1var __LiteMol_Plugin=function(){"use strict";/*! 2 * @overview es6-promise - a tiny implementation of Promises/A+. 3 * @copyright Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors (Conversion to ES6 API by Jake Archibald) 4 * @license Licensed under MIT license 5 * See https://raw.githubusercontent.com/jakearchibald/es6-promise/master/LICENSE 6 * @version 3.2.1 7 */ 8var e=function(e){"use strict";function t(e){return typeof e==="function"||typeof e==="object"&&e!==null}function r(e){return typeof e==="function"}function n(e){return typeof e==="object"&&e!==null}var i;if(!Array.isArray){i=function(e){return Object.prototype.toString.call(e)==="[object Array]"}}else{i=Array.isArray}var a=i;var o=0;var s;var u;var l=function e(t,r){w[o]=t;w[o+1]=r;o+=2;if(o===2){if(u){u(C)}else{E()}}};function c(e){u=e}function f(e){l=e}var h=typeof window!=="undefined"?window:undefined;var d=h||{};var p=d.MutationObserver||d.WebKitMutationObserver;var m=typeof self==="undefined"&&typeof process!=="undefined"&&{}.toString.call(process)==="[object process]";var v=typeof Uint8ClampedArray!=="undefined"&&typeof importScripts!=="undefined"&&typeof MessageChannel!=="undefined";function y(){return function(){process.nextTick(C)}}function g(){return function(){s(C)}}function b(){var e=0;var t=new p(C);var r=document.createTextNode("");t.observe(r,{characterData:true});return function(){r.data=e=++e%2}}function x(){var e=new MessageChannel;e.port1.onmessage=C;return function(){e.port2.postMessage(0)}}function _(){return function(){setTimeout(C,1)}}var w=new Array(1e3);function C(){for(var e=0;e<o;e+=2){var t=w[e];var r=w[e+1];t(r);w[e]=undefined;w[e+1]=undefined}o=0}var E;if(m){E=y()}else if(p){E=b()}else if(v){E=x()}else{E=_()}function S(e,t){var r=this;var n=new this.constructor(R);if(n[P]===undefined){te(n)}var i=r._state;if(i){var a=arguments[i-1];l(function(){Z(i,n,a,r._result)})}else{q(r,n,e,t)}return n}var T=S;function M(e){var t=this;if(e&&typeof e==="object"&&e.constructor===t){return e}var r=new t(R);H(r,e);return r}var A=M;var P=Math.random().toString(36).substring(16);function R(){}var k=void 0;var I=1;var D=2;var B=new Y;function L(){return new TypeError("You cannot resolve a promise with itself")}function F(){return new TypeError("A promises callback cannot return that same promise.")}function V(e){try{return e.then}catch(e){B.error=e;return B}}function O(e,t,r,n){try{e.call(t,r,n)}catch(e){return e}}function U(e,t,r){l(function(e){var n=false;var i=O(r,t,function(r){if(n){return}n=true;if(t!==r){H(e,r)}else{G(e,r)}},function(t){if(n){return}n=true;W(e,t)},"Settle: "+(e._label||" unknown promise"));if(!n&&i){n=true;W(e,i)}},e)}function N(e,t){if(t._state===I){G(e,t._result)}else if(t._state===D){W(e,t._result)}else{q(t,undefined,function(t){H(e,t)},function(t){W(e,t)})}}function z(e,t,n){if(t.constructor===e.constructor&&n===T&&constructor.resolve===A){N(e,t)}else{if(n===B){W(e,B.error)}else if(n===undefined){G(e,t)}else if(r(n)){U(e,t,n)}else{G(e,t)}}}function H(e,r){if(e===r){W(e,L())}else if(t(r)){z(e,r,V(r))}else{G(e,r)}}function j(e){if(e._onerror){e._onerror(e._result)}X(e)}function G(e,t){if(e._state!==k){return}e._result=t;e._state=I;if(e._subscribers.length!==0){l(X,e)}}function W(e,t){if(e._state!==k){return}e._state=D;e._result=t;l(j,e)}function q(e,t,r,n){var i=e._subscribers;var a=i.length;e._onerror=null;i[a]=t;i[a+I]=r;i[a+D]=n;if(a===0&&e._state){l(X,e)}}function X(e){var t=e._subscribers;var r=e._state;if(t.length===0){return}var n,i,a=e._result;for(var o=0;o<t.length;o+=3){n=t[o];i=t[o+r];if(n){Z(r,n,i,a)}else{i(a)}}e._subscribers.length=0}function Y(){this.error=null}var K=new Y;function Q(e,t){try{return e(t)}catch(e){K.error=e;return K}}function Z(e,t,n,i){var a=r(n),o,s,u,l;if(a){o=Q(n,i);if(o===K){l=true;s=o.error;o=null}else{u=true}if(t===o){W(t,F());return}}else{o=i;u=true}if(t._state!==k){}else if(a&&u){H(t,o)}else if(l){W(t,s)}else if(e===I){G(t,o)}else if(e===D){W(t,o)}}function J(e,t){try{t(function t(r){H(e,r)},function t(r){W(e,r)})}catch(t){W(e,t)}}var $=0;function ee(){return $++}function te(e){e[P]=$++;e._state=undefined;e._result=undefined;e._subscribers=[]}function re(e){return new he(this,e).promise}var ne=re;function ie(e){var t=this;if(!a(e)){return new t(function(e,t){t(new TypeError("You must pass an array to race."))})}else{return new t(function(r,n){var i=e.length;for(var a=0;a<i;a++){t.resolve(e[a]).then(r,n)}})}}var ae=ie;function oe(e){var t=this;var r=new t(R);W(r,e);return r}var se=oe;function ue(){throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")}function le(){throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object c
8onstructor cannot be called as a function.")}var ce=fe;function fe(e){this[P]=ee();this._result=this._state=undefined;this._subscribers=[];if(R!==e){typeof e!=="function"&&ue();this instanceof fe?J(this,e):le()}}fe.all=ne;fe.race=ae;fe.resolve=A;fe.reject=se;fe._setScheduler=c;fe._setAsap=f;fe._asap=l;fe.prototype={constructor:fe,then:T,catch:function(e){return this.then(null,e)}};var he=de;function de(e,t){this._instanceConstructor=e;this.promise=new e(R);if(!this.promise[P]){te(this.promise)}if(Array.isArray(t)){this._input=t;this.length=t.length;this._remaining=t.length;this._result=new Array(this.length);if(this.length===0){G(this.promise,this._result)}else{this.length=this.length||0;this._enumerate();if(this._remaining===0){G(this.promise,this._result)}}}else{W(this.promise,pe())}}function pe(){return new Error("Array Methods must be provided an Array")}de.prototype._enumerate=function(){var e=this.length;var t=this._input;for(var r=0;this._state===k&&r<e;r++){this._eachEntry(t[r],r)}};de.prototype._eachEntry=function(e,t){var r=this._instanceConstructor;var n=r.resolve;if(n===A){var i=V(e);if(i===T&&e._state!==k){this._settledAt(e._state,t,e._result)}else if(typeof i!=="function"){this._remaining--;this._result[t]=e}else if(r===ce){var a=new r(R);z(a,e,i);this._willSettleAt(a,t)}else{this._willSettleAt(new r(function(t){t(e)}),t)}}else{this._willSettleAt(n(e),t)}};de.prototype._settledAt=function(e,t,r){var n=this.promise;if(n._state===k){this._remaining--;if(e===D){W(n,r)}else{this._result[t]=r}}if(this._remaining===0){G(n,this._result)}};de.prototype._willSettleAt=function(e,t){var r=this;q(e,undefined,function(e){r._settledAt(I,t,e)},function(e){r._settledAt(D,t,e)})};function me(){var e;if(typeof global!=="undefined"){e=global}else if(typeof self!=="undefined"){e=self}else{try{e=Function("return this")()}catch(e){throw new Error("polyfill failed because global object is unavailable in this environment")}}var t=e.Promise;if(t&&Object.prototype.toString.call(t.resolve())==="[object Promise]"&&!t.cast){return}e.Promise=ce}var ve=me;var ye={Promise:ce,polyfill:ve};ve();e.ES6Promise=ye};var t;if(typeof window!=="undefined"&&window&&window.Promise){t=window.Promise}else if(typeof global!=="undefined"&&global&&global.Promise){t=global.Promise}else{var r={};e(r);t=r.ES6Promise.Promise} 9// Copyright (c) Microsoft, All rights reserved. See License.txt in the project root for license information. 10/* 11 * Copyright (c) Microsoft. All rights reserved. 12Microsoft Open Technologies would like to thank its contributors, a list 13of whom are at http://rx.codeplex.com/wikipage?title=Contributors. 14 15Licensed under the Apache License, Version 2.0 (the "License"); you 16may not use this file except in compliance with the License. You may 17obtain a copy of the License at 18 19http://www.apache.org/licenses/LICENSE-2.0 20 21Unless required by applicable law or agreed to in writing, software 22distributed under the License is distributed on an "AS IS" BASIS, 23WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 24implied. See the License for the specific language governing permissions 25and limitations under the License. 26 * 27 */ 28var n={};(function(e,t,r){var n={function:true,object:true};function i(e){return e&&e.Object===Object?e:null}var a=n[typeof exports]&&exports&&!exports.nodeType?exports:null;var o=n[typeof module]&&module&&!module.nodeType?module:null;var s=i(a&&o&&typeof global==="object"&&global);var u=i(n[typeof self]&&self);var l=i(n[typeof window]&&window);var c=o&&o.exports===a?a:null;var f=i(n[typeof this]&&this);var h=s||l!==(f&&f.window)&&l||u||f||Function("return this")();var d={internals:{},config:{Promise:t},helpers:{}};var p=d.helpers.noop=function(){},m=d.helpers.identity=function(e){return e},v=d.helpers.defaultNow=Date.now,y=d.helpers.defaultComparer=function(e,t){return Ne(e,t)},g=d.helpers.defaultSubComparer=function(e,t){return e>t?1:e<t?-1:0},b=d.helpers.defaultKeySerializer=function(e){return e.toString()},x=d.helpers.defaultError=function(e){throw e},_=d.helpers.isPromise=function(e){return!!e&&typeof e.subscribe!=="function"&&typeof e.then==="function"},w=d.helpers.isFunction=function(){var e=function(e){return typeof e=="function"||false};if(e(/x/)){e=function(e){return typeof e=="function"&&toString.call(e)=="[object Function]"}}return e}();function C(e){var t=e.length,r=new Array(t);for(var n=0;n<t;n++){r[n]=e[n]}return r}var E={e:{}};function S(e){return function t(){try{return e.apply(this,arguments)}catch(e){E.e=e;return E}}}var T=d.internals.tryCatch=function e(t){if(!w(t)){throw new TypeError("fn must be a function")}return S(t)};function M(e){throw e}d.config.longStackSupport=false;var A=false,P=T(function(){throw new Error})();A=!!P.e&&!!P.e.stack;var R=V(),k;var I="From previous event:";function D(e,t){if(A&&t.stack&&typeof e==="object"&&e!==null&&e.stack&&e.stack.indexOf(I)===-1){var r=[];for(var n=t;!!n;
28n=n.source){if(n.stack){r.unshift(n.stack)}}r.unshift(e.stack);var i=r.join("\n"+I+"\n");e.stack=B(i)}}function B(e){var t=e.split("\n"),r=[];for(var n=0,i=t.length;n<i;n++){var a=t[n];if(!L(a)&&!F(a)&&a){r.push(a)}}return r.join("\n")}function L(e){var t=O(e);if(!t){return false}var r=t[0],n=t[1];return r===k&&n>=R&&n<=Ri}function F(e){return e.indexOf("(module.js:")!==-1||e.indexOf("(node.js:")!==-1}function V(){if(!A){return}try{throw new Error}catch(n){var e=n.stack.split("\n");var t=e[0].indexOf("@")>0?e[1]:e[2];var r=O(t);if(!r){return}k=r[0];return r[1]}}function O(e){var t=/at .+ \((.+):(\d+):(?:\d+)\)$/.exec(e);if(t){return[t[1],Number(t[2])]}var r=/at ([^ ]+):(\d+):(?:\d+)$/.exec(e);if(r){return[r[1],Number(r[2])]}var n=/.*@(.+):(\d+)$/.exec(e);if(n){return[n[1],Number(n[2])]}}var U=d.EmptyError=function(){this.message="Sequence contains no elements.";Error.call(this)};U.prototype=Object.create(Error.prototype);U.prototype.name="EmptyError";var N=d.ObjectDisposedError=function(){this.message="Object has been disposed";Error.call(this)};N.prototype=Object.create(Error.prototype);N.prototype.name="ObjectDisposedError";var z=d.ArgumentOutOfRangeError=function(){this.message="Argument out of range";Error.call(this)};z.prototype=Object.create(Error.prototype);z.prototype.name="ArgumentOutOfRangeError";var H=d.NotSupportedError=function(e){this.message=e||"This operation is not supported";Error.call(this)};H.prototype=Object.create(Error.prototype);H.prototype.name="NotSupportedError";var j=d.NotImplementedError=function(e){this.message=e||"This operation is not implemented";Error.call(this)};j.prototype=Object.create(Error.prototype);j.prototype.name="NotImplementedError";var G=d.helpers.notImplemented=function(){throw new j};var W=d.helpers.notSupported=function(){throw new H};var q=typeof Symbol==="function"&&Symbol.iterator||"_es6shim_iterator_";if(h.Set&&typeof(new h.Set)["@@iterator"]==="function"){q="@@iterator"}var X=d.doneEnumerator={done:true,value:r};var Y=d.helpers.isIterable=function(e){return e&&e[q]!==r};var K=d.helpers.isArrayLike=function(e){return e&&e.length!==r};d.helpers.iterator=q;var Q=d.internals.bindCallback=function(e,t,r){if(typeof t==="undefined"){return e}switch(r){case 0:return function(){return e.call(t)};case 1:return function(r){return e.call(t,r)};case 2:return function(r,n){return e.call(t,r,n)};case 3:return function(r,n,i){return e.call(t,r,n,i)}}return function(){return e.apply(t,arguments)}};var Z=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],J=Z.length;var $="[object Arguments]",ee="[object Array]",te="[object Boolean]",re="[object Date]",ne="[object Error]",ie="[object Function]",ae="[object Map]",oe="[object Number]",se="[object Object]",ue="[object RegExp]",le="[object Set]",ce="[object String]",fe="[object WeakMap]";var he="[object ArrayBuffer]",de="[object Float32Array]",pe="[object Float64Array]",me="[object Int8Array]",ve="[object Int16Array]",ye="[object Int32Array]",ge="[object Uint8Array]",be="[object Uint8ClampedArray]",xe="[object Uint16Array]",_e="[object Uint32Array]";var we={};we[de]=we[pe]=we[me]=we[ve]=we[ye]=we[ge]=we[be]=we[xe]=we[_e]=true;we[$]=we[ee]=we[he]=we[te]=we[re]=we[ne]=we[ie]=we[ae]=we[oe]=we[se]=we[ue]=we[le]=we[ce]=we[fe]=false;var Ce=Object.prototype,Ee=Ce.hasOwnProperty,Se=Ce.toString,Te=Math.pow(2,53)-1;var Me=Object.keys||function(){var e=Object.prototype.hasOwnProperty,t=!{toString:null}.propertyIsEnumerable("toString"),r=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],n=r.length;return function(i){if(typeof i!=="object"&&(typeof i!=="function"||i===null)){throw new TypeError("Object.keys called on non-object")}var a=[],o,s;for(o in i){if(e.call(i,o)){a.push(o)}}if(t){for(s=0;s<n;s++){if(e.call(i,r[s])){a.push(r[s])}}}return a}}();function Ae(e,t,n,i,a,o){var s=Me(e),u=s.length,l=Me(t),c=l.length;if(u!==c&&!i){return false}var f=u,h;while(f--){h=s[f];if(!(i?h in t:Ee.call(t,h))){return false}}var d=i;while(++f<u){h=s[f];var p=e[h],m=t[h],v;if(!(v===r?n(p,m,i,a,o):v)){return false}d||(d=h==="constructor")}if(!d){var y=e.constructor,g=t.constructor;if(y!==g&&("constructor"in e&&"constructor"in t)&&!(typeof y==="function"&&y instanceof y&&typeof g==="function"&&g instanceof g)){return false}}return true}function Pe(e,t,r){switch(r){case te:case re:return+e===+t;case ne:return e.name===t.name&&e.message===t.message;case oe:return e!==+e?t!==+t:e===+t;case ue:case ce:return e===t+""}return false}var Re=d.internals.isObject=function(e){var t=typeof e;return!!e&&(t==="object"||t==="function")};function ke(e){return!!e&&typeof e==="object"}function Ie(e){return typeof e==="number"&&e>-1&&e%1===0&&e<=Te}var De=function(){try{Object({toString:0}+"")}catch(e){return function(){return false}}return function(e){return typeof e.toString!=="function"&&typeof(e+"")==="string"}}();function Be(e){return ke(e)&&Ie(e.length)&&!!we[Se.call(e)]}var Le=Array.isArray||function(e){return ke(e)&&Ie(e.length)&&Se.call(e)===ee};function Fe(e,t){var r=-1,n=e.length;while(++r<n){if(t(e[r],r,e)){return true}}return false}function Ve(e,t,n,i,a,o){var s=-1,u=e.length,l=t.length;if(u!==l&&!(i&&l>u)){return false}while(++s<u){var c=e[s],f=t[s],h;if(h!==r){if(h){continue}return false}if(i){if(!Fe(t,function(e){return c===e||n(c,e,i,a,o)})){return false}}else if(!(c===f||n(c,f,i,a,o))){return false}}return true}function Oe(e,t,r,n,i,a){var o=Le(e),s=Le(t),u=ee,l=ee;if(!o){u=Se.call(e);
28if(u===$){u=se}else if(u!==se){o=Be(e)}}if(!s){l=Se.call(t);if(l===$){l=se}}var c=u===se&&!De(e),f=l===se&&!De(t),h=u===l;if(h&&!(o||c)){return Pe(e,t,u)}if(!n){var d=c&&Ee.call(e,"__wrapped__"),p=f&&Ee.call(t,"__wrapped__");if(d||p){return r(d?e.value():e,p?t.value():t,n,i,a)}}if(!h){return false}i||(i=[]);a||(a=[]);var m=i.length;while(m--){if(i[m]===e){return a[m]===t}}i.push(e);a.push(t);var v=(o?Ve:Ae)(e,t,r,n,i,a);i.pop();a.pop();return v}function Ue(e,t,r,n,i){if(e===t){return true}if(e==null||t==null||!Re(e)&&!ke(t)){return e!==e&&t!==t}return Oe(e,t,Ue,r,n,i)}var Ne=d.internals.isEqual=function(e,t){return Ue(e,t)};var ze={}.hasOwnProperty,He=Array.prototype.slice;var je=d.internals.inherits=function(e,t){function r(){this.constructor=e}r.prototype=t.prototype;e.prototype=new r};var Ge=d.internals.addProperties=function(e){for(var t=[],r=1,n=arguments.length;r<n;r++){t.push(arguments[r])}for(var i=0,a=t.length;i<a;i++){var o=t[i];for(var s in o){e[s]=o[s]}}};var We=d.internals.addRef=function(e,t){return new wi(function(r){return new nt(t.getDisposable(),e.subscribe(r))})};function qe(e,t){var r=new Array(e);for(var n=0;n<e;n++){r[n]=t()}return r}var Xe=d.CompositeDisposable=function(){var e=[],t,r;if(Array.isArray(arguments[0])){e=arguments[0]}else{r=arguments.length;e=new Array(r);for(t=0;t<r;t++){e[t]=arguments[t]}}this.disposables=e;this.isDisposed=false;this.length=e.length};var Ye=Xe.prototype;Ye.add=function(e){if(this.isDisposed){e.dispose()}else{this.disposables.push(e);this.length++}};Ye.remove=function(e){var t=false;if(!this.isDisposed){var r=this.disposables.indexOf(e);if(r!==-1){t=true;this.disposables.splice(r,1);this.length--;e.dispose()}}return t};Ye.dispose=function(){if(!this.isDisposed){this.isDisposed=true;var e=this.disposables.length,t=new Array(e);for(var r=0;r<e;r++){t[r]=this.disposables[r]}this.disposables=[];this.length=0;for(r=0;r<e;r++){t[r].dispose()}}};var Ke=d.Disposable=function(e){this.isDisposed=false;this.action=e||p};Ke.prototype.dispose=function(){if(!this.isDisposed){this.action();this.isDisposed=true}};var Qe=Ke.create=function(e){return new Ke(e)};var Ze=Ke.empty={dispose:p};var Je=Ke.isDisposable=function(e){return e&&w(e.dispose)};var $e=Ke.checkDisposed=function(e){if(e.isDisposed){throw new N}};var et=Ke._fixup=function(e){return Je(e)?e:Ze};var tt=d.SingleAssignmentDisposable=function(){this.isDisposed=false;this.current=null};tt.prototype.getDisposable=function(){return this.current};tt.prototype.setDisposable=function(e){if(this.current){throw new Error("Disposable has already been assigned")}var t=this.isDisposed;!t&&(this.current=e);t&&e&&e.dispose()};tt.prototype.dispose=function(){if(!this.isDisposed){this.isDisposed=true;var e=this.current;this.current=null;e&&e.dispose()}};var rt=d.SerialDisposable=function(){this.isDisposed=false;this.current=null};rt.prototype.getDisposable=function(){return this.current};rt.prototype.setDisposable=function(e){var t=this.isDisposed;if(!t){var r=this.current;this.current=e}r&&r.dispose();t&&e&&e.dispose()};rt.prototype.dispose=function(){if(!this.isDisposed){this.isDisposed=true;var e=this.current;this.current=null}e&&e.dispose()};var nt=d.BinaryDisposable=function(e,t){this._first=e;this._second=t;this.isDisposed=false};nt.prototype.dispose=function(){if(!this.isDisposed){this.isDisposed=true;var e=this._first;this._first=null;e&&e.dispose();var t=this._second;this._second=null;t&&t.dispose()}};var it=d.NAryDisposable=function(e){this._disposables=e;this.isDisposed=false};it.prototype.dispose=function(){if(!this.isDisposed){this.isDisposed=true;for(var e=0,t=this._disposables.length;e<t;e++){this._disposables[e].dispose()}this._disposables.length=0}};var at=d.RefCountDisposable=function(){function e(e){this.disposable=e;this.disposable.count++;this.isInnerDisposed=false}e.prototype.dispose=function(){if(!this.disposable.isDisposed&&!this.isInnerDisposed){this.isInnerDisposed=true;this.disposable.count--;if(this.disposable.count===0&&this.disposable.isPrimaryDisposed){this.disposable.isDisposed=true;this.disposable.underlyingDisposable.dispose()}}};function t(e){this.underlyingDisposable=e;this.isDisposed=false;this.isPrimaryDisposed=false;this.count=0}t.prototype.dispose=function(){if(!this.isDisposed&&!this.isPrimaryDisposed){this.isPrimaryDisposed=true;if(this.count===0){this.isDisposed=true;this.underlyingDisposable.dispose()}}};t.prototype.getDisposable=function(){return this.isDisposed?Ze:new e(this)};return t}();var ot=d.internals.ScheduledItem=function(e,t,r,n,i){this.scheduler
28=e;this.state=t;this.action=r;this.dueTime=n;this.comparer=i||g;this.disposable=new tt};ot.prototype.invoke=function(){this.disposable.setDisposable(this.invokeCore())};ot.prototype.compareTo=function(e){return this.comparer(this.dueTime,e.dueTime)};ot.prototype.isCancelled=function(){return this.disposable.isDisposed};ot.prototype.invokeCore=function(){return et(this.action(this.scheduler,this.state))};var st=d.Scheduler=function(){function e(){}e.isScheduler=function(t){return t instanceof e};var t=e.prototype;t.schedule=function(e,t){throw new j};t.scheduleFuture=function(t,r,n){var i=r;i instanceof Date&&(i=i-this.now());i=e.normalize(i);if(i===0){return this.schedule(t,n)}return this._scheduleFuture(t,i,n)};t._scheduleFuture=function(e,t,r){throw new j};e.now=v;e.prototype.now=v;e.normalize=function(e){e<0&&(e=0);return e};return e}();var ut=st.normalize,lt=st.isScheduler;(function(e){function t(e,t){var r=t[0],n=t[1],i=new Xe;n(r,a);return i;function a(t){var r=false,o=false;var s=e.schedule(t,u);if(!o){i.add(s);r=true}function u(e,t){if(r){i.remove(s)}else{o=true}n(t,a);return Ze}}}function r(e,t){var r=t[0],n=t[1],i=new Xe;n(r,a);return i;function a(t,r){var o=false,s=false;var u=e.scheduleFuture(t,r,l);if(!s){i.add(u);o=true}function l(e,t){if(o){i.remove(u)}else{s=true}n(t,a);return Ze}}}e.scheduleRecursive=function(e,r){return this.schedule([e,r],t)};e.scheduleRecursiveFuture=function(e,t,n){return this.scheduleFuture([e,n],t,r)}})(st.prototype);(function(e){e.schedulePeriodic=function(e,t,r){if(typeof h.setInterval==="undefined"){throw new H}t=ut(t);var n=e,i=h.setInterval(function(){n=r(n)},t);return Qe(function(){h.clearInterval(i)})}})(st.prototype);var ct=function(e){je(t,e);function t(){e.call(this)}t.prototype.schedule=function(e,t){return et(t(this,e))};return t}(st);var ft=st.immediate=new ct;var ht=function(e){var t;function r(){while(t.length>0){var e=t.dequeue();!e.isCancelled()&&e.invoke()}}je(n,e);function n(){e.call(this)}n.prototype.schedule=function(e,n){var i=new ot(this,e,n,this.now());if(!t){t=new Ct(4);t.enqueue(i);var a=T(r)();t=null;if(a===E){M(a.e)}}else{t.enqueue(i)}return i.disposable};n.prototype.scheduleRequired=function(){return!t};return n}(st);var dt=st.currentThread=new ht;var pt=d.internals.SchedulePeriodicRecursive=function(){function e(e){return function t(r,n){n(0,e._period);var i=T(e._action)(e._state);if(i===E){e._cancel.dispose();M(i.e)}e._state=i}}function t(e,t,r,n){this._scheduler=e;this._state=t;this._period=r;this._action=n}t.prototype.start=function(){var t=new tt;this._cancel=t;t.setDisposable(this._scheduler.scheduleRecursiveFuture(0,this._period,e(this)));return t};return t}();var mt,vt;var yt=function(){var e,t=p;if(!!h.setTimeout){e=h.setTimeout;t=h.clearTimeout}else if(!!h.WScript){e=function(e,t){h.WScript.Sleep(t);e()}}else{throw new H}return{setTimeout:e,clearTimeout:t}}();var gt=yt.setTimeout,bt=yt.clearTimeout;(function(){var e=1,t={},r=false;vt=function(e){delete t[e]};function n(e){if(r){gt(function(){n(e)},0)}else{var i=t[e];if(i){r=true;var a=T(i)();vt(e);r=false;if(a===E){M(a.e)}}}}var i=new RegExp("^"+String(toString).replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/toString| for [^\]]+/g,".*?")+"$");var a=typeof(a=s&&c&&s.setImmediate)=="function"&&!i.test(a)&&a;function o(){if(!h.postMessage||h.importScripts){return false}var e=false,t=h.onmessage;h.onmessage=function(){e=true};h.postMessage("","*");h.onmessage=t;return e}if(w(a)){mt=function(r){var i=e++;t[i]=r;a(function(){n(i)});return i}}else if(typeof process!=="undefined"&&{}.toString.call(process)==="[object process]"){mt=function(r){var i=e++;t[i]=r;process.nextTick(function(){n(i)});return i}}else if(o()){var u="ms.rx.schedule"+Math.random();var l=function(e){if(typeof e.data==="string"&&e.data.substring(0,u.length)===u){n(e.data.substring(u.length))}};h.addEventListener("message",l,false);mt=function(r){var n=e++;t[n]=r;h.postMessage(u+n,"*");return n}}else if(!!h.MessageChannel){var f=new h.MessageChannel;f.port1.onmessage=function(e){n(e.data)};mt=function(r){var n=e++;t[n]=r;f.port2.postMessage(n);return n}}else if("document"in h&&"onreadystatechange"in h.document.createElement("script")){mt=function(r){var i=h.document.createElement("script");var a=e++;t[a]=r;i.onreadystatechange=function(){n(a);i.onreadystatechange=null;i.parentNode.removeChild(i);i=null};h.document.documentElement.appendChild(i);return a}}else{mt=function(r){var i=e++;t[i]=r;gt(function(){n(i)},0);return i}}})();var xt=function(e){je(t,e);function t(){e.call(this)}function r(e,t,r,n){return function i(){e.setDisposable(Ke._fixup(t(r,n)))}}function n(e){this._id=e;this.isDisposed=false}n.prototype.dispose=function(){if(!this.isDisposed){this.isDisposed=true;vt(this._id)}};function i(e){this._id=e;this.isDisposed=false}i.prototype.dispose=function(){if(!this.isDisposed){this.isDisposed=true;bt(this._id)}};t.prototype.schedule=function(e,t){var i=new tt,a=mt(r(i,t,this,e));return new nt(i,new n(a))};t.prototype._scheduleFuture=function(e,t,n){if(t===0){return this.schedule(e,n)}var a=new tt,o=gt(r(a,n,this,e),t);return new nt(a,new i(o))};function a(e,t,r){return function(){t(e,r)}}t.prototype.scheduleLongRunning=function(e,t){var r=Qe(p);mt(a(e,t,r));return r};return t}(st);var _t=st["default"]=st.async=new xt;function wt(e,t){this.id=e;this.value=t}wt.prototype.compareTo=function(e){var t=this.value.compareTo(e.value);t===0&&(t=this.id-e.id);return t};var Ct=d.internals.PriorityQueue=function(e){this.items=new Array(e);this.length=0};var Et=Ct.prototype;Et.isHigherPriority=function(e,t){return this.items[e].compareTo(this.items[t])<0};Et.percolate=function(e){if(e>=this.length||e<0){return}var t=e-1>>1;
28if(t<0||t===e){return}if(this.isHigherPriority(e,t)){var r=this.items[e];this.items[e]=this.items[t];this.items[t]=r;this.percolate(t)}};Et.heapify=function(e){+e||(e=0);if(e>=this.length||e<0){return}var t=2*e+1,r=2*e+2,n=e;if(t<this.length&&this.isHigherPriority(t,n)){n=t}if(r<this.length&&this.isHigherPriority(r,n)){n=r}if(n!==e){var i=this.items[e];this.items[e]=this.items[n];this.items[n]=i;this.heapify(n)}};Et.peek=function(){return this.items[0].value};Et.removeAt=function(e){this.items[e]=this.items[--this.length];this.items[this.length]=r;this.heapify()};Et.dequeue=function(){var e=this.peek();this.removeAt(0);return e};Et.enqueue=function(e){var t=this.length++;this.items[t]=new wt(Ct.count++,e);this.percolate(t)};Et.remove=function(e){for(var t=0;t<this.length;t++){if(this.items[t].value===e){this.removeAt(t);return true}}return false};Ct.count=0;var St=d.Notification=function(){function e(){}e.prototype._accept=function(e,t,r){throw new j};e.prototype._acceptObserver=function(e,t,r){throw new j};e.prototype.accept=function(e,t,r){return e&&typeof e==="object"?this._acceptObserver(e):this._accept(e,t,r)};e.prototype.toObservable=function(e){var t=this;lt(e)||(e=ft);return new wi(function(r){return e.schedule(t,function(e,t){t._acceptObserver(r);t.kind==="N"&&r.onCompleted()})})};return e}();var Tt=function(e){je(t,e);function t(e){this.value=e;this.kind="N"}t.prototype._accept=function(e){return e(this.value)};t.prototype._acceptObserver=function(e){return e.onNext(this.value)};t.prototype.toString=function(){return"OnNext("+this.value+")"};return t}(St);var Mt=function(e){je(t,e);function t(e){this.error=e;this.kind="E"}t.prototype._accept=function(e,t){return t(this.error)};t.prototype._acceptObserver=function(e){return e.onError(this.error)};t.prototype.toString=function(){return"OnError("+this.error+")"};return t}(St);var At=function(e){je(t,e);function t(){this.kind="C"}t.prototype._accept=function(e,t,r){return r()};t.prototype._acceptObserver=function(e){return e.onCompleted()};t.prototype.toString=function(){return"OnCompleted()"};return t}(St);var Pt=St.createOnNext=function(e){return new Tt(e)};var Rt=St.createOnError=function(e){return new Mt(e)};var kt=St.createOnCompleted=function(){return new At};var It=d.Observer=function(){};var Dt=It.create=function(e,t,r){e||(e=p);t||(t=x);r||(r=p);return new Lt(e,t,r)};var Bt=d.internals.AbstractObserver=function(e){je(t,e);function t(){this.isStopped=false}t.prototype.next=G;t.prototype.error=G;t.prototype.completed=G;t.prototype.onNext=function(e){!this.isStopped&&this.next(e)};t.prototype.onError=function(e){if(!this.isStopped){this.isStopped=true;this.error(e)}};t.prototype.onCompleted=function(){if(!this.isStopped){this.isStopped=true;this.completed()}};t.prototype.dispose=function(){this.isStopped=true};t.prototype.fail=function(e){if(!this.isStopped){this.isStopped=true;this.error(e);return true}return false};return t}(It);var Lt=d.AnonymousObserver=function(e){je(t,e);function t(t,r,n){e.call(this);this._onNext=t;this._onError=r;this._onCompleted=n}t.prototype.next=function(e){this._onNext(e)};t.prototype.error=function(e){this._onError(e)};t.prototype.completed=function(){this._onCompleted()};return t}(Bt);var Ft;var Vt=d.Observable=function(){function e(e,t){return function(r){var n=r.onError;r.onError=function(t){D(t,e);n.call(r,t)};return t.call(e,r)}}function t(){if(d.config.longStackSupport&&A){var t=this._subscribe;var r=T(M)(new Error).e;this.stack=r.stack.substring(r.stack.indexOf("\n")+1);this._subscribe=e(this,t)}}Ft=t.prototype;t.isObservable=function(e){return e&&w(e.subscribe)};Ft.subscribe=Ft.forEach=function(e,t,r){return this._subscribe(typeof e==="object"?e:Dt(e,t,r))};Ft.subscribeOnNext=function(e,t){return this._subscribe(Dt(typeof t!=="undefined"?function(r){e.call(t,r)}:e))};Ft.subscribeOnError=function(e,t){return this._subscribe(Dt(null,typeof t!=="undefined"?function(r){e.call(t,r)}:e))};Ft.subscribeOnCompleted=function(e,t){return this._subscribe(Dt(null,null,typeof t!=="undefined"?function(){e.call(t)}:e))};return t}();var Ot=d.internals.ScheduledObserver=function(e){je(t,e);function t(t,r){e.call(this);
28this.scheduler=t;this.observer=r;this.isAcquired=false;this.hasFaulted=false;this.queue=[];this.disposable=new rt}function r(e,t){return function(){e.onNext(t)}}function n(e,t){return function(){e.onError(t)}}function i(e){return function(){e.onCompleted()}}t.prototype.next=function(e){this.queue.push(r(this.observer,e))};t.prototype.error=function(e){this.queue.push(n(this.observer,e))};t.prototype.completed=function(){this.queue.push(i(this.observer))};function a(e,t){var r;if(e.queue.length>0){r=e.queue.shift()}else{e.isAcquired=false;return}var n=T(r)();if(n===E){e.queue=[];e.hasFaulted=true;return M(n.e)}t(e)}t.prototype.ensureActive=function(){var e=false;if(!this.hasFaulted&&this.queue.length>0){e=!this.isAcquired;this.isAcquired=true}e&&this.disposable.setDisposable(this.scheduler.scheduleRecursive(this,a))};t.prototype.dispose=function(){e.prototype.dispose.call(this);this.disposable.dispose()};return t}(Bt);var Ut=d.ObservableBase=function(e){je(n,e);function t(e){return e&&w(e.dispose)?e:w(e)?Qe(e):Ze}function r(e,r){var n=r[0],i=r[1];var a=T(i.subscribeCore).call(i,n);if(a===E&&!n.fail(E.e)){M(E.e)}n.setDisposable(t(a))}function n(){e.call(this)}n.prototype._subscribe=function(e){var t=new Ci(e),n=[t,this];if(dt.scheduleRequired()){dt.schedule(n,r)}else{r(null,n)}return t};n.prototype.subscribeCore=G;return n}(Vt);var Nt=d.FlatMapObservable=function(e){je(t,e);function t(t,r,n,i){this.resultSelector=w(n)?n:null;this.selector=Q(w(r)?r:function(){return r},i,3);this.source=t;e.call(this)}t.prototype.subscribeCore=function(e){return this.source.subscribe(new r(e,this.selector,this.resultSelector,this))};je(r,Bt);function r(e,t,r,n){this.i=0;this.selector=t;this.resultSelector=r;this.source=n;this.o=e;Bt.call(this)}r.prototype._wrapResult=function(e,t,r){return this.resultSelector?e.map(function(e,n){return this.resultSelector(t,e,r,n)},this):e};r.prototype.next=function(e){var t=this.i++;var r=T(this.selector)(e,t,this.source);if(r===E){return this.o.onError(r.e)}_(r)&&(r=Wn(r));(K(r)||Y(r))&&(r=Vt.from(r));this.o.onNext(this._wrapResult(r,e,t))};r.prototype.error=function(e){this.o.onError(e)};r.prototype.completed=function(){this.o.onCompleted()};return t}(Ut);var zt=d.internals.Enumerable=function(){};function Ht(e){this._s=e;this.isDisposed=false}Ht.prototype.dispose=function(){if(!this.isDisposed){this.isDisposed=true;this._s.isDisposed=true}};var jt=function(e){je(t,e);function t(t){this.sources=t;e.call(this)}function r(e,t){if(e.isDisposed){return}var r=T(e.e.next).call(e.e);if(r===E){return e.o.onError(r.e)}if(r.done){return e.o.onCompleted()}var i=r.value;_(i)&&(i=Wn(i));var a=new tt;e.subscription.setDisposable(a);a.setDisposable(i.subscribe(new n(e,t)))}t.prototype.subscribeCore=function(e){var t=new rt;var n={isDisposed:false,o:e,subscription:t,e:this.sources[q]()};var i=dt.scheduleRecursive(n,r);return new it([t,i,new Ht(n)])};function n(e,t){this._state=e;this._recurse=t;Bt.call(this)}je(n,Bt);n.prototype.next=function(e){this._state.o.onNext(e)};n.prototype.error=function(e){this._state.o.onError(e)};n.prototype.completed=function(){this._recurse(this._state)};return t}(Ut);zt.prototype.concat=function(){return new jt(this)};var Gt=function(e){function t(t){this.sources=t;e.call(this)}je(t,e);function r(e,t){if(e.isDisposed){return}var r=T(e.e.next).call(e.e);if(r===E){return e.o.onError(r.e)}if(r.done){return e.lastError!==null?e.o.onError(e.lastError):e.o.onCompleted()}var i=r.value;_(i)&&(i=Wn(i));var a=new tt;e.subscription.setDisposable(a);a.setDisposable(i.subscribe(new n(e,t)))}t.prototype.subscribeCore=function(e){var t=new rt;var n={isDisposed:false,e:this.sources[q](),subscription:t,lastError:null,o:e};
28var i=dt.scheduleRecursive(n,r);return new it([t,i,new Ht(n)])};function n(e,t){this._state=e;this._recurse=t;Bt.call(this)}je(n,Bt);n.prototype.next=function(e){this._state.o.onNext(e)};n.prototype.error=function(e){this._state.lastError=e;this._recurse(this._state)};n.prototype.completed=function(){this._state.o.onCompleted()};return t}(Ut);zt.prototype.catchError=function(){return new Gt(this)};var Wt=function(e){je(t,e);function t(e,t){this.v=e;this.c=t==null?-1:t}t.prototype[q]=function(){return new r(this)};function r(e){this.v=e.v;this.l=e.c}r.prototype.next=function(){if(this.l===0){return X}if(this.l>0){this.l--}return{done:false,value:this.v}};return t}(zt);var qt=zt.repeat=function(e,t){return new Wt(e,t)};var Xt=function(e){je(t,e);function t(e,t,r){this.s=e;this.fn=t?Q(t,r,3):null}t.prototype[q]=function(){return new r(this)};function r(e){this.i=-1;this.s=e.s;this.l=this.s.length;this.fn=e.fn}r.prototype.next=function(){return++this.i<this.l?{done:false,value:!this.fn?this.s[this.i]:this.fn(this.s[this.i],this.i,this.s)}:X};return t}(zt);var Yt=zt.of=function(e,t,r){return new Xt(e,t,r)};var Kt=function(e){je(t,e);function t(t){this.source=t;e.call(this)}t.prototype.subscribeCore=function(e){return this.source.subscribe(new r(e))};je(r,Bt);function r(e){this.o=e;this.a=[];Bt.call(this)}r.prototype.next=function(e){this.a.push(e)};r.prototype.error=function(e){this.o.onError(e)};r.prototype.completed=function(){this.o.onNext(this.a);this.o.onCompleted()};return t}(Ut);Ft.toArray=function(){return new Kt(this)};Vt.create=function(e,t){return new wi(e,t)};var Qt=function(e){je(t,e);function t(t){this._f=t;e.call(this)}t.prototype.subscribeCore=function(e){var t=T(this._f)();if(t===E){return Tr(t.e).subscribe(e)}_(t)&&(t=Wn(t));return t.subscribe(e)};return t}(Ut);var Zt=Vt.defer=function(e){return new Qt(e)};var Jt=function(e){je(t,e);function t(t){this.scheduler=t;e.call(this)}t.prototype.subscribeCore=function(e){var t=new r(e,this.scheduler);return t.run()};function r(e,t){this.observer=e;this.scheduler=t}function n(e,t){t.onCompleted();return Ze}r.prototype.run=function(){var e=this.observer;return this.scheduler===ft?n(null,e):this.scheduler.schedule(e,n)};return t}(Ut);var $t=new Jt(ft);var er=Vt.empty=function(e){lt(e)||(e=ft);return e===ft?$t:new Jt(e)};var tr=function(e){je(t,e);function t(t,r,n){this._iterable=t;this._fn=r;this._scheduler=n;e.call(this)}function r(e,t,r){return function n(i,a){var o=T(t.next).call(t);if(o===E){return e.onError(o.e)}if(o.done){return e.onCompleted()}var s=o.value;if(w(r)){s=T(r)(s,i);if(s===E){return e.onError(s.e)}}e.onNext(s);a(i+1)}}t.prototype.subscribeCore=function(e){var t=Object(this._iterable),n=lr(t);return this._scheduler.scheduleRecursive(0,r(e,n,this._fn))};return t}(Ut);var rr=Math.pow(2,53)-1;function nr(e){this._s=e}nr.prototype[q]=function(){return new ir(this._s)};function ir(e){this._s=e;this._l=e.length;this._i=0}ir.prototype[q]=function(){return this};ir.prototype.next=function(){return this._i<this._l?{done:false,value:this._s.charAt(this._i++)}:X};function ar(e){this._a=e}ar.prototype[q]=function(){return new or(this._a)};function or(e){this._a=e;this._l=fr(e);this._i=0}or.prototype[q]=function(){return this};or.prototype.next=function(){return this._i<this._l?{done:false,value:this._a[this._i++]}:X};function sr(e){return typeof e==="number"&&h.isFinite(e)}function ur(e){return e!==e}function lr(e){var t=e[q],n;if(!t&&typeof e==="string"){n=new nr(e);return n[q]()}if(!t&&e.length!==r){n=new ar(e);return n[q]()}if(!t){throw new TypeError("Object is not iterable")}return e[q]()}function cr(e){var t=+e;if(t===0){return t}if(isNaN(t)){return t}return t<0?-1:1}function fr(e){var t=+e.length;if(isNaN(t)){return 0}if(t===0||!sr(t)){return t}t=cr(t)*Math.floor(Math.abs(t));if(t<=0){return 0}if(t>rr){return rr}return t}var hr=Vt.from=function(e,t,r,n){if(e==null){throw new Error("iterable cannot be null.")}if(t&&!w(t)){throw new Error("mapFn when provided must be a function")}if(t){var i=Q(t,r,2)}lt(n)||(n=dt);return new tr(e,i,n)};var dr=function(e){je(t,e);function t(t,r){this._args=t;
28this._scheduler=r;e.call(this)}function r(e,t){var r=t.length;return function n(i,a){if(i<r){e.onNext(t[i]);a(i+1)}else{e.onCompleted()}}}t.prototype.subscribeCore=function(e){return this._scheduler.scheduleRecursive(0,r(e,this._args))};return t}(Ut);var pr=Vt.fromArray=function(e,t){lt(t)||(t=dt);return new dr(e,t)};var mr=function(e){je(t,e);function t(){e.call(this)}t.prototype.subscribeCore=function(e){return Ze};return t}(Ut);var vr=new mr;var yr=Vt.never=function(){return vr};function gr(e,t){lt(e)||(e=dt);return new dr(t,e)}Vt.of=function(){var e=arguments.length,t=new Array(e);for(var r=0;r<e;r++){t[r]=arguments[r]}return new dr(t,dt)};Vt.ofWithScheduler=function(e){var t=arguments.length,r=new Array(t-1);for(var n=1;n<t;n++){r[n-1]=arguments[n]}return new dr(r,e)};var br=function(e){je(t,e);function t(t,r){this._o=t;this._keys=Object.keys(t);this._scheduler=r;e.call(this)}function r(e,t,r){return function n(i,a){if(i<r.length){var o=r[i];e.onNext([o,t[o]]);a(i+1)}else{e.onCompleted()}}}t.prototype.subscribeCore=function(e){return this._scheduler.scheduleRecursive(0,r(e,this._o,this._keys))};return t}(Ut);Vt.pairs=function(e,t){t||(t=dt);return new br(e,t)};var xr=function(e){je(t,e);function t(t,r,n){this.start=t;this.rangeCount=r;this.scheduler=n;e.call(this)}function r(e,t,r){return function n(i,a){if(i<t){r.onNext(e+i);a(i+1)}else{r.onCompleted()}}}t.prototype.subscribeCore=function(e){return this.scheduler.scheduleRecursive(0,r(this.start,this.rangeCount,e))};return t}(Ut);Vt.range=function(e,t,r){lt(r)||(r=dt);return new xr(e,t,r)};var _r=function(e){je(t,e);function t(t,r,n){this.value=t;this.repeatCount=r==null?-1:r;this.scheduler=n;e.call(this)}t.prototype.subscribeCore=function(e){var t=new wr(e,this);return t.run()};return t}(Ut);function wr(e,t){this.observer=e;this.parent=t}wr.prototype.run=function(){var e=this.observer,t=this.parent.value;function r(r,n){if(r===-1||r>0){e.onNext(t);r>0&&r--}if(r===0){return e.onCompleted()}n(r)}return this.parent.scheduler.scheduleRecursive(this.parent.repeatCount,r)};Vt.repeat=function(e,t,r){lt(r)||(r=dt);return new _r(e,t,r)};var Cr=function(e){je(t,e);function t(t,r){this._value=t;this._scheduler=r;e.call(this)}t.prototype.subscribeCore=function(e){var t=[this._value,e];return this._scheduler===ft?r(null,t):this._scheduler.schedule(t,r)};function r(e,t){var r=t[0],n=t[1];n.onNext(r);n.onCompleted() 29;return Ze}return t}(Ut);var Er=Vt["return"]=Vt.just=function(e,t){lt(t)||(t=ft);return new Cr(e,t)};var Sr=function(e){je(t,e);function t(t,r){this._error=t;this._scheduler=r;e.call(this)}t.prototype.subscribeCore=function(e){var t=[this._error,e];return this._scheduler===ft?r(null,t):this._scheduler.schedule(t,r)};function r(e,t){var r=t[0],n=t[1];n.onError(r);return Ze}return t}(Ut);var Tr=Vt["throw"]=function(e,t){lt(t)||(t=ft);return new Sr(e,t)};var Mr=function(e){je(t,e);function t(t,r){this.source=t;this._fn=r;e.call(this)}t.prototype.subscribeCore=function(e){var t=new tt,r=new rt;r.setDisposable(t);t.setDisposable(this.source.subscribe(new Ar(e,r,this._fn)));return r};return t}(Ut);var Ar=function(e){je(t,e);function t(t,r,n){this._o=t;this._s=r;this._fn=n;e.call(this)}t.prototype.next=function(e){this._o.onNext(e)};t.prototype.completed=function(){return this._o.onCompleted()};t.prototype.error=function(e){var t=T(this._fn)(e);if(t===E){return this._o.onError(t.e)}_(t)&&(t=Wn(t));var r=new tt;this._s.setDisposable(r);r.setDisposable(t.subscribe(this._o))};return t}(Bt);Ft["catch"]=function(e){return w(e)?new Mr(this,e):Pr([this,e])};var Pr=Vt["catch"]=function(){var e;if(Array.isArray(arguments[0])){e=arguments[0]}else{var t=arguments.length;e=new Array(t);for(var r=0;r<t;r++){e[r]=arguments[r]}}return Yt(e).catchError()};Ft.combineLatest=function(){var e=arguments.length,t=new Array(e);for(var r=0;r<e;r++){t[r]=arguments[r]}if(Array.isArray(t[0])){t[0].unshift(this)}else{t.unshift(this)}return Br.apply(this,t)};function Rr(){return false}function kr(){var e=arguments.length,t=new Array(e);for(var r=0;r<e;r++){t[r]=arguments[r]}return t}var Ir=function(e){je(t,e);function t(t,r){this._params=t;this._cb=r;e.call(this)}t.prototype.subscribeCore=function(e){var t=this._params.length,r=new Array(t);
29var n={hasValue:qe(t,Rr),hasValueAll:false,isDone:qe(t,Rr),values:new Array(t)};for(var i=0;i<t;i++){var a=this._params[i],o=new tt;r[i]=o;_(a)&&(a=Wn(a));o.setDisposable(a.subscribe(new Dr(e,i,this._cb,n)))}return new it(r)};return t}(Ut);var Dr=function(e){je(t,e);function t(t,r,n,i){this._o=t;this._i=r;this._cb=n;this._state=i;e.call(this)}function r(e){return function(t,r){return r!==e}}t.prototype.next=function(e){this._state.values[this._i]=e;this._state.hasValue[this._i]=true;if(this._state.hasValueAll||(this._state.hasValueAll=this._state.hasValue.every(m))){var t=T(this._cb).apply(null,this._state.values);if(t===E){return this._o.onError(t.e)}this._o.onNext(t)}else if(this._state.isDone.filter(r(this._i)).every(m)){this._o.onCompleted()}};t.prototype.error=function(e){this._o.onError(e)};t.prototype.completed=function(){this._state.isDone[this._i]=true;this._state.isDone.every(m)&&this._o.onCompleted()};return t}(Bt);var Br=Vt.combineLatest=function(){var e=arguments.length,t=new Array(e);for(var r=0;r<e;r++){t[r]=arguments[r]}var n=w(t[e-1])?t.pop():kr;Array.isArray(t[0])&&(t=t[0]);return new Ir(t,n)};Ft.concat=function(){for(var e=[],t=0,r=arguments.length;t<r;t++){e.push(arguments[t])}e.unshift(this);return Vr.apply(null,e)};var Lr=function(e){je(t,e);function t(t,r){this._s=t;this._fn=r;e.call(this)}t.prototype.next=function(e){this._s.o.onNext(e)};t.prototype.error=function(e){this._s.o.onError(e)};t.prototype.completed=function(){this._s.i++;this._fn(this._s)};return t}(Bt);var Fr=function(e){je(t,e);function t(t){this._sources=t;e.call(this)}function r(e,t){if(e.disposable.isDisposed){return}if(e.i===e.sources.length){return e.o.onCompleted()}var r=e.sources[e.i];_(r)&&(r=Wn(r));var n=new tt;e.subscription.setDisposable(n);n.setDisposable(r.subscribe(new Lr(e,t)))}t.prototype.subscribeCore=function(e){var t=new rt;var n=Qe(p);var i={o:e,i:0,subscription:t,disposable:n,sources:this._sources};var a=ft.scheduleRecursive(i,r);return new it([t,n,a])};return t}(Ut);var Vr=Vt.concat=function(){var e;if(Array.isArray(arguments[0])){e=arguments[0]}else{e=new Array(arguments.length);for(var t=0,r=arguments.length;t<r;t++){e[t]=arguments[t]}}return new Fr(e)};Ft.concatAll=function(){return this.merge(1)};var Or=function(e){je(t,e);function t(t,r){this.source=t;this.maxConcurrent=r;e.call(this)}t.prototype.subscribeCore=function(e){var t=new Xe;t.add(this.source.subscribe(new Ur(e,this.maxConcurrent,t)));return t};return t}(Ut);var Ur=function(e){function t(t,r,n){this.o=t;this.max=r;this.g=n;this.done=false;this.q=[];this.activeCount=0;e.call(this)}je(t,e);t.prototype.handleSubscribe=function(e){var t=new tt;this.g.add(t);_(e)&&(e=Wn(e));t.setDisposable(e.subscribe(new r(this,t)))};t.prototype.next=function(e){if(this.activeCount<this.max){this.activeCount++;this.handleSubscribe(e)}else{this.q.push(e)}};t.prototype.error=function(e){this.o.onError(e)};t.prototype.completed=function(){this.done=true;this.activeCount===0&&this.o.onCompleted()};function r(t,r){this.parent=t;this.sad=r;e.call(this)}je(r,e);r.prototype.next=function(e){this.parent.o.onNext(e)};r.prototype.error=function(e){this.parent.o.onError(e)};r.prototype.completed=function(){this.parent.g.remove(this.sad);if(this.parent.q.length>0){this.parent.handleSubscribe(this.parent.q.shift())}else{this.parent.activeCount--;this.parent.done&&this.parent.activeCount===0&&this.parent.o.onCompleted()}};return t}(Bt);Ft.merge=function(e){return typeof e!=="number"?Nr(this,e):new Or(this,e)};var Nr=Vt.merge=function(){var e,t=[],r,n=arguments.length;if(!arguments[0]){e=ft;for(r=1;r<n;r++){t.push(arguments[r])}}else if(lt(arguments[0])){e=arguments[0];for(r=1;r<n;r++){t.push(arguments[r])}}else{e=ft;for(r=0;r<n;r++){t.push(arguments[r])}}if(Array.isArray(t[0])){t=t[0]}return gr(e,t).mergeAll()};var zr=d.CompositeError=function(e){this.innerErrors=e;this.message="This contains multiple errors. Check the innerErrors";Error.call(this)};zr.prototype=Object.create(Error.prototype);zr.prototype.name="CompositeError";var Hr=function(e){je(t,e);function t(t){this.source=t;e.call(this)}t.prototype.subscribeCore=function(e){var t=new Xe,r=new tt,n={isStopped:false,errors:[],o:e};t.add(r);r.setDisposable(this.source.subscribe(new jr(t,n)));return t};return t}(Ut);var jr=function(e){je(t,e);function t(t,r){this._group=t;this._state=r;e.call(this)}function r(e,t){if(t.length===0){e.onCompleted()}else if(t.length===1){e.onError(t[0])}else{e.onError(new zr(t))}}t.prototype.next=function(e){var t=new tt;this._group.add(t);_(e)&&(e=Wn(e));t.setDisposable(e.subscribe(new n(t,this._group,this._state)))};t.prototype.error=function(e){this._state.errors.push(e);this._state.isStopped=true;this._group.length===1&&r(this._state.o,this._state.errors)};t.prototype.completed=function(){this._state.isStopped=true;this._group.length===1&&r(this._state.o,this._state.errors)};je(n,e);function n(t,r,n){this._inner=t;this._group=r;this._state=n;e.call(this)}n.prototype.next=function(e){this._state.o.onNext(e)};n.prototype.error=function(e){this._state.errors.push(e);this._group.remove(this._inner);this._state.isStopped&&this._group.length===1&&r(this._state.o,this._state.errors)};n.prototype.completed=function(){this._group.remove(this._inner);this._state.isStopped&&this._group.length===1&&r(this._state.o,this._state.errors)};return t}(Bt);Vt.mergeDelayError=function(){var e;if(Array.isArray(arguments[0])){e=arguments[0]}else{var t=arguments.length;
29e=new Array(t);for(var r=0;r<t;r++){e[r]=arguments[r]}}var n=gr(null,e);return new Hr(n)};var Gr=function(e){je(t,e);function t(t){this.source=t;e.call(this)}t.prototype.subscribeCore=function(e){var t=new Xe,r=new tt;t.add(r);r.setDisposable(this.source.subscribe(new Wr(e,t)));return t};return t}(Ut);var Wr=function(e){function t(t,r){this.o=t;this.g=r;this.done=false;e.call(this)}je(t,e);t.prototype.next=function(e){var t=new tt;this.g.add(t);_(e)&&(e=Wn(e));t.setDisposable(e.subscribe(new r(this,t)))};t.prototype.error=function(e){this.o.onError(e)};t.prototype.completed=function(){this.done=true;this.g.length===1&&this.o.onCompleted()};function r(t,r){this.parent=t;this.sad=r;e.call(this)}je(r,e);r.prototype.next=function(e){this.parent.o.onNext(e)};r.prototype.error=function(e){this.parent.o.onError(e)};r.prototype.completed=function(){this.parent.g.remove(this.sad);this.parent.done&&this.parent.g.length===1&&this.parent.o.onCompleted()};return t}(Bt);Ft.mergeAll=function(){return new Gr(this)};var qr=function(e){je(t,e);function t(t,r){this._s=t;this._o=_(r)?Wn(r):r;this._open=false;e.call(this)}t.prototype.subscribeCore=function(e){var t=new tt;t.setDisposable(this._s.subscribe(new Xr(e,this)));_(this._o)&&(this._o=Wn(this._o));var r=new tt;r.setDisposable(this._o.subscribe(new Yr(e,this,r)));return new nt(t,r)};return t}(Ut);var Xr=function(e){je(t,e);function t(t,r){this._o=t;this._p=r;e.call(this)}t.prototype.next=function(e){this._p._open&&this._o.onNext(e)};t.prototype.error=function(e){this._o.onError(e)};t.prototype.onCompleted=function(){this._p._open&&this._o.onCompleted()};return t}(Bt);var Yr=function(e){je(t,e);function t(t,r,n){this._o=t;this._p=r;this._r=n;e.call(this)}t.prototype.next=function(){this._p._open=true;this._r.dispose()};t.prototype.error=function(e){this._o.onError(e)};t.prototype.onCompleted=function(){this._r.dispose()};return t}(Bt);Ft.skipUntil=function(e){return new qr(this,e)};var Kr=function(e){je(t,e);function t(t){this.source=t;e.call(this)}t.prototype.subscribeCore=function(e){var t=new rt,n=this.source.subscribe(new r(e,t));return new nt(n,t)};je(r,Bt);function r(e,t){this.o=e;this.inner=t;this.stopped=false;this.latest=0;this.hasLatest=false;Bt.call(this)}r.prototype.next=function(e){var t=new tt,r=++this.latest;this.hasLatest=true;this.inner.setDisposable(t);_(e)&&(e=Wn(e));t.setDisposable(e.subscribe(new n(this,r)))};r.prototype.error=function(e){this.o.onError(e)};r.prototype.completed=function(){this.stopped=true;!this.hasLatest&&this.o.onCompleted()};je(n,Bt);function n(e,t){this.parent=e;this.id=t;Bt.call(this)}n.prototype.next=function(e){this.parent.latest===this.id&&this.parent.o.onNext(e)};n.prototype.error=function(e){this.parent.latest===this.id&&this.parent.o.onError(e)};n.prototype.completed=function(){if(this.parent.latest===this.id){this.parent.hasLatest=false;this.parent.stopped&&this.parent.o.onCompleted()}};return t}(Ut);Ft["switch"]=Ft.switchLatest=function(){return new Kr(this)};var Qr=function(e){je(t,e);function t(t,r){this.source=t;this.other=_(r)?Wn(r):r;e.call(this)}t.prototype.subscribeCore=function(e){return new nt(this.source.subscribe(e),this.other.subscribe(new Zr(e)))};return t}(Ut);var Zr=function(e){je(t,e);function t(t){this._o=t;e.call(this)}t.prototype.next=function(){this._o.onCompleted()};t.prototype.error=function(e){this._o.onError(e)};t.prototype.onCompleted=p;return t}(Bt);Ft.takeUntil=function(e){return new Qr(this,e)};function Rr(){return false}function kr(){var e=arguments.length,t=new Array(e);for(var r=0;r<e;r++){t[r]=arguments[r]}return t}var Jr=function(e){je(t,e);function t(t,r,n){this._s=t;this._ss=r;this._cb=n;e.call(this)}t.prototype.subscribeCore=function(e){var t=this._ss.length;var r={hasValue:qe(t,Rr),hasValueAll:false,values:new Array(t)};var n=this._ss.length,i=new Array(n+1);for(var a=0;a<n;a++){var o=this._ss[a],s=new tt;_(o)&&(o=Wn(o));s.setDisposable(o.subscribe(new $r(e,a,r)));i[a]=s}var u=new tt;u.setDisposable(this._s.subscribe(new en(e,this._cb,r)));i[n]=u;return new it(i)};return t}(Ut);var $r=function(e){je(t,e);function t(t,r,n){this._o=t;this._i=r;this._state=n;e.call(this)}t.prototype.next=function(e){this._state.values[this._i]=e;this._state.hasValue[this._i]=true;this._state.hasValueAll=this._state.hasValue.every(m)};t.prototype.error=function(e){this._o.onError(e)};t.prototype.completed=p;return t}(Bt);var en=function(e){je(t,e);function t(t,r,n){this._o=t;this._cb=r;this._state=n;e.call(this)}t.prototype.next=function(e){var t=[e].concat(this._state.values);if(!this._state.hasValueAll){return}var r=T(this._cb).apply(null,t);if(r===E){return this._o.onError(r.e)}this._o.onNext(r)};t.prototype.error=function(e){this._o.onError(e)};t.prototype.completed=function(){this._o.onCompleted()};return t}(Bt);Ft.withLatestFrom=function(){if(arguments.length===0){throw new Error("invalid arguments")}var e=arguments.length,t=new Array(e);for(var r=0;r<e;r++){t[r]=arguments[r]}var n=w(t[e-1])?t.pop():kr;Array.isArray(t[0])&&(t=t[0]);return new Jr(this,t,n)};function Rr(){return false}function tn(){return[]}var rn=function(e){je(t,e);function t(t,r){this._s=t;this._cb=r;e.call(this)}t.prototype.subscribeCore=function(e){var t=this._s.length,r=new Array(t),n=qe(t,Rr),i=qe(t,tn);for(var a=0;a<t;a++){var o=this._s[a],s=new tt;r[a]=s;_(o)&&(o=Wn(o));s.setDisposable(o.subscribe(new nn(e,a,this,i,n)))}return new it(r)};return t}(Ut);var nn=function(e){je(t,e);function t(t,r,n,i,a){this._o=t;this._i=r;this._p=n;this._q=i;this._d=a;e.call(this)}function r(e){return e.length>0}function n(e){return e.shift()}function i(e){return function(t,r){return r!==e}}t.prototype.next=function(e){this._q[this._i].push(e);if(this._q.every(r)){var t=this._q.map(n);var a=T(this._p._cb).apply(null,t);if(a===E){return this._o.onError(a.e)}
29this._o.onNext(a)}else if(this._d.filter(i(this._i)).every(m)){this._o.onCompleted()}};t.prototype.error=function(e){this._o.onError(e)};t.prototype.completed=function(){this._d[this._i]=true;this._d.every(m)&&this._o.onCompleted()};return t}(Bt);Ft.zip=function(){if(arguments.length===0){throw new Error("invalid arguments")}var e=arguments.length,t=new Array(e);for(var r=0;r<e;r++){t[r]=arguments[r]}var n=w(t[e-1])?t.pop():kr;Array.isArray(t[0])&&(t=t[0]);var i=this;t.unshift(i);return new rn(t,n)};Vt.zip=function(){var e=arguments.length,t=new Array(e);for(var r=0;r<e;r++){t[r]=arguments[r]}if(Array.isArray(t[0])){t=w(t[1])?t[0].concat(t[1]):t[0]}var n=t.shift();return n.zip.apply(n,t)};function Rr(){return false}function tn(){return[]}function kr(){var e=arguments.length,t=new Array(e);for(var r=0;r<e;r++){t[r]=arguments[r]}return t}var an=function(e){je(t,e);function t(t,r){this.sources=t;this._cb=r;e.call(this)}t.prototype.subscribeCore=function(e){var t=this.sources,r=t.length,n=new Array(r);var i={q:qe(r,tn),done:qe(r,Rr),cb:this._cb,o:e};for(var a=0;a<r;a++){(function(e){var r=t[e],a=new tt;(K(r)||Y(r))&&(r=hr(r));n[e]=a;a.setDisposable(r.subscribe(new on(i,e)))})(a)}return new it(n)};return t}(Ut);var on=function(e){je(t,e);function t(t,r){this._s=t;this._i=r;e.call(this)}function r(e){return e.length>0}function n(e){return e.shift()}function i(e){return function(t,r){return r!==e}}t.prototype.next=function(e){this._s.q[this._i].push(e);if(this._s.q.every(r)){var t=this._s.q.map(n),a=T(this._s.cb).apply(null,t);if(a===E){return this._s.o.onError(a.e)}this._s.o.onNext(a)}else if(this._s.done.filter(i(this._i)).every(m)){this._s.o.onCompleted()}};t.prototype.error=function(e){this._s.o.onError(e)};t.prototype.completed=function(){this._s.done[this._i]=true;this._s.done.every(m)&&this._s.o.onCompleted()};return t}(Bt);Ft.zipIterable=function(){if(arguments.length===0){throw new Error("invalid arguments")}var e=arguments.length,t=new Array(e);for(var r=0;r<e;r++){t[r]=arguments[r]}var n=w(t[e-1])?t.pop():kr;var i=this;t.unshift(i);return new an(t,n)};function sn(e){return function t(r){return e.subscribe(r)}}Ft.asObservable=function(){return new wi(sn(this),this)};var un=function(e){je(t,e);function t(t){this.source=t;e.call(this)}t.prototype.subscribeCore=function(e){return this.source.subscribe(new ln(e))};return t}(Ut);var ln=function(e){je(t,e);function t(t){this._o=t;e.call(this)}t.prototype.next=function(e){e.accept(this._o)};t.prototype.error=function(e){this._o.onError(e)};t.prototype.completed=function(){this._o.onCompleted()};return t}(Bt);Ft.dematerialize=function(){return new un(this)};var cn=function(e){je(t,e);function t(t,r,n){this.source=t;this.keyFn=r;this.comparer=n;e.call(this)}t.prototype.subscribeCore=function(e){return this.source.subscribe(new fn(e,this.keyFn,this.comparer))};return t}(Ut);var fn=function(e){je(t,e);function t(t,r,n){this.o=t;this.keyFn=r;this.comparer=n;this.hasCurrentKey=false;this.currentKey=null;e.call(this)}t.prototype.next=function(e){var t=e,r;if(w(this.keyFn)){t=T(this.keyFn)(e);if(t===E){return this.o.onError(t.e)}}if(this.hasCurrentKey){r=T(this.comparer)(this.currentKey,t);if(r===E){return this.o.onError(r.e)}}if(!this.hasCurrentKey||!r){this.hasCurrentKey=true;this.currentKey=t;this.o.onNext(e)}};t.prototype.error=function(e){this.o.onError(e)};t.prototype.completed=function(){this.o.onCompleted()};return t}(Bt);Ft.distinctUntilChanged=function(e,t){t||(t=y);return new cn(this,e,t)};var hn=function(e){je(t,e);function t(t,r,n,i){this.source=t;this._oN=r;this._oE=n;this._oC=i;e.call(this)}t.prototype.subscribeCore=function(e){return this.source.subscribe(new r(e,this))};je(r,Bt);function r(e,t){this.o=e;this.t=!t._oN||w(t._oN)?Dt(t._oN||p,t._oE||p,t._oC||p):t._oN;this.isStopped=false;Bt.call(this)}r.prototype.next=function(e){var t=T(this.t.onNext).call(this.t,e);if(t===E){this.o.onError(t.e)}this.o.onNext(e)};r.prototype.error=function(e){var t=T(this.t.onError).call(this.t,e);if(t===E){return this.o.onError(t.e)}this.o.onError(e)};r.prototype.completed=function(){var e=T(this.t.onCompleted).call(this.t);if(e===E){return this.o.onError(e.e)}this.o.onCompleted()};return t}(Ut);Ft["do"]=Ft.tap=Ft.doAction=function(e,t,r){return new hn(this,e,t,r)};Ft.doOnNext=Ft.tapOnNext=function(e,t){return this.tap(typeof t!=="undefined"?function(r){e.call(t,r)}:e)};
29Ft.doOnError=Ft.tapOnError=function(e,t){return this.tap(p,typeof t!=="undefined"?function(r){e.call(t,r)}:e)};Ft.doOnCompleted=Ft.tapOnCompleted=function(e,t){return this.tap(p,null,typeof t!=="undefined"?function(){e.call(t)}:e)};var dn=function(e){je(t,e);function t(t,r,n){this.source=t;this._fn=Q(r,n,0);e.call(this)}t.prototype.subscribeCore=function(e){var t=T(this.source.subscribe).call(this.source,e);if(t===E){this._fn();M(t.e)}return new r(t,this._fn)};function r(e,t){this.isDisposed=false;this._s=e;this._fn=t}r.prototype.dispose=function(){if(!this.isDisposed){var e=T(this._s.dispose).call(this._s);this._fn();e===E&&M(e.e)}};return t}(Ut);Ft["finally"]=function(e,t){return new dn(this,e,t)};var pn=function(e){je(t,e);function t(t){this.source=t;e.call(this)}t.prototype.subscribeCore=function(e){return this.source.subscribe(new r(e))};function r(e){this.o=e;this.isStopped=false}r.prototype.onNext=p;r.prototype.onError=function(e){if(!this.isStopped){this.isStopped=true;this.o.onError(e)}};r.prototype.onCompleted=function(){if(!this.isStopped){this.isStopped=true;this.o.onCompleted()}};r.prototype.dispose=function(){this.isStopped=true};r.prototype.fail=function(e){if(!this.isStopped){this.isStopped=true;this.observer.onError(e);return true}return false};return t}(Ut);Ft.ignoreElements=function(){return new pn(this)};var mn=function(e){je(t,e);function t(t,r){this.source=t;e.call(this)}t.prototype.subscribeCore=function(e){return this.source.subscribe(new vn(e))};return t}(Ut);var vn=function(e){je(t,e);function t(t){this._o=t;e.call(this)}t.prototype.next=function(e){this._o.onNext(Pt(e))};t.prototype.error=function(e){this._o.onNext(Rt(e));this._o.onCompleted()};t.prototype.completed=function(){this._o.onNext(kt());this._o.onCompleted()};return t}(Bt);Ft.materialize=function(){return new mn(this)};Ft.repeat=function(e){return qt(this,e).concat()};Ft.retry=function(e){return qt(this,e).catchError()};function yn(e){return{"@@iterator":function(){return{next:function(){return{done:false,value:e}}}}}}var gn=function(e){function t(e){return{isDisposed:false,dispose:function(){if(!this.isDisposed){this.isDisposed=true;e.isDisposed=true}}}}function r(t,r){this.source=t;this._notifier=r;e.call(this)}je(r,e);r.prototype.subscribeCore=function(e){var r=new Si,n=new Si,i=this._notifier(r),a=i.subscribe(n);var o=this.source["@@iterator"]();var s={isDisposed:false},u,l=new rt;var c=dt.scheduleRecursive(null,function(t,i){if(s.isDisposed){return}var a=o.next();if(a.done){if(u){e.onError(u)}else{e.onCompleted()}return}var c=a.value;_(c)&&(c=Wn(c));var f=new tt;var h=new tt;l.setDisposable(new nt(h,f));f.setDisposable(c.subscribe(function(t){e.onNext(t)},function(t){h.setDisposable(n.subscribe(i,function(t){e.onError(t)},function(){e.onCompleted()}));r.onNext(t);f.dispose()},function(){e.onCompleted()}))});return new it([a,l,c,t(s)])};return r}(Ut);Ft.retryWhen=function(e){return new gn(yn(this),e)};function yn(e){return{"@@iterator":function(){return{next:function(){return{done:false,value:e}}}}}}var bn=function(e){function t(e){return{isDisposed:false,dispose:function(){if(!this.isDisposed){this.isDisposed=true;e.isDisposed=true}}}}function r(t,r){this.source=t;this._notifier=r;e.call(this)}je(r,e);r.prototype.subscribeCore=function(e){var r=new Si,n=new Si,i=this._notifier(r),a=i.subscribe(n);var o=this.source["@@iterator"]();var s={isDisposed:false},u,l=new rt;var c=dt.scheduleRecursive(null,function(t,i){if(s.isDisposed){return}var a=o.next();if(a.done){if(u){e.onError(u)}else{e.onCompleted()}return}var c=a.value;_(c)&&(c=Wn(c));var f=new tt;var h=new tt;l.setDisposable(new nt(h,f));f.setDisposable(c.subscribe(function(t){e.onNext(t)},function(t){e.onError(t)},function(){h.setDisposable(n.subscribe(i,function(t){e.onError(t)},function(){e.onCompleted()}));r.onNext(null);f.dispose()}))});return new it([a,l,c,t(s)])};return r}(Ut);Ft.repeatWhen=function(e){return new bn(yn(this),e)};var xn=function(e){je(t,e);function t(t,r,n,i){this.source=t;this.accumulator=r;this.hasSeed=n;this.seed=i;e.call(this)}t.prototype.subscribeCore=function(e){return this.source.subscribe(new _n(e,this))};return t}(Ut);var _n=function(e){je(t,e);function t(t,r){this._o=t;this._p=r;this._fn=r.accumulator;this._hs=r.hasSeed;this._s=r.seed;this._ha=false;this._a=null;this._hv=false;this._i=0;e.call(this)}
29t.prototype.next=function(e){!this._hv&&(this._hv=true);if(this._ha){this._a=T(this._fn)(this._a,e,this._i,this._p)}else{this._a=this._hs?T(this._fn)(this._s,e,this._i,this._p):e;this._ha=true}if(this._a===E){return this._o.onError(this._a.e)}this._o.onNext(this._a);this._i++};t.prototype.error=function(e){this._o.onError(e)};t.prototype.completed=function(){!this._hv&&this._hs&&this._o.onNext(this._s);this._o.onCompleted()};return t}(Bt);Ft.scan=function(){var e=false,t,r=arguments[0];if(arguments.length===2){e=true;t=arguments[1]}return new xn(this,r,e,t)};var wn=function(e){je(t,e);function t(t,r){this.source=t;this._c=r;e.call(this)}t.prototype.subscribeCore=function(e){return this.source.subscribe(new Cn(e,this._c))};return t}(Ut);var Cn=function(e){je(t,e);function t(t,r){this._o=t;this._c=r;this._q=[];e.call(this)}t.prototype.next=function(e){this._q.push(e);this._q.length>this._c&&this._o.onNext(this._q.shift())};t.prototype.error=function(e){this._o.onError(e)};t.prototype.completed=function(){this._o.onCompleted()};return t}(Bt);Ft.skipLast=function(e){if(e<0){throw new z}return new wn(this,e)};Ft.startWith=function(){var e,t,r=0;if(!!arguments.length&<(arguments[0])){t=arguments[0];r=1}else{t=ft}for(var n=[],i=r,a=arguments.length;i<a;i++){n.push(arguments[i])}return Vr.apply(null,[pr(n,t),this])};var En=function(e){je(t,e);function t(t,r){this._o=t;this._c=r;this._q=[];e.call(this)}t.prototype.next=function(e){this._q.push(e);this._q.length>this._c&&this._q.shift()};t.prototype.error=function(e){this._o.onError(e)};t.prototype.completed=function(){while(this._q.length>0){this._o.onNext(this._q.shift())}this._o.onCompleted()};return t}(Bt);Ft.takeLast=function(e){if(e<0){throw new z}var t=this;return new wi(function(r){return t.subscribe(new En(r,e))},t)};Ft.flatMapConcat=Ft.concatMap=function(e,t,r){return new Nt(this,e,t,r).merge(1)};var Sn=function(e){je(t,e);function t(t,r,n){this.source=t;this.selector=Q(r,n,3);e.call(this)}function r(e,t){return function(r,n,i){return e.call(this,t.selector(r,n,i),n,i)}}t.prototype.internalMap=function(e,n){return new t(this.source,r(e,this),n)};t.prototype.subscribeCore=function(e){return this.source.subscribe(new n(e,this.selector,this))};je(n,Bt);function n(e,t,r){this.o=e;this.selector=t;this.source=r;this.i=0;Bt.call(this)}n.prototype.next=function(e){var t=T(this.selector)(e,this.i++,this.source);if(t===E){return this.o.onError(t.e)}this.o.onNext(t)};n.prototype.error=function(e){this.o.onError(e)};n.prototype.completed=function(){this.o.onCompleted()};return t}(Ut);Ft.map=Ft.select=function(e,t){var r=typeof e==="function"?e:function(){return e};return this instanceof Sn?this.internalMap(r,t):new Sn(this,r,t)};function Tn(e,t){return function n(i){var a=i;for(var o=0;o<t;o++){var s=a[e[o]];if(typeof s!=="undefined"){a=s}else{return r}}return a}}Ft.pluck=function(){var e=arguments.length,t=new Array(e);if(e===0){throw new Error("List of properties cannot be empty.")}for(var r=0;r<e;r++){t[r]=arguments[r]}return this.map(Tn(t,e))};Ft.flatMap=Ft.selectMany=Ft.mergeMap=function(e,t,r){return new Nt(this,e,t,r).mergeAll()};Ft.flatMapLatest=Ft.switchMap=function(e,t,r){return new Nt(this,e,t,r).switchLatest()};var Mn=function(e){je(t,e);function t(t,r){this.source=t;this._count=r;e.call(this)}t.prototype.subscribeCore=function(e){return this.source.subscribe(new r(e,this._count))};function r(e,t){this._o=e;this._r=t;Bt.call(this)}je(r,Bt);r.prototype.next=function(e){if(this._r<=0){this._o.onNext(e)}else{this._r--}};r.prototype.error=function(e){this._o.onError(e)};r.prototype.completed=function(){this._o.onCompleted()};return t}(Ut);Ft.skip=function(e){if(e<0){throw new z}return new Mn(this,e)};var An=function(e){je(t,e);function t(t,r){this.source=t;this._fn=r;e.call(this)}t.prototype.subscribeCore=function(e){return this.source.subscribe(new Pn(e,this))};return t}(Ut);var Pn=function(e){je(t,e);function t(t,r){this._o=t;this._p=r;this._i=0;this._r=false;e.call(this)}t.prototype.next=function(e){if(!this._r){var t=T(this._p._fn)(e,this._i++,this._p);if(t===E){return this._o.onError(t.e)}this._r=!t}this._r&&this._o.onNext(e)};t.prototype.error=function(e){this._o.onError(e)};t.prototype.completed=function(){this._o.onCompleted()};return t}(Bt);Ft.skipWhile=function(e,t){var r=Q(e,t,3);return new An(this,r)};var Rn=function(e){je(t,e);function t(t,r){this.source=t;this._count=r;e.call(this)}t.prototype.subscribeCore=function(e){return this.source.subscribe(new r(e,this._count))};function r(e,t){this._o=e;this._c=t;this._r=t;Bt.call(this)}je(r,Bt);r.prototype.next=function(e){if(this._r-- >0){this._o.onNext(e);this._r<=0&&this._o.onCompleted()}};r.prototype.error=function(e){this._o.onError(e)};r.prototype.completed=function(){this._o.onCompleted()};return t}(Ut);Ft.take=function(e,t){if(e<0){throw new z}if(e===0){return er(t)}return new Rn(this,e)};var kn=function(e){je(t,e);function t(t,r){this.source=t;this._fn=r;e.call(this)}t.prototype.subscribeCore=function(e){return this.source.subscribe(new In(e,this))};return t}(Ut);var In=function(e){je(t,e);function t(t,r){this._o=t;this._p=r;this._i=0;this._r=true;e.call(this)}t.prototype.next=function(e){if(this._r){this._r=T(this._p._fn)(e,this._i++,this._p);if(this._r===E){return this._o.onError(this._r.e)}}if(this._r){this._o.onNext(e)}else{this._o.onCompleted()}};t.prototype.error=function(e){this._o.onError(e)};t.prototype.completed=function(){this._o.onCompleted()};return t}(Bt);Ft.takeWhile=function(e,t){var r=Q(e,t,3);return new kn(this,r)};var Dn=function(e){je(t,e);function t(t,r,n){this.source=t;this.predicate=Q(r,n,3);e.call(this)}t.prototype.subscribeCore=function(e){return this.source.subscribe(new n(e,this.predicate,this))};function r(e,t){return function(r,n,i){return t.predicate(r,n,i)&&e.call(this,r,n,i)}}t.prototype.internalFilter=function(e,n){return new t(this.source,r(e,this),n)};je(n,Bt);function n(e,t,r){this.o=e;this.predicate=t;this.source=r;this.i=0;Bt.call(this)}n.prototype.next=function(e){var t=T(this.predicate)(e,this.i++,this.source);if(t===E){return this.o.onError(t.e)}t&&this.o.onNext(e)};n.prototype.error=function(e){this.o.onError(e)};n.prototype.completed=function(){this.o.onCompleted()};return t}(Ut);Ft.filter=Ft.where=function(e,t){return this instanceof Dn?this.internalFilter(e,t):new Dn(this,e,t)};function Bn(e,t,r,n){var i=new Ti;n.push(Ln(i,t,r));e.apply(t,n);return i.asObservable()}function Ln(e,t,r){return function n(){var i=arguments.length,a=new Array(i);for(var o=0;o<i;o++){a[o]=arguments[o]}if(w(r)){a=T(r).apply(t,a);if(a===E){return e.onError(a.e)}e.onNext(a)}else{if(a.length<=1){e.onNext(a[0])}else{e.onNext(a)}}e.onCompleted()}}Vt.fromCallback=function(e,t,r){return function(){typeof t==="undefined"&&(t=this);var n=arguments.length,i=new Array(n);for(var a=0;a<n;a++){i[a]=arguments[a]}return Bn(e,t,r,i)}};function Fn(e,t,r,n){var i=new Ti;n.push(Vn(i,t,r));e.apply(t,n);return i.asObservable()}function Vn(e,t,r){return function n(){var i=arguments[0];if(i){return e.onError(i)}var a=arguments.length,o=[];for(var s=1;s<a;s++){o[s-1]=arguments[s]}if(w(r)){var o=T(r).apply(t,o);if(o===E){return e.onError(o.e)}e.onNext(o)}else{if(o.length<=1){e.onNext(o[0])}else{e.onNext(o)}}e.onCompleted()}}Vt.fromNodeCallback=function(e,t,r){return function(){typeof t==="undefined"&&(t=this);var n=arguments.length,i=new Array(n);for(var a=0;a<n;a++){i[a]=arguments[a]}return Fn(e,t,r,i)}};function On(e){if(h.StaticNodeList){return e instanceof h.StaticNodeList||e instanceof h.NodeList}else{return Object.prototype.toString.call(e)==="[object NodeList]"}}function Un(e,t,r){this._e=e;this._n=t;this._fn=r;this._e.addEventListener(this._n,this._fn,false);this.isDisposed=false}Un.prototype.dispose=function(){if(!this.isDisposed){this._e.removeEventListener(this._n,this._fn,false);this.isDisposed=true}};function Nn(e,t,r){var n=new Xe;var i=Object.prototype.toString.call(e);
29if(On(e)||i==="[object HTMLCollection]"){for(var a=0,o=e.length;a<o;a++){n.add(Nn(e.item(a),t,r))}}else if(e){n.add(new Un(e,t,r))}return n}d.config.useNativeEvents=false;var zn=function(e){je(t,e);function t(t,r,n){this._el=t;this._n=r;this._fn=n;e.call(this)}function r(e,t){return function r(){var n=arguments[0];if(w(t)){n=T(t).apply(null,arguments);if(n===E){return e.onError(n.e)}}e.onNext(n)}}t.prototype.subscribeCore=function(e){return Nn(this._el,this._n,r(e,this._fn))};return t}(Ut);Vt.fromEvent=function(e,t,r){if(e.addListener){return jn(function(r){e.addListener(t,r)},function(r){e.removeListener(t,r)},r)}if(!d.config.useNativeEvents){if(typeof e.on==="function"&&typeof e.off==="function"){return jn(function(r){e.on(t,r)},function(r){e.off(t,r)},r)}}return new zn(e,t,r).publish().refCount()};var Hn=function(e){je(t,e);function t(t,r,n){this._add=t;this._del=r;this._fn=n;e.call(this)}function r(e,t){return function r(){var n=arguments[0];if(w(t)){n=T(t).apply(null,arguments);if(n===E){return e.onError(n.e)}}e.onNext(n)}}t.prototype.subscribeCore=function(e){var t=r(e,this._fn);var i=this._add(t);return new n(this._del,t,i)};function n(e,t,r){this._del=e;this._fn=t;this._ret=r;this.isDisposed=false}n.prototype.dispose=function(){if(!this.isDisposed){w(this._del)&&this._del(this._fn,this._ret);this.isDisposed=true}};return t}(Ut);var jn=Vt.fromEventPattern=function(e,t,r){return new Hn(e,t,r).publish().refCount()};var Gn=function(e){je(t,e);function t(t,r){this._p=t;this._s=r;e.call(this)}function r(e,t){var r=t[0],n=t[1];r.onNext(n);r.onCompleted()}function n(e,t){var r=t[0],n=t[1];r.onError(n)}t.prototype.subscribeCore=function(e){var t=new tt,i=this,a=this._p;if(w(a)){a=T(a)();if(a===E){e.onError(a.e);return t}}a.then(function(n){t.setDisposable(i._s.schedule([e,n],r))},function(r){t.setDisposable(i._s.schedule([e,r],n))});return t};return t}(Ut);var Wn=Vt.fromPromise=function(e,t){t||(t=_t);return new Gn(e,t)};Ft.toPromise=function(e){e||(e=d.config.Promise);if(!e){throw new H("Promise type not provided nor in Rx.config.Promise")}var t=this;return new e(function(e,r){var n;t.subscribe(function(e){n=e},r,function(){e(n)})})} 30;Vt.startAsync=function(e){var t=T(e)();if(t===E){return Tr(t.e)}return Wn(t)};var qn=function(e){je(t,e);function t(t,r,n){this.source=t;this._fn1=r;this._fn2=n;e.call(this)}t.prototype.subscribeCore=function(e){var t=this.source.multicast(this._fn1());return new nt(this._fn2(t).subscribe(e),t.connect())};return t}(Ut);Ft.multicast=function(e,t){return w(e)?new qn(this,e,t):new Yn(this,e)};Ft.publish=function(e){return e&&w(e)?this.multicast(function(){return new Si},e):this.multicast(new Si)};Ft.share=function(){return this.publish().refCount()};Ft.publishLast=function(e){return e&&w(e)?this.multicast(function(){return new Ti},e):this.multicast(new Ti)};Ft.publishValue=function(e,t){return arguments.length===2?this.multicast(function(){return new Ai(t)},e):this.multicast(new Ai(e))};Ft.shareValue=function(e){return this.publishValue(e).refCount()};Ft.replay=function(e,t,r,n){return e&&w(e)?this.multicast(function(){return new Pi(t,r,n)},e):this.multicast(new Pi(t,r,n))};Ft.shareReplay=function(e,t,r){return this.replay(null,e,t,r).refCount()};var Xn=function(e){je(t,e);function t(t){this.source=t;this._count=0;this._connectableSubscription=null;e.call(this)}t.prototype.subscribeCore=function(e){var t=this.source.subscribe(e);++this._count===1&&(this._connectableSubscription=this.source.connect());return new r(this,t)};function r(e,t){this._p=e;this._s=t;this.isDisposed=false}r.prototype.dispose=function(){if(!this.isDisposed){this.isDisposed=true;this._s.dispose();--this._p._count===0&&this._p._connectableSubscription.dispose()}};return t}(Ut);var Yn=d.ConnectableObservable=function(e){je(t,e);function t(t,r){this.source=t;this._connection=null;this._source=t.asObservable();this._subject=r;e.call(this)}function r(e,t){this._p=e;this._s=t}r.prototype.dispose=function(){if(this._s){this._s.dispose();this._s=null;this._p._connection=null}};t.prototype.connect=function(){if(!this._connection){if(this._subject.isStopped){return Ze}var e=this._source.subscribe(this._subject);this._connection=new r(this,e)}return this._connection};t.prototype._subscribe=function(e){return this._subject.subscribe(e)};t.prototype.refCount=function(){return new Xn(this)};return t}(Vt);var Kn=function(e){je(t,e);function t(t,r){this._dt=t;this._s=r;e.call(this)}t.prototype.subscribeCore=function(e){return this._s.scheduleFuture(e,this._dt,r)};function r(e,t){t.onNext(0);t.onCompleted()}return t}(Ut);function Qn(e,t){return new Kn(e,t)}function Zn(e,t,r){return new wi(function(n){var i=e,a=ut(t);return r.scheduleRecursiveFuture(0,i,function(e,t){if(a>0){var o=r.now();i=new Date(i.getTime()+a);i.getTime()<=o&&(i=new Date(o+a))}n.onNext(e);t(e+1,new Date(i))})})}function Jn(e,t,r){return e===t?new wi(function(e){return r.schedulePeriodic(0,t,function(t){e.onNext(t);return t+1})}):Zt(function(){return Zn(new Date(r.now()+e),t,r)})}var $n=Vt.interval=function(e,t){return Jn(e,e,lt(t)?t:_t)};var ei=Vt.timer=function(e,t,n){var i;lt(n)||(n=_t);if(t!=null&&typeof t==="number"){i=t}else if(lt(t)){n=t}if((e instanceof Date||typeof e==="number")&&i===r){return Qn(e,n)}if(e instanceof Date&&i!==r){return Zn(e,t,n)}return Jn(e,i,n)};function ti(e,t,r){return new wi(function(n){var i=false,a=new rt,o=null,s=[],u=false,l;l=e.materialize().timestamp(r).subscribe(function(e){var l,c;if(e.value.kind==="E"){s=[];s.push(e);o=e.value.error;c=!u}else{s.push({value:e.value,timestamp:e.timestamp+t});c=!i;i=true}if(c){if(o!==null){n.onError(o)}else{l=new tt;a.setDisposable(l);l.setDisposable(r.scheduleRecursiveFuture(null,t,function(e,t){var a,l,c,f;if(o!==null){return}u=true;do{c=null;if(s.length>0&&s[0].timestamp-r.now()<=0){c=s.shift().value}if(c!==null){c.accept(n)}}while(c!==null);f=false;l=0;if(s.length>0){f=true;l=Math.max(0,s[0].timestamp-r.now())}else{i=false}a=o;u=false;if(a!==null){n.onError(a)}else if(f){t(null,l)}}))}}});return new nt(l,a)},e)}function ri(e,t,r){return Zt(function(){return ti(e,t-r.now(),r)})}function ni(e,t,r){var n,i;if(w(t)){i=t}else{n=t;i=r}return new wi(function(t){var r=new Xe,a=false,o=new rt;function s(){o.setDisposable(e.subscribe(function(e){var n=T(i)(e);if(n===E){return t.onError(n.e)}var a=new tt;r.add(a);a.setDisposable(n.subscribe(function(){t.onNext(e);r.remove(a);u()},function(e){t.onError(e)},function(){t.onNext(e);r.remove(a);u()}))},function(e){t.onError(e)},function(){a=true;o.dispose();u()}))}function u(){a&&r.length===0&&t.onCompleted()}if(!n){s()}else{o.setDisposable(n.subscribe(s,function(e){t.onError(e)},s))}return new nt(o,r)},e)}Ft.delay=function(){var e=arguments[0];if(typeof e==="number"||e instanceof Date){var t=e,r=arguments[1];lt(r)||(r=_t);return t instanceof Date?ri(this,t,r):ti(this,t,r)}else if(Vt.isObservable(e)||w(e)){return ni(this,e,arguments[1])}else{throw new Error("Invalid arguments")}};var ii=function(e){je(t,e);function t(t,r,n){lt(n)||(n=_t);this.source=t;this._dt=r;this._s=n;e.call(this)}t.prototype.subscribeCore=function(e){var t=new rt;return new nt(this.source.subscribe(new ai(e,this._dt,this._s,t)),t)};return t}(Ut);var ai=function(e){je(t,e);function t(t,r,n,i){this._o=t;this._d=r;
30this._scheduler=n;this._c=i;this._v=null;this._hv=false;this._id=0;e.call(this)}function r(e,t){t.self._hv&&t.self._id===t.currentId&&t.self._o.onNext(t.x);t.self._hv=false}t.prototype.next=function(e){this._hv=true;this._v=e;var t=++this._id,r=new tt;this._c.setDisposable(r);r.setDisposable(this._scheduler.scheduleFuture(this,this._d,function(r,n){n._hv&&n._id===t&&n._o.onNext(e);n._hv=false}))};t.prototype.error=function(e){this._c.dispose();this._o.onError(e);this._hv=false;this._id++};t.prototype.completed=function(){this._c.dispose();this._hv&&this._o.onNext(this._v);this._o.onCompleted();this._hv=false;this._id++};return t}(Bt);function oi(e,t){return new wi(function(r){var n,i=false,a=new rt,o=0;var s=e.subscribe(function(e){var s=T(t)(e);if(s===E){return r.onError(s.e)}_(s)&&(s=Wn(s));i=true;n=e;o++;var u=o,l=new tt;a.setDisposable(l);l.setDisposable(s.subscribe(function(){i&&o===u&&r.onNext(n);i=false;l.dispose()},function(e){r.onError(e)},function(){i&&o===u&&r.onNext(n);i=false;l.dispose()}))},function(e){a.dispose();r.onError(e);i=false;o++},function(){a.dispose();i&&r.onNext(n);r.onCompleted();i=false;o++});return new nt(s,a)},e)}Ft.debounce=function(){if(w(arguments[0])){return oi(this,arguments[0])}else if(typeof arguments[0]==="number"){return new ii(this,arguments[0],arguments[1])}else{throw new Error("Invalid arguments")}};var si=function(e){je(t,e);function t(t,r){this.source=t;this._s=r;e.call(this)}t.prototype.subscribeCore=function(e){return this.source.subscribe(new ui(e,this._s))};return t}(Ut);var ui=function(e){je(t,e);function t(t,r){this._o=t;this._s=r;e.call(this)}t.prototype.next=function(e){this._o.onNext({value:e,timestamp:this._s.now()})};t.prototype.error=function(e){this._o.onError(e)};t.prototype.completed=function(){this._o.onCompleted()};return t}(Bt);Ft.timestamp=function(e){lt(e)||(e=_t);return new si(this,e)};var li=function(e){je(t,e);function t(t,r){this.source=t;this._sampler=r;e.call(this)}t.prototype.subscribeCore=function(e){var t={o:e,atEnd:false,value:null,hasValue:false,sourceSubscription:new tt};t.sourceSubscription.setDisposable(this.source.subscribe(new fi(t)));return new nt(t.sourceSubscription,this._sampler.subscribe(new ci(t)))};return t}(Ut);var ci=function(e){je(t,e);function t(t){this._s=t;e.call(this)}t.prototype._handleMessage=function(){if(this._s.hasValue){this._s.hasValue=false;this._s.o.onNext(this._s.value)}this._s.atEnd&&this._s.o.onCompleted()};t.prototype.next=function(){this._handleMessage()};t.prototype.error=function(e){this._s.onError(e)};t.prototype.completed=function(){this._handleMessage()};return t}(Bt);var fi=function(e){je(t,e);function t(t){this._s=t;e.call(this)}t.prototype.next=function(e){this._s.hasValue=true;this._s.value=e};t.prototype.error=function(e){this._s.o.onError(e)};t.prototype.completed=function(){this._s.atEnd=true;this._s.sourceSubscription.dispose()};return t}(Bt);Ft.sample=function(e,t){lt(t)||(t=_t);return typeof e==="number"?new li(this,$n(e,t)):new li(this,e)};var hi=d.TimeoutError=function(e){this.message=e||"Timeout has occurred";this.name="TimeoutError";Error.call(this)};hi.prototype=Object.create(Error.prototype);function di(e,t,r,n){if(w(t)){n=r;r=t;t=yr()}Vt.isObservable(n)||(n=Tr(new hi));return new wi(function(i){var a=new rt,o=new rt,s=new tt;a.setDisposable(s);var u=0,l=false;function c(e){var t=u,r=new tt;function s(){l=t===u;return l}o.setDisposable(r);r.setDisposable(e.subscribe(function(){s()&&a.setDisposable(n.subscribe(i));r.dispose()},function(e){s()&&i.onError(e)},function(){s()&&a.setDisposable(n.subscribe(i))}))}c(t);function f(){var e=!l;if(e){u++}return e}s.setDisposable(e.subscribe(function(e){if(f()){i.onNext(e);var t=T(r)(e);if(t===E){return i.onError(t.e)}c(_(t)?Wn(t):t)}},function(e){f()&&i.onError(e)},function(){f()&&i.onCompleted()}));return new nt(a,o)},e)}function pi(e,t,r,n){if(lt(r)){n=r;r=Tr(new hi)}if(r instanceof Error){r=Tr(r)}lt(n)||(n=_t);Vt.isObservable(r)||(r=Tr(new hi));return new wi(function(i){var a=0,o=new tt,s=new rt,u=false,l=new rt;s.setDisposable(o);function c(){var e=a;l.setDisposable(n.scheduleFuture(null,t,function(){u=a===e;if(u){_(r)&&(r=Wn(r));s.setDisposable(r.subscribe(i))}}))}c();o.setDisposable(e.subscribe(function(e){if(!u){a++;i.onNext(e);c()}},function(e){if(!u){a++;i.onError(e)}},function(){if(!u){a++;i.onCompleted()}}));return new nt(s,l)},e)}Ft.timeout=function(){var e=arguments[0];if(e instanceof Date||typeof e==="number"){return pi(this,e,arguments[1],arguments[2])}else if(Vt.isObservable(e)||w(e)){return di(this,e,arguments[1],arguments[2])}else{throw new Error("Invalid arguments")}};Ft.throttle=function(e,t){lt(t)||(t=_t);var r=+e||0;if(r<=0){throw new RangeError("windowDuration cannot be less or equal zero.")}var n=this;return new wi(function(e){var i=0;return n.subscribe(function(n){var a=t.now();if(i===0||a-i>=r){i=a;e.onNext(n)}},function(t){e.onError(t)},function(){e.onCompleted()})},n)};var mi=function(e){je(t,e);function t(t,r){this.source=t;this.controller=new Si;this.paused=true;if(r&&r.subscribe){this.pauser=this.controller.merge(r)}else{this.pauser=this.controller}e.call(this)}t.prototype._subscribe=function(e){var t=this.source.publish(),r=t.subscribe(e),n=Ze;var i=this.pauser.startWith(!this.paused).distinctUntilChanged().subscribe(function(e){if(e){n=t.connect()}else{n.dispose();n=Ze}});return new it([r,n,i])};t.prototype.pause=function(){this.paused=true;this.controller.onNext(false)};t.prototype.resume=function(){this.paused=false;this.controller.onNext(true)};return t}(Vt);Ft.pausable=function(e){return new mi(this,e)};function vi(e,t,r){return new wi(function(n){var i=[false,false],a=false,o=false,s=new Array(2),u;function l(e,t){s[t]=e;i[t]=true;if(a||(a=i.every(m))){if(u){return n.onError(u)}var l=T(r).apply(null,s);if(l===E){return n.onError(l.e)}n.onNext(l)}o&&s[1]&&n.onCompleted()}return new nt(e.subscribe(function(e){l(e,0)},function(e){if(s[1]){n.onError(e)}else{u=e}},function(){o=true;s[1]&&n.onCompleted()}),t.subscribe(function(e){l(e,1)},function(e){n.onError(e)},function(){o=true;l(true,1)}))},e)}var yi=function(e){je(t,e);function t(t,r){this.source=t;this.controller=new Si;this.paused=true;if(r&&r.subscribe){this.pauser=this.controller.merge(r)}else{this.pauser=this.controller}e.call(this)}t.prototype._subscribe=function(e){var t=[],n;function i(){while(t.length>0){e.onNext(t.shift())}}var a=vi(this.source,this.pauser.startWith(!this.paused).distinctUntilChanged(),function(e,t){return{data:e,shouldFire:t}}
30).subscribe(function(a){if(n!==r&&a.shouldFire!==n){n=a.shouldFire;if(a.shouldFire){i()}}else{n=a.shouldFire;if(a.shouldFire){e.onNext(a.data)}else{t.push(a.data)}}},function(t){i();e.onError(t)},function(){i();e.onCompleted()});return a};t.prototype.pause=function(){this.paused=true;this.controller.onNext(false)};t.prototype.resume=function(){this.paused=false;this.controller.onNext(true)};return t}(Vt);Ft.pausableBuffered=function(e){return new yi(this,e)};var gi=function(e){je(t,e);function t(t,r,n){e.call(this);this.subject=new bi(r,n);this.source=t.multicast(this.subject).refCount()}t.prototype._subscribe=function(e){return this.source.subscribe(e)};t.prototype.request=function(e){return this.subject.request(e==null?-1:e)};return t}(Vt);var bi=function(e){je(t,e);function t(t,r){t==null&&(t=true);e.call(this);this.subject=new Si;this.enableQueue=t;this.queue=t?[]:null;this.requestedCount=0;this.requestedDisposable=null;this.error=null;this.hasFailed=false;this.hasCompleted=false;this.scheduler=r||dt}Ge(t.prototype,It,{_subscribe:function(e){return this.subject.subscribe(e)},onCompleted:function(){this.hasCompleted=true;if(!this.enableQueue||this.queue.length===0){this.subject.onCompleted();this.disposeCurrentRequest()}else{this.queue.push(St.createOnCompleted())}},onError:function(e){this.hasFailed=true;this.error=e;if(!this.enableQueue||this.queue.length===0){this.subject.onError(e);this.disposeCurrentRequest()}else{this.queue.push(St.createOnError(e))}},onNext:function(e){if(this.requestedCount<=0){this.enableQueue&&this.queue.push(St.createOnNext(e))}else{this.requestedCount--===0&&this.disposeCurrentRequest();this.subject.onNext(e)}},_processRequest:function(e){if(this.enableQueue){while(this.queue.length>0&&(e>0||this.queue[0].kind!=="N")){var t=this.queue.shift();t.accept(this.subject);if(t.kind==="N"){e--}else{this.disposeCurrentRequest();this.queue=[]}}}return e},request:function(e){this.disposeCurrentRequest();var t=this;this.requestedDisposable=this.scheduler.schedule(e,function(e,r){var n=t._processRequest(r);var i=t.hasCompleted||t.hasFailed;if(!i&&n>0){t.requestedCount=n;return Qe(function(){t.requestedCount=0})}});return this.requestedDisposable},disposeCurrentRequest:function(){if(this.requestedDisposable){this.requestedDisposable.dispose();this.requestedDisposable=null}}});return t}(Vt);Ft.controlled=function(e,t){if(e&<(e)){t=e;e=true}if(e==null){e=true}return new gi(this,e,t)};Ft.pipe=function(e){var t=this.pausableBuffered();function r(){t.resume()}e.addListener("drain",r);t.subscribe(function(r){!e.write(r)&&t.pause()},function(t){e.emit("error",t)},function(){!e._isStdio&&e.end();e.removeListener("drain",r)});t.resume();return e};var xi=function(e){je(t,e);function t(t,r){this._o=t;this._xform=r;e.call(this)}t.prototype.next=function(e){var t=T(this._xform["@@transducer/step"]).call(this._xform,this._o,e);if(t===E){this._o.onError(t.e)}};t.prototype.error=function(e){this._o.onError(e)};t.prototype.completed=function(){this._xform["@@transducer/result"](this._o)};return t}(Bt);function _i(e){return{"@@transducer/init":function(){return e},"@@transducer/step":function(e,t){return e.onNext(t)},"@@transducer/result":function(e){return e.onCompleted()}}}Ft.transduce=function(e){var t=this;return new wi(function(r){var n=e(_i(r));return t.subscribe(new xi(r,n))},t)};var wi=d.AnonymousObservable=function(e){je(n,e);function t(e){return e&&w(e.dispose)?e:w(e)?Qe(e):Ze}function r(e,r){var n=r[0],i=r[1];var a=T(i.__subscribe).call(i,n);if(a===E&&!n.fail(E.e)){M(E.e)}n.setDisposable(t(a))}function n(t,r){this.source=r;this.__subscribe=t;e.call(this)}n.prototype._subscribe=function(e){var t=new Ci(e),n=[t,this];if(dt.scheduleRequired()){dt.schedule(n,r)}else{r(null,n)}return t};return n}(Vt);var Ci=function(e){je(t,e);function t(t){e.call(this);this.observer=t;this.m=new tt}var r=t.prototype;r.next=function(e){var t=T(this.observer.onNext).call(this.observer,e);if(t===E){this.dispose();M(t.e)}};r.error=function(e){var t=T(this.observer.onError).call(this.observer,e);this.dispose();t===E&&M(t.e)};r.completed=function(){var e=T(this.observer.onCompleted).call(this.observer);this.dispose();e===E&&M(e.e)};r.setDisposable=function(e){this.m.setDisposable(e)};r.getDisposable=function(){return this.m.getDisposable()};r.dispose=function(){e.prototype.dispose.call(this);this.m.dispose()};return t}(Bt);var Ei=function(e,t){this._s=e;this._o=t};Ei.prototype.dispose=function(){if(!this._s.isDisposed&&this._o!==null){var e=this._s.observers.indexOf(this._o);this._s.observers.splice(e,1);this._o=null}};var Si=d.Subject=function(e){je(t,e);function t(){e.call(this);this.isDisposed=false;this.isStopped=false;this.observers=[];this.hasError=false}Ge(t.prototype,It.prototype,{_subscribe:function(e){$e(this);if(!this.isStopped){this.observers.push(e);return new Ei(this,e)}if(this.hasError){e.onError(this.error);return Ze}e.onCompleted();return Ze},hasObservers:function(){$e(this);return this.observers.length>0},onCompleted:function(){$e(this);if(!this.isStopped){this.isStopped=true;for(var e=0,t=C(this.observers),r=t.length;e<r;e++){t[e].onCompleted()}this.observers.length=0}},onError:function(e){$e(this);if(!this.isStopped){this.isStopped=true;this.error=e;this.hasError=true;for(var t=0,r=C(this.observers),n=r.length;t<n;t++){r[t].onError(e)}this.observers.length=0}},onNext:function(e){$e(this);if(!this.isStopped){for(var t=0,r=C(this.observers),n=r.length;t<n;t++){r[t].onNext(e)}}},dispose:function(){this.isDisposed=true;this.observers=null}});t.create=function(e,t){return new Mi(e,t)};return t}(Vt);var Ti=d.AsyncSubject=function(e){je(t,e);function t(){e.call(this);this.isDisposed=false;this.isStopped=false;this.hasValue=false;this.observers=[];this.hasError=false}Ge(t.prototype,It.prototype,{_subscribe:function(e){$e(this);if(!this.isStopped){this.observers.push(e);return new Ei(this,e)}if(this.hasError){e.onError(this.error)}else if(this.hasValue){e.onNext(this.value);e.onCompleted()}else{e.onCompleted()}return Ze},hasObservers:function(){$e(this);return this.observers.length>0},onCompleted:function(){var e,t;$e(this);if(!this.isStopped){this.isStopped=true;var r=C(this.observers),t=r.length;if(this.hasValue){for(e=0;e<t;e++){var n=r[e];n.onNext(this.value);n.onCompleted()}}else{for(e=0;e<t;e++){r[e].onCompleted()}}this.observers.length=0}},onError:function(e){$e(this);if(!this.isStopped){this.isStopped=true;this.hasError=true;this.error=e;for(var t=0,r=C(this.observers),n=r.length;t<n;t++){r[t].onError(e)}this.observers.length=0}},onNext:function(e){$e(this);if(this.isStopped){return}this.value=e;this.hasValue=true},dispose:function(){this.isDisposed=true;this.observers=null;this.error=null;this.value=null}});return t}(Vt);var Mi=d.AnonymousSubject=function(e){je(t,e);function t(t,r){this.observer=t;this.observable=r;e.call(this)}Ge(t.prototype,It.prototype,{_subscribe:function(e){return this.observable.subscribe(e)},onCompleted:function(){this.observer.onCompleted()},onError:function(e){this.observer.onError(e)},onNext:function(e){this.observer.onNext(e)}});return t}(Vt);var Ai=d.BehaviorSubject=function(e){je(t,e);function t(t){e.call(this);this.value=t;this.observers=[];this.isDisposed=false;this.isStopped=false;this.hasError=false}Ge(t.prototype,It.prototype,{_subscribe:function(e){$e(this);if(!this.isStopped){this.observers.push(e);e.onNext(this.value);return new Ei(this,e)}if(this.hasError){e.onError(this.error)}else{e.onCompleted()}return Ze},getValue:function(){$e(this);if(this.hasError){M(this.error)}return this.value},hasObservers:function(){$e(this);return this.observers.length>0},onCompleted:function(){$e(this);if(this.isStopped){return}this.isStopped=true;for(var e=0,t=C(this.observers),r=t.length;e<r;e++){t[e].onCompleted()}this.observers.length=0},onError:function(e){$e(this);if(this.isStopped){return}this.isStopped=true;this.hasError=true;this.error=e;for(var t=0,r=C(this.observers),n=r.length;t<n;t++){r[t].onError(e)}this.observers.length=0},onNext:function(e){$e(this);if(this.isStopped){return}this.value=e;for(var t=0,r=C(this.observers),n=r.length;t<n;t++){r[t].onNext(e)}},dispose:function(){this.isDisposed=true;this.observers=null;this.value=null;this.error=null}});return t}(Vt);var Pi=d.ReplaySubject=function(e){var t=Math.pow(2,53)-1;function r(e,t){return Qe(function(){t.dispose();!e.isDisposed&&e.observers.splice(e.observers.indexOf(t),1)})}je(n,e);function n(r,n,i){this.bufferSize=r==null?t:r;this.windowSize=n==null?t:n;
30this.scheduler=i||dt;this.q=[];this.observers=[];this.isStopped=false;this.isDisposed=false;this.hasError=false;this.error=null;e.call(this)}Ge(n.prototype,It.prototype,{_subscribe:function(e){$e(this);var t=new Ot(this.scheduler,e),n=r(this,t);this._trim(this.scheduler.now());this.observers.push(t);for(var i=0,a=this.q.length;i<a;i++){t.onNext(this.q[i].value)}if(this.hasError){t.onError(this.error)}else if(this.isStopped){t.onCompleted()}t.ensureActive();return n},hasObservers:function(){$e(this);return this.observers.length>0},_trim:function(e){while(this.q.length>this.bufferSize){this.q.shift()}while(this.q.length>0&&e-this.q[0].interval>this.windowSize){this.q.shift()}},onNext:function(e){$e(this);if(this.isStopped){return}var t=this.scheduler.now();this.q.push({interval:t,value:e});this._trim(t);for(var r=0,n=C(this.observers),i=n.length;r<i;r++){var a=n[r];a.onNext(e);a.ensureActive()}},onError:function(e){$e(this);if(this.isStopped){return}this.isStopped=true;this.error=e;this.hasError=true;var t=this.scheduler.now();this._trim(t);for(var r=0,n=C(this.observers),i=n.length;r<i;r++){var a=n[r];a.onError(e);a.ensureActive()}this.observers.length=0},onCompleted:function(){$e(this);if(this.isStopped){return}this.isStopped=true;var e=this.scheduler.now();this._trim(e);for(var t=0,r=C(this.observers),n=r.length;t<n;t++){var i=r[t];i.onCompleted();i.ensureActive()}this.observers.length=0},dispose:function(){this.isDisposed=true;this.observers=null}});return n}(Vt);d.Pauser=function(e){je(t,e);function t(){e.call(this)}t.prototype.pause=function(){this.onNext(false)};t.prototype.resume=function(){this.onNext(true)};return t}(Si);e.Rx=d;var Ri=V()}).call(this,n,t);var i=n.Rx;/* 31 * Copyright (c) 2016 - now David Sehnal, licensed under MIT License, See LICENSE file for more info. 32 */ 33var a;(function(e){e.VERSION={number:"1.1.6",date:"June 26 2017"}})(a||(a={}));/* 34 * Copyright (c) 2016 - now David Sehnal, licensed under MIT License, See LICENSE file for more info. 35 */ 36var a;(function(e){var t;(function(e){var t;(function(e){function t(e){return e.creator&&e.chunkSize}e.is=t;function r(e,t,r,n,i){if(e.currentIndex>=e.chunkSize){e.currentIndex=0;e.current=e.creator(e.chunkSize);e.parts[e.parts.length]=e.current}e.current[e.currentIndex++]=t;e.current[e.currentIndex++]=r;e.current[e.currentIndex++]=n;e.current[e.currentIndex++]=i;return e.elementCount++}e.add4=r;function n(e,t,r,n){if(e.currentIndex>=e.chunkSize){e.currentIndex=0;e.current=e.creator(e.chunkSize);e.parts[e.parts.length]=e.current}e.current[e.currentIndex++]=t;e.current[e.currentIndex++]=r;e.current[e.currentIndex++]=n;return e.elementCount++}e.add3=n;function i(e,t,r){if(e.currentIndex>=e.chunkSize){e.currentIndex=0;e.current=e.creator(e.chunkSize);e.parts[e.parts.length]=e.current}e.current[e.currentIndex++]=t;e.current[e.currentIndex++]=r;return e.elementCount++}e.add2=i;function a(e,t){if(e.currentIndex>=e.chunkSize){e.currentIndex=0;e.current=e.creator(e.chunkSize);e.parts[e.parts.length]=e.current}e.current[e.currentIndex++]=t;return e.elementCount++}e.add=a;function o(e){var t=e.creator(e.elementSize*e.elementCount),r=(e.parts.length-1)*e.chunkSize,n=0,i;if(e.parts.length>1){if(e.parts[0].buffer){for(var a=0;a<e.parts.length-1;a++){t.set(e.parts[a],e.chunkSize*a)}}else{for(var a=0;a<e.parts.length-1;a++){n=e.chunkSize*a;i=e.parts[a];for(var o=0;o<e.chunkSize;o++){t[n+o]=i[o]}}}}if(e.current.buffer&&e.currentIndex>=e.chunkSize){t.set(e.current,e.chunkSize*(e.parts.length-1))}else{for(var a=0;a<e.currentIndex;a++){t[r+a]=e.current[a]}}return t}e.compact=o;function s(e){if(e===void 0){e=262144}return p(function(e){return new Float32Array(e)},e,3)}e.forVertex3D=s;function u(e){if(e===void 0){e=262144}return p(function(e){return new Uint32Array(e)},e,3)}e.forIndexBuffer=u;function l(e){if(e===void 0){e=131072}return p(function(e){return new Int32Array(e)},e,2)}e.forTokenIndices=l;function c(e){if(e===void 0){e=131072}return p(function(e){return new Int32Array(e)},e,1)}e.forIndices=c;function f(e){if(e===void 0){e=131072}return p(function(e){return new Int32Array(e)},e,1)}e.forInt32=f;function h(e){if(e===void 0){e=131072}return p(function(e){return new Float32Array(e)},e,1)}e.forFloat32=h;function d(e){if(e===void 0){e=131072}return p(function(e){return[]},e,1)}e.forArray=d;function p(e,t,r){t=t|0;if(t<=0)t=1;var n=t*r;var i=e(n);return{elementSize:r,chunkSize:n,creator:e,current:i,parts:[i],currentIndex:0,elementCount:0}}e.create=p})(t=e.ChunkedArray||(e.ChunkedArray={}))})(t=e.Utils||(e.Utils={}))})(a||(a={}));/* 37 * Copyright (c) 2016 - now David Sehnal, licensed under MIT License, See LICENSE file for more info. 38 */ 39var a;(function(e){var t;(function(e){var t;(function(e){"use strict";function t(e,t,n){while(t<n&&e.charCodeAt(t)===32)t++;return r(e,t,n)}e.parseIntSkipTrailingWhitespace=t;function r(e,t,r){var n=0,i=1;if(e.charCodeAt(t)===45){i=-1;t++}for(;t<r;t++){var a=e.charCodeAt(t)-48;if(a>9||a<0)return i*n|0;else n=10*n+a|0}return i*n}e.parseInt=r;function n(e,t,n,i){if(t.charCodeAt(n)===43)n++;return e*Math.pow(10,r(t,n,i))}function i(e,t,r){while(t<r&&e.charCodeAt(t)===32)t++;return a(e,t,r)}e.parseFloatSkipTrailingWhitespace=i;function a(e,t,r){var i=1,a=0,o=0,s=1;if(e.charCodeAt(t)===45){i=-1;++t}while(t<r){var u=e.charCodeAt(t)-48;if(u>=0&&u<10){a=a*10+u;++t}else if(u===-2){++t;while(t<r){u=e.charCodeAt(t)-48;if(u>=0&&u<10){o=10*o+u;s=10*s;++t}else if(u===53||u===21){return n(i*(a+o/s),e,t+1,r)}else{return i*(a+o/s)}}return i*(a+o/s)}else if(u===53||u===21){return n(i*a,e,t+1,r)}else break}return i*a}e.parseFloat=a}
39)(t=e.FastNumberParsers||(e.FastNumberParsers={}))})(t=e.Utils||(e.Utils={}))})(a||(a={}));/* 40 * Copyright (c) 2016 - now David Sehnal, licensed under MIT License, See LICENSE file for more info. 41 */ 42var a;(function(e){var t;(function(e){var t=[];(function(){var e="";for(var r=0;r<512;r++){t[r]=e;e=e+" "}})();var r;(function(e){function r(e){if(e===void 0){e=512}return{chunkData:[],chunkOffset:0,chunkCapacity:e,data:[]}}e.create=r;function n(e){if(!e.data.length){if(e.chunkData.length===e.chunkOffset)return e.chunkData.join("");return e.chunkData.splice(0,e.chunkOffset).join("")}if(e.chunkOffset>0){e.data[e.data.length]=e.chunkData.splice(0,e.chunkOffset).join("")}return e.data.join("")}e.asString=n;function i(e,t){a(e);for(var r=0,n=e.data;r<n.length;r++){var i=n[r];t.writeString(i)}}e.writeTo=i;function a(e){if(e.chunkOffset>0){if(e.chunkData.length===e.chunkOffset)e.data[e.data.length]=e.chunkData.join("");else e.data[e.data.length]=e.chunkData.splice(0,e.chunkOffset).join("");e.chunkOffset=0}}function o(e){u(e,"\n")}e.newline=o;function s(e,r){u(e,t[r])}e.whitespace=s;function u(e,t){if(t===undefined||t===null){return}if(e.chunkOffset===e.chunkCapacity){e.data[e.data.length]=e.chunkData.join("");e.chunkOffset=0}e.chunkData[e.chunkOffset++]=t}e.write=u;function l(e,t){if(e.chunkOffset===e.chunkCapacity){e.data[e.data.length]=e.chunkData.join("");e.chunkOffset=0}e.chunkData[e.chunkOffset++]=t}e.writeSafe=l;function c(e,r,n){if(r===undefined||r===null){u(e,t[n])}var i=n-r.length;if(i>0)u(e,t[i]);u(e,r)}e.writePadLeft=c;function f(e,r,n){if(r===undefined||r===null){u(e,t[n])}var i=n-r.length;u(e,r);if(i>0)u(e,t[i])}e.writePadRight=f;function h(e,t){u(e,""+t)}e.writeInteger=h;function d(e,r,n){var i=""+r;var a=n-i.length;if(a>0)u(e,t[a]);u(e,i)}e.writeIntegerPadLeft=d;function p(e,r,n){var i=""+r;var a=n-i.length;u(e,i);if(a>0)u(e,t[a])}e.writeIntegerPadRight=p;function m(e,t,r){u(e,""+Math.round(r*t)/r)}e.writeFloat=m;function v(e,r,n,i){var a=""+Math.round(n*r)/n;var o=i-a.length;if(o>0)u(e,t[o]);u(e,a)}e.writeFloatPadLeft=v;function y(e,r,n,i){var a=""+Math.round(n*r)/n;var o=i-a.length;u(e,a);if(o>0)u(e,t[o])}e.writeFloatPadRight=y})(r=e.StringWriter||(e.StringWriter={}))})(t=e.Utils||(e.Utils={}))})(a||(a={}));/* 43 * Copyright (c) 2016 - now David Sehnal, licensed under MIT License, See LICENSE file for more info. 44 */ 45var a;(function(e){"use strict";var t=function(){function e(){this.isDefined=false}e.prototype.getString=function(e){return null};e.prototype.getInteger=function(e){return 0};e.prototype.getFloat=function(e){return 0};e.prototype.getValuePresence=function(e){return 1};e.prototype.areValuesEqual=function(e,t){return true};e.prototype.stringEquals=function(e,t){return t===null};return e}();e.UndefinedColumn=new t;var r;(function(e){function t(e,t,r,n,i){var a=[];for(var o=1;o<=r;o++){var s=[];for(var u=1;u<=n;u++){s[u-1]=e.getColumn(t+"["+o+"]["+u+"]").getFloat(i)}a[o-1]=s}return a}e.getMatrix=t;function r(e,t,r,n,i){var a=[];for(var o=1;o<=r;o++){a[o-1]=e.getColumn(t+"["+o+"]").getFloat(i)}return a}e.getVector=r})(r=e.Category||(e.Category={}))})(a||(a={}));/* 46 * Copyright (c) 2016 - now David Sehnal, licensed under MIT License, See LICENSE file for more info. 47 */ 48var a;(function(e){"use strict";var t;(function(e){function t(e,t){if(t===void 0){t=-1}return new r(e,t)}e.error=t;function i(e,t){if(t===void 0){t=[]}return new n(e,t)}e.success=i})(t=e.ParserResult||(e.ParserResult={}));var r=function(){function e(e,t){this.message=e;this.line=t;this.isError=true}e.prototype.toString=function(){if(this.line>=0){return"[Line "+this.line+"] "+this.message}return this.message};return e}();e.ParserError=r;var n=function(){function e(e,t){this.result=e;this.warnings=t;this.isError=false}return e}();e.ParserSuccess=n})(a||(a={}));/* 49 * Copyright (c) 2016 - now David Sehnal, licensed under MIT License, See LICENSE file for more info. 50 */ 51/* 52 * Copyright (c) 2016 - now David Sehnal, licensed under MIT License, See LICENSE file for more info. 53 */ 54var a;(function(e){var t;(function(t){"use strict";var r;(function(e){function t(){return Object.create(null)}e.create=t;function r(e,t){if(t.length>6)return t;var r=e[t];if(r!==void 0)return r;e[t]=t;return t}e.get=r})(r||(r={}));var n=function(){function e(e){this.dataBlocks=[];this.data=e}e.prototype.toJSON=function(){return this.dataBlocks.map(function(e){return e.toJSON()})};return e}();t.File=n;var i=function(){function e(e,t){this.header=t;this.data=e;this.categoryList=[];this.additionalData={};this.categoryMap=new Map}Object.defineProperty(e.prototype,"categories",{get:function(){return this.categoryList},enumerable:true,configurable:true});e.prototype.getCategory=function(e){return this.categoryMap.get(e)};e.prototype.addCategory=function(e){this.categoryList[this.categoryList.length]=e;this.categoryMap.set(e.name,e)};e.prototype.toJSON=function(){return{id:this.header,categories:this.categoryList.map(function(e){return e.toJSON()}),additionalData:this.additionalData}};return e}();t.DataBlock=i;var a=function(){function t(e,t,r,n,i,a,o){this.name=t;this.tokens=a;this.data=e;this.startIndex=r;this.endIndex=n;this.columnCount=i.length;this.rowCount=o/i.length|0;this.columnIndices=new Map;this.columnNameList=[];for(var s=0;s<i.length;s++){var u=i[s].substr(t.length+1);this.columnIndices.set(u,s);this.columnNameList.push(u)}}Object.defineProperty(t.prototype,"columnNames",{get:function(){return this.columnNameList},enumerable:true,configurable:true});t.prototype.getColumn=function(t){var r=this.columnIndices.get(t);if(r!==void 0)return new u(this,this.data,t,r);return e.UndefinedColumn};t.prototype.toJSON=function(){var e=[],t=this.data,n=this.tokens;var i=this.columnNameList;var a=r.create();for(var o=0;o<this.rowCount;o++){var s={};for(var u=0;u<this.columnCount;u++){var l=(o*this.columnCount+u)*2;s[i[u]]=r.get(a,t.substring(n[l],n[l+1]))}e[o]=s}return{name:this.name,columns:i,rows:e}};return t}();t.Category=a;var o=e.Utils.FastNumberParsers.parseInt;var s=e.Utils.FastNumberParsers.parseFloat;var u=function(){function e(e,t,n,i){this.data=t;this.name=n;this.index=i;this.stringPool=r.create();this.isDefined=true;this.tokens=e.tokens;this.columnCount=e.columnCount}e.prototype.getString=function(e){var t=(e*this.columnCount+this.index)*2;var n=r.get(this.stringPool,this.data.substring(this.tokens[t],this.tokens[t+1]));if(n==="."||n==="?")return null;return n};e.prototype.getInteger=function(e){var t=(e*this.columnCount+this.index)*2;return o(this.data,this.tokens[t],this.tokens[t+1])};e.prototype.getFloat=function(e){var t=(e*this.columnCount+this.index)*2;return s(this.data,this.tokens[t],this.tokens[t+1])};e.prototype.stringEquals=function(e,t){var r=(e*this.columnCount+this.index)*2,n=this.tokens[r],i=t.length;if(i!==this.tokens[r+1]-n)return false;for(var a=0;a<i;a++){if(this.data.charCodeAt(a+n)!==t.charCodeAt(a))return false}return true};e.prototype.areValuesEqual=function(e,t){var r=(e*this.columnCount+this.index)*2,n=(t*this.columnCount+this.index)*2;var i=this.tokens[r],a=this.tokens[n],o=this.tokens[r+1]-i;if(o!==this.tokens[n+1]-a)return false;for(var s=0;s<o;s++){if(this.data.charCodeAt(s+i)!==this.data.charCodeAt(s+a)){return false}}return true};e.prototype.getValuePresence=function(e){var t=e*this.columnCount+this.index;var r=this.tokens[2*t];if(this.tokens[2*t+1]-r!==1)return 0;var n=this.data.charCodeAt(r);if(n===46)return 1;if(n===63)return 2;return 0};return e}();t.Column=u})(t=e.Text||(e.Text={}))})(a||(a={}));/* 55 * Copyright (c) 2016 - now David Sehnal, licensed under MIT License, See LICENSE file for more info. 56 */ 57var a;(function(e){var t;(function(t){"use strict";var r;(function(e){function t(e){var t=new Int32Array(1.61*e.tokens.length|0);t.set(e.tokens);e.tokens=t;e.tokensLenMinus2=t.length-2|0}function r(e,r,n){if(e.count>=e.tokensLenMinus2){t(e)}e.tokens[e.count++]=r;e.tokens[e.count++]=n}e.addToken=r;function n(e){return{tokensLenMinus2:e-2|0,count:0,tokens:new Int32Array(e)}}e.create=n})(r||(r={}));function n(e){while(e.position<e.length){switch(e.data.charCodeAt(e.position)){case 9:case 10:case 13:case 32:e.currentTokenEnd=e.position;return;default:++e.position;break}}e.currentTokenEnd=e.position}function i(e,t){var r,n;++e.position;while(e.position<e.length){n=e.data.charCodeAt(e.position);if(n===t){r=e.data.charCodeAt(e.position+1);switch(r){case 9:case 10:case 13:case 32:e.currentTokenStart++;e.currentTokenEnd=e.position;e.isEscaped=true;++e.position;return;default:if(r===void 0){e.currentTokenStart++;e.currentTokenEnd=e.position;e.isEscaped=true;++e.position;return}++e.position;break}}else{if(n===10||n===13){e.currentTokenEnd=e.position;return}++e.position}}e.currentTokenEnd=e.position}function a(e){var t=59,r=e.position+1,n;while(r<e.length){n=e.data.charCodeAt(r);if(n===59&&(t===10||t===13)){e.position=r+1;e.currentTokenStart++;r--;n=e.data.charCodeAt(r);while(n===10||n===13){r--;n=e.data.charCodeAt(r)}e.currentTokenEnd=r+1;e.isEscaped=true;return}else{if(n===13){e.currentLineNumber++}else if(n===10&&t!==13){e.currentLineNumber++}t=n;++r}}e.position=r;return t}function o(e){while(e.position<e.length){var t=e.data.charCodeAt(e.position);if(t===10||t===13){return}++e.position}}function s(e){var t=10;while(e.position<e.length){var r=e.data.charCodeAt(e.position);switch(r){case 9:case 32:t=r;++e.position;break;case 10:if(t!==13){++e.currentLineNumber}t=r;++e.position;break;case 13:t=r;++e.position;++e.currentLineNumber;break;default:return t}}return t}function u(e){var t=e.data.charCodeAt(e.currentTokenStart);if(t!==68&&t!==100)return false;t=e.data.charCodeAt(e.currentTokenStart+1);if(t!==65&&t!==97)return false;t=e.data.charCodeAt(e.currentTokenStart+2);if(t!==84&&t!==116)return false;t=e.data.charCodeAt(e.currentTokenStart+3);if(t!==65&&t!==97)return false;return true}function l(e){var t=e.data.charCodeAt(e.currentTokenStart);if(t!==83&&t!==115)return false;t=e.data.charCodeAt(e.currentTokenStart+1);if(t!==65&&t!==97)return false;t=e.data.charCodeAt(e.currentTokenStart+2);if(t!==86&&t!==118)return false;t=e.data.charCodeAt(e.currentTokenStart+3);if(t!==69&&t!==101)return false;return true}function c(e){if(e.currentTokenEnd-e.currentTokenStart!==5)return false;var t=e.data.charCodeAt(e.currentTokenStart);if(t!==76&&t!==108)return false;t=e.data.charCodeAt(e.currentTokenStart+1);if(t!==79&&t!==111)return false;t=e.data.charCodeAt(e.currentTokenStart+2);if(t!==79&&t!==111)return false;t=e.data.charCodeAt(e.currentTokenStart+3);if(t!==80&&t!==112)return false;return true}function f(e,t,r){var n,i=r-t,a=e.currentTokenStart-t,o=e.currentTokenEnd-e.currentTokenStart;if(o<i)return false;for(n=t;n<r;++n){if(e.data.charCodeAt(n)!==e.data.charCodeAt(n+a))return false}if(i===o)return true;if(e.data.charCodeAt(n+a)===46){return true}return false}function h(e){var t;for(t=e.currentTokenStart;t<e.currentTokenEnd;++t){if(e.data.charCodeAt(t)===46)return t}return t}function d(e,t){return e.data.substring(e.currentTokenStart,t)}function p(e){return e.data.substring(e.currentTokenStart,e.currentTokenEnd)}function m(e){var t=s(e);if(e.position>=e.length){e.currentTokenType=6;return}e.currentTokenStart=e.position;e.currentTokenEnd=e.position;e.isEscaped=false;var r=e.data.charCodeAt(e.position);switch(r){case 35:o(e);e.currentTokenType=5;break;case 34:case 39:i(e,r);e.currentTokenType=3;break;case 59:if(t===10||t===13){a(e)}else{n(e)}e.currentTokenType=3;break;default:n(e);if(e.isEscaped){e.currentTokenType=3}else if(e.data.charCodeAt(e.currentTokenStart)===95){e.currentTokenType=4}else if(e.currentTokenEnd-e.currentTokenStart>=5&&e.data.charCodeAt(e.currentTokenStart+4)===95){if(u(e))e.currentTokenType=0;else if(l(e))e.currentTokenType=1;else if(c(e))e.currentTokenType=2;else e.currentTokenType=3}else{e.currentTokenType=3}break}}function v(e){m(e);while(e.currentTokenType===5)m(e)}
57function y(e){return{data:e,length:e.length,position:0,currentTokenStart:0,currentTokenEnd:0,currentTokenType:6,currentLineNumber:1,isEscaped:false}}function g(e,n){var i=e.currentTokenStart,a=h(e),o=d(e,a),s,u=[],l=r.create(512),c=0,m=true;while(m){if(e.currentTokenType!==4||!f(e,i,a)){m=false;break}s=p(e);v(e);if(e.currentTokenType!==3){return{hasError:true,errorLine:e.currentLineNumber,errorMessage:"Expected value."}}u[u.length]=s;r.addToken(l,e.currentTokenStart,e.currentTokenEnd);c++;v(e)}n.addCategory(new t.Category(n.data,o,i,e.currentTokenStart,u,l.tokens,c));return{hasError:false,errorLine:0,errorMessage:""}}function b(e,n){var i=e.currentTokenStart,a=e.currentLineNumber;v(e);var o=d(e,h(e)),s=[],u=r.create(o==="_atom_site"?n.data.length/1.85|0:1024),l=0;while(e.currentTokenType===4){s[s.length]=p(e);v(e)}while(e.currentTokenType===3){r.addToken(u,e.currentTokenStart,e.currentTokenEnd);l++;v(e)}if(l%s.length!==0){return{hasError:true,errorLine:e.currentLineNumber,errorMessage:"The number of values for loop starting at line "+a+" is not a multiple of the number of columns."}}n.addCategory(new t.Category(n.data,o,i,e.currentTokenStart,s,u.tokens,l));return{hasError:false,errorLine:0,errorMessage:""}}function x(t,r){return e.ParserResult.error(r,t)}function _(t){return e.ParserResult.success(t)}function w(e){var r=y(e),n,i,a=new t.File(e),o=new t.DataBlock(e,"default"),s=new t.DataBlock(e,"empty"),u=false,l;v(r);while(r.currentTokenType!==6){var c=r.currentTokenType;if(c===0){if(u){return x(r.currentLineNumber,"Unexpected data block inside a save frame.")}if(o.categories.length>0){a.dataBlocks.push(o)}o=new t.DataBlock(e,e.substring(r.currentTokenStart+5,r.currentTokenEnd));v(r)}else if(c===1){i=e.substring(r.currentTokenStart+5,r.currentTokenEnd);if(i.length===0){if(s.categories.length>0){l=o.additionalData["saveFrames"];if(!l){l=[];o.additionalData["saveFrames"]=l}l[l.length]=s}u=false}else{if(u){return x(r.currentLineNumber,"Save frames cannot be nested.")}u=true;s=new t.DataBlock(e,i)}v(r)}else if(c===2){n=b(r,u?s:o);if(n.hasError){return x(n.errorLine,n.errorMessage)}}else if(c===4){n=g(r,u?s:o);if(n.hasError){return x(n.errorLine,n.errorMessage)}}else{return x(r.currentLineNumber,"Unexpected token. Expected data_, loop_, or data name.")}}if(u){return x(r.currentLineNumber,"Unfinished save frame (`"+s.header+"`).")}if(o.categories.length>0){a.dataBlocks.push(o)}return _(a)}function C(e){return w(e)}t.parse=C})(t=e.Text||(e.Text={}))})(a||(a={}));/* 58 * Copyright (c) 2016 - now David Sehnal, licensed under MIT License, See LICENSE file for more info. 59 */ 60var a;(function(e){var t;(function(t){"use strict";var r=e.Utils.StringWriter;var n=function(){function e(){this.writer=r.create();this.encoded=false;this.dataBlockCreated=false}e.prototype.startDataBlock=function(e){this.dataBlockCreated=true;r.write(this.writer,"data_"+(e||"").replace(/[ \n\t]/g,"").toUpperCase()+"\n#\n")};e.prototype.writeCategory=function(e,t){if(this.encoded){throw new Error("The writer contents have already been encoded, no more writing.")}if(!this.dataBlockCreated){throw new Error("No data block created.")}var r=!t||!t.length?[e(void 0)]:t.map(function(t){return e(t)});var n=r.filter(function(e){return e&&e.count>0});if(!n.length)return;var i=n.reduce(function(e,t){return e+(t.count===void 0?1:t.count)},0);if(!i)return;else if(i===1){a(n[0],this.writer)}else{o(n,this.writer)}};e.prototype.encode=function(){this.encoded=true};e.prototype.flush=function(e){r.writeTo(this.writer,e)};return e}();t.Writer=n;function i(e){return!!e&&e.indexOf("\n")>=0}function a(e,t){var n=e.desc.fields;var a=e.data;var o=n.reduce(function(e,t){return Math.max(e,t.name.length)},0)+e.desc.name.length+5;for(var s=0,u=n;s<u.length;s++){var l=u[s];r.writePadRight(t,e.desc.name+"."+l.name,o);var p=l.presence;var m=p?p(a,0):0;if(m!==0){if(m===1)c(t);else f(t)}else{var v=l.string(a,0);if(i(v)){d(t,v);r.newline(t)}else{h(t,v)}}r.newline(t)}r.write(t,"#\n")}function o(e,t){s(t,"loop_");var n=e[0];var a=n.desc.fields;for(var o=0,u=a;o<u.length;o++){var l=u[o];
60s(t,n.desc.name+"."+l.name)}for(var p=0,m=e;p<m.length;p++){var v=m[p];var y=v.data;var g=v.count;for(var b=0;b<g;b++){for(var x=0,_=a;x<_.length;x++){var l=_[x];var w=l.presence;var C=w?w(y,b):0;if(C!==0){if(C===1)c(t);else f(t)}else{var E=l.string(y,b);if(i(E)){d(t,E);r.newline(t)}else{h(t,E)}}}r.newline(t)}}r.write(t,"#\n")}function s(e,t){r.write(e,t);r.newline(e)}function u(e,t){r.writeSafe(e,""+t+" ")}function l(e,t,n){r.writeSafe(e,""+Math.round(n*t)/n+" ")}function c(e){r.writeSafe(e,". ")}function f(e){r.writeSafe(e,"? ")}function h(e,t){if(!t){r.writeSafe(e,". ");return}var n=false,i="'",a="' ";var o=false;var s=false;var u=false;for(var l=0,c=t.length-1;l<c;l++){var f=t.charCodeAt(l);switch(f){case 9:o=true;break;case 10:r.writeSafe(e,"\n;"+t);r.writeSafe(e,"\n; ");return;case 32:o=true;break;case 34:if(s){r.writeSafe(e,"\n;"+t);r.writeSafe(e,"\n; ");return}u=true;n=true;i="'";a="' ";break;case 39:if(u){r.writeSafe(e,"\n;"+t);r.writeSafe(e,"\n; ");return}n=true;s=true;i='"';a='" ';break}}var h=t.charCodeAt(0);if(!n&&(h===35||h===59||o)){i="'";a="' ";n=true}if(n){r.writeSafe(e,i+t+a)}else{r.write(e,t);r.writeSafe(e," ")}}function d(e,t){r.writeSafe(e,"\n;"+t);r.writeSafe(e,"\n; ")}function p(e,t,n,i){var a=false,o="'",s="' ";for(var u=n;u<i-1;u++){var l=t.charCodeAt(u);switch(l){case 10:r.writeSafe(e,"\n;"+t.substring(n,i));r.writeSafe(e,"\n; ");return;case 34:a=true;o="'";s="' ";break;case 39:a=true;o='"';s='" ';break}}if(!a&&t.charCodeAt(n)===59){o="'";s="' ";a=true}if(a){r.writeSafe(e,o+t.substring(n,i));r.writeSafe(e,o)}else{r.write(e,t.substring(n,i));r.writeSafe(e," ")}}})(t=e.Text||(e.Text={}))})(a||(a={}));/* 61 * Copyright (c) 2016 - now David Sehnal, licensed under MIT License, See LICENSE file for more info. 62 */ 63var a;(function(e){var t;(function(e){var t;(function(e){/* 64 * Adapted from https://github.com/rcsb/mmtf-javascript 65 * by Alexander Rose <[email protected]>, MIT License, Copyright (c) 2016 66 */ 67function t(e,t){var r={};for(var n=0;n<t;n++){var i=a(e);r[i]=a(e)}return r}function r(e,t){var r=new Uint8Array(t);var n=e.offset;for(var i=0;i<t;i++)r[i]=e.buffer[i+n];e.offset+=t;return r}function n(t,r){var n=e.utf8Read(t.buffer,t.offset,r);t.offset+=r;return n}function i(e,t){var r=new Array(t);for(var n=0;n<t;n++){r[n]=a(e)}return r}function a(e){var a=e.buffer[e.offset];var o,s;if((a&128)===0){e.offset++;return a}if((a&240)===128){s=a&15;e.offset++;return t(e,s)}if((a&240)===144){s=a&15;e.offset++;return i(e,s)}if((a&224)===160){s=a&31;e.offset++;return n(e,s)}if((a&224)===224){o=e.dataView.getInt8(e.offset);e.offset++;return o}switch(a){case 192:e.offset++;return null;case 194:e.offset++;return false;case 195:e.offset++;return true;case 196:s=e.dataView.getUint8(e.offset+1);e.offset+=2;return r(e,s);case 197:s=e.dataView.getUint16(e.offset+1);e.offset+=3;return r(e,s);case 198:s=e.dataView.getUint32(e.offset+1);e.offset+=5;return r(e,s);case 202:o=e.dataView.getFloat32(e.offset+1);e.offset+=5;return o;case 203:o=e.dataView.getFloat64(e.offset+1);e.offset+=9;return o;case 204:o=e.buffer[e.offset+1];e.offset+=2;return o;case 205:o=e.dataView.getUint16(e.offset+1);e.offset+=3;return o;case 206:o=e.dataView.getUint32(e.offset+1);e.offset+=5;return o;case 208:o=e.dataView.getInt8(e.offset+1);e.offset+=2;return o;case 209:o=e.dataView.getInt16(e.offset+1);e.offset+=3;return o;case 210:o=e.dataView.getInt32(e.offset+1);e.offset+=5;return o;case 217:s=e.dataView.getUint8(e.offset+1);e.offset+=2;return n(e,s);case 218:s=e.dataView.getUint16(e.offset+1);e.offset+=3;return n(e,s);case 219:s=e.dataView.getUint32(e.offset+1);e.offset+=5;return n(e,s);case 220:s=e.dataView.getUint16(e.offset+1);e.offset+=3;return i(e,s);case 221:s=e.dataView.getUint32(e.offset+1);e.offset+=5;return i(e,s);case 222:s=e.dataView.getUint16(e.offset+1);e.offset+=3;return t(e,s);case 223:s=e.dataView.getUint32(e.offset+1);e.offset+=5;return t(e,s)}throw new Error("Unknown type 0x"+a.toString(16))}function o(e){return a({buffer:e,offset:0,dataView:new DataView(e.buffer)})}e.decode=o})(t=e.MessagePack||(e.MessagePack={}))})(t=e.Binary||(e.Binary={}))})(a||(a={}));/* 68 * Copyright (c) 2016 - now David Sehnal, licensed under MIT License, See LICENSE file for more info. 69 */ 70var a;(function(e){var t;(function(e){var t;(function(e){/* 71 * Adapted from https://github.com/rcsb/mmtf-javascript 72 * by Alexander Rose <[email protected]>, MIT License, Copyright (c) 2016 73 */ 74function t(e){var t=new ArrayBuffer(r(e));var i=new DataView(t);var a=new Uint8Array(t);n(e,i,a,0);return a}e.encode=t;function r(t){var n=typeof t;if(n==="string"){var i=e.utf8ByteCount(t);if(i<32){return 1+i}if(i<256){return 2+i}if(i<65536){return 3+i}if(i<4294967296){return 5+i}}if(t instanceof Uint8Array){var a=t.byteLength;if(a<256){return 2+a}if(a<65536){return 3+a}if(a<4294967296){return 5+a}}
74if(n==="number"){if(Math.floor(t)!==t)return 9;if(t>=0){if(t<128)return 1;if(t<256)return 2;if(t<65536)return 3;if(t<4294967296)return 5;throw new Error("Number too big 0x"+t.toString(16))}if(t>=-32)return 1;if(t>=-128)return 2;if(t>=-32768)return 3;if(t>=-2147483648)return 5;throw new Error("Number too small -0x"+t.toString(16).substr(1))}if(n==="boolean"||t===null||t===void 0)return 1;if(n==="object"){var o,s=0;if(Array.isArray(t)){o=t.length;for(var u=0;u<o;u++){s+=r(t[u])}}else{var l=Object.keys(t);o=l.length;for(var u=0;u<o;u++){var c=l[u];s+=r(c)+r(t[c])}}if(o<16){return 1+s}if(o<65536){return 3+s}if(o<4294967296){return 5+s}throw new Error("Array or object too long 0x"+o.toString(16))}throw new Error("Unknown type "+n)}function n(t,r,i,a){var o=typeof t;if(o==="string"){var s=e.utf8ByteCount(t);if(s<32){r.setUint8(a,s|160);e.utf8Write(i,a+1,t);return 1+s}if(s<256){r.setUint8(a,217);r.setUint8(a+1,s);e.utf8Write(i,a+2,t);return 2+s}if(s<65536){r.setUint8(a,218);r.setUint16(a+1,s);e.utf8Write(i,a+3,t);return 3+s}if(s<4294967296){r.setUint8(a,219);r.setUint32(a+1,s);e.utf8Write(i,a+5,t);return 5+s}}if(t instanceof Uint8Array){var u=t.byteLength;var l=new Uint8Array(r.buffer);if(u<256){r.setUint8(a,196);r.setUint8(a+1,u);l.set(t,a+2);return 2+u}if(u<65536){r.setUint8(a,197);r.setUint16(a+1,u);l.set(t,a+3);return 3+u}if(u<4294967296){r.setUint8(a,198);r.setUint32(a+1,u);l.set(t,a+5);return 5+u}}if(o==="number"){if(!isFinite(t)){throw new Error("Number not finite: "+t)}if(Math.floor(t)!==t){r.setUint8(a,203);r.setFloat64(a+1,t);return 9}if(t>=0){if(t<128){r.setUint8(a,t);return 1}if(t<256){r.setUint8(a,204);r.setUint8(a+1,t);return 2}if(t<65536){r.setUint8(a,205);r.setUint16(a+1,t);return 3}if(t<4294967296){r.setUint8(a,206);r.setUint32(a+1,t);return 5}throw new Error("Number too big 0x"+t.toString(16))}if(t>=-32){r.setInt8(a,t);return 1}if(t>=-128){r.setUint8(a,208);r.setInt8(a+1,t);return 2}if(t>=-32768){r.setUint8(a,209);r.setInt16(a+1,t);return 3}if(t>=-2147483648){r.setUint8(a,210);r.setInt32(a+1,t);return 5}throw new Error("Number too small -0x"+(-t).toString(16).substr(1))}if(t===null||t===undefined){r.setUint8(a,192);return 1}if(o==="boolean"){r.setUint8(a,t?195:194);return 1}if(o==="object"){var c,f=0;var h=Array.isArray(t);var d=void 0;if(h){c=t.length}else{d=Object.keys(t);c=d.length}if(c<16){r.setUint8(a,c|(h?144:128));f=1}else if(c<65536){r.setUint8(a,h?220:222);r.setUint16(a+1,c);f=3}else if(c<4294967296){r.setUint8(a,h?221:223);r.setUint32(a+1,c);f=5}if(h){for(var p=0;p<c;p++){f+=n(t[p],r,i,a+f)}}else{for(var m=0,v=d;m<v.length;m++){var y=v[m];f+=n(y,r,i,a+f);f+=n(t[y],r,i,a+f)}}return f}throw new Error("Unknown type "+o)}})(t=e.MessagePack||(e.MessagePack={}))})(t=e.Binary||(e.Binary={}))})(a||(a={}));/* 75 * Copyright (c) 2016 - now David Sehnal, licensed under MIT License, See LICENSE file for more info. 76 */ 77var a;(function(e){var t;(function(e){var t;(function(e){/* 78 * Adapted from https://github.com/rcsb/mmtf-javascript 79 * by Alexander Rose <[email protected]>, MIT License, Copyright (c) 2016 80 */ 81function t(e,t,r){var n=e.byteLength;for(var i=0,a=r.length;i<a;i++){var o=r.charCodeAt(i);if(o<128){e[t++]=o>>>0&127|0;continue}if(o<2048){e[t++]=o>>>6&31|192;e[t++]=o>>>0&63|128;continue}if(o<65536){e[t++]=o>>>12&15|224;e[t++]=o>>>6&63|128;e[t++]=o>>>0&63|128;continue}if(o<1114112){e[t++]=o>>>18&7|240;e[t++]=o>>>12&63|128;e[t++]=o>>>6&63|128;e[t++]=o>>>0&63|128;continue}throw new Error("bad codepoint "+o)}}e.utf8Write=t;var r=function(){var e=[];for(var t=0;t<1024;t++)e[t]=String.fromCharCode(t);return e}();function n(e){throw new Error(e)}function i(e,t,i){var a=r;var o=void 0,s=[],u=512,l=0;for(var c=t,f=t+i;c<f;c++){var h=e[c];if((h&128)===0){s[l++]=a[h]}else if((h&224)===192){s[l++]=a[(h&15)<<6|e[++c]&63]}else if((h&240)===224){s[l++]=String.fromCharCode((h&15)<<12|(e[++c]&63)<<6|(e[++c]&63)<<0)}else if((h&248)===240){s[l++]=String.fromCharCode((h&7)<<18|(e[++c]&63)<<12|(e[++c]&63)<<6|(e[++c]&63)<<0)}else n("Invalid byte "+h.toString(16));if(l===u){o=o||[];o[o.length]=s.join("");l=0}}if(!o)return s.slice(0,l).join("");if(l>0){o[o.length]=s.slice(0,l).join("")}return o.join("")}e.utf8Read=i;function a(e){var t=0;for(var r=0,i=e.length;r<i;r++){var a=e.charCodeAt(r);if(a<128){t+=1;continue}if(a<2048){t+=2;continue}if(a<65536){t+=3;continue}if(a<1114112){t+=4;continue}n("bad codepoint "+a)}return t}e.utf8ByteCount=a})(t=e.MessagePack||(e.MessagePack={}))})(t=e.Binary||(e.Binary={}))})(a||(a={}));/* 82 * Copyright (c) 2016 - now David Sehnal, licensed under MIT License, See LICENSE file for more info. 83 */ 84var a;(function(e){var t;(function(e){"use strict";/** 85 * Fixed point, delta, RLE, integer packing adopted from https://github.com/rcsb/mmtf-javascript/ 86 * by Alexander Rose <[email protected]>, MIT License, Copyright (c) 2016 87 */ 88function t(e){var t=e.data;for(var n=e.encoding.length-1;n>=0;n--){t=r.decodeStep(t,e.encoding[n])}return t}e.decode=t;var r;(function(e){function r(e,t){switch(t.kind){case"ByteArray":{switch(t.type){case 4:return e;case 1:return o(e);case 2:return l(e);case 5:return c(e);case 3:return f(e);case 6:return h(e);case 32:return d(e);case 33:return p(e);default:throw new Error("Unsupported ByteArray type.")}}case"FixedPoint":return m(e,t);case"IntervalQuantization":return v(e,t);case"RunLength":return y(e,t);case"Delta":return g(e,t);case"IntegerPacking":return _(e,t);case"StringArray":return w(e,t)}}e.decodeStep=r;function n(e,t){switch(e){case 1:return new Int8Array(t);case 2:return new Int16Array(t);case 3:return new Int32Array(t);case 4:return new Uint8Array(t);case 5:return new Uint16Array(t);case 6:return new Uint32Array(t);default:throw new Error("Unsupported integer data type.")}}function i(e,t){switch(e){case 32:return new Float32Array(t);case 33:return new Float64Array(t);default:throw new Error("Unsupported floating data type.")}}var a=function(){var e=new ArrayBuffer(2);var t=new Uint8Array(e);
88var r=new Uint16Array(e);t[0]=170;t[1]=187;if(r[0]===48042)return true;return false}();function o(e){return new Int8Array(e.buffer,e.byteOffset)}function s(e,t){var r=new ArrayBuffer(e.length);var n=new Uint8Array(r);for(var i=0,a=e.length;i<a;i+=t){for(var o=0;o<t;o++){n[i+t-o-1]=e[i+o]}}return r}function u(e,t,r){if(a)return new r(e.buffer);return new r(s(e,t))}function l(e){return u(e,2,Int16Array)}function c(e){return u(e,2,Uint16Array)}function f(e){return u(e,4,Int32Array)}function h(e){return u(e,4,Uint32Array)}function d(e){return u(e,4,Float32Array)}function p(e){return u(e,8,Float64Array)}function m(e,t){var r=e.length;var n=i(t.srcType,r);var a=1/t.factor;for(var o=0;o<r;o++){n[o]=a*e[o]}return n}function v(e,t){var r=e.length;var n=i(t.srcType,r);var a=(t.max-t.min)/(t.numSteps-1);var o=t.min;for(var s=0;s<r;s++){n[s]=o+a*e[s]}return n}function y(e,t){var r=n(t.srcType,t.srcSize);var i=0;for(var a=0,o=e.length;a<o;a+=2){var s=e[a];var u=e[a+1];for(var l=0;l<u;++l){r[i++]=s}}return r}function g(e,t){var r=e.length;var i=n(t.srcType,r);if(!r)return i;i[0]=e[0]+(t.origin|0);for(var a=1;a<r;++a){i[a]=e[a]+i[a-1]}return i}function b(e,t){var r=t.byteCount===1?127:32767;var n=-r-1;var i=e.length;var a=new Int32Array(t.srcSize);var o=0;var s=0;while(o<i){var u=0,l=e[o];while(l===r||l===n){u+=l;o++;l=e[o]}u+=l;a[s]=u;o++;s++}return a}function x(e,t){var r=t.byteCount===1?255:65535;var n=e.length;var i=new Int32Array(t.srcSize);var a=0;var o=0;while(a<n){var s=0,u=e[a];while(u===r){s+=u;a++;u=e[a]}s+=u;i[o]=s;a++;o++}return i}function _(e,t){return t.isUnsigned?x(e,t):b(e,t)}function w(e,r){var n=r.stringData;var i=t({encoding:r.offsetEncoding,data:r.offsets});var a=t({encoding:r.dataEncoding,data:e});var o=Object.create(null);var s=new Array(a.length);var u=0;for(var l=0,c=a;l<c.length;l++){var f=c[l];if(f<0){s[u++]=null;continue}var h=o[f];if(h===void 0){h=n.substring(i[f],i[f+1]);o[f]=h}s[u++]=h}return s}})(r||(r={}))})(t=e.Binary||(e.Binary={}))})(a||(a={}));/* 89 * Copyright (c) 2016 - now David Sehnal, licensed under MIT License, See LICENSE file for more info. 90 */ 91var a;(function(e){var t;(function(t){"use strict";var r=function(){function e(e){this.dataBlocks=e.dataBlocks.map(function(e){return new n(e)})}e.prototype.toJSON=function(){return this.dataBlocks.map(function(e){return e.toJSON()})};return e}();t.File=r;var n=function(){function e(e){this.additionalData={};this.header=e.header;this.categoryList=e.categories.map(function(e){return new i(e)});this.categoryMap=new Map;for(var t=0,r=this.categoryList;t<r.length;t++){var n=r[t];this.categoryMap.set(n.name,n)}}Object.defineProperty(e.prototype,"categories",{get:function(){return this.categoryList},enumerable:true,configurable:true});e.prototype.getCategory=function(e){return this.categoryMap.get(e)};e.prototype.toJSON=function(){return{id:this.header,categories:this.categoryList.map(function(e){return e.toJSON()}),additionalData:this.additionalData}};return e}();t.DataBlock=n;var i=function(){function t(e){this.name=e.name;this.columnCount=e.columns.length;this.rowCount=e.rowCount;this.columnNameList=[];this.encodedColumns=new Map;for(var t=0,r=e.columns;t<r.length;t++){var n=r[t];this.encodedColumns.set(n.name,n);this.columnNameList.push(n.name)}}Object.defineProperty(t.prototype,"columnNames",{get:function(){return this.columnNameList},enumerable:true,configurable:true});t.prototype.getColumn=function(t){var r=this.encodedColumns.get(t);if(r)return a(r);return e.UndefinedColumn};t.prototype.toJSON=function(){var e=this;var t=[];var r=this.columnNameList.map(function(t){return{name:t,column:e.getColumn(t)}});for(var n=0;n<this.rowCount;n++){var i={};for(var a=0,o=r;a<o.length;a++){var s=o[a];var u=s.column.getValuePresence(n);if(u===0)i[s.name]=s.column.getString(n);else if(u===1)i[s.name]=".";else i[s.name]="?"}t[n]=i}return{name:this.name,columns:this.columnNames,rows:t}};return t}();t.Category=i;function a(r){if(!r.data.data)return e.UndefinedColumn;var n=t.decode(r.data);var i=void 0;if(r.mask)i=t.decode(r.mask);if(n.buffer&&n.byteLength&&n.BYTES_PER_ELEMENT){return i?new l(n,i):new u(n)}return i?new f(n,i):new c(n)}var o=e.Utils.FastNumberParsers.parseInt;var s=e.Utils.FastNumberParsers.parseFloat;var u=function(){function e(e){this.data=e;this.isDefined=true}e.prototype.getString=function(e){return""+this.data[e]};e.prototype.getInteger=function(e){return this.data[e]|0};e.prototype.getFloat=function(e){return 1*this.data[e]};e.prototype.stringEquals=function(e,t){return this.data[e]===s(t,0,t.length)};e.prototype.areValuesEqual=function(e,t){return this.data[e]===this.data[t]};e.prototype.getValuePresence=function(e){return 0};return e}();var l=function(){function e(e,t){this.data=e;this.mask=t;this.isDefined=true}e.prototype.getString=function(e){return this.mask[e]===0?""+this.data[e]:null};e.prototype.getInteger=function(e){return this.mask[e]===0?this.data[e]:0};e.prototype.getFloat=function(e){return this.mask[e]===0?this.data[e]:0};e.prototype.stringEquals=function(e,t){return this.mask[e]===0?this.data[e]===s(t,0,t.length):t===null||t===void 0};e.prototype.areValuesEqual=function(e,t){return this.data[e]===this.data[t]};e.prototype.getValuePresence=function(e){return this.mask[e]};return e}();var c=function(){function e(e){this.data=e;this.isDefined=true}e.prototype.getString=function(e){return this.data[e]};e.prototype.getInteger=function(e){var t=this.data[e];return o(t,0,t.length)};e.prototype.getFloat=function(e){var t=this.data[e];return s(t,0,t.length)};e.prototype.stringEquals=function(e,t){return this.data[e]===t};e.prototype.areValuesEqual=function(e,t){return this.data[e]===this.data[t]};e.prototype.getValuePresence=function(e){return 0};return e}();var f=function(){function e(e,t){this.data=e;this.mask=t;this.isDefined=true}e.prototype.getString=function(e){return this.mask[e]===0?this.data[e]:null};e.prototype.getInteger=function(e){if(this.mask[e]!==0)return 0;var t=this.data[e];return o(t||"",0,(t||"").length)};e.prototype.getFloat=function(e){if(this.mask[e]!==0)return 0;var t=this.data[e];return s(t||"",0,(t||"").length)};e.prototype.stringEquals=function(e,t){return this.data[e]===t};e.prototype.areValuesEqual=function(e,t){return this.data[e]===this.data[t]};e.prototype.getValuePresence=function(e){return this.mask[e]};return e}()})(t=e.Binary||(e.Binary={}))})(a||(a={}));/* 92 * Copyright (c) 2016 - now David Sehnal, licensed under MIT License, See LICENSE file for more info. 93 */ 94var a;(function(e){var t;(function(t){"use strict";/** 95 * Fixed point, delta, RLE, integer packing adopted from https://github.com/rcsb/mmtf-javascript/ 96 * by Alexander Rose <[email protected]>, MIT License, Copyright (c) 2016 97 */ 98var r=function(){function e(e){this.providers=e}e.prototype.and=function(t){return new e(this.providers.concat([t]))};e.prototype.encode=function(e){var t=[];for(var r=0,n=this.providers;r<n.length;r++){var i=n[r];var a=i(e);if(!a.encodings.length){throw new Error("Encodings must be non-empty.")}e=a.data;for(var o=0,s=a.encodings;o<s.length;o++){var u=s[o];t.push(u)}}if(!(e instanceof Uint8Array)){throw new Error("The encoding must result in a Uint8Array. Fix your encoding chain.")}return{encoding:t,data:e}};return e}();t.Encoder=r;(function(r){function n(e){return new r([e])}r.by=n;function i(e){return{encodings:[{kind:"ByteArray",type:4}],data:e}}function a(e){return{encodings:[{kind:"ByteArray",type:1}],data:new Uint8Array(e.buffer,e.byteOffset)}}var o=(_={},_[2]=function(e,t,r){e.setInt16(2*t,r,true)},_[5]=function(e,t,r){e.setUint16(2*t,r,true)},_[3]=function(e,t,r){e.setInt32(4*t,r,true)},_[6]=function(e,t,r){e.setUint32(4*t,r,true)},_[32]=function(e,t,r){e.setFloat32(4*t,r,true)},_[33]=function(e,t,r){e.setFloat64(8*t,r,true)},_);var s=(w={},w[2]=2,w[5]=2,w[3]=4,w[6]=4,w[32]=4,w[33]=8,w);function u(e){var r=t.Encoding.getDataType(e);if(r===1)return a(e);else if(r===4)return i(e);var n=new Uint8Array(e.length*s[r]);var u=o[r];var l=new DataView(n.buffer);for(var c=0,f=e.length;c<f;c++){u(l,c,e[c])}return{encodings:[{kind:"ByteArray",type:r}],data:n}}r.byteArray=u;function l(e,r){var n=t.Encoding.getDataType(e);var i=new Int32Array(e.length);for(var a=0,o=e.length;a<o;a++){i[a]=Math.round(e[a]*r)}return{encodings:[{kind:"FixedPoint",factor:r,srcType:n}],data:i}}function c(e){return function(t){return l(t,e)}}r.fixedPoint=c;function f(e,r,n,i,a){var o=t.Encoding.getDataType(e);if(!e.length){return{encodings:[{kind:"IntervalQuantization",min:r,max:n,numSteps:i,srcType:o}],data:new Int32Array(0)}}if(n<r){var s=r;r=n;n=s}var u=(n-r)/(i-1);var l=new a(e.length);for(var c=0,f=e.length;c<f;c++){var h=e[c];if(h<=r)l[c]=0;else if(h>=n)l[c]=i;else l[c]=Math.round((h-r)/u)|0}return{encodings:[{kind:"IntervalQuantization",min:r,max:n,numSteps:i,srcType:o}],data:l}}function h(e,t,r,n){if(n===void 0){n=Int32Array}return function(i){return f(i,e,t,r,n)}}r.intervalQuantizaiton=h;function d(e){var r=t.Encoding.getDataType(e);if(r===void 0){e=new Int32Array(e);r=3}if(!e.length){return{encodings:[{kind:"RunLength",srcType:r,srcSize:0}],data:new Int32Array(0)}}var n=2;
98for(var i=1,a=e.length;i<a;i++){if(e[i-1]!==e[i]){n+=2}}var o=new Int32Array(n);var s=0;var u=1;for(var i=1,a=e.length;i<a;i++){if(e[i-1]!==e[i]){o[s]=e[i-1];o[s+1]=u;u=1;s+=2}else{++u}}o[s]=e[e.length-1];o[s+1]=u;return{encodings:[{kind:"RunLength",srcType:r,srcSize:e.length}],data:o}}r.runLength=d;function p(e){if(!t.Encoding.isSignedIntegerDataType(e)){throw new Error("Only signed integer types can be encoded using delta encoding.")}var r=t.Encoding.getDataType(e);if(r===void 0){e=new Int32Array(e);r=3}if(!e.length){return{encodings:[{kind:"Delta",origin:0,srcType:r}],data:new e.constructor(0)}}var n=new e.constructor(e.length);var i=e[0];n[0]=e[0];for(var a=1,o=e.length;a<o;a++){n[a]=e[a]-e[a-1]}n[0]=0;return{encodings:[{kind:"Delta",origin:i,srcType:r}],data:n}}r.delta=p;function m(e){for(var t=0,r=e.length;t<r;t++){if(e[t]<0)return true}return false}function v(e,t){var r=-t-1;var n=0;for(var i=0,a=e.length;i<a;i++){var o=e[i];if(o===0){n+=1}else if(o>0){n+=Math.ceil(o/t);if(o%t===0)n+=1}else{n+=Math.ceil(o/r);if(o%r===0)n+=1}}return n}function y(e){var t=m(e);var r=t?v(e,127):v(e,255);var n=t?v(e,32767):v(e,65535);if(e.length*4<n*2){return{isSigned:t,size:e.length,bytesPerElement:4}}else if(n*2<r){return{isSigned:t,size:n,bytesPerElement:2}}else{return{isSigned:t,size:r,bytesPerElement:1}}}function g(e,t){var r=t.isSigned?t.bytesPerElement===1?127:32767:t.bytesPerElement===1?255:65535;var n=-r-1;var i=e.length;var a=t.isSigned?t.bytesPerElement===1?new Int8Array(t.size):new Int16Array(t.size):t.bytesPerElement===1?new Uint8Array(t.size):new Uint16Array(t.size);var o=0;for(var s=0;s<i;s++){var l=e[s];if(l>=0){while(l>=r){a[o]=r;++o;l-=r}}else{while(l<=n){a[o]=n;++o;l-=n}}a[o]=l;++o}var c=u(a);return{encodings:[{kind:"IntegerPacking",byteCount:t.bytesPerElement,isUnsigned:!t.isSigned,srcSize:i},c.encodings[0]],data:c.data}}function b(e){if(!(e instanceof Int32Array)){throw new Error("Integer packing can only be applied to Int32 data.")}var t=y(e);if(t.bytesPerElement===4){return u(e)}return g(e,t)}r.integerPacking=b;function x(t){var n=Object.create(null);var i=[];var a=0;var o=e.Utils.ChunkedArray.create(function(e){return new Int32Array(e)},1024,1);var s=new Int32Array(t.length);e.Utils.ChunkedArray.add(o,0);var u=0;for(var l=0,c=t;l<c.length;l++){var f=c[l];if(f===null||f===void 0){s[u++]=-1;continue}var h=n[f];if(h===void 0){a+=f.length;h=i.length;i[h]=f;n[f]=h;e.Utils.ChunkedArray.add(o,a)}s[u++]=h}var m=r.by(p).and(b).encode(e.Utils.ChunkedArray.compact(o));var v=r.by(p).and(d).and(b).encode(s);return{encodings:[{kind:"StringArray",dataEncoding:v.encoding,stringData:i.join(""),offsetEncoding:m.encoding,offsets:m.data}],data:v.data}}r.stringArray=x;var _,w})(r=t.Encoder||(t.Encoder={}))})(t=e.Binary||(e.Binary={}))})(a||(a={}));/* 99 * Copyright (c) 2016 - now David Sehnal, licensed under MIT License, See LICENSE file for more info. 100 */ 101var a;(function(e){var t;(function(e){"use strict";e.VERSION="0.3.0";var t;(function(e){function t(e){var t;if(e instanceof Int8Array)t=1;else if(e instanceof Int16Array)t=2;else if(e instanceof Int32Array)t=3;else if(e instanceof Uint8Array)t=4;else if(e instanceof Uint16Array)t=5;else if(e instanceof Uint32Array)t=6;else if(e instanceof Float32Array)t=32;else if(e instanceof Float64Array)t=33;else throw new Error("Unsupported integer data type.");return t}e.getDataType=t;function r(e){return e instanceof Int8Array||e instanceof Int16Array||e instanceof Int32Array}e.isSignedIntegerDataType=r})(t=e.Encoding||(e.Encoding={}))})(t=e.Binary||(e.Binary={}))})(a||(a={}));/* 102 * Copyright (c) 2016 - now David Sehnal, licensed under MIT License, See LICENSE file for more info. 103 */ 104var a;(function(e){var t;(function(t){"use strict";function r(e,t){for(var r=0;r<2;r++){if(e[r]>t[r])return false}return true}function n(n){var i=[0,3];try{var a=new Uint8Array(n);var o=t.MessagePack.decode(a);if(!r(i,o.version.match(/(\d)\.(\d)\.\d/).slice(1))){return e.ParserResult.error("Unsupported format version. Current "+o.version+", required "+i.join(".")+".")}var s=new t.File(o);return e.ParserResult.success(s)}catch(t){return e.ParserResult.error(""+t)}}t.parse=n})(t=e.Binary||(e.Binary={}))})(a||(a={}));/* 105 * Copyright (c) 2016 - now David Sehnal, licensed under MIT License, See LICENSE file for more info. 106 */ 107var a;(function(e){var t;(function(e){"use strict";function t(t,r,n){var i,a=false;if(t.typedArray){i=new t.typedArray(n)}else{a=true;i=new Array(n)}var o=new Uint8Array(n);var s=t.presence;var u=t.number?t.number:t.string;var l=true;var c=0;for(var f=0,h=r;f<h.length;f++){var d=h[f];var p=d.data;for(var m=0,v=d.count;m<v;m++){var y=s?s(p,m):0;if(y!==0){o[c]=y;if(a)i[c]=null;l=false}else{o[c]=0;i[c]=u(p,m)}c++}}var g=t.encoder?t.encoder:e.Encoder.by(e.Encoder.stringArray);var b=g.encode(i);var x=void 0;if(!l){var _=e.Encoder.by(e.Encoder.runLength).and(e.Encoder.byteArray).encode(o);if(_.data.length<o.length){x=_}else{x=e.Encoder.by(e.Encoder.byteArray).encode(o)}}return{name:t.name,data:b,mask:x}}
107var r=function(){function r(t){this.dataBlocks=[];this.data={encoder:t,version:e.VERSION,dataBlocks:this.dataBlocks}}r.prototype.startDataBlock=function(e){this.dataBlocks.push({header:(e||"").replace(/[ \n\t]/g,"").toUpperCase(),categories:[]})};r.prototype.writeCategory=function(e,r){if(!this.data){throw new Error("The writer contents have already been encoded, no more writing.")}if(!this.dataBlocks.length){throw new Error("No data block created.")}var n=!r||!r.length?[e(void 0)]:r.map(function(t){return e(t)});var i=n.filter(function(e){return e&&e.count>0});if(!i.length)return;var a=i.reduce(function(e,t){return e+t.count},0);if(!a)return;var o=i[0];var s={name:o.desc.name,columns:[],rowCount:a};var u=i.map(function(e){return{data:e.data,count:e.count}});for(var l=0,c=o.desc.fields;l<c.length;l++){var f=c[l];s.columns.push(t(f,u,a))}this.dataBlocks[this.dataBlocks.length-1].categories.push(s)};r.prototype.encode=function(){this.encodedData=e.MessagePack.encode(this.data);this.data=null;this.dataBlocks=null};r.prototype.flush=function(e){e.writeBinary(this.encodedData)};return r}();e.Writer=r})(t=e.Binary||(e.Binary={}))})(a||(a={}));var o=a;var s=function(){var e={REVISION:"71"};if(Math.sign===undefined){Math.sign=function(e){return e<0?-1:e>0?1:+e}}e.log=function(){console.log.apply(console,arguments)};e.warn=function(){console.warn.apply(console,arguments)};e.error=function(){console.error.apply(console,arguments)};e.MOUSE={LEFT:0,MIDDLE:1,RIGHT:2};e.CullFaceNone=0;e.CullFaceBack=1;e.CullFaceFront=2;e.CullFaceFrontBack=3;e.FrontFaceDirectionCW=0;e.FrontFaceDirectionCCW=1;e.BasicShadowMap=0;e.PCFShadowMap=1;e.PCFSoftShadowMap=2;e.FrontSide=0;e.BackSide=1;e.DoubleSide=2;e.NoShading=0;e.FlatShading=1;e.SmoothShading=2;e.NoColors=0;e.FaceColors=1;e.VertexColors=2;e.NoBlending=0;e.NormalBlending=1;e.AdditiveBlending=2;e.SubtractiveBlending=3;e.MultiplyBlending=4;e.CustomBlending=5;e.AddEquation=100;e.SubtractEquation=101;e.ReverseSubtractEquation=102;e.MinEquation=103;e.MaxEquation=104;e.ZeroFactor=200;e.OneFactor=201;e.SrcColorFactor=202;e.OneMinusSrcColorFactor=203;e.SrcAlphaFactor=204;e.OneMinusSrcAlphaFactor=205;e.DstAlphaFactor=206;e.OneMinusDstAlphaFactor=207;e.DstColorFactor=208;e.OneMinusDstColorFactor=209;e.SrcAlphaSaturateFactor=210;e.MultiplyOperation=0;e.MixOperation=1;e.AddOperation=2;e.UVMapping=300;e.CubeReflectionMapping=301;e.CubeRefractionMapping=302;e.EquirectangularReflectionMapping=303;e.EquirectangularRefractionMapping=304;e.SphericalReflectionMapping=305;e.RepeatWrapping=1e3;e.ClampToEdgeWrapping=1001;e.MirroredRepeatWrapping=1002;e.NearestFilter=1003;e.NearestMipMapNearestFilter=1004;e.NearestMipMapLinearFilter=1005;e.LinearFilter=1006;e.LinearMipMapNearestFilter=1007;e.LinearMipMapLinearFilter=1008;e.UnsignedByteType=1009;e.ByteType=1010;e.ShortType=1011;e.UnsignedShortType=1012;e.IntType=1013;e.UnsignedIntType=1014;e.FloatType=1015;e.HalfFloatType=1025;e.UnsignedShort4444Type=1016;e.UnsignedShort5551Type=1017;e.UnsignedShort565Type=1018;e.AlphaFormat=1019;e.RGBFormat=1020;e.RGBAFormat=1021;e.LuminanceFormat=1022;e.LuminanceAlphaFormat=1023;e.RGBEFormat=e.RGBAFormat;e.RGB_S3TC_DXT1_Format=2001;e.RGBA_S3TC_DXT1_Format=2002;e.RGBA_S3TC_DXT3_Format=2003;e.RGBA_S3TC_DXT5_Format=2004;e.RGB_PVRTC_4BPPV1_Format=2100;e.RGB_PVRTC_2BPPV1_Format=2101;e.RGBA_PVRTC_4BPPV1_Format=2102;e.RGBA_PVRTC_2BPPV1_Format=2103;e.Projector=function(){e.error("THREE.Projector has been moved to /examples/js/renderers/Projector.js.");this.projectVector=function(t,r){e.warn("THREE.Projector: .projectVector() is now vector.project().");t.project(r)};this.unprojectVector=function(t,r){e.warn("THREE.Projector: .unprojectVector() is now vector.unproject().");t.unproject(r)};this.pickingRay=function(t,r){e.error("THREE.Projector: .pickingRay() is now raycaster.setFromCamera().")}};e.CanvasRenderer=function(){e.error("THREE.CanvasRenderer has been moved to /examples/js/renderers/CanvasRenderer.js");this.domElement=document.createElement("canvas");this.clear=function(){};this.render=function(){};this.setClearColor=function(){};this.setSize=function(){}};e.Color=function(e){if(arguments.length===3){return this.setRGB(arguments[0],arguments[1],arguments[2])}return this.set(e)};e.Color.prototype={constructor:e.Color,r:1,g:1,b:1,set:function(t){if(t instanceof e.Color){this.copy(t)}else if(typeof t==="number"){this.setHex(t)}else if(typeof t==="string"){this.setStyle(t)}return this},setHex:function(e){e=Math.floor(e);this.r=(e>>16&255)/255;this.g=(e>>8&255)/255;this.b=(e&255)/255;return this},setRGB:function(e,t,r){this.r=e;this.g=t;this.b=r;return this},setHSL:function(e,t,r){if(t===0){this.r=this.g=this.b=r}else{var n=function(e,t,r){if(r<0)r+=1;if(r>1)r-=1;if(r<1/6)return e+(t-e)*6*r;if(r<1/2)return t;if(r<2/3)return e+(t-e)*6*(2/3-r);return e};var i=r<=.5?r*(1+t):r+t-r*t;var a=2*r-i;this.r=n(a,i,e+1/3);this.g=n(a,i,e);this.b=n(a,i,e-1/3)}return this},setStyle:function(t){if(/^rgb\((\d+), ?(\d+), ?(\d+)\)$/i.test(t)){var r=
107/^rgb\((\d+), ?(\d+), ?(\d+)\)$/i.exec(t);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;return this}if(/^rgb\((\d+)\%, ?(\d+)\%, ?(\d+)\%\)$/i.test(t)){var r=/^rgb\((\d+)\%, ?(\d+)\%, ?(\d+)\%\)$/i.exec(t);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;return this}if(/^\#([0-9a-f]{6})$/i.test(t)){var r=/^\#([0-9a-f]{6})$/i.exec(t);this.setHex(parseInt(r[1],16));return this}if(/^\#([0-9a-f])([0-9a-f])([0-9a-f])$/i.test(t)){var r=/^\#([0-9a-f])([0-9a-f])([0-9a-f])$/i.exec(t);this.setHex(parseInt(r[1]+r[1]+r[2]+r[2]+r[3]+r[3],16));return this}if(/^(\w+)$/i.test(t)){this.setHex(e.ColorKeywords[t]);return this}},copy:function(e){this.r=e.r;this.g=e.g;this.b=e.b;return this},copyGammaToLinear:function(e,t){if(t===undefined)t=2;this.r=Math.pow(e.r,t);this.g=Math.pow(e.g,t);this.b=Math.pow(e.b,t);return this},copyLinearToGamma:function(e,t){if(t===undefined)t=2;var r=t>0?1/t:1;this.r=Math.pow(e.r,r);this.g=Math.pow(e.g,r);this.b=Math.pow(e.b,r);return this},convertGammaToLinear:function(){var e=this.r,t=this.g,r=this.b;this.r=e*e;this.g=t*t;this.b=r*r;return this},convertLinearToGamma:function(){this.r=Math.sqrt(this.r);this.g=Math.sqrt(this.g);this.b=Math.sqrt(this.b);return this},getHex:function(){return this.r*255<<16^this.g*255<<8^this.b*255<<0},getHexString:function(){return("000000"+this.getHex().toString(16)).slice(-6)},getHSL:function(e){var t=e||{h:0,s:0,l:0};var r=this.r,n=this.g,i=this.b;var a=Math.max(r,n,i);var o=Math.min(r,n,i);var s,u;var l=(o+a)/2;if(o===a){s=0;u=0}else{var c=a-o;u=l<=.5?c/(a+o):c/(2-a-o);switch(a){case r:s=(n-i)/c+(n<i?6:0);break;case n:s=(i-r)/c+2;break;case i:s=(r-n)/c+4;break}s/=6}t.h=s;t.s=u;t.l=l;return t},getStyle:function(){return"rgb("+(this.r*255|0)+","+(this.g*255|0)+","+(this.b*255|0)+")"},offsetHSL:function(e,t,r){var n=this.getHSL();n.h+=e;n.s+=t;n.l+=r;this.setHSL(n.h,n.s,n.l);return this},add:function(e){this.r+=e.r;this.g+=e.g;this.b+=e.b;return this},addColors:function(e,t){this.r=e.r+t.r;this.g=e.g+t.g;this.b=e.b+t.b;return this},addScalar:function(e){this.r+=e;this.g+=e;this.b+=e;return this},multiply:function(e){this.r*=e.r;this.g*=e.g;this.b*=e.b;return this},multiplyScalar:function(e){this.r*=e;this.g*=e;this.b*=e;return this},lerp:function(e,t){this.r+=(e.r-this.r)*t;this.g+=(e.g-this.g)*t;this.b+=(e.b-this.b)*t;return this},equals:function(e){return e.r===this.r&&e.g===this.g&&e.b===this.b},fromArray:function(e){this.r=e[0];this.g=e[1];this.b=e[2];return this},toArray:function(e,t){if(e===undefined)e=[];if(t===undefined)t=0;e[t]=this.r;e[t+1]=this.g;e[t+2]=this.b;return e},clone:function(){return(new e.Color).setRGB(this.r,this.g,this.b)}};e.ColorKeywords={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};e.Quaternion=function(e,t,r,n){this._x=e||0;this._y=t||0;this._z=r||0;this._w=n!==undefined?n:1};e.Quaternion.prototype={constructor:e.Quaternion,_x:0,_y:0,_z:0,_w:0,get x(){return this._x},set x(e){this._x=e;this.onChangeCallback()},get y(){return this._y},set y(e){this._y=e;this.onChangeCallback()},get z(){return this._z},set z(e){this._z=e;this.onChangeCallback()},get w(){return this._w},set w(e){this._w=e;this.onChangeCallback()},set:function(e,t,r,n){this._x=e;this._y=t;this._z=r;this._w=n;this.onChangeCallback();return this},copy:function(e){this._x=e.x;this._y=e.y;this._z=e.z;this._w=e.w;this.onChangeCallback();return this},setFromEuler:function(t,r){if(t instanceof e.Euler===false){throw new Error("THREE.Quaternion: .setFromEuler() now expects a Euler rotation rather than a Vector3 and order.")}var n=Math.cos(t._x/2);var i=Math.cos(t._y/2);var a=Math.cos(t._z/2);var o=Math.sin(t._x/2);var s=Math.sin(t._y/2);var u=Math.sin(t._z/2);if(t.order==="XYZ"){this._x=o*i*a+n*s*u;this._y=n*s*a-o*i*u;this._z=n*i*u+o*s*a;this._w=n*i*a-o*s*u}else if(t.order==="YXZ"){this._x=o*i*a+n*s*u;this._y=n*s*a-o*i*u;this._z=n*i*u-o*s*a;this._w=n*i*a+o*s*u}else if(t.order==="ZXY"){this._x=o*i*a-n*s*u;this._y=n*s*a+o*i*u;this._z=n*i*u+o*s*a;this._w=n*i*a-o*s*u}else if(t.order==="ZYX"){this._x=o*i*a-n*s*u;this._y=n*s*a+o*i*u;this._z=n*i*u-o*s*a;this._w=n*i*a+o*s*u}else if(t.order==="YZX"){this._x=o*i*a+n*s*u;this._y=n*s*a+o*i*u;this._z=n*i*u-o*s*a;this._w=n*i*a-o*s*u}else if(t.order==="XZY"){this._x=o*i*a-n*s*u;this._y=n*s*a-o*i*u;this._z=n*i*u+o*s*a;this._w=n*i*a+o*s*u}if(r!==false)this.onChangeCallback();return this},setFromAxisAngle:function(e,t){var r=t/2,n=Math.sin(r);this._x=e.x*n;this._y=e.y*n;this._z=e.z*n;this._w=Math.cos(r);this.onChangeCallback();return this},setFromRotationMatrix:function(e){var t=e.elements,r=t[0],n=t[4],i=t[8],a=t[1],o=t[5],s=t[9],u=t[2],l=t[6],c=t[10],f=r+o+c,h;if(f>0){h=.5/Math.sqrt(f+1);this._w=.25/h;this._x=(l-s)*h;this._y=(i-u)*h;this._z=(a-n)*h}else if(r>o&&r>c){h=2*Math.sqrt(1+r-o-c);this._w=(l-s)/h;this._x=.25*h;this._y=(n+a)/h;this._z=(i+u)/h}else if(o>c){h=2*Math.sqrt(1+o-r-c);this._w=(i-u)/h;this._x=(n+a)/h;this._y=.25*h;this._z=(s+l)/h}else{h=2*Math.sqrt(1+c-r-o);this._w=(a-n)/h;this._x=(i+u)/h;this._y=(s+l)/h;this._z=.25*h}this.onChangeCallback();return this},setFromUnitVectors:function(){var t,r;var n=1e-6;return function(i,a){if(t===undefined)t=new e.Vector3;r=i.dot(a)+1;if(r<n){r=0;if(Math.abs(i.x)>Math.abs(i.z)){t.set(-i.y,i.x,0)}else{t.set(0,-i.z,i.y)}}else{t.crossVectors(i,a)}this._x=t.x;this._y=t.y;this._z=t.z;this._w=r;this.normalize();return this}}(),inverse:function(){this.conjugate().normalize();return this},conjugate:function(){this._x*=-1;this._y*=-1;this._z*=-1;this.onChangeCallback();return this},dot:function(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w},lengthSq:function(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w},length:function(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)},normalize:function(){var e=this.length();if(e===0){this._x=0;this._y=0;this._z=0;this._w=1}else{e=1/e;this._x=this._x*e;this._y=this._y*e;this._z=this._z*e;this._w=this._w*e}this.onChangeCallback();return this},multiply:function(t,r){if(r!==undefined){e.warn("THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead.");return this.multiplyQuaternions(t,r)}return this.multiplyQuaternions(this,t)},multiplyQuaternions:function(e,t){var r=e._x,n=e._y,i=e._z,a=e._w;var o=t._x,s=t._y,u=t._z,l=t._w;this._x=r*l+a*o+n*u-i*s;this._y=n*l+a*s+i*o-r*u;this._z=i*l+a*u+r*s-n*o;this._w=a*l-r*o-n*s-i*u;this.onChangeCallback();return this},multiplyVector3:function(t){e.warn("THREE.Quaternion: .multiplyVector3(
107) has been removed. Use is now vector.applyQuaternion( quaternion ) instead.");return t.applyQuaternion(this)},slerp:function(e,t){if(t===0)return this;if(t===1)return this.copy(e);var r=this._x,n=this._y,i=this._z,a=this._w;var o=a*e._w+r*e._x+n*e._y+i*e._z;if(o<0){this._w=-e._w;this._x=-e._x;this._y=-e._y;this._z=-e._z;o=-o}else{this.copy(e)}if(o>=1){this._w=a;this._x=r;this._y=n;this._z=i;return this}var s=Math.acos(o);var u=Math.sqrt(1-o*o);if(Math.abs(u)<.001){this._w=.5*(a+this._w);this._x=.5*(r+this._x);this._y=.5*(n+this._y);this._z=.5*(i+this._z);return this}var l=Math.sin((1-t)*s)/u,c=Math.sin(t*s)/u;this._w=a*l+this._w*c;this._x=r*l+this._x*c;this._y=n*l+this._y*c;this._z=i*l+this._z*c;this.onChangeCallback();return this},equals:function(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w},fromArray:function(e,t){if(t===undefined)t=0;this._x=e[t];this._y=e[t+1];this._z=e[t+2];this._w=e[t+3];this.onChangeCallback();return this},toArray:function(e,t){if(e===undefined)e=[];if(t===undefined)t=0;e[t]=this._x;e[t+1]=this._y;e[t+2]=this._z;e[t+3]=this._w;return e},onChange:function(e){this.onChangeCallback=e;return this},onChangeCallback:function(){},clone:function(){return new e.Quaternion(this._x,this._y,this._z,this._w)}};e.Quaternion.slerp=function(e,t,r,n){return r.copy(e).slerp(t,n)};e.Vector2=function(e,t){this.x=e||0;this.y=t||0};e.Vector2.prototype={constructor:e.Vector2,set:function(e,t){this.x=e;this.y=t;return this},setX:function(e){this.x=e;return this},setY:function(e){this.y=e;return this},setComponent:function(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("index is out of range: "+e)}},getComponent:function(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}},copy:function(e){this.x=e.x;this.y=e.y;return this},add:function(t,r){if(r!==undefined){e.warn("THREE.Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead.");return this.addVectors(t,r)}this.x+=t.x;this.y+=t.y;return this},addScalar:function(e){this.x+=e;this.y+=e;return this},addVectors:function(e,t){this.x=e.x+t.x;this.y=e.y+t.y;return this},sub:function(t,r){if(r!==undefined){e.warn("THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead.");return this.subVectors(t,r)}this.x-=t.x;this.y-=t.y;return this},subScalar:function(e){this.x-=e;this.y-=e;return this},subVectors:function(e,t){this.x=e.x-t.x;this.y=e.y-t.y;return this},multiply:function(e){this.x*=e.x;this.y*=e.y;return this},multiplyScalar:function(e){this.x*=e;this.y*=e;return this},divide:function(e){this.x/=e.x;this.y/=e.y;return this},divideScalar:function(e){if(e!==0){var t=1/e;this.x*=t;this.y*=t}else{this.x=0;this.y=0}return this},min:function(e){if(this.x>e.x){this.x=e.x}if(this.y>e.y){this.y=e.y}return this},max:function(e){if(this.x<e.x){this.x=e.x}if(this.y<e.y){this.y=e.y}return this},clamp:function(e,t){if(this.x<e.x){this.x=e.x}else if(this.x>t.x){this.x=t.x}if(this.y<e.y){this.y=e.y}else if(this.y>t.y){this.y=t.y}return this},clampScalar:function(){var t,r;return function(n,i){if(t===undefined){t=new e.Vector2;r=new e.Vector2}t.set(n,n);r.set(i,i);return this.clamp(t,r)}}(),floor:function(){this.x=Math.floor(this.x);this.y=Math.floor(this.y);return this},ceil:function(){this.x=Math.ceil(this.x);this.y=Math.ceil(this.y);return this},round:function(){this.x=Math.round(this.x);this.y=Math.round(this.y);return this},roundToZero:function(){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);return this},negate:function(){this.x=-this.x;this.y=-this.y;return this},dot:function(e){return this.x*e.x+this.y*e.y},lengthSq:function(){return this.x*this.x+this.y*this.y},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},normalize:function(){return this.divideScalar(this.length())},distanceTo:function(e){return Math.sqrt(this.distanceToSquared(e))},distanceToSquared:function(e){var t=this.x-e.x,r=this.y-e.y;return t*t+r*r},setLength:function(e){var t=this.length();if(t!==0&&e!==t){this.multiplyScalar(e/t)}return this},lerp:function(e,t){this.x+=(e.x-this.x)*t;this.y+=(e.y-this.y)*t;return this},lerpVectors:function(e,t,r){this.subVectors(t,e).multiplyScalar(r).add(e);return this},equals:function(e){return e.x===this.x&&e.y===this.y},fromArray:function(e,t){if(t===undefined)t=0;this.x=e[t];this.y=e[t+1];return this},toArray:function(e,t){if(e===undefined)e=[];if(t===undefined)t=0;e[t]=this.x;e[t+1]=this.y;return e},fromAttribute:function(e,t,r){if(r===undefined)r=0;t=t*e.itemSize+r;this.x=e.array[t];this.y=e.array[t+1];return this},clone:function(){return new e.Vector2(this.x,this.y)}};e.Vector3=function(e,t,r){this.x=e||0;this.y=t||0;this.z=r||0};e.Vector3.prototype={constructor:e.Vector3,set:function(e,t,r){this.x=e;this.y=t;this.z=r;return this},setX:function(e){this.x=e;return this},setY:function(e){this.y=e;return this},setZ:function(e){this.z=e;return this},setComponent:function(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("index is out of range: "+e)}},getComponent:function(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}},copy:function(e){this.x=e.x;this.y=e.y;this.z=e.z;return this},add:function(t,r){if(r!==undefined){e.warn("THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead.");return this.addVectors(t,r)}this.x+=t.x;this.y+=t.y;this.z+=t.z;return this},addScalar:function(e){this.x+=e;this.y+=e;this.z+=e;return this},addVectors:function(e,t){this.x=e.x+t.x;this.y=e.y+t.y;this.z=e.z+t.z;return this},sub:function(t,r){if(r!==undefined){e.warn("THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead.");return this.subVectors(t,r)}this.x-=t.x;this.y-=t.y;this.z-=t.z;return this},subScalar:function(e){this.x-=e;this.y-=e;this.z-=e;return this},subVectors:function(e,t){this.x=e.x-t.x;this.y=e.y-t.y;this.z=e.z-t.z;return this},multiply:function(t,r){if(r!==undefined){e.warn("THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead.");return this.multiplyVectors(t,r)}this.x*=t.x;this.y*=t.y;this.z*=t.z;return this},multiplyScalar:function(e){this.x*=e;this.y*=e;this.z*=e;return this},multiplyVectors:function(e,t){this.x=e.x*t.x;this.y=e.y*t.y;this.z=e.z*t.z;return this},applyEuler:function(){var t;return function(r){if(r instanceof e.Euler===false){e.error("THREE.Vector3: .applyEuler() now expects a Euler rotation rather than a Vector3 and order.")}if(t===undefined)t=new e.Quaternion;this.applyQuaternion(t.setFromEuler(r));return this}}(),applyAxisAngle:function(){var t;return function(r,n){if(t===undefined)t=new e.Quaternion;this.applyQuaternion(t.setFromAxisAngle(r,n));return this}}(),applyMatrix3:function(e){var t=this.x;var r=this.y;var n=this.z;var i=e.elements;this.x=i[0]*t+i[3]*r+i[6]*n;this.y=i[1]*t+i[4]*r+i[7]*n;this.z=i[2]*t+i[5]*r+i[8]*n;return this},applyMatrix4:function(e){var t=this.x,r=this.y,n=this.z;var i=e.elements;this.x=i[0]*t+i[4]*r+i[8]*n+i[12];this.y=i[1]*t+i[5]*r+i[9]*n+i[13];this.z=i[2]*t+i[6]*r+i[10]*n+i[14];return this},applyProjection:function(e){var t=this.x,r=this.y,n=this.z;var i=e.elements;var a=1/(i[3]*t+i[7]*r+i[11]*n+i[15]);this.x=(i[0]*t+i[4]*r+i[8]*n+i[12])*a;this.y=(i[1]*t+i[5]*r+i[9]*n+i[13])*a;this.z=(i[2]*t+i[6]*r+i[10]*n+i[14])*a;return this},applyQuaternion:function(e){var t=this.x;var r=this.y;var n=this.z;var i=e.x;var a=e.y;var o=e.z;var s=e.w;var u=s*t+a*n-o*r;var l=s*r+o*t-i*n;var c=s*n+i*r-a*t;var f=-i*t-a*r-o*n;this.x=u*s+f*-i+l*-o-c*-a;this.y=l*s+f*-a+c*-i-u*-o;this.z=c*s+f*-o+u*-a-l*-i;return this},project:function(){var t;
107return function(r){if(t===undefined)t=new e.Matrix4;t.multiplyMatrices(r.projectionMatrix,t.getInverse(r.matrixWorld));return this.applyProjection(t)}}(),unproject:function(){var t;return function(r){if(t===undefined)t=new e.Matrix4;t.multiplyMatrices(r.matrixWorld,t.getInverse(r.projectionMatrix));return this.applyProjection(t)}}(),transformDirection:function(e){var t=this.x,r=this.y,n=this.z;var i=e.elements;this.x=i[0]*t+i[4]*r+i[8]*n;this.y=i[1]*t+i[5]*r+i[9]*n;this.z=i[2]*t+i[6]*r+i[10]*n;this.normalize();return this},divide:function(e){this.x/=e.x;this.y/=e.y;this.z/=e.z;return this},divideScalar:function(e){if(e!==0){var t=1/e;this.x*=t;this.y*=t;this.z*=t}else{this.x=0;this.y=0;this.z=0}return this},min:function(e){if(this.x>e.x){this.x=e.x}if(this.y>e.y){this.y=e.y}if(this.z>e.z){this.z=e.z}return this},max:function(e){if(this.x<e.x){this.x=e.x}if(this.y<e.y){this.y=e.y}if(this.z<e.z){this.z=e.z}return this},clamp:function(e,t){if(this.x<e.x){this.x=e.x}else if(this.x>t.x){this.x=t.x}if(this.y<e.y){this.y=e.y}else if(this.y>t.y){this.y=t.y}if(this.z<e.z){this.z=e.z}else if(this.z>t.z){this.z=t.z}return this},clampScalar:function(){var t,r;return function(n,i){if(t===undefined){t=new e.Vector3;r=new e.Vector3}t.set(n,n,n);r.set(i,i,i);return this.clamp(t,r)}}(),floor:function(){this.x=Math.floor(this.x);this.y=Math.floor(this.y);this.z=Math.floor(this.z);return this},ceil:function(){this.x=Math.ceil(this.x);this.y=Math.ceil(this.y);this.z=Math.ceil(this.z);return this},round:function(){this.x=Math.round(this.x);this.y=Math.round(this.y);this.z=Math.round(this.z);return this},roundToZero:function(){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);return this},negate:function(){this.x=-this.x;this.y=-this.y;this.z=-this.z;return this},dot:function(e){return this.x*e.x+this.y*e.y+this.z*e.z},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},lengthManhattan:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)},normalize:function(){return this.divideScalar(this.length())},setLength:function(e){var t=this.length();if(t!==0&&e!==t){this.multiplyScalar(e/t)}return this},lerp:function(e,t){this.x+=(e.x-this.x)*t;this.y+=(e.y-this.y)*t;this.z+=(e.z-this.z)*t;return this},lerpVectors:function(e,t,r){this.subVectors(t,e).multiplyScalar(r).add(e);return this},cross:function(t,r){if(r!==undefined){e.warn("THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead.");return this.crossVectors(t,r)}var n=this.x,i=this.y,a=this.z;this.x=i*t.z-a*t.y;this.y=a*t.x-n*t.z;this.z=n*t.y-i*t.x;return this},crossVectors:function(e,t){var r=e.x,n=e.y,i=e.z;var a=t.x,o=t.y,s=t.z;this.x=n*s-i*o;this.y=i*a-r*s;this.z=r*o-n*a;return this},projectOnVector:function(){var t,r;return function(n){if(t===undefined)t=new e.Vector3;t.copy(n).normalize();r=this.dot(t);return this.copy(t).multiplyScalar(r)}}(),projectOnPlane:function(){var t;return function(r){if(t===undefined)t=new e.Vector3;t.copy(this).projectOnVector(r);return this.sub(t)}}(),reflect:function(){var t;return function(r){if(t===undefined)t=new e.Vector3;return this.sub(t.copy(r).multiplyScalar(2*this.dot(r)))}}(),angleTo:function(t){var r=this.dot(t)/(this.length()*t.length());return Math.acos(e.Math.clamp(r,-1,1))},distanceTo:function(e){return Math.sqrt(this.distanceToSquared(e))},distanceToSquared:function(e){var t=this.x-e.x;var r=this.y-e.y;var n=this.z-e.z;return t*t+r*r+n*n},setEulerFromRotationMatrix:function(t,r){e.error("THREE.Vector3: .setEulerFromRotationMatrix() has been removed. Use Euler.setFromRotationMatrix() instead.")},setEulerFromQuaternion:function(t,r){e.error("THREE.Vector3: .setEulerFromQuaternion() has been removed. Use Euler.setFromQuaternion() instead.")},getPositionFromMatrix:function(t){e.warn("THREE.Vector3: .getPositionFromMatrix() has been renamed to .setFromMatrixPosition().");return this.setFromMatrixPosition(t)},getScaleFromMatrix:function(t){e.warn("THREE.Vector3: .getScaleFromMatrix() has been renamed to .setFromMatrixScale().");return this.setFromMatrixScale(t)}
107,getColumnFromMatrix:function(t,r){e.warn("THREE.Vector3: .getColumnFromMatrix() has been renamed to .setFromMatrixColumn().");return this.setFromMatrixColumn(t,r)},setFromMatrixPosition:function(e){this.x=e.elements[12];this.y=e.elements[13];this.z=e.elements[14];return this},setFromMatrixScale:function(e){var t=this.set(e.elements[0],e.elements[1],e.elements[2]).length();var r=this.set(e.elements[4],e.elements[5],e.elements[6]).length();var n=this.set(e.elements[8],e.elements[9],e.elements[10]).length();this.x=t;this.y=r;this.z=n;return this},setFromMatrixColumn:function(e,t){var r=e*4;var n=t.elements;this.x=n[r];this.y=n[r+1];this.z=n[r+2];return this},equals:function(e){return e.x===this.x&&e.y===this.y&&e.z===this.z},fromArray:function(e,t){if(t===undefined)t=0;this.x=e[t];this.y=e[t+1];this.z=e[t+2];return this},toArray:function(e,t){if(e===undefined)e=[];if(t===undefined)t=0;e[t]=this.x;e[t+1]=this.y;e[t+2]=this.z;return e},fromAttribute:function(e,t,r){if(r===undefined)r=0;t=t*e.itemSize+r;this.x=e.array[t];this.y=e.array[t+1];this.z=e.array[t+2];return this},clone:function(){return new e.Vector3(this.x,this.y,this.z)}};e.Vector4=function(e,t,r,n){this.x=e||0;this.y=t||0;this.z=r||0;this.w=n!==undefined?n:1};e.Vector4.prototype={constructor:e.Vector4,set:function(e,t,r,n){this.x=e;this.y=t;this.z=r;this.w=n;return this},setX:function(e){this.x=e;return this},setY:function(e){this.y=e;return this},setZ:function(e){this.z=e;return this},setW:function(e){this.w=e;return this},setComponent:function(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("index is out of range: "+e)}},getComponent:function(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+e)}},copy:function(e){this.x=e.x;this.y=e.y;this.z=e.z;this.w=e.w!==undefined?e.w:1;return this},add:function(t,r){if(r!==undefined){e.warn("THREE.Vector4: .add() now only accepts one argument. Use .addVectors( a, b ) instead.");return this.addVectors(t,r)}this.x+=t.x;this.y+=t.y;this.z+=t.z;this.w+=t.w;return this},addScalar:function(e){this.x+=e;this.y+=e;this.z+=e;this.w+=e;return this},addVectors:function(e,t){this.x=e.x+t.x;this.y=e.y+t.y;this.z=e.z+t.z;this.w=e.w+t.w;return this},sub:function(t,r){if(r!==undefined){e.warn("THREE.Vector4: .sub() now only accepts one argument. Use .subVectors( a, b ) instead.");return this.subVectors(t,r)}this.x-=t.x;this.y-=t.y;this.z-=t.z;this.w-=t.w;return this},subScalar:function(e){this.x-=e;this.y-=e;this.z-=e;this.w-=e;return this},subVectors:function(e,t){this.x=e.x-t.x;this.y=e.y-t.y;this.z=e.z-t.z;this.w=e.w-t.w;return this},multiplyScalar:function(e){this.x*=e;this.y*=e;this.z*=e;this.w*=e;return this},applyMatrix4:function(e){var t=this.x;var r=this.y;var n=this.z;var i=this.w;var a=e.elements;this.x=a[0]*t+a[4]*r+a[8]*n+a[12]*i;this.y=a[1]*t+a[5]*r+a[9]*n+a[13]*i;this.z=a[2]*t+a[6]*r+a[10]*n+a[14]*i;this.w=a[3]*t+a[7]*r+a[11]*n+a[15]*i;return this},divideScalar:function(e){if(e!==0){var t=1/e;this.x*=t;this.y*=t;this.z*=t;this.w*=t}else{this.x=0;this.y=0;this.z=0;this.w=1}return this},setAxisAngleFromQuaternion:function(e){this.w=2*Math.acos(e.w);var t=Math.sqrt(1-e.w*e.w);if(t<1e-4){this.x=1;this.y=0;this.z=0}else{this.x=e.x/t;this.y=e.y/t;this.z=e.z/t}return this},setAxisAngleFromRotationMatrix:function(e){var t,r,n,i,a=.01,o=.1,s=e.elements,u=s[0],l=s[4],c=s[8],f=s[1],h=s[5],d=s[9],p=s[2],m=s[6],v=s[10];if(Math.abs(l-f)<a&&Math.abs(c-p)<a&&Math.abs(d-m)<a){if(Math.abs(l+f)<o&&Math.abs(c+p)<o&&Math.abs(d+m)<o&&Math.abs(u+h+v-3)<o){this.set(1,0,0,0);return this}t=Math.PI;var y=(u+1)/2;var g=(h+1)/2;var b=(v+1)/2;var x=(l+f)/4;var _=(c+p)/4;var w=(d+m)/4;if(y>g&&y>b){if(y<a){r=0;n=.707106781;i=.707106781}else{r=Math.sqrt(y);n=x/r;i=_/r}}else if(g>b){if(g<a){r=.707106781;n=0;i=.707106781}else{n=Math.sqrt(g);r=x/n;i=w/n}}else{if(b<a){r=.707106781;n=.707106781;i=0}else{i=Math.sqrt(b);r=_/i;n=w/i}}this.set(r,n,i,t);return this}var C=Math.sqrt((m-d)*(m-d)+(c-p)*(c-p)+(f-l)*(f-l));
107if(Math.abs(C)<.001)C=1;this.x=(m-d)/C;this.y=(c-p)/C;this.z=(f-l)/C;this.w=Math.acos((u+h+v-1)/2);return this},min:function(e){if(this.x>e.x){this.x=e.x}if(this.y>e.y){this.y=e.y}if(this.z>e.z){this.z=e.z}if(this.w>e.w){this.w=e.w}return this},max:function(e){if(this.x<e.x){this.x=e.x}if(this.y<e.y){this.y=e.y}if(this.z<e.z){this.z=e.z}if(this.w<e.w){this.w=e.w}return this},clamp:function(e,t){if(this.x<e.x){this.x=e.x}else if(this.x>t.x){this.x=t.x}if(this.y<e.y){this.y=e.y}else if(this.y>t.y){this.y=t.y}if(this.z<e.z){this.z=e.z}else if(this.z>t.z){this.z=t.z}if(this.w<e.w){this.w=e.w}else if(this.w>t.w){this.w=t.w}return this},clampScalar:function(){var t,r;return function(n,i){if(t===undefined){t=new e.Vector4;r=new e.Vector4}t.set(n,n,n,n);r.set(i,i,i,i) 108;return this.clamp(t,r)}}(),floor:function(){this.x=Math.floor(this.x);this.y=Math.floor(this.y);this.z=Math.floor(this.z);this.w=Math.floor(this.w);return this},ceil:function(){this.x=Math.ceil(this.x);this.y=Math.ceil(this.y);this.z=Math.ceil(this.z);this.w=Math.ceil(this.w);return this},round:function(){this.x=Math.round(this.x);this.y=Math.round(this.y);this.z=Math.round(this.z);this.w=Math.round(this.w);return this},roundToZero:function(){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);return this},negate:function(){this.x=-this.x;this.y=-this.y;this.z=-this.z;this.w=-this.w;return this},dot:function(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},lengthManhattan:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)},normalize:function(){return this.divideScalar(this.length())},setLength:function(e){var t=this.length();if(t!==0&&e!==t){this.multiplyScalar(e/t)}return this},lerp:function(e,t){this.x+=(e.x-this.x)*t;this.y+=(e.y-this.y)*t;this.z+=(e.z-this.z)*t;this.w+=(e.w-this.w)*t;return this},lerpVectors:function(e,t,r){this.subVectors(t,e).multiplyScalar(r).add(e);return this},equals:function(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w},fromArray:function(e,t){if(t===undefined)t=0;this.x=e[t];this.y=e[t+1];this.z=e[t+2];this.w=e[t+3];return this},toArray:function(e,t){if(e===undefined)e=[];if(t===undefined)t=0;e[t]=this.x;e[t+1]=this.y;e[t+2]=this.z;e[t+3]=this.w;return e},fromAttribute:function(e,t,r){if(r===undefined)r=0;t=t*e.itemSize+r;this.x=e.array[t];this.y=e.array[t+1];this.z=e.array[t+2];this.w=e.array[t+3];return this},clone:function(){return new e.Vector4(this.x,this.y,this.z,this.w)}};e.Euler=function(t,r,n,i){this._x=t||0;this._y=r||0;this._z=n||0;this._order=i||e.Euler.DefaultOrder};e.Euler.RotationOrders=["XYZ","YZX","ZXY","XZY","YXZ","ZYX"];e.Euler.DefaultOrder="XYZ";e.Euler.prototype={constructor:e.Euler,_x:0,_y:0,_z:0,_order:e.Euler.DefaultOrder,get x(){return this._x},set x(e){this._x=e;this.onChangeCallback()},get y(){return this._y},set y(e){this._y=e;this.onChangeCallback()},get z(){return this._z},set z(e){this._z=e;this.onChangeCallback()},get order(){return this._order},set order(e){this._order=e;this.onChangeCallback()},set:function(e,t,r,n){this._x=e;this._y=t;this._z=r;this._order=n||this._order;this.onChangeCallback();return this},copy:function(e){this._x=e._x;this._y=e._y;this._z=e._z;this._order=e._order;this.onChangeCallback();return this},setFromRotationMatrix:function(t,r,n){var i=e.Math.clamp;var a=t.elements;var o=a[0],s=a[4],u=a[8];var l=a[1],c=a[5],f=a[9];var h=a[2],d=a[6],p=a[10];r=r||this._order;if(r==="XYZ"){this._y=Math.asin(i(u,-1,1));if(Math.abs(u)<.99999){this._x=Math.atan2(-f,p);this._z=Math.atan2(-s,o)}else{this._x=Math.atan2(d,c);this._z=0}}else if(r==="YXZ"){this._x=Math.asin(-i(f,-1,1));if(Math.abs(f)<.99999){this._y=Math.atan2(u,p);this._z=Math.atan2(l,c)}else{this._y=Math.atan2(-h,o);this._z=0}}else if(r==="ZXY"){this._x=Math.asin(i(d,-1,1));if(Math.abs(d)<.99999){this._y=Math.atan2(-h,p);this._z=Math.atan2(-s,c)}else{this._y=0;this._z=Math.atan2(l,o)}}else if(r==="ZYX"){this._y=Math.asin(-i(h,-1,1));if(Math.abs(h)<.99999){this._x=Math.atan2(d,p);this._z=Math.atan2(l,o)}else{this._x=0;this._z=Math.atan2(-s,c)}}else if(r==="YZX"){this._z=Math.asin(i(l,-1,1));if(Math.abs(l)<.99999){this._x=Math.atan2(-f,c);this._y=Math.atan2(-h,o)}else{this._x=0;this._y=Math.atan2(u,p)}}else if(r==="XZY"){this._z=Math.asin(-i(s,-1,1));if(Math.abs(s)<.99999){this._x=Math.atan2(d,c);this._y=Math.atan2(u,o)}else{this._x=Math.atan2(-f,p);this._y=0}}else{e.warn("THREE.Euler: .setFromRotationMatrix() given unsupported order: "+r)}this._order=r;if(n!==false)this.onChangeCallback();return this},setFromQuaternion:function(){var t;
108return function(r,n,i){if(t===undefined)t=new e.Matrix4;t.makeRotationFromQuaternion(r);this.setFromRotationMatrix(t,n,i);return this}}(),setFromVector3:function(e,t){return this.set(e.x,e.y,e.z,t||this._order)},reorder:function(){var t=new e.Quaternion;return function(e){t.setFromEuler(this);this.setFromQuaternion(t,e)}}(),equals:function(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order},fromArray:function(e){this._x=e[0];this._y=e[1];this._z=e[2];if(e[3]!==undefined)this._order=e[3];this.onChangeCallback();return this},toArray:function(e,t){if(e===undefined)e=[];if(t===undefined)t=0;e[t]=this._x;e[t+1]=this._y;e[t+2]=this._z;e[t+3]=this._order;return e},toVector3:function(t){if(t){return t.set(this._x,this._y,this._z)}else{return new e.Vector3(this._x,this._y,this._z)}},onChange:function(e){this.onChangeCallback=e;return this},onChangeCallback:function(){},clone:function(){return new e.Euler(this._x,this._y,this._z,this._order)}};e.Line3=function(t,r){this.start=t!==undefined?t:new e.Vector3;this.end=r!==undefined?r:new e.Vector3};e.Line3.prototype={constructor:e.Line3,set:function(e,t){this.start.copy(e);this.end.copy(t);return this},copy:function(e){this.start.copy(e.start);this.end.copy(e.end);return this},center:function(t){var r=t||new e.Vector3;return r.addVectors(this.start,this.end).multiplyScalar(.5)},delta:function(t){var r=t||new e.Vector3;return r.subVectors(this.end,this.start)},distanceSq:function(){return this.start.distanceToSquared(this.end)},distance:function(){return this.start.distanceTo(this.end)},at:function(t,r){var n=r||new e.Vector3;return this.delta(n).multiplyScalar(t).add(this.start)},closestPointToPointParameter:function(){var t=new e.Vector3;var r=new e.Vector3;return function(n,i){t.subVectors(n,this.start);r.subVectors(this.end,this.start);var a=r.dot(r);var o=r.dot(t);var s=o/a;
108if(i){s=e.Math.clamp(s,0,1)}return s}}(),closestPointToPoint:function(t,r,n){var i=this.closestPointToPointParameter(t,r);var a=n||new e.Vector3;return this.delta(a).multiplyScalar(i).add(this.start)},applyMatrix4:function(e){this.start.applyMatrix4(e);this.end.applyMatrix4(e);return this},equals:function(e){return e.start.equals(this.start)&&e.end.equals(this.end)},clone:function(){return(new e.Line3).copy(this)}};e.Box2=function(t,r){this.min=t!==undefined?t:new e.Vector2(Infinity,Infinity);this.max=r!==undefined?r:new e.Vector2(-Infinity,-Infinity)};e.Box2.prototype={constructor:e.Box2,set:function(e,t){this.min.copy(e);this.max.copy(t);return this},setFromPoints:function(e){this.makeEmpty();for(var t=0,r=e.length;t<r;t++){this.expandByPoint(e[t])}return this},setFromCenterAndSize:function(){var t=new e.Vector2;return function(e,r){var n=t.copy(r).multiplyScalar(.5);this.min.copy(e).sub(n);this.max.copy(e).add(n);return this}}(),copy:function(e){this.min.copy(e.min);this.max.copy(e.max);return this},makeEmpty:function(){this.min.x=this.min.y=Infinity;this.max.x=this.max.y=-Infinity;return this},empty:function(){return this.max.x<this.min.x||this.max.y<this.min.y},center:function(t){var r=t||new e.Vector2;return r.addVectors(this.min,this.max).multiplyScalar(.5)},size:function(t){var r=t||new e.Vector2;return r.subVectors(this.max,this.min)},expandByPoint:function(e){this.min.min(e);this.max.max(e);return this},expandByVector:function(e){this.min.sub(e);this.max.add(e);return this},expandByScalar:function(e){this.min.addScalar(-e);this.max.addScalar(e);return this},containsPoint:function(e){if(e.x<this.min.x||e.x>this.max.x||e.y<this.min.y||e.y>this.max.y){return false}return true},containsBox:function(e){if(this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y){return true}return false},getParameter:function(t,r){var n=r||new e.Vector2;return n.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y))},isIntersectionBox:function(e){if(e.max.x<this.min.x||e.min.x>this.max.x||e.max.y<this.min.y||e.min.y>this.max.y){return false}return true},clampPoint:function(t,r){var n=r||new e.Vector2;return n.copy(t).clamp(this.min,this.max)},distanceToPoint:function(){var t=new e.Vector2;return function(e){var r=t.copy(e).clamp(this.min,this.max);return r.sub(e).length()}}(),intersect:function(e){this.min.max(e.min);this.max.min(e.max);return this},union:function(e){this.min.min(e.min);this.max.max(e.max);return this},translate:function(e){this.min.add(e);this.max.add(e);return this},equals:function(e){return e.min.equals(this.min)&&e.max.equals(this.max)},clone:function(){return(new e.Box2).copy(this)}};e.Box3=function(t,r){this.min=t!==undefined?t:new e.Vector3(Infinity,Infinity,Infinity);this.max=r!==undefined?r:new e.Vector3(-Infinity,-Infinity,-Infinity)};e.Box3.prototype={constructor:e.Box3,set:function(e,t){this.min.copy(e);this.max.copy(t);return this},setFromPoints:function(e){this.makeEmpty();for(var t=0,r=e.length;t<r;t++){this.expandByPoint(e[t])}return this},setFromCenterAndSize:function(){var t=new e.Vector3;return function(e,r){var n=t.copy(r).multiplyScalar(.5);this.min.copy(e).sub(n);this.max.copy(e).add(n);return this}}(),setFromObject:function(){var t=new e.Vector3;return function(r){var n=this;r.updateMatrixWorld(true);this.makeEmpty();r.traverse(function(r){var i=r.geometry;if(i!==undefined){if(i instanceof e.Geometry){var a=i.vertices;for(var o=0,s=a.length;o<s;o++){t.copy(a[o]);t.applyMatrix4(r.matrixWorld);n.expandByPoint(t)}}else if(i instanceof e.BufferGeometry&&i.attributes["position"]!==undefined){var u=i.attributes["position"].array;for(var o=0,s=u.length;o<s;o+=3){t.set(u[o],u[o+1],u[o+2]);t.applyMatrix4(r.matrixWorld);n.expandByPoint(t)}}}});return this}}(),copy:function(e){this.min.copy(e.min);this.max.copy(e.max);return this},makeEmpty:function(){this.min.x=this.min.y=this.min.z=Infinity;this.max.x=this.max.y=this.max.z=-Infinity;return this},empty:function(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z},center:function(t){var r=t||new e.Vector3;return r.addVectors(this.min,this.max).multiplyScalar(.5)},size:function(t){var r=t||new e.Vector3;return r.subVectors(this.max,this.min)},expandByPoint:function(e){this.min.min(e);this.max.max(e);return this},expandByVector:function(e){this.min.sub(e);this.max.add(e);return this},expandByScalar:function(e){this.min.addScalar(-e);this.max.addScalar(e);return this},containsPoint:function(e){if(e.x<this.min.x||e.x>this.max.x||e.y<this.min.y||e.y>this.max.y||e.z<this.min.z||e.z>this.max.z){return false}return true},containsBox:function(e){if(this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z){return true}return false},getParameter:function(t,r){var n=r||new e.Vector3;return n.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))},isIntersectionBox:function(e){if(e.max.x<this.min.x||e.min.x>this.max.x||e.max.y<this.min.y||e.min.y>this.max.y||e.max.z<this.min.z||e.min.z>this.max.z){return false}return true},clampPoint:function(t,r){var n=r||new e.Vector3;return n.copy(t).clamp(this.min,this.max)},distanceToPoint:function(){var t=new e.Vector3;return function(e){var r=t.copy(e).clamp(this.min,this.max);return r.sub(e).length()}}(),getBoundingSphere:function(){var t=new e.Vector3;return function(r){var n=r||new e.Sphere;n.center=this.center();n.radius=this.size(t).length()*.5;return n}}(),intersect:function(e){this.min.max(e.min);this.max.min(e.max);return this},union:function(e){this.min.min(e.min);this.max.max(e.max);return this}
108,applyMatrix4:function(){var t=[new e.Vector3,new e.Vector3,new e.Vector3,new e.Vector3,new e.Vector3,new e.Vector3,new e.Vector3,new e.Vector3];return function(e){t[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e);t[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e);t[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e);t[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e);t[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e);t[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e);t[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e);t[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e);this.makeEmpty();this.setFromPoints(t);return this}}(),translate:function(e){this.min.add(e);this.max.add(e);return this},equals:function(e){return e.min.equals(this.min)&&e.max.equals(this.max)},clone:function(){return(new e.Box3).copy(this)}};e.Matrix3=function(){this.elements=new Float32Array([1,0,0,0,1,0,0,0,1]);if(arguments.length>0){e.error("THREE.Matrix3: the constructor no longer reads arguments. use .set() instead.")}};e.Matrix3.prototype={constructor:e.Matrix3,set:function(e,t,r,n,i,a,o,s,u){var l=this.elements;l[0]=e;l[3]=t;l[6]=r;l[1]=n;l[4]=i;l[7]=a;l[2]=o;l[5]=s;l[8]=u;return this},identity:function(){this.set(1,0,0,0,1,0,0,0,1);return this},copy:function(e){var t=e.elements;this.set(t[0],t[3],t[6],t[1],t[4],t[7],t[2],t[5],t[8]);return this},multiplyVector3:function(t){e.warn("THREE.Matrix3: .multiplyVector3(
108) has been removed. Use vector.applyMatrix3( matrix ) instead.");return t.applyMatrix3(this)},multiplyVector3Array:function(t){e.warn("THREE.Matrix3: .multiplyVector3Array() has been renamed. Use matrix.applyToVector3Array( array ) instead.");return this.applyToVector3Array(t)},applyToVector3Array:function(){var t=new e.Vector3;return function(e,r,n){if(r===undefined)r=0;if(n===undefined)n=e.length;for(var i=0,a=r;i<n;i+=3,a+=3){t.x=e[a];t.y=e[a+1];t.z=e[a+2];t.applyMatrix3(this);e[a]=t.x;e[a+1]=t.y;e[a+2]=t.z}return e}}(),multiplyScalar:function(e){var t=this.elements;t[0]*=e;t[3]*=e;t[6]*=e;t[1]*=e;t[4]*=e;t[7]*=e;t[2]*=e;t[5]*=e;t[8]*=e;return this},determinant:function(){var e=this.elements;var t=e[0],r=e[1],n=e[2],i=e[3],a=e[4],o=e[5],s=e[6],u=e[7],l=e[8];return t*a*l-t*o*u-r*i*l+r*o*s+n*i*u-n*a*s},getInverse:function(t,r){var n=t.elements;var i=this.elements;i[0]=n[10]*n[5]-n[6]*n[9];i[1]=-n[10]*n[1]+n[2]*n[9];i[2]=n[6]*n[1]-n[2]*n[5];i[3]=-n[10]*n[4]+n[6]*n[8];i[4]=n[10]*n[0]-n[2]*n[8];i[5]=-n[6]*n[0]+n[2]*n[4];i[6]=n[9]*n[4]-n[5]*n[8];i[7]=-n[9]*n[0]+n[1]*n[8];i[8]=n[5]*n[0]-n[1]*n[4];var a=n[0]*i[0]+n[1]*i[3]+n[2]*i[6];if(a===0){var o="Matrix3.getInverse(): can't invert matrix, determinant is 0";if(r||false){throw new Error(o)}else{e.warn(o)}this.identity();return this}this.multiplyScalar(1/a);return this},transpose:function(){var e,t=this.elements;e=t[1];t[1]=t[3];t[3]=e;e=t[2];t[2]=t[6];t[6]=e;e=t[5];t[5]=t[7];t[7]=e;return this},flattenToArrayOffset:function(e,t){var r=this.elements;e[t]=r[0];e[t+1]=r[1];e[t+2]=r[2];e[t+3]=r[3];e[t+4]=r[4];e[t+5]=r[5];e[t+6]=r[6];e[t+7]=r[7];e[t+8]=r[8];return e},getNormalMatrix:function(e){this.getInverse(e).transpose();return this},transposeIntoArray:function(e){var t=this.elements;e[0]=t[0];e[1]=t[3];e[2]=t[6];e[3]=t[1];e[4]=t[4];e[5]=t[7];e[6]=t[2];e[7]=t[5];e[8]=t[8];return this},fromArray:function(e){this.elements.set(e);return this},toArray:function(){var e=this.elements;return[e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8]]},clone:function(){return(new e.Matrix3).fromArray(this.elements)}};e.Matrix4=function(){this.elements=new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]);if(arguments.length>0){e.error("THREE.Matrix4: the constructor no longer reads arguments. use .set() instead.")}};e.Matrix4.prototype={constructor:e.Matrix4,set:function(e,t,r,n,i,a,o,s,u,l,c,f,h,d,p,m){var v=this.elements;v[0]=e;v[4]=t;v[8]=r;v[12]=n;v[1]=i;v[5]=a;v[9]=o;v[13]=s;v[2]=u;v[6]=l;v[10]=c;v[14]=f;v[3]=h;v[7]=d;v[11]=p;v[15]=m;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(e){this.elements.set(e.elements);return this},extractPosition:function(t){e.warn("THREE.Matrix4: .extractPosition() has been renamed to .copyPosition().");return this.copyPosition(t)},copyPosition:function(e){var t=this.elements;var r=e.elements;t[12]=r[12];t[13]=r[13];t[14]=r[14];return this},extractBasis:function(e,t,r){var n=this.elements;e.set(n[0],n[1],n[2]);t.set(n[4],n[5],n[6]);r.set(n[8],n[9],n[10]);return this},makeBasis:function(e,t,r){this.set(e.x,t.x,r.x,0,e.y,t.y,r.y,0,e.z,t.z,r.z,0,0,0,0,1);return this},extractRotation:function(){var t=new e.Vector3;return function(e){var r=this.elements;var n=e.elements;var i=1/t.set(n[0],n[1],n[2]).length();var a=1/t.set(n[4],n[5],n[6]).length();var o=1/t.set(n[8],n[9],n[10]).length();r[0]=n[0]*i;r[1]=n[1]*i;r[2]=n[2]*i;r[4]=n[4]*a;r[5]=n[5]*a;r[6]=n[6]*a;r[8]=n[8]*o;r[9]=n[9]*o;r[10]=n[10]*o;return this}}(),makeRotationFromEuler:function(t){if(t instanceof e.Euler===false){e.error("THREE.Matrix: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.")}var r=this.elements;var n=t.x,i=t.y,a=t.z;var o=Math.cos(n),s=Math.sin(n);var u=Math.cos(i),l=Math.sin(i);var c=Math.cos(a),f=Math.sin(a);if(t.order==="XYZ"){var h=o*c,d=o*f,p=s*c,m=s*f;r[0]=u*c;r[4]=-u*f;r[8]=l;r[1]=d+p*l;r[5]=h-m*l;r[9]=-s*u;r[2]=m-h*l;r[6]=p+d*l;r[10]=o*u}else if(t.order==="YXZ"){var v=u*c,y=u*f,g=l*c,b=l*f;r[0]=v+b*s;r[4]=g*s-y;r[8]=o*l;r[1]=o*f;r[5]=o*c;r[9]=-s;r[2]=y*s-g;r[6]=b+v*s;r[10]=o*u}else if(t.order==="ZXY"){var v=u*c,y=u*f,g=l*c,b=l*f;r[0]=v-b*s;r[4]=-o*f;r[8]=g+y*s;r[1]=y+g*s;r[5]=o*c;r[9]=b-v*s;r[2]=-o*l;r[6]=s;r[10]=o*u}else if(t.order==="ZYX"){var h=o*c,d=o*f,p=s*c,m=s*f;r[0]=u*c;r[4]=p*l-d;r[8]=h*l+m;r[1]=u*f;r[5]=m*l+h;r[9]=d*l-p;r[2]=-l;r[6]=s*u;r[10]=o*u}else if(t.order==="YZX"){var x=o*u,_=o*l,w=s*u,C=s*l;r[0]=u*c;r[4]=C-x*f;r[8]=w*f+_;r[1]=f;r[5]=o*c;r[9]=-s*c;r[2]=-l*c;r[6]=_*f+w;r[10]=x-C*f}else if(t.order==="XZY"){var x=o*u,_=o*l,w=s*u,C=s*l;r[0]=u*c;r[4]=-f;r[8]=l*c;r[1]=x*f+C;r[5]=o*c;r[9]=_*f-w;r[2]=w*f-_;r[6]=s*c;r[10]=C*f+x}r[3]=0;r[7]=0;r[11]=0;r[12]=0;r[13]=0;r[14]=0;r[15]=1;return this},setRotationFromQuaternion:function(t){e.warn("THREE.Matrix4: .setRotationFromQuaternion() has been renamed to .makeRotationFromQuaternion().");return this.makeRotationFromQuaternion(t)},makeRotationFromQuaternion:function(e){var t=this.elements;var r=e.x,n=e.y,i=e.z,a=e.w;var o=r+r,s=n+n,u=i+i;var l=r*o,c=r*s,f=r*u;var h=n*s,d=n*u,p=i*u;var m=a*o,v=a*s,y=a*u;t[0]=1-(h+p);t[4]=c-y;t[8]=f+v;t[1]=c+y;t[5]=1-(l+p);t[9]=d-m;t[2]=f-v;t[6]=d+m;t[10]=1-(l+h);t[3]=0;t[7]=0;t[11]=0;t[12]=0;t[13]=0;t[14]=0;t[15]=1;return this},lookAt:function(){var t=new e.Vector3;var r=new e.Vector3;var n=new e.Vector3;return function(e,i,a){var o=this.elements;n.subVectors(e,i).normalize();if(n.length()===0){n.z=1}t.crossVectors(a,n).normalize();if(t.length()===0){n.x+=1e-4;t.crossVectors(a,n).normalize()}r.crossVectors(n,t);o[0]=t.x;o[4]=r.x;o[8]=n.x;o[1]=t.y;o[5]=r.y;o[9]=n.y;o[2]=t.z;o[6]=r.z;o[10]=n.z;return this}}(),multiply:function(t,r){if(r!==undefined){e.warn("THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead.");return this.multiplyMatrices(t,r)}return this.multiplyMatrices(this,t)},multiplyMatrices:function(e,t){var r=e.elements;var n=t.elements;var i=this.elements;var a=r[0],o=r[4],s=r[8],u=r[12];var l=r[1],c=r[5],f=r[9],h=r[13];var d=r[2],p=r[6],m=r[10],v=r[14];var y=r[3],g=r[7],b=r[11],x=r[15];var _=n[0],w=n[4],C=n[8],E=n[12];var S=n[1],T=n[5],M=n[9],A=n[13];var P=n[2],R=n[6],k=n[10],I=n[14];var D=n[3],B=n[7],L=n[11],F=n[15];i[0]=a*_+o*S+s*P+u*D;i[4]=a*w+o*T+s*R+u*B;i[8]=a*C+o*M+s*k+u*L;i[12]=a*E+o*A+s*I+u*F;i[1]=l*_+c*S+f*P+h*D;i[5]=l*w+c*T+f*R+h*B;i[9]=l*C+c*M+f*k+h*L;i[13]=l*E+c*A+f*I+h*F;i[2]=d*_+p*S+m*P+v*D;i[6]=d*w+p*T+m*R+v*B;i[10]=d*C+p*M+m*k+v*L;i[14]=d*E+p*A+m*I+v*F;i[3]=y*_+g*S+b*P+x*D;i[7]=y*w+g*T+b*R+x*B;i[11]=y*C+g*M+b*k+x*L;i[15]=y*E+g*A+b*I+x*F;return this},multiplyToArray:function(e,t,r){var n=this.elements;this.multiplyMatrices(e,t);r[0]=n[0];r[1]=n[1];r[2]=n[2];r[3]=n[3];r[4]=n[4];r[5]=n[5];r[6]=n[6];r[7]=n[7];r[8]=n[8];r[9]=n[9];r[10]=n[10];r[11]=n[11];r[12]=n[12];r[13]=n[13];r[14]=n[14];r[15]=n[15];return this},multiplyScalar:function(e){var t=this.elements;t[0]*=e;t[4]*=e;t[8]*=e;t[12]*=e;t[1]*=e;t[5]*=e;t[9]*=e;t[13]*=e;t[2]*=e;t[6]*=e;t[10]*=e;t[14]*=e;t[3]*=e;t[7]*=e;t[11]*=e;t[15]*=e;return this},multiplyVector3:function(t){e.warn("THREE.Matrix4: .multiplyVector3(
108) has been removed. Use vector.applyMatrix4( matrix ) or vector.applyProjection( matrix ) instead.");return t.applyProjection(this)},multiplyVector4:function(t){e.warn("THREE.Matrix4: .multiplyVector4() has been removed. Use vector.applyMatrix4( matrix ) instead.");return t.applyMatrix4(this)},multiplyVector3Array:function(t){e.warn("THREE.Matrix4: .multiplyVector3Array() has been renamed. Use matrix.applyToVector3Array( array ) instead.");return this.applyToVector3Array(t)},applyToVector3Array:function(){var t=new e.Vector3;return function(e,r,n){if(r===undefined)r=0;if(n===undefined)n=e.length;for(var i=0,a=r;i<n;i+=3,a+=3){t.x=e[a];t.y=e[a+1];t.z=e[a+2];t.applyMatrix4(this);e[a]=t.x;e[a+1]=t.y;e[a+2]=t.z}return e}}(),rotateAxis:function(t){e.warn("THREE.Matrix4: .rotateAxis() has been removed. Use Vector3.transformDirection( matrix ) instead.");t.transformDirection(this)},crossVector:function(t){e.warn("THREE.Matrix4: .crossVector() has been removed. Use vector.applyMatrix4( matrix ) instead.");return t.applyMatrix4(this)},determinant:function(){var e=this.elements;var t=e[0],r=e[4],n=e[8],i=e[12];var a=e[1],o=e[5],s=e[9],u=e[13];var l=e[2],c=e[6],f=e[10],h=e[14];var d=e[3],p=e[7],m=e[11],v=e[15];return d*(+i*s*c-n*u*c-i*o*f+r*u*f+n*o*h-r*s*h)+p*(+t*s*h-t*u*f+i*a*f-n*a*h+n*u*l-i*s*l)+m*(+t*u*c-t*o*h-i*a*c+r*a*h+i*o*l-r*u*l)+v*(-n*o*l-t*s*c+t*o*f+n*a*c-r*a*f+r*s*l)},transpose:function(){var e=this.elements;var t;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;return this},flattenToArrayOffset:function(e,t){var r=this.elements;e[t]=r[0];e[t+1]=r[1];e[t+2]=r[2];e[t+3]=r[3];e[t+4]=r[4];e[t+5]=r[5];e[t+6]=r[6];e[t+7]=r[7];e[t+8]=r[8];e[t+9]=r[9];e[t+10]=r[10];e[t+11]=r[11];e[t+12]=r[12];e[t+13]=r[13];e[t+14]=r[14];e[t+15]=r[15];return e},getPosition:function(){var t=new e.Vector3;return function(){e.warn("THREE.Matrix4: .getPosition() has been removed. Use Vector3.setFromMatrixPosition( matrix ) instead.");var r=this.elements;return t.set(r[12],r[13],r[14])}}(),setPosition:function(e){var t=this.elements;t[12]=e.x;t[13]=e.y;t[14]=e.z;return this},getInverse:function(t,r){var n=this.elements;var i=t.elements;var a=i[0],o=i[4],s=i[8],u=i[12];var l=i[1],c=i[5],f=i[9],h=i[13];var d=i[2],p=i[6],m=i[10],v=i[14];var y=i[3],g=i[7],b=i[11],x=i[15];n[0]=f*v*g-h*m*g+h*p*b-c*v*b-f*p*x+c*m*x;n[4]=u*m*g-s*v*g-u*p*b+o*v*b+s*p*x-o*m*x;n[8]=s*h*g-u*f*g+u*c*b-o*h*b-s*c*x+o*f*x;n[12]=u*f*p-s*h*p-u*c*m+o*h*m+s*c*v-o*f*v;n[1]=h*m*y-f*v*y-h*d*b+l*v*b+f*d*x-l*m*x;n[5]=s*v*y-u*m*y+u*d*b-a*v*b-s*d*x+a*m*x;n[9]=u*f*y-s*h*y-u*l*b+a*h*b+s*l*x-a*f*x;n[13]=s*h*d-u*f*d+u*l*m-a*h*m-s*l*v+a*f*v;n[2]=c*v*y-h*p*y+h*d*g-l*v*g-c*d*x+l*p*x;n[6]=u*p*y-o*v*y-u*d*g+a*v*g+o*d*x-a*p*x;n[10]=o*h*y-u*c*y+u*l*g-a*h*g-o*l*x+a*c*x;n[14]=u*c*d-o*h*d-u*l*p+a*h*p+o*l*v-a*c*v;n[3]=f*p*y-c*m*y-f*d*g+l*m*g+c*d*b-l*p*b;n[7]=o*m*y-s*p*y+s*d*g-a*m*g-o*d*b+a*p*b;n[11]=s*c*y-o*f*y-s*l*g+a*f*g+o*l*b-a*c*b;n[15]=o*f*d-s*c*d+s*l*p-a*f*p-o*l*m+a*c*m;var _=a*n[0]+l*n[4]+d*n[8]+y*n[12];if(_==0){var w="THREE.Matrix4.getInverse(): can't invert matrix, determinant is 0";if(r||false){throw new Error(w)}else{e.warn(w)}this.identity();return this}this.multiplyScalar(1/_);return this},translate:function(t){e.error("THREE.Matrix4: .translate() has been removed.")},rotateX:function(t){e.error("THREE.Matrix4: .rotateX() has been removed.")},rotateY:function(t){e.error("THREE.Matrix4: .rotateY() has been removed.")},rotateZ:function(t){e.error("THREE.Matrix4: .rotateZ() has been removed.")},rotateByAxis:function(t,r){e.error("THREE.Matrix4: .rotateByAxis() has been removed.")},scale:function(e){var t=this.elements;var r=e.x,n=e.y,i=e.z;t[0]*=r;t[4]*=n;t[8]*=i;t[1]*=r;t[5]*=n;t[9]*=i;t[2]*=r;t[6]*=n;t[10]*=i;t[3]*=r;t[7]*=n;t[11]*=i;return this},getMaxScaleOnAxis:function(){var e=this.elements;var t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2];var r=e[4]*e[4]+e[5]*e[5]+e[6]*e[6];var n=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,Math.max(r,n)))},makeTranslation:function(e,t,r){this.set(1,0,0,e,0,1,0,t,0,0,1,r,0,0,0,1);return this},makeRotationX:function(e){var t=Math.cos(e),r=Math.sin(e);this.set(1,0,0,0,0,t,-r,0,0,r,t,0,0,0,0,1);return this},makeRotationY:function(e){var t=Math.cos(e),r=Math.sin(e);this.set(t,0,r,0,0,1,0,0,-r,0,t,0,0,0,0,1);return this},makeRotationZ:function(e){var t=Math.cos(e),r=Math.sin(e);this.set(t,-r,0,0,r,t,0,0,0,0,1,0,0,0,0,1);return this},makeRotationAxis:function(e,t){var r=Math.cos(t);var n=Math.sin(t);var i=1-r;var a=e.x,o=e.y,s=e.z;var u=i*a,l=i*o;this.set(u*a+r,u*o-n*s,u*s+n*o,0,u*o+n*s,l*o+r,l*s-n*a,0,u*s-n*o,l*s+n*a,i*s*s+r,0,0,0,0,1);return this},makeScale:function(e,t,r){this.set(e,0,0,0,0,t,0,0,0,0,r,0,0,0,0,1);return this},compose:function(e,t,r){this.makeRotationFromQuaternion(t);this.scale(r);this.setPosition(e);return this},decompose:function(){var t=new e.Vector3;
108var r=new e.Matrix4;return function(e,n,i){var a=this.elements;var o=t.set(a[0],a[1],a[2]).length();var s=t.set(a[4],a[5],a[6]).length();var u=t.set(a[8],a[9],a[10]).length();var l=this.determinant();if(l<0){o=-o}e.x=a[12];e.y=a[13];e.z=a[14];r.elements.set(this.elements);var c=1/o;var f=1/s;var h=1/u;r.elements[0]*=c;r.elements[1]*=c;r.elements[2]*=c;r.elements[4]*=f;r.elements[5]*=f;r.elements[6]*=f;r.elements[8]*=h;r.elements[9]*=h;r.elements[10]*=h;n.setFromRotationMatrix(r);i.x=o;i.y=s;i.z=u;return this}}(),makeFrustum:function(e,t,r,n,i,a){var o=this.elements;var s=2*i/(t-e);var u=2*i/(n-r);var l=(t+e)/(t-e);var c=(n+r)/(n-r);var f=-(a+i)/(a-i);var h=-2*a*i/(a-i);o[0]=s;o[4]=0;o[8]=l;o[12]=0;o[1]=0;o[5]=u;o[9]=c;o[13]=0;o[2]=0;o[6]=0;o[10]=f;o[14]=h;o[3]=0;o[7]=0;o[11]=-1;o[15]=0;return this},makePerspective:function(t,r,n,i){var a=n*Math.tan(e.Math.degToRad(t*.5));var o=-a;var s=o*r;var u=a*r;return this.makeFrustum(s,u,o,a,n,i)},makeOrthographic:function(e,t,r,n,i,a){var o=this.elements;var s=t-e;var u=r-n;var l=a-i;var c=(t+e)/s;var f=(r+n)/u;var h=(a+i)/l;o[0]=2/s;o[4]=0;o[8]=0;o[12]=-c;o[1]=0;o[5]=2/u;o[9]=0;o[13]=-f;o[2]=0;o[6]=0;o[10]=-2/l;o[14]=-h;o[3]=0;o[7]=0;o[11]=0;o[15]=1;return this},fromArray:function(e){this.elements.set(e);return this},toArray:function(){var e=this.elements;return[e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8],e[9],e[10],e[11],e[12],e[13],e[14],e[15]]},clone:function(){return(new e.Matrix4).fromArray(this.elements)}};e.Ray=function(t,r){this.origin=t!==undefined?t:new e.Vector3;this.direction=r!==undefined?r:new e.Vector3};e.Ray.prototype={constructor:e.Ray,set:function(e,t){this.origin.copy(e);this.direction.copy(t);return this},copy:function(e){this.origin.copy(e.origin);this.direction.copy(e.direction);return this},at:function(t,r){var n=r||new e.Vector3;return n.copy(this.direction).multiplyScalar(t).add(this.origin)},recast:function(){var t=new e.Vector3;return function(e){this.origin.copy(this.at(e,t));return this}}(),closestPointToPoint:function(t,r){var n=r||new e.Vector3;n.subVectors(t,this.origin);var i=n.dot(this.direction);if(i<0){return n.copy(this.origin)}return n.copy(this.direction).multiplyScalar(i).add(this.origin)},distanceToPoint:function(){var t=new e.Vector3;return function(e){var r=t.subVectors(e,this.origin).dot(this.direction);if(r<0){return this.origin.distanceTo(e)}t.copy(this.direction).multiplyScalar(r).add(this.origin);return t.distanceTo(e)}}(),distanceSqToSegment:function(){var t=new e.Vector3;var r=new e.Vector3;var n=new e.Vector3;return function(e,i,a,o){t.copy(e).add(i).multiplyScalar(.5);r.copy(i).sub(e).normalize();n.copy(this.origin).sub(t);var s=e.distanceTo(i)*.5;var u=-this.direction.dot(r);var l=n.dot(this.direction);var c=-n.dot(r);var f=n.lengthSq();var h=Math.abs(1-u*u);var d,p,m,v;if(h>0){d=u*c-l;p=u*l-c;v=s*h;if(d>=0){if(p>=-v){if(p<=v){var y=1/h;d*=y;p*=y;m=d*(d+u*p+2*l)+p*(u*d+p+2*c)+f}else{p=s;d=Math.max(0,-(u*p+l));m=-d*d+p*(p+2*c)+f}}else{p=-s;d=Math.max(0,-(u*p+l));m=-d*d+p*(p+2*c)+f}}else{if(p<=-v){d=Math.max(0,-(-u*s+l));p=d>0?-s:Math.min(Math.max(-s,-c),s);m=-d*d+p*(p+2*c)+f}else if(p<=v){d=0;p=Math.min(Math.max(-s,-c),s);m=p*(p+2*c)+f}else{d=Math.max(0,-(u*s+l));p=d>0?s:Math.min(Math.max(-s,-c),s);m=-d*d+p*(p+2*c)+f}}}else{p=u>0?-s:s;d=Math.max(0,-(u*p+l));m=-d*d+p*(p+2*c)+f}if(a){a.copy(this.direction).multiplyScalar(d).add(this.origin)}if(o){o.copy(r).multiplyScalar(p).add(t)}return m}}(),isIntersectionSphere:function(e){return this.distanceToPoint(e.center)<=e.radius},intersectSphere:function(){var t=new e.Vector3;return function(e,r){t.subVectors(e.center,this.origin);var n=t.dot(this.direction);var i=t.dot(t)-n*n;var a=e.radius*e.radius;if(i>a)return null;var o=Math.sqrt(a-i);var s=n-o;var u=n+o;if(s<0&&u<0)return null;if(s<0)return this.at(u,r);return this.at(s,r)}}(),isIntersectionPlane:function(e){var t=e.distanceToPoint(this.origin);if(t===0){return true}var r=e.normal.dot(this.direction);if(r*t<0){return true}return false},distanceToPlane:function(e){var t=e.normal.dot(this.direction);if(t==0){if(e.distanceToPoint(this.origin)==0){return 0}return null}var r=-(this.origin.dot(e.normal)+e.constant)/t;return r>=0?r:null},intersectPlane:function(e,t){var r=this.distanceToPlane(e);if(r===null){return null}return this.at(r,t)},isIntersectionBox:function(){var t=new e.Vector3;return function(e){return this.intersectBox(e,t)!==null}}(),intersectBox:function(e,t){var r,n,i,a,o,s;var u=1/this.direction.x,l=1/this.direction.y,c=1/this.direction.z;var f=this.origin;if(u>=0){r=(e.min.x-f.x)*u;n=(e.max.x-f.x)*u}else{r=(e.max.x-f.x)*u;n=(e.min.x-f.x)*u}if(l>=0){i=(e.min.y-f.y)*l;a=(e.max.y-f.y)*l}else{i=(e.max.y-f.y)*l;a=(e.min.y-f.y)*l}if(r>a||i>n)return null;if(i>r||r!==r)r=i;if(a<n||n!==n)n=a;if(c>=0){o=(e.min.z-f.z)*c;s=(e.max.z-f.z)*c}else{o=(e.max.z-f.z)*c;s=(e.min.z-f.z)*c}if(r>s||o>n)return null;if(o>r||r!==r)r=o;if(s<n||n!==n)n=s;if(n<0)return null;return this.at(r>=0?r:n,t)},intersectTriangle:function(){var t=new e.Vector3;var r=new e.Vector3;var n=new e.Vector3;var i=new e.Vector3;return function(e,a,o,s,u){r.subVectors(a,e);n.subVectors(o,e);i.crossVectors(r,n);var l=this.direction.dot(i);var c;if(l>0){if(s)return null;c=1}else if(l<0){c=-1;l=-l}else{return null}t.subVectors(this.origin,e);var f=c*this.direction.dot(n.crossVectors(t,n));if(f<0){return null}var h=c*this.direction.dot(r.cross(t));if(h<0){return null}if(f+h>l){return null}var d=-c*t.dot(i);if(d<0){return null}return this.at(d/l,u)}}(),applyMatrix4:function(e){this.direction.add(this.origin).applyMatrix4(e);this.origin.applyMatrix4(e);this.direction.sub(this.origin);this.direction.normalize();return this},equals:function(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)},clone:function(){return(new e.Ray).copy(this)}};e.Sphere=function(t,r){this.center=t!==undefined?t:new e.Vector3;this.radius=r!==undefined?r:0};e.Sphere.prototype={constructor:e.Sphere,set:function(e,t){this.center.copy(e);this.radius=t;return this},setFromPoints:function(){var t=new e.Box3;return function(e,r){var n=this.center;if(r!==undefined){n.copy(r)}else{t.setFromPoints(e).center(n)}var i=0;for(var a=0,o=e.length;a<o;a++){i=Math.max(i,n.distanceToSquared(e[a]))}this.radius=Math.sqrt(i);return this}}(),copy:function(e){this.center.copy(e.center);this.radius=e.radius;return this},empty:function(){return this.radius<=0},containsPoint:function(e){return e.distanceToSquared(this.center)<=this.radius*this.radius},distanceToPoint:function(e){return e.distanceTo(this.center)-this.radius},intersectsSphere:function(e){var t=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=t*t},clampPoint:function(t,r){var n=this.center.distanceToSquared(t);var i=r||new e.Vector3;i.copy(t) 109;if(n>this.radius*this.radius){i.sub(this.center).normalize();i.multiplyScalar(this.radius).add(this.center)}return i},getBoundingBox:function(t){var r=t||new e.Box3;r.set(this.center,this.center);r.expandByScalar(this.radius);return r}
109,applyMatrix4:function(e){this.center.applyMatrix4(e);this.radius=this.radius*e.getMaxScaleOnAxis();return this},translate:function(e){this.center.add(e);return this},equals:function(e){return e.center.equals(this.center)&&e.radius===this.radius},clone:function(){return(new e.Sphere).copy(this)}};e.Frustum=function(t,r,n,i,a,o){this.planes=[t!==undefined?t:new e.Plane,r!==undefined?r:new e.Plane,n!==undefined?n:new e.Plane,i!==undefined?i:new e.Plane,a!==undefined?a:new e.Plane,o!==undefined?o:new e.Plane]};e.Frustum.prototype={constructor:e.Frustum,set:function(e,t,r,n,i,a){var o=this.planes;o[0].copy(e);o[1].copy(t);o[2].copy(r);o[3].copy(n);o[4].copy(i);o[5].copy(a);return this},copy:function(e){var t=this.planes;for(var r=0;r<6;r++){t[r].copy(e.planes[r])}return this},setFromMatrix:function(e){var t=this.planes;var r=e.elements;var n=r[0],i=r[1],a=r[2],o=r[3];var s=r[4],u=r[5],l=r[6],c=r[7];var f=r[8],h=r[9],d=r[10],p=r[11];var m=r[12],v=r[13],y=r[14],g=r[15];t[0].setComponents(o-n,c-s,p-f,g-m).normalize();t[1].setComponents(o+n,c+s,p+f,g+m).normalize();t[2].setComponents(o+i,c+u,p+h,g+v).normalize();t[3].setComponents(o-i,c-u,p-h,g-v).normalize();t[4].setComponents(o-a,c-l,p-d,g-y).normalize();t[5].setComponents(o+a,c+l,p+d,g+y).normalize();return this},intersectsObject:function(){var t=new e.Sphere;return function(e){var r=e.geometry;if(r.boundingSphere===null)r.computeBoundingSphere();t.copy(r.boundingSphere);t.applyMatrix4(e.matrixWorld);return this.intersectsSphere(t)}}(),intersectsSphere:function(e){var t=this.planes;var r=e.center;var n=-e.radius;for(var i=0;i<6;i++){var a=t[i].distanceToPoint(r);if(a<n){return false}}return true},intersectsBox:function(){var t=new e.Vector3,r=new e.Vector3;return function(e){var n=this.planes;for(var i=0;i<6;i++){var a=n[i];t.x=a.normal.x>0?e.min.x:e.max.x;r.x=a.normal.x>0?e.max.x:e.min.x;t.y=a.normal.y>0?e.min.y:e.max.y;r.y=a.normal.y>0?e.max.y:e.min.y;t.z=a.normal.z>0?e.min.z:e.max.z;r.z=a.normal.z>0?e.max.z:e.min.z;var o=a.distanceToPoint(t);var s=a.distanceToPoint(r);if(o<0&&s<0){return false}}return true}}(),containsPoint:function(e){var t=this.planes;for(var r=0;r<6;r++){if(t[r].distanceToPoint(e)<0){return false}}return true},clone:function(){return(new e.Frustum).copy(this)}};e.Plane=function(t,r){this.normal=t!==undefined?t:new e.Vector3(1,0,0);this.constant=r!==undefined?r:0};e.Plane.prototype={constructor:e.Plane,set:function(e,t){this.normal.copy(e);this.constant=t;return this},setComponents:function(e,t,r,n){this.normal.set(e,t,r);this.constant=n;return this},setFromNormalAndCoplanarPoint:function(e,t){this.normal.copy(e);this.constant=-t.dot(this.normal);return this},setFromCoplanarPoints:function(){var t=new e.Vector3;var r=new e.Vector3;return function(e,n,i){var a=t.subVectors(i,n).cross(r.subVectors(e,n)).normalize();this.setFromNormalAndCoplanarPoint(a,e);return this}}(),copy:function(e){this.normal.copy(e.normal);this.constant=e.constant;return this},normalize:function(){var e=1/this.normal.length();this.normal.multiplyScalar(e);this.constant*=e;return this},negate:function(){this.constant*=-1;this.normal.negate();return this},distanceToPoint:function(e){return this.normal.dot(e)+this.constant},distanceToSphere:function(e){return this.distanceToPoint(e.center)-e.radius},projectPoint:function(e,t){return this.orthoPoint(e,t).sub(e).negate()},orthoPoint:function(t,r){var n=this.distanceToPoint(t);var i=r||new e.Vector3;return i.copy(this.normal).multiplyScalar(n)},isIntersectionLine:function(e){var t=this.distanceToPoint(e.start);var r=this.distanceToPoint(e.end);return t<0&&r>0||r<0&&t>0},intersectLine:function(){var t=new e.Vector3;return function(r,n){var i=n||new e.Vector3;var a=r.delta(t);var o=this.normal.dot(a);if(o==0){if(this.distanceToPoint(r.start)==0){return i.copy(r.start)}return undefined}var s=-(r.start.dot(this.normal)+this.constant)/o;if(s<0||s>1){return undefined}return i.copy(a).multiplyScalar(s).add(r.start)}}(),coplanarPoint:function(t){var r=t||new e.Vector3;return r.copy(this.normal).multiplyScalar(-this.constant)},applyMatrix4:function(){var t=new e.Vector3;var r=new e.Vector3;
109var n=new e.Matrix3;return function(e,i){var a=i||n.getNormalMatrix(e);var o=t.copy(this.normal).applyMatrix3(a);var s=this.coplanarPoint(r);s.applyMatrix4(e);this.setFromNormalAndCoplanarPoint(o,s);return this}}(),translate:function(e){this.constant=this.constant-e.dot(this.normal);return this},equals:function(e){return e.normal.equals(this.normal)&&e.constant==this.constant},clone:function(){return(new e.Plane).copy(this)}};e.Math={generateUUID:function(){var e="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split("");var t=new Array(36);var r=0,n;return function(){for(var i=0;i<36;i++){if(i==8||i==13||i==18||i==23){t[i]="-"}else if(i==14){t[i]="4"}else{if(r<=2)r=33554432+Math.random()*16777216|0;n=r&15;r=r>>4;t[i]=e[i==19?n&3|8:n]}}return t.join("")}}(),clamp:function(e,t,r){return e<t?t:e>r?r:e},clampBottom:function(e,t){return e<t?t:e},mapLinear:function(e,t,r,n,i){return n+(e-t)*(i-n)/(r-t)},smoothstep:function(e,t,r){if(e<=t)return 0;if(e>=r)return 1;e=(e-t)/(r-t);return e*e*(3-2*e)},smootherstep:function(e,t,r){if(e<=t)return 0;if(e>=r)return 1;e=(e-t)/(r-t);return e*e*e*(e*(e*6-15)+10)},random16:function(){return(65280*Math.random()+255*Math.random())/65535},randInt:function(e,t){return Math.floor(this.randFloat(e,t))},randFloat:function(e,t){return e+Math.random()*(t-e)},randFloatSpread:function(e){return e*(.5-Math.random())},degToRad:function(){var e=Math.PI/180;return function(t){return t*e}}(),radToDeg:function(){var e=180/Math.PI;return function(t){return t*e}}(),isPowerOfTwo:function(e){return(e&e-1)===0&&e!==0},nextPowerOfTwo:function(e){e--;e|=e>>1;e|=e>>2;e|=e>>4;e|=e>>8;e|=e>>16;e++;return e}};e.Spline=function(t){this.points=t;var r=[],n={x:0,y:0,z:0},i,a,o,s,u,l,c,f,h;this.initFromArray=function(e){this.points=[];for(var t=0;t<e.length;t++){this.points[t]={x:e[t][0],y:e[t][1],z:e[t][2]}}};this.getPoint=function(e){i=(this.points.length-1)*e;a=Math.floor(i);o=i-a;r[0]=a===0?a:a-1;r[1]=a;r[2]=a>this.points.length-2?this.points.length-1:a+1;r[3]=a>this.points.length-3?this.points.length-1:a+2;l=this.points[r[0]];c=this.points[r[1]];f=this.points[r[2]];h=this.points[r[3]];s=o*o;u=o*s;n.x=d(l.x,c.x,f.x,h.x,o,s,u);n.y=d(l.y,c.y,f.y,h.y,o,s,u);n.z=d(l.z,c.z,f.z,h.z,o,s,u);return n};this.getControlPointsArray=function(){var e,t,r=this.points.length,n=[];for(e=0;e<r;e++){t=this.points[e];n[e]=[t.x,t.y,t.z]}return n};this.getLength=function(t){var r,n,i,a,o=0,s=0,u=0,l=new e.Vector3,c=new e.Vector3,f=[],h=0;f[0]=0;if(!t)t=100;i=this.points.length*t;l.copy(this.points[0]);for(r=1;r<i;r++){n=r/i;a=this.getPoint(n);c.copy(a);h+=c.distanceTo(l);l.copy(a);o=(this.points.length-1)*n;s=Math.floor(o);if(s!=u){f[s]=h;u=s}}f[f.length]=h;return{chunks:f,total:h}};this.reparametrizeByArcLength=function(t){var r,n,i,a,o,s,u,l,c=[],f=new e.Vector3,h=this.getLength();c.push(f.copy(this.points[0]).clone());for(r=1;r<this.points.length;r++){s=h.chunks[r]-h.chunks[r-1];u=Math.ceil(t*s/h.total);a=(r-1)/(this.points.length-1);o=r/(this.points.length-1);for(n=1;n<u-1;n++){i=a+n*(1/u)*(o-a);l=this.getPoint(i);c.push(f.copy(l).clone())}c.push(f.copy(this.points[r]).clone())}this.points=c};function d(e,t,r,n,i,a,o){var s=(r-e)*.5,u=(n-t)*.5;return(2*(t-r)+s+u)*o+(-3*(t-r)-2*s-u)*a+s*i+t}};e.Triangle=function(t,r,n){this.a=t!==undefined?t:new e.Vector3;this.b=r!==undefined?r:new e.Vector3;this.c=n!==undefined?n:new e.Vector3};e.Triangle.normal=function(){var t=new e.Vector3;return function(r,n,i,a){var o=a||new e.Vector3;o.subVectors(i,n);t.subVectors(r,n);o.cross(t);var s=o.lengthSq();if(s>0){return o.multiplyScalar(1/Math.sqrt(s))}return o.set(0,0,0)}}();e.Triangle.barycoordFromPoint=function(){var t=new e.Vector3;var r=new e.Vector3;var n=new e.Vector3;return function(i,a,o,s,u){t.subVectors(s,a);r.subVectors(o,a);n.subVectors(i,a);var l=t.dot(t);var c=t.dot(r);var f=t.dot(n);var h=r.dot(r);var d=r.dot(n);var p=l*h-c*c;var m=u||new e.Vector3;if(p==0){return m.set(-2,-1,-1)}var v=1/p;var y=(h*f-c*d)*v;var g=(l*d-c*f)*v;return m.set(1-y-g,g,y)}}();e.Triangle.containsPoint=function(){var t=new e.Vector3;return function(r,n,i,a){var o=e.Triangle.barycoordFromPoint(r,n,i,a,t);return o.x>=0&&o.y>=0&&o.x+o.y<=1}}();e.Triangle.prototype={constructor:e.Triangle,set:function(e,t,r){this.a.copy(e);this.b.copy(t);this.c.copy(r);return this},setFromPointsAndIndices:function(e,t,r,n){this.a.copy(e[t]);this.b.copy(e[r]);this.c.copy(e[n]);return this},copy:function(e){this.a.copy(e.a);this.b.copy(e.b);this.c.copy(e.c);return this},area:function(){var t=new e.Vector3;var r=new e.Vector3;return function(){t.subVectors(this.c,this.b);r.subVectors(this.a,this.b);return t.cross(r).length()*.5}}(),midpoint:function(t){var r=t||new e.Vector3;return r.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)},normal:function(t){return e.Triangle.normal(this.a,this.b,this.c,t)},plane:function(t){var r=t||new e.Plane;return r.setFromCoplanarPoints(this.a,this.b,this.c)},barycoordFromPoint:function(t,r){return e.Triangle.barycoordFromPoint(t,this.a,this.b,this.c,r)},containsPoint:function(t){return e.Triangle.containsPoint(t,this.a,this.b,this.c)},equals:function(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)},clone:function(){return(new e.Triangle).copy(this)}};e.Clock=function(e){this.autoStart=e!==undefined?e:true;this.startTime=0;this.oldTime=0;this.elapsedTime=0;this.running=false};e.Clock.prototype={constructor:e.Clock,start:function(){this.startTime=self.performance!==undefined&&self.performance.now!==un
109defined?self.performance.now():Date.now();this.oldTime=this.startTime;this.running=true},stop:function(){this.getElapsedTime();this.running=false},getElapsedTime:function(){this.getDelta();return this.elapsedTime},getDelta:function(){var e=0;if(this.autoStart&&!this.running){this.start()}if(this.running){var t=self.performance!==undefined&&self.performance.now!==undefined?self.performance.now():Date.now();e=.001*(t-this.oldTime);this.oldTime=t;this.elapsedTime+=e}return e}};e.EventDispatcher=function(){};e.EventDispatcher.prototype={constructor:e.EventDispatcher,apply:function(t){t.addEventListener=e.EventDispatcher.prototype.addEventListener;t.hasEventListener=e.EventDispatcher.prototype.hasEventListener;t.removeEventListener=e.EventDispatcher.prototype.removeEventListener;t.dispatchEvent=e.EventDispatcher.prototype.dispatchEvent},addEventListener:function(e,t){if(this._listeners===undefined)this._listeners={};var r=this._listeners;if(r[e]===undefined){r[e]=[]}if(r[e].indexOf(t)===-1){r[e].push(t)}},hasEventListener:function(e,t){if(this._listeners===undefined)return false;var r=this._listeners;if(r[e]!==undefined&&r[e].indexOf(t)!==-1){return true}return false},removeEventListener:function(e,t){if(this._listeners===undefined)return;var r=this._listeners;var n=r[e];if(n!==undefined){var i=n.indexOf(t);if(i!==-1){n.splice(i,1)}}},dispatchEvent:function(e){if(this._listeners===undefined)return;var t=this._listeners;var r=t[e.type];if(r!==undefined){e.target=this;var n=[];var i=r.length;for(var a=0;a<i;a++){n[a]=r[a]}for(var a=0;a<i;a++){n[a].call(this,e)}}}};(function(e){e.Raycaster=function(t,r,n,i){this.ray=new e.Ray(t,r);this.near=n||0;this.far=i||Infinity;this.params={Sprite:{},Mesh:{},PointCloud:{threshold:1},LOD:{},Line:{}}};var t=function(e,t){return e.distance-t.distance};var r=function(e,t,n,i){e.raycast(t,n);if(i===true){var a=e.children;for(var o=0,s=a.length;o<s;o++){r(a[o],t,n,true)}}};e.Raycaster.prototype={constructor:e.Raycaster,precision:1e-4,linePrecision:1,set:function(e,t){this.ray.set(e,t)},setFromCamera:function(t,r){if(r instanceof e.PerspectiveCamera){this.ray.origin.copy(r.position);this.ray.direction.set(t.x,t.y,.5).unproject(r).sub(r.position).normalize()}else if(r instanceof e.OrthographicCamera){this.ray.origin.set(t.x,t.y,-1).unproject(r);this.ray.direction.set(0,0,-1).transformDirection(r.matrixWorld)}else{e.error("THREE.Raycaster: Unsupported camera type.")}},intersectObject:function(e,n){var i=[];r(e,this,i,n);i.sort(t);return i},intersectObjects:function(n,i){var a=[];if(n instanceof Array===false){e.warn("THREE.Raycaster.intersectObjects: objects is not an Array.");return a}for(var o=0,s=n.length;o<s;o++){r(n[o],this,a,i)}a.sort(t);return a}}})(e);e.Object3D=function(){Object.defineProperty(this,"id",{value:e.Object3DIdCount++});this.uuid=e.Math.generateUUID();this.name="";this.type="Object3D";this.parent=undefined;this.children=[];this.up=e.Object3D.DefaultUp.clone();var t=new e.Vector3;var r=new e.Euler;var n=new e.Quaternion;var i=new e.Vector3(1,1,1);var a=function(){n.setFromEuler(r,false)};var o=function(){r.setFromQuaternion(n,undefined,false)};r.onChange(a);n.onChange(o);Object.defineProperties(this,{position:{enumerable:true,value:t},rotation:{enumerable:true,value:r},quaternion:{enumerable:true,value:n},scale:{enumerable:true,value:i}});this.rotationAutoUpdate=true;
109this.matrix=new e.Matrix4;this.matrixWorld=new e.Matrix4;this.matrixAutoUpdate=true;this.matrixWorldNeedsUpdate=false;this.visible=true;this.castShadow=false;this.receiveShadow=false;this.frustumCulled=true;this.renderOrder=0;this.userData={}};e.Object3D.DefaultUp=new e.Vector3(0,1,0);e.Object3D.prototype={constructor:e.Object3D,get eulerOrder(){e.warn("THREE.Object3D: .eulerOrder has been moved to .rotation.order.");return this.rotation.order},set eulerOrder(t){e.warn("THREE.Object3D: .eulerOrder has been moved to .rotation.order.");this.rotation.order=t},get useQuaternion(){e.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")},set useQuaternion(t){e.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")},applyMatrix:function(e){this.matrix.multiplyMatrices(e,this.matrix);this.matrix.decompose(this.position,this.quaternion,this.scale)},setRotationFromAxisAngle:function(e,t){this.quaternion.setFromAxisAngle(e,t)},setRotationFromEuler:function(e){this.quaternion.setFromEuler(e,true)},setRotationFromMatrix:function(e){this.quaternion.setFromRotationMatrix(e)},setRotationFromQuaternion:function(e){this.quaternion.copy(e)},rotateOnAxis:function(){var t=new e.Quaternion;return function(e,r){t.setFromAxisAngle(e,r);this.quaternion.multiply(t);return this}}(),rotateX:function(){var t=new e.Vector3(1,0,0);return function(e){return this.rotateOnAxis(t,e)}}(),rotateY:function(){var t=new e.Vector3(0,1,0);return function(e){return this.rotateOnAxis(t,e)}}(),rotateZ:function(){var t=new e.Vector3(0,0,1);return function(e){return this.rotateOnAxis(t,e)}}(),translateOnAxis:function(){var t=new e.Vector3;return function(e,r){t.copy(e).applyQuaternion(this.quaternion);this.position.add(t.multiplyScalar(r));return this}}(),translate:function(t,r){e.warn("THREE.Object3D: .translate() has been removed. Use .translateOnAxis( axis, distance ) instead.");return this.translateOnAxis(r,t)},translateX:function(){var t=new e.Vector3(1,0,0);return function(e){return this.translateOnAxis(t,e)}}(),translateY:function(){var t=new e.Vector3(0,1,0);return function(e){return this.translateOnAxis(t,e)}}(),translateZ:function(){var t=new e.Vector3(0,0,1);return function(e){return this.translateOnAxis(t,e)}}(),localToWorld:function(e){return e.applyMatrix4(this.matrixWorld)},worldToLocal:function(){var t=new e.Matrix4;return function(e){return e.applyMatrix4(t.getInverse(this.matrixWorld))}}(),lookAt:function(){var t=new e.Matrix4;return function(e){t.lookAt(e,this.position,this.up);this.quaternion.setFromRotationMatrix(t)}}(),add:function(t){if(arguments.length>1){for(var r=0;r<arguments.length;r++){this.add(arguments[r])}return this}if(t===this){e.error("THREE.Object3D.add: object can't be added as a child of itself.",t);return this}if(t instanceof e.Object3D){if(t.parent!==undefined){t.parent.remove(t)}t.parent=this;t.dispatchEvent({type:"added"});this.children.push(t)}else{e.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",t)}return this},remove:function(e){if(arguments.length>1){for(var t=0;t<arguments.length;t++){this.remove(arguments[t])}}var r=this.children.indexOf(e);if(r!==-1){e.parent=undefined;e.dispatchEvent({type:"removed"});this.children.splice(r,1)}},getChildByName:function(t){e.warn("THREE.Object3D: .getChildByName() has been renamed to .getObjectByName().");return this.getObjectByName(t)},getObjectById:function(e){return this.getObjectByProperty("id",e)},getObjectByName:function(e){return this.getObjectByProperty("name",e)},getObjectByProperty:function(e,t){if(this[e]===t)return this;for(var r=0,n=this.children.length;r<n;r++){var i=this.children[r];var a=i.getObjectByProperty(e,t);if(a!==undefined){return a}}return undefined},getWorldPosition:function(t){var r=t||new e.Vector3;this.updateMatrixWorld(true);return r.setFromMatrixPosition(this.matrixWorld)},getWorldQuaternion:function(){var t=new e.Vector3;var r=new e.Vector3;return function(n){var i=n||new e.Quaternion;this.updateMatrixWorld(true);this.matrixWorld.decompose(t,i,r);return i}}(),getWorldRotation:function(){var t=new e.Quaternion;return function(r){var n=r||new e.Euler;this.getWorldQuaternion(t);return n.setFromQuaternion(t,this.rotation.order,false)}}(),getWorldScale:function(){var t=new e.Vector3;var r=new e.Quaternion;return function(n){var i=n||new e.Vector3;this.updateMatrixWorld(true);this.matrixWorld.decompose(t,r,i);return i}}(),getWorldDirection:function(){var t=new e.Quaternion;return function(r){var n=r||new e.Vector3;this.getWorldQuaternion(t);return n.set(0,0,1).applyQuaternion(t)}}(),raycast:function(){},traverse:function(e){e(this);for(var t=0,r=this.children.length;t<r;t++){this.children[t].traverse(e)}},traverseVisible:function(e){if(this.visible===false)return;e(this);for(var t=0,r=this.children.length;t<r;t++){this.children[t].traverseVisible(e)}},traverseAncestors:function(e){if(this.parent){e(this.parent);this.parent.traverseAncestors(e)}},updateMatrix:function(){this.matrix.compose(this.position,this.quaternion,this.scale);this.matrixWorldNeedsUpdate=true},updateMatrixWorld:function(e){if(this.matrixAutoUpdate===true)this.updateMatrix();if(this.matrixWorldNeedsUpdate===true||e===true){if(this.parent===undefined){this.matrixWorld.copy(this.matrix
109)}else{this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)}this.matrixWorldNeedsUpdate=false;e=true}for(var t=0,r=this.children.length;t<r;t++){this.children[t].updateMatrixWorld(e)}},toJSON:function(){var t={metadata:{version:4.3,type:"Object",generator:"ObjectExporter"}};var r={};var n=function(e){if(t.geometries===undefined){t.geometries=[]}if(r[e.uuid]===undefined){var n=e.toJSON();delete n.metadata;r[e.uuid]=n;t.geometries.push(n)}return e.uuid};var i={};var a=function(e){if(t.materials===undefined){t.materials=[]}if(i[e.uuid]===undefined){var r=e.toJSON();delete r.metadata;i[e.uuid]=r;t.materials.push(r)}return e.uuid};var o=function(t){var r={};r.uuid=t.uuid;r.type=t.type;if(t.name!=="")r.name=t.name;if(JSON.stringify(t.userData)!=="{}")r.userData=t.userData;if(t.visible!==true)r.visible=t.visible;if(t instanceof e.PerspectiveCamera){r.fov=t.fov;r.aspect=t.aspect;r.near=t.near;r.far=t.far}else if(t instanceof e.OrthographicCamera){r.left=t.left;r.right=t.right;r.top=t.top;r.bottom=t.bottom;r.near=t.near;r.far=t.far}else if(t instanceof e.AmbientLight){r.color=t.color.getHex()}else if(t instanceof e.DirectionalLight){r.color=t.color.getHex();r.intensity=t.intensity}else if(t instanceof e.PointLight){r.color=t.color.getHex();r.intensity=t.intensity;r.distance=t.distance;r.decay=t.decay}else if(t instanceof e.SpotLight){r.color=t.color.getHex();r.intensity=t.intensity;r.distance=t.distance;r.angle=t.angle;r.exponent=t.exponent;r.decay=t.decay}else if(t instanceof e.HemisphereLight){r.color=t.color.getHex();r.groundColor=t.groundColor.getHex()}else if(t instanceof e.Mesh||t instanceof e.Line||t instanceof e.PointCloud){r.geometry=n(t.geometry);r.material=a(t.material);if(t instanceof e.Line)r.mode=t.mode}else if(t instanceof e.Sprite){r.material=a(t.material)}r.matrix=t.matrix.toArray();if(t.children.length>0){r.children=[];for(var i=0;i<t.children.length;i++){r.children.push(o(t.children[i]))}}return r};t.object=o(this);return t},clone:function(t,r){if(t===undefined)t=new e.Object3D;if(r===undefined)r=true;t.name=this.name;t.up.copy(this.up);t.position.copy(this.position);t.quaternion.copy(this.quaternion);t.scale.copy(this.scale);t.rotationAutoUpdate=this.rotationAutoUpdate;t.matrix.copy(this.matrix);t.matrixWorld.copy(this.matrixWorld);t.matrixAutoUpdate=this.matrixAutoUpdate;t.matrixWorldNeedsUpdate=this.matrixWorldNeedsUpdate;t.visible=this.visible;t.castShadow=this.castShadow;t.receiveShadow=this.receiveShadow;t.frustumCulled=this.frustumCulled;t.userData=JSON.parse(JSON.stringify(this.userData));if(r===true){for(var n=0;n<this.children.length;n++){var i=this.children[n];t.add(i.clone())}}return t}};e.EventDispatcher.prototype.apply(e.Object3D.prototype);e.Object3DIdCount=0;e.Face3=function(t,r,n,i,a,o){this.a=t;this.b=r;this.c=n;this.normal=i instanceof e.Vector3?i:new e.Vector3;this.vertexNormals=i instanceof Array?i:[];this.color=a instanceof e.Color?a:new e.Color;this.vertexColors=a instanceof Array?a:[];this.vertexTangents=[];this.materialIndex=o!==undefined?o:0};e.Face3.prototype={constructor:e.Face3,clone:function(){var t=new e.Face3(this.a,this.b,this.c);t.normal.copy(this.normal);t.color.copy(this.color);t.materialIndex=this.materialIndex;for(var r=0,n=this.vertexNormals.length;r<n;r++){t.vertexNormals[r]=this.vertexNormals[r].clone()}for(var r=0,n=this.vertexColors.length;r<n;r++){t.vertexColors[r]=this.vertexColors[r].clone()}for(var r=0,n=this.vertexTangents.length;r<n;r++){t.vertexTangents[r]=this.vertexTangents[r].clone()}return t}};e.Face4=function(t,r,n,i,a,o,s){e.warn("THREE.Face4 has been removed. A THREE.Face3 will be created instead.");return new e.Face3(t,r,n,a,o,s)};e.BufferAttribute=function(e,t){this.array=e;this.itemSize=t;this.needsUpdate=false};e.BufferAttribute.prototype={constructor:e.BufferAttribute,get length(){return this.array.length},copyAt:function(e,t,r){e*=this.itemSize;r*=t.itemSize;for(var n=0,i=this.itemSize;n<i;n++){this.array[e+n]=t.array[r+n]}return this},set:function(e,t){if(t===undefined)t=0;this.array.set(e,t);return this},setX:function(e,t){this.array[e*this.itemSize]=t;return this},setY:function(e,t){this.array[e*this.itemSize+1]=t;return this},setZ:function(e,t){this.array[e*this.itemSize+2]=t;return this},setXY:function(e,t,r){e*=this.itemSize;this.array[e]=t;this.array[e+1]=r;return this},setXYZ:function(e,t,r,n){e*=this.itemSize;this.array[e]=t;this.array[e+1]=r;this.array[e+2]=n;return this},setXYZW:function(e,t,r,n,i){e*=this.itemSize;this.array[e]=t;this.array[e+1]=r;this.array[e+2]=n;this.array[e+3]=i;return this},clone:function(){return new e.BufferAttribute(new this.array.constructor(this.array),this.itemSize)}};e.Int8Attribute=function(t,r){e.warn("THREE.Int8Attribute has been removed. Use THREE.BufferAttribute( array, itemSize ) instead.");return new e.BufferAttribute(t,r)};e.Uint8Attribute=function(t,r){e.warn("THREE.Uint8Attribute has been removed. Use THREE.BufferAttribute( array, itemSize ) instead.");return new e.BufferAttribute(t,r)};e.Uint8ClampedAttribute=function(t,r){e.warn("THREE.Uint8ClampedAttribute has been removed. Use THREE.BufferAttribute( array, itemSize ) instead.");return new e.BufferAttribute(t,r)};e.Int16Attribute=function(t,r){e.warn("THREE.Int16Attribute has been removed. Use THREE.BufferAttribute( array, itemSize ) instead.");return new e.BufferAttribute(t,r)};e.Uint16Attribute=function(t,r){e.warn("THREE.Uint16Attribute has been removed. Use THREE.BufferAttribute( array, itemSize ) instead.");return new e.BufferAttribute(t,r)};e.Int32Attribute=function(t,r){e.warn("THREE.Int32Attribute has been removed. Use THREE.BufferAttribute( array, itemSize ) instead.");return new e.BufferAttribute(t,r)};e.Uint32Attribute=function(t,r){e.warn("THREE.Uint32Attribute has been removed. Use THREE.BufferAttribute( array, itemSize ) instead.");return new e.BufferAttribute(t,r)};e.Float32Attribute=function(t,r){e.warn("THREE.Float32Attribute has been removed. Use THREE.BufferAttribute( array, itemSize ) instead.");return new e.BufferAttribute(t,r)};e.Float64Attribute=function(t,r){e.warn("THREE.Float64Attribute has been removed. Use THREE.BufferAttribute( array, itemSize ) instead.");return new e.BufferAttribute(t,r)};e.DynamicBufferAttribute=function(t,r){e.BufferAttribute.call(this,t,r);this.updateRange={offset:0,count:-1}};e.DynamicBufferAttribute.prototype=Object.create(e.BufferAttribute.prototype);e.DynamicBufferAttribute.prototype.constructor=e.DynamicBufferAttribute;e.DynamicBufferAttribute.prototype.clone=function(){return new e.DynamicBufferAttribute(new this.array.constructor(this.array),this.itemSize)};e.BufferGeometry=function(){Object.defineProperty(this,"id",{value:e.GeometryIdCount++});this.uuid=e.Math.generateUUID();this.name="";this.type="BufferGeometry";this.attributes={};this.attributesKeys=[];this.drawcalls=[];this.offsets=this.drawcalls;this.boundingBox=null;this.boundingSphere=null};e.BufferGeometry.prototype={constructor:e.BufferGeometry,addAttribute:function(t,r){if(r instanceof e.BufferAttribute===false){e.warn("THREE.BufferGeometry: .addAttribute() now expects ( name, attribute ).");this.attributes[t]={array:arguments[1],itemSize:arguments[2]};return}this.attributes[t]=r;this.attributesKeys=Object.keys(this.attributes)},getAttribute:function(e){return this.attributes[e]},addDrawCall:function(e,t,r){this.drawcalls.push({start:e,count:t,index:r!==undefined?r:0})},applyMatrix:function(t){var r=this.attributes.position;if(r!==undefined){t.applyToVector3Array(r.array);r.needsUpdate=true}var n=this.attributes.normal;
109if(n!==undefined){var i=(new e.Matrix3).getNormalMatrix(t);i.applyToVector3Array(n.array);n.needsUpdate=true}if(this.boundingBox!==null){this.computeBoundingBox()}if(this.boundingSphere!==null){this.computeBoundingSphere()}},center:function(){this.computeBoundingBox();var t=this.boundingBox.center().negate();this.applyMatrix((new e.Matrix4).setPosition(t));return t},fromGeometry:function(t,r){r=r||{vertexColors:e.NoColors};var n=t.vertices;var i=t.faces;var a=t.faceVertexUvs;var o=r.vertexColors;var s=a[0].length>0;var u=i[0].vertexNormals.length==3;var l=new Float32Array(i.length*3*3);this.addAttribute("position",new e.BufferAttribute(l,3));var c=new Float32Array(i.length*3*3);this.addAttribute("normal",new e.BufferAttribute(c,3));if(o!==e.NoColors){var f=new Float32Array(i.length*3*3);this.addAttribute("color",new e.BufferAttribute(f,3))}if(s===true){var h=new Float32Array(i.length*3*2);this.addAttribute("uv",new e.BufferAttribute(h,2))}for(var d=0,p=0,m=0;d<i.length;d++,p+=6,m+=9){var v=i[d];var y=n[v.a];var g=n[v.b];var b=n[v.c];l[m]=y.x;l[m+1]=y.y;l[m+2]=y.z;l[m+3]=g.x;l[m+4]=g.y;l[m+5]=g.z;l[m+6]=b.x;l[m+7]=b.y;l[m+8]=b.z;if(u===true){var x=v.vertexNormals[0];var _=v.vertexNormals[1];var w=v.vertexNormals[2];c[m]=x.x;c[m+1]=x.y;c[m+2]=x.z;c[m+3]=_.x;c[m+4]=_.y;c[m+5]=_.z;c[m+6]=w.x;c[m+7]=w.y;c[m+8]=w.z}else{var C=v.normal;c[m]=C.x;c[m+1]=C.y;c[m+2]=C.z;c[m+3]=C.x;c[m+4]=C.y;c[m+5]=C.z;c[m+6]=C.x;c[m+7]=C.y;c[m+8]=C.z}if(o===e.FaceColors){var E=v.color;f[m]=E.r;f[m+1]=E.g;f[m+2]=E.b;f[m+3]=E.r;f[m+4]=E.g;f[m+5]=E.b;f[m+6]=E.r;f[m+7]=E.g;f[m+8]=E.b}else if(o===e.VertexColors){var S=v.vertexColors[0];var T=v.vertexColors[1];var M=v.vertexColors[2];f[m]=S.r;f[m+1]=S.g;f[m+2]=S.b;f[m+3]=T.r;f[m+4]=T.g;f[m+5]=T.b;f[m+6]=M.r;f[m+7]=M.g;f[m+8]=M.b}if(s===true){var A=a[0][d][0];var P=a[0][d][1];var R=a[0][d][2];h[p]=A.x;h[p+1]=A.y;h[p+2]=P.x;h[p+3]=P.y;h[p+4]=R.x;h[p+5]=R.y}}this.computeBoundingSphere();return this},computeBoundingBox:function(){var t=new e.Vector3;return function(){if(this.boundingBox===null){this.boundingBox=new e.Box3}var r=this.attributes.position.array;if(r){var n=this.boundingBox;n.makeEmpty();for(var i=0,a=r.length;i<a;i+=3){t.set(r[i],r[i+1],r[i+2]);n.expandByPoint(t)}}if(r===undefined||r.length===0){this.boundingBox.min.set(0,0,0);this.boundingBox.max.set(0,0,0)}if(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z)){e.error('THREE.BufferGeometry.computeBoundingBox: Computed min/max have NaN values. The "position" attribute is likely to have NaN values.')}}}(),computeBoundingSphere:function(){var t=new e.Box3;var r=new e.Vector3;return function(){if(this.boundingSphere===null){this.boundingSphere=new e.Sphere}var n=this.attributes.position.array;if(n){t.makeEmpty();var i=this.boundingSphere.center;for(var a=0,o=n.length;a<o;a+=3){r.set(n[a],n[a+1],n[a+2]);t.expandByPoint(r)}t.center(i);var s=0;for(var a=0,o=n.length;a<o;a+=3){r.set(n[a],n[a+1],n[a+2]);s=Math.max(s,i.distanceToSquared(r))}this.boundingSphere.radius=Math.sqrt(s);if(isNaN(this.boundingSphere.radius)){e.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.')}}}}(),computeFaceNormals:function(){},computeVertexNormals:function(){var t=this.attributes;if(t.position){var r=t.position.array;if(t.normal===undefined){this.addAttribute("normal",new e.BufferAttribute(new Float32Array(r.length),3))}else{var n=t.normal.array;for(var i=0,a=n.length;i<a;i++){n[i]=0}}var n=t.normal.array;var o,s,u,l=new e.Vector3,c=new e.Vector3,f=new e.Vector3,h=new e.Vector3,d=new e.Vector3;if(t.index){var p=t.index.array;var m=this.offsets.length>0?this.offsets:[{start:0,count:p.length,index:0}];for(var v=0,y=m.length;v<y;++v){var g=m[v].start;var b=m[v].count;var x=m[v].index;for(var i=g,a=g+b;i<a;i+=3){o=(x+p[i])*3;s=(x+p[i+1])*3;u=(x+p[i+2])*3;l.fromArray(r,o);c.fromArray(r,s);f.fromArray(r,u);h.subVectors(f,c);d.subVectors(l,c);h.cross(d);n[o]+=h.x;n[o+1]+=h.y;n[o+2]+=h.z;n[s]+=h.x;n[s+1]+=h.y;n[s+2]+=h.z;n[u]+=h.x;n[u+1]+=h.y;n[u+2]+=h.z}}}else{for(var i=0,a=r.length;i<a;i+=9){l.fromArray(r,i);c.fromArray(r,i+3);f.fromArray(r,i+6);h.subVectors(f,c);d.subVectors(l,c);h.cross(d);n[i]=h.x;n[i+1]=h.y;n[i+2]=h.z;n[i+3]=h.x;n[i+4]=h.y;n[i+5]=h.z;n[i+6]=h.x;n[i+7]=h.y;n[i+8]=h.z}}this.normalizeNormals();t.normal.needsUpdate=true}},computeTangents:function(){if(this.attributes.index===undefined||this.attributes.position===undefined||this.attributes.normal===undefined||this.attributes.uv===undefined){e.warn("THREE.BufferGeometry: Missing required attributes (index, position, normal or uv) in BufferGeometry.computeTangents()");return}var t=this.attributes.index.array;var r=this.attributes.position.array;var n=this.attributes.normal.array;var i=this.attributes.uv.array;var a=r.length/3;if(this.attributes.tangent===undefined){this.addAttribute("tangent",new e.BufferAttribute(new Float32Array(4*a),4))}var o=this.attributes.tangent.array;var s=[],u=[];for(var l=0;l<a;l++){s[l]=new e.Vector3;u[l]=new e.Vector3}var c=new e.Vector3,f=new e.Vector3,h=new e.Vector3,d=new e.Vector2,p=new e.Vector2,m=ne
109w e.Vector2,v,y,g,b,x,_,w,C,E,S,T;var M=new e.Vector3,A=new e.Vector3;function P(e,t,n){c.fromArray(r,e*3);f.fromArray(r,t*3);h.fromArray(r,n*3);d.fromArray(i,e*2);p.fromArray(i,t*2);m.fromArray(i,n*2);v=f.x-c.x;y=h.x-c.x;g=f.y-c.y;b=h.y-c.y;x=f.z-c.z;_=h.z-c.z;w=p.x-d.x;C=m.x-d.x;E=p.y-d.y;S=m.y-d.y;T=1/(w*S-C*E);M.set((S*v-E*y)*T,(S*g-E*b)*T,(S*x-E*_)*T);A.set((w*y-C*v)*T,(w*b-C*g)*T,(w*_-C*x)*T);s[e].add(M);s[t].add(M);s[n].add(M);u[e].add(A);u[t].add(A);u[n].add(A)}var R,k;var I,D;var B,L,F;if(this.drawcalls.length===0){this.addDrawCall(0,t.length,0)}var V=this.drawcalls;for(I=0,D=V.length;I<D;++I){var O=V[I].start;var U=V[I].count;var N=V[I].index;for(R=O, 110k=O+U;R<k;R+=3){B=N+t[R];L=N+t[R+1];F=N+t[R+2];P(B,L,F)}}var z=new e.Vector3,H=new e.Vector3;var j=new e.Vector3,G=new e.Vector3;var W,q,X;function Y(e){j.fromArray(n,e*3);G.copy(j);q=s[e];z.copy(q);z.sub(j.multiplyScalar(j.dot(q))).normalize();H.crossVectors(G,q);X=H.dot(u[e]);W=X<0?-1:1;o[e*4]=z.x;o[e*4+1]=z.y;o[e*4+2]=z.z;o[e*4+3]=W}for(I=0,D=V.length;I<D;++I){var O=V[I].start;var U=V[I].count;var N=V[I].index;for(R=O,k=O+U;R<k;R+=3){B=N+t[R];L=N+t[R+1];F=N+t[R+2];Y(B);Y(L);Y(F)}}},computeOffsets:function(e){if(e===undefined)e=65535;var t=this.attributes.index.array;var r=this.attributes.position.array;var n=t.length/3;var i=new Uint16Array(t.length);var a=0;var o=0;var s=[{start:0,count:0,index:0}];var u=s[0];var l=0;var c=0;var f=new Int32Array(6);var h=new Int32Array(r.length);var d=new Int32Array(r.length);for(var p=0;p<r.length;p++){h[p]=-1;d[p]=-1}for(var m=0;m<n;m++){c=0;for(var v=0;v<3;v++){var y=t[m*3+v];if(h[y]==-1){f[v*2]=y;f[v*2+1]=-1;c++}else if(h[y]<u.index){f[v*2]=y;f[v*2+1]=-1;l++}else{f[v*2]=y;f[v*2+1]=h[y]}}var g=o+c;if(g>u.index+e){var b={start:a,count:0,index:o};s.push(b);u=b;for(var x=0;x<6;x+=2){var _=f[x+1];if(_>-1&&_<u.index)f[x+1]=-1}}for(var x=0;x<6;x+=2){var y=f[x];var _=f[x+1];if(_===-1)_=o++;h[y]=_;d[_]=y;i[a++]=_-u.index;u.count++}}this.reorderBuffers(i,d,o);this.offsets=s;this.drawcalls=s;return s},merge:function(t,r){if(t instanceof e.BufferGeometry===false){e.error("THREE.BufferGeometry.merge(): geometry not an instance of THREE.BufferGeometry.",t);return}if(r===undefined)r=0;var n=this.attributes;for(var i in n){if(t.attributes[i]===undefined)continue;var a=n[i];var o=a.array;var s=t.attributes[i];var u=s.array;var l=s.itemSize;for(var c=0,f=l*r;c<u.length;c++,f++){o[f]=u[c]}}return this},normalizeNormals:function(){var e=this.attributes.normal.array;var t,r,n,i;for(var a=0,o=e.length;a<o;a+=3){t=e[a];r=e[a+1];n=e[a+2];i=1/Math.sqrt(t*t+r*r+n*n);e[a]*=i;e[a+1]*=i;e[a+2]*=i}},reorderBuffers:function(e,t,r){var n={};for(var i in this.attributes){if(i=="index")continue;var a=this.attributes[i].array;n[i]=new a.constructor(this.attributes[i].itemSize*r)}for(var o=0;o<r;o++){var s=t[o];for(var i in this.attributes){if(i=="index")continue;var u=this.attributes[i].array;var l=this.attributes[i].itemSize;var c=n[i];for(var f=0;f<l;f++)c[o*l+f]=u[s*l+f]}}this.attributes["index"].array=e;for(var i in this.attributes){if(i=="index")continue;this.attributes[i].array=n[i];this.attributes[i].numItems=this.attributes[i].itemSize*r}},toJSON:function(){var e={metadata:{version:4,type:"BufferGeometry",generator:"BufferGeometryExporter"}
110,uuid:this.uuid,type:this.type,data:{attributes:{}}};var t=this.attributes;var r=this.offsets;var n=this.boundingSphere;for(var i in t){var a=t[i];var o=Array.prototype.slice.call(a.array);e.data.attributes[i]={itemSize:a.itemSize,type:a.array.constructor.name,array:o}}if(r.length>0){e.data.offsets=JSON.parse(JSON.stringify(r))}if(n!==null){e.data.boundingSphere={center:n.center.toArray(),radius:n.radius}}return e},clone:function(){var t=new e.BufferGeometry;for(var r in this.attributes){var n=this.attributes[r];t.addAttribute(r,n.clone())}for(var i=0,a=this.offsets.length;i<a;i++){var o=this.offsets[i];t.offsets.push({start:o.start,index:o.index,count:o.count})}return t},dispose:function(){this.dispatchEvent({type:"dispose"})}};e.EventDispatcher.prototype.apply(e.BufferGeometry.prototype);e.Geometry=function(){Object.defineProperty(this,"id",{value:e.GeometryIdCount++});this.uuid=e.Math.generateUUID();this.name="";this.type="Geometry";this.vertices=[];this.colors=[];this.faces=[];this.faceVertexUvs=[[]];this.morphTargets=[];this.morphColors=[];this.morphNormals=[];this.skinWeights=[];this.skinIndices=[];this.lineDistances=[];this.boundingBox=null;this.boundingSphere=null;this.hasTangents=false;this.dynamic=true;this.verticesNeedUpdate=false;this.elementsNeedUpdate=false;this.uvsNeedUpdate=false;this.normalsNeedUpdate=false;this.tangentsNeedUpdate=false;this.colorsNeedUpdate=false;this.lineDistancesNeedUpdate=false;this.groupsNeedUpdate=false};e.Geometry.prototype={constructor:e.Geometry,applyMatrix:function(t){var r=(new e.Matrix3).getNormalMatrix(t);for(var n=0,i=this.vertices.length;n<i;n++){var a=this.vertices[n];a.applyMatrix4(t)}for(var n=0,i=this.faces.length;n<i;n++){var o=this.faces[n];o.normal.applyMatrix3(r).normalize();for(var s=0,u=o.vertexNormals.length;s<u;s++){o.vertexNormals[s].applyMatrix3(r).normalize()}}if(this.boundingBox!==null){this.computeBoundingBox()}if(this.boundingSphere!==null){this.computeBoundingSphere()}this.verticesNeedUpdate=true;this.normalsNeedUpdate=true},fromBufferGeometry:function(t){var r=this;var n=t.attributes;var i=n.position.array;
110var a=n.index!==undefined?n.index.array:undefined;var o=n.normal!==undefined?n.normal.array:undefined;var s=n.color!==undefined?n.color.array:undefined;var u=n.uv!==undefined?n.uv.array:undefined;var l=[];var c=[];for(var f=0,h=0;f<i.length;f+=3,h+=2){r.vertices.push(new e.Vector3(i[f],i[f+1],i[f+2]));if(o!==undefined){l.push(new e.Vector3(o[f],o[f+1],o[f+2]))}if(s!==undefined){r.colors.push(new e.Color(s[f],s[f+1],s[f+2]))}if(u!==undefined){c.push(new e.Vector2(u[h],u[h+1]))}}var d=function(t,n,i){var a=o!==undefined?[l[t].clone(),l[n].clone(),l[i].clone()]:[];var f=s!==undefined?[r.colors[t].clone(),r.colors[n].clone(),r.colors[i].clone()]:[];r.faces.push(new e.Face3(t,n,i,a,f));if(u!==undefined){r.faceVertexUvs[0].push([c[t].clone(),c[n].clone(),c[i].clone()])}};if(a!==undefined){var p=t.drawcalls;if(p.length>0){for(var f=0;f<p.length;f++){var m=p[f];var v=m.start;var y=m.count;var g=m.index;for(var h=v,b=v+y;h<b;h+=3){d(g+a[h],g+a[h+1],g+a[h+2])}}}else{for(var f=0;f<a.length;f+=3){d(a[f],a[f+1],a[f+2])}}}else{for(var f=0;f<i.length/3;f+=3){d(f,f+1,f+2)}}this.computeFaceNormals();
110if(t.boundingBox!==null){this.boundingBox=t.boundingBox.clone()}if(t.boundingSphere!==null){this.boundingSphere=t.boundingSphere.clone()}return this},center:function(){this.computeBoundingBox();var t=this.boundingBox.center().negate();this.applyMatrix((new e.Matrix4).setPosition(t));return t},computeFaceNormals:function(){var t=new e.Vector3,r=new e.Vector3;for(var n=0,i=this.faces.length;n<i;n++){var a=this.faces[n];var o=this.vertices[a.a];var s=this.vertices[a.b];var u=this.vertices[a.c];t.subVectors(u,s);r.subVectors(o,s);t.cross(r);t.normalize();a.normal.copy(t)}},computeVertexNormals:function(t){var r,n,i,a,o,s;s=new Array(this.vertices.length);for(r=0,n=this.vertices.length;r<n;r++){s[r]=new e.Vector3}if(t){var u,l,c;var f=new e.Vector3,h=new e.Vector3;for(i=0,a=this.faces.length;i<a;i++){o=this.faces[i];u=this.vertices[o.a];l=this.vertices[o.b];c=this.vertices[o.c];f.subVectors(c,l);h.subVectors(u,l);f.cross(h);s[o.a].add(f);s[o.b].add(f);s[o.c].add(f)}}else{for(i=0,a=this.faces.length;i<a;i++){o=this.faces[i];s[o.a].add(o.normal);s[o.b].add(o.normal);s[o.c].add(o.normal)}}for(r=0,n=this.vertices.length;r<n;r++){s[r].normalize()}for(i=0,a=this.faces.length;i<a;i++){o=this.faces[i];o.vertexNormals[0]=s[o.a].clone();o.vertexNormals[1]=s[o.b].clone();o.vertexNormals[2]=s[o.c].clone()}},computeMorphNormals:function(){var t,r,n,i,a;for(n=0,i=this.faces.length;n<i;n++){a=this.faces[n];
110if(!a.__originalFaceNormal){a.__originalFaceNormal=a.normal.clone()}else{a.__originalFaceNormal.copy(a.normal)}if(!a.__originalVertexNormals)a.__originalVertexNormals=[];for(t=0,r=a.vertexNormals.length;t<r;t++){if(!a.__originalVertexNormals[t]){a.__originalVertexNormals[t]=a.vertexNormals[t].clone()}else{a.__originalVertexNormals[t].copy(a.vertexNormals[t])}}}var o=new e.Geometry;o.faces=this.faces;for(t=0,r=this.morphTargets.length;t<r;t++){if(!this.morphNormals[t]){this.morphNormals[t]={};this.morphNormals[t].faceNormals=[];this.morphNormals[t].vertexNormals=[];var s=this.morphNormals[t].faceNormals;var u=this.morphNormals[t].vertexNormals;var l,c;for(n=0,i=this.faces.length;n<i;n++){l=new e.Vector3;c={a:new e.Vector3,b:new e.Vector3,c:new e.Vector3};s.push(l);u.push(c)}}var f=this.morphNormals[t];o.vertices=this.morphTargets[t].vertices;o.computeFaceNormals();o.computeVertexNormals();var l,c;for(n=0,i=this.faces.length;n<i;n++){a=this.faces[n];l=f.faceNormals[n];c=f.vertexNormals[n];l.copy(a.normal);c.a.copy(a.vertexNormals[0]);c.b.copy(a.vertexNormals[1]);c.c.copy(a.vertexNormals[2])}}for(n=0,i=this.faces.length;n<i;n++){a=this.faces[n];
110a.normal=a.__originalFaceNormal;a.vertexNormals=a.__originalVertexNormals}},computeTangents:function(){var t,r,n,i,a,o,s,u,l,c,f,h,d,p,m,v,y,g,b,x,_,w,C,E,S,T,M,A=[],P=[],R=new e.Vector3,k=new e.Vector3,I=new e.Vector3,D=new e.Vector3,B=new e.Vector3,L;for(n=0,i=this.vertices.length;n<i;n++){A[n]=new e.Vector3;P[n]=new e.Vector3}function F(e,t,r,n,i,a,o){l=e.vertices[t];c=e.vertices[r];f=e.vertices[n];h=u[i];d=u[a];p=u[o];m=c.x-l.x;v=f.x-l.x;y=c.y-l.y;g=f.y-l.y;b=c.z-l.z;x=f.z-l.z;_=d.x-h.x;w=p.x-h.x;C=d.y-h.y;E=p.y-h.y;S=1/(_*E-w*C);R.set((E*m-C*v)*S,(E*y-C*g)*S,(E*b-C*x)*S);k.set((_*v-w*m)*S,(_*g-w*y)*S,(_*x-w*b)*S);A[t].add(R);A[r].add(R);A[n].add(R);P[t].add(k);P[r].add(k);P[n].add(k)}for(t=0,r=this.faces.length;t<r;t++){s=this.faces[t];u=this.faceVertexUvs[0][t];F(this,s.a,s.b,s.c,0,1,2)}var V=["a","b","c","d"];for(t=0,r=this.faces.length;t<r;t++){s=this.faces[t];for(a=0;a<Math.min(s.vertexNormals.length,3);a++){B.copy(s.vertexNormals[a]);o=s[V[a]];T=A[o];I.copy(T);I.sub(B.multiplyScalar(B.dot(T))).normalize();D.crossVectors(s.vertexNormals[a],T);M=D.dot(P[o]);L=M<0?-1:1;s.vertexTangents[a]=new e.Vector4(I.x,I.y,I.z,L)}}this.hasTangents=true},computeLineDistances:function(){var e=0;var t=this.vertices;for(var r=0,n=t.length;r<n;r++){if(r>0){e+=t[r].distanceTo(t[r-1])}this.lineDistances[r]=e}},computeBoundingBox:function(){if(this.boundingBox===null){this.boundingBox=new e.Box3}this.boundingBox.setFromPoints(this.vertices)},computeBoundingSphere:function(){if(this.boundingSphere===null){this.boundingSphere=new e.Sphere}this.boundingSphere.setFromPoints(this.vertices)},merge:function(t,r,n){if(t instanceof e.Geometry===false){e.error("THREE.Geometry.merge(): geometry not an instance of THREE.Geometry.",t);return}var i,a=this.vertices.length,o=this.vertices,s=t.vertices,u=this.faces,l=t.faces,c=this.faceVertexUvs[0],f=t.faceVertexUvs[0];if(n===undefined)n=0;
110if(r!==undefined){i=(new e.Matrix3).getNormalMatrix(r)}for(var h=0,d=s.length;h<d;h++){var p=s[h];var m=p.clone();if(r!==undefined)m.applyMatrix4(r);o.push(m)}for(h=0,d=l.length;h<d;h++){var v=l[h],y,g,b,x=v.vertexNormals,_=v.vertexColors;y=new e.Face3(v.a+a,v.b+a,v.c+a);y.normal.copy(v.normal);if(i!==undefined){y.normal.applyMatrix3(i).normalize()}for(var w=0,C=x.length;w<C;w++){g=x[w].clone();if(i!==undefined){g.applyMatrix3(i).normalize()}y.vertexNormals.push(g)}y.color.copy(v.color);for(var w=0,C=_.length;w<C;w++){b=_[w];y.vertexColors.push(b.clone())}y.materialIndex=v.materialIndex+n;u.push(y)}for(h=0,d=f.length;h<d;h++){var E=f[h],S=[];if(E===undefined){continue}for(var w=0,C=E.length;w<C;w++){S.push(E[w].clone())}c.push(S)}},mergeMesh:function(t){if(t instanceof e.Mesh===false){e.error("THREE.Geometry.mergeMesh(): mesh not an instance of THREE.Mesh.",t);return}t.matrixAutoUpdate&&t.updateMatrix();this.merge(t.geometry,t.matrix)},mergeVertices:function(){var e={};var t=[],r=[];var n,i;var a=4;var o=Math.pow(10,a);var s,u,l;var c,f,h;for(s=0,u=this.vertices.length;s<u;s++){n=this.vertices[s];i=Math.round(n.x*o)+"_"+Math.round(n.y*o)+"_"+Math.round(n.z*o);if(e[i]===undefined){e[i]=s;t.push(this.vertices[s]);r[s]=t.length-1}else{r[s]=r[e[i]]}}var d=[];for(s=0,u=this.faces.length;s<u;s++){l=this.faces[s];l.a=r[l.a];l.b=r[l.b];l.c=r[l.c];c=[l.a,l.b,l.c];var p=-1;for(var m=0;m<3;m++){if(c[m]==c[(m+1)%3]){p=m;d.push(s);break}}}for(s=d.length-1;s>=0;s--){var v=d[s];this.faces.splice(v,1);for(f=0,h=this.faceVertexUvs.length;f<h;f++){this.faceVertexUvs[f].splice(v,1)}}var y=this.vertices.length-t.length;this.vertices=t;return y},toJSON:function(){var e={metadata:{version:4,type:"BufferGeometry",generator:"BufferGeometryExporter"}
110,uuid:this.uuid,type:this.type};if(this.name!=="")e.name=this.name;if(this.parameters!==undefined){var t=this.parameters;for(var r in t){if(t[r]!==undefined)e[r]=t[r]}return e}var n=[];for(var i=0;i<this.vertices.length;i++){var a=this.vertices[i];n.push(a.x,a.y,a.z)}var o=[];var s=[];var u={};var l=[];var c={};var f=[];var h={};for(var i=0;i<this.faces.length;i++){var d=this.faces[i];var p=false;var m=false;var v=this.faceVertexUvs[0][i]!==undefined;var y=d.normal.length()>0;var g=d.vertexNormals.length>0;var b=d.color.r!==1||d.color.g!==1||d.color.b!==1;var x=d.vertexColors.length>0;var _=0;_=S(_,0,0);_=S(_,1,p);_=S(_,2,m);_=S(_,3,v);_=S(_,4,y);_=S(_,5,g);_=S(_,6,b);_=S(_,7,x);o.push(_);o.push(d.a,d.b,d.c);if(v){var w=this.faceVertexUvs[0][i];o.push(A(w[0]),A(w[1]),A(w[2]))}if(y){o.push(T(d.normal))}if(g){var C=d.vertexNormals;o.push(T(C[0]),T(C[1]),T(C[2]))}if(b){o.push(M(d.color))}if(x){var E=d.vertexColors;o.push(M(E[0]),M(E[1]),M(E[2]))}}function S(e,t,r){return r?e|1<<t:e&~(1<<t)}function T(e){var t=e.x.toString()+e.y.toString()+e.z.toString();if(u[t]!==undefined){return u[t]}u[t]=s.length/3;s.push(e.x,e.y,e.z);return u[t]}function M(e){var t=e.r.toString()+e.g.toString()+e.b.toString();if(c[t]!==undefined){return c[t]}c[t]=l.length;l.push(e.getHex());return c[t]}function A(e){var t=e.x.toString()+e.y.toString();if(h[t]!==undefined){return h[t]}h[t]=f.length/2;f.push(e.x,e.y);return h[t]}e.data={};e.data.vertices=n;e.data.normals=s;if(l.length>0)e.data.colors=l;if(f.length>0)e.data.uvs=[f];e.data.faces=o;return e},clone:function(){var t=new e.Geometry;var r=this.vertices;for(var n=0,i=r.length;n<i;n++){t.vertices.push(r[n].clone())}var a=this.faces;for(var n=0,i=a.length;n<i;n++){t.faces.push(a[n].clone())}for(var n=0,i=this.faceVertexUvs.length;n<i;n++){var o=this.faceVertexUvs[n];if(t.faceVertexUvs[n]===undefined){t.faceVertexUvs[n]=[]}for(var s=0,u=o.length;s<u;s++){var l=o[s],c=[];for(var f=0,h=l.length;f<h;f++){var d=l[f];c.push(d.clone())}t.faceVertexUvs[n].push(c)}}return t},dispose:function(){this.dispatchEvent({type:"dispose"})}};e.EventDispatcher.prototype.apply(e.Geometry.prototype);e.GeometryIdCount=0;e.Camera=function(){e.Object3D.call(this);this.type="Camera";this.matrixWorldInverse=new e.Matrix4;
110this.projectionMatrix=new e.Matrix4};e.Camera.prototype=Object.create(e.Object3D.prototype);e.Camera.prototype.constructor=e.Camera;e.Camera.prototype.getWorldDirection=function(){var t=new e.Quaternion;return function(r){var n=r||new e.Vector3;this.getWorldQuaternion(t);return n.set(0,0,-1).applyQuaternion(t)}}();e.Camera.prototype.lookAt=function(){var t=new e.Matrix4;return function(e){t.lookAt(this.position,e,this.up);this.quaternion.setFromRotationMatrix(t)}}();e.Camera.prototype.clone=function(t){if(t===undefined)t=new e.Camera;e.Object3D.prototype.clone.call(this,t);t.matrixWorldInverse.copy(this.matrixWorldInverse);t.projectionMatrix.copy(this.projectionMatrix);return t};e.CubeCamera=function(t,r,n){e.Object3D.call(this);this.type="CubeCamera";var i=90,a=1;var o=new e.PerspectiveCamera(i,a,t,r);o.up.set(0,-1,0);o.lookAt(new e.Vector3(1,0,0));this.add(o);var s=new e.PerspectiveCamera(i,a,t,r);s.up.set(0,-1,0);s.lookAt(new e.Vector3(-1,0,0));this.add(s);var u=new e.PerspectiveCamera(i,a,t,r);u.up.set(0,0,1);u.lookAt(new e.Vector3(0,1,0));this.add(u);var l=new e.PerspectiveCamera(i,a,t,r);l.up.set(0,0,-1);l.lookAt(new e.Vector3(0,-1,0));this.add(l);var c=new e.PerspectiveCamera(i,a,t,r);c.up.set(0,-1,0);c.lookAt(new e.Vector3(0,0,1));this.add(c);var f=new e.PerspectiveCamera(i,a,t,r);f.up.set(0,-1,0);f.lookAt(new e.Vector3(0,0,-1));this.add(f);this.renderTarget=new e.WebGLRenderTargetCube(n,n,{format:e.RGBFormat,magFilter:e.LinearFilter,minFilter:e.LinearFilter});this.updateCubeMap=function(e,t){var r=this.renderTarget;var n=r.generateMipmaps;r.generateMipmaps=false;r.activeCubeFace=0;e.render(t,o,r);r.activeCubeFace=1;e.render(t,s,r);r.activeCubeFace=2;e.render(t,u,r);r.activeCubeFace=3;e.render(t,l,r);r.activeCubeFace=4;e.render(t,c,r);r.generateMipmaps=n;r.activeCubeFace=5;e.render(t,f,r)}};e.CubeCamera.prototype=Object.create(e.Object3D.prototype);e.CubeCamera.prototype.constructor=e.CubeCamera;e.OrthographicCamera=function(t,r,n,i,a,o){e.Camera.call(this);this.type="OrthographicCamera";this.zoom=1;this.left=t;this.right=r;this.top=n;this.bottom=i;this.near=a!==undefined?a:.1;this.far=o!==undefined?o:2e3;this.updateProjectionMatrix()};e.OrthographicCamera.prototype=Object.create(e.Camera.prototype);e.OrthographicCamera.prototype.constructor=e.OrthographicCamera;e.OrthographicCamera.prototype.updateProjectionMatrix=function(){var e=(this.right-this.left)/(2*this.zoom);var t=(this.top-this.bottom)/(2*this.zoom);var r=(this.right+this.left)/2;var n=(this.top+this.bottom)/2;this.projectionMatrix.makeOrthographic(r-e,r+e,n+t,n-t,this.near,this.far)};e.OrthographicCamera.prototype.clone=function(){var t=new e.OrthographicCamera;e.Camera.prototype.clone.call(this,t);t.zoom=this.zoom;t.left=this.left;t.right=this.right;t.top=this.top;t.bottom=this.bottom;t.near=this.near;t.far=this.far;t.projectionMatrix.copy(this.projectionMatrix);return t};e.PerspectiveCamera=function(t,r,n,i){e.Camera.call(this);this.type="PerspectiveCamera";this.zoom=1;this.fov=t!==undefined?t:50;this.aspect=r!==undefined?r:1;this.near=n!==undefined?n:.1;this.far=i!==undefined?i:2e3;this.updateProjectionMatrix()};e.PerspectiveCamera.prototype=Object.create(e.Camera.prototype);e.PerspectiveCamera.prototype.constructor=e.PerspectiveCamera;e.PerspectiveCamera.prototype.setLens=function(t,r){if(r===undefined)r=24;this.fov=2*e.Math.radToDeg(Math.atan(r/(t*2)));this.updateProjectionMatrix()};e.PerspectiveCamera.prototype.setViewOffset=function(e,t,r,n,i,a){this.fullWidth=e;this.fullHeight=t;this.x=r;this.y=n;this.width=i;this.height=a;this.updateProjectionMatrix()};e.PerspectiveCamera.prototype.updateProjectionMatrix=function(){var t=e.Math.radToDeg(2*Math.atan(Math.tan(e.Math.degToRad(this.fov)*.5)/this.zoom));if(this.fullWidth){var r=this.fullWidth/this.fullHeight;var n=Math.tan(e.Math.degToRad(t*.5))*this.near;var i=-n;var a=r*i;var o=r*n;var s=Math.abs(o-a);var u=Math.abs(n-i);this.projectionMatrix.makeFrustum(a+this.x*s/this.fullWidth,a+(this.x+this.width)*s/this.fullWidth,n-(this.y+this.height)*u/this.fullHeight,n-this.y*u/this.fullHeight,this.near,this.far)}else{this.projectionMatrix.makePerspective(t,this.aspect,this.near,this.far)}};e.PerspectiveCamera.prototype.clone=function(){var t=new e.PerspectiveCamera;e.Camera.prototype.clone.call(this,t);t.zoom=this.zoom;t.fov=this.fov;t.aspect=this.aspect;t.near=this.near;t.far=this.far;t.projectionMatrix.copy(this.projectionMatrix);return t};e.Light=function(t){e.Object3D.call(this);this.type="Light";this.color=new e.Color(t)};e.Light.prototype=Object.create(e.Object3D.prototype);e.Light.prototype.constructor=e.Light;e.Light.prototype.clone=function(t){if(t===undefined)t=new e.Light;e.Object3D.prototype.clone.call(this,t);t.color.copy(this.color);return t};e.AmbientLight=function(t){e.Light.call(this,t);this.type="AmbientLight"};e.AmbientLight.prototype=Object.create(e.Light.prototype);e.AmbientLight.prototype.constructor=e.AmbientLight;e.AmbientLight.prototype.clone=function(){var t=new e.AmbientLight;e.Light.prototype.clone.call(this,t);return t};e.AreaLight=function(t,r){e.Light.call(this,t);this.type="AreaLight";this.normal=new e.Vector3(0,-1,0);this.right=new e.Vector3(1,0,0);this.intensity=r!==undefined?r:1;this.width=1;this.height=1;this.constantAttenuation=1.5;this.linearAttenuation=.5;this.quadraticAttenuation=.1};e.AreaLight.prototype=Object.create(e.Light.prototype);e.AreaLight.prototype.constructor=e.AreaLight;e.DirectionalLight=function(t,r){e.Light.call(this,t);this.type="DirectionalLight";this.position.set(0,1,0);this.target=new e.Object3D;this.intensity=r!==undefined?r:1;this.castShadow=false;this.onlyShadow=false;this.shadowCameraNear=50;this.shadowCameraFar=5e3;this.shadowCameraLeft=-500;this.shadowCameraRight=500;this.shadowCameraTop=500;this.shadowCameraBottom=-500;this.shadowCameraVisible=false;this.shadowBias=0;this.shadowDarkness=.5;this.shadowMapWidth=512;this.shadowMapHeight=512;this.shadowCascade=false;this.shadowCascadeOffset=new e.Vector3(0,0,-1e3);this.shadowCascadeCount=2;this.shadowCascadeBias=[0,0,0];this.shadowCascadeWidth=[512,512,512];this.shadowCascadeHeight=[512,512,512];this.shadowCascadeNearZ=[-1,.99,.998];this.shadowCascadeFarZ=[.99,.998,1];this.shadowCascadeArray=[];this.shadowMap=null;this.shadowMapSize=null;this.shadowCamera=null;this.shadowMatrix=null};e.DirectionalLight.prototype=Object.create(e.Light.prototype);e.DirectionalLight.prototype.constructor=e.DirectionalLight;e.DirectionalLight.prototype.clone=function(){var t=new e.DirectionalLight;e.Light.prototype.clone.call(this,t);t.target=this.target.clone();t.intensity=this.intensity;t.castShadow=this.castShadow;t.onlyShadow=this.onlyShadow;t.shadowCameraNear=this.shadowCameraNear;t.shadowCameraFar=this.shadowCameraFar;t.shadowCameraLeft=this.shadowCameraLeft;t.shadowCameraRight=this.shadowCameraRight;t.shadowCameraTop=this.shadowCameraTop;t.shadowCameraBottom=this.shadowCameraBottom;t.shadowCameraVisible=this.shadowCameraVisible;t.shadowBias=this.shadowBias;t.shadowDarkness=this.shadowDarkness;t.shadowMapWidth=this.shadowMapWidth;t.shadowMapHeight=this.shadowMapHeight;t.shadowCascade=this.shadowCascade;t.shadowCascadeOffset.copy(this.shadowCascadeOffset);t.shadowCascadeCount=this.shadowCascadeCount;t.shadowCascadeBias=this.shadowCascadeBias.slice(0);t.shadowCascadeWidth=this.shadowCascadeWidth.slice(0);t.shadowCascadeHeight=this.shadowCascadeHeight.slice(0);t.shadowCascadeNearZ=this.shadowCascadeNearZ.slice(0);t.shadowCascadeFarZ=this.shadowCascadeFarZ.slice(0);return t};e.HemisphereLight=function(t,r,n){e.Light.call(this,t);this.type="HemisphereLight";this.position.set(0,100,0);this.groundColor=new e.Color(r);this.intensity=n!==undefined?n:1};e.HemisphereLight.prototype=Object.create(e.Light.prototype);e.HemisphereLight.prototype.constructor=e.HemisphereLight;e.HemisphereLight.prototype.clone=function(){var t=new e.HemisphereLight;e.Light.prototype.clone.call(this,t);t.groundColor.copy(this.groundColor);t.intensity=this.intensity;return t};e.PointLight=function(t,r,n,i){e.Light.call(this,t);this.type="PointLight";this.intensity=r!==undefined?r:1;
110this.distance=n!==undefined?n:0;this.decay=i!==undefined?i:1};e.PointLight.prototype=Object.create(e.Light.prototype);e.PointLight.prototype.constructor=e.PointLight;e.PointLight.prototype.clone=function(){var t=new e.PointLight;e.Light.prototype.clone.call(this,t);t.intensity=this.intensity;t.distance=this.distance;t.decay=this.decay;return t};e.SpotLight=function(t,r,n,i,a,o){e.Light.call(this,t);this.type="SpotLight";this.position.set(0,1,0);this.target=new e.Object3D;this.intensity=r!==undefined?r:1;this.distance=n!==undefined?n:0;this.angle=i!==undefined?i:Math.PI/3;this.exponent=a!==undefined?a:10;this.decay=o!==undefined?o:1;this.castShadow=false;this.onlyShadow=false;this.shadowCameraNear=50;this.shadowCameraFar=5e3;this.shadowCameraFov=50;this.shadowCameraVisible=false;this.shadowBias=0;this.shadowDarkness=.5;this.shadowMapWidth=512;this.shadowMapHeight=512;this.shadowMap=null;this.shadowMapSize=null;this.shadowCamera=null;this.shadowMatrix=null};e.SpotLight.prototype=Object.create(e.Light.prototype);e.SpotLight.prototype.constructor=e.SpotLight;e.SpotLight.prototype.clone=function(){var t=new e.SpotLight;e.Light.prototype.clone.call(this,t);t.target=this.target.clone();t.intensity=this.intensity;t.distance=this.distance;t.angle=this.angle;t.exponent=this.exponent;t.decay=this.decay;t.castShadow=this.castShadow;t.onlyShadow=this.onlyShadow;t.shadowCameraNear=this.shadowCameraNear;t.shadowCameraFar=this.shadowCameraFar;t.shadowCameraFov=this.shadowCameraFov;t.shadowCameraVisible=this.shadowCameraVisible;t.shadowBias=this.shadowBias;t.shadowDarkness=this.shadowDarkness;t.shadowMapWidth=this.shadowMapWidth;t.shadowMapHeight=this.shadowMapHeight;return t};e.Cache={files:{},add:function(e,t){this.files[e]=t},get:function(e){return this.files[e]},remove:function(e){delete this.files[e]},clear:function(){this.files={}}};e.Loader=function(t){this.showStatus=t;this.statusDomElement=t?e.Loader.prototype.addStatusElement():null;this.imageLoader=new e.ImageLoader;this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){}};e.Loader.prototype={constructor:e.Loader,crossOrigin:undefined,addStatusElement:function(){var e=document.createElement("div");e.style.position="absolute";e.style.right="0px";e.style.top="0px";e.style.fontSize="0.8em";e.style.textAlign="left";e.style.background="rgba(0,0,0,0.25)";e.style.color="#fff";e.style.width="120px";e.style.padding="0.5em 0.5em 0.5em 0.5em";e.style.zIndex=1e3;e.innerHTML="Loading ...";return e},updateProgress:function(e){var t="Loaded ";if(e.total){t+=(100*e.loaded/e.total).toFixed(0)+"%"}else{t+=(e.loaded/1024).toFixed(2)+" KB"}this.statusDomElement.innerHTML=t},extractUrlBase:function(e){var t=e.split("/");if(t.length===1)return"./";t.pop();return t.join("/")+"/"},initMaterials:function(e,t){var r=[];for(var n=0;n<e.length;++n){r[n]=this.createMaterial(e[n],t)}return r},needsTangents:function(t){for(var r=0,n=t.length;r<n;r++){var i=t[r];if(i instanceof e.ShaderMaterial)return true}return false},createMaterial:function(t,r){var n=this;function i(e){var t=Math.log(e)/Math.LN2;return Math.pow(2,Math.round(t))}function a(t,a,o,s,u,l,c){var f=r+o;var h;var d=e.Loader.Handlers.get(f);if(d!==null){h=d.load(f)}else{h=new e.Texture;d=n.imageLoader;d.crossOrigin=n.crossOrigin;d.load(f,function(t){if(e.Math.isPowerOfTwo(t.width)===false||e.Math.isPowerOfTwo(t.height)===false){var r=i(t.width);var n=i(t.height);var a=document.createElement("canvas");a.width=r;a.height=n;var o=a.getContext("2d");o.drawImage(t,0,0,r,n);h.image=a}else{h.image=t}h.needsUpdate=true})}h.sourceFile=o;if(s){h.repeat.set(s[0],s[1]);if(s[0]!==1)h.wrapS=e.RepeatWrapping;if(s[1]!==1)h.wrapT=e.RepeatWrapping}if(u){h.offset.set(u[0],u[1])}if(l){var p={repeat:e.RepeatWrapping,mirror:e.MirroredRepeatWrapping};if(p[l[0]]!==undefined)h.wrapS=p[l[0]];if(p[l[1]]!==undefined)h.wrapT=p[l[1]]}if(c){h.anisotropy=c}t[a]=h}function o(e){return(e[0]*255<<16)+(e[1]*255<<8)+e[2]*255}var s="MeshLambertMaterial";var u={color:15658734,opacity:1,map:null,lightMap:null,normalMap:null,bumpMap:null,wireframe:false};if(t.shading){var l=t.shading.toLowerCase();if(l==="phong")s="MeshPhongMaterial";else if(l==="basic")s="MeshBasicMaterial"}if(t.blending!==undefined&&e[t.blending]!==undefined){u.blending=e[t.blending]}if(t.transparent!==undefined){u.transparent=t.transparent}if(t.opacity!==undefined&&t.opacity<1){u.transparent=true}if(t.depthTest!==undefined){u.depthTest=t.depthTest}if(t.depthWrite!==undefined){u.depthWrite=t.depthWrite}if(t.visible!==undefined){u.visible=t.visible}if(t.flipSided!==undefined){u.side=e.BackSide}if(t.doubleSided!==undefined){u.side=e.DoubleSide}
110if(t.wireframe!==undefined){u.wireframe=t.wireframe}if(t.vertexColors!==undefined){if(t.vertexColors==="face"){u.vertexColors=e.FaceColors}else if(t.vertexColors){u.vertexColors=e.VertexColors}}if(t.colorDiffuse){u.color=o(t.colorDiffuse)}else if(t.DbgColor){u.color=t.DbgColor}if(t.colorSpecular){u.specular=o(t.colorSpecular)}if(t.colorEmissive){u.emissive=o(t.colorEmissive)}if(t.transparency!==undefined){console.warn("THREE.Loader: transparency has been renamed to opacity");t.opacity=t.transparency}if(t.opacity!==undefined){u.opacity=t.opacity}if(t.specularCoef){u.shininess=t.specularCoef}if(t.mapDiffuse&&r){a(u,"map",t.mapDiffuse,t.mapDiffuseRepeat,t.mapDiffuseOffset,t.mapDiffuseWrap,t.mapDiffuseAnisotropy)}if(t.mapLight&&r){a(u,"lightMap",t.mapLight,t.mapLightRepeat,t.mapLightOffset,t.mapLightWrap,t.mapLightAnisotropy)}if(t.mapBump&&r){a(u,"bumpMap",t.mapBump,t.mapBumpRepeat,t.mapBumpOffset,t.mapBumpWrap,t.mapBumpAnisotropy)}if(t.mapNormal&&r){a(u,"normalMap",t.mapNormal,t.mapNormalRepeat,t.mapNormalOffset,t.mapNormalWrap,t.mapNormalAnisotropy)}if(t.mapSpecular&&r){a(u,"specularMap",t.mapSpecular,t.mapSpecularRepeat,t.mapSpecularOffset,t.mapSpecularWrap,t.mapSpecularAnisotropy)}if(t.mapAlpha&&r){a(u,"alphaMap",t.mapAlpha,t.mapAlphaRepeat,t.mapAlphaOffset,t.mapAlphaWrap,t.mapAlphaAnisotropy)}if(t.mapBumpScale){u.bumpScale=t.mapBumpScale}if(t.mapNormalFactor){u.normalScale=new e.Vector2(t.mapNormalFactor,t.mapNormalFactor)}var c=new e[s](u);if(t.DbgName!==undefined)c.name=t.DbgName;return c}};e.Loader.Handlers={handlers:[],add:function(e,t){this.handlers.push(e,t)},get:function(e){for(var t=0,r=this.handlers.length;t<r;t+=2){var n=this.handlers[t];var i=this.handlers[t+1];if(n.test(e)){return i}}return null}};e.XHRLoader=function(t){this.manager=t!==undefined?t:e.DefaultLoadingManager};e.XHRLoader.prototype={constructor:e.XHRLoader,load:function(t,r,n,i){var a=this;var o=e.Cache.get(t);if(o!==undefined){if(r)r(o);return}var s=new XMLHttpRequest;s.open("GET",t,true);s.addEventListener("load",function(n){e.Cache.add(t,this.response);if(r)r(this.response);a.manager.itemEnd(t)},false);if(n!==undefined){s.addEventListener("progress",function(e){n(e)},false)}if(i!==undefined){s.addEventListener("error",function(e){i(e)},false)}if(this.crossOrigin!==undefined)s.crossOrigin=this.crossOrigin;if(this.responseType!==undefined)s.responseType=this.responseType;s.send(null);a.manager.itemStart(t)},setResponseType:function(e){this.responseType=e},setCrossOrigin:function(e){this.crossOrigin=e}};e.ImageLoader=function(t){this.manager=t!==undefined?t:e.DefaultLoadingManager};e.ImageLoader.prototype={constructor:e.ImageLoader,load:function(t,r,n,i){var a=this;var o=e.Cache.get(t);if(o!==undefined){r(o);return}var s=document.createElement("img");s.addEventListener("load",function(n){e.Cache.add(t,this);if(r)r(this);a.manager.itemEnd(t)},false);if(n!==undefined){s.addEventListener("progress",function(e){n(e)},false)}if(i!==undefined){s.addEventListener("error",function(e){i(e)},false)}if(this.crossOrigin!==undefined)s.crossOrigin=this.crossOrigin;s.src=t;a.manager.itemStart(t);return s},setCrossOrigin:function(e){this.crossOrigin=e}};e.JSONLoader=function(t){e.Loader.call(this,t);this.withCredentials=false};e.JSONLoader.prototype=Object.create(e.Loader.prototype);e.JSONLoader.prototype.constructor=e.JSONLoader;e.JSONLoader.prototype.load=function(e,t,r){r=r&&typeof r==="string"?r:this.extractUrlBase(e);this.onLoadStart();this.loadAjaxJSON(this,e,t,r)};e.JSONLoader.prototype.loadAjaxJSON=function(t,r,n,i,a){var o=new XMLHttpRequest;var s=0;o.onreadystatechange=function(){if(o.readyState===o.DONE){if(o.status===200||o.status===0){if(o.responseText){var u=JSON.parse(o.responseText);var l=u.metadata;if(l!==undefined){if(l.type==="object"){e.error("THREE.JSONLoader: "+r+" should be loaded with THREE.ObjectLoader instead.");return}if(l.type==="scene"){e.error("THREE.JSONLoader: "+r+" seems to be a Scene. Use THREE.SceneLoader instead.");return}}var c=t.parse(u,i);n(c.geometry,c.materials)}else{e.error("THREE.JSONLoader: "+r+" seems to be unreachable or the file is empty.")}t.onLoadComplete()}else{e.error("THREE.JSONLoader: Couldn't load "+r+" ("+o.status+")")}}else if(o.readyState===o.LOADING){if(a){if(s===0){s=o.getResponseHeader("Content-Length")}a({total:s,loaded:o.responseText.length})}}
110else if(o.readyState===o.HEADERS_RECEIVED){if(a!==undefined){s=o.getResponseHeader("Content-Length")}}};o.open("GET",r,true);o.withCredentials=this.withCredentials;o.send(null)};e.JSONLoader.prototype.parse=function(t,r){var n=new e.Geometry,i=t.scale!==undefined?1/t.scale:1;a(i);o();s(i);n.computeFaceNormals();n.computeBoundingSphere();function a(r){function i(e,t){return e&1<<t}var a,o,s,u,l,c,f,h,d,p,m,v,y,g,b,x,_,w,C,E,S,T,M,A,P,R,k,I=t.faces,D=t.vertices,B=t.normals,L=t.colors,F=0;if(t.uvs!==undefined){for(a=0;a<t.uvs.length;a++){if(t.uvs[a].length)F++}for(a=0;a<F;a++){ 111n.faceVertexUvs[a]=[]}}u=0;l=D.length;while(u<l){w=new e.Vector3;w.x=D[u++]*r;w.y=D[u++]*r;w.z=D[u++]*r;n.vertices.push(w)}u=0;l=I.length;while(u<l){p=I[u++];m=i(p,0);v=i(p,1);y=i(p,3);g=i(p,4);b=i(p,5);x=i(p,6);_=i(p,7);if(m){E=new e.Face3;E.a=I[u];E.b=I[u+1];E.c=I[u+3];S=new e.Face3;S.a=I[u+1];S.b=I[u+2];S.c=I[u+3];u+=4;if(v){d=I[u++];E.materialIndex=d;S.materialIndex=d}s=n.faces.length;if(y){for(a=0;a<F;a++){A=t.uvs[a];n.faceVertexUvs[a][s]=[];n.faceVertexUvs[a][s+1]=[];for(o=0;o<4;o++){h=I[u++];R=A[h*2];k=A[h*2+1];P=new e.Vector2(R,k);if(o!==2)n.faceVertexUvs[a][s].push(P);if(o!==0)n.faceVertexUvs[a][s+1].push(P)}}}if(g){f=I[u++]*3;E.normal.set(B[f++],B[f++],B[f]);S.normal.copy(E.normal)}if(b){for(a=0;a<4;a++){f=I[u++]*3;M=new e.Vector3(B[f++],B[f++],B[f]);if(a!==2)E.vertexNormals.push(M);if(a!==0)S.vertexNormals.push(M)}}if(x){c=I[u++];T=L[c];E.color.setHex(T);S.color.setHex(T)}if(_){for(a=0;a<4;a++){c=I[u++];T=L[c];if(a!==2)E.vertexColors.push(new e.Color(T));if(a!==0)S.vertexColors.push(new e.Color(T))}}n.faces.push(E);n.faces.push(S)}else{C=new e.Face3;C.a=I[u++];C.b=I[u++];C.c=I[u++];if(v){d=I[u++];C.materialIndex=d}s=n.faces.length;if(y){for(a=0;a<F;a++){A=t.uvs[a];n.faceVertexUvs[a][s]=[];for(o=0;o<3;o++){h=I[u++];R=A[h*2];k=A[h*2+1];P=new e.Vector2(R,k);n.faceVertexUvs[a][s].push(P)}}}if(g){f=I[u++]*3;C.normal.set(B[f++],B[f++],B[f])}if(b){for(a=0;a<3;a++){f=I[u++]*3;M=new e.Vector3(B[f++],B[f++],B[f]);C.vertexNormals.push(M)}}if(x){c=I[u++];C.color.setHex(L[c])}if(_){for(a=0;a<3;a++){c=I[u++];C.vertexColors.push(new e.Color(L[c]))}}n.faces.push(C)}}}function o(){var r=t.influencesPerVertex!==undefined?t.influencesPerVertex:2;if(t.skinWeights){for(var i=0,a=t.skinWeights.length;i<a;i+=r){var o=t.skinWeights[i];var s=r>1?t.skinWeights[i+1]:0;var u=r>2?t.skinWeights[i+2]:0;var l=r>3?t.skinWeights[i+3]:0;n.skinWeights.push(new e.Vector4(o,s,u,l))}}if(t.skinIndices){for(var i=0,a=t.skinIndices.length;i<a;i+=r){var c=t.skinIndices[i];var f=r>1?t.skinIndices[i+1]:0;var h=r>2?t.skinIndices[i+2]:0;var d=r>3?t.skinIndices[i+3]:0;n.skinIndices.push(new e.Vector4(c,f,h,d))}}n.bones=t.bones;if(n.bones&&n.bones.length>0&&(n.skinWeights.length!==n.skinIndices.length||n.skinIndices.length!==n.vertices.length)){e.warn("THREE.JSONLoader: When skinning, number of vertices ("+n.vertices.length+"), skinIndices ("+n.skinIndices.length+"), and skinWeights ("+n.skinWeights.length+") should match.")}n.animation=t.animation;n.animations=t.animations}function s(r){if(t.morphTargets!==undefined){var i,a,o,s,u,l;for(i=0,a=t.morphTargets.length;i<a;i++){n.morphTargets[i]={};n.morphTargets[i].name=t.morphTargets[i].name;n.morphTargets[i].vertices=[];u=n.morphTargets[i].vertices;l=t.morphTargets[i].vertices;for(o=0,s=l.length;o<s;o+=3){var c=new e.Vector3;c.x=l[o]*r;c.y=l[o+1]*r;c.z=l[o+2]*r;u.push(c)}}}if(t.morphColors!==undefined){var i,a,f,h,d,p,m;for(i=0,a=t.morphColors.length;i<a;i++){n.morphColors[i]={};n.morphColors[i].name=t.morphColors[i].name;n.morphColors[i].colors=[];d=n.morphColors[i].colors;p=t.morphColors[i].colors;for(f=0,h=p.length;f<h;f+=3){m=new e.Color(16755200);m.setRGB(p[f],p[f+1],p[f+2]);d.push(m)}}}}if(t.materials===undefined||t.materials.length===0){return{geometry:n}}else{var u=this.initMaterials(t.materials,r);if(this.needsTangents(u)){n.computeTangents()}return{geometry:n,materials:u}}};e.LoadingManager=function(e,t,r){var n=this;var i=0,a=0;this.onLoad=e;this.onProgress=t;this.onError=r;this.itemStart=function(e){a++};this.itemEnd=function(e){i++;if(n.onProgress!==undefined){n.onProgress(e,i,a)}if(i===a&&n.onLoad!==undefined){n.onLoad()}}};e.DefaultLoadingManager=new e.LoadingManager;e.BufferGeometryLoader=function(t){this.manager=t!==undefined?t:e.DefaultLoadingManager};e.BufferGeometryLoader.prototype={constructor:e.BufferGeometryLoader,load:function(t,r,n,i){var a=this;var o=new e.XHRLoader(a.manager);o.setCrossOrigin(this.crossOrigin);o.load(t,function(e){r(a.parse(JSON.parse(e)))},n,i)},setCrossOrigin:function(e){this.crossOrigin=e},parse:function(t){var r=new e.BufferGeometry;var n=t.data.attributes;for(var i in n){var a=n[i];var o=new self[a.type](a.array);r.addAttribute(i,new e.BufferAttribute(o,a.itemSize))}var s=t.data.offsets;
111if(s!==undefined){r.offsets=JSON.parse(JSON.stringify(s))}var u=t.data.boundingSphere;if(u!==undefined){var l=new e.Vector3;if(u.center!==undefined){l.fromArray(u.center)}r.boundingSphere=new e.Sphere(l,u.radius)}return r}};e.MaterialLoader=function(t){this.manager=t!==undefined?t:e.DefaultLoadingManager};e.MaterialLoader.prototype={constructor:e.MaterialLoader,load:function(t,r,n,i){var a=this;var o=new e.XHRLoader(a.manager);o.setCrossOrigin(this.crossOrigin);o.load(t,function(e){r(a.parse(JSON.parse(e)))},n,i)},setCrossOrigin:function(e){this.crossOrigin=e},parse:function(t){var r=new e[t.type];if(t.color!==undefined)r.color.setHex(t.color);if(t.emissive!==undefined)r.emissive.setHex(t.emissive);if(t.specular!==undefined)r.specular.setHex(t.specular);if(t.shininess!==undefined)r.shininess=t.shininess;if(t.uniforms!==undefined)r.uniforms=t.uniforms;if(t.vertexShader!==undefined)r.vertexShader=t.vertexShader;if(t.fragmentShader!==undefined)r.fragmentShader=t.fragmentShader;if(t.vertexColors!==undefined)r.vertexColors=t.vertexColors;if(t.shading!==undefined)r.shading=t.shading;if(t.blending!==undefined)r.blending=t.blending;if(t.side!==undefined)r.side=t.side;if(t.opacity!==undefined)r.opacity=t.opacity;if(t.transparent!==undefined)r.transparent=t.transparent;if(t.wireframe!==undefined)r.wireframe=t.wireframe;if(t.size!==undefined)r.size=t.size;if(t.sizeAttenuation!==undefined)r.sizeAttenuation=t.sizeAttenuation;if(t.materials!==undefined){for(var n=0,i=t.materials.length;n<i;n++){r.materials.push(this.parse(t.materials[n]))}}return r}};e.ObjectLoader=function(t){this.manager=t!==undefined?t:e.DefaultLoadingManager;this.texturePath=""};e.ObjectLoader.prototype={constructor:e.ObjectLoader,load:function(t,r,n,i){if(this.texturePath===""){this.texturePath=t.substring(0,t.lastIndexOf("/")+1)}var a=this;var o=new e.XHRLoader(a.manager);o.setCrossOrigin(this.crossOrigin);o.load(t,function(e){a.parse(JSON.parse(e),r)},n,i)},setTexturePath:function(e){this.texturePath=e},setCrossOrigin:function(e){this.crossOrigin=e},parse:function(e,t){var r=this.parseGeometries(e.geometries);var n=this.parseImages(e.images,function(){if(t!==undefined)t(o)});var i=this.parseTextures(e.textures,n);var a=this.parseMaterials(e.materials,i);var o=this.parseObject(e.object,r,a);if(e.images===undefined||e.images.length===0){if(t!==undefined)t(o)}return o},parseGeometries:function(t){var r={};if(t!==undefined){var n=new e.JSONLoader;var i=new e.BufferGeometryLoader;for(var a=0,o=t.length;a<o;a++){var s;var u=t[a];switch(u.type){case"PlaneGeometry":case"PlaneBufferGeometry":s=new e[u.type](u.width,u.height,u.widthSegments,u.heightSegments);break;case"BoxGeometry":case"CubeGeometry":s=new e.BoxGeometry(u.width,u.height,u.depth,u.widthSegments,u.heightSegments,u.depthSegments);break;case"CircleGeometry":s=new e.CircleGeometry(u.radius,u.segments);break;case"CylinderGeometry":s=new e.CylinderGeometry(u.radiusTop,u.radiusBottom,u.height,u.radialSegments,u.heightSegments,u.openEnded);break;case"SphereGeometry":s=new e.SphereGeometry(u.radius,u.widthSegments,u.heightSegments,u.phiStart,u.phiLength,u.thetaStart,u.thetaLength);break;case"IcosahedronGeometry":s=new e.IcosahedronGeometry(u.radius,u.detail);break;case"TorusGeometry":s=new e.TorusGeometry(u.radius,u.tube,u.radialSegments,u.tubularSegments,u.arc);break;case"TorusKnotGeometry":s=new e.TorusKnotGeometry(u.radius,u.tube,u.radialSegments,u.tubularSegments,u.p,u.q,u.heightScale);break;case"BufferGeometry":s=i.parse(u);break;case"Geometry":s=n.parse(u.data).geometry;break}s.uuid=u.uuid;if(u.name!==undefined)s.name=u.name;r[u.uuid]=s}}return r},parseMaterials:function(t,r){var n={};if(t!==undefined){var i=function(t){if(r[t]===undefined){e.warn("THREE.ObjectLoader: Undefined texture",t)}return r[t]};var a=new e.MaterialLoader;for(var o=0,s=t.length;o<s;o++){var u=t[o];var l=a.parse(u);l.uuid=u.uuid;if(u.name!==undefined)l.name=u.name;if(u.map!==undefined){l.map=i(u.map)}if(u.bumpMap!==undefined){l.bumpMap=i(u.bumpMap);if(u.bumpScale){l.bumpScale=new e.Vector2(u.bumpScale,u.bumpScale)}}if(u.alphaMap!==undefined){l.alphaMap=i(u.alphaMap)}if(u.envMap!==undefined){l.envMap=i(u.envMap)}if(u.normalMap!==undefined){l.normalMap=i(u.normalMap);if(u.normalScale){l.normalScale=new e.Vector2(u.normalScale,u.normalScale)}}if(u.lightMap!==undefined){l.lightMap=i(u.lightMap)}if(u.specularMap!==undefined){l.specularMap=i(u.specularMap)}n[u.uuid]=l}}return n},parseImages:function(t,r){var n=this;var i={};if(t!==undefined&&t.length>0){var a=new e.LoadingManager(r);var o=new e.ImageLoader(a);o.setCrossOrigin(this.crossOrigin);var s=function(e){n.manager.itemStart(e);return o.load(e,function(){n.manager.itemEnd(e)})};for(var u=0,l=t.length;u<l;u++){var c=t[u];var f=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(c.url)?c.url:n.texturePath+c.url;i[c.uuid]=s(f)}}return i},parseTextures:function(t,r){var n={};if(t!==undefined){for(var i=0,a=t.length;i<a;i++){var o=t[i];if(o.image===undefined){e.warn('THREE.ObjectLoader: No "image" speficied for',o.uuid)}if(r[o.image]===undefined){e.warn("THREE.ObjectLoader: Undefined image",o.image)}var s=new e.Texture(r[o.image]);s.needsUpdate=true;s.uuid=o.uuid;if(o.name!==undefined)s.name=o.name;if(o.repeat!==undefined)s.repeat=new e.Vector2(o.repeat[0],o.repeat[1]);if(o.minFilter!==undefined)s.minFilter=e[o.minFilter];if(o.magFilter!==undefined)s.magFilter=e[o.magFilter];if(o.anisotropy!==undefined)s.anisotropy=o.anisotropy;if(o.wrap instanceof Array){s.wrapS=e[o.wrap[0]];s.wrapT=e[o.wrap[1]]}n[o.uuid]=s}}return n}
111,parseObject:function(){var t=new e.Matrix4;return function(r,n,i){var a;var o=function(t){if(n[t]===undefined){e.warn("THREE.ObjectLoader: Undefined geometry",t)}return n[t]};var s=function(t){if(i[t]===undefined){e.warn("THREE.ObjectLoader: Undefined material",t)}return i[t]};switch(r.type){case"Scene":a=new e.Scene;break;case"PerspectiveCamera":a=new e.PerspectiveCamera(r.fov,r.aspect,r.near,r.far);break;case"OrthographicCamera":a=new e.OrthographicCamera(r.left,r.right,r.top,r.bottom,r.near,r.far);break;case"AmbientLight":a=new e.AmbientLight(r.color);break;case"DirectionalLight":a=new e.DirectionalLight(r.color,r.intensity);break;case"PointLight":a=new e.PointLight(r.color,r.intensity,r.distance,r.decay);break;case"SpotLight":a=new e.SpotLight(r.color,r.intensity,r.distance,r.angle,r.exponent,r.decay);break;case"HemisphereLight":a=new e.HemisphereLight(r.color,r.groundColor,r.intensity);break;case"Mesh":a=new e.Mesh(o(r.geometry),s(r.material));break;case"Line":a=new e.Line(o(r.geometry),s(r.material),r.mode);break;case"PointCloud":a=new e.PointCloud(o(r.geometry),s(r.material));break;case"Sprite":a=new e.Sprite(s(r.material));break;case"Group":a=new e.Group;break;default:a=new e.Object3D}a.uuid=r.uuid;if(r.name!==undefined)a.name=r.name;if(r.matrix!==undefined){t.fromArray(r.matrix);t.decompose(a.position,a.quaternion,a.scale)}else{if(r.position!==undefined)a.position.fromArray(r.position);if(r.rotation!==undefined)a.rotation.fromArray(r.rotation);if(r.scale!==undefined)a.scale.fromArray(r.scale)}if(r.visible!==undefined)a.visible=r.visible;if(r.userData!==undefined)a.userData=r.userData;if(r.children!==undefined){for(var u in r.children){a.add(this.parseObject(r.children[u],n,i))}}return a}}()};e.TextureLoader=function(t){this.manager=t!==undefined?t:e.DefaultLoadingManager};e.TextureLoader.prototype={constructor:e.TextureLoader,load:function(t,r,n,i){var a=this;var o=new e.ImageLoader(a.manager);o.setCrossOrigin(this.crossOrigin);o.load(t,function(t){var n=new e.Texture(t);n.needsUpdate=true;if(r!==undefined){r(n)}},n,i)},setCrossOrigin:function(e){this.crossOrigin=e}};e.DataTextureLoader=e.BinaryTextureLoader=function(){this._parser=null};e.BinaryTextureLoader.prototype={constructor:e.BinaryTextureLoader,load:function(t,r,n,i){var a=this;var o=new e.DataTexture;var s=new e.XHRLoader;s.setResponseType("arraybuffer");s.load(t,function(t){var n=a._parser(t);if(!n)return;if(undefined!==n.image){o.image=n.image}else if(undefined!==n.data){o.image.width=n.width;o.image.height=n.height;o.image.data=n.data}o.wrapS=undefined!==n.wrapS?n.wrapS:e.ClampToEdgeWrapping;o.wrapT=undefined!==n.wrapT?n.wrapT:e.ClampToEdgeWrapping;o.magFilter=undefined!==n.magFilter?n.magFilter:e.LinearFilter;o.minFilter=undefined!==n.minFilter?n.minFilter:e.LinearMipMapLinearFilter;o.anisotropy=undefined!==n.anisotropy?n.anisotropy:1;if(undefined!==n.format){o.format=n.format}if(undefined!==n.type){o.type=n.type}if(undefined!==n.mipmaps){o.mipmaps=n.mipmaps}if(1===n.mipmapCount){o.minFilter=e.LinearFilter}o.needsUpdate=true;if(r)r(o,n)},n,i);return o}};e.CompressedTextureLoader=function(){this._parser=null};e.CompressedTextureLoader.prototype={constructor:e.CompressedTextureLoader,load:function(t,r,n){var i=this;var a=[];var o=new e.CompressedTexture;o.image=a;var s=new e.XHRLoader;s.setResponseType("arraybuffer");if(t instanceof Array){var u=0;var l=function(n){s.load(t[n],function(t){var s=i._parser(t,true);a[n]={width:s.width,height:s.height,format:s.format,mipmaps:s.mipmaps};u+=1;if(u===6){if(s.mipmapCount==1)o.minFilter=e.LinearFilter;o.format=s.format;o.needsUpdate=true;if(r)r(o)}})};for(var c=0,f=t.length;c<f;++c){l(c)}}else{s.load(t,function(t){var n=i._parser(t,true);if(n.isCubemap){var s=n.mipmaps.length/n.mipmapCount;for(var u=0;u<s;u++){a[u]={mipmaps:[]};for(var l=0;l<n.mipmapCount;l++){a[u].mipmaps.push(n.mipmaps[u*n.mipmapCount+l]);a[u].format=n.format;a[u].width=n.width;a[u].height=n.height}}}else{o.image.width=n.width;o.image.height=n.height;o.mipmaps=n.mipmaps}if(n.mipmapCount===1){o.minFilter=e.LinearFilter}o.format=n.format;o.needsUpdate=true;if(r)r(o)})}return o}};e.Material=function(){Object.defineProperty(this,"id",{value:e.MaterialIdCount++});this.uuid=e.Math.generateUUID();this.name="";this.type="Material";this.side=e.FrontSide;this.opacity=1;this.transparent=false;this.blending=e.NormalBlending;this.blendSrc=e.SrcAlphaFactor;this.blendDst=e.OneMinusSrcAlphaFactor;this.blendEquation=e.AddEquation;this.blendSrcAlpha=null;this.blendDstAlpha=null;this.blendEquationAlpha=null;this.depthTest=true;this.depthWrite=true;this.colorWrite=true;this.polygonOffset=false;this.polygonOffsetFactor=0;this.polygonOffsetUnits=0;this.alphaTest=0;this.overdraw=0;this.visible=true;this._needsUpdate=true};e.Material.prototype={constructor:e.Material,get needsUpdate(){return this._needsUpdate},set needsUpdate(e){if(e===true)this.update();this._needsUpdate=e},setValues:function(t){if(t===undefined)return;for(var r in t){var n=t[r];
111if(n===undefined){e.warn("THREE.Material: '"+r+"' parameter is undefined.");continue}if(r in this){var i=this[r];if(i instanceof e.Color){i.set(n)}else if(i instanceof e.Vector3&&n instanceof e.Vector3){i.copy(n)}else if(r=="overdraw"){this[r]=Number(n)}else{this[r]=n}}}},toJSON:function(){var t={metadata:{version:4.2,type:"material",generator:"MaterialExporter"},uuid:this.uuid,type:this.type};if(this.name!=="")t.name=this.name;if(this instanceof e.MeshBasicMaterial){t.color=this.color.getHex();if(this.vertexColors!==e.NoColors)t.vertexColors=this.vertexColors;if(this.blending!==e.NormalBlending)t.blending=this.blending;if(this.side!==e.FrontSide)t.side=this.side}else if(this instanceof e.MeshLambertMaterial){t.color=this.color.getHex();t.emissive=this.emissive.getHex();if(this.vertexColors!==e.NoColors)t.vertexColors=this.vertexColors;if(this.shading!==e.SmoothShading)t.shading=this.shading;if(this.blending!==e.NormalBlending)t.blending=this.blending;if(this.side!==e.FrontSide)t.side=this.side}else if(this instanceof e.MeshPhongMaterial){t.color=this.color.getHex();t.emissive=this.emissive.getHex();t.specular=this.specular.getHex();t.shininess=this.shininess;if(this.vertexColors!==e.NoColors)t.vertexColors=this.vertexColors;if(this.shading!==e.SmoothShading)t.shading=this.shading;if(this.blending!==e.NormalBlending)t.blending=this.blending;if(this.side!==e.FrontSide)t.side=this.side}else if(this instanceof e.MeshNormalMaterial){if(this.blending!==e.NormalBlending)t.blending=this.blending;if(this.side!==e.FrontSide)t.side=this.side}else if(this instanceof e.MeshDepthMaterial){if(this.blending!==e.NormalBlending)t.blending=this.blending;if(this.side!==e.FrontSide)t.side=this.side}else if(this instanceof e.PointCloudMaterial){t.size=this.size;t.sizeAttenuation=this.sizeAttenuation;t.color=this.color.getHex();if(this.vertexColors!==e.NoColors)t.vertexColors=this.vertexColors;if(this.blending!==e.NormalBlending)t.blending=this.blending}else if(this instanceof e.ShaderMaterial){t.uniforms=this.uniforms;t.vertexShader=this.vertexShader;t.fragmentShader=this.fragmentShader}else if(this instanceof e.SpriteMaterial){t.color=this.color.getHex()}if(this.opacity<1)t.opacity=this.opacity;if(this.transparent!==false)t.transparent=this.transparent;if(this.wireframe!==false)t.wireframe=this.wireframe;return t},clone:function(t){if(t===undefined)t=new e.Material;t.name=this.name;t.side=this.side;t.opacity=this.opacity;t.transparent=this.transparent;t.blending=this.blending;t.blendSrc=this.blendSrc;t.blendDst=this.blendDst;t.blendEquation=this.blendEquation;t.blendSrcAlpha=this.blendSrcAlpha;t.blendDstAlpha=this.blendDstAlpha;t.blendEquationAlpha=this.blendEquationAlpha;t.depthTest=this.depthTest;t.depthWrite=this.depthWrite;t.polygonOffset=this.polygonOffset;t.polygonOffsetFactor=this.polygonOffsetFactor;t.polygonOffsetUnits=this.polygonOffsetUnits;t.alphaTest=this.alphaTest;t.overdraw=this.overdraw;t.visible=this.visible;return t},update:function(){this.dispatchEvent({type:"update"})},dispose:function(){this.dispatchEvent({type:"dispose"})}};e.EventDispatcher.prototype.apply(e.Material.prototype);e.MaterialIdCount=0;e.LineBasicMaterial=function(t){e.Material.call(this);this.type="LineBasicMaterial";this.color=new e.Color(16777215);this.linewidth=1;this.linecap="round";this.linejoin="round";this.vertexColors=e.NoColors;this.fog=true;this.setValues(t)};e.LineBasicMaterial.prototype=Object.create(e.Material.prototype);e.LineBasicMaterial.prototype.constructor=e.LineBasicMaterial;e.LineBasicMaterial.prototype.clone=function(){var t=new e.LineBasicMaterial;e.Material.prototype.clone.call(this,t);t.color.copy(this.color);t.linewidth=this.linewidth;t.linecap=this.linecap;t.linejoin=this.linejoin;t.vertexColors=this.vertexColors;t.fog=this.fog;return t};e.LineDashedMaterial=function(t){e.Material.call(this);this.type="LineDashedMaterial";this.color=new e.Color(16777215);this.linewidth=1;this.scale=1;this.dashSize=3;this.gapSize=1;this.vertexColors=false;this.fog=true;this.setValues(t)};e.LineDashedMaterial.prototype=Object.create(e.Material.prototype);e.LineDashedMaterial.prototype.constructor=e.LineDashedMaterial;e.LineDashedMaterial.prototype.clone=function(){var t=new e.LineDashedMaterial;e.Material.prototype.clone.call(this,t);t.color.copy(this.color);t.linewidth=this.linewidth;t.scale=this.scale;t.dashSize=this.dashSize;t.gapSize=this.gapSize;t.vertexColors=this.vertexColors;t.fog=this.fog;return t};e.MeshBasicMaterial=function(t){e.Material.call(this);this.type="MeshBasicMaterial";this.color=new e.Color(16777215);this.map=null;this.lightMap=null;this.specularMap=null;this.alphaMap=null;this.envMap=null;this.combine=e.MultiplyOperation;this.reflectivity=1;this.refractionRatio=.98;this.fog=true;this.shading=e.SmoothShading;this.wireframe=false;this.wireframeLinewidth=1;this.wireframeLinecap="round";this.wireframeLinejoin="round";this.vertexColors=e.NoColors;this.skinning=false;this.morphTargets=false;this.setValues(t)};e.MeshBasicMaterial.prototype=Object.create(e.Material.prototype);e.MeshBasicMaterial.prototype.constructor=e.MeshBasicMaterial;e.MeshBasicMaterial.prototype.clone=function(){var t=new e.MeshBasicMaterial;e.Material.prototype.clone.call(this,t);t.color.copy(this.color);t.map=this.map;t.lightMap=this.lightMap;t.specularMap=this.specularMap;t.alphaMap=this.alphaMap;t.envMap=this.envMap;t.combine=this.combine;t.reflectivity=this.reflectivity;t.refractionRatio=this.refractionRatio;t.fog=this.fog;t.shading=this.shading;t.wireframe=this.wireframe;t.wireframeLinewidth=this.wireframeLinewidth;t.wireframeLinecap=this.wireframeLinecap;t.wireframeLinejoin=this.wireframeLinejoin;t.vertexColors=this.vertexColors;t.skinning=this.skinning;t.morphTargets=this.morphTargets;return t};e.MeshLambertMaterial=function(t){e.Material.call(this);this.type="MeshLambertMaterial";this.color=new e.Color(16777215);this.emissive=new e.Color(0);this.wrapAround=false;this.wrapRGB=new e.Vector3(1,1,1);this.map=null;this.lightMap=null;this.specularMap=null;this.alphaMap=null;this.envMap=null;this.combine=e.MultiplyOperation;this.reflectivity=1;this.refractionRatio=.98;this.fog=true;this.shading=e.SmoothShading;this.wireframe=false;this.wireframeLinewidth=1;this.wireframeLinecap="round";this.wireframeLinejoin="round";this.vertexColors=e.NoColors;this.skinning=false;this.morphTargets=false;this.morphNormals=false;this.setValues(t)};e.MeshLambertMaterial.prototype=Object.create(e.Material.prototype);e.MeshLambertMaterial.prototype.constructor=e.MeshLambertMaterial;e.MeshLambertMaterial.prototype.clone=function(){var t=new e.MeshLambertMaterial;e.Material.prototype.clone.call(this,t);t.color.copy(this.color);t.emissive.copy(this.emissive);t.wrapAround=this.wrapAround;t.wrapRGB.copy(this.wrapRGB);t.map=this.map;t.lightMap=this.lightMap;t.specularMap=this.specularMap;t.alphaMap=this.alphaMap;t.envMap=this.envMap;t.combine=this.combine;t.reflectivity=this.reflectivity;t.refractionRatio=this.refractionRatio;t.fog=this.fog;t.shading=this.shading;t.wireframe=this.wireframe;t.wireframeLinewidth=this.wireframeLinewidth;t.wireframeLinecap=this.wireframeLinecap;t.wireframeLinejoin=this.wireframeLinejoin;t.vertexColors=this.vertexColors;t.skinning=this.skinning;t.morphTargets=this.morphTargets;t.morphNormals=this.morphNormals;return t};e.MeshPhongMaterial=function(t){e.Material.call(this);this.type="MeshPhongMaterial";this.color=new e.Color(16777215);this.emissive=new e.Color(0);this.specular=new e.Color(1118481);this.shininess=30;this.metal=false;this.wrapAround=false;this.wrapRGB=new e.Vector3(1,1,1);this.map=null;this.lightMap=null;this.bumpMap=null;this.bumpScale=1;this.normalMap=null;this.normalScale=new e.Vector2(1,1);this.specularMap=null;this.alphaMap=null;this.envMap=null;this.combine=e.MultiplyOperation;this.reflectivity=1;this.refractionRatio=.98;this.fog=true;this.shading=e.SmoothShading;this.wireframe=false;this.wireframeLinewidth=1;this.wireframeLinecap="round";this.wireframeLinejoin="round";this.vertexColors=e.NoColors;this.skinning=false;this.morphTargets=false;this.morphNormals=false;this.setValues(t)};e.MeshPhongMaterial.prototype=Object.create(e.Material.prototype);e.MeshPhongMaterial.prototype.constructor=e.MeshPhongMaterial;e.MeshPhongMaterial.prototype.clone=function(){var t=new e.MeshPhongMaterial;e.Material.prototype.clone.call(this,t);t.color.copy(this.color);t.emissive.copy(this.emissive);t.specular.copy(this.specular);t.shininess=this.shininess;t.metal=this.metal;t.wrapAround=this.wrapAround;t.wrapRGB.copy(this.wrapRGB);t.map=this.map;t.lightMap=this.lightMap;t.bumpMap=this.bumpMap;t.bumpScale=this.bumpScale;t.normalMap=this.normalMap;t.normalScale.copy(this.normalScale);t.specularMap=this.specularMap;t.alphaMap=this.alphaMap;t.envMap=this.envMap;t.combine=this.combine;t.reflectivity=this.reflectivity;t.refractionRatio=this.refractionRatio;t.fog=this.fog;t.shading=this.shading;t.wireframe=this.wireframe;t.wireframeLinewidth=this.wireframeLinewidth;t.wireframeLinecap=this.wireframeLinecap;t.wireframeLinejoin=this.wireframeLinejoin;t.vertexColors=this.vertexColors;t.skinning=this.skinning;t.morphTargets=this.morphTargets;t.morphNormals=this.morphNormals;return t};e.MeshDepthMaterial=function(t){e.Material.call(this);this.type="MeshDepthMaterial";this.morphTargets=false;this.wireframe=false;this.wireframeLinewidth=1;this.setValues(t)};e.MeshDepthMaterial.prototype=Object.create(e.Material.prototype);e.MeshDepthMaterial.prototype.constructor=e.MeshDepthMaterial;e.MeshDepthMaterial.prototype.clone=function(){var t=new e.MeshDepthMaterial;e.Material.prototype.clone.call(this,t);t.wireframe=this.wireframe;t.wireframeLinewidth=this.wireframeLinewidth;return t};e.MeshNormalMaterial=function(t){e.Material.call(this,t);this.type="MeshNormalMaterial";this.wireframe=false;this.wireframeLinewidth=1;this.morphTargets=false;this.setValues(t)};e.MeshNormalMaterial.prototype=Object.create(e.Material.prototype);e.MeshNormalMaterial.prototype.constructor=e.MeshNormalMaterial;e.MeshNormalMaterial.prototype.clone=function(){var t=new e.MeshNormalMaterial;e.Material.prototype.clone.call(this,t);t.wireframe=this.wireframe;t.wireframeLinewidth=this.wireframeLinewidth;return t};e.MeshFaceMaterial=function(t){this.uuid=e.Math.generateUUID();this.type="MeshFaceMaterial";this.materials=t instanceof Array?t:[]};e.MeshFaceMaterial.prototype={constructor:e.MeshFaceMaterial,toJSON:function(){var e={metadata:{version:4.2,type:"material",generator:"MaterialExporter"}
111,uuid:this.uuid,type:this.type,materials:[]};for(var t=0,r=this.materials.length;t<r;t++){e.materials.push(this.materials[t].toJSON())}return e},clone:function(){var t=new e.MeshFaceMaterial;for(var r=0;r<this.materials.length;r++){t.materials.push(this.materials[r].clone())}return t}};e.PointCloudMaterial=function(t){e.Material.call(this);this.type="PointCloudMaterial";this.color=new e.Color(16777215);this.map=null;this.size=1;this.sizeAttenuation=true;this.vertexColors=e.NoColors;this.fog=true;this.setValues(t)};e.PointCloudMaterial.prototype=Object.create(e.Material.prototype);e.PointCloudMaterial.prototype.constructor=e.PointCloudMaterial;e.PointCloudMaterial.prototype.clone=function(){var t=new e.PointCloudMaterial;e.Material.prototype.clone.call(this,t);t.color.copy(this.color);t.map=this.map;t.size=this.size;t.sizeAttenuation=this.sizeAttenuation;t.vertexColors=this.vertexColors;t.fog=this.fog;return t};e.ParticleBasicMaterial=function(t){e.warn("THREE.ParticleBasicMaterial has been renamed to THREE.PointCloudMaterial.");return new e.PointCloudMaterial(t)};e.ParticleSystemMaterial=function(t){e.warn("THREE.ParticleSystemMaterial has been renamed to THREE.PointCloudMaterial.");return new e.PointCloudMaterial(t)};e.ShaderMaterial=function(t){e.Material.call(this);this.type="ShaderMaterial";this.defines={};this.uniforms={};this.attributes=null;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.shading=e.SmoothShading;this.linewidth=1;this.wireframe=false;this.wireframeLinewidth=1;this.fog=false;this.lights=false;this.vertexColors=e.NoColors;this.skinning=false;this.morphTargets=false;this.morphNormals=false;this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv2:[0,0]};this.index0AttributeName=undefined;this.setValues(t)};e.ShaderMaterial.prototype=Object.create(e.Material.prototype);e.ShaderMaterial.prototype.constructor=e.ShaderMaterial;e.ShaderMaterial.prototype.clone=function(){var t=new e.ShaderMaterial;e.Material.prototype.clone.call(this,t);t.fragmentShader=this.fragmentShader;t.vertexShader=this.vertexShader;t.uniforms=e.UniformsUtils.clone(this.uniforms);t.attributes=this.attributes;t.defines=this.defines;t.shading=this.shading;t.wireframe=this.wireframe;t.wireframeLinewidth=this.wireframeLinewidth;t.fog=this.fog;t.lights=this.lights;t.vertexColors=this.vertexColors;t.skinning=this.skinning;t.morphTargets=this.morphTargets;t.morphNormals=this.morphNormals;return t};e.RawShaderMaterial=function(t){e.ShaderMaterial.call(this,t);this.type="RawShaderMaterial"};e.RawShaderMaterial.prototype=Object.create(e.ShaderMaterial.prototype);e.RawShaderMaterial.prototype.constructor=e.RawShaderMaterial;e.RawShaderMaterial.prototype.clone=function(){var t=new e.RawShaderMaterial;e.ShaderMaterial.prototype.clone.call(this,t);return t};e.SpriteMaterial=function(t){e.Material.call(this);this.type="SpriteMaterial";this.color=new e.Color(16777215);this.map=null;this.rotation=0;this.fog=false;this.setValues(t)};e.SpriteMaterial.prototype=Object.create(e.Material.prototype);e.SpriteMaterial.prototype.constructor=e.SpriteMaterial;e.SpriteMaterial.prototype.clone=function(){var t=new e.SpriteMaterial;e.Material.prototype.clone.call(this,t);t.color.copy(this.color);t.map=this.map;t.rotation=this.rotation;t.fog=this.fog;return t};e.Texture=function(t,r,n,i,a,o,s,u,l){Object.defineProperty(this,"id",{value:e.TextureIdCount++});this.uuid=e.Math.generateUUID();this.name="";this.sourceFile="";this.image=t!==undefined?t:e.Texture.DEFAULT_IMAGE;this.mipmaps=[];this.mapping=r!==undefined?r:e.Texture.DEFAULT_MAPPING;this.wrapS=n!==undefined?n:e.ClampToEdgeWrapping;this.wrapT=i!==undefined?i:e.ClampToEdgeWrapping;this.magFilter=a!==undefined?a:e.LinearFilter;this.minFilter=o!==undefined?o:e.LinearMipMapLinearFilter;this.anisotropy=l!==undefined?l:1;this.format=s!==undefined?s:e.RGBAFormat;this.type=u!==undefined?u:e.UnsignedByteType;this.offset=new e.Vector2(0,0);this.repeat=new e.Vector2(1,1);this.generateMipmaps=true;this.premultiplyAlpha=false;this.flipY=true;this.unpackAlignment=4;this._needsUpdate=false;this.onUpdate=null};e.Texture.DEFAULT_IMAGE=undefined;e.Texture.DEFAULT_MAPPING=e.UVMapping;e.Texture.prototype={constructor:e.Texture,get needsUpdate(){return this._needsUpdate},set needsUpdate(e){if(e===true)this.update();this._needsUpdate=e},clone:function(t){if(t===undefined)t=new e.Texture;t.image=this.image;t.mipmaps=this.mipmaps.slice(0);t.mapping=this.mapping;t.wrapS=this.wrapS;t.wrapT=this.wrapT;t.magFilter=this.magFilter;t.minFilter=this.minFilter;t.anisotropy=this.anisotropy;t.format=this.format;
111t.type=this.type;t.offset.copy(this.offset);t.repeat.copy(this.repeat);t.generateMipmaps=this.generateMipmaps;t.premultiplyAlpha=this.premultiplyAlpha;t.flipY=this.flipY;t.unpackAlignment=this.unpackAlignment;return t},update:function(){this.dispatchEvent({type:"update"})},dispose:function(){this.dispatchEvent({type:"dispose"})}};e.EventDispatcher.prototype.apply(e.Texture.prototype);e.TextureIdCount=0;e.CubeTexture=function(t,r,n,i,a,o,s,u,l){r=r!==undefined?r:e.CubeReflectionMapping;e.Texture.call(this,t,r,n,i,a,o,s,u,l);this.images=t};e.CubeTexture.prototype=Object.create(e.Texture.prototype);e.CubeTexture.prototype.constructor=e.CubeTexture;e.CubeTexture.clone=function(t){if(t===undefined)t=new e.CubeTexture;e.Texture.prototype.clone.call(this,t);t.images=this.images;return t};e.CompressedTexture=function(t,r,n,i,a,o,s,u,l,c,f){e.Texture.call(this,null,o,s,u,l,c,i,a,f);this.image={width:r,height:n};this.mipmaps=t;this.flipY=false;this.generateMipmaps=false};e.CompressedTexture.prototype=Object.create(e.Texture.prototype);e.CompressedTexture.prototype.constructor=e.CompressedTexture;e.CompressedTexture.prototype.clone=function(){var t=new e.CompressedTexture;e.Texture.prototype.clone.call(this,t);return t};e.DataTexture=function(t,r,n,i,a,o,s,u,l,c,f){e.Texture.call(this,null,o,s,u,l,c,i,a,f);this.image={data:t,width:r,height:n}};e.DataTexture.prototype=Object.create(e.Texture.prototype);e.DataTexture.prototype.constructor=e.DataTexture;e.DataTexture.prototype.clone=function(){var t=new e.DataTexture;e.Texture.prototype.clone.call(this,t);return t};e.VideoTexture=function(t,r,n,i,a,o,s,u,l){e.Texture.call(this,t,r,n,i,a,o,s,u,l);this.generateMipmaps=false;var c=this;var f=function(){requestAnimationFrame(f);if(t.readyState===t.HAVE_ENOUGH_DATA){c.needsUpdate=true}};f()};e.VideoTexture.prototype=Object.create(e.Texture.prototype);e.VideoTexture.prototype.constructor=e.VideoTexture;e.Group=function(){e.Object3D.call(this);this.type="Group"} 112;e.Group.prototype=Object.create(e.Object3D.prototype);e.Group.prototype.constructor=e.Group;e.PointCloud=function(t,r){e.Object3D.call(this);this.type="PointCloud";this.geometry=t!==undefined?t:new e.Geometry;this.material=r!==undefined?r:new e.PointCloudMaterial({color:Math.random()*16777215})};e.PointCloud.prototype=Object.create(e.Object3D.prototype);e.PointCloud.prototype.constructor=e.PointCloud;e.PointCloud.prototype.raycast=function(){var t=new e.Matrix4;var r=new e.Ray;return function(n,i){var a=this;var o=a.geometry;var s=n.params.PointCloud.threshold;t.getInverse(this.matrixWorld);r.copy(n.ray).applyMatrix4(t);if(o.boundingBox!==null){if(r.isIntersectionBox(o.boundingBox)===false){return}}var u=s/((this.scale.x+this.scale.y+this.scale.z)/3);var l=new e.Vector3;var c=function(e,t){var o=r.distanceToPoint(e);if(o<u){var s=r.closestPointToPoint(e);s.applyMatrix4(a.matrixWorld);var l=n.ray.origin.distanceTo(s);i.push({distance:l,distanceToRay:o,point:s.clone(),index:t,face:null,object:a})}};if(o instanceof e.BufferGeometry){var f=o.attributes;var h=f.position.array;if(f.index!==undefined){var d=f.index.array;var p=o.offsets;if(p.length===0){var m={start:0,count:d.length,index:0};p=[m]}for(var v=0,y=p.length;v<y;++v){var g=p[v].start;var b=p[v].count;var x=p[v].index;for(var _=g,w=g+b;_<w;_++){var C=x+d[_];l.fromArray(h,C*3);c(l,C)}}}else{var E=h.length/3;for(var _=0;_<E;_++){l.set(h[3*_],h[3*_+1],h[3*_+2]);c(l,_)}}}else{var S=this.geometry.vertices;for(var _=0;_<S.length;_++){c(S[_],_)}}}}();e.PointCloud.prototype.clone=function(t){if(t===undefined)t=new e.PointCloud(this.geometry,this.material);e.Object3D.prototype.clone.call(this,t);return t};e.ParticleSystem=function(t,r){e.warn("THREE.ParticleSystem has been renamed to THREE.PointCloud.");return new e.PointCloud(t,r)};e.Line=function(t,r,n){e.Object3D.call(this);this.type="Line";this.geometry=t!==undefined?t:new e.Geometry;this.material=r!==undefined?r:new e.LineBasicMaterial({color:Math.random()*16777215});this.mode=n!==undefined?n:e.LineStrip};e.LineStrip=0;
112e.LinePieces=1;e.Line.prototype=Object.create(e.Object3D.prototype);e.Line.prototype.constructor=e.Line;e.Line.prototype.raycast=function(){var t=new e.Matrix4;var r=new e.Ray;var n=new e.Sphere;return function(i,a){var o=i.linePrecision;var s=o*o;var u=this.geometry;if(u.boundingSphere===null)u.computeBoundingSphere();n.copy(u.boundingSphere);n.applyMatrix4(this.matrixWorld);if(i.ray.isIntersectionSphere(n)===false){return}t.getInverse(this.matrixWorld);r.copy(i.ray).applyMatrix4(t);var l=new e.Vector3;var c=new e.Vector3;var f=new e.Vector3;var h=new e.Vector3;var d=this.mode===e.LineStrip?1:2;if(u instanceof e.BufferGeometry){var p=u.attributes;if(p.index!==undefined){var m=p.index.array;var v=p.position.array;var y=u.offsets;if(y.length===0){y=[{start:0,count:m.length,index:0}]}for(var g=0;g<y.length;g++){var b=y[g].start;var x=y[g].count;var _=y[g].index;for(var w=b;w<b+x-1;w+=d){var C=_+m[w];var E=_+m[w+1];l.fromArray(v,C*3);c.fromArray(v,E*3);var S=r.distanceSqToSegment(l,c,h,f);if(S>s)continue;var T=r.origin.distanceTo(h);if(T<i.near||T>i.far)continue;a.push({distance:T,point:f.clone().applyMatrix4(this.matrixWorld),index:w,offsetIndex:g,face:null,faceIndex:null,object:this})}}}else{var v=p.position.array;for(var w=0;w<v.length/3-1;w+=d){l.fromArray(v,3*w);c.fromArray(v,3*w+3);var S=r.distanceSqToSegment(l,c,h,f);if(S>s)continue;var T=r.origin.distanceTo(h);if(T<i.near||T>i.far)continue;a.push({distance:T,point:f.clone().applyMatrix4(this.matrixWorld),index:w,face:null,faceIndex:null,object:this})}}}else if(u instanceof e.Geometry){var M=u.vertices;var A=M.length;for(var w=0;w<A-1;w+=d){var S=r.distanceSqToSegment(M[w],M[w+1],h,f);if(S>s)continue;var T=r.origin.distanceTo(h);if(T<i.near||T>i.far)continue;a.push({distance:T,point:f.clone().applyMatrix4(this.matrixWorld),index:w,face:null,faceIndex:null,object:this})}}}}();e.Line.prototype.clone=function(t){if(t===undefined)t=new e.Line(this.geometry,this.material,this.mode);e.Object3D.prototype.clone.call(this,t);return t};e.Mesh=function(t,r){e.Object3D.call(this);this.type="Mesh";this.geometry=t!==undefined?t:new e.Geometry;this.material=r!==undefined?r:new e.MeshBasicMaterial({color:Math.random()*16777215});this.updateMorphTargets()};e.Mesh.prototype=Object.create(e.Object3D.prototype);e.Mesh.prototype.constructor=e.Mesh;e.Mesh.prototype.updateMorphTargets=function(){if(this.geometry.morphTargets!==undefined&&this.geometry.morphTargets.length>0){this.morphTargetBase=-1;this.morphTargetForcedOrder=[];this.morphTargetInfluences=[];this.morphTargetDictionary={};for(var e=0,t=this.geometry.morphTargets.length;e<t;e++){this.morphTargetInfluences.push(0);this.morphTargetDictionary[this.geometry.morphTargets[e].name]=e}}};e.Mesh.prototype.getMorphTargetIndexByName=function(t){if(this.morphTargetDictionary[t]!==undefined){return this.morphTargetDictionary[t]}e.warn("THREE.Mesh.getMorphTargetIndexByName: morph target "+t+" does not exist. Returning 0.");return 0};e.Mesh.prototype.raycast=function(){var t=new e.Matrix4;var r=new e.Ray;var n=new e.Sphere;var i=new e.Vector3;var a=new e.Vector3;var o=new e.Vector3;return function(s,u){var l=this.geometry;if(l.boundingSphere===null)l.computeBoundingSphere();n.copy(l.boundingSphere);n.applyMatrix4(this.matrixWorld);if(s.ray.isIntersectionSphere(n)===false){return}t.getInverse(this.matrixWorld);r.copy(s.ray).applyMatrix4(t);if(l.boundingBox!==null){if(r.isIntersectionBox(l.boundingBox)===false){return}}if(l instanceof e.BufferGeometry){var c=this.material;if(c===undefined)return;var f=l.attributes;var h,d,p;var m=s.precision;if(f.index!==undefined){var v=f.index.array;var y=f.position.array;var g=l.offsets;if(g.length===0){g=[{start:0,count:v.length,index:0}]}for(var b=0,x=g.length;b<x;++b){var _=g[b].start;var w=g[b].count;var C=g[b].index;for(var E=_,S=_+w;E<S;E+=3){h=C+v[E];d=C+v[E+1];p=C+v[E+2];i.fromArray(y,h*3);a.fromArray(y,d*3);o.fromArray(y,p*3);if(c.side===e.BackSide){var T=r.intersectTriangle(o,a,i,true)}else{var T=r.intersectTriangle(i,a,o,c.side!==e.DoubleSide)}if(T===null)continue;T.applyMatrix4(this.matrixWorld);var M=s.ray.origin.distanceTo(T);if(M<m||M<s.near||M>s.far)continue;u.push({distance:M,point:T,face:new e.Face3(h,d,p,e.Triangle.normal(i,a,o)),faceIndex:null,object:this})}}}else{var y=f.position.array;for(var E=0,A=0,S=y.length;E<S;E+=3,A+=9){h=E;d=E+1;p=E+2;i.fromArray(y,A);a.fromArray(y,A+3);o.fromArray(y,A+6);if(c.side===e.BackSide){var T=r.intersectTriangle(o,a,i,true)}else{var T=r.intersectTriangle(i,a,o,c.side!==e.DoubleSide)}if(T===null)continue;
112T.applyMatrix4(this.matrixWorld);var M=s.ray.origin.distanceTo(T);if(M<m||M<s.near||M>s.far)continue;u.push({distance:M,point:T,face:new e.Face3(h,d,p,e.Triangle.normal(i,a,o)),faceIndex:null,object:this})}}}else if(l instanceof e.Geometry){var P=this.material instanceof e.MeshFaceMaterial;var R=P===true?this.material.materials:null;var h,d,p;var m=s.precision;var k=l.vertices;for(var I=0,D=l.faces.length;I<D;I++){var B=l.faces[I];var c=P===true?R[B.materialIndex]:this.material;if(c===undefined)continue;h=k[B.a];d=k[B.b];p=k[B.c];if(c.morphTargets===true){var L=l.morphTargets;var F=this.morphTargetInfluences;i.set(0,0,0);a.set(0,0,0);o.set(0,0,0);for(var V=0,O=L.length;V<O;V++){var U=F[V];if(U===0)continue;var N=L[V].vertices;i.x+=(N[B.a].x-h.x)*U;i.y+=(N[B.a].y-h.y)*U;i.z+=(N[B.a].z-h.z)*U;a.x+=(N[B.b].x-d.x)*U;a.y+=(N[B.b].y-d.y)*U;a.z+=(N[B.b].z-d.z)*U;o.x+=(N[B.c].x-p.x)*U;o.y+=(N[B.c].y-p.y)*U;o.z+=(N[B.c].z-p.z)*U}i.add(h);a.add(d);o.add(p);h=i;d=a;p=o}if(c.side===e.BackSide){var T=r.intersectTriangle(p,d,h,true)}else{var T=r.intersectTriangle(h,d,p,c.side!==e.DoubleSide)}if(T===null)continue;T.applyMatrix4(this.matrixWorld);var M=s.ray.origin.distanceTo(T);if(M<m||M<s.near||M>s.far)continue;u.push({distance:M,point:T,face:B,faceIndex:I,object:this})}}}}();e.Mesh.prototype.clone=function(t,r){if(t===undefined)t=new e.Mesh(this.geometry,this.material);e.Object3D.prototype.clone.call(this,t,r);return t};e.Bone=function(t){e.Object3D.call(this);this.type="Bone";this.skin=t};e.Bone.prototype=Object.create(e.Object3D.prototype);e.Bone.prototype.constructor=e.Bone;e.Skeleton=function(t,r,n){this.useVertexTexture=n!==undefined?n:true;
112this.identityMatrix=new e.Matrix4;t=t||[];this.bones=t.slice(0);if(this.useVertexTexture){var i;if(this.bones.length>256)i=64;else if(this.bones.length>64)i=32;else if(this.bones.length>16)i=16;else i=8;this.boneTextureWidth=i;this.boneTextureHeight=i;this.boneMatrices=new Float32Array(this.boneTextureWidth*this.boneTextureHeight*4);this.boneTexture=new e.DataTexture(this.boneMatrices,this.boneTextureWidth,this.boneTextureHeight,e.RGBAFormat,e.FloatType);this.boneTexture.minFilter=e.NearestFilter;this.boneTexture.magFilter=e.NearestFilter;this.boneTexture.generateMipmaps=false;this.boneTexture.flipY=false}else{this.boneMatrices=new Float32Array(16*this.bones.length)}if(r===undefined){this.calculateInverses()}else{if(this.bones.length===r.length){this.boneInverses=r.slice(0)}else{e.warn("THREE.Skeleton bonInverses is the wrong length.");this.boneInverses=[];for(var a=0,o=this.bones.length;a<o;a++){this.boneInverses.push(new e.Matrix4)}}}};e.Skeleton.prototype.calculateInverses=function(){this.boneInverses=[];for(var t=0,r=this.bones.length;t<r;
112t++){var n=new e.Matrix4;if(this.bones[t]){n.getInverse(this.bones[t].matrixWorld)}this.boneInverses.push(n)}};e.Skeleton.prototype.pose=function(){var e;for(var t=0,r=this.bones.length;t<r;t++){e=this.bones[t];if(e){e.matrixWorld.getInverse(this.boneInverses[t])}}for(var t=0,r=this.bones.length;t<r;t++){e=this.bones[t];if(e){if(e.parent){e.matrix.getInverse(e.parent.matrixWorld);e.matrix.multiply(e.matrixWorld)}else{e.matrix.copy(e.matrixWorld)}e.matrix.decompose(e.position,e.quaternion,e.scale)}}};e.Skeleton.prototype.update=function(){var t=new e.Matrix4;return function(){for(var e=0,r=this.bones.length;e<r;e++){var n=this.bones[e]?this.bones[e].matrixWorld:this.identityMatrix;t.multiplyMatrices(n,this.boneInverses[e]);t.flattenToArrayOffset(this.boneMatrices,e*16)}if(this.useVertexTexture){this.boneTexture.needsUpdate=true}}}();e.SkinnedMesh=function(t,r,n){e.Mesh.call(this,t,r);this.type="SkinnedMesh";this.bindMode="attached";this.bindMatrix=new e.Matrix4;this.bindMatrixInverse=new e.Matrix4;var i=[];if(this.geometry&&this.geometry.bones!==undefined){var a,o,s,u,l;for(var c=0,f=this.geometry.bones.length;c<f;++c){o=this.geometry.bones[c];s=o.pos;u=o.rotq;l=o.scl;a=new e.Bone(this);i.push(a);a.name=o.name;a.position.set(s[0],s[1],s[2]);a.quaternion.set(u[0],u[1],u[2],u[3]);if(l!==undefined){a.scale.set(l[0],l[1],l[2])}else{a.scale.set(1,1,1)}}for(var c=0,f=this.geometry.bones.length;c<f;++c){o=this.geometry.bones[c];if(o.parent!==-1){i[o.parent].add(i[c])}else{this.add(i[c])}}}this.normalizeSkinWeights();this.updateMatrixWorld(true);this.bind(new e.Skeleton(i,undefined,n))};e.SkinnedMesh.prototype=Object.create(e.Mesh.prototype);e.SkinnedMesh.prototype.constructor=e.SkinnedMesh;e.SkinnedMesh.prototype.bind=function(e,t){this.skeleton=e;if(t===undefined){this.updateMatrixWorld(true);t=this.matrixWorld}this.bindMatrix.copy(t);this.bindMatrixInverse.getInverse(t)};e.SkinnedMesh.prototype.pose=function(){this.skeleton.pose()};e.SkinnedMesh.prototype.normalizeSkinWeights=function(){if(this.geometry instanceof e.Geometry){for(var t=0;t<this.geometry.skinIndices.length;t++){var r=this.geometry.skinWeights[t];var n=1/r.lengthManhattan();if(n!==Infinity){r.multiplyScalar(n)}else{r.set(1)}}}else{}};e.SkinnedMesh.prototype.updateMatrixWorld=function(t){e.Mesh.prototype.updateMatrixWorld.call(this,true);if(this.bindMode==="attached"){this.bindMatrixInverse.getInverse(this.matrixWorld)}else if(this.bindMode==="detached"){this.bindMatrixInverse.getInverse(this.bindMatrix)}else{e.warn("THREE.SkinnedMesh unreckognized bindMode: "+this.bindMode)}};e.SkinnedMesh.prototype.clone=function(t){if(t===undefined){t=new e.SkinnedMesh(this.geometry,this.material,this.useVertexTexture)}e.Mesh.prototype.clone.call(this,t);return t};e.MorphAnimMesh=function(t,r){e.Mesh.call(this,t,r);this.type="MorphAnimMesh";this.duration=1e3;this.mirroredLoop=false;this.time=0;this.lastKeyframe=0;this.currentKeyframe=0;this.direction=1;this.directionBackwards=false;this.setFrameRange(0,this.geometry.morphTargets.length-1)};e.MorphAnimMesh.prototype=Object.create(e.Mesh.prototype);e.MorphAnimMesh.prototype.constructor=e.MorphAnimMesh;e.MorphAnimMesh.prototype.setFrameRange=function(e,t){this.startKeyframe=e;this.endKeyframe=t;this.length=this.endKeyframe-this.startKeyframe+1};e.MorphAnimMesh.prototype.setDirectionForward=function(){this.direction=1;this.directionBackwards=false};e.MorphAnimMesh.prototype.setDirectionBackward=function(){this.direction=-1;this.directionBackwards=true};e.MorphAnimMesh.prototype.parseAnimations=function(){var e=this.geometry;if(!e.animations)e.animations={};var t,r=e.animations;var n=/([a-z]+)_?(\d+)/;for(var i=0,a=e.morphTargets.length;i<a;i++){var o=e.morphTargets[i];var s=o.name.match(n);if(s&&s.length>1){var u=s[1];if(!r[u])r[u]={start:Infinity,end:-Infinity};var l=r[u];if(i<l.start)l.start=i;if(i>l.end)l.end=i;
112if(!t)t=u}}e.firstAnimation=t};e.MorphAnimMesh.prototype.setAnimationLabel=function(e,t,r){if(!this.geometry.animations)this.geometry.animations={};this.geometry.animations[e]={start:t,end:r}};e.MorphAnimMesh.prototype.playAnimation=function(t,r){var n=this.geometry.animations[t];if(n){this.setFrameRange(n.start,n.end);this.duration=1e3*((n.end-n.start)/r);this.time=0}else{e.warn("THREE.MorphAnimMesh: animation["+t+"] undefined in .playAnimation()")}};e.MorphAnimMesh.prototype.updateAnimation=function(t){var r=this.duration/this.length;this.time+=this.direction*t;if(this.mirroredLoop){if(this.time>this.duration||this.time<0){this.direction*=-1;if(this.time>this.duration){this.time=this.duration;this.directionBackwards=true}if(this.time<0){this.time=0;this.directionBackwards=false}}}else{this.time=this.time%this.duration;if(this.time<0)this.time+=this.duration}var n=this.startKeyframe+e.Math.clamp(Math.floor(this.time/r),0,this.length-1);if(n!==this.currentKeyframe){this.morphTargetInfluences[this.lastKeyframe]=0;this.morphTargetInfluences[this.currentKeyframe]=1;this.morphTargetInfluences[n]=0;this.lastKeyframe=this.currentKeyframe;this.currentKeyframe=n}var i=this.time%r/r;if(this.directionBackwards){i=1-i}this.morphTargetInfluences[this.currentKeyframe]=i;this.morphTargetInfluences[this.lastKeyframe]=1-i};e.MorphAnimMesh.prototype.interpolateTargets=function(e,t,r){var n=this.morphTargetInfluences;for(var i=0,a=n.length;i<a;i++){n[i]=0}if(e>-1)n[e]=1-r;if(t>-1)n[t]=r};e.MorphAnimMesh.prototype.clone=function(t){if(t===undefined)t=new e.MorphAnimMesh(this.geometry,this.material);t.duration=this.duration;t.mirroredLoop=this.mirroredLoop;t.time=this.time;t.lastKeyframe=this.lastKeyframe;t.currentKeyframe=this.currentKeyframe;t.direction=this.direction;t.directionBackwards=this.directionBackwards;e.Mesh.prototype.clone.call(this,t);return t};e.LOD=function(){e.Object3D.call(this);this.objects=[]};e.LOD.prototype=Object.create(e.Object3D.prototype);e.LOD.prototype.constructor=e.LOD;e.LOD.prototype.addLevel=function(e,t){if(t===undefined)t=0;t=Math.abs(t);for(var r=0;r<this.objects.length;r++){if(t<this.objects[r].distance){break}}this.objects.splice(r,0,{distance:t,object:e});this.add(e)};e.LOD.prototype.getObjectForDistance=function(e){for(var t=1,r=this.objects.length;t<r;t++){if(e<this.objects[t].distance){break}}return this.objects[t-1].object};e.LOD.prototype.raycast=function(){var t=new e.Vector3;return function(e,r){t.setFromMatrixPosition(this.matrixWorld);var n=e.ray.origin.distanceTo(t);this.getObjectForDistance(n).raycast(e,r)}}();e.LOD.prototype.update=function(){var t=new e.Vector3;var r=new e.Vector3;return function(e){if(this.objects.length>1){t.setFromMatrixPosition(e.matrixWorld);r.setFromMatrixPosition(this.matrixWorld);var n=t.distanceTo(r);this.objects[0].object.visible=true;for(var i=1,a=this.objects.length;i<a;i++){if(n>=this.objects[i].distance){this.objects[i-1].object.visible=false;this.objects[i].object.visible=true}else{break}}for(;i<a;i++){this.objects[i].object.visible=false}}}}();e.LOD.prototype.clone=function(t){if(t===undefined)t=new e.LOD;e.Object3D.prototype.clone.call(this,t);for(var r=0,n=this.objects.length;r<n;r++){var i=this.objects[r].object.clone();i.visible=r===0;t.addLevel(i,this.objects[r].distance)}return t};e.Sprite=function(){var t=new Uint16Array([0,1,2,0,2,3]);var r=new Float32Array([-.5,-.5,0,.5,-.5,0,.5,.5,0,-.5,.5,0]);var n=new Float32Array([0,0,1,0,1,1,0,1]);var i=new e.BufferGeometry;i.addAttribute("index",new e.BufferAttribute(t,1));i.addAttribute("position",new e.BufferAttribute(r,3));i.addAttribute("uv",new e.BufferAttribute(n,2));return function(t){e.Object3D.call(this);this.type="Sprite";this.geometry=i;this.material=t!==undefined?t:new e.SpriteMaterial}}();e.Sprite.prototype=Object.create(e.Object3D.prototype);e.Sprite.prototype.constructor=e.Sprite;e.Sprite.prototype.raycast=function(){var t=new e.Vector3;return function(e,r){t.setFromMatrixPosition(this.matrixWorld);var n=e.ray.distanceToPoint(t);if(n>this.scale.x){return}r.push({distance:n,point:this.position,face:null,object:this})}}();e.Sprite.prototype.clone=function(t){if(t===undefined)t=new e.Sprite(this.material);e.Object3D.prototype.clone.call(this,t);return t};e.Particle=e.Sprite;e.LensFlare=function(t,r,n,i,a){e.Object3D.call(this);this.lensFlares=[];this.positionScreen=new e.Vector3;this.customUpdateCallback=undefined;if(t!==undefined){this.add(t,r,n,i,a)}};e.LensFlare.prototype=Object.create(e.Object3D.prototype);e.LensFlare.prototype.constructor=e.LensFlare;e.LensFlare.prototype.add=function(t,r,n,i,a,o){if(r===undefined)r=-1;if(n===undefined)n=0;
112if(o===undefined)o=1;if(a===undefined)a=new e.Color(16777215);if(i===undefined)i=e.NormalBlending;n=Math.min(n,Math.max(0,n));this.lensFlares.push({texture:t,size:r,distance:n,x:0,y:0,z:0,scale:1,rotation:1,opacity:o,color:a,blending:i})};e.LensFlare.prototype.updateLensFlares=function(){var e,t=this.lensFlares.length;var r;var n=-this.positionScreen.x*2;var i=-this.positionScreen.y*2;for(e=0;e<t;e++){r=this.lensFlares[e];r.x=this.positionScreen.x+n*r.distance;r.y=this.positionScreen.y+i*r.distance;r.wantedRotation=r.x*Math.PI*.25;r.rotation+=(r.wantedRotation-r.rotation)*.25}};e.Scene=function(){e.Object3D.call(this);this.type="Scene";this.fog=null;this.overrideMaterial=null;this.autoUpdate=true};e.Scene.prototype=Object.create(e.Object3D.prototype);e.Scene.prototype.constructor=e.Scene;e.Scene.prototype.clone=function(t){if(t===undefined)t=new e.Scene;e.Object3D.prototype.clone.call(this,t);if(this.fog!==null)t.fog=this.fog.clone();if(this.overrideMaterial!==null)t.overrideMaterial=this.overrideMaterial.clone();t.autoUpdate=this.autoUpdate;t.matrixAutoUpdate=this.matrixAutoUpdate;return t};e.Fog=function(t,r,n){this.name="";this.color=new e.Color(t);this.near=r!==undefined?r:1;this.far=n!==undefined?n:1e3};e.Fog.prototype.clone=function(){return new e.Fog(this.color.getHex(),this.near,this.far)};e.FogExp2=function(t,r){this.name="";this.color=new e.Color(t);this.density=r!==undefined?r:25e-5};e.FogExp2.prototype.clone=function(){return new e.FogExp2(this.color.getHex(),this.density)};e.ShaderChunk={};e.ShaderChunk["common"]="#define PI 3.14159\n#define PI2 6.28318\n#define RECIPROCAL_PI2 0.15915494\n#define LOG2 1.442695\n#define EPSILON 1e-6\n\nfloat square( in float a ) { return a*a; }\nvec2 square( in vec2 a ) { return vec2( a.x*a.x, a.y*a.y ); }\nvec3 square( in vec3 a ) { return vec3( a.x*a.x, a.y*a.y, a.z*a.z ); }\nvec4 square( in vec4 a ) { return vec4( a.x*a.x, a.y*a.y, a.z*a.z, a.w*a.w ); }\nfloat saturate( in float a ) { return clamp( a, 0.0, 1.0 ); }\nvec2 saturate( in vec2 a ) { return clamp( a, 0.0, 1.0 ); }\nvec3 saturate( in vec3 a ) { return clamp( a, 0.0, 1.0 ); }\nvec4 saturate( in vec4 a ) { return clamp( a, 0.0, 1.0 ); }\nfloat average( in float a ) { return a; }\nfloat average( in vec2 a ) { return ( a.x + a.y) * 0.5; }\nfloat average( in vec3 a ) { return ( a.x + a.y + a.z) / 3.0; }\nfloat average( in vec4 a ) { return ( a.x + a.y + a.z + a.w) * 0.25; }\nfloat whiteCompliment( in float a ) { return saturate( 1.0 - a ); }\nvec2 whiteCompliment( in vec2 a ) { return saturate( vec2(1.0) - a ); }\nvec3 whiteCompliment( in vec3 a ) { return saturate( vec3(1.0) - a ); }\nvec4 whiteCompliment( in vec4 a ) { return saturate( vec4(1.0) - a ); }\nvec3 transformDirection( in vec3 normal, in mat4 matrix ) {\n\treturn normalize( ( matrix * vec4( normal, 0.0 ) ).xyz );\n}\n// http://en.wikibooks.org/wiki/GLSL_Programming/Applying_Matrix_Transformations\nvec3 inverseTransformDirection( in vec3 normal, in mat4 matrix ) {\n\treturn normalize( ( vec4( normal, 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 point - distance * planeNormal;\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 pointOnLine + lineDirection * ( dot( planeNormal, pointOnPlane - pointOnLine ) / dot( planeNormal, lineDirection ) );\n}\nfloat calcLightAttenuation( float lightDistance, float cutoffDistance, float decayExponent ) {\n\tif ( decayExponent > 0.0 ) {\n\t return pow( saturate( 1.0 - lightDistance / cutoffDistance ), decayExponent );\n\t}\n\treturn 1.0;\n}\n\nvec3 inputToLinear( in vec3 a ) {\n#ifdef GAMMA_INPUT\n\treturn pow( a, vec3( float( GAMMA_FACTOR ) ) );\n#else\n\treturn a;\n#endif\n}\nvec3 linearToOutput( in vec3 a ) {\n#ifdef GAMMA_OUTPUT\n\treturn pow( a, vec3( 1.0 / float( GAMMA_FACTOR ) ) );\n#else\n\treturn a;\n#endif\n}\n";e.ShaderChunk["alphatest_fragment"]="#ifdef ALPHATEST\n\n\tif ( diffuseColor.a < ALPHATEST ) discard;\n\n#endif\n";e.ShaderChunk["lights_lambert_vertex"]="vLightFront = vec3( 0.0 );\n\n#ifdef DOUBLE_SIDED\n\n\tvLightBack = vec3( 0.0 );\n\n#endif\n\ntransformedNormal = normalize( transformedNormal );\n\n#if MAX_DIR_LIGHTS > 0\n\nfor( int i = 0; i < MAX_DIR_LIGHTS; i ++ ) {\n\n\tvec3 dirVector = transformDirection( directionalLightDirection[ i ], viewMatrix );
112\n\n\tfloat dotProduct = dot( transformedNormal, dirVector );\n\tvec3 directionalLightWeighting = vec3( max( dotProduct, 0.0 ) );\n\n\t#ifdef DOUBLE_SIDED\n\n\t\tvec3 directionalLightWeightingBack = vec3( max( -dotProduct, 0.0 ) );\n\n\t\t#ifdef WRAP_AROUND\n\n\t\t\tvec3 directionalLightWeightingHalfBack = vec3( max( -0.5 * dotProduct + 0.5, 0.0 ) );\n\n\t\t#endif\n\n\t#endif\n\n\t#ifdef WRAP_AROUND\n\n\t\tvec3 directionalLightWeightingHalf = vec3( max( 0.5 * dotProduct + 0.5, 0.0 ) );\n\t\tdirectionalLightWeighting = mix( directionalLightWeighting, directionalLightWeightingHalf, wrapRGB );\n\n\t\t#ifdef DOUBLE_SIDED\n\n\t\t\tdirectionalLightWeightingBack = mix( directionalLightWeightingBack, directionalLightWeightingHalfBack, wrapRGB );\n\n\t\t#endif\n\n\t#endif\n\n\tvLightFront += directionalLightColor[ i ] * directionalLightWeighting;\n\n\t#ifdef DOUBLE_SIDED\n\n\t\tvLightBack += directionalLightColor[ i ] * directionalLightWeightingBack;\n\n\t#endif\n\n}\n\n#endif\n\n#if MAX_POINT_LIGHTS > 0\n\n\tfor( int i = 0; i < MAX_POINT_LIGHTS; i ++ ) {\n\n\t\tvec4 lPosition = viewMatrix * vec4( pointLightPosition[ i ], 1.0 );\n\t\tvec3 lVector = lPosition.xyz - mvPosition.xyz;\n\n\t\tfloat attenuation = calcLightAttenuation( length( lVector ), pointLightDistance[ i ], pointLightDecay[ i ] );\n\n\t\tlVector = normalize( lVector );\n\t\tfloat dotProduct = dot( transformedNormal, lVector );\n\n\t\tvec3 pointLightWeighting = vec3( max( dotProduct, 0.0 ) );\n\n\t\t#ifdef DOUBLE_SIDED\n\n\t\t\tvec3 pointLightWeightingBack = vec3( max( -dotProduct, 0.0 ) );\n\n\t\t\t#ifdef WRAP_AROUND\n\n\t\t\t\tvec3 pointLightWeightingHalfBack = vec3( max( -0.5 * dotProduct + 0.5, 0.0 ) );\n\n\t\t\t#endif\n\n\t\t#endif\n\n\t\t#ifdef WRAP_AROUND\n\n\t\t\tvec3 pointLightWeightingHalf = vec3( max( 0.5 * dotProduct + 0.5, 0.0 ) );\n\t\t\tpointLightWeighting = mix( pointLightWeighting, pointLightWeightingHalf, wrapRGB );\n\n\t\t\t#ifdef DOUBLE_SIDED\n\n\t\t\t\tpointLightWeightingBack = mix( pointLightWeightingBack, pointLightWeightingHalfBack, wrapRGB );\n\n\t\t\t#endif\n\n\t\t#endif\n\n\t\tvLightFront += pointLightColor[ i ] * pointLightWeighting * attenuation;\n\n\t\t#ifdef DOUBLE_SIDED\n\n\t\t\tvLightBack += pointLightColor[ i ] * pointLightWeightingBack * attenuation;\n\n\t\t#endif\n\n\t}\n\n#endif\n\n#if MAX_SPOT_LIGHTS > 0\n\n\tfor( int i = 0; i < MAX_SPOT_LIGHTS; i ++ ) {\n\n\t\tvec4 lPosition = viewMatrix * vec4( spotLightPosition[ i ], 1.0 );\n\t\tvec3 lVector = lPosition.xyz - mvPosition.xyz;\n\n\t\tfloat spotEffect = dot( spotLightDirection[ i ], normalize( spotLightPosition[ i ] - worldPosition.xyz ) );\n\n\t\tif ( spotEffect > spotLightAngleCos[ i ] ) {\n\n\t\t\tspotEffect = max( pow( max( spotEffect, 0.0 ), spotLightExponent[ i ] ), 0.0 );\n\n\t\t\tfloat attenuation = calcLightAttenuation( length( lVector ), spotLightDistance[ i ], spotLightDecay[ i ] );\n\n\t\t\tlVector = normalize( lVector );\n\n\t\t\tfloat dotProduct = dot( transformedNormal, lVector );\n\t\t\tvec3 spotLightWeighting = vec3( max( dotProduct, 0.0 ) );\n\n\t\t\t#ifdef DOUBLE_SIDED\n\n\t\t\t\tvec3 spotLightWeightingBack = vec3( max( -dotProduct, 0.0 ) );\n\n\t\t\t\t#ifdef WRAP_AROUND\n\n\t\t\t\t\tvec3 spotLightWeightingHalfBack = vec3( max( -0.5 * dotProduct + 0.5, 0.0 ) );\n\n\t\t\t\t#endif\n\n\t\t\t#endif\n\n\t\t\t#ifdef WRAP_AROUND\n\n\t\t\t\tvec3 spotLightWeightingHalf = vec3( max( 0.5 * dotProduct + 0.5, 0.0 ) );\n\t\t\t\tspotLightWeighting = mix( spotLightWeighting, spotLightWeightingHalf, wrapRGB );\n\n\t\t\t\t#ifdef DOUBLE_SIDED\n\n\t\t\t\t\tspotLightWeightingBack = mix( spotLightWeightingBack, spotLightWeightingHalfBack, wrapRGB );\n\n\t\t\t\t#endif\n\n\t\t\t#endif\n\n\t\t\tvLightFront += spotLightColor[ i ] * spotLightWeighting * attenuation * spotEffect;\n\n\t\t\t#ifdef DOUBLE_SIDED\n\n\t\t\t\tvLightBack += spotLightColor[ i ] * spotLightWeightingBack * attenuation * spotEffect;\n\n\t\t\t#endif\n\n\t\t}\n\n\t}\n\n#endif\n\n#if MAX_HEMI_LIGHTS > 0\n\n\tfor( int i = 0; i < MAX_HEMI_LIGHTS; i ++ ) {\n\n\t\tvec3 lVector = transformDirection( hemisphereLightDirection[ i ], viewMatrix );\n\n\t\tfloat dotProduct = dot( transformedNormal, lVector );\n\n\t\tfloat hemiDiffuseWeight = 0.5 * dotProduct + 0.5;\n\t\tfloat hemiDiffuseWeightBack = -0.5 * dotProduct + 0.5;\n\n\t\tvLightFront += mix( hemisphereLightGroundColor[ i ], hemisphereLightSkyColor[ i ], hemiDiffuseWeight );\n\n\t\t#ifdef DOUBLE_SIDED\n\n\t\t\tvLightBack += mix( hemisphereLightGroundColor[ i ], hemisphereLightSkyColor[ i ], hemiDiffuseWeightBack );\n\n\t\t#endif\n\n\t}\n\n#endif\n\nvLightFront += ambientLightColor;\n\n#ifdef DOUBLE_SIDED\n\n\tvLightBack += ambientLightColor;\n\n#endif\n";e.ShaderChunk["map_particle_pars_fragment"]="#ifdef USE_MAP\n\n\tuniform vec4 offsetRepeat;\n\tuniform sampler2D map;\n\n#endif\n";e.ShaderChunk["default_vertex"]="#ifdef USE_SKINNING\n\n\tvec4 mvPosition = modelViewMatrix * skinned;\n\n#elif defined( USE_MORPHTARGETS )\n\n\tvec4 mvPosition = modelViewMatrix * vec4( morphed, 1.0 );\n\n#else\n\n\tvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n\n#endif\n\ngl_Position = projectionMatrix * mvPosition;\n";e.ShaderChunk["map_pars_fragment"]="#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP )\n\n\tvarying vec2 vUv;\n\n#endif\n\n#ifdef USE_MAP\n\n\tuniform sampler2D map;\n\n#endif";e.ShaderChunk["skinnormal_vertex"]="#ifdef USE_SKINNING\n\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;
112\n\tskinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;\n\n\t#ifdef USE_MORPHNORMALS\n\n\tvec4 skinnedNormal = skinMatrix * vec4( morphedNormal, 0.0 );\n\n\t#else\n\n\tvec4 skinnedNormal = skinMatrix * vec4( normal, 0.0 );\n\n\t#endif\n\n#endif\n";e.ShaderChunk["logdepthbuf_pars_vertex"]="#ifdef USE_LOGDEPTHBUF\n\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\n\t\tvarying float vFragDepth;\n\n\t#endif\n\n\tuniform float logDepthBufFC;\n\n#endif";e.ShaderChunk["lightmap_pars_vertex"]="#ifdef USE_LIGHTMAP\n\n\tvarying vec2 vUv2;\n\n#endif" 113;e.ShaderChunk["lights_phong_fragment"]="#ifndef FLAT_SHADED\n\n\tvec3 normal = normalize( vNormal );\n\n\t#ifdef DOUBLE_SIDED\n\n\t\tnormal = normal * ( -1.0 + 2.0 * float( gl_FrontFacing ) );\n\n\t#endif\n\n#else\n\n\tvec3 fdx = dFdx( vViewPosition );\n\tvec3 fdy = dFdy( vViewPosition );\n\tvec3 normal = normalize( cross( fdx, fdy ) );\n\n#endif\n\nvec3 viewPosition = normalize( vViewPosition );\n\n#ifdef USE_NORMALMAP\n\n\tnormal = perturbNormal2Arb( -vViewPosition, normal );\n\n#elif defined( USE_BUMPMAP )\n\n\tnormal = perturbNormalArb( -vViewPosition, normal, dHdxy_fwd() );\n\n#endif\n\nvec3 totalDiffuseLight = vec3( 0.0 );\nvec3 totalSpecularLight = vec3( 0.0 );\n\n#if MAX_POINT_LIGHTS > 0\n\n\tfor ( int i = 0; i < MAX_POINT_LIGHTS; i ++ ) {\n\n\t\tvec4 lPosition = viewMatrix * vec4( pointLightPosition[ i ], 1.0 );\n\t\tvec3 lVector = lPosition.xyz + vViewPosition.xyz;\n\n\t\tfloat attenuation = calcLightAttenuation( length( lVector ), pointLightDistance[ i ], pointLightDecay[ i ] );\n\n\t\tlVector = normalize( lVector );\n\n\t\t// diffuse\n\n\t\tfloat dotProduct = dot( normal, lVector );\n\n\t\t#ifdef WRAP_AROUND\n\n\t\t\tfloat pointDiffuseWeightFull = max( dotProduct, 0.0 );\n\t\t\tfloat pointDiffuseWeightHalf = max( 0.5 * dotProduct + 0.5, 0.0 );\n\n\t\t\tvec3 pointDiffuseWeight = mix( vec3( pointDiffuseWeightFull ), vec3( pointDiffuseWeightHalf ), wrapRGB );\n\n\t\t#else\n\n\t\t\tfloat pointDiffuseWeight = max( dotProduct, 0.0 );\n\n\t\t#endif\n\n\t\ttotalDiffuseLight += pointLightColor[ i ] * pointDiffuseWeight * attenuation;\n\n\t\t\t\t// specular\n\n\t\tvec3 pointHalfVector = normalize( lVector + viewPosition );\n\t\tfloat pointDotNormalHalf = max( dot( normal, pointHalfVector ), 0.0 );\n\t\tfloat pointSpecularWeight = specularStrength * max( pow( pointDotNormalHalf, shininess ), 0.0 );\n\n\t\tfloat specularNormalization = ( shininess + 2.0 ) / 8.0;\n\n\t\tvec3 schlick = specular + vec3( 1.0 - specular ) * pow( max( 1.0 - dot( lVector, pointHalfVector ), 0.0 ), 5.0 );\n\t\ttotalSpecularLight += schlick * pointLightColor[ i ] * pointSpecularWeight * pointDiffuseWeight * attenuation * specularNormalization;\n\n\t}\n\n#endif\n\n#if MAX_SPOT_LIGHTS > 0\n\n\tfor ( int i = 0; i < MAX_SPOT_LIGHTS; i ++ ) {\n\n\t\tvec4 lPosition = viewMatrix * vec4( spotLightPosition[ i ], 1.0 );\n\t\tvec3 lVector = lPosition.xyz + vViewPosition.xyz;\n\n\t\tfloat attenuation = calcLightAttenuation( length( lVector ), spotLightDistance[ i ], spotLightDecay[ i ] );\n\n\t\tlVector = normalize( lVector );\n\n\t\tfloat spotEffect = dot( spotLightDirection[ i ], normalize( spotLightPosition[ i ] - vWorldPosition ) );\n\n\t\tif ( spotEffect > spotLightAngleCos[ i ] ) {\n\n\t\t\tspotEffect = max( pow( max( spotEffect, 0.0 ), spotLightExponent[ i ] ), 0.0 );\n\n\t\t\t// diffuse\n\n\t\t\tfloat dotProduct = dot( normal, lVector );\n\n\t\t\t#ifdef WRAP_AROUND\n\n\t\t\t\tfloat spotDiffuseWeightFull = max( dotProduct, 0.0 );\n\t\t\t\tfloat spotDiffuseWeightHalf = max( 0.5 * dotProduct + 0.5, 0.0 );\n\n\t\t\t\tvec3 spotDiffuseWeight = mix( vec3( spotDiffuseWeightFull ), vec3( spotDiffuseWeightHalf ), wrapRGB );\n\n\t\t\t#else\n\n\t\t\t\tfloat spotDiffuseWeight = max( dotProduct, 0.0 );\n\n\t\t\t#endif\n\n\t\t\ttotalDiffuseLight += spotLightColor[ i ] * spotDiffuseWeight * attenuation * spotEffect;\n\n\t\t\t// specular\n\n\t\t\tvec3 spotHalfVector = normalize( lVector + viewPosition );\n\t\t\tfloat spotDotNormalHalf = max( dot( normal, spotHalfVector ), 0.0 );\n\t\t\tfloat spotSpecularWeight = specularStrength * max( pow( spotDotNormalHalf, shininess ), 0.0 );\n\n\t\t\tfloat specularNormalization = ( shininess + 2.0 ) / 8.0;\n\n\t\t\tvec3 schlick = specular + vec3( 1.0 - specular ) * pow( max( 1.0
113- dot( lVector, spotHalfVector ), 0.0 ), 5.0 );\n\t\t\ttotalSpecularLight += schlick * spotLightColor[ i ] * spotSpecularWeight * spotDiffuseWeight * attenuation * specularNormalization * spotEffect;\n\n\t\t}\n\n\t}\n\n#endif\n\n#if MAX_DIR_LIGHTS > 0\n\n\tfor( int i = 0; i < MAX_DIR_LIGHTS; i ++ ) {\n\n\t\tvec3 dirVector = transformDirection( directionalLightDirection[ i ], viewMatrix );\n\n\t\t// diffuse\n\n\t\tfloat dotProduct = dot( normal, dirVector );\n\n\t\t#ifdef WRAP_AROUND\n\n\t\t\tfloat dirDiffuseWeightFull = max( dotProduct, 0.0 );\n\t\t\tfloat dirDiffuseWeightHalf = max( 0.5 * dotProduct + 0.5, 0.0 );\n\n\t\t\tvec3 dirDiffuseWeight = mix( vec3( dirDiffuseWeightFull ), vec3( dirDiffuseWeightHalf ), wrapRGB );\n\n\t\t#else\n\n\t\t\tfloat dirDiffuseWeight = max( dotProduct, 0.0 );\n\n\t\t#endif\n\n\t\ttotalDiffuseLight += directionalLightColor[ i ] * dirDiffuseWeight;\n\n\t\t// specular\n\n\t\tvec3 dirHalfVector = normalize( dirVector + viewPosition );\n\t\tfloat dirDotNormalHalf = max( dot( normal, dirHalfVector ), 0.0 );\n\t\tfloat dirSpecularWeight = specularStrength * max( pow( dirDotNormalHalf, shininess ), 0.0 );\n\n\t\t/*\n\t\t// fresnel term from skin shader\n\t\tconst float F0 = 0.128;\n\n\t\tfloat base = 1.0 - dot( viewPosition, dirHalfVector );\n\t\tfloat exponential = pow( base, 5.0 );\n\n\t\tfloat fresnel = exponential + F0 * ( 1.0 - exponential );\n\t\t*/\n\n\t\t/*\n\t\t// fresnel term from fresnel shader\n\t\tconst float mFresnelBias = 0.08;\n\t\tconst float mFresnelScale = 0.3;\n\t\tconst float mFresnelPower = 5.0;\n\n\t\tfloat fresnel = mFresnelBias + mFresnelScale * pow( 1.0 + dot( normalize( -viewPosition ), normal ), mFresnelPower );\n\t\t*/\n\n\t\tfloat specularNormalization = ( shininess + 2.0 ) / 8.0;\n\n\t\t// \t\tdirSpecular += specular * directionalLightColor[ i ] * dirSpecularWeight * dirDiffuseWeight * specularNormalization * fresnel;\n\n\t\tvec3 schlick = specular + vec3( 1.0 - specular ) * pow( max( 1.0 - dot( dirVector, dirHalfVector ), 0.0 ), 5.0 );\n\t\ttotalSpecularLight += schlick * directionalLightColor[ i ] * dirSpecularWeight * dirDiffuseWeight * specularNormalization;\n\n\n\t}\n\n#endif\n\n#if MAX_HEMI_LIGHTS > 0\n\n\tfor( int i = 0; i < MAX_HEMI_LIGHTS; i ++ ) {\n\n\t\tvec3 lVector = transformDirection( hemisphereLightDirection[ i ], viewMatrix );\n\n\t\t// diffuse\n\n\t\tfloat dotProduct = dot( normal, lVector );\n\t\tfloat hemiDiffuseWeight = 0.5 * dotProduct + 0.5;\n\n\t\tvec3 hemiColor = mix( hemisphereLightGroundColor[ i ], hemisphereLightSkyColor[ i ], hemiDiffuseWeight );\n\n\t\ttotalDiffuseLight += hemiColor;\n\n\t\t// specular (sky light)\n\n\t\tvec3 hemiHalfVectorSky = normalize( lVector + viewPosition );\n\t\tfloat hemiDotNormalHalfSky = 0.5 * dot( normal, hemiHalfVectorSky ) + 0.5;\n\t\tfloat hemiSpecularWeightSky = specularStrength * max( pow( max( hemiDotNormalHalfSky, 0.0 ), shininess ), 0.0 );\n\n\t\t// specular (ground light)\n\n\t\tvec3 lVectorGround = -lVector;\n\n\t\tvec3 hemiHalfVectorGround = normalize( lVectorGround + viewPosition );\n\t\tfloat hemiDotNormalHalfGround = 0.5 * dot( normal, hemiHalfVectorGround ) + 0.5;\n\t\tfloat hemiSpecularWeightGround = specularStrength * max( pow( max( hemiDotNormalHalfGround, 0.0 ), shininess ), 0.0 );\n\n\t\tfloat dotProductGround = dot( normal, lVectorGround );\n\n\t\tfloat specularNormalization = ( shininess + 2.0 ) / 8.0;\n\n\t\tvec3 schlickSky = specular + vec3( 1.0 - specular ) * pow( max( 1.0 - dot( lVector, hemiHalfVectorSky ), 0.0 ), 5.0 );\n\t\tvec3 schlickGround = specular + vec3( 1.0 - specular ) * pow( max( 1.0 - dot( lVectorGround, hemiHalfVectorGround ), 0.0 ), 5.0 );\n\t\ttotalSpecularLight += hemiColor * specularNormalization * ( schlickSky * hemiSpecularWeightSky * max( dotProduct, 0.0 ) + schlickGround * hemiSpecularWeightGround * max( dotProductGround, 0.0 ) );\n\n\t}\n\n#endif\n\n#ifdef METAL\n\n\toutgoingLight += diffuseColor.rgb * ( totalDiffuseLight + ambientLightColor ) * specular + totalSpecularLight + emissive;\n\n#else\n\n\toutgoingLight += diffuseColor.rgb * ( totalDiffuseLight + ambientLightColor ) + totalSpecularLight + emissive;\n\n#endif\n";e.ShaderChunk["fog_pars_fragment"]="#ifdef USE_FOG\n\n\tuniform vec3 fogColor;\n\n\t#ifdef FOG_EXP2\n\n\t\tuniform float fogDensity;\n\n\t#else\n\n\t\tuniform float fogNear;\n\t\tuniform float fogFar;\n\t#endif\n\n#endif";e.ShaderChunk["morphnormal_vertex"]="#ifdef USE_MORPHNORMALS\n\n\tvec3 morphedNormal = vec3( 0.0 );\n\n\tmorphedNormal += ( morphNormal0 - normal ) * morphTargetInfluences[ 0 ];\n\tmorphedNormal += ( morphNormal1 - normal ) * morphTargetInfluences[ 1 ];\n\tmorphedNormal += ( morphNormal2 - normal ) * morphTargetInfluences[ 2 ];\n\tmorphedNormal += ( morphNormal3 - normal ) * morphTargetInfluences[ 3 ];\n\n\tmorphedNormal += normal;\n\n#endif";e.ShaderChunk["envmap_pars_fragment"]="#ifdef USE_ENVMAP\n\n\tuniform float reflectivity;\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\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\n\t\tuniform float refractionRatio;\n\n\t#else\n\n\t\tvarying vec3 vReflect;\n\n\t#endif\n\n#endif\n";e.ShaderChunk["logdepthbuf_fragment"]="#if defined(USE_LOGDEPTHBUF) && defined(USE_LOGDEPTHBUF_EXT)\n\n\tgl_FragDepthEXT = log2(vFragDepth) * logDepthBufFC * 0.5;\n\n#endif";e.ShaderChunk["normalmap_pars_fragment"]="#ifdef USE_NORMALMAP\n\n\tuniform sampler2D normalMap;\n\tuniform vec2 normalScale;\n\n\t// Per-Pixel Tangent Space Normal Mapping\n\t// http://hacksoflife.blogspot.ch/2009/11/per-pixel-tangent-space-normal-mapping.html\n\n\tvec3 perturbN
113ormal2Arb( vec3 eye_pos, vec3 surf_norm ) {\n\n\t\tvec3 q0 = dFdx( eye_pos.xyz );\n\t\tvec3 q1 = dFdy( eye_pos.xyz );\n\t\tvec2 st0 = dFdx( vUv.st );\n\t\tvec2 st1 = dFdy( vUv.st );\n\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\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\n\t}\n\n#endif\n";e.ShaderChunk["lights_phong_pars_vertex"]="#if MAX_SPOT_LIGHTS > 0 || defined( USE_BUMPMAP ) || defined( USE_ENVMAP )\n\n\tvarying vec3 vWorldPosition;\n\n#endif\n";e.ShaderChunk["lightmap_pars_fragment"]="#ifdef USE_LIGHTMAP\n\n\tvarying vec2 vUv2;\n\tuniform sampler2D lightMap;\n\n#endif";e.ShaderChunk["shadowmap_vertex"]="#ifdef USE_SHADOWMAP\n\n\tfor( int i = 0; i < MAX_SHADOWS; i ++ ) {\n\n\t\tvShadowCoord[ i ] = shadowMatrix[ i ] * worldPosition;\n\n\t}\n\n#endif";e.ShaderChunk["lights_phong_vertex"]="#if MAX_SPOT_LIGHTS > 0 || defined( USE_BUMPMAP ) || defined( USE_ENVMAP )\n\n\tvWorldPosition = worldPosition.xyz;\n\n#endif";e.ShaderChunk["map_fragment"]="#ifdef USE_MAP\n\n\tvec4 texelColor = texture2D( map, vUv );\n\n\ttexelColor.xyz = inputToLinear( texelColor.xyz );\n\n\tdiffuseColor *= texelColor;\n\n#endif";e.ShaderChunk["lightmap_vertex"]="#ifdef USE_LIGHTMAP\n\n\tvUv2 = uv2;\n\n#endif";e.ShaderChunk["map_particle_fragment"]="#ifdef USE_MAP\n\n\tdiffuseColor *= texture2D( map, vec2( gl_PointCoord.x, 1.0 - gl_PointCoord.y ) * offsetRepeat.zw + offsetRepeat.xy );\n\n#endif\n";e.ShaderChunk["color_pars_fragment"]="#ifdef USE_COLOR\n\n\tvarying vec3 vColor;\n\n#endif\n";e.ShaderChunk["color_vertex"]="#ifdef USE_COLOR\n\n\tvColor.xyz = inputToLinear( color.xyz );\n\n#endif";e.ShaderChunk["skinning_vertex"]="#ifdef USE_SKINNING\n\n\t#ifdef USE_MORPHTARGETS\n\n\tvec4 skinVertex = bindMatrix * vec4( morphed, 1.0 );\n\n\t#else\n\n\tvec4 skinVertex = bindMatrix * vec4( position, 1.0 );\n\n\t#endif\n\n\tvec4 skinned = vec4( 0.0 );\n\tskinned += boneMatX * skinVertex * skinWeight.x;\n\tskinned += boneMatY * skinVertex * skinWeight.y;\n\tskinned += boneMatZ * skinVertex * skinWeight.z;\n\tskinned += boneMatW * skinVertex * skinWeight.w;\n\tskinned = bindMatrixInverse * skinned;\n\n#endif\n";e.ShaderChunk["envmap_pars_vertex"]="#if defined( USE_ENVMAP ) && ! defined( USE_BUMPMAP ) && ! defined( USE_NORMALMAP ) && ! defined( PHONG )\n\n\tvarying vec3 vReflect;\n\n\tuniform float refractionRatio;\n\n#endif\n";e.ShaderChunk["linear_to_gamma_fragment"]="\n\toutgoingLight = linearToOutput( outgoingLight );\n";e.ShaderChunk["color_pars_vertex"]="#ifdef USE_COLOR\n\n\tvarying vec3 vColor;\n\n#endif";e.ShaderChunk["lights_lambert_pars_vertex"]="uniform vec3 ambientLightColor;\n\n#if MAX_DIR_LIGHTS > 0\n\n\tuniform vec3 directionalLightColor[ MAX_DIR_LIGHTS ];\n\tuniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\n\n#endif\n\n#if MAX_HEMI_LIGHTS > 0\n\n\tuniform vec3 hemisphereLightSkyColor[ MAX_HEMI_LIGHTS ];\n\tuniform vec3 hemisphereLightGroundColor[ MAX_HEMI_LIGHTS ];\n\tuniform vec3 hemisphereLightDirection[ MAX_HEMI_LIGHTS ];\n\n#endif\n\n#if MAX_POINT_LIGHTS > 0\n\n\tuniform vec3 pointLightColor[ MAX_POINT_LIGHTS ];\n\tuniform vec3 pointLightPosition[ MAX_POINT_LIGHTS ];\n\tuniform float pointLightDistance[ MAX_POINT_LIGHTS ];\n\tuniform float pointLightDecay[ MAX_POINT_LIGHTS ];\n\n#endif\n\n#if MAX_SPOT_LIGHTS > 0\n\n\tuniform vec3 spotLightColor[ MAX_SPOT_LIGHTS ];\n\tuniform vec3 spotLightPosition[ MAX_SPOT_LIGHTS ];\n\tuniform vec3 spotLightDirection[ MAX_SPOT_LIGHTS ];\n\tuniform float spotLightDistance[ MAX_SPOT_LIGHTS ];\n\tuniform float spotLightAngleCos[ MAX_SPOT_LIGHTS ];\n\tuniform float spotLightExponent[ MAX_SPOT_LIGHTS ];\n\tuniform float spotLightDecay[ MAX_SPOT_LIGHTS ];\n\n#endif\n\n#ifdef WRAP_AROUND\n\n\tuniform vec3 wrapRGB;\n\n#endif\n";e.ShaderChunk["map_pars_vertex"]="#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP )\n\n\tvarying vec2 vUv;\n\tuniform vec4 offsetRepeat;\n\n#endif\n";e.ShaderChunk["envmap_fragment"]="#ifdef USE_ENVMAP\n\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\n\t\tvec3 cameraToVertex = normalize( vWorldPosition - cameraPosition );\n\n\t\t// Transforming Normal Vectors with the Inverse Transformation\n\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\n\t\t\tvec3 reflectVec = reflect( cameraToVertex, worldNormal );\n\n\t\t#else\n\n\t\t\tvec3 reflectVec = refract( cameraToVertex, worldNormal, refractionRatio );\n\n\t\t#endif\n\n\t#else\n\n\t\tvec3 reflectVec = vReflect;\n\n\t#endif\n\n\t#ifdef DOUBLE_SIDED\n\t\tfloat flipNormal = ( -1.0 + 2.0 * float( gl_FrontFacing ) );\n\t#else\n\t\tfloat flipNormal = 1.0;\n\t#endif\n\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 envColor = textureCube( envMap, flipNormal * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n\n\t#elif defined( ENVMAP_TYPE_EQUIREC )\n\t\tvec2 sampleUV;
113\n\t\tsampleUV.y = saturate( flipNormal * reflectVec.y * 0.5 + 0.5 );\n\t\tsampleUV.x = atan( flipNormal * reflectVec.z, flipNormal * reflectVec.x ) * RECIPROCAL_PI2 + 0.5;\n\t\tvec4 envColor = texture2D( envMap, sampleUV );\n\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#endif\n\n\tenvColor.xyz = inputToLinear( envColor.xyz );\n\n\t#ifdef ENVMAP_BLENDING_MULTIPLY\n\n\t\toutgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n\n\t#elif defined( ENVMAP_BLENDING_MIX )\n\n\t\toutgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n\n\t#elif defined( ENVMAP_BLENDING_ADD )\n\n\t\toutgoingLight += envColor.xyz * specularStrength * reflectivity;\n\n\t#endif\n\n#endif\n";e.ShaderChunk["specularmap_pars_fragment"]="#ifdef USE_SPECULARMAP\n\n\tuniform sampler2D specularMap;\n\n#endif";e.ShaderChunk["logdepthbuf_vertex"]="#ifdef USE_LOGDEPTHBUF\n\n\tgl_Position.z = log2(max( EPSILON, gl_Position.w + 1.0 )) * logDepthBufFC;\n\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\n\t\tvFragDepth = 1.0 + gl_Position.w;\n\n#else\n\n\t\tgl_Position.z = (gl_Position.z - 1.0) * gl_Position.w;\n\n\t#endif\n\n#endif";e.ShaderChunk["morphtarget_pars_vertex"]="#ifdef USE_MORPHTARGETS\n\n\t#ifndef USE_MORPHNORMALS\n\n\tuniform float morphTargetInfluences[ 8 ];\n\n\t#else\n\n\tuniform float morphTargetInfluences[ 4 ];\n\n\t#endif\n\n#endif";e.ShaderChunk["specularmap_fragment"]="float specularStrength;\n\n#ifdef USE_SPECULARMAP\n\n\tvec4 texelSpecular = texture2D( specularMap, vUv );\n\tspecularStrength = texelSpecular.r;\n\n#else\n\n\tspecularStrength = 1.0;\n\n#endif";e.ShaderChunk["fog_fragment"]="#ifdef USE_FOG\n\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\n\t\tfloat depth = gl_FragDepthEXT / gl_FragCoord.w;\n\n\t#else\n\n\t\tfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n\n\t#endif\n\n\t#ifdef FOG_EXP2\n\n\t\tfloat fogFactor = exp2( - square( fogDensity ) * square( depth ) * LOG2 );\n\t\tfogFactor = whiteCompliment( fogFactor );\n\n\t#else\n\n\t\tfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n\n\t#endif\n\t\n\toutgoingLight = mix( outgoingLight, fogColor, fogFactor );\n\n#endif";e.ShaderChunk["bumpmap_pars_fragment"]="#ifdef USE_BUMPMAP\n\n\tuniform sampler2D bumpMap;\n\tuniform float bumpScale;\n\n\t// Derivative maps - bump mapping unparametrized surfaces by Morten Mikkelsen\n\t// http://mmikkelsen3d.blogspot.sk/2011/07/derivative-maps.html\n\n\t// Evaluate the derivative of the height w.r.t. screen-space using forward differencing (listing 2)\n\n\tvec2 dHdxy_fwd() {\n\n\t\tvec2 dSTdx = dFdx( vUv );\n\t\tvec2 dSTdy = dFdy( vUv );\n\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\n\t\treturn vec2( dBx, dBy );\n\n\t}\n\n\tvec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy ) {\n\n\t\tvec3 vSigmaX = dFdx( surf_pos );\n\t\tvec3 vSigmaY = dFdy( surf_pos );\n\t\tvec3 vN = surf_norm;\t\t// normalized\n\n\t\tvec3 R1 = cross( vSigmaY, vN );\n\t\tvec3 R2 = cross( vN, vSigmaX );\n\n\t\tfloat fDet = dot( vSigmaX, R1 );\n\n\t\tvec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n\t\treturn normalize( abs( fDet ) * surf_norm - vGrad );\n\n\t}\n\n#endif\n";e.ShaderChunk["defaultnormal_vertex"]="#ifdef USE_SKINNING\n\n\tvec3 objectNormal = skinnedNormal.xyz;\n\n#elif defined( USE_MORPHNORMALS )\n\n\tvec3 objectNormal = morphedNormal;\n\n#else\n\n\tvec3 objectNormal = normal;\n\n#endif\n\n#ifdef FLIP_SIDED\n\n\tobjectNormal = -objectNormal;\n\n#endif\n\nvec3 transformedNormal = normalMatrix * objectNormal;\n";e.ShaderChunk["lights_phong_pars_fragment"]="uniform vec3 ambientLightColor;\n\n#if MAX_DIR_LIGHTS > 0\n\n\tuniform vec3 directionalLightColor[ MAX_DIR_LIGHTS ];\n\tuniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\n\n#endif\n\n#if MAX_HEMI_LIGHTS > 0\n\n\tuniform vec3 hemisphereLightSkyColor[ MAX_HEMI_LIGHTS ];\n\tuniform vec3 hemisphereLightGroundColor[ MAX_HEMI_LIGHTS ];\n\tuniform vec3 hemisphereLightDirection[ MAX_HEMI_LIGHTS ];\n\n#endif\n\n#if MAX_POINT_LIGHTS > 0\n\n\tuniform vec3 pointLightColor[ MAX_POINT_LIGHTS ];\n\n\tuniform vec3 pointLightPosition[ MAX_POINT_LIGHTS ];\n\tuniform float pointLightDistance[ MAX_POINT_LIGHTS ];\n\tuniform float pointLightDecay[ MAX_POINT_LIGHTS ];
113\n\n#endif\n\n#if MAX_SPOT_LIGHTS > 0\n\n\tuniform vec3 spotLightColor[ MAX_SPOT_LIGHTS ];\n\tuniform vec3 spotLightPosition[ MAX_SPOT_LIGHTS ];\n\tuniform vec3 spotLightDirection[ MAX_SPOT_LIGHTS ];\n\tuniform float spotLightAngleCos[ MAX_SPOT_LIGHTS ];\n\tuniform float spotLightExponent[ MAX_SPOT_LIGHTS ];\n\tuniform float spotLightDistance[ MAX_SPOT_LIGHTS ];\n\tuniform float spotLightDecay[ MAX_SPOT_LIGHTS ];\n\n#endif\n\n#if MAX_SPOT_LIGHTS > 0 || defined( USE_BUMPMAP ) || defined( USE_ENVMAP )\n\n\tvarying vec3 vWorldPosition;\n\n#endif\n\n#ifdef WRAP_AROUND\n\n\tuniform vec3 wrapRGB;\n\n#endif\n\nvarying vec3 vViewPosition;\n\n#ifndef FLAT_SHADED\n\n\tvarying vec3 vNormal;\n\n#endif\n";e.ShaderChunk["skinbase_vertex"]="#ifdef USE_SKINNING\n\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\n#endif";e.ShaderChunk["map_vertex"]="#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP )\n\n\tvUv = uv * offsetRepeat.zw + offsetRepeat.xy;\n\n#endif";e.ShaderChunk["lightmap_fragment"]="#ifdef USE_LIGHTMAP\n\n\toutgoingLight *= diffuseColor.xyz * texture2D( lightMap, vUv2 ).xyz;\n\n#endif";e.ShaderChunk["shadowmap_pars_vertex"]="#ifdef USE_SHADOWMAP\n\n\tvarying vec4 vShadowCoord[ MAX_SHADOWS ];\n\tuniform mat4 shadowMatrix[ MAX_SHADOWS ];\n\n#endif";e.ShaderChunk["color_fragment"]="#ifdef USE_COLOR\n\n\tdiffuseColor.rgb *= vColor;\n\n#endif";e.ShaderChunk["morphtarget_vertex"]="#ifdef USE_MORPHTARGETS\n\n\tvec3 morphed = vec3( 0.0 );\n\tmorphed += ( morphTarget0 - position ) * morphTargetInfluences[ 0 ];\n\tmorphed += ( morphTarget1 - position ) * morphTargetInfluences[ 1 ];\n\tmorphed += ( morphTarget2 - position ) * morphTargetInfluences[ 2 ];\n\tmorphed += ( morphTarget3 - position ) * morphTargetInfluences[ 3 ];\n\n\t#ifndef USE_MORPHNORMALS\n\n\tmorphed += ( morphTarget4 - position ) * morphTargetInfluences[ 4 ];\n\tmorphed += ( morphTarget5 - position ) * morphTargetInfluences[ 5 ];\n\tmorphed += ( morphTarget6 - position ) * morphTargetInfluences[ 6 ];\n\tmorphed += ( morphTarget7 - position ) * morphTargetInfluences[ 7 ];\n\n\t#endif\n\n\tmorphed += position;\n\n#endif";e.ShaderChunk["envmap_vertex"]="#if defined( USE_ENVMAP ) && ! defined( USE_BUMPMAP ) && ! defined( USE_NORMALMAP ) && ! defined( PHONG )\n\n\tvec3 worldNormal = transformDirection( objectNormal, modelMatrix );
113\n\n\tvec3 cameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n\n\t#ifdef ENVMAP_MODE_REFLECTION\n\n\t\tvReflect = reflect( cameraToVertex, worldNormal );\n\n\t#else\n\n\t\tvReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n\n\t#endif\n\n#endif\n";e.ShaderChunk["shadowmap_fragment"]="#ifdef USE_SHADOWMAP\n\n\t#ifdef SHADOWMAP_DEBUG\n\n\t\tvec3 frustumColors[3];\n\t\tfrustumColors[0] = vec3( 1.0, 0.5, 0.0 );\n\t\tfrustumColors[1] = vec3( 0.0, 1.0, 0.8 );\n\t\tfrustumColors[2] = vec3( 0.0, 0.5, 1.0 );\n\n\t#endif\n\n\t#ifdef SHADOWMAP_CASCADE\n\n\t\tint inFrustumCount = 0;\n\n\t#endif\n\n\tfloat fDepth;\n\tvec3 shadowColor = vec3( 1.0 );\n\n\tfor( int i = 0; i < MAX_SHADOWS; i ++ ) {\n\n\t\tvec3 shadowCoord = vShadowCoord[ i ].xyz / vShadowCoord[ i ].w;\n\n\t\t\t\t// if ( something && something ) breaks ATI OpenGL shader compiler\n\t\t\t\t// if ( all( something, something ) ) using this instead\n\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\n\t\t\t\t// don't shadow pixels outside of light frustum\n\t\t\t\t// use just first frustum (for cascades)\n\t\t\t\t// don't shadow pixels behind far plane of light frustum\n\n\t\t#ifdef SHADOWMAP_CASCADE\n\n\t\t\tinFrustumCount += int( inFrustum );\n\t\t\tbvec3 frustumTestVec = bvec3( inFrustum, inFrustumCount == 1, shadowCoord.z <= 1.0 );\n\n\t\t#else\n\n\t\t\tbvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 );\n\n\t\t#endif\n\n\t\tbool frustumTest = all( frustumTestVec );\n\n\t\tif ( frustumTest ) {\n\n\t\t\tshadowCoord.z += shadowBias[ i ];\n\n\t\t\t#if defined( SHADOWMAP_TYPE_PCF )\n\n\t\t\t\t\t\t// Percentage-close filtering\n\t\t\t\t\t\t// (9 pixel kernel)\n\t\t\t\t\t\t// http://fabiensanglard.net/shadowmappingPCF/\n\n\t\t\t\tfloat shadow = 0.0;\n\n\t\t/*\n\t\t\t\t\t\t// nested loops breaks shader compiler / validator on some ATI cards when using OpenGL\n\t\t\t\t\t\t// must enroll loop manually\n\n\t\t\t\tfor ( float y = -1.25; y <= 1.25; y += 1.25 )\n\t\t\t\t\tfor ( float x = -1.25; x <= 1.25; x += 1.25 ) {\n\n\t\t\t\t\t\tvec4 rgbaDepth = texture2D( shadowMap[ i ], vec2( x * xPixelOffset, y * yPixelOffset ) + shadowCoord.xy );\n\n\t\t\t\t\t\t\t\t// doesn't seem to produce any noticeable visual difference compared to simple texture2D lookup\n\t\t\t\t\t\t\t\t//vec4 rgbaDepth = texture2DProj( shadowMap[ i ], vec4( vShadowCoord[ i ].w * ( vec2( x * xPixelOffset, y * yPixelOffset ) + shadowCoord.xy ), 0.05, vShadowCoord[ i ].w ) );\n\n\t\t\t\t\t\tfloat fDepth = unpackDepth( rgbaDepth );\n\n\t\t\t\t\t\tif ( fDepth < shadowCoord.z )\n\t\t\t\t\t\t\tshadow += 1.0;\n\n\t\t\t\t}\n\n\t\t\t\tshadow /= 9.0;\n\n\t\t*/\n\n\t\t\t\tconst float shadowDelta = 1.0 / 9.0;\n\n\t\t\t\tfloat xPixelOffset = 1.0 / shadowMapSize[ i ].x;\n\t\t\t\tfloat yPixelOffset = 1.0 / shadowMapSize[ i ].y;\n\n\t\t\t\tfloat dx0 = -1.25 * xPixelOffset;\n\t\t\t\tfloat dy0 = -1.25 * yPixelOffset;\n\t\t\t\tfloat dx1 = 1.25 * xPixelOffset;\n\t\t\t\tfloat dy1 = 1.25 * yPixelOffset;\n\n\t\t\t\tfDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx0, dy0 ) ) );\n\t\t\t\tif ( fDepth < shadowCoord.z ) shadow += shadowDelta;\n\n\t\t\t\tfDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( 0.0, dy0 ) ) );\n\t\t\t\tif ( fDepth < shadowCoord.z ) shadow += shadowDelta;\n\n\t\t\t\tfDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx1, dy0 ) ) );\n\t\t\t\tif ( fDepth < shadowCoord.z ) shadow += shadowDelta;\n\n\t\t\t\tfDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx0, 0.0 ) ) );\n\t\t\t\tif ( fDepth < shadowCoord.z ) shadow += shadowDelta;\n\n\t\t\t\tfDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy ) );\n\t\t\t\tif ( fDepth < shadowCoord.z ) shadow += shadowDelta;\n\n\t\t\t\tfDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx1, 0.0 ) ) );\n\t\t\t\tif ( fDepth < shadowCoord.z ) shadow += shadowDelta;\n\n\t\t\t\tfDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx0, dy1 ) ) );\n\t\t\t\tif ( fDepth < shadowCoord.z ) shadow += shadowDelta;\n\n\t\t\t\tfDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( 0.0, dy1 ) ) );\n\t\t\t\tif ( fDepth < shadowCoord.z ) shadow += shadowDelta;\n\n\t\t\t\tfDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx1, dy1 ) ) );\n\t\t\t\tif ( fDepth < shadowCoord.z ) shadow += shadowDelta;\n\n\t\t\t\tshadowColor = shadowColor * vec3( ( 1.0 - shadowDarkness[ i ] * shadow ) );\n\n\t\t\t#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n\n\t\t\t\t\t\t// Percentage-close filtering\n\t\t\t\t\t\t// (9 pixel kernel)\n\t\t\t\t\t\t// http://fabiensanglard.net/shadowmappingPCF/\n\n\t\t\t\tfloat shadow = 0.0;
113\n\n\t\t\t\tfloat xPixelOffset = 1.0 / shadowMapSize[ i ].x;\n\t\t\t\tfloat yPixelOffset = 1.0 / shadowMapSize[ i ].y;\n\n\t\t\t\tfloat dx0 = -1.0 * xPixelOffset;\n\t\t\t\tfloat dy0 = -1.0 * yPixelOffset;\n\t\t\t\tfloat dx1 = 1.0 * xPixelOffset;\n\t\t\t\tfloat dy1 = 1.0 * yPixelOffset;\n\n\t\t\t\tmat3 shadowKernel;\n\t\t\t\tmat3 depthKernel;\n\n\t\t\t\tdepthKernel[0][0] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx0, dy0 ) ) );\n\t\t\t\tdepthKernel[0][1] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx0, 0.0 ) ) );\n\t\t\t\tdepthKernel[0][2] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx0, dy1 ) ) );\n\t\t\t\tdepthKernel[1][0] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( 0.0, dy0 ) ) );\n\t\t\t\tdepthKernel[1][1] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy ) );\n\t\t\t\tdepthKernel[1][2] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( 0.0, dy1 ) ) );\n\t\t\t\tdepthKernel[2][0] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx1, dy0 ) ) );\n\t\t\t\tdepthKernel[2][1] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx1, 0.0 ) ) );\n\t\t\t\tdepthKernel[2][2] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx1, dy1 ) ) );\n\n\t\t\t\tvec3 shadowZ = vec3( shadowCoord.z );\n\t\t\t\tshadowKernel[0] = vec3(lessThan(depthKernel[0], shadowZ ));\n\t\t\t\tshadowKernel[0] *= vec3(0.25);\n\n\t\t\t\tshadowKernel[1] = vec3(lessThan(depthKernel[1], shadowZ ));\n\t\t\t\tshadowKernel[1] *= vec3(0.25);\n\n\t\t\t\tshadowKernel[2] = vec3(lessThan(depthKernel[2], shadowZ ));\n\t\t\t\tshadowKernel[2] *= vec3(0.25);\n\n\t\t\t\tvec2 fractionalCoord = 1.0 - fract( shadowCoord.xy * shadowMapSize[i].xy );\n\n\t\t\t\tshadowKernel[0] = mix( shadowKernel[1], shadowKernel[0], fractionalCoord.x );\n\t\t\t\tshadowKernel[1] = mix( shadowKernel[2], shadowKernel[1], fractionalCoord.x );\n\n\t\t\t\tvec4 shadowValues;\n\t\t\t\tshadowValues.x = mix( shadowKernel[0][1], shadowKernel[0][0], fractionalCoord.y );\n\t\t\t\tshadowValues.y = mix( shadowKernel[0][2], shadowKernel[0][1], fractionalCoord.y );\n\t\t\t\tshadowValues.z = mix( shadowKernel[1][1], shadowKernel[1][0], fractionalCoord.y );\n\t\t\t\tshadowValues.w = mix( shadowKernel[1][2], shadowKernel[1][1], fractionalCoord.y );\n\n\t\t\t\tshadow = dot( shadowValues, vec4( 1.0 ) );\n\n\t\t\t\tshadowColor = shadowColor * vec3( ( 1.0 - shadowDarkness[ i ] * shadow ) );\n\n\t\t\t#else\n\n\t\t\t\tvec4 rgbaDepth = texture2D( shadowMap[ i ], shadowCoord.xy );\n\t\t\t\tfloat fDepth = unpackDepth( rgbaDepth );\n\n\t\t\t\tif ( fDepth < shadowCoord.z )\n\n\t\t// spot with multiple shadows is darker\n\n\t\t\t\t\tshadowColor = shadowColor * vec3( 1.0 - shadowDarkness[ i ] );\n\n\t\t// spot with multiple shadows has the same color as single shadow spot\n\n\t\t// \t\t\t\t\tshadowColor = min( shadowColor, vec3( shadowDarkness[ i ] ) );\n\n\t\t\t#endif\n\n\t\t}\n\n\n\t\t#ifdef SHADOWMAP_DEBUG\n\n\t\t\t#ifdef SHADOWMAP_CASCADE\n\n\t\t\t\tif ( inFrustum && inFrustumCount == 1 ) outgoingLight *= frustumColors[ i ];\n\n\t\t\t#else\n\n\t\t\t\tif ( inFrustum ) outgoingLight *= frustumColors[ i ];\n\n\t\t\t#endif\n\n\t\t#endif\n\n\t}\n\n\t// NOTE: I am unsure if this is correct in linear space. -bhouston, Dec 29, 2014\n\tshadowColor = inputToLinear( shadowColor );\n\n\toutgoingLight = outgoingLight * shadowColor;\n\n#endif\n";e.ShaderChunk["worldpos_vertex"]="#if defined( USE_ENVMAP ) || defined( PHONG ) || defined( LAMBERT ) || defined ( USE_SHADOWMAP )\n\n\t#ifdef USE_SKINNING\n\n\t\tvec4 worldPosition = modelMatrix * skinned;\n\n\t#elif defined( USE_MORPHTARGETS )\n\n\t\tvec4 worldPosition = modelMatrix * vec4( morphed, 1.0 );\n\n\t#else\n\n\t\tvec4 worldPosition = modelMatrix * vec4( position, 1.0 );\n\n\t#endif\n\n#endif\n";e.ShaderChunk["shadowmap_pars_fragment"]="#ifdef USE_SHADOWMAP\n\n\tuniform sampler2D shadowMap[ MAX_SHADOWS ];\n\tuniform vec2 shadowMapSize[ MAX_SHADOWS ];\n\n\tuniform float shadowDarkness[ MAX_SHADOWS ];\n\tuniform float shadowBias[ MAX_SHADOWS ];\n\n\tvarying vec4 vShadowCoord[ MAX_SHADOWS ];\n\n\tfloat unpackDepth( const in vec4 rgba_depth ) {\n\n\t\tconst vec4 bit_shift = vec4( 1.0 / ( 256.0 * 256.0 * 256.0 ), 1.0 / ( 256.0 * 256.0 ), 1.0 / 256.0, 1.0 );\n\t\tfloat depth = dot( rgba_depth, bit_shift );\n\t\treturn depth;\n\n\t}\n\n#endif" 114;e.ShaderChunk["skinning_pars_vertex"]="#ifdef USE_SKINNING\n\n\tuniform mat4 bindMatrix;\n\tuniform mat4 bindMatrixInverse;\n\n\t#ifdef BONE_TEXTURE\n\n\t\tuniform sampler2D boneTexture;\n\t\tuniform int boneTextureWidth;\n\t\tuniform int boneTextureHeight;\n\n\t\tmat4 getBoneMatrix( const in float i ) {\n\n\t\t\tfloat j = i * 4.0;\n\t\t\tfloat x = mod( j, float( boneTextureWidth ) );\n\t\t\tfloat y = floor( j / float( boneTextureWidth ) );\n\n\t\t\tfloat dx = 1.0 / float( boneTextureWidth );\n\t\t\tfloat dy = 1.0 / float( boneTextureHeight );\n\n\t\t\ty = dy * ( y + 0.5 );\n\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\n\t\t\tmat4 bone = mat4( v1, v2, v3, v4 );\n\n\t\t\treturn bone;\n\n\t\t}\n\n\t#else\n\n\t\tuniform mat4 boneGlobalMatrices[ MAX_BONES ];\n\n\t\tmat4 getBoneMatrix( const in float i ) {\n\n\t\t\tmat4 bone = boneGlobalMatrices[ int(i) ];\n\t\t\treturn bone;\n\n\t\t}\n\n\t#endif\n\n#endif\n";e.ShaderChunk["logdepthbuf_pars_fragment"]="#ifdef USE_LOGDEPTHBUF\n\n\tuniform float logDepthBufFC;\n\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\n\t\t#extension GL_EXT_frag_depth : enable\n\t\tvarying float vFragDepth;\n\n\t#endif\n\n#endif";e.ShaderChunk["alphamap_fragment"]="#ifdef USE_ALPHAMAP\n\n\tdiffuseColor.a *= texture2D( alphaMap, vUv ).g;\n\n#endif\n";e.ShaderChunk["alphamap_pars_fragment"]="#ifdef USE_ALPHAMAP\n\n\tuniform sampler2D alphaMap;\n\n#endif\n";e.UniformsUtils={merge:function(e){var t={};for(var r=0;r<e.length;r++){var n=this.clone(e[r]);for(var i in n){t[i]=n[i]}}return t},clone:function(t){var r={};for(var n in t){r[n]={};for(var i in t[n]){var a=t[n][i];if(a instanceof e.Color||a instanceof e.Vector2||a instanceof e.Vector3||a instanceof e.Vector4||a instanceof e.Matrix4||a instanceof e.Texture){r[n][i]=a.clone()}else if(a instanceof Array){r[n][i]=a.slice()}else{r[n][i]=a}}}return r}};e.UniformsLib={common:{diffuse:{type:"c",value:new e.Color(15658734)},opacity:{type:"f",value:1},map:{type:"t",value:null},offsetRepeat:{type:"v4",value:new e.Vector4(0,0,1,1)},lightMap:{type:"t",value:null},specularMap:{type:"t",value:null},alphaMap:{type:"t",value:null},envMap:{type:"t",value:null},flipEnvMap:{type:"f",value:-1},reflectivity:{type:"f",value:1},refractionRatio:{type:"f",value:.98},morphTargetInfluences:{type:"f",value:0}},bump:{bumpMap:{type:"t",value:null},bumpScale:{type:"f",value:1}},normalmap:{normalMap:{type:"t",value:null},normalScale:{type:"v2",value:new e.Vector2(1,1)}},fog:{fogDensity:{type:"f",value:25e-5},fogNear:{type:"f",value:1},fogFar:{type:"f",value:2e3},fogColor:{type:"c",value:new e.Color(16777215)}},lights:{ambientLightColor:{type:"fv",value:[]},directionalLightDirection:{type:"fv",value:[]},directionalLightColor:{type:"fv",value:[]},hemisphereLightDirection:{type:"fv",value:[]},hemisphereLightSkyColor:{type:"fv",value:[]},hemisphereLightGroundColor:{type:"fv",value:[]},pointLightColor:{type:"fv",value:[]},pointLightPosition:{type:"fv",value:[]},pointLightDistance:{type:"fv1",value:[]},pointLightDecay:{type:"fv1",value:[]},spotLightColor:{type:"fv",value:[]},spotLightPosition:{type:"fv",value:[]},spotLightDirection:{type:"fv",value:[]},spotLightDistance:{type:"fv1",value:[]},spotLightAngleCos:{type:"fv1",value:[]},spotLightExponent:{type:"fv1",value:[]},spotLightDecay:{type:"fv1",value:[]}},particle:{psColor:{type:"c",value:new e.Color(15658734)},opacity:{type:"f",value:1},size:{type:"f",value:1},scale:{type:"f",value:1},map:{type:"t",value:null},offsetRepeat:{type:"v4",value:new e.Vector4(0,0,1,1)},fogDensity:{type:"f",value:25e-5},fogNear:{type:"f",value:1},fogFar:{type:"f",value:2e3},fogColor:{type:"c",value:new e.Color(16777215)}},shadowmap:{shadowMap:{type:"tv",value:[]},shadowMapSize:{type:"v2v",value:[]},shadowBias:{type:"fv1",value:[]},shadowDarkness:{type:"fv1",value:[]},shadowMatrix:{type:"m4v",value:[]}}};e.ShaderLib={basic:{uniforms:e.UniformsUtils.merge([e.UniformsLib["common"],e.UniformsLib["fog"],e.UniformsLib["shadowmap"]]),vertexShader:[e.ShaderChunk["common"],e.ShaderChunk["map_pars_vertex"],e.ShaderChunk["lightmap_pars_vertex"],e.ShaderChunk["envmap_pars_vertex"],e.ShaderChunk["color_pars_vertex"],e.ShaderChunk["morphtarget_pars_vertex"],e.ShaderChunk["skinning_pars_vertex"],e.ShaderChunk["shadowmap_pars_vertex"],e.ShaderChunk["logdepthbuf_pars_vertex"],"void main() {",e.ShaderChunk["map_vertex"],e.ShaderChunk["lightmap_vertex"],e.ShaderChunk["color_vertex"],e.ShaderChunk["skinbase_vertex"],"\t#ifdef USE_ENVMAP",e.ShaderChunk["morphnormal_vertex"],e.ShaderChunk["skinnormal_vertex"],e.ShaderChunk["defaultnormal_vertex"],"\t#endif",e.ShaderChunk["morphtarget_vertex"],e.ShaderChunk["skinning_vertex"],e.ShaderChunk["default_vertex"],e.ShaderChunk["logdepthbuf_vertex"],e.ShaderChunk["worldpos_vertex"],e.ShaderChunk["envmap_vertex"],e.ShaderChunk["shadowmap_vertex"],"}"].join("\n"),fragmentShader:["uniform vec3 diffuse;","uniform float opacity;",e.ShaderChunk["common"],e.ShaderChunk["color_pars_fragment"],e.ShaderChunk["map_pars_fragment"],e.ShaderChunk["alphamap_pars_fragment"],e.ShaderChunk["lightmap_pars_fragment"],e.ShaderChunk["envmap_pars_fragment"],e.ShaderChunk["fog_pars_fragment"],e.ShaderChunk["shadowmap_pars_fragment"],e.ShaderChunk["specularmap_pars_fragment"],e.ShaderChunk["logdepthbuf_pars_fragment"],"void main() {","\tvec3 outgoingLight = vec3( 0.0 );","\tvec4 diffuseColor = vec4( diffuse, opacity );",e.ShaderChunk["logdepthbuf_fragment"],e.ShaderChunk["map_fragment"],e.ShaderChunk["color_fragment"],e.ShaderChunk["alphamap_fragment"],e.ShaderChunk["alphatest_fragment"],e.ShaderChunk["specularmap_fragment"],"\toutgoingLight = diffuseColor.rgb;",e.ShaderChunk["lightmap_fragment"],e.ShaderChunk["envmap_fragment"],e.ShaderChunk["shadowmap_fragment"],e.ShaderChunk["linear_to_gamma_fragment"],e.ShaderChunk["fog_fragment"],"\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );","}"].join("\n")},lambert:{uniforms:e.UniformsUtils.merge([e.UniformsLib["common"],e.UniformsLib["fog"],e.UniformsLib["lights"],e.UniformsLib["shadowmap"],{emissive:{type:"c",value:new e.Color(0)},wrapRGB:{type:"v3",value:new e.Vector3(1,1,1)}}]),vertexShader:["#define LAMBERT","varying vec3 vLightFront;","#ifdef DOUBLE_SIDED","\tvarying vec3 vLightBack;","#endif",e.ShaderChunk["common"],e.ShaderChunk["map_pars_vertex"],e.ShaderChunk["lightmap_pars_vertex"],e.ShaderChunk["envmap_pars_vertex"],e.ShaderChunk["lights_lambert_pars_vertex"],e.ShaderChunk["color_pars_vertex"],e.ShaderChunk["morphtarget_pars_vertex"],e.ShaderChunk["skinning_pars_vertex"],e.ShaderChunk["shadowmap_pars_vertex"],e.ShaderChunk["logdepthbuf_pars_vertex"],"void main() {",e.ShaderChunk["map_vertex"],e.ShaderChunk["lightmap_vertex"],e.ShaderChunk["color_vertex"],e.ShaderChunk["morphnormal_vertex"],e.ShaderChunk["skinbase_vertex"],e.ShaderChunk["skinnormal_vertex"],e.ShaderChunk["defaultnormal_vertex"],e.ShaderChunk["morphtarget_vertex"],e.ShaderChunk["skinning_vertex"],e.ShaderChunk["default_vertex"],e.ShaderChunk["logdepthbuf_vertex"],e.ShaderChunk["worldpos_vertex"],e.ShaderChunk["envmap_vertex"],e.ShaderChunk["lights_lambert_vertex"],e.ShaderChunk["shadowmap_vertex"],"}"].join("\n"),fragmentShader:["uniform vec3 diffuse;","uniform vec3 emissive;","uniform float opacity;","varying vec3 vLightFront;","#ifdef DOUBLE_SIDED","\tvarying vec3 vLightBack;","#endif",e.ShaderChunk["common"],e.ShaderChunk["color_pars_fragment"],e.ShaderChunk["map_pars_fragment"],e.ShaderChunk["alphamap_pars_fragment"],e.ShaderChunk["lightmap_pars_fragment"],e.ShaderChunk["envmap_pars_fragment"],e.ShaderChunk["fog_pars_fragment"],e.ShaderChunk["shadowmap_pars_fragment"],e.ShaderChunk["specularmap_pars_fragment"],e.ShaderChunk["logdepthbuf_pars_fragment"],"void main() {","\tvec3 outgoingLight = vec3( 0.0 );","\tvec4 diffuseColor = vec4( diffuse, opacity );",e.ShaderChunk["logdepthbuf_fragment"],e.ShaderChunk["map_fragment"],e.ShaderChunk["color_fragment"],e.ShaderChunk["alphamap_fragment"],e.ShaderChunk["alphatest_fragment"],e.ShaderChunk["specularmap_fragment"],"\t#ifdef DOUBLE_SIDED","\t\tif ( gl_FrontFacing )","\t\t\toutgoingLight += diffuseColor.rgb * vLightFront + emissive;","\t\telse","\t\t\toutgoingLight += diffuseColor.rgb * vLightBack + emissive;","\t#else","\t\toutgoingLight += diffuseColor.rgb * vLightFront + emissive;","\t#endif",e.ShaderChunk["lightmap_fragment"],e.ShaderChunk["envmap_fragment"],e.ShaderChunk["shadowmap_fragment"],e.ShaderChunk["linear_to_gamma_fragment"],e.ShaderChunk["fog_fragment"],"\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );","}"].join("\n")},phong:{uniforms:e.UniformsUtils.merge([e.UniformsLib["common"],e.UniformsLib["bump"],e.UniformsLib["normalmap"],e.UniformsLib["fog"],e.UniformsLib["lights"],e.UniformsLib["shadowmap"],{emissive:{type:"c",value:new e.Color(0)},specular:{type:"c",value:new e.Color(1118481)},shininess:{type:"f",value:30},wrapRGB:{type:"v3",value:new e.Vector3(1,1,1)}}]),vertexShader:["#define PHONG","varying vec3 vViewPosition;","#ifndef FLAT_SHADED","\tvarying vec3 vNormal;","#endif",e.ShaderChunk["common"],e.ShaderChunk["map_pars_vertex"],e.ShaderChunk["lightmap_pars_vertex"],e.ShaderChunk["envmap_pars_vertex"],e.ShaderChunk["lights_phong_pars_vertex"],e.ShaderChunk["color_pars_vertex"],e.ShaderChunk["morphtarget_pars_vertex"],e.ShaderChunk["skinning_pars_vertex"],e.ShaderChunk["shadowmap_pars_vertex"],e.ShaderChunk["logdepthbuf_pars_vertex"],"void main() {",e.ShaderChunk["map_vertex"],e.ShaderChunk["lightmap_vertex"],e.ShaderChunk["color_vertex"],e.ShaderChunk["morphnormal_vertex"],e.ShaderChunk["skinbase_vertex"],e.ShaderChunk["skinnormal_vertex"],e.ShaderChunk["defaultnormal_vertex"],"#ifndef FLAT_SHADED","\tvNormal = normalize( transformedNormal );","#endif",e.ShaderChunk["morphtarget_vertex"],e.ShaderChunk["skinning_vertex"],e.ShaderChunk["default_vertex"],e.ShaderChunk["logdepthbuf_vertex"],"\tvViewPosition = -mvPosition.xyz;",e.ShaderChunk["worldpos_vertex"],e.ShaderChunk["envmap_vertex"],e.ShaderChunk["lights_phong_vertex"],e.ShaderChunk["shadowmap_vertex"],"}"].join("\n"),fragmentShader:["#define PHONG","uniform vec3 diffuse;","uniform vec3 emissive;","uniform vec3 specular;","uniform float shininess;","uniform float opacity;",e.ShaderChunk["common"],e.ShaderChunk["color_pars_fragment"],e.ShaderChunk["map_pars_fragment"],e.ShaderChunk["alphamap_pars_fragment"],e.ShaderChunk["lightmap_pars_fragment"],e.ShaderChunk["envmap_pars_fragment"],e.ShaderChunk["fog_pars_fragment"],e.ShaderChunk["lights_phong_pars_fragment"],e.ShaderChunk["shadowmap_pars_fragment"],e.ShaderChunk["bumpmap_pars_fragment"],e.ShaderChunk["normalmap_pars_fragment"],e.ShaderChunk["specularmap_pars_fragment"],e.ShaderChunk["logdepthbuf_pars_fragment"],"void main() {","\tvec3 outgoingLight = vec3( 0.0 );","\tvec4 diffuseColor = vec4( diffuse, opacity );",e.ShaderChunk["logdepthbuf_fragment"],e.ShaderChunk["map_fragment"],e.ShaderChunk["color_fragment"],e.ShaderChunk["alphamap_fragment"],e.ShaderChunk["alphatest_fragment"],e.ShaderChunk["specularmap_fragment"],e.ShaderChunk["lights_phong_fragment"],e.ShaderChunk["lightmap_fragment"],e.ShaderChunk["envmap_fragment"],e.ShaderChunk["shadowmap_fragment"],e.ShaderChunk["linear_to_gamma_fragment"],e.ShaderChunk["fog_fragment"],"\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );","}"].join("\n")},particle_basic:{uniforms:e.UniformsUtils.merge([e.UniformsLib["particle"],e.UniformsLib["shadowmap"]]),vertexShader:["uniform float size;","uniform float scale;",e.ShaderChunk["common"],e.ShaderChunk["color_pars_vertex"],e.ShaderChunk["shadowmap_pars_vertex"],e.ShaderChunk["logdepthbuf_pars_vertex"],"void main() {",e.ShaderChunk["color_vertex"],"\tvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );","\t#ifdef USE_SIZEATTENUATION","\t\tgl_PointSize = size *
114( scale / length( mvPosition.xyz ) );","\t#else","\t\tgl_PointSize = size;","\t#endif","\tgl_Position = projectionMatrix * mvPosition;",e.ShaderChunk["logdepthbuf_vertex"],e.ShaderChunk["worldpos_vertex"],e.ShaderChunk["shadowmap_vertex"],"}"].join("\n"),fragmentShader:["uniform vec3 psColor;","uniform float opacity;",e.ShaderChunk["common"],e.ShaderChunk["color_pars_fragment"],e.ShaderChunk["map_particle_pars_fragment"],e.ShaderChunk["fog_pars_fragment"],e.ShaderChunk["shadowmap_pars_fragment"],e.ShaderChunk["logdepthbuf_pars_fragment"],"void main() {","\tvec3 outgoingLight = vec3( 0.0 );","\tvec4 diffuseColor = vec4( psColor, opacity );",e.ShaderChunk["logdepthbuf_fragment"],e.ShaderChunk["map_particle_fragment"],e.ShaderChunk["color_fragment"],e.ShaderChunk["alphatest_fragment"],"\toutgoingLight = diffuseColor.rgb;",e.ShaderChunk["shadowmap_fragment"],e.ShaderChunk["fog_fragment"],"\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );","}"].join("\n")},dashed:{uniforms:e.UniformsUtils.merge([e.UniformsLib["common"],e.UniformsLib["fog"],{scale:{type:"f",value:1},dashSize:{type:"f",value:1},totalSize:{type:"f",value:2}}]),vertexShader:["uniform float scale;","attribute float lineDistance;","varying float vLineDistance;",e.ShaderChunk["common"],e.ShaderChunk["color_pars_vertex"],e.ShaderChunk["logdepthbuf_pars_vertex"],"void main() {",e.ShaderChunk["color_vertex"],"\tvLineDistance = scale * lineDistance;","\tvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );","\tgl_Position = projectionMatrix * mvPosition;",e.ShaderChunk["logdepthbuf_vertex"],"}"].join("\n"),fragmentShader:["uniform vec3 diffuse;","uniform float opacity;","uniform float dashSize;","uniform float totalSize;","varying float vLineDistance;",e.ShaderChunk["common"],e.ShaderChunk["color_pars_fragment"],e.ShaderChunk["fog_pars_fragment"],e.ShaderChunk["logdepthbuf_pars_fragment"],"void main() {","\tif ( mod( vLineDistance, totalSize ) > dashSize ) {","\t\tdiscard;","\t}","\tvec3 outgoingLight = vec3( 0.0 );","\tvec4 diffuseColor = vec4( diffuse, opacity );",e.ShaderChunk["logdepthbuf_fragment"],e.ShaderChunk["color_fragment"],"\toutgoingLight = diffuseColor.rgb;",e.ShaderChunk["fog_fragment"],"\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );","}"].join("\n")},depth:{uniforms:{mNear:{type:"f",value:1},mFar:{type:"f",value:2e3},opacity:{type:"f",value:1}},vertexShader:[e.ShaderChunk["common"],e.ShaderChunk["morphtarget_pars_vertex"],e.ShaderChunk["logdepthbuf_pars_vertex"],"void main() {",e.ShaderChunk["morphtarget_vertex"],e.ShaderChunk["default_vertex"],e.ShaderChunk["logdepthbuf_vertex"],"}"].join("\n"),fragmentShader:["uniform float mNear;","uniform float mFar;","uniform float opacity;",e.ShaderChunk["common"],e.ShaderChunk["logdepthbuf_pars_fragment"],"void main() {",e.ShaderChunk["logdepthbuf_fragment"],"\t#ifdef USE_LOGDEPTHBUF_EXT","\t\tfloat depth = gl_FragDepthEXT / gl_FragCoord.w;","\t#else","\t\tfloat depth = gl_FragCoord.z / gl_FragCoord.w;","\t#endif","\tfloat color = 1.0 - smoothstep( mNear, mFar, depth );","\tgl_FragColor = vec4( vec3( color ), opacity );","}"].join("\n")},normal:{uniforms:{opacity:{type:"f",value:1}},vertexShader:["varying vec3 vNormal;",e.ShaderChunk["common"],e.ShaderChunk["morphtarget_pars_vertex"],e.ShaderChunk["logdepthbuf_pars_vertex"],"void main() {","\tvNormal = normalize( normalMatrix * normal );",e.ShaderChunk["morphtarget_vertex"],e.ShaderChunk["default_vertex"],e.ShaderChunk["logdepthbuf_vertex"],"}"].join("\n"),fragmentShader:["uniform float opacity;","varying vec3 vNormal;",e.ShaderChunk["common"],e.ShaderChunk["logdepthbuf_pars_fragment"],"void main() {","\tgl_FragColor = vec4( 0.5 * normalize( vNormal ) + 0.5, opacity );",e.ShaderChunk["logdepthbuf_fragment"],"}"].join("\n")},cube:{uniforms:{tCube:{type:"t",value:null},tFlip:{type:"f",value:-1}},vertexShader:["varying vec3 vWorldPosition;",e.ShaderChunk["common"],e.ShaderChunk["logdepthbuf_pars_vertex"],"void main() {","\tvWorldPosition = transformDirection( position, modelMatrix );","\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",e.ShaderChunk["logdepthbuf_vertex"],"}"].join("\n"),fragmentShader:["uniform samplerCube tCube;","uniform float tFlip;","varying vec3 vWorldPosition;",e.ShaderChunk["common"],e.ShaderChunk["logdepthbuf_pars_fragment"],"void main() {","\tgl_FragColor = textureCube( tCube, vec3( tFlip * vWorldPosition.x, vWorldPosition.yz ) );",e.ShaderChunk["logdepthbuf_fragment"],"}"].join("\n")},equirect:{uniforms:{tEquirect:{type:"t",value:null},tFlip:{type:"f",value:-1}},vertexShader:["varying vec3 vWorldPosition;",e.ShaderChunk["common"],e.ShaderChunk["logdepthbuf_pars_vertex"],"void main() {","\tvWorldPosition = transformDirection( position, modelMatrix );","\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",e.ShaderChunk["logdepthbuf_vertex"],"}"].join("\n"),fragmentShader:["uniform sampler2D tEquirect;","uniform float tFlip;","varying vec3 vWorldPosition;",e.ShaderChunk["common"],e.ShaderChunk["logdepthbuf_pars_fragment"],"void main() {","vec3 direction = normalize( vWorldPosition );","vec2 sampleUV;
114","sampleUV.y = saturate( tFlip * direction.y * -0.5 + 0.5 );","sampleUV.x = atan( direction.z, direction.x ) * RECIPROCAL_PI2 + 0.5;","gl_FragColor = texture2D( tEquirect, sampleUV );",e.ShaderChunk["logdepthbuf_fragment"],"}"].join("\n")},depthRGBA:{uniforms:{},vertexShader:[e.ShaderChunk["common"],e.ShaderChunk["morphtarget_pars_vertex"],e.ShaderChunk["skinning_pars_vertex"],e.ShaderChunk["logdepthbuf_pars_vertex"],"void main() {",e.ShaderChunk["skinbase_vertex"],e.ShaderChunk["morphtarget_vertex"],e.ShaderChunk["skinning_vertex"],e.ShaderChunk["default_vertex"],e.ShaderChunk["logdepthbuf_vertex"],"}"].join("\n"),fragmentShader:[e.ShaderChunk["common"],e.ShaderChunk["logdepthbuf_pars_fragment"],"vec4 pack_depth( const in float depth ) {","\tconst vec4 bit_shift = vec4( 256.0 * 256.0 * 256.0, 256.0 * 256.0, 256.0, 1.0 );","\tconst vec4 bit_mask = vec4( 0.0, 1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0 );","\tvec4 res = mod( depth * bit_shift * vec4( 255 ), vec4( 256 ) ) / vec4( 255 );","\tres -= res.xxyz * bit_mask;","\treturn res;","}","void main() {",e.ShaderChunk["logdepthbuf_fragment"],"\t#ifdef USE_LOGDEPTHBUF_EXT","\t\tgl_FragData[ 0 ] = pack_depth( gl_FragDepthEXT );","\t#else","\t\tgl_FragData[ 0 ] = pack_depth( gl_FragCoord.z );","\t#endif","}"].join("\n")}};e.WebGLRenderer=function(t){t=t||{};var r=t.canvas!==undefined?t.canvas:document.createElement("canvas"),n=t.context!==undefined?t.context:null,i=1,a=t.precision!==undefined?t.precision:"highp",o=t.alpha!==undefined?t.alpha:false,s=t.depth!==undefined?t.depth:true,u=t.stencil!==undefined?t.stencil:true,l=t.antialias!==undefined?t.antialias:false,c=t.premultipliedAlpha!==undefined?t.premultipliedAlpha:true,f=t.preserveDrawingBuffer!==undefined?t.preserveDrawingBuffer:false,h=t.logarithmicDepthBuffer!==undefined?t.logarithmicDepthBuffer:false,d=new e.Color(0),p=0;var m=[];var v={};var y=[];var g=[];var b=[];var x=[];var _=[];this.domElement=r;this.context=null;this.autoClear=true;this.autoClearColor=true;this.autoClearDepth=true;this.autoClearStencil=true;this.sortObjects=true;this.gammaFactor=2;this.gammaInput=false;this.gammaOutput=false;this.shadowMapEnabled=false;this.shadowMapType=e.PCFShadowMap;this.shadowMapCullFace=e.CullFaceFront;this.shadowMapDebug=false;this.shadowMapCascade=false;this.maxMorphTargets=8;this.maxMorphNormals=4;this.autoScaleCubemaps=true;this.info={memory:{programs:0,geometries:0,textures:0},render:{calls:0,vertices:0,faces:0,points:0}};var w=this,C=[],E=null,S=null,T=-1,M="",A=null,P=0,R=0,k=0,I=r.width,D=r.height,B=0,L=0,F=new e.Frustum,V=new e.Matr
114ix4,O=new e.Vector3,U=new e.Vector3,N=true,z={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[],decays:[]},spot:{length:0,colors:[],positions:[],distances:[],directions:[],anglesCos:[],exponents:[],decays:[]},hemi:{length:0,skyColors:[],groundColors:[],positions:[]}};var H;var j=function(e){e.preventDefault();K();Y();v={}};try{var G={alpha:o,depth:s,stencil:u,antialias:l,premultipliedAlpha:c,preserveDrawingBuffer:f};H=n||r.getContext("webgl",G)||r.getContext("experimental-webgl",G);if(H===null){if(r.getContext("webgl")!==null){throw"Error creating WebGL context with your selected attributes."}else{throw"Error creating WebGL context."}}r.addEventListener("webglcontextlost",j,false)}catch(t){e.error("THREE.WebGLRenderer: "+t)}this.dispose=function(){r.removeEventListener("webglcontextlost",j,false)};var W=new e.WebGLState(H,Rt);if(H.getShaderPrecisionFormat===undefined){H.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}}}var q=new e.WebGLExtensions(H);q.get("OES_texture_float");q.get("OES_texture_float_linear");q.get("OES_texture_half_float");q.get("OES_texture_half_float_linear");q.get("OES_standard_derivatives");if(h){q.get("EXT_frag_depth")}var X=function(e,t,r,n){if(c===true){e*=n;t*=n;r*=n}H.clearColor(e,t,r,n)};var Y=function(){H.clearColor(0,0,0,1);H.clearDepth(1);H.clearStencil(0);H.enable(H.DEPTH_TEST);H.depthFunc(H.LEQUAL);H.frontFace(H.CCW);H.cullFace(H.BACK);H.enable(H.CULL_FACE);H.enable(H.BLEND);H.blendEquation(H.FUNC_ADD);H.blendFunc(H.SRC_ALPHA,H.ONE_MINUS_SRC_ALPHA);H.viewport(R,k,I,D);X(d.r,d.g,d.b,p)};var K=function(){E=null;A=null;M="";T=-1;N=true;W.reset()};Y();this.context=H;this.state=W;var Q=H.getParameter(H.MAX_TEXTURE_IMAGE_UNITS);var Z=H.getParameter(H.MAX_VERTEX_TEXTURE_IMAGE_UNITS);var J=H.getParameter(H.MAX_TEXTURE_SIZE);var $=H.getParameter(H.MAX_CUBE_MAP_TEXTURE_SIZE);var ee=Z>0;var te=ee&&q.get("OES_texture_float");var re=H.getShaderPrecisionFormat(H.VERTEX_SHADER,H.HIGH_FLOAT);var ne=H.getShaderPrecisionFormat(H.VERTEX_SHADER,H.MEDIUM_FLOAT);var ie=H.getShaderPrecisionFormat(H.FRAGMENT_SHADER,H.HIGH_FLOAT);var ae=H.getShaderPrecisionFormat(H.FRAGMENT_SHADER,H.MEDIUM_FLOAT);var oe=function(){var e;return function(){if(e!==undefined){return e}e=[];if(q.get("WEBGL_compressed_texture_pvrtc")||q.get("WEBGL_compressed_texture_s3tc")){var t=H.getParameter(H.COMPRESSED_TEXTURE_FORMATS);for(var r=0;r<t.length;r++){e.push(t[r])}}return e}}();var se=re.precision>0&&ie.precision>0;var ue=ne.precision>0&&ae.precision>0;if(a==="highp"&&!se){if(ue){a="mediump";e.warn("THREE.WebGLRenderer: highp not supported, using mediump.")}else{a="lowp";e.warn("THREE.WebGLRenderer: highp and mediump not supported, using lowp.")}}if(a==="mediump"&&!ue){a="lowp";e.warn("THREE.WebGLRenderer: mediump not supported, using lowp.")}var le=new e.ShadowMapPlugin(this,m,v,y);var ce=new e.SpritePlugin(this,x);var fe=new e.LensFlarePlugin(this,_);this.getContext=function(){return H};this.forceContextLoss=function(){q.get("WEBGL_lose_context").loseContext()};this.supportsVertexTextures=function(){return ee};this.supportsFloatTextures=function(){return q.get("OES_texture_float")};this.supportsHalfFloatTextures=function(){return q.get("OES_texture_half_float")};this.supportsStandardDerivatives=function(){return q.get("OES_standard_derivatives")};this.supportsCompressedTextureS3TC=function(){return q.get("WEBGL_compressed_texture_s3tc")};this.supportsCompressedTexturePVRTC=function(){return q.get("WEBGL_compressed_texture_pvrtc")};this.supportsBlendMinMax=function(){return q.get("EXT_blend_minmax")};this.getMaxAnisotropy=function(){var e;return function(){if(e!==undefined){return e}var t=q.get("EXT_texture_filter_anisotropic");e=t!==null?H.getParameter(t.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0;return e}}();
114this.getPrecision=function(){return a};this.getPixelRatio=function(){return i};this.setPixelRatio=function(e){i=e};this.setSize=function(e,t,n){r.width=e*i;r.height=t*i;if(n!==false){r.style.width=e+"px";r.style.height=t+"px"}this.setViewport(0,0,e,t)};this.setViewport=function(e,t,r,n){R=e*i;k=t*i;I=r*i;D=n*i;H.viewport(R,k,I,D)};this.setScissor=function(e,t,r,n){H.scissor(e*i,t*i,r*i,n*i)};this.enableScissorTest=function(e){e?H.enable(H.SCISSOR_TEST):H.disable(H.SCISSOR_TEST)};this.getClearColor=function(){return d};this.setClearColor=function(e,t){d.set(e);p=t!==undefined?t:1;X(d.r,d.g,d.b,p)};this.getClearAlpha=function(){return p};this.setClearAlpha=function(e){p=e;X(d.r,d.g,d.b,p)};this.clear=function(e,t,r){var n=0;if(e===undefined||e)n|=H.COLOR_BUFFER_BIT;if(t===undefined||t)n|=H.DEPTH_BUFFER_BIT;if(r===undefined||r)n|=H.STENCIL_BUFFER_BIT;H.clear(n)};this.clearColor=function(){H.clear(H.COLOR_BUFFER_BIT)};this.clearDepth=function(){H.clear(H.DEPTH_BUFFER_BIT)};this.clearStencil=function(){H.clear(H.STENCIL_BUFFER_BIT)};this.clearTarget=function(e,t,r,n){this.setRenderTarget(e);this.clear(t,r,n)};this.resetGLState=K;function he(e){e.__webglVertexBuffer=H.createBuffer();e.__webglColorBuffer=H.createBuffer();w.info.memory.geometries++}function de(e){e.__webglVertexBuffer=H.createBuffer();e.__webglColorBuffer=H.createBuffer();e.__webglLineDistanceBuffer=H.createBuffer();w.info.memory.geometries++}function pe(e){e.__webglVertexBuffer=H.createBuffer();e.__webglNormalBuffer=H.createBuffer();e.__webglTangentBuffer=H.createBuffer();e.__webglColorBuffer=H.createBuffer();e.__webglUVBuffer=H.createBuffer();e.__webglUV2Buffer=H.createBuffer();e.__webglSkinIndicesBuffer=H.createBuffer();e.__webglSkinWeightsBuffer=H.createBuffer();e.__webglFaceBuffer=H.createBuffer();e.__webglLineBuffer=H.createBuffer();var t=e.numMorphTargets;if(t){e.__webglMorphTargetsBuffers=[];for(var r=0,n=t;r<n;r++){e.__webglMorphTargetsBuffers.push(H.createBuffer())}}var i=e.numMorphNormals;if(i){e.__webglMorphNormalsBuffers=[];for(var r=0,n=i;r<n;r++){e.__webglMorphNormalsBuffers.push(H.createBuffer())}}w.info.memory.geometries++}var me=function(e){var t=e.target;t.traverse(function(e){e.removeEventListener("remove",me);et(e)})};var ve=function(e){var t=e.target;t.removeEventListener("dispose",ve);_e(t)};var ye=function(e){var t=e.target;t.removeEventListener("dispose",ye);we(t);w.info.memory.textures--};var ge=function(e){var t=e.target;t.removeEventListener("dispose",ge);Ce(t);w.info.memory.textures--};var be=function(e){var t=e.target;t.removeEventListener("dispose",be);Ee(t)};var xe=function(e){var t=["__webglVertexBuffer","__webglNormalBuffer","__webglTangentBuffer","__webglColorBuffer","__webglUVBuffer","__webglUV2Buffer","__webglSkinIndicesBuffer","__webglSkinWeightsBuffer","__webglFaceBuffer","__webglLineBuffer","__webglLineDistanceBuffer"];for(var r=0,n=t.length;r<n;r++){var i=t[r];if(e[i]!==undefined){H.deleteBuffer(e[i]);delete e[i]}}if(e.__webglCustomAttributesList!==undefined){for(var i in e.__webglCustomAttributesList){H.deleteBuffer(e.__webglCustomAttributesList[i].buffer)}delete e.__webglCustomAttributesList}w.info.memory.geometries--};var _e=function(t){delete t.__webglInit;if(t instanceof e.BufferGeometry){for(var r in t.attributes){var n=t.attributes[r];if(n.buffer!==undefined){H.deleteBuffer(n.buffer);delete n.buffer}}w.info.memory.geometries--}else{var i=We[t.id];if(i!==undefined){for(var a=0,o=i.length;a<o;a++){var s=i[a];if(s.numMorphTargets!==undefined){for(var u=0,l=s.numMorphTargets;u<l;u++){H.deleteBuffer(s.__webglMorphTargetsBuffers[u])}delete s.__webglMorphTargetsBuffers}if(s.numMorphNormals!==undefined){for(var u=0,l=s.numMorphNormals;u<l;u++){H.deleteBuffer(s.__webglMorphNormalsBuffers[u])}delete s.__webglMorphNormalsBuffers}xe(s)}delete We[t.id]}else{xe(t)}}M=""};var we=function(e){if(e.image&&e.image.__webglTextureCube){H.deleteTexture(e.image.__webglTextureCube);delete e.image.__webglTextureCube}else{if(e.__webglInit===undefined)return;H.deleteTexture(e.__webglTexture);delete e.__webglTexture;delete e.__webglInit}};var Ce=function(t){if(!t||t.__webglTexture===undefined)return;H.deleteTexture(t.__webglTexture);delete t.__webglTexture;if(t instanceof e.WebGLRenderTargetCube){for(var r=0;r<6;r++){H.deleteFramebuffer(t.__webglFramebuffer[r]);H.deleteRenderbuffer(t.__webglRenderbuffer[r])}}else{H.deleteFramebuffer(t.__webglFramebuffer);H.deleteRenderbuffer(t.__webglRenderbuffer)}delete t.__webglFramebuffer;delete t.__webglRenderbuffer};var Ee=function(e){var t=e.program.program;if(t===undefined)return;e.program=undefined;var r,n,i;var a=false;for(r=0,n=C.length;r<n;r++){i=C[r];if(i.program===t){i.usedTimes--;if(i.usedTimes===0){a=true}break}}if(a===true){var o=[];for(r=0,n=C.length;r<n;r++){i=C[r];if(i.program!==t){o.push(i)}}C=o;H.deleteProgram(t);w.info.memory.programs--}};function Se(e){var t=e.geometry;var r=e.material;var n=t.vertices.length;
114if(r.attributes){if(t.__webglCustomAttributesList===undefined){t.__webglCustomAttributesList=[]}for(var i in r.attributes){var a=r.attributes[i];if(!a.__webglInitialized||a.createUniqueBuffers){a.__webglInitialized=true;var o=1;if(a.type==="v2")o=2;else if(a.type==="v3")o=3;else if(a.type==="v4")o=4;else if(a.type==="c")o=3;a.size=o;a.array=new Float32Array(n*o);a.buffer=H.createBuffer();a.buffer.belongsToAttribute=i;a.needsUpdate=true}t.__webglCustomAttributesList.push(a)}}}function Te(e,t){var r=e.vertices.length;e.__vertexArray=new Float32Array(r*3);e.__colorArray=new Float32Array(r*3);e.__webglParticleCount=r;Se(t)}function Me(e,t){var r=e.vertices.length;e.__vertexArray=new Float32Array(r*3);e.__colorArray=new Float32Array(r*3);e.__lineDistanceArray=new Float32Array(r*1);e.__webglLineCount=r;Se(t)}function Ae(e,t){var r=t.geometry,n=e.faces3,i=n.length*3,a=n.length*1,o=n.length*3,s=Pe(t,e);e.__vertexArray=new Float32Array(i*3);e.__normalArray=new Float32Array(i*3);e.__colorArray=new Float32Array(i*3);e.__uvArray=new Float32Array(i*2);if(r.faceVertexUvs.length>1){e.__uv2Array=new Float32Array(i*2)}if(r.hasTangents){e.__tangentArray=new Float32Array(i*4)}if(t.geometry.skinWeights.length&&t.geometry.skinIndices.length){e.__skinIndexArray=new Float32Array(i*4);e.__skinWeightArray=new Float32Array(i*4)}var u=q.get("OES_element_index_uint")!==null&&a>21845?Uint32Array:Uint16Array;e.__typeArray=u;e.__faceArray=new u(a*3);e.__lineArray=new u(o*2);var l=e.numMorphTargets;if(l){e.__morphTargetsArrays=[];for(var c=0,f=l;c<f;c++){e.__morphTargetsArrays.push(new Float32Array(i*3))}}var h=e.numMorphNormals;if(h){e.__morphNormalsArrays=[];for(var c=0,f=h;c<f;c++){e.__morphNormalsArrays.push(new Float32Array(i*3))}}e.__webglFaceCount=a*3;e.__webglLineCount=o*2;if(s.attributes){if(e.__webglCustomAttributesList===undefined){e.__webglCustomAttributesList=[]}for(var d in s.attributes){var p=s.attributes[d];var m={};for(var v in p){m[v]=p[v]}if(!m.__webglInitialized||m.createUniqueBuffers){m.__webglInitialized=true;var y=1;if(m.type==="v2")y=2;else if(m.type==="v3")y=3;else if(m.type==="v4")y=4;else if(m.type==="c")y=3;m.size=y;m.array=new Float32Array(i*y);m.buffer=H.createBuffer();m.buffer.belongsToAttribute=d;p.needsUpdate=true;m.__original=p}e.__webglCustomAttributesList.push(m)}}e.__inittedArrays=true}function Pe(t,r){return t.material instanceof e.MeshFaceMaterial?t.material.materials[r.materialIndex]:t.material}function Re(t){return t instanceof e.MeshPhongMaterial===false&&t.shading===e.FlatShading}function ke(e,t,r){var n,i,a,o,s,u=e.vertices,l=u.length,c=e.colors,f=c.length,h=e.__vertexArray,d=e.__colorArray,p=e.verticesNeedUpdate,m=e.colorsNeedUpdate,v=e.__webglCustomAttributesList,y,g,b,x,_,w;if(p){for(n=0;n<l;n++){a=u[n];o=n*3;h[o]=a.x;h[o+1]=a.y;h[o+2]=a.z}H.bindBuffer(H.ARRAY_BUFFER,e.__webglVertexBuffer);H.bufferData(H.ARRAY_BUFFER,h,t)}if(m){for(i=0;i<f;i++){s=c[i];o=i*3;d[o]=s.r;d[o+1]=s.g;d[o+2]=s.b}H.bindBuffer(H.ARRAY_BUFFER,e.__webglColorBuffer);H.bufferData(H.ARRAY_BUFFER,d,t)}if(v){for(y=0,g=v.length;y<g;y++){w=v[y];if(w.needsUpdate&&(w.boundTo===undefined||w.boundTo==="vertices")){x=w.value.length;o=0;if(w.size===1){for(b=0;b<x;b++){w.array[b]=w.value[b]}}else if(w.size===2){for(b=0;b<x;b++){_=w.value[b];w.array[o]=_.x;w.array[o+1]=_.y;o+=2}}else if(w.size===3){if(w.type==="c"){for(b=0;b<x;b++){_=w.value[b];w.array[o]=_.r;w.array[o+1]=_.g;w.array[o+2]=_.b;o+=3}}else{for(b=0;b<x;b++){_=w.value[b];w.array[o]=_.x;w.array[o+1]=_.y 115;w.array[o+2]=_.z;o+=3}}}else if(w.size===4){for(b=0;b<x;b++){_=w.value[b];w.array[o]=_.x;w.array[o+1]=_.y;w.array[o+2]=_.z;w.array[o+3]=_.w;o+=4}}}H.bindBuffer(H.ARRAY_BUFFER,w.buffer);H.bufferData(H.ARRAY_BUFFER,w.array,t);w.needsUpdate=false}}}function Ie(e,t){var r,n,i,a,o,s,u=e.vertices,l=e.colors,c=e.lineDistances,f=u.length,h=l.length,d=c.length,p=e.__vertexArray,m=e.__colorArray,v=e.__lineDistanceArray,y=e.verticesNeedUpdate,g=e.colorsNeedUpdate,b=e.lineDistancesNeedUpdate,x=e.__webglCustomAttributesList,_,w,C,E,S,T;if(y){for(r=0;r<f;r++){a=u[r];o=r*3;p[o]=a.x;p[o+1]=a.y;p[o+2]=a.z}H.bindBuffer(H.ARRAY_BUFFER,e.__webglVertexBuffer);H.bufferData(H.ARRAY_BUFFER,p,t)}if(g){for(n=0;n<h;n++){s=l[n];o=n*3;m[o]=s.r;m[o+1]=s.g;m[o+2]=s.b}H.bindBuffer(H.ARRAY_BUFFER,e.__webglColorBuffer);H.bufferData(H.ARRAY_BUFFER,m,t)}if(b){for(i=0;i<d;i++){v[i]=c[i]}H.bindBuffer(H.ARRAY_BUFFER,e.__webglLineDistanceBuffer);H.bufferData(H.ARRAY_BUFFER,v,t)}if(x){for(_=0,w=x.length;_<w;_++){T=x[_];if(T.needsUpdate&&(T.boundTo===undefined||T.boundTo==="vertices")){o=0;E=T.value.length;if(T.size===1){for(C=0;C<E;C++){T.array[C]=T.value[C]}}else if(T.size===2){for(C=0;C<E;C++){S=T.value[C];T.array[o]=S.x;T.array[o+1]=S.y;o+=2}}else if(T.size===3){if(T.type==="c"){for(C=0;C<E;C++){S=T.value[C];T.array[o]=S.r;T.array[o+1]=S.g;T.array[o+2]=S.b;o+=3}}else{for(C=0;C<E;C++){S=T.value[C];T.array[o]=S.x;T.array[o+1]=S.y;T.array[o+2]=S.z;o+=3}}}else if(T.size===4){for(C=0;C<E;C++){S=T.value[C];T.array[o]=S.x;T.array[o+1]=S.y;T.array[o+2]=S.z;T.array[o+3]=S.w;o+=4}}H.bindBuffer(H.ARRAY_BUFFER,T.buffer);H.bufferData(H.ARRAY_BUFFER,T.array,t);T.needsUpdate=false}}}}function De(t,r,n,i,a){if(!t.__inittedArrays){return}var o=Re(a);var s,u,l,c,f,h,d,p,m,v,y,g,b,x,_,w,C,E,S,T,M,A,P,R,k,I,D,B,L,F,V,O,U,N,z,j,G,W,q,X,Y=0,K=0,Q=0,Z=0,J=0,$=0,ee=0,te=0,re=0,ne=0,ie=0,ae=0,oe,se=t.__vertexArray,ue=t.__uvArray,le=t.__uv2Array,ce=t.__normalArray,fe=t.__tangentArray,he=t.__colorArray,de=t.__skinIndexArray,pe=t.__skinWeightArray,me=t.__morphTargetsArrays,ve=t.__morphNormalsArrays,ye=t.__webglCustomAttributesList,ge,be=t.__faceArray,xe=t.__lineArray,_e=r.geometry,we=_e.verticesNeedUpdate,Ce=_e.elementsNeedUpdate,Ee=_e.uvsNeedUpdate,Se=_e.normalsNeedUpdate,Te=_e.tangentsNeedUpdate,Me=_e.colorsNeedUpdate,Ae=_e.morphTargetsNeedU
115pdate,Pe=_e.vertices,ke=t.faces3,Ie=_e.faces,De=_e.faceVertexUvs[0],Be=_e.faceVertexUvs[1],Le=_e.skinIndices,Fe=_e.skinWeights,Ve=_e.morphTargets,Oe=_e.morphNormals;if(we){for(s=0,u=ke.length;s<u;s++){c=Ie[ke[s]];g=Pe[c.a];b=Pe[c.b];x=Pe[c.c];se[K]=g.x;se[K+1]=g.y;se[K+2]=g.z;se[K+3]=b.x;se[K+4]=b.y;se[K+5]=b.z;se[K+6]=x.x;se[K+7]=x.y;se[K+8]=x.z;K+=9}H.bindBuffer(H.ARRAY_BUFFER,t.__webglVertexBuffer);H.bufferData(H.ARRAY_BUFFER,se,n)}if(Ae){for(z=0,j=Ve.length;z<j;z++){ie=0;for(s=0,u=ke.length;s<u;s++){q=ke[s];c=Ie[q];g=Ve[z].vertices[c.a];b=Ve[z].vertices[c.b];x=Ve[z].vertices[c.c];G=me[z];G[ie]=g.x;G[ie+1]=g.y;G[ie+2]=g.z;G[ie+3]=b.x;G[ie+4]=b.y;G[ie+5]=b.z;G[ie+6]=x.x;G[ie+7]=x.y;G[ie+8]=x.z;if(a.morphNormals){if(o){E=Oe[z].faceNormals[q];S=E;T=E}else{X=Oe[z].vertexNormals[q];E=X.a;S=X.b;T=X.c}W=ve[z];W[ie]=E.x;W[ie+1]=E.y;W[ie+2]=E.z;W[ie+3]=S.x;W[ie+4]=S.y;W[ie+5]=S.z;W[ie+6]=T.x;W[ie+7]=T.y;W[ie+8]=T.z}ie+=9}H.bindBuffer(H.ARRAY_BUFFER,t.__webglMorphTargetsBuffers[z]);H.bufferData(H.ARRAY_BUFFER,me[z],n);if(a.morphNormals){H.bindBuffer(H.ARRAY_BUFFER,t.__webglMorphNormalsBuffers[z]);H.bufferData(H.ARRAY_BUFFER,ve[z],n)}}}if(Fe.length){for(s=0,u=ke.length;s<u;s++){c=Ie[ke[s]];R=Fe[c.a];k=Fe[c.b];I=Fe[c.c];pe[ne]=R.x;pe[ne+1]=R.y;pe[ne+2]=R.z;pe[ne+3]=R.w;pe[ne+4]=k.x;pe[ne+5]=k.y;pe[ne+6]=k.z;pe[ne+7]=k.w;pe[ne+8]=I.x;pe[ne+9]=I.y;pe[ne+10]=I.z;pe[ne+11]=I.w;D=Le[c.a];B=Le[c.b];L=Le[c.c];de[ne]=D.x;de[ne+1]=D.y;de[ne+2]=D.z;de[ne+3]=D.w;de[ne+4]=B.x;de[ne+5]=B.y;de[ne+6]=B.z;de[ne+7]=B.w;de[ne+8]=L.x;de[ne+9]=L.y;de[ne+10]=L.z;de[ne+11]=L.w;ne+=12}if(ne>0){H.bindBuffer(H.ARRAY_BUFFER,t.__webglSkinIndicesBuffer);H.bufferData(H.ARRAY_BUFFER,de,n);H.bindBuffer(H.ARRAY_BUFFER,t.__webglSkinWeightsBuffer);H.bufferData(H.ARRAY_BUFFER,pe,n)}}if(Me){for(s=0,u=ke.length;s<u;s++){c=Ie[ke[s]];d=c.vertexColors;p=c.color;if(d.length===3&&a.vertexColors===e.VertexColors){M=d[0];A=d[1];P=d[2]}else{M=p;A=p;P=p}he[re]=M.r;he[re+1]=M.g;he[re+2]=M.b;he[re+3]=A.r;he[re+4]=A.g;he[re+5]=A.b;he[re+6]=P.r;he[re+7]=P.g;he[re+8]=P.b;re+=9}if(re>0){H.bindBuffer(H.ARRAY_BUFFER,t.__webglColorBuffer);H.bufferData(H.ARRAY_BUFFER,he,n)}}if(Te&&_e.hasTangents){for(s=0,u=ke.length;s<u;s++){c=Ie[ke[s]];m=c.vertexTangents;_=m[0];w=m[1];C=m[2];fe[ee]=_.x;fe[ee+1]=_.y;fe[ee+2]=_.z;fe[ee+3]=_.w;fe[ee+4]=w.x;fe[ee+5]=w.y;fe[ee+6]=w.z;fe[ee+7]=w.w;fe[ee+8]=C.x;fe[ee+9]=C.y;fe[ee+10]=C.z;fe[ee+11]=C.w;ee+=12}H.bindBuffer(H.ARRAY_BUFFER,t.__webglTangentBuffer);H.bufferData(H.ARRAY_BUFFER,fe,n)}if(Se){for(s=0,u=ke.length;s<u;s++){c=Ie[ke[s]];f=c.vertexNormals;h=c.normal;if(f.length===3&&o===false){for(F=0;F<3;F++){O=f[F];ce[$]=O.x;ce[$+1]=O.y;ce[$+2]=O.z;$+=3}}else{for(F=0;F<3;F++){ce[$]=h.x;ce[$+1]=h.y;ce[$+2]=h.z;$+=3}}}H.bindBuffer(H.ARRAY_BUFFER,t.__webglNormalBuffer);H.bufferData(H.ARRAY_BUFFER,ce,n)}if(Ee&&De){for(s=0,u=ke.length;s<u;s++){l=ke[s];v=De[l];if(v===undefined)continue;for(F=0;F<3;F++){U=v[F];ue[Q]=U.x;ue[Q+1]=U.y;Q+=2}}if(Q>0){H.bindBuffer(H.ARRAY_BUFFER,t.__webglUVBuffer);H.bufferData(H.ARRAY_BUFFER,ue,n)}}if(Ee&&Be){for(s=0,u=ke.length;s<u;s++){l=ke[s];y=Be[l];if(y===undefined)continue;for(F=0;F<3;F++){N=y[F];le[Z]=N.x;le[Z+1]=N.y;Z+=2}}if(Z>0){H.bindBuffer(H.ARRAY_BUFFER,t.__webglUV2Buffer);H.bufferData(H.ARRAY_BUFFER,le,n)}}if(Ce){for(s=0,u=ke.length;s<u;s++){be[J]=Y;be[J+1]=Y+1;be[J+2]=Y+2;J+=3;xe[te]=Y;xe[te+1]=Y+1;xe[te+2]=Y;xe[te+3]=Y+2;xe[te+4]=Y+1;xe[te+5]=Y+2;te+=6;Y+=3}H.bindBuffer(H.ELEMENT_ARRAY_BUFFER,t.__webglFaceBuffer);H.bufferData(H.ELEMENT_ARRAY_BUFFER,be,n);H.bindBuffer(H.ELEMENT_ARRAY_BUFFER,t.__webglLineBuffer);H.bufferData(H.ELEMENT_ARRAY_BUFFER,xe,n)}if(ye){for(F=0,V=ye.length;F<V;F++){ge=ye[F];if(!ge.__original.needsUpdate)continue;ae=0;if(ge.size===1){if(ge.boundTo===undefined||ge.boundTo==="vertices"){for(s=0,u=ke.length;s<u;s++){c=Ie[ke[s]];ge.array[ae]=ge.value[c.a];ge.array[ae+1]=ge.value[c.b];ge.array[ae+2]=ge.value[c.c];ae+=3}}else if(ge.boundTo==="faces"){for(s=0,u=ke.length;s<u;s++){oe=ge.value[ke[s]];ge.array[ae]=oe;ge.array[ae+1]=oe;ge.array[ae+2]=oe;ae+=3}}}
115else if(ge.size===2){if(ge.boundTo===undefined||ge.boundTo==="vertices"){for(s=0,u=ke.length;s<u;s++){c=Ie[ke[s]];g=ge.value[c.a];b=ge.value[c.b];x=ge.value[c.c];ge.array[ae]=g.x;ge.array[ae+1]=g.y;ge.array[ae+2]=b.x;ge.array[ae+3]=b.y;ge.array[ae+4]=x.x;ge.array[ae+5]=x.y;ae+=6}}else if(ge.boundTo==="faces"){for(s=0,u=ke.length;s<u;s++){oe=ge.value[ke[s]];g=oe;b=oe;x=oe;ge.array[ae]=g.x;ge.array[ae+1]=g.y;ge.array[ae+2]=b.x;ge.array[ae+3]=b.y;ge.array[ae+4]=x.x;ge.array[ae+5]=x.y;ae+=6}}}else if(ge.size===3){var Ue;if(ge.type==="c"){Ue=["r","g","b"]}else{Ue=["x","y","z"]}if(ge.boundTo===undefined||ge.boundTo==="vertices"){for(s=0,u=ke.length;s<u;s++){c=Ie[ke[s]];g=ge.value[c.a];b=ge.value[c.b];x=ge.value[c.c];ge.array[ae]=g[Ue[0]];ge.array[ae+1]=g[Ue[1]];ge.array[ae+2]=g[Ue[2]];ge.array[ae+3]=b[Ue[0]];ge.array[ae+4]=b[Ue[1]];ge.array[ae+5]=b[Ue[2]];ge.array[ae+6]=x[Ue[0]];ge.array[ae+7]=x[Ue[1]];ge.array[ae+8]=x[Ue[2]];ae+=9}}else if(ge.boundTo==="faces"){for(s=0,u=ke.length;s<u;s++){oe=ge.value[ke[s]];g=oe;b=oe;x=oe;ge.array[ae]=g[Ue[0]];ge.array[ae+1]=g[Ue[1]];ge.array[ae+2]=g[Ue[2]];ge.array[ae+3]=b[Ue[0]];ge.array[ae+4]=b[Ue[1]];ge.array[ae+5]=b[Ue[2]];ge.array[ae+6]=x[Ue[0]];ge.array[ae+7]=x[Ue[1]];ge.array[ae+8]=x[Ue[2]];ae+=9}}else if(ge.boundTo==="faceVertices"){for(s=0,u=ke.length;s<u;s++){oe=ge.value[ke[s]];g=oe[0];b=oe[1];x=oe[2];ge.array[ae]=g[Ue[0]];ge.array[ae+1]=g[Ue[1]];ge.array[ae+2]=g[Ue[2]];ge.array[ae+3]=b[Ue[0]];ge.array[ae+4]=b[Ue[1]];ge.array[ae+5]=b[Ue[2]];ge.array[ae+6]=x[Ue[0]];ge.array[ae+7]=x[Ue[1]];ge.array[ae+8]=x[Ue[2]];ae+=9}}}else if(ge.size===4){if(ge.boundTo===undefined||ge.boundTo==="vertices"){for(s=0,u=ke.length;s<u;s++){c=Ie[ke[s]];g=ge.value[c.a];b=ge.value[c.b];x=ge.value[c.c];ge.array[ae]=g.x;ge.array[ae+1]=g.y;ge.array[ae+2]=g.z;ge.array[ae+3]=g.w;ge.array[ae+4]=b.x;ge.array[ae+5]=b.y;ge.array[ae+6]=b.z;ge.array[ae+7]=b.w;ge.array[ae+8]=x.x;ge.array[ae+9]=x.y;ge.array[ae+10]=x.z;ge.array[ae+11]=x.w;ae+=12}}else if(ge.boundTo==="faces"){for(s=0,u=ke.length;s<u;s++){oe=ge.value[ke[s]];g=oe;b=oe;x=oe;ge.array[ae]=g.x;ge.array[ae+1]=g.y;ge.array[ae+2]=g.z;ge.array[ae+3]=g.w;ge.array[ae+4]=b.x;ge.array[ae+5]=b.y;ge.array[ae+6]=b.z;ge.array[ae+7]=b.w;ge.array[ae+8]=x.x;ge.array[ae+9]=x.y;ge.array[ae+10]=x.z;ge.array[ae+11]=x.w;ae+=12}}else if(ge.boundTo==="faceVertices"){for(s=0,u=ke.length;s<u;s++){oe=ge.value[ke[s]];g=oe[0];b=oe[1];x=oe[2];ge.array[ae]=g.x;ge.array[ae+1]=g.y;ge.array[ae+2]=g.z;ge.array[ae+3]=g.w;ge.array[ae+4]=b.x;ge.array[ae+5]=b.y;ge.array[ae+6]=b.z;ge.array[ae+7]=b.w;ge.array[ae+8]=x.x;ge.array[ae+9]=x.y;ge.array[ae+10]=x.z;ge.array[ae+11]=x.w;ae+=12}}}H.bindBuffer(H.ARRAY_BUFFER,ge.buffer);H.bufferData(H.ARRAY_BUFFER,ge.array,n)}}if(i){delete t.__inittedArrays;delete t.__colorArray;delete t.__normalArray;delete t.__tangentArray;delete t.__uvArray;delete t.__uv2Array;delete t.__faceArray;delete t.__vertexArray;delete t.__lineArray;delete t.__skinIndexArray;delete t.__skinWeightArray}}this.renderBufferImmediate=function(t,r,n){W.initAttributes();if(t.hasPositions&&!t.__webglVertexBuffer)t.__webglVertexBuffer=H.createBuffer();if(t.hasNormals&&!t.__webglNormalBuffer)t.__webglNormalBuffer=H.createBuffer();if(t.hasUvs&&!t.__webglUvBuffer)t.__webglUvBuffer=H.createBuffer();if(t.hasColors&&!t.__webglColorBuffer)t.__webglColorBuffer=H.createBuffer();if(t.hasPositions){H.bindBuffer(H.ARRAY_BUFFER,t.__webglVertexBuffer);H.bufferData(H.ARRAY_BUFFER,t.positionArray,H.DYNAMIC_DRAW);W.enableAttribute(r.attributes.position);H.vertexAttribPointer(r.attributes.position,3,H.FLOAT,false,0,0)}if(t.hasNormals){H.bindBuffer(H.ARRAY_BUFFER,t.__webglNormalBuffer);if(n instanceof e.MeshPhongMaterial===false&&n.shading===e.FlatShading){var i,a,o,s,u,l,c,f,h,d,p,m,v,y,g=t.count*3;for(y=0;y<g;y+=9){v=t.normalArray;s=v[y];c=v[y+1];d=v[y+2];u=v[y+3];f=v[y+4];p=v[y+5];l=v[y+6];h=v[y+7];m=v[y+8];i=(s+u+l)/3;a=(c+f+h)/3;o=(d+p+m)/3;v[y]=i;v[y+1]=a;v[y+2]=o;v[y+3]=i;v[y+4]=a;v[y+5]=o;v[y+6]=i;
115v[y+7]=a;v[y+8]=o}}H.bufferData(H.ARRAY_BUFFER,t.normalArray,H.DYNAMIC_DRAW);W.enableAttribute(r.attributes.normal);H.vertexAttribPointer(r.attributes.normal,3,H.FLOAT,false,0,0)}if(t.hasUvs&&n.map){H.bindBuffer(H.ARRAY_BUFFER,t.__webglUvBuffer);H.bufferData(H.ARRAY_BUFFER,t.uvArray,H.DYNAMIC_DRAW);W.enableAttribute(r.attributes.uv);H.vertexAttribPointer(r.attributes.uv,2,H.FLOAT,false,0,0)}if(t.hasColors&&n.vertexColors!==e.NoColors){H.bindBuffer(H.ARRAY_BUFFER,t.__webglColorBuffer);H.bufferData(H.ARRAY_BUFFER,t.colorArray,H.DYNAMIC_DRAW);W.enableAttribute(r.attributes.color);H.vertexAttribPointer(r.attributes.color,3,H.FLOAT,false,0,0)}W.disableUnusedAttributes();H.drawArrays(H.TRIANGLES,0,t.count);t.count=0};function Be(e,t,r,n){var i=r.attributes;var a=t.attributes;var o=t.attributesKeys;for(var s=0,u=o.length;s<u;s++){var l=o[s];var c=a[l];if(c>=0){var f=i[l];if(f!==undefined){var h=f.itemSize;H.bindBuffer(H.ARRAY_BUFFER,f.buffer);W.enableAttribute(c);H.vertexAttribPointer(c,h,H.FLOAT,false,0,n*h*4)}else if(e.defaultAttributeValues!==undefined){if(e.defaultAttributeValues[l].length===2){H.vertexAttrib2fv(c,e.defaultAttributeValues[l])}else if(e.defaultAttributeValues[l].length===3){H.vertexAttrib3fv(c,e.defaultAttributeValues[l])}}}}W.disableUnusedAttributes()}this.renderBufferDirect=function(t,r,n,a,o,s){if(a.visible===false)return;Ze(s);var u=at(t,r,n,a,s);var l=false,c=a.wireframe?1:0,f="direct_"+o.id+"_"+u.id+"_"+c;if(f!==M){M=f;l=true}if(l){W.initAttributes()}if(s instanceof e.Mesh){var h=a.wireframe===true?H.LINES:H.TRIANGLES;var d=o.attributes.index;if(d){var p,m;if(d.array instanceof Uint32Array&&q.get("OES_element_index_uint")){p=H.UNSIGNED_INT;m=4}else{p=H.UNSIGNED_SHORT;m=2}var v=o.offsets;if(v.length===0){if(l){Be(a,u,o,0);H.bindBuffer(H.ELEMENT_ARRAY_BUFFER,d.buffer)}H.drawElements(h,d.array.length,p,0);w.info.render.calls++;w.info.render.vertices+=d.array.length;w.info.render.faces+=d.array.length/3}else{l=true;for(var y=0,g=v.length;y<g;y++){var b=v[y].index;if(l){Be(a,u,o,b);H.bindBuffer(H.ELEMENT_ARRAY_BUFFER,d.buffer)}H.drawElements(h,v[y].count,p,v[y].start*m);w.info.render.calls++;w.info.render.vertices+=v[y].count;w.info.render.faces+=v[y].count/3}}}else{if(l){Be(a,u,o,0)}var x=o.attributes["position"];H.drawArrays(h,0,x.array.length/x.itemSize);w.info.render.calls++;w.info.render.vertices+=x.array.length/x.itemSize;w.info.render.faces+=x.array.length/(3*x.itemSize)}}else if(s instanceof e.PointCloud){var h=H.POINTS;var d=o.attributes.index;if(d){var p,m;if(d.array instanceof Uint32Array&&q.get("OES_element_index_uint")){p=H.UNSIGNED_INT;m=4}else{p=H.UNSIGNED_SHORT;m=2}var v=o.offsets;if(v.length===0){if(l){Be(a,u,o,0);H.bindBuffer(H.ELEMENT_ARRAY_BUFFER,d.buffer)}H.drawElements(h,d.array.length,p,0);w.info.render.calls++;w.info.render.points+=d.array.length}else{if(v.length>1)l=true;for(var y=0,g=v.length;y<g;y++){var b=v[y].index;if(l){Be(a,u,o,b);H.bindBuffer(H.ELEMENT_ARRAY_BUFFER,d.buffer)}H.drawElements(h,v[y].count,p,v[y].start*m);w.info.render.calls++;w.info.render.points+=v[y].count}}}else{if(l){Be(a,u,o,0)}var x=o.attributes.position;var v=o.offsets;if(v.length===0){H.drawArrays(h,0,x.array.length/3);w.info.render.calls++;w.info.render.points+=x.array.length/3}else{for(var y=0,g=v.length;y<g;y++){H.drawArrays(h,v[y].index,v[y].count);w.info.render.calls++;w.info.render.points+=v[y].count}}}}else if(s instanceof e.Line){var h=s.mode===e.LineStrip?H.LINE_STRIP:H.LINES;W.setLineWidth(a.linewidth*i);var d=o.attributes.index;if(d){var p,m;if(d.array instanceof Uint32Array){p=H.UNSIGNED_INT;m=4}else{p=H.UNSIGNED_SHORT;m=2}var v=o.offsets;if(v.length===0){if(l){Be(a,u,o,0);H.bindBuffer(H.ELEMENT_ARRAY_BUFFER,d.buffer)}H.drawElements(h,d.array.length,p,0);w.info.render.calls++;w.info.render.vertices+=d.array.length}else{if(v.length>1)l=true;for(var y=0,g=v.length;y<g;y++){var b=v[y].index;if(l){Be(a,u,o,b);H.bindBuffer(H.ELEMENT_ARRAY_BUFFER,d.buffer)}H.drawElements(h,v[y].count,p,v[y].start*m);w.info.render.calls++;w.info.render.vertices+=v[y].count}}}else{if(l){Be(a,u,o,0)}var x=o.attributes.position;var v=o.offsets;if(v.length===0){H.drawArrays(h,0,x.array.length/3);w.info.render.calls++;w.info.render.vertices+=x.array.length/3}else{for(var y=0,g=v.length;y<g;y++){H.drawArrays(h,v[y].index,v[y].count);w.info.render.calls++;w.info.render.vertices+=v[y].count}}}}};
115this.renderBuffer=function(t,r,n,a,o,s){if(a.visible===false)return;Ze(s);var u=at(t,r,n,a,s);var l=u.attributes;var c=false,f=a.wireframe?1:0,h=o.id+"_"+u.id+"_"+f;if(h!==M){M=h;c=true}if(c){W.initAttributes()}if(!a.morphTargets&&l.position>=0){if(c){H.bindBuffer(H.ARRAY_BUFFER,o.__webglVertexBuffer);W.enableAttribute(l.position);H.vertexAttribPointer(l.position,3,H.FLOAT,false,0,0)}}else{if(s.morphTargetBase){Le(a,o,s)}}if(c){if(o.__webglCustomAttributesList){for(var d=0,p=o.__webglCustomAttributesList.length;d<p;d++){var m=o.__webglCustomAttributesList[d];if(l[m.buffer.belongsToAttribute]>=0){H.bindBuffer(H.ARRAY_BUFFER,m.buffer);W.enableAttribute(l[m.buffer.belongsToAttribute]);H.vertexAttribPointer(l[m.buffer.belongsToAttribute],m.size,H.FLOAT,false,0,0)}}}if(l.color>=0){if(s.geometry.colors.length>0||s.geometry.faces.length>0){H.bindBuffer(H.ARRAY_BUFFER,o.__webglColorBuffer);W.enableAttribute(l.color);H.vertexAttribPointer(l.color,3,H.FLOAT,false,0,0)}else if(a.defaultAttributeValues!==undefined){H.vertexAttrib3fv(l.color,a.defaultAttributeValues.color)}}if(l.normal>=0){H.bindBuffer(H.ARRAY_BUFFER,o.__webglNormalBuffer);W.enableAttribute(l.normal);H.vertexAttribPointer(l.normal,3,H.FLOAT,false,0,0)}if(l.tangent>=0){H.bindBuffer(H.ARRAY_BUFFER,o.__webglTangentBuffer);W.enableAttribute(l.tangent);H.vertexAttribPointer(l.tangent,4,H.FLOAT,false,0,0)}if(l.uv>=0){if(s.geometry.faceVertexUvs[0]){H.bindBuffer(H.ARRAY_BUFFER,o.__webglUVBuffer);W.enableAttribute(l.uv);H.vertexAttribPointer(l.uv,2,H.FLOAT,false,0,0)}else if(a.defaultAttributeValues!==undefined){H.vertexAttrib2fv(l.uv,a.defaultAttributeValues.uv)}}if(l.uv2>=0){if(s.geometry.faceVertexUvs[1]){H.bindBuffer(H.ARRAY_BUFFER,o.__webglUV2Buffer);W.enableAttribute(l.uv2);H.vertexAttribPointer(l.uv2,2,H.FLOAT,false,0,0)}else if(a.defaultAttributeValues!==undefined){H.vertexAttrib2fv(l.uv2,a.defaultAttributeValues.uv2)}}if(a.skinning&&l.skinIndex>=0&&l.skinWeight>=0){H.bindBuffer(H.ARRAY_BUFFER,o.__webglSkinIndicesBuffer);W.enableAttribute(l.skinIndex);H.vertexAttribPointer(l.skinIndex,4,H.FLOAT,false,0,0);H.bindBuffer(H.ARRAY_BUFFER,o.__webglSkinWeightsBuffer);W.enableAttribute(l.skinWeight);H.vertexAttribPointer(l.skinWeight,4,H.FLOAT,false,0,0)}if(l.lineDistance>=0){H.bindBuffer(H.ARRAY_BUFFER,o.__webglLineDistanceBuffer);W.enableAttribute(l.lineDistance);H.vertexAttribPointer(l.lineDistance,1,H.FLOAT,false,0,0)}}W.disableUnusedAttributes();if(s instanceof e.Mesh){var v=o.__typeArray===Uint32Array?H.UNSIGNED_INT:H.UNSIGNED_SHORT;if(a.wireframe){W.setLineWidth(a.wireframeLinewidth*i);if(c)H.bindBuffer(H.ELEMENT_ARRAY_BUFFER,o.__webglLineBuffer);H.drawElements(H.LINES,o.__webglLineCount,v,0)}else{if(c)H.bindBuffer(H.ELEMENT_ARRAY_BUFFER,o.__webglFaceBuffer);H.drawElements(H.TRIANGLES,o.__webglFaceCount,v,0)}w.info.render.calls++;w.info.render.vertices+=o.__webglFaceCount;w.info.render.faces+=o.__webglFaceCount/3}else if(s instanceof e.Line){var y=s.mode===e.LineStrip?H.LINE_STRIP:H.LINES;W.setLineWidth(a.linewidth*i);H.drawArrays(y,0,o.__webglLineCount);w.info.render.calls++}else if(s instanceof e.PointCloud){H.drawArrays(H.POINTS,0,o.__webglParticleCount);w.info.render.calls++;w.info.render.points+=o.__webglParticleCount}};function Le(e,t,r){var n=e.program.attributes;if(r.morphTargetBase!==-1&&n.position>=0){H.bindBuffer(H.ARRAY_BUFFER,t.__webglMorphTargetsBuffers[r.morphTargetBase]);W.enableAttribute(n.position);H.vertexAttribPointer(n.position,3,H.FLOAT,false,0,0)}else if(n.position>=0){H.bindBuffer(H.ARRAY_BUFFER,t.__webglVertexBuffer);W.enableAttribute(n.position);H.vertexAttribPointer(n.position,3,H.FLOAT,false,0,0)}if(r.morphTargetForcedOrder.length){var i=0;var a=r.morphTargetForcedOrder;var o=r.morphTargetInfluences;var s;while(i<e.numSupportedMorphTargets&&i<a.length){s=n["morphTarget"+i];if(s>=0){H.bindBuffer(H.ARRAY_BUFFER,t.__webglMorphTargetsBuffers[a[i]]);W.enableAttribute(s);H.vertexAttribPointer(s,3,H.FLOAT,false,0,0)}s=n["morphNormal"+i];if(s>=0&&e.morphNormals){H.bindBuffer(H.ARRAY_BUFFER,t.__webglMorphNormalsBuffers[a[i]]);W.enableAttribute(s);H.vertexAttribPointer(s,3,H.FLOAT,false,0,0)}r.__webglMorphTargetInfluences[i]=o[a[i]];i++}}else{var u=[];var o=r.morphTargetInfluences;var l=r.geometry.morphTargets;if(o.length>l.length){console.warn("THREE.WebGLRenderer: Influences array is bigger than morphTargets array.");o.length=l.length}for(var c=0,f=o.length;c<f;c++){var h=o[c];u.push([h,c])}if(u.length>e.numSupportedMorphTargets){u.sort(Oe);u.length=e.numSupportedMorphTargets}else if(u.length>e.numSupportedMorphNormals){u.sort(Oe)}else if(u.length===0){u.push([0,0])}var s;for(var i=0,d=e.numSupportedMorphTargets;i<d;i++){if(u[i]){var p=u[i][1];s=n["morphTarget"+i];if(s>
115=0){H.bindBuffer(H.ARRAY_BUFFER,t.__webglMorphTargetsBuffers[p]);W.enableAttribute(s);H.vertexAttribPointer(s,3,H.FLOAT,false,0,0)}s=n["morphNormal"+i];if(s>=0&&e.morphNormals){H.bindBuffer(H.ARRAY_BUFFER,t.__webglMorphNormalsBuffers[p]);W.enableAttribute(s);H.vertexAttribPointer(s,3,H.FLOAT,false,0,0)}r.__webglMorphTargetInfluences[i]=o[p]}else{r.__webglMorphTargetInfluences[i]=0}}}if(e.program.uniforms.morphTargetInfluences!==null){H.uniform1fv(e.program.uniforms.morphTargetInfluences,r.__webglMorphTargetInfluences)}}function Fe(e,t){if(e.object.renderOrder!==t.object.renderOrder){return e.object.renderOrder-t.object.renderOrder}else if(e.material.id!==t.material.id){return e.material.id-t.material.id}else if(e.z!==t.z){return e.z-t.z}else{return e.id-t.id}}function Ve(e,t){if(e.object.renderOrder!==t.object.renderOrder){return e.object.renderOrder-t.object.renderOrder}if(e.z!==t.z){return t.z-e.z}else{return e.id-t.id}}function Oe(e,t){return t[0]-e[0]}this.render=function(t,r,n,i){if(r instanceof e.Camera===false){e.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}var a=t.fog;M="";T=-1;A=null;N=true;if(t.autoUpdate===true)t.updateMatrixWorld();if(r.parent===undefined)r.updateMatrixWorld();t.traverse(function(t){if(t instanceof e.SkinnedMesh){t.skeleton.update()}});r.matrixWorldInverse.getInverse(r.matrixWorld);V.multiplyMatrices(r.projectionMatrix,r.matrixWorldInverse);F.setFromMatrix(V);m.length=0;g.length=0;b.length=0;x.length=0;_.length=0;Ue(t);if(w.sortObjects===true){g.sort(Fe);b.sort(Ve)}le.render(t,r);w.info.render.calls=0;w.info.render.vertices=0;w.info.render.faces=0;w.info.render.points=0;this.setRenderTarget(n);if(this.autoClear||i){this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil)}for(var o=0,s=y.length;o<s;o++){var u=y[o];var l=u.object;if(l.visible){bt(l,r);He(u)}}if(t.overrideMaterial){var c=t.overrideMaterial;it(c);Ne(g,r,m,a,c);Ne(b,r,m,a,c);ze(y,"",r,m,a,c)}else{W.setBlending(e.NoBlending);Ne(g,r,m,a,null);ze(y,"opaque",r,m,a,null);Ne(b,r,m,a,null);ze(y,"transparent",r,m,a,null)}ce.render(t,r);fe.render(t,r,B,L);if(n&&n.generateMipmaps&&n.minFilter!==e.NearestFilter&&n.minFilter!==e.LinearFilter){At(n)}W.setDepthTest(true);W.setDepthWrite(true);W.setColorWrite(true)};function Ue(t){if(t.visible===false)return;if(t instanceof e.Scene||t instanceof e.Group){}else{Ge(t);if(t instanceof e.Light){m.push(t)}else if(t instanceof e.Sprite){x.push(t)}else if(t instanceof e.LensFlare){_.push(t)}else{var r=v[t.id];if(r&&(t.frustumCulled===false||F.intersectsObject(t)===true)){for(var n=0,i=r.length;n<i;n++){var a=r[n];je(a);a.render=true;if(w.sortObjects===true){O.setFromMatrixPosition(t.matrixWorld);O.applyProjection(V);a.z=O.z}}}}}for(var n=0,i=t.children.length;n<i;n++){Ue(t.children[n])}}function Ne(t,r,n,i,a){var o;for(var s=0,u=t.length;s<u;s++){var l=t[s];var c=l.object;var f=l.buffer;bt(c,r);if(a){o=a}else{o=l.material;if(!o)continue;it(o)}w.setMaterialFaces(o);if(f instanceof e.BufferGeometry){w.renderBufferDirect(r,n,i,o,f,c)}else{w.renderBuffer(r,n,i,o,f,c)}}}function ze(e,t,r,n,i,a){var o;for(var s=0,u=e.length;s<u;s++){var l=e[s];var c=l.object;if(c.visible){if(a){o=a}else{o=l[t];if(!o)continue;it(o)}w.renderImmediateObject(r,n,i,o,c)}}}this.renderImmediateObject=function(e,t,r,n,i){var a=at(e,t,r,n,i);M="";w.setMaterialFaces(n);if(i.immediateRenderCallback){i.immediateRenderCallback(a,H,F)}else{i.render(function(e){w.renderBufferImmediate(e,a,n)})}};function He(e){var t=e.object,r=t.material;if(r.transparent){e.transparent=r;e.opaque=null}else{e.opaque=r;e.transparent=null}}function je(t){var r=t.object;var n=t.buffer;var i=r.geometry;var a=r.material;if(a instanceof e.MeshFaceMaterial){var o=i instanceof e.BufferGeometry?0:n.materialIndex;a=a.materials[o];t.material=a;if(a.transparent){b.push(t)}else{g.push(t)}}else if(a){t.material=a;if(a.transparent){b.push(t)}else{g.push(t)}}}function Ge(t){if(t.__webglInit===undefined){t.__webglInit=true;
115t._modelViewMatrix=new e.Matrix4;t._normalMatrix=new e.Matrix3;t.addEventListener("removed",me)}var r=t.geometry;if(r===undefined){}else if(r.__webglInit===undefined){r.__webglInit=true;r.addEventListener("dispose",ve);if(r instanceof e.BufferGeometry){w.info.memory.geometries++}else if(t instanceof e.Mesh){Ye(t,r)}else if(t instanceof e.Line){if(r.__webglVertexBuffer===undefined){de(r);Me(r,t);r.verticesNeedUpdate=true;r.colorsNeedUpdate=true;r.lineDistancesNeedUpdate=true}}else if(t instanceof e.PointCloud){if(r.__webglVertexBuffer===undefined){he(r);Te(r,t);r.verticesNeedUpdate=true;r.colorsNeedUpdate=true}}}if(t.__webglActive===undefined){t.__webglActive=true;if(t instanceof e.Mesh){if(r instanceof e.BufferGeometry){Ke(v,r,t)}else if(r instanceof e.Geometry){var n=We[r.id];for(var i=0,a=n.length;i<a;i++){Ke(v,n[i],t)}}}else if(t instanceof e.Line||t instanceof e.PointCloud){Ke(v,r,t)}else if(t instanceof e.ImmediateRenderObject||t.immediateRenderCallback){Qe(y,t)}}}var We={};var qe=0;function Xe(e,t){var r=q.get("OES_element_index_uint")?4294967296:65535;var n,i={};var a=e.morphTargets.length;var o=e.morphNormals.length;var s;var u={};var l=[];for(var c=0,f=e.faces.length;c<f;c++){var h=e.faces[c];var d=t?h.materialIndex:0;if(!(d in i)){i[d]={hash:d,counter:0}}n=i[d].hash+"_"+i[d].counter;if(!(n in u)){s={id:qe++,faces3:[],materialIndex:d,vertices:0,numMorphTargets:a,numMorphNormals:o};u[n]=s;l.push(s)}if(u[n].vertices+3>r){i[d].counter+=1;n=i[d].hash+"_"+i[d].counter;if(!(n in u)){s={id:qe++,faces3:[],materialIndex:d,vertices:0,numMorphTargets:a,numMorphNormals:o};u[n]=s;l.push(s)}}u[n].faces3.push(c);u[n].vertices+=3}return l}function Ye(t,r){var n=t.material,i=false;if(We[r.id]===undefined||r.groupsNeedUpdate===true){delete v[t.id];We[r.id]=Xe(r,n instanceof e.MeshFaceMaterial);r.groupsNeedUpdate=false}var a=We[r.id];for(var o=0,s=a.length;o<s;o++){var u=a[o];if(u.__webglVertexBuffer===undefined){pe(u);Ae(u,t);r.verticesNeedUpdate=true;r.morphTargetsNeedUpdate=true;r.elementsNeedUpdate=true;r.uvsNeedUpdate=true;r.normalsNeedUpdate=true;r.tangentsNeedUpdate=true;r.colorsNeedUpdate=true;i=true}else{i=false}if(i||t.__webglActive===undefined){Ke(v,u,t)}}t.__webglActive=true}function Ke(e,t,r){var n=r.id;e[n]=e[n]||[];e[n].push({id:n,buffer:t,object:r,material:null,z:0})}function Qe(e,t){e.push({id:null,object:t,opaque:null,transparent:null,z:0})}function Ze(t){var r=t.geometry;if(r instanceof e.BufferGeometry){var n=r.attributes;var i=r.attributesKeys;for(var a=0,o=i.length;a<o;a++){var s=i[a];var u=n[s];var l=s==="index"?H.ELEMENT_ARRAY_BUFFER:H.ARRAY_BUFFER;if(u.buffer===undefined){u.buffer=H.createBuffer();H.bindBuffer(l,u.buffer);H.bufferData(l,u.array,u instanceof e.DynamicBufferAttribute?H.DYNAMIC_DRAW:H.STATIC_DRAW);u.needsUpdate=false}else if(u.needsUpdate===true){H.bindBuffer(l,u.buffer);if(u.updateRange===undefined||u.updateRange.count===-1){H.bufferSubData(l,0,u.array)}else if(u.updateRange.count===0){console.error("THREE.WebGLRenderer.updateObject: using updateRange for THREE.DynamicBufferAttribute and marked as needsUpdate but count is 0, ensure you are using set methods or updating manually.")}else{H.bufferSubData(l,u.updateRange.offset*u.array.BYTES_PER_ELEMENT,u.array.subarray(u.updateRange.offset,u.updateRange.offset+u.updateRange.count));u.updateRange.count=0}u.needsUpdate=false}}}else if(t instanceof e.Mesh){if(r.groupsNeedUpdate===true){Ye(t,r)}var c=We[r.id];for(var a=0,f=c.length;a<f;a++){var h=c[a];var d=Pe(t,h);var p=d.attributes&&Je(d);if(r.verticesNeedUpdate||r.morphTargetsNeedUpdate||r.elementsNeedUpdate||r.uvsNeedUpdate||r.normalsNeedUpdate||r.colorsNeedUpdate||r.tangentsNeedUpdate||p){De(h,t,H.DYNAMIC_DRAW,!r.dynamic,d)}}r.verticesNeedUpdate=false;r.morphTargetsNeedUpdate=false;r.elementsNeedUpdate=false;r.uvsNeedUpdate=false;r.normalsNeedUpdate=false;r.colorsNeedUpdate=false;r.tangentsNeedUpdate=false;d.attributes&&$e(d)}else if(t instanceof e.Line){var d=Pe(t,r);var p=d.attributes&&Je(d);if(r.verticesNeedUpdate||r.colorsNeedUpdate||r.lineDistancesNeedUpdate||p){Ie(r,H.DYNAMIC_DRAW)}r.verticesNeedUpdate=false;r.colorsNeedUpdate=false;r.lineDistancesNeedUpdate=false;d.attributes&&$e(d)}else if(t instanceof e.PointCloud){var d=Pe(t,r);var p=d.attributes&&Je(d);if(r.verticesNeedUpdate||r.colorsNeedUpdate||p){ke(r,H.DYNAMIC_DRAW,t)}r.verticesNeedUpdate=false;r.colorsNeedUpdate=false;d.attributes&&$e(d)}}
115function Je(e){for(var t in e.attributes){if(e.attributes[t].needsUpdate)return true}return false}function $e(e){for(var t in e.attributes){e.attributes[t].needsUpdate=false}}function et(t){if(t instanceof e.Mesh||t instanceof e.PointCloud||t instanceof e.Line){delete v[t.id]}else if(t instanceof e.ImmediateRenderObject||t.immediateRenderCallback){tt(y,t)}delete t.__webglInit;delete t._modelViewMatrix;delete t._normalMatrix;delete t.__webglActive}function tt(e,t){for(var r=e.length-1;r>=0;r--){if(e[r].object===t){e.splice(r,1)}}}var rt={MeshDepthMaterial:"depth",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointCloudMaterial:"particle_basic"};function nt(t,r,n,i){t.addEventListener("dispose",be);var o=rt[t.type];if(o){var s=e.ShaderLib[o];t.__webglShader={uniforms:e.UniformsUtils.clone(s.uniforms),vertexShader:s.vertexShader,fragmentShader:s.fragmentShader}}else{t.__webglShader={uniforms:t.uniforms,vertexShader:t.vertexShader,fragmentShader:t.fragmentShader}}var u=It(r);var l=Dt(r);var c=kt(i);var f={precision:a,supportsVertexTextures:ee,map:!!t.map,envMap:!!t.envMap,envMapMode:t.envMap&&t.envMap.mapping,lightMap:!!t.lightMap,bumpMap:!!t.bumpMap,normalMap:!!t.normalMap,specularMap:!!t.specularMap,alphaMap:!!t.alphaMap,combine:t.combine,vertexColors:t.vertexColors,fog:n,useFog:t.fog,fogExp:n instanceof e.FogExp2,flatShading:t.shading===e.FlatShading,sizeAttenuation:t.sizeAttenuation,logarithmicDepthBuffer:h,skinning:t.skinning,maxBones:c,useVertexTexture:te&&i&&i.skeleton&&i.skeleton.useVertexTexture,morphTargets:t.morphTargets,morphNormals:t.morphNormals,maxMorphTargets:w.maxMorphTargets,maxMorphNormals:w.maxMorphNormals,maxDirLights:u.directional,maxPointLights:u.point,maxSpotLights:u.spot,maxHemiLights:u.hemi,maxShadows:l,shadowMapEnabled:w.shadowMapEnabled&&i.receiveShadow&&l>0,shadowMapType:w.shadowMapType,shadowMapDebug:w.shadowMapDebug,shadowMapCascade:w.shadowMapCascade,alphaTest:t.alphaTest,metal:t.metal,wrapAround:t.wrapAround,doubleSided:t.side===e.DoubleSide,flipSided:t.side===e.BackSide};var d=[];if(o){d.push(o)}else{d.push(t.fragmentShader);d.push(t.vertexShader)}if(t.defines!==undefined){for(var p in t.defines){d.push(p);d.push(t.defines[p])}}for(var p in f){d.push(p);d.push(f[p])}var m=d.join();var v;for(var y=0,g=C.length;y<g;y++){var b=C[y];if(b.code===m){v=b;v.usedTimes++;break}}if(v===undefined){v=new e.WebGLProgram(w,m,t,f);C.push(v);w.info.memory.programs=C.length}t.program=v;var x=v.attributes;if(t.morphTargets){t.numSupportedMorphTargets=0;var _,E="morphTarget";for(var S=0;S<w.maxMorphTargets;S++){_=E+S;if(x[_]>=0){t.numSupportedMorphTargets++}}}if(t.morphNormals){t.numSupportedMorphNormals=0;var _,E="morphNormal";for(S=0;S<w.maxMorphNormals;S++){_=E+S;if(x[_]>=0){t.numSupportedMorphNormals++}}}t.uniformsList=[];for(var T in t.__webglShader.uniforms){var M=t.program.uniforms[T];if(M){t.uniformsList.push([t.__webglShader.uniforms[T],M])}}}function it(t){if(t.transparent===true){W.setBlending(t.blending,t.blendEquation,t.blendSrc,t.blendDst,t.blendEquationAlpha,t.blendSrcAlpha,t.blendDstAlpha)}else{W.setBlending(e.NoBlending)}W.setDepthTest(t.depthTest);W.setDepthWrite(t.depthWrite);W.setColorWrite(t.colorWrite);W.setPolygonOffset(t.polygonOffset,t.polygonOffsetFactor,t.polygonOffsetUnits)}function at(t,r,n,i,a){P=0;if(i.needsUpdate){if(i.program)Ee(i);nt(i,r,n,a);i.needsUpdate=false}if(i.morphTargets){if(!a.__webglMorphTargetInfluences){a.__webglMorphTargetInfluences=new Float32Array(w.maxMorphTargets)}}var o=false;var s=false;var u=false;var l=i.program,c=l.uniforms,f=i.__webglShader.uniforms;if(l.id!==E){H.useProgram(l.program);E=l.id;o=true;s=true;u=true}if(i.id!==T){if(T===-1)u=true;T=i.id;s=true}if(o||t!==A){H.uniformMatrix4fv(c.projectionMatrix,false,t.projectionMatrix.elements);if(h){H.uniform1f(c.logDepthBufFC,2/(Math.log(t.far+1)/Math.LN2))}if(t!==A)A=t;if(i instanceof e.ShaderMaterial||i instanceof e.MeshPhongMaterial||i.envMap){if(c.cameraPosition!==null){O.setFromMatrixPosition(t.matrixWorld) 116;H.uniform3f(c.cameraPosition,O.x,O.y,O.z)}}if(i instanceof e.MeshPhongMaterial||i instanceof e.MeshLambertMaterial||i instanceof e.MeshBasicMaterial||i instanceof e.ShaderMaterial||i.skinning){if(c.viewMatrix!==null){H.uniformMatrix4fv(c.viewMatrix,false,t.matrixWorldInverse.elements)}}}if(i.skinning){if(a.bindMatrix&&c.bindMatrix!==null){H.uniformMatrix4fv(c.bindMatrix,false,a.bindMatrix.elements)}if(a.bindMatrixInverse&&c.bindMatrixInverse!==null){H.uniformMatrix4fv(c.bindMatrixInverse,false,a.bindMatrixInverse.elements)}if(te&&a.skeleton&&a.skeleton.useVertexTexture){if(c.boneTexture!==null){var d=yt();H.uniform1i(c.boneTexture,d);w.setTexture(a.skeleton.boneTexture,d)}if(c.boneTextureWidth!==null){H.uniform1i(c.boneTextureWidth,a.skeleton.boneTextureWidth)}if(c.boneTextureHeight!==null){H.uniform1i(c.boneTextureHeight,a.skeleton.boneTextureHeight)}}else if(a.skeleton&&a.skeleton.boneMatrices){if(c.boneGlobalMatrices!==null){H.uniformMatrix4fv(c.boneGlobalMatrices,false,a.skeleton.boneMatrices)}}}if(s){if(n&&i.fog){ct(f,n)}if(i instanceof e.MeshPhongMaterial||i instanceof e.MeshLambertMaterial||i.lights){if(N){u=true;_t(r);N=false}if(u){dt(f,z);pt(f,true)}else{pt(f,false)}}if(i instanceof e.MeshBasicMaterial||i instanceof e.MeshLambertMaterial||i instanceof e.MeshPhongMaterial){ot(f,i)}if(i instanceof e.LineBasicMaterial){st(f,i)}else if(i instanceof e.LineDashedMaterial){st(f,i);ut(f,i)}else if(i instanceof e.PointCloudMaterial){lt(f,i)}else if(i instanceof e.MeshPhongMaterial){ft(f,i)}else if(i instanceof e.MeshLambertMaterial){ht(f,i)}else if(i instanceof e.MeshDepthMaterial){f.mNear.value=t.near;f.mFar.value=t.far;f.opacity.value=i.opacity}else if(i instanceof e.MeshNormalMaterial){f.opacity.value=i.opacity}if(a.receiveShadow&&!i._shadowPass){mt(f,r)}gt(i.uniformsList)}vt(c,a);if(c.modelMatrix!==null){H.uniformMatrix4fv(c.modelMatrix,false,a.matrixWorld.elements)}return l}function ot(t,r){t.opacity.value=r.opacity;t.diffuse.value=r.color;t.map.value=r.map;t.lightMap.value=r.lightMap;t.specularMap.value=r.specularMap;t.alphaMap.value=r.alphaMap;if(r.bumpMap){t.bumpMap.value=r.bumpMap;t.bumpScale.value=r.bumpScale}if(r.normalMap){t.normalMap.value=r.normalMap;t.normalScale.value.copy(r.normalScale)}var n;if(r.map){n=r.map}else if(r.specularMap){n=r.specularMap}else if(r.normalMap){n=r.normalMap}else if(r.bumpMap){n=r.bumpMap}else if(r.alphaMap){n=r.alphaMap}
116if(n!==undefined){var i=n.offset;var a=n.repeat;t.offsetRepeat.value.set(i.x,i.y,a.x,a.y)}t.envMap.value=r.envMap;t.flipEnvMap.value=r.envMap instanceof e.WebGLRenderTargetCube?1:-1;t.reflectivity.value=r.reflectivity;t.refractionRatio.value=r.refractionRatio}function st(e,t){e.diffuse.value=t.color;e.opacity.value=t.opacity}function ut(e,t){e.dashSize.value=t.dashSize;e.totalSize.value=t.dashSize+t.gapSize;e.scale.value=t.scale}function lt(e,t){e.psColor.value=t.color;e.opacity.value=t.opacity;e.size.value=t.size;e.scale.value=r.height/2;e.map.value=t.map;if(t.map!==null){var n=t.map.offset;var i=t.map.repeat;e.offsetRepeat.value.set(n.x,n.y,i.x,i.y)}}function ct(t,r){t.fogColor.value=r.color;if(r instanceof e.Fog){t.fogNear.value=r.near;t.fogFar.value=r.far}else if(r instanceof e.FogExp2){t.fogDensity.value=r.density}}function ft(e,t){e.shininess.value=t.shininess;e.emissive.value=t.emissive;e.specular.value=t.specular;if(t.wrapAround){e.wrapRGB.value.copy(t.wrapRGB)}}function ht(e,t){e.emissive.value=t.emissive;if(t.wrapAround){e.wrapRGB.value.copy(t.wrapRGB)}}function dt(e,t){e.ambientLightColor.value=t.ambient;e.directionalLightColor.value=t.directional.colors;e.directionalLightDirection.value=t.directional.positions;e.pointLightColor.value=t.point.colors;e.pointLightPosition.value=t.point.positions;e.pointLightDistance.value=t.point.distances;e.pointLightDecay.value=t.point.decays;e.spotLightColor.value=t.spot.colors;e.spotLightPosition.value=t.spot.positions;e.spotLightDistance.value=t.spot.distances;e.spotLightDirection.value=t.spot.directions;e.spotLightAngleCos.value=t.spot.anglesCos;e.spotLightExponent.value=t.spot.exponents;e.spotLightDecay.value=t.spot.decays;e.hemisphereLightSkyColor.value=t.hemi.skyColors;e.hemisphereLightGroundColor.value=t.hemi.groundColors;e.hemisphereLightDirection.value=t.hemi.positions}function pt(e,t){e.ambientLightColor.needsUpdate=t;e.directionalLightColor.needsUpdate=t;e.directionalLightDirection.needsUpdate=t;e.pointLightColor.needsUpdate=t;e.pointLightPosition.needsUpdate=t;e.pointLightDistance.needsUpdate=t;e.pointLightDecay.needsUpdate=t;e.spotLightColor.needsUpdate=t;e.spotLightPosition.needsUpdate=t;e.spotLightDistance.needsUpdate=t;e.spotLightDirection.needsUpdate=t;e.spotLightAngleCos.needsUpdate=t;e.spotLightExponent.needsUpdate=t;e.spotLightDecay.needsUpdate=t;e.hemisphereLightSkyColor.needsUpdate=t;e.hemisphereLightGroundColor.needsUpdate=t;e.hemisphereLightDirection.needsUpdate=t}function mt(t,r){if(t.shadowMatrix){var n=0;for(var i=0,a=r.length;i<a;i++){var o=r[i];if(!o.castShadow)continue;if(o instanceof e.SpotLight||o instanceof e.DirectionalLight&&!o.shadowCascade){t.shadowMap.value[n]=o.shadowMap;t.shadowMapSize.value[n]=o.shadowMapSize;t.shadowMatrix.value[n]=o.shadowMatrix;t.shadowDarkness.value[n]=o.shadowDarkness;t.shadowBias.value[n]=o.shadowBias;n++}}}}function vt(e,t){H.uniformMatrix4fv(e.modelViewMatrix,false,t._modelViewMatrix.elements);if(e.normalMatrix){H.uniformMatrix3fv(e.normalMatrix,false,t._normalMatrix.elements)}}function yt(){var t=P;if(t>=Q){e.warn("WebGLRenderer: trying to use "+t+" texture units while this GPU supports only "+Q)}P+=1;return t}function gt(t){var r,n,i;for(var a=0,o=t.length;a<o;a++){var s=t[a][0];if(s.needsUpdate===false)continue;var u=s.type;var l=s.value;var c=t[a][1];switch(u){case"1i":H.uniform1i(c,l);break;case"1f":H.uniform1f(c,l);break;case"2f":H.uniform2f(c,l[0],l[1]);break;case"3f":H.uniform3f(c,l[0],l[1],l[2]);break;case"4f":H.uniform4f(c,l[0],l[1],l[2],l[3]);break;case"1iv":H.uniform1iv(c,l);break;case"3iv":H.uniform3iv(c,l);break;case"1fv":H.uniform1fv(c,l);break;case"2fv":H.uniform2fv(c,l);break;case"3fv":H.uniform3fv(c,l);break;case"4fv":H.uniform4fv(c,l);break;case"Matrix3fv":H.uniformMatrix3fv(c,false,l);break;case"Matrix4fv":H.uniformMatrix4fv(c,false,l);break;case"i":H.uniform1i(c,l);break;case"f":H.uniform1f(c,l);break;case"v2":H.uniform2f(c,l.x,l.y);break;case"v3":H.uniform3f(c,l.x,l.y,l.z);break;case"v4":H.uniform4f(c,l.x,l.y,l.z,l.w);break;case"c":H.uniform3f(c,l.r,l.g,l.b);break;case"iv1":H.uniform1iv(c,l);break;case"iv":H.uniform3iv(c,l);break;case"fv1":H.uniform1fv(c,l);break;case"fv":H.uniform3fv(c,l);break;case"v2v":if(s._array===undefined){s._array=new Float32Array(2*l.length)}for(var f=0,h=l.length;f<h;f++){i=f*2;s._array[i]=l[f].x;s._array[i+1]=l[f].y}H.uniform2fv(c,s._array);break;case"v3v":if(s._array===undefined){s._array=new Float32Array(3*l.length)}for(var f=0,h=l.length;f<h;f++){i=f*3;s._array[i]=l[f].x;s._array[i+1]=l[f].y;s._array[i+2]=l[f].z}H.uniform3fv(c,s._array);break;case"v4v":if(s._array===undefined){s._array=new Float32Array(4*l.length)}for(var f=0,h=l.length;f<h;f++){i=f*4;s._array[i]=l[f].x;s._array[i+1]=l[f].y;s._array[i+2]=l[f].z;s._array[i+3]=l[f].w}H.uniform4fv(c,s._array);break;case"m3":H.uniformMatrix3fv(c,false,l.elements);break;case"m3v":if(s._array===undefined){s._array=new Float32Array(9*l.length)}for(var f=0,h=l.length;f<h;f++){l[f].flattenToArrayOffset(s._array,f*9)}H.uniformMatrix3fv(c,false,s._array);break;
116case"m4":H.uniformMatrix4fv(c,false,l.elements);break;case"m4v":if(s._array===undefined){s._array=new Float32Array(16*l.length)}for(var f=0,h=l.length;f<h;f++){l[f].flattenToArrayOffset(s._array,f*16)}H.uniformMatrix4fv(c,false,s._array);break;case"t":r=l;n=yt();H.uniform1i(c,n);if(!r)continue;if(r instanceof e.CubeTexture||r.image instanceof Array&&r.image.length===6){Et(r,n)}else if(r instanceof e.WebGLRenderTargetCube){St(r,n)}else{w.setTexture(r,n)}break;case"tv":if(s._array===undefined){s._array=[]}for(var f=0,h=s.value.length;f<h;f++){s._array[f]=yt()}H.uniform1iv(c,s._array);for(var f=0,h=s.value.length;f<h;f++){r=s.value[f];n=s._array[f];if(!r)continue;w.setTexture(r,n)}break;default:e.warn("THREE.WebGLRenderer: Unknown uniform type: "+u)}}}function bt(e,t){e._modelViewMatrix.multiplyMatrices(t.matrixWorldInverse,e.matrixWorld);e._normalMatrix.getNormalMatrix(e._modelViewMatrix)}function xt(e,t,r,n){e[t]=r.r*n;e[t+1]=r.g*n;e[t+2]=r.b*n}function _t(t){var r,n,i,a=0,o=0,s=0,u,l,c,f,h,d=z,p=d.directional.colors,m=d.directional.positions,v=d.point.colors,y=d.point.positions,g=d.point.distances,b=d.point.decays,x=d.spot.colors,_=d.spot.positions,w=d.spot.distances,C=d.spot.directions,E=d.spot.anglesCos,S=d.spot.exponents,T=d.spot.decays,M=d.hemi.skyColors,A=d.hemi.groundColors,P=d.hemi.positions,R=0,k=0,I=0,D=0,B=0,L=0,F=0,V=0,N=0,H=0,j=0,G=0;for(r=0,n=t.length;r<n;r++){i=t[r];if(i.onlyShadow)continue;u=i.color;f=i.intensity;h=i.distance;if(i instanceof e.AmbientLight){if(!i.visible)continue;a+=u.r;o+=u.g;s+=u.b}else if(i instanceof e.DirectionalLight){B+=1;if(!i.visible)continue;U.setFromMatrixPosition(i.matrixWorld);O.setFromMatrixPosition(i.target.matrixWorld);U.sub(O);U.normalize();N=R*3;m[N]=U.x;m[N+1]=U.y;m[N+2]=U.z;xt(p,N,u,f);R+=1}else if(i instanceof e.PointLight){L+=1;if(!i.visible)continue;H=k*3;xt(v,H,u,f);O.setFromMatrixPosition(i.matrixWorld);y[H]=O.x;y[H+1]=O.y;y[H+2]=O.z;g[k]=h;b[k]=i.distance===0?0:i.decay;k+=1}else if(i instanceof e.SpotLight){F+=1;if(!i.visible)continue;j=I*3;xt(x,j,u,f);U.setFromMatrixPosition(i.matrixWorld);_[j]=U.x;_[j+1]=U.y;_[j+2]=U.z;w[I]=h;O.setFromMatrixPosition(i.target.matrixWorld);U.sub(O);U.normalize();C[j]=U.x;C[j+1]=U.y;C[j+2]=U.z;E[I]=Math.cos(i.angle);S[I]=i.exponent;T[I]=i.distance===0?0:i.decay;I+=1}else if(i instanceof e.HemisphereLight){V+=1;if(!i.visible)continue;U.setFromMatrixPosition(i.matrixWorld);U.normalize();G=D*3;P[G]=U.x;P[G+1]=U.y;P[G+2]=U.z;l=i.color;c=i.groundColor;xt(M,G,l,f);xt(A,G,c,f);D+=1}}for(r=R*3,n=Math.max(p.length,B*3);r<n;r++)p[r]=0;for(r=k*3,n=Math.max(v.length,L*3);r<n;r++)v[r]=0;for(r=I*3,n=Math.max(x.length,F*3);r<n;r++)x[r]=0;for(r=D*3,n=Math.max(M.length,V*3);r<n;r++)M[r]=0;for(r=D*3,n=Math.max(A.length,V*3);r<n;r++)A[r]=0;d.directional.length=R;d.point.length=k;d.spot.length=I;d.hemi.length=D;d.ambient[0]=a;d.ambient[1]=o;d.ambient[2]=s}this.setFaceCulling=function(t,r){if(t===e.CullFaceNone){H.disable(H.CULL_FACE)}else{if(r===e.FrontFaceDirectionCW){H.frontFace(H.CW)}else{H.frontFace(H.CCW)}if(t===e.CullFaceBack){H.cullFace(H.BACK)}else if(t===e.CullFaceFront){H.cullFace(H.FRONT)}else{H.cullFace(H.FRONT_AND_BACK)}H.enable(H.CULL_FACE)}};this.setMaterialFaces=function(t){W.setDoubleSided(t.side===e.DoubleSide);W.setFlipSided(t.side===e.BackSide)};function wt(t,r,n){var i;if(n){H.texParameteri(t,H.TEXTURE_WRAP_S,Rt(r.wrapS));H.texParameteri(t,H.TEXTURE_WRAP_T,Rt(r.wrapT));H.texParameteri(t,H.TEXTURE_MAG_FILTER,Rt(r.magFilter));H.texParameteri(t,H.TEXTURE_MIN_FILTER,Rt(r.minFilter))}else{H.texParameteri(t,H.TEXTURE_WRAP_S,H.CLAMP_TO_EDGE);H.texParameteri(t,H.TEXTURE_WRAP_T,H.CLAMP_TO_EDGE);if(r.wrapS!==e.ClampToEdgeWrapping||r.wrapT!==e.ClampToEdgeWrapping){e.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping. ( "+r.sourceFile+" )")}H.texParameteri(t,H.TEXTURE_MAG_FILTER,Pt(r.magFilter));H.texParameteri(t,H.TEXTURE_MIN_FILTER,Pt(r.minFilter));if(r.minFilter!==e.NearestFilter&&r.minFilter!==e.LinearFilter){e.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter. ( "+r.sourceFile+" )")}}i=q.get("EXT_texture_filter_anisotropic");if(i&&r.type!==e.FloatType&&r.type!==e.HalfFloatType){if(r.anisotropy>1||r.__currentAnisotropy){H.texParameterf(t,i.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(r.anisotropy,w.getMaxAnisotropy()));r.__currentAnisotropy=r.anisotropy}}}this.uploadTexture=function(t){if(t.__webglInit===undefined){t.__webglInit=true;t.addEventListener("dispose",ye);t.__webglTexture=H.createTexture();w.info.memory.textures++}H.bindTexture(H.TEXTURE_2D,t.__webglTexture);H.pixelStorei(H.UNPACK_FLIP_Y_WEBGL,t.flipY);H.pixelStorei(H.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t.premultiplyAlpha);H.pixelStorei(H.UNPACK_ALIGNMENT,t.unpackAlignment);t.image=Ct(t.image,J);var r=t.image,n=e.Math.isPowerOfTwo(r.width)&&e.Math.isPowerOfTwo(r.height),i=Rt(t.format),a=Rt(t.type);wt(H.TEXTURE_2D,t,n);var o,s=t.mipmaps;if(t instanceof e.DataTexture){if(s.length>0&&n){for(var u=0,l=s.length;u<l;u++){o=s[u];H.texImage2D(H.TEXTURE_2D,u,i,o.width,o.height,0,i,a,o.data)}t.generateMipmaps=false}else{H.texImage2D(H.TEXTURE_2D,0,i,r.width,r.height,0,i,a,r.data)}}else if(t instanceof e.CompressedTexture){for(var u=0,l=s.length;u<l;u++){o=s[u];if(t.format!==e.RGBAFormat&&t.format!==e.RGBFormat){if(oe().indexOf(i)>-1){H.compressedTexImage2D(H.TEXTURE_2D,u,i,o.width,o.height,0,o.data)}else{e.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()")}}else{H.texImage2D(H.TEXTURE_2D,u,i,o.width,o.height,0,i,a,o.data)}}}else{if(s.length>0&&n){for(var u=0,l=s.length;u<l;u++){o=s[u];H.texImage2D(H.TEXTURE_2D,u,i,i,a,o)}t.generateMipmaps=false}else{H.texImage2D(H.TEXTURE_2D,0,i,i,a,t.image)}}if(t.generateMipmaps&&n)H.generateMipmap(H.TEXTURE_2D);t.needsUpdate=false;if(t.onUpdate)t.onUpdate()};this.setTexture=function(e,t){H.activeTexture(H.TEXTURE0+t);if(e.needsUpdate){w.uploadTexture(e)}else{H.bindTexture(H.TEXTURE_2D,e.__webglTexture)}};function Ct(t,r){if(t.width>r||t.height>r){var n=r/Math.max(t.width,t.height);var i=document.createElement("canvas");i.width=Math.floor(t.width*n);i.height=Math.floor(t.height*n);var a=i.getContext("2d");a.drawImage(t,0,0,t.width,t.height,0,0,i.width,i.height);e.warn("THREE.WebGLRenderer: image is too big ("+t.width+"x"+t.height+"). Resized to "+i.width+"x"+i.height,t);return i}return t}function Et(t,r){if(t.image.length===6){if(t.needsUpdate){if(!t.image.__webglTextureCube){t.addEventListener("dispose",ye);t.image.__webglTextureCube=H.createTexture();w.info.memory.textures++}H.activeTexture(H.TEXTURE0+r);H.bindTexture(H.TEXTURE_CUBE_MAP,t.image.__webglTextureCube);H.pixelStorei(H.UNPACK_FLIP_Y_WEBGL,t.flipY);var n=t instanceof e.CompressedTexture;var i=t.image[0]instanceof e.DataTexture;var a=[];for(var o=0;o<6;o++){if(w.autoScaleCubemaps&&!n&&!i){a[o]=Ct(t.image[o],$)}else{a[o]=i?t.image[o].image:t.image[o]}}var s=a[0],u=e.Math.isPowerOfTwo(s.width)&&e.Math.isPowerOfTwo(s.height),l=Rt(t.format),c=Rt(t.type);wt(H.TEXTURE_CUBE_MAP,t,u);for(var o=0;o<6;
116o++){if(!n){if(i){H.texImage2D(H.TEXTURE_CUBE_MAP_POSITIVE_X+o,0,l,a[o].width,a[o].height,0,l,c,a[o].data)}else{H.texImage2D(H.TEXTURE_CUBE_MAP_POSITIVE_X+o,0,l,l,c,a[o])}}else{var f,h=a[o].mipmaps;for(var d=0,p=h.length;d<p;d++){f=h[d];if(t.format!==e.RGBAFormat&&t.format!==e.RGBFormat){if(oe().indexOf(l)>-1){H.compressedTexImage2D(H.TEXTURE_CUBE_MAP_POSITIVE_X+o,d,l,f.width,f.height,0,f.data)}else{e.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setCubeTexture()")}}else{H.texImage2D(H.TEXTURE_CUBE_MAP_POSITIVE_X+o,d,l,f.width,f.height,0,l,c,f.data)}}}}if(t.generateMipmaps&&u){H.generateMipmap(H.TEXTURE_CUBE_MAP)}t.needsUpdate=false;if(t.onUpdate)t.onUpdate()}else{H.activeTexture(H.TEXTURE0+r);H.bindTexture(H.TEXTURE_CUBE_MAP,t.image.__webglTextureCube)}}}function St(e,t){H.activeTexture(H.TEXTURE0+t);H.bindTexture(H.TEXTURE_CUBE_MAP,e.__webglTexture)}function Tt(e,t,r){H.bindFramebuffer(H.FRAMEBUFFER,e);H.framebufferTexture2D(H.FRAMEBUFFER,H.COLOR_ATTACHMENT0,r,t.__webglTexture,0)}function Mt(e,t){H.bindRenderbuffer(H.RENDERBUFFER,e);if(t.depthBuffer&&!t.stencilBuffer){H.renderbufferStorage(H.RENDERBUFFER,H.DEPTH_COMPONENT16,t.width,t.height);H.framebufferRenderbuffer(H.FRAMEBUFFER,H.DEPTH_ATTACHMENT,H.RENDERBUFFER,e)}else if(t.depthBuffer&&t.stencilBuffer){H.renderbufferStorage(H.RENDERBUFFER,H.DEPTH_STENCIL,t.width,t.height);H.framebufferRenderbuffer(H.FRAMEBUFFER,H.DEPTH_STENCIL_ATTACHMENT,H.RENDERBUFFER,e)}else{H.renderbufferStorage(H.RENDERBUFFER,H.RGBA4,t.width,t.height)}}this.setRenderTarget=function(t){var r=t instanceof e.WebGLRenderTargetCube;if(t&&t.__webglFramebuffer===undefined){if(t.depthBuffer===undefined)t.depthBuffer=true;if(t.stencilBuffer===undefined)t.stencilBuffer=true;t.addEventListener("dispose",ge);t.__webglTexture=H.createTexture();w.info.memory.textures++;var n=e.Math.isPowerOfTwo(t.width)&&e.Math.isPowerOfTwo(t.height),i=Rt(t.format),a=Rt(t.type);if(r){t.__webglFramebuffer=[];t.__webglRenderbuffer=[];H.bindTexture(H.TEXTURE_CUBE_MAP,t.__webglTexture);wt(H.TEXTURE_CUBE_MAP,t,n);for(var o=0;o<6;o++){t.__webglFramebuffer[o]=H.createFramebuffer();t.__webglRenderbuffer[o]=H.createRenderbuffer();H.texImage2D(H.TEXTURE_CUBE_MAP_POSITIVE_X+o,0,i,t.width,t.height,0,i,a,null);Tt(t.__webglFramebuffer[o],t,H.TEXTURE_CUBE_MAP_POSITIVE_X+o);Mt(t.__webglRenderbuffer[o],t)}if(n)H.generateMipmap(H.TEXTURE_CUBE_MAP)}else{t.__webglFramebuffer=H.createFramebuffer();if(t.shareDepthFrom){t.__webglRenderbuffer=t.shareDepthFrom.__webglRenderbuffer}else{t.__webglRenderbuffer=H.createRenderbuffer()}H.bindTexture(H.TEXTURE_2D,t.__webglTexture);wt(H.TEXTURE_2D,t,n);H.texImage2D(H.TEXTURE_2D,0,i,t.width,t.height,0,i,a,null);Tt(t.__webglFramebuffer,t,H.TEXTURE_2D);if(t.shareDepthFrom){if(t.depthBuffer&&!t.stencilBuffer){H.framebufferRenderbuffer(H.FRAMEBUFFER,H.DEPTH_ATTACHMENT,H.RENDERBUFFER,t.__webglRenderbuffer)}else if(t.depthBuffer&&t.stencilBuffer){H.framebufferRenderbuffer(H.FRAMEBUFFER,H.DEPTH_STENCIL_ATTACHMENT,H.RENDERBUFFER,t.__webglRenderbuffer)}}else{Mt(t.__webglRenderbuffer,t)}if(n)H.generateMipmap(H.TEXTURE_2D)}if(r){H.bindTexture(H.TEXTURE_CUBE_MAP,null)}else{H.bindTexture(H.TEXTURE_2D,null)}H.bindRenderbuffer(H.RENDERBUFFER,null);H.bindFramebuffer(H.FRAMEBUFFER,null)}var s,u,l,c,f;if(t){if(r){s=t.__webglFramebuffer[t.activeCubeFace]}else{s=t.__webglFramebuffer}u=t.width;l=t.height;c=0;f=0}else{s=null;u=I;l=D;c=R;f=k}if(s!==S){H.bindFramebuffer(H.FRAMEBUFFER,s);H.viewport(c,f,u,l);S=s}B=u;L=l};this.readRenderTargetPixels=function(t,r,n,i,a,o){if(!(t instanceof e.WebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}if(t.__webglFramebuffer){if(t.format!==e.RGBAFormat){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA format. readPixels can read only RGBA format.");return}var s=false;if(t.__webglFramebuffer!==S){H.bindFramebuffer(H.FRAMEBUFFER,t.__webglFramebuffer);s=true}if(H.checkFramebufferStatus(H.FRAMEBUFFER)===H.FRAMEBUFFER_COMPLETE){H.readPixels(r,n,i,a,H.RGBA,H.UNSIGNED_BYTE,o)}else{console.error("THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete.")}if(s){H.bindFramebuffer(H.FRAMEBUFFER,S)}}};function At(t){if(t instanceof e.WebGLRenderTargetCube){H.bindTexture(H.TEXTURE_CUBE_MAP,t.__webglTexture);H.generateMipmap(H.TEXTURE_CUBE_MAP);H.bindTexture(H.TEXTURE_CUBE_MAP,null)}else{H.bindTexture(H.TEXTURE_2D,t.__webglTexture);H.generateMipmap(H.TEXTURE_2D);H.bindTexture(H.TEXTURE_2D,null)}}function Pt(t){if(t===e.NearestFilter||t===e.NearestMipMapNearestFilter||t===e.NearestMipMapLinearFilter){return H.NEAREST}return H.LINEAR}function Rt(t){var r;if(t===e.RepeatWrapping)return H.REPEAT;if(t===e.ClampToEdgeWrapping)return H.CLAMP_TO_EDGE;if(t===e.MirroredRepeatWrapping)return H.MIRRORED_REPEAT;if(t===e.NearestFilter)return H.NEAREST;if(t===e.NearestMipMapNearestFilter)return H.NEAREST_MIPMAP_NEAREST;if(t===e.NearestMipMapLinearFilter)return H.NEAREST_MIPMAP_LINEAR;if(t===e.LinearFilter)return H.LINEAR;if(t===e.LinearMipMapNearestFilter)return H.LINEAR_MIPMAP_NEAREST;if(t===e.LinearMipMapLinearFilter)return H.LINEAR_MIPMAP_LINEAR;if(t===e.UnsignedByteType)return H.UNSIGNED_BYTE;if(t===e.UnsignedShort4444Type)return H.UNSIGNED_SHORT_4_4_4_4;if(t===e.UnsignedShort5551Type)return H.UNSIGNED_SHORT_5_5_5_1;if(t===e.UnsignedShort565Type)return H.UNSIGNED_SHORT_5_6_5;if(t===e.ByteType)return H.BYTE;if(t===e.ShortType)return H.SHORT;if(t===e.UnsignedShortType)return H.UNSIGNED_SHORT;if(t===e.IntType)return H.INT;if(t===e.UnsignedIntType)return H.UNSIGNED_INT;if(t===e.FloatType)return H.FLOAT;r=q.get("OES_texture_half_float");
116if(r!==null){if(t===e.HalfFloatType)return r.HALF_FLOAT_OES}if(t===e.AlphaFormat)return H.ALPHA;if(t===e.RGBFormat)return H.RGB;if(t===e.RGBAFormat)return H.RGBA;if(t===e.LuminanceFormat)return H.LUMINANCE;if(t===e.LuminanceAlphaFormat)return H.LUMINANCE_ALPHA;if(t===e.AddEquation)return H.FUNC_ADD;if(t===e.SubtractEquation)return H.FUNC_SUBTRACT;if(t===e.ReverseSubtractEquation)return H.FUNC_REVERSE_SUBTRACT;if(t===e.ZeroFactor)return H.ZERO;if(t===e.OneFactor)return H.ONE;if(t===e.SrcColorFactor)return H.SRC_COLOR;if(t===e.OneMinusSrcColorFactor)return H.ONE_MINUS_SRC_COLOR;if(t===e.SrcAlphaFactor)return H.SRC_ALPHA;if(t===e.OneMinusSrcAlphaFactor)return H.ONE_MINUS_SRC_ALPHA;if(t===e.DstAlphaFactor)return H.DST_ALPHA;if(t===e.OneMinusDstAlphaFactor)return H.ONE_MINUS_DST_ALPHA;if(t===e.DstColorFactor)return H.DST_COLOR;if(t===e.OneMinusDstColorFactor)return H.ONE_MINUS_DST_COLOR;if(t===e.SrcAlphaSaturateFactor)return H.SRC_ALPHA_SATURATE;r=q.get("WEBGL_compressed_texture_s3tc");if(r!==null){if(t===e.RGB_S3TC_DXT1_Format)return r.COMPRESSED_RGB_S3TC_DXT1_EXT;if(t===e.RGBA_S3TC_DXT1_Format)return r.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(t===e.RGBA_S3TC_DXT3_Format)return r.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(t===e.RGBA_S3TC_DXT5_Format)return r.COMPRESSED_RGBA_S3TC_DXT5_EXT}r=q.get("WEBGL_compressed_texture_pvrtc");if(r!==null){if(t===e.RGB_PVRTC_4BPPV1_Format)return r.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(t===e.RGB_PVRTC_2BPPV1_Format)return r.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(t===e.RGBA_PVRTC_4BPPV1_Format)return r.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(t===e.RGBA_PVRTC_2BPPV1_Format)return r.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}r=q.get("EXT_blend_minmax");if(r!==null){if(t===e.MinEquation)return r.MIN_EXT;if(t===e.MaxEquation)return r.MAX_EXT}return 0}function kt(t){if(te&&t&&t.skeleton&&t.skeleton.useVertexTexture){return 1024}else{var r=H.getParameter(H.MAX_VERTEX_UNIFORM_VECTORS);var n=Math.floor((r-20)/4);var i=n;if(t!==undefined&&t instanceof e.SkinnedMesh){i=Math.min(t.skeleton.bones.length,i);if(i<t.skeleton.bones.length){e.warn("WebGLRenderer: too many bones - "+t.skeleton.bones.length+", this GPU supports just "+i+" (try OpenGL instead of ANGLE)")}}return i}}function It(t){var r=0;var n=0;var i=0;var a=0;for(var o=0,s=t.length;o<s;o++){var u=t[o];if(u.onlyShadow||u.visible===false)continue;if(u instanceof e.DirectionalLight)r++;if(u instanceof e.PointLight)n++;if(u instanceof e.SpotLight)i++;if(u instanceof e.HemisphereLight)a++}return{directional:r,point:n,spot:i,hemi:a}}function Dt(t){var r=0;for(var n=0,i=t.length;n<i;n++){var a=t[n];if(!a.castShadow)continue;if(a instanceof e.SpotLight)r++;if(a instanceof e.DirectionalLight&&!a.shadowCascade)r++}return r}this.initMaterial=function(){e.warn("THREE.WebGLRenderer: .initMaterial() has been removed.")};this.addPrePlugin=function(){e.warn("THREE.WebGLRenderer: .addPrePlugin() has been removed.")};this.addPostPlugin=function(){e.warn("THREE.WebGLRenderer: .addPostPlugin() has been removed.")};this.updateShadowMap=function(){e.warn("THREE.WebGLRenderer: .updateShadowMap() has been removed.")}};e.WebGLRenderTarget=function(t,r,n){this.width=t;this.height=r;n=n||{};this.wrapS=n.wrapS!==undefined?n.wrapS:e.ClampToEdgeWrapping;this.wrapT=n.wrapT!==undefined?n.wrapT:e.ClampToEdgeWrapping;this.magFilter=n.magFilter!==undefined?n.magFilter:e.LinearFilter;this.minFilter=n.minFilter!==undefined?n.minFilter:e.LinearMipMapLinearFilter;this.anisotropy=n.anisotropy!==undefined?n.anisotropy:1;this.offset=new e.Vector2(0,0);this.repeat=new e.Vector2(1,1);this.format=n.format!==undefined?n.format:e.RGBAFormat;this.type=n.type!==undefined?n.type:e.UnsignedByteType;this.depthBuffer=n.depthBuffer!==undefined?n.depthBuffer:true;this.stencilBuffer=n.stencilBuffer!==undefined?n.stencilBuffer:true;this.generateMipmaps=true;this.shareDepthFrom=n.shareDepthFrom!==undefined?n.shareDepthFrom:null};e.WebGLRenderTarget.prototype={constructor:e.WebGLRenderTarget,setSize:function(e,t){if(this.width!==e||this.height!==t){this.width=e;this.height=t;this.dispose()}},clone:function(){var t=new e.WebGLRenderTarget(this.width,this.height);t.wrapS=this.wrapS;t.wrapT=this.wrapT;t.magFilter=this.magFilter;t.minFilter=this.minFilter;t.anisotropy=this.anisotropy;t.offset.copy(this.offset);t.repeat.copy(this.repeat);t.format=this.format;
116t.type=this.type;t.depthBuffer=this.depthBuffer;t.stencilBuffer=this.stencilBuffer;t.generateMipmaps=this.generateMipmaps;t.shareDepthFrom=this.shareDepthFrom;return t},dispose:function(){this.dispatchEvent({type:"dispose"})}};e.EventDispatcher.prototype.apply(e.WebGLRenderTarget.prototype);e.WebGLRenderTargetCube=function(t,r,n){e.WebGLRenderTarget.call(this,t,r,n);this.activeCubeFace=0};e.WebGLRenderTargetCube.prototype=Object.create(e.WebGLRenderTarget.prototype);e.WebGLRenderTargetCube.prototype.constructor=e.WebGLRenderTargetCube;e.WebGLExtensions=function(t){var r={};this.get=function(n){if(r[n]!==undefined){return r[n]}var i;switch(n){case"EXT_texture_filter_anisotropic":i=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":i=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":i=t.getExtension("WEBGL_compressed_texture_pvrtc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:i=t.getExtension(n)}if(i===null){e.warn("THREE.WebGLRenderer: "+n+" extension not supported.")}r[n]=i;return i}};e.WebGLProgram=function(){var t=0;var r=function(e){var t,r,n=[];for(var i in e){t=e[i];if(t===false)continue;r="#define "+i+" "+t;n.push(r)}return n.join("\n")};var n=function(e,t,r){var n={};for(var i=0,a=r.length;i<a;i++){var o=r[i];n[o]=e.getUniformLocation(t,o)}return n};var i=function(e,t,r){var n={};for(var i=0,a=r.length;i<a;i++){var o=r[i];n[o]=e.getAttribLocation(t,o)}return n};return function(a,o,s,u){var l=a;var c=l.context;var f=s.defines;var h=s.__webglShader.uniforms;var d=s.attributes;var p=s.__webglShader.vertexShader;var m=s.__webglShader.fragmentShader;var v=s.index0AttributeName;if(v===undefined&&u.morphTargets===true){v="position"}var y="SHADOWMAP_TYPE_BASIC";if(u.shadowMapType===e.PCFShadowMap){y="SHADOWMAP_TYPE_PCF"}else if(u.shadowMapType===e.PCFSoftShadowMap){y="SHADOWMAP_TYPE_PCF_SOFT"}var g="ENVMAP_TYPE_CUBE";var b="ENVMAP_MODE_REFLECTION";var x="ENVMAP_BLENDING_MULTIPLY";if(u.envMap){switch(s.envMap.mapping){case e.CubeReflectionMapping:case e.CubeRefractionMapping:g="ENVMAP_TYPE_CUBE";break;case e.EquirectangularReflectionMapping:case e.EquirectangularRefractionMapping:g="ENVMAP_TYPE_EQUIREC";break;case e.SphericalReflectionMapping:g="ENVMAP_TYPE_SPHERE";break}switch(s.envMap.mapping){case e.CubeRefractionMapping:case e.EquirectangularRefractionMapping:b="ENVMAP_MODE_REFRACTION";break}switch(s.combine){case e.MultiplyOperation:x="ENVMAP_BLENDING_MULTIPLY";break;case e.MixOperation:x="ENVMAP_BLENDING_MIX";break;case e.AddOperation:x="ENVMAP_BLENDING_ADD";break}}var _=a.gammaFactor>0?a.gammaFactor:1;var w=r(f);var C=c.createProgram();var E,S;if(s instanceof e.RawShaderMaterial){E="";S=""}else{E=["precision "+u.precision+" float;","precision "+u.precision+" int;",w,u.supportsVertexTextures?"#define VERTEX_TEXTURES":"",l.gammaInput?"#define GAMMA_INPUT":"",l.gammaOutput?"#define GAMMA_OUTPUT":"","#define GAMMA_FACTOR "+_,"#define MAX_DIR_LIGHTS "+u.maxDirLights,"#define MAX_POINT_LIGHTS "+u.maxPointLights,"#define MAX_SPOT_LIGHTS "+u.maxSpotLights,"#define MAX_HEMI_LIGHTS "+u.maxHemiLights,"#define MAX_SHADOWS "+u.maxShadows,"#define MAX_BONES "+u.maxBones,u.map?"#define USE_MAP":"",u.envMap?"#define USE_ENVMAP":"",u.envMap?"#define "+b:"",u.lightMap?"#define USE_LIGHTMAP":"",u.bumpMap?"#define USE_BUMPMAP":"",u.
116normalMap?"#define USE_NORMALMAP":"",u.specularMap?"#define USE_SPECULARMAP":"",u.alphaMap?"#define USE_ALPHAMAP":"",u.vertexColors?"#define USE_COLOR":"",u.flatShading?"#define FLAT_SHADED":"",u.skinning?"#define USE_SKINNING":"",u.useVertexTexture?"#define BONE_TEXTURE":"",u.morphTargets?"#define USE_MORPHTARGETS":"",u.morphNormals?"#define USE_MORPHNORMALS":"",u.wrapAround?"#define WRAP_AROUND":"",u.doubleSided?"#define DOUBLE_SIDED":"",u.flipSided?"#define FLIP_SIDED":"",u.shadowMapEnabled?"#define USE_SHADOWMAP":"",u.shadowMapEnabled?"#define "+y:"",u.shadowMapDebug?"#define SHADOWMAP_DEBUG":"",u.shadowMapCascade?"#define SHADOWMAP_CASCADE":"",u.sizeAttenuation?"#define USE_SIZEATTENUATION":"",u.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"","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;","attribute vec2 uv2;","#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",""].join("\n");S=["precision "+u.precision+" float;","precision "+u.precision+" int;",u.bumpMap||u.normalMap||u.flatShading?"#extension GL_OES_standard_derivatives : enable":"",w,"#define MAX_DIR_LIGHTS "+u.maxDirLights,"#define MAX_POINT_LIGHTS "+u.maxPointLights,"#define MAX_SPOT_LIGHTS "+u.maxSpotLights,"#define MAX_HEMI_LIGHTS "+u.maxHemiLights,"#define MAX_SHADOWS "+u.maxShadows,u.alphaTest?"#define ALPHATEST "+u.alphaTest:"",l.gammaInput?"#define GAMMA_INPUT":"",l.gammaOutput?"#define GAMMA_OUTPUT":"","#define GAMMA_FACTOR "+_,u.useFog&&u.fog?"#define USE_FOG":"",u.useFog&&u.fogExp?"#define FOG_EXP2":"",u.map?"#define USE_MAP":"",u.envMap?"#define USE_ENVMAP":"",u.envMap?"#define "+g:"",u.envMap?"#define "+b:"",u.envMap?"#define "+x:"",u.lightMap?"#define USE_LIGHTMAP":"",u.bumpMap?"#define USE_BUMPMAP":"",u.
116normalMap?"#define USE_NORMALMAP":"",u.specularMap?"#define USE_SPECULARMAP":"",u.alphaMap?"#define USE_ALPHAMAP":"",u.vertexColors?"#define USE_COLOR":"",u.flatShading?"#define FLAT_SHADED":"",u.metal?"#define METAL":"",u.wrapAround?"#define WRAP_AROUND":"",u.doubleSided?"#define DOUBLE_SIDED":"",u.flipSided?"#define FLIP_SIDED":"",u.shadowMapEnabled?"#define USE_SHADOWMAP":"",u.shadowMapEnabled?"#define "+y:"",u.shadowMapDebug?"#define SHADOWMAP_DEBUG":"",u.shadowMapCascade?"#define SHADOWMAP_CASCADE":"",u.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;",""].join("\n")}var T=new e.WebGLShader(c,c.VERTEX_SHADER,E+p);var M=new e.WebGLShader(c,c.FRAGMENT_SHADER,S+m);c.attachShader(C,T);c.attachShader(C,M);if(v!==undefined){c.bindAttribLocation(C,0,v)}c.linkProgram(C);var A=c.getProgramInfoLog(C);if(c.getProgramParameter(C,c.LINK_STATUS)===false){e.error("THREE.WebGLProgram: shader error: "+c.getError(),"gl.VALIDATE_STATUS",c.getProgramParameter(C,c.VALIDATE_STATUS),"gl.getPRogramInfoLog",A)}if(A!==""){}c.deleteShader(T);c.deleteShader(M) 117;var P=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","modelMatrix","cameraPosition","morphTargetInfluences","bindMatrix","bindMatrixInverse"];if(u.useVertexTexture){P.push("boneTexture");P.push("boneTextureWidth");P.push("boneTextureHeight")}else{P.push("boneGlobalMatrices")}if(u.logarithmicDepthBuffer){P.push("logDepthBufFC")}for(var R in h){P.push(R)}this.uniforms=n(c,C,P);P=["position","normal","uv","uv2","tangent","color","skinIndex","skinWeight","lineDistance"];for(var k=0;k<u.maxMorphTargets;k++){P.push("morphTarget"+k)}for(var k=0;k<u.maxMorphNormals;k++){P.push("morphNormal"+k)}for(var I in d){P.push(I)}this.attributes=i(c,C,P);this.attributesKeys=Object.keys(this.attributes);this.id=t++;this.code=o;this.usedTimes=1;this.program=C;this.vertexShader=T;this.fragmentShader=M;return this}}();e.WebGLShader=function(){var t=function(e){var t=e.split("\n");for(var r=0;r<t.length;r++){t[r]=r+1+": "+t[r]}return t.join("\n")};return function(t,r,n){var i=t.createShader(r);t.shaderSource(i,n);t.compileShader(i);if(t.getShaderParameter(i,t.COMPILE_STATUS)===false){e.error("THREE.WebGLShader: Shader couldn't compile.")}return i}}();e.WebGLState=function(t,r){var n=new Uint8Array(16);var i=new Uint8Array(16);var a=null;var o=null;var s=null;var u=null;var l=null;var c=null;var f=null;var h=null;var d=null;var p=null;var m=null;var v=null;var y=null;var g=null;var b=null;var x=null;this.initAttributes=function(){for(var e=0,t=n.length;e<t;e++){n[e]=0}};this.enableAttribute=function(e){n[e]=1;if(i[e]===0){t.enableVertexAttribArray(e);i[e]=1}};this.disableUnusedAttributes=function(){for(var e=0,r=i.length;e<r;e++){if(i[e]!==n[e]){t.disableVertexAttribArray(e);i[e]=0}}};this.setBlending=function(n,i,h,d,p,m,v){if(n!==a){if(n===e.NoBlending){t.disable(t.BLEND)}else if(n===e.AdditiveBlending){t.enable(t.BLEND);t.blendEquation(t.FUNC_ADD);t.blendFunc(t.SRC_ALPHA,t.ONE)}else if(n===e.SubtractiveBlending){t.enable(t.BLEND);t.blendEquation(t.FUNC_ADD);t.blendFunc(t.ZERO,t.ONE_MINUS_SRC_COLOR)}else if(n===e.MultiplyBlending){t.enable(t.BLEND);t.blendEquation(t.FUNC_ADD);t.blendFunc(t.ZERO,t.SRC_COLOR)}else if(n===e.CustomBlending){t.enable(t.BLEND)}else{t.enable(t.BLEND);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)}a=n}if(n===e.CustomBlending){p=p||i;m=m||h;v=v||d;if(i!==o||p!==l){t.blendEquationSeparate(r(i),r(p));o=i;l=p}if(h!==s||d!==u||m!==c||v!==f){t.blendFuncSeparate(r(h),r(d),r(m),r(v));s=h;u=d;c=m;f=v}}else{o=null;s=null;u=null;l=null;c=null;f=null}};this.setDepthTest=function(e){if(h!==e){if(e){t.enable(t.DEPTH_TEST)}else{t.disable(t.DEPTH_TEST)}h=e}};this.setDepthWrite=function(e){if(d!==e){t.depthMask(e);d=e}};this.setColorWrite=function(e){if(p!==e){t.colorMask(e,e,e,e);p=e}};this.setDoubleSided=function(e){if(m!==e){if(e){t.disable(t.CULL_FACE)}else{t.enable(t.CULL_FACE)}m=e}};this.setFlipSided=function(e){if(v!==e){if(e){t.frontFace(t.CW)}else{t.frontFace(t.CCW)}v=e}};this.setLineWidth=function(e){if(e!==y){t.lineWidth(e);y=e}};this.setPolygonOffset=function(e,r,n){if(g!==e){if(e){t.enable(t.POLYGON_OFFSET_FILL)}else{t.disable(t.POLYGON_OFFSET_FILL)}g=e}
117if(e&&(b!==r||x!==n)){t.polygonOffset(r,n);b=r;x=n}};this.reset=function(){for(var e=0;e<i.length;e++){i[e]=0}a=null;h=null;d=null;p=null;m=null;v=null}};e.LensFlarePlugin=function(t,r){var n=t.context;var i,a;var o,s,u;var l;var c,f;var h=function(){var e=new Float32Array([-1,-1,0,0,1,-1,1,0,1,1,1,1,-1,1,0,1]);var t=new Uint16Array([0,1,2,0,2,3]);i=n.createBuffer();a=n.createBuffer();n.bindBuffer(n.ARRAY_BUFFER,i);n.bufferData(n.ARRAY_BUFFER,e,n.STATIC_DRAW);n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,a);n.bufferData(n.ELEMENT_ARRAY_BUFFER,t,n.STATIC_DRAW);c=n.createTexture();f=n.createTexture();n.bindTexture(n.TEXTURE_2D,c);n.texImage2D(n.TEXTURE_2D,0,n.RGB,16,16,0,n.RGB,n.UNSIGNED_BYTE,null);n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_S,n.CLAMP_TO_EDGE);n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_T,n.CLAMP_TO_EDGE);n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MAG_FILTER,n.NEAREST);n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MIN_FILTER,n.NEAREST);n.bindTexture(n.TEXTURE_2D,f);n.texImage2D(n.TEXTURE_2D,0,n.RGBA,16,16,0,n.RGBA,n.UNSIGNED_BYTE,null);n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_S,n.CLAMP_TO_EDGE);n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_T,n.CLAMP_TO_EDGE);n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MAG_FILTER,n.NEAREST);n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MIN_FILTER,n.NEAREST);l=n.getParameter(n.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0;var r;if(l){r={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")}}else{r={vertexShader:["uniform lowp int renderType;","uniform vec3 screenPosition;","uniform vec2 scale;","uniform float rotation;","attribute vec2 position;","attribute vec2 uv;","varying vec2 vUV;","void main() {","vUV = uv;","vec2 pos = position;","if( renderType == 2 ) {","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:["precision mediump float;","uniform lowp int renderType;","uniform sampler2D map;","uniform sampler2D occlusionMap;","uniform float opacity;","uniform vec3 color;","varying vec2 vUV;","void main() {","if( renderType == 0 ) {","gl_FragColor = vec4( texture2D( map, vUV ).rgb, 0.0 );","} else if( renderType == 1 ) {","gl_FragColor = texture2D( map, vUV );","} else {","float visibility = texture2D( occlusionMap, vec2( 0.5, 0.1 ) ).a;","visibility += texture2D( occlusionMap, vec2( 0.9, 0.5 ) ).a;","visibility += texture2D( occlusionMap, vec2( 0.5, 0.9 ) ).a;","visibility += texture2D( occlusionMap, vec2( 0.1, 0.5 ) ).a;","visibility = ( 1.0 - visibility / 4.0 );","vec4 texture = texture2D( map, vUV );","texture.a *= opacity * visibility;","gl_FragColor = texture;","gl_FragColor.rgb *= color;","}","}"].join("\n")}}o=d(r);s={vertex:n.getAttribLocation(o,"position"),uv:n.getAttribLocation(o,"uv")};u={renderType:n.getUniformLocation(o,"renderType"),map:n.getUniformLocation(o,"map"),occlusionMap:n.getUniformLocation(o,"occlusionMap"),opacity:n.getUniformLocation(o,"opacity"),color:n.getUniformLocation(o,"color"),scale:n.getUniformLocation(o,"scale"),rotation:n.getUniformLocation(o,"rotation"),screenPosition:n.getUniformLocation(o,"screenPosition")}};this.render=function(d,p,m,v){if(r.length===0)return;var y=new e.Vector3;var g=v/m,b=m*.5,x=v*.5;var _=16/v,w=new e.Vector2(_*g,_);var C=new e.Vector3(1,1,0),E=new e.Vector2(1,1);
117if(o===undefined){h()}n.useProgram(o);n.enableVertexAttribArray(s.vertex);n.enableVertexAttribArray(s.uv);n.uniform1i(u.occlusionMap,0);n.uniform1i(u.map,1);n.bindBuffer(n.ARRAY_BUFFER,i);n.vertexAttribPointer(s.vertex,2,n.FLOAT,false,2*8,0);n.vertexAttribPointer(s.uv,2,n.FLOAT,false,2*8,8);n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,a);n.disable(n.CULL_FACE);n.depthMask(false);for(var S=0,T=r.length;S<T;S++){_=16/v;w.set(_*g,_);var M=r[S];y.set(M.matrixWorld.elements[12],M.matrixWorld.elements[13],M.matrixWorld.elements[14]);y.applyMatrix4(p.matrixWorldInverse);y.applyProjection(p.projectionMatrix);C.copy(y);E.x=C.x*b+b;E.y=C.y*x+x;if(l||E.x>0&&E.x<m&&E.y>0&&E.y<v){n.activeTexture(n.TEXTURE1);n.bindTexture(n.TEXTURE_2D,c);n.copyTexImage2D(n.TEXTURE_2D,0,n.RGB,E.x-8,E.y-8,16,16,0);n.uniform1i(u.renderType,0);n.uniform2f(u.scale,w.x,w.y);n.uniform3f(u.screenPosition,C.x,C.y,C.z);n.disable(n.BLEND);n.enable(n.DEPTH_TEST);n.drawElements(n.TRIANGLES,6,n.UNSIGNED_SHORT,0);n.activeTexture(n.TEXTURE0);n.bindTexture(n.TEXTURE_2D,f);n.copyTexImage2D(n.TEXTURE_2D,0,n.RGBA,E.x-8,E.y-8,16,16,0);n.uniform1i(u.renderType,1);n.disable(n.DEPTH_TEST);n.activeTexture(n.TEXTURE1);n.bindTexture(n.TEXTURE_2D,c);n.drawElements(n.TRIANGLES,6,n.UNSIGNED_SHORT,0);M.positionScreen.copy(C);if(M.customUpdateCallback){M.customUpdateCallback(M)}else{M.updateLensFlares()}n.uniform1i(u.renderType,2);n.enable(n.BLEND);for(var A=0,P=M.lensFlares.length;A<P;A++){var R=M.lensFlares[A];if(R.opacity>.001&&R.scale>.001){C.x=R.x;C.y=R.y;C.z=R.z;_=R.size*R.scale/v;w.x=_*g;w.y=_;n.uniform3f(u.screenPosition,C.x,C.y,C.z);n.uniform2f(u.scale,w.x,w.y);n.uniform1f(u.rotation,R.rotation);n.uniform1f(u.opacity,R.opacity);n.uniform3f(u.color,R.color.r,R.color.g,R.color.b);t.state.setBlending(R.blending,R.blendEquation,R.blendSrc,R.blendDst);t.setTexture(R.texture,1);n.drawElements(n.TRIANGLES,6,n.UNSIGNED_SHORT,0)}}}}n.enable(n.CULL_FACE);n.enable(n.DEPTH_TEST);n.depthMask(true);t.resetGLState()};function d(e){var r=n.createProgram();var i=n.createShader(n.FRAGMENT_SHADER);var a=n.createShader(n.VERTEX_SHADER);var o="precision "+t.getPrecision()+" float;\n";n.shaderSource(i,o+e.fragmentShader);n.shaderSource(a,o+e.vertexShader);n.compileShader(i);n.compileShader(a);n.attachShader(r,i);n.attachShader(r,a);n.linkProgram(r);return r}};e.ShadowMapPlugin=function(t,r,n,i){var a=t.context;var o,s,u,l,c=new e.Frustum,f=new e.Matrix4,h=new e.Vector3,d=new e.Vector3,p=new e.Vector3,m=[];var v=e.ShaderLib["depthRGBA"];var y=e.UniformsUtils.clone(v.uniforms);o=new e.ShaderMaterial({uniforms:y,vertexShader:v.vertexShader,fragmentShader:v.fragmentShader});s=new e.ShaderMaterial({uniforms:y,vertexShader:v.vertexShader,fragmentShader:v.fragmentShader,morphTargets:true});u=new e.ShaderMaterial({uniforms:y,vertexShader:v.vertexShader,fragmentShader:v.fragmentShader,skinning:true});l=new e.ShaderMaterial({uniforms:y,vertexShader:v.vertexShader,fragmentShader:v.fragmentShader,morphTargets:true,skinning:true});o._shadowPass=true;s._shadowPass=true;u._shadowPass=true;l._shadowPass=true;this.render=function(n,h){if(t.shadowMapEnabled===false)return;var d,v,y,C,E,S,T,M,A,P,R,k,I,D=[],B=0,L=null;a.clearColor(1,1,1,1);a.disable(a.BLEND);a.enable(a.CULL_FACE);a.frontFace(a.CCW);if(t.shadowMapCullFace===e.CullFaceFront){a.cullFace(a.FRONT)}else{a.cullFace(a.BACK)}t.state.setDepthTest(true);for(d=0,v=r.length;d<v;d++){I=r[d];if(!I.castShadow)continue;if(I instanceof e.DirectionalLight&&I.shadowCascade){for(E=0;E<I.shadowCascadeCount;E++){var F;if(!I.shadowCascadeArray[E]){F=b(I,E);F.originalCamera=h;var V=new e.Gyroscope;V.position.copy(I.shadowCascadeOffset);V.add(F);V.add(F.target);h.add(V);I.shadowCascadeArray[E]=F}else{F=I.shadowCascadeArray[E]}x(I,E);D[B]=F;B++}}else{D[B]=I;B++}}for(d=0,v=D.length;d<v;d++){I=D[d];if(!I.shadowMap){var O=e.LinearFilter;if(t.shadowMapType===e.PCFSoftShadowMap){O=e.NearestFilter}var U={minFilter:O,magFilter:O,format:e.RGBAFormat};I.shadowMap=new e.WebGLRenderTarget(I.shadowMapWidth,I.shadowMapHeight,U);I.shadowMapSize=new e.Vector2(I.shadowMapWidth,I.shadowMapHeight);
117I.shadowMatrix=new e.Matrix4}if(!I.shadowCamera){if(I instanceof e.SpotLight){I.shadowCamera=new e.PerspectiveCamera(I.shadowCameraFov,I.shadowMapWidth/I.shadowMapHeight,I.shadowCameraNear,I.shadowCameraFar)}else if(I instanceof e.DirectionalLight){I.shadowCamera=new e.OrthographicCamera(I.shadowCameraLeft,I.shadowCameraRight,I.shadowCameraTop,I.shadowCameraBottom,I.shadowCameraNear,I.shadowCameraFar)}else{e.error("THREE.ShadowMapPlugin: Unsupported light type for shadow",I);continue}n.add(I.shadowCamera);if(n.autoUpdate===true)n.updateMatrixWorld()}if(I.shadowCameraVisible&&!I.cameraHelper){I.cameraHelper=new e.CameraHelper(I.shadowCamera);n.add(I.cameraHelper)}if(I.isVirtual&&F.originalCamera==h){_(h,I)}S=I.shadowMap;T=I.shadowMatrix;M=I.shadowCamera;M.position.setFromMatrixPosition(I.matrixWorld);p.setFromMatrixPosition(I.target.matrixWorld);M.lookAt(p);M.updateMatrixWorld();M.matrixWorldInverse.getInverse(M.matrixWorld);if(I.cameraHelper)I.cameraHelper.visible=I.shadowCameraVisible;if(I.shadowCameraVisible)I.cameraHelper.update();T.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1);T.multiply(M.projectionMatrix);T.multiply(M.matrixWorldInverse);f.multiplyMatrices(M.projectionMatrix,M.matrixWorldInverse);c.setFromMatrix(f);t.setRenderTarget(S);t.clear();m.length=0;g(n,n,M);var N,z,H;for(y=0,C=m.length;y<C;y++){R=m[y];k=R.object;A=R.buffer;N=w(k);z=k.geometry.morphTargets!==undefined&&k.geometry.morphTargets.length>0&&N.morphTargets;H=k instanceof e.SkinnedMesh&&N.skinning;if(k.customDepthMaterial){P=k.customDepthMaterial}else if(H){P=z?l:u}else if(z){P=s}else{P=o}t.setMaterialFaces(N);if(A instanceof e.BufferGeometry){t.renderBufferDirect(M,r,L,P,A,k)}else{t.renderBuffer(M,r,L,P,A,k)}}for(y=0,C=i.length;y<C;y++){R=i[y];k=R.object;if(k.visible&&k.castShadow){k._modelViewMatrix.multiplyMatrices(M.matrixWorldInverse,k.matrixWorld);t.renderImmediateObject(M,r,L,o,k)}}}var j=t.getClearColor(),G=t.getClearAlpha();a.clearColor(j.r,j.g,j.b,G);a.enable(a.BLEND);if(t.shadowMapCullFace===e.CullFaceFront){a.cullFace(a.BACK)}t.resetGLState()};function g(e,t,r){if(t.visible){var i=n[t.id];if(i&&t.castShadow&&(t.frustumCulled===false||c.intersectsObject(t)===true)){for(var a=0,o=i.length;a<o;a++){var s=i[a];t._modelViewMatrix.multiplyMatrices(r.matrixWorldInverse,t.matrixWorld);m.push(s)}}for(var a=0,o=t.children.length;a<o;a++){g(e,t.children[a],r)}}}function b(t,r){var n=new e.DirectionalLight;n.isVirtual=true;n.onlyShadow=true;n.castShadow=true;n.shadowCameraNear=t.shadowCameraNear;n.shadowCameraFar=t.shadowCameraFar;n.shadowCameraLeft=t.shadowCameraLeft;n.shadowCameraRight=t.shadowCameraRight;n.shadowCameraBottom=t.shadowCameraBottom;n.shadowCameraTop=t.shadowCameraTop;n.shadowCameraVisible=t.shadowCameraVisible;n.shadowDarkness=t.shadowDarkness;n.shadowBias=t.shadowCascadeBias[r];n.shadowMapWidth=t.shadowCascadeWidth[r];n.shadowMapHeight=t.shadowCascadeHeight[r];n.pointsWorld=[];n.pointsFrustum=[];var i=n.pointsWorld,a=n.pointsFrustum;for(var o=0;o<8;o++){i[o]=new e.Vector3;a[o]=new e.Vector3}var s=t.shadowCascadeNearZ[r];var u=t.shadowCascadeFarZ[r];a[0].set(-1,-1,s);a[1].set(1,-1,s);a[2].set(-1,1,s);a[3].set(1,1,s);a[4].set(-1,-1,u);a[5].set(1,-1,u);a[6].set(-1,1,u);a[7].set(1,1,u);return n}function x(e,t){var r=e.shadowCascadeArray[t];r.position.copy(e.position);r.target.position.copy(e.target.position);r.lookAt(r.target);r.shadowCameraVisible=e.shadowCameraVisible;r.shadowDarkness=e.shadowDarkness;r.shadowBias=e.shadowCascadeBias[t];var n=e.shadowCascadeNearZ[t];var i=e.shadowCascadeFarZ[t];var a=r.pointsFrustum;a[0].z=n;a[1].z=n;a[2].z=n;a[3].z=n;a[4].z=i;a[5].z=i;a[6].z=i;a[7].z=i}function _(e,t){var r=t.shadowCamera,n=t.pointsFrustum,i=t.pointsWorld;h.set(Infinity,Infinity,Infinity);d.set(-Infinity,-Infinity,-Infinity);for(var a=0;a<8;a++){var o=i[a];o.copy(n[a]);o.unproject(e);o.applyMatrix4(r.matrixWorldInverse);if(o.x<h.x)h.x=o.x;if(o.x>d.x)d.x=o.x;if(o.y<h.y)h.y=o.y;if(o.y>d.y)d.y=o.y;if(o.z<h.z)h.z=o.z;if(o.z>d.z)d.z=o.z}r.left=h.x;r.right=d.x;r.top=d.y;r.bottom=h.y;r.updateProjectionMatrix()}function w(t){return t.material instanceof e.MeshFaceMaterial?t.material.materials[0]:t.material}};e.SpritePlugin=function(t,r){var n=t.context;var i,a;var o,s,u;var l;var c=new e.Vector3;var f=new e.Quaternion;var h=new e.Vector3;var d=function(){var t=new Float32Array([-.5,-.5,0,0,.5,-.5,1,0,.5,.5,1,1,-.5,.5,0,1]);
117var r=new Uint16Array([0,1,2,0,2,3]);i=n.createBuffer();a=n.createBuffer();n.bindBuffer(n.ARRAY_BUFFER,i);n.bufferData(n.ARRAY_BUFFER,t,n.STATIC_DRAW);n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,a);n.bufferData(n.ELEMENT_ARRAY_BUFFER,r,n.STATIC_DRAW);o=p();s={position:n.getAttribLocation(o,"position"),uv:n.getAttribLocation(o,"uv")};u={uvOffset:n.getUniformLocation(o,"uvOffset"),uvScale:n.getUniformLocation(o,"uvScale"),rotation:n.getUniformLocation(o,"rotation"),scale:n.getUniformLocation(o,"scale"),color:n.getUniformLocation(o,"color"),map:n.getUniformLocation(o,"map"),opacity:n.getUniformLocation(o,"opacity"),modelViewMatrix:n.getUniformLocation(o,"modelViewMatrix"),projectionMatrix:n.getUniformLocation(o,"projectionMatrix"),fogType:n.getUniformLocation(o,"fogType"),fogDensity:n.getUniformLocation(o,"fogDensity"),fogNear:n.getUniformLocation(o,"fogNear"),fogFar:n.getUniformLocation(o,"fogFar"),fogColor:n.getUniformLocation(o,"fogColor"),alphaTest:n.getUniformLocation(o,"alphaTest")};var c=document.createElement("canvas");c.width=8;c.height=8;var f=c.getContext("2d");f.fillStyle="white";f.fillRect(0,0,8,8);l=new e.Texture(c);l.needsUpdate=true};this.render=function(p,v){if(r.length===0)return;if(o===undefined){d()}n.useProgram(o);n.enableVertexAttribArray(s.position);n.enableVertexAttribArray(s.uv);n.disable(n.CULL_FACE);n.enable(n.BLEND);n.bindBuffer(n.ARRAY_BUFFER,i);n.vertexAttribPointer(s.position,2,n.FLOAT,false,2*8,0);n.vertexAttribPointer(s.uv,2,n.FLOAT,false,2*8,8);n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,a);n.uniformMatrix4fv(u.projectionMatrix,false,v.projectionMatrix.elements);n.activeTexture(n.TEXTURE0);n.uniform1i(u.map,0);var y=0;var g=0;var b=p.fog;if(b){n.uniform3f(u.fogColor,b.color.r,b.color.g,b.color.b);if(b instanceof e.Fog){n.uniform1f(u.fogNear,b.near);n.uniform1f(u.fogFar,b.far);n.uniform1i(u.fogType,1);y=1;g=1}else if(b instanceof e.FogExp2){n.uniform1f(u.fogDensity,b.density);n.uniform1i(u.fogType,2);y=2;g=2}}else{n.uniform1i(u.fogType,0);y=0;g=0}for(var x=0,_=r.length;x<_;x++){var w=r[x];w._modelViewMatrix.multiplyMatrices(v.matrixWorldInverse,w.matrixWorld);w.z=-w._modelViewMatrix.elements[14]}r.sort(m);var C=[];for(var x=0,_=r.length;x<_;x++){var w=r[x];var E=w.material;n.uniform1f(u.alphaTest,E.alphaTest);n.uniformMatrix4fv(u.modelViewMatrix,false,w._modelViewMatrix.elements);w.matrixWorld.decompose(c,f,h);C[0]=h.x;C[1]=h.y;var S=0;if(p.fog&&E.fog){S=g}if(y!==S){n.uniform1i(u.fogType,S);y=S}if(E.map!==null){n.uniform2f(u.uvOffset,E.map.offset.x,E.map.offset.y);n.uniform2f(u.uvScale,E.map.repeat.x,E.map.repeat.y)}else{n.uniform2f(u.uvOffset,0,0);n.uniform2f(u.uvScale,1,1)}n.uniform1f(u.opacity,E.opacity);n.uniform3f(u.color,E.color.r,E.color.g,E.color.b);n.uniform1f(u.rotation,E.rotation);n.uniform2fv(u.scale,C);t.state.setBlending(E.blending,E.blendEquation,E.blendSrc,E.blendDst);t.state.setDepthTest(E.depthTest);t.state.setDepthWrite(E.depthWrite);if(E.map&&E.map.image&&E.map.image.width){t.setTexture(E.map,0)}else{t.setTexture(l,0)}n.drawElements(n.TRIANGLES,6,n.UNSIGNED_SHORT,0)}n.enable(n.CULL_FACE);t.resetGLState()};function p(){var e=n.createProgram();var r=n.createShader(n.VERTEX_SHADER);var i=n.createShader(n.FRAGMENT_SHADER);n.shaderSource(r,["precision "+t.getPrecision()+" float;","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"));n.shaderSource(i,["precision "+t.getPrecision()+" float;","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;","float 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"));n.compileShader(r);n.compileShader(i);n.attachShader(e,r);n.attachShader(e,i);n.linkProgram(e);return e}function m(e,t){if(e.z!==t.z){return t.z-e.z}else{return t.id-e.id}}};e.GeometryUtils={merge:function(t,r,n){e.warn("THREE.GeometryUtils: .merge() has been moved to Geometry. Use geometry.merge( geometry2, matrix, materialIndexOffset ) instead.");var i;if(r instanceof e.Mesh){r.matrixAutoUpdate&&r.updateMatrix();i=r.matrix;r=r.geometry}t.merge(r,i,n)},center:function(t){e.warn("THREE.GeometryUtils: .center() has been moved to Geometry. Use geometry.center() instead.");return t.center()}};e.ImageUtils={crossOrigin:undefined,loadTexture:function(t,r,n,i){var a=new e.ImageLoader;a.crossOrigin=this.crossOrigin;var o=new e.Texture(undefined,r);a.load(t,function(e){o.image=e;o.needsUpdate=true;if(n)n(o)},undefined,function(e){if(i)i(e)});o.sourceFile=t;return o},loadTextureCube:function(t,r,n,i){var a=[];var o=new e.ImageLoader;o.crossOrigin=this.crossOrigin;var s=new e.CubeTexture(a,r);
117s.flipY=false;var u=0;var l=function(e){o.load(t[e],function(t){s.images[e]=t;u+=1;if(u===6){s.needsUpdate=true;if(n)n(s)}},undefined,i)};for(var c=0,f=t.length;c<f;++c){l(c)}return s},loadCompressedTexture:function(){e.error("THREE.ImageUtils.loadCompressedTexture has been removed. Use THREE.DDSLoader instead.")},loadCompressedTextureCube:function(){e.error("THREE.ImageUtils.loadCompressedTextureCube has been removed. Use THREE.DDSLoader instead.")},getNormalMap:function(e,t){var r=function(e,t){return[e[1]*t[2]-e[2]*t[1],e[2]*t[0]-e[0]*t[2],e[0]*t[1]-e[1]*t[0]]};var n=function(e,t){return[e[0]-t[0],e[1]-t[1],e[2]-t[2]]};var i=function(e){var t=Math.sqrt(e[0]*e[0]+e[1]*e[1]+e[2]*e[2]);return[e[0]/t,e[1]/t,e[2]/t]};t=t|1;var a=e.width;var o=e.height;var s=document.createElement("canvas");s.width=a;s.height=o;var u=s.getContext("2d");u.drawImage(e,0,0);var l=u.getImageData(0,0,a,o).data;var c=u.createImageData(a,o);var f=c.data;for(var h=0;h<a;h++){for(var d=0;d<o;d++){var p=d-1<0?0:d-1;var m=d+1>o-1?o-1:d+1;var v=h-1<0?0:h-1;var y=h+1>a-1?a-1:h+1;var g=[];var b=[0,0,l[(d*a+h)*4]/255*t];g.push([-1,0,l[(d*a+v)*4]/255*t]);g.push([-1,-1,l[(p*a+v)*4]/255*t]);g.push([0,-1,l[(p*a+h)*4]/255*t]);g.push([1,-1,l[(p*a+y)*4]/255*t]);g.push([1,0,l[(d*a+y)*4]/255*t]);g.push([1,1,l[(m*a+y)*4]/255*t]);g.push([0,1,l[(m*a+h)*4]/255*t]);g.push([-1,1,l[(m*a+v)*4]/255*t]);var x=[];var _=g.length;for(var w=0;w<_;w++){var C=g[w];var E=g[(w+1)%_];C=n(C,b);E=n(E,b);x.push(i(r(C,E)))}var S=[0,0,0];for(var w=0;w<x.length;w++){S[0]+=x[w][0];S[1]+=x[w][1];S[2]+=x[w][2]}S[0]/=x.length;S[1]/=x.length;S[2]/=x.length;var T=(d*a+h)*4;f[T]=(S[0]+1)/2*255|0;f[T+1]=(S[1]+1)/2*255|0;f[T+2]=S[2]*255|0;f[T+3]=255}}u.putImageData(c,0,0);return s},generateDataTexture:function(t,r,n){var i=t*r;var a=new Uint8Array(3*i);var o=Math.floor(n.r*255);var s=Math.floor(n.g*255);var u=Math.floor(n.b*255);for(var l=0;l<i;l++){a[l*3]=o;a[l*3+1]=s;a[l*3+2]=u}var c=new e.DataTexture(a,t,r,e.RGBFormat);c.needsUpdate=true;return c}};e.SceneUtils={createMultiMaterialObject:function(t,r){var n=new e.Object3D;for(var i=0,a=r.length;i<a;i++){n.add(new e.Mesh(t,r[i]))}return n},detach:function(e,t,r){e.applyMatrix(t.matrixWorld);t.remove(e);r.add(e)}
117,attach:function(t,r,n){var i=new e.Matrix4;i.getInverse(n.matrixWorld);t.applyMatrix(i);r.remove(t);n.add(t)}};e.FontUtils={faces:{},face:"helvetiker",weight:"normal",style:"normal",size:150,divisions:10,getFace:function(){try{return this.faces[this.face][this.weight][this.style]}catch(e){throw"The font "+this.face+" with "+this.weight+" weight and "+this.style+" style is missing."}},loadFace:function(e){var t=e.familyName.toLowerCase();var r=this;r.faces[t]=r.faces[t]||{};r.faces[t][e.cssFontWeight]=r.faces[t][e.cssFontWeight]||{};r.faces[t][e.cssFontWeight][e.cssFontStyle]=e;r.faces[t][e.cssFontWeight][e.cssFontStyle]=e;return e},drawText:function(t){var r,n=this.getFace(),i=this.size/n.resolution,a=0,o=String(t).split(""),s=o.length;var u=[];for(r=0;r<s;r++){var l=new e.Path;var c=this.extractGlyphPoints(o[r],n,i,a,l);a+=c.offset;u.push(c.path)}var f=a/2;return{paths:u,offset:f}},extractGlyphPoints:function(t,r,n,i,a){var o=[];var s,u,l,c,f,h,d,p,m,v,y,g,b,x,_,w,C,E,S,T=r.glyphs[t]||r.glyphs["?"];if(!T)return;if(T.o){c=T._cachedOutline||(T._cachedOutline=T.o.split(" "));h=c.length;d=n;p=n;for(s=0;s<h;){f=c[s++];switch(f){case"m":m=c[s++]*d+i;v=c[s++]*p;a.moveTo(m,v);break;case"l":m=c[s++]*d+i;v=c[s++]*p;a.lineTo(m,v);break;case"q":y=c[s++]*d+i;g=c[s++]*p;_=c[s++]*d+i;w=c[s++]*p;a.quadraticCurveTo(_,w,y,g);S=o[o.length-1];if(S){b=S.x;x=S.y;for(u=1,l=this.divisions;u<=l;u++){var M=u/l;e.Shape.Utils.b2(M,b,_,y);e.Shape.Utils.b2(M,x,w,g)}}break;case"b":y=c[s++]*d+i;g=c[s++]*p;_=c[s++]*d+i;w=c[s++]*p;C=c[s++]*d+i;E=c[s++]*p;a.bezierCurveTo(_,w,C,E,y,g);S=o[o.length-1];if(S){b=S.x;x=S.y;for(u=1,l=this.divisions;u<=l;u++){var M=u/l;e.Shape.Utils.b3(M,b,_,C,y);e.Shape.Utils.b3(M,x,w,E,g)}}break}}}return{offset:T.ha*n,path:a}}};e.FontUtils.generateShapes=function(t,r){r=r||{};var n=r.size!==undefined?r.size:100;var i=r.curveSegments!==undefined?r.curveSegments:4;var a=r.font!==undefined?r.font:"helvetiker";var o=r.weight!==undefined?r.weight:"normal";var s=r.style!==undefined?r.style:"normal";e.FontUtils.size=n;e.FontUtils.divisions=i;e.FontUtils.face=a;e.FontUtils.weight=o;e.FontUtils.style=s;var u=e.FontUtils.drawText(t);var l=u.paths;var c=[];for(var f=0,h=l.length;f<h;f++){Array.prototype.push.apply(c,l[f].toShapes())}return c};(function(t){var r=1e-10;var n=function(t,r){var n=t.length;if(n<3)return null;var o=[],s=[],u=[];var l,c,f;if(i(t)>0){for(c=0;c<n;c++)s[c]=c}else{for(c=0;c<n;c++)s[c]=n-1-c}var h=n;var d=2*h;for(c=h-1;h>2;){if(d--<=0){e.warn("THREE.FontUtils: Warning, unable to triangulate polygon! in Triangulate.process()");if(r)return u;return o}l=c;if(h<=l)l=0;c=l+1;if(h<=c)c=0;f=c+1;if(h<=f)f=0;if(a(t,l,c,f,h,s)){var p,m,v,y,g;p=s[l];m=s[c];v=s[f];o.push([t[p],t[m],t[v]]);u.push([s[l],s[c],s[f]]);for(y=c,g=c+1;g<h;y++,g++){s[y]=s[g]}h--;d=2*h}}if(r)return u;return o};var i=function(e){var t=e.length;var r=0;for(var n=t-1,i=0;i<t;n=i++){r+=e[n].x*e[i].y-e[i].x*e[n].y}return r*.5};var a=function(e,t,n,i,a,o){var s;var u,l,c,f;var h,d,p,m;u=e[o[t]].x;l=e[o[t]].y;c=e[o[n]].x;f=e[o[n]].y;h=e[o[i]].x;d=e[o[i]].y;if(r>(c-u)*(d-l)-(f-l)*(h-u))return false;var v,y,g,b,x,_;var w,C,E,S,T,M;var A,P,R;v=h-c;y=d-f;g=u-h;b=l-d;x=c-u;_=f-l;for(s=0;s<a;s++){p=e[o[s]].x;m=e[o[s]].y;if(p===u&&m===l||p===c&&m===f||p===h&&m===d)continue;w=p-u;C=m-l;E=p-c;S=m-f;T=p-h;M=m-d;R=v*S-y*E;A=x*C-_*w;P=g*M-b*T;if(R>=-r&&P>=-r&&A>=-r)return false}return true};t.Triangulate=n;t.Triangulate.area=i;return t})(e.FontUtils);self._typeface_js={faces:e.FontUtils.faces,loadFace:e.FontUtils.loadFace};e.typeface_js=self._typeface_js;e.Audio=function(t){e.Object3D.call(this);this.type="Audio";this.context=t.context;this.source=this.context.createBufferSource();this.source.onended=this.onEnded.bind(this);this.gain=this.context.createGain();this.gain.connect(this.context.destination);this.panner=this.context.createPanner();this.panner.connect(this.gain);this.autoplay=false;this.startTime=0;this.isPlaying=false};e.Audio.prototype=Object.create(e.Object3D.prototype);e.Audio.prototype.constructor=e.Audio;e.Audio.prototype.load=function(e){var t=this;var r=new XMLHttpRequest;r.open("GET",e,true);r.responseType="arraybuffer";r.onload=function(e){t.context.decodeAudioData(this.response,function(e){t.source.buffer=e;
117if(t.autoplay)t.play()})};r.send();return this};e.Audio.prototype.play=function(){if(this.isPlaying===true){e.warn("THREE.Audio: Audio is already playing.");return}var t=this.context.createBufferSource();t.buffer=this.source.buffer;t.loop=this.source.loop;t.onended=this.source.onended;t.connect(this.panner);t.start(0,this.startTime);this.isPlaying=true;this.source=t};e.Audio.prototype.pause=function(){this.source.stop();this.startTime=this.context.currentTime};e.Audio.prototype.stop=function(){this.source.stop();this.startTime=0};e.Audio.prototype.onEnded=function(){this.isPlaying=false};e.Audio.prototype.setLoop=function(e){this.source.loop=e};e.Audio.prototype.setRefDistance=function(e){this.panner.refDistance=e};e.Audio.prototype.setRolloffFactor=function(e){this.panner.rolloffFactor=e};e.Audio.prototype.setVolume=function(e){this.gain.gain.value=e};e.Audio.prototype.updateMatrixWorld=function(){var t=new e.Vector3;return function(r){e.Object3D.prototype.updateMatrixWorld.call(this,r);t.setFromMatrixPosition(this.matrixWorld);this.panner.setPosition(t.x,t.y,t.z)}}();e.AudioListener=function(){e.Object3D.call(this);this.type="AudioListener";this.context=new(window.AudioContext||window.webkitAudioContext)};e.AudioListener.prototype=Object.create(e.Object3D.prototype);e.AudioListener.prototype.constructor=e.AudioListener;e.AudioListener.prototype.updateMatrixWorld=function(){var t=new e.Vector3;var r=new e.Quaternion;var n=new e.Vector3;var i=new e.Vector3;var a=new e.Vector3;var o=new e.Vector3;return function(s){e.Object3D.prototype.updateMatrixWorld.call(this,s);var u=this.context.listener;var l=this.up;this.matrixWorld.decompose(t,r,n);i.set(0,0,-1).applyQuaternion(r);a.subVectors(t,o);u.setPosition(t.x,t.y,t.z);u.setOrientation(i.x,i.y,i.z,l.x,l.y,l.z);u.setVelocity(a.x,a.y,a.z);o.copy(t)}}();e.Curve=function(){};e.Curve.prototype.getPoint=function(t){e.warn("THREE.Curve: Warning, getPoint() not implemented!");return null};e.Curve.prototype.getPointAt=function(e){var t=this.getUtoTmapping(e);return this.getPoint(t)};e.Curve.prototype.getPoints=function(e){if(!e)e=5;var t,r=[];for(t=0;t<=e;t++){r.push(this.getPoint(t/e))}return r};e.Curve.prototype.getSpacedPoints=function(e){if(!e)e=5;var t,r=[];for(t=0;t<=e;t++){r.push(this.getPointAt(t/e))}return r};e.Curve.prototype.getLength=function(){var e=this.getLengths();return e[e.length-1]};e.Curve.prototype.getLengths=function(e){if(!e)e=this.__arcLengthDivisions?this.__arcLengthDivisions:200;if(this.cacheArcLengths&&this.cacheArcLengths.length==e+1&&!this.needsUpdate){return this.cacheArcLengths}this.needsUpdate=false;var t=[];var r,n=this.getPoint(0);var i,a=0;t.push(0);for(i=1;i<=e;i++){r=this.getPoint(i/e);a+=r.distanceTo(n);t.push(a) 118;n=r}this.cacheArcLengths=t;return t};e.Curve.prototype.updateArcLengths=function(){this.needsUpdate=true;this.getLengths()};e.Curve.prototype.getUtoTmapping=function(e,t){var r=this.getLengths();var n=0,i=r.length;var a;if(t){a=t}else{a=e*r[i-1]}var o=0,s=i-1,u;while(o<=s){n=Math.floor(o+(s-o)/2);u=r[n]-a;if(u<0){o=n+1}else if(u>0){s=n-1}else{s=n;break}}n=s;if(r[n]==a){var l=n/(i-1);return l}var c=r[n];var f=r[n+1];var h=f-c;var d=(a-c)/h;var l=(n+d)/(i-1);return l};e.Curve.prototype.getTangent=function(e){var t=1e-4;var r=e-t;var n=e+t;if(r<0)r=0;if(n>1)n=1;var i=this.getPoint(r);var a=this.getPoint(n);var o=a.clone().sub(i);return o.normalize()};e.Curve.prototype.getTangentAt=function(e){var t=this.getUtoTmapping(e);return this.getTangent(t)};e.Curve.Utils={tangentQuadraticBezier:function(e,t,r,n){return 2*(1-e)*(r-t)+2*e*(n-r)},tangentCubicBezier:function(e,t,r,n,i){return-3*t*(1-e)*(1-e)+3*r*(1-e)*(1-e)-6*e*r*(1-e)+6*e*n*(1-e)-3*e*e*n+3*e*e*i},tangentSpline:function(e,t,r,n,i){var a=6*e*e-6*e;var o=3*e*e-4*e+1;var s=-6*e*e+6*e;var u=3*e*e-2*e;return a+o+s+u},interpolate:function(e,t,r,n,i){var a=(r-e)*.5;var o=(n-t)*.5;var s=i*i;var u=i*s;return(2*t-2*r+a+o)*u+(-3*t+3*r-2*a-o)*s+a*i+t}};e.Curve.create=function(t,r){t.prototype=Object.create(e.Curve.prototype);t.prototype.constructor=t;t.prototype.getPoint=r;return t};e.CurvePath=function(){this.curves=[];this.bends=[];this.autoClose=false};e.CurvePath.prototype=Object.create(e.Curve.prototype);e.CurvePath.prototype.constructor=e.CurvePath;e.CurvePath.prototype.add=function(e){this.curves.push(e)};e.CurvePath.prototype.checkConnection=function(){};e.CurvePath.prototype.closePath=function(){var t=this.curves[0].getPoint(0);var r=this.curves[this.curves.length-1].getPoint(1);if(!t.equals(r)){this.curves.push(new e.LineCurve(r,t))}};e.CurvePath.prototype.getPoint=function(e){var t=e*this.getLength();var r=this.getCurveLengths();var n=0,i,a;while(n<r.length){if(r[n]>=t){i=r[n]-t;a=this.curves[n];var o=1-i/a.getLength();return a.getPointAt(o)}n++}return null};e.CurvePath.prototype.getLength=function(){var e=this.getCurveLengths();return e[e.length-1]};e.CurvePath.prototype.getCurveLengths=function(){if(this.cacheLengths&&this.cacheLengths.length==this.curves.length){return this.cacheLengths}var e=[],t=0;var r,n=this.curves.length;for(r=0;r<n;r++){t+=this.curves[r].getLength();e.push(t)}this.cacheLengths=e;return e};e.CurvePath.prototype.getBoundingBox=function(){var t=this.getPoints();var r,n,i;var a,o,s;r=n=Number.NEGATIVE_INFINITY;a=o=Number.POSITIVE_INFINITY;var u,l,c,f;var h=t[0]instanceof e.Vector3;f=h?new e.Vector3:new e.Vector2;for(l=0,c=t.length;l<c;l++){u=t[l];if(u.x>r)r=u.x;else if(u.x<a)a=u.x;if(u.y>n)n=u.y;else if(u.y<o)o=u.y;if(h){if(u.z>i)i=u.z;else if(u.z<s)s=u.z}f.add(u)}var d={minX:a,minY:o,maxX:r,maxY:n};if(h){d.maxZ=i;d.minZ=s}return d};e.CurvePath.prototype.createPointsGeometry=function(e){var t=this.getPoints(e,true);return this.createGeometry(t)};e.CurvePath.prototype.createSpacedPointsGeometry=function(e){var t=this.getSpacedPoints(e,true);return this.createGeometry(t)};e.CurvePath.prototype.createGeometry=function(t){var r=new e.Geometry;for(var n=0;n<t.length;n++){r.vertices.push(new e.Vector3(t[n].x,t[n].y,t[n].z||0))}return r};e.CurvePath.prototype.addWrapPath=function(e){this.bends.push(e)};e.CurvePath.prototype.getTransformedPoints=function(e,t){var r=this.getPoints(e);var n,i;if(!t){t=this.bends}for(n=0,i=t.length;n<i;n++){r=this.getWrapPoints(r,t[n])}return r};e.CurvePath.prototype.getTransformedSpacedPoints=function(e,t){var r=this.getSpacedPoints(e);var n,i;if(!t){t=this.bends}for(n=0,i=t.length;n<i;n++){r=this.getWrapPoints(r,t[n])}return r};e.CurvePath.prototype.getWrapPoints=function(e,t){var r=this.getBoundingBox();var n,i,a,o,s,u;for(n=0,i=e.length;n<i;n++){a=e[n];o=a.x;s=a.y;u=o/r.maxX;u=t.getUtoTmapping(u,o);var l=t.getPoint(u);var c=t.getTangent(u);c.set(-c.y,c.x).multiplyScalar(s);a.x=l.x+c.x;a.y=l.y+c.y}return e};e.Gyroscope=function(){e.Object3D.call(this)};e.Gyroscope.prototype=Object.create(e.Object3D.prototype);e.Gyroscope.prototype.constructor=e.Gyroscope;e.Gyroscope.prototype.updateMatrixWorld=function(){var t=new e.Vector3;var r=new e.Quaternion;var n=new e.Vector3;var i=new e.Vector3;var a=new e.Quaternion;var o=new e.Vector3;return function(e){this.matrixAutoUpdate&&this.updateMatrix();if(this.matrixWorldNeedsUpdate||e){if(this.parent){this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix
118);this.matrixWorld.decompose(i,a,o);this.matrix.decompose(t,r,n);this.matrixWorld.compose(i,r,o)}else{this.matrixWorld.copy(this.matrix)}this.matrixWorldNeedsUpdate=false;e=true}for(var s=0,u=this.children.length;s<u;s++){this.children[s].updateMatrixWorld(e)}}}();e.Path=function(t){e.CurvePath.call(this);this.actions=[];if(t){this.fromPoints(t)}};e.Path.prototype=Object.create(e.CurvePath.prototype);e.Path.prototype.constructor=e.Path;e.PathActions={MOVE_TO:"moveTo",LINE_TO:"lineTo",QUADRATIC_CURVE_TO:"quadraticCurveTo",BEZIER_CURVE_TO:"bezierCurveTo",CSPLINE_THRU:"splineThru",ARC:"arc",ELLIPSE:"ellipse"};e.Path.prototype.fromPoints=function(e){this.moveTo(e[0].x,e[0].y);for(var t=1,r=e.length;t<r;t++){this.lineTo(e[t].x,e[t].y)}};e.Path.prototype.moveTo=function(t,r){var n=Array.prototype.slice.call(arguments);this.actions.push({action:e.PathActions.MOVE_TO,args:n})};e.Path.prototype.lineTo=function(t,r){var n=Array.prototype.slice.call(arguments);var i=this.actions[this.actions.length-1].args;var a=i[i.length-2];var o=i[i.length-1];var s=new e.LineCurve(new e.Vector2(a,o),new e.Vector2(t,r));this.curves.push(s);this.actions.push({action:e.PathActions.LINE_TO,args:n})};e.Path.prototype.quadraticCurveTo=function(t,r,n,i){var a=Array.prototype.slice.call(arguments);var o=this.actions[this.actions.length-1].args;var s=o[o.length-2];var u=o[o.length-1];var l=new e.QuadraticBezierCurve(new e.Vector2(s,u),new e.Vector2(t,r),new e.Vector2(n,i));this.curves.push(l);this.actions.push({action:e.PathActions.QUADRATIC_CURVE_TO,args:a})};e.Path.prototype.bezierCurveTo=function(t,r,n,i,a,o){var s=Array.prototype.slice.call(arguments);var u=this.actions[this.actions.length-1].args;var l=u[u.length-2];var c=u[u.length-1];var f=new e.CubicBezierCurve(new e.Vector2(l,c),new e.Vector2(t,r),new e.Vector2(n,i),new e.Vector2(a,o));this.curves.push(f);this.actions.push({action:e.PathActions.BEZIER_CURVE_TO,args:s})};e.Path.prototype.splineThru=function(t){var r=Array.prototype.slice.call(arguments);var n=this.actions[this.actions.length-1].args;var i=n[n.length-2];var a=n[n.length-1];var o=[new e.Vector2(i,a)];Array.prototype.push.apply(o,t);var s=new e.SplineCurve(o);this.curves.push(s);this.actions.push({action:e.PathActions.CSPLINE_THRU,args:r})};e.Path.prototype.arc=function(e,t,r,n,i,a){var o=this.actions[this.actions.length-1].args;var s=o[o.length-2];var u=o[o.length-1];this.absarc(e+s,t+u,r,n,i,a)};e.Path.prototype.absarc=function(e,t,r,n,i,a){this.absellipse(e,t,r,r,n,i,a)};e.Path.prototype.ellipse=function(e,t,r,n,i,a,o){var s=this.actions[this.actions.length-1].args;var u=s[s.length-2];var l=s[s.length-1];this.absellipse(e+u,t+l,r,n,i,a,o)};e.Path.prototype.absellipse=function(t,r,n,i,a,o,s){var u=Array.prototype.slice.call(arguments);var l=new e.EllipseCurve(t,r,n,i,a,o,s);this.curves.push(l);var c=l.getPoint(1);u.push(c.x);u.push(c.y);this.actions.push({action:e.PathActions.ELLIPSE,args:u})};e.Path.prototype.getSpacedPoints=function(e,t){if(!e)e=40;var r=[];for(var n=0;n<e;n++){r.push(this.getPoint(n/e))}return r};e.Path.prototype.getPoints=function(t,r){if(this.useSpacedPoints){console.log("tata");return this.getSpacedPoints(t,r)}t=t||12;var n=[];var i,a,o,s,u;var l,c,f,h,d,p,m,v,y,g,b,x,_;for(i=0,a=this.actions.length;i<a;i++){o=this.actions[i];s=o.action;u=o.args;switch(s){case e.PathActions.MOVE_TO:n.push(new e.Vector2(u[0],u[1]));break;case e.PathActions.LINE_TO:n.push(new e.Vector2(u[0],u[1]));break;case e.PathActions.QUADRATIC_CURVE_TO:l=u[2];c=u[3];d=u[0];p=u[1];if(n.length>0){y=n[n.length-1];m=y.x;v=y.y}else{y=this.actions[i-1].args;m=y[y.length-2];v=y[y.length-1]}for(g=1;g<=t;g++){b=g/t;x=e.Shape.Utils.b2(b,m,d,l);_=e.Shape.Utils.b2(b,v,p,c);n.push(new e.Vector2(x,_))}break;case e.PathActions.BEZIER_CURVE_TO:l=u[4];c=u[5];d=u[0];p=u[1];f=u[2];h=u[3];if(n.length>0){y=n[n.length-1];m=y.x;v=y.y}else{y=this.actions[i-1].args;m=y[y.length-2];v=y[y.length-1]}for(g=1;g<=t;g++){b=g/t;x=e.Shape.Utils.b3(b,m,d,f,l);_=e.Shape.Utils.b3(b,v,p,h,c);n.push(new e.Vector2(x,_))}break;case e.PathActions.CSPLINE_THRU:y=this.actions[i-1].args;var w=new e.Vector2(y[y.length-2],y[y.length-1]);var C=[w];var E=t*u[0].length;C=C.concat(u[0]);var S=new e.SplineCurve(C);for(g=1;g<=E;g++){n.push(S.getPointAt(g/E))}break;case e.PathActions.ARC:var T=u[0],M=u[1],A=u[2],P=u[3],R=u[4],k=!!u[5];var I=R-P;var D;var B=t*2;for(g=1;g<=B;g++){b=g/B;if(!k){b=1-b}D=P+b*I;x=T+A*Math.cos(D);_=M+A*Math.sin(D);n.push(new e.Vector2(x,_))}break;case e.PathActions.ELLIPSE:var T=u[0],M=u[1],L=u[2],F=u[3],P=u[4],R=u[5],k=!!u[6];var I=R-P;var D;var B=t*2;for(g=1;g<=B;g++){b=g/B;if(!k){b=1-b}D=P+b*I;x=T+L*Math.cos(D);_=M+F*Math.sin(D);n.push(new e.Vector2(x,_))}break}}var V=n[n.length-1];var O=1e-10;if(Math.abs(V.x-n[0].x)<O&&Math.abs(V.y-n[0].y)<O)n.splice(n.length-1,1);if(r){n.push(n[0])}return n};e.Path.prototype.toShapes=function(t,r){function n(t){var r,n,i,a,o;var s=[],u=new e.Path;for(r=0,n=t.length;r<n;r++){i=t[r];o=i.args;a=i.action;if(a==e.PathActions.MOVE_TO){if(u.actions.length!=0){s.push(u);u=new e.Path}}u[a].apply(u,o)}if(u.actions.length!=0){s.push(u)}return s}function i(t){var r=[];for(var n=0,i=t.length;n<i;n++){var a=t[n];var o=new e.Shape;o.actions=a.actions;o.curves=a.curves;r.push(o)}return r}function a(e,t){var r=1e-10;var n=t.length;var i=false;for(var a=n-1,o=0;o<n;a=o++){var s=t[a];var u=t[o];var l=u.x-s.x;var c=u.y-s.y;
118if(Math.abs(c)>r){if(c<0){s=t[o];l=-l;u=t[a];c=-c}if(e.y<s.y||e.y>u.y)continue;if(e.y==s.y){if(e.x==s.x)return true}else{var f=c*(e.x-s.x)-l*(e.y-s.y);if(f==0)return true;if(f<0)continue;i=!i}}else{if(e.y!=s.y)continue;if(u.x<=e.x&&e.x<=s.x||s.x<=e.x&&e.x<=u.x)return true}}return i}var o=n(this.actions);if(o.length==0)return[];if(r===true)return i(o);var s,u,l,c=[];if(o.length==1){u=o[0];l=new e.Shape;l.actions=u.actions;l.curves=u.curves;c.push(l);return c}var f=!e.Shape.Utils.isClockWise(o[0].getPoints());f=t?!f:f;var h=[];var d=[];var p=[];var m=0;var v;d[m]=undefined;p[m]=[];var y,g;for(y=0,g=o.length;y<g;y++){u=o[y];v=u.getPoints();s=e.Shape.Utils.isClockWise(v);s=t?!s:s;if(s){if(!f&&d[m])m++;d[m]={s:new e.Shape,p:v};d[m].s.actions=u.actions;d[m].s.curves=u.curves;if(f)m++;p[m]=[]}else{p[m].push({h:u,p:v[0]})}}if(!d[0])return i(o);if(d.length>1){var b=false;var x=[];for(var _=0,w=d.length;_<w;_++){h[_]=[]}for(var _=0,w=d.length;_<w;_++){var C=p[_];for(var E=0;E<C.length;E++){var S=C[E];var T=true;for(var M=0;M<d.length;M++){if(a(S.p,d[M].p)){if(_!=M)x.push({froms:_,tos:M,hole:E});if(T){T=false;h[M].push(S)}else{b=true}}}if(T){h[_].push(S)}}}if(x.length>0){if(!b)p=h}}var A,P,R;for(y=0,g=d.length;y<g;y++){l=d[y].s;c.push(l);A=p[y];for(P=0,R=A.length;P<R;P++){l.holes.push(A[P].h)}}return c};e.Shape=function(){e.Path.apply(this,arguments);this.holes=[]};e.Shape.prototype=Object.create(e.Path.prototype);e.Shape.prototype.constructor=e.Shape;e.Shape.prototype.extrude=function(t){var r=new e.ExtrudeGeometry(this,t);return r};e.Shape.prototype.makeGeometry=function(t){var r=new e.ShapeGeometry(this,t);return r};e.Shape.prototype.getPointsHoles=function(e){var t,r=this.holes.length,n=[];for(t=0;t<r;t++){n[t]=this.holes[t].getTransformedPoints(e,this.bends)}return n};e.Shape.prototype.getSpacedPointsHoles=function(e){var t,r=this.holes.length,n=[];for(t=0;t<r;t++){n[t]=this.holes[t].getTransformedSpacedPoints(e,this.bends)}return n};e.Shape.prototype.extractAllPoints=function(e){return{shape:this.getTransformedPoints(e),holes:this.getPointsHoles(e)}};e.Shape.prototype.extractPoints=function(e){if(this.useSpacedPoints){return this.extractAllSpacedPoints(e)}return this.extractAllPoints(e)};e.Shape.prototype.extractAllSpacedPoints=function(e){return{shape:this.getTransformedSpacedPoints(e),holes:this.getSpacedPointsHoles(e)}};e.Shape.Utils={triangulateShape:function(t,r){function n(e,t,r){if(e.x!=t.x){if(e.x<t.x){return e.x<=r.x&&r.x<=t.x}else{return t.x<=r.x&&r.x<=e.x}}else{if(e.y<t.y){return e.y<=r.y&&r.y<=t.y}else{return t.y<=r.y&&r.y<=e.y}}}function i(e,t,r,i,a){var o=1e-10;var s=t.x-e.x,u=t.y-e.y;var l=i.x-r.x,c=i.y-r.y;var f=e.x-r.x;var h=e.y-r.y;var d=u*l-s*c;var p=u*f-s*h;if(Math.abs(d)>o){var m;if(d>0){if(p<0||p>d)return[];m=c*f-l*h;if(m<0||m>d)return[]}else{if(p>0||p<d)return[];m=c*f-l*h;if(m>0||m<d)return[]}if(m==0){if(a&&(p==0||p==d))return[];return[e]}if(m==d){if(a&&(p==0||p==d))return[];return[t]}if(p==0)return[r];if(p==d)return[i];var v=m/d;return[{x:e.x+v*s,y:e.y+v*u}]}else{if(p!=0||c*f!=l*h)return[];var y=s==0&&u==0;var g=l==0&&c==0;if(y&&g){if(e.x!=r.x||e.y!=r.y)return[];return[e]}if(y){if(!n(r,i,e))return[];return[e]}if(g){if(!n(e,t,r))return[];return[r]}var b,x,_,w;var C,E,S,T;if(s!=0){if(e.x<t.x){b=e;_=e.x;x=t;w=t.x}else{b=t;_=t.x;x=e;w=e.x}if(r.x<i.x){C=r;S=r.x;E=i;T=i.x}else{C=i;S=i.x;E=r;T=r.x}}else{if(e.y<t.y){b=e;_=e.y;x=t;w=t.y}else{b=t;_=t.y;x=e;w=e.y}if(r.y<i.y){C=r;S=r.y;E=i;T=i.y}else{C=i;S=i.y;E=r;T=r.y}}if(_<=S){if(w<S)return[];if(w==S){if(a)return[];return[C]}if(w<=T)return[C,x];return[C,E]}else{if(_>T)return[];if(_==T){if(a)return[];return[b]}if(w<=T)return[b,x];return[b,E]}}}function a(e,t,r,n){var i=1e-10;var a=t.x-e.x,o=t.y-e.y;var s=r.x-e.x,u=r.y-e.y;var l=n.x-e.x,c=n.y-e.y;var f=a*u-o*s;var h=a*c-o*l;if(Math.abs(f)>i){var d=l*u-c*s;if(f>0){return h>=0&&d>=0}else{return h>=0||d>=0}}else{return h>0}}function o(e,t){var r=e.concat();var n;function o(e,t){var i=r.length-1;var o=e-1;if(o<0)o=i;var s=e+1;if(s>i)s=0;var u=a(r[e],r[o],r[s],n[t]);if(!u){return false}var l=n.length-1;var c=t-1;if(c<0)c=l;var f=t+1;if(f>l)f=0;u=a(n[t],n[c],n[f],r[e]);if(!u){return false}return true}function s(e,t){var n,a,o;for(n=0;n<r.length;n++){a=n+1;a%=r.length;o=i(e,t,r[n],r[a],true);if(o.length>0)return true}return false}var u=[];function l(e,r){var n,a,o,s,l;for(n=0;n<u.length;n++){a=t[u[n]];for(o=0;o<a.length;o++){s=o+1;s%=a.length;l=i(e,r,a[o],a[s],true);if(l.length>0)return true}}return false}var c,f,h,d,p,m,v=[],y,g,b,x;for(var _=0,w=t.length;_<w;_++){u.push(_)}var C=0;var E=u.length*2;while(u.length>0){E--;if(E<0){console.log("Infinite Loop! Holes left:"+u.length+", Probably Hole outside Shape!");break}for(f=C;f<r.length;f++){h=r[f];c=-1;for(var _=0;_<u.length;_++){p=u[_];m=h.x+":"+h.y+":"+p;if(v[m]!==undefined)continue;n=t[p];for(var S=0;S<n.length;S++){d=n[S];if(!o(f,S))continue;if(s(h,d))continue;if(l(h,d))continue;c=S;u.splice(_,1);y=r.slice(0,f+1);g=r.slice(f);b=n.slice(c);x=n.slice(0,c+1);r=y.concat(b).concat(x).concat(g);C=f;break}if(c>=0)break;v[m]=true}if(c>=0)break}}return r}var s,u,l,c,f,h,d={};var p=t.concat();for(var m=0,v=r.length;m<v;
118m++){Array.prototype.push.apply(p,r[m])}for(s=0,u=p.length;s<u;s++){f=p[s].x+":"+p[s].y;if(d[f]!==undefined){e.warn("THREE.Shape: Duplicate point",f)}d[f]=s}var y=o(t,r);var g=e.FontUtils.Triangulate(y,false);for(s=0,u=g.length;s<u;s++){c=g[s];for(l=0;l<3;l++){f=c[l].x+":"+c[l].y;h=d[f];if(h!==undefined){c[l]=h}}}return g.concat()},isClockWise:function(t){return e.FontUtils.Triangulate.area(t)<0},b2p0:function(e,t){var r=1-e;return r*r*t},b2p1:function(e,t){return 2*(1-e)*e*t},b2p2:function(e,t){return e*e*t},b2:function(e,t,r,n){return this.b2p0(e,t)+this.b2p1(e,r)+this.b2p2(e,n)},b3p0:function(e,t){var r=1-e;return r*r*r*t},b3p1:function(e,t){var r=1-e;return 3*r*r*e*t},b3p2:function(e,t){var r=1-e;return 3*r*e*e*t},b3p3:function(e,t){return e*e*e*t},b3:function(e,t,r,n,i){return this.b3p0(e,t)+this.b3p1(e,r)+this.b3p2(e,n)+this.b3p3(e,i)}};e.LineCurve=function(e,t){this.v1=e;this.v2=t};e.LineCurve.prototype=Object.create(e.Curve.prototype);e.LineCurve.prototype.constructor=e.LineCurve;e.LineCurve.prototype.getPoint=function(e){var t=this.v2.clone().sub(this.v1);t.multiplyScalar(e).add(this.v1);return t};e.LineCurve.prototype.getPointAt=function(e){return this.getPoint(e)};e.LineCurve.prototype.getTangent=function(e){var t=this.v2.clone().sub(this.v1);return t.normalize()};e.QuadraticBezierCurve=function(e,t,r){this.v0=e;this.v1=t;this.v2=r};e.QuadraticBezierCurve.prototype=Object.create(e.Curve.prototype);e.QuadraticBezierCurve.prototype.constructor=e.QuadraticBezierCurve;e.QuadraticBezierCurve.prototype.getPoint=function(t){var r=new e.Vector2;r.x=e.Shape.Utils.b2(t,this.v0.x,this.v1.x,this.v2.x);r.y=e.Shape.Utils.b2(t,this.v0.y,this.v1.y,this.v2.y);return r};e.QuadraticBezierCurve.prototype.getTangent=function(t){var r=new e.Vector2;r.x=e.Curve.Utils.tangentQuadraticBezier(t,this.v0.x,this.v1.x,this.v2.x);r.y=e.Curve.Utils.tangentQuadraticBezier(t,this.v0.y,this.v1.y,this.v2.y);return r.normalize()};e.CubicBezierCurve=function(e,t,r,n){this.v0=e;this.v1=t;this.v2=r;this.v3=n};e.CubicBezierCurve.prototype=Object.create(e.Curve.prototype);e.CubicBezierCurve.prototype.constructor=e.CubicBezierCurve;e.CubicBezierCurve.prototype.getPoint=function(t){var r,n;r=e.Shape.Utils.b3(t,this.v0.x,this.v1.x,this.v2.x,this.v3.x);n=e.Shape.Utils.b3(t,this.v0.y,this.v1.y,this.v2.y,this.v3.y);return new e.Vector2(r,n)};e.CubicBezierCurve.prototype.getTangent=function(t){var r,n;r=e.Curve.Utils.tangentCubicBezier(t,this.v0.x,this.v1.x,this.v2.x,this.v3.x);n=e.Curve.Utils.tangentCubicBezier(t,this.v0.y,this.v1.y,this.v2.y,this.v3.y);var i=new e.Vector2(r,n);i.normalize();return i};e.SplineCurve=function(e){this.points=e==undefined?[]:e};e.SplineCurve.prototype=Object.create(e.Curve.prototype);e.SplineCurve.prototype.constructor=e.SplineCurve;e.SplineCurve.prototype.getPoint=function(t){var r=this.points;var n=(r.length-1)*t;var i=Math.floor(n);var a=n-i;var o=r[i==0?i:i-1];var s=r[i];var u=r[i>r.length-2?r.length-1:i+1];var l=r[i>r.length-3?r.length-1:i+2];var c=new e.Vector2;c.x=e.Curve.Utils.interpolate(o.x,s.x,u.x,l.x,a);c.y=e.Curve.Utils.interpolate(o.y,s.y,u.y,l.y,a);return c};e.EllipseCurve=function(e,t,r,n,i,a,o){this.aX=e;this.aY=t;this.xRadius=r;this.yRadius=n;this.aStartAngle=i;this.aEndAngle=a;this.aClockwise=o};e.EllipseCurve.prototype=Object.create(e.Curve.prototype);e.EllipseCurve.prototype.constructor=e.EllipseCurve;e.EllipseCurve.prototype.getPoint=function(t){var r=this.aEndAngle-this.aStartAngle;if(r<0)r+=Math.PI*2;if(r>Math.PI*2)r-=Math.PI*2;var n;if(this.aClockwise===true){n=this.aEndAngle+(1-t)*(Math.PI*2-r)}else{n=this.aStartAngle+t*r}var i=new e.Vector2;i.x=this.aX+this.xRadius*Math.cos(n);i.y=this.aY+this.yRadius*Math.sin(n);return i};e.ArcCurve=function(t,r,n,i,a,o){e.EllipseCurve.call(this,t,r,n,n,i,a,o)};e.ArcCurve.prototype=Object.create(e.EllipseCurve.prototype);e.ArcCurve.prototype.constructor=e.ArcCurve;e.LineCurve3=e.Curve.create(function(e,t){this.v1=e;this.v2=t},function(t){var r=new e.Vector3;r.subVectors(this.v2,this.v1);r.multiplyScalar(t);r.add(this.v1);return r});e.QuadraticBezierCurve3=e.Curve.create(function(e,t,r){this.v0=e;this.v1=t;this.v2=r},function(t){var r=new e.Vector3;r.x=e.Shape.Utils.b2(t,this.v0.x,this.v1.x,this.v2.x);r.y=e.Shape.Utils.b2(t,this.v0.y,this.v1.y,this.v2.y);r.z=e.Shape.Utils.b2(t,this.v0.z,this.v1.z,this.v2.z);return r});e.CubicBezierCurve3=e.Curve.create(function(e,t,r,n){this.v0=e;this.v1=t;this.v2=r;this.v3=n},function(t){var r=new e.Vector3;r.x=e.Shape.Utils.b3(t,this.v0.x,this.v1.x,this.v2.x,this.v3.x);r.y=e.Shape.Utils.b3(t,this.v0.y,this.v1.y,this.v2.y,this.v3.y);r.z=e.Shape.Utils.b3(t,this.v0.z,this.v1.z,this.v2.z,this.v3.z);return r});e.SplineCurve3=e.Curve.create(function(e){this.points=e==undefined?[]:e},function(t){var r=this.points;var n=(r.length-1)*t;var i=Math.floor(n);var a=n-i;var o=r[i==0?i:i-1];var s=r[i];var u=r[i>r.length-2?r.length-1:i+1];var l=r[i>r.length-3?r.length-1:i+2];var c=new e.Vector3;c.x=e.Curve.Utils.interpolate(o.x,s.x,u.x,l.x,a);c.y=e.Curve.Utils.interpolate(o.y,s.y,u.y,l.y,a);c.z=e.Curve.Utils.interpolate(o.z,s.z,u.z,l.z,a);return c});e.ClosedSplineCurve3=e.Curve.create(function(e){this.points=e==undefined?[]:e},function(t){var r=this.points;var n=(r.length-0)*t;var i=Math.floor(n);var a=n-i;i+=i>0?0:(Math.floor(Math.abs(i)/r.length)+1)*r.length;var o=r[(i-1)%r.length];var s=r[i%r.length];var u=r[(i+1)%r.length];var l=r[(i+2)%r.length];var c=new e.Vector3;c.x=e.Curve.Utils.interpolate(o.x,s.x,u.x,l.x,a);c.y=e.Curve.Utils.interpolate(o.y,s.y,u.y,l.y,a);c.z=e.Curve.Utils.interpolate(o.z,s.z,u.z,l.z,a);return c});e.AnimationHandler={LINEAR:0,CATMULLROM:1,CATMULLROM_FORWARD:2,add:function(){e.warn("THREE.AnimationHandler.add() has been deprecated.")},get:function(){e.warn("THREE.AnimationHandler.get() has been deprecated.")},remove:function(){e.warn("THREE.AnimationHandler.remove() has been deprecated.")},animations:[],init:function(t){if(t.initialized===true)return t;for(var r=0;r<t.hierarchy.length;r++){for(var n=0;n<t.hierarchy[r].keys.length;n++){if(t.hierarchy[r].keys[n].time<0){t.hierarchy[r].keys[n].time=0}if(t.hierarchy[r].keys[n].rot!==undefined&&!(t.hierarchy[r].keys[n].rot instanceof e.Quaternion)){var i=t.hierarchy[r].keys[n].rot;t.hierarchy[r].keys[n].rot=(new e.Quaternion).fromArray(i)}}if(t.hierarchy[r].keys.length&&t.hierarchy[r].keys[0].morphTargets!==undefined){var a={};for(var n=0;n<t.hierarchy[r].keys.length;n++){for(var o=0;o<t.hierarchy[r].keys[n].morphTargets.length;o++){var s=t.hierarchy[r].keys[n].morphTargets[o];a[s]=-1}}t.hierarchy[r].usedMorphTargets=a;for(var n=0;n<t.hierarchy[r].keys.length;n++){var u={};for(var s in a){for(var o=0;o<t.hierarchy[r].keys[n].morphTargets.length;o++){if(t.hierarchy[r].keys[n].morphTargets[o]===s){u[s]=t.hierarchy[r].keys[n].morphTargetsInfluences[o];break}}if(o===t.hierarchy[r].keys[n].morphTargets.length){u[s]=0}}t.hierarchy[r].keys[n].morphTargetsInfluences=u}}for(var n=1;n<t.hierarchy[r].keys.length;n++){if(t.hierarchy[r].keys[n].time===t.hierarchy[r].keys[n-1].time){t.hierarchy[r].keys.splice(n,1);n--}}for(var n=0;n<t.hierarchy[r].keys.length;n++){t.hierarchy[r].keys[n].index=n}}t.initialized=true;return t},parse:function(t){var r=function(e,t){t.push(e);for(var n=0;n<e.children.length;n++)r(e.children[n],t)};var n=[];if(t instanceof e.SkinnedMesh){for(var i=0;i<t.skeleton.bones.length;i++){n.push(t.skeleton.bones[i])}}else{r(t,n)}return n},play:function(e){if(this.animations.indexOf(e)===-1){this.animations.push(e)}},stop:function(e){var t=this.animations.indexOf(e);if(t!==-1){this.animations.splice(t,1)}},update:function(e){for(var t=0;t<this.animations.length;t++){this.animations[t].resetBlendWeights()}for(var t=0;t<this.animations.length;t++){this.animations[t].update(e)}}};e.Animation=function(t,r){this.root=t;this.data=e.AnimationHandler.init(r);this.hierarchy=e.AnimationHandler.parse(t);this.currentTime=0;this.timeScale=1;this.isPlaying=false;this.loop=true;this.weight=0;this.interpolationType=e.AnimationHandler.LINEAR};e.Animation.prototype={constructor:e.Animation,keyTypes:["pos","rot","scl"],play:function(t,r){this.currentTime=t!==undefined?t:0;this.weight=r!==undefined?r:1;this.isPlaying=true;this.reset();e.AnimationHandler.play(this)},stop:function(){this.isPlaying=false;e.AnimationHandler.stop(this)},reset:function(){for(var e=0,t=this.hierarchy.length;e<t;e++){var r=this.hierarchy[e];if(r.animationCache===undefined){r.animationCache={animations:{},blending:{positionWeight:0,quaternionWeight:0,scaleWeight:0}}}var n=this.data.name;var i=r.animationCache.animations;var a=i[n];
118if(a===undefined){a={prevKey:{pos:0,rot:0,scl:0},nextKey:{pos:0,rot:0,scl:0},originalMatrix:r.matrix};i[n]=a}for(var o=0;o<3;o++){var s=this.keyTypes[o];var u=this.data.hierarchy[e].keys[0];var l=this.getNextKeyWith(s,e,1);while(l.time<this.currentTime&&l.index>u.index){u=l;l=this.getNextKeyWith(s,e,l.index+1)}a.prevKey[s]=u;a.nextKey[s]=l}}},resetBlendWeights:function(){for(var e=0,t=this.hierarchy.length;e<t;e++){var r=this.hierarchy[e];var n=r.animationCache;if(n!==undefined){var i=n.blending;i.positionWeight=0;i.quaternionWeight=0;i.scaleWeight=0}}},update:function(){var t=[];var r=new e.Vector3;var n=new e.Vector3;var i=new e.Quaternion;var a=function(e,t){var r=[],n=[],i,a,s,u,l,c,f,h,d;i=(e.length-1)*t;a=Math.floor(i);s=i-a;r[0]=a===0?a:a-1;r[1]=a;r[2]=a>e.length-2?a:a+1;r[3]=a>e.length-3?a:a+2;c=e[r[0]];f=e[r[1]];h=e[r[2]];d=e[r[3]];u=s*s;l=s*u;n[0]=o(c[0],f[0],h[0],d[0],s,u,l);n[1]=o(c[1],f[1],h[1],d[1],s,u,l);n[2]=o(c[2],f[2],h[2],d[2],s,u,l);return n};var o=function(e,t,r,n,i,a,o){var s=(r-e)*.5,u=(n-t)*.5;return(2*(t-r)+s+u)*o+(-3*(t-r)-2*s-u)*a+s*i+t};return function(o){if(this.isPlaying===false)return;this.currentTime+=o*this.timeScale;if(this.weight===0)return;var s=this.data.length;if(this.currentTime>s||this.currentTime<0){if(this.loop){this.currentTime%=s;if(this.currentTime<0)this.currentTime+=s;this.reset()}else{this.stop()}}for(var u=0,l=this.hierarchy.length;u<l;u++){var c=this.hierarchy[u];var f=c.animationCache.animations[this.data.name];var h=c.animationCache.blending;for(var d=0;d<3;d++){var p=this.keyTypes[d];var m=f.prevKey[p];var v=f.nextKey[p];if(this.timeScale>0&&v.time<=this.currentTime||this.timeScale<0&&m.time>=this.currentTime){m=this.data.hierarchy[u].keys[0];v=this.getNextKeyWith(p,u,1);while(v.time<this.currentTime&&v.index>m.index){m=v;v=this.getNextKeyWith(p,u,v.index+1)}f.prevKey[p]=m;f.nextKey[p]=v}var y=(this.currentTime-m.time)/(v.time-m.time);var g=m[p];var b=v[p];if(y<0)y=0;if(y>1)y=1;if(p==="pos"){if(this.interpolationType===e.AnimationHandler.LINEAR){n.x=g[0]+(b[0]-g[0])*y;n.y=g[1]+(b[1]-g[1])*y;n.z=g[2]+(b[2]-g[2])*y;var x=this.weight/(this.weight+h.positionWeight);c.position.lerp(n,x);h.positionWeight+=this.weight}else if(this.interpolationType===e.AnimationHandler.CATMULLROM||this.interpolationType===e.AnimationHandler.CATMULLROM_FORWARD){t[0]=this.getPrevKeyWith("pos",u,m.index-1)["pos"];t[1]=g;t[2]=b;t[3]=this.getNextKeyWith("pos",u,v.index+1)["pos"];y=y*.33+.33;var _=a(t,y);var x=this.weight/(this.weight+h.positionWeight);h.positionWeight+=this.weight;var w=c.position;w.x=w.x+(_[0]-w.x)*x;w.y=w.y+(_[1]-w.y)*x;w.z=w.z+(_[2]-w.z)*x;if(this.interpolationType===e.AnimationHandler.CATMULLROM_FORWARD){var C=a(t,y*1.01);r.set(C[0],C[1],C[2]);r.sub(w);r.y=0;r.normalize();var E=Math.atan2(r.x,r.z);c.rotation.set(0,E,0)}}}else if(p==="rot"){e.Quaternion.slerp(g,b,i,y);if(h.quaternionWeight===0){c.quaternion.copy(i);h.quaternionWeight=this.weight}else{var x=this.weight/(this.weight+h.quaternionWeight);e.Quaternion.slerp(c.quaternion,i,c.quaternion,x);h.quaternionWeight+=this.weight}}else if(p==="scl"){n.x=g[0]+(b[0]-g[0])*y;n.y=g[1]+(b[1]-g[1])*y;n.z=g[2]+(b[2]-g[2])*y;var x=this.weight/(this.weight+h.scaleWeight);c.scale.lerp(n,x);h.scaleWeight+=this.weight}}}return true}}(),getNextKeyWith:function(t,r,n){var i=this.data.hierarchy[r].keys;if(this.interpolationType===e.AnimationHandler.CATMULLROM||this.interpolationType===e.AnimationHandler.CATMULLROM_FORWARD){n=n<i.length-1?n:i.length-1}else{n=n%i.length}for(;n<i.length;n++){if(i[n][t]!==undefined){return i[n]}}return this.data.hierarchy[r].keys[0]},getPrevKeyWith:function(t,r,n){var i=this.data.hierarchy[r].keys;if(this.interpolationType===e.AnimationHandler.CATMULLROM||this.interpolationType===e.AnimationHandler.CATMULLROM_FORWARD){n=n>0?n:0}else{n=n>=0?n:n+i.length}for(;n>=0;n--){if(i[n][t]!==undefined){return i[n]}}return this.data.hierarchy[r].keys[i.length-1]}};e.KeyFrameAnimation=function(t){this.root=t.node;this.data=e.AnimationHandler.init(t);this.hierarchy=e.AnimationHandler.parse(this.root);this.currentTime=0;this.timeScale=.001;this.isPlaying=false;this.isPaused=true;this.loop=true;for(var r=0,n=this.hierarchy.length;r<n;r++){var i=this.data.hierarchy[r].keys,a=this.data.hierarchy[r].sids,o=this.hierarchy[r];if(i.length&&a){for(var s=0;s<a.length;s++){var u=a[s],l=this.getNextKeyWith(u,r,0);if(l){l.apply(u)}}o.matrixAutoUpdate=false;this.data.hierarchy[r].node.updateMatrix();o.matrixWorldNeedsUpdate=true}}};e.KeyFrameAnimation.prototype={constructor:e.KeyFrameAnimation,play:function(t){this.currentTime=t!==undefined?t:0;if(this.isPlaying===false){this.isPlaying=true;var r,n=this.hierarchy.length,i,a;for(r=0;r<n;r++){i=this.hierarchy[r];a=this.data.hierarchy[r];if(a.animationCache===undefined){a.animationCache={};a.animationCache.prevKey=null;a.animationCache.nextKey=null;a.animationCache.originalMatrix=i.matrix}var o=this.data.hierarchy[r].keys;if(o.length){a.animationCache.prevKey=o[0];a.animationCache.nextKey=o[1];this.startTime=Math.min(o[0].time,this.startTime);this.endTime=Math.max(o[o.length-1].time,this.endTime)}}this.update(0)}this.isPaused=false;e.AnimationHandler.play(this)},stop:function(){this.isPlaying=false;this.isPaused=false;e.AnimationHandler.stop(this);for(var t=0;t<this.data.hierarchy.length;t++){var r=this.hierarchy[t];var n=this.data.hierarchy[t];if(n.animationCache!==undefined){var i=n.animationCache.originalMatrix;i.copy(r.matrix);r.matrix=i;delete n.animationCache}}},update:function(e){if(this.isPlaying===false)return;this.currentTime+=e*this.timeScale;var t=this.data.length;if(this.loop===true&&this.currentTime>t){this.currentTime%=t}this.currentTime=Math.min(this.currentTime,t);for(var r=0,n=this.hierarchy.length;r<n;r++){var i=this.hierarchy[r];var a=this.data.hierarchy[r];var o=a.keys,s=a.animationCache;if(o.length){var u=s.prevKey;var l=s.nextKey;if(l.time<=this.currentTime){while(l.time<this.currentTime&&l.index>u.index){u=l;l=o[u.index+1]}s.prevKey=u;s.nextKey=l}if(l.time>=this.currentTime){u.interpolate(l,this.currentTime)}else{u.interpolate(l,l.time)}this.data.hierarchy[r].node.updateMatrix();i.matrixWorldNeedsUpdate=true}}},getNextKeyWith:function(e,t,r){var n=this.data.hierarchy[t].keys;r=r%n.length;for(;r<n.length;r++){if(n[r].hasTarget(e)){return n[r]}}return n[0]},getPrevKeyWith:function(e,t,r){var n=this.data.hierarchy[t].keys;r=r>=0?r:r+n.length;for(;r>=0;r--){if(n[r].hasTarget(e)){return n[r]}}return n[n.length-1]}};e.MorphAnimation=function(e){this.mesh=e;this.frames=e.morphTargetInfluences.length;this.currentTime=0;this.duration=1e3;this.loop=true;this.lastFrame=0;this.currentFrame=0;this.isPlaying=false};e.MorphAnimation.prototype={constructor:e.MorphAnimation,play:function(){this.isPlaying=true},pause:function(){this.isPlaying=false},update:function(e){if(this.isPlaying===false)return;this.currentTime+=e;if(this.loop===true&&this.currentTime>this.duration){this.currentTime%=this.duration}this.currentTime=Math.min(this.currentTime,this.duration);var t=this.duration/this.frames;var r=Math.floor(this.currentTime/t);var n=this.mesh.morphTargetInfluences;if(r!=this.currentFrame){n[this.lastFrame]=0;n[this.currentFrame]=1;n[r]=0;this.lastFrame=this.currentFrame;this.currentFrame=r}n[r]=this.currentTime%t/t;n[this.lastFrame]=1-n[r]}};e.BoxGeometry=function(t,r,n,i,a,o){e.Geometry.call(this);this.type="BoxGeometry";this.parameters={width:t,height:r,depth:n,widthSegments:i,heightSegments:a,depthSegments:o};this.widthSegments=i||1;this.heightSegments=a||1;this.depthSegments=o||1;var s=this;var u=t/2;var l=r/2;var c=n/2;f("z","y",-1,-1,n,r,u,0);f("z","y",1,-1,n,r,-u,1);f("x","z",1,1,t,n,l,2);f("x","z",1,-1,t,n,-l,3);f("x","y",1,-1,t,r,c,4);f("x","y",-1,-1,t,r,-c,5);function f(t,r,n,i,a,o,u,l){var c,f,h,d=s.widthSegments,p=s.heightSegments,m=a/2,v=o/2,y=s.vertices.length;if(t==="x"&&r==="y"||t==="y"&&r==="x"){c="z"}else if(t==="x"&&r==="z"||t==="z"&&r==="x"){c="y";p=s.depthSegments}else if(t==="z"&&r==="y"||t==="y"&&r==="z"){c="x";d=s.depthSegments}var g=d+1,b=p+1,x=a/d,_=o/p,w=new e.Vector3;w[c]=u>0?1:-1;for(h=0;h<b;h++){for(f=0;f<g;f++){var C=new e.Vector3;C[t]=(f*x-m)*n;C[r]=(h*_-v)*i;C[c]=u;s.vertices.push(C)}}for(h=0;h<p;h++){for(f=0;f<d;f++){var E=f+g*h;var S=f+g*(h+1);var T=f+1+g*(h+1);var M=f+1+g*h;var A=new e.Vector2(f/d,1-h/p) 119;var P=new e.Vector2(f/d,1-(h+1)/p);var R=new e.Vector2((f+1)/d,1-(h+1)/p);var k=new e.Vector2((f+1)/d,1-h/p);var I=new e.Face3(E+y,S+y,M+y);I.normal.copy(w);I.vertexNormals.push(w.clone(),w.clone(),w.clone());I.materialIndex=l;s.faces.push(I);s.faceVertexUvs[0].push([A,P,k]);I=new e.Face3(S+y,T+y,M+y);I.normal.copy(w);I.vertexNormals.push(w.clone(),w.clone(),w.clone());I.materialIndex=l;s.faces.push(I);s.faceVertexUvs[0].push([P.clone(),R,k.clone()])}}}this.mergeVertices()};e.BoxGeometry.prototype=Object.create(e.Geometry.prototype);e.BoxGeometry.prototype.constructor=e.BoxGeometry;
119e.CircleGeometry=function(t,r,n,i){e.Geometry.call(this);this.type="CircleGeometry";this.parameters={radius:t,segments:r,thetaStart:n,thetaLength:i};t=t||50;r=r!==undefined?Math.max(3,r):8;n=n!==undefined?n:0;i=i!==undefined?i:Math.PI*2;var a,o=[],s=new e.Vector3,u=new e.Vector2(.5,.5);this.vertices.push(s);o.push(u);for(a=0;a<=r;a++){var l=new e.Vector3;var c=n+a/r*i;l.x=t*Math.cos(c);l.y=t*Math.sin(c);this.vertices.push(l);o.push(new e.Vector2((l.x/t+1)/2,(l.y/t+1)/2))}var f=new e.Vector3(0,0,1);for(a=1;a<=r;a++){this.faces.push(new e.Face3(a,a+1,0,[f.clone(),f.clone(),f.clone()]));this.faceVertexUvs[0].push([o[a].clone(),o[a+1].clone(),u.clone()])}this.computeFaceNormals();this.boundingSphere=new e.Sphere(new e.Vector3,t)};e.CircleGeometry.prototype=Object.create(e.Geometry.prototype);e.CircleGeometry.prototype.constructor=e.CircleGeometry;e.CubeGeometry=function(t,r,n,i,a,o){e.warn("THREE.CubeGeometry has been renamed to THREE.BoxGeometry.");return new e.BoxGeometry(t,r,n,i,a,o)};e.CylinderGeometry=function(t,r,n,i,a,o,s,u){e.Geometry.call(this);this.type="CylinderGeometry";this.parameters={radiusTop:t,radiusBottom:r,height:n,radialSegments:i,heightSegments:a,openEnded:o,thetaStart:s,thetaLength:u};t=t!==undefined?t:20;r=r!==undefined?r:20;n=n!==undefined?n:100;i=i||8;a=a||1;o=o!==undefined?o:false;s=s!==undefined?s:0;u=u!==undefined?u:2*Math.PI;var l=n/2;var c,f,h=[],d=[];for(f=0;f<=a;f++){var p=[];var m=[];var v=f/a;var y=v*(r-t)+t;for(c=0;c<=i;c++){var g=c/i;var b=new e.Vector3;b.x=y*Math.sin(g*u+s);b.y=-v*n+l;b.z=y*Math.cos(g*u+s);this.vertices.push(b);p.push(this.vertices.length-1);m.push(new e.Vector2(g,1-v))}h.push(p);d.push(m)}var x=(r-t)/n;var _,w;for(c=0;c<i;c++){if(t!==0){_=this.vertices[h[0][c]].clone();w=this.vertices[h[0][c+1]].clone()}else{_=this.vertices[h[1][c]].clone();w=this.vertices[h[1][c+1]].clone()}_.setY(Math.sqrt(_.x*_.x+_.z*_.z)*x).normalize();w.setY(Math.sqrt(w.x*w.x+w.z*w.z)*x).normalize();for(f=0;f<a;f++){var C=h[f][c];var E=h[f+1][c];var S=h[f+1][c+1];var T=h[f][c+1];var M=_.clone();var A=_.clone();var P=w.clone();var R=w.clone();var k=d[f][c].clone();var I=d[f+1][c].clone();var D=d[f+1][c+1].clone();var B=d[f][c+1].clone();this.faces.push(new e.Face3(C,E,T,[M,A,R]));this.faceVertexUvs[0].push([k,I,B]);this.faces.push(new e.Face3(E,S,T,[A.clone(),P,R.clone()]));this.faceVertexUvs[0].push([I.clone(),D,B.clone()])}}if(o===false&&t>0){this.vertices.push(new e.Vector3(0,l,0));for(c=0;c<i;c++){var C=h[0][c];var E=h[0][c+1];var S=this.vertices.length-1;var M=new e.Vector3(0,1,0);var A=new e.Vector3(0,1,0);var P=new e.Vector3(0,1,0);var k=d[0][c].clone();var I=d[0][c+1].clone();var D=new e.Vector2(I.x,0);this.faces.push(new e.Face3(C,E,S,[M,A,P]));this.faceVertexUvs[0].push([k,I,D])}}if(o===false&&r>0){this.vertices.push(new e.Vector3(0,-l,0));for(c=0;c<i;c++){var C=h[a][c+1];var E=h[a][c];var S=this.vertices.length-1;var M=new e.Vector3(0,-1,0);var A=new e.Vector3(0,-1,0);var P=new e.Vector3(0,-1,0);var k=d[a][c+1].clone();var I=d[a][c].clone();var D=new e.Vector2(I.x,1);this.faces.push(new e.Face3(C,E,S,[M,A,P]));this.faceVertexUvs[0].push([k,I,D])}}this.computeFaceNormals()};e.CylinderGeometry.prototype=Object.create(e.Geometry.prototype);e.CylinderGeometry.prototype.constructor=e.CylinderGeometry;e.ExtrudeGeometry=function(t,r){if(typeof t==="undefined"){t=[];return}e.Geometry.call(this);this.type="ExtrudeGeometry";t=t instanceof Array?t:[t];this.addShapeList(t,r);this.computeFaceNormals()};e.ExtrudeGeometry.prototype=Object.create(e.Geometry.prototype);e.ExtrudeGeometry.prototype.constructor=e.ExtrudeGeometry;e.ExtrudeGeometry.prototype.addShapeList=function(e,t){var r=e.length;for(var n=0;n<r;n++){var i=e[n];this.addShape(i,t)}};e.ExtrudeGeometry.prototype.addShape=function(t,r){var n=r.amount!==undefined?r.amount:100;var i=r.bevelThickness!==undefined?r.bevelThickness:6;var a=r.bevelSize!==undefined?r.bevelSize:i-2;var o=r.bevelSegments!==undefined?r.bevelSegments:3;var s=r.bevelEnabled!==undefined?r.bevelEnabled:true;var u=r.curveSegments!==undefined?r.curveSegments:12;var l=r.steps!==undefined?r.steps:1;var c=r.extrudePath;var f,h=false;var d=r.material;var p=r.extrudeMaterial;var m=r.UVGenerator!==undefined?r.UVGenerator:e.ExtrudeGeometry.WorldUVGenerator;var v,y,g,b;
119if(c){f=c.getSpacedPoints(l);h=true;s=false;v=r.frames!==undefined?r.frames:new e.TubeGeometry.FrenetFrames(c,l,false);y=new e.Vector3;g=new e.Vector3;b=new e.Vector3}if(!s){o=0;i=0;a=0}var x,_,w;var C=this;var E=this.vertices.length;var S=t.extractPoints(u);var T=S.shape;var M=S.holes;var A=!e.Shape.Utils.isClockWise(T);if(A){T=T.reverse();for(_=0,w=M.length;_<w;_++){x=M[_];if(e.Shape.Utils.isClockWise(x)){M[_]=x.reverse()}}A=false}var P=e.Shape.Utils.triangulateShape(T,M);var R=T;for(_=0,w=M.length;_<w;_++){x=M[_];T=T.concat(x)}function k(t,r,n){if(!r)e.error("THREE.ExtrudeGeometry: vec does not exist");return r.clone().multiplyScalar(n).add(t)}var I,D,B,L,F,V=T.length,O,U=P.length;function N(t,r,n){var i=1e-10;var a,o,s=1;var u=t.x-r.x,l=t.y-r.y;var c=n.x-t.x,f=n.y-t.y;var h=u*u+l*l;var d=u*f-l*c;if(Math.abs(d)>i){var p=Math.sqrt(h);var m=Math.sqrt(c*c+f*f);var v=r.x-l/p;var y=r.y+u/p;var g=n.x-f/m;var b=n.y+c/m;var x=((g-v)*f-(b-y)*c)/(u*f-l*c);a=v+u*x-t.x;o=y+l*x-t.y;var _=a*a+o*o;if(_<=2){return new e.Vector2(a,o)}else{s=Math.sqrt(_/2)}}else{var w=false;if(u>i){if(c>i){w=true}}else{if(u<-i){if(c<-i){w=true}}else{if(Math.sign(l)==Math.sign(f)){w=true}}}if(w){a=-l;o=u;s=Math.sqrt(h)}else{a=u;o=l;s=Math.sqrt(h/2)}}return new e.Vector2(a/s,o/s)}var z=[];for(var H=0,j=R.length,G=j-1,W=H+1;H<j;H++,G++,W++){if(G===j)G=0;if(W===j)W=0;z[H]=N(R[H],R[G],R[W])}var q=[],X,Y=z.concat();for(_=0,w=M.length;_<w;_++){x=M[_];X=[];for(H=0,j=x.length,G=j-1,W=H+1;H<j;H++,G++,W++){if(G===j)G=0;if(W===j)W=0;X[H]=N(x[H],x[G],x[W])}q.push(X);Y=Y.concat(X)}for(I=0;I<o;I++){B=I/o;L=i*(1-B);D=a*Math.sin(B*Math.PI/2);for(H=0,j=R.length;H<j;H++){F=k(R[H],z[H],D);$(F.x,F.y,-L)}for(_=0,w=M.length;_<w;_++){x=M[_];X=q[_];for(H=0,j=x.length;H<j;H++){F=k(x[H],X[H],D);$(F.x,F.y,-L)}}}D=a;for(H=0;H<V;H++){F=s?k(T[H],Y[H],D):T[H];if(!h){$(F.x,F.y,0)}else{g.copy(v.normals[0]).multiplyScalar(F.x);y.copy(v.binormals[0]).multiplyScalar(F.y);b.copy(f[0]).add(g).add(y);$(b.x,b.y,b.z)}}var K;for(K=1;K<=l;K++){for(H=0;H<V;H++){F=s?k(T[H],Y[H],D):T[H];if(!h){$(F.x,F.y,n/l*K)}else{g.copy(v.normals[K]).multiplyScalar(F.x);y.copy(v.binormals[K]).multiplyScalar(F.y);b.copy(f[K]).add(g).add(y);$(b.x,b.y,b.z)}}}for(I=o-1;I>=0;I--){B=I/o;L=i*(1-B);D=a*Math.sin(B*Math.PI/2);for(H=0,j=R.length;H<j;H++){F=k(R[H],z[H],D);$(F.x,F.y,n+L)}for(_=0,w=M.length;_<w;_++){x=M[_];X=q[_];for(H=0,j=x.length;H<j;H++){F=k(x[H],X[H],D);if(!h){$(F.x,F.y,n+L)}else{$(F.x,F.y+f[l-1].y,f[l-1].x+L)}}}}Q();Z();function Q(){if(s){var e=0;var t=V*e;for(H=0;H<U;H++){O=P[H];ee(O[2]+t,O[1]+t,O[0]+t)}e=l+o*2;t=V*e;for(H=0;H<U;H++){O=P[H];ee(O[0]+t,O[1]+t,O[2]+t)}}else{for(H=0;H<U;H++){O=P[H];ee(O[2],O[1],O[0])}for(H=0;H<U;H++){O=P[H];ee(O[0]+V*l,O[1]+V*l,O[2]+V*l)}}}function Z(){var e=0;J(R,e);e+=R.length;for(_=0,w=M.length;_<w;_++){x=M[_];J(x,e);e+=x.length}}function J(e,t){var r,n;H=e.length;while(--H>=0){r=H;n=H-1;if(n<0)n=e.length-1;var i=0,a=l+o*2;for(i=0;i<a;i++){var s=V*i;var u=V*(i+1);var c=t+r+s,f=t+n+s,h=t+n+u,d=t+r+u;te(c,f,h,d,e,i,a,r,n)}}}function $(t,r,n){C.vertices.push(new e.Vector3(t,r,n))}function ee(t,r,n){t+=E;r+=E;n+=E;C.faces.push(new e.Face3(t,r,n,null,null,d));var i=m.generateTopUV(C,t,r,n);C.faceVertexUvs[0].push(i)}function te(t,r,n,i,a,o,s,u,l){t+=E;r+=E;n+=E;i+=E;C.faces.push(new e.Face3(t,r,i,null,null,p));C.faces.push(new e.Face3(r,n,i,null,null,p));var c=m.generateSideWallUV(C,t,r,n,i);C.faceVertexUvs[0].push([c[0],c[1],c[3]]);C.faceVertexUvs[0].push([c[1],c[2],c[3]])}};e.ExtrudeGeometry.WorldUVGenerator={generateTopUV:function(t,r,n,i){var a=t.vertices;var o=a[r];var s=a[n];var u=a[i];return[new e.Vector2(o.x,o.y),new e.Vector2(s.x,s.y),new e.Vector2(u.x,u.y)]},generateSideWallUV:function(t,r,n,i,a){var o=t.vertices;var s=o[r];var u=o[n];var l=o[i];var c=o[a];if(Math.abs(s.y-u.y)<.01){return[new e.Vector2(s.x,1-s.z),new e.Vector2(u.x,1-u.z),new e.Vector2(l.x,1-l.z),new e.Vector2(c.x,1-c.z)]}else{return[new e.Vector2(s.y,1-s.z),new e.Vector2(u.y,1-u.z),new e.Vector2(l.y,1-l.z),new e.Vector2(c.y,1-c.z)]}}};e.ShapeGeometry=function(t,r){e.Geometry.call(this);this.type="ShapeGeometry";if(t instanceof Array===false)t=[t];this.addShapeList(t,r);this.computeFaceNormals()};e.ShapeGeometry.prototype=Object.create(e.Geometry.prototype);e.ShapeGeometry.prototype.constructor=e.ShapeGeometry;e.ShapeGeometry.prototype.addShapeList=function(e,t){for(var r=0,n=e.length;r<n;r++){this.addShape(e[r],t)}return this};e.ShapeGeometry.prototype.addShape=function(t,r){if(r===undefined)r={};var n=r.curveSegments!==undefined?r.curveSegments:12;var i=r.material;var a=r.UVGenerator===undefined?e.ExtrudeGeometry.WorldUVGenerator:r.UVGenerator;var o,s,u;var l=this.vertices.length;var c=t.extractPoints(n);var f=c.shape;var h=c.holes;var d=!e.Shape.Utils.isClockWise(f);if(d){f=f.reverse();for(o=0,s=h.length;o<s;o++){u=h[o];if(e.Shape.Utils.isClockWise(u)){h[o]=u.reverse()}}d=false}var p=e.Shape.Utils.triangulateShape(f,h);var m=f;for(o=0,s=h.length;o<s;o++){u=h[o];f=f.concat(u)}var v,y=f.length;var g,b=p.length;for(o=0;o<y;o++){v=f[o];this.vertices.push(new e.Vector3(v.x,v.y,0))}for(o=0;o<b;o++){g=p[o];var x=g[0]+l;var _=g[1]+l;var w=g[2]+l;this.faces.push(new e.Face3(x,_,w,null,null,i));this.faceVertexUvs[0].push(a.generateTopUV(this,x,_,w))}};e.LatheGeometry=function(t,r,n,i){e.Geometry.call(this);this.type="LatheGeometry";this.parameters={points:t,segments:r,phiStart:n,phiLength:i};r=r||12;n=n||0;i=i||2*Math.PI;var a=1/(t.length-1);var o=1/r;for(var s=0,u=r;s<=u;s++){var l=n+s*o*i;var c=Math.cos(l),f=Math.sin(l);for(var h=0,d=t.length;h<d;h++){var p=t[h];var m=new e.Vector3;m.x=c*p.x-f*p.y;m.y=f*p.x+c*p.y;m.z=p.z;this.vertices.push(m)}}var v=t.length;for(var s=0,u=r;s<u;s++){for(var h=0,d=t.length-1;h<d;h++){var y=h+v*s;var g=y;var b=y+v;var c=y+1+v;var x=y+1;var _=s*o;var w=h*a;var C=_+o;var E=w+a;this.faces.push(new e.Face3(g,b,x));this.faceVertexUvs[0].push([new e.Vector2(_,w),new e.Vector2(C,w),new e.Vector2(_,E)]);this.faces.push(new e.Face3(b,c,x));this.faceVertexUvs[0].push([new e.Vector2(C,w),new e.Vector2(C,E),new e.Vector2(_,E)])}}this.mergeVertices();this.computeFaceNormals();this.computeVertexNormals()};e.LatheGeometry.prototype=Object.create(e.Geometry.prototype);e.LatheGeometry.prototype.constructor=e.LatheGeometry;e.PlaneGeometry=function(t,r,n,i){console.info("THREE.PlaneGeometry: Consider using THREE.PlaneBufferGeometry for lower memory footprint.");e.Geometry.call(this);this.type="PlaneGeometry";this.parameters={width:t,height:r,widthSegments:n,heightSegments:i};this.fromBufferGeometry(new e.PlaneBufferGeometry(t,r,n,i))};e.PlaneGeometry.prototype=Object.create(e.Geometry.prototype);e.PlaneGeometry.prototype.constructor=e.PlaneGeometry;e.PlaneBufferGeometry=function(t,r,n,i){e.BufferGeometry.call(this);this.type="PlaneBufferGeometry";this.parameters={width:t,height:r,widthSegments:n,heightSegments:i};var a=t/2;var o=r/2;var s=n||1;var u=i||1;var l=s+1;var c=u+1;var f=t/s;var h=r/u;var d=new Float32Array(l*c*3);var p=new Float32Array(l*c*3);var m=new Float32Array(l*c*2);var v=0;var y=0;for(var g=0;g<c;g++){var b=g*h-o;for(var x=0;x<l;x++){var _=x*f-a;d[v]=_;d[v+1]=-b;p[v+2]=1;m[y]=x/s;m[y+1]=1-g/u;v+=3;y+=2}}v=0;var w=new(d.length/3>65535?Uint32Array:Uint16Array)(s*u*6);for(var g=0;g<u;g++){for(var x=0;x<s;x++){var C=x+l*g;var E=x+l*(g+1);var S=x+1+l*(g+1);var T=x+1+l*g;w[v]=C;w[v+1]=E;w[v+2]=T;w[v+3]=E;w[v+4]=S;w[v+5]=T;v+=6}
119}this.addAttribute("index",new e.BufferAttribute(w,1));this.addAttribute("position",new e.BufferAttribute(d,3));this.addAttribute("normal",new e.BufferAttribute(p,3));this.addAttribute("uv",new e.BufferAttribute(m,2))};e.PlaneBufferGeometry.prototype=Object.create(e.BufferGeometry.prototype);e.PlaneBufferGeometry.prototype.constructor=e.PlaneBufferGeometry;e.RingGeometry=function(t,r,n,i,a,o){e.Geometry.call(this);this.type="RingGeometry";this.parameters={innerRadius:t,outerRadius:r,thetaSegments:n,phiSegments:i,thetaStart:a,thetaLength:o};t=t||0;r=r||50;a=a!==undefined?a:0;o=o!==undefined?o:Math.PI*2;n=n!==undefined?Math.max(3,n):8;i=i!==undefined?Math.max(1,i):8;var s,u,l=[],c=t,f=(r-t)/i;for(s=0;s<i+1;s++){for(u=0;u<n+1;u++){var h=new e.Vector3;var d=a+u/n*o;h.x=c*Math.cos(d);h.y=c*Math.sin(d);this.vertices.push(h);l.push(new e.Vector2((h.x/r+1)/2,(h.y/r+1)/2))}c+=f}var p=new e.Vector3(0,0,1);for(s=0;s<i;s++){var m=s*(n+1);for(u=0;u<n;u++){var d=u+m;var v=d;var y=d+n+1;var g=d+n+2;this.faces.push(new e.Face3(v,y,g,[p.clone(),p.clone(),p.clone()]));this.faceVertexUvs[0].push([l[v].clone(),l[y].clone(),l[g].clone()]);v=d;y=d+n+2;g=d+1;this.faces.push(new e.Face3(v,y,g,[p.clone(),p.clone(),p.clone()]));this.faceVertexUvs[0].push([l[v].clone(),l[y].clone(),l[g].clone()])}}this.computeFaceNormals();this.boundingSphere=new e.Sphere(new e.Vector3,c)};e.RingGeometry.prototype=Object.create(e.Geometry.prototype);e.RingGeometry.prototype.constructor=e.RingGeometry;e.SphereGeometry=function(t,r,n,i,a,o,s){e.Geometry.call(this);this.type="SphereGeometry";this.parameters={radius:t,widthSegments:r,heightSegments:n,phiStart:i,phiLength:a,thetaStart:o,thetaLength:s};t=t||50;r=Math.max(3,Math.floor(r)||8);n=Math.max(2,Math.floor(n)||6);i=i!==undefined?i:0;a=a!==undefined?a:Math.PI*2;o=o!==undefined?o:0;s=s!==undefined?s:Math.PI;var u,l,c=[],f=[];for(l=0;l<=n;l++){var h=[];var d=[];for(u=0;u<=r;u++){var p=u/r;var m=l/n;var v=new e.Vector3;v.x=-t*Math.cos(i+p*a)*Math.sin(o+m*s);v.y=t*Math.cos(o+m*s);v.z=t*Math.sin(i+p*a)*Math.sin(o+m*s);this.vertices.push(v);h.push(this.vertices.length-1);d.push(new e.Vector2(p,1-m))}c.push(h);f.push(d)}for(l=0;l<n;l++){for(u=0;u<r;u++){var y=c[l][u+1];var g=c[l][u];var b=c[l+1][u];var x=c[l+1][u+1];var _=this.vertices[y].clone().normalize();var w=this.vertices[g].clone().normalize();var C=this.vertices[b].clone().normalize();var E=this.vertices[x].clone().normalize();var S=f[l][u+1].clone();var T=f[l][u].clone();var M=f[l+1][u].clone();var A=f[l+1][u+1].clone();if(Math.abs(this.vertices[y].y)===t){S.x=(S.x+T.x)/2;this.faces.push(new e.Face3(y,b,x,[_,C,E]));this.faceVertexUvs[0].push([S,M,A])}else if(Math.abs(this.vertices[b].y)===t){M.x=(M.x+A.x)/2;this.faces.push(new e.Face3(y,g,b,[_,w,C]));this.faceVertexUvs[0].push([S,T,M])}else{this.faces.push(new e.Face3(y,g,x,[_,w,E]));this.faceVertexUvs[0].push([S,T,A]);this.faces.push(new e.Face3(g,b,x,[w.clone(),C,E.clone()]));this.faceVertexUvs[0].push([T.clone(),M,A.clone()])}}}this.computeFaceNormals();this.boundingSphere=new e.Sphere(new e.Vector3,t)};e.SphereGeometry.prototype=Object.create(e.Geometry.prototype);e.SphereGeometry.prototype.constructor=e.SphereGeometry;e.TextGeometry=function(t,r){r=r||{};var n=e.FontUtils.generateShapes(t,r);r.amount=r.height!==undefined?r.height:50;if(r.bevelThickness===undefined)r.bevelThickness=10;if(r.bevelSize===undefined)r.bevelSize=8;if(r.bevelEnabled===undefined)r.bevelEnabled=false;e.ExtrudeGeometry.call(this,n,r);this.type="TextGeometry"};e.TextGeometry.prototype=Object.create(e.ExtrudeGeometry.prototype);e.TextGeometry.prototype.constructor=e.TextGeometry;e.TorusGeometry=function(t,r,n,i,a){e.Geometry.call(this);this.type="TorusGeometry";this.parameters={radius:t,tube:r,radialSegments:n,tubularSegments:i,arc:a};t=t||100;r=r||40;n=n||8;i=i||6;a=a||Math.PI*2;var o=new e.Vector3,s=[],u=[];for(var l=0;l<=n;l++){for(var c=0;c<=i;c++){var f=c/i*a;var h=l/n*Math.PI*2;o.x=t*Math.cos(f);o.y=t*Math.sin(f);var d=new e.Vector3;d.x=(t+r*Math.cos(h))*Math.cos(f);d.y=(t+r*Math.cos(h))*Math.sin(f);d.z=r*Math.sin(h);this.vertices.push(d);s.push(new e.Vector2(c/i,l/n));u.push(d.clone().sub(o).normalize())}}for(var l=1;l<=n;l++){for(var c=1;c<=i;c++){var p=(i+1)*l+c-1;var m=(i+1)*(l-1)+c-1;var v=(i+1)*(l-1)+c;var y=(i+1)*l+c;var g=new e.Face3(p,m,y,[u[p].clone(),u[m].clone(),u[y].clone()]);this.faces.push(g);this.faceVertexUvs[0].push([s[p].clone(),s[m].clone(),s[y].clone()]);g=new e.Face3(m,v,y,[u[m].clone(),u[v].clone(),u[y].clone()]);this.faces.push(g);this.faceVertexUvs[0].push([s[m].clone(),s[v].clone(),s[y].clone()])}}this.computeFaceNormals()};e.TorusGeometry.prototype=Object.create(e.Geometry.prototype);e.TorusGeometry.prototype.constructor=e.TorusGeometry;e.TorusKnotGeometry=function(t,r,n,i,a,o,s){e.Geometry.call(this);this.type="TorusKnotGeometry";
119this.parameters={radius:t,tube:r,radialSegments:n,tubularSegments:i,p:a,q:o,heightScale:s};t=t||100;r=r||40;n=n||64;i=i||8;a=a||2;o=o||3;s=s||1;var u=new Array(n);var l=new e.Vector3;var c=new e.Vector3;var f=new e.Vector3;for(var h=0;h<n;++h){u[h]=new Array(i);var d=h/n*2*a*Math.PI;var p=k(d,o,a,t,s);var m=k(d+.01,o,a,t,s);l.subVectors(m,p);c.addVectors(m,p);f.crossVectors(l,c);c.crossVectors(f,l);f.normalize();c.normalize();for(var v=0;v<i;++v){var y=v/i*2*Math.PI;var g=-r*Math.cos(y);var b=r*Math.sin(y);var x=new e.Vector3;x.x=p.x+g*c.x+b*f.x;x.y=p.y+g*c.y+b*f.y;x.z=p.z+g*c.z+b*f.z;u[h][v]=this.vertices.push(x)-1}}for(var h=0;h<n;++h){for(var v=0;v<i;++v){var _=(h+1)%n;var w=(v+1)%i;var C=u[h][v];var E=u[_][v];var S=u[_][w];var T=u[h][w];var M=new e.Vector2(h/n,v/i);var A=new e.Vector2((h+1)/n,v/i);var P=new e.Vector2((h+1)/n,(v+1)/i);var R=new e.Vector2(h/n,(v+1)/i);this.faces.push(new e.Face3(C,E,T));this.faceVertexUvs[0].push([M,A,R]);this.faces.push(new e.Face3(E,S,T));this.faceVertexUvs[0].push([A.clone(),P,R.clone()])}}this.computeFaceNormals();this.computeVertexNormals();function k(t,r,n,i,a){var o=Math.cos(t);var s=Math.sin(t);var u=r/n*t;var l=Math.cos(u);var c=i*(2+l)*.5*o;var f=i*(2+l)*s*.5;var h=a*i*Math.sin(u)*.5;return new e.Vector3(c,f,h)}};e.TorusKnotGeometry.prototype=Object.create(e.Geometry.prototype);e.TorusKnotGeometry.prototype.constructor=e.TorusKnotGeometry;e.TubeGeometry=function(t,r,n,i,a,o){e.Geometry.call(this);this.type="TubeGeometry";this.parameters={path:t,segments:r,radius:n,radialSegments:i,closed:a};r=r||64;n=n||1;i=i||8;a=a||false;o=o||e.TubeGeometry.NoTaper;var s=[];var u=this,l,c,f,h=r+1,d,p,m,v,y,g,b=new e.Vector3,x,_,w,C,E,S,T,M,A,P,R,k;var I=new e.TubeGeometry.FrenetFrames(t,r,a),D=I.tangents,B=I.normals,L=I.binormals;this.tangents=D;this.normals=B;this.binormals=L;function F(t,r,n){return u.vertices.push(new e.Vector3(t,r,n))-1}for(x=0;x<h;x++){s[x]=[];d=x/(h-1);g=t.getPointAt(d);l=D[x];c=B[x];f=L[x];m=n*o(d);for(_=0;_<i;_++){p=_/i*2*Math.PI;v=-m*Math.cos(p);y=m*Math.sin(p);b.copy(g);b.x+=v*c.x+y*f.x;b.y+=v*c.y+y*f.y;b.z+=v*c.z+y*f.z;s[x][_]=F(b.x,b.y,b.z)}}for(x=0;x<r;x++){for(_=0;_<i;_++){w=a?(x+1)%r:x+1;C=(_+1)%i;E=s[x][_];S=s[w][_];T=s[w][C];M=s[x][C];A=new e.Vector2(x/r,_/i);P=new e.Vector2((x+1)/r,_/i);R=new e.Vector2((x+1)/r,(_+1)/i);k=new e.Vector2(x/r,(_+1)/i);this.faces.push(new e.Face3(E,S,M));this.faceVertexUvs[0].push([A,P,k]);this.faces.push(new e.Face3(S,T,M));this.faceVertexUvs[0].push([P.clone(),R,k.clone()])}}this.computeFaceNormals();this.computeVertexNormals()};e.TubeGeometry.prototype=Object.create(e.Geometry.prototype);e.TubeGeometry.prototype.constructor=e.TubeGeometry;e.TubeGeometry.NoTaper=function(e){return 1};e.TubeGeometry.SinusoidalTaper=function(e){return Math.sin(Math.PI*e)};e.TubeGeometry.FrenetFrames=function(t,r,n){var i=new e.Vector3,a=[],o=[],s=[],u=new e.Vector3,l=new e.Matrix4,c=r+1,f,h=1e-4,d,p,m,v,y,g;this.tangents=a;this.normals=o;this.binormals=s;for(y=0;y<c;y++){g=y/(c-1);a[y]=t.getTangentAt(g);a[y].normalize()}b();function b(){o[0]=new e.Vector3;s[0]=new e.Vector3;d=Number.MAX_VALUE;p=Math.abs(a[0].x);m=Math.abs(a[0].y);v=Math.abs(a[0].z);if(p<=d){d=p;i.set(1,0,0)}if(m<=d){d=m;i.set(0,1,0)}if(v<=d){i.set(0,0,1)}u.crossVectors(a[0],i).normalize();o[0].crossVectors(a[0],u);s[0].crossVectors(a[0],o[0])}for(y=1;y<c;y++){o[y]=o[y-1].clone();s[y]=s[y-1].clone();u.crossVectors(a[y-1],a[y]);if(u.length()>h){u.normalize();f=Math.acos(e.Math.clamp(a[y-1].dot(a[y]),-1,1));o[y].applyMatrix4(l.makeRotationAxis(u,f))}s[y].crossVectors(a[y],o[y])}if(n){f=Math.acos(e.Math.clamp(o[0].dot(o[c-1]),-1,1));f/=c-1;if(a[0].dot(u.crossVectors(o[0],o[c-1]))>0){f=-f}for(y=1;y<c;y++){o[y].applyMatrix4(l.makeRotationAxis(a[y],f*y));s[y].crossVectors(a[y],o[y])}}};e.PolyhedronGeometry=function(t,r,n,i){e.Geometry.call(this);this.type="PolyhedronGeometry";this.parameters={vertices:t,indices:r,radius:n,detail:i};n=n||1;i=i||0;var a=this;for(var o=0,s=t.length;o<s;o+=3){_(new e.Vector3(t[o],t[o+1],t[o+2]))}var u=this.vertices;var l=[];for(var o=0,c=0,s=r.length;o<s;o+=3,c++){var f=u[r[o]];var h=u[r[o+1]];var d=u[r[o+2]];l[c]=new e.Face3(f.index,h.index,d.index,[f.clone(),h.clone(),d.clone()])}var p=new e.Vector3;for(var o=0,s=l.length;o<s;o++){C(l[o],i)}for(var o=0,s=this.faceVertexUvs[0].length;o<s;o++){var m=this.faceVertexUvs[0][o];var v=m[0].x;var y=m[1].x;var g=m[2].x;var b=Math.max(v,Math.max(y,g));var x=Math.min(v,Math.min(y,g));if(b>.9&&x<.1){if(v<.2)m[0].x+=1;if(y<.2)m[1].x+=1;if(g<.2)m[2].x+=1}}for(var o=0,s=this.vertices.length;o<s;o++){this.vertices[o].multiplyScalar(n)}this.mergeVertices();this.computeFaceNormals();
119this.boundingSphere=new e.Sphere(new e.Vector3,n);function _(t){var r=t.normalize().clone();r.index=a.vertices.push(r)-1;var n=E(t)/2/Math.PI+.5;var i=S(t)/Math.PI+.5;r.uv=new e.Vector2(n,1-i);return r}function w(t,r,n){var i=new e.Face3(t.index,r.index,n.index,[t.clone(),r.clone(),n.clone()]);a.faces.push(i);p.copy(t).add(r).add(n).divideScalar(3);var o=E(p);a.faceVertexUvs[0].push([T(t.uv,t,o),T(r.uv,r,o),T(n.uv,n,o)])}function C(e,t){var r=Math.pow(2,t);var n=_(a.vertices[e.a]);var i=_(a.vertices[e.b]);var o=_(a.vertices[e.c]);var s=[];for(var u=0;u<=r;u++){s[u]=[];var l=_(n.clone().lerp(o,u/r));var c=_(i.clone().lerp(o,u/r));var f=r-u;for(var h=0;h<=f;h++){if(h==0&&u==r){s[u][h]=l}else{s[u][h]=_(l.clone().lerp(c,h/f))}}}for(var u=0;u<r;u++){for(var h=0;h<2*(r-u)-1;h++){var d=Math.floor(h/2);if(h%2==0){w(s[u][d+1],s[u+1][d],s[u][d])}else{w(s[u][d+1],s[u+1][d+1],s[u+1][d])}}}}function E(e){return Math.atan2(e.z,-e.x)}function S(e){return Math.atan2(-e.y,Math.sqrt(e.x*e.x+e.z*e.z))}function T(t,r,n){if(n<0&&t.x===1)t=new e.Vector2(t.x-1,t.y);if(r.x===0&&r.z===0)t=new e.Vector2(n/2/Math.PI+.5,t.y);return t.clone()}};e.PolyhedronGeometry.prototype=Object.create(e.Geometry.prototype);e.PolyhedronGeometry.prototype.constructor=e.PolyhedronGeometry;e.DodecahedronGeometry=function(t,r){this.parameters={radius:t,detail:r};var n=(1+Math.sqrt(5))/2;var i=1/n;var a=[-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,-i,-n,0,-i,n,0,i,-n,0,i,n,-i,-n,0,-i,n,0,i,-n,0,i,n,0,-n,0,-i,n,0,-i,-n,0,i,n,0,i];var o=[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,
11919,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9];e.PolyhedronGeometry.call(this,a,o,t,r)};e.DodecahedronGeometry.prototype=Object.create(e.Geometry.prototype);e.DodecahedronGeometry.prototype.constructor=e.DodecahedronGeometry;e.IcosahedronGeometry=function(t,r){var n=(1+Math.sqrt(5))/2;var i=[-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];var a=[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1];e.PolyhedronGeometry.call(this,i,a,t,r);this.type="IcosahedronGeometry";this.parameters={radius:t,detail:r}};e.IcosahedronGeometry.prototype=Object.create(e.Geometry.prototype);e.IcosahedronGeometry.prototype.constructor=e.IcosahedronGeometry;e.OctahedronGeometry=function(t,r){this.parameters={radius:t,detail:r};var n=[1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1];var i=[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2];e.PolyhedronGeometry.call(this,n,i,t,r);this.type="OctahedronGeometry";this.parameters={radius:t,detail:r}};e.OctahedronGeometry.prototype=Object.create(e.Geometry.prototype);e.OctahedronGeometry.prototype.constructor=e.OctahedronGeometry;e.TetrahedronGeometry=function(t,r){var n=[1,1,1,-1,-1,1,-1,1,-1,1,-1,-1];var i=[2,1,0,0,3,2,1,3,0,2,3,1];e.PolyhedronGeometry.call(this,n,i,t,r);this.type="TetrahedronGeometry";this.parameters={radius:t,detail:r}};e.TetrahedronGeometry.prototype=Object.create(e.Geometry.prototype);e.TetrahedronGeometry.prototype.constructor=e.TetrahedronGeometry;e.ParametricGeometry=function(t,r,n){e.Geometry.call(this);this.type="ParametricGeometry";this.parameters={func:t,slices:r,stacks:n};var i=this.vertices;var a=this.faces;var o=this.faceVertexUvs[0];var s,u,l;var c,f;var h=r+1;for(s=0;s<=n;s++){f=s/n;for(u=0;u<=r;u++){c=u/r;l=t(c,f);i.push(l)}}var d,p,m,v;var y,g,b,x;for(s=0;s<n;s++){for(u=0;u<r;u++){d=s*h+u;p=s*h+u+1;m=(s+1)*h+u+1;v=(s+1)*h+u;y=new e.Vector2(u/r,s/n);g=new e.Vector2((u+1)/r,s/n);b=new e.Vector2((u+1)/r,(s+1)/n);x=new e.Vector2(u/r,(s+1)/n);a.push(new e.Face3(d,p,v));o.push([y,g,x]);a.push(new e.Face3(p,m,v));o.push([g.clone(),b,x.clone()])}}this.computeFaceNormals();this.computeVertexNormals()};e.ParametricGeometry.prototype=Object.create(e.Geometry.prototype);e.ParametricGeometry.prototype.constructor=e.ParametricGeometry;e.AxisHelper=function(t){t=t||1;var r=new Float32Array([0,0,0,t,0,0,0,0,0,0,t,0,0,0,0,0,0,t]);var n=new Float32Array([1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1]);var i=new e.BufferGeometry;i.addAttribute("position",new e.BufferAttribute(r,3));i.addAttribute("color",new e.BufferAttribute(n,3));var a=new e.LineBasicMaterial({vertexColors:e.VertexColors});e.Line.call(this,i,a,e.LinePieces)};e.AxisHelper.prototype=Object.create(e.Line.prototype);e.AxisHelper.prototype.constructor=e.AxisHelper;e.ArrowHelper=function(){var t=new e.Geometry;t.vertices.push(new e.Vector3(0,0,0),new e.Vector3(0,1,0));var r=new e.CylinderGeometry(0,.5,1,5,1);
119r.applyMatrix((new e.Matrix4).makeTranslation(0,-.5,0));return function(n,i,a,o,s,u){e.Object3D.call(this);if(o===undefined)o=16776960;if(a===undefined)a=1;if(s===undefined)s=.2*a;if(u===undefined)u=.2*s;this.position.copy(i);this.line=new e.Line(t,new e.LineBasicMaterial({color:o}));this.line.matrixAutoUpdate=false;this.add(this.line);this.cone=new e.Mesh(r,new e.MeshBasicMaterial({color:o}));this.cone.matrixAutoUpdate=false;this.add(this.cone);this.setDirection(n);this.setLength(a,s,u)}}();e.ArrowHelper.prototype=Object.create(e.Object3D.prototype);e.ArrowHelper.prototype.constructor=e.ArrowHelper;e.ArrowHelper.prototype.setDirection=function(){var t=new e.Vector3;var r;return function(e){if(e.y>.99999){this.quaternion.set(0,0,0,1)}else if(e.y<-.99999){this.quaternion.set(1,0,0,0)}else{t.set(e.z,0,-e.x).normalize();r=Math.acos(e.y);this.quaternion.setFromAxisAngle(t,r)}}}();e.ArrowHelper.prototype.setLength=function(e,t,r){if(t===undefined)t=.2*e;if(r===undefined)r=.2*t;this.line.scale.set(1,e-t,1);this.line.updateMatrix();this.cone.scale.set(r,t,r);this.cone.position.y=e;this.cone.updateMatrix()};e.ArrowHelper.prototype.setColor=function(e){this.line.material.color.set(e);this.cone.material.color.set(e)};e.BoxHelper=function(t){var r=new e.BufferGeometry;r.addAttribute("position",new e.BufferAttribute(new Float32Array(72),3));e.Line.call(this,r,new e.LineBasicMaterial({color:16776960}),e.LinePieces);if(t!==undefined){this.update(t)}};e.BoxHelper.prototype=Object.create(e.Line.prototype);e.BoxHelper.prototype.constructor=e.BoxHelper;e.BoxHelper.prototype.update=function(e){var t=e.geometry;if(t.boundingBox===null){t.computeBoundingBox()}var r=t.boundingBox.min;var n=t.boundingBox.max;var i=this.geometry.attributes.position.array;i[0]=n.x;i[1]=n.y;i[2]=n.z;i[3]=r.x;i[4]=n.y;i[5]=n.z;i[6]=r.x;i[7]=n.y;i[8]=n.z;i[9]=r.x;i[10]=r.y;i[11]=n.z;i[12]=r.x;i[13]=r.y;i[14]=n.z;i[15]=n.x;i[16]=r.y;i[17]=n.z;i[18]=n.x;i[19]=r.y;i[20]=n.z;i[21]=n.x;i[22]=n.y;i[23]=n.z;i[24]=n.x;i[25]=n.y;i[26]=r.z;i[27]=r.x;i[28]=n.y;i[29]=r.z;i[30]=r.x;i[31]=n.y;i[32]=r.z;i[33]=r.x;i[34]=r.y;i[35]=r.z;i[36]=r.x;i[37]=r.y;i[38]=r.z;i[39]=n.x;i[40]=r.y;i[41]=r.z;i[42]=n.x;i[43]=r.y;i[44]=r.z;i[45]=n.x;i[46]=n.y;i[47]=r.z;i[48]=n.x;i[49]=n.y;i[50]=n.z;i[51]=n.x;i[52]=n.y;i[53]=r.z;i[54]=r.x;i[55]=n.y;i[56]=n.z;i[57]=r.x;i[58]=n.y;i[59]=r.z;i[60]=r.x;i[61]=r.y;i[62]=n.z;i[63]=r.x;i[64]=r.y;i[65]=r.z;i[66]=n.x;i[67]=r.y;i[68]=n.z;i[69]=n.x;i[70]=r.y;i[71]=r.z;this.geometry.attributes.position.needsUpdate=true;this.geometry.computeBoundingSphere();this.matrix=e.matrixWorld;this.matrixAutoUpdate=false};e.BoundingBoxHelper=function(t,r){var n=r!==undefined?r:8947848;this.object=t;this.box=new e.Box3;e.Mesh.call(this,new e.BoxGeometry(1,1,1),new e.MeshBasicMaterial({color:n,wireframe:true}))};e.BoundingBoxHelper.prototype=Object.create(e.Mesh.prototype);e.BoundingBoxHelper.prototype.constructor=e.BoundingBoxHelper;e.BoundingBoxHelper.prototype.update=function(){this.box.setFromObject(this.object);this.box.size(this.scale);this.box.center(this.position)};e.CameraHelper=function(t){var r=new e.Geometry;var n=new e.LineBasicMaterial({color:16777215,vertexColors:e.FaceColors});var i={};var a=16755200;var o=16711680;var s=43775;var u=16777215;var l=3355443;c("n1","n2",a);c("n2","n4",a);c("n4","n3",a);c("n3","n1",a);c("f1","f2",a);c("f2","f4",a);c("f4","f3",a);c("f3","f1",a);c("n1","f1",a);c("n2","f2",a);c("n3","f3",a);c("n4","f4",a);c("p","n1",o);c("p","n2",o);c("p","n3",o);c("p","n4",o);c("u1","u2",s);c("u2","u3",s);c("u3","u1",s);c("c","t",u);c("p","c",l);c("cn1","cn2",l);c("cn3","cn4",l);c("cf1","cf2",l);c("cf3","cf4",l);function c(e,t,r){f(e,r);f(t,r)}function f(t,n){r.vertices.push(new e.Vector3);r.colors.push(new e.Color(n));if(i[t]===undefined){i[t]=[]}i[t].push(r.vertices.length-1)}e.Line.call(this,r,n,e.LinePieces);this.camera=t;this.matrix=t.matrixWorld;this.matrixAutoUpdate=false;this.pointMap=i;this.update()};e.CameraHelper.prototype=Object.create(e.Line.prototype);e.CameraHelper.prototype.constructor=e.CameraHelper;e.CameraHelper.prototype.update=function(){var t,r;var n=new e.Vector3;var i=new e.Camera;var a=function(e,a,o,s){n.set(a,o,s).unproject(i);var u=r[e];if(u!==undefined){for(var l=0,c=u.length;l<c;l++){t.vertices[u[l]].copy(n)}}};return function(){t=this.geometry;r=this.pointMap;var e=1,n=1;i.projectionMatrix.copy(this.camera.projectionMatrix);a("c",0,0,-1);a("t",0,0,1);a("n1",-e,-n,-1);a("n2",e,-n,-1);a("n3",-e,n,-1);a("n4",e,n,-1);a("f1",-e,-n,1);a("f2",e,-n,1);a("f3",-e,n,1);a("f4",e,n,1);a("u1",e*.7,n*1.1,-1);a("u2",-e*.7,n*1.1,-1);a("u3",0,n*2,-1);
119a("cf1",-e,0,1);a("cf2",e,0,1);a("cf3",0,-n,1);a("cf4",0,n,1);a("cn1",-e,0,-1);a("cn2",e,0,-1);a("cn3",0,-n,-1);a("cn4",0,n,-1);t.verticesNeedUpdate=true}}();e.DirectionalLightHelper=function(t,r){e.Object3D.call(this);this.light=t;this.light.updateMatrixWorld();this.matrix=t.matrixWorld;this.matrixAutoUpdate=false;r=r||1;var n=new e.Geometry;n.vertices.push(new e.Vector3(-r,r,0),new e.Vector3(r,r,0),new e.Vector3(r,-r,0),new e.Vector3(-r,-r,0),new e.Vector3(-r,r,0));var i=new e.LineBasicMaterial({fog:false});i.color.copy(this.light.color).multiplyScalar(this.light.intensity);this.lightPlane=new e.Line(n,i);this.add(this.lightPlane);n=new e.Geometry;n.vertices.push(new e.Vector3,new e.Vector3);i=new e.LineBasicMaterial({fog:false});i.color.copy(this.light.color).multiplyScalar(this.light.intensity);this.targetLine=new e.Line(n,i);this.add(this.targetLine);this.update() 120};e.DirectionalLightHelper.prototype=Object.create(e.Object3D.prototype);e.DirectionalLightHelper.prototype.constructor=e.DirectionalLightHelper;e.DirectionalLightHelper.prototype.dispose=function(){this.lightPlane.geometry.dispose();this.lightPlane.material.dispose();this.targetLine.geometry.dispose();this.targetLine.material.dispose()};e.DirectionalLightHelper.prototype.update=function(){var t=new e.Vector3;var r=new e.Vector3;var n=new e.Vector3;return function(){t.setFromMatrixPosition(this.light.matrixWorld);r.setFromMatrixPosition(this.light.target.matrixWorld);n.subVectors(r,t);this.lightPlane.lookAt(n);this.lightPlane.material.color.copy(this.light.color).multiplyScalar(this.light.intensity);
120this.targetLine.geometry.vertices[1].copy(n);this.targetLine.geometry.verticesNeedUpdate=true;this.targetLine.material.color.copy(this.lightPlane.material.color)}}();e.EdgesHelper=function(t,r,n){var i=r!==undefined?r:16777215;n=n!==undefined?n:1;var a=Math.cos(e.Math.degToRad(n));var o=[0,0],s={};var u=function(e,t){return e-t};var l=["a","b","c"];var c=new e.BufferGeometry;var f;if(t.geometry instanceof e.BufferGeometry){f=new e.Geometry;f.fromBufferGeometry(t.geometry)}else{f=t.geometry.clone()}f.mergeVertices();f.computeFaceNormals();var h=f.vertices;var d=f.faces;var p=0;for(var m=0,v=d.length;m<v;m++){var y=d[m];for(var g=0;g<3;g++){o[0]=y[l[g]];o[1]=y[l[(g+1)%3]];o.sort(u);var b=o.toString();if(s[b]===undefined){s[b]={vert1:o[0],vert2:o[1],face1:m,face2:undefined};p++}else{s[b].face2=m}}}var x=new Float32Array(p*2*3);var _=0;for(var b in s){var w=s[b];if(w.face2===undefined||d[w.face1].normal.dot(d[w.face2].normal)<=a){var C=h[w.vert1];x[_++]=C.x;x[_++]=C.y;x[_++]=C.z;C=h[w.vert2];x[_++]=C.x;x[_++]=C.y;x[_++]=C.z}}c.addAttribute("position",new e.BufferAttribute(x,3));e.Line.call(this,c,new e.LineBasicMaterial({color:i}),e.LinePieces);this.matrix=t.matrixWorld;this.matrixAutoUpdate=false};e.EdgesHelper.prototype=Object.create(e.Line.prototype);e.EdgesHelper.prototype.constructor=e.EdgesHelper;e.FaceNormalsHelper=function(t,r,n,i){this.object=t;this.size=r!==undefined?r:1;var a=n!==undefined?n:16776960;var o=i!==undefined?i:1;var s=new e.Geometry;var u=this.object.geometry.faces;for(var l=0,c=u.length;l<c;l++){s.vertices.push(new e.Vector3,new e.Vector3)}e.Line.call(this,s,new e.LineBasicMaterial({color:a,linewidth:o}),e.LinePieces);this.matrixAutoUpdate=false;
120this.normalMatrix=new e.Matrix3;this.update()};e.FaceNormalsHelper.prototype=Object.create(e.Line.prototype);e.FaceNormalsHelper.prototype.constructor=e.FaceNormalsHelper;e.FaceNormalsHelper.prototype.update=function(){var e=this.geometry.vertices;var t=this.object;var r=t.geometry.vertices;var n=t.geometry.faces;var i=t.matrixWorld;t.updateMatrixWorld(true);this.normalMatrix.getNormalMatrix(i);for(var a=0,o=0,s=n.length;a<s;a++,o+=2){var u=n[a];e[o].copy(r[u.a]).add(r[u.b]).add(r[u.c]).divideScalar(3).applyMatrix4(i);e[o+1].copy(u.normal).applyMatrix3(this.normalMatrix).normalize().multiplyScalar(this.size).add(e[o])}this.geometry.verticesNeedUpdate=true;return this};e.GridHelper=function(t,r){var n=new e.Geometry;var i=new e.LineBasicMaterial({vertexColors:e.VertexColors});this.color1=new e.Color(4473924);this.color2=new e.Color(8947848);for(var a=-t;a<=t;a+=r){n.vertices.push(new e.Vector3(-t,0,a),new e.Vector3(t,0,a),new e.Vector3(a,0,-t),new e.Vector3(a,0,t));var o=a===0?this.color1:this.color2;n.colors.push(o,o,o,o)}e.Line.call(this,n,i,e.LinePieces)};e.GridHelper.prototype=Object.create(e.Line.prototype);e.GridHelper.prototype.constructor=e.GridHelper;e.GridHelper.prototype.setColors=function(e,t){this.color1.set(e);this.color2.set(t);this.geometry.colorsNeedUpdate=true};e.HemisphereLightHelper=function(t,r){e.Object3D.call(this);this.light=t;this.light.updateMatrixWorld();this.matrix=t.matrixWorld;this.matrixAutoUpdate=false;this.colors=[new e.Color,new e.Color];var n=new e.SphereGeometry(r,4,2);
120n.applyMatrix((new e.Matrix4).makeRotationX(-Math.PI/2));for(var i=0,a=8;i<a;i++){n.faces[i].color=this.colors[i<4?0:1]}var o=new e.MeshBasicMaterial({vertexColors:e.FaceColors,wireframe:true});this.lightSphere=new e.Mesh(n,o);this.add(this.lightSphere);this.update()};e.HemisphereLightHelper.prototype=Object.create(e.Object3D.prototype);e.HemisphereLightHelper.prototype.constructor=e.HemisphereLightHelper;e.HemisphereLightHelper.prototype.dispose=function(){this.lightSphere.geometry.dispose();this.lightSphere.material.dispose()};e.HemisphereLightHelper.prototype.update=function(){var t=new e.Vector3;return function(){this.colors[0].copy(this.light.color).multiplyScalar(this.light.intensity);this.colors[1].copy(this.light.groundColor).multiplyScalar(this.light.intensity);this.lightSphere.lookAt(t.setFromMatrixPosition(this.light.matrixWorld).negate());this.lightSphere.geometry.colorsNeedUpdate=true}}();e.PointLightHelper=function(t,r){this.light=t;this.light.updateMatrixWorld();var n=new e.SphereGeometry(r,4,2);var i=new e.MeshBasicMaterial({wireframe:true,fog:false});i.color.copy(this.light.color).multiplyScalar(this.light.intensity);e.Mesh.call(this,n,i);this.matrix=this.light.matrixWorld;this.matrixAutoUpdate=false};e.PointLightHelper.prototype=Object.create(e.Mesh.prototype);e.PointLightHelper.prototype.constructor=e.PointLightHelper;e.PointLightHelper.prototype.dispose=function(){this.geometry.dispose();this.material.dispose()};e.PointLightHelper.prototype.update=function(){this.material.color.copy(this.light.color).multiplyScalar(this.light.intensity)};e.SkeletonHelper=function(t){this.bones=this.getBoneList(t);var r=new e.Geometry;for(var n=0;n<this.bones.length;n++){var i=this.bones[n];if(i.parent instanceof e.Bone){r.vertices.push(new e.Vector3);r.vertices.push(new e.Vector3);r.colors.push(new e.Color(0,0,1));r.colors.push(new e.Color(0,1,0))}}var a=new e.LineBasicMaterial({vertexColors:e.VertexColors,depthTest:false,depthWrite:false,transparent:true});e.Line.call(this,r,a,e.LinePieces);this.root=t;this.matrix=t.matrixWorld;this.matrixAutoUpdate=false;this.update()};e.SkeletonHelper.prototype=Object.create(e.Line.prototype);e.SkeletonHelper.prototype.constructor=e.SkeletonHelper;e.SkeletonHelper.prototype.getBoneList=function(t){var r=[];if(t instanceof e.Bone){r.push(t)}for(var n=0;n<t.children.length;n++){r.push.apply(r,this.getBoneList(t.children[n]))}return r};e.SkeletonHelper.prototype.update=function(){var t=this.geometry;var r=(new e.Matrix4).getInverse(this.root.matrixWorld);
120var n=new e.Matrix4;var i=0;for(var a=0;a<this.bones.length;a++){var o=this.bones[a];if(o.parent instanceof e.Bone){n.multiplyMatrices(r,o.matrixWorld);t.vertices[i].setFromMatrixPosition(n);n.multiplyMatrices(r,o.parent.matrixWorld);t.vertices[i+1].setFromMatrixPosition(n);i+=2}}t.verticesNeedUpdate=true;t.computeBoundingSphere()};e.SpotLightHelper=function(t){e.Object3D.call(this);this.light=t;this.light.updateMatrixWorld();this.matrix=t.matrixWorld;this.matrixAutoUpdate=false;var r=new e.CylinderGeometry(0,1,1,8,1,true);r.applyMatrix((new e.Matrix4).makeTranslation(0,-.5,0));r.applyMatrix((new e.Matrix4).makeRotationX(-Math.PI/2));var n=new e.MeshBasicMaterial({wireframe:true,fog:false});this.cone=new e.Mesh(r,n);this.add(this.cone);this.update()};e.SpotLightHelper.prototype=Object.create(e.Object3D.prototype);e.SpotLightHelper.prototype.constructor=e.SpotLightHelper;e.SpotLightHelper.prototype.dispose=function(){this.cone.geometry.dispose();this.cone.material.dispose()};e.SpotLightHelper.prototype.update=function(){var t=new e.Vector3;var r=new e.Vector3;return function(){var e=this.light.distance?this.light.distance:1e4;var n=e*Math.tan(this.light.angle);this.cone.scale.set(n,n,e);t.setFromMatrixPosition(this.light.matrixWorld);r.setFromMatrixPosition(this.light.target.matrixWorld);this.cone.lookAt(r.sub(t));this.cone.material.color.copy(this.light.color).multiplyScalar(this.light.intensity)}}();e.VertexNormalsHelper=function(t,r,n,i){this.object=t;this.size=r!==undefined?r:1;var a=n!==undefined?n:16711680;var o=i!==undefined?i:1;var s=new e.Geometry;var u=t.geometry.faces;for(var l=0,c=u.length;l<c;l++){var f=u[l];for(var h=0,d=f.vertexNormals.length;h<d;h++){s.vertices.push(new e.Vector3,new e.Vector3)}}e.Line.call(this,s,new e.LineBasicMaterial({color:a,linewidth:o}),e.LinePieces);this.matrixAutoUpdate=false;
120this.normalMatrix=new e.Matrix3;this.update()};e.VertexNormalsHelper.prototype=Object.create(e.Line.prototype);e.VertexNormalsHelper.prototype.constructor=e.VertexNormalsHelper;e.VertexNormalsHelper.prototype.update=function(t){var r=new e.Vector3;return function(e){var t=["a","b","c","d"];this.object.updateMatrixWorld(true);this.normalMatrix.getNormalMatrix(this.object.matrixWorld);var n=this.geometry.vertices;var i=this.object.geometry.vertices;var a=this.object.geometry.faces;var o=this.object.matrixWorld;var s=0;for(var u=0,l=a.length;u<l;u++){var c=a[u];for(var f=0,h=c.vertexNormals.length;f<h;f++){var d=c[t[f]];var p=i[d];var m=c.vertexNormals[f];n[s].copy(p).applyMatrix4(o);r.copy(m).applyMatrix3(this.normalMatrix).normalize().multiplyScalar(this.size);r.add(n[s]);s=s+1;n[s].copy(r);s=s+1}}this.geometry.verticesNeedUpdate=true;return this}}();e.VertexTangentsHelper=function(t,r,n,i){this.object=t;this.size=r!==undefined?r:1;var a=n!==undefined?n:255;var o=i!==undefined?i:1;var s=new e.Geometry;var u=t.geometry.faces;for(var l=0,c=u.length;l<c;l++){var f=u[l];for(var h=0,d=f.vertexTangents.length;h<d;h++){s.vertices.push(new e.Vector3);s.vertices.push(new e.Vector3)}}e.Line.call(this,s,new e.LineBasicMaterial({color:a,linewidth:o}),e.LinePieces);this.matrixAutoUpdate=false;this.update()};e.VertexTangentsHelper.prototype=Object.create(e.Line.prototype);e.VertexTangentsHelper.prototype.constructor=e.VertexTangentsHelper;e.VertexTangentsHelper.prototype.update=function(t){var r=new e.Vector3;return function(e){var t=["a","b","c","d"];this.object.updateMatrixWorld(true);var n=this.geometry.vertices;var i=this.object.geometry.vertices;var a=this.object.geometry.faces;var o=this.object.matrixWorld;var s=0;for(var u=0,l=a.length;u<l;u++){var c=a[u];for(var f=0,h=c.vertexTangents.length;f<h;f++){var d=c[t[f]];var p=i[d];var m=c.vertexTangents[f];n[s].copy(p).applyMatrix4(o);r.copy(m).transformDirection(o).multiplyScalar(this.size);r.add(n[s]);s=s+1;n[s].copy(r);s=s+1}}this.geometry.verticesNeedUpdate=true;return this}}();e.WireframeHelper=function(t,r){var n=r!==undefined?r:16777215;var i=[0,0],a={};var o=function(e,t){return e-t};var s=["a","b","c"];var u=new e.BufferGeometry;if(t.geometry instanceof e.Geometry){var l=t.geometry.vertices;var c=t.geometry.faces;var f=0;var h=new Uint32Array(6*c.length);for(var d=0,p=c.length;d<p;d++){var m=c[d];for(var v=0;v<3;v++){i[0]=m[s[v]];i[1]=m[s[(v+1)%3]];i.sort(o);var y=i.toString();if(a[y]===undefined){h[2*f]=i[0];h[2*f+1]=i[1];a[y]=true;f++}}}var g=new Float32Array(f*2*3);for(var d=0,p=f;d<p;d++){for(var v=0;v<2;v++){var b=l[h[2*d+v]];var x=6*d+3*v;g[x+0]=b.x;g[x+1]=b.y;g[x+2]=b.z}}u.addAttribute("position",new e.BufferAttribute(g,3))}else if(t.geometry instanceof e.BufferGeometry){if(t.geometry.attributes.index!==undefined){var l=t.geometry.attributes.position.array;var _=t.geometry.attributes.index.array;var w=t.geometry.drawcalls;var f=0;if(w.length===0){w=[{count:_.length,index:0,start:0}]}var h=new Uint32Array(2*_.length);for(var C=0,E=w.length;C<E;++C){var S=w[C].start;var T=w[C].count;var x=w[C].index;for(var d=S,M=S+T;d<M;d+=3){for(var v=0;v<3;v++){i[0]=x+_[d+v];i[1]=x+_[d+(v+1)%3];i.sort(o);var y=i.toString();if(a[y]===undefined){h[2*f]=i[0];h[2*f+1]=i[1];a[y]=true;f++}}}}var g=new Float32Array(f*2*3);for(var d=0,p=f;d<p;d++){for(var v=0;v<2;v++){var x=6*d+3*v;var A=3*h[2*d+v];g[x+0]=l[A];g[x+1]=l[A+1];g[x+2]=l[A+2]}}u.addAttribute("position",new e.BufferAttribute(g,3))}else{var l=t.geometry.attributes.position.array;var f=l.length/3;var P=f/3;var g=new Float32Array(f*2*3);for(var d=0,p=P;d<p;d++){for(var v=0;v<3;v++){var x=18*d+6*v;var R=9*d+3*v;g[x+0]=l[R];g[x+1]=l[R+1];g[x+2]=l[R+2];var A=9*d+3*((v+1)%3);g[x+3]=l[A];g[x+4]=l[A+1];g[x+5]=l[A+2]}}u.addAttribute("position",new e.BufferAttribute(g,3))}}e.Line.call(this,u,new e.LineBasicMaterial({color:n}),e.LinePieces);this.matrix=t.matrixWorld;this.matrixAutoUpdate=false};e.WireframeHelper.prototype=Object.create(e.Line.prototype);e.WireframeHelper.prototype.constructor=e.WireframeHelper;e.ImmediateRenderObject=function(){e.Object3D.call(this);this.render=function(e){}};e.ImmediateRenderObject.prototype=Object.create(e.Object3D.prototype);e.ImmediateRenderObject.prototype.constructor=e.ImmediateRenderObject;e.MorphBlendMesh=function(t,r){e.Mesh.call(this,t,r);this.animationsMap={};this.animationsList=[];var n=this.geometry.morphTargets.length;var i="__default";var a=0;var o=n-1;var s=n/1;this.createAnimation(i,a,o,s);this.setAnimationWeight(i,1)};e.MorphBlendMesh.prototype=Object.create(e.Mesh.prototype);e.MorphBlendMesh.prototype.constructor=e.MorphBlendMesh;e.MorphBlendMesh.prototype.createAnimation=function(e,t,r,n){var i={startFrame:t,endFrame:r,length:r-t+1,fps:n,duration:(r-t)/n,lastFrame:0,currentFrame:0,active:false,time:0,direction:1,weight:1,directionBackwards:false,mirroredLoop:false};this.animationsMap[e]=i;this.animationsList.push(i)};e.MorphBlendMesh.prototype.autoCreateAnimations=function(e){var t=/([a-z]+)_?(\d+)/;var r,n={};var i=this.geometry;for(var a=0,o=i.morphTargets.length;a<o;a++){var s=i.morphTargets[a];var u=s.name.match(t);if(u&&u.length>1){var l=u[1];if(!n[l])n[l]={start:Infinity,end:-Infinity};var c=n[l];if(a<c.start)c.start=a;if(a>c.end)c.end=a;if(!r)r=l}}for(var l in n){var c=n[l];this.createAnimation(l,c.start,c.end,e)}this.firstAnimation=r};e.MorphBlendMesh.prototype.setAnimationDirectionForward=function(e){var t=this.animationsMap[e];if(t){t.direction=1;t.directionBackwards=false}};e.MorphBlendMesh.prototype.setAnimationDirectionBackward=function(e){var t=this.animationsMap[e];if(t){t.direction=-1;t.directionBackwards=true}};e.MorphBlendMesh.prototype.setAnimationFPS=function(e,t){var r=this.animationsMap[e];if(r){r.fps=t;r.duration=(r.end-r.start)/r.fps}};e.MorphBlendMesh.prototype.setAnimationDuration=function(e,t){var r=this.animationsMap[e];if(r){r.duration=t;r.fps=(r.end-r.start)/r.duration}};e.MorphBlendMesh.prototype.setAnimationWeight=function(e,t){var r=this.animationsMap[e];if(r){r.weight=t}};e.MorphBlendMesh.prototype.setAnimationTime=function(e,t){var r=this.animationsMap[e];if(r){r.time=t}};e.MorphBlendMesh.prototype.getAnimationTime=function(e){var t=0;var r=this.animationsMap[e];if(r){t=r.time}return t};e.MorphBlendMesh.prototype.getAnimationDuration=function(e){var t=-1;var r=this.animationsMap[e];if(r){t=r.duration}return t};e.MorphBlendMesh.prototype.playAnimation=function(t){var r=this.animationsMap[t];if(r){r.time=0;r.active=true}else{e.warn("THREE.MorphBlendMesh: animation["+t+"] undefined in .playAnimation()")}};e.MorphBlendMesh.prototype.stopAnimation=function(e){var t=this.animationsMap[e];if(t){t.active=false}};e.MorphBlendMesh.prototype.update=function(t){for(var r=0,n=this.animationsList.length;r<n;r++){var i=this.animationsList[r];if(!i.active)continue;var a=i.duration/i.length;i.time+=i.direction*t;
120if(i.mirroredLoop){if(i.time>i.duration||i.time<0){i.direction*=-1;if(i.time>i.duration){i.time=i.duration;i.directionBackwards=true}if(i.time<0){i.time=0;i.directionBackwards=false}}}else{i.time=i.time%i.duration;if(i.time<0)i.time+=i.duration}var o=i.startFrame+e.Math.clamp(Math.floor(i.time/a),0,i.length-1);var s=i.weight;if(o!==i.currentFrame){this.morphTargetInfluences[i.lastFrame]=0;this.morphTargetInfluences[i.currentFrame]=1*s;this.morphTargetInfluences[o]=0;i.lastFrame=i.currentFrame;i.currentFrame=o}var u=i.time%a/a;if(i.directionBackwards)u=1-u;this.morphTargetInfluences[i.currentFrame]=u*s;this.morphTargetInfluences[i.lastFrame]=(1-u)*s}};(function(){var e=0;var t=/MSIE (\d+\.\d+);/.test(navigator.userAgent);var r=!!navigator.userAgent.match(/Trident\/7.0/);var n=navigator.userAgent.indexOf("rv:11.0");if(t)e=new Number(RegExp.$1);if(navigator.appVersion.indexOf("MSIE 10")!=-1)e=10;if(r&&n!=-1)e=11;if(e>0){HTMLElement.prototype.getBoundingClientRect=function(){var e=HTMLElement.prototype.getBoundingClientRect;return function(){try{return e.apply(this,arguments)}catch(e){return{left:"",right:"",top:"",bottom:""}}}}()}})();return e}();/** 121 * Copyright (c) 2014-2015, Facebook, Inc. 122 * All rights reserved. 123 * 124 * This source code is licensed under the BSD-style license found in the 125 * LICENSE file in the root directory of this source tree. An additional grant 126 * of patent rights can be found in the PATENTS file in the same directory. 127 */ 128/* 129 130BSD License 131 132For Immutable JS software 133 134Copyright (c) 2014-2015, Facebook, Inc. All rights reserved. 135 136Redistribution and use in source and binary forms, with or without modification, 137are permitted provided that the following conditions are met: 138 139 * Redistributions of source code must retain the above copyright notice, this 140 list of conditions and the following disclaimer. 141 142 * Redistributions in binary form must reproduce the above copyright notice, 143 this list of conditions and the following disclaimer in the documentation 144 and/or other materials provided with the distribution. 145 146 * Neither the name Facebook nor the names of its contributors may be used to 147 endorse or promote products derived from this software without specific 148 prior written permission. 149 150THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 151ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 152WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 153DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR 154ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 155(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 156LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 157ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 158(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 159SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 160 161*/ 162var u;(function(e,t){u=t()})({},function(){"use strict";var e=Array.prototype.slice;function t(e,t){if(t){e.prototype=Object.create(t.prototype)}e.prototype.constructor=e}function r(e){return o(e)?e:X(e)}t(n,r);function n(e){return s(e)?e:Y(e)}t(i,r);function i(e){return u(e)?e:K(e)}t(a,r);function a(e){return o(e)&&!l(e)?e:Q(e)}function o(e){return!!(e&&e[f])}function s(e){return!!(e&&e[h])}function u(e){return!!(e&&e[d])}function l(e){return s(e)||u(e)}function c(e){return!!(e&&e[p])}r.isIterable=o;r.isKeyed=s;r.isIndexed=u;r.isAssociative=l;r.isOrdered=c;r.Keyed=n;r.Indexed=i;r.Set=a;var f="@@__IMMUTABLE_ITERABLE__@@";var h="@@__IMMUTABLE_KEYED__@@";var d="@@__IMMUTABLE_INDEXED__@@";var p="@@__IMMUTABLE_ORDERED__@@";var m="delete";var v=5;var y=1<<v;var g=y-1;var b={};var x={value:false};var _={value:false};function w(e){e.value=false;return e}function C(e){e&&(e.value=true)}function E(){}function S(e,t){t=t||0;var r=Math.max(0,e.length-t);var n=new Array(r);for(var i=0;i<r;i++){n[i]=e[i+t]}return n}function T(e){if(e.size===undefined){e.size=e.__iterate(A)}return e.size}function M(e,t){if(typeof t!=="number"){var r=t>>>0;if(""+r!==t||r===4294967295){return NaN}t=r}return t<0?T(e)+t:t}function A(){return true}function P(e,t,r){return(e===0||r!==undefined&&e<=-r)&&(t===undefined||r!==undefined&&t>=r)}function R(e,t){return I(e,t,0)}function k(e,t){return I(e,t,t)}function I(e,t,r){return e===undefined?r:e<0?Math.max(0,t+e):t===undefined?e:Math.min(t,e)}var D=0;var B=1;var L=2;var F=typeof Symbol==="function"&&Symbol.iterator;var V="@@iterator";var O=F||V;function U(e){this.next=e}U.prototype.toString=function(){return"[Iterator]"};U.KEYS=D;U.VALUES=B;U.ENTRIES=L;U.prototype.inspect=U.prototype.toSource=function(){return this.toString()};U.prototype[O]=function(){return this};function N(e,t,r,n){var i=e===0?t:e===1?r:[t,r];n?n.value=i:n={value:i,done:false};return n}function z(){return{value:undefined,done:true}}function H(e){return!!W(e)}function j(e){return e&&typeof e.next==="function"}function G(e){var t=W(e);return t&&t.call(e)}function W(e){var t=e&&(F&&e[F]||e[V]);if(typeof t==="function"){return t}}function q(e){return e&&typeof e.length==="number"}t(X,r);function X(e){return e===null||e===undefined?ie():o(e)?e.toSeq():se(e)}X.of=function(){return X(arguments)};X.prototype.toSeq=function(){return this};X.prototype.toString=function(){return this.__toString("Seq {","}")};X.prototype.cacheResult=function(){if(!this._cache&&this.__iterateUncached){this._cache=this.entrySeq().toArray();this.size=this._cache.length}return this};X.prototype.__iterate=function(e,t){return le(this,e,t,true)};X.prototype.__iterator=function(e,t){return ce(this,e,t,true)};t(Y,X);function Y(e){return e===null||e===undefined?ie().toKeyedSeq():o(e)?s(e)?e.toSeq():e.fromEntrySeq():ae(e)}Y.prototype.toKeyedSeq=function(){return this};t(K,X);function K(e){return e===null||e===undefined?ie():!o(e)?oe(e):s(e)?e.entrySeq():e.toIndexedSeq()}K.of=function(){return K(arguments)};K.prototype.toIndexedSeq=function(){return this};K.prototype.toString=function(){return this.__toString("Seq [","]")};K.prototype.__iterate=function(e,t){return le(this,e,t,false)};K.prototype.__iterator=function(e,t){return ce(this,e,t,false)};t(Q,X);function Q(e){return(e===null||e===undefined?ie():!o(e)?oe(e):s(e)?e.entrySeq():e).toSetSeq()}Q.of=function(){return Q(arguments)};Q.prototype.toSetSeq=function(){return this};X.isSeq=re;X.Keyed=Y;X.Set=Q;X.Indexed=K;var Z="@@__IMMUTABLE_SEQ__@@";X.prototype[Z]=true;t(J,K);function J(e){this._array=e;this.size=e.length}J.prototype.get=function(e,t){return this.has(e)?this._array[M(this,e)]:t};J.prototype.__iterate=function(e,t){var r=this._array;var n=r.length-1;for(var i=0;i<=n;i++){if(e(r[t?n-i:i],i,this)===false){return i+1}}return i};J.prototype.__iterator=function(e,t){var r=this._array;var n=r.length-1;var i=0;return new U(function(){return i>n?z():N(e,i,r[t?n-i++:i++])})};t($,Y);function $(e){var t=Object.keys(e);this._object=e;this._keys=t;this.size=t.length}$.prototype.get=function(e,t){if(t!==undefined&&!this.has(e)){return t}return this._object[e]};$.prototype.has=function(e){return this._object.hasOwnProperty(e)};$.prototype.__iterate=function(e,t){var r=this._object;var n=this._keys;var i=n.length-1;for(var a=0;a<=i;a++){var o=n[t?i-a:a];if(e(r[o],o,this)===false){return a+1}}return a};$.prototype.__iterator=function(e,t){var r=this._object;var n=this._keys;var i=n.length-1;var a=0;return new U(function(){var o=n[t?i-a:a];return a++>i?z():N(e,o,r[o])})};$.prototype[p]=true;t(ee,K);function ee(e){this._iterable=e;this.size=e.length||e.size}ee.prototype.__iterateUncached=function(e,t){if(t){return this.cacheResult().__iterate(e,t)}var r=this._iterable;var n=G(r);var i=0;if(j(n)){var a;while(!(a=n.next()).done){if(e(a.value,i++,this)===false){break}}}return i};ee.prototype.__iteratorUncached=function(e,t){if(t){return this.cacheResult().__iterator(e,t)}var r=this._iterable;var n=G(r);if(!j(n)){return new U(z)}var i=0;return new U(function(){var t=n.next();return t.done?t:N(e,i++,t.value)})};t(te,K);function te(e){this._iterator=e;this._iteratorCache=[]}te.prototype.__iterateUncached=function(e,t){if(t){return this.cacheResult().__iterate(e,t)}var r=this._iterator;var n=this._iteratorCache;var i=0;while(i<n.length){if(e(n[i],i++,this)===false){return i}}var a;
162while(!(a=r.next()).done){var o=a.value;n[i]=o;if(e(o,i++,this)===false){break}}return i};te.prototype.__iteratorUncached=function(e,t){if(t){return this.cacheResult().__iterator(e,t)}var r=this._iterator;var n=this._iteratorCache;var i=0;return new U(function(){if(i>=n.length){var t=r.next();if(t.done){return t}n[i]=t.value}return N(e,i,n[i++])})};function re(e){return!!(e&&e[Z])}var ne;function ie(){return ne||(ne=new J([]))}function ae(e){var t=Array.isArray(e)?new J(e).fromEntrySeq():j(e)?new te(e).fromEntrySeq():H(e)?new ee(e).fromEntrySeq():typeof e==="object"?new $(e):undefined;if(!t){throw new TypeError("Expected Array or iterable object of [k, v] entries, "+"or keyed object: "+e)}return t}function oe(e){var t=ue(e);if(!t){throw new TypeError("Expected Array or iterable object of values: "+e)}return t}function se(e){var t=ue(e)||typeof e==="object"&&new $(e);if(!t){throw new TypeError("Expected Array or iterable object of values, or keyed object: "+e)}return t}function ue(e){return q(e)?new J(e):j(e)?new te(e):H(e)?new ee(e):undefined}function le(e,t,r,n){var i=e._cache;if(i){var a=i.length-1;for(var o=0;o<=a;o++){var s=i[r?a-o:o];if(t(s[1],n?s[0]:o,e)===false){return o+1}}return o}return e.__iterateUncached(t,r)}function ce(e,t,r,n){var i=e._cache;if(i){var a=i.length-1;var o=0;return new U(function(){var e=i[r?a-o:o];return o++>a?z():N(t,n?e[0]:o-1,e[1])})}return e.__iteratorUncached(t,r)}function fe(e,t){return t?he(t,e,"",{"":e}):de(e)}function he(e,t,r,n){if(Array.isArray(t)){return e.call(n,r,K(t).map(function(r,n){return he(e,r,n,t)}))}if(pe(t)){return e.call(n,r,Y(t).map(function(r,n){return he(e,r,n,t)}))}return t}function de(e){if(Array.isArray(e)){return K(e).map(de).toList()}if(pe(e)){return Y(e).map(de).toMap()}return e}function pe(e){return e&&(e.constructor===Object||e.constructor===undefined)}function me(e,t){if(e===t||e!==e&&t!==t){return true}if(!e||!t){return false}if(typeof e.valueOf==="function"&&typeof t.valueOf==="function"){e=e.valueOf();t=t.valueOf();if(e===t||e!==e&&t!==t){return true}if(!e||!t){return false}}if(typeof e.equals==="function"&&typeof t.equals==="function"&&e.equals(t)){return true}return false}function ve(e,t){if(e===t){return true}if(!o(t)||e.size!==undefined&&t.size!==undefined&&e.size!==t.size||e.__hash!==undefined&&t.__hash!==undefined&&e.__hash!==t.__hash||s(e)!==s(t)||u(e)!==u(t)||c(e)!==c(t)){return false}if(e.size===0&&t.size===0){return true}var r=!l(e);if(c(e)){var n=e.entries();return t.every(function(e,t){var i=n.next().value;return i&&me(i[1],e)&&(r||me(i[0],t))})&&n.next().done}var i=false;if(e.size===undefined){if(t.size===undefined){if(typeof e.cacheResult==="function"){e.cacheResult()}}else{i=true;var a=e;e=t;t=a}}var f=true;var h=t.__iterate(function(t,n){if(r?!e.has(t):i?!me(t,e.get(n,b)):!me(e.get(n,b),t)){f=false;return false}});return f&&e.size===h}t(ye,K);function ye(e,t){if(!(this instanceof ye)){return new ye(e,t)}this._value=e;this.size=t===undefined?Infinity:Math.max(0,t);if(this.size===0){if(ge){return ge}ge=this}}ye.prototype.toString=function(){if(this.size===0){return"Repeat []"}return"Repeat [ "+this._value+" "+this.size+" times ]"};ye.prototype.get=function(e,t){return this.has(e)?this._value:t};ye.prototype.includes=function(e){return me(this._value,e)};ye.prototype.slice=function(e,t){var r=this.size;return P(e,t,r)?this:new ye(this._value,k(t,r)-R(e,r))};ye.prototype.reverse=function(){return this};ye.prototype.indexOf=function(e){if(me(this._value,e)){return 0}return-1};ye.prototype.lastIndexOf=function(e){if(me(this._value,e)){return this.size}return-1};ye.prototype.__iterate=function(e,t){for(var r=0;r<this.size;r++){if(e(this._value,r,this)===false){return r+1}}return r};ye.prototype.__iterator=function(e,t){var r=this;var n=0;return new U(function(){return n<r.size?N(e,n++,r._value):z()})};ye.prototype.equals=function(e){return e instanceof ye?me(this._value,e._value):ve(e)};var ge;function be(e,t){if(!e)throw new Error(t)}t(xe,K);function xe(e,t,r){if(!(this instanceof xe)){return new xe(e,t,r)}be(r!==0,"Cannot step a Range by 0");e=e||0;if(t===undefined){t=Infinity}r=r===undefined?1:Math.abs(r);if(t<e){r=-r}this._start=e;this._end=t;this._step=r;this.size=Math.max(0,Math.ceil((t-e)/r-1)+1);if(this.size===0){if(_e){return _e}_e=this}}xe.prototype.toString=function(){if(this.size===0){return"Range []"}return"Range [ "+this._start+"..."+this._end+(this._step!==1?" by "+this._step:"")+" ]"};xe.prototype.get=function(e,t){return this.has(e)?this._start+M(this,e)*this._step:t};xe.prototype.includes=function(e){var t=(e-this._start)/this._step;return t>=0&&t<this.size&&t===Math.floor(t)};xe.prototype.slice=function(e,t){if(P(e,t,this.size)){return this}e=R(e,this.size);t=k(t,this.size);if(t<=e){return new xe(0,0)}return new xe(this.get(e,this._end),this.get(t,this._end),this._step)};xe.prototype.indexOf=function(e){var t=e-this._start;if(t%this._step===0){var r=t/this._step;if(r>=0&&r<this.size){return r}}return-1};xe.prototype.lastIndexOf=function(e){return this.indexOf(e)};xe.prototype.__iterate=function(e,t){var r=this.size-1;var n=this._step;var i=t?this._start+r*n:this._start;for(var a=0;a<=r;a++){if(e(i,a,this)===false){return a+1}i+=t?-n:n}return a};xe.prototype.__iterator=function(e,t){var r=this.size-1;var n=this._step;var i=t?this._start+r*n:this._start;var a=0;return new U(function(){var o=i;i+=t?-n:n;return a>r?z():N(e,a++,o)})};xe.prototype.equals=function(e){return e instanceof xe?this._start===e._start&&this._end===e._end&&this._step===e._step:ve(this,e)};var _e;t(we,r);function we(){throw TypeError("Abstract")}t(Ce,we);function Ce(){}t(Ee,we);function Ee(){}t(Se,we);function Se(){}we.Keyed=Ce;we.Indexed=Ee;we.Set=Se;var Te=typeof Math.imul==="function"&&Math.imul(4294967295,2)===-2?Math.imul:function e(t,r){t=t|0;r=r|0;var n=t&65535;var i=r&65535;return n*i+((t>>>16)*i+n*(r>>>16)<<16>>>0)|0};function Me(e){return e>>>1&1073741824|e&3221225471}function Ae(e){if(e===false||e===null||e===undefined){return 0}if(typeof e.valueOf==="function"){e=e.valueOf();if(e===false||e===null||e===undefined){return 0}}if(e===true){return 1}var t=typeof e;if(t==="number"){var r=e|0;if(r!==e){r^=e*4294967295}while(e>4294967295){e/=4294967295;r^=e}return Me(r)}if(t==="string"){return e.length>Ue?Pe(e):Re(e)}if(typeof e.hashCode==="function"){return e.hashCode()}if(t==="object"){return ke(e)}if(typeof e.toString==="function"){return Re(e.toString())}throw new Error("Value type "+t+" cannot be hashed.")}function Pe(e){var t=He[e];if(t===undefined){t=Re(e);if(ze===Ne){ze=0;He={}}ze++;He[e]=t}return t}function Re(e){var t=0;for(var r=0;r<e.length;r++){t=31*t+e.charCodeAt(r)|0}return Me(t)}function ke(e){var t;if(Le){t=Fe.get(e);if(t!==undefined){return t}}t=e[Oe];if(t!==undefined){return t}if(!De){t=e.propertyIsEnumerable&&e.propertyIsEnumerable[Oe];if(t!==undefined){return t}t=Be(e);if(t!==undefined){return t}}t=++Ve;if(Ve&1073741824){Ve=0}if(Le){Fe.set(e,t)}else if(Ie!==undefined&&Ie(e)===false){throw new Error("Non-extensible objects are not allowed as keys.")}else if(De){Object.defineProperty(e,Oe,{enumerable:false,configurable:false,writable:false,value:t})}else if(e.propertyIsEnumerable!==undefined&&e.propertyIsEnumerable===e.constructor.prototype.propertyIsEnumerable){e.propertyIsEnumerable=function(){return this.constructor.prototype.propertyIsEnumerable.apply(this,arguments)};e.propertyIsEnumerable[Oe]=t}else if(e.nodeType!==undefined){e[Oe]=t}else{throw new Error("Unable to set a non-enumerable property on object.")}return t}var Ie=Object.isExtensible;var De=function(){try{Object.defineProperty({},"@",{});return true}catch(e){return false}}();function Be(e){if(e&&e.nodeType>0){switch(e.nodeType){case 1:return e.uniqueID;case 9:return e.documentElement&&e.documentElement.uniqueID}}}var Le=typeof WeakMap==="function";var Fe;if(Le){Fe=new WeakMap}var Ve=0;var Oe="__immutablehash__";if(typeof Symbol==="function"){Oe=Symbol(Oe)}var Ue=16;var Ne=255;var ze=0;var He={};function je(e){be(e!==Infinity,"Cannot perform this action with an infinite size.")}t(Ge,Ce);function Ge(e){return e===null||e===undefined?it():We(e)&&!c(e)?e:it().withMutations(function(t){var r=n(e);je(r.size);r.forEach(function(e,r){return t.set(r,e)})})}Ge.of=function(){var t=e.call(arguments,0);return it().withMutations(function(e){for(var r=0;r<t.length;r+=2){if(r+1>=t.length){throw new Error("Missing value for key: "+t[r])}e.set(t[r],t[r+1])}})};Ge.prototype.toString=function(){return this.__toString("Map {","}")};Ge.prototype.get=function(e,t){return this._root?this._root.get(0,undefined,e,t):t};Ge.prototype.set=function(e,t){return at(this,e,t)};Ge.prototype.setIn=function(e,t){return this.updateIn(e,b,function(){return t})};Ge.prototype.remove=function(e){return at(this,e,b)};Ge.prototype.deleteIn=function(e){return this.updateIn(e,function(){return b})};Ge.prototype.update=function(e,t,r){return arguments.length===1?e(this):this.updateIn([e],t,r)};Ge.prototype.updateIn=function(e,t,r){if(!r){r=t;t=undefined}var n=vt(this,_r(e),t,r);return n===b?undefined:n};Ge.prototype.clear=function(){if(this.size===0){return this}if(this.__ownerID){this.size=0;this._root=null;this.__hash=undefined;this.__altered=true;return this}return it()};Ge.prototype.merge=function(){return ht(this,undefined,arguments)};
162Ge.prototype.mergeWith=function(t){var r=e.call(arguments,1);return ht(this,t,r)};Ge.prototype.mergeIn=function(t){var r=e.call(arguments,1);return this.updateIn(t,it(),function(e){return typeof e.merge==="function"?e.merge.apply(e,r):r[r.length-1]})};Ge.prototype.mergeDeep=function(){return ht(this,dt,arguments)};Ge.prototype.mergeDeepWith=function(t){var r=e.call(arguments,1);return ht(this,pt(t),r)};Ge.prototype.mergeDeepIn=function(t){var r=e.call(arguments,1);return this.updateIn(t,it(),function(e){return typeof e.mergeDeep==="function"?e.mergeDeep.apply(e,r):r[r.length-1]})};Ge.prototype.sort=function(e){return zt(cr(this,e))};Ge.prototype.sortBy=function(e,t){return zt(cr(this,t,e))};Ge.prototype.withMutations=function(e){var t=this.asMutable();e(t);return t.wasAltered()?t.__ensureOwner(this.__ownerID):this};Ge.prototype.asMutable=function(){return this.__ownerID?this:this.__ensureOwner(new E)};Ge.prototype.asImmutable=function(){return this.__ensureOwner()};Ge.prototype.wasAltered=function(){return this.__altered};Ge.prototype.__iterator=function(e,t){return new $e(this,e,t)};Ge.prototype.__iterate=function(e,t){var r=this;var n=0;this._root&&this._root.iterate(function(t){n++;return e(t[1],t[0],r)},t);return n};Ge.prototype.__ensureOwner=function(e){if(e===this.__ownerID){return this}if(!e){this.__ownerID=e;this.__altered=false;return this}return rt(this.size,this._root,e,this.__hash)};function We(e){return!!(e&&e[qe])}Ge.isMap=We;
162var qe="@@__IMMUTABLE_MAP__@@";var Xe=Ge.prototype;Xe[qe]=true;Xe[m]=Xe.remove;Xe.removeIn=Xe.deleteIn;function Ye(e,t){this.ownerID=e;this.entries=t}Ye.prototype.get=function(e,t,r,n){var i=this.entries;for(var a=0,o=i.length;a<o;a++){if(me(r,i[a][0])){return i[a][1]}}return n};Ye.prototype.update=function(e,t,r,n,i,a,o){var s=i===b;var u=this.entries;var l=0;for(var c=u.length;l<c;l++){if(me(n,u[l][0])){break}}var f=l<c;if(f?u[l][1]===i:s){return this}C(o);(s||!f)&&C(a);if(s&&u.length===1){return}if(!f&&!s&&u.length>=_t){return lt(e,u,n,i)}var h=e&&e===this.ownerID;var d=h?u:S(u);if(f){if(s){l===c-1?d.pop():d[l]=d.pop()}else{d[l]=[n,i]}}else{d.push([n,i])}if(h){this.entries=d;return this}return new Ye(e,d)};function Ke(e,t,r){this.ownerID=e;this.bitmap=t;this.nodes=r}Ke.prototype.get=function(e,t,r,n){if(t===undefined){t=Ae(r)}var i=1<<((e===0?t:t>>>e)&g);var a=this.bitmap;return(a&i)===0?n:this.nodes[yt(a&i-1)].get(e+v,t,r,n)};Ke.prototype.update=function(e,t,r,n,i,a,o){if(r===undefined){r=Ae(n)}var s=(t===0?r:r>>>t)&g;var u=1<<s;var l=this.bitmap;var c=(l&u)!==0;if(!c&&i===b){return this}var f=yt(l&u-1);var h=this.nodes;var d=c?h[f]:undefined;var p=ot(d,e,t+v,r,n,i,a,o);if(p===d){return this}if(!c&&p&&h.length>=wt){return ft(e,h,l,s,p)}if(c&&!p&&h.length===2&&st(h[f^1])){return h[f^1]}if(c&&p&&h.length===1&&st(p)){return p}var m=e&&e===this.ownerID;var y=c?p?l:l^u:l|u;var x=c?p?gt(h,f,p,m):xt(h,f,m):bt(h,f,p,m);if(m){this.bitmap=y;this.nodes=x;return this}return new Ke(e,y,x)};function Qe(e,t,r){this.ownerID=e;this.count=t;this.nodes=r}Qe.prototype.get=function(e,t,r,n){if(t===undefined){t=Ae(r)}var i=(e===0?t:t>>>e)&g;var a=this.nodes[i];return a?a.get(e+v,t,r,n):n};Qe.prototype.update=function(e,t,r,n,i,a,o){if(r===undefined){r=Ae(n)}var s=(t===0?r:r>>>t)&g;var u=i===b;var l=this.nodes;var c=l[s];if(u&&!c){return this}var f=ot(c,e,t+v,r,n,i,a,o);if(f===c){return this}var h=this.count;if(!c){h++}else if(!f){h--;if(h<Ct){return ct(e,l,h,s)}}var d=e&&e===this.ownerID;var p=gt(l,s,f,d);if(d){this.count=h;this.nodes=p;return this}return new Qe(e,h,p)};function Ze(e,t,r){this.ownerID=e;this.keyHash=t;this.entries=r}Ze.prototype.get=function(e,t,r,n){var i=this.entries;for(var a=0,o=i.length;a<o;a++){if(me(r,i[a][0])){return i[a][1]}}return n};Ze.prototype.update=function(e,t,r,n,i,a,o){if(r===undefined){r=Ae(n)}var s=i===b;if(r!==this.keyHash){if(s){return this}C(o);C(a);return ut(this,e,t,r,[n,i])}var u=this.entries;var l=0;for(var c=u.length;l<c;l++){if(me(n,u[l][0])){break}}var f=l<c;if(f?u[l][1]===i:s){return this}C(o);(s||!f)&&C(a);if(s&&c===2){return new Je(e,this.keyHash,u[l^1])}var h=e&&e===this.ownerID;var d=h?u:S(u);if(f){if(s){l===c-1?d.pop():d[l]=d.pop()}else{d[l]=[n,i]}}else{d.push([n,i])}if(h){this.entries=d;return this}return new Ze(e,this.keyHash,d)};function Je(e,t,r){this.ownerID=e;this.keyHash=t;this.entry=r}Je.prototype.get=function(e,t,r,n){return me(r,this.entry[0])?this.entry[1]:n};Je.prototype.update=function(e,t,r,n,i,a,o){var s=i===b;var u=me(n,this.entry[0]);if(u?i===this.entry[1]:s){return this}C(o);if(s){C(a);return}if(u){if(e&&e===this.ownerID){this.entry[1]=i;return this}return new Je(e,this.keyHash,[n,i])}C(a);return ut(this,e,t,Ae(n),[n,i])};Ye.prototype.iterate=Ze.prototype.iterate=function(e,t){var r=this.entries;for(var n=0,i=r.length-1;n<=i;n++){if(e(r[t?i-n:n])===false){return false}}};Ke.prototype.iterate=Qe.prototype.iterate=function(e,t){var r=this.nodes;for(var n=0,i=r.length-1;n<=i;n++){var a=r[t?i-n:n];if(a&&a.iterate(e,t)===false){return false}}};Je.prototype.iterate=function(e,t){return e(this.entry)};t($e,U);function $e(e,t,r){this._type=t;this._reverse=r;this._stack=e._root&&tt(e._root)}$e.prototype.next=function(){var e=this._type;var t=this._stack;while(t){var r=t.node;var n=t.index++;var i;if(r.entry){if(n===0){return et(e,r.entry)}}else if(r.entries){i=r.entries.length-1;if(n<=i){return et(e,r.entries[this._reverse?i-n:n])}}else{i=r.nodes.length-1;if(n<=i){var a=r.nodes[this._reverse?i-n:n];if(a){if(a.entry){return et(e,a.entry)}t=this._stack=tt(a,t)}continue}}t=this._stack=this._stack.__prev}return z()};function et(e,t){return N(e,t[0],t[1])}function tt(e,t){return{node:e,index:0,__prev:t}}function rt(e,t,r,n){var i=Object.create(Xe);i.size=e;i._root=t;i.__ownerID=r;i.__hash=n;i.__altered=false;return i}var nt;function it(){return nt||(nt=rt(0))}function at(e,t,r){var n;var i;if(!e._root){if(r===b){return e}i=1;n=new Ye(e.__ownerID,[[t,r]])}else{var a=w(x);var o=w(_);n=ot(e._root,e.__ownerID,0,undefined,t,r,a,o);if(!o.value){return e}i=e.size+(a.value?r===b?-1:1:0)}if(e.__ownerID){e.size=i;e._root=n;e.__hash=undefined;e.__altered=true;return e}return n?rt(i,n):it()}
162function ot(e,t,r,n,i,a,o,s){if(!e){if(a===b){return e}C(s);C(o);return new Je(t,n,[i,a])}return e.update(t,r,n,i,a,o,s)}function st(e){return e.constructor===Je||e.constructor===Ze}function ut(e,t,r,n,i){if(e.keyHash===n){return new Ze(t,n,[e.entry,i])}var a=(r===0?e.keyHash:e.keyHash>>>r)&g;var o=(r===0?n:n>>>r)&g;var s;var u=a===o?[ut(e,t,r+v,n,i)]:(s=new Je(t,n,i),a<o?[e,s]:[s,e]);return new Ke(t,1<<a|1<<o,u)}function lt(e,t,r,n){if(!e){e=new E}var i=new Je(e,Ae(r),[r,n]);for(var a=0;a<t.length;a++){var o=t[a];i=i.update(e,0,undefined,o[0],o[1])}return i}function ct(e,t,r,n){var i=0;var a=0;var o=new Array(r);for(var s=0,u=1,l=t.length;s<l;s++,u<<=1){var c=t[s];if(c!==undefined&&s!==n){i|=u;o[a++]=c}}return new Ke(e,i,o)}function ft(e,t,r,n,i){var a=0;var o=new Array(y);for(var s=0;r!==0;s++,r>>>=1){o[s]=r&1?t[a++]:undefined}o[n]=i;return new Qe(e,a+1,o)}function ht(e,t,r){var i=[];for(var a=0;a<r.length;a++){var s=r[a];var u=n(s);if(!o(s)){u=u.map(function(e){return fe(e)})}i.push(u)}return mt(e,t,i)}function dt(e,t,r){return e&&e.mergeDeep&&o(t)?e.mergeDeep(t):me(e,t)?e:t}function pt(e){return function(t,r,n){if(t&&t.mergeDeepWith&&o(r)){return t.mergeDeepWith(e,r)}var i=e(t,r,n);return me(t,i)?t:i}}function mt(e,t,r){r=r.filter(function(e){return e.size!==0});if(r.length===0){return e}if(e.size===0&&!e.__ownerID&&r.length===1){return e.constructor(r[0])}return e.withMutations(function(e){var n=t?function(r,n){e.update(n,b,function(e){return e===b?r:t(e,r,n)})}:function(t,r){e.set(r,t)};for(var i=0;i<r.length;i++){r[i].forEach(n)}})}function vt(e,t,r,n){var i=e===b;var a=t.next();if(a.done){var o=i?r:e;var s=n(o);return s===o?e:s}be(i||e&&e.set,"invalid keyPath");var u=a.value;var l=i?b:e.get(u,b);var c=vt(l,t,r,n);return c===l?e:c===b?e.remove(u):(i?it():e).set(u,c)}function yt(e){e=e-(e>>1&1431655765);e=(e&858993459)+(e>>2&858993459);e=e+(e>>4)&252645135;e=e+(e>>8);e=e+(e>>16);return e&127}function gt(e,t,r,n){var i=n?e:S(e);i[t]=r;return i}function bt(e,t,r,n){var i=e.length+1;if(n&&t+1===i){e[t]=r;return e}var a=new Array(i);var o=0;for(var s=0;s<i;s++){if(s===t){a[s]=r;o=-1}else{a[s]=e[s+o]}}return a}function xt(e,t,r){var n=e.length-1;if(r&&t===n){e.pop();return e}var i=new Array(n);var a=0;for(var o=0;o<n;o++){if(o===t){a=1}i[o]=e[o+a]}return i}var _t=y/4;var wt=y/2;var Ct=y/4;t(Et,Ee);function Et(e){var t=Dt();if(e===null||e===undefined){return t}if(St(e)){return e}var r=i(e);var n=r.size;if(n===0){return t}je(n);if(n>0&&n<y){return kt(0,n,v,null,new At(r.toArray()))}return t.withMutations(function(e){e.setSize(n);r.forEach(function(t,r){return e.set(r,t)})})}Et.of=function(){return this(arguments)};Et.prototype.toString=function(){return this.__toString("List [","]")};Et.prototype.get=function(e,t){e=M(this,e);if(e>=0&&e<this.size){e+=this._origin;var r=Vt(this,e);return r&&r.array[e&g]}return t};Et.prototype.set=function(e,t){return Bt(this,e,t)};Et.prototype.remove=function(e){return!this.has(e)?this:e===0?this.shift():e===this.size-1?this.pop():this.splice(e,1)};Et.prototype.insert=function(e,t){return this.splice(e,0,t)};Et.prototype.clear=function(){if(this.size===0){return this}if(this.__ownerID){this.size=this._origin=this._capacity=0;this._level=v;this._root=this._tail=null;this.__hash=undefined;this.__altered=true;return this}return Dt()};Et.prototype.push=function(){var e=arguments;var t=this.size;return this.withMutations(function(r){Ot(r,0,t+e.length);for(var n=0;n<e.length;n++){r.set(t+n,e[n])}})};Et.prototype.pop=function(){return Ot(this,0,-1)};Et.prototype.unshift=function(){var e=arguments;return this.withMutations(function(t){Ot(t,-e.length);for(var r=0;r<e.length;r++){t.set(r,e[r])}})};Et.prototype.shift=function(){return Ot(this,1)};Et.prototype.merge=function(){return Ut(this,undefined,arguments)};Et.prototype.mergeWith=function(t){var r=e.call(arguments,1);return Ut(this,t,r)};Et.prototype.mergeDeep=function(){return Ut(this,dt,arguments)};Et.prototype.mergeDeepWith=function(t){var r=e.call(arguments,1);return Ut(this,pt(t),r)};Et.prototype.setSize=function(e){return Ot(this,0,e)};Et.prototype.slice=function(e,t){var r=this.size;if(P(e,t,r)){return this}return Ot(this,R(e,r),k(t,r))};Et.prototype.__iterator=function(e,t){var r=0;var n=Rt(this,t);return new U(function(){var t=n();return t===Pt?z():N(e,r++,t)})};Et.prototype.__iterate=function(e,t){var r=0;var n=Rt(this,t);var i;while((i=n())!==Pt){if(e(i,r++,this)===false){break}}return r};Et.prototype.__ensureOwner=function(e){if(e===this.__ownerID){return this}if(!e){this.__ownerID=e;return this}return kt(this._origin,this._capacity,this._level,this._root,this._tail,e,this.__hash)};function St(e){return!!(e&&e[Tt])}Et.isList=St;
162var Tt="@@__IMMUTABLE_LIST__@@";var Mt=Et.prototype;Mt[Tt]=true;Mt[m]=Mt.remove;Mt.setIn=Xe.setIn;Mt.deleteIn=Mt.removeIn=Xe.removeIn;Mt.update=Xe.update;Mt.updateIn=Xe.updateIn;Mt.mergeIn=Xe.mergeIn;Mt.mergeDeepIn=Xe.mergeDeepIn;Mt.withMutations=Xe.withMutations;Mt.asMutable=Xe.asMutable;Mt.asImmutable=Xe.asImmutable;Mt.wasAltered=Xe.wasAltered;function At(e,t){this.array=e;this.ownerID=t}At.prototype.removeBefore=function(e,t,r){if(r===t?1<<t:0||this.array.length===0){return this}var n=r>>>t&g;if(n>=this.array.length){return new At([],e)}var i=n===0;var a;if(t>0){var o=this.array[n];a=o&&o.removeBefore(e,t-v,r);if(a===o&&i){return this}}if(i&&!a){return this}var s=Ft(this,e);if(!i){for(var u=0;u<n;u++){s.array[u]=undefined}}if(a){s.array[n]=a}return s};At.prototype.removeAfter=function(e,t,r){if(r===(t?1<<t:0)||this.array.length===0){return this}var n=r-1>>>t&g;if(n>=this.array.length){return this}var i;if(t>0){var a=this.array[n];i=a&&a.removeAfter(e,t-v,r);if(i===a&&n===this.array.length-1){return this}}var o=Ft(this,e);o.array.splice(n+1);if(i){o.array[n]=i}return o};var Pt={};function Rt(e,t){var r=e._origin;var n=e._capacity;var i=Nt(n);var a=e._tail;return o(e._root,e._level,0);function o(e,t,r){return t===0?s(e,r):u(e,t,r)}function s(e,o){var s=o===i?a&&a.array:e&&e.array;var u=o>r?0:r-o;var l=n-o;if(l>y){l=y}return function(){if(u===l){return Pt}var e=t?--l:u++;return s&&s[e]}}function u(e,i,a){var s;var u=e&&e.array;var l=a>r?0:r-a>>i;var c=(n-a>>i)+1;if(c>y){c=y}return function(){do{if(s){var e=s();if(e!==Pt){return e}s=null}if(l===c){return Pt}var r=t?--c:l++;s=o(u&&u[r],i-v,a+(r<<i))}while(true)}}}function kt(e,t,r,n,i,a,o){var s=Object.create(Mt);s.size=t-e;s._origin=e;s._capacity=t;s._level=r;s._root=n;s._tail=i;s.__ownerID=a;s.__hash=o;s.__altered=false;return s}var It;function Dt(){return It||(It=kt(0,0,v))}function Bt(e,t,r){t=M(e,t);if(t!==t){return e}if(t>=e.size||t<0){return e.withMutations(function(e){t<0?Ot(e,t).set(0,r):Ot(e,0,t+1).set(t,r)})}t+=e._origin;var n=e._tail;var i=e._root;var a=w(_);if(t>=Nt(e._capacity)){n=Lt(n,e.__ownerID,0,t,r,a)}else{i=Lt(i,e.__ownerID,e._level,t,r,a)}if(!a.value){return e}if(e.__ownerID){e._root=i;e._tail=n;e.__hash=undefined;e.__altered=true;return e}return kt(e._origin,e._capacity,e._level,i,n)}function Lt(e,t,r,n,i,a){var o=n>>>r&g;var s=e&&o<e.array.length;if(!s&&i===undefined){return e}var u;if(r>0){var l=e&&e.array[o];var c=Lt(l,t,r-v,n,i,a);if(c===l){return e}u=Ft(e,t);u.array[o]=c;return u}if(s&&e.array[o]===i){return e}C(a);u=Ft(e,t);if(i===undefined&&o===u.array.length-1){u.array.pop()}else{u.array[o]=i}return u}function Ft(e,t){if(t&&e&&t===e.ownerID){return e}return new At(e?e.array.slice():[],t)}function Vt(e,t){if(t>=Nt(e._capacity)){return e._tail}if(t<1<<e._level+v){var r=e._root;var n=e._level;while(r&&n>0){r=r.array[t>>>n&g];n-=v}return r}}function Ot(e,t,r){if(t!==undefined){t=t|0}if(r!==undefined){r=r|0}var n=e.__ownerID||new E;var i=e._origin;var a=e._capacity;var o=i+t;var s=r===undefined?a:r<0?a+r:i+r;if(o===i&&s===a){return e}if(o>=s){return e.clear()}var u=e._level;var l=e._root;var c=0;while(o+c<0){l=new At(l&&l.array.length?[undefined,l]:[],n);u+=v;c+=1<<u}if(c){o+=c;i+=c;s+=c;a+=c}var f=Nt(a);var h=Nt(s);while(h>=1<<u+v){l=new At(l&&l.array.length?[l]:[],n);u+=v}var d=e._tail;var p=h<f?Vt(e,s-1):h>f?new At([],n):d;if(d&&h>f&&o<a&&d.array.length){l=Ft(l,n);var m=l;for(var y=u;y>v;y-=v){var b=f>>>y&g;m=m.array[b]=Ft(m.array[b],n)}m.array[f>>>v&g]=d}if(s<a){p=p&&p.removeAfter(n,0,s)}if(o>=h){o-=h;s-=h;u=v;l=null;p=p&&p.removeBefore(n,0,o)}else if(o>i||h<f){c=0;while(l){var x=o>>>u&g;if(x!==h>>>u&g){break}if(x){c+=(1<<u)*x}u-=v;l=l.array[x]}if(l&&o>i){l=l.removeBefore(n,u,o-c)}if(l&&h<f){l=l.removeAfter(n,u,h-c)}if(c){o-=c;s-=c}}if(e.__ownerID){e.size=s-o;e._origin=o;e._capacity=s;e._level=u;e._root=l;e._tail=p;e.__hash=undefined;e.__altered=true;return e}return kt(o,s,u,l,p)}function Ut(e,t,r){var n=[];var a=0;for(var s=0;s<r.length;s++){var u=r[s];var l=i(u);if(l.size>a){a=l.size}if(!o(u)){l=l.map(function(e){return fe(e)})}n.push(l)}if(a>e.size){e=e.setSize(a)}return mt(e,t,n)}function Nt(e){return e<y?0:e-1>>>v<<v}t(zt,Ge);function zt(e){return e===null||e===undefined?Wt():Ht(e)?e:Wt().withMutations(function(t){var r=n(e);je(r.size);r.forEach(function(e,r){return t.set(r,e)})})}zt.of=function(){return this(arguments)};zt.prototype.toString=function(){return this.__toString("OrderedMap {","}")};zt.prototype.get=function(e,t){var r=this._map.get(e);return r!==undefined?this._list.get(r)[1]:t};zt.prototype.clear=function(){if(this.size===0){return this}if(this.__ownerID){this.size=0;this._map.clear();this._list.clear();return this}return Wt()};zt.prototype.set=function(e,t){return qt(this,e,t)};zt.prototype.remove=function(e){return qt(this,e,b)};zt.prototype.wasAltered=function(){return this._map.wasAltered()||this._list.
162wasAltered()};zt.prototype.__iterate=function(e,t){var r=this;return this._list.__iterate(function(t){return t&&e(t[1],t[0],r)},t)};zt.prototype.__iterator=function(e,t){return this._list.fromEntrySeq().__iterator(e,t)};zt.prototype.__ensureOwner=function(e){if(e===this.__ownerID){return this}var t=this._map.__ensureOwner(e);var r=this._list.__ensureOwner(e);if(!e){this.__ownerID=e;this._map=t;this._list=r;return this}return jt(t,r,e,this.__hash)};function Ht(e){return We(e)&&c(e)}zt.isOrderedMap=Ht;zt.prototype[p]=true;zt.prototype[m]=zt.prototype.remove;function jt(e,t,r,n){var i=Object.create(zt.prototype);i.size=e?e.size:0;i._map=e;i._list=t;i.__ownerID=r;i.__hash=n;return i}var Gt;function Wt(){return Gt||(Gt=jt(it(),Dt()))}function qt(e,t,r){var n=e._map;var i=e._list;var a=n.get(t);var o=a!==undefined;var s;var u;if(r===b){if(!o){return e}if(i.size>=y&&i.size>=n.size*2){u=i.filter(function(e,t){return e!==undefined&&a!==t});s=u.toKeyedSeq().map(function(e){return e[0]}).flip().toMap();if(e.__ownerID){s.__ownerID=u.__ownerID=e.__ownerID}}else{s=n.remove(t);u=a===i.size-1?i.pop():i.set(a,undefined)}}else{if(o){if(r===i.get(a)[1]){return e}s=n;u=i.set(a,[t,r])}else{s=n.set(t,i.size);u=i.set(i.size,[t,r])}}if(e.__ownerID){e.size=s.size;e._map=s;e._list=u;e.__hash=undefined;return e}return jt(s,u)}t(Xt,Y);function Xt(e,t){this._iter=e;this._useKeys=t;this.size=e.size}Xt.prototype.get=function(e,t){return this._iter.get(e,t)};Xt.prototype.has=function(e){return this._iter.has(e)};Xt.prototype.valueSeq=function(){ 163return this._iter.valueSeq()};Xt.prototype.reverse=function(){var e=this;var t=$t(this,true);if(!this._useKeys){t.valueSeq=function(){return e._iter.toSeq().reverse()}}return t};Xt.prototype.map=function(e,t){var r=this;var n=Jt(this,e,t);if(!this._useKeys){n.valueSeq=function(){return r._iter.toSeq().map(e,t)}}return n};Xt.prototype.__iterate=function(e,t){var r=this;var n;return this._iter.__iterate(this._useKeys?function(t,n){return e(t,n,r)}:(n=t?vr(this):0,function(i){return e(i,t?--n:n++,r)}),t)};Xt.prototype.__iterator=function(e,t){if(this._useKeys){return this._iter.__iterator(e,t)}var r=this._iter.__iterator(B,t);var n=t?vr(this):0;return new U(function(){var i=r.next();return i.done?i:N(e,t?--n:n++,i.value,i)})};Xt.prototype[p]=true;t(Yt,K);function Yt(e){this._iter=e;this.size=e.size}Yt.prototype.includes=function(e){return this._iter.includes(e)};Yt.prototype.__iterate=function(e,t){var r=this;var n=0;return this._iter.__iterate(function(t){return e(t,n++,r)},t)};Yt.prototype.__iterator=function(e,t){var r=this._iter.__iterator(B,t);var n=0;return new U(function(){var t=r.next();return t.done?t:N(e,n++,t.value,t)})};t(Kt,Q);function Kt(e){this._iter=e;this.size=e.size}Kt.prototype.has=function(e){return this._iter.includes(e)};Kt.prototype.__iterate=function(e,t){var r=this;return this._iter.__iterate(function(t){return e(t,t,r)},t)};Kt.prototype.__iterator=function(e,t){var r=this._iter.__iterator(B,t);return new U(function(){var t=r.next();return t.done?t:N(e,t.value,t.value,t)})};t(Qt,Y);function Qt(e){this._iter=e;this.size=e.size}Qt.prototype.entrySeq=function(){return this._iter.toSeq()};Qt.prototype.__iterate=function(e,t){var r=this;return this._iter.__iterate(function(t){if(t){mr(t);var n=o(t);return e(n?t.get(1):t[1],n?t.get(0):t[0],r)}},t)};Qt.prototype.__iterator=function(e,t){var r=this._iter.__iterator(B,t);return new U(function(){while(true){var t=r.next();if(t.done){return t}var n=t.value;if(n){mr(n);var i=o(n);return N(e,i?n.get(0):n[0],i?n.get(1):n[1],t)}}})};Yt.prototype.cacheResult=Xt.prototype.cacheResult=Kt.prototype.cacheResult=Qt.prototype.cacheResult=br;function Zt(e){var t=gr(e);t._iter=e;t.size=e.size;t.flip=function(){return e};t.reverse=function(){var t=e.reverse.apply(this);t.flip=function(){return e.reverse()};return t};t.has=function(t){return e.includes(t)};t.includes=function(t){return e.has(t)};t.cacheResult=br;t.__iterateUncached=function(t,r){var n=this;return e.__iterate(function(e,r){return t(r,e,n)!==false},r)};t.__iteratorUncached=function(t,r){if(t===L){var n=e.__iterator(t,r);return new U(function(){var e=n.next();if(!e.done){var t=e.value[0];e.value[0]=e.value[1];e.value[1]=t}return e})}return e.__iterator(t===B?D:B,r)};return t}function Jt(e,t,r){var n=gr(e);n.size=e.size;n.has=function(t){return e.has(t)};n.get=function(n,i){var a=e.get(n,b);return a===b?i:t.call(r,a,n,e)};n.__iterateUncached=function(n,i){var a=this;return e.__iterate(function(e,i,o){return n(t.call(r,e,i,o),i,a)!==false},i)};n.__iteratorUncached=function(n,i){var a=e.__iterator(L,i);return new U(function(){var i=a.next();if(i.done){return i}var o=i.value;var s=o[0];return N(n,s,t.call(r,o[1],s,e),i)})};return n}function $t(e,t){var r=gr(e);r._iter=e;r.size=e.size;r.reverse=function(){return e};if(e.flip){r.flip=function(){var t=Zt(e);t.reverse=function(){return e.flip()};return t}}r.get=function(r,n){return e.get(t?r:-1-r,n)};r.has=function(r){return e.has(t?r:-1-r)};r.includes=function(t){return e.includes(t)};r.cacheResult=br;r.__iterate=function(t,r){var n=this;return e.__iterate(function(e,r){return t(e,r,n)},!r)};r.__iterator=function(t,r){return e.__iterator(t,!r)};return r}function er(e,t,r,n){var i=gr(e);if(n){i.has=function(n){var i=e.get(n,b);return i!==b&&!!t.call(r,i,n,e)};i.get=function(n,i){var a=e.get(n,b);return a!==b&&t.call(r,a,n,e)?a:i}}i.__iterateUncached=function(i,a){var o=this;var s=0;e.__iterate(function(e,a,u){if(t.call(r,e,a,u)){s++;return i(e,n?a:s-1,o)}},a);return s};i.__iteratorUncached=function(i,a){var o=e.__iterator(L,a);var s=0;return new U(function(){while(true){var a=o.next();if(a.done){return a}var u=a.value;var l=u[0];var c=u[1];if(t.call(r,c,l,e)){return N(i,n?l:s++,c,a)}}})};return i}function tr(e,t,r){var n=Ge().asMutable();e.__iterate(function(i,a){n.update(t.call(r,i,a,e),0,function(e){return e+1})});return n.asImmutable()}function rr(e,t,r){var n=s(e);var i=(c(e)?zt():Ge()).asMutable();e.__iterate(function(a,o){i.update(t.call(r,a,o,e),function(e){return e=e||[],e.push(n?[o,a]:a),e})});var a=yr(e);return i.map(function(t){return pr(e,a(t))})}function nr(e,t,r,n){var i=e.size;if(t!==undefined){t=t|0}if(r!==undefined){r=r|0}if(P(t,r,i)){return e}var a=R(t,i);var o=k(r,i);if(a!==a||o!==o){return nr(e.toSeq().cacheResult(),t,r,n)}var s=o-a;var u;if(s===s){u=s<0?0:s}var l=gr(e);l.size=u===0?u:e.size&&u||undefined;if(!n&&re(e)&&u>=0){l.get=function(t,r){t=M(this,t);return t>=0&&t<u?e.get(t+a,r):r}}l.__iterateUncached=function(t,r){var i=this;if(u===0){return 0}if(r){return this.cacheResult().__iterate(t,r)}var o=0;var s=true;var l=0;e.__iterate(function(e,r){if(!(s&&(s=o++<a))){l++;return t(e,n?r:l-1,i)!==false&&l!==u}});return l};l.__iteratorUncached=function(t,r){if(u!==0&&r){return this.cacheResult().__iterator(t,r)}var i=u!==0&&e.__iterator(t,r);var o=0;var s=0;return new U(function(){while(o++<a){i.next()}if(++s>u){return z()}var e=i.next();if(n||t===B){return e}else if(t===D){return N(t,s-1,undefined,e)}else{return N(t,s-1,e.value[1],e)}})};return l}function ir(e,t,r){var n=gr(e);n.__iterateUncached=function(n,i){var a=this;if(i){return this.cacheResult().__iterate(n,i)}var o=0;e.__iterate(function(e,i,s){return t.call(r,e,i,s)&&++o&&n(e,i,a)});return o};n.__iteratorUncached=function(n,i){var a=this;if(i){return this.cacheResult().__iterator(n,i)}var o=e.__iterator(L,i);var s=true;return new U(function(){if(!s){return z()}var e=o.next();if(e.done){return e}var i=e.value;var u=i[0];var l=i[1];if(!t.call(r,l,u,a)){s=false;return z()}return n===L?e:N(n,u,l,e)})};return n}function ar(e,t,r,n){var i=gr(e);i.__iterateUncached=function(i,a){var o=this;if(a){return this.cacheResult().__iterate(i,a)}var s=true;var u=0;e.__iterate(function(e,a,l){if(!(s&&(s=t.call(r,e,a,l)))){u++;return i(e,n?a:u-1,o)}});return u};i.__iteratorUncached=function(i,a){var o=this;if(a){return this.cacheResult().__iterator(i,a)}var s=e.__iterator(L,a);var u=true;var l=0;return new U(function(){var e,a,c;do{e=s.next();if(e.done){if(n||i===B){return e}else if(i===D){return N(i,l++,undefined,e)}else{return N(i,l++,e.value[1],e)}}var f=e.value;a=f[0];c=f[1];u&&(u=t.call(r,c,a,o))}while(u);return i===L?e:N(i,a,c,e)})};return i}function or(e,t){var r=s(e);var i=[e].concat(t).map(function(e){if(!o(e)){e=r?ae(e):oe(Array.isArray(e)?e:[e])}else if(r){e=n(e)}return e}).filter(function(e){return e.size!==0});if(i.length===0){return e}if(i.length===1){var a=i[0];if(a===e||r&&s(a)||u(e)&&u(a)){return a}}var l=new J(i);if(r){l=l.toKeyedSeq()}else if(!u(e)){l=l.toSetSeq()}l=l.flatten(true);l.size=i.reduce(function(e,t){if(e!==undefined){var r=t.size;if(r!==undefined){return e+r}}},0);return l}function sr(e,t,r){var n=gr(e);n.__iterateUncached=function(n,i){var a=0;var s=false;function u(e,l){var c=this;e.__iterate(function(e,i){if((!t||l<t)&&o(e)){u(e,l+1)}else if(n(e,r?i:a++,c)===false){s=true}return!s},i)}u(e,0);return a};n.__iteratorUncached=function(n,i){var a=e.__iterator(n,i);var s=[];var u=0;return new U(function(){while(a){var e=a.next();if(e.done!==false){a=s.pop();continue}var l=e.value;if(n===L){l=l[1]}if((!t||s.length<t)&&o(l)){s.push(a);a=l.__iterator(n,i)}else{return r?e:N(n,u++,l,e)}}return z()})};return n}function ur(e,t,r){var n=yr(e);return e.toSeq().map(function(i,a){return n(t.call(r,i,a,e))}).flatten(true)}function lr(e,t){var r=gr(e);r.size=e.size&&e.size*2-1;r.__iterateUncached=function(r,n){var i=this;var a=0;e.__iterate(function(e,n){return(!a||r(t,a++,i)!==false)&&r(e,a++,i)!==false},n);return a};r.__iteratorUncached=function(r,n){var i=e.__iterator(B,n);var a=0;var o;return new U(function(){if(!o||a%2){o=i.next();if(o.done){return o}}return a%2?N(r,a++,t):N(r,a++,o.value,o)})};return r}function cr(e,t,r){if(!t){t=xr}var n=s(e);var i=0;var a=e.toSeq().map(function(t,n){return[n,t,i++,r?r(t,n,e):t]}).toArray();a.sort(function(e,r){return t(e[3],r[3])||e[2]-r[2]}
163).forEach(n?function(e,t){a[t].length=2}:function(e,t){a[t]=e[1]});return n?Y(a):u(e)?K(a):Q(a)}function fr(e,t,r){if(!t){t=xr}if(r){var n=e.toSeq().map(function(t,n){return[t,r(t,n,e)]}).reduce(function(e,r){return hr(t,e[1],r[1])?r:e});return n&&n[0]}else{return e.reduce(function(e,r){return hr(t,e,r)?r:e})}}function hr(e,t,r){var n=e(r,t);return n===0&&r!==t&&(r===undefined||r===null||r!==r)||n>0}function dr(e,t,n){var i=gr(e);i.size=new J(n).map(function(e){return e.size}).min();i.__iterate=function(e,t){var r=this.__iterator(B,t);var n;var i=0;while(!(n=r.next()).done){if(e(n.value,i++,this)===false){break}}return i};i.__iteratorUncached=function(e,i){var a=n.map(function(e){return e=r(e),G(i?e.reverse():e)});var o=0;var s=false;return new U(function(){var r;if(!s){r=a.map(function(e){return e.next()});s=r.some(function(e){return e.done})}if(s){return z()}return N(e,o++,t.apply(null,r.map(function(e){return e.value})))})};return i}function pr(e,t){return re(e)?t:e.constructor(t)}function mr(e){if(e!==Object(e)){throw new TypeError("Expected [K, V] tuple: "+e)}}function vr(e){je(e.size);return T(e)}function yr(e){return s(e)?n:u(e)?i:a}function gr(e){return Object.create((s(e)?Y:u(e)?K:Q).prototype)}function br(){if(this._iter.cacheResult){this._iter.cacheResult();this.size=this._iter.size;return this}else{return X.prototype.cacheResult.call(this)}}function xr(e,t){return e>t?1:e<t?-1:0}function _r(e){var t=G(e);if(!t){if(!q(e)){throw new TypeError("Expected iterable or array-like: "+e)}t=G(r(e))}return t}t(wr,Ce);function wr(e,t){var r;var n=function a(o){if(o instanceof n){return o}if(!(this instanceof n)){return new n(o)}if(!r){r=true;var s=Object.keys(e);Tr(i,s);i.size=s.length;i._name=t;i._keys=s;i._defaultValues=e}this._map=Ge(o)};var i=n.prototype=Object.create(Cr);i.constructor=n;return n}wr.prototype.toString=function(){return this.__toString(Sr(this)+" {","}")};wr.prototype.has=function(e){return this._defaultValues.hasOwnProperty(e)};wr.prototype.get=function(e,t){if(!this.has(e)){return t}var r=this._defaultValues[e];return this._map?this._map.get(e,r):r};wr.prototype.clear=function(){if(this.__ownerID){this._map&&this._map.clear();return this}var e=this.constructor;return e._empty||(e._empty=Er(this,it()))};wr.prototype.set=function(e,t){if(!this.has(e)){throw new Error('Cannot set unknown key "'+e+'" on '+Sr(this))}if(this._map&&!this._map.has(e)){var r=this._defaultValues[e];if(t===r){return this}}var n=this._map&&this._map.set(e,t);if(this.__ownerID||n===this._map){return this}return Er(this,n)};wr.prototype.remove=function(e){if(!this.has(e)){return this}var t=this._map&&this._map.remove(e);if(this.__ownerID||t===this._map){return this}return Er(this,t)};wr.prototype.wasAltered=function(){return this._map.wasAltered()};wr.prototype.__iterator=function(e,t){var r=this;return n(this._defaultValues).map(function(e,t){return r.get(t)}).__iterator(e,t)};wr.prototype.__iterate=function(e,t){var r=this;return n(this._defaultValues).map(function(e,t){return r.get(t)}).__iterate(e,t)};wr.prototype.__ensureOwner=function(e){if(e===this.__ownerID){return this}var t=this._map&&this._map.__ensureOwner(e);if(!e){this.__ownerID=e;this._map=t;return this}return Er(this,t,e)};var Cr=wr.prototype;Cr[m]=Cr.remove;Cr.deleteIn=Cr.removeIn=Xe.removeIn;Cr.merge=Xe.merge;Cr.mergeWith=Xe.mergeWith;Cr.mergeIn=Xe.mergeIn;Cr.mergeDeep=Xe.mergeDeep;Cr.mergeDeepWith=Xe.mergeDeepWith;Cr.mergeDeepIn=Xe.mergeDeepIn;Cr.setIn=Xe.setIn;Cr.update=Xe.update;Cr.updateIn=Xe.updateIn;Cr.withMutations=Xe.withMutations;Cr.asMutable=Xe.asMutable;Cr.asImmutable=Xe.asImmutable;function Er(e,t,r){var n=Object.create(Object.getPrototypeOf(e));n._map=t;n.__ownerID=r;return n}function Sr(e){return e._name||e.constructor.name||"Record"}function Tr(e,t){try{t.forEach(Mr.bind(undefined,e))}catch(e){}}function Mr(e,t){Object.defineProperty(e,t,{get:function(){return this.get(t)},set:function(e){be(this.__ownerID,"Cannot set on an immutable record.");this.set(t,e)}})}t(Ar,Se);function Ar(e){return e===null||e===undefined?Lr():Pr(e)&&!c(e)?e:Lr().withMutations(function(t){var r=a(e);je(r.size);r.forEach(function(e){return t.add(e)})})}Ar.of=function(){return this(arguments)};Ar.fromKeys=function(e){return this(n(e).keySeq())};Ar.prototype.toString=function(){return this.__toString("Set {","}")};Ar.prototype.has=function(e){return this._map.has(e)};Ar.prototype.add=function(e){return Ir(this,this._map.set(e,true))};Ar.prototype.remove=function(e){return Ir(this,this._map.remove(e))};Ar.prototype.clear=function(){return Ir(this,this._map.clear())};Ar.prototype.union=function(){var t=e.call(arguments,0);t=t.filter(function(e){return e.size!==0});if(t.length===0){return this}if(this.size===0&&!this.__ownerID&&t.length===1){return this.constructor(t[0])}return this.withMutations(function(e){for(var r=0;r<t.length;
163r++){a(t[r]).forEach(function(t){return e.add(t)})}})};Ar.prototype.intersect=function(){var t=e.call(arguments,0);if(t.length===0){return this}t=t.map(function(e){return a(e)});var r=this;return this.withMutations(function(e){r.forEach(function(r){if(!t.every(function(e){return e.includes(r)})){e.remove(r)}})})};Ar.prototype.subtract=function(){var t=e.call(arguments,0);if(t.length===0){return this}t=t.map(function(e){return a(e)});var r=this;return this.withMutations(function(e){r.forEach(function(r){if(t.some(function(e){return e.includes(r)})){e.remove(r)}})})};Ar.prototype.merge=function(){return this.union.apply(this,arguments)};Ar.prototype.mergeWith=function(t){var r=e.call(arguments,1);return this.union.apply(this,r)};Ar.prototype.sort=function(e){return Fr(cr(this,e))};Ar.prototype.sortBy=function(e,t){return Fr(cr(this,t,e))};Ar.prototype.wasAltered=function(){return this._map.wasAltered()};Ar.prototype.__iterate=function(e,t){var r=this;return this._map.__iterate(function(t,n){return e(n,n,r)},t)};Ar.prototype.__iterator=function(e,t){return this._map.map(function(e,t){return t}).__iterator(e,t)};Ar.prototype.__ensureOwner=function(e){if(e===this.__ownerID){return this}var t=this._map.__ensureOwner(e);if(!e){this.__ownerID=e;this._map=t;return this}return this.__make(t,e)};function Pr(e){return!!(e&&e[Rr])}Ar.isSet=Pr;var Rr="@@__IMMUTABLE_SET__@@";var kr=Ar.prototype;kr[Rr]=true;kr[m]=kr.remove;kr.mergeDeep=kr.merge;kr.mergeDeepWith=kr.mergeWith;kr.withMutations=Xe.withMutations;kr.asMutable=Xe.asMutable;kr.asImmutable=Xe.asImmutable;kr.__empty=Lr;kr.__make=Dr;function Ir(e,t){if(e.__ownerID){e.size=t.size;e._map=t;return e}return t===e._map?e:t.size===0?e.__empty():e.__make(t)}function Dr(e,t){var r=Object.create(kr);r.size=e?e.size:0;r._map=e;r.__ownerID=t;return r}var Br;function Lr(){return Br||(Br=Dr(it()))}t(Fr,Ar);function Fr(e){return e===null||e===undefined?zr():Vr(e)?e:zr().withMutations(function(t){var r=a(e);je(r.size);r.forEach(function(e){return t.add(e)})})}Fr.of=function(){return this(arguments)};Fr.fromKeys=function(e){return this(n(e).keySeq())};Fr.prototype.toString=function(){return this.__toString("OrderedSet {","}")};function Vr(e){return Pr(e)&&c(e)}Fr.isOrderedSet=Vr;var Or=Fr.prototype;Or[p]=true;Or.__empty=zr;Or.__make=Ur;function Ur(e,t){var r=Object.create(Or);r.size=e?e.size:0;r._map=e;r.__ownerID=t;return r}var Nr;function zr(){return Nr||(Nr=Ur(Wt()))}t(Hr,Ee);function Hr(e){return e===null||e===undefined?Yr():jr(e)?e:Yr().unshiftAll(e)}Hr.of=function(){return this(arguments)};Hr.prototype.toString=function(){return this.__toString("Stack [","]")};Hr.prototype.get=function(e,t){var r=this._head;e=M(this,e);while(r&&e--){r=r.next}return r?r.value:t};Hr.prototype.peek=function(){return this._head&&this._head.value};Hr.prototype.push=function(){if(arguments.length===0){return this}var e=this.size+arguments.length;var t=this._head;for(var r=arguments.length-1;r>=0;r--){t={value:arguments[r],next:t}}if(this.__ownerID){this.size=e;this._head=t;this.__hash=undefined;this.__altered=true;return this}return qr(e,t)};Hr.prototype.pushAll=function(e){e=i(e);if(e.size===0){return this}je(e.size);var t=this.size;var r=this._head;e.reverse().forEach(function(e){t++;r={value:e,next:r}});if(this.__ownerID){this.size=t;this._head=r;this.__hash=undefined;this.__altered=true;return this}return qr(t,r)};Hr.prototype.pop=function(){return this.slice(1)};Hr.prototype.unshift=function(){return this.push.apply(this,arguments)};Hr.prototype.unshiftAll=function(e){return this.pushAll(e)};Hr.prototype.shift=function(){return this.pop.apply(this,arguments)};Hr.prototype.clear=function(){if(this.size===0){return this}if(this.__ownerID){this.size=0;this._head=undefined;this.__hash=undefined;this.__altered=true;return this}return Yr()};Hr.prototype.slice=function(e,t){if(P(e,t,this.size)){return this}var r=R(e,this.size);var n=k(t,this.size);if(n!==this.size){return Ee.prototype.slice.call(this,e,t)}var i=this.size-r;var a=this._head;while(r--){a=a.next}if(this.__ownerID){this.size=i;this._head=a;this.__hash=undefined;this.__altered=true;return this}return qr(i,a)};Hr.prototype.__ensureOwner=function(e){if(e===this.__ownerID){return this}if(!e){this.__ownerID=e;this.__altered=false;return this}return qr(this.size,this._head,e,this.__hash)};Hr.prototype.__iterate=function(e,t){if(t){return this.reverse().__iterate(e)}var r=0;var n=this._head;while(n){if(e(n.value,r++,this)===false){break}n=n.next}return r};Hr.prototype.__iterator=function(e,t){if(t){return this.reverse().__iterator(e)}var r=0;var n=this._head;return new U(function(){if(n){var t=n.value;n=n.next;return N(e,r++,t)}return z()})};function jr(e){return!!(e&&e[Gr])}Hr.isStack=jr;
163var Gr="@@__IMMUTABLE_STACK__@@";var Wr=Hr.prototype;Wr[Gr]=true;Wr.withMutations=Xe.withMutations;Wr.asMutable=Xe.asMutable;Wr.asImmutable=Xe.asImmutable;Wr.wasAltered=Xe.wasAltered;function qr(e,t,r,n){var i=Object.create(Wr);i.size=e;i._head=t;i.__ownerID=r;i.__hash=n;i.__altered=false;return i}var Xr;function Yr(){return Xr||(Xr=qr(0))}function Kr(e,t){var r=function(r){e.prototype[r]=t[r]};Object.keys(t).forEach(r);Object.getOwnPropertySymbols&&Object.getOwnPropertySymbols(t).forEach(r);return e}r.Iterator=U;Kr(r,{toArray:function(){je(this.size);var e=new Array(this.size||0);this.valueSeq().__iterate(function(t,r){e[r]=t});return e},toIndexedSeq:function(){return new Yt(this)},toJS:function(){return this.toSeq().map(function(e){return e&&typeof e.toJS==="function"?e.toJS():e}).__toJS()},toJSON:function(){return this.toSeq().map(function(e){return e&&typeof e.toJSON==="function"?e.toJSON():e}).__toJS()},toKeyedSeq:function(){return new Xt(this,true)},toMap:function(){return Ge(this.toKeyedSeq())},toObject:function(){je(this.size);var e={};this.__iterate(function(t,r){e[r]=t});return e},toOrderedMap:function(){return zt(this.toKeyedSeq())},toOrderedSet:function(){return Fr(s(this)?this.valueSeq():this)},toSet:function(){return Ar(s(this)?this.valueSeq():this)},toSetSeq:function(){return new Kt(this)},toSeq:function(){return u(this)?this.toIndexedSeq():s(this)?this.toKeyedSeq():this.toSetSeq()},toStack:function(){return Hr(s(this)?this.valueSeq():this)},toList:function(){return Et(s(this)?this.valueSeq():this)},toString:function(){return"[Iterable]"},__toString:function(e,t){if(this.size===0){return e+t}return e+" "+this.toSeq().map(this.__toStringMapper).join(", ")+" "+t},concat:function(){var t=e.call(arguments,0);return pr(this,or(this,t))},includes:function(e){return this.some(function(t){return me(t,e)})},entries:function(){return this.__iterator(L)},every:function(e,t){je(this.size);var r=true;this.__iterate(function(n,i,a){if(!e.call(t,n,i,a)){r=false;return false}});return r},filter:function(e,t){return pr(this,er(this,e,t,true))},find:function(e,t,r){var n=this.findEntry(e,t);return n?n[1]:r},findEntry:function(e,t){var r;this.__iterate(function(n,i,a){if(e.call(t,n,i,a)){r=[i,n];return false}});return r},findLastEntry:function(e,t){return this.toSeq().reverse().findEntry(e,t)},forEach:function(e,t){je(this.size);return this.__iterate(t?e.bind(t):e)},join:function(e){je(this.size);e=e!==undefined?""+e:",";var t="";var r=true;this.__iterate(function(n){r?r=false:t+=e;t+=n!==null&&n!==undefined?n.toString():""});return t},keys:function(){return this.__iterator(D)},map:function(e,t){return pr(this,Jt(this,e,t))},reduce:function(e,t,r){je(this.size);var n;var i;if(arguments.length<2){i=true}else{n=t}this.__iterate(function(t,a,o){if(i){i=false;n=t}else{n=e.call(r,n,t,a,o)}});return n},reduceRight:function(e,t,r){var n=this.toKeyedSeq().reverse();return n.reduce.apply(n,arguments)},reverse:function(){return pr(this,$t(this,true))},slice:function(e,t){return pr(this,nr(this,e,t,true))},some:function(e,t){return!this.every(en(e),t)},sort:function(e){return pr(this,cr(this,e))},values:function(){return this.__iterator(B)},butLast:function(){return this.slice(0,-1)},isEmpty:function(){return this.size!==undefined?this.size===0:!this.some(function(){return true})},count:function(e,t){return T(e?this.toSeq().filter(e,t):this)},countBy:function(e,t){return tr(this,e,t)},equals:function(e){return ve(this,e)},entrySeq:function(){var e=this;if(e._cache){return new J(e._cache)}var t=e.toSeq().map($r).toIndexedSeq();t.fromEntrySeq=function(){return e.toSeq()};return t},filterNot:function(e,t){return this.filter(en(e),t)},findLast:function(e,t,r){return this.toKeyedSeq().reverse().find(e,t,r)},first:function(){return this.find(A)},flatMap:function(e,t){return pr(this,ur(this,e,t))},flatten:function(e){return pr(this,sr(this,e,true))},fromEntrySeq:function(){return new Qt(this)},get:function(e,t){return this.find(function(t,r){return me(r,e)},undefined,t)},getIn:function(e,t){var r=this;var n=_r(e);var i;while(!(i=n.next()).done){var a=i.value;r=r&&r.get?r.get(a,b):b;if(r===b){return t}}return r},groupBy:function(e,t){return rr(this,e,t)},has:function(e){return this.get(e,b)!==b},hasIn:function(e){return this.getIn(e,b)!==b},isSubset:function(e){e=typeof e.includes==="function"?e:r(e);return this.every(function(t){return e.includes(t)})},isSuperset:function(e){e=typeof e.isSubset==="function"?e:r(e);return e.isSubset(this)},keySeq:function(){return this.toSeq().map(Jr).toIndexedSeq()},last:function(){return this.toSeq().reverse().first()},max:function(e){return fr(this,e)},maxBy:function(e,t){return fr(this,t,e)},min:function(e){return fr(this,e?tn(e):an)},minBy:function(e,t){return fr(this,t?tn(t):an,e)},rest:function(){return this.slice(1)},skip:function(e){return this.slice(Math.max(0,e))},skipLast:function(e){return pr(this,this.toSeq().reverse().skip(e).reverse())},skipWhile:function(e,t){return pr(this,ar(this,e,t,true))},skipUntil:function(e,t){return this.skipWhile(en(e),t)},sortBy:function(e,t){return pr(this,cr(this,t,e))},take:function(e){return this.slice(0,Math.max(0,e))},takeLast:function(e){return pr(this,this.toSeq().reverse().take(e).reverse())},takeWhile:function(e,t){return pr(this,ir(this,e,t))},takeUntil:function(e,t){return this.takeWhile(en(e),t)},valueSeq:function(){return this.toIndexedSeq()},hashCode:function(){return this.__hash||(this.__hash=on(this))}});var Qr=r.prototype;Qr[f]=true;Qr[O]=Qr.values;Qr.__toJS=Qr.toArray;Qr.__toStringMapper=rn;Qr.inspect=Qr.toSource=function(){return this.toString()};Qr.chain=Qr.flatMap;Qr.contains=Qr.includes;(function(){try{Object.defineProperty(Qr,"length",{get:function(){if(!r.noLengthWarning){var e;try{throw new Error}
163catch(t){e=t.stack}if(e.indexOf("_wrapObject")===-1){console&&console.warn&&console.warn("iterable.length has been deprecated, "+"use iterable.size or iterable.count(). "+"This warning will become a silent error in a future version. "+e);return this.size}}}})}catch(e){}})();Kr(n,{flip:function(){return pr(this,Zt(this))},findKey:function(e,t){var r=this.findEntry(e,t);return r&&r[0]},findLastKey:function(e,t){return this.toSeq().reverse().findKey(e,t)},keyOf:function(e){return this.findKey(function(t){return me(t,e)})},lastKeyOf:function(e){return this.findLastKey(function(t){return me(t,e)})},mapEntries:function(e,t){var r=this;var n=0;return pr(this,this.toSeq().map(function(i,a){return e.call(t,[a,i],n++,r)}).fromEntrySeq())},mapKeys:function(e,t){var r=this;return pr(this,this.toSeq().flip().map(function(n,i){return e.call(t,n,i,r)}).flip())}});var Zr=n.prototype;Zr[h]=true;Zr[O]=Qr.entries;Zr.__toJS=Qr.toObject;Zr.__toStringMapper=function(e,t){return JSON.stringify(t)+": "+rn(e)};Kr(i,{toKeyedSeq:function(){return new Xt(this,false)},filter:function(e,t){return pr(this,er(this,e,t,false))},findIndex:function(e,t){var r=this.findEntry(e,t);return r?r[0]:-1},indexOf:function(e){var t=this.toKeyedSeq().keyOf(e);return t===undefined?-1:t},lastIndexOf:function(e){var t=this.toKeyedSeq().reverse().keyOf(e);return t===undefined?-1:t},reverse:function(){return pr(this,$t(this,false))},slice:function(e,t){return pr(this,nr(this,e,t,false))},splice:function(e,t){var r=arguments.length;t=Math.max(t|0,0);if(r===0||r===2&&!t){return this}e=R(e,e<0?this.count():this.size);var n=this.slice(0,e);return pr(this,r===1?n:n.concat(S(arguments,2),this.slice(e+t)))},findLastIndex:function(e,t){var r=this.toKeyedSeq().findLastKey(e,t);return r===undefined?-1:r},first:function(){return this.get(0)},flatten:function(e){return pr(this,sr(this,e,false))},get:function(e,t){e=M(this,e);return e<0||(this.size===Infinity||this.size!==undefined&&e>this.size)?t:this.find(function(t,r){return r===e},undefined,t)},has:function(e){e=M(this,e);return e>=0&&(this.size!==undefined?this.size===Infinity||e<this.size:this.indexOf(e)!==-1)},interpose:function(e){return pr(this,lr(this,e))},interleave:function(){var e=[this].concat(S(arguments));var t=dr(this.toSeq(),K.of,e);var r=t.flatten(true);if(t.size){r.size=t.size*e.length}return pr(this,r)},last:function(){return this.get(-1)},skipWhile:function(e,t){return pr(this,ar(this,e,t,false))},zip:function(){var e=[this].concat(S(arguments));return pr(this,dr(this,nn,e))},zipWith:function(e){var t=S(arguments);t[0]=this;return pr(this,dr(this,e,t))}});i.prototype[d]=true;i.prototype[p]=true;Kr(a,{get:function(e,t){return this.has(e)?e:t},includes:function(e){return this.has(e)},keySeq:function(){return this.valueSeq()}});a.prototype.has=Qr.includes;a.prototype.contains=a.prototype.includes;Kr(Y,n.prototype);Kr(K,i.prototype);Kr(Q,a.prototype);Kr(Ce,n.prototype);Kr(Ee,i.prototype);Kr(Se,a.prototype);function Jr(e,t){return t}function $r(e,t){return[t,e]}function en(e){return function(){return!e.apply(this,arguments)}}function tn(e){return function(){return-e.apply(this,arguments)}}function rn(e){return typeof e==="string"?JSON.stringify(e):e}function nn(){return S(arguments)}function an(e,t){return e<t?1:e>t?-1:0}function on(e){if(e.size===Infinity){return 0}var t=c(e);var r=s(e);var n=t?1:0;var i=e.__iterate(r?t?function(e,t){n=31*n+un(Ae(e),Ae(t))|0}:function(e,t){n=n+un(Ae(e),Ae(t))|0}:t?function(e){n=31*n+Ae(e)|0}:function(e){n=n+Ae(e)|0});return sn(i,n)}function sn(e,t){t=Te(t,3432918353);t=Te(t<<15|t>>>-15,461845907);t=Te(t<<13|t>>>-13,5);t=(t+3864292196|0)^e;t=Te(t^t>>>16,2246822507);t=Te(t^t>>>13,3266489909);t=Me(t^t>>>16);return t}function un(e,t){return e^t+2654435769+(e<<6)+(e>>2)|0}var ln={Iterable:r,Seq:X,Collection:we,Map:Ge,OrderedMap:zt,List:Et,Stack:Hr,Set:Ar,OrderedSet:Fr,Record:wr,Range:xe,Repeat:ye,is:me,fromJS:fe};return ln});/** @license zlib.js 2012 - imaya [ https://github.com/imaya/zlib.js ] The MIT License */ 164var l={};(function(){"use strict";function e(e){throw e}var t=void 0,r=!0,n=this;function i(e,r){var i=e.split("."),a=n;!(i[0]in a)&&a.execScript&&a.execScript("var "+i[0]);for(var o;i.length&&(o=i.shift());)!i.length&&r!==t?a[o]=r:a=a[o]?a[o]:a[o]={}}var a="undefined"!==typeof Uint8Array&&"undefined"!==typeof Uint16Array&&"undefined"!==typeof Uint32Array&&"undefined"!==typeof DataView;function o(t,r){this.index="number"===typeof r?r:0;this.m=0;this.buffer=t instanceof(a?Uint8Array:Array)?t:new(a?Uint8Array:Array)(32768);2*this.buffer.length<=this.index&&e(Error("invalid index"));this.buffer.length<=this.index&&this.f()}o.prototype.f=function(){var e=this.buffer,t,r=e.length,n=new(a?Uint8Array:Array)(r<<1);if(a)n.set(e);else for(t=0;t<r;++t)n[t]=e[t];return this.buffer=n};o.prototype.d=function(e,t,r){var n=this.buffer,i=this.index,a=this.m,o=n[i],s;r&&1<t&&(e=8<t?(h[e&255]<<24|h[e>>>8&255]<<16|h[e>>>16&255]<<8|h[e>>>24&255])>>32-t:h[e]>>8-t);if(8>t+a)o=o<<t|e,a+=t;else for(s=0;s<t;++s)o=o<<1|e>>t-s-1&1,8===++a&&(a=0,n[i++]=h[o],o=0,i===n.length&&(n=this.f()));n[i]=o;this.buffer=n;this.m=a;this.index=i};o.prototype.finish=function(){var e=this.buffer,t=this.index,r;0<this.m&&(e[t]<<=8-this.m,e[t]=h[e[t]],t++);a?r=e.subarray(0,t):(e.length=t,r=e);return r};var s=new(a?Uint8Array:Array)(256),u;for(u=0;256>u;++u){for(var l=u,c=l,f=7,l=l>>>1;l;l>>>=1)c<<=1,c|=l&1,--f;s[u]=(c<<f&255)>>>0}var h=s;function d(e,t,r){var n,i="number"===typeof t?t:t=0,a="number"===typeof r?r:e.length;n=-1;for(i=a&7;
vendor: 5,188 bytes, line 164
164i--;++t)n=n>>>8^m[(n^e[t])&255];for(i=a>>3;i--;t+=8)n=n>>>8^m[(n^e[t])&255],n=n>>>8^m[(n^e[t+1])&255],n=n>>>8^m[(n^e[t+2])&255],n=n>>>8^m[(n^e[t+3])&255],n=n>>>8^m[(n^e[t+4])&255],n=n>>>8^m[(n^e[t+5])&255],n=n>>>8^m[(n^e[t+6])&255],n=n>>>8^m[(n^e[t+7])&255];return(n^4294967295)>>>0}var p=[0,1996959894,3993919788,2567524794,124634137,1886057615,3915621685,2657392035,249268274,2044508324,3772115230,2547177864,162941995,2125561021,3887607047,2428444049,498536548,1789927666,4089016648,2227061214,450548861,1843258603,4107580753,2211677639,325883990,1684777152,4251122042,2321926636,335633487,1661365465,4195302755,2366115317,997073096,1281953886,3579855332,2724688242,1006888145,1258607687,3524101629,2768942443,901097722,1119000684,3686517206,2898065728,853044451,1172266101,3705015759,2882616665,651767980,1373503546,3369554304,3218104598,565507253,1454621731,3485111705,3099436303,671266974,1594198024,3322730930,2970347812,795835527,1483230225,3244367275,3060149565,1994146192,31158534,2563907772,4023717930,1907459465,112637215,2680153253,3904427059,2013776290,251722036,2517215374,3775830040,2137656763,141376813,2439277719,3865271297,1802195444,476864866,2238001368,4066508878,1812370925,453092731,2181625025,4111451223,1706088902,314042704,2344532202,4240017532,1658658271,366619977,2362670323,4224994405,1303535960,984961486,2747007092,3569037538,1256170817,1037604311,2765210733,3554079995,1131014506,879679996,2909243462,3663771856,1141124467,855842277,2852801631,3708648649,1342533948,654459306,3188396048,3373015174,1466479909,544179635,3110523913,3462522015,1591671054,702138776,2966460450,3352799412,1504918807,783551873,3082640443,3233442989,3988292384,2596254646,62317068,1957810842,3939845945,2647816111,81470997,1943803523,3814918930,2489596804,225274430,2053790376,3826175755,2466906013,167816743,2097651377,4027552580,2265490386,503444072,1762050814,4150417245,2154129355,426522225,1852507879,4275313526,2312317920,282753626,1742555852,4189708143,2394877945,397917763,1622183637,3604390888,2714866558,953729732,1340076626,3518719985,2797360999,1068828381,1219638859,3624741850,2936675148,906185462,1090812512,3747672003,2825379669,829329135,1181335161,3412177804,3160834842,628085408,1382605366,3423369109,3138078467,570562233,1426400815,3317316542,2998733608,733239954,1555261956,3268935591,3050360625,752459403,1541320221,2607071920,3965973030,1969922972,40735498,2617837225,3943577151,1913087877,83908371,2512341634,3803740692,2075208622,213261112,2463272603,3855990285,2094854071,198958881,2262029012,4057260610,1759359992,534414190,2176718541,4139329115,1873836001,414664567,2282248934,4279200368,1711684554,285281116,2405801727,4167216745,1634467795,376229701,2685067896,3608007406,1308918612,956543938,2808555105,3495958263,1231636301,1047427035,2932959818,3654703836,1088359270,936918e3,2847714899,3736837829,1202900863,817233897,3183342108,3401237130,1404277552,615818150,3134207493,3453421203,1423857449,601450431,3009837614,3294710456,1567103746,711928724,3020668471,3272380065,1510334235,755167117],m=a?new Uint32Array(p):p;function v(){}v.prototype.getName=function(){return this.name};v.prototype.getData=function(){return this.data};v.prototype.Y=function(){return this.Z};i("Zlib.GunzipMember",v);i("Zlib.GunzipMember.prototype.getName",v.prototype.getName);i("Zlib.GunzipMember.prototype.getData",v.prototype.getData);i("Zlib.GunzipMember.prototype.getMtime",v.prototype.Y);function y(e){this.buffer=new(a?Uint16Array:Array)(2*e);this.length=0}y.prototype.getParent=function(e){return 2*((e-2)/4|0)};y.prototype.push=function(e,t){var r,n,i=this.buffer,a;r=this.length;i[this.length++]=t;for(i[this.length++]=e;0<r;)if(n=this.getParent(r),i[r]>i[n])a=i[r],i[r]=i[n],i[n]=a,a=i[r+1],i[r+1]=i[n+1],i[n+1]=a,r=n;else break;return this.length};y.prototype.pop=function(){var e,t,r=this.buffer,n,i,a;t=r[0];e=r[1];this.length-=2;r[0]=r[this.length];r[1]=r[this.length+1];for(a=0;;){i=2*a+2;if(i>=this.length)break;i+2<this.length&&r[i+2]>r[i]&&(i+=2);if(r[i]>r[a])n=r[a],r[a]=r[i],r[i]=n,n=r[a+1],r[a+1]=r[i+1],r[i+1]=n;else break;a=i}return{index:e,value:t,length:this.length}};function g(e){var t=e.length,r=0,n=Number.POSITIVE_INFINITY,i,o,s,u,l,c,f,h,d,p;for(h=0;h<t;++h)e[h]>r&&(r=e[h]),e[h]<n&&(n=e[h]);i=1<<r;o=new(a?Uint32Array:Array)(i);s=1;u=0;for(l=2;s<=r;){for(h=0;h<t;++h)if(e[h]===s){c=0;f=u;for(d=0;d<s;++d)c=c<<1|f&1,f>>=1;p=s<<16|h;for(d=c;d<i;d+=l)o[d]=p;++u}++s;u<<=1;l<<=1}return[o,r,n]}function b(e,t){this.k=x;this.I=0;this.input=a&&e instanceof Array?new Uint8Array(e):e;this.b=0;t&&(t.lazy&&(this.I=t.lazy),"number"===typeof t.compressionType&&(this.k=t.compressionType),t.outputBuffer&&(this.a=a&&t.outputBuffer instanceof Array?new Uint8Array(t.outputBuffer):t.outputBuffer),"number"===typeof t.outputIndex&&(this.b=t.outputIndex));this.a||(this.a=new(a?Uint8Array:Array)(32768))}var x=2,_={NONE:0,v:1,o:x,ba:3},w=[],C;for(C=0;288>C;C++)switch(r){case 143>=C:w.push([C+48,8]);break;case 255>=C:w.push([C-144+400,9]);break;case 279>=C:w.push([C-256+0,7]);break;case 287>=C:w.push([C-280+192,8]);break;default:e("invalid literal: "+C)}b.prototype.g=function(){var n,i,s,u,l=this.input;switch(this.k){case 0:s=0;for(u=l.length;s<u;
vendor: 6,315 bytes, line 164
164){i=a?l.subarray(s,s+65535):l.slice(s,s+65535);s+=i.length;var c=i,f=s===u,h=t,d=t,p=t,m=t,v=t,y=this.a,g=this.b;if(a){for(y=new Uint8Array(this.a.buffer);y.length<=g+c.length+5;)y=new Uint8Array(y.length<<1);y.set(this.a)}h=f?1:0;y[g++]=h|0;d=c.length;p=~d+65536&65535;y[g++]=d&255;y[g++]=d>>>8&255;y[g++]=p&255;y[g++]=p>>>8&255;if(a)y.set(c,g),g+=c.length,y=y.subarray(0,g);else{m=0;for(v=c.length;m<v;++m)y[g++]=c[m];y.length=g}this.b=g;this.a=y}break;case 1:var b=new o(a?new Uint8Array(this.a.buffer):this.a,this.b);b.d(1,1,r);b.d(1,2,r);var _=M(this,l),C,E,S;C=0;for(E=_.length;C<E;C++)if(S=_[C],o.prototype.d.apply(b,w[S]),256<S)b.d(_[++C],_[++C],r),b.d(_[++C],5),b.d(_[++C],_[++C],r);else if(256===S)break;this.a=b.finish();this.b=this.a.length;break;case x:var T=new o(a?new Uint8Array(this.a.buffer):this.a,this.b),A,R,I,D,B,L=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],F,V,O,U,N,z=Array(19),H,j,G,W,q;A=x;T.d(1,1,r);T.d(A,2,r);R=M(this,l);F=P(this.W,15);V=k(F);O=P(this.V,7);U=k(O);for(I=286;257<I&&0===F[I-1];I--);for(D=30;1<D&&0===O[D-1];D--);var X=I,Y=D,K=new(a?Uint32Array:Array)(X+Y),Q,Z,J,$,ee=new(a?Uint32Array:Array)(316),te,re,ne=new(a?Uint8Array:Array)(19);for(Q=Z=0;Q<X;Q++)K[Z++]=F[Q];for(Q=0;Q<Y;Q++)K[Z++]=O[Q];if(!a){Q=0;for($=ne.length;Q<$;++Q)ne[Q]=0}Q=te=0;for($=K.length;Q<$;Q+=Z){for(Z=1;Q+Z<$&&K[Q+Z]===K[Q];++Z);J=Z;if(0===K[Q])if(3>J)for(;0<J--;)ee[te++]=0,ne[0]++;else for(;0<J;)re=138>J?J:138,re>J-3&&re<J&&(re=J-3),10>=re?(ee[te++]=17,ee[te++]=re-3,ne[17]++):(ee[te++]=18,ee[te++]=re-11,ne[18]++),J-=re;else if(ee[te++]=K[Q],ne[K[Q]]++,J--,3>J)for(;0<J--;)ee[te++]=K[Q],ne[K[Q]]++;else for(;0<J;)re=6>J?J:6,re>J-3&&re<J&&(re=J-3),ee[te++]=16,ee[te++]=re-3,ne[16]++,J-=re}n=a?ee.subarray(0,te):ee.slice(0,te);N=P(ne,7);for(W=0;19>W;W++)z[W]=N[L[W]];for(B=19;4<B&&0===z[B-1];B--);H=k(N);T.d(I-257,5,r);T.d(D-1,5,r);T.d(B-4,4,r);for(W=0;W<B;W++)T.d(z[W],3,r);W=0;for(q=n.length;W<q;W++)if(j=n[W],T.d(H[j],N[j],r),16<=j){W++;switch(j){case 16:G=2;break;case 17:G=3;break;case 18:G=7;break;default:e("invalid code: "+j)}T.d(n[W],G,r)}var ie=[V,F],ae=[U,O],oe,se,ue,le,ce,fe,he,de;ce=ie[0];fe=ie[1];he=ae[0];de=ae[1];oe=0;for(se=R.length;oe<se;++oe)if(ue=R[oe],T.d(ce[ue],fe[ue],r),256<ue)T.d(R[++oe],R[++oe],r),le=R[++oe],T.d(he[le],de[le],r),T.d(R[++oe],R[++oe],r);else if(256===ue)break;this.a=T.finish();this.b=this.a.length;break;default:e("invalid compression type")}return this.a};function E(e,t){this.length=e;this.Q=t}var S=function(){function t(t){switch(r){case 3===t:return[257,t-3,0];case 4===t:return[258,t-4,0];case 5===t:return[259,t-5,0];case 6===t:return[260,t-6,0];case 7===t:return[261,t-7,0];case 8===t:return[262,t-8,0];case 9===t:return[263,t-9,0];case 10===t:return[264,t-10,0];case 12>=t:return[265,t-11,1];case 14>=t:return[266,t-13,1];case 16>=t:return[267,t-15,1];case 18>=t:return[268,t-17,1];case 22>=t:return[269,t-19,2];case 26>=t:return[270,t-23,2];case 30>=t:return[271,t-27,2];case 34>=t:return[272,t-31,2];case 42>=t:return[273,t-35,3];case 50>=t:return[274,t-43,3];case 58>=t:return[275,t-51,3];case 66>=t:return[276,t-59,3];case 82>=t:return[277,t-67,4];case 98>=t:return[278,t-83,4];case 114>=t:return[279,t-99,4];case 130>=t:return[280,t-115,4];case 162>=t:return[281,t-131,5];case 194>=t:return[282,t-163,5];case 226>=t:return[283,t-195,5];case 257>=t:return[284,t-227,5];case 258===t:return[285,t-258,0];default:e("invalid length: "+t)}}var n=[],i,a;for(i=3;258>=i;i++)a=t(i),n[i]=a[2]<<24|a[1]<<16|a[0];return n}(),T=a?new Uint32Array(S):S;function M(n,i){function o(t,n){var i=t.Q,a=[],o=0,s;s=T[t.length];a[o++]=s&65535;a[o++]=s>>16&255;a[o++]=s>>24;var u;switch(r){case 1===i:u=[0,i-1,0];break;case 2===i:u=[1,i-2,0];break;case 3===i:u=[2,i-3,0];break;case 4===i:u=[3,i-4,0];break;case 6>=i:u=[4,i-5,1];break;case 8>=i:u=[5,i-7,1];break;case 12>=i:u=[6,i-9,2];break;case 16>=i:u=[7,i-13,2];break;case 24>=i:u=[8,i-17,3];break;case 32>=i:u=[9,i-25,3];break;case 48>=i:u=[10,i-33,4];break;case 64>=i:u=[11,i-49,4];break;case 96>=i:u=[12,i-65,5];break;case 128>=i:u=[13,i-97,5];break;case 192>=i:u=[14,i-129,6];break;case 256>=i:u=[15,i-193,6];break;case 384>=i:u=[16,i-257,7];break;case 512>=i:u=[17,i-385,7];break;case 768>=i:u=[18,i-513,8];break;case 1024>=i:u=[19,i-769,8];break;case 1536>=i:u=[20,i-1025,9];break;case 2048>=i:u=[21,i-1537,9];break;case 3072>=i:u=[22,i-2049,10];break;case 4096>=i:u=[23,i-3073,10];break;case 6144>=i:u=[24,i-4097,11];break;case 8192>=i:u=[25,i-6145,11];break;case 12288>=i:u=[26,i-8193,12];break;case 16384>=i:u=[27,i-12289,12];break;case 24576>=i:u=[28,i-16385,13];break;case 32768>=i:u=[29,i-24577,13];break;default:e("invalid distance")}s=u;a[o++]=s[0];a[o++]=s[1];a[o++]=s[2];var l,c;l=0;for(c=a.length;l<c;++l)v[y++]=a[l];b[a[0]]++;x[a[3]]++;g=t.length+n-1;m=null}var s,u,l,c,f,h={},d,p,m,v=a?new Uint16Array(2*i.length):[],y=0,g=0,b=new(a?Uint32Array:Array)(286),x=new(a?Uint32Array:Array)(30),_=n.I,w;if(!a){for(l=0;285>=l;)b[l++]=0;for(l=0;29>=l;)x[l++]=0}b[256]=1;s=0;for(u=i.length;s<u;++s){l=f=0;for(c=3;l<c&&s+l!==u;++l)f=f<<8|i[s+l];h[f]===t&&(h[f]=[]);d=h[f];if(!(0<g--)){for(;0<d.length&&32768<s-d[0];)d.shift();if(s+3>=u){m&&o(m,-1);l=0;for(c=u-s;l<c;++l)w=i[s+l],v[y++]=w,++b[w];break}0<d.length?(p=A(i,s,d),m?m.length<p.length?(w=i[s-1],v[y++]=w,++b[w],o(p,0)):o(m,-1):p.length<_?m=p:o(p,0)):m?o(m,-1):(w=i[s],v[y++]=w,++b[w])}d.push(s)}v[y++]=256;b[256]++;n.W=b;n.V=x;return a?v.subarray(0,y):v}function A(e,t,r){var n,i,a=0,o,s,u,l,c=e.length;s=0;l=r.length;e:for(;s<l;s++){n=r[l-s-1];o=3;if(3<a){for(u=a;3<u;u--)if(e[n+u-1]!==e[t+u-1])continue e;o=a}for(;258>o&&t+o<c&&e[n+o]===e[t+o];)++o;o>a&&(i=n,a=o);if(258===o)break}return new E(a,t-i)}function P(e,t){var r=e.length,n=new y(572),i=new(a?Uint8Array:Array)(r),o,s,u,l,c;if(!a)for(l=0;l<r;l++)i[l]=0;for(l=0;l<r;++l)0<e[l]&&n.push(l,e[l]);o=Array(n.length/2);s=new(a?Uint32Array:Array)(n.length/2);if(1===o.length)return i[n.pop().index]=1,i;l=0;for(c=n.length/2;l<c;++l)o[l]=n.pop(),s[l]=o[l].value;u=R(s,s.length,t);l=0;for(c=o.length;l<c;++l)i[o[l].index]=u[l];return i}function R(e,t,r){function n(e){var r=l[e][c[e]];r===t?(n(e+1),n(e+1)):--s[r];++c[e]}var i=new(a?Uint16Array:Array)(r),o=new(a?Uint8Array:Array)(r),s=new(a?Uint8Array:Array)(t),u=Array(r),l=Array(r),c=Array(r),f=(1<<r)-t,h=1<<r-1,d,p,m,v,y;i[r-1]=t;
vendor: 12,447 bytes, lines 164-199
164for(p=0;p<r;++p)f<h?o[p]=0:(o[p]=1,f-=h),f<<=1,i[r-2-p]=(i[r-1-p]/2|0)+t;i[0]=o[0];u[0]=Array(i[0]);l[0]=Array(i[0]);for(p=1;p<r;++p)i[p]>2*i[p-1]+o[p]&&(i[p]=2*i[p-1]+o[p]),u[p]=Array(i[p]),l[p]=Array(i[p]);for(d=0;d<t;++d)s[d]=r;for(m=0;m<i[r-1];++m)u[r-1][m]=e[m],l[r-1][m]=m;for(d=0;d<r;++d)c[d]=0;1===o[r-1]&&(--s[0],++c[r-1]);for(p=r-2;0<=p;--p){v=d=0;y=c[p+1];for(m=0;m<i[p];m++)v=u[p+1][y]+u[p+1][y+1],v>e[d]?(u[p][m]=v,l[p][m]=t,y+=2):(u[p][m]=e[d],l[p][m]=d,++d);c[p]=0;1===o[p]&&n(p)}return s}function k(e){var t=new(a?Uint16Array:Array)(e.length),r=[],n=[],i=0,o,s,u,l;o=0;for(s=e.length;o<s;o++)r[e[o]]=(r[e[o]]|0)+1;o=1;for(s=16;o<=s;o++)n[o]=i,i+=r[o]|0,i<<=1;o=0;for(s=e.length;o<s;o++){i=n[e[o]];n[e[o]]+=1;u=t[o]=0;for(l=e[o];u<l;u++)t[o]=t[o]<<1|i&1,i>>>=1}return t}function I(e,t){this.input=e;this.b=this.c=0;this.i={};t&&(t.flags&&(this.i=t.flags),"string"===typeof t.filename&&(this.filename=t.filename),"string"===typeof t.comment&&(this.A=t.comment),t.deflateOptions&&(this.l=t.deflateOptions));this.l||(this.l={})}I.prototype.g=function(){var e,r,n,i,o,s,u,l,c=new(a?Uint8Array:Array)(32768),f=0,h=this.input,p=this.c,m=this.filename,v=this.A;c[f++]=31;c[f++]=139;c[f++]=8;e=0;this.i.fname&&(e|=L);this.i.fcomment&&(e|=F);this.i.fhcrc&&(e|=B);c[f++]=e;r=(Date.now?Date.now():+new Date)/1e3|0;c[f++]=r&255;c[f++]=r>>>8&255;c[f++]=r>>>16&255;c[f++]=r>>>24&255;c[f++]=0;c[f++]=D;if(this.i.fname!==t){u=0;for(l=m.length;u<l;++u)s=m.charCodeAt(u),255<s&&(c[f++]=s>>>8&255),c[f++]=s&255;c[f++]=0}if(this.i.comment){u=0;for(l=v.length;u<l;++u)s=v.charCodeAt(u),255<s&&(c[f++]=s>>>8&255),c[f++]=s&255;c[f++]=0}this.i.fhcrc&&(n=d(c,0,f)&65535,c[f++]=n&255,c[f++]=n>>>8&255);this.l.outputBuffer=c;this.l.outputIndex=f;o=new b(h,this.l);c=o.g();f=o.b;a&&(f+8>c.buffer.byteLength?(this.a=new Uint8Array(f+8),this.a.set(new Uint8Array(c.buffer)),c=this.a):c=new Uint8Array(c.buffer));i=d(h,t,t);c[f++]=i&255;c[f++]=i>>>8&255;c[f++]=i>>>16&255;c[f++]=i>>>24&255;l=h.length;c[f++]=l&255;c[f++]=l>>>8&255;c[f++]=l>>>16&255;c[f++]=l>>>24&255;this.c=p;a&&f<c.length&&(this.a=c=c.subarray(0,f));return c};var D=255,B=2,L=8,F=16;i("Zlib.Gzip",I);i("Zlib.Gzip.prototype.compress",I.prototype.g);function V(t,r){this.p=[];this.q=32768;this.e=this.j=this.c=this.u=0;this.input=a?new Uint8Array(t):t;this.w=!1;this.r=U;this.M=!1;if(r||!(r={}))r.index&&(this.c=r.index),r.bufferSize&&(this.q=r.bufferSize),r.bufferType&&(this.r=r.bufferType),r.resize&&(this.M=r.resize);switch(this.r){case O:this.b=32768;this.a=new(a?Uint8Array:Array)(32768+this.q+258);break;case U:this.b=0;this.a=new(a?Uint8Array:Array)(this.q);this.f=this.U;this.B=this.R;this.s=this.T;break;default:e(Error("invalid inflate mode"))}}var O=0,U=1,N={O:O,N:U};V.prototype.h=function(){for(;!this.w;){var n=ae(this,3);n&1&&(this.w=r);n>>>=1;switch(n){case 0:var i=this.input,o=this.c,s=this.a,u=this.b,l=i.length,c=t,f=t,h=s.length,d=t;this.e=this.j=0;o+1>=l&&e(Error("invalid uncompressed block header: LEN"));c=i[o++]|i[o++]<<8;o+1>=l&&e(Error("invalid uncompressed block header: NLEN"));f=i[o++]|i[o++]<<8;c===~f&&e(Error("invalid uncompressed block header: length verify"));o+c>i.length&&e(Error("input buffer is broken"));switch(this.r){case O:for(;u+c>s.length;){d=h-u;c-=d;if(a)s.set(i.subarray(o,o+d),u),u+=d,o+=d;else for(;d--;)s[u++]=i[o++];this.b=u;s=this.f();u=this.b}break;case U:for(;u+c>s.length;)s=this.f({F:2});break;default:e(Error("invalid inflate mode"))}if(a)s.set(i.subarray(o,o+c),u),u+=c,o+=c;else for(;c--;)s[u++]=i[o++];this.c=o;this.b=u;this.a=s;break;case 1:this.s(ee,ie);break;case 2:se(this);break;default:e(Error("unknown BTYPE: "+n))}}return this.B()};var z=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],H=a?new Uint16Array(z):z,j=[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,258,258],G=a?new Uint16Array(j):j,W=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0],q=a?new Uint8Array(W):W,X=[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],Y=a?new Uint16Array(X):X,K=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],Q=a?new Uint8Array(K):K,Z=new(a?Uint8Array:Array)(288),J,$;J=0;for($=Z.length;J<$;++J)Z[J]=143>=J?8:255>=J?9:279>=J?7:8;var ee=g(Z),te=new(a?Uint8Array:Array)(30),re,ne;re=0;for(ne=te.length;re<ne;++re)te[re]=5;var ie=g(te);function ae(t,r){for(var n=t.j,i=t.e,a=t.input,o=t.c,s=a.length,u;i<r;)o>=s&&e(Error("input buffer is broken")),n|=a[o++]<<i,i+=8;u=n&(1<<r)-1;t.j=n>>>r;t.e=i-r;t.c=o;return u}function oe(e,t){for(var r=e.j,n=e.e,i=e.input,a=e.c,o=i.length,s=t[0],u=t[1],l,c;n<u&&!(a>=o);)r|=i[a++]<<n,n+=8;l=s[r&(1<<u)-1];c=l>>>16;e.j=r>>c;e.e=n-c;e.c=a;return l&65535}function se(e){function t(e,t,r){var n,i=this.J,a,o;for(o=0;o<e;)switch(n=oe(this,t),n){case 16:for(a=3+ae(this,2);a--;)r[o++]=i;break;case 17:for(a=3+ae(this,3);a--;)r[o++]=0;i=0;break;case 18:for(a=11+ae(this,7);a--;)r[o++]=0;i=0;break;default:i=r[o++]=n}this.J=i;return r}var r=ae(e,5)+257,n=ae(e,5)+1,i=ae(e,4)+4,o=new(a?Uint8Array:Array)(H.length),s,u,l,c;for(c=0;c<i;++c)o[H[c]]=ae(e,3);if(!a){c=i;for(i=o.length;c<i;++c)o[H[c]]=0}s=g(o);u=new(a?Uint8Array:Array)(r);l=new(a?Uint8Array:Array)(n);e.J=0;e.s(g(t.call(e,r,s,u)),g(t.call(e,n,s,l)))}V.prototype.s=function(e,t){var r=this.a,n=this.b;this.C=e;for(var i=r.length-258,a,o,s,u;256!==(a=oe(this,e));)if(256>a)n>=i&&(this.b=n,r=this.f(),n=this.b),r[n++]=a;else{o=a-257;u=G[o];0<q[o]&&(u+=ae(this,q[o]));a=oe(this,t);s=Y[a];0<Q[a]&&(s+=ae(this,Q[a]));n>=i&&(this.b=n,r=this.f(),n=this.b);for(;u--;)r[n]=r[n++-s]}for(;8<=this.e;)this.e-=8,this.c--;this.b=n};V.prototype.T=function(e,t){var r=this.a,n=this.b;this.C=e;for(var i=r.length,a,o,s,u;256!==(a=oe(this,e));)if(256>a)n>=i&&(r=this.f(),i=r.length),r[n++]=a;else{o=a-257;u=G[o];0<q[o]&&(u+=ae(this,q[o]));a=oe(this,t);s=Y[a];0<Q[a]&&(s+=ae(this,Q[a]));n+u>i&&(r=this.f(),i=r.length);for(;u--;)r[n]=r[n++-s]}for(;8<=this.e;)this.e-=8,this.c--;this.b=n};V.prototype.f=function(){var e=new(a?Uint8Array:Array)(this.b-32768),t=this.b-32768,r,n,i=this.a;if(a)e.set(i.subarray(32768,e.length));else{r=0;for(n=e.length;r<n;++r)e[r]=i[r+32768]}this.p.push(e);this.u+=e.length;if(a)i.set(i.subarray(t,t+32768));else for(r=0;32768>r;++r)i[r]=i[t+r];this.b=32768;return i};V.prototype.U=function(e){var t,r=this.input.length/this.c+1|0,n,i,o,s=this.input,u=this.a;e&&("number"===typeof e.F&&(r=e.F),"number"===typeof e.P&&(r+=e.P));2>r?(n=(s.length-this.c)/this.C[2],o=258*(n/2)|0,i=o<u.length?u.length+o:u.length<<1):i=u.length*r;a?(t=new Uint8Array(i),t.set(u)):t=u;return this.a=t};V.prototype.B=function(){var e=0,t=this.a,r=this.p,n,i=new(a?Uint8Array:Array)(this.u+(this.b-32768)),o,s,u,l;if(0===r.length)return a?this.a.subarray(32768,this.b):this.a.slice(32768,this.b);o=0;for(s=r.length;o<s;++o){n=r[o];u=0;for(l=n.length;u<l;++u)i[e++]=n[u]}o=32768;for(s=this.b;o<s;++o)i[e++]=t[o];this.p=[];return this.buffer=i};V.prototype.R=function(){var e,t=this.b;a?this.M?(e=new Uint8Array(t),e.set(this.a.subarray(0,t))):e=this.a.subarray(0,t):(this.a.length>t&&(this.a.length=t),e=this.a);return this.buffer=e};function ue(e){this.input=e;this.c=0;this.t=[];this.D=!1}ue.prototype.X=function(){this.D||this.h();return this.t.slice()};ue.prototype.h=function(){for(var n=this.input.length;this.c<n;){var i=new v,o=t,s=t,u=t,l=t,c=t,f=t,h=t,p=t,m=t,y=this.input,g=this.c;i.G=y[g++];i.H=y[g++];(31!==i.G||139!==i.H)&&e(Error("invalid file signature:"+i.G+","+i.H));i.z=y[g++];switch(i.z){case 8:break;default:e(Error("unknown compression method: "+i.z))}i.n=y[g++];p=y[g++]|y[g++]<<8|y[g++]<<16|y[g++]<<24;i.Z=new Date(1e3*p);i.fa=y[g++];i.ea=y[g++];0<(i.n&4)&&(i.aa=y[g++]|y[g++]<<8,g+=i.aa);if(0<(i.n&L)){h=[];for(f=0;0<(c=y[g++]);)h[f++]=String.fromCharCode(c);i.name=h.join("")}if(0<(i.n&F)){h=[];for(f=0;0<(c=y[g++]);)h[f++]=String.fromCharCode(c);i.A=h.join("")}0<(i.n&B)&&(i.S=d(y,0,g)&65535,i.S!==(y[g++]|y[g++]<<8)&&e(Error("invalid header crc16")));o=y[y.length-4]|y[y.length-3]<<8|y[y.length-2]<<16|y[y.length-1]<<24;y.length-g-4-4<512*o&&(l=o);s=new V(y,{index:g,bufferSize:l});i.data=u=s.h();g=s.c;i.ca=m=(y[g++]|y[g++]<<8|y[g++]<<16|y[g++]<<24)>>>0;d(u,t,t)!==m&&e(Error("invalid CRC-32 checksum: 0x"+d(u,t,t).toString(16)+" / 0x"+m.toString(16)));i.da=o=(y[g++]|y[g++]<<8|y[g++]<<16|y[g++]<<24)>>>0;(u.length&4294967295)!==o&&e(Error("invalid input size: "+(u.length&4294967295)+" / "+o));this.t.push(i);this.c=g}this.D=r;var b=this.t,x,_,w=0,C=0,E;x=0;for(_=b.length;x<_;++x)C+=b[x].data.length;if(a){E=new Uint8Array(C);for(x=0;x<_;++x)E.set(b[x].data,w),w+=b[x].data.length}else{E=[];for(x=0;x<_;++x)E[x]=b[x].data;E=Array.prototype.concat.apply([],E)}return E};i("Zlib.Gunzip",ue);i("Zlib.Gunzip.prototype.decompress",ue.prototype.h);i("Zlib.Gunzip.prototype.getMembers",ue.prototype.X);function le(e){if("string"===typeof e){var t=e.split(""),r,n;r=0;for(n=t.length;r<n;r++)t[r]=(t[r].charCodeAt(0)&255)>>>0;e=t}for(var i=1,a=0,o=e.length,s,u=0;0<o;){s=1024<o?1024:o;o-=s;do{i+=e[u++],a+=i}while(--s);i%=65521;a%=65521}return(a<<16|i)>>>0}function ce(t,r){var n,i;this.input=t;this.c=0;if(r||!(r={}))r.index&&(this.c=r.index),r.verify&&(this.$=r.verify);n=t[this.c++];i=t[this.c++];switch(n&15){case fe:this.method=fe;break;default:e(Error("unsupported compression method"))}0!==((n<<8)+i)%31&&e(Error("invalid fcheck flag:"+((n<<8)+i)%31));i&32&&e(Error("fdict flag is not supported"));this.L=new V(t,{index:this.c,bufferSize:r.bufferSize,bufferType:r.bufferType,resize:r.resize})}ce.prototype.h=function(){var t=this.input,r,n;r=this.L.h();this.c=this.L.c;this.$&&(n=(t[this.c++]<<24|t[this.c++]<<16|t[this.c++]<<8|t[this.c++])>>>0,n!==le(r)&&e(Error("invalid adler-32 checksum")));return r};var fe=8;function he(e,t){this.input=e;this.a=new(a?Uint8Array:Array)(32768);this.k=de.o;var r={},n;if((t||!(t={}))&&"number"===typeof t.compressionType)this.k=t.compressionType;for(n in t)r[n]=t[n];r.outputBuffer=this.a;this.K=new b(this.input,r)}var de=_;he.prototype.g=function(){var t,r,n,i,o,s,u,l=0;u=this.a;t=fe;switch(t){case fe:r=Math.LOG2E*Math.log(32768)-8;break;default:e(Error("invalid compression method"))}n=r<<4|t;u[l++]=n;switch(t){case fe:switch(this.k){case de.NONE:o=0;break;case de.v:o=1;break;case de.o:o=2;break;default:e(Error("unsupported compression type"))}break;default:e(Error("invalid compression method"))}i=o<<6|0;u[l++]=i|31-(256*n+i)%31;s=le(this.input);this.K.b=l;u=this.K.g();l=u.length;a&&(u=new Uint8Array(u.buffer),u.length<=l+4&&(this.a=new Uint8Array(u.length+4),this.a.set(u),u=this.a),u=u.subarray(0,l+4));u[l++]=s>>24&255;u[l++]=s>>16&255;u[l++]=s>>8&255;u[l++]=s&255;return u};function pe(e,t){var r,n,a,o;if(Object.keys)r=Object.keys(t);else for(n in r=[],a=0,t)r[a++]=n;a=0;for(o=r.length;a<o;++a)n=r[a],i(e+"."+n,t[n])}i("Zlib.Inflate",ce);i("Zlib.Inflate.prototype.decompress",ce.prototype.h);pe("Zlib.Inflate.BufferType",{ADAPTIVE:N.N,BLOCK:N.O});i("Zlib.Deflate",he);i("Zlib.Deflate.compress",function(e,t){return new he(e,t).g()});i("Zlib.Deflate.prototype.compress",he.prototype.g);pe("Zlib.Deflate.CompressionType",{NONE:de.NONE,FIXED:de.v,DYNAMIC:de.o})}).call(l);var c=l.Zlib;/** 165 * React v15.6.1 166 * 167 * Copyright 2013-present, Facebook, Inc. 168 * All rights reserved. 169 * 170 * This source code is licensed under the BSD-style license found in the 171 * LICENSE file in the root directory of this source tree. An additional grant 172 * of patent rights can be found in the PATENTS file in the same directory. 173 * 174 */ 175/* 176 177BSD License 178 179For React software 180 181Copyright (c) 2013-present, Facebook, Inc. 182All rights reserved. 183 184Redistribution and use in source and binary forms, with or without modification, 185are permitted provided that the following conditions are met: 186 187 * Redistributions of source code must retain the above copyright notice, this 188 list of conditions and the following disclaimer. 189 190 * Redistributions in binary form must reproduce the above copyright notice, 191 this list of conditions and the following disclaimer in the documentation 192 and/or other materials provided with the distribution. 193 194 * Neither the name Facebook nor the names of its contributors may be used to 195 endorse or promote products derived from this software without specific 196 prior written permission. 197 198THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 199ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
200WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 201DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR 202ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 203(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 204LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 205ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 206(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 207SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 208 209*/ 210var f;(function(){var e={};var t={};!function(r){if("object"==typeof e&&"undefined"!=typeof t)t.exports=r();else if("function"==typeof define&&define.amd)define([],r);else{var n;n="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,n.React=r()}}(function(){return function e(t,r,n){function i(o,s){if(!r[o]){if(!t[o]){var u=void 0;if(!s&&u)return u(o,!0);if(a)return a(o,!0);var l=new Error("Cannot find __module__ '"+o+"'");throw l.code="__module___NOT_FOUND",l}var c=r[o]={exports:{}};t[o][0].call(c.exports,function(e){var r=t[o][1][e];return i(r||e)},c,c.exports,e,t,r,n)}return r[o].exports}for(var a=void 0,o=0;o<n.length;o++)i(n[o]);return i}({1:[function(e,t,r){"use strict";function n(e){var t={"=":"=0",":":"=2"};return"$"+(""+e).replace(/[=:]/g,function(e){return t[e]})}function i(e){var t=/(=0|=2)/g,r={"=0":"=","=2":":"};return(""+("."===e[0]&&"$"===e[1]?e.substring(2):e.substring(1))).replace(t,function(e){return r[e]})}var a={escape:n,unescape:i};t.exports=a},{}],2:[function(e,t,r){"use strict";var n=e(19),i=(e(24),function(e){var t=this;if(t.instancePool.length){var r=t.instancePool.pop();return t.call(r,e),r}return new t(e)}),a=function(e,t){var r=this;if(r.instancePool.length){var n=r.instancePool.pop();return r.call(n,e,t),n}return new r(e,t)},o=function(e,t,r){var n=this;if(n.instancePool.length){var i=n.instancePool.pop();return n.call(i,e,t,r),i}return new n(e,t,r)},s=function(e,t,r,n){var i=this;if(i.instancePool.length){var a=i.instancePool.pop();return i.call(a,e,t,r,n),a}return new i(e,t,r,n)},u=function(e){var t=this;e instanceof t||n("25"),e.destructor(),t.instancePool.length<t.poolSize&&t.instancePool.push(e)},l=i,c=function(e,t){var r=e;return r.instancePool=[],r.getPooled=t||l,r.poolSize||(r.poolSize=10),r.release=u,r},f={addPoolingTo:c,oneArgumentPooler:i,twoArgumentPooler:a,threeArgumentPooler:o,fourArgumentPooler:s};t.exports=f},{19:19,24:24}],3:[function(e,t,r){"use strict";var n=e(26),i=e(4),a=e(5),o=e(7),s=e(8),u=e(11),l=e(13),c=e(15),f=e(18),h=s.createElement,d=s.createFactory,p=s.cloneElement,m=n,v=function(e){return e},y={Children:{map:a.map,forEach:a.forEach,count:a.count,toArray:a.toArray,only:f},Component:i.Component,PureComponent:i.PureComponent,createElement:h,cloneElement:p,isValidElement:s.isValidElement,PropTypes:u,createClass:c,createFactory:d,createMixin:v,DOM:o,version:l,__spread:m};t.exports=y},{11:11,13:13,15:15,18:18,26:26,4:4,5:5,7:7,8:8}],4:[function(e,t,r){"use strict";function n(e,t,r){this.props=e,this.context=t,this.refs=l,this.updater=r||u}function i(e,t,r){this.props=e,this.context=t,this.refs=l,this.updater=r||u}function a(){}var o=e(19),s=e(26),u=e(10),l=(e(14),e(23));e(24),e(17);n.prototype.isReactComponent={},n.prototype.setState=function(e,t){"object"!=typeof e&&"function"!=typeof e&&null!=e&&o("85"),this.updater.enqueueSetState(this,e),t&&this.updater.enqueueCallback(this,t,"setState")},n.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this),e&&this.updater.enqueueCallback(this,e,"forceUpdate")};a.prototype=n.prototype,i.prototype=new a,i.prototype.constructor=i,s(i.prototype,n.prototype),i.prototype.isPureReactComponent=!0,t.exports={Component:n,PureComponent:i}},{10:10,14:14,17:17,19:19,23:23,24:24,26:26}],5:[function(e,t,r){"use strict";function n(e){return(""+e).replace(x,"$&/")}function i(e,t){this.func=e,this.context=t,this.count=0}function a(e,t,r){var n=e.func,i=e.context;n.call(i,t,e.count++)}function o(e,t,r){if(null==e)return e;var n=i.getPooled(t,r);y(e,a,n),i.release(n)}function s(e,t,r,n){this.result=e,this.keyPrefix=t,this.func=r,this.context=n,this.count=0}function u(e,t,r){var i=e.result,a=e.keyPrefix,o=e.func,s=e.context,u=o.call(s,t,e.count++);Array.isArray(u)?l(u,i,r,v.thatReturnsArgument):null!=u&&(m.isValidElement(u)&&(u=m.cloneAndReplaceKey(u,a+(!u.key||t&&t.key===u.key?"":n(u.key)+"/")+r)),i.push(u))}function l(e,t,r,i,a){var o="";null!=r&&(o=n(r)+"/");var l=s.getPooled(t,o,i,a);y(e,u,l),s.release(l)}function c(e,t,r){if(null==e)return e;var n=[];return l(e,n,null,t,r),n}function f(e,t,r){return null}function h(e,t){return y(e,f,null)}function d(e){var t=[];return l(e,t,null,v.thatReturnsArgument),t}var p=e(2),m=e(8),v=e(22),y=e(20),g=p.twoArgumentPooler,b=p.fourArgumentPooler,x=/\/+/g;i.prototype.destructor=function(){this.func=null,this.context=null,this.count=0},p.addPoolingTo(i,g),s.prototype.destructor=function(){this.result=null,this.keyPrefix=null,this.func=null,this.context=null,this.count=0},p.addPoolingTo(s,b);var _={forEach:o,map:c,mapIntoWithKeyPrefixInternal:l,count:h,toArray:d};t.exports=_},{2:2,20:20,22:22,8:8}],6:[function(e,t,r){"use strict";var n={current:null};t.exports=n},{}],7:[function(e,t,r){"use strict";var n=e(8),i=n.createFactory,a={a:i("a"),abbr:i("abbr"),address:i("address"),area:i("area"),article:i("article"),aside:i("aside"),audio:i("audio"),b:i("b"),base:i("base"),bdi:i("bdi"),bdo:i("bdo"),big:i("big"),blockquote:i("blockquote"),body:i("body"),br:i("br"),button:i("button"),canvas:i("canvas"),caption:i("caption"),cite:i("cite"),code:i("code"),col:i("col"),colgroup:i("colgroup"),data:i("data"),datalist:i("datalist"),dd:i("dd"),del:i("del"),details:i("details"),dfn:i("dfn"),dialog:i("dialog"),div:i("div"),dl:i("dl"),dt:i("dt"),em:i("em"),embed:i("embed"),fieldset:i("fieldset"),figcaption:i("figcaption"),figure:i("figure"),footer:i("footer"),form:i("form"),h1:i("h1"),h2:i("h2"),h3:i("h3"),h4:i("h4"),h5:i("h5"),h6:i("h6"),head:i("head"),header:i("header"),hgroup:i("hgroup"),hr:i("hr"),html:i("html"),i:i("i"),iframe:i("iframe"),img:i("img"),input:i("input"),ins:i("ins"),kbd:i("kbd"),keygen:i("keygen"),label:i("label"),legend:i("legend"),li:i("li"),link:i("link"),main:i("main"),map:i("map"),mark:i("mark"),menu:i("menu"),menuitem:i("menuitem"),meta:i("meta"),meter:i("meter"),nav:i("nav"),noscript:i("noscript"),object:i("object"),ol:i("ol"),optgroup:i("optgroup"),option:i("option"),output:i("output"),p:i("p"),param:i("param"),picture:i("picture"),pre:i("pre"),progress:i("progress"),q:i("q"),rp:i("rp"),rt:i("rt"),ruby:i("ruby"),s:i("s"),samp:i("samp"),script:i("script"),section:i("section"),select:i("select"),small:i("small"),source:i("source"),span:i("span"),strong:i("strong"),style:i("style"),sub:i("sub"),summary:i("summary"),sup:i("sup"),table:i("table"),tbody:i("tbody"),td:i("td"),textarea:i("textarea"),tfoot:i("tfoot"),th:i("th"),thead:i("thead"),time:i("time"),title:i("title"),tr:i("tr"),track:i("track"),u:i("u"),ul:i("ul"),var:i("var"),video:i("video"),wbr:i("wbr"),circle:i("circle"),clipPath:i("clipPath"),defs:i("defs"),ellipse:i("ellipse"),g:i("g"),image:i("image"),line:i("line"),linearGradient:i("linearGradient"),mask:i("mask"),path:i("path"),pattern:i("pattern"),polygon:i("polygon"),polyline:i("polyline"),radialGradient:i("radialGradient"),rect:i("rect"),stop:i("stop"),svg:i("svg"),text:i("text"),tspan:i("tspan")};t.exports=a},{8:8}],8:[function(e,t,r){"use strict";function n(e){return void 0!==e.ref}
210function i(e){return void 0!==e.key}var a=e(26),o=e(6),s=(e(25),e(14),Object.prototype.hasOwnProperty),u=e(9),l={key:!0,ref:!0,__self:!0,__source:!0},c=function(e,t,r,n,i,a,o){return{$$typeof:u,type:e,key:t,ref:r,props:o,_owner:a}};c.createElement=function(e,t,r){var a,u={},f=null,h=null;if(null!=t){n(t)&&(h=t.ref),i(t)&&(f=""+t.key),void 0===t.__self?null:t.__self,void 0===t.__source?null:t.__source;for(a in t)s.call(t,a)&&!l.hasOwnProperty(a)&&(u[a]=t[a])}var d=arguments.length-2;if(1===d)u.children=r;else if(d>1){for(var p=Array(d),m=0;m<d;m++)p[m]=arguments[m+2];u.children=p}if(e&&e.defaultProps){var v=e.defaultProps;for(a in v)void 0===u[a]&&(u[a]=v[a])}return c(e,f,h,0,0,o.current,u)},c.createFactory=function(e){var t=c.createElement.bind(null,e);return t.type=e,t},c.cloneAndReplaceKey=function(e,t){return c(e.type,t,e.ref,e._self,e._source,e._owner,e.props)},c.cloneElement=function(e,t,r){var u,f=a({},e.props),h=e.key,d=e.ref,p=(e._self,e._source,e._owner);if(null!=t){n(t)&&(d=t.ref,p=o.current),i(t)&&(h=""+t.key);var m;e.type&&e.type.defaultProps&&(m=e.type.defaultProps);for(u in t)s.call(t,u)&&!l.hasOwnProperty(u)&&(void 0===t[u]&&void 0!==m?f[u]=m[u]:f[u]=t[u])}var v=arguments.length-2;if(1===v)f.children=r;else if(v>1){for(var y=Array(v),g=0;g<v;g++)y[g]=arguments[g+2];f.children=y}return c(e.type,h,d,0,0,p,f)},c.isValidElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===u},t.exports=c},{14:14,25:25,26:26,6:6,9:9}],9:[function(e,t,r){"use strict";var n="function"==typeof Symbol&&Symbol.for&&Symbol.for("react.element")||60103;t.exports=n},{}],10:[function(e,t,r){"use strict";var n=(e(25),{isMounted:function(e){return!1},enqueueCallback:function(e,t){},enqueueForceUpdate:function(e){},enqueueReplaceState:function(e,t){},enqueueSetState:function(e,t){}});t.exports=n},{25:25}],11:[function(e,t,r){"use strict";var n=e(8),i=n.isValidElement,a=e(28);t.exports=a(i)},{28:28,8:8}],12:[function(e,t,r){"use strict";var n=e(26),i=e(3),a=n(i,{__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:{ReactCurrentOwner:e(6)}});t.exports=a},{26:26,3:3,6:6}],13:[function(e,t,r){"use strict";t.exports="15.6.1"},{}],14:[function(e,t,r){"use strict";t.exports=!1},{}],15:[function(e,t,r){"use strict";var n=e(4),i=n.Component,a=e(8),o=a.isValidElement,s=e(10),u=e(21);t.exports=u(i,o,s)},{10:10,21:21,4:4,8:8}],16:[function(e,t,r){"use strict";function n(e){var t=e&&(i&&e[i]||e[a]);if("function"==typeof t)return t}var i="function"==typeof Symbol&&Symbol.iterator,a="@@iterator";t.exports=n},{}],17:[function(e,t,r){"use strict";var n=function(){};t.exports=n},{}],18:[function(e,t,r){"use strict";function n(e){return a.isValidElement(e)||i("143"),e}var i=e(19),a=e(8);e(24);t.exports=n},{19:19,24:24,8:8}],19:[function(e,t,r){"use strict";function n(e){for(var t=arguments.length-1,r="Minified React error #"+e+"; visit http://facebook.github.io/react/docs/error-decoder.html?invariant="+e,n=0;n<t;n++)r+="&args[]="+encodeURIComponent(arguments[n+1]);r+=" for the full message or use the non-minified dev environment for full errors and additional helpful warnings.";var i=new Error(r);throw i.name="Invariant Violation",i.framesToPop=1,i}t.exports=n},{}],20:[function(e,t,r){"use strict";function n(e,t){return e&&"object"==typeof e&&null!=e.key?l.escape(e.key):t.toString(36)}function i(e,t,r,a){var h=typeof e;if("undefined"!==h&&"boolean"!==h||(e=null),null===e||"string"===h||"number"===h||"object"===h&&e.$$typeof===s)return r(a,e,""===t?c+n(e,0):t),1;var d,p,m=0,v=""===t?c:t+f;if(Array.isArray(e))for(var y=0;y<e.length;y++)d=e[y],p=v+n(d,y),m+=i(d,p,r,a);else{var g=u(e);if(g){var b,x=g.call(e);if(g!==e.entries)for(var _=0;!(b=x.next()).done;)d=b.value,p=v+n(d,_++),m+=i(d,p,r,a);else for(;!(b=x.next()).done;){var w=b.value;w&&(d=w[1],p=v+l.escape(w[0])+f+n(d,0),m+=i(d,p,r,a))}}else if("object"===h){var C=String(e);o("31","[object Object]"===C?"object with keys {"+Object.keys(e).join(", ")+"}":C,"")}}return m}function a(e,t,r){return null==e?0:i(e,"",t,r)}var o=e(19),s=(e(6),e(9)),u=e(16),l=(e(24),e(1)),c=(e(25),"."),f=":";t.exports=a},{1:1,16:16,19:19,24:24,25:25,6:6,9:9}],21:[function(e,t,r){"use strict";function n(e){return e}function i(e,t,r){function i(e,t){var r=g.hasOwnProperty(t)?g[t]:null;w.hasOwnProperty(t)&&s("OVERRIDE_BASE"===r,"ReactClassInterface: You are attempting to override `%s` from your class specification. Ensure that your method n
210ames do not overlap with React methods.",t),e&&s("DEFINE_MANY"===r||"DEFINE_MANY_MERGED"===r,"ReactClassInterface: You are attempting to define `%s` on your component more than once. This conflict may be due to a mixin.",t)}function l(e,r){if(r){s("function"!=typeof r,"ReactClass: You're attempting to use a component class or function as a mixin. Instead, just use a regular object."),s(!t(r),"ReactClass: You're attempting to use a component as a mixin. Instead, just use a regular object.");var n=e.prototype,a=n.__reactAutoBindPairs;r.hasOwnProperty(u)&&b.mixins(e,r.mixins);for(var o in r)if(r.hasOwnProperty(o)&&o!==u){var l=r[o],c=n.hasOwnProperty(o);if(i(c,o),b.hasOwnProperty(o))b[o](e,l);else{var f=g.hasOwnProperty(o),p="function"==typeof l,m=p&&!f&&!c&&!1!==r.autobind;if(m)a.push(o,l),n[o]=l;else if(c){var v=g[o];s(f&&("DEFINE_MANY_MERGED"===v||"DEFINE_MANY"===v),"ReactClass: Unexpected spec policy %s for key %s when mixing in component specs.",v,o),"DEFINE_MANY_MERGED"===v?n[o]=h(n[o],l):"DEFINE_MANY"===v&&(n[o]=d(n[o],l))}else n[o]=l}}}else;}function c(e,t){if(t)for(var r in t){var n=t[r];if(t.hasOwnProperty(r)){var i=r in b;s(!i,'ReactClass: You are attempting to define a reserved property, `%s`, that shouldn\'t be on the "statics" key. Define it as an instance property instead; it will still be accessible on the constructor.',r);var a=r in e;s(!a,"ReactClass: You are attempting to define `%s` on your component more than once. This conflict may be due to a mixin.",r),e[r]=n}}}function f(e,t){s(e&&t&&"object"==typeof e&&"object"==typeof t,"mergeIntoWithNoDuplicateKeys(): Cannot merge non-objects.");for(var r in t)t.hasOwnProperty(r)&&(s(void 0===e[r],"mergeIntoWithNoDuplicateKeys(): Tried to merge two objects with the same key: `%s`. This conflict may be due to a mixin; in particular, this may be caused by two getInitialState() or getDefaultProps() methods returning objects with clashing keys.",r),e[r]=t[r]);return e}function h(e,t){return function(){var r=e.apply(this,arguments),n=t.apply(this,arguments);if(null==r)return n;if(null==n)return r;var i={};return f(i,r),f(i,n),i}}function d(e,t){return function(){e.apply(this,arguments),t.apply(this,arguments)}}function p(e,t){var r=t.bind(e);return r}function m(e){for(var t=e.__reactAutoBindPairs,r=0;r<t.length;r+=2){var n=t[r],i=t[r+1];e[n]=p(e,i)}}function v(e){var t=n(function(e,n,i){this.__reactAutoBindPairs.length&&m(this),this.props=e,this.context=n,this.refs=o,this.updater=i||r,this.state=null;var a=this.getInitialState?this.getInitialState():null;s("object"==typeof a&&!Array.isArray(a),"%s.getInitialState(): must return an object or null",t.displayName||"ReactCompositeComponent"),this.state=a});t.prototype=new C,t.prototype.constructor=t,t.prototype.__reactAutoBindPairs=[],y.forEach(l.bind(null,t)),l(t,x),l(t,e),l(t,_),t.getDefaultProps&&(t.defaultProps=t.getDefaultProps()),s(t.prototype.render,"createClass(...): Class specification must implement a `render` method.");for(var i in g)t.prototype[i]||(t.prototype[i]=null);return t}var y=[],g={mixins:"DEFINE_MANY",statics:"DEFINE_MANY",propTypes:"DEFINE_MANY",contextTypes:"DEFINE_MANY",childContextTypes:"DEFINE_MANY",getDefaultProps:"DEFINE_MANY_MERGED",getInitialState:"DEFINE_MANY_MERGED",getChildContext:"DEFINE_MANY_MERGED",render:"DEFINE_ONCE",componentWillMount:"DEFINE_MANY",componentDidMount:"DEFINE_MANY",componentWillReceiveProps:"DEFINE_MANY",shouldComponentUpdate:"DEFINE_ONCE",componentWillUpdate:"DEFINE_MANY",componentDidUpdate:"DEFINE_MANY",componentWillUnmount:"DEFINE_MANY",updateComponent:"OVERRIDE_BASE"},b={displayName:function(e,t){e.displayName=t},mixins:function(e,t){if(t)for(var r=0;r<t.length;r++)l(e,t[r])},childContextTypes:function(e,t){e.childContextTypes=a({},e.childContextTypes,t)},contextTypes:function(e,t){e.contextTypes=a({},e.contextTypes,t)},getDefaultProps:function(e,t){e.getDefaultProps?e.getDefaultProps=h(e.getDefaultProps,t):e.getDefaultProps=t},propTypes:function(e,t){e.propTypes=a({},e.propTypes,t)},statics:function(e,t){c(e,t)},autobind:function(){}},x={componentDidMount:function(){this.__isMounted=!0}},_={componentWillUnmount:function(){this.__isMounted=!1}},w={replaceState:function(e,t){this.updater.enqueueReplaceState(this,e,t)},isMounted:function(){return!!this.__isMounted}},C=function(){};return a(C.prototype,e.prototype,w),v}var a=e(26),o=e(23),s=e(24),u="mixins";t.exports=i},{23:23,24:24,25:25,26:26}],22:[function(e,t,r){"use strict";function n(e){return function(){return e}}var i=function(){};i.thatReturns=n,i.thatReturnsFalse=n(!1),i.thatReturnsTrue=n(!0),i.thatReturnsNull=n(null),i.thatReturnsThis=function(){return this},i.thatReturnsArgument=function(e){return e},t.exports=i},{}],23:[function(e,t,r){"use strict";var n={};t.exports=n},{}],24:[function(e,t,r){"use strict";function n(e,t,r,n,a,o,s,u){if(i(t),!e){var l;if(void 0===t)l=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var c=[r,n,a,o,s,u],f=0;l=new Error(t.replace(/%s/g,function(){return c[f++]})),l.name="Invariant Violation"}throw l.framesToPop=1,l}}var i=function(e){};t.exports=n},{}],25:[function(e,t,r){"use strict";var n=e(22),i=n;t.exports=i},{22:22}],26:[function(e,t,r){"use strict";function n(e){if(null===e||void 0===e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}var i=Object.getOwnPropertySymbols,a=Object.prototype.hasOwnProperty,o=Object.prototype.propertyIsEnumerable;t.exports=function(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},r=0;r<10;r++)t["_"+String.fromCharCode(r)]=r;if("0123456789"!==Object.getOwnPropertyNames(t).map(function(e){return t[e]}).join(""))return!1;var n={};return"abcdefghijklmnopqrst".split("").forEach(function(e){n[e]=e}),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},n)).join("")}catch(e){return!1}}()?Object.assign:function(e,t){for(var r,s,u=n(e),l=1;l<arguments.length;l++){r=Object(arguments[l]);for(var c in r)a.call(r,c)&&(u[c]=r[c]);if(i){s=i(r);for(var f=0;f<s.length;f++)o.call(r,s[f])&&(u[s[f]]=r[s[f]])}}return u}},{}],27:[function(e,t,r){"use strict";function n(e,t,r,n,i){}t.exports=n},{24:24,25:25,30:30}],28:[function(e,t,r){"use strict";var n=e(29);t.exports=function(e){return n(e,!1)}},{29:29}],29:[function(e,t,r){"use strict";var n=e(22),i=e(24),a=e(25),o=e(30),s=e(27);t.exports=function(e,t){function r(e){var t=e&&(E&&e[E]||e[S]);if("function"==typeof t)return t}function u(e,t){return e===t?0!==e||1/e==1/t:e!==e&&t!==t}function l(e){this.message=e,this.stack=""}function c(e){function r(r,n,a,s,u,c,f){if(s=s||T,c=c||a,f!==o)if(t)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");else;return null==n[a]?r?new l(null===n[a]?"The "+u+" `"+c+"` is marked as required in `"+s+"`, but its value is `null`.":"The "+u+" `"+c+"` is marked as required in `"+s+"`, but its value is `undefined`."):null:e(n,a,s,u,c)}var n=r.bind(null,!1);return n.isRequired=r.bind(null,!0),n}function f(e){function t(t,r,n,i,a,o){var s=t[r];
vendor: 5,267 bytes, lines 210-245
210if(x(s)!==e)return new l("Invalid "+i+" `"+a+"` of type `"+_(s)+"` supplied to `"+n+"`, expected `"+e+"`.");return null}return c(t)}function h(e){function t(t,r,n,i,a){if("function"!=typeof e)return new l("Property `"+a+"` of component `"+n+"` has invalid PropType notation inside arrayOf.");var s=t[r];if(!Array.isArray(s)){return new l("Invalid "+i+" `"+a+"` of type `"+x(s)+"` supplied to `"+n+"`, expected an array.")}for(var u=0;u<s.length;u++){var c=e(s,u,n,i,a+"["+u+"]",o);if(c instanceof Error)return c}return null}return c(t)}function d(e){function t(t,r,n,i,a){if(!(t[r]instanceof e)){var o=e.name||T;return new l("Invalid "+i+" `"+a+"` of type `"+C(t[r])+"` supplied to `"+n+"`, expected instance of `"+o+"`.")}return null}return c(t)}function p(e){function t(t,r,n,i,a){for(var o=t[r],s=0;s<e.length;s++)if(u(o,e[s]))return null;return new l("Invalid "+i+" `"+a+"` of value `"+o+"` supplied to `"+n+"`, expected one of "+JSON.stringify(e)+".")}return Array.isArray(e)?c(t):n.thatReturnsNull}function m(e){function t(t,r,n,i,a){if("function"!=typeof e)return new l("Property `"+a+"` of component `"+n+"` has invalid PropType notation inside objectOf.");var s=t[r],u=x(s);if("object"!==u)return new l("Invalid "+i+" `"+a+"` of type `"+u+"` supplied to `"+n+"`, expected an object.");for(var c in s)if(s.hasOwnProperty(c)){var f=e(s,c,n,i,a+"."+c,o);if(f instanceof Error)return f}return null}return c(t)}function v(e){function t(t,r,n,i,a){for(var s=0;s<e.length;s++){if(null==(0,e[s])(t,r,n,i,a,o))return null}return new l("Invalid "+i+" `"+a+"` supplied to `"+n+"`.")}if(!Array.isArray(e))return n.thatReturnsNull;for(var r=0;r<e.length;r++){var i=e[r];if("function"!=typeof i)return a(!1,"Invalid argument supplid to oneOfType. Expected an array of check functions, but received %s at index %s.",w(i),r),n.thatReturnsNull}return c(t)}function y(e){function t(t,r,n,i,a){var s=t[r],u=x(s);if("object"!==u)return new l("Invalid "+i+" `"+a+"` of type `"+u+"` supplied to `"+n+"`, expected `object`.");for(var c in e){var f=e[c];if(f){var h=f(s,c,n,i,a+"."+c,o);if(h)return h}}return null}return c(t)}function g(t){switch(typeof t){case"number":case"string":case"undefined":return!0;case"boolean":return!t;case"object":if(Array.isArray(t))return t.every(g);if(null===t||e(t))return!0;var n=r(t);if(!n)return!1;var i,a=n.call(t);if(n!==t.entries){for(;!(i=a.next()).done;)if(!g(i.value))return!1}else for(;!(i=a.next()).done;){var o=i.value;if(o&&!g(o[1]))return!1}return!0;default:return!1}}function b(e,t){return"symbol"===e||("Symbol"===t["@@toStringTag"]||"function"==typeof Symbol&&t instanceof Symbol)}function x(e){var t=typeof e;return Array.isArray(e)?"array":e instanceof RegExp?"object":b(t,e)?"symbol":t}function _(e){if(void 0===e||null===e)return""+e;var t=x(e);if("object"===t){if(e instanceof Date)return"date";if(e instanceof RegExp)return"regexp"}return t}function w(e){var t=_(e);switch(t){case"array":case"object":return"an "+t;case"boolean":case"date":case"regexp":return"a "+t;default:return t}}function C(e){return e.constructor&&e.constructor.name?e.constructor.name:T}var E="function"==typeof Symbol&&Symbol.iterator,S="@@iterator",T="<<anonymous>>",M={array:f("array"),bool:f("boolean"),func:f("function"),number:f("number"),object:f("object"),string:f("string"),symbol:f("symbol"),any:function(){return c(n.thatReturnsNull)}(),arrayOf:h,element:function(){function t(t,r,n,i,a){var o=t[r];if(!e(o)){return new l("Invalid "+i+" `"+a+"` of type `"+x(o)+"` supplied to `"+n+"`, expected a single ReactElement.")}return null}return c(t)}(),instanceOf:d,node:function(){function e(e,t,r,n,i){return g(e[t])?null:new l("Invalid "+n+" `"+i+"` supplied to `"+r+"`, expected a ReactNode.")}return c(e)}(),objectOf:m,oneOf:p,oneOfType:v,shape:y};return l.prototype=Error.prototype,M.checkPropTypes=s,M.PropTypes=M,M}},{22:22,24:24,25:25,27:27,30:30}],30:[function(e,t,r){"use strict";t.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},{}]},{},[12])(12)});f=t.exports})();/** 211 * ReactDOM v15.6.1 212 * 213 * Copyright 2013-present, Facebook, Inc. 214 * All rights reserved. 215 * 216 * This source code is licensed under the BSD-style license found in the 217 * LICENSE file in the root directory of this source tree. An additional grant 218 * of patent rights can be found in the PATENTS file in the same directory. 219 * 220 */ 221/* 222 223BSD License 224 225For React software 226 227Copyright (c) 2013-present, Facebook, Inc. 228All rights reserved. 229 230Redistribution and use in source and binary forms, with or without modification, 231are permitted provided that the following conditions are met: 232 233 * Redistributions of source code must retain the above copyright notice, this 234 list of conditions and the following disclaimer. 235 236 * Redistributions in binary form must reproduce the above copyright notice, 237 this list of conditions and the following disclaimer in the documentation 238 and/or other materials provided with the distribution. 239 240 * Neither the name Facebook nor the names of its contributors may be used to 241 endorse or promote products derived from this software without specific 242 prior written permission. 243 244THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 245ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
246WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 247DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR 248ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 249(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 250LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 251ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 252(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 253SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 254 255*/ 256var h;(function(){var e={};var t={};!function(r){if("object"==typeof e&&"undefined"!=typeof t)t.exports=r(f);else{var n;n="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,n.ReactDOM=r(n.React)}}(function(e){return function(t){return function(){return function e(t,r,n){function i(o,s){if(!r[o]){if(!t[o]){var u=void 0;if(!s&&u)return u(o,!0);if(a)return a(o,!0);var l=new Error("Cannot find __module__ '"+o+"'");throw l.code="__module___NOT_FOUND",l}var c=r[o]={exports:{}};t[o][0].call(c.exports,function(e){var r=t[o][1][e];return i(r||e)},c,c.exports,e,t,r,n)}return r[o].exports}for(var a=void 0,o=0;o<n.length;o++)i(n[o]);return i}({1:[function(e,t,r){"use strict";var n={Properties:{"aria-current":0,"aria-details":0,"aria-disabled":0,"aria-hidden":0,"aria-invalid":0,"aria-keyshortcuts":0,"aria-label":0,"aria-roledescription":0,"aria-autocomplete":0,"aria-checked":0,"aria-expanded":0,"aria-haspopup":0,"aria-level":0,"aria-modal":0,"aria-multiline":0,"aria-multiselectable":0,"aria-orientation":0,"aria-placeholder":0,"aria-pressed":0,"aria-readonly":0,"aria-required":0,"aria-selected":0,"aria-sort":0,"aria-valuemax":0,"aria-valuemin":0,"aria-valuenow":0,"aria-valuetext":0,"aria-atomic":0,"aria-busy":0,"aria-live":0,"aria-relevant":0,"aria-dropeffect":0,"aria-grabbed":0,"aria-activedescendant":0,"aria-colcount":0,"aria-colindex":0,"aria-colspan":0,"aria-controls":0,"aria-describedby":0,"aria-errormessage":0,"aria-flowto":0,"aria-labelledby":0,"aria-owns":0,"aria-posinset":0,"aria-rowcount":0,"aria-rowindex":0,"aria-rowspan":0,"aria-setsize":0},DOMAttributeNames:{},DOMPropertyNames:{}};t.exports=n},{}],2:[function(e,t,r){"use strict";var n=e(33),i=e(132),a={focusDOMComponent:function(){i(n.getNodeFromInstance(this))}};t.exports=a},{132:132,33:33}],3:[function(e,t,r){"use strict";function n(e){return(e.ctrlKey||e.altKey||e.metaKey)&&!(e.ctrlKey&&e.altKey)}function i(e){switch(e){case"topCompositionStart":return S.compositionStart;case"topCompositionEnd":return S.compositionEnd;case"topCompositionUpdate":return S.compositionUpdate}}function a(e,t){return"topKeyDown"===e&&t.keyCode===g}function o(e,t){switch(e){case"topKeyUp":return-1!==y.indexOf(t.keyCode);case"topKeyDown":return t.keyCode!==g;case"topKeyPress":case"topMouseDown":case"topBlur":return!0;default:return!1}}function s(e){var t=e.detail;return"object"==typeof t&&"data"in t?t.data:null}function u(e,t,r,n){var u,l;if(b?u=i(e):M?o(e,r)&&(u=S.compositionEnd):a(e,r)&&(u=S.compositionStart),!u)return null;w&&(M||u!==S.compositionStart?u===S.compositionEnd&&M&&(l=M.getData()):M=p.getPooled(n));var c=m.getPooled(u,t,r,n);if(l)c.data=l;else{var f=s(r);null!==f&&(c.data=f)}return h.accumulateTwoPhaseDispatches(c),c}function l(e,t){switch(e){case"topCompositionEnd":return s(t);case"topKeyPress":return t.which!==C?null:(T=!0,E);case"topTextInput":var r=t.data;return r===E&&T?null:r;default:return null}}function c(e,t){if(M){if("topCompositionEnd"===e||!b&&o(e,t)){var r=M.getData();return p.release(M),M=null,r}return null}switch(e){case"topPaste":return null;case"topKeyPress":return t.which&&!n(t)?String.fromCharCode(t.which):null;case"topCompositionEnd":return w?null:t.data;default:return null}}function f(e,t,r,n){var i;if(!(i=_?l(e,r):c(e,r)))return null;var a=v.getPooled(S.beforeInput,t,r,n);return a.data=i,h.accumulateTwoPhaseDispatches(a),a}var h=e(19),d=e(124),p=e(20),m=e(78),v=e(82),y=[9,13,27,32],g=229,b=d.canUseDOM&&"CompositionEvent"in window,x=null;d.canUseDOM&&"documentMode"in document&&(x=document.documentMode);var _=d.canUseDOM&&"TextEvent"in window&&!x&&!function(){var e=window.opera;
256return"object"==typeof e&&"function"==typeof e.version&&parseInt(e.version(),10)<=12}(),w=d.canUseDOM&&(!b||x&&x>8&&x<=11),C=32,E=String.fromCharCode(C),S={beforeInput:{phasedRegistrationNames:{bubbled:"onBeforeInput",captured:"onBeforeInputCapture"},dependencies:["topCompositionEnd","topKeyPress","topTextInput","topPaste"]},compositionEnd:{phasedRegistrationNames:{bubbled:"onCompositionEnd",captured:"onCompositionEndCapture"},dependencies:["topBlur","topCompositionEnd","topKeyDown","topKeyPress","topKeyUp","topMouseDown"]},compositionStart:{phasedRegistrationNames:{bubbled:"onCompositionStart",captured:"onCompositionStartCapture"},dependencies:["topBlur","topCompositionStart","topKeyDown","topKeyPress","topKeyUp","topMouseDown"]},compositionUpdate:{phasedRegistrationNames:{bubbled:"onCompositionUpdate",captured:"onCompositionUpdateCapture"},dependencies:["topBlur","topCompositionUpdate","topKeyDown","topKeyPress","topKeyUp","topMouseDown"]}},T=!1,M=null,A={eventTypes:S,extractEvents:function(e,t,r,n){return[u(e,t,r,n),f(e,t,r,n)]}};t.exports=A},{124:124,19:19,20:20,78:78,82:82}],4:[function(e,t,r){"use strict";function n(e,t){return e+t.charAt(0).toUpperCase()+t.substring(1)}var i={animationIterationCount:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!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},a=["Webkit","ms","Moz","O"];
256Object.keys(i).forEach(function(e){a.forEach(function(t){i[n(t,e)]=i[e]})});var o={background:{backgroundAttachment:!0,backgroundColor:!0,backgroundImage:!0,backgroundPositionX:!0,backgroundPositionY:!0,backgroundRepeat:!0},backgroundPosition:{backgroundPositionX:!0,backgroundPositionY:!0},border:{borderWidth:!0,borderStyle:!0,borderColor:!0},borderBottom:{borderBottomWidth:!0,borderBottomStyle:!0,borderBottomColor:!0},borderLeft:{borderLeftWidth:!0,borderLeftStyle:!0,borderLeftColor:!0},borderRight:{borderRightWidth:!0,borderRightStyle:!0,borderRightColor:!0},borderTop:{borderTopWidth:!0,borderTopStyle:!0,borderTopColor:!0},font:{fontStyle:!0,fontVariant:!0,fontWeight:!0,fontSize:!0,lineHeight:!0,fontFamily:!0},outline:{outlineWidth:!0,outlineStyle:!0,outlineColor:!0}},s={isUnitlessNumber:i,shorthandPropertyExpansions:o};t.exports=s},{}],5:[function(e,t,r){"use strict";var n=e(4),i=e(124),a=(e(58),e(126),e(94)),o=e(137),s=e(141),u=(e(143),s(function(e){return o(e)})),l=!1,c="cssFloat";if(i.canUseDOM){var f=document.createElement("div").style;try{f.font=""}catch(e){l=!0}void 0===document.documentElement.style.cssFloat&&(c="styleFloat")}var h={createMarkupForStyles:function(e,t){var r="";for(var n in e)if(e.hasOwnProperty(n)){var i=0===n.indexOf("--"),o=e[n];null!=o&&(r+=u(n)+":",r+=a(n,o,t,i)+";")}return r||null},setValueForStyles:function(e,t,r){var i=e.style;for(var o in t)if(t.hasOwnProperty(o)){var s=0===o.indexOf("--"),u=a(o,t[o],r,s);if("float"!==o&&"cssFloat"!==o||(o=c),s)i.setProperty(o,u);else if(u)i[o]=u;else{var f=l&&n.shorthandPropertyExpansions[o];if(f)for(var h in f)i[h]="";else i[o]=""}}}};t.exports=h},{124:124,126:126,137:137,141:141,143:143,4:4,58:58,94:94}],6:[function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var i=e(113),a=e(24),o=(e(138),function(){function e(t){n(this,e),this._callbacks=null,this._contexts=null,this._arg=t}return e.prototype.enqueue=function(e,t){this._callbacks=this._callbacks||[],this._callbacks.push(e),this._contexts=this._contexts||[],this._contexts.push(t)},e.prototype.notifyAll=function(){var e=this._callbacks,t=this._contexts,r=this._arg;if(e&&t){e.length!==t.length&&i("24"),this._callbacks=null,this._contexts=null;for(var n=0;n<e.length;n++)e[n].call(t[n],r);e.length=0,t.length=0}},e.prototype.checkpoint=function(){return this._callbacks?this._callbacks.length:0},e.prototype.rollback=function(e){this._callbacks&&this._contexts&&(this._callbacks.length=e,this._contexts.length=e)},e.prototype.reset=function(){this._callbacks=null,this._contexts=null},e.prototype.destructor=function(){this.reset()},e}());t.exports=a.addPoolingTo(o)},{113:113,138:138,24:24}],7:[function(e,t,r){"use strict";function n(e,t,r){var n=T.getPooled(k.change,e,t,r);return n.type="change",w.accumulateTwoPhaseDispatches(n),n}function i(e){var t=e.nodeName&&e.nodeName.toLowerCase();return"select"===t||"input"===t&&"file"===e.type}function a(e){var t=n(D,e,A(e));S.batchedUpdates(o,t)}function o(e){_.enqueueEvents(e),_.processEventQueue(!1)}function s(e,t){I=e,D=t,I.attachEvent("onchange",a)}function u(){I&&(I.detachEvent("onchange",a),I=null,D=null)}function l(e,t){var r=M.updateValueIfChanged(e),n=!0===t.simulated&&F._allowSimulatedPassThrough;if(r||n)return e}function c(e,t){if("topChange"===e)return t}function f(e,t,r){"topFocus"===e?(u(),s(t,r)):"topBlur"===e&&u()}function h(e,t){I=e,D=t,I.attachEvent("onpropertychange",p)}function d(){I&&(I.detachEvent("onpropertychange",p),I=null,D=null)}function p(e){"value"===e.propertyName&&l(D,e)&&a(e)}function m(e,t,r){"topFocus"===e?(d(),h(t,r)):"topBlur"===e&&d()}function v(e,t,r){if("topSelectionChange"===e||"topKeyUp"===e||"topKeyDown"===e)return l(D,r)}function y(e){var t=e.nodeName;return t&&"input"===t.toLowerCase()&&("checkbox"===e.type||"radio"===e.type)}function g(e,t,r){if("topClick"===e)return l(t,r)}function b(e,t,r){if("topInput"===e||"topChange"===e)return l(t,r)}function x(e,t){if(null!=e){var r=e._wrapperState||t._wrapperState;if(r&&r.controlled&&"number"===t.type){var n=""+t.value;t.getAttribute("value")!==n&&t.setAttribute("value",n)}}}var _=e(16),w=e(19),C=e(124),E=e(33),S=e(71),T=e(80),M=e(108),A=e(102),P=e(110),R=e(111),k={change:{phasedReg
256istrationNames:{bubbled:"onChange",captured:"onChangeCapture"},dependencies:["topBlur","topChange","topClick","topFocus","topInput","topKeyDown","topKeyUp","topSelectionChange"]}},I=null,D=null,B=!1;C.canUseDOM&&(B=P("change")&&(!document.documentMode||document.documentMode>8));var L=!1;C.canUseDOM&&(L=P("input")&&(!("documentMode"in document)||document.documentMode>9));var F={eventTypes:k,_allowSimulatedPassThrough:!0,_isInputEventSupported:L,extractEvents:function(e,t,r,a){var o,s,u=t?E.getNodeFromInstance(t):window;if(i(u)?B?o=c:s=f:R(u)?L?o=b:(o=v,s=m):y(u)&&(o=g),o){var l=o(e,t,r);if(l)return n(l,r,a)}s&&s(e,u,t),"topBlur"===e&&x(t,u)}};t.exports=F},{102:102,108:108,110:110,111:111,124:124,16:16,19:19,33:33,71:71,80:80}],8:[function(e,t,r){"use strict";function n(e,t){return Array.isArray(t)&&(t=t[1]),t?t.nextSibling:e.firstChild}function i(e,t,r){c.insertTreeBefore(e,t,r)}function a(e,t,r){Array.isArray(t)?s(e,t[0],t[1],r):m(e,t,r)}function o(e,t){if(Array.isArray(t)){var r=t[1];t=t[0],u(e,t,r),e.removeChild(r)}e.removeChild(t)}function s(e,t,r,n){for(var i=t;;){var a=i.nextSibling;if(m(e,i,n),i===r)break;i=a}}function u(e,t,r){for(;;){var n=t.nextSibling;if(n===r)break;e.removeChild(n)}}function l(e,t,r){var n=e.parentNode,i=e.nextSibling;i===t?r&&m(n,document.createTextNode(r),i):r?(p(i,r),u(n,i,t)):u(n,e,t)}var c=e(9),f=e(13),h=(e(33),e(58),e(93)),d=e(115),p=e(116),m=h(function(e,t,r){e.insertBefore(t,r)}),v=f.dangerouslyReplaceNodeWithMarkup,y={dangerouslyReplaceNodeWithMarkup:v,replaceDelimitedText:l,processUpdates:function(e,t){for(var r=0;r<t.length;r++){var s=t[r];switch(s.type){case"INSERT_MARKUP":i(e,s.content,n(e,s.afterNode));break;case"MOVE_EXISTING":a(e,s.fromNode,n(e,s.afterNode));break;case"SET_MARKUP":d(e,s.content);break;case"TEXT_CONTENT":p(e,s.content);break;case"REMOVE_NODE":o(e,s.fromNode)}}}};t.exports=y},{115:115,116:116,13:13,33:33,58:58,9:9,93:93}],9:[function(e,t,r){"use strict";function n(e){if(p){var t=e.node,r=e.children;if(r.length)for(var n=0;n<r.length;n++)m(t,r[n],null);else null!=e.html?f(t,e.html):null!=e.text&&d(t,e.text)}}function i(e,t){e.parentNode.replaceChild(t.node,e),n(t)}function a(e,t){p?e.children.push(t):e.node.appendChild(t.node)}function o(e,t){p?e.html=t:f(e.node,t)}function s(e,t){p?e.text=t:d(e.node,t)}function u(){return this.node.nodeName}function l(e){return{node:e,children:[],html:null,text:null,toString:u}}var c=e(10),f=e(115),h=e(93),d=e(116),p="undefined"!=typeof document&&"number"==typeof document.documentMode||"undefined"!=typeof navigator&&"string"==typeof navigator.userAgent&&/\bEdge\/\d/.test(navigator.userAgent),m=h(function(e,t,r){11===t.node.nodeType||1===t.node.nodeType&&"object"===t.node.nodeName.toLowerCase()&&(null==t.node.namespaceURI||t.node.namespaceURI===c.html)?(n(t),e.insertBefore(t.node,r)):(e.insertBefore(t.node,r),n(t))});l.insertTreeBefore=m,l.replaceChildWithTree=i,l.queueChild=a,l.queueHTML=o,l.queueText=s,t.exports=l},{10:10,115:115,116:116,93:93}],10:[function(e,t,r){"use strict";var n={html:"http://www.w3.org/1999/xhtml",mathml:"http://www.w3.org/1998/Math/MathML",svg:"http://www.w3.org/2000/svg"};t.exports=n},{}],11:[function(e,t,r){"use strict";function n(e,t){return(e&t)===t}var i=e(113),a=(e(138),{MUST_USE_PROPERTY:1,HAS_BOOLEAN_VALUE:4,HAS_NUMERIC_VALUE:8,HAS_POSITIVE_NUMERIC_VALUE:24,HAS_OVERLOADED_BOOLEAN_VALUE:32,injectDOMPropertyConfig:function(e){var t=a,r=e.Properties||{},o=e.DOMAttributeNamespaces||{},u=e.DOMAttributeNames||{},l=e.DOMPropertyNames||{},c=e.DOMMutationMethods||{};e.isCustomAttribute&&s._isCustomAttributeFunctions.push(e.isCustomAttribute);for(var f in r){s.properties.hasOwnProperty(f)&&i("48",f);var h=f.toLowerCase(),d=r[f],p={attributeName:h,attributeNamespace:null,propertyName:f,mutationMethod:null,mustUseProperty:n(d,t.MUST_USE_PROPERTY),hasBooleanValue:n(d,t.HAS_BOOLEAN_VALUE),hasNumericValue:n(d,t.HAS_NUMERIC_VALUE),hasPositiveNumericValue:n(d,t.HAS_POSITIVE_NUMERIC_VALUE),hasOverloadedBooleanValue:n(d,t.HAS_OVERLOADED_BOOLEAN_VALUE)};if(p.hasBooleanValue+p.hasNumericValue+p.hasOverloadedBooleanValue<=1||i("50",f),u.hasOwnProperty(f)){var m=u[f];p.attributeName=m}o.hasOwnProperty(f)&&(p.attributeNamespace=o[f]),l.hasOwnProperty(f)&&(p.propertyName=l[f]),c.hasOwnProperty(f)&&(p.mutationMethod=c[f]),s.properties[f]=p}}}),o=":A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u
256037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD",s={ID_ATTRIBUTE_NAME:"data-reactid",ROOT_ATTRIBUTE_NAME:"data-reactroot",ATTRIBUTE_NAME_START_CHAR:o,ATTRIBUTE_NAME_CHAR:o+"\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040",properties:{},getPossibleStandardName:null,_isCustomAttributeFunctions:[],isCustomAttribute:function(e){for(var t=0;t<s._isCustomAttributeFunctions.length;t++)if((0,s._isCustomAttributeFunctions[t])(e))return!0;return!1},injection:a};t.exports=s},{113:113,138:138}],12:[function(e,t,r){"use strict";function n(e){return!!l.hasOwnProperty(e)||!u.hasOwnProperty(e)&&(s.test(e)?(l[e]=!0,!0):(u[e]=!0,!1))}function i(e,t){return null==t||e.hasBooleanValue&&!t||e.hasNumericValue&&isNaN(t)||e.hasPositiveNumericValue&&t<1||e.hasOverloadedBooleanValue&&!1===t}var a=e(11),o=(e(33),e(58),e(112)),s=(e(143),new RegExp("^["+a.ATTRIBUTE_NAME_START_CHAR+"]["+a.ATTRIBUTE_NAME_CHAR+"]*$")),u={},l={},c={createMarkupForID:function(e){return a.ID_ATTRIBUTE_NAME+"="+o(e)},setAttributeForID:function(e,t){e.setAttribute(a.ID_ATTRIBUTE_NAME,t)},createMarkupForRoot:function(){return a.ROOT_ATTRIBUTE_NAME+'=""'},setAttributeForRoot:function(e){e.setAttribute(a.ROOT_ATTRIBUTE_NAME,"")},createMarkupForProperty:function(e,t){var r=a.properties.hasOwnProperty(e)?a.properties[e]:null;if(r){if(i(r,t))return"";var n=r.attributeName;return r.hasBooleanValue||r.hasOverloadedBooleanValue&&!0===t?n+'=""':n+"="+o(t)}return a.isCustomAttribute(e)?null==t?"":e+"="+o(t):null},createMarkupForCustomAttribute:function(e,t){return n(e)&&null!=t?e+"="+o(t):""},setValueForProperty:function(e,t,r){var n=a.properties.hasOwnProperty(t)?a.properties[t]:null;if(n){var o=n.mutationMethod;if(o)o(e,r);else{if(i(n,r))return void this.deleteValueForProperty(e,t);if(n.mustUseProperty)e[n.propertyName]=r;else{var s=n.attributeName,u=n.attributeNamespace;u?e.setAttributeNS(u,s,""+r):n.hasBooleanValue||n.hasOverloadedBooleanValue&&!0===r?e.setAttribute(s,""):e.setAttribute(s,""+r)}}}else if(a.isCustomAttribute(t))return void c.setValueForAttribute(e,t,r)},setValueForAttribute:function(e,t,r){n(t)&&(null==r?e.removeAttribute(t):e.setAttribute(t,""+r))},deleteValueForAttribute:function(e,t){e.removeAttribute(t)},deleteValueForProperty:function(e,t){var r=a.properties.hasOwnProperty(t)?a.properties[t]:null;if(r){var n=r.mutationMethod;if(n)n(e,void 0);else if(r.mustUseProperty){var i=r.propertyName;r.hasBooleanValue?e[i]=!1:e[i]=""}else e.removeAttribute(r.attributeName)}else a.isCustomAttribute(t)&&e.removeAttribute(t)}};t.exports=c},{11:11,112:112,143:143,33:33,58:58}],13:[function(e,t,r){"use strict";var n=e(113),i=e(9),a=e(124),o=e(129),s=e(130),u=(e(138),{dangerouslyReplaceNodeWithMarkup:function(e,t){if(a.canUseDOM||n("56"),t||n("57"),"HTML"===e.nodeName&&n("58"),"string"==typeof t){var r=o(t,s)[0];e.parentNode.replaceChild(r,e)}else i.replaceChildWithTree(e,t)}});t.exports=u},{113:113,124:124,129:129,130:130,138:138,9:9}],14:[function(e,t,r){"use strict";var n=["ResponderEventPlugin","SimpleEventPlugin","TapEventPlugin","EnterLeaveEventPlugin","ChangeEventPlugin","SelectEventPlugin","BeforeInputEventPlugin"];t.exports=n},{}],15:[function(e,t,r){"use strict";var n=e(19),i=e(33),a=e(84),o={mouseEnter:{registrationName:"onMouseEnter",dependencies:["topMouseOut","topMouseOver"]},mouseLeave:{registrationName:"onMouseLeave",dependencies:["topMouseOut","topMouseOver"]}},s={eventTypes:o,extractEvents:function(e,t,r,s){if("topMouseOver"===e&&(r.relatedTarget||r.fromElement))return null;if("topMouseOut"!==e&&"topMouseOver"!==e)return null;var u;if(s.window===s)u=s;else{var l=s.ownerDocument;u=l?l.defaultView||l.parentWindow:window}var c,f;if("topMouseOut"===e){c=t;var h=r.relatedTarget||r.toElement;f=h?i.getClosestInstanceFromNode(h):null}else c=null,f=t;if(c===f)return null;var d=null==c?u:i.getNodeFromInstance(c),p=null==f?u:i.getNodeFromInstance(f),m=a.getPooled(o.mouseLeave,c,r,s);m.type="mouseleave",m.target=d,m.relatedTarget=p;var v=a.getPooled(o.mouseEnter,f,r,s);return v.type="mouseenter",v.target=p,v.relatedTarget=d,n.accumulateEnterLeaveDispatches(m,v,c,f),[m,v]}};t.exports=s}
256,{19:19,33:33,84:84}],16:[function(e,t,r){"use strict";function n(e){return"button"===e||"input"===e||"select"===e||"textarea"===e}function i(e,t,r){switch(e){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":return!(!r.disabled||!n(t));default:return!1}}var a=e(113),o=e(17),s=e(18),u=e(50),l=e(91),c=e(98),f=(e(138),{}),h=null,d=function(e,t){e&&(s.executeDispatchesInOrder(e,t),e.isPersistent()||e.constructor.release(e))},p=function(e){return d(e,!0)},m=function(e){return d(e,!1)},v=function(e){return"."+e._rootNodeID},y={injection:{injectEventPluginOrder:o.injectEventPluginOrder,injectEventPluginsByName:o.injectEventPluginsByName},putListener:function(e,t,r){"function"!=typeof r&&a("94",t,typeof r);var n=v(e);(f[t]||(f[t]={}))[n]=r;var i=o.registrationName__module__s[t];i&&i.didPutListener&&i.didPutListener(e,t,r)},getListener:function(e,t){var r=f[t];if(i(t,e._currentElement.type,e._currentElement.props))return null;var n=v(e);return r&&r[n]},deleteListener:function(e,t){var r=o.registrationName__module__s[t];r&&r.willDeleteListener&&r.willDeleteListener(e,t);var n=f[t];n&&delete n[v(e)]},deleteAllListeners:function(e){var t=v(e);for(var r in f)if(f.hasOwnProperty(r)&&f[r][t]){var n=o.registrationName__module__s[r];n&&n.willDeleteListener&&n.willDeleteListener(e,r),delete f[r][t]}},extractEvents:function(e,t,r,n){for(var i,a=o.plugins,s=0;s<a.length;s++){var u=a[s];if(u){var c=u.extractEvents(e,t,r,n);c&&(i=l(i,c))}}return i},enqueueEvents:function(e){e&&(h=l(h,e))},processEventQueue:function(e){var t=h;h=null,e?c(t,p):c(t,m),h&&a("95"),u.rethrowCaughtError()},__purge:function(){f={}},__getListenerBank:function(){return f}};t.exports=y},{113:113,138:138,17:17,18:18,50:50,91:91,98:98}],17:[function(e,t,r){"use strict";function n(){if(s)for(var e in u){var t=u[e],r=s.indexOf(e);if(r>-1||o("96",e),!l.plugins[r]){t.extractEvents||o("97",e),l.plugins[r]=t;var n=t.eventTypes;for(var a in n)i(n[a],t,a)||o("98",a,e)}}}function i(e,t,r){l.eventNameDispatchConfigs.hasOwnProperty(r)&&o("99",r),l.eventNameDispatchConfigs[r]=e;var n=e.phasedRegistrationNames;if(n){for(var i in n)if(n.hasOwnProperty(i)){var s=n[i];a(s,t,r)}return!0}return!!e.registrationName&&(a(e.registrationName,t,r),!0)}function a(e,t,r){l.registrationName__module__s[e]&&o("100",e),l.registrationName__module__s[e]=t,l.registrationNameDependencies[e]=t.eventTypes[r].dependencies}var o=e(113),s=(e(138),null),u={},l={plugins:[],eventNameDispatchConfigs:{},registrationName__module__s:{},registrationNameDependencies:{},possibleRegistrationNames:null,injectEventPluginOrder:function(e){s&&o("101"),s=Array.prototype.slice.call(e),n()},injectEventPluginsByName:function(e){var t=!1;for(var r in e)if(e.hasOwnProperty(r)){var i=e[r];u.hasOwnProperty(r)&&u[r]===i||(u[r]&&o("102",r),u[r]=i,t=!0)}t&&n()},getPlugin__module__ForEvent:function(e){var t=e.dispatchConfig;if(t.registrationName)return l.registrationName__module__s[t.registrationName]||null;
256if(void 0!==t.phasedRegistrationNames){var r=t.phasedRegistrationNames;for(var n in r)if(r.hasOwnProperty(n)){var i=l.registrationName__module__s[r[n]];if(i)return i}}return null},_resetEventPlugins:function(){s=null;for(var e in u)u.hasOwnProperty(e)&&delete u[e];l.plugins.length=0;var t=l.eventNameDispatchConfigs;for(var r in t)t.hasOwnProperty(r)&&delete t[r];var n=l.registrationName__module__s;for(var i in n)n.hasOwnProperty(i)&&delete n[i]}};t.exports=l},{113:113,138:138}],18:[function(e,t,r){"use strict";function n(e){return"topMouseUp"===e||"topTouchEnd"===e||"topTouchCancel"===e}function i(e){return"topMouseMove"===e||"topTouchMove"===e}function a(e){return"topMouseDown"===e||"topTouchStart"===e}function o(e,t,r,n){var i=e.type||"unknown-event";e.currentTarget=y.getNodeFromInstance(n),t?m.invokeGuardedCallbackWithCatch(i,r,e):m.invokeGuardedCallback(i,r,e),e.currentTarget=null}function s(e,t){var r=e._dispatchListeners,n=e._dispatchInstances;if(Array.isArray(r))for(var i=0;i<r.length&&!e.isPropagationStopped();i++)o(e,t,r[i],n[i]);else r&&o(e,t,r,n);e._dispatchListeners=null,e._dispatchInstances=null}function u(e){var t=e._dispatchListeners,r=e._dispatchInstances;if(Array.isArray(t)){for(var n=0;n<t.length&&!e.isPropagationStopped();n++)if(t[n](e,r[n]))return r[n]}else if(t&&t(e,r))return r;return null}function l(e){var t=u(e);return e._dispatchInstances=null,e._dispatchListeners=null,t}function c(e){var t=e._dispatchListeners,r=e._dispatchInstances;Array.isArray(t)&&p("103"),e.currentTarget=t?y.getNodeFromInstance(r):null;var n=t?t(e):null;return e.currentTarget=null,e._dispatchListeners=null,e._dispatchInstances=null,n}function f(e){return!!e._dispatchListeners}var h,d,p=e(113),m=e(50),v=(e(138),e(143),{injectComponentTree:function(e){h=e},injectTreeTraversal:function(e){d=e}}),y={isEndish:n,isMoveish:i,isStartish:a,executeDirectDispatch:c,executeDispatchesInOrder:s,executeDispatchesInOrderStopAtTrue:l,hasDispatches:f,getInstanceFromNode:function(e){return h.getInstanceFromNode(e)},getNodeFromInstance:function(e){return h.getNodeFromInstance(e)},isAncestor:function(e,t){return d.isAncestor(e,t)},getLowestCommonAncestor:function(e,t){return d.getLowestCommonAncestor(e,t)},getParentInstance:function(e){return d.getParentInstance(e)},traverseTwoPhase:function(e,t,r){return d.traverseTwoPhase(e,t,r)},traverseEnterLeave:function(e,t,r,n,i){return d.traverseEnterLeave(e,t,r,n,i)},injection:v};t.exports=y},{113:113,138:138,143:143,50:50}],19:[function(e,t,r){"use strict";
256function n(e,t,r){var n=t.dispatchConfig.phasedRegistrationNames[r];return y(e,n)}function i(e,t,r){var i=n(e,r,t);i&&(r._dispatchListeners=m(r._dispatchListeners,i),r._dispatchInstances=m(r._dispatchInstances,e))}function a(e){e&&e.dispatchConfig.phasedRegistrationNames&&p.traverseTwoPhase(e._targetInst,i,e)}function o(e){if(e&&e.dispatchConfig.phasedRegistrationNames){var t=e._targetInst,r=t?p.getParentInstance(t):null;p.traverseTwoPhase(r,i,e)}}function s(e,t,r){if(r&&r.dispatchConfig.registrationName){var n=r.dispatchConfig.registrationName,i=y(e,n);i&&(r._dispatchListeners=m(r._dispatchListeners,i),r._dispatchInstances=m(r._dispatchInstances,e))}}function u(e){e&&e.dispatchConfig.registrationName&&s(e._targetInst,null,e)}function l(e){v(e,a)}function c(e){v(e,o)}function f(e,t,r,n){p.traverseEnterLeave(r,n,s,e,t)}function h(e){v(e,u)}var d=e(16),p=e(18),m=e(91),v=e(98),y=(e(143),d.getListener),g={accumulateTwoPhaseDispatches:l,accumulateTwoPhaseDispatchesSkipTarget:c,accumulateDirectDispatches:h,accumulateEnterLeaveDispatches:f};t.exports=g},{143:143,16:16,18:18,91:91,98:98}],20:[function(e,t,r){"use strict";function n(e){this._root=e,this._startText=this.getText(),this._fallbackText=null}var i=e(144),a=e(24),o=e(106);i(n.prototype,{destructor:function(){this._root=null,this._startText=null,this._fallbackText=null},getText:function(){return"value"in this._root?this._root.value:this._root[o()]},getData:function(){if(this._fallbackText)return this._fallbackText;var e,t,r=this._startText,n=r.length,i=this.getText(),a=i.length;for(e=0;e<n&&r[e]===i[e];e++);var o=n-e;for(t=1;t<=o&&r[n-t]===i[a-t];t++);var s=t>1?1-t:void 0;return this._fallbackText=i.slice(e,s),this._fallbackText}}),a.addPoolingTo(n),t.exports=n},{106:106,144:144,24:24}],21:[function(e,t,r){"use strict";var n=e(11),i=n.injection.MUST_USE_PROPERTY,a=n.injection.HAS_BOOLEAN_VALUE,o=n.injection.HAS_NUMERIC_VALUE,s=n.injection.HAS_POSITIVE_NUMERIC_VALUE,u=n.injection.HAS_OVERLOADED_BOOLEAN_VALUE,l={isCustomAttribute:RegExp.prototype.test.bind(new RegExp("^(data|aria)-["+n.ATTRIBUTE_NAME_CHAR+"]*$")),Properties:{accept:0,acceptCharset:0,accessKey:0,action:0,allowFullScreen:a,allowTransparency:0,alt:0,as:0,async:a,autoComplete:0,autoPlay:a,capture:a,cellPadding:0,cellSpacing:0,charSet:0,challenge:0,checked:i|a,cite:0,classID:0,className:0,cols:s,colSpan:0,content:0,contentEditable:0,contextMenu:0,controls:a,coords:0,crossOrigin:0,data:0,dateTime:0,default:a,defer:a,dir:0,disabled:a,download:u,draggable:0,encType:0,form:0,formAction:0,formEncType:0,formMethod:0,formNoValidate:a,formTarget:0,frameBorder:0,headers:0,height:0,hidden:a,high:0,href:0,hrefLang:0,htmlFor:0,httpEquiv:0,icon:0,id:0,inputMode:0,integrity:0,is:0,keyParams:0,keyType:0,kind:0,label:0,lang:0,list:0,loop:a,low:0,manifest:0,marginHeight:0,marginWidth:0,max:0,maxLength:0,media:0,mediaGroup:0,method:0,min:0,minLength:0,multiple:i|a,muted:i|a,name:0,nonce:0,noValidate:a,open:a,optimum:0,pattern:0,placeholder:0,playsInline:a,poster:0,preload:0,profile:0,radioGroup:0,readOnly:a,referrerPolicy:0,rel:0,required:a,reversed:a,role:0,rows:s,rowSpan:o,sandbox:0,scope:0,scoped:a,scrolling:0,seamless:a,selected:i|a,shape:0,size:s,sizes:0,span:s,spellCheck:0,src:0,srcDoc:0,srcLang:0,srcSet:0,start:o,step:0,style:0,summary:0,tabIndex:0,target:0,title:0,type:0,useMap:0,value:0,width:0,wmode:0,wrap:0,about:0,datatype:0,inlist:0,prefix:0,property:0,resource:0,typeof:0,vocab:0,autoCapitalize:0,autoCorrect:0,autoSave:0,color:0,itemProp:0,itemScope:a,itemType:0,itemID:0,itemRef:0,results:0,security:0,unselectable:0},DOMAttributeNames:{acceptCharset:"accept-charset",className:"class",htmlFor:"for",httpEquiv:"http-equiv"},DOMPropertyNames:{},DOMMutationMethods:{value:function(e,t){if(null==t)return e.removeAttribute("value");"number"!==e.type||!1===e.hasAttribute("value")?e.setAttribute("value",""+t):e.validity&&!e.validity.badInput&&e.ownerDocument.activeElement!==e&&e.setAttribute("value",""+t)}}};t.exports=l},{11:11}],22:[function(e,t,r){"use strict";function n(e){var t={"=":"=0",":":"=2"};return"$"+(""+e).replace(/[=:]/g,function(e){return t[e]})}function i(e){var t=/(=0|=2)/g,r={"=0":"=","=2":":"};return(""+("."===e[0]&&"$"===e[1]?e.substring(2):e.substring(1))).replace(t,function(e){return r[e]})}var a={escape:n,unescape:i};t.exports=a},{}],23:[function(e,t,r){"use strict";function n(e){null!=e.checkedLink&&null!=e.valueLink&&s("87")}
256function i(e){n(e),(null!=e.value||null!=e.onChange)&&s("88")}function a(e){n(e),(null!=e.checked||null!=e.onChange)&&s("89")}function o(e){if(e){var t=e.getName();if(t)return" Check the render method of `"+t+"`."}return""}var s=e(113),u=e(64),l=e(146),c=e(121),f=l(c.isValidElement),h=(e(138),e(143),{button:!0,checkbox:!0,image:!0,hidden:!0,radio:!0,reset:!0,submit:!0}),d={value:function(e,t,r){return!e[t]||h[e.type]||e.onChange||e.readOnly||e.disabled?null:new Error("You provided a `value` prop to a form field without an `onChange` handler. This will render a read-only field. If the field should be mutable use `defaultValue`. Otherwise, set either `onChange` or `readOnly`.")},checked:function(e,t,r){return!e[t]||e.onChange||e.readOnly||e.disabled?null:new Error("You provided a `checked` prop to a form field without an `onChange` handler. This will render a read-only field. If the field should be mutable use `defaultChecked`. Otherwise, set either `onChange` or `readOnly`.")},onChange:f.func},p={},m={checkPropTypes:function(e,t,r){for(var n in d){if(d.hasOwnProperty(n))var i=d[n](t,n,e,"prop",null,u);i instanceof Error&&!(i.message in p)&&(p[i.message]=!0,o(r))}},getValue:function(e){return e.valueLink?(i(e),e.valueLink.value):e.value},getChecked:function(e){return e.checkedLink?(a(e),e.checkedLink.value):e.checked},executeOnChange:function(e,t){return e.valueLink?(i(e),e.valueLink.requestChange(t.target.value)):e.checkedLink?(a(e),e.checkedLink.requestChange(t.target.checked)):e.onChange?e.onChange.call(void 0,t):void 0}};t.exports=m},{113:113,121:121,138:138,143:143,146:146,64:64}],24:[function(e,t,r){"use strict";var n=e(113),i=(e(138),function(e){var t=this;if(t.instancePool.length){var r=t.instancePool.pop();return t.call(r,e),r}return new t(e)}),a=function(e,t){var r=this;if(r.instancePool.length){var n=r.instancePool.pop();return r.call(n,e,t),n}return new r(e,t)},o=function(e,t,r){var n=this;if(n.instancePool.length){var i=n.instancePool.pop();return n.call(i,e,t,r),i}return new n(e,t,r)},s=function(e,t,r,n){var i=this;if(i.instancePool.length){var a=i.instancePool.pop();return i.call(a,e,t,r,n),a}return new i(e,t,r,n)},u=function(e){var t=this;e instanceof t||n("25"),e.destructor(),t.instancePool.length<t.poolSize&&t.instancePool.push(e)},l=i,c=function(e,t){var r=e;return r.instancePool=[],r.getPooled=t||l,r.poolSize||(r.poolSize=10),r.release=u,r},f={addPoolingTo:c,oneArgumentPooler:i,twoArgumentPooler:a,threeArgumentPooler:o,fourArgumentPooler:s};t.exports=f},{113:113,138:138}],25:[function(e,t,r){"use strict";function n(e){return Object.prototype.hasOwnProperty.call(e,m)||(e[m]=d++,f[e[m]]={}),f[e[m]]}var i,a=e(144),o=e(17),s=e(51),u=e(90),l=e(107),c=e(110),f={},h=!1,d=0,p={topAbort:"abort",topAnimationEnd:l("animationend")||"animationend",topAnimationIteration:l("animationiteration")||"animationiteration",topAnimationStart:l("animationstart")||"animationstart",topBlur:"blur",topCanPlay:"canplay",topCanPlayThrough:"canplaythrough",topChange:"change",topClick:"click",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",topDurationChange:"durationchange",topEmptied:"emptied",topEncrypted:"encrypted",topEnded:"ended",topError:"error",topFocus:"focus",topInput:"input",topKeyDown:"keydown",topKeyPress:"keypress",topKeyUp:"keyup", 257topLoadedData:"loadeddata",topLoadedMetadata:"loadedmetadata",topLoadStart:"loadstart",topMouseDown:"mousedown",topMouseMove:"mousemove",topMouseOut:"mouseout",topMouseOver:"mouseover",topMouseUp:"mouseup",topPaste:"paste",topPause:"pause",topPlay:"play",topPlaying:"playing",topProgress:"progress",topRateChange:"ratechange",topScroll:"scroll",topSeeked:"seeked",topSeeking:"seeking",topSelectionChange:"selectionchange",topStalled:"stalled",topSuspend:"suspend",topTextInput:"textInput",topTimeUpdate:"timeupdate",topTouchCancel:"touchcancel",topTouchEnd:"touchend",topTouchMove:"touchmove",topTouchStart:"touchstart",topTransitionEnd:l("transitionend")||"transitionend",topVolumeChange:"volumechange",topWaiting:"waiting",topWheel:"wheel"},m="_reactListenersID"+String(Math.random()).slice(2),v=a({},s,{ReactEventListener:null,injection:{injectReactEventListener:function(e){e.setHandleTopLevel(v.handleTopLevel),v.ReactEventListener=e}},setEnabled:function(e){v.ReactEventListener&&v.ReactEventListener.setEnabled(e)},isEnabled:function(){return!(!v.ReactEventListener||!v.ReactEventListener.isEnabled())},listenTo:function(e,t){for(var r=t,i=n(r),a=o.registrationNameDependencies[e],s=0;s<a.length;s++){var u=a[s];i.hasOwnProperty(u)&&i[u]||("topWheel"===u?c("wheel")?v.ReactEventListener.trapBubbledEvent("topWheel","
257wheel",r):c("mousewheel")?v.ReactEventListener.trapBubbledEvent("topWheel","mousewheel",r):v.ReactEventListener.trapBubbledEvent("topWheel","DOMMouseScroll",r):"topScroll"===u?c("scroll",!0)?v.ReactEventListener.trapCapturedEvent("topScroll","scroll",r):v.ReactEventListener.trapBubbledEvent("topScroll","scroll",v.ReactEventListener.WINDOW_HANDLE):"topFocus"===u||"topBlur"===u?(c("focus",!0)?(v.ReactEventListener.trapCapturedEvent("topFocus","focus",r),v.ReactEventListener.trapCapturedEvent("topBlur","blur",r)):c("focusin")&&(v.ReactEventListener.trapBubbledEvent("topFocus","focusin",r),v.ReactEventListener.trapBubbledEvent("topBlur","focusout",r)),i.topBlur=!0,i.topFocus=!0):p.hasOwnProperty(u)&&v.ReactEventListener.trapBubbledEvent(u,p[u],r),i[u]=!0)}},trapBubbledEvent:function(e,t,r){return v.ReactEventListener.trapBubbledEvent(e,t,r)},trapCapturedEvent:function(e,t,r){return v.ReactEventListener.trapCapturedEvent(e,t,r)},supportsEventPageXY:function(){if(!document.createEvent)return!1;var e=document.createEvent("MouseEvent");return null!=e&&"pageX"in e},ensureScrollValueMonitoring:function(){if(void 0===i&&(i=v.supportsEventPageXY()),!i&&!h){var e=u.refreshScrollValues;v.ReactEventListener.monitorScrollValue(e),h=!0}}});t.exports=v},{107:107,110:110,144:144,17:17,51:51,90:90}],26:[function(e,t,r){(function(r){"use strict";function n(e,t,r,n){var i=void 0===e[r];null!=t&&i&&(e[r]=a(t,!0))}var i=e(66),a=e(109),o=(e(22),e(117)),s=e(118);e(143);void 0!==r&&r.env;var u={instantiateChildren:function(e,t,r,i){if(null==e)return null;var a={};return s(e,n,a),a},updateChildren:function(e,t,r,n,s,u,l,c,f){if(t||e){var h,d;for(h in t)if(t.hasOwnProperty(h)){d=e&&e[h];var p=d&&d._currentElement,m=t[h];if(null!=d&&o(p,m))i.receiveComponent(d,m,s,c),t[h]=d;else{d&&(n[h]=i.getHostNode(d),i.unmountComponent(d,!1));var v=a(m,!0);t[h]=v;var y=i.mountComponent(v,s,u,l,c,f);r.push(y)}}for(h in e)!e.hasOwnProperty(h)||t&&t.hasOwnProperty(h)||(d=e[h],n[h]=i.getHostNode(d),i.unmountComponent(d,!1))}},unmountChildren:function(e,t){for(var r in e)if(e.hasOwnProperty(r)){var n=e[r];i.unmountComponent(n,t)}}};t.exports=u}).call(this,void 0)},{109:109,117:117,118:118,143:143,22:22,66:66}],27:[function(e,t,r){"use strict";var n=e(8),i=e(37),a={processChildrenUpdates:i.dangerouslyProcessChildrenUpdates,replaceNodeWithMarkup:n.dangerouslyReplaceNodeWithMarkup};t.exports=a},{37:37,8:8}],28:[function(e,t,r){"use strict";var n=e(113),i=(e(138),!1),a={replaceNodeWithMarkup:null,processChildrenUpdates:null,injection:{injectEnvironment:function(e){i&&n("104"),a.replaceNodeWithMarkup=e.replaceNodeWithMarkup,a.processChildrenUpdates=e.processChildrenUpdates,i=!0}}};t.exports=a},{113:113,138:138}],29:[function(e,t,r){"use strict";function n(e){}function i(e){return!(!e.prototype||!e.prototype.isReactComponent)}function a(e){return!(!e.prototype||!e.prototype.isPureReactComponent)}var o=e(113),s=e(144),u=e(121),l=e(28),c=e(120),f=e(50),h=e(57),d=(e(58),e(62)),p=e(66),m=e(131),v=(e(138),e(142)),y=e(117),g=(e(143),{ImpureClass:0,PureClass:1,StatelessFunctional:2});n.prototype.render=function(){var e=h.get(this)._currentElement.type,t=e(this.props,this.context,this.updater);return t};var b=1,x={construct:function(e){this._currentElement=e,this._rootNodeID=0,this._compositeType=null,this._instance=null,this._hostParent=null,this._hostContainerInfo=null,this._updateBatchNumber=null,this._pendingElement=null,this._pendingStateQueue=null,this._pendingReplaceState=!1,this._pendingForceUpdate=!1,this._renderedNodeType=null,this._renderedComponent=null,this._context=null,this._mountOrder=0,this._topLevelWrapper=null,this._pendingCallbacks=null,this._calledComponentWillUnmount=!1},mountComponent:function(e,t,r,s){this._context=s,this._mountOrder=b++,this._hostParent=t,this._hostContainerInfo=r;var l,c=this._currentElement.props,f=this._processContext(s),d=this._currentElement.type,p=e.getUpdateQueue(),v=i(d),y=this._constructComponent(v,c,f,p);v||null!=y&&null!=y.render?a(d)?this._compositeType=g.PureClass:this._compositeType=g.ImpureClass:(l=y,null===y||!1===y||u.isValidElement(y)||o("105",d.displayName||d.name||"Component"),y=new n(d),this._compositeType=g.StatelessFunctional),y.props=c,y.context=f,y.refs=m,y.updater=p,this._instance=y,h.set(y,this);var x=y.state;void 0===x&&(y.state=x=null),("object"!=typeof x||Array.isArray(x))&&o("106",this.getName()||"ReactCompositeComponent"),this._pendingStateQueue=null,this._pendingReplaceState=!1,this._pendingForceUpdate=!1;var _;return _=y.unstable_handleError?this.performInitialMountWithErrorHandling(l,t,r,e,s):this.performInitialMount(l,t,r,e,s),y.componentDidMount&&e.getReactMountReady().enqueue(y.componentDidMount,y),_},_constructComponent:function(e,t,r,n){return this._constructComponentWithoutOwner(e,t,r,n)},_constructComponentWithoutOwner:function(e,t,r,n){var i=this._currentElement.type;return e?new i(t,r,n):i(t,r,n)},performInitialMountWithErrorHandling:function(e,t,r,n,i){var a,o=n.checkpoint();try{a=this.performInitialMount(e,t,r,n,i)}catch(s){n.rollback(o),this._instance.unstable_handleError(s),this._pendingStateQueue&&(this._instance.state=this._processPendingState(this._instance.props,this._instance.context)),o=n.checkpoint(),this._renderedComponent.unmountComponent(!0),n.rollback(o),a=this.performInitialMount(e,t,r,n,i)}return a},performInitialMount:function(e,t,r,n,i){var a=this._instance;a.componentWillMount&&(a.componentWillMount(),this._pendingStateQueue&&(a.state=this._processPendingState(a.props,a.context))),void 0===e&&(e=this._renderValidatedComponent());var o=d.getType(e);this._renderedNodeType=o;var s=this._instantiateReactComponent(e,o!==d.EMPTY);return this._renderedComponent=s,p.mountComponent(s,n,t,r,this._processChildContext(i),0)},getHostNode:function(){return p.getHostNode(this._renderedComponent)},unmountComponent:function(e){if(this._renderedComponent){var t=this._instance;if(t.componentWillUnmount&&!t._calledComponentWillUnmount)if(t._calledComponentWillUnmount=!0,e){var r=this.getName()+".componentWillUnmount()";f.invokeGuardedCallback(r,t.componentWillUnmount.bind(t))}else t.componentWillUnmount();this._renderedComponent&&(p.unmountComponent(this._renderedComponent,e),this._renderedNodeType=null,this._renderedComponent=null,this._instance=null),this._pendingStateQueue=null,this._pendingReplaceState=!1,this._pendingForceUpdate=!1,this._pendingCallbacks=null,this._pendingElement=null,this._context=null,this._rootNodeID=0,this._topLevelWrapper=null,h.remove(t)}},_maskContext:function(e){var t=this._currentElement.type,r=t.contextTypes;if(!r)return m;var n={};for(var i in r)n[i]=e[i];return n},_processContext:function(e){return this._maskContext(e)},_processChildContext:function(e){var t,r=this._currentElement.type,n=this._instance;if(n.getChildContext&&(t=n.getChildContext()),t){"object"!=typeof r.childContextTypes&&o("107",this.getName()||"ReactCompositeComponent");for(var i in t)i in r.childContextTypes||o("108",this.getName()||"ReactCompositeComponent",i);return s({},e,t)}return e},_checkContextTypes:function(e,t,r){},receiveComponent:function(e,t,r){var n=this._currentElement,i=this._context;this._pendingElement=null,this.updateComponent(t,n,e,i,r)}
257,performUpdateIfNecessary:function(e){null!=this._pendingElement?p.receiveComponent(this,this._pendingElement,e,this._context):null!==this._pendingStateQueue||this._pendingForceUpdate?this.updateComponent(e,this._currentElement,this._currentElement,this._context,this._context):this._updateBatchNumber=null},updateComponent:function(e,t,r,n,i){var a=this._instance;null==a&&o("136",this.getName()||"ReactCompositeComponent");var s,u=!1;this._context===i?s=a.context:(s=this._processContext(i),u=!0);var l=t.props,c=r.props;t!==r&&(u=!0),u&&a.componentWillReceiveProps&&a.componentWillReceiveProps(c,s);var f=this._processPendingState(c,s),h=!0;this._pendingForceUpdate||(a.shouldComponentUpdate?h=a.shouldComponentUpdate(c,f,s):this._compositeType===g.PureClass&&(h=!v(l,c)||!v(a.state,f))),this._updateBatchNumber=null,h?(this._pendingForceUpdate=!1,this._performComponentUpdate(r,c,f,s,e,i)):(this._currentElement=r,this._context=i,a.props=c,a.state=f,a.context=s)},_processPendingState:function(e,t){var r=this._instance,n=this._pendingStateQueue,i=this._pendingReplaceState;if(this._pendingReplaceState=!1,this._pendingStateQueue=null,!n)return r.state;if(i&&1===n.length)return n[0];for(var a=s({},i?n[0]:r.state),o=i?1:0;o<n.length;o++){var u=n[o];s(a,"function"==typeof u?u.call(r,a,e,t):u)}return a},_performComponentUpdate:function(e,t,r,n,i,a){var o,s,u,l=this._instance,c=Boolean(l.componentDidUpdate);c&&(o=l.props,s=l.state,u=l.context),l.componentWillUpdate&&l.componentWillUpdate(t,r,n),this._currentElement=e,this._context=a,l.props=t,l.state=r,l.context=n,this._updateRenderedComponent(i,a),c&&i.getReactMountReady().enqueue(l.componentDidUpdate.bind(l,o,s,u),l)},_updateRenderedComponent:function(e,t){var r=this._renderedComponent,n=r._currentElement,i=this._renderValidatedComponent();if(y(n,i))p.receiveComponent(r,i,e,this._processChildContext(t));else{var a=p.getHostNode(r);p.unmountComponent(r,!1);var o=d.getType(i);this._renderedNodeType=o;var s=this._instantiateReactComponent(i,o!==d.EMPTY);this._renderedComponent=s;var u=p.mountComponent(s,e,this._hostParent,this._hostContainerInfo,this._processChildContext(t),0);this._replaceNodeWithMarkup(a,u,r)}},_replaceNodeWithMarkup:function(e,t,r){l.replaceNodeWithMarkup(e,t,r)},_renderValidatedComponentWithoutOwnerOrContext:function(){return this._instance.render()},_renderValidatedComponent:function(){var e;if(this._compositeType!==g.StatelessFunctional){c.current=this;try{e=this._renderValidatedComponentWithoutOwnerOrContext()}finally{c.current=null}}else e=this._renderValidatedComponentWithoutOwnerOrContext();return null===e||!1===e||u.isValidElement(e)||o("109",this.getName()||"ReactCompositeComponent"),e},attachRef:function(e,t){var r=this.getPublicInstance();null==r&&o("110");var n=t.getPublicInstance();(r.refs===m?r.refs={}:r.refs)[e]=n},detachRef:function(e){delete this.getPublicInstance().refs[e]},getName:function(){var e=this._currentElement.type,t=this._instance&&this._instance.constructor;return e.displayName||t&&t.displayName||e.name||t&&t.name||null},getPublicInstance:function(){var e=this._instance;return this._compositeType===g.StatelessFunctional?null:e},_instantiateReactComponent:null};t.exports=x},{113:113,117:117,120:120,121:121,131:131,138:138,142:142,143:143,144:144,28:28,50:50,57:57,58:58,62:62,66:66}],30:[function(e,t,r){"use strict";var n=e(33),i=e(47),a=e(60),o=e(66),s=e(71),u=e(72),l=e(96),c=e(103),f=e(114);e(143);i.inject();var h={findDOMNode:l,render:a.render,unmountComponentAtNode:a.unmountComponentAtNode,version:u,unstable_batchedUpdates:s.batchedUpdates,unstable_renderSubtreeIntoContainer:f};"undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.inject&&__REACT_DEVTOOLS_GLOBAL_HOOK__.inject({ComponentTree:{getClosestInstanceFromNode:n.getClosestInstanceFromNode,getNodeFromInstance:function(e){return e._renderedComponent&&(e=c(e)),e?n.getNodeFromInstance(e):null}},Mount:a,Reconciler:o});t.exports=h},{103:103,114:114,143:143,33:33,47:47,60:60,66:66,71:71,72:72,96:96}],31:[function(e,t,r){"use strict";function n(e){if(e){var t=e._currentElement._owner||null;if(t){var r=t.getName();if(r)return" This DOM node was rendered by `"+r+"`."}}return""}function i(e,t){t&&(K[e._tag]&&(null!=t.children||null!=t.dangerouslySetInnerHTML)&&v("137",e._tag,e._currentElement._owner?" Check the render method of "+e._currentElement._owner.getName()+".":""),null!=t.dangerouslySetInnerHTML&&(null!=t.children&&v("60"),"object"==typeof t.dangerouslySetInnerHTML&&j in t.dangerouslySetInnerHTML||v("61")),null!=t.style&&"object"!=typeof t.style&&v("62",n(e)))}function a(e,t,r,n){if(!(n instanceof B)){var i=e._hostContainerInfo,a=i._node&&i._node.nodeType===W,s=a?i._node:i._ownerDocument;N(t,s),n.getReactMountReady().enqueue(o,{inst:e,registrationName:t,listener:r})}}function o(){var e=this;E.putListener(e.inst,e.registrationName,e.listener)}function s(){var e=this;P.postMountWrapper(e)}function u(){var e=this;I.postMountWrapper(e)}function l(){var e=this;R.postMountWrapper(e)}function c(){F.track(this)}function f(){var e=this;e._rootNodeID||v("63");var t=U(e);switch(t||v("64"),e._tag){case"iframe":case"object":e._wrapperState.listeners=[T.trapBubbledEvent("topLoad","load",t)];break;case"video":case"audio":e._wrapperState.listeners=[];for(var r in q)q.hasOwnProperty(r)&&e._wrapperState.listeners.push(T.trapBubbledEvent(r,q[r],t));break;case"source":e._wrapperState.listeners=[T.trapBubbledEvent("topError","error",t)];break;case"img":e._wrapperState.listeners=[T.trapBubbledEvent("topError","error",t),T.trapBubbledEvent("topLoad","load",t)];break;case"form":e._wrapperState.listeners=[T.trapBubbledEvent("topReset","reset",t),T.trapBubbledEvent("topSubmit","submit",t)];break;case"input":case"select":case"textarea":e._wrapperState.listeners=[T.trapBubbledEvent("topInvalid","invali
257d",t)]}}function h(){k.postUpdateWrapper(this)}function d(e){J.call(Z,e)||(Q.test(e)||v("65",e),Z[e]=!0)}function p(e,t){return e.indexOf("-")>=0||null!=t.is}function m(e){var t=e.type;d(t),this._currentElement=e,this._tag=t.toLowerCase(),this._namespaceURI=null,this._renderedChildren=null,this._previousStyle=null,this._previousStyleCopy=null,this._hostNode=null,this._hostParent=null,this._rootNodeID=0,this._domID=0,this._hostContainerInfo=null,this._wrapperState=null,this._topLevelWrapper=null,this._flags=0}var v=e(113),y=e(144),g=e(2),b=e(5),x=e(9),_=e(10),w=e(11),C=e(12),E=e(16),S=e(17),T=e(25),M=e(32),A=e(33),P=e(38),R=e(39),k=e(40),I=e(43),D=(e(58),e(61)),B=e(68),L=(e(130),e(95)),F=(e(138),e(110),e(142),e(108)),V=(e(119),e(143),M),O=E.deleteListener,U=A.getNodeFromInstance,N=T.listenTo,z=S.registrationName__module__s,H={string:!0,number:!0},j="__html",G={children:null,dangerouslySetInnerHTML:null,suppressContentEditableWarning:null},W=11,q={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"},X={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},Y={listing:!0,pre:!0,textarea:!0},K=y({menuitem:!0},X),Q=/^[a-zA-Z][a-zA-Z:_\.\-\d]*$/,Z={},J={}.hasOwnProperty,$=1;m.displayName="ReactDOMComponent",m.Mixin={mountComponent:function(e,t,r,n){this._rootNodeID=$++,this._domID=r._idCounter++,this._hostParent=t,this._hostContainerInfo=r;var a=this._currentElement.props;switch(this._tag){case"audio":case"form":case"iframe":case"img":case"link":case"object":case"source":case"video":this._wrapperState={listeners:null},e.getReactMountReady().enqueue(f,this);break;case"input":P.mountWrapper(this,a,t),a=P.getHostProps(this,a),e.getReactMountReady().enqueue(c,this),e.getReactMountReady().enqueue(f,this);break;case"option":R.mountWrapper(this,a,t),a=R.getHostProps(this,a);break;case"select":k.mountWrapper(this,a,t),a=k.getHostProps(this,a),e.getReactMountReady().enqueue(f,this);break;case"textarea":I.mountWrapper(this,a,t),a=I.getHostProps(this,a),e.getReactMountReady().enqueue(c,this),e.getReactMountReady().enqueue(f,this)}i(this,a);var o,h;null!=t?(o=t._namespaceURI,h=t._tag):r._tag&&(o=r._namespaceURI,h=r._tag),(null==o||o===_.svg&&"foreignobject"===h)&&(o=_.html),o===_.html&&("svg"===this._tag?o=_.svg:"math"===this._tag&&(o=_.mathml)),this._namespaceURI=o;var d;if(e.useCreateElement){var p,m=r._ownerDocument;if(o===_.html)if("script"===this._tag){var v=m.createElement("div"),y=this._currentElement.type;v.innerHTML="<"+y+"></"+y+">",p=v.removeChild(v.firstChild)}else p=a.is?m.createElement(this._currentElement.type,a.is):m.createElement(this._currentElement.type);else p=m.createElementNS(o,this._currentElement.type);A.precacheNode(this,p),this._flags|=V.hasCachedChildNodes,this._hostParent||C.setAttributeForRoot(p),this._updateDOMProperties(null,a,e);var b=x(p);this._createInitialChildren(e,a,n,b),d=b}else{var w=this._createOpenTagMarkupAndPutListeners(e,a),E=this._createContentMarkup(e,a,n);d=!E&&X[this._tag]?w+"/>":w+">"+E+"</"+this._currentElement.type+">"}switch(this._tag){case"input":e.getReactMountReady().enqueue(s,this),a.autoFocus&&e.getReactMountReady().enqueue(g.focusDOMComponent,this);break;case"textarea":e.getReactMountReady().enqueue(u,this),a.autoFocus&&e.getReactMountReady().enqueue(g.focusDOMComponent,this);break;case"select":case"button":a.autoFocus&&e.getReactMountReady().enqueue(g.focusDOMComponent,this);break;case"option":e.getReactMountReady().enqueue(l,this)}return d},_createOpenTagMarkupAndPutListeners:function(e,t){var r="<"+this._currentElement.type;for(var n in t)if(t.hasOwnProperty(n)){var i=t[n];if(null!=i)if(z.hasOwnProperty(n))i&&a(this,n,i,e);else{"style"===n&&(i&&(i=this._previousStyleCopy=y({},t.style)),i=b.createMarkupForStyles(i,this));var o=null;null!=this._tag&&p(this._tag,t)?G.hasOwnProperty(n)||(o=C.createMarkupFor
257CustomAttribute(n,i)):o=C.createMarkupForProperty(n,i),o&&(r+=" "+o)}}return e.renderToStaticMarkup?r:(this._hostParent||(r+=" "+C.createMarkupForRoot()),r+=" "+C.createMarkupForID(this._domID))},_createContentMarkup:function(e,t,r){var n="",i=t.dangerouslySetInnerHTML;if(null!=i)null!=i.__html&&(n=i.__html);else{var a=H[typeof t.children]?t.children:null,o=null!=a?null:t.children;if(null!=a)n=L(a);else if(null!=o){var s=this.mountChildren(o,e,r);n=s.join("")}}return Y[this._tag]&&"\n"===n.charAt(0)?"\n"+n:n},_createInitialChildren:function(e,t,r,n){var i=t.dangerouslySetInnerHTML;if(null!=i)null!=i.__html&&x.queueHTML(n,i.__html);else{var a=H[typeof t.children]?t.children:null,o=null!=a?null:t.children;if(null!=a)""!==a&&x.queueText(n,a);else if(null!=o)for(var s=this.mountChildren(o,e,r),u=0;u<s.length;u++)x.queueChild(n,s[u])}},receiveComponent:function(e,t,r){var n=this._currentElement;this._currentElement=e,this.updateComponent(t,n,e,r)},updateComponent:function(e,t,r,n){var a=t.props,o=this._currentElement.props;switch(this._tag){case"input":a=P.getHostProps(this,a),o=P.getHostProps(this,o);break;case"option":a=R.getHostProps(this,a),o=R.getHostProps(this,o);break;case"select":a=k.getHostProps(this,a),o=k.getHostProps(this,o);break;case"textarea":a=I.getHostProps(this,a),o=I.getHostProps(this,o)}switch(i(this,o),this._updateDOMProperties(a,o,e),this._updateDOMChildren(a,o,e,n),this._tag){case"input":P.updateWrapper(this);break;case"textarea":I.updateWrapper(this);break;case"select":e.getReactMountReady().enqueue(h,this)}},_updateDOMProperties:function(e,t,r){var n,i,o;for(n in e)if(!t.hasOwnProperty(n)&&e.hasOwnProperty(n)&&null!=e[n])if("style"===n){var s=this._previousStyleCopy;for(i in s)s.hasOwnProperty(i)&&(o=o||{},o[i]="");this._previousStyleCopy=null}else z.hasOwnProperty(n)?e[n]&&O(this,n):p(this._tag,e)?G.hasOwnProperty(n)||C.deleteValueForAttribute(U(this),n):(w.properties[n]||w.isCustomAttribute(n))&&C.deleteValueForProperty(U(this),n);for(n in t){var u=t[n],l="style"===n?this._previousStyleCopy:null!=e?e[n]:void 0;if(t.hasOwnProperty(n)&&u!==l&&(null!=u||null!=l))if("style"===n)if(u?u=this._previousStyleCopy=y({},u):this._previousStyleCopy=null,l){for(i in l)!l.hasOwnProperty(i)||u&&u.hasOwnProperty(i)||(o=o||{},o[i]="");for(i in u)u.hasOwnProperty(i)&&l[i]!==u[i]&&(o=o||{},o[i]=u[i])}else o=u;else if(z.hasOwnProperty(n))u?a(this,n,u,r):l&&O(this,n);else if(p(this._tag,t))G.hasOwnProperty(n)||C.setValueForAttribute(U(this),n,u);else if(w.properties[n]||w.isCustomAttribute(n)){var c=U(this);null!=u?C.setValueForProperty(c,n,u):C.deleteValueForProperty(c,n)}}o&&b.setValueForStyles(U(this),o,this)},_updateDOMChildren:function(e,t,r,n){var i=H[typeof e.children]?e.children:null,a=H[typeof t.children]?t.children:null,o=e.dangerouslySetInnerHTML&&e.dangerouslySetInnerHTML.__html,s=t.dangerouslySetInnerHTML&&t.dangerouslySetInnerHTML.__html,u=null!=i?null:e.children,l=null!=a?null:t.children,c=null!=i||null!=o,f=null!=a||null!=s;null!=u&&null==l?this.updateChildren(null,r,n):c&&!f&&this.updateTextContent(""),null!=a?i!==a&&this.updateTextContent(""+a):null!=s?o!==s&&this.updateMarkup(""+s):null!=l&&this.updateChildren(l,r,n)},getHostNode:function(){return U(this)},unmountComponent:function(e){switch(this._tag){case"audio":case"form":case"iframe":case"img":case"link":case"object":case"source":case"video":var t=this._wrapperState.listeners;if(t)for(var r=0;r<t.length;r++)t[r].remove();break;case"input":case"textarea":F.stopTracking(this);break;case"html":case"head":case"body":v("66",this._tag)}this.unmountChildren(e),A.uncacheNode(this),E.deleteAllListeners(this),this._rootNodeID=0,this._domID=0,this._wrapperState=null},getPublicInstance:function(){return U(this)}},y(m.prototype,m.Mixin,D.Mixin),t.exports=m},{10:10,108:108,11:11,110:110,113:113,119:119,12:12,130:130,138:138,142:142,143:143,144:144,16:16,17:17,2:2,25:25,32:32,33:33,38:38,39:39,40:40,43:43,5:5,58:58,61:61,68:68,9:9,95:95}],32:[function(e,t,r){"use strict";var n={hasCachedChildNodes:1};t.exports=n},{}],33:[function(e,t,r){"use strict";function n(e,t){return 1===e.nodeType&&e.getAttribute(p)===String(t)||8===e.n
257odeType&&e.nodeValue===" react-text: "+t+" "||8===e.nodeType&&e.nodeValue===" react-empty: "+t+" "}function i(e){for(var t;t=e._renderedComponent;)e=t;return e}function a(e,t){var r=i(e);r._hostNode=t,t[v]=r}function o(e){var t=e._hostNode;t&&(delete t[v],e._hostNode=null)}function s(e,t){if(!(e._flags&m.hasCachedChildNodes)){var r=e._renderedChildren,o=t.firstChild;e:for(var s in r)if(r.hasOwnProperty(s)){var u=r[s],l=i(u)._domID;if(0!==l){for(;null!==o;o=o.nextSibling)if(n(o,l)){a(u,o);continue e}f("32",l)}}e._flags|=m.hasCachedChildNodes}}function u(e){if(e[v])return e[v];for(var t=[];!e[v];){if(t.push(e),!e.parentNode)return null;e=e.parentNode}for(var r,n;e&&(n=e[v]);e=t.pop())r=n,t.length&&s(n,e);return r}function l(e){var t=u(e);return null!=t&&t._hostNode===e?t:null}function c(e){if(void 0===e._hostNode&&f("33"),e._hostNode)return e._hostNode;for(var t=[];!e._hostNode;)t.push(e),e._hostParent||f("34"),e=e._hostParent;for(;t.length;e=t.pop())s(e,e._hostNode);return e._hostNode}var f=e(113),h=e(11),d=e(32),p=(e(138),h.ID_ATTRIBUTE_NAME),m=d,v="__reactInternalInstance$"+Math.random().toString(36).slice(2),y={getClosestInstanceFromNode:u,getInstanceFromNode:l,getNodeFromInstance:c,precacheChildNodes:s,precacheNode:a,uncacheNode:o};t.exports=y},{11:11,113:113,138:138,32:32}],34:[function(e,t,r){"use strict";function n(e,t){return{_topLevelWrapper:e,_idCounter:1,_ownerDocument:t?t.nodeType===i?t:t.ownerDocument:null,_node:t,_tag:t?t.nodeName.toLowerCase():null,_namespaceURI:t?t.namespaceURI:null}}var i=(e(119),9);t.exports=n},{119:119}],35:[function(e,t,r){"use strict";var n=e(144),i=e(9),a=e(33),o=function(e){this._currentElement=null,this._hostNode=null,this._hostParent=null,this._hostContainerInfo=null,this._domID=0};n(o.prototype,{mountComponent:function(e,t,r,n){var o=r._idCounter++;this._domID=o,this._hostParent=t,this._hostContainerInfo=r;var s=" react-empty: "+this._domID+" ";if(e.useCreateElement){var u=r._ownerDocument,l=u.createComment(s);return a.precacheNode(this,l),i(l)}return e.renderToStaticMarkup?"":"\x3c!--"+s+"--\x3e"},receiveComponent:function(){},getHostNode:function(){return a.getNodeFromInstance(this)},unmountComponent:function(){a.uncacheNode(this)}}),t.exports=o},{144:144,33:33,9:9}],36:[function(e,t,r){"use strict";var n={useCreateElement:!0,useFiber:!1};t.exports=n},{}],37:[function(e,t,r){"use strict";var n=e(8),i=e(33),a={dangerouslyProcessChildrenUpdates:function(e,t){var r=i.getNodeFromInstance(e);n.processUpdates(r,t)}};t.exports=a},{33:33,8:8}],38:[function(e,t,r){"use strict";function n(){this._rootNodeID&&h.updateWrapper(this)}function i(e){return"checkbox"===e.type||"radio"===e.type?null!=e.checked:null!=e.value}function a(e){var t=this._currentElement.props,r=l.executeOnChange(t,e);f.asap(n,this);var i=t.name;if("radio"===t.type&&null!=i){for(var a=c.getNodeFromInstance(this),s=a;s.parentNode;)s=s.parentNode;for(var u=s.querySelectorAll("input[name="+JSON.stringify(""+i)+'][type="radio"]'),h=0;h<u.length;h++){var d=u[h];if(d!==a&&d.form===a.form){var p=c.getInstanceFromNode(d);p||o("90"),f.asap(n,p)}}}return r}var o=e(113),s=e(144),u=e(12),l=e(23),c=e(33),f=e(71),h=(e(138),e(143),{getHostProps:function(e,t){var r=l.getValue(t),n=l.getChecked(t);return s({type:void 0,step:void 0,min:void 0,max:void 0},t,{defaultChecked:void 0,defaultValue:void 0,value:null!=r?r:e._wrapperState.initialValue,checked:null!=n?n:e._wrapperState.initialChecked,onChange:e._wrapperState.onChange})},mountWrapper:function(e,t){var r=t.defaultValue;e._wrapperState={initialChecked:null!=t.checked?t.checked:t.defaultChecked,initialValue:null!=t.value?t.value:r,listeners:null,onChange:a.bind(e),controlled:i(t)}},updateWrapper:function(e){var t=e._currentElement.props,r=t.checked;null!=r&&u.setValueForProperty(c.getNodeFromInstance(e),"checked",r||!1);var n=c.getNodeFromInstance(e),i=l.getValue(t);
257if(null!=i)if(0===i&&""===n.value)n.value="0";else if("number"===t.type){var a=parseFloat(n.value,10)||0;(i!=a||i==a&&n.value!=i)&&(n.value=""+i)}else n.value!==""+i&&(n.value=""+i);else null==t.value&&null!=t.defaultValue&&n.defaultValue!==""+t.defaultValue&&(n.defaultValue=""+t.defaultValue),null==t.checked&&null!=t.defaultChecked&&(n.defaultChecked=!!t.defaultChecked)},postMountWrapper:function(e){var t=e._currentElement.props,r=c.getNodeFromInstance(e);switch(t.type){case"submit":case"reset":break;case"color":case"date":case"datetime":case"datetime-local":case"month":case"time":case"week":r.value="",r.value=r.defaultValue;break;default:r.value=r.value}var n=r.name;""!==n&&(r.name=""),r.defaultChecked=!r.defaultChecked,r.defaultChecked=!r.defaultChecked,""!==n&&(r.name=n)}});t.exports=h},{113:113,12:12,138:138,143:143,144:144,23:23,33:33,71:71}],39:[function(e,t,r){"use strict";function n(e){var t="";return a.Children.forEach(e,function(e){null!=e&&("string"==typeof e||"number"==typeof e?t+=e:u||(u=!0))}),t}var i=e(144),a=e(121),o=e(33),s=e(40),u=(e(143),!1),l={mountWrapper:function(e,t,r){var i=null;if(null!=r){var a=r;"optgroup"===a._tag&&(a=a._hostParent),null!=a&&"select"===a._tag&&(i=s.getSelectValueContext(a))}var o=null;if(null!=i){var u;if(u=null!=t.value?t.value+"":n(t.children),o=!1,Array.isArray(i)){for(var l=0;l<i.length;l++)if(""+i[l]===u){o=!0;break}}else o=""+i===u}e._wrapperState={selected:o}},postMountWrapper:function(e){var t=e._currentElement.props;null!=t.value&&o.getNodeFromInstance(e).setAttribute("value",t.value)},getHostProps:function(e,t){var r=i({selected:void 0,children:void 0},t);null!=e._wrapperState.selected&&(r.selected=e._wrapperState.selected);var a=n(t.children);return a&&(r.children=a),r}};t.exports=l},{121:121,143:143,144:144,33:33,40:40}],40:[function(e,t,r){"use strict";function n(){if(this._rootNodeID&&this._wrapperState.pendingUpdate){this._wrapperState.pendingUpdate=!1;var e=this._currentElement.props,t=s.getValue(e);null!=t&&i(this,Boolean(e.multiple),t)}}function i(e,t,r){var n,i,a=u.getNodeFromInstance(e).options;if(t){for(n={},i=0;i<r.length;i++)n[""+r[i]]=!0;for(i=0;i<a.length;i++){var o=n.hasOwnProperty(a[i].value);a[i].selected!==o&&(a[i].selected=o)}}else{for(n=""+r,i=0;i<a.length;i++)if(a[i].value===n)return void(a[i].selected=!0);a.length&&(a[0].selected=!0)}}function a(e){var t=this._currentElement.props,r=s.executeOnChange(t,e);return this._rootNodeID&&(this._wrapperState.pendingUpdate=!0),l.asap(n,this),r}var o=e(144),s=e(23),u=e(33),l=e(71),c=(e(143),!1),f={getHostProps:function(e,t){return o({},t,{onChange:e._wrapperState.onChange,value:void 0})},mountWrapper:function(e,t){var r=s.getValue(t);e._wrapperState={pendingUpdate:!1,initialValue:null!=r?r:t.defaultValue,listeners:null,onChange:a.bind(e),wasMultiple:Boolean(t.multiple)},void 0===t.value||void 0===t.defaultValue||c||(c=!0)},getSelectValueContext:function(e){return e._wrapperState.initialValue},postUpdateWrapper:function(e){var t=e._currentElement.props;e._wrapperState.initialValue=void 0;var r=e._wrapperState.wasMultiple;e._wrapperState.wasMultiple=Boolean(t.multiple);var n=s.getValue(t);null!=n?(e._wrapperState.pendingUpdate=!1,i(e,Boolean(t.multiple),n)):r!==Boolean(t.multiple)&&(null!=t.defaultValue?i(e,Boolean(t.multiple),t.defaultValue):i(e,Boolean(t.multiple),t.multiple?[]:""))}};t.exports=f},{143:143,144:144,23:23,33:33,71:71}],41:[function(e,t,r){"use strict";function n(e,t,r,n){return e===r&&t===n}function i(e){var t=document.selection,r=t.createRange(),n=r.text.length,i=r.duplicate();i.moveToElementText(e),i.setEndPoint("EndToStart",r);var a=i.text.length;return{start:a,end:a+n}}function a(e){var t=window.getSelection&&window.getSelection();if(!t||0===t.rangeCount)return null;var r=t.anchorNode,i=t.anchorOffset,a=t.focusNode,o=t.focusOffset,s=t.getRangeAt(0);try{s.startContainer.nodeType,s.endContainer.nodeType}catch(e){return null}var u=n(t.anchorNode,t.anchorOffset,t.focusNode,t.focusOffset),l=u?0:s.toString().length,c=s.cloneRange();c.selectNodeContents(e),c.setEnd(s.startContainer,s.startOffset);var f=n(c.startContainer,c.startOffset,c.endContainer,c.endOffset),h=f?0:c.toString().length,d=h+l,p=document.createRange();p.setStart(r,i),p.setEnd(a,o);var m=p.collapsed;return{start:m?d:h,end:m?h:d}}function o(e,t){var r,n,i=document.selection.createRange().duplicate();void 0===t.end?(r=t.start,n=r):t.start>
257t.end?(r=t.end,n=t.start):(r=t.start,n=t.end),i.moveToElementText(e),i.moveStart("character",r),i.setEndPoint("EndToStart",i),i.moveEnd("character",n-r),i.select()}function s(e,t){if(window.getSelection){var r=window.getSelection(),n=e[c()].length,i=Math.min(t.start,n),a=void 0===t.end?i:Math.min(t.end,n);if(!r.extend&&i>a){var o=a;a=i,i=o}var s=l(e,i),u=l(e,a);if(s&&u){var f=document.createRange();f.setStart(s.node,s.offset),r.removeAllRanges(),i>a?(r.addRange(f),r.extend(u.node,u.offset)):(f.setEnd(u.node,u.offset),r.addRange(f))}}}var u=e(124),l=e(105),c=e(106),f=u.canUseDOM&&"selection"in document&&!("getSelection"in window),h={getOffsets:f?i:a,setOffsets:f?o:s};t.exports=h},{105:105,106:106,124:124}],42:[function(e,t,r){"use strict" 258;var n=e(113),i=e(144),a=e(8),o=e(9),s=e(33),u=e(95),l=(e(138),e(119),function(e){this._currentElement=e,this._stringText=""+e,this._hostNode=null,this._hostParent=null,this._domID=0,this._mountIndex=0,this._closingComment=null,this._commentNodes=null});i(l.prototype,{mountComponent:function(e,t,r,n){var i=r._idCounter++,a=" react-text: "+i+" ";if(this._domID=i,this._hostParent=t,e.useCreateElement){var l=r._ownerDocument,c=l.createComment(a),f=l.createComment(" /react-text "),h=o(l.createDocumentFragment());return o.queueChild(h,o(c)),this._stringText&&o.queueChild(h,o(l.createTextNode(this._stringText))),o.queueChild(h,o(f)),s.precacheNode(this,c),this._closingComment=f,h}var d=u(this._stringText);return e.renderToStaticMarkup?d:"\x3c!--"+a+"--\x3e"+d+"\x3c!-- /react-text --\x3e"},receiveComponent:function(e,t){if(e!==this._currentElement){this._currentElement=e;var r=""+e;if(r!==this._stringText){this._stringText=r;var n=this.getHostNode();a.replaceDelimitedText(n[0],n[1],r)}}},getHostNode:function(){var e=this._commentNodes;if(e)return e;if(!this._closingComment)for(var t=s.getNodeFromInstance(this),r=t.nextSibling;;
258){if(null==r&&n("67",this._domID),8===r.nodeType&&" /react-text "===r.nodeValue){this._closingComment=r;break}r=r.nextSibling}return e=[this._hostNode,this._closingComment],this._commentNodes=e,e},unmountComponent:function(){this._closingComment=null,this._commentNodes=null,s.uncacheNode(this)}}),t.exports=l},{113:113,119:119,138:138,144:144,33:33,8:8,9:9,95:95}],43:[function(e,t,r){"use strict";function n(){this._rootNodeID&&c.updateWrapper(this)}function i(e){var t=this._currentElement.props,r=s.executeOnChange(t,e);return l.asap(n,this),r}var a=e(113),o=e(144),s=e(23),u=e(33),l=e(71),c=(e(138),e(143),{getHostProps:function(e,t){return null!=t.dangerouslySetInnerHTML&&a("91"),o({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue,onChange:e._wrapperState.onChange})},mountWrapper:function(e,t){var r=s.getValue(t),n=r;if(null==r){var o=t.defaultValue,u=t.children;null!=u&&(null!=o&&a("92"),Array.isArray(u)&&(u.length<=1||a("93"),u=u[0]),o=""+u),null==o&&(o=""),n=o}e._wrapperState={initialValue:""+n,listeners:null,onChange:i.bind(e)}},updateWrapper:function(e){var t=e._currentElement.props,r=u.getNodeFromInstance(e),n=s.getValue(t);if(null!=n){var i=""+n;i!==r.value&&(r.value=i),null==t.defaultValue&&(r.defaultValue=i)}null!=t.defaultValue&&(r.defaultValue=t.defaultValue)},postMountWrapper:function(e){var t=u.getNodeFromInstance(e),r=t.textContent;r===e._wrapperState.initialValue&&(t.value=r)}});t.exports=c},{113:113,138:138,143:143,144:144,23:23,33:33,71:71}],44:[function(e,t,r){"use strict";function n(e,t){"_hostNode"in e||u("33"),"_hostNode"in t||u("33");for(var r=0,n=e;n;n=n._hostParent)r++;for(var i=0,a=t;a;a=a._hostParent)i++;for(;r-i>0;)e=e._hostParent,r--;for(;i-r>0;)t=t._hostParent,i--;for(var o=r;o--;){if(e===t)return e;e=e._hostParent,t=t._hostParent}return null}function i(e,t){"_hostNode"in e||u("35"),"_hostNode"in t||u("35");for(;t;){if(t===e)return!0;t=t._hostParent}return!1}function a(e){return"_hostNode"in e||u("36"),e._hostParent}function o(e,t,r){for(var n=[];e;)n.push(e),e=e._hostParent;var i;for(i=n.length;i-- >0;)t(n[i],"captured",r);for(i=0;i<n.length;i++)t(n[i],"bubbled",r)}function s(e,t,r,i,a){for(var o=e&&t?n(e,t):null,s=[];e&&e!==o;)s.push(e),e=e._hostParent;for(var u=[];t&&t!==o;)u.push(t),t=t._hostParent;var l;for(l=0;l<s.length;l++)r(s[l],"bubbled",i);for(l=u.length;l-- >0;)r(u[l],"captured",a)}var u=e(113);e(138);t.exports={isAncestor:i,getLowestCommonAncestor:n,getParentInstance:a,traverseTwoPhase:o,traverseEnterLeave:s}},{113:113,138:138}],45:[function(e,t,r){"use strict";var n=e(121),i=e(30),a=i;n.addons&&(n.__SECRET_INJECTED_REACT_DOM_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=a),t.exports=a},{121:121,30:30}],46:[function(e,t,r){"use strict";function n(){this.reinitializeTransaction()}var i=e(144),a=e(71),o=e(89),s=e(130),u={initialize:s,close:function(){h.isBatchingUpdates=!1}},l={initialize:s,close:a.flushBatchedUpdates.bind(a)},c=[l,u];i(n.prototype,o,{getTransactionWrappers:function(){return c}});var f=new n,h={isBatchingUpdates:!1,batchedUpdates:function(e,t,r,n,i,a){var o=h.isBatchingUpdates;return h.isBatchingUpdates=!0,o?e(t,r,n,i,a):f.perform(e,null,t,r,n,i,a)}};t.exports=h},{130:130,144:144,71:71,89:89}],47:[function(e,t,r){"use strict";function n(){C||(C=!0,g.EventEmitter.injectReactEventListener(y),g.EventPluginHub.injectEventPluginOrder(s),g.EventPluginUtils.injectComponentTree(h),g.EventPluginUtils.injectTreeTraversal(p),g.EventPluginHub.injectEventPluginsByName({SimpleEventPlugin:w,EnterLeaveEventPlugin:u,ChangeEventPlugin:o,SelectEventPlugin:_,BeforeInputEventPlugin:a}),g.HostComponent.injectGenericComponentClass(f),g.HostComponent.injectTextComponentClass(m),g.DOMProperty.injectDOMPropertyConfig(i),g.DOMProperty.injectDOMPropertyConfig(l),g.DOMProperty.injectDOMPropertyConfig(x),g.EmptyComponent.injectEmptyComponentFactory(function(e){return new d(e)}),g.Updates.injectReconcileTransaction(b),g.Updates.injectBatchingStrategy(v),g.Component.injectEnvironment(c))}var i=e(1),a=e(3),o=e(7),s=e(14),u=e(15),l=e(21),c=e(27),f=e(31),h=e(33),d=e(35),p=e(44),m=e(42),v=e(46),y=e(52),g=e(55),b=e(65),x=e(73),_=e(74),w=e(75),C=!1;t.exports={inject:n}},{1:1,14:14,15:15,21:21,27:27,3:3,31:31,33:33,35:35,42:42,44:44,46:46,52:52,55:55,65:65,7:7,73:73,74:74,75:75}],48:[function(e,t,r){"use strict";var n="function"==typeof Symbol&&Symbol.for&&Symbol.for("react.element")||60103;t.exports=n},{}],49:[function(e,t,r){"use strict";var n,i={injectEmptyComponentFactory:function(e){n=e}},a={create:function(e){return n(e)}};a.injection=i,t.exports=a},{}],50:[function(e,t,r){"use strict";function n(e,t,r){try{t(r)}catch(e){null===i&&(i=e)}}var i=null,a={invokeGuardedCallback:n,invokeGuardedCallbackWithCatch:n,rethrowCaughtError:function(){if(i){var e=i;throw i=null,e}}};t.exports=a},{}],51:[function(e,t,r){"use strict";function n(e){i.enqueueEvents(e),i.processEventQueue(!1)}var i=e(16),a={handleTopLevel:function(e,t,r,a){n(i.extractEvents(e,t,r,a))}};t.exports=a},{16:16}],52:[function(e,t,r){"use strict";function n(e){for(;e._hostParent;)e=e._hostParent;var t=f.getNodeFromInstance(e),r=t.parentNode;return f.getClosestInstanceFromNode(r)}function i(e,t){this.topLevelType=e,this.nativeEvent=t,this.ancestors=[]}function a(e){var t=d(e.nativeEvent),r=f.getClosestInstanceFromNode(t),i=r;do{e.ancestors.push(i),i=i&&n(i)}while(i);for(var a=0;a<e.ancestors.length;a++)r=e.ancestors[a],m._handleTopLevel(e.topLevelType,r,e.nativeEvent,d(e.nativeEvent))}function o(e){e(p(window))}var s=e(144),u=e(123),l=e(124),c=e(24),f=e(33),h=e(71),d=e(102),p=e(135);s(i.prototype,{destructor:function(){this.topLevelType=null,this.nativeEvent=null,this.ancestors.length=0}}),c.addPoolingTo(i,c.twoArgumentPooler);var m={_enabled:!0,_handleTopLevel:null,WINDOW_HANDLE:l.canUseDOM?window:null,setHandleTopLevel:function(e){m._handleTopLevel=e},setEnabled:function(e){m._enabled=!!e},isEnabled:function(){return m._enabled},trapBubbledEvent:function(e,t,r){return r?u.listen(r,t,m.dispatchEvent.bind(null,e)):null},trapCapturedEvent:function(e,t,r){return r?u.capture(r,t,m.dispatchEvent.bind(null,e)):null},monitorScrollValue:function(e){var t=o.bind(null,e);u.listen(window,"scroll",t)},dispatchEvent:function(e,t){if(m._enabled){var r=i.getPooled(e,t);try{h.batchedUpdates(a,r)}finally{i.release(r)}}}};t.exports=m},{102:102,123:123,124:124,135:135,144:144,24:24,33:33,71:71}],53:[function(e,t,r){"use strict";var n={logTopLevelRenders:!1};t.exports=n},{}],54:[function(e,t,r){"use strict";function n(e){return s||o("111",e.type),new s(e)}function i(e){return new u(e)}function a(e){return e instanceof u}var o=e(113),s=(e(138),null),u=null,l={injectGenericComponentClass:function(e){s=e},injectTextComponentClass:function(e){u=e}},c={createInternalComponent:n,createInstanceForText:i,isTextComponent:a,injection:l};t.exports=c},{113:113,138:138}],55:[function(e,t,r){"use strict";var n=e(11),i=e(16),a=e(18),o=e(28),s=e(49),u=e(25),l=e(54),c=e(71),f={Component:o.injection,DOMProperty:n.injection,EmptyComponent:s.injection,EventPluginHub:i.injection,EventPluginUtils:a.injection,EventEmitter:u.injection,HostComponent:l.injection,Updates:c.injection};t.exports=f},{11:11,16:16,18:18,25:25,28:28,49:49,54:54,71:71}],56:[function(e,t,r){"use strict";function n(e){return a(document.documentElement,e)}var i=e(41),a=e(127),o=e(132),s=e(133),u={hasSelectionCapabilities:function(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&("input"===t&&"text"===e.type||"textarea"===t||"true"===e.contentEditable)},getSelectionInformation:function(){var e=s();return{focusedElem:e,selectionRange:u.hasSelectionCapabilities(e)?u.getSelection(e):null}},restoreSelection:function(e){var t=s(),r=e.focusedElem,i=e.selectionRange;t!==r&&n(r)&&(u.hasSelectionCapabilities(r)&&u.setSelection(r,i),o(r))},getSelection:function(e){var t;if("selectionStart"in e)t={start:e.selectionStart,end:e.selectionEnd};else if(document.selection&&e.nodeName&&"input"===e.nodeName.toLowerCase()){var r=document.selection.createRange();r.parentElement()===e&&(t={start:-r.moveStart("character",-e.value.length),end:-r.moveEnd("character",-e.value.length)})}else t=i.getOffsets(e);return t||{start:0,end:0}},setSelection:function(e,t){var r=t.start,n=t.end;if(void 0===n&&(n=r),"selectionStart"in e)e.selectionStart=r,e.selectionEnd=Math.min(n,e.value.length);else if(document.selection&&e.nodeName&&"input"===e.nodeName.toLowerCase()){var a=e.createTextRange();a.collapse(!0),a.moveStart("character",r),a.moveEnd("character",n-r),a.select()}else i.setOffsets(e,t)}};t.exports=u},{127:127,132:132,133:133,41:41}],57:[function(e,t,r){"use strict";var n={remove:function(e){e._reactInternalInstance=void 0},get:function(e){return e._reactInternalInstance},has:function(e){return void 0!==e._reactInternalInstance},set:function(e,t){e._reactInternalInstance=t}};t.exports=n},{}],58:[function(e,t,r){"use strict";
258t.exports={debugTool:null}},{}],59:[function(e,t,r){"use strict";var n=e(92),i=/\/?>/,a=/^<\!\-\-/,o={CHECKSUM_ATTR_NAME:"data-react-checksum",addChecksumToMarkup:function(e){var t=n(e);return a.test(e)?e:e.replace(i," "+o.CHECKSUM_ATTR_NAME+'="'+t+'"$&')},canReuseMarkup:function(e,t){var r=t.getAttribute(o.CHECKSUM_ATTR_NAME);return r=r&&parseInt(r,10),n(e)===r}};t.exports=o},{92:92}],60:[function(e,t,r){"use strict";function n(e,t){for(var r=Math.min(e.length,t.length),n=0;n<r;n++)if(e.charAt(n)!==t.charAt(n))return n;return e.length===t.length?-1:r}function i(e){return e?e.nodeType===B?e.documentElement:e.firstChild:null}function a(e){return e.getAttribute&&e.getAttribute(k)||""}function o(e,t,r,n,i){var a;if(_.logTopLevelRenders){var o=e._currentElement.props.child,s=o.type;a="React mount: "+("string"==typeof s?s:s.displayName||s.name),console.time(a)}var u=E.mountComponent(e,r,null,b(e,t),i,0);a&&console.timeEnd(a),e._renderedComponent._topLevelWrapper=e,U._mountImageIntoNode(u,t,e,n,r)}function s(e,t,r,n){var i=T.ReactReconcileTransaction.getPooled(!r&&x.useCreateElement);i.perform(o,null,e,t,i,r,n),T.ReactReconcileTransaction.release(i)}function u(e,t,r){for(E.unmountComponent(e,r),t.nodeType===B&&(t=t.documentElement);t.lastChild;)t.removeChild(t.lastChild)}function l(e){var t=i(e);if(t){var r=g.getInstanceFromNode(t);return!(!r||!r._hostParent)}}function c(e){return!(!e||e.nodeType!==D&&e.nodeType!==B&&e.nodeType!==L)}function f(e){var t=i(e),r=t&&g.getInstanceFromNode(t);return r&&!r._hostParent?r:null}function h(e){var t=f(e);return t?t._hostContainerInfo._topLevelWrapper:null}var d=e(113),p=e(9),m=e(11),v=e(121),y=e(25),g=(e(120),e(33)),b=e(34),x=e(36),_=e(53),w=e(57),C=(e(58),e(59)),E=e(66),S=e(70),T=e(71),M=e(131),A=e(109),P=(e(138),e(115)),R=e(117),k=(e(143),m.ID_ATTRIBUTE_NAME),I=m.ROOT_ATTRIBUTE_NAME,D=1,B=9,L=11,F={},V=1,O=function(){this.rootID=V++};O.prototype.isReactComponent={},O.prototype.render=function(){return this.props.child},O.isReactTopLevelWrapper=!0;var U={TopLevelWrapper:O,_instancesByReactRootID:F,scrollMonitor:function(e,t){t()},_updateRootComponent:function(e,t,r,n,i){return U.scrollMonitor(n,function(){S.enqueueElementInternal(e,t,r),i&&S.enqueueCallbackInternal(e,i)}),e},_renderNewRootComponent:function(e,t,r,n){c(t)||d("37"),y.ensureScrollValueMonitoring();var i=A(e,!1);T.batchedUpdates(s,i,t,r,n);var a=i._instance.rootID;return F[a]=i,i},renderSubtreeIntoContainer:function(e,t,r,n){return null!=e&&w.has(e)||d("38"),U._renderSubtreeIntoContainer(e,t,r,n)},_renderSubtreeIntoContainer:function(e,t,r,n){S.validateCallback(n,"ReactDOM.render"),v.isValidElement(t)||d("39","string"==typeof t?" Instead of passing a string like 'div', pass React.createElement('div') or <div />.":"function"==typeof t?" Instead of passing a class like Foo, pass React.createElement(Foo) or <Foo />.":null!=t&&void 0!==t.props?" This may be caused by unintentionally loading two independent copies of React.":"");var o,s=v.createElement(O,{child:t});if(e){var u=w.get(e);o=u._processChildContext(u._context)}else o=M;var c=h(r);if(c){var f=c._currentElement,p=f.props.child;if(R(p,t)){var m=c._renderedComponent.getPublicInstance(),y=n&&function(){n.call(m)};return U._updateRootComponent(c,s,o,r,y),m}U.unmountComponentAtNode(r)}var g=i(r),b=g&&!!a(g),x=l(r),_=b&&!c&&!x,C=U._renderNewRootComponent(s,r,_,o)._renderedComponent.getPublicInstance();return n&&n.call(C),C},render:function(e,t,r){return U._renderSubtreeIntoContainer(null,e,t,r)},unmountComponentAtNode:function(e){c(e)||d("40");var t=h(e);return t?(delete F[t._instance.rootID],T.batchedUpdates(u,t,e,!1),!0):(l(e),1===e.nodeType&&e.hasAttribute(I),!1)},_mountImageIntoNode:function(e,t,r,a,o){if(c(t)||d("41"),a){var s=i(t);if(C.canReuseMarkup(e,s))return void g.precacheNode(r,s);var u=s.getAttribute(C.CHECKSUM_ATTR_NAME);s.removeAttribute(C.CHECKSUM_ATTR_NAME);var l=s.outerHTML;s.setAttribute(C.CHECKSUM_ATTR_NAME,u);var f=e,h=n(f,l),m=" (client) "+f.substring(h-20,h+20)+"\n (server) "+l.substring(h-20,h+20);t.nodeType===B&&d("42",m)}if(t.nodeType===B&&d("43"),o.useCreateElement){for(;
258t.lastChild;)t.removeChild(t.lastChild);p.insertTreeBefore(t,e,null)}else P(t,e),g.precacheNode(r,t.firstChild)}};t.exports=U},{109:109,11:11,113:113,115:115,117:117,120:120,121:121,131:131,138:138,143:143,25:25,33:33,34:34,36:36,53:53,57:57,58:58,59:59,66:66,70:70,71:71,9:9}],61:[function(e,t,r){"use strict";function n(e,t,r){return{type:"INSERT_MARKUP",content:e,fromIndex:null,fromNode:null,toIndex:r,afterNode:t}}function i(e,t,r){return{type:"MOVE_EXISTING",content:null,fromIndex:e._mountIndex,fromNode:h.getHostNode(e),toIndex:r,afterNode:t}}function a(e,t){return{type:"REMOVE_NODE",content:null,fromIndex:e._mountIndex,fromNode:t,toIndex:null,afterNode:null}}function o(e){return{type:"SET_MARKUP",content:e,fromIndex:null,fromNode:null,toIndex:null,afterNode:null}}function s(e){return{type:"TEXT_CONTENT",content:e,fromIndex:null,fromNode:null,toIndex:null,afterNode:null}}function u(e,t){return t&&(e=e||[],e.push(t)),e}function l(e,t){f.processChildrenUpdates(e,t)}var c=e(113),f=e(28),h=(e(57),e(58),e(120),e(66)),d=e(26),p=(e(130),e(97)),m=(e(138),{Mixin:{_reconcilerInstantiateChildren:function(e,t,r){return d.instantiateChildren(e,t,r)},_reconcilerUpdateChildren:function(e,t,r,n,i,a){var o;return o=p(t,0),d.updateChildren(e,o,r,n,i,this,this._hostContainerInfo,a,0),o},mountChildren:function(e,t,r){var n=this._reconcilerInstantiateChildren(e,t,r);this._renderedChildren=n;var i=[],a=0;for(var o in n)if(n.hasOwnProperty(o)){var s=n[o],u=h.mountComponent(s,t,this,this._hostContainerInfo,r,0);s._mountIndex=a++,i.push(u)}return i},updateTextContent:function(e){var t=this._renderedChildren;d.unmountChildren(t,!1);for(var r in t)t.hasOwnProperty(r)&&c("118");l(this,[s(e)])},updateMarkup:function(e){var t=this._renderedChildren;d.unmountChildren(t,!1);for(var r in t)t.hasOwnProperty(r)&&c("118");l(this,[o(e)])},updateChildren:function(e,t,r){this._updateChildren(e,t,r)},_updateChildren:function(e,t,r){var n=this._renderedChildren,i={},a=[],o=this._reconcilerUpdateChildren(n,e,a,i,t,r);if(o||n){var s,c=null,f=0,d=0,p=0,m=null;for(s in o)if(o.hasOwnProperty(s)){var v=n&&n[s],y=o[s];v===y?(c=u(c,this.moveChild(v,m,f,d)),d=Math.max(v._mountIndex,d),v._mountIndex=f):(v&&(d=Math.max(v._mountIndex,d)),c=u(c,this._mountChildAtIndex(y,a[p],m,f,t,r)),p++),f++,m=h.getHostNode(y)}for(s in i)i.hasOwnProperty(s)&&(c=u(c,this._unmountChild(n[s],i[s])));c&&l(this,c),this._renderedChildren=o}},unmountChildren:function(e){var t=this._renderedChildren;d.unmountChildren(t,e),this._renderedChildren=null},moveChild:function(e,t,r,n){if(e._mountIndex<n)return i(e,t,r)},createChild:function(e,t,r){return n(r,t,e._mountIndex)},removeChild:function(e,t){return a(e,t)},_mountChildAtIndex:function(e,t,r,n,i,a){return e._mountIndex=n,this.createChild(e,r,t)},_unmountChild:function(e,t){var r=this.removeChild(e,t);return e._mountIndex=null,r}}});t.exports=m},{113:113,120:120,130:130,138:138,26:26,28:28,57:57,58:58,66:66,97:97}],62:[function(e,t,r){"use strict";var n=e(113),i=e(121),a=(e(138),{HOST:0,COMPOSITE:1,EMPTY:2,getType:function(e){return null===e||!1===e?a.EMPTY:i.isValidElement(e)?"function"==typeof e.type?a.COMPOSITE:a.HOST:void n("26",e)}});t.exports=a},{113:113,121:121,138:138}],63:[function(e,t,r){"use strict";function n(e){return!(!e||"function"!=typeof e.attachRef||"function"!=typeof e.detachRef)}var i=e(113),a=(e(138),{addComponentAsRefTo:function(e,t,r){n(r)||i("119"),r.attachRef(t,e)},removeComponentAsRefFrom:function(e,t,r){n(r)||i("120");var a=r.getPublicInstance();a&&a.refs[t]===e.getPublicInstance()&&r.detachRef(t)}});t.exports=a},{113:113,138:138}],64:[function(e,t,r){"use strict";t.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},{}],65:[function(e,t,r){"use strict";function n(e){this.reinitializeTransaction(),this.renderToStaticMarkup=!1,this.reactMountReady=a.getPooled(null),this.useCreateElement=e}var i=e(144),a=e(6),o=e(24),s=e(25),u=e(56),l=(e(58),e(89)),c=e(70),f={initialize:u.getSelectionInformation,close:u.restoreSelection},h={initialize:function(){var e=s.isEnabled();return s.setEnabled(!1),e},close:function(e){s.setEnabled(e)}},d={initialize:function(){this.reactMountReady.reset()},close:function(){this.reactMountReady.notifyAll()}},p=[f,h,d],m={getTransactionWrappers:function(){return p},getReactMountReady:function(){return this.reactMountReady}
258,getUpdateQueue:function(){return c},checkpoint:function(){return this.reactMountReady.checkpoint()},rollback:function(e){this.reactMountReady.rollback(e)},destructor:function(){a.release(this.reactMountReady),this.reactMountReady=null}};i(n.prototype,l,m),o.addPoolingTo(n),t.exports=n},{144:144,24:24,25:25,56:56,58:58,6:6,70:70,89:89}],66:[function(e,t,r){"use strict";function n(){i.attachRefs(this,this._currentElement)}var i=e(67),a=(e(58),e(143),{mountComponent:function(e,t,r,i,a,o){var s=e.mountComponent(t,r,i,a,o);return e._currentElement&&null!=e._currentElement.ref&&t.getReactMountReady().enqueue(n,e),s},getHostNode:function(e){return e.getHostNode()},unmountComponent:function(e,t){i.detachRefs(e,e._currentElement),e.unmountComponent(t)},receiveComponent:function(e,t,r,a){var o=e._currentElement;if(t!==o||a!==e._context){var s=i.shouldUpdateRefs(o,t);s&&i.detachRefs(e,o),e.receiveComponent(t,r,a),s&&e._currentElement&&null!=e._currentElement.ref&&r.getReactMountReady().enqueue(n,e)}},performUpdateIfNecessary:function(e,t,r){e._updateBatchNumber===r&&e.performUpdateIfNecessary(t)}});t.exports=a},{143:143,58:58,67:67}],67:[function(e,t,r){"use strict";function n(e,t,r){"function"==typeof e?e(t.getPublicInstance()):a.addComponentAsRefTo(t,e,r)}function i(e,t,r){"function"==typeof e?e(null):a.removeComponentAsRefFrom(t,e,r)}var a=e(63),o={};o.attachRefs=function(e,t){if(null!==t&&"object"==typeof t){var r=t.ref;null!=r&&n(r,e,t._owner)}},o.shouldUpdateRefs=function(e,t){var r=null,n=null;null!==e&&"object"==typeof e&&(r=e.ref,n=e._owner);var i=null,a=null;return null!==t&&"object"==typeof t&&(i=t.ref,a=t._owner),r!==i||"string"==typeof i&&a!==n},o.detachRefs=function(e,t){if(null!==t&&"object"==typeof t){var r=t.ref;null!=r&&i(r,e,t._owner)}},t.exports=o},{63:63}],68:[function(e,t,r){"use strict";function n(e){this.reinitializeTransaction(),this.renderToStaticMarkup=e,this.useCreateElement=!1,this.updateQueue=new s(this)}var i=e(144),a=e(24),o=e(89),s=(e(58),e(69)),u=[],l={enqueue:function(){}},c={getTransactionWrappers:function(){return u},getReactMountReady:function(){return l},getUpdateQueue:function(){return this.updateQueue},destructor:function(){},checkpoint:function(){},rollback:function(){}};i(n.prototype,o,c),a.addPoolingTo(n),t.exports=n},{144:144,24:24,58:58,69:69,89:89}],69:[function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var i=e(70),a=(e(143),function(){function e(t){n(this,e),this.transaction=t}return e.prototype.isMounted=function(e){return!1},e.prototype.enqueueCallback=function(e,t,r){this.transaction.isInTransaction()&&i.enqueueCallback(e,t,r)},e.prototype.enqueueForceUpdate=function(e){this.transaction.isInTransaction()&&i.enqueueForceUpdate(e)},e.prototype.enqueueReplaceState=function(e,t){this.transaction.isInTransaction()&&i.enqueueReplaceState(e,t)},e.prototype.enqueueSetState=function(e,t){this.transaction.isInTransaction()&&i.enqueueSetState(e,t)},e}());t.exports=a},{143:143,70:70}],70:[function(e,t,r){"use strict";function n(e){u.enqueueUpdate(e)}function i(e){var t=typeof e;if("object"!==t)return t;var r=e.constructor&&e.constructor.name||t,n=Object.keys(e);return n.length>0&&n.length<20?r+" (keys: "+n.join(", ")+")":r}function a(e,t){var r=s.get(e);return r||null}var o=e(113),s=(e(120),e(57)),u=(e(58),e(71)),l=(e(138),e(143),{isMounted:function(e){var t=s.get(e);return!!t&&!!t._renderedComponent},enqueueCallback:function(e,t,r){l.validateCallback(t,r);var i=a(e);if(!i)return null;i._pendingCallbacks?i._pendingCallbacks.push(t):i._pendingCallbacks=[t],n(i)},enqueueCallbackInternal:function(e,t){e._pendingCallbacks?e._pendingCallbacks.push(t):e._pendingCallbacks=[t],n(e)},enqueueForceUpdate:function(e){var t=a(e,"forceUpdate");t&&(t._pendingForceUpdate=!0,n(t))},enqueueReplaceState:function(e,t,r){var i=a(e,"replaceState");i&&(i._pendingStateQueue=[t],i._pendingReplaceState=!0,void 0!==r&&null!==r&&(l.validateCallback(r,"replaceState"),i._pendingCallbacks?i._pendingCallbacks.push(r):i._pendingCallbacks=[r]),n(i))},enqueueSetState:function(e,t){var r=a(e,"setState");r&&((r._pendingStateQueue||(r._pendingStateQueue=[])).push(t),n(r))},enqueueElementInternal:function(e,t,r){e._pendingElement=t,e._context=r,n(e)},validateCallback:function(e,t){e&&"function"!=typeof e&&o("122",t,i(e))}});t.exports=l},{113:113,120:120,138:138,143:143,57:57,58:58,71:71}],71:[function(e,t,r){"use strict";function n(){M.ReactReconcileTransaction&&_||c("123")}function i(){this.reinitializeTransaction(),this.dirtyComponentsLength=null,this.callbackQueue=h.getPooled(),this.reconcileTransaction=M.ReactReconcileTransaction.getPooled(!0)}function a(e,t,r,i,a,o){return n(),_.batchedUpdates(e,t,r,i,a,o)}function o(e,t){return e._mountOrder-t._mountOrder}function s(e){var t=e.dirtyComponentsLength;t!==y.length&&c("124",t,y.length),y.sort(o),g++;for(var r=0;r<t;r++){var n=y[r],i=n._pendingCallbacks;n._pendingCallbacks=null;var a;if(p.logTopLevelRenders){var s=n;n._currentElement.type.isReactTopLevelWrapper&&(s=n._renderedComponent),a="React update: "+s.getName(),console.time(a)}if(m.performUpdateIfNecessary(n,e.reconcileTransaction,g),a&&console.timeEnd(a),i)for(var u=0;u<i.length;u++)e.callbackQueue.enqueue(i[u],n.getPublicInstance())}}function u(e){if(n(),!_.isBatchingUpdates)return void _.batchedUpdates(u,e);y.push(e),null==e._updateBatchNumber&&(e._updateBatchNumber=g+1)}function l(e,t){_.isBatchingUpdates||c("125"),b.enqueue(e,t),x=!0}var c=e(113),f=e(144),h=e(6),d=e(24),p=e(53),m=e(66),v=e(89),y=(e(138),[]),g=0,b=h.getPooled(),x=!1,_=null,w={initialize:function(){this.dirtyComponentsLength=y.length},close:function(){this.dirtyComponentsLength!==y.length?(y.splice(0,this.dirtyComponentsLength),S()):y.length=0}},C={initialize:function(){this.callbackQueue.reset()},close:function(){this.callbackQueue.notifyAll()}},E=[w,C];f(i.prototype,v,{getTransactionWrappers:function(){return E},destructor:function(){this.dirtyComponentsLength=null,h.release(this.callbackQueue),this.callbackQueue=null,M.ReactReconcileTransaction.release(this.reconcileTransaction),this.reconcileTransaction=null},perform:function(e,t,r){return v.perform.call(this,this.reconcileTransaction.perform,this.reconcileTransaction,e,t,r)}}),d.addPoolingTo(i);var S=function(){for(;y.length||x;){if(y.length){var e=i.getPooled();e.perform(s,null,e),i.release(e)}if(x){x=!1;var t=b;b=h.getPooled(),t.notifyAll(),h.release(t)}}},T={injectReconcileTransaction:function(e){e||c("126"),M.ReactReconcileTransaction=e},injectBatchingStrategy:function(e){e||c("127"),"function"!=typeof e.batchedUpdates&&c("128"),"boolean"!=typeof e.isBatchingUpdates&&c("129"),_=e}},M={ReactReconcileTransaction:null,batchedUpdates:a,enqueueUpdate:u,flushBatchedUp
258dates:S,injection:T,asap:l};t.exports=M},{113:113,138:138,144:144,24:24,53:53,6:6,66:66,89:89}],72:[function(e,t,r){"use strict";t.exports="15.6.1"},{}],73:[function(e,t,r){"use strict";var n={xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace"},i={accentHeight:"accent-height",accumulate:0,additive:0,alignmentBaseline:"alignment-baseline",allowReorder:"allowReorder",alphabetic:0,amplitude:0,arabicForm:"arabic-form",ascent:0,attributeName:"attributeName",attributeType:"attributeType",autoReverse:"autoReverse",azimuth:0,baseFrequency:"baseFrequency",baseProfile:"baseProfile",baselineShift:"baseline-shift",bbox:0,begin:0,bias:0,by:0,calcMode:"calcMode",capHeight:"cap-height",clip:0,clipPath:"clip-path",clipRule:"clip-rule",clipPathUnits:"clipPathUnits",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",contentScriptType:"contentScriptType",contentStyleType:"contentStyleType",cursor:0,cx:0,cy:0,d:0,decelerate:0,descent:0,diffuseConstant:"diffuseConstant",direction:0,display:0,divisor:0,dominantBaseline:"dominant-baseline",dur:0,dx:0,dy:0,edgeMode:"edgeMode",elevation:0,enableBackground:"enable-background",end:0,exponent:0,externalResourcesRequired:"externalResourcesRequired",fill:0,fillOpacity:"fill-opacity",fillRule:"fill-rule",filter:0,filterRes:"filterRes",filterUnits:"filterUnits",floodColor:"flood-color",floodOpacity:"flood-opacity",focusable:0,fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",format:0,from:0,fx:0,fy:0,g1:0,g2:0,glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",glyphRef:"glyphRef",gradientTransform:"gradientTransform",gradientUnits:"gradientUnits",hanging:0,horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",ideographic:0,imageRendering:"image-rendering",in:0,in2:0,intercept:0,k:0,k1:0,k2:0,k3:0,k4:0,kernelMatrix:"kernelMatrix",kernelUnitLength:"kernelUnitLength",kerning:0,keyPoints:"keyPoints",keySplines:"keySplines",keyTimes:"keyTimes",lengthAdjust:"lengthAdjust",letterSpacing:"letter-spacing",lightingColor:"lighting-color",limitingConeAngle:"limitingConeAngle",local:0,markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",markerHeight:"markerHeight",markerUnits:"markerUnits",markerWidth:"markerWidth",mask:0,maskContentUnits:"maskContentUnits",maskUnits:"maskUnits",mathematical:0,mode:0,numOctaves:"numOctaves",offset:0,opacity:0,operator:0,order:0,orient:0,orientation:0,origin:0,overflow:0,overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pathLength:"pathLength",patternContentUnits:"patternContentUnits",patternTransform:"patternTransform",patternUnits:"patternUnits",pointerEvents:"pointer-events",points:0,pointsAtX:"pointsAtX",pointsAtY:"pointsAtY",pointsAtZ:"pointsAtZ",preserveAlpha:"preserveAlpha",preserveAspectRatio:"preserveAspectRatio",primitiveUnits:"primitiveUnits",r:0,radius:0,refX:"refX",refY:"refY",renderingIntent:"rendering-intent",repeatCount:"repeatCount",repeatDur:"repeatDur",requiredExtensions:"requiredExtensions",requiredFeatures:"requiredFeatures",restart:0,result:0,rotate:0,rx:0,ry:0,scale:0,seed:0,shapeRendering:"shape-rendering",slope:0,spacing:0,specularConstant:"specularConstant",specularExponent:"specularExponent",speed:0,spreadMethod:"spreadMethod",startOffset:"startOffset",stdDeviation:"stdDeviation",stemh:0,stemv:0,stitchTiles:"stitchTiles",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",string:0,stroke:0,strokeDasharray:"stroke-dasharray",strokeDashoffset:"stroke-dashoffset",strokeLinecap:"stroke-linecap",strokeLinejoin:"stroke-linejoin",strokeMiterlimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",surfaceScale:"surfaceScale",systemLanguage:"systemLanguage",tableValues:"tableValues",targetX:"targetX",targetY:"targetY",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",textLength:"textLength",to:0,transform:0,u1:0,u2:0,underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicode:0,unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",values:0,vectorEffect:"vector-effect",version:0,vertAdvY:"vert-
258adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",viewBox:"viewBox",viewTarget:"viewTarget",visibility:0,widths:0,wordSpacing:"word-spacing",writingMode:"writing-mode",x:0,xHeight:"x-height",x1:0,x2:0,xChannelSelector:"xChannelSelector",xlinkActuate:"xlink:actuate",xlinkArcrole:"xlink:arcrole",xlinkHref:"xlink:href",xlinkRole:"xlink:role",xlinkShow:"xlink:show",xlinkTitle:"xlink:title",xlinkType:"xlink:type",xmlBase:"xml:base",xmlns:0,xmlnsXlink:"xmlns:xlink",xmlLang:"xml:lang",xmlSpace:"xml:space",y:0,y1:0,y2:0,yChannelSelector:"yChannelSelector",z:0,zoomAndPan:"zoomAndPan"},a={Properties:{},DOMAttributeNamespaces:{xlinkActuate:n.xlink,xlinkArcrole:n.xlink,xlinkHref:n.xlink,xlinkRole:n.xlink,xlinkShow:n.xlink,xlinkTitle:n.xlink,xlinkType:n.xlink,xmlBase:n.xml,xmlLang:n.xml,xmlSpace:n.xml},DOMAttributeNames:{}};Object.keys(i).forEach(function(e){a.Properties[e]=0,i[e]&&(a.DOMAttributeNames[e]=i[e])}),t.exports=a},{}],74:[function(e,t,r){"use strict";function n(e){if("selectionStart"in e&&u.hasSelectionCapabilities(e))return{start:e.selectionStart,end:e.selectionEnd};if(window.getSelection){var t=window.getSelection();return{anchorNode:t.anchorNode,anchorOffset:t.anchorOffset,focusNode:t.focusNode,focusOffset:t.focusOffset}}if(document.selection){var r=document.selection.createRange();return{parentElement:r.parentElement(),text:r.text,top:r.boundingTop,left:r.boundingLeft}}}function i(e,t){if(g||null==m||m!==c())return null;var r=n(m);if(!y||!h(y,r)){y=r;var i=l.getPooled(p.select,v,e,t);return i.type="select",i.target=m,a.accumulateTwoPhaseDispatches(i),i}return null}var a=e(19),o=e(124),s=e(33),u=e(56),l=e(80),c=e(133),f=e(111),h=e(142),d=o.canUseDOM&&"documentMode"in document&&document.documentMode<=11,p={select:{phasedRegistrationNames:{bubbled:"onSelect",captured:"onSelectCapture"},dependencies:["topBlur","topContextMenu","topFocus","topKeyDown","topKeyUp","topMouseDown","topMouseUp","topSelectionChange"]}},m=null,v=null,y=null,g=!1,b=!1,x={eventTypes:p,extractEvents:function(e,t,r,n){ 259if(!b)return null;var a=t?s.getNodeFromInstance(t):window;switch(e){case"topFocus":(f(a)||"true"===a.contentEditable)&&(m=a,v=t,y=null);break;case"topBlur":m=null,v=null,y=null;break;case"topMouseDown":g=!0;break;case"topContextMenu":case"topMouseUp":return g=!1,i(r,n);case"topSelectionChange":if(d)break;case"topKeyDown":case"topKeyUp":return i(r,n)}return null},didPutListener:function(e,t,r){"onSelect"===t&&(b=!0)}};t.exports=x},{111:111,124:124,133:133,142:142,19:19,33:33,56:56,80:80}],75:[function(e,t,r){"use strict";function n(e){return"."+e._rootNodeID}function i(e){return"button"===e||"input"===e||"select"===e||"textarea"===e}var a=e(113),o=e(123),s=e(19),u=e(33),l=e(76),c=e(77),f=e(80),h=e(81),d=e(83),p=e(84),m=e(79),v=e(85),y=e(86),g=e(87),b=e(88),x=e(130),_=e(99),w=(e(138),{}),C={};["abort","animationEnd","animationIteration","animationStart","blur","canPlay","canPlayThrough","click","contextMenu","copy","cut","doubleClick","drag","dragEnd","dragEnter","dragExit","dragLeave","dragOver","dragStart","drop","durationChange","emptied","encrypted","ended","error","focus","input","invalid","keyDown","keyPress","keyUp","load","loadedData","loadedMetadata","loadStart","mouseDown","mouseMove","mouseOut","mouseOver","mouseUp","paste","pause","play","playing","progress","rateChange","reset","scroll","seeked","seeking","stalled","submit","suspend","timeUpdate","touchCancel","touchEnd","touchMove","touchStart","transitionEnd","volumeChange","waiting","wheel"].forEach(function(e){var t=e[0].toUpperCase()+e.slice(1),r="on"+t,n="top"+t,i={phasedRegistrationNames:{bubbled:r,captured:r+"Capture"},dependencies:[n]};w[e]=i,C[n]=i});var E={},S={eventTypes:w,extractEvents:function(e,t,r,n){var i=C[e];if(!i)return null;var o;switch(e){case"topAbort":case"topCanPlay":case"topCanPlayThrough":case"topDurationChange":case"topEmptied":case"topEncrypted":case"topEnded":case"topError":case"topInput":case"topInvalid":case"topLoad":case"topLoadedData":case"topLoadedMetadata":case"topLoadStart":case"topPause":case"topPlay":case"topPlaying":case"topProgress":case"topRateChange":case"topReset":case"topSeeked":case"topSeeking":case"topStalled":case"topSubmit":case"topSuspend":case"topTimeUpdate":case"topVolumeChange":case"topWaiting":o=f;break;case"topKeyPress":if(0===_(r))return null;case"topKeyDown":case"topKeyUp":o=d;break;case"topBlur":case"topFocus":o=h;break;case"topClick":if(2===r.button)return null;case"topDoubleClick":case"topMouseDown":case"topMouseMove":case"topMouseUp":case"topMouseOut":case"topMouseOver":case"topContextMenu":o=p;break;case"topDrag":case"topDragEnd":case"topDragEnter":case"topDragExit":case"topDragLeave":case"topDragOver":case"topDragStart":case"topDrop":o=m;break;case"topTouchCancel":case"topTouchEnd":case"topTouchMove":case"topTouchStart":o=v;break;case"topAnimationEnd":case"topAnimationIteration":case"topAnimationStart":o=l;break;case"topTransitionEnd":o=y;break;case"topScroll":o=g;break;case"topWheel":o=b;break;case"topCopy":case"topCut":case"topPaste":o=c}o||a("86",e);var u=o.getPooled(i,t,r,n);return s.accumulateTwoPhaseDispatches(u),u},didPutListener:function(e,t,r){if("onClick"===t&&!i(e._tag)){var a=n(e),s=u.getNodeFromInstance(e);E[a]||(E[a]=o.listen(s,"click",x))}},willDeleteListener:function(e,t){if("onClick"===t&&!i(e._tag)){var r=n(e);E[r].remove(),delete E[r]}}};t.exports=S},{113:113,123:123,130:130,138:138,19:19,33:33,76:76,77:77,79:79,80:80,81:81,83:83,84:84,85:85,86:86,87:87,88:88,99:99}],76:[function(e,t,r){"use strict";function n(e,t,r,n){return i.call(this,e,t,r,n)}var i=e(80),a={animationName:null,elapsedTime:null,pseudoElement:null};i.augmentClass(n,a),t.exports=n},{80:80}],77:[function(e,t,r){"use strict";function n(e,t,r,n){return i.call(this,e,t,r,n)}var i=e(80),a={clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}};i.augmentClass(n,a),t.exports=n},{80:80}],78:[function(e,t,r){"use strict";function n(e,t,r,n){return i.call(this,e,t,r,n)}var i=e(80),a={data:null};i.augmentClass(n,a),t.exports=n},{80:80}],79:[function(e,t,r){"use strict";function n(e,t,r,n){return i.call(this,e,t,r,n)}var i=e(84),a={dataTransfer:null};i.augmentClass(n,a),t.exports=n},{84:84}],80:[function(e,t,r){"use strict";function n(e,t,r,n){this.dispatchConfig=e,this._targetInst=t,this.nativeEvent=r;var i=this.constructor.Interface;for(var a in i)if(i.hasOwnProperty(a)){var s=i[a];s?this[a]=s(r):"target"===a?this.target=n:this[a]=r[a]}var u=null!=r.defaultPrevented?r.defaultPrevented:!1===r.returnValue;return this.isDefaultPrevented=u?o.thatReturnsTrue:o.thatReturnsFalse,this.isPropagationStopped=o.thatReturnsFalse,this}var i=e(144),a=e(24),o=e(130),s=(e(143),["dispatchConfig","_targetInst","nativeEvent","isDefaultPrevented","isPropagationStopped","_dispatchListeners","_dispatchInstances"]),u={type:null,target:null,currentTarget:o.thatReturnsNull,eventPhase:null,bubbles:null,cancelable:null,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:null,isTrusted:null};i(n.prototype,{preventDefault:function(){this.defaultPrevented=!0;var e=this.nativeEvent;e&&(e.preventDefault?e.preventDefault():"unknown"!=typeof e.returnValue&&(e.returnValue=!1),this.isDefaultPrevented=o.thatReturnsTrue)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():"unknown"!=typeof e.cancelBubble&&(e.cancelBubble=!0),this.isPropagationStopped=o.thatReturnsTrue)},persist:function(){this.isPersistent=o.thatReturnsTrue},isPersistent:o.thatReturnsFalse,destructor:function(){var e=this.constructor.Interface;for(var t in e)this[t]=null;for(var r=0;r<s.length;r++)this[s[r]]=null}}),n.Interface=u,n.augmentClass=function(e,t){var r=this,n=function(){};n.prototype=r.prototype;var o=new n;i(o,e.prototype),e.prototype=o,e.prototype.constructor=e,e.Interface=i({},r.Interface,t),e.augmentClass=r.augmentClass,a.addPoolingTo(e,a.fourArgumentPooler)},a.addPoolingTo(n,a.fourArgumentPooler),t.exports=n},{130:130,143:143,144:144,24:24}],81:[function(e,t,r){"use strict";function n(e,t,r,n){return i.call(this,e,t,r,n)}var i=e(87),a={relatedTarget:null};i.augmentClass(n,a),t.exports=n},{87:87}],82:[function(e,t,r){"use strict";function n(e,t,r,n){return i.call(this,e,t,r,n)}var i=e(80),a={data:null};i.augmentClass(n,a),t.exports=n},{80:80}],83:[function(e,t,r){"use strict";function n(e,t,r,n){return i.call(this,e,t,r,n)}var i=e(87),a=e(99),o=e(100),s=e(101),u={key:o,location:null,ctrlKey:null,
259shiftKey:null,altKey:null,metaKey:null,repeat:null,locale:null,getModifierState:s,charCode:function(e){return"keypress"===e.type?a(e):0},keyCode:function(e){return"keydown"===e.type||"keyup"===e.type?e.keyCode:0},which:function(e){return"keypress"===e.type?a(e):"keydown"===e.type||"keyup"===e.type?e.keyCode:0}};i.augmentClass(n,u),t.exports=n},{100:100,101:101,87:87,99:99}],84:[function(e,t,r){"use strict";function n(e,t,r,n){return i.call(this,e,t,r,n)}var i=e(87),a=e(90),o=e(101),s={screenX:null,screenY:null,clientX:null,clientY:null,ctrlKey:null,shiftKey:null,altKey:null,metaKey:null,getModifierState:o,button:function(e){var t=e.button;return"which"in e?t:2===t?2:4===t?1:0},buttons:null,relatedTarget:function(e){return e.relatedTarget||(e.fromElement===e.srcElement?e.toElement:e.fromElement)},pageX:function(e){return"pageX"in e?e.pageX:e.clientX+a.currentScrollLeft},pageY:function(e){return"pageY"in e?e.pageY:e.clientY+a.currentScrollTop}};i.augmentClass(n,s),t.exports=n},{101:101,87:87,90:90}],85:[function(e,t,r){"use strict";function n(e,t,r,n){return i.call(this,e,t,r,n)}var i=e(87),a=e(101),o={touches:null,targetTouches:null,changedTouches:null,altKey:null,metaKey:null,ctrlKey:null,shiftKey:null,getModifierState:a};i.augmentClass(n,o),t.exports=n},{101:101,87:87}],86:[function(e,t,r){"use strict";function n(e,t,r,n){return i.call(this,e,t,r,n)}var i=e(80),a={propertyName:null,elapsedTime:null,pseudoElement:null};i.augmentClass(n,a),t.exports=n},{80:80}],87:[function(e,t,r){"use strict";function n(e,t,r,n){return i.call(this,e,t,r,n)}var i=e(80),a=e(102),o={view:function(e){if(e.view)return e.view;var t=a(e);if(t.window===t)return t;var r=t.ownerDocument;return r?r.defaultView||r.parentWindow:window},detail:function(e){return e.detail||0}};i.augmentClass(n,o),t.exports=n},{102:102,80:80}],88:[function(e,t,r){"use strict";function n(e,t,r,n){return i.call(this,e,t,r,n)}var i=e(84),a={deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:null,deltaMode:null};i.augmentClass(n,a),t.exports=n},{84:84}],89:[function(e,t,r){"use strict";var n=e(113),i=(e(138),{}),a={reinitializeTransaction:function(){this.transactionWrappers=this.getTransactionWrappers(),this.wrapperInitData?this.wrapperInitData.length=0:this.wrapperInitData=[],this._isInTransaction=!1},_isInTransaction:!1,getTransactionWrappers:null,isInTransaction:function(){return!!this._isInTransaction},perform:function(e,t,r,i,a,o,s,u){this.isInTransaction()&&n("27");var l,c;try{this._isInTransaction=!0,l=!0,this.initializeAll(0),c=e.call(t,r,i,a,o,s,u),l=!1}finally{try{if(l)try{this.closeAll(0)}catch(e){}else this.closeAll(0)}finally{this._isInTransaction=!1}}return c},initializeAll:function(e){for(var t=this.transactionWrappers,r=e;r<t.length;r++){var n=t[r];try{this.wrapperInitData[r]=i,this.wrapperInitData[r]=n.initialize?n.initialize.call(this):null}finally{if(this.wrapperInitData[r]===i)try{this.initializeAll(r+1)}catch(e){}}}},closeAll:function(e){this.isInTransaction()||n("28");for(var t=this.transactionWrappers,r=e;r<t.length;r++){var a,o=t[r],s=this.wrapperInitData[r];try{a=!0,s!==i&&o.close&&o.close.call(this,s),a=!1}finally{if(a)try{this.closeAll(r+1)}catch(e){}}}this.wrapperInitData.length=0}};t.exports=a},{113:113,138:138}],90:[function(e,t,r){"use strict";var n={currentScrollLeft:0,currentScrollTop:0,refreshScrollValues:function(e){n.currentScrollLeft=e.x,n.currentScrollTop=e.y}};t.exports=n},{}],91:[function(e,t,r){"use strict";function n(e,t){return null==t&&i("30"),null==e?t:Array.isArray(e)?Array.isArray(t)?(e.push.apply(e,t),e):(e.push(t),e):Array.isArray(t)?[e].concat(t):[e,t]}var i=e(113);e(138);t.exports=n},{113:113,138:138}],92:[function(e,t,r){"use strict";function n(e){for(var t=1,r=0,n=0,a=e.length,o=-4&a;n<o;){for(var s=Math.min(n+4096,o);n<s;n+=4)r+=(t+=e.charCodeAt(n))+(t+=e.charCodeAt(n+1))+(t+=e.charCodeAt(n+2))+(t+=e.charCodeAt(n+3));t%=i,r%=i}for(;n<a;n++)r+=t+=e.charCodeAt(n);return t%=i,r%=i,t|r<<16}var i=65521;t.exports=n},{}],93:[function(e,t,r){"use strict";var n=function(e){return"undefined"!=typeof MSApp&&MSApp.execUnsafeLocalFunction?function(t,r,n,i){MSApp.execUnsafeLocalFunction(function(){return e(t,r,n,i)})}:e};t.exports=n},{}],94:[function(e,t,r){"use strict";function n(e,t,r,n){if(null==t||"boolean"==typeof t||""===t)return"";var i=isNaN(t);return n||i||0===t||a.hasOwnProperty(e)&&a[e]?""+t:("string"==typeof t&&(t=t.trim()),t+"px")}var i=e(4),a=(e(143),i.isUnitlessNumber);t.exports=n},{143:143,4:4}],95:[function(e,t,r){"use strict";function n(e){var t=""+e,r=a.exec(t);if(!r)return t;var n,i="",o=0,s=0;for(o=r.index;o<t.length;o++){switch(t.charCodeAt(o)){case 34:n=""";break;case 38:n="&";break;case 39:n="'";break;case 60:n="<";break;case 62:n=">";break;default:continue}s!==o&&(i+=t.substring(s,o)),s=o+1,i+=n}return s!==o?i+t.substring(s,o):i}function i(e){return"boolean"==typeof e||"number"==typeof e?""+e:n(e)}var a=/["'&<>]/;t.exports=i},{}],96:[function(e,t,r){"use strict";function n(e){if(null==e)return null;if(1===e.nodeType)return e;var t=o.get(e);if(t)return t=s(t),t?a.getNodeFromInstance(t):null;"function"==typeof e.render?i("44"):i("45",Object.keys(e))}var i=e(113),a=(e(120),e(33)),o=e(57),s=e(103);e(138),e(143);t.exports=n},{103:103,113:113,120:120,138:138,143:143,33:33,57:57}],97:[function(e,t,r){(function(r){"use strict";function n(e,t,r,n){if(e&&"object"==typeof e){var i=e;void 0===i[r]&&null!=t&&(i[r]=t)}}function i(e,t){if(null==e)return e;var r={};return a(e,n,r),r}var a=(e(22),e(118));e(143);void 0!==r&&r.env,t.exports=i}).call(this,void 0)},{118:118,143:143,22:22}],98:[function(e,t,r){"use strict";function n(e,t,r){Array.isArray(e)?e.forEach(t,r):e&&t.call(r,e)}t.exports=n},{}],99:[function(e,t,r){"use strict";function n(e){var t,r=e.keyCode;return"charCode"in e?0===(t=e.charCode)&&13===r&&(t=13):t=r,t>=32||13===t?t:0}t.exports=n},{}],100:[function(e,t,r){"use strict";function n(e){if(e.key){var t=a[e.key]||e.key;if("Unidentified"!==t)return t}if("keypress"===e.type){var r=i(e);return 13===r?"Enter":String.fromCharCode(r)}
259return"keydown"===e.type||"keyup"===e.type?o[e.keyCode]||"Unidentified":""}var i=e(99),a={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},o={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"};t.exports=n},{99:99}],101:[function(e,t,r){"use strict";function n(e){var t=this,r=t.nativeEvent;if(r.getModifierState)return r.getModifierState(e);var n=a[e];return!!n&&!!r[n]}function i(e){return n}var a={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};t.exports=i},{}],102:[function(e,t,r){"use strict";function n(e){var t=e.target||e.srcElement||window;return t.correspondingUseElement&&(t=t.correspondingUseElement),3===t.nodeType?t.parentNode:t}t.exports=n},{}],103:[function(e,t,r){"use strict";function n(e){for(var t;(t=e._renderedNodeType)===i.COMPOSITE;)e=e._renderedComponent;return t===i.HOST?e._renderedComponent:t===i.EMPTY?null:void 0}var i=e(62);t.exports=n},{62:62}],104:[function(e,t,r){"use strict";function n(e){var t=e&&(i&&e[i]||e[a]);if("function"==typeof t)return t}var i="function"==typeof Symbol&&Symbol.iterator,a="@@iterator";t.exports=n},{}],105:[function(e,t,r){"use strict";function n(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function i(e){for(;e;){if(e.nextSibling)return e.nextSibling;e=e.parentNode}}function a(e,t){for(var r=n(e),a=0,o=0;r;){if(3===r.nodeType){if(o=a+r.textContent.length,a<=t&&o>=t)return{node:r,offset:t-a};a=o}r=n(i(r))}}t.exports=a},{}],106:[function(e,t,r){"use strict";function n(){return!a&&i.canUseDOM&&(a="textContent"in document.documentElement?"textContent":"innerText"),a}var i=e(124),a=null;t.exports=n},{124:124}],107:[function(e,t,r){"use strict";function n(e,t){var r={};return r[e.toLowerCase()]=t.toLowerCase(),r["Webkit"+e]="webkit"+t,r["Moz"+e]="moz"+t,r["ms"+e]="MS"+t,r["O"+e]="o"+t.toLowerCase(),r}function i(e){if(s[e])return s[e];if(!o[e])return e;var t=o[e];for(var r in t)if(t.hasOwnProperty(r)&&r in u)return s[e]=t[r];return""}var a=e(124),o={animationend:n("Animation","AnimationEnd"),animationiteration:n("Animation","AnimationIteration"),animationstart:n("Animation","AnimationStart"),transitionend:n("Transition","TransitionEnd")},s={},u={};a.canUseDOM&&(u=document.createElement("div").style,"AnimationEvent"in window||(delete o.animationend.animation,delete o.animationiteration.animation,delete o.animationstart.animation),"TransitionEvent"in window||delete o.transitionend.transition),t.exports=i},{124:124}],108:[function(e,t,r){"use strict";function n(e){var t=e.type,r=e.nodeName;return r&&"input"===r.toLowerCase()&&("checkbox"===t||"radio"===t)}function i(e){return e._wrapperState.valueTracker}function a(e,t){e._wrapperState.valueTracker=t}function o(e){delete e._wrapperState.valueTracker}function s(e){var t;return e&&(t=n(e)?""+e.checked:e.value),t}var u=e(33),l={_getTrackerFromNode:function(e){return i(u.getInstanceFromNode(e))},track:function(e){if(!i(e)){var t=u.getNodeFromInstance(e),r=n(t)?"checked":"value",s=Object.getOwnPropertyDescriptor(t.constructor.prototype,r),l=""+t[r];t.hasOwnProperty(r)||"function"!=typeof s.get||"function"!=typeof s.set||(Object.defineProperty(t,r,{enumerable:s.enumerable,configurable:!0,get:function(){return s.get.call(this)},set:function(e){l=""+e,s.set.call(this,e)}}),a(e,{getValue:function(){return l},setValue:function(e){l=""+e},stopTracking:function(){o(e),delete t[r]}}))}},updateValueIfChanged:function(e){if(!e)return!1;var t=i(e);if(!t)return l.track(e),!0;var r=t.getValue(),n=s(u.getNodeFromInstance(e));return n!==r&&(t.setValue(n),!0)},stopTracking:function(e){var t=i(e);t&&t.stopTracking()}};t.exports=l},{33:33}],109:[function(e,t,r){"use strict";function n(e){if(e){var t=e.getName();if(t)return" Check the render method of `"+t+"`."}return""}function i(e){return"function"==typeof e&&void 0!==e.prototype&&"function"==typeof e.prototype.mountComponent&&"function"==typeof e.prototype.receiveComponent}function a(e,t){var r;if(null===e||!1===e)r=l.create(a);else if("object"==typeof e){var s=e,u=s.type;if("function"!=typeof u&&"string"!=typeof u){var h="";h+=n(s._owner),o("130",null==u?u:typeof u,h)}"string"==typeof s.type?r=c.createInternalComponent(s):i(s.type)?(r=new s.type(s),r.getHostNode||(r.getHostNode=r.getNativeNode)):r=new f(s)}else"string"==typeof e||"number"==typeof e?r=c.createInstanceForText(e):o("131",typeof e);return r._mountIndex=0,r._mountImage=null,r}var o=e(113),s=e(144),u=e(29),l=e(49),c=e(54),f=(e(122),e(138),e(143),function(e){this.construct(e)});s(f.prototype,u,{_instantiateReactComponent:a}),t.exports=a},{113:113,122:122,138:138,143:143,144:144,29:29,49:49,54:54}],110:[function(e,t,r){"use strict";function n(e,t){if(!a.canUseDOM||t&&!("addEventListener"in document))return!1;var r="on"+e,n=r in document;if(!n){var o=document.createElement("div");o.setAttribute(r,"return;"),n="function"==typeof o[r]}return!n&&i&&"wheel"===e&&(n=document.implementation.hasFeature("Events.wheel","3.0")),n}var i,a=e(124);a.canUseDOM&&(i=document.implementation&&document.implementation.hasFeature&&!0!==document.implementation.hasFeature("","")),t.exports=n},{124:124}],111:[function(e,t,r){"use strict";function n(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return"input"===t?!!i[e.type]:"textarea"===t}var i={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};t.exports=n},{}],112:[function(e,t,r){"use strict";function n(e){return'"'+i(e)+'"'}var i=e(95);t.exports=n},{95:95}],113:[function(e,t,r){"use strict";function n(e){for(var t=arguments.length-1,r="Minified React error #"+e+"; visit http://facebook.github.io/react/docs/error-decoder.html?invariant="+e,n=0;n<t;n++)r+="&args[]="+encodeURIComponent(arguments[n+1]);r+=" for the full message or use the non-minified dev environment for full errors and additional helpful warnings.";var i=new Error(r);throw i.name="Invariant Violation",i.framesToPop=1,i}t.exports=n},{}],114:[function(e,t,r){"use strict";var n=e(60);t.exports=n.renderSubtreeIntoContainer}
259,{60:60}],115:[function(e,t,r){"use strict";var n,i=e(124),a=e(10),o=/^[ \r\n\t\f]/,s=/<(!--|link|noscript|meta|script|style)[ \r\n\t\f\/>]/,u=e(93),l=u(function(e,t){if(e.namespaceURI!==a.svg||"innerHTML"in e)e.innerHTML=t;else{n=n||document.createElement("div"),n.innerHTML="<svg>"+t+"</svg>";for(var r=n.firstChild;r.firstChild;)e.appendChild(r.firstChild)}});if(i.canUseDOM){var c=document.createElement("div");c.innerHTML=" ",""===c.innerHTML&&(l=function(e,t){if(e.parentNode&&e.parentNode.replaceChild(e,e),o.test(t)||"<"===t[0]&&s.test(t)){e.innerHTML=String.fromCharCode(65279)+t;var r=e.firstChild;1===r.data.length?e.removeChild(r):r.deleteData(0,1)}else e.innerHTML=t}),c=null}t.exports=l},{10:10,124:124,93:93}],116:[function(e,t,r){"use strict";var n=e(124),i=e(95),a=e(115),o=function(e,t){if(t){var r=e.firstChild;if(r&&r===e.lastChild&&3===r.nodeType)return void(r.nodeValue=t)}e.textContent=t};n.canUseDOM&&("textContent"in document.documentElement||(o=function(e,t){if(3===e.nodeType)return void(e.nodeValue=t);a(e,i(t))})),t.exports=o},{115:115,124:124,95:95}],117:[function(e,t,r){"use strict";function n(e,t){var r=null===e||!1===e,n=null===t||!1===t;if(r||n)return r===n;var i=typeof e,a=typeof t;return"string"===i||"number"===i?"string"===a||"number"===a:"object"===a&&e.type===t.type&&e.key===t.key}t.exports=n},{}],118:[function(e,t,r){"use strict";function n(e,t){return e&&"object"==typeof e&&null!=e.key?l.escape(e.key):t.toString(36)}function i(e,t,r,a){var h=typeof e;if("undefined"!==h&&"boolean"!==h||(e=null),null===e||"string"===h||"number"===h||"object"===h&&e.$$typeof===s)return r(a,e,""===t?c+n(e,0):t),1;var d,p,m=0,v=""===t?c:t+f;if(Array.isArray(e))for(var y=0;y<e.length;y++)d=e[y],p=v+n(d,y),m+=i(d,p,r,a);else{var g=u(e);if(g){var b,x=g.call(e);if(g!==e.entries)for(var _=0;!(b=x.next()).done;)d=b.value,p=v+n(d,_++),m+=i(d,p,r,a);else for(;!(b=x.next()).done;){var w=b.value;w&&(d=w[1],p=v+l.escape(w[0])+f+n(d,0),m+=i(d,p,r,a))}}else if("object"===h){var C=String(e);o("31","[object Object]"===C?"object with keys {"+Object.keys(e).join(", ")+"}":C,"")}}return m}function a(e,t,r){return null==e?0:i(e,"",t,r)}var o=e(113),s=(e(120),e(48)),u=e(104),l=(e(138),e(22)),c=(e(143),"."),f=":";t.exports=a},{104:104,113:113,120:120,138:138,143:143,22:22,48:48}],119:[function(e,t,r){"use strict";var n=(e(144),e(130)),i=(e(143),n);t.exports=i},{130:130,143:143,144:144}],120:[function(t,r,n){"use strict";var i=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;r.exports=i.ReactCurrentOwner},{}],121:[function(t,r,n){"use strict";r.exports=e},{}],122:[function(t,r,n){"use strict";var i=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;r.exports=i.getNextDebugID},{}],123:[function(e,t,r){"use strict";var n=e(130),i={listen:function(e,t,r){return e.addEventListener?(e.addEventListener(t,r,!1),{remove:function(){e.removeEventListener(t,r,!1)}}):e.attachEvent?(e.attachEvent("on"+t,r),{remove:function(){e.detachEvent("on"+t,r)}}):void 0},capture:function(e,t,r){return e.addEventListener?(e.addEventListener(t,r,!0),{remove:function(){e.removeEventListener(t,r,!0)}}):{remove:n}},registerDefault:function(){}};t.exports=i},{130:130}],124:[function(e,t,r){"use strict";var n=!("undefined"==typeof window||!window.document||!window.document.createElement),i={canUseDOM:n,canUseWorkers:"undefined"!=typeof Worker,canUseEventListeners:n&&!(!window.addEventListener&&!window.attachEvent),canUseViewport:n&&!!window.screen,isInWorker:!n};t.exports=i},{}],125:[function(e,t,r){"use strict";function n(e){return e.replace(i,function(e,t){return t.toUpperCase()})}var i=/-(.)/g;t.exports=n},{}],126:[function(e,t,r){"use strict";function n(e){return i(e.replace(a,"ms-"))}var i=e(125),a=/^-ms-/;t.exports=n},{125:125}],127:[function(e,t,r){"use strict";function n(e,t){return!(!e||!t)&&(e===t||!i(e)&&(i(t)?n(e,t.parentNode):"contains"in e?e.contains(t):!!e.compareDocumentPosition&&!!(16&e.compareDocumentPosition(t))))}var i=e(140);t.exports=n},{140:140}],128:[function(e,t,r){"use strict";function n(e){var t=e.length;if((Array.isArray(e)||"object"!=typeof e&&"function"!=typeof e)&&o(!1),"number"!=typeof t&&o(!1),0===t||t-1 in e||o(!1),"function"==typeof e.callee&&o(!1),e.hasOwnProperty)try{return Array.prototype.slice.call(e)}catch(e){}for(var r=Array(t),n=0;n<t;n++)r[n]=e[n];return r}function i(e){return!!e&&("object"==typeof e||"function"==typeof e)&&"length"in e&&!("setInterval"in e)&&"number"!=typeof e.nodeType&&(Array.isArray(e)||"callee"in e||"item"in e)}function a(e){return i(e)?Array.isArray(e)?e.slice():n(e):[e]}var o=e(138);t.exports=a},{138:138}],129:[function(e,t,r){"use strict";function n(e){var t=e.match(c);return t&&t[1].toLowerCase()}function i(e,t){var r=l;l||u(!1);var i=n(e),a=i&&s(i);if(a){r.innerHTML=a[1]+e+a[2];for(var c=a[0];c--;)r=r.lastChild}else r.innerHTML=e;var f=r.getElementsByTagName("script");f.length&&(t||u(!1),o(f).forEach(t));for(var h=Array.from(r.childNodes);r.lastChild;)r.removeChild(r.lastChild);return h}var a=e(124),o=e(128),s=e(134),u=e(138),l=a.canUseDOM?document.createElement("div"):null,c=/^\s*<(\w+)/;t.exports=i},{124:124,128:128,134:134,138:138}],130:[function(e,t,r){"use strict";function n(e){return function(){return e}}var i=function(){};i.thatReturns=n,i.thatReturnsFalse=n(!1),i.thatReturnsTrue=n(!0),i.thatReturnsNull=n(null),i.thatReturnsThis=function(){return this},i.thatReturnsArgument=function(e){return e},t.exports=i},{}],131:[function(e,t,r){"use strict";var n={};t.exports=n},{}
259],132:[function(e,t,r){"use strict";function n(e){try{e.focus()}catch(e){}}t.exports=n},{}],133:[function(e,t,r){"use strict";function n(e){if(void 0===(e=e||("undefined"!=typeof document?document:void 0)))return null;try{return e.activeElement||e.body}catch(t){return e.body}}t.exports=n},{}],134:[function(e,t,r){"use strict";function n(e){return o||a(!1),h.hasOwnProperty(e)||(e="*"),s.hasOwnProperty(e)||(o.innerHTML="*"===e?"<link />":"<"+e+"></"+e+">",s[e]=!o.firstChild),s[e]?h[e]:null}var i=e(124),a=e(138),o=i.canUseDOM?document.createElement("div"):null,s={},u=[1,'<select multiple="true">',"</select>"],l=[1,"<table>","</table>"],c=[3,"<table><tbody><tr>","</tr></tbody></table>"],f=[1,'<svg xmlns="http://www.w3.org/2000/svg">',"</svg>"],h={"*":[1,"?<div>","</div>"],area:[1,"<map>","</map>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],legend:[1,"<fieldset>","</fieldset>"],param:[1,"<object>","</object>"],tr:[2,"<table><tbody>","</tbody></table>"],optgroup:u,option:u,caption:l,colgroup:l,tbody:l,tfoot:l,thead:l,td:c,th:c};["circle","clipPath","defs","ellipse","g","image","line","linearGradient","mask","path","pattern","polygon","polyline","radialGradient","rect","stop","text","tspan"].forEach(function(e){h[e]=f,s[e]=!0}),t.exports=n},{124:124,138:138}],135:[function(e,t,r){"use strict";function n(e){return e.Window&&e instanceof e.Window?{x:e.pageXOffset||e.document.documentElement.scrollLeft,y:e.pageYOffset||e.document.documentElement.scrollTop}:{x:e.scrollLeft,y:e.scrollTop}}t.exports=n},{}],136:[function(e,t,r){"use strict";function n(e){return e.replace(i,"-$1").toLowerCase()}var i=/([A-Z])/g;t.exports=n},{}],137:[function(e,t,r){"use strict";function n(e){return i(e).replace(a,"-ms-")}var i=e(136),a=/^ms-/;t.exports=n},{136:136}],138:[function(e,t,r){"use strict";function n(e,t,r,n,a,o,s,u){if(i(t),!e){var l;if(void 0===t)l=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var c=[r,n,a,o,s,u],f=0;l=new Error(t.replace(/%s/g,function(){return c[f++]})),l.name="Invariant Violation"}throw l.framesToPop=1,l}}var i=function(e){};t.exports=n},{}],139:[function(e,t,r){"use strict";function n(e){var t=e?e.ownerDocument||e:document,r=t.defaultView||window;return!(!e||!("function"==typeof r.Node?e instanceof r.Node:"object"==typeof e&&"number"==typeof e.nodeType&&"string"==typeof e.nodeName))}t.exports=n},{}],140:[function(e,t,r){"use strict";function n(e){return i(e)&&3==e.nodeType}var i=e(139);t.exports=n},{139:139}],141:[function(e,t,r){"use strict";function n(e){var t={};return function(r){return t.hasOwnProperty(r)||(t[r]=e.call(this,r)),t[r]}}t.exports=n},{}],142:[function(e,t,r){"use strict";function n(e,t){return e===t?0!==e||0!==t||1/e==1/t:e!==e&&t!==t}function i(e,t){if(n(e,t))return!0;if("object"!=typeof e||null===e||"object"!=typeof t||null===t)return!1;var r=Object.keys(e),i=Object.keys(t);if(r.length!==i.length)return!1;for(var o=0;o<r.length;o++)if(!a.call(t,r[o])||!n(e[r[o]],t[r[o]]))return!1;return!0}var a=Object.prototype.hasOwnProperty;t.exports=i},{}],143:[function(e,t,r){"use strict";var n=e(130),i=n;t.exports=i},{130:130}],144:[function(e,t,r){"use strict";function n(e){if(null===e||void 0===e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}var i=Object.getOwnPropertySymbols,a=Object.prototype.hasOwnProperty,o=Object.prototype.propertyIsEnumerable;t.exports=function(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},r=0;r<10;r++)t["_"+String.fromCharCode(r)]=r;if("0123456789"!==Object.getOwnPropertyNames(t).map(function(e){return t[e]}).join(""))return!1;var n={};return"abcdefghijklmnopqrst".split("").forEach(function(e){n[e]=e}),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},n)).join("")}catch(e){return!1}}()?Object.assign:function(e,t){for(var r,s,u=n(e),l=1;l<arguments.length;l++){r=Object(arguments[l]);for(var c in r)a.call(r,c)&&(u[c]=r[c]);if(i){s=i(r);for(var f=0;f<s.length;f++)o.call(r,s[f])&&(u[s[f]]=r[s[f]])}}return u}},{}],145:[function(e,t,r){"use strict";function n(e,t,r,n,i){}t.exports=n},{138:138,143:143,148:148}],146:[function(e,t,r){"use strict";var n=e(147);t.exports=function(e){return n(e,!1)}},{147:147}],147:[function(e,t,r){"use strict";var n=e(130),i=e(138),a=e(143),o=e(148),s=e(145);t.exports=function(e,t){function r(e){var t=e&&(E&&e[E]||e[S]);if("function"==typeof t)return t}function u(e,t){return e===t?0!==e||1/e==1/t:e!==e&&t!==t}function l(e){this.message=e,this.stack=""}function c(e){function r(r,n,a,s,u,c,f){if(s=s||T,c=c||a,f!==o)if(t)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");else;return null==n[a]?r?new l(null===n[a]?"The "+u+" `"+c+"` is marked as required in `"+s+"`, but its value is `null`.":"The "+u+" `"+c+"` is marked as required in `"+s+"`, but its value is `undefined`."):null:e(n,a,s,u,c)}var n=r.bind(null,!1);return n.isRequired=r.bind(null,!0),n}function f(e){function t(t,r,n,i,a,o){var s=t[r];
259if(x(s)!==e)return new l("Invalid "+i+" `"+a+"` of type `"+_(s)+"` supplied to `"+n+"`, expected `"+e+"`.");return null}return c(t)}function h(e){function t(t,r,n,i,a){if("function"!=typeof e)return new l("Property `"+a+"` of component `"+n+"` has invalid PropType notation inside arrayOf.");var s=t[r];if(!Array.isArray(s)){return new l("Invalid "+i+" `"+a+"` of type `"+x(s)+"` supplied to `"+n+"`, expected an array.")}for(var u=0;u<s.length;u++){var c=e(s,u,n,i,a+"["+u+"]",o);if(c instanceof Error)return c}return null}return c(t)}function d(e){function t(t,r,n,i,a){if(!(t[r]instanceof e)){var o=e.name||T;return new l("Invalid "+i+" `"+a+"` of type `"+C(t[r])+"` supplied to `"+n+"`, expected instance of `"+o+"`.")}return null}return c(t)}function p(e){function t(t,r,n,i,a){for(var o=t[r],s=0;s<e.length;s++)if(u(o,e[s]))return null;return new l("Invalid "+i+" `"+a+"` of value `"+o+"` supplied to `"+n+"`, expected one of "+JSON.stringify(e)+".")}return Array.isArray(e)?c(t):n.thatReturnsNull}function m(e){function t(t,r,n,i,a){if("function"!=typeof e)return new l("Property `"+a+"` of component `"+n+"` has invalid PropType notation inside objectOf.");var s=t[r],u=x(s);if("object"!==u)return new l("Invalid "+i+" `"+a+"` of type `"+u+"` supplied to `"+n+"`, expected an object.");for(var c in s)if(s.hasOwnProperty(c)){var f=e(s,c,n,i,a+"."+c,o);if(f instanceof Error)return f}return null}return c(t)}function v(e){function t(t,r,n,i,a){for(var s=0;s<e.length;s++){if(null==(0,e[s])(t,r,n,i,a,o))return null}return new l("Invalid "+i+" `"+a+"` supplied to `"+n+"`.")}if(!Array.isArray(e))return n.thatReturnsNull;for(var r=0;r<e.length;r++){var i=e[r];if("function"!=typeof i)return a(!1,"Invalid argument supplid to oneOfType. Expected an array of check functions, but received %s at index %s.",w(i),r),n.thatReturnsNull}return c(t)}function y(e){function t(t,r,n,i,a){var s=t[r],u=x(s);if("object"!==u)return new l("Invalid "+i+" `"+a+"` of type `"+u+"` supplied to `"+n+"`, expected `object`.");for(var c in e){var f=e[c];if(f){ 260var h=f(s,c,n,i,a+"."+c,o);if(h)return h}}return null}return c(t)}function g(t){switch(typeof t){case"number":case"string":case"undefined":return!0;case"boolean":return!t;case"object":if(Array.isArray(t))return t.every(g);if(null===t||e(t))return!0;var n=r(t);if(!n)return!1;var i,a=n.call(t);if(n!==t.entries){for(;!(i=a.next()).done;)if(!g(i.value))return!1}else for(;!(i=a.next()).done;){var o=i.value;if(o&&!g(o[1]))return!1}return!0;default:return!1}}function b(e,t){return"symbol"===e||("Symbol"===t["@@toStringTag"]||"function"==typeof Symbol&&t instanceof Symbol)}function x(e){var t=typeof e;return Array.isArray(e)?"array":e instanceof RegExp?"object":b(t,e)?"symbol":t}function _(e){if(void 0===e||null===e)return""+e;var t=x(e);if("object"===t){if(e instanceof Date)return"date";if(e instanceof RegExp)return"regexp"}return t}function w(e){var t=_(e);switch(t){case"array":case"object":return"an "+t;case"boolean":case"date":case"regexp":return"a "+t;default:return t}}function C(e){return e.constructor&&e.constructor.name?e.constructor.name:T}var E="function"==typeof Symbol&&Symbol.iterator,S="@@iterator",T="<<anonymous>>",M={array:f("array"),bool:f("boolean"),func:f("function"),number:f("number"),object:f("object"),string:f("string"),symbol:f("symbol"),any:function(){return c(n.thatReturnsNull)}(),arrayOf:h,element:function(){function t(t,r,n,i,a){var o=t[r];if(!e(o)){return new l("Invalid "+i+" `"+a+"` of type `"+x(o)+"` supplied to `"+n+"`, expected a single ReactElement.")}return null}return c(t)}(),instanceOf:d,node:function(){function e(e,t,r,n,i){return g(e[t])?null:new l("Invalid "+n+" `"+i+"` supplied to `"+r+"`, expected a ReactNode.")}return c(e)}(),objectOf:m,oneOf:p,oneOfType:v,shape:y};return l.prototype=Error.prototype,M.checkPropTypes=s,M.PropTypes=M,M}},{130:130,138:138,143:143,145:145,148:148}],148:[function(e,t,r){"use strict";t.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},{}]},{},[45])(45)}()}()});h=t.exports})();var d={};/* 261 262The MIT License (MIT) 263 264Copyright (c) 2015 Case Sandberg 265 266Permission is hereby granted, free of charge, to any person obtaining a copy 267of this software and associated documentation files (the "Software"), to deal 268in the Software without restriction, including without limitation the rights 269to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 270copies of the Software, and to permit persons to whom the Software is 271furnished to do so, subject to the following conditions: 272 273The above copyright notice and this permission notice shall be included in all 274copies or substantial portions of the Software. 275 276THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 277IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 278FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 279AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 280LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 281OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 282SOFTWARE. 283 284*/ 285(function(e){var t={};var r=t["webpackHotUpdate"];t["webpackHotUpdate"]=function e(t,n){S(t,n);if(r)r(t,n)};function n(e){var t=document.getElementsByTagName("head")[0];var r=document.createElement("script");r.type="text/javascript";r.charset="utf-8";r.src=R.p+""+e+"."+s+".hot-update.js";t.appendChild(r)}function i(e){if(typeof XMLHttpRequest==="undefined")return e(new Error("No browser support"));try{var t=new XMLHttpRequest;var r=R.p+""+s+".hot-update.json";t.open("GET",r,true);t.timeout=1e4;t.send(null)}catch(t){return e(t)}t.onreadystatechange=function(){if(t.readyState!==4)return;if(t.status===0){e(new Error("Manifest request to "+r+" timed out."))}else if(t.status===404){e()}else if(t.status!==200&&t.status!==304){e(new Error("Manifest request to "+r+" failed."))}else{try{var n=JSON.parse(t.responseText)}catch(t){e(t);return}e(null,n)}}}var a=false;try{Object.defineProperty({},"x",{get:function(){}});a=true}catch(e){}var o=true;var s="cac23860c44b0ba80f83";var u={};var l=[];function c(e){var t=P[e];if(!t)return R;var r=function(r){if(t.hot.active){if(P[r]){if(P[r].parents.indexOf(e)<0)P[r].parents.push(e);if(t.children.indexOf(r)<0)t.children.push(r)}else l=[e]}else{console.warn("[HMR] unexpected require("+r+") from disposed module "+e);l=[]}return R(r)};for(var n in R){if(Object.prototype.hasOwnProperty.call(R,n)){if(a){Object.defineProperty(r,n,function(e){return{configurable:true,enumerable:true,get:function(){return R[e]},set:function(t){R[e]=t}}}(n))}else{r[n]=R[n]}}}function i(e,t){if(d==="ready")p("prepare");v++;R.e(e,function(){try{t.call(null,r)}finally{n()}function n(){v--;if(d==="prepare"){if(!y[e]){T(e)}if(v===0&&m===0){M()}}}})}if(a){Object.defineProperty(r,"e",{enumerable:true,value:i})}else{r.e=i}return r}function f(e){var t={_acceptedDependencies:{},_declinedDependencies:{},_selfAccepted:false,_selfDeclined:false,_disposeHandlers:[],active:true,accept:function(e,r){if(typeof e==="undefined")t._selfAccepted=true;else if(typeof e==="function")t._selfAccepted=e;else if(typeof e==="object")for(var n=0;n<e.length;n++)t._acceptedDependencies[e[n]]=r;else t._acceptedDependencies[e]=r},decline:function(e){if(typeof e==="undefined")t._selfDeclined=true;else if(typeof e==="number")t._declinedDependencies[e]=true;else for(var r=0;r<e.length;r++)t._declinedDependencies[e[r]]=true},dispose:function(e){t._disposeHandlers.push(e)},addDisposeHandler:function(e){t._disposeHandlers.push(e)},removeDisposeHandler:function(e){var r=t._disposeHandlers.indexOf(e);if(r>=0)t._disposeHandlers.splice(r,1)},check:E,apply:A,status:function(e){if(!e)return d;h.push(e)},addStatusHandler:function(e){h.push(e)},removeStatusHandler:function(e){var t=h.indexOf(e);if(t>=0)h.splice(t,1)},data:u[e]};return t}var h=[];var d="idle";function p(e){d=e;for(var t=0;t<h.length;t++)h[t].call(null,e)}var m=0;var v=0;var y={};var g={};var b={};var x;var _,w;function C(e){var t=+e+""===e;return t?+e:e}function E(e,t){if(d!=="idle")throw new Error("check() is only allowed in idle status");if(typeof e==="function"){o=false;t=e}else{o=e;t=t||function(e){if(e)throw e}}p("check");i(function(e,r){if(e)return t(e);if(!r){p("idle");t(null,null);return}g={};b={};y={};for(var n=0;n<r.c.length;n++)b[r.c[n]]=true;w=r.h;p("prepare");x=t;_={};var i=0;{T(i)}if(d==="prepare"&&v===0&&m===0){M()}})}function S(e,t){if(!b[e]||!g[e])return;g[e]=false;for(var r in t){if(Object.prototype.hasOwnProperty.call(t,r)){_[r]=t[r]}}if(--m===0&&v===0){M()}}function T(e){if(!b[e]){y[e]=true}else{g[e]=true;m++;n(e)}}function M(){p("ready");var e=x;x=null;if(!e)return;if(o){A(o,e)}else{var t=[];for(var r in _){if(Object.prototype.hasOwnProperty.call(_,r)){t.push(C(r))}}e(null,t)}}function A(t,r){if(d!=="ready")throw new Error("apply() is only allowed in ready status");if(typeof t==="function"){r=t;t={}}else if(t&&typeof t==="object"){r=r||function(e){if(e)throw e}}else{t={};r=r||function(e){if(e)throw e}}function n(e){var t=[e];var r={};var n=t.slice();while(n.length>0){var a=n.pop();var e=P[a];if(!e||e.hot._selfAccepted)continue;if(e.hot._selfDeclined){return new Error("Aborted because of self decline: "+a)}if(a===0){return}for(var o=0;o<e.parents.length;o++){var s=e.parents[o];var u=P[s];if(u.hot._declinedDependencies[a]){return new Error("Aborted because of declined dependency: "+a+" in "+s)}if(t.indexOf(s)>=0)continue;if(u.hot._acceptedDependencies[a]){if(!r[s])r[s]=[];i(r[s],[a]);continue}delete r[s];t.push(s);n.push(s)}}return[t,r]}function i(e,t){for(var r=0;r<t.length;r++){var n=t[r];
285if(e.indexOf(n)<0)e.push(n)}}var a={};var o=[];var c={};for(var f in _){if(Object.prototype.hasOwnProperty.call(_,f)){var h=C(f);var m=n(h);if(!m){if(t.ignoreUnaccepted)continue;p("abort");return r(new Error("Aborted because "+h+" is not accepted"))}if(m instanceof Error){p("abort");return r(m)}c[h]=_[h];i(o,m[0]);for(var h in m[1]){if(Object.prototype.hasOwnProperty.call(m[1],h)){if(!a[h])a[h]=[];i(a[h],m[1][h])}}}}var v=[];for(var y=0;y<o.length;y++){var h=o[y];if(P[h]&&P[h].hot._selfAccepted)v.push({module:h,errorHandler:P[h].hot._selfAccepted})}p("dispose");var g=o.slice();while(g.length>0){var h=g.pop();var b=P[h];if(!b)continue;var x={};var E=b.hot._disposeHandlers;for(var S=0;S<E.length;S++){var T=E[S];T(x)}u[h]=x;b.hot.active=false;delete P[h];for(var S=0;S<b.children.length;S++){var M=P[b.children[S]];if(!M)continue;var A=M.parents.indexOf(h);if(A>=0){M.parents.splice(A,1)}}}for(var h in a){if(Object.prototype.hasOwnProperty.call(a,h)){var b=P[h];var k=a[h];for(var S=0;S<k.length;S++){var I=k[S];var A=b.children.indexOf(I);if(A>=0)b.children.splice(A,1)}}}p("apply");s=w;for(var h in c){if(Object.prototype.hasOwnProperty.call(c,h)){e[h]=c[h]}}var D=null;for(var h in a){if(Object.prototype.hasOwnProperty.call(a,h)){var b=P[h];var k=a[h];var B=[];for(var y=0;y<k.length;y++){var I=k[y];var T=b.hot._acceptedDependencies[I];if(B.indexOf(T)>=0)continue;B.push(T)}for(var y=0;y<B.length;y++){var T=B[y];try{T(a)}catch(e){if(!D)D=e}}}}for(var y=0;y<v.length;y++){var L=v[y];var h=L.module;l=[h];try{R(h)}catch(e){if(typeof L.errorHandler==="function"){try{L.errorHandler(e)}catch(e){if(!D)D=e}}else if(!D)D=e}}if(D){p("fail");return r(D)}p("idle");r(null,o)}var P={};function R(t){if(P[t])return P[t].exports;var r=P[t]={exports:{},id:t,loaded:false,hot:f(t),parents:l,children:[]};e[t].call(r.exports,r,r.exports,c(t));r.loaded=true;return r.exports}R.m=e;R.c=P;R.p="build/";R.h=function(){return s};return c(0)(0)})([function(e,t,r){e.exports=r(1)},function(e,t,r){"use strict";var n=r(2);var i=a(n);function a(e){return e&&e.__esModule?e:{default:e}}d.ChromePicker=i.default},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:true});t.Chrome=undefined;var n=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r){if(Object.prototype.hasOwnProperty.call(r,n)){e[n]=r[n]}}}return e};var i=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||false;n.configurable=true;if("value"in n)n.writable=true;Object.defineProperty(e,n.key,n)}}return function(t,r,n){if(r)e(t.prototype,r);if(n)e(t,n);return t}}();var a=r(3);var o=g(a);var s=r(4);var u=g(s);var l=r(15);var c=r(29);var f=g(c);var h=r(30);var d=g(h);var p=r(17);var m=g(p);var v=r(31);var y=g(v);function g(e){return e&&e.__esModule?e:{default:e}}function b(e,t){if(!(e instanceof t)){throw new TypeError("Cannot call a class as a function")}}function x(e,t){if(!e){throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return t&&(typeof t==="object"||typeof t==="function")?t:e}function _(e,t){if(typeof t!=="function"&&t!==null){throw new TypeError("Super expression must either be null or a function, not "+typeof t)}e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:false,writable:true,configurable:true}});if(t)Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t}var w=t.Chrome=function(e){_(t,e);function t(){var e;var r,n,i;for(var a=arguments.length,o=Array(a),s=0;s<a;s++){o[s]=arguments[s]}b(this,t);return i=(r=(n=x(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(o))),n),n.shouldComponentUpdate=m.default.bind(n,n,arguments[0],arguments[1]),n.handleChange=function(e){n.props.onChange(e)},r),x(n,i)}i(t,[{key:"classes",value:function e(){return{default:{picker:{width:"100%"},saturation:{width:"100%",height:"48px",position:"relative",borderRadius:"0px",overflow:"hidden"},Saturation:{radius:"0px"},body:{padding:"0"},controls:{marginTop:"1px",display:"block"},swatch:{marginTop:"0px",width:"16px",height:"16px",borderRadius:"8px",position:"relative",overflow:"hidden"},active:{Absolute:"0 0 0 0",zIndex:2,borderRadius:"8px",boxShadow:"inset 0 0 0 1px rgba(0,0,0,.1)",background:"rgba("+this.props.rgb.r+", "+this.props.rgb.g+", "+this.props.rgb.b+", "+this.props.rgb.a+")"},hue:{height:"16px",position:"relative",width:"100%"},Hue:{radius:"0"},colors:{marginTop:"1px",display:"flex",flexDirection:"row"}}}}},{key:"render",value:function e(){var t=[];if(this.props.colors){for(var r=0;r<this.props.colors.length;r++){var i=this.props.colors[r];t.push(o.default.createElement(y.default,{key:i,color:i,active:i.replace("#","").toLowerCase()==this.props.hex,onClick:this.handleChange}))}}return o.default.createElement("div",{style:this.styles().picker},o.default.createElement("div",{style:this.styles().saturation},o.default.createElement(l.Saturation,n({}
285,this.styles().Saturation,this.props,{pointer:d.default,onChange:this.handleChange}))),o.default.createElement("div",{style:this.styles().body},o.default.createElement("div",{style:this.styles().hue},o.default.createElement(l.Hue,n({},this.styles().Hue,this.props,{pointer:f.default,onChange:this.handleChange}))),o.default.createElement("div",{style:this.styles().colors},t)))}}]);return t}(u.default.Component);w.defaultProps={colors:["#000000","#808080","#FFFFFF","#D33115","#E27300","#FCC400","#B0BC00","#68BC00","#16A5A5","#009CE0","#7B64FF","#FA28FF","#E20F2E"]};t.default=(0,l.ColorWrap)(w)},function(e,t){"use strict";e.exports=f},function(e,t,r){"use strict";e.exports={Component:r(5),inline:r(6),mixin:{css:r(6)}}},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var a=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),o=function(e,t,r){for(var n=!0;n;){var i=e,a=t,o=r;n=!1,null===i&&(i=Function.prototype);var s=Object.getOwnPropertyDescriptor(i,a);if(void 0!==s){if("value"in s)return s.value;var u=s.get;if(void 0===u)return;return u.call(o)}var l=Object.getPrototypeOf(i);if(null===l)return;e=l,t=a,r=o,n=!0,s=l=void 0}},s=r(3),u=r(6),l=function(e){function t(){n(this,t),o(Object.getPrototypeOf(t.prototype),"constructor",this).apply(this,arguments)}return i(t,e),a(t,[{key:"css",value:function(e){return u.call(this,e)}},{key:"styles",value:function(){return this.css()}}]),t}(s.Component);l.contextTypes={mixins:s.PropTypes.object},e.exports=l},function(e,t,r){"use strict";var n=r(7),i=r(8),a=r(9);e.exports=function(e){var t=this;a=r(9);var o=[];if(!this.classes)throw console.warn("Define this.classes on `"+this.constructor.name+"`");i(this.classes());var s=function(e,r){t.classes()[e]?o.push(t.classes()[e]):e&&r&&r.warn===!0&&console.warn("The `"+e+"` css class does not exist on `"+t.constructor.name+"`")};s("default");for(var u in this.props){var l=this.props[u];n(l)||(l===!0?(s(u),s(u+"-true")):s(l?u+"-"+l:u+"-false"))}if(this.props&&this.props.activeBounds)for(var c=0;c<this.props.activeBounds.length;c++){var f=this.props.activeBounds[c];s(f)}for(var h in e){var d=e[h];d===!0&&s(h,{warn:!0})}var p={};return this.context&&this.context.mixins&&(p=this.context.mixins),a(o,p)}},function(e,t){/** 286 * lodash 3.0.2 (Custom Build) <https://lodash.com/> 287 * Build: `lodash modern modularize exports="npm" -o ./` 288 * Copyright 2012-2015 The Dojo Foundation <http://dojofoundation.org/> 289 * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE> 290 * Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors 291 * Available under MIT license <https://lodash.com/license> 292 */ 293function r(e){var t=typeof e;return!!e&&(t=="object"||t=="function")}e.exports=r},function(e,t,r){"use strict";var n=r(7);e.exports=function(e){for(var t in e){var r=e[t];if(n(r))for(var i in r){var a=r[i];n(a)||console.warn("Make sure the value of the element `"+t+"` is an object of css. You passed it `"+r+"`")}else console.warn("Make sure the value of `"+t+"` is an object of html elements. You passed it `"+r+"`")}}},function(e,t,r){"use strict";var n=r(10),i=r(14);e.exports=function(e,t){var r=n(e);return i(r,t)}},function(e,t,r){"use strict";var n=r(11),i=r(7),a=r(13);e.exports=function(e){return i(e)&&!a(e)?e:1===e.length?e[0]:n.recursive.apply(void 0,e)}},function(e,t,r){(function(e){(function(t){var r=function(e){return a(e===true,false,arguments)},n="merge";r.recursive=function(e){return a(e===true,true,arguments)};r.clone=function(e){var t=e,n=o(e),i,a;if(n==="array"){t=[];a=e.length;for(i=0;i<a;++i)t[i]=r.clone(e[i])}else if(n==="object"){t={};for(i in e)t[i]=r.clone(e[i])}return t};function i(e,t){if(o(e)!=="object")return t;for(var r in t){if(o(e[r])==="object"&&o(t[r])==="object"){e[r]=i(e[r],t[r])}else{e[r]=t[r]}}return e}function a(e,t,n){var a=n[0],s=n.length;if(e||o(a)!=="object")a={};for(var u=0;u<s;++u){var l=n[u],c=o(l);if(c!=="object")continue;for(var f in l){var h=e?r.clone(l[f]):l[f];if(t){a[f]=i(a[f],h)}else{a[f]=h}}}return a}function o(e){return{}.toString.call(e).slice(8,-1).toLowerCase()}if(t){e.exports=r}else{window[n]=r}})(typeof e==="object"&&e&&typeof e.exports==="object"&&e.exports)}).call(t,r(12)(e))},function(e,t){e.exports=function(e){if(!e.webpackPolyfill){e.deprecate=function(){};e.paths=[];e.children=[];e.webpackPolyfill=1}return e}},function(e,t){/** 294 * lodash 4.0.0 (Custom Build) <https://lodash.com/> 295 * Build: `lodash modularize exports="npm" -o ./` 296 * Copyright 2012-2016 The Dojo Foundation <http://dojofoundation.org/> 297 * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE> 298 * Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors 299 * Available under MIT license <https://lodash.com/license> 300 */ 301var r=Array.isArray;e.exports=r},function(e,t,r){"use strict";var n=r(7),i=r(13),a=r(11),o={borderRadius:function(e){return null!==e?{msBorderRadius:e,MozBorderRadius:e,OBorderRadius:e,WebkitBorderRadius:e,borderRadius:e}:void 0},boxShadow:function(e){return null!==e?{msBoxShadow:e,MozBoxShadow:e,OBoxShadow:e,WebkitBoxShadow:e,boxShadow:e}:void 0},userSelect:function(e){return null!==e?{WebkitTouchCallout:e,KhtmlUserSelect:e,MozUserSelect:e,msUserSelect:e,WebkitUserSelect:e,userSelect:e}:void 0},flex:function(e){return null!==e?{WebkitBoxFlex:e,MozBoxFlex:e,WebkitFlex:e,msFlex:e,flex:e}:void 0},flexBasis:function(e){return null!==e?{WebkitFlexBasis:e,flexBasis:e}:void 0},justifyContent:function(e){return null!==e?{WebkitJustifyContent:e,justifyContent:e}:void 0},transition:function(e){return null!==e?{msTransition:e,MozTransition:e,OTransition:e,WebkitTransition:e,transition:e}:void 0},transform:function(e){return null!==e?{msTransform:e,MozTransform:e,OTransform:e,WebkitTransform:e,transform:e}:void 0},Absolute:function(e){if(null!==e){var t=e.split(" ");return{position:"absolute",top:t[0],right:t[1],bottom:t[2],left:t[3]}}},Extend:function(e,t){var r=t[e];return r?r:void 0}},s=function e(t,r,s){var u=a(r,o),l={};for(var c in t){var f=t[c];if(n(f)&&!i(f))l[c]=e(f,r,t);else if(u[c]){var h=u[c](f,s);for(var d in h){var p=h[d];l[d]=p}}else l[c]=f}return l};e.exports=function(e,t,r){return s(e,t,r)}},function(e,t,r){"use strict";
301Object.defineProperty(t,"__esModule",{value:true});var n=r(16);Object.defineProperty(t,"Alpha",{enumerable:true,get:function e(){return u(n).default}});var i=r(20);Object.defineProperty(t,"Checkboard",{enumerable:true,get:function e(){return u(i).default}});var a=r(21);Object.defineProperty(t,"Hue",{enumerable:true,get:function e(){return u(a).default}});var o=r(22);Object.defineProperty(t,"Saturation",{enumerable:true,get:function e(){return u(o).default}});var s=r(24);Object.defineProperty(t,"ColorWrap",{enumerable:true,get:function e(){return u(s).default}});function u(e){return e&&e.__esModule?e:{default:e}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:true});t.Alpha=undefined;var n=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||false;n.configurable=true;if("value"in n)n.writable=true;Object.defineProperty(e,n.key,n)}}return function(t,r,n){if(r)e(t.prototype,r);if(n)e(t,n);return t}}();var i=r(3);var a=h(i);var o=r(4);var s=h(o);var u=r(17);var l=h(u);var c=r(20);var f=h(c);function h(e){return e&&e.__esModule?e:{default:e}}function d(e,t){if(!(e instanceof t)){throw new TypeError("Cannot call a class as a function")}}function p(e,t){if(!e){throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return t&&(typeof t==="object"||typeof t==="function")?t:e}function m(e,t){if(typeof t!=="function"&&t!==null){throw new TypeError("Super expression must either be null or a function, not "+typeof t)}e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:false,writable:true,configurable:true}});if(t)Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t}var v=t.Alpha=function(e){m(t,e);function t(){var e;var r,n,i;for(var a=arguments.length,o=Array(a),s=0;s<a;s++){o[s]=arguments[s]}d(this,t);return i=(r=(n=p(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(o))),n),n.shouldComponentUpdate=l.default.bind(n,n,arguments[0],arguments[1]),n.handleChange=function(e,t){!t&&e.preventDefault();var r=n.refs.container;var i=r.clientWidth;var a=(e.pageX||e.touches[0].pageX)-(r.getBoundingClientRect().left+window.pageXOffset);var o;if(a<0){o=0}else if(a>i){o=1}else{o=Math.round(a*100/i)/100}if(n.props.a!==o){n.props.onChange({h:n.props.hsl.h,s:n.props.hsl.s,l:n.props.hsl.l,a:o,source:"rgb"})}},n.handleMouseDown=function(e){n.handleChange(e,true);window.addEventListener("mousemove",n.handleChange);window.addEventListener("mouseup",n.handleMouseUp)},n.handleMouseUp=function(){n.unbindEventListeners()},n.unbindEventListeners=function(){window.removeEventListener("mousemove",n.handleChange);window.removeEventListener("mouseup",n.handleMouseUp)},r),p(n,i)}n(t,[{key:"classes",value:function e(){return{default:{alpha:{Absolute:"0 0 0 0",borderRadius:this.props.radius},checkboard:{Absolute:"0 0 0 0",overflow:"hidden"},gradient:{Absolute:"0 0 0 0",background:"linear-gradient(to right, rgba("+this.props.rgb.r+", "+this.props.rgb.g+", "+this.props.rgb.b+", 0) 0%, rgba("+this.props.rgb.r+", "+this.props.rgb.g+", "+this.props.rgb.b+", 1) 100%)",boxShadow:this.props.shadow,borderRadius:this.props.radius},container:{position:"relative",zIndex:"2",height:"100%",margin:"0 3px"},pointer:{zIndex:"2",position:"absolute",left:this.props.rgb.a*100+"%"},slider:{width:"4px",borderRadius:"1px",height:"8px",boxShadow:"0 0 2px rgba(0, 0, 0, .6)",background:"#fff",marginTop:"1px",transform:"translateX(-2px)"}}}}},{key:"componentWillUnmount",value:function e(){this.unbindEventListeners()}},{key:"render",value:function e(){var t=a.default.createElement("div",{style:this.styles().slider});if(this.props.pointer){t=a.default.createElement(this.props.pointer,this.props)}return a.default.createElement("div",{style:this.styles().alpha},a.default.createElement("div",{style:this.styles().checkboard},a.default.createElement(f.default,null)),a.default.createElement("div",{style:this.styles().gradient}),a.default.createElement("div",{style:this.styles().container,ref:"container",onMouseDown:this.handleMouseDown,onTouchMove:this.handleChange,onTouchStart:this.handleChange},a.default.createElement("div",{style:this.styles().pointer,ref:"pointer"},t)))}}]);return t}(s.default.Component);t.default=v},function(e,t,r){e.exports=r(18)},function(e,t,r){/** 302 * Copyright 2013-2015, Facebook, Inc. 303 * All rights reserved. 304 * 305 * This source code is licensed under the BSD-style license found in the 306 * LICENSE file in the root directory of this source tree. An additional grant 307 * of patent rights can be found in the PATENTS file in the same directory. 308 * 309 * @providesModule shallowCompare 310 */ 311"use strict";var n=r(19);function i(e,t,r){return!n(e.props,t)||!n(e.state,r)}e.exports=i},function(e,t){/** 312 * Copyright 2013-2015, Facebook, Inc. 313 * All rights reserved. 314 * 315 * This source code is licensed under the BSD-style license found in the 316 * LICENSE file in the root directory of this source tree. An additional grant 317 * of patent rights can be found in the PATENTS file in the same directory. 318 * 319 * @providesModule shallowEqual 320 * @typechecks 321 * 322 */ 323"use strict";var r=Object.prototype.hasOwnProperty;function n(e,t){if(e===t){return true}if(typeof e!=="object"||e===null||typeof t!=="object"||t===null){return false}var n=Object.keys(e);var i=Object.keys(t);if(n.length!==i.length){return false}var a=r.bind(t);for(var o=0;o<n.length;o++){if(!a(n[o])||e[n[o]]!==t[n[o]]){return false}}return true}e.exports=n},function(e,t,r){"use strict";
323Object.defineProperty(t,"__esModule",{value:true});t.Checkboard=undefined;var n=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||false;n.configurable=true;if("value"in n)n.writable=true;Object.defineProperty(e,n.key,n)}}return function(t,r,n){if(r)e(t.prototype,r);if(n)e(t,n);return t}}();var i=r(3);var a=c(i);var o=r(4);var s=c(o);var u=r(17);var l=c(u);function c(e){return e&&e.__esModule?e:{default:e}}function f(e,t){if(!(e instanceof t)){throw new TypeError("Cannot call a class as a function")}}function h(e,t){if(!e){throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return t&&(typeof t==="object"||typeof t==="function")?t:e}function d(e,t){if(typeof t!=="function"&&t!==null){throw new TypeError("Super expression must either be null or a function, not "+typeof t)}e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:false,writable:true,configurable:true}});if(t)Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t}var p={};function m(e,t,r){if(typeof document=="undefined")return null;var n=document.createElement("canvas");n.width=n.height=r*2;var i=n.getContext("2d");if(!i)return null;i.fillStyle=e;i.fillRect(0,0,n.width,n.height);i.fillStyle=t;i.fillRect(0,0,r,r);i.translate(r,r);i.fillRect(0,0,r,r);return n.toDataURL()}function v(e,t,r){var n=e+","+t+","+r;if(p[n]){return p[n]}else{var i=m(e,t,r);p[n]=i;return i}}var y=t.Checkboard=function(e){d(t,e);function t(){var e;var r,n,i;for(var a=arguments.length,o=Array(a),s=0;s<a;s++){o[s]=arguments[s]}f(this,t);return i=(r=(n=h(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(o))),n),n.shouldComponentUpdate=l.default.bind(n,n,arguments[0],arguments[1]),r),h(n,i)}n(t,[{key:"classes",value:function e(){var t=v(this.props.white,this.props.grey,this.props.size);return{default:{grid:{Absolute:"0 0 0 0",background:"url("+t+") center left"}}}}},{key:"render",value:function e(){return a.default.createElement("div",{style:this.styles().grid,ref:"grid"})}}]);return t}(s.default.Component);y.defaultProps={size:8,white:"#fff",grey:"#e6e6e6"};t.default=y},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:true});t.Hue=undefined;var n=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||false;n.configurable=true;if("value"in n)n.writable=true;Object.defineProperty(e,n.key,n)}}return function(t,r,n){if(r)e(t.prototype,r);if(n)e(t,n);return t}}();var i=r(3);var a=c(i);var o=r(4);var s=c(o);var u=r(17);var l=c(u);function c(e){return e&&e.__esModule?e:{default:e}}function f(e,t){if(!(e instanceof t)){throw new TypeError("Cannot call a class as a function")}}function h(e,t){if(!e){throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return t&&(typeof t==="object"||typeof t==="function")?t:e}function d(e,t){if(typeof t!=="function"&&t!==null){throw new TypeError("Super expression must either be null or a function, not "+typeof t)}e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:false,writable:true,configurable:true}});if(t)Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t}var p=t.Hue=function(e){d(t,e);function t(){var e;var r,n,i;for(var a=arguments.length,o=Array(a),s=0;s<a;s++){o[s]=arguments[s]}f(this,t);return i=(r=(n=h(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(o))),n),n.shouldComponentUpdate=l.default.bind(n,n,arguments[0],arguments[1]),n.handleChange=function(e,t){!t&&e.preventDefault();var r=n.refs.container;var i=r.clientWidth;var a=r.clientHeight;var o=(e.pageX||e.touches&&e.touches[0].pageX||0)-(r.getBoundingClientRect().left+window.pageXOffset);var s=(e.pageY||e.touches&&e.touches[0].pageY||0)-(r.getBoundingClientRect().top+window.pageYOffset);if(n.props.direction==="vertical"){var u;if(s<0){u=359}else if(s>a){u=0}else{var l=-(s*100/a)+100;u=360*l/100}if(n.props.hsl.h!==u){n.props.onChange({h:u,s:n.props.hsl.s,l:n.props.hsl.l,a:n.props.hsl.a,source:"rgb"})}}else{var u;if(o<0){u=0}else if(o>i){u=359}else{var l=o*100/i;u=360*l/100}if(n.props.hsl.h!==u){n.props.onChange({h:u,s:n.props.hsl.s,l:n.props.hsl.l,a:n.props.hsl.a,source:"rgb"})}}},n.handleMouseDown=function(e){n.handleChange(e,true);window.addEventListener("mousemove",n.handleChange);window.addEventListener("mouseup",n.handleMouseUp)},n.handleMouseUp=function(){n.unbindEventListeners()},r),h(n,i)}n(t,[{key:"classes",value:function e(){return{default:{hue:{Absolute:"0 0 0 0",background:"linear-gradient(to right, #f00 0%, #ff0 17%, #0f0 33%, #0ff 50%, #00f 67%, #f0f 83%, #f00 100%)",borderRadius:this.props.radius,boxSh
323adow:this.props.shadow},container:{margin:"0 2px",position:"relative",height:"100%"},pointer:{zIndex:"2",position:"absolute",left:this.props.hsl.h*100/360+"%"},slider:{marginTop:"1px",width:"4px",borderRadius:"1px",height:"8px",boxShadow:"0 0 2px rgba(0, 0, 0, .6)",background:"#fff",transform:"translateX(-2px)"}},"direction-vertical":{hue:{background:"linear-gradient(to top, #f00 0%, #ff0 17%, #0f0 33%, #0ff 50%, #00f 67%, #f0f 83%, #f00 100%)"},pointer:{left:"0",top:-(this.props.hsl.h*100/360)+100+"%"}}}}},{key:"componentWillUnmount",value:function e(){this.unbindEventListeners()}},{key:"unbindEventListeners",value:function e(){window.removeEventListener("mousemove",this.handleChange);window.removeEventListener("mouseup",this.handleMouseUp)}},{key:"render",value:function e(){var t=a.default.createElement("div",{style:this.styles().slider});if(this.props.pointer){t=a.default.createElement(this.props.pointer,this.props)}return a.default.createElement("div",{style:this.styles().hue},a.default.createElement("div",{style:this.styles().container,ref:"container",onMouseDown:this.handleMouseDown,onTouchMove:this.handleChange,onTouchStart:this.handleChange},a.default.createElement("div",{style:this.styles().pointer,ref:"pointer"},t)))}}]);return t}(s.default.Component);t.default=p},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:true});t.Saturation=undefined;var n=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||false;n.configurable=true;if("value"in n)n.writable=true;Object.defineProperty(e,n.key,n)}}return function(t,r,n){if(r)e(t.prototype,r);if(n)e(t,n);return t}}();var i=r(3);var a=h(i);var o=r(4);var s=h(o);var u=r(23);var l=h(u);var c=r(17);var f=h(c);function h(e){return e&&e.__esModule?e:{default:e}}function d(e,t){if(!(e instanceof t)){throw new TypeError("Cannot call a class as a function")}}function p(e,t){if(!e){throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return t&&(typeof t==="object"||typeof t==="function")?t:e}function m(e,t){if(typeof t!=="function"&&t!==null){throw new TypeError("Super expression must either be null or a function, not "+typeof t)}e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:false,writable:true,configurable:true}});if(t)Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t}var v=t.Saturation=function(e){m(t,e);function t(e){d(this,t);var r=p(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));r.shouldComponentUpdate=f.default.bind(r,r,arguments[0],arguments[1]);r.handleChange=function(e,t){!t&&e.preventDefault();var n=r.refs.container;var i=n.clientWidth;var a=n.clientHeight;var o=(e.pageX||e.touches[0].pageX)-(n.getBoundingClientRect().left+window.pageXOffset);var s=(e.pageY||e.touches[0].pageY)-(n.getBoundingClientRect().top+window.pageYOffset);if(o<0){o=0}else if(o>i){o=i}else if(s<0){s=0}else if(s>a){s=a}var u=o*100/i;var l=-(s*100/a)+100;r.throttle(r.props.onChange,{h:r.props.hsl.h,s:u,v:l,a:r.props.hsl.a,source:"rgb"})};r.handleMouseDown=function(e){r.handleChange(e,true);window.addEventListener("mousemove",r.handleChange);window.addEventListener("mouseup",r.handleMouseUp)};r.handleMouseUp=function(){r.unbindEventListeners()};r.throttle=(0,l.default)(function(e,t){e(t)},50);return r}n(t,[{key:"classes",value:function e(){return{default:{color:{Absolute:"0 0 0 0",background:"hsl("+this.props.hsl.h+",100%, 50%)",borderRadius:this.props.radius},white:{Absolute:"0 0 0 0",background:"linear-gradient(to right, #fff, rgba(255,255,255,0))"},black:{Absolute:"0 0 0 0",background:"linear-gradient(to top, #000, rgba(0,0,0,0))",boxShadow:this.props.shadow},pointer:{position:"absolute",top:-(this.props.hsv.v*100)+100+"%",left:this.props.hsv.s*100+"%",cursor:"default"},circle:{width:"4px",height:"4px",boxShadow:"0 0 0 1.5px #fff, inset 0 0 1px 1px rgba(0,0,0,.3), 0 0 1px 2px rgba(0,0,0,.4)",borderRadius:"50%",cursor:"hand",transform:"translate(-2px, -2px)"}}}}},{key:"componentWillUnmount",value:function e(){this.unbindEventListeners()}},{key:"unbindEventListeners",value:function e(){window.removeEventListener("mousemove",this.handleChange);window.removeEventListener("mouseup",this.handleMouseUp)}},{key:"render",value:function e(){var t=a.default.createElement("div",{style:this.styles().circle});if(this.props.pointer){t=a.default.createElement(this.props.pointer,this.props)}return a.default.createElement("div",{style:this.styles().color,ref:"container",onMouseDown:this.handleMouseDown,onTouchMove:this.handleChange,onTouchStart:this.handleChange},a.default.createElement("div",{style:this.styles().white},a.default.createElement("div",{style:this.styles().black}),a.default.createElement("div",{style:this.styles().pointer,ref:"pointer"},t)))}}]);return t}(s.default.Component);t.default=v},function(e,t){(function(t){/** 324 * lodash (Custom Build) <https://lodash.com/> 325 * Build: `lodash modularize exports="npm" -o ./` 326 * Copyright jQuery Foundation and other contributors <https://jquery.org/> 327 * Released under MIT license <https://lodash.com/license> 328 * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE> 329 * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors 330 */ 331var r="Expected a function";var n=0/0;var i="[object Symbol]";var a=/^\s+|\s+$/g;var o=/^[-+]0x[0-9a-f]+$/i;var s=/^0b[01]+$/i;var u=/^0o[0-7]+$/i;var l=parseInt;var c=typeof t=="object"&&t&&t.Object===Object&&t;var f=typeof self=="object"&&self&&self.Object===Object&&self;var h=c||f||Function("return this")();var d=Object.prototype;var p=d.toString;var m=Math.max,v=Math.min;var y=function(){return h.Date.now()};function g(e,t,n){var i,a,o,s,u,l,c=0,f=false,h=false,d=true;if(typeof e!="function"){throw new TypeError(r)}t=C(t)||0;if(x(n)){f=!!n.leading;h="maxWait"in n;o=h?m(C(n.maxWait)||0,t):o;d="trailing"in n?!!n.trailing:d}function p(t){var r=i,n=a;i=a=undefined;c=t;s=e.apply(n,r);return s}function g(e){c=e;u=setTimeout(w,t);return f?p(e):s}function b(e){var r=e-l,n=e-c,i=t-r;return h?v(i,o-n):i}function _(e){var r=e-l,n=e-c;return l===undefined||r>=t||r<0||h&&n>=o}function w(){var e=y();if(_(e)){return E(e)}u=setTimeout(w,b(e))}function E(e){u=undefined;if(d&&i){return p(e)}i=a=undefined;return s}function S(){if(u!==undefined){clearTimeout(u)}c=0;i=l=a=u=undefined}function T(){return u===undefined?s:E(y())}function M(){var e=y(),r=_(e);i=arguments;a=this;l=e;if(r){if(u===undefined){return g(l)}if(h){u=setTimeout(w,t);return p(l)}}if(u===undefined){u=setTimeout(w,t)}return s}M.cancel=S;M.flush=T;return M}function b(e,t,n){var i=true,a=true;if(typeof e!="function"){throw new TypeError(r)}if(x(n)){i="leading"in n?!!n.leading:i;a="trailing"in n?!!n.trailing:a}return g(e,t,{leading:i,maxWait:t,trailing:a})}function x(e){var t=typeof e;return!!e&&(t=="object"||t=="function")}function _(e){return!!e&&typeof e=="object"}function w(e){return typeof e=="symbol"||_(e)&&p.call(e)==i}function C(e){if(typeof e=="number"){return e}if(w(e)){return n}if(x(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=x(t)?t+"":t}if(typeof e!="string"){return e===0?e:+e}e=e.replace(a,"");var r=s.test(e);return r||u.test(e)?l(e.slice(2),r?2:8):o.test(e)?n:+e}e.exports=b}).call(t,function(){return this}())},function(e,t,r){"use strict";
331Object.defineProperty(t,"__esModule",{value:true});t.ColorWrap=undefined;var n=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r){if(Object.prototype.hasOwnProperty.call(r,n)){e[n]=r[n]}}}return e};var i=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||false;n.configurable=true;if("value"in n)n.writable=true;Object.defineProperty(e,n.key,n)}}return function(t,r,n){if(r)e(t.prototype,r);if(n)e(t,n);return t}}();var a=r(3);var o=y(a);var s=r(11);var u=y(s);var l=r(25);var c=y(l);var f=r(26);var h=y(f);var d=r(27);var p=y(d);var m=r(17);var v=y(m);function y(e){return e&&e.__esModule?e:{default:e}}function g(e,t){if(!(e instanceof t)){throw new TypeError("Cannot call a class as a function")}}function b(e,t){if(!e){throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return t&&(typeof t==="object"||typeof t==="function")?t:e}function x(e,t){if(typeof t!=="function"&&t!==null){throw new TypeError("Super expression must either be null or a function, not "+typeof t)}e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:false,writable:true,configurable:true}});if(t)Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t}var _=t.ColorWrap=function e(t){var r=function(e){x(r,e);function r(e){g(this,r);var t=b(this,(r.__proto__||Object.getPrototypeOf(r)).call(this));t.shouldComponentUpdate=v.default.bind(t,t,arguments[0],arguments[1]);t.handleChange=function(e){e=p.default.simpleCheckForValidColor(e);if(e){var r=p.default.toState(e,e.h||t.state.oldHue);t.setState(r);t.props.onChangeComplete&&t.debounce(t.props.onChangeComplete,r);t.props.onChange&&t.props.onChange(r)}};t.state=(0,u.default)(p.default.toState(e.color,0),{visible:e.display});t.debounce=(0,h.default)(function(e,t){e(t)},100);return t}i(r,[{key:"componentWillReceiveProps",value:function e(t){this.setState((0,u.default)(p.default.toState(t.color,this.state.oldHue),{visible:t.display}))}},{key:"render",value:function e(){return o.default.createElement(t,n({},this.props,this.state,{onChange:this.handleChange}))}}]);return r}(o.default.Component);r.defaultProps={color:{h:250,s:.5,l:.2,a:1}};return r};t.default=_},function(e,t){/** 332 * lodash (Custom Build) <https://lodash.com/> 333 * Build: `lodash modularize exports="npm" -o ./` 334 * Copyright jQuery Foundation and other contributors <https://jquery.org/> 335 * Released under MIT license <https://lodash.com/license> 336 * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE> 337 * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors 338 */ 339var r="[object Object]";function n(e){var t=false;if(e!=null&&typeof e.toString!="function"){try{t=!!(e+"")}catch(e){}}return t}function i(e,t){return function(r){return e(t(r))}}var a=Function.prototype,o=Object.prototype;var s=a.toString;var u=o.hasOwnProperty;var l=s.call(Object);var c=o.toString;var f=i(Object.getPrototypeOf,Object);function h(e){return!!e&&typeof e=="object"}function d(e){if(!h(e)||c.call(e)!=r||n(e)){return false}var t=f(e);if(t===null){return true}var i=u.call(t,"constructor")&&t.constructor;return typeof i=="function"&&i instanceof i&&s.call(i)==l}e.exports=d},function(e,t){(function(t){/** 340 * lodash (Custom Build) <https://lodash.com/> 341 * Build: `lodash modularize exports="npm" -o ./` 342 * Copyright jQuery Foundation and other contributors <https://jquery.org/> 343 * Released under MIT license <https://lodash.com/license> 344 * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE> 345 * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors 346 */ 347var r="Expected a function";var n=0/0;var i="[object Symbol]";var a=/^\s+|\s+$/g;var o=/^[-+]0x[0-9a-f]+$/i;var s=/^0b[01]+$/i;var u=/^0o[0-7]+$/i;var l=parseInt;var c=typeof t=="object"&&t&&t.Object===Object&&t;var f=typeof self=="object"&&self&&self.Object===Object&&self;var h=c||f||Function("return this")();var d=Object.prototype;var p=d.toString;var m=Math.max,v=Math.min;var y=function(){return h.Date.now()};function g(e,t,n){var i,a,o,s,u,l,c=0,f=false,h=false,d=true;if(typeof e!="function"){throw new TypeError(r)}t=w(t)||0;
347if(b(n)){f=!!n.leading;h="maxWait"in n;o=h?m(w(n.maxWait)||0,t):o;d="trailing"in n?!!n.trailing:d}function p(t){var r=i,n=a;i=a=undefined;c=t;s=e.apply(n,r);return s}function g(e){c=e;u=setTimeout(C,t);return f?p(e):s}function x(e){var r=e-l,n=e-c,i=t-r;return h?v(i,o-n):i}function _(e){var r=e-l,n=e-c;return l===undefined||r>=t||r<0||h&&n>=o}function C(){var e=y();if(_(e)){return E(e)}u=setTimeout(C,x(e))}function E(e){u=undefined;if(d&&i){return p(e)}i=a=undefined;return s}function S(){if(u!==undefined){clearTimeout(u)}c=0;i=l=a=u=undefined}function T(){return u===undefined?s:E(y())}function M(){var e=y(),r=_(e);i=arguments;a=this;l=e;if(r){if(u===undefined){return g(l)}if(h){u=setTimeout(C,t);return p(l)}}if(u===undefined){u=setTimeout(C,t)}return s}M.cancel=S;M.flush=T;return M}function b(e){var t=typeof e;return!!e&&(t=="object"||t=="function")}function x(e){return!!e&&typeof e=="object"}function _(e){return typeof e=="symbol"||x(e)&&p.call(e)==i}function w(e){if(typeof e=="number"){return e}if(_(e)){return n}if(b(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=b(t)?t+"":t}if(typeof e!="string"){return e===0?e:+e}e=e.replace(a,"");var r=s.test(e);return r||u.test(e)?l(e.slice(2),r?2:8):o.test(e)?n:+e}e.exports=g}).call(t,function(){return this}())},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:true});var n=r(28);var i=a(n);function a(e){return e&&e.__esModule?e:{default:e}}t.default={simpleCheckForValidColor:function e(t){var r=["r","g","b","a","h","s","a","v"];var n=0;var i=0;for(var a=0;a<r.length;a++){var o=r[a];if(t[o]){n++;if(!isNaN(t[o])){i++}}}if(n===i){return t}},toState:function e(t,r){var n=t.hex?(0,i.default)(t.hex):(0,i.default)(t);var a=n.toHsl();var o=n.toHsv();if(a.s===0){a.h=r||0;o.h=r||0}return{hsl:a,hex:"#"+n.toHex(),rgb:n.toRgb(),hsv:o,oldHue:t.h||r||a.h,source:t.source}},isValidHex:function e(t){return(0,i.default)(t).isValid()}}},function(e,t,r){var n; 348// Brian Grinstead, MIT License 349(function(){var i=/^[\s,#]+/;var a=/\s+$/;var o=0;var s=Math;var u=s.round;var l=s.min;var c=s.max;var f=s.random;function h(e,t){e=e?e:"";t=t||{};if(e instanceof h){return e}if(!(this instanceof h)){return new h(e,t)}var r=d(e);this._originalInput=e,this._r=r.r,this._g=r.g,this._b=r.b,this._a=r.a,this._roundA=u(100*this._a)/100,this._format=t.format||r.format;this._gradientType=t.gradientType;if(this._r<1){this._r=u(this._r)}if(this._g<1){this._g=u(this._g)}if(this._b<1){this._b=u(this._b)}this._ok=r.ok;this._tc_id=o++}h.prototype={isDark:function(){return this.getBrightness()<128},isLight:function(){return!this.isDark()},isValid:function(){return this._ok},getOriginalInput:function(){return this._originalInput},getFormat:function(){return this._format},getAlpha:function(){return this._a},getBrightness:function(){var e=this.toRgb();return(e.r*299+e.g*587+e.b*114)/1e3},getLuminance:function(){var e=this.toRgb();var t,r,n,i,a,o;t=e.r/255;r=e.g/255;n=e.b/255;if(t<=.03928){i=t/12.92}else{i=Math.pow((t+.055)/1.055,2.4)}if(r<=.03928){a=r/12.92}else{a=Math.pow((r+.055)/1.055,2.4)}if(n<=.03928){o=n/12.92}else{o=Math.pow((n+.055)/1.055,2.4)}return.2126*i+.7152*a+.0722*o},setAlpha:function(e){this._a=V(e);this._roundA=u(100*this._a)/100;return this},toHsv:function(){var e=y(this._r,this._g,this._b);return{h:e.h*360,s:e.s,v:e.v,a:this._a}},toHsvString:function(){var e=y(this._r,this._g,this._b);var t=u(e.h*360),r=u(e.s*100),n=u(e.v*100);return this._a==1?"hsv("+t+", "+r+"%, "+n+"%)":"hsva("+t+", "+r+"%, "+n+"%, "+this._roundA+")"},toHsl:function(){var e=m(this._r,this._g,this._b);return{h:e.h*360,s:e.s,l:e.l,a:this._a}},toHslString:function(){var e=m(this._r,this._g,this._b);var t=u(e.h*360),r=u(e.s*100),n=u(e.l*100);return this._a==1?"hsl("+t+", "+r+"%, "+n+"%)":"hsla("+t+", "+r+"%, "+n+"%, "+this._roundA+")"},toHex:function(e){return b(this._r,this._g,this._b,e)},toHexString:function(e){return"#"+this.toHex(e)},toHex8:function(){return x(this._r,this._g,this._b,this._a)},toHex8String:function(){return"#"+this.toHex8()},toRgb:function(){return{r:u(this._r),g:u(this._g),b:u(this._b),a:this._a}},toRgbString:function(){return this._a==1?"rgb("+u(this._r)+", "+u(this._g)+", "+u(this._b)+")":"rgba("+u(this._r)+", "+u(this._g)+", "+u(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:u(O(this._r,255)*100)+"%",g:u(O(this._g,255)*100)+"%",b:u(O(this._b,255)*100)+"%",a:this._a}},toPercentageRgbString:function(){return this._a==1?"rgb("+u(O(this._r,255)*100)+"%, "+u(O(this._g,255)*100)+"%, "+u(O(this._b,255)*100)+"%)":"rgba("+u(O(this._r,255)*100)+"%, "+u(O(this._g,255)*100)+"%, "+u(O(this._b,255)*100)+"%, "+this._roundA+")"},toName:function(){if(this._a===0){return"transparent"}if(this._a<1){return false}return L[b(this._r,this._g,this._b,true)]||false},toFilter:function(e){var t="#"+x(this._r,this._g,this._b,this._a);var r=t;var n=this._gradientType?"GradientType = 1, ":"";if(e){var i=h(e);r=i.toHex8String()}return"progid:DXImageTransform.Microsoft.gradient("+n+"startColorstr="+t+",endColorstr="+r+")"},toString:function(e){var t=!!e;e=e||this._format;var r=false;var n=this._a<1&&this._a>=0;var i=!t&&n&&(e==="hex"||e==="hex6"||e==="hex3"||e==="name");if(i){if(e==="name"&&this._a===0){return this.toName()}return this.toRgbString()}if(e==="rgb"){r=this.toRgbString()}if(e==="prgb"){r=this.toPercentageRgbString()}if(e==="hex"||e==="hex6"){r=this.toHexString()}if(e==="hex3"){r=this.toHexString(true)}if(e==="hex8"){r=this.toHex8String()}if(e==="name"){r=this.toName()}if(e==="hsl"){r=this.toHslString()}if(e==="hsv"){r=this.toHsvString()}return r||this.toHexString()},_applyModification:function(e,t){var r=e.apply(null,[this].concat([].slice.call(t)));this._r=r._r;this._g=r._g;this._b=r._b;this.setAlpha(r._a);return this},lighten:function(){return this._applyModification(E,arguments)},brighten:function(){return this._applyModification(S,arguments)},darken:function(){return this._applyModification(T,arguments)},desaturate:function(){return this._applyModification(_,arguments)},saturate:function(){return this._applyModification(w,arguments)},greyscale:function(){return this._applyModification(C,arguments)},spin:function(){return this._applyModification(M,arguments)},_applyCombination:function(e,t){return e.apply(null,[this].concat([].slice.call(t)))},analogous:function(){return this._applyCombination(I,arguments)},complement:function(){return this._applyCombination(A,arguments)},monochromatic:function(){return this._applyCombination(D,arguments)},splitcomplement:function(){return this._applyCombination(k,arguments)},triad:function(){return this._applyCombination(P,arguments)},tetrad:function(){return this._applyCombination(R,arguments)}};h.fromRatio=function(e,t){if(typeof e=="object"){var r={};for(var n in e){if(e.hasOwnProperty(n)){if(n==="a"){r[n]=e[n]}else{r[n]=G(e[n])}}}e=r}return h(e,t)};function d(e){var t={r:0,g:0,b:0};var r=1;var n=false;var i=false;if(typeof e=="string"){e=Y(e)}if(typeof e=="object"){if(e.hasOwnProperty("r")&&e.hasOwnProperty("g")&&e.hasOwnProperty("b")){t=p(e.r,e.g,e.b);n=true;i=String(e.r).substr(-1)==="%"?"prgb":"rgb"}else if(e.hasOwnProperty("h")&&e.hasOwnProperty("s")&&e.hasOwnProperty("v")){e.
349s=G(e.s,1);e.v=G(e.v,1);t=g(e.h,e.s,e.v);n=true;i="hsv"}else if(e.hasOwnProperty("h")&&e.hasOwnProperty("s")&&e.hasOwnProperty("l")){e.s=G(e.s);e.l=G(e.l);t=v(e.h,e.s,e.l);n=true;i="hsl"}if(e.hasOwnProperty("a")){r=e.a}}r=V(r);return{ok:n,format:e.format||i,r:l(255,c(t.r,0)),g:l(255,c(t.g,0)),b:l(255,c(t.b,0)),a:r}}function p(e,t,r){return{r:O(e,255)*255,g:O(t,255)*255,b:O(r,255)*255}}function m(e,t,r){e=O(e,255);t=O(t,255);r=O(r,255);var n=c(e,t,r),i=l(e,t,r);var a,o,s=(n+i)/2;if(n==i){a=o=0}else{var u=n-i;o=s>.5?u/(2-n-i):u/(n+i);switch(n){case e:a=(t-r)/u+(t<r?6:0);break;case t:a=(r-e)/u+2;break;case r:a=(e-t)/u+4;break}a/=6}return{h:a,s:o,l:s}}function v(e,t,r){var n,i,a;e=O(e,360);t=O(t,100);r=O(r,100);function o(e,t,r){if(r<0)r+=1;if(r>1)r-=1;if(r<1/6)return e+(t-e)*6*r;if(r<1/2)return t;if(r<2/3)return e+(t-e)*(2/3-r)*6;return e}if(t===0){n=i=a=r}else{var s=r<.5?r*(1+t):r+t-r*t;var u=2*r-s;n=o(u,s,e+1/3);i=o(u,s,e);a=o(u,s,e-1/3)}return{r:n*255,g:i*255,b:a*255}}function y(e,t,r){e=O(e,255);t=O(t,255);r=O(r,255);var n=c(e,t,r),i=l(e,t,r);var a,o,s=n;var u=n-i;o=n===0?0:u/n;if(n==i){a=0}else{switch(n){case e:a=(t-r)/u+(t<r?6:0);break;case t:a=(r-e)/u+2;break;case r:a=(e-t)/u+4;break}a/=6}return{h:a,s:o,v:s}}function g(e,t,r){e=O(e,360)*6;t=O(t,100);r=O(r,100);var n=s.floor(e),i=e-n,a=r*(1-t),o=r*(1-i*t),u=r*(1-(1-i)*t),l=n%6,c=[r,o,a,a,u,r][l],f=[u,r,r,o,a,a][l],h=[a,a,u,r,r,o][l];return{r:c*255,g:f*255,b:h*255}}function b(e,t,r,n){var i=[j(u(e).toString(16)),j(u(t).toString(16)),j(u(r).toString(16))];if(n&&i[0].charAt(0)==i[0].charAt(1)&&i[1].charAt(0)==i[1].charAt(1)&&i[2].charAt(0)==i[2].charAt(1)){return i[0].charAt(0)+i[1].charAt(0)+i[2].charAt(0)}return i.join("")}function x(e,t,r,n){var i=[j(W(n)),j(u(e).toString(16)),j(u(t).toString(16)),j(u(r).toString(16))];return i.join("")}h.equals=function(e,t){if(!e||!t){return false}return h(e).toRgbString()==h(t).toRgbString()};h.random=function(){return h.fromRatio({r:f(),g:f(),b:f()})};function _(e,t){t=t===0?0:t||10;var r=h(e).toHsl();r.s-=t/100;r.s=U(r.s);return h(r)}function w(e,t){t=t===0?0:t||10;var r=h(e).toHsl();r.s+=t/100;r.s=U(r.s);return h(r)}function C(e){return h(e).desaturate(100)}function E(e,t){t=t===0?0:t||10;var r=h(e).toHsl();r.l+=t/100;r.l=U(r.l);return h(r)}function S(e,t){t=t===0?0:t||10;var r=h(e).toRgb();r.r=c(0,l(255,r.r-u(255*-(t/100))));r.g=c(0,l(255,r.g-u(255*-(t/100))));r.b=c(0,l(255,r.b-u(255*-(t/100))));return h(r)}function T(e,t){t=t===0?0:t||10;var r=h(e).toHsl();r.l-=t/100;r.l=U(r.l);return h(r)}function M(e,t){var r=h(e).toHsl();var n=(u(r.h)+t)%360;r.h=n<0?360+n:n;return h(r)}function A(e){var t=h(e).toHsl();t.h=(t.h+180)%360;return h(t)}function P(e){var t=h(e).toHsl();var r=t.h;return[h(e),h({h:(r+120)%360,s:t.s,l:t.l}),h({h:(r+240)%360,s:t.s,l:t.l})]}function R(e){var t=h(e).toHsl();var r=t.h;return[h(e),h({h:(r+90)%360,s:t.s,l:t.l}),h({h:(r+180)%360,s:t.s,l:t.l}),h({h:(r+270)%360,s:t.s,l:t.l})]}function k(e){var t=h(e).toHsl();var r=t.h;return[h(e),h({h:(r+72)%360,s:t.s,l:t.l}
349),h({h:(r+216)%360,s:t.s,l:t.l})]}function I(e,t,r){t=t||6;r=r||30;var n=h(e).toHsl();var i=360/r;var a=[h(e)];for(n.h=(n.h-(i*t>>1)+720)%360;--t;){n.h=(n.h+i)%360;a.push(h(n))}return a}function D(e,t){t=t||6;var r=h(e).toHsv();var n=r.h,i=r.s,a=r.v;var o=[];var s=1/t;while(t--){o.push(h({h:n,s:i,v:a}));a=(a+s)%1}return o}h.mix=function(e,t,r){r=r===0?0:r||50;var n=h(e).toRgb();var i=h(t).toRgb();var a=r/100;var o=a*2-1;var s=i.a-n.a;var u;if(o*s==-1){u=o}else{u=(o+s)/(1+o*s)}u=(u+1)/2;var l=1-u;var c={r:i.r*u+n.r*l,g:i.g*u+n.g*l,b:i.b*u+n.b*l,a:i.a*a+n.a*(1-a)};return h(c)};h.readability=function(e,t){var r=h(e);var n=h(t);return(Math.max(r.getLuminance(),n.getLuminance())+.05)/(Math.min(r.getLuminance(),n.getLuminance())+.05)};h.isReadable=function(e,t,r){var n=h.readability(e,t);var i,a;a=false;i=K(r);switch(i.level+i.size){case"AAsmall":case"AAAlarge":a=n>=4.5;break;case"AAlarge":a=n>=3;break;case"AAAsmall":a=n>=7;break}return a};h.mostReadable=function(e,t,r){var n=null;var i=0;var a;var o,s,u;r=r||{};o=r.includeFallbackColors;s=r.level;u=r.size;
vendor: 1,604 bytes, line 349
349for(var l=0;l<t.length;l++){a=h.readability(e,t[l]);if(a>i){i=a;n=h(t[l])}}if(h.isReadable(e,n,{level:s,size:u})||!o){return n}else{r.includeFallbackColors=false;return h.mostReadable(e,["#fff","#000"],r)}};var B=h.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",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:"f0f",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",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee9
3490",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",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",rebeccapurple:"663399",red:"f00",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:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"};var L=h.hexNames=F(B);function F(e){var t={};for(var r in e){if(e.hasOwnProperty(r)){t[e[r]]=r}}return t}function V(e){e=parseFloat(e);if(isNaN(e)||e<0||e>1){e=1}return e}function O(e,t){if(z(e)){e="100%"}var r=H(e);e=l(t,c(0,parseFloat(e)));if(r){e=parseInt(e*t,10)/100}if(s.abs(e-t)<1e-6){return 1}return e%t/parseFloat(t)}function U(e){return l(1,c(0,e))}function N(e){return parseInt(e,16)}function z(e){return typeof e=="string"&&e.indexOf(".")!=-1&&parseFloat(e)===1}function H(e){return typeof e==="string"&&e.indexOf("%")!=-1}function j(e){return e.length==1?"0"+e:""+e}function G(e,t){t=t||100;if(e<=1){e=e*t+"%"}return e}function W(e){return Math.round(parseFloat(e)*255).toString(16)}function q(e){return N(e)/255}var X=function(){var e="[-\\+]?\\d+%?";var t="[-\\+]?\\d*\\.\\d+%?";var r="(?:"+t+")|(?:"+e+")";var n="[\\s|\\(]+("+r+")[,|\\s]+("+r+")[,|\\s]+("+r+")\\s*\\)?";var i="[\\s|\\(]+("+r+")[,|\\s]+("+r+")[,|\\s]+("+r+")[,|\\s]+("+r+")\\s*\\)?";return{rgb:new RegExp("rgb"+n),rgba:new RegExp("rgba"+i),hsl:new RegExp("hsl"+n),hsla:new RegExp("hsla"+i),hsv:new RegExp("hsv"+n),hsva:new RegExp("hsva"
349+i),hex3:/^([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex8:/^([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/}}();function Y(e){e=e.replace(i,"").replace(a,"").toLowerCase();var t=false;if(B[e]){e=B[e];t=true}else if(e=="transparent"){return{r:0,g:0,b:0,a:0,format:"name"}}var r;if(r=X.rgb.exec(e)){return{r:r[1],g:r[2],b:r[3]}}if(r=X.rgba.exec(e)){return{r:r[1],g:r[2],b:r[3],a:r[4]}}if(r=X.hsl.exec(e)){return{h:r[1],s:r[2],l:r[3]}}if(r=X.hsla.exec(e)){return{h:r[1],s:r[2],l:r[3],a:r[4]}}if(r=X.hsv.exec(e)){return{h:r[1],s:r[2],v:r[3]}}if(r=X.hsva.exec(e)){return{h:r[1],s:r[2],v:r[3],a:r[4]}}if(r=X.hex8.exec(e)){return{a:q(r[1]),r:N(r[2]),g:N(r[3]),b:N(r[4]),format:t?"name":"hex8"}}if(r=X.hex6.exec(e)){return{r:N(r[1]),g:N(r[2]),b:N(r[3]),format:t?"name":"hex"}}if(r=X.hex3.exec(e)){return{r:N(r[1]+""+r[1]),g:N(r[2]+""+r[2]),b:N(r[3]+""+r[3]),format:t?"name":"hex"}}return false}function K(e){var t,r;e=e||{level:"AA",size:"small"};t=(e.level||"AA").toUpperCase();r=(e.size||"small").toLowerCase();if(t!=="AA"&&t!=="AAA"){t="AA"}if(r!=="small"&&r!=="large"){r="small"}return{level:t,size:r}}if(typeof e!=="undefined"&&e.exports){e.exports=h}else if(true){!(n=function(){return h}.call(t,r,t,e),n!==undefined&&(e.exports=n))}else{window.tinycolor=h}})()},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:true});t.ChromePointer=undefined;var n=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||false;n.configurable=true;if("value"in n)n.writable=true;Object.defineProperty(e,n.key,n)}}return function(t,r,n){if(r)e(t.prototype,r);if(n)e(t,n);return t}}();var i=r(3);var a=c(i);var o=r(4);var s=c(o);var u=r(17);var l=c(u);function c(e){return e&&e.__esModule?e:{default:e}}function f(e,t){if(!(e instanceof t)){throw new TypeError("Cannot call a class as a function")}}function h(e,t){if(!e){throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return t&&(typeof t==="object"||typeof t==="function")?t:e}function d(e,t){if(typeof t!=="function"&&t!==null){throw new TypeError("Super expression must either be null or a function, not "+typeof t)}e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:false,writable:true,configurable:true}});if(t)Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t}var p=t.ChromePointer=function(e){d(t,e);function t(){var e;var r,n,i;for(var a=arguments.length,o=Array(a),s=0;s<a;s++){o[s]=arguments[s]}f(this,t);return i=(r=(n=h(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(o))),n),n.shouldComponentUpdate=l.default.bind(n,n,arguments[0],arguments[1]),r),h(n,i)}n(t,[{key:"classes",value:function e(){return{default:{picker:{width:"10px",height:"16px",borderRadius:"5px",transform:"translate(-5px, 0px)",backgroundColor:"rgb(248, 248, 248)",boxShadow:"0 1px 4px 0 rgba(0, 0, 0, 0.37)"}}}}},{key:"render",value:function e(){return a.default.createElement("div",{style:this.styles().picker})}}]);return t}(s.default.Component);t.default=p},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:true});t.ChromePointerCircle=undefined;var n=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||false;n.configurable=true;if("value"in n)n.writable=true;Object.defineProperty(e,n.key,n)}}return function(t,r,n){if(r)e(t.prototype,r);if(n)e(t,n);return t}}();var i=r(3);var a=c(i);var o=r(4);var s=c(o);var u=r(17);var l=c(u);function c(e){return e&&e.__esModule?e:{default:e}}function f(e,t){if(!(e instanceof t)){throw new TypeError("Cannot call a class as a function")}}function h(e,t){if(!e){throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return t&&(typeof t==="object"||typeof t==="function")?t:e}function d(e,t){if(typeof t!=="function"&&t!==null){throw new TypeError("Super expression must either be null or a function, not "+typeof t)}e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:false,writable:true,configurable:true}});
349if(t)Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t}var p=t.ChromePointerCircle=function(e){d(t,e);function t(){var e;var r,n,i;for(var a=arguments.length,o=Array(a),s=0;s<a;s++){o[s]=arguments[s]}f(this,t);return i=(r=(n=h(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(o))),n),n.shouldComponentUpdate=l.default.bind(n,n,arguments[0],arguments[1]),r),h(n,i)}n(t,[{key:"classes",value:function e(){return{default:{picker:{width:"12px",height:"12px",borderRadius:"6px",boxShadow:"inset 0 0 0 1px #fff",transform:"translate(-6px, -6px)"}}}}},{key:"render",value:function e(){return a.default.createElement("div",{style:this.styles().picker})}}]);return t}(s.default.Component);t.default=p},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:true});t.CompactColor=undefined;var n=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||false;n.configurable=true;if("value"in n)n.writable=true;Object.defineProperty(e,n.key,n)}}return function(t,r,n){if(r)e(t.prototype,r);if(n)e(t,n);return t}}();var i=r(3);var a=c(i);var o=r(4);var s=c(o);var u=r(17);var l=c(u);function c(e){return e&&e.__esModule?e:{default:e}}function f(e,t){if(!(e instanceof t)){throw new TypeError("Cannot call a class as a function")}}function h(e,t){if(!e){throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return t&&(typeof t==="object"||typeof t==="function")?t:e}function d(e,t){if(typeof t!=="function"&&t!==null){throw new TypeError("Super expression must either be null or a function, not "+typeof t)}e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:false,writable:true,configurable:true}});if(t)Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t}var p=t.CompactColor=function(e){d(t,e);function t(){var e;var r,n,i;for(var a=arguments.length,o=Array(a),s=0;s<a;s++){o[s]=arguments[s]}f(this,t);return i=(r=(n=h(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(o))),n),n.shouldComponentUpdate=l.default.bind(n,n,arguments[0],arguments[1]),n.handleClick=function(){n.props.onClick({hex:n.props.color})},r),h(n,i)}n(t,[{key:"classes",value:function e(){return{default:{color:{background:this.props.color,height:"15px",cursor:"pointer",flexGrow:"1"}}}}},{key:"render",value:function e(){return a.default.createElement("div",{style:this.styles().color,ref:"color",onClick:this.handleClick})}}]);return t}(s.default.Component);t.default=p}]);"use strict";/* 350 * Copyright (c) 2016 - now David Sehnal, licensed under Apache 2.0, See LICENSE file for more info. 351 */ 352var p;(function(e){e.Promise=t})(p||(p={}));(function(e){var t;(function(t){"use strict";t.Rx=i;t.Promise=e.Promise;var r;(function(e){e.CIF=o})(r=t.Formats||(t.Formats={}))})(t=e.Core||(e.Core={}))})(p||(p={}));/* 353 * Copyright (c) 2016 - now David Sehnal, licensed under Apache 2.0, See LICENSE file for more info. 354 */ 355var p;(function(e){var t;(function(e){e.VERSION={number:"3.2.2",date:"Nov 14 2017"}})(t=e.Core||(e.Core={}))})(p||(p={}));/* 356 * Copyright (c) 2016 - now David Sehnal, licensed under Apache 2.0, See LICENSE file for more info. 357 */ 358var p;(function(e){var t;(function(e){var t;(function(t){"use strict";function r(){var e={};var t=typeof document!=="undefined"?document:void 0;var r=false;var n=1;var i;function a(t){var r=[];for(var a=1;a<arguments.length;a++){r[a-1]=arguments[a]}if(typeof t!=="function"){t=new Function(""+t)}var o={callback:t,args:r};e[n]=o;i(n);return n++}function o(t){delete e[t]}function s(e){var t=e.callback;var r=e.args;switch(r.length){case 0:t();break;case 1:t(r[0]);break;case 2:t(r[0],r[1]);break;case 3:t(r[0],r[1],r[2]);break;default:t.apply(undefined,r);break}}function u(t){if(r){setTimeout(u,0,t)}else{var n=e[t];if(n){r=true;try{s(n)}finally{o(t);r=false}}}}function l(){i=function(e){process.nextTick(function(){u(e)})}}function c(){var e=window;if(e&&e.postMessage&&!e.importScripts){var t=true;var r=e.onmessage;e.onmessage=function(){t=false};e.postMessage("","*");e.onmessage=r;return t}return void 0}function f(){var e=window;var t="setImmediate$"+Math.random()+"$";var r=function(r){if(r.source===e&&typeof r.data==="string"&&r.data.indexOf(t)===0){u(+r.data.slice(t.length))}};if(window.addEventListener){window.addEventListener("message",r,false)}else{window.attachEvent("onmessage",r)}i=function(e){window.postMessage(t+e,"*")}}function h(){var e=new MessageChannel;e.port1.onmessage=function(e){var t=e.data;u(t)};i=function(t){e.port2.postMessage(t)}}function d(){var e=t.documentElement;i=function(r){var n=t.createElement("script");n.onreadystatechange=function(){u(r);n.onreadystatechange=null;e.removeChild(n);n=null};e.appendChild(n)}}function p(){i=function(e){setTimeout(u,0,e)}}if(typeof process!=="undefined"&&{}.toString.call(process)==="[object process]"){l()}else if(c()){f()}else if(typeof MessageChannel!=="undefined"){h()}else if(t&&"onreadystatechange"in t.createElement("script")){d()}else{p()}return{setImmediate:a,clearImmediate:o}}var n=function(){if(typeof setImmediate!=="undefined"){if(typeof window!=="undefined"&&typeof window.setImmediate!=="undefined"){return{setImmediate:function(e){var t=[];for(var r=1;r<arguments.length;r++){t[r-1]=arguments[r]}return window.setImmediate.apply(window,[e].concat(t))},clearImmediate:function(e){return window.clearImmediate(e)}}}else return{setImmediate:setImmediate,clearImmediate:t.clearImmediate}}return r()}();function i(e){n.setImmediate(e)}t.immediate=n.setImmediate;t.clearImmediate=n.clearImmediate;function a(){return new e.Promise(i)}t.immediatePromise=a}
358)(t=e.Scheduler||(e.Scheduler={}))})(t=e.Core||(e.Core={}))})(p||(p={}));/* 359 * Copyright (c) 2016 - now David Sehnal, licensed under Apache 2.0, See LICENSE file for more info. 360 */ 361var m=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))(function(i,a){function o(e){try{u(n.next(e))}catch(e){a(e)}}function s(e){try{u(n["throw"](e))}catch(e){a(e)}}function u(e){e.done?i(e.value):new r(function(t){t(e.value)}).then(o,s)}u((n=n.apply(e,t||[])).next())})};var v=this&&this.__generator||function(e,t){var r={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},n,i,a,o;return o={next:s(0),throw:s(1),return:s(2)},typeof Symbol==="function"&&(o[Symbol.iterator]=function(){return this}),o;function s(e){return function(t){return u([e,t])}}function u(o){if(n)throw new TypeError("Generator is already executing.");while(r)try{if(n=1,i&&(a=i[o[0]&2?"return":o[0]?"throw":"next"])&&!(a=a.call(i,o[1])).done)return a;if(i=0,a)o=[0,a.value];switch(o[0]){case 0:case 1:a=o;break;case 4:r.label++;return{value:o[1],done:false};case 5:r.label++;i=o[1];o=[0];continue;case 7:o=r.ops.pop();r.trys.pop();continue;default:if(!(a=r.trys,a=a.length>
3610&&a[a.length-1])&&(o[0]===6||o[0]===2)){r=0;continue}if(o[0]===3&&(!a||o[1]>a[0]&&o[1]<a[3])){r.label=o[1];break}if(o[0]===6&&r.label<a[1]){r.label=a[1];a=o;break}if(a&&r.label<a[2]){r.label=a[2];r.ops.push(o);break}if(a[2])r.ops.pop();r.trys.pop();continue}o=t.call(e,r)}catch(e){o=[6,e];i=0}finally{n=a=0}if(o[0]&5)throw o[1];return{value:o[0]?o[1]:void 0,done:true}}};var p;(function(e){var t;(function(e){"use strict";function t(e){return new r(e)}e.computation=t;var r=function(){function t(e){this.computation=e}t.prototype.run=function(e){return this.runWithContext(e).result};t.prototype.runWithContext=function(r){var i=this;var a=r?r:new n;return{progress:a.progressStream,result:new e.Promise(function(e,r){return m(i,void 0,void 0,function(){var n,i;return v(this,function(o){switch(o.label){case 0:o.trys.push([0,2,3,4]);a.started();return[4,this.computation(a)];case 1:n=o.sent();e(n);return[3,4];case 2:i=o.sent();if(t.PRINT_CONSOLE_ERROR)console.error(i);r(i);return[3,4];case 3:a.finished();return[7];case 4:return[2]}})})})}};return t}();e.Computation=r;(function(r){r.PRINT_CONSOLE_ERROR=false;function i(r){return t(function(){return e.Promise.resolve(r)})}r.resolve=i;function a(r){return t(function(){return e.Promise.reject(r)})}r.reject=a;function o(){return new n}r.createContext=o;r.Aborted="Aborted";r.UpdateProgressDelta=100})(r=e.Computation||(e.Computation={}));var n=function(){function t(){var t=this;this._abortRequested=false;this._abortRequester=function(){t._abortRequested=true};this.progressTick=new e.Rx.Subject;this._progress={message:"Working...",current:0,max:0,isIndeterminate:true,requestAbort:void 0};this.progressStream=new e.Rx.BehaviorSubject(this._progress);this.startEndCounter=0;this.progressTick.throttle(1e3/15).subscribe(function(e){t.progressStream.onNext({message:e.message,isIndeterminate:e.isIndeterminate,current:e.current,max:e.max,requestAbort:e.requestAbort})})}Object.defineProperty(t.prototype,"isAbortRequested",{get:function(){return this._abortRequested},enumerable:true,configurable:true});t.prototype.checkAborted=function(){if(this._abortRequested)throw r.Aborted};t.prototype.requestAbort=function(){try{if(this._abortRequester){this._abortRequester.call(null)}}catch(e){}};Object.defineProperty(t.prototype,"progress",{get:function(){return this.progressTick},enumerable:true,configurable:true});t.prototype.updateProgress=function(t,r,n,i){if(n===void 0){n=NaN}if(i===void 0){i=NaN}this.checkAborted();this._progress.message=t;if(typeof r==="boolean"){this._progress.requestAbort=r?this._abortRequester:void 0}else{if(r)this._abortRequester=r;this._progress.requestAbort=r?this._abortRequester:void 0}if(isNaN(n)){this._progress.isIndeterminate=true}else{this._progress.isIndeterminate=false;this._progress.current=n;this._progress.max=i}this.progressTick.onNext(this._progress);return e.Scheduler.immediatePromise()};t.prototype.started=function(){this.startEndCounter++};t.prototype.finished=function(){this.startEndCounter--;if(this.startEndCounter<=0){this.progressTick.onCompleted();this.progressStream.onCompleted()}if(this.startEndCounter<0){throw"Bug in code somewhere, Computation.resolve/reject called too many times."}};return t}()})(t=e.Core||(e.Core={}))})(p||(p={}));/* 362 * Copyright (c) 2016 - now David Sehnal, licensed under Apache 2.0, See LICENSE file for more info. 363 */ 364var p;(function(e){var t;(function(e){var t;(function(e){"use strict";function t(){var e=Object.create(null);e["__"]=void 0;delete e["__"];return e}var r;(function(e){function r(e,t,r){for(var n=0,i=Object.keys(e);n<i.length;n++){var a=i[n];var o=e[a];if(o===void 0)continue;t(o,a,r)}}var n={set:function(e,t){if(this.data[e]===void 0&&t!==void 0){this.size++}this.data[e]=t},get:function(e){return this.data[e]},delete:function(e){if(this.data[e]===void 0)return false;delete this.data[e];this.size--;return true},has:function(e){return this.data[e]!==void 0},clear:function(){this.data=t();this.size=0},forEach:function(e,t){r(this.data,e,t!==void 0?t:void 0)}};function i(){var e=Object.create(n);e.data=t();e.size=0;return e}e.create=i;function a(e){var t=i();for(var r=0,n=e;r<n.length;r++){var a=n[r];t.set(a[0],a[1])}return t}e.ofArray=a;function o(e){var t=i();for(var r=0,n=Object.keys(e);r<n.length;r++){var a=n[r];var o=e[a];t.set(a,o)}return t}e.ofObject=o})(r=e.FastMap||(e.FastMap={}));var n;(function(e){function r(e,t,r){for(var n=0,i=Object.keys(e);n<i.length;n++){var a=i[n];if(e[a]!==null)continue;t(a,r)}}var n={add:function(e){if(this.data[e]===null)return false;this.data[e]=null;this.size++;return true},delete:function(e){if(this.data[e]!==null)return false;delete this.data[e];this.size--;return true},has:function(e){return this.data[e]===null},clear:function(){this.data=t();this.size=0}
364,forEach:function(e,t){r(this.data,e,t!==void 0?t:void 0)}};function i(){var e=Object.create(n);e.data=t();e.size=0;return e}e.create=i;function a(e){var t=i();for(var r=0,n=e.length;r<n;r++){t.add(e[r])}return t}e.ofArray=a})(n=e.FastSet||(e.FastSet={}));var i;(function(t){var r=function(){function e(e){this.size=e}e.prototype.has=function(e){return false};return e}();var n=function(){function e(e,t){this.idx=e;this.size=t}e.prototype.has=function(e){return e===this.idx};return e}();var i=function(){function e(e,t){this.mask=e;this.size=t}e.prototype.has=function(e){return this.mask[e]};return e}();var a=function(){function e(e){this.size=e}e.prototype.has=function(e){return true};return e}();function o(e){return new a(e.data.atoms.count)}t.ofStructure=o;function s(t,a){var o=a.length;if(o===0)return new r(t);if(o===1)return new n(a[0],t);var s=o/t;if(s<1/12){var u=e.FastSet.create();for(var l=0,c=a;l<c.length;l++){var f=c[l];u.add(f)}return u}var h=new Int8Array(t);for(var d=0,p=a;d<p.length;d++){var f=p[d];h[f]=1}return new i(h,o)}t.ofIndices=s;function u(t){var r=0;for(var n=0,a=t.fragments;n<a.length;n++){var o=a[n];r+=o.atomCount}var s=t.context.structure.data.atoms.count;if(r/s<1/12){var u=e.FastSet.create();for(var l=0,c=t.fragments;l<c.length;l++){var o=c[l];for(var f=0,h=o.atomIndices;f<h.length;f++){var d=h[f];u.add(d)}}return u}else{var u=new Int8Array(s);for(var p=0,m=t.fragments;p<m.length;p++){var o=m[p];for(var v=0,y=o.atomIndices;v<y.length;v++){var d=y[v];u[d]=1}}var g=0;for(var d=0;d<s;d++){if(u[d]!==0)g++}return new i(u,g)}}t.ofFragments=u})(i=e.Mask||(e.Mask={}))})(t=e.Utils||(e.Utils={}))})(t=e.Core||(e.Core={}))})(p||(p={}));/* 365 * Copyright (c) 2016 - now David Sehnal, licensed under Apache 2.0, See LICENSE file for more info. 366 */ 367var p;(function(e){var t;(function(e){var t;(function(t){"use strict";t.FastNumberParsers=e.Formats.CIF.Utils.FastNumberParsers;function r(e,t,r){var n;var i=t;var a=e;var o=r;for(var s=0,u=Object.keys(t);s<u.length;s++){var l=u[s];n=i[l];if(n!==void 0)a[l]=n;else if(r)a[l]=o[l]}if(r){for(var c=0,f=Object.keys(r);c<f.length;c++){var l=f[c];n=a[l];if(n===void 0)a[l]=o[l]}}return e}t.extend=r;function n(e,t){var r,n,i,a,o,s,u,l=0,c=0,f=true,h=false;t=Math.max(0,t)||0;var d=function(){var c=t-(performance.now()-a);if(c<=0){if(n){clearTimeout(n)}var f=u;n=s=u=void 0;if(f){l=performance.now();i=e.apply(o,r);if(!s&&!n){r=o=null}}}else{s=setTimeout(d,c)}};var p=function(){if(s){clearTimeout(s)}n=s=u=void 0;if(f||c!==t){l=performance.now();i=e.apply(o,r);if(!s&&!n){r=o=null}}};return function(){r=arguments;a=performance.now();o=this;u=f&&(s||!h);var m=false;var v=false;if(c===0){v=h&&!s}else{if(!n&&!h){l=a}var y=c-(a-l),g=y<=0;if(g){if(n){n=clearTimeout(n)}l=a;i=e.apply(o,r)}else if(!n){n=setTimeout(p,y)}}if(m&&s){s=clearTimeout(s)}else if(!s&&t!==c){s=setTimeout(d,t)}if(v){m=true;i=e.apply(o,r)}if(m&&!s&&!n){r=o=null}return i}}t.debounce=n})(t=e.Utils||(e.Utils={}))})(t=e.Core||(e.Core={}))})(p||(p={}));/* 368 * Copyright (c) 2016 - now David Sehnal, licensed under Apache 2.0, See LICENSE file for more info. 369 */ 370var p;(function(e){var t;(function(e){var t;(function(e){"use strict";var t;(function(t){function r(e){return function(t){return new e(t)}}t.typedColumn=r;function n(){return function(e){return new Array(e)}}t.customColumn=n;t.stringColumn=function(e){return new Array(e)};t.stringNullColumn=function(e){return new Array(e)};function i(e){return new u(e)}t.builder=i;function a(e,r){var n=t.builder(r);for(var i=0,a=Object.keys(e);i<a.length;i++){var o=a[i];if(!Object.prototype.hasOwnProperty.call(e,o))continue;var s=e[o];if(s){n.addColumn(o,s)}}return n.seal()}t.ofDefinition=a;function o(e,t){var r=Object.create(null);for(var n=0,i=e.columns;n<i.length;n++){var a=i[n];(function(e,t,r,n){Object.defineProperty(t,e.name,{enumerable:true,configurable:false,get:function(){return n[r.index]}})})(a,r,t,e[a.name])}return r}var s=function(){function t(t,r,n){this.__rowIndexer={index:0};this.count=t;this.indices=new Int32Array(t);this.columns=[];for(var i=0;i<t;i++){this.indices[i]=i}for(var a=0,s=r;a<s.length;a++){var u=s[a];var l=n[u.name];if(e.ChunkedArray.is(l)){l=e.ChunkedArray.compact(l)}Object.defineProperty(this,u.name,{enumerable:true,configurable:false,writable:false,value:l});this.columns[this.columns.length]=u}this.__row=o(this,this.__rowIndexer)}t.prototype.getBuilder=function(e){var t=new u(e);for(var r=0,n=this.columns;r<n.length;r++){var i=n[r];t.addColumn(i.name,i.creator)}return t};t.prototype.getRawData=function(){var e=this;return this.columns.map(function(t){return e[t.name]})};t.prototype.getRow=function(e){this.__rowIndexer.index=e;return this.__row};return t}();var u=function(){function e(e){this.columns=[];this.count=e}e.prototype.addColumn=function(e,t){var r=t(this.count);Object.defineProperty(this,e,{enumerable:true,configurable:false,writable:false,value:r});this.columns[this.columns.length]={name:e,creator:t};return r};e.prototype.addRawColumn=function(e,t,r){var n=r;Object.defineProperty(this,e,{enumerable:true,configurable:false,writable:false,value:n});this.columns[this.columns.length]={name:e,creator:t};return n};e.prototype.getRawData=function(){var e=this;return this.columns.map(function(t){return e[t.name]})};e.prototype.seal=function(){return new s(this.count,this.columns,this)};return e}()})(t=e.DataTable||(e.DataTable={}))})(t=e.Utils||(e.Utils={}))})(t=e.Core||(e.Core={}))})(p||(p={}));/* 371 * Copyright (c) 2016 - now David Sehnal, licensed under Apache 2.0, See LICENSE file for more info. 372 */ 373var p;(function(e){var t;(function(e){var t;(function(e){"use strict";function t(e){var t=new Int32Array(e.size);e.forEach(function(e,t){t.array[t.index++]=e},{array:t,index:0});Array.prototype.sort.call(t,function(e,t){return e-t});return t}e.integerSetToSortedTypedArray=t;function r(e){var t=[];for(var r=0;r<e;r++)t[r]=0;return t}e.makeNativeIntArray=r;function n(e){var t=[];if(!e)return t;t[0]=.1;for(var r=0;r<e;r++)t[r]=0;return t}e.makeNativeFloatArray=n;var i;(function(e){function t(e){return e.creator&&e.chunkSize}e.is=t;function r(e,t,r,n,i){if(e.currentIndex>=e.chunkSize){e.currentIndex=0;e.current=e.creator(e.chunkSize);e.parts[e.parts.length]=e.current}e.current[e.currentIndex++]=t;e.current[e.currentIndex++]=r;e.current[e.currentIndex++]=n;e.current[e.currentIndex++]=i;return e.elementCount++}e.add4=r;function n(e,t,r,n){if(e.currentIndex>=e.chunkSize){e.currentIndex=0;e.current=e.creator(e.chunkSize);e.parts[e.parts.length]=e.current}e.current[e.currentIndex++]=t;e.current[e.currentIndex++]=r;e.current[e.currentIndex++]=n;return e.elementCount++}e.add3=n;function i(e,t,r){if(e.currentIndex>=e.chunkSize){e.currentIndex=0;e.current=e.creator(e.chunkSize);e.parts[e.parts.length]=e.current}e.current[e.currentIndex++]=t;e.current[e.currentIndex++]=r;return e.elementCount++}e.add2=i;function a(e,t){if(e.currentIndex>=e.chunkSize){e.currentIndex=0;e.current=e.creator(e.chunkSize);e.parts[e.parts.length]=e.current}e.current[e.currentIndex++]=t;return e.elementCount++}e.add=a;function o(e){var t=e.creator(e.elementSize*e.elementCount),r=(e.parts.length-1)*e.chunkSize,n=0,i;if(e.parts.length===1&&e.chunkSize===e.elementCount){return e.parts[0]}if(e.parts.length>1){if(e.parts[0].buffer){for(var a=0;a<e.parts.length-1;a++){t.set(e.parts[a],e.chunkSize*a)}}else{for(var a=0;a<e.parts.length-1;a++){n=e.chunkSize*a;i=e.parts[a];for(var o=0;o<e.chunkSize;o++){t[n+o]=i[o]}}}}if(e.current.buffer&&e.currentIndex>=e.chunkSize){t.set(e.current,e.chunkSize*(e.parts.length-1))}else{for(var a=0;a<e.currentIndex;a++){t[r+a]=e.current[a]}}return t}e.compact=o;function s(e){if(e===void 0){e=262144}return p(function(e){return new Float32Array(e)},e,3)}e.forVertex3D=s;function u(e){if(e===void 0){e=262144}return p(function(e){return new Uint32Array(e)},e,3)}e.forIndexBuffer=u;function l(e){if(e===void 0){e=131072}return p(function(e){return new Int32Array(e)},e,2)}e.forTokenIndices=l;function c(e){if(e===void 0){e=131072}return p(function(e){return new Int32Array(e)},e,1)}e.forIndices=c;function f(e){if(e===void 0){e=131072}return p(function(e){return new Int32Array(e)},e,1)}e.forInt32=f;function h(e){if(e===void 0){e=131072}return p(function(e){return new Float32Array(e)},e,1)}e.forFloat32=h;function d(e){if(e===void 0){e=131072}return p(function(e){return[]},e,1)}e.forArray=d;function p(e,t,r){t=t|0;if(t<=0)t=1;var n=t*r;var i=e(n);return{elementSize:r,chunkSize:n,creator:e,current:i,parts:[i],currentIndex:0,elementCount:0}}e.create=p})(i=e.ChunkedArray||(e.ChunkedArray={}));var a;(function(e){function t(e,t,r,n){var i=e.array;i[e.currentIndex++]=t;i[e.currentIndex++]=r;i[e.currentIndex++]=n;e.elementCount++}e.add3=t;function r(e,t,r){var n=e.array;n[e.currentIndex++]=t;n[e.currentIndex++]=r;e.elementCount++}e.add2=r;function n(e,t){e.array[e.currentIndex++]=t;e.elementCount++}e.add=n;function i(e){return f(function(e){return new Float32Array(e)},e,3)}e.forVertex3D=i;function a(e){return f(function(e){return new Int32Array(e)},e,3)}e.forIndexBuffer=a;function o(e){return f(function(e){return new Int32Array(e)},e,2)}e.forTokenIndices=o;function s(e){return f(function(e){return new Int32Array(e)},e,1)}e.forIndices=s;function u(e){return f(function(e){return new Int32Array(e)},e,1)}e.forInt32=u;function l(e){return f(function(e){return new Float32Array(e)},e,1)}e.forFloat32=l;function c(e){return f(function(e){return[]},e,1)}e.forArray=c;function f(e,t,r){t=t|0;return{array:e(t*r),currentIndex:0,elementCount:0}}e.create=f})(a=e.ArrayBuilder||(e.ArrayBuilder={}));function o(){return{_set:e.FastSet.create(),array:[]}}e.UniqueArray=o;(function(e){function t(e,t){var r=e._set,n=e.array;if(!r.has(t)){r.add(t);n[n.length]=t}}e.add=t}
373)(o=e.UniqueArray||(e.UniqueArray={}))})(t=e.Utils||(e.Utils={}))})(t=e.Core||(e.Core={}))})(p||(p={}));/* 374 * Copyright (c) 2016 - now David Sehnal, licensed under Apache 2.0, See LICENSE file for more info. 375 */ 376var p;(function(e){var t;(function(e){var t;(function(e){"use strict";var t;(function(e){e.perfGetTime=function(){if(typeof window!=="undefined"&&window.performance){return function(){return window.performance.now()}}else if(typeof process!=="undefined"&&process.hrtime!=="undefined"){return function(){var e=process.hrtime();return e[0]*1e3+e[1]/1e6}}else{return function(){return+new Date}}}()})(t||(t={}));var r=function(){function r(){this.starts=e.FastMap.create();this.ends=e.FastMap.create()}r.currentTime=function(){return t.perfGetTime()};r.prototype.start=function(e){this.starts.set(e,t.perfGetTime())};r.prototype.end=function(e){this.ends.set(e,t.perfGetTime())};r.format=function(e){if(isNaN(e))return"n/a";var t=Math.floor(e/(60*60*1e3)),r=Math.floor(e/(60*1e3)%60),n=Math.floor(e/1e3%60),i=Math.floor(e%1e3).toString();while(i.length<3)i="0"+i;if(t>0)return t+"h"+r+"m"+n+"."+i+"s";if(r>0)return r+"m"+n+"."+i+"s";if(n>0)return n+"."+i+"s";return e.toFixed(0)+"ms"};r.prototype.formatTime=function(e){return r.format(this.time(e))};r.prototype.formatTimeSum=function(){var e=[];for(var t=0;t<arguments.length;t++){e[t]=arguments[t]}return r.format(this.timeSum.apply(this,e))};r.prototype.time=function(e){var t=this.starts.get(e),r=this.ends.get(e);this.starts.delete(e);this.ends.delete(e);return r-t};r.prototype.timeSum=function(){var e=this;var t=[];for(var r=0;r<arguments.length;r++){t[r]=arguments[r]}var n=0;for(var i=0,a=t.map(function(t){return e.ends.get(t)-e.starts.get(t)});i<a.length;i++){var o=a[i];n+=o}return n};return r}();e.PerformanceMonitor=r})(t=e.Utils||(e.Utils={}))})(t=e.Core||(e.Core={}))})(p||(p={}));/* 377 * Copyright (c) 2016 - now David Sehnal, licensed under Apache 2.0, See LICENSE file for more info. 378 */ 379var p;(function(e){var t;(function(e){var t;(function(e){"use strict";var t;(function(e){function t(e){return e.name&&e.parse}e.is=t;function r(e,t){t=t.toLowerCase().trim();for(var r=0,n=e;r<n.length;r++){var i=n[r];for(var a=0,o=i.shortcuts;a<o.length;a++){var s=o[a];if(s.toLowerCase()===t)return i}}return void 0}e.fromShortcut=r;function n(e){return new RegExp(e.extensions.map(function(e){return"(\\"+e+")"}).join("|")+"(\\.gz){0,1}$","i")}e.formatRegExp=n;function i(e){return e.map(function(e){return e.extensions.map(function(e){return e+","+e+".gz"}).join(",")}).join(",")}e.formatFileFilters=i;function a(e,t){for(var r=0,i=t;r<i.length;r++){var a=i[r];if(n(a).test(e))return a}return void 0}e.getFormat=a})(t=e.FormatInfo||(e.FormatInfo={}));var r;(function(e){function t(e,t){if(t===void 0){t=-1}return new n(e,t)}e.error=t;function r(e,t){if(t===void 0){t=[]}return new i(e,t)}e.success=r})(r=e.ParserResult||(e.ParserResult={}));var n=function(){function e(e,t){this.message=e;this.line=t;this.isError=true}e.prototype.toString=function(){if(this.line>=0){return"[Line "+this.line+"] "+this.message}return this.message};return e}();e.ParserError=n;var i=function(){function e(e,t){this.result=e;this.warnings=t;this.isError=false}return e}();e.ParserSuccess=i;var a;(function(e){function t(e){var t=new Int32Array(Math.round(1.61*e.tokens.length));t.set(e.tokens);e.tokens=t;e.tokensLenMinus2=t.length-2}function r(e,r,n){if(e.count>=e.tokensLenMinus2){t(e)}e.tokens[e.count++]=r;e.tokens[e.count++]=n}e.addToken=r;function n(e){return{tokensLenMinus2:Math.round(e)-2,count:0,tokens:new Int32Array(e)}}e.create=n})(a=e.TokenIndexBuilder||(e.TokenIndexBuilder={}));var o;(function(e){function t(){return Object.create(null)}e.create=t;function r(e,t){if(t.length>6)return t;var r=e[t];if(r!==void 0)return r;e[t]=t;return t}e.get=r})(o=e.ShortStringPool||(e.ShortStringPool={}))})(t=e.Formats||(e.Formats={}))})(t=e.Core||(e.Core={}))})(p||(p={}));/* 380 * Copyright (c) 2016 - now David Sehnal, licensed under Apache 2.0, See LICENSE file for more info. 381 */ 382var p;(function(e){var t;(function(e){var t;(function(t){var r;(function(t){var r;(function(t){"use strict";var r;(function(e){e.ElementSymbol="X";e.ResidueName="UNK";e.AsymId="";e.EntityId="1";e.ModelId="1"})(r||(r={}));function n(t,r,n,i){var a=e.Geometry.LinearAlgebra.Matrix4.identity(),o,s;for(o=1;o<=3;o++){for(s=1;s<=3;s++){e.Geometry.LinearAlgebra.Matrix4.setValue(a,o-1,s-1,t.getColumn(r+"["+o+"]["+s+"]").getFloat(i))}e.Geometry.LinearAlgebra.Matrix4.setValue(a,o-1,3,t.getColumn(n+"["+o+"]").getFloat(i))}return a}function i(e,t,r){var n=0;if(!r||!r.isDefined)return t;for(n=e+1;n<t;n++){if(!r.areValuesEqual(n-1,n))break}return n}var a=["id","Cartn_x","Cartn_y","Cartn_z","label_atom_id","type_symbol","occupancy","B_iso_or_equiv","auth_atom_id","label_alt_id","label_comp_id","label_seq_id","label_asym_id","auth_comp_id","auth_seq_id","auth_asym_id","group_PDB","label_entity_id","pdbx_PDB_ins_code","pdbx_PDB_model_num"];function o(t){var r=e.Utils.FastMap.create();for(var n=0,i=a;n<i.length;n++){var o=i[n];r.set(o,t.getColumn(o))}return r}function s(t,n,a){var o=i(t,n,a.get("pdbx_PDB_model_num"));var s=e.Utils.DataTable.ofDefinition(e.Structure.Tables.Atoms,o-t),u=e.Utils.DataTable.ofDefinition(e.Structure.Tables.Positions,o-t),l=u.x,c=a.get("Cartn_x"),f=u.y,h=a.get("Cartn_y"),d=u.z,p=a.get("Cartn_z"),m=s.id,v=a.get("id"),y=s.altLoc,g=a.get("label_alt_id"),b=s.rowIndex,x=s.residueIndex,_=s.chainIndex,w=s.entity
382Index,C=s.name,E=a.get("label_atom_id"),S=s.elementSymbol,T=a.get("type_symbol"),M=s.occupancy,A=a.get("occupancy"),P=s.tempFactor,R=a.get("B_iso_or_equiv"),k=s.authName,I=a.get("auth_atom_id");var D=a.get("label_asym_id"),B=a.get("label_entity_id"),L=a.get("pdbx_PDB_ins_code"),F=a.get("auth_seq_id"),V=a.get("pdbx_PDB_model_num"),O=0,U=0,N=0;var z=t;for(var H=t;H<o;H++){var j=H-t;m[j]=v.getInteger(H);l[j]=c.getFloat(H);f[j]=h.getFloat(H);d[j]=p.getFloat(H);S[j]=T.getString(H)||r.ElementSymbol;C[j]=E.getString(H)||S[j];k[j]=I.getString(H)||C[j];y[j]=g.getString(H);M[j]=A.getFloat(H);P[j]=R.getFloat(H);var G=false;var W=!F.areValuesEqual(z,H)||!L.areValuesEqual(z,H);if(!D.areValuesEqual(z,H)){G=true;W=true}if(!B.areValuesEqual(z,H)){N++;G=true;W=true}if(W)U++;if(G)O++;b[j]=H;x[j]=U;_[j]=O;w[j]=N;z=H}var q=!V.isDefined?r.ModelId:V.getString(t)||r.ModelId;return{atoms:s,positions:u,modelId:q,endRow:o}}function u(t,n){var i=n.count,a=n.residueIndex,o=n.chainIndex,s=n.entityIndex;var u=e.Utils.DataTable.ofDefinition(e.Structure.Tables.Residues,n.residueIndex[n.count-1]+1),l=e.Utils.DataTable.ofDefinition(e.Structure.Tables.Chains,n.chainIndex[n.count-1]+1),c=e.Utils.DataTable.ofDefinition(e.Structure.Tables.Entities,n.entityIndex[n.count-1]+1);var f=u.name,h=u.seqNumber,d=u.asymId,p=u.authName,m=u.authSeqNumber,v=u.authAsymId,y=u.insCode,g=u.entityId,b=u.isHet,x=u.atomStartIndex,_=u.atomEndIndex,w=u.chainIndex,C=u.entityIndex;var E=l.asymId,S=l.entityId,T=l.authAsymId,M=l.atomStartIndex,A=l.atomEndIndex,P=l.residueStartIndex,R=l.residueEndIndex,k=l.entityIndex;var I=c.entityId,D=c.type,B=c.atomStartIndex,L=c.atomEndIndex,F=c.residueStartIndex,V=c.residueEndIndex,O=c.chainStartIndex,U=c.chainEndIndex;var N=t.get("label_comp_id"),z=t.get("label_seq_id"),H=t.get("label_asym_id"),j=t.get("auth_comp_id"),G=t.get("auth_seq_id"),W=t.get("auth_asym_id"),q=t.get("group_PDB"),X=t.get("label_entity_id"),Y=t.get("pdbx_PDB_ins_code");var K=0,Q=0,Z=0,J=0,$=0,ee=0,te=0,re=0,ne=0;var ie=0;for(ie=0;ie<i;ie++){if(a[ie]!==a[K]){f[te]=N.getString(K)||r.ResidueName;h[te]=z.getInteger(K);d[te]=H.getString(K)||r.AsymId;p[te]=j.getString(K)||f[te];m[te]=G.getInteger(K);v[te]=W.getString(K)||d[te];y[te]=Y.getString(K);g[te]=X.getString(K)||r.EntityId;b[te]=q.stringEquals(K,"HETATM")?1:0;x[te]=K;_[te]=ie;w[te]=re;C[te]=ne;te++;K=ie}if(o[ie]!==o[Q]){E[re]=H.getString(Q)||r.AsymId;T[re]=W.getString(Q)||E[re];S[re]=X.getString(Q)||r.EntityId;P[re]=ee;R[re]=te;M[re]=Q;A[re]=ie;k[re]=ne;re++;Q=ie;ee=te}if(s[ie]!==s[Z]){I[ne]=X.getString(Z)||r.EntityId;D[ne]="unknown";B[ne]=Z;L[ne]=ie;F[ne]=$;V[ne]=te;O[ne]=J;U[ne]=re;ne++;Z=ie;J=re;$=te}}I[ne]=X.getString(Z)||r.EntityId;D[ne]="unknown";B[ne]=Z;L[ne]=ie;F[ne]=$;V[ne]=te+1;O[ne]=J;U[ne]=re+1;E[re]=H.getString(Q)||r.AsymId;T[re]=W.getString(Q)||E[re];S[re]=X.getString(Q)||r.EntityId;P[re]=ee;R[re]=te+1;M[re]=Q;A[re]=ie;k[re]=ne;f[te]=N.getString(K)||r.ResidueName;h[te]=z.getInteger(K);d[te]=H.getString(K)||r.AsymId;p[te]=j.getString(K)||f[te];m[te]=G.getInteger(K);v[te]=W.getString(K)||d[te];y[te]=Y.getString(K);x[te]=K;_[te]=ie;w[te]=re;C[te]=ne;b[te]=q.stringEquals(K,"HETATM")?1:0;return{residues:u,chains:l,entities:c}}function l(e,t){var n;if(!e){return}var i={},a=e.getColumn("type"),o=e.getColumn("id");for(n=0;n<e.rowCount;n++){var s=(a.getString(n)||"").toLowerCase();var u=o.getString(n)||r.EntityId;switch(s){case"polymer":case"non-polymer":case"water":i[u]=s;break;default:i[u]="unknown";break}}for(n=0;n<t.count;n++){var l=i[t.entityId[n]];if(l!==void 0){t.type[n]=l}}}function c(t,n,i,a){return new e.Structure.PolyResidueIdentifier(n.getString(t)||r.AsymId,i.getInteger(t),a.getString(t))}var f={ALA:true,ARG:true,ASP:true,CYS:true,GLN:true,GLU:true,GLY:true,HIS:true,ILE:true,LEU:true,LYS:true,MET:true,PHE:true,PRO:true,SER:true,THR:true,TRP:true,TYR:true,VAL:true,ASN:true,PYL:true,SEC:true};function h(e,t,r,n){if(r.type[t.entityIndex[n]]!=="polymer")return false;var i=false,a=false,o=e.name,s=0;for(var u=t.atomStartIndex[n],l=t.atomEndIndex[n];u<l;u++){var c=o[u];if(!i&&c==="CA"){i=true;s++}else if(!a&&c==="O"){a=true;s++}if(s===2)break}return i&&a||i&&!t.isHet[n]}function d(e,t,r,n){if(f[t.name[n]]||r.type[t.entityIndex[n]]!=="pol
382ymer")return false;var i=e.name,a=0;var o=t.atomStartIndex[n],s=t.atomEndIndex[n];if(s-o===1&&!t.isHet[o]&&i[o]==="P"){return true}for(var u=o;u<s;u++){var l=i[u];if(l==="O5'"||l==="C3'"||l==="N3"||l==="P"){a++}if(a>=3){return true}}return false}function p(t,r,n,i,a,o){var s=r.asymId,u=r.entityIndex,l=0,c=i,f=i,p=a;while(c<p){if(d(t,r,n,c)){f=c+1;while(f<p&&s[c]===s[f]&&u[c]===u[f]&&d(t,r,n,f)){f++}l=5}else if(h(t,r,n,c)){f=c+1;while(f<p&&s[c]===s[f]&&u[c]===u[f]&&h(t,r,n,f)){f++}l=4}else{f=c+1;while(f<p&&s[c]===s[f]&&u[c]===u[f]&&!d(t,r,n,f)&&!h(t,r,n,f)){f++}l=0}var m=new e.Structure.SecondaryStructureElement(l,new e.Structure.PolyResidueIdentifier(r.asymId[c],r.seqNumber[c],r.insCode[c]),new e.Structure.PolyResidueIdentifier(r.asymId[f-1],r.seqNumber[f-1],r.insCode[f-1]));m.startResidueIndex=c;m.endResidueIndex=f;o[o.length]=m;c=f}}function m(t,r){var n=[];var i=t.authSeqNumber;for(var a=0,o=r;a<o.length;a++){var s=o[a];var u=s.startResidueIndex;var l=s.endResidueIndex-1;for(var c=s.startResidueIndex;c<l;c++){if(i[c+1]-i[c]===1)continue;var f=new e.Structure.SecondaryStructureElement(s.type,s.startResidueId,s.endResidueId,s.info);f.startResidueIndex=u;f.endResidueIndex=c+1;n[n.length]=f;u=c+1}if(u===s.startResidueIndex){n[n.length]=s}else{var f=new e.Structure.SecondaryStructureElement(s.type,s.startResidueId,s.endResidueId,s.info);f.startResidueIndex=u;f.endResidueIndex=s.endResidueIndex;n[n.length]=f}}return n}function v(t,r){var n=r.residues,i=n.count,a=n.asymId,o=n.seqNumber,s=n.insCode,u=void 0,l="",c=e.Utils.FastMap.create(),f=e.Utils.FastMap.create();for(var h=0,d=t;h<d.length;h++){var p=d[h];l=p.startResidueId.asymId+" "+p.startResidueId.seqNumber;if(p.startResidueId.insCode)l+=" "+p.startResidueId.insCode;c.set(l,p);l=p.endResidueId.asymId+" "+p.endResidueId.seqNumber;if(p.endResidueId.insCode)l+=" "+p.endResidueId.insCode;f.set(l,p)}for(var m=0;m<i;m++){l=a[m]+" "+o[m];if(s[m])l+=" "+s[m];u=c.get(l);if(u){u.startResidueIndex=m;u.endResidueIndex=m+1}u=f.get(l);if(u){if(u.startResidueIndex<0)u.startResidueIndex=m;u.endResidueIndex=m+1}}if(u){u.endResidueIndex=i}var v=[];for(var g=0,b=t;g<b.length;g++){var p=b[g];if(p.startResidueIndex<0||p.endResidueIndex<0)continue;if(p.type===3&&p.length<3)continue;if(p.endResidueIndex>=0&&p.startResidueIndex>=0)v[v.length]=p}v.sort(function(e,t){return e.startResidueIndex-t.startResidueIndex});for(var m=0;m<v.length-1;m++){if(v[m+1].startResidueIndex-v[m].endResidueIndex===-1){v[m+1].startResidueIndex++}}if(!v.length)return v;var x=[v[0]];for(var m=1;m<v.length;m++){var _=x[x.length-1],w=v[m];if(w.startResidueIndex<_.endResidueIndex){y(_,w)}else{x[x.length]=w}}return x}function y(e,t){if(t.endResidueIndex>e.endResidueIndex){e.endResidueIndex=t.endResidueIndex}}function g(t,r,n){var i=[],a=[];var o=t.getCategory("_struct_conf"),s=t.getCategory("_struct_sheet_range"),u;if(o){var l=o.getColumn("conf_type_id");if(l){var f=o.getColumn("beg_label_asym_id");var h=o.getColumn("beg_label_seq_id");var d=o.getColumn("pdbx_beg_PDB_ins_code");var y=o.getColumn("end_label_asym_id");var g=o.getColumn("end_label_seq_id");var b=o.getColumn("pdbx_end_PDB_ins_code");var x=o.getColumn("pdbx_PDB_helix_class");for(u=0;u<o.rowCount;u++){var _=void 0;switch((l.getString(u)||"").toUpperCase()){case"HELX_P":_=1;break;case"TURN_P":_=2;break}if(!_)continue;i[i.length]=new e.Structure.SecondaryStructureElement(_,c(u,f,h,d),c(u,y,g,b),{helixClass:x.getString(u)})}}}if(s){var f=s.getColumn("beg_label_asym_id");var h=s.getColumn("beg_label_seq_id");var d=s.getColumn("pdbx_beg_PDB_ins_code");var y=s.getColumn("end_label_asym_id");var g=s.getColumn("end_label_seq_id");var b=s.getColumn("pdbx_end_PDB_ins_code");var w=s.getColumn("symmetry");var C=s.getColumn("sheet_id");var E=s.getColumn("id");for(u=0;u<s.rowCount;u++){i[i.length]=new e.Structure.SecondaryStructureElement(3,c(u,f,h,d),c(u,y,g,b),{symmetry:w.getString(u),sheetId:C.getString(u),id:E.getString(u)})}}var S=i.length>0?v(i,n):[];var T=n.residues,M=T.count;if(S.length===0){p(r,T,n.entities,0,M,a);return m(T,a)}var A=S.length-1;if(S[0].startResidueIndex>0){p(r,T,n.entities,0,S[0].startResidueIndex,a)}for(u=0;
382u<A;u++){a[a.length]=S[u];if(S[u+1].startResidueIndex-S[u].endResidueIndex>0){p(r,T,n.entities,S[u].endResidueIndex,S[u+1].startResidueIndex,a)}}a[a.length]=S[A];if(S[A].endResidueIndex<M){p(r,T,n.entities,S[A].endResidueIndex,M,a)}return m(T,a)}function b(e,t){var r=e.secondaryStructureIndex;var n=0;for(var i=0,a=t;i<a.length;i++){var o=a[i];for(var s=o.startResidueIndex;s<o.endResidueIndex;s++){r[s]=n}n++}return r}function x(e,t,r,n){var i=e.chains,a=i.asymId,o=i.residueStartIndex,s=i.residueEndIndex,u=i.count;var l=e.residues,c=l.seqNumber,f=l.insCode;for(var h=0;h<u;h++){if(a[h]!==t)continue;for(var d=o[h],p=s[h];d<p;d++){if(c[d]===r&&f[d]===n)return d}}return-1}function _(e,t,r,n,i){var a=t.residues,o=a.atomStartIndex,s=a.atomEndIndex;var u=e.name,l=e.altLoc;for(var c=o[r],f=s[r];c<=f;c++){if(u[c]===n&&l[c]===i)return c}return-1}function w(t){var r=t.getCategory("_pdbx_struct_mod_residue");if(!r)return void 0;var n=e.Utils.DataTable.ofDefinition(e.Structure.Tables.ModifiedResidues,r.rowCount);var i=r.getColumn("label_asym_id");var a=r.getColumn("label_seq_id");var o=r.getColumn("PDB_ins_code");var s=r.getColumn("parent_comp_id");var u=r.getColumn("details");var l=n.asymId,c=n.seqNumber,f=n.insCode,h=n.parent,d=n.details;for(var p=0,m=r.rowCount;p<m;p++){l[p]=i.getString(p);c[p]=a.getInteger(p);f[p]=o.getString(p);h[p]=s.getString(p);d[p]=u.getString(p)}return n}function C(t,r,n){var i=t.getCategory("_struct_conn");if(!i)return void 0;var a=function(e){return{label_asym_id:i.getColumn("ptnr"+e+"_label_asym_id"),label_seq_id:i.getColumn("ptnr"+e+"_label_seq_id"),label_atom_id:i.getColumn("ptnr"+e+"_label_atom_id"),label_alt_id:i.getColumn("pdbx_ptnr"+e+"_label_alt_id"),ins_code:i.getColumn("pdbx_ptnr"+e+"_PDB_ins_code"),symmetry:i.getColumn("ptnr"+e+"_symmetry")}};var o=i.getColumn("conn_type_id");var s=i.getColumn("pdbx_dist_value");var u=i.getColumn("pdbx_value_order");var l=a(1);var c=a(2);var f=a(3);var h=function(e,t){if(t.label_asym_id.getValuePresence(e)!==0)return void 0;var i=x(n,t.label_asym_id.getString(e),t.label_seq_id.getInteger(e),t.ins_code.getString(e));if(i<0)return void 0;var a=_(r,n,i,t.label_atom_id.getString(e),t.label_alt_id.getString(e));if(a<0)return void 0;return{residueIndex:i,atomIndex:a,symmetry:t.symmetry.getString(e)||"1_555"}};var d=function(e){var t=[];var r=h(e,l);if(r)t.push(r);r=h(e,c);if(r)t.push(r);r=h(e,f);if(r)t.push(r);return t};var p=[];for(var m=0;m<i.rowCount;m++){var v=d(m);if(v.length<2)continue;var y=o.getString(m);var g=(u.getString(m)||"").toLowerCase();var b=0;switch(g){case"sing":b=1;break;case"doub":b=2;break;case"trip":b=3;break;case"quad":b=4;break}switch(y){case"disulf":b=5;break;case"hydrog":b=8;break;case"metalc":b=6;break;case"saltbr":b=7;break}p.push({bondType:b,distance:s.getFloat(m),partners:v})}return new e.Structure.StructConn(p)}function E(e){var t=/\(?([^\(\)]+)\)?]*/g,r,n=[],i=[];while(r=t.exec(e))n[n.length]=r[1];n.forEach(function(e){var t=[];e.split(",").forEach(function(e){var r=e.indexOf("-");if(r>0){var n=parseInt(e.substring(0,r)),i=parseInt(e.substr(r+1));for(var a=n;a<=i;a++)t[t.length]=a.toString()}else{t[t.length]=e.trim()}});i[i.length]=t});return i}function S(t){var r=t.getCategory("_pdbx_struct_assembly"),i=t.getCategory("_pdbx_struct_assembly_gen"),a=t.getCategory("_pdbx_struct_oper_list");if(!r||!i||!a){return void 0}var o,s={},u=[],l=e.Utils.FastMap.create();var c=i.getColumn("assembly_id");var f=i.getColumn("oper_expression");var h=i.getColumn("asym_id_list");for(o=0;o<i.rowCount;o++){var d=c.getString(o);if(!d){return void 0}var p=l.get(d);if(!p){p=new e.Structure.AssemblyGen(d);l.set(d,p);u.push(p)}p.gens.push(new e.Structure.AssemblyGenEntry(E(f.getString(o)),h.getString(o).split(",")))}var m=a.getColumn("id");var v=a.getColumn("name");for(o=0;o<a.rowCount;o++){var y=n(a,"matrix","vector",o);if(!y){return void 0}var g=new e.Structure.AssemblyOperator(m.getString(o),v.getString(o),y);s[g.id]=g}return new e.Structure.AssemblyInfo(s,u)}function T(t){var r=t.getCategory("_cell"),i=t.getCategory("_symmetry"),a=t.getCategory("_atom_sites");var o="",s=[1,1,1],u=[90,90,90],l=e.Geometry.LinearAlgebra.Matrix4.identity(),c=false;if(!r||!i){return void 0}o=i.getColumn("space_group_name_H-M").getString(0);s=[r.getColumn("length_a").getFloat(0),r.getColumn("length_b").getFloat(0),r.getColumn("length_c").getFloat(0)];u=[r.getColumn("angle_alpha").getFloat(0),r.getColumn("angle_beta").getFloat(0),r.getColumn("angle_gamma").getFloat(0)];if(!o||s.every(function(e){return isNaN(e)||e===0})||s.every(function(e){return isNaN(e)||e===0})){return void 0}var f=function(e){return e*e};var h=function(e){return e*Math.PI/180};
382var d=s[0],p=s[1],m=s[2],v=h(u[0]),y=h(u[1]),g=h(u[2]),b=d*p*m*Math.sqrt(1-f(Math.cos(v))-f(Math.cos(y))-f(Math.cos(g))+2*Math.cos(v)*Math.cos(y)*Math.cos(g));var x=e.Geometry.LinearAlgebra.Matrix4.ofRows([[d,p*Math.cos(g),m*Math.cos(y),0],[0,p*Math.sin(g),m*(Math.cos(v)-Math.cos(y)*Math.cos(g))/Math.sin(g),0],[0,0,b/(d*p*Math.sin(g)),0],[0,0,0,1]]);var _=e.Geometry.LinearAlgebra.Matrix4.identity();e.Geometry.LinearAlgebra.Matrix4.invert(_,x);if(a){var w=n(a,"fract_transf_matrix","fract_transf_vector",0);if(w){l=w;if(!e.Geometry.LinearAlgebra.Matrix4.areEqual(_,w,1e-4)){c=true}}}else{l=_}return new e.Structure.SymmetryInfo(o,s,u,l,c)}function M(t){if(!t||!t.rowCount)return void 0;var r=new e.Structure.ComponentBondInfo;var n=t.getColumn("comp_id"),i=t.getColumn("atom_id_1"),a=t.getColumn("atom_id_2"),o=t.getColumn("value_order"),s=t.rowCount;var u=r.newEntry(n.getString(0));for(var l=0;l<s;l++){var c=n.getString(l),f=i.getString(l),h=a.getString(l),d=o.getString(l);if(u.id!==c){u=r.newEntry(c)}var p=void 0;switch(d.toLowerCase()){case"sing":p=1;break;case"doub":case"delo":p=2;break;case"trip":p=3;break;case"quad":p=4;break;default:p=0;break}u.add(f,h,p)}return r}function A(t,r,n){var i=s(t,r.getCategory("_atom_site").rowCount,n),a=i.atoms,o=i.positions,c=i.modelId,f=i.endRow,h=u(n,a),d=r.getCategory("_entry"),p;if(d&&d.getColumn("id").isDefined)p=d.getColumn("id").getString(0);else p=r.header;l(r.getCategory("_entity"),h.entities);var m=g(r,a,h);b(h.residues,m);return{model:e.Structure.Molecule.Model.create({id:p,modelId:c,data:{atoms:a,residues:h.residues,chains:h.chains,entities:h.entities,bonds:{structConn:C(r,a,h),component:M(r.getCategory("_chem_comp_bond"))},modifiedResidues:w(r),secondaryStructure:m,symmetryInfo:T(r),assemblyInfo:S(r)},positions:o,source:e.Structure.Molecule.Model.Source.File}),endRow:f}}function P(t){var r=[],n=t.getCategory("_atom_site"),i=0;if(!n){throw"'_atom_site' category is missing in the input."}var a=t.getCategory("_entry"),s=o(n),u;if(a&&a.getColumn("id").isDefined)u=a.getColumn("id").getString(0);else u=t.header;while(i<n.rowCount){var l=A(i,t,s),c=l.model,f=l.endRow;r.push(c);i=f}var h=void 0;var d=t.getCategory("_exptl");if(d){h=[];var p=d.getColumn("method");for(var m=0;m<d.rowCount;m++){if(p.getValuePresence(m)!==0)continue;h.push(p.getString(m))}}return e.Structure.Molecule.create(u,r,{experimentMethods:h})}t.ofDataBlock=P})(r=t.mmCIF||(t.mmCIF={}))})(r=t.Molecule||(t.Molecule={}))})(t=e.Formats||(e.Formats={}))})(t=e.Core||(e.Core={}))})(p||(p={}));/* 383 * Copyright (c) 2016 - now David Sehnal, licensed under Apache 2.0, See LICENSE file for more info. 384 */ 385var p;(function(e){var t;(function(e){var t;(function(t){var r;(function(r){var n;(function(r){"use strict";var n=function(){function e(e,t,r,n){this.header=e;this.crystInfo=t;this.models=r;this.data=n}e.prototype.makeEntities=function(){var e=["data_ent","loop_","_entity.id","_entity.type","_entity.src_method","_entity.pdbx_description","_entity.formula_weight","_entity.pdbx_number_of_molecules","_entity.details","_entity.pdbx_mutation","_entity.pdbx_fragment","_entity.pdbx_ec","1 polymer man polymer 0.0 0 ? ? ? ?","2 non-polymer syn non-polymer 0.0 0 ? ? ? ?","3 water nat water 0.0 0 ? ? ? ?"].join("\n");var r=t.CIF.Text.parse(e);if(r.isError){throw r.toString()}return r.result.dataBlocks[0].getCategory("_entity")};e.prototype.toCifFile=function(){var e={dot:r.Parser.getDotRange(this.data.length),question:r.Parser.getQuestionmarkRange(this.data.length),numberTokens:r.Parser.getNumberRanges(this.data.length),data:this.data};var n=new t.CIF.Text.File(this.data);var i=new t.CIF.Text.DataBlock(this.data,this.header.id);n.dataBlocks.push(i);i.addCategory(this.makeEntities());if(this.crystInfo){var a=this.crystInfo.toCifCategory(this.header.id),o=a.cell,s=a.symm;i.addCategory(o);i.addCategory(s)}i.addCategory(this.models.toCifCategory(i,e));return n};return e}();r.MoleculeData=n;var i=function(){function e(e){this.id=e}return e}();r.Header=i;var a=function(){function e(e){this.record=e}e.prototype.getValue=function(e,t){var r=this.record.substr(6,9).trim();if(!r.length)return".";return r};e.prototype.toCifCategory=function(e){var r=["_cell.entry_id '"+e+"'","_cell.length_a "+this.getValue(6,9),"_
385cell.length_b "+this.getValue(15,9),"_cell.length_c "+this.getValue(24,9),"_cell.angle_alpha "+this.getValue(33,7),"_cell.angle_beta "+this.getValue(40,7),"_cell.angle_gamma "+this.getValue(48,7),"_cell.Z_PDB "+this.getValue(66,4),"_cell.pdbx_unique_axis ?","_symmetry.entry_id '"+e+"'","_symmetry.space_group_name_H-M '"+this.getValue(55,11)+"'","_symmetry.pdbx_full_space_group_name_H-M ?","_symmetry.cell_setting ?","_symmetry.Int_Tables_number ?","_symmetry.space_group_name_Hall ?"].join("\n");var n=t.CIF.Text.parse(r);if(n.isError){throw new Error(n.toString())}return{cell:n.result.dataBlocks[0].getCategory("_cell"),symm:n.result.dataBlocks[0].getCategory("_symmetry")}};return e}();r.CrystStructureInfo=a;var o=function(){function e(e,t){this.helixTokens=e;this.sheetTokens=t}e.prototype.toCifCategory=function(e){return void 0};return e}();r.SecondaryStructure=o;var s=function(){function t(e,t,r){this.idToken=e;this.atomTokens=t;this.atomCount=r}t.prototype.writeToken=function(t,r){e.Utils.ArrayBuilder.add2(r,this.atomTokens[2*t],this.atomTokens[2*t+1])};t.prototype.writeTokenCond=function(t,r,n){var i=this.atomTokens[2*t];var a=this.atomTokens[2*t+1];if(i===a)e.Utils.ArrayBuilder.add2(r,n.start,n.end);else e.Utils.ArrayBuilder.add2(r,i,a)};t.prototype.writeRange=function(t,r){e.Utils.ArrayBuilder.add2(r,t.start,t.end)};t.prototype.tokenEquals=function(e,t,r,n){var i=r.length;if(i!==t-e)return false;for(var a=r.length-1;a>=0;a--){if(n.charCodeAt(a+e)!==r.charCodeAt(a)){return false}}return true};t.prototype.getEntityType=function(e,t){var r=e*14;if(this.tokenEquals(this.atomTokens[2*r],this.atomTokens[2*r+1],"HETATM",t)){var n=this.atomTokens[2*(r+4)],i=this.atomTokens[2*(r+4)+1];if(this.tokenEquals(n,i,"HOH",t)||this.tokenEquals(n,i,"WTR",t)||this.tokenEquals(n,i,"SOL",t)){return 3}return 2}else{return 1}};t.prototype.writeCifTokens=function(e,t,r){var n={RECORD:0,SERIAL:1,ATOM_NAME:2,ALT_LOC:3,RES_NAME:4,CHAIN_ID:5,RES_SEQN:6,INS_CODE:7,X:8,Y:9,Z:10,OCCUPANCY:11,TEMP_FACTOR:12,ELEMENT:13};var i=14;for(var a=0;a<this.atomCount;a++){var o=a*i;this.writeToken(o+n.RECORD,t);this.writeToken(o+n.SERIAL,t);this.writeToken(o+n.ELEMENT,t);this.writeToken(o+n.ATOM_NAME,t);this.writeTokenCond(o+n.ALT_LOC,t,r.dot);this.writeToken(o+n.RES_NAME,t);this.writeToken(o+n.CHAIN_ID,t);this.writeRange(r.numberTokens.get(this.getEntityType(a,r.data)),t);this.writeToken(o+n.RES_SEQN,t);this.writeTokenCond(o+n.INS_CODE,t,r.dot);this.writeToken(o+n.X,t);this.writeToken(o+n.Y,t);this.writeToken(o+n.Z,t);this.writeToken(o+n.OCCUPANCY,t);this.writeToken(o+n.TEMP_FACTOR,t);this.writeRange(r.question,t);this.writeRange(r.question,t);this.writeRange(r.question,t);this.writeRange(r.question,t);this.writeRange(r.question,t);this.writeRange(r.question,t);this.writeToken(o+n.RES_SEQN,t);this.writeToken(o+n.RES_NAME,t);this.writeToken(o+n.CHAIN_ID,t);this.writeToken(o+n.ATOM_NAME,t);this.writeRange(e,t)}};t.COLUMNS=["_atom_site.group_PDB","_atom_site.id","_atom_site.type_symbol","_atom_site.label_atom_id","_atom_site.label_alt_id","_atom_site.label_comp_id","_atom_site.label_asym_id","_atom_site.label_entity_id","_atom_site.label_seq_id","_atom_site.pdbx_PDB_ins_code","_atom_site.Cartn_x","_atom_site.Cartn_y","_atom_site.Cartn_z","_atom_site.occupancy","_atom_site.B_iso_or_equiv","_atom_site.Cartn_x_esd","_atom_site.Cartn_y_esd","_atom_site.Cartn_z_esd","_atom_site.occupancy_esd","_atom_site.B_iso_or_equiv_esd","_atom_site.pdbx_formal_charge","_atom_site.auth_seq_id","_atom_site.auth_comp_id","_atom_site.auth_asym_id","_atom_site.auth_atom_id","_atom_site.pdbx_PDB_model_num"];return t}();r.ModelData=s;var u=function(){function r(e){this.models=e}r.prototype.toCifCategory=function(r,n){var i=0;for(var a=0,o=this.models;a<o.length;a++){var u=o[a];i+=u.atomCount}var l=26;var c=e.Utils.ArrayBuilder.forTokenIndices(i*l);for(var f=0,h=this.models;f<h.length;f++){var u=h[f];u.writeCifTokens(u.idToken,c,n)}return new t.CIF.Text.Category(r.data,"_atom_site",0,0,s.COLUMNS,c.array,i*l)};return r}();r.ModelsData=u})(n=r.PDB||(r.PDB={}))})(r=t.Molecule||(t.Molecule={}))})(t=e.Formats||(e.Formats={}))})(t=e.Core||(e.Core={}))})(p||(p={}));/* 386 * Copyright (c) 2016 - now David Sehnal, licensed under Apache 2.0, See LICENSE file for more info. 387 */ 388var p;(function(e){var t;(function(e){var t;(function(t){var r;(function(r){var n;(function(r){"use strict";var n=function(){function e(e){this.data=e;this.trimmedToken={start:0,end:0};this.line=0;this.position=0;this.length=e.length}e.prototype.moveToNextLine=function(){while(this.position<this.length&&this.data.charCodeAt(this.position)!==10){this.position++}this.position++;this.line++;return this.position};e.prototype.moveToEndOfLine=function(){while(this.position<this.length){var e=this.data.charCodeAt(this.position);if(e===10||e===13){return this.position}this.position++}return this.position};e.prototype.startsWith=function(e,t){for(var r=t.length-1;r>=0;r--){if(this.data.charCodeAt(r+e)!==t.charCodeAt(r)){return false}}return true};e.prototype.trim=function(e,t){while(e<t&&this.data.charCodeAt(e)===32)e++;while(t>e&&this.data.charCodeAt(t-1)===32)t--;this.trimmedToken.start=e;this.trimmedToken.end=t};e.prototype.tokenizeAtomRecord=function(e){var r=this.position;var n=this.position;var i=this.moveToEndOfLine();var a=i-n;if(a<60)return false;this.trim(n,n+6);t.TokenIndexBuilder.addToken(e,this.trimmedToken.start,this.trimmedToken.end);n=r+6;
388this.trim(n,n+5);t.TokenIndexBuilder.addToken(e,this.trimmedToken.start,this.trimmedToken.end);n=r+12;this.trim(n,n+4);t.TokenIndexBuilder.addToken(e,this.trimmedToken.start,this.trimmedToken.end);if(this.data.charCodeAt(r+16)===32){t.TokenIndexBuilder.addToken(e,0,0)}else{t.TokenIndexBuilder.addToken(e,r+16,r+17)}n=r+17;this.trim(n,n+3);t.TokenIndexBuilder.addToken(e,this.trimmedToken.start,this.trimmedToken.end);t.TokenIndexBuilder.addToken(e,r+21,r+22);n=r+22;this.trim(n,n+4);t.TokenIndexBuilder.addToken(e,this.trimmedToken.start,this.trimmedToken.end);if(this.data.charCodeAt(r+26)===32){t.TokenIndexBuilder.addToken(e,0,0)}else{t.TokenIndexBuilder.addToken(e,r+26,r+27)}n=r+30;this.trim(n,n+8);t.TokenIndexBuilder.addToken(e,this.trimmedToken.start,this.trimmedToken.end);n=r+38;this.trim(n,n+8);t.TokenIndexBuilder.addToken(e,this.trimmedToken.start,this.trimmedToken.end);n=r+46;this.trim(n,n+8);t.TokenIndexBuilder.addToken(e,this.trimmedToken.start,this.trimmedToken.end);n=r+54;this.trim(n,n+6);t.TokenIndexBuilder.addToken(e,this.trimmedToken.start,this.trimmedToken.end);if(a>=66){n=r+60;this.trim(n,n+6);t.TokenIndexBuilder.addToken(e,this.trimmedToken.start,this.trimmedToken.end)}else{t.TokenIndexBuilder.addToken(e,0,0)}if(a>=78){n=r+76;this.trim(n,n+2);if(this.trimmedToken.start<this.trimmedToken.end){t.TokenIndexBuilder.addToken(e,this.trimmedToken.start,this.trimmedToken.end)}else{t.TokenIndexBuilder.addToken(e,r+12,r+13)}}else{t.TokenIndexBuilder.addToken(e,r+12,r+13)}return true};return e}();var i=function(){function i(){}i.tokenizeAtom=function(e,r){if(r.tokenizeAtomRecord(e)){return void 0}return new t.ParserError("Invalid ATOM/HETATM record.",r.line)};i.tokenize=function(e,a){var o=new n(a);var s=a.length;var u=t.TokenIndexBuilder.create(4096);var l=0;var c=[];var f=void 0;var h={start:0,end:0};while(o.position<s){var d=true;switch(a.charCodeAt(o.position)){case 65:if(o.startsWith(o.position,"ATOM")){if(!u){u=t.TokenIndexBuilder.create(4096)}var p=i.tokenizeAtom(u,o);l++;if(p)return p}break;case 67:if(o.startsWith(o.position,"CRYST1")){var m=o.position;var v=o.moveToEndOfLine();f=new r.CrystStructureInfo(a.substring(m,v))}break;case 69:if(o.startsWith(o.position,"ENDMDL")&&l>0){if(c.length===0){h={start:a.length+3,end:a.length+4}}if(u){c.push(new r.ModelData(h,u.tokens,l))}l=0;u=null}else if(o.startsWith(o.position,"END")){var m=o.position;var v=o.moveToEndOfLine();o.trim(m,v);if(o.trimmedToken.end-o.trimmedToken.start===3){d=false}}break;case 72:if(o.startsWith(o.position,"HETATM")){if(!u){u=t.TokenIndexBuilder.create(4096)}var p=i.tokenizeAtom(u,o);l++;if(p)return p}break;case 77:if(o.startsWith(o.position,"MODEL")){if(l>0){if(c.length===0){h={start:a.length+3,end:a.length+4}}if(u){c.push(new r.ModelData(h,u.tokens,l))}}var m=o.position+6;var v=o.moveToEndOfLine();o.trim(m,v);h={start:o.trimmedToken.start,end:o.trimmedToken.end};if(l>0||!u){u=t.TokenIndexBuilder.create(4096)}l=0}break}o.moveToNextLine();if(!d)break}var y=a+".?0123";if(l>0){if(c.length===0){h={start:a.length+3,end:a.length+4}}if(u){c.push(new r.ModelData(h,u.tokens,l))}}return new r.MoleculeData(new r.Header(e),f,new r.ModelsData(c),y)};i.getDotRange=function(e){return{start:e-6,end:e-5}};i.getNumberRanges=function(t){var r=e.Utils.FastMap.create();for(var n=0;n<4;n++){r.set(n,{start:t-4+n,end:t-3+n})}return r};i.getQuestionmarkRange=function(e){return{start:e-5,end:e-4}};i.parse=function(e,r){var n=i.tokenize(e,r);if(n instanceof t.ParserError){return t.ParserResult.error(n.message,n.line)}else{return t.ParserResult.success(n.toCifFile())}};return i}();r.Parser=i;function a(e,t){return i.parse(e,t)}r.toCifFile=a})(n=r.PDB||(r.PDB={}))})(r=t.Molecule||(t.Molecule={}))})(t=e.Formats||(e.Formats={}))})(t=e.Core||(e.Core={}))})(p||(p={}));/* 389 * Copyright (c) 2016 - now David Sehnal, licensed under Apache 2.0, See LICENSE file for more info. 390 */ 391var p;(function(e){var t;(function(e){var t;(function(t){var r;(function(r){var n;(function(r){function n(r,n){var i=r.split(/\r?\n/g);var a=i[0].trim();if(!a.length)a="SDF";var o=i[3];var s=+o.substr(0,3);var u=+o.substr(3,3);return{id:n?n:a,atomCount:s,bondCount:u,atoms:e.Utils.DataTable.ofDefinition(e.Structure.Tables.Atoms,s),positions:e.Utils.DataTable.ofDefinition(e.Structure.Tables.Positions,s),bonds:e.Utils.DataTable.ofDefinition(e.Structure.Tables.Bonds,u),lines:i,currentLine:4,error:void 0,stringPool:t.ShortStringPool.create()}}function i(r,n){var i=n.lines[n.currentLine];var a=n.atoms,o=n.positions;var s=t.ShortStringPool.get(n.stringPool,i.substr(31,3).trim());a.id[r]=r;a.elementSymbol[r]=s;a.name[r]=s;a.authName[r]=s;a.occupancy[r]=1;a.rowIndex[r]=n.currentLine;o.x[r]=e.Utils.FastNumberParsers.parseFloatSkipTrailingWhitespace(i,0,10);o.y[r]=e.Utils.FastNumberParsers.parseFloatSkipTrailingWhitespace(i,10,20);o.z[r]=e.Utils.FastNumberParsers.parseFloatSkipTrailingWhitespace(i,20,30)}function a(e){for(var t=0;t<e.atomCount;t++){i(t,e);e.currentLine++}}function o(t,r){var n=r.lines[r.currentLine];var i=r.bonds;i.atomAIndex[t]=e.Utils.FastNumberParsers.parseIntSkipTrailingWhitespace(n,0,3)-1;
391i.atomBIndex[t]=e.Utils.FastNumberParsers.parseIntSkipTrailingWhitespace(n,3,6)-1;switch(e.Utils.FastNumberParsers.parseIntSkipTrailingWhitespace(n,6,9)){case 1:i.type[t]=1;break;case 2:i.type[t]=2;break;case 3:i.type[t]=3;break;case 4:i.type[t]=4;break;default:i.type[t]=0;break}}function s(e){for(var t=0;t<e.bondCount;t++){o(t,e);e.currentLine++}}function u(t){var r=e.Utils.DataTable.ofDefinition(e.Structure.Tables.Residues,1),n=e.Utils.DataTable.ofDefinition(e.Structure.Tables.Chains,1),i=e.Utils.DataTable.ofDefinition(e.Structure.Tables.Entities,1);r.isHet[0]=1;r.insCode[0]=null;r.name[0]=r.authName[0]="UNK";r.atomEndIndex[0]=n.atomEndIndex[0]=i.atomEndIndex[0]=t.atomCount;r.asymId[0]=r.authAsymId[0]=n.asymId[0]=n.authAsymId[0]="X";r.entityId[0]=n.entityId[0]=i.entityId[0]="1";n.residueEndIndex[0]=i.residueEndIndex[0]=0;i.chainEndIndex[0]=1;i.type[0]="non-polymer";var a=new e.Structure.PolyResidueIdentifier("X",0,null);var o=[new e.Structure.SecondaryStructureElement(0,a,a)];o[0].startResidueIndex=0;o[0].endResidueIndex=1;return e.Structure.Molecule.Model.create({id:t.id,modelId:"1",data:{atoms:t.atoms,residues:r,chains:n,entities:i,bonds:{input:t.bonds},secondaryStructure:o,symmetryInfo:void 0,assemblyInfo:void 0},positions:t.positions,source:e.Structure.Molecule.Model.Source.File})}function l(r,i){try{var o=n(r,i);a(o);s(o);var l=u(o);if(o.error){return t.ParserResult.error(o.error,o.currentLine+1)}var c=e.Structure.Molecule.create(i?i:o.id,[l]);return t.ParserResult.success(c)}catch(e){return t.ParserResult.error(""+e)}}r.parse=l})(n=r.SDF||(r.SDF={}))})(r=t.Molecule||(t.Molecule={}))})(t=e.Formats||(e.Formats={}))})(t=e.Core||(e.Core={}))})(p||(p={}));/* 392 * Copyright (c) 2016 - now David Sehnal, licensed under Apache 2.0, See LICENSE file for more info. 393 */ 394var p;(function(e){var t;(function(e){var t;(function(t){var r;(function(r){function n(n,i){var a=this;return function(o,s){return e.computation(function(e){return m(a,void 0,void 0,function(){var a,u,l;return v(this,function(c){switch(c.label){case 0:return[4,e.updateProgress("Parsing...")];case 1:c.sent();a=i(o,s);if(a.isError){throw a.toString()}u=a.result;if(!u.dataBlocks.length){throw"The "+n+" data does not contain a data block."}return[4,e.updateProgress("Creating representation...")];case 2:c.sent();l=r.mmCIF.ofDataBlock(u.dataBlocks[0]);return[2,t.ParserResult.success(l,u.dataBlocks.length>1?["The input data contains multiple data blocks, only the first one was parsed. To parse all data blocks, use the function 'mmCIF.ofDataBlock' separately for each block."]:void 0)]}})})})}}var i;(function(i){var a=this;i.mmCIF={name:"mmCIF",shortcuts:["mmcif","cif"],extensions:[".cif"],parse:n("CIF",t.CIF.Text.parse)};i.mmBCIF={name:"mmCIF (Binary)",shortcuts:["mmbcif","bcif","binarycif"],extensions:[".bcif"],isBinary:true,parse:n("BinaryCIF",t.CIF.Binary.parse)};i.PDB={name:"PDB",shortcuts:["pdb","ent"],extensions:[".pdb",".ent"],parse:n("PDB",function(e,t){return r.PDB.toCifFile(t&&t.id||"PDB",e)})};i.SDF={name:"SDF",shortcuts:["sdf","mol"],extensions:[".sdf",".mol"],parse:function(n,i){return e.computation(function(e){return m(a,void 0,void 0,function(){var a;return v(this,function(o){switch(o.label){case 0:return[4,e.updateProgress("Parsing...")];case 1:o.sent();a=r.SDF.parse(n,i&&i.id||undefined);if(a.isError)throw a.toString();return[2,t.ParserResult.success(a.result)]}})})})}};i.All=[i.mmCIF,i.mmBCIF,i.PDB,i.SDF]})(i=r.SupportedFormats||(r.SupportedFormats={}))})(r=t.Molecule||(t.Molecule={}))})(t=e.Formats||(e.Formats={}))})(t=e.Core||(e.Core={}))})(p||(p={}));/* 395 * Copyright (c) 2016 - now David Sehnal, licensed under Apache 2.0, See LICENSE file for more info. 396 */ 397var p;(function(e){var t;(function(e){var t;(function(e){var t;(function(e){"use strict";function t(e,t){var r=e.length;for(var n=0;n<r;n++){e[n]=t}}var r=function(){function e(e,t){this.data=e;this.dimensions=t;this.len=this.dimensions[0]*this.dimensions[1]*this.dimensions[2];this.nX=this.dimensions[0];this.nY=this.dimensions[1]}Object.defineProperty(e.prototype,"length",{get:function(){return this.len},enumerable:true,configurable:true});e.prototype.getAt=function(e){return this.data[e]};e.prototype.setAt=function(e,t){this.data[e]=t};e.prototype.get=function(e,t,r){return this.data[this.nX*(r*this.nY+t)+e|0]};e.prototype.set=function(e,t,r,n){this.data[this.nX*(r*this.nY+t)+e|0]=n};e.prototype.fill=function(e){t(this.data,e)};return e}();e.Field3DZYX=r;function n(e,t,r){var n=Math.PI/180*r[0],i=Math.PI/180*r[1],a=Math.PI/180*r[2];var o=t[0],s=t[1],u=t[2];var l=Math.cos(i),c=(Math.cos(n)-Math.cos(i)*Math.cos(a))/Math.sin(a),f=Math.sqrt(1-l*l-c*c);var h=[o,0,0];var d=[Math.cos(a)*s,Math.sin(a)*s,0];var p=[l*u,c*u,f*u];return{number:e,size:t,angles:r,basis:{x:h,y:d,z:p}}}e.createSpacegroup=n})(t=e.Density||(e.Density={}))})(t=e.Formats||(e.Formats={}))})(t=e.Core||(e.Core={}))})(p||(p={}));/* 398 * Copyright (c) 2016 - now David Sehnal, licensed under Apache 2.0, See LICENSE file for more info. 399 */ 400var p;(function(e){var t;(function(e){var t;(function(e){var t;(function(t){var r;(function(r){function n(e){return i.parse(e)}r.parse=n;var i;(function(r){function n(e,t,r){var n=[];for(var i=0;i<r;i++){n[i]=e(t+i)}return n}function i(r){var i=1024,s=new DataView(r,0,i),u=[];var l=false;var c=s.getInt32(3*4,false);
400if(c!==2){l=true;c=s.getInt32(3*4,true);if(c!==2){return e.ParserResult.error("Only CCP4 mode 2 is supported.")}}var f=function(e){return s.getInt32(e*4,l)},h=function(e){return s.getFloat32(e*4,l)};var d={extent:n(f,0,3),mode:c,nxyzStart:n(f,4,3),grid:n(f,7,3),cellSize:n(h,10,3),cellAngles:n(h,13,3),crs2xyz:n(f,16,3),min:h(19),max:h(20),mean:h(21),spacegroupNumber:f(22),symBytes:f(23),skewFlag:f(24),skewMatrix:n(h,25,9),skewTranslation:n(h,34,3),origin2k:n(h,49,3)};var p=r.byteLength-4*d.extent[0]*d.extent[1]*d.extent[2];if(p!==i+d.symBytes){if(p===i){u.push("File contains bogus symmetry record.")}else if(p<i){return e.ParserResult.error("File appears truncated and doesn't match header.")}else if(p>i&&p<1024*1024){p=i+d.symBytes;u.push("File is larger than expected and doesn't match header. Continuing file load, good luck!")}else{return e.ParserResult.error("File is MUCH larger than expected and doesn't match header.")}}if(d.grid[0]===0&&d.extent[0]>0){d.grid[0]=d.extent[0]-1;u.push("Fixed X interval count.")}if(d.grid[1]===0&&d.extent[1]>0){d.grid[1]=d.extent[1]-1;u.push("Fixed Y interval count.")}if(d.grid[2]===0&&d.extent[2]>0){d.grid[2]=d.extent[2]-1;u.push("Fixed Z interval count.")}if(d.crs2xyz[0]===0&&d.crs2xyz[1]===0&&d.crs2xyz[2]===0){u.push("All crs2xyz records are zero. Setting crs2xyz to 1, 2, 3.");d.crs2xyz=[1,2,3]}if(d.cellSize[0]===0&&d.cellSize[1]===0&&d.cellSize[2]===0){u.push("Cell dimensions are all zero. Setting to 1.0, 1.0, 1.0. Map file will not align with other structures.");d.cellSize[0]=1;d.cellSize[1]=1;d.cellSize[2]=1}var m=[0,0,0];m[d.crs2xyz[0]-1]=0;m[d.crs2xyz[1]-1]=1;m[d.crs2xyz[2]-1]=2;var v;if(d.origin2k[0]===0&&d.origin2k[1]===0&&d.origin2k[2]===0){v=[d.nxyzStart[m[0]],d.nxyzStart[m[1]],d.nxyzStart[m[2]]]}else{v=[d.origin2k[m[0]],d.origin2k[m[1]],d.origin2k[m[2]]]}var y=[d.extent[m[0]],d.extent[m[1]],d.extent[m[2]]];var g=new Uint16Array(new Uint8Array([18,52]).buffer)[0]===13330;var b=l===g?a(new Float32Array(r,i+d.symBytes,y[0]*y[1]*y[2]),l,y,d.extent,m,d.mean):o(new DataView(r,i+d.symBytes),l,y,d.extent,m,d.mean);var x=new t.Field3DZYX(b.data,y);var _={spacegroup:t.createSpacegroup(d.spacegroupNumber,d.cellSize,d.cellAngles),box:{origin:[v[0]/d.grid[0],v[1]/d.grid[1],v[2]/d.grid[2]],dimensions:[y[0]/d.grid[0],y[1]/d.grid[1],y[2]/d.grid[2]],sampleCount:y},data:x,valuesInfo:{min:d.min,max:d.max,mean:d.mean,sigma:b.sigma}};return e.ParserResult.success(_,u)}r.parse=i;function a(e,t,r,n,i,a){var o=new Float32Array(r[0]*r[1]*r[2]),s=[0,0,0],u,l,c,f,h,d,p,m,v=0,y=.1,g=0,b=.1,x=i[0],_=i[1],w=i[2];u=n[0];l=n[1];c=n[2];p=r[0];m=r[0]*r[1];for(d=0;d<c;d++){s[2]=d;for(h=0;h<l;h++){s[1]=h;for(f=0;f<u;f++){s[0]=f;y=e[v];b=y-a;g+=b*b,o[s[x]+s[_]*p+s[w]*m]=y;v+=1}}}g/=u*l*c;g=Math.sqrt(g);return{data:o,sigma:g}}function o(e,t,r,n,i,a){var o=new Float32Array(r[0]*r[1]*r[2]),s=[0,0,0],u,l,c,f,h,d,p,m,v=0,y=.1,g=0,b=.1,x=i[0],_=i[1],w=i[2];u=n[0];l=n[1];c=n[2];p=r[0];m=r[0]*r[1];for(d=0;d<c;d++){s[2]=d;for(h=0;h<l;h++){s[1]=h;for(f=0;f<u;f++){s[0]=f;y=e.getFloat32(v,t);b=y-a;g+=b*b,o[s[x]+s[_]*p+s[w]*m]=y;v+=4}}}g/=u*l*c;g=Math.sqrt(g);return{data:o,sigma:g}}})(i||(i={}))})(r=t.CCP4||(t.CCP4={}))})(t=e.Density||(e.Density={}))})(t=e.Formats||(e.Formats={}))})(t=e.Core||(e.Core={}))})(p||(p={}));/* 401 * Copyright (c) 2016 - now David Sehnal, licensed under Apache 2.0, See LICENSE file for more info. 402 */ 403var p;(function(e){var t;(function(e){var t;(function(e){var t;(function(t){var r;(function(r){function n(t){if(t.getCategory("_density_info"))return i.parseLegacy(t);else if(t.getCategory("_volume_data_3d_info"))return i.parse(t);return e.ParserResult.error("Invalid data format.")}r.parse=n;var i;(function(r){function n(r){var n=r.getCategory("_volume_data_3d_info");if(!n)return e.ParserResult.error("_volume_data_3d_info category is missing.");if(!r.getCategory("_volume_data_3d"))return e.ParserResult.error("_volume_data_3d category is missing.");function i(e){var t=[0,0,0];for(var r=0;r<3;r++){t[r]=n.getColumn(e+"["+r+"]").getFloat(0)}return t}function o(e){return n.getColumn(e).getFloat(0)}var s={name:n.getColumn("name").getString(0),axisOrder:i("axis_order"),origin:i("origin"),dimensions:i("dimensions"),sampleCount:i("sample_count"),spacegroupNumber:o("spacegroup_number")|0,cellSize:i("spacegroup_cell_size"),cellAngles:i("spacegroup_cell_angles"),mean:o("mean_sampled"),sigma:o("sigma_sampled")};var u=[0,0,0];u[s.axisOrder[0]]=0;u[s.axisOrder[1]]=1;u[s.axisOrder[2]]=2;function l(e){return[e[u[0]],e[u[1]],e[u[2]]]}var c=l(s.sampleCount);var f=a(r.getCategory("_volume_data_3d").getColumn("values"),c,s.sampleCount,u);var h=new t.Field3DZYX(f.data,c);var d={name:s.name,spacegroup:t.createSpacegroup(s.spacegroupNumber,s.cellSize,s.cellAngles),box:{origin:l(s.origin),dimensions:l(s.dimensions),sampleCount:c},data:h,valuesInfo:{min:f.min,max:f.max,mean:s.mean,sigma:s.sigma}};return e.ParserResult.success(d)}r.parse=n;function i(r){var n=r.getCategory("_density_info");if(!n)return e.ParserResult.error("_density_info category is missing.");if(!r.getCategory("_density_data"))return e.ParserResult.error("_density_data category is missing.");function i(e){var t=[];for(var r=0;r<3;r++){t[r]=n.getColumn(e+"["+r+"]").getFloat(0)}return t}function o(e){return n.getColumn(e).getFloat(0)}var s={name:n.getColumn("name").getString(0),grid:i("grid"),axisOrder:i("axis_order"),extent:i("extent"),origin:i("origin"),cellSize:i("cell_size"),cellAngles:i("cell_angles"),mean:o("mean"),sigma:o("sigma"),spacegroupNumber:o("spacegroup_number")|0};var u=[0,0,0];u[s.axisOrder[0]]=0;u[s.axisOrder[1]]=1;u[s.axisOrder[2]]=2;var l=[s.origin[u[0]],s.origin[u[1]],s.origin[u[2]]];var c=[s.extent[u[0]],s.extent[u[1]],s.extent[u[2]]];var f=a(r.getCategory("_density_data").getColumn("values"),c,s.extent,u);var h=new t.Field3DZYX(f.data,c);var d={name:s.name,spacegroup:t.createSpacegroup(s.spacegroupNumber,s.cellSize,s.cellAngles),box:{origin:[l[0]/s.grid[0],l[1]/s.grid[1],l[2]/s.grid[2]],dimensions:[c[0]/s.grid[0],c[
4031]/s.grid[1],c[2]/s.grid[2]],sampleCount:c},data:h,valuesInfo:{min:f.min,max:f.max,mean:s.mean,sigma:s.sigma}};return e.ParserResult.success(d)}r.parseLegacy=i;function a(e,t,r,n){var i=new Float32Array(t[0]*t[1]*t[2]);var a=[0,0,0];var o=n[0],s=n[1],u=n[2];var l=r[0],c=r[1],f=r[2];var h=t[0];var d=t[0]*t[1];var p=0;var m=e.getFloat(0),v=m;for(var y=0;y<f;y++){a[2]=y;for(var g=0;g<c;g++){a[1]=g;for(var b=0;b<l;b++){a[0]=b;var x=e.getFloat(p);p+=1;i[a[o]+a[s]*h+a[u]*d]=x;if(x<m)m=x;else if(x>v)v=x}}}return{data:i,min:m,max:v}}})(i||(i={}))})(r=t.CIF||(t.CIF={}))})(t=e.Density||(e.Density={}))})(t=e.Formats||(e.Formats={}))})(t=e.Core||(e.Core={}))})(p||(p={}));/* 404 * Copyright (c) 2016 - now David Sehnal, licensed under Apache 2.0, See LICENSE file for more info. 405 */ 406var p;(function(e){var t;(function(e){var t;(function(t){var r;(function(t){function r(t,r,n){var i=this;return e.computation(function(e){return m(i,void 0,void 0,function(){return v(this,function(i){switch(i.label){case 0:return[4,e.updateProgress("Parsing "+r+"...")];case 1:i.sent();return[2,n(t)]}})})})}var n;(function(e){e.CCP4={name:"CCP4",shortcuts:["ccp4","map"],extensions:[".ccp4",".map"],isBinary:true,parse:function(e){return r(e,"CCP4",function(e){return t.CCP4.parse(e)})}};e.All=[e.CCP4]})(n=t.SupportedFormats||(t.SupportedFormats={}))})(r=t.Density||(t.Density={}))})(t=e.Formats||(e.Formats={}))})(t=e.Core||(e.Core={}))})(p||(p={}));/* 407 * Copyright (c) 2016 - now David Sehnal, licensed under Apache 2.0, See LICENSE file for more info. 408 */ 409var p;(function(e){var t;(function(e){var t;(function(e){var t;(function(e){/* 410 * This code has been modified from https://github.com/toji/gl-matrix/, 411 * copyright (c) 2015, Brandon Jones, Colin MacKenzie IV. 412 * 413 * Permission is hereby granted, free of charge, to any person obtaining a copy 414 * of this software and associated documentation files (the "Software"), to deal 415 * in the Software without restriction, including without limitation the rights 416 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 417 * copies of the Software, and to permit persons to whom the Software is 418 * furnished to do so, subject to the following conditions: 419 */ 420function t(){return t.zero()}e.Matrix4=t;(function(e){function t(){var e=[.1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];e[0]=0;return e}e.zero=t;function r(){var e=t();e[0]=1;e[1]=0;e[2]=0;e[3]=0;e[4]=0;e[5]=1;e[6]=0;e[7]=0;e[8]=0;e[9]=0;e[10]=1;e[11]=0;e[12]=0;e[13]=0;e[14]=0;e[15]=1;return e}e.identity=r;function n(e){e[0]=1;e[1]=0;e[2]=0;e[3]=0;e[4]=0;e[5]=1;e[6]=0;e[7]=0;e[8]=0;e[9]=0;e[10]=1;e[11]=0;e[12]=0;e[13]=0;e[14]=0;e[15]=1;return e}e.fromIdentity=n;function i(e){var r=t(),n,i,a;for(n=0;n<4;n++){a=e[n];for(i=0;i<4;i++){r[4*i+n]=a[i]}}return r}e.ofRows=i;function a(e,t,r){for(var n=0;n<16;n++){if(Math.abs(e[n]-t[n])>r){return false}}return true}e.areEqual=a;function o(e,t,r,n){e[4*r+t]=n}e.setValue=o;function s(e,t){e[0]=t[0];e[1]=t[1];e[2]=t[2];e[3]=t[3];e[4]=t[4];e[5]=t[5];e[6]=t[6];e[7]=t[7];e[8]=t[8];e[9]=t[9];e[10]=t[10];e[11]=t[11];e[12]=t[12];e[13]=t[13];e[14]=t[14];e[15]=t[15];return e}e.copy=s;function u(t){return e.copy(e.zero(),t)}e.clone=u;function l(e,t){var r=t[0],n=t[1],i=t[2],a=t[3],o=t[4],s=t[5],u=t[6],l=t[7],c=t[8],f=t[9],h=t[10],d=t[11],p=t[12],m=t[13],v=t[14],y=t[15],g=r*s-n*o,b=r*u-i*o,x=r*l-a*o,_=n*u-i*s,w=n*l-a*s,C=i*l-a*u,E=c*m-f*p,S=c*v-h*p,T=c*y-d*p,M=f*v-h*m,A=f*y-d*m,P=h*y-d*v,R=g*P-b*A+x*M+_*T-w*S+C*E;if(!R){return null}R=1/R;e[0]=(s*P-u*A+l*M)*R;e[1]=(i*A-n*P-a*M)*R;e[2]=(m*C-v*w+y*_)*R;e[3]=(h*w-f*C-d*_)*R;e[4]=(u*T-o*P-l*S)*R;e[5]=(r*P-i*T+a*S)*R;e[6]=(v*x-p*C-y*b)*R;e[7]=(c*C-h*x+d*b)*R;e[8]=(o*A-s*T+l*E)*R;e[9]=(n*T-r*A-a*E)*R;e[10]=(p*w-m*x+y*g)*R;e[11]=(f*x-c*w-d*g)*R;e[12]=(s*S-o*M-u*E)*R;e[13]=(r*M-n*S+i*E)*R;e[14]=(m*b-p*_-v*g)*R;e[15]=(c*_-f*b+h*g)*R;return e}e.invert=l;function c(e,t,r){var n=t[0],i=t[1],a=t[2],o=t[3],s=t[4],u=t[5],l=t[6],c=t[7],f=t[8],h=t[9],d=t[10
420],p=t[11],m=t[12],v=t[13],y=t[14],g=t[15];var b=r[0],x=r[1],_=r[2],w=r[3];e[0]=b*n+x*s+_*f+w*m;e[1]=b*i+x*u+_*h+w*v;e[2]=b*a+x*l+_*d+w*y;e[3]=b*o+x*c+_*p+w*g;b=r[4];x=r[5];_=r[6];w=r[7];e[4]=b*n+x*s+_*f+w*m;e[5]=b*i+x*u+_*h+w*v;e[6]=b*a+x*l+_*d+w*y;e[7]=b*o+x*c+_*p+w*g;b=r[8];x=r[9];_=r[10];w=r[11];e[8]=b*n+x*s+_*f+w*m;e[9]=b*i+x*u+_*h+w*v;e[10]=b*a+x*l+_*d+w*y;e[11]=b*o+x*c+_*p+w*g;b=r[12];x=r[13];_=r[14];w=r[15];e[12]=b*n+x*s+_*f+w*m;e[13]=b*i+x*u+_*h+w*v;e[14]=b*a+x*l+_*d+w*y;e[15]=b*o+x*c+_*p+w*g;return e}e.mul=c;function f(e,t,r,n){return c(e,c(e,t,r),n)}e.mul3=f;function h(e,t,r){var n=r[0],i=r[1],a=r[2],o,s,u,l,c,f,h,d,p,m,v,y;if(t===e){e[12]=t[0]*n+t[4]*i+t[8]*a+t[12];e[13]=t[1]*n+t[5]*i+t[9]*a+t[13];e[14]=t[2]*n+t[6]*i+t[10]*a+t[14];e[15]=t[3]*n+t[7]*i+t[11]*a+t[15]}else{o=t[0];s=t[1];u=t[2];l=t[3];c=t[4];f=t[5];h=t[6];d=t[7];p=t[8];m=t[9];v=t[10];y=t[11];e[0]=o;e[1]=s;e[2]=u;e[3]=l;e[4]=c;e[5]=f;e[6]=h;e[7]=d;e[8]=p;e[9]=m;e[10]=v;e[11]=y;e[12]=o*n+c*i+p*a+t[12];e[13]=s*n+f*i+m*a+t[13];e[14]=u*n+h*i+v*a+t[14];e[15]=l*n+d*i+y*a+t[15]}return e}e.translate=h;function d(e,t){e[0]=1;e[1]=0;e[2]=0;e[3]=0;e[4]=0;e[5]=1;e[6]=0;e[7]=0;e[8]=0;e[9]=0;e[10]=1;e[11]=0;e[12]=t[0];e[13]=t[1];e[14]=t[2];e[15]=1;return e}e.fromTranslation=d;function p(e,t,r,n){var i=n[0],a=n[1],o=n[2],s=Math.sqrt(i*i+a*a+o*o),u,l,c,f,h,d,p,m,v,y,g,b,x,_,w,C,E,S,T,M,A,P,R,k;if(Math.abs(s)<1e-6){return null}s=1/s;i*=s;a*=s;o*=s;u=Math.sin(r);l=Math.cos(r);c=1-l;f=t[0];h=t[1];d=t[2];p=t[3];m=t[4];v=t[5];y=t[6];g=t[7];b=t[8];x=t[9];_=t[10];w=t[11];C=i*i*c+l;E=a*i*c+o*u;S=o*i*c-a*u;T=i*a*c-o*u;M=a*a*c+l;A=o*a*c+i*u;P=i*o*c+a*u;R=a*o*c-i*u;k=o*o*c+l;e[0]=f*C+m*E+b*S;e[1]=h*C+v*E+x*S;e[2]=d*C+y*E+_*S;e[3]=p*C+g*E+w*S;e[4]=f*T+m*M+b*A;e[5]=h*T+v*M+x*A;e[6]=d*T+y*M+_*A;e[7]=p*T+g*M+w*A;e[8]=f*P+m*R+b*k;e[9]=h*P+v*R+x*k;e[10]=d*P+y*R+_*k;e[11]=p*P+g*R+w*k;if(t!==e){e[12]=t[12];e[13]=t[13];e[14]=t[14];e[15]=t[15]}return e}e.rotate=p;function m(e,t,r){var i=r[0],a=r[1],o=r[2],s=Math.sqrt(i*i+a*a+o*o),u,l,c;if(Math.abs(s)<1e-6){return n(e)}s=1/s;i*=s;a*=s;o*=s;u=Math.sin(t);l=Math.cos(t);c=1-l;e[0]=i*i*c+l;e[1]=a*i*c+o*u;e[2]=o*i*c-a*u;e[3]=0;e[4]=i*a*c-o*u;e[5]=a*a*c+l;e[6]=o*a*c+i*u;e[7]=0;e[8]=i*o*c+a*u;e[9]=a*o*c-i*u;e[10]=o*o*c+l;e[11]=0;e[12]=0;e[13]=0;e[14]=0;e[15]=1;return e}e.fromRotation=m;function v(e,t,r){var n=r[0],i=r[1],a=r[2];e[0]=t[0]*n;e[1]=t[1]*n;e[2]=t[2]*n;e[3]=t[3]*n;e[4]=t[4]*i;e[5]=t[5]*i;e[6]=t[6]*i;e[7]=t[7]*i;e[8]=t[8]*a;e[9]=t[9]*a;e[10]=t[10]*a;e[11]=t[11]*a;e[12]=t[12];e[13]=t[13];e[14]=t[14];e[15]=t[15];return e}e.scale=v;function y(e,t){e[0]=t[0];e[1]=0;e[2]=0;e[3]=0;e[4]=0;e[5]=t[1];e[6]=0;e[7]=0;e[8]=0;e[9]=0;e[10]=t[2];e[11]=0;e[12]=0;e[13]=0;e[14]=0;e[15]=1;return e}e.fromScaling=y;function g(e){var t="";for(var r=0;r<4;r++){for(var n=0;n<4;n++){t+=e[4*n+r].toString();if(n<3)t+=" "}if(r<3)t+="\n"}return t}e.makeTable=g;function b(e){var t=e[0],r=e[1],n=e[2],i=e[3],a=e[4],o=e[5],s=e[6],u=e[7],l=e[8],c=e[9],f=e[10],h=e[11],d=e[12],p=e[13],m=e[14],v=e[15],y=t*o-r*a,g=t*s-n*a,b=t*u-i*a,x=r*s-n*o,_=r*u-i*o,w=n*u-i*s,C=l*p-c*d,E=l*m-f*d,S=l*v-h*d,T=c*m-f*p,M=c*v-h*p,A=f*v-h*m;return y*A-g*M+b*T+x*S-_*E+w*C}e.determinant=b})(t=e.Matrix4||(e.Matrix4={}));function r(e,t,n){return r.fromValues(e||0,t||0,n||0)}e.Vector3=r;(function(e){function r(){var e=[.1,0,0];e[0]=0;return e}e.zero=r;function n(e){var t=r();t[0]=e[0];t[1]=e[1];t[2]=e[2];return t}e.clone=n;function i(e){return o(e.x,e.y,e.z)}e.fromObj=i;function a(e){return{x:e[0],y:e[1],z:e[2]}}e.toObj=a;function o(e,t,n){var i=r();i[0]=e;i[1]=t;i[2]=n;return i}e.fromValues=o;function s(e,t,r,n){e[0]=t;e[1]=r;e[2]=n;return e}e.set=s;function u(e,t){e[0]=t[0];e[1]=t[1];e[2]=t[2];return e}e.copy=u;function l(e,t,r){e[0]=t[0]+r[0];e[1]=t[1]+r[1];e[2]=t[2]+r[2];return e}e.add=l;function c(e,t,r){e[0]=t[0]-r[0];e[1]=t[1]-r[1];e[2]=t[2]-r[2];return e}e.sub=c;function f(e,t,r){e[0]=t[0]*r;e[1]=t[1]*r;e[2]=t[2]*r;return e}e.scale=f;function h(e,t,r,n){e[0]=t[0]+r[0]*n;e[1]=t[1]+r[1]*n;e[2]=t[2]+r[2]*n;return e}e.scaleAndAdd=h;function d(e,t){var r=t[0]-e[0],n=t[1]-e[1],i=t[2]-e[2];return Math.sqrt(r*r+n*n+i*i)}e.distance=d;function p(e,t){var r=t[0]-e[0],n=t[1]-e[1],i=t[2]-e[2];return r*r+n*n+i*i}e.squaredDistance=p;function m(e){var t=e[0],r=e[1],n=e[2];return Math.sqrt(t*t+r*r+n*n)}e.magnitude=m;function v(e){var t=e[0],r=e[1],n=e[2];return t*t+r*r+n*n}e.squaredMagnitude=v;function y(e,t){var r=t[0],n=t[1],i=t[2];var a=r*r+n*n+i*i;if(a>0){a=1/Math.sqrt(a);e[0]=t[0]*a;e[1]=t[1]*a;e[2]=t[2]*a}return e}e.normalize=y;function g(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}e.dot=g;function b(e,t,r){var n=t[0],i=t[1],a=t[2],o=r[0],s=r[1],u=r[2];e[0]=i*u-a*s;e[1]=a*o-n*u;e[2]=n*s-i*o;return e}e.cross=b;function x(e,t,r,n){var i=t[0],a=t[1],o=t[2];e[0]=i+n*(r[0]-i);e[1]=a+n*(r[1]-a);e[2]=o+n*(r[2]-o);return e}e.lerp=x;function _(e,t,r){var n=t[0],i=t[1],a=t[2],o=r[3]*n+r[7]*i+r[11]*a+r[15];o=o||1;e[0]=(r[0]*n+r[4]*i+r[8]*a+r[12])/o;e[1]=(r[1]*n+r[5]*i+r[9]*a+r[13])/o;e[2]=(r[2]*n+r[6]*i+r[10]*a+r[14])/o;return e}e.transformMat4=_;var w=r(),C=r();function E(e,t){u(w,e);u(C,t);y(w,w);y(C,C);var r=g(w,C);if(r>1){return 0}else if(r<-1){return Math.PI}else{return Math.acos(r)}}e.angle=E;var S=r();function T(e,r,n){var i=E(r,n);if(Math.abs(i)<1e-4)return t.fromIdentity(e);var a=b(S,r,n);return t.fromRotation(e,i,a)}e.makeRotation=T})(r=e.Vector3||(e.Vector3={}));function n(e,t,r,i){return n.fromValues(e||0,t||0,r||0,i||0)}e.Vector4=n;(function(e){function t(){var e=[.1,0,0,0];e[0]=0;return e}e.zero=t;function r(e){var r=t();r[0]=e[0];r[1]=e[1];r[2]=e[2];r[3]=e[3];return r}e.clone=r;function n(e,r,n,i){var a=t();a[0]=e;a[1]=r;a[2]=n;a[3]=i;return a}e.fromValues=n;function i(e,t,r,n,i){e[0]=t;e[1]=r;e[2]=n;e[3]=i;return e}e.set=i;function a(e,t){var r=t[0]-e[0],n=t[1]-e[1],i=t[2]-e[2],a=t[3]-e[3];return Math.sqrt(r*r+n*n+i*i+a*a)}e.distance=a;function o(e,t){var r=t[0]-e[0],n=t[1]-e[1],i=t[2]-e[2],a=t[3]-e[3];return r*r+n*n+i*i+a*a}e.squaredDistance=o;function s(e){var t=e[0],r=e[1],n=e[2],i=e[3];return Math.sqrt(t*t+r*r+n*n+i*i)}e.norm=s;function u(e){var t=e[0],r=e[1],n=e[2],i=e[3];return t*t+r*r+n*n+i*i}e.squaredNorm=u;function l(e,t,r){var n=t[0],i=t[1],a=t[2],o=t[3];e[0]=r[0]*n+r[4]*i+r[8]*a+r[12]*o;e[1]=r[1]*n+r[5]*i+r[9]*a+r[13]*o;e[2]=r[2]*n+r[6]*i+r[10]*a+r[14]*o;e[3]=r[3]*n+r[7]*i+r[11]*a+r[15]*o;return e}e.transform=l})(n=e.Vector4||(e.Vector4={}))})(t=e.LinearAlgebra||(e.LinearAlgebra={}))})(t=e.Geometry||(e.Geometry={}))})(t=e.Core||(e.Core={}))})(p||(p={}));/* 421 * Copyright (c) 2016 - now David Sehnal, licensed under Apache 2.0, See LICENSE file for more info. 422 */ 423var p;(function(e){var t;(function(e){var t;(function(t){"use strict";var r;(function(r){var n=t.LinearAlgebra.Vector3;function i(e){if(e.normals)return;var t=new Float32Array(e.vertices.length),r=e.vertices,i=e.triangleIndices;var a=n.zero(),o=n.zero(),s=n.zero(),u=n.zero(),l=n.zero(),c=n.zero();for(var f=0;f<i.length;f+=3){var h=3*i[f],d=3*i[f+1],p=3*i[f+2];n.set(a,r[h],r[h+1],r[h+2]);n.set(o,r[d],r[d+1],r[d+2]);n.set(s,r[p],r[p+1],r[p+2]);n.sub(u,s,o);n.sub(l,o,a);n.cross(c,u,l);t[h]+=c[0];t[h+1]+=c[1];t[h+2]+=c[2];t[d]+=c[0];t[d+1]+=c[1];t[d+2]+=c[2];t[p]+=c[0];t[p+1]+=c[1];t[p+2]+=c[2]}for(var f=0;f<t.length;f+=3){var m=t[f];var v=t[f+1];var y=t[f+2];var g=1/Math.sqrt(m*m+v*v+y*y);t[f]*=g;t[f+1]*=g;t[f+2]*=g}e.normals=t}r.computeNormalsImmediate=i;function a(t){var r=this;return e.computation(function(e){return m(r,void 0,void 0,function(){return v(this,function(r){switch(r.label){case 0:if(t.normals){return[2,t]};return[4,e.updateProgress("Computing normals...")];case 1:r.sent();i(t);return[2,t]}})})})}r.computeNormals=a;function o(e,t,r,n){r[3*n]+=e[3*t];r[3*n+1]+=e[3*t+1];r[3*n+2]+=e[3*t+2]}function s(e,t,r,n){var i=e.triangleIndices.length,a=e.vertices;var s=e.triangleIndices;for(var u=0;u<i;u+=3){var l=s[u],c=s[u+1],f=s[u+2];o(a,c,r,l);o(a,f,r,l);o(a,l,r,c);o(a,f,r,c);o(a,l,r,f);o(a,c,r,f)}var h=2*n;for(var u=0,d=e.vertexCount;u<d;u++){var p=t[u]+h;r[3*u]=(r[3*u]+h*a[3*u])/p;r[3*u+1]=(r[3*u+1]+h*a[3*u+1])/p;r[3*u+2]=(r[3*u+2]+h*a[3*u+2])/p}}function u(t,r,n,i){return m(this,void 0,void 0,function(){var a,o,u,l,c,f,l,h,d,p,m;return v(this,function(v){switch(v.label){case 0:return[4,t.updateProgress("Smoothing surface...",true)];case 1:v.sent();a=new Int32Array(r.vertexCount),o=r.triangleIndices.length;u=r.triangleIndices;for(l=0;l<o;l++){a[u[l]]+=2}c=new Float32Array(r.vertices.length);
423f=e.Utils.PerformanceMonitor.currentTime();return[4,t.updateProgress("Smoothing surface...",true)];case 2:v.sent();l=0;v.label=3;case 3:if(!(l<n))return[3,6];if(l>0){for(h=0,d=c.length;h<d;h++)c[h]=0}r.normals=void 0;s(r,a,c,i);p=r.vertices;r.vertices=c;c=p;m=e.Utils.PerformanceMonitor.currentTime();if(!(m-f>e.Computation.UpdateProgressDelta))return[3,5];f=m;return[4,t.updateProgress("Smoothing surface...",true,l+1,n)];case 4:v.sent();v.label=5;case 5:l++;return[3,3];case 6:return[2,r]}})})}function l(t,r,n){var i=this;if(r===void 0){r=1}if(n===void 0){n=1}if(r<1)r=0;if(r===0)return e.Computation.resolve(t);return e.computation(function(e){return m(i,void 0,void 0,function(){return v(this,function(i){switch(i.label){case 0:return[4,u(e,t,r,1.1*n/1.1)];case 1:return[2,i.sent()]}})})})}r.laplacianSmooth=l;function c(r){var n=this;return e.computation(function(e){return m(n,void 0,void 0,function(){var n,i,a,o,s,u,l,s,u,c,f,h;return v(this,function(d){switch(d.label){case 0:if(r.boundingSphere){return[2,r]}return[4,e.updateProgress("Computing bounding sphere...")];case 1:d.sent();n=r.vertices;i=0,a=0,o=0;for(s=0,u=r.vertices.length;s<u;s+=3){i+=n[s];a+=n[s+1];o+=n[s+2]}i/=r.vertexCount;a/=r.vertexCount;o/=r.vertexCount;l=0;for(s=0,u=n.length;s<u;s+=3){c=i-n[s];f=a-n[s+1];h=o-n[s+2];l=Math.max(l,c*c+f*f+h*h)}r.boundingSphere={center:t.LinearAlgebra.Vector3.fromValues(i,a,o),radius:Math.sqrt(l)};return[2,r]}})})})}r.computeBoundingSphere=c;function f(e,r){var n=t.LinearAlgebra.Vector3.zero();var i=t.LinearAlgebra.Vector3.transformMat4;var a=e.vertices;for(var o=0,s=e.vertices.length;o<s;o+=3){n[0]=a[o];n[1]=a[o+1];n[2]=a[o+2];i(n,n,r);a[o]=n[0];a[o+1]=n[1];a[o+2]=n[2]}e.normals=void 0;e.boundingSphere=void 0}r.transformImmediate=f;function h(t,r){var n=this;return e.computation(function(e){return m(n,void 0,void 0,function(){return v(this,function(n){e.updateProgress("Updating surface...");f(t,r);return[2,t]})})})}r.transform=h})(r=t.Surface||(t.Surface={}))})(t=e.Geometry||(e.Geometry={}))})(t=e.Core||(e.Core={}))})(p||(p={}));/* 424 * Copyright (c) 2016 - now David Sehnal, licensed under Apache 2.0, See LICENSE file for more info. 425 */ 426var p;(function(e){var t;(function(e){var t;(function(e){var t;(function(e){var t;(function(e){function t(){return{min:[Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE],max:[-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE]}}e.createInfinite=t})(t=e.Box3D||(e.Box3D={}));var r;(function(e){function t(e,t,r){var n=e.buffer;n.squaredDistances[n.count]=t;n.elements[n.count++]=n.sourceElements[r]}e.add=t;function r(e){e.count=0}function n(e){return{sourceElements:e,elements:[],count:0,squaredDistances:[]}}function i(e,t,n,i,a){e.pivot[0]=t;e.pivot[1]=n;e.pivot[2]=i;e.radius=a;e.radiusSq=a*a;r(e.buffer)}e.update=i;function a(e,t){return{structure:e,buffer:n(t),pivot:[.1,.1,.1],radius:1.1,radiusSq:1.1*1.1}}e.create=a})(r=e.QueryContext||(e.QueryContext={}));var n;(function(e){function r(e,t,r,n){e.data[e._count++]=t;e.data[e._count++]=r;e.data[e._count++]=n;e.boundsMin[0]=Math.min(t,e.boundsMin[0]);e.boundsMin[1]=Math.min(r,e.boundsMin[1]);e.boundsMin[2]=Math.min(n,e.boundsMin[2]);e.boundsMax[0]=Math.max(t,e.boundsMax[0]);e.boundsMax[1]=Math.max(r,e.boundsMax[1]);e.boundsMax[2]=Math.max(n,e.boundsMax[2])}e.add=r;function n(e){var r=new Float32Array(e*3|0);var n=t.createInfinite();var i=n.min;var a=n.max;return{_count:0,data:r,bounds:n,boundsMin:i,boundsMax:a}}e.create=n;function i(t){var r=e.add;return function(e,n,i){r(t,e,n,i)}}e.createAdder=i})(n||(n={}));function i(e,t){var r=n.create(e.length);var i=new Int32Array(e.length);var a=n.createAdder(r);for(var o=0;o<e.length;o++){i[o]=o;t(e[o],a)}return{elements:e,positions:r.data,bounds:r.bounds,indices:i}}e.createInputData=i})(t=e.Query3D||(e.Query3D={}))})(t=e.Geometry||(e.Geometry={}))})(t=e.Core||(e.Core={}))})(p||(p={}));/* 427 * Copyright (c) 2016 - now David Sehnal, licensed under Apache 2.0, See LICENSE file for more info. 428 */ 429var p;(function(e){var t;(function(e){var t;(function(e){var t;(function(e){var t;(function(t){function r(t,r){var n=r.pivot,i=r.structure,a=i.indices,o=i.positions,s=r.radiusSq,u,l,c,f,h,d;for(d=t.startIndex;d<t.endIndex;d++){f=3*a[d];u=n[0]-o[f];l=n[1]-o[f+1];c=n[2]-o[f+2];h=u*u+l*l+c*c;
429if(h<=s)e.QueryContext.add(r,h,a[d])}}function n(e,t,r){var n=t.pivot[r],a=n<e.splitValue;if(a?n+t.radius>e.splitValue:n-t.radius<e.splitValue){i(e.left,t,(r+1)%3);i(e.right,t,(r+1)%3)}else if(a){i(e.left,t,(r+1)%3)}else{i(e.right,t,(r+1)%3)}}function i(e,t,i){if(e.startIndex===e.endIndex)return;if(isNaN(e.splitValue))r(e,t);else n(e,t,i)}t.nearest=i;function a(e,t,r,n,i){return{splitValue:e,startIndex:t,endIndex:r,left:n,right:i}}t.create=a})(t||(t={}));var r;(function(e){function r(e,n,i,a){var o=i-n+1;if(o<=0){return e.emptyNode}else if(o<=e.leafSize){return t.create(NaN,n,i+1,e.emptyNode,e.emptyNode)}var s=e.bounds.min[a],u=e.bounds.max[a],l=.5*(s+u),c=0,f=n,h=i,d,p,m;while(f<h){d=e.indices[h];e.indices[h]=e.indices[f];e.indices[f]=d;while(f<=i&&e.positions[3*e.indices[f]+a]<=l)f++;while(h>=n&&e.positions[3*e.indices[h]+a]>l)h--}c=f-1;e.bounds.max[a]=l;p=r(e,n,c,(a+1)%3);e.bounds.max[a]=u;e.bounds.min[a]=l;m=r(e,c+1,i,(a+1)%3);e.bounds.min[a]=s;return t.create(l,n,i+1,p,m)}function n(e,n){var i=e.elements,a=e.positions,o=e.bounds,s=e.indices;var u={bounds:o,positions:a,leafSize:n,indices:s,emptyNode:t.create(NaN,-1,-1,void 0,void 0)};var l=r(u,0,s.length-1,0);return{root:l,indices:s,positions:a}}e.build=n})(r||(r={}));function n(n,i){if(i===void 0){i=32}var a=r.build(n,i);return function(){var r=e.QueryContext.create(a,n.elements);return function(n,i,o,s){e.QueryContext.update(r,n,i,o,s);t.nearest(a.root,r,0);return r.buffer}}}e.createSubdivisionTree=n})(t=e.Query3D||(e.Query3D={}))})(t=e.Geometry||(e.Geometry={}))})(t=e.Core||(e.Core={}))})(p||(p={}));/* 430 * Copyright (c) 2017 - now David Sehnal, licensed under Apache 2.0, See LICENSE file for more info. 431 */ 432var p;(function(e){var t;(function(e){var t;(function(e){var t;(function(e){/** 433 * Adapted from https://github.com/arose/ngl 434 * MIT License Copyright (C) 2014+ Alexander Rose 435 */ 436function t(t){var r=t.structure,n=r.min,i=n[0],a=n[1],o=n[2],s=r.size,u=s[0],l=s[1],c=s[2],f=r.bucketOffset,h=r.bucketCounts,d=r.bucketArray,p=r.grid,m=r.positions;var v=t.radius,y=t.radiusSq,g=t.pivot,b=g[0],x=g[1],_=g[2];var w=Math.max(0,b-v-i>>3);var C=Math.max(0,x-v-a>>3);var E=Math.max(0,_-v-o>>3);var S=Math.min(u,b+v-i>>3);var T=Math.min(l,x+v-a>>3);var M=Math.min(c,_+v-o>>3);for(var A=w;A<=S;A++){for(var P=C;P<=T;P++){for(var R=E;R<=M;R++){var k=(A*l+P)*c+R;var I=p[k];if(I>0){var D=I-1;var B=f[D];var L=h[D];var F=B+L;for(var V=B;V<F;V++){var O=d[V];var U=m[3*O+0]-b;var N=m[3*O+1]-x;var z=m[3*O+2]-_;var H=U*U+N*N+z*z;if(H<=y){e.QueryContext.add(t,H,O)}}}}}}}function r(e){var t=e.bounds,r=e.size,n=r[0],i=r[1],a=r[2],o=e.positions,s=e.indices;var u=n*i*a;var l=s.length;var c=t.min,f=c[0],h=c[1],d=c[2];var p=0;var m=new Uint32Array(u);var v=new Int32Array(l);for(var y=0;y<l;y++){var g=o[3*y+0]-f>>3;var b=o[3*y+1]-h>>3;var x=o[3*y+2]-d>>3;var _=(g*i+b)*a+x;if((m[_]+=1)===1){p+=1}v[y]=_}var w=new Int32Array(p);for(var y=0,C=0;y<u;y++){var E=m[y];if(E>0){m[y]=C+1;w[C]=E;C+=1}}var S=new Uint32Array(l);for(var y=1;y<l;++y){S[y]+=S[y-1]+w[y-1]}var T=new Int32Array(p);var M=new Int32Array(l);for(var y=0;y<l;y++){var A=m[v[y]];if(A>0){var P=A-1;M[S[P]+T[P]]=y;T[P]+=1}}return{size:e.size,bucketArray:M,bucketCounts:w,bucketOffset:S,grid:m,min:e.bounds.min,positions:o}}function n(e){var t=e.elements,n=e.positions,i=e.bounds,a=e.indices;var o=[(i.max[0]-i.min[0]>>3)+1,(i.max[1]-i.min[1]>>3)+1,(i.max[2]-i.min[2]>>3)+1];var s={size:o,positions:n,indices:a,bounds:i};return r(s)}function i(r){var i=n(r);return function(){var n=e.QueryContext.create(i,r.elements);return function(r,i,a,o){e.QueryContext.update(n,r,i,a,o);t(n);return n.buffer}}}e.createSpatialHash=i})(t=e.Query3D||(e.Query3D={}))})(t=e.Geometry||(e.Geometry={}))})(t=e.Core||(e.Core={}))})(p||(p={}));/* 437 * Copyright (c) 2016 - now David Sehnal, licensed under Apache 2.0, See LICENSE file for more info. 438 */ 439var p;(function(e){var t;(function(e){var t;(function(t){var r;(function(t){"use strict";function r(t){var r=this;return e.computation(function(e){return m(r,void 0,void 0,function(){var r;return v(this,function(i){switch(i.label){case 0:r=new n(t,e);return[4,r.run()];case 1:return[2,i.sent()]}})})})}t.compute=r;var n=function(){function t(t,r){this.ctx=r;this.minX=0;this.minY=0;this.minZ=0;this.maxX=0;this.maxY=0;this.maxZ=0;var n=e.Utils.extend({},t);if(!n.bottomLeft)n.bottomLeft=[0,0,0];if(!n.topRight)n.topRight=n.scalarField.dimensions;this.state=new i(n),this.minX=n.bottomLeft[0];this.minY=n.bottomLeft[1];this.minZ=n.bottomLeft[2];this.maxX=n.topRight[0]-1;this.maxY=n.topRight[1]-1;this.maxZ=n.topRight[2]-1;this.size=(this.maxX-this.minX)*(this.maxY-this.minY)*(this.maxZ-this.minZ);this.sliceSize=(this.maxX-this.minX)*(this.maxY-this.minY)}t.prototype.doSlices=function(){return m(this,void 0,void 0,function(){var t,r,n,i;return v(this,function(a){switch(a.label){case 0:t=0;r=e.Utils.PerformanceMonitor.currentTime();n=this.minZ;a.label=1;case 1:if(!(n<this.maxZ))return[3,4];this.slice(n);t+=this.sliceSize;i=e.Utils.PerformanceMonitor.currentTime();if(!(i-r>e.Computation.UpdateProgressDelta))return[3,3];return[4,this.ctx.updateProgress("Computing surface...",true,t,this.size)];case 2:a.sent();r=i;a.label=3;case 3:n++;return[3,1];case 4:return[2]}})})};t.prototype.slice=function(e){for(var t=this.minY;t<this.maxY;t++){for(var r=this.minX;r<this.maxX;r++){this.state.processCell(r,t,e)}}this.state.clearEdgeVertexIndexSlice(e)};t.prototype.finish=function(){var t=e.Utils.ChunkedArray.compact(this.state.vertexBuffer);var r=e.Utils.ChunkedArray.compact(this.state.triangleBuffer);this.state.vertexBuffer=void 0;this.state.verticesOnEdges=void 0;var n={vertexCount:t.length/3|0,triangleCount:r.length/3|0,vertices:t,triangleIndices:r,annotation:this.state.annotate?e.Utils.ChunkedArray.compact(this.state.annotationBuffer):void 0};return n};t.prototype.run=function(){return m(this,void 0,void 0,function(){return v(this,function(e){switch(e.label){case 0:return[4,this.ctx.updateProgress("Computing surface...",true,0,this.size)];case 1:e.sent();return[4,this.doSlices()];case 2:e.sent();return[4,this.ctx.updateProgress("Finalizing...")];case 3:e.sent();return[2,this.finish()]}})})};return t}();var i=function(){function r(t){this.vertList=[0,0,0,0,0,0,0,0,0,0,0,0];this.i=0;this.j=0;this.k=0;this.nX=t.scalarField.dimensions[0];this.nY=t.scalarField.dimensions[1];this.nZ=t.scalarField.dimensions[2];this.isoLevel=t.isoLevel;this.scalarField=t.scalarField;this.annotationField=t.annotationField;var r=t.topRight[0]-t.bottomLeft[0],n=t.topRight[1]-t.bottomLeft[1],i=t.topRight[2]-t.bottomLeft[2],a=Math.min(262144,Math.max(r*n*i/16,
4391024)|0),o=Math.min(1<<16,a*4);this.vertexBuffer=e.Utils.ChunkedArray.forVertex3D(a);this.triangleBuffer=e.Utils.ChunkedArray.create(function(e){return new Uint32Array(e)},o,3);this.annotate=!!t.annotationField;if(this.annotate)this.annotationBuffer=e.Utils.ChunkedArray.forInt32(a);this.verticesOnEdges=new Int32Array(3*this.nX*this.nY*2)}r.prototype.get3dOffsetFromEdgeInfo=function(e){return this.nX*((this.k+e.k)%2*this.nY+this.j+e.j)+this.i+e.i};r.prototype.clearEdgeVertexIndexSlice=function(e){var t=e%2===0?0:3*this.nX*this.nY;var r=e%2===0?3*this.nX*this.nY:this.verticesOnEdges.length;for(var n=t;n<r;n++)this.verticesOnEdges[n]=0};r.prototype.interpolate=function(r){var n=t.EdgeIdInfo[r],i=3*this.get3dOffsetFromEdgeInfo(n)+n.e;var a=this.verticesOnEdges[i];if(a>0)return a-1|0;var o=t.CubeEdges[r];var s=o.a,u=o.b;var l=s.i+this.i,c=s.j+this.j,f=s.k+this.k;var h=u.i+this.i,d=u.j+this.j,p=u.k+this.k;var m=this.scalarField.get(l,c,f),v=this.scalarField.get(h,d,p);var y=(this.isoLevel-m)/(m-v);var g=e.Utils.ChunkedArray.add3(this.vertexBuffer,l+y*(l-h),c+y*(c-d),f+y*(f-p))|0;this.verticesOnEdges[i]=g+1;if(this.annotate){var b=y<.5?this.annotationField.get(l,c,f):this.annotationField.get(h,d,p);if(b<0)b=y<.5?this.annotationField.get(h,d,p):this.annotationField.get(l,c,f);e.Utils.ChunkedArray.add(this.annotationBuffer,b)}return g};r.prototype.processCell=function(r,n,i){var a=0;if(this.scalarField.get(r,n,i)<this.isoLevel)a|=1;if(this.scalarField.get(r+1,n,i)<this.isoLevel)a|=2;if(this.scalarField.get(r+1,n+1,i)<this.isoLevel)a|=4;if(this.scalarField.get(r,n+1,i)<this.isoLevel)a|=8;if(this.scalarField.get(r,n,i+1)<this.isoLevel)a|=16;if(this.scalarField.get(r+1,n,i+1)<this.isoLevel)a|=32;if(this.scalarField.get(r+1,n+1,i+1)<this.isoLevel)a|=64;if(this.scalarField.get(r,n+1,i+1)<this.isoLevel)a|=128;if(a===0||a===255)return;this.i=r;this.j=n;this.k=i;var o=t.EdgeTable[a];if((o&1)>0)this.vertList[0]=this.interpolate(0);if((o&2)>0)this.vertList[1]=this.interpolate(1);if((o&4)>0)this.vertList[2]=this.interpolate(2);if((o&8)>0)this.vertList[3]=this.interpolate(3);if((o&16)>0)this.vertList[4]=this.interpolate(4);if((o&32)>0)this.vertList[5]=this.interpolate(5);if((o&64)>0)this.vertList[6]=this.interpolate(6);if((o&128)>0)this.vertList[7]=this.interpolate(7);if((o&256)>0)this.vertList[8]=this.interpolate(8);if((o&512)>0)this.vertList[9]=this.interpolate(9);if((o&1024)>0)this.vertList[10]=this.interpolate(10);if((o&2048)>0)this.vertList[11]=this.interpolate(11);var s=t.TriTable[a];for(var u=0;u<s.length;u+=3){e.Utils.ChunkedArray.add3(this.triangleBuffer,this.vertList[s[u]],this.vertList[s[u+1]],this.vertList[s[u+2]])}};return r}()})(r=t.MarchingCubes||(t.MarchingCubes={}))})(t=e.Geometry||(e.Geometry={}))})(t=e.Core||(e.Core={}))})(p||(p={}));/* 440 * Copyright (c) 2016 - now David Sehnal, licensed under Apache 2.0, See LICENSE file for more info. 441 */ 442var p;(function(e){var t;(function(e){var t;(function(e){var t;(function(e){var t=function(){function e(e,t,r){this.i=e|0;this.j=t|0;this.k=r|0}return e}();e.Index=t;var r=function(){function e(e,t){this.a=e;this.b=t}return e}();e.IndexPair=r;e.EdgesXY=[[],[0,3],[0,1],[1,3],[1,2],[0,1,1,2,2,3,0,3],[0,2],[2,3],[2,3],[0,2],[0,1,1,2,2,3,0,3],[1,2],[1,3],[0,1],[0,3],[]];e.EdgesXZ=[[],[0,8],[0,9],[9,8],[9,4],[0,9,9,4,4,8,0,8],[0,4],[4,8],[4,8],[0,4],[0,9,9,4,4,8,0,8],[9,4],[9,8],[0,9],[0,8],[]];e.EdgesYZ=[[],[3,8],[3,11],[11,8],[11,7],[3,11,11,7,7,8,3,8],[3,7],[7,8],[7,8],[3,7],[3,11,11,7,7,8,3,8],[11,7],[11,8],[3,11],[3,8],[]];e.CubeVertices=[new t(0,0,0),new t(1,0,0),new t(1,1,0),new t(0,1,0),new t(0,0,1),new t(1,0,1),new t(1,1,1),new t(0,1,1)];e.CubeEdges=[new r(e.CubeVertices[0],e.CubeVertices[1]),new r(e.CubeVertices[1],e.CubeVertices[2]),new r(e.CubeVertices[2],e.CubeVertices[3]),new r(e.CubeVertices[3],e.CubeVertices[0]),new r(e.CubeVertices[4],e.CubeVertices[5]),new r(e.CubeVertices[5],e.CubeVertices[6]),new r(e.CubeVertices[6],e.CubeVertices[7]),new r(e.CubeVertices[7],e.CubeVertices[4]),new r(e.CubeVertices[0],e.CubeVertices[4]),new r(e.CubeVertices[1],e.CubeVertices[5]),new r(e.CubeVertices[2],e.CubeVertices[6]),new r(e.CubeVertices[3],e.CubeVertices[7])];e.EdgeIdInfo=[{i:0,j:0,k:0,e:0},{i:1,j:0,k:0,e:1},{i:0,j:1,k:0,e:0},{i:0,j:0,k:0,e:1},{i:0,j:0,k:1,e:0},{i:1,j:0,k:1,e:1},{i:0,j:1,k:1,e:0},{i:0,j:0,k:1,e:1},{i:0,j:0,k:0,e:2},{i:1,j:0,k:0,e:2},{i:1,j:1,k:0,e:2},{i:0,j:1,k:0,e:2}];
442e.EdgeTable=[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];e.TriTable=[[],[0,8,3],[0,1,9],[1,8,3,9,8,1],[1,2,10],[0,8,3,1,2,10],[9,2,10,0,2,9],[2,8,3,2,10,8,10,9,8],[3,11,2],[0,11,2,8,11,0],[1,9,0,2,3,11],[1,11,2,1,9,11,9,8,11],[3,10,1,11,10,3],[0,10,1,0,8,10,8,11,10],[3,9,0,3,11,9,11,10,9],[9,8,10,10,8,11],[4,7,8],[4,3,0,7,3,4],[0,1,9,8,4,7],[4,1,9,4,7,1,7,3,1],[1,2,10,8,4,7],[3,4,7,3,0,4,1,2,10],[9,2,10,9,0,2,8,4,7],[2,10,9,2,9,7,2,7,3,7,9,4],[8,4,7,3,11,2],[11,4,7,11,2,4,2,0,4],[9,0,1,8,4,7,2,3,11],[4,7,11,9,4,11,9,11,2,9,2,1],[3,10,1,3,11,10,7,8,4],[1,11,10,1,4,11,1,0,4,7,11,4],[4,7,8,9,0,11,9,11,10,11,0,3],[4,7,11,4,11,9,9,11,10],[9,5,4],[9,5,4,0,8,3],[0,5,4,1,5,0],[8,5,4,8,3,5,3,1,5],[1,2,10,9,5,4],[3,0,8,1,2,10,4,9,5],[5,2,10,5,4,2,4,0,2],[2,10,5,3,2,5,3,5,4,3,4,8],[9,5,4,2,3,11],[0,11,2,0,8,11,4,9,5],[0,5,4,0,1,5,2,3,11],[2,1,5,2,5,8,2,8,11,4,8,5],[10,3,11,10,1,3,9,5,4],[4,9,5,0,8,1,8,10,1,8,11,10],[5,4,0,5,0,11,5,11,10,11,0,3],[5,4,8,5,8,10,10,8,11],[9,7,8,5,7,9],[9,3,0,9,5,3,5,7,3],[0,7,8,0,1,7,1,5,7],[1,5,3,3,5,7],[9,7,8,9,5,7,10,1,2],[10,1,2,9,5,0,5,3,0,5,7,3],[8,0,2,8,2,5,8,5,7,10,5,2],[2,10,5,2,5,3,3,5,7],[7,9,5,7,8,9,3,11,2],[9,5,7,9,7,2,9,2,0,2,7,11],[2,3,11,0,1,8,1,7,8,1,5,7],[11,2,1,11,1,7,7,1,5],[9,5,8,8,5,7,10,1,3,10,3,11],[5,7,0,5,0,9,7,11,0,1,0,10,11,10,0],[11,10,0,11,0,3,10,5,0,8,0,7,5,7,0],[11,10,5,7,11,5],[10,6,5],[0,8,3,5,10,6],[9,0,1,5,10,6],[1,8,3,1,9,8,5,10,6],[1,6,5,2,6,1],[1,6,5,1,2,6,3,0,8],[9,6,5,9,0,6,0,2,6],[5,9,8,5,8,2,5,2,6,3,2,8],[2,3,11,10,6,5],[11,0,8,11,2,0,10,6,5],[0,1,9,2,3,11,5,10,6],[5,10,6,1,9,2,9,11,2,9,8,11],[6,3,11,6,5,3,5,1,3],[0,8,11,0,11,5,0,5,1,5,11,6],[3,11,6,0,3,6,0,6,5,0,5,9],[6,5,9,6,9,11,11,9,8],[5,10,6,4,7,8],[4,3,0,4,7,3,6,5,10],[1,9,0,5,10,6,8,4,7],[10,6,5,1,9,7,1,7,3,7,9,4],[6,1,2,6,5,1,4,7,8],[1,2,5,5,2,6,3,0,4,3,4,7],[8,4,7,9,0,5,0,6,5,0,2,6],[7,3,9,7,9,4,3,2,9,5,9,6,2,6,9],[3,11,2,7,8,4,10,6,5],[5,10,6,4,7,2,4,2,0,2,7,11],[0,1,9,4,7,8,2,3,11,5,10,6],[9,2,1,9,11,2,9,4,11,7,11,4,5,10,6],[8,4,7,3,11,5,3,5,1,5,11,6],[5,1,11,5,11,6,1,0,11,7,11,4,0,4,11],[0,5,9,0,6,5,0,3,6,11,6,3,8,4,7],[6,5,9,6,9,11,4,7,9,7,11,9],[10,4,9,6,4,10],[4,10,6,4,9,10,0,8,3],[10,0,1,10,6,0,6,4,0],[8,3,1,8,1,6,8,6,4,6,1,10],[1,4,9,1,2,4,2,6,4],[3,0,8,1,2,9,2,4,9,2,6,4],[0,2,4,4,2,6],[8,3,2,8,2,4,4,2,6],[10,4,9,10,6,4,11,2,3],[0,8,2,2,8,11,4,9,10,4,10,6],[3,11,2,0,1,6,0,6,4,6,1,10],[6,4,1,6,1,10,4,8,1,2,1,11,8,11,1],[9,6,4,9,3,6,9,1,3,11,6,3],[8,11,1,8,1,0,11,6,1,9,1,4,6,4,1],[3,11,6,3,6,0,0,6,4],[6,4,8,11,6,8],[7,10,6,7,8,10,8,9,10],[0,7,3,0,10,7,0,9,10,6,7,10],[10,6,7,1,10,7,1,7,8,1,8,0],[10,6,7,10,7,1,1,7,3],[1,2,6,1,6,8,1,8,9,8,6,7],[2,6,9,2,9,1,6,7,9,0,9,3,7,3,9],[7,8,0,7,0,6,6,0,2],[7,3,2,6,7,2],[2,3,11,10,6,8,10,8,9,8,6,7],[2,0,7,2,7,11,0,9,7,6,7,10,9,10,7],[1,8,0,1,7,8,1,10,7,6,7,10,2,3,11],[11,2,1,11,1,7,10,6,1,6,7,1],[8,9,6,8,6,7,9,1,6,11,6,3,1,3,6],[0,9,1,11,6,7],[7,8,0,7,0,6,3,11,0,11,6,0],[7,11,6],[7,6,11],[3,0,8,11,7,6],[0,1,9,11,7,6],[8,1,9,8,3,1,11,7,6],[10,1,2,6,11,7],[1,2,10,3,0,8,6,11,7],[2,9,0,2,10,9,6,11,7],[6,11,7,2,10,3,10,8,3,10,9,8],[7,2,3,6,2,7],[7,0,8,7,6,0,6,2,0],[2,7,6,2,3,7,0,1,9],[1,6,2,1,8,6,1,9,8,8,7,6],[10,7,6,10,1,7,1,3,7],[10,7,6,1,7,10,1,8,7,1,0,8],[0,3,7,0,7,10,0,10,9,6,10,7],[7,6,10,7,10,8,8,10,9],[6,8,4,11,8,6],[3,6,11,3,0,6,0,4,6],[8,6,11,8,4,6,9,0,1],[9,4,6,9,6,3,9,3,1,11,3,6],[6,8,4,6,11,8,2,10,1],[1,2,10,3,0,11,0,6,11,0,4,6],[4,11,8,4,6,11,0,2,9,2,10,9],[10,9,3,10,3,2,9,4,3,11,3,6,4,6,3],[8,2,3,8,4,2,4,6,2],[0,4,2,4,6,2],[1,9,0,2,3,4,2,4,6,4,3,8],[1,9,4,1,4,2,2,4,6],[8,1,3,8,6,1,8,4,6,6,10,1],[10,1,0,10,0,6,6,0,4],[4,6,3,4,3,8,6,10,3,0,3,9,10,9,3],[10,9,4,6,10,4],[4,9,5,7,6,11],[0,8,3,4,9,5,11,7,6],[5,0,1,5,4,0,7,6,11],[11,7,6,8,3,4,3,5,4,3,1,5],[9,5,4,10,1,2,7,6,11],[6,11,7,1,2,10,0,8,3,4,9,5],[7,6,11,5,4,10,4,2,10,4,0,2],[3,4,8,3,5,4,3,2,5,10,5,2,11,7,6],[7,2,3,7,6,2,5,4,9],[9,5,4,0,8,6,0,6,2,6,8,7],[3,6,2,3,7,6,1,5,0,5,4,0],[6,2,8,6,8,7,2,1,8,4,8,5,1,5,8],[9,5,4,10,1,6,1,7,6,1,3,7],[1,6,10,1,7,
4426,1,0,7,8,7,0,9,5,4],[4,0,10,4,10,5,0,3,10,6,10,7,3,7,10],[7,6,10,7,10,8,5,4,10,4,8,10],[6,9,5,6,11,9,11,8,9],[3,6,11,0,6,3,0,5,6,0,9,5],[0,11,8,0,5,11,0,1,5,5,6,11],[6,11,3,6,3,5,5,3,1],[1,2,10,9,5,11,9,11,8,11,5,6],[0,11,3,0,6,11,0,9,6,5,6,9,1,2,10],[11,8,5,11,5,6,8,0,5,10,5,2,0,2,5],[6,11,3,6,3,5,2,10,3,10,5,3],[5,8,9,5,2,8,5,6,2,3,8,2],[9,5,6,9,6,0,0,6,2],[1,5,8,1,8,0,5,6,8,3,8,2,6,2,8],[1,5,6,2,1,6],[1,3,6,1,6,10,3,8,6,5,6,9,8,9,6],[10,1,0,10,0,6,9,5,0,5,6,0],[0,3,8,5,6,10],[10,5,6],[11,5,10,7,5,11],[11,5,10,11,7,5,8,3,0],[5,11,7,5,10,11,1,9,0],[10,7,5,10,11,7,9,8,1,8,3,1],[11,1,2,11,7,1,7,5,1],[0,8,3,1,2,7,1,7,5,7,2,11],[9,7,5,9,2,7,9,0,2,2,11,7],[7,5,2,7,2,11,5,9,2,3,2,8,9,8,2],[2,5,10,2,3,5,3,7,5],[8,2,0,8,5,2,8,7,5,10,2,5],[9,0,1,5,10,3,5,3,7,3,10,2],[9,8,2,9,2,1,8,7,2,10,2,5,7,5,2],[1,3,5,3,7,5],[0,8,7,0,7,1,1,7,5],[9,0,3,9,3,5,5,3,7],[9,8,7,5,9,7],[5,8,4,5,10,8,10,11,8],[5,0,4,5,11,0,5,10,11,11,3,0],[0,1,9,8,4,10,8,10,11,10,4,5],[10,11,4,10,4,5,11,3,4,9,4,1,3,1,4],[2,5,1,2,8,5,2,11,8,4,5,8],[0,4,11,0,11,3,4,5,11,2,11,1,5,1,11],[0,2,5,0,5,9,2,11,5,4,5,8,11,8,5],[9,4,5,2,11,3],[2,5,10,3,5,2,3,4,5,3,8,4],[5,10,2,5,2,4,4,2,0],[3,10,2,3,5,10,3,8,5,4,5,8,0,1,9],[5,10,2,5,2,4,1,9,2,9,4,2],[8,4,5,8,5,3,3,5,1],[0,4,5,1,0,5],[8,4,5,8,5,3,9,0,5,0,3,5],[9,4,5],[4,11,7,4,9,11,9,10,11],[0,8,3,4,9,7,9,11,7,9,10,11],[1,10,11,1,11,4,1,4,0,7,4,11],[3,1,4,3,4,8,1,10,4,7,4,11,10,11,4],[4,11,7,9,11,4,9,2,11,9,1,2],[9,7,4,9,11,7,9,1,11,2,11,1,0,8,3],[11,7,4,11,4,2,2,4,0],[11,7,4,11,4,2,8,3,4,3,2,4],[2,9,10,2,7,9,2,3,7,7,4,9],[9,10,7,9,7,4,10,2,7,8,7,0,2,0,7],[3,7,10,3,10,2,7,4,10,1,10,0,4,0,10],[1,10,2,8,7,4],[4,9,1,4,1,7,7,1,3],[4,9,1,4,1,7,0,8,1,8,7,1],[4,0,3,7,4,3],[4,8,7],[9,10,8,10,11,8],[3,0,9,3,9,11,11,9,10],[0,1,10,0,10,8,8,10,11],[3,1,10,11,3,10],[1,2,11,1,11,9,9,11,8],[3,0,9,3,9,11,1,2,9,2,11,9],[0,2,11,8,0,11],[3,2,11],[2,3,8,2,8,10,10,8,9],[9,10,2,0,9,2],[2,3,8,2,8,10,0,1,8,1,10,8],[1,10,2],[1,3,8,9,1,8],[0,9,1],[0,3,8],[]]})(t=e.MarchingCubes||(e.MarchingCubes={}))})(t=e.Geometry||(e.Geometry={}))})(t=e.Core||(e.Core={}))})(p||(p={}));/* 443 * Copyright (c) 2016 - now David Sehnal, licensed under Apache 2.0, See LICENSE file for more info. 444 */ 445var p;(function(e){var t;(function(e){var t;(function(t){var r;(function(r){"use strict";var n=function(){function t(t){e.Utils.extend(this,t,{exactBoundary:false,boundaryDelta:{dx:1.5,dy:1.5,dz:1.5},probeRadius:1.4,atomRadii:function(){return 1},density:1.1,interactive:false,smoothingIterations:1});if(this.exactBoundary)this.boundaryDelta={dx:0,dy:0,dz:0};if(this.density<.05)this.density=.05}return t}();var i=function(){function r(e,t){this.inputParameters=e;this.ctx=t;this.minX=Number.MAX_VALUE;this.minY=Number.MAX_VALUE;this.minZ=Number.MAX_VALUE;this.maxX=-Number.MAX_VALUE;this.maxY=-Number.MAX_VALUE;this.maxZ=-Number.MAX_VALUE;this.nX=0;this.nY=0;this.nZ=0;this.dX=.1;this.dY=.1;this.dZ=.1;this.field=new Float32Array(0);this.distanceField=new Float32Array(0);this.proximityMap=new Int32Array(0);this.minIndex={i:0,j:0,k:0};this.maxIndex={i:0,j:0,k:0};this.parameters=new n(e.parameters);var r=e.positions;this.x=r.x;this.y=r.y;this.z=r.z;this.atomIndices=e.atomIndices;if(this.parameters.density>=.99){this.vdwScaleFactor=1.000000001}else{this.vdwScaleFactor=1+(1-this.parameters.density*this.parameters.density)}}r.prototype.findBounds=function(){for(var e=0,t=this.atomIndices;e<t.length;e++){var r=t[e];var n=this.parameters.exactBoundary?0:this.vdwScaleFactor*this.parameters.atomRadius(r)+this.parameters.probeRadius,i=this.x[r],a=this.y[r],o=this.z[r];if(n<0)continue;this.minX=Math.min(this.minX,i-n);this.minY=Math.min(this.minY,a-n);this.minZ=Math.min(this.minZ,o-n);this.maxX=Math.max(this.maxX,i+n);this.maxY=Math.max(this.maxY,a+n);this.maxZ=Math.max(this.maxZ,o+n)}if(this.minX===Number.MAX_VALUE){this.minX=this.minY=this.minZ=-1;this.maxX=this.maxY=this.maxZ=1}this.minX-=this.parameters.boundaryDelta.dx;this.minY-=this.parameters.boundaryDelta.dy;this.minZ-=this.parameters.boundaryDelta.dz;this.maxX+=this.parameters.boundaryDelta.dx;this.maxY+=this.parameters.boundaryDelta.dy;this.maxZ+=this.parameters.boundaryDelta.dz;this.nX=Math.floor((this.maxX-this.minX)*this.parameters.density);this.nY=Math.floor((this.maxY-this.minY)*this.parameters.density);this.nZ=Math.floor((this.maxZ-this.minZ)*this.parameters.density);this.nX=Math.min(this.nX,333);this.nY=Math.min(this.nY,333);this.nZ=Math.min(this.nZ,333);this.dX=(this.maxX-this.minX)/(this.nX-1);this.dY=(this.maxY-this.minY)/(this.nY-1);this.dZ=(this.maxZ-this.minZ)/(this.nZ-1)};r.prototype.initData=function(){var e=this.nX*this.nY*this.nZ;this.field=new Float32Array(e);this.distanceField=new Float32Array(e);this.proximityMap=new Int32Array(e);var t=Number.POSITIVE_INFINITY;for(var r=0,n=this.proximityMap.length;r<n;r++){this.distanceField[r]=t;this.proximityMap[r]=-1}};r.prototype.updateMinIndex=function(e,t,r){this.minIndex.i=Math.max(Math.floor((e-this.minX)/this.dX)|0,0);this.minIndex.j=Math.max(Math.floor((t-this.minY)/this.dY)|0,0);this.minIndex.k=Math.max(Math.floor((r-this.minZ)/this.dZ)|0,0)};r.prototype.updateMaxIndex=function(e,t,r){this.maxIndex.i=Math.min(Math.ceil((e-this.minX)/this.dX)|0,this.nX);this.maxIndex.j=Math.min(Math.ceil((t-this.minY)/this.dY)|0,this.nY);this.maxIndex.k=Math.min(Math.ceil((r-this.minZ)/this.dZ)|0,this.nZ)};r.prototype.addBall=function(e,t){var r=t*t;var n=this.x[e],i=this.y[e],a=this.z[e];this.updateMinIndex(n-t,i-t,a-t);this.updateMaxIndex(n+t,i+t,a+t);var o=this.minIndex.i,s=this.minIndex.j,u=this.minIndex.k;var l=this.maxIndex.i,c=this.maxIndex.j,f=this.maxIndex.k;n=this.minX-n;i=this.minY-i;a=this.minZ-a;for(var h=u;h<f;h++){var d=a+h*this.dZ,p=d*d,m=h*this.nY;for(var v=s;v<c;v++){var y=i+v*this.dY,g=p+y*y,b=this.nX*(m+v);for(var x=o;x<l;x++){var _=n+x*this.dX,w=g+_*_,C=b+x;var E=r/(1e-6+w)-1;if(w<this.distanceField[C]){this.proximityMap[C]=e;this.distanceField[C]=w}if(E>0){this.field[C]+=E}}}}};r.prototype.processChunks=function(){return m(this,void 0,void 0,function(){var t,r,n,i,a,o,s;return v(this,function(u){switch(u.label){case 0:t=1e4;r=e.Utils.PerformanceMonitor.currentTime();return[4,this.ctx.updateProgress("Creating field...",true)];case 1:u.sent();n=0,i=this.atomIndices.length;u.label=2;case 2:if(!(n<i))return[3,5];a=this.atomIndices[n];o=this.vdwScaleFactor*this.parameters.atomRadius(a)+this.parameters.probeRadius;if(o>=0){this.addBall(a,o)}if(!((n+1)%t===0))return[3,4];s=e.Utils.PerformanceMonitor.currentTime();if(!(s-r>e.Computation.UpdateProgressDelta))return[3,4];r=s;return[4,this.ctx.updateProgress("Creating field...",true,n,i)];case 3:u.sent();u.label=4;case 4:n++;return[3,2];case 5:return[2]}})})};r.prototype.finish=function(){var r=t.LinearAlgebra.Matrix4.zero();t.LinearAlgebra.Matrix4.fromTranslation(r,[this.minX,this.minY,this.minZ]);r[0]=this.dX;r[5]=this.dY;r[10]=this.dZ;var n={data:{scalarField:new e.Formats.Density.Field3DZYX(this.field,[this.nX,this.nY,this.nZ]),annotationField:this.parameters.interactive?new e.Formats.Density.Field3DZYX(this.proximityMap,[this.nX,this.nY,this.nZ]):void 0,isoLevel:.05},bottomLeft:t.LinearAlgebra.Vector3.fromValues(this.minX,this.minY,this.minZ),topRight:t.LinearAlgebra.Vector3.fromValues(this.maxX,this.maxY,this.maxZ),transform:r,inputParameters:this.inputParameters,parameters:this.parameters};this.distanceField=null;this.proximityMap=null;return n};r.prototype.run=function(){return m(this,void 0,void 0,function(){return v(this,function(e){switch(e.label){case 0:return[4,this.ctx.updateProgress("Initializing...")];case 1:e.sent();this.findBounds();this.initData();return[4,this.processChunks()];case 2:e.sent();return[4,this.ctx.updateProgress("Finalizing...",void 0,this.atomIndices.length,this.atomIndices.length)];case 3:e.sent();return[2,this.finish()]}})})};return r}();function a(t){var r=this;return e.computation(function(e){return m(r,void 0,void 0,function(){var r;return v(this,function(n){switch(n.label){case 0:r=new i(t,e);return[4,r.run()];case 1:return[2,n.sent()]}})})})}r.createMolecularIsoFieldAsync=a;function o(r){var n=this;return e.computation(function(e){return m(n,void 0,void 0,function(){var n,i,o,s;return v(this,function(u){switch(u.label){case 0:return[4,a(r).run(e)];case 1:n=u.sent();return[4,t.MarchingCubes.compute(n.data).run(e)];case 2:i=u.sent();return[4,t.Surface.transform(i,n.transform).run(e)];case 3:i=u.sent();o=r.parameters&&r.parameters.smoothingIterations||1;s=1;if(r.parameters&&r.parameters.density<1){s=2/r.parameters.density}return[4,t.Surface.laplacianSmooth(i,o,s).run(e)];case 4:i=u.sent();return[2,{surface:i,usedParameters:n.parameters}]}})})})}r.computeMolecularSurfaceAsync=o})(r=t.MolecularSurface||(t.MolecularSurface={}))})(t=e.Geometry||(e.Geometry={}))})(t=e.Core||(e.Core={}))})(p||(p={}));/* 446 * Copyright (c) 2016 - now David Sehnal, licensed under Apache 2.0, See LICENSE file for more info. 447 */ 448var p;(function(e){var t;(function(e){var t;(function(t){"use strict";var r=e.Utils.DataTable;var n=function(){function t(t){this.id=t;this.map=e.Utils.FastMap.create()}t.prototype.add=function(t,r,n,i){if(i===void 0){i=true}var a=this.map.get(t);if(a!==void 0){var o=a.get(r);if(o===void 0){a.set(r,n)}}else{var s=e.Utils.FastMap.create();s.set(r,n);this.map.set(t,s)}if(i)this.add(r,t,n,false)};return t}();t.ComponentBondInfoEntry=n;var i=function(){function t(){this.entries=e.Utils.FastMap.create()}t.prototype.newEntry=function(e){var t=new n(e);this.entries.set(e,t);return t};return t}();t.ComponentBondInfo=i;var a=function(){function e(e,t,r){this.asymId=e;this.seqNumber=t;this.insCode=r}e.areEqual=function(e,t,r,n,i){return e.asymId===r[t]&&e.seqNumber===n[t]&&e.insCode===i[t]};e.compare=function(e,t){if(e.asymId===t.asymId){if(e.seqNumber===t.seqNumber){if(e.insCode===t.insCode)return 0;if(e.insCode===void 0)return-1;if(t.insCode===void 0)return 1;return e.insCode<t.insCode?-1:1}return e.seqNumber<t.seqNumber?-1:1}return e.asymId<t.asymId?-1:1};e.compareResidue=function(e,t,r,n,i){if(e.asymId===r[t]){if(e.seqNumber===n[t]){if(e.insCode===i[t])return 0;if(e.insCode===void 0)return-1;if(i[t]===void 0)return 1;return e.insCode<i[t]?-1:1}return e.seqNumber<n[t]?-1:1}return e.asymId<r[t]?-1:1};return e}();t.PolyResidueIdentifier=a;var o=function(){function e(e,t,r,n){if(n===void 0){n={}}
448this.type=e;this.startResidueId=t;this.endResidueId=r;this.info=n;this.startResidueIndex=-1;this.endResidueIndex=-1}Object.defineProperty(e.prototype,"length",{get:function(){return this.endResidueIndex-this.startResidueIndex},enumerable:true,configurable:true});return e}();t.SecondaryStructureElement=o;var s=function(){function e(e,t,r,n,i){this.spacegroupName=e;this.cellSize=t;this.cellAngles=r;this.toFracTransform=n;this.isNonStandardCrytalFrame=i}return e}();t.SymmetryInfo=s;var u=function(){function t(e){this.entries=e;this._residuePairIndex=void 0;this._atomIndex=void 0}t._resKey=function(e,t){if(e<t)return e+"-"+t;return t+"-"+e};t.prototype.getResiduePairIndex=function(){if(this._residuePairIndex)return this._residuePairIndex;this._residuePairIndex=e.Utils.FastMap.create();for(var r=0,n=this.entries;r<n.length;r++){var i=n[r];var a=i.partners;var o=a.length;for(var s=0;s<o-1;s++){for(var u=s+s;u<o;u++){var l=t._resKey(a[s].residueIndex,a[u].residueIndex);if(this._residuePairIndex.has(l)){this._residuePairIndex.get(l).push(i)}else{this._residuePairIndex.set(l,[i])}}}}return this._residuePairIndex};t.prototype.getAtomIndex=function(){if(this._atomIndex)return this._atomIndex;this._atomIndex=e.Utils.FastMap.create();for(var t=0,r=this.entries;t<r.length;t++){var n=r[t];for(var i=0,a=n.partners;i<a.length;i++){var o=a[i];var s=o.atomIndex;if(this._atomIndex.has(s)){this._atomIndex.get(s).push(n)}else{this._atomIndex.set(s,[n])}}}return this._atomIndex};t.prototype.getResidueEntries=function(e,r){return this.getResiduePairIndex().get(t._resKey(e,r))||t._emptyEntry};t.prototype.getAtomEntries=function(e){return this.getAtomIndex().get(e)||t._emptyEntry};t._emptyEntry=[];return t}();t.StructConn=u;var l=function(){function e(e,t,r){this.id=e;this.name=t;this.operator=r}return e}();t.AssemblyOperator=l;var c=function(){function e(e,t){this.operators=e;this.asymIds=t}return e}();t.AssemblyGenEntry=c;var f=function(){function e(e){this.name=e;this.gens=[]}return e}();t.AssemblyGen=f;var h=function(){function e(e,t){this.operators=e;this.assemblies=t}return e}();t.AssemblyInfo=h;var d;(function(e){var t=r.typedColumn(Int32Array);var n=r.typedColumn(Float32Array);var i=r.stringColumn;var a=r.stringNullColumn;e.Positions={x:n,y:n,z:n};e.Atoms={id:t,altLoc:i,residueIndex:t,chainIndex:t,entityIndex:t,name:i,elementSymbol:i,occupancy:n,tempFactor:n,authName:i,rowIndex:t};e.Residues={name:i,seqNumber:t,asymId:i,authName:i,authSeqNumber:t,authAsymId:i,insCode:a,entityId:i,isHet:r.typedColumn(Int8Array),atomStartIndex:t,atomEndIndex:t,chainIndex:t,entityIndex:t,secondaryStructureIndex:t};e.Chains={asymId:i,entityId:i,authAsymId:i,atomStartIndex:t,atomEndIndex:t,residueStartIndex:t,residueEndIndex:t,entityIndex:t,sourceChainIndex:void 0,operatorIndex:void 0};e.Entities={entityId:i,type:r.customColumn(),atomStartIndex:t,atomEndIndex:t,residueStartIndex:t,residueEndIndex:t,chainStartIndex:t,chainEndIndex:t};e.Bonds={atomAIndex:t,atomBIndex:t,type:r.typedColumn(Int8Array)};e.ModifiedResidues={asymId:i,seqNumber:t,insCode:a,parent:i,details:a}})(d=t.Tables||(t.Tables={}));var p=function(){function t(e,t,r){this.matrix=e;this.id=t;this.isIdentity=r}t.prototype.apply=function(t){e.Geometry.LinearAlgebra.Vector3.transformMat4(t,t,this.matrix)};t.applyToModelUnsafe=function(t,r){var n=e.Geometry.LinearAlgebra.Vector3.zero();var i=r.positions,a=i.x,o=i.y,s=i.z;for(var u=0,l=r.positions.count;u<l;u++){n[0]=a[u];n[1]=o[u];n[2]=s[u];e.Geometry.LinearAlgebra.Vector3.transformMat4(n,n,t);a[u]=n[0];o[u]=n[1];s[u]=n[2]}};return t}();t.Operator=p;var m;(function(r){function n(e,t,r){if(r===void 0){r={}}return{id:e,models:t,properties:r}}r.create=n;var i;(function(r){function n(r){var n=e.Utils.extend({},r);var i=void 0;Object.defineProperty(n,"queryContext",{enumerable:true,configurable:false,get:function(){if(i)return i;i=t.Query.Context.ofStructure(n);return i}});return n}r.create=n;var i;(function(e){e[e["File"]=0]="File";e[e["Computed"]=1]="Computed"})(i=r.Source||(r.Source={}));function a(t,r,i){var a=t.positions,o=a.x,s=a.y,u=a.z;var l=t.positions.getBuilder(t.positions.count).seal();var c=l.x,f=l.y,h=l.z;var d=e.Geometry.LinearAlgebra.Vector3.zero();for(var p=0,m=t.positions.count;p<m;p++){i(r,o[p],s[p],u[p],d);c[p]=d[0];f[p]=d[1];h[p]=d[2]}return n({id:t.id,modelId:t.modelId,data:t.data,positions:l,parent:t.parent,source:t.source,operators:t.operators})}r.withTransformedXYZ=a})(i=r.Model||(r.Model={}))})(m=t.Molecule||(t.Molecule={}))})(t=e.Structure||(e.Structure={}))})(t=e.Core||(e.Core={}))})(p||(p={}));/* 449 * Copyright (c) 2017 - now David Sehnal, licensed under Apache 2.0, See LICENSE file for more info. 450 */ 451var p;(function(e){var t;(function(e){var t;(function(t){"use strict";function r(e){return e>=0&&e<=5}t.isBondTypeCovalent=r;var n={H:0,h:0,D:0,d:0,T:0,t:0,He:2,HE:2,he:2,Li:3,LI:3,li:3,Be:4,BE:4,be:4,B:5,b:5,C:6,c:6,N:7,n:7,O:8,o:8,F:9,f:9,Ne:10,NE:10,ne:10,Na:11,NA:11,na:11,Mg:12,MG:12,mg:12,Al:13,AL:13,al:13,Si:14,SI:14,si:14,P:15,p:15,S:16,s:16,Cl:17,CL:17,cl:17,Ar:18,AR:18,ar:18,K:19,k:19,Ca:20,CA:20,ca:20,Sc:21,SC:21,sc:21,Ti:22,TI:22,ti:22,V:23,v:23,Cr:24,CR:24,cr:24,Mn:25,MN:25,mn:25,Fe:26,FE:26,fe:26,Co:27,CO:27,co:27,Ni:28,NI:28,ni:28,Cu:29,CU:29,cu:29,Zn:30,ZN:30,zn:30,Ga:31,GA:31,ga:31,Ge:32,GE:32,ge:32,As:33,AS:33,as:33,Se:34,SE:34,se:34,Br:35,BR:35,br:35,Kr:36,KR:36,
451kr:36,Rb:37,RB:37,rb:37,Sr:38,SR:38,sr:38,Y:39,y:39,Zr:40,ZR:40,zr:40,Nb:41,NB:41,nb:41,Mo:42,MO:42,mo:42,Tc:43,TC:43,tc:43,Ru:44,RU:44,ru:44,Rh:45,RH:45,rh:45,Pd:46,PD:46,pd:46,Ag:47,AG:47,ag:47,Cd:48,CD:48,cd:48,In:49,IN:49,in:49,Sn:50,SN:50,sn:50,Sb:51,SB:51,sb:51,Te:52,TE:52,te:52,I:53,i:53,Xe:54,XE:54,xe:54,Cs:55,CS:55,cs:55,Ba:56,BA:56,ba:56,La:57,LA:57,la:57,Ce:58,CE:58,ce:58,Pr:59,PR:59,pr:59,Nd:60,ND:60,nd:60,Pm:61,PM:61,pm:61,Sm:62,SM:62,sm:62,Eu:63,EU:63,eu:63,Gd:64,GD:64,gd:64,Tb:65,TB:65,tb:65,Dy:66,DY:66,dy:66,Ho:67,HO:67,ho:67,Er:68,ER:68,er:68,Tm:69,TM:69,tm:69,Yb:70,YB:70,yb:70,Lu:71,LU:71,lu:71,Hf:72,HF:72,hf:72,Ta:73,TA:73,ta:73,W:74,w:74,Re:75,RE:75,re:75,Os:76,OS:76,os:76,Ir:77,IR:77,ir:77,Pt:78,PT:78,pt:78,Au:79,AU:79,au:79,Hg:80,HG:80,hg:80,Tl:81,TL:81,tl:81,Pb:82,PB:82,pb:82,Bi:83,BI:83,bi:83,Po:84,PO:84,po:84,At:85,AT:85,at:85,Rn:86,RN:86,rn:86,Fr:87,FR:87,fr:87,Ra:88,RA:88,ra:88,Ac:89,AC:89,ac:89,Th:90,TH:90,th:90,Pa:91,PA:91,pa:91,U:92,u:92,Np:93,NP:93,np:93,Pu:94,PU:94,pu:94,Am:95,AM:95,am:95,Cm:96,CM:96,cm:96,Bk:97,BK:97,bk:97,Cf:98,CF:98,cf:98,Es:99,ES:99,es:99,Fm:100,FM:100,fm:100,Md:101,MD:101,md:101,No:102,NO:102,no:102,Lr:103,LR:103,lr:103,Rf:104,RF:104,rf:104,Db:105,DB:105,db:105,Sg:106,SG:106,sg:106,Bh:107,BH:107,bh:107,Hs:108,HS:108,hs:108,Mt:109,MT:109,mt:109};var i={0:1.42,1:1.42,3:2.7,4:2.7,6:1.75,7:1.6,8:1.52,11:2.7,12:2.7,13:2.7,14:1.9,15:1.9,16:1.9,17:1.8,19:2.7,20:2.7,21:2.7,22:2.7,23:2.7,24:2.7,25:2.7,26:2.7,27:2.7,28:2.7,29:2.7,30:2.7,31:2.7,33:2.68,37:2.7,38:2.7,39:2.7,40:2.7,41:2.7,42:2.7,43:2.7,44:2.7,45:2.7,46:2.7,47:2.7,48:2.7,49:2.7,50:2.7,55:2.7,56:2.7,57:2.7,58:2.7,59:2.7,60:2.7,61:2.7,62:2.7,63:2.7,64:2.7,65:2.7,66:2.7,67:2.7,68:2.7,69:2.7,70:2.7,71:2.7,72:2.7,73:2.7,74:2.7,75:2.7,76:2.7,77:2.7,78:2.7,79:2.7,80:2.7,81:2.7,82:2.7,83:2.7,87:2.7,88:2.7,89:2.7,90:2.7,91:2.7,92:2.7,93:2.7,94:2.7,95:2.7,96:2.7,97:2.7,98:2.7,99:2.7,100:2.7,101:2.7,102:2.7,103:2.7,104:2.7,105:2.7,106:2.7,107:2.7,108:2.7,109:2.88};var a={0:.8,20:1.31,27:1.3,35:1.3,44:1.05,54:1,60:1.84,72:1.88,84:1.75,85:1.56,86:1.76,98:1.6,99:1.68,100:1.63,112:1.55,113:1.59,114:1.36,129:1.45,144:1.6,170:1.4,180:1.55,202:2.4,222:2.24,224:1.91,225:1.98,243:2.02,269:2,293:1.9,480:2.3,512:2.3,544:2.3,612:2.1,629:1.54,665:1,813:2.6,854:2.27,894:1.93,896:2.1,937:2.05,938:2.06,981:1.62,1258:2.68,1309:2.33,1484:1,1763:2.14,1823:2.48,1882:2.1,1944:1.72,2380:2.34,3367:2.44,3733:2.11,3819:2.6,3821:2.36,4736:2.75,5724:2.73,5959:2.63,6519:2.84,6750:2.87,8991:2.81};var o=2.001;var s=function(){var t=["LI","NA","K","RB","CS","FR","BE","MG","CA","SR","BA","RA","AL","GA","IN","SN","TL","PB","BI","SC","TI","V","CR","MN","FE","CO","NI","CU","ZN","Y","ZR","NB","MO","TC","RU","RH","PD","AG","CD","LA","HF","TA","W","RE","OS","IR","PT","AU","HG","AC","RF","DB","SG","BH","HS","MT","CE","PR","ND","PM","SM","EU","GD","TB","DY","HO","ER","TM","YB","LU","TH","PA","U","NP","PU","AM","CM","BK","CF","ES","FM","MD","NO","LR"];var r=e.Utils.FastSet.create();for(var i=0,a=t;i<a.length;i++){var o=a[i];r.add(n[o])}return r}();function u(e,t){if(e<t)return(e+t)*(e+t+1)/2+t;else return(e+t)*(e+t+1)/2+e}function l(e){var t=n[e];if(t===void 0)return-1;return t}function c(e,t){if(e<0||t<0)return-1;var r=a[u(e,t)];if(r===void 0)return-1;return r}function f(e){if(e<0)return o;var t=i[e];if(t===void 0)return o;return t}var h=n["H"];function d(e){return e===h}function p(e){var t=n[e];if(t===void 0)return false;return s.has(t)}function m(r,n){var i=r.data.bonds.input;if(n.length===r.data.atoms.count)return i;var a=e.Utils.Mask.ofIndices(r.data.atoms.count,n);var o=i.atomAIndex,s=i.atomBIndex,u=i.type;var l=0;for(var c=0,f=i.count;c<f;c++){if(!a.has(o[c])||!a.has(s[c]))continue;l++}var h=e.Utils.DataTable.ofDefinition(t.Tables.Bonds,l);var d=h.atomAIndex,m=h.atomBIndex,v=h.type;var y=r.data.atoms.elementSymbol;var g=0;for(var c=0,f=i.count;c<f;c++){var b=o[c],x=s[c];if(!a.has(b)||!a.has(x))continue;d[g]=b;m[g]=x;var _=p(y[b])||p(y[x]);v[g]=_?6:u[c];g++}return h}var v=e.Utils.ChunkedArray.add;function y(e,t){var r=e.model,n=e.mask,i=e.atomA,a=e.atomB,o=e.type;var s=r.data.residues,u=s.atomStartIndex,l=s.atomEndIndex,c=s.name;var f=r.data.atoms,h=f.name,d=f.altLoc,m=f.elementSymbol;var y=r.data.bonds.component.entries.get(c[t]).map;var g=u[t],b=l[t];for(var x=g;x<b-1;x++){if(!n.has(x))continue;var _=y.get(h[x]);if(!_)continue;var w=d[x];var C=p(m[x]);for(var E=x+1;E<b;E++){if(!n.has(E))continue;var S=d[E];if(w&&S&&w!==S)continue;var T=_.get(h[E]);if(T===void 0)continue;var M=C||p(m[E]);v(i,x);v(a,E);v(o,M?6:T)}}}function g(t,r,n){var i=3;var a=t.data.bonds,o=a.structConn,u=a.component;var h=t.positions,p=h.x,m=h.y,g=h.z;var b=t.data.atoms,x=b.elementSymbol,_=b.residueIndex,w=b.altLoc;var C=t.data.residues.name;var E=t.queryContext.lookup3d();var S=e.Utils.ChunkedArray.create(function(e){return new Int32Array(e)},r.length*1.33|0,1);var T=e.Utils.ChunkedArray.create(function(e){return new Int32Array(e)},r.length*1.33|0,1);var M=e.Utils.ChunkedArray.create(function(e){return new Uint8Array(e)},r.length*1.33|0,1);var A=e.Utils.Mask.ofIndices(t.data.atoms.count,r);var P={model:t,mask:A,atomA:S,atomB:T,type:M};var R=-1;var k=false;for(var I=0,D=r;I<D.length;I++){var B=D[I];var L=_[B];if(!n.forceCompute&&L!==R){k=!!u&&u.entries.has(C[L]);if(k){y(P,L)}}R=L;var F=l(x[B]);var V=E(p[B],m[B],g[B],i),O=V.elements,U=V.count,N=V.squaredDistances;var z=d(F);var H=f(F);var j=w[B];var G=s.has(F);var W=n.forceCompute?void 0:o&&o.getAtomEntries(B);for(var q=0;q<U;q++){var X=O[q];if(X<=B||!A.has(X))continue;var Y=w[X];if(j&&Y&&j!==Y)continue;var K=_[X];if(L===K&&k)continue;var Q=l(x[X]);var Z=d(Q);if(z&&Z)continue;var J=Math.sqrt(N[q]);if(J===0)continue;if(W){var $=false;for(var ee=0,te=W;ee<te.length;ee++){var re=te[ee];for(var ne=0,ie=re.partners;ne<ie.length;ne++){var ae=ie[ne];if(ae.atomIndex===X){v(S,B);v(T,X);v(M,re.bondType);$=true;break}}if($)break}if($)continue}if(z||Z){if(J<n.maxHbondLength){v(S,B);v(T,X);v(M,1)}continue}var oe=c(F,Q);var se=oe>0?oe:Q<0?H:Math.max(H,f(Q));var ue=s.has(Q);if(J<=se){v(S,B);v(T,X);v(M,G||ue?6:1)}}}var le=e.Utils.DataTable.builder(S.elementCount);le.addRawColumn("atomAIndex",function(e){return new Int32Array(e)},e.Utils.ChunkedArray.compact(S));le.addRawColumn("atomBIndex",function(e){return new Int32Array(e)},e.Utils.ChunkedArray.compact(T));le.addRawColumn("type",function(e){return new Uint8Array(e)},e.Utils.ChunkedArray.compact(M));var ce=le.seal();return ce}function b(e,t,r){if(e.data.bonds.input)return m(e,t);return g(e,t,{maxHbondLength:r&&r.maxHbondLength||1.15,forceCompute:!!(r&&r.forceCompute)})}t.computeBonds=b})(t=e.Structure||(e.Structure={}))})(t=e.Core||(e.Core={}))})(p||(p={}));/* 452 * Copyright (c) 2016 - now David Sehnal, licensed under Apache 2.0, See LICENSE file for more info. 453 */ 454var p;(function(e){var t;(function(e){var t;(function(t){"use strict";var r=e.Geometry.LinearAlgebra.Matrix4;var n=e.Geometry.LinearAlgebra.Vector4;var i=function(){function e(e){this.info=e;this.temp=r.zero();this.tempV=new Float64Array(4);if(a.Spacegroup[e.spacegroupName]===void 0){throw"'"+e.spacegroupName+"' is not a spacegroup recognized by the library."}this.space=this.getSpace();this.operators=this.getOperators()}Object.defineProperty(e.prototype,"operatorCount",{get:function(){return this.operators.length},enumerable:true,configurable:true});e.prototype.getOperatorMatrix=function(e,t,n,i,a){this.tempV[0]=t;this.tempV[1]=n;this.tempV[2]=i;r.fromTranslation(this.temp,this.tempV);r.mul(a,r.mul(a,r.mul(a,this.space.fromFrac,this.temp),this.operators[e]),this.space.toFrac);return a};e.prototype.getSpace=function(){var e=this.info.toFracTransform,t=r.zero();r.invert(t,e);return{toFrac:e,fromFrac:t,baseX:n.transform(n.zero(),n.fromValues(1,0,0,1),e),baseY:n.transform(n.zero(),n.fromValues(0,1,0,1),e),baseZ:n.transform(n.zero(),n.fromValues(0,0,1,1),e)}};e.getOperator=function(e){var t=a.Transform[e[0]],n=a.Transform[e[1]],i=a.Transform[e[2]];return r.ofRows([t,n,i,[0,0,0,1]])};e.prototype.getOperators=function(){var t=a.Group[a.Spacegroup[this.info.spacegroupName]];return t.map(function(t){return e.getOperator(a.Operator[t])})};return e}();t.Spacegroup=i;var a;(function(e){e.Transform=[[1,0,0,0],[0,1,0,0],[0,0,1,0],[-1,0,0,0],[0,-1,0,0],[0,0,-1,0],[0,1,0,.5],[1,0,0,.5],[-1,0,0,.5],[0,0,1,.5],[0,-1,0,.5],[0,0,-1,.5],[1,0,0,.25],[0,-1,0,.25],[0,0,1,.25],[-1,0,0,.25],[0,1,0,.25],[0,-1,0,.75],[0,0,1,.75],[0,1,0,.75],[1,0,0,.75],[-1,0,0,.75],[0,0,-1,.25],[0,0,-1,.75],[1,-1,0,0],[-1,1,0,0],[0,0,1,.333333333333333],[0,0,1,.666666666666667],[1,0,0,.666666666666667],[0,1,0,.333333333333333],[0,-1,0,.666666666666667],[1,-1,0,.333333333333333],[-1,1,0,.666666666666667],[-1,0,0,.333333333333333],[1,0,0,.333333333333333],[0,1,0,.666666666666667],[0,-1,0,.333333333333333],[1,-1,0,.666666666666667],[-1,1,0,.333333333333333],[-1,0,0,.666666666666667],[0,0,-1,.333333333333333],[0,0,-1,.666666666666667],[0,0,1,.833333333333333],[0,0,1,.166666666666667],[0,0,-1,.833333333333333],[0,0,-1,.166666666666667]];e.Operator=[[0,1,2],[3,4,5],[3,1,5],[3,6,5],[7,6,2],[8,6,5],[0,4,2],[0,4,9],[7,10,2],[7,10,9],[0,10,2],[8,10,5],[3,1,11],[3,6,11],[0,10,9],[8,6,11],[3,4,2],[0,4,5],[3,4,9],[7,10,5],[8,4,9],[8,10,9],[8,10,2],[0,6,9],[3,10,9],[0,10,11],[7,1,9],[8,1,11],[7,4,11],[7,6,9],[7,10,11],[3,10,2],[8,1,5],[0,4,11],[3,1,2],[3,1,9],[7,4,2],[8,1,2],[8,1,9],[3,6,9],[7,4,9],[8,6,2],[8,6,9],[3,6,2],[12,13,14],[15,16,14],[12,17,18],[15,19,18],[20,13,18],[21,16,18],[20,17,14],[21,19,14],[0,1,5],[8,10,11],[7,6,11],[7,6,5],[8,4,2],[7,4,5],[7,1,5],[7,1,11],[0,10,5],[0,1,11],[0,6,11],[0,6,5],[3,10,11],[8,4,11],[15,13,22],[12,16,22],[15,17,23],[12,19,23],[21,13,23],[20,16,23],[21,17,22],[20,19,22],[4,0,2],[1,3,2],[4,0,14],[1,3,18],[4,0,9],[1,3,9],[4,0,18],[1,3,14],[10,7,9],[6,8,9],[4,7,14],[6,3,18],[10,0,18],[1,8,14],[1,3,5],[4,0,5],[6,8,11],[10,7,11],[1,3,11],[4,0,11],[10,7,2],[6,8,2],[3,10,22],[7,1,23],[8,4,23],[0,6,22],[1,0,5],[4,3,5],[1,0,23],[4,3,22],[10,7,14],[6,8,18],[8,6,22],[7,10,23],[4,3,11],[1,0,11],[1,0,22],[4,3,23],[10,7,18],[6,8,14],[8,6,23],[7,10,22],[6,7,11],[10,8,11],[8,1,23],[0,10,22],[3,6,22],[7,4,23],[4,3,2],[1,0,2],[10,8,2],[6,7,2],[4,3,9],[1,0,9],[10,8,9],[6,7,9],[4,8,14],[6,0,18],[10,3,18],[1,7,14],[4,8,18],[6,0,14],[10,3,14],[1,7,18],[6,7,5],[10,8,5],[6,8,5],[10,7,5],[8,1,22],[0,10,23],[3,6,23],[7,4,22],[4,24,2],[25,3,2],[4,24,26],[25,3,27],[4,24,27],[25,3,26],[28,29,26],[30,31,26],[32,33,26],[34,35,27],[36,37,27],[38,39,27],[2,0,1],[1,2,0],[1,25,5],[24,0,5],[39,36,40],[35,38,40],[37,34,40],[33,30,41],[29,32,41],[31,28,41],[5,3,4],[4,5,3],[25,1,5],[0,24,5],[24,4,5],[3,25,5],[4,3,41],[25,
4541,40],[24,4,41],[3,25,40],[4,3,40],[25,1,41],[24,4,40],[3,25,41],[35,34,40],[37,36,40],[39,38,40],[29,28,41],[31,30,41],[33,32,41],[3,5,4],[5,4,3],[25,1,2],[0,24,2],[24,4,2],[3,25,2],[25,1,9],[0,24,9],[24,4,9],[3,25,9],[30,33,26],[32,29,26],[28,31,26],[36,39,27],[38,35,27],[34,37,27],[0,2,1],[2,1,0],[30,33,42],[32,29,42],[28,31,42],[36,39,43],[38,35,43],[34,37,43],[7,9,6],[9,6,7],[25,1,11],[0,24,11],[24,4,11],[3,25,11],[35,34,44],[37,36,44],[39,38,44],[29,28,45],[31,30,45],[33,32,45],[8,11,10],[11,10,8],[1,25,2],[24,0,2],[1,25,42],[24,0,43],[1,25,43],[24,0,42],[1,25,27],[24,0,26],[1,25,26],[24,0,27],[1,25,9],[24,0,9],[4,24,5],[25,3,5],[4,24,11],[25,3,11],[1,0,40],[4,3,44],[0,24,45],[1,0,41],[4,3,45],[0,24,44],[0,24,40],[0,24,41],[2,3,4],[5,3,1],[5,0,4],[4,2,3],[1,5,3],[4,5,0],[2,7,6],[2,8,10],[5,8,6],[5,7,10],[1,9,7],[4,9,8],[1,11,8],[4,11,7],[9,0,6],[9,3,10],[11,3,6],[11,0,10],[6,2,7],[10,2,8],[6,5,8],[10,5,7],[9,7,1],[9,8,4],[11,8,1],[11,7,4],[6,9,0],[10,9,3],[6,11,3],[10,11,0],[9,7,6],[9,8,10],[11,8,6],[11,7,10],[6,9,7],[10,9,8],[6,11,8],[10,11,7],[2,3,10],[5,8,1],[11,0,4],[10,2,3],[1,5,8],[4,11,0],[5,0,1],[2,0,4],[2,3,1],[1,5,0],[4,2,0],[1,2,3],[11,8,10],[11,7,6],[9,7,10],[9,8,6],[10,11,8],[6,11,7],[10,9,7],[6,9,8],[5,8,10],[5,7,6],[2,7,10],[2,8,6],[4,11,8],[1,11,7],[4,9,7],[1,9,8],[11,3,10],[11,0,6],[9,0,10],[9,3,6],[10,5,8],[6,5,7],[10,2,7],[6,2,8],[11,8,4],[11,7,1],[9,7,4],[9,8,1],[10,11,3],[6,11,0],[10,9,0],[6,9,3],[22,15,13],[22,12,16],[14,12,13],[14,15,16],[13,22,15],[16,22,12],[13,14,12],[16,14,15],[22,21,17],[22,20,19],[14,20,17],[14,21,19],[13,23,21],[16,23,20],[13,18,20],[16,18,21],[23,15,17],[23,12,19],[18,12,17],[18,15,19],[17,22,21],[19,22,20],[17,14,20],[19,14,21],[23,21,13],[23,20,16],[18,20,13],[18,21,16],[17,23,15],[19,23,12],[17,18,12],[19,18,15],[5,0,6],[2,7,4],[9,3,1],[6,5,0],[4,2,7],[1,9,3],[0,2,4],[3,2,1],[0,5,1],[2,1,3],[2,4,0],[5,1,0],[7,9,10],[8,9,6],[7,11,6],[9,6,8],[9,10,7],[11,6,7],[1,7,11],[4,8,11],[1,8,9],[4,7,9],[0,9,10],[3,9,6],[3,11,10],[0,11,6],[2,6,8],[2,10,7],[5,6,7],[5,10,8],[6,0,11],[10,3,11],[6,3,9],[10,0,9],[7,2,10],[8,2,6],[8,5,10],[7,5,6],[9,1,8],[9,4,7],[11,1,7],[11,4,8],[7,9,4],[8,9,1],[8,11,4],[7,11,1],[9,6,3],[9,10,0],[11,6,0],[11,10,3],[19,12,23],[13,15,22],[16,21,18],[17,20,14],[20,14,17],[21,18,16],[15,22,13],[12,23,19],[18,16,21],[14,17,20],[23,19,12],[22,13,15],[19,20,22],[13,21,23],[16,15,14],[17,12,18],[20,18,13],[21,14,19],[15,23,17],[12,22,16],[18,19,15],[14,13,12],[23,16,20],[22,17,21],[16,12,22],[17,15,23],[19,21,14],[13,20,18],[12,14,13],[15,18,19],[21,22,17],[20,23,16],[14,16,15],[18,17,12],[22,19,20],[23,13,21],[16,20,23],[17,21,22],[19,15,18],[13,12,14],[12,18,17],[15,14,16],[21,23,13],[20,22,19],[14,19,21],[18,13,20],[22,16,12],[23,17,15],[19,12,22],[17,21,23],[16,15,18],[13,20,14],[20,14,13],[15,18,16],[21,23,17],[12,22,19],[18,16,15],[14,13,20],[22,19,12],[23,17,21],[3,2,4],[3,5,1],[0,5,4],[2,4,3],[5,1,3],[5,4,0],[1,7,9],[4,8,9],[1,8,11],[4,7,11],[0,9,6],[3,9,10],[3,11,6],[0,11,10],[2,6,7],[2,10,8],[5,6,8],[5,10,7],[6,0,9],[10,3,9],[6,3,11],[10,0,11],[7,2,6],[8,2,10],[8,5,6],[7,5,10],[9,1,7],[9,4,8],[11,1,8],[11,4,7],[7,9,1],[8,9,4],[8,11,1],[7,11,4],[9,6,0],[9,10,3],[11,6,3],[11,10,0],[8,9,10],[8,11,6],[7,11,10],[9,10,8],[11,6,8],[11,10,7],[6,0,2],[10,3,2],[6,3,5],[10,0,5],[7,2,1],[8,2,4],[8,5,1],[7,5,4],[9,1,0],[9,4,3],[11,1,3],[11,4,0],[1,7,2],[4,8,2],[1,8,5],[4,7,5],[0,9,1],[3,9,4],[3,11,1],[0,11,4],[2,6,0],[2,10,3],[5,6,3],[5,10,0],[0,2,6],[3,2,10],[3,5,6],[0,5,10],[2,1,7],[2,4,8],[5,1,8],[5,4,7],[16,12,14],[13,21,18],[19,15,23],[17,20,22],[12,14,16],[21,18,13],[15,23,19],[20,22,17],[14,16,12],[18,13,21],[23,19,15],[22,17,20],[19,20,18],[17,15,14],[16,21,22],[13,12,23],[20,18,19],[15,14,17],[21,22,16],[12,23,13],[18,19,20],[14,17,15],[22,16,21],[23,13,12],[6,0,5],[10,3,5],[6,3,2],[10,0,2],[7,2,4],[8,2,1],[8,5,4],[7,5,1],[9,1,3],[9,4,0],[11,1,0],[11,4,3],[1,7,5],[4,8,5],[1,8,2],[4,7,2],[0,9,4],[3,9,1],[3,11,4],[0,11,1],[2,6,3],[2,10,0],[5,6,0],[5,10,3],[0,2,10],[3,2,6],[3,5,10],[0,5,6],[2,1,8],[2,4,7],[5,1,7],[5,4,8],[21,17,23],[20,16,22],[12,13,18],[15,19,14],[23,21,17],[22,20,16],[18,12,13],[14,15,19],[17,23,21],[16,22,20],[13,18,12],[19,14,15],[21,13,22],[20,19,23],[12,17,14],[15,16,18],[23,15,13],[22,12,19],[18,20,17],[14,21,16],[17,22,15],[16,23,12],[13,14,20],[19,18,21],[15,17,22],[12,16,23],[20,13,14],[21,19,18],[22,21,13],[23,20,19],[14,12,17],[18,15,16],[13,23,15],[19,22,12],[17,18,20],[16,14,21],[15,13,23],[12,19,22],[20,17,18],[21,16,14],[22,15,17],[23,12,16],[14,20,13],[18,21,19],[13,22,21],[19,23,20],[17,14,12],[16,18,15],[6,5,3],[4,9,3],[9,3,4],[5,7,4],[4,5,7],[5,3,6]];e.Group
vendor: 16,124 bytes, line 454
454=[[0],[0,1],[0,2],[0,3],[0,2,4,5],[0,6],[0,7],[0,6,4,8],[0,7,4,9],[0,6,2,1],[0,3,1,10],[0,6,2,1,4,8,5,11],[0,12,1,7],[0,1,13,14],[0,12,1,7,4,15,11,9],[0,16,2,17],[0,18,12,17],[0,16,5,19],[0,20,13,19],[0,18,12,17,4,21,15,19],[0,16,2,17,4,22,5,19],[0,16,2,17,23,24,13,25,26,20,27,28,4,22,5,19],[0,16,17,2,29,21,30,15],[0,20,13,19,29,31,32,33],[0,16,6,34],[0,18,7,34],[0,16,7,35],[0,16,36,37],[0,18,36,38],[0,16,14,39],[0,20,40,34],[0,16,8,41],[0,18,8,42],[0,16,9,42],[0,16,6,34,4,22,8,41],[0,18,7,34,4,21,9,41],[0,16,7,35,4,22,9,42],[0,16,6,34,23,24,14,39],[0,16,10,43,23,24,7,35],[0,16,36,37,23,24,9,42],[0,16,8,41,23,24,40,38],[0,16,6,34,23,24,14,39,26,20,40,38,4,22,8,41],[0,16,44,45,23,24,46,47,26,20,48,49,4,22,50,51],[0,16,6,34,29,21,9,42],[0,16,8,41,29,21,7,35],[0,16,36,37,29,21,14,39],[0,16,2,17,1,52,6,34],[0,16,2,17,53,54,9,42],[0,16,12,33,1,52,7,35],[0,16,2,17,11,55,8,41],[0,56,2,57,1,58,6,37],[0,56,15,25,1,58,9,39],[0,20,27,17,1,59,40,34],[0,56,12,28,1,58,7,38],[0,16,5,19,1,52,8,41],[0,22,13,28,1,55,14,38],[0,18,13,60,1,61,14,43],[0,16,15,30,1,52,9,42],[0,16,5,19,11,55,6,34],[0,21,12,19,1,54,7,41],[0,20,13,19,1,59,14,41],[0,20,3,30,1,59,10,42],[0,18,12,17,1,61,7,34,4,21,15,19,11,54,9,41],[0,24,13,17,1,62,14,34,4,20,27,19,11,59,40,41],[0,16,2,17,1,52,6,34,4,22,5,19,11,55,8,41],[0,16,12,33,1,52,7,35,4,22,15,30,11,55,9,42],[0,31,3,17,1,63,10,34,4,56,32,19,11,58,36,41],[0,22,2,19,64,59,14,38,4,16,5,17,65,62,40,39],[0,16,2,17,1,52,6,34,23,24,13,25,64,62,14,39,26,20,27,28,65,59,40,38,4,22,5,19,11,55,8,41],[0,16,2,17,66,67,44,45,23,24,13,25,68,69,46,47,26,20,27,28,70,71,48,49,4,22,5,19,72,73,50,51],[0,16,2,17,1,52,6,34,29,21,15,30,53,54,9,42],[0,16,5,19,1,52,8,41,29,21,12,33,53,54,7,35],[0,20,13,19,1,59,14,41,29,31,32,33,53,63,36,35],[0,31,3,17,1,63,10,34,29,20,27,30,53,59,40,42],[0,16,74,75],[0,18,76,77],[0,16,78,79],[0,18,80,81],[0,16,74,75,29,21,82,83],[0,21,84,85,29,16,86,87],[0,16,88,89],[0,16,88,89,29,21,90,91],[0,16,74,75,1,52,88,89],[0,16,78,79,1,52,92,93],[0,16,94,95,11,55,88,89],[0,16,82,83,53,54,88,89],[0,16,74,75,1,52,88,89,29,21,82,83,53,54,90,91],[0,21,84,85,96,97,88,91,29,16,86,87,98,99,90,89],[0,16,74,75,2,17,100,101],[0,16,94,95,5,19,100,101],[0,18,76,77,2,33,102,103],[0,18,104,105,106,107,100,108],[0,16,78,79,2,17,109,108],[0,16,82,83,15,30,100,101],[0,18,80,81,2,33,110,111],[0,18,112,113,114,115,100,108],[0,16,74,75,2,17,100,101,29,21,82,83,15,30,116,117],[0,21,84,85,118,119,116,101,29,16,86,87,120,121,100,117],[0,16,74,75,6,34,122,123],[0,16,74,75,8,41,124,125],[0,16,78,79,7,35,122,123],[0,16,82,83,9,42,122,123],[0,16,74,75,7,35,126,127],[0,16,74,75,9,42,128,129],[0,16,78,79,6,34,126,127],[0,16,78,79,8,41,128,129],[0,16,74,75,6,34,122,123,29,21,82,83,9,42,128,129],[0,16,74,75,7,35,126,127,29,21,82,83,8,41,124,125],[0,21,84,85,6,42,130,131,29,16,86,87,9,34,132,133],[0,21,84,85,7,41,134,135,29,16,86,87,8,35,136,137],[0,16,89,88,2,17,122,123],[0,16,89,88,12,33,126,127],[0,16,89,88,5,19,124,125],[0,16,89,88,15,30,128,129],[0,16,88,89,6,34,100,101],[0,16,89,88,7,35,109,108],[0,16,89,88,8,41,138,139],[0,16,89,88,9,42,116,117],[0,16,89,88,6,34,100,101,29,21,91,90,9,42,116,117],[0,16,89,88,7,35,109,108,29,21,91,90,8,41,138,139],[0,16,89,88,2,17,122,123,29,21,91,90,15,30,128,129],[0,16,89,88,118,121,132,131,29,21,91,90,120,119,130,133],[0,16,74,75,2,17,100,101,1,52,88,89,6,34,122,123],[0,16,74,75,12,33,109,108,1,52,88,89,7,35,126,127],[0,16,74,75,2,17,100,101,11,55,140,141,8,41,124,125],[0,16,74,75,2,17,100,101,53,54,90,91,9,42,128,129],[0,16,74,75,5,19,138,139,1,52,88,89,8,41,124,125],[0,16,74,75,15,30,116,117,1,52,88,89,9,42,128,129],[0,16,94,95,5,19,100,101,11,55,88,89,6,34,124,125],[0,16,94,95,15,30,109,108,11,55,88,89,7,35,128,129],[0,16,78,79,2,17,109,108,1,52,92,93,6,34,126,127],[0,16,78,79,12,33,100,101,1,52,92,93,7,35,122,123],[0,16,82,83,12,33,138,139,53,54,88,89,8,41,126,127],[0,16,82,83,2,17,116,117,53,54,88,89,9,42,122,123],[0,16,78,79,5,19,116,117,1,52,92,93,8,41,128,129],[0,16,82,83,15,30,100,101,1,52,90,91,9,42,122,123],[0,16,82,83,15,30,100,101,53,54,88,89,6,34,128,129],[0,16,82,83,5,19,109,108,53,54,88,89,7,35,124,125],[0,16,74,75,2,17,100,101,1,52,88,89,6,34,122,123,29,21,82,83,15,30,116,117,53,54,90,91,9,42,128,129],[0,16,74,75,12,33,109,108,1,52,88,89,7,35,126,127,29,21,82,83,5,19,138,139,53,54,90,91,8,41,124,125],[0,21,84,85,118,119,116,101,96,97,88,91,9,34,132,133,29,16,86,87,120,121,100,117,98,99,90,89,6,42,130,131],[0,21,84,85,142,143,138,108,96,97,88,91,8,35,136,137,29,16,86,87,144,145,109,139,98,99,90,89,7,41,134,135],[0,146,147],[0,148,149],[0,150,151],[0,146,147,152,153,154,155,156,157],[0,158,159],[0,146,147,1,160,161],[0,146,147,1,160,161,152,153,154,162,163,164,155,156,157,165,166,167],[0,158,159,1,168,169],[0,146,147,101,170,171],[0,146,147,100,172,173],[0,148,149,174,175,171],[0,148,149,100,176,177],[0,150,151,178,179,171],[0,150,151,100,180,181],[0,146,147,100,172,173,152,153,154,182,183,184,155,156,157,185,186,187],[0,158,159,101,188,189],[0,146,147,122,190,191],[0,146,147,123,192,193],[0,146,147,126,194,195],[0,146,147,127,196,197],[0,146,147,122,190,191,152,153,154,198,199,200,155,156,157,201,202,203],[0,158,159,123,204,205],[0,146,147,126,194,195,152,153,154,206,207,208,155,156,157,209,210,211],[0,158,159,129,212,213],[0,146,147,101,170,171,1,160,161,123,192,193],[0,146,147,108,214,215,1,160,161,127,196,197],[0,146,147,100,172,173,1,160,161,122,190,191],[0,146,147,109,216,217,1,160,161,126,194,195],[0,146,147,100,172,173,1,160,161,122,190,191,152,153,154,182,183,184,162,163,164,198,199,200,155,156,157,185,186,187,165,166,167,201,202,203],[0,158,159,101,188,189,1,168,169,123,204,205],[0,146,147,109,216,217,1,160,161,126,194,195,152,153,154,218,219,220,162,163,164,206,207,208,155,156,157,221,222,223,165,166,167,209,210,211],[0,158,159,117,224,225,1,168,169,129,212,213],[0,146,147,16,226,227],[0,148,149,18,228,229],[0,150,151,18,230,231],[0,150,151,16,232,233],[0,148,149,16,234,235],[0,146,147,18,236,237],[0,146,147,52,238,239],[0,146,147,16,226,227,1,160,161,52,238,239],[0,146,147,18,236,237,1,160,161,61,240,241],[0,146,147,16,226,227,100,172,173,101,170,171],[0,148,149,18,228,229,242,172,181,243,214,244],[0,150,151,18,230,231,245,172,177,246,214,247],[0,150,151,16,232,233,245,172,177,174,170,248],[0,148,149,16,234,235,242,172,181,178,170,249],[0,146,147,18,236,237,100,172,173,108,214,215],[0,146,147,16,226,227,122,190,191,123,192,193],[0,146,147,16,226,227,126,194,195,127,196,197],[0,146,147,18,236,237,126,194,195,123,192,193],[0,146,147,18,236,237,122,190,191,127,196,197],[0,146,147,52,238,239,122,190,191,101,170,171],[0,146,147,61,240,241,126,194,195,101,170,171],[0,146,147,52,238,239,100,172,173,123,192,193],[0,146,147,61,240,241,100,172,173,127,196,197],[0,146,147,16,226,227,100,172,173,101,170,171,1,160,161,52,239,238,122,190,191,123,192,193],[0,146,147,16,226,227,109,216,217,108,214,215,1,160,161,52,239,238,126,194,195,127,196,197],[0,146,147,18,236,237,109,216,217,101,170,171,1,160,161,61,241,240,126,194,195,123,192,193],[0,146,147,18,236,237,100,172,173,108,214,215,1,160,161,61,241,240,122,190,191,127,196,197],[0,16,2,17,158,250,251,252,159,253,254,255],[0,16,2,17,158,250,251,252,159,253,254,255,23,24,13,25,256,257,258,259,260,261,262,263,26,20,27,28,264,265,266,267,268,269,270,271,4,22,5,19,272,273,274,275,276,277,278,279],[0,16,2,17,158,250,251,252,159,253,254,255,29,21,15,30,280,281,282,283,284,285,286,287],[0,20,13,19,158,273,266,259,159,261,278,271],[0,20,13,19,158,273,266,259,159,261,278,271,29,31,32,33,280,288,289,290,284,291,292,293],[0,16,2,17,158,250,251,252,159,253,254,255,1,52,6,34,168,294,295,296,169,297,298,299],[0,16,2,17,158,250,251,252,159,253,254,255,53,54,9,42,300,301,302,303,304,305,306,307],[0,16,2,17,158,250,251,252,159,253,254,255,1,52,6,34,168,294,295,296,169,297,298,299,23,24,13,25,256,257,258,259,260,261,262,263,64,62,14,39,308,309,310,311,312,313,314,315,26,20,27,28,264,265,266,267,268,269,270,271,65,59,40,38,316,317,318,319,320,321,322,323,4,22,5,19,272,273,274,275,276,277,278,279,11,55,8,41,324,325,326,327,328,329,330,331],[0,16,2,17,158,250,251,252,159,253,254,255,66,67,44,45,332,333,334,335,336,337,338,339,23,24,13,25,256,257,258,259,260,261,262,263,68,69,46,47,340,341,342,343,344,345,346,347,26,20,27,28,264,265,266,267,268,269,270,271,70,71,48,49,348,349,350,351,352,353,354,355,4,22,5,19,272,273,274,275,276,277,278,279,72,73,50,51,356,357,358,359,360,361,362,363],[0,16,2,17,158,250,251,252,159,253,254,255,1,52,6,34,168,294,295,296,169,297,298,299,29,21,15,30,280,281,282,283,284,285,286,287,53,54,9,42,300,301,302,303,304,305,306,307],[0,20,13,19,158,273,266,259,159,261,278,271,1,59,14,41,168,325,318,311,169,313,330,323],[0,20,13,19,158,273,266,259,159,261,278,271,1,59,14,41,168,325,318,311,169,313,330,323,29,31,32,33,280,288,289,290,284,291,292,293,53,63,36,35,300,364,365,366,304,367,368,369],[0,16,2,17,158,250,251,252,159,253,254,255,100,101,75,74,370,371,188,372,373,374,375,189],[0,16,2,17,158,250,251,252,159,253,254,255,116,117,83,82,376,377,224,378,379,380,381,225],[0,16,2,17,158,250,251,252,159,253,254,255,100,101,75,74,370,371,188,372,373,374,375,189,23,24,13,25,256,257,258,259,260,261,262,263,382,383,384,385,386,387,388,389,390,391,392,393,26,20,27,28,264,265,266,267,268,269,270,271,394,395,396,397,398,399,400,401,402,403,404,405,4,22,5,19,272,273,274,275,276,277,278,279,138,139,95,94,406,407,408,409,410,411,412,413],[0,24,5,28,158,265,258,275,159,277,270,263,414,415,416,417,418,419,420,421,422,423,424,425,23,16,27,19,256,273,251,267,260,269,278,255,426,427,428,429,430,431,432,433,434,435,436,437,26,22,13,17,264,250,274,259,268,261,254,279,438,439,440,441,442,443,444,445,446,447,448,449,4,20,2,25,272,257,266,252,276,253,262,271,450,451,452,453,454,455,456,457,458,459,460,461],[0,16,2,17,158,250,251,252,159,253,254,255,100,101,75,74,370,371,188,372,373,374,375,189,29,21,15,30,280,281,282,283,284,285,286,287,116,117,83,82,376,377,224,378,379,380,381,225],[0,20,13,19,158,273,266,259,159,261,278,271,450,415,440,429,454,431,420,445,458,447,436,425],[0,20,13,19,158,273,266,259,159,261,278,271,462,463,464,465,466,467,468,469,470,471,472,473],[0,20,13,19,158,273,266,259,159,261,278,271,462,463,464,465,466,467,468,469,470,471,472,473,29,31,32,33,280,288,289,290,284,291,292,293,450,415,440,429,454,431,420,445,458,447,436,425],[0,16,2,17,158,250,251,252,159,253,254,255,123,122,88,89,204,474,475,476,205,477,478,479],[0,16,2,17,158,250,251,252,159,253,254,255,123,122,88,89,204,474,475,476,205,477,478,479,23,24,13,25,256,257,258,259,260,261,262,263,480,481,482,483,484,485,486,487,488,489,490,491,26,20,27,28,264,265,266,267,268,269,270,271,492,493,494,495,496,497,498,499,500,501,502,503,4,22,5,19,272,273,274,275,276,277,278,279,125,124,140,141,504,505,506,507,508,509,510,511],[0,16,2,17,158,250,251,252,159,253,254,255,123,122,88,89,204,474,475,476,205,477,478,479,29,21,15,30,280,281,282,283,284,285,286,287,129,128,90,91,212,512,513,514,213,515,516,517],[0,16,2,17,158,250,251,252,159,253,254,255,129,128,90,91,212,512,513,514,213,515,516,517],[0,16,2,17,158,250,251,252,159,253,254,255,129,128,90,91,212,512,513,514,213,515,516,517,23,24,13,25,256,257,258,259,260,261,262,263,518,519,520,521,522,523,524,525,526,527,528,529,26,20,27,28,264,265,266,267,268,269,270,271,530,531,532,533,534,535,536,537,538,539,540,541,4,22,5,19,272,273,274,275,276,277,278,279,127,126,92,93,542,543,544,545,546,547,548,549],[0,20,13,19,158,273,266,259,159,261,278,271,550,551,552,553,554,555,556,557,558,559,560,561,29,31,32,33,280,288,289,290,284,291,292,293,562,563,564,565,566,567,568,569,570,571,572,573],[0,16,2,17,158,250,251,252,159,253,254,255,100,101,75,74,370,371,188,372,373,374,375,189,1,52,6,34,168,294,295,296,169,297,298,299,122,123,89,88,475,476,204,474,479,478,477,205],[0,16,2,17,158,250,251,252,159,253,254,255,100,101,75,74,370,371,188,372,373,374,375,189,53,54,9,42,300,301,302,303,304,305,306,307,128,129,91,90,513,514,212,512,517,516,515,213],[0,16,2,17,158,250,251,252,159,253,254,255,116,117,83,82,376,377,224,378,379,380,381,225,1,52,6,34,168,294,295,296,169,297,298,299,128,129,91,90,513,514,212,512,517,516,515,213],[0,16,2,17,158,250,251,252,159,253,254,255,116,117,83,82,376,377,224,378,379,380,381,225,53,54,9,42,300,301,302,303,304,305,306,307,122,123,89,88,475,476,204,474,479,478,477,205],[0,16,2,17,158,250,251,252,159,253,254,255,100,101,75,74,370,371,188,372,373,374,375,189,1,52,6,34,168,294,295,296,169,297,298,299,122,123,89,88,475,476,204,474,479,478,477,205,23,24,13,25,256,257,258,259,260,261,262,263,382,383,384,385,386,387,388,389,390,391,392,393,64,62,14,39,308,309,310,311,312,313,314,315,481,480,483,482,486,487,484,485,491,490,489,488,26,20,27,28,264,265,266,267,268,269,270,271,394,395,396,397,398,399,400,401,402,403,404,405,65,59,40,38,316,317,318,319,320,321,322,323,493,492,495,494,498,499,496,497,503,502,501,500,4,22,5,19,272,273,274,275,276,277,278,279,138,139,95,94,406,407,408,409,410,411,412,413,11,55,8,41,324,325,326,327,328,329,330,331,124,125,141,140,506,507,504,505,511,510,509,508],[0,16,2,17,158,250,251,252,159,253,254,255,116,117,83,82,376,377,224,378,379,380,381,225,1,52,6,34,168,294,295,296,169,297,298,299,128,129,91,90,513,514,212,512,517,516,515,213,23,24,13,25,256,257,258,259,260,261,262,263,574,575,576,577,578,579,580,581,582,583,584,585,64,62,14,39,308,309,310,311,312,313,314,315,519,518,521,520,524,525,522,523,529,528,527,526,26,20,27,28,264,265,266,267,268,269,270,271,586,587,588,589,590,591,592,593,594,595,596,597,65,59,40,38,316,317,318,319,320,321,322,323,531,530,533,532,536,537,534,535,541,540,539,538,4,22,5,19,272,273,274,275,276,277,278,279,109,108,79,78,598,599,600,601,602,603,604,605,11,55,8,41,324,325,326,327,328,329,330,331,126,127,93,92,544,545,542,543,549,548,547,546],[0,24,5,28,158,265,258,275,159,277,270,263,414,415,416,417,418,419,420,421,422,423,424,425,66,69,50,49,332,349,342,359,336,361,354,347,493,123,483,140,498,507,204,485,503,490,509,205,23,16,27,19,256,273,251,267,260,269,278,255,426,427,428,429,430,431,432,433,434,435,436,437,68,67,48,51,340,357,334,351,344,353,362,339,124,480,89,494,506,499,484,474,511,478,501,488,26,22,13,17,264,250,274,259,268,261,254,279,438,439,440,441,442,443,444,445,446,447,448,449,70,73,46,45,348,333,358,343,352,345,338,363,122,492,141,482,475,487,496,505,479,510,489,500,4,20,2,25,272,257,266,252,276,253,262,271,450,451,452,453,454,455,456,457,458,459,460,461,72,71,44,47,356,341,350,335,360,337,346,355,481,125,495,88,486,476,504,497,491,502,477,508],[0,24,5,28,158,265,258,275,159,277,270,263,414,415,416,417,418,419,420,421,422,423,424,425,606,607,608,609,610,611,612,613,614,615,616,617,531,129,521,92,536,545,212,523,541,528,547,213,23,16,27,19,256,273,251,267,260,269,278,255,426,427,428,429,430,431,432,433,434,435,436,437,618,619,620,621,622,623,624,625,626,627,628,629,126,518,91,532,544,537,522,512,549,516,539,526,26,22,13,17,264,250,274,259,268,261,254,279,438,439,440,441,442,443,444,445,446,447,448,449,630,631,632,633,634,635,636,637,638,639,640,641,128,530,93,520,513,525,534,543,517,548,527,538,4,20,2,25,272,257,266,252,276,253,262,271,450,451,452,453,454,455,456,457,458,459,460,461,642,643,644,645,646,647,648,649,650,651,652,653,519,127,533,90,524,514,542,535,529,540,515,546],[0,16,2,17,158,250,251,252,159,253,254,255,100,101,75,74,370,371,188,372,373,374,375,189,1,52,6,34,168,294,295,296,169,297,298,299,122,123,89,88,475,476,204,474,479,478,477,205,29,21,15,30,280,281,282,283,284,285,286,287,116,117,83,82,376,377,224,378,379,380,381,225,53,54,9,42,300,301,302,303,304,305,306,307,128,129,91,90,513,514,212,512,517,516,515,213],[0,20,13,19,158,273,266,259,159,261,278,271,462,463,464,465,466,467,468,469,470,471,472,473,1,59,14,41,168,325,318,311,169,313,330,323,551,550,553,552,556,557,554,555,561,560,559,558,29,31,32,33,280,288,289,290,284,291,292,293,450,415,440,429,454,431,420,445,458,447,436,425,53,63,36,35,300,364,365,366,304,367,368,369,563,562,565,564,568,569,566,567,573,572,571,570],[0,16],[0,18],[0,16,26,20],[0,2,23,13],[0,3,4,32],[0,2,29,15],[0,3,29,27],[0,52],[0,63],[0,52,26,59],[0,63,26,54],[0,52,16,1],[0,18,1,61],[0,52,16,1,26,59,20,65],[0,31,1,63],[0,1,24,62],[0,
45431,1,63,26,21,65,54],[0,2,57,56],[0,60,3,16],[0,22,57,3],[0,2,28,20],[0,17,13,24],[0,20,19,13,4,24,17,27],[0,22,57,3,4,16,60,32],[0,22,57,3,23,20,30,12,26,24,33,15,4,16,60,32],[0,22,57,3,29,18,27,25],[0,22,3,57,1,55,10,37],[0,22,385,396,3,57,109,117],[0,22,57,3,159,279,654,655,158,274,656,657,29,18,25,27,284,658,262,269,280,659,257,267]];e.Spacegroup={"P 1":0,"P -1":1,"P 1 2 1":2,"P 1 21 1":3,"C 1 2 1":4,"P 1 m 1":5,"P 1 c 1":6,"C 1 m 1":7,"C 1 c 1":8,"P 1 2/m 1":9,"P 1 21/m 1":10,"C 1 2/m 1":11,"P 1 2/c 1":12,"P 1 21/c 1":13,"C 1 2/c 1":14,"P 2 2 2":15,"P 2 2 21":16,"P 21 21 2":17,"P 21 21 21":18,"C 2 2 21":19,"C 2 2 2":20,"F 2 2 2":21,"I 2 2 2":22,"I 21 21 21":23,"P m m 2":24,"P m c 21":25,"P c c 2":26,"P m a 2":27,"P c a 21":28,"P n c 2":29,"P m n 21":30,"P b a 2":31,"P n a 21":32,"P n n 2":33,"C m m 2":34,"C m c 21":35,"C c c 2":36,"A m m 2":37,"A b m 2":38,"A m a 2":39,"A b a 2":40,"F m m 2":41,"F d d 2":42,"I m m 2":43,"I b a 2":44,"I m a 2":45,"P 2/m 2/m 2/m":46,"P m m m":46,"P 2/n 2/n 2/n":47,"P n n n":47,"P 2/c 2/c 2/m":48,"P c c m":48,"P 2/b 2/a 2/n":49,"P b a n":49,"P 21/m 2/m 2/a":50,"P m m a":50,"P 2/n 21/n 2/a":51,"P n n a":51,"P 2/m 2/n 21/a":52,"P m n a":52,"P 21/c 2/c 2/a":53,"P c c a":53,"P 21/b 21/a 2/m":54,"P b a m":54,"P 21/c 21/c 2/n":55,"P c c n":55,"P 2/b 21/c 21/m":56,"P b c m":56,"P 21/n 21/n 2/m":57,"P n n m":57,"P 21/m 21/m 2/n":58,"P m m n":58,"P 21/b 2/c 21/n":59,"P b
454c n":59,"P 21/b 21/c 21/a":60,"P b c a":60,"P 21/n 21/m 21/a":61,"P n m a":61,"C 2/m 2/c 21/m":62,"C m c m":62,"C 2/m 2/c 21/a":63,"C m c a":63,"C 2/m 2/m 2/m":64,"C m m m":64,"C 2/c 2/c 2/m":65,"C c c m":65,"C 2/m 2/m 2/a":66,"C m m a":66,"C 2/c 2/c 2/a":67,"C c c a":67,"F 2/m 2/m 2/m":68,"F m m m":68,"F 2/d 2/d 2/d":69,"F d d d":69,"I 2/m 2/m 2/m":70,"I m m m":70,"I 2/b 2/a 2/m":71,"I b a m":71,"I 21/b 21/c 21/a":72,"I b c a":72,"I 21/m 21/m 21/a":73,"I m m a":73,"P 4":74,"P 41":75,"P 42":76,"P 43":77,"I 4":78,"I 41":79,"P -4":80,"I -4":81,"P 4/m":82,"P 42/m":83,"P 4/n":84,"P 42/n":85,"I 4/m":86,"I 41/a":87,"P 4 2 2":88,"P 4 21 2":89,"P 41 2 2":90,"P 41 21 2":91,"P 42 2 2":92,"P 42 21 2":93,"P 43 2 2":94,"P 43 21 2":95,"I 4 2 2":96,"I 41 2 2":97,"P 4 m m":98,"P 4 b m":99,"P 42 c m":100,"P 42 n m":101,"P 4 c c":102,"P 4 n c":103,"P 42 m c":104,"P 42 b c":105,"I 4 m m":106,"I 4 c m":107,"I 41 m d":108,"I 41 c d":109,"P -4 2 m":110,"P -4 2 c":111,"P -4 21 m":112,"P -4 21 c":113,"P -4 m 2":114,"P -4 c 2":115,"P -4 b 2":116,"P -4 n 2":117,"I -4 m 2":118,"I -4 c 2":119,"I -4 2 m":120,"I -4 2 d":121,"P 4/m 2/m 2/m":122,"P4/m m m":122,"P 4/m 2/c 2/c":123,"P4/m c c":123,"P 4/n 2/b 2/m":124,"P4/n b m":124,"P 4/n 2/n 2/c":125,"P4/n n c":125,"P 4/m 21/b 2/m":126,"P4/m b m":126,"P 4/m 21/n 2/c":127,"P4/m n c":127,"P 4/n 21/m 2/m":128,"P4/n m m":128,"P 4/n 2/c 2/c":129,"P4/n c c":129,"P 42/m 2/m 2/c":130,"P42/m m c":130,"P 42/m 2/c 2/m":131,"P42/m c m":131,"P 42/n 2/b 2/c":132,"P42/n b c":132,"P 42/n 2/n 2/m":133,"P42/n n m":133,"P 42/m 21/b 2/c":134,"P42/m b c":134,"P 42/m 21/n 2/m":135,"P42/m n m":135,"P 42/n 21/m 2/c":136,"P42/n m c":136,"P 42/n 21/c 2/m":137,"P42/n c m":137,"I 4/m 2/m 2/m":138,"I4/m m m":138,"I 4/m 2/c 2/m":139,"I4/m c m":139,"I 41/a 2/m 2/d":140,"I41/a m d":140,"I 41/a 2/c 2/d":141,"I41/a c d":141,"P 3":142,"P 31":143,"P 32":144,"H 3":145,"R 3":146,"P -3":147,"H -3":148,"R -3":149,"P 3 1 2":150,"P 3 2 1":151,"P 31 1 2":152,"P 31 2 1":153,"P 32 1 2":154,"P 32 2 1":155,"H 3 2":156,"R 3 2":157,"P 3 m 1":158,"P 3 1 m":159,"P 3 c 1":160,"P 3 1 c":161,"H 3 m":162,"R 3 m":163,"H 3 c":164,"R 3 c":165,"P -3 1 2/m":166,"P -3 1 m":166,"P -3 1 2/c":167,"P -3 1 c":167,"P -3 2/m 1":168,"P -3 m 1":168,"P -3 2/c 1":169,"P -3 c 1":169,"H -3 2/m":170,"H -3 m":170,"R -3 2/m":171,"R -3 m":171,"H -3 2/c":172,"H -3 c":172,"R -3 2/c":173,"R -3 c":173,"P 6":174,"P 61":175,"P 65":176,"P 62":177,"P 64":178,"P 63":179,"P -6":180,"P 6/m":181,"P 63/m":182,"P 6 2 2":183,"P 61 2 2":184,"P 65 2 2":185,"P 62 2 2":186,"P 64 2 2":187,"P 63 2 2":188,"P 6 m m":189,"P 6 c c":190,"P 63 c m":191,"P 63 m c":192,"P -6 m 2":193,"P -6 c 2":194,"P -6 2 m":195,"P -6 2 c":196,"P 6/m 2/m 2/m":197,"P 6/m m m":197,"P 6/m 2/c 2/c":198,"P 6/m c c":198,"P 63/m 2/c 2/m":199,"P 63/m c m":199,"P 63/m 2/m 2/c":200,"P 63/m m c":200,"P 2 3":201,"F 2 3":202,"I 2 3":203,"P 21 3":204,"I 21 3":205,"P 2/m -3":206,"P m -3":206,"P 2/n -3":207,"P n -3":207,"F 2/m -3":208,"F m -3":208,"F 2/d -3":209,"F d -3":209,"I 2/m -3":210,"I m -3":210,"P 21/a -3":211,"P a -3":211,"I 21/a -3":212,"I a -3":212,"P 4 3 2":213,"P 42 3 2":214,"F 4 3 2":215,"F 41 3 2":216,"I 4 3 2":217,"P 43 3 2":218,"P 41 3 2":219,"I 41 3 2":220,"P -4 3 m":221,"F -4 3 m":222,"I -4 3 m":223,"P -4 3 n":224,"F -4 3 c":225,"I -4 3 d":226,"P 4/m -3 2/m":227,"P m -3 m":227,"P 4/n -3 2/n":228,"P n -3 n":228,"P 42/m -3 2/n":229,"P m -3 n":229,"P 42/n -3 2/m":230,"P n -3 m":230,"F 4/m -3 2/m":231,"F m -3 m":231,"F 4/m -3 2/c":232,"F m -3 c":232,"F 41/d -3 2/m":233,"F d -3 m":233,"F 41/d -3 2/c":234,"F d -3 c":234,"I 4/m -3 2/m":235,"I m -3 m":235,"I 41/a -3 2/d":236,"I a -3 d":236,"P 1 1 2":237,"P 1 1 21":238,"B 1 1 2":239,"B 2":239,"A 1 2 1":240,"C 1 21 1":241,"I 1 2 1":242,"I 2":242,"I 1 21 1":243,"P 1 1 m":244,"P 1 1 b":245,"B 1 1 m":246,"B 1 1 b":247,"P 1 1 2/m":248,"P 1 1 21/m":249,"B 1 1 2/m":250,"P 1 1 2/b":251,"P 1 1 21/b":252,"B 1 1 2/b":253,"P 21 2 2":254,"P 2 21 2":255,"P 21 21 2
454(a)":256,"P 21 2 21":257,"P 2 21 21":258,"C 2 2 21a)":259,"C 2 2 2a":260,"F 2 2 2a":261,"I 2 2 2a":262,"P 21/m 21/m 2/n a":263,"P 42 21 2a":264,"I 2 3a":265}})(a=t.SpacegroupTables||(t.SpacegroupTables={}))})(t=e.Structure||(e.Structure={}))})(t=e.Core||(e.Core={}))})(p||(p={}));/* 455 * Copyright (c) 2016 - now David Sehnal, licensed under Apache 2.0, See LICENSE file for more info. 456 */ 457var p;(function(e){var t;(function(e){var t;(function(t){"use strict";var r=e.Utils.DataTable;var n;(function(n){var i=e.Geometry.LinearAlgebra.Matrix4;var a=e.Geometry.LinearAlgebra.Vector3;function o(e,t){var r=e.x,n=e.y,i=e.z;var o=a.zero();for(var s=0,u=t;s<u.length;s++){var l=u[s];o[0]+=r[l];o[1]+=n[l];o[2]+=i[l]}var f=t.length>0?t.length:1;o[0]/=f;o[1]/=f;o[2]/=f;var h=0;for(var d=0,p=t;d<p.length;d++){var l=p[d];h=Math.max(c(l,o,e),h)}return{center:o,radius:Math.sqrt(h)}}function s(e,t,r){return a.distance(e,r.center)-(t+r.radius)}function u(e,t,r,n,i,o){o[0]=r.x[t];o[1]=r.y[t];o[2]=r.z[t];a.transformMat4(o,o,n);return s(o,r.r[t],e)<=i}function l(e,t,r){var n=r.x[e]-r.cX[t],i=r.y[e]-r.cY[t],a=r.z[e]-r.cZ[t];return n*n+i*i+a*a}function c(e,t,r){var n=r.x[e]-t[0],i=r.y[e]-t[1],a=r.z[e]-t[2];return n*n+i*i+a*a}function f(e,t,r,n){return{model:e,boundingInfo:t,spacegroup:r,radius:n,transform:i.zero(),transformed:a.zero(),i:0,j:0,k:0,op:0}}function h(e,t){return a.transformMat4(e.transformed,t,e.transform)}function d(e){return p(e.i,e.j,e.k,e.op,i.clone(e.transform))}function p(e,t,r,n,i){return{isIdentity:!e&&!t&&!r&&!n,id:n+1+"_"+(5+e)+(5+t)+(5+r),transform:i}}function m(e,t){var r=true;for(var n=0;n<4;n++){for(var i=0;i<4;i++){var a=t[4*i+n];if(n===i){if(Math.abs(a-1)>1e-7){r=false;break}}else if(Math.abs(a)>1e-7){r=false;break}}if(!r)break}return{isIdentity:r,id:e.toString(),transform:t}}function v(e,t){var n=e.data.atoms,i=e.data.residues,o=e.data.chains,s=e.data.entities,u=e.positions,f=u.x,h=u.y,d=u.z;var p=r.builder(s.count),m=p.addColumn("x",function(e){return new Float64Array(e)}),v=p.addColumn("y",function(e){return new Float64Array(e)}),y=p.addColumn("z",function(e){return new Float64Array(e)}),g=p.addColumn("r",function(e){return new Float64Array(e)}),b=r.builder(o.count),x=b.addColumn("x",function(e){return new Float64Array(e)}),_=b.addColumn("y",function(e){return new Float64Array(e)}),w=b.addColumn("z",function(e){return new Float64Array(e)}),C=b.addColumn("r",function(e){return new Float64Array(e)}),E=r.builder(i.count),S=E.addColumn("x",function(e){return new Float64Array(e)}),T=E.addColumn("y",function(e){return new Float64Array(e)}),M=E.addColumn("z",function(e){return new Float64Array(e)}),A=E.addColumn("r",function(e){return new Float64Array(e)});var P=a.zero(),R=0,k=a.zero(),I=0,D=0,B=a.zero(),L=0,F=a.zero(),V=0,O=a.zero(),U=0;for(var N=0,z=s.count;N<z;N++){a.set(B,0,0,0);for(var H=s.chainStartIndex[N],j=s.chainEndIndex[N];H<j;H++){a.set(F,0,0,0);for(var G=o.residueStartIndex[H],W=o.residueEndIndex[H];G<W;G++){a.set(O,0,0,0);for(var q=i.atomStartIndex[G],X=i.atomEndIndex[G];q<X;q++){O[0]+=f[q];O[1]+=h[q];O[2]+=d[q]}a.add(P,P,O);D=i.atomEndIndex[G]-i.atomStartIndex[G];a.add(F,F,O);S[G]=O[0]/D;T[G]=O[1]/D;M[G]=O[2]/D}a.add(B,B,F);D=o.atomEndIndex[H]-o.atomStartIndex[H];x[H]=F[0]/D;_[H]=F[1]/D;w[H]=F[2]/D}D=s.atomEndIndex[N]-s.atomStartIndex[N];m[N]=B[0]/D;v[N]=B[1]/D;y[N]=B[2]/D}P[0]/=n.count;P[1]/=n.count;P[2]/=n.count;for(var Y=0,K=t;Y<K.length;Y++){var q=K[Y];k[0]+=f[q];k[1]+=h[q];k[2]+=d[q]}var Q=t.length>0?t.length:1;k[0]/=Q;k[1]/=Q;k[2]/=Q;var Z={x:f,y:h,z:d,cX:m,cY:v,cZ:y},J={x:f,y:h,z:d,cX:x,cY:_,cZ:w},$={x:f,y:h,z:d,cX:S,cY:T,cZ:M};for(var N=0,z=s.count;N<z;N++){L=0;for(var H=s.chainStartIndex[N],j=s.chainEndIndex[N];H<j;H++){V=0;for(var G=o.residueStartIndex[H],W=o.residueEndIndex[H];G<W;G++){U=0;for(var q=i.atomStartIndex[G],X=i.atomEndIndex[G];q<X;q++){U=Math.max(U,l(q,G,$));V=Math.max(V,l(q,H,J));L=Math.max(L,l(q,N,Z));R=Math.max(R,c(q,P,$))}U=Math.sqrt(U);A[G]=U}V=Math.sqrt(V);C[H]=V}L=Math.sqrt(L);g[N]=L}R=Math.sqrt(R);for(var ee=0,te=t;ee<te.length;ee++){var q=te[ee];I=Math.max(I,c(q,k,$))}I=Math.sqrt(I);return{entities:p.seal(),chains:b.seal(),residues:E.seal(),allAtoms:{center:P,radius:R},target:{center:k,radius:I}}}function y(e){var t=e.boundingInfo,r=e.spacegroup;var n=[];e.transform=i.identity();n[0]=d(e);for(var a=-3;a<=3;a++){for(var o=-3;o<=3;o++){for(var u=-3;u<=3;u++){for(var l=a===0&&o===0&&u===0?1:0,c=r.operatorCount;l<c;l++){r.getOperatorMatrix(l,a,o,u,e.transform);e.i=a;e.k=u;e.j=o;e.op=l;var f=h(e,t.allAtoms.center),p=s(f,t.allAtoms.radius,t.target);if(p<e.radius){n[n.length]=d(e)}}}}}return n}function g(t,r){var n=t.boundingInfo,i=t.radius,o=n.target;var s=t.model,l=s.data.residues,c=s.data.chains,f=s.data.entities;var h=e.Utils.ChunkedArray.create(function(e){return new Int32Array(e)},l.count,1),d=e.Utils.ChunkedArray.create(function(e){return new Int32Array(e)},l.count,1);var p=a.zero(),m=0;var v=0,y=0,g=0;for(var b=0,x=f.count;b<x;b++){m=0;var _=false;for(var w=0,C=r;w<C.length;w++){var E=C[w];for(var S=f.chainStartIndex[b],T=f.chainEndIndex[b];S<T;S++){if(!u(o,S,n.chains,E.transform,i,p))continue;var M=false;for(var A=c.residueStartIndex[S],P=c.residueEndIndex[S];A<P;A++){if(!u(o,A,n.residues,E.transform,i,p))continue;e.Utils.ChunkedArray.add(h,A);e.Utils.ChunkedArray.add(d,m);v+=l.atomEndIndex[A]-l.atomStartIndex[A];M=true}if(M){y+=1;_=true}}m++}if(_){g++}}return{residues:e.Utils.ChunkedArray.compact(h),operators:e.Utils.ChunkedArray.compact(d),atomCount:v,chainCount:y,entityCount:g}}function b(e,t,r,n,i){for(var a=0;a<i;a++){r[a][n]=e[a][t]}}function x(n,i,o){var s=n.data.residues,u=s.chainIndex,l=s.entity
457Index,c=s.atomStartIndex,f=s.atomEndIndex,h=n.data.atoms,d=n.positions,p=d.x,m=d.y,v=d.z;var y=r.builder(i.atomCount),g,x,C,E,S=[];var T=r.ofDefinition(t.Tables.Positions,i.atomCount),M=T.x,A=T.y,P=T.z;var R=n.data.entities.getBuilder(i.entityCount),k=R,I=n.data.entities.getRawData(),D=k.getRawData(),B=k.chainStartIndex,L=k.chainEndIndex,F=k.residueStartIndex,V=k.residueEndIndex,O=k.atomStartIndex,U=k.atomEndIndex,N=0;var z=n.data.chains.getBuilder(i.chainCount),H=z,j=n.data.chains.getRawData(),G=H.getRawData(),W=H.residueStartIndex,q=H.residueEndIndex,X=H.atomStartIndex,Y=H.atomEndIndex,K=H.asymId,Q=H.authAsymId,Z=H.entityIndex,J=z.addColumn("sourceChainIndex",function(e){return new Int32Array(e)}),$=z.addColumn("operatorIndex",function(e){return new Int32Array(e)}),ee=0;var te=n.data.residues.getBuilder(i.residues.length),re=te,ne=n.data.residues.getRawData(),ie=re.getRawData(),ae=re.atomStartIndex,oe=re.atomEndIndex,se=re.asymId,ue=re.authAsymId,le=re.chainIndex,ce=re.entityIndex;for(var fe=0,he=n.data.atoms.columns;fe<he.length;fe++){var de=he[fe];var pe=y.addColumn(de.name,de.creator);if(de.name==="residueIndex")x=pe;else if(de.name==="chainIndex")C=pe;else if(de.name==="entityIndex")E=pe;else if(de.name==="id")g=pe;else{S[S.length]={src:h[de.name],target:pe}}}var me=i.residues,ve=i.operators,ye=e.Geometry.LinearAlgebra.Vector3.zero(),ge=0;var be=me[0],xe=u[be],_e=l[be],we=ve[0],Ce,Ee;b(I,l[be],D,0,I.length);B[0]=0;F[0]=0;O[0]=0;b(j,u[be],G,0,j.length);Z[0]=0;W[0]=0;X[0]=0;Ce=n.data.chains.asymId[u[be]];Ee=n.data.chains.authAsymId[u[be]];var Se=o[ve[0]];if(Se&&!Se.isIdentity){K[ee]=n.data.chains.asymId[u[be]]+"-"+Se.id;Q[ee]=n.data.chains.authAsymId[u[be]]+"-"+Se.id;J[ee]=u[be];$[ee]=we;Ce=K[ee];Ee=Q[ee]}for(var Te=0,Me=me.length;Te<Me;Te++){be=me[Te];var Ae=ve[Te];Se=o[Ae];b(ne,be,ie,Te,ie.length);var Pe=l[be],Re=u[be];var ke=false;if(Pe!==_e){q[ee]=Te;Y[ee]=ge;ee+=1;L[N]=ee;V[N]=Te;U[N]=ge;N+=1;b(I,Pe,D,N,I.length);B[N]=ee;F[N]=Te;O[N]=ge;ke=true}else if(Re!==xe){q[ee]=Te;Y[ee]=ge;ee+=1;ke=true}else if(Ae!==we){q[ee]=Te;Y[ee]=ge;ee+=1;ke=true}if(ke){b(j,Re,G,ee,j.length);Z[ee]=N;W[ee]=Te;X[ee]=ge;if(!Se.isIdentity){K[ee]=n.data.chains.asymId[Re]+"-"+Se.id;Q[ee]=n.data.chains.authAsymId[Re]+"-"+Se.id}J[ee]=Re;$[ee]=Ae;Ce=K[ee];Ee=Q[ee]}xe=Re;_e=Pe;we=Ae;le[Te]=ee;ce[Te]=N;ae[Te]=ge;se[Te]=Ce;ue[Te]=Ee;for(var Ie=c[be],De=f[be];Ie<De;Ie++){a.set(ye,p[Ie],m[Ie],v[Ie]);a.transformMat4(ye,ye,Se.transform);M[ge]=ye[0];A[ge]=ye[1];P[ge]=ye[2];g[ge]=ge+1;x[ge]=Te;C[ge]=ee;E[ge]=N;for(var Be=0,Le=S;Be<Le.length;Be++){var pe=Le[Be];pe.target[ge]=pe.src[Ie]}ge++}oe[Te]=ge}L[N]=ee+1;V[N]=me.length;U[N]=ge;q[ee]=me.length;Y[ee]=ge;var Fe=y.seal(),Ve=te.seal(),Oe=z.seal(),Ue=R.seal();var Ne=w(n,i,Ve);var ze=n.data.bonds.structConn?_(n.data.bonds.structConn,o,i.residues,i.operators,n.data.residues,Ve):void 0;return t.Molecule.Model.create({id:n.id,modelId:n.modelId,data:{atoms:Fe,residues:Ve,chains:Oe,entities:Ue,bonds:{structConn:ze,component:n.data.bonds.component},secondaryStructure:Ne},positions:T,parent:n,source:t.Molecule.Model.Source.Computed,operators:o.map(function(e){return new t.Operator(e.transform,e.id,e.isIdentity)})})}function _(r,n,i,a,o,s){var u=r.entries;var l=e.Utils.FastMap.create();for(var c=0,f=n.length;c<f;c++){l.set(n[c].id,c)}var h=e.Utils.FastMap.create();for(var d=0,p=u;d<p.length;d++){var m=p[d];for(var v=0,y=m.partners;v<y.length;v++){var g=y[v];if(!h.has(g.residueIndex)){h.set(g.residueIndex,e.Utils.FastMap.create())}}}for(var c=0,f=i.length;c<f;c++){var b=i[c];if(!h.has(b))continue;h.get(b).set(a[c],c)}var x=o.atomStartIndex;var _=s.atomStartIndex;var w=[];for(var C=0,E=u;C<E.length;C++){var m=E[C];var S=true;for(var T=0,M=m.partners;T<M.length;T++){var g=M[T];if(g.symmetry!=="1_555"){S=false;break}}if(S){var A=function(e,t){var r=true;for(var n=0,i=m.partners;n<i.length;n++){var a=i[n];if(!h.get(a.residueIndex).has(e)){r=false;break}}if(!r)return"continue";w.push({bondType:m.bondType,distance:m.distance,partners:m.partners.map(function(t){var r=h.get(t.residueIndex).get(e);return{residueIndex:r,atomIndex:_[r]+(t.atomIndex-x[t.residueIndex]),symmetry:t.symmetry}})})};for(var P=0,R=n.length;P<R;P++){A(P,R)}}else{var k=[];for(var I=0,D=m.partners;I<D.length;I++){var g=D[I];if(!l.has(g.symmetry))break;var B=l.get(g.symmetry);var L=h.get(g.residueIndex);if(!L.has(B))break;var F=L.get(B);k.push({residueIndex:F,atomIndex:_[F]+(g.atomIndex-x[g.residueIndex]),symmetry:g.symmetry})}if(k.length===m.partners.length){w.push({bondType:m.bondType,distance:m.distance,partners:k})}}}return new t.StructConn(w)}function w(e,r,n){var i=e.data.residues.secondaryStructureIndex;var a=e.data.secondaryStructure;var o=n.asymId,s=n.seqNumber,u=n.insCode,l=n.secondaryStructureIndex;var c=r.residues,f=r.operators;var h=c.length;var d=[];var p=0;while(p<h){var m=p;var v=i[c[p]],y=f[p];while(m<h&&f[m]==y&&i[c[m]]==v)m++;var g=a[v];var b=new t.SecondaryStructureElement(g.type,new t.PolyResidueIdentifier(o[p],s[p],u[p]),new t.PolyResidueIdentifier(o[m-1],s[m-1],u[m-1]),g.info);b.startResidueIndex=p;b.endResidueIndex=m;var x=d.length;for(var _=p;_<m;_++){l[_]=x}d[x]=b;p=m}return d}function C(e,r,n){var i=e.data.symmetryInfo;if(!i||i.cellSize[0]<1.1&&i.cellSize[1]<1.1&&i.cellSize[2]<1.1){return e}var a;if(!n)a=e.data.atoms.indices;else a=t.Query.apply(n,e).unionAtomIndices();var o=v(e,a),s=new t.Spacegroup(i),u=f(e,o,s,r);var l=y(u),c=g(u,l);return x(e,c,l)}n.buildPivotGroupSymmetry=C;function E(e,r){var n=o(e.positions,e.positions.indices);var u=new t.Spacegroup(e.data.symmetryInfo);var l=i.zero();var c=a.zero();var f=[];for(var h=-3;h<=3;h++){for(var d=-3;d<=3;d++){for(var m=-3;m<=3;m++){for(var v=0;v<u.operatorCount;v++){u.getOperatorMatrix(v,h,d,m,l);a.transformMat4(c,n.center,l);if(s(c,n.radius,n)>r)continue;var y=i.zero();i.copy(y,l);f.push(p(h,d,m,v,y))}}}}return f}function S(t,r){var n=t.data,i=n.atoms,a=n.chains,o=n.entities,s=n.residues;var u=e.Utils.ArrayBuilder.create(function(e){return new Int32Array(e)},s.count*r.length,1),l=e.Utils.ArrayBuilder.create(function(e){return new Int32Array(e)},s.count*r.length,1);var c=r.length*i.count;var f=r.length*a.count;var h=o.count;for(var d=0,p=o.count;d<p;d++){for(var m=0;m<r.length;m++){for(var v=o.chainStartIndex[d],y=o.chainEndIndex[d];v<y;v++){for(var g=a.residueStartIndex[v],b=a.residueEndIndex[v];g<b;g++){e.Utils.ArrayBuilder.add(u,g);e.Utils.ArrayBuilder.add(l,m)}}}}return{residues:u.array,operators:l.array,atomCount:c,chainCount:f,entityCount:h}}function T(e,t){var r=e.data.symmetryInfo;if(!r||r.cellSize[0]<1.1&&r.cellSize[1]<1.1&&r.cellSize[2]<1.1){return e}var n=E(e,t);var i=S(e,n);return x(e,i,n)}n.buildMates=T;function M(e,t,r,n){if(r<0){t[t.length]=n.slice(0);return}var i=e[r],a=i.length;for(var o=0;o<a;o++){n[r]=i[o];M(e,t,r-1,n)}}function A(e,t,r){var n=e.data.assemblyInfo;var a=[];var o=r;for(var s=0,u=t;s<u.length;s++){var l=u[s];var c=i.identity();for(var f=0;f<l.length;f++){i.mul(c,c,n.operators[l[f]].operator)}o++;a[a.length]=m(o,c)}return a}function P(t,r,n,i,a){var o=t.data,s=o.chains,u=o.entities,l=o.residues;var c=i.residueIndices,f=i.operatorIndices;var h=0,d=0,p=0;for(var m=0,v=u.count;m<v;m++){var y=a;var g=false;for(var b=0,x=n;b<x.length;b++){var _=x[b];for(var w=u.chainStartIndex[m],C=u.chainEndIndex[m];w<C;w++){var E=false;for(var S=s.residueStartIndex[w],T=s.residueEndIndex[w];S<T;S++){if(!r[S])continue;e.Utils.ChunkedArray.add(c,S);e.Utils.ChunkedArray.add(f,y);h+=l.atomEndIndex[S]-l.atomStartIndex[S];E=true}if(E){d+=1;g=true}}y++}if(g){p++}}i.atomCount+=h;i.chainCount+=d;i.entityCount+=p}function R(t,r,n){var i;var a=[],o=[];for(var s=0;s<r.operators.length;s++)o[s]="";M(r.operators,a,r.operators.length-1,o);var u=n.transforms.length;var l=A(t,a,n.transforms.length);(i=n.transforms).push.apply(i,l);var c=e.Utils.FastSet.create();r.asymIds.forEach(function(e){return c.add(e)});var f=t.data.residues.asymId;
457var h=t.data.residues.count;var d=n.mask;for(var p=0;p<h;p++){d[p]=c.has(f[p])}P(t,d,l,n,u)}n.buildAssemblyEntry=R;function k(t,r){var n={atomCount:0,chainCount:0,entityCount:0,transforms:[],mask:new Int8Array(t.data.residues.count),residueIndices:e.Utils.ChunkedArray.create(function(e){return new Int32Array(e)},t.data.residues.count,1),operatorIndices:e.Utils.ChunkedArray.create(function(e){return new Int32Array(e)},t.data.residues.count,1)};for(var i=0,a=r.gens;i<a.length;i++){var o=a[i];R(t,o,n)}var s={residues:e.Utils.ChunkedArray.compact(n.residueIndices),operators:e.Utils.ChunkedArray.compact(n.operatorIndices),atomCount:n.atomCount,chainCount:n.chainCount,entityCount:n.entityCount};return x(t,s,n.transforms)}n.buildAssembly=k})(n||(n={}));function i(e,t,r){return n.buildPivotGroupSymmetry(e,t,r)}t.buildPivotGroupSymmetry=i;function a(e,t){return n.buildMates(e,t)}t.buildSymmetryMates=a;function o(e,t){return n.buildAssembly(e,t)}t.buildAssembly=o})(t=e.Structure||(e.Structure={}))})(t=e.Core||(e.Core={}))})(p||(p={}));/* 458 * Copyright (c) 2016 - now David Sehnal, licensed under Apache 2.0, See LICENSE file for more info. 459 */ 460var p;(function(e){var t;(function(e){var t;(function(t){var r;(function(t){function r(e,r){return t.Builder.toQuery(e)(r.queryContext)}t.apply=r;var n=function(){function t(e,t){this.mask=t;this.structure=e}Object.defineProperty(t.prototype,"atomCount",{get:function(){return this.mask.size},enumerable:true,configurable:true});Object.defineProperty(t.prototype,"isComplete",{get:function(){return this.mask.size===this.structure.data.atoms.count},enumerable:true,configurable:true});Object.defineProperty(t.prototype,"lookup3d",{get:function(){if(!this.lazyLoopup3d)this.makeLookup3d();return this.lazyLoopup3d},enumerable:true,configurable:true});t.prototype.hasAtom=function(e){return!!this.mask.has(e)};t.prototype.hasRange=function(e,t){for(var r=e;r<t;r++){if(this.mask.has(r))return true}return false};t.ofStructure=function(r){return new t(r,e.Utils.Mask.ofStructure(r))};t.ofFragments=function(r){return new t(r.context.structure,e.Utils.Mask.ofFragments(r))};t.ofAtomIndices=function(r,n){return new t(r,e.Utils.Mask.ofIndices(r.data.atoms.count,n))};t.prototype.makeLookup3d=function(){var t=new Int32Array(this.mask.size),r=0,n=this.structure.positions,i=n.x,a=n.y,o=n.z;for(var s=0,u=this.structure.positions.count;s<u;s++){if(this.mask.has(s))t[r++]=s}var l=e.Geometry.Query3D.createInputData(t,function(e,t){return t(i[e],a[e],o[e])});this.lazyLoopup3d=e.Geometry.Query3D.createSpatialHash(l)};return t}();t.Context=n;var i=function(){function r(e,t,r){this._hashCode=0;this._hashComputed=false;this.context=e;this.tag=t;this.atomIndices=r}Object.defineProperty(r.prototype,"hashCode",{get:function(){if(this._hashComputed)return this._hashCode;var e=23;for(var t=0,r=this.atomIndices;t<r.length;t++){var n=r[t];e=31*e+n|0}this._hashCode=e;this._hashComputed=true;return e},enumerable:true,configurable:true});Object.defineProperty(r.prototype,"id",{get:function(){return this.context.structure.id+"_"+this.tag},enumerable:true,configurable:true});Object.defineProperty(r.prototype,"atomCount",{get:function(){return this.atomIndices.length},enumerable:true,configurable:true});Object.defineProperty(r.prototype,"isHet",{get:function(){var e=this.context.structure.data.atoms.residueIndex[this.tag];return this.context.structure.data.residues.isHet[e]},enumerable:true,configurable:true});Object.defineProperty(r.prototype,"fingerprint",{get:function(){if(this._fingerprint)return this._fingerprint;var e=this.residueIndices,t=this.context.structure.data.residues,r=t.name,n=t.asymId,i=t.seqNumber,a=t.insCode,o=[];for(var s=0,u=e;s<u.length;s++){var l=u[s];var c=r[l]+" "+n[l]+" "+i[l];if(a[l])c+=" i:"+a[l];o[o.length]=c}return o.join("-")},enumerable:true,configurable:true});Object.defineProperty(r.prototype,"authFingerprint",{get:function(){if(this._authFingerprint)return this._authFingerprint;var e=this.residueIndices,t=this.context.structure.data.residues,r=t.authName,n=t.authAsymId,i=t.authSeqNumber,a=t.insCode,o=[];for(var s=0,u=e;s<u.length;s++){var l=u[s];var c=r[l]+" "+n[l]+" "+i[l];if(a[l])c+=" i:"+a[l];o[o.length]=c}return o.join("-")},enumerable:true,configurable:true});r.prototype.find=function(e){var r=n.ofFragments(new a(this.context,[this]));return t.Builder.toQuery(e)(r)};r.prototype.computeIndices=function(){if(this._residueIndices)return;var t=e.Utils.FastSet.create(),r=e.Utils.FastSet.create(),n=e.Utils.FastSet.create(),i=this.context.structure.data.atoms.residueIndex,a=this.context.structure.data.residues.chainIndex,o=this.context.structure.data.chains.entity
460Index;for(var s=0,u=this.atomIndices;s<u.length;s++){var l=u[s];t.add(i[l])}this._residueIndices=e.Utils.integerSetToSortedTypedArray(t);for(var c=0,f=this._residueIndices;c<f.length;c++){var l=f[c];r.add(a[l])}this._chainIndices=e.Utils.integerSetToSortedTypedArray(r);for(var h=0,d=this._chainIndices;h<d.length;h++){var l=d[h];n.add(o[l])}this._entityIndices=e.Utils.integerSetToSortedTypedArray(n)};Object.defineProperty(r.prototype,"residueIndices",{get:function(){this.computeIndices();return this._residueIndices},enumerable:true,configurable:true});Object.defineProperty(r.prototype,"chainIndices",{get:function(){this.computeIndices();return this._chainIndices},enumerable:true,configurable:true});Object.defineProperty(r.prototype,"entityIndices",{get:function(){this.computeIndices();return this._entityIndices},enumerable:true,configurable:true});r.areEqual=function(e,t){if(e.atomCount!==t.atomCount)return false;var r=e.atomIndices,n=t.atomIndices;for(var i=0;i<r.length;i++){if(r[i]!==n[i])return false}return e.tag===t.tag};r.ofSet=function(e,t){var n=new Int32Array(t.size);t.forEach(function(e,t){t.array[t.index++]=e},{array:n,index:0});Array.prototype.sort.call(n,function(e,t){return e-t});return new r(e,n[0],n)};r.ofArray=function(e,t,n){return new r(e,t,n)};r.ofIndex=function(e,t){var n=new Int32Array(1);n[0]=t;return new r(e,t,n)};r.ofIndexRange=function(e,t,n){var i=0;for(var a=t;a<n;a++){if(e.hasAtom(a))i++}var o=new Int32Array(i),s=0;for(var a=t;a<n;a++){if(e.hasAtom(a))o[s++]=a}return new r(e,t,o)};return r}();t.Fragment=i;var a=function(){function e(e,t){this.context=e;this.fragments=t}e.empty=function(t){return new e(t,[])};Object.defineProperty(e.prototype,"length",{get:function(){return this.fragments.length},enumerable:true,configurable:true});e.prototype.unionAtomIndices=function(){if(!this.length)return[];if(this.length===1)return this.fragments[0].atomIndices;var e=new Int8Array(this.context.structure.data.atoms.count),t=0;for(var r=0,n=this.fragments;r<n.length;r++){var i=n[r];for(var a=0,o=i.atomIndices;a<o.length;a++){var s=o[a];e[s]=1}}for(var u=0,l=e;u<l.length;u++){var s=l[u];t+=s}var c=new Int32Array(t),f=0;for(var s=0,h=e.length;s<h;s++){if(e[s])c[f++]=s}return c};e.prototype.unionFragment=function(){if(!this.length)return new i(this.context,0,new Int32Array(0));if(this.length===1)return this.fragments[0];var e=this.unionAtomIndices();return new i(this.context,e[0],e)};return e}();t.FragmentSeq=a;var o=function(){function e(e){this.ctx=e;this.fragments=[]}e.prototype.add=function(e){this.fragments[this.fragments.length]=e};e.prototype.getSeq=function(){return new a(this.ctx,this.fragments)};return e}();t.FragmentSeqBuilder=o;var s=function(){function t(t){this.ctx=t;this.fragments=[];this.byHash=e.Utils.FastMap.create()}t.prototype.add=function(e){var t=e.hashCode;if(this.byHash.has(t)){var r=this.byHash.get(t);for(var n=0,a=r;n<a.length;n++){var o=a[n];if(i.areEqual(e,o))return this}this.fragments[this.fragments.length]=e;r[r.length]=e}else{this.fragments[this.fragments.length]=e;this.byHash.set(t,[e])}return this};t.prototype.getSeq=function(){return new a(this.ctx,this.fragments)};return t}();t.HashFragmentSeqBuilder=s})(r=t.Query||(t.Query={}))})(t=e.Structure||(e.Structure={}))})(t=e.Core||(e.Core={}))})(p||(p={}));/* 461 * Copyright (c) 2016 - now David Sehnal, licensed under Apache 2.0, See LICENSE file for more info. 462 */ 463var p;(function(e){var t;(function(e){var t;(function(t){var r;(function(t){var r;(function(e){e.BuilderPrototype={};function t(t,r){e.BuilderPrototype[t]=function(){var e=[];for(var t=0;t<arguments.length;t++){e[t]=arguments[t]}return r.call.apply(r,[void 0,this].concat(e))}}e.registerModifier=t;function r(t){return Object.create(e.BuilderPrototype,{compile:{writable:false,configurable:false,value:t}})}e.build=r;function n(e){return!!e.compile}function i(e){if(typeof window==="undefined")throw"parse can only be called from a browser.";((function(){})(),eval)("with (LiteMol.Core.Structure.Query) { window.__LiteMol_query = "+e+"; }");var t=window.__LiteMol_query;window.__LiteMol_query=void 0;return t.compile()}e.parse=i;function a(e){var t;if(n(e))t=e.compile();else if(typeof e==="string"||e instanceof String)t=i(e);else t=e;return t}e.toQuery=a})(r=t.Builder||(t.Builder={}));function n(){return r.build(function(){return F.compileAllAtoms()})}t.allAtoms=n;function i(){var e=[];for(var t=0;t<arguments.length;t++){e[t]=arguments[t]}return r.build(function(){return F.compileAtoms(e,function(e){return e.data.atoms.elementSymbol})})}t.atomsByElement=i;function a(){var e=[];for(var t=0;t<arguments.length;t++){e[t]=arguments[t]}return r.build(function(){return F.compileAtoms(e,function(e){return e.data.atoms.name})})}t.atomsByName=a;function o(){var e=[];for(var t=0;t<arguments.length;t++){e[t]=arguments[t]}return r.build(function(){return F.compileAtoms(e,function(e){return e.data.atoms.id})})}t.atomsById=o;function s(){var e=[];for(var t=0;t<arguments.length;t++){e[t]=arguments[t]}return r.build(function(){return F.compileAtomRanges(false,e,function(e){return e.data.residues})})}t.residues=s;function u(){var e=[];for(var t=0;t<arguments.length;t++){e[t]=arguments[t]}return r.build(function(){return F.compileAtomRanges(false,e,function(e){return e.data.chains})})}t.chains=u;function l(){var e=[];for(var t=0;t<arguments.length;t++){e[t]=arguments[t]}return r.build(function(){return F.compileAtomRanges(false,e,function(e){return e.data.entities})})}t.entities=l;function c(){var e=[];for(var t=0;t<arguments.length;t++){e[t]=arguments[t]}return r.build(function(){return F.compileAtomRanges(true,e,function(e){return e.data.entities})})}t.notEntities=c;function f(){return r.build(function(){return F.compileEverything()})}t.everything=f;function h(e){return r.build(function(){return F.compileFromIndices(false,e,function(e){return e.data.entities})})}t.entitiesFromIndices=h;function d(e){return r.build(function(){return F.compileFromIndices(false,e,function(e){return e.data.chains})})}t.chainsFromIndices=d;function p(e){return r.build(function(){return F.compileFromIndices(false,e,function(e){return e.data.residues})})}t.residuesFromIndices=p;function m(e){return r.build(function(){return F.compileAtomIndices(e)})}t.atomsFromIndices=m;function v(e,t,n,i){return r.build(function(){return F.compileSequence(e,t,n,i)})}t.sequence=v;function y(){return r.build(function(){return F.compileHetGroups()})}t.hetGroups=y;function g(){return r.build(function(){return F.compileNonHetPolymer()})}t.nonHetPolymer=g;function b(){var e=[];for(var t=0;t<arguments.length;t++){e[t]=arguments[t]}return r.build(function(){return F.compilePolymerNames(e,false)})}t.polymerTrace=b;function x(){return E(r.build(function(){return F.compilePolymerNames(["CA","O","O5'","C3'","N3"],false)}),y(),l({type:"water"}))}t.cartoons=x;function _(){return r.build(function(){return F.compilePolymerNames(["N","CA","C","O","P","OP1","OP2","O3'","O5'","C3'","C5'","C4"],false)})}t.backbone=_;function w(){return r.build(function(){return F.compilePolymerNames(["N","CA","C","O","P","OP1","OP2","O3'","O5'","C3'","C5'","C4"],true)})}t.sidechain=w;function C(e,t){return r.build(function(){return F.compileAtomsInBox(e,t)})}t.atomsInBox=C;function E(){var e=[];for(var t=0;t<arguments.length;t++){e[t]=arguments[t]}return r.build(function(){return F.compileOr(e)})}t.or=E;r.registerModifier("complement",S);function S(e){return r.build(function(){return F.compileComplement(e)})}t.complement=S;r.registerModifier("ambientResidues",T);function T(e,t){return r.build(function(){return F.compileAmbientResidues(e,t)})}t.ambientResidues=T;r.registerModifier("wholeResidues",M);function M(e){return r.build(function(){return F.compileWholeResidues(e)})}t.wholeResidues=M;r.registerModifier("union",A);function A(e){return r.build(function(){return F.compileUnion(e)})}t.union=A;r.registerModifier("inside",P);function P(e,t){return r.build(function(){return F.compileInside(e,t)})}t.inside=P;r.registerModifier("intersectWith",R);function R(e,t){return r.build(function(){return F.compileIntersectWith(e,t)})}t.intersectWith=R;r.registerModifier("flatten",k);function k(e,t){return r.build(function(){return F.compileFlatten(e,t)})}t.flatten=k;r.registerModifier("except",I);function I(e,t){return r.build(function(){return F.compileExcept(e,t)})}t.except=I;function D(){var e=[];for(var t=0;t<arguments.length;t++){e[t]=arguments[t]}return s.apply(void 0,e.map(function(e){return{name:e}}))}t.residuesByName=D;function B(){var e=[];for(var t=0;t<arguments.length;t++){e[t]=arguments[t]}return s.apply(void 0,e.map(function(e){return{authSeqNumber:e}}))}t.residuesById=B;function L(){var e=[];for(var t=0;t<arguments.length;t++){e[t]=arguments[t]}return u.apply(void 0,e.map(function(e){return{authAsymId:e}}))}t.chainsById=L;var F;(function(n){var i=function(){function e(e,t){this.columns=[];for(var r=0,n=Object.keys(e);r<n.length;r++){var i=n[r];if(e[i]!==void 0&&!!t[i]){this.columns.push({value:e[i],array:t[i]})}}}e.prototype.isSatisfied=function(e){for(var t=0,r=this.columns;t<r.length;t++){var n=r[t];if(n.value!==n.array[e])return false}return true};return e}();function a(){return function(e){if(e.isComplete){var r=e.structure.data.atoms.indices;return new t.FragmentSeq(e,[new t.Fragment(e,r[0],r)])}var n=new Int32Array(e.atomCount);var i=0;for(var a=0,o=e.structure.data.atoms.indices;a<o.length;a++){var s=o[a];if(e.hasAtom(s))n[i++]=s}return new t.FragmentSeq(e,[t.Fragment.ofArray(e,n[0],n)])}}n.compileEverything=a;function o(){return function(e){var r=new t.FragmentSeqBuilder(e);for(var n=0,i=e.structure.data.atoms.count;n<i;n++){if(e.hasAtom(n))r.add(t.Fragment.ofIndex(e,n))}return r.getSeq()}}n.compileAllAtoms=o;function s(r,n){return function(i){var a=e.Utils.FastSet.ofArray(r),o=n(i.structure),s=new t.FragmentSeqBuilder(i);for(var u=0,l=o.length;u<l;u++){if(i.hasAtom(u)&&a.has(o[u]))s.add(t.Fragment.ofIndex(i,u))}return s.getSeq()}}n.compileAtoms=s;function u(e){return function(r){var n=0;for(var i=0,a=e;i<a.length;i++){var o=a[i];
463if(r.hasAtom(o))n++}if(!n)return t.FragmentSeq.empty(r);if(n===e.length)return new t.FragmentSeq(r,[t.Fragment.ofArray(r,e[0],e)]);var s=0;var u=new Int32Array(n);for(var l=0,c=e;l<c.length;l++){var o=c[l];if(r.hasAtom(o))u[s++]=o}return new t.FragmentSeq(r,[t.Fragment.ofArray(r,u[0],u)])}}n.compileAtomIndices=u;function l(r,n,i){return function(a){var o=i(a.structure),s=o.atomStartIndex,u=o.atomEndIndex,l=new t.FragmentSeqBuilder(a);if(r){var c=e.Utils.FastSet.ofArray(n);var f=o.count;for(var h=0;h<f;h++){if(c.has(h))continue;if(!a.hasRange(s[h],u[h]))continue;l.add(t.Fragment.ofIndexRange(a,s[h],u[h]))}}else{for(var d=0,p=n;d<p.length;d++){var h=p[d];if(!a.hasRange(s[h],u[h]))continue;l.add(t.Fragment.ofIndexRange(a,s[h],u[h]))}}return l.getSeq()}}n.compileFromIndices=l;function c(e,r,n){return function(a){var o=n(a.structure),s=o.atomStartIndex,u=o.atomEndIndex,l=new t.FragmentSeqBuilder(a),c=o.count,f=false;var h=r.map(function(e){return new i(e,o)});var d=h.length===0;for(var p=0;p<c;p++){if(!a.hasRange(s[p],u[p]))continue;f=d;for(var m=0,v=h;m<v.length;m++){var y=v[m];if(y.isSatisfied(p)){f=true;break}}if(e)f=!f;if(f){l.add(t.Fragment.ofIndexRange(a,s[p],u[p]))}}return l.getSeq()}}n.compileAtomRanges=c;function f(e,r,n,a){return function(o){var s=o.structure.data,u=s.residues,l=s.chains,c=u.seqNumber,f=u.atomStartIndex,h=u.atomEndIndex,d=l.entityId,p=l.count,m=l.residueStartIndex,v=l.residueEndIndex,y=new t.FragmentSeqBuilder(o);var g=o.structure.parent,b=l.sourceChainIndex,x=g&&b;var _=typeof r==="string"?{asymId:r}:r;var w=new i(_,x?g.data.chains:l);for(var C=0;C<p;C++){if(d[C]!==e||!w.isSatisfied(x?b[C]:C)){continue}var E=m[C],S=v[C],T=-1,M=-1;for(;E<S;E++){if(c[E]>=n.seqNumber){T=E;break}}if(E===S)continue;for(E=T;E<S;E++){if(c[E]>=a.seqNumber){break}}M=E;if(o.hasRange(f[T],h[M])){y.add(t.Fragment.ofIndexRange(o,f[T],h[M]))}}return y.getSeq()}}n.compileSequence=f;function h(){return function(e){var r=e.structure.data.residues,n=r.atomStartIndex,i=r.atomEndIndex,a=r.isHet,o=r.entityIndex,s=r.count,u=e.structure.data.entities.type,l="water",c=new t.FragmentSeqBuilder(e);for(var f=0;f<s;f++){if(!e.hasRange(n[f],i[f]))continue;if(u[o[f]]===l)continue;if(a[f]){c.add(t.Fragment.ofIndexRange(e,n[f],i[f]))}}return c.getSeq()}}n.compileHetGroups=h;function d(){return function(e){var r=e.structure.data.residues,n=r.atomStartIndex,i=r.atomEndIndex,a=e.structure.data.entities,o=a.type,s=a.count,u=a.residueStartIndex,l=a.residueEndIndex,c="polymer",f=0;for(var h=0;h<s;h++){if(o[h]!==c)continue;for(var d=u[h],p=l[h];d<p;d++){for(var m=n[d],v=i[d];m<v;m++){if(e.hasAtom(m))f++}}}if(!f)return t.FragmentSeq.empty(e);var y=new Int32Array(f),g=0;for(var h=0;h<s;h++){if(o[h]!==c)continue;for(var d=u[h],p=l[h];d<p;d++){for(var m=n[d],v=i[d];m<v;m++){if(e.hasAtom(m))y[g++]=m}}}return new t.FragmentSeq(e,[t.Fragment.ofArray(e,y[0],y)])}}
463n.compileNonHetPolymer=d;function p(e,r){return function(n){var i=n.structure.positions,a=i.x,o=i.y,s=i.z,u=i.count,l=[];for(var c=0;c<u;c++){if(!n.hasAtom(c))continue;var f=a[c],h=o[c],d=s[c];if(f>=e.x&&f<=r.x&&h>=e.y&&h<=r.y&&d>=e.z&&d<=r.z){l[l.length]=c}}if(!l.length)return t.FragmentSeq.empty(n);return new t.FragmentSeq(n,[new t.Fragment(n,l[0],l)])}}n.compileAtomsInBox=p;function m(e,n){var i=r.toQuery(e);var a=r.toQuery(n);return function(e){return new t.FragmentSeq(e,i(t.Context.ofFragments(a(e))).fragments)}}n.compileInside=m;function v(e,r,n){var i=0;for(var a=0,o=r.atomIndices;a<o.length;a++){var s=o[a];if(n.has(s))i++}if(!i)return void 0;var u=new Int32Array(i);var l=0;for(var c=0,f=r.atomIndices;c<f.length;c++){var s=f[c];if(n.has(s))u[l++]=s}return t.Fragment.ofArray(e,u[0],u)}function y(n,i){var a=r.toQuery(n);var o=r.toQuery(i);return function(r){var n=a(r);var i=e.Utils.Mask.ofFragments(o(r));var s=new t.FragmentSeqBuilder(r);for(var u=0,l=n.fragments;u<l.length;u++){var c=l[u];var f=v(r,c,i);if(f)s.add(f)}return s.getSeq()}}n.compileIntersectWith=y;function g(e,n){var i=r.toQuery(e);return function(e){var r=i(e).fragments,a=new t.FragmentSeqBuilder(e),o;for(var s=0;s<r.length;s++){o=r[s];if(n(o))a.add(o)}return a.getSeq()}}n.compileFilter=g;function b(n){var i=r.toQuery(n);return function(r){var n=e.Utils.Mask.ofFragments(i(r)),a=0,o=0;for(var s=0,u=r.structure.data.atoms.count;s<u;s++){if(r.hasAtom(s)&&!n.has(s))a++}if(!a)return t.FragmentSeq.empty(r);var l=new Int32Array(a);for(var s=0,u=r.structure.data.atoms.count;s<u;s++){if(r.hasAtom(s)&&!n.has(s))l[o++]=s}return new t.FragmentSeq(r,[t.Fragment.ofArray(r,l[0],l)])}}n.compileComplement=b;function x(e){var n=e.map(function(e){return r.toQuery(e)});return function(e){var r=new t.HashFragmentSeqBuilder(e);for(var i=0,a=n;i<a.length;i++){var o=a[i];var s=o(e);for(var u=0,l=s.fragments;u<l.length;u++){var c=l[u];r.add(c)}}return r.getSeq()}}n.compileOr=x;function _(n){var i=r.toQuery(n);return function(r){var n=i(r).fragments,a=e.Utils.FastSet.create(),o=0,s;for(var u=0;u<n.length;u++){s=n[u].atomIndices;for(o=0;o<s.length;o++)a.add(s[o])}if(a.size===0)return t.FragmentSeq.empty(r);return new t.FragmentSeq(r,[t.Fragment.ofSet(r,a)])}}n.compileUnion=_;function w(r,n){return function(i){var a=i.structure,o=a.data.entities,s=a.data.atoms.name,u=[],l=0;var c=e.Utils.FastSet.ofArray(r);if(n){for(var f=0;f<a.data.entities.count;f++){if(o.type[f]!=="polymer")continue;var h=o.atomStartIndex[f],d=o.atomEndIndex[f];for(var p=h;p<d;p++){if(i.hasAtom(p)&&!c.has(s[p]))u[l++]=p}}}else{for(var f=0;f<o.count;f++){if(o.type[f]!=="polymer")continue;var h=o.atomStartIndex[f],d=o.atomEndIndex[f];for(var p=h;p<d;p++){if(i.hasAtom(p)&&c.has(s[p]))u[l++]=p}}}if(!u.length)return t.FragmentSeq.empty(i);return new t.FragmentSeq(i,[t.Fragment.ofArray(i,u[0],new Int32Array(u))])}}n.compilePolymerNames=w;function C(n,i){var a=r.toQuery(n);return function(r){var n=a(r),o=r.lookup3d(),s=new t.HashFragmentSeqBuilder(r),u=r.structure.positions,l=u.x,c=u.y,f=u.z,h=r.structure.data.atoms.residueIndex,d=r.structure.data.residues.atomStartIndex,p=r.structure.data.residues.atomEndIndex;for(var m=0,v=n.fragments;m<v.length;m++){var y=v[m];var g=e.Utils.FastSet.create();for(var b=0,x=y.atomIndices;b<x.length;b++){var _=x[b];g.add(h[_]);var w=o(l[_],c[_],f[_],i),C=w.elements,E=w.count;for(var S=0;S<E;S++){g.add(h[C[S]])}}var T={count:0,start:d,end:p};g.forEach(function(e,t){t.count+=t.end[e]-t.start[e]},T);var M=new Int32Array(T.count),A={indices:M,offset:0,start:d,end:p};g.forEach(function(e,t){for(var r=t.start[e],n=t.end[e];r<n;r++){t.indices[t.offset++]=r}},A);Array.prototype.sort.call(M,function(e,t){return e-t});s.add(t.Fragment.ofArray(r,M[0],M))}return s.getSeq()}}n.compileAmbientResidues=C;function E(n){var i=r.toQuery(n);return function(r){var n=i(r),a=new t.HashFragmentSeqBuilder(r),o=r.structure.data.atoms.residueIndex,s=r.structure.data.residues.atomStartIndex,u=r.structure.data.residues.atomEndIndex;for(var l=0,c=n.fragments;l<c.length;l++){var f=c[l];var h=e.Utils.FastSet.create();for(var d=0,p=f.atomIndices;d<p.length;d++){var m=p[d];h.add(o[m])}var v={count:0,start:s,end:u};h.forEach(function(e,t){t.count+=t.end[e]-t.start[e]},v);var y=new Int32Array(v.count),g={indices:y,offset:0,start:s,end:u};h.forEach(function(e,t){for(var r=t.start[e],n=t.end[e];r<n;r++){t.indices[t.offset++]=r}},g);Array.prototype.sort.call(y,function(e,t){return e-t});a.add(t.Fragment.ofArray(r,y[0],y))}return a.getSeq()}}n.compileWholeResidues=E;function S(e,n){var i=r.toQuery(e);return function(e){var r=i(e);var a=new t.HashFragmentSeqBuilder(e);for(var o=0,s=r.fragments;o<s.length;o++){var u=s[o];var l=n(u);for(var c=0,f=l.fragments;c<f.length;c++){var h=f[c];a.add(h)}}return a.getSeq()}}n.compileFlatten=S;function T(n,i){var a=r.toQuery(n);var o=r.toQuery(i);return function(r){var n=a(r);var i=e.Utils.Mask.ofFragments(o(r));var s=new t.HashFragmentSeqBuilder(r);for(var u=0,l=n.fragments;u<l.length;u++){var c=l[u];var f=0;for(var h=0,d=c.atomIndices;h<d.length;h++){var p=d[h];if(!i.has(p))f++}if(!f)continue;var m=new Int32Array(f);var v=0;for(var y=0,g=c.atomIndices;y<g.length;y++){var p=g[y];if(!i.has(p))m[v++]=p}s.add(t.Fragment.ofArray(r,m[0],m))}return s.getSeq()}}n.compileExcept=T})(F=t.Compiler||(t.Compiler={}))})(r=t.Query||(t.Query={}))})(t=e.Structure||(e.Structure={}))})(t=e.Core||(e.Core={}))})(p||(p={}));/* 464 * Copyright (c) 2016 - now David Sehnal, licensed under Apache 2.0, See LICENSE file for more info. 465 */ 466var p;(function(e){var t;(function(e){var t;(function(t){var r;(function(t){var r;(function(r){function n(e){return function(t){return function(r,n){return e(t(r,n))}}}function i(e){return function(t,r){return function(n,i){return e(t(n,i),r(n,i))}}}r.not=n(function(e){return!e});r.and=i(function(e,t){return e&&t});r.or=i(function(e,t){return e||t});var a=e.Utils.FastSet.ofArray(["N","CA","C","O","P","OP1","OP2","O3'","O5'","C3'","C5'","C4"]);
466r.backbone=function(e,t){return r.entityType(e,t)==="polymer"&&a.has(r.atomName(e,t))};r.sidechain=function(e,t){return r.entityType(e,t)==="polymer"&&!a.has(r.atomName(e,t))};function o(e){return function(t,r){return function(n,i){return e(t(n,i),r(n,i))}}}r.equal=o(function(e,t){return e===t});r.notEqual=o(function(e,t){return e!==t});r.greater=o(function(e,t){return e>t});r.lesser=o(function(e,t){return e<t});r.greaterEqual=o(function(e,t){return e>=t});r.lesserEqual=o(function(e,t){return e<=t});function s(e,t,r){return function(n,i){var a=e(n,i);return a>=t&&a<=r}}r.inRange=s;function u(e){return function(){return e}}r.value=u;function l(e,t,r){return function(n,i){var a=n.structure;return r(t(a))[e(a.data.atoms)[i]]}}r.residueSeqNumber=l(function(e){return e.residueIndex},function(e){return e.data.residues},function(e){return e.seqNumber});r.residueName=l(function(e){return e.residueIndex},function(e){return e.data.residues},function(e){return e.name});r.elementSymbol=l(function(e){return e.indices},function(e){return e.data.atoms},function(e){return e.elementSymbol});r.atomName=l(function(e){return e.indices},function(e){return e.data.atoms},function(e){return e.name});r.entityType=l(function(e){return e.entityIndex},function(e){return e.data.entities},function(e){return e.type});function c(e){return t.Builder.build(function(){return function(r){var n=[];for(var i=0,a=r.structure.data.atoms.count;i<a;i++){if(r.hasAtom(i)&&e(r,i))n[n.length]=i}if(!n.length)return t.FragmentSeq.empty(r);return new t.FragmentSeq(r,[t.Fragment.ofArray(r,n[0],new Int32Array(n))])}})}r.query=c})(r=t.Algebraic||(t.Algebraic={}))})(r=t.Query||(t.Query={}))})(t=e.Structure||(e.Structure={}))})(t=e.Core||(e.Core={}))})(p||(p={}));/* 467 * Copyright (c) 2016 - now David Sehnal, licensed under Apache 2.0, See LICENSE file for more info. 468 */ 469var p;(function(e){var t;(function(e){e.VERSION={number:"1.7.7",date:"Feb 27 2018"}})(t=e.Visualization||(e.Visualization={}))})(p||(p={}));var p;(function(e){var t;(function(e){e.THREE=s})(t=e.Visualization||(e.Visualization={}))})(p||(p={}));/* 470 * Copyright (c) 2016 - now David Sehnal, licensed under Apache 2.0, See LICENSE file for more info. 471 */ 472var p;(function(e){var t;(function(e){var t;(function(e){"use strict";var t=function(){function e(){}e.getRandomColor=function(t){if(t===void 0){t=0}var r=0;while(true){r++;var n=e.randomMix({r:166/255,g:0,b:100/255},{r:1,g:1,b:0},{r:0,g:100/255,b:1},t);var i=Math.abs(e.previous.r-n.r)+Math.abs(e.previous.g-n.g)+Math.abs(e.previous.b-n.b);if(i>100||r===10){e.previous=n;return n}}};e.randomMix=function(e,t,r,n){var i=Math.floor(Math.random()*3)|0;var a=i===0?Math.random()*n:Math.random();var o=i===1?Math.random()*n:Math.random();var s=i===2?Math.random()*n:Math.random();var u=a+o+s;a/=u;o/=u;s/=u;return{r:a*e.r+o*t.r+s*r.r,g:a*e.g+o*t.g+s*r.g,b:a*e.b+o*t.b+s*r.b}};e.interpolate=function(e,t,r,n,i,a){var o=a!==void 0?a:{r:.1,g:.1,b:.1};var s=(i-e)/(r-e);o.r=t.r+(n.r-t.r)*s;o.g=t.g+(n.g-t.g)*s;o.b=t.b+(n.b-t.b)*s;return o};e.previous=e.randomMix({r:.75,g:0,b:.25},{r:1,g:.5,b:0},{r:0,g:.35,b:1},.5);return e}();e.Palette=t})(t=e.Utils||(e.Utils={}))})(t=e.Visualization||(e.Visualization={}))})(p||(p={}));/* 473 * Copyright (c) 2016 - now David Sehnal, licensed under Apache 2.0, See LICENSE file for more info. 474 */ 475var p;(function(e){var t;(function(e){function t(){var e=document.createElement("canvas");try{var t=e.getContext("webgl")||e.getContext("experimental-webgl");return!!t}catch(e){console.log(e);return false}}e.checkWebGL=t;var r=function(){function t(){}t.setPickBase=function(e,t,r,n){var i=24,a=e<<i-t|r,o=a>>16&255,s=a>>8&255,u=a&255;n.r=o/255;n.g=s/255;n.b=u/255};t.setPickColor=function(e,t,r,n,i){var a=24,o=e<<a-t|r,s=o>>16&255,u=o>>8&255,l=o&255;n[i]=s/255;n[i+1]=u/255;n[i+2]=l/255};t.toSurface=function(e){var t=e.vertices.length*3,r=new Float32Array(t),n=new Float32Array(t),i=new Uint32Array(e.faces.length*3),a=Array(e.vertices.length);for(var o=0;o<e.faces.length;o++){var s=e.faces[o];a[s.a]=s.vertexNormals[0];a[s.b]=s.vertexNormals[1];a[s.c]=s.vertexNormals[2];i[3*o]=s.a;i[3*o+1]=s.b;i[3*o+2]=s.c}for(var o=0;o<e.vertices.length;o++){var u=e.vertices[o];r[3*o]=u.x;r[3*o+1]=u.y;r[3*o+2]=u.z;var l=a[o];n[3*o]=l.x;n[3*o+1]=l.y;n[3*o+2]=l.z}return{vertices:r,vertexCount:e.vertices.length,triangleIndices:i,triangleCount:e.faces.length,normals:n}};t.toRawGeometry=function(e){var r=t.toSurface(e),n=r.vertices,i=r.vertexCount,a=r.triangleIndices,o=r.triangleCount,s=r.normals;return{vertices:n,vertexCount:i,indices:a,indexCount:o,normals:s,elementSize:3}};t.getIndexedBufferGeometry=function(t){var r=t.vertices.length*3,n=new Float32Array(r),i=new Float32Array(r),a=new Uint32Array(t.faces.length*3),o=Array(t.vertices.length);for(var s=0;s<t.faces.length;s++){var u=t.faces[s];o[u.a]=u.vertexNormals[0];o[u.b]=u.vertexNormals[1];o[u.c]=u.vertexNormals[2];a[3*s]=u.a;a[3*s+1]=u.b;a[3*s+2]=u.c}for(var s=0;s<t.vertices.length;s++){var l=t.vertices[s];n[3*s]=l.x;n[3*s+1]=l.y;n[3*s+2]=l.z;var c=o[s];i[3*s]=c.x;i[3*s+1]=c.y;i[3*s+2]=c.z}var f=new e.THREE.BufferGeometry;f.addAttribute("position",new e.THREE.BufferAttribute(n,3));f.addAttribute("normal",new e.THREE.BufferAttribute(i,3));f.addAttribute("index",new e.THREE.BufferAttribute(a,1));return f};return t}();e.GeometryHelper=r})(t=e.Visualization||(e.Visualization={}))})(p||(p={}));/* 476 * Copyright (c) 2016 - now David Sehnal, licensed under Apache 2.0, See LICENSE file for more info. 477 */ 478var p;(function(e){var t;(function(t){var r;(function(e){function r(e,t){t.r=e.r;t.g=e.g;t.b=e.b}e.copy=r;function n(e){var t=e.r,r=e.g,n=e.b;return{r:t,g:r,b:n}}e.clone=n;function i(e){return new t.THREE.Vector3(e.r,e.g,e.b)}e.toVector=i;function a(e){return{r:e.x,g:e.y,b:e.z}}e.fromVector=a;function o(e,t,r){return{r:e/255,g:t/255,b:r/255}}e.fromRgb=o;function s(e,t,r){if(r<0)r+=1;if(r>1)r-=1;if(r<1/6)return e+(t-e)*6*r;if(r<1/2)return t;if(r<2/3)return e+(t-e)*(2/3-r)*6;return e}function u(e,t,r){var n,i,a;if(t==0){n=i=a=r}else{var o=r<.5?r*(1+t):r+t-r*t;var u=2*r-o;n=s(u,o,e+1/3);i=s(u,o,e);a=s(u,o,e-1/3)}return{r:n,g:i,b:a}}e.fromHsl=u;function l(e,t,r){var n,i,a=[];if(t===0){n=[r,r,r]}else{e=e/60;i=Math.floor(e);a=[r*(1-t),r*(1-t*(e-i)),r*(1-t*(1-(e-i)))];switch(i){case 0:n=[r,a[2],a[0]];break;case 1:n=[a[1],r,a[0]];break;case 2:n=[a[0],r,a[2]];break;case 3:n=[a[0],a[1],r];break;case 4:n=[a[2],a[0],r];break;default:n=[r,a[0],a[1]];break}}return{r:n[0],g:n[1],b:n[2]}}e.fromHsv=l;function c(){return t.Utils.Palette.getRandomColor()}e.random=c;function f(e){return{r:(e>>16&255)/255,g:(e>>8&255)/255,b:(e&255)/255}}e.fromHex=f;function h(e){if(e[0]!=="#")return f(0);if(e.length===4){return h("#"+e[1]+e[1]+e[2]+e[2]+e[3]+e[3])}else if(e.length===7){return f(parseInt(e.substr(1),16))}return f(0)}e.fromHexString=h;function d(e,t,r,n){n.r=e.r+(t.r-e.r)*r;n.g=e.g+(t.g-e.g)*r;n.b=e.b+(t.b-e.b)*r}e.interpolate=d;function p(e){return e.r!==void 0&&e.g!==void 0&&e.b!==void 0}e.isColor=p})(r=t.Color||(t.Color={}));var n;(function(t){var n;(function(e){e.HighlightColor={r:1,g:1,b:0};e.SelectionColor={r:171/255,g:71/255,b:183/255};e.UniformColor={r:68/255,g:130/255,b:255};e.Transparency={alpha:1,writeDepth:false}})(n=t.Default||(t.Default={}));function i(e){var t=+e.transparency.alpha;if(isNaN(t))t=1;return t<=.999}t.isTransparent=i;function a(e,t,r){var n=e.colors.get(t);if(!n)return r;return n}t.getColor=a;function o(t){if(t===void 0){t={}}var i=t.colors,a=t.variables,o=a===void 0?e.Core.Utils.FastMap.create():a,s=t.transparency,u=s===void 0?n.Transparency:s,l=t.interactive,c=l===void 0?true:l,f=t.disableFog,h=f===void 0?false:f,d=t.isSticky,p=d===void 0?false:d;var m=e.Core.Utils.FastMap.create();
478if(i){i.forEach(function(e,t){return m.set(t,e)})}var v=m.get("Uniform");if(!v){m.set("Uniform",n.UniformColor);v=n.UniformColor}return{colors:m,variables:o,transparency:u,interactive:c,disableFog:h,isSticky:p,setElementColor:function(e,t){r.copy(v,t)}}}t.createUniform=o;function s(t,r){if(r===void 0){r={}}var i=r.colors,a=i===void 0?e.Core.Utils.FastMap.create():i,o=r.variables,s=o===void 0?e.Core.Utils.FastMap.create():o,u=r.transparency,l=u===void 0?n.Transparency:u,c=r.interactive,f=c===void 0?true:c,h=r.disableFog,d=h===void 0?false:h,p=r.isSticky,m=p===void 0?false:p;return{colors:a,variables:s,transparency:l?l:n.Transparency,interactive:f,disableFog:d,isSticky:m,setElementColor:function(e,r){t.setColor(t.getProperty(e),r)}}}t.createMapping=s;function u(e,t,r){var n=new d(t,r);return{getProperty:e,setColor:function(e,t){return n.setColor(e,t)}}}t.createColorMapMapping=u;function l(e,t){var r=new h(t);return{getProperty:e,setColor:function(e,t){return r.setColor(e,t)}}}t.createPalleteMapping=l;function c(e,t){var r=new f(t);return{getProperty:e,setColor:function(e,t){return r.setColor(e,t)}}}t.createPalleteIndexMapping=c;var f=function(){function e(e){this.pallete=e}e.prototype.setColor=function(e,t){var n=this.pallete[e];r.copy(n,t)};return e}();var h=function(){function t(t){this.pallete=t;this.colorIndex=0;this.colorMap=e.Core.Utils.FastMap.create()}t.prototype.setColor=function(e,t){var n=this.colorMap.get(e);if(!n){this.colorIndex=(this.colorIndex+1)%this.pallete.length|0;n=this.pallete[this.colorIndex];this.colorMap.set(e,n)}r.copy(n,t)};return t}();var d=function(){function e(e,t){this.map=e;this.fallbackColor=t}e.prototype.setColor=function(e,t){var n=this.map.get(e);if(!n){n=this.fallbackColor}r.copy(n,t)};return e}()})(n=t.Theme||(t.Theme={}))})(t=e.Visualization||(e.Visualization={}))})(p||(p={}));/* 479 * Copyright (c) 2016 - now David Sehnal, licensed under Apache 2.0, See LICENSE file for more info. 480 */ 481var p;(function(e){var t;(function(e){var t=function(){function t(){}t.getPickMaterial=function(){return new e.THREE.ShaderMaterial({attributes:{pColor:{type:"v4",value:[]}},vertexShader:t.pickVertexShader,fragmentShader:t.pickFragmentShader,blending:e.THREE.NoBlending,shading:e.THREE.FlatShading,side:e.THREE.DoubleSide})};t.getPickExcludeMaterial=function(){return new e.THREE.MeshBasicMaterial({color:e.THREE.ColorKeywords.white,side:e.THREE.DoubleSide})};t.compareVectorAndColor=function(e,t){return e.x===t.r&&e.y===t.g&&e.z===t.b};t.updateMaterial=function(r,n,i){var a=false;if(t.updateTransparencyAndFog(r,n,i))a=true;if(r instanceof e.THREE.ShaderMaterial&&t.updateHighlightColor(r,n))a=true;if(a)r.needsUpdate=true};t.updateHighlightColor=function(r,n){var i=false;var a=r.uniforms.selectionColor.value;var o=e.Theme.getColor(n,"Selection",e.Theme.Default.SelectionColor);if(!t.compareVectorAndColor(a,o)){r.uniforms.selectionColor.value=e.Color.toVector(o);i=true}a=r.uniforms.highlightColor.value;var s=e.Theme.getColor(n,"Highlight",e.Theme.Default.HighlightColor);if(!t.compareVectorAndColor(a,s)){r.uniforms.highlightColor.value=e.Color.toVector(s);i=true}return i};t.updateTransparencyAndFog=function(t,r,n){var i=r.transparency;var a=+i.alpha;if(isNaN(a))a=1;var o=a<=.999;var s=!!i.writeDepth;if(!o){a=1;s=true}if(n)n.renderOrder=o?1:0;var u=false;if(t instanceof e.THREE.MeshPhongMaterial||t instanceof e.THREE.MeshBasicMaterial||t instanceof e.THREE.ShaderMaterial){if(t.transparent!==o){t.transparent=o;u=true}if(t.depthWrite!==s){t.depthWrite=s;u=true}if(t.opacity!==a){t.opacity=a;u=true}if(t.fog!==!r.disableFog){t.fog=!r.disableFog;u=true}if(t instanceof e.THREE.ShaderMaterial){if(t.uniforms.opacity){t.uniforms.opacity.value=a}}}return u};t.getMeshMaterial=function(r,n){if(r===void 0){r=e.THREE.SmoothShading}if(n===void 0){n=false}var i=t.shader;var a=new e.THREE.ShaderMaterial({uniforms:e.THREE.UniformsUtils.clone(i.uniforms),attributes:{vState:{type:"f",value:[]}},lights:true,fog:true,vertexShader:i.vertexShader,fragmentShader:i.fragmentShader,shading:r,side:e.THREE.DoubleSide,vertexColors:e.THREE.VertexColors,blending:e.THREE.NormalBlending,wireframe:n,linewidth:1});return a};t.getPhongVertexColorMaterial=function(){return new e.THREE.MeshPhongMaterial({specular:11184810,shininess:2,shading:e.THREE.SmoothShading,vertexColors:e.THREE.VertexColors,side:e.THREE.DoubleSide,metal:true})};t.getDefaultHighlightMaterial=function(){return new e.THREE.MeshPhongMaterial({color:16777215,specular:11184810,shininess:2,shading:e.THREE.SmoothShading,side:e.THREE.DoubleSide,metal:true})};t.applyColorToBuffer=function(e,t){var r=e.array;for(var n=0,i=r.length;n<i;n+=3){r[n]=t.r;r[n+1]=t.g;r[n+2]=t.b}e.needsUpdate=true};t.applyColorToMap=function(e,t,r){var n=t.array,i={r:.45,g:.45,b:.45},a=e.vertexRanges;for(var o=0,s=e.elementIndices;o<s.length;o++){var u=s[o];var l=e.elementMap.get(u);var c=e.elementRanges[2*l],f=e.elementRanges[2*l+1];if(c===f)continue;r(u,i);for(var h=c;h<f;h+=2){var d=a[h],p=a[h+1];for(var m=d;m<p;m++){n[m*3]=i.r,n[m*3+1]=i.g,n[m*3+2]=i.b}}}t.needsUpdate=true};t.pickVertexShader=["attribute vec4 pColor;","varying vec4 pC;","void main() {","pC = pColor;","gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n");t.pickFragmentShader=["varying vec4 pC;","void main() {","gl_FragColor = pC;","}"].join("\n");t.shader={uniforms:e.THREE.UniformsUtils.merge([e.THREE.UniformsLib["common"],e.THREE.UniformsLib["bump"],e.THREE.UniformsLib["normalmap"],e.THREE.UniformsLib["fog"],e.THREE.UniformsLib["lights"],e.THREE.UniformsLib["shadowmap"],{emissive:{type:"c",value:new e.THREE.Color(0)},specular:{type:"c",value:new e.THREE.Color(1118481)},shininess:{type:"f",value:2},wrapRGB:{type:"v3",value:new e.THREE.Vector3(1,1,1)},highlightColor:{type:"v3",value:new e.THREE.Vector3(1,1,0)},selectionColor:{type:"v3",value:new e.THREE.Vector3(1,0,0)}}]),vertexShader:["#define PHONG","varying vec3 vViewPosition;","#ifndef FLAT_SHADED","\tvarying vec3 vNormal;","#endif",e.THREE.ShaderChunk["common"],e.THREE.ShaderChunk["map_pars_vertex"],e.THREE.ShaderChunk["lightmap_pars_vertex"],e.THREE.ShaderChunk["envmap_pars_vertex"],e.THREE.ShaderChunk["lights_phong_pars_vertex"],e.THREE.ShaderChunk["color_pars_vertex"],e.THREE.ShaderChunk["morphtarget_pars_vertex"],e.THREE.ShaderChunk["skinning_pars_vertex"],e.THREE.ShaderChunk["shadowmap_pars_vertex"],e.THREE.ShaderChunk["logdepthbuf_pars_vertex"],"attribute float vState;","varying float vS;","void main() {"," vS = vState;",e.THREE.ShaderChunk["map_vertex"],e.THREE.ShaderChunk["lightmap_vertex"],e.THREE.ShaderChunk["color_vertex"],e.THREE.ShaderChunk["morphnormal_vertex"],e.THREE.ShaderChunk["skinbase_vertex"],e.THREE.ShaderChunk["skinnormal_vertex"],e.THREE.ShaderChunk["defaultnormal_vertex"],"#ifndef FLAT_SHADED","\tvNormal = normalize( transformedNormal );","#endif",e.THREE.ShaderChunk["morphtarget_vertex"],e.THREE.ShaderChunk["skinning_vertex"],e.THREE.ShaderChunk["default_vertex"],e.THREE.ShaderChunk["logdepthbuf_vertex"],"\tvViewPosition = -mvPosition.xyz;",e.THREE.ShaderChunk["worldpos_vertex"],e.THREE.ShaderChunk["envmap_vertex"],e.THREE.ShaderChunk["lights_phong_vertex"],e.THREE.ShaderChunk["shadowmap_vertex"],"}"].join("\n"),fragmentShader:["#define PHONG","uniform vec3 diffuse;","uniform vec3 emissive;","uniform vec3 specular;","uniform float shininess;","uniform float opacity;","uniform vec3 highlightColor;","uniform vec3 selectionColor;",e.THREE.ShaderChunk["common"],e.THREE.ShaderChunk["color_pars_fragment"],e.THREE.ShaderChunk["map_pars_fragment"],e.THREE.ShaderChunk["alphamap_pars_fragment"],e.THREE.ShaderChunk["lightmap_pars_fragment"],e.THREE.ShaderChunk["envmap_pars_fragment"],e.THREE.ShaderChunk["fog_pars_fragment"],e.THREE.ShaderChunk["lights_phong_pars_fragment"],e.THREE.ShaderChunk["shadowmap_pars_fragment"],e.THREE.ShaderChunk["bumpmap_pars_fragment"],e.THREE.ShaderChunk["normalmap_pars_fragment"],e.THREE.ShaderChunk["specularmap_pars_fragment"],e.THREE.ShaderChunk["logdepthbuf_pars_fragment"],"varying float vS;","void main() {","\tvec3 outgoingLight = vec3( 0.0 );","\tvec4 diffuseColor;"," if (vS < 0.33) { diffuseColor = vec4( vColor, opacity ); }"," else if (vS - floor(vS + 0.1) > 0.33) { diffuseColor = vec4(highlightColor, opacity); }","\telse { diffuseColor = vec4(selectionColor, opacity); }",e.THREE.ShaderChunk["logdepthbuf_fragment"],e.THREE.ShaderChunk["map_fragment"],e.THREE.ShaderChunk["alphamap_fragment"],e.THREE.ShaderChunk["alphatest_fragment"],e.THREE.ShaderChunk["specularmap_fragment"],e.THREE.ShaderChunk["lights_phong_fragment"],e.THREE.ShaderChunk["lightmap_fragment"],e.THREE.ShaderChunk["envmap_fragment"],e.THREE.ShaderChunk["shadowmap_fragment"],e.THREE.ShaderChunk["linear_to_gamma_fragment"],e.THREE.ShaderChunk["fog_fragment"],"#ifdef USE_FOG"," if (diffuseColor.a > 0.99) { gl_FragColor = vec4( outgoingLight, diffuseColor.a ); }"," else { gl_FragColor = vec4( outgoingLight, (1.0 - fogFactor) * diffuseColor.a ); }","#else","\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );","#endif","}"].join("\n")};return t}();e.MaterialsHelper=t})(t=e.Visualization||(e.Visualization={}))})(p||(p={}));/* 482 * Copyright (c) 2016 - now David Sehnal, licensed under Apache 2.0, See LICENSE file for more info. 483 */ 484var p;(function(e){var t;(function(e){var t=function(){function e(){}return e}();e.GeometryBase=t;var r=function(){function t(){this.id=-1;this.entity=void 0;this.centroid=new e.THREE.Vector3;this.radius=0;this.object=void 0;this.theme=void 0;this.disposeList=[];this.pickObject=void 0;this.pickBufferAttributes=[];this.dirty=false;this.props={};this.tag=void 0}t.prototype.updateVisibility=function(e){this.dirty=true;this.object.visible=e;if(this.pickObject){this.pickObject.visible=this.getPickObjectVisibility(e)}};t.prototype.getVisibility=function(){return this.object.visible};t.prototype.applyTheme=function(e){this.dirty=true;this.theme=e;if(!e.interactive){if(this.pickObject)this.pickObject.visible=false}else{if(this.pickObject)this.pickObject.visible=this.object.visible}this.applyThemeInternal(e)};t.prototype.updateId=function(t,r){this.id=t;
484for(var n=0,i=this.pickBufferAttributes;n<i.length;n++){var a=i[n];var o=a.array;if(r<=8){for(var s=0,u=o.length;s<u;s+=4){e.Selection.Picking.applySceneIdFast(this.id,s,o)}}else{for(var s=0,u=o.length;s<u;s+=4){e.Selection.Picking.applySceneIdSlow(r-8,this.id,s,o)}}a.needsUpdate=true}};t.prototype.dispose=function(){for(var e=0,t=this.disposeList;e<t.length;e++){var r=t[e];if(r)r.dispose()}this.disposeList=[]};t.prototype.highlight=function(e){var t=this.highlightInternal(e);this.dirty=this.dirty||t;return t};t.prototype.applySelection=function(e,t){var r=this.applySelectionInternal(e,t);this.dirty=this.dirty||r;return r};t.prototype.getBoundingSphereOfSelection=function(e){return undefined};t.prototype.getPickObjectVisibility=function(e){return e&&this.theme.interactive};return t}();e.Model=r})(t=e.Visualization||(e.Visualization={}))})(p||(p={}));/* 485 * Copyright (c) 2016 - now David Sehnal, licensed under Apache 2.0, See LICENSE file for more info. 486 */ 487var p;(function(e){var t;(function(t){var r=function(){function t(t){this.scene=t;this.availableIds=[];this.list=[];this.map=e.Core.Utils.FastMap.create();this.maxId=1;this._idWidth=8}Object.defineProperty(t.prototype,"idWidth",{get:function(){return this._idWidth},enumerable:true,configurable:true});Object.defineProperty(t.prototype,"all",{get:function(){return this.list},enumerable:true,configurable:true});Object.defineProperty(t.prototype,"count",{get:function(){return this.map.size},enumerable:true,configurable:true});t.prototype.getBySceneId=function(e){return this.map.get(e)};t.prototype.add=function(e,t){if(t===void 0){t=true}var r=-1;if(this.availableIds.length){r=this.availableIds.pop()}else{r=this.maxId++}this.map.set(r,e);this.list.push(e);e.updateId(r,8);if(e.object){this.scene.scene.add(e.object)}if(e.pickObject)this.scene.pickScene.add(e.pickObject);if(t){this.scene.camera.reset()}else{this.scene.forceRender()}};t.prototype.dispose=function(e){if(e.object){this.scene.scene.remove(e.object)}if(e.pickObject)this.scene.pickScene.remove(e.pickObject);e.dispose()};t.prototype.removeAndDispose=function(e){if(!this.map.get(e.id))return;this.availableIds.push(e.id);this.dispose(e);this.map.delete(e.id);var t=this.list.indexOf(e);this.list[t]=this.list[this.list.length-1];this.list.pop();if(e.id===this.maxId)this.maxId--;e.id=-1;this.scene.forceRender()};t.prototype.clear=function(){for(var e=0,t=this.list;e<t.length;e++){var r=t[e];this.dispose(r)}this.list=[];this.maxId=0;this.availableIds=[];this.map.clear();this.scene.forceRender()};return t}();t.ModelStore=r})(t=e.Visualization||(e.Visualization={}))})(p||(p={}));/* 488 * Copyright (c) 2016 - now David Sehnal, licensed under Apache 2.0, See LICENSE file for more info. 489 */ 490var p;(function(e){var t;(function(t){var r;(function(e){e[e["Perspective"]=0]="Perspective";e[e["Orthographic"]=1]="Orthographic"})(r=t.CameraType||(t.CameraType={}));var n=e.Core.Geometry.LinearAlgebra;var i=function(){function t(t){var r=this;this.touchSlabOn=false;this.touchStartPosition={x:0,y:0};this.touchPosition={x:0,y:0};this.radius=0;this.slabWheelRate=1/15;this._planeDelta=new e.Core.Rx.Subject;this.subs=[];this.enableWheel=false;this.mouseMoveDelta=0;this.lastMousePosition=void 0;this.planeDelta=this._planeDelta;var n={wheel:function(e){return r.handleMouseWheel(e)},touchStart:function(e){return r.touchstart(e)},touchEnd:function(e){return r.touchend(e)},touchMove:function(e){return r.touchmove(e)},mouseMove:function(e){return r.mousemove(e)},mouseOut:function(){return r.mouseOut()}};t.addEventListener("mousewheel",n.wheel);t.addEventListener("DOMMouseScroll",n.wheel);t.addEventListener("mousemove",n.mouseMove);t.addEventListener("mouseout",n.mouseOut);t.addEventListener("touchstart",n.touchStart,false);t.addEventListener("touchend",n.touchEnd,false);t.addEventListener("touchmove",n.touchMove,false);this.subs.push(function(){return t.removeEventListener("mousewheel",n.wheel)});this.subs.push(function(){return t.removeEventListener("mousemove",n.mouseMove)});this.subs.push(function(){return t.removeEventListener("mouseout",n.mouseOut)});this.subs.push(function(){return t.removeEventListener("DOMMouseScroll",n.wheel)});this.subs.push(function(){return t.removeEventListener("touchstart",n.touchStart,false)});this.subs.push(function(){return t.removeEventListener("touchend",n.touchEnd,false)});this.subs.push(function(){return t.removeEventListener("touchmove",n.touchMove,false)})}t.prototype.updateSize=function(e,t){this.height=t};t.prototype.updateRadius=function(e){this.radius=e};t.prototype.destroy=function(){for(var e=0,t=this.subs;e<t.length;e++){var r=t[e];r()}this.subs=[];this._planeDelta.onCompleted()};t.prototype.handleMouseWheel=function(e){if(!this.enableWheel)return;if(e.stopPropagation){e.stopPropagation()}if(e.preventDefault){e.preventDefault()}var t=0;if(e.wheelDelta){t=e.wheelDelta}else if(e.detail){t=-e.detail}var r=t<0?1:-1;t=this.radius*this.slabWheelRate*r;this._planeDelta.onNext(t)};t.prototype.touchstart=function(e){switch(e.touches.length){case 3:{this.touchStartPosition.x=0;this.touchStartPosition.y=0;for(var t=0;t<3;t++){this.touchStartPosition.x+=e.touches[t].clientX/3;this.touchStartPosition.y+=e.touches[t].clientY/3}this.touchSlabOn=true;break}default:this.touchSlabOn=false;break}};t.prototype.touchend=function(e){this.touchSlabOn=false};t.prototype.touchmove=function(e){if(!this.touchSlabOn)return;this.touchPosition.x=0;this.touchPosition.y=0;for(var t=0;t<3;t++){this.touchPosition.x+=e.touches[t].clientX/3;this.touchPosition.y+=e.touches[t].clientY/3}var r=-5*this.radius*(this.touchPosition.y-this.touchStartPosition.y)/this.height;this.touchStartPosition.x=this.touchPosition.x;this.touchStartPosition.y=this.touchPosition.y;this._planeDelta.onNext(r)};t.prototype.mousemove=function(e){if(!this.lastMousePosition){this.lastMousePosition=[e.clientX,e.clientY,0];return}var t=[e.clientX,e.clientY,0];this.mouseMoveDelta+=n.Vector3.distance(t,this.lastMousePosition);this.lastMousePosition=t;if(this.mouseMoveDelta>15)this.enableWheel=true};t.prototype.mouseOut=function(){this.mouseMoveDelta=0;this.lastMousePosition=void 0;this.enableWheel=false};return t}();t.SlabControls=i;var a=function(){function e(e,r){this.scene=e;this.domElement=r;this.fog=new t.THREE.Fog(0,0,500);this.focusPoint=new t.THREE.Vector3(0,0,0);this.focusRadius=0;this.targetDistance=0;this.nearPlaneDistance=0;this.nearPlaneDelta=0;this.fogEnabled=true;this.fogDelta=0;this.observers=[];this.setup()}e.shouldInUpdateInclude=function(e){return!isNaN(e.centroid.x)&&e.getVisibility()};e.prototype.updateFocus=function(r){if(!r.length)return;var n=r.filter(function(t){return e.shouldInUpdateInclude(t)}).sort(function(e,t){return t.radius-e.radius});if(!n.length)return;var i=[n[0]];var a=new t.THREE.Vector3;for(var o=1;o<n.length;o++){var s=n[o];var u=true;for(var l=0,c=i;l<c.length;l++){var f=c[l];var h=a.subVectors(s.centroid,f.centroid).length();if(h<f.radius){u=false;break}}if(u){i.push(s)}}var d=this.focusPoint;d.x=0;d.y=0;d.z=0;for(var p=0,m=i;p<m.length;p++){var f=m[p];d.add(f.centroid)}d.multiplyScalar(1/i.length);var v=0;for(var y=0,g=n;y<g.length;y++){var b=g[y];v=Math.max(v,d.distanceTo(b.centroid)+b.radius)}this.focusRadius=v;this.slabControls.updateRadius(this.focusRadius)};
490e.prototype.focus=function(){this.controls.reset();var e=this.focusPoint;this.camera.position.set(e.x,e.y,e.z+4*this.focusRadius);this.camera.lookAt(e);this.controls.target.set(e.x,e.y,e.z);this.cameraUpdated()};e.prototype.reset=function(){this.nearPlaneDelta=0;this.fogDelta=0;this.updateFocus(this.scene.models.all);this.focus()};e.prototype.snapshot=function(){return this.controls.getState()};e.prototype.restore=function(e){this.controls.setState(e);this.scene.forceRender()};e.prototype.focusOnModel=function(){var e=[];for(var t=0;t<arguments.length;t++){e[t]=arguments[t]}this.updateFocus(e);this.nearPlaneDelta=0;this.fogDelta=0;this.controls.panAndMoveToDistance(this.focusPoint,this.focusRadius*4)};e.prototype.focusOnPoint=function(e,t){this.focusPoint.x=e.x;this.focusPoint.y=e.y;this.focusPoint.z=e.z;this.focusRadius=Math.max(t,1);this.slabControls.updateRadius(this.focusRadius);this.nearPlaneDelta=0;this.fogDelta=0;this.controls.panAndMoveToDistance(this.focusPoint,this.focusRadius*4)};e.prototype.move=function(e){this.controls.panTo(e)};e.prototype.updateSize=function(e,r){var n=this.camera;if(n instanceof t.THREE.PerspectiveCamera){n.aspect=e/r}this.slabControls.updateSize(e,r);this.camera.updateProjectionMatrix()};Object.defineProperty(e.prototype,"position",{get:function(){return this.camera.position},enumerable:true,configurable:true});Object.defineProperty(e.prototype,"object",{get:function(){return this.camera},enumerable:true,configurable:true});e.prototype.dispose=function(){if(this.slabControls){this.slabControls.destroy();this.slabControls=void 0}if(this.unbindCamera){this.unbindCamera();this.unbindCamera=void 0}if(this.controls){this.controls.destroy();this.controls=void 0}};e.prototype.planeDeltaUpdate=function(e){var t=this.computeNearDistance();var r=t+this.nearPlaneDelta+e;if(e>0&&r>this.targetDistance)e=0;if(e<0&&r<.01)e=0;this.nearPlaneDelta+=e;this.fogDelta+=e;this.cameraUpdated()};e.prototype.computeNearDistance=function(){var e=this.controls.target.distanceTo(this.camera.position);if(e>this.focusRadius)return e-this.focusRadius;return 0};e.prototype.cameraUpdated=function(){var e=this.scene.options;this.fogEnabled=!!e.enableFog;var r=this.camera;if(r instanceof t.THREE.PerspectiveCamera){r.fov=e.cameraFOV}this.targetDistance=this.controls.target.distanceTo(this.camera.position);var n=this.computeNearDistance()+this.nearPlaneDelta;this.camera.near=Math.max(.01,Math.min(n,this.targetDistance-.5));if(e.enableFog){var i=this.targetDistance-this.camera.near+1*this.focusRadius-this.nearPlaneDelta;var a=this.targetDistance-this.camera.near+2*this.focusRadius-this.nearPlaneDelta;this.fog.near=Math.max(i,.1);this.fog.far=Math.max(a,.2)}else{this.fog.far=1000001;this.fog.near=1e6}this.camera.updateProjectionMatrix();this.scene.forceRender();for(var o=0,s=this.observers;o<s.length;o++){var u=s[o];u.call(null,this)}};e.prototype.createCamera=function(){if(this.scene.options.cameraType===r.Perspective){this.camera=new t.THREE.PerspectiveCamera(this.scene.options.cameraFOV,this.scene.parentElement.clientWidth/this.scene.parentElement.clientHeight,.1,1e6)}else{var e=this.scene.parentElement.clientWidth,n=this.scene.parentElement.clientHeight;var i=100,a=n/e*i;this.camera=new t.THREE.OrthographicCamera(.5*i/-2,.5*i/2,a/2,a/-2,.1,1e6)}if(this.controls){this.controls.camera=this.camera;this.reset()}};e.prototype.setup=function(){var e=this;this.dispose();this.createCamera();this.controls=new t.CameraControls(this.camera,this.domElement,this.scene);var r=this.scene.options.clearColor;this.fog.color.setRGB(r.r,r.g,r.b);this.scene.scene.fog=this.fog;var n=function(){return e.cameraUpdated()};this.slabControls=new i(this.domElement);var a=this.slabControls.planeDelta.subscribe(function(t){return e.planeDeltaUpdate(t)});this.controls.events.addEventListener("change",n);this.unbindCamera=function(){e.controls.events.removeEventListener("change",n);a.dispose();e.observers=[]};this.reset()};e.prototype.observe=function(e){this.observers.push(e)};e.prototype.stopObserving=function(e){this.observers=this.observers.filter(function(t){return t!==e})};return e}();t.Camera=a})(t=e.Visualization||(e.Visualization={}))})(p||(p={}));/* 491 * Copyright (c) 2016 - now David Sehnal, licensed under Apache 2.0, See LICENSE file for more info. 492 */ 493var p;(function(e){var t;(function(t){t.DefaultSceneOptions={alpha:false,clearColor:{r:0,g:0,b:0},cameraSpeed:6,cameraFOV:30,cameraType:t.CameraType.Perspective,enableFog:true};var r=function(){function e(e,t){this.renderState=e;this.domElement=t;this.position={x:0,y:0};this.lastPosition={x:0,y:0};this.isDirty=true;this.rect={left:0,top:0,right:0,bottom:0};this.exactPosition={x:0,y:0};this.isInside=false;this.isButtonDown=false}e.prototype.updateRect=function(){var e=this.domElement.getBoundingClientRect();this.rect.bottom=e.bottom;this.rect.top=e.top;this.rect.left=e.left;this.rect.right=e.right};e.prototype.updatePosition=function(e,t){if(this.position.x===e&&this.position.y===t){return}this.isDirty=true;this.position.x=e;this.position.y=t};e.prototype.update=function(){if(this.lastPosition.x===this.position.x&&this.lastPosition.y===this.position.y){return false}this.lastPosition.x=this.position.x;this.lastPosition.y=this.position.y;return true};e.prototype.setExactPosition=function(){if(!this.isDirty){return}var e=Math.round((this.position.x-this.rect.left)/(this.rect.right-this.rect.left)*this.renderState.width)|0;var t=Math.round((this.position.y-this.rect.top)/(this.rect.bottom-this.rect.top)*this.renderState.height)|0;this.exactPosition.x=e;this.exactPosition.y=t;this.isDirty=false};return e}();t.MouseInfo=r;var n=function(){function e(){this.lights=[]}e.prototype.setup=function(e){var r=new t.THREE.PointLight(11184810,.75);e.add(r);this.lights=[r];var n=new t.THREE.AmbientLight(10066329);e.add(n)};e.prototype.update=function(e){for(var t=0,r=this.lights;t<r.length;t++){var n=r[t];n.position.copy(e)}};return e}();t.DefaultLighting=n;var i=function(){function e(){this.width=0;this.height=0;this.resizing=false;this.rendered=false;this.lastRenderTime=0;this.pickDelta=0;this.animationFrame=0}return e}();t.RenderState=i;var a=function(){function a(a,o){if(o===void 0){o={}}var s=this;this.renderState=new i;this.pickInfo=new t.Selection.Pick;this.unbindEvents=[];this.models=new t.ModelStore(this);this.events=new t.THREE.EventDispatcher;this.initialResizeTimeout=void 0;this.clearHighlightsCall=function(){return s.clearHighlights(true)};this.renderFunc=function(e){return s.render(e)};this.pickBuffer=new Uint8Array(4);o=e.Core.Utils.extend({},o,t.DefaultSceneOptions);this.options=o;this.parentElement=a;this.scene=new t.THREE.Scene;this.pickScene=new t.THREE.Scene;this.pickTarget=new t.THREE.WebGLRenderTarget(1,1,{format:t.THREE.RGBAFormat,minFilter:t.THREE.LinearFilter});this.pickTarget.generateMipmaps=false;this.renderer=new t.THREE.WebGLRenderer({antialias:true,alpha:o.alpha,preserveDrawingBuffer:true});this.renderer.setPixelRatio(window.devicePixelRatio||1);this.renderer.setClearColor(new t.THREE.Color(o.clearColor.r,o.clearColor.g,o.clearColor.b));this.renderer.autoClear=true;this.renderer.sortObjects=false;this.mouseInfo=new r(this.renderState,this.renderer.domElement);this.lighting=new n;this.lighting.setup(this.scene);this.parentElement.appendChild(this.renderer.domElement);var u=e.Core.Utils.debounce(function(){return s.handleResize()},150),l=function(){s.renderState.resizing=true;u()};window.addEventListener("resize",l);document.addEventListener("resize",l);this.parentElement.addEventListener("resize",l);this.unbindEvents.push(function(){return window.removeEventListener("resize",l)});this.unbindEvents.push(function(){return document.removeEventListener("resize",l)});this.unbindEvents.push(function(){return s.parentElement.removeEventListener("resize",l)});this.setupMouse();this.camera=new t.Camera(this,this.renderer.domElement);this.handleResize();this.renderer.clear();this.needsRender();this.renderState.animationFrame=requestAnimationFrame(this.renderFunc);this.initialResizeTimeout=setTimeout(function(){s.initialResizeTimeout=void 0;s.handleResize()},1e3)}a.prototype.updateOptions=function(r){r=e.Core.Utils.extend({},r,this.options);var n=r.cameraType!==this.options.cameraType;var i=r.clearColor;this.renderer.setClearColor(new t.THREE.Color(i.r,i.g,i.b));this.renderer.setClearAlpha(r.alpha?0:1);this.camera.fog.color.setRGB(i.r,i.g,i.b);if(this.camera.controls){this.camera.controls.rotateSpeed=r.cameraSpeed;this.camera.controls.zoomSpeed=r.cameraSpeed}this.options=r;if(n)this.camera.createCamera();this.camera.cameraUpdated();this.forceRender()};a.prototype.setupMouse=function(){var e=this;var t=function(t){if(!e.mouseInfo.isInside){e.mouseInfo.updateRect()}e.mouseInfo.updatePosition(t.clientX,t.clientY);e.mouseInfo.isInside=true};var r=this.renderer.domElement;r.addEventListener("mousemove",t);this.unbindEvents.push(function(){return r.removeEventListener("mousemove",t)});var n=function(t){e.mouseInfo.isInside=false;e.clearHighlights()};r.addEventListener("mouseleave",n);this.unbindEvents.push(function(){return r.removeEventListener("mouseleave",n)});var i=function(t){if(e.mouseInfo.isInside){e.mouseInfo.updateRect();e.handleSelectStart(t.clientX,t.clientY)}else{}e.mouseInfo.isButtonDown=true;e.clearHighlights()};r.addEventListener("mousedown",i);this.unbindEvents.push(function(){return r.removeEventListener("mousedown",i)});var a=function(t){e.mouseInfo.isButtonDown=false;e.needsRender();e.handleSelectEnd(t.clientX,t.clientY);e.clearHighlights(true)};window.addEventListener("mouseup",a);this.unbindEvents.push(function(){return window.removeEventListener("mouseup",a)});var o=function(t){e.mouseInfo.updateRect()};window.addEventListener("mousewheel",o);window.addEventListener("DOMMouseScroll",o);this.unbindEvents.push(function(){return window.removeEventListener("mousewheel",o)});this.unbindEvents.push(function(){return window.removeEventListener("DOMMouseScroll",o)});r.addEventListener("touchstart",o,false);this.unbindEvents.push(function(){return r.removeEventListener("touchstart",o,false)});var s=function(t){var r=t.touches;if(!r.length){r=t.changedTouches}if(r.length===1){e.handleSelectEnd(r[0].clientX,r[0].clientY)}setTimeout(e.clearHighlightsCall,1e3/15)};r.addEventListener("touchend",s,false);this.unbindEvents.push(function(){return r.removeEventListener("touchend",s,false)});try{r.addEventListener("touchcancel",s,false);this.unbindEvents.push(function(){return r.removeEventListener("touchcancel",s,false)})}catch(e){}};a.prototype.handleSelectStart=function(e,t){this.pickInfo.selectStart(e,t)};a.prototype.handleSelectEnd=function(e,t){if(this.pickInfo.selectEnd(e,t)){var r=this.handlePick(true);this.dispatchSelectEvent(r)}};a.prototype.handleResize=function(){var e=this.parentElement.clientWidth,r=this.parentElement.clientHeight;this.camera.updateSize(e,r);if(this.renderState.height===r&&this.renderState.width===e){this.renderState.resizing=false;return}this.renderState.width=e;this.renderState.height=r;this.renderer.setSize(e,r);this.pickTarget=new t.THREE.WebGLRenderTarget(e,r,{format:t.THREE.RGBAFormat,minFilter:t.THREE.LinearFilter});this.pickTarget.generateMipmaps=false;this.renderState.resizing=false;this.mouseInfo.updateRect();this.needsRender()};a.prototype.needsRender=function(){this.renderState.rendered=false};a.prototype.checkDirty=function(){var e=false;for(var t=0,r=this.models.all;t<r.length;t++){var n=r[t];e=e||n.dirty;n.dirty=false}return e};a.prototype.render=function(e){if(this.renderState.resizing){this.renderState.animationFrame=requestAnimationFrame(this.renderFunc);return}var t=e-this.renderState.lastRenderTime;this.renderState.pickDelta+=t;this.renderState.lastRenderTime=e;if(this.renderState.pickDelta>33.3333333){this.renderState.pickDelta=this.renderState.pickDelta%33.3333333;this.handlePick(false)}var r=this.checkDirty();if(r)this.renderState.rendered=false;if(!this.renderState.rendered){this.lighting.update(this.camera.position);this.renderer.sortObjects=true;this.renderer.render(this.scene,this.camera.object);this.renderer.sortObjects=false;this.renderState.rendered=true;if(!this.mouseInfo.isButtonDown){this.renderer.setClearAlpha(1);this.renderer.render(this.pickScene,this.camera.object,this.pickTarget);this.renderer.setClearAlpha(this.options.alpha?0:1)}}this.renderState.animationFrame=requestAnimationFrame(this.renderFunc)};a.prototype.dispatchHoverEvent=function(){this.events.dispatchEvent({type:a.hoverEvent,target:null,data:this.pickInfo.getPickInfo()})};a.prototype.dispatchSelectEvent=function(e){if(e){this.events.dispatchEvent({type:a.selectEvent,target:null,data:e})}};a.prototype.clearHighlights=function(e){if(e===void 0){e=true}var t=this.pickInfo,r=this.models.getBySceneId(t.currentPickId),n=false;if(r){n=r.highlightElement(t.currentPickElementId,false)}if(n&&e)this.needsRender();if(this.pickInfo.reset()){this.dispatchHoverEvent()}return n};a.prototype.handlePick=function(e){if(!e&&(!this.mouseInfo.update()||this.mouseInfo.isButtonDown)||this.renderState.resizing){return}if(!this.mouseInfo.isInside){return void 0}this.mouseInfo.setExactPosition();var r=this.mouseInfo.exactPosition;var n=this.pickTarget.height-r.y;if(this.pickTarget.width<r.x-1||r.x<.01||this.pickTarget.height<n-1||n<.01){return void 0}this.renderer.readRenderTargetPixels(this.pickTarget,r.x|0,n|0,1,1,this.pickBuffer);
493var i=t.Selection.Picking.getSceneId(this.models.idWidth,this.pickBuffer),a=t.Selection.Picking.getElementId(this.models.idWidth,this.pickBuffer),o=this.pickInfo;if(e){if(i===255)return void 0;var s=this.models.getBySceneId(i);if(!s)return void 0;return{model:s,elements:s.getPickElements(a)}}else{if(i===o.currentPickId&&a===o.currentPickElementId)return void 0;var u=this.clearHighlights(false),s=this.models.getBySceneId(i);if(i===255||!s){if(u)this.needsRender();return void 0}o.currentPickId=i;o.currentPickElementId=a;if(s.highlightElement(a,true)||u){this.needsRender();o.current={model:s,elements:s.getPickElements(a)};this.dispatchHoverEvent()}return void 0}};a.prototype.resized=function(){this.handleResize()};a.prototype.forceRender=function(){this.needsRender()};a.prototype.clear=function(){this.models.clear()};a.prototype.downloadScreenshot=function(){var e=this.renderer.domElement.toDataURL("image/png");var t=document.createElement("a");if("download"in t){t.style.visibility="hidden";t.href=e;t.target="_blank";t.download="litemol_screenshot.png";document.body.appendChild(t);t.click();t.remove()}else{window.open(e,"_blank")}};a.prototype.destroy=function(){this.clear();for(var e=0,t=this.unbindEvents;e<t.length;e++){var r=t[e];try{r()}catch(e){}}if(this.initialResizeTimeout!==void 0){clearTimeout(this.initialResizeTimeout);this.initialResizeTimeout=void 0}this.unbindEvents=[];cancelAnimationFrame(this.renderState.animationFrame);this.scene=null;this.pickScene=null;this.camera.dispose();this.camera=null;if(this.renderer&&this.renderer.dispose)this.renderer.dispose();this.renderer=null;this.pickTarget.dispose();this.pickTarget=null;while(this.parentElement.lastChild)this.parentElement.removeChild(this.parentElement.lastChild)};a.hoverEvent="hover";a.selectEvent="select";return a}();t.Scene=a})(t=e.Visualization||(e.Visualization={}))})(p||(p={}));/* 494 * Copyright (c) 2016 - now David Sehnal, licensed under Apache 2.0, See LICENSE file for more info. 495 */ 496var p;(function(e){var t;(function(e){var t=function(){function t(t,r,n){var i=this;this.camera=t;this.domElement=r;this.scene=n;this.enabled=true;this.rotateSpeed=6;this.zoomSpeed=6;this.panSpeed=1;this.noRotate=false;this.noZoom=false;this.noPan=false;this.noRoll=true;this.staticMoving=true;this.dynamicDampingFactor=.2;this.minDistance=1.5;this.maxDistance=1e5;this.keys=[65,16,17];this.target=new e.THREE.Vector3;this.EPS=1e-6;this.lastPosition=new e.THREE.Vector3;this._state=-1;this._keyDownState=-1;this._prevState=-1;this._eye=new e.THREE.Vector3;this._rotateStart=new e.THREE.Vector3;this._rotateEnd=new e.THREE.Vector3;this._zoomStart=new e.THREE.Vector2;this._zoomEnd=new e.THREE.Vector2;this._touchZoomDistanceStart=0;this._touchZoomDistanceEnd=0;this._panStart=new e.THREE.Vector2;this._panEnd=new e.THREE.Vector2;this.target0=this.target.clone();this.position0=this.camera.position.clone();this.up0=this.camera.up.clone();this.changeEvent={type:"change",target:void 0};this.startEvent={type:"start",target:void 0};this.endEvent={type:"end",target:void 0};this.events=new e.THREE.EventDispatcher;this._mouseOnScreen=new e.THREE.Vector2;this._mouseOnBallProjection=new e.THREE.Vector3;this._objectUp=new e.THREE.Vector3;this._mouseOnBall=new e.THREE.Vector3;this._rotationAxis=new e.THREE.Vector3;this._rotationQuaternion=new e.THREE.Quaternion;this._panMouseChange=new e.THREE.Vector2;this._panObjectUp=new e.THREE.Vector3;this._panPan=new e.THREE.Vector3;this._panToDelta=new e.THREE.Vector3;this._panToVector=new e.THREE.Vector3;this.eventHandlers={keydown:function(e){return i.keydown(e)},keyup:function(e){return i.keyup(e)},mousedown:function(e){return i.mousedown(e)},mouseup:function(e){return i.mouseup(e)},mousemove:function(e){return i.mousemove(e)},touchstart:function(e){return i.touchstart(e)},touchmove:function(e){return i.touchmove(e)},touchend:function(e){return i.touchend(e)}};this.init()}t.prototype.getMouseOnScreen=function(){this.scene.mouseInfo.setExactPosition();var e=this.scene.renderState,t=this.scene.mouseInfo.exactPosition;this._mouseOnScreen.set(t.x/e.width,t.y/e.height);return this._mouseOnScreen};t.prototype.getMouseProjectionOnBall=function(){this.scene.mouseInfo.setExactPosition();var e=this.scene.renderState,t=this.scene.mouseInfo.exactPosition;var r=.5*e.width,n=.5*e.height,i=(t.x-r)/(e.width*.5),a=-(t.y-n)/(e.height*.5);this._mouseOnBall.set(i,a,0);var o=this._mouseOnBall.length();if(this.noRoll){if(o<Math.SQRT1_2){this._mouseOnBall.z=Math.sqrt(1-o*o)}else{this._mouseOnBall.z=.5/o}}else if(o>1){this._mouseOnBall.normalize()}else{this._mouseOnBall.z=Math.sqrt(1-o*o)}this._eye.copy(this.camera.position).sub(this.target);this._mouseOnBallProjection.copy(this.camera.up).setLength(this._mouseOnBall.y);this._mouseOnBallProjection.add(this._objectUp.copy(this.camera.up).cross(this._eye).setLength(this._mouseOnBall.x));this._mouseOnBallProjection.add(this._eye.setLength(this._mouseOnBall.z));return this._mouseOnBallProjection};t.prototype.rotateCamera=function(){var e=Math.acos(this._rotateStart.dot
496(this._rotateEnd)/this._rotateStart.length()/this._rotateEnd.length());if(e){this._rotationAxis.crossVectors(this._rotateStart,this._rotateEnd).normalize();e*=this.rotateSpeed;this._rotationQuaternion.setFromAxisAngle(this._rotationAxis,-e);this._eye.applyQuaternion(this._rotationQuaternion);this.camera.up.applyQuaternion(this._rotationQuaternion);this._rotateEnd.applyQuaternion(this._rotationQuaternion);if(this.staticMoving){this._rotateStart.copy(this._rotateEnd)}else{this._rotationQuaternion.setFromAxisAngle(this._rotationAxis,e*(this.dynamicDampingFactor-1));this._rotateStart.applyQuaternion(this._rotationQuaternion)}}};t.prototype.zoomCamera=function(){if(this._state===4){var e=this._touchZoomDistanceStart/this._touchZoomDistanceEnd;this._touchZoomDistanceStart=this._touchZoomDistanceEnd;this._eye.multiplyScalar(e)}else{var e=1-(this._zoomEnd.y-this._zoomStart.y)*this.zoomSpeed;if(e!==1&&e>0){this._eye.multiplyScalar(e);if(this.staticMoving){this._zoomStart.copy(this._zoomEnd)}else{this._zoomStart.y+=(this._zoomEnd.y-this._zoomStart.y)*this.dynamicDampingFactor}}}};t.prototype.panCamera=function(){this._panMouseChange.copy(this._panEnd).sub(this._panStart);if(this._panMouseChange.lengthSq()){this._panMouseChange.multiplyScalar(this._eye.length()*this.panSpeed);this._panPan.copy(this._eye).cross(this.camera.up).setLength(this._panMouseChange.x);this._panPan.add(this._panObjectUp.copy(this.camera.up).setLength(this._panMouseChange.y));this.camera.position.add(this._panPan);this.target.add(this._panPan);if(this.staticMoving){this._panStart.copy(this._panEnd)}else{this._panStart.add(this._panMouseChange.subVectors(this._panEnd,this._panStart).multiplyScalar(this.dynamicDampingFactor))}}};t.prototype.panTo=function(e){var t=e.x,r=e.y,n=e.z;this._panToVector.set(t,r,n);this._panToDelta.subVectors(this._panToVector,this.target);this.camera.position.add(this._panToDelta);this.camera.lookAt(this._panToVector);this.target.copy(this._panToVector);this._eye.subVectors(this.camera.position,this.target);this.lastPosition.copy(this.camera.position);if(this._panToDelta.lengthSq()>this.EPS){this.events.dispatchEvent(this.changeEvent)}};t.prototype.panAndMoveToDistance=function(e,t){var r=e.x,n=e.y,i=e.z;this._panToVector.set(r,n,i);this._panToDelta.subVectors(this._panToVector,this.target);this.camera.position.add(this._panToDelta);this.camera.lookAt(this._panToVector);this.target.copy(this._panToVector);this._eye.subVectors(this.camera.position,this.target);this._eye.setLength(t);this.camera.position.addVectors(this.target,this._eye);this.checkDistances();this.lastPosition.copy(this.camera.position);this.events.dispatchEvent(this.changeEvent)};t.prototype.checkDistances=function(){if(!this.noZoom||!this.noPan){if(this._eye.lengthSq()>this.maxDistance*this.maxDistance){this.camera.position.addVectors(this.target,this._eye.setLength(this.maxDistance))}if(this._eye.lengthSq()<this.minDistance*this.minDistance){this.camera.position.addVectors(this.target,this._eye.setLength(this.minDistance))}}};t.prototype.update=function(){this._eye.subVectors(this.camera.position,this.target);if(!this.noRotate){this.rotateCamera()}if(!this.noZoom){this.zoomCamera()}if(!this.noPan){this.panCamera()}this.camera.position.addVectors(this.target,this._eye);this.checkDistances();this.camera.lookAt(this.target);if(this.lastPosition.distanceToSquared(this.camera.position)>this.EPS){this.events.dispatchEvent(this.changeEvent);this.lastPosition.copy(this.camera.position)}};t.prototype.reset=function(){this._state=-1;this._prevState=-1;this.target.copy(this.target0);this.camera.position.copy(this.position0);this.camera.up.copy(this.up0);this._eye.subVectors(this.camera.position,this.target);this.camera.lookAt(this.target);this.events.dispatchEvent(this.changeEvent);this.lastPosition.copy(this.camera.position)};t.prototype.getState=function(){return{state:this._state,prevState:this._prevState,target:this.target.clone(),objPos:this.camera.position.clone(),objUp:this.camera.up.clone(),eye:this._eye.clone(),lastPosition:this.lastPosition.clone()}};t.prototype.setState=function(e){this._state=e.state;this._prevState=e.prevState;this.target.copy(e.target);this.camera.position.copy(e.objPos);this.camera.up.copy(e.objUp);this._eye.copy(e.eye);this.camera.lookAt(this.target);this.events.dispatchEvent(this.changeEvent);this.lastPosition.copy(e.lastPosition)};t.prototype.keydown=function(e){if(this.enabled===false)return;window.removeEventListener("keydown",this.eventHandlers.keydown,false);window.addEventListener("keyup",this.eventHandlers.keyup,false);this._prevState=this._state;if(this._state!==-1){return}else if(e.keyCode===this.keys[0]&&!this.noRotate){this._state=0}else if(e.keyCode===this.keys[2]&&!this.noZoom){this._state=2}else if(e.keyCode===this.keys[1]&&!this.noPan){this._state=1}this._keyDownState=this._state};t.prototype.keyup=function(e){if(this.enabled===false)return;this._state=this._prevState;this._keyDownState=-1;window.removeEventListener("keyup",this.eventHandlers.keyup,false);window.addEventListener("keydown",this.eventHandlers.keydown,false)};t.prototype.mousedown=function(e){if(this.enabled===false)return;e.preventDefault();this.scene.mouseInfo.updatePosition(e.clientX,e.clientY);if(this._keyDownState!==-1){this._state=this._keyDownState}if(this._state===-1){this._state=e.button}if(this._state===0&&!this.noRotate){this._rotateStart.copy(this.getMouseProjectionOnBall());this._rotateEnd.copy(this._rotateStart)}else if(this._state===2&&!this.noZoom){this._zoomStart.copy(this.getMouseOnScreen());this._zoomEnd.copy(this._zoomStart)}else if(this._state===1&&!this.noPan){this._panStart.copy(this.getMouseOnScreen());this._panEnd.copy(this._panStart)}window.addEventListener("mousemove",this.eventHandlers.mousemove,false);window.addEventListener("mouseup",this.eventHandlers.mouseup,false);this.events.dispatchEvent(this.startEvent)};t.prototype.mousemove=function(e){if(this.enabled===false)return;e.preventDefault();this.scene.mouseInfo.updatePosition(e.clientX,e.clientY);if(this._state===0&&!this.noRotate){this._rotateEnd.copy(this.getMouseProjectionOnBall())}else if(this._state===2&&!this.noZoom){this._zoomEnd.copy(this.getMouseOnScreen())}else if(this._state===1&&!this.noPan){this._panEnd.copy(this.getMouseOnScreen())}this.update()};t.prototype.mouseup=function(e){if(this.enabled===false)return;e.preventDefault();this._state=-1;window.removeEventListener("mousemove",this.eventHandlers.mousemove,false);window.removeEventListener("mouseup",this.eventHandlers.mouseup,false);this.events.dispatchEvent(this.endEvent)};t.prototype.touchstart=function(e){if(this.enabled===false)return;switch(e.touches.length){case 1:this._state=3;this.scene.mouseInfo.updatePosition(e.touches[0].clientX,e.touches[0].clientY);this._rotateStart.copy(this.getMouseProjectionOnBall());this._rotateEnd.copy(this._rotateStart);break;case 2:this._state=4;var t=e.touches[0].clientX-e.touches[1].clientX;var r=e.touches[0].clientY-e.touches[1].clientY;this._touchZoomDistanceEnd=this._touchZoomDistanceStart=Math.sqrt(t*t+r*r);var n=(e.touches[0].clientX+e.touches[1].clientX)/2;var i=(e.touches[0].clientY+e.touches[1].clientY)/2;this.scene.mouseInfo.updatePosition(n,i);this._panStart.copy(this.getMouseOnScreen());this._panEnd.copy(this._panStart);break;default:this._state=-1}this.events.dispatchEvent(this.startEvent)};t.prototype.touchmove=function(e){if(this.enabled===false)return;e.preventDefault();e.stopPropagation();switch(e.touches.length){case 1:this.scene.mouseInfo.updatePosition(e.touches[0].clientX,e.touches[0].clientY);this._rotateEnd.copy(this.getMouseProjectionOnBall());this.update();break;case 2:var t=e.touches[0].clientX-e.touches[1].clientX;var r=e.touches[0].clientY-e.touches[1].clientY;this._touchZoomDistanceEnd=Math.sqrt(t*t+r*r);var n=(e.touches[0].clientX+e.touches[1].clientX)/2;var i=(e.touches[0].clientY+e.touches[1].clientY)/2;this.scene.mouseInfo.updatePosition(n,i);this._panEnd.copy(this.getMouseOnScreen());this.update();break;default:this._state=-1}};t.prototype.touchend=function(e){if(this.enabled===false)return;var t=e.touches;if(!t.length){t=e.changedTouches}switch(t.length){case 1:this.scene.mouseInfo.updatePosition(t[0].clientX,t[0].clientY);this._rotateEnd.copy(this.getMouseProjectionOnBall());this._rotateStart.copy(this._rotateEnd);break;case 2:this._touchZoomDistanceStart=this._touchZoomDistanceEnd=0;var r=(t[0].clientX+t[1].clientX)/2;var n=(t[0].clientY+t[1].clientY)/2;this.scene.mouseInfo.updatePosition(r,n);this._panEnd.copy(this.getMouseOnScreen());this._panStart.copy(this._panEnd);break}this._state=-1;this.events.dispatchEvent(this.endEvent)};t.prototype.preventContextMenu=function(e){e.preventDefault()};t.prototype.init=function(){this.domElement.addEventListener("contextmenu",this.preventContextMenu,false);this.domElement.addEventListener("mousedown",this.eventHandlers.mousedown,false);this.domElement.addEventListener("touchstart",this.eventHandlers.touchstart,false);this.domElement.addEventListener("touchend",this.eventHandlers.touchend,false);this.domElement.addEventListener("touchmove",this.eventHandlers.touchmove,false);window.addEventListener("keydown",this.eventHandlers.keydown,false);this.update()};t.prototype.destroy=function(){this.domElement.removeEventListener("contextmenu",this.preventContextMenu,false);this.domElement.removeEventListener("mousedown",this.eventHandlers.mousedown,false);window.removeEventListener("keydown",this.eventHandlers.keydown,false);this.domElement.removeEventListener("touchstart",this.eventHandlers.touchstart,false);this.domElement.removeEventListener("touchend",this.eventHandlers.touchend,false);this.domElement.removeEventListener("touchmove",this.eventHandlers.touchmove,false);this.camera=void 0;this.domElement=void 0};return t}();e.CameraControls=t})(t=e.Visualization||(e.Visualization={}))})(p||(p={}));/* 497 * Copyright (c) 2016 - now David Sehnal, licensed under Apache 2.0, See LICENSE file for more info. 498 */ 499var p;(function(e){var t;(function(t){var r;(function(t){var r=function(){function e(){this.current=null;this.currentPickId=-1;this.currentPickElementId=-1;this.selectPos={x:0,y:0}}e.prototype.getPickInfo=function(){if(!this.current)return this.current;if(this.current.elements&&!this.current.elements.length)return null;return{model:this.current.model,elements:this.current.elements}};e.prototype.reset=function(){var e=this.current!==null;this.currentPickId=-1;this.currentPickElementId=-1;this.current=null;return e};e.prototype.selectStart=function(e,t){this.selectPos.x=e;this.selectPos.y=t};e.prototype.selectEnd=function(e,t){var r=e-this.selectPos.x,n=t-this.selectPos.y;return r*r+n*n<4.5};return e}();t.Pick=r;var n;(function(e){function t(e,t){var r=e>>16&255,n=e>>8&255,i=e&255;t.r=i/255;t.g=n/255;t.b=r/255}e.assignPickColor=t;function r(e,t,r){r[t+3]=e/255}e.applySceneIdFast=r;function n(e,t,r,n){var i=(t&(1<<e)-1)<<8-e;var a=t>>e;n[r+3]=a/255;var o=n[r+2]*255|0;n[r+2]=(o|i)/255}e.applySceneIdSlow=n;function i(e,t){var r=(1<<16-e)-1;return t[0]|t[1]<<8|(t[2]&r)<<16}e.getElementId=i;function a(e,t){var r=e-8;var n=t[2]&(1<<r)-1<<8-r>>8-r;var i=t[3]<<r;return n|i}e.getSceneId=a})(n=t.Picking||(t.Picking={}));var i=e.Core.Utils.ChunkedArray;var a=function(){function t(t){this.elementMap=e.Core.Utils.FastMap.create();this.elementIndex=0;this.elementRangeIndex=0;this.rangeIndex=0;this.added=0;this.elementIndices=i.create(function(e){return new Int32Array(e)},t,1);this.elementRanges=new Int32Array(2*t);
499this.vertexRanges=i.create(function(e){return new Int32Array(e)},t,2)}t.prototype.startElement=function(e){this.elementIndex=e;this.elementRangeIndex=this.elementMap.size;this.rangeIndex=this.vertexRanges.elementCount;this.added=0};t.prototype.addVertexRange=function(e,t){this.added++;i.add2(this.vertexRanges,e,t)};t.prototype.endElement=function(){i.add(this.elementIndices,this.elementIndex);this.elementMap.set(this.elementIndex,this.elementRangeIndex);this.elementRanges[2*this.elementRangeIndex]=2*this.rangeIndex;this.elementRanges[2*this.elementRangeIndex+1]=2*(this.rangeIndex+this.added)};t.prototype.getMap=function(){return new o(i.compact(this.elementIndices),this.elementMap,this.elementRanges,i.compact(this.vertexRanges))};return t}();t.VertexMapBuilder=a;var o=function(){function e(e,t,r,n){this.elementIndices=e;this.elementMap=t;this.elementRanges=r;this.vertexRanges=n}return e}();t.VertexMap=o;function s(e,t,r,n){var i=false;if(n===3){for(var a=t;a<r;a++){var o=e[a];var s=o|0;if(o-s<.33){e[a]=s+.55;i=true}}}else if(n===4){for(var a=t;a<r;a++){var o=e[a];var s=o|0;if(o-s>.33){e[a]=s;i=true}}}else if(n===1){for(var a=t;a<r;a++){e[a]=e[a]+1;i=true}}else if(n===2){for(var a=t;a<r;a++){if(e[a]>.75){var o=e[a]-1;if(o<0)o=0;e[a]=o;i=true}}}else{for(var a=t;a<r;a++){var o=e[a];e[a]=0;i=i||o!==0}}return i}t.applyActionToRange=s;function u(e,t){var r=e.array;var n=s(r,0,r.length,t);if(n)e.needsUpdate=true;return n}t.applyActionToBuffer=u})(r=t.Selection||(t.Selection={}))})(t=e.Visualization||(e.Visualization={}))})(p||(p={}));/* 500 * Copyright (c) 2017 - now David Sehnal, licensed under Apache 2.0, See LICENSE file for more info. 501 */ 502var p;(function(e){var t;(function(t){var r;(function(r){"use strict";function n(e){var r=new t.THREE.BufferGeometry;r.addAttribute("position",new t.THREE.BufferAttribute(e.vertices,3));if(e.normals){r.addAttribute("normal",new t.THREE.BufferAttribute(e.normals,3))}r.addAttribute("index",new t.THREE.BufferAttribute(e.indices,1));return r}r.toBufferGeometry=n;function i(e,r,n,i){e.addAttribute(r,new t.THREE.BufferAttribute(n,i))}r.addAttribute=i;var a=e.Core.Utils;var o=a.ChunkedArray;var s=a.ArrayBuilder;var u;(function(n){function i(e,t,r){if(r===void 0){r=3}return{type:"Static",vertices:s.create(function(e){return new Float32Array(e)},e,3),indices:s.create(function(e){return new Uint32Array(e)},t,r),normals:r===3?s.create(function(e){return new Float32Array(e)},e,3):void 0,elementSize:r}}n.createStatic=i;function a(e,t,r){if(r===void 0){r=3}return{type:"Dynamic",vertices:o.create(function(e){return new Float32Array(e)},e,3),indices:o.create(function(e){return new Uint32Array(e)},t,r),normals:r===3?o.create(function(e){return new Float32Array(e)},e,3):void 0,elementSize:r}}n.createDynamic=a;var u=o.add2;var l=o.add3;var c=s.add2;var f=s.add3;var h=e.Core.Geometry;var d=h.LinearAlgebra.Vector3;var p=h.LinearAlgebra.Matrix4;function m(e,t,r,n){for(var i=0,a=t.length;i<a;i+=3){n(r,t[i]+e,t[i+1]+e,t[i+2]+e)}}var v=d.zero();function y(e,t,r,n){var i=v;for(var a=0,o=t.length;a<o;a+=3){i[0]=t[a],i[1]=t[a+1],i[2]=t[a+2];d.transformMat4(i,i,e);n(r,i[0],i[1],i[2])}}function g(e,t,r,n){for(var i=0,a=t.length;i<a;i+=2){n(r,t[i]+e,t[i+1]+e)}}function b(e){throw new Error(e)}var x=p.zero(),_=p.zero(),w=p.zero(),C=p.zero(),E=p.zero();var S=d.fromValues(1,1,1),T=d.zero();function M(e,t,r,n,i){p.fromScaling(x,r||S);p.fromTranslation(_,n||T);if(i)p.copy(w,i);else p.fromIdentity(w);p.mul3(C,_,w,x);var a=e.vertices.elementCount;var o=e.type==="Static"?f:l;y(C,t.vertices,e.vertices,o);if(e.normals){if(!t.normals)b("geom is missing normals.");p.mul(E,w,x);y(E,t.normals,e.normals,o)}if(e.elementSize===2){g(a,t.indices,e.indices,e.type==="Static"?c:u)}else{m(a,t.indices,e.indices,e.type==="Static"?f:l)}}n.addRawTransformed=M;function A(e,t,r,n){f(e.vertices,t,r,n)}n.addVertex3s=A;function P(e,t,r,n){f(e.normals,t,r,n)}n.addNormal3s=P;function R(e,t,r,n){f(e.indices,t,r,n)}n.addIndex3s=R;function k(e,t,r,n){l(e.vertices,t,r,n)}n.addVertex3d=k;function I(e,t,r,n){l(e.normals,t,r,n)}n.addNormal3d=I;function D(e,t,r,n){l(e.indices,t,r,n)}n.addIndex3d=D;var B=void 0;function L(){if(B)return B;B=t.GeometryHelper.toRawGeometry(new t.THREE.BoxGeometry(1,1,1));for(var e=0;e<B.vertices.length;e+=3){B.vertices[e]+=.5}return B}n.getDashTemplate=L;var F=d.zero(),V=d.zero(),O=d.zero(),U=d.fromValues(1,0,0),N=p.zero();function z(e,t,r,n,i,a){var o=d.sub(O,r,t);
502var s=d.magnitude(o);var u=d.set(F,n,a,a);var l=d.makeRotation(N,U,o);var c=L();var f=V;d.copy(f,t);d.normalize(o,o);var h=n+i;d.scale(o,o,h);for(var p=0;p<s;p+=h){if(p+n>s)u[0]=s-p;M(e,c,u,f,l);d.add(f,f,o)}}n.addDashedLine=z;function H(e){return e.array}function j(e){return o.compact(e)}function G(e){var t=e.type==="Static"?H:j;return r.toBufferGeometry({vertices:t(e.vertices),vertexCount:e.vertices.elementCount,normals:e.normals&&t(e.normals),indices:t(e.indices),indexCount:e.indices.elementCount,elementSize:e.elementSize})}n.toBufferGeometry=G})(u=r.Builder||(r.Builder={}))})(r=t.Geometry||(t.Geometry={}))})(t=e.Visualization||(e.Visualization={}))})(p||(p={}));/* 503 * Copyright (c) 2016 - now David Sehnal, licensed under Apache 2.0, See LICENSE file for more info. 504 */ 505var y=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)if(t.hasOwnProperty(r))e[r]=t[r]};return function(t,r){e(t,r);function n(){this.constructor=t}t.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}}();var p;(function(e){var t;(function(t){var r;(function(r){"use strict";var n=e.Core.Utils.ChunkedArray;function i(e){var t=new Int32Array(e.data.annotation.length);var r=e.data.annotation;for(var n=0,i=t.length;n<i;n++)t[n]=n;Array.prototype.sort.call(t,function(e,t){var n=r[e]-r[t];if(!n)return e-t;return n});return t}function a(e,t,r,n){var i=e;var a=e+1;while(i<t){while(a<t&&r[a]-r[a-1]<1.1)a++;n.addVertexRange(r[i],r[a-1]+1);i=a;a=a+1}}function o(e){var r=i(e);var n=e.data.annotation;var o=1;for(var s=0,u=r.length-1;s<u;s++){if(n[r[s]]!==n[r[s+1]])o++}var l=new t.Selection.VertexMapBuilder(o);var c=new Int32Array(r.length);for(var s=0,u=r.length;s<u;s++){c[s]=n[r[s]]}var f=n[r[0]];l.startElement(f);for(var s=0,u=r.length;s<u;s++){var h=n[r[s]];if(h!==f){l.endElement();l.startElement(h);f=h}var d=s;s++;while(h===n[r[s]])s++;var p=s;s--;a(d,p,r,l)}l.endElement();return l.getMap()}function s(e){var r=new t.Selection.VertexMapBuilder(1);r.startElement(0);r.addVertexRange(0,e.vertexCount);r.endElement();return r.getMap()}function u(e){return m(this,void 0,void 0,function(){return v(this,function(t){switch(t.label){case 0:return[4,e.computation.updateProgress("Computing selection map...")];case 1:t.sent();if(e.data.annotation){e.geom.elementToVertexMap=o(e)}else{e.geom.elementToVertexMap=s(e)}return[2]}})})}var l=1e5;function c(e,r){return m(this,void 0,void 0,function(){var i,a,o,s,u,c,f,h,d,p,m,y,g,b,x,_,w,C;return v(this,function(v){i=r.data.triangleIndices;a=r.data.annotation;o=r.pickPlatesVertices;s=r.pickPlatesTris;u=r.pickPlatesColors;c=r.data.vertices;f={r:.45,g:.45,b:.45};h=r.pickTris;d=0;for(p=e,m=Math.min(e+l,r.triCount);p<m;p++){y=i[3*p],g=i[3*p+1],b=i[3*p+2];x=a[y],_=a[g],w=a[b];if(x===_&&_===w){n.add3(h,y,g,b);continue}C=-1;if(x===_||x===w)C=x;else if(_===w)C=_;n.add3(o,c[3*y],c[3*y+1],c[3*y+2]);n.add3(o,c[3*g],c[3*g+1],c[3*g+2]);n.add3(o,c[3*b],c[3*b+1],c[3*b+2]);n.add3(s,d++,d++,d++);if(C<0){f.r=0;f.g=0;f.b=0}else{t.Selection.Picking.assignPickColor(C,f)}n.add4(u,f.r,f.g,f.b,0);n.add4(u,f.r,f.g,f.b,0);n.add4(u,f.r,f.g,f.b,0)}r.platesVertexCount=r.platesVertexCount+d;return[2]})})}function f(t){return m(this,void 0,void 0,function(){var r,n,i;return v(this,function(a){switch(a.label){case 0:r=e.Core.Utils.PerformanceMonitor.currentTime();n=0;a.label=1;case 1:if(!(n<t.triCount))return[3,5];i=e.Core.Utils.PerformanceMonitor.currentTime();if(!(i-r>e.Core.Computation.UpdateProgressDelta))return[3,3];r=i;return[4,t.computation.updateProgress("Creating selection geometry...",true,n,t.triCount)];case 2:a.sent();a.label=3;case 3:c(n,t);a.label=4;case 4:n+=l;return[3,1];case 5:return[2]}})})}function h(e){var r={r:.45,g:.45,b:.45},i=e.data.annotation;e.pickTris=n.forIndexBuffer(e.triCount);var a=e.pickColorBuffer;for(var o=0,s=e.vertexCount;o<s;o++){var u=i[o];if(u>=0){t.Selection.Picking.assignPickColor(u+1,r);a[o*4]=r.r;a[o*4+1]=r.g;a[o*4+2]=r.b}}}function d(e,r){var n=new t.THREE.BufferGeometry;n.addAttribute("position",e.position);n.addAttribute("index",e.index);n.addAttribute("pColor",new t.THREE.BufferAttribute(r.pickColorBuffer,4));r.geom.pickGeometry=n;n=new t.THREE.BufferGeometry;n.addAttribute("position",new t.THREE.BufferAttribute(new Float32Array(0),3));n.addAttribute("index",new t.THREE.BufferAttribute(new Uint32Array(0),1));n.addAttribute("pColor",new t.THREE.BufferAttribute(new Float32Array(0),4));r.geom.pickPlatesGeometry=n}function p(e,r){var i=new t.THREE.BufferGeometry;i.addAttribute("position",e.position);i.addAttribute("index",e.index);i.addAttribute("pColor",new t.THREE.BufferAttribute(r.pickColorBuffer,4));r.geom.pickGeometry=i;i=new t.THREE.BufferGeometry;i.addAttribute("position",new t.THREE.BufferAttribute(n.compact(r.pickPlatesVertices),3));i.addAttribute("index",new t.THREE.BufferAttribute(n.compact(r.pickPlatesTris),1));i.addAttribute("pColor",new t.THREE.BufferAttribute(n.compact(r.pickPlatesColors),4));r.geom.pickPlatesGeometry=i}
505function g(e,t,r,i){if(r>i){var a=r;r=i;i=a}if(t.add((r+i)*(r+i+1)/2+i)){n.add2(e,r,i)}}function b(r){var i=r.data.triangleIndices;var a=n.create(function(e){return new Uint32Array(e)},1.5*r.triCount|0,2);var o=e.Core.Utils.FastSet.create();for(var s=0,u=i.length;s<u;s+=3){var l=i[s],c=i[s+1],f=i[s+2];g(a,o,l,c);g(a,o,l,f);g(a,o,c,f)}return new t.THREE.BufferAttribute(n.compact(a),1)}function x(e){return{position:new t.THREE.BufferAttribute(e.data.vertices,3),index:new t.THREE.BufferAttribute(e.data.triangleIndices,1)}}function _(e,r,n){var i=new t.THREE.BufferGeometry;i.addAttribute("position",e.position);i.addAttribute("normal",new t.THREE.BufferAttribute(n.data.normals,3));i.addAttribute("color",new t.THREE.BufferAttribute(new Float32Array(n.data.vertices.length),3));if(r){i.addAttribute("index",b(n))}else{i.addAttribute("index",e.index)}n.geom.geometry=i;n.geom.vertexStateBuffer=new t.THREE.BufferAttribute(new Float32Array(n.data.vertices.length),1);i.addAttribute("vState",n.geom.vertexStateBuffer)}function w(e,t){return m(this,void 0,void 0,function(){return v(this,function(r){switch(r.label){case 0:return[4,t.computation.updateProgress("Creating selection geometry...")];case 1:r.sent();t.pickColorBuffer=new Float32Array(t.vertexCount*4);if(!!t.data.annotation)return[3,2];d(e,t);return[2];case 2:h(t);t.pickPlatesVertices=n.forVertex3D(Math.max(t.vertexCount/10,10));t.pickPlatesTris=n.forIndexBuffer(Math.max(t.triCount/10,10));t.pickPlatesColors=n.create(function(e){return new Float32Array(e)},Math.max(t.vertexCount/10,10),4);t.platesVertexCount=0;return[4,f(t)];case 3:r.sent();p(e,t);r.label=4;case 4:return[2]}})})}function C(t,r,n){return m(this,void 0,void 0,function(){var i,a;return v(this,function(o){switch(o.label){case 0:i={data:t,computation:r,geom:new E,vertexCount:t.vertices.length/3|0,triCount:t.triangleIndices.length/3|0};return[4,r.updateProgress("Creating geometry...")];case 1:o.sent();return[4,e.Core.Geometry.Surface.computeNormals(t).run(r)];case 2:o.sent();return[4,e.Core.Geometry.Surface.computeBoundingSphere(t).run(r)];case 3:o.sent();a=x(i);return[4,u(i)];case 4:o.sent();return[4,w(a,i)];case 5:o.sent();_(a,n,i);i.geom.vertexToElementMap=i.data.annotation;return[2,i.geom]}})})}r.buildGeometry=C;var E=function(e){y(t,e);function t(){var t=e.call(this)||this;t.geometry=void 0;t.vertexToElementMap=void 0;t.elementToVertexMap=void 0;t.pickGeometry=void 0;t.pickPlatesGeometry=void 0;t.vertexStateBuffer=void 0;return t}t.prototype.dispose=function(){this.geometry.dispose();if(this.pickGeometry){this.pickGeometry.dispose();this.pickPlatesGeometry.dispose()}};return t}(t.GeometryBase);r.Geometry=E})(r=t.Surface||(t.Surface={}))})(t=e.Visualization||(e.Visualization={}))})(p||(p={}));/* 506 * Copyright (c) 2016 - now David Sehnal, licensed under Apache 2.0, See LICENSE file for more info. 507 */ 508var p;(function(e){var t;(function(t){var r;(function(r){"use strict";r.DefaultSurfaceModelParameters={isWireframe:false,mapPickElements:void 0};var n=function(n){y(i,n);function i(){var e=n!==null&&n.apply(this,arguments)||this;e._mapPickElements=void 0;return e}i.prototype.applySelectionInternal=function(e,r){var n=this.geometry.vertexStateBuffer,i=n.array,a=this.geometry.elementToVertexMap,o=a.vertexRanges,s=false;for(var u=0,l=e;u<l.length;u++){var c=l[u];if(!a.elementMap.has(c))continue;var f=a.elementMap.get(c),h=a.elementRanges[2*f],d=a.elementRanges[2*f+1];if(h===d)continue;for(var p=h;p<d;p+=2){var m=o[p],v=o[p+1];s=t.Selection.applyActionToRange(i,m,v,r)||s}}if(!s)return false;n.needsUpdate=true;return true};i.prototype.highlightElement=function(e,t){if(this.surface.annotation){return this.applySelection([e-1],t?3:4)}else{return this.highlightInternal(t)}};i.prototype.highlightInternal=function(e){return t.Selection.applyActionToBuffer(this.geometry.vertexStateBuffer,e?3:4)};i.prototype.getPickElements=function(e){if(!e)return[0];if(this._mapPickElements){return this._mapPickElements(e-1)||[]}return[e-1]};i.prototype.getBoundingSphereOfSelection=function(r){if(!this.geometry.vertexToElementMap)return{radius:this.radius,center:e.Core.Geometry.LinearAlgebra.Vector3.fromObj(this.centroid)};var n=this.geometry.geometry.attributes.position.array;var i=new t.THREE.Vector3,a=0;var o=this.geometry.elementToVertexMap,s=o.vertexRanges;for(var u=0,l=r;u<l.length;u++){var c=l[u];if(!o.elementMap.has(c))continue;var f=o.elementMap.get(c),h=o.elementRanges[2*f],d=o.elementRanges[2*f+1];if(h===d)continue;for(var p=h;p<d;p+=2){var m=s[p],v=s[p+1];for(var y=m;y<v;y++){i.x+=n[3*y];i.y+=n[3*y+1];i.z+=n[3*y+2];a++}}}if(!a)return void 0;i.x=i.x/a;i.y=i.y/a;i.z=i.z/a;var g=new t.THREE.Vector3;var b=0;for(var x=0,_=r;x<_.length;x++){var c=_[x];if(!o.elementMap.has(c))continue;var f=o.elementMap.get(c),h=o.elementRanges[2*f],d=o.elementRanges[2*f+1];if(h===d)continue;for(var p=h;p<d;p+=2){var m=s[p],v=s[p+1];for(var y=m;y<v;y++){g.x=n[3*y];g.y=n[3*y+1];g.z=n[3*y+2];b=Math.max(b,g.distanceToSquared(i))}}}b=Math.sqrt(b);return{radius:b,center:e.Core.Geometry.LinearAlgebra.Vector3.fromObj(i)}};i.prototype.applyThemeInternal=function(e){var r={r:0,g:0,b:0};t.MaterialsHelper.updateMaterial(this.material,e,this.object);var n=this.geometry.geometry.attributes.color.array,i=this.geometry.vertexToElementMap;if(i){for(var a=0,o=n.length/3|0;a<o;a++){var s=i[a];if(s<0){r.r=0;r.g=0;r.b=0}else{e.setElementColor(s,r)}n[3*a]=r.r;n[3*a+1]=r.g;n[3*a+2]=r.b}}else{e.setElementColor(0,r);for(var a=0,o=n.length/3|0;a<o;a++){n[3*a]=r.r;n[3*a+1]=r.g;n[3*a+2]=r.b}}if(this.pickObject)this.pickObject.visible=this.getPickObjectVisibility(this.object.visible);this.geometry.geometry.getAttribute("color").needsUpdate=true};i.prototype.getPickObjectVisibility=function(e){if(t.Theme.isTransparent
508(this.theme)||!this.theme.interactive){return false}else{return e}};i.prototype.createObjects=function(){var e=new t.THREE.Mesh(this.geometry.geometry,this.material);var r=void 0;if(this.geometry.pickGeometry){r=new t.THREE.Object3D;var n=new t.THREE.Mesh(this.geometry.pickGeometry,this.pickMaterial);r.add(n);n=new t.THREE.Mesh(this.geometry.pickPlatesGeometry,this.pickMaterial);r.add(n)}return{main:e,pick:r}};i.create=function(n,a){var o=this;var s=a.surface,u=a.theme,l=a.parameters,c=l===void 0?r.DefaultSurfaceModelParameters:l,f=a.props;return e.Core.computation(function(e){return m(o,void 0,void 0,function(){var a,o,l,h;return v(this,function(d){switch(d.label){case 0:return[4,r.buildGeometry(s,e,!!c.isWireframe)];case 1:a=d.sent();o=new i;o._mapPickElements=c.mapPickElements;o.surface=s;o.material=t.MaterialsHelper.getMeshMaterial(t.THREE.FlatShading,!!c.isWireframe);o.geometry=a;o.pickMaterial=t.MaterialsHelper.getPickMaterial();o.entity=n;l=s.boundingSphere.center;o.centroid=new t.THREE.Vector3(l[0],l[1],l[2]);o.radius=s.boundingSphere.radius;if(f)o.props=f;o.disposeList.push(o.geometry,o.material,o.pickMaterial);h=o.createObjects();o.object=h.main;o.pickObject=h.pick;o.applyTheme(u);o.pickBufferAttributes=[o.geometry.pickGeometry.attributes.pColor,o.geometry.pickPlatesGeometry.attributes.pColor];return[2,o]}})})})};return i}(t.Model);r.Model=n})(r=t.Surface||(t.Surface={}))})(t=e.Visualization||(e.Visualization={}))})(p||(p={}));/* 509 * Copyright (c) 2016 - now David Sehnal, licensed under Apache 2.0, See LICENSE file for more info. 510 */ 511var p;(function(e){var t;(function(e){var t;(function(t){"use strict";var r=function(t){y(r,t);function r(){var r=t.call(this)||this;r.geometry=void 0;r.center=new e.THREE.Vector3(0,0,0);r.radius=0;return r}r.prototype.dispose=function(){this.geometry.dispose()};r.create=function(t,n){var i=new r;var a=new e.THREE.Vector3(0,0,0);for(var o=0,s=t.length;o<s;o+=3){a.x+=t[o];a.y+=t[o+1];a.z+=t[o+2]}a.multiplyScalar(1/(t.length/3));var u=0;for(var o=0,s=t.length;o<s;o+=3){var l=a.x-t[o];var c=a.y-t[o+1];var f=a.z-t[o+2];var h=l*l+c*c+f*f;if(h>u)u=h}u=Math.sqrt(u);var d=new e.THREE.BufferGeometry;d.addAttribute("position",new e.THREE.BufferAttribute(t,3));d.addAttribute("index",new e.THREE.BufferAttribute(n,1));i.geometry=d;i.center=a;i.radius=u;return i};return r}(e.GeometryBase);t.Geometry=r})(t=e.Lines||(e.Lines={}))})(t=e.Visualization||(e.Visualization={}))})(p||(p={}));/* 512 * Copyright (c) 2016 - now David Sehnal, licensed under Apache 2.0, See LICENSE file for more info. 513 */ 514var p;(function(e){var t;(function(t){var r;(function(r){"use strict";var n=function(r){y(n,r);function n(){return r!==null&&r.apply(this,arguments)||this}n.prototype.applySelectionInternal=function(e,t){return false};n.prototype.highlightElement=function(e,t){return this.applySelection([e],t?3:4)};n.prototype.highlightInternal=function(e){return false};n.prototype.getPickElements=function(e){return[e]};n.prototype.applyThemeInternal=function(e){var r=e.colors.get("Uniform");this.material.color=new t.THREE.Color(r.r,r.g,r.b);this.material.needsUpdate=true};n.prototype.getPickObjectVisibility=function(e){return false};n.prototype.createObjects=function(){return{main:new t.THREE.Mesh(this.geometry.geometry,this.material),pick:void 0}};n.create=function(r,i){var a=this;var o=i.geometry,s=i.theme,u=i.props;return e.Core.computation(function(e){return m(a,void 0,void 0,function(){var e,i;return v(this,function(a){e=new n;e.material=new t.THREE.MeshBasicMaterial({wireframe:true});e.geometry=o;e.entity=r;e.centroid=o.center;e.radius=o.radius;if(u)e.props=u;e.disposeList.push(e.geometry,e.material);i=e.createObjects();e.object=i.main;e.pickObject=void 0;e.applyTheme(s);e.pickBufferAttributes=[];return[2,e]})})})};return n}(t.Model);r.Model=n})(r=t.Lines||(t.Lines={}))})(t=e.Visualization||(e.Visualization={}))})(p||(p={}));/* 515 * Copyright (c) 2017 - now David Sehnal, licensed under Apache 2.0, See LICENSE file for more info. 516 */ 517var p;(function(e){var t;(function(t){var r;(function(r){"use strict";r.DefaultTextAtlasParams={font:["sans-serif"],size:36,style:"normal",variant:"normal",weight:"normal",outline:0,width:2048,height:2048};var n=e.Core.Utils.FastMap.create();function i(e){var t=JSON.stringify(e);if(n.has(t))return n.get(t);var r=new a(e);n.set(t,r);return r}r.getTextAtlas=i;var a=function(){function n(n){this.gamma=1;this.mapped=e.Core.Utils.FastMap.create();this.state={scratchW:0,scratchH:0,currentX:0,currentY:0};this.lineHeight=0;this.params=e.Core.Utils.extend({},n,r.DefaultTextAtlasParams);if(typeof navigator!=="undefined"){var i=navigator.userAgent;if(i.match(/Chrome/)&&i.match(/OS X/)){this.gamma=.5}}this.build();this.populate();this.texture=new t.THREE.Texture(this.canvas.canvas2);this.texture.flipY=false;this.texture.needsUpdate=true;this.canvas=void 0}n.prototype.build=function(){var e=this.params;var t=e.size+2*e.outline+Math.round(e.size/4);var r=e.width/4;var n=document.createElement("canvas");n.width=r;n.height=t;var i=n.getContext("2d");i.font=e.style+" "+e.variant+" "+e.weight+" "+e.size+"px "+e.font;i.fillStyle="#FF0000";i.textAlign="left";i.textBaseline="bottom";i.lineJoin="round";var a=[];var o=e.outline*3;for(var s=0;s<o;++s){var u=Math.max(0,-s*8+128-+!s*8);var l=("00"+u.toString(16)).slice(-2);a.push("#"+l+l+l)}var c=new Uint8Array(r*t*2);var f=new Uint8Array(e.width*e.height*4);var h=document.createElement("canvas");h.width=e.width;h.height=e.height;var d=h.getContext("2d");this.canvas={canvas:n,ctx:i,canvas2:h,ctx2:d,maxWidth:r,colors:a,scratch:c,data:f};this.lineHeight=t};n.prototype.map=function(e){if(this.mapped.has(e))return this.mapped.get(e);this.draw(e);var t=this.state;if(t.currentX+t.scratchW>this.params.width){t.currentX=0;t.currentY+=t.scratchH}if(t.currentY+t.scratchH>this.params.height){console.warn("TextAtlas canvas to small")}var r={x:t.currentX,y:t.currentY,w:t.scratchW,h:t.scratchH};this.mapped.set(e,r);this.canvas.ctx2.drawImage(this.canvas.canvas,0,0,t.scratchW,t.scratchH,t.currentX,t.currentY,t.scratchW,t.scratchH);t.currentX+=t.scratchW;return r};n.prototype.getTextMetrics=function(e){return this.mapped.has(e)?this.mapped.get(e):this.placeholder};n.prototype.draw=function(e){var t=this,r=t.params,n=t.canvas;var i=this.lineHeight;var a=r.outline;var o=n.ctx;var s=n.scratch;var u=n.maxWidth;var l=n.colors;var c=a;var f=i-r.outline;var h=o.measureText(e);var d=Math.min(u,Math.ceil(h.width+2*c+1));o.clearRect(0,0,d,i);var p,m,v,y,g;if(r.outline===0){o.fillText(e,c,f);y=o.getImageData(0,0,d,i);g=y.data;v=3;for(p=0,m=g.length/4;p<m;++p){s[p]=g[v];v+=4}}else{o.globalCompositeOperation="source-over";for(p=a+1;p>0;--p){v=p>1?p*2-2:p;o.strokeStyle=l[v-1];o.lineWidth=v;o.strokeText(e,c,f)}o.globalCompositeOperation="multiply";o.fillStyle="#FF00FF";o.fillText(e,c,f);y=o.getImageData(0,0,d,i);g=y.data;v=0;var b=this.gamma;for(p=0,m=g.length/4;p<m;++p){var x=g[v];var _=x?g[v+1]/x:1;if(b===.5){_=Math.sqrt(_)}_=Math.min(1,Math.max(0,_));var w=256-x;var C=w+(x-w)*_;s[p]=Math.max(0,Math.min(255,C+2));g[v+3]=s[p];v+=4}}o.putImageData(y,0,0);this.state.scratchW=d;this.state.scratchH=i};n.prototype.populate=function(){this.placeholder=this.map(String.fromCharCode(65533));for(var e=0;e<127;++e){this.map(String.fromCharCode(e))}for(var e=128;e<255;++e){this.map(String.fromCharCode(e))}for(var e=880;e<1023;
517++e){this.map(String.fromCharCode(e))}for(var e=1024;e<1279;++e){this.map(String.fromCharCode(e))}this.map(String.fromCharCode(8491))};return n}();r.TextAtlas=a})(r=t.Labels||(t.Labels={}))})(t=e.Visualization||(e.Visualization={}))})(p||(p={}));/* 518 * Copyright (c) 2017 - now David Sehnal, licensed under Apache 2.0, See LICENSE file for more info. 519 */ 520var p;(function(e){var t;(function(t){var r;(function(r){var n;(function(n){"use strict";/** 521 * Adapted from https://github.com/arose/ngl 522 * MIT License Copyright (C) 2014+ Alexander Rose 523 */ 524function i(e){var r=a(e);o(r);s(r);var n=u(r);var i=new t.THREE.BufferGeometry;i.addAttribute("position",new t.THREE.BufferAttribute(r.vertices,3));i.addAttribute("index",new t.THREE.BufferAttribute(n,1));i.addAttribute("color",new t.THREE.BufferAttribute(new Float32Array(r.quadCount*4*3),3));i.addAttribute("mapping",new t.THREE.BufferAttribute(r.mapping,2));i.addAttribute("inputTexCoord",new t.THREE.BufferAttribute(r.texCoords,2));i.addAttribute("inputSize",new t.THREE.BufferAttribute(r.size,1));return{geometry:i,texture:r.textAtlas.texture,options:r.options}}n.create=i;function a(t){var n=e.Core.Utils.extend({},t.options,r.DefaultLabelsOptions);var i=0;for(var a=0,o=t.labels;a<o.length;a++){var s=o[a];i+=s.length}var u=r.getTextAtlas({font:[n.fontFamily],style:n.fontStyle,weight:n.fontWeight,size:n.fontSize,outline:n.useSDF?5:0});var l=i+t.labels.length;return{positions:t.positions,inputSizes:t.sizes,labels:t.labels,options:n,textAtlas:u,charCount:i,quadCount:l,vertices:new Float32Array(l*4*3),size:new Float32Array(l*4),texCoords:new Float32Array(l*4*2),mapping:new Float32Array(l*4*2)}}function o(e){var t=e.labels;var r=e.positions,n=r.x,i=r.y,a=r.z;var o=e.vertices,s=e.size,u=e.inputSizes;var l=0;for(var c=0;c<t.length;++c){var f=t[c];var h=f.length+1;for(var d=0;d<h;++d,++l){for(var p=0;p<4;p++){var m=l*4*3+3*p;o[m]=n[c];o[m+1]=i[c];o[m+2]=a[c];s[l*4+p]=u[c]}}}}function s(e){var t=e.textAtlas;var r=e.labels;var n=e.options.attachment;var i=t.params.outline,a=t.lineHeight;var o=t.lineHeight*e.options.backgroundMargin*.1-10;var s=e.texCoords;var u=e.mapping;var l=0;var c,f,h,d,p,m,v,y;for(var g=0;g<r.length;++g){h=r[g];d=0;m=h.length;for(p=0;p<m;++p){c=t.getTextMetrics(h[p]);d+=c.w-2*i}if(n.indexOf("top")===0){y=t.lineHeight/1.25}else if(n.indexOf("middle")===0){y=t.lineHeight/2.5}else{y=0}if(n.indexOf("right")>0){v=d}else if(n.indexOf("center")>0){v=d/2}else{v=0}v+=i;y+=i;f=l*2*4;u[f+0]=-a/6-v-o;u[f+1]=a-y+o;u[f+2]=-a/6-v-o;u[f+3]=0-1.2*y-o;u[f+4]=d+a/6-v+2*i+o;u[f+5]=a-y+o;u[f+6]=d+a/6-v+2*i+o;u[f+7]=0-1.2*y-o;s[f+0]=10;s[f+2]=10;s[f+4]=10;s[f+6]=10;l+=1;d=0;for(p=0;p<m;++p,++l){c=t.getTextMetrics(h[p]);f=l*2*4;u[f+0]=d-v;u[f+1]=c.h-y;u[f+2]=d-v;u[f+3]=0-y;u[f+4]=d+c.w-v;u[f+5]=c.h-y;u[f+6]=d+c.w-v;u[f+7]=0-y;var b=t.params.width;var x=t.params.height;s[f+0]=c.x/b;s[f+1]=c.y/x;s[f+2]=c.x/b;s[f+3]=(c.y+c.h)/x;s[f+4]=(c.x+c.w)/b;s[f+5]=c.y/x;s[f+6]=(c.x+c.w)/b;s[f+7]=(c.y+c.h)/x;d+=c.w-2*i}}}function u(e){var t=new Uint32Array(e.quadCount*2*3);var r=0;for(var n=0;n<e.quadCount;n++){t[r++]=4*n;t[r++]=4*n+1;t[r++]=4*n+2;t[r++]=4*n+1;t[r++]=4*n+3;t[r++]=4*n+2}return t}})(n=r.Geometry||(r.Geometry={}))})(r=t.Labels||(t.Labels={}))})(t=e.Visualization||(e.Visualization={}))})(p||(p={}));/* 525 * Copyright (c) 2017 - now David Sehnal, licensed under Apache 2.0, See LICENSE file for more info. 526 */ 527var p;(function(e){var t;(function(e){var t;(function(t){var r;(function(t){/** 528 * Adapted from https://github.com/arose/ngl 529 * MIT License Copyright (C) 2014+ Alexander Rose 530 */ 531t.VERTEX_SHADER="\nuniform float xOffset;\nuniform float yOffset;\nuniform float zOffset;\nuniform float sizeFactor;\n\nvarying vec2 texCoord;\n\nattribute vec2 mapping;\nattribute vec2 inputTexCoord;\nattribute float inputSize;\n\n"+e.THREE.ShaderChunk["color_pars_vertex"]+"\n"+e.THREE.ShaderChunk["common"]+"\n\nfloat matrixScale( in mat4 m ){\n vec4 r = m[ 0 ];\n return sqrt( r[ 0 ] * r[ 0 ] + r[ 1 ] * r[ 1 ] + r[ 2 ] * r[ 2 ] );\n}\n\nvoid main(void){\n\n "+e.THREE.ShaderChunk["color_vertex"]+"\n\n texCoord = inputTexCoord;\n\n float scale = matrixScale( modelViewMatrix );\n\n float _zOffset = zOffset * scale;\n if( texCoord.x == 10.0 ){\n _zOffset -= 0.001;\n }\n\n vec3 pos = position;\n vec4 cameraPos = modelViewMatrix * vec4( pos, 1.0 );\n vec4 cameraCornerPos = vec4( cameraPos.xyz, 1.0 );\n cameraCornerPos.xy += mapping * inputSize * sizeFactor * 0.01 * scale;\n cameraCornerPos.x += xOffset * scale;\n cameraCornerPos.y += yOffset * scale;\n cameraCornerPos.xyz += normalize( -cameraCornerPos.xyz ) * _zOffset;\n\n gl_Position = projectionMatrix * cameraCornerPos;\n //gl_Position.xyz = position.xyz;\n}\n";t.FRAGMENT_SHADER="\n#extension GL_OES_standard_derivatives : enable\n\nuniform sampler2D fontTexture;\nuniform vec3 outlineColor;\nuniform float outlineWidth;\nuniform vec3 backgroundColor;\nuniform float backgroundOpacity;\n\nvarying vec2 texCoord;\n\n"+e.THREE.ShaderChunk["common"]+"\n"+e.THREE.ShaderChunk["color_pars_fragment"]+"\n"+e.THREE.ShaderChunk["fog_pars_fragment"]+"\n\nconst float smoothness = 16.0;\nconst float gamma = 2.2;\n\nvoid main(){\n vec4 finalColor;\n\n if( texCoord.x > 1.0 ){\n if (backgroundOpacity < 0.05) discard;\n finalColor = vec4( backgroundColor, backgroundOpacity );\n }
531else{\n // retrieve signed distance\n float sdf = texture2D( fontTexture, texCoord ).a + outlineWidth;\n\n // perform adaptive anti-aliasing of the edges\n float w = clamp(\n smoothness * ( abs( dFdx( texCoord.x ) ) + abs( dFdy( texCoord.y ) ) ),\n 0.0,\n 0.5\n );\n float a = smoothstep( 0.5 - w, 0.5 + w, sdf );\n\n // gamma correction for linear attenuation\n a = pow( a, 1.0 / gamma );\n if( a < 0.2 ) discard;\n //a *= opacity;\n\n vec3 outgoingLight = vColor;\n if( outlineWidth > 0.0 && sdf < ( 0.5 + outlineWidth ) ){\n outgoingLight = outlineColor;\n }\n\n finalColor = vec4( outgoingLight, a ); \n }\n\n //gl_FragColor = finalColor;\n vec3 outgoingLight = finalColor.rgb;\n\n "+e.THREE.ShaderChunk["fog_fragment"]+"\n \n #ifdef USE_FOG\n float alpha = (1.0 - fogFactor) * finalColor.a;\n if (alpha < 0.05) discard;\n gl_FragColor = vec4( outgoingLight.rgb, alpha );\n #else\n gl_FragColor = finalColor;\n #endif\n}\n"})(r=t.Material||(t.Material={}))})(t=e.Labels||(e.Labels={}))})(t=e.Visualization||(e.Visualization={}))})(p||(p={}));/* 532 * Copyright (c) 2017 - now David Sehnal, licensed under Apache 2.0, See LICENSE file for more info. 533 */ 534var p;(function(e){var t;(function(e){var t;(function(t){var r;(function(t){"use strict";function r(r){var n=e.THREE.UniformsUtils.merge([e.THREE.UniformsLib["common"],e.THREE.UniformsLib["fog"],{fontTexture:{type:"t",value:r},xOffset:{type:"f",value:0},yOffset:{type:"f",value:0},zOffset:{type:"f",value:0},sizeFactor:{type:"f",value:1},outlineWidth:{type:"f",value:0},outlineColor:{type:"v3",value:new e.THREE.Vector3(0,0,0)},backgroundColor:{type:"v3",value:new e.THREE.Vector3(0,0,0)},backgroundOpacity:{type:"f",value:.5}}]);n.fontTexture.value=r;var i=new e.THREE.ShaderMaterial({uniforms:n,attributes:{mapping:{type:"v2",value:null},inputTexCoord:{type:"v2",value:null},inputSize:{type:"f",value:null}},lights:false,fog:true,vertexShader:t.VERTEX_SHADER,fragmentShader:t.FRAGMENT_SHADER,shading:e.THREE.NoShading,side:e.THREE.DoubleSide,vertexColors:e.THREE.VertexColors,blending:e.THREE.NormalBlending,transparent:false,wireframe:false,linewidth:1});return i}t.create=r})(r=t.Material||(t.Material={}))})(t=e.Labels||(e.Labels={}))})(t=e.Visualization||(e.Visualization={}))})(p||(p={}));/* 535 * Copyright (c) 2017 - now David Sehnal, licensed under Apache 2.0, See LICENSE file for more info. 536 */ 537var p;(function(e){var t;(function(t){var r;(function(r){"use strict";r.DefaultLabelsOptions={fontFamily:"sans-serif",fontSize:32,fontStyle:"normal",fontWeight:"normal",useSDF:true,attachment:"middle-center",backgroundMargin:1};var n=function(n){y(i,n);function i(){return n!==null&&n.apply(this,arguments)||this}i.prototype.applySelectionInternal=function(e,t){return false};i.prototype.getPickElements=function(e){return[]};i.prototype.highlightElement=function(e,t){return false};i.prototype.highlightInternal=function(e){return false};i.prototype.applyColoring=function(e){var t=this.geometry.attributes.color.array;var r=0,n={r:.1,g:.1,b:.1};var i=0;for(var a=0,o=this.labels;a<o.length;a++){var s=o[a];var u=s.length*4+4;e.setElementColor(i,n);for(var l=0;l<u;l++){t[r++]=n.r;t[r++]=n.g;t[r++]=n.b}i++}this.geometry.attributes.color.needsUpdate=true};i.prototype.applyThemeInternal=function(e){this.applyColoring(e);var r=e.colors.get("Background")||t.Color.fromHexString("#333333");var n=e.variables.get("backgroundOpacity")!==void 0?e.variables.get("backgroundOpacity"):.5;var i=e.colors.get("Outline")||t.Color.fromHexString("#222222");var a=e.variables.get("outlineWidth")?+e.variables.get("outlineWidth"):0;var o=e.variables.get("sizeFactor")?+e.variables.get("sizeFactor"):1;var s=this.material.uniforms;s.xOffset.value=e.variables.get("xOffset")||0;s.yOffset.value=e.variables.get("yOffset")||0;s.zOffset.value=e.variables.get("zOffset")||0;s.backgroundColor.value=new t.THREE.Vector3(r.r,r.g,r.b);s.backgroundOpacity.value=n;s.outlineColor.value=new t.THREE.Vector3(i.r,i.g,i.b);s.outlineWidth.value=a;s.sizeFactor.value=o;this.material.transparent=n<1,this.material.fog=!e.disableFog;this.material.needsUpdate=true};i.create=function(n,a){var o=this;return e.Core.computation(function(e){return m(o,void 0,void 0,function(){var o,s,u,l;return v(this,function(c){switch(c.label){case 0:return[4,e.updateProgress("Creating labels geometry...")];case 1:c.sent();o=r.Geometry.create(a),s=o.geometry,u=o.texture;return[4,e.updateProgress("Creating labels model...")];case 2:c.sent();l=new i;l.labels=a.labels;l.geometry=s;l.material=r.Material.create(u);l.entity=n;l.object=new t.THREE.Mesh(s,l.material);l.object.renderOrder=1;s.computeBoundingSphere();l.centroid=s.boundingSphere.center;l.radius=s.boundingSphere.radius+4;l.applyTheme(a.theme);l.disposeList=[s,l.material];return[2,l]}})})})};return i}(t.Model);r.Model=n})(r=t.Labels||(t.Labels={}))})(t=e.Visualization||(e.Visualization={}))})(p||(p={}));/* 538 * Copyright (c) 2016 - now David Sehnal, licensed under Apache 2.0, See LICENSE file for more info. 539 */ 540var p;(function(e){var t;(function(t){var r;(function(r){var n;(function(n){"use strict";n.DefaultBallsAndSticksModelParameters={tessalation:3,atomRadius:function(){return.4},hideBonds:false,hideHydrogens:false,bondRadius:.15,customMaxBondLengths:void 0};var i=function(i){y(a,i);function a(){return i!==null&&i.apply(this,arguments)||this}a.prototype.applySelectionInternal=function(e,r){var n=this.ballsAndSticks.vertexStateBuffer,i=n.array,a=this.ballsAndSticks.atomVertexMap,o=a.vertexRanges,s=false;for(var u=0,l=e;u<l.length;u++){var c=l[u];if(!a.elementMap.has(c))continue;var f=a.elementMap.get(c),h=a.elementRanges[2*f],d=a.elementRanges[2*f+1];if(h===d)continue;for(var p=h;p<d;p+=2){var m=o[p],v=o[p+1];s=t.Selection.applyActionToRange(i,m,v,r)||s}}if(!s)return false;n.needsUpdate=true;return true};a.prototype.getPickElements=function(e){return[e]};a.prototype.highlightElement=function(e,t){return this.applySelection([e],t?3:4)};a.prototype.highlightInternal=function(e){return t.Selection.applyActionToBuffer(this.ballsAndSticks.vertexStateBuffer,e?3:4)};a.prototype.applyThemeInternal=function(e){var n=this;var i=this.ballsAndSticks.atomVertexMap;t.MaterialsHelper.applyColorToMap(i,this.ballsAndSticks.atomsGeometry.attributes.color,function(e,t){return n.theme.setElementColor(e,t)});var a=t.Theme.getColor(e,"Bond",r.Colors.DefaultBondColor);t.MaterialsHelper.applyColorToBuffer(this.ballsAndSticks.bondsGeometry.attributes.color,a);t.MaterialsHelper.updateMaterial(this.material,e,this.object);t.MaterialsHelper.updateMaterial(this.bondsMaterial,e,this.object)};a.prototype.createObjects=function(){var e=new t.THREE.Object3D;e.add(new t.THREE.Mesh(this.ballsAndSticks.atomsGeometry,this.material));e.add(new t.THREE.Mesh(this.ballsAndSticks.bondsGeometry,this.bondsMaterial));var r=new t.THREE.Mesh(this.ballsAndSticks.pickGeometry,this.pickMaterial);return{main:e,pick:r}};a.create=function(r,i){var o=this;var s=i.model,u=i.atomIndices,l=i.theme,c=i.params,f=i.props;return e.Core.computation(function(e){return m(o,void 0,void 0,function(){var i,o,h;return v(this,function(d){switch(d.label){case 0:return[4,n.buildGeometry(s,c,u,e)];case 1:i=d.sent();o=new a;o.ballsAndSticks=i;o.material=t.MaterialsHelper.getMeshMaterial();o.bondsMaterial=new t.THREE.MeshPhongMaterial({specular:11184810,shininess:1,shading:t.THREE.SmoothShading,side:t.THREE.FrontSide,vertexColors:t.THREE.VertexColors});o.pickMaterial=t.MaterialsHelper.getPickMaterial();o.entity=r;o.ballsAndSticks.atomsGeometry.computeBoundingSphere();o.centroid=o.ballsAndSticks.atomsGeometry.boundingSphere.center;o.radius=o.ballsAndSticks.atomsGeometry.boundingSphere.radius;if(f)o.props=f;h=o.createObjects();o.object=h.main;o.applyTheme(l);o.disposeList.push(o.ballsAndSticks,o.material,o.bondsMaterial,o.pickMaterial);o.pickObject=h.pick;o.pickBufferAttributes=[o.ballsAndSticks.pickGeometry.attributes.pColor];return[2,o]}})})})};return a}(t.Model);n.Model=i})(n=r.BallsAndSticks||(r.BallsAndSticks={}))})(r=t.Molecule||(t.Molecule={}))})(t=e.Visualization||(e.Visualization={}))})(p||(p={}));/* 541 * Copyright (c) 2016 - now David Sehnal, licensed under Apache 2.0, See LICENSE file for more info. 542 */ 543var p;(function(e){var t;(function(t){var r;(function(r){var n;(function(r){"use strict";var n=e.Core.Geometry;var i=n.LinearAlgebra.Vector3;var a=n.LinearAlgebra.Matrix4;var o=t.Geometry.Builder;function s(e){return e==="H"||e==="D"||e==="T"}function u(e,t,r){var n=e.data.atoms.elementSymbol;var i=r.hideHydrogens;var a=0;if(i){for(var o=0,u=t;o<u.length;o++){var l=u[o];if(!s(n[l])){a++}}}else{a=t.length}return a}function l(t,r,n){var i=e.Core.Structure.computeBonds(t,r,{maxHbondLength:n.customMaxBondLengths&&n.customMaxBondLengths.has("H")?n.customMaxBondLengths.get("H"):1.15});var a=1/(2*.15);var o=t.data.atoms.elementSymbol;var u=n.hideHydrogens;var l=0,c=0;var f=i.type,h=i.count,d=i.atomAIndex,p=i.atomBIndex;
543var m=t.positions,v=m.x,y=m.y,g=m.z;for(var b=0;b<h;b++){var x=f[b];var _=d[b],w=p[b];if(u&&(s(o[_])||s(o[w]))){continue}if(x===0||x===5)l+=1;else if(x>=1&&x<=4)l+=x;else if(x===6||x===7||x===8){var C=v[_]-v[w],E=y[_]-y[w],S=g[_]-g[w];var T=Math.sqrt(C*C+E*E+S*S);c+=Math.ceil(a*T)}}return{bonds:i,covalentStickCount:l,dashPartCount:c}}var c=function(){function e(e,t){this.bondTemplate=e;this.builder=t;this.rotationAxis=i.zero();this.bondUpVector=i.fromValues(1,0,0);this.dir=i.zero();this.scale=i.zero();this.translation=i.zero();this.rotation=a.zero();this.offset=i.zero();this.a=i.zero();this.b=i.zero()}return e}();var f;(function(e){var r={};function n(e){if(r[e])return r[e];var n;switch(e){case 0:n=2;break;case 1:n=4;break;case 2:n=6;break;case 3:n=8;break;case 4:n=10;break;case 5:n=12;break;default:n=14;break}var i=new t.THREE.TubeGeometry(new t.THREE.LineCurve3(new t.THREE.Vector3(0,0,0),new t.THREE.Vector3(1,0,0)),2,1,n);var a=t.GeometryHelper.toRawGeometry(i);r[e]=a;return a}e.getBond=n;var i={};function a(e){if(i[e])return i[e];var r,n=1;switch(e){case 0:r=new t.THREE.OctahedronGeometry(n,0);break;case 1:r=new t.THREE.OctahedronGeometry(n,1);break;case 2:r=new t.THREE.IcosahedronGeometry(n,0);break;case 3:r=new t.THREE.IcosahedronGeometry(n,1);break;case 4:r=new t.THREE.IcosahedronGeometry(n,2);break;case 5:r=new t.THREE.OctahedronGeometry(n,3);break;default:r=new t.THREE.IcosahedronGeometry(n,3);break}var a=t.GeometryHelper.toRawGeometry(r);i[e]=a;return a}e.getAtom=a})(f||(f={}));var h=function(){function e(e,r,n){this.model=e;this.atomIndices=r;this.params=n;this.tessalation=this.params.tessalation;this.atomRadius=this.params.atomRadius;this.bondRadius=this.params.bondRadius;this.hideBonds=this.params.hideBonds;this.bondTemplate=f.getBond(this.tessalation);this.atomTemplate=f.getAtom(this.tessalation);this.dashTemplate=o.getDashTemplate();this.atomCount=u(this.model,this.atomIndices,this.params);this.atomVertexCount=this.atomTemplate.vertexCount*this.atomCount;this.atomBuilder=o.createStatic(this.atomVertexCount,this.atomTemplate.indexCount*this.atomCount);this.atomColors=new Float32Array(this.atomVertexCount*3);this.atomPickColors=new Float32Array(this.atomVertexCount*4);this.atoms=this.model.data.atoms;this.positions=this.model.positions;this.cX=this.positions.x;this.cY=this.positions.y;this.cZ=this.positions.z;this.atomSymbols=this.atoms.elementSymbol;this.residueIndex=this.atoms.residueIndex;this.scale=i.zero();this.translation=i.zero();this.pickColor={r:.1,g:.1,b:.1};this.pickOffset=0;this.atomMapBuilder=new t.Selection.VertexMapBuilder(this.atomIndices.length);this.bs=void 0}return e}();var d=function(){function e(e){this.state=e;this.info=l(this.state.model,this.state.atomIndices,this.state.params);this.bondVertexCount=this.state.bondTemplate.vertexCount*this.info.covalentStickCount+this.state.dashTemplate.vertexCount*this.info.dashPartCount;this.bondBuilder=o.createStatic(this.bondVertexCount,this.state.bondTemplate.indexCount*this.info.covalentStickCount+this.state.dashTemplate.indexCount*this.info.dashPartCount);this.bondColors=new Float32Array(this.bondVertexCount*3);this.bondRadius=this.state.params.bondRadius;this.bondState=new c(this.state.bondTemplate,this.bondBuilder);this.bondCount=this.info.bonds.count}return e}();var p=function(){function n(){}n.prototype.dispose=function(){this.atomsGeometry.dispose();this.bondsGeometry.dispose();this.pickGeometry.dispose()};n.addAtom=function(e,r){r.atomMapBuilder.startElement(e);var n=r.atomRadius(e);i.set(r.scale,n,n,n);i.set(r.translation,r.cX[e],r.cY[e],r.cZ[e]);var a=r.atomBuilder.vertices.elementCount;o.addRawTransformed(r.atomBuilder,r.atomTemplate,r.scale,r.translation,void 0);t.Selection.Picking.assignPickColor(e,r.pickColor);for(var s=0,u=r.atomTemplate.vertexCount;s<u;s++){r.atomPickColors[r.pickOffset++]=r.pickColor.r;r.atomPickColors[r.pickOffset++]=r.pickColor.g;r.atomPickColors[r.pickOffset++]=r.pickColor.b;r.pickOffset++}r.atomMapBuilder.addVertexRange(a,r.atomBuilder.vertices.elementCount);r.atomMapBuilder.endElement()};n.addBond=function(e,t,r){var a=r.info.bonds.atomAIndex[e],o=r.info.bonds.atomBIndex[e],u=r.info.bonds.type[e];if(t.params.hideHydrogens){var l=t.model.data.atoms.elementSymbol;if(s(l[a])||s(l[o])){return}}i.set(r.bondState.a,t.cX[a],t.cY[a],t.cZ[a]);i.set(r.bondState.b,t.cX[o],t.cY[o],t.cZ[o]);var c=+r.bondRadius,f=2*c/3,h=c/2;var d=r.bondState;switch(u){case 0:case 1:case 5:n.addBondPart(c,0,0,d);break;case 2:n.addBondPart(h,f,f,d);n.addBondPart(h,-f,-f,d);break;case 3:n.addBondPart(h,0,f,d);var p=Math.cos(Math.PI/3)*f,m=Math.sin(Math.PI/3)*f;n.addBondPart(h,-p,-m,d);n.addBondPart(h,-p,m,d);break;case 4:n.addBondPart(h/2,f,f,d);n.addBondPart(h/2,-f,-f,d);n.addBondPart(h/2,-f,f,d);n.addBondPart(h/2,f,-f,d);break;case 6:case 7:case 8:n.addDashedBond(h,d);break}};n.addBondPart=function(e,t,r,n){var a=i.sub(n.dir,n.b,n.a);var s=i.magnitude(n.dir);i.set(n.scale,s,e,e);i.makeRotation(n.rotation,n.bondUpVector,a);n.offset[0]=0;n.offset[1]=t;n.offset[2]=r;i.transformMat4(n.offset,n.offset,n.rotation);i.add(n.offset,n.offset,n.a);o.addRawTransformed(n.builder,n.bondTemplate,n.scale,n.offset,n.rotation)};n.addDashedBond=function(e,t){o.addDashedLine(t.builder,t.a,t.b,.15,.15,e)};n.getEmptyBondsGeometry=function(){var e=new t.THREE.BufferGeometry;e.addAttribute("position",new t.THREE.BufferAttribute(new Float32Array(0),3));e.addAttribute("normal",new t.THREE.BufferAttribute(new Float32Array(0),3));e.addAttribute("index",new t.THREE.BufferAttribute(new Uint32Array(0),1));e.addAttribute("color",new t.THREE.BufferAttribute(new Float32Array(0),3));return e};n.getBondsGeometry=function(e){var r=o.toBufferGeometry(e.bondBuilder);t.Geometry.addAttribute(r,"color",e.bondColors,3);return r};n.getAtomsGeometry=function(e){var r=o.toBufferGeometry(e.atomBuilder);t.Geometry.addAttribute(r,"color",e.atomColors,3);var n=new Float32Array(e.atomVertexCount);var i=new t.THREE.BufferAttribute(n,1);r.addAttribute("vState",i);var a=new t.THREE.BufferGeometry;a.addAttribute("position",r.getAttribute("position"));a.addAttribute("index",r.getAttribute("index"));a.addAttribute("pColor",new t.THREE.BufferAttribute(e.atomPickColors,4));return{vertexStateBuffer:i,atomsGeometry:r,atomsPickGeometry:a,atomVertexMap:e.atomMapBuilder.getMap()}};n.addAtoms=function(t,r){return m(this,void 0,void 0,function(){var i,a,o,u,l,c,f,h,d,p;return v(this,function(m){switch(m.label){case 0:i=2500;a=e.Core.Utils.PerformanceMonitor.currentTime();o=t.model.data.atoms.elementSymbol;u=t.params.hideHydrogens;l=0,c=t.atomIndices.length;m.label=1;case 1:if(!(l<c))return[3,4];for(f=l,h=Math.min(l+i,t.atomIndices.length);f<h;f++){d=t.atomIndices[f];if(u&&s(o[d])){continue}n.addAtom(d,t)}p=e.Core.Utils.PerformanceMonitor.currentTime();if(!(p-a>e.Core.Computation.UpdateProgressDelta))return[3,3];a=p;return[4,r.updateProgress("Adding atoms...",true,l,c)];case 2:m.sent();m.label=3;case 3:l+=i;return[3,1];case 4:return[2]}})})};n.addBondsChunks=function(t,r,i){return m(this,void 0,void 0,function(){var a,o,s,u,l,c;return v(this,function(f){switch(f.label){case 0:a=2500;o=e.Core.Utils.PerformanceMonitor.currentTime();s=0;f.label=1;case 1:if(!(s<r.bondCount))return[3,4];for(u=s,l=Math.min(s+a,r.bondCount);u<l;u++){n.addBond(u,t,r)}c=e.Core.Utils.PerformanceMonitor.currentTime();if(!(c-o>e.Core.Computation.UpdateProgressDelta))return[3,3];o=c;return[4,i.updateProgress("Adding bonds...",true,s,r.bondCount)];case 2:f.sent();f.label=3;case 3:s+=a;return[3,1];case 4:return[2]}})})};n.addBonds=function(e,t){return m(this,void 0,void 0,function(){var r;return v(this,function(i){switch(i.label){case 0:if(e.params.hideBonds){return[2]}return[4,t.updateProgress("Computing bonds...",true)];case 1:i.sent();r=new d(e);e.bs=r;return[4,n.addBondsChunks(e,r,t)];case 2:i.sent();return[2]}})})};n.build=function(t,i,a,o){return m(this,void 0,void 0,function(){var s,u,l;return v(this,function(c){switch(c.label){case 0:return[4,o.updateProgress("Creating atoms...")];case 1:c.sent();s=new h(t,a,e.Core.Utils.extend({},i,r.DefaultBallsAndSticksModelParameters));return[4,n.addAtoms(s,o)];case 2:c.sent();return[4,n.addBonds(s,o)];case 3:c.sent();return[4,o.updateProgress("Finalizing...")];case 4:c.sent();
543u=new b;if(s.bs){u.bondsGeometry=n.getBondsGeometry(s.bs)}else{u.bondsGeometry=n.getEmptyBondsGeometry()}l=n.getAtomsGeometry(s);u.vertexStateBuffer=l.vertexStateBuffer;u.atomsGeometry=l.atomsGeometry;u.pickGeometry=l.atomsPickGeometry;u.atomVertexMap=l.atomVertexMap;return[2,u]}})})};return n}();function g(e,t,r,n){return p.build(e,t,r,n)}r.buildGeometry=g;var b=function(e){y(t,e);function t(){var t=e!==null&&e.apply(this,arguments)||this;t.atomsGeometry=void 0;t.bondsGeometry=void 0;t.pickGeometry=void 0;t.atomVertexMap=void 0;t.vertexStateBuffer=void 0;return t}t.prototype.dispose=function(){this.atomsGeometry.dispose();this.bondsGeometry.dispose();this.pickGeometry.dispose()};return t}(t.GeometryBase);r.BallsAndSticksGeometry=b})(n=r.BallsAndSticks||(r.BallsAndSticks={}))})(r=t.Molecule||(t.Molecule={}))})(t=e.Visualization||(e.Visualization={}))})(p||(p={}));/* 544 * Copyright (c) 2016 - now David Sehnal, licensed under Apache 2.0, See LICENSE file for more info. 545 */ 546var p;(function(e){var t;(function(t){var r;(function(r){var n;(function(r){var n;(function(r){var n=function(e){y(t,e);function t(){var t=e!==null&&e.apply(this,arguments)||this;t.geometry=void 0;t.pickGeometry=void 0;t.gapsGeometry=void 0;t.directionConesGeometry=void 0;t.vertexMap=void 0;t.vertexStateBuffer=void 0;return t}t.prototype.dispose=function(){this.geometry.dispose();this.pickGeometry.dispose();if(this.gapsGeometry){this.gapsGeometry.dispose()}if(this.directionConesGeometry){this.directionConesGeometry.dispose()}};return t}(t.GeometryBase);r.Data=n;function i(t,i,a,o,s,u){return m(this,void 0,void 0,function(){var l,c,f,h,d,p;return v(this,function(m){switch(m.label){case 0:l=e.Core.Utils.extend({},o,r.CartoonsGeometryParams.Default);c={computation:u,model:t,atomIndices:i,linearSegments:a,parameters:o,isTrace:s,params:l,state:new r.CartoonsGeometryState(l,t.data.residues.count),units:void 0,strandArrays:{startIndex:t.data.residues.atomStartIndex,endIndex:t.data.residues.atomEndIndex,x:t.positions.x,y:t.positions.y,z:t.positions.z,name:t.data.atoms.name},strandTemplate:void 0,builder:new r.Builder,geom:new n};return[4,c.computation.updateProgress("Building units...")];case 1:m.sent();c.units=r.CartoonAsymUnit.buildUnits(c.model,c.atomIndices,c.linearSegments);return[4,r.buildUnitsAsync(c)];case 2:m.sent();if(c.strandTemplate)c.strandTemplate.geometry.dispose();c.geom.vertexMap=c.state.vertexMap.getMap();return[4,c.computation.updateProgress("Creating geometry...")];case 3:m.sent();r.createGeometry(c);f=c.geom;for(h=0,d=Object.keys(c);h<d.length;h++){p=d[h];if(!Object.prototype.hasOwnProperty.call(c,p))continue;c[p]=void 0}return[2,f]}})})}r.create=i})(n=r.Geometry||(r.Geometry={}))})(n=r.Cartoons||(r.Cartoons={}))})(r=t.Molecule||(t.Molecule={}))})(t=e.Visualization||(e.Visualization={}))})(p||(p={}));/* 547 * Copyright (c) 2016 - now David Sehnal, licensed under Apache 2.0, See LICENSE file for more info. 548 */ 549var p;(function(e){var t;(function(t){var r;(function(r){var n;(function(r){var n;(function(r){var n=e.Core.Utils.ArrayBuilder;var i=function(){function r(r,i,o){this.model=r;this.elements=i;this.linearSegmentCount=o;this.tempA=new t.THREE.Vector3;this.tempB=new t.THREE.Vector3;this.tempC=new t.THREE.Vector3;this.controlPoints=new Float32Array(0);this.torsionVectors=new Float32Array(0);this.normalVectors=new Float32Array(0);this.residueCount=0;this.structureStarts=e.Core.Utils.FastSet.create();this.structureEnds=e.Core.Utils.FastSet.create();this.residueType=[];this.residueIndex=new Int32Array(0);this.backboneOnly=false;this.startResidueIndex=-1;this.endResidueIndex=-1;for(var s=0,u=this.elements;s<u.length;s++){var l=u[s];this.residueCount+=l.endResidueIndex-l.startResidueIndex}this.startResidueIndex=this.elements[0].startResidueIndex;this.endResidueIndex=this.elements[this.elements.length-1].endResidueIndex-1;var c=new a(this.residueCount);this.controlPointsBuilder=n.forVertex3D(this.residueCount*this.linearSegmentCount+1);this.torsionVectorsBuilder=n.forVertex3D(this.residueCount*this.linearSegmentCount+1);this.normalVectorsBuilder=n.forVertex3D(this.residueCount*this.linearSegmentCount+1);this.createControlPoints(c)}r.prototype.createControlPoints=function(e){this.initPositions(e);this.initControlsPoints(e);this.computeSplines(e);this.controlPoints=this.controlPointsBuilder.array;this.torsionVectors=this.torsionVectorsBuilder.array;this.normalVectors=this.normalVectorsBuilder.array;this.controlPointsBuilder=null;this.torsionVectorsBuilder=null;this.normalVectorsBuilder=null};r.prototype.initPositions=function(e){var t=this.model.data.residues,r=this.model.data.atoms,n=this.model.positions,i={atomStartIndex:t.atomStartIndex,atomEndIndex:t.atomEndIndex,name:r.name,x:n.x,y:n.y,z:n.z},a=[],o=0,s=0;for(var u=0,l=this.elements;u<l.length;u++){var c=l[u];this.structureStarts.add(c.startResidueIndex);this.structureEnds.add(c.endResidueIndex-1);for(s=c.startResidueIndex;s<c.endResidueIndex;s++){this.backboneOnly=e.addResidue(s,i,c.type);a[a.length]=c.type}}this.residueIndex=new Int32Array(this.residueCount);for(var f=0,h=this.elements;f<h.length;f++){var c=h[f];for(s=c.startResidueIndex;s<c.endResidueIndex;s++){this.residueIndex[o++]=s}}this.residueType=a;e.finishResidues();var d=this.residueCount;e.residueType[0]=e.residueType[2];e.residueType[1]=e.residueType[3];e.residueType[e.residueType.length-2]=e.residueType[e.residueType.length-4];e.residueType[e.residueType.length-1]=e.residueType[e.residueType.length-3];if(d>2){var p=2,m=3,v=4;if(e.residueType[0]!==5){this.reflectPositions(e.uPositions,0,1,p,m,m,v,.4,.6);this.reflectPositions(e.vPositions,0,1,p,m,m,v,.4,.6)}else{this.reflectPositions(e.uPositions,1,0,p,m,m,v,.5,.5);this.reflectPositions(e.vPositions,1,0,p,m,m,v,.5,.5)}p=d+1;m=d;v=d-1;if(e.residueType[d-1]!==5){this.reflectPositions(e.uPositions,d+2,d+3,p,m,m,v,.4,.6);this.reflectPositions(e.vPositions,d+2,d+3,p,m,m,v,.4,.6)}else{this.reflectPositions(e.uPositions,d+2,d+3,p,m,m,v,.5,.5);this.reflectPositions(e.vPositions,d+2,d+3,p,m,m,v,.5,.5)}}else if(d===2){for(s=0;s<2;s++){e.uPositions[3*s]=e.uPositions[6];e.uPositions[3*s+1]=e.uPositions[7];e.uPositions[3*s+2]=e.uPositions[8];e.vPositions[3*s]=e.vPositions[6];e.vPositions[3*s+1]=e.vPositions[7];e.vPositions[3*s+2]=e.vPositions[8];e.uPositions[(d+2)*3+3*s]=e.uPositions[(d+1)*3];e.uPositions[(d+2)*3+3*s+1]=e.uPositions[(d+1)*3+1];e.uPositions[(d+2)*3+3*s+2]=e.uPositions[(d+1)*3+2];e.vPositions[(d+2)*3+3*s]=e.vPositions[(d+1)*3];e.vPositions[(d+2)*3+3*s+1]=e.vPositions[(d+1)*3+1];e.vPositions[(d+2)*3+3*s+2]=e.vPositions[(d+1)*3+2]}}else{var y=[e.uPositions[6]-e.vPositions[6],e.uPositions[7]-e.vPositions[7],e.uPositions[8]-e.vPositions[8]];for(var g=0;g<2;g++){for(var b=0;b<3;b++){e.uPositions[3*g+b]=e.uPositions[6+b]-.5*(g+1)*y[b];e.uPositions[9+3*g+b]=e.uPositions[6+b]+.5*(g+1)*y[b];e.vPositions[3*g+b]=e.vPositions[6+b]+.5*(g+1)*y[b];e.vPositions[9+3*g+b]=e.vPositions[6+b]-.5*(g+1)*y[b]}}}};r.prototype.initControlsPoints=function(e){var r=new t.THREE.Vector3,
549n=e.uvLength-1,i=new t.THREE.Vector3,a=new t.THREE.Vector3,o=new t.THREE.Vector3,s=new t.THREE.Vector3,u=new t.THREE.Vector3,l=new t.THREE.Vector3,c=new t.THREE.Vector3,f=new t.THREE.Vector3,h=1;for(var d=0;d<n;d++){u.set(e.uPositions[3*d],e.uPositions[3*d+1],e.uPositions[3*d+2]);l.set(e.vPositions[3*d],e.vPositions[3*d+1],e.vPositions[3*d+2]);d++;c.set(e.uPositions[3*d],e.uPositions[3*d+1],e.uPositions[3*d+2]);d--;f.set((u.x+c.x)/2,(u.y+c.y)/2,(u.z+c.z)/2);i.subVectors(c,u);a.subVectors(l,u);o.crossVectors(i,a);s.crossVectors(o,i);o.normalize();s.normalize();if(e.residueType[d]===h&&e.residueType[d+1]===h){f.set(f.x+1.5*o.x,f.y+1.5*o.y,f.z+1.5*o.z)}if(d>0&&s.angleTo(r)>Math.PI/2){s.negate()}r.copy(s);i.addVectors(f,s);e.addControlPoint(f,i)}e.finishContols()};r.prototype.computeSplines=function(e){var n=new t.THREE.Vector3,i=new t.THREE.Vector3,a=new t.THREE.Vector3,o=e.residueCount,s=e.pPositions,u=e.dPositions,l=new t.THREE.Vector3,c=new t.THREE.Vector3,f=new t.THREE.Vector3,h=new t.THREE.Vector3,d=new t.THREE.Vector3,p=new t.THREE.Vector3,m=new t.THREE.Vector3,v=new t.THREE.Vector3,y=new t.THREE.Vector3,g=new t.THREE.Vector3;for(var b=0;b<o;b++){l.set(s[3*b],s[3*b+1],s[3*b+2]);b++;c.set(s[3*b],s[3*b+1],s[3*b+2]);b++;f.set(s[3*b],s[3*b+1],s[3*b+2]);b++;h.set(s[3*b],s[3*b+1],s[3*b+2]);b=b-3;d.set(u[3*b],u[3*b+1],u[3*b+2]);b++;p.set(u[3*b],u[3*b+1],u[3*b+2]);b++;m.set(u[3*b],u[3*b+1],u[3*b+2]);b++;v.set(u[3*b],u[3*b+1],u[3*b+2]);b=b-3;for(var x=1;x<=this.linearSegmentCount;x++){var _=x*1/this.linearSegmentCount;if(_<.5){r.spline(i,l,c,f,_+.5);r.spline(a,d,p,m,_+.5)}else{r.spline(i,c,f,h,_-.5);r.spline(a,p,m,v,_-.5)}if(b===0&&x===1){r.spline(n,l,c,f,.5);r.spline(y,d,p,m,.5);r.reflect(g,n,i,1);this.addSplineNode(g,n,y)}this.addSplineNode(n,i,a);n.copy(i)}}};r.prototype.addSplineNode=function(e,t,r){n.add3(this.controlPointsBuilder,t.x,t.y,t.z);var i=this.tempA.subVectors(r,t);i.normalize();n.add3(this.torsionVectorsBuilder,i.x,i.y,i.z);var a=this.tempB.subVectors(t,e);var o=this.tempC.crossVectors(i,a);o.normalize();n.add3(this.normalVectorsBuilder,o.x,o.y,o.z)};r.prototype.reflectPositions=function(e,t,n,i,a,o,s,u,l){this.tempA.set(e[3*i],e[3*i+1],e[3*i+2]);this.tempB.set(e[3*a],e[3*a+1],e[3*a+2]);r.reflect(this.tempC,this.tempA,this.tempB,u);e[3*t]=this.tempC.x;e[3*t+1]=this.tempC.y;e[3*t+2]=this.tempC.z;this.tempA.set(e[3*o],e[3*o+1],e[3*o+2]);this.tempB.set(e[3*s],e[3*s+1],e[3*s+2]);r.reflect(this.tempC,this.tempA,this.tempB,l);e[3*n]=this.tempC.x;e[3*n+1]=this.tempC.y;e[3*n+2]=this.tempC.z};return r}();r.CartoonAsymUnit=i;(function(r){function n(e,t,r,n){e.set(t.x-n*(r.x-t.x),t.y-n*(r.y-t.y),t.z-n*(r.z-t.z))}r.reflect=n;function i(e,t,r,n,i){var a=Math.pow(1-i,2)/2;var o=Math.pow(i,2)/2;var s=1-a-o;var u=a*t.x+s*r.x+o*n.x;var l=a*t.y+s*r.y+o*n.y;var c=a*t.z+s*r.z+o*n.z;e.set(u,l,c)}r.spline=i;function a(t,r,n){var i=new e.Core.Structure.SecondaryStructureElement(t.type,t.startResidueId,t.endResidueId),a=t.startResidueIndex,o=t.endResidueIndex;for(var s=a;s<o;s++){if(!r[s])continue;if(i.startResidueIndex!==s){i=new e.Core.Structure.SecondaryStructureElement(t.type,t.startResidueId,t.endResidueId);i.startResidueIndex=s}while(s<o&&r[s]){s++}i.endResidueIndex=s;n[n.length]=i}}r.maskSplit=a;function o(e,t,r,n,i,a,o){var s=false,u=false,l=false;for(var c=t;c<r;c++){var f=n[e[c]];if(!s&&f===i){s=true}else if(!u&&f===a){u=true}if(s&&u)return true;if(f==="P"){l=true}}if(o)return s;return l}r.isCartoonLike=o;function s(e,t){var n=new Uint8Array(e.data.residues.count);var i=e.data.atoms,a=i.residueIndex,o=i.name;var s=e.data.residues.secondaryStructureIndex;var u=e.data.secondaryStructure;for(var l=0,c=t.length-1;l<c;l++){var f=t[l];var h=l;var d=a[f];l++;while(d===a[t[l]])l++;var p=u[s[d]].type;if(p===0)continue;if(p===5){n[d]=+r.isCartoonLike(t,h,l,o,"O5'","C3'",false)}else{n[d]=+r.isCartoonLike(t,h,l,o,"CA","O",true)}l--}return n}r.createMask=s;function u(e){var t=false;for(var r=0,n=e.data.secondaryStructure;r<n.length;r++){var i=n[r];if(i.type===1||i.type===3||i.type===2){return false}if(i.type===4){t=true}}return t}function l(e,t){if(t.type!==4)return[t];var r=[];var n=e.data.atoms.name;var i=e.data.residues,a=i.atomStartIndex,o=i.atomEndIndex;var s=new Int32Array(t.endResidueIndex-t.startResidueIndex),u=0;var l=true;for(var c=t.startResidueIndex,f=t.endResidueIndex;c<f;c++){var h=false,d=false;for(var p=a[c],m=o[c];p<m;p++){if(n[p]==="CA"){if(!h)s[u++]=p;h=true}else if(n[p]==="O"){d=true}if(d&&h)break}if(!h||!d){l=false;break}}if(!l)return[t];v(e,s,t,r);return r}var c=[5.45,5.18,6.37];var f=2.1;var h=[6.1,10.4,13];var d=1.42;var p=new t.THREE.Vector3(0,0,0);var m=new t.THREE.Vector3(0,0,0);function v(t,r,n,i){var a=new Int32Array(r.length);var o=false;var s=t.data.atoms.residueIndex;for(var u=0,l=r.length;u<l;u++){if(y(t,r,u,c,f)){a[u]=1;o=true}else if(y(t,r,u,h,d)){a[u]=3;o=true}else{a[u]=n.type}}if(!o){i.push(n);return}for(var u=0,l=a.length;u<l;u++){var p=a[u];if(p===n.type)continue;var m=u+1;while(m<l&&p===a[m]){m++}if(m-u>1){u=m-1;continue}for(var v=u;v<m;v++)a[v]=n.type;u=m-1}for(var u=0,l=a.length;u<l;u++){var p=a[u];var m=u+1;while(m<l&&p===a[m]){m++}var g=new e.Core.Structure.SecondaryStructureElement(p,new e.Core.Structure.PolyResidueIdentifier("",u,null),new e.Core.Structure.PolyResidueIdentifier("",m,null));g.startResidueIndex=s[r[u]];g.endResidueIndex=s[r[m-1]]+1;
549i.push(g);u=m-1}}function y(e,t,r,n,i){var a=t.length;var o=e.positions,s=o.x,u=o.y,l=o.z;var c=p,f=m;for(var h=Math.max(0,r-2);h<=r;h++){for(var d=2;d<5;d++){if(h+d>=a){continue}var v=t[h],y=t[h+d];c.set(s[v],u[v],l[v]);f.set(s[y],u[y],l[y]);if(Math.abs(c.distanceTo(f)-n[d-2])>i){return false}}}return true}function g(e){if(e.length===0){throw"Cartoons cannot be constructred from this model/selection."}}function b(e,t,n){var i=s(e,t);var a=[];var o=u(e);for(var c=0,f=e.data.secondaryStructure;c<f.length;c++){var h=f[c];if(o){var d=l(e,h);for(var p=0,m=d;p<m.length;p++){var v=m[p];r.maskSplit(v,i,a)}}else{r.maskSplit(h,i,a)}}g(a);var y=a[0],b=e.data.residues.asymId,x=e.data.residues.authSeqNumber,_=[],w=[],C=0;if(y.type===C){y=null}for(var E=0,S=a;E<S.length;E++){var h=S[E];if(h.type===C){if(_.length>0){w.push(new r(e,_,n))}y=null;_=[]}else{if(y===null)y=h;if(b[y.endResidueIndex-1]!==b[h.startResidueIndex]||y!==h&&x[h.startResidueIndex]-x[y.endResidueIndex-1]>1||y.startResidueIndex!==h.startResidueIndex&&h.startResidueIndex-y.endResidueIndex>0){if(_.length>0){w.push(new r(e,_,n))}else if(y!==null){w.push(new r(e,[y],n))}y=null;_=[h]}else{_[_.length]=h}}y=h}if(_.length>0){w.push(new r(e,_,n))}return w}r.buildUnits=b})(i=r.CartoonAsymUnit||(r.CartoonAsymUnit={}));var a=function(){function e(e){this.typeBuilder=n.forArray(1e4);this.residueType=[];this.uPositions=new Float32Array(0);this.vPositions=new Float32Array(0);this.pPositions=new Float32Array(0);this.dPositions=new Float32Array(0);this.uvLength=0;this.residueCount=0;this.typeBuilder=n.forArray(e+4);this.uPositionsBuilder=n.forVertex3D(e+4);this.vPositionsBuilder=n.forVertex3D(e+4);this.pPositionsBuilder=n.forVertex3D(e+4);this.dPositionsBuilder=n.forVertex3D(e+4);n.add(this.typeBuilder,0);n.add(this.typeBuilder,0);n.add3(this.uPositionsBuilder,0,0,0);n.add3(this.uPositionsBuilder,0,0,0);n.add3(this.vPositionsBuilder,0,0,0);n.add3(this.vPositionsBuilder,0,0,0)}e.prototype.addResidue=function(e,t,r){var i=t.atomStartIndex[e],a=t.atomEndIndex[e],o=false,s=false;var u=t.name;if(r!==5){for(var l=i;l<a;l++){if(!o&&u[l]==="CA"){n.add3(this.uPositionsBuilder,t.x[l],t.y[l],t.z[l]);o=true}else if(!s&&u[l]==="O"){n.add3(this.vPositionsBuilder,t.x[l],t.y[l],t.z[l]);s=true}if(o&&s)break}}else{if(a-i===1){n.add3(this.uPositionsBuilder,t.x[i],t.y[i],t.z[i]);o=true}else{var c=-1;for(var l=i;l<a;l++){if(!o&&u[l]==="O5'"){n.add3(this.uPositionsBuilder,t.x[l],t.y[l],t.z[l]);o=true}else if(!s&&u[l]==="C3'"){n.add3(this.vPositionsBuilder,t.x[l],t.y[l],t.z[l]);s=true}if(u[l]==="P"){c=l}if(o&&s)break}if(!o&&!s&&c>=0){n.add3(this.uPositionsBuilder,t.x[c],t.y[c],t.z[c]);o=true}}}var f=false;if(!s){var h=this.uPositionsBuilder.array,d=h.length;n.add3(this.vPositionsBuilder,h[d-3],h[d-2],h[d-1]);f=true}else if(!o){var h=this.vPositionsBuilder.array,d=h.length;n.add3(this.uPositionsBuilder,h[d-3],h[d-2],h[d-1]);f=true}n.add(this.typeBuilder,r);return f};e.prototype.finishResidues=function(){n.add(this.typeBuilder,0);n.add(this.typeBuilder,0);n.add3(this.uPositionsBuilder,0,0,0);n.add3(this.uPositionsBuilder,0,0,0);n.add3(this.vPositionsBuilder,0,0,0);n.add3(this.vPositionsBuilder,0,0,0);this.residueType=this.typeBuilder.array;this.uPositions=this.uPositionsBuilder.array;this.vPositions=this.vPositionsBuilder.array;this.typeBuilder=null;this.uPositionsBuilder=null;this.vPositionsBuilder=null;this.uvLength=this.residueType.length;this.residueCount=this.uvLength-4};e.prototype.addControlPoint=function(e,t){n.add3(this.pPositionsBuilder,e.x,e.y,e.z);n.add3(this.dPositionsBuilder,t.x,t.y,t.z)};e.prototype.finishContols=function(){this.pPositions=this.pPositionsBuilder.array;this.dPositions=this.dPositionsBuilder.array;this.pPositionsBuilder=null;this.dPositionsBuilder=null};return e}()})(n=r.Geometry||(r.Geometry={}))})(n=r.Cartoons||(r.Cartoons={}))})(r=t.Molecule||(t.Molecule={}))})(t=e.Visualization||(e.Visualization={}))})(p||(p={}));/* 550 * Copyright (c) 2016 - now David Sehnal, licensed under Apache 2.0, See LICENSE file for more info. 551 */ 552var p;(function(e){var t;(function(t){var r;(function(r){var n;(function(r){var n;(function(r){var n=function(){function e(){this.radialSegmentCount=10;this.turnWidth=.1;this.strandWidth=.15;this.nucleotideStrandLineWidth=.15;this.nucleotideStrandFactor=3;this.helixWidth=1.1;this.helixHeight=.1;this.sheetWidth=1.1;this.sheetHeight=.1;this.arrowWidth=1.7;this.tessalation=2}e.Default=new e;return e}();r.CartoonsGeometryParams=n;var i=t.Geometry.Builder;var a=function(){function e(e,r){this.params=e;this.residueCount=r;this.residueIndex=0;this.builder=i.createDynamic(this.residueCount*8,this.residueCount*16);this.vs=this.builder.vertices;this.is=this.builder.indices;this.gapsBuilder=i.createDynamic(256,512);this.dCones=i.createDynamic(1,1);this.dConesInit=false;this.translationMatrix=new t.THREE.Matrix4;this.scaleMatrix=new t.THREE.Matrix4;this.rotationMatrix=new t.THREE.Matrix4;this.invMatrix=new t.THREE.Matrix4;this.vertexMap=new t.Selection.VertexMapBuilder(r)}Object.defineProperty(e.prototype,"verticesDone",{get:function(){return this.vs.elementCount},enumerable:true,configurable:true});Object.defineProperty(e.prototype,"trianglesDone",{get:function(){return this.is.elementCount},enumerable:true,configurable:true});Object.defineProperty(e.prototype,"directionConesBuilder",{get:function(){if(this.dConesInit)return this.dCones;this.dConesInit=true;this.dCones=i.createDynamic(this.residueCount,this.residueCount);return this.dCones},enumerable:true,configurable:true});e.prototype.addVertex=function(e,t){i.addVertex3d(this.builder,e.x,e.y,e.z);i.addNormal3d(this.builder,t.x,t.y,t.z)};e.prototype.addTriangle=function(e,t,r){i.addIndex3d(this.builder,e,t,r)};e.prototype.addTriangles=function(e,t,r,n,a,o){i.addIndex3d(this.builder,e,t,r);i.addIndex3d(this.builder,n,a,o)};return e}();r.CartoonsGeometryState=a;function o(e){var r=e.params.nucleotideStrandLineWidth,n=e.params.tessalation;var i=0,a=0,o;switch(n){case 0:a=2;i=1;break;case 1:a=3;i=2;break;case 2:a=4;i=2;break;case 3:a=8;i=4;break;case 4:a=10;i=6;break;case 5:a=14;i=6;break;default:a=16;i=8;break}var s=[],u=Math.PI/2/i;for(var l=0;l<=i;l++){s[l]=new t.THREE.Vector3(0,r*Math.cos(l*u),.1*Math.sin(l*u));s[l].z+=.9}o=new t.THREE.LatheGeometry([new t.THREE.Vector3(0,r,0)].concat(s),a,Math.PI);var c=t.GeometryHelper.getIndexedBufferGeometry(o);e.strandTemplate={vertex:c.attributes.position.array,normal:c.attributes.normal.array,index:c.attributes.index.array,geometry:c}}function s(e,t){var r=t.state,n=t.params;var i=t.builder;for(var a=0,s=e.residueCount;a<s;a++){r.vertexMap.startElement(e.residueIndex[a]);var u=r.verticesDone;r.residueIndex=a;var l=e.structureStarts.has(e.residueIndex[a]);var c=e.structureEnds.has(e.residueIndex[a]);if(t.isTrace||e.backboneOnly){switch(e.residueType[a]){case 5:i.addTube(e,r,n.strandWidth,n.strandWidth,i.hasP(e.residueIndex[a],t.strandArrays)?n.nucleotideStrandFactor:1);if(l||c){i.addTubeCap(e,r,n.strandWidth,n.strandWidth,l,c)}if(!t.strandTemplate){o(t)}i.addStrandLine(e,r,t.strandTemplate,t.strandArrays,e.residueIndex[a]);break;default:i.addTube(e,r,n.turnWidth,n.turnWidth,n.turnWidth);if(l||c){i.addTubeCap(e,r,n.turnWidth,n.turnWidth,l,c)}break}}else{switch(e.residueType[a]){case 1:i.addTube(e,r,n.helixWidth,n.helixHeight,1);if(l){i.addTubeCap(e,r,n.helixWidth,n.helixHeight,true,false)}
552else if(c){i.addTubeCap(e,r,n.helixWidth,n.helixHeight,false,true)}break;case 3:i.addSheet(e,r,l,c);if(l||c){i.addSheetCap(e,r,l,c)}break;case 5:i.addTube(e,r,n.strandWidth,n.strandWidth,i.hasP(e.residueIndex[a],t.strandArrays)?n.nucleotideStrandFactor:1);if(l||c){i.addTubeCap(e,r,n.strandWidth,n.strandWidth,l,c)}if(!t.strandTemplate){o(t)}i.addStrandLine(e,r,t.strandTemplate,t.strandArrays,e.residueIndex[a]);break;default:i.addTube(e,r,n.turnWidth,n.turnWidth,1);if(l||c){i.addTubeCap(e,r,n.turnWidth,n.turnWidth,l,c)}break}}if(t.parameters.showDirectionCones&&e.residueType[a]!==5){w(t,e,2*n.sheetHeight,a)}r.vertexMap.addVertexRange(u,r.verticesDone);r.vertexMap.endElement()}}r.buildUnit=s;function u(e,t,r){var n=e.model.data.residues.chainIndex;return n[t.endResidueIndex]===n[r.endResidueIndex]}var l=e.Core.Geometry.LinearAlgebra.Vector3;var c=e.Core.Geometry.LinearAlgebra.Matrix4;function f(e,t,r){var n=t.controlPoints.length;var a=t.controlPoints,o=r.controlPoints;var s=l.fromValues(a[n-3],a[n-2],a[n-1]),u=l.fromValues(o[0],o[1],o[2]);var c=e.state.params.turnWidth/2;i.addDashedLine(e.state.gapsBuilder,s,u,.5,.5,c)}var h=function(){var e=new t.THREE.CylinderGeometry(0,1,1,6,1);var r=t.GeometryHelper.toRawGeometry(e);e.dispose();return r}();var d=l.zero(),p=l.fromValues(0,1,0),y=l.zero(),g=l.zero(),b=l.zero(),x=l.zero(),_=c.identity();function w(e,t,r,n){if(t.residueCount<=2)return;var a=t.controlPoints;var o=n*t.linearSegmentCount+(.35*t.linearSegmentCount+1|0);var s=n*t.linearSegmentCount+(.85*t.linearSegmentCount+1|0);if(o===s||3*s>a.length)return;l.set(b,a[3*o],a[3*o+1],a[3*o+2]);l.set(y,a[3*o],a[3*o+1],a[3*o+2]);l.set(g,a[3*s],a[3*s+1],a[3*s+2]);l.sub(y,g,y);var u=l.magnitude(y);if(u<=.1)return;l.set(x,2*r,u,2*r);l.normalize(y,y);l.makeRotation(_,p,y);i.addRawTransformed(e.state.directionConesBuilder,h,x,b,_)}function C(t){return m(this,void 0,void 0,function(){var r,n,i,a,o,l;return v(this,function(c){switch(c.label){case 0:r=1e4;n=e.Core.Utils.PerformanceMonitor.currentTime();i=0;c.label=1;case 1:if(!(i<t.units.length))return[3,4];a=0;while(a<r&&i<t.units.length){s(t.units[i],t);a+=t.units[i].residueCount;i++}o=e.Core.Utils.PerformanceMonitor.currentTime();if(!(o-n>e.Core.Computation.UpdateProgressDelta))return[3,3];n=o;return[4,t.computation.updateProgress("Building units...",true,i,t.units.length)];case 2:c.sent();c.label=3;case 3:return[3,1];case 4:for(l=0;l<t.units.length-1;l++){if(u(t,t.units[l],t.units[l+1])){f(t,t.units[l],t.units[l+1])}}return[2]}})})}r.buildUnitsAsync=C;function E(e){var r=e.state;var n=new Float32Array(r.verticesDone*3),a=new Float32Array(r.verticesDone*4),o=new Float32Array(r.verticesDone);var s=i.toBufferGeometry(r.builder);s.addAttribute("color",new t.THREE.BufferAttribute(n,3));e.geom.vertexStateBuffer=new t.THREE.BufferAttribute(o,1);s.addAttribute("vState",e.geom.vertexStateBuffer);e.geom.geometry=s;if(r.gapsBuilder.vertices.elementCount){e.geom.gapsGeometry=i.toBufferGeometry(r.gapsBuilder)}if(r.directionConesBuilder.vertices.elementCount){e.geom.directionConesGeometry=i.toBufferGeometry(r.directionConesBuilder)}var u=e.geom.vertexMap,l={r:.45,g:.45,b:.45},c=u.vertexRanges;for(var f=0,h=u.elementIndices;f<h.length;f++){var d=h[f];var p=u.elementMap.get(d);var m=u.elementRanges[2*p],v=u.elementRanges[2*p+1];if(m===v)continue;t.Selection.Picking.assignPickColor(d,l);for(var y=m;y<v;y+=2){var g=c[y],b=c[y+1];for(var x=g;x<b;x++){a[x*4]=l.r;a[x*4+1]=l.g;a[x*4+2]=l.b}}}var _=new t.THREE.BufferGeometry;_.addAttribute("position",s.getAttribute("position"));_.addAttribute("index",s.getAttribute("index"));_.addAttribute("pColor",new t.THREE.BufferAttribute(a,4));e.geom.pickGeometry=_}r.createGeometry=E;var S=function(){function e(){this.tempVectors=[new t.THREE.Vector3,new t.THREE.Vector3,new t.THREE.Vector3,new t.THREE.Vector3,new t.THREE.Vector3,new t.THREE.Vector3,new t.THREE.Vector3,new t.THREE.Vector3,new t.THREE.Vector3,new t.THREE.Vector3,new t.THREE.Vector3,new t.THREE.Vector3,new t.THREE.Vector3,new t.THREE.Vector3,new t.THREE.Vector3,new t.THREE.Vector3,new t.THREE.Vector3,new t.THREE.Vector3]}e.prototype.setVector=function(e,t,r){r.set(e[3*t],e[3*t+1],e[3*t+2]);return r};e.prototype.addTube=function(e,t,r,n,i){var a=t.verticesDone,o=0,s=0,u=this.tempVectors[0],l=this.tempVectors[1],c=this.tempVectors[2],f=this.tempVectors[3],h=this.tempVectors[4],d=this.tempVectors[5],p=this.tempVectors[6],m=t.residueIndex*e.linearSegmentCount,v=m+e.linearSegmentCount,y=e.controlPoints,g=e.linearSegmentCount+1,b=e.torsionVectors,x=e.normalVectors,_=t.params.radialSegmentCount;var w=1/(v-m);for(o=m;o<=v;o++){this.setVector(b,o,d);this.setVector(x,o,p);
552var C=w*(o-m)-.5;var E=1+(i-1)*(Math.cos(2*Math.PI*C)+1);var S=E*r,T=E*n;for(s=0;s<_;s++){var M=2*Math.PI*s/_;f.copy(d);h.copy(p);u.addVectors(f.multiplyScalar(S*Math.cos(M)),h.multiplyScalar(T*Math.sin(M)));f.copy(d);h.copy(p);l.addVectors(f.multiplyScalar(T*Math.cos(M)),h.multiplyScalar(S*Math.sin(M)));l.normalize();this.setVector(y,o,c);c.add(u);t.addVertex(c,l)}}for(o=0;o<g-1;o++){for(s=0;s<_;s++){t.addTriangles(a+o*_+s,a+(o+1)*_+(s+1)%_,a+o*_+(s+1)%_,a+o*_+s,a+(o+1)*_+s,a+(o+1)*_+(s+1)%_)}}};e.prototype.addTubeCap=function(e,t,r,n,i,a){var o=t.verticesDone,s,u=this.tempVectors[0],l=this.tempVectors[1],c=this.tempVectors[2],f=this.tempVectors[3],h=this.tempVectors[4],d=this.tempVectors[5],p=this.tempVectors[6],m=this.tempVectors[7],v=t.residueIndex*e.linearSegmentCount,y=e.controlPoints,g=e.linearSegmentCount+1,b=e.torsionVectors,x=e.normalVectors,_=t.params.radialSegmentCount;this.setVector(b,v,p);this.setVector(x,v,m);l.crossVectors(p,m);if(a){l.negate()}var w=v+(i?0:g-1);this.setVector(y,w,u);t.addVertex(u,l);this.setVector(b,w,h);this.setVector(x,w,d);for(var C=0;C<_;C++){s=2*Math.PI*C/_;c.copy(h);f.copy(d);u.addVectors(c.multiplyScalar(Math.cos(s)*r),f.multiplyScalar(Math.sin(s)*n));this.setVector(y,w,p);u.add(p);t.addVertex(u,l);if(i){t.addTriangle(o,o+C+1,o+(C+1)%_+1)}else{t.addTriangle(o,o+(C+1)%_+1,o+C+1)}}};e.prototype.addSheet=function(e,t,r,n){var i=t.verticesDone,a=t.params,o=0,s=0,u=this.tempVectors[0],l=this.tempVectors[1],c=this.tempVectors[2],f=this.tempVectors[3],h=this.tempVectors[4],d=this.tempVectors[5],p=this.tempVectors[7],m=this.tempVectors[8],v=this.tempVectors[9],y=t.residueIndex*e.linearSegmentCount,g=y+e.linearSegmentCount,b=e.controlPoints,x=e.torsionVectors,_=e.normalVectors,w=0,C=0;f.set(0,0,0);if(n){this.setVector(b,g,p);this.setVector(b,y,m);w=a.arrowWidth/d.subVectors(p,m).length()}for(o=y;o<=g;o++){C=!n?a.sheetWidth:a.arrowWidth*(1-(o-y)/e.linearSegmentCount);this.setVector(x,o,u);u.multiplyScalar(C);this.setVector(_,o,l);l.multiplyScalar(a.sheetHeight);if(n){this.setVector(_,o,p);this.setVector(x,o,m);f.crossVectors(p,m).multiplyScalar(w)}this.setVector(b,o,c);this.setVector(_,o,h);this.setVector(x,o,v);p.copy(c).add(u).add(l);m.copy(h);t.addVertex(p,m);p.copy(c).sub(u).add(l);t.addVertex(p,m);p.copy(c).sub(u).add(l);m.copy(v).negate().add(f);t.addVertex(p,m);p.copy(c).sub(u).sub(l);t.addVertex(p,m);p.copy(c).sub(u).sub(l);m.copy(h).negate();t.addVertex(p,m);p.copy(c).add(u).sub(l);t.addVertex(p,m);p.copy(c).add(u).sub(l);m.copy(v).add(f);t.addVertex(p,m);p.copy(c).add(u).add(l);t.addVertex(p,m)}for(o=0;o<e.linearSegmentCount;o++){for(s=0;s<4;s++){t.addTriangles(i+o*8+2*s,i+(o+1)*8+2*s+1,i+o*8+2*s+1,i+o*8+2*s,i+(o+1)*8+2*s,i+(o+1)*8+2*s+1)}}};e.prototype.addSheetCap=function(e,t,r,n){var i=t.params,a=t.residueIndex*e.linearSegmentCount,o=this.setVector(e.controlPoints,a,this.tempVectors[0]);var s=this.setVector(e.torsionVectors,a,this.tempVectors[1]).multiplyScalar(i.sheetWidth);var u=this.setVector(e.normalVectors,a,this.tempVectors[2]).multiplyScalar(i.sheetHeight);var l=this.tempVectors[3].addVectors(o,s).add(u),c=this.tempVectors[4].subVectors(o,s).add(u),f=this.tempVectors[5].subVectors(o,s).sub(u),h=this.tempVectors[6].addVectors(o,s).sub(u);if(r){this.addSheepCapSection(t,l,c,f,h)}else{var d=this.setVector(e.torsionVectors,a,this.tempVectors[7]).multiplyScalar(i.arrowWidth);var p=this.tempVectors[8].addVectors(o,d).add(u),m=this.tempVectors[9].subVectors(o,d).add(u),v=this.tempVectors[10].subVectors(o,d).sub(u),y=this.tempVectors[11].addVectors(o,d).sub(u);this.addSheepCapSection(t,p,l,h,y);this.addSheepCapSection(t,c,m,v,f)}};e.prototype.addSheepCapSection=function(e,t,r,n,i){var a=e.verticesDone,o=this.tempVectors[12].crossVectors(this.tempVectors[13].subVectors(r,t),this.tempVectors[14].subVectors(i,t)).normalize();e.addVertex(t,o);e.addVertex(r,o);e.addVertex(n,o);e.addVertex(i,o);e.addTriangles(a,a+1,a+2,a+2,a+3,a)};e.prototype.findN3=function(e,t,r){var n=t.startIndex[e],i=t.endIndex[e];var a=false;for(var o=n;o<i;o++){if(t.name[o]==="N3"){r.set(t.x[o],t.y[o],t.z[o]);a=true;break}}return a};e.prototype.hasP=function(e,t){var r=t.startIndex[e],n=t.endIndex[e];for(var i=r;i<n;i++){if(t.name[i]==="P")return true}return false};e.prototype.addStrandLine=function(e,r,n,i,a){if(!this.findN3(a,i,this.tempVectors[3]))return;var o=this.tempVectors[0],s=this.tempVectors[1],u,l=n.vertex,c=n.normal,f=n.index,h=r.verticesDone,d=l.length,p=f.length,m=r.residueIndex*e.linearSegmentCount+(.5*e.linearSegmentCount+1|0),v=this.setVector(e.controlPoints,m,this.tempVectors[2]),y=this.tempVectors[3].sub(v),g=y.length();y.normalize();r.translationMatrix.makeTranslation(v.x,v.y,v.z);r.scaleMatrix.makeScale(1,1,g);r.rotationMatrix.makeRotationAxis(new t.THREE.Vector3(-y.y,y.x,0),Math.acos(y.z));r.translationMatrix.multiply(r.rotationMatrix).multiply(r.scaleMatrix);n.geometry.applyMatrix(r.translationMatrix);for(u=0;
552u<d;u+=3){o.set(l[u],l[u+1],l[u+2]);s.set(c[u],c[u+1],c[u+2]);r.addVertex(o,s)}for(u=0;u<p;u+=3){r.addTriangle(h+f[u],h+f[u+1],h+f[u+2])}r.invMatrix.getInverse(r.translationMatrix);n.geometry.applyMatrix(r.invMatrix)};return e}();r.Builder=S})(n=r.Geometry||(r.Geometry={}))})(n=r.Cartoons||(r.Cartoons={}))})(r=t.Molecule||(t.Molecule={}))})(t=e.Visualization||(e.Visualization={}))})(p||(p={}));/* 553 * Copyright (c) 2016 - now David Sehnal, licensed under Apache 2.0, See LICENSE file for more info. 554 */ 555var p;(function(e){var t;(function(t){var r;(function(r){var n;(function(r){"use strict";var n;(function(e){e[e["Default"]=0]="Default";e[e["AlphaTrace"]=1]="AlphaTrace"})(n=r.CartoonsModelType||(r.CartoonsModelType={}));r.DefaultCartoonsModelParameters={tessalation:3,drawingType:n.Default,showDirectionCones:true};var i=function(i){y(a,i);function a(){return i!==null&&i.apply(this,arguments)||this}a.prototype.applySelectionInternal=function(e,r){var n=this.cartoons.vertexStateBuffer,i=n.array,a=this.cartoons.vertexMap,o=a.vertexRanges,s=false,u=this.model.data.atoms.residueIndex;for(var l=0,c=e.length;l<c;l++){var f=u[e[l]];l++;while(u[e[l]]===f){l++}l--;if(!a.elementMap.has(f))continue;var h=a.elementMap.get(f),d=a.elementRanges[2*h],p=a.elementRanges[2*h+1];if(d===p)continue;for(var m=d;m<p;m+=2){var v=o[m],y=o[m+1];s=t.Selection.applyActionToRange(i,v,y,r)||s}}if(!s)return false;n.needsUpdate=true;return true};a.prototype.getPickElements=function(e){var t=this.model.data.residues,r=t.atomStartIndex,n=t.atomEndIndex;var i=[];for(var a=r[e],o=n[e];a<o;a++){if(this.queryContext.hasAtom(a))i.push(a)}return i};a.prototype.highlightElement=function(e,t){return this.applySelection([this.model.data.residues.atomStartIndex[e]],t?3:4)};a.prototype.highlightInternal=function(e){return t.Selection.applyActionToBuffer(this.cartoons.vertexStateBuffer,e?3:4)};a.prototype.applyColoring=function(e){var t=this.model.data.residues,r=t.atomStartIndex,n=t.atomEndIndex;var i={r:.1,g:.1,b:.1};var a={r:.1,g:.1,b:.1};var o=this.cartoons.vertexMap;var s=this.cartoons.geometry.attributes.color;var u=s.array;var l=o.vertexRanges;for(var c=0,f=this.model.data.residues.count;c<f;c++){a.r=0;a.g=0;a.b=0;var h=0;for(var d=r[c],p=n[c];d<p;d++){if(!this.queryContext.hasAtom(d))continue;e.setElementColor(d,i);a.r+=i.r;a.g+=i.g;a.b+=i.b;h++}if(!h)continue;i.r=a.r/h;i.g=a.g/h;i.b=a.b/h;var m=o.elementMap.get(c);var v=o.elementRanges[2*m],y=o.elementRanges[2*m+1];if(v===y)continue;for(var g=v;g<y;g+=2){var b=l[g],x=l[g+1];for(var _=b;_<x;_++){u[_*3]=i.r,u[_*3+1]=i.g,u[_*3+2]=i.b}}}s.needsUpdate=true};a.prototype.applyThemeInternal=function(e){this.applyColoring(e);t.MaterialsHelper.updateMaterial(this.material,e,this.object);t.MaterialsHelper.updateMaterial(this.gapMaterial,e,this.object);t.MaterialsHelper.updateMaterial(this.directionConeMaterial,e,this.object)};a.prototype.createObjects=function(){var e=new t.THREE.Object3D;e.add(new t.THREE.Mesh(this.cartoons.geometry,this.material));if(this.cartoons.gapsGeometry){e.add(new t.THREE.Mesh(this.cartoons.gapsGeometry,this.gapMaterial))}if(this.cartoons.directionConesGeometry){e.add(new t.THREE.Mesh(this.cartoons.directionConesGeometry,this.directionConeMaterial))}return{main:e.children.length>1?e:e.children[0],pick:new t.THREE.Mesh(this.cartoons.pickGeometry,this.pickMaterial)}};a.create=function(i,o){var s=this;var u=o.model,l=o.queryContext,c=o.atomIndices,f=o.theme,h=o.params,d=o.props;return e.Core.computation(function(o){return m(s,void 0,void 0,function(){var s,p,m,y,g;return v(this,function(v){switch(v.label){case 0:s=0,p=0;return[4,o.updateProgress("Computing cartoons...")];case 1:v.sent();h=e.Core.Utils.extend({},h,r.DefaultCartoonsModelParameters);switch(h.tessalation){case 0:s=2;p=2;break;case 1:s=4;p=3;break;case 2:s=6;p=5;break;case 3:s=10;p=8;break;case 4:s=12;p=10;break;case 5:s=16;p=14;break;default:s=18;p=16;break}return[4,r.Geometry.create(u,c,s,{radialSegmentCount:p,tessalation:+h.tessalation,showDirectionCones:!!h.showDirectionCones},h.drawingType===n.AlphaTrace,o)];case 2:m=v.sent();y=new a;y.cartoons=m;y.queryContext=l;y.material=t.MaterialsHelper.getMeshMaterial();y.gapMaterial=new t.THREE.MeshPhongMaterial({color:7829367,shading:t.THREE.FlatShading});y.directionConeMaterial=new t.THREE.MeshPhongMaterial({color:10066329,shading:t.THREE.FlatShading});y.pickMaterial=t.MaterialsHelper.getPickMaterial();if(d)y.props=d;y.entity=i;y.cartoons.geometry.computeBoundingSphere();y.centroid=y.cartoons.geometry.boundingSphere.center;y.radius=y.cartoons.geometry.boundingSphere.radius;g=y.createObjects();y.object=g.main;y.pickObject=g.pick;y.pickBufferAttributes=[y.cartoons.pickGeometry.attributes.pColor];y.model=u;y.applyTheme(f);y.disposeList.push(y.cartoons,y.material,y.pickMaterial,y.gapMaterial,y.directionConeMaterial);return[2,y]}})})})};return a}(t.Model);r.Model=i})(n=r.Cartoons||(r.Cartoons={}))})(r=t.Molecule||(t.Molecule={}))})(t=e.Visualization||(e.Visualization={}))})(p||(p={}));/* 556 * Copyright (c) 2016 - now David Sehnal, licensed under Apache 2.0, See LICENSE file for more info. 557 */ 558var p;(function(e){var t;(function(t){var r;(function(t){var r;(function(t){t.DefaultBondColor={r:.6,g:.6,b:.6};t.DefaultCartoonDirectionConeColor={r:.85,g:.85,b:.85};t.DefaultElementColor={r:.6,g:.6,b:.6};t.DefaultElementColorMap=e.Core.Utils.FastMap.create();t.DefaultPallete=[];(function(){var e=[["Ac",.43921,.67058,.98039],["Al",.74901,.65098,.65098],["Am",.32941,.36078,.94901],["Sb",.6196,.38823,.7098],["Ar",.50196,.8196,.89019],["As",.74117,.50196,.89019],["At",.45882,.3098,.27058],["Ba",0,.78823,0],["Bk",.54117,.3098,.89019],["Be",.76078,1,0],["Bi",.6196,.3098,.7098],["Bh",.87843,0,.2196],["B",1,.7098,.7098],["Br",.65098,.16078,.16078],["Cd",1,.85098,.56078],["Ca",.23921,1,0],["Cf",.63137,.21176,.83137],["C",.45,.45,.45],["Ce",1,1,.78039],["Cs",.34117,.09019,.56078],["Cl",.12156,.94117,.12156],["Cr",.54117,.6,.78039],["Co",.94117,.5647,.62745],["Cu",.78431,.50196,.2],["Cm",.47058,.36078,.89019],["D",.9,.9,.9],["Db",.8196,0,.3098],["Dy",.12156,1,.78039],["Es",.70196,.12156,.83137],["Er",0,.90196,.45882],["Eu",.38039,1,.78039],["Fm",.70196,.12156,.72941],["F",.70196,1,1],["Fr",.25882,0,.4],["Gd",.27058,1,.78039],["Ga",.76078,.56078,.56078],["Ge",.4,.56078,.56078],["Au",1,.8196,.13725],["Hf",.30196,.76078,1],["Hs",.90196,0,.18039],["He",.85098,1,1],["Ho",0,1,.61176],["H",.9,.9,.9],["In",.65098,.45882,.45098],["I",.58039,0,.58039],["Ir",.09019,.32941,.52941],["Fe",.698,.13,.13],["Kr",.36078,.72156,.8196],["La",.43921,.83137,1],["Lr",.78039,0,.4],["Pb",.34117,.34901,.38039],["Li",.8,.50196,1],["Lu",0,.67058,.14117],["Mg",.54117,1,0],["Mn",.61176,.47843,.78039],["Mt",.92156,0,.14901],["Md",.70196,.05098,.65098],["Hg",.72156,.72156,.81568],["Mo",.32941,.7098,.7098],["Nd",.78039,1,.78039],["Ne",.70196,.89019,.96078],["Np",0,.50196,1],["Ni",.31372,.81568,.31372],["Nb",.45098,.76078,.78823],["N",0,.5,1],["No",.74117,.05098,.52941],["Os",.14901,.4,.58823],["O",1,.3,.3],["Pd",0,.41176,.52156],["P",1,.50196,0],["Pt",.81568,.81568,.87843],["Pu",0,.4196,1],["Po",.67058,.36078,0],["K",.56078,.25098,.83137],["Pr",.85098,1,.78039],["Pm",.63921,1,.78039],["Pa",0,.63137,1],["Ra",0,.49019,0],["Rn",.25882,.5098,.58823],["Re",.14901,.49019,.67058],["Rh",.03921,.49019,.54901],["Rb",.43921,.18039,.69019],["Ru",.14117,.56078,.56078],["Rf",.8,0,.34901],["Sm",.56078,1,.78039],["Sc",.90196,.90196,.90196],["Sg",.85098,0,.27058],["Se",1,.63137,0],["Si",.94117,.78431,.62745],["Ag",.75294,.75294,.75294],["Na",.67058,.36078,.94901],["Sr",0,1,0],["S",.9,.775,.25],["Ta",.30196,.65098,1],["Tc",.23137,.6196,.6196],["Te",.83137,.47843,0],["Tb",.18823,1,.78039],["Tl",.65098,.32941,.30196],["Th",0,.72941,1],["Tm",0,.83137,.32156],["Sn",.4,.50196,.50196],["Ti",.74901,.76078,.78039],["W",.12941,.58039,.83921],["U",0,.56078,1],["V",.65098,.65098,.67058],["Xe",.25882,.6196,.69019],["Yb",0,.74901,.2196],["Y",.58039,1,1],["Zn",.49019,.50196,.69019],["Zr",.58039,.87843,.87843]];for(var r=0,n=e;r<n.length;r++){var i=n[r];var a=i[0];var o={r:i[1],g:i[2],b:i[3]};t.DefaultElementColorMap.set(a,o);t.DefaultElementColorMap.set(a.toUpperCase(),o);t.DefaultElementColorMap.set(a.toLowerCase(),o);t.DefaultPallete.push(o)}})()})(r=t.Colors||(t.Colors={}))})(r=t.Molecule||(t.Molecule={}))})(t=e.Visualization||(e.Visualization={}))})(p||(p={}));/* 559 * Copyright (c) 2016 - now David Sehnal, licensed under Apache 2.0, See LICENSE file for more info. 560 */ 561var p;(function(e){var t;(function(t){var r;(function(r){"use strict";var n=e.Core.Geometry.LinearAlgebra;function i(e){var r=e.tessalation,n=r===void 0?0:r;var i=new t.THREE.IcosahedronGeometry(1,n);var a=t.GeometryHelper.toSurface(i);i.dispose();return a}r.createSphereSurface=i;function a(e){var r=e.a,n=e.b,i=e.slices,a=i===void 0?12:i;var o=new t.THREE.TubeGeometry(new t.THREE.LineCurve3(new t.THREE.Vector3(r[0],r[1],r[2]),new t.THREE.Vector3(n[0],n[1],n[2])),2,e.radius,a);
561var s=t.GeometryHelper.toSurface(o);o.dispose();return s}r.createTubeSurface=a;var o=[0,1,0],s=n.Matrix4.zero(),u=n.Matrix4.zero(),l=n.Matrix4.zero();function c(r){var i=r.a,a=r.b,c=r.radius,f=r.slices,h=f===void 0?12:f;var d=n.Vector3.distance(i,a);var p=new t.THREE.CylinderGeometry(0,c,d,h,1);var m=t.GeometryHelper.toSurface(p);p.dispose();var v=n.Vector3.sub(a,a,i);n.Vector3.makeRotation(s,o,v);n.Matrix4.fromTranslation(l,[0,d/2,0]);n.Matrix4.fromTranslation(u,i);e.Core.Geometry.Surface.transformImmediate(m,n.Matrix4.mul3(u,u,s,l));e.Core.Geometry.Surface.computeNormalsImmediate(m);return m}r.createCone=c;function f(e){var t=e.id,r=e.a,i=e.b,a=e.radius,o=e.slices,s=o===void 0?12:o,u=e.coneHeight,l=e.coneRadius;var c=n.Vector3.distance(r,i);var f=c-u;var h=n.Vector3.normalize(i,n.Vector3.sub(i,i,r));var d=[r[0]+f*h[0],r[1]+f*h[1],r[2]+f*h[2]];return[{type:"Cone",a:d,b:i,id:t,radius:l,slices:s},{type:"Tube",a:r,b:d,id:t,radius:a,slices:s}]}r.createArrow=f;var h=function(){var e=t.GeometryHelper.toSurface(new t.THREE.BoxGeometry(1,1,1));for(var r=0;r<e.vertices.length;r+=3){e.vertices[r+2]+=.5}return e}();function d(e){var t=e.id,r=e.a,i=e.b,a=e.width,o=e.dashSize,s=e.spaceSize;var u=n.Vector3.distance(r,i);if(u===0)return[];var l=o+(s!==void 0?s:o);var c=n.Vector3.sub(n.Vector3(),i,r);n.Vector3.normalize(c,c);var f=n.Vector3.fromValues(a,a,o);var d=n.Vector3.fromValues(0,0,1);var p=n.Vector3.makeRotation(n.Matrix4(),d,c);var m=[];n.Vector3.scale(c,c,l);var v=n.Vector3.copy(n.Vector3(),r);for(var y=0;y<u;y+=l){if(y+o>u)f=n.Vector3.fromValues(a,a,u-y);m.push({type:"Surface",id:t,surface:h,rotation:p,scale:f,translation:n.Vector3.clone(v)});n.Vector3.add(v,v,c)}return m}r.createDashes=d})(r=t.Primitive||(t.Primitive={}))})(t=e.Visualization||(e.Visualization={}))})(p||(p={}));/* 562 * Copyright (c) 2016 - now David Sehnal, licensed under Apache 2.0, See LICENSE file for more info. 563 */ 564var p;(function(e){var t;(function(t){var r;(function(t){"use strict";var r=e.Core.Geometry.LinearAlgebra;var n=e.Core.Geometry.Surface;function i(i){var a=this;return e.Core.computation(function(o){return m(a,void 0,void 0,function(){var a,s,u,l,c,f,h,d,p,m,c,y,g,b,x,_,w,C,E,S,T,M,A,P,R,k,I,D,c,B,L,F,V,O,F,V,F,V,O,F,V,F,V,O,F,V,F,V,O,F,V,U,F,V,F,V,N;return v(this,function(v){switch(v.label){case 0:return[4,o.updateProgress("Building surface...")];case 1:v.sent();a=e.Core.Utils.FastMap.create();s=[];for(u=0,l=i;u<l.length;u++){c=l[u];switch(c.type){case"Sphere":if(a.has(c.tessalation||0))s.push(a.get(c.tessalation||0));else{f=t.createSphereSurface(c);a.set(c.tessalation||0,f);s.push(f)}break;case"Tube":{h=t.createTubeSurface(c);s.push(h);break}case"Cone":{s.push(t.createCone(c));break}case"Surface":{s.push(c.surface);break}}}d={vertexCount:0,triangleCount:0};for(p=0,m=s;p<m.length;p++){c=m[p];d.vertexCount+=c.vertexCount;d.triangleCount+=c.triangleCount}y=new Float32Array(d.vertexCount*3);g=new Float32Array(d.vertexCount*3);b=new Uint32Array(d.triangleCount*3);x=new Int32Array(d.vertexCount);_=0,w=0,C=0,E=0;S=r.Vector3.zero();T=r.Matrix4.zero(),M=r.Matrix4.zero(),A=r.Matrix4.zero(),P=r.Matrix4.zero();k=0;for(I=0,D=i;I<D.length;I++){c=D[I];B=s[k++];L=_/3|0;switch(c.type){case"Sphere":{R=B.vertices;r.Matrix4.fromScaling(T,[c.radius,c.radius,c.radius]);r.Matrix4.fromTranslation(M,c.center);r.Matrix4.mul(P,M,T);for(F=0,V=B.vertexCount*3;F<V;F+=3){S[0]=R[F],S[1]=R[F+1],S[2]=R[F+2];r.Vector3.transformMat4(S,S,P);y[_++]=S[0];y[_++]=S[1];y[_++]=S[2]}O=B.normals;for(F=0,V=O.length;F<V;F++){g[w++]=O[F]}break}case"Tube":case"Cone":{R=B.vertices;for(F=0,V=R.length;F<V;F++){y[_++]=R[F]}O=B.normals;for(F=0,V=O.length;F<V;F++){g[w++]=O[F]}break}case"Surface":{if(!B.normals)n.computeNormalsImmediate(B);R=B.vertices;if(c.rotation||c.scale||c.translation){r.Matrix4.fromScaling(T,c.scale||[1,1,1]);r.Matrix4.fromTranslation(M,c.translation||[0,0,0]);if(c.rotation)r.Matrix4.copy(A,c.rotation);else r.Matrix4.fromIdentity(A);r.Matrix4.mul3(P,M,A,T);for(F=0,V=R.length;F<V;F+=3){S[0]=R[F],S[1]=R[F+1],S[2]=R[F+2];r.Vector3.transformMat4(S,S,P);y[_++]=S[0];y[_++]=S[1];y[_++]=S[2]}r.Matrix4.mul(P,A,T);O=B.normals;for(F=0,V=O.length;F<V;F+=3){S[0]=O[F],S[1]=O[F+1],S[2]=O[F+2];r.Vector3.transformMat4(S,S,P);r.Vector3.normalize(S,S);g[w++]=S[0];g[w++]=S[1];g[w++]=S[2]}}else{for(F=0,V=R.length;F<V;F++){y[_++]=R[F]}O=B.normals;for(F=0,V=O.length;F<V;F++){g[w++]=O[F]}}break}}U=B.triangleIndices;for(F=0,V=U.length;F<V;F++){b[C++]=L+U[F]}for(F=0,V=B.vertexCount;F<V;F++){x[E++]=c.id}}N={vertices:y,vertexCount:d.vertexCount,triangleIndices:b,triangleCount:d.triangleCount,normals:g,annotation:x};return[2,N]}})})})}var a=function(){function e(){this.shapes=[]}e.prototype.add=function(e){this.shapes.push(e);return this};e.prototype.buildSurface=function(){var e=false;for(var r=0,n=this.shapes;r<n.length;r++){var a=n[r];if(a.type==="DashedLine"||a.type==="Arrow"){e=true;break}}if(e){var o=[];for(var s=0,u=this.shapes;s<u.length;s++){var a=u[s];if(a.type==="DashedLine"){for(var l=0,c=t.createDashes(a);l<c.length;l++){var f=c[l];o[o.length]=f}}else if(a.type==="Arrow"){for(var h=0,d=t.createArrow(a);h<d.length;h++){var p=d[h];o[o.length]=p}}else{o[o.length]=a}}return i(o)}return i(this.shapes)};e.create=function(){return new e};return e}();t.Builder=a})(r=t.Primitive||(t.Primitive={}))})(t=e.Visualization||(e.Visualization={}))})(p||(p={}));/* 565 * Copyright (c) 2016 - now David Sehnal, licensed under Apache 2.0, See LICENSE file for more info. 566 */ 567var p;(function(e){var t;(function(e){e.VERSION={number:"1.4.4",date:"May 31 2018"}})(t=e.Bootstrap||(e.Bootstrap={}))})(p||(p={}));/* 568 * Copyright (c) 2016 - now David Sehnal, licensed under Apache 2.0, See LICENSE file for more info. 569 */ 570var p;(function(e){var t;(function(t){"use strict";t.Immutable=u;t.Rx=e.Core.Rx;t.Zlib=c})(t=e.Bootstrap||(e.Bootstrap={}))})(p||(p={}));/* 571 * Copyright (c) 2016 - now David Sehnal, licensed under Apache 2.0, See LICENSE file for more info. 572 */ 573var p;(function(e){var t;(function(e){var t;(function(e){"use strict";var t;(function(t){function r(e,t){return{previous:null,next:null,inList:false,key:e,data:t}}t.entry=r;function n(t){return{entries:new e.LinkedList,capacity:Math.max(1,t)}}t.create=n;function i(e,t){for(var r=e.entries.first;r;r=r.next){if(r.key===t){e.entries.remove(r);e.entries.addLast(r);return r.data}}return void 0}t.get=i;function a(e,t,n){if(e.entries.count>=e.capacity){e.entries.remove(e.entries.first)}e.entries.addLast(r(t,n));return n}t.set=a})(t=e.LRUCache||(e.LRUCache={}))})(t=e.Utils||(e.Utils={}))})(t=e.Bootstrap||(e.Bootstrap={}))})(p||(p={}));/* 574 * Copyright (c) 2016 - now David Sehnal, licensed under Apache 2.0, See LICENSE file for more info. 575 */ 576var p;(function(e){var t;(function(t){var r;(function(r){"use strict";var n;(function(e){e[e["None"]=0]="None";e[e["Gzip"]=1]="Gzip"})(n=r.DataCompressionMethod||(r.DataCompressionMethod={}));function i(e){return p(e,false)}r.readStringFromFile=i;function a(e){return p(e,true)}r.readArrayBufferFromFile=a;function o(e,t){return p(e,t==="Binary")}r.readFromFile=o;function s(e,t){return b(t,e,false,false)}r.ajaxGetString=s;function u(e,t){return b(t,e,true,false)}r.ajaxGetArrayBuffer=u;function l(e){return b(e.title,e.url,e.type==="Binary",e.compression===n.Gzip)}r.ajaxGet=l;function f(e){var t=new c.Gunzip(new Uint8Array(e));return t.decompress()}function h(t,r,n,i){return m(this,void 0,void 0,function(){var a,o;return v(this,function(s){switch(s.label){case 0:a=i.target.result;if(!n)return[3,2];return[4,t.updateProgress("Decompressing...")];case 1:s.sent();o=f(a);if(r){return[2,o.buffer]}
576else{return[2,e.Core.Formats.CIF.Binary.MessagePack.utf8Read(o,0,o.length)]}return[3,3];case 2:return[2,a];case 3:return[2]}})})}function d(t,r,n,i){return new e.Promise(function(i,a){n.onerror=function(e){var t=e.target.error;a(t?t:"Failed.")};n.onabort=function(){return a(e.Core.Computation.Aborted)};n.onprogress=function(e){if(e.lengthComputable){t.updateProgress(r,true,e.loaded,e.total)}else{t.updateProgress(r+" "+(e.loaded/1024/1024).toFixed(2)+" MB",true)}};n.onload=function(e){return i(e)}})}function p(r,n){var i=this;return t.Task.fromComputation("Open File","Background",e.Core.computation(function(e){return m(i,void 0,void 0,function(){var t,i,a,o;return v(this,function(s){switch(s.label){case 0:t=new FileReader;i=/\.gz$/i.test(r.name);if(i||n)t.readAsArrayBuffer(r);else t.readAsBinaryString(r);e.updateProgress("Opening file...",function(){return t.abort()});return[4,d(e,"Reading...",t,n)];case 1:a=s.sent();o=h(e,n,i,a);return[2,o]}})})}))}var y=function(){function e(){}e.get=function(){if(this.pool.length){return this.pool.pop()}return new XMLHttpRequest};e.emptyFunc=function(){};e.deposit=function(t){if(this.pool.length<this.poolSize){t.onabort=e.emptyFunc;t.onerror=e.emptyFunc;t.onload=e.emptyFunc;t.onprogress=e.emptyFunc;this.pool.push(t)}};e.pool=[];e.poolSize=15;return e}();function g(e,t,r,n){return m(this,void 0,void 0,function(){var i,a,o,s,u,l;return v(this,function(f){switch(f.label){case 0:i=n.target;if(!(i.status>=200&&i.status<400))return[3,6];if(!t)return[3,4];a=n.target.response;y.deposit(n.target);if(!r)return[3,2];return[4,e.updateProgress("Decompressing...")];case 1:f.sent();o=new c.Gunzip(new Uint8Array(a));s=o.decompress();return[2,s.buffer];case 2:return[2,a];case 3:return[3,5];case 4:u=n.target.responseText;y.deposit(n.target);return[2,u];case 5:return[3,7];case 6:l=i.statusText;y.deposit(n.target);throw l;case 7:return[2]}})})}function b(r,n,i,a){var o=this;return t.Task.fromComputation(r?r:"Download","Background",e.Core.computation(function(e){return m(o,void 0,void 0,function(){var t,r,o;return v(this,function(s){switch(s.label){case 0:if(!i&&a){throw"Decompress is only available when downloading binary data."}t=y.get();t.open("get",n,true);t.responseType=i?"arraybuffer":"text";t.send();e.updateProgress("Waiting for server...",function(){return t.abort()});return[4,d(e,"Downloading...",t,i)];case 1:r=s.sent();return[4,g(e,i,a,r)];case 2:o=s.sent();return[2,o]}})})}))}})(r=t.Utils||(t.Utils={}))})(t=e.Bootstrap||(e.Bootstrap={}))})(p||(p={}));/* 577 * Copyright (c) 2016 - now David Sehnal, licensed under Apache 2.0, See LICENSE file for more info. 578 */ 579var p;(function(e){var t;(function(t){var r;(function(t){var r;(function(t){"use strict";var r=/^\s*([1-9][0-9]*)\s+([_.;:""&<>()\/\{}'`~!@#$%A-Za-z0-9*|+-]+)(?:\s+i[:]([.]|[a-zA-Z0-9]))?(?:\s+e[:]([.]|[a-zA-Z0-9]+))?/;function n(e){if(!e||e==="."||e==="?")return null;return e}function i(e){var t=e.match(r);if(!t)return void 0;var i=+t[1]|0;var a=n(t[2]);var o=n(t[3]);var s=n(t[4]);return{entityId:s,authSeqNumber:i,authAsymId:a,insCode:o}}function a(t,r){var n;if(r===void 0){r=","}var a=t.split(r).map(function(e){return i(e)}).filter(function(e){return!!e});return e.Core.Structure.Query.Builder.toQuery((n=e.Core.Structure.Query).residues.apply(n,a))}t.parseAuthResidueId=a})(r=t.Query||(t.Query={}))})(r=t.Utils||(t.Utils={}))})(t=e.Bootstrap||(e.Bootstrap={}))})(p||(p={}));/* 580 * Copyright (c) 2016 - now David Sehnal, licensed under Apache 2.0, See LICENSE file for more info. 581 */ 582var p;(function(e){var t;(function(e){var t;(function(e){var t;(function(e){"use strict";var t=function(){function e(e,t,r){this.isError=e;this.value=t;this.error=r}e.prototype.bind=function(e){if(this.isError)return this;return e(this.value)};return e}();e.ValueOrError=t;(function(e){function t(t){return new e(true,void 0,t)}e.error=t;function r(t){return new e(true,t)}e.value=r})(t=e.ValueOrError||(e.ValueOrError={}))})(t=e.Query||(e.Query={}))})(t=e.Utils||(e.Utils={}))})(t=e.Bootstrap||(e.Bootstrap={}))})(p||(p={}));/* 583 * Copyright (c) 2016 - now David Sehnal, licensed under Apache 2.0, See LICENSE file for more info. 584 */ 585var p;(function(e){var t;(function(e){var t;(function(e){"use strict";var t=function(){function e(){this.count=0;this.first=null;this.last=null}e.prototype.addFirst=function(e){e.inList=true;if(this.first)this.first.previous=e;e.next=this.first;this.first=e;this.count++};e.prototype.addLast=function(e){if(this.last!=null){this.last.next=e}e.previous=this.last;this.last=e;if(this.first==null){this.first=e}e.inList=true;this.count++};e.prototype.remove=function(e){if(!e.inList)return;e.inList=false;if(e.previous!==null){e.previous.next=e.next}else if(e.previous===null){this.first=e.next}if(e.next!==null){e.next.previous=e.previous}else if(e.next===null){this.last=e.previous}e.next=null;e.previous=null;this.count--};return e}();e.LinkedList=t})(t=e.Utils||(e.Utils={}))})(t=e.Bootstrap||(e.Bootstrap={}))})(p||(p={}));/* 586 * Copyright (c) 2016 - now David Sehnal, licensed under Apache 2.0, See LICENSE file for more info. 587 */ 588var p;(function(e){var t;(function(e){var t;(function(e){"use strict";function t(e){return(e<10?"0":"")+e}function r(e){var r=e.getHours(),n=e.getMinutes(),i=e.getSeconds();return r+":"+t(n)+":"+t(i)}e.formatTime=r;function n(e,t){var r=Math.pow(10,t);return Math.round(r*e)/r}e.round=n;function i(e){if(e.isIndeterminate)return e.message;var t=(100*e.current/e.max).toFixed(2);return e.message+" "+t+"%"}e.formatProgress=i;function a(){var e=(new Date).getTime();if(window.performance&&typeof window.performance.now==="function"){e+=performance.now()}var t="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(t){var r=(e+Math.random()*16)%16|0;e=Math.floor(e/16);return(t=="x"?r:r&3|8).toString(16)});return t}e.generateUUID=a})(t=e.Utils||(e.Utils={}))})(t=e.Bootstrap||(e.Bootstrap={}))})(p||(p={}));/* 589 * Copyright (c) 2016 - now David Sehnal, licensed under Apache 2.0, See LICENSE file for more info. 590 */ 591var p;(function(e){var t;(function(t){var r;(function(t){"use strict";var r=void 0;function n(e){if(!r)r=i();return function(e,t){return function(r){var n=t.get(e[r]);if(n!==void 0)return n;return 1}}(e.data.atoms.elementSymbol,r)}t.vdwRadiusFromElementSymbol=n;function i(){var t={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.16,Ti:1.87,V:1.79,Cr:1.89,Mn:1.97,Fe:1.94,Co:1.92,Ni:1.84,Cu:1.86,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.19,Zr:1.86,Nb:2.07,Mo:2.09,Tc:2.09,Ru:2.07,Rh:1.95,Pd:2.02,Ag:2.03,Cd:2.3,In:1.93,Sn:2.17,Sb:2.06,Te:2.06,I:1.98,Xe:2.16,Cs:3.43,Ba:2.68,La:2.4,Ce:2.35,Pr:2.39,Nd:2.29,Pm:2.36,Sm:2.29,Eu:2.33,Gd:2.37,Tb:2.21,Dy:2.29,Ho:2.16,Er:2.35,Tm:2.27,Yb:2.42,Lu:2.21,Hf:2.12,Ta:2.17,W:2.1,Re:2.17,Os:2.16,Ir:2.02,Pt:2.09,Au:2.17,Hg:2.09,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.6,Th:2.37,Pa:2.43,U:2.4,Np:2.21,Pu:2.43,Am:2.44,Cm:2.45,Bk:2.44,Cf:2.45,Es:2.45,Fm:2.45,Md:2.46,No:2.46,Lr:2.46};var r=e.Core.Utils.FastMap.create();for(var n in t){r.set(n,t[n]);r.set(n.toUpperCase(),t[n]);r.set(n.toLowerCase(),t[n])}return r}})(r=t.Utils||(t.Utils={}))})(t=e.Bootstrap||(e.Bootstrap={}))})(p||(p={}));/* 592 * Copyright (c) 2016 - now David Sehnal, licensed under Apache 2.0, See LICENSE file for more info. 593 */ 594var p;(function(e){var t;(function(t){var r;(function(t){"use strict";var r=Object.prototype.hasOwnProperty;function n(t){return e.Core.Utils.extend({},t)}t.shallowClone=n;function i(e,t){if(!e){if(!t)return true;return false}if(!t)return false;var n=Object.keys(e);if(Object.keys(t).length!==n.length)return false;for(var i=0,a=n;i<a.length;i++){var o=a[i];if(!r.call(e,o)||e[o]!==t[o])return false}return true}t.shallowEqual=i;function a(e,t){if(!e){if(!t)return true;return false}if(!t)return false;var n=Object.keys(e);if(Object.keys(t).length!==n.length)return false;for(var i=0,o=n;i<o.length;i++){var s=o[i];if(!r.call(e,s))return false;var u=e[s];var l=t[s];if(typeof u==="object"&&typeof l==="object"){if(!a(u,l))return false}else if(u!==l)return false}return true}t.deepEqual=a;function o(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i=0,a=Object.keys(n);i<a.length;i++){var o=a[i];if(r.call(n,o)){e[o]=n[o]}}}return e}t.assign=Object.assign||o;function s(e,i){var a=false;for(var o=0,s=Object.keys(i);o<s.length;o++){var u=s[o];if(!r.call(i,u))continue;if(i[u]!==e[u]){a=true;break}}if(!a)return e;return t.assign(n(e),i)}function u(e){var r=e;for(var n=1;n<arguments.length;n++){if(!arguments[n])continue;r=s(e,arguments[n]);if(r!==e){for(var i=n+1;i<arguments.length;i++){r=t.assign(r,arguments[i])}break}}return r}t.merge=u})(r=t.Utils||(t.Utils={}))})(t=e.Bootstrap||(e.Bootstrap={}))})(p||(p={}));/* 595 * Copyright (c) 2016 - now David Sehnal, licensed under Apache 2.0, See LICENSE file for more info. 596 */ 597var p;(function(e){var t;(function(e){var t;(function(t){"use strict";var r=function(){function t(){this.LOG_DISPATCH_STREAM=false;this.lanes=[];for(var r=0;r<=t.Lane.Task;r++){this.lanes.push(new e.Rx.Subject)}}t.prototype.dispatch=function(e){if(this.LOG_DISPATCH_STREAM)console.log(e.type.n
597ame,t.Lane[e.type.lane],e.data);this.lanes[e.type.lane].onNext(e)};t.prototype.schedule=function(e,t,r){if(r===void 0){r=1e3/31}return setTimeout(function(){if(t){try{e.call(null)}catch(e){t.call(null,""+e)}}else{e.call(null)}},r)};t.prototype.getStream=function(e){return this.lanes[e.lane].filter(function(t){return t.type===e})};t.prototype.finished=function(){this.lanes.forEach(function(e){return e.onCompleted()})};return t}();t.Dispatcher=r;(function(e){var t;(function(e){e[e["Slow"]=0]="Slow";e[e["Fast"]=1]="Fast";e[e["Log"]=2]="Log";e[e["Busy"]=3]="Busy";e[e["Transformer"]=4]="Transformer";e[e["Task"]=5]="Task"})(t=e.Lane||(e.Lane={}))})(r=t.Dispatcher||(t.Dispatcher={}))})(t=e.Service||(e.Service={}))})(t=e.Bootstrap||(e.Bootstrap={}))})(p||(p={}));/* 598 * Copyright (c) 2016 - now David Sehnal, licensed under Apache 2.0, See LICENSE file for more info. 599 */ 600var p;(function(e){var t;(function(e){var t;(function(t){"use strict";var r=function(){function t(e){this.context=e}t.prototype.log=function(t){e.Event.Log.dispatch(this.context,t)};t.prototype.message=function(e){this.log({type:t.EntryType.Message,timestamp:new Date,message:e})};t.prototype.error=function(e){this.log({type:t.EntryType.Error,timestamp:new Date,message:e})};t.prototype.warning=function(e){this.log({type:t.EntryType.Warning,timestamp:new Date,message:e})};t.prototype.info=function(e){this.log({type:t.EntryType.Info,timestamp:new Date,message:e})};return t}();t.Logger=r;(function(e){var t;(function(e){e[e["Message"]=0]="Message";e[e["Error"]=1]="Error";e[e["Warning"]=2]="Warning";e[e["Info"]=3]="Info"})(t=e.EntryType||(e.EntryType={}))})(r=t.Logger||(t.Logger={}))})(t=e.Service||(e.Service={}))})(t=e.Bootstrap||(e.Bootstrap={}))})(p||(p={}));/* 601 * Copyright (c) 2016 - now David Sehnal, licensed under Apache 2.0, See LICENSE file for more info. 602 */ 603var p;(function(e){var t;(function(e){var t;(function(e){"use strict"})(t=e.Service||(e.Service={}))})(t=e.Bootstrap||(e.Bootstrap={}))})(p||(p={}));/* 604 * Copyright (c) 2016 - now David Sehnal, licensed under Apache 2.0, See LICENSE file for more info. 605 */ 606var p;(function(e){var t;(function(t){"use strict";var r=e.Core.Computation;var n=function(){function e(e,t,r){this.name=e;this.type=t;this.computation=r;this.info={id:i++,name:e,type:t,reportTime:false}}Object.defineProperty(e.prototype,"id",{get:function(){return this.info.id},enumerable:true,configurable:true});Object.defineProperty(e.prototype,"reportTime",{get:function(){return this.info.reportTime},enumerable:true,configurable:true});e.prototype.run=function(e){return this.runWithContext(e).result};e.prototype.runWithContext=function(t){return new e.Running(t,this.computation,this.info)};e.prototype.setReportTime=function(e){this.info.reportTime=e;return this};return e}();t.Task=n;var i=0;(function(n){n.__DEBUG_MODE__=false;var i=function(){function i(e,t,r){this.context=e;this.computation=t;this.info=r;this.run()}i.prototype.tryAbort=function(){this.computationCtx.requestAbort()};i.prototype.progressUpdated=function(e){t.Event.Task.StateUpdated.dispatch(this.context,{taskId:this.info.id,type:this.info.type,name:this.info.name,message:t.Utils.formatProgress(e),abort:e.requestAbort})};i.prototype.resolved=function(){try{this.context.performance.end("task"+this.info.id);if(this.info.reportTime){var r=this.context.performance.time("task"+this.info.id);if(this.info.type!=="Silent")this.context.logger.info(this.info.name+" finished in "+e.Core.Utils.PerformanceMonitor.format(r)+".")}}finally{t.Event.Task.Completed.dispatch(this.context,this.info.id)}};i.prototype.rejected=function(e){this.context.performance.end("task"+this.info.id);this.context.performance.formatTime("task"+this.info.id);if(n.__DEBUG_MODE__){console.error(e)}try{if(this.info.type==="Silent"){if(e.warn)this.context.logger.warning("Warning ("+this.info.name+"): "+e.message);else console.error("Error ("+this.info.name+")",e)}else{if(e.warn){this.context.logger.warning("Warning ("+this.info.name+"): "+e.message)}else{var r=""+e;if(r.indexOf("Aborted")>=0)this.context.logger.info(this.info.name+": Aborted.");else this.context.logger.error("Error ("+this.info.name+"): "+e)}}}catch(r){console.error(r)}finally{t.Event.Task.Completed.dispatch(this.context,this.info.id)}};i.prototype.run=function(){var e=this;this.computationCtx=r.createContext();this.computationCtx.progress.subscribe(function(t){return e.progressUpdated(t)});t.Event.Task.Started.dispatch(this.context,this.info);this.context.performance.start("task"+this.info.id);this.result=this.computation.run(this.computationCtx);this.result.then(function(){return e.resolved()}).catch(function(t){return e.rejected(t)})};return i}();n.Running=i;function a(t,r,i){return new n(t,r,e.Core.computation(i))}n.create=a;function o(e,t,i){return new n(e,t,r.resolve(i))}n.resolve=o;function s(e,t,i){return new n(e,t,r.reject(i))}n.reject=s;function u(e,t,r){return new n(e,t,r)}n.fromComputation=u;function l(e){return e.then&&e.catch}n.isPromise=l})(n=t.Task||(t.Task={}))})(t=e.Bootstrap||(e.Bootstrap={}))})(p||(p={}));/* 607 * Copyright (c) 2016 - now David Sehnal, licensed under Apache 2.0, See LICENSE file for more info. 608 */ 609var p;(function(e){var t;(function(e){"use strict";var t;(function(e){var t={dispatch:function(e,t){e.dispatcher.dispatch({type:this,data:t})}
609,getStream:function(e){return e.dispatcher.getStream(this)}};function r(e,r){return Object.create(t,{name:{writable:false,configurable:false,value:e},lane:{writable:false,configurable:false,value:r}})}e.create=r})(t=e.Event||(e.Event={}))})(t=e.Bootstrap||(e.Bootstrap={}))})(p||(p={}));/* 610 * Copyright (c) 2016 - now David Sehnal, licensed under Apache 2.0, See LICENSE file for more info. 611 */ 612var p;(function(e){var t;(function(e){var t;(function(t){"use strict";var r=e.Service.Dispatcher.Lane;t.Log=t.create("bs.Log",r.Log);var n;(function(e){e.LayoutChanged=t.create("bs.Common.LayoutChanged",r.Slow);e.ComponentsChanged=t.create("bs.Common.ComponentsChanged",r.Slow)})(n=t.Common||(t.Common={}));var i;(function(e){e.Started=t.create("bs.Tasks.Started",r.Task);e.Completed=t.create("bs.Tasks.Completed",r.Task);e.StateUpdated=t.create("bs.Tasks.StateUpdated",r.Busy)})(i=t.Task||(t.Task={}));var a;(function(e){e.NodeUpdated=t.create("bs.Tree.NodeUpdated",r.Slow);e.NodeAdded=t.create("bs.Tree.NodeAdded",r.Slow);e.NodeRemoved=t.create("bs.Tree.NodeRemoved",r.Slow);e.TransformStarted=t.create("bs.Tree.TransformStarted",r.Slow);e.TransformFinished=t.create("bs.Tree.TransformFinished",r.Slow);e.TransformerApply=t.create("bs.Tree.TransformerApplied",r.Transformer)})(a=t.Tree||(t.Tree={}));var o;(function(e){e.CurrentChanged=t.create("bs.Entity.CurrentChanged",r.Slow)})(o=t.Entity||(t.Entity={}));var s;(function(e){e.Highlight=t.create("bs.Visuals.HoverElement",r.Fast)})(s=t.Interactivity||(t.Interactivity={}));var u;(function(e){e.VisualHoverElement=t.create("bs.Visual.HoverElement",r.Fast);e.VisualSelectElement=t.create("bs.Visual.SelectElement",r.Fast);e.CameraChanged=t.create("bs.Visual.CameraChanged",r.Fast)})(u=t.Visual||(t.Visual={}));var l;(function(e){e.ModelHighlight=t.create("bs.Molecule.ModelHighlight",r.Fast);e.ModelSelect=t.create("bs.Molecule.ModelSelect",r.Fast)})(l=t.Molecule||(t.Molecule={}))})(t=e.Event||(e.Event={}))})(t=e.Bootstrap||(e.Bootstrap={}))})(p||(p={}));/* 613 * Copyright (c) 2016 - now David Sehnal, licensed under Apache 2.0, See LICENSE file for more info. 614 */ 615var p;(function(e){var t;(function(t){var r;(function(r){"use strict";var n=t.Service.Dispatcher.Lane;var i=t.Event.create;var a;(function(e){e.RemoveNode=i("bs.cmd.Tree.RemoveNode",n.Slow);e.ApplyTransform=i("bs.cmd.Tree.ApplyTransform",n.Slow)})(a=r.Tree||(r.Tree={}));var o;(function(e){e.SetCurrent=i("bs.cmd.Entity.SetCurrentNode",n.Slow);e.ToggleExpanded=i("bs.cmd.Entity.ToggleExpanded",n.Slow);e.SetVisibility=i("bs.cmd.Entity.SetVisibility",n.Slow);e.Focus=i("bs.cmd.Entity.Focus",n.Slow);e.Highlight=i("bs.cmd.Entity.Highlight",n.Slow)})(o=r.Entity||(r.Entity={}));var s;(function(t){t.SetState=e.Bootstrap.Event.create("lm.cmd.Layout.SetState",n.Slow);t.SetViewportOptions=i("bs.cmd.Layout.SetViewportOptions",n.Slow)})(s=r.Layout||(r.Layout={}));var u;(function(e){e.FocusQuery=i("bs.cmd.Molecule.FocusQuery",n.Slow);e.Highlight=i("bs.cmd.Molecule.Highlight",n.Slow);e.CreateSelectInteraction=i("bs.cmd.Molecule.CreateSelectInteraction",n.Slow)})(u=r.Molecule||(r.Molecule={}));var l;(function(e){e.ResetScene=i("bs.cmd.Visual.ResetScene",n.Slow);e.ResetTheme=i("bs.cmd.Visual.ResetTheme",n.Slow);e.UpdateBasicTheme=i("bs.cmd.Visual.UpdateBasicTheme",n.Slow)})(l=r.Visual||(r.Visual={}));var c;(function(e){e.Show=i("bs.cmd.Toast.Show",n.Slow);e.Hide=i("bs.cmd.Toast.Hide",n.Slow)})(c=r.Toast||(r.Toast={}))})(r=t.Command||(t.Command={}))})(t=e.Bootstrap||(e.Bootstrap={}))})(p||(p={}));/* 616 * Copyright (c) 2016 - now David Sehnal, licensed under Apache 2.0, See LICENSE file for more info. 617 */ 618var p;(function(e){var t;(function(t){"use strict";var r;(function(r){function n(t,r){var n={version:0,refs:e.Core.Utils.FastMap.create(),nodes:e.Core.Utils.FastSet.create(),root:r,context:t};r.parent=r;r.tree=n;return n}r.create=n;function i(e){if(!e.tree)return;var t=e.tree.refs.get(e.ref);if(!t){e.tree.refs.set(e.ref,[e])}else{t.push(e)}}function a(e){r.Node.forEach(e,function(e){return i(e)})}function o(e,t){var r=e.refs.get(t.ref);if(!r)return;var n=r.indexOf(t);if(n<0)return;r[n]=r[r.length-1];r.pop();if(!r.length)e.refs.delete(t.ref)}function s(e){if(!e.parent)throw"Cannot add a node without a parent.";var n=e.parent.tree;r.Node.forEach(e,function(e){return e.tree=n});r.Node.addChild(e.parent,e);a(e);
618t.Entity.nodeUpdated(e.parent);u(e)}r.add=s;function u(e){var n=e.tree.context;r.Node.forEachPreorder(e,function(e){t.Event.Tree.NodeAdded.dispatch(n,e)})}function l(e,n,i){r.Node.replaceChild(n.parent,n,i);h(e.context,n);r.Node.forEach(i,function(t){return t.tree=e});a(i);for(var o=0,s=i.children;o<s.length;o++){var l=s[o];u(l)}t.Entity.nodeUpdated(i.parent);t.Event.Tree.NodeAdded.dispatch(e.context,i);if(e.context.currentEntity===n){t.Entity.setCurrent(i)}}r.update=l;function c(e){if(!e)return;var n=void 0;while(e!==e.parent){n=e;r.Node.update(e);e=e.parent}if(n)t.Event.Tree.NodeUpdated.dispatch(e.tree.context,n)}r.updatePath=c;function f(e){var n=e.root.children;e.root.children=[];r.Node.update(e.root);t.Entity.nodeUpdated(e.root);e.refs.clear();for(var i=0,a=n;i<a.length;i++){var o=a[i];h(e.context,o)}t.Command.Entity.SetCurrent.dispatch(e.context,e.root)}function h(e,n){var i=e.currentEntity;var a=false;r.Node.forEach(n,function(r){o(e.tree,r);t.Event.Tree.NodeRemoved.dispatch(e,r);r.tree=void 0;if(r===i)a=true});return a}function d(e){if(!e||!e.tree)return;if(e.parent===e){f(e.tree);return}var n=r.Node.isHidden(e);var i=e.index;var a=e.parent;var o=e.tree.context;r.Node.removeChild(a,e);t.Entity.nodeUpdated(a);var s=h(o,e);if(s&&!n){var u=false;for(var l=i;l>=0;l--){if(a.children[l]&&!r.Node.isHidden(a.children[l])){t.Command.Entity.SetCurrent.dispatch(o,a.children[l]);u=true;break}}if(!u){t.Command.Entity.SetCurrent.dispatch(o,a)}}if(e.transform.props.isBinding&&!a.children.length){d(e.parent)}}r.remove=d})(r=t.Tree||(t.Tree={}))})(t=e.Bootstrap||(e.Bootstrap={}))})(p||(p={}));/* 619 * Copyright (c) 2016 - now David Sehnal, licensed under Apache 2.0, See LICENSE file for more info. 620 */ 621var p;(function(e){var t;(function(e){var t;(function(t){"use strict";var r;(function(t){t.Null={};function r(e,t){return e&&e.type===t}t.is=r;function n(e,t){if(!t)return false;while(true){if(e===t)return true;e=e.parent;if(!e||e===e.parent)return false}}t.hasAncestor=n;function i(e,t){if(!e)return void 0;var n=e.parent;while(true){if(r(n,t))return n;n=n.parent;if(n.parent===n)return void 0}}t.findAncestor=i;function a(e,t){if(!e)return void 0;var r=e;while(true){if(t.indexOf(r.type)>=0)return r;r=r.parent;if(r.parent===r){return t.indexOf(r.type)>=0?r:void 0}}}t.findClosestNodeOfType=a;var o=0;function s(){return o++}t.createId=s;function u(e){e.version++;return e}t.update=u;function l(t,r){var n=e.Utils.merge(t.props,r);if(n===t.props)return t;return u(t)}t.withProps=l;function c(t,r){var n=e.Utils.merge(t.state,r);if(n===t.state)return t;t.state=n;return u(t)}t.withState=c;function f(e,t){t.index=e.children.length;e.children.push(t);return u(e)}t.addChild=f;function h(e,t){var r=e.children;for(var n=t.index,i=r.length-1;n<i;n++){var a=r[n+1];a.index--;r[n]=a}r.pop();return u(e)}t.removeChild=h;function d(e,t,r){if(!r)return h(e,t);r.index=t.index;e.children[r.index]=r;return u(e)}t.replaceChild=d;function p(e,t){for(var r=0,n=e.children;r<n.length;r++){var i=n[r];p(i,t)}t(e)}t.forEach=p;function m(e,t){t(e);for(var r=0,n=e.children;r<n.length;r++){var i=n[r];p(i,t)}}t.forEachPreorder=m;function v(e){var t=[];p(e,function(e){return t.push(e)});return t}t.collect=v;function y(e){if(e.isHidden)return true;var t=e.parent;if(!t)return e.isHidden;while(t.parent!==t){if(t.isHidden){return true}t=t.parent;if(!t)return false}return false}t.isHidden=y})(r=t.Node||(t.Node={}))})(t=e.Tree||(e.Tree={}))})(t=e.Bootstrap||(e.Bootstrap={}))})(p||(p={}));/* 622 * Copyright (c) 2016 - now David Sehnal, licensed under Apache 2.0, See LICENSE file for more info. 623 */ 624var p;(function(e){var t;(function(t){var r;(function(t){"use strict";var r;(function(r){function n(e,t){return i(e)(t)}r.select=n;function i(e){var t=e?e:r.root();var n;if(o(t))n=t.compile();else if(a(t))n=r.byValue(t).compile();else if(s(t))n=t;else n=r.byRef(t).compile();return n}r.compile=i;function a(e){return e.ref!==void 0}function o(e){return e.compile!==void 0}function s(e){return typeof e==="function"}var u;(function(e){e.BuilderPrototype={};function t(t,r){e.BuilderPrototype[t]=function(){var e=[];for(var t=0;t<arguments.length;t++){e[t]=arguments[t]}return r.call.apply(r,[void 0,this].concat(e))}}e.registerModifier=t})(u=r.Helpers||(r.Helpers={}));function l(e){return Object.create(u.BuilderPrototype,{compile:{writable:false,configurable:false,value:e}})}function c(){return l(function(){return function(e){return[e.root]}})}r.root=c;function f(){var e=[];for(var t=0;t<arguments.length;t++){e[t]=arguments[t]}return l(function(){return function(t){var r=[];for(var n=0,i=e;n<i.length;n++){var a=i[n];var o=t.refs.get(a);if(!o)continue;for(var s=0,u=o;s<u.length;s++){var l=u[s];
624r.push(l)}}return r}})}r.byRef=f;function h(){var e=[];for(var t=0;t<arguments.length;t++){e[t]=arguments[t]}return l(function(){return function(t){return e}})}r.byValue=h;u.registerModifier("flatMap",d);function d(e,t){var r=i(e);return l(function(){return function(e){var n=[];for(var i=0,a=r(e);i<a.length;i++){var o=a[i];for(var s=0,u=t(o);s<u.length;s++){var l=u[s];n.push(l)}}return n}})}r.flatMap=d;u.registerModifier("mapEntity",p);function p(e,t){var r=i(e);return l(function(){return function(e){var n=[];for(var i=0,a=r(e);i<a.length;i++){var o=a[i];var s=t(o);if(s)n.push(s)}return n}})}r.mapEntity=p;u.registerModifier("unique",m);function m(t){var r=i(t);return l(function(){return function(t){var n=e.Core.Utils.FastSet.create();var i=[];for(var a=0,o=r(t);a<o.length;a++){var s=o[a];if(!n.has(s.id)){n.add(s.id);i.push(s)}}return i}})}r.unique=m;u.registerModifier("first",v);function v(e){var t=i(e);return l(function(){return function(e){return[t(e)[0]]}})}r.first=v;u.registerModifier("filter",y);function y(e,t){return d(e,function(e){return t(e)?[e]:[]})}r.filter=y;u.registerModifier("subtree",g);function g(e){return d(e,function(e){return t.Node.collect(e)})}r.subtree=g;u.registerModifier("children",b);function b(e){return d(e,function(e){return e.children})}r.children=b;u.registerModifier("ofType",x);function x(e,t){return y(e,function(e){return e.type===t})}r.ofType=x;u.registerModifier("ancestorOfType",_);function _(e,r){return m(p(e,function(e){return t.Node.findAncestor(e,r)}))}r.ancestorOfType=_;u.registerModifier("parent",w);function w(e){return m(p(e,function(e){return e.parent}))}r.parent=w})(r=t.Selection||(t.Selection={}))})(r=t.Tree||(t.Tree={}))})(t=e.Bootstrap||(e.Bootstrap={}))})(p||(p={}));/* 625 * Copyright (c) 2016 - now David Sehnal, licensed under Apache 2.0, See LICENSE file for more info. 626 */ 627var p;(function(e){var t;(function(t){var r;(function(r){"use strict";var n;(function(n){var i=function(){function e(e,t,r){this.info=e;this.transform=t;this.updater=r}e.prototype.getTarget=function(e){var t=this.info;return!t.from.length?e:r.Node.findClosestNodeOfType(e,t.from)};e.prototype.checkTypes=function(e,t){if(t.transformer!==this){return"The transform is calling an invalid transformer (got "+t.transformer.info.name+", expected "+this.info.name+")"}var r=this.info;if(r.from.length&&r.from.indexOf(e.type)<0){return"Transform ("+r.name+"): type error, expected '"+r.from.map(function(e){return e.info.name}).join("/")+"', got '"+e.type.info.name+"'."}return void 0};e.prototype.validateParams=function(e){var t=this.info;if(t.validateParams){var r=t.validateParams(e.params);if(r&&r.length>0){return"Invalid params: "+r.join(", ")+"."}}return void 0};e.prototype.validate=function(e,r){var n=this.info;if(!e)return t.Task.reject(n.name,"Normal","Could not find a suitable node to apply the transformer to.");var i=this.checkTypes(e,r);if(i)return t.Task.reject(n.name,"Normal",i);var a=this.validateParams(r);if(a)return t.Task.reject(n.name,"Normal",a);return void 0};e.prototype.apply=function(e,r,n){if(this.info.isComposed)return this.transform(e,r,n);var i=this.getTarget(r);var a=this.validate(i,n);if(a)return a;t.Event.Tree.TransformerApply.dispatch(e,{a:i,t:n});return this.transform(e,i,n)};e.prototype.update=function(e,r,n){var i=r.parent;if(this.info.isComposed&&!this.updater)return this.transform(e,i,n);if(this.updater){var a=this.validateParams(n);if(a)return t.Task.reject(this.info.name,"Normal",a);var o=this.updater(e,r,n);if(o)return o}t.Event.Tree.TransformerApply.dispatch(e,{a:r.parent,t:n});return this.transform(e,i,n)};e.prototype.create=function(e,t){return r.Transform.create(e,t?t:{},this)};return e}();function a(e,t,r){return new i(e,t,r)}n.create=a;function o(e,t,r,n){return a({id:e,name:e,description:"",from:t,to:r,validateParams:function(){return void 0},defaultParams:function(){return{}}},n)}n.internal=o;function s(e,t,r,n,i){try{n(t)}finally{if(i){if(typeof i==="string"){r.logger.error(i)}else{setTimeout(function(){return i.call(null,r,e,t)},0)}}}}function u(e,t,n,i,a,o){return m(this,void 0,void 0,function(){var s,u;return v(this,function(l){switch(l.label){case 0:s=false;l.label=1;case 1:l.trys.push([1,3,,4]);return[4,r.Transform.apply(t,e.action).run()];case 2:l.sent();try{n(r.Node.Null)}finally{if(a){if(typeof a==="string"){if(!s)t.logger.message(a)}else{setTimeout(function(){return a.call(null,t,e.context)},0)}}}return[3,4];case 3:u=l.sent();s=true;try{i(u)}finally{if(o){if(typeof o==="string"){t.logger.error(o)}else{setTimeout(function(){return o.call(null,t,e.context,u)},0)}}}return[3,4];case 4:return[2]}})})}function l(r,n,i,o){return a(r,function(a,s,l){return t.Task.create(r.name,"Backgroun
627d",function(t){return new e.Promise(function(e,t){try{var r=n(a,s,l);u({action:r,context:void 0},a,e,t,i,o)}catch(e){t(e)}})})})}n.action=l;function c(r,n,i,o){return a(r,function(a,l,c){return t.Task.create(r.name,"Background",function(r){return new e.Promise(function(e,r){try{var f=n(a,l,c);if(t.Task.isPromise(f)){f.then(function(t){return u(t,a,e,r,i,o)}).catch(function(e){return s(void 0,e,a,r,o)})}else{u(f,a,e,r,i,o)}}catch(e){r(e)}})})})}n.actionWithContext=c})(n=r.Transformer||(r.Transformer={}))})(r=t.Tree||(t.Tree={}))})(t=e.Bootstrap||(e.Bootstrap={}))})(p||(p={}));/* 628 * Copyright (c) 2016 - now David Sehnal, licensed under Apache 2.0, See LICENSE file for more info. 629 */ 630var p;(function(e){var t;(function(t){var r;(function(r){"use strict";var n;(function(n){var i=function(){function n(e,t,r){this.params=e;this.props=t;this.transformer=r;this.isUpdate=false}n.prototype.resolveAdd=function(e,t){if(t===r.Node.Null){return t}t.ref=this.props.ref;if(this.props.isHidden)t.isHidden=true;if(!t.tree){t.parent=e;r.add(t)}return t};n.prototype.resolveUpdate=function(e,t,n){if(n===r.Node.Null){return n}var i=t.parent;n.ref=this.props.ref;n.parent=i;n.tag=t.tag;n.state=t.state;if(this.props.isHidden)n.isHidden=true;r.update(e.tree,t,n);return n};n.prototype.apply=function(r,n){var i=this;return e.Core.computation(function(a){return new e.Promise(function(e,a){return m(i,void 0,void 0,function(){var i=this;return v(this,function(o){t.Event.Tree.TransformStarted.dispatch(r,this);this.transformer.apply(r,n,this).run(r).then(function(a){e(i.resolveAdd(n,a));t.Event.Tree.TransformFinished.dispatch(r,{transform:i})}).catch(function(e){a(e);t.Event.Tree.TransformFinished.dispatch(r,{transform:i,error:e})});return[2]})})})})};n.prototype.update=function(r,n){var i=this;return e.Core.computation(function(a){return new e.Promise(function(e,a){i.isUpdate=true;i.props.ref=n.transform.props.ref;t.Event.Tree.TransformStarted.dispatch(r,i);if(n.transform.props.isBinding)i.props.isBinding=true;i.transformer.update(r,n,i).run(r).then(function(a){e(i.resolveUpdate(r,n,a));t.Event.Tree.TransformFinished.dispatch(r,{transform:i})}).catch(function(e){a(e);t.Event.Tree.TransformFinished.dispatch(r,{transform:i,error:e})})})})};return n}();function a(e,r,n){var a=t.Utils.shallowClone(r);if(!a.ref)a.ref=t.Utils.generateUUID();return new i(e,a,n)}n.create=a;function o(e){return!!e.selector}function s(e){return!!e.compile}function u(t,r,n){var i=this;var a;try{if(o(r))a=[r];else if(s(r))a=r.compile();else a=r}catch(t){return e.Core.Computation.reject(t)}return e.Core.computation(function(){return m(i,void 0,void 0,function(){var e,r,i,o,s,u,l,c;return v(this,function(f){switch(f.label){case 0:e=0,r=a;f.label=1;case 1:if(!(e<r.length))return[3,8];i=r[e];o=t.select(i.selector);s=0,u=o;f.label=2;case 2:if(!(s<u.length))return[3,7];l=u[s];f.label=3;case 3:f.trys.push([3,5,,6]);return[4,(n?i.transform.update(t,l):i.transform.apply(t,l)).run()];case 4:f.sent();return[3,6];case 5:c=f.sent();return[3,6];case 6:s++;return[3,2];case 7:e++;return[3,1];case 8:return[2]}})})})}n.execute=u;function l(e,t){return u(e,t,false)}n.apply=l;function c(e,t){return u(e,t,true)}n.update=c})(n=r.Transform||(r.Transform={}))})(r=t.Tree||(t.Tree={}))})(t=e.Bootstrap||(e.Bootstrap={}))})(p||(p={}));/* 631 * Copyright (c) 2016 - now David Sehnal, licensed under Apache 2.0, See LICENSE file for more info. 632 */ 633var p;(function(e){var t;(function(e){var t;(function(e){var t;(function(e){"use strict";function t(){return new r.Impl(void 0,[])}e.build=t;var r;(function(e){var t=function(){function e(e,t){this.last=e;this.transforms=t}e.prototype.add=function(t,r,n,i){var a={selector:t,transform:r.create(n,i)};this.transforms.push(a);this.last=a;return new e(a,this.transforms)};e.prototype.then=function(t,r,n){if(!this.last)throw"Cannot 'then' on an empty builder";var i=t.create(r,n);var a={selector:this.last.transform.props.ref,transform:i};this.transforms.push(a);return new e(a,this.transforms)};e.prototype.compile=function(){return this.transforms};return e}();e.Impl=t})(r=e.Builder||(e.Builder={}))})(t=e.Transform||(e.Transform={}))})(t=e.Tree||(e.Tree={}))})(t=e.Bootstrap||(e.Bootstrap={}))})(p||(p={}));/* 634 * Copyright (c) 2016 - now David Sehnal, licensed under Apache 2.0, See LICENSE file for more info. 635 */ 636var p;(function(e){var t;(function(e){var t;(function(t){"use strict";var r;(function(e){e.empty={kind:0};function t(e,t){return{kind:1,source:e,elements:t}}e.selection=t})(r=t.Info||(t.Info={}));function n(t){if(t.kind===0||!t.source.tree)return true;if(t.source.type.info.typeClass===e.Entity.VisualClass&&t.source.type===e.Entity.Molecule.Visual){var r=e.Utils.Molecule.findModelOrSelection(t.source);if(r){if(!t.elements||!t.elements.length){return true}}}return false}
636t.isEmpty=n;function i(e){return e.kind===1&&!!e.source.tree}t.isSelection=i;function a(e,t){if(!e&&!t)return true;if(!e||!t)return false;if(e.kind!==t.kind)return false;if(e.kind===0)return true;if(e.source!==t.source)return false;var r=e.elements,n=t.elements;if(r.length!==n.length)return false;for(var i=0,a=r.length;i<a;i++){if(r[i]!==n[i])return false}return true}t.interactivityInfoEqual=a;function o(e,t){var r=e.elements,n=t.elements;if(r.length!==n.length)return false;for(var i=0,a=r.length;i<a;i++){if(r[i]!==n[i])return false}return true}t.interactivitySelectionElementsEqual=o})(t=e.Interactivity||(e.Interactivity={}))})(t=e.Bootstrap||(e.Bootstrap={}))})(p||(p={}));/* 637 * Copyright (c) 2016 - now David Sehnal, licensed under Apache 2.0, See LICENSE file for more info. 638 */ 639var p;(function(e){var t;(function(e){var t;(function(t){"use strict";var r=function(){function t(t){var r=this;this.context=t;this.providers=[];this.empty=[];e.Event.Visual.VisualHoverElement.getStream(t).subscribe(function(n){return e.Event.Interactivity.Highlight.dispatch(t,r.getInfo(n.data))})}t.prototype.addProvider=function(e){this.providers.push(e)};t.prototype.removeProvider=function(t){this.providers=this.providers.filter(function(e){return e!==t});e.Event.Interactivity.Highlight.dispatch(this.context,[])};t.prototype.getInfo=function(e){if(!e)return this.empty;var t=[];for(var r=0,n=this.providers;r<n.length;r++){var i=n[r];var a=i.call(null,e);if(a)t.push(a)}return t};return t}();t.HighlightManager=r})(t=e.Interactivity||(e.Interactivity={}))})(t=e.Bootstrap||(e.Bootstrap={}))})(p||(p={}));/* 640 * Copyright (c) 2016 - now David Sehnal, licensed under Apache 2.0, See LICENSE file for more info. 641 */ 642var p;(function(e){var t;(function(e){var t;(function(t){var r;(function(r){"use strict";function n(e,t,r){var n=t.structure;var i=n.data.atoms,a=i.residueIndex,o=i.chainIndex,s=i.entityIndex,u=i.name,l=i.authName,c=i.id,f=i.occupancy,h=i.tempFactor,d=i.elementSymbol,p=i.altLoc;var m=n.positions,v=m.x,y=m.y,g=m.z;var b=n.data.residues,x=b.name,_=b.authName,w=b.seqNumber,C=b.authSeqNumber,E=b.insCode,S=b.isHet;var T=n.data.chains,M=T.asymId,A=T.authAsymId;var P=n.data.entities.entityId;var R=-1,k=-1,I=-1,D=-1;var B,L,F,V;var O=function(){return B={index:k,entityId:P[k]}};var U=function(){return L={index:I,asymId:M[I],authAsymId:A[I],entity:B}};var N=function(){return F={index:D,name:x[D],authName:_[D],seqNumber:w[D],authSeqNumber:C[D],insCode:E[D],isHet:S[D],chain:L}};var z=function(){return V={index:R,id:c[R],name:u[R],authName:l[R],elementSymbol:d[R],occupancy:f[R],tempFactor:h[R],x:v[R],y:y[R],z:g[R],altLoc:p[R],residue:F}};var H=[];var j=[];var G=[];var W=[];for(var q=0;q<r.length;q++){R=r[q];if(!t.hasAtom(R))continue;if(k!==s[R]){k=s[R];H.push(O())}if(I!==o[R]){I=o[R];j.push(U())}if(D!==a[R]){D=a[R];G.push(N())}W.push(z())}return{modelRef:e.ref,moleculeId:n.id,modelId:n.modelId,atoms:W,residues:G,chains:j,entities:H}}r.transformMoleculeAtomIndices=n;function i(r){if(t.isEmpty(r))return void 0;var i=e.Utils.Molecule.findModelOrSelection(r.source);if(!i)return void 0;var a=e.Utils.Molecule.findQueryContext(i);var o=e.Utils.Molecule.findModel(i);if(!a||!o)return void 0;return n(o,a,r.elements)}r.transformInteraction=i;function a(t){var r=[];if(t.occupancy!==1){r.push("occupancy "+e.Utils.round(t.occupancy,2))}if(t.altLoc){r.push("alt. loc "+t.altLoc)}if(!r.length)return"";return" <small>["+r.join(", ")+"]</small>"}function o(t){return"<span><b>"+t.name+" "+t.elementSymbol+" "+t.id+"</b>"+a(t)+" at ("+e.Utils.round(t.x,1)+", "+e.Utils.round(t.y,1)+", "+e.Utils.round(t.z,1)+")</span>"}function s(e){return"<span>"+e.name+" "+e.elementSymbol+" "+e.id+a(e)+"</span>"}function u(e){return"<span>"+e.authName+" "+e.chain.authAsymId+" "+e.authSeqNumber+(e.insCode!==null?" i: "+e.insCode:"")+"</span>"}function l(e){if(e.modelId==="1"){return"<span><small>["+e.moleculeId+"]</small></span>"}return"<span><small>["+e.moleculeId+":"+e.modelId+"]</small></span>"}function c(e){if(!e||!e.atoms.length)return"";if(e.atoms.length===1){return"<span>"+o(e.atoms[0])+" on <b><small>"+u(e.residues[0])+"</small></b> "+l(e)+"</span>"}else if(e.residues.length===1){return"<span><b>"+u(e.residues[0])+"</b> "+l(e)+"</span>"}else{return"<span><small>"+e.atoms.length+" atoms on</small> <b>"+e.residues.length+" residues</b> "+l(e)+"</span>"}}r.formatInfo=c;function f(e){if(!e||!e.atoms.length)return"";if(e.atoms.length===1){return"<span><b>"+s(e.atoms[0])+"</b> "+l(e)+"</span>"}else if(e.residues.length===1){return"<span><b>"+u(e.residues[0])+"</b> "+l(e)+"</span>"}else{return"<span><b>"+e.residues.length+" residues</b> "+l(e)+"</span>"}}r.formatInfoShort=f;function h(r){if(t.isEmpty(r))return false;if(r.source.type.info.typeClass===e.Entity.VisualClass&&r.source.type!==e.Entity.Molecule.Visual)return false;var n=e.Utils.Molecule.findModelOrSelection(r.source);if(!n)return false;return true}r.isMoleculeModelInteractivity=h})(r=t.Molecule||(t.Molecule={}))})(t=e.Interactivity||(e.Interactivity={}))})(t=e.Bootstrap||(e.Bootstrap={}))})(p||(p={}));/* 643 * Copyright (c) 2016 - now David Sehnal, licensed under Apache 2.0, See LICENSE file for more info. 644 */ 645var p;(function(e){var t;(function(t){var r;(function(r){"use strict";var n=function(){function e(e,r){var n=this;this.context=e;this.scene=r;this.entries=new Map;this.originalThemes=new Map;this.lastParent=NaN;t.Event.Tree.NodeAdded.getStream(e).subscribe(function(e){if(!t.Entity.isClass(e.data,t.Entity.VisualClass))return;n.add(e.data)});t.Event.Tree.NodeRemoved.getStream(e).subscribe(function(e){if(!t.Entity.isClass(e.data,t.Entity.VisualClass))return;n.remove(e.data)});t.Event.Tree.NodeUpdated.getStream(e).subscribe(function(e){if(!t.Entity.isVisual(e.data))return;var r=n.entries.get(e.data.id);if(!r)return;var i=r.visual.state.visibility!==2;if(r.visual.props.model.getVisibility()!==i){r.visual.props.model.updateVisibility(i)}});t.Command.Visual.UpdateBasicTheme.getStream(e).subscribe(function(e){if(!n.entries.get(e.data.visual.id)||!t.Entity.isVisual(e.data.visual))return;var r=e.data.visual;if(e.data.theme.isSticky){n.originalThemes.set(r.id,e.data.theme)}else if(!n.originalThemes.get(r.id)){n.originalThemes.set(r.id,r.props.model.theme)}r.props.model.applyTheme(e.data.theme)});t.Command.Molecule.Highlight.getStream(e).subscribe(function(e){return n.highlightMoleculeModel(e.data)});t.Command.Visual.ResetTheme.getStream(e).subscribe(function(e){return n.resetThemesAndHighlight(e.data&&e.data.selection)})}e.prototype.isEmpty=function(){return!this.entries.size};e.prototype.add=function(e){if(this.entries.has(e.id)||!e.props.model)return false;var t=e.parent.id;this.entries.set(e.id,{visual:e,parentId:t});this.scene.scene.models.add(e.props.model,this.entries.size===1&&this.lastParent!==t);var r=e.state.visibility!==2;if(e.props.model.getVisibility()!==r){e.props.model.updateVisibility(r)}e.props.model.tag=e;return true};e.prototype.remove=function(e){if(!this.entries.has(e.id))return false;this.lastParent=this.entries.get(e.id).parentId;this.entries.delete(e.id);this.originalThemes.delete(e.id);this.scene.scene.models.removeAndDispose(e.props.model);e.props.model.tag=void 0;e.props.model=void 0;return true};e.prototype.get=function(e){return this.entries.get(e)};e.prototype.resetThemesAndHighlight=function(e){var r=this;
645if(!e){this.originalThemes.forEach(function(e,t){var n=r.entries.get(t).visual.props.model;if(!n.theme.isSticky){n.applyTheme(e);r.originalThemes.delete(t)}else{r.originalThemes.set(t,n.theme)}});this.entries.forEach(function(e){return e.visual.props.model.highlight(false)});this.scene.scene.forceRender();return}var n=this.context.select(e);for(var i=0,a=n;i<a.length;i++){var o=a[i];if(!t.Entity.isVisual(o)||!this.originalThemes.has(o.id))continue;var s=o;var u=this.originalThemes.get(s.id);var l=s.props.model;if(!l.theme.isSticky){l.applyTheme(u);this.originalThemes.delete(s.id)}else{this.originalThemes.set(s.id,l.theme)}l.highlight(false)}this.scene.scene.forceRender()};e.prototype.highlightMoleculeModel=function(e){var r=this;var n=t.Utils.Molecule.findModel(e.model);if(!n){console.warn("Highlight: Trying to highlight a non-molecule model entity, ignoring...");return}var i=[];this.context.select(t.Tree.Selection.byValue(e.model).subtree()).forEach(function(e){if(t.Entity.isVisual(e)&&r.entries.get(e.id))i.push(e)});if(!i.length)return;var a=t.Utils.Molecule.getModelAndIndicesFromQuery(n,e.query);if(!a||!a.indices.length)return;var o=e.isOn?3:4;for(var s=0,u=i;s<u.length;s++){var l=u[s];l.props.model.applySelection(a.indices,o)}};return e}();r.DisplayList=n;var i=function(){function r(r,i,a){var o=this;this.context=i;this._destroyed=false;this.cameraChanged=new t.Rx.Subject;this.cameraObserver=function(e){return o.cameraChanged.onNext(e)};this.models=new n(i,this);this.scene=new e.Visualization.Scene(r,a);this.scene.camera.observe(this.cameraObserver);this.scene.events.addEventListener("hover",function(e){return o.handleEvent(e,t.Event.Visual.VisualHoverElement)});this.scene.events.addEventListener("select",function(e){return o.handleEvent(e,t.Event.Visual.VisualSelectElement)});this.cameraChanged.throttle(1e3/30).subscribe(function(e){t.Event.Visual.CameraChanged.dispatch(o.context,e)});t.Command.Entity.Focus.getStream(i).subscribe(function(e){var r;if(e.data.length===1){var n=e.data[0];if(t.Entity.isMoleculeSelection(n)){o.focusMoleculeModelSelection(n)}else if(t.Entity.isClass(n,t.Entity.VisualClass)){o.scene.camera.focusOnModel(n.props.model)}}else{(r=o.scene.camera).focusOnModel.apply(r,e.data.filter(function(e){return t.Entity.isClass(e,t.Entity.VisualClass)}).map(function(e){return e.props.model}))}});t.Command.Entity.Highlight.getStream(i).subscribe(function(e){for(var r=0,n=e.data.entities;r<n.length;r++){var i=n[r];if(!t.Entity.isClass(i,t.Entity.VisualClass)||!i.props.model)continue;i.props.model.highlight(e.data.isOn)}});t.Command.Visual.ResetScene.getStream(i).subscribe(function(e){return o.resetScene()});t.Command.Molecule.FocusQuery.getStream(i).subscribe(function(e){return o.focusMoleculeModelOnQuery(e.data)})}r.prototype.resetScene=function(){if(this._destroyed)return;t.Event.Visual.VisualSelectElement.dispatch(this.context,t.Interactivity.Info.empty);this.models.resetThemesAndHighlight();this.scene.camera.reset()};Object.defineProperty(r.prototype,"camera",{get:function(){return this.scene.camera},enumerable:true,configurable:true});r.prototype.destroy=function(){if(this._destroyed)return;this.scene.camera.stopObserving(this.cameraObserver);this.scene.destroy();this.scene=void 0;this._destroyed=true};r.prototype.handleEvent=function(e,r){var n=e.data;if(n&&n.model&&n.elements){r.dispatch(this.context,t.Interactivity.Info.selection(n.model.tag,n.elements))}else{r.dispatch(this.context,t.Interactivity.Info.empty)}};r.prototype.focusMoleculeModelSelection=function(r){if(!t.Tree.Node.is(r,t.Entity.Molecule.Selection)){console.warn("Focus: Trying to focus on non-molecule selection, ignoring...");return}var n=t.Utils.Molecule.findModel(r);if(!n){console.warn("Focus: Molecule model for selection not found, ignoring...");return}var i=e.Core.Geometry.LinearAlgebra.Vector3.zero();var a=t.Utils.Molecule.getCentroidAndRadius(n.props.model,r.props.indices,i);this.scene.camera.focusOnPoint(e.Core.Geometry.LinearAlgebra.Vector3.toObj(i),a)};r.prototype.focusMoleculeModelOnQuery=function(r){var n=t.Utils.Molecule.getModelAndIndicesFromQuery(r.model,r.query);if(!n||!n.indices.length)return;var i=e.Core.Geometry.LinearAlgebra.Vector3.zero();var a=t.Utils.Molecule.getCentroidAndRadius(n.model.props.model,n.indices,i);this.scene.camera.focusOnPoint(e.Core.Geometry.LinearAlgebra.Vector3.toObj(i),a)};return r}();r.SceneWrapper=i})(r=t.Visualization||(t.Visualization={}))})(t=e.Bootstrap||(e.Bootstrap={}))})(p||(p={}));/* 646 * Copyright (c) 2016 - now David Sehnal, licensed under Apache 2.0, See LICENSE file for more info. 647 */ 648var p;(function(e){var t;(function(t){var r;(function(t){"use strict";var r;(function(e){function t(e){return!e.taskType?"Normal":e.taskType}e.getTaskType=t;function r(e){return e}e.create=r})(r=t.Style||(t.Style={}));var n;(function(t){function r(t){var r=e.Core.Utils.FastMap.create();
648if(t.colors)t.colors.forEach(function(e,t){return r.set(t,e)});var n=e.Core.Utils.FastMap.create();if(t.variables)t.variables.forEach(function(e,t){return n.set(t,e)});return{colors:r,variables:n,transparency:t.transparency,interactive:t.interactive,disableFog:t.disableFog,isSticky:true}}t.getProps=r})(n=t.Theme||(t.Theme={}))})(r=t.Visualization||(t.Visualization={}))})(t=e.Bootstrap||(e.Bootstrap={}))})(p||(p={}));/* 649 * Copyright (c) 2016 - now David Sehnal, licensed under Apache 2.0, See LICENSE file for more info. 650 */ 651var p;(function(e){var t;(function(t){var r;(function(r){var n;(function(r){"use strict";var n=e.Visualization;r.UniformBaseColors=t.Immutable.Map({Uniform:n.Theme.Default.UniformColor,Highlight:n.Theme.Default.HighlightColor,Selection:n.Theme.Default.SelectionColor});r.ModelVisualBaseColors=t.Immutable.Map({Bond:n.Molecule.Colors.DefaultBondColor,Highlight:n.Theme.Default.HighlightColor,Selection:n.Theme.Default.SelectionColor});function i(e,t){return function(r){return t[e[r]]}}function a(e,r){return function(a,o){var s=t.Utils.Molecule.findModel(a).props.model;var u=e(s);var l=n.Theme.createPalleteMapping(i(u.index,u.property),r);return n.Theme.createMapping(l,o)}}r.createPaletteThemeProvider=a;function o(e,r,a){return function(o,s){var u=t.Utils.Molecule.findModel(o);var l=u.tree&&u.tree.context;if(l){var c=l.entityCache.get(u,"theme-mapping-"+e);if(c){return n.Theme.createMapping(c,s)}}var f=u.props.model;var h=r(f);var d=n.Theme.createPalleteMapping(i(h.index,h.property),a);if(l)l.entityCache.set(o,"theme-mapping-"+e,d);return n.Theme.createMapping(d,s)}}r.createCachedPaletteThemeProvider=o;function s(r,i){if(i&&i.colors){if(!i.colors.get("Bond")&&i.colors.get("Uniform")){var a=i.colors;i=t.Utils.assign({},i);var o=e.Core.Utils.FastMap.create();i.colors=o;a.forEach(function(e,t){return o.set(t,e)});o.set("Bond",i.colors.get("Uniform"))}}return n.Theme.createUniform(i)}r.uniformThemeProvider=s;function u(e,r,a){return function(o,s){var u=t.Utils.Molecule.findModel(o);var l=u.props.model;var c=e(l);var f=n.Theme.createColorMapMapping(i(c.index,c.property),r,a);return n.Theme.createMapping(f,s)}}r.createColorMapThemeProvider=u;function l(e,r,a,o){return function(s,u){var l=t.Utils.Molecule.findModel(s);var c=l.tree&&l.tree.context;if(c){var f=c.entityCache.get(l,"theme-mapping-map-"+e);if(f){return n.Theme.createMapping(f,u)}}var h=l.props.model;var d=r(h);var p=n.Theme.createColorMapMapping(i(d.index,d.property),a,o);if(c)c.entityCache.set(s,"theme-mapping-map-"+e,p);return n.Theme.createMapping(p,u)}}r.createCachedColorMapThemeProvider=l;var c=function(){function e(e,t){var r=t.r,n=t.g,i=t.b;this.residueIndex=e.data.atoms.residueIndex;this.r=r;this.g=n;this.b=i}e.prototype.getProperty=function(e){return this.residueIndex[e]};e.prototype.setColor=function(e,t){t.r=this.r[e];t.g=this.g[e];t.b=this.b[e]};return e}();r.RainbowPalette=[n.Color.fromHex(13378048),n.Color.fromHex(13399808),n.Color.fromHex(13412864),n.Color.fromHex(52224),n.Color.fromHex(43724),n.Color.fromHex(204),n.Color.fromHex(8989394),n.Color.fromHex(12025059)];var f=t.Immutable.Map({Bond:n.Molecule.Colors.DefaultBondColor,Highlight:n.Color.fromHex(16777215),Selection:n.Color.fromHex(9863168)});function h(t,i,a){var o=t.data.residues.count;var s={r:new Float32Array(o),g:new Float32Array(o),b:new Float32Array(o)},u=s.r,l=s.g,c=s.b;var f=i(t);var h=f.count,d=f.residueStartIndex,p=f.residueEndIndex;var m=r.RainbowPalette.length-1;var v=n.Color.fromHex(0);var y=e.Core.Utils.FastMap.create();for(var g=0;g<h;g++){var b=a(f,g);var x=p[g]-d[g];if(y.has(b)){y.get(b).count+=x}else{y.set(b,{index:0,count:x})}}y.forEach(function(e){return e.count=Math.max(e.count-1,1)});for(var g=0;g<h;g++){var _=d[g],x=p[g]-_;var w=y.get(a(f,g));var C=w.count;for(var E=0;E<x;E++){var S=m*w.index/C;var T=Math.floor(S),M=Math.ceil(S);n.Color.interpolate(r.RainbowPalette[T],r.RainbowPalette[M],S-T,v);u[_+E]=v.r;l[_+E]=v.g;c[_+E]=v.b;w.index++}}return{r:u,g:l,b:c}}function d(e,r){return function(i,a){var o=t.Utils.Molecule.findModel(i).props.model;var s=h(o,e,r);var u=new c(o,s);return n.Theme.createMapping(u,a)}}var p;(function(e){e.Themes=[{name:"Chain ID",description:"Color the surface by Chain ID.",colors:r.ModelVisualBaseColors,provider:o("chain-id",function(e){return{index:e.data.atoms.residueIndex,property:e.data.residues.asymId}},n.Molecule.Colors.DefaultPallete)},{name:"Entity ID",description:"Color the surface by Entity ID.",colors:r.ModelVisualBaseColors,provider:a(function(e){return{index:e.data.atoms.residueIndex,property:e.data.residues.entityId}},n.Molecule.Colors.DefaultPallete)},{name:"Entity Type",description:"Color the surface by Entity Type.",colors:r.ModelVisualBaseColors,provider:a(function(e){return{index:e.data.atoms.entityIndex,property:e.data.entities.type}},n.Molecule.Colors.DefaultPallete)},{name:"Residue Name",description:"Color the surface by residue name.",colors:r.ModelVisualBaseColors,provider:a(function(e){return{index:e.data.atoms.residueIndex,property:e.data.residues.name}},n.Molecule.Colors.DefaultPallete)},{name:"Element Symbol",description:"Color the surface by atom elemnt symbol.",colors:r.ModelVisualBaseColors,provider:u(function(e){return{index:e.data.atoms.indices,property:e.data.atoms.elementSymbol}},n.Molecule.Colors.DefaultElementColorMap,n.Molecule.Colors.DefaultElementColor)},{name:"Rainbow (Chain)",description:"Color each chain using rainbow palette.",colors:f,provider:d(function(e){return e.data.chains},function(e,t){return e.asymId[t]+" "+e.entityId[t]})},{name:"Rainbow (Entity)",description:"Color each entity using rainbow palette.",colors:f,provider:d(function(e){return e.data.entities},function(e,t){return e.entityId[t]})},{name:"Uniform Color",description:"Same color everywhere.",colors:r.UniformBaseColors,provider:s}];e.CartoonThemeTemplate=e.Themes.filter(function(e){return e.name==="Chain ID"})[0];e.ElementSymbolThemeTemplate=e.Themes.filter(function(e){return e.name==="Element Symbol"})[0];e.SurfaceThemeTemplate=e.Themes.filter(function(e){return e.name==="Uniform Color"})[0];e.UniformThemeTemplate=e.Themes.filter(function(e){return e.name==="Uniform Color"})[0];e.RainbowEntityThemeTemplate=e.Themes.filter(function(e){return e.name==="Rainbow (Entity)"})[0]})(p=r.Default||(r.Default={}))})(n=r.Molecule||(r.Molecule={}))})(r=t.Visualization||(t.Visualization={}))})(t=e.Bootstrap||(e.Bootstrap={}))})(p||(p={}));/* 652 * Copyright (c) 2016 - now David Sehnal, licensed under Apache 2.0, See LICENSE file for more info. 653 */ 654var p;(function(e){var t;(function(e){var t;(function(e){var t;(function(e){"use strict";e.TypeDescriptions={Cartoons:{label:"Cartoon",shortLabel:"Cartoon"},Calpha:{label:"C-α Trace",shortLabel:"C-α"},BallsAndSticks:{label:"Balls and Sticks",shortLabel:"B'n'S"},VDWBalls:{label:"VDW Balls",shortLabel:"VDW"},Surface:{label:"Surface",shortLabel:"Surface"}};e.Types=["Cartoons","Calpha","BallsAndSticks","VDWBalls","Surface"];e.DetailTypes=["Automatic","Very Low","Low","Medium","High","Very High"];var t;(function(e){e.DetailParams={detail:"Automatic"};e.CartoonParams={showDirectionCone:false,detail:"Automatic"};e.BallsAndSticksParams={useVDW:true,vdwScaling:.22,atomRadius:.35,bondRadius:.09,hideHydrogens:false,customMaxBondLengths:void 0,detail:"Automatic"};e.SurfaceParams={probeRadius:.4,automaticDensity:true,density:1.1,smoothing:10,isWireframe:false};e.Transparency={alpha:1,writeDepth:false};e.ForType=function(){var t={Cartoons:{type:"Cartoons",params:e.CartoonParams,theme:{template:e.CartoonThemeTemplate,colors:e.CartoonThemeTemplate.colors,transparency:e.Transparency,interactive:true}},Calpha:{type:"Calpha",params:{detail:"Automatic"},theme:{template:e.CartoonThemeTemplate,colors:e.CartoonThemeTemplate.colors,transparency:e.Transparency,interactive:true}},BallsAndSticks:{type:"BallsAndSticks",params:e.BallsAndSticksParams,theme:{template:e.ElementSymbolThemeTemplate,colors:e.ElementSymbolThemeTemplate.colors,transparency:e.Transparency,interactive:true}},VDWBalls:{type:"VDWBalls",params:{detail:"Automatic"},theme:{template:e.ElementSymbolThemeTemplate,colors:e.ElementSymbolThemeTemplate.colors,transparency:e.Transparency,interactive:true}},Surface:{type:"Surface",params:e.SurfaceParams,theme:{template:e.SurfaceThemeTemplate,colors:e.SurfaceThemeTemplate.colors,transparency:{alpha:.33,writeDepth:false},interactive:true}}};var r=new Map;for(var n=0,i=Object.keys(t);n<i.length;n++){var a=i[n];r.set(a,t[a])}return r}()})(t=e.Default||(e.Default={}))})(t=e.Molecule||(e.Molecule={}))})(t=e.Visualization||(e.Visualization={}))})(t=e.Bootstrap||(e.Bootstrap={}))})(p||(p={}));/* 655 * Copyright (c) 2016 - now David Sehnal, licensed under Apache 2.0, See LICENSE file for more info. 656 */ 657var p;(function(e){var t;(function(t){var r;(function(r){var n;(function(n){"use strict";var i=e.Visualization;var a=e.Visualization.Molecule;function o(e,t){if(e==="Automatic"){if(t<250)return 5;if(t<1e3)return 4;if(t<75e3)return 3;
657if(t<25e4)return 2;if(t<6e5)return 1;return 0}var r=n.DetailTypes.indexOf(e)-1;return Math.max(r,0)}function s(r,n,i){if(!!r.automaticDensity){var a=t.Utils.Molecule.getBox(n,i,0),o=a.bottomLeft,s=a.topRight;var u=e.Core.Geometry.LinearAlgebra.Vector3.sub(s,s,o);var l=Math.pow(Math.pow(99,3)/(u[0]*u[1]*u[2]),1/3);if(l>1.2)return 1.2;if(l<.1)return.1;return l}if(r.density!==void 0)return+r.density;return 1}function u(e,t,r){return{tessalation:e,drawingType:t?a.Cartoons.CartoonsModelType.AlphaTrace:a.Cartoons.CartoonsModelType.Default,showDirectionCones:r}}function l(e,r){if(typeof r.vdwScaling==="undefined")r.vdwScaling=n.Default.BallsAndSticksParams.vdwScaling;if(typeof r.atomRadius==="undefined")r.atomRadius=n.Default.BallsAndSticksParams.atomRadius;if(!r.useVDW){return function(e){return function(){return e}}(r.atomRadius)}var i=t.Utils.vdwRadiusFromElementSymbol(e);return function(e,t){return function(r){return e*t(r)}}(r.vdwScaling,i)}function c(t,r,n){var i=void 0;if(n.customMaxBondLengths){var a=Object.getOwnPropertyNames(n.customMaxBondLengths);if(a.length>0)i=e.Core.Utils.FastMap.create();for(var o=0,s=a;o<s.length;o++){var u=s[o];i.set(u,n.customMaxBondLengths[u])}}return{tessalation:t,bondRadius:n.bondRadius,hideBonds:false,hideHydrogens:!!n.hideHydrogens,atomRadius:l(r,n),customMaxBondLengths:i}}function f(e,r){return{tessalation:e,bondRadius:0,hideBonds:true,atomRadius:t.Utils.vdwRadiusFromElementSymbol(r)}}function h(e,r,n){var s=t.Utils.Molecule.findModel(e).props.model;var l=t.Entity.isMoleculeModel(e)?e.props.model.data.atoms.indices:e.props.indices;if(!l.length)return void 0;var h=o(r.params.detail,l.length);switch(r.type){case"Cartoons":return a.Cartoons.Model.create(e,{model:s,atomIndices:l,theme:n,queryContext:t.Utils.Molecule.findQueryContext(e),params:u(h,false,r.params.showDirectionCone)});case"Calpha":return a.Cartoons.Model.create(e,{model:s,atomIndices:l,theme:n,queryContext:t.Utils.Molecule.findQueryContext(e),params:u(h,true,r.params.showDirectionCone)});case"BallsAndSticks":return i.Molecule.BallsAndSticks.Model.create(e,{model:s,atomIndices:l,theme:n,params:c(h,s,r.params)});case"VDWBalls":return i.Molecule.BallsAndSticks.Model.create(e,{model:s,atomIndices:l,theme:n,params:f(h,s)});default:return void 0}}function d(e,i,a){var o=this;return t.Task.create("Visual ("+e.props.label+")",r.Style.getTaskType(a),function(s){return m(o,void 0,void 0,function(){var o,u,l,c;return v(this,function(f){switch(f.label){case 0:o=n.TypeDescriptions[a.type].label;return[4,s.updateProgress("Creating "+o+"...")];case 1:f.sent();u=a.theme.template.provider(t.Utils.Molecule.findModel(e),r.Theme.getProps(a.theme));l=h(e,a,u);if(!l){throw"Invalid input parameters."}return[4,l.run(s)];case 2:c=f.sent();return[2,t.Entity.Molecule.Visual.create(i,{label:o,model:c,style:a,isSelectable:!a.isNotSelectable})]}})})})}function p(n,i,a){var o=this;return t.Task.create("Molecular Surface ("+n.props.label+")",r.Style.getTaskType(a),function(u){return m(o,void 0,void 0,function(){var o,l,c,f,h,d,p;return v(this,function(m){switch(m.label){case 0:o=t.Utils.Molecule.findModel(n).props.model;l=t.Entity.isMoleculeModel(n)?n.props.model.data.atoms.indices:n.props.indices;c=a.params;return[4,e.Core.Geometry.MolecularSurface.computeMolecularSurfaceAsync({positions:o.positions,atomIndices:l,parameters:{atomRadius:t.Utils.vdwRadiusFromElementSymbol(o),density:s(c,o,l),probeRadius:c.probeRadius,smoothingIterations:c.smoothing,interactive:true}}).run(u)];case 1:f=m.sent();h=a.theme.template.provider(t.Utils.Molecule.findModel(n),r.Theme.getProps(a.theme));return[4,u.updateProgress("Creating visual...")];case 2:m.sent();return[4,e.Visualization.Surface.Model.create(n,{surface:f.surface,theme:h,parameters:{isWireframe:a.params.isWireframe}}).run(u)];case 3:d=m.sent();p="Surface, "+t.Utils.round(c.probeRadius,2)+" â« probe";return[2,t.Entity.Molecule.Visual.create(i,{label:p,model:d,style:a,isSelectable:!a.isNotSelectable})]}})})})}function y(e,t,r){if(r.type==="Surface")return p(e,t,r);return d(e,t,r)}n.create=y})(n=r.Molecule||(r.Molecule={}))})(r=t.Visualization||(t.Visualization={}))})(t=e.Bootstrap||(e.Bootstrap={}))})(p||(p={}));/* 658 * Copyright (c) 2017 - now David Sehnal, licensed under Apache 2.0, See LICENSE file for more info. 659 */ 660var p;(function(e){var t;(function(t){var r;(function(r){var n;(function(n){"use strict";function i(n,i,a){var o=this;
660return t.Task.create("Labels","Background",function(s){return m(o,void 0,void 0,function(){var o,u,l,c;return v(this,function(f){switch(f.label){case 0:o=a.params;u=a.theme.template.provider(n,r.Theme.getProps(a.theme));l=t.Utils.Molecule.create3DLabelsParams(n,o,u);return[4,s.updateProgress("Creating labels...")];case 1:f.sent();return[4,e.Visualization.Labels.Model.create(n,l).run(s)];case 2:c=f.sent();return[2,t.Entity.Visual.Labels.create(i,{label:"Labels",model:c,style:a,isSelectable:false})]}})})})}n.createMoleculeLabels=i;function a(n,i,a){var o=this;return t.Task.create("Labels","Background",function(s){return m(o,void 0,void 0,function(){var o,u,l;return v(this,function(c){switch(c.label){case 0:return[4,s.updateProgress("Creating labels...")];case 1:c.sent();o=a.style.theme.template.provider(n,r.Theme.getProps(a.style.theme));u={positions:a.positions,sizes:a.sizes,labels:a.labels,options:a.options,theme:o};return[4,e.Visualization.Labels.Model.create(n,u).run(s)];case 2:l=c.sent();return[2,t.Entity.Visual.Labels.create(i,{label:"Labels",model:l,style:a.style,isSelectable:false})]}})})})}n.createGenericLabels=a})(n=r.Labels||(r.Labels={}))})(r=t.Visualization||(t.Visualization={}))})(t=e.Bootstrap||(e.Bootstrap={}))})(p||(p={}));/* 661 * Copyright (c) 2017 - now David Sehnal, licensed under Apache 2.0, See LICENSE file for more info. 662 */ 663var p;(function(e){var t;(function(t){var r;(function(r){var n;(function(r){"use strict";var n;(function(e){function r(e,r){return t.Utils.deepEqual(e.params,r.params)}e.moleculeHasOnlyThemeChanged=r;function n(e){return{type:"Labels",params:{kind:e.kind,labelsOptions:e.labelsOptions?e.labelsOptions:i.MoleculeLabels.params.labelsOptions},theme:e.theme?e.theme:i.MoleculeLabels.theme}}e.createMoleculeStyle=n})(n=r.Style||(r.Style={}));var i;(function(r){var n=e.Visualization;var i=t.Immutable.Map({Uniform:n.Color.fromHexString("#eaeaea"),Background:n.Color.fromHexString("#777777"),Outline:n.Color.fromHexString("#333333")});var a=t.Immutable.Map({xOffset:0,yOffset:0,zOffset:.6,sizeFactor:1.5,backgroundOpacity:0,outlineWidth:.1});function o(e,t){return n.Theme.createUniform(t)}var s=[{name:"Uniform Color",description:"Same color everywhere.",colors:i,variables:a,provider:o}];var u={alpha:1,writeDepth:false};r.Theme=s[0];r.MoleculeLabels={type:"Labels",params:{kind:"Residue-Full-Id",labelsOptions:n.Labels.DefaultLabelsOptions},theme:{template:r.Theme,colors:r.Theme.colors,variables:r.Theme.variables,transparency:u,interactive:false,disableFog:false}};r.GenericLabels={type:"Labels",params:n.Labels.DefaultLabelsOptions,theme:{template:r.Theme,colors:r.Theme.colors,variables:r.Theme.variables,transparency:u,interactive:false,disableFog:false}}})(i=r.Default||(r.Default={}))})(n=r.Labels||(r.Labels={}))})(r=t.Visualization||(t.Visualization={}))})(t=e.Bootstrap||(e.Bootstrap={}))})(p||(p={}));/* 664 * Copyright (c) 2016 - now David Sehnal, licensed under Apache 2.0, See LICENSE file for more info. 665 */ 666var p;(function(e){var t;(function(t){var r;(function(r){var n;(function(n){"use strict";var i=e.Core.Geometry;function a(t,r,n,i){var a=n[0]-r[0],o=n[1]-r[1],s=n[2]-r[2];var u=[r,[r[0]+a,r[1],r[2]],[r[0],r[1]+o,r[2]],[r[0],r[1],r[2]+s],[r[0]+a,r[1]+o,r[2]],[r[0]+a,r[1],r[2]+s],[r[0],r[1]+o,r[2]+s],[r[0]+a,r[1]+o,r[2]+s]].map(function(t){var r=(new e.Visualization.THREE.Vector3).fromArray(t).applyMatrix4(i);return[r.x,r.y,r.z]});var l=u[0].slice(),c=u[0].slice();for(var f=0,h=u;f<h.length;f++){var d=h[f];for(var p=0;p<3;p++){l[p]=Math.min(l[p],d[p]);c[p]=Math.max(c[p],d[p])}}var m=t.box,v=m.origin,y=m.dimensions,g=m.sampleCount;var b=[0,0,0],x=[0,0,0];for(var p=0;p<3;p++){var d=Math.floor(g[p]*(l[p]-v[p])/y[p]);b[p]=Math.min(Math.max(d,0),g[p]);d=Math.ceil(g[p]*(c[p]-v[p])/y[p]);x[p]=Math.min(Math.max(d,0),g[p])}return{bottomLeft:b,topRight:x}}function o(o,s,u){var l=this;var c=u.taskType==="Background"?o.props.label:"Density Surface ("+o.props.label+")";return t.Task.create(c,r.Style.getTaskType(u),function(c){return m(l,void 0,void 0,function(){var l,f,h,d,p,m,y,g,b,x,_,w,C,E,S,T,M,A,P,R,k,I;return v(this,function(v){switch(v.label){case 0:l=u.params;f=t.Tree.Node.findClosestNodeOfType(o,[t.Entity.Density.Data]);if(!f){throw"Cannot create density visual on "+o.props.label}h=f.props.data;
666d=h.spacegroup.basis;p=h.box,m=p.sampleCount,y=p.origin,g=p.dimensions;b=(new e.Visualization.THREE.Matrix4).makeScale(g[0]/m[0],g[1]/m[1],g[2]/m[2]);x=(new e.Visualization.THREE.Matrix4).makeTranslation(y[0],y[1],y[2]);_=(new e.Visualization.THREE.Matrix4).set(d.x[0],d.y[0],d.z[0],0,0,d.y[1],d.z[1],0,0,0,d.z[2],0,0,0,0,1);w=(new e.Visualization.THREE.Matrix4).getInverse(_);C=_.multiply(x).multiply(b);if(l.bottomLeft&&l.topRight){T=a(h,l.bottomLeft,l.topRight,w);E=T.bottomLeft;S=T.topRight}else{E=[0,0,0];S=h.box.sampleCount}if(!(E[0]-S[0])||!(E[1]-S[1])||!(E[2]-S[2])){throw{warn:true,message:"Empty box."}}M=l.isoValueType===void 0||l.isoValueType===n.IsoValueType.Sigma;A=M?h.valuesInfo.mean+h.valuesInfo.sigma*l.isoValue:l.isoValue;return[4,i.MarchingCubes.compute({isoLevel:A,scalarField:h.data,bottomLeft:E,topRight:S}).run(c)];case 1:P=v.sent();return[4,i.Surface.transform(P,C.elements).run(c)];case 2:P=v.sent();return[4,i.Surface.laplacianSmooth(P,l.smoothing,8).run(c)];case 3:P=v.sent();R=u.theme.template.provider(f,r.Theme.getProps(u.theme));return[4,c.updateProgress("Creating visual...")];case 4:v.sent();return[4,e.Visualization.Surface.Model.create(f,{surface:P,theme:R,parameters:{isWireframe:u.params.isWireframe}}).run(c)];case 5:k=v.sent();I="Surface, "+t.Utils.round(l.isoValue,2)+(M?" Ï":"");return[2,t.Entity.Density.Visual.create(s,{label:I,model:k,style:u,isSelectable:!u.isNotSelectable})]}})})})}n.create=o})(n=r.Density||(r.Density={}))})(r=t.Visualization||(t.Visualization={}))})(t=e.Bootstrap||(e.Bootstrap={}))})(p||(p={}));/* 667 * Copyright (c) 2016 - now David Sehnal, licensed under Apache 2.0, See LICENSE file for more info. 668 */ 669var p;(function(e){var t;(function(t){var r;(function(r){var n;(function(r){"use strict";var n;(function(e){e[e["Sigma"]=0]="Sigma";e[e["Absolute"]=1]="Absolute"})(n=r.IsoValueType||(r.IsoValueType={}));function i(e,t){return e.bottomLeft===t.bottomLeft&&t.topRight===t.topRight&&e.smoothing===t.smoothing&&e.isWireframe===t.isWireframe}r.areNonIsoParamsSame=i;var a;(function(e){function t(e){var t=o.Theme.colors.set("Uniform",e.color);return{type:"Density",taskType:e.taskType,params:{isoValue:e.isoValue,isoValueType:e.isoValueType,smoothing:1,isWireframe:!!e.isWireframe},theme:{template:o.Theme,colors:t,transparency:e.transparency?e.transparency:o.Transparency,interactive:false,disableFog:!!e.disableFog}}}e.create=t})(a=r.Style||(r.Style={}));var o;(function(r){r.Params={isoValue:0,isoValueType:n.Sigma,smoothing:1,isWireframe:false};var i=e.Visualization;var a=t.Immutable.Map({Uniform:i.Theme.Default.UniformColor,Highlight:i.Theme.Default.HighlightColor,Selection:i.Theme.Default.SelectionColor});function o(e,t){return i.Theme.createUniform(t)}r.Themes=[{name:"Uniform Color",description:"Same color everywhere.",colors:a,provider:o}];r.Transparency={alpha:1,writeDepth:false};r.Theme=r.Themes[0];r.Style={type:"Density",params:r.Params,theme:{template:r.Theme,colors:r.Theme.colors,transparency:r.Transparency,interactive:false,disableFog:false}}})(o=r.Default||(r.Default={}))})(n=r.Density||(r.Density={}))})(r=t.Visualization||(t.Visualization={}))})(t=e.Bootstrap||(e.Bootstrap={}))})(p||(p={}));/* 670 * Copyright (c) 2016 - now David Sehnal, licensed under Apache 2.0, See LICENSE file for more info. 671 */ 672var p;(function(e){var t;(function(e){"use strict";var t;(function(t){function r(e,t){return e.type.info.typeClass===t}t.isClass=r;function n(e,t){return e.info.typeClass===t}t.isTypeClass=n;t.RootClass="Root";t.GroupClass="Group";t.DataClass="Data";t.ObjectClass="Object";t.VisualClass="Visual";t.SelectionClass="Selection";t.ActionClass="Action";t.BehaviourClass="Behaviour";var i=function(){function t(t,r,n){this.id=t;this.info=e.Utils.assign({},r,{traits:n})}t.prototype.create=function(t,r){var n={id:e.Tree.Node.createId(),version:0,index:0,ref:"undefined",tag:void 0,tree:void 0,props:r,state:{isCollapsed:false,visibility:0},isHidden:false,transform:t,parent:void 0,children:[],type:this};return e.Tree.Node.update(n)};return t}();function a(t,r){return new i(e.Utils.generateUUID(),t,r?r:{})}t.create=a})(t=e.Entity||(e.Entity={}))})(t=e.Bootstrap||(e.Bootstrap={}))})(p||(p={}));/* 673 * Copyright (c) 2016 - now David Sehnal, licensed under Apache 2.0, See LICENSE file for more info. 674 */ 675var p;(function(e){var t;(function(e){var t;(function(t){"use strict";function r(t){if(!t.tree)return;e.Event.Tree.NodeUpdated.dispatch(t.tree.context,t);if(t.tree.context.currentEntity===t){e.Event.Entity.CurrentChanged.dispatch(t.tree.context,t)}}t.nodeUpdated=r;function n(t){var n={isCollapsed:!t.state.isCollapsed};e.Tree.Node.withState(t,n);r(t)}t.toggleExpanded=n;function i(t){var n=t.tree.context.currentEntity;if(n===t||t&&t.isHidden){return}var i=t.parent;while(i.parent!==i){if(i.isHidden){return}i=i.parent}t.tree.context.currentEntity=t;if(n){e.Tree.Node.update(n);r(n)}if(t){e.Tree.Node.update(t);r(t)}e.Event.Entity.CurrentChanged.dispatch(t.tree.context,t);if(n)e.Tree.updatePath(n);e.Tree.updatePath(t.parent)}t.setCurrent=i;function a(t){if(!t)return;var n=0;var i=0;for(var o=0,s=t.children;o<s.length;o++){var u=s[o];var l=u.state.visibility;if(l===0)n++;else if(l===2)i++}var c;if(n===t.children.length)c=0;else if(i===t.children.length)c=2;else c=1;if(c!==t.state.visibility){var l={visibility:c}
675;e.Tree.Node.withState(t,l);r(t)}if(t.parent!==t)a(t.parent)}t.updateVisibilityState=a;function o(t,n){if(!t)return;var i=n?0:2;e.Tree.Node.forEach(t,function(t){var n=t.state.visibility;if(n!==i){var a={visibility:i};e.Tree.Node.withState(t,a);r(t)}});a(t.parent)}t.setVisibility=o})(t=e.Entity||(e.Entity={}))})(t=e.Bootstrap||(e.Bootstrap={}))})(p||(p={}));/* 676 * Copyright (c) 2016 - now David Sehnal, licensed under Apache 2.0, See LICENSE file for more info. 677 */ 678var p;(function(e){var t;(function(e){var t;(function(t){"use strict";function r(e){return e&&e.type===u.Molecule}t.isMolecule=r;function n(e){return e&&e.type===u.Model}t.isMoleculeModel=n;function i(e){return e&&e.type===u.Selection}t.isMoleculeSelection=i;function a(e){return e&&e.type.info.typeClass===t.VisualClass}t.isVisual=a;t.RootTransform=e.Tree.Transform.create({},{},void 0);t.Root=t.create({name:"Root",typeClass:"Root",shortName:"R",description:"Where everything begins."});t.Group=t.create({name:"Group",typeClass:"Group",shortName:"G",description:"A group on entities."});t.Action=t.create({name:"Action",typeClass:"Action",shortName:"A",description:"Represents an action performed on the entity tree."});var o;(function(e){e.Types=["String","Binary"];e.String=t.create({name:"String Data",typeClass:"Data",shortName:"S_D",description:"A string."});e.Binary=t.create({name:"Binary Data",typeClass:"Data",shortName:"B_D",description:"A binary blob."});e.CifDictionary=t.create({name:"Cif Dictionary",typeClass:"Data",shortName:"CD",description:"Represents parsed CIF data."});e.Json=t.create({name:"JSON Data",typeClass:"Data",shortName:"JS_D",description:"Represents JSON data."})})(o=t.Data||(t.Data={}));var s;(function(e){e.Surface=t.create({name:"Surface Visual",typeClass:"Visual",shortName:"V_S",description:"A surface visual."},{isFocusable:true});e.Labels=t.create({name:"Labels Visual",typeClass:"Visual",shortName:"V_L",description:"3D labels."},{isFocusable:false})})(s=t.Visual||(t.Visual={}));var u;(function(e){e.Molecule=t.create({name:"Molecule",typeClass:"Object",shortName:"M",description:"A molecule that might contain one or more models."});e.Model=t.create({name:"Molecule Model",typeClass:"Object",shortName:"M_M",description:"A model of a molecule."});e.Selection=t.create({name:"Molecule Model Selection",typeClass:"Selection",shortName:"S_M",description:"A selection of atoms."},{isFocusable:true});e.Visual=t.create({name:"Molecule Visual",typeClass:"Visual",shortName:"V_M",description:"A visual of a molecule."},{isFocusable:true});var r;(function(e){e.Behaviour=t.create({name:"Coordinate Streaming",typeClass:"Behaviour",shortName:"CS",description:"Behaviour that downloads surrounding residues when an atom or residue is selected."})})(r=e.CoordinateStreaming||(e.CoordinateStreaming={}))})(u=t.Molecule||(t.Molecule={}));var l;(function(e){e.Data=t.create({name:"Density Data",typeClass:"Object",shortName:"DD",description:"Density data."});e.Visual=t.create({name:"Density Visual",typeClass:"Visual",shortName:"V_DD",description:"A visual of density data."},{isFocusable:true});e.InteractiveSurface=t.create({name:"Interactive Surface",typeClass:"Behaviour",shortName:"B_IS",description:"Behaviour that creates an interactive surface when an atom or residue is selected."})})(l=t.Density||(t.Density={}))})(t=e.Entity||(e.Entity={}))})(t=e.Bootstrap||(e.Bootstrap={}))})(p||(p={}));/* 679 * Copyright (c) 2016 - now David Sehnal, licensed under Apache 2.0, See LICENSE file for more info. 680 */ 681var p;(function(e){var t;(function(t){var r;(function(r){"use strict";var n=function(){function r(r){var n=this;this.data=e.Core.Utils.FastMap.create();t.Event.Tree.NodeRemoved.getStream(r).subscribe(function(e){return n.data.delete(e.data.id)})}r.prototype.get=function(e,t){var r=this.data.get(e.id);if(r)return r[t];return void 0};r.prototype.set=function(e,t,r){var n;var i=this.data.get(e.id);if(i){i[t]=r}else{this.data.set(e.id,(n={},n[t]=r,n))}return r};return r}();r.Cache=n;(function(e){var t;(function(e){e.QueryContext="queryContext"})(t=e.Keys||(e.Keys={}))})(n=r.Cache||(r.Cache={}))})(r=t.Entity||(t.Entity={}))})(t=e.Bootstrap||(e.Bootstrap={}))})(p||(p={}));/* 682 * Copyright (c) 2016 - now David Sehnal, licensed under Apache 2.0, See LICENSE file for more info. 683 */ 684var p;(function(e){var t;(function(t){var r;(function(r){var n;(function(n){var i;(function(n){"use strict";var i=this;var a=t.Tree.Transformer;n.Root=a.create({id:"root",name:"Root",description:"A transformer that always returns itself.",from:[r.Root],to:[r.Root],validateParams:function(){return void 0},defaultParams:function(){return{}}},function(e,r,n){return t.Task.resolve("Root","Silent",r)});
684n.Fail=a.create({id:"fail",name:"Fail",description:"A transform that always fails.",from:[],to:[],validateParams:function(){return void 0},defaultParams:function(){return{title:"Error",message:"Unknown error."}}},function(e,r,n){return t.Task.reject(n.params.title,"Background",n.params.message)});n.CreateGroup=a.create({id:"create-group",name:"Create Group",description:"A transformer that always returns itself.",from:[],to:[r.Group],validateParams:function(){return void 0},defaultParams:function(){return{}}},function(e,n,i){var a=r.Group.create(i,{label:i.params.label?i.params.label:"Group",description:i.params.description});if(i.params.isCollapsed){var o={isCollapsed:true};a=t.Tree.Node.withState(a,o)}return t.Task.resolve("Group","Silent",a)});n.Delay=a.create({id:"basic-delay",name:"Delay",description:"A transformer that delays by the specified timeout and does nothing.",from:[],to:[r.Action],validateParams:function(){return void 0},defaultParams:function(){return{timeoutMs:1e3}}},function(r,n,i){return t.Task.create("Delay","Silent",function(r){return new e.Promise(function(e){setTimeout(function(){return e(t.Tree.Node.Null)},i.params.timeoutMs)})})});n.CreateSurfaceVisual=t.Tree.Transformer.create({id:"basic-create-surface-visual",name:"Create Surface Visual",description:"Create generic surface visual.",from:[],to:[t.Entity.Visual.Surface],defaultParams:function(){return void 0},isUpdatable:false},function(r,n,a){var o=a.params.theme;var s={type:"Surface",taskType:a.params.taskType||"Silent",isNotSelectable:!!a.params.isNotInteractive,params:{},theme:void 0};return t.Task.create("Create Surface Visual",a.params.taskType||"Silent",function(r){return m(i,void 0,void 0,function(){var i;return v(this,function(u){switch(u.label){case 0:return[4,e.Visualization.Surface.Model.create(n,{surface:a.params.surface,theme:o,parameters:{isWireframe:a.params.isWireframe}}).run(r)];case 1:i=u.sent();return[2,t.Entity.Visual.Surface.create(a,{label:a.params.label||"Surface",model:i,style:s,isSelectable:!a.params.isNotInteractive,tag:a.params.tag})]}})})})})})(i=n.Basic||(n.Basic={}))})(n=r.Transformer||(r.Transformer={}))})(r=t.Entity||(t.Entity={}))})(t=e.Bootstrap||(e.Bootstrap={}))})(p||(p={}));/* 685 * Copyright (c) 2016 - now David Sehnal, licensed under Apache 2.0, See LICENSE file for more info. 686 */ 687var p;(function(e){var t;(function(t){var r;(function(r){var n;(function(n){var i;(function(i){"use strict";var a=this;function o(a){return t.Tree.Transformer.action({id:"molecule-download-molecule-"+a.sourceId,name:"Molecule from "+a.name,description:a.description,from:[r.Root],to:[r.Action],defaultParams:function(t){return{id:a.defaultId,format:e.Core.Formats.Molecule.SupportedFormats.mmCIF}},validateParams:function(e){return!e.id||!e.id.trim().length?["Enter "+(a.isFullUrl?"URL":"Id")]:void 0}},function(e,r,o){var s=a.specificFormat?a.specificFormat:o.params.format;return t.Tree.Transform.build().add(r,n.Data.Download,{url:a.urlTemplate(o.params.id.trim()),type:s.isBinary?"Binary":"String",id:o.params.id,description:a.name,title:"Molecule"}).then(i.CreateFromData,{format:a.specificFormat?a.specificFormat:o.params.format},{isBinding:true}).then(i.CreateModel,{modelIndex:0},{isBinding:false})})}i.downloadMoleculeSource=o;i.OpenMoleculeFromFile=t.Tree.Transformer.action({id:"molecule-open-from-file",name:"Molecule from File",description:"Open a molecule from a file ("+e.Core.Formats.Molecule.SupportedFormats.All.map(function(e){return e.name}).join(", ")+").",from:[r.Root],to:[r.Action],defaultParams:function(e){return{file:void 0}},validateParams:function(t){return!t.file?["Select a file"]:!e.Core.Formats.FormatInfo.getFormat(t.file.name,e.Core.Formats.Molecule.SupportedFormats.All)?["Select a supported file format ("+[].concat(e.Core.Formats.Molecule.SupportedFormats.All.map(function(e){return e.extensions})).join(", ")+")."]:void 0}},function(r,a,o){var s=e.Core.Formats.FormatInfo.getFormat(o.params.file.name,e.Core.Formats.Molecule.SupportedFormats.All);return t.Tree.Transform.build().add(a,n.Data.OpenFile,{file:o.params.file,type:s.isBinary?"Binary":"String"}).then(i.CreateFromData,{format:s},{isBinding:true}).then(i.CreateModel,{modelIndex:0},{isBinding:false})});i.CreateFromData=t.Tree.Transformer.create({id:"molecule-create-from-data",name:"Molecule",description:"Create a molecule from string or binary data.",from:[r.Data.String,r.Data.Binary],to:[r.Molecule.Molecule],defaultParams:function(t){return{format:e.Core.Formats.Molecule.SupportedFormats.mmCIF}}},function(e,n,i){return t.Task.create("Create Molecule ("+n.props.label+")","Silent",function(){return m(a,void 0,void 0,function(){var a,o,s,u;return v(this,function(l){switch(l.label){case 0:return[4,t.Task.fromComputation("Create Molecule ("+n.props.label+")","Normal",i.params.format.parse(n.props.data,{id:i.params.customId})).setReportTime(true).run(e)];case 1:a=l.sent();if(a.isError)throw a.toString();if(a.warnings&&a.warnings.length>0){for(o=0,s=a.warnings;o<s.length;o++){u=s[o];e.logger.warning(u)}}return[2,r.Molecule.Molecule.create(i,{label:a.result.id,molecule:a.result})]}})})})});i.CreateFromMmCif=t.Tree.Transformer.create({id:"molecule-create-from-mmcif",name:"Molecule",description:"Create a molecule from a mmCIF data block.",from:[r.Data.CifDictionary],to:[r.Molecule.Molecule],defaultParams:function(e){return{blockIndex:0}}},function(n,i,o){return t.Task.create("Create Molecule ("+i.props.label+")","Normal",function(t){return m(a,void 0,void 0,function(){var n,a,s;return v(this,function(u){switch(u.label){case 0:return[4,t.updateProgress("Creating...")];case 1:u.sent();n=o.params.blockIndex|0;a=i.props.dictionary.dataBlocks[n];if(!a){throw"The source contains only "+i.props.dictionary.dataBlocks.length+" data block(s), tried to access the "+(n+1)+"-th."}s=e.Core.Formats.Molecule.mmCIF.ofDataBlock(a);return[2,r.Molecule.Molecule.create(o,{label:s.id,molecule:s})]}})})}).setReportTime(true)});i.CreateModel=t.Tree.Transformer.create({id:"molecule-create-model",name:"Model",description:"Create a model of a molecule.",from:[r.Molecule.Molecule],to:[r.Molecule.Model],isUpdatable:true,defaultParams:function(e){return{modelIndex:0}}},function(e,n,i){return t.Task.create("Create Model ("+n.props.label+")","Backgroun
687d",function(e){return m(a,void 0,void 0,function(){var e,t,a;return v(this,function(o){e=i.params;t=e.modelIndex|0;a=n.props.molecule.models[t];if(!a){throw"The molecule contains only "+n.props.molecule.models.length+" model(s), tried to access the "+(t+1)+"-th."}return[2,r.Molecule.Model.create(i,{label:"Model "+a.modelId,description:a.data.atoms.count+" atom"+(a.data.atoms.count!==1?"s":""),model:a})]})})})});i.CreateSelection=t.Tree.Transformer.create({id:"molecule-create-selection",name:"Selection",description:"Create an atom selection.",from:[r.Molecule.Model,r.Molecule.Visual],to:[r.Molecule.Selection],isUpdatable:true,defaultParams:function(e){return{queryString:e.settings.get("molecule.model.defaultQuery")||""}},validateParams:function(t){if(!(t.queryString||"").trim().length)return["Enter query"];try{return e.Core.Structure.Query.Builder.toQuery(t.queryString)&&void 0||void 0}catch(e){return[""+e]}}},function(n,i,o){return t.Task.create("Create Selection ("+i.props.label+")","Background",function(n){return m(a,void 0,void 0,function(){var n,a,s,u;return v(this,function(l){n=o.params;a=e.Core.Structure.Query.Builder.toQuery(n.queryString);s=o.params.inFullContext?t.Utils.Molecule.findModel(i).props.model.queryContext:t.Utils.Molecule.findQueryContext(i);u=a(s).unionAtomIndices();if(!u.length){throw{warn:true,message:"Empty selection"+(o.params.name?" ("+o.params.name+")":"")+"."}}return[2,r.Molecule.Selection.create(o,{label:n.name?n.name:"Selection",description:u.length+" atom"+(u.length!==1?"s":""),indices:u})]})})}).setReportTime(!o.params.silent)});i.CreateSelectionFromQuery=t.Tree.Transformer.create({id:"molecule-create-selection",name:"Selection",description:"Create an atom selection.",from:[r.Molecule.Selection,r.Molecule.Model,r.Molecule.Visual],to:[r.Molecule.Selection],defaultParams:function(e){return void 0}},function(n,i,o){return t.Task.create("Create Selection ("+i.props.label+")","Background",function(n){return m(a,void 0,void 0,function(){var n,a,s,u;return v(this,function(l){n=o.params;a=e.Core.Structure.Query.Builder.toQuery(n.query);s=o.params.inFullContext?t.Utils.Molecule.findModel(i).props.model.queryContext:t.Utils.Molecule.findQueryContext(i);u=a(s).unionAtomIndices();if(!u.length){throw{warn:true,message:"Empty selection"+(o.params.name?" ("+o.params.name+")":"")+"."}}return[2,r.Molecule.Selection.create(o,{label:n.name?n.name:"Selection",description:u.length+" atom"+(u.length!==1?"s":""),indices:u})]})})}).setReportTime(!o.params.silent)});i.CreateAssembly=t.Tree.Transformer.create({id:"molecule-create-assemly",name:"Assembly",description:"Create an assembly of a molecule.",from:[r.Molecule.Model],to:[r.Molecule.Model],defaultParams:function(e,r){var n=t.Utils.Molecule.findModel(r);var i={name:e.settings.get("molecule.model.defaultAssemblyName")||"1"};var a=n.props.model.data.assemblyInfo;if(!a||!a.assemblies.length)return i;if(a.assemblies.filter(function(e){return e.name===i.name}))return i;i.name=a.assemblies[0].name;return i},isUpdatable:true,isApplicable:function(e){return!!(e&&e.props.model.data.assemblyInfo&&e.props.model.data.assemblyInfo.assemblies.length)}},function(n,i,o){return t.Task.create("Create Model ("+i.props.label+")","Background",function(t){return m(a,void 0,void 0,function(){var n,a,s;return v(this,function(u){switch(u.label){case 0:n=i.props.model.data.assemblyInfo;if(!n||!n.assemblies.length){throw"Assembly info not available."}a=n.assemblies.filter(function(e){return e.name===o.params.name})[0];if(!a){throw"No assembly called '"+o.params.name+"' found."}return[4,t.updateProgress("Creating...")];case 1:u.sent();s=e.Core.Structure.buildAssembly(i.props.model,a);return[2,r.Molecule.Model.create(o,{label:"Assembly "+a.name,description:s.data.atoms.count+" atom"+(s.data.atoms.count!==1?"s":""),model:s})]}})})})});i.CreateSymmetryMates=t.Tree.Transformer.create({id:"molecule-create-symmetry-mates",name:"Crystal Symmetry",description:"Find crystal symmetry mates or interaction partners.",from:[r.Molecule.Model],to:[r.Molecule.Model],defaultParams:function(e){return{type:"Interaction",radius:5}},isUpdatable:true,isApplicable:function(e){if(!e||!e.props.model.data.symmetryInfo)return false;var t=e.props.model.data.symmetryInfo;if(t.cellSize[0]===1&&t.cellSize[1]===1&&t.cellSize[2]===1)return false;return true}},function(n,i,o){return t.Task.create("Create Model ("+i.props.label+")","Backgroun
687d",function(n){return m(a,void 0,void 0,function(){var a,s,u;return v(this,function(l){switch(l.label){case 0:a=i.props.model.data.symmetryInfo;if(!a){throw"Spacegroup info info not available."}s=Math.max(o.params.radius,0);return[4,n.updateProgress("Creating...")];case 1:l.sent();u=o.params.type==="Mates"?e.Core.Structure.buildSymmetryMates(i.props.model,s):e.Core.Structure.buildPivotGroupSymmetry(i.props.model,s);return[2,r.Molecule.Model.create(o,{label:"Symmetry",model:u,description:u.data.atoms.count+" atom"+(u.data.atoms.count!==1?"s":"")+", "+o.params.type+" "+t.Utils.round(s,1)+" â«"})]}})})})});i.ModelTransform3D=t.Tree.Transformer.create({id:"molecule-model-transform3d",name:"Transform 3D",description:"Transform 3D coordinates of a model using a 4x4 matrix.",from:[r.Molecule.Model],to:[r.Molecule.Model],validateParams:function(e){return!e||!e.transform||e.transform.length!==16?["Specify a 4x4 transform matrix."]:void 0},defaultParams:function(t,r){return{transform:e.Core.Geometry.LinearAlgebra.Matrix4.identity()}},isUpdatable:false},function(n,i,o){return t.Task.create("Transform 3D ("+i.props.label+")","Normal",function(t){return m(a,void 0,void 0,function(){var n,a,s;return v(this,function(u){switch(u.label){case 0:return[4,t.updateProgress("Transforming...")];case 1:u.sent();n=i.props.model;a={t:o.params.transform,v:e.Core.Geometry.LinearAlgebra.Vector3.zero()};s=e.Core.Structure.Molecule.Model.withTransformedXYZ(n,a,function(t,r,n,i,a){var o=t.v;e.Core.Geometry.LinearAlgebra.Vector3.set(o,r,n,i);e.Core.Geometry.LinearAlgebra.Vector3.transformMat4(a,o,t.t)});return[2,r.Molecule.Model.create(o,{label:i.props.label,description:o.params.description?o.params.description:"Transformed",model:s})]}})})})});i.CreateVisual=t.Tree.Transformer.create({id:"molecule-create-visual",name:"Visual",description:"Create a visual of a molecule or a selection.",from:[r.Molecule.Model,r.Molecule.Selection],to:[r.Molecule.Visual],isUpdatable:true,defaultParams:function(e){return{style:t.Visualization.Molecule.Default.ForType.get("Cartoons")}},validateParams:function(e){return!e.style?["Specify Style"]:void 0},customController:function(e,r,n){return new t.Components.Transform.MoleculeVisual(e,r,n)}},function(e,r,n){var i=n.params;return t.Visualization.Molecule.create(r,n,i.style).setReportTime(t.Visualization.Style.getTaskType(n.params.style)==="Normal")},function(e,n,i){var a=n.transform.params;if(a.style.type!==i.params.style.type||!t.Utils.deepEqual(a.style.params,i.params.style.params))return void 0;var o=n.props.model;if(!o)return void 0;var s=t.Utils.Molecule.findModel(n.parent);if(!s)return void 0;var u=i.params.style.theme;var l=u.template.provider(s,t.Visualization.Theme.getProps(u));o.applyTheme(l);n.props.style=i.params.style;r.nodeUpdated(n);return t.Task.resolve(i.transformer.info.name,"Background",t.Tree.Node.Null)});i.CreateMacromoleculeVisual=t.Tree.Transformer.action({id:"molecule-create-macromolecule-visual",name:"Macromolecule Visual",description:"Create a visual of a molecule that is split into polymer, HET, and water parts.",from:[r.Molecule.Selection,r.Molecule.Model],to:[r.Action],validateParams:function(e){return!e.polymer&&!e.het&&!e.water?["Select at least one component"]:void 0},defaultParams:function(e){return{polymer:true,het:true,water:true}}},function(r,a,o){var s=t.Tree.Transform.build().add(a,n.Basic.CreateGroup,{label:"Group",description:"Macromolecule"},{ref:o.params.groupRef});if(o.params.polymer){s.then(i.CreateSelectionFromQuery,{query:e.Core.Structure.Query.nonHetPolymer(),name:"Polymer",silent:true},{isBinding:true}).then(i.CreateVisual,{style:t.Visualization.Molecule.Default.ForType.get("Cartoons")},{ref:o.params.polymerRef})}if(o.params.het){s.then(i.CreateSelectionFromQuery,{query:e.Core.Structure.Query.hetGroups(),name:"HET",silent:true},{isBinding:true}).then(i.CreateVisual,{style:t.Visualization.Molecule.Default.ForType.get("BallsAndSticks")},{ref:o.params.hetRef})}if(o.params.water){var u={type:"BallsAndSticks",params:{useVDW:false,atomRadius:.23,bondRadius:.09,detail:"Automatic"},theme:{template:t.Visualization.Molecule.Default.ElementSymbolThemeTemplate,colors:t.Visualization.Molecule.Default.ElementSymbolThemeTemplate.colors,transparency:{alpha:.25}}};s.then(i.CreateSelectionFromQuery,{query:e.Core.Structure.Query.entities({type:"water"}),name:"Water",silent:true},{isBinding:true}).then(i.CreateVisual,{style:u},{ref:o.params.waterRef})}return s});i.CreateLabels=t.Tree.Transformer.create({id:"molecule-create-labels",name:"Labels",description:"Create a labels for a molecule or a selection.",from:[r.Molecule.Model,r.Molecule.Selection,r.Molecule.Visual],to:[r.Visual.Labels],isUpdatable:true,defaultParams:function(e){return{style:t.Visualization.Labels.Default.MoleculeLabels}},validateParams:function(e){return!e.style?["Specify Style"]:void 0},customController:function(e,r,n){return new t.Components.Transform.MoleculeLabels(e,r,n)}},function(e,r,n){var i=n.params;return t.Visualization.Labels.createMoleculeLabels(r,n,i.style).setReportTime(false)},function(e,n,i){var a=n.transform.params;var o=i.params;if(!t.Visualization.Labels.Style.moleculeHasOnlyThemeChanged(a.style,o.style))return void 0;var s=n.props.model;var u=t.Tree.Node.findClosestNodeOfType(n,[r.Molecule.Model,r.Molecule.Selection,r.Molecule.Visual]);if(!u)return void 0;var l=o.style.theme.template.provider(u,t.Visualization.Theme.getProps(o.style.theme));s.applyTheme(l);r.nodeUpdated(n);
687return t.Task.resolve(i.transformer.info.name,"Background",t.Tree.Node.Null)})})(i=n.Molecule||(n.Molecule={}))})(n=r.Transformer||(r.Transformer={}))})(r=t.Entity||(t.Entity={}))})(t=e.Bootstrap||(e.Bootstrap={}))})(p||(p={}));/* 688 * Copyright (c) 2016 - now David Sehnal, licensed under Apache 2.0, See LICENSE file for more info. 689 */ 690var p;(function(e){var t;(function(e){var t;(function(t){var r;(function(r){var n;(function(r){r.Create=e.Tree.Transformer.create({id:"labels-create",name:"Labels",description:"Create a labels for a molecule or a selection.",from:[],to:[t.Visual.Labels],isUpdatable:false,defaultParams:function(e){return{}},customController:function(t,r,n){return new e.Components.Transform.MoleculeLabels(t,r,n)}},function(t,r,n){return e.Visualization.Labels.createGenericLabels(r,n,n.params).setReportTime(false)},function(r,n,i){var a=n.transform.params;var o=i.params;if(a.positions!==o.positions||a.sizes!==o.sizes||a.labels!==o.labels||a.options!==o.options){return void 0}var s=n.props.model;var u=e.Tree.Node.findClosestNodeOfType(n,[t.Root]);if(!u)return void 0;var l=o.style.theme.template.provider(u,e.Visualization.Theme.getProps(o.style.theme));s.applyTheme(l);t.nodeUpdated(n);return e.Task.resolve(i.transformer.info.name,"Background",e.Tree.Node.Null)})})(n=r.Labels||(r.Labels={}))})(r=t.Transformer||(t.Transformer={}))})(t=e.Entity||(e.Entity={}))})(t=e.Bootstrap||(e.Bootstrap={}))})(p||(p={}));/* 691 * Copyright (c) 2016 - now David Sehnal, licensed under Apache 2.0, See LICENSE file for more info. 692 */ 693var p;(function(e){var t;(function(t){var r;(function(r){var n;(function(n){var i;(function(n){"use strict";var i=this;function a(e){if(e===void 0||e===null)return"String";if(e.toLowerCase()==="binary")return"Binary";return"String"}function o(e){var r=e===void 0?t.Utils.DataCompressionMethod.None:e;return r!==t.Utils.DataCompressionMethod.None}n.Download=t.Tree.Transformer.create({id:"data-download",name:"Download Data",description:"Downloads a string or binary data from the given URL (if the host server supports cross domain requests).",from:[r.Root],to:[r.Data.String,r.Data.Binary],validateParams:function(e){return!e.url||!e.url.trim().length?["Enter URL"]:!e.type?["Specify type"]:e.type==="String"&&o(e.responseCompression)?["Decompression is only available for Binary data."]:void 0},defaultParams:function(){return{id:"",description:"",type:"String",url:"",responseCompression:t.Utils.DataCompressionMethod.None}}},function(e,n,o){var s=o.params;return t.Task.create("Download","Silent",function(){return m(i,void 0,void 0,function(){var n;return v(this,function(i){switch(i.label){case 0:return[4,t.Utils.ajaxGet({url:s.url,type:a(s.type),compression:s.responseCompression,title:s.title}).setReportTime(true).run(e)];case 1:n=i.sent();if(s.type==="String")return[2,r.Data.String.create(o,{label:s.id?s.id:s.url,description:s.description,data:n})];else return[2,r.Data.Binary.create(o,{label:s.id?s.id:s.url,description:s.description,data:n})];return[2]}})})})});n.OpenFile=t.Tree.Transformer.create({id:"data-open-file",name:"Open Data File",description:"Read a string or binary data from the selected file.",from:[r.Root],to:[r.Data.String,r.Data.Binary],validateParams:function(e){return!e.file?["Select a file"]:void 0},defaultParams:function(){return{type:"String",file:void 0}}},function(e,n,o){return t.Task.create("Download","Silent",function(n){return m(i,void 0,void 0,function(){var n,i;return v(this,function(s){switch(s.label){case 0:n=o.params;return[4,t.Utils.readFromFile(n.file,a(n.type)).setReportTime(true).run(e)];case 1:i=s.sent();if(n.type==="String")return[2,r.Data.String.create(o,{label:n.id?n.id:n.file.name,description:n.description,data:i})];else return[2,r.Data.Binary.create(o,{label:n.id?n.id:n.file.name,description:n.description,data:i})];return[2]}})})})});n.ParseCif=t.Tree.Transformer.create({id:"data-parse-cif",name:"CIF Dictionary",description:"Parse CIF dictionary from a string.",from:[r.Data.String],to:[r.Data.CifDictionary],defaultParams:function(){return{}}},function(n,a,o){return t.Task.create("CIF Parse ("+a.props.label+")","Normal",function(t){return m(i,void 0,void 0,function(){var n;return v(this,function(i){switch(i.label){case 0:return[4,t.updateProgress("Parsing...")];case 1:i.sent();
693n=e.Core.Formats.CIF.Text.parse(a.props.data);if(n.isError){throw n.toString()}return[2,r.Data.CifDictionary.create(o,{label:o.params.id?o.params.id:"CIF Dictionary",description:o.params.description,dictionary:n.result})]}})})}).setReportTime(true)});n.ParseBinaryCif=t.Tree.Transformer.create({id:"data-parse-binary-cif",name:"CIF Dictionary",description:"Parse CIF dictionary from BinaryCIF data.",from:[r.Data.Binary],to:[r.Data.CifDictionary],defaultParams:function(){return{}}},function(n,a,o){return t.Task.create("BinaryCIF Parse ("+a.props.label+")","Normal",function(t){return m(i,void 0,void 0,function(){var n;return v(this,function(i){switch(i.label){case 0:return[4,t.updateProgress("Parsing...")];case 1:i.sent();n=e.Core.Formats.CIF.Binary.parse(a.props.data);if(n.isError){throw n.toString()}return[2,r.Data.CifDictionary.create(o,{label:o.params.id?o.params.id:"CIF Dictionary",description:o.params.description,dictionary:n.result})]}})})}).setReportTime(true)});n.ParseJson=t.Tree.Transformer.create({id:"data-parse-json",name:"JSON",description:"Parse a string to JSON object.",from:[r.Data.String],to:[r.Data.Json],defaultParams:function(){return{}}},function(e,n,a){return t.Task.create("JSON Parse ("+n.props.label+")","Normal",function(e){return m(i,void 0,void 0,function(){var t;return v(this,function(i){switch(i.label){case 0:return[4,e.updateProgress("Parsing...")];case 1:i.sent();t=JSON.parse(n.props.data);return[2,r.Data.Json.create(a,{label:a.params.id?a.params.id:"JSON Data",description:a.params.description,data:t})]}})})}).setReportTime(true)});n.FromData=t.Tree.Transformer.create({id:"data-from-data",name:"From Data",description:"Creates a data entity from string or binary data",from:[r.Root],to:[r.Data.String,r.Data.Binary],defaultParams:function(){return void 0}},function(e,n,i){var a=i.params.data;var o=a instanceof ArrayBuffer?r.Data.Binary.create(i,{label:i.params.id?i.params.id:"Binary Data",description:i.params.description,data:a}):r.Data.String.create(i,{label:i.params.id?i.params.id:"String Data",description:i.params.description,data:a});return t.Task.resolve("From Data","Silent",o)})})(i=n.Data||(n.Data={}))})(n=r.Transformer||(r.Transformer={}))})(r=t.Entity||(t.Entity={}))})(t=e.Bootstrap||(e.Bootstrap={}))})(p||(p={}));/* 694 * Copyright (c) 2016 - now David Sehnal, licensed under Apache 2.0, See LICENSE file for more info. 695 */ 696var p;(function(e){var t;(function(t){var r;(function(r){var n;(function(n){var i;(function(n){"use strict";var i=this;n.ParseData=t.Tree.Transformer.create({id:"density-parse-binary",name:"Density Data",description:"Parse density from binary data.",from:[r.Data.String,r.Data.Binary],to:[r.Density.Data],isUpdatable:true,defaultParams:function(){return{format:e.Core.Formats.Density.SupportedFormats.CCP4}}},function(e,n,a){return t.Task.create("Create Density ("+n.props.label+")","Background",function(o){return m(i,void 0,void 0,function(){var i,o;return v(this,function(s){switch(s.label){case 0:return[4,t.Task.fromComputation("Parse Density ("+n.props.label+")","Normal",a.params.format.parse(n.props.data)).setReportTime(true).run(e)];case 1:i=s.sent();if(i.isError){throw i.toString()}o=r.Density.Data.create(a,{label:a.params.id?a.params.id:"Density Data",data:i.result});return[2,o]}})})})});n.CreateFromCif=t.Tree.Transformer.create({id:"density-create-from-cif",name:"Density Data",description:"Parse density from CIF data.",from:[r.Data.CifDictionary],to:[r.Density.Data],isUpdatable:false,defaultParams:function(){return{blockIndex:0}}},function(n,a,o){return t.Task.create("Create Density","Normal",function(t){return m(i,void 0,void 0,function(){var n;return v(this,function(i){switch(i.label){case 0:return[4,t.updateProgress("Parsing...")];case 1:i.sent();n=e.Core.Formats.Density.CIF.parse(a.props.dictionary.dataBlocks[o.params.blockIndex]);if(n.isError){throw n.toString()}return[2,r.Density.Data.create(o,{label:o.params.id?o.params.id:"Density Data",data:n.result,description:n.result.name})]}})})}).setReportTime(true)});n.CreateFromData=t.Tree.Transformer.create({id:"density-create-from-data",name:"Density Data",description:"Create density from data.",from:[],to:[r.Density.Data],isUpdatable:false,defaultParams:function(){return{}}},function(e,n,i){var a=r.Density.Data.create(i,{label:i.params.id?i.params.id:"Density Data",data:i.params.data,description:i.params.data.name});
696return t.Task.resolve("Create Density","Background",a)});n.CreateVisual=t.Tree.Transformer.create({id:"density-create-visual",name:"Surface",description:"Create a surface from the density data.",from:[r.Density.Data],to:[r.Density.Visual],isUpdatable:true,defaultParams:function(){return{style:t.Visualization.Density.Default.Style}},validateParams:function(e){return!e.style?["Specify Style"]:void 0},customController:function(e,r,n){return new t.Components.Transform.DensityVisual(e,r,n)}},function(e,r,n){var i=n.params;return t.Visualization.Density.create(r,n,i.style).setReportTime(t.Visualization.Style.getTaskType(n.params.style)==="Normal")},function(e,n,i){var o=n.transform.params.style;var s=i.params.style;if(o.type!==i.params.style.type)return void 0;var u=t.Tree.Node.findClosestNodeOfType(n,[r.Density.Data]);if(!u)return void 0;var l=n.props.model;if(!l)return void 0;if(!a(u.props.data,o.params,s.params))return void 0;if(!t.Utils.deepEqual(o.theme,i.params.style.theme)){var c=s.theme;var f=c.template.provider(u,t.Visualization.Theme.getProps(c));l.applyTheme(f);n.props.style.theme=c;r.nodeUpdated(n)}return t.Task.resolve(i.transformer.info.name,"Background",t.Tree.Node.Null)});n.CreateVisualBehaviour=t.Tree.Transformer.create({id:"density-create-visual-behaviour",name:"Interactive Surface",description:"Create a surface from the density data when a residue or atom is selected.",from:[r.Density.Data],to:[r.Density.InteractiveSurface],isUpdatable:true,defaultParams:function(e){return{style:t.Visualization.Density.Default.Style,radius:e.settings.get("density.defaultVisualBehaviourRadius")||0,isoSigmaMin:-5,isoSigmaMax:5,minRadius:0,maxRadius:10,showFull:false}},customController:function(e,r,n){return new t.Components.Transform.DensityVisual(e,r,n)}},function(e,n,i){var a=i.params;var o=new t.Behaviour.Density.ShowDynamicDensity(e,{style:a.style,radius:a.radius,showFull:a.showFull});var s=a.style.params.isoValueType===void 0||a.style.params.isoValueType===t.Visualization.Density.IsoValueType.Sigma;return t.Task.resolve("Behaviour","Background",r.Density.InteractiveSurface.create(i,{label:(a.id?i.params.id:"Interactive")+", "+t.Utils.round(a.style.params.isoValue,2)+(s?" Ï":""),behaviour:o}))},function(e,n,i){var o=n.transform.params;var s=i.params;if(o.style.type!==s.style.type)return void 0;if(o.isoSigmaMin!==s.isoSigmaMin||o.isoSigmaMax!==s.isoSigmaMax||o.minRadius!==s.minRadius||o.maxRadius!==s.maxRadius||o.radius!==s.radius||o.showFull!==s.showFull){return void 0}var u=t.Tree.Node.findClosestNodeOfType(n,[r.Density.Data]);if(!u)return void 0;if(!a(u.props.data,o.style.params,s.style.params))return void 0;var l=s.style.theme;n.props.behaviour.updateTheme(l);r.nodeUpdated(n);return t.Task.resolve(i.transformer.info.name,"Background",t.Tree.Node.Null)});function a(e,r,n){if(!t.Visualization.Density.areNonIsoParamsSame(r,n))return false;var i=e.valuesInfo;var a=r.isoValueType===t.Visualization.Density.IsoValueType.Absolute?r.isoValue:i.mean+i.sigma*r.isoValue;var o=n.isoValueType===t.Visualization.Density.IsoValueType.Absolute?n.isoValue:i.mean+i.sigma*n.isoValue;return Math.abs(a-o)<1e-6}})(i=n.Density||(n.Density={}))})(n=r.Transformer||(r.Transformer={}))})(r=t.Entity||(t.Entity={}))})(t=e.Bootstrap||(e.Bootstrap={}))})(p||(p={}));/* 697 * Copyright (c) 2016 - now David Sehnal, licensed under Apache 2.0, See LICENSE file for more info. 698 */ 699var p;(function(e){var t;(function(t){var r;(function(r){var n;(function(n){var i;(function(i){var a;(function(a){"use strict";var o=this;a.CreateBehaviour=t.Tree.Transformer.create({id:"streaming-create-behaviour",name:"Coordinate Streaming",description:"Enable coordinate data streaming for this molecule.",from:[r.Molecule.Model],to:[r.Molecule.CoordinateStreaming.Behaviour],defaultParams:function(e){return{server:e.settings.get("molecule.coordinateStreaming.defaultServer")||"",radius:e.settings.get("molecule.coordinateStreaming.defaultRadius")||0}}},function(e,n,i){return t.Task.resolve("Behaviour","Background",r.Molecule.CoordinateStreaming.Behaviour.create(i,{label:"Coordinate Streaming",behaviour:new t.Behaviour.Molecule.CoordinateStreaming(e,i.params.server,i.params.radius)}))});a.CreateModel=t.Tree.Transformer.create({id:"streaming-create-model",name:"Streaming Model",description:"",from:[r.Molecule.CoordinateStreaming.Behaviour],to:[r.Molecule.Model],defaultParams:function(){return void 0}},function(n,i,a){return t.Task.create("Load","Silent",function(t){return m(o,void 0,void 0,function(){var t,n;
699return v(this,function(i){t=e.Core.Formats.CIF.Binary.parse(a.params.data);if(t.isError)throw new Error("Invalid CIF.");n=e.Core.Formats.Molecule.mmCIF.ofDataBlock(t.result.dataBlocks[0]).models[0];if(a.params.transform)e.Core.Structure.Operator.applyToModelUnsafe(a.params.transform,n);return[2,r.Molecule.Model.create(a,{label:"part",model:n})]})})})});a.InitStreaming=t.Tree.Transformer.action({id:"streaming-init",name:"Coordinate Streaming",description:"Download a smaller version of the molecule required to display cartoon representation and stream the rest of the coordinates as required.",from:[r.Root],to:[r.Action],validateParams:function(e){return!(e.id||"").trim().length?["Enter id"]:!(e.server||"").trim().length?["Specify server"]:void 0},defaultParams:function(e){return{id:e.settings.get("molecule.coordinateStreaming.defaultId")||"",server:e.settings.get("molecule.coordinateStreaming.defaultServer")||"",radius:e.settings.get("molecule.coordinateStreaming.defaultRadius")||0}}},function(e,r,o){return t.Tree.Transform.build().add(r,n.Data.Download,{url:t.Behaviour.Molecule.CoordinateStreaming.getBaseUrl(o.params.id,o.params.server),type:"Binary",id:o.params.id}).then(n.Data.ParseBinaryCif,{id:o.params.id},{isBinding:true}).then(i.CreateFromMmCif,{blockIndex:0},{isBinding:true}).then(i.CreateModel,{modelIndex:0},{isBinding:false}).then(a.CreateBehaviour,{server:o.params.server,radius:o.params.radius})})})(a=i.CoordinateStreaming||(i.CoordinateStreaming={}))})(i=n.Molecule||(n.Molecule={}))})(n=r.Transformer||(r.Transformer={}))})(r=t.Entity||(t.Entity={}))})(t=e.Bootstrap||(e.Bootstrap={}))})(p||(p={}));/* 700 * Copyright (c) 2016 - now David Sehnal, licensed under Apache 2.0, See LICENSE file for more info. 701 */ 702var p;(function(e){var t;(function(t){var r;(function(r){var n;(function(r){"use strict";var n=e.Core.Geometry;var i=n.LinearAlgebra;var a=[t.Entity.Molecule.Model];function o(e){return t.Tree.Node.findClosestNodeOfType(e,a)}r.findModel=o;var s=[t.Entity.Molecule.Model,t.Entity.Molecule.Selection];function u(e){return t.Tree.Node.findClosestNodeOfType(e,s)}r.findModelOrSelection=u;var l=[t.Entity.Molecule.Molecule];function c(e){return t.Tree.Node.findClosestNodeOfType(e,l)}r.findMolecule=c;function f(r){var n=t.Tree.Node.findClosestNodeOfType(r,s);if(t.Entity.isMoleculeModel(n)){return n.props.model.queryContext}else{var i=n.tree.context.entityCache;var a=i.get(n,t.Entity.Cache.Keys.QueryContext);if(a)return a;a=e.Core.Structure.Query.Context.ofAtomIndices(o(n).props.model,n.props.indices);return i.set(n,t.Entity.Cache.Keys.QueryContext,a)}}r.findQueryContext=f;function h(e,t,r,n,i,a){var o=e.positions,s=o.x,u=o.y,l=o.z;var c=n.positions,f=c.x,h=c.y,d=c.z;var p=Number.POSITIVE_INFINITY;for(var m=t;m<r;m++){for(var v=i;v<a;v++){var y=s[m]-f[v],g=u[m]-h[v],b=l[m]-d[v];p=Math.min(p,y*y+g*g+b*b)}}return Math.sqrt(p)}r.getDistance=h;function d(e,t,r,n){var i=e.positions,a=i.x,o=i.y,s=i.z;var u=r.positions,l=u.x,c=u.y,f=u.z;var h=Number.POSITIVE_INFINITY;for(var d=0,p=t;d<p.length;d++){var m=p[d];for(var v=0,y=n;v<y.length;v++){var g=y[v];var b=a[m]-l[g],x=o[m]-c[g],_=s[m]-f[g];h=Math.min(h,b*b+x*x+_*_)}}return Math.sqrt(h)}r.getDistanceSet=d;function p(t,r){var n=o(t);if(!n){console.warn("Could not find a model for query selection.");return void 0}var i=f(t);try{var a=e.Core.Structure.Query.Builder.toQuery(r);return{model:n,indices:a(i).unionAtomIndices(),queryContext:i}}catch(e){console.error("Query Execution",e);return void 0}}r.getModelAndIndicesFromQuery=p;function m(e,t){var r=e.data.atoms.residueIndex;var n=[];for(var i=e.data.residues.atomStartIndex[r[t]],a=e.data.residues.atomEndIndex[r[t]];i<a;i++){n.push(i)}return n}r.getResidueIndices=m;function v(e,t,r){var n=e.positions,i=n.x,a=n.y,o=n.z,s=[Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE],u=[-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE];for(var l=0,c=t;l<c.length;l++){var f=c[l];s[0]=Math.min(i[f],s[0]);s[1]=Math.min(a[f],s[1]);s[2]=Math.min(o[f],s[2]);u[0]=Math.max(i[f],u[0]);u[1]=Math.max(a[f],u[1]);u[2]=Math.max(o[f],u[2])}s[0]=s[0]-r;s[1]=s[1]-r;s[2]=s[2]-r;u[0]=u[0]+r;u[1]=u[1]+r;u[2]=u[2]+r;return{bottomLeft:s,topRight:u}}r.getBox=v;var y=function(){function e(e){this.center={x:0,y:0,z:0};this.radiusSquared=0;this.count=0;this.x=e.positions.x;this.y=e.positions.y;this.z=e.positions.z}e.prototype.addAtom=function(e){this.count++;this.center.x+=this.x[e];this.center.y+=this.y[e];this.center.z+=this.z[e]};e.prototype.finishedAdding=function(){this.center.x/=this.count;this.center.y/=this.count;this.center.z/=this.count};
702e.prototype.radiusVisit=function(e){var t=this.center.x-this.x[e],r=this.center.y-this.y[e],n=this.center.z-this.z[e];this.radiusSquared=Math.max(this.radiusSquared,t*t+r*r+n*n)};return e}();r.CentroidHelper=y;function g(e,t,r){i.Vector3.set(r,0,0,0);var n=e.positions,a=n.x,o=n.y,s=n.z;if(t.length===0)return 0;if(t.length===1){i.Vector3.set(r,a[t[0]],o[t[0]],s[t[0]]);return 0}for(var u=0,l=t;u<l.length;u++){var c=l[u];r[0]+=a[c];r[1]+=o[c];r[2]+=s[c]}var f=t.length;r[0]/=f;r[1]/=f;r[2]/=f;var h=0;for(var d=0,p=t;d<p.length;d++){var c=p[d];var m=r[0]-a[c],v=r[1]-o[c],y=r[2]-s[c];h=Math.max(h,m*m+v*v+y*y)}return Math.sqrt(h)}r.getCentroidAndRadius=g;r.Labels3DKinds=["Residue-Name","Residue-Full-Id","Atom-Name","Atom-Element"];r.Labels3DKindLabels={"Residue-Name":"Residue Name","Residue-Full-Id":"Residue Full Id","Atom-Name":"Atom Name","Atom-Element":"Atom Element"};function b(e,t){var r=t.data.atoms,n=r.residueIndex,i=r.chainIndex,a=r.name,o=r.elementSymbol;var s=t.data.residues,u=s.name,l=s.seqNumber;var c=t.data.chains.authAsymId;switch(e.kind){case"Residue-Name":return function(e){return u[n[e]]};case"Residue-Full-Id":return function(e){var t=n[e],r=i[e];return u[t]+" "+c[r]+" "+l[t]};case"Atom-Name":return function(e){return a[e]};case"Atom-Element":return function(e){return o[e]};default:return function(e){return""+e}}}function x(t,r,n){var a=f(t);var o=r.kind.indexOf("Residue")>=0?e.Core.Structure.Query.residues():e.Core.Structure.Query.allAtoms();var s=o.compile()(a);var u=b(r,a.structure);var l=e.Core.Utils.DataTable.ofDefinition(e.Core.Structure.Tables.Positions,s.length);var c=l.x,h=l.y,d=l.z;var p=[];var m=new Float32Array(s.length);var v=i.Vector3.zero();var y=0;for(var x=0,_=s.fragments;x<_.length;x++){var w=_[x];var C=u(w.atomIndices[0]);g(a.structure,w.atomIndices,v);c[y]=v[0];h[y]=v[1];d[y]=v[2];p[p.length]=C;m[y]=1;y++}return{labels:p,options:r.labelsOptions,positions:l,sizes:m,theme:n}}r.create3DLabelsParams=x})(n=r.Molecule||(r.Molecule={}))})(r=t.Utils||(t.Utils={}))})(t=e.Bootstrap||(e.Bootstrap={}))})(p||(p={}));/* 703 * Copyright (c) 2016 - now David Sehnal, licensed under Apache 2.0, See LICENSE file for more info. 704 */ 705var p;(function(e){var t;(function(e){var t;(function(t){"use strict";var r=function(){function t(t){this.context=t;this.subjects={select:new e.Rx.BehaviorSubject(e.Interactivity.Info.empty),click:new e.Rx.BehaviorSubject(e.Interactivity.Info.empty),currentEntity:new e.Rx.BehaviorSubject(void 0)};this.select=this.subjects.select.distinctUntilChanged(function(e){return e},e.Interactivity.interactivityInfoEqual);this.click=this.subjects.click.distinctUntilChanged(function(e){return e},e.Interactivity.interactivityInfoEqual);this.currentEntity=this.subjects.currentEntity;this.init()}t.prototype.init=function(){var t=this;var r=e.Interactivity.Info.empty;e.Event.Tree.NodeRemoved.getStream(this.context).subscribe(function(n){if(e.Interactivity.isSelection(r)&&r.source===n.data){r=e.Interactivity.Info.empty;e.Event.Visual.VisualSelectElement.dispatch(t.context,r)}});e.Event.Visual.VisualSelectElement.getStream(this.context).subscribe(function(n){r=n.data;t.subjects.click.onNext(r);if(e.Interactivity.isSelection(r)&&e.Entity.isVisual(r.source)&&!r.source.props.isSelectable)return;t.subjects.select.onNext(r)});e.Event.Entity.CurrentChanged.getStream(this.context).subscribe(function(e){return t.subjects.currentEntity.onNext(e.data)})};return t}();t.Streams=r})(t=e.Behaviour||(e.Behaviour={}))})(t=e.Bootstrap||(e.Bootstrap={}))})(p||(p={}));/* 706 * Copyright (c) 2016 - now David Sehnal, licensed under Apache 2.0, See LICENSE file for more info. 707 */ 708var p;(function(e){var t;(function(t){var r;(function(r){"use strict";function n(e){t.Event.Tree.NodeAdded.getStream(e).subscribe(function(r){var n=r.data;if(n&&(n.transform.isUpdate||n.type.info.traits.isSilent))return;t.Command.Entity.SetCurrent.dispatch(e,n)})}r.SetEntityToCurrentWhenAdded=n;r.SuppressCreateVisualWhenModelIsAdded=false;function i(e){t.Event.Tree.NodeAdded.getStream(e).subscribe(function(n){if(r.SuppressCreateVisualWhenModelIsAdded||!t.Tree.Node.is(n.data,t.Entity.Molecule.Model)||n.data.isHidden){return}var i=t.Entity.Transformer.Molecule.CreateMacromoleculeVisual.info.defaultParams(e,n.data);t.Command.Tree.ApplyTransform.dispatch(e,{node:n.data,transform:t.Entity.Transformer.Molecule.CreateMacromoleculeVisual.create(i)})})}r.CreateVisualWhenModelIsAdded=i;function a(e){t.Event.Tree.NodeAdded.getStream(e).subscribe(function(e){var r=e.data;if(t.Entity.isMoleculeSelection(r)&&t.Entity.isVisual(r.parent)){var n=r;var i=r.parent;i.props.model.applySelection(n.props.indices,1)}});t.Event.Tree.NodeRemoved.getStream(e).subscribe(function(e){var r=e.data;if(t.Entity.isMoleculeSelection(r)&&t.Entity.isVisual(r.parent)){var n=r;var i=r.parent;i.props.model.applySelection(n.props.indices,2)}})}r.ApplySelectionToVisual=a;function o(e,r){var n=void 0;var i=void 0;e.subscribe(function(e){if(i){i.applySelection(n,2);i=void 0;n=void 0}if(t.Interactivity.isEmpty(e)||!t.Entity.isVisual(e.source))return;i=e.source.props.model;n=e.elements;i.applySelection(n,1)})}function s(e){o(e.behaviours.click,e)}r.ApplyInteractivitySelection=s;function u(e){return function(t){o(t.behaviours.click.filter(function(r){return e(r,t)}),t)}}r.FilteredApplyInteractivitySelection=u;function l(e){var r=t.Interactivity.Info.empty;t.Event.Visual.VisualSelectElement.getStream(e).subscribe(function(n){if(t.Interactivity.isEmpty(n.data)||t.Interactivity.isEmpty(r)){r=n.data;return}if((t.Tree.Node.hasAncestor(r.source,n.data.source)||t.Tree.Node.hasAncestor(n.data.source,r.source))&&t.Interactivity.interactivitySelectionElementsEqual(n.data,r)){r=t.Interactivity.Info.empty;setTimeout(function(){return t.Event.Visual.VisualSelectElement.dispatch(e,t.Interactivity.Info.empty)},0)}else{r=n.data}})}
708r.UnselectElementOnRepeatedClick=l;var c=e.Core.Geometry.LinearAlgebra.Vector3.zero();function f(r,n){var i=t.Utils.Molecule.findModel(n.source).props.model;if(!i)return;var a=n.elements;if(n.elements.length===1){a=t.Utils.Molecule.getResidueIndices(i,n.elements[0])}var o=t.Utils.Molecule.getCentroidAndRadius(i,a,c);if(n.elements.length===1){var s=n.elements[0];c[0]=i.positions.x[s];c[1]=i.positions.y[s];c[2]=i.positions.z[s]}r.scene.camera.focusOnPoint(e.Core.Geometry.LinearAlgebra.Vector3.toObj(c),Math.max(o,7))}function h(r,n){if(t.Interactivity.isEmpty(n)||n.source.type.info.typeClass!=="Visual")return;var i=n.source;var a=i.props.model;if(!a)return;var o=a.getBoundingSphereOfSelection(n.elements);if(o){r.scene.camera.focusOnPoint(e.Core.Geometry.LinearAlgebra.Vector3.toObj(o.center),Math.max(o.radius,7))}else{r.scene.camera.focusOnModel(a)}}function d(e,r){e.subscribe(function(e){if(t.Interactivity.Molecule.isMoleculeModelInteractivity(e))f(r,e);else h(r,e)})}function p(e){d(e.behaviours.click,e)}r.FocusCameraOnSelect=p;function m(e){return function(t){d(t.behaviours.click.filter(function(r){return e(r,t)}),t)}}r.FilteredFocusCameraOnSelect=m})(r=t.Behaviour||(t.Behaviour={}))})(t=e.Bootstrap||(e.Bootstrap={}))})(p||(p={}));/* 709 * Copyright (c) 2016 - now David Sehnal, licensed under Apache 2.0, See LICENSE file for more info. 710 */ 711var p;(function(e){var t;(function(t){var r;(function(r){var n;(function(r){"use strict";var n=e.Core.Structure.Query;var i=t.Entity.Transformer;r.SuppressShowInteractionOnSelect=false;function a(a){return function(o){var s=void 0;var u=void 0;var l={type:"BallsAndSticks",taskType:"Silent",params:{useVDW:true,vdwScaling:.25,bondRadius:.13,detail:"Automatic"},theme:{template:t.Visualization.Molecule.Default.ElementSymbolThemeTemplate,colors:t.Visualization.Molecule.Default.ElementSymbolThemeTemplate.colors.set("Bond",e.Visualization.Theme.Default.SelectionColor),transparency:{alpha:.4}},isNotSelectable:true};var c={type:"BallsAndSticks",taskType:"Silent",params:{useVDW:false,atomRadius:.15,bondRadius:.07,detail:"Automatic"},theme:{template:t.Visualization.Molecule.Default.UniformThemeTemplate,colors:t.Visualization.Molecule.Default.UniformThemeTemplate.colors.set("Uniform",{r:.4,g:.4,b:.4}),transparency:{alpha:.75}},isNotSelectable:true};function f(){if(s){t.Command.Tree.RemoveNode.dispatch(o,s);s=void 0;u=void 0}}o.behaviours.click.subscribe(function(e){if(r.SuppressShowInteractionOnSelect||t.Interactivity.isEmpty(e)){f();return}if(e.source.ref===u){var h=t.Utils.Molecule.findModel(e.source);if(!h)return;var d=n.atomsFromIndices(e.elements);setTimeout(t.Command.Molecule.CreateSelectInteraction.dispatch(o,{entity:h,query:d}),0);return}var p=t.Entity.isVisual(e.source)?e.source.props.isSelectable:true;if(!p)return;f();if(t.Interactivity.isEmpty(e)||!t.Utils.Molecule.findModelOrSelection(e.source))return;var m=n.atomsFromIndices(e.elements).wholeResidues();var v=n.atomsFromIndices(e.elements).wholeResidues().ambientResidues(a);var y=t.Utils.generateUUID();var g=t.Tree.Transform.build().add(e.source,i.Basic.CreateGroup,{label:"Interaction"},{ref:y,isHidden:true});s=y;u=t.Utils.generateUUID();g.then(i.Molecule.CreateSelectionFromQuery,{query:v,name:"Ambience",silent:true,inFullContext:true},{isBinding:true}).then(i.Molecule.CreateVisual,{style:c},{ref:u});g.then(i.Molecule.CreateSelectionFromQuery,{query:m,name:"Ligand",silent:true,inFullContext:true},{isBinding:true}).then(i.Molecule.CreateVisual,{style:l});t.Tree.Transform.apply(o,g).run()})}}r.ShowInteractionOnSelect=a;function o(e){e.highlight.addProvider(function(e){if(!t.Interactivity.Molecule.isMoleculeModelInteractivity(e))return void 0;var r=t.Interactivity.Molecule.transformInteraction(e);return t.Interactivity.Molecule.formatInfo(r)})}r.HighlightElementInfo=o;function s(e){var r=t.Interactivity.Info.empty;var n=void 0;var i=void 0;e.behaviours.click.subscribe(function(e){if(!t.Interactivity.Molecule.isMoleculeModelInteractivity(e)){r=t.Interactivity.Info.empty;i=void 0;n=void 0}else{r=e;var a=t.Utils.Molecule.findModel(e.source);if(!a){r=t.Interactivity.Info.empty;i=void 0;n=void 0}else{i=a.props.model;n=t.Interactivity.Molecule.formatInfoShort(t.Interactivity.Molecule.transformInteraction(e))}}});e.highlight.addProvider(function(e){if(!t.Interactivity.Molecule.isMoleculeModelInteractivity(e))return void 0;if(t.Interactivity.isEmpty(r))return void 0;var a=t.Utils.Molecule.findModel(e.source);if(!a)return void 0;var o=t.Utils.Molecule.getDistanceSet(i,r.elements,a.props.model,e.elements);if(o<1e-4)return void 0;return"<span><b>"+t.Utils.round(o,2)+" â«</b> from <b>"+n+"</b></span>"})}r.DistanceToLastClickedElement=s})(n=r.Molecule||(r.Molecule={}))})(r=t.Behaviour||(t.Behaviour={}))})(t=e.Bootstrap||(e.Bootstrap={}))})(p||(p={}));/* 712 * Copyright (c) 2016 - now David Sehnal, licensed under Apache 2.0, See LICENSE file for more info. 713 */ 714var p;(function(e){var t;(function(e){var t;(function(t){var r;(function(t){"use strict";var r="__ShowDynamicDensity-toast";var n=function(){function t(t,r){this.context=t;this.params=r;this.obs=[];this.ref=e.Utils.generateUUID()}t.prototype.remove=function(){var t=this.getVisual();if(t){e.Tree.remove(t)}};t.prototype.getVisual=function(){return this.context.select(this.ref)[0]};t.prototype.update=function(t){if(!this.params.showFull&&!e.Interactivity.Molecule.isMoleculeModelInteractivity(t)){this.remove();return}e.Command.Toast.Hide.dispatch(this.context,{key:r});var n=e.Utils.shallowClone(this.params.style);n.params=e.Utils.shallowClone(n.params);if(this.params.showFull){n.params.bottomLeft=void 0;n.params.topRight=void 0;n.taskType="Normal"}else{var i=t;var a=e.Utils.Molecule.findModel(i.source);var o=i.elements;var s=a.props.model;if(i.elements.length===1){o=e.Utils.Molecule.getResidueIndices(s,i.elements[0])}var u=e.Utils.Molecule.getBox(s,o,this.params.radius);n.params.bottomLeft=u.bottomLeft;n.params.topRight=u.topRight;n.taskType="Silent"}var l;var c=this.getVisual();if(!c){var f=e.Entity.Transformer.Density.CreateVisual.create({style:n},{ref:this.ref,isHidden:true});f.isUpdate=true;l=f.apply(this.context,this.behaviour)}else l=e.Entity.Transformer.Density.CreateVisual.create({style:n},{ref:this.ref,isHidden:true}).update(this.context,c);l.run()};t.prototype.updateTheme=function(t){this.params.style.theme=t;if(!this.behaviour)return;var r=this.getVisual();if(!r)return;var n=e.Tree.Node.findClosestNodeOfType(this.behaviour,[e.Entity.Density.Data]);var i=t.template.provider(n,e.Visualization.Theme.getProps(t));r.props.model.applyTheme(i)};t.prototype.dispose=function(){this.remove();e.Command.Toast.Hide.dispatch(this.context,{key:r});for(var t=0,n=this.obs;t<n.length;t++){var i=n[t];i.dispose()}this.obs=[]};t.prototype.register=function(t){var n=this;this.behaviour=t;if(!this.params.showFull){e.Command.Toast.Show.dispatch(this.context,{key:r,title:"Density",message:"Click on a residue or an atom to view the data.",timeoutMs:30*1e3})}this.obs.push(this.context.behaviours.select.subscribe(function(e){n.update(e)}))};return t}();t.ShowDynamicDensity=n})(r=t.Density||(t.Density={}))})(t=e.Behaviour||(e.Behaviour={}))})(t=e.Bootstrap||(e.Bootstrap={}))})(p||(p={}));/* 715 * Copyright (c) 2016 - now David Sehnal, licensed under Apache 2.0, See LICENSE file for more info. 716 */ 717var p;(function(e){var t;(function(t){var r;(function(r){var n;(function(r){"use strict";var n=t.Entity.Transformer;var i=function(){function r(e,n,i){if(i===void 0){i=5}this.context=e;this.radius=i;this.obs=[];this.target=void 0;this.behaviour=void 0;this.ref=t.Utils.generateUUID();this.download=void 0;this.cache=t.Utils.LRUCache.create(100);this.style={type:"BallsAndSticks",taskType:"Silent",params:{useVDW:true,vdwScaling:.17,bondRadius:.07,detail:"Automatic"},theme:{template:t.Visualization.Molecule.Default.ElementSymbolThemeTemplate,colors:t.Visualization.Molecule.Default.ElementSymbolThemeTemplate.colors,transparency:{alpha:1}},isNotSelectable:true};this.server=r.normalizeServerName(n)}r.prototype.remove=function(){if(this.download){this.download.tryAbort();this.download=void 0}t.Command.Tree.RemoveNode.dispatch(this.context,this.ref)};r.prototype.isApplicable=function(e){if(!t.Interactivity.Molecule.isMoleculeModelInteractivity(e))return false;return t.Tree.Node.hasAncestor(e.source,this.target)};r.prototype.update=function(r){var n=this;this.remove();if(!this.isApplicable(r)){return}var i=t.Utils.Molecule.findModel(r.source).props.model;var a=i.data.atoms.residueIndex[r.elements[0]];var o=i.data.residues;var s=o.authAsymId[a];var u=void 0;if(i.source===e.Core.Structure.Molecule.Model.Source.Computed){var l=i.parent;var c=o.chainIndex[a];var f=i.data.chains.sourceChainIndex[c];s=l.data.chains.authAsymId[f];u=i.operators[i.data.chains.operatorIndex[c]].matrix}var h=this.server+"/"+(i.id.toLocaleLowerCase()+"/ambientResidues?")+("modelId="+encodeURIComponent(i.modelId)+"&")+("entityId="+encodeURIComponent(o.entityId[a])+"&")+("authAsymId="+encodeURIComponent(s)+"&")+("authSeqNumber="+encodeURIComponent(""+o.authSeqNumber[a])+"&")+("insCode="+encodeURIComponent(o.insCode[a]!==null?o.insCode[a]:"")+"&")+("radius="+encodeURIComponent(""+this.radius)+"&")+"atomSitesOnly=1&"+"encoding=bcif&"+"lowPrecisionCoords=1";this.download=t.Utils.ajaxGetArrayBuffer(h).runWithContext(this.context);var d=t.Utils.LRUCache.get(this.cache,h);if(d){this.create(d,u)}else{this.context.performance.start(this.ref);this.download.result.then(function(e){t.Utils.LRUCache.set(n.cache,h,e);n.context.performance.end(n.ref);n.context.logger.info("Streaming done in "+n.context.performance.formatTime(n.ref));n.create(e,u)}).catch(function(){n.context.performance.end(n.ref)})}};r.prototype.create=function(e,r){var i=t.Tree.Transform.build().add(this.behaviour,t.Entity.Transformer.Molecule.CoordinateStreaming.CreateModel,{data:e,transform:r},{ref:this.ref,isHidden:true}).then(n.Molecule.CreateVisual,{style:this.style});t.Tree.Transform.apply(this.context,i).run()};r.prototype.dispose=function(){this.remove();for(var e=0,t=this.obs;e<t.length;e++){var r=t[e];
717r.dispose()}this.obs=[]};r.prototype.register=function(e){var t=this;this.behaviour=e;this.target=e.parent;this.obs.push(this.context.behaviours.select.subscribe(function(e){return t.update(e)}))};return r}();r.CoordinateStreaming=i;(function(e){function t(e){if(e[e.length-1]!=="/")return e;if(e.length>0)return e.substr(0,e.length-1);return e}e.normalizeServerName=t;function r(e,r){return t(r)+"/"+e.trim().toLocaleLowerCase()+"/cartoon?encoding=bcif&lowPrecisionCoords=1"}e.getBaseUrl=r})(i=r.CoordinateStreaming||(r.CoordinateStreaming={}))})(n=r.Molecule||(r.Molecule={}))})(r=t.Behaviour||(t.Behaviour={}))})(t=e.Bootstrap||(e.Bootstrap={}))})(p||(p={}));/* 718 * Copyright (c) 2016 - now David Sehnal, licensed under Apache 2.0, See LICENSE file for more info. 719 */ 720var p;(function(e){var t;(function(e){var t;(function(t){"use strict";function r(e,t,r,n,i,a,o){if(i.transformer!==r)return;try{var s=window[o];var u=a(i.params,n);if(s&&typeof u!=="undefined"){s("send","event",t,u,e.id)}}catch(e){}}function n(e,t){return e.format.name}function i(e){return e.url}function a(e){return e.queryString}function o(t,r){if(e.Tree.Node.isHidden(r))return void 0;var n=e.Utils.Molecule.findModel(r);if(!n)return void 0;return n.props.model.id+" $(name)$ "+t.name}function s(t,r){if(e.Tree.Node.isHidden(r))return void 0;var n=e.Utils.Molecule.findModel(r);if(!n)return void 0;return n.props.model.id+" $(type)$ "+t.type+" $(radius)$ "+t.radius}function u(t,r){var n=e.Utils.Molecule.findModel(r);if(!n)return void 0;return n.props.model.id+" $(server)$ "+t.server}function l(t,r){if(e.Tree.Node.isHidden(r))return void 0;return t.style.type}function c(e){return"$(format)$ "+e.format}function f(e,t){return e.queryString}function h(t,h){if(h===void 0){h="default"}return function(d){var p="ga-"+d.id+"-"+h;try{(function(e,t,r,n,i,a,o){e["GoogleAnalyticsObject"]=i;e[i]=e[i]||function(){(e[i].q=e[i].q||[]).push(arguments)},e[i].l=1*+new Date;a=t.createElement(r),o=t.getElementsByTagName(r)[0];a.async=1;a.src=n;o.parentNode.insertBefore(a,o)})(window,document,"script","https://www.google-analytics.com/analytics.js",p);window[p]("create",t,"auto");setTimeout(function(){try{var e=window[p];if(e)e("send","event","Loaded","contextId",d.id)}catch(e){}},1e3)}catch(e){}e.Event.Tree.TransformerApply.getStream(d).subscribe(function(t){r(d,"Download",e.Entity.Transformer.Data.Download,t.data.a,t.data.t,i,p);r(d,"Create Molecule From Data",e.Entity.Transformer.Molecule.CreateFromData,t.data.a,t.data.t,n,p);r(d,"Create Model Selecion",e.Entity.Transformer.Molecule.CreateSelection,t.data.a,t.data.t,a,p);r(d,"Create Assembly",e.Entity.Transformer.Molecule.CreateAssembly,t.data.a,t.data.t,o,p);r(d,"Create Symmetry",e.Entity.Transformer.Molecule.CreateSymmetryMates,t.data.a,t.data.t,s,p);r(d,"Create Visual",e.Entity.Transformer.Molecule.CreateVisual,t.data.a,t.data.t,l,p);r(d,"Coordinate Streaming",e.Entity.Transformer.Molecule.CoordinateStreaming.CreateBehaviour,t.data.a,t.data.t,u,p);r(d,"Parse Density",e.Entity.Transformer.Density.ParseData,t.data.a,t.data.t,c,p);r(d,"Create Model Selection",e.Entity.Transformer.Molecule.CreateSelection,t.data.a,t.data.t,f,p)})}}t.GoogleAnalytics=h})(t=e.Behaviour||(e.Behaviour={}))})(t=e.Bootstrap||(e.Bootstrap={}))})(p||(p={}));/* 721 * Copyright (c) 2016 - now David Sehnal, licensed under Apache 2.0, See LICENSE file for more info. 722 */ 723var p;(function(e){var t;(function(e){var t;(function(t){"use strict";var r=function(){function t(t,r){this.context=t;this._state=new e.Rx.Subject;this._latestState=void 0;this._latestState=r}Object.defineProperty(t.prototype,"dispatcher",{get:function(){return this.context.dispatcher},enumerable:true,configurable:true});t.prototype.setState=function(){var t=[];for(var r=0;r<arguments.length;r++){t[r]=arguments[r]}var n=e.Utils.merge.apply(e.Utils,[this._latestState].concat(t));if(n!==this._latestState){this._latestState=n;this._state.onNext(n)}};Object.defineProperty(t.prototype,"state",{get:function(){return this._state},enumerable:true,configurable:true});Object.defineProperty(t.prototype,"latestState",{get:function(){return this._latestState},enumerable:true,configurable:true});return t}();t.Component=r})(t=e.Components||(e.Components={}))})(t=e.Bootstrap||(e.Bootstrap={}))})(p||(p={}));/* 724 * Copyright (c) 2016 - now David Sehnal, licensed under Apache 2.0, See LICENSE file for more info. 725 */ 726var p;(function(e){var t;(function(e){var t;(function(t){"use strict";var r;(function(e){e[e["Main"]=0]="Main";e[e["Top"]=1]="Top";e[e["Right"]=2]="Right";e[e["Bottom"]=3]="Bottom";e[e["Left"]=4]="Left";e[e["Root"]=5]="Root"})(r=t.LayoutRegion||(t.LayoutRegion={}));var n;(function(e){e[e["Outside"]=0]="Outside";e[e["Landscape"]=1]="Landscape";e[e["Portrait"]=2]="Portrait"})(n=t.CollapsedControlsLayout||(t.CollapsedControlsLayout={}));var i=function(){function e(e){this.cssClass=e;this.components=[]}return e}();t.LayoutTarget=i;function a(){var e=[];for(var t=0;t<=r.Root;t++){e.push(new i(r[t].toLowerCase()))}return e}t.makeEmptyTargets=a;var o=function(t){y(r,t);function r(r,i,a){var o=t.call(this,r,{isExpanded:false,hideControls:false,collapsedControlsLayout:n.Outside,regionStates:{}})||this;o.targets=i;o.root=a;o.rootState=void 0;e.Command.Layout.SetState.getStream(o.context).subscribe(function(e){return o.update(e.data)});o.expandedViewport=document.createElement("meta");o.expandedViewport.name="viewport";o.expandedViewport.content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0";return o}r.prototype.update=function(t){var r=this;var n=!!this.latestState.isExpanded;this.setState(t);if(typeof t.isExpanded==="boolean"&&t.isExpanded!==n)this.handleExpand();this.dispatcher.schedule(function(){return e.Event.Common.LayoutChanged.dispatch(r.context,{})})};r.prototype.getScrollElement=function(){if(document.scrollingElement)return document.scrollingElement;if(document.documentElement)return document.documentElement;return document.body};r.prototype.handleExpand=function(){try{var e=document.getElementsByTagName("body")[0];var t=document.getElementsByTagName("head")[0];if(!e||!t)return;if(this.latestState.isExpanded){var r=t.children;var n=false;var i=[];for(var a=0;a<r.length;a++){if(r[a]===this.expandedViewport){n=true}else if((r[a].name||"").toLowerCase()==="viewport"){i.push(r[a])}}for(var o=0,s=i;o<s.length;o++){var u=s[o];t.removeChild(u)}if(!n)t.appendChild(this.expandedViewport);var l=e.style;var c=this.getScrollElement();var f=c.scrollLeft;var h=c.scrollTop;this.rootState={top:l.top,bottom:l.bottom,right:l.right,left:l.left,scrollTop:h,scrollLeft:f,position:l.position,overflow:l.overflow,viewports:i,zindex:this.root.style.zIndex,width:l.width,height:l.height,maxWidth:l.maxWidth,maxHeight:l.maxHeight,margin:l.margin,marginLeft:l.marginLeft,marginRight:l.marginRight,marginTop:l.marginTop,marginBottom:l.marginBottom};l.overflow="hidden";l.position="fixed";l.top="0";l.bottom="0";l.right="0";l.left="0";l.width="100%";l.height="100%";l.maxWidth="100%";l.maxHeight="100%";l.margin="0";l.marginLeft="0";l.marginRight="0";l.marginTop="0";l.marginBottom="0";this.root.style.zIndex="100000"}else{var r=t.children;for(var a=0;a<r.length;a++){if(r[a]===this.expandedViewport){t.removeChild(this.expandedViewport);break}}if(this.rootState){var l=e.style,d=this.rootState;for(var p=0,m=d.viewports;p<m.length;p++){var u=m[p];t.appendChild(u)}l.top=d.top;l.bottom=d.bottom;l.left=d.left;l.right=d.right;
726l.width=d.width;l.height=d.height;l.maxWidth=d.maxWidth;l.maxHeight=d.maxHeight;l.margin=d.margin;l.marginLeft=d.marginLeft;l.marginRight=d.marginRight;l.marginTop=d.marginTop;l.marginBottom=d.marginBottom;l.position=d.position;l.overflow=d.overflow;var c=this.getScrollElement();c.scrollTop=d.scrollTop;c.scrollLeft=d.scrollLeft;this.rootState=void 0;this.root.style.zIndex=d.zindex}}}catch(e){this.context.logger.error("Layout change error, you might have to reload the page.");console.log("Layout change error, you might have to reload the page.",e)}};r.prototype.updateTargets=function(t){var r=this;this.targets=t;this.dispatcher.schedule(function(){return e.Event.Common.ComponentsChanged.dispatch(r.context,{})})};return r}(t.Component);t.Layout=o})(t=e.Components||(e.Components={}))})(t=e.Bootstrap||(e.Bootstrap={}))})(p||(p={}));/* 727 * Copyright (c) 2016 - now David Sehnal, licensed under Apache 2.0, See LICENSE file for more info. 728 */ 729var p;(function(e){var t;(function(t){var r;(function(r){var n;(function(n){"use strict";var i=function(r){y(n,r);function n(e,n,i){var a=r.call(this,e,{params:n.info.defaultParams(e,i),canApply:false,isBusy:false,issues:void 0,parametersAutoUpdating:false,isDirty:false})||this;a.transformer=n;a.entity=i;a.updateTimeout=new t.Rx.Subject;a.timeout=t.Rx.Observable.timer(50);a.never=t.Rx.Observable.never();a.anchorParams=a.latestState.params;a.updateParams(a.anchorParams);a.updateTimeout.flatMapLatest(function(e){return e}).forEach(function(){return a.apply()});return a}n.prototype._update=function(){if(this.isUpdate&&!this.latestState.isBusy){if(this.updateTimeout){this.updateTimeout.onNext(this.timeout);this.setState({parametersAutoUpdating:true})}}};n.prototype._reset=function(){this.setState({parametersAutoUpdating:false});if(this.updateTimeout)this.updateTimeout.onNext(this.never)};n.prototype._updateParams=function(e){var r=t.Utils.merge(this.latestState.params,e);if(this.transformer.info.validateParams){var n=this.transformer.info.validateParams(r);if(n&&n.length>0){this.setState({params:r,issues:n,canApply:false});return}}var i=!t.Utils.deepEqual(this.anchorParams,r);this.setState({params:r,isDirty:i,issues:void 0,canApply:true})};n.prototype.updateParams=function(e){this._reset();this._updateParams(e)};n.prototype.autoUpdateParams=function(e){this._update();this._updateParams(e)};Object.defineProperty(n.prototype,"isUpdate",{get:function(){return this.transformer===this.entity.transform.transformer},enumerable:true,configurable:true});n.prototype.apply=function(){var t=this;this._reset();if(this.latestState.isBusy)return;var r=this.transformer.create(this.latestState.params);this.anchorParams=this.latestState.params;this.setState({isDirty:false,isBusy:true});try{var n=this.isUpdate?r.update(this.context,this.entity):r.apply(this.context,this.entity);var i=n.run();i.then(function(){return t.setState({isBusy:false})}).catch(function(){return t.setState({isBusy:false})});return i}catch(t){this.setState({isBusy:false});return e.Core.Computation.reject(t)}};n.prototype.setParams=function(e){this._reset();this.anchorParams=e;this.updateParams(e)};return n}(r.Component);n.Controller=i})(n=r.Transform||(r.Transform={}))})(r=t.Components||(t.Components={}))})(t=e.Bootstrap||(e.Bootstrap={}))})(p||(p={}));/* 730 * Copyright (c) 2016 - now David Sehnal, licensed under Apache 2.0, See LICENSE file for more info. 731 */ 732var p;(function(e){var t;(function(e){var t;(function(t){var r;(function(r){"use strict";var n=function(t){y(r,t);function r(r){var n=t.call(this,r,{update:void 0,transforms:[]})||this;n.update();e.Event.Entity.CurrentChanged.getStream(r).subscribe(function(){return n.update()});return n}r.prototype.update=function(){if(!this.context.currentEntity){this.setState({transforms:[]});return}var e=this.context.currentEntity;var t=this.context.transforms;var r=void 0;if(e.transform.transformer&&e.transform.transformer.info.isUpdatable){r=t.getController(e.transform.transformer,e)}var n=[];for(var i=0,a=this.context.transforms.getBySourceType(e.type);i<a.length;i++){var o=a[i];if(o.info.isApplicable&&!o.info.isApplicable(e)){continue}var s=t.getController(o,e);if(s)n.push(s)}this.setState({update:r,transforms:n})};return r}(t.Component);r.View=n})(r=t.Transform||(t.Transform={}))})(t=e.Components||(e.Components={}))})(t=e.Bootstrap||(e.Bootstrap={}))})(p||(p={}));/* 733 * Copyright (c) 2016 - now David Sehnal, licensed under Apache 2.0, See LICENSE file for more info. 734 */ 735var p;(function(e){var t;(function(e){var t;(function(t){var r;(function(t){"use strict";var r=function(t){y(r,t);function r(){return t!==null&&t.apply(this,arguments)||this}r.prototype.updateTemplate=function(e,t){var r=t.get(e);var n=this.latestState&&this.latestState.params.style.theme;var i=r.params;var a=n||this.getThemeInstance(r.theme.template);var o={type:r.type,params:i,theme:a};this.autoUpdateParams({style:o})};r.prototype.updateStyleParams=function(t){var r=e.Utils.shallowClone(this.latestState.params.style);r.params=e.Utils.merge(r.params,t);this.autoUpdateParams({style:r})};r.prototype.updateStyleTheme=function(t){var r=e.Utils.shallowClone(this.latestState.params.style);r.theme=e.Utils.merge(r.theme,t);this.autoUpdateParams({style:r})};r.prototype.updateThemeColor=function(t,r){var n=this.latestState.params.style.theme;if(!n)return;var i=n.colors;if(!i)i=e.Immutable.Map();i=i.set(t,r);this.updateStyleTheme({colors:i})};
735r.prototype.updateThemeVariable=function(t,r){var n=this.latestState.params.style.theme;if(!n)return;var i=n.variables;if(!i)i=e.Immutable.Map();i=i.set(t,r);this.updateStyleTheme({variables:i})};r.prototype.updateThemeTransparency=function(e){var t=this.latestState.params.style.theme;if(!t)return;this.updateStyleTheme({transparency:e})};r.prototype.getThemeInstance=function(t){var r=this.latestState.params.style.theme;var n=e.Visualization.Molecule.Default.ForType.get(this.latestState.params.style.type).theme.transparency;if(!r)return{template:t,colors:t.colors,transparency:n};var i=t.colors;if(r.colors&&i){i=i.withMutations(function(e){r.colors.forEach(function(t,r){if(e.has(r))e.set(r,t)})})}var a=t.variables;if(r.variables&&a){a=a.withMutations(function(e){r.variables.forEach(function(t,r){if(e.has(r))e.set(r,t)})})}var o=r.transparency?r.transparency:n;return{template:t,colors:i,variables:a,transparency:o}};r.prototype.updateThemeDefinition=function(e){this.updateStyleTheme(this.getThemeInstance(e))};return r}(t.Controller);t.VisualStyle=r;var n=function(e){y(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t}(r);t.MoleculeVisual=n;var i=function(e){y(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t}(r);t.MoleculeLabels=i;var a=function(e){y(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t}(r);t.GenericLabels=a;var o=function(t){y(r,t);function r(){return t!==null&&t.apply(this,arguments)||this}r.prototype.cloneStyle=function(t){return e.Utils.shallowClone(this.latestState.params[t||"style"])};r.prototype.getStyle=function(e){return this.latestState.params[e||"style"]};r.prototype.setStyle=function(e,t){var r;this.autoUpdateParams((r={},r[t||"style"]=e,r))};r.prototype.updateStyleParams=function(t,r){var n=this.cloneStyle(r);n.params=e.Utils.merge(n.params,t);this.setStyle(n,r)};r.prototype.updateStyleTheme=function(t,r){var n=this.cloneStyle(r);n.theme=e.Utils.merge(n.theme,t);this.setStyle(n,r)};r.prototype.updateThemeColor=function(t,r,n){var i=this.getStyle(n).theme;if(!i)return;var a=i.colors;if(!a)a=e.Immutable.Map();a=a.set(t,r);this.updateStyleTheme({colors:a},n)};r.prototype.updateThemeTransparency=function(e,t){var r=this.getStyle(t).theme;if(!r)return;this.updateStyleTheme({transparency:e},t)};r.prototype.getThemeInstance=function(t,r){var n=this.getStyle(r).theme;var i=e.Visualization.Density.Default.Transparency;if(!n)return{template:t,colors:t.colors,transparency:i};var a=t.colors;if(n.colors&&a){a=a.withMutations(function(e){n.colors.forEach(function(t,r){if(e.has(r))e.set(r,t)})})}var o=n.transparency?n.transparency:i;return{template:t,colors:a,transparency:o}};r.prototype.updateThemeDefinition=function(e,t){this.updateStyleTheme(this.getThemeInstance(e,t),t)};return r}(t.Controller);t.DensityVisual=o})(r=t.Transform||(t.Transform={}))})(t=e.Components||(e.Components={}))})(t=e.Bootstrap||(e.Bootstrap={}))})(p||(p={}));/* 736 * Copyright (c) 2016 - now David Sehnal, licensed under Apache 2.0, See LICENSE file for more info. 737 */ 738var p;(function(e){var t;(function(e){var t;(function(t){var r;(function(r){"use strict";var n=function(t){y(r,t);function r(r,n,i){var a=t.call(this,r,{controller:void 0})||this;a.selector=n;a.header=i;e.Event.Tree.NodeAdded.getStream(r).subscribe(function(){return a.added()});e.Event.Tree.NodeRemoved.getStream(r).subscribe(function(e){return a.removed(e.data)});return a}r.prototype.removed=function(e){if(!this.latestState.controller)return;var t=this.latestState.controller.entity;if(t===e){this.setState({controller:void 0})}};r.prototype.added=function(){var e=this.context.select(this.selector);var t=e[0];if(!t||!t.transform)return;var r=this.context.transforms.getController(t.transform.transformer,t);if(!r)return;this.setState({controller:r})};return r}(t.Component);r.Updater=n})(r=t.Transform||(t.Transform={}))})(t=e.Components||(e.Components={}))})(t=e.Bootstrap||(e.Bootstrap={}))})(p||(p={}));/* 739 * Copyright (c) 2016 - now David Sehnal, licensed under Apache 2.0, See LICENSE file for more info. 740 */ 741var p;(function(e){var t;(function(e){var t;(function(t){var r;(function(r){"use strict";var n=function(t){y(r,t);function r(r,n,i,a){var o=t.call(this,r,{controller:void 0})||this;o.selector=n;o.transformer=i;o.header=a;e.Event.Tree.NodeAdded.getStream(r).subscribe(function(){return o.added()});e.Event.Tree.NodeRemoved.getStream(r).subscribe(function(e){return o.removed(e.data)});return o}r.prototype.removed=function(e){if(!this.latestState.controller)return;var t=this.latestState.controller.entity;if(t===e){this.setState({controller:void 0})}};r.prototype.added=function(){var e=this.context.select(this.selector);var t=e[0];if(!t)return;var r=this.context.transforms.getController(this.transformer,t);if(!r)return;this.setState({controller:r})};return r}(t.Component);r.Action=n})(r=t.Transform||(t.Transform={}))})(t=e.Components||(e.Components={}))})(t=e.Bootstrap||(e.Bootstrap={}))})(p||(p={}));/* 742 * Copyright (c) 2016 - now David Sehnal, licensed under Apache 2.0, See LICENSE file for more info. 743 */ 744var p;(function(e){var t;(function(e){var t;(function(t){var r;(function(r){"use strict";var n=function(t){y(r,t);function r(r){var n=t.call(this,r,{entries:e.Immutable.List()})||this;e.Event.Log.getStream(n.context).subscribe(function(e){return n.setState({entries:n.latestState.entries.push(e.data)})});return n}return r}(t.Component);r.Log=n})(r=t.Context||(t.Context={}))})(t=e.Components||(e.Components={}))})(t=e.Bootstrap||(e.Bootstrap={}))})(p||(p={}));/* 745 * Copyright (c) 2016 - now David Sehnal, licensed under Apache 2.0, See LICENSE file for more info. 746 */ 747var p;(function(e){var t;(function(e){var t;(function(t){var r;(function(r){"use strict";var n=function(t){y(r,t);function r(r){var n=t.call(this,r,{entries:e.Immutable.Map()})||this;n.serialNumber=0;n.serialId=0;e.Command.Toast.Show.getStream(n.context).subscribe(function(e){return n.show(e.data)});e.Command.Toast.Hide.getStream(n.context).subscribe(function(e){return n.hide(n.findByKey(e.data.key))});return n}r.prototype.findByKey=function(e){return this.latestState.entries.find(function(t){return!!t&&t.key===e})};r.prototype.show=function(e){var t=this;var r=this.latestState.entries;var n=void 0;var i=++this.serialId;var a;if(e.key&&(n=this.findByKey(e.key))){if(n.timeout!==void 0)clearTimeout(n.timeout);a=n.serialNumber;r=r.remove(n.id)}else{a=++this.serialNumber}
747n={id:i,serialNumber:a,key:e.key,title:e.title,message:e.message,timeout:this.timeout(i,e.timeoutMs),hide:function(){return t.hideId(i)}};r=r.set(i,n);this.setState({entries:r})};r.prototype.timeout=function(e,t){var r=this;if(t===void 0)return void 0;if(t<0)t=500;return setTimeout(function(){var t=r.latestState.entries.get(e);t.timeout=void 0;r.hide(t)},t)};r.prototype.hideId=function(e){this.hide(this.latestState.entries.get(e))};r.prototype.hide=function(e){if(!e)return;if(e.timeout!==void 0)clearTimeout(e.timeout);e.hide=void 0;var t=this.latestState.entries;t=t.delete(e.id);this.setState({entries:t})};return r}(t.Component);r.Toast=n})(r=t.Context||(t.Context={}))})(t=e.Components||(e.Components={}))})(t=e.Bootstrap||(e.Bootstrap={}))})(p||(p={}));/* 748 * Copyright (c) 2016 - now David Sehnal, licensed under Apache 2.0, See LICENSE file for more info. 749 */ 750var p;(function(e){var t;(function(e){var t;(function(t){var r;(function(r){"use strict";var n=function(t){y(r,t);function r(r,n){var i=t.call(this,r,{tasks:e.Immutable.Map()})||this;i.type=n;e.Event.Task.StateUpdated.getStream(i.context).subscribe(function(e){return i.updated(e.data)});e.Event.Task.Started.getStream(i.context).filter(function(e){return e.data.type===n}).subscribe(function(e){return i.started(e.data)});e.Event.Task.Completed.getStream(i.context).subscribe(function(e){return i.completed(e.data)});return i}r.prototype.updated=function(e){var t=e.type===this.type;var r=this.latestState.tasks;if(!t){if(r.has(e.taskId)){r=r.delete(e.taskId);this.setState({tasks:r})}return}r=r.set(e.taskId,{name:e.name,message:e.message,abort:e.abort});this.setState({tasks:r})};r.prototype.started=function(e){this.setState({tasks:this.latestState.tasks.set(e.id,{name:e.name,message:"Running..."})})};r.prototype.completed=function(e){if(!this.latestState.tasks.has(e))return;this.setState({tasks:this.latestState.tasks.delete(e)})};return r}(t.Component);r.TaskWatcher=n})(r=t.Context||(t.Context={}))})(t=e.Components||(e.Components={}))})(t=e.Bootstrap||(e.Bootstrap={}))})(p||(p={}));/* 751 * Copyright (c) 2016 - now David Sehnal, licensed under Apache 2.0, See LICENSE file for more info. 752 */ 753var p;(function(e){var t;(function(e){var t;(function(t){var r;(function(r){"use strict";var n=function(t){y(r,t);function r(r){var n=t.call(this,r,{info:[]})||this;e.Event.Interactivity.Highlight.getStream(n.context).subscribe(function(e){return n.setState({info:e.data})});return n}return r}(t.Component);r.HighlightInfo=n})(r=t.Visualization||(t.Visualization={}))})(t=e.Components||(e.Components={}))})(t=e.Bootstrap||(e.Bootstrap={}))})(p||(p={}));/* 754 * Copyright (c) 2016 - now David Sehnal, licensed under Apache 2.0, See LICENSE file for more info. 755 */ 756var p;(function(e){var t;(function(t){var r;(function(r){var n;(function(n){"use strict";var i=e.Visualization;var a=function(r){y(n,r);function n(e){var n=r.call(this,e,t.Utils.shallowClone(i.DefaultSceneOptions))||this;t.Event.Common.LayoutChanged.getStream(n.context).subscribe(function(e){if(n._scene)n._scene.scene.resized()});t.Command.Layout.SetViewportOptions.getStream(n.context).subscribe(function(e){return n.setState(e.data)});n.state.throttle(1e3/30).subscribe(function(e){n.scene.scene.updateOptions(e)});return n}Object.defineProperty(n.prototype,"scene",{get:function(){return this._scene},enumerable:true,configurable:true});n.prototype.init=function(r){if(!e.Visualization.checkWebGL())return false;try{this._scene=new t.Visualization.SceneWrapper(r,this.context,this.latestState);this.context.scene=this._scene;return true}catch(e){return false}};n.prototype.destroy=function(){if(this._scene){this._scene.destroy();this._scene=null}};return n}(r.Component);n.Viewport=a})(n=r.Visualization||(r.Visualization={}))})(r=t.Components||(t.Components={}))})(t=e.Bootstrap||(e.Bootstrap={}))})(p||(p={}));/* 757 * Copyright (c) 2016 - now David Sehnal, licensed under Apache 2.0, See LICENSE file for more info. 758 */ 759var p;(function(e){var t;(function(t){"use strict";var r=function(){function t(){this.settings=e.Core.Utils.FastMap.create()}t.prototype.set=function(e,t){this.settings.set(e,t)};t.prototype.get=function(e){return this.settings.get(e)};return t}();t.Settings=r;var n=function(){function n(n){this.plugin=n;this.id=t.Utils.generateUUID();this.dispatcher=new t.Service.Dispatcher;this.logger=new t.Service.Logger(this);this.performance=new e.Core.Utils.PerformanceMonitor;this.scene=void 0;this.tree=t.Tree.create(this,t.Entity.Root.create(t.Entity.RootTransform,{label:"Root Entity"}));this.currentEntity=void 0;this.transforms=new t.TransformManager(this);this.entityCache=new t.Entity.Cache(this);this.viewport=new t.Components.Visualization.Viewport(this);this.highlight=new t.Interactivity.HighlightManager(this);this.behaviours=new t.Behaviour.Streams(this);this.settings=new r;t.initEventsAndCommands(this)}n.prototype.createLayout=function(e,r){this.layout=new t.Components.Layout(this,e,r)};n.prototype.select=function(e){return t.Tree.Selection.select(e,this.tree)};return n}();t.Context=n})(t=e.Bootstrap||(e.Bootstrap={}))})(p||(p={}));/* 760 * Copyright (c) 2016 - now David Sehnal, licensed under Apache 2.0, See LICENSE file for more info. 761 */ 762var p;(function(e){var t;(function(e){var t;(function(e){"use strict"})(t=e.Plugin||(e.Plugin={}))})(t=e.Bootstrap||(e.Bootstrap={}))})(p||(p={}));/* 763 * Copyright (c) 2016 - now David Sehnal, licensed under Apache 2.0, See LICENSE file for more info. 764 */ 765var p;(function(e){var t;(function(e){"use strict";function t(t,r){if(!e.Utils.Molecule.findModelOrSelection(r.entity)){console.warn("Select: Trying to create a selection event on a non-molecule related entity, ignoring...");return}var n=e.Utils.Molecule.getModelAndIndicesFromQuery(r.entity,r.query);if(!n||!n.indices.length)return;e.Event.Visual.VisualSelectElement.dispatch(t,e.Interactivity.Info.selection(r.entity,n.indices))}function r(r){e.Command.Entity.SetCurrent.getStream(r).subscribe(function(t){return e.Entity.setCurrent(t.data)});e.Command.Entity.SetVisibility.getStream(r).subscribe(function(t){return e.Entity.setVisibility(t.data.entity,t.data.visible)});e.Command.Entity.ToggleExpanded.getStream(r).subscribe(function(t){return e.Entity.toggleExpanded(t.data)});e.Command.Tree.RemoveNode.getStream(r).subscribe(function(t){return r.select(t.data).forEac
765h(function(t){return e.Tree.remove(t)})});e.Command.Tree.ApplyTransform.getStream(r).subscribe(function(e){(e.data.isUpdate?e.data.transform.update(r,e.data.node):e.data.transform.apply(r,e.data.node)).run()});e.Event.Tree.NodeAdded.getStream(r).subscribe(function(t){var r=t.data.parent.state.visibility;var n=r!==2;e.Entity.setVisibility(t.data,n);if(e.Entity.isClass(t.data,e.Entity.BehaviourClass)){var i=t.data;i.props.behaviour.register(i)}});e.Event.Tree.NodeRemoved.getStream(r).subscribe(function(t){e.Entity.updateVisibilityState(t.data.parent);if(e.Entity.isClass(t.data,e.Entity.BehaviourClass)){var r=t.data;r.props.behaviour.dispose()}});e.Event.Visual.VisualHoverElement.getStream(r).distinctUntilChanged(function(e){return e.data},e.Interactivity.interactivityInfoEqual).map(function(t){return e.Interactivity.Molecule.transformInteraction(t.data)}).distinctUntilChanged(function(e){return e},function(e,t){return e===t}).subscribe(function(t){return e.Event.Molecule.ModelHighlight.dispatch(r,t)});e.Event.Visual.VisualSelectElement.getStream(r).distinctUntilChanged(function(e){return e.data},e.Interactivity.interactivityInfoEqual).map(function(t){return e.Interactivity.Molecule.transformInteraction(t.data)}).distinctUntilChanged(function(e){return e},function(e,t){return e===t}).subscribe(function(t){return e.Event.Molecule.ModelSelect.dispatch(r,t)});e.Command.Molecule.CreateSelectInteraction.getStream(r).subscribe(function(e){return t(r,e.data)})}e.initEventsAndCommands=r})(t=e.Bootstrap||(e.Bootstrap={}))})(p||(p={}));/* 766 * Copyright (c) 2016 - now David Sehnal, licensed under Apache 2.0, See LICENSE file for more info. 767 */ 768var p;(function(e){var t;(function(t){"use strict";var r=function(){function r(r){var n=this;this.context=r;this.controllerCache=e.Core.Utils.FastMap.create();this.state=e.Core.Utils.FastMap.create();this.byId=e.Core.Utils.FastMap.create();this.bySourceType=e.Core.Utils.FastMap.create();this.byTargetType=e.Core.Utils.FastMap.create();t.Event.Tree.NodeRemoved.getStream(r).subscribe(function(e){n.controllerCache.delete(e.data.id);n.state.delete(e.data.id)})}r.prototype.addType=function(e,t,r){var n=r.get(e.id);if(!n)r.set(e.id,[t]);else n.push(t)};r.prototype.getController=function(r,n){if(!n){console.warn("Trying to get controller for undefined entity.");return void 0}if(!this.byId.get(r.info.id)){console.warn("Trying to get controller for unregistered transform ("+r.info.id+").");return void 0}var i=this.controllerCache.get(n.id);if(!i){i=e.Core.Utils.FastMap.create();this.controllerCache.set(n.id,i)}var a=i.get(r.info.id);if(a)return a;var o=r.info.customController;if(o)a=o(this.context,r,n);else a=new t.Components.Transform.Controller(this.context,r,n);var s=this.context.plugin&&this.context.plugin.getTransformerInfo(r);if(s&&s.initiallyCollapsed){if(!this.hasPersistentState(r,n,"isExpanded"))this.setPersistentState(r,n,"isExpanded",false)}else{if(!this.hasPersistentState(r,n,"isExpanded"))this.setPersistentState(r,n,"isExpanded",true)}if(n.transform.transformer===r){a.setParams(n.transform.params)}i.set(r.info.id,a);return a};r.prototype.getBySourceType=function(e){return this.bySourceType.get(e.id)||[]};r.prototype.getByTargetType=function(e){return this.byTargetType.get(e.id)||[]};r.prototype.add=function(e){if(this.byId.has(e.info.id)){throw"Transformer with id '"+e.info.id+"' is has already been added. Pick another id."}this.byId.set(e.info.id,e);for(var t=0,r=e.info.from;t<r.length;t++){var n=r[t];this.addType(n,e,this.bySourceType)}for(var i=0,a=e.info.to;i<a.length;i++){var n=a[i];this.addType(n,e,this.byTargetType)}};r.prototype.hasPersistentState=function(e,t,r){var n=this.state.get(t.id);if(!n)return false;var i=n.get(e.info.id);if(!i||!i.has(r))return false;return true};r.prototype.getPersistentState=function(e,t,r,n){var i=this.state.get(t.id);if(!i)return n;var a=i.get(e.info.id);if(!a||!a.has(r))return n;return a.get(r)};r.prototype.setPersistentState=function(t,r,n,i){var a=this.state.get(r.id);if(!a){a=e.Core.Utils.FastMap.create();this.state.set(r.id,a)}var o=a.get(t.info.id);if(!o){o=e.Core.Utils.FastMap.create();a.set(t.info.id,o)}var s=o.get(n);o.set(n,i);return s!==i};return r}();t.TransformManager=r})(t=e.Bootstrap||(e.Bootstrap={}))})(p||(p={}));/* 769 * Copyright (c) 2016 - now David Sehnal, licensed under Apache 2.0, See LICENSE file for more info. 770 */ 771var p;(function(e){var t;(function(e){e.VERSION={number:"1.3.4",date:"September 7 2017"}})(t=e.Plugin||(e.Plugin={}))})(p||(p={}));/* 772 * Copyright (c) 2016 - now David Sehnal, licensed under Apache 2.0, See LICENSE file for more info. 773 */ 774var p;(function(e){var t;(function(e){"use strict";e.React=f;e.ReactDOM=h;var t;(function(e){})(t=e.Controls||(e.Controls={}));t.ChromePickerHelper=d.ChromePicker})(t=e.Plugin||(e.Plugin={}))})(p||(p={}));/* 775 * Copyright (c) 2016 - now David Sehnal, licensed under Apache 2.0, See LICENSE file for more info. 776 */ 777var p;(function(e){var t;(function(t){var r;(function(r){"use strict";var n=e.Bootstrap.Utils.shallowEqual;var i=function(e){y(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}t.prototype.shouldComponentUpdate=function(e,t){return!n(this.props,e)||!n(this.state,t)};return t}(t.React.Component);r.Pure=i;var a=function(e){y(r,e);function r(){return e!==null&&e.apply(this,arguments)||this}r.prototype.render=function(){var e=this.props;var r="lm-btn";if(e.size&&e.size!=="normal")r+=" lm-btn-"+e.size;if(e.asBlock)r+=" lm-btn-block";if(e.disabled)r+=" lm-btn-"+(e.disabledStyle||e.style||"default");else if(e.active)r+=" lm-btn-"+(e.activeStyle||e.style||"default");else r+=" lm-btn-"+(e.style||"default");if(e.customClass)r+=" "+e.customClass;var n=void 0;if(e.icon){if(e.active&&e.activeIcon)n=t.React.createElement("span",{className:"lm-icon lm-icon-"+e.activeIcon});else n=t.React.createElement("span",{className:"lm-icon lm-icon-"+e.icon})}return t.React.createElement("button",{title:e.title,className:r,style:e.customStyle,disabled:e.disabled,onClick:function(t){e.onClick.call(null,t);t.target.blur()}},n,e.children)};return r}(i);r.Button=a;r.TextBox=function(e){return t.React.createElement("input",{type:"text",className:"lm-form-control",placeholder:e.placeholder,value:e.value,defaultValue:e.defaultValue,onBlur:function(t){if(e.onBlur)e.onBlur.call(null,t)},onChange:function(t){return e.onChange.call(null,t.target.value)},onKeyPress:e.onKeyPress})};function o(e){if(e.keyCode===13||e.charCode===13){return true}return false}r.isEnter=o;function s(e){return t.React.createElement("div",{className:"lm-control-row lm-options-group",title:e.title},t.React.createElement("span",null,e.label),t.React.createElement("div",null,t.React.createElement(r.TextBox,{placeholder:e.placeholder,onChange:e.onChange,value:e.value,onKeyPress:function(t){if(o(t)&&e.onEnter)e.onEnter.call(null,t)}})))}r.TextBoxGroup=s;r.CommitButton=function(e){return t.React.createElement("div",{style:{marginTop:"1px"}},t.React.createElement("button",{onClick:function(t){e.action();t.target.blur()},className:"lm-btn lm-btn-block lm-btn-commit lm-btn-commit-"+(e.isOn?"on":"off"),disabled:!e.isOn,title:e.title},t.React.createElement("span",{className:"lm-icon lm-icon-"+(e.isOn?"ok":"cross")}),e.isOn?t.React.createElement("b",null,e.on):e.off?e.off:e.on))};r.Toggle=function(e){return t.React.createElement("div",{className:"lm-control-row lm-toggle-button",title:e.title},t.React.createElement("span",null,e.label),t.React.createElement("div",null,t.React.createElement("button",{onClick:function(t){e.onChange.call(null,!e.value);t.target.blur()}},t.React.createElement("span",{className:"lm-icon lm-icon-"+(e.value?"ok":"off")})," ",e.value?"On":"Off")))};r.ControlGroupExpander=function(e){return t.React.createElement(r.Button,{style:"link",title:(e.isExpanded?"Less":"More")+" options",onClick:function(){return e.onChange.call(null,!e.isExpanded)},icon:e.isExpanded?"minus":"plus",customClass:"lm-conrol-group-expander"})};r.RowText=function(e){return t.React.createElement("div",{className:"lm-control-row lm-row-text",title:e.title},t.React.createElement("span",null,e.label),t.React.createElement("div",null,e.value))};r.HelpBox=function(e){return t.React.createElement("div",{className:"lm-help-row"},t.React.createElement("span",null,e.title),t.React.createElement("div",null,e.content))}})(r=t.Controls||(t.Controls={}))})(t=e.Plugin||(e.Plugin={}))})(p||(p={}));/* 778 * Copyright (c) 2016 - now David Sehnal, licensed under Apache 2.0, See LICENSE file for more info. 779 */ 780var p;(function(e){var t;(function(e){var t;(function(t){"use strict";var r=function(t){y(r,t);function r(){var e=t!==null&&t.apply(this,arguments)||this;e.current=void 0;return e}r.prototype.get=function(e){var t=this.props.options;if(typeof t.get!=="undefined")return t.get(e);return t[e]};r.prototype.render=function(){var t=this;var r=this.props.caption;var n=this.props.options.indexOf(this.props.current);if(n<0)n=0;return e.React.createElement("select",{title:this.props.title,value:n.toString(),className:"lm-form-control",onChange:function(e){t.current=t.get(+e.target.value);t.props.onChange(t.current)}},this.props.options.map(function(t,n){return e.React.createElement("option",{key:n,value:""+n},r(t))}))};return r}(e.React.Component);t.OptionsBox=r;function n(r){var n=r.caption?r.caption:function(e){return e};return e.React.createElement("div",{className:"lm-control-row lm-options-group",title:r.title},e.React.createElement("span",null,r.label),e.React.createElement("div",null,e.React.createElement(t.OptionsBox,{options:r.options,caption:n,current:r.current,onChange:r.onChange}
780)))}t.OptionsGroup=n})(t=e.Controls||(e.Controls={}))})(t=e.Plugin||(e.Plugin={}))})(p||(p={}));/* 781 * Copyright (c) 2016 - now David Sehnal, licensed under Apache 2.0, See LICENSE file for more info. 782 */ 783var p;(function(e){var t;(function(e){var t;(function(t){"use strict";var r=function(r){y(n,r);function n(){return r!==null&&r.apply(this,arguments)||this}n.prototype.header=function(){var r=this;var n=this.props.isExpanded;var i=this.props.title?this.props.title:this.props.header;var a=n?"collapse":"expand";var o=e.React.createElement("div",{className:"lm-panel-description lm-panel-description-"+(this.props.topRightAction?"with-action":"standalone"),onClick:function(){return r.props.onExpand.call(null,!r.props.isExpanded)}},e.React.createElement("span",{className:"lm-icon lm-icon-info"}),e.React.createElement("div",{className:"lm-panel-description-content"},e.React.createElement("span",{className:"lm-icon lm-icon-info"}),this.props.description));return e.React.createElement("div",{className:"lm-panel-header"},o,this.props.topRightAction,e.React.createElement("div",{className:"lm-panel-expander-wrapper"},e.React.createElement(t.Button,{title:i,onClick:function(){return r.props.onExpand.call(null,!r.props.isExpanded)},icon:a,customClass:"lm-panel-expander",style:"link"},this.props.badge,this.props.header)))};n.prototype.render=function(){var t="lm-panel"+(this.props.className?" "+this.props.className:"")+(this.props.isExpanded?" lm-panel-expanded":" lm-panel-collapsed");return e.React.createElement("div",{className:t},this.header(),e.React.createElement("div",{className:"lm-panel-body",style:{display:this.props.isExpanded?"block":"none"}},this.props.children))};return n}(e.React.Component);t.Panel=r;t.ExpandableGroup=function(t){return e.React.createElement("div",{className:"lm-control-group"},t.select,t.colorStripe?e.React.createElement("div",{className:"lm-expandable-group-color-stripe",style:{backgroundColor:"rgb("+(255*t.colorStripe.r|0)+", "+(255*t.colorStripe.g|0)+", "+(255*t.colorStripe.b|0)+")"}}):void 0,t.options.length>0?t.expander:void 0,t.options.length>0?e.React.createElement("div",{style:{display:t.isExpanded?"block":"none"},className:"lm-control-subgroup"},t.options):void 0)}})(t=e.Controls||(e.Controls={}))})(t=e.Plugin||(e.Plugin={}))})(p||(p={}));/* 784 * Copyright (c) 2016 - now David Sehnal, licensed under Apache 2.0, See LICENSE file for more info. 785 */ 786var g=this&&this.__assign||Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++){t=arguments[r];for(var i in t)if(Object.prototype.hasOwnProperty.call(t,i))e[i]=t[i]}return e};var p;(function(e){var t;(function(e){var t;(function(t){"use strict";var r=function(r){y(n,r);function n(){var e=r!==null&&r.apply(this,arguments)||this;e.state={value:"0"};e.firedValue=NaN;return e}n.prototype.componentWillMount=function(){this.setState({value:""+this.props.value})};n.prototype.componentWillReceiveProps=function(e){this.setState({value:""+e.value})};n.prototype.updateValue=function(e){var t=+e;if(t<this.props.min){t=this.props.min;e=""+t}else if(t>this.props.max){t=this.props.max;e=""+t}this.setState({value:e})};n.prototype.fire=function(){var e=+this.state.value;if(isNaN(e)){e=this.props.value}if(e!==this.props.value){if(this.firedValue!==e){this.firedValue=e;this.props.onChange.call(null,e)}}};n.prototype.render=function(){var r=this;var n=this.props.step;if(n===void 0)n=1;return e.React.createElement("div",{className:"lm-control-row lm-slider",title:this.props.title},e.React.createElement("span",null,this.props.label),e.React.createElement("div",null,e.React.createElement("div",null,e.React.createElement("div",null,e.React.createElement(f,{min:this.props.min,max:this.props.max,step:n,value:+this.state.value,onChange:function(e){return r.setState({value:""+e})},onAfterChange:function(e){return r.fire()}}))),e.React.createElement("div",null,e.React.createElement(t.TextBox,{value:this.state.value,onChange:function(e){return r.updateValue(e)},onBlur:function(){return r.fire()},onKeyPress:function(e){if(t.isEnter(e))r.fire()}}))))};return n}(e.React.Component);t.Slider=r;/** 787 * The following code was adapted from react-components/slider library. 788 * 789 * The MIT License (MIT) 790 * Copyright (c) 2015-present Alipay.com, https://www.alipay.com/ 791 * 792 * Permission is hereby granted, free of charge, to any person obtaining a copy 793 * of this software and associated documentation files (the "Software"), to deal 794 * in the Software without restriction, including without limitation the rights 795 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 796 * copies of the Software, and to permit persons to whom the Software is 797 * furnished to do so, subject to the following conditions: 798 799 * The above copyright notice and this permission notice shall be included in 800 * all copies or substantial portions of the Software. 801 802 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 803 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 804 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 805 * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 806 * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 807 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 808 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 809 */ 810function n(e){var t=[];var r={}.hasOwnProperty;for(var i=0;i<arguments.length;i++){var a=arguments[i];if(!a)continue;var o=typeof a;
810if(o==="string"||o==="number"){t.push(a)}else if(Array.isArray(a)){t.push(n.apply(null,a))}else if(o==="object"){for(var s in a){if(r.call(a,s)&&a[s]){t.push(s)}}}}return t.join(" ")}function i(){}function a(e){return e.touches.length>1||e.type.toLowerCase()==="touchend"&&e.touches.length>0}function o(e,t){return e?t.touches[0].clientY:t.touches[0].pageX}function s(e,t){return e?t.clientY:t.pageX}function u(e,t){var r=t.getBoundingClientRect();return e?r.top+r.height*.5:r.left+r.width*.5}function l(e){e.stopPropagation();e.preventDefault()}var c=function(t){y(r,t);function r(){return t!==null&&t.apply(this,arguments)||this}r.prototype.render=function(){var t=this.props,r=t.className,n=t.tipFormatter,i=t.vertical,a=t.offset,o=t.value,s=t.index;var u=i?{bottom:a+"%"}:{left:a+"%"};return e.React.createElement("div",{className:r,style:u,title:n(o,s)})};return r}(e.React.Component);t.Handle=c;var f=function(t){y(r,t);function r(e){var r=t.call(this,e)||this;r.sliderElement=void 0;r.handleElements=[];r.dragOffset=0;r.startPosition=0;r.startValue=0;r._getPointsCache=void 0;r.eventHandlers={touchmove:function(e){return r.onTouchMove(e)},touchend:function(e){return r.end("touch")},mousemove:function(e){return r.onMouseMove(e)},mouseup:function(e){return r.end("mouse")}};var n=e.range,i=e.min,a=e.max;var o=n?Array.apply(null,Array(+n+1)).map(function(){return i}):i;var s="defaultValue"in e?e.defaultValue:o;var u=e.value!==undefined?e.value:s;var l=(n?u:[i,u]).map(function(e){return r.trimAlignValue(e)});var c;if(n&&l[0]===l[l.length-1]&&l[0]===a){c=0}else{c=l.length-1}r.state={handle:null,recent:c,bounds:l};return r}r.prototype.componentWillReceiveProps=function(e){var t=this;if(!("value"in e||"min"in e||"max"in e))return;var r=this.state.bounds;if(e.range){var n=e.value||r;var i=n.map(function(r){return t.trimAlignValue(r,e)});if(i.every(function(e,t){return e===r[t]}))return;this.setState({bounds:i});if(r.some(function(r){return t.isValueOutOfBounds(r,e)})){this.props.onChange(i)}}else{var n=e.value!==undefined?e.value:r[1];var a=this.trimAlignValue(n,e);if(a===r[1]&&r[0]===e.min)return;this.setState({bounds:[e.min,a]});if(this.isValueOutOfBounds(r[1],e)){this.props.onChange(a)}}};r.prototype.onChange=function(e){var t=this.props;var r=!("value"in t);if(r){this.setState(e)}else if(e.handle!==undefined){this.setState({handle:e.handle})}var n=g({},this.state,e);var i=t.range?n.bounds:n.bounds[1];t.onChange(i)};r.prototype.onMouseDown=function(e){if(e.button!==0){return}var t=s(this.props.vertical,e);if(!this.isEventFromHandle(e)){this.dragOffset=0}else{var r=u(this.props.vertical,e.target);this.dragOffset=t-r;t=r}this.onStart(t);this.addDocumentEvents("mouse");l(e)};r.prototype.onMouseMove=function(e){var t=s(this.props.vertical,e);this.onMove(e,t-this.dragOffset)};r.prototype.onMove=function(e,t){l(e);var r=this.props;var n=this.state;var i=t-this.startPosition;i=this.props.vertical?-i:i;var a=i/this.getSliderLength()*(r.max-r.min);var o=this.trimAlignValue(this.startValue+a);var s=n.bounds[n.handle];if(o===s)return;var u=n.bounds.slice();u[n.handle]=o;var c=n.handle;if(r.pushable!==false){var f=n.bounds[c];this.pushSurroundingHandles(u,c,f)}else if(r.allowCross){u.sort(function(e,t){return e-t});c=u.indexOf(o)}this.onChange({handle:c,bounds:u})};r.prototype.onStart=function(e){var t=this.props;t.onBeforeChange(this.getValue());var r=this.calcValueByPos(e);this.startValue=r;this.startPosition=e;var n=this.state;var i=n.bounds;var a=1;if(this.props.range){var o=0;for(var s=1;s<i.length-1;++s){if(r>i[s]){o=s}}if(Math.abs(i[o+1]-r)<Math.abs(i[o]-r)){o=o+1}a=o;var u=i[o+1]===i[o];if(u){a=n.recent}if(u&&r!==i[o+1]){a=r<i[o+1]?o:o+1}}this.setState({handle:a,recent:a});var l=n.bounds[a];if(r===l)return;var c=n.bounds.slice();c[a]=r;this.onChange({bounds:c})};r.prototype.onTouchMove=function(e){if(a(e)){this.end("touch");return}var t=o(this.props.vertical,e);this.onMove(e,t-this.dragOffset)};r.prototype.onTouchStart=function(e){if(a(e))return;var t=o(this.props.vertical,e);if(!this.isEventFromHandle(e)){this.dragOffset=0}else{var r=u(this.props.vertical,e.target);this.dragOffset=t-r;t=r}this.onStart(t);this.addDocumentEvents("touch");l(e)};r.prototype.getPoints=function(){var e=this.props,t=e.marks,r=e.step,n=e.min,i=e.max;var a=this._getPointsCache;if(!a||a.marks!==t||a.step!==r){var o=g({},t);if(r!==null){for(var s=n;s<=i;s+=r){o[s]=s}}var u=Object.keys(o).map(parseFloat);u.sort(function(e,t){return e-t});this._getPointsCache={marks:t,step:r,points:u}}return this._getPointsCache.points};r.prototype.getPrecision=function(e){var t=e.toString();var r=0;if(t.indexOf(".")>=0){r=t.length-t.indexOf(".")-1}return r};r.prototype.getSliderLength=function(){var e=this.sliderElement;if(!e){return 0}return this.props.vertical?e.clientHeight:e.clientWidth};r.prototype.getSliderStart=function(){var e=this.sliderElement;var t=e.getBoundingClientRect();return this.props.vertical?t.top:t.left};r.prototype.getValue=function(){var e=this.state.bounds;return this.props.range?e:e[1]};r.prototype.addDocumentEvents=function(e){if(e==="touch"){document.addEventListener("touchmove",this.eventHandlers.touchmove);document.addEventListener("touchend",this.eventHandlers.touchend)}else if(e==="mouse"){document.addEventListener("mousemove",this.eventHandlers.mousemove);document.addEventListener("mouseup",this.eventHandlers.mouseup)}};r.prototype.calcOffset=function(e){var t=this.props,r=t.min,n=t.max;var i=(e-r)/(n-r);return i*100};r.prototype.calcValue=function(e){var t=this.props,r=t.vertical,n=t.min,i=t.max;var a=Math.abs(e/this.getSliderLength());var o=r?(1-a)*(i-n)+n:a*(i-n)+n;return o};r.prototype.calcValueByPos=function(e){var t=e-this.getSliderStart();var r=this.trimAlignValue(this.calcValue(t));return r};r.prototype.end=function(e){this.removeEvents(e);this.props.onAfterChange(this.getValue());this.setState({handle:null})};r.prototype.isEventFromHandle=function(e){for(var t=0,r=this.handleElements;t<r.length;t++){var n=r[t];if(n===e.target)return true}return false};r.prototype.isValueOutOfBounds=function(e,t){return e<t.min||e>t.max};r.prototype.pushHandle=function(e,t,r,n){var i=e[t];var a=e[t];while(r*(a-i)<n){if(!this.pushHandleOnePoint(e,t,r)){e[t]=i;return false}a=e[t]}return true};r.prototype.pushHandleOnePoint=function(e,t,r){var n=this.getPoints();var i=n.indexOf(e[t]);var a=i+r;if(a>=n.length||a<0){return false}var o=t+r;var s=n[a];var u=this.props.pushable;var l=r*(e[o]-s);if(!this.pushHandle(e,o,r,+u-l)){return false}e[t]=s;return true};r.prototype.pushSurroundingHandles=function(e,t,r){var n=this.props.pushable;var i=e[t];var a=0;if(e[t+1]-i<n){a=+1}else if(i-e[t-1]<n){a=-1}if(a===0){return}var o=t+a;var s=a*(e[o]-i);if(!this.pushHandle(e,o,a,+n-s)){e[t]=r}};r.prototype.removeEvents=function(e){if(e==="touch"){document.removeEventListener("touchmove",this.eventHandlers.touchmove);document.removeEventListener("touchend",this.eventHandlers.touchend)}else if(e==="mouse"){document.removeEventListener("mousemove",this.eventHandlers.mousemove);document.removeEventListener("mouseup",this.eventHandlers.mouseup)}};r.prototype.trimAlignValue=function(e,t){var r=this.state||{}
810,n=r.handle,i=r.bounds;var a=g({},this.props,t||{}),o=a.marks,s=a.step,u=a.min,l=a.max,c=a.allowCross;var f=e;if(f<=u){f=u}if(f>=l){f=l}if(!c&&n!=null&&n>0&&f<=i[n-1]){f=i[n-1]}if(!c&&n!=null&&n<i.length-1&&f>=i[n+1]){f=i[n+1]}var h=Object.keys(o).map(parseFloat);if(s!==null){var d=Math.round((f-u)/s)*s+u;h.push(d)}var p=h.map(function(e){return Math.abs(f-e)});var m=h[p.indexOf(Math.min.apply(Math,p))];return s!==null?parseFloat(m.toFixed(this.getPrecision(s))):m};r.prototype.render=function(){var t;var r=this;var a=this.state,o=a.handle,s=a.bounds;var u=this.props,l=u.className,c=u.prefixCls,f=u.disabled,d=u.vertical,m=u.dots,v=u.included,y=u.range,b=u.step,x=u.marks,_=u.max,w=u.min,C=u.tipFormatter,E=u.children;var S=this.props.handle;var T=s.map(function(e){return r.calcOffset(e)});var M=c+"-handle";var A=s.map(function(e,t){var r;return n((r={},r[M]=true,r[M+"-"+(t+1)]=true,r[M+"-lower"]=t===0,r[M+"-upper"]=t===s.length-1,r))});var P=b===null||C===null;var R={prefixCls:c,noTip:P,tipFormatter:C,vertical:d};this.handleElements=[];var k=s.map(function(t,n){return e.React.cloneElement(S,g({},R,{className:A[n],value:t,offset:T[n],dragging:o===n,index:n,key:n,ref:function(e){return r.handleElements.push(e)}}))});if(!y){k.shift()}var I=v||y;var D=[];var B=n((t={},t[c]=true,t[c+"-with-marks"]=Object.keys(x).length,t[c+"-disabled"]=f,t[c+"-vertical"]=this.props.vertical,t[l]=!!l,t));return e.React.createElement("div",{ref:function(e){return r.sliderElement=e},className:B,onTouchStart:f?i:this.onTouchStart.bind(this),onMouseDown:f?i:this.onMouseDown.bind(this)},e.React.createElement("div",{className:c+"-rail"}),D,e.React.createElement(p,{prefixCls:c,vertical:d,marks:x,dots:m,step:b,included:I,lowerBound:s[0],upperBound:s[s.length-1],max:_,min:w}),k,e.React.createElement(h,{className:c+"-mark",vertical:d,marks:x,included:I,lowerBound:s[0],upperBound:s[s.length-1],max:_,min:w}),E)};r.defaultProps={prefixCls:"lm-slider-base",className:"",min:0,max:100,step:1,marks:{},handle:e.React.createElement(c,{className:"",vertical:false,offset:0,tipFormatter:function(e){return e},value:0,index:0}),onBeforeChange:i,onChange:i,onAfterChange:i,tipFormatter:function(e,t){return e},included:true,disabled:false,dots:false,range:false,vertical:false,allowCross:true,pushable:false};return r}(e.React.Component);t.SliderBase=f;var h=function(t){var r=t.className,i=t.vertical,a=t.marks,o=t.included,s=t.upperBound,u=t.lowerBound,l=t.max,c=t.min;var f=Object.keys(a);var h=f.length;var d=100/(h-1);var p=d*.9;var m=l-c;var v=f.map(parseFloat).sort(function(e,t){return e-t}).map(function(t){var l;var f=!o&&t===s||o&&t<=s&&t>=u;var h=n((l={},l[r+"-text"]=true,l[r+"-text-active"]=f,l));var d={marginBottom:"-50%",bottom:(t-c)/m*100+"%"};var v={width:p+"%",marginLeft:-p/2+"%",left:(t-c)/m*100+"%"};var y=i?d:v;var b=a[t];var x=typeof b==="object"&&!e.React.isValidElement(b);var _=x?b.label:b;var w=x?g({},y,b.style):y;return e.React.createElement("span",{className:h,style:w,key:t},_)});return e.React.createElement("div",{className:r},v)};function d(e,t,r,n,i,a){var o=Object.keys(t).map(parseFloat);if(r){for(var s=i;s<=a;s=s+n){if(o.indexOf(s)>=0)continue;o.push(s)}}return o}var p=function(t){var r=t.prefixCls,i=t.vertical,a=t.marks,o=t.dots,s=t.step,u=t.included,l=t.lowerBound,c=t.upperBound,f=t.max,h=t.min;var p=f-h;var m=d(i,a,o,s,h,f).map(function(t){var a;var o=Math.abs(t-h)/p*100+"%";var s=i?{bottom:o}:{left:o};var f=!u&&t===c||u&&t<=c&&t>=l;var d=n((a={},a[r+"-dot"]=true,a[r+"-dot-active"]=f,a));return e.React.createElement("span",{className:d,style:s,key:t})});return e.React.createElement("div",{className:r+"-step"},m)}})(t=e.Controls||(e.Controls={}))})(t=e.Plugin||(e.Plugin={}))})(p||(p={}));/* 811 * Copyright (c) 2016 - now David Sehnal, licensed under Apache 2.0, See LICENSE file for more info. 812 */ 813var p;(function(e){var t;(function(t){var r;(function(r){"use strict";var n=e.Bootstrap.Utils.shallowEqual;var i=function(e){y(i,e);function i(){return e!==null&&e.apply(this,arguments)||this}i.prototype.shouldComponentUpdate=function(e,t,r){return!n(this.props,e)};i.prototype.render=function(){var e=this;var n=this.props.color,i=n.r,a=i===void 0?1:i,o=n.g,s=o===void 0?1:o,u=n.b,l=u===void 0?1:u;
813var c={a:1,r:255*a,g:255*s,b:255*l};var f=function(t){return e.props.onChange({r:t.rgb.r/255,g:t.rgb.g/255,b:t.rgb.b/255})};var h=t.React.createElement(r.ChromePickerHelper,{color:c,onChangeComplete:f});return t.React.createElement("div",{className:"lm-color-picker"},h)};return i}(t.React.Component);r.ColorPicker=i;var a=function(e){y(n,e);function n(){var t=e!==null&&e.apply(this,arguments)||this;t.state={isExpanded:false};return t}n.prototype.render=function(){var e=this;var n=this.state.isExpanded?t.React.createElement(i,g({},this.props)):void 0;var a=this.props.color;var o=this.props.position?this.props.position:"above";return t.React.createElement("div",{className:"lm-control-row lm-toggle-color-picker lm-toggle-color-picker-"+o,onMouseLeave:function(){return e.setState({isExpanded:false})}},t.React.createElement("span",null,this.props.label),t.React.createElement("div",null,t.React.createElement(r.Button,{onClick:function(){e.setState({isExpanded:!e.state.isExpanded})},asBlock:true,customStyle:{backgroundColor:"rgb("+(255*a.r|0)+", "+(255*a.g|0)+", "+(255*a.b|0)+")",color:"rgb("+(255*(1-a.r)|0)+","+(255*(1-a.g)|0)+","+(255*(1-a.b)|0)+")"}})),n)};return n}(t.React.Component);r.ToggleColorPicker=a})(r=t.Controls||(t.Controls={}))})(t=e.Plugin||(e.Plugin={}))})(p||(p={}));/* 814 * Copyright (c) 2016 - now David Sehnal, licensed under Apache 2.0, See LICENSE file for more info. 815 */ 816var p;(function(e){var t;(function(e){var t;(function(t){"use strict";function r(r){return e.React.createElement("div",{className:"lm-control-row"},e.React.createElement(t.TextBox,{placeholder:"Enter query...",onChange:r.onChange,value:r.value,onKeyPress:function(e){if(t.isEnter(e)&&r.onEnter)r.onEnter.call(null,e)}}))}t.QueryEditor=r})(t=e.Controls||(e.Controls={}))})(t=e.Plugin||(e.Plugin={}))})(p||(p={}));/* 817 * Copyright (c) 2016 - now David Sehnal, licensed under Apache 2.0, See LICENSE file for more info. 818 */ 819var p;(function(e){var t;(function(t){var r;(function(r){"use strict";var n=e.Bootstrap.Utils.shallowEqual;var i=function(t){y(r,t);function r(){return t!==null&&t.apply(this,arguments)||this}r.prototype.update=function(t){var r=e.Bootstrap.Utils.merge(this.props.state,t);if(r!==this.props.state)this.props.onChange(r)};r.prototype.shouldComponentUpdate=function(e,t){return!n(this.props,e)||!n(this.state,t)};return r}(t.React.Component);r.PureView=i;var a=function(e){y(t,e);function t(){var t=e!==null&&e.apply(this,arguments)||this;t.subs=[];return t}t.prototype.subscribe=function(e,t){var r=e.subscribe(t);this.subs.push(r);return r};t.prototype.unsubscribe=function(e){var t=this.subs.indexOf(e);for(var r=t;r<this.subs.length-1;r++){this.subs[r]=this.subs[r+1]}e.dispose();this.subs.pop()};t.prototype.componentWillUnmount=function(){for(var e=0,t=this.subs;e<t.length;e++){var r=t[e];r.dispose()}this.subs=[]};return t}(t.React.Component);r.Component=a;var o=function(e){y(t,e);function t(){var t=e!==null&&e.apply(this,arguments)||this;t.subs=[];return t}t.prototype.subscribe=function(e,t){var r=e.subscribe(t);this.subs.push(r);return r};t.prototype.unsubscribe=function(e){var t=this.subs.indexOf(e);for(var r=t;r<this.subs.length-1;r++){this.subs[r]=this.subs[r+1]}e.dispose();this.subs.pop()};t.prototype.componentWillUnmount=function(){for(var e=0,t=this.subs;e<t.length;e++){var r=t[e];r.dispose()}this.subs=[]};return t}(t.React.Component);r.ObserverView=o;var s=function(e){y(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}Object.defineProperty(t.prototype,"controller",{get:function(){return this.props.controller},enumerable:true,configurable:true});t.prototype.componentWillMount=function(){var e=this;this.subscribe(this.controller.state,function(t){e.forceUpdate()})};return t}(o);r.View=s})(r=t.Views||(t.Views={}))})(t=e.Plugin||(e.Plugin={}))})(p||(p={}));/* 820 * Copyright (c) 2016 - now David Sehnal, licensed under Apache 2.0, See LICENSE file for more info. 821 */ 822var p;(function(e){var t;(function(t){var r;(function(r){"use strict";var n=e.Bootstrap.Components.LayoutRegion;var i=function(r){y(i,r);function i(){return r!==null&&r.apply(this,arguments)||this}i.prototype.componentDidMount=function(){var t=this;this.subscribe(e.Bootstrap.Event.Common.ComponentsChanged.getStream(this.controller.context),function(){return t.forceUpdate()})};i.prototype.renderTarget=function(e,r){var n=[];var i=[];for(var a=0,o=r.components;a<o.length;a++){var s=o[a];if(s.isStatic)n.push(t.React.createElement(s.view,{key:s.key,controller:s.controller}));else i.push(t.React.createElement(s.view,{key:s.key,controller:s.controller}))}return t.React.createElement("div",{key:"layout-target-"+e,className:"lm-layout-region lm-layout-"+r.cssClass},n.length?t.React.createElement("div",{className:"lm-layout-static"},n):void 0,i.length?t.React.createElement("div",{className:"lm-layout-scrollable"},i):void 0)};i.prototype.updateTarget=function(e,t,r){var n=this.controller.latestState;var i=n.regionStates;var a=this.controller.targets[t];var o;if(n.hideControls){o=i!==void 0&&i[t]==="Sticky"&&a.components.length>0}else if(i&&i[t]==="Hidden"){o=false}else{o=a.components.length>0}if(o){r.regions.push(this.renderTarget(e,a))}else{r.layoutClass+=" lm-layout-hide-"+e}};i.prototype.render=function(){var r="";var i=this.controller.latestState;var a;if(i.isExpanded){a="lm-layout-expanded"}else{a="lm-layout-standard ";switch(i.collapsedControlsLayout){case e.Bootstrap.Components.CollapsedControlsLayout.Outside:a+="lm-layout-standard-outside";break;case e.Bootstrap.Components.CollapsedControlsLayout.Landscape:a+="lm-layout-standard-landscape";break;case e.Bootstrap.Components.CollapsedControlsLayout.Portrait:a+="lm-layout-standard-portrait";break;default:a+="lm-layout-standard-outside";break}}var o=this.controller.targets;var s=[this.renderTarget("main",o[n.Main])];
822var u={regions:s,layoutClass:r};this.updateTarget("top",n.Top,u);this.updateTarget("right",n.Right,u);this.updateTarget("bottom",n.Bottom,u);this.updateTarget("left",n.Left,u);r=u.layoutClass;var l=o[n.Root].components.map(function(e){return t.React.createElement(e.view,{key:e.key,controller:e.controller})});return t.React.createElement("div",{className:"lm-plugin"},t.React.createElement("div",{className:"lm-plugin-content "+a},t.React.createElement("div",{className:r},s,l)))};return i}(r.View);r.Layout=i})(r=t.Views||(t.Views={}))})(t=e.Plugin||(e.Plugin={}))})(p||(p={}));/* 823 * Copyright (c) 2016 - now David Sehnal, licensed under Apache 2.0, See LICENSE file for more info. 824 */ 825var p;(function(e){var t;(function(t){var r;(function(r){var n;(function(n){"use strict";var i=function(e){y(n,e);function n(){return e!==null&&e.apply(this,arguments)||this}Object.defineProperty(n.prototype,"params",{get:function(){return this.controller.latestState.params},enumerable:true,configurable:true});n.prototype.updateParams=function(e){this.controller.updateParams(e)};n.prototype.autoUpdateParams=function(e){this.controller.autoUpdateParams(e)};n.prototype.getPersistentState=function(e,t){return this.controller.context.transforms.getPersistentState(this.controller.transformer,this.transformSourceEntity,e,t)};n.prototype.setPersistentState=function(e,t){if(this.controller.context.transforms.setPersistentState(this.controller.transformer,this.transformSourceEntity,e,t)){this.forceUpdate()}};Object.defineProperty(n.prototype,"transformSourceEntity",{get:function(){return this.isUpdate?this.controller.entity.parent:this.controller.entity},enumerable:true,configurable:true});Object.defineProperty(n.prototype,"isUpdate",{get:function(){return this.controller.isUpdate},enumerable:true,configurable:true});Object.defineProperty(n.prototype,"canApply",{get:function(){var e=this.controller.latestState;var t=e.canApply&&(!this.isUpdate||e.isDirty)&&!e.isBusy;if(t&&this.isUpdate&&e.parametersAutoUpdating)return false;return t},enumerable:true,configurable:true});n.prototype.applyEnter=function(e){if(!this.canApply)return;e.target.blur();this.controller.apply()};n.prototype.render=function(){var e=this;var n=this.isUpdate;var i=this.controller.latestState;var a=i.issues;var o=a&&a.length;var s=i.isBusy;var u=s?"Working...":n&&!o?"Nothing to update":a?a[0]:void 0;var l=this.controller.transformer.info;var c=t.React.createElement(t.Controls.CommitButton,{action:function(){return e.controller.apply()},isOn:this.canApply,title:a&&a.length?a[0]:this.canApply?n?"An update will remove all child nodes.":void 0:void 0,on:n?"Update":this.props.isAction?"Apply":"Add",off:u});var f=this.canApply||o;var h=this.props.customHeader?this.props.customHeader:(n?"Update ":"")+l.name;var d=this.getPersistentState("isExpanded",true);return t.React.createElement("div",{className:"lm-transformer-wrapper"},t.React.createElement(t.Controls.Panel,{header:h,badge:this.props.hideBadge?void 0:t.React.createElement(r.Entity.Badge,{type:l.to[0].info}),className:"lm-control lm-transformer lm-panel-"+l.to[0].info.typeClass,key:l.id,title:l.description,isExpanded:d,onExpand:function(t){e.setPersistentState("isExpanded",t)},description:this.controller.transformer.info.description,topRightAction:this.props.showVisibilityIcon?t.React.createElement(r.Entity.VisibilityControl,{entity:this.controller.entity}):void 0},this.renderControls(),f?c:void 0))};return n}(r.View);n.ControllerBase=i;var a=function(e){y(r,e);function r(){return e!==null&&e.apply(this,arguments)||this}r.prototype.renderControls=function(){return t.React.createElement("div",null)};return r}(n.ControllerBase);n.Empty=a;var o=function(e){y(r,e);function r(){return e!==null&&e.apply(this,arguments)||this}r.prototype.render=function(){var e=this.controller.context;var r=e.plugin;var n=this.controller.latestState;var i=n.transforms;var a=i.map(function(e){var n=r.getTransformerInfo(e.transformer).view;return t.React.createElement(n,{controller:e,key:e.transformer.info.id+"-"+e.entity.id})});if(n.update){var o=r.getTransformerInfo(n.update.transformer).view;a.push(t.React.createElement(o,{controller:n.update,key:n.update.transformer.info.id+"-"+n.update.entity.id}))}return t.React.createElement("div",{className:"lm-transform-view"},a)};return r}(r.View);n.View=o;
825n.TransparencyControl=function(e){var r=e.definition.alpha;return t.React.createElement(t.Controls.Slider,{label:"Opacity",onChange:function(t){return e.onChange({alpha:t,writeDepth:e.definition.writeDepth})},min:0,max:1,step:.01,value:r})};var s=function(r){y(n,r);function n(){return r!==null&&r.apply(this,arguments)||this}n.prototype.componentWillMount=function(){var t=this;r.prototype.componentWillMount.call(this);this.subscribe(e.Bootstrap.Event.Tree.NodeUpdated.getStream(this.controller.context),function(e){var r=t.controller.latestState.controller;var n=r&&r.entity;if(e.data===n)t.forceUpdate()})};n.prototype.render=function(){var e=this.controller.latestState.controller;if(!e)return t.React.createElement("div",{className:"lm-empty-control"});var r=this.controller.context;var n=r.plugin;var i=n.getTransformerInfo(e.transformer).view;if(!i){console.warn("Count not find view for updater ("+e.transformer.info.id+"), please register it.");return t.React.createElement("div",{className:"lm-empty-control"})}return t.React.createElement(i,{controller:e,key:e.transformer.info.id+"-"+e.entity.id,customHeader:this.controller.header,hideBadge:true,showVisibilityIcon:true})};return n}(r.View);n.Updater=s;var u=function(e){y(r,e);function r(){return e!==null&&e.apply(this,arguments)||this}r.prototype.render=function(){var e=this.controller.latestState.controller;if(!e)return t.React.createElement("div",{className:"lm-empty-control"});var r=this.controller.context;var n=r.plugin;var i=n.getTransformerInfo(e.transformer).view;if(!i){console.warn("Count not find view for updater ("+e.transformer.info.id+"), please register it.");return t.React.createElement("div",{className:"lm-empty-control"})}return t.React.createElement(i,{controller:e,key:e.transformer.info.id+"-"+e.entity.id,customHeader:this.controller.header,hideBadge:true,isAction:true})};return r}(r.View);n.Action=u})(n=r.Transform||(r.Transform={}))})(r=t.Views||(t.Views={}))})(t=e.Plugin||(e.Plugin={}))})(p||(p={}));/* 826 * Copyright (c) 2016 - now David Sehnal, licensed under Apache 2.0, See LICENSE file for more info. 827 */ 828var p;(function(e){var t;(function(t){var r;(function(r){var n;(function(r){var n;(function(n){"use strict";var i=function(r){y(n,r);function n(){return r!==null&&r.apply(this,arguments)||this}n.prototype.renderControls=function(){var r=this;var n=this.params;return t.React.createElement("div",null,t.React.createElement(t.Controls.OptionsGroup,{options:e.Bootstrap.Entity.Data.Types,caption:function(e){return e},current:n.type,onChange:function(t){return r.updateParams({type:t,responseCompression:e.Bootstrap.Utils.DataCompressionMethod.None})},label:"Type"}),n.type==="Binary"?t.React.createElement(t.Controls.OptionsGroup,{options:["None","Gzip"],caption:function(e){return e},current:n.responseCompression===e.Bootstrap.Utils.DataCompressionMethod.Gzip?"Gzip":"None",onChange:function(t){return r.updateParams({responseCompression:t==="None"?e.Bootstrap.Utils.DataCompressionMethod.None:e.Bootstrap.Utils.DataCompressionMethod.Gzip})},label:"Compression",title:'Specify the compression of the data. Usually only appliable if you downloading "raw" files.'}):void 0,t.React.createElement(t.Controls.TextBoxGroup,{value:n.url,onChange:function(e){return r.updateParams({url:e})},label:"URL",onEnter:function(e){return r.applyEnter(e)},placeholder:"Enter URL..."}))};return n}(r.ControllerBase);n.Download=i;var a=function(r){y(n,r);function n(){return r!==null&&r.apply(this,arguments)||this}n.prototype.renderControls=function(){var r=this;var n=this.params;var i=this.controller.latestState;return t.React.createElement("div",null,t.React.createElement(t.Controls.OptionsGroup,{options:e.Bootstrap.Entity.Data.Types,caption:function(e){return e},current:n.type,onChange:function(e){return r.updateParams({type:e})},label:"Type"}),t.React.createElement("div",{className:"lm-btn lm-btn-block lm-btn-action lm-loader-lm-btn-file",style:{marginTop:"1px"}},n.file?n.file.name:"Select a file..."," ",t.React.createElement("input",{disabled:i.isBusy,type:"file",onChange:function(e){return r.updateParams({file:e.target.files[0]})},multiple:false})))};return n}(r.ControllerBase);n.OpenFile=a;var o=function(e){y(r,e);function r(){return e!==null&&e.apply(this,arguments)||this}r.prototype.renderControls=function(){var e=this;var r=this.params;return t.React.createElement("div",null,t.React.createElement(t.Controls.TextBoxGroup,{value:r.
828id,onChange:function(t){return e.updateParams({id:t})},label:"Id",onEnter:function(t){return e.applyEnter(t)},placeholder:"Enter PDB id..."}))};return r}(r.ControllerBase);n.WithIdField=o;var s=function(e){y(r,e);function r(){return e!==null&&e.apply(this,arguments)||this}r.prototype.renderControls=function(){var e=this;var r=this.params;return t.React.createElement("div",null,t.React.createElement(t.Controls.TextBoxGroup,{value:r.id,onChange:function(t){return e.updateParams({id:t})},label:"URL",onEnter:function(t){return e.applyEnter(t)},placeholder:"Enter URL..."}))};return r}(r.ControllerBase);n.WithUrlIdField=s})(n=r.Data||(r.Data={}))})(n=r.Transform||(r.Transform={}))})(r=t.Views||(t.Views={}))})(t=e.Plugin||(e.Plugin={}))})(p||(p={}));/* 829 * Copyright (c) 2016 - now David Sehnal, licensed under Apache 2.0, See LICENSE file for more info. 830 */ 831var p;(function(e){var t;(function(t){var r;(function(r){var n;(function(r){var n;(function(n){"use strict";var i=function(r){y(n,r);function n(){return r!==null&&r.apply(this,arguments)||this}n.prototype.renderControls=function(){var r=this;var n=this.params;return t.React.createElement("div",null,t.React.createElement(t.Controls.OptionsGroup,{options:e.Core.Formats.Molecule.SupportedFormats.All,caption:function(e){return e.name},current:n.format,onChange:function(e){return r.updateParams({format:e})},label:"Format"}))};return n}(r.ControllerBase);n.CreateFromData=i;var a=function(r){y(n,r);function n(){return r!==null&&r.apply(this,arguments)||this}n.prototype.renderControls=function(){var r=this;var n=this.params;return t.React.createElement("div",null,t.React.createElement(t.Controls.OptionsGroup,{options:e.Core.Formats.Molecule.SupportedFormats.All,caption:function(e){return e.name},current:n.format,onChange:function(e){return r.updateParams({format:e})},label:"Format"}),t.React.createElement(t.Controls.TextBoxGroup,{value:n.id,onChange:function(e){return r.updateParams({id:e})},label:"URL",onEnter:function(e){return r.applyEnter(e)},placeholder:"Enter url..."}))};return n}(r.ControllerBase);n.DownloadFromUrl=a;var o=function(r){y(n,r);function n(){return r!==null&&r.apply(this,arguments)||this}n.prototype.renderControls=function(){var r=this;var n=this.params;var i=this.controller.latestState;var a=e.Core.Formats.FormatInfo.formatFileFilters(e.Core.Formats.Molecule.SupportedFormats.All);return t.React.createElement("div",null,t.React.createElement("div",{className:"lm-btn lm-btn-block lm-btn-action lm-loader-lm-btn-file",style:{marginTop:"1px"}},n.file?n.file.name:"Select a file..."," ",t.React.createElement("input",{disabled:i.isBusy,type:"file",accept:a,onChange:function(e){return r.updateParams({file:e.target.files[0]})},multiple:false})))};return n}(r.ControllerBase);n.OpenFile=o;var s=function(e){y(r,e);function r(){return e!==null&&e.apply(this,arguments)||this}r.prototype.renderControls=function(){var e=this;var r=this.params;return t.React.createElement("div",null,t.React.createElement(t.Controls.TextBoxGroup,{value:r.id,onChange:function(t){return e.updateParams({id:t})},label:"Id",onEnter:function(t){return e.applyEnter(t)},placeholder:"Enter pdb id..."}),t.React.createElement(t.Controls.TextBoxGroup,{value:r.server,onChange:function(t){return e.updateParams({server:t})},label:"Server",onEnter:function(t){return e.applyEnter(t)},placeholder:"Server url..."}))};return r}(r.ControllerBase);n.InitCoordinateStreaming=s;var u=function(e){y(r,e);function r(){return e!==null&&e.apply(this,arguments)||this}r.prototype.renderControls=function(){var e=this;var r=this.transformSourceEntity;var n=r.props.dictionary.dataBlocks.map(function(e,t){return{b:e.header,i:t}});return t.React.createElement("div",null,t.React.createElement(t.Controls.OptionsGroup,{options:n,caption:function(e){return e.b},current:n[this.params.blockIndex],onChange:function(t){return e.updateParams({blockIndex:t.i})},label:"Source"}))};return r}(r.ControllerBase);n.CreateFromMmCif=u;var l=function(e){y(r,e);function r(){return e!==null&&e.apply(this,arguments)||this}r.prototype.renderControls=function(){var e=this;var r=this.transformSourceEntity.props.molecule.models.length;return t.React.createElement("div",null,t.React.createElement(t.Controls.Slider,{label:"Index",onChange:function(t){return e.updateParams({modelIndex:t-1})},min:1,max:r,step:1,value:(this.params.modelIndex|0)+1,title:"Index of the model."}))};return r}(r.ControllerBase);n.CreateModel=l;var c=function(r){y(n,r);function n(){return r!==null&&r.apply(this,arguments)||this}n.prototype.renderControls=function(){var r=this;var n=this.params;var i=e.Bootstrap.Utils.Molecule.findModel(this.transformSourceEntity);var a=i.props.model.data.assemblyInfo;if(!a)return void 0;var o=a.assemblies.map(function(e){return e.name});return t.React.createElement("div",null,t.React.createElement(t.Controls.OptionsGroup,{options:o,current:n.name,onChange:function(e){return r.updateParams({name:e})},label:"Name"}))};return n}(r.ControllerBase);n.CreateAssembly=c;var f=function(e){y(r,e);function r(){return e!==null&&e.apply(this,arguments)||this}r.prototype.renderControls=function(){var e=this;var r=this.params;var n=["Mates","Interaction"];return t.React.createElement("div",null,t.React.createElement(t.Controls.OptionsGroup,{options:n,current:r.type,onCh
831ange:function(t){return e.updateParams({type:t})},label:"Type",title:"Mates: copies whole asymetric unit. Interaction: Includes only residues that are no more than `radius` from the asymetric unit."}),t.React.createElement(t.Controls.Slider,{label:"Radius",onChange:function(t){return e.updateParams({radius:t})},min:0,max:25,step:.1,value:r.radius,title:"Interaction radius."}))};return r}(r.ControllerBase);n.CreateSymmetryMates=f;var h=function(e){y(r,e);function r(){return e!==null&&e.apply(this,arguments)||this}r.prototype.renderControls=function(){var e=this;var r=this.params;return t.React.createElement("div",null,t.React.createElement(t.Controls.TextBoxGroup,{value:r.name,onChange:function(t){return e.updateParams({name:t})},label:"Name",onEnter:function(t){return e.applyEnter(t)},placeholder:"Optional name..."}),t.React.createElement(t.Controls.QueryEditor,{value:r.queryString,onChange:function(t){return e.updateParams({queryString:t})},onEnter:function(t){return e.applyEnter(t)}}))};return r}(r.ControllerBase);n.CreateSelection=h;var d=function(e){y(r,e);function r(){return e!==null&&e.apply(this,arguments)||this}r.prototype.renderControls=function(){var e=this;var r=this.params;return t.React.createElement("div",null,t.React.createElement(t.Controls.Toggle,{onChange:function(t){return e.updateParams({polymer:t})},value:r.polymer,label:"Polymer"}),t.React.createElement(t.Controls.Toggle,{onChange:function(t){return e.updateParams({het:t})},value:r.het,label:"HET"}),t.React.createElement(t.Controls.Toggle,{onChange:function(t){return e.updateParams({water:t})},value:r.water,label:"Water"}))};return r}(r.ControllerBase);n.CreateMacromoleculeVisual=d;var p=function(n){y(i,n);function i(){return n!==null&&n.apply(this,arguments)||this}i.prototype.detail=function(){var r=this;var n=this.params.style.params;return[t.React.createElement(t.Controls.OptionsGroup,{options:e.Bootstrap.Visualization.Molecule.DetailTypes,caption:function(e){return e},current:n.detail,onChange:function(e){return r.controller.updateStyleParams({detail:e})},label:"Detail"})]};i.prototype.cartoons=function(){var r=this;var n=this.params.style.params;return[t.React.createElement(t.Controls.Toggle,{key:0,onChange:function(e){return r.controller.updateStyleParams({showDirectionCone:e})},value:n.showDirectionCone,label:"Dir. Cones"}),t.React.createElement(t.Controls.OptionsGroup,{key:1,options:e.Bootstrap.Visualization.Molecule.DetailTypes,caption:function(e){return e},current:n.detail,onChange:function(e){return r.controller.updateStyleParams({detail:e})},label:"Detail"})]};i.prototype.ballsAndSticks=function(){var r=this;var n=this.params.style.params;var i=[];var a=0;i.push(t.React.createElement(t.Controls.Toggle,{title:"Scale atoms using their VDW radius.",onChange:function(e){return r.controller.updateStyleParams({useVDW:e})},value:n.useVDW,label:"VDW"}));if(n.useVDW){i.push(t.React.createElement(t.Controls.Slider,{key:a++,label:"Scale",onChange:function(e){return r.controller.updateStyleParams({vdwScaling:e})},min:.1,max:1,step:.01,value:n.vdwScaling,title:"VDW scale factor."}))}else{i.push(t.React.createElement(t.Controls.Slider,{key:a++,label:"Atom Rds",onChange:function(e){return r.controller.updateStyleParams({atomRadius:e})},min:.05,max:2,step:.01,value:n.atomRadius,title:"Atom Radius"}))}i.push(t.React.createElement(t.Controls.Slider,{key:a++,label:"Bond Rds",onChange:function(e){return r.controller.updateStyleParams({bondRadius:e})},min:.05,max:1,step:.01,value:n.bondRadius,title:"Bond Radius"}));var o=n.customMaxBondLengths&&n.customMaxBondLengths["H"]?n.customMaxBondLengths["H"]:1.15;i.push(t.React.createElement(t.Controls.Slider,{key:a++,label:"H Bond Len",onChange:function(e){return r.controller.updateStyleParams({customMaxBondLengths:g({},n.customMaxBondLengths,{H:e})})},min:.9,max:1.5,step:.01,value:o,title:"Maximum H bond length"}));i.push(t.React.createElement(t.Controls.Toggle,{key:a++,onChange:function(e){return r.controller.updateStyleParams({hideHydrogens:e})},value:n.hideHydrogens,label:"Hide H"}));i.push(t.React.createElement(t.Controls.OptionsGroup,{key:a++,options:e.Bootstrap.Visualization.Molecule.DetailTypes,caption:function(e){return e},current:n.detail,onChange:function(e){return r.controller.updateStyleParams({detail:e})},label:"Detail"}));return i};i.prototype.surface=function(){var e=this;var r=this.params.style.params;var n=0;return[t.React.createElement(t.Controls.Slider,{key:n++,label:"Probe Radius",onChange:function(t){return e.controller.updateStyleParams({probeRadius:t})},min:0,max:6,step:.1,value:r.probeRadius}),t.React.createElement(t.Controls.Slider,{key:n++,label:"Smoothing",onCh
831ange:function(t){return e.controller.updateStyleParams({smoothing:t})},min:0,max:20,step:1,value:r.smoothing,title:"Number of laplacian smoothing itrations."}),t.React.createElement(t.Controls.Toggle,{key:n++,onChange:function(t){return e.controller.updateStyleParams({automaticDensity:t})},value:r.automaticDensity,label:"Auto Detail"}),r.automaticDensity?void 0:t.React.createElement(t.Controls.Slider,{key:n++,label:"Detail",onChange:function(t){return e.controller.updateStyleParams({density:t})},min:.1,max:3,step:.1,value:r.density,title:"Determines the size of a grid cell (size = 1/detail)."}),t.React.createElement(t.Controls.Toggle,{key:n++,onChange:function(t){return e.controller.updateStyleParams({isWireframe:t})},value:r.isWireframe,label:"Wireframe"})]};i.prototype.createColors=function(){var e=this;var n=this.params.style.theme;var i=this.params.style.type==="BallsAndSticks";var a=n.colors.filter(function(e,t){return!i?t!=="Bond":true}).map(function(r,n){return t.React.createElement(t.Controls.ToggleColorPicker,{key:n,label:n,color:r,onChange:function(t){return e.controller.updateThemeColor(n,t)}})}).toArray();a.push(t.React.createElement(r.TransparencyControl,{definition:n.transparency,onChange:function(t){return e.controller.updateThemeTransparency(t)}}));return a};i.prototype.renderControls=function(){var r=this;var n=this.params;var i;switch(n.style.type){case"Surface":i=this.surface();break;case"BallsAndSticks":i=this.ballsAndSticks();break;case"Cartoons":i=this.cartoons();break;default:i=this.detail();break}var a=function(t){return e.Bootstrap.Visualization.Molecule.TypeDescriptions[t]};var o=this.getPersistentState("showTypeOptions",false);var s=this.getPersistentState("showThemeOptions",false);return t.React.createElement("div",null,t.React.createElement(t.Controls.ExpandableGroup,{select:t.React.createElement(t.Controls.OptionsGroup,{options:e.Bootstrap.Visualization.Molecule.Types,caption:function(e){return a(e).label},current:n.style.type,onChange:function(t){return r.controller.updateTemplate(t,e.Bootstrap.Visualization.Molecule.Default.ForType)},label:"Type"}),expander:t.React.createElement(t.Controls.ControlGroupExpander,{isExpanded:o,onChange:function(e){return r.setPersistentState("showTypeOptions",e)}}),options:i,isExpanded:o}),t.React.createElement(t.Controls.ExpandableGroup,{select:t.React.createElement(t.Controls.OptionsGroup,{options:e.Bootstrap.Visualization.Molecule.Default.Themes,caption:function(e){return e.name},current:n.style.theme.template,onChange:function(e){return r.controller.updateThemeDefinition(e)},label:"Coloring"}),expander:t.React.createElement(t.Controls.ControlGroupExpander,{isExpanded:s,onChange:function(e){return r.setPersistentState("showThemeOptions",e)}}),options:this.createColors(),isExpanded:s}))};return i}(r.ControllerBase);n.CreateVisual=p;var m=function(n){y(i,n);function i(){return n!==null&&n.apply(this,arguments)||this}i.prototype.renderControls=function(){var n=this;var i=this.controller.latestState.params.style;var a=t.React.createElement(t.Controls.OptionsGroup,{options:e.Bootstrap.Utils.Molecule.Labels3DKinds,caption:function(t){return e.Bootstrap.Utils.Molecule.Labels3DKindLabels[t]},current:i.params.kind,onChange:function(e){return n.controller.updateStyleParams({kind:e})},label:"Kind"});var o=this.getPersistentState("showOptions",false);return t.React.createElement("div",null,t.React.createElement(t.Controls.ExpandableGroup,{select:a,expander:t.React.createElement(t.Controls.ControlGroupExpander,{isExpanded:o,onChange:function(e){return n.setPersistentState("showOptions",e)}}),options:r.Labels.optionsControls(this.controller),isExpanded:o}))};return i}(r.ControllerBase);n.CreateLabels=m})(n=r.Molecule||(r.Molecule={}))})(n=r.Transform||(r.Transform={}))})(r=t.Views||(t.Views={}))})(t=e.Plugin||(e.Plugin={}))})(p||(p={}));/* 832 * Copyright (c) 2016 - now David Sehnal, licensed under Apache 2.0, See LICENSE file for more info. 833 */ 834var p;(function(e){var t;(function(t){var r;(function(r){var n;(function(r){var n;(function(n){"use strict";var i=function(r){return t.React.createElement(t.Controls.ExpandableGroup,{select:t.React.createElement(t.Controls.Slider,{label:r.isSigma?"Iso Value (Ï)":"Iso Value",onCh
834ange:r.onChangeValue,min:r.min,max:r.max,value:r.value,step:.001}),expander:t.React.createElement(t.Controls.ControlGroupExpander,{isExpanded:r.view.getPersistentState("showIsoValueType",false),onChange:function(e){return r.view.setPersistentState("showIsoValueType",e)}}),options:[t.React.createElement(t.Controls.Toggle,{onChange:function(t){return r.onChangeType(t?e.Bootstrap.Visualization.Density.IsoValueType.Sigma:e.Bootstrap.Visualization.Density.IsoValueType.Absolute)},value:r.isSigma,label:"Relative (\\u03C3)"})],isExpanded:r.view.getPersistentState("showIsoValueType",false)})};function a(e,t,r,n){var i=(t-e.valuesInfo.mean)/e.valuesInfo.sigma;if(i>n)return n;if(i<r)return r;return i}function o(e,t){var r=e.valuesInfo.mean+t*e.valuesInfo.sigma;if(r>e.valuesInfo.max)return e.valuesInfo.max;if(r<e.valuesInfo.min)return e.valuesInfo.min;return r}var s=function(r){y(n,r);function n(){return r!==null&&r.apply(this,arguments)||this}n.prototype.renderControls=function(){var r=this;var n=this.params;var i=e.Bootstrap.Utils.round;if(this.isUpdate){var a=this.controller.entity.props.data;return t.React.createElement("div",null,t.React.createElement(t.Controls.RowText,{label:"Format",value:n.format.name}),t.React.createElement(t.Controls.RowText,{label:"Sigma",value:i(a.valuesInfo.sigma,3)}),t.React.createElement(t.Controls.RowText,{label:"Mean",value:i(a.valuesInfo.mean,3)}),t.React.createElement(t.Controls.RowText,{label:"Value Range",value:"["+i(a.valuesInfo.min,3)+", "+i(a.valuesInfo.max,3)+"]"}))}return t.React.createElement("div",null,t.React.createElement(t.Controls.OptionsGroup,{options:e.Core.Formats.Density.SupportedFormats.All,caption:function(e){return e.name},current:n.format,onChange:function(e){return r.updateParams({format:e})},label:"Format"}))};return n}(r.ControllerBase);n.ParseData=s;var u=function(n){y(s,n);function s(){return n!==null&&n.apply(this,arguments)||this}s.prototype.surface=function(){var r=this;var n=e.Bootstrap.Tree.Node.findClosestNodeOfType(this.transformSourceEntity,[e.Bootstrap.Entity.Density.Data]);var s=this.params.style.params;var u=s.isoValueType!==e.Bootstrap.Visualization.Density.IsoValueType.Absolute;var l=n.props.data.valuesInfo;var c=u?(l.min-l.mean)/l.sigma:l.min;var f=u?(l.max-l.mean)/l.sigma:l.max;return t.React.createElement(i,{view:this,onChangeValue:function(e){return r.controller.updateStyleParams({isoValue:e})},onChangeType:function(t){if(t===s.isoValueType)return;if(t===e.Bootstrap.Visualization.Density.IsoValueType.Absolute){r.controller.updateStyleParams({isoValue:o(n.props.data,s.isoValue),isoValueType:t})}else{r.controller.updateStyleParams({isoValue:a(n.props.data,s.isoValue,-5,5),isoValueType:t})}},min:c,max:f,isSigma:u,value:s.isoValue})};s.prototype.colors=function(){var e=this;var n=this.params.style.params;var i=this.params.style.theme;var a=i.colors.get("Uniform");var o=t.React.createElement(t.Controls.ToggleColorPicker,{key:"Uniform",label:"Color",color:a,onChange:function(t){return e.controller.updateThemeColor("Uniform",t)}});var s=[];s.push(t.React.createElement(r.TransparencyControl,{definition:i.transparency,onChange:function(t){return e.controller.updateThemeTransparency(t)}}));s.push(t.React.createElement(t.Controls.Toggle,{onChange:function(t){return e.controller.updateStyleParams({isWireframe:t})},value:n.isWireframe,label:"Wireframe"}));var u=this.getPersistentState("showThemeOptions",false);return t.React.createElement(t.Controls.ExpandableGroup,{select:o,expander:t.React.createElement(t.Controls.ControlGroupExpander,{isExpanded:u,onChange:function(t){return e.setPersistentState("showThemeOptions",t)}}),options:s,isExpanded:u})};s.prototype.renderControls=function(){return t.React.createElement("div",null,this.surface(),this.colors())};return s}(r.ControllerBase);n.CreateVisual=u;var l=function(n){y(s,n);function s(){return n!==null&&n.apply(this,arguments)||this}s.prototype.surface=function(){var r=this;var n=e.Bootstrap.Tree.Node.findClosestNodeOfType(this.transformSourceEntity,[e.Bootstrap.Entity.Density.Data]);var s=this.params;var u=s.style.params;var l=u.isoValueType!==e.Bootstrap.Visualization.Density.IsoValueType.Absolute;return t.React.createElement(i,{view:this,onChangeValue:function(e){return r.controller.updateStyleParams({isoValue:e})},onChangeType:function(t){if(t===u.isoValueType)return;if(t===e.Bootstrap.Visualization.Density.IsoValueType.Absolute){r.controller.updateStyleParams({isoValue:o(n.props.data,u.isoValue),isoValueType:t})}else{r.controller.updateStyleParams({isoValue:a(n.props.data,u.isoValue,s.isoSigmaMin,s.isoSigmaMax),isoValueType:t})}},min:l?s.isoSigmaMin:n.props.data.valuesInfo.min,max:l?s.isoSigmaMax:n.props.data.valuesInfo.max,isSigma:l,value:u.isoValue})};s.prototype.colors=function(){var e=this;var n=this.params.style.params;var i=this.params.style.theme;var a=i.colors.get("Uniform");var o=t.React.createElement(t.Controls.ToggleColorPicker,{key:"Uniform",label:"Color",color:a,onChange:function(t){return e.controller.updateThemeColor("Uniform",t)}});var s=[];s.push(t.React.createElement(r.TransparencyControl,{definition:i.transparency,onChange:function(t){return e.controller.updateThemeTransparency(t)}}
834));s.push(t.React.createElement(t.Controls.Toggle,{onChange:function(t){return e.controller.updateStyleParams({isWireframe:t})},value:n.isWireframe,label:"Wireframe"}));var u=this.getPersistentState("showThemeOptions",false);return t.React.createElement(t.Controls.ExpandableGroup,{select:o,expander:t.React.createElement(t.Controls.ControlGroupExpander,{isExpanded:u,onChange:function(t){return e.setPersistentState("showThemeOptions",t)}}),options:s,isExpanded:u})};s.prototype.show=function(){var e=this;var r="Around Selection";var n="Everything";var i=this.params;return t.React.createElement(t.Controls.OptionsGroup,{options:[r,n],caption:function(e){return e},current:i.showFull?n:r,onChange:function(t){return e.autoUpdateParams({showFull:t===n})},label:"Show"})};s.prototype.renderControls=function(){var e=this;var r=this.params;return t.React.createElement("div",null,this.surface(),this.colors(),this.show(),!r.showFull?t.React.createElement(t.Controls.Slider,{label:"Radius",onChange:function(t){return e.autoUpdateParams({radius:t})},min:r.minRadius!==void 0?r.minRadius:0,max:r.maxRadius!==void 0?r.maxRadius:10,step:.005,value:r.radius}):void 0)};return s}(r.ControllerBase);n.CreateVisualBehaviour=l})(n=r.Density||(r.Density={}))})(n=r.Transform||(r.Transform={}))})(r=t.Views||(t.Views={}))})(t=e.Plugin||(e.Plugin={}))})(p||(p={}));/* 835 * Copyright (c) 2017 - now David Sehnal, licensed under Apache 2.0, See LICENSE file for more info. 836 */ 837var p;(function(e){var t;(function(e){var t;(function(t){var r;(function(t){var r;(function(t){"use strict";function r(t){var r=t.latestState.params.style;var n=r.theme.colors.map(function(r,n){return e.React.createElement(e.Controls.ToggleColorPicker,{key:n,label:n==="Uniform"?"Font":n,color:r,onChange:function(e){return t.updateThemeColor(n,e)}})}).toArray();return[e.React.createElement(e.Controls.Slider,{label:"Size",onChange:function(e){return t.updateThemeVariable("sizeFactor",e)},min:.1,max:10,step:.1,value:r.theme.variables&&r.theme.variables.get("sizeFactor")||1,title:"Font size."}),e.React.createElement(e.Controls.Slider,{label:"Outline",onChange:function(e){return t.updateThemeVariable("outlineWidth",e)},min:0,max:.3,step:.001,value:r.theme.variables&&r.theme.variables.get("outlineWidth")||0,title:"Font outline."}),e.React.createElement(e.Controls.Slider,{label:"Offset",onChange:function(e){return t.updateThemeVariable("zOffset",e)},min:0,max:5,step:.1,value:r.theme.variables&&r.theme.variables.get("zOffset")||0,title:"Label offset."}),e.React.createElement(e.Controls.Slider,{label:"Bg. Opacity",onChange:function(e){return t.updateThemeVariable("backgroundOpacity",e)},min:0,max:1,step:.01,value:r.theme.variables&&r.theme.variables.get("backgroundOpacity")||0,title:"Background opacity."})].concat(n)}t.optionsControls=r})(r=t.Labels||(t.Labels={}))})(r=t.Transform||(t.Transform={}))})(t=e.Views||(e.Views={}))})(t=e.Plugin||(e.Plugin={}))})(p||(p={}));/* 838 * Copyright (c) 2016 - now David Sehnal, licensed under Apache 2.0, See LICENSE file for more info. 839 */ 840var p;(function(e){var t;(function(t){var r;(function(r){var n;(function(n){"use strict";var i=e.Bootstrap.Service.Logger.EntryType;var a=function(r){y(n,r);function n(){var e=r!==null&&r.apply(this,arguments)||this;e.wrapper=void 0;return e}n.prototype.componentWillMount=function(){var t=this;r.prototype.componentWillMount.call(this);this.subscribe(e.Bootstrap.Event.Common.LayoutChanged.getStream(this.controller.context),function(){return t.scrollToBottom()})};n.prototype.componentDidUpdate=function(){this.scrollToBottom()};n.prototype.scrollToBottom=function(){var e=this.wrapper;if(e)e.scrollTop=e.scrollHeight-e.clientHeight-1};n.prototype.render=function(){var r=this;var n=this.controller.latestState.entries;return t.React.createElement("div",{className:"lm-log-wrap"},t.React.createElement("div",{className:"lm-log",ref:function(e){return r.wrapper=e}},t.React.createElement("ul",{className:"lm-list-unstyled"},n.map(function(r,n,a){var o=r;var s=e.Bootstrap.Utils.formatTime(o.timestamp);return t.React.createElement("li",{key:n},t.React.createElement("div",{className:"lm-log-entry-badge lm-log-entry-"+i[o.type].toLowerCase()}),t.React.createElement("div",{className:"lm-log-timestamp"},s),t.React.createElement("div",{className:"lm-log-entry"},o.message))}))))};return n}(r.View);n.Log=a})(n=r.Context||(r.Context={}))}
840)(r=t.Views||(t.Views={}))})(t=e.Plugin||(e.Plugin={}))})(p||(p={}));/* 841 * Copyright (c) 2016 - now David Sehnal, licensed under Apache 2.0, See LICENSE file for more info. 842 */ 843var p;(function(e){var t;(function(e){var t;(function(t){var r;(function(r){"use strict";var n=function(t){y(r,t);function r(){return t!==null&&t.apply(this,arguments)||this}r.prototype.render=function(){var t=this.props.info;return e.React.createElement("div",{className:"lm-task-state"},e.React.createElement("div",null,t.abort?e.React.createElement(e.Controls.Button,{onClick:function(){return t.abort.call(null)},style:"remove",icon:"abort",title:"Abort",customClass:"lm-btn-icon"}):void 0,e.React.createElement("div",null,t.name,": ",t.message)))};return r}(e.React.Component);var i=function(t){y(r,t);function r(){return t!==null&&t.apply(this,arguments)||this}r.prototype.render=function(){var t=this.controller.latestState;if(!t.tasks.count())return e.React.createElement("div",{className:"lm-empty-control"});var r=[];t.tasks.forEach(function(t,i){return r.push(e.React.createElement(n,{key:i,info:t}))});return e.React.createElement("div",{className:"lm-overlay"},e.React.createElement("div",{className:"lm-overlay-background"}),e.React.createElement("div",{className:"lm-overlay-content-wrap"},e.React.createElement("div",{className:"lm-overlay-content"},e.React.createElement("div",null,r))))};return r}(t.View);r.Overlay=i;var a=function(t){y(r,t);function r(){return t!==null&&t.apply(this,arguments)||this}r.prototype.render=function(){var t=this.controller.latestState;if(!t.tasks.count())return e.React.createElement("div",{className:"lm-empty-control"});var r=[];t.tasks.forEach(function(t,i){return r.push(e.React.createElement(n,{key:i,info:t,isSmall:true}))});return e.React.createElement("div",{className:"lm-background-tasks"},r)};return r}(t.View);r.BackgroundTasks=a})(r=t.Context||(t.Context={}))})(t=e.Views||(e.Views={}))})(t=e.Plugin||(e.Plugin={}))})(p||(p={}));/* 844 * Copyright (c) 2016 - now David Sehnal, licensed under Apache 2.0, See LICENSE file for more info. 845 */ 846var p;(function(e){var t;(function(e){var t;(function(t){var r;(function(r){"use strict";var n=function(t){y(r,t);function r(){return t!==null&&t.apply(this,arguments)||this}r.prototype.hide=function(){var e=this.props.entry;(e.hide||function(){}).call(null)};r.prototype.render=function(){var t=this;var r=this.props.entry;var n=typeof r.message==="string"?e.React.createElement("div",{dangerouslySetInnerHTML:{__html:r.message}}):e.React.createElement("div",null,r.message);return e.React.createElement("div",{className:"lm-toast-entry"},e.React.createElement("div",{className:"lm-toast-title",onClick:function(){return t.hide()}},r.title),e.React.createElement("div",{className:"lm-toast-message"},n),e.React.createElement("div",{className:"lm-toast-clear"}),e.React.createElement("div",{className:"lm-toast-hide"},e.React.createElement(e.Controls.Button,{onClick:function(){return t.hide()},style:"link",icon:"abort",title:"Hide",customClass:"lm-btn-icon"})))};return r}(e.React.Component);var i=function(t){y(r,t);function r(){return t!==null&&t.apply(this,arguments)||this}r.prototype.render=function(){var t=this.controller.latestState;if(!t.entries.count())return e.React.createElement("div",{className:"lm-empty-control"});var r=[];t.entries.forEach(function(e,t){return r.push(e)});r.sort(function(e,t){return e.serialNumber-t.serialNumber});var i=r.map(function(t){return e.React.createElement(n,{key:t.serialNumber,entry:t})});return e.React.createElement("div",{className:"lm-toast-container"},e.React.createElement("div",null,i))};return r}(t.View);r.Toast=i})(r=t.Context||(t.Context={}))})(t=e.Views||(e.Views={}))})(t=e.Plugin||(e.Plugin={}))})(p||(p={}));/* 847 * Copyright (c) 2016 - now David Sehnal, licensed under Apache 2.0, See LICENSE file for more info. 848 */ 849var p;(function(e){var t;(function(t){var r;(function(r){var n;(function(n){"use strict";n.VisibilityControl=function(r){var n=r.entity;var i=function(){e.Bootstrap.Command.Entity.SetVisibility.dispatch(n.tree.context,{entity:n,visible:n.state.visibility===0?false:true})};var a=n.state.visibility;var o,s;if(a===0){o="full";s="Hide"}else if(a===2){o="none";s="Show"}else{o="partial";s="Show"}return t.React.createElement(t.Controls.Button,{title:s,onClick:i,icon:"visual-visibility",style:"link",customClass:"lm-entity-tree-entry-toggle-visible lm-entity-tree-entry-toggle-visible-"+o})};var i=function(r){y(i,r);function i(){var e=r!==null&&r.apply(this,arguments)||this;e.renderedVersion=-1;e.root=void 0;return e}i.prototype.ensureVisible=function(){if(this.ctx.currentEntity===this.props.node){if(this.root)this.props.tree.scrollIntoView(this.root)}};i.prototype.componentDidMount=function(){this.ensureVisible()};i.prototype.componentDidUpdate=function(){this.ensureVisible()};Object.defineProperty(i.prototype,"node",{get:function(){return this.props.node},enumerable:true,configurable:true});i.prototype.shouldComponentUpdate=function(e,t,r){return this.node.version!==this.renderedVersion};i.prototype.componentWillMount=function(){var t=this;this.ctx=this.props.node.tree.context;var r=this.node;this.subscribe(e.Bootstrap.Event.Tree.NodeUpdated.getStream(this.ctx),function(n){if(n.data===r){if(r.version!==t.renderedVersion)t.forceUpdate();if(t.ctx.currentEntity===r&&t.isFullyBound()){setTimeout(e.Bootstrap.Command.Entity.SetCurrent.dispatch(t.ctx,r.children[0]),0)}}})};i.prototype.highlight=function(t){var r=this.node;e.Bootstrap.Command.Entity.Highlight.dispatch(this.ctx,{entities:this.ctx.select(e.Bootstrap.Tree.Selection.byValue(r).subtree()),isOn:t})};i.prototype.row=function(r){var i=this;var a=this.props.node;var o=a.props;var s=a.parent===a;var u=o.label;if(o.description)u+=" ("+o.description+")";return t.React.createElement("div",{className:"lm-entity-tree-entry-body"+(this.ctx.currentEntity===a?" lm-entity-tree-entry-current":"")+(this.isOnCurrentPath()?" lm-entity-tree-entry-current-path":""),ref:function(e){return i.root=e}},t.React.createElement(n.Badge,{type:a.type.info}),t.React.createElement("div",{className:"lm-entity-tree-entry-label-wrap"},t.React.createElement(t.Controls.Button,{onClick:function(){return e.Bootstrap.Command.Entity.SetCurrent.dispatch(i.ctx,a)},customClass:"lm-entity-tree-entry-label",style:"link",title:u},t.React.createElement("span",null,o.label,t.React.createElement("span",{className:"lm-entity-tree-entry-label-tag"},o.description?" "+o.description:void 0)))),!s||r?t.React.createElement(t.Controls.Button,{title:"Remove",onClick:function(){return e.Bootstrap.Command.Tree.RemoveNode.dispatch(a.tree.context,a)},icon:"remove",style:"link",customClass:"lm-entity-tree-entry-remove"}):void 0,s&&!r?void 0:t.React.createElement(n.VisibilityControl,{entity:a}))};i.prototype.renderFlat=function(){var e=this.node;var r=[];for(var n=0,a=e.children;n<a.length;n++){var o=a[n];r.push(t.React.createElement(i,{key:o.id,node:o,tree:this.props.tree}))}return t.React.createElement("div",{key:e.id},r)};i.prototype.isFullyBound=function(){var e=true;for(var t=0,r=this.node.children;t<r.length;t++){var n=r[t];if(!n.transform.props.isBinding){e=false;break}}return e&&this.node.children.length===1};i.prototype.isOnCurrentPath=function(){if(!this.ctx.currentEntity)return false;var e=this.ctx.currentEntity.parent;var t=this.node;while(e.parent!==e){if(e===t)return true;e=e.parent}return false};i.prototype.render=function(){var r=this;var n=this.node;this.renderedVersion=n.version;var a=n.parent===n;if(this.isFullyBound())return this.renderFlat();var o=n.state;var s=0;var u=[];
849for(var l=0,c=n.children;l<c.length;l++){var f=c[l];if(f.isHidden)continue;if(!a)u.push(t.React.createElement(i,{key:f.id,node:f,tree:this.props.tree}));s++}var h;if(u.length){h=o.isCollapsed?t.React.createElement(t.Controls.Button,{style:"link",title:"Expand",onClick:function(){return e.Bootstrap.Command.Entity.ToggleExpanded.dispatch(r.ctx,n)},icon:"expand",customClass:"lm-entity-tree-entry-toggle-group"}):t.React.createElement(t.Controls.Button,{style:"link",title:"Collapse",onClick:function(){return e.Bootstrap.Command.Entity.ToggleExpanded.dispatch(r.ctx,n)},icon:"collapse",customClass:"lm-entity-tree-entry-toggle-group"})}else{if(n.state.visibility===0&&n.type.info.traits.isFocusable){h=t.React.createElement(t.Controls.Button,{style:"link",icon:"focus-on-visual",title:"Focus",onClick:function(){return e.Bootstrap.Command.Entity.Focus.dispatch(r.ctx,r.ctx.select(n))},customClass:"lm-entity-tree-entry-toggle-group"})}}var d=t.React.createElement("div",{className:"lm-entity-tree-entry",onMouseEnter:function(){return r.highlight(true)},onMouseLeave:function(){return r.highlight(false)},onTouchStart:function(){return setTimeout(function(){return r.highlight(true)},1e3/30)},onTouchCancel:function(){return setTimeout(function(){return r.highlight(false)},1e3/30)},onTouchEnd:function(){return setTimeout(function(){return r.highlight(false)},1e3/30)}},h,this.row(s));return t.React.createElement("div",{key:n.id,className:a?"lm-entity-tree-root":""},d,t.React.createElement("div",{className:"lm-entity-tree-children-wrap",style:{display:o.isCollapsed?"none":"block"}},u))};return i}(r.ObserverView);var a=function(r){y(a,r);function a(){var e=r!==null&&r.apply(this,arguments)||this;e.renderedVersion=-1;e.root=void 0;e.splash=n.SplashInfo.Info();return e}a.prototype.scrollIntoView=function(e){var t=this.root;if(!t||!e)return;try{var r=t.getBoundingClientRect();var n=e.getBoundingClientRect();var i=t.scrollTop;if(n.top<r.top){var a=r.top-n.top;t.scrollTop=i-a}else if(n.bottom>r.bottom){var a=n.bottom-r.bottom;t.scrollTop=i+a}}catch(e){}};a.prototype.componentWillMount=function(){var t=this;var r=this.controller.context.tree.root;var n=r.tree.context;this.subscribe(e.Bootstrap.Event.Tree.NodeUpdated.getStream(n),function(e){if(e.data===r){if(r.version!==t.renderedVersion)t.forceUpdate()}})};a.prototype.render=function(){var e=this;var r=this.controller.context.tree.root;this.renderedVersion=r.version;var n=[];for(var a=0,o=r.children;a<o.length;a++){var s=o[a];if(s.isHidden)continue;n.push(t.React.createElement(i,{key:s.id,node:s,tree:this}))}return t.React.createElement("div",{className:"lm-entity-tree",ref:function(t){return e.root=t}},t.React.createElement(i,{key:r.id,node:r,tree:this}),t.React.createElement("div",{className:"lm-entity-tree-children"},n.length?n:this.splash))};return a}(r.View);n.Tree=a})(n=r.Entity||(r.Entity={}))})(r=t.Views||(t.Views={}))})(t=e.Plugin||(e.Plugin={}))})(p||(p={}));/* 850 * Copyright (c) 2016 - now David Sehnal, licensed under Apache 2.0, See LICENSE file for more info. 851 */ 852var p;(function(e){var t;(function(t){var r;(function(r){var n;(function(n){"use strict";n.Remove=function(r){return t.React.createElement(t.Controls.Button,{onClick:function(){e.Bootstrap.Command.Tree.RemoveNode.dispatch(r.entity.tree.context,r.entity);r.onRemove.call(null)},style:"link",icon:"remove",customClass:"lm-remove-entity lm-btn-icon"})};var i=function(r){y(n,r);function n(){return r!==null&&r.apply(this,arguments)||this}n.prototype.shouldComponentUpdate=function(e,t,r){return this.props.type!==e.type};n.prototype.createBadge=function(e){if(!e.length)return;for(var r=0;r<e.length;r++){if(e[r]==="_"){return t.React.createElement("span",null,e.substr(0,r),t.React.createElement("sub",null,this.createBadge(e.substr(r+1))))}else if(e[r]==="^"){return t.React.createElement("span",null,e.substr(0,r),t.React.createElement("sup",null,this.createBadge(e.substr(r+1))))}}return e};n.prototype.render=function(){var r=this.props.type;return t.React.createElement("div",{className:"lm-entity-badge lm-entity-badge-"+this.props.type.typeClass,title:r.name},t.React.createElement("div",null,r===e.Bootstrap.Entity.Root.info?void 0:this.createBadge(r.shortName)))};return n}(t.React.Component);n.Badge=i;var a=function(r){y(a,r);function a(){var e=r!==null&&r.apply(this,arguments)||this;e.state={current:void 0};return e}a.prototype.componentWillMount=function(){var t=this;r.prototype.componentWillMount.call(this);this.state.current=this.controller.context.currentEntity;this.subscribe(e.Bootstrap.Event.Entity.CurrentChanged.getStream(this.controller.context),function(e){t.setState({current:e.data})})};a.prototype.render=function(){var e=this;if(!this.state.current){return t.React.createElement("div",{className:"lm-entity-info"},t.React.createElement("div",null,t.React.createElement("span",null,this.controller.appName)))}var r=this.state.current;return t.React.createElement("div",{className:"lm-entity-info",title:r.props.label+" "+(r.props.description?r.props.description:"")},t.React.createElement("div",null,t.React.createElement(i,{type:r.type.info}),t.React.createElement("span",null,r.props.label,t.React.createElement("span",null,r.props.description)),r.parent===r&&!r.children.length?void 0:t.React.createElement(n.Remove,{entity:r,onRemove:function(){return e.forceUpdate()}})))};return a}
852(r.View);n.CurrentEntityControl=a;var o;(function(e){e.General=function(){return t.React.createElement("div",{className:"lm-entity-splash-general"},t.React.createElement("div",null),t.React.createElement("span",{className:"lm-icon lm-icon-info"}),"The application operates on an entity tree structure that can be manipulated using the controls on the panel to the right.")};var r=function(e){y(r,e);function r(){var t=e!==null&&e.apply(this,arguments)||this;t.state={isExpanded:false};return t}r.prototype.render=function(){var e=this;return t.React.createElement("div",{className:"lm-entity-splash-class lm-entity-splash-class-"+(this.state.isExpanded?"expanded":"collapsed")},t.React.createElement("div",{onClick:function(){return e.setState({isExpanded:!e.state.isExpanded})}},t.React.createElement("div",null),t.React.createElement("div",{className:"lm-entity-badge-"+this.props.cls})," ",t.React.createElement("span",null,this.props.cls)),t.React.createElement("div",null,this.props.desc))};return r}(t.React.Component);e.Info=function(){return t.React.createElement("div",{className:"lm-entity-splash"},t.React.createElement(e.General,null),t.React.createElement(r,{cls:"Root",desc:"The root entity represents the starting point of all actions."}),t.React.createElement(r,{cls:"Action",desc:"Represents a composition of one of more changes to the entity tree."}),t.React.createElement(r,{cls:"Data",desc:"Low level data, for example a string or a CIF dictionary."}),t.React.createElement(r,{cls:"Object",desc:"A more complex structure obtained from low level data. For example a molecule."}),t.React.createElement(r,{cls:"Visual",desc:"A visual representation of an object."}),t.React.createElement(r,{cls:"Selection",desc:"A description of a substructure of an object or a visual."}),t.React.createElement(r,{cls:"Behaviour",desc:"Represents a dynamic behavior of the program. For example creating electron density surface when the selection changes."}),t.React.createElement(r,{cls:"Group",desc:"A collection of related entities."}))}})(o=n.SplashInfo||(n.SplashInfo={}))})(n=r.Entity||(r.Entity={}))})(r=t.Views||(t.Views={}))})(t=e.Plugin||(e.Plugin={}))})(p||(p={}));/* 853 * Copyright (c) 2016 - now David Sehnal, licensed under Apache 2.0, See LICENSE file for more info. 854 */ 855var p;(function(e){var t;(function(t){var r;(function(r){var n;(function(n){"use strict";var i=function(r){y(n,r);function n(){var e=r!==null&&r.apply(this,arguments)||this;e.state={showSceneOptions:false,showHelp:false};return e}n.prototype.help=function(){return t.React.createElement("div",{className:"lm-viewport-controls-scene-options lm-control"},t.React.createElement(t.Controls.HelpBox,{title:"Rotate",content:t.React.createElement("div",null,t.React.createElement("div",null,"Left button"),t.React.createElement("div",null,"One finger touch"))}),t.React.createElement(t.Controls.HelpBox,{title:"Zoom",content:t.React.createElement("div",null,t.React.createElement("div",null,"Right button"),t.React.createElement("div",null,"Pinch"))}),t.React.createElement(t.Controls.HelpBox,{title:"Move",content:t.React.createElement("div",null,t.React.createElement("div",null,"Middle button"),t.React.createElement("div",null,"Two finger touch"))}),t.React.createElement(t.Controls.HelpBox,{title:"Slab",content:t.React.createElement("div",null,t.React.createElement("div",null,"Mouse wheel"),t.React.createElement("div",null,"Three finger touch"))}))};n.prototype.render=function(){var r=this;var n=this.controller.latestState;var i;var a=this.controller.context.layout;var o=a.latestState;if(this.state.showSceneOptions){i=t.React.createElement("div",{className:"lm-viewport-controls-scene-options lm-control"},t.React.createElement(t.Controls.Toggle,{onChange:function(e){return r.controller.setState({enableFog:e})},value:n.enableFog,label:"Fog"}),t.React.createElement(t.Controls.Slider,{label:"FOV",min:30,max:90,onChange:function(e){return r.controller.setState({cameraFOV:e})},value:n.cameraFOV}),t.React.createElement(t.Controls.Slider,{label:"Camera Speed",min:1,max:10,step:.01,onChange:function(e){return r.controller.setState({cameraSpeed:e})},value:n.cameraSpeed}),t.React.createElement(t.Controls.ToggleColorPicker,{color:n.clearColor,label:"Backgroun
855d",position:"below",onChange:function(e){return r.controller.setState({clearColor:e})}}))}else if(this.state.showHelp){i=this.help()}var s=!o.hideControls;return t.React.createElement("div",{className:"lm-viewport-controls",onMouseLeave:function(){return r.setState({showSceneOptions:false,showHelp:false})}},t.React.createElement("div",{className:"lm-viewport-controls-buttons"},t.React.createElement(t.Controls.Button,{style:"link",active:this.state.showHelp,customClass:"lm-btn-link-toggle-"+(this.state.showHelp?"on":"off"),icon:"help-circle",onClick:function(e){return r.setState({showHelp:!r.state.showHelp,showSceneOptions:false})},title:"Controls Help"}),t.React.createElement(t.Controls.Button,{style:"link",active:this.state.showSceneOptions,customClass:"lm-btn-link-toggle-"+(this.state.showSceneOptions?"on":"off"),icon:"settings",onClick:function(e){return r.setState({showSceneOptions:!r.state.showSceneOptions,showHelp:false})},title:"Scene Options"}),t.React.createElement(t.Controls.Button,{style:"link",icon:"screenshot",onClick:function(e){return r.controller.scene.scene.downloadScreenshot()},title:"Screenshot"}),t.React.createElement(t.Controls.Button,{onClick:function(){a.update({hideControls:s});r.forceUpdate()},icon:"tools",title:s?"Hide Controls":"Show Controls",active:s,customClass:"lm-btn-link-toggle-"+(s?"on":"off"),style:"link"}),t.React.createElement(t.Controls.Button,{onClick:function(){return a.update({isExpanded:!o.isExpanded})},icon:"expand-layout",title:o.isExpanded?"Collapse":"Expand",active:o.isExpanded,customClass:"lm-btn-link-toggle-"+(o.isExpanded?"on":"off"),style:"link"}),t.React.createElement(t.Controls.Button,{style:"link",icon:"reset-scene",onClick:function(t){return e.Bootstrap.Command.Visual.ResetScene.dispatch(r.controller.context,void 0)},title:"Reset scene"})),i)};return n}(r.View);n.ViewportControls=i;var a=function(e){y(r,e);function r(){return e!==null&&e.apply(this,arguments)||this}r.prototype.render=function(){var e=this.controller.latestState;var r=e.info;if(!r.length){return t.React.createElement("div",{className:"lm-empty-control"})}var n={__html:r.join(", ")};return t.React.createElement("div",{className:"lm-highlight-info"},t.React.createElement("div",{dangerouslySetInnerHTML:n}))};return r}(r.View);n.HighlightInfo=a;n.Logo=function(){return t.React.createElement("div",{className:"lm-logo"},t.React.createElement("div",null,t.React.createElement("div",null,t.React.createElement("div",null),t.React.createElement("div",{className:"lm-logo-image"}))))};var o=function(r){y(a,r);function a(){var e=r!==null&&r.apply(this,arguments)||this;e.host3d=void 0;e.defaultBg={r:0,g:0,b:0};e.state={noWebGl:false,showLogo:true};return e}a.prototype.componentDidMount=function(){if(!this.host3d||!this.controller.init(this.host3d)){this.setState({noWebGl:true})}this.handleLogo()};a.prototype.componentWillUnmount=function(){r.prototype.componentWillUnmount.call(this);this.controller.destroy()};a.prototype.renderMissing=function(){return t.React.createElement("div",{className:"lm-no-webgl"},t.React.createElement("div",null,t.React.createElement("p",null,t.React.createElement("b",null,"WebGL does not seem to be available.")),t.React.createElement("p",null,"This can be caused by an outdated browser, graphics card driver issue, or bad weather. Sometimes, just restarting the browser helps."),t.React.createElement("p",null,"For a list of supported browsers, refer to ",t.React.createElement("a",{href:"http://caniuse.com/#feat=webgl",target:"_blank"},"http://caniuse.com/#feat=webgl"),".")))};a.prototype.handleLogo=function(){var t=this;this.subscribe(e.Bootstrap.Event.Tree.NodeAdded.getStream(this.controller.context),function(r){if(e.Bootstrap.Entity.isClass(r.data,e.Bootstrap.Entity.VisualClass)){setTimeout(function(){return t.setState({showLogo:t.getShowLogo()})},0)}});this.subscribe(e.Bootstrap.Event.Tree.NodeRemoved.getStream(this.controller.context),function(r){if(e.Bootstrap.Entity.isClass(r.data,e.Bootstrap.Entity.VisualClass)){setTimeout(function(){return t.setState({showLogo:t.getShowLogo()})},0)}})};a.prototype.getShowLogo=function(){try{return this.controller.context.viewport.scene.models.isEmpty()}catch(e){return true}};a.prototype.render=function(){var e=this;if(this.state.noWebGl)return this.renderMissing();var r=this.controller.latestState.clearColor||this.defaultBg;return t.React.createElement("div",{className:"lm-viewport",style:{backgroundColor:"rgb("+255*r.r+", "+255*r.g+", "+255*r.b+")"}},t.React.createElement("div",{ref:function(t){return e.host3d=t},className:"lm-viewport-host3d"}),this.state.showLogo?t.React.createElement(n.Logo,null):void 0,t.React.createElement(i,{controller:this.controller}))};return a}
855(r.View);n.Viewport=o})(n=r.Visualization||(r.Visualization={}))})(r=t.Views||(t.Views={}))})(t=e.Plugin||(e.Plugin={}))})(p||(p={}));/* 856 * Copyright (c) 2016 - now David Sehnal, licensed under Apache 2.0, See LICENSE file for more info. 857 */ 858var p;(function(e){var t;(function(t){var r;(function(r){"use strict";function n(e,t,r){return function(n,i){return function(a){return{key:e,controller:t(a),region:n,view:r,isStatic:i}}}}r.create=n;var i=function(e){y(t,e);function t(t,r,n){var i=e.call(this,t,{})||this;i.appName=r;i.appVersion=n;return i}return t}(e.Bootstrap.Components.Component);r.AppInfo=i;var a;(function(r){r.Log=n("Context.Log",function(t){return new e.Bootstrap.Components.Context.Log(t)},t.Views.Context.Log);r.Toast=n("Context.Toast",function(t){return new e.Bootstrap.Components.Context.Toast(t)},t.Views.Context.Toast);r.Overlay=n("Context.Overlay",function(t){return new e.Bootstrap.Components.Context.TaskWatcher(t,"Normal")},t.Views.Context.Overlay);r.BackgroundTasks=n("Context.BackgroundTasks",function(t){return new e.Bootstrap.Components.Context.TaskWatcher(t,"Background")},t.Views.Context.BackgroundTasks)})(a=r.Context||(r.Context={}));var o;(function(r){r.View=n("Transform.View",function(t){return new e.Bootstrap.Components.Transform.View(t)},t.Views.Transform.View)})(o=r.Transform||(r.Transform={}));var s;(function(e){e.Current=function(e,r){return n("EntityInfo",function(t){return new i(t,e,r)},t.Views.Entity.CurrentEntityControl)}})(s=r.Entity||(r.Entity={}));var u;(function(r){r.Viewport=n("Viewport",function(t){return new e.Bootstrap.Components.Visualization.Viewport(t)},t.Views.Visualization.Viewport);r.HighlightInfo=n("HighlightInfo",function(t){return new e.Bootstrap.Components.Visualization.HighlightInfo(t)},t.Views.Visualization.HighlightInfo)})(u=r.Visualization||(r.Visualization={}))})(r=t.Components||(t.Components={}))})(t=e.Plugin||(e.Plugin={}))})(p||(p={}));/* 859 * Copyright (c) 2016 - now David Sehnal, licensed under Apache 2.0, See LICENSE file for more info. 860 */ 861var p;(function(e){var t;(function(t){"use strict";t.Context=e.Bootstrap.Context;var r=e.Bootstrap.Components.LayoutRegion;var n=function(){function n(r,n){this.spec=r;this.target=n;this.transformersInfo=e.Core.Utils.FastMap.create();this.context=new e.Bootstrap.Context(this);this.init();t.ReactDOM.render(t.React.createElement(this.spec.layoutView,{controller:this.context.layout}),n);e.Bootstrap.Command.Entity.SetCurrent.dispatch(this.context,this.context.tree.root)}n.prototype.compose=function(){for(var e=0,t=Object.keys(this.spec.settings);e<t.length;e++){var r=t[e];if(!Object.prototype.hasOwnProperty.call(this.spec.settings,r))continue;this.context.settings.set(r,this.spec.settings[r])}for(var n=0,i=this.spec.behaviours||[];n<i.length;n++){var a=i[n];a(this.context)}for(var o=0,s=this.spec.transforms;o<s.length;o++){var u=s[o];this.context.transforms.add(u.transformer);this.transformersInfo.set(u.transformer.info.id,u)}};n.prototype.prepareTargets=function(){var t=e.Bootstrap.Components.makeEmptyTargets();var n=e.Core.Utils.FastMap.create();for(var i=0,a=this.spec.components;i<a.length;i++){var o=a[i];var s=o(this.context);if(n.has(s.key)){throw"Component with key '"+s.key+"' was already added. Fix your spec."}t[s.region].components.push(s);n.set(s.key,s)}if(this.spec.tree){t[this.spec.tree.region].components.push({key:"lm-internal-tree",controller:new e.Bootstrap.Components.Component(this.context,{}),region:this.spec.tree.region,view:this.spec.tree.view,isStatic:true})}t[r.Main].components.push({key:"lm-internal-viewport",controller:this.context.viewport,region:r.Main,view:this.spec.viewport.view,isStatic:true});return t};n.prototype.getTransformerInfo=function(e){return this.transformersInfo.get(e.info.id)};n.prototype.destroy=function(){this.context.dispatcher.finished();t.ReactDOM.unmountComponentAtNode(this.target);this.context=void 0;this.spec=void 0;this.target=void 0};n.prototype.setComponents=function(e){this.spec.components=e;var t=this.prepareTargets();this.context.layout.updateTargets(t)};n.prototype.init=function(){this.compose();var e=this.prepareTargets();this.context.createLayout(e,this.target)};return n}();t.Instance=n})(t=e.Plugin||(e.Plugin={}))})(p||(p={}));/* 862 * Copyright (c) 2016 - now David Sehnal, licensed under Apache 2.0, See LICENSE file for more info. 863 */ 864var p;(function(e){var t;(function(t){"use strict";var r=e.Bootstrap.Entity.Transformer;var n;(function(e){e.DownloadMolecule=r.Molecule.downloadMoleculeSource({sourceId:"url-molecule",name:"URL",description:"Download a molecule from the specified URL (if the host server supports cross domain requests).",defaultId:"https://webchem.ncbr.muni.cz/CoordinateServer/1tqn/cartoon",urlTemplate:function(e){return e},isFullUrl:true})}
864)(n=t.DataSources||(t.DataSources={}));var i=e.Bootstrap.Components.LayoutRegion;function a(){return{settings:{"molecule.model.defaultQuery":"residues({ name: 'ALA' })","molecule.model.defaultAssemblyName":"1","molecule.coordinateStreaming.defaultId":"1jj2","molecule.coordinateStreaming.defaultServer":"https://webchem.ncbr.muni.cz/CoordinateServer","molecule.coordinateStreaming.defaultRadius":10,"density.defaultVisualBehaviourRadius":5},transforms:[{transformer:r.Molecule.CoordinateStreaming.InitStreaming,view:t.Views.Transform.Molecule.InitCoordinateStreaming,initiallyCollapsed:true},{transformer:n.DownloadMolecule,view:t.Views.Transform.Data.WithUrlIdField,initiallyCollapsed:true},{transformer:r.Molecule.OpenMoleculeFromFile,view:t.Views.Transform.Molecule.OpenFile,initiallyCollapsed:true},{transformer:r.Data.Download,view:t.Views.Transform.Data.Download,initiallyCollapsed:true},{transformer:r.Data.OpenFile,view:t.Views.Transform.Data.OpenFile,initiallyCollapsed:true},{transformer:r.Molecule.CreateFromData,view:t.Views.Transform.Molecule.CreateFromData},{transformer:r.Data.ParseCif,view:t.Views.Transform.Empty},{transformer:r.Density.ParseData,view:t.Views.Transform.Density.ParseData},{transformer:r.Molecule.CreateFromMmCif,view:t.Views.Transform.Molecule.CreateFromMmCif},{transformer:r.Molecule.CreateModel,view:t.Views.Transform.Molecule.CreateModel,initiallyCollapsed:true},{transformer:r.Molecule.CreateSelection,view:t.Views.Transform.Molecule.CreateSelection,initiallyCollapsed:true},{transformer:r.Molecule.CreateAssembly,view:t.Views.Transform.Molecule.CreateAssembly,initiallyCollapsed:true},{transformer:r.Molecule.CreateSymmetryMates,view:t.Views.Transform.Molecule.CreateSymmetryMates,initiallyCollapsed:true},{transformer:r.Molecule.CreateMacromoleculeVisual,view:t.Views.Transform.Empty},{transformer:r.Molecule.CreateVisual,view:t.Views.Transform.Molecule.CreateVisual},{transformer:r.Density.CreateVisual,view:t.Views.Transform.Density.CreateVisual},{transformer:r.Density.CreateVisualBehaviour,view:t.Views.Transform.Density.CreateVisualBehaviour},{transformer:r.Molecule.CoordinateStreaming.CreateBehaviour,view:t.Views.Transform.Empty,initiallyCollapsed:true}],behaviours:[e.Bootstrap.Behaviour.SetEntityToCurrentWhenAdded,e.Bootstrap.Behaviour.FocusCameraOnSelect,e.Bootstrap.Behaviour.ApplySelectionToVisual,e.Bootstrap.Behaviour.ApplyInteractivitySelection,e.Bootstrap.Behaviour.UnselectElementOnRepeatedClick,e.Bootstrap.Behaviour.Molecule.HighlightElementInfo,e.Bootstrap.Behaviour.Molecule.DistanceToLastClickedElement,e.Bootstrap.Behaviour.Molecule.ShowInteractionOnSelect(5)],components:[t.Components.Visualization.HighlightInfo(i.Main,true),t.Components.Entity.Current("LiteMol",t.VERSION.number)(i.Right,true),t.Components.Transform.View(i.Right),t.Components.Context.Log(i.Bottom,true),t.Components.Context.Overlay(i.Root),t.Components.Context.Toast(i.Main,true),t.Components.Context.BackgroundTasks(i.Main,true)],viewport:{view:t.Views.Visualization.Viewport,controlsView:t.Views.Visualization.ViewportControls},layoutView:t.Views.Layout,tree:{region:i.Left,view:t.Views.Entity.Tree}}}t.getDefaultSpecification=a})(t=e.Plugin||(e.Plugin={}))})(p||(p={}));/* 865 * Copyright (c) 2016 - now David Sehnal, licensed under Apache 2.0, See LICENSE file for more info. 866 */ 867var p;(function(e){var t;(function(t){"use strict";var r=e.Bootstrap.Entity;var n=r.Transformer;var i=function(){function i(e){if(e.getTransformerInfo){this.ofInstace(e)}else{this.ofOptions(e)}}Object.defineProperty(i.prototype,"instance",{get:function(){return this._instance},enumerable:true,configurable:true});Object.defineProperty(i.prototype,"context",{get:function(){return this._instance.context},enumerable:true,configurable:true});Object.defineProperty(i.prototype,"root",{get:function(){return this._instance.context.tree.root},enumerable:true,configurable:true});i.prototype.command=function(e,t){e.dispatch(this.context,t)};i.prototype.selectEntities=function(e){return this.context.select(e)};i.prototype.subscribe=function(e,t){return e.getStream(this.context).subscribe(t)};i.prototype.createTransform=function(){return e.Bootstrap.Tree.Transform.build()};i.prototype.applyTransform=function(t){var r=this.context;return e.Bootstrap.Tree.Transform.apply(r,t).run()};i.prototype.clear=function(){this.command(e.Bootstrap.Command.Tree.RemoveNode,this.root)};
867i.prototype.setViewportBackground=function(t){if(e.Visualization.Color.isColor(t)){this.command(e.Bootstrap.Command.Layout.SetViewportOptions,{clearColor:t})}else{this.command(e.Bootstrap.Command.Layout.SetViewportOptions,{clearColor:e.Visualization.Color.fromHexString(t)})}};i.prototype.setLayoutState=function(t){this.command(e.Bootstrap.Command.Layout.SetState,t)};i.prototype.loadMolecule=function(t){var i=this.createTransform();if(!t.url&&!t.data){throw new Error("Please specify either url or data")}var a=e.Core.Formats.Molecule.SupportedFormats.mmCIF;if(t.format){if(e.Core.Formats.FormatInfo.is(t.format)){a=t.format}else{var o=e.Core.Formats.FormatInfo.fromShortcut(e.Core.Formats.Molecule.SupportedFormats.All,t.format);if(!o){throw new Error("'"+t.format+"' is not a supported format.")}a=o}}var s=t.data?i.add(this.root,r.Transformer.Data.FromData,{data:t.data,id:t.id}):i.add(this.root,n.Data.Download,{url:t.url,type:a.isBinary?"Binary":"String",id:t.id,title:"Molecule"});var u=s.then(n.Molecule.CreateFromData,{format:a,customId:t.id},{isBinding:true,ref:t.moleculeRef}).then(n.Molecule.CreateModel,{modelIndex:0},{isBinding:false,ref:t.modelRef});if(!t.doNotCreateVisual){u.then(n.Molecule.CreateMacromoleculeVisual,{polymer:true,het:true,water:true})}return this.applyTransform(s)};i.prototype.destroy=function(){if(!this._instance)return;this._instance.destroy();this._instance=void 0};i.prototype.ofOptions=function(r){var n=r.customSpecification?r.customSpecification:t.getDefaultSpecification();if(!!r.allowAnalytics&&!r.customSpecification){n.behaviours.push(e.Bootstrap.Behaviour.GoogleAnalytics(r.analyticsId?r.analyticsId:"UA-77062725-1"))}var i;if(r.target instanceof HTMLElement){i=r.target}else{i=document.querySelector(r.target)}if(!i){throw new Error("options.target cannot be undefined.")}this._instance=new t.Instance(n,i);if(r.viewportBackground){this.setViewportBackground(r.viewportBackground)}if(r.layoutState){this.setLayoutState(r.layoutState)}};i.prototype.ofInstace=function(e){this._instance=e};return i}();t.Controller=i;function a(e){return new i(e)}t.create=a})(t=e.Plugin||(e.Plugin={}))})(p||(p={}));return p};if(typeof module==="object"&&typeof module.exports==="object"){module.exports=__LiteMol_Plugin()}else if(typeof define==="function"&&define.amd){define(["require"],function(e){return __LiteMol_Plugin()})}else{var __target=!!window?window:this;__target.LiteMol=__LiteMol_Plugin()}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.