pdb-lite-mol
Version:
Web-component implementation of LiteMol 3D structure viewer. LiteMol is a streamlined structure viewer which enables a PDB structure to be explored within a browser rather than requiring pre-installed molecular graphics software. It is a PDB Component dev
68 lines • 1.53 MB
JavaScript
/**
* PDB LiteMol
* @version v0.1.0
* @link http://www.ebi.ac.uk/pdbe/pdb-component-library/doc.html#a_LiteMol
* @license Apache 2.0
*/
/**
* Copyright 2015-2016 Mandar Deshpande <mandar@ebi.ac.uk>
* European Bioinformatics Institute (EBI, http://www.ebi.ac.uk/)
* European Molecular Biology Laboratory (EMBL, http://www.embl.de/)
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
(function(){"use strict";function e(e){return"function"==typeof e||"object"==typeof e&&null!==e}function t(e){return"function"==typeof e}function n(e){j=e}function r(e){X=e}function i(){return function(){process.nextTick(c)}}function o(){return function(){H(c)}}function a(){var e=0,t=new Q(c),n=document.createTextNode("");return t.observe(n,{characterData:!0}),function(){n.data=e=++e%2}}function s(){var e=new MessageChannel;return e.port1.onmessage=c,function(){e.port2.postMessage(0)}}function u(){return function(){setTimeout(c,1)}}function c(){for(var e=0;q>e;e+=2){var t=et[e],n=et[e+1];t(n),et[e]=void 0,et[e+1]=void 0}q=0}function l(){try{var e=require,t=e("vertx");return H=t.runOnLoop||t.runOnContext,o()}catch(n){return u()}}function h(e,t){var n=this,r=new this.constructor(p);void 0===r[rt]&&I(r);var i=n._state;if(i){var o=arguments[i-1];X(function(){P(i,r,o,n._result)})}else S(n,r,e,t);return r}function f(e){var t=this;if(e&&"object"==typeof e&&e.constructor===t)return e;var n=new t(p);return w(n,e),n}function p(){}function d(){return new TypeError("You cannot resolve a promise with itself")}function m(){return new TypeError("A promises callback cannot return that same promise.")}function v(e){try{return e.then}catch(t){return st.error=t,st}}function g(e,t,n,r){try{e.call(t,n,r)}catch(i){return i}}function y(e,t,n){X(function(e){var r=!1,i=g(n,t,function(n){r||(r=!0,t!==n?w(e,n):C(e,n))},function(t){r||(r=!0,E(e,t))},"Settle: "+(e._label||" unknown promise"));!r&&i&&(r=!0,E(e,i))},e)}function b(e,t){t._state===ot?C(e,t._result):t._state===at?E(e,t._result):S(t,void 0,function(t){w(e,t)},function(t){E(e,t)})}function x(e,n,r){n.constructor===e.constructor&&r===tt&&constructor.resolve===nt?b(e,n):r===st?E(e,st.error):void 0===r?C(e,n):t(r)?y(e,n,r):C(e,n)}function w(t,n){t===n?E(t,d()):e(n)?x(t,n,v(n)):C(t,n)}function _(e){e._onerror&&e._onerror(e._result),M(e)}function C(e,t){e._state===it&&(e._result=t,e._state=ot,0!==e._subscribers.length&&X(M,e))}function E(e,t){e._state===it&&(e._state=at,e._result=t,X(_,e))}function S(e,t,n,r){var i=e._subscribers,o=i.length;e._onerror=null,i[o]=t,i[o+ot]=n,i[o+at]=r,0===o&&e._state&&X(M,e)}function M(e){var t=e._subscribers,n=e._state;if(0!==t.length){for(var r,i,o=e._result,a=0;a<t.length;a+=3)r=t[a],i=t[a+n],r?P(n,r,i,o):i(o);e._subscribers.length=0}}function T(){this.error=null}function A(e,t){try{return e(t)}catch(n){return ut.error=n,ut}}function P(e,n,r,i){var o,a,s,u,c=t(r);if(c){if(o=A(r,i),o===ut?(u=!0,a=o.error,o=null):s=!0,n===o)return void E(n,m())}else o=i,s=!0;n._state!==it||(c&&s?w(n,o):u?E(n,a):e===ot?C(n,o):e===at&&E(n,o))}function k(e,t){try{t(function(t){w(e,t)},function(t){E(e,t)})}catch(n){E(e,n)}}function R(){return ct++}function I(e){e[rt]=ct++,e._state=void 0,e._result=void 0,e._subscribers=[]}function D(e){return new dt(this,e).promise}function B(e){var t=this;return new t(W(e)?function(n,r){for(var i=e.length,o=0;i>o;o++)t.resolve(e[o]).then(n,r)}:function(e,t){t(new TypeError("You must pass an array to race."))})}function V(e){var t=this,n=new t(p);return E(n,e),n}function L(){throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")}function N(){throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.")}function O(e){this[rt]=R(),this._result=this._state=void 0,this._subscribers=[],p!==e&&("function"!=typeof e&&L(),this instanceof O?k(this,e):N())}function F(e,t){this._instanceConstructor=e,this.promise=new e(p),this.promise[rt]||I(this.promise),Array.isArray(t)?(this._input=t,this.length=t.length,this._remaining=t.length,this._result=new Array(this.length),0===this.length?C(this.promise,this._result):(this.length=this.length||0,this._enumerate(),0===this._remaining&&C(this.promise,this._result))):E(this.promise,U())}function U(){return new Error("Array Methods must be provided an Array")}function z(){var e;if("undefined"!=typeof global)e=global;else if("undefined"!=typeof self)e=self;else try{e=Function("return this")()}catch(t){throw new Error("polyfill failed because global object is unavailable in this environment")}var n=e.Promise;(!n||"[object Promise]"!==Object.prototype.toString.call(n.resolve())||n.cast)&&(e.Promise=pt)}var $;$=Array.isArray?Array.isArray:function(e){return"[object Array]"===Object.prototype.toString.call(e)};var H,j,G,W=$,q=0,X=function(e,t){et[q]=e,et[q+1]=t,q+=2,2===q&&(j?j(c):G())},Y="undefined"!=typeof window?window:void 0,K=Y||{},Q=K.MutationObserver||K.WebKitMutationObserver,Z="undefined"==typeof self&&"undefined"!=typeof process&&"[object process]"==={}.toString.call(process),J="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel,et=new Array(1e3);G=Z?i():Q?a():J?s():void 0===Y&&"function"==typeof require?l():u();var tt=h,nt=f,rt=Math.random().toString(36).substring(16),it=void 0,ot=1,at=2,st=new T,ut=new T,ct=0,lt=D,ht=B,ft=V,pt=O;O.all=lt,O.race=ht,O.resolve=nt,O.reject=ft,O._setScheduler=n,O._setAsap=r,O._asap=X,O.prototype={constructor:O,then:tt,"catch":function(e){return this.then(null,e)}};var dt=F;F.prototype._enumerate=function(){for(var e=this.length,t=this._input,n=0;this._state===it&&e>n;n++)this._eachEntry(t[n],n)},F.prototype._eachEntry=function(e,t){var n=this._instanceConstructor,r=n.resolve;if(r===nt){var i=v(e);if(i===tt&&e._state!==it)this._settledAt(e._state,t,e._result);else if("function"!=typeof i)this._remaining--,this._result[t]=e;else if(n===pt){var o=new n(p);x(o,e,i),this._willSettleAt(o,t)}else this._willSettleAt(new n(function(t){t(e)}),t)}else this._willSettleAt(r(e),t)},F.prototype._settledAt=function(e,t,n){var r=this.promise;r._state===it&&(this._remaining--,e===at?E(r,n):this._result[t]=n),0===this._remaining&&C(r,this._result)},F.prototype._willSettleAt=function(e,t){var n=this;S(e,void 0,function(e){n._settledAt(ot,t,e)},function(e){n._settledAt(at,t,e)})};var mt=z,vt={Promise:pt,polyfill:mt};"function"==typeof define&&define.amd?define(function(){return vt}):"undefined"!=typeof module&&module.exports?module.exports=vt:"undefined"!=typeof this&&(this.ES6Promise=vt),mt()}).call(this);var __LiteMol_Plugin=function(){"use strict";var e;!function(){var t={},n={};!function(e){if("object"==typeof t&&"undefined"!=typeof n)n.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var r;r="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,r.React=e()}}(function(){return function e(t,n,r){function i(a,s){if(!n[a]){if(!t[a]){var u="function"==typeof require&&require;if(!s&&u)return u(a,!0);if(o)return o(a,!0);var c=new Error("Cannot find module '"+a+"'");throw c.code="MODULE_NOT_FOUND",c}var l=n[a]={exports:{}};t[a][0].call(l.exports,function(e){var n=t[a][1][e];return i(n?n:e)},l,l.exports,e,t,n,r)}return n[a].exports}for(var o="function"==typeof require&&require,a=0;a<r.length;a++)i(r[a]);return i}({1:[function(e,t){var n=e(40),r=e(148),i={focusDOMComponent:function(){r(n.getNodeFromInstance(this))}};t.exports=i},{148:148,40:40}],2:[function(e,t){function n(){var e=window.opera;return"object"==typeof e&&"function"==typeof e.version&&parseInt(e.version(),10)<=12}function r(e){return(e.ctrlKey||e.altKey||e.metaKey)&&!(e.ctrlKey&&e.altKey)}function i(e){switch(e){case T.topCompositionStart:return A.compositionStart;case T.topCompositionEnd:return A.compositionEnd;case T.topCompositionUpdate:return A.compositionUpdate}}function o(e,t){return e===T.topKeyDown&&t.keyCode===x}function a(e,t){switch(e){case T.topKeyUp:return-1!==b.indexOf(t.keyCode);case T.topKeyDown:return t.keyCode!==x;case T.topKeyPress:case T.topMouseDown:case T.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,n,r){var u,c;if(w?u=i(e):k?a(e,n)&&(u=A.compositionEnd):o(e,n)&&(u=A.compositionStart),!u)return null;E&&(k||u!==A.compositionStart?u===A.compositionEnd&&k&&(c=k.getData()):k=m.getPooled(r));var l=v.getPooled(u,t,n,r);if(c)l.data=c;else{var h=s(n);null!==h&&(l.data=h)}return p.accumulateTwoPhaseDispatches(l),l}function c(e,t){switch(e){case T.topCompositionEnd:return s(t);case T.topKeyPress:var n=t.which;return n!==S?null:(P=!0,M);case T.topTextInput:var r=t.data;return r===M&&P?null:r;default:return null}}function l(e,t){if(k){if(e===T.topCompositionEnd||a(e,t)){var n=k.getData();return m.release(k),k=null,n}return null}switch(e){case T.topPaste:return null;case T.topKeyPress:return t.which&&!r(t)?String.fromCharCode(t.which):null;case T.topCompositionEnd:return E?null:t.data;default:return null}}function h(e,t,n,r){var i;if(i=C?c(e,n):l(e,n),!i)return null;var o=g.getPooled(A.beforeInput,t,n,r);return o.data=i,p.accumulateTwoPhaseDispatches(o),o}var f=e(16),p=e(20),d=e(140),m=e(21),v=e(95),g=e(99),y=e(158),b=[9,13,27,32],x=229,w=d.canUseDOM&&"CompositionEvent"in window,_=null;d.canUseDOM&&"documentMode"in document&&(_=document.documentMode);var C=d.canUseDOM&&"TextEvent"in window&&!_&&!n(),E=d.canUseDOM&&(!w||_&&_>8&&11>=_),S=32,M=String.fromCharCode(S),T=f.topLevelTypes,A={beforeInput:{phasedRegistrationNames:{bubbled:y({onBeforeInput:null}),captured:y({onBeforeInputCapture:null})},dependencies:[T.topCompositionEnd,T.topKeyPress,T.topTextInput,T.topPaste]},compositionEnd:{phasedRegistrationNames:{bubbled:y({onCompositionEnd:null}),captured:y({onCompositionEndCapture:null})},dependencies:[T.topBlur,T.topCompositionEnd,T.topKeyDown,T.topKeyPress,T.topKeyUp,T.topMouseDown]},compositionStart:{phasedRegistrationNames:{bubbled:y({onCompositionStart:null}),captured:y({onCompositionStartCapture:null})},dependencies:[T.topBlur,T.topCompositionStart,T.topKeyDown,T.topKeyPress,T.topKeyUp,T.topMouseDown]},compositionUpdate:{phasedRegistrationNames:{bubbled:y({onCompositionUpdate:null}),captured:y({onCompositionUpdateCapture:null})},dependencies:[T.topBlur,T.topCompositionUpdate,T.topKeyDown,T.topKeyPress,T.topKeyUp,T.topMouseDown]}},P=!1,k=null,R={eventTypes:A,extractEvents:function(e,t,n,r){return[u(e,t,n,r),h(e,t,n,r)]}};t.exports=R},{140:140,158:158,16:16,20:20,21:21,95:95,99:99}],3:[function(e,t){function n(e,t){return e+t.charAt(0).toUpperCase()+t.substring(1)}var r={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,gridColumn:!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},i=["Webkit","ms","Moz","O"];Object.keys(r).forEach(function(e){i.forEach(function(t){r[n(t,e)]=r[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}},a={isUnitlessNumber:r,shorthandPropertyExpansions:o};t.exports=a},{}],4:[function(e,t){var n=e(3),r=e(140),i=(e(66),e(142),e(113)),o=e(153),a=e(159),s=(e(161),a(function(e){return o(e)})),u=!1,c="cssFloat";if(r.canUseDOM){var l=document.createElement("div").style;try{l.font=""}catch(e){u=!0}void 0===document.documentElement.style.cssFloat&&(c="styleFloat")}var h={createMarkupForStyles:function(e,t){var n="";for(var r in e)if(e.hasOwnProperty(r)){var o=e[r];null!=o&&(n+=s(r)+":",n+=i(r,o,t)+";")}return n||null},setValueForStyles:function(e,t,r){var o=e.style;for(var a in t)if(t.hasOwnProperty(a)){var s=i(a,t[a],r);if("float"!==a&&"cssFloat"!==a||(a=c),s)o[a]=s;else{var l=u&&n.shorthandPropertyExpansions[a];if(l)for(var h in l)o[h]="";else o[a]=""}}}};t.exports=h},{113:113,140:140,142:142,153:153,159:159,161:161,3:3,66:66}],5:[function(e,t){function n(){this._callbacks=null,this._contexts=null}var r=e(132),i=e(162),o=e(25);e(154),i(n.prototype,{enqueue:function(e,t){this._callbacks=this._callbacks||[],this._contexts=this._contexts||[],this._callbacks.push(e),this._contexts.push(t)},notifyAll:function(){var e=this._callbacks,t=this._contexts;if(e){e.length!==t.length?r("24"):void 0,this._callbacks=null,this._contexts=null;for(var n=0;n<e.length;n++)e[n].call(t[n]);e.length=0,t.length=0}},checkpoint:function(){return this._callbacks?this._callbacks.length:0},rollback:function(e){this._callbacks&&(this._callbacks.length=e,this._contexts.length=e)},reset:function(){this._callbacks=null,this._contexts=null},destructor:function(){this.reset()}}),o.addPoolingTo(n),t.exports=n},{132:132,154:154,162:162,25:25}],6:[function(e,t){function n(e){var t=e.nodeName&&e.nodeName.toLowerCase();return"select"===t||"input"===t&&"file"===e.type}function r(e){var t=C.getPooled(P.change,R,e,E(e));b.accumulateTwoPhaseDispatches(t),_.batchedUpdates(i,t)}function i(e){y.enqueueEvents(e),y.processEventQueue(!1)}function o(e,t){k=e,R=t,k.attachEvent("onchange",r)}function a(){k&&(k.detachEvent("onchange",r),k=null,R=null)}function s(e,t){return e===A.topChange?t:void 0}function u(e,t,n){e===A.topFocus?(a(),o(t,n)):e===A.topBlur&&a()}function c(e,t){k=e,R=t,I=e.value,D=Object.getOwnPropertyDescriptor(e.constructor.prototype,"value"),Object.defineProperty(k,"value",L),k.attachEvent?k.attachEvent("onpropertychange",h):k.addEventListener("propertychange",h,!1)}function l(){k&&(delete k.value,k.detachEvent?k.detachEvent("onpropertychange",h):k.removeEventListener("propertychange",h,!1),k=null,R=null,I=null,D=null)}function h(e){if("value"===e.propertyName){var t=e.srcElement.value;t!==I&&(I=t,r(e))}}function f(e,t){return e===A.topInput?t:void 0}function p(e,t,n){e===A.topFocus?(l(),c(t,n)):e===A.topBlur&&l()}function d(e){return e!==A.topSelectionChange&&e!==A.topKeyUp&&e!==A.topKeyDown||!k||k.value===I?void 0:(I=k.value,R)}function m(e){return e.nodeName&&"input"===e.nodeName.toLowerCase()&&("checkbox"===e.type||"radio"===e.type)}function v(e,t){return e===A.topClick?t:void 0}var g=e(16),y=e(17),b=e(20),x=e(140),w=e(40),_=e(88),C=e(97),E=e(121),S=e(128),M=e(129),T=e(158),A=g.topLevelTypes,P={change:{phasedRegistrationNames:{bubbled:T({onChange:null}),captured:T({onChangeCapture:null})},dependencies:[A.topBlur,A.topChange,A.topClick,A.topFocus,A.topInput,A.topKeyDown,A.topKeyUp,A.topSelectionChange]}},k=null,R=null,I=null,D=null,B=!1;x.canUseDOM&&(B=S("change")&&(!("documentMode"in document)||document.documentMode>8));var V=!1;x.canUseDOM&&(V=S("input")&&(!("documentMode"in document)||document.documentMode>11));var L={get:function(){return D.get.call(this)},set:function(e){I=""+e,D.set.call(this,e)}},N={eventTypes:P,extractEvents:function(e,t,r,i){var o,a,c=t?w.getNodeFromInstance(t):window;if(n(c)?B?o=s:a=u:M(c)?V?o=f:(o=d,a=p):m(c)&&(o=v),o){var l=o(e,t);if(l){var h=C.getPooled(P.change,l,r,i);return h.type="change",b.accumulateTwoPhaseDispatches(h),h}}a&&a(e,c,t)}};t.exports=N},{121:121,128:128,129:129,140:140,158:158,16:16,17:17,20:20,40:40,88:88,97:97}],7:[function(e,t){function n(e,t){return Array.isArray(t)&&(t=t[1]),t?t.nextSibling:e.firstChild}function r(e,t,n){c.insertTreeBefore(e,t,n)}function i(e,t,n){Array.isArray(t)?a(e,t[0],t[1],n):m(e,t,n)}function o(e,t){if(Array.isArray(t)){var n=t[1];t=t[0],s(e,t,n),e.removeChild(n)}e.removeChild(t)}function a(e,t,n,r){for(var i=t;;){var o=i.nextSibling;if(m(e,i,r),i===n)break;i=o}}function s(e,t,n){for(;;){var r=t.nextSibling;if(r===n)break;e.removeChild(r)}}function u(e,t,n){var r=e.parentNode,i=e.nextSibling;i===t?n&&m(r,document.createTextNode(n),i):n?(d(i,n),s(r,i,t)):s(r,e,t)}var c=e(8),l=e(12),h=e(70),f=(e(40),e(66),e(112)),p=e(134),d=e(135),m=f(function(e,t,n){e.insertBefore(t,n)}),v=l.dangerouslyReplaceNodeWithMarkup,g={dangerouslyReplaceNodeWithMarkup:v,replaceDelimitedText:u,processUpdates:function(e,t){for(var a=0;a<t.length;a++){var s=t[a];switch(s.type){case h.INSERT_MARKUP:r(e,s.content,n(e,s.afterNode));break;case h.MOVE_EXISTING:i(e,s.fromNode,n(e,s.afterNode));break;case h.SET_MARKUP:p(e,s.content);break;case h.TEXT_CONTENT:d(e,s.content);break;case h.REMOVE_NODE:o(e,s.fromNode)}}}};t.exports=g},{112:112,12:12,134:134,135:135,40:40,66:66,70:70,8:8}],8:[function(e,t){function n(e){if(m){var t=e.node,n=e.children;if(n.length)for(var r=0;r<n.length;r++)v(t,n[r],null);else null!=e.html?l(t,e.html):null!=e.text&&f(t,e.text)}}function r(e,t){e.parentNode.replaceChild(t.node,e),n(t)}function i(e,t){m?e.children.push(t):e.node.appendChild(t.node)}function o(e,t){m?e.html=t:l(e.node,t)}function a(e,t){m?e.text=t:f(e.node,t)}function s(){return this.node.nodeName}function u(e){return{node:e,children:[],html:null,text:null,toString:s}}var c=e(9),l=e(134),h=e(112),f=e(135),p=1,d=11,m="undefined"!=typeof document&&"number"==typeof document.documentMode||"undefined"!=typeof navigator&&"string"==typeof navigator.userAgent&&/\bEdge\/\d/.test(navigator.userAgent),v=h(function(e,t,r){t.node.nodeType===d||t.node.nodeType===p&&"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))});u.insertTreeBefore=v,u.replaceChildWithTree=r,u.queueChild=i,u.queueHTML=o,u.queueText=a,t.exports=u},{112:112,134:134,135:135,9:9}],9:[function(e,t){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},{}],10:[function(e,t){function n(e,t){return(e&t)===t}var r=e(132),i=(e(154),{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=i,o=e.Properties||{},s=e.DOMAttributeNamespaces||{},u=e.DOMAttributeNames||{},c=e.DOMPropertyNames||{},l=e.DOMMutationMethods||{};e.isCustomAttribute&&a._isCustomAttributeFunctions.push(e.isCustomAttribute);for(var h in o){a.properties.hasOwnProperty(h)?r("48",h):void 0;var f=h.toLowerCase(),p=o[h],d={attributeName:f,attributeNamespace:null,propertyName:h,mutationMethod:null,mustUseProperty:n(p,t.MUST_USE_PROPERTY),hasBooleanValue:n(p,t.HAS_BOOLEAN_VALUE),hasNumericValue:n(p,t.HAS_NUMERIC_VALUE),hasPositiveNumericValue:n(p,t.HAS_POSITIVE_NUMERIC_VALUE),hasOverloadedBooleanValue:n(p,t.HAS_OVERLOADED_BOOLEAN_VALUE)};if(d.hasBooleanValue+d.hasNumericValue+d.hasOverloadedBooleanValue<=1?void 0:r("50",h),u.hasOwnProperty(h)){var m=u[h];d.attributeName=m}s.hasOwnProperty(h)&&(d.attributeNamespace=s[h]),c.hasOwnProperty(h)&&(d.propertyName=c[h]),l.hasOwnProperty(h)&&(d.mutationMethod=l[h]),a.properties[h]=d}}}),o=":A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD",a={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<a._isCustomAttributeFunctions.length;t++){var n=a._isCustomAttributeFunctions[t];if(n(e))return!0}return!1},injection:i};t.exports=a},{132:132,154:154}],11:[function(e,t){function n(e){return!!u.hasOwnProperty(e)||!s.hasOwnProperty(e)&&(a.test(e)?(u[e]=!0,!0):(s[e]=!0,!1))}function r(e,t){return null==t||e.hasBooleanValue&&!t||e.hasNumericValue&&isNaN(t)||e.hasPositiveNumericValue&&1>t||e.hasOverloadedBooleanValue&&t===!1}var i=e(10),o=(e(40),e(66),e(131)),a=(e(161),new RegExp("^["+i.ATTRIBUTE_NAME_START_CHAR+"]["+i.ATTRIBUTE_NAME_CHAR+"]*$")),s={},u={},c={createMarkupForID:function(e){return i.ID_ATTRIBUTE_NAME+"="+o(e)},setAttributeForID:function(e,t){e.setAttribute(i.ID_ATTRIBUTE_NAME,t)},createMarkupForRoot:function(){return i.ROOT_ATTRIBUTE_NAME+'=""'},setAttributeForRoot:function(e){e.setAttribute(i.ROOT_ATTRIBUTE_NAME,"")},createMarkupForProperty:function(e,t){var n=i.properties.hasOwnProperty(e)?i.properties[e]:null;if(n){if(r(n,t))return"";var a=n.attributeName;return n.hasBooleanValue||n.hasOverloadedBooleanValue&&t===!0?a+'=""':a+"="+o(t)}return i.isCustomAttribute(e)?null==t?"":e+"="+o(t):null},createMarkupForCustomAttribute:function(e,t){return n(e)&&null!=t?e+"="+o(t):""},setValueForProperty:function(e,t,n){var o=i.properties.hasOwnProperty(t)?i.properties[t]:null;if(o){var a=o.mutationMethod;if(a)a(e,n);else{if(r(o,n))return void this.deleteValueForProperty(e,t);if(o.mustUseProperty)e[o.propertyName]=n;else{var s=o.attributeName,u=o.attributeNamespace;u?e.setAttributeNS(u,s,""+n):o.hasBooleanValue||o.hasOverloadedBooleanValue&&n===!0?e.setAttribute(s,""):e.setAttribute(s,""+n)}}}else if(i.isCustomAttribute(t))return void c.setValueForAttribute(e,t,n)},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 n=i.properties.hasOwnProperty(t)?i.properties[t]:null;if(n){var r=n.mutationMethod;if(r)r(e,void 0);else if(n.mustUseProperty){var o=n.propertyName;e[o]=n.hasBooleanValue?!1:""}else e.removeAttribute(n.attributeName)}else i.isCustomAttribute(t)&&e.removeAttribute(t)}};t.exports=c},{10:10,131:131,161:161,40:40,66:66}],12:[function(e,t){var n=e(132),r=e(8),i=e(140),o=e(145),a=e(146),s=(e(154),{dangerouslyReplaceNodeWithMarkup:function(e,t){if(i.canUseDOM?void 0:n("56"),t?void 0:n("57"),"HTML"===e.nodeName?n("58"):void 0,"string"==typeof t){var s=o(t,a)[0];e.parentNode.replaceChild(s,e)}else r.replaceChildWithTree(e,t)}});t.exports=s},{132:132,140:140,145:145,146:146,154:154,8:8}],13:[function(e,t){var n=e(158),r=[n({ResponderEventPlugin:null}),n({SimpleEventPlugin:null}),n({TapEventPlugin:null}),n({EnterLeaveEventPlugin:null}),n({ChangeEventPlugin:null}),n({SelectEventPlugin:null}),n({BeforeInputEventPlugin:null})];t.exports=r},{158:158}],14:[function(e,t){var n={onClick:!0,onDoubleClick:!0,onMouseDown:!0,onMouseMove:!0,onMouseUp:!0,onClickCapture:!0,onDoubleClickCapture:!0,onMouseDownCapture:!0,onMouseMoveCapture:!0,onMouseUpCapture:!0},r={getHostProps:function(e,t){if(!t.disabled)return t;var r={};for(var i in t)!n[i]&&t.hasOwnProperty(i)&&(r[i]=t[i]);return r}};t.exports=r},{}],15:[function(e,t){var n=e(16),r=e(20),i=e(40),o=e(101),a=e(158),s=n.topLevelTypes,u={mouseEnter:{registrationName:a({onMouseEnter:null}),dependencies:[s.topMouseOut,s.topMouseOver]},mouseLeave:{registrationName:a({onMouseLeave:null}),dependencies:[s.topMouseOut,s.topMouseOver]}},c={eventTypes:u,extractEvents:function(e,t,n,a){if(e===s.topMouseOver&&(n.relatedTarget||n.fromElement))return null;if(e!==s.topMouseOut&&e!==s.topMouseOver)return null;var c;if(a.window===a)c=a;else{var l=a.ownerDocument;c=l?l.defaultView||l.parentWindow:window}var h,f;if(e===s.topMouseOut){h=t;var p=n.relatedTarget||n.toElement;f=p?i.getClosestInstanceFromNode(p):null}else h=null,f=t;if(h===f)return null;var d=null==h?c:i.getNodeFromInstance(h),m=null==f?c:i.getNodeFromInstance(f),v=o.getPooled(u.mouseLeave,h,n,a);v.type="mouseleave",v.target=d,v.relatedTarget=m;var g=o.getPooled(u.mouseEnter,f,n,a);return g.type="mouseenter",g.target=m,g.relatedTarget=d,r.accumulateEnterLeaveDispatches(v,g,h,f),[v,g]}};t.exports=c},{101:101,158:158,16:16,20:20,40:40}],16:[function(e,t){var n=e(157),r=n({bubbled:null,captured:null}),i=n({topAbort:null,topAnimationEnd:null,topAnimationIteration:null,topAnimationStart:null,topBlur:null,topCanPlay:null,topCanPlayThrough:null,topChange:null,topClick:null,topCompositionEnd:null,topCompositionStart:null,topCompositionUpdate:null,topContextMenu:null,topCopy:null,topCut:null,topDoubleClick:null,topDrag:null,topDragEnd:null,topDragEnter:null,topDragExit:null,topDragLeave:null,topDragOver:null,topDragStart:null,topDrop:null,topDurationChange:null,topEmptied:null,topEncrypted:null,topEnded:null,topError:null,topFocus:null,topInput:null,topInvalid:null,topKeyDown:null,topKeyPress:null,topKeyUp:null,topLoad:null,topLoadedData:null,topLoadedMetadata:null,topLoadStart:null,topMouseDown:null,topMouseMove:null,topMouseOut:null,topMouseOver:null,topMouseUp:null,topPaste:null,topPause:null,topPlay:null,topPlaying:null,topProgress:null,topRateChange:null,topReset:null,topScroll:null,topSeeked:null,topSeeking:null,topSelectionChange:null,topStalled:null,topSubmit:null,topSuspend:null,topTextInput:null,topTimeUpdate:null,topTouchCancel:null,topTouchEnd:null,topTouchMove:null,topTouchStart:null,topTransitionEnd:null,topVolumeChange:null,topWaiting:null,topWheel:null}),o={topLevelTypes:i,PropagationPhases:r};t.exports=o},{157:157}],17:[function(e,t){var n=e(132),r=e(18),i=e(19),o=e(58),a=e(108),s=e(117),u=(e(154),{}),c=null,l=function(e,t){e&&(i.executeDispatchesInOrder(e,t),e.isPersistent()||e.constructor.release(e))},h=function(e){return l(e,!0)},f=function(e){return l(e,!1)},p=function(e){return"."+e._rootNodeID},d={injection:{injectEventPluginOrder:r.injectEventPluginOrder,injectEventPluginsByName:r.injectEventPluginsByName},putListener:function(e,t,i){"function"!=typeof i?n("94",t,typeof i):void 0;var o=p(e),a=u[t]||(u[t]={});a[o]=i;var s=r.registrationNameModules[t];s&&s.didPutListener&&s.didPutListener(e,t,i)},getListener:function(e,t){var n=u[t],r=p(e);return n&&n[r]},deleteListener:function(e,t){var n=r.registrationNameModules[t];n&&n.willDeleteListener&&n.willDeleteListener(e,t);var i=u[t];if(i){var o=p(e);delete i[o]}},deleteAllListeners:function(e){var t=p(e);for(var n in u)if(u.hasOwnProperty(n)&&u[n][t]){var i=r.registrationNameModules[n];i&&i.willDeleteListener&&i.willDeleteListener(e,n),delete u[n][t]}},extractEvents:function(e,t,n,i){for(var o,s=r.plugins,u=0;u<s.length;u++){var c=s[u];if(c){var l=c.extractEvents(e,t,n,i);l&&(o=a(o,l))}}return o},enqueueEvents:function(e){e&&(c=a(c,e))},processEventQueue:function(e){var t=c;c=null,e?s(t,h):s(t,f),c?n("95"):void 0,o.rethrowCaughtError()},__purge:function(){u={}},__getListenerBank:function(){return u}};t.exports=d},{108:108,117:117,132:132,154:154,18:18,19:19,58:58}],18:[function(e,t){function n(){if(a)for(var e in s){var t=s[e],n=a.indexOf(e);if(n>-1?void 0:o("96",e),!u.plugins[n]){t.extractEvents?void 0:o("97",e),u.plugins[n]=t;var i=t.eventTypes;for(var c in i)r(i[c],t,c)?void 0:o("98",c,e)}}}function r(e,t,n){u.eventNameDispatchConfigs.hasOwnProperty(n)?o("99",n):void 0,u.eventNameDispatchConfigs[n]=e;var r=e.phasedRegistrationNames;if(r){for(var a in r)if(r.hasOwnProperty(a)){var s=r[a];i(s,t,n)}return!0}return!!e.registrationName&&(i(e.registrationName,t,n),!0)}function i(e,t,n){u.registrationNameModules[e]?o("100",e):void 0,u.registrationNameModules[e]=t,u.registrationNameDependencies[e]=t.eventTypes[n].dependencies}var o=e(132),a=(e(154),null),s={},u={plugins:[],eventNameDispatchConfigs:{},registrationNameModules:{},registrationNameDependencies:{},possibleRegistrationNames:null,injectEventPluginOrder:function(e){a?o("101"):void 0,a=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];s.hasOwnProperty(r)&&s[r]===i||(s[r]?o("102",r):void 0,s[r]=i,t=!0)}t&&n()},getPluginModuleForEvent:function(e){var t=e.dispatchConfig;if(t.registrationName)return u.registrationNameModules[t.registrationName]||null;for(var n in t.phasedRegistrationNames)if(t.phasedRegistrationNames.hasOwnProperty(n)){var r=u.registrationNameModules[t.phasedRegistrationNames[n]];if(r)return r}return null},_resetEventPlugins:function(){a=null;for(var e in s)s.hasOwnProperty(e)&&delete s[e];u.plugins.length=0;var t=u.eventNameDispatchConfigs;for(var n in t)t.hasOwnProperty(n)&&delete t[n];var r=u.registrationNameModules;for(var i in r)r.hasOwnProperty(i)&&delete r[i]}};t.exports=u},{132:132,154:154}],19:[function(e,t){function n(e){return e===g.topMouseUp||e===g.topTouchEnd||e===g.topTouchCancel}function r(e){return e===g.topMouseMove||e===g.topTouchMove}function i(e){return e===g.topMouseDown||e===g.topTouchStart}function o(e,t,n,r){var i=e.type||"unknown-event";e.currentTarget=y.getNodeFromInstance(r),t?m.invokeGuardedCallbackWithCatch(i,n,e):m.invokeGuardedCallback(i,n,e),e.currentTarget=null}function a(e,t){var n=e._dispatchListeners,r=e._dispatchInstances;if(Array.isArray(n))for(var i=0;i<n.length&&!e.isPropagationStopped();i++)o(e,t,n[i],r[i]);else n&&o(e,t,n,r);e._dispatchListeners=null,e._dispatchInstances=null}function s(e){var t=e._dispatchListeners,n=e._dispatchInstances;if(Array.isArray(t)){for(var r=0;r<t.length&&!e.isPropagationStopped();r++)if(t[r](e,n[r]))return n[r]}else if(t&&t(e,n))return n;return null}function u(e){var t=s(e);return e._dispatchInstances=null,e._dispatchListeners=null,t}function c(e){var t=e._dispatchListeners,n=e._dispatchInstances;Array.isArray(t)?p("103"):void 0,e.currentTarget=t?y.getNodeFromInstance(n):null;var r=t?t(e):null;return e.currentTarget=null,e._dispatchListeners=null,e._dispatchInstances=null,r}function l(e){return!!e._dispatchListeners}var h,f,p=e(132),d=e(16),m=e(58),v=(e(154),e(161),{injectComponentTree:function(e){h=e},injectTreeTraversal:function(e){f=e}}),g=d.topLevelTypes,y={isEndish:n,isMoveish:r,isStartish:i,executeDirectDispatch:c,executeDispatchesInOrder:a,executeDispatchesInOrderStopAtTrue:u,hasDispatches:l,getInstanceFromNode:function(e){return h.getInstanceFromNode(e)},getNodeFromInstance:function(e){return h.getNodeFromInstance(e)},isAncestor:function(e,t){return f.isAncestor(e,t)},getLowestCommonAncestor:function(e,t){return f.getLowestCommonAncestor(e,t)},getParentInstance:function(e){return f.getParentInstance(e)},traverseTwoPhase:function(e,t,n){return f.traverseTwoPhase(e,t,n)},traverseEnterLeave:function(e,t,n,r,i){return f.traverseEnterLeave(e,t,n,r,i)},injection:v};t.exports=y},{132:132,154:154,16:16,161:161,58:58}],20:[function(e,t){function n(e,t,n){var r=t.dispatchConfig.phasedRegistrationNames[n];return y(e,r)}function r(e,t,r){var i=t?g.bubbled:g.captured,o=n(e,r,i);o&&(r._dispatchListeners=m(r._dispatchListeners,o),r._dispatchInstances=m(r._dispatchInstances,e))}function i(e){e&&e.dispatchConfig.phasedRegistrationNames&&d.traverseTwoPhase(e._targetInst,r,e)}function o(e){if(e&&e.dispatchConfig.phasedRegistrationNames){var t=e._targetInst,n=t?d.getParentInstance(t):null;d.traverseTwoPhase(n,r,e)}}function a(e,t,n){if(n&&n.dispatchConfig.registrationName){var r=n.dispatchConfig.registrationName,i=y(e,r);i&&(n._dispatchListeners=m(n._dispatchListeners,i),n._dispatchInstances=m(n._dispatchInstances,e))}}function s(e){e&&e.dispatchConfig.registrationName&&a(e._targetInst,null,e)}function u(e){v(e,i)}function c(e){v(e,o)}function l(e,t,n,r){d.traverseEnterLeave(n,r,a,e,t)}function h(e){v(e,s)}var f=e(16),p=e(17),d=e(19),m=e(108),v=e(117),g=(e(161),f.PropagationPhases),y=p.getListener,b={accumulateTwoPhaseDispatches:u,accumulateTwoPhaseDispatchesSkipTarget:c,accumulateDirectDispatches:h,accumulateEnterLeaveDispatches:l};t.exports=b},{108:108,117:117,16:16,161:161,17:17,19:19}],21:[function(e,t){function n(e){this._root=e,this._startText=this.getText(),this._fallbackText=null}var r=e(162),i=e(25),o=e(125);r(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,n=this._startText,r=n.length,i=this.getText(),o=i.length;for(e=0;r>e&&n[e]===i[e];e++);var a=r-e;
for(t=1;a>=t&&n[r-t]===i[o-t];t++);var s=t>1?1-t:void 0;return this._fallbackText=i.slice(e,s),this._fallbackText}}),i.addPoolingTo(n),t.exports=n},{125:125,162:162,25:25}],22:[function(e,t){var n=e(10),r=n.injection.MUST_USE_PROPERTY,i=n.injection.HAS_BOOLEAN_VALUE,o=n.injection.HAS_NUMERIC_VALUE,a=n.injection.HAS_POSITIVE_NUMERIC_VALUE,s=n.injection.HAS_OVERLOADED_BOOLEAN_VALUE,u={isCustomAttribute:RegExp.prototype.test.bind(new RegExp("^(data|aria)-["+n.ATTRIBUTE_NAME_CHAR+"]*$")),Properties:{accept:0,acceptCharset:0,accessKey:0,action:0,allowFullScreen:i,allowTransparency:0,alt:0,async:i,autoComplete:0,autoPlay:i,capture:i,cellPadding:0,cellSpacing:0,charSet:0,challenge:0,checked:r|i,cite:0,classID:0,className:0,cols:a,colSpan:0,content:0,contentEditable:0,contextMenu:0,controls:i,coords:0,crossOrigin:0,data:0,dateTime:0,"default":i,defer:i,dir:0,disabled:i,download:s,draggable:0,encType:0,form:0,formAction:0,formEncType:0,formMethod:0,formNoValidate:i,formTarget:0,frameBorder:0,headers:0,height:0,hidden:i,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:i,low:0,manifest:0,marginHeight:0,marginWidth:0,max:0,maxLength:0,media:0,mediaGroup:0,method:0,min:0,minLength:0,multiple:r|i,muted:r|i,name:0,nonce:0,noValidate:i,open:i,optimum:0,pattern:0,placeholder:0,poster:0,preload:0,profile:0,radioGroup:0,readOnly:i,referrerPolicy:0,rel:0,required:i,reversed:i,role:0,rows:a,rowSpan:o,sandbox:0,scope:0,scoped:i,scrolling:0,seamless:i,selected:r|i,shape:0,size:a,sizes:0,span:a,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:i,itemType:0,itemID:0,itemRef:0,results:0,security:0,unselectable:0},DOMAttributeNames:{acceptCharset:"accept-charset",className:"class",htmlFor:"for",httpEquiv:"http-equiv"},DOMPropertyNames:{}};t.exports=u},{10:10}],23:[function(e,t){function n(e){var t=/[=:]/g,n={"=":"=0",":":"=2"},r=(""+e).replace(t,function(e){return n[e]});return"$"+r}function r(e){var t=/(=0|=2)/g,n={"=0":"=","=2":":"},r="."===e[0]&&"$"===e[1]?e.substring(2):e.substring(1);return(""+r).replace(t,function(e){return n[e]})}var i={escape:n,unescape:r};t.exports=i},{}],24:[function(e,t){function n(e){null!=e.checkedLink&&null!=e.valueLink?a("87"):void 0}function r(e){n(e),null!=e.value||null!=e.onChange?a("88"):void 0}function i(e){n(e),null!=e.checked||null!=e.onChange?a("89"):void 0}function o(e){if(e){var t=e.getName();if(t)return" Check the render method of `"+t+"`."}return""}var a=e(132),s=e(76),u=e(75),c=e(77),l=(e(154),e(161),{button:!0,checkbox:!0,image:!0,hidden:!0,radio:!0,reset:!0,submit:!0}),h={value:function(e,t){return!e[t]||l[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){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:s.func},f={},p={checkPropTypes:function(e,t,n){for(var r in h){if(h.hasOwnProperty(r))var i=h[r](t,r,e,u.prop,null,c);i instanceof Error&&!(i.message in f)&&(f[i.message]=!0,o(n))}},getValue:function(e){return e.valueLink?(r(e),e.valueLink.value):e.value},getChecked:function(e){return e.checkedLink?(i(e),e.checkedLink.value):e.checked},executeOnChange:function(e,t){return e.valueLink?(r(e),e.valueLink.requestChange(t.target.value)):e.checkedLink?(i(e),e.checkedLink.requestChange(t.target.checked)):e.onChange?e.onChange.call(void 0,t):void 0}};t.exports=p},{132:132,154:154,161:161,75:75,76:76,77:77}],25:[function(e,t){var n=e(132),r=(e(154),function(e){var t=this;if(t.instancePool.length){var n=t.instancePool.pop();return t.call(n,e),n}return new t(e)}),i=function(e,t){var n=this;if(n.instancePool.length){var r=n.instancePool.pop();return n.call(r,e,t),r}return new n(e,t)},o=function(e,t,n){var r=this;if(r.instancePool.length){var i=r.instancePool.pop();return r.call(i,e,t,n),i}return new r(e,t,n)},a=function(e,t,n,r){var i=this;if(i.instancePool.length){var o=i.instancePool.pop();return i.call(o,e,t,n,r),o}return new i(e,t,n,r)},s=function(e,t,n,r,i){var o=this;if(o.instancePool.length){var a=o.instancePool.pop();return o.call(a,e,t,n,r,i),a}return new o(e,t,n,r,i)},u=function(e){var t=this;e instanceof t?void 0:n("25"),e.destructor(),t.instancePool.length<t.poolSize&&t.instancePool.push(e)},c=10,l=r,h=function(e,t){var n=e;return n.instancePool=[],n.getPooled=t||l,n.poolSize||(n.poolSize=c),n.release=u,n},f={addPoolingTo:h,oneArgumentPooler:r,twoArgumentPooler:i,threeArgumentPooler:o,fourArgumentPooler:a,fiveArgumentPooler:s};t.exports=f},{132:132,154:154}],26:[function(e,t){var n=e(162),r=e(29),i=e(31),o=e(78),a=e(30),s=e(43),u=e(56),c=e(76),l=e(89),h=e(130),f=(e(161),u.createElement),p=u.createFactory,d=u.cloneElement,m=n,v={Children:{map:r.map,forEach:r.forEach,count:r.count,toArray:r.toArray,only:h},Component:i,PureComponent:o,createElement:f,cloneElement:d,isValidElement:u.isValidElement,PropTypes:c,createClass:a.createClass,createFactory:p,createMixin:function(e){return e},DOM:s,version:l,__spread:m};t.exports=v},{130:130,161:161,162:162,29:29,30:30,31:31,43:43,56:56,76:76,78:78,89:89}],27:[function(e,t){function n(e){return Object.prototype.hasOwnProperty.call(e,m)||(e[m]=p++,h[e[m]]={}),h[e[m]]}var r,i=e(162),o=e(16),a=e(18),s=e(59),u=e(107),c=e(126),l=e(128),h={},f=!1,p=0,d={topAbort:"abort",topAnimationEnd:c("animationend")||"animationend",topAnimationIteration:c("animationiteration")||"animationiteration",topAnimationStart:c("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",topLoadedData:"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:c("transitionend")||"transitionend",topVolumeChange:"volumechange",topWaiting:"waiting",topWheel:"wheel"},m="_reactListenersID"+String(Math.random()).slice(2),v=i({},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),s=a.registrationNameDependencies[e],u=o.topLevelTypes,c=0;c<s.length;c++){var h=s[c];i.hasOwnProperty(h)&&i[h]||(h===u.topWheel?l("wheel")?v.ReactEventListener.trapBubbledEvent(u.topWheel,"wheel",r):l("mousewheel")?v.ReactEventListener.trapBubbledEvent(u.topWheel,"mousewheel",r):v.ReactEventListener.trapBubbledEvent(u.topWheel,"DOMMouseScroll",r):h===u.topScroll?l("scroll",!0)?v.ReactEventListener.trapCapturedEvent(u.topScroll,"scroll",r):v.ReactEventListener.trapBubbledEvent(u.topScroll,"scroll",v.ReactEventListener.WINDOW_HANDLE):h===u.topFocus||h===u.topBlur?(l("focus",!0)?(v.ReactEventListener.trapCapturedEvent(u.topFocus,"focus",r),v.ReactEventListener.trapCapturedEvent(u.topBlur,"blur",r)):l("focusin")&&(v.ReactEventListener.trapBubbledEvent(u.topFocus,"focusin",r),v.ReactEventListener.trapBubbledEvent(u.topBlur,"focusout",r)),i[u.topBlur]=!0,i[u.topFocus]=!0):d.hasOwnProperty(h)&&v.ReactEventListener.trapBubbledEvent(h,d[h],r),i[h]=!0)}},trapBubbledEvent:function(e,t,n){return v.ReactEventListener.trapBubbledEvent(e,t,n)},trapCapturedEvent:function(e,t,n){return v.ReactEventListener.trapCapturedEvent(e,t,n)},ensureScrollValueMonitoring:function(){if(void 0===r&&(r=document.createEvent&&"pageX"in document.createEvent("MouseEvent")),!r&&!f){var e=u.refreshScrollValues;v.ReactEventListener.monitorScrollValue(e),f=!0}}});t.exports=v},{107:107,126:126,128:128,16:16,162:162,18:18,59:59}],28:[function(e,t){(function(n){function r(e,t,n){var r=void 0===e[n];null!=t&&r&&(e[n]=o(t,!0))}var i=e(80),o=e(127),a=(e(23),e(136)),s=e(137);e(161),"undefined"!=typeof n&&n.env,1;var u={instantiateChildren:function(e){if(null==e)return null;var t={};return s(e,r,t),t},updateChildren:function(e,t,n,r,s,u,c,l,h){if(t||e){var f,p;for(f in t)if(t.hasOwnProperty(f)){p=e&&e[f];var d=p&&p._currentElement,m=t[f];if(null!=p&&a(d,m))i.receiveComponent(p,m,s,l),t[f]=p;else{p&&(r[f]=i.getHostNode(p),i.unmountComponent(p,!1));var v=o(m,!0);t[f]=v;var g=i.mountComponent(v,s,u,c,l,h);n.push(g)}}for(f in e)!e.hasOwnProperty(f)||t&&t.hasOwnProperty(f)||(p=e[f],r[f]=i.getHostNode(p),i.unmountComponent(p,!1))}},unmountChildren:function(e,t){for(var n in e)if(e.hasOwnProperty(n)){var r=e[n];i.unmountComponent(r,t)}}};t.exports=u}).call(this,void 0)},{127:127,136:136,137:137,161:161,23:23,80:80}],29:[function(e,t){function n(e){return(""+e).replace(b,"$&/")}function r(e,t){this.func=e,this.context=t,this.count=0}function i(e,t){var n=e.func,r=e.context;n.call(r,t,e.count++)}function o(e,t,n){if(null==e)return e;var o=r.getPooled(t,n);v(e,i,o),r.release(o)}function a(e,t,n,r){this.result=e,this.keyPrefix=t,this.func=n,this.context=r,this.count=0}function s(e,t,r){var i=e.result,o=e.keyPrefix,a=e.func,s=e.context,c=a.call(s,t,e.count++);Array.isArray(c)?u(c,i,r,m.thatReturnsArgument):null!=c&&(d.isValidElement(c)&&(c=d.cloneAndReplaceKey(c,o+(!c.key||t&&t.key===c.key?"":n(c.key)+"/")+r)),i.push(c))}function u(e,t,r,i,o){var u="";null!=r&&(u=n(r)+"/");var c=a.getPooled(t,u,i,o);v(e,s,c),a.release(c)}function c(e,t,n){if(null==e)return e;var r=[];return u(e,r,null,t,n),r}function l(){return null}function h(e){return v(e,l,null)}function f(e){var t=[];return u(e,t,null,m.thatReturnsArgument),t}var p=e(25),d=e(56),m=e(146),v=e(137),g=p.twoArgumentPooler,y=p.fourArgumentPooler,b=/\/+/g;r.prototype.destructor=function(){this.func=null,this.context=null,this.count=0},p.addPoolingTo(r,g),a.prototype.destructor=function(){this.result=null,this.keyPrefix=null,this.func=null,this.context=null,this.count=0},p.addPoolingTo(a,y);var x={forEach:o,map:c,mapIntoWithKeyPrefixInternal:u,count:h,toArray:f};t.exports=x},{137:137,146:146,25:25,56:56}],30:[function(e,t){function n(e,t){var n=w.hasOwnProperty(t)?w[t]:null;C.hasOwnProperty(t)&&(n!==b.OVERRIDE_BASE?l("73",t):void 0),e&&(n!==b.DEFINE_MANY&&n!==b.DEFINE_MANY_MERGED?l("74",t):void 0)}function r(e,t){if(t){"function"==typeof t?l("75"):void 0,p.isValidElement(t)?l("76"):void 0;var r=e.prototype,i=r.__reactAutoBindPairs;t.hasOwnProperty(y)&&_.mixins(e,t.mixins);for(var o in t)if(t.hasOwnProperty(o)&&o!==y){var u=t[o],c=r.hasOwnProperty(o);if(n(c,o),_.hasOwnProperty(o))_[o](e,u);else{var h=w.hasOwnProperty(o),f="function"==typeof u,d=f&&!h&&!c&&t.autobind!==!1;if(d)i.push(o,u),r[o]=u;else if(c){var m=w[o];!h||m!==b.DEFINE_MANY_MERGED&&m!==b.DEFINE_MANY?l("77",m,o):void 0,m===b.DEFINE_MANY_MERGED?r[o]=a(r[o],u):m===b.DEFINE_MANY&&(r[o]=s(r[o],u))}else r[o]=u}}}}function i(e,t){if(t)for(var n in t){var r=t[n];if(t.hasOwnProperty(n)){var i=n in _;i?l("78",n):void 0;var o=n in e;o?l("79",n):void 0,e[n]=r}}}function o(e,t){e&&t&&"object"==typeof e&&"object"==typeof t?void 0:l("80");for(var n in t)t.hasOwnProperty(n)&&(void 0!==e[n]?l("81",n):void 0,e[n]=t[n]);return e}function a(e,t){return function(){var n=e.apply(this,arguments),r=t.apply(this,arguments);if(null==n)return r;if(null==r)return n;var i={};return o(i,n),o(i,r),i}}function s(e,t){return function(){e.apply(this,arguments),t.apply(this,arguments)}}function u(e,t){var n=t.bind(e);return n}function c(e){for(var t=e.__reactAutoBindPairs,n=0;n<t.length;n+=2){var r=t[n],i=t[n+1];e[r]=u(e,i)}}var l=e(132),h=e(162),f=e(31),p=e(56),d=(e(75),e(74),e(72)),m=e(147),v=(e(154),e(157)),g=e(158),y=(e(161),g({mixins:null})),b=v({DEFINE_ONCE:null,DEFINE_MANY:null,OVERRIDE_BASE:null,DEFINE_MANY_MERGED:null}),x=[],w={mixins:b.DEFINE_MANY,statics:b.DEFINE_MANY,propTypes:b.DEFINE_MANY,contextTypes:b.DEFINE_MANY,childContextTypes:b.DEFINE_MANY,getDefaultProps:b.DEFINE_MANY_MERGED,getInitialState:b.DEFINE_MANY_MERGED,getChildContext:b.DEFINE_MANY_MERGED,render:b.DEFINE_ONCE,componentWillMount:b.DEFINE_MANY,componentDidMount:b.DEFINE_MANY,componentWillReceiveProps:b.DEFINE_MANY,shouldComponentUpdate:b.DEFINE_ONCE,componentWillUpdate:b.DEFINE_MANY,componentDidUpdate:b.DEFINE_MANY,componentWillUnmount:b.DEFINE_MANY,updateComponent:b.OVERRIDE_BASE},_={displayName:function(e,t){e.displayName=t},mixins:function(e,t){if(t)for(var n=0;n<t.length;n++)r(e,t[n])},childContextTypes:function(e,t){e.childContextTypes=h({},e.childContextTypes,t)},contextTypes:function(e,t){e.contextTypes=h({},e.contextTypes,t)},getDefaultProps:function(e,t){e.getDefaultProps=e.getDefaultProps?a(e.getDefaultProps,t):t},propTypes:function(e,t){e.propTypes=h({},e.propTypes,t)},statics:function(e,t){i(e,t)},autobind:function(){}},C={replaceState:function(e,t){this.updater.enqueueReplaceState(this,e),t&&this.updater.enqueueCallback(this,t,"replaceState")},isMounted:function(){return this.updater.isMounted(this)}},E=function(){};h(E.prototype,f.prototype,C);var S={createClass:function(e){var t=function(e,n,r){this.__reactAutoBindPairs.length&&c(this),this.props=e,this.context=n,this.refs=m,this.updater=r||d,this.state=null;var i=this.getInitialState?this.getInitialState():null;"object"!=typeof i||Array.isArray(i)?l("82",t.displayName||"ReactCompositeComponent"):void 0,this.state=i};t.prototype=new E,t.prototype.constructor=t,t.prototype.__reactAutoBindPairs=[],x.forEach(r.bind(null,t)),r(t,e),t.getDefaultProps&&(t.defaultProps=t.getDefaultProps()),t.prototype.render?void 0:l("83");for(var n in w)t.prototype[n]||(t.prototype[n]=null);return t},injection:{injectMixin:function(e){x.push(e)}}};t.exports=S},{132:132,147:147,154:154,157:157,158:158,161:161,162:162,31:31,56:56,72:72,74:74,75:75}],31:[function(e,t){function n(e,t,n){this.props=e,this.context=t,this.refs=o,this.updater=n||i}var r=e(132),i=e(72),o=(e(110),e(147));e(154),e(161),n.prototype.isReactComponent={},n.prototype.setState=function(e,t){"object"!=typeof e&&"function"!=typeof e&&null!=e?r("85"):void 0,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")},t.exports=n},{110:110,132:132,147:147,154:154,161:161,72:72}],32:[function(e,t){var n=e(7),r=e(45),i={processChildrenUpdates:r.dangerouslyProcessChildrenUpdates,replaceNodeWithMarkup:n.dangerouslyReplaceNodeWithMarkup};t.exports=i},{45:45,7:7}],33:[function(e,t){var n=e(132),r=(e(154),!1),i={replaceNodeWithMarkup:null,processChildrenUpdates:null,injection:{injectEnvironment:function(e){r?n("104"):void 0,i.replaceNodeWithMarkup=e.replaceNodeWithMarkup,i.processChildrenUpdates=e.processChildrenUpdates,r=!0}}};t.exports=i},{132:132,154:154}],34:[function(e,t){function n(){}function r(){}function i(e){return!(!e.prototype||!e.prototype.isReactComponent)}function o(e){return!(!e.prototype||!e.prototype.isPureReactComponent)}var a=e(132),s=e(162),u=e(33),c=e(35),l=e(56),h=e(58),f=e(65),p=(e(66),e(71)),d=(e(75),e(80)),m=e(111),v=e(147),g=(e(154),e(160)),y=e(136),b=(e(161),{ImpureClass:0,PureClass:1,StatelessFunctional:2});n.prototype.render=function(){var e=f.get(this)._currentElement.type,t=e(this.props,this.context,this.updater);return r(e,t),t};var x=1,w={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,s,u){this._context=u,this._mountOrder=x++,this._hostParent=t,this._hostContainerInfo=s;var c,h=this._currentElement.props,p=this._processContext(u),d=this._currentElement.type,m=e.getUpdateQueue(),g=i(d),y=this._constructComponent(g,h,p,m);g||null!=y&&null!=y.render?this._compositeType=o(d)?b.PureClass:b.ImpureClass:(c=y,r(d,c),null===y||y===!1||l.isValidElement(y)?void 0:a("105",d.displayName||d.name||"Component"),y=new n(d),this._compositeType=b.StatelessFunctional),y.props=h,y.context=p,y.refs=v,y.updater=m,this._instance=y,f.set(y,this);var w=y.state;void 0===w&&(y.state=w=null),"object"!=typeof w||Array.isArray(w)?a("106",this.getName()||"ReactCompositeComponent"):void 0,this._pendingStateQueue=null,this._pendingReplaceState=!1,this._pendingForceUpdate=!1;var _;return _=y.unstable_handleError?this.performInitialMountWithErrorHandling(c,t,s,e,u):this.performInitialMount(c,t,s,e,u),y.componentDidMount&&e.getReactMountReady().enqueue(y.componentDidMount,y),_},_constructComponent:function(e,t,n,r){return this._constructComponentWithoutOwner(e,t,n,r)},_constructComponentWithoutOwner:function(e,t,n,r){var i,o=this._currentElement.type;return i=e?new o(t,n,r):o(t,n,r)},performInitialMountWithErrorHandling:function(e,t,n,r,i){var o,a=r.checkpoint();try{o=this.performInitialMount(e,t,n,r,i)}catch(s){r.rollback(a),this._instance.unstable_handleError(s),this._pendingStateQueue&&(this._instance.state=this._processPendingState(this._instance.props,this._instance.context)),a=r.checkpoint(),this._renderedComponent.unmountComponent(!0),r.rollback(a),o=this.performInitialMount(e,t,n,r,i)}return o},performInitialMount:function(e,t,n,r,i){var o=this._instance;o.componentWillMount&&(o.componentWillMount(),this._pendingStateQueue&&(o.state=this._processPendingState(o.props,o.context))),void 0===e&&(e=this._renderValidatedComponent());var a=p.getType(e);this._renderedNodeType=a;var s=this._instantiateReactComponent(e,a!==p.EMPTY);this._renderedComponent=s;var u=0,c=d.mountComponent(s,r,t,n,this._processChildContext(i),u);return c},getHostNode:function(){return d.getHostNode(this._renderedComponent)},unmountComponent:function(e){if(this._renderedComponent){var t=this._instance;if(t.componentWillUnmount&&!t._calledComponentWillUnmount)if(t._calledComponentWillUnmount=!0,e){var n=this.getName()+".componentWillUnmount()";h.invokeGuardedCallback(n,t.componentWillUnmount.bind(t))}else t.componentWillUnmount();this._renderedComponent&&(d.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,f.remove(t)}},_maskContext:function(e){var t=this._currentElement.type,n=t.contextTypes;if(!n)return v;var r={};for(var i in n)r[i]=e[i];return r},_processContext:function(e){var t=this._maskContext(e);return t},_processChildContext:function(e){var t=this._currentElement.type,n=this._instance,r=n.getChildContext&&n.getChildContext();if(r){"object"!=typeof t.childContextTypes?a("107",this.getName()||"ReactCompositeComponent"):void 0;for(var i in r)i in t.childContextTypes?void 0:a("108",this.getName()||"ReactCompositeComponent",i);return s({},e,r)}return e},_checkContextTypes:function(e,t,n){m(e,t,n,this.getName(),null,this._debugID)},receiveComponent:function(e,t,n){var r=this._currentElement,i=this._context;this._pendingElement=null,this.updateComponent(t,r,e,i,n)},performUpdateIfNecessary:function(e){null!=this._pendingElement?d.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,n,r,i){var o=this._instance;null==o?a("136",this.getName()||"ReactCompositeComponent"):void 0;var s,u=!1;this._context===i?s=o.context:(s=this._processContext(i),u=!0);var c=t.props,l=n.props;t!==n&&(u=!0),u&&o.componentWillReceiveProps&&o.componentWillReceiveProps(l,s);var h=this._processPendingState(l,s),f=!0;this._pendingForceUpdate||(o.shouldComponentUpdate?f=o.shouldComponentUpdate(l,h,s):this._compositeType===b.PureClass&&(f=!g(c,l)||!g(o.state,h))),this._updateBatchNumber=null,f?(this._pendingForceUpdate=!1,this._performComponentUpdate(n,l,h,s,e,i)):(this._currentElement=n,this._context=i,o.props=l,o.state=h,o.context=s)},_processPendingState:function(e,t){var n=this._instance,r=this._pendingStateQueue,i=this._pendingReplaceState;if(this._pendingReplaceState=!1,this._pendingStateQueue=null,!r)return n.state;if(i&&1===r.length)return r[0];for(var o=s({},i?r[0]:n.state),a=i?1:0;a<r.length;a++){var u=r[a];s(o,"function"==typeof u?u.call(n,o,e,t):u)}return o},_performComponentUpdate:function(e,t,n,r,i,o){var a,s,u,c=this._instance,l=Boolean(c.componentDidUpdate);l&&(a=c.props,s=c.state,u=c.context),c.componentWillUpdate&&c.componentWillUpdate(t,n,r),this._currentElement=e,this._context=o,c.props=t,c.state=n,c.context=r,this._updateRenderedComponent(i,o),l&&i.getReactMountReady().enqueue(c.componentDidUpdate.bind(c,a,s,u),c)},_updateRenderedComponent:function(e,t){var n=this._renderedComponent,r=n._currentElement,i=this._renderValidatedComponent();if(y(r,i))d.receiveComponent(n,i,e,this._processChildContext(t));else{var o=d.getHostNode(n);d.unmountComponent(n,!1);var a=p.getType(i);this._renderedNodeType=a;var s=this._instantiateReactComponent(i,a!==p.EMPTY);this._renderedComponent=s;var u=0,c=d.mountComponent(s,e,this._hostParent,this._hostContainerInfo,this._processChildContext(t),u);this._replaceNodeWithMarkup(o,c,n)}},_replaceNodeWithMarkup:function(e,t,n){u.replaceNodeWithMarkup(e,t,n)},_renderValidatedComponentWithoutOwnerOrContext:function(){var e=this._instance,t=e.render();return t},_renderValidatedComponent:function(){var e;if(this._compositeType!==b.StatelessFunctional){c.current=this;try{e=this._renderValidatedComponentWithoutOwnerOrContext()}finally{c.current=null}}else e=this._renderValidatedComponentWithoutOwnerOrContext();return null===e||e===!1||l.isValidElement(e)?void 0:a("109",this.getName()||"ReactCompositeComponent"),e},attachRef:function(e,t){var n=this.getPublicInstance();null==n?a("110"):void 0;var r=t.getPublicInstance(),i=n.refs===v?n.refs={}:n.refs;i[e]=r},detachRef:function(e){var t=this.getPublicInstance().refs;delete t[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===b.StatelessFunctional?null:e},_instantiateReactComponent:null},_={Mixin:w};t.exports=_},{111:111,132:132,136:136,147:147,154:154,160:160,161:161,162:162,33:33,35:35,56:56,58:58,65:65,66:66,71:71,75:75,80:80}],35:[function(e,t){var n={current:null};t.exports=n},{}],36:[function(e,t){var n=e(40),r=e(55),i=e(68),o=e(80),a=e(88),s=e(89),u=e(115),c=e(122),l=e(133);e(161),r.inject();var h={findDOMNode:u,render:i.render,unmountComponentAtNode:i.unmountComponentAtNode,version:s,unstable_batchedUpdates:a.batchedUpdates,unstable_renderSubtreeIntoContainer:l};"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:i,Reconciler:o}),t.exports=h},{115:115,122:122,133:133,161:161,40:40,55:55,68:68,80:80,88:88,89:89}],37:[function(e,t){var n=e(14),r={getHostProps:n.getHostProps};t.exports=r},{14:14}],38:[function(e,t){function n(e){if(e){var t=e._currentElement._owner||null;if(t){var n=t.getName();if(n)return" This DOM node was rendered by `"+n+"`."}}return""}function r(e,t){t&&(K[e._tag]&&(null!=t.children||null!=t.dangerouslySetInnerHTML?d("137",e._tag,e._currentElement._owner?" Check the render method of "+e._currentElement._owner.getName()+".":""):void 0),null!=t.dangerouslySetInnerHTML&&(null!=t.children?d("60"):void 0,"object"==typeof t.dangerouslySetInnerHTML&&j in t.dangerouslySetInnerHTML?void 0:d("61")),null!=t.style&&"object"!=typeof t.style?d("62",n(e)):void 0)}function i(e,t,n,r){if(!(r instanceof B)){var i=e._hostContainerInfo,a=i._node&&i._node.nodeType===W,s=a?i._node:i._ownerDocument;U(t,s),r.getReactMountReady().enqueue(o,{inst:e,registrationName:t,listener:n})}}function o(){var e=this;C.putListener(e.inst,e.registrationName,e.listener)}function a(){var e=this;P.postMountWrapper(e)}function s(){var e=this;I.postMountWrapper(e)}function u(){var e=this;k.postMountWrapper(e)}function c(){var e=this;e._rootNodeID?void 0:d("63");var t=F(e);switch(t?void 0:d("64"),e._tag){case"iframe":case"object":e._wrapperState.listeners=[S.trapBubbledEvent(_.topLevelTypes.topLoad,"load",t)];break;case"video":case"audio":e._wrapperState.listeners=[];for(var n in q)q.hasOwnProperty(n)&&e._wrapperState.listeners.push(S.trapBubbledEvent(_.topLevelTypes[n],q[n],t));break;case"source":e._wrapperState.listeners=[S.trapBubbledEvent(_.topLevelTypes.topError,"error",t)];break;case"img":e._wrapperState.listeners=[S.trapBubbledEvent(_.topLevelTypes.topError,"error",t),S.trapBubbledEvent(_.topLevelTypes.topLoad,"load",t)];break;case"form":e._wrapperState.listeners=[S.trapBubbledEvent(_.topLevelTypes.topReset,"reset",t),S.trapBubbledEvent(_.topLevelTypes.topSubmit,"submit",t)];break;case"input":case"select":case"textarea":e._wrapperState.listeners=[S.trapBubbledEvent(_.topLevelTypes.topInvalid,"invalid",t)]}}function l(){R.postUpdateWrapper(this)}function h(e){J.call(Z,e)||(Q.test(e)?void 0:d("65",e),Z[e]=!0)}function f(e,t){return e.indexOf("-")>=0||null!=t.is}function p(e){var t=e.type;h(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 d=e(132),m=e(162),v=e(1),g=e(4),y=e(8),b=e(9),x=e(10),w=e(11),_=e(16),C=e(17),E=e(18),S=e(27),M=e(37),T=e(39),A=e(40),P=e(46),k=e(47),R=e(48),I=e(52),D=(e(66),e(69)),B=e(84),V=(e(146),e(114)),L=(e(154),e(128),e(158)),N=(e(160),e(138),e(161),T),O=C.deleteListener,F=A.getNodeFromInstance,U=S.listenTo,z=E.registrationNameModules,$={string:!0,number:!0},H=L({style:null}),j=L({__html:null}),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=m({menuitem:!0},X),Q=/^[a-zA-Z][a-zA-Z:_\.\-\d]*$/,Z={},J={}.hasOwnProperty,et=1;p.displayName="ReactDOMComponent",p.Mixin={mountComponent:function(e,t,n,i){this._rootNodeID=et++,this._domID=n._idCounter++,this._hostParent=t,this._hostContainerInfo=n;var o=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(c,this);break;case"button":o=M.getHostProps(this,o,t);break;case"input":P.mountWrapper(this,o,t),o=P.getHostProps(this,o),e.getReactMountReady().enqueue(c,this);break;case"option":k.mountWrapper(this,o,t),o=k.getHostProps(this,o);break;case"select":R.mountWrapper(this,o,t),o=R.getHostProps(this,o),e.getReactMountReady().enqueue(c,this);break;case"textarea":I.mountWrapper(this,o,t),o=I.getHostProps(this,o),e.getReactMountReady().enqueue(c,this)}r(this,o);var l,h;null!=t?(l=t._namespaceURI,h=t._tag):n._tag&&(l=n._namespaceURI,h=n._tag),(null==l||l===b.svg&&"foreignobject"===h)&&(l=b.html),l===b.html&&("svg"===this._tag?l=b.svg:"math"===this._tag&&(l=b.mathml)),this._namespaceURI=l;var f;if(e.useCreateElement){var p,d=n._ownerDocument;if(l===b.html)if("script"===this._tag){var m=d.createElement("div"),g=this._currentElement.type;m.innerHTML="<"+g+"></"+g+">",p=m.removeChild(m.firstChild)}else p=o.is?d.createElement(this._currentElement.type,o.is):d.createElement(this._currentElement.type);else p=d.createElementNS(l,this._currentElement.type);A.precacheNode(this,p),this._flags|=N.hasCachedChildNodes,this._hostParent||w.setAttributeForRoot(p),this._updateDOMProperties(null,o,e);var x=y(p);this._createInitialChildren(e,o,i,x),f=x}else{var _=this._createOpenTagMarkupAndPutListeners(e,o),C=this._createContentMarkup(e,o,i);f=!C&&X[this._tag]?_+"/>":_+">"+C+"</"+this._currentElement.type+">"}switch(this._tag){case"input":e.getReactMountReady().enqueue(a,this),o.autoFocus&&e.getReactMountReady().enqueue(v.focusDOMComponent,this);break;case"textarea":e.getReactMountReady().enqueue(s,this),o.autoFocus&&e.getReactMountReady().enqueue(v.focusDOMComponent,this);break;case"select":o.autoFocus&&e.getReactMountReady().enqueue(v.focusDOMComponent,this);break;case"button":o.autoFocus&&e.getReactMountReady().enqueue(v.focusDOMComponent,this);break;case"option":e.getReactMountReady().enqueue(u,this)}return f},_createOpenTagMarkupAndPutListeners:function(e,t){var n="<"+this._currentElement.type;for(var r in t)if(t.hasOwnProperty(r)){var o=t[r];if(null!=o)if(z.hasOwnProperty(r))o&&i(this,r,o,e);else{r===H&&(o&&(o=this._previousStyleCopy=m({},t.style)),o=g.createMarkupForStyles(o,this));var a=null;null!=this._tag&&f(this._tag,t)?G.hasOwnProperty(r)||(a=w.createMarkupForCustomAttribute(r,o)):a=w.createMarkupForProperty(r,o),a&&(n+=" "+a)}}return e.renderToStaticMarkup?n:(this._hostParent||(n+=" "+w.createMarkupForRoot()),n+=" "+w.createMarkupForID(this._domID))},_createContentMarkup:function(e,t,n){var r="",i=t.dangerouslySetInnerHTML;if(null!=i)null!=i.__html&&(r=i.__html);else{var o=$[typeof t.children]?t.children:null,a=null!=o?null:t.children;if(null!=o)r=V(o);else if(null!=a){var s=this.mountChildren(a,e,n);
r=s.join("")}}return Y[this._tag]&&"\n"===r.charAt(0)?"\n"+r:r},_createInitialChildren:function(e,t,n,r){var i=t.dangerouslySetInnerHTML;if(null!=i)null!=i.__html&&y.queueHTML(r,i.__html);else{var o=$[typeof t.children]?t.children:null,a=null!=o?null:t.children;if(null!=o)y.queueText(r,o);else if(null!=a)for(var s=this.mountChildren(a,e,n),u=0;u<s.length;u++)y.queueChild(r,s[u])}},receiveComponent:function(e,t,n){var r=this._currentElement;this._currentElement=e,this.updateComponent(t,r,e,n)},updateComponent:function(e,t,n,i){var o=t.props,a=this._currentElement.props;switch(this._tag){case"button":o=M.getHostProps(this,o),a=M.getHostProps(this,a);break;case"input":o=P.getHostProps(this,o),a=P.getHostProps(this,a);break;case"option":o=k.getHostProps(this,o),a=k.getHostProps(this,a);break;case"select":o=R.getHostProps(this,o),a=R.getHostProps(this,a);break;case"textarea":o=I.getHostProps(this,o),a=I.getHostProps(this,a)}switch(r(this,a),this._updateDOMProperties(o,a,e),this._updateDOMChildren(o,a,e,i),this._tag){case"input":P.updateWrapper(this);break;case"textarea":I.updateWrapper(this);break;case"select":e.getReactMountReady().enqueue(l,this)}},_updateDOMProperties:function(e,t,n){var r,o,a;for(r in e)if(!t.hasOwnProperty(r)&&e.hasOwnProperty(r)&&null!=e[r])if(r===H){var s=this._previousStyleCopy;for(o in s)s.hasOwnProperty(o)&&(a=a||{},a[o]="");this._previousStyleCopy=null}else z.hasOwnProperty(r)?e[r]&&O(this,r):f(this._tag,e)?G.hasOwnProperty(r)||w.deleteValueForAttribute(F(this),r):(x.properties[r]||x.isCustomAttribute(r))&&w.deleteValueForProperty(F(this),r);for(r in t){var u=t[r],c=r===H?this._previousStyleCopy:null!=e?e[r]:void 0;if(t.hasOwnProperty(r)&&u!==c&&(null!=u||null!=c))if(r===H)if(u?u=this._previousStyleCopy=m({},u):this._previousStyleCopy=null,c){for(o in c)!c.hasOwnProperty(o)||u&&u.hasOwnProperty(o)||(a=a||{},a[o]="");for(o in u)u.hasOwnProperty(o)&&c[o]!==u[o]&&(a=a||{},a[o]=u[o])}else a=u;else if(z.hasOwnProperty(r))u?i(this,r,u,n):c&&O(this,r);else if(f(this._tag,t))G.hasOwnProperty(r)||w.setValueForAttribute(F(this),r,u);else if(x.properties[r]||x.isCustomAttribute(r)){var l=F(this);null!=u?w.setValueForProperty(l,r,u):w.deleteValueForProperty(l,r)}}a&&g.setValueForStyles(F(this),a,this)},_updateDOMChildren:function(e,t,n,r){var i=$[typeof e.children]?e.children:null,o=$[typeof t.children]?t.children:null,a=e.dangerouslySetInnerHTML&&e.dangerouslySetInnerHTML.__html,s=t.dangerouslySetInnerHTML&&t.dangerouslySetInnerHTML.__html,u=null!=i?null:e.children,c=null!=o?null:t.children,l=null!=i||null!=a,h=null!=o||null!=s;null!=u&&null==c?this.updateChildren(null,n,r):l&&!h&&this.updateTextContent(""),null!=o?i!==o&&this.updateTextContent(""+o):null!=s?a!==s&&this.updateMarkup(""+s):null!=c&&this.updateChildren(c,n,r)},getHostNode:function(){return F(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 n=0;n<t.length;n++)t[n].remove();break;case"html":case"head":case"body":d("66",this._tag)}this.unmountChildren(e),A.uncacheNode(this),C.deleteAllListeners(this),this._rootNodeID=0,this._domID=0,this._wrapperState=null},getPublicInstance:function(){return F(this)}},m(p.prototype,p.Mixin,D.Mixin),t.exports=p},{1:1,10:10,11:11,114:114,128:128,132:132,138:138,146:146,154:154,158:158,16:16,160:160,161:161,162:162,17:17,18:18,27:27,37:37,39:39,4:4,40:40,46:46,47:47,48:48,52:52,66:66,69:69,8:8,84:84,9:9}],39:[function(e,t){var n={hasCachedChildNodes:1};t.exports=n},{}],40:[function(e,t){function n(e){for(var t;t=e._renderedComponent;)e=t;return e}function r(e,t){var r=n(e);r._hostNode=t,t[d]=r}function i(e){var t=e._hostNode;t&&(delete t[d],e._hostNode=null)}function o(e,t){if(!(e._flags&p.hasCachedChildNodes)){var i=e._renderedChildren,o=t.firstChild;e:for(var a in i)if(i.hasOwnProperty(a)){var s=i[a],u=n(s)._domID;if(0!==u){for(;null!==o;o=o.nextSibling)if(1===o.nodeType&&o.getAttribute(f)===String(u)||8===o.nodeType&&o.nodeValue===" react-text: "+u+" "||8===o.nodeType&&o.nodeValue===" react-empty: "+u+" "){r(s,o);continue e}c("32",u)}}e._flags|=p.hasCachedChildNodes}}function a(e){if(e[d])return e[d];for(var t=[];!e[d];){if(t.push(e),!e.parentNode)return null;e=e.parentNode}for(var n,r;e&&(r=e[d]);e=t.pop())n=r,t.length&&o(r,e);return n}function s(e){var t=a(e);return null!=t&&t._hostNode===e?t:null}function u(e){if(void 0===e._hostNode?c("33"):void 0,e._hostNode)return e._hostNode;for(var t=[];!e._hostNode;)t.push(e),e._hostParent?void 0:c("34"),e=e._hostParent;for(;t.length;e=t.pop())o(e,e._hostNode);return e._hostNode}var c=e(132),l=e(10),h=e(39),f=(e(154),l.ID_ATTRIBUTE_NAME),p=h,d="__reactInternalInstance$"+Math.random().toString(36).slice(2),m={getClosestInstanceFromNode:a,getInstanceFromNode:s,getNodeFromInstance:u,precacheChildNodes:o,precacheNode:r,uncacheNode:i};t.exports=m},{10:10,132:132,154:154,39:39}],41:[function(e,t){function n(e,t){var n={_topLevelWrapper:e,_idCounter:1,_ownerDocument:t?t.nodeType===r?t:t.ownerDocument:null,_node:t,_tag:t?t.nodeName.toLowerCase():null,_namespaceURI:t?t.namespaceURI:null};return n}var r=(e(138),9);t.exports=n},{138:138}],42:[function(e,t){var n=e(162),r=e(8),i=e(40),o=function(){this._currentElement=null,this._hostNode=null,this._hostParent=null,this._hostContainerInfo=null,this._domID=0};n(o.prototype,{mountComponent:function(e,t,n){var o=n._idCounter++;this._domID=o,this._hostParent=t,this._hostContainerInfo=n;var a=" react-empty: "+this._domID+" ";if(e.useCreateElement){var s=n._ownerDocument,u=s.createComment(a);return i.precacheNode(this,u),r(u)}return e.renderToStaticMarkup?"":"<!--"+a+"-->"},receiveComponent:function(){},getHostNode:function(){return i.getNodeFromInstance(this)},unmountComponent:function(){i.uncacheNode(this)}}),t.exports=o},{162:162,40:40,8:8}],43:[function(e,t){var n=e(56),r=n.createFactory,i={a:r("a"),abbr:r("abbr"),address:r("address"),area:r("area"),article:r("article"),aside:r("aside"),audio:r("audio"),b:r("b"),base:r("base"),bdi:r("bdi"),bdo:r("bdo"),big:r("big"),blockquote:r("blockquote"),body:r("body"),br:r("br"),button:r("button"),canvas:r("canvas"),caption:r("caption"),cite:r("cite"),code:r("code"),col:r("col"),colgroup:r("colgroup"),data:r("data"),datalist:r("datalist"),dd:r("dd"),del:r("del"),details:r("details"),dfn:r("dfn"),dialog:r("dialog"),div:r("div"),dl:r("dl"),dt:r("dt"),em:r("em"),embed:r("embed"),fieldset:r("fieldset"),figcaption:r("figcaption"),figure:r("figure"),footer:r("footer"),form:r("form"),h1:r("h1"),h2:r("h2"),h3:r("h3"),h4:r("h4"),h5:r("h5"),h6:r("h6"),head:r("head"),header:r("header"),hgroup:r("hgroup"),hr:r("hr"),html:r("html"),i:r("i"),iframe:r("iframe"),img:r("img"),input:r("input"),ins:r("ins"),kbd:r("kbd"),keygen:r("keygen"),label:r("label"),legend:r("legend"),li:r("li"),link:r("link"),main:r("main"),map:r("map"),mark:r("mark"),menu:r("menu"),menuitem:r("menuitem"),meta:r("meta"),meter:r("meter"),nav:r("nav"),noscript:r("noscript"),object:r("object"),ol:r("ol"),optgroup:r("optgroup"),option:r("option"),output:r("output"),p:r("p"),param:r("param"),picture:r("picture"),pre:r("pre"),progress:r("progress"),q:r("q"),rp:r("rp"),rt:r("rt"),ruby:r("ruby"),s:r("s"),samp:r("samp"),script:r("script"),section:r("section"),select:r("select"),small:r("small"),source:r("source"),span:r("span"),strong:r("strong"),style:r("style"),sub:r("sub"),summary:r("summary"),sup:r("sup"),table:r("table"),tbody:r("tbody"),td:r("td"),textarea:r("textarea"),tfoot:r("tfoot"),th:r("th"),thead:r("thead"),time:r("time"),title:r("title"),tr:r("tr"),track:r("track"),u:r("u"),ul:r("ul"),"var":r("var"),video:r("video"),wbr:r("wbr"),circle:r("circle"),clipPath:r("clipPath"),defs:r("defs"),ellipse:r("ellipse"),g:r("g"),image:r("image"),line:r("line"),linearGradient:r("linearGradient"),mask:r("mask"),path:r("path"),pattern:r("pattern"),polygon:r("polygon"),polyline:r("polyline"),radialGradient:r("radialGradient"),rect:r("rect"),stop:r("stop"),svg:r("svg"),text:r("text"),tspan:r("tspan")};t.exports=i},{56:56}],44:[function(e,t){var n={useCreateElement:!0};t.exports=n},{}],45:[function(e,t){var n=e(7),r=e(40),i={dangerouslyProcessChildrenUpdates:function(e,t){var i=r.getNodeFromInstance(e);n.processUpdates(i,t)}};t.exports=i},{40:40,7:7}],46:[function(e,t){function n(){this._rootNodeID&&h.updateWrapper(this)}function r(e){var t=this._currentElement.props,r=u.executeOnChange(t,e);l.asap(n,this);var o=t.name;if("radio"===t.type&&null!=o){for(var a=c.getNodeFromInstance(this),s=a;s.parentNode;)s=s.parentNode;for(var h=s.querySelectorAll("input[name="+JSON.stringify(""+o)+'][type="radio"]'),f=0;f<h.length;f++){var p=h[f];if(p!==a&&p.form===a.form){var d=c.getInstanceFromNode(p);d?void 0:i("90"),l.asap(n,d)}}}return r}var i=e(132),o=e(162),a=e(14),s=e(11),u=e(24),c=e(40),l=e(88),h=(e(154),e(161),{getHostProps:function(e,t){var n=u.getValue(t),r=u.getChecked(t),i=o({type:void 0,step:void 0,min:void 0,max:void 0},a.getHostProps(e,t),{defaultChecked:void 0,defaultValue:void 0,value:null!=n?n:e._wrapperState.initialValue,checked:null!=r?r:e._wrapperState.initialChecked,onChange:e._wrapperState.onChange});return i},mountWrapper:function(e,t){var n=t.defaultValue;e._wrapperState={initialChecked:null!=t.checked?t.checked:t.defaultChecked,initialValue:null!=t.value?t.value:n,listeners:null,onChange:r.bind(e)}},updateWrapper:function(e){var t=e._currentElement.props,n=t.checked;null!=n&&s.setValueForProperty(c.getNodeFromInstance(e),"checked",n||!1);var r=c.getNodeFromInstance(e),i=u.getValue(t);if(null!=i){var o=""+i;o!==r.value&&(r.value=o)}else null==t.value&&null!=t.defaultValue&&(r.defaultValue=""+t.defaultValue),null==t.checked&&null!=t.defaultChecked&&(r.defaultChecked=!!t.defaultChecked)},postMountWrapper:function(e){var t=e._currentElement.props,n=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":n.value="",n.value=n.defaultValue;break;default:n.value=n.value}var r=n.name;""!==r&&(n.name=""),n.defaultChecked=!n.defaultChecked,n.defaultChecked=!n.defaultChecked,""!==r&&(n.name=r)}});t.exports=h},{11:11,132:132,14:14,154:154,161:161,162:162,24:24,40:40,88:88}],47:[function(e,t){function n(e){var t="";return i.forEach(e,function(e){null!=e&&("string"==typeof e||"number"==typeof e?t+=e:s||(s=!0))}),t}var r=e(162),i=e(29),o=e(40),a=e(48),s=(e(161),!1),u={mountWrapper:function(e,t,r){var i=null;if(null!=r){var o=r;"optgroup"===o._tag&&(o=o._hostParent),null!=o&&"select"===o._tag&&(i=a.getSelectValueContext(o))}var s=null;if(null!=i){var u;if(u=null!=t.value?t.value+"":n(t.children),s=!1,Array.isArray(i)){for(var c=0;c<i.length;c++)if(""+i[c]===u){s=!0;break}}else s=""+i===u}e._wrapperState={selected:s}},postMountWrapper:function(e){var t=e._currentElement.props;if(null!=t.value){var n=o.getNodeFromInstance(e);n.setAttribute("value",t.value)}},getHostProps:function(e,t){var i=r({selected:void 0,children:void 0},t);null!=e._wrapperState.selected&&(i.selected=e._wrapperState.selected);var o=n(t.children);return o&&(i.children=o),i}};t.exports=u},{161:161,162:162,29:29,40:40,48:48}],48:[function(e,t){function n(){if(this._rootNodeID&&this._wrapperState.pendingUpdate){this._wrapperState.pendingUpdate=!1;var e=this._currentElement.props,t=s.getValue(e);null!=t&&r(this,Boolean(e.multiple),t)}}function r(e,t,n){var r,i,o=u.getNodeFromInstance(e).options;if(t){for(r={},i=0;i<n.length;i++)r[""+n[i]]=!0;for(i=0;i<o.length;i++){var a=r.hasOwnProperty(o[i].value);o[i].selected!==a&&(o[i].selected=a)}}else{for(r=""+n,i=0;i<o.length;i++)if(o[i].value===r)return void(o[i].selected=!0);o.length&&(o[0].selected=!0)}}function i(e){var t=this._currentElement.props,r=s.executeOnChange(t,e);return this._rootNodeID&&(this._wrapperState.pendingUpdate=!0),c.asap(n,this),r}var o=e(162),a=e(14),s=e(24),u=e(40),c=e(88),l=(e(161),!1),h={getHostProps:function(e,t){return o({},a.getHostProps(e,t),{onChange:e._wrapperState.onChange,value:void 0})},mountWrapper:function(e,t){var n=s.getValue(t);e._wrapperState={pendingUpdate:!1,initialValue:null!=n?n:t.defaultValue,listeners:null,onChange:i.bind(e),wasMultiple:Boolean(t.multiple)},void 0===t.value||void 0===t.defaultValue||l||(l=!0)},getSelectValueContext:function(e){return e._wrapperState.initialValue},postUpdateWrapper:function(e){var t=e._currentElement.props;e._wrapperState.initialValue=void 0;var n=e._wrapperState.wasMultiple;e._wrapperState.wasMultiple=Boolean(t.multiple);var i=s.getValue(t);null!=i?(e._wrapperState.pendingUpdate=!1,r(e,Boolean(t.multiple),i)):n!==Boolean(t.multiple)&&(null!=t.defaultValue?r(e,Boolean(t.multiple),t.defaultValue):r(e,Boolean(t.multiple),t.multiple?[]:""))}};t.exports=h},{14:14,161:161,162:162,24:24,40:40,88:88}],49:[function(e,t){function n(e,t,n,r){return e===n&&t===r}function r(e){var t=document.selection,n=t.createRange(),r=n.text.length,i=n.duplicate();i.moveToElementText(e),i.setEndPoint("EndToStart",n);var o=i.text.length,a=o+r;return{start:o,end:a}}function i(e){var t=window.getSelection&&window.getSelection();if(!t||0===t.rangeCount)return null;var r=t.anchorNode,i=t.anchorOffset,o=t.focusNode,a=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),c=u?0:s.toString().length,l=s.cloneRange();l.selectNodeContents(e),l.setEnd(s.startContainer,s.startOffset);var h=n(l.startContainer,l.startOffset,l.endContainer,l.endOffset),f=h?0:l.toString().length,p=f+c,d=document.createRange();d.setStart(r,i),d.setEnd(o,a);var m=d.collapsed;return{start:m?p:f,end:m?f:p}}function o(e,t){var n,r,i=document.selection.createRange().duplicate();void 0===t.end?(n=t.start,r=n):t.start>t.end?(n=t.end,r=t.start):(n=t.start,r=t.end),i.moveToElementText(e),i.moveStart("character",n),i.setEndPoint("EndToStart",i),i.moveEnd("character",r-n),i.select()}function a(e,t){if(window.getSelection){var n=window.getSelection(),r=e[c()].length,i=Math.min(t.start,r),o=void 0===t.end?i:Math.min(t.end,r);if(!n.extend&&i>o){var a=o;o=i,i=a}var s=u(e,i),l=u(e,o);if(s&&l){var h=document.createRange();h.setStart(s.node,s.offset),n.removeAllRanges(),i>o?(n.addRange(h),n.extend(l.node,l.offset)):(h.setEnd(l.node,l.offset),n.addRange(h))}}}var s=e(140),u=e(124),c=e(125),l=s.canUseDOM&&"selection"in document&&!("getSelection"in window),h={getOffsets:l?r:i,setOffsets:l?o:a};t.exports=h},{124:124,125:125,140:140}],50:[function(e,t){var n=e(55),r=e(83),i=e(89);n.inject();var o={renderToString:r.renderToString,renderToStaticMarkup:r.renderToStaticMarkup,version:i};t.exports=o},{55:55,83:83,89:89}],51:[function(e,t){var n=e(132),r=e(162),i=e(7),o=e(8),a=e(40),s=e(114),u=(e(154),e(138),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});r(u.prototype,{mountComponent:function(e,t,n){var r=n._idCounter++,i=" react-text: "+r+" ",u=" /react-text ";if(this._domID=r,this._hostParent=t,e.useCreateElement){var c=n._ownerDocument,l=c.createComment(i),h=c.createComment(u),f=o(c.createDocumentFragment());return o.queueChild(f,o(l)),this._stringText&&o.queueChild(f,o(c.createTextNode(this._stringText))),o.queueChild(f,o(h)),a.precacheNode(this,l),this._closingComment=h,f}var p=s(this._stringText);return e.renderToStaticMarkup?p:"<!--"+i+"-->"+p+"<!--"+u+"-->"},receiveComponent:function(e){if(e!==this._currentElement){this._currentElement=e;var t=""+e;if(t!==this._stringText){this._stringText=t;var n=this.getHostNode();i.replaceDelimitedText(n[0],n[1],t)}}},getHostNode:function(){var e=this._commentNodes;if(e)return e;if(!this._closingComment)for(var t=a.getNodeFromInstance(this),r=t.nextSibling;;){if(null==r?n("67",this._domID):void 0,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,a.uncacheNode(this)}}),t.exports=u},{114:114,132:132,138:138,154:154,162:162,40:40,7:7,8:8}],52:[function(e,t){function n(){this._rootNodeID&&l.updateWrapper(this)}function r(e){var t=this._currentElement.props,r=s.executeOnChange(t,e);return c.asap(n,this),r}var i=e(132),o=e(162),a=e(14),s=e(24),u=e(40),c=e(88),l=(e(154),e(161),{getHostProps:function(e,t){null!=t.dangerouslySetInnerHTML?i("91"):void 0;var n=o({},a.getHostProps(e,t),{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue,onChange:e._wrapperState.onChange});return n},mountWrapper:function(e,t){var n=s.getValue(t),o=n;if(null==n){var a=t.defaultValue,u=t.children;null!=u&&(null!=a?i("92"):void 0,Array.isArray(u)&&(u.length<=1?void 0:i("93"),u=u[0]),a=""+u),null==a&&(a=""),o=a}e._wrapperState={initialValue:""+o,listeners:null,onChange:r.bind(e)}},updateWrapper:function(e){var t=e._currentElement.props,n=u.getNodeFromInstance(e),r=s.getValue(t);if(null!=r){var i=""+r;i!==n.value&&(n.value=i),null==t.defaultValue&&(n.defaultValue=i)}null!=t.defaultValue&&(n.defaultValue=t.defaultValue)},postMountWrapper:function(e){var t=u.getNodeFromInstance(e);t.value=t.textContent}});t.exports=l},{132:132,14:14,154:154,161:161,162:162,24:24,40:40,88:88}],53:[function(e,t){function n(e,t){"_hostNode"in e?void 0:s("33"),"_hostNode"in t?void 0:s("33");for(var n=0,r=e;r;r=r._hostParent)n++;for(var i=0,o=t;o;o=o._hostParent)i++;for(;n-i>0;)e=e._hostParent,n--;for(;i-n>0;)t=t._hostParent,i--;for(var a=n;a--;){if(e===t)return e;e=e._hostParent,t=t._hostParent}return null}function r(e,t){"_hostNode"in e?void 0:s("35"),"_hostNode"in t?void 0:s("35");for(;t;){if(t===e)return!0;t=t._hostParent}return!1}function i(e){return"_hostNode"in e?void 0:s("36"),e._hostParent}function o(e,t,n){for(var r=[];e;)r.push(e),e=e._hostParent;var i;for(i=r.length;i-->0;)t(r[i],!1,n);for(i=0;i<r.length;i++)t(r[i],!0,n)}function a(e,t,r,i,o){for(var a=e&&t?n(e,t):null,s=[];e&&e!==a;)s.push(e),e=e._hostParent;for(var u=[];t&&t!==a;)u.push(t),t=t._hostParent;var c;for(c=0;c<s.length;c++)r(s[c],!0,i);for(c=u.length;c-->0;)r(u[c],!1,o)}var s=e(132);e(154),t.exports={isAncestor:r,getLowestCommonAncestor:n,getParentInstance:i,traverseTwoPhase:o,traverseEnterLeave:a}},{132:132,154:154}],54:[function(e,t){function n(){this.reinitializeTransaction()}var r=e(162),i=e(88),o=e(106),a=e(146),s={initialize:a,close:function(){h.isBatchingUpdates=!1}},u={initialize:a,close:i.flushBatchedUpdates.bind(i)},c=[u,s];r(n.prototype,o.Mixin,{getTransactionWrappers:function(){return c}});var l=new n,h={isBatchingUpdates:!1,batchedUpdates:function(e,t,n,r,i,o){var a=h.isBatchingUpdates;h.isBatchingUpdates=!0,a?e(t,n,r,i,o):l.perform(e,null,t,n,r,i,o)}};t.exports=h},{106:106,146:146,162:162,88:88}],55:[function(e,t){function n(){w||(w=!0,v.EventEmitter.injectReactEventListener(m),v.EventPluginHub.injectEventPluginOrder(o),v.EventPluginUtils.injectComponentTree(l),v.EventPluginUtils.injectTreeTraversal(f),v.EventPluginHub.injectEventPluginsByName({SimpleEventPlugin:x,EnterLeaveEventPlugin:a,ChangeEventPlugin:i,SelectEventPlugin:b,BeforeInputEventPlugin:r}),v.HostComponent.injectGenericComponentClass(c),v.HostComponent.injectTextComponentClass(p),v.DOMProperty.injectDOMPropertyConfig(s),v.DOMProperty.injectDOMPropertyConfig(y),v.EmptyComponent.injectEmptyComponentFactory(function(e){return new h(e)}),v.Updates.injectReconcileTransaction(g),v.Updates.injectBatchingStrategy(d),v.Component.injectEnvironment(u))}var r=e(2),i=e(6),o=e(13),a=e(15),s=e(22),u=e(32),c=e(38),l=e(40),h=e(42),f=e(53),p=e(51),d=e(54),m=e(60),v=e(63),g=e(79),y=e(90),b=e(91),x=e(92),w=!1;t.exports={inject:n}},{13:13,15:15,2:2,22:22,32:32,38:38,40:40,42:42,51:51,53:53,54:54,6:6,60:60,63:63,79:79,90:90,91:91,92:92}],56:[function(e,t){function n(e){return void 0!==e.ref}function r(e){return void 0!==e.key}var i=e(162),o=e(35),a=(e(161),e(110),Object.prototype.hasOwnProperty),s="function"==typeof Symbol&&Symbol.for&&Symbol.for("react.element")||60103,u={key:!0,ref:!0,__self:!0,__source:!0},c=function(e,t,n,r,i,o,a){var u={$$typeof:s,type:e,key:t,ref:n,props:a,_owner:o};return u};c.createElement=function(e,t,i){var s,l={},h=null,f=null,p=null,d=null;if(null!=t){n(t)&&(f=t.ref),r(t)&&(h=""+t.key),p=void 0===t.__self?null:t.__self,d=void 0===t.__source?null:t.__source;for(s in t)a.call(t,s)&&!u.hasOwnProperty(s)&&(l[s]=t[s])}var m=arguments.length-2;if(1===m)l.children=i;else if(m>1){for(var v=Array(m),g=0;m>g;g++)v[g]=arguments[g+2];l.children=v}if(e&&e.defaultProps){var y=e.defaultProps;for(s in y)void 0===l[s]&&(l[s]=y[s])}return c(e,h,f,p,d,o.current,l)},c.createFactory=function(e){var t=c.createElement.bind(null,e);return t.type=e,t},c.cloneAndReplaceKey=function(e,t){var n=c(e.type,t,e.ref,e._self,e._source,e._owner,e.props);return n},c.cloneElement=function(e,t,s){var l,h=i({},e.props),f=e.key,p=e.ref,d=e._self,m=e._source,v=e._owner;if(null!=t){n(t)&&(p=t.ref,v=o.current),r(t)&&(f=""+t.key);var g;e.type&&e.type.defaultProps&&(g=e.type.defaultProps);for(l in t)a.call(t,l)&&!u.hasOwnProperty(l)&&(h[l]=void 0===t[l]&&void 0!==g?g[l]:t[l])}var y=arguments.length-2;if(1===y)h.children=s;else if(y>1){for(var b=Array(y),x=0;y>x;x++)b[x]=arguments[x+2];h.children=b}return c(e.type,f,p,d,m,v,h)},c.isValidElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===s},c.REACT_ELEMENT_TYPE=s,t.exports=c},{110:110,161:161,162:162,35:35}],57:[function(e,t){var n,r={injectEmptyComponentFactory:function(e){n=e}},i={create:function(e){return n(e)}};i.injection=r,t.exports=i},{}],58:[function(e,t){function n(e,t,n,i){try{return t(n,i)}catch(e){return void(null===r&&(r=e))}}var r=null,i={invokeGuardedCallback:n,invokeGuardedCallbackWithCatch:n,rethrowCaughtError:function(){if(r){var e=r;throw r=null,e}}};t.exports=i},{}],59:[function(e,t){function n(e){r.enqueueEvents(e),r.processEventQueue(!1)}var r=e(17),i={handleTopLevel:function(e,t,i,o){var a=r.extractEvents(e,t,i,o);n(a)}};t.exports=i},{17:17}],60:[function(e,t){function n(e){for(;e._hostParent;)e=e._hostParent;var t=l.getNodeFromInstance(e),n=t.parentNode;return l.getClosestInstanceFromNode(n)}function r(e,t){this.topLevelType=e,this.nativeEvent=t,this.ancestors=[]}function i(e){var t=f(e.nativeEvent),r=l.getClosestInstanceFromNode(t),i=r;do e.ancestors.push(i),i=i&&n(i);while(i);for(var o=0;o<e.ancestors.length;o++)r=e.ancestors[o],d._handleTopLevel(e.topLevelType,r,e.nativeEvent,f(e.nativeEvent))}function o(e){var t=p(window);e(t)}var a=e(162),s=e(139),u=e(140),c=e(25),l=e(40),h=e(88),f=e(121),p=e(151);a(r.prototype,{destructor:function(){this.topLevelType=null,this.nativeEvent=null,this.ancestors.length=0}}),c.addPoolingTo(r,c.twoArgumentPooler);var d={_enabled:!0,_handleTopLevel:null,WINDOW_HANDLE:u.canUseDOM?window:null,setHandleTopLevel:function(e){d._handleTopLevel=e},setEnabled:function(e){d._enabled=!!e},isEnabled:function(){return d._enabled},trapBubbledEvent:function(e,t,n){var r=n;return r?s.listen(r,t,d.dispatchEvent.bind(null,e)):null},trapCapturedEvent:function(e,t,n){var r=n;return r?s.capture(r,t,d.dispatchEvent.bind(null,e)):null},monitorScrollValue:function(e){var t=o.bind(null,e);s.listen(window,"scroll",t)},dispatchEvent:function(e,t){if(d._enabled){var n=r.getPooled(e,t);try{h.batchedUpdates(i,n)}finally{r.release(n)}}}};t.exports=d},{121:121,139:139,140:140,151:151,162:162,25:25,40:40,88:88}],61:[function(e,t){var n={logTopLevelRenders:!1};t.exports=n},{}],62:[function(e,t){function n(e){return s?void 0:o("111",e.type),new s(e)}function r(e){return new c(e)}function i(e){return e instanceof c}var o=e(132),a=e(162),s=(e(154),null),u={},c=null,l={injectGenericComponentClass:function(e){s=e},injectTextComponentClass:function(e){c=e},injectComponentClasses:function(e){a(u,e)}},h={createInternalComponent:n,createInstanceForText:r,isTextComponent:i,injection:l};t.exports=h},{132:132,154:154,162:162}],63:[function(e,t){var n=e(10),r=e(17),i=e(19),o=e(33),a=e(30),s=e(57),u=e(27),c=e(62),l=e(88),h={Component:o.injection,Class:a.injection,DOMProperty:n.injection,EmptyComponent:s.injection,EventPluginHub:r.injection,EventPluginUtils:i.injection,EventEmitter:u.injection,HostComponent:c.injection,Updates:l.injection};t.exports=h},{10:10,17:17,19:19,27:27,30:30,33:33,57:57,62:62,88:88}],64:[function(e,t){function n(e){return i(document.documentElement,e)}var r=e(49),i=e(143),o=e(148),a=e(149),s={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=a();return{focusedElem:e,selectionRange:s.hasSelectionCapabilities(e)?s.getSelection(e):null}},restoreSelection:function(e){var t=a(),r=e.focusedElem,i=e.selectionRange;t!==r&&n(r)&&(s.hasSelectionCapabilities(r)&&s.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 n=document.selection.createRange();n.parentElement()===e&&(t={start:-n.moveStart("character",-e.value.length),end:-n.moveEnd("character",-e.value.length)})}else t=r.getOffsets(e);return t||{start:0,end:0}},setSelection:function(e,t){var n=t.start,i=t.end;if(void 0===i&&(i=n),"selectionStart"in e)e.selectionStart=n,e.selectionEnd=Math.min(i,e.value.length);else if(document.selection&&e.nodeName&&"input"===e.nodeName.toLowerCase()){var o=e.createTextRange();o.collapse(!0),o.moveStart("character",n),o.moveEnd("character",i-n),o.select()}else r.setOffsets(e,t)}};t.exports=s},{143:143,148:148,149:149,49:49}],65:[function(e,t){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},{}],66:[function(e,t){var n=null;t.exports={debugTool:n}},{}],67:[function(e,t){var n=e(109),r=/\/?>/,i=/^<\!\-\-/,o={CHECKSUM_ATTR_NAME:"data-react-checksum",addChecksumToMarkup:function(e){var t=n(e);return i.test(e)?e:e.replace(r," "+o.CHECKSUM_ATTR_NAME+'="'+t+'"$&')},canReuseMarkup:function(e,t){var r=t.getAttribute(o.CHECKSUM_ATTR_NAME);r=r&&parseInt(r,10);var i=n(e);return i===r}};t.exports=o},{109:109}],68:[function(e,t){function n(e,t){for(var n=Math.min(e.length,t.length),r=0;n>r;r++)if(e.charAt(r)!==t.charAt(r))return r;return e.length===t.length?-1:n}function r(e){return e?e.nodeType===D?e.documentElement:e.firstChild:null}function i(e){return e.getAttribute&&e.getAttribute(k)||""}function o(e,t,n,r,i){var o;if(x.logTopLevelRenders){var a=e._currentElement.props,s=a.type;o="React mount: "+("string"==typeof s?s:s.displayName||s.name),console.time(o)}var u=C.mountComponent(e,n,null,g(e,t),i,0);o&&console.timeEnd(o),e._renderedComponent._topLevelWrapper=e,O._mountImageIntoNode(u,t,e,r,n)}function a(e,t,n,r){var i=S.ReactReconcileTransaction.getPooled(!n&&y.useCreateElement);i.perform(o,null,e,t,i,n,r),S.ReactReconcileTransaction.release(i)}function s(e,t,n){for(C.unmountComponent(e,n),t.nodeType===D&&(t=t.documentElement);t.lastChild;)t.removeChild(t.lastChild)}function u(e){var t=r(e);if(t){var n=v.getInstanceFromNode(t);return!(!n||!n._hostParent)}}function c(e){return!(!e||e.nodeType!==I&&e.nodeType!==D&&e.nodeType!==B)}function l(e){var t=r(e),n=t&&v.getInstanceFromNode(t);return n&&!n._hostParent?n:null}function h(e){var t=l(e);return t?t._hostContainerInfo._topLevelWrapper:null}var f=e(132),p=e(8),d=e(10),m=e(27),v=(e(35),e(40)),g=e(41),y=e(44),b=e(56),x=e(61),w=e(65),_=(e(66),e(67)),C=e(80),E=e(87),S=e(88),M=e(147),T=e(127),A=(e(154),e(134)),P=e(136),k=(e(161),d.ID_ATTRIBUTE_NAME),R=d.ROOT_ATTRIBUTE_NAME,I=1,D=9,B=11,V={},L=1,N=function(){this.rootID=L++};N.prototype.isReactComponent={},N.prototype.render=function(){return this.props};var O={TopLevelWrapper:N,_instancesByReactRootID:V,scrollMonitor:function(e,t){t()},_updateRootComponent:function(e,t,n,r,i){return O.scrollMonitor(r,function(){E.enqueueElementInternal(e,t,n),i&&E.enqueueCallbackInternal(e,i)}),e},_renderNewRootComponent:function(e,t,n,r){c(t)?void 0:f("37"),m.ensureScrollValueMonitoring();var i=T(e,!1);S.batchedUpdates(a,i,t,n,r);var o=i._instance.rootID;return V[o]=i,i},renderSubtreeIntoContainer:function(e,t,n,r){return null!=e&&w.has(e)?void 0:f("38"),O._renderSubtreeIntoContainer(e,t,n,r)},_renderSubtreeIntoContainer:function(e,t,n,o){E.validateCallback(o,"ReactDOM.render"),b.isValidElement(t)?void 0:f("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 a,s=b(N,null,null,null,null,null,t);if(e){var c=w.get(e);a=c._processChildContext(c._context)}else a=M;var l=h(n);if(l){var p=l._currentElement,d=p.props;if(P(d,t)){var m=l._renderedComponent.getPublicInstance(),v=o&&function(){o.call(m)};return O._updateRootComponent(l,s,a,n,v),m}O.unmountComponentAtNode(n)}var g=r(n),y=g&&!!i(g),x=u(n),_=y&&!l&&!x,C=O._renderNewRootComponent(s,n,_,a)._renderedComponent.getPublicInstance();return o&&o.call(C),C},render:function(e,t,n){return O._renderSubtreeIntoContainer(null,e,t,n)},unmountComponentAtNode:function(e){c(e)?void 0:f("40");var t=h(e);return t?(delete V[t._instance.rootID],S.batchedUpdates(s,t,e,!1),!0):(u(e),1===e.nodeType&&e.hasAttribute(R),!1)},_mountImageIntoNode:function(e,t,i,o,a){if(c(t)?void 0:f("41"),o){var s=r(t);if(_.canReuseMarkup(e,s))return void v.precacheNode(i,s);var u=s.getAttribute(_.CHECKSUM_ATTR_NAME);s.removeAttribute(_.CHECKSUM_ATTR_NAME);var l=s.outerHTML;s.setAttribute(_.CHECKSUM_ATTR_NAME,u);var h=e,d=n(h,l),m=" (client) "+h.substring(d-20,d+20)+"\n (server) "+l.substring(d-20,d+20);t.nodeType===D?f("42",m):void 0}if(t.nodeType===D?f("43"):void 0,a.useCreateElement){for(;t.lastChild;)t.removeChild(t.lastChild);p.insertTreeBefore(t,e,null)}else A(t,e),v.precacheNode(i,t.firstChild)}};t.exports=O},{10:10,127:127,132:132,134:134,136:136,147:147,154:154,161:161,27:27,35:35,40:40,41:41,44:44,56:56,61:61,65:65,66:66,67:67,8:8,80:80,87:87,88:88}],69:[function(e,t){function n(e,t,n){return{type:h.INSERT_MARKUP,content:e,fromIndex:null,fromNode:null,toIndex:n,afterNode:t}}function r(e,t,n){return{type:h.MOVE_EXISTING,content:null,fromIndex:e._mountIndex,fromNode:f.getHostNode(e),toIndex:n,afterNode:t}}function i(e,t){return{type:h.REMOVE_NODE,content:null,fromIndex:e._mountIndex,fromNode:t,toIndex:null,afterNode:null}}function o(e){return{type:h.SET_MARKUP,content:e,fromIndex:null,fromNode:null,toIndex:null,afterNode:null}}function a(e){return{type:h.TEXT_CONTENT,content:e,fromIndex:null,fromNode:null,toIndex:null,afterNode:null}}function s(e,t){return t&&(e=e||[],e.push(t)),e}function u(e,t){l.processChildrenUpdates(e,t)}var c=e(132),l=e(33),h=(e(65),e(66),e(70)),f=(e(35),e(80)),p=e(28),d=(e(146),e(116)),m=(e(154),{Mixin:{_reconcilerInstantiateChildren:function(e,t,n){return p.instantiateChildren(e,t,n)},_reconcilerUpdateChildren:function(e,t,n,r,i,o){var a,s=0;return a=d(t,s),p.updateChildren(e,a,n,r,i,this,this._hostContainerInfo,o,s),a},mountChildren:function(e,t,n){var r=this._reconcilerInstantiateChildren(e,t,n);this._renderedChildren=r;var i=[],o=0;for(var a in r)if(r.hasOwnProperty(a)){var s=r[a],u=0,c=f.mountComponent(s,t,this,this._hostContainerInfo,n,u);s._mountIndex=o++,i.push(c)}return i},updateTextContent:function(e){var t=this._renderedChildren;p.unmountChildren(t,!1);for(var n in t)t.hasOwnProperty(n)&&c("118");var r=[a(e)];u(this,r)},updateMarkup:function(e){var t=this._renderedChildren;p.unmountChildren(t,!1);for(var n in t)t.hasOwnProperty(n)&&c("118");var r=[o(e)];u(this,r)},updateChildren:function(e,t,n){this._updateChildren(e,t,n)
},_updateChildren:function(e,t,n){var r=this._renderedChildren,i={},o=[],a=this._reconcilerUpdateChildren(r,e,o,i,t,n);if(a||r){var c,l=null,h=0,p=0,d=0,m=null;for(c in a)if(a.hasOwnProperty(c)){var v=r&&r[c],g=a[c];v===g?(l=s(l,this.moveChild(v,m,h,p)),p=Math.max(v._mountIndex,p),v._mountIndex=h):(v&&(p=Math.max(v._mountIndex,p)),l=s(l,this._mountChildAtIndex(g,o[d],m,h,t,n)),d++),h++,m=f.getHostNode(g)}for(c in i)i.hasOwnProperty(c)&&(l=s(l,this._unmountChild(r[c],i[c])));l&&u(this,l),this._renderedChildren=a}},unmountChildren:function(e){var t=this._renderedChildren;p.unmountChildren(t,e),this._renderedChildren=null},moveChild:function(e,t,n,i){return e._mountIndex<i?r(e,t,n):void 0},createChild:function(e,t,r){return n(r,t,e._mountIndex)},removeChild:function(e,t){return i(e,t)},_mountChildAtIndex:function(e,t,n,r){return e._mountIndex=r,this.createChild(e,n,t)},_unmountChild:function(e,t){var n=this.removeChild(e,t);return e._mountIndex=null,n}}});t.exports=m},{116:116,132:132,146:146,154:154,28:28,33:33,35:35,65:65,66:66,70:70,80:80}],70:[function(e,t){var n=e(157),r=n({INSERT_MARKUP:null,MOVE_EXISTING:null,REMOVE_NODE:null,SET_MARKUP:null,TEXT_CONTENT:null});t.exports=r},{157:157}],71:[function(e,t){var n=e(132),r=e(56),i=(e(154),{HOST:0,COMPOSITE:1,EMPTY:2,getType:function(e){return null===e||e===!1?i.EMPTY:r.isValidElement(e)?"function"==typeof e.type?i.COMPOSITE:i.HOST:void n("26",e)}});t.exports=i},{132:132,154:154,56:56}],72:[function(e,t){function n(){}var r=(e(161),{isMounted:function(){return!1},enqueueCallback:function(){},enqueueForceUpdate:function(e){n(e,"forceUpdate")},enqueueReplaceState:function(e){n(e,"replaceState")},enqueueSetState:function(e){n(e,"setState")}});t.exports=r},{161:161}],73:[function(e,t){var n=e(132),r=(e(154),{isValidOwner:function(e){return!(!e||"function"!=typeof e.attachRef||"function"!=typeof e.detachRef)},addComponentAsRefTo:function(e,t,i){r.isValidOwner(i)?void 0:n("119"),i.attachRef(t,e)},removeComponentAsRefFrom:function(e,t,i){r.isValidOwner(i)?void 0:n("120");var o=i.getPublicInstance();o&&o.refs[t]===e.getPublicInstance()&&i.detachRef(t)}});t.exports=r},{132:132,154:154}],74:[function(e,t){var n={};t.exports=n},{}],75:[function(e,t){var n=e(157),r=n({prop:null,context:null,childContext:null});t.exports=r},{157:157}],76:[function(e,t){function n(e,t){return e===t?0!==e||1/e===1/t:e!==e&&t!==t}function r(e){this.message=e,this.stack=""}function i(e){function t(t,n,i,o,a,s){if(o=o||S,s=s||i,null==n[i]){var u=w[a];return t?new r("Required "+u+" `"+s+"` was not specified in "+("`"+o+"`.")):null}return e(n,i,o,a,s)}var n=t.bind(null,!1);return n.isRequired=t.bind(null,!0),n}function o(e){function t(t,n,i,o,a){var s=t[n],u=g(s);if(u!==e){var c=w[o],l=y(s);return new r("Invalid "+c+" `"+a+"` of type "+("`"+l+"` supplied to `"+i+"`, expected ")+("`"+e+"`."))}return null}return i(t)}function a(){return i(C.thatReturns(null))}function s(e){function t(t,n,i,o,a){if("function"!=typeof e)return new r("Property `"+a+"` of component `"+i+"` has invalid PropType notation inside arrayOf.");var s=t[n];if(!Array.isArray(s)){var u=w[o],c=g(s);return new r("Invalid "+u+" `"+a+"` of type "+("`"+c+"` supplied to `"+i+"`, expected an array."))}for(var l=0;l<s.length;l++){var h=e(s,l,i,o,a+"["+l+"]",_);if(h instanceof Error)return h}return null}return i(t)}function u(){function e(e,t,n,i,o){var a=e[t];if(!x.isValidElement(a)){var s=w[i],u=g(a);return new r("Invalid "+s+" `"+o+"` of type "+("`"+u+"` supplied to `"+n+"`, expected a single ReactElement."))}return null}return i(e)}function c(e){function t(t,n,i,o,a){if(!(t[n]instanceof e)){var s=w[o],u=e.name||S,c=b(t[n]);return new r("Invalid "+s+" `"+a+"` of type "+("`"+c+"` supplied to `"+i+"`, expected ")+("instance of `"+u+"`."))}return null}return i(t)}function l(e){function t(t,i,o,a,s){for(var u=t[i],c=0;c<e.length;c++)if(n(u,e[c]))return null;var l=w[a],h=JSON.stringify(e);return new r("Invalid "+l+" `"+s+"` of value `"+u+"` "+("supplied to `"+o+"`, expected one of "+h+"."))}return Array.isArray(e)?i(t):C.thatReturnsNull}function h(e){function t(t,n,i,o,a){if("function"!=typeof e)return new r("Property `"+a+"` of component `"+i+"` has invalid PropType notation inside objectOf.");var s=t[n],u=g(s);if("object"!==u){var c=w[o];return new r("Invalid "+c+" `"+a+"` of type "+("`"+u+"` supplied to `"+i+"`, expected an object."))}for(var l in s)if(s.hasOwnProperty(l)){var h=e(s,l,i,o,a+"."+l,_);if(h instanceof Error)return h}return null}return i(t)}function f(e){function t(t,n,i,o,a){for(var s=0;s<e.length;s++){var u=e[s];if(null==u(t,n,i,o,a,_))return null}var c=w[o];return new r("Invalid "+c+" `"+a+"` supplied to "+("`"+i+"`."))}return Array.isArray(e)?i(t):C.thatReturnsNull}function p(){function e(e,t,n,i,o){if(!m(e[t])){var a=w[i];return new r("Invalid "+a+" `"+o+"` supplied to "+("`"+n+"`, expected a ReactNode."))}return null}return i(e)}function d(e){function t(t,n,i,o,a){var s=t[n],u=g(s);if("object"!==u){var c=w[o];return new r("Invalid "+c+" `"+a+"` of type `"+u+"` "+("supplied to `"+i+"`, expected `object`."))}for(var l in e){var h=e[l];if(h){var f=h(s,l,i,o,a+"."+l,_);if(f)return f}}return null}return i(t)}function m(e){switch(typeof e){case"number":case"string":case"undefined":return!0;case"boolean":return!e;case"object":if(Array.isArray(e))return e.every(m);if(null===e||x.isValidElement(e))return!0;var t=E(e);if(!t)return!1;var n,r=t.call(e);if(t!==e.entries){for(;!(n=r.next()).done;)if(!m(n.value))return!1}else for(;!(n=r.next()).done;){var i=n.value;if(i&&!m(i[1]))return!1}return!0;default:return!1}}function v(e,t){return"symbol"===e||"Symbol"===t["@@toStringTag"]||"function"==typeof Symbol&&t instanceof Symbol}function g(e){var t=typeof e;return Array.isArray(e)?"array":e instanceof RegExp?"object":v(t,e)?"symbol":t}function y(e){var t=g(e);if("object"===t){if(e instanceof Date)return"date";if(e instanceof RegExp)return"regexp"}return t}function b(e){return e.constructor&&e.constructor.name?e.constructor.name:S}var x=e(56),w=e(74),_=e(77),C=e(146),E=e(123),S=(e(161),"<<anonymous>>"),M={array:o("array"),bool:o("boolean"),func:o("function"),number:o("number"),object:o("object"),string:o("string"),symbol:o("symbol"),any:a(),arrayOf:s,element:u(),instanceOf:c,node:p(),objectOf:h,oneOf:l,oneOfType:f,shape:d};r.prototype=Error.prototype,t.exports=M},{123:123,146:146,161:161,56:56,74:74,77:77}],77:[function(e,t){var n="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";t.exports=n},{}],78:[function(e,t){function n(e,t,n){this.props=e,this.context=t,this.refs=s,this.updater=n||a}function r(){}var i=e(162),o=e(31),a=e(72),s=e(147);r.prototype=o.prototype,n.prototype=new r,n.prototype.constructor=n,i(n.prototype,o.prototype),n.prototype.isPureReactComponent=!0,t.exports=n},{147:147,162:162,31:31,72:72}],79:[function(e,t){function n(e){this.reinitializeTransaction(),this.renderToStaticMarkup=!1,this.reactMountReady=i.getPooled(null),this.useCreateElement=e}var r=e(162),i=e(5),o=e(25),a=e(27),s=e(64),u=(e(66),e(106)),c=e(87),l={initialize:s.getSelectionInformation,close:s.restoreSelection},h={initialize:function(){var e=a.isEnabled();return a.setEnabled(!1),e},close:function(e){a.setEnabled(e)}},f={initialize:function(){this.reactMountReady.reset()},close:function(){this.reactMountReady.notifyAll()}},p=[l,h,f],d={getTransactionWrappers:function(){return p},getReactMountReady:function(){return this.reactMountReady},getUpdateQueue:function(){return c},checkpoint:function(){return this.reactMountReady.checkpoint()},rollback:function(e){this.reactMountReady.rollback(e)},destructor:function(){i.release(this.reactMountReady),this.reactMountReady=null}};r(n.prototype,u.Mixin,d),o.addPoolingTo(n),t.exports=n},{106:106,162:162,25:25,27:27,5:5,64:64,66:66,87:87}],80:[function(e,t){function n(){r.attachRefs(this,this._currentElement)}var r=e(81),i=(e(66),e(161),{mountComponent:function(e,t,r,i,o,a){var s=e.mountComponent(t,r,i,o,a);return e._currentElement&&null!=e._currentElement.ref&&t.getReactMountReady().enqueue(n,e),s},getHostNode:function(e){return e.getHostNode()},unmountComponent:function(e,t){r.detachRefs(e,e._currentElement),e.unmountComponent(t)},receiveComponent:function(e,t,i,o){var a=e._currentElement;if(t!==a||o!==e._context){var s=r.shouldUpdateRefs(a,t);s&&r.detachRefs(e,a),e.receiveComponent(t,i,o),s&&e._currentElement&&null!=e._currentElement.ref&&i.getReactMountReady().enqueue(n,e)}},performUpdateIfNecessary:function(e,t,n){e._updateBatchNumber===n&&e.performUpdateIfNecessary(t)}});t.exports=i},{161:161,66:66,81:81}],81:[function(e,t){function n(e,t,n){"function"==typeof e?e(t.getPublicInstance()):i.addComponentAsRefTo(t,e,n)}function r(e,t,n){"function"==typeof e?e(null):i.removeComponentAsRefFrom(t,e,n)}var i=e(73),o={};o.attachRefs=function(e,t){if(null!==t&&t!==!1){var r=t.ref;null!=r&&n(r,e,t._owner)}},o.shouldUpdateRefs=function(e,t){var n=null===e||e===!1,r=null===t||t===!1;return n||r||t.ref!==e.ref||"string"==typeof t.ref&&t._owner!==e._owner},o.detachRefs=function(e,t){if(null!==t&&t!==!1){var n=t.ref;null!=n&&r(n,e,t._owner)}},t.exports=o},{73:73}],82:[function(e,t){var n={isBatchingUpdates:!1,batchedUpdates:function(){}};t.exports=n},{}],83:[function(e,t){function n(e,t){var n;try{return p.injection.injectBatchingStrategy(h),n=f.getPooled(t),v++,n.perform(function(){var r=m(e,!0),i=l.mountComponent(r,n,null,a(),d,0);return t||(i=c.addChecksumToMarkup(i)),i},null)}finally{v--,f.release(n),v||p.injection.injectBatchingStrategy(s)}}function r(e){return u.isValidElement(e)?void 0:o("46"),n(e,!1)}function i(e){return u.isValidElement(e)?void 0:o("47"),n(e,!0)}var o=e(132),a=e(41),s=e(54),u=e(56),c=(e(66),e(67)),l=e(80),h=e(82),f=e(84),p=e(88),d=e(147),m=e(127),v=(e(154),0);t.exports={renderToString:r,renderToStaticMarkup:i}},{127:127,132:132,147:147,154:154,41:41,54:54,56:56,66:66,67:67,80:80,82:82,84:84,88:88}],84:[function(e,t){function n(e){this.reinitializeTransaction(),this.renderToStaticMarkup=e,this.useCreateElement=!1,this.updateQueue=new a(this)}var r=e(162),i=e(25),o=e(106),a=(e(66),e(85)),s=[],u={enqueue:function(){}},c={getTransactionWrappers:function(){return s},getReactMountReady:function(){return u},getUpdateQueue:function(){return this.updateQueue},destructor:function(){},checkpoint:function(){},rollback:function(){}};r(n.prototype,o.Mixin,c),i.addPoolingTo(n),t.exports=n},{106:106,162:162,25:25,66:66,85:85}],85:[function(e,t){function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(){}var i=e(87),o=(e(106),e(161),function(){function e(t){n(this,e),this.transaction=t}return e.prototype.isMounted=function(){return!1},e.prototype.enqueueCallback=function(e,t,n){this.transaction.isInTransaction()&&i.enqueueCallback(e,t,n)},e.prototype.enqueueForceUpdate=function(e){this.transaction.isInTransaction()?i.enqueueForceUpdate(e):r(e,"forceUpdate")},e.prototype.enqueueReplaceState=function(e,t){this.transaction.isInTransaction()?i.enqueueReplaceState(e,t):r(e,"replaceState")},e.prototype.enqueueSetState=function(e,t){this.transaction.isInTransaction()?i.enqueueSetState(e,t):r(e,"setState")},e}());t.exports=o},{106:106,161:161,87:87}],86:[function(e,t){var n=e(162),r=e(36),i=e(50),o=e(26),a=n({__SECRET_DOM_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:r,__SECRET_DOM_SERVER_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:i},o);t.exports=a},{162:162,26:26,36:36,50:50}],87:[function(e,t){function n(e){s.enqueueUpdate(e)}function r(e){var t=typeof e;if("object"!==t)return t;var n=e.constructor&&e.constructor.name||t,r=Object.keys(e);return r.length>0&&r.length<20?n+" (keys: "+r.join(", ")+")":n}function i(e){var t=a.get(e);return t?t:null}var o=e(132),a=(e(35),e(65)),s=(e(66),e(88)),u=(e(154),e(161),{isMounted:function(e){var t=a.get(e);return!!t&&!!t._renderedComponent},enqueueCallback:function(e,t,r){u.validateCallback(t,r);var o=i(e);return o?(o._pendingCallbacks?o._pendingCallbacks.push(t):o._pendingCallbacks=[t],void n(o)):null},enqueueCallbackInternal:function(e,t){e._pendingCallbacks?e._pendingCallbacks.push(t):e._pendingCallbacks=[t],n(e)},enqueueForceUpdate:function(e){var t=i(e,"forceUpdate");t&&(t._pendingForceUpdate=!0,n(t))},enqueueReplaceState:function(e,t){var r=i(e,"replaceState");r&&(r._pendingStateQueue=[t],r._pendingReplaceState=!0,n(r))},enqueueSetState:function(e,t){var r=i(e,"setState");if(r){var o=r._pendingStateQueue||(r._pendingStateQueue=[]);o.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,r(e)):void 0}});t.exports=u},{132:132,154:154,161:161,35:35,65:65,66:66,88:88}],88:[function(e,t){function n(){M.ReactReconcileTransaction&&x?void 0:c("123")}function r(){this.reinitializeTransaction(),this.dirtyComponentsLength=null,this.callbackQueue=h.getPooled(),this.reconcileTransaction=M.ReactReconcileTransaction.getPooled(!0)}function i(e,t,r,i,o,a){n(),x.batchedUpdates(e,t,r,i,o,a)}function o(e,t){return e._mountOrder-t._mountOrder}function a(e){var t=e.dirtyComponentsLength;t!==v.length?c("124",t,v.length):void 0,v.sort(o),g++;for(var n=0;t>n;n++){var r=v[n],i=r._pendingCallbacks;r._pendingCallbacks=null;var a;if(p.logTopLevelRenders){var s=r;r._currentElement.props===r._renderedComponent._currentElement&&(s=r._renderedComponent),a="React update: "+s.getName(),console.time(a)}if(d.performUpdateIfNecessary(r,e.reconcileTransaction,g),a&&console.timeEnd(a),i)for(var u=0;u<i.length;u++)e.callbackQueue.enqueue(i[u],r.getPublicInstance())}}function s(e){return n(),x.isBatchingUpdates?(v.push(e),void(null==e._updateBatchNumber&&(e._updateBatchNumber=g+1))):void x.batchedUpdates(s,e)}function u(e,t){x.isBatchingUpdates?void 0:c("125"),y.enqueue(e,t),b=!0}var c=e(132),l=e(162),h=e(5),f=e(25),p=e(61),d=e(80),m=e(106),v=(e(154),[]),g=0,y=h.getPooled(),b=!1,x=null,w={initialize:function(){this.dirtyComponentsLength=v.length},close:function(){this.dirtyComponentsLength!==v.length?(v.splice(0,this.dirtyComponentsLength),E()):v.length=0}},_={initialize:function(){this.callbackQueue.reset()},close:function(){this.callbackQueue.notifyAll()}},C=[w,_];l(r.prototype,m.Mixin,{getTransactionWrappers:function(){return C},destructor:function(){this.dirtyComponentsLength=null,h.release(this.callbackQueue),this.callbackQueue=null,M.ReactReconcileTransaction.release(this.reconcileTransaction),this.reconcileTransaction=null},perform:function(e,t,n){return m.Mixin.perform.call(this,this.reconcileTransaction.perform,this.reconcileTransaction,e,t,n)}}),f.addPoolingTo(r);var E=function(){for(;v.length||b;){if(v.length){var e=r.getPooled();e.perform(a,null,e),r.release(e)}if(b){b=!1;var t=y;y=h.getPooled(),t.notifyAll(),h.release(t)}}},S={injectReconcileTransaction:function(e){e?void 0:c("126"),M.ReactReconcileTransaction=e},injectBatchingStrategy:function(e){e?void 0:c("127"),"function"!=typeof e.batchedUpdates?c("128"):void 0,"boolean"!=typeof e.isBatchingUpdates?c("129"):void 0,x=e}},M={ReactReconcileTransaction:null,batchedUpdates:i,enqueueUpdate:s,flushBatchedUpdates:E,injection:S,asap:u};t.exports=M},{106:106,132:132,154:154,162:162,25:25,5:5,61:61,80:80}],89:[function(e,t){t.exports="15.3.1"},{}],90:[function(e,t){var n={xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace"},r={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-adv-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"},i={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(r).forEach(function(e){i.Properties[e]=0,r[e]&&(i.DOMAttributeNames[e]=r[e])}),t.exports=i},{}],91:[function(e,t){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 n=document.selection.createRange();return{parentElement:n.parentElement(),text:n.text,top:n.boundingTop,left:n.boundingLeft}}}function r(e,t){if(x||null==g||g!==l())return null;var r=n(g);if(!b||!p(b,r)){b=r;var i=c.getPooled(v.select,y,e,t);return i.type="select",i.target=g,o.accumulateTwoPhaseDispatches(i),i}return null}var i=e(16),o=e(20),a=e(140),s=e(40),u=e(64),c=e(97),l=e(149),h=e(129),f=e(158),p=e(160),d=i.topLevelTypes,m=a.canUseDOM&&"documentMode"in document&&document.documentMode<=11,v={select:{phasedRegistrationNames:{bubbled:f({onSelect:null}),captured:f({onSelectCapture:null})},dependencies:[d.topBlur,d.topContextMenu,d.topFocus,d.topKeyDown,d.topMouseDown,d.topMouseUp,d.topSelectionChange]}},g=null,y=null,b=null,x=!1,w=!1,_=f({onSelect:null}),C={eventTypes:v,extractEvents:function(e,t,n,i){if(!w)return null;var o=t?s.getNodeFromInstance(t):window;switch(e){case d.topFocus:(h(o)||"true"===o.contentEditable)&&(g=o,y=t,b=null);break;case d.topBlur:g=null,y=null,b=null;break;case d.topMouseDown:x=!0;break;case d.topContextMenu:case d.topMouseUp:return x=!1,r(n,i);case d.topSelectionChange:if(m)break;case d.topKeyDown:case d.topKeyUp:return r(n,i)}return null},didPutListener:function(e,t){t===_&&(w=!0)}};t.exports=C},{129:129,140:140,149:149,158:158,16:16,160:160,20:20,40:40,64:64,97:97}],92:[function(e,t){function n(e){return"."+e._rootNodeID}var r=e(132),i=e(16),o=e(139),a=e(20),s=e(40),u=e(93),c=e(94),l=e(97),h=e(98),f=e(100),p=e(101),d=e(96),m=e(102),v=e(103),g=e(104),y=e(105),b=e(146),x=e(118),w=(e(154),e(158)),_=i.topLevelTypes,C={abort:{phasedRegistrationNames:{bubbled:w({onAbort:!0}),captured:w({onAbortCapture:!0})}},animationEnd:{phasedRegistrationNames:{bubbled:w({onAnimationEnd:!0}),captured:w({onAnimationEndCapture:!0})}},animationIteration:{phasedRegistrationNames:{bubbled:w({onAnimationIteration:!0}),captured:w({onAnimationIterationCapture:!0})}},animationStart:{phasedRegistrationNames:{bubbled:w({onAnimationStart:!0}),captured:w({onAnimationStartCapture:!0})}},blur:{phasedRegistrationNames:{bubbled:w({onBlur:!0}),captured:w({onBlurCapture:!0})}},canPlay:{phasedRegistrationNames:{bubbled:w({onCanPlay:!0}),captured:w({onCanPlayCapture:!0})}},canPlayThrough:{phasedRegistrationNames:{bubbled:w({onCanPlayThrough:!0}),captured:w({onCanPlayThroughCapture:!0})}},click:{phasedRegistrationNames:{bubbled:w({onClick:!0}),captured:w({onClickCapture:!0})}},contextMenu:{phasedRegistrationNames:{bubbled:w({onContextMenu:!0}),captured:w({onContextMenuCapture:!0})}},copy:{phasedRegistrationNames:{bubbled:w({onCopy:!0}),captured:w({onCopyCapture:!0})}},cut:{phasedRegistrationNames:{bubbled:w({onCut:!0}),captured:w({onCutCapture:!0})}},doubleClick:{phasedRegistrationNames:{bubbled:w({onDoubleClick:!0}),captured:w({onDoubleClickCapture:!0})}},drag:{phasedRegistrationNames:{bubbled:w({onDrag:!0}),captured:w({onDragCapture:!0})}},dragEnd:{phasedRegistrationNames:{bubbled:w({onDragEnd:!0}),captured:w({onDragEndCapture:!0})}},dragEnter:{phasedRegistrationNames:{bubbled:w({onDragEnter:!0}),captured:w({onDragEnterCapture:!0})}},dragExit:{phasedRegistrationNames:{bubbled:w({onDragExit:!0}),captured:w({onDragExitCapture:!0})}},dragLeave:{phasedRegistrationNames:{bubbled:w({onDragLeave:!0}),captured:w({onDragLeaveCapture:!0})}},dragOver:{phasedRegistrationNames:{bubbled:w({onDragOver:!0}),captured:w({onDragOverCapture:!0})}},dragStart:{phasedRegistrationNames:{bubbled:w({onDragStart:!0}),captured:w({onDragStartCapture:!0})}},drop:{phasedRegistrationNames:{bubbled:w({onDrop:!0}),captured:w({onDropCapture:!0})}},durationChange:{phasedRegistrationNames:{bubbled:w({onDurationChange:!0}),captured:w({onDurationChangeCapture:!0})}},emptied:{phasedRegistrationNames:{bubbled:w({onEmptied:!0}),captured:w({onEmptiedCapture:!0})}},encrypted:{phasedRegistrationNames:{bubbled:w({onEncrypted:!0}),captured:w({onEncryptedCapture:!0})}},ended:{phasedRegistrationNames:{bubbled:w({onEnded:!0}),captured:w({onEndedCapture:!0})}},error:{phasedRegistrationNames:{bubbled:w({onError:!0}),captured:w({onErrorCapture:!0})}},focus:{phasedRegistrationNames:{bubbled:w({onFocus:!0}),captured:w({onFocusCapture:!0})}},input:{phasedRegistrationNames:{bubbled:w({onInput:!0}),captured:w({onInputCapture:!0})}},invalid:{phasedRegistrationNames:{bubbled:w({onInvalid:!0}),captured:w({onInvalidCapture:!0})}},keyDown:{phasedRegistrationNames:{bubbled:w({onKeyDown:!0}),captured:w({onKeyDownCapture:!0})}},keyPress:{phasedRegistrationNames:{bubbled:w({onKeyPress:!0}),captured:w({onKeyPressCapture:!0})}},keyUp:{phasedRegistrationNames:{bubbled:w({onKeyUp:!0}),captured:w({onKeyUpCapture:!0})}},load:{phasedRegistrationNames:{bubbled:w({onLoad:!0}),captured:w({onLoadCapture:!0})}},loadedData:{phasedRegistrationNames:{bubbled:w({onLoadedData:!0}),captured:w({onLoadedDataCapture:!0})}},loadedMetadata:{phasedRegistrationNames:{bubbled:w({onLoadedMetadata:!0}),captured:w({onLoadedMetadataCapture:!0})}},loadStart:{phasedRegistrationNames:{bubbled:w({onLoadStart:!0}),captured:w({onLoadStartCapture:!0})}},mouseDown:{phasedRegistrationNames:{bubbled:w({onMouseDown:!0}),captured:w({onMouseDownCapture:!0})}},mouseMove:{phasedRegistrationNames:{bubbled:w({onMouseMove:!0}),captured:w({onMouseMoveCapture:!0})}},mouseOut:{phasedRegistrationNames:{bubbled:w({onMouseOut:!0}),captured:w({onMouseOutCapture:!0})}},mouseOver:{phasedRegistrationNames:{bubbled:w({onMouseOver:!0}),captured:w({onMouseOverCapture:!0})}},mouseUp:{phasedRegistrationNames:{bubbled:w({onMouseUp:!0}),captured:w({onMouseUpCapture:!0})}},paste:{phasedRegistrationNames:{bubbled:w({onPaste:!0}),captured:w({onPasteCapture:!0})}},pause:{phasedRegistrationNames:{bubbled:w({onPause:!0}),captured:w({onPauseCapture:!0})}},play:{phasedRegistrationNames:{bubbled:w({onPlay:!0}),captured:w({onPlayCapture:!0})}},playing:{phasedRegistrationNames:{bubbled:w({onPlaying:!0}),captured:w({onPlayingCapture:!0})}},progress:{phasedRegistrationNames:{bubbled:w({onProgress:!0}),captured:w({onProgressCapture:!0})}},rateChange:{phasedRegistrationNames:{bubbled:w({onRateChange:!0}),captured:w({onRateChangeCapture:!0})}},reset:{phasedRegistrationNames:{bubbled:w({onReset:!0}),captured:w({onResetCapture:!0})}},scroll:{phasedRegistrationNames:{bubbled:w({onScroll:!0}),captured:w({onScrollCapture:!0})}},seeked:{phasedRegistrationNames:{bubbled:w({onSeeked:!0}),captured:w({onSeekedCapture:!0})}},seeking:{phasedRegistrationNames:{bubbled:w({onSeeking:!0}),captured:w({onSeekingCapture:!0})}},stalled:{phasedRegistrationNames:{bubbled:w({onStalled:!0}),captured:w({onStalledCapture:!0})}},submit:{phasedRegistrationNames:{bubbled:w({onSubmit:!0}),captured:w({onSubmitCapture:!0})}},suspend:{phasedRegistrationNames:{bubbled:w({onSuspend:!0}),captured:w({onSuspendCapture:!0})}},timeUpdate:{phasedRegistrationNames:{bubbled:w({onTimeUpdate:!0}),captured:w({onTimeUpdateCapture:!0})}},touchCancel:{phasedRegistrationNames:{bubbled:w({onTouchCancel:!0}),captured:w({onTouchCancelCapture:!0})}},touchEnd:{phasedRegistrationNames:{bubbled:w({onTouchEnd:!0}),captured:w({onTouchEndCapture:!0})}},touchMove:{phasedRegistrationNames:{bubbled:w({onTouchMove:!0}),captured:w({onTouchMoveCapture:!0})}},touchStart:{phasedRegistrationNames:{bubbled:w({onTouchStart:!0}),captured:w({onTouchStartCapture:!0})}},transitionEnd:{phasedRegistrationNames:{bubbled:w({onTransitionEnd:!0}),captured:w({onTransitionEndCapture:!0})}},volumeChange:{phasedRegistrationNames:{bubbled:w({onVolumeChange:!0}),captured:w({onVolumeChangeCapture:!0})}},waiting:{phasedRegistrationNames:{bubbled:w({onWaiting:!0}),captured:w({onWaitingCapture:!0})}},wheel:{phasedRegistrationNames:{bubbled:w({onWheel:!0}),captured:w({onWheelCapture:!0})}}},E={topAbort:C.abort,topAnimationEnd:C.animationEnd,topAnimationIteration:C.animationIteration,topAnimationStart:C.animationStart,topBlur:C.blur,topCanPlay:C.canPlay,topCanPlayThrough:C.canPlayThrough,topClick:C.click,topContextMenu:C.contextMenu,topCopy:C.copy,topCut:C.cut,topDoubleClick:C.doubleClick,topDrag:C.drag,topDragEnd:C.dragEnd,topDragEnter:C.dragEnter,topDragExit:C.dragExit,topDragLeave:C.dragLeave,topDragOver:C.dragOver,topDragStart:C.dragStart,topDrop:C.drop,topDurationChange:C.durationChange,topEmptied:C.emptied,topEncrypted:C.encrypted,topEnded:C.ended,topError:C.error,topFocus:C.focus,topInput:C.input,topInvalid:C.invalid,topKeyDown:C.keyDown,topKeyPress:C.keyPress,topKeyUp:C.keyUp,topLoad:C.load,topLoadedData:C.loadedData,topLoadedMetadata:C.loadedMetadata,topLoadStart:C.loadStart,topMouseDown:C.mouseDown,topMouseMove:C.mouseMove,topMouseOut:C.mouseOut,topMouseOver:C.mouseOver,topMouseUp:C.mouseUp,topPaste:C.paste,topPause:C.pause,topPlay:C.play,topPlaying:C.playing,topProgress:C.progress,topRateChange:C.rateChange,topReset:C.reset,topScroll:C.scroll,topSeeked:C.seeked,topSeeking:C.seeking,topStalled:C.stalled,topSubmit:C.submit,topSuspend:C.suspend,topTimeUpdate:C.timeUpdate,topTouchCancel:C.touchCancel,topTouchEnd:C.touchEnd,topTouchMove:C.touchMove,topTouchStart:C.touchStart,topTransitionEnd:C.transitionEnd,topVolumeChange:C.volumeChange,topWaiting:C.waiting,topWheel:C.wheel};for(var S in E)E[S].dependencies=[S];var M=w({onClick:null}),T={},A={eventTypes:C,extractEvents:function(e,t,n,i){var o=E[e];if(!o)return null;var s;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:s=l;break;case _.topKeyPress:if(0===x(n))return null;case _.topKeyDown:case _.topKeyUp:s=f;break;case _.topBlur:case _.topFocus:s=h;break;case _.topClick:if(2===n.button)return null;case _.topContextMenu:case _.topDoubleClick:case _.topMouseDown:case _.topMouseMove:case _.topMouseOut:case _.topMouseOver:case _.topMouseUp:s=p;break;case _.topDrag:case _.topDragEnd:case _.topDragEnter:case _.topDragExit:case _.topDragLeave:case _.topDragOver:case _.topDragStart:case _.topDrop:s=d;break;case _.topTouchCancel:case _.topTouchEnd:case _.topTouchMove:case _.topTouchStart:s=m;break;case _.topAnimationEnd:case _.topAnimationIteration:case _.topAnimationStart:s=u;break;case _.topTransitionEnd:s=v;break;case _.topScroll:s=g;break;case _.topWheel:s=y;break;case _.topCopy:case _.topCut:case _.topPaste:s=c}s?void 0:r("86",e);var b=s.getPooled(o,t,n,i);return a.accumulateTwoPhaseDispatches(b),b},didPutListener:function(e,t){if(t===M){var r=n(e),i=s.getNodeFromInstance(e);T[r]||(T[r]=o.listen(i,"click",b))}},willDeleteListener:function(e,t){if(t===M){var r=n(e);T[r].remove(),delete T[r]}}};t.exports=A},{100:100,101:101,102:102,103:103,104:104,105:105,118:118,132:132,139:139,146:146,154:154,158:158,16:16,20:20,40:40,93:93,94:94,96:96,97:97,98:98}],93:[function(e,t){function n(e,t,n,i){return r.call(this,e,t,n,i)
}var r=e(97),i={animationName:null,elapsedTime:null,pseudoElement:null};r.augmentClass(n,i),t.exports=n},{97:97}],94:[function(e,t){function n(e,t,n,i){return r.call(this,e,t,n,i)}var r=e(97),i={clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}};r.augmentClass(n,i),t.exports=n},{97:97}],95:[function(e,t){function n(e,t,n,i){return r.call(this,e,t,n,i)}var r=e(97),i={data:null};r.augmentClass(n,i),t.exports=n},{97:97}],96:[function(e,t){function n(e,t,n,i){return r.call(this,e,t,n,i)}var r=e(101),i={dataTransfer:null};r.augmentClass(n,i),t.exports=n},{101:101}],97:[function(e,t){function n(e,t,n,r){this.dispatchConfig=e,this._targetInst=t,this.nativeEvent=n;var i=this.constructor.Interface;for(var a in i)if(i.hasOwnProperty(a)){var s=i[a];s?this[a]=s(n):"target"===a?this.target=r:this[a]=n[a]}var u=null!=n.defaultPrevented?n.defaultPrevented:n.returnValue===!1;return this.isDefaultPrevented=u?o.thatReturnsTrue:o.thatReturnsFalse,this.isPropagationStopped=o.thatReturnsFalse,this}var r=e(162),i=e(25),o=e(146),a=(e(161),["dispatchConfig","_targetInst","nativeEvent","isDefaultPrevented","isPropagationStopped","_dispatchListeners","_dispatchInstances"]),s={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};r(n.prototype,{preventDefault:function(){this.defaultPrevented=!0;var e=this.nativeEvent;e&&(e.preventDefault?e.preventDefault():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 n=0;n<a.length;n++)this[a[n]]=null}}),n.Interface=s,n.augmentClass=function(e,t){var n=this,o=function(){};o.prototype=n.prototype;var a=new o;r(a,e.prototype),e.prototype=a,e.prototype.constructor=e,e.Interface=r({},n.Interface,t),e.augmentClass=n.augmentClass,i.addPoolingTo(e,i.fourArgumentPooler)},i.addPoolingTo(n,i.fourArgumentPooler),t.exports=n},{146:146,161:161,162:162,25:25}],98:[function(e,t){function n(e,t,n,i){return r.call(this,e,t,n,i)}var r=e(104),i={relatedTarget:null};r.augmentClass(n,i),t.exports=n},{104:104}],99:[function(e,t){function n(e,t,n,i){return r.call(this,e,t,n,i)}var r=e(97),i={data:null};r.augmentClass(n,i),t.exports=n},{97:97}],100:[function(e,t){function n(e,t,n,i){return r.call(this,e,t,n,i)}var r=e(104),i=e(118),o=e(119),a=e(120),s={key:o,location:null,ctrlKey:null,shiftKey:null,altKey:null,metaKey:null,repeat:null,locale:null,getModifierState:a,charCode:function(e){return"keypress"===e.type?i(e):0},keyCode:function(e){return"keydown"===e.type||"keyup"===e.type?e.keyCode:0},which:function(e){return"keypress"===e.type?i(e):"keydown"===e.type||"keyup"===e.type?e.keyCode:0}};r.augmentClass(n,s),t.exports=n},{104:104,118:118,119:119,120:120}],101:[function(e,t){function n(e,t,n,i){return r.call(this,e,t,n,i)}var r=e(104),i=e(107),o=e(120),a={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+i.currentScrollLeft},pageY:function(e){return"pageY"in e?e.pageY:e.clientY+i.currentScrollTop}};r.augmentClass(n,a),t.exports=n},{104:104,107:107,120:120}],102:[function(e,t){function n(e,t,n,i){return r.call(this,e,t,n,i)}var r=e(104),i=e(120),o={touches:null,targetTouches:null,changedTouches:null,altKey:null,metaKey:null,ctrlKey:null,shiftKey:null,getModifierState:i};r.augmentClass(n,o),t.exports=n},{104:104,120:120}],103:[function(e,t){function n(e,t,n,i){return r.call(this,e,t,n,i)}var r=e(97),i={propertyName:null,elapsedTime:null,pseudoElement:null};r.augmentClass(n,i),t.exports=n},{97:97}],104:[function(e,t){function n(e,t,n,i){return r.call(this,e,t,n,i)}var r=e(97),i=e(121),o={view:function(e){if(e.view)return e.view;var t=i(e);if(t.window===t)return t;var n=t.ownerDocument;return n?n.defaultView||n.parentWindow:window},detail:function(e){return e.detail||0}};r.augmentClass(n,o),t.exports=n},{121:121,97:97}],105:[function(e,t){function n(e,t,n,i){return r.call(this,e,t,n,i)}var r=e(101),i={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};r.augmentClass(n,i),t.exports=n},{101:101}],106:[function(e,t){var n=e(132),r=(e(154),{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,o,a,s,u){this.isInTransaction()?n("27"):void 0;var c,l;try{this._isInTransaction=!0,c=!0,this.initializeAll(0),l=e.call(t,r,i,o,a,s,u),c=!1}finally{try{if(c)try{this.closeAll(0)}catch(e){}else this.closeAll(0)}finally{this._isInTransaction=!1}}return l},initializeAll:function(e){for(var t=this.transactionWrappers,n=e;n<t.length;n++){var r=t[n];try{this.wrapperInitData[n]=i.OBSERVED_ERROR,this.wrapperInitData[n]=r.initialize?r.initialize.call(this):null}finally{if(this.wrapperInitData[n]===i.OBSERVED_ERROR)try{this.initializeAll(n+1)}catch(e){}}}},closeAll:function(e){this.isInTransaction()?void 0:n("28");for(var t=this.transactionWrappers,r=e;r<t.length;r++){var o,a=t[r],s=this.wrapperInitData[r];try{o=!0,s!==i.OBSERVED_ERROR&&a.close&&a.close.call(this,s),o=!1}finally{if(o)try{this.closeAll(r+1)}catch(e){}}}this.wrapperInitData.length=0}}),i={Mixin:r,OBSERVED_ERROR:{}};t.exports=i},{132:132,154:154}],107:[function(e,t){var n={currentScrollLeft:0,currentScrollTop:0,refreshScrollValues:function(e){n.currentScrollLeft=e.x,n.currentScrollTop=e.y}};t.exports=n},{}],108:[function(e,t){function n(e,t){return null==t?r("30"):void 0,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 r=e(132);e(154),t.exports=n},{132:132,154:154}],109:[function(e,t){function n(e){for(var t=1,n=0,i=0,o=e.length,a=-4&o;a>i;){for(var s=Math.min(i+4096,a);s>i;i+=4)n+=(t+=e.charCodeAt(i))+(t+=e.charCodeAt(i+1))+(t+=e.charCodeAt(i+2))+(t+=e.charCodeAt(i+3));t%=r,n%=r}for(;o>i;i++)n+=t+=e.charCodeAt(i);return t%=r,n%=r,t|n<<16}var r=65521;t.exports=n},{}],110:[function(e,t){var n=!1;t.exports=n},{}],111:[function(e,t){(function(n){function r(e,t,n,r){for(var u in e)if(e.hasOwnProperty(u)){var c;try{"function"!=typeof e[u]?i("84",r||"React class",o[n],u):void 0,c=e[u](t,u,r,n,null,a)}catch(e){c=e}c instanceof Error&&!(c.message in s)&&(s[c.message]=!0)}}var i=e(132),o=e(74),a=e(77);e(154),e(161),"undefined"!=typeof n&&n.env,1;var s={};t.exports=r}).call(this,void 0)},{132:132,154:154,161:161,74:74,77:77}],112:[function(e,t){var n=function(e){return"undefined"!=typeof MSApp&&MSApp.execUnsafeLocalFunction?function(t,n,r,i){MSApp.execUnsafeLocalFunction(function(){return e(t,n,r,i)})}:e};t.exports=n},{}],113:[function(e,t){function n(e,t){var n=null==t||"boolean"==typeof t||""===t;if(n)return"";var r=isNaN(t);return r||0===t||i.hasOwnProperty(e)&&i[e]?""+t:("string"==typeof t&&(t=t.trim()),t+"px")}var r=e(3),i=(e(161),r.isUnitlessNumber);t.exports=n},{161:161,3:3}],114:[function(e,t){function n(e){var t=""+e,n=i.exec(t);if(!n)return t;var r,o="",a=0,s=0;for(a=n.index;a<t.length;a++){switch(t.charCodeAt(a)){case 34:r=""";break;case 38:r="&";break;case 39:r="'";break;case 60:r="<";break;case 62:r=">";break;default:continue}s!==a&&(o+=t.substring(s,a)),s=a+1,o+=r}return s!==a?o+t.substring(s,a):o}function r(e){return"boolean"==typeof e||"number"==typeof e?""+e:n(e)}var i=/["'&<>]/;t.exports=r},{}],115:[function(e,t){function n(e){if(null==e)return null;if(1===e.nodeType)return e;var t=o.get(e);return t?(t=a(t),t?i.getNodeFromInstance(t):null):void("function"==typeof e.render?r("44"):r("45",Object.keys(e)))}var r=e(132),i=(e(35),e(40)),o=e(65),a=e(122);e(154),e(161),t.exports=n},{122:122,132:132,154:154,161:161,35:35,40:40,65:65}],116:[function(e,t){(function(n){function r(e,t,n){if(e&&"object"==typeof e){var r=e,i=void 0===r[n];i&&null!=t&&(r[n]=t)}}function i(e){if(null==e)return e;var t={};return o(e,r,t),t}var o=(e(23),e(137));e(161),"undefined"!=typeof n&&n.env,t.exports=i}).call(this,void 0)},{137:137,161:161,23:23}],117:[function(e,t){function n(e,t,n){Array.isArray(e)?e.forEach(t,n):e&&t.call(n,e)}t.exports=n},{}],118:[function(e,t){function n(e){var t,n=e.keyCode;return"charCode"in e?(t=e.charCode,0===t&&13===n&&(t=13)):t=n,t>=32||13===t?t:0}t.exports=n},{}],119:[function(e,t){function n(e){if(e.key){var t=i[e.key]||e.key;if("Unidentified"!==t)return t}if("keypress"===e.type){var n=r(e);return 13===n?"Enter":String.fromCharCode(n)}return"keydown"===e.type||"keyup"===e.type?o[e.keyCode]||"Unidentified":""}var r=e(118),i={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},{118:118}],120:[function(e,t){function n(e){var t=this,n=t.nativeEvent;if(n.getModifierState)return n.getModifierState(e);var r=i[e];return!!r&&!!n[r]}function r(){return n}var i={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};t.exports=r},{}],121:[function(e,t){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},{}],122:[function(e,t){function n(e){for(var t;(t=e._renderedNodeType)===r.COMPOSITE;)e=e._renderedComponent;return t===r.HOST?e._renderedComponent:t===r.EMPTY?null:void 0}var r=e(71);t.exports=n},{71:71}],123:[function(e,t){function n(e){var t=e&&(r&&e[r]||e[i]);return"function"==typeof t?t:void 0}var r="function"==typeof Symbol&&Symbol.iterator,i="@@iterator";t.exports=n},{}],124:[function(e,t){function n(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function r(e){for(;e;){if(e.nextSibling)return e.nextSibling;e=e.parentNode}}function i(e,t){for(var i=n(e),o=0,a=0;i;){if(3===i.nodeType){if(a=o+i.textContent.length,t>=o&&a>=t)return{node:i,offset:t-o};o=a}i=n(r(i))}}t.exports=i},{}],125:[function(e,t){function n(){return!i&&r.canUseDOM&&(i="textContent"in document.documentElement?"textContent":"innerText"),i}var r=e(140),i=null;t.exports=n},{140:140}],126:[function(e,t){function n(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n["ms"+e]="MS"+t,n["O"+e]="o"+t.toLowerCase(),n}function r(e){if(a[e])return a[e];if(!o[e])return e;var t=o[e];for(var n in t)if(t.hasOwnProperty(n)&&n in s)return a[e]=t[n];return""}var i=e(140),o={animationend:n("Animation","AnimationEnd"),animationiteration:n("Animation","AnimationIteration"),animationstart:n("Animation","AnimationStart"),transitionend:n("Transition","TransitionEnd")},a={},s={};i.canUseDOM&&(s=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=r},{140:140}],127:[function(e,t){function n(e){if(e){var t=e.getName();if(t)return" Check the render method of `"+t+"`."}return""}function r(e){return"function"==typeof e&&"undefined"!=typeof e.prototype&&"function"==typeof e.prototype.mountComponent&&"function"==typeof e.prototype.receiveComponent}function i(e){var t;if(null===e||e===!1)t=u.create(i);else if("object"==typeof e){var a=e;!a||"function"!=typeof a.type&&"string"!=typeof a.type?o("130",null==a.type?a.type:typeof a.type,n(a._owner)):void 0,"string"==typeof a.type?t=c.createInternalComponent(a):r(a.type)?(t=new a.type(a),t.getHostNode||(t.getHostNode=t.getNativeNode)):t=new l(a)}else"string"==typeof e||"number"==typeof e?t=c.createInstanceForText(e):o("131",typeof e);return t._mountIndex=0,t._mountImage=null,t}var o=e(132),a=e(162),s=e(34),u=e(57),c=e(62),l=(e(154),e(161),function(e){this.construct(e)});a(l.prototype,s.Mixin,{_instantiateReactComponent:i}),t.exports=i},{132:132,154:154,161:161,162:162,34:34,57:57,62:62}],128:[function(e,t){function n(e,t){if(!i.canUseDOM||t&&!("addEventListener"in document))return!1;var n="on"+e,o=n in document;if(!o){var a=document.createElement("div");a.setAttribute(n,"return;"),o="function"==typeof a[n]}return!o&&r&&"wheel"===e&&(o=document.implementation.hasFeature("Events.wheel","3.0")),o}var r,i=e(140);i.canUseDOM&&(r=document.implementation&&document.implementation.hasFeature&&document.implementation.hasFeature("","")!==!0),t.exports=n},{140:140}],129:[function(e,t){function n(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return"input"===t?!!r[e.type]:"textarea"===t}var r={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},{}],130:[function(e,t){function n(e){return i.isValidElement(e)?void 0:r("143"),e}var r=e(132),i=e(56);e(154),t.exports=n},{132:132,154:154,56:56}],131:[function(e,t){function n(e){return'"'+r(e)+'"'}var r=e(114);t.exports=n},{114:114}],132:[function(e,t){function n(e){for(var t=arguments.length-1,n="Minified React error #"+e+"; visit http://facebook.github.io/react/docs/error-decoder.html?invariant="+e,r=0;t>r;r++)n+="&args[]="+encodeURIComponent(arguments[r+1]);n+=" for the full message or use the non-minified dev environment for full errors and additional helpful warnings.";var i=new Error(n);throw i.name="Invariant Violation",i.framesToPop=1,i}t.exports=n},{}],133:[function(e,t){var n=e(68);t.exports=n.renderSubtreeIntoContainer},{68:68}],134:[function(e,t){var n,r=e(140),i=e(9),o=/^[ \r\n\t\f]/,a=/<(!--|link|noscript|meta|script|style)[ \r\n\t\f\/>]/,s=e(112),u=s(function(e,t){if(e.namespaceURI!==i.svg||"innerHTML"in e)e.innerHTML=t;else{n=n||document.createElement("div"),n.innerHTML="<svg>"+t+"</svg>";for(var r=n.firstChild.childNodes,o=0;o<r.length;o++)e.appendChild(r[o])}});if(r.canUseDOM){var c=document.createElement("div");c.innerHTML=" ",""===c.innerHTML&&(u=function(e,t){if(e.parentNode&&e.parentNode.replaceChild(e,e),o.test(t)||"<"===t[0]&&a.test(t)){e.innerHTML=String.fromCharCode(65279)+t;var n=e.firstChild;1===n.data.length?e.removeChild(n):n.deleteData(0,1)}else e.innerHTML=t}),c=null}t.exports=u},{112:112,140:140,9:9}],135:[function(e,t){var n=e(140),r=e(114),i=e(134),o=function(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&3===n.nodeType)return void(n.nodeValue=t)}e.textContent=t};n.canUseDOM&&("textContent"in document.documentElement||(o=function(e,t){i(e,r(t))})),t.exports=o},{114:114,134:134,140:140}],136:[function(e,t){function n(e,t){var n=null===e||e===!1,r=null===t||t===!1;if(n||r)return n===r;var i=typeof e,o=typeof t;return"string"===i||"number"===i?"string"===o||"number"===o:"object"===o&&e.type===t.type&&e.key===t.key}t.exports=n},{}],137:[function(e,t){function n(e,t){return e&&"object"==typeof e&&null!=e.key?u.escape(e.key):t.toString(36)}function r(e,t,i,h){var f=typeof e;if("undefined"!==f&&"boolean"!==f||(e=null),null===e||"string"===f||"number"===f||a.isValidElement(e))return i(h,e,""===t?c+n(e,0):t),1;var p,d,m=0,v=""===t?c:t+l;if(Array.isArray(e))for(var g=0;g<e.length;g++)p=e[g],d=v+n(p,g),m+=r(p,d,i,h);else{var y=s(e);if(y){var b,x=y.call(e);if(y!==e.entries)for(var w=0;!(b=x.next()).done;)p=b.value,d=v+n(p,w++),m+=r(p,d,i,h);else for(;!(b=x.next()).done;){var _=b.value;_&&(p=_[1],d=v+u.escape(_[0])+l+n(p,0),m+=r(p,d,i,h))}}else if("object"===f){var C="",E=String(e);o("31","[object Object]"===E?"object with keys {"+Object.keys(e).join(", ")+"}":E,C)}}return m}function i(e,t,n){return null==e?0:r(e,"",t,n)}var o=e(132),a=(e(35),e(56)),s=e(123),u=(e(154),e(23)),c=(e(161),"."),l=":";t.exports=i},{123:123,132:132,154:154,161:161,23:23,35:35,56:56}],138:[function(e,t){var n=(e(162),e(146)),r=(e(161),n);t.exports=r},{146:146,161:161,162:162}],139:[function(e,t){var n=e(146),r={listen:function(e,t,n){return e.addEventListener?(e.addEventListener(t,n,!1),{remove:function(){e.removeEventListener(t,n,!1)}}):e.attachEvent?(e.attachEvent("on"+t,n),{remove:function(){e.detachEvent("on"+t,n)}}):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=r},{146:146}],140:[function(e,t){var n=!("undefined"==typeof window||!window.document||!window.document.createElement),r={canUseDOM:n,canUseWorkers:"undefined"!=typeof Worker,canUseEventListeners:n&&!(!window.addEventListener&&!window.attachEvent),canUseViewport:n&&!!window.screen,isInWorker:!n};t.exports=r},{}],141:[function(e,t){function n(e){return e.replace(r,function(e,t){return t.toUpperCase()})}var r=/-(.)/g;t.exports=n},{}],142:[function(e,t){function n(e){return r(e.replace(i,"ms-"))}var r=e(141),i=/^-ms-/;t.exports=n},{141:141}],143:[function(e,t){function n(e,t){return!!(e&&t&&(e===t||!r(e)&&(r(t)?n(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition&&16&e.compareDocumentPosition(t))))}var r=e(156);t.exports=n},{156:156}],144:[function(e,t){function n(e){var t=e.length;if(Array.isArray(e)||"object"!=typeof e&&"function"!=typeof e?o(!1):void 0,"number"!=typeof t?o(!1):void 0,0===t||t-1 in e?void 0:o(!1),"function"==typeof e.callee?o(!1):void 0,e.hasOwnProperty)try{return Array.prototype.slice.call(e)}catch(e){}for(var n=Array(t),r=0;t>r;r++)n[r]=e[r];return n}function r(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 i(e){return r(e)?Array.isArray(e)?e.slice():n(e):[e]}var o=e(154);t.exports=i},{154:154}],145:[function(e,t){function n(e){var t=e.match(c);return t&&t[1].toLowerCase()}function r(e,t){var r=u;u?void 0:s(!1);var i=n(e),c=i&&a(i);if(c){r.innerHTML=c[1]+e+c[2];for(var l=c[0];l--;)r=r.lastChild}else r.innerHTML=e;var h=r.getElementsByTagName("script");h.length&&(t?void 0:s(!1),o(h).forEach(t));for(var f=Array.from(r.childNodes);r.lastChild;)r.removeChild(r.lastChild);return f}var i=e(140),o=e(144),a=e(150),s=e(154),u=i.canUseDOM?document.createElement("div"):null,c=/^\s*<(\w+)/;t.exports=r},{140:140,144:144,150:150,154:154}],146:[function(e,t){function n(e){return function(){return e}}var r=function(){};r.thatReturns=n,r.thatReturnsFalse=n(!1),r.thatReturnsTrue=n(!0),r.thatReturnsNull=n(null),r.thatReturnsThis=function(){return this},r.thatReturnsArgument=function(e){return e},t.exports=r},{}],147:[function(e,t){var n={};t.exports=n},{}],148:[function(e,t){function n(e){try{e.focus()}catch(e){}}t.exports=n},{}],149:[function(e,t){function n(){if("undefined"==typeof document)return null;try{return document.activeElement||document.body}catch(e){return document.body}}t.exports=n},{}],150:[function(e,t){function n(e){return o?void 0:i(!1),h.hasOwnProperty(e)||(e="*"),a.hasOwnProperty(e)||(o.innerHTML="*"===e?"<link />":"<"+e+"></"+e+">",a[e]=!o.firstChild),a[e]?h[e]:null}var r=e(140),i=e(154),o=r.canUseDOM?document.createElement("div"):null,a={},s=[1,'<select multiple="true">',"</select>"],u=[1,"<table>","</table>"],c=[3,"<table><tbody><tr>","</tr></tbody></table>"],l=[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:s,option:s,caption:u,colgroup:u,tbody:u,tfoot:u,thead:u,td:c,th:c},f=["circle","clipPath","defs","ellipse","g","image","line","linearGradient","mask","path","pattern","polygon","polyline","radialGradient","rect","stop","text","tspan"];f.forEach(function(e){h[e]=l,a[e]=!0}),t.exports=n},{140:140,154:154}],151:[function(e,t){function n(e){return e===window?{x:window.pageXOffset||document.documentElement.scrollLeft,y:window.pageYOffset||document.documentElement.scrollTop}:{x:e.scrollLeft,y:e.scrollTop}}t.exports=n},{}],152:[function(e,t){function n(e){return e.replace(r,"-$1").toLowerCase()}var r=/([A-Z])/g;t.exports=n},{}],153:[function(e,t){function n(e){return r(e).replace(i,"-ms-")}var r=e(152),i=/^ms-/;t.exports=n},{152:152}],154:[function(e,t){function n(e,t,n,r,i,o,a,s){if(!e){var u;if(void 0===t)u=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var c=[n,r,i,o,a,s],l=0;u=new Error(t.replace(/%s/g,function(){return c[l++]})),u.name="Invariant Violation"}throw u.framesToPop=1,u}}t.exports=n},{}],155:[function(e,t){function n(e){return!(!e||!("function"==typeof Node?e instanceof Node:"object"==typeof e&&"number"==typeof e.nodeType&&"string"==typeof e.nodeName))}t.exports=n},{}],156:[function(e,t){function n(e){return r(e)&&3==e.nodeType}var r=e(155);t.exports=n},{155:155}],157:[function(e,t){var n=e(154),r=function(e){var t,r={};e instanceof Object&&!Array.isArray(e)?void 0:n(!1);for(t in e)e.hasOwnProperty(t)&&(r[t]=t);return r};t.exports=r},{154:154}],158:[function(e,t){var n=function(e){var t;for(t in e)if(e.hasOwnProperty(t))return t;return null};t.exports=n},{}],159:[function(e,t){function n(e){var t={};return function(n){return t.hasOwnProperty(n)||(t[n]=e.call(this,n)),t[n]}}t.exports=n},{}],160:[function(e,t){function n(e,t){return e===t?0!==e||1/e===1/t:e!==e&&t!==t}function r(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),o=Object.keys(t);if(r.length!==o.length)return!1;for(var a=0;a<r.length;a++)if(!i.call(t,r[a])||!n(e[r[a]],t[r[a]]))return!1;return!0}var i=Object.prototype.hasOwnProperty;t.exports=r},{}],161:[function(e,t){var n=e(146),r=n;t.exports=r},{146:146}],162:[function(e,t){function n(e){if(null===e||void 0===e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}function r(){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={},n=0;10>n;n++)t["_"+String.fromCharCode(n)]=n;var r=Object.getOwnPropertyNames(t).map(function(e){return t[e]});if("0123456789"!==r.join(""))return!1;var i={};return"abcdefghijklmnopqrst".split("").forEach(function(e){i[e]=e}),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},i)).join("")}catch(e){return!1}}var i=Object.prototype.hasOwnProperty,o=Object.prototype.propertyIsEnumerable;t.exports=r()?Object.assign:function(e){for(var t,r,a=n(e),s=1;s<arguments.length;s++){t=Object(arguments[s]);for(var u in t)i.call(t,u)&&(a[u]=t[u]);if(Object.getOwnPropertySymbols){r=Object.getOwnPropertySymbols(t);for(var c=0;c<r.length;c++)o.call(t,r[c])&&(a[r[c]]=t[r[c]])}}return a}},{}]},{},[86])(86)}),e=n.exports}();var t,n=function(e){function t(e){return"function"==typeof e||"object"==typeof e&&null!==e}function n(e){return"function"==typeof e}function r(e){$=e}function i(e){W=e}function o(){return function(){process.nextTick(c)}}function a(){var e=0,t=new Y(c),n=document.createTextNode("");return t.observe(n,{characterData:!0}),function(){n.data=e=++e%2}}function s(){var e=new MessageChannel;return e.port1.onmessage=c,function(){e.port2.postMessage(0)}}function u(){return function(){setTimeout(c,1)}}function c(){for(var e=0;G>e;e+=2){var t=Z[e],n=Z[e+1];t(n),Z[e]=void 0,Z[e+1]=void 0}G=0}function l(e,t){var n=this,r=new this.constructor(f);void 0===r[tt]&&R(r);var i=n._state;if(i){var o=arguments[i-1];W(function(){A(i,r,o,n._result)})}else E(n,r,e,t);return r}function h(e){var t=this;if(e&&"object"==typeof e&&e.constructor===t)return e;var n=new t(f);return x(n,e),n}function f(){}function p(){return new TypeError("You cannot resolve a promise with itself")}function d(){return new TypeError("A promises callback cannot return that same promise.")}function m(e){try{return e.then}catch(t){return ot.error=t,ot}}function v(e,t,n,r){try{e.call(t,n,r)}catch(i){return i}}function g(e,t,n){W(function(e){var r=!1,i=v(n,t,function(n){r||(r=!0,t!==n?x(e,n):_(e,n))},function(t){r||(r=!0,C(e,t))},"Settle: "+(e._label||" unknown promise"));!r&&i&&(r=!0,C(e,i))},e)}function y(e,t){t._state===rt?_(e,t._result):t._state===it?C(e,t._result):E(t,void 0,function(t){x(e,t)},function(t){C(e,t)})}function b(e,t,r){t.constructor===e.constructor&&r===J&&constructor.resolve===et?y(e,t):r===ot?C(e,ot.error):void 0===r?_(e,t):n(r)?g(e,t,r):_(e,t)}function x(e,n){e===n?C(e,p()):t(n)?b(e,n,m(n)):_(e,n)}function w(e){e._onerror&&e._onerror(e._result),S(e)}function _(e,t){e._state===nt&&(e._result=t,e._state=rt,0!==e._subscribers.length&&W(S,e))}function C(e,t){e._state===nt&&(e._state=it,e._result=t,W(w,e))}function E(e,t,n,r){var i=e._subscribers,o=i.length;e._onerror=null,i[o]=t,i[o+rt]=n,i[o+it]=r,0===o&&e._state&&W(S,e)}function S(e){var t=e._subscribers,n=e._state;if(0!==t.length){for(var r,i,o=e._result,a=0;a<t.length;a+=3)r=t[a],i=t[a+n],r?A(n,r,i,o):i(o);e._subscribers.length=0}}function M(){this.error=null}function T(e,t){try{return e(t)}catch(n){return at.error=n,at}}function A(e,t,r,i){var o,a,s,u,c=n(r);if(c){if(o=T(r,i),o===at?(u=!0,a=o.error,o=null):s=!0,t===o)return C(t,d()),void 0}else o=i,s=!0;t._state!==nt||(c&&s?x(t,o):u?C(t,a):e===rt?_(t,o):e===it&&C(t,o))}function P(e,t){try{t(function(t){x(e,t)},function(t){C(e,t)})}catch(n){C(e,n)}}function k(){return st++}function R(e){e[tt]=st++,e._state=void 0,e._result=void 0,e._subscribers=[]}function I(e){return new ft(this,e).promise}function D(e){var t=this;return j(e)?new t(function(n,r){for(var i=e.length,o=0;i>o;o++)t.resolve(e[o]).then(n,r)}):new t(function(e,t){t(new TypeError("You must pass an array to race."))})}function B(e){var t=this,n=new t(f);return C(n,e),n}function V(){throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")}function L(){throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.")}function N(e){this[tt]=k(),this._result=this._state=void 0,this._subscribers=[],f!==e&&("function"!=typeof e&&V(),this instanceof N?P(this,e):L())}function O(e,t){this._instanceConstructor=e,this.promise=new e(f),this.promise[tt]||R(this.promise),Array.isArray(t)?(this._input=t,this.length=t.length,this._remaining=t.length,this._result=new Array(this.length),0===this.length?_(this.promise,this._result):(this.length=this.length||0,this._enumerate(),0===this._remaining&&_(this.promise,this._result))):C(this.promise,F())}function F(){return new Error("Array Methods must be provided an Array")}function U(){var e;if("undefined"!=typeof global)e=global;else if("undefined"!=typeof self)e=self;else try{e=Function("return this")()}catch(t){throw new Error("polyfill failed because global object is unavailable in this environment")}var n=e.Promise;(!n||"[object Promise]"!==Object.prototype.toString.call(n.resolve())||n.cast)&&(e.Promise=ht)}var z;z=Array.isArray?Array.isArray:function(e){return"[object Array]"===Object.prototype.toString.call(e)};var $,H,j=z,G=0,W=function(e,t){Z[G]=e,Z[G+1]=t,G+=2,2===G&&($?$(c):H())},q="undefined"!=typeof window?window:void 0,X=q||{},Y=X.MutationObserver||X.WebKitMutationObserver,K="undefined"==typeof self&&"undefined"!=typeof process&&"[object process]"==={}.toString.call(process),Q="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel,Z=new Array(1e3);H=K?o():Y?a():Q?s():u();var J=l,et=h,tt=Math.random().toString(36).substring(16),nt=void 0,rt=1,it=2,ot=new M,at=new M,st=0,ut=I,ct=D,lt=B,ht=N;N.all=ut,N.race=ct,N.resolve=et,N.reject=lt,N._setScheduler=r,N._setAsap=i,N._asap=W,N.prototype={constructor:N,then:J,"catch":function(e){return this.then(null,e)}};var ft=O;O.prototype._enumerate=function(){for(var e=this.length,t=this._input,n=0;this._state===nt&&e>n;n++)this._eachEntry(t[n],n)},O.prototype._eachEntry=function(e,t){var n=this._instanceConstructor,r=n.resolve;if(r===et){var i=m(e);if(i===J&&e._state!==nt)this._settledAt(e._state,t,e._result);else if("function"!=typeof i)this._remaining--,this._result[t]=e;else if(n===ht){var o=new n(f);b(o,e,i),this._willSettleAt(o,t)}else this._willSettleAt(new n(function(t){t(e)}),t)}else this._willSettleAt(r(e),t)},O.prototype._settledAt=function(e,t,n){var r=this.promise;r._state===nt&&(this._remaining--,e===it?C(r,n):this._result[t]=n),0===this._remaining&&_(r,this._result)},O.prototype._willSettleAt=function(e,t){var n=this;E(e,void 0,function(e){n._settledAt(rt,t,e)},function(e){n._settledAt(it,t,e)})};var pt=U,dt={Promise:ht,polyfill:pt};pt(),e.ES6Promise=dt};if("undefined"!=typeof window&&window&&window.Promise)t=window.Promise;else if("undefined"!=typeof global&&global&&global.Promise)t=global.Promise;else{var r={};n(r),t=r.ES6Promise.Promise}var i;!function(e){e.VERSION={number:"1.1.0",date:"Dec 11 2016"}}(i||(i={}));var i;!function(e){var t;!function(e){var t;!function(e){function t(e){return e.creator&&e.chunkSize}function n(e,t,n,r,i){return 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++]=n,e.current[e.currentIndex++]=r,e.current[e.currentIndex++]=i,e.elementCount++}function r(e,t,n,r){return 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++]=n,e.current[e.currentIndex++]=r,e.elementCount++}function i(e,t,n){return 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++]=n,e.elementCount++}function o(e,t){return 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.elementCount++}function a(e){var t,n=e.creator(e.elementSize*e.elementCount),r=(e.parts.length-1)*e.chunkSize,i=0;if(e.parts.length>1)if(e.parts[0].buffer)for(var o=0;o<e.parts.length-1;o++)n.set(e.parts[o],e.chunkSize*o);else for(var o=0;o<e.parts.length-1;o++){i=e.chunkSize*o,t=e.parts[o];for(var a=0;a<e.chunkSize;a++)n[i+a]=t[a]}if(e.current.buffer&&e.currentIndex>=e.chunkSize)n.set(e.current,e.chunkSize*(e.parts.length-1));else for(var o=0;o<e.currentIndex;o++)n[r+o]=e.current[o];return n}function s(e){return void 0===e&&(e=262144),d(function(e){return new Float32Array(e)},e,3)}function u(e){return void 0===e&&(e=262144),d(function(e){return new Uint32Array(e)},e,3)}function c(e){return void 0===e&&(e=131072),d(function(e){return new Int32Array(e)},e,2)}function l(e){return void 0===e&&(e=131072),d(function(e){return new Int32Array(e)},e,1)}function h(e){return void 0===e&&(e=131072),d(function(e){return new Int32Array(e)},e,1)}function f(e){return void 0===e&&(e=131072),d(function(e){return new Float32Array(e)
},e,1)}function p(e){return void 0===e&&(e=131072),d(function(){return[]},e,1)}function d(e,t,n){t=0|t,0>=t&&(t=1);var r=t*n,i=e(r);return{elementSize:n,chunkSize:r,creator:e,current:i,parts:[i],currentIndex:0,elementCount:0}}e.is=t,e.add4=n,e.add3=r,e.add2=i,e.add=o,e.compact=a,e.forVertex3D=s,e.forIndexBuffer=u,e.forTokenIndices=c,e.forIndices=l,e.forInt32=h,e.forFloat32=f,e.forArray=p,e.create=d}(t=e.ChunkedArray||(e.ChunkedArray={}))}(t=e.Utils||(e.Utils={}))}(i||(i={}));var i;!function(e){var t;!function(e){var t;!function(e){function t(e,t,r){for(;r>t&&32===e.charCodeAt(t);)t++;return n(e,t,r)}function n(e,t,n){var r=0,i=1;for(45===e.charCodeAt(t)&&(i=-1,t++);n>t;t++){var o=e.charCodeAt(t)-48;if(o>9||0>o)return i*r|0;r=10*r+o|0}return i*r}function r(e,t,r,i){return e*Math.pow(10,n(t,r,i))}function i(e,t,n){for(;n>t&&32===e.charCodeAt(t);)t++;return o(e,t,n)}function o(e,t,n){var i=1,o=0,a=0,s=1;for(45===e.charCodeAt(t)&&(i=-1,++t);n>t;){var u=e.charCodeAt(t)-48;if(!(u>=0&&10>u)){if(-2===u){for(++t;n>t;){if(u=e.charCodeAt(t)-48,!(u>=0&&10>u))return 53===u||21===u?r(i*(o+a/s),e,t+1,n):i*(o+a/s);a=10*a+u,s=10*s,++t}return i*(o+a/s)}if(53===u||21===u)return r(i*o,e,t+1,n);break}o=10*o+u,++t}return i*o}e.parseIntSkipTrailingWhitespace=t,e.parseInt=n,e.parseScientific=r,e.parseFloatSkipTrailingWhitespace=i,e.parseFloat=o}(t=e.FastNumberParsers||(e.FastNumberParsers={}))}(t=e.Utils||(e.Utils={}))}(i||(i={}));var i;!function(e){var t;!function(e){var t=[];!function(){for(var e="",n=0;512>n;n++)t[n]=e,e+=" "}();var n;!function(e){function n(e){return void 0===e&&(e=512),{chunkData:[],chunkOffset:0,chunkCapacity:e,data:[]}}function r(e){return e.data.length?(e.chunkOffset>0&&(e.data[e.data.length]=e.chunkData.splice(0,e.chunkOffset).join("")),e.data.join("")):e.chunkData.length===e.chunkOffset?e.chunkData.join(""):e.chunkData.splice(0,e.chunkOffset).join("")}function i(e,t){o(e);for(var n=0,r=e.data;n<r.length;n++){var i=r[n];t.writeString(i)}}function o(e){e.chunkOffset>0&&(e.data[e.data.length]=e.chunkData.length===e.chunkOffset?e.chunkData.join(""):e.chunkData.splice(0,e.chunkOffset).join(""),e.chunkOffset=0)}function a(e){u(e,"\n")}function s(e,n){u(e,t[n])}function u(e,t){void 0!==t&&null!==t&&(e.chunkOffset===e.chunkCapacity&&(e.data[e.data.length]=e.chunkData.join(""),e.chunkOffset=0),e.chunkData[e.chunkOffset++]=t)}function c(e,t){e.chunkOffset===e.chunkCapacity&&(e.data[e.data.length]=e.chunkData.join(""),e.chunkOffset=0),e.chunkData[e.chunkOffset++]=t}function l(e,n,r){(void 0===n||null===n)&&u(e,t[r]);var i=r-n.length;i>0&&u(e,t[i]),u(e,n)}function h(e,n,r){(void 0===n||null===n)&&u(e,t[r]);var i=r-n.length;u(e,n),i>0&&u(e,t[i])}function f(e,t){u(e,""+t)}function p(e,n,r){var i=""+n,o=r-i.length;o>0&&u(e,t[o]),u(e,i)}function d(e,n,r){var i=""+n,o=r-i.length;u(e,i),o>0&&u(e,t[o])}function m(e,t,n){u(e,""+Math.round(n*t)/n)}function v(e,n,r,i){var o=""+Math.round(r*n)/r,a=i-o.length;a>0&&u(e,t[a]),u(e,o)}function g(e,n,r,i){var o=""+Math.round(r*n)/r,a=i-o.length;u(e,o),a>0&&u(e,t[a])}e.create=n,e.asString=r,e.writeTo=i,e.newline=a,e.whitespace=s,e.write=u,e.writeSafe=c,e.writePadLeft=l,e.writePadRight=h,e.writeInteger=f,e.writeIntegerPadLeft=p,e.writeIntegerPadRight=d,e.writeFloat=m,e.writeFloatPadLeft=v,e.writeFloatPadRight=g}(n=e.StringWriter||(e.StringWriter={}))}(t=e.Utils||(e.Utils={}))}(i||(i={}));var i;!function(e){var t=function(){function e(){this.isDefined=!1}return e.prototype.getString=function(){return null},e.prototype.getInteger=function(){return 0},e.prototype.getFloat=function(){return 0},e.prototype.getValuePresence=function(){return 1},e.prototype.areValuesEqual=function(){return!0},e.prototype.stringEquals=function(e,t){return null===t},e}();e.UndefinedColumn=new t;var n;!function(e){function t(e,t,n,r,i){for(var o=[],a=1;n>=a;a++){for(var s=[],u=1;r>=u;u++)s[u-1]=e.getColumn(t+"["+a+"]["+u+"]").getFloat(i);o[a-1]=s}return o}function n(e,t,n,r,i){for(var o=[],a=1;n>=a;a++)o[a-1]=e.getColumn(t+"["+a+"]").getFloat(i);return o}e.getMatrix=t,e.getVector=n}(n=e.Category||(e.Category={}))}(i||(i={}));var i;!function(e){var t;!function(e){function t(e,t){return void 0===t&&(t=-1),new n(e,t)}function i(e,t){return void 0===t&&(t=[]),new r(e,t)}e.error=t,e.success=i}(t=e.ParserResult||(e.ParserResult={}));var n=function(){function e(e,t){this.message=e,this.line=t,this.isError=!0}return e.prototype.toString=function(){return this.line>=0?"[Line "+this.line+"] "+this.message:this.message},e}();e.ParserError=n;var r=function(){function e(e,t){this.result=e,this.warnings=t,this.isError=!1}return e}();e.ParserSuccess=r}(i||(i={}));var i;!function(e){var t;!function(t){var n;!function(e){function t(){return new Map}function n(e,t){if(t.length>6)return t;var n=e.get(t);return void 0!==n?n:(e.set(t,t),t)}e.create=t,e.get=n}(n||(n={}));var r=function(){function e(e){this.dataBlocks=[],this.data=e}return e.prototype.toJSON=function(){return this.dataBlocks.map(function(e){return e.toJSON()})},e}();t.File=r;var i=function(){function e(e,t){this.header=t,this.data=e,this.categoryList=[],this.additionalData={},this.categoryMap=new Map}return Object.defineProperty(e.prototype,"categories",{get:function(){return this.categoryList},enumerable:!0,configurable:!0}),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}},e}();t.DataBlock=i;var o=function(){function t(e,t,n,r,i,o,a){this.name=t,this.tokens=o,this.data=e,this.startIndex=n,this.endIndex=r,this.columnCount=i.length,this.rowCount=a/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)}}return Object.defineProperty(t.prototype,"columnNames",{get:function(){return this.columnNameList},enumerable:!0,configurable:!0}),t.prototype.getColumn=function(t){var n=this.columnIndices.get(t);return void 0!==n?new u(this,this.data,t,n):e.UndefinedColumn},t.prototype.toJSON=function(){for(var e=[],t=this.data,r=this.tokens,i=this.columnNameList,o=n.create(),a=0;a<this.rowCount;a++){for(var s={},u=0;u<this.columnCount;u++){var c=2*(a*this.columnCount+u);s[i[u]]=n.get(o,t.substring(r[c],r[c+1]))}e[a]=s}return{name:this.name,columns:i,rows:e}},t}();t.Category=o;var a=e.Utils.FastNumberParsers.parseInt,s=e.Utils.FastNumberParsers.parseFloat,u=function(){function e(e,t,r,i){this.data=t,this.name=r,this.index=i,this.stringPool=n.create(),this.isDefined=!0,this.tokens=e.tokens,this.columnCount=e.columnCount}return e.prototype.getString=function(e){var t=2*(e*this.columnCount+this.index),r=n.get(this.stringPool,this.data.substring(this.tokens[t],this.tokens[t+1]));return"."===r||"?"===r?null:r},e.prototype.getInteger=function(e){var t=2*(e*this.columnCount+this.index);return a(this.data,this.tokens[t],this.tokens[t+1])},e.prototype.getFloat=function(e){var t=2*(e*this.columnCount+this.index);return s(this.data,this.tokens[t],this.tokens[t+1])},e.prototype.stringEquals=function(e,t){var n=2*(e*this.columnCount+this.index),r=this.tokens[n],i=t.length;if(i!==this.tokens[n+1]-r)return!1;for(var o=0;i>o;o++)if(this.data.charCodeAt(o+r)!==t.charCodeAt(o))return!1;return!0},e.prototype.areValuesEqual=function(e,t){var n=2*(e*this.columnCount+this.index),r=2*(t*this.columnCount+this.index),i=this.tokens[n],o=this.tokens[r],a=this.tokens[n+1]-i;if(a!==this.tokens[r+1]-o)return!1;for(var s=0;a>s;s++)if(this.data.charCodeAt(s+i)!==this.data.charCodeAt(s+o))return!1;return!0},e.prototype.getValuePresence=function(e){var t=e*this.columnCount+this.index,n=this.tokens[2*t];if(this.tokens[2*t+1]-n!==1)return 0;var r=this.data.charCodeAt(n);return 46===r?1:63===r?2:0},e}();t.Column=u}(t=e.Text||(e.Text={}))}(i||(i={}));var i;!function(e){var t;!function(t){function n(e){for(;e.position<e.length;)switch(e.data.charCodeAt(e.position)){case 9:case 10:case 13:case 32:return e.currentTokenEnd=e.position,void 0;default:++e.position}e.currentTokenEnd=e.position}function r(e,t){var n,r;for(++e.position;e.position<e.length;)if(r=e.data.charCodeAt(e.position),r===t)switch(n=e.data.charCodeAt(e.position+1)){case 9:case 10:case 13:case 32:return e.currentTokenStart++,e.currentTokenEnd=e.position,e.isEscaped=!0,++e.position,void 0;default:if(void 0===n)return e.currentTokenStart++,e.currentTokenEnd=e.position,e.isEscaped=!0,++e.position,void 0;++e.position}else{if(10===r||13===r)return e.currentTokenEnd=e.position,void 0;++e.position}e.currentTokenEnd=e.position}function i(e){for(var t,n=59,r=e.position+1;r<e.length;){if(t=e.data.charCodeAt(r),59===t&&(10===n||13===n)){for(e.position=r+1,e.currentTokenStart++,r--,t=e.data.charCodeAt(r);10===t||13===t;)r--,t=e.data.charCodeAt(r);return e.currentTokenEnd=r+1,e.isEscaped=!0,void 0}13===t?e.currentLineNumber++:10===t&&13!==n&&e.currentLineNumber++,n=t,++r}return e.position=r,n}function o(e){for(;e.position<e.length;){var t=e.data.charCodeAt(e.position);if(10===t||13===t)return;++e.position}}function a(e){for(var t=10;e.position<e.length;){var n=e.data.charCodeAt(e.position);switch(n){case 9:case 32:t=n,++e.position;break;case 10:13!==t&&++e.currentLineNumber,t=n,++e.position;break;case 13:t=n,++e.position,++e.currentLineNumber;break;default:return t}}return t}function s(e){var t=e.data.charCodeAt(e.currentTokenStart);return 68!==t&&100!==t?!1:(t=e.data.charCodeAt(e.currentTokenStart+1),65!==t&&97!==t?!1:(t=e.data.charCodeAt(e.currentTokenStart+2),84!==t&&116!==t?!1:(t=e.data.charCodeAt(e.currentTokenStart+3),65!==t&&97!==t?!1:!0)))}function u(e){var t=e.data.charCodeAt(e.currentTokenStart);return 83!==t&&115!==t?!1:(t=e.data.charCodeAt(e.currentTokenStart+1),65!==t&&97!==t?!1:(t=e.data.charCodeAt(e.currentTokenStart+2),86!==t&&118!==t?!1:(t=e.data.charCodeAt(e.currentTokenStart+3),69!==t&&101!==t?!1:!0)))}function c(e){if(e.currentTokenEnd-e.currentTokenStart!==5)return!1;var t=e.data.charCodeAt(e.currentTokenStart);return 76!==t&&108!==t?!1:(t=e.data.charCodeAt(e.currentTokenStart+1),79!==t&&111!==t?!1:(t=e.data.charCodeAt(e.currentTokenStart+2),79!==t&&111!==t?!1:(t=e.data.charCodeAt(e.currentTokenStart+3),80!==t&&112!==t?!1:!0)))}function l(e,t,n){var r,i=n-t,o=e.currentTokenStart-t,a=e.currentTokenEnd-e.currentTokenStart;if(i>a)return!1;for(r=t;n>r;++r)if(e.data.charCodeAt(r)!==e.data.charCodeAt(r+o))return!1;return i===a?!0:46===e.data.charCodeAt(r+o)?!0:!1}function h(e){var t;for(t=e.currentTokenStart;t<e.currentTokenEnd;++t)if(46===e.data.charCodeAt(t))return t;return t}function f(e,t){return e.data.substring(e.currentTokenStart,t)}function p(e){return e.data.substring(e.currentTokenStart,e.currentTokenEnd)}function d(e){var t=a(e);if(e.position>=e.length)return e.currentTokenType=6,void 0;e.currentTokenStart=e.position,e.currentTokenEnd=e.position,e.isEscaped=!1;var l=e.data.charCodeAt(e.position);switch(l){case 35:o(e),e.currentTokenType=5;break;case 34:case 39:r(e,l),e.currentTokenType=3;break;case 59:10===t||13===t?i(e):n(e),e.currentTokenType=3;break;default:n(e),e.currentTokenType=e.isEscaped?3:95===e.data.charCodeAt(e.currentTokenStart)?4:e.currentTokenEnd-e.currentTokenStart>=5&&95===e.data.charCodeAt(e.currentTokenStart+4)?s(e)?0:u(e)?1:c(e)?2:3:3}}function m(e){for(d(e);5===e.currentTokenType;)d(e)}function v(e){return{data:e,length:e.length,position:0,currentTokenStart:0,currentTokenEnd:0,currentTokenType:6,currentLineNumber:1,isEscaped:!1}}function g(e,n){for(var r,i=e.currentTokenStart,o=h(e),a=f(e,o),s=[],u=C.create(512),c=0,d=!0;d;){if(4!==e.currentTokenType||!l(e,i,o)){d=!1;break}if(r=p(e),m(e),3!==e.currentTokenType)return{hasError:!0,errorLine:e.currentLineNumber,errorMessage:"Expected value."};s[s.length]=r,C.addToken(u,e.currentTokenStart,e.currentTokenEnd),c++,m(e)}return n.addCategory(new t.Category(n.data,a,i,e.currentTokenStart,s,u.tokens,c)),{hasError:!1,errorLine:0,errorMessage:""}}function y(e,n){var r=e.currentTokenStart,i=e.currentLineNumber;m(e);for(var o=f(e,h(e)),a=[],s=C.create("_atom_site"===o?n.data.length/1.85|0:1024),u=0;4===e.currentTokenType;)a[a.length]=p(e),m(e);for(;3===e.currentTokenType;)C.addToken(s,e.currentTokenStart,e.currentTokenEnd),u++,m(e);return u%a.length!==0?{hasError:!0,errorLine:e.currentLineNumber,errorMessage:"The number of values for loop starting at line "+i+" is not a multiple of the number of columns."}:(n.addCategory(new t.Category(n.data,o,r,e.currentTokenStart,a,s.tokens,u)),{hasError:!1,errorLine:0,errorMessage:""})}function b(t,n){return e.ParserResult.error(n,t)}function x(t){return e.ParserResult.success(t)}function w(e){var n,r,i,o=v(e),a=new t.File(e),s=new t.DataBlock(e,"default"),u=new t.DataBlock(e,"empty"),c=!1;for(m(o);6!==o.currentTokenType;){var l=o.currentTokenType;if(0===l){if(c)return b(o.currentLineNumber,"Unexpected data block inside a save frame.");s.categories.length>0&&a.dataBlocks.push(s),s=new t.DataBlock(e,e.substring(o.currentTokenStart+5,o.currentTokenEnd)),m(o)}else if(1===l){if(r=e.substring(o.currentTokenStart+5,o.currentTokenEnd),0===r.length)u.categories.length>0&&(i=s.additionalData.saveFrames,i||(i=[],s.additionalData.saveFrames=i),i[i.length]=u),c=!1;else{if(c)return b(o.currentLineNumber,"Save frames cannot be nested.");c=!0,u=new t.DataBlock(e,r)}m(o)}else if(2===l){if(n=y(o,c?u:s),n.hasError)return b(n.errorLine,n.errorMessage)}else{if(4!==l)return b(o.currentLineNumber,"Unexpected token. Expected data_, loop_, or data name.");if(n=g(o,c?u:s),n.hasError)return b(n.errorLine,n.errorMessage)}}return c?b(o.currentLineNumber,"Unfinished save frame (`"+u.header+"`)."):(s.categories.length>0&&a.dataBlocks.push(s),x(a))}function _(e){return w(e)}var C;!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 n(e,n,r){e.count>=e.tokensLenMinus2&&t(e),e.tokens[e.count++]=n,e.tokens[e.count++]=r}function r(e){return{tokensLenMinus2:e-2|0,count:0,tokens:new Int32Array(e)}}e.addToken=n,e.create=r}(C||(C={})),t.parse=_}(t=e.Text||(e.Text={}))}(i||(i={}));var i;!function(e){var t;!function(t){function n(e){return!!e&&e.indexOf("\n")>=0}function r(e,t){for(var r=e.desc.fields,i=e.data,o=r.reduce(function(e,t){return Math.max(e,t.name.length)},0)+e.desc.name.length+5,h=0,f=r;h<f.length;h++){var p=f[h];l.writePadRight(t,e.desc.name+"."+p.name,o);var d=p.presence,m=void 0;if(d&&0!==(m=d(i,0)))1===m?a(t):s(t);else{var v=p.string(i,0);n(v)?(c(t,v),l.newline(t)):u(t,v)}l.newline(t)}l.write(t,"#\n")}function i(e,t){o(t,"loop_");for(var r=e[0],i=r.desc.fields,h=0,f=i;h<f.length;h++){var p=f[h];o(t,r.desc.name+"."+p.name)}for(var d=0,m=e;d<m.length;d++)for(var v=m[d],g=v.data,y=v.count,b=0;y>b;b++){for(var x=0,w=i;x<w.length;x++){var p=w[x],_=p.presence,C=void 0;if(_&&0!==(C=_(g,b)))1===C?a(t):s(t);else{var E=p.string(g,b);n(E)?(c(t,E),l.newline(t)):u(t,E)}}l.newline(t)}l.write(t,"#\n")}function o(e,t){l.write(e,t),l.newline(e)}function a(e){l.writeSafe(e,". ")}function s(e){l.writeSafe(e,"? ")}function u(e,t){if(!t)return l.writeSafe(e,". "),void 0;for(var n=!1,r="'",i="' ",o=!1,a=!1,s=!1,u=0,c=t.length-1;c>u;u++){var h=t.charCodeAt(u);switch(h){case 9:o=!0;break;case 10:return l.writeSafe(e,"\n;"+t),l.writeSafe(e,"\n; "),void 0;case 32:o=!0;break;case 34:if(a)return l.writeSafe(e,"\n;"+t),l.writeSafe(e,"\n; "),void 0;s=!0,n=!0,r="'",i="' ";break;case 39:if(s)return l.writeSafe(e,"\n;"+t),l.writeSafe(e,"\n; "),void 0;n=!0,a=!0,r='"',i='" '}}var f=t.charCodeAt(0);n||35!==f&&59!==f&&!o||(r="'",i="' ",n=!0),n?l.writeSafe(e,r+t+i):(l.write(e,t),l.writeSafe(e," "))}function c(e,t){l.writeSafe(e,"\n;"+t),l.writeSafe(e,"\n; ")}var l=e.Utils.StringWriter,h=function(){function e(){this.writer=l.create(),this.encoded=!1,this.dataBlockCreated=!1}return e.prototype.startDataBlock=function(e){this.dataBlockCreated=!0,l.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 n=t&&t.length?t.map(function(t){return e(t)}):[e(void 0)],o=n.filter(function(e){return e&&e.count>0});if(o.length){var a=o.reduce(function(e,t){return e+(void 0===t.count?1:t.count)},0);a&&(1===a?r(o[0],this.writer):i(o,this.writer))}},e.prototype.encode=function(){this.encoded=!0},e.prototype.flush=function(e){l.writeTo(this.writer,e)},e}();t.Writer=h}(t=e.Text||(e.Text={}))}(i||(i={}));var i;!function(e){var t;!function(e){var t;!function(e){function t(e,t){for(var n={},r=0;t>r;r++){var i=o(e);n[i]=o(e)}return n}function n(e,t){for(var n=new Uint8Array(t),r=e.offset,i=0;t>i;i++)n[i]=e.buffer[i+r];return e.offset+=t,n}function r(t,n){var r=e.utf8Read(t.buffer,t.offset,n);return t.offset+=n,r}function i(e,t){for(var n=new Array(t),r=0;t>r;r++)n[r]=o(e);return n}function o(e){var o,a,s=e.buffer[e.offset];if(0===(128&s))return e.offset++,s;if(128===(240&s))return a=15&s,e.offset++,t(e,a);if(144===(240&s))return a=15&s,e.offset++,i(e,a);if(160===(224&s))return a=31&s,e.offset++,r(e,a);if(224===(224&s))return o=e.dataView.getInt8(e.offset),e.offset++,o;switch(s){case 192:return e.offset++,null;case 194:return e.offset++,!1;case 195:return e.offset++,!0;case 196:return a=e.dataView.getUint8(e.offset+1),e.offset+=2,n(e,a);case 197:return a=e.dataView.getUint16(e.offset+1),e.offset+=3,n(e,a);case 198:return a=e.dataView.getUint32(e.offset+1),e.offset+=5,n(e,a);case 202:return o=e.dataView.getFloat32(e.offset+1),e.offset+=5,o;case 203:return o=e.dataView.getFloat64(e.offset+1),e.offset+=9,o;case 204:return o=e.buffer[e.offset+1],e.offset+=2,o;case 205:return o=e.dataView.getUint16(e.offset+1),e.offset+=3,o;case 206:return o=e.dataView.getUint32(e.offset+1),e.offset+=5,o;case 208:return o=e.dataView.getInt8(e.offset+1),e.offset+=2,o;case 209:return o=e.dataView.getInt16(e.offset+1),e.offset+=3,o;case 210:return o=e.dataView.getInt32(e.offset+1),e.offset+=5,o;case 217:return a=e.dataView.getUint8(e.offset+1),e.offset+=2,r(e,a);case 218:return a=e.dataView.getUint16(e.offset+1),e.offset+=3,r(e,a);case 219:return a=e.dataView.getUint32(e.offset+1),e.offset+=5,r(e,a);case 220:return a=e.dataView.getUint16(e.offset+1),e.offset+=3,i(e,a);case 221:return a=e.dataView.getUint32(e.offset+1),e.offset+=5,i(e,a);case 222:return a=e.dataView.getUint16(e.offset+1),e.offset+=3,t(e,a);case 223:return a=e.dataView.getUint32(e.offset+1),e.offset+=5,t(e,a)}throw new Error("Unknown type 0x"+s.toString(16))}function a(e){return o({buffer:e,offset:0,dataView:new DataView(e.buffer)})}e.decode=a}(t=e.MessagePack||(e.MessagePack={}))}(t=e.Binary||(e.Binary={}))}(i||(i={}));var i;!function(e){var t;!function(e){var t;!function(e){function t(e){var t=new ArrayBuffer(n(e)),i=new DataView(t),o=new Uint8Array(t);return r(e,i,o,0),o}function n(t){var r=typeof t;if("string"===r){var i=e.utf8ByteCount(t);if(32>i)return 1+i;if(256>i)return 2+i;if(65536>i)return 3+i;if(4294967296>i)return 5+i}if(t instanceof Uint8Array){var o=t.byteLength;if(256>o)return 2+o;if(65536>o)return 3+o;if(4294967296>o)return 5+o}if("number"===r){if(Math.floor(t)!==t)return 9;if(t>=0){if(128>t)return 1;if(256>t)return 2;if(65536>t)return 3;if(4294967296>t)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("boolean"===r||null===t||void 0===t)return 1;if("object"===r){var a,s=0;if(Array.isArray(t)){a=t.length;for(var u=0;a>u;u++)s+=n(t[u])}else{var c=Object.keys(t);a=c.length;for(var u=0;a>u;u++){var l=c[u];s+=n(l)+n(t[l])}}if(16>a)return 1+s;if(65536>a)return 3+s;if(4294967296>a)return 5+s;throw new Error("Array or object too long 0x"+a.toString(16))}throw new Error("Unknown type "+r)}function r(t,n,i,o){var a=typeof t;if("string"===a){var s=e.utf8ByteCount(t);if(32>s)return n.setUint8(o,160|s),e.utf8Write(i,o+1,t),1+s;if(256>s)return n.setUint8(o,217),n.setUint8(o+1,s),e.utf8Write(i,o+2,t),2+s;if(65536>s)return n.setUint8(o,218),n.setUint16(o+1,s),e.utf8Write(i,o+3,t),3+s;if(4294967296>s)return n.setUint8(o,219),n.setUint32(o+1,s),e.utf8Write(i,o+5,t),5+s}if(t instanceof Uint8Array){var u=t.byteLength,c=new Uint8Array(n.buffer);if(256>u)return n.setUint8(o,196),n.setUint8(o+1,u),c.set(t,o+2),2+u;if(65536>u)return n.setUint8(o,197),n.setUint16(o+1,u),c.set(t,o+3),3+u;if(4294967296>u)return n.setUint8(o,198),n.setUint32(o+1,u),c.set(t,o+5),5+u}if("number"===a){if(!isFinite(t))throw new Error("Number not finite: "+t);if(Math.floor(t)!==t)return n.setUint8(o,203),n.setFloat64(o+1,t),9;if(t>=0){if(128>t)return n.setUint8(o,t),1;if(256>t)return n.setUint8(o,204),n.setUint8(o+1,t),2;if(65536>t)return n.setUint8(o,205),n.setUint16(o+1,t),3;if(4294967296>t)return n.setUint8(o,206),n.setUint32(o+1,t),5;throw new Error("Number too big 0x"+t.toString(16))}if(t>=-32)return n.setInt8(o,t),1;if(t>=-128)return n.setUint8(o,208),n.setInt8(o+1,t),2;if(t>=-32768)return n.setUint8(o,209),n.setInt16(o+1,t),3;if(t>=-2147483648)return n.setUint8(o,210),n.setInt32(o+1,t),5;throw new Error("Number too small -0x"+(-t).toString(16).substr(1))}if(null===t||void 0===t)return n.setUint8(o,192),1;if("boolean"===a)return n.setUint8(o,t?195:194),1;if("object"===a){var l,h=0,f=Array.isArray(t),p=void 0;if(f?l=t.length:(p=Object.keys(t),l=p.length),16>l?(n.setUint8(o,l|(f?144:128)),h=1):65536>l?(n.setUint8(o,f?220:222),n.setUint16(o+1,l),h=3):4294967296>l&&(n.setUint8(o,f?221:223),n.setUint32(o+1,l),h=5),f)for(var d=0;l>d;d++)h+=r(t[d],n,i,o+h);else for(var m=0,v=p;m<v.length;m++){var g=v[m];h+=r(g,n,i,o+h),h+=r(t[g],n,i,o+h)}return h}throw new Error("Unknown type "+a)}e.encode=t}(t=e.MessagePack||(e.MessagePack={}))}(t=e.Binary||(e.Binary={}))}(i||(i={}));var i;!function(e){var t;!function(e){var t;!function(e){function t(e,t,n){for(var r=(e.byteLength,0),i=n.length;i>r;r++){var o=n.charCodeAt(r);if(128>o)e[t++]=o>>>0&127|0;else if(2048>o)e[t++]=o>>>6&31|192,e[t++]=o>>>0&63|128;else if(65536>o)e[t++]=o>>>12&15|224,e[t++]=o>>>6&63|128,e[t++]=o>>>0&63|128;else{if(!(1114112>o))throw new Error("bad codepoint "+o);e[t++]=o>>>18&7|240,e[t++]=o>>>12&63|128,e[t++]=o>>>6&63|128,e[t++]=o>>>0&63|128}}}function n(e,t,n){for(var r=[],i=t,o=t+n;o>i;i++){var a=e[i];if(0!==(128&a))if(192!==(224&a))if(224!==(240&a)){if(240!==(248&a))throw new Error("Invalid byte "+a.toString(16));r[r.length]=String.fromCharCode((7&a)<<18|(63&e[++i])<<12|(63&e[++i])<<6|(63&e[++i])<<0)}else r[r.length]=String.fromCharCode((15&a)<<12|(63&e[++i])<<6|(63&e[++i])<<0);else r[r.length]=String.fromCharCode((15&a)<<6|63&e[++i]);else r[r.length]=String.fromCharCode(a)}return r.join("")}function r(e){for(var t=0,n=0,r=e.length;r>n;n++){var i=e.charCodeAt(n);if(128>i)t+=1;else if(2048>i)t+=2;else if(65536>i)t+=3;else{if(!(1114112>i))throw new Error("bad codepoint "+i);t+=4}}return t}e.utf8Write=t,e.utf8Read=n,e.utf8ByteCount=r}(t=e.MessagePack||(e.MessagePack={}))}(t=e.Binary||(e.Binary={}))}(i||(i={}));var i;!function(e){var t;!function(e){function t(e){for(var t=e.data,r=e.encoding.length-1;r>=0;r--)t=n.decodeStep(t,e.encoding[r]);return t}e.decode=t;var n;!function(e){function n(e,t){switch(t.kind){case"ByteArray":switch(t.type){case 4:return e;case 1:return o(e);case 2:return u(e);case 5:return c(e);case 3:return l(e);case 6:return h(e);case 32:return f(e);case 33:return p(e);default:throw new Error("Unsupported ByteArray type.")}case"FixedPoint":return d(e,t);case"IntervalQuantization":return m(e,t);case"RunLength":return v(e,t);case"Delta":return g(e,t);case"IntegerPacking":return x(e,t);case"StringArray":return w(e,t)}}function r(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.")}}function o(e){return new Int8Array(e.buffer,e.byteOffset)}function a(e,t){for(var n=new ArrayBuffer(e.length),r=new Uint8Array(n),i=0,o=e.length;o>i;i+=t)for(var a=0;t>a;a++)r[i+t-a-1]=e[i+a];return n}function s(e,t,n){return _?new n(e.buffer):new n(a(e,t))}function u(e){return s(e,2,Int16Array)}function c(e){return s(e,2,Uint16Array)}function l(e){return s(e,4,Int32Array)}function h(e){return s(e,4,Uint32Array)}function f(e){return s(e,4,Float32Array)}function p(e){return s(e,8,Float64Array)}function d(e,t){for(var n=e.length,r=i(t.srcType,n),o=1/t.factor,a=0;n>a;a++)r[a]=o*e[a];return r}function m(e,t){for(var n=e.length,r=i(t.srcType,n),o=(t.max-t.min)/(t.numSteps-1),a=t.min,s=0;n>s;s++)r[s]=a+o*e[s];return r}function v(e,t){for(var n=r(t.srcType,t.srcSize),i=0,o=0,a=e.length;a>o;o+=2)for(var s=e[o],u=e[o+1],c=0;u>c;++c)n[i++]=s;return n}function g(e,t){var n=e.length,i=r(t.srcType,n);if(!n)return i;i[0]=e[0]+(0|t.origin);for(var o=1;n>o;++o)i[o]=e[o]+i[o-1];return i}function y(e,t){for(var n=1===t.byteCount?127:32767,r=-n-1,i=e.length,o=new Int32Array(t.srcSize),a=0,s=0;i>a;){for(var u=0,c=e[a];c===n||c===r;)u+=c,a++,c=e[a];u+=c,o[s]=u,a++,s++}return o}function b(e,t){for(var n=1===t.byteCount?255:65535,r=e.length,i=new Int32Array(t.srcSize),o=0,a=0;r>o;){for(var s=0,u=e[o];u===n;)s+=u,o++,u=e[o];s+=u,i[a]=s,o++,a++}return i}function x(e,t){return t.isUnsigned?b(e,t):y(e,t)}function w(e,n){for(var r=n.stringData,i=t({encoding:n.offsetEncoding,data:n.offsets}),o=t({encoding:n.dataEncoding,data:e}),a=new Map,s=new Array(o.length),u=0,c=0,l=o;c<l.length;c++){var h=l[c];if(0>h)s[u++]=null;else{var f=a.get(h);void 0===f&&(f=r.substring(i[h],i[h+1]),a.set(h,f)),s[u++]=f}}return s}e.decodeStep=n;var _=function(){var e=new ArrayBuffer(2),t=new Uint8Array(e),n=new Uint16Array(e);return t[0]=170,t[1]=187,48042===n[0]?!0:!1}()}(n||(n={}))}(t=e.Binary||(e.Binary={}))}(i||(i={}));var i;!function(e){var t;!function(t){function n(n){if(!n.data.data)return e.UndefinedColumn;var r=t.decode(n.data),i=void 0;return n.mask&&(i=t.decode(n.mask)),r.buffer&&r.byteLength&&r.BYTES_PER_ELEMENT?i?new c(r,i):new u(r):i?new h(r,i):new l(r)}var r=function(){function e(e){this.dataBlocks=e.dataBlocks.map(function(e){return new i(e)})}return e.prototype.toJSON=function(){return this.dataBlocks.map(function(e){return e.toJSON()})},e}();t.File=r;var i=function(){function e(e){this.additionalData={},this.header=e.header,this.categoryList=e.categories.map(function(e){return new o(e)}),this.categoryMap=new Map;for(var t=0,n=this.categoryList;t<n.length;t++){var r=n[t];this.categoryMap.set(r.name,r)}}return Object.defineProperty(e.prototype,"categories",{get:function(){return this.categoryList},enumerable:!0,configurable:!0}),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}},e}();t.DataBlock=i;var o=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,n=e.columns;t<n.length;t++){var r=n[t];this.encodedColumns.set(r.name,r),this.columnNameList.push(r.name)}}return Object.defineProperty(t.prototype,"columnNames",{get:function(){return this.columnNameList},enumerable:!0,configurable:!0}),t.prototype.getColumn=function(t){var r=this.encodedColumns.get(t);return r?n(r):e.UndefinedColumn},t.prototype.toJSON=function(){for(var e=this,t=[],n=this.columnNameList.map(function(t){return{name:t,column:e.getColumn(t)}}),r=0;r<this.rowCount;r++){for(var i={},o=0,a=n;o<a.length;o++){var s=a[o],u=s.column.getValuePresence(r);i[s.name]=0===u?s.column.getString(r):1===u?".":"?"}t[r]=i}return{name:this.name,columns:this.columnNames,rows:t}},t}();t.Category=o;var a=e.Utils.FastNumberParsers.parseInt,s=e.Utils.FastNumberParsers.parseFloat,u=function(){function e(e){this.data=e,this.isDefined=!0}return e.prototype.getString=function(e){return""+this.data[e]},e.prototype.getInteger=function(e){return 0|this.data[e]},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(){return 0},e}(),c=function(){function e(e,t){this.data=e,this.mask=t,this.isDefined=!0}return e.prototype.getString=function(e){return 0===this.mask[e]?""+this.data[e]:null},e.prototype.getInteger=function(e){return 0===this.mask[e]?this.data[e]:0},e.prototype.getFloat=function(e){return 0===this.mask[e]?this.data[e]:0},e.prototype.stringEquals=function(e,t){return 0===this.mask[e]?this.data[e]===s(t,0,t.length):null===t||void 0===t},e.prototype.areValuesEqual=function(e,t){return this.data[e]===this.data[t]},e.prototype.getValuePresence=function(e){return this.mask[e]},e}(),l=function(){function e(e){this.data=e,this.isDefined=!0}return e.prototype.getString=function(e){return this.data[e]},e.prototype.getInteger=function(e){var t=this.data[e];return a(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(){return 0},e}(),h=function(){function e(e,t){this.data=e,this.mask=t,this.isDefined=!0}return e.prototype.getString=function(e){return 0===this.mask[e]?this.data[e]:null},e.prototype.getInteger=function(e){if(0!==this.mask[e])return 0;var t=this.data[e];return a(t||"",0,(t||"").length)},e.prototype.getFloat=function(e){if(0!==this.mask[e])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]},e}()}(t=e.Binary||(e.Binary={}))}(i||(i={}));var i;!function(e){var t;!function(t){var n=function(){function e(e){this.providers=e}return e.prototype.and=function(t){return new e(this.providers.concat([t]))},e.prototype.encode=function(e){for(var t=[],n=0,r=this.providers;n<r.length;n++){var i=r[n],o=i(e);if(!o.encodings.length)throw new Error("Encodings must be non-empty.");e=o.data;for(var a=0,s=o.encodings;a<s.length;a++){var u=s[a];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}},e}();t.Encoder=n;var n;!function(n){function r(e){return new n([e])}function i(e){return{encodings:[{kind:"ByteArray",type:4}],data:e}}function o(e){return{encodings:[{kind:"ByteArray",type:1}],data:new Uint8Array(e.buffer,e.byteOffset)}}function a(e){var n=t.Encoding.getDataType(e);if(1===n)return o(e);if(4===n)return i(e);for(var r=new Uint8Array(e.length*x[n]),a=b[n],s=new DataView(r.buffer),u=0,c=e.length;c>u;u++)a(s,u,e[u]);return{encodings:[{kind:"ByteArray",type:n}],data:r}}function s(e,n){for(var r=t.Encoding.getDataType(e),i=new Int32Array(e.length),o=0,a=e.length;a>o;o++)i[o]=Math.round(e[o]*n);return{encodings:[{kind:"FixedPoint",factor:n,srcType:r}],data:i}}function u(e){return function(t){return s(t,e)}}function c(e,n,r,i){var o=t.Encoding.getDataType(e);if(!e.length)return{encodings:[{kind:"IntervalQuantization",min:n,max:r,numSteps:i,srcType:o}],data:new Int32Array(0)};if(n>r){var a=n;n=r,r=a}for(var s=(r-n)/(i-1),u=new Int32Array(e.length),c=0,l=e.length;l>c;c++){var h=e[c];u[c]=n>=h?0:h>=r?i:0|Math.round((h-n)/s)}return{encodings:[{kind:"IntervalQuantization",min:n,max:r,numSteps:i,srcType:o}],data:u}
}function l(e,t,n){return function(r){return c(r,e,t,n)}}function h(e){var n=t.Encoding.getDataType(e);if(void 0===n&&(e=new Int32Array(e),n=3),!e.length)return{encodings:[{kind:"RunLength",srcType:n,srcSize:0}],data:new Int32Array(0)};for(var r=2,i=1,o=e.length;o>i;i++)e[i-1]!==e[i]&&(r+=2);for(var a=new Int32Array(r),s=0,u=1,i=1,o=e.length;o>i;i++)e[i-1]!==e[i]?(a[s]=e[i-1],a[s+1]=u,u=1,s+=2):++u;return a[s]=e[e.length-1],a[s+1]=u,{encodings:[{kind:"RunLength",srcType:n,srcSize:e.length}],data:a}}function f(e){if(!t.Encoding.isSignedIntegerDataType(e))throw new Error("Only signed integer types can be encoded using delta encoding.");var n=t.Encoding.getDataType(e);if(void 0===n&&(e=new Int32Array(e),n=3),!e.length)return{encodings:[{kind:"Delta",origin:0,srcType:n}],data:new e.constructor(0)};var r=new e.constructor(e.length),i=e[0];r[0]=e[0];for(var o=1,a=e.length;a>o;o++)r[o]=e[o]-e[o-1];return r[0]=0,{encodings:[{kind:"Delta",origin:i,srcType:n}],data:r}}function p(e){for(var t=0,n=e.length;n>t;t++)if(e[t]<0)return!0;return!1}function d(e,t){for(var n=-t-1,r=0,i=0,o=e.length;o>i;i++){var a=e[i];r+=0===a?1:a===t||a===n?2:a>0?Math.ceil(a/t):Math.ceil(a/n)}return r}function m(e){var t=p(e),n=t?d(e,127):d(e,255),r=t?d(e,32767):d(e,65535);return 4*e.length<2*r?{isSigned:t,size:e.length,bytesPerElement:4}:n>2*r?{isSigned:t,size:r,bytesPerElement:2}:{isSigned:t,size:n,bytesPerElement:1}}function v(e,t){for(var n=t.isSigned?1===t.bytesPerElement?127:32767:1===t.bytesPerElement?255:65535,r=-n-1,i=e.length,o=t.isSigned?1===t.bytesPerElement?new Int8Array(t.size):new Int16Array(t.size):1===t.bytesPerElement?new Uint8Array(t.size):new Uint16Array(t.size),s=0,u=0;i>u;u++){var c=e[u];if(c>=0)for(;c>=n;)o[s]=n,++s,c-=n;else for(;r>=c;)o[s]=r,++s,c-=r;o[s]=c,++s}var l=a(o);return{encodings:[{kind:"IntegerPacking",byteCount:t.bytesPerElement,isUnsigned:!t.isSigned,srcSize:i},l.encodings[0]],data:l.data}}function g(e){if(!(e instanceof Int32Array))throw new Error("Integer packing can only be applied to Int32 data.");var t=m(e);return 4===t.bytesPerElement?a(e):v(e,t)}function y(t){var r=new Map,i=[],o=0,a=e.Utils.ChunkedArray.create(function(e){return new Int32Array(e)},1024,1),s=new Int32Array(t.length);e.Utils.ChunkedArray.add(a,0);for(var u=0,c=0,l=t;c<l.length;c++){var p=l[c];if(null!==p&&void 0!==p){var d=r.get(p);void 0===d&&(o+=p.length,d=i.length,i[d]=p,r.set(p,d),e.Utils.ChunkedArray.add(a,o)),s[u++]=d}else s[u++]=-1}var m=n.by(f).and(g).encode(e.Utils.ChunkedArray.compact(a)),v=n.by(f).and(h).and(g).encode(s);return{encodings:[{kind:"StringArray",dataEncoding:v.encoding,stringData:i.join(""),offsetEncoding:m.encoding,offsets:m.data}],data:v.data}}n.by=r;var b=(w={},w[2]=function(e,t,n){e.setInt16(2*t,n,!0)},w[5]=function(e,t,n){e.setUint16(2*t,n,!0)},w[3]=function(e,t,n){e.setInt32(4*t,n,!0)},w[6]=function(e,t,n){e.setUint32(4*t,n,!0)},w[32]=function(e,t,n){e.setFloat32(4*t,n,!0)},w[33]=function(e,t,n){e.setFloat64(8*t,n,!0)},w),x=(_={},_[2]=2,_[5]=2,_[3]=4,_[6]=4,_[32]=4,_[33]=8,_);n.byteArray=a,n.fixedPoint=u,n.intervalQuantizaiton=l,n.runLength=h,n.delta=f,n.integerPacking=g,n.stringArray=y;var w,_}(n=t.Encoder||(t.Encoder={}))}(t=e.Binary||(e.Binary={}))}(i||(i={}));var i;!function(e){var t;!function(e){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))throw new Error("Unsupported integer data type.");t=33}return t}function n(e){return e instanceof Int8Array||e instanceof Int16Array||e instanceof Int32Array}e.getDataType=t,e.isSignedIntegerDataType=n}(t=e.Encoding||(e.Encoding={}))}(t=e.Binary||(e.Binary={}))}(i||(i={}));var i;!function(e){var t;!function(t){function n(e,t){for(var n=0;2>n;n++)if(e[n]>t[n])return!1;return!0}function r(r){var i=[0,3];try{var o=new Uint8Array(r),a=t.MessagePack.decode(o);if(!n(i,a.version.match(/(\d)\.(\d)\.\d/).slice(1)))return e.ParserResult.error("Unsupported format version. Current "+a.version+", required "+i.join(".")+".");var s=new t.File(a);return e.ParserResult.success(s)}catch(u){return e.ParserResult.error(""+u)}}t.parse=r}(t=e.Binary||(e.Binary={}))}(i||(i={}));var i;!function(e){var t;!function(e){function t(t,n,r){var i,o=!1;t.typedArray?i=new t.typedArray(r):(o=!0,i=new Array(r));for(var a=new Uint8Array(r),s=t.presence,u=t.number?t.number:t.string,c=!0,l=0,h=0,f=n;h<f.length;h++)for(var p=f[h],d=p.data,m=0,v=p.count;v>m;m++){var g=void 0;s&&0!==(g=s(d,m))?(a[l]=g,o&&(i[l]=null),c=!1):(a[l]=0,i[l]=u(d,m)),l++}var y=t.encoder?t.encoder:e.Encoder.by(e.Encoder.stringArray),b=y.encode(i),x=void 0;if(!c){var w=e.Encoder.by(e.Encoder.runLength).and(e.Encoder.byteArray).encode(a);x=w.data.length<a.length?w:e.Encoder.by(e.Encoder.byteArray).encode(a)}return{name:t.name,data:b,mask:x}}var n=function(){function n(t){this.dataBlocks=[],this.data={encoder:t,version:e.VERSION,dataBlocks:this.dataBlocks}}return n.prototype.startDataBlock=function(e){this.dataBlocks.push({header:(e||"").replace(/[ \n\t]/g,"").toUpperCase(),categories:[]})},n.prototype.writeCategory=function(e,n){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 r=n&&n.length?n.map(function(t){return e(t)}):[e(void 0)],i=r.filter(function(e){return e&&e.count>0});if(i.length){var o=i.reduce(function(e,t){return e+t.count},0);if(o){for(var a=i[0],s={name:a.desc.name,columns:[],rowCount:o},u=i.map(function(e){return{data:e.data,count:e.count}}),c=0,l=a.desc.fields;c<l.length;c++){var h=l[c];s.columns.push(t(h,u,o))}this.dataBlocks[this.dataBlocks.length-1].categories.push(s)}}},n.prototype.encode=function(){this.encodedData=e.MessagePack.encode(this.data),this.data=null,this.dataBlocks=null},n.prototype.flush=function(e){e.writeBinary(this.encodedData)},n}();e.Writer=n}(t=e.Binary||(e.Binary={}))}(i||(i={}));var o={};(function(e,t,n){function r(e){return e&&e.Object===Object?e:null}function i(e){for(var t=e.length,n=new Array(t),r=0;t>r;r++)n[r]=e[r];return n}function o(e){return function(){try{return e.apply(this,arguments)}catch(t){return Ct.e=t,Ct}}}function a(e){throw e}function s(e,t){if(St&&t.stack&&"object"==typeof e&&null!==e&&e.stack&&-1===e.stack.indexOf(Pt)){for(var n=[],r=t;r;r=r.source)r.stack&&n.unshift(r.stack);n.unshift(e.stack);var i=n.join("\n"+Pt+"\n");e.stack=u(i)}}function u(e){for(var t=e.split("\n"),n=[],r=0,i=t.length;i>r;r++){var o=t[r];c(o)||l(o)||!o||n.push(o)}return n.join("\n")}function c(e){var t=f(e);if(!t)return!1;var n=t[0],r=t[1];return n===Tt&&r>=At&&xo>=r}function l(e){return-1!==e.indexOf("(module.js:")||-1!==e.indexOf("(node.js:")}function h(){if(St)try{throw new Error}catch(e){var t=e.stack.split("\n"),n=t[0].indexOf("@")>0?t[1]:t[2],r=f(n);if(!r)return;return Tt=r[0],r[1]}}function f(e){var t=/at .+ \((.+):(\d+):(?:\d+)\)$/.exec(e);if(t)return[t[1],Number(t[2])];var n=/at ([^ ]+):(\d+):(?:\d+)$/.exec(e);if(n)return[n[1],Number(n[2])];var r=/.*@(.+):(\d+)$/.exec(e);return r?[r[1],Number(r[2])]:void 0}function p(e,t,r,i,o,a){var s=gn(e),u=s.length,c=gn(t),l=c.length;if(u!==l&&!i)return!1;for(var h,f=u;f--;)if(h=s[f],!(i?h in t:dn.call(t,h)))return!1;for(var p=i;++f<u;){h=s[f];var d,m=e[h],v=t[h];if(!(d===n?r(m,v,i,o,a):d))return!1;p||(p="constructor"===h)}if(!p){var g=e.constructor,y=t.constructor;if(g!==y&&"constructor"in e&&"constructor"in t&&!("function"==typeof g&&g instanceof g&&"function"==typeof y&&y instanceof y))return!1}return!0}function d(e,t,n){switch(n){case jt:case Gt:return+e===+t;case Wt:return e.name===t.name&&e.message===t.message;case Yt:return e!==+e?t!==+t:e===+t;case Qt:case Jt:return e===t+""}return!1}function m(e){return!!e&&"object"==typeof e}function v(e){return"number"==typeof e&&e>-1&&e%1===0&&vn>=e}function g(e){return m(e)&&v(e.length)&&!!fn[mn.call(e)]}function y(e,t){for(var n=-1,r=e.length;++n<r;)if(t(e[n],n,e))return!0;return!1}function b(e,t,r,i,o,a){var s=-1,u=e.length,c=t.length;if(u!==c&&!(i&&c>u))return!1;for(;++s<u;){var l,h=e[s],f=t[s];if(l!==n){if(l)continue;return!1}if(i){if(!y(t,function(e){return h===e||r(h,e,i,o,a)}))return!1}else if(h!==f&&!r(h,f,i,o,a))return!1}return!0}function x(e,t,n,r,i,o){var a=xn(e),s=xn(t),u=Ht,c=Ht;a||(u=mn.call(e),u===$t?u=Kt:u!==Kt&&(a=g(e))),s||(c=mn.call(t),c===$t&&(c=Kt));var l=u===Kt&&!bn(e),h=c===Kt&&!bn(t),f=u===c;if(f&&!a&&!l)return d(e,t,u);if(!r){var m=l&&dn.call(e,"__wrapped__"),v=h&&dn.call(t,"__wrapped__");if(m||v)return n(m?e.value():e,v?t.value():t,r,i,o)}if(!f)return!1;i||(i=[]),o||(o=[]);for(var y=i.length;y--;)if(i[y]===e)return o[y]===t;i.push(e),o.push(t);var x=(a?b:p)(e,t,n,r,i,o);return i.pop(),o.pop(),x}function w(e,t,n,r,i){return e===t?!0:null==e||null==t||!yn(e)&&!m(t)?e!==e&&t!==t:x(e,t,w,n,r,i)}function _(e,t){for(var n=new Array(e),r=0;e>r;r++)n[r]=t();return n}function C(e,t){this.id=e,this.value=t}function E(e){this._s=e,this.isDisposed=!1}function S(e){this._s=e}function M(e){this._s=e,this._l=e.length,this._i=0}function T(e){this._a=e}function A(e){this._a=e,this._l=I(e),this._i=0}function P(e){return"number"==typeof e&&pt.isFinite(e)}function k(e){var t,r=e[Lt];if(!r&&"string"==typeof e)return t=new S(e),t[Lt]();if(!r&&e.length!==n)return t=new T(e),t[Lt]();if(!r)throw new TypeError("Object is not iterable");return e[Lt]()}function R(e){var t=+e;return 0===t?t:isNaN(t)?t:0>t?-1:1}function I(e){var t=+e.length;return isNaN(t)?0:0!==t&&P(t)?(t=R(t)*Math.floor(Math.abs(t)),0>=t?0:t>Pr?Pr:t):t}function D(e,t){return Fn(e)||(e=Gn),new Rr(t,e)}function B(e,t){this.observer=e,this.parent=t}function V(){return!1}function L(){for(var e=arguments.length,t=new Array(e),n=0;e>n;n++)t[n]=arguments[n];return t}function V(){return!1}function L(){for(var e=arguments.length,t=new Array(e),n=0;e>n;n++)t[n]=arguments[n];return t}function V(){return!1}function N(){return[]}function V(){return!1}function N(){return[]}function L(){for(var e=arguments.length,t=new Array(e),n=0;e>n;n++)t[n]=arguments[n];return t}function O(e){return function(t){return e.subscribe(t)}}function F(e){return{"@@iterator":function(){return{next:function(){return{done:!1,value:e}}}}}}function F(e){return{"@@iterator":function(){return{next:function(){return{done:!1,value:e}}}}}}function U(e,t){return function(r){for(var i=r,o=0;t>o;o++){var a=i[e[o]];if("undefined"==typeof a)return n;i=a}return i}}function z(e,t,n,r){var i=new vo;return r.push($(i,t,n)),e.apply(t,r),i.asObservable()}function $(e,t,n){return function(){for(var r=arguments.length,i=new Array(r),o=0;r>o;o++)i[o]=arguments[o];if(_t(n)){if(i=Et(n).apply(t,i),i===Ct)return e.onError(i.e);e.onNext(i)}else i.length<=1?e.onNext(i[0]):e.onNext(i);e.onCompleted()}}function H(e,t,n,r){var i=new vo;return r.push(j(i,t,n)),e.apply(t,r),i.asObservable()}function j(e,t,n){return function(){var r=arguments[0];if(r)return e.onError(r);for(var i=arguments.length,o=[],a=1;i>a;a++)o[a-1]=arguments[a];if(_t(n)){var o=Et(n).apply(t,o);if(o===Ct)return e.onError(o.e);e.onNext(o)}else o.length<=1?e.onNext(o[0]):e.onNext(o);e.onCompleted()}}function G(e){return pt.StaticNodeList?e instanceof pt.StaticNodeList||e instanceof pt.NodeList:"[object NodeList]"===Object.prototype.toString.call(e)}function W(e,t,n){this._e=e,this._n=t,this._fn=n,this._e.addEventListener(this._n,this._fn,!1),this.isDisposed=!1}function q(e,t,n){var r=new En,i=Object.prototype.toString.call(e);if(G(e)||"[object HTMLCollection]"===i)for(var o=0,a=e.length;a>o;o++)r.add(q(e.item(o),t,n));else e&&r.add(new W(e,t,n));return r}function X(e,t){return new Ki(e,t)}function Y(e,t,n){return new ho(function(r){var i=e,o=On(t);return n.scheduleRecursiveFuture(0,i,function(e,t){if(o>0){var a=n.now();i=new Date(i.getTime()+o),i.getTime()<=a&&(i=new Date(a+o))}r.onNext(e),t(e+1,new Date(i))})})}function K(e,t,n){return e===t?new ho(function(e){return n.schedulePeriodic(0,t,function(t){return e.onNext(t),t+1})}):Er(function(){return Y(new Date(n.now()+e),t,n)})}function Q(e,t,n){return new ho(function(r){var i,o=!1,a=new Dn,s=null,u=[],c=!1;return i=e.materialize().timestamp(n).subscribe(function(e){var i,l;"E"===e.value.kind?(u=[],u.push(e),s=e.value.error,l=!c):(u.push({value:e.value,timestamp:e.timestamp+t}),l=!o,o=!0),l&&(null!==s?r.onError(s):(i=new In,a.setDisposable(i),i.setDisposable(n.scheduleRecursiveFuture(null,t,function(e,t){var i,a,l,h;if(null===s){c=!0;do l=null,u.length>0&&u[0].timestamp-n.now()<=0&&(l=u.shift().value),null!==l&&l.accept(r);while(null!==l);h=!1,a=0,u.length>0?(h=!0,a=Math.max(0,u[0].timestamp-n.now())):o=!1,i=s,c=!1,null!==i?r.onError(i):h&&t(null,a)}}))))}),new Bn(i,a)},e)}function Z(e,t,n){return Er(function(){return Q(e,t-n.now(),n)})}function J(e,t,n){var r,i;return _t(t)?i=t:(r=t,i=n),new ho(function(t){function n(){u.setDisposable(e.subscribe(function(e){var n=Et(i)(e);if(n===Ct)return t.onError(n.e);var r=new In;a.add(r),r.setDisposable(n.subscribe(function(){t.onNext(e),a.remove(r),o()},function(e){t.onError(e)},function(){t.onNext(e),a.remove(r),o()}))},function(e){t.onError(e)},function(){s=!0,u.dispose(),o()}))}function o(){s&&0===a.length&&t.onCompleted()}var a=new En,s=!1,u=new Dn;return r?u.setDisposable(r.subscribe(n,function(e){t.onError(e)},n)):n(),new Bn(u,a)},e)}function et(e,t){return new ho(function(n){var r,i=!1,o=new Dn,a=0,s=e.subscribe(function(e){var s=Et(t)(e);if(s===Ct)return n.onError(s.e);wt(s)&&(s=Wi(s)),i=!0,r=e,a++;var u=a,c=new In;o.setDisposable(c),c.setDisposable(s.subscribe(function(){i&&a===u&&n.onNext(r),i=!1,c.dispose()},function(e){n.onError(e)},function(){i&&a===u&&n.onNext(r),i=!1,c.dispose()}))},function(e){o.dispose(),n.onError(e),i=!1,a++},function(){o.dispose(),i&&n.onNext(r),n.onCompleted(),i=!1,a++});return new Bn(s,o)},e)}function tt(e,t,n,r){return _t(t)&&(r=n,n=t,t=Vr()),hr.isObservable(r)||(r=zr(new oo)),new ho(function(i){function o(e){function t(){return h=n===l}var n=l,o=new In;u.setDisposable(o),o.setDisposable(e.subscribe(function(){t()&&s.setDisposable(r.subscribe(i)),o.dispose()},function(e){t()&&i.onError(e)},function(){t()&&s.setDisposable(r.subscribe(i))}))}function a(){var e=!h;return e&&l++,e}var s=new Dn,u=new Dn,c=new In;s.setDisposable(c);var l=0,h=!1;return o(t),c.setDisposable(e.subscribe(function(e){if(a()){i.onNext(e);var t=Et(n)(e);if(t===Ct)return i.onError(t.e);o(wt(t)?Wi(t):t)}},function(e){a()&&i.onError(e)},function(){a()&&i.onCompleted()})),new Bn(s,u)},e)}function nt(e,t,n,r){return Fn(n)&&(r=n,n=zr(new oo)),n instanceof Error&&(n=zr(n)),Fn(r)||(r=Kn),hr.isObservable(n)||(n=zr(new oo)),new ho(function(i){function o(){var e=a;l.setDisposable(r.scheduleFuture(null,t,function(){c=a===e,c&&(wt(n)&&(n=Wi(n)),u.setDisposable(n.subscribe(i)))}))}var a=0,s=new In,u=new Dn,c=!1,l=new Dn;return u.setDisposable(s),o(),s.setDisposable(e.subscribe(function(e){c||(a++,i.onNext(e),o())},function(e){c||(a++,i.onError(e))},function(){c||(a++,i.onCompleted())})),new Bn(u,l)},e)}function rt(e,t,n){return new ho(function(r){function i(e,t){if(c[t]=e,a[t]=!0,s||(s=a.every(vt))){if(o)return r.onError(o);var i=Et(n).apply(null,c);if(i===Ct)return r.onError(i.e);r.onNext(i)}u&&c[1]&&r.onCompleted()}var o,a=[!1,!1],s=!1,u=!1,c=new Array(2);return new Bn(e.subscribe(function(e){i(e,0)},function(e){c[1]?r.onError(e):o=e},function(){u=!0,c[1]&&r.onCompleted()}),t.subscribe(function(e){i(e,1)},function(e){r.onError(e)},function(){u=!0,i(!0,1)}))},e)}function it(e){return{"@@transducer/init":function(){return e},"@@transducer/step":function(e,t){return e.onNext(t)},"@@transducer/result":function(e){return e.onCompleted()}}}var ot={"function":!0,object:!0},at=ot[typeof exports]&&exports&&!exports.nodeType?exports:null,st=ot[typeof module]&&module&&!module.nodeType?module:null,ut=r(at&&st&&"object"==typeof global&&global),ct=r(ot[typeof self]&&self),lt=r(ot[typeof window]&&window),ht=st&&st.exports===at?at:null,ft=r(ot[typeof this]&&this),pt=ut||lt!==(ft&&ft.window)&<||ct||ft||Function("return this")(),dt={internals:{},config:{Promise:t},helpers:{}},mt=dt.helpers.noop=function(){},vt=dt.helpers.identity=function(e){return e},gt=dt.helpers.defaultNow=Date.now,yt=dt.helpers.defaultComparer=function(e,t){return wn(e,t)},bt=dt.helpers.defaultSubComparer=function(e,t){return e>t?1:t>e?-1:0},xt=(dt.helpers.defaultKeySerializer=function(e){return e.toString()},dt.helpers.defaultError=function(e){throw e}),wt=dt.helpers.isPromise=function(e){return!!e&&"function"!=typeof e.subscribe&&"function"==typeof e.then},_t=dt.helpers.isFunction=function(){var e=function(e){return"function"==typeof e||!1};return e(/x/)&&(e=function(e){return"function"==typeof e&&"[object Function]"==toString.call(e)}),e}(),Ct={e:{}},Et=dt.internals.tryCatch=function(e){if(!_t(e))throw new TypeError("fn must be a function");return o(e)};dt.config.longStackSupport=!1;var St=!1,Mt=Et(function(){throw new Error})();St=!!Mt.e&&!!Mt.e.stack;var Tt,At=h(),Pt="From previous event:",kt=dt.EmptyError=function(){this.message="Sequence contains no elements.",Error.call(this)};kt.prototype=Object.create(Error.prototype),kt.prototype.name="EmptyError";var Rt=dt.ObjectDisposedError=function(){this.message="Object has been disposed",Error.call(this)};Rt.prototype=Object.create(Error.prototype),Rt.prototype.name="ObjectDisposedError";var It=dt.ArgumentOutOfRangeError=function(){this.message="Argument out of range",Error.call(this)};It.prototype=Object.create(Error.prototype),It.prototype.name="ArgumentOutOfRangeError";var Dt=dt.NotSupportedError=function(e){this.message=e||"This operation is not supported",Error.call(this)};Dt.prototype=Object.create(Error.prototype),Dt.prototype.name="NotSupportedError";var Bt=dt.NotImplementedError=function(e){this.message=e||"This operation is not implemented",Error.call(this)};Bt.prototype=Object.create(Error.prototype),Bt.prototype.name="NotImplementedError";var Vt=dt.helpers.notImplemented=function(){throw new Bt},Lt=(dt.helpers.notSupported=function(){throw new Dt},"function"==typeof Symbol&&Symbol.iterator||"_es6shim_iterator_");pt.Set&&"function"==typeof(new pt.Set)["@@iterator"]&&(Lt="@@iterator");var Nt=dt.doneEnumerator={done:!0,value:n},Ot=dt.helpers.isIterable=function(e){return e&&e[Lt]!==n},Ft=dt.helpers.isArrayLike=function(e){return e&&e.length!==n};dt.helpers.iterator=Lt;var Ut=dt.internals.bindCallback=function(e,t,n){if("undefined"==typeof t)return e;switch(n){case 0:return function(){return e.call(t)};case 1:return function(n){return e.call(t,n)};case 2:return function(n,r){return e.call(t,n,r)};case 3:return function(n,r,i){return e.call(t,n,r,i)}}return function(){return e.apply(t,arguments)}},zt=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],$t=(zt.length,"[object Arguments]"),Ht="[object Array]",jt="[object Boolean]",Gt="[object Date]",Wt="[object Error]",qt="[object Function]",Xt="[object Map]",Yt="[object Number]",Kt="[object Object]",Qt="[object RegExp]",Zt="[object Set]",Jt="[object String]",en="[object WeakMap]",tn="[object ArrayBuffer]",nn="[object Float32Array]",rn="[object Float64Array]",on="[object Int8Array]",an="[object Int16Array]",sn="[object Int32Array]",un="[object Uint8Array]",cn="[object Uint8ClampedArray]",ln="[object Uint16Array]",hn="[object Uint32Array]",fn={};fn[nn]=fn[rn]=fn[on]=fn[an]=fn[sn]=fn[un]=fn[cn]=fn[ln]=fn[hn]=!0,fn[$t]=fn[Ht]=fn[tn]=fn[jt]=fn[Gt]=fn[Wt]=fn[qt]=fn[Xt]=fn[Yt]=fn[Kt]=fn[Qt]=fn[Zt]=fn[Jt]=fn[en]=!1;var pn=Object.prototype,dn=pn.hasOwnProperty,mn=pn.toString,vn=Math.pow(2,53)-1,gn=Object.keys||function(){var e=Object.prototype.hasOwnProperty,t=!{toString:null}.propertyIsEnumerable("toString"),n=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],r=n.length;return function(i){if("object"!=typeof i&&("function"!=typeof i||null===i))throw new TypeError("Object.keys called on non-object");var o,a,s=[];for(o in i)e.call(i,o)&&s.push(o);if(t)for(a=0;r>a;a++)e.call(i,n[a])&&s.push(n[a]);return s}}(),yn=dt.internals.isObject=function(e){var t=typeof e;return!!e&&("object"===t||"function"===t)},bn=function(){try{Object({toString:0}+"")}catch(e){return function(){return!1}}return function(e){return"function"!=typeof e.toString&&"string"==typeof(e+"")}}(),xn=Array.isArray||function(e){return m(e)&&v(e.length)&&mn.call(e)===Ht},wn=dt.internals.isEqual=function(e,t){return w(e,t)},_n=({}.hasOwnProperty,Array.prototype.slice,dt.internals.inherits=function(e,t){function n(){this.constructor=e}n.prototype=t.prototype,e.prototype=new n}),Cn=dt.internals.addProperties=function(e){for(var t=[],n=1,r=arguments.length;r>n;n++)t.push(arguments[n]);for(var i=0,o=t.length;o>i;i++){var a=t[i];for(var s in a)e[s]=a[s]}},En=(dt.internals.addRef=function(e,t){return new ho(function(n){return new Bn(t.getDisposable(),e.subscribe(n))})},dt.CompositeDisposable=function(){var e,t,n=[];if(Array.isArray(arguments[0]))n=arguments[0];else for(t=arguments.length,n=new Array(t),e=0;t>e;e++)n[e]=arguments[e];this.disposables=n,this.isDisposed=!1,this.length=n.length}),Sn=En.prototype;Sn.add=function(e){this.isDisposed?e.dispose():(this.disposables.push(e),this.length++)},Sn.remove=function(e){var t=!1;if(!this.isDisposed){var n=this.disposables.indexOf(e);-1!==n&&(t=!0,this.disposables.splice(n,1),this.length--,e.dispose())}return t},Sn.dispose=function(){if(!this.isDisposed){this.isDisposed=!0;for(var e=this.disposables.length,t=new Array(e),n=0;e>n;n++)t[n]=this.disposables[n];for(this.disposables=[],this.length=0,n=0;e>n;n++)t[n].dispose()}};var Mn=dt.Disposable=function(e){this.isDisposed=!1,this.action=e||mt};Mn.prototype.dispose=function(){this.isDisposed||(this.action(),this.isDisposed=!0)};var Tn=Mn.create=function(e){return new Mn(e)},An=Mn.empty={dispose:mt},Pn=Mn.isDisposable=function(e){return e&&_t(e.dispose)},kn=Mn.checkDisposed=function(e){if(e.isDisposed)throw new Rt},Rn=Mn._fixup=function(e){return Pn(e)?e:An},In=dt.SingleAssignmentDisposable=function(){this.isDisposed=!1,this.current=null};In.prototype.getDisposable=function(){return this.current},In.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()},In.prototype.dispose=function(){if(!this.isDisposed){this.isDisposed=!0;var e=this.current;this.current=null,e&&e.dispose()}};var Dn=dt.SerialDisposable=function(){this.isDisposed=!1,this.current=null};Dn.prototype.getDisposable=function(){return this.current},Dn.prototype.setDisposable=function(e){var t=this.isDisposed;if(!t){var n=this.current;this.current=e}n&&n.dispose(),t&&e&&e.dispose()},Dn.prototype.dispose=function(){if(!this.isDisposed){this.isDisposed=!0;var e=this.current;this.current=null}e&&e.dispose()};var Bn=dt.BinaryDisposable=function(e,t){this._first=e,this._second=t,this.isDisposed=!1};Bn.prototype.dispose=function(){if(!this.isDisposed){this.isDisposed=!0;var e=this._first;this._first=null,e&&e.dispose();var t=this._second;this._second=null,t&&t.dispose()}};var Vn=dt.NAryDisposable=function(e){this._disposables=e,this.isDisposed=!1};Vn.prototype.dispose=function(){if(!this.isDisposed){this.isDisposed=!0;for(var e=0,t=this._disposables.length;t>e;e++)this._disposables[e].dispose();this._disposables.length=0}};var Ln=(dt.RefCountDisposable=function(){function e(e){this.disposable=e,this.disposable.count++,this.isInnerDisposed=!1}function t(e){this.underlyingDisposable=e,this.isDisposed=!1,this.isPrimaryDisposed=!1,this.count=0}return e.prototype.dispose=function(){this.disposable.isDisposed||this.isInnerDisposed||(this.isInnerDisposed=!0,this.disposable.count--,0===this.disposable.count&&this.disposable.isPrimaryDisposed&&(this.disposable.isDisposed=!0,this.disposable.underlyingDisposable.dispose()))},t.prototype.dispose=function(){this.isDisposed||this.isPrimaryDisposed||(this.isPrimaryDisposed=!0,0===this.count&&(this.isDisposed=!0,this.underlyingDisposable.dispose()))},t.prototype.getDisposable=function(){return this.isDisposed?An:new e(this)},t}(),dt.internals.ScheduledItem=function(e,t,n,r,i){this.scheduler=e,this.state=t,this.action=n,this.dueTime=r,this.comparer=i||bt,this.disposable=new In});Ln.prototype.invoke=function(){this.disposable.setDisposable(this.invokeCore())},Ln.prototype.compareTo=function(e){return this.comparer(this.dueTime,e.dueTime)},Ln.prototype.isCancelled=function(){return this.disposable.isDisposed},Ln.prototype.invokeCore=function(){return Rn(this.action(this.scheduler,this.state))};var Nn=dt.Scheduler=function(){function e(){}e.isScheduler=function(t){return t instanceof e};var t=e.prototype;return t.schedule=function(){throw new Bt},t.scheduleFuture=function(t,n,r){var i=n;return i instanceof Date&&(i-=this.now()),i=e.normalize(i),0===i?this.schedule(t,r):this._scheduleFuture(t,i,r)},t._scheduleFuture=function(){throw new Bt},e.now=gt,e.prototype.now=gt,e.normalize=function(e){return 0>e&&(e=0),e},e}(),On=Nn.normalize,Fn=Nn.isScheduler;!function(e){function t(e,t){function n(t){function r(e,t){return a?o.remove(u):s=!0,i(t,n),An}var a=!1,s=!1,u=e.schedule(t,r);s||(o.add(u),a=!0)}var r=t[0],i=t[1],o=new En;return i(r,n),o}function n(e,t){function n(t,r){function a(e,t){return s?o.remove(c):u=!0,i(t,n),An}var s=!1,u=!1,c=e.scheduleFuture(t,r,a);u||(o.add(c),s=!0)}var r=t[0],i=t[1],o=new En;return i(r,n),o}e.scheduleRecursive=function(e,n){return this.schedule([e,n],t)},e.scheduleRecursiveFuture=function(e,t,r){return this.scheduleFuture([e,r],t,n)}}(Nn.prototype),function(e){e.schedulePeriodic=function(e,t,n){if("undefined"==typeof pt.setInterval)throw new Dt;t=On(t);var r=e,i=pt.setInterval(function(){r=n(r)},t);return Tn(function(){pt.clearInterval(i)})}}(Nn.prototype);var Un,zn,$n=function(e){function t(){e.call(this)}return _n(t,e),t.prototype.schedule=function(e,t){return Rn(t(this,e))},t}(Nn),Hn=Nn.immediate=new $n,jn=function(e){function t(){for(;r.length>0;){var e=r.dequeue();!e.isCancelled()&&e.invoke()}}function n(){e.call(this)}var r;return _n(n,e),n.prototype.schedule=function(e,n){var i=new Ln(this,e,n,this.now());if(r)r.enqueue(i);else{r=new Qn(4),r.enqueue(i);var o=Et(t)();r=null,o===Ct&&a(o.e)}return i.disposable},n.prototype.scheduleRequired=function(){return!r},n}(Nn),Gn=Nn.currentThread=new jn,Wn=(dt.internals.SchedulePeriodicRecursive=function(){function e(e){return function(t,n){n(0,e._period);var r=Et(e._action)(e._state);r===Ct&&(e._cancel.dispose(),a(r.e)),e._state=r}}function t(e,t,n,r){this._scheduler=e,this._state=t,this._period=n,this._action=r}return t.prototype.start=function(){var t=new In;return this._cancel=t,t.setDisposable(this._scheduler.scheduleRecursiveFuture(0,this._period,e(this))),t},t}(),function(){var e,t=mt;if(pt.setTimeout)e=pt.setTimeout,t=pt.clearTimeout;else{if(!pt.WScript)throw new Dt;e=function(e,t){pt.WScript.Sleep(t),e()}}return{setTimeout:e,clearTimeout:t}}()),qn=Wn.setTimeout,Xn=Wn.clearTimeout;!function(){function e(t){if(i)qn(function(){e(t)},0);else{var n=r[t];if(n){i=!0;var o=Et(n)();zn(t),i=!1,o===Ct&&a(o.e)}}}function t(){if(!pt.postMessage||pt.importScripts)return!1;var e=!1,t=pt.onmessage;return pt.onmessage=function(){e=!0},pt.postMessage("","*"),pt.onmessage=t,e}var n=1,r={},i=!1;zn=function(e){delete r[e]};var o=new RegExp("^"+String(toString).replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/toString| for [^\]]+/g,".*?")+"$"),s="function"==typeof(s=ut&&ht&&ut.setImmediate)&&!o.test(s)&&s;if(_t(s))Un=function(t){var i=n++;return r[i]=t,s(function(){e(i)}),i};else if("undefined"!=typeof process&&"[object process]"==={}.toString.call(process))Un=function(t){var i=n++;return r[i]=t,process.nextTick(function(){e(i)}),i};else if(t()){var u="ms.rx.schedule"+Math.random(),c=function(t){"string"==typeof t.data&&t.data.substring(0,u.length)===u&&e(t.data.substring(u.length))};pt.addEventListener("message",c,!1),Un=function(e){var t=n++;return r[t]=e,pt.postMessage(u+t,"*"),t}}else if(pt.MessageChannel){var l=new pt.MessageChannel;l.port1.onmessage=function(t){e(t.data)},Un=function(e){var t=n++;return r[t]=e,l.port2.postMessage(t),t}}else Un="document"in pt&&"onreadystatechange"in pt.document.createElement("script")?function(t){var i=pt.document.createElement("script"),o=n++;return r[o]=t,i.onreadystatechange=function(){e(o),i.onreadystatechange=null,i.parentNode.removeChild(i),i=null},pt.document.documentElement.appendChild(i),o}:function(t){var i=n++;return r[i]=t,qn(function(){e(i)},0),i}}();var Yn=function(e){function t(){e.call(this)}function n(e,t,n,r){return function(){e.setDisposable(Mn._fixup(t(n,r)))}}function r(e){this._id=e,this.isDisposed=!1}function i(e){this._id=e,this.isDisposed=!1}function o(e,t,n){return function(){t(e,n)}}return _n(t,e),r.prototype.dispose=function(){this.isDisposed||(this.isDisposed=!0,zn(this._id))},i.prototype.dispose=function(){this.isDisposed||(this.isDisposed=!0,Xn(this._id))},t.prototype.schedule=function(e,t){var i=new In,o=Un(n(i,t,this,e));return new Bn(i,new r(o))},t.prototype._scheduleFuture=function(e,t,r){if(0===t)return this.schedule(e,r);var o=new In,a=qn(n(o,r,this,e),t);return new Bn(o,new i(a))},t.prototype.scheduleLongRunning=function(e,t){var n=Tn(mt);return Un(o(e,t,n)),n},t}(Nn),Kn=Nn["default"]=Nn.async=new Yn;C.prototype.compareTo=function(e){var t=this.value.compareTo(e.value);return 0===t&&(t=this.id-e.id),t};var Qn=dt.internals.PriorityQueue=function(e){this.items=new Array(e),this.length=0},Zn=Qn.prototype;Zn.isHigherPriority=function(e,t){return this.items[e].compareTo(this.items[t])<0},Zn.percolate=function(e){if(!(e>=this.length||0>e)){var t=e-1>>1;if(!(0>t||t===e)&&this.isHigherPriority(e,t)){var n=this.items[e];this.items[e]=this.items[t],this.items[t]=n,this.percolate(t)}}},Zn.heapify=function(e){if(+e||(e=0),!(e>=this.length||0>e)){var t=2*e+1,n=2*e+2,r=e;if(t<this.length&&this.isHigherPriority(t,r)&&(r=t),n<this.length&&this.isHigherPriority(n,r)&&(r=n),r!==e){var i=this.items[e];this.items[e]=this.items[r],this.items[r]=i,this.heapify(r)}}},Zn.peek=function(){return this.items[0].value},Zn.removeAt=function(e){this.items[e]=this.items[--this.length],this.items[this.length]=n,this.heapify()},Zn.dequeue=function(){var e=this.peek();return this.removeAt(0),e},Zn.enqueue=function(e){var t=this.length++;this.items[t]=new C(Qn.count++,e),this.percolate(t)},Zn.remove=function(e){for(var t=0;t<this.length;t++)if(this.items[t].value===e)return this.removeAt(t),!0;return!1},Qn.count=0;var Jn,er=dt.Notification=function(){function e(){}return e.prototype._accept=function(){throw new Bt},e.prototype._acceptObserver=function(){throw new Bt},e.prototype.accept=function(e,t,n){return e&&"object"==typeof e?this._acceptObserver(e):this._accept(e,t,n)},e.prototype.toObservable=function(e){var t=this;return Fn(e)||(e=Hn),new ho(function(n){return e.schedule(t,function(e,t){t._acceptObserver(n),"N"===t.kind&&n.onCompleted()})})},e}(),tr=function(e){function t(e){this.value=e,this.kind="N"}return _n(t,e),t.prototype._accept=function(e){return e(this.value)},t.prototype._acceptObserver=function(e){return e.onNext(this.value)},t.prototype.toString=function(){return"OnNext("+this.value+")"},t}(er),nr=function(e){function t(e){this.error=e,this.kind="E"}return _n(t,e),t.prototype._accept=function(e,t){return t(this.error)},t.prototype._acceptObserver=function(e){return e.onError(this.error)},t.prototype.toString=function(){return"OnError("+this.error+")"},t}(er),rr=function(e){function t(){this.kind="C"}return _n(t,e),t.prototype._accept=function(e,t,n){return n()},t.prototype._acceptObserver=function(e){return e.onCompleted()},t.prototype.toString=function(){return"OnCompleted()"},t}(er),ir=er.createOnNext=function(e){return new tr(e)},or=er.createOnError=function(e){return new nr(e)},ar=er.createOnCompleted=function(){return new rr
},sr=dt.Observer=function(){},ur=sr.create=function(e,t,n){return e||(e=mt),t||(t=xt),n||(n=mt),new lr(e,t,n)},cr=dt.internals.AbstractObserver=function(e){function t(){this.isStopped=!1}return _n(t,e),t.prototype.next=Vt,t.prototype.error=Vt,t.prototype.completed=Vt,t.prototype.onNext=function(e){!this.isStopped&&this.next(e)},t.prototype.onError=function(e){this.isStopped||(this.isStopped=!0,this.error(e))},t.prototype.onCompleted=function(){this.isStopped||(this.isStopped=!0,this.completed())},t.prototype.dispose=function(){this.isStopped=!0},t.prototype.fail=function(e){return this.isStopped?!1:(this.isStopped=!0,this.error(e),!0)},t}(sr),lr=dt.AnonymousObserver=function(e){function t(t,n,r){e.call(this),this._onNext=t,this._onError=n,this._onCompleted=r}return _n(t,e),t.prototype.next=function(e){this._onNext(e)},t.prototype.error=function(e){this._onError(e)},t.prototype.completed=function(){this._onCompleted()},t}(cr),hr=dt.Observable=function(){function e(e,t){return function(n){var r=n.onError;return n.onError=function(t){s(t,e),r.call(n,t)},t.call(e,n)}}function t(){if(dt.config.longStackSupport&&St){var t=this._subscribe,n=Et(a)(new Error).e;this.stack=n.stack.substring(n.stack.indexOf("\n")+1),this._subscribe=e(this,t)}}return Jn=t.prototype,t.isObservable=function(e){return e&&_t(e.subscribe)},Jn.subscribe=Jn.forEach=function(e,t,n){return this._subscribe("object"==typeof e?e:ur(e,t,n))},Jn.subscribeOnNext=function(e,t){return this._subscribe(ur("undefined"!=typeof t?function(n){e.call(t,n)}:e))},Jn.subscribeOnError=function(e,t){return this._subscribe(ur(null,"undefined"!=typeof t?function(n){e.call(t,n)}:e))},Jn.subscribeOnCompleted=function(e,t){return this._subscribe(ur(null,null,"undefined"!=typeof t?function(){e.call(t)}:e))},t}(),fr=dt.internals.ScheduledObserver=function(e){function t(t,n){e.call(this),this.scheduler=t,this.observer=n,this.isAcquired=!1,this.hasFaulted=!1,this.queue=[],this.disposable=new Dn}function n(e,t){return function(){e.onNext(t)}}function r(e,t){return function(){e.onError(t)}}function i(e){return function(){e.onCompleted()}}function o(e,t){var n;if(!(e.queue.length>0))return e.isAcquired=!1,void 0;n=e.queue.shift();var r=Et(n)();return r===Ct?(e.queue=[],e.hasFaulted=!0,a(r.e)):(t(e),void 0)}return _n(t,e),t.prototype.next=function(e){this.queue.push(n(this.observer,e))},t.prototype.error=function(e){this.queue.push(r(this.observer,e))},t.prototype.completed=function(){this.queue.push(i(this.observer))},t.prototype.ensureActive=function(){var e=!1;!this.hasFaulted&&this.queue.length>0&&(e=!this.isAcquired,this.isAcquired=!0),e&&this.disposable.setDisposable(this.scheduler.scheduleRecursive(this,o))},t.prototype.dispose=function(){e.prototype.dispose.call(this),this.disposable.dispose()},t}(cr),pr=dt.ObservableBase=function(e){function t(e){return e&&_t(e.dispose)?e:_t(e)?Tn(e):An}function n(e,n){var r=n[0],i=n[1],o=Et(i.subscribeCore).call(i,r);o!==Ct||r.fail(Ct.e)||a(Ct.e),r.setDisposable(t(o))}function r(){e.call(this)}return _n(r,e),r.prototype._subscribe=function(e){var t=new fo(e),r=[t,this];return Gn.scheduleRequired()?Gn.schedule(r,n):n(null,r),t},r.prototype.subscribeCore=Vt,r}(hr),dr=dt.FlatMapObservable=function(e){function t(t,n,r,i){this.resultSelector=_t(r)?r:null,this.selector=Ut(_t(n)?n:function(){return n},i,3),this.source=t,e.call(this)}function n(e,t,n,r){this.i=0,this.selector=t,this.resultSelector=n,this.source=r,this.o=e,cr.call(this)}return _n(t,e),t.prototype.subscribeCore=function(e){return this.source.subscribe(new n(e,this.selector,this.resultSelector,this))},_n(n,cr),n.prototype._wrapResult=function(e,t,n){return this.resultSelector?e.map(function(e,r){return this.resultSelector(t,e,n,r)},this):e},n.prototype.next=function(e){var t=this.i++,n=Et(this.selector)(e,t,this.source);return n===Ct?this.o.onError(n.e):(wt(n)&&(n=Wi(n)),(Ft(n)||Ot(n))&&(n=hr.from(n)),this.o.onNext(this._wrapResult(n,e,t)),void 0)},n.prototype.error=function(e){this.o.onError(e)},n.prototype.completed=function(){this.o.onCompleted()},t}(pr),mr=dt.internals.Enumerable=function(){};E.prototype.dispose=function(){this.isDisposed||(this.isDisposed=!0,this._s.isDisposed=!0)};var vr=function(e){function t(t){this.sources=t,e.call(this)}function n(e,t){if(!e.isDisposed){var n=Et(e.e.next).call(e.e);if(n===Ct)return e.o.onError(n.e);if(n.done)return e.o.onCompleted();var i=n.value;wt(i)&&(i=Wi(i));var o=new In;e.subscription.setDisposable(o),o.setDisposable(i.subscribe(new r(e,t)))}}function r(e,t){this._state=e,this._recurse=t,cr.call(this)}return _n(t,e),t.prototype.subscribeCore=function(e){var t=new Dn,r={isDisposed:!1,o:e,subscription:t,e:this.sources[Lt]()},i=Gn.scheduleRecursive(r,n);return new Vn([t,i,new E(r)])},_n(r,cr),r.prototype.next=function(e){this._state.o.onNext(e)},r.prototype.error=function(e){this._state.o.onError(e)},r.prototype.completed=function(){this._recurse(this._state)},t}(pr);mr.prototype.concat=function(){return new vr(this)};var gr=function(e){function t(t){this.sources=t,e.call(this)}function n(e,t){if(!e.isDisposed){var n=Et(e.e.next).call(e.e);if(n===Ct)return e.o.onError(n.e);if(n.done)return null!==e.lastError?e.o.onError(e.lastError):e.o.onCompleted();var i=n.value;wt(i)&&(i=Wi(i));var o=new In;e.subscription.setDisposable(o),o.setDisposable(i.subscribe(new r(e,t)))}}function r(e,t){this._state=e,this._recurse=t,cr.call(this)}return _n(t,e),t.prototype.subscribeCore=function(e){var t=new Dn,r={isDisposed:!1,e:this.sources[Lt](),subscription:t,lastError:null,o:e},i=Gn.scheduleRecursive(r,n);return new Vn([t,i,new E(r)])},_n(r,cr),r.prototype.next=function(e){this._state.o.onNext(e)},r.prototype.error=function(e){this._state.lastError=e,this._recurse(this._state)},r.prototype.completed=function(){this._state.o.onCompleted()},t}(pr);mr.prototype.catchError=function(){return new gr(this)};var yr=function(e){function t(e,t){this.v=e,this.c=null==t?-1:t}function n(e){this.v=e.v,this.l=e.c}return _n(t,e),t.prototype[Lt]=function(){return new n(this)},n.prototype.next=function(){return 0===this.l?Nt:(this.l>0&&this.l--,{done:!1,value:this.v})},t}(mr),br=mr.repeat=function(e,t){return new yr(e,t)},xr=function(e){function t(e,t,n){this.s=e,this.fn=t?Ut(t,n,3):null}function n(e){this.i=-1,this.s=e.s,this.l=this.s.length,this.fn=e.fn}return _n(t,e),t.prototype[Lt]=function(){return new n(this)},n.prototype.next=function(){return++this.i<this.l?{done:!1,value:this.fn?this.fn(this.s[this.i],this.i,this.s):this.s[this.i]}:Nt},t}(mr),wr=mr.of=function(e,t,n){return new xr(e,t,n)},_r=function(e){function t(t){this.source=t,e.call(this)}function n(e){this.o=e,this.a=[],cr.call(this)}return _n(t,e),t.prototype.subscribeCore=function(e){return this.source.subscribe(new n(e))},_n(n,cr),n.prototype.next=function(e){this.a.push(e)},n.prototype.error=function(e){this.o.onError(e)},n.prototype.completed=function(){this.o.onNext(this.a),this.o.onCompleted()},t}(pr);Jn.toArray=function(){return new _r(this)},hr.create=function(e,t){return new ho(e,t)};var Cr=function(e){function t(t){this._f=t,e.call(this)}return _n(t,e),t.prototype.subscribeCore=function(e){var t=Et(this._f)();return t===Ct?zr(t.e).subscribe(e):(wt(t)&&(t=Wi(t)),t.subscribe(e))},t}(pr),Er=hr.defer=function(e){return new Cr(e)},Sr=function(e){function t(t){this.scheduler=t,e.call(this)}function n(e,t){this.observer=e,this.scheduler=t}function r(e,t){return t.onCompleted(),An}return _n(t,e),t.prototype.subscribeCore=function(e){var t=new n(e,this.scheduler);return t.run()},n.prototype.run=function(){var e=this.observer;return this.scheduler===Hn?r(null,e):this.scheduler.schedule(e,r)},t}(pr),Mr=new Sr(Hn),Tr=hr.empty=function(e){return Fn(e)||(e=Hn),e===Hn?Mr:new Sr(e)},Ar=function(e){function t(t,n,r){this._iterable=t,this._fn=n,this._scheduler=r,e.call(this)}function n(e,t,n){return function(r,i){var o=Et(t.next).call(t);if(o===Ct)return e.onError(o.e);if(o.done)return e.onCompleted();var a=o.value;return _t(n)&&(a=Et(n)(a,r),a===Ct)?e.onError(a.e):(e.onNext(a),i(r+1),void 0)}}return _n(t,e),t.prototype.subscribeCore=function(e){var t=Object(this._iterable),r=k(t);return this._scheduler.scheduleRecursive(0,n(e,r,this._fn))},t}(pr),Pr=Math.pow(2,53)-1;S.prototype[Lt]=function(){return new M(this._s)},M.prototype[Lt]=function(){return this},M.prototype.next=function(){return this._i<this._l?{done:!1,value:this._s.charAt(this._i++)}:Nt},T.prototype[Lt]=function(){return new A(this._a)},A.prototype[Lt]=function(){return this},A.prototype.next=function(){return this._i<this._l?{done:!1,value:this._a[this._i++]}:Nt};var kr=hr.from=function(e,t,n,r){if(null==e)throw new Error("iterable cannot be null.");if(t&&!_t(t))throw new Error("mapFn when provided must be a function");if(t)var i=Ut(t,n,2);return Fn(r)||(r=Gn),new Ar(e,i,r)},Rr=function(e){function t(t,n){this._args=t,this._scheduler=n,e.call(this)}function n(e,t){var n=t.length;return function(r,i){n>r?(e.onNext(t[r]),i(r+1)):e.onCompleted()}}return _n(t,e),t.prototype.subscribeCore=function(e){return this._scheduler.scheduleRecursive(0,n(e,this._args))},t}(pr),Ir=hr.fromArray=function(e,t){return Fn(t)||(t=Gn),new Rr(e,t)},Dr=function(e){function t(){e.call(this)}return _n(t,e),t.prototype.subscribeCore=function(){return An},t}(pr),Br=new Dr,Vr=hr.never=function(){return Br};hr.of=function(){for(var e=arguments.length,t=new Array(e),n=0;e>n;n++)t[n]=arguments[n];return new Rr(t,Gn)},hr.ofWithScheduler=function(e){for(var t=arguments.length,n=new Array(t-1),r=1;t>r;r++)n[r-1]=arguments[r];return new Rr(n,e)};var Lr=function(e){function t(t,n){this._o=t,this._keys=Object.keys(t),this._scheduler=n,e.call(this)}function n(e,t,n){return function(r,i){if(r<n.length){var o=n[r];e.onNext([o,t[o]]),i(r+1)}else e.onCompleted()}}return _n(t,e),t.prototype.subscribeCore=function(e){return this._scheduler.scheduleRecursive(0,n(e,this._o,this._keys))},t}(pr);hr.pairs=function(e,t){return t||(t=Gn),new Lr(e,t)};var Nr=function(e){function t(t,n,r){this.start=t,this.rangeCount=n,this.scheduler=r,e.call(this)}function n(e,t,n){return function(r,i){t>r?(n.onNext(e+r),i(r+1)):n.onCompleted()}}return _n(t,e),t.prototype.subscribeCore=function(e){return this.scheduler.scheduleRecursive(0,n(this.start,this.rangeCount,e))},t}(pr);hr.range=function(e,t,n){return Fn(n)||(n=Gn),new Nr(e,t,n)};var Or=function(e){function t(t,n,r){this.value=t,this.repeatCount=null==n?-1:n,this.scheduler=r,e.call(this)}return _n(t,e),t.prototype.subscribeCore=function(e){var t=new B(e,this);return t.run()},t}(pr);B.prototype.run=function(){function e(e,r){return(-1===e||e>0)&&(t.onNext(n),e>0&&e--),0===e?t.onCompleted():(r(e),void 0)}var t=this.observer,n=this.parent.value;return this.parent.scheduler.scheduleRecursive(this.parent.repeatCount,e)},hr.repeat=function(e,t,n){return Fn(n)||(n=Gn),new Or(e,t,n)};var Fr=function(e){function t(t,n){this._value=t,this._scheduler=n,e.call(this)}function n(e,t){var n=t[0],r=t[1];return r.onNext(n),r.onCompleted(),An}return _n(t,e),t.prototype.subscribeCore=function(e){var t=[this._value,e];return this._scheduler===Hn?n(null,t):this._scheduler.schedule(t,n)},t}(pr),Ur=(hr["return"]=hr.just=function(e,t){return Fn(t)||(t=Hn),new Fr(e,t)},function(e){function t(t,n){this._error=t,this._scheduler=n,e.call(this)}function n(e,t){var n=t[0],r=t[1];return r.onError(n),An}return _n(t,e),t.prototype.subscribeCore=function(e){var t=[this._error,e];return this._scheduler===Hn?n(null,t):this._scheduler.schedule(t,n)},t}(pr)),zr=hr["throw"]=function(e,t){return Fn(t)||(t=Hn),new Ur(e,t)},$r=function(e){function t(t,n){this.source=t,this._fn=n,e.call(this)}return _n(t,e),t.prototype.subscribeCore=function(e){var t=new In,n=new Dn;return n.setDisposable(t),t.setDisposable(this.source.subscribe(new Hr(e,n,this._fn))),n},t}(pr),Hr=function(e){function t(t,n,r){this._o=t,this._s=n,this._fn=r,e.call(this)}return _n(t,e),t.prototype.next=function(e){this._o.onNext(e)},t.prototype.completed=function(){return this._o.onCompleted()},t.prototype.error=function(e){var t=Et(this._fn)(e);if(t===Ct)return this._o.onError(t.e);wt(t)&&(t=Wi(t));var n=new In;this._s.setDisposable(n),n.setDisposable(t.subscribe(this._o))},t}(cr);Jn["catch"]=function(e){return _t(e)?new $r(this,e):jr([this,e])};var jr=hr["catch"]=function(){var e;if(Array.isArray(arguments[0]))e=arguments[0];else{var t=arguments.length;e=new Array(t);for(var n=0;t>n;n++)e[n]=arguments[n]}return wr(e).catchError()};Jn.combineLatest=function(){for(var e=arguments.length,t=new Array(e),n=0;e>n;n++)t[n]=arguments[n];return Array.isArray(t[0])?t[0].unshift(this):t.unshift(this),qr.apply(this,t)};var Gr=function(e){function t(t,n){this._params=t,this._cb=n,e.call(this)}return _n(t,e),t.prototype.subscribeCore=function(e){for(var t=this._params.length,n=new Array(t),r={hasValue:_(t,V),hasValueAll:!1,isDone:_(t,V),values:new Array(t)},i=0;t>i;i++){var o=this._params[i],a=new In;n[i]=a,wt(o)&&(o=Wi(o)),a.setDisposable(o.subscribe(new Wr(e,i,this._cb,r)))}return new Vn(n)},t}(pr),Wr=function(e){function t(t,n,r,i){this._o=t,this._i=n,this._cb=r,this._state=i,e.call(this)}function n(e){return function(t,n){return n!==e}}return _n(t,e),t.prototype.next=function(e){if(this._state.values[this._i]=e,this._state.hasValue[this._i]=!0,this._state.hasValueAll||(this._state.hasValueAll=this._state.hasValue.every(vt))){var t=Et(this._cb).apply(null,this._state.values);if(t===Ct)return this._o.onError(t.e);this._o.onNext(t)}else this._state.isDone.filter(n(this._i)).every(vt)&&this._o.onCompleted()},t.prototype.error=function(e){this._o.onError(e)},t.prototype.completed=function(){this._state.isDone[this._i]=!0,this._state.isDone.every(vt)&&this._o.onCompleted()},t}(cr),qr=hr.combineLatest=function(){for(var e=arguments.length,t=new Array(e),n=0;e>n;n++)t[n]=arguments[n];var r=_t(t[e-1])?t.pop():L;return Array.isArray(t[0])&&(t=t[0]),new Gr(t,r)};Jn.concat=function(){for(var e=[],t=0,n=arguments.length;n>t;t++)e.push(arguments[t]);return e.unshift(this),Kr.apply(null,e)};var Xr=function(e){function t(t,n){this._s=t,this._fn=n,e.call(this)}return _n(t,e),t.prototype.next=function(e){this._s.o.onNext(e)},t.prototype.error=function(e){this._s.o.onError(e)},t.prototype.completed=function(){this._s.i++,this._fn(this._s)},t}(cr),Yr=function(e){function t(t){this._sources=t,e.call(this)}function n(e,t){if(!e.disposable.isDisposed){if(e.i===e.sources.length)return e.o.onCompleted();var n=e.sources[e.i];wt(n)&&(n=Wi(n));var r=new In;e.subscription.setDisposable(r),r.setDisposable(n.subscribe(new Xr(e,t)))}}return _n(t,e),t.prototype.subscribeCore=function(e){var t=new Dn,r=Tn(mt),i={o:e,i:0,subscription:t,disposable:r,sources:this._sources},o=Hn.scheduleRecursive(i,n);return new Vn([t,r,o])},t}(pr),Kr=hr.concat=function(){var e;if(Array.isArray(arguments[0]))e=arguments[0];else{e=new Array(arguments.length);for(var t=0,n=arguments.length;n>t;t++)e[t]=arguments[t]}return new Yr(e)};Jn.concatAll=function(){return this.merge(1)};var Qr=function(e){function t(t,n){this.source=t,this.maxConcurrent=n,e.call(this)}return _n(t,e),t.prototype.subscribeCore=function(e){var t=new En;return t.add(this.source.subscribe(new Zr(e,this.maxConcurrent,t))),t},t}(pr),Zr=function(e){function t(t,n,r){this.o=t,this.max=n,this.g=r,this.done=!1,this.q=[],this.activeCount=0,e.call(this)}function n(t,n){this.parent=t,this.sad=n,e.call(this)}return _n(t,e),t.prototype.handleSubscribe=function(e){var t=new In;this.g.add(t),wt(e)&&(e=Wi(e)),t.setDisposable(e.subscribe(new n(this,t)))},t.prototype.next=function(e){this.activeCount<this.max?(this.activeCount++,this.handleSubscribe(e)):this.q.push(e)},t.prototype.error=function(e){this.o.onError(e)},t.prototype.completed=function(){this.done=!0,0===this.activeCount&&this.o.onCompleted()},_n(n,e),n.prototype.next=function(e){this.parent.o.onNext(e)},n.prototype.error=function(e){this.parent.o.onError(e)},n.prototype.completed=function(){this.parent.g.remove(this.sad),this.parent.q.length>0?this.parent.handleSubscribe(this.parent.q.shift()):(this.parent.activeCount--,this.parent.done&&0===this.parent.activeCount&&this.parent.o.onCompleted())},t}(cr);Jn.merge=function(e){return"number"!=typeof e?Jr(this,e):new Qr(this,e)};var Jr=hr.merge=function(){var e,t,n=[],r=arguments.length;if(arguments[0])if(Fn(arguments[0]))for(e=arguments[0],t=1;r>t;t++)n.push(arguments[t]);else for(e=Hn,t=0;r>t;t++)n.push(arguments[t]);else for(e=Hn,t=1;r>t;t++)n.push(arguments[t]);return Array.isArray(n[0])&&(n=n[0]),D(e,n).mergeAll()},ei=dt.CompositeError=function(e){this.innerErrors=e,this.message="This contains multiple errors. Check the innerErrors",Error.call(this)};ei.prototype=Object.create(Error.prototype),ei.prototype.name="CompositeError";var ti=function(e){function t(t){this.source=t,e.call(this)}return _n(t,e),t.prototype.subscribeCore=function(e){var t=new En,n=new In,r={isStopped:!1,errors:[],o:e};return t.add(n),n.setDisposable(this.source.subscribe(new ni(t,r))),t},t}(pr),ni=function(e){function t(t,n){this._group=t,this._state=n,e.call(this)}function n(e,t){0===t.length?e.onCompleted():1===t.length?e.onError(t[0]):e.onError(new ei(t))}function r(t,n,r){this._inner=t,this._group=n,this._state=r,e.call(this)}return _n(t,e),t.prototype.next=function(e){var t=new In;this._group.add(t),wt(e)&&(e=Wi(e)),t.setDisposable(e.subscribe(new r(t,this._group,this._state)))},t.prototype.error=function(e){this._state.errors.push(e),this._state.isStopped=!0,1===this._group.length&&n(this._state.o,this._state.errors)},t.prototype.completed=function(){this._state.isStopped=!0,1===this._group.length&&n(this._state.o,this._state.errors)},_n(r,e),r.prototype.next=function(e){this._state.o.onNext(e)},r.prototype.error=function(e){this._state.errors.push(e),this._group.remove(this._inner),this._state.isStopped&&1===this._group.length&&n(this._state.o,this._state.errors)},r.prototype.completed=function(){this._group.remove(this._inner),this._state.isStopped&&1===this._group.length&&n(this._state.o,this._state.errors)},t}(cr);hr.mergeDelayError=function(){var e;if(Array.isArray(arguments[0]))e=arguments[0];else{var t=arguments.length;e=new Array(t);for(var n=0;t>n;n++)e[n]=arguments[n]}var r=D(null,e);return new ti(r)};var ri=function(e){function t(t){this.source=t,e.call(this)}return _n(t,e),t.prototype.subscribeCore=function(e){var t=new En,n=new In;return t.add(n),n.setDisposable(this.source.subscribe(new ii(e,t))),t},t}(pr),ii=function(e){function t(t,n){this.o=t,this.g=n,this.done=!1,e.call(this)}function n(t,n){this.parent=t,this.sad=n,e.call(this)}return _n(t,e),t.prototype.next=function(e){var t=new In;this.g.add(t),wt(e)&&(e=Wi(e)),t.setDisposable(e.subscribe(new n(this,t)))},t.prototype.error=function(e){this.o.onError(e)},t.prototype.completed=function(){this.done=!0,1===this.g.length&&this.o.onCompleted()},_n(n,e),n.prototype.next=function(e){this.parent.o.onNext(e)},n.prototype.error=function(e){this.parent.o.onError(e)},n.prototype.completed=function(){this.parent.g.remove(this.sad),this.parent.done&&1===this.parent.g.length&&this.parent.o.onCompleted()},t}(cr);Jn.mergeAll=function(){return new ri(this)};var oi=function(e){function t(t,n){this._s=t,this._o=wt(n)?Wi(n):n,this._open=!1,e.call(this)}return _n(t,e),t.prototype.subscribeCore=function(e){var t=new In;t.setDisposable(this._s.subscribe(new ai(e,this))),wt(this._o)&&(this._o=Wi(this._o));var n=new In;return n.setDisposable(this._o.subscribe(new si(e,this,n))),new Bn(t,n)},t}(pr),ai=function(e){function t(t,n){this._o=t,this._p=n,e.call(this)}return _n(t,e),t.prototype.next=function(e){this._p._open&&this._o.onNext(e)},t.prototype.error=function(e){this._o.onError(e)},t.prototype.onCompleted=function(){this._p._open&&this._o.onCompleted()},t}(cr),si=function(e){function t(t,n,r){this._o=t,this._p=n,this._r=r,e.call(this)}return _n(t,e),t.prototype.next=function(){this._p._open=!0,this._r.dispose()},t.prototype.error=function(e){this._o.onError(e)},t.prototype.onCompleted=function(){this._r.dispose()},t}(cr);Jn.skipUntil=function(e){return new oi(this,e)};var ui=function(e){function t(t){this.source=t,e.call(this)}function n(e,t){this.o=e,this.inner=t,this.stopped=!1,this.latest=0,this.hasLatest=!1,cr.call(this)}function r(e,t){this.parent=e,this.id=t,cr.call(this)}return _n(t,e),t.prototype.subscribeCore=function(e){var t=new Dn,r=this.source.subscribe(new n(e,t));return new Bn(r,t)},_n(n,cr),n.prototype.next=function(e){var t=new In,n=++this.latest;this.hasLatest=!0,this.inner.setDisposable(t),wt(e)&&(e=Wi(e)),t.setDisposable(e.subscribe(new r(this,n)))},n.prototype.error=function(e){this.o.onError(e)},n.prototype.completed=function(){this.stopped=!0,!this.hasLatest&&this.o.onCompleted()},_n(r,cr),r.prototype.next=function(e){this.parent.latest===this.id&&this.parent.o.onNext(e)},r.prototype.error=function(e){this.parent.latest===this.id&&this.parent.o.onError(e)},r.prototype.completed=function(){this.parent.latest===this.id&&(this.parent.hasLatest=!1,this.parent.stopped&&this.parent.o.onCompleted())},t}(pr);Jn["switch"]=Jn.switchLatest=function(){return new ui(this)};var ci=function(e){function t(t,n){this.source=t,this.other=wt(n)?Wi(n):n,e.call(this)}return _n(t,e),t.prototype.subscribeCore=function(e){return new Bn(this.source.subscribe(e),this.other.subscribe(new li(e)))},t}(pr),li=function(e){function t(t){this._o=t,e.call(this)}return _n(t,e),t.prototype.next=function(){this._o.onCompleted()},t.prototype.error=function(e){this._o.onError(e)},t.prototype.onCompleted=mt,t}(cr);Jn.takeUntil=function(e){return new ci(this,e)};var hi=function(e){function t(t,n,r){this._s=t,this._ss=n,this._cb=r,e.call(this)}return _n(t,e),t.prototype.subscribeCore=function(e){for(var t=this._ss.length,n={hasValue:_(t,V),hasValueAll:!1,values:new Array(t)},r=this._ss.length,i=new Array(r+1),o=0;r>o;o++){var a=this._ss[o],s=new In;wt(a)&&(a=Wi(a)),s.setDisposable(a.subscribe(new fi(e,o,n))),i[o]=s}var u=new In;return u.setDisposable(this._s.subscribe(new pi(e,this._cb,n))),i[r]=u,new Vn(i)},t}(pr),fi=function(e){function t(t,n,r){this._o=t,this._i=n,this._state=r,e.call(this)}return _n(t,e),t.prototype.next=function(e){this._state.values[this._i]=e,this._state.hasValue[this._i]=!0,this._state.hasValueAll=this._state.hasValue.every(vt)},t.prototype.error=function(e){this._o.onError(e)},t.prototype.completed=mt,t}(cr),pi=function(e){function t(t,n,r){this._o=t,this._cb=n,this._state=r,e.call(this)}return _n(t,e),t.prototype.next=function(e){var t=[e].concat(this._state.values);if(this._state.hasValueAll){var n=Et(this._cb).apply(null,t);return n===Ct?this._o.onError(n.e):(this._o.onNext(n),void 0)}},t.prototype.error=function(e){this._o.onError(e)},t.prototype.completed=function(){this._o.onCompleted()},t}(cr);Jn.withLatestFrom=function(){if(0===arguments.length)throw new Error("invalid arguments");for(var e=arguments.length,t=new Array(e),n=0;e>n;n++)t[n]=arguments[n];var r=_t(t[e-1])?t.pop():L;return Array.isArray(t[0])&&(t=t[0]),new hi(this,t,r)};var di=function(e){function t(t,n){this._s=t,this._cb=n,e.call(this)}return _n(t,e),t.prototype.subscribeCore=function(e){for(var t=this._s.length,n=new Array(t),r=_(t,V),i=_(t,N),o=0;t>o;o++){var a=this._s[o],s=new In;n[o]=s,wt(a)&&(a=Wi(a)),s.setDisposable(a.subscribe(new mi(e,o,this,i,r)))}return new Vn(n)},t}(pr),mi=function(e){function t(t,n,r,i,o){this._o=t,this._i=n,this._p=r,this._q=i,this._d=o,e.call(this)}function n(e){return e.length>0}function r(e){return e.shift()}function i(e){return function(t,n){return n!==e}}return _n(t,e),t.prototype.next=function(e){if(this._q[this._i].push(e),this._q.every(n)){var t=this._q.map(r),o=Et(this._p._cb).apply(null,t);if(o===Ct)return this._o.onError(o.e);this._o.onNext(o)}else this._d.filter(i(this._i)).every(vt)&&this._o.onCompleted()},t.prototype.error=function(e){this._o.onError(e)},t.prototype.completed=function(){this._d[this._i]=!0,this._d.every(vt)&&this._o.onCompleted()},t}(cr);Jn.zip=function(){if(0===arguments.length)throw new Error("invalid arguments");for(var e=arguments.length,t=new Array(e),n=0;e>n;n++)t[n]=arguments[n];var r=_t(t[e-1])?t.pop():L;Array.isArray(t[0])&&(t=t[0]);var i=this;return t.unshift(i),new di(t,r)},hr.zip=function(){for(var e=arguments.length,t=new Array(e),n=0;e>n;n++)t[n]=arguments[n];Array.isArray(t[0])&&(t=_t(t[1])?t[0].concat(t[1]):t[0]);var r=t.shift();return r.zip.apply(r,t)};var vi=function(e){function t(t,n){this.sources=t,this._cb=n,e.call(this)}return _n(t,e),t.prototype.subscribeCore=function(e){for(var t=this.sources,n=t.length,r=new Array(n),i={q:_(n,N),done:_(n,V),cb:this._cb,o:e},o=0;n>o;o++)!function(e){var n=t[e],o=new In;(Ft(n)||Ot(n))&&(n=kr(n)),r[e]=o,o.setDisposable(n.subscribe(new gi(i,e)))}(o);return new Vn(r)},t}(pr),gi=function(e){function t(t,n){this._s=t,this._i=n,e.call(this)}function n(e){return e.length>0}function r(e){return e.shift()}function i(e){return function(t,n){return n!==e}}return _n(t,e),t.prototype.next=function(e){if(this._s.q[this._i].push(e),this._s.q.every(n)){var t=this._s.q.map(r),o=Et(this._s.cb).apply(null,t);if(o===Ct)return this._s.o.onError(o.e);this._s.o.onNext(o)}else this._s.done.filter(i(this._i)).every(vt)&&this._s.o.onCompleted()},t.prototype.error=function(e){this._s.o.onError(e)},t.prototype.completed=function(){this._s.done[this._i]=!0,this._s.done.every(vt)&&this._s.o.onCompleted()},t}(cr);Jn.zipIterable=function(){if(0===arguments.length)throw new Error("invalid arguments");for(var e=arguments.length,t=new Array(e),n=0;e>n;n++)t[n]=arguments[n];var r=_t(t[e-1])?t.pop():L,i=this;return t.unshift(i),new vi(t,r)},Jn.asObservable=function(){return new ho(O(this),this)};var yi=function(e){function t(t){this.source=t,e.call(this)}return _n(t,e),t.prototype.subscribeCore=function(e){return this.source.subscribe(new bi(e))},t}(pr),bi=function(e){function t(t){this._o=t,e.call(this)}return _n(t,e),t.prototype.next=function(e){e.accept(this._o)},t.prototype.error=function(e){this._o.onError(e)},t.prototype.completed=function(){this._o.onCompleted()},t}(cr);Jn.dematerialize=function(){return new yi(this)};var xi=function(e){function t(t,n,r){this.source=t,this.keyFn=n,this.comparer=r,e.call(this)}return _n(t,e),t.prototype.subscribeCore=function(e){return this.source.subscribe(new wi(e,this.keyFn,this.comparer))},t}(pr),wi=function(e){function t(t,n,r){this.o=t,this.keyFn=n,this.comparer=r,this.hasCurrentKey=!1,this.currentKey=null,e.call(this)}return _n(t,e),t.prototype.next=function(e){var t,n=e;return _t(this.keyFn)&&(n=Et(this.keyFn)(e),n===Ct)?this.o.onError(n.e):this.hasCurrentKey&&(t=Et(this.comparer)(this.currentKey,n),t===Ct)?this.o.onError(t.e):(this.hasCurrentKey&&t||(this.hasCurrentKey=!0,this.currentKey=n,this.o.onNext(e)),void 0)},t.prototype.error=function(e){this.o.onError(e)},t.prototype.completed=function(){this.o.onCompleted()},t}(cr);Jn.distinctUntilChanged=function(e,t){return t||(t=yt),new xi(this,e,t)};var _i=function(e){function t(t,n,r,i){this.source=t,this._oN=n,this._oE=r,this._oC=i,e.call(this)}function n(e,t){this.o=e,this.t=!t._oN||_t(t._oN)?ur(t._oN||mt,t._oE||mt,t._oC||mt):t._oN,this.isStopped=!1,cr.call(this)}return _n(t,e),t.prototype.subscribeCore=function(e){return this.source.subscribe(new n(e,this))},_n(n,cr),n.prototype.next=function(e){var t=Et(this.t.onNext).call(this.t,e);t===Ct&&this.o.onError(t.e),this.o.onNext(e)},n.prototype.error=function(e){var t=Et(this.t.onError).call(this.t,e);return t===Ct?this.o.onError(t.e):(this.o.onError(e),void 0)},n.prototype.completed=function(){var e=Et(this.t.onCompleted).call(this.t);return e===Ct?this.o.onError(e.e):(this.o.onCompleted(),void 0)},t}(pr);Jn["do"]=Jn.tap=Jn.doAction=function(e,t,n){return new _i(this,e,t,n)},Jn.doOnNext=Jn.tapOnNext=function(e,t){return this.tap("undefined"!=typeof t?function(n){e.call(t,n)}:e)},Jn.doOnError=Jn.tapOnError=function(e,t){return this.tap(mt,"undefined"!=typeof t?function(n){e.call(t,n)}:e)},Jn.doOnCompleted=Jn.tapOnCompleted=function(e,t){return this.tap(mt,null,"undefined"!=typeof t?function(){e.call(t)}:e)};var Ci=function(e){function t(t,n,r){this.source=t,this._fn=Ut(n,r,0),e.call(this)}function n(e,t){this.isDisposed=!1,this._s=e,this._fn=t}return _n(t,e),t.prototype.subscribeCore=function(e){var t=Et(this.source.subscribe).call(this.source,e);return t===Ct&&(this._fn(),a(t.e)),new n(t,this._fn)},n.prototype.dispose=function(){if(!this.isDisposed){var e=Et(this._s.dispose).call(this._s);this._fn(),e===Ct&&a(e.e)}},t}(pr);Jn["finally"]=function(e,t){return new Ci(this,e,t)};var Ei=function(e){function t(t){this.source=t,e.call(this)}function n(e){this.o=e,this.isStopped=!1}return _n(t,e),t.prototype.subscribeCore=function(e){return this.source.subscribe(new n(e))},n.prototype.onNext=mt,n.prototype.onError=function(e){this.isStopped||(this.isStopped=!0,this.o.onError(e))},n.prototype.onCompleted=function(){this.isStopped||(this.isStopped=!0,this.o.onCompleted())},n.prototype.dispose=function(){this.isStopped=!0},n.prototype.fail=function(e){return this.isStopped?!1:(this.isStopped=!0,this.observer.onError(e),!0)},t}(pr);Jn.ignoreElements=function(){return new Ei(this)};var Si=function(e){function t(t){this.source=t,e.call(this)}return _n(t,e),t.prototype.subscribeCore=function(e){return this.source.subscribe(new Mi(e))},t}(pr),Mi=function(e){function t(t){this._o=t,e.call(this)}return _n(t,e),t.prototype.next=function(e){this._o.onNext(ir(e))},t.prototype.error=function(e){this._o.onNext(or(e)),this._o.onCompleted()},t.prototype.completed=function(){this._o.onNext(ar()),this._o.onCompleted()},t}(cr);Jn.materialize=function(){return new Si(this)},Jn.repeat=function(e){return br(this,e).concat()},Jn.retry=function(e){return br(this,e).catchError()};var Ti=function(e){function t(e){return{isDisposed:!1,dispose:function(){this.isDisposed||(this.isDisposed=!0,e.isDisposed=!0)}}}function n(t,n){this.source=t,this._notifier=n,e.call(this)}return _n(n,e),n.prototype.subscribeCore=function(e){var n,r=new mo,i=new mo,o=this._notifier(r),a=o.subscribe(i),s=this.source["@@iterator"](),u={isDisposed:!1},c=new Dn,l=Gn.scheduleRecursive(null,function(t,o){if(!u.isDisposed){var a=s.next();if(a.done)return n?e.onError(n):e.onCompleted(),void 0;var l=a.value;wt(l)&&(l=Wi(l));var h=new In,f=new In;c.setDisposable(new Bn(f,h)),h.setDisposable(l.subscribe(function(t){e.onNext(t)},function(t){f.setDisposable(i.subscribe(o,function(t){e.onError(t)},function(){e.onCompleted()})),r.onNext(t),h.dispose()},function(){e.onCompleted()}))}});return new Vn([a,c,l,t(u)])},n}(pr);Jn.retryWhen=function(e){return new Ti(F(this),e)};var Ai=function(e){function t(e){return{isDisposed:!1,dispose:function(){this.isDisposed||(this.isDisposed=!0,e.isDisposed=!0)}}}function n(t,n){this.source=t,this._notifier=n,e.call(this)}return _n(n,e),n.prototype.subscribeCore=function(e){var n,r=new mo,i=new mo,o=this._notifier(r),a=o.subscribe(i),s=this.source["@@iterator"](),u={isDisposed:!1},c=new Dn,l=Gn.scheduleRecursive(null,function(t,o){if(!u.isDisposed){var a=s.next();if(a.done)return n?e.onError(n):e.onCompleted(),void 0;var l=a.value;wt(l)&&(l=Wi(l));var h=new In,f=new In;c.setDisposable(new Bn(f,h)),h.setDisposable(l.subscribe(function(t){e.onNext(t)},function(t){e.onError(t)},function(){f.setDisposable(i.subscribe(o,function(t){e.onError(t)},function(){e.onCompleted()})),r.onNext(null),h.dispose()}))}});return new Vn([a,c,l,t(u)])},n}(pr);Jn.repeatWhen=function(e){return new Ai(F(this),e)};var Pi=function(e){function t(t,n,r,i){this.source=t,this.accumulator=n,this.hasSeed=r,this.seed=i,e.call(this)}return _n(t,e),t.prototype.subscribeCore=function(e){return this.source.subscribe(new ki(e,this))},t}(pr),ki=function(e){function t(t,n){this._o=t,this._p=n,this._fn=n.accumulator,this._hs=n.hasSeed,this._s=n.seed,this._ha=!1,this._a=null,this._hv=!1,this._i=0,e.call(this)}return _n(t,e),t.prototype.next=function(e){return!this._hv&&(this._hv=!0),this._ha?this._a=Et(this._fn)(this._a,e,this._i,this._p):(this._a=this._hs?Et(this._fn)(this._s,e,this._i,this._p):e,this._ha=!0),this._a===Ct?this._o.onError(this._a.e):(this._o.onNext(this._a),this._i++,void 0)
},t.prototype.error=function(e){this._o.onError(e)},t.prototype.completed=function(){!this._hv&&this._hs&&this._o.onNext(this._s),this._o.onCompleted()},t}(cr);Jn.scan=function(){var e,t=!1,n=arguments[0];return 2===arguments.length&&(t=!0,e=arguments[1]),new Pi(this,n,t,e)};var Ri=function(e){function t(t,n){this.source=t,this._c=n,e.call(this)}return _n(t,e),t.prototype.subscribeCore=function(e){return this.source.subscribe(new Ii(e,this._c))},t}(pr),Ii=function(e){function t(t,n){this._o=t,this._c=n,this._q=[],e.call(this)}return _n(t,e),t.prototype.next=function(e){this._q.push(e),this._q.length>this._c&&this._o.onNext(this._q.shift())},t.prototype.error=function(e){this._o.onError(e)},t.prototype.completed=function(){this._o.onCompleted()},t}(cr);Jn.skipLast=function(e){if(0>e)throw new It;return new Ri(this,e)},Jn.startWith=function(){var e,t=0;arguments.length&&Fn(arguments[0])?(e=arguments[0],t=1):e=Hn;for(var n=[],r=t,i=arguments.length;i>r;r++)n.push(arguments[r]);return Kr.apply(null,[Ir(n,e),this])};var Di=function(e){function t(t,n){this._o=t,this._c=n,this._q=[],e.call(this)}return _n(t,e),t.prototype.next=function(e){this._q.push(e),this._q.length>this._c&&this._q.shift()},t.prototype.error=function(e){this._o.onError(e)},t.prototype.completed=function(){for(;this._q.length>0;)this._o.onNext(this._q.shift());this._o.onCompleted()},t}(cr);Jn.takeLast=function(e){if(0>e)throw new It;var t=this;return new ho(function(n){return t.subscribe(new Di(n,e))},t)},Jn.flatMapConcat=Jn.concatMap=function(e,t,n){return new dr(this,e,t,n).merge(1)};var Bi=function(e){function t(t,n,r){this.source=t,this.selector=Ut(n,r,3),e.call(this)}function n(e,t){return function(n,r,i){return e.call(this,t.selector(n,r,i),r,i)}}function r(e,t,n){this.o=e,this.selector=t,this.source=n,this.i=0,cr.call(this)}return _n(t,e),t.prototype.internalMap=function(e,r){return new t(this.source,n(e,this),r)},t.prototype.subscribeCore=function(e){return this.source.subscribe(new r(e,this.selector,this))},_n(r,cr),r.prototype.next=function(e){var t=Et(this.selector)(e,this.i++,this.source);return t===Ct?this.o.onError(t.e):(this.o.onNext(t),void 0)},r.prototype.error=function(e){this.o.onError(e)},r.prototype.completed=function(){this.o.onCompleted()},t}(pr);Jn.map=Jn.select=function(e,t){var n="function"==typeof e?e:function(){return e};return this instanceof Bi?this.internalMap(n,t):new Bi(this,n,t)},Jn.pluck=function(){var e=arguments.length,t=new Array(e);if(0===e)throw new Error("List of properties cannot be empty.");for(var n=0;e>n;n++)t[n]=arguments[n];return this.map(U(t,e))},Jn.flatMap=Jn.selectMany=Jn.mergeMap=function(e,t,n){return new dr(this,e,t,n).mergeAll()},Jn.flatMapLatest=Jn.switchMap=function(e,t,n){return new dr(this,e,t,n).switchLatest()};var Vi=function(e){function t(t,n){this.source=t,this._count=n,e.call(this)}function n(e,t){this._o=e,this._r=t,cr.call(this)}return _n(t,e),t.prototype.subscribeCore=function(e){return this.source.subscribe(new n(e,this._count))},_n(n,cr),n.prototype.next=function(e){this._r<=0?this._o.onNext(e):this._r--},n.prototype.error=function(e){this._o.onError(e)},n.prototype.completed=function(){this._o.onCompleted()},t}(pr);Jn.skip=function(e){if(0>e)throw new It;return new Vi(this,e)};var Li=function(e){function t(t,n){this.source=t,this._fn=n,e.call(this)}return _n(t,e),t.prototype.subscribeCore=function(e){return this.source.subscribe(new Ni(e,this))},t}(pr),Ni=function(e){function t(t,n){this._o=t,this._p=n,this._i=0,this._r=!1,e.call(this)}return _n(t,e),t.prototype.next=function(e){if(!this._r){var t=Et(this._p._fn)(e,this._i++,this._p);if(t===Ct)return this._o.onError(t.e);this._r=!t}this._r&&this._o.onNext(e)},t.prototype.error=function(e){this._o.onError(e)},t.prototype.completed=function(){this._o.onCompleted()},t}(cr);Jn.skipWhile=function(e,t){var n=Ut(e,t,3);return new Li(this,n)};var Oi=function(e){function t(t,n){this.source=t,this._count=n,e.call(this)}function n(e,t){this._o=e,this._c=t,this._r=t,cr.call(this)}return _n(t,e),t.prototype.subscribeCore=function(e){return this.source.subscribe(new n(e,this._count))},_n(n,cr),n.prototype.next=function(e){this._r-->0&&(this._o.onNext(e),this._r<=0&&this._o.onCompleted())},n.prototype.error=function(e){this._o.onError(e)},n.prototype.completed=function(){this._o.onCompleted()},t}(pr);Jn.take=function(e,t){if(0>e)throw new It;return 0===e?Tr(t):new Oi(this,e)};var Fi=function(e){function t(t,n){this.source=t,this._fn=n,e.call(this)}return _n(t,e),t.prototype.subscribeCore=function(e){return this.source.subscribe(new Ui(e,this))},t}(pr),Ui=function(e){function t(t,n){this._o=t,this._p=n,this._i=0,this._r=!0,e.call(this)}return _n(t,e),t.prototype.next=function(e){return this._r&&(this._r=Et(this._p._fn)(e,this._i++,this._p),this._r===Ct)?this._o.onError(this._r.e):(this._r?this._o.onNext(e):this._o.onCompleted(),void 0)},t.prototype.error=function(e){this._o.onError(e)},t.prototype.completed=function(){this._o.onCompleted()},t}(cr);Jn.takeWhile=function(e,t){var n=Ut(e,t,3);return new Fi(this,n)};var zi=function(e){function t(t,n,r){this.source=t,this.predicate=Ut(n,r,3),e.call(this)}function n(e,t){return function(n,r,i){return t.predicate(n,r,i)&&e.call(this,n,r,i)}}function r(e,t,n){this.o=e,this.predicate=t,this.source=n,this.i=0,cr.call(this)}return _n(t,e),t.prototype.subscribeCore=function(e){return this.source.subscribe(new r(e,this.predicate,this))},t.prototype.internalFilter=function(e,r){return new t(this.source,n(e,this),r)},_n(r,cr),r.prototype.next=function(e){var t=Et(this.predicate)(e,this.i++,this.source);return t===Ct?this.o.onError(t.e):(t&&this.o.onNext(e),void 0)},r.prototype.error=function(e){this.o.onError(e)},r.prototype.completed=function(){this.o.onCompleted()},t}(pr);Jn.filter=Jn.where=function(e,t){return this instanceof zi?this.internalFilter(e,t):new zi(this,e,t)},hr.fromCallback=function(e,t,n){return function(){"undefined"==typeof t&&(t=this);for(var r=arguments.length,i=new Array(r),o=0;r>o;o++)i[o]=arguments[o];return z(e,t,n,i)}},hr.fromNodeCallback=function(e,t,n){return function(){"undefined"==typeof t&&(t=this);for(var r=arguments.length,i=new Array(r),o=0;r>o;o++)i[o]=arguments[o];return H(e,t,n,i)}},W.prototype.dispose=function(){this.isDisposed||(this._e.removeEventListener(this._n,this._fn,!1),this.isDisposed=!0)},dt.config.useNativeEvents=!1;var $i=function(e){function t(t,n,r){this._el=t,this._n=n,this._fn=r,e.call(this)}function n(e,t){return function(){var n=arguments[0];return _t(t)&&(n=Et(t).apply(null,arguments),n===Ct)?e.onError(n.e):(e.onNext(n),void 0)}}return _n(t,e),t.prototype.subscribeCore=function(e){return q(this._el,this._n,n(e,this._fn))},t}(pr);hr.fromEvent=function(e,t,n){return e.addListener?ji(function(n){e.addListener(t,n)},function(n){e.removeListener(t,n)},n):dt.config.useNativeEvents||"function"!=typeof e.on||"function"!=typeof e.off?new $i(e,t,n).publish().refCount():ji(function(n){e.on(t,n)},function(n){e.off(t,n)},n)};var Hi=function(e){function t(t,n,r){this._add=t,this._del=n,this._fn=r,e.call(this)}function n(e,t){return function(){var n=arguments[0];return _t(t)&&(n=Et(t).apply(null,arguments),n===Ct)?e.onError(n.e):(e.onNext(n),void 0)}}function r(e,t,n){this._del=e,this._fn=t,this._ret=n,this.isDisposed=!1}return _n(t,e),t.prototype.subscribeCore=function(e){var t=n(e,this._fn),i=this._add(t);return new r(this._del,t,i)},r.prototype.dispose=function(){this.isDisposed||(_t(this._del)&&this._del(this._fn,this._ret),this.isDisposed=!0)},t}(pr),ji=hr.fromEventPattern=function(e,t,n){return new Hi(e,t,n).publish().refCount()},Gi=function(e){function t(t,n){this._p=t,this._s=n,e.call(this)}function n(e,t){var n=t[0],r=t[1];n.onNext(r),n.onCompleted()}function r(e,t){var n=t[0],r=t[1];n.onError(r)}return _n(t,e),t.prototype.subscribeCore=function(e){var t=new In,i=this,o=this._p;return _t(o)&&(o=Et(o)(),o===Ct)?(e.onError(o.e),t):(o.then(function(r){t.setDisposable(i._s.schedule([e,r],n))},function(n){t.setDisposable(i._s.schedule([e,n],r))}),t)},t}(pr),Wi=hr.fromPromise=function(e,t){return t||(t=Kn),new Gi(e,t)};Jn.toPromise=function(e){if(e||(e=dt.config.Promise),!e)throw new Dt("Promise type not provided nor in Rx.config.Promise");var t=this;return new e(function(e,n){var r;t.subscribe(function(e){r=e},n,function(){e(r)})})},hr.startAsync=function(e){var t=Et(e)();return t===Ct?zr(t.e):Wi(t)};var qi=function(e){function t(t,n,r){this.source=t,this._fn1=n,this._fn2=r,e.call(this)}return _n(t,e),t.prototype.subscribeCore=function(e){var t=this.source.multicast(this._fn1());return new Bn(this._fn2(t).subscribe(e),t.connect())},t}(pr);Jn.multicast=function(e,t){return _t(e)?new qi(this,e,t):new Yi(this,e)},Jn.publish=function(e){return e&&_t(e)?this.multicast(function(){return new mo},e):this.multicast(new mo)},Jn.share=function(){return this.publish().refCount()},Jn.publishLast=function(e){return e&&_t(e)?this.multicast(function(){return new vo},e):this.multicast(new vo)},Jn.publishValue=function(e,t){return 2===arguments.length?this.multicast(function(){return new yo(t)},e):this.multicast(new yo(e))},Jn.shareValue=function(e){return this.publishValue(e).refCount()},Jn.replay=function(e,t,n,r){return e&&_t(e)?this.multicast(function(){return new bo(t,n,r)},e):this.multicast(new bo(t,n,r))},Jn.shareReplay=function(e,t,n){return this.replay(null,e,t,n).refCount()};{var Xi=function(e){function t(t){this.source=t,this._count=0,this._connectableSubscription=null,e.call(this)}function n(e,t){this._p=e,this._s=t,this.isDisposed=!1}return _n(t,e),t.prototype.subscribeCore=function(e){var t=this.source.subscribe(e);return 1===++this._count&&(this._connectableSubscription=this.source.connect()),new n(this,t)},n.prototype.dispose=function(){this.isDisposed||(this.isDisposed=!0,this._s.dispose(),0===--this._p._count&&this._p._connectableSubscription.dispose())},t}(pr),Yi=dt.ConnectableObservable=function(e){function t(t,n){this.source=t,this._connection=null,this._source=t.asObservable(),this._subject=n,e.call(this)}function n(e,t){this._p=e,this._s=t}return _n(t,e),n.prototype.dispose=function(){this._s&&(this._s.dispose(),this._s=null,this._p._connection=null)},t.prototype.connect=function(){if(!this._connection){if(this._subject.isStopped)return An;var e=this._source.subscribe(this._subject);this._connection=new n(this,e)}return this._connection},t.prototype._subscribe=function(e){return this._subject.subscribe(e)},t.prototype.refCount=function(){return new Xi(this)},t}(hr),Ki=function(e){function t(t,n){this._dt=t,this._s=n,e.call(this)}function n(e,t){t.onNext(0),t.onCompleted()}return _n(t,e),t.prototype.subscribeCore=function(e){return this._s.scheduleFuture(e,this._dt,n)},t}(pr),Qi=hr.interval=function(e,t){return K(e,e,Fn(t)?t:Kn)};hr.timer=function(e,t,r){var i;return Fn(r)||(r=Kn),null!=t&&"number"==typeof t?i=t:Fn(t)&&(r=t),(e instanceof Date||"number"==typeof e)&&i===n?X(e,r):e instanceof Date&&i!==n?Y(e,t,r):K(e,i,r)}}Jn.delay=function(){var e=arguments[0];if("number"==typeof e||e instanceof Date){var t=e,n=arguments[1];return Fn(n)||(n=Kn),t instanceof Date?Z(this,t,n):Q(this,t,n)}if(hr.isObservable(e)||_t(e))return J(this,e,arguments[1]);throw new Error("Invalid arguments")};var Zi=function(e){function t(t,n,r){Fn(r)||(r=Kn),this.source=t,this._dt=n,this._s=r,e.call(this)}return _n(t,e),t.prototype.subscribeCore=function(e){var t=new Dn;return new Bn(this.source.subscribe(new Ji(e,this._dt,this._s,t)),t)},t}(pr),Ji=function(e){function t(t,n,r,i){this._o=t,this._d=n,this._scheduler=r,this._c=i,this._v=null,this._hv=!1,this._id=0,e.call(this)}return _n(t,e),t.prototype.next=function(e){this._hv=!0,this._v=e;var t=++this._id,n=new In;this._c.setDisposable(n),n.setDisposable(this._scheduler.scheduleFuture(this,this._d,function(n,r){r._hv&&r._id===t&&r._o.onNext(e),r._hv=!1}))},t.prototype.error=function(e){this._c.dispose(),this._o.onError(e),this._hv=!1,this._id++},t.prototype.completed=function(){this._c.dispose(),this._hv&&this._o.onNext(this._v),this._o.onCompleted(),this._hv=!1,this._id++},t}(cr);Jn.debounce=function(){if(_t(arguments[0]))return et(this,arguments[0]);if("number"==typeof arguments[0])return new Zi(this,arguments[0],arguments[1]);throw new Error("Invalid arguments")};var eo=function(e){function t(t,n){this.source=t,this._s=n,e.call(this)}return _n(t,e),t.prototype.subscribeCore=function(e){return this.source.subscribe(new to(e,this._s))},t}(pr),to=function(e){function t(t,n){this._o=t,this._s=n,e.call(this)}return _n(t,e),t.prototype.next=function(e){this._o.onNext({value:e,timestamp:this._s.now()})},t.prototype.error=function(e){this._o.onError(e)},t.prototype.completed=function(){this._o.onCompleted()},t}(cr);Jn.timestamp=function(e){return Fn(e)||(e=Kn),new eo(this,e)};var no=function(e){function t(t,n){this.source=t,this._sampler=n,e.call(this)}return _n(t,e),t.prototype.subscribeCore=function(e){var t={o:e,atEnd:!1,value:null,hasValue:!1,sourceSubscription:new In};return t.sourceSubscription.setDisposable(this.source.subscribe(new io(t))),new Bn(t.sourceSubscription,this._sampler.subscribe(new ro(t)))},t}(pr),ro=function(e){function t(t){this._s=t,e.call(this)}return _n(t,e),t.prototype._handleMessage=function(){this._s.hasValue&&(this._s.hasValue=!1,this._s.o.onNext(this._s.value)),this._s.atEnd&&this._s.o.onCompleted()},t.prototype.next=function(){this._handleMessage()},t.prototype.error=function(e){this._s.onError(e)},t.prototype.completed=function(){this._handleMessage()},t}(cr),io=function(e){function t(t){this._s=t,e.call(this)}return _n(t,e),t.prototype.next=function(e){this._s.hasValue=!0,this._s.value=e},t.prototype.error=function(e){this._s.o.onError(e)},t.prototype.completed=function(){this._s.atEnd=!0,this._s.sourceSubscription.dispose()},t}(cr);Jn.sample=function(e,t){return Fn(t)||(t=Kn),"number"==typeof e?new no(this,Qi(e,t)):new no(this,e)};var oo=dt.TimeoutError=function(e){this.message=e||"Timeout has occurred",this.name="TimeoutError",Error.call(this)};oo.prototype=Object.create(Error.prototype),Jn.timeout=function(){var e=arguments[0];if(e instanceof Date||"number"==typeof e)return nt(this,e,arguments[1],arguments[2]);if(hr.isObservable(e)||_t(e))return tt(this,e,arguments[1],arguments[2]);throw new Error("Invalid arguments")},Jn.throttle=function(e,t){Fn(t)||(t=Kn);var n=+e||0;if(0>=n)throw new RangeError("windowDuration cannot be less or equal zero.");var r=this;return new ho(function(e){var i=0;return r.subscribe(function(r){var o=t.now();(0===i||o-i>=n)&&(i=o,e.onNext(r))},function(t){e.onError(t)},function(){e.onCompleted()})},r)};var ao=function(e){function t(t,n){this.source=t,this.controller=new mo,this.paused=!0,this.pauser=n&&n.subscribe?this.controller.merge(n):this.controller,e.call(this)}return _n(t,e),t.prototype._subscribe=function(e){var t=this.source.publish(),n=t.subscribe(e),r=An,i=this.pauser.startWith(!this.paused).distinctUntilChanged().subscribe(function(e){e?r=t.connect():(r.dispose(),r=An)});return new Vn([n,r,i])},t.prototype.pause=function(){this.paused=!0,this.controller.onNext(!1)},t.prototype.resume=function(){this.paused=!1,this.controller.onNext(!0)},t}(hr);Jn.pausable=function(e){return new ao(this,e)};var so=function(e){function t(t,n){this.source=t,this.controller=new mo,this.paused=!0,this.pauser=n&&n.subscribe?this.controller.merge(n):this.controller,e.call(this)}return _n(t,e),t.prototype._subscribe=function(e){function t(){for(;i.length>0;)e.onNext(i.shift())}var r,i=[],o=rt(this.source,this.pauser.startWith(!this.paused).distinctUntilChanged(),function(e,t){return{data:e,shouldFire:t}}).subscribe(function(o){r!==n&&o.shouldFire!==r?(r=o.shouldFire,o.shouldFire&&t()):(r=o.shouldFire,o.shouldFire?e.onNext(o.data):i.push(o.data))},function(n){t(),e.onError(n)},function(){t(),e.onCompleted()});return o},t.prototype.pause=function(){this.paused=!0,this.controller.onNext(!1)},t.prototype.resume=function(){this.paused=!1,this.controller.onNext(!0)},t}(hr);Jn.pausableBuffered=function(e){return new so(this,e)};var uo=function(e){function t(t,n,r){e.call(this),this.subject=new co(n,r),this.source=t.multicast(this.subject).refCount()}return _n(t,e),t.prototype._subscribe=function(e){return this.source.subscribe(e)},t.prototype.request=function(e){return this.subject.request(null==e?-1:e)},t}(hr),co=function(e){function t(t,n){null==t&&(t=!0),e.call(this),this.subject=new mo,this.enableQueue=t,this.queue=t?[]:null,this.requestedCount=0,this.requestedDisposable=null,this.error=null,this.hasFailed=!1,this.hasCompleted=!1,this.scheduler=n||Gn}return _n(t,e),Cn(t.prototype,sr,{_subscribe:function(e){return this.subject.subscribe(e)},onCompleted:function(){this.hasCompleted=!0,this.enableQueue&&0!==this.queue.length?this.queue.push(er.createOnCompleted()):(this.subject.onCompleted(),this.disposeCurrentRequest())},onError:function(e){this.hasFailed=!0,this.error=e,this.enableQueue&&0!==this.queue.length?this.queue.push(er.createOnError(e)):(this.subject.onError(e),this.disposeCurrentRequest())},onNext:function(e){this.requestedCount<=0?this.enableQueue&&this.queue.push(er.createOnNext(e)):(0===this.requestedCount--&&this.disposeCurrentRequest(),this.subject.onNext(e))},_processRequest:function(e){if(this.enableQueue)for(;this.queue.length>0&&(e>0||"N"!==this.queue[0].kind);){var t=this.queue.shift();t.accept(this.subject),"N"===t.kind?e--:(this.disposeCurrentRequest(),this.queue=[])}return e},request:function(e){this.disposeCurrentRequest();var t=this;return this.requestedDisposable=this.scheduler.schedule(e,function(e,n){var r=t._processRequest(n),i=t.hasCompleted||t.hasFailed;return!i&&r>0?(t.requestedCount=r,Tn(function(){t.requestedCount=0})):void 0}),this.requestedDisposable},disposeCurrentRequest:function(){this.requestedDisposable&&(this.requestedDisposable.dispose(),this.requestedDisposable=null)}}),t}(hr);Jn.controlled=function(e,t){return e&&Fn(e)&&(t=e,e=!0),null==e&&(e=!0),new uo(this,e,t)},Jn.pipe=function(e){function t(){n.resume()}var n=this.pausableBuffered();return e.addListener("drain",t),n.subscribe(function(t){!e.write(t)&&n.pause()},function(t){e.emit("error",t)},function(){!e._isStdio&&e.end(),e.removeListener("drain",t)}),n.resume(),e};var lo=function(e){function t(t,n){this._o=t,this._xform=n,e.call(this)}return _n(t,e),t.prototype.next=function(e){var t=Et(this._xform["@@transducer/step"]).call(this._xform,this._o,e);t===Ct&&this._o.onError(t.e)},t.prototype.error=function(e){this._o.onError(e)},t.prototype.completed=function(){this._xform["@@transducer/result"](this._o)},t}(cr);Jn.transduce=function(e){var t=this;return new ho(function(n){var r=e(it(n));return t.subscribe(new lo(n,r))},t)};var ho=dt.AnonymousObservable=function(e){function t(e){return e&&_t(e.dispose)?e:_t(e)?Tn(e):An}function n(e,n){var r=n[0],i=n[1],o=Et(i.__subscribe).call(i,r);o!==Ct||r.fail(Ct.e)||a(Ct.e),r.setDisposable(t(o))}function r(t,n){this.source=n,this.__subscribe=t,e.call(this)}return _n(r,e),r.prototype._subscribe=function(e){var t=new fo(e),r=[t,this];return Gn.scheduleRequired()?Gn.schedule(r,n):n(null,r),t},r}(hr),fo=function(e){function t(t){e.call(this),this.observer=t,this.m=new In}_n(t,e);var n=t.prototype;return n.next=function(e){var t=Et(this.observer.onNext).call(this.observer,e);t===Ct&&(this.dispose(),a(t.e))},n.error=function(e){var t=Et(this.observer.onError).call(this.observer,e);this.dispose(),t===Ct&&a(t.e)},n.completed=function(){var e=Et(this.observer.onCompleted).call(this.observer);this.dispose(),e===Ct&&a(e.e)},n.setDisposable=function(e){this.m.setDisposable(e)},n.getDisposable=function(){return this.m.getDisposable()},n.dispose=function(){e.prototype.dispose.call(this),this.m.dispose()},t}(cr),po=function(e,t){this._s=e,this._o=t};po.prototype.dispose=function(){if(!this._s.isDisposed&&null!==this._o){var e=this._s.observers.indexOf(this._o);this._s.observers.splice(e,1),this._o=null}};var mo=dt.Subject=function(e){function t(){e.call(this),this.isDisposed=!1,this.isStopped=!1,this.observers=[],this.hasError=!1}return _n(t,e),Cn(t.prototype,sr.prototype,{_subscribe:function(e){return kn(this),this.isStopped?this.hasError?(e.onError(this.error),An):(e.onCompleted(),An):(this.observers.push(e),new po(this,e))},hasObservers:function(){return kn(this),this.observers.length>0},onCompleted:function(){if(kn(this),!this.isStopped){this.isStopped=!0;for(var e=0,t=i(this.observers),n=t.length;n>e;e++)t[e].onCompleted();this.observers.length=0}},onError:function(e){if(kn(this),!this.isStopped){this.isStopped=!0,this.error=e,this.hasError=!0;for(var t=0,n=i(this.observers),r=n.length;r>t;t++)n[t].onError(e);this.observers.length=0}},onNext:function(e){if(kn(this),!this.isStopped)for(var t=0,n=i(this.observers),r=n.length;r>t;t++)n[t].onNext(e)},dispose:function(){this.isDisposed=!0,this.observers=null}}),t.create=function(e,t){return new go(e,t)},t}(hr),vo=dt.AsyncSubject=function(e){function t(){e.call(this),this.isDisposed=!1,this.isStopped=!1,this.hasValue=!1,this.observers=[],this.hasError=!1}return _n(t,e),Cn(t.prototype,sr.prototype,{_subscribe:function(e){return kn(this),this.isStopped?(this.hasError?e.onError(this.error):this.hasValue?(e.onNext(this.value),e.onCompleted()):e.onCompleted(),An):(this.observers.push(e),new po(this,e))},hasObservers:function(){return kn(this),this.observers.length>0},onCompleted:function(){var e,t;if(kn(this),!this.isStopped){this.isStopped=!0;var n=i(this.observers),t=n.length;if(this.hasValue)for(e=0;t>e;e++){var r=n[e];r.onNext(this.value),r.onCompleted()}else for(e=0;t>e;e++)n[e].onCompleted();this.observers.length=0}},onError:function(e){if(kn(this),!this.isStopped){this.isStopped=!0,this.hasError=!0,this.error=e;for(var t=0,n=i(this.observers),r=n.length;r>t;t++)n[t].onError(e);this.observers.length=0}},onNext:function(e){kn(this),this.isStopped||(this.value=e,this.hasValue=!0)},dispose:function(){this.isDisposed=!0,this.observers=null,this.error=null,this.value=null}}),t}(hr),go=dt.AnonymousSubject=function(e){function t(t,n){this.observer=t,this.observable=n,e.call(this)}return _n(t,e),Cn(t.prototype,sr.prototype,{_subscribe:function(e){return this.observable.subscribe(e)},onCompleted:function(){this.observer.onCompleted()},onError:function(e){this.observer.onError(e)},onNext:function(e){this.observer.onNext(e)}}),t}(hr),yo=dt.BehaviorSubject=function(e){function t(t){e.call(this),this.value=t,this.observers=[],this.isDisposed=!1,this.isStopped=!1,this.hasError=!1}return _n(t,e),Cn(t.prototype,sr.prototype,{_subscribe:function(e){return kn(this),this.isStopped?(this.hasError?e.onError(this.error):e.onCompleted(),An):(this.observers.push(e),e.onNext(this.value),new po(this,e))},getValue:function(){return kn(this),this.hasError&&a(this.error),this.value},hasObservers:function(){return kn(this),this.observers.length>0},onCompleted:function(){if(kn(this),!this.isStopped){this.isStopped=!0;for(var e=0,t=i(this.observers),n=t.length;n>e;e++)t[e].onCompleted();this.observers.length=0}},onError:function(e){if(kn(this),!this.isStopped){this.isStopped=!0,this.hasError=!0,this.error=e;for(var t=0,n=i(this.observers),r=n.length;r>t;t++)n[t].onError(e);this.observers.length=0}},onNext:function(e){if(kn(this),!this.isStopped){this.value=e;for(var t=0,n=i(this.observers),r=n.length;r>t;t++)n[t].onNext(e)}},dispose:function(){this.isDisposed=!0,this.observers=null,this.value=null,this.error=null}}),t}(hr),bo=dt.ReplaySubject=function(e){function t(e,t){return Tn(function(){t.dispose(),!e.isDisposed&&e.observers.splice(e.observers.indexOf(t),1)})}function n(t,n,i){this.bufferSize=null==t?r:t,this.windowSize=null==n?r:n,this.scheduler=i||Gn,this.q=[],this.observers=[],this.isStopped=!1,this.isDisposed=!1,this.hasError=!1,this.error=null,e.call(this)}var r=Math.pow(2,53)-1;return _n(n,e),Cn(n.prototype,sr.prototype,{_subscribe:function(e){kn(this);var n=new fr(this.scheduler,e),r=t(this,n);this._trim(this.scheduler.now()),this.observers.push(n);for(var i=0,o=this.q.length;o>i;i++)n.onNext(this.q[i].value);return this.hasError?n.onError(this.error):this.isStopped&&n.onCompleted(),n.ensureActive(),r},hasObservers:function(){return kn(this),this.observers.length>0},_trim:function(e){for(;this.q.length>this.bufferSize;)this.q.shift();for(;this.q.length>0&&e-this.q[0].interval>this.windowSize;)this.q.shift()},onNext:function(e){if(kn(this),!this.isStopped){var t=this.scheduler.now();this.q.push({interval:t,value:e}),this._trim(t);for(var n=0,r=i(this.observers),o=r.length;o>n;n++){var a=r[n];a.onNext(e),a.ensureActive()}}},onError:function(e){if(kn(this),!this.isStopped){this.isStopped=!0,this.error=e,this.hasError=!0;var t=this.scheduler.now();this._trim(t);for(var n=0,r=i(this.observers),o=r.length;o>n;n++){var a=r[n];a.onError(e),a.ensureActive()}this.observers.length=0}},onCompleted:function(){if(kn(this),!this.isStopped){this.isStopped=!0;var e=this.scheduler.now();this._trim(e);for(var t=0,n=i(this.observers),r=n.length;r>t;t++){var o=n[t];o.onCompleted(),o.ensureActive()}this.observers.length=0}},dispose:function(){this.isDisposed=!0,this.observers=null}}),n}(hr);dt.Pauser=function(e){function t(){e.call(this)}return _n(t,e),t.prototype.pause=function(){this.onNext(!1)},t.prototype.resume=function(){this.onNext(!0)},t}(mo),e.Rx=dt;var xo=h()}).call(this,o,t);var a,s=o.Rx;!function(e){var n;!function(e){e.Rx=s,e.Promise=t;var n;!function(e){e.CIF=i}(n=e.Formats||(e.Formats={}))}(n=e.Core||(e.Core={}))}(a||(a={}));var a;!function(e){var t;!function(e){e.VERSION={number:"2.4.11",date:"Dec 11 2016"}}(t=e.Core||(e.Core={}))}(a||(a={}));var a;!function(e){var t;!function(t){var n=function(){function e(e){this.computation=e}return e.prototype.bind=function(t){var n=this;return e.create(function(e){n.run(e).result.then(function(n){t(n).run(e).result.then(e.resolve).catch(e.reject)}).catch(e.reject)})},e.prototype.map=function(t){var n=this;return e.create(function(e){n.run(e).result.then(function(n){return e.resolve(t(n))}).catch(e.reject)})},e.prototype.run=function(n){var r=this,i=n?n:new e.Context;return{progress:i.progressStream,result:new t.Promise(function(e,t){try{i.__push(e,t),r.computation(i)}catch(n){i.reject(n)}})}},e}();t.Computation=n,function(n){function r(e){return new n(e)}function i(e){return r(function(t){return t.resolve(e)})}function o(t,n,r){return void 0===r&&(r=0),new e.Core.Promise(function(e){return t.schedule(function(){try{e(n())}finally{e(void 0)}},r)})}n.create=r,n.resolve=i,n.schedule=o;var a=function(){function e(){var e=this;this._abortRequested=!1,this._abortRequest=function(){return e._abortRequested=!0},this.progressTick=new t.Rx.Subject,this.progress={message:"Working...",current:0,max:0,isIndeterminate:!1,requestAbort:void 0},this.progressStream=new t.Rx.BehaviorSubject(this.progress),this.promiseStack=[],this.resolve=this._resolve.bind(this),this.reject=this._reject.bind(this),this.progressTick.throttle(1e3/30).subscribe(function(t){e.progressStream.onNext({message:t.message,isIndeterminate:t.isIndeterminate,current:t.current,max:t.max,requestAbort:t.requestAbort})})}return e.prototype.schedule=function(e,t){var n=this;void 0===t&&(t=0),setTimeout(function(){try{e()}catch(t){n.reject(t)}},t)},Object.defineProperty(e.prototype,"abortRequested",{get:function(){return this._abortRequested},enumerable:!0,configurable:!0}),e.prototype.setRequestAbort=function(e){this.progress.requestAbort=e},Object.defineProperty(e.prototype,"abortRequest",{get:function(){return this._abortRequest},enumerable:!0,configurable:!0}),e.prototype.update=function(e,t,n,r){void 0===n&&(n=0/0),void 0===r&&(r=0/0),this.progress.message=e,this.progress.requestAbort=t,isNaN(n)?this.progress.isIndeterminate=!0:(this.progress.isIndeterminate=!1,this.progress.current=n,this.progress.max=r),this.progressTick.onNext(this.progress)},e.prototype.__push=function(e,t){this.promiseStack.push({resolve:e,reject:t})},e.prototype._resolve=function(e){var t=this.promiseStack.pop();if(!t)throw"Bug in code somewhere, Computation.resolve/reject called too many times.";t.resolve(e),this.promiseStack.length||(this.progressTick.onCompleted(),this.progressStream.onCompleted())},e.prototype._reject=function(e){var t=this.promiseStack.pop();if(!t)throw"Bug in code somewhere, Computation.resolve/reject called too many times.";t.reject(e),this.promiseStack.length||(this.progressTick.onCompleted(),this.progressStream.onCompleted())},e.prototype.abort=function(){this.reject("Aborted.")},e}();n.Context=a}(n=t.Computation||(t.Computation={}))}(t=e.Core||(e.Core={}))}(a||(a={}));var a;!function(e){var t;!function(e){var t;!function(e){function t(e,t,n){for(var r,i=t,o=e,a=n,s=0,u=Object.keys(t);s<u.length;s++){var c=u[s];r=i[c],void 0!==r?o[c]=r:n&&(o[c]=a[c])}if(n)for(var l=0,h=Object.keys(n);l<h.length;l++){var c=h[l];r=o[c],void 0===r&&(o[c]=a[c])}return e}function n(e,t){var n,r,i,o,a,s,u,c=0,l=0,h=!0,f=!1;t=Math.max(0,t)||0;var p=function(){var l=t-(performance.now()-o);if(0>=l){r&&clearTimeout(r);var h=u;r=s=u=void 0,h&&(c=performance.now(),i=e.apply(a,n),s||r||(n=a=null))}else s=setTimeout(p,l)},d=function(){s&&clearTimeout(s),r=s=u=void 0,(h||l!==t)&&(c=performance.now(),i=e.apply(a,n),s||r||(n=a=null))};return function(){n=arguments,o=performance.now(),a=this,u=h&&(s||!f);var m=!1,v=!1;if(0===l);else{r||f||(c=o);var g=l-(o-c),y=0>=g;y?(r&&(r=clearTimeout(r)),c=o,i=e.apply(a,n)):r||(r=setTimeout(d,g))}return m&&s?s=clearTimeout(s):s||t===l||(s=setTimeout(p,t)),v&&(m=!0,i=e.apply(a,n)),!m||s||r||(n=a=null),i}}e.extend=t,e.debounce=n}(t=e.Utils||(e.Utils={}))}(t=e.Core||(e.Core={}))}(a||(a={}));var a;!function(e){var t;!function(e){var t;!function(e){function t(e){var t=new Int32Array(e.size);return e.forEach(function(e){this.array[this.index++]=e},{array:t,index:0}),Array.prototype.sort.call(t,function(e,t){return e-t}),t}function n(e){for(var t=[],n=0;e>n;n++)t[n]=0;return t}function r(e){var t=[];if(!e)return t;t[0]=.1;for(var n=0;e>n;n++)t[n]=0;return t}e.integerSetToSortedTypedArray=t,e.makeNativeIntArray=n,e.makeNativeFloatArray=r;var i;!function(e){function t(e){return e.creator&&e.chunkSize}function n(e,t,n,r,i){return 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++]=n,e.current[e.currentIndex++]=r,e.current[e.currentIndex++]=i,e.elementCount++}function r(e,t,n,r){return 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++]=n,e.current[e.currentIndex++]=r,e.elementCount++}function i(e,t,n){return 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++]=n,e.elementCount++}function o(e,t){return 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.elementCount++}function a(e){var t,n=e.creator(e.elementSize*e.elementCount),r=(e.parts.length-1)*e.chunkSize,i=0;if(e.parts.length>1)if(e.parts[0].buffer)for(var o=0;o<e.parts.length-1;o++)n.set(e.parts[o],e.chunkSize*o);else for(var o=0;o<e.parts.length-1;o++){i=e.chunkSize*o,t=e.parts[o];for(var a=0;a<e.chunkSize;a++)n[i+a]=t[a]}if(e.current.buffer&&e.currentIndex>=e.chunkSize)n.set(e.current,e.chunkSize*(e.parts.length-1));else for(var o=0;o<e.currentIndex;o++)n[r+o]=e.current[o];return n}function s(e){return void 0===e&&(e=262144),d(function(e){return new Float32Array(e)},e,3)}function u(e){return void 0===e&&(e=262144),d(function(e){return new Uint32Array(e)},e,3)}function c(e){return void 0===e&&(e=131072),d(function(e){return new Int32Array(e)},e,2)}function l(e){return void 0===e&&(e=131072),d(function(e){return new Int32Array(e)},e,1)}function h(e){return void 0===e&&(e=131072),d(function(e){return new Int32Array(e)},e,1)}function f(e){return void 0===e&&(e=131072),d(function(e){return new Float32Array(e)
},e,1)}function p(e){return void 0===e&&(e=131072),d(function(){return[]},e,1)}function d(e,t,n){t=0|t,0>=t&&(t=1);var r=t*n,i=e(r);return{elementSize:n,chunkSize:r,creator:e,current:i,parts:[i],currentIndex:0,elementCount:0}}e.is=t,e.add4=n,e.add3=r,e.add2=i,e.add=o,e.compact=a,e.forVertex3D=s,e.forIndexBuffer=u,e.forTokenIndices=c,e.forIndices=l,e.forInt32=h,e.forFloat32=f,e.forArray=p,e.create=d}(i=e.ChunkedArray||(e.ChunkedArray={}));var o;!function(e){function t(e,t,n,r){var i=e.array;i[e.currentIndex++]=t,i[e.currentIndex++]=n,i[e.currentIndex++]=r,e.elementCount++}function n(e,t,n){var r=e.array;r[e.currentIndex++]=t,r[e.currentIndex++]=n,e.elementCount++}function r(e,t){e.array[e.currentIndex++]=t,e.elementCount++}function i(e){return h(function(e){return new Float32Array(e)},e,3)}function o(e){return h(function(e){return new Int32Array(e)},e,3)}function a(e){return h(function(e){return new Int32Array(e)},e,2)}function s(e){return h(function(e){return new Int32Array(e)},e,1)}function u(e){return h(function(e){return new Int32Array(e)},e,1)}function c(e){return h(function(e){return new Float32Array(e)},e,1)}function l(e){return h(function(){return[]},e,1)}function h(e,t,n){return t=0|t,{array:e(t*n),currentIndex:0,elementCount:0}}e.add3=t,e.add2=n,e.add=r,e.forVertex3D=i,e.forIndexBuffer=o,e.forTokenIndices=a,e.forIndices=s,e.forInt32=u,e.forFloat32=c,e.forArray=l,e.create=h}(o=e.ArrayBuilder||(e.ArrayBuilder={}))}(t=e.Utils||(e.Utils={}))}(t=e.Core||(e.Core={}))}(a||(a={}));var a;!function(e){var t;!function(e){var t;!function(e){var t;!function(e){function t(e,t,r){for(;r>t&&32===e.charCodeAt(t);)t++;return n(e,t,r)}function n(e,t,n){var r=0,i=1;for(45===e.charCodeAt(t)&&(i=-1,t++);n>t;t++){var o=e.charCodeAt(t)-48;if(o>9||0>o)return i*r|0;r=10*r+o|0}return i*r}function r(e,t,r,i){return e*Math.pow(10,n(t,r,i))}function i(e,t,n){for(;n>t&&32===e.charCodeAt(t);)t++;return o(e,t,n)}function o(e,t,n){var i=1,o=0,a=0,s=1;for(45===e.charCodeAt(t)&&(i=-1,++t);n>t;){var u=e.charCodeAt(t)-48;if(!(u>=0&&10>u)){if(-2===u){for(++t;n>t;){if(u=e.charCodeAt(t)-48,!(u>=0&&10>u))return 53===u||21===u?r(i*(o+a/s),e,t+1,n):i*(o+a/s);a=10*a+u,s=10*s,++t}return i*(o+a/s)}if(53===u||21===u)return r(i*o,e,t+1,n);break}o=10*o+u,++t}return i*o}e.parseIntSkipTrailingWhitespace=t,e.parseInt=n,e.parseScientific=r,e.parseFloatSkipTrailingWhitespace=i,e.parseFloat=o}(t=e.FastNumberParsers||(e.FastNumberParsers={}))}(t=e.Utils||(e.Utils={}))}(t=e.Core||(e.Core={}))}(a||(a={}));var a;!function(e){var t;!function(e){var t;!function(e){var t;!function(e){e.perfGetTime=function(){return"undefined"!=typeof window&&window.performance?function(){return window.performance.now()}:"undefined"!=typeof process&&"undefined"!==process.hrtime?function(){var e=process.hrtime();return 1e3*e[0]+e[1]/1e6}:function(){return+new Date}}()}(t||(t={}));var n=function(){function e(){this.starts=new Map,this.ends=new Map}return e.currentTime=function(){return t.perfGetTime()},e.prototype.start=function(e){this.starts.set(e,t.perfGetTime())},e.prototype.end=function(e){this.ends.set(e,t.perfGetTime())},e.format=function(e){if(isNaN(e))return"n/a";for(var t=Math.floor(e/36e5),n=Math.floor(e/6e4%60),r=Math.floor(e/1e3%60),i=Math.floor(e%1e3).toString();i.length<3;)i="0"+i;return t>0?t+"h"+n+"m"+r+"."+i+"s":n>0?n+"m"+r+"."+i+"s":r>0?r+"."+i+"s":e.toFixed(0)+"ms"},e.prototype.formatTime=function(t){return e.format(this.time(t))},e.prototype.formatTimeSum=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return e.format(this.timeSum.apply(this,t))},e.prototype.time=function(e){var t=this.starts.get(e),n=this.ends.get(e);return this.starts.delete(e),this.ends.delete(e),n-t},e.prototype.timeSum=function(){for(var e=this,t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];for(var r=0,i=0,o=t.map(function(t){return e.ends.get(t)-e.starts.get(t)});i<o.length;i++){var a=o[i];r+=a}return r},e}();e.PerformanceMonitor=n}(t=e.Utils||(e.Utils={}))}(t=e.Core||(e.Core={}))}(a||(a={}));var a;!function(e){var t;!function(e){var t;!function(e){var t;!function(e){function t(e){return e.name&&e.parse}function n(e,t){t=t.toLowerCase().trim();for(var n=0,r=e;n<r.length;n++)for(var i=r[n],o=0,a=i.shortcuts;o<a.length;o++){var s=a[o];if(s.toLowerCase()===t)return i}return void 0}function r(e){return new RegExp(e.extensions.map(function(e){return"(\\"+e+")"}).join("|")+"(\\.gz){0,1}$","i")}function i(e){return e.map(function(e){return e.extensions.map(function(e){return e+","+e+".gz"}).join(",")}).join(",")}function o(e,t){for(var n=0,i=t;n<i.length;n++){var o=i[n];if(r(o).test(e))return o}return void 0}e.is=t,e.fromShortcut=n,e.formatRegExp=r,e.formatFileFilters=i,e.getFormat=o}(t=e.FormatInfo||(e.FormatInfo={}));var n;!function(e){function t(e,t){return void 0===t&&(t=-1),new r(e,t)}function n(e,t){return void 0===t&&(t=[]),new i(e,t)}e.error=t,e.success=n}(n=e.ParserResult||(e.ParserResult={}));var r=function(){function e(e,t){this.message=e,this.line=t,this.isError=!0}return e.prototype.toString=function(){return this.line>=0?"[Line "+this.line+"] "+this.message:this.message},e}();e.ParserError=r;var i=function(){function e(e,t){this.result=e,this.warnings=t,this.isError=!1}return e}();e.ParserSuccess=i;var o;!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 n(e,n,r){e.count>=e.tokensLenMinus2&&t(e),e.tokens[e.count++]=n,e.tokens[e.count++]=r}function r(e){return{tokensLenMinus2:e-2|0,count:0,tokens:new Int32Array(e)}}e.addToken=n,e.create=r}(o=e.TokenIndexBuilder||(e.TokenIndexBuilder={}));var a;!function(e){function t(){return new Map}function n(e,t){if(t.length>6)return t;var n=e.get(t);return void 0!==n?n:(e.set(t,t),t)}e.create=t,e.get=n}(a=e.ShortStringPool||(e.ShortStringPool={}))}(t=e.Formats||(e.Formats={}))}(t=e.Core||(e.Core={}))}(a||(a={}));var a;!function(e){var t;!function(e){var t;!function(t){var n;!function(t){var n;!function(t){function n(t,n,r,i){var o,a,s,u=e.Geometry.LinearAlgebra.Matrix4.identity();for(o=1;3>=o;o++){for(a=1;3>=a;a++)s=n+"["+o+"]["+a+"]",e.Geometry.LinearAlgebra.Matrix4.setValue(u,o-1,a-1,t.getColumn(n+"["+o+"]["+a+"]").getFloat(i));e.Geometry.LinearAlgebra.Matrix4.setValue(u,o-1,3,t.getColumn(r+"["+o+"]").getFloat(i))}return u}function r(e,t,n){var r=0;if(!n||!n.isDefined)return t;for(r=e+1;t>r&&n.areValuesEqual(r-1,r);r++);return r}function i(e){for(var t=new Map,n=0,r=E;n<r.length;n++){var i=r[n];t.set(i,e.getColumn(i))}return t}function o(t,n,i){for(var o=r(t,n,i.get("pdbx_PDB_model_num")),a=new e.Structure.DataTableBuilder(o-t),s=a.addColumn("id",function(e){return new Int32Array(e)}),u=i.get("id"),c=a.addColumn("x",function(e){return new Float32Array(e)}),l=i.get("Cartn_x"),h=a.addColumn("y",function(e){return new Float32Array(e)}),f=i.get("Cartn_y"),p=a.addColumn("z",function(e){return new Float32Array(e)}),d=i.get("Cartn_z"),m=a.addColumn("altLoc",function(e){return new Array(e)}),v=i.get("label_alt_id"),g=a.addColumn("rowIndex",function(e){return new Int32Array(e)}),y=a.addColumn("residueIndex",function(e){return new Int32Array(e)}),b=a.addColumn("chainIndex",function(e){return new Int32Array(e)}),x=a.addColumn("entityIndex",function(e){return new Int32Array(e)}),w=a.addColumn("name",function(e){return new Array(e)}),_=i.get("label_atom_id"),E=a.addColumn("elementSymbol",function(e){return new Array(e)}),S=i.get("type_symbol"),M=a.addColumn("occupancy",function(e){return new Float32Array(e)}),T=i.get("occupancy"),A=a.addColumn("tempFactor",function(e){return new Float32Array(e)}),P=i.get("B_iso_or_equiv"),k=a.addColumn("authName",function(e){return new Array(e)}),R=i.get("auth_atom_id"),I=(i.get("label_seq_id"),i.get("label_asym_id")),D=i.get("label_entity_id"),B=i.get("pdbx_PDB_ins_code"),V=i.get("auth_seq_id"),L=i.get("pdbx_PDB_model_num"),N=0,O=0,F=0,U=t,z=t;o>z;z++){var $=z-t;s[$]=u.getInteger(z),c[$]=l.getFloat(z),h[$]=f.getFloat(z),p[$]=d.getFloat(z),E[$]=S.getString(z)||C.ElementSymbol,w[$]=_.getString(z)||E[$],k[$]=R.getString(z)||w[$],m[$]=v.getString(z),M[$]=T.getFloat(z),A[$]=P.getFloat(z);var H=!1,j=!V.areValuesEqual(U,z)||!B.areValuesEqual(U,z);I.areValuesEqual(U,z)||(H=!0,j=!0),D.areValuesEqual(U,z)||(F++,H=!0,j=!0),j&&O++,H&&N++,g[$]=z,y[$]=O,b[$]=N,x[$]=F,U=z}var G=L.isDefined?L.getString(t)||C.ModelId:C.ModelId;return{atoms:a.seal(),modelId:G,endRow:o}}function a(t,n){var r=n.count,i=n.residueIndex,o=n.chainIndex,a=n.entityIndex,s=new e.Structure.DataTableBuilder(n.residueIndex[n.count-1]+1),u=new e.Structure.DataTableBuilder(n.chainIndex[n.count-1]+1),c=new e.Structure.DataTableBuilder(n.entityIndex[n.count-1]+1),l=s.addColumn("name",function(e){return new Array(e)}),h=s.addColumn("seqNumber",function(e){return new Int32Array(e)}),f=s.addColumn("asymId",function(e){return new Array(e)}),p=s.addColumn("authName",function(e){return new Array(e)}),d=s.addColumn("authSeqNumber",function(e){return new Int32Array(e)}),m=s.addColumn("authAsymId",function(e){return new Array(e)}),v=s.addColumn("insCode",function(e){return new Array(e)}),g=s.addColumn("entityId",function(e){return new Array(e)}),y=s.addColumn("isHet",function(e){return new Int8Array(e)}),b=s.addColumn("atomStartIndex",function(e){return new Int32Array(e)}),x=s.addColumn("atomEndIndex",function(e){return new Int32Array(e)}),w=s.addColumn("chainIndex",function(e){return new Int32Array(e)}),_=s.addColumn("entityIndex",function(e){return new Int32Array(e)}),E=(s.addColumn("secondaryStructureIndex",function(e){return new Int32Array(e)}),u.addColumn("asymId",function(){return[]})),S=u.addColumn("entityId",function(){return[]}),M=u.addColumn("authAsymId",function(){return[]}),T=u.addColumn("atomStartIndex",function(e){return new Int32Array(e)}),A=u.addColumn("atomEndIndex",function(e){return new Int32Array(e)}),P=u.addColumn("residueStartIndex",function(e){return new Int32Array(e)}),k=u.addColumn("residueEndIndex",function(e){return new Int32Array(e)}),R=u.addColumn("entityIndex",function(e){return new Int32Array(e)}),I=c.addColumn("entityId",function(){return[]}),D=c.addColumn("entityType",function(){return[]}),B=c.addColumn("type",function(){return[]}),V=c.addColumn("atomStartIndex",function(e){return new Int32Array(e)}),L=c.addColumn("atomEndIndex",function(e){return new Int32Array(e)}),N=c.addColumn("residueStartIndex",function(e){return new Int32Array(e)}),O=c.addColumn("residueEndIndex",function(e){return new Int32Array(e)}),F=c.addColumn("chainStartIndex",function(e){return new Int32Array(e)}),U=c.addColumn("chainEndIndex",function(e){return new Int32Array(e)}),z=t.get("label_comp_id"),$=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"),K=0,Q=0,Z=0,J=0,et=0,tt=0,nt=0,rt=0,it=0,ot=0;for(ot=0;r>ot;ot++)i[ot]!==i[K]&&(l[nt]=z.getString(K)||C.ResidueName,h[nt]=$.getInteger(K),f[nt]=H.getString(K)||C.AsymId,p[nt]=j.getString(K)||l[nt],d[nt]=G.getInteger(K),m[nt]=W.getString(K)||f[nt],v[nt]=Y.getString(K),g[nt]=X.getString(K)||C.EntityId,y[nt]=q.stringEquals(K,"HETATM")?1:0,b[nt]=K,x[nt]=ot,w[nt]=rt,_[nt]=it,nt++,K=ot),o[ot]!==o[Q]&&(E[rt]=H.getString(Q)||C.AsymId,M[rt]=W.getString(Q)||E[rt],S[rt]=X.getString(Q)||C.EntityId,P[rt]=tt,k[rt]=nt,T[rt]=Q,A[rt]=ot,R[rt]=it,rt++,Q=ot,tt=nt),a[ot]!==a[Z]&&(I[it]=X.getString(Z)||C.EntityId,D[it]=e.Structure.EntityType.Unknown,B[it]="unknown",V[it]=Z,L[it]=ot,N[it]=et,O[it]=nt,F[it]=J,U[it]=rt,it++,Z=ot,J=rt,et=nt);return I[it]=X.getString(Z)||C.EntityId,D[it]=e.Structure.EntityType.Unknown,B[it]="unknown",V[it]=Z,L[it]=ot,N[it]=et,O[it]=nt+1,F[it]=J,U[it]=rt+1,E[rt]=H.getString(Q)||C.AsymId,M[rt]=W.getString(Q)||E[rt],S[rt]=X.getString(Q)||C.EntityId,P[rt]=tt,k[rt]=nt+1,T[rt]=Q,A[rt]=ot,R[rt]=it,l[nt]=z.getString(K)||C.ResidueName,h[nt]=$.getInteger(K),f[nt]=H.getString(K)||C.AsymId,p[nt]=j.getString(K)||l[nt],d[nt]=G.getInteger(K),m[nt]=W.getString(K)||f[nt],v[nt]=Y.getString(K),b[nt]=K,x[nt]=ot,w[nt]=rt,_[nt]=it,y[nt]=q.stringEquals(K,"HETATM")?1:0,{residues:s.seal(),chains:u.seal(),entities:c.seal()}}function s(t,n){var r;for(r=0;r<n.count;r++)n.entityType[r]=e.Structure.EntityType.Unknown;if(t){var i,o={},a={},s=t.getColumn("type"),u=t.getColumn("id");for(r=0;r<t.rowCount;r++){var c=(s.getString(r)||"").toLowerCase();switch(c){case"polymer":i=e.Structure.EntityType.Polymer;break;case"non-polymer":i=e.Structure.EntityType.NonPolymer;break;case"water":i=e.Structure.EntityType.Water;break;default:i=e.Structure.EntityType.Unknown}var l=u.getString(r)||C.EntityId;o[l]=i,a[l]=""!==c?c:"unknown"}for(r=0;r<n.count;r++)i=o[n.entityId[r]],void 0!==i&&(n.entityType[r]=i,n.type[r]=a[n.entityId[r]])}}function u(t,n,r,i){return new e.Structure.PolyResidueIdentifier(n.getString(t)||C.AsymId,r.getInteger(t),i.getString(t))}function c(t,n,r,i){if(r.entityType[n.entityIndex[i]]!==e.Structure.EntityType.Polymer)return!1;for(var o=!1,a=!1,s=t.name,u=0,c=n.atomStartIndex[i],l=n.atomEndIndex[i];l>c;c++){var h=s[c];if(o||"CA"!==h?a||"O"!==h||(a=!0,u++):(o=!0,u++),2===u)break}return o&&a||o&&!n.isHet[i]}function l(t,n,r,i){if(S[n.name[i]]||r.entityType[n.entityIndex[i]]!==e.Structure.EntityType.Polymer)return!1;var o=!1,a=!1,s=!1,u=!1,c=t.name,l=0,h=n.atomStartIndex[i],f=n.atomEndIndex[i];if(f-h===1&&!n.isHet[h]&&"P"===c[h])return!0;for(var p=h;f>p;p++){var d=c[p];if(o||"O5'"!==d?a||"C3'"!==d?s||"N3"!==d?u||"P"!==d||(u=!0,l++):(s=!0,l++):(a=!0,l++):(o=!0,l++),4===l)break}return o&&a&&s&&u}function h(t,n,r,i,o,a){for(var s=n.asymId,u=n.entityIndex,h=0,f=i,p=i,d=o;d>f;){if(l(t,n,r,f)){for(p=f+1;d>p&&s[f]===s[p]&&u[f]===u[p]&&l(t,n,r,p);)p++;h=5}else if(c(t,n,r,f)){for(p=f+1;d>p&&s[f]===s[p]&&u[f]===u[p]&&c(t,n,r,p);)p++;h=4}else{for(p=f+1;d>p&&s[f]===s[p]&&u[f]===u[p]&&!l(t,n,r,p)&&!c(t,n,r,p);)p++;h=0}var m=new e.Structure.SecondaryStructureElement(h,new e.Structure.PolyResidueIdentifier(n.asymId[f],n.seqNumber[f],n.insCode[f]),new e.Structure.PolyResidueIdentifier(n.asymId[p-1],n.seqNumber[p-1],n.insCode[p-1]));m.startResidueIndex=f,m.endResidueIndex=p,a[a.length]=m,f=p}}function f(t,n){for(var r=[],i=t.authSeqNumber,o=0,a=n;o<a.length;o++){for(var s=a[o],u=s.startResidueIndex,c=s.endResidueIndex-1,l=s.startResidueIndex;c>l;l++)if(i[l+1]-i[l]!==1){var h=new e.Structure.SecondaryStructureElement(s.type,s.startResidueId,s.endResidueId,s.info);h.startResidueIndex=u,h.endResidueIndex=l+1,r[r.length]=h,u=l+1}if(u===s.startResidueIndex)r[r.length]=s;else{var h=new e.Structure.SecondaryStructureElement(s.type,s.startResidueId,s.endResidueId,s.info);h.startResidueIndex=u,h.endResidueIndex=s.endResidueIndex,r[r.length]=h}}return r}function p(e,t){for(var n=t.residues,r=n.count,i=n.asymId,o=n.seqNumber,a=n.insCode,s=void 0,u="",c=new Map,l=new Map,h=0,f=e;h<f.length;h++){var p=f[h];u=p.startResidueId.asymId+" "+p.startResidueId.seqNumber,p.startResidueId.insCode&&(u+=" "+p.startResidueId.insCode),c.set(u,p),u=p.endResidueId.asymId+" "+p.endResidueId.seqNumber,p.endResidueId.insCode&&(u+=" "+p.endResidueId.insCode),l.set(u,p)}for(var m=0;r>m;m++)u=i[m]+" "+o[m],a[m]&&(u+=" "+a[m]),s=c.get(u),s&&(s.startResidueIndex=m,s.endResidueIndex=m+1),s=l.get(u),s&&(s.startResidueIndex<0&&(s.startResidueIndex=m),s.endResidueIndex=m+1);s&&(s.endResidueIndex=r);for(var v=[],g=0,y=e;g<y.length;g++){var p=y[g];p.startResidueIndex<0||p.endResidueIndex<0||3===p.type&&p.length<3||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++)v[m+1].startResidueIndex-v[m].endResidueIndex===-1&&v[m+1].startResidueIndex++;if(!v.length)return v;for(var b=[v[0]],m=1;m<v.length;m++){var x=b[b.length-1],w=v[m];w.startResidueIndex<x.endResidueIndex?d(x,w):b[b.length]=w}return b}function d(e,t){t.endResidueIndex>e.endResidueIndex&&(e.endResidueIndex=t.endResidueIndex)}function m(t,n,r){var i,o=[],a=[],s=t.getCategory("_struct_conf"),c=t.getCategory("_struct_sheet_range");if(s){var l=s.getColumn("conf_type_id");if(l){var d=s.getColumn("beg_label_asym_id"),m=s.getColumn("beg_label_seq_id"),v=s.getColumn("pdbx_beg_PDB_ins_code"),g=s.getColumn("end_label_asym_id"),y=s.getColumn("end_label_seq_id"),b=s.getColumn("pdbx_end_PDB_ins_code"),x=s.getColumn("pdbx_PDB_helix_class");for(i=0;i<s.rowCount;i++){var w=void 0;switch((l.getString(i)||"").toUpperCase()){case"HELX_P":w=1;break;case"TURN_P":w=2}w&&(o[o.length]=new e.Structure.SecondaryStructureElement(w,u(i,d,m,v),u(i,g,y,b),{helixClass:x.getString(i)}))}}}if(c){{var d=c.getColumn("beg_label_asym_id"),m=c.getColumn("beg_label_seq_id"),v=c.getColumn("pdbx_beg_PDB_ins_code"),g=c.getColumn("end_label_asym_id"),y=c.getColumn("end_label_seq_id"),b=c.getColumn("pdbx_end_PDB_ins_code"),_=c.getColumn("symmetry"),C=c.getColumn("sheet_id");c.getColumn("id")}for(i=0;i<c.rowCount;i++)o[o.length]=new e.Structure.SecondaryStructureElement(3,u(i,d,m,v),u(i,g,y,b),{symmetry:_.getString(i),sheetId:C.getString(i),id:C.getString(i)})}var E=o.length>0?p(o,r):[],S=r.residues,M=S.count;if(0===E.length)return h(n,S,r.entities,0,M,a),f(S,a);var T=E.length-1;for(E[0].startResidueIndex>0&&h(n,S,r.entities,0,E[0].startResidueIndex,a),i=0;T>i;i++)a[a.length]=E[i],E[i+1].startResidueIndex-E[i].endResidueIndex>0&&h(n,S,r.entities,E[i].endResidueIndex,E[i+1].startResidueIndex,a);return a[a.length]=E[T],E[T].endResidueIndex<M&&h(n,S,r.entities,E[T].endResidueIndex,M,a),f(S,a)}function v(e,t){for(var n=e.secondaryStructureIndex,r=0,i=0,o=t;i<o.length;i++){for(var a=o[i],s=a.startResidueIndex;s<a.endResidueIndex;s++)n[s]=r;r++}return n}function g(e){for(var t,n=/\(?([^\(\)]+)\)?]*/g,r=[],i=[];t=n.exec(e);)r[r.length]=t[1];return r.forEach(function(e){var t=[];e.split(",").forEach(function(e){var n=e.indexOf("-");if(n>0)for(var r=parseInt(e.substring(0,n)),i=parseInt(e.substr(n+1)),o=r;i>=o;o++)t[t.length]=o.toString();else t[t.length]=e.trim()}),i[i.length]=t}),i}function y(t){var r=t.getCategory("_pdbx_struct_assembly"),i=t.getCategory("_pdbx_struct_assembly_gen"),o=t.getCategory("_pdbx_struct_oper_list");if(!r||!i||!o)return void 0;var a,s={},u=[],c=new Map,l=i.getColumn("assembly_id"),h=i.getColumn("oper_expression"),f=i.getColumn("asym_id_list");for(a=0;a<i.rowCount;a++){var p=l.getString(a);if(!p)return void 0;var d=c.get(p);d||(d=new e.Structure.AssemblyGen(p),c.set(p,d),u.push(d)),d.gens.push(new e.Structure.AssemblyGenEntry(g(h.getString(a)),f.getString(a).split(",")))}var m=o.getColumn("id"),v=o.getColumn("name");for(a=0;a<o.rowCount;a++){var y=n(o,"matrix","vector",a);if(!y)return void 0;var b=new e.Structure.AssemblyOperator(m.getString(a),v.getString(a),y);s[b.id]=b}return new e.Structure.AssemblyInfo(s,u)}function b(t){var r=t.getCategory("_cell"),i=t.getCategory("_symmetry"),o=t.getCategory("_atom_sites"),a="",s=[1,1,1],u=[90,90,90],c=e.Geometry.LinearAlgebra.Matrix4.identity(),l=!1;if(!r||!i)return void 0;if(a=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)],!a||s.every(function(e){return isNaN(e)||0===e})||s.every(function(e){return isNaN(e)||0===e}))return void 0;var h=function(e){return e*e},f=function(e){return e*Math.PI/180},p=s[0],d=s[1],m=s[2],v=f(u[0]),g=f(u[1]),y=f(u[2]),b=p*d*m*Math.sqrt(1-h(Math.cos(v))-h(Math.cos(g))-h(Math.cos(y))+2*Math.cos(v)*Math.cos(g)*Math.cos(y)),x=e.Geometry.LinearAlgebra.Matrix4.ofRows([[p,d*Math.cos(y),m*Math.cos(g),0],[0,d*Math.sin(y),m*(Math.cos(v)-Math.cos(g)*Math.cos(y))/Math.sin(y),0],[0,0,b/(p*d*Math.sin(y)),0],[0,0,0,1]]),w=e.Geometry.LinearAlgebra.Matrix4.identity();if(e.Geometry.LinearAlgebra.Matrix4.invert(w,x),o){var _=n(o,"fract_transf_matrix","fract_transf_vector",0);_&&(c=_,e.Geometry.LinearAlgebra.Matrix4.areEqual(w,_,1e-4)||(l=!0))}else c=w;return new e.Structure.SymmetryInfo(a,s,u,c,l)}function x(t){if(!t||!t.rowCount)return void 0;for(var n=new e.Structure.ComponentBondInfo,r=t.getColumn("comp_id"),i=t.getColumn("atom_id_1"),o=t.getColumn("atom_id_2"),a=t.getColumn("value_order"),s=t.rowCount,u=n.newEntry(r.getString(0)),c=0;s>c;c++){var l=r.getString(c),h=i.getString(c),f=o.getString(c),p=a.getString(c);u.id!==l&&(u=n.newEntry(l));var d=void 0;switch(p.toLowerCase()){case"sing":d=1;break;case"doub":case"delo":d=2;break;case"trip":d=3;break;case"quad":d=4;break;default:d=0}u.add(h,f,d)}return n}function w(t,n,r){var i,u=o(t,n.getCategory("_atom_site").rowCount,r),c=u.atoms,l=u.modelId,h=u.endRow,f=a(r,c),p=n.getCategory("_entry");i=p&&p.getColumn("id").isDefined?p.getColumn("id").getString(0):n.header,s(n.getCategory("_entity"),f.entities);var d=m(n,c,f);return v(f.residues,d),{model:new e.Structure.MoleculeModel({id:i,modelId:l,atoms:c,residues:f.residues,chains:f.chains,entities:f.entities,componentBonds:x(n.getCategory("_chem_comp_bond")),secondaryStructure:d,symmetryInfo:b(n),assemblyInfo:y(n),source:e.Structure.MoleculeModelSource.File}),endRow:h}}function _(t){var n=[],r=t.getCategory("_atom_site"),o=0;if(!r)throw"'_atom_site' category is missing in the input.";var a,s=t.getCategory("_entry"),u=i(r);for(a=s&&s.getColumn("id").isDefined?s.getColumn("id").getString(0):t.header;o<r.rowCount;){var c=w(o,t,u),l=c.model,h=c.endRow;n.push(l),o=h}var f=void 0,p=t.getCategory("_exptl");return p&&(f=p.getColumn("method").getString(0)||void 0),new e.Structure.Molecule(a,n,{experimentMethod:f})}var C;!function(e){e.ElementSymbol="X",e.ResidueName="UNK",e.AsymId="",e.EntityId="1",e.ModelId="1"}(C||(C={}));var E=["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"],S={ALA:!0,ARG:!0,ASP:!0,CYS:!0,GLN:!0,GLU:!0,GLY:!0,HIS:!0,ILE:!0,LEU:!0,LYS:!0,MET:!0,PHE:!0,PRO:!0,SER:!0,THR:!0,TRP:!0,TYR:!0,VAL:!0,ASN:!0,PYL:!0,SEC:!0};t.ofDataBlock=_}(n=t.mmCIF||(t.mmCIF={}))}(n=t.Molecule||(t.Molecule={}))}(t=e.Formats||(e.Formats={}))}(t=e.Core||(e.Core={}))}(a||(a={}));var a;!function(e){var t;!function(e){var t;!function(t){var n;!function(n){var r;!function(n){var r=function(){function e(e,t,n,r){this.header=e,this.crystInfo=t,this.models=n,this.data=r}return 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"),n=t.CIF.Text.parse(e);if(n.isError)throw n.toString();return n.result.dataBlocks[0].getCategory("_entity")},e.prototype.toCifFile=function(){var e={dot:n.Parser.getDotRange(this.data.length),question:n.Parser.getQuestionmarkRange(this.data.length),numberTokens:n.Parser.getNumberRanges(this.data.length),data:this.data},r=new t.CIF.Text.File(this.data),i=new t.CIF.Text.DataBlock(this.data,this.header.id);if(r.dataBlocks.push(i),i.addCategory(this.makeEntities()),this.crystInfo){var o=this.crystInfo.toCifCategory(this.header.id),a=o.cell,s=o.symm;i.addCategory(a),i.addCategory(s)}return i.addCategory(this.models.toCifCategory(i,e)),r},e}();n.MoleculeData=r;var i=function(){function e(e){this.id=e}return e}();n.Header=i;var o=function(){function e(e){this.record=e}return e.prototype.getValue=function(){var e=this.record.substr(6,9).trim();return e.length?e:"."},e.prototype.toCifCategory=function(e){var n=["_cell.entry_id '"+e+"'","_cell.length_a "+this.getValue(6,9),"_cell.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"),r=t.CIF.Text.parse(n);if(r.isError)throw new Error(r.toString());return{cell:r.result.dataBlocks[0].getCategory("_cell"),symm:r.result.dataBlocks[0].getCategory("_symmetry")}},e}();n.CrystStructureInfo=o;var a=function(){function e(e,t){this.helixTokens=e,this.sheetTokens=t}return e.prototype.toCifCategory=function(){return void 0},e}();n.SecondaryStructure=a;var s=function(){function t(e,t,n){this.idToken=e,this.atomTokens=t,this.atomCount=n}return t.prototype.writeToken=function(t,n){e.Utils.ArrayBuilder.add2(n,this.atomTokens[2*t],this.atomTokens[2*t+1])},t.prototype.writeTokenCond=function(t,n,r){var i=this.atomTokens[2*t],o=this.atomTokens[2*t+1];i===o?e.Utils.ArrayBuilder.add2(n,r.start,r.end):e.Utils.ArrayBuilder.add2(n,i,o)},t.prototype.writeRange=function(t,n){e.Utils.ArrayBuilder.add2(n,t.start,t.end)},t.prototype.tokenEquals=function(e,t,n,r){var i=n.length;if(i!==t-e)return!1;for(var o=n.length-1;o>=0;o--)if(r.charCodeAt(o+e)!==n.charCodeAt(o))return!1;return!0},t.prototype.getEntityType=function(e,t){var n=14*e;if(this.tokenEquals(this.atomTokens[2*n],this.atomTokens[2*n+1],"HETATM",t)){var r=this.atomTokens[2*(n+4)],i=this.atomTokens[2*(n+4)+1];return this.tokenEquals(r,i,"HOH",t)||this.tokenEquals(r,i,"WTR",t)||this.tokenEquals(r,i,"SOL",t)?3:2}return 1},t.prototype.writeCifTokens=function(e,t,n){for(var r={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},i=14,o=0;o<this.atomCount;o++){var a=o*i;this.writeToken(a+r.RECORD,t),this.writeToken(a+r.SERIAL,t),this.writeToken(a+r.ELEMENT,t),this.writeToken(a+r.ATOM_NAME,t),this.writeTokenCond(a+r.ALT_LOC,t,n.dot),this.writeToken(a+r.RES_NAME,t),this.writeToken(a+r.CHAIN_ID,t),this.writeRange(n.numberTokens.get(this.getEntityType(o,n.data)),t),this.writeToken(a+r.RES_SEQN,t),this.writeTokenCond(a+r.INS_CODE,t,n.dot),this.writeToken(a+r.X,t),this.writeToken(a+r.Y,t),this.writeToken(a+r.Z,t),this.writeToken(a+r.OCCUPANCY,t),this.writeToken(a+r.TEMP_FACTOR,t),this.writeRange(n.question,t),this.writeRange(n.question,t),this.writeRange(n.question,t),this.writeRange(n.question,t),this.writeRange(n.question,t),this.writeRange(n.question,t),this.writeToken(a+r.RES_SEQN,t),this.writeToken(a+r.RES_NAME,t),this.writeToken(a+r.CHAIN_ID,t),this.writeToken(a+r.ATOM_NAME,t),this.writeRange(e,t)}},t}();s.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"],n.ModelData=s;var u=function(){function n(e){this.models=e}return n.prototype.toCifCategory=function(n,r){for(var i=0,o=0,a=this.models;o<a.length;o++){var u=a[o];i+=u.atomCount}for(var c=e.Utils.ArrayBuilder.forTokenIndices(26*i),l=0,h=this.models;l<h.length;l++){var u=h[l];u.writeCifTokens(u.idToken,c,r)}return new t.CIF.Text.Category(n.data,"_atom_site",0,0,s.COLUMNS,c.array,26*i)},n}();n.ModelsData=u}(r=n.PDB||(n.PDB={}))}(n=t.Molecule||(t.Molecule={}))}(t=e.Formats||(e.Formats={}))}(t=e.Core||(e.Core={}))}(a||(a={}));var a;!function(e){var t;!function(e){var t;!function(e){var t;!function(t){var n;!function(t){function n(e,t){return i.parse(e,t)}var r=function(){function t(e){this.data=e,this.trimmedToken={start:0,end:0},this.line=0,this.position=0,this.length=e.length}return t.prototype.moveToNextLine=function(){for(;this.position<this.length&&10!==this.data.charCodeAt(this.position);)this.position++;return this.position++,this.line++,this.position},t.prototype.moveToEndOfLine=function(){for(;this.position<this.length;){var e=this.data.charCodeAt(this.position);if(10===e||13===e)return this.position;this.position++}return this.position},t.prototype.startsWith=function(e,t){for(var n=t.length-1;n>=0;n--)if(this.data.charCodeAt(n+e)!==t.charCodeAt(n))return!1;return!0},t.prototype.trim=function(e,t){for(;t>e&&32===this.data.charCodeAt(e);)e++;for(;t>e&&32===this.data.charCodeAt(t-1);)t--;this.trimmedToken.start=e,this.trimmedToken.end=t},t.prototype.tokenizeAtomRecord=function(t){var n=this.position,r=this.position,i=this.moveToEndOfLine(),o=i-r;return 66>o?!1:(this.trim(r,r+6),e.TokenIndexBuilder.addToken(t,this.trimmedToken.start,this.trimmedToken.end),r=n+6,this.trim(r,r+5),e.TokenIndexBuilder.addToken(t,this.trimmedToken.start,this.trimmedToken.end),r=n+12,this.trim(r,r+4),e.TokenIndexBuilder.addToken(t,this.trimmedToken.start,this.trimmedToken.end),32===this.data.charCodeAt(n+16)?e.TokenIndexBuilder.addToken(t,0,0):e.TokenIndexBuilder.addToken(t,n+16,n+17),r=n+17,this.trim(r,r+3),e.TokenIndexBuilder.addToken(t,this.trimmedToken.start,this.trimmedToken.end),e.TokenIndexBuilder.addToken(t,n+21,n+22),r=n+22,this.trim(r,r+4),e.TokenIndexBuilder.addToken(t,this.trimmedToken.start,this.trimmedToken.end),32===this.data.charCodeAt(n+26)?e.TokenIndexBuilder.addToken(t,0,0):e.TokenIndexBuilder.addToken(t,n+26,n+27),r=n+30,this.trim(r,r+8),e.TokenIndexBuilder.addToken(t,this.trimmedToken.start,this.trimmedToken.end),r=n+38,this.trim(r,r+8),e.TokenIndexBuilder.addToken(t,this.trimmedToken.start,this.trimmedToken.end),r=n+46,this.trim(r,r+8),e.TokenIndexBuilder.addToken(t,this.trimmedToken.start,this.trimmedToken.end),r=n+54,this.trim(r,r+6),e.TokenIndexBuilder.addToken(t,this.trimmedToken.start,this.trimmedToken.end),r=n+60,this.trim(r,r+6),e.TokenIndexBuilder.addToken(t,this.trimmedToken.start,this.trimmedToken.end),o>=78?(r=n+76,this.trim(r,r+2),this.trimmedToken.start<this.trimmedToken.end?e.TokenIndexBuilder.addToken(t,this.trimmedToken.start,this.trimmedToken.end):e.TokenIndexBuilder.addToken(t,n+12,n+13)):e.TokenIndexBuilder.addToken(t,n+12,n+13),!0)},t}(),i=function(){function n(e,t){this.id=e,this.data=t}return n.tokenizeAtom=function(t,n){return n.tokenizeAtomRecord(t)?void 0:new e.ParserError("Invalid ATOM/HETATM record.",n.line)},n.tokenize=function(i,o){for(var a=new r(o),s=o.length,u=e.TokenIndexBuilder.create(4096),c=0,l=[],h=void 0,f={start:0,end:0};a.position<s;){var p=!0;switch(o.charCodeAt(a.position)){case 65:if(a.startsWith(a.position,"ATOM")){u||(u=e.TokenIndexBuilder.create(4096));var d=n.tokenizeAtom(u,a);if(c++,d)return d}break;case 67:if(a.startsWith(a.position,"CRYST1")){var m=a.position,v=a.moveToEndOfLine();h=new t.CrystStructureInfo(o.substring(m,v))}break;case 69:if(a.startsWith(a.position,"ENDMDL")&&c>0)0===l.length&&(f={start:o.length+3,end:o.length+4}),u&&l.push(new t.ModelData(f,u.tokens,c)),c=0,u=null;else if(a.startsWith(a.position,"END")){var m=a.position,v=a.moveToEndOfLine();a.trim(m,v),a.trimmedToken.end-a.trimmedToken.start===3&&(p=!1)}break;case 72:if(a.startsWith(a.position,"HETATM")){u||(u=e.TokenIndexBuilder.create(4096));var d=n.tokenizeAtom(u,a);if(c++,d)return d}break;case 77:if(a.startsWith(a.position,"MODEL")){c>0&&(0===l.length&&(f={start:o.length+3,end:o.length+4}),u&&l.push(new t.ModelData(f,u.tokens,c)));var m=a.position+6,v=a.moveToEndOfLine();a.trim(m,v),f={start:a.trimmedToken.start,end:a.trimmedToken.end},(c>0||!u)&&(u=e.TokenIndexBuilder.create(4096)),c=0
}}if(a.moveToNextLine(),!p)break}var g=o+".?0123";return c>0&&(0===l.length&&(f={start:o.length+3,end:o.length+4}),u&&l.push(new t.ModelData(f,u.tokens,c))),new t.MoleculeData(new t.Header(i),h,new t.ModelsData(l),g)},n.getDotRange=function(e){return{start:e-6,end:e-5}},n.getNumberRanges=function(e){for(var t=new Map,n=0;4>n;n++)t.set(n,{start:e-4+n,end:e-3+n});return t},n.getQuestionmarkRange=function(e){return{start:e-5,end:e-4}},n.parse=function(t,r){var i=n.tokenize(t,r);return i instanceof e.ParserError?e.ParserResult.error(i.message,i.line):e.ParserResult.success(i.toCifFile())},n}();t.Parser=i,t.toCifFile=n}(n=t.PDB||(t.PDB={}))}(t=e.Molecule||(e.Molecule={}))}(t=e.Formats||(e.Formats={}))}(t=e.Core||(e.Core={}))}(a||(a={}));var a;!function(e){var t;!function(e){var t;!function(t){var n;!function(n){var r;!function(n){function r(n,r){var i=n.split(/\r?\n/g),o=i[0].trim();o.length||(o="SDF");var a=(i[1],i[2],i[3]),s=+a.substr(0,3),u=+a.substr(3,3);return{id:r?r:o,atomCount:s,bondCount:u,atoms:e.Structure.DefaultDataTables.forAtoms(s).table,bonds:e.Structure.DefaultDataTables.forBonds(u).table,lines:i,currentLine:4,error:void 0,stringPool:t.ShortStringPool.create()}}function i(n,r){var i=r.lines[r.currentLine],o=r.atoms,a=t.ShortStringPool.get(r.stringPool,i.substr(31,3).trim());o.id[n]=n,o.elementSymbol[n]=a,o.name[n]=a,o.authName[n]=a,o.occupancy[n]=1,o.rowIndex[n]=r.currentLine,o.x[n]=e.Utils.FastNumberParsers.parseFloatSkipTrailingWhitespace(i,0,10),o.y[n]=e.Utils.FastNumberParsers.parseFloatSkipTrailingWhitespace(i,10,20),o.z[n]=e.Utils.FastNumberParsers.parseFloatSkipTrailingWhitespace(i,20,30)}function o(e){for(var t=0;t<e.atomCount;t++)i(t,e),e.currentLine++}function a(t,n){var r=n.lines[n.currentLine],i=n.bonds;switch(i.atomAIndex[t]=e.Utils.FastNumberParsers.parseIntSkipTrailingWhitespace(r,0,3)-1,i.atomBIndex[t]=e.Utils.FastNumberParsers.parseIntSkipTrailingWhitespace(r,3,6)-1,e.Utils.FastNumberParsers.parseIntSkipTrailingWhitespace(r,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}}function s(e){for(var t=0;t<e.bondCount;t++)a(t,e),e.currentLine++}function u(t){var n=e.Structure.DefaultDataTables.forResidues(1),r=e.Structure.DefaultDataTables.forChains(1),i=e.Structure.DefaultDataTables.forEntities(1);n.columns.isHet[0]=1,n.columns.insCode[0]=null,n.columns.name[0]=n.columns.authName[0]="UNK",n.columns.atomEndIndex[0]=r.columns.atomEndIndex[0]=i.columns.atomEndIndex[0]=t.atomCount,n.columns.asymId[0]=n.columns.authAsymId[0]=r.columns.asymId[0]=r.columns.authAsymId[0]="X",n.columns.entityId[0]=r.columns.entityId[0]=i.columns.entityId[0]="1",r.columns.residueEndIndex[0]=i.columns.residueEndIndex[0]=0,i.columns.chainEndIndex[0]=1,i.columns.type[0]="non-polymer",i.columns.entityType[0]=e.Structure.EntityType.NonPolymer;var o=new e.Structure.PolyResidueIdentifier("X",0,null),a=[new e.Structure.SecondaryStructureElement(0,o,o)];return a[0].startResidueIndex=0,a[0].endResidueIndex=1,new e.Structure.MoleculeModel({id:t.id,modelId:"1",atoms:t.atoms,residues:n.table,chains:r.table,entities:i.table,covalentBonds:t.bonds,componentBonds:void 0,secondaryStructure:a,symmetryInfo:void 0,assemblyInfo:void 0,source:e.Structure.MoleculeModelSource.File})}function c(n,i){try{var a=r(n,i);o(a),s(a);var c=u(a);if(a.error)return t.ParserResult.error(a.error,a.currentLine+1);var l=new e.Structure.Molecule(i?i:a.id,[c]);return t.ParserResult.success(l)}catch(h){return t.ParserResult.error(""+h)}}n.parse=c}(r=n.SDF||(n.SDF={}))}(n=t.Molecule||(t.Molecule={}))}(t=e.Formats||(e.Formats={}))}(t=e.Core||(e.Core={}))}(a||(a={}));var a;!function(e){var t;!function(e){var t;!function(t){var n;!function(n){var r;!function(r){r.mmCIF={name:"mmCIF",shortcuts:["mmcif","cif"],extensions:[".cif"],parse:function(r){return e.Computation.create(function(e){e.update("Parsing..."),e.schedule(function(){var i=t.CIF.Text.parse(r);if(i.isError)return e.reject(i.toString()),void 0;var o=i.result;return o.dataBlocks.length?(e.update("Creating representation..."),e.schedule(function(){try{var r=n.mmCIF.ofDataBlock(o.dataBlocks[0]);e.resolve(t.ParserResult.success(r,o.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))}catch(i){e.reject(""+i)}}),void 0):(e.reject("The CIF data does not contain a data block."),void 0)})})}},r.mmBCIF={name:"mmCIF (Binary)",shortcuts:["mmbcif","bcif","binarycif"],extensions:[".bcif"],isBinary:!0,parse:function(r){return e.Computation.create(function(e){e.update("Parsing..."),e.schedule(function(){var i=t.CIF.Binary.parse(r);if(i.isError)return e.reject(i.toString()),void 0;var o=i.result;return o.dataBlocks.length?(e.update("Creating representation..."),e.schedule(function(){try{var r=n.mmCIF.ofDataBlock(o.dataBlocks[0]);e.resolve(t.ParserResult.success(r,o.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))}catch(i){e.reject(""+i)}}),void 0):(e.reject("The BinaryCIF data does not contain a data block."),void 0)})})}},r.PDB={name:"PDB",shortcuts:["pdb","ent"],extensions:[".pdb",".ent"],parse:function(r,i){return e.Computation.create(function(e){e.update("Parsing..."),e.schedule(function(){var o=n.PDB.toCifFile(i&&i.id||"PDB",r);if(o.isError)return e.reject(o.toString()),void 0;var a=o.result;return a.dataBlocks.length?(e.update("Creating representation..."),e.schedule(function(){try{var r=n.mmCIF.ofDataBlock(a.dataBlocks[0]);e.resolve(t.ParserResult.success(r))}catch(i){e.reject(""+i)}}),void 0):(e.reject("The PDB data does not contain a data block."),void 0)})})}},r.SDF={name:"SDF",shortcuts:["sdf","mol"],extensions:[".sdf",".mol"],parse:function(r,i){return e.Computation.create(function(e){e.update("Parsing..."),e.schedule(function(){var o=n.SDF.parse(r,i&&i.id||void 0);return o.isError?(e.reject(o.toString()),void 0):(e.resolve(t.ParserResult.success(o.result)),void 0)})})}},r.All=[r.mmCIF,r.mmBCIF,r.PDB,r.SDF]}(r=n.SupportedFormats||(n.SupportedFormats={}))}(n=t.Molecule||(t.Molecule={}))}(t=e.Formats||(e.Formats={}))}(t=e.Core||(e.Core={}))}(a||(a={}));var a;!function(e){var t;!function(e){var t;!function(e){var t;!function(e){function t(e,t){for(var n=e.length,r=0;n>r;r++)e[r]=t}var n=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]}return Object.defineProperty(e.prototype,"length",{get:function(){return this.len},enumerable:!0,configurable:!0}),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,n){return this.data[this.nX*(n*this.nY+t)+e|0]},e.prototype.set=function(e,t,n,r){this.data[this.nX*(n*this.nY+t)+e|0]=r},e.prototype.fill=function(e){t(this.data,e)},e}();e.Field3DZYX=n;var r;!function(e){function t(e,t,n,r,i,o,a,s,u,c,l){return{cellSize:e,cellAngles:t,origin:n,hasSkewMatrix:r,skewMatrix:i,data:o,basis:s,startOffset:u,dataDimensions:a,valuesInfo:c,attributes:l?l:{},isNormalized:!1}}function n(e){if(!e.isNormalized){for(var t=e.data,n=e.valuesInfo,r=n.mean,i=n.sigma,o=Number.POSITIVE_INFINITY,a=Number.NEGATIVE_INFINITY,s=0,u=t.length;u>s;s++){var c=(t.getAt(s)-r)/i;t.setAt(s,c),o>c&&(o=c),c>a&&(a=c)}e.valuesInfo.min=o,e.valuesInfo.max=a,e.isNormalized=!0}}function r(e){if(e.isNormalized){for(var t=e.data,n=e.valuesInfo,r=n.mean,i=n.sigma,o=Number.POSITIVE_INFINITY,a=Number.NEGATIVE_INFINITY,s=0,u=t.length;u>s;s++){var c=i*t.getAt(s)+r;t.setAt(s,c),o>c&&(o=c),c>a&&(a=c)}e.valuesInfo.min=o,e.valuesInfo.max=a,e.isNormalized=!1}}e.create=t,e.normalize=n,e.denormalize=r}(r=e.Data||(e.Data={}))}(t=e.Density||(e.Density={}))}(t=e.Formats||(e.Formats={}))}(t=e.Core||(e.Core={}))}(a||(a={}));var a;!function(e){var t;!function(e){var t;!function(e){var t;!function(t){var n;!function(n){function r(e){return i.parse(e)}n.parse=r;var i;!function(n){function r(e,t,n){for(var r=[],i=0;n>i;i++)r[i]=e(t+i);return r}function i(n){var i=1024,s=!1,u=new DataView(n,0,i),c=[],l=u.getInt32(12,!1);if(2!==l&&(s=!0,l=u.getInt32(12,!0),2!==l))return e.ParserResult.error("Only CCP4 modes 0 and 2 are supported.");var h=function(e){return u.getInt32(4*e,s)},f=function(e){return u.getFloat32(4*e,s)},p={extent:r(h,0,3),mode:l,nxyzStart:r(h,4,3),grid:r(h,7,3),cellDimensions:r(f,10,3),cellAngles:r(f,13,3),crs2xyz:r(h,16,3),min:f(19),max:f(20),mean:f(21),spacegroupNumber:h(22),symBytes:h(23),skewFlag:h(24),skewMatrix:r(f,25,9),skewTranslation:r(f,34,3),origin2k:r(f,49,3)},d=n.byteLength-4*p.extent[0]*p.extent[1]*p.extent[2];if(d!==i+p.symBytes)if(d===i)c.push("File contains bogus symmetry record.");else{if(i>d)return e.ParserResult.error("File appears truncated and doesn't match header.");if(!(d>i&&1048576>d))return e.ParserResult.error("File is MUCH larger than expected and doesn't match header.");d=i+p.symBytes,c.push("File is larger than expected and doesn't match header. Continuing file load, good luck!")}0===p.grid[0]&&p.extent[0]>0&&(p.grid[0]=p.extent[0]-1,c.push("Fixed X interval count.")),0===p.grid[1]&&p.extent[1]>0&&(p.grid[1]=p.extent[1]-1,c.push("Fixed Y interval count.")),0===p.grid[2]&&p.extent[2]>0&&(p.grid[2]=p.extent[2]-1,c.push("Fixed Z interval count.")),0===p.crs2xyz[0]&&0===p.crs2xyz[1]&&0===p.crs2xyz[2]&&(c.push("All crs2xyz records are zero. Setting crs2xyz to 1, 2, 3."),p.crs2xyz=[1,2,3]),0===p.cellDimensions[0]&&0===p.cellDimensions[1]&&0===p.cellDimensions[2]&&(c.push("Cell dimensions are all zero. Setting to 1.0, 1.0, 1.0. Map file will not align with other structures."),p.cellDimensions[0]=1,p.cellDimensions[1]=1,p.cellDimensions[2]=1);var m=Math.PI/180*p.cellAngles[0],v=Math.PI/180*p.cellAngles[1],g=Math.PI/180*p.cellAngles[2],y=p.cellDimensions[0]/p.grid[0],b=p.cellDimensions[1]/p.grid[1],x=p.cellDimensions[2]/p.grid[2],w=Math.cos(v),_=(Math.cos(m)-Math.cos(v)*Math.cos(g))/Math.sin(g),C=Math.sqrt(1-w*w-_*_),E=[y,0,0],S=[Math.cos(g)*b,Math.sin(g)*b,0],M=[w*x,_*x,C*x],T=[0,0,0];T[p.crs2xyz[0]-1]=0,T[p.crs2xyz[1]-1]=1,T[p.crs2xyz[2]-1]=2;var A;A=0===p.origin2k[0]&&0===p.origin2k[1]&&0===p.origin2k[2]?[E[0]*p.nxyzStart[T[0]]+S[0]*p.nxyzStart[T[1]]+M[0]*p.nxyzStart[T[2]],S[1]*p.nxyzStart[T[1]]+M[1]*p.nxyzStart[T[2]],M[2]*p.nxyzStart[T[2]]]:[p.origin2k[T[0]],p.origin2k[T[1]],p.origin2k[T[2]]];var P,k,R=[p.extent[T[0]],p.extent[T[1]],p.extent[T[2]]],I=new Float32Array(16);for(P=0;3>P;P++){for(k=0;3>k;k++)I[4*k+P]=p.skewMatrix[3*P+k];I[12+P]=p.skewTranslation[P]}var D=13330===new Uint16Array(new Uint8Array([18,52]).buffer)[0],B=s===D?o(new Float32Array(n,i+p.symBytes,R[0]*R[1]*R[2]),s,R,p.extent,T,p.mean):a(new DataView(n,i+p.symBytes),s,R,p.extent,T,p.mean),V=new t.Field3DZYX(B.data,R),L=t.Data.create(p.cellDimensions,p.cellAngles,A,0!==p.skewFlag,I,V,R,{x:E,y:S,z:M},[p.nxyzStart[T[0]],p.nxyzStart[T[1]],p.nxyzStart[T[2]]],{min:p.min,max:p.max,mean:p.mean,sigma:B.sigma},{spacegroupIndex:p.spacegroupNumber-1});return e.ParserResult.success(L,c)}function o(e,t,n,r,i,o){var a,s,u,c,l,h,f,p,d=new Float32Array(n[0]*n[1]*n[2]),m=[0,0,0],v=0,g=.1,y=0,b=.1,x=i[0],w=i[1],_=i[2];for(a=r[0],s=r[1],u=r[2],f=n[0],p=n[0]*n[1],h=0;u>h;h++)for(m[2]=h,l=0;s>l;l++)for(m[1]=l,c=0;a>c;c++)m[0]=c,g=e[v],b=g-o,y+=b*b,d[m[x]+m[w]*f+m[_]*p]=g,v+=1;return y/=a*s*u,y=Math.sqrt(y),{data:d,sigma:y}}function a(e,t,n,r,i,o){var a,s,u,c,l,h,f,p,d=new Float32Array(n[0]*n[1]*n[2]),m=[0,0,0],v=0,g=.1,y=0,b=.1,x=i[0],w=i[1],_=i[2];for(a=r[0],s=r[1],u=r[2],f=n[0],p=n[0]*n[1],h=0;u>h;h++)for(m[2]=h,l=0;s>l;l++)for(m[1]=l,c=0;a>c;c++)m[0]=c,g=e.getFloat32(v,t),b=g-o,y+=b*b,d[m[x]+m[w]*f+m[_]*p]=g,v+=4;return y/=a*s*u,y=Math.sqrt(y),{data:d,sigma:y}}n.parse=i}(i||(i={}))}(n=t.CCP4||(t.CCP4={}))}(t=e.Density||(e.Density={}))}(t=e.Formats||(e.Formats={}))}(t=e.Core||(e.Core={}))}(a||(a={}));var a;!function(e){var t;!function(e){var t;!function(e){var t;!function(t){var n;!function(n){function r(e){return i.parse(e)}n.parse=r;var i;!function(n){function r(n){function r(e){for(var t=[],n=0;3>n;n++)t[n]=a.getColumn(e+"["+n+"]").getFloat(0);return t}function o(e){return a.getColumn(e).getFloat(0)}var a=n.getCategory("_density_info");if(!a)return e.ParserResult.error("_density_info category is missing.");if(!n.getCategory("_density_data"))return e.ParserResult.error("_density_data category is missing.");var s={name:a.getColumn("name").getString(0),grid:r("grid"),axisOrder:r("axis_order"),extent:r("extent"),origin:r("origin"),cellSize:r("cell_size"),cellAngles:r("cell_angles"),mean:o("mean"),sigma:o("sigma"),spacegroupNumber:0|o("spacegroup_number")},u=Math.PI/180*s.cellAngles[0],c=Math.PI/180*s.cellAngles[1],l=Math.PI/180*s.cellAngles[2],h=s.cellSize[0]/s.grid[0],f=s.cellSize[1]/s.grid[1],p=s.cellSize[2]/s.grid[2],d=Math.cos(c),m=(Math.cos(u)-Math.cos(c)*Math.cos(l))/Math.sin(l),v=Math.sqrt(1-d*d-m*m),g=[h,0,0],y=[Math.cos(l)*f,Math.sin(l)*f,0],b=[d*p,m*p,v*p],x=[0,0,0];x[s.axisOrder[0]]=0,x[s.axisOrder[1]]=1,x[s.axisOrder[2]]=2;var w=[s.origin[s.axisOrder[0]],s.origin[s.axisOrder[1]],s.origin[s.axisOrder[2]]],_=[g[0]*w[0]+y[0]*w[1]+b[0]*w[2],y[1]*w[1]+b[1]*w[2],b[2]*w[2]],C=[s.extent[x[0]],s.extent[x[1]],s.extent[x[2]]],E=i(n.getCategory("_density_data").getColumn("values"),C,s.extent,x,s.mean),S=new t.Field3DZYX(E.data,C),M=t.Data.create(s.cellSize,s.cellAngles,_,!1,void 0,S,C,{x:g,y:y,z:b},[s.axisOrder[x[0]],s.axisOrder[x[1]],s.axisOrder[x[2]]],{min:E.min,max:E.max,mean:s.mean,sigma:s.sigma},{spacegroupIndex:s.spacegroupNumber-1,name:s.name});return e.ParserResult.success(M)}function i(e,t,n,r){var i,o,a,s,u,c,l,h,f=new Float32Array(t[0]*t[1]*t[2]),p=[0,0,0],d=0,m=.1,v=Number.POSITIVE_INFINITY,g=Number.NEGATIVE_INFINITY,y=r[0],b=r[1],x=r[2];for(i=n[0],o=n[1],a=n[2],l=t[0],h=t[0]*t[1],c=0;a>c;c++)for(p[2]=c,u=0;o>u;u++)for(p[1]=u,s=0;i>s;s++)p[0]=s,m=e.getFloat(d),v>m?v=m:m>g&&(g=m),f[p[y]+p[b]*l+p[x]*h]=m,d+=1;return{data:f,min:v,max:g}}n.parse=r}(i||(i={}))}(n=t.CIF||(t.CIF={}))}(t=e.Density||(e.Density={}))}(t=e.Formats||(e.Formats={}))}(t=e.Core||(e.Core={}))}(a||(a={}));var a;!function(e){var t;!function(e){var t;!function(e){var t;!function(t){var n;!function(n){function r(e){return o.parse(e)}function i(e,t){return e.filter(function(e){return e!==t})}n.parse=r;var o;!function(n){function r(n){var r=512,a=!1,s=new Uint8Array(n,0,r),u=String.fromCharCode.apply(null,s),c=u.search("origin"),l=u.search("extent"),h=u.search("grid"),f=u.search("cell"),p=u.search("prod"),d=u.search("plus"),m=u.search("sigma"),v=u.substring(c+"origin".length,l).replace(" ","").split(" "),g=i(v,""),y=u.substring(l+"extent".length,h).split(" "),b=i(y,""),x=u.substring(h+"grid".length,f).split(" "),w=i(x,""),_=u.substring(f+"cell".length,p).split(" "),C=i(_,""),E=u.substring(p+"prod".length,d).split(" "),S=i(E,""),M=u.substring(d+"plus".length,m).split(" "),T=i(M,""),A=u.substring(m+"sigma".length,u.length).split(" "),P=(i(A,""),[]),k=0,R={extent:b.map(function(e){return parseInt(e)}),mode:k,nxyzStart:[0,0,0],grid:w.map(function(e){return parseInt(e)}),cellDimensions:C.slice(0,3).map(function(e){return parseFloat(e)}),cellAngles:C.slice(3,6).map(function(e){return parseFloat(e)}),crs2xyz:[1,2,3],min:0,max:0,mean:0,symBytes:0,skewFlag:0,skewMatrix:0,skewTranslation:0,origin2k:g.map(function(e){return parseFloat(e)}),prod:S.map(function(e){return parseFloat(e)})[0],plus:T.map(function(e){return parseFloat(e)})[0]},I=512;if(I!==r+R.symBytes)if(I===r)P.push("File contains bogus symmetry record.");else{if(r>I)return e.ParserResult.error("File appears truncated and doesn't match header.");if(!(I>r&&1048576>I))return e.ParserResult.error("File is MUCH larger than expected and doesn't match header.");I=r+R.symBytes,P.push("File is larger than expected and doesn't match header. Continuing file load, good luck!")}0===R.grid[0]&&R.extent[0]>0&&(R.grid[0]=R.extent[0]-1,P.push("Fixed X interval count.")),0===R.grid[1]&&R.extent[1]>0&&(R.grid[1]=R.extent[1]-1,P.push("Fixed Y interval count.")),0===R.grid[2]&&R.extent[2]>0&&(R.grid[2]=R.extent[2]-1,P.push("Fixed Z interval count.")),0===R.crs2xyz[0]&&0===R.crs2xyz[1]&&0===R.crs2xyz[2]&&(P.push("All crs2xyz records are zero. Setting crs2xyz to 1, 2, 3."),R.crs2xyz=[1,2,3]),0===R.cellDimensions[0]&&0===R.cellDimensions[1]&&0===R.cellDimensions[2]&&(P.push("Cell dimensions are all zero. Setting to 1.0, 1.0, 1.0. Map file will not align with other structures."),R.cellDimensions[0]=1,R.cellDimensions[1]=1,R.cellDimensions[2]=1);var D=Math.PI/180*R.cellAngles[0],B=Math.PI/180*R.cellAngles[1],V=Math.PI/180*R.cellAngles[2],L=R.cellDimensions[0]/R.grid[0],N=R.cellDimensions[1]/R.grid[1],O=R.cellDimensions[2]/R.grid[2],F=Math.cos(B),U=(Math.cos(D)-Math.cos(B)*Math.cos(V))/Math.sin(V),z=Math.sqrt(1-F*F-U*U),$=[L,0,0],H=[Math.cos(V)*N,Math.sin(V)*N,0],j=[F*O,U*O,z*O],G=[0,0,0];G[R.crs2xyz[0]-1]=0,G[R.crs2xyz[1]-1]=1,G[R.crs2xyz[2]-1]=2;var W;W=0===R.origin2k[0]&&0===R.origin2k[1]&&0===R.origin2k[2]?[$[0]*R.nxyzStart[G[0]]+H[0]*R.nxyzStart[G[1]]+j[0]*R.nxyzStart[G[2]],H[1]*R.nxyzStart[G[1]]+j[1]*R.nxyzStart[G[2]],j[2]*R.nxyzStart[G[2]]]:[R.origin2k[G[0]],R.origin2k[G[1]],R.origin2k[G[2]]];var q,X,Y=[R.extent[G[0]],R.extent[G[1]],R.extent[G[2]]],K=new Float32Array(16);for(q=0;3>q;q++){for(X=0;3>X;X++)K[4*X+q]=0;K[12+q]=0}var Q=13330===new Uint16Array(new Uint8Array([18,52]).buffer)[0];a=Q;var Z=o(new Uint8Array(n,r+R.symBytes),a,Y,R.extent,G,R.mean,R.prod,R.plus),J=new t.Field3DZYX(Z.data,Y),et=t.Data.create(R.cellDimensions,R.cellAngles,W,0!==R.skewFlag,K,J,Y,{x:$,y:H,z:j},[R.nxyzStart[G[0]],R.nxyzStart[G[1]],R.nxyzStart[G[2]]],{min:Z.minj,max:Z.maxj,mean:Z.meanj,sigma:Z.sigma},{prod:R.prod,plus:R.plus});return e.ParserResult.success(et,P)}function o(e,t,n,r,i,o,a,s){var u,c,l,h,f,p,d,m,v,g,y,b,x,w,_=0,C=.1,E=0,S=.1,M=0,T=0,A=0,P=8,k=8,R=8,I=8,D=P*P*P;u=r[0]/8,c=r[1]/8,l=r[2]/8;var B=new Float32Array(8*u*8*c*8*l);for(d=8*u,m=64*u*c,M=0,T=0,A=0,v=0;D*u*c*l>v;v++)C=(e[v]-s)/a,A+=C,M>C&&(M=C),C>T&&(T=C);for(A/=D*u*c*l,p=0;l>p;p++)for(f=0;c>f;f++)for(h=0;u>h;h++){for(y=0;k>y;y++)for(g=0;R>g;g++)for(v=0;I>v;v++)C=(e[_+v+8*g+64*y]-s)/a,b=I*h+v,x=R*f+g,w=k*p+y,B[b+d*x+m*w]=C,S=C-A,E+=S*S;_+=D}return E/=D*u*c*l,E=Math.sqrt(E),{data:B,sigma:E,minj:M,maxj:T,meanj:A}}n.parse=r}(o||(o={}))}(n=t.DSN6||(t.DSN6={}))}(t=e.Density||(e.Density={}))}(t=e.Formats||(e.Formats={}))}(t=e.Core||(e.Core={}))}(a||(a={}));var a;!function(e){var t;!function(e){var t;!function(t){var n;!function(t){function n(t,n,r){return e.Computation.create(function(e){e.update("Parsing "+n+"...");try{e.resolve(r(t))}catch(i){e.reject(""+i)}})}var r;!function(e){e.CCP4={name:"CCP4",shortcuts:["ccp4","map"],extensions:[".ccp4",".map"],isBinary:!0,parse:function(e){return n(e,"CCP4",function(e){return t.CCP4.parse(e)})}},e.DSN6={name:"DSN6",shortcuts:["dsn6"],extensions:[".dsn6"],isBinary:!0,parse:function(e){return n(e,"DSN6",function(e){return t.DSN6.parse(e)})}},e.All=[e.CCP4,e.DSN6]}(r=t.SupportedFormats||(t.SupportedFormats={}))}(n=t.Density||(t.Density={}))}(t=e.Formats||(e.Formats={}))}(t=e.Core||(e.Core={}))}(a||(a={}));var a;!function(e){var t;!function(e){var t;!function(e){var t;!function(e){var t,n="undefined"!=typeof Float64Array?function(e){return new Float64Array(e)}:function(){return[]};!function(e){function t(){return n(16)}function r(){var e=n(16);return 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,e}function i(e){var t,r,i,o=n(16);for(t=0;4>t;t++)for(i=e[t],r=0;4>r;r++)o[4*r+t]=i[r];return o}function o(e,t,n){for(var r=0;16>r;r++)if(Math.abs(e[r]-t[r])>n)return!1;return!0}function a(e,t,n,r){e[4*n+t]=r}function s(e,t){return 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],e}function u(t){return e.copy(e.empty(),t)}function c(e,t){var n=t[0],r=t[1],i=t[2],o=t[3],a=t[4],s=t[5],u=t[6],c=t[7],l=t[8],h=t[9],f=t[10],p=t[11],d=t[12],m=t[13],v=t[14],g=t[15],y=n*s-r*a,b=n*u-i*a,x=n*c-o*a,w=r*u-i*s,_=r*c-o*s,C=i*c-o*u,E=l*m-h*d,S=l*v-f*d,M=l*g-p*d,T=h*v-f*m,A=h*g-p*m,P=f*g-p*v,k=y*P-b*A+x*T+w*M-_*S+C*E;return k?(k=1/k,e[0]=(s*P-u*A+c*T)*k,e[1]=(i*A-r*P-o*T)*k,e[2]=(m*C-v*_+g*w)*k,e[3]=(f*_-h*C-p*w)*k,e[4]=(u*M-a*P-c*S)*k,e[5]=(n*P-i*M+o*S)*k,e[6]=(v*x-d*C-g*b)*k,e[7]=(l*C-f*x+p*b)*k,e[8]=(a*A-s*M+c*E)*k,e[9]=(r*M-n*A-o*E)*k,e[10]=(d*_-m*x+g*y)*k,e[11]=(h*x-l*_-p*y)*k,e[12]=(s*S-a*T-u*E)*k,e[13]=(n*T-r*S+i*E)*k,e[14]=(m*b-d*w-v*y)*k,e[15]=(l*w-h*b+f*y)*k,e):null}function l(e,t,n){var r=t[0],i=t[1],o=t[2],a=t[3],s=t[4],u=t[5],c=t[6],l=t[7],h=t[8],f=t[9],p=t[10],d=t[11],m=t[12],v=t[13],g=t[14],y=t[15],b=n[0],x=n[1],w=n[2],_=n[3];return e[0]=b*r+x*s+w*h+_*m,e[1]=b*i+x*u+w*f+_*v,e[2]=b*o+x*c+w*p+_*g,e[3]=b*a+x*l+w*d+_*y,b=n[4],x=n[5],w=n[6],_=n[7],e[4]=b*r+x*s+w*h+_*m,e[5]=b*i+x*u+w*f+_*v,e[6]=b*o+x*c+w*p+_*g,e[7]=b*a+x*l+w*d+_*y,b=n[8],x=n[9],w=n[10],_=n[11],e[8]=b*r+x*s+w*h+_*m,e[9]=b*i+x*u+w*f+_*v,e[10]=b*o+x*c+w*p+_*g,e[11]=b*a+x*l+w*d+_*y,b=n[12],x=n[13],w=n[14],_=n[15],e[12]=b*r+x*s+w*h+_*m,e[13]=b*i+x*u+w*f+_*v,e[14]=b*o+x*c+w*p+_*g,e[15]=b*a+x*l+w*d+_*y,e}function h(e,t,n){var r,i,o,a,s,u,c,l,h,f,p,d,m=n[0],v=n[1],g=n[2];return t===e?(e[12]=t[0]*m+t[4]*v+t[8]*g+t[12],e[13]=t[1]*m+t[5]*v+t[9]*g+t[13],e[14]=t[2]*m+t[6]*v+t[10]*g+t[14],e[15]=t[3]*m+t[7]*v+t[11]*g+t[15]):(r=t[0],i=t[1],o=t[2],a=t[3],s=t[4],u=t[5],c=t[6],l=t[7],h=t[8],f=t[9],p=t[10],d=t[11],e[0]=r,e[1]=i,e[2]=o,e[3]=a,e[4]=s,e[5]=u,e[6]=c,e[7]=l,e[8]=h,e[9]=f,e[10]=p,e[11]=d,e[12]=r*m+s*v+h*g+t[12],e[13]=i*m+u*v+f*g+t[13],e[14]=o*m+c*v+p*g+t[14],e[15]=a*m+l*v+d*g+t[15]),e}function f(e,t){return 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,e}function p(e,t,n){var r=t.x,i=t.y,o=t.z;return e.x=n[0]*r+n[4]*i+n[8]*o+n[12],e.y=n[1]*r+n[5]*i+n[9]*o+n[13],e.z=n[2]*r+n[6]*i+n[10]*o+n[14],e}function d(e){for(var t="",n=0;4>n;n++){for(var r=0;4>r;r++)t+=e[4*r+n].toString(),3>r&&(t+=" ");3>n&&(t+="\n")}return t}function m(e){var t=e[0],n=e[1],r=e[2],i=e[3],o=e[4],a=e[5],s=e[6],u=e[7],c=e[8],l=e[9],h=e[10],f=e[11],p=e[12],d=e[13],m=e[14],v=e[15],g=t*a-n*o,y=t*s-r*o,b=t*u-i*o,x=n*s-r*a,w=n*u-i*a,_=r*u-i*s,C=c*d-l*p,E=c*m-h*p,S=c*v-f*p,M=l*m-h*d,T=l*v-f*d,A=h*v-f*m;return g*A-y*T+b*M+x*S-w*E+_*C}e.empty=t,e.identity=r,e.ofRows=i,e.areEqual=o,e.setValue=a,e.copy=s,e.clone=u,e.invert=c,e.mul=l,e.translate=h,e.fromTranslation=f,e.transformVector3=p,e.makeTable=d,e.determinant=m}(t=e.Matrix4||(e.Matrix4={}));var r;!function(e){function t(){var e=n(4);return e[0]=0,e[1]=0,e[2]=0,e[3]=0,e}function r(e){var t=n(4);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t}function i(e,t,r,i){var o=n(4);return o[0]=e,o[1]=t,o[2]=r,o[3]=i,o}function o(e,t,n,r,i){return e[0]=t,e[1]=n,e[2]=r,e[3]=i,e}function a(e,t){var n=t[0]-e[0],r=t[1]-e[1],i=t[2]-e[2],o=t[3]-e[3];return Math.sqrt(n*n+r*r+i*i+o*o)}function s(e,t){var n=t[0]-e[0],r=t[1]-e[1],i=t[2]-e[2],o=t[3]-e[3];return n*n+r*r+i*i+o*o}function u(e){var t=e[0],n=e[1],r=e[2],i=e[3];return Math.sqrt(t*t+n*n+r*r+i*i)}function c(e){var t=e[0],n=e[1],r=e[2],i=e[3];return t*t+n*n+r*r+i*i}function l(e,t,n){var r=t[0],i=t[1],o=t[2],a=t[3];return e[0]=n[0]*r+n[4]*i+n[8]*o+n[12]*a,e[1]=n[1]*r+n[5]*i+n[9]*o+n[13]*a,e[2]=n[2]*r+n[6]*i+n[10]*o+n[14]*a,e[3]=n[3]*r+n[7]*i+n[11]*o+n[15]*a,e}e.create=t,e.clone=r,e.fromValues=i,e.set=o,e.distance=a,e.squaredDistance=s,e.norm=u,e.squaredNorm=c,e.transform=l}(r=e.Vector4||(e.Vector4={}))}(t=e.LinearAlgebra||(e.LinearAlgebra={}))}(t=e.Geometry||(e.Geometry={}))}(t=e.Core||(e.Core={}))}(a||(a={}));var a;!function(e){var t;!function(e){var t;!function(e){var t;!function(e){function t(e){var t,n=2*e.capacity+1,r=new Int32Array(n);if(e.count<32)for(t=0;t<e.count;t++)r[t]=e.indices[t];else r.set(e.indices);e.indices=r,e.capacity=n}function n(e,n){this.count+1>=this.capacity&&t(this),this.indices[this.count++]=n}function r(){this.count=0}function i(e){return 1>e&&(e=1),{indices:new Int32Array(e),count:0,capacity:e,hasPriorities:!1,priorities:void 0,add:n,reset:r}}e.create=i}(t=e.SubdivisionTree3DResultIndexBuffer||(e.SubdivisionTree3DResultIndexBuffer={}));var n;!function(e){function t(e){var t,n=2*e.capacity+1,r=new Int32Array(n),i=new Float32Array(n);if(e.count<32)for(t=0;t<e.count;t++)r[t]=e.indices[t],i[t]=e.priorities[t];else r.set(e.indices),i.set(e.priorities);e.indices=r,e.priorities=i,e.capacity=n}function n(e,n){this.count+1>=this.capacity&&t(this),this.priorities[this.count]=e,this.indices[this.count++]=n}function r(){this.count=0}function i(e){return 1>e&&(e=1),{indices:new Int32Array(e),count:0,capacity:e,hasPriorities:!0,priorities:new Float32Array(e),add:n,reset:r}}e.create=i}(n=e.SubdivisionTree3DResultPriorityBuffer||(e.SubdivisionTree3DResultPriorityBuffer={}));var r;!function(e){function t(e,t,n,r){this.pivot[0]=e,this.pivot[1]=t,this.pivot[2]=n,this.radius=r,this.radiusSq=r*r,this.buffer.reset(),a.nearest(this.tree.root,this,0)}function n(e,n){return{tree:e,indices:e.indices,positions:e.positions,buffer:n,pivot:[.1,.1,.1],radius:1.1,radiusSq:1.1*1.1,nearest:t}}e.create=n}(r=e.SubdivisionTree3DQueryContext||(e.SubdivisionTree3DQueryContext={}));var i;!function(e){function i(e,i,o){return void 0===o&&(o=!1),r.create(e,o?n.create(Math.max(i*i|0,8)):t.create(Math.max(i*i|0,8)))}function o(e,t,n){void 0===n&&(n=32);var r=u.build(e,t,n),i=r.root,o=r.indices,a=r.positions;return{data:e,root:i,indices:o,positions:a}}e.createContextRadius=i,e.create=o}(i=e.SubdivisionTree3D||(e.SubdivisionTree3D={}));var o;!function(e){function t(e,t,n,r){e.data[e._count++]=t,e.data[e._count++]=n,e.data[e._count++]=r,e.boundsMin[0]=Math.min(t,e.boundsMin[0]),e.boundsMin[1]=Math.min(n,e.boundsMin[1]),e.boundsMin[2]=Math.min(r,e.boundsMin[2]),e.boundsMax[0]=Math.max(t,e.boundsMax[0]),e.boundsMax[1]=Math.max(n,e.boundsMax[1]),e.boundsMax[2]=Math.max(r,e.boundsMax[2])}function n(e){var t=new Float32Array(3*e|0),n=s.createInfinite(),r=n.min,i=n.max;return{_count:0,data:t,bounds:n,boundsMin:r,boundsMax:i}}e.add=t,e.create=n}(o||(o={}));var a;!function(e){function t(e,t){var n,r,i,o,a,s,u=t.pivot,c=t.indices,l=t.positions,h=t.radiusSq;for(s=e.startIndex;s<e.endIndex;s++)o=3*c[s],n=u[0]-l[o],r=u[1]-l[o+1],i=u[2]-l[o+2],a=n*n+r*r+i*i,h>=a&&t.buffer.add(a,c[s])}function n(e,t,n){var i=t.pivot[n],o=i<e.splitValue;(o?i+t.radius>e.splitValue:i-t.radius<e.splitValue)?(r(e.left,t,(n+1)%3),r(e.right,t,(n+1)%3)):o?r(e.left,t,(n+1)%3):r(e.right,t,(n+1)%3)}function r(e,r,i){e.startIndex!==e.endIndex&&(isNaN(e.splitValue)?t(e,r):n(e,r,i))}function i(e,t,n,r,i){return{splitValue:e,startIndex:t,endIndex:n,left:r,right:i}}e.nearest=r,e.create=i}(a=e.SubdivisionTree3DNode||(e.SubdivisionTree3DNode={}));var s;!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}(s=e.Box3D||(e.Box3D={}));var u;!function(e){function t(e,n,r,i){var o=r-n+1;if(0>=o)return e.emptyNode;if(o<=e.leafSize)return a.create(0/0,n,r+1,e.emptyNode,e.emptyNode);for(var s,u,c,l=e.bounds.min[i],h=e.bounds.max[i],f=.5*(l+h),p=0,d=n,m=r;m>d;){for(s=e.indices[m],e.indices[m]=e.indices[d],e.indices[d]=s;r>=d&&e.positions[3*e.indices[d]+i]<=f;)d++;for(;m>=n&&e.positions[3*e.indices[m]+i]>f;)m--}return p=d-1,e.bounds.max[i]=f,u=t(e,n,p,(i+1)%3),e.bounds.max[i]=h,e.bounds.min[i]=f,c=t(e,p+1,r,(i+1)%3),e.bounds.min[i]=l,a.create(f,n,r+1,u,c)}function n(e){var t=o.add;return function(n,r,i){t(e,n,r,i)}}function r(e,r,i){for(var s=o.create(e.length),u=new Int32Array(e.length),c=n(s),l=0;l<e.length;l++)u[l]=l,r(e[l],c);c=void 0;var h={bounds:s.bounds,positions:s.data,leafSize:i,indices:u,emptyNode:a.create(0/0,-1,-1,void 0,void 0)},f=t(h,0,u.length-1,0);return h=void 0,{root:f,indices:u,positions:s.data}}e.build=r}(u||(u={}))}(t=e.Geometry||(e.Geometry={}))}(t=e.Core||(e.Core={}))}(a||(a={}));var a;!function(e){var t;!function(e){var t;!function(t){var n;!function(n){function r(e){if(!e.normals){{var t,n,r=new Float32Array(e.vertices.length),i=e.vertices,o=e.triangleIndices;o.length}for(n=0;n<o.length;n+=3){var a=3*o[n],s=3*o[n+1],u=3*o[n+2],c=i[a+2]*(i[s+1]-i[u+1])+i[s+2]*i[u+1]-i[s+1]*i[u+2]+i[a+1]*(-i[s+2]+i[u+2]),l=-(i[s+2]*i[u])+i[a+2]*(-i[s]+i[u])+i[a]*(i[s+2]-i[u+2])+i[s]*i[u+2],h=i[a+1]*(i[s]-i[u])+i[s+1]*i[u]-i[s]*i[u+1]+i[a]*(-i[s+1]+i[s+1]);r[a]+=c,r[a+1]+=l,r[a+2]+=h,r[s]+=c,r[s+1]+=l,r[s+2]+=h,r[u]+=c,r[u+1]+=l,r[u+2]+=h}for(n=0;n<r.length;n+=3){var c=r[n],l=r[n+1],h=r[n+2];t=1/Math.sqrt(c*c+l*l+h*h),r[n]*=t,r[n+1]*=t,r[n+2]*=t}e.normals=r}}function i(t){return e.Computation.create(function(e){return t.normals?(e.resolve(t),void 0):(e.update("Computing normals..."),e.schedule(function(){r(t),e.resolve(t)}),void 0)})}function o(e,t,n,r){n[3*r]+=e[3*t],n[3*r+1]+=e[3*t+1],n[3*r+2]+=e[3*t+2]}function a(e,t,n){for(var r=e.triangleIndices.length,i=e.vertices,a=e.triangleIndices,s=0;r>s;s+=3){var u=a[s],c=a[s+1],l=a[s+2];o(i,c,n,u),o(i,l,n,u),o(i,u,n,c),o(i,l,n,c),o(i,u,n,l),o(i,c,n,l)}for(var s=0,h=e.vertexCount;h>s;s++){var f=t[s]+2;n[3*s]=(n[3*s]+2*i[3*s])/f,n[3*s+1]=(n[3*s+1]+2*i[3*s+1])/f,n[3*s+2]=(n[3*s+2]+2*i[3*s+2])/f}}function s(t,n){return void 0===n&&(n=1),1>n&&(n=0),0===n?e.Computation.resolve(t):e.Computation.create(function(e){e.update("Smoothing surface...");for(var r=new Int32Array(t.vertexCount),i=t.triangleIndices.length,o=t.triangleIndices,s=0;i>s;s++)r[o[s]]+=2;var u=new Float32Array(t.vertices.length),c=function(i){if(i>=n)return e.resolve(t),void 0;if(i>0)for(var o=0,s=u.length;s>o;o++)u[o]=0;t.normals=void 0,a(t,r,u);var l=t.vertices;t.vertices=u,u=l,e.update("Smoothing surface...",e.abortRequest,i+1,n),e.schedule(function(){return c(i+1)})};c(0)})}function u(t){return e.Computation.create(function(e){return t.boundingSphere?(e.resolve(t),void 0):(e.update("Computing bounding sphere..."),e.schedule(function(){for(var n=t.vertices,r=0,i=0,o=0,a=0,s=t.vertices.length;s>a;a+=3)r+=n[a],i+=n[a+1],o+=n[a+2];r/=t.vertexCount,i/=t.vertexCount,o/=t.vertexCount;for(var u=0,a=0,s=n.length;s>a;a+=3){var c=r-n[a],l=i-n[a+1],h=o-n[a+2];u=Math.max(u,c*c+l*l+h*h)}t.boundingSphere={center:{x:r,y:i,z:o},radius:Math.sqrt(u)},e.resolve(t)}),void 0)})}function c(e,n){for(var r={x:.1,y:.1,z:.1},i=t.LinearAlgebra.Matrix4.transformVector3,o=e.vertices,a=0,s=e.vertices.length;s>a;a+=3)r.x=o[a],r.y=o[a+1],r.z=o[a+2],i(r,r,n),o[a]=r.x,o[a+1]=r.y,o[a+2]=r.z;e.normals=void 0,e.boundingSphere=void 0}function l(t,n){return e.Computation.create(function(e){e.update("Updating surface..."),e.schedule(function(){c(t,n),e.resolve(t)})})}n.computeNormalsImmediate=r,n.computeNormals=i,n.laplacianSmooth=s,n.computeBoundingSphere=u,n.transformImmediate=c,n.transform=l}(n=t.Surface||(t.Surface={}))}(t=e.Geometry||(e.Geometry={}))}(t=e.Core||(e.Core={}))}(a||(a={}));var a;!function(e){var t;!function(e){var t;!function(t){var n;!function(t){function n(t){return e.Computation.create(function(e){var n=new r(t,e);n.start()})}t.compute=n;var r=function(){function t(t,n){var r=this;this.ctx=n,this.chunkSize=512e3,this.done=0,this.k=0,this.minX=0,this.minY=0,this.minZ=0,this.maxX=0,this.maxY=0,this.maxZ=0,this._slice=function(){try{r.slice()}catch(e){r.ctx.reject(""+e)}};var o=e.Utils.extend({},t);o.bottomLeft||(o.bottomLeft=[0,0,0]),o.topRight||(o.topRight=o.scalarField.dimensions),this.state=new i(o),this.minX=o.bottomLeft[0],this.minY=o.bottomLeft[1],this.minZ=o.bottomLeft[2],this.maxX=o.topRight[0]-1,this.maxY=o.topRight[1]-1,this.maxZ=o.topRight[2]-1,this.k=this.minZ,this.size=(this.maxX-this.minX)*(this.maxY-this.minY)*(this.maxZ-this.minZ),this.sliceSize=(this.maxX-this.minX)*(this.maxY-this.minY)}return t.prototype.nextSlice=function(){return this.ctx.abortRequested?(this.ctx.abort(),void 0):(this.done+=this.sliceSize,this.ctx.update("Computing surface...",this.ctx.abortRequest,this.done,this.size),this.k>=this.maxZ?this.finish():this.ctx.schedule(this._slice),void 0)
},t.prototype.slice=function(){for(var e=this.minY;e<this.maxY;e++)for(var t=this.minX;t<this.maxX;t++)this.state.processCell(t,e,this.k);this.k++,this.nextSlice()},t.prototype.finish=function(){var t=e.Utils.ChunkedArray.compact(this.state.vertexBuffer),n=e.Utils.ChunkedArray.compact(this.state.triangleBuffer);this.state.vertexBuffer=void 0,this.state.verticesOnEdges=void 0;var r={vertexCount:t.length/3|0,triangleCount:n.length/3|0,vertices:t,triangleIndices:n,annotation:this.state.annotate?e.Utils.ChunkedArray.compact(this.state.annotationBuffer):void 0};this.ctx.resolve(r)},t.prototype.start=function(){this.ctx.update("Computing surface...",this.ctx.abortRequest,0,this.size),this.ctx.schedule(this._slice)},t}(),i=function(){function n(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 n=t.topRight[0]-t.bottomLeft[0],r=t.topRight[1]-t.bottomLeft[1],i=t.topRight[2]-t.bottomLeft[2],o=Math.min(262144,0|Math.max(n*r*i/16,1024)),a=Math.min(65536,4*o);this.vertexBuffer=e.Utils.ChunkedArray.forVertex3D(o),this.triangleBuffer=e.Utils.ChunkedArray.create(function(e){return new Uint32Array(e)},a,3),this.annotate=!!t.annotationField,this.annotate&&(this.annotationBuffer=e.Utils.ChunkedArray.forInt32(o)),this.verticesOnEdges=new Int32Array(3*this.nX*this.nY*this.nZ)}return n.prototype.get3dOffsetFromEdgeInfo=function(e){return this.nX*((this.k+e.k)*this.nY+this.j+e.j)+this.i+e.i|0},n.prototype.interpolate=function(n){var r=t.EdgeIdInfo[n],i=3*this.get3dOffsetFromEdgeInfo(r)+r.e,o=this.verticesOnEdges[i];if(o>0)return o-1|0;var a=t.CubeEdges[n],s=a.a,u=a.b,c=s.i+this.i,l=s.j+this.j,h=s.k+this.k,f=u.i+this.i,p=u.j+this.j,d=u.k+this.k,m=this.scalarField.get(c,l,h),v=this.scalarField.get(f,p,d),g=(this.isoLevel-m)/(m-v),y=0|e.Utils.ChunkedArray.add3(this.vertexBuffer,c+g*(c-f),l+g*(l-p),h+g*(h-d));return this.verticesOnEdges[i]=y+1,this.annotate&&e.Utils.ChunkedArray.add(this.annotationBuffer,this.annotationField.get(this.i,this.j,this.k)),y},n.prototype.processCell=function(n,r,i){var o=0;if(this.scalarField.get(n,r,i)<this.isoLevel&&(o|=1),this.scalarField.get(n+1,r,i)<this.isoLevel&&(o|=2),this.scalarField.get(n+1,r+1,i)<this.isoLevel&&(o|=4),this.scalarField.get(n,r+1,i)<this.isoLevel&&(o|=8),this.scalarField.get(n,r,i+1)<this.isoLevel&&(o|=16),this.scalarField.get(n+1,r,i+1)<this.isoLevel&&(o|=32),this.scalarField.get(n+1,r+1,i+1)<this.isoLevel&&(o|=64),this.scalarField.get(n,r+1,i+1)<this.isoLevel&&(o|=128),0!==o&&255!==o){this.i=n,this.j=r,this.k=i;var a=t.EdgeTable[o];(1&a)>0&&(this.vertList[0]=this.interpolate(0)),(2&a)>0&&(this.vertList[1]=this.interpolate(1)),(4&a)>0&&(this.vertList[2]=this.interpolate(2)),(8&a)>0&&(this.vertList[3]=this.interpolate(3)),(16&a)>0&&(this.vertList[4]=this.interpolate(4)),(32&a)>0&&(this.vertList[5]=this.interpolate(5)),(64&a)>0&&(this.vertList[6]=this.interpolate(6)),(128&a)>0&&(this.vertList[7]=this.interpolate(7)),(256&a)>0&&(this.vertList[8]=this.interpolate(8)),(512&a)>0&&(this.vertList[9]=this.interpolate(9)),(1024&a)>0&&(this.vertList[10]=this.interpolate(10)),(2048&a)>0&&(this.vertList[11]=this.interpolate(11));for(var s=t.TriTable[o],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]])}},n}()}(n=t.MarchingCubes||(t.MarchingCubes={}))}(t=e.Geometry||(e.Geometry={}))}(t=e.Core||(e.Core={}))}(a||(a={}));var a;!function(e){var t;!function(e){var t;!function(e){var t;!function(e){var t=function(){function e(e,t,n){this.i=0|e,this.j=0|t,this.k=0|n}return e}();e.Index=t;var n=function(){function e(e,t){this.a=e,this.b=t}return e}();e.IndexPair=n,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 n(e.CubeVertices[0],e.CubeVertices[1]),new n(e.CubeVertices[1],e.CubeVertices[2]),new n(e.CubeVertices[2],e.CubeVertices[3]),new n(e.CubeVertices[3],e.CubeVertices[0]),new n(e.CubeVertices[4],e.CubeVertices[5]),new n(e.CubeVertices[5],e.CubeVertices[6]),new n(e.CubeVertices[6],e.CubeVertices[7]),new n(e.CubeVertices[7],e.CubeVertices[4]),new n(e.CubeVertices[0],e.CubeVertices[4]),new n(e.CubeVertices[1],e.CubeVertices[5]),new n(e.CubeVertices[2],e.CubeVertices[6]),new n(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}],e.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,6,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={}))}(a||(a={}));var a;!function(e){var t;!function(e){var t;!function(t){var n;!function(n){function r(t,n){return e.Computation.resolve({surface:n,usedParameters:t.parameters})}function i(t){return e.Computation.create(function(e){var n=new s(t,e);n.start()})}function o(e){return i(e).bind(function(e){return t.MarchingCubes.compute(e.data).bind(function(n){return t.Surface.transform(n,e.transform)}).bind(function(n){return t.Surface.laplacianSmooth(n,e.inputParameters.parameters&&e.inputParameters.parameters.smoothingIterations||1).bind(function(t){return r(e,t)})})})}var a=function(){function t(t){e.Utils.extend(this,t,{exactBoundary:!1,boundaryDelta:{dx:1.5,dy:1.5,dz:1.5},probeRadius:1.4,atomRadii:function(){return 1},density:1.1,interactive:!1,smoothingIterations:1}),this.exactBoundary&&(this.boundaryDelta={dx:0,dy:0,dz:0}),this.density<.3&&(this.density=.3)}return t}(),s=function(){function n(e,t){var n=this;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.maxField=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.currentAtom=0,this.chunkSize=1e4,this._addChunk=function(){try{n.addChunk()}catch(e){n.ctx.reject(e)}},this.parameters=new a(e.parameters);var r=e.positions;this.x=r.x,this.y=r.y,this.z=r.z,this.atomIndices=e.atomIndices}return n.prototype.findBounds=function(){for(var e=0,t=this.atomIndices;e<t.length;e++){var n=t[e],r=this.parameters.exactBoundary?0:this.parameters.atomRadius(n)+this.parameters.probeRadius,i=this.x[n],o=this.y[n],a=this.z[n];0>r||(this.minX=Math.min(this.minX,i-r),this.minY=Math.min(this.minY,o-r),this.minZ=Math.min(this.minZ,a-r),this.maxX=Math.max(this.maxX,i+r),this.maxY=Math.max(this.maxY,o+r),this.maxZ=Math.max(this.maxZ,a+r))}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)},n.prototype.initData=function(){var e=this.nX*this.nY*this.nZ;this.field=new Float32Array(e),this.maxField=new Float32Array(e),this.proximityMap=new Int32Array(e);for(var t=-Number.MAX_VALUE,n=0,r=this.proximityMap.length;r>n;n++)this.maxField[n]=t,this.proximityMap[n]=-1},n.prototype.updateMinIndex=function(e,t,n){this.minIndex.i=Math.max(0|Math.floor((e-this.minX)/this.dX),0),this.minIndex.j=Math.max(0|Math.floor((t-this.minY)/this.dY),0),this.minIndex.k=Math.max(0|Math.floor((n-this.minZ)/this.dZ),0)},n.prototype.updateMaxIndex=function(e,t,n){this.maxIndex.i=Math.min(0|Math.ceil((e-this.minX)/this.dX),this.nX),this.maxIndex.j=Math.min(0|Math.ceil((t-this.minY)/this.dY),this.nY),this.maxIndex.k=Math.min(0|Math.ceil((n-this.minZ)/this.dZ),this.nZ)},n.prototype.addBall=function(e,t){var n=t*t,r=this.x[e],i=this.y[e],o=this.z[e];this.updateMinIndex(r-t,i-t,o-t),this.updateMaxIndex(r+t,i+t,o+t);var a=this.minIndex.i,s=this.minIndex.j,u=this.minIndex.k,c=this.maxIndex.i,l=this.maxIndex.j,h=this.maxIndex.k;r=this.minX-r,i=this.minY-i,o=this.minZ-o;for(var f=u;h>f;f++)for(var p=o+f*this.dZ,d=p*p,m=f*this.nY,v=s;l>v;v++)for(var g=i+v*this.dY,y=d+g*g,b=this.nX*(m+v),x=a;c>x;x++){var w=r+x*this.dX,_=y+w*w,C=b+x,E=n/(1e-6+_)-1;E>this.maxField[C]&&(this.proximityMap[C]=e,this.maxField[C]=E),E>0&&(this.field[C]+=E)}},n.prototype.addChunk=function(){for(var e=this.atomIndices.length,t=0;this.currentAtom<e;this.currentAtom++){var n=this.atomIndices[this.currentAtom],r=this.parameters.atomRadius(n)+this.parameters.probeRadius;if(t++,!(0>r)&&(this.addBall(n,r),t>=this.chunkSize))return this.ctx.abortRequested?(this.ctx.abort(),void 0):(this.ctx.update("Creating field...",this.ctx.abortRequest,this.currentAtom,this.atomIndices.length),this.ctx.schedule(this._addChunk),void 0)}this.ctx.update("Creating field...",void 0,this.currentAtom,this.atomIndices.length),this.finish()},n.prototype.finish=function(){this.maxField=null;var n=t.LinearAlgebra.Matrix4.empty();t.LinearAlgebra.Matrix4.fromTranslation(n,[this.minX,this.minY,this.minZ]),n[0]=this.dX,n[5]=this.dY,n[10]=this.dZ;var r={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:{x:this.minX,y:this.minY,z:this.minZ},topRight:{x:this.maxX,y:this.maxY,z:this.maxZ},transform:n,inputParameters:this.inputParameters,parameters:this.parameters};this.ctx.resolve(r)},n.prototype.start=function(){var e=this;this.ctx.update("Initializing..."),this.ctx.schedule(function(){try{e.findBounds(),e.initData()}catch(t){return e.ctx.reject(t),void 0}return e.ctx.abortRequested?(e.ctx.abort(),void 0):(e.ctx.update("Creating field...",e.ctx.abortRequest,0,e.atomIndices.length),e.ctx.schedule(e._addChunk),void 0)})},n}();n.createMolecularIsoFieldAsync=i,n.computeMolecularSurfaceAsync=o}(n=t.MolecularSurface||(t.MolecularSurface={}))}(t=e.Geometry||(e.Geometry={}))}(t=e.Core||(e.Core={}))}(a||(a={}));var a;!function(e){var t;!function(e){var t;!function(t){var n=function(){function e(e,t){this.name=e,this.creator=t}return e}();t.DataTableColumnDescriptor=n;var r=function(){function t(t,n,r){this.count=t,this.indices=new Int32Array(t),this.columns=[];for(var i=0;t>i;i++)this.indices[i]=i;for(var o=0,a=n;o<a.length;o++){var s=a[o],u=r[s.name];e.Utils.ChunkedArray.is(u)&&(u=e.Utils.ChunkedArray.compact(u)),Object.defineProperty(this,s.name,{enumerable:!0,configurable:!1,writable:!1,value:u}),this.columns[this.columns.length]=s}}return t.prototype.getBuilder=function(e){for(var t=new i(e),n=0,r=this.columns;n<r.length;n++){var o=r[n];t.addColumn(o.name,o.creator)}return t},t.prototype.getRawData=function(){var e=this;return this.columns.map(function(t){return e[t.name]})},t}();t.DataTable=r;var i=function(){function e(e){this.columns=[],this.count=e}return e.prototype.addColumn=function(e,t){var r=t(this.count);return Object.defineProperty(this,e,{enumerable:!0,configurable:!1,writable:!1,value:r}),this.columns[this.columns.length]=new n(e,t),r},e.prototype.getRawData=function(){var e=this;return this.columns.map(function(t){return e[t.name]})},e.prototype.seal=function(){return new r(this.count,this.columns,this)},e}();t.DataTableBuilder=i;var o;!function(e){e[e.Polymer=0]="Polymer",e[e.NonPolymer=1]="NonPolymer",e[e.Water=2]="Water",e[e.Unknown=3]="Unknown"}(o=t.EntityType||(t.EntityType={}));var a=function(){function e(e){this.id=e,this.map=new Map}return e.prototype.add=function(e,t,n,r){void 0===r&&(r=!0);var i=this.map.get(e);if(void 0!==i){var o=i.get(t);void 0===o&&i.set(t,n)}else{var a=new Map;a.set(t,n),this.map.set(e,a)}r&&this.add(t,e,n,!1)},e}();t.ComponentBondInfoEntry=a;var s=function(){function e(){this.entries=new Map}return e.prototype.newEntry=function(e){var t=new a(e);return this.entries.set(e,t),t},e}();t.ComponentBondInfo=s;var u=function(){function e(e,t,n){this.asymId=e,this.seqNumber=t,this.insCode=n}return e.areEqual=function(e,t,n,r,i){return e.asymId===n[t]&&e.seqNumber===r[t]&&e.insCode===i[t]},e.compare=function(e,t){return e.asymId===t.asymId?e.seqNumber===t.seqNumber?e.insCode===t.insCode?0:void 0===e.insCode?-1:void 0===t.insCode?1:e.insCode<t.insCode?-1:1:e.seqNumber<t.seqNumber?-1:1:e.asymId<t.asymId?-1:1},e.compareResidue=function(e,t,n,r,i){return e.asymId===n[t]?e.seqNumber===r[t]?e.insCode===i[t]?0:void 0===e.insCode?-1:void 0===i[t]?1:e.insCode<i[t]?-1:1:e.seqNumber<r[t]?-1:1:e.asymId<n[t]?-1:1},e}();t.PolyResidueIdentifier=u;var c=function(){function e(e,t,n,r){void 0===r&&(r={}),this.type=e,this.startResidueId=t,this.endResidueId=n,this.info=r,this.startResidueIndex=-1,this.endResidueIndex=-1}return Object.defineProperty(e.prototype,"length",{get:function(){return this.endResidueIndex-this.startResidueIndex},enumerable:!0,configurable:!0}),e}();t.SecondaryStructureElement=c;var l=function(){function e(e,t,n,r,i){this.spacegroupName=e,this.cellSize=t,this.cellAngles=n,this.toFracTransform=r,this.isNonStandardCrytalFrame=i}return e}();t.SymmetryInfo=l;var h=function(){function e(e,t,n){this.id=e,this.name=t,this.operator=n}return e}();t.AssemblyOperator=h;var f=function(){function e(e,t){this.operators=e,this.asymIds=t}return e}();t.AssemblyGenEntry=f;var p=function(){function e(e){this.name=e,this.gens=[]}return e}();t.AssemblyGen=p;var d=function(){function e(e,t){this.operators=e,this.assemblies=t}return e}();t.AssemblyInfo=d;var m;!function(e){function t(e){var t=new i(e),n={id:t.addColumn("id",function(e){return new Int32Array(e)}),x:t.addColumn("x",function(e){return new Float32Array(e)}),y:t.addColumn("y",function(e){return new Float32Array(e)}),z:t.addColumn("z",function(e){return new Float32Array(e)}),altLoc:t.addColumn("altLoc",function(){return[]}),rowIndex:t.addColumn("rowIndex",function(e){return new Int32Array(e)}),residueIndex:t.addColumn("residueIndex",function(e){return new Int32Array(e)}),chainIndex:t.addColumn("chainIndex",function(e){return new Int32Array(e)}),entityIndex:t.addColumn("entityIndex",function(e){return new Int32Array(e)}),name:t.addColumn("name",function(){return[]}),elementSymbol:t.addColumn("elementSymbol",function(){return[]}),occupancy:t.addColumn("occupancy",function(e){return new Float32Array(e)}),tempFactor:t.addColumn("tempFactor",function(e){return new Float32Array(e)}),authName:t.addColumn("authName",function(){return[]})};return{table:t.seal(),columns:n}}function n(e){var t=new i(e),n={name:t.addColumn("name",function(){return[]}),seqNumber:t.addColumn("seqNumber",function(e){return new Int32Array(e)}),asymId:t.addColumn("asymId",function(){return[]}),authName:t.addColumn("authName",function(){return[]}),authSeqNumber:t.addColumn("authSeqNumber",function(e){return new Int32Array(e)}),authAsymId:t.addColumn("authAsymId",function(){return[]}),insCode:t.addColumn("insCode",function(){return[]}),entityId:t.addColumn("entityId",function(){return[]}),isHet:t.addColumn("isHet",function(e){return new Int8Array(e)}),atomStartIndex:t.addColumn("atomStartIndex",function(e){return new Int32Array(e)}),atomEndIndex:t.addColumn("atomEndIndex",function(e){return new Int32Array(e)}),chainIndex:t.addColumn("chainIndex",function(e){return new Int32Array(e)}),entityIndex:t.addColumn("entityIndex",function(e){return new Int32Array(e)}),secondaryStructureIndex:t.addColumn("secondaryStructureIndex",function(e){return new Int32Array(e)})};return{table:t.seal(),columns:n}}function r(e){var t=new i(e),n={asymId:t.addColumn("asymId",function(){return[]}),entityId:t.addColumn("entityId",function(){return[]}),authAsymId:t.addColumn("authAsymId",function(){return[]}),atomStartIndex:t.addColumn("atomStartIndex",function(e){return new Int32Array(e)}),atomEndIndex:t.addColumn("atomEndIndex",function(e){return new Int32Array(e)}),residueStartIndex:t.addColumn("residueStartIndex",function(e){return new Int32Array(e)}),residueEndIndex:t.addColumn("residueEndIndex",function(e){return new Int32Array(e)}),entityIndex:t.addColumn("entityIndex",function(e){return new Int32Array(e)})};return{table:t.seal(),columns:n}}function o(e){var t=new i(e),n={entityId:t.addColumn("entityId",function(){return[]}),entityType:t.addColumn("entityType",function(){return[]}),type:t.addColumn("type",function(){return[]}),atomStartIndex:t.addColumn("atomStartIndex",function(e){return new Int32Array(e)}),atomEndIndex:t.addColumn("atomEndIndex",function(e){return new Int32Array(e)}),residueStartIndex:t.addColumn("residueStartIndex",function(e){return new Int32Array(e)}),residueEndIndex:t.addColumn("residueEndIndex",function(e){return new Int32Array(e)}),chainStartIndex:t.addColumn("chainStartIndex",function(e){return new Int32Array(e)}),chainEndIndex:t.addColumn("chainEndIndex",function(e){return new Int32Array(e)})};return{table:t.seal(),columns:n}}function a(e){var t=new i(e),n={atomAIndex:t.addColumn("atomAIndex",function(e){return new Int32Array(e)}),atomBIndex:t.addColumn("atomBIndex",function(e){return new Int32Array(e)}),type:t.addColumn("type",function(e){return new Int8Array(e)})};return{table:t.seal(),columns:n}}e.forAtoms=t,e.forResidues=n,e.forChains=r,e.forEntities=o,e.forBonds=a}(m=t.DefaultDataTables||(t.DefaultDataTables={}));var v;!function(e){e[e.File=0]="File",e[e.Computed=1]="Computed"}(v=t.MoleculeModelSource||(t.MoleculeModelSource={}));var g=function(){function t(e,t,n){this.matrix=e,this.id=t,this.isIdentity=n}return t.prototype.apply=function(t){e.Geometry.LinearAlgebra.Matrix4.transformVector3(t,t,this.matrix)},t.applyToModelUnsafe=function(t,n){for(var r={x:.1,y:.1,z:.1},i=n.atoms,o=i.x,a=i.y,s=i.z,u=0,c=n.atoms.count;c>u;u++)r.x=o[u],r.y=a[u],r.z=s[u],e.Geometry.LinearAlgebra.Matrix4.transformVector3(r,r,t),o[u]=r.x,a[u]=r.y,s[u]=r.z},t}();t.Operator=g;var y=function(){function e(e){this._queryContext=void 0,this.id=e.id,this.modelId=e.modelId,this.atoms=e.atoms,this.residues=e.residues,this.chains=e.chains,this.entities=e.entities,this.covalentBonds=e.covalentBonds,this.nonCovalentbonds=e.nonCovalentbonds,this.componentBonds=e.componentBonds,this.secondaryStructure=e.secondaryStructure,this.symmetryInfo=e.symmetryInfo,this.assemblyInfo=e.assemblyInfo,this.parent=e.parent,this.source=e.source,this.operators=e.operators}return Object.defineProperty(e.prototype,"queryContext",{get:function(){return this._queryContext?this._queryContext:(this._queryContext=t.Query.Context.ofStructure(this),this._queryContext)},enumerable:!0,configurable:!0}),e.prototype.query=function(e){return t.Query.Builder.toQuery(e)(this.queryContext)},e}();t.MoleculeModel=y;var b=function(){function e(e,t,n){void 0===n&&(n={}),this.id=e,this.models=t,this.properties=n}return e}();t.Molecule=b,function(e){function t(e){for(var t={},n=e.atoms,i=0,o=n.columns;i<o.length;i++){var a=o[i];t[a.name]="x"===a.name||"y"===a.name||"z"===a.name?a.creator(n.count):n[a.name]}return new r(n.count,n.columns,t)}function n(n,r,i){for(var o=n.atoms,a=o.x,s=o.y,u=o.z,c=t(n),l=c.x,h=c.y,f=c.z,p={x:0,y:0,z:0},d=0,m=n.atoms.count;m>d;d++)i(r,a[d],s[d],u[d],p),l[d]=p.x,h[d]=p.y,f[d]=p.z;return new e({id:n.id,modelId:n.modelId,atoms:c,residues:n.residues,chains:n.chains,entities:n.entities,covalentBonds:n.covalentBonds,nonCovalentbonds:n.nonCovalentbonds,componentBonds:n.componentBonds,secondaryStructure:n.secondaryStructure,symmetryInfo:n.symmetryInfo,assemblyInfo:n.assemblyInfo,parent:n.parent,source:n.source,operators:n.operators})}e.withTransformedXYZ=n}(y=t.MoleculeModel||(t.MoleculeModel={}))}(t=e.Structure||(e.Structure={}))}(t=e.Core||(e.Core={}))}(a||(a={}));var a;!function(e){var t;!function(e){var t;!function(t){var n=e.Geometry.LinearAlgebra.Matrix4,r=e.Geometry.LinearAlgebra.Vector4,i=function(){function e(e){if(this.info=e,this.temp=n.empty(),this.tempV=new Float64Array(4),void 0===o.Spacegroup[e.spacegroupName])throw"'"+e.spacegroupName+"' is not a spacegroup recognized by the library.";this.space=this.getSpace(),this.operators=this.getOperators()}return Object.defineProperty(e.prototype,"operatorCount",{get:function(){return this.operators.length},enumerable:!0,configurable:!0}),e.prototype.getOperatorMatrix=function(e,t,r,i,o){return this.tempV[0]=t,this.tempV[1]=r,this.tempV[2]=i,n.fromTranslation(this.temp,this.tempV),n.mul(o,n.mul(o,n.mul(o,this.space.fromFrac,this.temp),this.operators[e]),this.space.toFrac),o},e.prototype.getSpace=function(){var e=this.info.toFracTransform,t=n.empty();return n.invert(t,e),{toFrac:e,fromFrac:t,baseX:r.transform(r.create(),r.fromValues(1,0,0,1),e),baseY:r.transform(r.create(),r.fromValues(0,1,0,1),e),baseZ:r.transform(r.create(),r.fromValues(0,0,1,1),e)}},e.getOperator=function(e){var t=o.Transform[e[0]],r=o.Transform[e[1]],i=o.Transform[e[2]];return n.ofRows([t,r,i,[0,0,0,1]])},e.prototype.getOperators=function(){var t=o.Group[o.Spacegroup[this.info.spacegroupName]];return t.map(function(t){return e.getOperator(o.Operator[t])})},e}();t.Spacegroup=i;var o;!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,1,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=[[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,31,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 c 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 (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}
}(o=t.SpacegroupTables||(t.SpacegroupTables={}))}(t=e.Structure||(e.Structure={}))}(t=e.Core||(e.Core={}))}(a||(a={}));var a;!function(e){var t;!function(e){var t;!function(t){function n(e,t,n){return o.buildPivotGroupSymmetry(e,t,n)}function r(e,t){return o.buildMates(e,t)}function i(e,t){return o.buildAssembly(e,t)}var o;!function(n){function r(e,t){for(var n=e.x,r=e.y,i=e.z,o={x:0,y:0,z:0},a=0,s=t;a<s.length;a++){var c=s[a];o.x+=n[c],o.y+=r[c],o.z+=i[c]}var l=t.length>0?t.length:1;o.x/=l,o.y/=l,o.z/=l;for(var h=0,f=0,p=t;f<p.length;f++){var c=p[f];h=Math.max(u(c,o,e),h)}return{center:o,radius:Math.sqrt(h)}}function i(){return{x:0,y:0,z:0}}function o(e,t,n){var r=e.x-n.center.x,i=e.y-n.center.y,o=e.z-n.center.z;return Math.sqrt(r*r+i*i+o*o)-(t+n.radius)}function a(e,t,n,r,i,a){return a.x=n.x[t],a.y=n.y[t],a.z=n.z[t],P.transformVector3(a,a,r),o(a,n.r[t],e)<=i}function s(e,t,n){var r=n.x[e]-n.cX[t],i=n.y[e]-n.cY[t],o=n.z[e]-n.cZ[t];return r*r+i*i+o*o}function u(e,t,n){var r=n.x[e]-t.x,i=n.y[e]-t.y,o=n.z[e]-t.z;return r*r+i*i+o*o}function c(e,t,n,r){return{model:e,boundingInfo:t,spacegroup:n,radius:r,transform:P.empty(),transformed:{x:0,y:0,z:0},i:0,j:0,k:0,op:0}}function l(e,t){return P.transformVector3(e.transformed,t,e.transform)}function h(e){return f(e.i,e.j,e.k,e.op,P.clone(e.transform))}function f(e,t,n,r,i){return{isIdentity:!(e||t||n||r),id:r+1+"_"+(5+e)+(5+t)+(5+n),transform:i}}function p(e,t){for(var n=!0,r=0;4>r;r++){for(var i=0;4>i;i++){var o=t[4*i+r];if(r===i){if(Math.abs(o-1)>1e-7){n=!1;break}}else if(Math.abs(o)>1e-7){n=!1;break}}if(!n)break}return{isIdentity:n,id:e.toString(),transform:t}}function d(e,n){for(var r=e.atoms,o=e.residues,a=e.chains,c=e.entities,l=r.x,h=r.y,f=r.z,p=new t.DataTableBuilder(c.count),d=p.addColumn("x",function(e){return new Float64Array(e)}),m=p.addColumn("y",function(e){return new Float64Array(e)}),v=p.addColumn("z",function(e){return new Float64Array(e)}),g=p.addColumn("r",function(e){return new Float64Array(e)}),y=new t.DataTableBuilder(a.count),b=y.addColumn("x",function(e){return new Float64Array(e)}),x=y.addColumn("y",function(e){return new Float64Array(e)}),w=y.addColumn("z",function(e){return new Float64Array(e)}),_=y.addColumn("r",function(e){return new Float64Array(e)}),C=new t.DataTableBuilder(o.count),E=C.addColumn("x",function(e){return new Float64Array(e)}),S=C.addColumn("y",function(e){return new Float64Array(e)}),M=C.addColumn("z",function(e){return new Float64Array(e)}),T=C.addColumn("r",function(e){return new Float64Array(e)}),A=i(),P=0,k=i(),R=0,I=0,D=i(),B=0,V=i(),L=0,N=i(),O=0,F=0,U=c.count;U>F;F++){D.x=0,D.y=0,D.z=0;for(var z=c.chainStartIndex[F],$=c.chainEndIndex[F];$>z;z++){V.x=0,V.y=0,V.z=0;for(var H=a.residueStartIndex[z],j=a.residueEndIndex[z];j>H;H++){N.x=0,N.y=0,N.z=0;for(var G=o.atomStartIndex[H],W=o.atomEndIndex[H];W>G;G++)N.x+=l[G],N.y+=h[G],N.z+=f[G];A.x+=N.x,A.y+=N.y,A.z+=N.z,I=o.atomEndIndex[H]-o.atomStartIndex[H],V.x+=N.x,V.y+=N.y,V.z+=N.z,E[H]=N.x/I,S[H]=N.y/I,M[H]=N.z/I}D.x+=V.x,D.y+=V.y,D.z+=V.z,I=a.atomEndIndex[z]-a.atomStartIndex[z],b[z]=V.x/I,x[z]=V.y/I,w[z]=V.z/I}I=c.atomEndIndex[F]-c.atomStartIndex[F],d[F]=D.x/I,m[F]=D.y/I,v[F]=D.z/I}A.x/=r.count,A.y/=r.count,A.z/=r.count;for(var q=0,X=n;q<X.length;q++){var G=X[q];k.x+=l[G],k.y+=h[G],k.z+=f[G]}var Y=n.length>0?n.length:1;k.x/=Y,k.y/=Y,k.z/=Y;for(var K={x:l,y:h,z:f,cX:d,cY:m,cZ:v},Q={x:l,y:h,z:f,cX:b,cY:x,cZ:w},Z={x:l,y:h,z:f,cX:E,cY:S,cZ:M},F=0,U=c.count;U>F;F++){B=0;for(var z=c.chainStartIndex[F],$=c.chainEndIndex[F];$>z;z++){L=0;for(var H=a.residueStartIndex[z],j=a.residueEndIndex[z];j>H;H++){O=0;for(var G=o.atomStartIndex[H],W=o.atomEndIndex[H];W>G;G++)O=Math.max(O,s(G,H,Z)),L=Math.max(L,s(G,z,Q)),B=Math.max(B,s(G,F,K)),P=Math.max(P,u(G,A,Z));O=Math.sqrt(O),T[H]=O}L=Math.sqrt(L),_[z]=L}B=Math.sqrt(B),g[F]=B}P=Math.sqrt(P);for(var J=0,et=n;J<et.length;J++){var G=et[J];R=Math.max(R,u(G,k,Z))}return R=Math.sqrt(R),{entities:p.seal(),chains:y.seal(),residues:C.seal(),allAtoms:{center:A,radius:P},target:{center:k,radius:R}}}function m(e){var t=e.boundingInfo,n=e.spacegroup,r=[];e.transform=P.identity(),r[0]=h(e);for(var i=-3;3>=i;i++)for(var a=-3;3>=a;a++)for(var s=-3;3>=s;s++)for(var u=0===i&&0===a&&0===s?1:0,c=n.operatorCount;c>u;u++){n.getOperatorMatrix(u,i,a,s,e.transform),e.i=i,e.k=s,e.j=a,e.op=u;var f=l(e,t.allAtoms.center),p=o(f,t.allAtoms.radius,t.target);p<e.radius&&(r[r.length]=h(e))}return r}function v(t,n){for(var r=t.boundingInfo,i=t.radius,o=r.target,s=t.model,u=(s.atoms,s.residues),c=s.chains,l=s.entities,h=e.Utils.ChunkedArray.create(function(e){return new Int32Array(e)},t.model.residues.count,1),f=e.Utils.ChunkedArray.create(function(e){return new Int32Array(e)},t.model.residues.count,1),p={x:0,y:0,z:0},d=0,m=0,v=0,g=0,y=0,b=l.count;b>y;y++){d=0;for(var x=!1,w=0,_=n;w<_.length;w++){for(var C=_[w],E=l.chainStartIndex[y],S=l.chainEndIndex[y];S>E;E++)if(a(o,E,r.chains,C.transform,i,p)){for(var M=!1,T=c.residueStartIndex[E],A=c.residueEndIndex[E];A>T;T++)a(o,T,r.residues,C.transform,i,p)&&(e.Utils.ChunkedArray.add(h,T),e.Utils.ChunkedArray.add(f,d),m+=u.atomEndIndex[T]-u.atomStartIndex[T],M=!0);M&&(v+=1,x=!0)}d++}x&&g++}return{residues:e.Utils.ChunkedArray.compact(h),operators:e.Utils.ChunkedArray.compact(f),atomCount:m,chainCount:v,entityCount:g}}function g(e,t,n,r,i){for(var o=0;i>o;o++)n[o][r]=e[o][t]}function y(e,n,r){for(var i,o,a,s,u,c,l,h=e.residues,f=h.chainIndex,p=h.entityIndex,d=h.atomStartIndex,m=h.atomEndIndex,v=e.atoms,y=v.x,x=v.y,w=v.z,_=new t.DataTableBuilder(n.atomCount),C=[],E=e.entities.getBuilder(n.entityCount),S=E,M=e.entities.getRawData(),T=S.getRawData(),A=S.chainStartIndex,k=S.chainEndIndex,R=S.residueStartIndex,I=S.residueEndIndex,D=S.atomStartIndex,B=S.atomEndIndex,V=0,L=e.chains.getBuilder(n.chainCount),N=L,O=e.chains.getRawData(),F=N.getRawData(),U=N.residueStartIndex,z=N.residueEndIndex,$=N.atomStartIndex,H=N.atomEndIndex,j=N.asymId,G=N.authAsymId,W=N.entityIndex,q=L.addColumn("sourceChainIndex",function(e){return new Int32Array(e)}),X=L.addColumn("operatorIndex",function(e){return new Int32Array(e)}),Y=0,K=e.residues.getBuilder(n.residues.length),Q=e.residues.getRawData(),Z=K.getRawData(),J=K.atomStartIndex,et=K.atomEndIndex,tt=K.asymId,nt=K.authAsymId,rt=K.chainIndex,it=K.entityIndex,ot=0,at=e.atoms.columns;ot<at.length;ot++){var st=at[ot],ut=_.addColumn(st.name,st.creator);"x"===st.name?i=ut:"y"===st.name?o=ut:"z"===st.name?a=ut:"residueIndex"===st.name?u=ut:"chainIndex"===st.name?c=ut:"entityIndex"===st.name?l=ut:"id"===st.name?s=ut:C[C.length]={src:v[st.name],target:ut}}var ct,lt,ht=n.residues,ft=n.operators,pt={x:0,y:0,z:0},dt=0,mt=ht[0],vt=f[mt],gt=p[mt],yt=ft[0];g(M,p[mt],T,0,M.length),A[0]=0,R[0]=0,D[0]=0,g(O,f[mt],F,0,O.length),W[0]=0,U[0]=0,$[0]=0,ct=e.chains.asymId[f[mt]],lt=e.chains.authAsymId[f[mt]];var bt=r[ft[0]];bt&&!bt.isIdentity&&(j[Y]=e.chains.asymId[f[mt]]+"-"+bt.id,G[Y]=e.chains.authAsymId[f[mt]]+"-"+bt.id,q[Y]=f[mt],X[Y]=yt,ct=j[Y],lt=G[Y]);for(var xt=0,wt=ht.length;wt>xt;xt++){mt=ht[xt];var _t=ft[xt];bt=r[_t],g(Q,mt,Z,xt,Z.length);var Ct=p[mt],Et=f[mt],St=!1;Ct!==gt?(z[Y]=xt,H[Y]=dt,Y+=1,k[V]=Y,I[V]=xt,B[V]=dt,V+=1,g(M,Ct,T,V,M.length),A[V]=Y,R[V]=xt,D[V]=dt,St=!0):Et!==vt?(z[Y]=xt,H[Y]=dt,Y+=1,St=!0):_t!==yt&&(z[Y]=xt,H[Y]=dt,Y+=1,St=!0),St&&(g(O,Et,F,Y,O.length),W[Y]=V,U[Y]=xt,$[Y]=dt,bt.isIdentity||(j[Y]=e.chains.asymId[Et]+"-"+bt.id,G[Y]=e.chains.authAsymId[Et]+"-"+bt.id),q[Y]=Et,X[Y]=_t,ct=j[Y],lt=G[Y]),vt=Et,gt=Ct,yt=_t,rt[xt]=Y,it[xt]=V,J[xt]=dt,tt[xt]=ct,nt[xt]=lt;for(var Mt=d[mt],Tt=m[mt];Tt>Mt;Mt++){pt.x=y[Mt],pt.y=x[Mt],pt.z=w[Mt],P.transformVector3(pt,pt,bt.transform),i[dt]=pt.x,o[dt]=pt.y,a[dt]=pt.z,s[dt]=dt+1,u[dt]=xt,c[dt]=Y,l[dt]=V;for(var At=0,Pt=C;At<Pt.length;At++){var ut=Pt[At];ut.target[dt]=ut.src[Mt]}dt++}et[xt]=dt}k[V]=Y+1,I[V]=ht.length,B[V]=dt,z[Y]=ht.length,H[Y]=dt;var kt=_.seal(),Rt=K.seal(),It=L.seal(),Dt=E.seal(),Bt=b(e,n,Rt);return new t.MoleculeModel({id:e.id,modelId:e.modelId,atoms:kt,residues:Rt,chains:It,entities:Dt,componentBonds:e.componentBonds,secondaryStructure:Bt,parent:e,source:t.MoleculeModelSource.Computed,operators:r.map(function(e){return new t.Operator(e.transform,e.id,e.isIdentity)})})}function b(e,n,r){for(var i=e.residues.secondaryStructureIndex,o=e.secondaryStructure,a=r.asymId,s=r.seqNumber,u=r.insCode,c=r.secondaryStructureIndex,l=n.residues,h=n.operators,f=l.length,p=[],d=0;f>d;){for(var m=d,v=i[l[d]],g=h[d];f>m&&h[m]==g&&i[l[m]]==v;)m++;var y=o[v],b=new t.SecondaryStructureElement(y.type,new t.PolyResidueIdentifier(a[d],s[d],u[d]),new t.PolyResidueIdentifier(a[m-1],s[m-1],u[m-1]),y.info);b.startResidueIndex=d,b.endResidueIndex=m;for(var x=p.length,w=d;m>w;w++)c[w]=x;p[x]=b,d=m}return p}function x(e,n,r){var i=e.symmetryInfo;if(!i||"P 1"===i.spacegroupName||i.cellSize[0]<1.1&&i.cellSize[1]<1.1&&i.cellSize[2]<1.1)return e;var o;o=r?e.query(r).unionAtomIndices():e.atoms.indices;var a=d(e,o),s=new t.Spacegroup(i),u=c(e,a,s,n),l=m(u),h=v(u,l);return y(e,h,l)}function w(e,n){for(var i=r(e.atoms,e.atoms.indices),a=new t.Spacegroup(e.symmetryInfo),s=P.empty(),u={x:0,y:0,z:0},c=[],l=-3;3>=l;l++)for(var h=-3;3>=h;h++)for(var p=-3;3>=p;p++)for(var d=0;d<a.operatorCount;d++)if(a.getOperatorMatrix(d,l,h,p,s),P.transformVector3(u,i.center,s),!(o(u,i.radius,i)>n)){var m=P.empty();P.copy(m,s),c.push(f(l,h,p,d,m))}return c}function _(t,n){for(var r=t.atoms,i=(t.residues,t.chains),o=t.entities,a=e.Utils.ArrayBuilder.create(function(e){return new Int32Array(e)},t.residues.count*n.length,1),s=e.Utils.ArrayBuilder.create(function(e){return new Int32Array(e)},t.residues.count*n.length,1),u=0,c=n.length*r.count,l=n.length*i.count,h=t.entities.count,f=0,p=o.count;p>f;f++){u=0;for(var d=0,m=n;d<m.length;d++){for(var v=(m[d],o.chainStartIndex[f]),g=o.chainEndIndex[f];g>v;v++)for(var y=i.residueStartIndex[v],b=i.residueEndIndex[v];b>y;y++)e.Utils.ArrayBuilder.add(a,y),e.Utils.ArrayBuilder.add(s,u);u++}}return{residues:a.array,operators:s.array,atomCount:c,chainCount:l,entityCount:h}}function C(e,t){var n=e.symmetryInfo;if(!n||"P 1"===n.spacegroupName||n.cellSize[0]<1.1&&n.cellSize[1]<1.1&&n.cellSize[2]<1.1)return e;var r=w(e,t),i=_(e,r);return y(e,i,r)}function E(e,t,n,r){if(0>n)return t[t.length]=r.slice(0),void 0;for(var i=e[n],o=i.length,a=0;o>a;a++)r[n]=i[a],E(e,t,n-1,r)}function S(e,t){for(var n=e.assemblyInfo,r=[],i=(P.empty(),0),o=0,a=t;o<a.length;o++){for(var s=a[o],u=P.identity(),c=0;c<s.length;c++)P.mul(u,u,n.operators[s[c]].operator);i++,r[r.length]=p(i,u)}return r}function M(t,n,r,i){for(var o=(t.atoms,t.residues),a=t.chains,s=t.entities,u=i.residueIndices,c=i.operatorIndices,l=0,h=0,f=0,p=0,d=0,m=s.count;m>d;d++){l=i.transformsOffset;for(var v=!1,g=0,y=r;g<y.length;g++){for(var b=(y[g],s.chainStartIndex[d]),x=s.chainEndIndex[d];x>b;b++){for(var w=!1,_=a.residueStartIndex[b],C=a.residueEndIndex[b];C>_;_++)n[_]&&(e.Utils.ChunkedArray.add(u,_),e.Utils.ChunkedArray.add(c,l),h+=o.atomEndIndex[_]-o.atomStartIndex[_],w=!0);w&&(f+=1,v=!0)}l++}v&&p++}i.atomCount+=h,i.chainCount+=f,i.entityCount+=p}function T(e,t,n){for(var r=[],i=[],o=0;o<t.operators.length;o++)i[o]="";E(t.operators,r,t.operators.length-1,i);var a=S(e,r);n.transformsOffset+=n.transforms.length,(f=n.transforms).push.apply(f,a);var s=new Set;t.asymIds.forEach(function(e){return s.add(e)});for(var u=e.residues.asymId,c=e.residues.count,l=n.mask,h=0;c>h;h++)l[h]=s.has(u[h]);M(e,l,a,n);var f}function A(t,n){for(var r={atomCount:0,chainCount:0,entityCount:0,transforms:[],transformsOffset:0,mask:new Int8Array(t.residues.count),residueIndices:e.Utils.ChunkedArray.create(function(e){return new Int32Array(e)},t.residues.count,1),operatorIndices:e.Utils.ChunkedArray.create(function(e){return new Int32Array(e)},t.residues.count,1)},i=0,o=n.gens;i<o.length;i++){var a=o[i];T(t,a,r)}var s={residues:e.Utils.ChunkedArray.compact(r.residueIndices),operators:e.Utils.ChunkedArray.compact(r.operatorIndices),atomCount:r.atomCount,chainCount:r.chainCount,entityCount:r.entityCount};return y(t,s,r.transforms)}var P=e.Geometry.LinearAlgebra.Matrix4;n.buildPivotGroupSymmetry=x,n.buildMates=C,n.buildAssemblyEntry=T,n.buildAssembly=A}(o||(o={})),t.buildPivotGroupSymmetry=n,t.buildSymmetryMates=r,t.buildAssembly=i}(t=e.Structure||(e.Structure={}))}(t=e.Core||(e.Core={}))}(a||(a={}));var a;!function(e){var t;!function(e){var t;!function(t){var n;!function(t){var n=function(){function t(e,t){this.structure=e,this.mask=t}return Object.defineProperty(t.prototype,"atomCount",{get:function(){return this.mask.size},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"isComplete",{get:function(){return this.mask.size===this.structure.atoms.count},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"tree",{get:function(){return this.lazyTree||this.makeTree(),this.lazyTree},enumerable:!0,configurable:!0}),t.prototype.hasAtom=function(e){return!!this.mask.has(e)},t.prototype.hasRange=function(e,t){for(var n=e;t>n;n++)if(this.mask.has(n))return!0;return!1},t.ofStructure=function(e){return new t(e,t.Mask.ofStructure(e))},t.ofFragments=function(e){return new t(e.context.structure,t.Mask.ofFragments(e))},t.ofAtomIndices=function(e,n){return new t(e,t.Mask.ofIndices(e,n))},t.prototype.makeTree=function(){for(var t=new Int32Array(this.mask.size),n=0,r=this.structure.atoms,i=r.x,o=r.y,a=r.z,s=0,u=this.structure.atoms.count;u>s;s++)this.mask.has(s)&&(t[n++]=s);this.lazyTree=e.Geometry.SubdivisionTree3D.create(t,function(e,t){return t(i[e],o[e],a[e])})},t}();t.Context=n,function(e){var t;!function(e){function t(e){return new o(e.atoms.count)}function n(e,t){var n=t.length/e.atoms.count;if(.25>n){for(var r=new Set,o=0,a=t;o<a.length;o++){var s=a[o];r.add(s)}return r}for(var u=new Int8Array(e.atoms.count),c=0,l=t;c<l.length;c++){var s=l[c];u[s]=1}return new i(u,t.length)}function r(e){for(var t=0,n=0,r=e.fragments;n<r.length;n++){var o=r[n];t+=o.atomCount}var a=e.context.structure.atoms.count;if(.25>t/a){for(var s=new Set,u=0,c=e.fragments;u<c.length;u++)for(var o=c[u],l=0,h=o.atomIndices;l<h.length;l++){var f=h[l];s.add(f)}return s}for(var s=new Int8Array(a),p=0,d=e.fragments;p<d.length;p++)for(var o=d[p],m=0,v=o.atomIndices;m<v.length;m++){var f=v[m];s[f]=1}for(var g=0,f=0;a>f;f++)0!==s[f]&&g++;return new i(s,g)}var i=function(){function e(e,t){this.mask=e,this.size=t}return e.prototype.has=function(e){return this.mask[e]},e}(),o=function(){function e(e){this.size=e}return e.prototype.has=function(){return!0},e}();e.ofStructure=t,e.ofIndices=n,e.ofFragments=r}(t=e.Mask||(e.Mask={}))}(n=t.Context||(t.Context={}));var r=function(){function r(e,t,n){this._hashCode=0,this._hashComputed=!1,this.context=e,this.tag=t,this.atomIndices=n}return Object.defineProperty(r.prototype,"hashCode",{get:function(){if(this._hashComputed)return this._hashCode;for(var e=23,t=0,n=this.atomIndices;t<n.length;t++){var r=n[t];e=31*e+r|0}return this._hashCode=e,this._hashComputed=!0,e},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"id",{get:function(){return this.context.structure.id+"_"+this.tag},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"atomCount",{get:function(){return this.atomIndices.length},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"isHet",{get:function(){var e=this.context.structure.atoms.residueIndex[this.tag];return this.context.structure.residues.isHet[e]},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"fingerprint",{get:function(){if(this._fingerprint)return this._fingerprint;for(var e=this.residueIndices,t=(this.context.structure,this.context.structure.residues),n=t.name,r=t.asymId,i=t.seqNumber,o=t.insCode,a=[],s=0,u=e;s<u.length;s++){var c=u[s],l=n[c]+" "+r[c]+" "+i[c];o[c]&&(l+=" i:"+o[c]),a[a.length]=l}return a.join("-")},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"authFingerprint",{get:function(){if(this._authFingerprint)return this._authFingerprint;for(var e=this.residueIndices,t=(this.context.structure,this.context.structure.residues),n=t.authName,r=t.authAsymId,i=t.authSeqNumber,o=t.insCode,a=[],s=0,u=e;s<u.length;s++){var c=u[s],l=n[c]+" "+r[c]+" "+i[c];o[c]&&(l+=" i:"+o[c]),a[a.length]=l}return a.join("-")},enumerable:!0,configurable:!0}),r.prototype.find=function(e){var r=n.ofFragments(new i(this.context,[this]));return t.Builder.toQuery(e)(r)},r.prototype.computeIndices=function(){if(!this._residueIndices){for(var t=new Set,n=new Set,r=new Set,i=this.context.structure.atoms.residueIndex,o=this.context.structure.residues.chainIndex,a=this.context.structure.chains.entityIndex,s=0,u=this.atomIndices;s<u.length;s++){var c=u[s];t.add(i[c])}this._residueIndices=e.Utils.integerSetToSortedTypedArray(t);for(var l=0,h=this._residueIndices;l<h.length;l++){var c=h[l];n.add(o[c])}this._chainIndices=e.Utils.integerSetToSortedTypedArray(n);for(var f=0,p=this._chainIndices;f<p.length;f++){var c=p[f];r.add(a[c])}this._entityIndices=e.Utils.integerSetToSortedTypedArray(r)}},Object.defineProperty(r.prototype,"residueIndices",{get:function(){return this.computeIndices(),this._residueIndices},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"chainIndices",{get:function(){return this.computeIndices(),this._chainIndices},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"entityIndices",{get:function(){return this.computeIndices(),this._entityIndices},enumerable:!0,configurable:!0}),r.areEqual=function(e,t){if(e.atomCount!==t.atomCount)return!1;for(var n=e.atomIndices,r=t.atomIndices,i=0;i<n.length;i++)if(n[i]!==r[i])return!1;return e.tag===t.tag},r.ofSet=function(e,t){var n=new Int32Array(t.size);return t.forEach(function(e){this.array[this.index++]=e},{array:n,index:0}),Array.prototype.sort.call(n,function(e,t){return e-t}),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);return n[0]=t,new r(e,t,n)},r.ofIndexRange=function(e,t,n){for(var i=0,o=t;n>o;o++)e.hasAtom(o)&&i++;for(var a=new Int32Array(i),s=0,o=t;n>o;o++)e.hasAtom(o)&&(a[s++]=o);return new r(e,t,a)},r}();t.Fragment=r;var i=function(){function e(e,t){this.context=e,this.fragments=t}return e.empty=function(t){return new e(t,[])},Object.defineProperty(e.prototype,"length",{get:function(){return this.fragments.length},enumerable:!0,configurable:!0}),e.prototype.unionAtomIndices=function(){if(!this.length)return[];if(1===this.length)return this.fragments[0].atomIndices;for(var e=new Int8Array(this.context.structure.atoms.count),t=0,n=0,r=this.fragments;n<r.length;n++)for(var i=r[n],o=0,a=i.atomIndices;o<a.length;o++){var s=a[o];e[s]=1}for(var u=0,c=e;u<c.length;u++){var s=c[u];t+=s}for(var l=new Int32Array(t),h=0,s=0,f=e.length;f>s;s++)e[s]&&(l[h++]=s);return l},e.prototype.unionFragment=function(){if(!this.length)return new r(this.context,0,new Int32Array(0));if(1===this.length)return this.fragments[0];var e=this.unionAtomIndices();return new r(this.context,e[0],e)},e}();t.FragmentSeq=i;var o=function(){function e(e){this.ctx=e,this.fragments=[]}return e.prototype.add=function(e){this.fragments[this.fragments.length]=e},e.prototype.getSeq=function(){return new i(this.ctx,this.fragments)},e}();t.FragmentSeqBuilder=o;var a=function(){function e(e){this.ctx=e,this.fragments=[],this.byHash=new Map}return e.prototype.add=function(e){var t=e.hashCode;if(this.byHash.has(t)){for(var n=this.byHash.get(t),i=0,o=n;i<o.length;i++){var a=o[i];if(r.areEqual(e,a))return this}this.fragments[this.fragments.length]=e,n[n.length]=e}else this.fragments[this.fragments.length]=e,this.byHash.set(t,[e]);return this},e.prototype.getSeq=function(){return new i(this.ctx,this.fragments)},e}();t.HashFragmentSeqBuilder=a}(n=t.Query||(t.Query={}))}(t=e.Structure||(e.Structure={}))}(t=e.Core||(e.Core={}))}(a||(a={}));var a;!function(e){var t;!function(e){var t;!function(t){var n;!function(n){function r(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return B.build(function(){return V.compileAtoms(e,function(e){return e.atoms.elementSymbol})})}function i(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return B.build(function(){return V.compileAtoms(e,function(e){return e.atoms.name})})}function o(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return B.build(function(){return V.compileAtoms(e,function(e){return e.atoms.id})})}function a(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return B.build(function(){return V.compileAtomRanges(!1,e,function(e){return e.residues})})}function s(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return B.build(function(){return V.compileAtomRanges(!1,e,function(e){return e.chains})})}function u(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return B.build(function(){return V.compileAtomRanges(!1,e,function(e){return e.entities})})}function c(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return B.build(function(){return V.compileAtomRanges(!0,e,function(e){return e.entities})})}function l(){return B.build(function(){return V.compileEverything()})}function h(e){return B.build(function(){return V.compileFromIndices(!1,e,function(e){return e.entities})})}function f(e){return B.build(function(){return V.compileFromIndices(!1,e,function(e){return e.chains})})}function p(e){return B.build(function(){return V.compileFromIndices(!1,e,function(e){return e.residues})})}function d(e){return B.build(function(){return V.compileAtomIndices(e)})}function m(e,t,n,r){return B.build(function(){return V.compileSequence(e,t,n,r)})}function v(){return B.build(function(){return V.compileHetGroups()})}function g(){return B.build(function(){return V.compileNonHetPolymer()})}function y(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return B.build(function(){return V.compilePolymerNames(e,!1)})}function b(){return C(B.build(function(){return V.compilePolymerNames(["CA","O","O5'","C3'","N3"],!1)}),v(),u({type:"water"}))}function x(){return B.build(function(){return V.compilePolymerNames(["N","CA","C","O","P","OP1","OP2","O3'","O5'","C3'","C5'","C4"],!1)})}function w(){return B.build(function(){return V.compilePolymerNames(["N","CA","C","O","P","OP1","OP2","O3'","O5'","C3'","C5'","C4"],!0)})}function _(e,t){return B.build(function(){return V.compileAtomsInBox(e,t)})}function C(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return B.build(function(){return V.compileOr(e)})}function E(e){return B.build(function(){return V.compileComplement(e)})}function S(e,t){return B.build(function(){return V.compileAmbientResidues(e,t)})}function M(e){return B.build(function(){return V.compileWholeResidues(e)})}function T(e){return B.build(function(){return V.compileUnion(e)})}function A(e,t){return B.build(function(){return V.compileInside(e,t)})}function P(e,t){return B.build(function(){return V.compileIntersectWith(e,t)})}function k(e,t){return B.build(function(){return V.compileFlatten(e,t)})}function R(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return a.apply(void 0,e.map(function(e){return{name:e}}))}function I(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return a.apply(void 0,e.map(function(e){return{authSeqNumber:e}}))}function D(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return s.apply(void 0,e.map(function(e){return{authAsymId:e}}))}var B;!function(e){function t(t,n){e.BuilderPrototype[t]=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return n.call.apply(n,[void 0,this].concat(e))}}function n(t){return Object.create(e.BuilderPrototype,{compile:{writable:!1,configurable:!1,value:t}})}function r(e){return!!e.compile}function i(e){if("undefined"==typeof window)throw"parse can only be called from a browser.";(void 0,eval)("with (LiteMol.Core.Structure.Query) { window.__LiteMol_query = "+e+"; }");var t=window.__LiteMol_query;return window.__LiteMol_query=void 0,t.compile()}function o(e){var t;return t=r(e)?e.compile():"string"==typeof e||e instanceof String?i(e):e}e.BuilderPrototype={},e.registerModifier=t,e.build=n,e.parse=i,e.toQuery=o}(B=n.Builder||(n.Builder={})),n.atomsByElement=r,n.atomsByName=i,n.atomsById=o,n.residues=a,n.chains=s,n.entities=u,n.notEntities=c,n.everything=l,n.entitiesFromIndices=h,n.chainsFromIndices=f,n.residuesFromIndices=p,n.atomsFromIndices=d,n.sequence=m,n.hetGroups=v,n.nonHetPolymer=g,n.polymerTrace=y,n.cartoons=b,n.backbone=x,n.sidechain=w,n.atomsInBox=_,n.or=C,B.registerModifier("complement",E),n.complement=E,B.registerModifier("ambientResidues",S),n.ambientResidues=S,B.registerModifier("wholeResidues",M),n.wholeResidues=M,B.registerModifier("union",T),n.union=T,B.registerModifier("inside",A),n.inside=A,B.registerModifier("intersectWith",P),n.intersectWith=P,B.registerModifier("flatten",k),n.flatten=k,n.residuesByName=R,n.residuesById=I,n.chainsById=D;var V;!function(r){function i(){return function(e){if(e.isComplete){var t=e.structure.atoms.indices;return new n.FragmentSeq(e,[new n.Fragment(e,t[0],t)])}for(var r=new Int32Array(e.atomCount),i=0,o=0,a=e.structure.atoms.indices;o<a.length;o++){var s=a[o];e.hasAtom(s)&&(r[i++]=s)}return new n.FragmentSeq(e,[n.Fragment.ofArray(e,r[0],r)])}}function o(e,t){return function(r){for(var i=new Set(e),o=t(r.structure),a=new n.FragmentSeqBuilder(r),s=0,u=o.length;u>s;s++)r.hasAtom(s)&&i.has(o[s])&&a.add(n.Fragment.ofIndex(r,s));return a.getSeq()}}function a(e){return function(t){for(var r=0,i=0,o=e;i<o.length;i++){var a=o[i];t.hasAtom(a)&&r++}if(!r)return n.FragmentSeq.empty(t);for(var s=0,u=new Int32Array(r),c=0,l=e;c<l.length;c++){var a=l[c];t.hasAtom(a)&&(u[s++]=a)}return new n.FragmentSeq(t,[n.Fragment.ofArray(t,u[0],u)])}}function s(e,t,r){return function(i){var o=r(i.structure),a=o.atomStartIndex,s=o.atomEndIndex,u=new n.FragmentSeqBuilder(i);if(e)for(var c=new Set(t),l=o.count,h=0;l>h;h++)c.has(h)||i.hasRange(a[h],s[h])&&u.add(n.Fragment.ofIndexRange(i,a[h],s[h]));else for(var f=0,p=t;f<p.length;f++){var h=p[f];i.hasRange(a[h],s[h])&&u.add(n.Fragment.ofIndexRange(i,a[h],s[h]))}return u.getSeq()}}function u(e,t,r){return function(i){for(var o=r(i.structure),a=o.atomStartIndex,s=o.atomEndIndex,u=new n.FragmentSeqBuilder(i),c=o.count,l=!1,h=t.map(function(e){return new E(e,o)}),f=0===h.length,p=0;c>p;p++)if(i.hasRange(a[p],s[p])){l=f;for(var d=0,m=h;d<m.length;d++){var v=m[d];if(v.isSatisfied(p)){l=!0;break}}e&&(l=!l),l&&u.add(n.Fragment.ofIndexRange(i,a[p],s[p]))}return u.getSeq()}}function c(e,t,r,i){return function(o){for(var a=o.structure.residues,s=o.structure.chains,u=a.seqNumber,c=(a.insCode,a.chainIndex,a.atomStartIndex),l=a.atomEndIndex,h=s.entityId,f=(s.asymId,s.count),p=s.residueStartIndex,d=s.residueEndIndex,m=new n.FragmentSeqBuilder(o),v=o.structure.parent,g=o.structure.chains.sourceChainIndex,y=v&&g,b="string"==typeof t?{asymId:t}:t,x=new E(b,y?v.chains:o.structure.chains),w=0;f>w;w++)if(h[w]===e&&x.isSatisfied(y?g[w]:w)){for(var _=p[w],C=d[w],S=-1,M=-1;C>_;_++)if(u[_]>=r.seqNumber){S=_;break}if(_!==C){for(_=S;C>_&&!(u[_]>=i.seqNumber);_++);M=_,o.hasRange(c[S],l[M])&&m.add(n.Fragment.ofIndexRange(o,c[S],l[M]))}}return m.getSeq()}}function l(){return function(e){for(var r=e.structure.residues,i=r.atomStartIndex,o=r.atomEndIndex,a=r.isHet,s=r.entityIndex,u=r.count,c=e.structure.entities.entityType,l=t.EntityType.Water,h=new n.FragmentSeqBuilder(e),f=0;u>f;f++)e.hasRange(i[f],o[f])&&c[s[f]]!==l&&a[f]&&h.add(n.Fragment.ofIndexRange(e,i[f],o[f]));return h.getSeq()}}function h(){return function(e){for(var r=e.structure.residues,i=r.atomStartIndex,o=r.atomEndIndex,a=(r.isHet,r.entityIndex,r.count,e.structure.entities),s=a.entityType,u=a.count,c=a.residueStartIndex,l=a.residueEndIndex,h=t.EntityType.Polymer,f=0,p=0;u>p;p++)if(s[p]===h)for(var d=c[p],m=l[p];m>d;d++)for(var v=i[d],g=o[d];g>v;v++)e.hasAtom(v)&&f++;if(!f)return n.FragmentSeq.empty(e);for(var y=new Int32Array(f),b=0,p=0;u>p;p++)if(s[p]===h)for(var d=c[p],m=l[p];m>d;d++)for(var v=i[d],g=o[d];g>v;v++)e.hasAtom(v)&&(y[b++]=v);return new n.FragmentSeq(e,[n.Fragment.ofArray(e,y[0],y)])}}function f(e,t){return function(r){for(var i=r.structure.atoms,o=i.x,a=i.y,s=i.z,u=i.count,c=[],l=0;u>l;l++)if(r.hasAtom(l)){var h=o[l],f=a[l],p=s[l];h>=e.x&&h<=t.x&&f>=e.y&&f<=t.y&&p>=e.z&&p<=t.z&&(c[c.length]=l)}return c.length?new n.FragmentSeq(r,[new n.Fragment(r,c[0],c)]):n.FragmentSeq.empty(r)}}function p(e,t){var r=B.toQuery(e),i=B.toQuery(t);return function(e){return new n.FragmentSeq(e,r(n.Context.ofFragments(i(e))).fragments)}}function d(e,t,r){for(var i=0,o=0,a=t.atomIndices;o<a.length;o++){var s=a[o];r.has(s)&&i++}if(!i)return void 0;for(var u=new Int32Array(i),c=0,l=0,h=t.atomIndices;l<h.length;l++){var s=h[l];r.has(s)&&(u[c++]=s)}return n.Fragment.ofArray(e,u[0],u)}function m(e,t){var r=B.toQuery(e),i=B.toQuery(t);return function(e){for(var t=r(e),o=n.Context.Mask.ofFragments(i(e)),a=new n.FragmentSeqBuilder(e),s=0,u=t.fragments;s<u.length;s++){var c=u[s],l=d(e,c,o);l&&a.add(l)}return a.getSeq()}}function v(e,t){var r=B.toQuery(e);return function(e){for(var i,o=r(e).fragments,a=new n.FragmentSeqBuilder(e),s=0;s<o.length;s++)i=o[s],t(i)&&a.add(i);return a.getSeq()}}function g(e){var t=B.toQuery(e);return function(e){for(var r=n.Context.Mask.ofFragments(t(e)),i=0,o=0,a=0,s=e.structure.atoms.count;s>a;a++)e.hasAtom(a)&&!r.has(a)&&i++;if(!i)return n.FragmentSeq.empty(e);for(var u=new Int32Array(i),a=0,s=e.structure.atoms.count;s>a;a++)e.hasAtom(a)&&!r.has(a)&&(u[o++]=a);return new n.FragmentSeq(e,[n.Fragment.ofArray(e,u[0],u)])}}function y(e){var t=e.map(function(e){return B.toQuery(e)});return function(e){for(var r=new n.HashFragmentSeqBuilder(e),i=0,o=t;i<o.length;i++)for(var a=o[i],s=a(e),u=0,c=s.fragments;u<c.length;u++){var l=c[u];r.add(l)}return r.getSeq()}}function b(e){var t=B.toQuery(e);return function(e){for(var r,i=t(e).fragments,o=new Set,a=0,s=0;s<i.length;s++)for(r=i[s].atomIndices,a=0;a<r.length;a++)o.add(r[a]);return 0===o.size?n.FragmentSeq.empty(e):new n.FragmentSeq(e,[n.Fragment.ofSet(e,o)])}}function x(e,r){return function(i){var o=i.structure,a=o.atoms.name,s=[],u=0,c=new Set(e);if(r){for(var l=0;l<o.entities.count;l++)if(o.entities.entityType[l]===t.EntityType.Polymer)for(var h=o.entities.atomStartIndex[l],f=o.entities.atomEndIndex[l],p=h;f>p;p++)i.hasAtom(p)&&!c.has(a[p])&&(s[u++]=p)}else for(var l=0;l<o.entities.count;l++)if(o.entities.entityType[l]===t.EntityType.Polymer)for(var h=o.entities.atomStartIndex[l],f=o.entities.atomEndIndex[l],p=h;f>p;p++)i.hasAtom(p)&&c.has(a[p])&&(s[u++]=p);return s.length?new n.FragmentSeq(i,[n.Fragment.ofArray(i,s[0],new Int32Array(s))]):n.FragmentSeq.empty(i)}}function w(t,r){var i=B.toQuery(t);return function(t){for(var o=i(t),a=t.tree,s=e.Geometry.SubdivisionTree3D.createContextRadius(a,r,!1),u=s.buffer,c=new n.HashFragmentSeqBuilder(t),l=t.structure.atoms.x,h=t.structure.atoms.y,f=t.structure.atoms.z,p=t.structure.atoms.residueIndex,d=t.structure.residues.atomStartIndex,m=t.structure.residues.atomEndIndex,v=new Set,g=a.data,y=function(e){v.clear();for(var i=0,o=e.atomIndices;i<o.length;i++){var a=o[i];v.add(p[a]),s.nearest(l[a],h[a],f[a],r);for(var y=0,b=u.count;b>y;y++)v.add(p[g[u.indices[y]]])}var x={count:0,start:d,end:m};v.forEach(function(e){this.count+=this.end[e]-this.start[e]},x);var w=new Int32Array(x.count),_={indices:w,offset:0,start:d,end:m};v.forEach(function(e){for(var t=this.start[e],n=this.end[e];n>t;t++)this.indices[this.offset++]=t},_),Array.prototype.sort.call(w,function(e,t){return e-t}),c.add(n.Fragment.ofArray(t,w[0],w))},b=0,x=o.fragments;b<x.length;b++){var w=x[b];y(w)}return c.getSeq()}}function _(e){var t=B.toQuery(e);return function(e){for(var r=t(e),i=new n.HashFragmentSeqBuilder(e),o=e.structure.atoms.residueIndex,a=e.structure.residues.atomStartIndex,s=e.structure.residues.atomEndIndex,u=new Set,c=function(t){u.clear();for(var r=0,c=t.atomIndices;r<c.length;r++){var l=c[r];u.add(o[l])}var h={count:0,start:a,end:s};u.forEach(function(e){this.count+=this.end[e]-this.start[e]},h);var f=new Int32Array(h.count),p={indices:f,offset:0,start:a,end:s};
u.forEach(function(e){for(var t=this.start[e],n=this.end[e];n>t;t++)this.indices[this.offset++]=t},p),Array.prototype.sort.call(f,function(e,t){return e-t}),i.add(n.Fragment.ofArray(e,f[0],f))},l=0,h=r.fragments;l<h.length;l++){var f=h[l];c(f)}return i.getSeq()}}function C(e,t){var r=B.toQuery(e);return function(e){for(var i=r(e),o=new n.HashFragmentSeqBuilder(e),a=0,s=i.fragments;a<s.length;a++)for(var u=s[a],c=t(u),l=0,h=c.fragments;l<h.length;l++){var f=h[l];o.add(f)}return o.getSeq()}}var E=function(){function e(e,t){this.columns=[];for(var n=0,r=Object.keys(e);n<r.length;n++){var i=r[n];void 0!==e[i]&&t[i]&&this.columns.push({value:e[i],array:t[i]})}}return e.prototype.isSatisfied=function(e){for(var t=0,n=this.columns;t<n.length;t++){var r=n[t];if(r.value!==r.array[e])return!1}return!0},e}();r.compileEverything=i,r.compileAtoms=o,r.compileAtomIndices=a,r.compileFromIndices=s,r.compileAtomRanges=u,r.compileSequence=c,r.compileHetGroups=l,r.compileNonHetPolymer=h,r.compileAtomsInBox=f,r.compileInside=p,r.compileIntersectWith=m,r.compileFilter=v,r.compileComplement=g,r.compileOr=y,r.compileUnion=b,r.compilePolymerNames=x,r.compileAmbientResidues=w,r.compileWholeResidues=_,r.compileFlatten=C}(V=n.Compiler||(n.Compiler={}))}(n=t.Query||(t.Query={}))}(t=e.Structure||(e.Structure={}))}(t=e.Core||(e.Core={}))}(a||(a={}));var a;!function(e){var t;!function(e){var t;!function(e){var t;!function(e){var t;!function(t){function n(e){return function(t){return function(n,r){return e(t(n,r))}}}function r(e){return function(t,n){return function(r,i){return e(t(r,i),n(r,i))}}}function i(e){return function(t,n){return function(r,i){return e(t(r,i),n(r,i))}}}function o(e,t,n){return function(r,i){var o=e(r,i);return o>=t&&n>=o}}function a(e){return function(){return e}}function s(e,t,n){return function(r,i){var o=r.structure;return n(t(o))[e(o.atoms)[i]]}}function u(t){return e.Builder.build(function(){return function(n){for(var r=[],i=0,o=n.structure.atoms.count;o>i;i++)n.hasAtom(i)&&t(n,i)&&(r[r.length]=i);return r.length?new e.FragmentSeq(n,[e.Fragment.ofArray(n,r[0],new Int32Array(r))]):e.FragmentSeq.empty(n)}})}t.not=n(function(e){return!e}),t.and=r(function(e,t){return e&&t}),t.or=r(function(e,t){return e||t});var c=new Set(["N","CA","C","O","P","OP1","OP2","O3'","O5'","C3'","C5'","C4"]);t.backbone=function(e,n){return"polymer"===t.entityType(e,n)&&c.has(t.atomName(e,n))},t.sidechain=function(e,n){return"polymer"===t.entityType(e,n)&&!c.has(t.atomName(e,n))},t.equal=i(function(e,t){return e===t}),t.notEqual=i(function(e,t){return e!==t}),t.greater=i(function(e,t){return e>t}),t.lesser=i(function(e,t){return t>e}),t.greaterEqual=i(function(e,t){return e>=t}),t.lesserEqual=i(function(e,t){return t>=e}),t.inRange=o,t.value=a,t.residueSeqNumber=s(function(e){return e.residueIndex},function(e){return e.residues},function(e){return e.seqNumber}),t.residueName=s(function(e){return e.residueIndex},function(e){return e.residues},function(e){return e.name}),t.elementSymbol=s(function(e){return e.indices},function(e){return e.atoms},function(e){return e.elementSymbol}),t.atomName=s(function(e){return e.indices},function(e){return e.atoms},function(e){return e.name}),t.entityType=s(function(e){return e.entityIndex},function(e){return e.entities},function(e){return e.type}),t.query=u}(t=e.Algebraic||(e.Algebraic={}))}(t=e.Query||(e.Query={}))}(t=e.Structure||(e.Structure={}))}(t=e.Core||(e.Core={}))}(a||(a={}));var a,u=function(){var e={REVISION:"71"};return void 0===Math.sign&&(Math.sign=function(e){return 0>e?-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,n){e.warn("THREE.Projector: .projectVector() is now vector.project()."),t.project(n)},this.unprojectVector=function(t,n){e.warn("THREE.Projector: .unprojectVector() is now vector.unproject()."),t.unproject(n)},this.pickingRay=function(){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){return 3===arguments.length?this.setRGB(arguments[0],arguments[1],arguments[2]):this.set(e)},e.Color.prototype={constructor:e.Color,r:1,g:1,b:1,set:function(t){return t instanceof e.Color?this.copy(t):"number"==typeof t?this.setHex(t):"string"==typeof t&&this.setStyle(t),this},setHex:function(e){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(255&e)/255,this},setRGB:function(e,t,n){return this.r=e,this.g=t,this.b=n,this},setHSL:function(e,t,n){if(0===t)this.r=this.g=this.b=n;else{var r=function(e,t,n){return 0>n&&(n+=1),n>1&&(n-=1),1/6>n?e+6*(t-e)*n:.5>n?t:2/3>n?e+6*(t-e)*(2/3-n):e},i=.5>=n?n*(1+t):n+t-n*t,o=2*n-i;this.r=r(o,i,e+1/3),this.g=r(o,i,e),this.b=r(o,i,e-1/3)}return this},setStyle:function(t){if(/^rgb\((\d+), ?(\d+), ?(\d+)\)$/i.test(t)){var n=/^rgb\((\d+), ?(\d+), ?(\d+)\)$/i.exec(t);return this.r=Math.min(255,parseInt(n[1],10))/255,this.g=Math.min(255,parseInt(n[2],10))/255,this.b=Math.min(255,parseInt(n[3],10))/255,this}if(/^rgb\((\d+)\%, ?(\d+)\%, ?(\d+)\%\)$/i.test(t)){var n=/^rgb\((\d+)\%, ?(\d+)\%, ?(\d+)\%\)$/i.exec(t);return this.r=Math.min(100,parseInt(n[1],10))/100,this.g=Math.min(100,parseInt(n[2],10))/100,this.b=Math.min(100,parseInt(n[3],10))/100,this}if(/^\#([0-9a-f]{6})$/i.test(t)){var n=/^\#([0-9a-f]{6})$/i.exec(t);return this.setHex(parseInt(n[1],16)),this}if(/^\#([0-9a-f])([0-9a-f])([0-9a-f])$/i.test(t)){var n=/^\#([0-9a-f])([0-9a-f])([0-9a-f])$/i.exec(t);return this.setHex(parseInt(n[1]+n[1]+n[2]+n[2]+n[3]+n[3],16)),this}return/^(\w+)$/i.test(t)?(this.setHex(e.ColorKeywords[t]),this):void 0},copy:function(e){return this.r=e.r,this.g=e.g,this.b=e.b,this},copyGammaToLinear:function(e,t){return void 0===t&&(t=2),this.r=Math.pow(e.r,t),this.g=Math.pow(e.g,t),this.b=Math.pow(e.b,t),this},copyLinearToGamma:function(e,t){void 0===t&&(t=2);var n=t>0?1/t:1;return this.r=Math.pow(e.r,n),this.g=Math.pow(e.g,n),this.b=Math.pow(e.b,n),this},convertGammaToLinear:function(){var e=this.r,t=this.g,n=this.b;return this.r=e*e,this.g=t*t,this.b=n*n,this},convertLinearToGamma:function(){return this.r=Math.sqrt(this.r),this.g=Math.sqrt(this.g),this.b=Math.sqrt(this.b),this},getHex:function(){return 255*this.r<<16^255*this.g<<8^255*this.b<<0},getHexString:function(){return("000000"+this.getHex().toString(16)).slice(-6)},getHSL:function(e){var t,n,r=e||{h:0,s:0,l:0},i=this.r,o=this.g,a=this.b,s=Math.max(i,o,a),u=Math.min(i,o,a),c=(u+s)/2;if(u===s)t=0,n=0;else{var l=s-u;switch(n=.5>=c?l/(s+u):l/(2-s-u),s){case i:t=(o-a)/l+(a>o?6:0);break;case o:t=(a-i)/l+2;break;case a:t=(i-o)/l+4}t/=6}return r.h=t,r.s=n,r.l=c,r},getStyle:function(){return"rgb("+(255*this.r|0)+","+(255*this.g|0)+","+(255*this.b|0)+")"},offsetHSL:function(e,t,n){var r=this.getHSL();return r.h+=e,r.s+=t,r.l+=n,this.setHSL(r.h,r.s,r.l),this},add:function(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this},addColors:function(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this},addScalar:function(e){return this.r+=e,this.g+=e,this.b+=e,this},multiply:function(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this},multiplyScalar:function(e){return this.r*=e,this.g*=e,this.b*=e,this},lerp:function(e,t){return this.r+=(e.r-this.r)*t,this.g+=(e.g-this.g)*t,this.b+=(e.b-this.b)*t,this},equals:function(e){return e.r===this.r&&e.g===this.g&&e.b===this.b},fromArray:function(e){return this.r=e[0],this.g=e[1],this.b=e[2],this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e},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,n,r){this._x=e||0,this._y=t||0,this._z=n||0,this._w=void 0!==r?r: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,n,r){return this._x=e,this._y=t,this._z=n,this._w=r,this.onChangeCallback(),this},copy:function(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this.onChangeCallback(),this},setFromEuler:function(t,n){if(t instanceof e.Euler==!1)throw new Error("THREE.Quaternion: .setFromEuler() now expects a Euler rotation rather than a Vector3 and order.");var r=Math.cos(t._x/2),i=Math.cos(t._y/2),o=Math.cos(t._z/2),a=Math.sin(t._x/2),s=Math.sin(t._y/2),u=Math.sin(t._z/2);return"XYZ"===t.order?(this._x=a*i*o+r*s*u,this._y=r*s*o-a*i*u,this._z=r*i*u+a*s*o,this._w=r*i*o-a*s*u):"YXZ"===t.order?(this._x=a*i*o+r*s*u,this._y=r*s*o-a*i*u,this._z=r*i*u-a*s*o,this._w=r*i*o+a*s*u):"ZXY"===t.order?(this._x=a*i*o-r*s*u,this._y=r*s*o+a*i*u,this._z=r*i*u+a*s*o,this._w=r*i*o-a*s*u):"ZYX"===t.order?(this._x=a*i*o-r*s*u,this._y=r*s*o+a*i*u,this._z=r*i*u-a*s*o,this._w=r*i*o+a*s*u):"YZX"===t.order?(this._x=a*i*o+r*s*u,this._y=r*s*o+a*i*u,this._z=r*i*u-a*s*o,this._w=r*i*o-a*s*u):"XZY"===t.order&&(this._x=a*i*o-r*s*u,this._y=r*s*o-a*i*u,this._z=r*i*u+a*s*o,this._w=r*i*o+a*s*u),n!==!1&&this.onChangeCallback(),this},setFromAxisAngle:function(e,t){var n=t/2,r=Math.sin(n);return this._x=e.x*r,this._y=e.y*r,this._z=e.z*r,this._w=Math.cos(n),this.onChangeCallback(),this},setFromRotationMatrix:function(e){var t,n=e.elements,r=n[0],i=n[4],o=n[8],a=n[1],s=n[5],u=n[9],c=n[2],l=n[6],h=n[10],f=r+s+h;return f>0?(t=.5/Math.sqrt(f+1),this._w=.25/t,this._x=(l-u)*t,this._y=(o-c)*t,this._z=(a-i)*t):r>s&&r>h?(t=2*Math.sqrt(1+r-s-h),this._w=(l-u)/t,this._x=.25*t,this._y=(i+a)/t,this._z=(o+c)/t):s>h?(t=2*Math.sqrt(1+s-r-h),this._w=(o-c)/t,this._x=(i+a)/t,this._y=.25*t,this._z=(u+l)/t):(t=2*Math.sqrt(1+h-r-s),this._w=(a-i)/t,this._x=(o+c)/t,this._y=(u+l)/t,this._z=.25*t),this.onChangeCallback(),this},setFromUnitVectors:function(){var t,n,r=1e-6;return function(i,o){return void 0===t&&(t=new e.Vector3),n=i.dot(o)+1,r>n?(n=0,Math.abs(i.x)>Math.abs(i.z)?t.set(-i.y,i.x,0):t.set(0,-i.z,i.y)):t.crossVectors(i,o),this._x=t.x,this._y=t.y,this._z=t.z,this._w=n,this.normalize(),this}}(),inverse:function(){return this.conjugate().normalize(),this},conjugate:function(){return this._x*=-1,this._y*=-1,this._z*=-1,this.onChangeCallback(),this},dot:function(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w},lengthSq:function(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w},length:function(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)},normalize:function(){var e=this.length();return 0===e?(this._x=0,this._y=0,this._z=0,this._w=1):(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(),this},multiply:function(t,n){return void 0!==n?(e.warn("THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead."),this.multiplyQuaternions(t,n)):this.multiplyQuaternions(this,t)},multiplyQuaternions:function(e,t){var n=e._x,r=e._y,i=e._z,o=e._w,a=t._x,s=t._y,u=t._z,c=t._w;return this._x=n*c+o*a+r*u-i*s,this._y=r*c+o*s+i*a-n*u,this._z=i*c+o*u+n*s-r*a,this._w=o*c-n*a-r*s-i*u,this.onChangeCallback(),this},multiplyVector3:function(t){return e.warn("THREE.Quaternion: .multiplyVector3() has been removed. Use is now vector.applyQuaternion( quaternion ) instead."),t.applyQuaternion(this)},slerp:function(e,t){if(0===t)return this;if(1===t)return this.copy(e);var n=this._x,r=this._y,i=this._z,o=this._w,a=o*e._w+n*e._x+r*e._y+i*e._z;if(0>a?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,a=-a):this.copy(e),a>=1)return this._w=o,this._x=n,this._y=r,this._z=i,this;var s=Math.acos(a),u=Math.sqrt(1-a*a);if(Math.abs(u)<.001)return this._w=.5*(o+this._w),this._x=.5*(n+this._x),this._y=.5*(r+this._y),this._z=.5*(i+this._z),this;var c=Math.sin((1-t)*s)/u,l=Math.sin(t*s)/u;return this._w=o*c+this._w*l,this._x=n*c+this._x*l,this._y=r*c+this._y*l,this._z=i*c+this._z*l,this.onChangeCallback(),this},equals:function(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w},fromArray:function(e,t){return void 0===t&&(t=0),this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this.onChangeCallback(),this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e},onChange:function(e){return this.onChangeCallback=e,this},onChangeCallback:function(){},clone:function(){return new e.Quaternion(this._x,this._y,this._z,this._w)}},e.Quaternion.slerp=function(e,t,n,r){return n.copy(e).slerp(t,r)},e.Vector2=function(e,t){this.x=e||0,this.y=t||0},e.Vector2.prototype={constructor:e.Vector2,set:function(e,t){return this.x=e,this.y=t,this},setX:function(e){return this.x=e,this},setY:function(e){return this.y=e,this},setComponent:function(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw 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){return this.x=e.x,this.y=e.y,this},add:function(t,n){return void 0!==n?(e.warn("THREE.Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,n)):(this.x+=t.x,this.y+=t.y,this)},addScalar:function(e){return this.x+=e,this.y+=e,this},addVectors:function(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this},sub:function(t,n){return void 0!==n?(e.warn("THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,n)):(this.x-=t.x,this.y-=t.y,this)},subScalar:function(e){return this.x-=e,this.y-=e,this},subVectors:function(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this},multiply:function(e){return this.x*=e.x,this.y*=e.y,this},multiplyScalar:function(e){return this.x*=e,this.y*=e,this},divide:function(e){return this.x/=e.x,this.y/=e.y,this},divideScalar:function(e){if(0!==e){var t=1/e;this.x*=t,this.y*=t}else this.x=0,this.y=0;return this},min:function(e){return this.x>e.x&&(this.x=e.x),this.y>e.y&&(this.y=e.y),this},max:function(e){return this.x<e.x&&(this.x=e.x),this.y<e.y&&(this.y=e.y),this},clamp:function(e,t){return this.x<e.x?this.x=e.x:this.x>t.x&&(this.x=t.x),this.y<e.y?this.y=e.y:this.y>t.y&&(this.y=t.y),this},clampScalar:function(){var t,n;return function(r,i){return void 0===t&&(t=new e.Vector2,n=new e.Vector2),t.set(r,r),n.set(i,i),this.clamp(t,n)}}(),floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},roundToZero:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this},negate:function(){return this.x=-this.x,this.y=-this.y,this},dot:function(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,n=this.y-e.y;return t*t+n*n},setLength:function(e){var t=this.length();return 0!==t&&e!==t&&this.multiplyScalar(e/t),this},lerp:function(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this},lerpVectors:function(e,t,n){return this.subVectors(t,e).multiplyScalar(n).add(e),this},equals:function(e){return e.x===this.x&&e.y===this.y},fromArray:function(e,t){return void 0===t&&(t=0),this.x=e[t],this.y=e[t+1],this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this.x,e[t+1]=this.y,e},fromAttribute:function(e,t,n){return void 0===n&&(n=0),t=t*e.itemSize+n,this.x=e.array[t],this.y=e.array[t+1],this},clone:function(){return new e.Vector2(this.x,this.y)}},e.Vector3=function(e,t,n){this.x=e||0,this.y=t||0,this.z=n||0},e.Vector3.prototype={constructor:e.Vector3,set:function(e,t,n){return this.x=e,this.y=t,this.z=n,this},setX:function(e){return this.x=e,this},setY:function(e){return this.y=e,this},setZ:function(e){return this.z=e,this},setComponent:function(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw 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){return this.x=e.x,this.y=e.y,this.z=e.z,this},add:function(t,n){return void 0!==n?(e.warn("THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,n)):(this.x+=t.x,this.y+=t.y,this.z+=t.z,this)},addScalar:function(e){return this.x+=e,this.y+=e,this.z+=e,this},addVectors:function(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this},sub:function(t,n){return void 0!==n?(e.warn("THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,n)):(this.x-=t.x,this.y-=t.y,this.z-=t.z,this)},subScalar:function(e){return this.x-=e,this.y-=e,this.z-=e,this},subVectors:function(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this},multiply:function(t,n){return void 0!==n?(e.warn("THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead."),this.multiplyVectors(t,n)):(this.x*=t.x,this.y*=t.y,this.z*=t.z,this)},multiplyScalar:function(e){return this.x*=e,this.y*=e,this.z*=e,this},multiplyVectors:function(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this},applyEuler:function(){var t;return function(n){return n instanceof e.Euler==!1&&e.error("THREE.Vector3: .applyEuler() now expects a Euler rotation rather than a Vector3 and order."),void 0===t&&(t=new e.Quaternion),this.applyQuaternion(t.setFromEuler(n)),this}}(),applyAxisAngle:function(){var t;return function(n,r){return void 0===t&&(t=new e.Quaternion),this.applyQuaternion(t.setFromAxisAngle(n,r)),this}}(),applyMatrix3:function(e){var t=this.x,n=this.y,r=this.z,i=e.elements;return this.x=i[0]*t+i[3]*n+i[6]*r,this.y=i[1]*t+i[4]*n+i[7]*r,this.z=i[2]*t+i[5]*n+i[8]*r,this},applyMatrix4:function(e){var t=this.x,n=this.y,r=this.z,i=e.elements;return this.x=i[0]*t+i[4]*n+i[8]*r+i[12],this.y=i[1]*t+i[5]*n+i[9]*r+i[13],this.z=i[2]*t+i[6]*n+i[10]*r+i[14],this},applyProjection:function(e){var t=this.x,n=this.y,r=this.z,i=e.elements,o=1/(i[3]*t+i[7]*n+i[11]*r+i[15]);return this.x=(i[0]*t+i[4]*n+i[8]*r+i[12])*o,this.y=(i[1]*t+i[5]*n+i[9]*r+i[13])*o,this.z=(i[2]*t+i[6]*n+i[10]*r+i[14])*o,this},applyQuaternion:function(e){var t=this.x,n=this.y,r=this.z,i=e.x,o=e.y,a=e.z,s=e.w,u=s*t+o*r-a*n,c=s*n+a*t-i*r,l=s*r+i*n-o*t,h=-i*t-o*n-a*r;return this.x=u*s+h*-i+c*-a-l*-o,this.y=c*s+h*-o+l*-i-u*-a,this.z=l*s+h*-a+u*-o-c*-i,this},project:function(){var t;return function(n){return void 0===t&&(t=new e.Matrix4),t.multiplyMatrices(n.projectionMatrix,t.getInverse(n.matrixWorld)),this.applyProjection(t)}}(),unproject:function(){var t;return function(n){return void 0===t&&(t=new e.Matrix4),t.multiplyMatrices(n.matrixWorld,t.getInverse(n.projectionMatrix)),this.applyProjection(t)}}(),transformDirection:function(e){var t=this.x,n=this.y,r=this.z,i=e.elements;return this.x=i[0]*t+i[4]*n+i[8]*r,this.y=i[1]*t+i[5]*n+i[9]*r,this.z=i[2]*t+i[6]*n+i[10]*r,this.normalize(),this},divide:function(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this},divideScalar:function(e){if(0!==e){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){return this.x>e.x&&(this.x=e.x),this.y>e.y&&(this.y=e.y),this.z>e.z&&(this.z=e.z),this},max:function(e){return this.x<e.x&&(this.x=e.x),this.y<e.y&&(this.y=e.y),this.z<e.z&&(this.z=e.z),this},clamp:function(e,t){return this.x<e.x?this.x=e.x:this.x>t.x&&(this.x=t.x),this.y<e.y?this.y=e.y:this.y>t.y&&(this.y=t.y),this.z<e.z?this.z=e.z:this.z>t.z&&(this.z=t.z),this},clampScalar:function(){var t,n;return function(r,i){return void 0===t&&(t=new e.Vector3,n=new e.Vector3),t.set(r,r,r),n.set(i,i,i),this.clamp(t,n)}}(),floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this},roundToZero:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this},negate:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this},dot:function(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();return 0!==t&&e!==t&&this.multiplyScalar(e/t),this},lerp:function(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this},lerpVectors:function(e,t,n){return this.subVectors(t,e).multiplyScalar(n).add(e),this},cross:function(t,n){if(void 0!==n)return e.warn("THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead."),this.crossVectors(t,n);var r=this.x,i=this.y,o=this.z;return this.x=i*t.z-o*t.y,this.y=o*t.x-r*t.z,this.z=r*t.y-i*t.x,this},crossVectors:function(e,t){var n=e.x,r=e.y,i=e.z,o=t.x,a=t.y,s=t.z;return this.x=r*s-i*a,this.y=i*o-n*s,this.z=n*a-r*o,this},projectOnVector:function(){var t,n;return function(r){return void 0===t&&(t=new e.Vector3),t.copy(r).normalize(),n=this.dot(t),this.copy(t).multiplyScalar(n)}}(),projectOnPlane:function(){var t;return function(n){return void 0===t&&(t=new e.Vector3),t.copy(this).projectOnVector(n),this.sub(t)}}(),reflect:function(){var t;return function(n){return void 0===t&&(t=new e.Vector3),this.sub(t.copy(n).multiplyScalar(2*this.dot(n)))}}(),angleTo:function(t){var n=this.dot(t)/(this.length()*t.length());return Math.acos(e.Math.clamp(n,-1,1))},distanceTo:function(e){return Math.sqrt(this.distanceToSquared(e))},distanceToSquared:function(e){var t=this.x-e.x,n=this.y-e.y,r=this.z-e.z;return t*t+n*n+r*r},setEulerFromRotationMatrix:function(){e.error("THREE.Vector3: .setEulerFromRotationMatrix() has been removed. Use Euler.setFromRotationMatrix() instead.")},setEulerFromQuaternion:function(){e.error("THREE.Vector3: .setEulerFromQuaternion() has been removed. Use Euler.setFromQuaternion() instead.")},getPositionFromMatrix:function(t){return e.warn("THREE.Vector3: .getPositionFromMatrix() has been renamed to .setFromMatrixPosition()."),this.setFromMatrixPosition(t)},getScaleFromMatrix:function(t){return e.warn("THREE.Vector3: .getScaleFromMatrix() has been renamed to .setFromMatrixScale()."),this.setFromMatrixScale(t)},getColumnFromMatrix:function(t,n){return e.warn("THREE.Vector3: .getColumnFromMatrix() has been renamed to .setFromMatrixColumn()."),this.setFromMatrixColumn(t,n)},setFromMatrixPosition:function(e){return this.x=e.elements[12],this.y=e.elements[13],this.z=e.elements[14],this},setFromMatrixScale:function(e){var t=this.set(e.elements[0],e.elements[1],e.elements[2]).length(),n=this.set(e.elements[4],e.elements[5],e.elements[6]).length(),r=this.set(e.elements[8],e.elements[9],e.elements[10]).length();return this.x=t,this.y=n,this.z=r,this},setFromMatrixColumn:function(e,t){var n=4*e,r=t.elements;return this.x=r[n],this.y=r[n+1],this.z=r[n+2],this},equals:function(e){return e.x===this.x&&e.y===this.y&&e.z===this.z},fromArray:function(e,t){return void 0===t&&(t=0),this.x=e[t],this.y=e[t+1],this.z=e[t+2],this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e},fromAttribute:function(e,t,n){return void 0===n&&(n=0),t=t*e.itemSize+n,this.x=e.array[t],this.y=e.array[t+1],this.z=e.array[t+2],this},clone:function(){return new e.Vector3(this.x,this.y,this.z)}},e.Vector4=function(e,t,n,r){this.x=e||0,this.y=t||0,this.z=n||0,this.w=void 0!==r?r:1},e.Vector4.prototype={constructor:e.Vector4,set:function(e,t,n,r){return this.x=e,this.y=t,this.z=n,this.w=r,this},setX:function(e){return this.x=e,this},setY:function(e){return this.y=e,this},setZ:function(e){return this.z=e,this},setW:function(e){return this.w=e,this},setComponent:function(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw 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){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=void 0!==e.w?e.w:1,this},add:function(t,n){return void 0!==n?(e.warn("THREE.Vector4: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,n)):(this.x+=t.x,this.y+=t.y,this.z+=t.z,this.w+=t.w,this)},addScalar:function(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this},addVectors:function(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this},sub:function(t,n){return void 0!==n?(e.warn("THREE.Vector4: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,n)):(this.x-=t.x,this.y-=t.y,this.z-=t.z,this.w-=t.w,this)},subScalar:function(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this},subVectors:function(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this},multiplyScalar:function(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this},applyMatrix4:function(e){var t=this.x,n=this.y,r=this.z,i=this.w,o=e.elements;return this.x=o[0]*t+o[4]*n+o[8]*r+o[12]*i,this.y=o[1]*t+o[5]*n+o[9]*r+o[13]*i,this.z=o[2]*t+o[6]*n+o[10]*r+o[14]*i,this.w=o[3]*t+o[7]*n+o[11]*r+o[15]*i,this},divideScalar:function(e){if(0!==e){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);return 1e-4>t?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this},setAxisAngleFromRotationMatrix:function(e){var t,n,r,i,o=.01,a=.1,s=e.elements,u=s[0],c=s[4],l=s[8],h=s[1],f=s[5],p=s[9],d=s[2],m=s[6],v=s[10];if(Math.abs(c-h)<o&&Math.abs(l-d)<o&&Math.abs(p-m)<o){if(Math.abs(c+h)<a&&Math.abs(l+d)<a&&Math.abs(p+m)<a&&Math.abs(u+f+v-3)<a)return this.set(1,0,0,0),this;t=Math.PI;var g=(u+1)/2,y=(f+1)/2,b=(v+1)/2,x=(c+h)/4,w=(l+d)/4,_=(p+m)/4;return g>y&&g>b?o>g?(n=0,r=.707106781,i=.707106781):(n=Math.sqrt(g),r=x/n,i=w/n):y>b?o>y?(n=.707106781,r=0,i=.707106781):(r=Math.sqrt(y),n=x/r,i=_/r):o>b?(n=.707106781,r=.707106781,i=0):(i=Math.sqrt(b),n=w/i,r=_/i),this.set(n,r,i,t),this
}var C=Math.sqrt((m-p)*(m-p)+(l-d)*(l-d)+(h-c)*(h-c));return Math.abs(C)<.001&&(C=1),this.x=(m-p)/C,this.y=(l-d)/C,this.z=(h-c)/C,this.w=Math.acos((u+f+v-1)/2),this},min:function(e){return this.x>e.x&&(this.x=e.x),this.y>e.y&&(this.y=e.y),this.z>e.z&&(this.z=e.z),this.w>e.w&&(this.w=e.w),this},max:function(e){return this.x<e.x&&(this.x=e.x),this.y<e.y&&(this.y=e.y),this.z<e.z&&(this.z=e.z),this.w<e.w&&(this.w=e.w),this},clamp:function(e,t){return this.x<e.x?this.x=e.x:this.x>t.x&&(this.x=t.x),this.y<e.y?this.y=e.y:this.y>t.y&&(this.y=t.y),this.z<e.z?this.z=e.z:this.z>t.z&&(this.z=t.z),this.w<e.w?this.w=e.w:this.w>t.w&&(this.w=t.w),this},clampScalar:function(){var t,n;return function(r,i){return void 0===t&&(t=new e.Vector4,n=new e.Vector4),t.set(r,r,r,r),n.set(i,i,i,i),this.clamp(t,n)}}(),floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this},roundToZero:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this.w=this.w<0?Math.ceil(this.w):Math.floor(this.w),this},negate:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this},dot:function(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();return 0!==t&&e!==t&&this.multiplyScalar(e/t),this},lerp:function(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this},lerpVectors:function(e,t,n){return this.subVectors(t,e).multiplyScalar(n).add(e),this},equals:function(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w},fromArray:function(e,t){return void 0===t&&(t=0),this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e},fromAttribute:function(e,t,n){return void 0===n&&(n=0),t=t*e.itemSize+n,this.x=e.array[t],this.y=e.array[t+1],this.z=e.array[t+2],this.w=e.array[t+3],this},clone:function(){return new e.Vector4(this.x,this.y,this.z,this.w)}},e.Euler=function(t,n,r,i){this._x=t||0,this._y=n||0,this._z=r||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,n,r){return this._x=e,this._y=t,this._z=n,this._order=r||this._order,this.onChangeCallback(),this},copy:function(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this.onChangeCallback(),this},setFromRotationMatrix:function(t,n,r){var i=e.Math.clamp,o=t.elements,a=o[0],s=o[4],u=o[8],c=o[1],l=o[5],h=o[9],f=o[2],p=o[6],d=o[10];return n=n||this._order,"XYZ"===n?(this._y=Math.asin(i(u,-1,1)),Math.abs(u)<.99999?(this._x=Math.atan2(-h,d),this._z=Math.atan2(-s,a)):(this._x=Math.atan2(p,l),this._z=0)):"YXZ"===n?(this._x=Math.asin(-i(h,-1,1)),Math.abs(h)<.99999?(this._y=Math.atan2(u,d),this._z=Math.atan2(c,l)):(this._y=Math.atan2(-f,a),this._z=0)):"ZXY"===n?(this._x=Math.asin(i(p,-1,1)),Math.abs(p)<.99999?(this._y=Math.atan2(-f,d),this._z=Math.atan2(-s,l)):(this._y=0,this._z=Math.atan2(c,a))):"ZYX"===n?(this._y=Math.asin(-i(f,-1,1)),Math.abs(f)<.99999?(this._x=Math.atan2(p,d),this._z=Math.atan2(c,a)):(this._x=0,this._z=Math.atan2(-s,l))):"YZX"===n?(this._z=Math.asin(i(c,-1,1)),Math.abs(c)<.99999?(this._x=Math.atan2(-h,l),this._y=Math.atan2(-f,a)):(this._x=0,this._y=Math.atan2(u,d))):"XZY"===n?(this._z=Math.asin(-i(s,-1,1)),Math.abs(s)<.99999?(this._x=Math.atan2(p,l),this._y=Math.atan2(u,a)):(this._x=Math.atan2(-h,d),this._y=0)):e.warn("THREE.Euler: .setFromRotationMatrix() given unsupported order: "+n),this._order=n,r!==!1&&this.onChangeCallback(),this},setFromQuaternion:function(){var t;return function(n,r,i){return void 0===t&&(t=new e.Matrix4),t.makeRotationFromQuaternion(n),this.setFromRotationMatrix(t,r,i),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){return this._x=e[0],this._y=e[1],this._z=e[2],void 0!==e[3]&&(this._order=e[3]),this.onChangeCallback(),this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e},toVector3:function(t){return t?t.set(this._x,this._y,this._z):new e.Vector3(this._x,this._y,this._z)},onChange:function(e){return this.onChangeCallback=e,this},onChangeCallback:function(){},clone:function(){return new e.Euler(this._x,this._y,this._z,this._order)}},e.Line3=function(t,n){this.start=void 0!==t?t:new e.Vector3,this.end=void 0!==n?n:new e.Vector3},e.Line3.prototype={constructor:e.Line3,set:function(e,t){return this.start.copy(e),this.end.copy(t),this},copy:function(e){return this.start.copy(e.start),this.end.copy(e.end),this},center:function(t){var n=t||new e.Vector3;return n.addVectors(this.start,this.end).multiplyScalar(.5)},delta:function(t){var n=t||new e.Vector3;return n.subVectors(this.end,this.start)},distanceSq:function(){return this.start.distanceToSquared(this.end)},distance:function(){return this.start.distanceTo(this.end)},at:function(t,n){var r=n||new e.Vector3;return this.delta(r).multiplyScalar(t).add(this.start)},closestPointToPointParameter:function(){var t=new e.Vector3,n=new e.Vector3;return function(r,i){t.subVectors(r,this.start),n.subVectors(this.end,this.start);var o=n.dot(n),a=n.dot(t),s=a/o;return i&&(s=e.Math.clamp(s,0,1)),s}}(),closestPointToPoint:function(t,n,r){var i=this.closestPointToPointParameter(t,n),o=r||new e.Vector3;return this.delta(o).multiplyScalar(i).add(this.start)},applyMatrix4:function(e){return this.start.applyMatrix4(e),this.end.applyMatrix4(e),this},equals:function(e){return e.start.equals(this.start)&&e.end.equals(this.end)},clone:function(){return(new e.Line3).copy(this)}},e.Box2=function(t,n){this.min=void 0!==t?t:new e.Vector2(1/0,1/0),this.max=void 0!==n?n:new e.Vector2(-1/0,-1/0)},e.Box2.prototype={constructor:e.Box2,set:function(e,t){return this.min.copy(e),this.max.copy(t),this},setFromPoints:function(e){this.makeEmpty();for(var t=0,n=e.length;n>t;t++)this.expandByPoint(e[t]);return this},setFromCenterAndSize:function(){var t=new e.Vector2;return function(e,n){var r=t.copy(n).multiplyScalar(.5);return this.min.copy(e).sub(r),this.max.copy(e).add(r),this}}(),copy:function(e){return this.min.copy(e.min),this.max.copy(e.max),this},makeEmpty:function(){return this.min.x=this.min.y=1/0,this.max.x=this.max.y=-1/0,this},empty:function(){return this.max.x<this.min.x||this.max.y<this.min.y},center:function(t){var n=t||new e.Vector2;return n.addVectors(this.min,this.max).multiplyScalar(.5)},size:function(t){var n=t||new e.Vector2;return n.subVectors(this.max,this.min)},expandByPoint:function(e){return this.min.min(e),this.max.max(e),this},expandByVector:function(e){return this.min.sub(e),this.max.add(e),this},expandByScalar:function(e){return this.min.addScalar(-e),this.max.addScalar(e),this},containsPoint:function(e){return e.x<this.min.x||e.x>this.max.x||e.y<this.min.y||e.y>this.max.y?!1:!0},containsBox:function(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y?!0:!1},getParameter:function(t,n){var r=n||new e.Vector2;return r.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){return e.max.x<this.min.x||e.min.x>this.max.x||e.max.y<this.min.y||e.min.y>this.max.y?!1:!0},clampPoint:function(t,n){var r=n||new e.Vector2;return r.copy(t).clamp(this.min,this.max)},distanceToPoint:function(){var t=new e.Vector2;return function(e){var n=t.copy(e).clamp(this.min,this.max);return n.sub(e).length()}}(),intersect:function(e){return this.min.max(e.min),this.max.min(e.max),this},union:function(e){return this.min.min(e.min),this.max.max(e.max),this},translate:function(e){return this.min.add(e),this.max.add(e),this},equals:function(e){return e.min.equals(this.min)&&e.max.equals(this.max)},clone:function(){return(new e.Box2).copy(this)}},e.Box3=function(t,n){this.min=void 0!==t?t:new e.Vector3(1/0,1/0,1/0),this.max=void 0!==n?n:new e.Vector3(-1/0,-1/0,-1/0)},e.Box3.prototype={constructor:e.Box3,set:function(e,t){return this.min.copy(e),this.max.copy(t),this},setFromPoints:function(e){this.makeEmpty();for(var t=0,n=e.length;n>t;t++)this.expandByPoint(e[t]);return this},setFromCenterAndSize:function(){var t=new e.Vector3;return function(e,n){var r=t.copy(n).multiplyScalar(.5);return this.min.copy(e).sub(r),this.max.copy(e).add(r),this}}(),setFromObject:function(){var t=new e.Vector3;return function(n){var r=this;return n.updateMatrixWorld(!0),this.makeEmpty(),n.traverse(function(n){var i=n.geometry;if(void 0!==i)if(i instanceof e.Geometry)for(var o=i.vertices,a=0,s=o.length;s>a;a++)t.copy(o[a]),t.applyMatrix4(n.matrixWorld),r.expandByPoint(t);else if(i instanceof e.BufferGeometry&&void 0!==i.attributes.position)for(var u=i.attributes.position.array,a=0,s=u.length;s>a;a+=3)t.set(u[a],u[a+1],u[a+2]),t.applyMatrix4(n.matrixWorld),r.expandByPoint(t)}),this}}(),copy:function(e){return this.min.copy(e.min),this.max.copy(e.max),this},makeEmpty:function(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this},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 n=t||new e.Vector3;return n.addVectors(this.min,this.max).multiplyScalar(.5)},size:function(t){var n=t||new e.Vector3;return n.subVectors(this.max,this.min)},expandByPoint:function(e){return this.min.min(e),this.max.max(e),this},expandByVector:function(e){return this.min.sub(e),this.max.add(e),this},expandByScalar:function(e){return this.min.addScalar(-e),this.max.addScalar(e),this},containsPoint:function(e){return e.x<this.min.x||e.x>this.max.x||e.y<this.min.y||e.y>this.max.y||e.z<this.min.z||e.z>this.max.z?!1:!0},containsBox:function(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z?!0:!1},getParameter:function(t,n){var r=n||new e.Vector3;return r.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){return e.max.x<this.min.x||e.min.x>this.max.x||e.max.y<this.min.y||e.min.y>this.max.y||e.max.z<this.min.z||e.min.z>this.max.z?!1:!0},clampPoint:function(t,n){var r=n||new e.Vector3;return r.copy(t).clamp(this.min,this.max)},distanceToPoint:function(){var t=new e.Vector3;return function(e){var n=t.copy(e).clamp(this.min,this.max);return n.sub(e).length()}}(),getBoundingSphere:function(){var t=new e.Vector3;return function(n){var r=n||new e.Sphere;return r.center=this.center(),r.radius=.5*this.size(t).length(),r}}(),intersect:function(e){return this.min.max(e.min),this.max.min(e.max),this},union:function(e){return this.min.min(e.min),this.max.max(e.max),this},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){return 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),this}}(),translate:function(e){return this.min.add(e),this.max.add(e),this},equals:function(e){return e.min.equals(this.min)&&e.max.equals(this.max)},clone:function(){return(new e.Box3).copy(this)}},e.Matrix3=function(){this.elements=new Float32Array([1,0,0,0,1,0,0,0,1]),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,n,r,i,o,a,s,u){var c=this.elements;return c[0]=e,c[3]=t,c[6]=n,c[1]=r,c[4]=i,c[7]=o,c[2]=a,c[5]=s,c[8]=u,this},identity:function(){return this.set(1,0,0,0,1,0,0,0,1),this},copy:function(e){var t=e.elements;return this.set(t[0],t[3],t[6],t[1],t[4],t[7],t[2],t[5],t[8]),this},multiplyVector3:function(t){return e.warn("THREE.Matrix3: .multiplyVector3() has been removed. Use vector.applyMatrix3( matrix ) instead."),t.applyMatrix3(this)},multiplyVector3Array:function(t){return e.warn("THREE.Matrix3: .multiplyVector3Array() has been renamed. Use matrix.applyToVector3Array( array ) instead."),this.applyToVector3Array(t)},applyToVector3Array:function(){var t=new e.Vector3;return function(e,n,r){void 0===n&&(n=0),void 0===r&&(r=e.length);for(var i=0,o=n;r>i;i+=3,o+=3)t.x=e[o],t.y=e[o+1],t.z=e[o+2],t.applyMatrix3(this),e[o]=t.x,e[o+1]=t.y,e[o+2]=t.z;return e}}(),multiplyScalar:function(e){var t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this},determinant:function(){var e=this.elements,t=e[0],n=e[1],r=e[2],i=e[3],o=e[4],a=e[5],s=e[6],u=e[7],c=e[8];return t*o*c-t*a*u-n*i*c+n*a*s+r*i*u-r*o*s},getInverse:function(t,n){var r=t.elements,i=this.elements;i[0]=r[10]*r[5]-r[6]*r[9],i[1]=-r[10]*r[1]+r[2]*r[9],i[2]=r[6]*r[1]-r[2]*r[5],i[3]=-r[10]*r[4]+r[6]*r[8],i[4]=r[10]*r[0]-r[2]*r[8],i[5]=-r[6]*r[0]+r[2]*r[4],i[6]=r[9]*r[4]-r[5]*r[8],i[7]=-r[9]*r[0]+r[1]*r[8],i[8]=r[5]*r[0]-r[1]*r[4];var o=r[0]*i[0]+r[1]*i[3]+r[2]*i[6];if(0===o){var a="Matrix3.getInverse(): can't invert matrix, determinant is 0";if(n)throw new Error(a);return e.warn(a),this.identity(),this}return this.multiplyScalar(1/o),this},transpose:function(){var e,t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this},flattenToArrayOffset:function(e,t){var n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e},getNormalMatrix:function(e){return this.getInverse(e).transpose(),this},transposeIntoArray:function(e){var t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this},fromArray:function(e){return this.elements.set(e),this},toArray:function(){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]),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,n,r,i,o,a,s,u,c,l,h,f,p,d,m){var v=this.elements;return v[0]=e,v[4]=t,v[8]=n,v[12]=r,v[1]=i,v[5]=o,v[9]=a,v[13]=s,v[2]=u,v[6]=c,v[10]=l,v[14]=h,v[3]=f,v[7]=p,v[11]=d,v[15]=m,this},identity:function(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this},copy:function(e){return this.elements.set(e.elements),this},extractPosition:function(t){return e.warn("THREE.Matrix4: .extractPosition() has been renamed to .copyPosition()."),this.copyPosition(t)},copyPosition:function(e){var t=this.elements,n=e.elements;return t[12]=n[12],t[13]=n[13],t[14]=n[14],this},extractBasis:function(e,t,n){var r=this.elements;return e.set(r[0],r[1],r[2]),t.set(r[4],r[5],r[6]),n.set(r[8],r[9],r[10]),this},makeBasis:function(e,t,n){return this.set(e.x,t.x,n.x,0,e.y,t.y,n.y,0,e.z,t.z,n.z,0,0,0,0,1),this},extractRotation:function(){var t=new e.Vector3;return function(e){var n=this.elements,r=e.elements,i=1/t.set(r[0],r[1],r[2]).length(),o=1/t.set(r[4],r[5],r[6]).length(),a=1/t.set(r[8],r[9],r[10]).length();return n[0]=r[0]*i,n[1]=r[1]*i,n[2]=r[2]*i,n[4]=r[4]*o,n[5]=r[5]*o,n[6]=r[6]*o,n[8]=r[8]*a,n[9]=r[9]*a,n[10]=r[10]*a,this}}(),makeRotationFromEuler:function(t){t instanceof e.Euler==!1&&e.error("THREE.Matrix: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.");var n=this.elements,r=t.x,i=t.y,o=t.z,a=Math.cos(r),s=Math.sin(r),u=Math.cos(i),c=Math.sin(i),l=Math.cos(o),h=Math.sin(o);if("XYZ"===t.order){var f=a*l,p=a*h,d=s*l,m=s*h;n[0]=u*l,n[4]=-u*h,n[8]=c,n[1]=p+d*c,n[5]=f-m*c,n[9]=-s*u,n[2]=m-f*c,n[6]=d+p*c,n[10]=a*u}else if("YXZ"===t.order){var v=u*l,g=u*h,y=c*l,b=c*h;n[0]=v+b*s,n[4]=y*s-g,n[8]=a*c,n[1]=a*h,n[5]=a*l,n[9]=-s,n[2]=g*s-y,n[6]=b+v*s,n[10]=a*u}else if("ZXY"===t.order){var v=u*l,g=u*h,y=c*l,b=c*h;n[0]=v-b*s,n[4]=-a*h,n[8]=y+g*s,n[1]=g+y*s,n[5]=a*l,n[9]=b-v*s,n[2]=-a*c,n[6]=s,n[10]=a*u}else if("ZYX"===t.order){var f=a*l,p=a*h,d=s*l,m=s*h;n[0]=u*l,n[4]=d*c-p,n[8]=f*c+m,n[1]=u*h,n[5]=m*c+f,n[9]=p*c-d,n[2]=-c,n[6]=s*u,n[10]=a*u}else if("YZX"===t.order){var x=a*u,w=a*c,_=s*u,C=s*c;n[0]=u*l,n[4]=C-x*h,n[8]=_*h+w,n[1]=h,n[5]=a*l,n[9]=-s*l,n[2]=-c*l,n[6]=w*h+_,n[10]=x-C*h}else if("XZY"===t.order){var x=a*u,w=a*c,_=s*u,C=s*c;n[0]=u*l,n[4]=-h,n[8]=c*l,n[1]=x*h+C,n[5]=a*l,n[9]=w*h-_,n[2]=_*h-w,n[6]=s*l,n[10]=C*h+x}return n[3]=0,n[7]=0,n[11]=0,n[12]=0,n[13]=0,n[14]=0,n[15]=1,this},setRotationFromQuaternion:function(t){return e.warn("THREE.Matrix4: .setRotationFromQuaternion() has been renamed to .makeRotationFromQuaternion()."),this.makeRotationFromQuaternion(t)},makeRotationFromQuaternion:function(e){var t=this.elements,n=e.x,r=e.y,i=e.z,o=e.w,a=n+n,s=r+r,u=i+i,c=n*a,l=n*s,h=n*u,f=r*s,p=r*u,d=i*u,m=o*a,v=o*s,g=o*u;return t[0]=1-(f+d),t[4]=l-g,t[8]=h+v,t[1]=l+g,t[5]=1-(c+d),t[9]=p-m,t[2]=h-v,t[6]=p+m,t[10]=1-(c+f),t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this},lookAt:function(){var t=new e.Vector3,n=new e.Vector3,r=new e.Vector3;return function(e,i,o){var a=this.elements;return r.subVectors(e,i).normalize(),0===r.length()&&(r.z=1),t.crossVectors(o,r).normalize(),0===t.length()&&(r.x+=1e-4,t.crossVectors(o,r).normalize()),n.crossVectors(r,t),a[0]=t.x,a[4]=n.x,a[8]=r.x,a[1]=t.y,a[5]=n.y,a[9]=r.y,a[2]=t.z,a[6]=n.z,a[10]=r.z,this}}(),multiply:function(t,n){return void 0!==n?(e.warn("THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead."),this.multiplyMatrices(t,n)):this.multiplyMatrices(this,t)},multiplyMatrices:function(e,t){var n=e.elements,r=t.elements,i=this.elements,o=n[0],a=n[4],s=n[8],u=n[12],c=n[1],l=n[5],h=n[9],f=n[13],p=n[2],d=n[6],m=n[10],v=n[14],g=n[3],y=n[7],b=n[11],x=n[15],w=r[0],_=r[4],C=r[8],E=r[12],S=r[1],M=r[5],T=r[9],A=r[13],P=r[2],k=r[6],R=r[10],I=r[14],D=r[3],B=r[7],V=r[11],L=r[15];return i[0]=o*w+a*S+s*P+u*D,i[4]=o*_+a*M+s*k+u*B,i[8]=o*C+a*T+s*R+u*V,i[12]=o*E+a*A+s*I+u*L,i[1]=c*w+l*S+h*P+f*D,i[5]=c*_+l*M+h*k+f*B,i[9]=c*C+l*T+h*R+f*V,i[13]=c*E+l*A+h*I+f*L,i[2]=p*w+d*S+m*P+v*D,i[6]=p*_+d*M+m*k+v*B,i[10]=p*C+d*T+m*R+v*V,i[14]=p*E+d*A+m*I+v*L,i[3]=g*w+y*S+b*P+x*D,i[7]=g*_+y*M+b*k+x*B,i[11]=g*C+y*T+b*R+x*V,i[15]=g*E+y*A+b*I+x*L,this},multiplyToArray:function(e,t,n){var r=this.elements;return this.multiplyMatrices(e,t),n[0]=r[0],n[1]=r[1],n[2]=r[2],n[3]=r[3],n[4]=r[4],n[5]=r[5],n[6]=r[6],n[7]=r[7],n[8]=r[8],n[9]=r[9],n[10]=r[10],n[11]=r[11],n[12]=r[12],n[13]=r[13],n[14]=r[14],n[15]=r[15],this},multiplyScalar:function(e){var t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this},multiplyVector3:function(t){return e.warn("THREE.Matrix4: .multiplyVector3() has been removed. Use vector.applyMatrix4( matrix ) or vector.applyProjection( matrix ) instead."),t.applyProjection(this)},multiplyVector4:function(t){return e.warn("THREE.Matrix4: .multiplyVector4() has been removed. Use vector.applyMatrix4( matrix ) instead."),t.applyMatrix4(this)},multiplyVector3Array:function(t){return e.warn("THREE.Matrix4: .multiplyVector3Array() has been renamed. Use matrix.applyToVector3Array( array ) instead."),this.applyToVector3Array(t)},applyToVector3Array:function(){var t=new e.Vector3;return function(e,n,r){void 0===n&&(n=0),void 0===r&&(r=e.length);for(var i=0,o=n;r>i;i+=3,o+=3)t.x=e[o],t.y=e[o+1],t.z=e[o+2],t.applyMatrix4(this),e[o]=t.x,e[o+1]=t.y,e[o+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){return e.warn("THREE.Matrix4: .crossVector() has been removed. Use vector.applyMatrix4( matrix ) instead."),t.applyMatrix4(this)},determinant:function(){var e=this.elements,t=e[0],n=e[4],r=e[8],i=e[12],o=e[1],a=e[5],s=e[9],u=e[13],c=e[2],l=e[6],h=e[10],f=e[14],p=e[3],d=e[7],m=e[11],v=e[15];return p*(+i*s*l-r*u*l-i*a*h+n*u*h+r*a*f-n*s*f)+d*(+t*s*f-t*u*h+i*o*h-r*o*f+r*u*c-i*s*c)+m*(+t*u*l-t*a*f-i*o*l+n*o*f+i*a*c-n*u*c)+v*(-r*a*c-t*s*l+t*a*h+r*o*l-n*o*h+n*s*c)},transpose:function(){var e,t=this.elements;return e=t[1],t[1]=t[4],t[4]=e,e=t[2],t[2]=t[8],t[8]=e,e=t[6],t[6]=t[9],t[9]=e,e=t[3],t[3]=t[12],t[12]=e,e=t[7],t[7]=t[13],t[13]=e,e=t[11],t[11]=t[14],t[14]=e,this},flattenToArrayOffset:function(e,t){var n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e[t+9]=n[9],e[t+10]=n[10],e[t+11]=n[11],e[t+12]=n[12],e[t+13]=n[13],e[t+14]=n[14],e[t+15]=n[15],e},getPosition:function(){var t=new e.Vector3;return function(){e.warn("THREE.Matrix4: .getPosition() has been removed. Use Vector3.setFromMatrixPosition( matrix ) instead.");var n=this.elements;return t.set(n[12],n[13],n[14])}}(),setPosition:function(e){var t=this.elements;return t[12]=e.x,t[13]=e.y,t[14]=e.z,this},getInverse:function(t,n){var r=this.elements,i=t.elements,o=i[0],a=i[4],s=i[8],u=i[12],c=i[1],l=i[5],h=i[9],f=i[13],p=i[2],d=i[6],m=i[10],v=i[14],g=i[3],y=i[7],b=i[11],x=i[15];r[0]=h*v*y-f*m*y+f*d*b-l*v*b-h*d*x+l*m*x,r[4]=u*m*y-s*v*y-u*d*b+a*v*b+s*d*x-a*m*x,r[8]=s*f*y-u*h*y+u*l*b-a*f*b-s*l*x+a*h*x,r[12]=u*h*d-s*f*d-u*l*m+a*f*m+s*l*v-a*h*v,r[1]=f*m*g-h*v*g-f*p*b+c*v*b+h*p*x-c*m*x,r[5]=s*v*g-u*m*g+u*p*b-o*v*b-s*p*x+o*m*x,r[9]=u*h*g-s*f*g-u*c*b+o*f*b+s*c*x-o*h*x,r[13]=s*f*p-u*h*p+u*c*m-o*f*m-s*c*v+o*h*v,r[2]=l*v*g-f*d*g+f*p*y-c*v*y-l*p*x+c*d*x,r[6]=u*d*g-a*v*g-u*p*y+o*v*y+a*p*x-o*d*x,r[10]=a*f*g-u*l*g+u*c*y-o*f*y-a*c*x+o*l*x,r[14]=u*l*p-a*f*p-u*c*d+o*f*d+a*c*v-o*l*v,r[3]=h*d*g-l*m*g-h*p*y+c*m*y+l*p*b-c*d*b,r[7]=a*m*g-s*d*g+s*p*y-o*m*y-a*p*b+o*d*b,r[11]=s*l*g-a*h*g-s*c*y+o*h*y+a*c*b-o*l*b,r[15]=a*h*p-s*l*p+s*c*d-o*h*d-a*c*m+o*l*m;var w=o*r[0]+c*r[4]+p*r[8]+g*r[12];if(0==w){var _="THREE.Matrix4.getInverse(): can't invert matrix, determinant is 0";if(n)throw new Error(_);return e.warn(_),this.identity(),this}return this.multiplyScalar(1/w),this},translate:function(){e.error("THREE.Matrix4: .translate() has been removed.")},rotateX:function(){e.error("THREE.Matrix4: .rotateX() has been removed.")},rotateY:function(){e.error("THREE.Matrix4: .rotateY() has been removed.")},rotateZ:function(){e.error("THREE.Matrix4: .rotateZ() has been removed.")},rotateByAxis:function(){e.error("THREE.Matrix4: .rotateByAxis() has been removed.")},scale:function(e){var t=this.elements,n=e.x,r=e.y,i=e.z;return t[0]*=n,t[4]*=r,t[8]*=i,t[1]*=n,t[5]*=r,t[9]*=i,t[2]*=n,t[6]*=r,t[10]*=i,t[3]*=n,t[7]*=r,t[11]*=i,this},getMaxScaleOnAxis:function(){var e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],n=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],r=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,Math.max(n,r)))},makeTranslation:function(e,t,n){return this.set(1,0,0,e,0,1,0,t,0,0,1,n,0,0,0,1),this},makeRotationX:function(e){var t=Math.cos(e),n=Math.sin(e);return this.set(1,0,0,0,0,t,-n,0,0,n,t,0,0,0,0,1),this},makeRotationY:function(e){var t=Math.cos(e),n=Math.sin(e);return this.set(t,0,n,0,0,1,0,0,-n,0,t,0,0,0,0,1),this},makeRotationZ:function(e){var t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,0,n,t,0,0,0,0,1,0,0,0,0,1),this},makeRotationAxis:function(e,t){var n=Math.cos(t),r=Math.sin(t),i=1-n,o=e.x,a=e.y,s=e.z,u=i*o,c=i*a;return this.set(u*o+n,u*a-r*s,u*s+r*a,0,u*a+r*s,c*a+n,c*s-r*o,0,u*s-r*a,c*s+r*o,i*s*s+n,0,0,0,0,1),this},makeScale:function(e,t,n){return this.set(e,0,0,0,0,t,0,0,0,0,n,0,0,0,0,1),this},compose:function(e,t,n){return this.makeRotationFromQuaternion(t),this.scale(n),this.setPosition(e),this},decompose:function(){var t=new e.Vector3,n=new e.Matrix4;return function(e,r,i){var o=this.elements,a=t.set(o[0],o[1],o[2]).length(),s=t.set(o[4],o[5],o[6]).length(),u=t.set(o[8],o[9],o[10]).length(),c=this.determinant();0>c&&(a=-a),e.x=o[12],e.y=o[13],e.z=o[14],n.elements.set(this.elements);var l=1/a,h=1/s,f=1/u;return n.elements[0]*=l,n.elements[1]*=l,n.elements[2]*=l,n.elements[4]*=h,n.elements[5]*=h,n.elements[6]*=h,n.elements[8]*=f,n.elements[9]*=f,n.elements[10]*=f,r.setFromRotationMatrix(n),i.x=a,i.y=s,i.z=u,this}}(),makeFrustum:function(e,t,n,r,i,o){var a=this.elements,s=2*i/(t-e),u=2*i/(r-n),c=(t+e)/(t-e),l=(r+n)/(r-n),h=-(o+i)/(o-i),f=-2*o*i/(o-i);return a[0]=s,a[4]=0,a[8]=c,a[12]=0,a[1]=0,a[5]=u,a[9]=l,a[13]=0,a[2]=0,a[6]=0,a[10]=h,a[14]=f,a[3]=0,a[7]=0,a[11]=-1,a[15]=0,this},makePerspective:function(t,n,r,i){var o=r*Math.tan(e.Math.degToRad(.5*t)),a=-o,s=a*n,u=o*n;return this.makeFrustum(s,u,a,o,r,i)},makeOrthographic:function(e,t,n,r,i,o){var a=this.elements,s=t-e,u=n-r,c=o-i,l=(t+e)/s,h=(n+r)/u,f=(o+i)/c;return a[0]=2/s,a[4]=0,a[8]=0,a[12]=-l,a[1]=0,a[5]=2/u,a[9]=0,a[13]=-h,a[2]=0,a[6]=0,a[10]=-2/c,a[14]=-f,a[3]=0,a[7]=0,a[11]=0,a[15]=1,this},fromArray:function(e){return this.elements.set(e),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,n){this.origin=void 0!==t?t:new e.Vector3,this.direction=void 0!==n?n:new e.Vector3},e.Ray.prototype={constructor:e.Ray,set:function(e,t){return this.origin.copy(e),this.direction.copy(t),this},copy:function(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this},at:function(t,n){var r=n||new e.Vector3;return r.copy(this.direction).multiplyScalar(t).add(this.origin)},recast:function(){var t=new e.Vector3;return function(e){return this.origin.copy(this.at(e,t)),this}}(),closestPointToPoint:function(t,n){var r=n||new e.Vector3;r.subVectors(t,this.origin);var i=r.dot(this.direction);return 0>i?r.copy(this.origin):r.copy(this.direction).multiplyScalar(i).add(this.origin)},distanceToPoint:function(){var t=new e.Vector3;return function(e){var n=t.subVectors(e,this.origin).dot(this.direction);return 0>n?this.origin.distanceTo(e):(t.copy(this.direction).multiplyScalar(n).add(this.origin),t.distanceTo(e))}}(),distanceSqToSegment:function(){var t=new e.Vector3,n=new e.Vector3,r=new e.Vector3;return function(e,i,o,a){t.copy(e).add(i).multiplyScalar(.5),n.copy(i).sub(e).normalize(),r.copy(this.origin).sub(t);var s,u,c,l,h=.5*e.distanceTo(i),f=-this.direction.dot(n),p=r.dot(this.direction),d=-r.dot(n),m=r.lengthSq(),v=Math.abs(1-f*f);if(v>0)if(s=f*d-p,u=f*p-d,l=h*v,s>=0)if(u>=-l)if(l>=u){var g=1/v;s*=g,u*=g,c=s*(s+f*u+2*p)+u*(f*s+u+2*d)+m}else u=h,s=Math.max(0,-(f*u+p)),c=-s*s+u*(u+2*d)+m;else u=-h,s=Math.max(0,-(f*u+p)),c=-s*s+u*(u+2*d)+m;else-l>=u?(s=Math.max(0,-(-f*h+p)),u=s>0?-h:Math.min(Math.max(-h,-d),h),c=-s*s+u*(u+2*d)+m):l>=u?(s=0,u=Math.min(Math.max(-h,-d),h),c=u*(u+2*d)+m):(s=Math.max(0,-(f*h+p)),u=s>0?h:Math.min(Math.max(-h,-d),h),c=-s*s+u*(u+2*d)+m);else u=f>0?-h:h,s=Math.max(0,-(f*u+p)),c=-s*s+u*(u+2*d)+m;return o&&o.copy(this.direction).multiplyScalar(s).add(this.origin),a&&a.copy(n).multiplyScalar(u).add(t),c}}(),isIntersectionSphere:function(e){return this.distanceToPoint(e.center)<=e.radius},intersectSphere:function(){var t=new e.Vector3;return function(e,n){t.subVectors(e.center,this.origin);var r=t.dot(this.direction),i=t.dot(t)-r*r,o=e.radius*e.radius;if(i>o)return null;var a=Math.sqrt(o-i),s=r-a,u=r+a;return 0>s&&0>u?null:0>s?this.at(u,n):this.at(s,n)}}(),isIntersectionPlane:function(e){var t=e.distanceToPoint(this.origin);if(0===t)return!0;var n=e.normal.dot(this.direction);return 0>n*t?!0:!1},distanceToPlane:function(e){var t=e.normal.dot(this.direction);if(0==t)return 0==e.distanceToPoint(this.origin)?0:null;var n=-(this.origin.dot(e.normal)+e.constant)/t;return n>=0?n:null},intersectPlane:function(e,t){var n=this.distanceToPlane(e);return null===n?null:this.at(n,t)},isIntersectionBox:function(){var t=new e.Vector3;return function(e){return null!==this.intersectBox(e,t)}}(),intersectBox:function(e,t){var n,r,i,o,a,s,u=1/this.direction.x,c=1/this.direction.y,l=1/this.direction.z,h=this.origin;return u>=0?(n=(e.min.x-h.x)*u,r=(e.max.x-h.x)*u):(n=(e.max.x-h.x)*u,r=(e.min.x-h.x)*u),c>=0?(i=(e.min.y-h.y)*c,o=(e.max.y-h.y)*c):(i=(e.max.y-h.y)*c,o=(e.min.y-h.y)*c),n>o||i>r?null:((i>n||n!==n)&&(n=i),(r>o||r!==r)&&(r=o),l>=0?(a=(e.min.z-h.z)*l,s=(e.max.z-h.z)*l):(a=(e.max.z-h.z)*l,s=(e.min.z-h.z)*l),n>s||a>r?null:((a>n||n!==n)&&(n=a),(r>s||r!==r)&&(r=s),0>r?null:this.at(n>=0?n:r,t)))},intersectTriangle:function(){var t=new e.Vector3,n=new e.Vector3,r=new e.Vector3,i=new e.Vector3;return function(e,o,a,s,u){n.subVectors(o,e),r.subVectors(a,e),i.crossVectors(n,r);var c,l=this.direction.dot(i);if(l>0){if(s)return null;c=1}else{if(!(0>l))return null;c=-1,l=-l}t.subVectors(this.origin,e);var h=c*this.direction.dot(r.crossVectors(t,r));if(0>h)return null;var f=c*this.direction.dot(n.cross(t));if(0>f)return null;if(h+f>l)return null;var p=-c*t.dot(i);return 0>p?null:this.at(p/l,u)}}(),applyMatrix4:function(e){return this.direction.add(this.origin).applyMatrix4(e),this.origin.applyMatrix4(e),this.direction.sub(this.origin),this.direction.normalize(),this},equals:function(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)},clone:function(){return(new e.Ray).copy(this)}},e.Sphere=function(t,n){this.center=void 0!==t?t:new e.Vector3,this.radius=void 0!==n?n:0},e.Sphere.prototype={constructor:e.Sphere,set:function(e,t){return this.center.copy(e),this.radius=t,this},setFromPoints:function(){var t=new e.Box3;return function(e,n){var r=this.center;void 0!==n?r.copy(n):t.setFromPoints(e).center(r);for(var i=0,o=0,a=e.length;a>o;o++)i=Math.max(i,r.distanceToSquared(e[o]));return this.radius=Math.sqrt(i),this}}(),copy:function(e){return this.center.copy(e.center),this.radius=e.radius,this},empty:function(){return this.radius<=0},containsPoint:function(e){return e.distanceToSquared(this.center)<=this.radius*this.radius},distanceToPoint:function(e){return e.distanceTo(this.center)-this.radius},intersectsSphere:function(e){var t=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=t*t},clampPoint:function(t,n){var r=this.center.distanceToSquared(t),i=n||new e.Vector3;return i.copy(t),r>this.radius*this.radius&&(i.sub(this.center).normalize(),i.multiplyScalar(this.radius).add(this.center)),i},getBoundingBox:function(t){var n=t||new e.Box3;return n.set(this.center,this.center),n.expandByScalar(this.radius),n},applyMatrix4:function(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this
},translate:function(e){return this.center.add(e),this},equals:function(e){return e.center.equals(this.center)&&e.radius===this.radius},clone:function(){return(new e.Sphere).copy(this)}},e.Frustum=function(t,n,r,i,o,a){this.planes=[void 0!==t?t:new e.Plane,void 0!==n?n:new e.Plane,void 0!==r?r:new e.Plane,void 0!==i?i:new e.Plane,void 0!==o?o:new e.Plane,void 0!==a?a:new e.Plane]},e.Frustum.prototype={constructor:e.Frustum,set:function(e,t,n,r,i,o){var a=this.planes;return a[0].copy(e),a[1].copy(t),a[2].copy(n),a[3].copy(r),a[4].copy(i),a[5].copy(o),this},copy:function(e){for(var t=this.planes,n=0;6>n;n++)t[n].copy(e.planes[n]);return this},setFromMatrix:function(e){var t=this.planes,n=e.elements,r=n[0],i=n[1],o=n[2],a=n[3],s=n[4],u=n[5],c=n[6],l=n[7],h=n[8],f=n[9],p=n[10],d=n[11],m=n[12],v=n[13],g=n[14],y=n[15];return t[0].setComponents(a-r,l-s,d-h,y-m).normalize(),t[1].setComponents(a+r,l+s,d+h,y+m).normalize(),t[2].setComponents(a+i,l+u,d+f,y+v).normalize(),t[3].setComponents(a-i,l-u,d-f,y-v).normalize(),t[4].setComponents(a-o,l-c,d-p,y-g).normalize(),t[5].setComponents(a+o,l+c,d+p,y+g).normalize(),this},intersectsObject:function(){var t=new e.Sphere;return function(e){var n=e.geometry;return null===n.boundingSphere&&n.computeBoundingSphere(),t.copy(n.boundingSphere),t.applyMatrix4(e.matrixWorld),this.intersectsSphere(t)}}(),intersectsSphere:function(e){for(var t=this.planes,n=e.center,r=-e.radius,i=0;6>i;i++){var o=t[i].distanceToPoint(n);if(r>o)return!1}return!0},intersectsBox:function(){var t=new e.Vector3,n=new e.Vector3;return function(e){for(var r=this.planes,i=0;6>i;i++){var o=r[i];t.x=o.normal.x>0?e.min.x:e.max.x,n.x=o.normal.x>0?e.max.x:e.min.x,t.y=o.normal.y>0?e.min.y:e.max.y,n.y=o.normal.y>0?e.max.y:e.min.y,t.z=o.normal.z>0?e.min.z:e.max.z,n.z=o.normal.z>0?e.max.z:e.min.z;var a=o.distanceToPoint(t),s=o.distanceToPoint(n);if(0>a&&0>s)return!1}return!0}}(),containsPoint:function(e){for(var t=this.planes,n=0;6>n;n++)if(t[n].distanceToPoint(e)<0)return!1;return!0},clone:function(){return(new e.Frustum).copy(this)}},e.Plane=function(t,n){this.normal=void 0!==t?t:new e.Vector3(1,0,0),this.constant=void 0!==n?n:0},e.Plane.prototype={constructor:e.Plane,set:function(e,t){return this.normal.copy(e),this.constant=t,this},setComponents:function(e,t,n,r){return this.normal.set(e,t,n),this.constant=r,this},setFromNormalAndCoplanarPoint:function(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this},setFromCoplanarPoints:function(){var t=new e.Vector3,n=new e.Vector3;return function(e,r,i){var o=t.subVectors(i,r).cross(n.subVectors(e,r)).normalize();return this.setFromNormalAndCoplanarPoint(o,e),this}}(),copy:function(e){return this.normal.copy(e.normal),this.constant=e.constant,this},normalize:function(){var e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this},negate:function(){return this.constant*=-1,this.normal.negate(),this},distanceToPoint:function(e){return this.normal.dot(e)+this.constant},distanceToSphere:function(e){return this.distanceToPoint(e.center)-e.radius},projectPoint:function(e,t){return this.orthoPoint(e,t).sub(e).negate()},orthoPoint:function(t,n){var r=this.distanceToPoint(t),i=n||new e.Vector3;return i.copy(this.normal).multiplyScalar(r)},isIntersectionLine:function(e){var t=this.distanceToPoint(e.start),n=this.distanceToPoint(e.end);return 0>t&&n>0||0>n&&t>0},intersectLine:function(){var t=new e.Vector3;return function(n,r){var i=r||new e.Vector3,o=n.delta(t),a=this.normal.dot(o);if(0==a)return 0==this.distanceToPoint(n.start)?i.copy(n.start):void 0;var s=-(n.start.dot(this.normal)+this.constant)/a;return 0>s||s>1?void 0:i.copy(o).multiplyScalar(s).add(n.start)}}(),coplanarPoint:function(t){var n=t||new e.Vector3;return n.copy(this.normal).multiplyScalar(-this.constant)},applyMatrix4:function(){var t=new e.Vector3,n=new e.Vector3,r=new e.Matrix3;return function(e,i){var o=i||r.getNormalMatrix(e),a=t.copy(this.normal).applyMatrix3(o),s=this.coplanarPoint(n);return s.applyMatrix4(e),this.setFromNormalAndCoplanarPoint(a,s),this}}(),translate:function(e){return this.constant=this.constant-e.dot(this.normal),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,t="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""),n=new Array(36),r=0;return function(){for(var i=0;36>i;i++)8==i||13==i||18==i||23==i?n[i]="-":14==i?n[i]="4":(2>=r&&(r=33554432+16777216*Math.random()|0),e=15&r,r>>=4,n[i]=t[19==i?3&e|8:e]);return n.join("")}}(),clamp:function(e,t,n){return t>e?t:e>n?n:e},clampBottom:function(e,t){return t>e?t:e},mapLinear:function(e,t,n,r,i){return r+(e-t)*(i-r)/(n-t)},smoothstep:function(e,t,n){return t>=e?0:e>=n?1:(e=(e-t)/(n-t),e*e*(3-2*e))},smootherstep:function(e,t,n){return t>=e?0:e>=n?1:(e=(e-t)/(n-t),e*e*e*(e*(6*e-15)+10))},random16:function(){return(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 0===(e&e-1)&&0!==e},nextPowerOfTwo:function(e){return e--,e|=e>>1,e|=e>>2,e|=e>>4,e|=e>>8,e|=e>>16,e++,e}},e.Spline=function(t){function n(e,t,n,r,i,o,a){var s=.5*(n-e),u=.5*(r-t);return(2*(t-n)+s+u)*a+(-3*(t-n)-2*s-u)*o+s*i+t}this.points=t;var r,i,o,a,s,u,c,l,h,f=[],p={x:0,y:0,z:0};this.initFromArray=function(e){this.points=[];for(var t=0;t<e.length;t++)this.points[t]={x:e[t][0],y:e[t][1],z:e[t][2]}},this.getPoint=function(e){return r=(this.points.length-1)*e,i=Math.floor(r),o=r-i,f[0]=0===i?i:i-1,f[1]=i,f[2]=i>this.points.length-2?this.points.length-1:i+1,f[3]=i>this.points.length-3?this.points.length-1:i+2,u=this.points[f[0]],c=this.points[f[1]],l=this.points[f[2]],h=this.points[f[3]],a=o*o,s=o*a,p.x=n(u.x,c.x,l.x,h.x,o,a,s),p.y=n(u.y,c.y,l.y,h.y,o,a,s),p.z=n(u.z,c.z,l.z,h.z,o,a,s),p},this.getControlPointsArray=function(){var e,t,n=this.points.length,r=[];for(e=0;n>e;e++)t=this.points[e],r[e]=[t.x,t.y,t.z];return r},this.getLength=function(t){var n,r,i,o,a=0,s=0,u=0,c=new e.Vector3,l=new e.Vector3,h=[],f=0;for(h[0]=0,t||(t=100),i=this.points.length*t,c.copy(this.points[0]),n=1;i>n;n++)r=n/i,o=this.getPoint(r),l.copy(o),f+=l.distanceTo(c),c.copy(o),a=(this.points.length-1)*r,s=Math.floor(a),s!=u&&(h[s]=f,u=s);return h[h.length]=f,{chunks:h,total:f}},this.reparametrizeByArcLength=function(t){var n,r,i,o,a,s,u,c,l=[],h=new e.Vector3,f=this.getLength();for(l.push(h.copy(this.points[0]).clone()),n=1;n<this.points.length;n++){for(s=f.chunks[n]-f.chunks[n-1],u=Math.ceil(t*s/f.total),o=(n-1)/(this.points.length-1),a=n/(this.points.length-1),r=1;u-1>r;r++)i=o+r*(1/u)*(a-o),c=this.getPoint(i),l.push(h.copy(c).clone());l.push(h.copy(this.points[n]).clone())}this.points=l}},e.Triangle=function(t,n,r){this.a=void 0!==t?t:new e.Vector3,this.b=void 0!==n?n:new e.Vector3,this.c=void 0!==r?r:new e.Vector3},e.Triangle.normal=function(){var t=new e.Vector3;return function(n,r,i,o){var a=o||new e.Vector3;a.subVectors(i,r),t.subVectors(n,r),a.cross(t);var s=a.lengthSq();return s>0?a.multiplyScalar(1/Math.sqrt(s)):a.set(0,0,0)}}(),e.Triangle.barycoordFromPoint=function(){var t=new e.Vector3,n=new e.Vector3,r=new e.Vector3;return function(i,o,a,s,u){t.subVectors(s,o),n.subVectors(a,o),r.subVectors(i,o);var c=t.dot(t),l=t.dot(n),h=t.dot(r),f=n.dot(n),p=n.dot(r),d=c*f-l*l,m=u||new e.Vector3;if(0==d)return m.set(-2,-1,-1);var v=1/d,g=(f*h-l*p)*v,y=(c*p-l*h)*v;return m.set(1-g-y,y,g)}}(),e.Triangle.containsPoint=function(){var t=new e.Vector3;return function(n,r,i,o){var a=e.Triangle.barycoordFromPoint(n,r,i,o,t);return a.x>=0&&a.y>=0&&a.x+a.y<=1}}(),e.Triangle.prototype={constructor:e.Triangle,set:function(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this},setFromPointsAndIndices:function(e,t,n,r){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[r]),this},copy:function(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this},area:function(){var t=new e.Vector3,n=new e.Vector3;return function(){return t.subVectors(this.c,this.b),n.subVectors(this.a,this.b),.5*t.cross(n).length()}}(),midpoint:function(t){var n=t||new e.Vector3;return n.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 n=t||new e.Plane;return n.setFromCoplanarPoints(this.a,this.b,this.c)},barycoordFromPoint:function(t,n){return e.Triangle.barycoordFromPoint(t,this.a,this.b,this.c,n)},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=void 0!==e?e:!0,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1},e.Clock.prototype={constructor:e.Clock,start:function(){this.startTime=void 0!==self.performance&&void 0!==self.performance.now?self.performance.now():Date.now(),this.oldTime=this.startTime,this.running=!0},stop:function(){this.getElapsedTime(),this.running=!1},getElapsedTime:function(){return this.getDelta(),this.elapsedTime},getDelta:function(){var e=0;if(this.autoStart&&!this.running&&this.start(),this.running){var t=void 0!==self.performance&&void 0!==self.performance.now?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){void 0===this._listeners&&(this._listeners={});var n=this._listeners;void 0===n[e]&&(n[e]=[]),-1===n[e].indexOf(t)&&n[e].push(t)},hasEventListener:function(e,t){if(void 0===this._listeners)return!1;var n=this._listeners;return void 0!==n[e]&&-1!==n[e].indexOf(t)?!0:!1},removeEventListener:function(e,t){if(void 0!==this._listeners){var n=this._listeners,r=n[e];if(void 0!==r){var i=r.indexOf(t);-1!==i&&r.splice(i,1)}}},dispatchEvent:function(e){if(void 0!==this._listeners){var t=this._listeners,n=t[e.type];if(void 0!==n){e.target=this;for(var r=[],i=n.length,o=0;i>o;o++)r[o]=n[o];for(var o=0;i>o;o++)r[o].call(this,e)}}}},function(e){e.Raycaster=function(t,n,r,i){this.ray=new e.Ray(t,n),this.near=r||0,this.far=i||1/0,this.params={Sprite:{},Mesh:{},PointCloud:{threshold:1},LOD:{},Line:{}}};var t=function(e,t){return e.distance-t.distance},n=function(e,t,r,i){if(e.raycast(t,r),i===!0)for(var o=e.children,a=0,s=o.length;s>a;a++)n(o[a],t,r,!0)};e.Raycaster.prototype={constructor:e.Raycaster,precision:1e-4,linePrecision:1,set:function(e,t){this.ray.set(e,t)},setFromCamera:function(t,n){n instanceof e.PerspectiveCamera?(this.ray.origin.copy(n.position),this.ray.direction.set(t.x,t.y,.5).unproject(n).sub(n.position).normalize()):n instanceof e.OrthographicCamera?(this.ray.origin.set(t.x,t.y,-1).unproject(n),this.ray.direction.set(0,0,-1).transformDirection(n.matrixWorld)):e.error("THREE.Raycaster: Unsupported camera type.")},intersectObject:function(e,r){var i=[];return n(e,this,i,r),i.sort(t),i},intersectObjects:function(r,i){var o=[];if(r instanceof Array==!1)return e.warn("THREE.Raycaster.intersectObjects: objects is not an Array."),o;for(var a=0,s=r.length;s>a;a++)n(r[a],this,o,i);return o.sort(t),o}}}(e),e.Object3D=function(){Object.defineProperty(this,"id",{value:e.Object3DIdCount++}),this.uuid=e.Math.generateUUID(),this.name="",this.type="Object3D",this.parent=void 0,this.children=[],this.up=e.Object3D.DefaultUp.clone();var t=new e.Vector3,n=new e.Euler,r=new e.Quaternion,i=new e.Vector3(1,1,1),o=function(){r.setFromEuler(n,!1)},a=function(){n.setFromQuaternion(r,void 0,!1)};n.onChange(o),r.onChange(a),Object.defineProperties(this,{position:{enumerable:!0,value:t},rotation:{enumerable:!0,value:n},quaternion:{enumerable:!0,value:r},scale:{enumerable:!0,value:i}}),this.rotationAutoUpdate=!0,this.matrix=new e.Matrix4,this.matrixWorld=new e.Matrix4,this.matrixAutoUpdate=!0,this.matrixWorldNeedsUpdate=!1,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.userData={}},e.Object3D.DefaultUp=new e.Vector3(0,1,0),e.Object3D.prototype={constructor:e.Object3D,get eulerOrder(){return e.warn("THREE.Object3D: .eulerOrder has been moved to .rotation.order."),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,!0)},setRotationFromMatrix:function(e){this.quaternion.setFromRotationMatrix(e)},setRotationFromQuaternion:function(e){this.quaternion.copy(e)},rotateOnAxis:function(){var t=new e.Quaternion;return function(e,n){return t.setFromAxisAngle(e,n),this.quaternion.multiply(t),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,n){return t.copy(e).applyQuaternion(this.quaternion),this.position.add(t.multiplyScalar(n)),this}}(),translate:function(t,n){return e.warn("THREE.Object3D: .translate() has been removed. Use .translateOnAxis( axis, distance ) instead."),this.translateOnAxis(n,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 n=0;n<arguments.length;n++)this.add(arguments[n]);return this}return t===this?(e.error("THREE.Object3D.add: object can't be added as a child of itself.",t),this):(t instanceof e.Object3D?(void 0!==t.parent&&t.parent.remove(t),t.parent=this,t.dispatchEvent({type:"added"}),this.children.push(t)):e.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",t),this)},remove:function(e){if(arguments.length>1)for(var t=0;t<arguments.length;t++)this.remove(arguments[t]);var n=this.children.indexOf(e);-1!==n&&(e.parent=void 0,e.dispatchEvent({type:"removed"}),this.children.splice(n,1))},getChildByName:function(t){return e.warn("THREE.Object3D: .getChildByName() has been renamed to .getObjectByName()."),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 n=0,r=this.children.length;r>n;n++){var i=this.children[n],o=i.getObjectByProperty(e,t);if(void 0!==o)return o}return void 0},getWorldPosition:function(t){var n=t||new e.Vector3;return this.updateMatrixWorld(!0),n.setFromMatrixPosition(this.matrixWorld)},getWorldQuaternion:function(){var t=new e.Vector3,n=new e.Vector3;return function(r){var i=r||new e.Quaternion;return this.updateMatrixWorld(!0),this.matrixWorld.decompose(t,i,n),i}}(),getWorldRotation:function(){var t=new e.Quaternion;return function(n){var r=n||new e.Euler;return this.getWorldQuaternion(t),r.setFromQuaternion(t,this.rotation.order,!1)}}(),getWorldScale:function(){var t=new e.Vector3,n=new e.Quaternion;return function(r){var i=r||new e.Vector3;return this.updateMatrixWorld(!0),this.matrixWorld.decompose(t,n,i),i}}(),getWorldDirection:function(){var t=new e.Quaternion;return function(n){var r=n||new e.Vector3;return this.getWorldQuaternion(t),r.set(0,0,1).applyQuaternion(t)}}(),raycast:function(){},traverse:function(e){e(this);for(var t=0,n=this.children.length;n>t;t++)this.children[t].traverse(e)},traverseVisible:function(e){if(this.visible!==!1){e(this);for(var t=0,n=this.children.length;n>t;t++)this.children[t].traverseVisible(e)}},traverseAncestors:function(e){this.parent&&(e(this.parent),this.parent.traverseAncestors(e))},updateMatrix:function(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0},updateMatrixWorld:function(e){this.matrixAutoUpdate===!0&&this.updateMatrix(),(this.matrixWorldNeedsUpdate===!0||e===!0)&&(void 0===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorldNeedsUpdate=!1,e=!0);for(var t=0,n=this.children.length;n>t;t++)this.children[t].updateMatrixWorld(e)},toJSON:function(){var t={metadata:{version:4.3,type:"Object",generator:"ObjectExporter"}},n={},r=function(e){if(void 0===t.geometries&&(t.geometries=[]),void 0===n[e.uuid]){var r=e.toJSON();delete r.metadata,n[e.uuid]=r,t.geometries.push(r)}return e.uuid},i={},o=function(e){if(void 0===t.materials&&(t.materials=[]),void 0===i[e.uuid]){var n=e.toJSON();delete n.metadata,i[e.uuid]=n,t.materials.push(n)}return e.uuid},a=function(t){var n={};if(n.uuid=t.uuid,n.type=t.type,""!==t.name&&(n.name=t.name),"{}"!==JSON.stringify(t.userData)&&(n.userData=t.userData),t.visible!==!0&&(n.visible=t.visible),t instanceof e.PerspectiveCamera?(n.fov=t.fov,n.aspect=t.aspect,n.near=t.near,n.far=t.far):t instanceof e.OrthographicCamera?(n.left=t.left,n.right=t.right,n.top=t.top,n.bottom=t.bottom,n.near=t.near,n.far=t.far):t instanceof e.AmbientLight?n.color=t.color.getHex():t instanceof e.DirectionalLight?(n.color=t.color.getHex(),n.intensity=t.intensity):t instanceof e.PointLight?(n.color=t.color.getHex(),n.intensity=t.intensity,n.distance=t.distance,n.decay=t.decay):t instanceof e.SpotLight?(n.color=t.color.getHex(),n.intensity=t.intensity,n.distance=t.distance,n.angle=t.angle,n.exponent=t.exponent,n.decay=t.decay):t instanceof e.HemisphereLight?(n.color=t.color.getHex(),n.groundColor=t.groundColor.getHex()):t instanceof e.Mesh||t instanceof e.Line||t instanceof e.PointCloud?(n.geometry=r(t.geometry),n.material=o(t.material),t instanceof e.Line&&(n.mode=t.mode)):t instanceof e.Sprite&&(n.material=o(t.material)),n.matrix=t.matrix.toArray(),t.children.length>0){n.children=[];for(var i=0;i<t.children.length;i++)n.children.push(a(t.children[i]))}return n};return t.object=a(this),t},clone:function(t,n){if(void 0===t&&(t=new e.Object3D),void 0===n&&(n=!0),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)),n===!0)for(var r=0;r<this.children.length;r++){var i=this.children[r];t.add(i.clone())}return t}},e.EventDispatcher.prototype.apply(e.Object3D.prototype),e.Object3DIdCount=0,e.Face3=function(t,n,r,i,o,a){this.a=t,this.b=n,this.c=r,this.normal=i instanceof e.Vector3?i:new e.Vector3,this.vertexNormals=i instanceof Array?i:[],this.color=o instanceof e.Color?o:new e.Color,this.vertexColors=o instanceof Array?o:[],this.vertexTangents=[],this.materialIndex=void 0!==a?a: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 n=0,r=this.vertexNormals.length;r>n;n++)t.vertexNormals[n]=this.vertexNormals[n].clone();for(var n=0,r=this.vertexColors.length;r>n;n++)t.vertexColors[n]=this.vertexColors[n].clone();for(var n=0,r=this.vertexTangents.length;r>n;n++)t.vertexTangents[n]=this.vertexTangents[n].clone();return t}},e.Face4=function(t,n,r,i,o,a,s){return e.warn("THREE.Face4 has been removed. A THREE.Face3 will be created instead."),new e.Face3(t,n,r,o,a,s)},e.BufferAttribute=function(e,t){this.array=e,this.itemSize=t,this.needsUpdate=!1},e.BufferAttribute.prototype={constructor:e.BufferAttribute,get length(){return this.array.length},copyAt:function(e,t,n){e*=this.itemSize,n*=t.itemSize;for(var r=0,i=this.itemSize;i>r;r++)this.array[e+r]=t.array[n+r];return this},set:function(e,t){return void 0===t&&(t=0),this.array.set(e,t),this},setX:function(e,t){return this.array[e*this.itemSize]=t,this},setY:function(e,t){return this.array[e*this.itemSize+1]=t,this},setZ:function(e,t){return this.array[e*this.itemSize+2]=t,this},setXY:function(e,t,n){return e*=this.itemSize,this.array[e]=t,this.array[e+1]=n,this},setXYZ:function(e,t,n,r){return e*=this.itemSize,this.array[e]=t,this.array[e+1]=n,this.array[e+2]=r,this},setXYZW:function(e,t,n,r,i){return e*=this.itemSize,this.array[e]=t,this.array[e+1]=n,this.array[e+2]=r,this.array[e+3]=i,this},clone:function(){return new e.BufferAttribute(new this.array.constructor(this.array),this.itemSize)}},e.Int8Attribute=function(t,n){return e.warn("THREE.Int8Attribute has been removed. Use THREE.BufferAttribute( array, itemSize ) instead."),new e.BufferAttribute(t,n)},e.Uint8Attribute=function(t,n){return e.warn("THREE.Uint8Attribute has been removed. Use THREE.BufferAttribute( array, itemSize ) instead."),new e.BufferAttribute(t,n)},e.Uint8ClampedAttribute=function(t,n){return e.warn("THREE.Uint8ClampedAttribute has been removed. Use THREE.BufferAttribute( array, itemSize ) instead."),new e.BufferAttribute(t,n)},e.Int16Attribute=function(t,n){return e.warn("THREE.Int16Attribute has been removed. Use THREE.BufferAttribute( array, itemSize ) instead."),new e.BufferAttribute(t,n)},e.Uint16Attribute=function(t,n){return e.warn("THREE.Uint16Attribute has been removed. Use THREE.BufferAttribute( array, itemSize ) instead."),new e.BufferAttribute(t,n)},e.Int32Attribute=function(t,n){return e.warn("THREE.Int32Attribute has been removed. Use THREE.BufferAttribute( array, itemSize ) instead."),new e.BufferAttribute(t,n)},e.Uint32Attribute=function(t,n){return e.warn("THREE.Uint32Attribute has been removed. Use THREE.BufferAttribute( array, itemSize ) instead."),new e.BufferAttribute(t,n)},e.Float32Attribute=function(t,n){return e.warn("THREE.Float32Attribute has been removed. Use THREE.BufferAttribute( array, itemSize ) instead."),new e.BufferAttribute(t,n)},e.Float64Attribute=function(t,n){return e.warn("THREE.Float64Attribute has been removed. Use THREE.BufferAttribute( array, itemSize ) instead."),new e.BufferAttribute(t,n)},e.DynamicBufferAttribute=function(t,n){e.BufferAttribute.call(this,t,n),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,n){return n instanceof e.BufferAttribute==!1?(e.warn("THREE.BufferGeometry: .addAttribute() now expects ( name, attribute )."),this.attributes[t]={array:arguments[1],itemSize:arguments[2]},void 0):(this.attributes[t]=n,this.attributesKeys=Object.keys(this.attributes),void 0)},getAttribute:function(e){return this.attributes[e]},addDrawCall:function(e,t,n){this.drawcalls.push({start:e,count:t,index:void 0!==n?n:0})},applyMatrix:function(t){var n=this.attributes.position;void 0!==n&&(t.applyToVector3Array(n.array),n.needsUpdate=!0);var r=this.attributes.normal;if(void 0!==r){var i=(new e.Matrix3).getNormalMatrix(t);i.applyToVector3Array(r.array),r.needsUpdate=!0}null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere()},center:function(){this.computeBoundingBox();var t=this.boundingBox.center().negate();return this.applyMatrix((new e.Matrix4).setPosition(t)),t},fromGeometry:function(t,n){n=n||{vertexColors:e.NoColors};var r=t.vertices,i=t.faces,o=t.faceVertexUvs,a=n.vertexColors,s=o[0].length>0,u=3==i[0].vertexNormals.length,c=new Float32Array(3*i.length*3);this.addAttribute("position",new e.BufferAttribute(c,3));var l=new Float32Array(3*i.length*3);if(this.addAttribute("normal",new e.BufferAttribute(l,3)),a!==e.NoColors){var h=new Float32Array(3*i.length*3);this.addAttribute("color",new e.BufferAttribute(h,3))}if(s===!0){var f=new Float32Array(3*i.length*2);this.addAttribute("uv",new e.BufferAttribute(f,2))}for(var p=0,d=0,m=0;p<i.length;p++,d+=6,m+=9){var v=i[p],g=r[v.a],y=r[v.b],b=r[v.c];if(c[m]=g.x,c[m+1]=g.y,c[m+2]=g.z,c[m+3]=y.x,c[m+4]=y.y,c[m+5]=y.z,c[m+6]=b.x,c[m+7]=b.y,c[m+8]=b.z,u===!0){var x=v.vertexNormals[0],w=v.vertexNormals[1],_=v.vertexNormals[2];l[m]=x.x,l[m+1]=x.y,l[m+2]=x.z,l[m+3]=w.x,l[m+4]=w.y,l[m+5]=w.z,l[m+6]=_.x,l[m+7]=_.y,l[m+8]=_.z}else{var C=v.normal;l[m]=C.x,l[m+1]=C.y,l[m+2]=C.z,l[m+3]=C.x,l[m+4]=C.y,l[m+5]=C.z,l[m+6]=C.x,l[m+7]=C.y,l[m+8]=C.z}if(a===e.FaceColors){var E=v.color;h[m]=E.r,h[m+1]=E.g,h[m+2]=E.b,h[m+3]=E.r,h[m+4]=E.g,h[m+5]=E.b,h[m+6]=E.r,h[m+7]=E.g,h[m+8]=E.b}else if(a===e.VertexColors){var S=v.vertexColors[0],M=v.vertexColors[1],T=v.vertexColors[2];h[m]=S.r,h[m+1]=S.g,h[m+2]=S.b,h[m+3]=M.r,h[m+4]=M.g,h[m+5]=M.b,h[m+6]=T.r,h[m+7]=T.g,h[m+8]=T.b}if(s===!0){var A=o[0][p][0],P=o[0][p][1],k=o[0][p][2];f[d]=A.x,f[d+1]=A.y,f[d+2]=P.x,f[d+3]=P.y,f[d+4]=k.x,f[d+5]=k.y}}return this.computeBoundingSphere(),this},computeBoundingBox:function(){var t=new e.Vector3;return function(){null===this.boundingBox&&(this.boundingBox=new e.Box3);var n=this.attributes.position.array;if(n){var r=this.boundingBox;r.makeEmpty();for(var i=0,o=n.length;o>i;i+=3)t.set(n[i],n[i+1],n[i+2]),r.expandByPoint(t)}(void 0===n||0===n.length)&&(this.boundingBox.min.set(0,0,0),this.boundingBox.max.set(0,0,0)),(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,n=new e.Vector3;return function(){null===this.boundingSphere&&(this.boundingSphere=new e.Sphere);var r=this.attributes.position.array;if(r){t.makeEmpty();for(var i=this.boundingSphere.center,o=0,a=r.length;a>o;o+=3)n.set(r[o],r[o+1],r[o+2]),t.expandByPoint(n);t.center(i);for(var s=0,o=0,a=r.length;a>o;o+=3)n.set(r[o],r[o+1],r[o+2]),s=Math.max(s,i.distanceToSquared(n));this.boundingSphere.radius=Math.sqrt(s),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 n=t.position.array;if(void 0===t.normal)this.addAttribute("normal",new e.BufferAttribute(new Float32Array(n.length),3));else for(var r=t.normal.array,i=0,o=r.length;o>i;i++)r[i]=0;var a,s,u,r=t.normal.array,c=new e.Vector3,l=new e.Vector3,h=new e.Vector3,f=new e.Vector3,p=new e.Vector3;if(t.index)for(var d=t.index.array,m=this.offsets.length>0?this.offsets:[{start:0,count:d.length,index:0}],v=0,g=m.length;g>v;++v)for(var y=m[v].start,b=m[v].count,x=m[v].index,i=y,o=y+b;o>i;i+=3)a=3*(x+d[i]),s=3*(x+d[i+1]),u=3*(x+d[i+2]),c.fromArray(n,a),l.fromArray(n,s),h.fromArray(n,u),f.subVectors(h,l),p.subVectors(c,l),f.cross(p),r[a]+=f.x,r[a+1]+=f.y,r[a+2]+=f.z,r[s]+=f.x,r[s+1]+=f.y,r[s+2]+=f.z,r[u]+=f.x,r[u+1]+=f.y,r[u+2]+=f.z;else for(var i=0,o=n.length;o>i;i+=9)c.fromArray(n,i),l.fromArray(n,i+3),h.fromArray(n,i+6),f.subVectors(h,l),p.subVectors(c,l),f.cross(p),r[i]=f.x,r[i+1]=f.y,r[i+2]=f.z,r[i+3]=f.x,r[i+4]=f.y,r[i+5]=f.z,r[i+6]=f.x,r[i+7]=f.y,r[i+8]=f.z;this.normalizeNormals(),t.normal.needsUpdate=!0}},computeTangents:function(){function t(e,t,n){k.fromArray(i,3*e),R.fromArray(i,3*t),I.fromArray(i,3*n),D.fromArray(a,2*e),B.fromArray(a,2*t),V.fromArray(a,2*n),f=R.x-k.x,p=I.x-k.x,d=R.y-k.y,m=I.y-k.y,v=R.z-k.z,g=I.z-k.z,y=B.x-D.x,b=V.x-D.x,x=B.y-D.y,w=V.y-D.y,_=1/(y*w-b*x),L.set((w*f-x*p)*_,(w*d-x*m)*_,(w*v-x*g)*_),N.set((y*p-b*f)*_,(y*m-b*d)*_,(y*g-b*v)*_),c[e].add(L),c[t].add(L),c[n].add(L),l[e].add(N),l[t].add(N),l[n].add(N)}function n(e){q.fromArray(o,3*e),X.copy(q),H=c[e],G.copy(H),G.sub(q.multiplyScalar(q.dot(H))).normalize(),W.crossVectors(X,H),j=W.dot(l[e]),$=0>j?-1:1,u[4*e]=G.x,u[4*e+1]=G.y,u[4*e+2]=G.z,u[4*e+3]=$}if(void 0===this.attributes.index||void 0===this.attributes.position||void 0===this.attributes.normal||void 0===this.attributes.uv)return e.warn("THREE.BufferGeometry: Missing required attributes (index, position, normal or uv) in BufferGeometry.computeTangents()"),void 0;var r=this.attributes.index.array,i=this.attributes.position.array,o=this.attributes.normal.array,a=this.attributes.uv.array,s=i.length/3;void 0===this.attributes.tangent&&this.addAttribute("tangent",new e.BufferAttribute(new Float32Array(4*s),4));for(var u=this.attributes.tangent.array,c=[],l=[],h=0;s>h;h++)c[h]=new e.Vector3,l[h]=new e.Vector3;var f,p,d,m,v,g,y,b,x,w,_,C,E,S,M,T,A,P,k=new e.Vector3,R=new e.Vector3,I=new e.Vector3,D=new e.Vector2,B=new e.Vector2,V=new e.Vector2,L=new e.Vector3,N=new e.Vector3;0===this.drawcalls.length&&this.addDrawCall(0,r.length,0);var O=this.drawcalls;for(S=0,M=O.length;M>S;++S){var F=O[S].start,U=O[S].count,z=O[S].index;for(C=F,E=F+U;E>C;C+=3)T=z+r[C],A=z+r[C+1],P=z+r[C+2],t(T,A,P)}var $,H,j,G=new e.Vector3,W=new e.Vector3,q=new e.Vector3,X=new e.Vector3;for(S=0,M=O.length;M>S;++S){var F=O[S].start,U=O[S].count,z=O[S].index;for(C=F,E=F+U;E>C;C+=3)T=z+r[C],A=z+r[C+1],P=z+r[C+2],n(T),n(A),n(P)}},computeOffsets:function(e){void 0===e&&(e=65535);for(var t=this.attributes.index.array,n=this.attributes.position.array,r=t.length/3,i=new Uint16Array(t.length),o=0,a=0,s=[{start:0,count:0,index:0}],u=s[0],c=0,l=0,h=new Int32Array(6),f=new Int32Array(n.length),p=new Int32Array(n.length),d=0;d<n.length;d++)f[d]=-1,p[d]=-1;for(var m=0;r>m;m++){l=0;for(var v=0;3>v;v++){var g=t[3*m+v];-1==f[g]?(h[2*v]=g,h[2*v+1]=-1,l++):f[g]<u.index?(h[2*v]=g,h[2*v+1]=-1,c++):(h[2*v]=g,h[2*v+1]=f[g])}var y=a+l;if(y>u.index+e){var b={start:o,count:0,index:a};s.push(b),u=b;for(var x=0;6>x;x+=2){var w=h[x+1];w>-1&&w<u.index&&(h[x+1]=-1)}}for(var x=0;6>x;x+=2){var g=h[x],w=h[x+1];-1===w&&(w=a++),f[g]=w,p[w]=g,i[o++]=w-u.index,u.count++}}return this.reorderBuffers(i,p,a),this.offsets=s,this.drawcalls=s,s},merge:function(t,n){if(t instanceof e.BufferGeometry==!1)return e.error("THREE.BufferGeometry.merge(): geometry not an instance of THREE.BufferGeometry.",t),void 0;
void 0===n&&(n=0);var r=this.attributes;for(var i in r)if(void 0!==t.attributes[i])for(var o=r[i],a=o.array,s=t.attributes[i],u=s.array,c=s.itemSize,l=0,h=c*n;l<u.length;l++,h++)a[h]=u[l];return this},normalizeNormals:function(){for(var e,t,n,r,i=this.attributes.normal.array,o=0,a=i.length;a>o;o+=3)e=i[o],t=i[o+1],n=i[o+2],r=1/Math.sqrt(e*e+t*t+n*n),i[o]*=r,i[o+1]*=r,i[o+2]*=r},reorderBuffers:function(e,t,n){var r={};for(var i in this.attributes)if("index"!=i){var o=this.attributes[i].array;r[i]=new o.constructor(this.attributes[i].itemSize*n)}for(var a=0;n>a;a++){var s=t[a];for(var i in this.attributes)if("index"!=i)for(var u=this.attributes[i].array,c=this.attributes[i].itemSize,l=r[i],h=0;c>h;h++)l[a*c+h]=u[s*c+h]}this.attributes.index.array=e;for(var i in this.attributes)"index"!=i&&(this.attributes[i].array=r[i],this.attributes[i].numItems=this.attributes[i].itemSize*n)},toJSON:function(){var e={metadata:{version:4,type:"BufferGeometry",generator:"BufferGeometryExporter"},uuid:this.uuid,type:this.type,data:{attributes:{}}},t=this.attributes,n=this.offsets,r=this.boundingSphere;for(var i in t){var o=t[i],a=Array.prototype.slice.call(o.array);e.data.attributes[i]={itemSize:o.itemSize,type:o.array.constructor.name,array:a}}return n.length>0&&(e.data.offsets=JSON.parse(JSON.stringify(n))),null!==r&&(e.data.boundingSphere={center:r.center.toArray(),radius:r.radius}),e},clone:function(){var t=new e.BufferGeometry;for(var n in this.attributes){var r=this.attributes[n];t.addAttribute(n,r.clone())}for(var i=0,o=this.offsets.length;o>i;i++){var a=this.offsets[i];t.offsets.push({start:a.start,index:a.index,count:a.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=!1,this.dynamic=!0,this.verticesNeedUpdate=!1,this.elementsNeedUpdate=!1,this.uvsNeedUpdate=!1,this.normalsNeedUpdate=!1,this.tangentsNeedUpdate=!1,this.colorsNeedUpdate=!1,this.lineDistancesNeedUpdate=!1,this.groupsNeedUpdate=!1},e.Geometry.prototype={constructor:e.Geometry,applyMatrix:function(t){for(var n=(new e.Matrix3).getNormalMatrix(t),r=0,i=this.vertices.length;i>r;r++){var o=this.vertices[r];o.applyMatrix4(t)}for(var r=0,i=this.faces.length;i>r;r++){var a=this.faces[r];a.normal.applyMatrix3(n).normalize();for(var s=0,u=a.vertexNormals.length;u>s;s++)a.vertexNormals[s].applyMatrix3(n).normalize()}null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this.verticesNeedUpdate=!0,this.normalsNeedUpdate=!0},fromBufferGeometry:function(t){for(var n=this,r=t.attributes,i=r.position.array,o=void 0!==r.index?r.index.array:void 0,a=void 0!==r.normal?r.normal.array:void 0,s=void 0!==r.color?r.color.array:void 0,u=void 0!==r.uv?r.uv.array:void 0,c=[],l=[],h=0,f=0;h<i.length;h+=3,f+=2)n.vertices.push(new e.Vector3(i[h],i[h+1],i[h+2])),void 0!==a&&c.push(new e.Vector3(a[h],a[h+1],a[h+2])),void 0!==s&&n.colors.push(new e.Color(s[h],s[h+1],s[h+2])),void 0!==u&&l.push(new e.Vector2(u[f],u[f+1]));var p=function(t,r,i){var o=void 0!==a?[c[t].clone(),c[r].clone(),c[i].clone()]:[],h=void 0!==s?[n.colors[t].clone(),n.colors[r].clone(),n.colors[i].clone()]:[];n.faces.push(new e.Face3(t,r,i,o,h)),void 0!==u&&n.faceVertexUvs[0].push([l[t].clone(),l[r].clone(),l[i].clone()])};if(void 0!==o){var d=t.drawcalls;if(d.length>0)for(var h=0;h<d.length;h++)for(var m=d[h],v=m.start,g=m.count,y=m.index,f=v,b=v+g;b>f;f+=3)p(y+o[f],y+o[f+1],y+o[f+2]);else for(var h=0;h<o.length;h+=3)p(o[h],o[h+1],o[h+2])}else for(var h=0;h<i.length/3;h+=3)p(h,h+1,h+2);return this.computeFaceNormals(),null!==t.boundingBox&&(this.boundingBox=t.boundingBox.clone()),null!==t.boundingSphere&&(this.boundingSphere=t.boundingSphere.clone()),this},center:function(){this.computeBoundingBox();var t=this.boundingBox.center().negate();return this.applyMatrix((new e.Matrix4).setPosition(t)),t},computeFaceNormals:function(){for(var t=new e.Vector3,n=new e.Vector3,r=0,i=this.faces.length;i>r;r++){var o=this.faces[r],a=this.vertices[o.a],s=this.vertices[o.b],u=this.vertices[o.c];t.subVectors(u,s),n.subVectors(a,s),t.cross(n),t.normalize(),o.normal.copy(t)}},computeVertexNormals:function(t){var n,r,i,o,a,s;for(s=new Array(this.vertices.length),n=0,r=this.vertices.length;r>n;n++)s[n]=new e.Vector3;if(t){var u,c,l,h=new e.Vector3,f=new e.Vector3;for(i=0,o=this.faces.length;o>i;i++)a=this.faces[i],u=this.vertices[a.a],c=this.vertices[a.b],l=this.vertices[a.c],h.subVectors(l,c),f.subVectors(u,c),h.cross(f),s[a.a].add(h),s[a.b].add(h),s[a.c].add(h)}else for(i=0,o=this.faces.length;o>i;i++)a=this.faces[i],s[a.a].add(a.normal),s[a.b].add(a.normal),s[a.c].add(a.normal);for(n=0,r=this.vertices.length;r>n;n++)s[n].normalize();for(i=0,o=this.faces.length;o>i;i++)a=this.faces[i],a.vertexNormals[0]=s[a.a].clone(),a.vertexNormals[1]=s[a.b].clone(),a.vertexNormals[2]=s[a.c].clone()},computeMorphNormals:function(){var t,n,r,i,o;for(r=0,i=this.faces.length;i>r;r++)for(o=this.faces[r],o.__originalFaceNormal?o.__originalFaceNormal.copy(o.normal):o.__originalFaceNormal=o.normal.clone(),o.__originalVertexNormals||(o.__originalVertexNormals=[]),t=0,n=o.vertexNormals.length;n>t;t++)o.__originalVertexNormals[t]?o.__originalVertexNormals[t].copy(o.vertexNormals[t]):o.__originalVertexNormals[t]=o.vertexNormals[t].clone();var a=new e.Geometry;for(a.faces=this.faces,t=0,n=this.morphTargets.length;n>t;t++){if(!this.morphNormals[t]){this.morphNormals[t]={},this.morphNormals[t].faceNormals=[],this.morphNormals[t].vertexNormals=[];var s,u,c=this.morphNormals[t].faceNormals,l=this.morphNormals[t].vertexNormals;for(r=0,i=this.faces.length;i>r;r++)s=new e.Vector3,u={a:new e.Vector3,b:new e.Vector3,c:new e.Vector3},c.push(s),l.push(u)}var h=this.morphNormals[t];a.vertices=this.morphTargets[t].vertices,a.computeFaceNormals(),a.computeVertexNormals();var s,u;for(r=0,i=this.faces.length;i>r;r++)o=this.faces[r],s=h.faceNormals[r],u=h.vertexNormals[r],s.copy(o.normal),u.a.copy(o.vertexNormals[0]),u.b.copy(o.vertexNormals[1]),u.c.copy(o.vertexNormals[2])}for(r=0,i=this.faces.length;i>r;r++)o=this.faces[r],o.normal=o.__originalFaceNormal,o.vertexNormals=o.__originalVertexNormals},computeTangents:function(){function t(e,t,n,r,i,o,a){l=e.vertices[t],h=e.vertices[n],f=e.vertices[r],p=c[i],d=c[o],m=c[a],v=h.x-l.x,g=f.x-l.x,y=h.y-l.y,b=f.y-l.y,x=h.z-l.z,w=f.z-l.z,_=d.x-p.x,C=m.x-p.x,E=d.y-p.y,S=m.y-p.y,M=1/(_*S-C*E),I.set((S*v-E*g)*M,(S*y-E*b)*M,(S*x-E*w)*M),D.set((_*g-C*v)*M,(_*b-C*y)*M,(_*w-C*x)*M),k[t].add(I),k[n].add(I),k[r].add(I),R[t].add(D),R[n].add(D),R[r].add(D)}var n,r,i,o,a,s,u,c,l,h,f,p,d,m,v,g,y,b,x,w,_,C,E,S,M,T,A,P,k=[],R=[],I=new e.Vector3,D=new e.Vector3,B=new e.Vector3,V=new e.Vector3,L=new e.Vector3;for(i=0,o=this.vertices.length;o>i;i++)k[i]=new e.Vector3,R[i]=new e.Vector3;for(n=0,r=this.faces.length;r>n;n++)u=this.faces[n],c=this.faceVertexUvs[0][n],t(this,u.a,u.b,u.c,0,1,2);var N=["a","b","c","d"];for(n=0,r=this.faces.length;r>n;n++)for(u=this.faces[n],a=0;a<Math.min(u.vertexNormals.length,3);a++)L.copy(u.vertexNormals[a]),s=u[N[a]],T=k[s],B.copy(T),B.sub(L.multiplyScalar(L.dot(T))).normalize(),V.crossVectors(u.vertexNormals[a],T),A=V.dot(R[s]),P=0>A?-1:1,u.vertexTangents[a]=new e.Vector4(B.x,B.y,B.z,P);this.hasTangents=!0},computeLineDistances:function(){for(var e=0,t=this.vertices,n=0,r=t.length;r>n;n++)n>0&&(e+=t[n].distanceTo(t[n-1])),this.lineDistances[n]=e},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new e.Box3),this.boundingBox.setFromPoints(this.vertices)},computeBoundingSphere:function(){null===this.boundingSphere&&(this.boundingSphere=new e.Sphere),this.boundingSphere.setFromPoints(this.vertices)},merge:function(t,n,r){if(t instanceof e.Geometry==!1)return e.error("THREE.Geometry.merge(): geometry not an instance of THREE.Geometry.",t),void 0;var i,o=this.vertices.length,a=this.vertices,s=t.vertices,u=this.faces,c=t.faces,l=this.faceVertexUvs[0],h=t.faceVertexUvs[0];void 0===r&&(r=0),void 0!==n&&(i=(new e.Matrix3).getNormalMatrix(n));for(var f=0,p=s.length;p>f;f++){var d=s[f],m=d.clone();void 0!==n&&m.applyMatrix4(n),a.push(m)}for(f=0,p=c.length;p>f;f++){var v,g,y,b=c[f],x=b.vertexNormals,w=b.vertexColors;v=new e.Face3(b.a+o,b.b+o,b.c+o),v.normal.copy(b.normal),void 0!==i&&v.normal.applyMatrix3(i).normalize();for(var _=0,C=x.length;C>_;_++)g=x[_].clone(),void 0!==i&&g.applyMatrix3(i).normalize(),v.vertexNormals.push(g);v.color.copy(b.color);for(var _=0,C=w.length;C>_;_++)y=w[_],v.vertexColors.push(y.clone());v.materialIndex=b.materialIndex+r,u.push(v)}for(f=0,p=h.length;p>f;f++){var E=h[f],S=[];if(void 0!==E){for(var _=0,C=E.length;C>_;_++)S.push(E[_].clone());l.push(S)}}},mergeMesh:function(t){return t instanceof e.Mesh==!1?(e.error("THREE.Geometry.mergeMesh(): mesh not an instance of THREE.Mesh.",t),void 0):(t.matrixAutoUpdate&&t.updateMatrix(),this.merge(t.geometry,t.matrix),void 0)},mergeVertices:function(){var e,t,n,r,i,o,a,s,u={},c=[],l=[],h=4,f=Math.pow(10,h);for(n=0,r=this.vertices.length;r>n;n++)e=this.vertices[n],t=Math.round(e.x*f)+"_"+Math.round(e.y*f)+"_"+Math.round(e.z*f),void 0===u[t]?(u[t]=n,c.push(this.vertices[n]),l[n]=c.length-1):l[n]=l[u[t]];var p=[];for(n=0,r=this.faces.length;r>n;n++){i=this.faces[n],i.a=l[i.a],i.b=l[i.b],i.c=l[i.c],o=[i.a,i.b,i.c];for(var d=-1,m=0;3>m;m++)if(o[m]==o[(m+1)%3]){d=m,p.push(n);break}}for(n=p.length-1;n>=0;n--){var v=p[n];for(this.faces.splice(v,1),a=0,s=this.faceVertexUvs.length;s>a;a++)this.faceVertexUvs[a].splice(v,1)}var g=this.vertices.length-c.length;return this.vertices=c,g},toJSON:function(){function e(e,t,n){return n?e|1<<t:e&~(1<<t)}function t(e){var t=e.x.toString()+e.y.toString()+e.z.toString();return void 0!==f[t]?f[t]:(f[t]=h.length/3,h.push(e.x,e.y,e.z),f[t])}function n(e){var t=e.r.toString()+e.g.toString()+e.b.toString();return void 0!==d[t]?d[t]:(d[t]=p.length,p.push(e.getHex()),d[t])}function r(e){var t=e.x.toString()+e.y.toString();return void 0!==v[t]?v[t]:(v[t]=m.length/2,m.push(e.x,e.y),v[t])}var i={metadata:{version:4,type:"BufferGeometry",generator:"BufferGeometryExporter"},uuid:this.uuid,type:this.type};if(""!==this.name&&(i.name=this.name),void 0!==this.parameters){var o=this.parameters;for(var a in o)void 0!==o[a]&&(i[a]=o[a]);return i}for(var s=[],u=0;u<this.vertices.length;u++){var c=this.vertices[u];s.push(c.x,c.y,c.z)}for(var l=[],h=[],f={},p=[],d={},m=[],v={},u=0;u<this.faces.length;u++){var g=this.faces[u],y=!1,b=!1,x=void 0!==this.faceVertexUvs[0][u],w=g.normal.length()>0,_=g.vertexNormals.length>0,C=1!==g.color.r||1!==g.color.g||1!==g.color.b,E=g.vertexColors.length>0,S=0;if(S=e(S,0,0),S=e(S,1,y),S=e(S,2,b),S=e(S,3,x),S=e(S,4,w),S=e(S,5,_),S=e(S,6,C),S=e(S,7,E),l.push(S),l.push(g.a,g.b,g.c),x){var M=this.faceVertexUvs[0][u];l.push(r(M[0]),r(M[1]),r(M[2]))}if(w&&l.push(t(g.normal)),_){var T=g.vertexNormals;l.push(t(T[0]),t(T[1]),t(T[2]))}if(C&&l.push(n(g.color)),E){var A=g.vertexColors;l.push(n(A[0]),n(A[1]),n(A[2]))}}return i.data={},i.data.vertices=s,i.data.normals=h,p.length>0&&(i.data.colors=p),m.length>0&&(i.data.uvs=[m]),i.data.faces=l,i},clone:function(){for(var t=new e.Geometry,n=this.vertices,r=0,i=n.length;i>r;r++)t.vertices.push(n[r].clone());for(var o=this.faces,r=0,i=o.length;i>r;r++)t.faces.push(o[r].clone());for(var r=0,i=this.faceVertexUvs.length;i>r;r++){var a=this.faceVertexUvs[r];void 0===t.faceVertexUvs[r]&&(t.faceVertexUvs[r]=[]);for(var s=0,u=a.length;u>s;s++){for(var c=a[s],l=[],h=0,f=c.length;f>h;h++){var p=c[h];l.push(p.clone())}t.faceVertexUvs[r].push(l)}}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,this.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(n){var r=n||new e.Vector3;return this.getWorldQuaternion(t),r.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){return void 0===t&&(t=new e.Camera),e.Object3D.prototype.clone.call(this,t),t.matrixWorldInverse.copy(this.matrixWorldInverse),t.projectionMatrix.copy(this.projectionMatrix),t},e.CubeCamera=function(t,n,r){e.Object3D.call(this),this.type="CubeCamera";var i=90,o=1,a=new e.PerspectiveCamera(i,o,t,n);a.up.set(0,-1,0),a.lookAt(new e.Vector3(1,0,0)),this.add(a);var s=new e.PerspectiveCamera(i,o,t,n);s.up.set(0,-1,0),s.lookAt(new e.Vector3(-1,0,0)),this.add(s);var u=new e.PerspectiveCamera(i,o,t,n);u.up.set(0,0,1),u.lookAt(new e.Vector3(0,1,0)),this.add(u);var c=new e.PerspectiveCamera(i,o,t,n);c.up.set(0,0,-1),c.lookAt(new e.Vector3(0,-1,0)),this.add(c);var l=new e.PerspectiveCamera(i,o,t,n);l.up.set(0,-1,0),l.lookAt(new e.Vector3(0,0,1)),this.add(l);var h=new e.PerspectiveCamera(i,o,t,n);h.up.set(0,-1,0),h.lookAt(new e.Vector3(0,0,-1)),this.add(h),this.renderTarget=new e.WebGLRenderTargetCube(r,r,{format:e.RGBFormat,magFilter:e.LinearFilter,minFilter:e.LinearFilter}),this.updateCubeMap=function(e,t){var n=this.renderTarget,r=n.generateMipmaps;n.generateMipmaps=!1,n.activeCubeFace=0,e.render(t,a,n),n.activeCubeFace=1,e.render(t,s,n),n.activeCubeFace=2,e.render(t,u,n),n.activeCubeFace=3,e.render(t,c,n),n.activeCubeFace=4,e.render(t,l,n),n.generateMipmaps=r,n.activeCubeFace=5,e.render(t,h,n)}},e.CubeCamera.prototype=Object.create(e.Object3D.prototype),e.CubeCamera.prototype.constructor=e.CubeCamera,e.OrthographicCamera=function(t,n,r,i,o,a){e.Camera.call(this),this.type="OrthographicCamera",this.zoom=1,this.left=t,this.right=n,this.top=r,this.bottom=i,this.near=void 0!==o?o:.1,this.far=void 0!==a?a: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),t=(this.top-this.bottom)/(2*this.zoom),n=(this.right+this.left)/2,r=(this.top+this.bottom)/2;this.projectionMatrix.makeOrthographic(n-e,n+e,r+t,r-t,this.near,this.far)},e.OrthographicCamera.prototype.clone=function(){var t=new e.OrthographicCamera;return 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),t},e.PerspectiveCamera=function(t,n,r,i){e.Camera.call(this),this.type="PerspectiveCamera",this.zoom=1,this.fov=void 0!==t?t:50,this.aspect=void 0!==n?n:1,this.near=void 0!==r?r:.1,this.far=void 0!==i?i:2e3,this.updateProjectionMatrix()},e.PerspectiveCamera.prototype=Object.create(e.Camera.prototype),e.PerspectiveCamera.prototype.constructor=e.PerspectiveCamera,e.PerspectiveCamera.prototype.setLens=function(t,n){void 0===n&&(n=24),this.fov=2*e.Math.radToDeg(Math.atan(n/(2*t))),this.updateProjectionMatrix()},e.PerspectiveCamera.prototype.setViewOffset=function(e,t,n,r,i,o){this.fullWidth=e,this.fullHeight=t,this.x=n,this.y=r,this.width=i,this.height=o,this.updateProjectionMatrix()},e.PerspectiveCamera.prototype.updateProjectionMatrix=function(){var t=e.Math.radToDeg(2*Math.atan(Math.tan(.5*e.Math.degToRad(this.fov))/this.zoom));if(this.fullWidth){var n=this.fullWidth/this.fullHeight,r=Math.tan(e.Math.degToRad(.5*t))*this.near,i=-r,o=n*i,a=n*r,s=Math.abs(a-o),u=Math.abs(r-i);this.projectionMatrix.makeFrustum(o+this.x*s/this.fullWidth,o+(this.x+this.width)*s/this.fullWidth,r-(this.y+this.height)*u/this.fullHeight,r-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;return 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),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){return void 0===t&&(t=new e.Light),e.Object3D.prototype.clone.call(this,t),t.color.copy(this.color),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;return e.Light.prototype.clone.call(this,t),t},e.AreaLight=function(t,n){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=void 0!==n?n: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,n){e.Light.call(this,t),this.type="DirectionalLight",this.position.set(0,1,0),this.target=new e.Object3D,this.intensity=void 0!==n?n:1,this.castShadow=!1,this.onlyShadow=!1,this.shadowCameraNear=50,this.shadowCameraFar=5e3,this.shadowCameraLeft=-500,this.shadowCameraRight=500,this.shadowCameraTop=500,this.shadowCameraBottom=-500,this.shadowCameraVisible=!1,this.shadowBias=0,this.shadowDarkness=.5,this.shadowMapWidth=512,this.shadowMapHeight=512,this.shadowCascade=!1,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;return 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),t},e.HemisphereLight=function(t,n,r){e.Light.call(this,t),this.type="HemisphereLight",this.position.set(0,100,0),this.groundColor=new e.Color(n),this.intensity=void 0!==r?r: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;return e.Light.prototype.clone.call(this,t),t.groundColor.copy(this.groundColor),t.intensity=this.intensity,t},e.PointLight=function(t,n,r,i){e.Light.call(this,t),this.type="PointLight",this.intensity=void 0!==n?n:1,this.distance=void 0!==r?r:0,this.decay=void 0!==i?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;return e.Light.prototype.clone.call(this,t),t.intensity=this.intensity,t.distance=this.distance,t.decay=this.decay,t},e.SpotLight=function(t,n,r,i,o,a){e.Light.call(this,t),this.type="SpotLight",this.position.set(0,1,0),this.target=new e.Object3D,this.intensity=void 0!==n?n:1,this.distance=void 0!==r?r:0,this.angle=void 0!==i?i:Math.PI/3,this.exponent=void 0!==o?o:10,this.decay=void 0!==a?a:1,this.castShadow=!1,this.onlyShadow=!1,this.shadowCameraNear=50,this.shadowCameraFar=5e3,this.shadowCameraFov=50,this.shadowCameraVisible=!1,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;return 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,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:void 0,addStatusElement:function(){var e=document.createElement("div");return 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 ...",e},updateProgress:function(e){var t="Loaded ";t+=e.total?(100*e.loaded/e.total).toFixed(0)+"%":(e.loaded/1024).toFixed(2)+" KB",this.statusDomElement.innerHTML=t},extractUrlBase:function(e){var t=e.split("/");return 1===t.length?"./":(t.pop(),t.join("/")+"/")},initMaterials:function(e,t){for(var n=[],r=0;r<e.length;++r)n[r]=this.createMaterial(e[r],t);return n},needsTangents:function(t){for(var n=0,r=t.length;r>n;n++){var i=t[n];if(i instanceof e.ShaderMaterial)return!0}return!1},createMaterial:function(t,n){function r(e){var t=Math.log(e)/Math.LN2;return Math.pow(2,Math.round(t))}function i(t,i,o,s,u,c,l){var h,f=n+o,p=e.Loader.Handlers.get(f);if(null!==p?h=p.load(f):(h=new e.Texture,p=a.imageLoader,p.crossOrigin=a.crossOrigin,p.load(f,function(t){if(e.Math.isPowerOfTwo(t.width)===!1||e.Math.isPowerOfTwo(t.height)===!1){var n=r(t.width),i=r(t.height),o=document.createElement("canvas");o.width=n,o.height=i;var a=o.getContext("2d");a.drawImage(t,0,0,n,i),h.image=o}else h.image=t;h.needsUpdate=!0})),h.sourceFile=o,s&&(h.repeat.set(s[0],s[1]),1!==s[0]&&(h.wrapS=e.RepeatWrapping),1!==s[1]&&(h.wrapT=e.RepeatWrapping)),u&&h.offset.set(u[0],u[1]),c){var d={repeat:e.RepeatWrapping,mirror:e.MirroredRepeatWrapping};void 0!==d[c[0]]&&(h.wrapS=d[c[0]]),void 0!==d[c[1]]&&(h.wrapT=d[c[1]])}l&&(h.anisotropy=l),t[i]=h}function o(e){return(255*e[0]<<16)+(255*e[1]<<8)+255*e[2]}var a=this,s="MeshLambertMaterial",u={color:15658734,opacity:1,map:null,lightMap:null,normalMap:null,bumpMap:null,wireframe:!1};if(t.shading){var c=t.shading.toLowerCase();"phong"===c?s="MeshPhongMaterial":"basic"===c&&(s="MeshBasicMaterial")}void 0!==t.blending&&void 0!==e[t.blending]&&(u.blending=e[t.blending]),void 0!==t.transparent&&(u.transparent=t.transparent),void 0!==t.opacity&&t.opacity<1&&(u.transparent=!0),void 0!==t.depthTest&&(u.depthTest=t.depthTest),void 0!==t.depthWrite&&(u.depthWrite=t.depthWrite),void 0!==t.visible&&(u.visible=t.visible),void 0!==t.flipSided&&(u.side=e.BackSide),void 0!==t.doubleSided&&(u.side=e.DoubleSide),void 0!==t.wireframe&&(u.wireframe=t.wireframe),void 0!==t.vertexColors&&("face"===t.vertexColors?u.vertexColors=e.FaceColors:t.vertexColors&&(u.vertexColors=e.VertexColors)),t.colorDiffuse?u.color=o(t.colorDiffuse):t.DbgColor&&(u.color=t.DbgColor),t.colorSpecular&&(u.specular=o(t.colorSpecular)),t.colorEmissive&&(u.emissive=o(t.colorEmissive)),void 0!==t.transparency&&(console.warn("THREE.Loader: transparency has been renamed to opacity"),t.opacity=t.transparency),void 0!==t.opacity&&(u.opacity=t.opacity),t.specularCoef&&(u.shininess=t.specularCoef),t.mapDiffuse&&n&&i(u,"map",t.mapDiffuse,t.mapDiffuseRepeat,t.mapDiffuseOffset,t.mapDiffuseWrap,t.mapDiffuseAnisotropy),t.mapLight&&n&&i(u,"lightMap",t.mapLight,t.mapLightRepeat,t.mapLightOffset,t.mapLightWrap,t.mapLightAnisotropy),t.mapBump&&n&&i(u,"bumpMap",t.mapBump,t.mapBumpRepeat,t.mapBumpOffset,t.mapBumpWrap,t.mapBumpAnisotropy),t.mapNormal&&n&&i(u,"normalMap",t.mapNormal,t.mapNormalRepeat,t.mapNormalOffset,t.mapNormalWrap,t.mapNormalAnisotropy),t.mapSpecular&&n&&i(u,"specularMap",t.mapSpecular,t.mapSpecularRepeat,t.mapSpecularOffset,t.mapSpecularWrap,t.mapSpecularAnisotropy),t.mapAlpha&&n&&i(u,"alphaMap",t.mapAlpha,t.mapAlphaRepeat,t.mapAlphaOffset,t.mapAlphaWrap,t.mapAlphaAnisotropy),t.mapBumpScale&&(u.bumpScale=t.mapBumpScale),t.mapNormalFactor&&(u.normalScale=new e.Vector2(t.mapNormalFactor,t.mapNormalFactor));var l=new e[s](u);return void 0!==t.DbgName&&(l.name=t.DbgName),l}},e.Loader.Handlers={handlers:[],add:function(e,t){this.handlers.push(e,t)},get:function(e){for(var t=0,n=this.handlers.length;n>t;t+=2){var r=this.handlers[t],i=this.handlers[t+1];if(r.test(e))return i}return null}},e.XHRLoader=function(t){this.manager=void 0!==t?t:e.DefaultLoadingManager},e.XHRLoader.prototype={constructor:e.XHRLoader,load:function(t,n,r,i){var o=this,a=e.Cache.get(t);if(void 0!==a)return n&&n(a),void 0;var s=new XMLHttpRequest;s.open("GET",t,!0),s.addEventListener("load",function(){e.Cache.add(t,this.response),n&&n(this.response),o.manager.itemEnd(t)},!1),void 0!==r&&s.addEventListener("progress",function(e){r(e)},!1),void 0!==i&&s.addEventListener("error",function(e){i(e)},!1),void 0!==this.crossOrigin&&(s.crossOrigin=this.crossOrigin),void 0!==this.responseType&&(s.responseType=this.responseType),s.send(null),o.manager.itemStart(t)},setResponseType:function(e){this.responseType=e},setCrossOrigin:function(e){this.crossOrigin=e}},e.ImageLoader=function(t){this.manager=void 0!==t?t:e.DefaultLoadingManager},e.ImageLoader.prototype={constructor:e.ImageLoader,load:function(t,n,r,i){var o=this,a=e.Cache.get(t);if(void 0!==a)return n(a),void 0;var s=document.createElement("img");return s.addEventListener("load",function(){e.Cache.add(t,this),n&&n(this),o.manager.itemEnd(t)},!1),void 0!==r&&s.addEventListener("progress",function(e){r(e)},!1),void 0!==i&&s.addEventListener("error",function(e){i(e)},!1),void 0!==this.crossOrigin&&(s.crossOrigin=this.crossOrigin),s.src=t,o.manager.itemStart(t),s},setCrossOrigin:function(e){this.crossOrigin=e}},e.JSONLoader=function(t){e.Loader.call(this,t),this.withCredentials=!1},e.JSONLoader.prototype=Object.create(e.Loader.prototype),e.JSONLoader.prototype.constructor=e.JSONLoader,e.JSONLoader.prototype.load=function(e,t,n){n=n&&"string"==typeof n?n:this.extractUrlBase(e),this.onLoadStart(),this.loadAjaxJSON(this,e,t,n)},e.JSONLoader.prototype.loadAjaxJSON=function(t,n,r,i,o){var a=new XMLHttpRequest,s=0;a.onreadystatechange=function(){if(a.readyState===a.DONE)if(200===a.status||0===a.status){if(a.responseText){var u=JSON.parse(a.responseText),c=u.metadata;if(void 0!==c){if("object"===c.type)return e.error("THREE.JSONLoader: "+n+" should be loaded with THREE.ObjectLoader instead."),void 0;if("scene"===c.type)return e.error("THREE.JSONLoader: "+n+" seems to be a Scene. Use THREE.SceneLoader instead."),void 0}var l=t.parse(u,i);r(l.geometry,l.materials)}else e.error("THREE.JSONLoader: "+n+" seems to be unreachable or the file is empty.");t.onLoadComplete()}else e.error("THREE.JSONLoader: Couldn't load "+n+" ("+a.status+")");else a.readyState===a.LOADING?o&&(0===s&&(s=a.getResponseHeader("Content-Length")),o({total:s,loaded:a.responseText.length})):a.readyState===a.HEADERS_RECEIVED&&void 0!==o&&(s=a.getResponseHeader("Content-Length"))},a.open("GET",n,!0),a.withCredentials=this.withCredentials,a.send(null)},e.JSONLoader.prototype.parse=function(t,n){function r(n){function r(e,t){return e&1<<t}var i,o,s,u,c,l,h,f,p,d,m,v,g,y,b,x,w,_,C,E,S,M,T,A,P,k,R,I=t.faces,D=t.vertices,B=t.normals,V=t.colors,L=0;if(void 0!==t.uvs){for(i=0;i<t.uvs.length;i++)t.uvs[i].length&&L++;for(i=0;L>i;i++)a.faceVertexUvs[i]=[]}for(u=0,c=D.length;c>u;)_=new e.Vector3,_.x=D[u++]*n,_.y=D[u++]*n,_.z=D[u++]*n,a.vertices.push(_);for(u=0,c=I.length;c>u;)if(d=I[u++],m=r(d,0),v=r(d,1),g=r(d,3),y=r(d,4),b=r(d,5),x=r(d,6),w=r(d,7),m){if(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,v&&(p=I[u++],E.materialIndex=p,S.materialIndex=p),s=a.faces.length,g)for(i=0;L>i;i++)for(A=t.uvs[i],a.faceVertexUvs[i][s]=[],a.faceVertexUvs[i][s+1]=[],o=0;4>o;o++)f=I[u++],k=A[2*f],R=A[2*f+1],P=new e.Vector2(k,R),2!==o&&a.faceVertexUvs[i][s].push(P),0!==o&&a.faceVertexUvs[i][s+1].push(P);if(y&&(h=3*I[u++],E.normal.set(B[h++],B[h++],B[h]),S.normal.copy(E.normal)),b)for(i=0;4>i;i++)h=3*I[u++],T=new e.Vector3(B[h++],B[h++],B[h]),2!==i&&E.vertexNormals.push(T),0!==i&&S.vertexNormals.push(T);if(x&&(l=I[u++],M=V[l],E.color.setHex(M),S.color.setHex(M)),w)for(i=0;4>i;i++)l=I[u++],M=V[l],2!==i&&E.vertexColors.push(new e.Color(M)),0!==i&&S.vertexColors.push(new e.Color(M));a.faces.push(E),a.faces.push(S)}else{if(C=new e.Face3,C.a=I[u++],C.b=I[u++],C.c=I[u++],v&&(p=I[u++],C.materialIndex=p),s=a.faces.length,g)for(i=0;L>i;i++)for(A=t.uvs[i],a.faceVertexUvs[i][s]=[],o=0;3>o;o++)f=I[u++],k=A[2*f],R=A[2*f+1],P=new e.Vector2(k,R),a.faceVertexUvs[i][s].push(P);if(y&&(h=3*I[u++],C.normal.set(B[h++],B[h++],B[h])),b)for(i=0;3>i;i++)h=3*I[u++],T=new e.Vector3(B[h++],B[h++],B[h]),C.vertexNormals.push(T);if(x&&(l=I[u++],C.color.setHex(V[l])),w)for(i=0;3>i;i++)l=I[u++],C.vertexColors.push(new e.Color(V[l]));a.faces.push(C)}}function i(){var n=void 0!==t.influencesPerVertex?t.influencesPerVertex:2;if(t.skinWeights)for(var r=0,i=t.skinWeights.length;i>r;r+=n){var o=t.skinWeights[r],s=n>1?t.skinWeights[r+1]:0,u=n>2?t.skinWeights[r+2]:0,c=n>3?t.skinWeights[r+3]:0;a.skinWeights.push(new e.Vector4(o,s,u,c))}if(t.skinIndices)for(var r=0,i=t.skinIndices.length;i>r;r+=n){var l=t.skinIndices[r],h=n>1?t.skinIndices[r+1]:0,f=n>2?t.skinIndices[r+2]:0,p=n>3?t.skinIndices[r+3]:0;a.skinIndices.push(new e.Vector4(l,h,f,p))}a.bones=t.bones,a.bones&&a.bones.length>0&&(a.skinWeights.length!==a.skinIndices.length||a.skinIndices.length!==a.vertices.length)&&e.warn("THREE.JSONLoader: When skinning, number of vertices ("+a.vertices.length+"), skinIndices ("+a.skinIndices.length+"), and skinWeights ("+a.skinWeights.length+") should match."),a.animation=t.animation,a.animations=t.animations}function o(n){if(void 0!==t.morphTargets){var r,i,o,s,u,c;for(r=0,i=t.morphTargets.length;i>r;r++)for(a.morphTargets[r]={},a.morphTargets[r].name=t.morphTargets[r].name,a.morphTargets[r].vertices=[],u=a.morphTargets[r].vertices,c=t.morphTargets[r].vertices,o=0,s=c.length;s>o;o+=3){var l=new e.Vector3;
l.x=c[o]*n,l.y=c[o+1]*n,l.z=c[o+2]*n,u.push(l)}}if(void 0!==t.morphColors){var r,i,h,f,p,d,m;for(r=0,i=t.morphColors.length;i>r;r++)for(a.morphColors[r]={},a.morphColors[r].name=t.morphColors[r].name,a.morphColors[r].colors=[],p=a.morphColors[r].colors,d=t.morphColors[r].colors,h=0,f=d.length;f>h;h+=3)m=new e.Color(16755200),m.setRGB(d[h],d[h+1],d[h+2]),p.push(m)}}var a=new e.Geometry,s=void 0!==t.scale?1/t.scale:1;if(r(s),i(),o(s),a.computeFaceNormals(),a.computeBoundingSphere(),void 0===t.materials||0===t.materials.length)return{geometry:a};var u=this.initMaterials(t.materials,n);return this.needsTangents(u)&&a.computeTangents(),{geometry:a,materials:u}},e.LoadingManager=function(e,t,n){var r=this,i=0,o=0;this.onLoad=e,this.onProgress=t,this.onError=n,this.itemStart=function(){o++},this.itemEnd=function(e){i++,void 0!==r.onProgress&&r.onProgress(e,i,o),i===o&&void 0!==r.onLoad&&r.onLoad()}},e.DefaultLoadingManager=new e.LoadingManager,e.BufferGeometryLoader=function(t){this.manager=void 0!==t?t:e.DefaultLoadingManager},e.BufferGeometryLoader.prototype={constructor:e.BufferGeometryLoader,load:function(t,n,r,i){var o=this,a=new e.XHRLoader(o.manager);a.setCrossOrigin(this.crossOrigin),a.load(t,function(e){n(o.parse(JSON.parse(e)))},r,i)},setCrossOrigin:function(e){this.crossOrigin=e},parse:function(t){var n=new e.BufferGeometry,r=t.data.attributes;for(var i in r){var o=r[i],a=new self[o.type](o.array);n.addAttribute(i,new e.BufferAttribute(a,o.itemSize))}var s=t.data.offsets;void 0!==s&&(n.offsets=JSON.parse(JSON.stringify(s)));var u=t.data.boundingSphere;if(void 0!==u){var c=new e.Vector3;void 0!==u.center&&c.fromArray(u.center),n.boundingSphere=new e.Sphere(c,u.radius)}return n}},e.MaterialLoader=function(t){this.manager=void 0!==t?t:e.DefaultLoadingManager},e.MaterialLoader.prototype={constructor:e.MaterialLoader,load:function(t,n,r,i){var o=this,a=new e.XHRLoader(o.manager);a.setCrossOrigin(this.crossOrigin),a.load(t,function(e){n(o.parse(JSON.parse(e)))},r,i)},setCrossOrigin:function(e){this.crossOrigin=e},parse:function(t){var n=new e[t.type];if(void 0!==t.color&&n.color.setHex(t.color),void 0!==t.emissive&&n.emissive.setHex(t.emissive),void 0!==t.specular&&n.specular.setHex(t.specular),void 0!==t.shininess&&(n.shininess=t.shininess),void 0!==t.uniforms&&(n.uniforms=t.uniforms),void 0!==t.vertexShader&&(n.vertexShader=t.vertexShader),void 0!==t.fragmentShader&&(n.fragmentShader=t.fragmentShader),void 0!==t.vertexColors&&(n.vertexColors=t.vertexColors),void 0!==t.shading&&(n.shading=t.shading),void 0!==t.blending&&(n.blending=t.blending),void 0!==t.side&&(n.side=t.side),void 0!==t.opacity&&(n.opacity=t.opacity),void 0!==t.transparent&&(n.transparent=t.transparent),void 0!==t.wireframe&&(n.wireframe=t.wireframe),void 0!==t.size&&(n.size=t.size),void 0!==t.sizeAttenuation&&(n.sizeAttenuation=t.sizeAttenuation),void 0!==t.materials)for(var r=0,i=t.materials.length;i>r;r++)n.materials.push(this.parse(t.materials[r]));return n}},e.ObjectLoader=function(t){this.manager=void 0!==t?t:e.DefaultLoadingManager,this.texturePath=""},e.ObjectLoader.prototype={constructor:e.ObjectLoader,load:function(t,n,r,i){""===this.texturePath&&(this.texturePath=t.substring(0,t.lastIndexOf("/")+1));var o=this,a=new e.XHRLoader(o.manager);a.setCrossOrigin(this.crossOrigin),a.load(t,function(e){o.parse(JSON.parse(e),n)},r,i)},setTexturePath:function(e){this.texturePath=e},setCrossOrigin:function(e){this.crossOrigin=e},parse:function(e,t){var n=this.parseGeometries(e.geometries),r=this.parseImages(e.images,function(){void 0!==t&&t(a)}),i=this.parseTextures(e.textures,r),o=this.parseMaterials(e.materials,i),a=this.parseObject(e.object,n,o);return(void 0===e.images||0===e.images.length)&&void 0!==t&&t(a),a},parseGeometries:function(t){var n={};if(void 0!==t)for(var r=new e.JSONLoader,i=new e.BufferGeometryLoader,o=0,a=t.length;a>o;o++){var s,u=t[o];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=r.parse(u.data).geometry}s.uuid=u.uuid,void 0!==u.name&&(s.name=u.name),n[u.uuid]=s}return n},parseMaterials:function(t,n){var r={};if(void 0!==t)for(var i=function(t){return void 0===n[t]&&e.warn("THREE.ObjectLoader: Undefined texture",t),n[t]},o=new e.MaterialLoader,a=0,s=t.length;s>a;a++){var u=t[a],c=o.parse(u);c.uuid=u.uuid,void 0!==u.name&&(c.name=u.name),void 0!==u.map&&(c.map=i(u.map)),void 0!==u.bumpMap&&(c.bumpMap=i(u.bumpMap),u.bumpScale&&(c.bumpScale=new e.Vector2(u.bumpScale,u.bumpScale))),void 0!==u.alphaMap&&(c.alphaMap=i(u.alphaMap)),void 0!==u.envMap&&(c.envMap=i(u.envMap)),void 0!==u.normalMap&&(c.normalMap=i(u.normalMap),u.normalScale&&(c.normalScale=new e.Vector2(u.normalScale,u.normalScale))),void 0!==u.lightMap&&(c.lightMap=i(u.lightMap)),void 0!==u.specularMap&&(c.specularMap=i(u.specularMap)),r[u.uuid]=c}return r},parseImages:function(t,n){var r=this,i={};if(void 0!==t&&t.length>0){var o=new e.LoadingManager(n),a=new e.ImageLoader(o);a.setCrossOrigin(this.crossOrigin);for(var s=function(e){return r.manager.itemStart(e),a.load(e,function(){r.manager.itemEnd(e)})},u=0,c=t.length;c>u;u++){var l=t[u],h=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(l.url)?l.url:r.texturePath+l.url;i[l.uuid]=s(h)}}return i},parseTextures:function(t,n){var r={};if(void 0!==t)for(var i=0,o=t.length;o>i;i++){var a=t[i];void 0===a.image&&e.warn('THREE.ObjectLoader: No "image" speficied for',a.uuid),void 0===n[a.image]&&e.warn("THREE.ObjectLoader: Undefined image",a.image);var s=new e.Texture(n[a.image]);s.needsUpdate=!0,s.uuid=a.uuid,void 0!==a.name&&(s.name=a.name),void 0!==a.repeat&&(s.repeat=new e.Vector2(a.repeat[0],a.repeat[1])),void 0!==a.minFilter&&(s.minFilter=e[a.minFilter]),void 0!==a.magFilter&&(s.magFilter=e[a.magFilter]),void 0!==a.anisotropy&&(s.anisotropy=a.anisotropy),a.wrap instanceof Array&&(s.wrapS=e[a.wrap[0]],s.wrapT=e[a.wrap[1]]),r[a.uuid]=s}return r},parseObject:function(){var t=new e.Matrix4;return function(n,r,i){var o,a=function(t){return void 0===r[t]&&e.warn("THREE.ObjectLoader: Undefined geometry",t),r[t]},s=function(t){return void 0===i[t]&&e.warn("THREE.ObjectLoader: Undefined material",t),i[t]};switch(n.type){case"Scene":o=new e.Scene;break;case"PerspectiveCamera":o=new e.PerspectiveCamera(n.fov,n.aspect,n.near,n.far);break;case"OrthographicCamera":o=new e.OrthographicCamera(n.left,n.right,n.top,n.bottom,n.near,n.far);break;case"AmbientLight":o=new e.AmbientLight(n.color);break;case"DirectionalLight":o=new e.DirectionalLight(n.color,n.intensity);break;case"PointLight":o=new e.PointLight(n.color,n.intensity,n.distance,n.decay);break;case"SpotLight":o=new e.SpotLight(n.color,n.intensity,n.distance,n.angle,n.exponent,n.decay);break;case"HemisphereLight":o=new e.HemisphereLight(n.color,n.groundColor,n.intensity);break;case"Mesh":o=new e.Mesh(a(n.geometry),s(n.material));break;case"Line":o=new e.Line(a(n.geometry),s(n.material),n.mode);break;case"PointCloud":o=new e.PointCloud(a(n.geometry),s(n.material));break;case"Sprite":o=new e.Sprite(s(n.material));break;case"Group":o=new e.Group;break;default:o=new e.Object3D}if(o.uuid=n.uuid,void 0!==n.name&&(o.name=n.name),void 0!==n.matrix?(t.fromArray(n.matrix),t.decompose(o.position,o.quaternion,o.scale)):(void 0!==n.position&&o.position.fromArray(n.position),void 0!==n.rotation&&o.rotation.fromArray(n.rotation),void 0!==n.scale&&o.scale.fromArray(n.scale)),void 0!==n.visible&&(o.visible=n.visible),void 0!==n.userData&&(o.userData=n.userData),void 0!==n.children)for(var u in n.children)o.add(this.parseObject(n.children[u],r,i));return o}}()},e.TextureLoader=function(t){this.manager=void 0!==t?t:e.DefaultLoadingManager},e.TextureLoader.prototype={constructor:e.TextureLoader,load:function(t,n,r,i){var o=this,a=new e.ImageLoader(o.manager);a.setCrossOrigin(this.crossOrigin),a.load(t,function(t){var r=new e.Texture(t);r.needsUpdate=!0,void 0!==n&&n(r)},r,i)},setCrossOrigin:function(e){this.crossOrigin=e}},e.DataTextureLoader=e.BinaryTextureLoader=function(){this._parser=null},e.BinaryTextureLoader.prototype={constructor:e.BinaryTextureLoader,load:function(t,n,r,i){var o=this,a=new e.DataTexture,s=new e.XHRLoader;return s.setResponseType("arraybuffer"),s.load(t,function(t){var r=o._parser(t);r&&(void 0!==r.image?a.image=r.image:void 0!==r.data&&(a.image.width=r.width,a.image.height=r.height,a.image.data=r.data),a.wrapS=void 0!==r.wrapS?r.wrapS:e.ClampToEdgeWrapping,a.wrapT=void 0!==r.wrapT?r.wrapT:e.ClampToEdgeWrapping,a.magFilter=void 0!==r.magFilter?r.magFilter:e.LinearFilter,a.minFilter=void 0!==r.minFilter?r.minFilter:e.LinearMipMapLinearFilter,a.anisotropy=void 0!==r.anisotropy?r.anisotropy:1,void 0!==r.format&&(a.format=r.format),void 0!==r.type&&(a.type=r.type),void 0!==r.mipmaps&&(a.mipmaps=r.mipmaps),1===r.mipmapCount&&(a.minFilter=e.LinearFilter),a.needsUpdate=!0,n&&n(a,r))},r,i),a}},e.CompressedTextureLoader=function(){this._parser=null},e.CompressedTextureLoader.prototype={constructor:e.CompressedTextureLoader,load:function(t,n){var r=this,i=[],o=new e.CompressedTexture;o.image=i;var a=new e.XHRLoader;if(a.setResponseType("arraybuffer"),t instanceof Array)for(var s=0,u=function(u){a.load(t[u],function(t){var a=r._parser(t,!0);i[u]={width:a.width,height:a.height,format:a.format,mipmaps:a.mipmaps},s+=1,6===s&&(1==a.mipmapCount&&(o.minFilter=e.LinearFilter),o.format=a.format,o.needsUpdate=!0,n&&n(o))})},c=0,l=t.length;l>c;++c)u(c);else a.load(t,function(t){var a=r._parser(t,!0);if(a.isCubemap)for(var s=a.mipmaps.length/a.mipmapCount,u=0;s>u;u++){i[u]={mipmaps:[]};for(var c=0;c<a.mipmapCount;c++)i[u].mipmaps.push(a.mipmaps[u*a.mipmapCount+c]),i[u].format=a.format,i[u].width=a.width,i[u].height=a.height}else o.image.width=a.width,o.image.height=a.height,o.mipmaps=a.mipmaps;1===a.mipmapCount&&(o.minFilter=e.LinearFilter),o.format=a.format,o.needsUpdate=!0,n&&n(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=!1,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=!0,this.depthWrite=!0,this.colorWrite=!0,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.alphaTest=0,this.overdraw=0,this.visible=!0,this._needsUpdate=!0},e.Material.prototype={constructor:e.Material,get needsUpdate(){return this._needsUpdate},set needsUpdate(e){e===!0&&this.update(),this._needsUpdate=e},setValues:function(t){if(void 0!==t)for(var n in t){var r=t[n];if(void 0!==r){if(n in this){var i=this[n];i instanceof e.Color?i.set(r):i instanceof e.Vector3&&r instanceof e.Vector3?i.copy(r):this[n]="overdraw"==n?Number(r):r}}else e.warn("THREE.Material: '"+n+"' parameter is undefined.")}},toJSON:function(){var t={metadata:{version:4.2,type:"material",generator:"MaterialExporter"},uuid:this.uuid,type:this.type};return""!==this.name&&(t.name=this.name),this instanceof e.MeshBasicMaterial?(t.color=this.color.getHex(),this.vertexColors!==e.NoColors&&(t.vertexColors=this.vertexColors),this.blending!==e.NormalBlending&&(t.blending=this.blending),this.side!==e.FrontSide&&(t.side=this.side)):this instanceof e.MeshLambertMaterial?(t.color=this.color.getHex(),t.emissive=this.emissive.getHex(),this.vertexColors!==e.NoColors&&(t.vertexColors=this.vertexColors),this.shading!==e.SmoothShading&&(t.shading=this.shading),this.blending!==e.NormalBlending&&(t.blending=this.blending),this.side!==e.FrontSide&&(t.side=this.side)):this instanceof e.MeshPhongMaterial?(t.color=this.color.getHex(),t.emissive=this.emissive.getHex(),t.specular=this.specular.getHex(),t.shininess=this.shininess,this.vertexColors!==e.NoColors&&(t.vertexColors=this.vertexColors),this.shading!==e.SmoothShading&&(t.shading=this.shading),this.blending!==e.NormalBlending&&(t.blending=this.blending),this.side!==e.FrontSide&&(t.side=this.side)):this instanceof e.MeshNormalMaterial?(this.blending!==e.NormalBlending&&(t.blending=this.blending),this.side!==e.FrontSide&&(t.side=this.side)):this instanceof e.MeshDepthMaterial?(this.blending!==e.NormalBlending&&(t.blending=this.blending),this.side!==e.FrontSide&&(t.side=this.side)):this instanceof e.PointCloudMaterial?(t.size=this.size,t.sizeAttenuation=this.sizeAttenuation,t.color=this.color.getHex(),this.vertexColors!==e.NoColors&&(t.vertexColors=this.vertexColors),this.blending!==e.NormalBlending&&(t.blending=this.blending)):this instanceof e.ShaderMaterial?(t.uniforms=this.uniforms,t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader):this instanceof e.SpriteMaterial&&(t.color=this.color.getHex()),this.opacity<1&&(t.opacity=this.opacity),this.transparent!==!1&&(t.transparent=this.transparent),this.wireframe!==!1&&(t.wireframe=this.wireframe),t},clone:function(t){return void 0===t&&(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,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=!0,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;return 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,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=!1,this.fog=!0,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;return 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,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=!0,this.shading=e.SmoothShading,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.vertexColors=e.NoColors,this.skinning=!1,this.morphTargets=!1,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;return 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,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=!1,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=!0,this.shading=e.SmoothShading,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.vertexColors=e.NoColors,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,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;return 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,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=!1,this.wrapAround=!1,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=!0,this.shading=e.SmoothShading,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.vertexColors=e.NoColors,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,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;return 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,t},e.MeshDepthMaterial=function(t){e.Material.call(this),this.type="MeshDepthMaterial",this.morphTargets=!1,this.wireframe=!1,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;return e.Material.prototype.clone.call(this,t),t.wireframe=this.wireframe,t.wireframeLinewidth=this.wireframeLinewidth,t},e.MeshNormalMaterial=function(t){e.Material.call(this,t),this.type="MeshNormalMaterial",this.wireframe=!1,this.wireframeLinewidth=1,this.morphTargets=!1,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;return e.Material.prototype.clone.call(this,t),t.wireframe=this.wireframe,t.wireframeLinewidth=this.wireframeLinewidth,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(){for(var e={metadata:{version:4.2,type:"material",generator:"MaterialExporter"},uuid:this.uuid,type:this.type,materials:[]},t=0,n=this.materials.length;n>t;t++)e.materials.push(this.materials[t].toJSON());return e},clone:function(){for(var t=new e.MeshFaceMaterial,n=0;n<this.materials.length;n++)t.materials.push(this.materials[n].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=!0,this.vertexColors=e.NoColors,this.fog=!0,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;return 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,t},e.ParticleBasicMaterial=function(t){return e.warn("THREE.ParticleBasicMaterial has been renamed to THREE.PointCloudMaterial."),new e.PointCloudMaterial(t)},e.ParticleSystemMaterial=function(t){return e.warn("THREE.ParticleSystemMaterial has been renamed to THREE.PointCloudMaterial."),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 gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",this.fragmentShader="void main() {\n gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );\n}",this.shading=e.SmoothShading,this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.vertexColors=e.NoColors,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv2:[0,0]},this.index0AttributeName=void 0,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;return 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,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;return e.ShaderMaterial.prototype.clone.call(this,t),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=!1,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;return e.Material.prototype.clone.call(this,t),t.color.copy(this.color),t.map=this.map,t.rotation=this.rotation,t.fog=this.fog,t},e.Texture=function(t,n,r,i,o,a,s,u,c){Object.defineProperty(this,"id",{value:e.TextureIdCount++}),this.uuid=e.Math.generateUUID(),this.name="",this.sourceFile="",this.image=void 0!==t?t:e.Texture.DEFAULT_IMAGE,this.mipmaps=[],this.mapping=void 0!==n?n:e.Texture.DEFAULT_MAPPING,this.wrapS=void 0!==r?r:e.ClampToEdgeWrapping,this.wrapT=void 0!==i?i:e.ClampToEdgeWrapping,this.magFilter=void 0!==o?o:e.LinearFilter,this.minFilter=void 0!==a?a:e.LinearMipMapLinearFilter,this.anisotropy=void 0!==c?c:1,this.format=void 0!==s?s:e.RGBAFormat,this.type=void 0!==u?u:e.UnsignedByteType,this.offset=new e.Vector2(0,0),this.repeat=new e.Vector2(1,1),this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this._needsUpdate=!1,this.onUpdate=null},e.Texture.DEFAULT_IMAGE=void 0,e.Texture.DEFAULT_MAPPING=e.UVMapping,e.Texture.prototype={constructor:e.Texture,get needsUpdate(){return this._needsUpdate},set needsUpdate(e){e===!0&&this.update(),this._needsUpdate=e},clone:function(t){return void 0===t&&(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,t.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,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,n,r,i,o,a,s,u,c){n=void 0!==n?n:e.CubeReflectionMapping,e.Texture.call(this,t,n,r,i,o,a,s,u,c),this.images=t},e.CubeTexture.prototype=Object.create(e.Texture.prototype),e.CubeTexture.prototype.constructor=e.CubeTexture,e.CubeTexture.clone=function(t){return void 0===t&&(t=new e.CubeTexture),e.Texture.prototype.clone.call(this,t),t.images=this.images,t},e.CompressedTexture=function(t,n,r,i,o,a,s,u,c,l,h){e.Texture.call(this,null,a,s,u,c,l,i,o,h),this.image={width:n,height:r},this.mipmaps=t,this.flipY=!1,this.generateMipmaps=!1},e.CompressedTexture.prototype=Object.create(e.Texture.prototype),e.CompressedTexture.prototype.constructor=e.CompressedTexture,e.CompressedTexture.prototype.clone=function(){var t=new e.CompressedTexture;return e.Texture.prototype.clone.call(this,t),t},e.DataTexture=function(t,n,r,i,o,a,s,u,c,l,h){e.Texture.call(this,null,a,s,u,c,l,i,o,h),this.image={data:t,width:n,height:r}},e.DataTexture.prototype=Object.create(e.Texture.prototype),e.DataTexture.prototype.constructor=e.DataTexture,e.DataTexture.prototype.clone=function(){var t=new e.DataTexture;return e.Texture.prototype.clone.call(this,t),t},e.VideoTexture=function(t,n,r,i,o,a,s,u,c){e.Texture.call(this,t,n,r,i,o,a,s,u,c),this.generateMipmaps=!1;var l=this,h=function(){requestAnimationFrame(h),t.readyState===t.HAVE_ENOUGH_DATA&&(l.needsUpdate=!0)};h()},e.VideoTexture.prototype=Object.create(e.Texture.prototype),e.VideoTexture.prototype.constructor=e.VideoTexture,e.Group=function(){e.Object3D.call(this),this.type="Group"},e.Group.prototype=Object.create(e.Object3D.prototype),e.Group.prototype.constructor=e.Group,e.PointCloud=function(t,n){e.Object3D.call(this),this.type="PointCloud",this.geometry=void 0!==t?t:new e.Geometry,this.material=void 0!==n?n:new e.PointCloudMaterial({color:16777215*Math.random()})},e.PointCloud.prototype=Object.create(e.Object3D.prototype),e.PointCloud.prototype.constructor=e.PointCloud,e.PointCloud.prototype.raycast=function(){var t=new e.Matrix4,n=new e.Ray;return function(r,i){var o=this,a=o.geometry,s=r.params.PointCloud.threshold;if(t.getInverse(this.matrixWorld),n.copy(r.ray).applyMatrix4(t),null===a.boundingBox||n.isIntersectionBox(a.boundingBox)!==!1){var u=s/((this.scale.x+this.scale.y+this.scale.z)/3),c=new e.Vector3,l=function(e,t){var a=n.distanceToPoint(e);if(u>a){var s=n.closestPointToPoint(e);s.applyMatrix4(o.matrixWorld);var c=r.ray.origin.distanceTo(s);i.push({distance:c,distanceToRay:a,point:s.clone(),index:t,face:null,object:o})}};if(a instanceof e.BufferGeometry){var h=a.attributes,f=h.position.array;if(void 0!==h.index){var p=h.index.array,d=a.offsets;if(0===d.length){var m={start:0,count:p.length,index:0};d=[m]}for(var v=0,g=d.length;g>v;++v)for(var y=d[v].start,b=d[v].count,x=d[v].index,w=y,_=y+b;_>w;w++){var C=x+p[w];c.fromArray(f,3*C),l(c,C)}}else for(var E=f.length/3,w=0;E>w;w++)c.set(f[3*w],f[3*w+1],f[3*w+2]),l(c,w)}else for(var S=this.geometry.vertices,w=0;w<S.length;w++)l(S[w],w)}}}(),e.PointCloud.prototype.clone=function(t){return void 0===t&&(t=new e.PointCloud(this.geometry,this.material)),e.Object3D.prototype.clone.call(this,t),t},e.ParticleSystem=function(t,n){return e.warn("THREE.ParticleSystem has been renamed to THREE.PointCloud."),new e.PointCloud(t,n)},e.Line=function(t,n,r){e.Object3D.call(this),this.type="Line",this.geometry=void 0!==t?t:new e.Geometry,this.material=void 0!==n?n:new e.LineBasicMaterial({color:16777215*Math.random()}),this.mode=void 0!==r?r:e.LineStrip},e.LineStrip=0,e.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,n=new e.Ray,r=new e.Sphere;return function(i,o){var a=i.linePrecision,s=a*a,u=this.geometry;if(null===u.boundingSphere&&u.computeBoundingSphere(),r.copy(u.boundingSphere),r.applyMatrix4(this.matrixWorld),i.ray.isIntersectionSphere(r)!==!1){t.getInverse(this.matrixWorld),n.copy(i.ray).applyMatrix4(t);var c=new e.Vector3,l=new e.Vector3,h=new e.Vector3,f=new e.Vector3,p=this.mode===e.LineStrip?1:2;if(u instanceof e.BufferGeometry){var d=u.attributes;if(void 0!==d.index){var m=d.index.array,v=d.position.array,g=u.offsets;0===g.length&&(g=[{start:0,count:m.length,index:0}]);for(var y=0;y<g.length;y++)for(var b=g[y].start,x=g[y].count,w=g[y].index,_=b;b+x-1>_;_+=p){var C=w+m[_],E=w+m[_+1];c.fromArray(v,3*C),l.fromArray(v,3*E);var S=n.distanceSqToSegment(c,l,f,h);if(!(S>s)){var M=n.origin.distanceTo(f);M<i.near||M>i.far||o.push({distance:M,point:h.clone().applyMatrix4(this.matrixWorld),index:_,offsetIndex:y,face:null,faceIndex:null,object:this})}}}else for(var v=d.position.array,_=0;_<v.length/3-1;_+=p){c.fromArray(v,3*_),l.fromArray(v,3*_+3);var S=n.distanceSqToSegment(c,l,f,h);if(!(S>s)){var M=n.origin.distanceTo(f);M<i.near||M>i.far||o.push({distance:M,point:h.clone().applyMatrix4(this.matrixWorld),index:_,face:null,faceIndex:null,object:this})}}}else if(u instanceof e.Geometry)for(var T=u.vertices,A=T.length,_=0;A-1>_;_+=p){var S=n.distanceSqToSegment(T[_],T[_+1],f,h);
if(!(S>s)){var M=n.origin.distanceTo(f);M<i.near||M>i.far||o.push({distance:M,point:h.clone().applyMatrix4(this.matrixWorld),index:_,face:null,faceIndex:null,object:this})}}}}}(),e.Line.prototype.clone=function(t){return void 0===t&&(t=new e.Line(this.geometry,this.material,this.mode)),e.Object3D.prototype.clone.call(this,t),t},e.Mesh=function(t,n){e.Object3D.call(this),this.type="Mesh",this.geometry=void 0!==t?t:new e.Geometry,this.material=void 0!==n?n:new e.MeshBasicMaterial({color:16777215*Math.random()}),this.updateMorphTargets()},e.Mesh.prototype=Object.create(e.Object3D.prototype),e.Mesh.prototype.constructor=e.Mesh,e.Mesh.prototype.updateMorphTargets=function(){if(void 0!==this.geometry.morphTargets&&this.geometry.morphTargets.length>0){this.morphTargetBase=-1,this.morphTargetForcedOrder=[],this.morphTargetInfluences=[],this.morphTargetDictionary={};for(var e=0,t=this.geometry.morphTargets.length;t>e;e++)this.morphTargetInfluences.push(0),this.morphTargetDictionary[this.geometry.morphTargets[e].name]=e}},e.Mesh.prototype.getMorphTargetIndexByName=function(t){return void 0!==this.morphTargetDictionary[t]?this.morphTargetDictionary[t]:(e.warn("THREE.Mesh.getMorphTargetIndexByName: morph target "+t+" does not exist. Returning 0."),0)},e.Mesh.prototype.raycast=function(){var t=new e.Matrix4,n=new e.Ray,r=new e.Sphere,i=new e.Vector3,o=new e.Vector3,a=new e.Vector3;return function(s,u){var c=this.geometry;if(null===c.boundingSphere&&c.computeBoundingSphere(),r.copy(c.boundingSphere),r.applyMatrix4(this.matrixWorld),s.ray.isIntersectionSphere(r)!==!1&&(t.getInverse(this.matrixWorld),n.copy(s.ray).applyMatrix4(t),null===c.boundingBox||n.isIntersectionBox(c.boundingBox)!==!1))if(c instanceof e.BufferGeometry){var l=this.material;if(void 0===l)return;var h,f,p,d=c.attributes,m=s.precision;if(void 0!==d.index){var v=d.index.array,g=d.position.array,y=c.offsets;0===y.length&&(y=[{start:0,count:v.length,index:0}]);for(var b=0,x=y.length;x>b;++b)for(var w=y[b].start,_=y[b].count,C=y[b].index,E=w,S=w+_;S>E;E+=3){if(h=C+v[E],f=C+v[E+1],p=C+v[E+2],i.fromArray(g,3*h),o.fromArray(g,3*f),a.fromArray(g,3*p),l.side===e.BackSide)var M=n.intersectTriangle(a,o,i,!0);else var M=n.intersectTriangle(i,o,a,l.side!==e.DoubleSide);if(null!==M){M.applyMatrix4(this.matrixWorld);var T=s.ray.origin.distanceTo(M);m>T||T<s.near||T>s.far||u.push({distance:T,point:M,face:new e.Face3(h,f,p,e.Triangle.normal(i,o,a)),faceIndex:null,object:this})}}}else for(var g=d.position.array,E=0,A=0,S=g.length;S>E;E+=3,A+=9){if(h=E,f=E+1,p=E+2,i.fromArray(g,A),o.fromArray(g,A+3),a.fromArray(g,A+6),l.side===e.BackSide)var M=n.intersectTriangle(a,o,i,!0);else var M=n.intersectTriangle(i,o,a,l.side!==e.DoubleSide);if(null!==M){M.applyMatrix4(this.matrixWorld);var T=s.ray.origin.distanceTo(M);m>T||T<s.near||T>s.far||u.push({distance:T,point:M,face:new e.Face3(h,f,p,e.Triangle.normal(i,o,a)),faceIndex:null,object:this})}}}else if(c instanceof e.Geometry)for(var h,f,p,P=this.material instanceof e.MeshFaceMaterial,k=P===!0?this.material.materials:null,m=s.precision,R=c.vertices,I=0,D=c.faces.length;D>I;I++){var B=c.faces[I],l=P===!0?k[B.materialIndex]:this.material;if(void 0!==l){if(h=R[B.a],f=R[B.b],p=R[B.c],l.morphTargets===!0){var V=c.morphTargets,L=this.morphTargetInfluences;i.set(0,0,0),o.set(0,0,0),a.set(0,0,0);for(var N=0,O=V.length;O>N;N++){var F=L[N];if(0!==F){var U=V[N].vertices;i.x+=(U[B.a].x-h.x)*F,i.y+=(U[B.a].y-h.y)*F,i.z+=(U[B.a].z-h.z)*F,o.x+=(U[B.b].x-f.x)*F,o.y+=(U[B.b].y-f.y)*F,o.z+=(U[B.b].z-f.z)*F,a.x+=(U[B.c].x-p.x)*F,a.y+=(U[B.c].y-p.y)*F,a.z+=(U[B.c].z-p.z)*F}}i.add(h),o.add(f),a.add(p),h=i,f=o,p=a}if(l.side===e.BackSide)var M=n.intersectTriangle(p,f,h,!0);else var M=n.intersectTriangle(h,f,p,l.side!==e.DoubleSide);if(null!==M){M.applyMatrix4(this.matrixWorld);var T=s.ray.origin.distanceTo(M);m>T||T<s.near||T>s.far||u.push({distance:T,point:M,face:B,faceIndex:I,object:this})}}}}}(),e.Mesh.prototype.clone=function(t,n){return void 0===t&&(t=new e.Mesh(this.geometry,this.material)),e.Object3D.prototype.clone.call(this,t,n),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,n,r){if(this.useVertexTexture=void 0!==r?r:!0,this.identityMatrix=new e.Matrix4,t=t||[],this.bones=t.slice(0),this.useVertexTexture){var i;i=this.bones.length>256?64:this.bones.length>64?32:this.bones.length>16?16: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=!1,this.boneTexture.flipY=!1}else this.boneMatrices=new Float32Array(16*this.bones.length);if(void 0===n)this.calculateInverses();else if(this.bones.length===n.length)this.boneInverses=n.slice(0);else{e.warn("THREE.Skeleton bonInverses is the wrong length."),this.boneInverses=[];for(var o=0,a=this.bones.length;a>o;o++)this.boneInverses.push(new e.Matrix4)}},e.Skeleton.prototype.calculateInverses=function(){this.boneInverses=[];for(var t=0,n=this.bones.length;n>t;t++){var r=new e.Matrix4;this.bones[t]&&r.getInverse(this.bones[t].matrixWorld),this.boneInverses.push(r)}},e.Skeleton.prototype.pose=function(){for(var e,t=0,n=this.bones.length;n>t;t++)e=this.bones[t],e&&e.matrixWorld.getInverse(this.boneInverses[t]);for(var t=0,n=this.bones.length;n>t;t++)e=this.bones[t],e&&(e.parent?(e.matrix.getInverse(e.parent.matrixWorld),e.matrix.multiply(e.matrixWorld)):e.matrix.copy(e.matrixWorld),e.matrix.decompose(e.position,e.quaternion,e.scale))},e.Skeleton.prototype.update=function(){var t=new e.Matrix4;return function(){for(var e=0,n=this.bones.length;n>e;e++){var r=this.bones[e]?this.bones[e].matrixWorld:this.identityMatrix;t.multiplyMatrices(r,this.boneInverses[e]),t.flattenToArrayOffset(this.boneMatrices,16*e)}this.useVertexTexture&&(this.boneTexture.needsUpdate=!0)}}(),e.SkinnedMesh=function(t,n,r){e.Mesh.call(this,t,n),this.type="SkinnedMesh",this.bindMode="attached",this.bindMatrix=new e.Matrix4,this.bindMatrixInverse=new e.Matrix4;var i=[];if(this.geometry&&void 0!==this.geometry.bones){for(var o,a,s,u,c,l=0,h=this.geometry.bones.length;h>l;++l)a=this.geometry.bones[l],s=a.pos,u=a.rotq,c=a.scl,o=new e.Bone(this),i.push(o),o.name=a.name,o.position.set(s[0],s[1],s[2]),o.quaternion.set(u[0],u[1],u[2],u[3]),void 0!==c?o.scale.set(c[0],c[1],c[2]):o.scale.set(1,1,1);for(var l=0,h=this.geometry.bones.length;h>l;++l)a=this.geometry.bones[l],-1!==a.parent?i[a.parent].add(i[l]):this.add(i[l])}this.normalizeSkinWeights(),this.updateMatrixWorld(!0),this.bind(new e.Skeleton(i,void 0,r))},e.SkinnedMesh.prototype=Object.create(e.Mesh.prototype),e.SkinnedMesh.prototype.constructor=e.SkinnedMesh,e.SkinnedMesh.prototype.bind=function(e,t){this.skeleton=e,void 0===t&&(this.updateMatrixWorld(!0),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 n=this.geometry.skinWeights[t],r=1/n.lengthManhattan();1/0!==r?n.multiplyScalar(r):n.set(1)}},e.SkinnedMesh.prototype.updateMatrixWorld=function(){e.Mesh.prototype.updateMatrixWorld.call(this,!0),"attached"===this.bindMode?this.bindMatrixInverse.getInverse(this.matrixWorld):"detached"===this.bindMode?this.bindMatrixInverse.getInverse(this.bindMatrix):e.warn("THREE.SkinnedMesh unreckognized bindMode: "+this.bindMode)},e.SkinnedMesh.prototype.clone=function(t){return void 0===t&&(t=new e.SkinnedMesh(this.geometry,this.material,this.useVertexTexture)),e.Mesh.prototype.clone.call(this,t),t},e.MorphAnimMesh=function(t,n){e.Mesh.call(this,t,n),this.type="MorphAnimMesh",this.duration=1e3,this.mirroredLoop=!1,this.time=0,this.lastKeyframe=0,this.currentKeyframe=0,this.direction=1,this.directionBackwards=!1,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=!1},e.MorphAnimMesh.prototype.setDirectionBackward=function(){this.direction=-1,this.directionBackwards=!0},e.MorphAnimMesh.prototype.parseAnimations=function(){var e=this.geometry;e.animations||(e.animations={});for(var t,n=e.animations,r=/([a-z]+)_?(\d+)/,i=0,o=e.morphTargets.length;o>i;i++){var a=e.morphTargets[i],s=a.name.match(r);if(s&&s.length>1){var u=s[1];n[u]||(n[u]={start:1/0,end:-1/0});var c=n[u];i<c.start&&(c.start=i),i>c.end&&(c.end=i),t||(t=u)}}e.firstAnimation=t},e.MorphAnimMesh.prototype.setAnimationLabel=function(e,t,n){this.geometry.animations||(this.geometry.animations={}),this.geometry.animations[e]={start:t,end:n}},e.MorphAnimMesh.prototype.playAnimation=function(t,n){var r=this.geometry.animations[t];r?(this.setFrameRange(r.start,r.end),this.duration=1e3*((r.end-r.start)/n),this.time=0):e.warn("THREE.MorphAnimMesh: animation["+t+"] undefined in .playAnimation()")},e.MorphAnimMesh.prototype.updateAnimation=function(t){var n=this.duration/this.length;this.time+=this.direction*t,this.mirroredLoop?(this.time>this.duration||this.time<0)&&(this.direction*=-1,this.time>this.duration&&(this.time=this.duration,this.directionBackwards=!0),this.time<0&&(this.time=0,this.directionBackwards=!1)):(this.time=this.time%this.duration,this.time<0&&(this.time+=this.duration));var r=this.startKeyframe+e.Math.clamp(Math.floor(this.time/n),0,this.length-1);r!==this.currentKeyframe&&(this.morphTargetInfluences[this.lastKeyframe]=0,this.morphTargetInfluences[this.currentKeyframe]=1,this.morphTargetInfluences[r]=0,this.lastKeyframe=this.currentKeyframe,this.currentKeyframe=r);var i=this.time%n/n;this.directionBackwards&&(i=1-i),this.morphTargetInfluences[this.currentKeyframe]=i,this.morphTargetInfluences[this.lastKeyframe]=1-i},e.MorphAnimMesh.prototype.interpolateTargets=function(e,t,n){for(var r=this.morphTargetInfluences,i=0,o=r.length;o>i;i++)r[i]=0;e>-1&&(r[e]=1-n),t>-1&&(r[t]=n)},e.MorphAnimMesh.prototype.clone=function(t){return void 0===t&&(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),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){void 0===t&&(t=0),t=Math.abs(t);for(var n=0;n<this.objects.length&&!(t<this.objects[n].distance);n++);this.objects.splice(n,0,{distance:t,object:e}),this.add(e)},e.LOD.prototype.getObjectForDistance=function(e){for(var t=1,n=this.objects.length;n>t&&!(e<this.objects[t].distance);t++);return this.objects[t-1].object},e.LOD.prototype.raycast=function(){var t=new e.Vector3;return function(e,n){t.setFromMatrixPosition(this.matrixWorld);var r=e.ray.origin.distanceTo(t);this.getObjectForDistance(r).raycast(e,n)}}(),e.LOD.prototype.update=function(){var t=new e.Vector3,n=new e.Vector3;return function(e){if(this.objects.length>1){t.setFromMatrixPosition(e.matrixWorld),n.setFromMatrixPosition(this.matrixWorld);var r=t.distanceTo(n);this.objects[0].object.visible=!0;for(var i=1,o=this.objects.length;o>i&&r>=this.objects[i].distance;i++)this.objects[i-1].object.visible=!1,this.objects[i].object.visible=!0;for(;o>i;i++)this.objects[i].object.visible=!1}}}(),e.LOD.prototype.clone=function(t){void 0===t&&(t=new e.LOD),e.Object3D.prototype.clone.call(this,t);for(var n=0,r=this.objects.length;r>n;n++){var i=this.objects[n].object.clone();i.visible=0===n,t.addLevel(i,this.objects[n].distance)}return t},e.Sprite=function(){var t=new Uint16Array([0,1,2,0,2,3]),n=new Float32Array([-.5,-.5,0,.5,-.5,0,.5,.5,0,-.5,.5,0]),r=new Float32Array([0,0,1,0,1,1,0,1]),i=new e.BufferGeometry;return i.addAttribute("index",new e.BufferAttribute(t,1)),i.addAttribute("position",new e.BufferAttribute(n,3)),i.addAttribute("uv",new e.BufferAttribute(r,2)),function(t){e.Object3D.call(this),this.type="Sprite",this.geometry=i,this.material=void 0!==t?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,n){t.setFromMatrixPosition(this.matrixWorld);var r=e.ray.distanceToPoint(t);r>this.scale.x||n.push({distance:r,point:this.position,face:null,object:this})}}(),e.Sprite.prototype.clone=function(t){return void 0===t&&(t=new e.Sprite(this.material)),e.Object3D.prototype.clone.call(this,t),t},e.Particle=e.Sprite,e.LensFlare=function(t,n,r,i,o){e.Object3D.call(this),this.lensFlares=[],this.positionScreen=new e.Vector3,this.customUpdateCallback=void 0,void 0!==t&&this.add(t,n,r,i,o)},e.LensFlare.prototype=Object.create(e.Object3D.prototype),e.LensFlare.prototype.constructor=e.LensFlare,e.LensFlare.prototype.add=function(t,n,r,i,o,a){void 0===n&&(n=-1),void 0===r&&(r=0),void 0===a&&(a=1),void 0===o&&(o=new e.Color(16777215)),void 0===i&&(i=e.NormalBlending),r=Math.min(r,Math.max(0,r)),this.lensFlares.push({texture:t,size:n,distance:r,x:0,y:0,z:0,scale:1,rotation:1,opacity:a,color:o,blending:i})},e.LensFlare.prototype.updateLensFlares=function(){var e,t,n=this.lensFlares.length,r=2*-this.positionScreen.x,i=2*-this.positionScreen.y;for(e=0;n>e;e++)t=this.lensFlares[e],t.x=this.positionScreen.x+r*t.distance,t.y=this.positionScreen.y+i*t.distance,t.wantedRotation=t.x*Math.PI*.25,t.rotation+=.25*(t.wantedRotation-t.rotation)},e.Scene=function(){e.Object3D.call(this),this.type="Scene",this.fog=null,this.overrideMaterial=null,this.autoUpdate=!0},e.Scene.prototype=Object.create(e.Object3D.prototype),e.Scene.prototype.constructor=e.Scene,e.Scene.prototype.clone=function(t){return void 0===t&&(t=new e.Scene),e.Object3D.prototype.clone.call(this,t),null!==this.fog&&(t.fog=this.fog.clone()),null!==this.overrideMaterial&&(t.overrideMaterial=this.overrideMaterial.clone()),t.autoUpdate=this.autoUpdate,t.matrixAutoUpdate=this.matrixAutoUpdate,t},e.Fog=function(t,n,r){this.name="",this.color=new e.Color(t),this.near=void 0!==n?n:1,this.far=void 0!==r?r:1e3},e.Fog.prototype.clone=function(){return new e.Fog(this.color.getHex(),this.near,this.far)},e.FogExp2=function(t,n){this.name="",this.color=new e.Color(t),this.density=void 0!==n?n: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 return 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 return normalize( ( vec4( normal, 0.0 ) * matrix ).xyz );\n}\nvec3 projectOnPlane(in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal) {\n float distance = dot( planeNormal, point-pointOnPlane );\n return point - distance * planeNormal;\n}\nfloat sideOfPlane( in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n return sign( dot( point - pointOnPlane, planeNormal ) );\n}\nvec3 linePlaneIntersect( in vec3 pointOnLine, in vec3 lineDirection, in vec3 pointOnPlane, in vec3 planeNormal ) {\n return pointOnLine + lineDirection * ( dot( planeNormal, pointOnPlane - pointOnLine ) / dot( planeNormal, lineDirection ) );\n}\nfloat calcLightAttenuation( float lightDistance, float cutoffDistance, float decayExponent ) {\n if ( decayExponent > 0.0 ) {\n return pow( saturate( 1.0 - lightDistance / cutoffDistance ), decayExponent );\n }\n return 1.0;\n}\n\nvec3 inputToLinear( in vec3 a ) {\n#ifdef GAMMA_INPUT\n return pow( a, vec3( float( GAMMA_FACTOR ) ) );\n#else\n return a;\n#endif\n}\nvec3 linearToOutput( in vec3 a ) {\n#ifdef GAMMA_OUTPUT\n return pow( a, vec3( 1.0 / float( GAMMA_FACTOR ) ) );\n#else\n return a;\n#endif\n}\n",e.ShaderChunk.alphatest_fragment="#ifdef ALPHATEST\n\n if ( diffuseColor.a < ALPHATEST ) discard;\n\n#endif\n",e.ShaderChunk.lights_lambert_vertex="vLightFront = vec3( 0.0 );\n\n#ifdef DOUBLE_SIDED\n\n vLightBack = 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 vec3 dirVector = transformDirection( directionalLightDirection[ i ], viewMatrix );\n\n float dotProduct = dot( transformedNormal, dirVector );\n vec3 directionalLightWeighting = vec3( max( dotProduct, 0.0 ) );\n\n #ifdef DOUBLE_SIDED\n\n vec3 directionalLightWeightingBack = vec3( max( -dotProduct, 0.0 ) );\n\n #ifdef WRAP_AROUND\n\n vec3 directionalLightWeightingHalfBack = vec3( max( -0.5 * dotProduct + 0.5, 0.0 ) );\n\n #endif\n\n #endif\n\n #ifdef WRAP_AROUND\n\n vec3 directionalLightWeightingHalf = vec3( max( 0.5 * dotProduct + 0.5, 0.0 ) );\n directionalLightWeighting = mix( directionalLightWeighting, directionalLightWeightingHalf, wrapRGB );\n\n #ifdef DOUBLE_SIDED\n\n directionalLightWeightingBack = mix( directionalLightWeightingBack, directionalLightWeightingHalfBack, wrapRGB );\n\n #endif\n\n #endif\n\n vLightFront += directionalLightColor[ i ] * directionalLightWeighting;\n\n #ifdef DOUBLE_SIDED\n\n vLightBack += directionalLightColor[ i ] * directionalLightWeightingBack;\n\n #endif\n\n}\n\n#endif\n\n#if MAX_POINT_LIGHTS > 0\n\n for( int i = 0; i < MAX_POINT_LIGHTS; i ++ ) {\n\n vec4 lPosition = viewMatrix * vec4( pointLightPosition[ i ], 1.0 );\n vec3 lVector = lPosition.xyz - mvPosition.xyz;\n\n float attenuation = calcLightAttenuation( length( lVector ), pointLightDistance[ i ], pointLightDecay[ i ] );\n\n lVector = normalize( lVector );\n float dotProduct = dot( transformedNormal, lVector );\n\n vec3 pointLightWeighting = vec3( max( dotProduct, 0.0 ) );\n\n #ifdef DOUBLE_SIDED\n\n vec3 pointLightWeightingBack = vec3( max( -dotProduct, 0.0 ) );\n\n #ifdef WRAP_AROUND\n\n vec3 pointLightWeightingHalfBack = vec3( max( -0.5 * dotProduct + 0.5, 0.0 ) );\n\n #endif\n\n #endif\n\n #ifdef WRAP_AROUND\n\n vec3 pointLightWeightingHalf = vec3( max( 0.5 * dotProduct + 0.5, 0.0 ) );\n pointLightWeighting = mix( pointLightWeighting, pointLightWeightingHalf, wrapRGB );\n\n #ifdef DOUBLE_SIDED\n\n pointLightWeightingBack = mix( pointLightWeightingBack, pointLightWeightingHalfBack, wrapRGB );\n\n #endif\n\n #endif\n\n vLightFront += pointLightColor[ i ] * pointLightWeighting * attenuation;\n\n #ifdef DOUBLE_SIDED\n\n vLightBack += pointLightColor[ i ] * pointLightWeightingBack * attenuation;\n\n #endif\n\n }\n\n#endif\n\n#if MAX_SPOT_LIGHTS > 0\n\n for( int i = 0; i < MAX_SPOT_LIGHTS; i ++ ) {\n\n vec4 lPosition = viewMatrix * vec4( spotLightPosition[ i ], 1.0 );\n vec3 lVector = lPosition.xyz - mvPosition.xyz;\n\n float spotEffect = dot( spotLightDirection[ i ], normalize( spotLightPosition[ i ] - worldPosition.xyz ) );\n\n if ( spotEffect > spotLightAngleCos[ i ] ) {\n\n spotEffect = max( pow( max( spotEffect, 0.0 ), spotLightExponent[ i ] ), 0.0 );\n\n float attenuation = calcLightAttenuation( length( lVector ), spotLightDistance[ i ], spotLightDecay[ i ] );\n\n lVector = normalize( lVector );\n\n float dotProduct = dot( transformedNormal, lVector );\n vec3 spotLightWeighting = vec3( max( dotProduct, 0.0 ) );\n\n #ifdef DOUBLE_SIDED\n\n vec3 spotLightWeightingBack = vec3( max( -dotProduct, 0.0 ) );\n\n #ifdef WRAP_AROUND\n\n vec3 spotLightWeightingHalfBack = vec3( max( -0.5 * dotProduct + 0.5, 0.0 ) );\n\n #endif\n\n #endif\n\n #ifdef WRAP_AROUND\n\n vec3 spotLightWeightingHalf = vec3( max( 0.5 * dotProduct + 0.5, 0.0 ) );\n spotLightWeighting = mix( spotLightWeighting, spotLightWeightingHalf, wrapRGB );\n\n #ifdef DOUBLE_SIDED\n\n spotLightWeightingBack = mix( spotLightWeightingBack, spotLightWeightingHalfBack, wrapRGB );\n\n #endif\n\n #endif\n\n vLightFront += spotLightColor[ i ] * spotLightWeighting * attenuation * spotEffect;\n\n #ifdef DOUBLE_SIDED\n\n vLightBack += spotLightColor[ i ] * spotLightWeightingBack * attenuation * spotEffect;\n\n #endif\n\n }\n\n }\n\n#endif\n\n#if MAX_HEMI_LIGHTS > 0\n\n for( int i = 0; i < MAX_HEMI_LIGHTS; i ++ ) {\n\n vec3 lVector = transformDirection( hemisphereLightDirection[ i ], viewMatrix );\n\n float dotProduct = dot( transformedNormal, lVector );\n\n float hemiDiffuseWeight = 0.5 * dotProduct + 0.5;\n float hemiDiffuseWeightBack = -0.5 * dotProduct + 0.5;\n\n vLightFront += mix( hemisphereLightGroundColor[ i ], hemisphereLightSkyColor[ i ], hemiDiffuseWeight );\n\n #ifdef DOUBLE_SIDED\n\n vLightBack += mix( hemisphereLightGroundColor[ i ], hemisphereLightSkyColor[ i ], hemiDiffuseWeightBack );\n\n #endif\n\n }\n\n#endif\n\nvLightFront += ambientLightColor;\n\n#ifdef DOUBLE_SIDED\n\n vLightBack += ambientLightColor;\n\n#endif\n",e.ShaderChunk.map_particle_pars_fragment="#ifdef USE_MAP\n\n uniform vec4 offsetRepeat;\n uniform sampler2D map;\n\n#endif\n",e.ShaderChunk.default_vertex="#ifdef USE_SKINNING\n\n vec4 mvPosition = modelViewMatrix * skinned;\n\n#elif defined( USE_MORPHTARGETS )\n\n vec4 mvPosition = modelViewMatrix * vec4( morphed, 1.0 );\n\n#else\n\n vec4 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 varying vec2 vUv;\n\n#endif\n\n#ifdef USE_MAP\n\n uniform sampler2D map;\n\n#endif",e.ShaderChunk.skinnormal_vertex="#ifdef USE_SKINNING\n\n mat4 skinMatrix = mat4( 0.0 );\n skinMatrix += skinWeight.x * boneMatX;\n skinMatrix += skinWeight.y * boneMatY;\n skinMatrix += skinWeight.z * boneMatZ;\n skinMatrix += skinWeight.w * boneMatW;\n skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;\n\n #ifdef USE_MORPHNORMALS\n\n vec4 skinnedNormal = skinMatrix * vec4( morphedNormal, 0.0 );\n\n #else\n\n vec4 skinnedNormal = skinMatrix * vec4( normal, 0.0 );\n\n #endif\n\n#endif\n",e.ShaderChunk.logdepthbuf_pars_vertex="#ifdef USE_LOGDEPTHBUF\n\n #ifdef USE_LOGDEPTHBUF_EXT\n\n varying float vFragDepth;\n\n #endif\n\n uniform float logDepthBufFC;\n\n#endif",e.ShaderChunk.lightmap_pars_vertex="#ifdef USE_LIGHTMAP\n\n varying vec2 vUv2;\n\n#endif",e.ShaderChunk.lights_phong_fragment="#ifndef FLAT_SHADED\n\n vec3 normal = normalize( vNormal );\n\n #ifdef DOUBLE_SIDED\n\n normal = normal * ( -1.0 + 2.0 * float( gl_FrontFacing ) );\n\n #endif\n\n#else\n\n vec3 fdx = dFdx( vViewPosition );\n vec3 fdy = dFdy( vViewPosition );\n vec3 normal = normalize( cross( fdx, fdy ) );\n\n#endif\n\nvec3 viewPosition = normalize( vViewPosition );\n\n#ifdef USE_NORMALMAP\n\n normal = perturbNormal2Arb( -vViewPosition, normal );\n\n#elif defined( USE_BUMPMAP )\n\n normal = 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 for ( int i = 0; i < MAX_POINT_LIGHTS; i ++ ) {\n\n vec4 lPosition = viewMatrix * vec4( pointLightPosition[ i ], 1.0 );\n vec3 lVector = lPosition.xyz + vViewPosition.xyz;\n\n float attenuation = calcLightAttenuation( length( lVector ), pointLightDistance[ i ], pointLightDecay[ i ] );\n\n lVector = normalize( lVector );\n\n // diffuse\n\n float dotProduct = dot( normal, lVector );\n\n #ifdef WRAP_AROUND\n\n float pointDiffuseWeightFull = max( dotProduct, 0.0 );\n float pointDiffuseWeightHalf = max( 0.5 * dotProduct + 0.5, 0.0 );\n\n vec3 pointDiffuseWeight = mix( vec3( pointDiffuseWeightFull ), vec3( pointDiffuseWeightHalf ), wrapRGB );\n\n #else\n\n float pointDiffuseWeight = max( dotProduct, 0.0 );\n\n #endif\n\n totalDiffuseLight += pointLightColor[ i ] * pointDiffuseWeight * attenuation;\n\n // specular\n\n vec3 pointHalfVector = normalize( lVector + viewPosition );\n float pointDotNormalHalf = max( dot( normal, pointHalfVector ), 0.0 );\n float pointSpecularWeight = specularStrength * max( pow( pointDotNormalHalf, shininess ), 0.0 );\n\n float specularNormalization = ( shininess + 2.0 ) / 8.0;\n\n vec3 schlick = specular + vec3( 1.0 - specular ) * pow( max( 1.0 - dot( lVector, pointHalfVector ), 0.0 ), 5.0 );\n totalSpecularLight += schlick * pointLightColor[ i ] * pointSpecularWeight * pointDiffuseWeight * attenuation * specularNormalization;\n\n }\n\n#endif\n\n#if MAX_SPOT_LIGHTS > 0\n\n for ( int i = 0; i < MAX_SPOT_LIGHTS; i ++ ) {\n\n vec4 lPosition = viewMatrix * vec4( spotLightPosition[ i ], 1.0 );\n vec3 lVector = lPosition.xyz + vViewPosition.xyz;\n\n float attenuation = calcLightAttenuation( length( lVector ), spotLightDistance[ i ], spotLightDecay[ i ] );\n\n lVector = normalize( lVector );\n\n float spotEffect = dot( spotLightDirection[ i ], normalize( spotLightPosition[ i ] - vWorldPosition ) );\n\n if ( spotEffect > spotLightAngleCos[ i ] ) {\n\n spotEffect = max( pow( max( spotEffect, 0.0 ), spotLightExponent[ i ] ), 0.0 );\n\n // diffuse\n\n float dotProduct = dot( normal, lVector );\n\n #ifdef WRAP_AROUND\n\n float spotDiffuseWeightFull = max( dotProduct, 0.0 );\n float spotDiffuseWeightHalf = max( 0.5 * dotProduct + 0.5, 0.0 );\n\n vec3 spotDiffuseWeight = mix( vec3( spotDiffuseWeightFull ), vec3( spotDiffuseWeightHalf ), wrapRGB );\n\n #else\n\n float spotDiffuseWeight = max( dotProduct, 0.0 );\n\n #endif\n\n totalDiffuseLight += spotLightColor[ i ] * spotDiffuseWeight * attenuation * spotEffect;\n\n // specular\n\n vec3 spotHalfVector = normalize( lVector + viewPosition );\n float spotDotNormalHalf = max( dot( normal, spotHalfVector ), 0.0 );\n float spotSpecularWeight = specularStrength * max( pow( spotDotNormalHalf, shininess ), 0.0 );\n\n float specularNormalization = ( shininess + 2.0 ) / 8.0;\n\n vec3 schlick = specular + vec3( 1.0 - specular ) * pow( max( 1.0 - dot( lVector, spotHalfVector ), 0.0 ), 5.0 );\n totalSpecularLight += schlick * spotLightColor[ i ] * spotSpecularWeight * spotDiffuseWeight * attenuation * specularNormalization * spotEffect;\n\n }\n\n }\n\n#endif\n\n#if MAX_DIR_LIGHTS > 0\n\n for( int i = 0; i < MAX_DIR_LIGHTS; i ++ ) {\n\n vec3 dirVector = transformDirection( directionalLightDirection[ i ], viewMatrix );\n\n // diffuse\n\n float dotProduct = dot( normal, dirVector );\n\n #ifdef WRAP_AROUND\n\n float dirDiffuseWeightFull = max( dotProduct, 0.0 );\n float dirDiffuseWeightHalf = max( 0.5 * dotProduct + 0.5, 0.0 );\n\n vec3 dirDiffuseWeight = mix( vec3( dirDiffuseWeightFull ), vec3( dirDiffuseWeightHalf ), wrapRGB );\n\n #else\n\n float dirDiffuseWeight = max( dotProduct, 0.0 );\n\n #endif\n\n totalDiffuseLight += directionalLightColor[ i ] * dirDiffuseWeight;\n\n // specular\n\n vec3 dirHalfVector = normalize( dirVector + viewPosition );\n float dirDotNormalHalf = max( dot( normal, dirHalfVector ), 0.0 );\n float dirSpecularWeight = specularStrength * max( pow( dirDotNormalHalf, shininess ), 0.0 );\n\n /*\n // fresnel term from skin shader\n const float F0 = 0.128;\n\n float base = 1.0 - dot( viewPosition, dirHalfVector );\n float exponential = pow( base, 5.0 );\n\n float fresnel = exponential + F0 * ( 1.0 - exponential );\n */\n\n /*\n // fresnel term from fresnel shader\n const float mFresnelBias = 0.08;\n const float mFresnelScale = 0.3;\n const float mFresnelPower = 5.0;\n\n float fresnel = mFresnelBias + mFresnelScale * pow( 1.0 + dot( normalize( -viewPosition ), normal ), mFresnelPower );\n */\n\n float specularNormalization = ( shininess + 2.0 ) / 8.0;\n\n // dirSpecular += specular * directionalLightColor[ i ] * dirSpecularWeight * dirDiffuseWeight * specularNormalization * fresnel;\n\n vec3 schlick = specular + vec3( 1.0 - specular ) * pow( max( 1.0 - dot( dirVector, dirHalfVector ), 0.0 ), 5.0 );\n totalSpecularLight += schlick * directionalLightColor[ i ] * dirSpecularWeight * dirDiffuseWeight * specularNormalization;\n\n\n }\n\n#endif\n\n#if MAX_HEMI_LIGHTS > 0\n\n for( int i = 0; i < MAX_HEMI_LIGHTS; i ++ ) {\n\n vec3 lVector = transformDirection( hemisphereLightDirection[ i ], viewMatrix );\n\n // diffuse\n\n float dotProduct = dot( normal, lVector );\n float hemiDiffuseWeight = 0.5 * dotProduct + 0.5;\n\n vec3 hemiColor = mix( hemisphereLightGroundColor[ i ], hemisphereLightSkyColor[ i ], hemiDiffuseWeight );\n\n totalDiffuseLight += hemiColor;\n\n // specular (sky light)\n\n vec3 hemiHalfVectorSky = normalize( lVector + viewPosition );\n float hemiDotNormalHalfSky = 0.5 * dot( normal, hemiHalfVectorSky ) + 0.5;\n float hemiSpecularWeightSky = specularStrength * max( pow( max( hemiDotNormalHalfSky, 0.0 ), shininess ), 0.0 );\n\n // specular (ground light)\n\n vec3 lVectorGround = -lVector;\n\n vec3 hemiHalfVectorGround = normalize( lVectorGround + viewPosition );\n float hemiDotNormalHalfGround = 0.5 * dot( normal, hemiHalfVectorGround ) + 0.5;\n float hemiSpecularWeightGround = specularStrength * max( pow( max( hemiDotNormalHalfGround, 0.0 ), shininess ), 0.0 );\n\n float dotProductGround = dot( normal, lVectorGround );\n\n float specularNormalization = ( shininess + 2.0 ) / 8.0;\n\n vec3 schlickSky = specular + vec3( 1.0 - specular ) * pow( max( 1.0 - dot( lVector, hemiHalfVectorSky ), 0.0 ), 5.0 );\n vec3 schlickGround = specular + vec3( 1.0 - specular ) * pow( max( 1.0 - dot( lVectorGround, hemiHalfVectorGround ), 0.0 ), 5.0 );\n totalSpecularLight += hemiColor * specularNormalization * ( schlickSky * hemiSpecularWeightSky * max( dotProduct, 0.0 ) + schlickGround * hemiSpecularWeightGround * max( dotProductGround, 0.0 ) );\n\n }\n\n#endif\n\n#ifdef METAL\n\n outgoingLight += diffuseColor.rgb * ( totalDiffuseLight + ambientLightColor ) * specular + totalSpecularLight + emissive;\n\n#else\n\n outgoingLight += diffuseColor.rgb * ( totalDiffuseLight + ambientLightColor ) + totalSpecularLight + emissive;\n\n#endif\n",e.ShaderChunk.fog_pars_fragment="#ifdef USE_FOG\n\n uniform vec3 fogColor;\n\n #ifdef FOG_EXP2\n\n uniform float fogDensity;\n\n #else\n\n uniform float fogNear;\n uniform float fogFar;\n #endif\n\n#endif",e.ShaderChunk.morphnormal_vertex="#ifdef USE_MORPHNORMALS\n\n vec3 morphedNormal = vec3( 0.0 );\n\n morphedNormal += ( morphNormal0 - normal ) * morphTargetInfluences[ 0 ];\n morphedNormal += ( morphNormal1 - normal ) * morphTargetInfluences[ 1 ];\n morphedNormal += ( morphNormal2 - normal ) * morphTargetInfluences[ 2 ];\n morphedNormal += ( morphNormal3 - normal ) * morphTargetInfluences[ 3 ];\n\n morphedNormal += normal;\n\n#endif",e.ShaderChunk.envmap_pars_fragment="#ifdef USE_ENVMAP\n\n uniform float reflectivity;\n #ifdef ENVMAP_TYPE_CUBE\n uniform samplerCube envMap;\n #else\n uniform sampler2D envMap;\n #endif\n uniform float flipEnvMap;\n\n #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\n uniform float refractionRatio;\n\n #else\n\n varying vec3 vReflect;\n\n #endif\n\n#endif\n",e.ShaderChunk.logdepthbuf_fragment="#if defined(USE_LOGDEPTHBUF) && defined(USE_LOGDEPTHBUF_EXT)\n\n gl_FragDepthEXT = log2(vFragDepth) * logDepthBufFC * 0.5;\n\n#endif",e.ShaderChunk.normalmap_pars_fragment="#ifdef USE_NORMALMAP\n\n uniform sampler2D normalMap;\n uniform vec2 normalScale;\n\n // Per-Pixel Tangent Space Normal Mapping\n // http://hacksoflife.blogspot.ch/2009/11/per-pixel-tangent-space-normal-mapping.html\n\n vec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm ) {\n\n vec3 q0 = dFdx( eye_pos.xyz );\n vec3 q1 = dFdy( eye_pos.xyz );\n vec2 st0 = dFdx( vUv.st );\n vec2 st1 = dFdy( vUv.st );\n\n vec3 S = normalize( q0 * st1.t - q1 * st0.t );\n vec3 T = normalize( -q0 * st1.s + q1 * st0.s );\n vec3 N = normalize( surf_norm );\n\n vec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n mapN.xy = normalScale * mapN.xy;\n mat3 tsn = mat3( S, T, N );\n return normalize( tsn * mapN );\n\n }\n\n#endif\n",e.ShaderChunk.lights_phong_pars_vertex="#if MAX_SPOT_LIGHTS > 0 || defined( USE_BUMPMAP ) || defined( USE_ENVMAP )\n\n varying vec3 vWorldPosition;\n\n#endif\n",e.ShaderChunk.lightmap_pars_fragment="#ifdef USE_LIGHTMAP\n\n varying vec2 vUv2;\n uniform sampler2D lightMap;\n\n#endif",e.ShaderChunk.shadowmap_vertex="#ifdef USE_SHADOWMAP\n\n for( int i = 0; i < MAX_SHADOWS; i ++ ) {\n\n vShadowCoord[ i ] = shadowMatrix[ i ] * worldPosition;\n\n }\n\n#endif",e.ShaderChunk.lights_phong_vertex="#if MAX_SPOT_LIGHTS > 0 || defined( USE_BUMPMAP ) || defined( USE_ENVMAP )\n\n vWorldPosition = worldPosition.xyz;\n\n#endif",e.ShaderChunk.map_fragment="#ifdef USE_MAP\n\n vec4 texelColor = texture2D( map, vUv );\n\n texelColor.xyz = inputToLinear( texelColor.xyz );\n\n diffuseColor *= texelColor;\n\n#endif",e.ShaderChunk.lightmap_vertex="#ifdef USE_LIGHTMAP\n\n vUv2 = uv2;\n\n#endif",e.ShaderChunk.map_particle_fragment="#ifdef USE_MAP\n\n diffuseColor *= 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 varying vec3 vColor;\n\n#endif\n",e.ShaderChunk.color_vertex="#ifdef USE_COLOR\n\n vColor.xyz = inputToLinear( color.xyz );\n\n#endif",e.ShaderChunk.skinning_vertex="#ifdef USE_SKINNING\n\n #ifdef USE_MORPHTARGETS\n\n vec4 skinVertex = bindMatrix * vec4( morphed, 1.0 );\n\n #else\n\n vec4 skinVertex = bindMatrix * vec4( position, 1.0 );\n\n #endif\n\n vec4 skinned = vec4( 0.0 );\n skinned += boneMatX * skinVertex * skinWeight.x;\n skinned += boneMatY * skinVertex * skinWeight.y;\n skinned += boneMatZ * skinVertex * skinWeight.z;\n skinned += boneMatW * skinVertex * skinWeight.w;\n skinned = bindMatrixInverse * skinned;\n\n#endif\n",e.ShaderChunk.envmap_pars_vertex="#if defined( USE_ENVMAP ) && ! defined( USE_BUMPMAP ) && ! defined( USE_NORMALMAP ) && ! defined( PHONG )\n\n varying vec3 vReflect;\n\n uniform float refractionRatio;\n\n#endif\n",e.ShaderChunk.linear_to_gamma_fragment="\n outgoingLight = linearToOutput( outgoingLight );\n",e.ShaderChunk.color_pars_vertex="#ifdef USE_COLOR\n\n varying vec3 vColor;\n\n#endif",e.ShaderChunk.lights_lambert_pars_vertex="uniform vec3 ambientLightColor;\n\n#if MAX_DIR_LIGHTS > 0\n\n uniform vec3 directionalLightColor[ MAX_DIR_LIGHTS ];\n uniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\n\n#endif\n\n#if MAX_HEMI_LIGHTS > 0\n\n uniform vec3 hemisphereLightSkyColor[ MAX_HEMI_LIGHTS ];\n uniform vec3 hemisphereLightGroundColor[ MAX_HEMI_LIGHTS ];\n uniform vec3 hemisphereLightDirection[ MAX_HEMI_LIGHTS ];\n\n#endif\n\n#if MAX_POINT_LIGHTS > 0\n\n uniform vec3 pointLightColor[ MAX_POINT_LIGHTS ];\n uniform vec3 pointLightPosition[ MAX_POINT_LIGHTS ];\n uniform float pointLightDistance[ MAX_POINT_LIGHTS ];\n uniform float pointLightDecay[ MAX_POINT_LIGHTS ];\n\n#endif\n\n#if MAX_SPOT_LIGHTS > 0\n\n uniform vec3 spotLightColor[ MAX_SPOT_LIGHTS ];\n uniform vec3 spotLightPosition[ MAX_SPOT_LIGHTS ];\n uniform vec3 spotLightDirection[ MAX_SPOT_LIGHTS ];\n uniform float spotLightDistance[ MAX_SPOT_LIGHTS ];\n uniform float spotLightAngleCos[ MAX_SPOT_LIGHTS ];\n uniform float spotLightExponent[ MAX_SPOT_LIGHTS ];\n uniform float spotLightDecay[ MAX_SPOT_LIGHTS ];\n\n#endif\n\n#ifdef WRAP_AROUND\n\n uniform 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 varying vec2 vUv;\n uniform vec4 offsetRepeat;\n\n#endif\n",e.ShaderChunk.envmap_fragment="#ifdef USE_ENVMAP\n\n #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\n vec3 cameraToVertex = normalize( vWorldPosition - cameraPosition );\n\n // Transforming Normal Vectors with the Inverse Transformation\n vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\n #ifdef ENVMAP_MODE_REFLECTION\n\n vec3 reflectVec = reflect( cameraToVertex, worldNormal );\n\n #else\n\n vec3 reflectVec = refract( cameraToVertex, worldNormal, refractionRatio );\n\n #endif\n\n #else\n\n vec3 reflectVec = vReflect;\n\n #endif\n\n #ifdef DOUBLE_SIDED\n float flipNormal = ( -1.0 + 2.0 * float( gl_FrontFacing ) );\n #else\n float flipNormal = 1.0;\n #endif\n\n #ifdef ENVMAP_TYPE_CUBE\n vec4 envColor = textureCube( envMap, flipNormal * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n\n #elif defined( ENVMAP_TYPE_EQUIREC )\n vec2 sampleUV;\n sampleUV.y = saturate( flipNormal * reflectVec.y * 0.5 + 0.5 );\n sampleUV.x = atan( flipNormal * reflectVec.z, flipNormal * reflectVec.x ) * RECIPROCAL_PI2 + 0.5;\n vec4 envColor = texture2D( envMap, sampleUV );\n\n #elif defined( ENVMAP_TYPE_SPHERE )\n vec3 reflectView = flipNormal * normalize((viewMatrix * vec4( reflectVec, 0.0 )).xyz + vec3(0.0,0.0,1.0));\n vec4 envColor = texture2D( envMap, reflectView.xy * 0.5 + 0.5 );\n #endif\n\n envColor.xyz = inputToLinear( envColor.xyz );\n\n #ifdef ENVMAP_BLENDING_MULTIPLY\n\n outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n\n #elif defined( ENVMAP_BLENDING_MIX )\n\n outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n\n #elif defined( ENVMAP_BLENDING_ADD )\n\n outgoingLight += envColor.xyz * specularStrength * reflectivity;\n\n #endif\n\n#endif\n",e.ShaderChunk.specularmap_pars_fragment="#ifdef USE_SPECULARMAP\n\n uniform sampler2D specularMap;\n\n#endif",e.ShaderChunk.logdepthbuf_vertex="#ifdef USE_LOGDEPTHBUF\n\n gl_Position.z = log2(max( EPSILON, gl_Position.w + 1.0 )) * logDepthBufFC;\n\n #ifdef USE_LOGDEPTHBUF_EXT\n\n vFragDepth = 1.0 + gl_Position.w;\n\n#else\n\n gl_Position.z = (gl_Position.z - 1.0) * gl_Position.w;\n\n #endif\n\n#endif",e.ShaderChunk.morphtarget_pars_vertex="#ifdef USE_MORPHTARGETS\n\n #ifndef USE_MORPHNORMALS\n\n uniform float morphTargetInfluences[ 8 ];\n\n #else\n\n uniform float morphTargetInfluences[ 4 ];\n\n #endif\n\n#endif",e.ShaderChunk.specularmap_fragment="float specularStrength;\n\n#ifdef USE_SPECULARMAP\n\n vec4 texelSpecular = texture2D( specularMap, vUv );\n specularStrength = texelSpecular.r;\n\n#else\n\n specularStrength = 1.0;\n\n#endif",e.ShaderChunk.fog_fragment="#ifdef USE_FOG\n\n #ifdef USE_LOGDEPTHBUF_EXT\n\n float depth = gl_FragDepthEXT / gl_FragCoord.w;\n\n #else\n\n float depth = gl_FragCoord.z / gl_FragCoord.w;\n\n #endif\n\n #ifdef FOG_EXP2\n\n float fogFactor = exp2( - square( fogDensity ) * square( depth ) * LOG2 );\n fogFactor = whiteCompliment( fogFactor );\n\n #else\n\n float fogFactor = smoothstep( fogNear, fogFar, depth );\n\n #endif\n \n outgoingLight = mix( outgoingLight, fogColor, fogFactor );\n\n#endif",e.ShaderChunk.bumpmap_pars_fragment="#ifdef USE_BUMPMAP\n\n uniform sampler2D bumpMap;\n uniform float bumpScale;\n\n // Derivative maps - bump mapping unparametrized surfaces by Morten Mikkelsen\n // http://mmikkelsen3d.blogspot.sk/2011/07/derivative-maps.html\n\n // Evaluate the derivative of the height w.r.t. screen-space using forward differencing (listing 2)\n\n vec2 dHdxy_fwd() {\n\n vec2 dSTdx = dFdx( vUv );\n vec2 dSTdy = dFdy( vUv );\n\n float Hll = bumpScale * texture2D( bumpMap, vUv ).x;\n float dBx = bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll;\n float dBy = bumpScale * texture2D( bumpMap, vUv + dSTdy ).x - Hll;\n\n return vec2( dBx, dBy );\n\n }\n\n vec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy ) {\n\n vec3 vSigmaX = dFdx( surf_pos );\n vec3 vSigmaY = dFdy( surf_pos );\n vec3 vN = surf_norm; // normalized\n\n vec3 R1 = cross( vSigmaY, vN );\n vec3 R2 = cross( vN, vSigmaX );\n\n float fDet = dot( vSigmaX, R1 );\n\n vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n return normalize( abs( fDet ) * surf_norm - vGrad );\n\n }\n\n#endif\n",e.ShaderChunk.defaultnormal_vertex="#ifdef USE_SKINNING\n\n vec3 objectNormal = skinnedNormal.xyz;\n\n#elif defined( USE_MORPHNORMALS )\n\n vec3 objectNormal = morphedNormal;\n\n#else\n\n vec3 objectNormal = normal;\n\n#endif\n\n#ifdef FLIP_SIDED\n\n objectNormal = -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 uniform vec3 directionalLightColor[ MAX_DIR_LIGHTS ];\n uniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\n\n#endif\n\n#if MAX_HEMI_LIGHTS > 0\n\n uniform vec3 hemisphereLightSkyColor[ MAX_HEMI_LIGHTS ];\n uniform vec3 hemisphereLightGroundColor[ MAX_HEMI_LIGHTS ];\n uniform vec3 hemisphereLightDirection[ MAX_HEMI_LIGHTS ];\n\n#endif\n\n#if MAX_POINT_LIGHTS > 0\n\n uniform vec3 pointLightColor[ MAX_POINT_LIGHTS ];\n\n uniform vec3 pointLightPosition[ MAX_POINT_LIGHTS ];\n uniform float pointLightDistance[ MAX_POINT_LIGHTS ];\n uniform float pointLightDecay[ MAX_POINT_LIGHTS ];\n\n#endif\n\n#if MAX_SPOT_LIGHTS > 0\n\n uniform vec3 spotLightColor[ MAX_SPOT_LIGHTS ];\n uniform vec3 spotLightPosition[ MAX_SPOT_LIGHTS ];\n uniform vec3 spotLightDirection[ MAX_SPOT_LIGHTS ];\n uniform float spotLightAngleCos[ MAX_SPOT_LIGHTS ];\n uniform float spotLightExponent[ MAX_SPOT_LIGHTS ];\n uniform float spotLightDistance[ MAX_SPOT_LIGHTS ];\n uniform float spotLightDecay[ MAX_SPOT_LIGHTS ];\n\n#endif\n\n#if MAX_SPOT_LIGHTS > 0 || defined( USE_BUMPMAP ) || defined( USE_ENVMAP )\n\n varying vec3 vWorldPosition;\n\n#endif\n\n#ifdef WRAP_AROUND\n\n uniform vec3 wrapRGB;\n\n#endif\n\nvarying vec3 vViewPosition;\n\n#ifndef FLAT_SHADED\n\n varying vec3 vNormal;\n\n#endif\n",e.ShaderChunk.skinbase_vertex="#ifdef USE_SKINNING\n\n mat4 boneMatX = getBoneMatrix( skinIndex.x );\n mat4 boneMatY = getBoneMatrix( skinIndex.y );\n mat4 boneMatZ = getBoneMatrix( skinIndex.z );\n mat4 boneMatW = getBoneMatrix( skinIndex.w );\n\n#endif",e.ShaderChunk.map_vertex="#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP )\n\n vUv = uv * offsetRepeat.zw + offsetRepeat.xy;\n\n#endif",e.ShaderChunk.lightmap_fragment="#ifdef USE_LIGHTMAP\n\n outgoingLight *= diffuseColor.xyz * texture2D( lightMap, vUv2 ).xyz;\n\n#endif",e.ShaderChunk.shadowmap_pars_vertex="#ifdef USE_SHADOWMAP\n\n varying vec4 vShadowCoord[ MAX_SHADOWS ];\n uniform mat4 shadowMatrix[ MAX_SHADOWS ];\n\n#endif",e.ShaderChunk.color_fragment="#ifdef USE_COLOR\n\n diffuseColor.rgb *= vColor;\n\n#endif",e.ShaderChunk.morphtarget_vertex="#ifdef USE_MORPHTARGETS\n\n vec3 morphed = vec3( 0.0 );\n morphed += ( morphTarget0 - position ) * morphTargetInfluences[ 0 ];\n morphed += ( morphTarget1 - position ) * morphTargetInfluences[ 1 ];\n morphed += ( morphTarget2 - position ) * morphTargetInfluences[ 2 ];\n morphed += ( morphTarget3 - position ) * morphTargetInfluences[ 3 ];\n\n #ifndef USE_MORPHNORMALS\n\n morphed += ( morphTarget4 - position ) * morphTargetInfluences[ 4 ];\n morphed += ( morphTarget5 - position ) * morphTargetInfluences[ 5 ];\n morphed += ( morphTarget6 - position ) * morphTargetInfluences[ 6 ];\n morphed += ( morphTarget7 - position ) * morphTargetInfluences[ 7 ];\n\n #endif\n\n morphed += position;\n\n#endif",e.ShaderChunk.envmap_vertex="#if defined( USE_ENVMAP ) && ! defined( USE_BUMPMAP ) && ! defined( USE_NORMALMAP ) && ! defined( PHONG )\n\n vec3 worldNormal = transformDirection( objectNormal, modelMatrix );\n\n vec3 cameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n\n #ifdef ENVMAP_MODE_REFLECTION\n\n vReflect = reflect( cameraToVertex, worldNormal );\n\n #else\n\n vReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n\n #endif\n\n#endif\n",e.ShaderChunk.shadowmap_fragment="#ifdef USE_SHADOWMAP\n\n #ifdef SHADOWMAP_DEBUG\n\n vec3 frustumColors[3];\n frustumColors[0] = vec3( 1.0, 0.5, 0.0 );\n frustumColors[1] = vec3( 0.0, 1.0, 0.8 );\n frustumColors[2] = vec3( 0.0, 0.5, 1.0 );\n\n #endif\n\n #ifdef SHADOWMAP_CASCADE\n\n int inFrustumCount = 0;\n\n #endif\n\n float fDepth;\n vec3 shadowColor = vec3( 1.0 );\n\n for( int i = 0; i < MAX_SHADOWS; i ++ ) {\n\n vec3 shadowCoord = vShadowCoord[ i ].xyz / vShadowCoord[ i ].w;\n\n // if ( something && something ) breaks ATI OpenGL shader compiler\n // if ( all( something, something ) ) using this instead\n\n bvec4 inFrustumVec = bvec4 ( shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0 );\n bool inFrustum = all( inFrustumVec );\n\n // don't shadow pixels outside of light frustum\n // use just first frustum (for cascades)\n // don't shadow pixels behind far plane of light frustum\n\n #ifdef SHADOWMAP_CASCADE\n\n inFrustumCount += int( inFrustum );\n bvec3 frustumTestVec = bvec3( inFrustum, inFrustumCount == 1, shadowCoord.z <= 1.0 );\n\n #else\n\n bvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 );\n\n #endif\n\n bool frustumTest = all( frustumTestVec );\n\n if ( frustumTest ) {\n\n shadowCoord.z += shadowBias[ i ];\n\n #if defined( SHADOWMAP_TYPE_PCF )\n\n // Percentage-close filtering\n // (9 pixel kernel)\n // http://fabiensanglard.net/shadowmappingPCF/\n\n float shadow = 0.0;\n\n /*\n // nested loops breaks shader compiler / validator on some ATI cards when using OpenGL\n // must enroll loop manually\n\n for ( float y = -1.25; y <= 1.25; y += 1.25 )\n for ( float x = -1.25; x <= 1.25; x += 1.25 ) {\n\n vec4 rgbaDepth = texture2D( shadowMap[ i ], vec2( x * xPixelOffset, y * yPixelOffset ) + shadowCoord.xy );\n\n // doesn't seem to produce any noticeable visual difference compared to simple texture2D lookup\n //vec4 rgbaDepth = texture2DProj( shadowMap[ i ], vec4( vShadowCoord[ i ].w * ( vec2( x * xPixelOffset, y * yPixelOffset ) + shadowCoord.xy ), 0.05, vShadowCoord[ i ].w ) );\n\n float fDepth = unpackDepth( rgbaDepth );\n\n if ( fDepth < shadowCoord.z )\n shadow += 1.0;\n\n }\n\n shadow /= 9.0;\n\n */\n\n const float shadowDelta = 1.0 / 9.0;\n\n float xPixelOffset = 1.0 / shadowMapSize[ i ].x;\n float yPixelOffset = 1.0 / shadowMapSize[ i ].y;\n\n float dx0 = -1.25 * xPixelOffset;\n float dy0 = -1.25 * yPixelOffset;\n float dx1 = 1.25 * xPixelOffset;\n float dy1 = 1.25 * yPixelOffset;\n\n fDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx0, dy0 ) ) );\n if ( fDepth < shadowCoord.z ) shadow += shadowDelta;\n\n fDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( 0.0, dy0 ) ) );\n if ( fDepth < shadowCoord.z ) shadow += shadowDelta;\n\n fDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx1, dy0 ) ) );\n if ( fDepth < shadowCoord.z ) shadow += shadowDelta;\n\n fDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx0, 0.0 ) ) );\n if ( fDepth < shadowCoord.z ) shadow += shadowDelta;\n\n fDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy ) );\n if ( fDepth < shadowCoord.z ) shadow += shadowDelta;\n\n fDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx1, 0.0 ) ) );\n if ( fDepth < shadowCoord.z ) shadow += shadowDelta;\n\n fDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx0, dy1 ) ) );\n if ( fDepth < shadowCoord.z ) shadow += shadowDelta;\n\n fDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( 0.0, dy1 ) ) );\n if ( fDepth < shadowCoord.z ) shadow += shadowDelta;\n\n fDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx1, dy1 ) ) );\n if ( fDepth < shadowCoord.z ) shadow += shadowDelta;\n\n shadowColor = shadowColor * vec3( ( 1.0 - shadowDarkness[ i ] * shadow ) );\n\n #elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n\n // Percentage-close filtering\n // (9 pixel kernel)\n // http://fabiensanglard.net/shadowmappingPCF/\n\n float shadow = 0.0;\n\n float xPixelOffset = 1.0 / shadowMapSize[ i ].x;\n float yPixelOffset = 1.0 / shadowMapSize[ i ].y;\n\n float dx0 = -1.0 * xPixelOffset;\n float dy0 = -1.0 * yPixelOffset;\n float dx1 = 1.0 * xPixelOffset;\n float dy1 = 1.0 * yPixelOffset;\n\n mat3 shadowKernel;\n mat3 depthKernel;\n\n depthKernel[0][0] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx0, dy0 ) ) );\n depthKernel[0][1] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx0, 0.0 ) ) );\n depthKernel[0][2] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx0, dy1 ) ) );\n depthKernel[1][0] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( 0.0, dy0 ) ) );\n depthKernel[1][1] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy ) );\n depthKernel[1][2] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( 0.0, dy1 ) ) );\n depthKernel[2][0] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx1, dy0 ) ) );\n depthKernel[2][1] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx1, 0.0 ) ) );\n depthKernel[2][2] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx1, dy1 ) ) );\n\n vec3 shadowZ = vec3( shadowCoord.z );\n shadowKernel[0] = vec3(lessThan(depthKernel[0], shadowZ ));\n shadowKernel[0] *= vec3(0.25);\n\n shadowKernel[1] = vec3(lessThan(depthKernel[1], shadowZ ));\n shadowKernel[1] *= vec3(0.25);\n\n shadowKernel[2] = vec3(lessThan(depthKernel[2], shadowZ ));\n shadowKernel[2] *= vec3(0.25);\n\n vec2 fractionalCoord = 1.0 - fract( shadowCoord.xy * shadowMapSize[i].xy );\n\n shadowKernel[0] = mix( shadowKernel[1], shadowKernel[0], fractionalCoord.x );\n shadowKernel[1] = mix( shadowKernel[2], shadowKernel[1], fractionalCoord.x );\n\n vec4 shadowValues;\n shadowValues.x = mix( shadowKernel[0][1], shadowKernel[0][0], fractionalCoord.y );\n shadowValues.y = mix( shadowKernel[0][2], shadowKernel[0][1], fractionalCoord.y );\n shadowValues.z = mix( shadowKernel[1][1], shadowKernel[1][0], fractionalCoord.y );\n shadowValues.w = mix( shadowKernel[1][2], shadowKernel[1][1], fractionalCoord.y );\n\n shadow = dot( shadowValues, vec4( 1.0 ) );\n\n shadowColor = shadowColor * vec3( ( 1.0 - shadowDarkness[ i ] * shadow ) );\n\n #else\n\n vec4 rgbaDepth = texture2D( shadowMap[ i ], shadowCoord.xy );\n float fDepth = unpackDepth( rgbaDepth );\n\n if ( fDepth < shadowCoord.z )\n\n // spot with multiple shadows is darker\n\n shadowColor = shadowColor * vec3( 1.0 - shadowDarkness[ i ] );\n\n // spot with multiple shadows has the same color as single shadow spot\n\n // shadowColor = min( shadowColor, vec3( shadowDarkness[ i ] ) );\n\n #endif\n\n }\n\n\n #ifdef SHADOWMAP_DEBUG\n\n #ifdef SHADOWMAP_CASCADE\n\n if ( inFrustum && inFrustumCount == 1 ) outgoingLight *= frustumColors[ i ];\n\n #else\n\n if ( inFrustum ) outgoingLight *= frustumColors[ i ];\n\n #endif\n\n #endif\n\n }\n\n // NOTE: I am unsure if this is correct in linear space. -bhouston, Dec 29, 2014\n shadowColor = inputToLinear( shadowColor );\n\n outgoingLight = outgoingLight * shadowColor;\n\n#endif\n",e.ShaderChunk.worldpos_vertex="#if defined( USE_ENVMAP ) || defined( PHONG ) || defined( LAMBERT ) || defined ( USE_SHADOWMAP )\n\n #ifdef USE_SKINNING\n\n vec4 worldPosition = modelMatrix * skinned;\n\n #elif defined( USE_MORPHTARGETS )\n\n vec4 worldPosition = modelMatrix * vec4( morphed, 1.0 );\n\n #else\n\n vec4 worldPosition = modelMatrix * vec4( position, 1.0 );\n\n #endif\n\n#endif\n",e.ShaderChunk.shadowmap_pars_fragment="#ifdef USE_SHADOWMAP\n\n uniform sampler2D shadowMap[ MAX_SHADOWS ];\n uniform vec2 shadowMapSize[ MAX_SHADOWS ];\n\n uniform float shadowDarkness[ MAX_SHADOWS ];\n uniform float shadowBias[ MAX_SHADOWS ];\n\n varying vec4 vShadowCoord[ MAX_SHADOWS ];\n\n float unpackDepth( const in vec4 rgba_depth ) {\n\n const 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 float depth = dot( rgba_depth, bit_shift );\n return depth;\n\n }\n\n#endif",e.ShaderChunk.skinning_pars_vertex="#ifdef USE_SKINNING\n\n uniform mat4 bindMatrix;\n uniform mat4 bindMatrixInverse;\n\n #ifdef BONE_TEXTURE\n\n uniform sampler2D boneTexture;\n uniform int boneTextureWidth;\n uniform int boneTextureHeight;\n\n mat4 getBoneMatrix( const in float i ) {\n\n float j = i * 4.0;\n float x = mod( j, float( boneTextureWidth ) );\n float y = floor( j / float( boneTextureWidth ) );\n\n float dx = 1.0 / float( boneTextureWidth );\n float dy = 1.0 / float( boneTextureHeight );\n\n y = dy * ( y + 0.5 );\n\n vec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );\n vec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );\n vec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );\n vec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );\n\n mat4 bone = mat4( v1, v2, v3, v4 );\n\n return bone;\n\n }\n\n #else\n\n uniform mat4 boneGlobalMatrices[ MAX_BONES ];\n\n mat4 getBoneMatrix( const in float i ) {\n\n mat4 bone = boneGlobalMatrices[ int(i) ];\n return bone;\n\n }\n\n #endif\n\n#endif\n",e.ShaderChunk.logdepthbuf_pars_fragment="#ifdef USE_LOGDEPTHBUF\n\n uniform float logDepthBufFC;\n\n #ifdef USE_LOGDEPTHBUF_EXT\n\n #extension GL_EXT_frag_depth : enable\n varying float vFragDepth;\n\n #endif\n\n#endif",e.ShaderChunk.alphamap_fragment="#ifdef USE_ALPHAMAP\n\n diffuseColor.a *= texture2D( alphaMap, vUv ).g;\n\n#endif\n",e.ShaderChunk.alphamap_pars_fragment="#ifdef USE_ALPHAMAP\n\n uniform sampler2D alphaMap;\n\n#endif\n",e.UniformsUtils={merge:function(e){for(var t={},n=0;n<e.length;n++){var r=this.clone(e[n]);
for(var i in r)t[i]=r[i]}return t},clone:function(t){var n={};for(var r in t){n[r]={};for(var i in t[r]){var o=t[r][i];n[r][i]=o instanceof e.Color||o instanceof e.Vector2||o instanceof e.Vector3||o instanceof e.Vector4||o instanceof e.Matrix4||o instanceof e.Texture?o.clone():o instanceof Array?o.slice():o}}return n}},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," #ifdef USE_ENVMAP",e.ShaderChunk.morphnormal_vertex,e.ShaderChunk.skinnormal_vertex,e.ShaderChunk.defaultnormal_vertex," #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() {"," vec3 outgoingLight = vec3( 0.0 );"," vec4 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," outgoingLight = diffuseColor.rgb;",e.ShaderChunk.lightmap_fragment,e.ShaderChunk.envmap_fragment,e.ShaderChunk.shadowmap_fragment,e.ShaderChunk.linear_to_gamma_fragment,e.ShaderChunk.fog_fragment," gl_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"," varying 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"," varying 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() {"," vec3 outgoingLight = vec3( 0.0 );"," vec4 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," #ifdef DOUBLE_SIDED"," if ( gl_FrontFacing )"," outgoingLight += diffuseColor.rgb * vLightFront + emissive;"," else"," outgoingLight += diffuseColor.rgb * vLightBack + emissive;"," #else"," outgoingLight += diffuseColor.rgb * vLightFront + emissive;"," #endif",e.ShaderChunk.lightmap_fragment,e.ShaderChunk.envmap_fragment,e.ShaderChunk.shadowmap_fragment,e.ShaderChunk.linear_to_gamma_fragment,e.ShaderChunk.fog_fragment," gl_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"," varying 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"," vNormal = normalize( transformedNormal );","#endif",e.ShaderChunk.morphtarget_vertex,e.ShaderChunk.skinning_vertex,e.ShaderChunk.default_vertex,e.ShaderChunk.logdepthbuf_vertex," vViewPosition = -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() {"," vec3 outgoingLight = vec3( 0.0 );"," vec4 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," gl_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," vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );"," #ifdef USE_SIZEATTENUATION"," gl_PointSize = size * ( scale / length( mvPosition.xyz ) );"," #else"," gl_PointSize = size;"," #endif"," gl_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() {"," vec3 outgoingLight = vec3( 0.0 );"," vec4 diffuseColor = vec4( psColor, opacity );",e.ShaderChunk.logdepthbuf_fragment,e.ShaderChunk.map_particle_fragment,e.ShaderChunk.color_fragment,e.ShaderChunk.alphatest_fragment," outgoingLight = diffuseColor.rgb;",e.ShaderChunk.shadowmap_fragment,e.ShaderChunk.fog_fragment," gl_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," vLineDistance = scale * lineDistance;"," vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );"," gl_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() {"," if ( mod( vLineDistance, totalSize ) > dashSize ) {"," discard;"," }"," vec3 outgoingLight = vec3( 0.0 );"," vec4 diffuseColor = vec4( diffuse, opacity );",e.ShaderChunk.logdepthbuf_fragment,e.ShaderChunk.color_fragment," outgoingLight = diffuseColor.rgb;",e.ShaderChunk.fog_fragment," gl_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," #ifdef USE_LOGDEPTHBUF_EXT"," float depth = gl_FragDepthEXT / gl_FragCoord.w;"," #else"," float depth = gl_FragCoord.z / gl_FragCoord.w;"," #endif"," float color = 1.0 - smoothstep( mNear, mFar, depth );"," gl_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() {"," vNormal = 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() {"," gl_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() {"," vWorldPosition = transformDirection( position, modelMatrix );"," gl_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() {"," gl_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() {"," vWorldPosition = transformDirection( position, modelMatrix );"," gl_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;","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 ) {"," const vec4 bit_shift = vec4( 256.0 * 256.0 * 256.0, 256.0 * 256.0, 256.0, 1.0 );"," const vec4 bit_mask = vec4( 0.0, 1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0 );"," vec4 res = mod( depth * bit_shift * vec4( 255 ), vec4( 256 ) ) / vec4( 255 );"," res -= res.xxyz * bit_mask;"," return res;","}","void main() {",e.ShaderChunk.logdepthbuf_fragment," #ifdef USE_LOGDEPTHBUF_EXT"," gl_FragData[ 0 ] = pack_depth( gl_FragDepthEXT );"," #else"," gl_FragData[ 0 ] = pack_depth( gl_FragCoord.z );"," #endif","}"].join("\n")}},e.WebGLRenderer=function(t){function n(e){e.__webglVertexBuffer=Rt.createBuffer(),e.__webglColorBuffer=Rt.createBuffer(),It.info.memory.geometries++}function r(e){e.__webglVertexBuffer=Rt.createBuffer(),e.__webglColorBuffer=Rt.createBuffer(),e.__webglLineDistanceBuffer=Rt.createBuffer(),It.info.memory.geometries++}function i(e){e.__webglVertexBuffer=Rt.createBuffer(),e.__webglNormalBuffer=Rt.createBuffer(),e.__webglTangentBuffer=Rt.createBuffer(),e.__webglColorBuffer=Rt.createBuffer(),e.__webglUVBuffer=Rt.createBuffer(),e.__webglUV2Buffer=Rt.createBuffer(),e.__webglSkinIndicesBuffer=Rt.createBuffer(),e.__webglSkinWeightsBuffer=Rt.createBuffer(),e.__webglFaceBuffer=Rt.createBuffer(),e.__webglLineBuffer=Rt.createBuffer();var t=e.numMorphTargets;if(t){e.__webglMorphTargetsBuffers=[];for(var n=0,r=t;r>n;n++)e.__webglMorphTargetsBuffers.push(Rt.createBuffer())}var i=e.numMorphNormals;if(i){e.__webglMorphNormalsBuffers=[];for(var n=0,r=i;r>n;n++)e.__webglMorphNormalsBuffers.push(Rt.createBuffer())}It.info.memory.geometries++}function o(e){var t=e.geometry,n=e.material,r=t.vertices.length;if(n.attributes){void 0===t.__webglCustomAttributesList&&(t.__webglCustomAttributesList=[]);for(var i in n.attributes){var o=n.attributes[i];if(!o.__webglInitialized||o.createUniqueBuffers){o.__webglInitialized=!0;var a=1;"v2"===o.type?a=2:"v3"===o.type?a=3:"v4"===o.type?a=4:"c"===o.type&&(a=3),o.size=a,o.array=new Float32Array(r*a),o.buffer=Rt.createBuffer(),o.buffer.belongsToAttribute=i,o.needsUpdate=!0}t.__webglCustomAttributesList.push(o)}}}function a(e,t){var n=e.vertices.length;e.__vertexArray=new Float32Array(3*n),e.__colorArray=new Float32Array(3*n),e.__webglParticleCount=n,o(t)}function s(e,t){var n=e.vertices.length;e.__vertexArray=new Float32Array(3*n),e.__colorArray=new Float32Array(3*n),e.__lineDistanceArray=new Float32Array(1*n),e.__webglLineCount=n,o(t)}function u(e,t){var n=t.geometry,r=e.faces3,i=3*r.length,o=1*r.length,a=3*r.length,s=c(t,e);e.__vertexArray=new Float32Array(3*i),e.__normalArray=new Float32Array(3*i),e.__colorArray=new Float32Array(3*i),e.__uvArray=new Float32Array(2*i),n.faceVertexUvs.length>1&&(e.__uv2Array=new Float32Array(2*i)),n.hasTangents&&(e.__tangentArray=new Float32Array(4*i)),t.geometry.skinWeights.length&&t.geometry.skinIndices.length&&(e.__skinIndexArray=new Float32Array(4*i),e.__skinWeightArray=new Float32Array(4*i));var u=null!==nn.get("OES_element_index_uint")&&o>21845?Uint32Array:Uint16Array;e.__typeArray=u,e.__faceArray=new u(3*o),e.__lineArray=new u(2*a);var l=e.numMorphTargets;if(l){e.__morphTargetsArrays=[];for(var h=0,f=l;f>h;h++)e.__morphTargetsArrays.push(new Float32Array(3*i))}var p=e.numMorphNormals;if(p){e.__morphNormalsArrays=[];for(var h=0,f=p;f>h;h++)e.__morphNormalsArrays.push(new Float32Array(3*i))}if(e.__webglFaceCount=3*o,e.__webglLineCount=2*a,s.attributes){void 0===e.__webglCustomAttributesList&&(e.__webglCustomAttributesList=[]);for(var d in s.attributes){var m=s.attributes[d],v={};for(var g in m)v[g]=m[g];if(!v.__webglInitialized||v.createUniqueBuffers){v.__webglInitialized=!0;var y=1;"v2"===v.type?y=2:"v3"===v.type?y=3:"v4"===v.type?y=4:"c"===v.type&&(y=3),v.size=y,v.array=new Float32Array(i*y),v.buffer=Rt.createBuffer(),v.buffer.belongsToAttribute=d,m.needsUpdate=!0,v.__original=m}e.__webglCustomAttributesList.push(v)}}e.__inittedArrays=!0}function c(t,n){return t.material instanceof e.MeshFaceMaterial?t.material.materials[n.materialIndex]:t.material}function l(t){return t instanceof e.MeshPhongMaterial==!1&&t.shading===e.FlatShading}function h(e,t){var n,r,i,o,a,s,u,c,l,h,f,p=e.vertices,d=p.length,m=e.colors,v=m.length,g=e.__vertexArray,y=e.__colorArray,b=e.verticesNeedUpdate,x=e.colorsNeedUpdate,w=e.__webglCustomAttributesList;if(b){for(n=0;d>n;n++)i=p[n],o=3*n,g[o]=i.x,g[o+1]=i.y,g[o+2]=i.z;Rt.bindBuffer(Rt.ARRAY_BUFFER,e.__webglVertexBuffer),Rt.bufferData(Rt.ARRAY_BUFFER,g,t)}if(x){for(r=0;v>r;r++)a=m[r],o=3*r,y[o]=a.r,y[o+1]=a.g,y[o+2]=a.b;Rt.bindBuffer(Rt.ARRAY_BUFFER,e.__webglColorBuffer),Rt.bufferData(Rt.ARRAY_BUFFER,y,t)}if(w)for(s=0,u=w.length;u>s;s++){if(f=w[s],f.needsUpdate&&(void 0===f.boundTo||"vertices"===f.boundTo))if(l=f.value.length,o=0,1===f.size)for(c=0;l>c;c++)f.array[c]=f.value[c];else if(2===f.size)for(c=0;l>c;c++)h=f.value[c],f.array[o]=h.x,f.array[o+1]=h.y,o+=2;else if(3===f.size)if("c"===f.type)for(c=0;l>c;c++)h=f.value[c],f.array[o]=h.r,f.array[o+1]=h.g,f.array[o+2]=h.b,o+=3;else for(c=0;l>c;c++)h=f.value[c],f.array[o]=h.x,f.array[o+1]=h.y,f.array[o+2]=h.z,o+=3;else if(4===f.size)for(c=0;l>c;c++)h=f.value[c],f.array[o]=h.x,f.array[o+1]=h.y,f.array[o+2]=h.z,f.array[o+3]=h.w,o+=4;Rt.bindBuffer(Rt.ARRAY_BUFFER,f.buffer),Rt.bufferData(Rt.ARRAY_BUFFER,f.array,t),f.needsUpdate=!1}}function f(e,t){var n,r,i,o,a,s,u,c,l,h,f,p,d=e.vertices,m=e.colors,v=e.lineDistances,g=d.length,y=m.length,b=v.length,x=e.__vertexArray,w=e.__colorArray,_=e.__lineDistanceArray,C=e.verticesNeedUpdate,E=e.colorsNeedUpdate,S=e.lineDistancesNeedUpdate,M=e.__webglCustomAttributesList;if(C){for(n=0;g>n;n++)o=d[n],a=3*n,x[a]=o.x,x[a+1]=o.y,x[a+2]=o.z;Rt.bindBuffer(Rt.ARRAY_BUFFER,e.__webglVertexBuffer),Rt.bufferData(Rt.ARRAY_BUFFER,x,t)}if(E){for(r=0;y>r;r++)s=m[r],a=3*r,w[a]=s.r,w[a+1]=s.g,w[a+2]=s.b;Rt.bindBuffer(Rt.ARRAY_BUFFER,e.__webglColorBuffer),Rt.bufferData(Rt.ARRAY_BUFFER,w,t)}if(S){for(i=0;b>i;i++)_[i]=v[i];Rt.bindBuffer(Rt.ARRAY_BUFFER,e.__webglLineDistanceBuffer),Rt.bufferData(Rt.ARRAY_BUFFER,_,t)}if(M)for(u=0,c=M.length;c>u;u++)if(p=M[u],p.needsUpdate&&(void 0===p.boundTo||"vertices"===p.boundTo)){if(a=0,h=p.value.length,1===p.size)for(l=0;h>l;l++)p.array[l]=p.value[l];else if(2===p.size)for(l=0;h>l;l++)f=p.value[l],p.array[a]=f.x,p.array[a+1]=f.y,a+=2;else if(3===p.size)if("c"===p.type)for(l=0;h>l;l++)f=p.value[l],p.array[a]=f.r,p.array[a+1]=f.g,p.array[a+2]=f.b,a+=3;else for(l=0;h>l;l++)f=p.value[l],p.array[a]=f.x,p.array[a+1]=f.y,p.array[a+2]=f.z,a+=3;else if(4===p.size)for(l=0;h>l;l++)f=p.value[l],p.array[a]=f.x,p.array[a+1]=f.y,p.array[a+2]=f.z,p.array[a+3]=f.w,a+=4;Rt.bindBuffer(Rt.ARRAY_BUFFER,p.buffer),Rt.bufferData(Rt.ARRAY_BUFFER,p.array,t),p.needsUpdate=!1}}function p(t,n,r,i,o){if(t.__inittedArrays){var a,s,u,c,h,f,p,d,m,v,g,y,b,x,w,_,C,E,S,M,T,A,P,k,R,I,D,B,V,L,N,O,F,U,z,$,H,j,G,W,q,X,Y=l(o),K=0,Q=0,Z=0,J=0,et=0,tt=0,nt=0,rt=0,it=0,ot=0,at=0,st=0,ut=t.__vertexArray,ct=t.__uvArray,lt=t.__uv2Array,ht=t.__normalArray,ft=t.__tangentArray,pt=t.__colorArray,dt=t.__skinIndexArray,mt=t.__skinWeightArray,vt=t.__morphTargetsArrays,gt=t.__morphNormalsArrays,yt=t.__webglCustomAttributesList,bt=t.__faceArray,xt=t.__lineArray,wt=n.geometry,_t=wt.verticesNeedUpdate,Ct=wt.elementsNeedUpdate,Et=wt.uvsNeedUpdate,St=wt.normalsNeedUpdate,Mt=wt.tangentsNeedUpdate,Tt=wt.colorsNeedUpdate,At=wt.morphTargetsNeedUpdate,Pt=wt.vertices,kt=t.faces3,It=wt.faces,Dt=wt.faceVertexUvs[0],Bt=wt.faceVertexUvs[1],Vt=wt.skinIndices,Lt=wt.skinWeights,Nt=wt.morphTargets,Ot=wt.morphNormals;if(_t){for(a=0,s=kt.length;s>a;a++)c=It[kt[a]],y=Pt[c.a],b=Pt[c.b],x=Pt[c.c],ut[Q]=y.x,ut[Q+1]=y.y,ut[Q+2]=y.z,ut[Q+3]=b.x,ut[Q+4]=b.y,ut[Q+5]=b.z,ut[Q+6]=x.x,ut[Q+7]=x.y,ut[Q+8]=x.z,Q+=9;Rt.bindBuffer(Rt.ARRAY_BUFFER,t.__webglVertexBuffer),Rt.bufferData(Rt.ARRAY_BUFFER,ut,r)}if(At)for(z=0,$=Nt.length;$>z;z++){for(at=0,a=0,s=kt.length;s>a;a++)G=kt[a],c=It[G],y=Nt[z].vertices[c.a],b=Nt[z].vertices[c.b],x=Nt[z].vertices[c.c],H=vt[z],H[at]=y.x,H[at+1]=y.y,H[at+2]=y.z,H[at+3]=b.x,H[at+4]=b.y,H[at+5]=b.z,H[at+6]=x.x,H[at+7]=x.y,H[at+8]=x.z,o.morphNormals&&(Y?(E=Ot[z].faceNormals[G],S=E,M=E):(W=Ot[z].vertexNormals[G],E=W.a,S=W.b,M=W.c),j=gt[z],j[at]=E.x,j[at+1]=E.y,j[at+2]=E.z,j[at+3]=S.x,j[at+4]=S.y,j[at+5]=S.z,j[at+6]=M.x,j[at+7]=M.y,j[at+8]=M.z),at+=9;Rt.bindBuffer(Rt.ARRAY_BUFFER,t.__webglMorphTargetsBuffers[z]),Rt.bufferData(Rt.ARRAY_BUFFER,vt[z],r),o.morphNormals&&(Rt.bindBuffer(Rt.ARRAY_BUFFER,t.__webglMorphNormalsBuffers[z]),Rt.bufferData(Rt.ARRAY_BUFFER,gt[z],r))}if(Lt.length){for(a=0,s=kt.length;s>a;a++)c=It[kt[a]],k=Lt[c.a],R=Lt[c.b],I=Lt[c.c],mt[ot]=k.x,mt[ot+1]=k.y,mt[ot+2]=k.z,mt[ot+3]=k.w,mt[ot+4]=R.x,mt[ot+5]=R.y,mt[ot+6]=R.z,mt[ot+7]=R.w,mt[ot+8]=I.x,mt[ot+9]=I.y,mt[ot+10]=I.z,mt[ot+11]=I.w,D=Vt[c.a],B=Vt[c.b],V=Vt[c.c],dt[ot]=D.x,dt[ot+1]=D.y,dt[ot+2]=D.z,dt[ot+3]=D.w,dt[ot+4]=B.x,dt[ot+5]=B.y,dt[ot+6]=B.z,dt[ot+7]=B.w,dt[ot+8]=V.x,dt[ot+9]=V.y,dt[ot+10]=V.z,dt[ot+11]=V.w,ot+=12;ot>0&&(Rt.bindBuffer(Rt.ARRAY_BUFFER,t.__webglSkinIndicesBuffer),Rt.bufferData(Rt.ARRAY_BUFFER,dt,r),Rt.bindBuffer(Rt.ARRAY_BUFFER,t.__webglSkinWeightsBuffer),Rt.bufferData(Rt.ARRAY_BUFFER,mt,r))}if(Tt){for(a=0,s=kt.length;s>a;a++)c=It[kt[a]],p=c.vertexColors,d=c.color,3===p.length&&o.vertexColors===e.VertexColors?(T=p[0],A=p[1],P=p[2]):(T=d,A=d,P=d),pt[it]=T.r,pt[it+1]=T.g,pt[it+2]=T.b,pt[it+3]=A.r,pt[it+4]=A.g,pt[it+5]=A.b,pt[it+6]=P.r,pt[it+7]=P.g,pt[it+8]=P.b,it+=9;it>0&&(Rt.bindBuffer(Rt.ARRAY_BUFFER,t.__webglColorBuffer),Rt.bufferData(Rt.ARRAY_BUFFER,pt,r))}if(Mt&&wt.hasTangents){for(a=0,s=kt.length;s>a;a++)c=It[kt[a]],m=c.vertexTangents,w=m[0],_=m[1],C=m[2],ft[nt]=w.x,ft[nt+1]=w.y,ft[nt+2]=w.z,ft[nt+3]=w.w,ft[nt+4]=_.x,ft[nt+5]=_.y,ft[nt+6]=_.z,ft[nt+7]=_.w,ft[nt+8]=C.x,ft[nt+9]=C.y,ft[nt+10]=C.z,ft[nt+11]=C.w,nt+=12;Rt.bindBuffer(Rt.ARRAY_BUFFER,t.__webglTangentBuffer),Rt.bufferData(Rt.ARRAY_BUFFER,ft,r)}if(St){for(a=0,s=kt.length;s>a;a++)if(c=It[kt[a]],h=c.vertexNormals,f=c.normal,3===h.length&&Y===!1)for(L=0;3>L;L++)O=h[L],ht[tt]=O.x,ht[tt+1]=O.y,ht[tt+2]=O.z,tt+=3;else for(L=0;3>L;L++)ht[tt]=f.x,ht[tt+1]=f.y,ht[tt+2]=f.z,tt+=3;Rt.bindBuffer(Rt.ARRAY_BUFFER,t.__webglNormalBuffer),Rt.bufferData(Rt.ARRAY_BUFFER,ht,r)}if(Et&&Dt){for(a=0,s=kt.length;s>a;a++)if(u=kt[a],v=Dt[u],void 0!==v)for(L=0;3>L;L++)F=v[L],ct[Z]=F.x,ct[Z+1]=F.y,Z+=2;Z>0&&(Rt.bindBuffer(Rt.ARRAY_BUFFER,t.__webglUVBuffer),Rt.bufferData(Rt.ARRAY_BUFFER,ct,r))}if(Et&&Bt){for(a=0,s=kt.length;s>a;a++)if(u=kt[a],g=Bt[u],void 0!==g)for(L=0;3>L;L++)U=g[L],lt[J]=U.x,lt[J+1]=U.y,J+=2;J>0&&(Rt.bindBuffer(Rt.ARRAY_BUFFER,t.__webglUV2Buffer),Rt.bufferData(Rt.ARRAY_BUFFER,lt,r))}if(Ct){for(a=0,s=kt.length;s>a;a++)bt[et]=K,bt[et+1]=K+1,bt[et+2]=K+2,et+=3,xt[rt]=K,xt[rt+1]=K+1,xt[rt+2]=K,xt[rt+3]=K+2,xt[rt+4]=K+1,xt[rt+5]=K+2,rt+=6,K+=3;Rt.bindBuffer(Rt.ELEMENT_ARRAY_BUFFER,t.__webglFaceBuffer),Rt.bufferData(Rt.ELEMENT_ARRAY_BUFFER,bt,r),Rt.bindBuffer(Rt.ELEMENT_ARRAY_BUFFER,t.__webglLineBuffer),Rt.bufferData(Rt.ELEMENT_ARRAY_BUFFER,xt,r)}if(yt)for(L=0,N=yt.length;N>L;L++)if(X=yt[L],X.__original.needsUpdate){if(st=0,1===X.size){if(void 0===X.boundTo||"vertices"===X.boundTo)for(a=0,s=kt.length;s>a;a++)c=It[kt[a]],X.array[st]=X.value[c.a],X.array[st+1]=X.value[c.b],X.array[st+2]=X.value[c.c],st+=3;else if("faces"===X.boundTo)for(a=0,s=kt.length;s>a;a++)q=X.value[kt[a]],X.array[st]=q,X.array[st+1]=q,X.array[st+2]=q,st+=3}else if(2===X.size){if(void 0===X.boundTo||"vertices"===X.boundTo)for(a=0,s=kt.length;s>a;a++)c=It[kt[a]],y=X.value[c.a],b=X.value[c.b],x=X.value[c.c],X.array[st]=y.x,X.array[st+1]=y.y,X.array[st+2]=b.x,X.array[st+3]=b.y,X.array[st+4]=x.x,X.array[st+5]=x.y,st+=6;else if("faces"===X.boundTo)for(a=0,s=kt.length;s>a;a++)q=X.value[kt[a]],y=q,b=q,x=q,X.array[st]=y.x,X.array[st+1]=y.y,X.array[st+2]=b.x,X.array[st+3]=b.y,X.array[st+4]=x.x,X.array[st+5]=x.y,st+=6}else if(3===X.size){var Ft;if(Ft="c"===X.type?["r","g","b"]:["x","y","z"],void 0===X.boundTo||"vertices"===X.boundTo)for(a=0,s=kt.length;s>a;a++)c=It[kt[a]],y=X.value[c.a],b=X.value[c.b],x=X.value[c.c],X.array[st]=y[Ft[0]],X.array[st+1]=y[Ft[1]],X.array[st+2]=y[Ft[2]],X.array[st+3]=b[Ft[0]],X.array[st+4]=b[Ft[1]],X.array[st+5]=b[Ft[2]],X.array[st+6]=x[Ft[0]],X.array[st+7]=x[Ft[1]],X.array[st+8]=x[Ft[2]],st+=9;else if("faces"===X.boundTo)for(a=0,s=kt.length;s>a;a++)q=X.value[kt[a]],y=q,b=q,x=q,X.array[st]=y[Ft[0]],X.array[st+1]=y[Ft[1]],X.array[st+2]=y[Ft[2]],X.array[st+3]=b[Ft[0]],X.array[st+4]=b[Ft[1]],X.array[st+5]=b[Ft[2]],X.array[st+6]=x[Ft[0]],X.array[st+7]=x[Ft[1]],X.array[st+8]=x[Ft[2]],st+=9;else if("faceVertices"===X.boundTo)for(a=0,s=kt.length;s>a;a++)q=X.value[kt[a]],y=q[0],b=q[1],x=q[2],X.array[st]=y[Ft[0]],X.array[st+1]=y[Ft[1]],X.array[st+2]=y[Ft[2]],X.array[st+3]=b[Ft[0]],X.array[st+4]=b[Ft[1]],X.array[st+5]=b[Ft[2]],X.array[st+6]=x[Ft[0]],X.array[st+7]=x[Ft[1]],X.array[st+8]=x[Ft[2]],st+=9}else if(4===X.size)if(void 0===X.boundTo||"vertices"===X.boundTo)for(a=0,s=kt.length;s>a;a++)c=It[kt[a]],y=X.value[c.a],b=X.value[c.b],x=X.value[c.c],X.array[st]=y.x,X.array[st+1]=y.y,X.array[st+2]=y.z,X.array[st+3]=y.w,X.array[st+4]=b.x,X.array[st+5]=b.y,X.array[st+6]=b.z,X.array[st+7]=b.w,X.array[st+8]=x.x,X.array[st+9]=x.y,X.array[st+10]=x.z,X.array[st+11]=x.w,st+=12;else if("faces"===X.boundTo)for(a=0,s=kt.length;s>a;a++)q=X.value[kt[a]],y=q,b=q,x=q,X.array[st]=y.x,X.array[st+1]=y.y,X.array[st+2]=y.z,X.array[st+3]=y.w,X.array[st+4]=b.x,X.array[st+5]=b.y,X.array[st+6]=b.z,X.array[st+7]=b.w,X.array[st+8]=x.x,X.array[st+9]=x.y,X.array[st+10]=x.z,X.array[st+11]=x.w,st+=12;else if("faceVertices"===X.boundTo)for(a=0,s=kt.length;s>a;a++)q=X.value[kt[a]],y=q[0],b=q[1],x=q[2],X.array[st]=y.x,X.array[st+1]=y.y,X.array[st+2]=y.z,X.array[st+3]=y.w,X.array[st+4]=b.x,X.array[st+5]=b.y,X.array[st+6]=b.z,X.array[st+7]=b.w,X.array[st+8]=x.x,X.array[st+9]=x.y,X.array[st+10]=x.z,X.array[st+11]=x.w,st+=12;Rt.bindBuffer(Rt.ARRAY_BUFFER,X.buffer),Rt.bufferData(Rt.ARRAY_BUFFER,X.array,r)}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)}}function d(e,t,n,r){for(var i=n.attributes,o=t.attributes,a=t.attributesKeys,s=0,u=a.length;u>s;s++){var c=a[s],l=o[c];if(l>=0){var h=i[c];if(void 0!==h){var f=h.itemSize;Rt.bindBuffer(Rt.ARRAY_BUFFER,h.buffer),tn.enableAttribute(l),Rt.vertexAttribPointer(l,f,Rt.FLOAT,!1,0,r*f*4)}else void 0!==e.defaultAttributeValues&&(2===e.defaultAttributeValues[c].length?Rt.vertexAttrib2fv(l,e.defaultAttributeValues[c]):3===e.defaultAttributeValues[c].length&&Rt.vertexAttrib3fv(l,e.defaultAttributeValues[c]))}}tn.disableUnusedAttributes()}function m(e,t,n){var r=e.program.attributes;if(-1!==n.morphTargetBase&&r.position>=0?(Rt.bindBuffer(Rt.ARRAY_BUFFER,t.__webglMorphTargetsBuffers[n.morphTargetBase]),tn.enableAttribute(r.position),Rt.vertexAttribPointer(r.position,3,Rt.FLOAT,!1,0,0)):r.position>=0&&(Rt.bindBuffer(Rt.ARRAY_BUFFER,t.__webglVertexBuffer),tn.enableAttribute(r.position),Rt.vertexAttribPointer(r.position,3,Rt.FLOAT,!1,0,0)),n.morphTargetForcedOrder.length)for(var i,o=0,a=n.morphTargetForcedOrder,s=n.morphTargetInfluences;o<e.numSupportedMorphTargets&&o<a.length;)i=r["morphTarget"+o],i>=0&&(Rt.bindBuffer(Rt.ARRAY_BUFFER,t.__webglMorphTargetsBuffers[a[o]]),tn.enableAttribute(i),Rt.vertexAttribPointer(i,3,Rt.FLOAT,!1,0,0)),i=r["morphNormal"+o],i>=0&&e.morphNormals&&(Rt.bindBuffer(Rt.ARRAY_BUFFER,t.__webglMorphNormalsBuffers[a[o]]),tn.enableAttribute(i),Rt.vertexAttribPointer(i,3,Rt.FLOAT,!1,0,0)),n.__webglMorphTargetInfluences[o]=s[a[o]],o++;else{var u=[],s=n.morphTargetInfluences,c=n.geometry.morphTargets;s.length>c.length&&(console.warn("THREE.WebGLRenderer: Influences array is bigger than morphTargets array."),s.length=c.length);for(var l=0,h=s.length;h>l;l++){var f=s[l];u.push([f,l])}u.length>e.numSupportedMorphTargets?(u.sort(y),u.length=e.numSupportedMorphTargets):u.length>e.numSupportedMorphNormals?u.sort(y):0===u.length&&u.push([0,0]);for(var i,o=0,p=e.numSupportedMorphTargets;p>o;o++)if(u[o]){var d=u[o][1];i=r["morphTarget"+o],i>=0&&(Rt.bindBuffer(Rt.ARRAY_BUFFER,t.__webglMorphTargetsBuffers[d]),tn.enableAttribute(i),Rt.vertexAttribPointer(i,3,Rt.FLOAT,!1,0,0)),i=r["morphNormal"+o],i>=0&&e.morphNormals&&(Rt.bindBuffer(Rt.ARRAY_BUFFER,t.__webglMorphNormalsBuffers[d]),tn.enableAttribute(i),Rt.vertexAttribPointer(i,3,Rt.FLOAT,!1,0,0)),n.__webglMorphTargetInfluences[o]=s[d]}else n.__webglMorphTargetInfluences[o]=0}null!==e.program.uniforms.morphTargetInfluences&&Rt.uniform1fv(e.program.uniforms.morphTargetInfluences,n.__webglMorphTargetInfluences)}function v(e,t){return e.object.renderOrder!==t.object.renderOrder?e.object.renderOrder-t.object.renderOrder:e.material.id!==t.material.id?e.material.id-t.material.id:e.z!==t.z?e.z-t.z:e.id-t.id
}function g(e,t){return e.object.renderOrder!==t.object.renderOrder?e.object.renderOrder-t.object.renderOrder:e.z!==t.z?t.z-e.z:e.id-t.id}function y(e,t){return t[0]-e[0]}function b(t){if(t.visible!==!1){if(t instanceof e.Scene||t instanceof e.Group);else if(E(t),t instanceof e.Light)Et.push(t);else if(t instanceof e.Sprite)Pt.push(t);else if(t instanceof e.LensFlare)kt.push(t);else{var n=St[t.id];if(n&&(t.frustumCulled===!1||Wt.intersectsObject(t)===!0))for(var r=0,i=n.length;i>r;r++){var o=n[r];C(o),o.render=!0,It.sortObjects===!0&&(Xt.setFromMatrixPosition(t.matrixWorld),Xt.applyProjection(qt),o.z=Xt.z)}}for(var r=0,i=t.children.length;i>r;r++)b(t.children[r])}}function x(t,n,r,i,o){for(var a,s=0,u=t.length;u>s;s++){var c=t[s],l=c.object,h=c.buffer;if(K(l,n),o)a=o;else{if(a=c.material,!a)continue;V(a)}It.setMaterialFaces(a),h instanceof e.BufferGeometry?It.renderBufferDirect(n,r,i,a,h,l):It.renderBuffer(n,r,i,a,h,l)}}function w(e,t,n,r,i,o){for(var a,s=0,u=e.length;u>s;s++){var c=e[s],l=c.object;if(l.visible){if(o)a=o;else{if(a=c[t],!a)continue;V(a)}It.renderImmediateObject(n,r,i,a,l)}}}function _(e){var t=e.object,n=t.material;n.transparent?(e.transparent=n,e.opaque=null):(e.opaque=n,e.transparent=null)}function C(t){var n=t.object,r=t.buffer,i=n.geometry,o=n.material;if(o instanceof e.MeshFaceMaterial){var a=i instanceof e.BufferGeometry?0:r.materialIndex;o=o.materials[a],t.material=o,o.transparent?At.push(t):Tt.push(t)}else o&&(t.material=o,o.transparent?At.push(t):Tt.push(t))}function E(t){void 0===t.__webglInit&&(t.__webglInit=!0,t._modelViewMatrix=new e.Matrix4,t._normalMatrix=new e.Matrix3,t.addEventListener("removed",Cn));var i=t.geometry;if(void 0===i||void 0===i.__webglInit&&(i.__webglInit=!0,i.addEventListener("dispose",En),i instanceof e.BufferGeometry?It.info.memory.geometries++:t instanceof e.Mesh?M(t,i):t instanceof e.Line?void 0===i.__webglVertexBuffer&&(r(i),s(i,t),i.verticesNeedUpdate=!0,i.colorsNeedUpdate=!0,i.lineDistancesNeedUpdate=!0):t instanceof e.PointCloud&&void 0===i.__webglVertexBuffer&&(n(i),a(i,t),i.verticesNeedUpdate=!0,i.colorsNeedUpdate=!0)),void 0===t.__webglActive)if(t.__webglActive=!0,t instanceof e.Mesh){if(i instanceof e.BufferGeometry)T(St,i,t);else if(i instanceof e.Geometry)for(var o=Dn[i.id],u=0,c=o.length;c>u;u++)T(St,o[u],t)}else t instanceof e.Line||t instanceof e.PointCloud?T(St,i,t):(t instanceof e.ImmediateRenderObject||t.immediateRenderCallback)&&A(Mt,t)}function S(e,t){for(var n,r,i=nn.get("OES_element_index_uint")?4294967296:65535,o={},a=e.morphTargets.length,s=e.morphNormals.length,u={},c=[],l=0,h=e.faces.length;h>l;l++){var f=e.faces[l],p=t?f.materialIndex:0;p in o||(o[p]={hash:p,counter:0}),n=o[p].hash+"_"+o[p].counter,n in u||(r={id:Bn++,faces3:[],materialIndex:p,vertices:0,numMorphTargets:a,numMorphNormals:s},u[n]=r,c.push(r)),u[n].vertices+3>i&&(o[p].counter+=1,n=o[p].hash+"_"+o[p].counter,n in u||(r={id:Bn++,faces3:[],materialIndex:p,vertices:0,numMorphTargets:a,numMorphNormals:s},u[n]=r,c.push(r))),u[n].faces3.push(l),u[n].vertices+=3}return c}function M(t,n){var r=t.material,o=!1;(void 0===Dn[n.id]||n.groupsNeedUpdate===!0)&&(delete St[t.id],Dn[n.id]=S(n,r instanceof e.MeshFaceMaterial),n.groupsNeedUpdate=!1);for(var a=Dn[n.id],s=0,c=a.length;c>s;s++){var l=a[s];void 0===l.__webglVertexBuffer?(i(l),u(l,t),n.verticesNeedUpdate=!0,n.morphTargetsNeedUpdate=!0,n.elementsNeedUpdate=!0,n.uvsNeedUpdate=!0,n.normalsNeedUpdate=!0,n.tangentsNeedUpdate=!0,n.colorsNeedUpdate=!0,o=!0):o=!1,(o||void 0===t.__webglActive)&&T(St,l,t)}t.__webglActive=!0}function T(e,t,n){var r=n.id;e[r]=e[r]||[],e[r].push({id:r,buffer:t,object:n,material:null,z:0})}function A(e,t){e.push({id:null,object:t,opaque:null,transparent:null,z:0})}function P(t){var n=t.geometry;if(n instanceof e.BufferGeometry)for(var r=n.attributes,i=n.attributesKeys,o=0,a=i.length;a>o;o++){var s=i[o],u=r[s],l="index"===s?Rt.ELEMENT_ARRAY_BUFFER:Rt.ARRAY_BUFFER;void 0===u.buffer?(u.buffer=Rt.createBuffer(),Rt.bindBuffer(l,u.buffer),Rt.bufferData(l,u.array,u instanceof e.DynamicBufferAttribute?Rt.DYNAMIC_DRAW:Rt.STATIC_DRAW),u.needsUpdate=!1):u.needsUpdate===!0&&(Rt.bindBuffer(l,u.buffer),void 0===u.updateRange||-1===u.updateRange.count?Rt.bufferSubData(l,0,u.array):0===u.updateRange.count?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."):(Rt.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=!1)}else if(t instanceof e.Mesh){n.groupsNeedUpdate===!0&&M(t,n);for(var d=Dn[n.id],o=0,m=d.length;m>o;o++){var v=d[o],g=c(t,v),y=g.attributes&&k(g);(n.verticesNeedUpdate||n.morphTargetsNeedUpdate||n.elementsNeedUpdate||n.uvsNeedUpdate||n.normalsNeedUpdate||n.colorsNeedUpdate||n.tangentsNeedUpdate||y)&&p(v,t,Rt.DYNAMIC_DRAW,!n.dynamic,g)}n.verticesNeedUpdate=!1,n.morphTargetsNeedUpdate=!1,n.elementsNeedUpdate=!1,n.uvsNeedUpdate=!1,n.normalsNeedUpdate=!1,n.colorsNeedUpdate=!1,n.tangentsNeedUpdate=!1,g.attributes&&R(g)}else if(t instanceof e.Line){var g=c(t,n),y=g.attributes&&k(g);(n.verticesNeedUpdate||n.colorsNeedUpdate||n.lineDistancesNeedUpdate||y)&&f(n,Rt.DYNAMIC_DRAW),n.verticesNeedUpdate=!1,n.colorsNeedUpdate=!1,n.lineDistancesNeedUpdate=!1,g.attributes&&R(g)}else if(t instanceof e.PointCloud){var g=c(t,n),y=g.attributes&&k(g);(n.verticesNeedUpdate||n.colorsNeedUpdate||y)&&h(n,Rt.DYNAMIC_DRAW,t),n.verticesNeedUpdate=!1,n.colorsNeedUpdate=!1,g.attributes&&R(g)}}function k(e){for(var t in e.attributes)if(e.attributes[t].needsUpdate)return!0;return!1}function R(e){for(var t in e.attributes)e.attributes[t].needsUpdate=!1}function I(t){t instanceof e.Mesh||t instanceof e.PointCloud||t instanceof e.Line?delete St[t.id]:(t instanceof e.ImmediateRenderObject||t.immediateRenderCallback)&&D(Mt,t),delete t.__webglInit,delete t._modelViewMatrix,delete t._normalMatrix,delete t.__webglActive}function D(e,t){for(var n=e.length-1;n>=0;n--)e[n].object===t&&e.splice(n,1)}function B(t,n,r,i){t.addEventListener("dispose",Tn);var o=Vn[t.type];if(o){var a=e.ShaderLib[o];t.__webglShader={uniforms:e.UniformsUtils.clone(a.uniforms),vertexShader:a.vertexShader,fragmentShader:a.fragmentShader}}else t.__webglShader={uniforms:t.uniforms,vertexShader:t.vertexShader,fragmentShader:t.fragmentShader};var s=ct(n),u=lt(n),c=ut(i),l={precision:dt,supportsVertexTextures:hn,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:r,useFog:t.fog,fogExp:r instanceof e.FogExp2,flatShading:t.shading===e.FlatShading,sizeAttenuation:t.sizeAttenuation,logarithmicDepthBuffer:wt,skinning:t.skinning,maxBones:c,useVertexTexture:fn&&i&&i.skeleton&&i.skeleton.useVertexTexture,morphTargets:t.morphTargets,morphNormals:t.morphNormals,maxMorphTargets:It.maxMorphTargets,maxMorphNormals:It.maxMorphNormals,maxDirLights:s.directional,maxPointLights:s.point,maxSpotLights:s.spot,maxHemiLights:s.hemi,maxShadows:u,shadowMapEnabled:It.shadowMapEnabled&&i.receiveShadow&&u>0,shadowMapType:It.shadowMapType,shadowMapDebug:It.shadowMapDebug,shadowMapCascade:It.shadowMapCascade,alphaTest:t.alphaTest,metal:t.metal,wrapAround:t.wrapAround,doubleSided:t.side===e.DoubleSide,flipSided:t.side===e.BackSide},h=[];if(o?h.push(o):(h.push(t.fragmentShader),h.push(t.vertexShader)),void 0!==t.defines)for(var f in t.defines)h.push(f),h.push(t.defines[f]);for(var f in l)h.push(f),h.push(l[f]);for(var p,d=h.join(),m=0,v=Dt.length;v>m;m++){var g=Dt[m];if(g.code===d){p=g,p.usedTimes++;break}}void 0===p&&(p=new e.WebGLProgram(It,d,t,l),Dt.push(p),It.info.memory.programs=Dt.length),t.program=p;var y=p.attributes;if(t.morphTargets){t.numSupportedMorphTargets=0;for(var b,x="morphTarget",w=0;w<It.maxMorphTargets;w++)b=x+w,y[b]>=0&&t.numSupportedMorphTargets++}if(t.morphNormals){t.numSupportedMorphNormals=0;var b,x="morphNormal";for(w=0;w<It.maxMorphNormals;w++)b=x+w,y[b]>=0&&t.numSupportedMorphNormals++}t.uniformsList=[];for(var _ in t.__webglShader.uniforms){var C=t.program.uniforms[_];C&&t.uniformsList.push([t.__webglShader.uniforms[_],C])}}function V(t){t.transparent===!0?tn.setBlending(t.blending,t.blendEquation,t.blendSrc,t.blendDst,t.blendEquationAlpha,t.blendSrcAlpha,t.blendDstAlpha):tn.setBlending(e.NoBlending),tn.setDepthTest(t.depthTest),tn.setDepthWrite(t.depthWrite),tn.setColorWrite(t.colorWrite),tn.setPolygonOffset(t.polygonOffset,t.polygonOffsetFactor,t.polygonOffsetUnits)}function L(t,n,r,i,o){Ft=0,i.needsUpdate&&(i.program&&In(i),B(i,n,r,o),i.needsUpdate=!1),i.morphTargets&&(o.__webglMorphTargetInfluences||(o.__webglMorphTargetInfluences=new Float32Array(It.maxMorphTargets)));var a=!1,s=!1,u=!1,c=i.program,l=c.uniforms,h=i.__webglShader.uniforms;if(c.id!==Bt&&(Rt.useProgram(c.program),Bt=c.id,a=!0,s=!0,u=!0),i.id!==Lt&&(-1===Lt&&(u=!0),Lt=i.id,s=!0),(a||t!==Ot)&&(Rt.uniformMatrix4fv(l.projectionMatrix,!1,t.projectionMatrix.elements),wt&&Rt.uniform1f(l.logDepthBufFC,2/(Math.log(t.far+1)/Math.LN2)),t!==Ot&&(Ot=t),(i instanceof e.ShaderMaterial||i instanceof e.MeshPhongMaterial||i.envMap)&&null!==l.cameraPosition&&(Xt.setFromMatrixPosition(t.matrixWorld),Rt.uniform3f(l.cameraPosition,Xt.x,Xt.y,Xt.z)),(i instanceof e.MeshPhongMaterial||i instanceof e.MeshLambertMaterial||i instanceof e.MeshBasicMaterial||i instanceof e.ShaderMaterial||i.skinning)&&null!==l.viewMatrix&&Rt.uniformMatrix4fv(l.viewMatrix,!1,t.matrixWorldInverse.elements)),i.skinning)if(o.bindMatrix&&null!==l.bindMatrix&&Rt.uniformMatrix4fv(l.bindMatrix,!1,o.bindMatrix.elements),o.bindMatrixInverse&&null!==l.bindMatrixInverse&&Rt.uniformMatrix4fv(l.bindMatrixInverse,!1,o.bindMatrixInverse.elements),fn&&o.skeleton&&o.skeleton.useVertexTexture){if(null!==l.boneTexture){var f=X();Rt.uniform1i(l.boneTexture,f),It.setTexture(o.skeleton.boneTexture,f)}null!==l.boneTextureWidth&&Rt.uniform1i(l.boneTextureWidth,o.skeleton.boneTextureWidth),null!==l.boneTextureHeight&&Rt.uniform1i(l.boneTextureHeight,o.skeleton.boneTextureHeight)}else o.skeleton&&o.skeleton.boneMatrices&&null!==l.boneGlobalMatrices&&Rt.uniformMatrix4fv(l.boneGlobalMatrices,!1,o.skeleton.boneMatrices);return s&&(r&&i.fog&&z(h,r),(i instanceof e.MeshPhongMaterial||i instanceof e.MeshLambertMaterial||i.lights)&&(Kt&&(u=!0,Z(n),Kt=!1),u?(j(h,Qt),G(h,!0)):G(h,!1)),(i instanceof e.MeshBasicMaterial||i instanceof e.MeshLambertMaterial||i instanceof e.MeshPhongMaterial)&&N(h,i),i instanceof e.LineBasicMaterial?O(h,i):i instanceof e.LineDashedMaterial?(O(h,i),F(h,i)):i instanceof e.PointCloudMaterial?U(h,i):i instanceof e.MeshPhongMaterial?$(h,i):i instanceof e.MeshLambertMaterial?H(h,i):i instanceof e.MeshDepthMaterial?(h.mNear.value=t.near,h.mFar.value=t.far,h.opacity.value=i.opacity):i instanceof e.MeshNormalMaterial&&(h.opacity.value=i.opacity),o.receiveShadow&&!i._shadowPass&&W(h,n),Y(i.uniformsList)),q(l,o),null!==l.modelMatrix&&Rt.uniformMatrix4fv(l.modelMatrix,!1,o.matrixWorld.elements),c}function N(t,n){t.opacity.value=n.opacity,t.diffuse.value=n.color,t.map.value=n.map,t.lightMap.value=n.lightMap,t.specularMap.value=n.specularMap,t.alphaMap.value=n.alphaMap,n.bumpMap&&(t.bumpMap.value=n.bumpMap,t.bumpScale.value=n.bumpScale),n.normalMap&&(t.normalMap.value=n.normalMap,t.normalScale.value.copy(n.normalScale));var r;if(n.map?r=n.map:n.specularMap?r=n.specularMap:n.normalMap?r=n.normalMap:n.bumpMap?r=n.bumpMap:n.alphaMap&&(r=n.alphaMap),void 0!==r){var i=r.offset,o=r.repeat;t.offsetRepeat.value.set(i.x,i.y,o.x,o.y)}t.envMap.value=n.envMap,t.flipEnvMap.value=n.envMap instanceof e.WebGLRenderTargetCube?1:-1,t.reflectivity.value=n.reflectivity,t.refractionRatio.value=n.refractionRatio}function O(e,t){e.diffuse.value=t.color,e.opacity.value=t.opacity}function F(e,t){e.dashSize.value=t.dashSize,e.totalSize.value=t.dashSize+t.gapSize,e.scale.value=t.scale}function U(e,t){if(e.psColor.value=t.color,e.opacity.value=t.opacity,e.size.value=t.size,e.scale.value=ht.height/2,e.map.value=t.map,null!==t.map){var n=t.map.offset,r=t.map.repeat;e.offsetRepeat.value.set(n.x,n.y,r.x,r.y)}}function z(t,n){t.fogColor.value=n.color,n instanceof e.Fog?(t.fogNear.value=n.near,t.fogFar.value=n.far):n instanceof e.FogExp2&&(t.fogDensity.value=n.density)}function $(e,t){e.shininess.value=t.shininess,e.emissive.value=t.emissive,e.specular.value=t.specular,t.wrapAround&&e.wrapRGB.value.copy(t.wrapRGB)}function H(e,t){e.emissive.value=t.emissive,t.wrapAround&&e.wrapRGB.value.copy(t.wrapRGB)}function j(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 G(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 W(t,n){if(t.shadowMatrix)for(var r=0,i=0,o=n.length;o>i;i++){var a=n[i];a.castShadow&&(a instanceof e.SpotLight||a instanceof e.DirectionalLight&&!a.shadowCascade)&&(t.shadowMap.value[r]=a.shadowMap,t.shadowMapSize.value[r]=a.shadowMapSize,t.shadowMatrix.value[r]=a.shadowMatrix,t.shadowDarkness.value[r]=a.shadowDarkness,t.shadowBias.value[r]=a.shadowBias,r++)}}function q(e,t){Rt.uniformMatrix4fv(e.modelViewMatrix,!1,t._modelViewMatrix.elements),e.normalMatrix&&Rt.uniformMatrix3fv(e.normalMatrix,!1,t._normalMatrix.elements)}function X(){var t=Ft;return t>=sn&&e.warn("WebGLRenderer: trying to use "+t+" texture units while this GPU supports only "+sn),Ft+=1,t}function Y(t){for(var n,r,i,o=0,a=t.length;a>o;o++){var s=t[o][0];if(s.needsUpdate!==!1){var u=s.type,c=s.value,l=t[o][1];switch(u){case"1i":Rt.uniform1i(l,c);break;case"1f":Rt.uniform1f(l,c);break;case"2f":Rt.uniform2f(l,c[0],c[1]);break;case"3f":Rt.uniform3f(l,c[0],c[1],c[2]);break;case"4f":Rt.uniform4f(l,c[0],c[1],c[2],c[3]);break;case"1iv":Rt.uniform1iv(l,c);break;case"3iv":Rt.uniform3iv(l,c);break;case"1fv":Rt.uniform1fv(l,c);break;case"2fv":Rt.uniform2fv(l,c);break;case"3fv":Rt.uniform3fv(l,c);break;case"4fv":Rt.uniform4fv(l,c);break;case"Matrix3fv":Rt.uniformMatrix3fv(l,!1,c);break;case"Matrix4fv":Rt.uniformMatrix4fv(l,!1,c);break;case"i":Rt.uniform1i(l,c);break;case"f":Rt.uniform1f(l,c);break;case"v2":Rt.uniform2f(l,c.x,c.y);break;case"v3":Rt.uniform3f(l,c.x,c.y,c.z);break;case"v4":Rt.uniform4f(l,c.x,c.y,c.z,c.w);break;case"c":Rt.uniform3f(l,c.r,c.g,c.b);break;case"iv1":Rt.uniform1iv(l,c);break;case"iv":Rt.uniform3iv(l,c);break;case"fv1":Rt.uniform1fv(l,c);break;case"fv":Rt.uniform3fv(l,c);break;case"v2v":void 0===s._array&&(s._array=new Float32Array(2*c.length));for(var h=0,f=c.length;f>h;h++)i=2*h,s._array[i]=c[h].x,s._array[i+1]=c[h].y;Rt.uniform2fv(l,s._array);break;case"v3v":void 0===s._array&&(s._array=new Float32Array(3*c.length));for(var h=0,f=c.length;f>h;h++)i=3*h,s._array[i]=c[h].x,s._array[i+1]=c[h].y,s._array[i+2]=c[h].z;Rt.uniform3fv(l,s._array);break;case"v4v":void 0===s._array&&(s._array=new Float32Array(4*c.length));for(var h=0,f=c.length;f>h;h++)i=4*h,s._array[i]=c[h].x,s._array[i+1]=c[h].y,s._array[i+2]=c[h].z,s._array[i+3]=c[h].w;Rt.uniform4fv(l,s._array);break;case"m3":Rt.uniformMatrix3fv(l,!1,c.elements);break;case"m3v":void 0===s._array&&(s._array=new Float32Array(9*c.length));for(var h=0,f=c.length;f>h;h++)c[h].flattenToArrayOffset(s._array,9*h);Rt.uniformMatrix3fv(l,!1,s._array);break;case"m4":Rt.uniformMatrix4fv(l,!1,c.elements);break;case"m4v":void 0===s._array&&(s._array=new Float32Array(16*c.length));for(var h=0,f=c.length;f>h;h++)c[h].flattenToArrayOffset(s._array,16*h);Rt.uniformMatrix4fv(l,!1,s._array);break;case"t":if(n=c,r=X(),Rt.uniform1i(l,r),!n)continue;n instanceof e.CubeTexture||n.image instanceof Array&&6===n.image.length?tt(n,r):n instanceof e.WebGLRenderTargetCube?nt(n,r):It.setTexture(n,r);break;case"tv":void 0===s._array&&(s._array=[]);for(var h=0,f=s.value.length;f>h;h++)s._array[h]=X();Rt.uniform1iv(l,s._array);for(var h=0,f=s.value.length;f>h;h++)n=s.value[h],r=s._array[h],n&&It.setTexture(n,r);break;default:e.warn("THREE.WebGLRenderer: Unknown uniform type: "+u)}}}}function K(e,t){e._modelViewMatrix.multiplyMatrices(t.matrixWorldInverse,e.matrixWorld),e._normalMatrix.getNormalMatrix(e._modelViewMatrix)}function Q(e,t,n,r){e[t]=n.r*r,e[t+1]=n.g*r,e[t+2]=n.b*r}function Z(t){var n,r,i,o,a,s,u,c,l=0,h=0,f=0,p=Qt,d=p.directional.colors,m=p.directional.positions,v=p.point.colors,g=p.point.positions,y=p.point.distances,b=p.point.decays,x=p.spot.colors,w=p.spot.positions,_=p.spot.distances,C=p.spot.directions,E=p.spot.anglesCos,S=p.spot.exponents,M=p.spot.decays,T=p.hemi.skyColors,A=p.hemi.groundColors,P=p.hemi.positions,k=0,R=0,I=0,D=0,B=0,V=0,L=0,N=0,O=0,F=0,U=0,z=0;for(n=0,r=t.length;r>n;n++)if(i=t[n],!i.onlyShadow)if(o=i.color,u=i.intensity,c=i.distance,i instanceof e.AmbientLight){if(!i.visible)continue;l+=o.r,h+=o.g,f+=o.b}else if(i instanceof e.DirectionalLight){if(B+=1,!i.visible)continue;Yt.setFromMatrixPosition(i.matrixWorld),Xt.setFromMatrixPosition(i.target.matrixWorld),Yt.sub(Xt),Yt.normalize(),O=3*k,m[O]=Yt.x,m[O+1]=Yt.y,m[O+2]=Yt.z,Q(d,O,o,u),k+=1}else if(i instanceof e.PointLight){if(V+=1,!i.visible)continue;F=3*R,Q(v,F,o,u),Xt.setFromMatrixPosition(i.matrixWorld),g[F]=Xt.x,g[F+1]=Xt.y,g[F+2]=Xt.z,y[R]=c,b[R]=0===i.distance?0:i.decay,R+=1}else if(i instanceof e.SpotLight){if(L+=1,!i.visible)continue;U=3*I,Q(x,U,o,u),Yt.setFromMatrixPosition(i.matrixWorld),w[U]=Yt.x,w[U+1]=Yt.y,w[U+2]=Yt.z,_[I]=c,Xt.setFromMatrixPosition(i.target.matrixWorld),Yt.sub(Xt),Yt.normalize(),C[U]=Yt.x,C[U+1]=Yt.y,C[U+2]=Yt.z,E[I]=Math.cos(i.angle),S[I]=i.exponent,M[I]=0===i.distance?0:i.decay,I+=1}else if(i instanceof e.HemisphereLight){if(N+=1,!i.visible)continue;Yt.setFromMatrixPosition(i.matrixWorld),Yt.normalize(),z=3*D,P[z]=Yt.x,P[z+1]=Yt.y,P[z+2]=Yt.z,a=i.color,s=i.groundColor,Q(T,z,a,u),Q(A,z,s,u),D+=1}for(n=3*k,r=Math.max(d.length,3*B);r>n;n++)d[n]=0;for(n=3*R,r=Math.max(v.length,3*V);r>n;n++)v[n]=0;for(n=3*I,r=Math.max(x.length,3*L);r>n;n++)x[n]=0;for(n=3*D,r=Math.max(T.length,3*N);r>n;n++)T[n]=0;for(n=3*D,r=Math.max(A.length,3*N);r>n;n++)A[n]=0;p.directional.length=k,p.point.length=R,p.spot.length=I,p.hemi.length=D,p.ambient[0]=l,p.ambient[1]=h,p.ambient[2]=f}function J(t,n,r){var i;r?(Rt.texParameteri(t,Rt.TEXTURE_WRAP_S,st(n.wrapS)),Rt.texParameteri(t,Rt.TEXTURE_WRAP_T,st(n.wrapT)),Rt.texParameteri(t,Rt.TEXTURE_MAG_FILTER,st(n.magFilter)),Rt.texParameteri(t,Rt.TEXTURE_MIN_FILTER,st(n.minFilter))):(Rt.texParameteri(t,Rt.TEXTURE_WRAP_S,Rt.CLAMP_TO_EDGE),Rt.texParameteri(t,Rt.TEXTURE_WRAP_T,Rt.CLAMP_TO_EDGE),(n.wrapS!==e.ClampToEdgeWrapping||n.wrapT!==e.ClampToEdgeWrapping)&&e.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping. ( "+n.sourceFile+" )"),Rt.texParameteri(t,Rt.TEXTURE_MAG_FILTER,at(n.magFilter)),Rt.texParameteri(t,Rt.TEXTURE_MIN_FILTER,at(n.minFilter)),n.minFilter!==e.NearestFilter&&n.minFilter!==e.LinearFilter&&e.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter. ( "+n.sourceFile+" )")),i=nn.get("EXT_texture_filter_anisotropic"),i&&n.type!==e.FloatType&&n.type!==e.HalfFloatType&&(n.anisotropy>1||n.__currentAnisotropy)&&(Rt.texParameterf(t,i.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(n.anisotropy,It.getMaxAnisotropy())),n.__currentAnisotropy=n.anisotropy)}function et(t,n){if(t.width>n||t.height>n){var r=n/Math.max(t.width,t.height),i=document.createElement("canvas");i.width=Math.floor(t.width*r),i.height=Math.floor(t.height*r);var o=i.getContext("2d");return o.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),i}return t}function tt(t,n){if(6===t.image.length)if(t.needsUpdate){t.image.__webglTextureCube||(t.addEventListener("dispose",Sn),t.image.__webglTextureCube=Rt.createTexture(),It.info.memory.textures++),Rt.activeTexture(Rt.TEXTURE0+n),Rt.bindTexture(Rt.TEXTURE_CUBE_MAP,t.image.__webglTextureCube),Rt.pixelStorei(Rt.UNPACK_FLIP_Y_WEBGL,t.flipY);for(var r=t instanceof e.CompressedTexture,i=t.image[0]instanceof e.DataTexture,o=[],a=0;6>a;a++)o[a]=!It.autoScaleCubemaps||r||i?i?t.image[a].image:t.image[a]:et(t.image[a],ln);var s=o[0],u=e.Math.isPowerOfTwo(s.width)&&e.Math.isPowerOfTwo(s.height),c=st(t.format),l=st(t.type);J(Rt.TEXTURE_CUBE_MAP,t,u);for(var a=0;6>a;a++)if(r)for(var h,f=o[a].mipmaps,p=0,d=f.length;d>p;p++)h=f[p],t.format!==e.RGBAFormat&&t.format!==e.RGBFormat?gn().indexOf(c)>-1?Rt.compressedTexImage2D(Rt.TEXTURE_CUBE_MAP_POSITIVE_X+a,p,c,h.width,h.height,0,h.data):e.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setCubeTexture()"):Rt.texImage2D(Rt.TEXTURE_CUBE_MAP_POSITIVE_X+a,p,c,h.width,h.height,0,c,l,h.data);else i?Rt.texImage2D(Rt.TEXTURE_CUBE_MAP_POSITIVE_X+a,0,c,o[a].width,o[a].height,0,c,l,o[a].data):Rt.texImage2D(Rt.TEXTURE_CUBE_MAP_POSITIVE_X+a,0,c,c,l,o[a]);t.generateMipmaps&&u&&Rt.generateMipmap(Rt.TEXTURE_CUBE_MAP),t.needsUpdate=!1,t.onUpdate&&t.onUpdate()}else Rt.activeTexture(Rt.TEXTURE0+n),Rt.bindTexture(Rt.TEXTURE_CUBE_MAP,t.image.__webglTextureCube)}function nt(e,t){Rt.activeTexture(Rt.TEXTURE0+t),Rt.bindTexture(Rt.TEXTURE_CUBE_MAP,e.__webglTexture)}function rt(e,t,n){Rt.bindFramebuffer(Rt.FRAMEBUFFER,e),Rt.framebufferTexture2D(Rt.FRAMEBUFFER,Rt.COLOR_ATTACHMENT0,n,t.__webglTexture,0)}function it(e,t){Rt.bindRenderbuffer(Rt.RENDERBUFFER,e),t.depthBuffer&&!t.stencilBuffer?(Rt.renderbufferStorage(Rt.RENDERBUFFER,Rt.DEPTH_COMPONENT16,t.width,t.height),Rt.framebufferRenderbuffer(Rt.FRAMEBUFFER,Rt.DEPTH_ATTACHMENT,Rt.RENDERBUFFER,e)):t.depthBuffer&&t.stencilBuffer?(Rt.renderbufferStorage(Rt.RENDERBUFFER,Rt.DEPTH_STENCIL,t.width,t.height),Rt.framebufferRenderbuffer(Rt.FRAMEBUFFER,Rt.DEPTH_STENCIL_ATTACHMENT,Rt.RENDERBUFFER,e)):Rt.renderbufferStorage(Rt.RENDERBUFFER,Rt.RGBA4,t.width,t.height)}function ot(t){t instanceof e.WebGLRenderTargetCube?(Rt.bindTexture(Rt.TEXTURE_CUBE_MAP,t.__webglTexture),Rt.generateMipmap(Rt.TEXTURE_CUBE_MAP),Rt.bindTexture(Rt.TEXTURE_CUBE_MAP,null)):(Rt.bindTexture(Rt.TEXTURE_2D,t.__webglTexture),Rt.generateMipmap(Rt.TEXTURE_2D),Rt.bindTexture(Rt.TEXTURE_2D,null))}function at(t){return t===e.NearestFilter||t===e.NearestMipMapNearestFilter||t===e.NearestMipMapLinearFilter?Rt.NEAREST:Rt.LINEAR}function st(t){var n;if(t===e.RepeatWrapping)return Rt.REPEAT;if(t===e.ClampToEdgeWrapping)return Rt.CLAMP_TO_EDGE;if(t===e.MirroredRepeatWrapping)return Rt.MIRRORED_REPEAT;if(t===e.NearestFilter)return Rt.NEAREST;if(t===e.NearestMipMapNearestFilter)return Rt.NEAREST_MIPMAP_NEAREST;if(t===e.NearestMipMapLinearFilter)return Rt.NEAREST_MIPMAP_LINEAR;if(t===e.LinearFilter)return Rt.LINEAR;if(t===e.LinearMipMapNearestFilter)return Rt.LINEAR_MIPMAP_NEAREST;if(t===e.LinearMipMapLinearFilter)return Rt.LINEAR_MIPMAP_LINEAR;if(t===e.UnsignedByteType)return Rt.UNSIGNED_BYTE;if(t===e.UnsignedShort4444Type)return Rt.UNSIGNED_SHORT_4_4_4_4;if(t===e.UnsignedShort5551Type)return Rt.UNSIGNED_SHORT_5_5_5_1;if(t===e.UnsignedShort565Type)return Rt.UNSIGNED_SHORT_5_6_5;if(t===e.ByteType)return Rt.BYTE;if(t===e.ShortType)return Rt.SHORT;if(t===e.UnsignedShortType)return Rt.UNSIGNED_SHORT;if(t===e.IntType)return Rt.INT;if(t===e.UnsignedIntType)return Rt.UNSIGNED_INT;if(t===e.FloatType)return Rt.FLOAT;if(n=nn.get("OES_texture_half_float"),null!==n&&t===e.HalfFloatType)return n.HALF_FLOAT_OES;if(t===e.AlphaFormat)return Rt.ALPHA;if(t===e.RGBFormat)return Rt.RGB;if(t===e.RGBAFormat)return Rt.RGBA;if(t===e.LuminanceFormat)return Rt.LUMINANCE;if(t===e.LuminanceAlphaFormat)return Rt.LUMINANCE_ALPHA;if(t===e.AddEquation)return Rt.FUNC_ADD;if(t===e.SubtractEquation)return Rt.FUNC_SUBTRACT;if(t===e.ReverseSubtractEquation)return Rt.FUNC_REVERSE_SUBTRACT;if(t===e.ZeroFactor)return Rt.ZERO;if(t===e.OneFactor)return Rt.ONE;if(t===e.SrcColorFactor)return Rt.SRC_COLOR;if(t===e.OneMinusSrcColorFactor)return Rt.ONE_MINUS_SRC_COLOR;if(t===e.SrcAlphaFactor)return Rt.SRC_ALPHA;if(t===e.OneMinusSrcAlphaFactor)return Rt.ONE_MINUS_SRC_ALPHA;if(t===e.DstAlphaFactor)return Rt.DST_ALPHA;if(t===e.OneMinusDstAlphaFactor)return Rt.ONE_MINUS_DST_ALPHA;if(t===e.DstColorFactor)return Rt.DST_COLOR;if(t===e.OneMinusDstColorFactor)return Rt.ONE_MINUS_DST_COLOR;if(t===e.SrcAlphaSaturateFactor)return Rt.SRC_ALPHA_SATURATE;if(n=nn.get("WEBGL_compressed_texture_s3tc"),null!==n){if(t===e.RGB_S3TC_DXT1_Format)return n.COMPRESSED_RGB_S3TC_DXT1_EXT;if(t===e.RGBA_S3TC_DXT1_Format)return n.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(t===e.RGBA_S3TC_DXT3_Format)return n.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(t===e.RGBA_S3TC_DXT5_Format)return n.COMPRESSED_RGBA_S3TC_DXT5_EXT}if(n=nn.get("WEBGL_compressed_texture_pvrtc"),null!==n){if(t===e.RGB_PVRTC_4BPPV1_Format)return n.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(t===e.RGB_PVRTC_2BPPV1_Format)return n.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(t===e.RGBA_PVRTC_4BPPV1_Format)return n.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(t===e.RGBA_PVRTC_2BPPV1_Format)return n.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(n=nn.get("EXT_blend_minmax"),null!==n){if(t===e.MinEquation)return n.MIN_EXT;if(t===e.MaxEquation)return n.MAX_EXT}return 0}function ut(t){if(fn&&t&&t.skeleton&&t.skeleton.useVertexTexture)return 1024;var n=Rt.getParameter(Rt.MAX_VERTEX_UNIFORM_VECTORS),r=Math.floor((n-20)/4),i=r;return void 0!==t&&t instanceof e.SkinnedMesh&&(i=Math.min(t.skeleton.bones.length,i),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)")),i}function ct(t){for(var n=0,r=0,i=0,o=0,a=0,s=t.length;s>a;a++){var u=t[a];u.onlyShadow||u.visible===!1||(u instanceof e.DirectionalLight&&n++,u instanceof e.PointLight&&r++,u instanceof e.SpotLight&&i++,u instanceof e.HemisphereLight&&o++)}return{directional:n,point:r,spot:i,hemi:o}}function lt(t){for(var n=0,r=0,i=t.length;i>r;r++){var o=t[r];o.castShadow&&(o instanceof e.SpotLight&&n++,o instanceof e.DirectionalLight&&!o.shadowCascade&&n++)}return n}t=t||{};var ht=void 0!==t.canvas?t.canvas:document.createElement("canvas"),ft=void 0!==t.context?t.context:null,pt=1,dt=void 0!==t.precision?t.precision:"highp",mt=void 0!==t.alpha?t.alpha:!1,vt=void 0!==t.depth?t.depth:!0,gt=void 0!==t.stencil?t.stencil:!0,yt=void 0!==t.antialias?t.antialias:!1,bt=void 0!==t.premultipliedAlpha?t.premultipliedAlpha:!0,xt=void 0!==t.preserveDrawingBuffer?t.preserveDrawingBuffer:!1,wt=void 0!==t.logarithmicDepthBuffer?t.logarithmicDepthBuffer:!1,_t=new e.Color(0),Ct=0,Et=[],St={},Mt=[],Tt=[],At=[],Pt=[],kt=[];this.domElement=ht,this.context=null,this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.gammaFactor=2,this.gammaInput=!1,this.gammaOutput=!1,this.shadowMapEnabled=!1,this.shadowMapType=e.PCFShadowMap,this.shadowMapCullFace=e.CullFaceFront,this.shadowMapDebug=!1,this.shadowMapCascade=!1,this.maxMorphTargets=8,this.maxMorphNormals=4,this.autoScaleCubemaps=!0,this.info={memory:{programs:0,geometries:0,textures:0},render:{calls:0,vertices:0,faces:0,points:0}};var Rt,It=this,Dt=[],Bt=null,Vt=null,Lt=-1,Nt="",Ot=null,Ft=0,Ut=0,zt=0,$t=ht.width,Ht=ht.height,jt=0,Gt=0,Wt=new e.Frustum,qt=new e.Matrix4,Xt=new e.Vector3,Yt=new e.Vector3,Kt=!0,Qt={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:[]}},Zt=function(e){e.preventDefault(),an(),on(),St={}};try{var Jt={alpha:mt,depth:vt,stencil:gt,antialias:yt,premultipliedAlpha:bt,preserveDrawingBuffer:xt};if(Rt=ft||ht.getContext("webgl",Jt)||ht.getContext("experimental-webgl",Jt),null===Rt)throw null!==ht.getContext("webgl")?"Error creating WebGL context with your selected attributes.":"Error creating WebGL context.";ht.addEventListener("webglcontextlost",Zt,!1)}catch(en){e.error("THREE.WebGLRenderer: "+en)}this.dispose=function(){ht.removeEventListener("webglcontextlost",Zt,!1)};var tn=new e.WebGLState(Rt,st);void 0===Rt.getShaderPrecisionFormat&&(Rt.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}});var nn=new e.WebGLExtensions(Rt);nn.get("OES_texture_float"),nn.get("OES_texture_float_linear"),nn.get("OES_texture_half_float"),nn.get("OES_texture_half_float_linear"),nn.get("OES_standard_derivatives"),wt&&nn.get("EXT_frag_depth");var rn=function(e,t,n,r){bt===!0&&(e*=r,t*=r,n*=r),Rt.clearColor(e,t,n,r)},on=function(){Rt.clearColor(0,0,0,1),Rt.clearDepth(1),Rt.clearStencil(0),Rt.enable(Rt.DEPTH_TEST),Rt.depthFunc(Rt.LEQUAL),Rt.frontFace(Rt.CCW),Rt.cullFace(Rt.BACK),Rt.enable(Rt.CULL_FACE),Rt.enable(Rt.BLEND),Rt.blendEquation(Rt.FUNC_ADD),Rt.blendFunc(Rt.SRC_ALPHA,Rt.ONE_MINUS_SRC_ALPHA),Rt.viewport(Ut,zt,$t,Ht),rn(_t.r,_t.g,_t.b,Ct)},an=function(){Bt=null,Ot=null,Nt="",Lt=-1,Kt=!0,tn.reset()};on(),this.context=Rt,this.state=tn;var sn=Rt.getParameter(Rt.MAX_TEXTURE_IMAGE_UNITS),un=Rt.getParameter(Rt.MAX_VERTEX_TEXTURE_IMAGE_UNITS),cn=Rt.getParameter(Rt.MAX_TEXTURE_SIZE),ln=Rt.getParameter(Rt.MAX_CUBE_MAP_TEXTURE_SIZE),hn=un>0,fn=hn&&nn.get("OES_texture_float"),pn=Rt.getShaderPrecisionFormat(Rt.VERTEX_SHADER,Rt.HIGH_FLOAT),dn=Rt.getShaderPrecisionFormat(Rt.VERTEX_SHADER,Rt.MEDIUM_FLOAT),mn=Rt.getShaderPrecisionFormat(Rt.FRAGMENT_SHADER,Rt.HIGH_FLOAT),vn=Rt.getShaderPrecisionFormat(Rt.FRAGMENT_SHADER,Rt.MEDIUM_FLOAT),gn=function(){var e;return function(){if(void 0!==e)return e;if(e=[],nn.get("WEBGL_compressed_texture_pvrtc")||nn.get("WEBGL_compressed_texture_s3tc"))for(var t=Rt.getParameter(Rt.COMPRESSED_TEXTURE_FORMATS),n=0;n<t.length;n++)e.push(t[n]);return e}}(),yn=pn.precision>0&&mn.precision>0,bn=dn.precision>0&&vn.precision>0;"highp"!==dt||yn||(bn?(dt="mediump",e.warn("THREE.WebGLRenderer: highp not supported, using mediump.")):(dt="lowp",e.warn("THREE.WebGLRenderer: highp and mediump not supported, using lowp."))),"mediump"!==dt||bn||(dt="lowp",e.warn("THREE.WebGLRenderer: mediump not supported, using lowp."));var xn=new e.ShadowMapPlugin(this,Et,St,Mt),wn=new e.SpritePlugin(this,Pt),_n=new e.LensFlarePlugin(this,kt);this.getContext=function(){return Rt},this.forceContextLoss=function(){nn.get("WEBGL_lose_context").loseContext()},this.supportsVertexTextures=function(){return hn},this.supportsFloatTextures=function(){return nn.get("OES_texture_float")},this.supportsHalfFloatTextures=function(){return nn.get("OES_texture_half_float")},this.supportsStandardDerivatives=function(){return nn.get("OES_standard_derivatives")},this.supportsCompressedTextureS3TC=function(){return nn.get("WEBGL_compressed_texture_s3tc")},this.supportsCompressedTexturePVRTC=function(){return nn.get("WEBGL_compressed_texture_pvrtc")
},this.supportsBlendMinMax=function(){return nn.get("EXT_blend_minmax")},this.getMaxAnisotropy=function(){var e;return function(){if(void 0!==e)return e;var t=nn.get("EXT_texture_filter_anisotropic");return e=null!==t?Rt.getParameter(t.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0}}(),this.getPrecision=function(){return dt},this.getPixelRatio=function(){return pt},this.setPixelRatio=function(e){pt=e},this.setSize=function(e,t,n){ht.width=e*pt,ht.height=t*pt,n!==!1&&(ht.style.width=e+"px",ht.style.height=t+"px"),this.setViewport(0,0,e,t)},this.setViewport=function(e,t,n,r){Ut=e*pt,zt=t*pt,$t=n*pt,Ht=r*pt,Rt.viewport(Ut,zt,$t,Ht)},this.setScissor=function(e,t,n,r){Rt.scissor(e*pt,t*pt,n*pt,r*pt)},this.enableScissorTest=function(e){e?Rt.enable(Rt.SCISSOR_TEST):Rt.disable(Rt.SCISSOR_TEST)},this.getClearColor=function(){return _t},this.setClearColor=function(e,t){_t.set(e),Ct=void 0!==t?t:1,rn(_t.r,_t.g,_t.b,Ct)},this.getClearAlpha=function(){return Ct},this.setClearAlpha=function(e){Ct=e,rn(_t.r,_t.g,_t.b,Ct)},this.clear=function(e,t,n){var r=0;(void 0===e||e)&&(r|=Rt.COLOR_BUFFER_BIT),(void 0===t||t)&&(r|=Rt.DEPTH_BUFFER_BIT),(void 0===n||n)&&(r|=Rt.STENCIL_BUFFER_BIT),Rt.clear(r)},this.clearColor=function(){Rt.clear(Rt.COLOR_BUFFER_BIT)},this.clearDepth=function(){Rt.clear(Rt.DEPTH_BUFFER_BIT)},this.clearStencil=function(){Rt.clear(Rt.STENCIL_BUFFER_BIT)},this.clearTarget=function(e,t,n,r){this.setRenderTarget(e),this.clear(t,n,r)},this.resetGLState=an;var Cn=function(e){var t=e.target;t.traverse(function(e){e.removeEventListener("remove",Cn),I(e)})},En=function(e){var t=e.target;t.removeEventListener("dispose",En),Pn(t)},Sn=function(e){var t=e.target;t.removeEventListener("dispose",Sn),kn(t),It.info.memory.textures--},Mn=function(e){var t=e.target;t.removeEventListener("dispose",Mn),Rn(t),It.info.memory.textures--},Tn=function(e){var t=e.target;t.removeEventListener("dispose",Tn),In(t)},An=function(e){for(var t=["__webglVertexBuffer","__webglNormalBuffer","__webglTangentBuffer","__webglColorBuffer","__webglUVBuffer","__webglUV2Buffer","__webglSkinIndicesBuffer","__webglSkinWeightsBuffer","__webglFaceBuffer","__webglLineBuffer","__webglLineDistanceBuffer"],n=0,r=t.length;r>n;n++){var i=t[n];void 0!==e[i]&&(Rt.deleteBuffer(e[i]),delete e[i])}if(void 0!==e.__webglCustomAttributesList){for(var i in e.__webglCustomAttributesList)Rt.deleteBuffer(e.__webglCustomAttributesList[i].buffer);delete e.__webglCustomAttributesList}It.info.memory.geometries--},Pn=function(t){if(delete t.__webglInit,t instanceof e.BufferGeometry){for(var n in t.attributes){var r=t.attributes[n];void 0!==r.buffer&&(Rt.deleteBuffer(r.buffer),delete r.buffer)}It.info.memory.geometries--}else{var i=Dn[t.id];if(void 0!==i){for(var o=0,a=i.length;a>o;o++){var s=i[o];if(void 0!==s.numMorphTargets){for(var u=0,c=s.numMorphTargets;c>u;u++)Rt.deleteBuffer(s.__webglMorphTargetsBuffers[u]);delete s.__webglMorphTargetsBuffers}if(void 0!==s.numMorphNormals){for(var u=0,c=s.numMorphNormals;c>u;u++)Rt.deleteBuffer(s.__webglMorphNormalsBuffers[u]);delete s.__webglMorphNormalsBuffers}An(s)}delete Dn[t.id]}else An(t)}Nt=""},kn=function(e){if(e.image&&e.image.__webglTextureCube)Rt.deleteTexture(e.image.__webglTextureCube),delete e.image.__webglTextureCube;else{if(void 0===e.__webglInit)return;Rt.deleteTexture(e.__webglTexture),delete e.__webglTexture,delete e.__webglInit}},Rn=function(t){if(t&&void 0!==t.__webglTexture){if(Rt.deleteTexture(t.__webglTexture),delete t.__webglTexture,t instanceof e.WebGLRenderTargetCube)for(var n=0;6>n;n++)Rt.deleteFramebuffer(t.__webglFramebuffer[n]),Rt.deleteRenderbuffer(t.__webglRenderbuffer[n]);else Rt.deleteFramebuffer(t.__webglFramebuffer),Rt.deleteRenderbuffer(t.__webglRenderbuffer);delete t.__webglFramebuffer,delete t.__webglRenderbuffer}},In=function(e){var t=e.program.program;if(void 0!==t){e.program=void 0;var n,r,i,o=!1;for(n=0,r=Dt.length;r>n;n++)if(i=Dt[n],i.program===t){i.usedTimes--,0===i.usedTimes&&(o=!0);break}if(o===!0){var a=[];for(n=0,r=Dt.length;r>n;n++)i=Dt[n],i.program!==t&&a.push(i);Dt=a,Rt.deleteProgram(t),It.info.memory.programs--}}};this.renderBufferImmediate=function(t,n,r){if(tn.initAttributes(),t.hasPositions&&!t.__webglVertexBuffer&&(t.__webglVertexBuffer=Rt.createBuffer()),t.hasNormals&&!t.__webglNormalBuffer&&(t.__webglNormalBuffer=Rt.createBuffer()),t.hasUvs&&!t.__webglUvBuffer&&(t.__webglUvBuffer=Rt.createBuffer()),t.hasColors&&!t.__webglColorBuffer&&(t.__webglColorBuffer=Rt.createBuffer()),t.hasPositions&&(Rt.bindBuffer(Rt.ARRAY_BUFFER,t.__webglVertexBuffer),Rt.bufferData(Rt.ARRAY_BUFFER,t.positionArray,Rt.DYNAMIC_DRAW),tn.enableAttribute(n.attributes.position),Rt.vertexAttribPointer(n.attributes.position,3,Rt.FLOAT,!1,0,0)),t.hasNormals){if(Rt.bindBuffer(Rt.ARRAY_BUFFER,t.__webglNormalBuffer),r instanceof e.MeshPhongMaterial==!1&&r.shading===e.FlatShading){var i,o,a,s,u,c,l,h,f,p,d,m,v,g,y=3*t.count;for(g=0;y>g;g+=9)v=t.normalArray,s=v[g],l=v[g+1],p=v[g+2],u=v[g+3],h=v[g+4],d=v[g+5],c=v[g+6],f=v[g+7],m=v[g+8],i=(s+u+c)/3,o=(l+h+f)/3,a=(p+d+m)/3,v[g]=i,v[g+1]=o,v[g+2]=a,v[g+3]=i,v[g+4]=o,v[g+5]=a,v[g+6]=i,v[g+7]=o,v[g+8]=a}Rt.bufferData(Rt.ARRAY_BUFFER,t.normalArray,Rt.DYNAMIC_DRAW),tn.enableAttribute(n.attributes.normal),Rt.vertexAttribPointer(n.attributes.normal,3,Rt.FLOAT,!1,0,0)}t.hasUvs&&r.map&&(Rt.bindBuffer(Rt.ARRAY_BUFFER,t.__webglUvBuffer),Rt.bufferData(Rt.ARRAY_BUFFER,t.uvArray,Rt.DYNAMIC_DRAW),tn.enableAttribute(n.attributes.uv),Rt.vertexAttribPointer(n.attributes.uv,2,Rt.FLOAT,!1,0,0)),t.hasColors&&r.vertexColors!==e.NoColors&&(Rt.bindBuffer(Rt.ARRAY_BUFFER,t.__webglColorBuffer),Rt.bufferData(Rt.ARRAY_BUFFER,t.colorArray,Rt.DYNAMIC_DRAW),tn.enableAttribute(n.attributes.color),Rt.vertexAttribPointer(n.attributes.color,3,Rt.FLOAT,!1,0,0)),tn.disableUnusedAttributes(),Rt.drawArrays(Rt.TRIANGLES,0,t.count),t.count=0},this.renderBufferDirect=function(t,n,r,i,o,a){if(i.visible!==!1){P(a);var s=L(t,n,r,i,a),u=!1,c=i.wireframe?1:0,l="direct_"+o.id+"_"+s.id+"_"+c;if(l!==Nt&&(Nt=l,u=!0),u&&tn.initAttributes(),a instanceof e.Mesh){var h=i.wireframe===!0?Rt.LINES:Rt.TRIANGLES,f=o.attributes.index;if(f){var p,m;f.array instanceof Uint32Array&&nn.get("OES_element_index_uint")?(p=Rt.UNSIGNED_INT,m=4):(p=Rt.UNSIGNED_SHORT,m=2);var v=o.offsets;if(0===v.length)u&&(d(i,s,o,0),Rt.bindBuffer(Rt.ELEMENT_ARRAY_BUFFER,f.buffer)),Rt.drawElements(h,f.array.length,p,0),It.info.render.calls++,It.info.render.vertices+=f.array.length,It.info.render.faces+=f.array.length/3;else{u=!0;for(var g=0,y=v.length;y>g;g++){var b=v[g].index;u&&(d(i,s,o,b),Rt.bindBuffer(Rt.ELEMENT_ARRAY_BUFFER,f.buffer)),Rt.drawElements(h,v[g].count,p,v[g].start*m),It.info.render.calls++,It.info.render.vertices+=v[g].count,It.info.render.faces+=v[g].count/3}}}else{u&&d(i,s,o,0);var x=o.attributes.position;Rt.drawArrays(h,0,x.array.length/x.itemSize),It.info.render.calls++,It.info.render.vertices+=x.array.length/x.itemSize,It.info.render.faces+=x.array.length/(3*x.itemSize)}}else if(a instanceof e.PointCloud){var h=Rt.POINTS,f=o.attributes.index;if(f){var p,m;f.array instanceof Uint32Array&&nn.get("OES_element_index_uint")?(p=Rt.UNSIGNED_INT,m=4):(p=Rt.UNSIGNED_SHORT,m=2);var v=o.offsets;if(0===v.length)u&&(d(i,s,o,0),Rt.bindBuffer(Rt.ELEMENT_ARRAY_BUFFER,f.buffer)),Rt.drawElements(h,f.array.length,p,0),It.info.render.calls++,It.info.render.points+=f.array.length;else{v.length>1&&(u=!0);for(var g=0,y=v.length;y>g;g++){var b=v[g].index;u&&(d(i,s,o,b),Rt.bindBuffer(Rt.ELEMENT_ARRAY_BUFFER,f.buffer)),Rt.drawElements(h,v[g].count,p,v[g].start*m),It.info.render.calls++,It.info.render.points+=v[g].count}}}else{u&&d(i,s,o,0);var x=o.attributes.position,v=o.offsets;if(0===v.length)Rt.drawArrays(h,0,x.array.length/3),It.info.render.calls++,It.info.render.points+=x.array.length/3;else for(var g=0,y=v.length;y>g;g++)Rt.drawArrays(h,v[g].index,v[g].count),It.info.render.calls++,It.info.render.points+=v[g].count}}else if(a instanceof e.Line){var h=a.mode===e.LineStrip?Rt.LINE_STRIP:Rt.LINES;tn.setLineWidth(i.linewidth*pt);var f=o.attributes.index;if(f){var p,m;f.array instanceof Uint32Array?(p=Rt.UNSIGNED_INT,m=4):(p=Rt.UNSIGNED_SHORT,m=2);var v=o.offsets;if(0===v.length)u&&(d(i,s,o,0),Rt.bindBuffer(Rt.ELEMENT_ARRAY_BUFFER,f.buffer)),Rt.drawElements(h,f.array.length,p,0),It.info.render.calls++,It.info.render.vertices+=f.array.length;else{v.length>1&&(u=!0);for(var g=0,y=v.length;y>g;g++){var b=v[g].index;u&&(d(i,s,o,b),Rt.bindBuffer(Rt.ELEMENT_ARRAY_BUFFER,f.buffer)),Rt.drawElements(h,v[g].count,p,v[g].start*m),It.info.render.calls++,It.info.render.vertices+=v[g].count}}}else{u&&d(i,s,o,0);var x=o.attributes.position,v=o.offsets;if(0===v.length)Rt.drawArrays(h,0,x.array.length/3),It.info.render.calls++,It.info.render.vertices+=x.array.length/3;else for(var g=0,y=v.length;y>g;g++)Rt.drawArrays(h,v[g].index,v[g].count),It.info.render.calls++,It.info.render.vertices+=v[g].count}}}},this.renderBuffer=function(t,n,r,i,o,a){if(i.visible!==!1){P(a);var s=L(t,n,r,i,a),u=s.attributes,c=!1,l=i.wireframe?1:0,h=o.id+"_"+s.id+"_"+l;if(h!==Nt&&(Nt=h,c=!0),c&&tn.initAttributes(),!i.morphTargets&&u.position>=0?c&&(Rt.bindBuffer(Rt.ARRAY_BUFFER,o.__webglVertexBuffer),tn.enableAttribute(u.position),Rt.vertexAttribPointer(u.position,3,Rt.FLOAT,!1,0,0)):a.morphTargetBase&&m(i,o,a),c){if(o.__webglCustomAttributesList)for(var f=0,p=o.__webglCustomAttributesList.length;p>f;f++){var d=o.__webglCustomAttributesList[f];u[d.buffer.belongsToAttribute]>=0&&(Rt.bindBuffer(Rt.ARRAY_BUFFER,d.buffer),tn.enableAttribute(u[d.buffer.belongsToAttribute]),Rt.vertexAttribPointer(u[d.buffer.belongsToAttribute],d.size,Rt.FLOAT,!1,0,0))}u.color>=0&&(a.geometry.colors.length>0||a.geometry.faces.length>0?(Rt.bindBuffer(Rt.ARRAY_BUFFER,o.__webglColorBuffer),tn.enableAttribute(u.color),Rt.vertexAttribPointer(u.color,3,Rt.FLOAT,!1,0,0)):void 0!==i.defaultAttributeValues&&Rt.vertexAttrib3fv(u.color,i.defaultAttributeValues.color)),u.normal>=0&&(Rt.bindBuffer(Rt.ARRAY_BUFFER,o.__webglNormalBuffer),tn.enableAttribute(u.normal),Rt.vertexAttribPointer(u.normal,3,Rt.FLOAT,!1,0,0)),u.tangent>=0&&(Rt.bindBuffer(Rt.ARRAY_BUFFER,o.__webglTangentBuffer),tn.enableAttribute(u.tangent),Rt.vertexAttribPointer(u.tangent,4,Rt.FLOAT,!1,0,0)),u.uv>=0&&(a.geometry.faceVertexUvs[0]?(Rt.bindBuffer(Rt.ARRAY_BUFFER,o.__webglUVBuffer),tn.enableAttribute(u.uv),Rt.vertexAttribPointer(u.uv,2,Rt.FLOAT,!1,0,0)):void 0!==i.defaultAttributeValues&&Rt.vertexAttrib2fv(u.uv,i.defaultAttributeValues.uv)),u.uv2>=0&&(a.geometry.faceVertexUvs[1]?(Rt.bindBuffer(Rt.ARRAY_BUFFER,o.__webglUV2Buffer),tn.enableAttribute(u.uv2),Rt.vertexAttribPointer(u.uv2,2,Rt.FLOAT,!1,0,0)):void 0!==i.defaultAttributeValues&&Rt.vertexAttrib2fv(u.uv2,i.defaultAttributeValues.uv2)),i.skinning&&u.skinIndex>=0&&u.skinWeight>=0&&(Rt.bindBuffer(Rt.ARRAY_BUFFER,o.__webglSkinIndicesBuffer),tn.enableAttribute(u.skinIndex),Rt.vertexAttribPointer(u.skinIndex,4,Rt.FLOAT,!1,0,0),Rt.bindBuffer(Rt.ARRAY_BUFFER,o.__webglSkinWeightsBuffer),tn.enableAttribute(u.skinWeight),Rt.vertexAttribPointer(u.skinWeight,4,Rt.FLOAT,!1,0,0)),u.lineDistance>=0&&(Rt.bindBuffer(Rt.ARRAY_BUFFER,o.__webglLineDistanceBuffer),tn.enableAttribute(u.lineDistance),Rt.vertexAttribPointer(u.lineDistance,1,Rt.FLOAT,!1,0,0))}if(tn.disableUnusedAttributes(),a instanceof e.Mesh){var v=o.__typeArray===Uint32Array?Rt.UNSIGNED_INT:Rt.UNSIGNED_SHORT;i.wireframe?(tn.setLineWidth(i.wireframeLinewidth*pt),c&&Rt.bindBuffer(Rt.ELEMENT_ARRAY_BUFFER,o.__webglLineBuffer),Rt.drawElements(Rt.LINES,o.__webglLineCount,v,0)):(c&&Rt.bindBuffer(Rt.ELEMENT_ARRAY_BUFFER,o.__webglFaceBuffer),Rt.drawElements(Rt.TRIANGLES,o.__webglFaceCount,v,0)),It.info.render.calls++,It.info.render.vertices+=o.__webglFaceCount,It.info.render.faces+=o.__webglFaceCount/3}else if(a instanceof e.Line){var g=a.mode===e.LineStrip?Rt.LINE_STRIP:Rt.LINES;tn.setLineWidth(i.linewidth*pt),Rt.drawArrays(g,0,o.__webglLineCount),It.info.render.calls++}else a instanceof e.PointCloud&&(Rt.drawArrays(Rt.POINTS,0,o.__webglParticleCount),It.info.render.calls++,It.info.render.points+=o.__webglParticleCount)}},this.render=function(t,n,r,i){if(n instanceof e.Camera==!1)return e.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera."),void 0;var o=t.fog;Nt="",Lt=-1,Ot=null,Kt=!0,t.autoUpdate===!0&&t.updateMatrixWorld(),void 0===n.parent&&n.updateMatrixWorld(),t.traverse(function(t){t instanceof e.SkinnedMesh&&t.skeleton.update()}),n.matrixWorldInverse.getInverse(n.matrixWorld),qt.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse),Wt.setFromMatrix(qt),Et.length=0,Tt.length=0,At.length=0,Pt.length=0,kt.length=0,b(t),It.sortObjects===!0&&(Tt.sort(v),At.sort(g)),xn.render(t,n),It.info.render.calls=0,It.info.render.vertices=0,It.info.render.faces=0,It.info.render.points=0,this.setRenderTarget(r),(this.autoClear||i)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);for(var a=0,s=Mt.length;s>a;a++){var u=Mt[a],c=u.object;c.visible&&(K(c,n),_(u))}if(t.overrideMaterial){var l=t.overrideMaterial;V(l),x(Tt,n,Et,o,l),x(At,n,Et,o,l),w(Mt,"",n,Et,o,l)}else tn.setBlending(e.NoBlending),x(Tt,n,Et,o,null),w(Mt,"opaque",n,Et,o,null),x(At,n,Et,o,null),w(Mt,"transparent",n,Et,o,null);wn.render(t,n),_n.render(t,n,jt,Gt),r&&r.generateMipmaps&&r.minFilter!==e.NearestFilter&&r.minFilter!==e.LinearFilter&&ot(r),tn.setDepthTest(!0),tn.setDepthWrite(!0),tn.setColorWrite(!0)},this.renderImmediateObject=function(e,t,n,r,i){var o=L(e,t,n,r,i);Nt="",It.setMaterialFaces(r),i.immediateRenderCallback?i.immediateRenderCallback(o,Rt,Wt):i.render(function(e){It.renderBufferImmediate(e,o,r)})};var Dn={},Bn=0,Vn={MeshDepthMaterial:"depth",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointCloudMaterial:"particle_basic"};this.setFaceCulling=function(t,n){t===e.CullFaceNone?Rt.disable(Rt.CULL_FACE):(n===e.FrontFaceDirectionCW?Rt.frontFace(Rt.CW):Rt.frontFace(Rt.CCW),t===e.CullFaceBack?Rt.cullFace(Rt.BACK):t===e.CullFaceFront?Rt.cullFace(Rt.FRONT):Rt.cullFace(Rt.FRONT_AND_BACK),Rt.enable(Rt.CULL_FACE))},this.setMaterialFaces=function(t){tn.setDoubleSided(t.side===e.DoubleSide),tn.setFlipSided(t.side===e.BackSide)},this.uploadTexture=function(t){void 0===t.__webglInit&&(t.__webglInit=!0,t.addEventListener("dispose",Sn),t.__webglTexture=Rt.createTexture(),It.info.memory.textures++),Rt.bindTexture(Rt.TEXTURE_2D,t.__webglTexture),Rt.pixelStorei(Rt.UNPACK_FLIP_Y_WEBGL,t.flipY),Rt.pixelStorei(Rt.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t.premultiplyAlpha),Rt.pixelStorei(Rt.UNPACK_ALIGNMENT,t.unpackAlignment),t.image=et(t.image,cn);var n=t.image,r=e.Math.isPowerOfTwo(n.width)&&e.Math.isPowerOfTwo(n.height),i=st(t.format),o=st(t.type);J(Rt.TEXTURE_2D,t,r);var a,s=t.mipmaps;if(t instanceof e.DataTexture)if(s.length>0&&r){for(var u=0,c=s.length;c>u;u++)a=s[u],Rt.texImage2D(Rt.TEXTURE_2D,u,i,a.width,a.height,0,i,o,a.data);t.generateMipmaps=!1}else Rt.texImage2D(Rt.TEXTURE_2D,0,i,n.width,n.height,0,i,o,n.data);else if(t instanceof e.CompressedTexture)for(var u=0,c=s.length;c>u;u++)a=s[u],t.format!==e.RGBAFormat&&t.format!==e.RGBFormat?gn().indexOf(i)>-1?Rt.compressedTexImage2D(Rt.TEXTURE_2D,u,i,a.width,a.height,0,a.data):e.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):Rt.texImage2D(Rt.TEXTURE_2D,u,i,a.width,a.height,0,i,o,a.data);else if(s.length>0&&r){for(var u=0,c=s.length;c>u;u++)a=s[u],Rt.texImage2D(Rt.TEXTURE_2D,u,i,i,o,a);t.generateMipmaps=!1}else Rt.texImage2D(Rt.TEXTURE_2D,0,i,i,o,t.image);t.generateMipmaps&&r&&Rt.generateMipmap(Rt.TEXTURE_2D),t.needsUpdate=!1,t.onUpdate&&t.onUpdate()},this.setTexture=function(e,t){Rt.activeTexture(Rt.TEXTURE0+t),e.needsUpdate?It.uploadTexture(e):Rt.bindTexture(Rt.TEXTURE_2D,e.__webglTexture)},this.setRenderTarget=function(t){var n=t instanceof e.WebGLRenderTargetCube;if(t&&void 0===t.__webglFramebuffer){void 0===t.depthBuffer&&(t.depthBuffer=!0),void 0===t.stencilBuffer&&(t.stencilBuffer=!0),t.addEventListener("dispose",Mn),t.__webglTexture=Rt.createTexture(),It.info.memory.textures++;var r=e.Math.isPowerOfTwo(t.width)&&e.Math.isPowerOfTwo(t.height),i=st(t.format),o=st(t.type);if(n){t.__webglFramebuffer=[],t.__webglRenderbuffer=[],Rt.bindTexture(Rt.TEXTURE_CUBE_MAP,t.__webglTexture),J(Rt.TEXTURE_CUBE_MAP,t,r);for(var a=0;6>a;a++)t.__webglFramebuffer[a]=Rt.createFramebuffer(),t.__webglRenderbuffer[a]=Rt.createRenderbuffer(),Rt.texImage2D(Rt.TEXTURE_CUBE_MAP_POSITIVE_X+a,0,i,t.width,t.height,0,i,o,null),rt(t.__webglFramebuffer[a],t,Rt.TEXTURE_CUBE_MAP_POSITIVE_X+a),it(t.__webglRenderbuffer[a],t);r&&Rt.generateMipmap(Rt.TEXTURE_CUBE_MAP)}else t.__webglFramebuffer=Rt.createFramebuffer(),t.__webglRenderbuffer=t.shareDepthFrom?t.shareDepthFrom.__webglRenderbuffer:Rt.createRenderbuffer(),Rt.bindTexture(Rt.TEXTURE_2D,t.__webglTexture),J(Rt.TEXTURE_2D,t,r),Rt.texImage2D(Rt.TEXTURE_2D,0,i,t.width,t.height,0,i,o,null),rt(t.__webglFramebuffer,t,Rt.TEXTURE_2D),t.shareDepthFrom?t.depthBuffer&&!t.stencilBuffer?Rt.framebufferRenderbuffer(Rt.FRAMEBUFFER,Rt.DEPTH_ATTACHMENT,Rt.RENDERBUFFER,t.__webglRenderbuffer):t.depthBuffer&&t.stencilBuffer&&Rt.framebufferRenderbuffer(Rt.FRAMEBUFFER,Rt.DEPTH_STENCIL_ATTACHMENT,Rt.RENDERBUFFER,t.__webglRenderbuffer):it(t.__webglRenderbuffer,t),r&&Rt.generateMipmap(Rt.TEXTURE_2D);n?Rt.bindTexture(Rt.TEXTURE_CUBE_MAP,null):Rt.bindTexture(Rt.TEXTURE_2D,null),Rt.bindRenderbuffer(Rt.RENDERBUFFER,null),Rt.bindFramebuffer(Rt.FRAMEBUFFER,null)}var s,u,c,l,h;t?(s=n?t.__webglFramebuffer[t.activeCubeFace]:t.__webglFramebuffer,u=t.width,c=t.height,l=0,h=0):(s=null,u=$t,c=Ht,l=Ut,h=zt),s!==Vt&&(Rt.bindFramebuffer(Rt.FRAMEBUFFER,s),Rt.viewport(l,h,u,c),Vt=s),jt=u,Gt=c},this.readRenderTargetPixels=function(t,n,r,i,o,a){if(!(t instanceof e.WebGLRenderTarget))return console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget."),void 0;if(t.__webglFramebuffer){if(t.format!==e.RGBAFormat)return console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA format. readPixels can read only RGBA format."),void 0;var s=!1;t.__webglFramebuffer!==Vt&&(Rt.bindFramebuffer(Rt.FRAMEBUFFER,t.__webglFramebuffer),s=!0),Rt.checkFramebufferStatus(Rt.FRAMEBUFFER)===Rt.FRAMEBUFFER_COMPLETE?Rt.readPixels(n,r,i,o,Rt.RGBA,Rt.UNSIGNED_BYTE,a):console.error("THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete."),s&&Rt.bindFramebuffer(Rt.FRAMEBUFFER,Vt)}},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,n,r){this.width=t,this.height=n,r=r||{},this.wrapS=void 0!==r.wrapS?r.wrapS:e.ClampToEdgeWrapping,this.wrapT=void 0!==r.wrapT?r.wrapT:e.ClampToEdgeWrapping,this.magFilter=void 0!==r.magFilter?r.magFilter:e.LinearFilter,this.minFilter=void 0!==r.minFilter?r.minFilter:e.LinearMipMapLinearFilter,this.anisotropy=void 0!==r.anisotropy?r.anisotropy:1,this.offset=new e.Vector2(0,0),this.repeat=new e.Vector2(1,1),this.format=void 0!==r.format?r.format:e.RGBAFormat,this.type=void 0!==r.type?r.type:e.UnsignedByteType,this.depthBuffer=void 0!==r.depthBuffer?r.depthBuffer:!0,this.stencilBuffer=void 0!==r.stencilBuffer?r.stencilBuffer:!0,this.generateMipmaps=!0,this.shareDepthFrom=void 0!==r.shareDepthFrom?r.shareDepthFrom:null},e.WebGLRenderTarget.prototype={constructor:e.WebGLRenderTarget,setSize:function(e,t){(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);return 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,t.type=this.type,t.depthBuffer=this.depthBuffer,t.stencilBuffer=this.stencilBuffer,t.generateMipmaps=this.generateMipmaps,t.shareDepthFrom=this.shareDepthFrom,t},dispose:function(){this.dispatchEvent({type:"dispose"})}},e.EventDispatcher.prototype.apply(e.WebGLRenderTarget.prototype),e.WebGLRenderTargetCube=function(t,n,r){e.WebGLRenderTarget.call(this,t,n,r),this.activeCubeFace=0},e.WebGLRenderTargetCube.prototype=Object.create(e.WebGLRenderTarget.prototype),e.WebGLRenderTargetCube.prototype.constructor=e.WebGLRenderTargetCube,e.WebGLExtensions=function(t){var n={};this.get=function(r){if(void 0!==n[r])return n[r];var i;switch(r){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(r)}return null===i&&e.warn("THREE.WebGLRenderer: "+r+" extension not supported."),n[r]=i,i}},e.WebGLProgram=function(){var t=0,n=function(e){var t,n,r=[];for(var i in e)t=e[i],t!==!1&&(n="#define "+i+" "+t,r.push(n));return r.join("\n")},r=function(e,t,n){for(var r={},i=0,o=n.length;o>i;i++){var a=n[i];r[a]=e.getUniformLocation(t,a)}return r},i=function(e,t,n){for(var r={},i=0,o=n.length;o>i;i++){var a=n[i];r[a]=e.getAttribLocation(t,a)}return r};return function(o,a,s,u){var c=o,l=c.context,h=s.defines,f=s.__webglShader.uniforms,p=s.attributes,d=s.__webglShader.vertexShader,m=s.__webglShader.fragmentShader,v=s.index0AttributeName;void 0===v&&u.morphTargets===!0&&(v="position");var g="SHADOWMAP_TYPE_BASIC";u.shadowMapType===e.PCFShadowMap?g="SHADOWMAP_TYPE_PCF":u.shadowMapType===e.PCFSoftShadowMap&&(g="SHADOWMAP_TYPE_PCF_SOFT");var y="ENVMAP_TYPE_CUBE",b="ENVMAP_MODE_REFLECTION",x="ENVMAP_BLENDING_MULTIPLY";if(u.envMap){switch(s.envMap.mapping){case e.CubeReflectionMapping:case e.CubeRefractionMapping:y="ENVMAP_TYPE_CUBE";break;case e.EquirectangularReflectionMapping:case e.EquirectangularRefractionMapping:y="ENVMAP_TYPE_EQUIREC";break;case e.SphericalReflectionMapping:y="ENVMAP_TYPE_SPHERE"}switch(s.envMap.mapping){case e.CubeRefractionMapping:case e.EquirectangularRefractionMapping:b="ENVMAP_MODE_REFRACTION"}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"}}var w,_,C=o.gammaFactor>0?o.gammaFactor:1,E=n(h),S=l.createProgram();s instanceof e.RawShaderMaterial?(w="",_=""):(w=["precision "+u.precision+" float;","precision "+u.precision+" int;",E,u.supportsVertexTextures?"#define VERTEX_TEXTURES":"",c.gammaInput?"#define GAMMA_INPUT":"",c.gammaOutput?"#define GAMMA_OUTPUT":"","#define GAMMA_FACTOR "+C,"#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.normalMap?"#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 "+g:"",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"," attribute vec3 color;","#endif","#ifdef USE_MORPHTARGETS"," attribute vec3 morphTarget0;"," attribute vec3 morphTarget1;"," attribute vec3 morphTarget2;"," attribute vec3 morphTarget3;"," #ifdef USE_MORPHNORMALS"," attribute vec3 morphNormal0;"," attribute vec3 morphNormal1;"," attribute vec3 morphNormal2;"," attribute vec3 morphNormal3;"," #else"," attribute vec3 morphTarget4;"," attribute vec3 morphTarget5;"," attribute vec3 morphTarget6;"," attribute vec3 morphTarget7;"," #endif","#endif","#ifdef USE_SKINNING"," attribute vec4 skinIndex;"," attribute vec4 skinWeight;","#endif",""].join("\n"),_=["precision "+u.precision+" float;","precision "+u.precision+" int;",u.bumpMap||u.normalMap||u.flatShading?"#extension GL_OES_standard_derivatives : enable":"",E,"#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:"",c.gammaInput?"#define GAMMA_INPUT":"",c.gammaOutput?"#define GAMMA_OUTPUT":"","#define GAMMA_FACTOR "+C,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 "+y:"",u.envMap?"#define "+b:"",u.envMap?"#define "+x:"",u.lightMap?"#define USE_LIGHTMAP":"",u.bumpMap?"#define USE_BUMPMAP":"",u.normalMap?"#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 "+g:"",u.shadowMapDebug?"#define SHADOWMAP_DEBUG":"",u.shadowMapCascade?"#define SHADOWMAP_CASCADE":"",u.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;",""].join("\n"));var M=new e.WebGLShader(l,l.VERTEX_SHADER,w+d),T=new e.WebGLShader(l,l.FRAGMENT_SHADER,_+m);l.attachShader(S,M),l.attachShader(S,T),void 0!==v&&l.bindAttribLocation(S,0,v),l.linkProgram(S);var A=l.getProgramInfoLog(S);l.getProgramParameter(S,l.LINK_STATUS)===!1&&e.error("THREE.WebGLProgram: shader error: "+l.getError(),"gl.VALIDATE_STATUS",l.getProgramParameter(S,l.VALIDATE_STATUS),"gl.getPRogramInfoLog",A),l.deleteShader(M),l.deleteShader(T);var P=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","modelMatrix","cameraPosition","morphTargetInfluences","bindMatrix","bindMatrixInverse"];u.useVertexTexture?(P.push("boneTexture"),P.push("boneTextureWidth"),P.push("boneTextureHeight")):P.push("boneGlobalMatrices"),u.logarithmicDepthBuffer&&P.push("logDepthBufFC");for(var k in f)P.push(k);this.uniforms=r(l,S,P),P=["position","normal","uv","uv2","tangent","color","skinIndex","skinWeight","lineDistance"];for(var R=0;R<u.maxMorphTargets;R++)P.push("morphTarget"+R);for(var R=0;R<u.maxMorphNormals;R++)P.push("morphNormal"+R);for(var I in p)P.push(I);return this.attributes=i(l,S,P),this.attributesKeys=Object.keys(this.attributes),this.id=t++,this.code=a,this.usedTimes=1,this.program=S,this.vertexShader=M,this.fragmentShader=T,this}}(),e.WebGLShader=function(){return function(t,n,r){var i=t.createShader(n);return t.shaderSource(i,r),t.compileShader(i),t.getShaderParameter(i,t.COMPILE_STATUS)===!1&&e.error("THREE.WebGLShader: Shader couldn't compile."),i}}(),e.WebGLState=function(t,n){var r=new Uint8Array(16),i=new Uint8Array(16),o=null,a=null,s=null,u=null,c=null,l=null,h=null,f=null,p=null,d=null,m=null,v=null,g=null,y=null,b=null,x=null;this.initAttributes=function(){for(var e=0,t=r.length;t>e;e++)r[e]=0},this.enableAttribute=function(e){r[e]=1,0===i[e]&&(t.enableVertexAttribArray(e),i[e]=1)},this.disableUnusedAttributes=function(){for(var e=0,n=i.length;n>e;e++)i[e]!==r[e]&&(t.disableVertexAttribArray(e),i[e]=0)},this.setBlending=function(r,i,f,p,d,m,v){r!==o&&(r===e.NoBlending?t.disable(t.BLEND):r===e.AdditiveBlending?(t.enable(t.BLEND),t.blendEquation(t.FUNC_ADD),t.blendFunc(t.SRC_ALPHA,t.ONE)):r===e.SubtractiveBlending?(t.enable(t.BLEND),t.blendEquation(t.FUNC_ADD),t.blendFunc(t.ZERO,t.ONE_MINUS_SRC_COLOR)):r===e.MultiplyBlending?(t.enable(t.BLEND),t.blendEquation(t.FUNC_ADD),t.blendFunc(t.ZERO,t.SRC_COLOR)):r===e.CustomBlending?t.enable(t.BLEND):(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)),o=r),r===e.CustomBlending?(d=d||i,m=m||f,v=v||p,(i!==a||d!==c)&&(t.blendEquationSeparate(n(i),n(d)),a=i,c=d),(f!==s||p!==u||m!==l||v!==h)&&(t.blendFuncSeparate(n(f),n(p),n(m),n(v)),s=f,u=p,l=m,h=v)):(a=null,s=null,u=null,c=null,l=null,h=null)},this.setDepthTest=function(e){f!==e&&(e?t.enable(t.DEPTH_TEST):t.disable(t.DEPTH_TEST),f=e)},this.setDepthWrite=function(e){p!==e&&(t.depthMask(e),p=e)},this.setColorWrite=function(e){d!==e&&(t.colorMask(e,e,e,e),d=e)},this.setDoubleSided=function(e){m!==e&&(e?t.disable(t.CULL_FACE):t.enable(t.CULL_FACE),m=e)},this.setFlipSided=function(e){v!==e&&(e?t.frontFace(t.CW):t.frontFace(t.CCW),v=e)},this.setLineWidth=function(e){e!==g&&(t.lineWidth(e),g=e)},this.setPolygonOffset=function(e,n,r){y!==e&&(e?t.enable(t.POLYGON_OFFSET_FILL):t.disable(t.POLYGON_OFFSET_FILL),y=e),!e||b===n&&x===r||(t.polygonOffset(n,r),b=n,x=r)},this.reset=function(){for(var e=0;e<i.length;e++)i[e]=0;o=null,f=null,p=null,d=null,m=null,v=null}},e.LensFlarePlugin=function(t,n){function r(e){var n=f.createProgram(),r=f.createShader(f.FRAGMENT_SHADER),i=f.createShader(f.VERTEX_SHADER),o="precision "+t.getPrecision()+" float;\n";return f.shaderSource(r,o+e.fragmentShader),f.shaderSource(i,o+e.vertexShader),f.compileShader(r),f.compileShader(i),f.attachShader(n,r),f.attachShader(n,i),f.linkProgram(n),n}var i,o,a,s,u,c,l,h,f=t.context,p=function(){var e=new Float32Array([-1,-1,0,0,1,-1,1,0,1,1,1,1,-1,1,0,1]),t=new Uint16Array([0,1,2,0,2,3]);i=f.createBuffer(),o=f.createBuffer(),f.bindBuffer(f.ARRAY_BUFFER,i),f.bufferData(f.ARRAY_BUFFER,e,f.STATIC_DRAW),f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,o),f.bufferData(f.ELEMENT_ARRAY_BUFFER,t,f.STATIC_DRAW),l=f.createTexture(),h=f.createTexture(),f.bindTexture(f.TEXTURE_2D,l),f.texImage2D(f.TEXTURE_2D,0,f.RGB,16,16,0,f.RGB,f.UNSIGNED_BYTE,null),f.texParameteri(f.TEXTURE_2D,f.TEXTURE_WRAP_S,f.CLAMP_TO_EDGE),f.texParameteri(f.TEXTURE_2D,f.TEXTURE_WRAP_T,f.CLAMP_TO_EDGE),f.texParameteri(f.TEXTURE_2D,f.TEXTURE_MAG_FILTER,f.NEAREST),f.texParameteri(f.TEXTURE_2D,f.TEXTURE_MIN_FILTER,f.NEAREST),f.bindTexture(f.TEXTURE_2D,h),f.texImage2D(f.TEXTURE_2D,0,f.RGBA,16,16,0,f.RGBA,f.UNSIGNED_BYTE,null),f.texParameteri(f.TEXTURE_2D,f.TEXTURE_WRAP_S,f.CLAMP_TO_EDGE),f.texParameteri(f.TEXTURE_2D,f.TEXTURE_WRAP_T,f.CLAMP_TO_EDGE),f.texParameteri(f.TEXTURE_2D,f.TEXTURE_MAG_FILTER,f.NEAREST),f.texParameteri(f.TEXTURE_2D,f.TEXTURE_MIN_FILTER,f.NEAREST),c=f.getParameter(f.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0;var n;n=c?{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")}:{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")},a=r(n),s={vertex:f.getAttribLocation(a,"position"),uv:f.getAttribLocation(a,"uv")},u={renderType:f.getUniformLocation(a,"renderType"),map:f.getUniformLocation(a,"map"),occlusionMap:f.getUniformLocation(a,"occlusionMap"),opacity:f.getUniformLocation(a,"opacity"),color:f.getUniformLocation(a,"color"),scale:f.getUniformLocation(a,"scale"),rotation:f.getUniformLocation(a,"rotation"),screenPosition:f.getUniformLocation(a,"screenPosition")}
};this.render=function(r,d,m,v){if(0!==n.length){var g=new e.Vector3,y=v/m,b=.5*m,x=.5*v,w=16/v,_=new e.Vector2(w*y,w),C=new e.Vector3(1,1,0),E=new e.Vector2(1,1);void 0===a&&p(),f.useProgram(a),f.enableVertexAttribArray(s.vertex),f.enableVertexAttribArray(s.uv),f.uniform1i(u.occlusionMap,0),f.uniform1i(u.map,1),f.bindBuffer(f.ARRAY_BUFFER,i),f.vertexAttribPointer(s.vertex,2,f.FLOAT,!1,16,0),f.vertexAttribPointer(s.uv,2,f.FLOAT,!1,16,8),f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,o),f.disable(f.CULL_FACE),f.depthMask(!1);for(var S=0,M=n.length;M>S;S++){w=16/v,_.set(w*y,w);var T=n[S];if(g.set(T.matrixWorld.elements[12],T.matrixWorld.elements[13],T.matrixWorld.elements[14]),g.applyMatrix4(d.matrixWorldInverse),g.applyProjection(d.projectionMatrix),C.copy(g),E.x=C.x*b+b,E.y=C.y*x+x,c||E.x>0&&E.x<m&&E.y>0&&E.y<v){f.activeTexture(f.TEXTURE1),f.bindTexture(f.TEXTURE_2D,l),f.copyTexImage2D(f.TEXTURE_2D,0,f.RGB,E.x-8,E.y-8,16,16,0),f.uniform1i(u.renderType,0),f.uniform2f(u.scale,_.x,_.y),f.uniform3f(u.screenPosition,C.x,C.y,C.z),f.disable(f.BLEND),f.enable(f.DEPTH_TEST),f.drawElements(f.TRIANGLES,6,f.UNSIGNED_SHORT,0),f.activeTexture(f.TEXTURE0),f.bindTexture(f.TEXTURE_2D,h),f.copyTexImage2D(f.TEXTURE_2D,0,f.RGBA,E.x-8,E.y-8,16,16,0),f.uniform1i(u.renderType,1),f.disable(f.DEPTH_TEST),f.activeTexture(f.TEXTURE1),f.bindTexture(f.TEXTURE_2D,l),f.drawElements(f.TRIANGLES,6,f.UNSIGNED_SHORT,0),T.positionScreen.copy(C),T.customUpdateCallback?T.customUpdateCallback(T):T.updateLensFlares(),f.uniform1i(u.renderType,2),f.enable(f.BLEND);for(var A=0,P=T.lensFlares.length;P>A;A++){var k=T.lensFlares[A];k.opacity>.001&&k.scale>.001&&(C.x=k.x,C.y=k.y,C.z=k.z,w=k.size*k.scale/v,_.x=w*y,_.y=w,f.uniform3f(u.screenPosition,C.x,C.y,C.z),f.uniform2f(u.scale,_.x,_.y),f.uniform1f(u.rotation,k.rotation),f.uniform1f(u.opacity,k.opacity),f.uniform3f(u.color,k.color.r,k.color.g,k.color.b),t.state.setBlending(k.blending,k.blendEquation,k.blendSrc,k.blendDst),t.setTexture(k.texture,1),f.drawElements(f.TRIANGLES,6,f.UNSIGNED_SHORT,0))}}}f.enable(f.CULL_FACE),f.enable(f.DEPTH_TEST),f.depthMask(!0),t.resetGLState()}}},e.ShadowMapPlugin=function(t,n,r,i){function o(e,t,n){if(t.visible){var i=r[t.id];if(i&&t.castShadow&&(t.frustumCulled===!1||m.intersectsObject(t)===!0))for(var a=0,s=i.length;s>a;a++){var u=i[a];t._modelViewMatrix.multiplyMatrices(n.matrixWorldInverse,t.matrixWorld),x.push(u)}for(var a=0,s=t.children.length;s>a;a++)o(e,t.children[a],n)}}function a(t,n){var r=new e.DirectionalLight;r.isVirtual=!0,r.onlyShadow=!0,r.castShadow=!0,r.shadowCameraNear=t.shadowCameraNear,r.shadowCameraFar=t.shadowCameraFar,r.shadowCameraLeft=t.shadowCameraLeft,r.shadowCameraRight=t.shadowCameraRight,r.shadowCameraBottom=t.shadowCameraBottom,r.shadowCameraTop=t.shadowCameraTop,r.shadowCameraVisible=t.shadowCameraVisible,r.shadowDarkness=t.shadowDarkness,r.shadowBias=t.shadowCascadeBias[n],r.shadowMapWidth=t.shadowCascadeWidth[n],r.shadowMapHeight=t.shadowCascadeHeight[n],r.pointsWorld=[],r.pointsFrustum=[];for(var i=r.pointsWorld,o=r.pointsFrustum,a=0;8>a;a++)i[a]=new e.Vector3,o[a]=new e.Vector3;var s=t.shadowCascadeNearZ[n],u=t.shadowCascadeFarZ[n];return o[0].set(-1,-1,s),o[1].set(1,-1,s),o[2].set(-1,1,s),o[3].set(1,1,s),o[4].set(-1,-1,u),o[5].set(1,-1,u),o[6].set(-1,1,u),o[7].set(1,1,u),r}function s(e,t){var n=e.shadowCascadeArray[t];n.position.copy(e.position),n.target.position.copy(e.target.position),n.lookAt(n.target),n.shadowCameraVisible=e.shadowCameraVisible,n.shadowDarkness=e.shadowDarkness,n.shadowBias=e.shadowCascadeBias[t];var r=e.shadowCascadeNearZ[t],i=e.shadowCascadeFarZ[t],o=n.pointsFrustum;o[0].z=r,o[1].z=r,o[2].z=r,o[3].z=r,o[4].z=i,o[5].z=i,o[6].z=i,o[7].z=i}function u(e,t){var n=t.shadowCamera,r=t.pointsFrustum,i=t.pointsWorld;g.set(1/0,1/0,1/0),y.set(-1/0,-1/0,-1/0);for(var o=0;8>o;o++){var a=i[o];a.copy(r[o]),a.unproject(e),a.applyMatrix4(n.matrixWorldInverse),a.x<g.x&&(g.x=a.x),a.x>y.x&&(y.x=a.x),a.y<g.y&&(g.y=a.y),a.y>y.y&&(y.y=a.y),a.z<g.z&&(g.z=a.z),a.z>y.z&&(y.z=a.z)}n.left=g.x,n.right=y.x,n.top=y.y,n.bottom=g.y,n.updateProjectionMatrix()}function c(t){return t.material instanceof e.MeshFaceMaterial?t.material.materials[0]:t.material}var l,h,f,p,d=t.context,m=new e.Frustum,v=new e.Matrix4,g=new e.Vector3,y=new e.Vector3,b=new e.Vector3,x=[],w=e.ShaderLib.depthRGBA,_=e.UniformsUtils.clone(w.uniforms);l=new e.ShaderMaterial({uniforms:_,vertexShader:w.vertexShader,fragmentShader:w.fragmentShader}),h=new e.ShaderMaterial({uniforms:_,vertexShader:w.vertexShader,fragmentShader:w.fragmentShader,morphTargets:!0}),f=new e.ShaderMaterial({uniforms:_,vertexShader:w.vertexShader,fragmentShader:w.fragmentShader,skinning:!0}),p=new e.ShaderMaterial({uniforms:_,vertexShader:w.vertexShader,fragmentShader:w.fragmentShader,morphTargets:!0,skinning:!0}),l._shadowPass=!0,h._shadowPass=!0,f._shadowPass=!0,p._shadowPass=!0,this.render=function(r,g){if(t.shadowMapEnabled!==!1){var y,w,_,C,E,S,M,T,A,P,k,R,I,D=[],B=0,V=null;for(d.clearColor(1,1,1,1),d.disable(d.BLEND),d.enable(d.CULL_FACE),d.frontFace(d.CCW),t.shadowMapCullFace===e.CullFaceFront?d.cullFace(d.FRONT):d.cullFace(d.BACK),t.state.setDepthTest(!0),y=0,w=n.length;w>y;y++)if(I=n[y],I.castShadow)if(I instanceof e.DirectionalLight&&I.shadowCascade)for(E=0;E<I.shadowCascadeCount;E++){var L;if(I.shadowCascadeArray[E])L=I.shadowCascadeArray[E];else{L=a(I,E),L.originalCamera=g;var N=new e.Gyroscope;N.position.copy(I.shadowCascadeOffset),N.add(L),N.add(L.target),g.add(N),I.shadowCascadeArray[E]=L}s(I,E),D[B]=L,B++}else D[B]=I,B++;for(y=0,w=D.length;w>y;y++){if(I=D[y],!I.shadowMap){var O=e.LinearFilter;t.shadowMapType===e.PCFSoftShadowMap&&(O=e.NearestFilter);var F={minFilter:O,magFilter:O,format:e.RGBAFormat};I.shadowMap=new e.WebGLRenderTarget(I.shadowMapWidth,I.shadowMapHeight,F),I.shadowMapSize=new e.Vector2(I.shadowMapWidth,I.shadowMapHeight),I.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)){e.error("THREE.ShadowMapPlugin: Unsupported light type for shadow",I);continue}I.shadowCamera=new e.OrthographicCamera(I.shadowCameraLeft,I.shadowCameraRight,I.shadowCameraTop,I.shadowCameraBottom,I.shadowCameraNear,I.shadowCameraFar)}r.add(I.shadowCamera),r.autoUpdate===!0&&r.updateMatrixWorld()}I.shadowCameraVisible&&!I.cameraHelper&&(I.cameraHelper=new e.CameraHelper(I.shadowCamera),r.add(I.cameraHelper)),I.isVirtual&&L.originalCamera==g&&u(g,I),S=I.shadowMap,M=I.shadowMatrix,T=I.shadowCamera,T.position.setFromMatrixPosition(I.matrixWorld),b.setFromMatrixPosition(I.target.matrixWorld),T.lookAt(b),T.updateMatrixWorld(),T.matrixWorldInverse.getInverse(T.matrixWorld),I.cameraHelper&&(I.cameraHelper.visible=I.shadowCameraVisible),I.shadowCameraVisible&&I.cameraHelper.update(),M.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),M.multiply(T.projectionMatrix),M.multiply(T.matrixWorldInverse),v.multiplyMatrices(T.projectionMatrix,T.matrixWorldInverse),m.setFromMatrix(v),t.setRenderTarget(S),t.clear(),x.length=0,o(r,r,T);var U,z,$;for(_=0,C=x.length;C>_;_++)k=x[_],R=k.object,A=k.buffer,U=c(R),z=void 0!==R.geometry.morphTargets&&R.geometry.morphTargets.length>0&&U.morphTargets,$=R instanceof e.SkinnedMesh&&U.skinning,P=R.customDepthMaterial?R.customDepthMaterial:$?z?p:f:z?h:l,t.setMaterialFaces(U),A instanceof e.BufferGeometry?t.renderBufferDirect(T,n,V,P,A,R):t.renderBuffer(T,n,V,P,A,R);for(_=0,C=i.length;C>_;_++)k=i[_],R=k.object,R.visible&&R.castShadow&&(R._modelViewMatrix.multiplyMatrices(T.matrixWorldInverse,R.matrixWorld),t.renderImmediateObject(T,n,V,l,R))}var H=t.getClearColor(),j=t.getClearAlpha();d.clearColor(H.r,H.g,H.b,j),d.enable(d.BLEND),t.shadowMapCullFace===e.CullFaceFront&&d.cullFace(d.BACK),t.resetGLState()}}},e.SpritePlugin=function(t,n){function r(){var e=h.createProgram(),n=h.createShader(h.VERTEX_SHADER),r=h.createShader(h.FRAGMENT_SHADER);return h.shaderSource(n,["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")),h.shaderSource(r,["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")),h.compileShader(n),h.compileShader(r),h.attachShader(e,n),h.attachShader(e,r),h.linkProgram(e),e}function i(e,t){return e.z!==t.z?t.z-e.z:t.id-e.id}var o,a,s,u,c,l,h=t.context,f=new e.Vector3,p=new e.Quaternion,d=new e.Vector3,m=function(){var t=new Float32Array([-.5,-.5,0,0,.5,-.5,1,0,.5,.5,1,1,-.5,.5,0,1]),n=new Uint16Array([0,1,2,0,2,3]);o=h.createBuffer(),a=h.createBuffer(),h.bindBuffer(h.ARRAY_BUFFER,o),h.bufferData(h.ARRAY_BUFFER,t,h.STATIC_DRAW),h.bindBuffer(h.ELEMENT_ARRAY_BUFFER,a),h.bufferData(h.ELEMENT_ARRAY_BUFFER,n,h.STATIC_DRAW),s=r(),u={position:h.getAttribLocation(s,"position"),uv:h.getAttribLocation(s,"uv")},c={uvOffset:h.getUniformLocation(s,"uvOffset"),uvScale:h.getUniformLocation(s,"uvScale"),rotation:h.getUniformLocation(s,"rotation"),scale:h.getUniformLocation(s,"scale"),color:h.getUniformLocation(s,"color"),map:h.getUniformLocation(s,"map"),opacity:h.getUniformLocation(s,"opacity"),modelViewMatrix:h.getUniformLocation(s,"modelViewMatrix"),projectionMatrix:h.getUniformLocation(s,"projectionMatrix"),fogType:h.getUniformLocation(s,"fogType"),fogDensity:h.getUniformLocation(s,"fogDensity"),fogNear:h.getUniformLocation(s,"fogNear"),fogFar:h.getUniformLocation(s,"fogFar"),fogColor:h.getUniformLocation(s,"fogColor"),alphaTest:h.getUniformLocation(s,"alphaTest")};var i=document.createElement("canvas");i.width=8,i.height=8;var f=i.getContext("2d");f.fillStyle="white",f.fillRect(0,0,8,8),l=new e.Texture(i),l.needsUpdate=!0};this.render=function(r,v){if(0!==n.length){void 0===s&&m(),h.useProgram(s),h.enableVertexAttribArray(u.position),h.enableVertexAttribArray(u.uv),h.disable(h.CULL_FACE),h.enable(h.BLEND),h.bindBuffer(h.ARRAY_BUFFER,o),h.vertexAttribPointer(u.position,2,h.FLOAT,!1,16,0),h.vertexAttribPointer(u.uv,2,h.FLOAT,!1,16,8),h.bindBuffer(h.ELEMENT_ARRAY_BUFFER,a),h.uniformMatrix4fv(c.projectionMatrix,!1,v.projectionMatrix.elements),h.activeTexture(h.TEXTURE0),h.uniform1i(c.map,0);var g=0,y=0,b=r.fog;b?(h.uniform3f(c.fogColor,b.color.r,b.color.g,b.color.b),b instanceof e.Fog?(h.uniform1f(c.fogNear,b.near),h.uniform1f(c.fogFar,b.far),h.uniform1i(c.fogType,1),g=1,y=1):b instanceof e.FogExp2&&(h.uniform1f(c.fogDensity,b.density),h.uniform1i(c.fogType,2),g=2,y=2)):(h.uniform1i(c.fogType,0),g=0,y=0);for(var x=0,w=n.length;w>x;x++){var _=n[x];_._modelViewMatrix.multiplyMatrices(v.matrixWorldInverse,_.matrixWorld),_.z=-_._modelViewMatrix.elements[14]}n.sort(i);for(var C=[],x=0,w=n.length;w>x;x++){var _=n[x],E=_.material;h.uniform1f(c.alphaTest,E.alphaTest),h.uniformMatrix4fv(c.modelViewMatrix,!1,_._modelViewMatrix.elements),_.matrixWorld.decompose(f,p,d),C[0]=d.x,C[1]=d.y;var S=0;r.fog&&E.fog&&(S=y),g!==S&&(h.uniform1i(c.fogType,S),g=S),null!==E.map?(h.uniform2f(c.uvOffset,E.map.offset.x,E.map.offset.y),h.uniform2f(c.uvScale,E.map.repeat.x,E.map.repeat.y)):(h.uniform2f(c.uvOffset,0,0),h.uniform2f(c.uvScale,1,1)),h.uniform1f(c.opacity,E.opacity),h.uniform3f(c.color,E.color.r,E.color.g,E.color.b),h.uniform1f(c.rotation,E.rotation),h.uniform2fv(c.scale,C),t.state.setBlending(E.blending,E.blendEquation,E.blendSrc,E.blendDst),t.state.setDepthTest(E.depthTest),t.state.setDepthWrite(E.depthWrite),E.map&&E.map.image&&E.map.image.width?t.setTexture(E.map,0):t.setTexture(l,0),h.drawElements(h.TRIANGLES,6,h.UNSIGNED_SHORT,0)}h.enable(h.CULL_FACE),t.resetGLState()}}},e.GeometryUtils={merge:function(t,n,r){e.warn("THREE.GeometryUtils: .merge() has been moved to Geometry. Use geometry.merge( geometry2, matrix, materialIndexOffset ) instead.");var i;n instanceof e.Mesh&&(n.matrixAutoUpdate&&n.updateMatrix(),i=n.matrix,n=n.geometry),t.merge(n,i,r)},center:function(t){return e.warn("THREE.GeometryUtils: .center() has been moved to Geometry. Use geometry.center() instead."),t.center()}},e.ImageUtils={crossOrigin:void 0,loadTexture:function(t,n,r,i){var o=new e.ImageLoader;o.crossOrigin=this.crossOrigin;var a=new e.Texture(void 0,n);return o.load(t,function(e){a.image=e,a.needsUpdate=!0,r&&r(a)},void 0,function(e){i&&i(e)}),a.sourceFile=t,a},loadTextureCube:function(t,n,r,i){var o=[],a=new e.ImageLoader;a.crossOrigin=this.crossOrigin;var s=new e.CubeTexture(o,n);s.flipY=!1;for(var u=0,c=function(e){a.load(t[e],function(t){s.images[e]=t,u+=1,6===u&&(s.needsUpdate=!0,r&&r(s))},void 0,i)},l=0,h=t.length;h>l;++l)c(l);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 n=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]]},r=function(e,t){return[e[0]-t[0],e[1]-t[1],e[2]-t[2]]},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=1|t;var o=e.width,a=e.height,s=document.createElement("canvas");s.width=o,s.height=a;var u=s.getContext("2d");u.drawImage(e,0,0);for(var c=u.getImageData(0,0,o,a).data,l=u.createImageData(o,a),h=l.data,f=0;o>f;f++)for(var p=0;a>p;p++){var d=0>p-1?0:p-1,m=p+1>a-1?a-1:p+1,v=0>f-1?0:f-1,g=f+1>o-1?o-1:f+1,y=[],b=[0,0,c[4*(p*o+f)]/255*t];y.push([-1,0,c[4*(p*o+v)]/255*t]),y.push([-1,-1,c[4*(d*o+v)]/255*t]),y.push([0,-1,c[4*(d*o+f)]/255*t]),y.push([1,-1,c[4*(d*o+g)]/255*t]),y.push([1,0,c[4*(p*o+g)]/255*t]),y.push([1,1,c[4*(m*o+g)]/255*t]),y.push([0,1,c[4*(m*o+f)]/255*t]),y.push([-1,1,c[4*(m*o+v)]/255*t]);for(var x=[],w=y.length,_=0;w>_;_++){var C=y[_],E=y[(_+1)%w];C=r(C,b),E=r(E,b),x.push(i(n(C,E)))}for(var S=[0,0,0],_=0;_<x.length;_++)S[0]+=x[_][0],S[1]+=x[_][1],S[2]+=x[_][2];S[0]/=x.length,S[1]/=x.length,S[2]/=x.length;var M=4*(p*o+f);h[M]=(S[0]+1)/2*255|0,h[M+1]=(S[1]+1)/2*255|0,h[M+2]=255*S[2]|0,h[M+3]=255}return u.putImageData(l,0,0),s},generateDataTexture:function(t,n,r){for(var i=t*n,o=new Uint8Array(3*i),a=Math.floor(255*r.r),s=Math.floor(255*r.g),u=Math.floor(255*r.b),c=0;i>c;c++)o[3*c]=a,o[3*c+1]=s,o[3*c+2]=u;var l=new e.DataTexture(o,t,n,e.RGBFormat);return l.needsUpdate=!0,l}},e.SceneUtils={createMultiMaterialObject:function(t,n){for(var r=new e.Object3D,i=0,o=n.length;o>i;i++)r.add(new e.Mesh(t,n[i]));return r},detach:function(e,t,n){e.applyMatrix(t.matrixWorld),t.remove(e),n.add(e)},attach:function(t,n,r){var i=new e.Matrix4;i.getInverse(r.matrixWorld),t.applyMatrix(i),n.remove(t),r.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(),n=this;return n.faces[t]=n.faces[t]||{},n.faces[t][e.cssFontWeight]=n.faces[t][e.cssFontWeight]||{},n.faces[t][e.cssFontWeight][e.cssFontStyle]=e,n.faces[t][e.cssFontWeight][e.cssFontStyle]=e,e},drawText:function(t){var n,r=this.getFace(),i=this.size/r.resolution,o=0,a=String(t).split(""),s=a.length,u=[];for(n=0;s>n;n++){var c=new e.Path,l=this.extractGlyphPoints(a[n],r,i,o,c);o+=l.offset,u.push(l.path)}var h=o/2;return{paths:u,offset:h}},extractGlyphPoints:function(t,n,r,i,o){var a,s,u,c,l,h,f,p,d,m,v,g,y,b,x,w,_,C,E,S=[],M=n.glyphs[t]||n.glyphs["?"];if(M){if(M.o)for(c=M._cachedOutline||(M._cachedOutline=M.o.split(" ")),h=c.length,f=r,p=r,a=0;h>a;)switch(l=c[a++]){case"m":d=c[a++]*f+i,m=c[a++]*p,o.moveTo(d,m);break;case"l":d=c[a++]*f+i,m=c[a++]*p,o.lineTo(d,m);break;case"q":if(v=c[a++]*f+i,g=c[a++]*p,x=c[a++]*f+i,w=c[a++]*p,o.quadraticCurveTo(x,w,v,g),E=S[S.length-1])for(y=E.x,b=E.y,s=1,u=this.divisions;u>=s;s++){var T=s/u;e.Shape.Utils.b2(T,y,x,v),e.Shape.Utils.b2(T,b,w,g)}break;case"b":if(v=c[a++]*f+i,g=c[a++]*p,x=c[a++]*f+i,w=c[a++]*p,_=c[a++]*f+i,C=c[a++]*p,o.bezierCurveTo(x,w,_,C,v,g),E=S[S.length-1])for(y=E.x,b=E.y,s=1,u=this.divisions;u>=s;s++){var T=s/u;e.Shape.Utils.b3(T,y,x,_,v),e.Shape.Utils.b3(T,b,w,C,g)}}return{offset:M.ha*r,path:o}}}},e.FontUtils.generateShapes=function(t,n){n=n||{};var r=void 0!==n.size?n.size:100,i=void 0!==n.curveSegments?n.curveSegments:4,o=void 0!==n.font?n.font:"helvetiker",a=void 0!==n.weight?n.weight:"normal",s=void 0!==n.style?n.style:"normal";e.FontUtils.size=r,e.FontUtils.divisions=i,e.FontUtils.face=o,e.FontUtils.weight=a,e.FontUtils.style=s;for(var u=e.FontUtils.drawText(t),c=u.paths,l=[],h=0,f=c.length;f>h;h++)Array.prototype.push.apply(l,c[h].toShapes());return l},function(t){var n=1e-10,r=function(t,n){var r=t.length;if(3>r)return null;var a,s,u,c=[],l=[],h=[];if(i(t)>0)for(s=0;r>s;s++)l[s]=s;else for(s=0;r>s;s++)l[s]=r-1-s;var f=r,p=2*f;for(s=f-1;f>2;){if(p--<=0)return e.warn("THREE.FontUtils: Warning, unable to triangulate polygon! in Triangulate.process()"),n?h:c;if(a=s,a>=f&&(a=0),s=a+1,s>=f&&(s=0),u=s+1,u>=f&&(u=0),o(t,a,s,u,f,l)){var d,m,v,g,y;for(d=l[a],m=l[s],v=l[u],c.push([t[d],t[m],t[v]]),h.push([l[a],l[s],l[u]]),g=s,y=s+1;f>y;g++,y++)l[g]=l[y];f--,p=2*f}}return n?h:c},i=function(e){for(var t=e.length,n=0,r=t-1,i=0;t>i;r=i++)n+=e[r].x*e[i].y-e[i].x*e[r].y;return.5*n},o=function(e,t,r,i,o,a){var s,u,c,l,h,f,p,d,m;if(u=e[a[t]].x,c=e[a[t]].y,l=e[a[r]].x,h=e[a[r]].y,f=e[a[i]].x,p=e[a[i]].y,n>(l-u)*(p-c)-(h-c)*(f-u))return!1;var v,g,y,b,x,w,_,C,E,S,M,T,A,P,k;for(v=f-l,g=p-h,y=u-f,b=c-p,x=l-u,w=h-c,s=0;o>s;s++)if(d=e[a[s]].x,m=e[a[s]].y,!(d===u&&m===c||d===l&&m===h||d===f&&m===p)&&(_=d-u,C=m-c,E=d-l,S=m-h,M=d-f,T=m-p,k=v*S-g*E,A=x*C-w*_,P=y*T-b*M,k>=-n&&P>=-n&&A>=-n))return!1;return!0};return t.Triangulate=r,t.Triangulate.area=i,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=!1,this.startTime=0,this.isPlaying=!1},e.Audio.prototype=Object.create(e.Object3D.prototype),e.Audio.prototype.constructor=e.Audio,e.Audio.prototype.load=function(e){var t=this,n=new XMLHttpRequest;return n.open("GET",e,!0),n.responseType="arraybuffer",n.onload=function(){t.context.decodeAudioData(this.response,function(e){t.source.buffer=e,t.autoplay&&t.play()})},n.send(),this},e.Audio.prototype.play=function(){if(this.isPlaying===!0)return e.warn("THREE.Audio: Audio is already playing."),void 0;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=!0,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=!1},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(n){e.Object3D.prototype.updateMatrixWorld.call(this,n),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,n=new e.Quaternion,r=new e.Vector3,i=new e.Vector3,o=new e.Vector3,a=new e.Vector3;return function(s){e.Object3D.prototype.updateMatrixWorld.call(this,s);var u=this.context.listener,c=this.up;this.matrixWorld.decompose(t,n,r),i.set(0,0,-1).applyQuaternion(n),o.subVectors(t,a),u.setPosition(t.x,t.y,t.z),u.setOrientation(i.x,i.y,i.z,c.x,c.y,c.z),u.setVelocity(o.x,o.y,o.z),a.copy(t)}}(),e.Curve=function(){},e.Curve.prototype.getPoint=function(){return e.warn("THREE.Curve: Warning, getPoint() not implemented!"),null},e.Curve.prototype.getPointAt=function(e){var t=this.getUtoTmapping(e);return this.getPoint(t)},e.Curve.prototype.getPoints=function(e){e||(e=5);var t,n=[];for(t=0;e>=t;t++)n.push(this.getPoint(t/e));return n},e.Curve.prototype.getSpacedPoints=function(e){e||(e=5);var t,n=[];for(t=0;e>=t;t++)n.push(this.getPointAt(t/e));return n},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),this.cacheArcLengths&&this.cacheArcLengths.length==e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;var t,n,r=[],i=this.getPoint(0),o=0;for(r.push(0),n=1;e>=n;n++)t=this.getPoint(n/e),o+=t.distanceTo(i),r.push(o),i=t;return this.cacheArcLengths=r,r},e.Curve.prototype.updateArcLengths=function(){this.needsUpdate=!0,this.getLengths()},e.Curve.prototype.getUtoTmapping=function(e,t){var n,r=this.getLengths(),i=0,o=r.length;n=t?t:e*r[o-1];for(var a,s=0,u=o-1;u>=s;)if(i=Math.floor(s+(u-s)/2),a=r[i]-n,0>a)s=i+1;else{if(!(a>0)){u=i;break}u=i-1}if(i=u,r[i]==n){var c=i/(o-1);return c}var l=r[i],h=r[i+1],f=h-l,p=(n-l)/f,c=(i+p)/(o-1);return c},e.Curve.prototype.getTangent=function(e){var t=1e-4,n=e-t,r=e+t;0>n&&(n=0),r>1&&(r=1);var i=this.getPoint(n),o=this.getPoint(r),a=o.clone().sub(i);return a.normalize()},e.Curve.prototype.getTangentAt=function(e){var t=this.getUtoTmapping(e);return this.getTangent(t)},e.Curve.Utils={tangentQuadraticBezier:function(e,t,n,r){return 2*(1-e)*(n-t)+2*e*(r-n)},tangentCubicBezier:function(e,t,n,r,i){return-3*t*(1-e)*(1-e)+3*n*(1-e)*(1-e)-6*e*n*(1-e)+6*e*r*(1-e)-3*e*e*r+3*e*e*i},tangentSpline:function(e){var t=6*e*e-6*e,n=3*e*e-4*e+1,r=-6*e*e+6*e,i=3*e*e-2*e;return t+n+r+i},interpolate:function(e,t,n,r,i){var o=.5*(n-e),a=.5*(r-t),s=i*i,u=i*s;return(2*t-2*n+o+a)*u+(-3*t+3*n-2*o-a)*s+o*i+t}},e.Curve.create=function(t,n){return t.prototype=Object.create(e.Curve.prototype),t.prototype.constructor=t,t.prototype.getPoint=n,t},e.CurvePath=function(){this.curves=[],this.bends=[],this.autoClose=!1},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),n=this.curves[this.curves.length-1].getPoint(1);t.equals(n)||this.curves.push(new e.LineCurve(n,t))},e.CurvePath.prototype.getPoint=function(e){for(var t,n,r=e*this.getLength(),i=this.getCurveLengths(),o=0;o<i.length;){if(i[o]>=r){t=i[o]-r,n=this.curves[o];var a=1-t/n.getLength();return n.getPointAt(a)}o++}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=[],n=0,r=this.curves.length;for(e=0;r>e;e++)n+=this.curves[e].getLength(),t.push(n);return this.cacheLengths=t,t},e.CurvePath.prototype.getBoundingBox=function(){var t,n,r,i,o,a,s=this.getPoints();t=n=Number.NEGATIVE_INFINITY,i=o=Number.POSITIVE_INFINITY;var u,c,l,h,f=s[0]instanceof e.Vector3;for(h=f?new e.Vector3:new e.Vector2,c=0,l=s.length;l>c;c++)u=s[c],u.x>t?t=u.x:u.x<i&&(i=u.x),u.y>n?n=u.y:u.y<o&&(o=u.y),f&&(u.z>r?r=u.z:u.z<a&&(a=u.z)),h.add(u);var p={minX:i,minY:o,maxX:t,maxY:n};return f&&(p.maxZ=r,p.minZ=a),p},e.CurvePath.prototype.createPointsGeometry=function(e){var t=this.getPoints(e,!0);return this.createGeometry(t)},e.CurvePath.prototype.createSpacedPointsGeometry=function(e){var t=this.getSpacedPoints(e,!0);return this.createGeometry(t)},e.CurvePath.prototype.createGeometry=function(t){for(var n=new e.Geometry,r=0;r<t.length;r++)n.vertices.push(new e.Vector3(t[r].x,t[r].y,t[r].z||0));return n},e.CurvePath.prototype.addWrapPath=function(e){this.bends.push(e)},e.CurvePath.prototype.getTransformedPoints=function(e,t){var n,r,i=this.getPoints(e);for(t||(t=this.bends),n=0,r=t.length;r>n;n++)i=this.getWrapPoints(i,t[n]);return i},e.CurvePath.prototype.getTransformedSpacedPoints=function(e,t){var n,r,i=this.getSpacedPoints(e);for(t||(t=this.bends),n=0,r=t.length;r>n;n++)i=this.getWrapPoints(i,t[n]);return i},e.CurvePath.prototype.getWrapPoints=function(e,t){var n,r,i,o,a,s,u=this.getBoundingBox();for(n=0,r=e.length;r>n;n++){i=e[n],o=i.x,a=i.y,s=o/u.maxX,s=t.getUtoTmapping(s,o);var c=t.getPoint(s),l=t.getTangent(s);l.set(-l.y,l.x).multiplyScalar(a),i.x=c.x+l.x,i.y=c.y+l.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,n=new e.Quaternion,r=new e.Vector3,i=new e.Vector3,o=new e.Quaternion,a=new e.Vector3;return function(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(this.parent?(this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorld.decompose(i,o,a),this.matrix.decompose(t,n,r),this.matrixWorld.compose(i,n,a)):this.matrixWorld.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,e=!0);for(var s=0,u=this.children.length;u>s;s++)this.children[s].updateMatrixWorld(e)}}(),e.Path=function(t){e.CurvePath.call(this),this.actions=[],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,n=e.length;n>t;t++)this.lineTo(e[t].x,e[t].y)},e.Path.prototype.moveTo=function(){var t=Array.prototype.slice.call(arguments);this.actions.push({action:e.PathActions.MOVE_TO,args:t})},e.Path.prototype.lineTo=function(t,n){var r=Array.prototype.slice.call(arguments),i=this.actions[this.actions.length-1].args,o=i[i.length-2],a=i[i.length-1],s=new e.LineCurve(new e.Vector2(o,a),new e.Vector2(t,n));this.curves.push(s),this.actions.push({action:e.PathActions.LINE_TO,args:r})},e.Path.prototype.quadraticCurveTo=function(t,n,r,i){var o=Array.prototype.slice.call(arguments),a=this.actions[this.actions.length-1].args,s=a[a.length-2],u=a[a.length-1],c=new e.QuadraticBezierCurve(new e.Vector2(s,u),new e.Vector2(t,n),new e.Vector2(r,i));this.curves.push(c),this.actions.push({action:e.PathActions.QUADRATIC_CURVE_TO,args:o})},e.Path.prototype.bezierCurveTo=function(t,n,r,i,o,a){var s=Array.prototype.slice.call(arguments),u=this.actions[this.actions.length-1].args,c=u[u.length-2],l=u[u.length-1],h=new e.CubicBezierCurve(new e.Vector2(c,l),new e.Vector2(t,n),new e.Vector2(r,i),new e.Vector2(o,a));this.curves.push(h),this.actions.push({action:e.PathActions.BEZIER_CURVE_TO,args:s})},e.Path.prototype.splineThru=function(t){var n=Array.prototype.slice.call(arguments),r=this.actions[this.actions.length-1].args,i=r[r.length-2],o=r[r.length-1],a=[new e.Vector2(i,o)];Array.prototype.push.apply(a,t);var s=new e.SplineCurve(a);this.curves.push(s),this.actions.push({action:e.PathActions.CSPLINE_THRU,args:n})},e.Path.prototype.arc=function(e,t,n,r,i,o){var a=this.actions[this.actions.length-1].args,s=a[a.length-2],u=a[a.length-1];this.absarc(e+s,t+u,n,r,i,o)},e.Path.prototype.absarc=function(e,t,n,r,i,o){this.absellipse(e,t,n,n,r,i,o)},e.Path.prototype.ellipse=function(e,t,n,r,i,o,a){var s=this.actions[this.actions.length-1].args,u=s[s.length-2],c=s[s.length-1];this.absellipse(e+u,t+c,n,r,i,o,a)},e.Path.prototype.absellipse=function(t,n,r,i,o,a,s){var u=Array.prototype.slice.call(arguments),c=new e.EllipseCurve(t,n,r,i,o,a,s);this.curves.push(c);var l=c.getPoint(1);u.push(l.x),u.push(l.y),this.actions.push({action:e.PathActions.ELLIPSE,args:u})},e.Path.prototype.getSpacedPoints=function(e){e||(e=40);for(var t=[],n=0;e>n;n++)t.push(this.getPoint(n/e));return t},e.Path.prototype.getPoints=function(t,n){if(this.useSpacedPoints)return console.log("tata"),this.getSpacedPoints(t,n);t=t||12;var r,i,o,a,s,u,c,l,h,f,p,d,m,v,g,y,b,x,w=[];for(r=0,i=this.actions.length;i>r;r++)switch(o=this.actions[r],a=o.action,s=o.args,a){case e.PathActions.MOVE_TO:w.push(new e.Vector2(s[0],s[1]));break;case e.PathActions.LINE_TO:w.push(new e.Vector2(s[0],s[1]));break;case e.PathActions.QUADRATIC_CURVE_TO:for(u=s[2],c=s[3],f=s[0],p=s[1],w.length>0?(v=w[w.length-1],d=v.x,m=v.y):(v=this.actions[r-1].args,d=v[v.length-2],m=v[v.length-1]),g=1;t>=g;g++)y=g/t,b=e.Shape.Utils.b2(y,d,f,u),x=e.Shape.Utils.b2(y,m,p,c),w.push(new e.Vector2(b,x));break;case e.PathActions.BEZIER_CURVE_TO:for(u=s[4],c=s[5],f=s[0],p=s[1],l=s[2],h=s[3],w.length>0?(v=w[w.length-1],d=v.x,m=v.y):(v=this.actions[r-1].args,d=v[v.length-2],m=v[v.length-1]),g=1;t>=g;g++)y=g/t,b=e.Shape.Utils.b3(y,d,f,l,u),x=e.Shape.Utils.b3(y,m,p,h,c),w.push(new e.Vector2(b,x));break;case e.PathActions.CSPLINE_THRU:v=this.actions[r-1].args;var _=new e.Vector2(v[v.length-2],v[v.length-1]),C=[_],E=t*s[0].length;C=C.concat(s[0]);var S=new e.SplineCurve(C);for(g=1;E>=g;g++)w.push(S.getPointAt(g/E));break;case e.PathActions.ARC:var M,T=s[0],A=s[1],P=s[2],k=s[3],R=s[4],I=!!s[5],D=R-k,B=2*t;for(g=1;B>=g;g++)y=g/B,I||(y=1-y),M=k+y*D,b=T+P*Math.cos(M),x=A+P*Math.sin(M),w.push(new e.Vector2(b,x));break;case e.PathActions.ELLIPSE:var M,T=s[0],A=s[1],V=s[2],L=s[3],k=s[4],R=s[5],I=!!s[6],D=R-k,B=2*t;for(g=1;B>=g;g++)y=g/B,I||(y=1-y),M=k+y*D,b=T+V*Math.cos(M),x=A+L*Math.sin(M),w.push(new e.Vector2(b,x))}var N=w[w.length-1],O=1e-10;return Math.abs(N.x-w[0].x)<O&&Math.abs(N.y-w[0].y)<O&&w.splice(w.length-1,1),n&&w.push(w[0]),w},e.Path.prototype.toShapes=function(t,n){function r(t){var n,r,i,o,a,s=[],u=new e.Path;for(n=0,r=t.length;r>n;n++)i=t[n],a=i.args,o=i.action,o==e.PathActions.MOVE_TO&&0!=u.actions.length&&(s.push(u),u=new e.Path),u[o].apply(u,a);return 0!=u.actions.length&&s.push(u),s}function i(t){for(var n=[],r=0,i=t.length;i>r;r++){var o=t[r],a=new e.Shape;
a.actions=o.actions,a.curves=o.curves,n.push(a)}return n}function o(e,t){for(var n=1e-10,r=t.length,i=!1,o=r-1,a=0;r>a;o=a++){var s=t[o],u=t[a],c=u.x-s.x,l=u.y-s.y;if(Math.abs(l)>n){if(0>l&&(s=t[a],c=-c,u=t[o],l=-l),e.y<s.y||e.y>u.y)continue;if(e.y==s.y){if(e.x==s.x)return!0}else{var h=l*(e.x-s.x)-c*(e.y-s.y);if(0==h)return!0;if(0>h)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!0}}return i}var a=r(this.actions);if(0==a.length)return[];if(n===!0)return i(a);var s,u,c,l=[];if(1==a.length)return u=a[0],c=new e.Shape,c.actions=u.actions,c.curves=u.curves,l.push(c),l;var h=!e.Shape.Utils.isClockWise(a[0].getPoints());h=t?!h:h;var f,p=[],d=[],m=[],v=0;d[v]=void 0,m[v]=[];var g,y;for(g=0,y=a.length;y>g;g++)u=a[g],f=u.getPoints(),s=e.Shape.Utils.isClockWise(f),s=t?!s:s,s?(!h&&d[v]&&v++,d[v]={s:new e.Shape,p:f},d[v].s.actions=u.actions,d[v].s.curves=u.curves,h&&v++,m[v]=[]):m[v].push({h:u,p:f[0]});if(!d[0])return i(a);if(d.length>1){for(var b=!1,x=[],w=0,_=d.length;_>w;w++)p[w]=[];for(var w=0,_=d.length;_>w;w++)for(var C=m[w],E=0;E<C.length;E++){for(var S=C[E],M=!0,T=0;T<d.length;T++)o(S.p,d[T].p)&&(w!=T&&x.push({froms:w,tos:T,hole:E}),M?(M=!1,p[T].push(S)):b=!0);M&&p[w].push(S)}x.length>0&&(b||(m=p))}var A,P,k;for(g=0,y=d.length;y>g;g++)for(c=d[g].s,l.push(c),A=m[g],P=0,k=A.length;k>P;P++)c.holes.push(A[P].h);return l},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 n=new e.ExtrudeGeometry(this,t);return n},e.Shape.prototype.makeGeometry=function(t){var n=new e.ShapeGeometry(this,t);return n},e.Shape.prototype.getPointsHoles=function(e){var t,n=this.holes.length,r=[];for(t=0;n>t;t++)r[t]=this.holes[t].getTransformedPoints(e,this.bends);return r},e.Shape.prototype.getSpacedPointsHoles=function(e){var t,n=this.holes.length,r=[];for(t=0;n>t;t++)r[t]=this.holes[t].getTransformedSpacedPoints(e,this.bends);return r},e.Shape.prototype.extractAllPoints=function(e){return{shape:this.getTransformedPoints(e),holes:this.getPointsHoles(e)}},e.Shape.prototype.extractPoints=function(e){return this.useSpacedPoints?this.extractAllSpacedPoints(e):this.extractAllPoints(e)},e.Shape.prototype.extractAllSpacedPoints=function(e){return{shape:this.getTransformedSpacedPoints(e),holes:this.getSpacedPointsHoles(e)}},e.Shape.Utils={triangulateShape:function(t,n){function r(e,t,n){return e.x!=t.x?e.x<t.x?e.x<=n.x&&n.x<=t.x:t.x<=n.x&&n.x<=e.x:e.y<t.y?e.y<=n.y&&n.y<=t.y:t.y<=n.y&&n.y<=e.y}function i(e,t,n,i,o){var a=1e-10,s=t.x-e.x,u=t.y-e.y,c=i.x-n.x,l=i.y-n.y,h=e.x-n.x,f=e.y-n.y,p=u*c-s*l,d=u*h-s*f;if(Math.abs(p)>a){var m;if(p>0){if(0>d||d>p)return[];if(m=l*h-c*f,0>m||m>p)return[]}else{if(d>0||p>d)return[];if(m=l*h-c*f,m>0||p>m)return[]}if(0==m)return!o||0!=d&&d!=p?[e]:[];if(m==p)return!o||0!=d&&d!=p?[t]:[];if(0==d)return[n];if(d==p)return[i];var v=m/p;return[{x:e.x+v*s,y:e.y+v*u}]}if(0!=d||l*h!=c*f)return[];var g=0==s&&0==u,y=0==c&&0==l;if(g&&y)return e.x!=n.x||e.y!=n.y?[]:[e];if(g)return r(n,i,e)?[e]:[];if(y)return r(e,t,n)?[n]:[];var b,x,w,_,C,E,S,M;return 0!=s?(e.x<t.x?(b=e,w=e.x,x=t,_=t.x):(b=t,w=t.x,x=e,_=e.x),n.x<i.x?(C=n,S=n.x,E=i,M=i.x):(C=i,S=i.x,E=n,M=n.x)):(e.y<t.y?(b=e,w=e.y,x=t,_=t.y):(b=t,w=t.y,x=e,_=e.y),n.y<i.y?(C=n,S=n.y,E=i,M=i.y):(C=i,S=i.y,E=n,M=n.y)),S>=w?S>_?[]:_==S?o?[]:[C]:M>=_?[C,x]:[C,E]:w>M?[]:w==M?o?[]:[b]:M>=_?[b,x]:[b,E]}function o(e,t,n,r){var i=1e-10,o=t.x-e.x,a=t.y-e.y,s=n.x-e.x,u=n.y-e.y,c=r.x-e.x,l=r.y-e.y,h=o*u-a*s,f=o*l-a*c;if(Math.abs(h)>i){var p=c*u-l*s;return h>0?f>=0&&p>=0:f>=0||p>=0}return f>0}function a(e,t){function n(e,t){var n=y.length-1,r=e-1;0>r&&(r=n);var i=e+1;i>n&&(i=0);var a=o(y[e],y[r],y[i],s[t]);if(!a)return!1;var u=s.length-1,c=t-1;0>c&&(c=u);var l=t+1;return l>u&&(l=0),a=o(s[t],s[c],s[l],y[e]),a?!0:!1}function r(e,t){var n,r,o;for(n=0;n<y.length;n++)if(r=n+1,r%=y.length,o=i(e,t,y[n],y[r],!0),o.length>0)return!0;return!1}function a(e,n){var r,o,a,s,u;for(r=0;r<b.length;r++)for(o=t[b[r]],a=0;a<o.length;a++)if(s=a+1,s%=o.length,u=i(e,n,o[a],o[s],!0),u.length>0)return!0;return!1}for(var s,u,c,l,h,f,p,d,m,v,g,y=e.concat(),b=[],x=[],w=0,_=t.length;_>w;w++)b.push(w);for(var C=0,E=2*b.length;b.length>0;){if(E--,0>E){console.log("Infinite Loop! Holes left:"+b.length+", Probably Hole outside Shape!");break}for(c=C;c<y.length;c++){l=y[c],u=-1;for(var w=0;w<b.length;w++)if(f=b[w],p=l.x+":"+l.y+":"+f,void 0===x[p]){s=t[f];for(var S=0;S<s.length;S++)if(h=s[S],n(c,S)&&!r(l,h)&&!a(l,h)){u=S,b.splice(w,1),d=y.slice(0,c+1),m=y.slice(c),v=s.slice(u),g=s.slice(0,u+1),y=d.concat(v).concat(g).concat(m),C=c;break}if(u>=0)break;x[p]=!0}if(u>=0)break}}return y}for(var s,u,c,l,h,f,p={},d=t.concat(),m=0,v=n.length;v>m;m++)Array.prototype.push.apply(d,n[m]);for(s=0,u=d.length;u>s;s++)h=d[s].x+":"+d[s].y,void 0!==p[h]&&e.warn("THREE.Shape: Duplicate point",h),p[h]=s;var g=a(t,n),y=e.FontUtils.Triangulate(g,!1);for(s=0,u=y.length;u>s;s++)for(l=y[s],c=0;3>c;c++)h=l[c].x+":"+l[c].y,f=p[h],void 0!==f&&(l[c]=f);return y.concat()},isClockWise:function(t){return e.FontUtils.Triangulate.area(t)<0},b2p0:function(e,t){var n=1-e;return n*n*t},b2p1:function(e,t){return 2*(1-e)*e*t},b2p2:function(e,t){return e*e*t},b2:function(e,t,n,r){return this.b2p0(e,t)+this.b2p1(e,n)+this.b2p2(e,r)},b3p0:function(e,t){var n=1-e;return n*n*n*t},b3p1:function(e,t){var n=1-e;return 3*n*n*e*t},b3p2:function(e,t){var n=1-e;return 3*n*e*e*t},b3p3:function(e,t){return e*e*e*t},b3:function(e,t,n,r,i){return this.b3p0(e,t)+this.b3p1(e,n)+this.b3p2(e,r)+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);return t.multiplyScalar(e).add(this.v1),t},e.LineCurve.prototype.getPointAt=function(e){return this.getPoint(e)},e.LineCurve.prototype.getTangent=function(){var e=this.v2.clone().sub(this.v1);return e.normalize()},e.QuadraticBezierCurve=function(e,t,n){this.v0=e,this.v1=t,this.v2=n},e.QuadraticBezierCurve.prototype=Object.create(e.Curve.prototype),e.QuadraticBezierCurve.prototype.constructor=e.QuadraticBezierCurve,e.QuadraticBezierCurve.prototype.getPoint=function(t){var n=new e.Vector2;return n.x=e.Shape.Utils.b2(t,this.v0.x,this.v1.x,this.v2.x),n.y=e.Shape.Utils.b2(t,this.v0.y,this.v1.y,this.v2.y),n},e.QuadraticBezierCurve.prototype.getTangent=function(t){var n=new e.Vector2;return n.x=e.Curve.Utils.tangentQuadraticBezier(t,this.v0.x,this.v1.x,this.v2.x),n.y=e.Curve.Utils.tangentQuadraticBezier(t,this.v0.y,this.v1.y,this.v2.y),n.normalize()},e.CubicBezierCurve=function(e,t,n,r){this.v0=e,this.v1=t,this.v2=n,this.v3=r},e.CubicBezierCurve.prototype=Object.create(e.Curve.prototype),e.CubicBezierCurve.prototype.constructor=e.CubicBezierCurve,e.CubicBezierCurve.prototype.getPoint=function(t){var n,r;return n=e.Shape.Utils.b3(t,this.v0.x,this.v1.x,this.v2.x,this.v3.x),r=e.Shape.Utils.b3(t,this.v0.y,this.v1.y,this.v2.y,this.v3.y),new e.Vector2(n,r)},e.CubicBezierCurve.prototype.getTangent=function(t){var n,r;n=e.Curve.Utils.tangentCubicBezier(t,this.v0.x,this.v1.x,this.v2.x,this.v3.x),r=e.Curve.Utils.tangentCubicBezier(t,this.v0.y,this.v1.y,this.v2.y,this.v3.y);var i=new e.Vector2(n,r);return i.normalize(),i},e.SplineCurve=function(e){this.points=void 0==e?[]:e},e.SplineCurve.prototype=Object.create(e.Curve.prototype),e.SplineCurve.prototype.constructor=e.SplineCurve,e.SplineCurve.prototype.getPoint=function(t){var n=this.points,r=(n.length-1)*t,i=Math.floor(r),o=r-i,a=n[0==i?i:i-1],s=n[i],u=n[i>n.length-2?n.length-1:i+1],c=n[i>n.length-3?n.length-1:i+2],l=new e.Vector2;return l.x=e.Curve.Utils.interpolate(a.x,s.x,u.x,c.x,o),l.y=e.Curve.Utils.interpolate(a.y,s.y,u.y,c.y,o),l},e.EllipseCurve=function(e,t,n,r,i,o,a){this.aX=e,this.aY=t,this.xRadius=n,this.yRadius=r,this.aStartAngle=i,this.aEndAngle=o,this.aClockwise=a},e.EllipseCurve.prototype=Object.create(e.Curve.prototype),e.EllipseCurve.prototype.constructor=e.EllipseCurve,e.EllipseCurve.prototype.getPoint=function(t){var n=this.aEndAngle-this.aStartAngle;0>n&&(n+=2*Math.PI),n>2*Math.PI&&(n-=2*Math.PI);var r;r=this.aClockwise===!0?this.aEndAngle+(1-t)*(2*Math.PI-n):this.aStartAngle+t*n;var i=new e.Vector2;return i.x=this.aX+this.xRadius*Math.cos(r),i.y=this.aY+this.yRadius*Math.sin(r),i},e.ArcCurve=function(t,n,r,i,o,a){e.EllipseCurve.call(this,t,n,r,r,i,o,a)},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 n=new e.Vector3;return n.subVectors(this.v2,this.v1),n.multiplyScalar(t),n.add(this.v1),n}),e.QuadraticBezierCurve3=e.Curve.create(function(e,t,n){this.v0=e,this.v1=t,this.v2=n},function(t){var n=new e.Vector3;return n.x=e.Shape.Utils.b2(t,this.v0.x,this.v1.x,this.v2.x),n.y=e.Shape.Utils.b2(t,this.v0.y,this.v1.y,this.v2.y),n.z=e.Shape.Utils.b2(t,this.v0.z,this.v1.z,this.v2.z),n}),e.CubicBezierCurve3=e.Curve.create(function(e,t,n,r){this.v0=e,this.v1=t,this.v2=n,this.v3=r},function(t){var n=new e.Vector3;return n.x=e.Shape.Utils.b3(t,this.v0.x,this.v1.x,this.v2.x,this.v3.x),n.y=e.Shape.Utils.b3(t,this.v0.y,this.v1.y,this.v2.y,this.v3.y),n.z=e.Shape.Utils.b3(t,this.v0.z,this.v1.z,this.v2.z,this.v3.z),n}),e.SplineCurve3=e.Curve.create(function(e){this.points=void 0==e?[]:e},function(t){var n=this.points,r=(n.length-1)*t,i=Math.floor(r),o=r-i,a=n[0==i?i:i-1],s=n[i],u=n[i>n.length-2?n.length-1:i+1],c=n[i>n.length-3?n.length-1:i+2],l=new e.Vector3;return l.x=e.Curve.Utils.interpolate(a.x,s.x,u.x,c.x,o),l.y=e.Curve.Utils.interpolate(a.y,s.y,u.y,c.y,o),l.z=e.Curve.Utils.interpolate(a.z,s.z,u.z,c.z,o),l}),e.ClosedSplineCurve3=e.Curve.create(function(e){this.points=void 0==e?[]:e},function(t){var n=this.points,r=(n.length-0)*t,i=Math.floor(r),o=r-i;i+=i>0?0:(Math.floor(Math.abs(i)/n.length)+1)*n.length;var a=n[(i-1)%n.length],s=n[i%n.length],u=n[(i+1)%n.length],c=n[(i+2)%n.length],l=new e.Vector3;return l.x=e.Curve.Utils.interpolate(a.x,s.x,u.x,c.x,o),l.y=e.Curve.Utils.interpolate(a.y,s.y,u.y,c.y,o),l.z=e.Curve.Utils.interpolate(a.z,s.z,u.z,c.z,o),l}),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===!0)return t;for(var n=0;n<t.hierarchy.length;n++){for(var r=0;r<t.hierarchy[n].keys.length;r++)if(t.hierarchy[n].keys[r].time<0&&(t.hierarchy[n].keys[r].time=0),void 0!==t.hierarchy[n].keys[r].rot&&!(t.hierarchy[n].keys[r].rot instanceof e.Quaternion)){var i=t.hierarchy[n].keys[r].rot;t.hierarchy[n].keys[r].rot=(new e.Quaternion).fromArray(i)}if(t.hierarchy[n].keys.length&&void 0!==t.hierarchy[n].keys[0].morphTargets){for(var o={},r=0;r<t.hierarchy[n].keys.length;r++)for(var a=0;a<t.hierarchy[n].keys[r].morphTargets.length;a++){var s=t.hierarchy[n].keys[r].morphTargets[a];o[s]=-1}t.hierarchy[n].usedMorphTargets=o;for(var r=0;r<t.hierarchy[n].keys.length;r++){var u={};for(var s in o){for(var a=0;a<t.hierarchy[n].keys[r].morphTargets.length;a++)if(t.hierarchy[n].keys[r].morphTargets[a]===s){u[s]=t.hierarchy[n].keys[r].morphTargetsInfluences[a];break}a===t.hierarchy[n].keys[r].morphTargets.length&&(u[s]=0)}t.hierarchy[n].keys[r].morphTargetsInfluences=u}}for(var r=1;r<t.hierarchy[n].keys.length;r++)t.hierarchy[n].keys[r].time===t.hierarchy[n].keys[r-1].time&&(t.hierarchy[n].keys.splice(r,1),r--);for(var r=0;r<t.hierarchy[n].keys.length;r++)t.hierarchy[n].keys[r].index=r}return t.initialized=!0,t},parse:function(t){var n=function(e,t){t.push(e);for(var r=0;r<e.children.length;r++)n(e.children[r],t)},r=[];if(t instanceof e.SkinnedMesh)for(var i=0;i<t.skeleton.bones.length;i++)r.push(t.skeleton.bones[i]);else n(t,r);return r},play:function(e){-1===this.animations.indexOf(e)&&this.animations.push(e)},stop:function(e){var t=this.animations.indexOf(e);-1!==t&&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,n){this.root=t,this.data=e.AnimationHandler.init(n),this.hierarchy=e.AnimationHandler.parse(t),this.currentTime=0,this.timeScale=1,this.isPlaying=!1,this.loop=!0,this.weight=0,this.interpolationType=e.AnimationHandler.LINEAR},e.Animation.prototype={constructor:e.Animation,keyTypes:["pos","rot","scl"],play:function(t,n){this.currentTime=void 0!==t?t:0,this.weight=void 0!==n?n:1,this.isPlaying=!0,this.reset(),e.AnimationHandler.play(this)},stop:function(){this.isPlaying=!1,e.AnimationHandler.stop(this)},reset:function(){for(var e=0,t=this.hierarchy.length;t>e;e++){var n=this.hierarchy[e];void 0===n.animationCache&&(n.animationCache={animations:{},blending:{positionWeight:0,quaternionWeight:0,scaleWeight:0}});var r=this.data.name,i=n.animationCache.animations,o=i[r];void 0===o&&(o={prevKey:{pos:0,rot:0,scl:0},nextKey:{pos:0,rot:0,scl:0},originalMatrix:n.matrix},i[r]=o);for(var a=0;3>a;a++){for(var s=this.keyTypes[a],u=this.data.hierarchy[e].keys[0],c=this.getNextKeyWith(s,e,1);c.time<this.currentTime&&c.index>u.index;)u=c,c=this.getNextKeyWith(s,e,c.index+1);o.prevKey[s]=u,o.nextKey[s]=c}}},resetBlendWeights:function(){for(var e=0,t=this.hierarchy.length;t>e;e++){var n=this.hierarchy[e],r=n.animationCache;if(void 0!==r){var i=r.blending;i.positionWeight=0,i.quaternionWeight=0,i.scaleWeight=0}}},update:function(){var t=[],n=new e.Vector3,r=new e.Vector3,i=new e.Quaternion,o=function(e,t){var n,r,i,o,s,u,c,l,h,f=[],p=[];return n=(e.length-1)*t,r=Math.floor(n),i=n-r,f[0]=0===r?r:r-1,f[1]=r,f[2]=r>e.length-2?r:r+1,f[3]=r>e.length-3?r:r+2,u=e[f[0]],c=e[f[1]],l=e[f[2]],h=e[f[3]],o=i*i,s=i*o,p[0]=a(u[0],c[0],l[0],h[0],i,o,s),p[1]=a(u[1],c[1],l[1],h[1],i,o,s),p[2]=a(u[2],c[2],l[2],h[2],i,o,s),p},a=function(e,t,n,r,i,o,a){var s=.5*(n-e),u=.5*(r-t);return(2*(t-n)+s+u)*a+(-3*(t-n)-2*s-u)*o+s*i+t};return function(a){if(this.isPlaying!==!1&&(this.currentTime+=a*this.timeScale,0!==this.weight)){var s=this.data.length;(this.currentTime>s||this.currentTime<0)&&(this.loop?(this.currentTime%=s,this.currentTime<0&&(this.currentTime+=s),this.reset()):this.stop());for(var u=0,c=this.hierarchy.length;c>u;u++)for(var l=this.hierarchy[u],h=l.animationCache.animations[this.data.name],f=l.animationCache.blending,p=0;3>p;p++){var d=this.keyTypes[p],m=h.prevKey[d],v=h.nextKey[d];if(this.timeScale>0&&v.time<=this.currentTime||this.timeScale<0&&m.time>=this.currentTime){for(m=this.data.hierarchy[u].keys[0],v=this.getNextKeyWith(d,u,1);v.time<this.currentTime&&v.index>m.index;)m=v,v=this.getNextKeyWith(d,u,v.index+1);h.prevKey[d]=m,h.nextKey[d]=v}var g=(this.currentTime-m.time)/(v.time-m.time),y=m[d],b=v[d];if(0>g&&(g=0),g>1&&(g=1),"pos"===d){if(this.interpolationType===e.AnimationHandler.LINEAR){r.x=y[0]+(b[0]-y[0])*g,r.y=y[1]+(b[1]-y[1])*g,r.z=y[2]+(b[2]-y[2])*g;var x=this.weight/(this.weight+f.positionWeight);l.position.lerp(r,x),f.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]=y,t[2]=b,t[3]=this.getNextKeyWith("pos",u,v.index+1).pos,g=.33*g+.33;var w=o(t,g),x=this.weight/(this.weight+f.positionWeight);f.positionWeight+=this.weight;var _=l.position;if(_.x=_.x+(w[0]-_.x)*x,_.y=_.y+(w[1]-_.y)*x,_.z=_.z+(w[2]-_.z)*x,this.interpolationType===e.AnimationHandler.CATMULLROM_FORWARD){var C=o(t,1.01*g);n.set(C[0],C[1],C[2]),n.sub(_),n.y=0,n.normalize();var E=Math.atan2(n.x,n.z);l.rotation.set(0,E,0)}}}else if("rot"===d)if(e.Quaternion.slerp(y,b,i,g),0===f.quaternionWeight)l.quaternion.copy(i),f.quaternionWeight=this.weight;else{var x=this.weight/(this.weight+f.quaternionWeight);e.Quaternion.slerp(l.quaternion,i,l.quaternion,x),f.quaternionWeight+=this.weight}else if("scl"===d){r.x=y[0]+(b[0]-y[0])*g,r.y=y[1]+(b[1]-y[1])*g,r.z=y[2]+(b[2]-y[2])*g;var x=this.weight/(this.weight+f.scaleWeight);l.scale.lerp(r,x),f.scaleWeight+=this.weight}}return!0}}}(),getNextKeyWith:function(t,n,r){var i=this.data.hierarchy[n].keys;for(this.interpolationType===e.AnimationHandler.CATMULLROM||this.interpolationType===e.AnimationHandler.CATMULLROM_FORWARD?r=r<i.length-1?r:i.length-1:r%=i.length;r<i.length;r++)if(void 0!==i[r][t])return i[r];return this.data.hierarchy[n].keys[0]},getPrevKeyWith:function(t,n,r){var i=this.data.hierarchy[n].keys;for(r=this.interpolationType===e.AnimationHandler.CATMULLROM||this.interpolationType===e.AnimationHandler.CATMULLROM_FORWARD?r>0?r:0:r>=0?r:r+i.length;r>=0;r--)if(void 0!==i[r][t])return i[r];return this.data.hierarchy[n].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=!1,this.isPaused=!0,this.loop=!0;for(var n=0,r=this.hierarchy.length;r>n;n++){var i=this.data.hierarchy[n].keys,o=this.data.hierarchy[n].sids,a=this.hierarchy[n];if(i.length&&o){for(var s=0;s<o.length;s++){var u=o[s],c=this.getNextKeyWith(u,n,0);c&&c.apply(u)}a.matrixAutoUpdate=!1,this.data.hierarchy[n].node.updateMatrix(),a.matrixWorldNeedsUpdate=!0}}},e.KeyFrameAnimation.prototype={constructor:e.KeyFrameAnimation,play:function(t){if(this.currentTime=void 0!==t?t:0,this.isPlaying===!1){this.isPlaying=!0;var n,r,i,o=this.hierarchy.length;for(n=0;o>n;n++){r=this.hierarchy[n],i=this.data.hierarchy[n],void 0===i.animationCache&&(i.animationCache={},i.animationCache.prevKey=null,i.animationCache.nextKey=null,i.animationCache.originalMatrix=r.matrix);var a=this.data.hierarchy[n].keys;a.length&&(i.animationCache.prevKey=a[0],i.animationCache.nextKey=a[1],this.startTime=Math.min(a[0].time,this.startTime),this.endTime=Math.max(a[a.length-1].time,this.endTime))}this.update(0)}this.isPaused=!1,e.AnimationHandler.play(this)},stop:function(){this.isPlaying=!1,this.isPaused=!1,e.AnimationHandler.stop(this);for(var t=0;t<this.data.hierarchy.length;t++){var n=this.hierarchy[t],r=this.data.hierarchy[t];if(void 0!==r.animationCache){var i=r.animationCache.originalMatrix;i.copy(n.matrix),n.matrix=i,delete r.animationCache}}},update:function(e){if(this.isPlaying!==!1){this.currentTime+=e*this.timeScale;var t=this.data.length;this.loop===!0&&this.currentTime>t&&(this.currentTime%=t),this.currentTime=Math.min(this.currentTime,t);for(var n=0,r=this.hierarchy.length;r>n;n++){var i=this.hierarchy[n],o=this.data.hierarchy[n],a=o.keys,s=o.animationCache;if(a.length){var u=s.prevKey,c=s.nextKey;if(c.time<=this.currentTime){for(;c.time<this.currentTime&&c.index>u.index;)u=c,c=a[u.index+1];s.prevKey=u,s.nextKey=c}c.time>=this.currentTime?u.interpolate(c,this.currentTime):u.interpolate(c,c.time),this.data.hierarchy[n].node.updateMatrix(),i.matrixWorldNeedsUpdate=!0}}}},getNextKeyWith:function(e,t,n){var r=this.data.hierarchy[t].keys;for(n%=r.length;n<r.length;n++)if(r[n].hasTarget(e))return r[n];return r[0]},getPrevKeyWith:function(e,t,n){var r=this.data.hierarchy[t].keys;for(n=n>=0?n:n+r.length;n>=0;n--)if(r[n].hasTarget(e))return r[n];return r[r.length-1]}},e.MorphAnimation=function(e){this.mesh=e,this.frames=e.morphTargetInfluences.length,this.currentTime=0,this.duration=1e3,this.loop=!0,this.lastFrame=0,this.currentFrame=0,this.isPlaying=!1},e.MorphAnimation.prototype={constructor:e.MorphAnimation,play:function(){this.isPlaying=!0},pause:function(){this.isPlaying=!1},update:function(e){if(this.isPlaying!==!1){this.currentTime+=e,this.loop===!0&&this.currentTime>this.duration&&(this.currentTime%=this.duration),this.currentTime=Math.min(this.currentTime,this.duration);var t=this.duration/this.frames,n=Math.floor(this.currentTime/t),r=this.mesh.morphTargetInfluences;n!=this.currentFrame&&(r[this.lastFrame]=0,r[this.currentFrame]=1,r[n]=0,this.lastFrame=this.currentFrame,this.currentFrame=n),r[n]=this.currentTime%t/t,r[this.lastFrame]=1-r[n]}}},e.BoxGeometry=function(t,n,r,i,o,a){function s(t,n,r,i,o,a,s,c){var l,h,f,p=u.widthSegments,d=u.heightSegments,m=o/2,v=a/2,g=u.vertices.length;"x"===t&&"y"===n||"y"===t&&"x"===n?l="z":"x"===t&&"z"===n||"z"===t&&"x"===n?(l="y",d=u.depthSegments):("z"===t&&"y"===n||"y"===t&&"z"===n)&&(l="x",p=u.depthSegments);var y=p+1,b=d+1,x=o/p,w=a/d,_=new e.Vector3;for(_[l]=s>0?1:-1,f=0;b>f;f++)for(h=0;y>h;h++){var C=new e.Vector3;C[t]=(h*x-m)*r,C[n]=(f*w-v)*i,C[l]=s,u.vertices.push(C)}for(f=0;d>f;f++)for(h=0;p>h;h++){var E=h+y*f,S=h+y*(f+1),M=h+1+y*(f+1),T=h+1+y*f,A=new e.Vector2(h/p,1-f/d),P=new e.Vector2(h/p,1-(f+1)/d),k=new e.Vector2((h+1)/p,1-(f+1)/d),R=new e.Vector2((h+1)/p,1-f/d),I=new e.Face3(E+g,S+g,T+g);I.normal.copy(_),I.vertexNormals.push(_.clone(),_.clone(),_.clone()),I.materialIndex=c,u.faces.push(I),u.faceVertexUvs[0].push([A,P,R]),I=new e.Face3(S+g,M+g,T+g),I.normal.copy(_),I.vertexNormals.push(_.clone(),_.clone(),_.clone()),I.materialIndex=c,u.faces.push(I),u.faceVertexUvs[0].push([P.clone(),k,R.clone()])}}e.Geometry.call(this),this.type="BoxGeometry",this.parameters={width:t,height:n,depth:r,widthSegments:i,heightSegments:o,depthSegments:a},this.widthSegments=i||1,this.heightSegments=o||1,this.depthSegments=a||1;var u=this,c=t/2,l=n/2,h=r/2;s("z","y",-1,-1,r,n,c,0),s("z","y",1,-1,r,n,-c,1),s("x","z",1,1,t,r,l,2),s("x","z",1,-1,t,r,-l,3),s("x","y",1,-1,t,n,h,4),s("x","y",-1,-1,t,n,-h,5),this.mergeVertices()},e.BoxGeometry.prototype=Object.create(e.Geometry.prototype),e.BoxGeometry.prototype.constructor=e.BoxGeometry,e.CircleGeometry=function(t,n,r,i){e.Geometry.call(this),this.type="CircleGeometry",this.parameters={radius:t,segments:n,thetaStart:r,thetaLength:i},t=t||50,n=void 0!==n?Math.max(3,n):8,r=void 0!==r?r:0,i=void 0!==i?i:2*Math.PI;var o,a=[],s=new e.Vector3,u=new e.Vector2(.5,.5);for(this.vertices.push(s),a.push(u),o=0;n>=o;o++){var c=new e.Vector3,l=r+o/n*i;c.x=t*Math.cos(l),c.y=t*Math.sin(l),this.vertices.push(c),a.push(new e.Vector2((c.x/t+1)/2,(c.y/t+1)/2))}var h=new e.Vector3(0,0,1);for(o=1;n>=o;o++)this.faces.push(new e.Face3(o,o+1,0,[h.clone(),h.clone(),h.clone()])),this.faceVertexUvs[0].push([a[o].clone(),a[o+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,n,r,i,o,a){return e.warn("THREE.CubeGeometry has been renamed to THREE.BoxGeometry."),new e.BoxGeometry(t,n,r,i,o,a)},e.CylinderGeometry=function(t,n,r,i,o,a,s,u){e.Geometry.call(this),this.type="CylinderGeometry",this.parameters={radiusTop:t,radiusBottom:n,height:r,radialSegments:i,heightSegments:o,openEnded:a,thetaStart:s,thetaLength:u},t=void 0!==t?t:20,n=void 0!==n?n:20,r=void 0!==r?r:100,i=i||8,o=o||1,a=void 0!==a?a:!1,s=void 0!==s?s:0,u=void 0!==u?u:2*Math.PI;var c,l,h=r/2,f=[],p=[];for(l=0;o>=l;l++){var d=[],m=[],v=l/o,g=v*(n-t)+t;for(c=0;i>=c;c++){var y=c/i,b=new e.Vector3;b.x=g*Math.sin(y*u+s),b.y=-v*r+h,b.z=g*Math.cos(y*u+s),this.vertices.push(b),d.push(this.vertices.length-1),m.push(new e.Vector2(y,1-v))}f.push(d),p.push(m)}var x,w,_=(n-t)/r;for(c=0;i>c;c++)for(0!==t?(x=this.vertices[f[0][c]].clone(),w=this.vertices[f[0][c+1]].clone()):(x=this.vertices[f[1][c]].clone(),w=this.vertices[f[1][c+1]].clone()),x.setY(Math.sqrt(x.x*x.x+x.z*x.z)*_).normalize(),w.setY(Math.sqrt(w.x*w.x+w.z*w.z)*_).normalize(),l=0;o>l;l++){var C=f[l][c],E=f[l+1][c],S=f[l+1][c+1],M=f[l][c+1],T=x.clone(),A=x.clone(),P=w.clone(),k=w.clone(),R=p[l][c].clone(),I=p[l+1][c].clone(),D=p[l+1][c+1].clone(),B=p[l][c+1].clone();this.faces.push(new e.Face3(C,E,M,[T,A,k])),this.faceVertexUvs[0].push([R,I,B]),this.faces.push(new e.Face3(E,S,M,[A.clone(),P,k.clone()])),this.faceVertexUvs[0].push([I.clone(),D,B.clone()])}if(a===!1&&t>0)for(this.vertices.push(new e.Vector3(0,h,0)),c=0;i>c;c++){var C=f[0][c],E=f[0][c+1],S=this.vertices.length-1,T=new e.Vector3(0,1,0),A=new e.Vector3(0,1,0),P=new e.Vector3(0,1,0),R=p[0][c].clone(),I=p[0][c+1].clone(),D=new e.Vector2(I.x,0);this.faces.push(new e.Face3(C,E,S,[T,A,P])),this.faceVertexUvs[0].push([R,I,D])}if(a===!1&&n>0)for(this.vertices.push(new e.Vector3(0,-h,0)),c=0;i>c;c++){var C=f[o][c+1],E=f[o][c],S=this.vertices.length-1,T=new e.Vector3(0,-1,0),A=new e.Vector3(0,-1,0),P=new e.Vector3(0,-1,0),R=p[o][c+1].clone(),I=p[o][c].clone(),D=new e.Vector2(I.x,1);this.faces.push(new e.Face3(C,E,S,[T,A,P])),this.faceVertexUvs[0].push([R,I,D])}this.computeFaceNormals()},e.CylinderGeometry.prototype=Object.create(e.Geometry.prototype),e.CylinderGeometry.prototype.constructor=e.CylinderGeometry,e.ExtrudeGeometry=function(t,n){return"undefined"==typeof t?(t=[],void 0):(e.Geometry.call(this),this.type="ExtrudeGeometry",t=t instanceof Array?t:[t],this.addShapeList(t,n),this.computeFaceNormals(),void 0)},e.ExtrudeGeometry.prototype=Object.create(e.Geometry.prototype),e.ExtrudeGeometry.prototype.constructor=e.ExtrudeGeometry,e.ExtrudeGeometry.prototype.addShapeList=function(e,t){for(var n=e.length,r=0;n>r;r++){var i=e[r];this.addShape(i,t)}},e.ExtrudeGeometry.prototype.addShape=function(t,n){function r(t,n,r){return n||e.error("THREE.ExtrudeGeometry: vec does not exist"),n.clone().multiplyScalar(r).add(t)}function i(t,n,r){var i,o,a=1e-10,s=1,u=t.x-n.x,c=t.y-n.y,l=r.x-t.x,h=r.y-t.y,f=u*u+c*c,p=u*h-c*l;if(Math.abs(p)>a){var d=Math.sqrt(f),m=Math.sqrt(l*l+h*h),v=n.x-c/d,g=n.y+u/d,y=r.x-h/m,b=r.y+l/m,x=((y-v)*h-(b-g)*l)/(u*h-c*l);i=v+u*x-t.x,o=g+c*x-t.y;var w=i*i+o*o;if(2>=w)return new e.Vector2(i,o);s=Math.sqrt(w/2)}else{var _=!1;u>a?l>a&&(_=!0):-a>u?-a>l&&(_=!0):Math.sign(c)==Math.sign(h)&&(_=!0),_?(i=-c,o=u,s=Math.sqrt(f)):(i=u,o=c,s=Math.sqrt(f/2))}return new e.Vector2(i/s,o/s)}function o(){if(x){var e=0,t=G*e;for(X=0;W>X;X++)j=N[X],c(j[2]+t,j[1]+t,j[0]+t);for(e=_+2*b,t=G*e,X=0;W>X;X++)j=N[X],c(j[0]+t,j[1]+t,j[2]+t)}else{for(X=0;W>X;X++)j=N[X],c(j[2],j[1],j[0]);for(X=0;W>X;X++)j=N[X],c(j[0]+G*_,j[1]+G*_,j[2]+G*_)}}function a(){var e=0;for(s(O,e),e+=O.length,P=0,k=V.length;k>P;P++)A=V[P],s(A,e),e+=A.length}function s(e,t){var n,r;for(X=e.length;--X>=0;){n=X,r=X-1,0>r&&(r=e.length-1);var i=0,o=_+2*b;for(i=0;o>i;i++){var a=G*i,s=G*(i+1),u=t+n+a,c=t+r+a,h=t+r+s,f=t+n+s;l(u,c,h,f,e,i,o,n,r)}}}function u(t,n,r){R.vertices.push(new e.Vector3(t,n,r))}function c(t,n,r){t+=I,n+=I,r+=I,R.faces.push(new e.Face3(t,n,r,null,null,S));var i=T.generateTopUV(R,t,n,r);R.faceVertexUvs[0].push(i)}function l(t,n,r,i){t+=I,n+=I,r+=I,i+=I,R.faces.push(new e.Face3(t,n,i,null,null,M)),R.faces.push(new e.Face3(n,r,i,null,null,M));var o=T.generateSideWallUV(R,t,n,r,i);R.faceVertexUvs[0].push([o[0],o[1],o[3]]),R.faceVertexUvs[0].push([o[1],o[2],o[3]])}var h,f,p,d,m,v=void 0!==n.amount?n.amount:100,g=void 0!==n.bevelThickness?n.bevelThickness:6,y=void 0!==n.bevelSize?n.bevelSize:g-2,b=void 0!==n.bevelSegments?n.bevelSegments:3,x=void 0!==n.bevelEnabled?n.bevelEnabled:!0,w=void 0!==n.curveSegments?n.curveSegments:12,_=void 0!==n.steps?n.steps:1,C=n.extrudePath,E=!1,S=n.material,M=n.extrudeMaterial,T=void 0!==n.UVGenerator?n.UVGenerator:e.ExtrudeGeometry.WorldUVGenerator;C&&(h=C.getSpacedPoints(_),E=!0,x=!1,f=void 0!==n.frames?n.frames:new e.TubeGeometry.FrenetFrames(C,_,!1),p=new e.Vector3,d=new e.Vector3,m=new e.Vector3),x||(b=0,g=0,y=0);var A,P,k,R=this,I=this.vertices.length,D=t.extractPoints(w),B=D.shape,V=D.holes,L=!e.Shape.Utils.isClockWise(B);if(L){for(B=B.reverse(),P=0,k=V.length;k>P;P++)A=V[P],e.Shape.Utils.isClockWise(A)&&(V[P]=A.reverse());L=!1}var N=e.Shape.Utils.triangulateShape(B,V),O=B;for(P=0,k=V.length;k>P;P++)A=V[P],B=B.concat(A);for(var F,U,z,$,H,j,G=B.length,W=N.length,q=[],X=0,Y=O.length,K=Y-1,Q=X+1;Y>X;X++,K++,Q++)K===Y&&(K=0),Q===Y&&(Q=0),q[X]=i(O[X],O[K],O[Q]);var Z,J=[],et=q.concat();for(P=0,k=V.length;k>P;P++){for(A=V[P],Z=[],X=0,Y=A.length,K=Y-1,Q=X+1;Y>X;X++,K++,Q++)K===Y&&(K=0),Q===Y&&(Q=0),Z[X]=i(A[X],A[K],A[Q]);J.push(Z),et=et.concat(Z)}for(F=0;b>F;F++){for(z=F/b,$=g*(1-z),U=y*Math.sin(z*Math.PI/2),X=0,Y=O.length;Y>X;X++)H=r(O[X],q[X],U),u(H.x,H.y,-$);for(P=0,k=V.length;k>P;P++)for(A=V[P],Z=J[P],X=0,Y=A.length;Y>X;X++)H=r(A[X],Z[X],U),u(H.x,H.y,-$)}for(U=y,X=0;G>X;X++)H=x?r(B[X],et[X],U):B[X],E?(d.copy(f.normals[0]).multiplyScalar(H.x),p.copy(f.binormals[0]).multiplyScalar(H.y),m.copy(h[0]).add(d).add(p),u(m.x,m.y,m.z)):u(H.x,H.y,0);var tt;for(tt=1;_>=tt;tt++)for(X=0;G>X;X++)H=x?r(B[X],et[X],U):B[X],E?(d.copy(f.normals[tt]).multiplyScalar(H.x),p.copy(f.binormals[tt]).multiplyScalar(H.y),m.copy(h[tt]).add(d).add(p),u(m.x,m.y,m.z)):u(H.x,H.y,v/_*tt);for(F=b-1;F>=0;F--){for(z=F/b,$=g*(1-z),U=y*Math.sin(z*Math.PI/2),X=0,Y=O.length;Y>X;X++)H=r(O[X],q[X],U),u(H.x,H.y,v+$);for(P=0,k=V.length;k>P;P++)for(A=V[P],Z=J[P],X=0,Y=A.length;Y>X;X++)H=r(A[X],Z[X],U),E?u(H.x,H.y+h[_-1].y,h[_-1].x+$):u(H.x,H.y,v+$)}o(),a()},e.ExtrudeGeometry.WorldUVGenerator={generateTopUV:function(t,n,r,i){var o=t.vertices,a=o[n],s=o[r],u=o[i];return[new e.Vector2(a.x,a.y),new e.Vector2(s.x,s.y),new e.Vector2(u.x,u.y)]},generateSideWallUV:function(t,n,r,i,o){var a=t.vertices,s=a[n],u=a[r],c=a[i],l=a[o];return Math.abs(s.y-u.y)<.01?[new e.Vector2(s.x,1-s.z),new e.Vector2(u.x,1-u.z),new e.Vector2(c.x,1-c.z),new e.Vector2(l.x,1-l.z)]:[new e.Vector2(s.y,1-s.z),new e.Vector2(u.y,1-u.z),new e.Vector2(c.y,1-c.z),new e.Vector2(l.y,1-l.z)]}},e.ShapeGeometry=function(t,n){e.Geometry.call(this),this.type="ShapeGeometry",t instanceof Array==!1&&(t=[t]),this.addShapeList(t,n),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 n=0,r=e.length;r>n;n++)this.addShape(e[n],t);return this},e.ShapeGeometry.prototype.addShape=function(t,n){void 0===n&&(n={});var r,i,o,a=void 0!==n.curveSegments?n.curveSegments:12,s=n.material,u=void 0===n.UVGenerator?e.ExtrudeGeometry.WorldUVGenerator:n.UVGenerator,c=this.vertices.length,l=t.extractPoints(a),h=l.shape,f=l.holes,p=!e.Shape.Utils.isClockWise(h);if(p){for(h=h.reverse(),r=0,i=f.length;i>r;r++)o=f[r],e.Shape.Utils.isClockWise(o)&&(f[r]=o.reverse());p=!1}var d=e.Shape.Utils.triangulateShape(h,f);for(r=0,i=f.length;i>r;r++)o=f[r],h=h.concat(o);var m,v,g=h.length,y=d.length;for(r=0;g>r;r++)m=h[r],this.vertices.push(new e.Vector3(m.x,m.y,0));for(r=0;y>r;r++){v=d[r];var b=v[0]+c,x=v[1]+c,w=v[2]+c;this.faces.push(new e.Face3(b,x,w,null,null,s)),this.faceVertexUvs[0].push(u.generateTopUV(this,b,x,w))}},e.LatheGeometry=function(t,n,r,i){e.Geometry.call(this),this.type="LatheGeometry",this.parameters={points:t,segments:n,phiStart:r,phiLength:i},n=n||12,r=r||0,i=i||2*Math.PI;for(var o=1/(t.length-1),a=1/n,s=0,u=n;u>=s;s++)for(var c=r+s*a*i,l=Math.cos(c),h=Math.sin(c),f=0,p=t.length;p>f;f++){var d=t[f],m=new e.Vector3;m.x=l*d.x-h*d.y,m.y=h*d.x+l*d.y,m.z=d.z,this.vertices.push(m)}for(var v=t.length,s=0,u=n;u>s;s++)for(var f=0,p=t.length-1;p>f;f++){var g=f+v*s,y=g,b=g+v,l=g+1+v,x=g+1,w=s*a,_=f*o,C=w+a,E=_+o;this.faces.push(new e.Face3(y,b,x)),this.faceVertexUvs[0].push([new e.Vector2(w,_),new e.Vector2(C,_),new e.Vector2(w,E)]),this.faces.push(new e.Face3(b,l,x)),this.faceVertexUvs[0].push([new e.Vector2(C,_),new e.Vector2(C,E),new e.Vector2(w,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,n,r,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:n,widthSegments:r,heightSegments:i},this.fromBufferGeometry(new e.PlaneBufferGeometry(t,n,r,i))},e.PlaneGeometry.prototype=Object.create(e.Geometry.prototype),e.PlaneGeometry.prototype.constructor=e.PlaneGeometry,e.PlaneBufferGeometry=function(t,n,r,i){e.BufferGeometry.call(this),this.type="PlaneBufferGeometry",this.parameters={width:t,height:n,widthSegments:r,heightSegments:i};
for(var o=t/2,a=n/2,s=r||1,u=i||1,c=s+1,l=u+1,h=t/s,f=n/u,p=new Float32Array(c*l*3),d=new Float32Array(c*l*3),m=new Float32Array(c*l*2),v=0,g=0,y=0;l>y;y++)for(var b=y*f-a,x=0;c>x;x++){var w=x*h-o;p[v]=w,p[v+1]=-b,d[v+2]=1,m[g]=x/s,m[g+1]=1-y/u,v+=3,g+=2}v=0;for(var _=new(p.length/3>65535?Uint32Array:Uint16Array)(s*u*6),y=0;u>y;y++)for(var x=0;s>x;x++){var C=x+c*y,E=x+c*(y+1),S=x+1+c*(y+1),M=x+1+c*y;_[v]=C,_[v+1]=E,_[v+2]=M,_[v+3]=E,_[v+4]=S,_[v+5]=M,v+=6}this.addAttribute("index",new e.BufferAttribute(_,1)),this.addAttribute("position",new e.BufferAttribute(p,3)),this.addAttribute("normal",new e.BufferAttribute(d,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,n,r,i,o,a){e.Geometry.call(this),this.type="RingGeometry",this.parameters={innerRadius:t,outerRadius:n,thetaSegments:r,phiSegments:i,thetaStart:o,thetaLength:a},t=t||0,n=n||50,o=void 0!==o?o:0,a=void 0!==a?a:2*Math.PI,r=void 0!==r?Math.max(3,r):8,i=void 0!==i?Math.max(1,i):8;var s,u,c=[],l=t,h=(n-t)/i;for(s=0;i+1>s;s++){for(u=0;r+1>u;u++){var f=new e.Vector3,p=o+u/r*a;f.x=l*Math.cos(p),f.y=l*Math.sin(p),this.vertices.push(f),c.push(new e.Vector2((f.x/n+1)/2,(f.y/n+1)/2))}l+=h}var d=new e.Vector3(0,0,1);for(s=0;i>s;s++){var m=s*(r+1);for(u=0;r>u;u++){var p=u+m,v=p,g=p+r+1,y=p+r+2;this.faces.push(new e.Face3(v,g,y,[d.clone(),d.clone(),d.clone()])),this.faceVertexUvs[0].push([c[v].clone(),c[g].clone(),c[y].clone()]),v=p,g=p+r+2,y=p+1,this.faces.push(new e.Face3(v,g,y,[d.clone(),d.clone(),d.clone()])),this.faceVertexUvs[0].push([c[v].clone(),c[g].clone(),c[y].clone()])}}this.computeFaceNormals(),this.boundingSphere=new e.Sphere(new e.Vector3,l)},e.RingGeometry.prototype=Object.create(e.Geometry.prototype),e.RingGeometry.prototype.constructor=e.RingGeometry,e.SphereGeometry=function(t,n,r,i,o,a,s){e.Geometry.call(this),this.type="SphereGeometry",this.parameters={radius:t,widthSegments:n,heightSegments:r,phiStart:i,phiLength:o,thetaStart:a,thetaLength:s},t=t||50,n=Math.max(3,Math.floor(n)||8),r=Math.max(2,Math.floor(r)||6),i=void 0!==i?i:0,o=void 0!==o?o:2*Math.PI,a=void 0!==a?a:0,s=void 0!==s?s:Math.PI;var u,c,l=[],h=[];for(c=0;r>=c;c++){var f=[],p=[];for(u=0;n>=u;u++){var d=u/n,m=c/r,v=new e.Vector3;v.x=-t*Math.cos(i+d*o)*Math.sin(a+m*s),v.y=t*Math.cos(a+m*s),v.z=t*Math.sin(i+d*o)*Math.sin(a+m*s),this.vertices.push(v),f.push(this.vertices.length-1),p.push(new e.Vector2(d,1-m))}l.push(f),h.push(p)}for(c=0;r>c;c++)for(u=0;n>u;u++){var g=l[c][u+1],y=l[c][u],b=l[c+1][u],x=l[c+1][u+1],w=this.vertices[g].clone().normalize(),_=this.vertices[y].clone().normalize(),C=this.vertices[b].clone().normalize(),E=this.vertices[x].clone().normalize(),S=h[c][u+1].clone(),M=h[c][u].clone(),T=h[c+1][u].clone(),A=h[c+1][u+1].clone();Math.abs(this.vertices[g].y)===t?(S.x=(S.x+M.x)/2,this.faces.push(new e.Face3(g,b,x,[w,C,E])),this.faceVertexUvs[0].push([S,T,A])):Math.abs(this.vertices[b].y)===t?(T.x=(T.x+A.x)/2,this.faces.push(new e.Face3(g,y,b,[w,_,C])),this.faceVertexUvs[0].push([S,M,T])):(this.faces.push(new e.Face3(g,y,x,[w,_,E])),this.faceVertexUvs[0].push([S,M,A]),this.faces.push(new e.Face3(y,b,x,[_.clone(),C,E.clone()])),this.faceVertexUvs[0].push([M.clone(),T,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,n){n=n||{};var r=e.FontUtils.generateShapes(t,n);n.amount=void 0!==n.height?n.height:50,void 0===n.bevelThickness&&(n.bevelThickness=10),void 0===n.bevelSize&&(n.bevelSize=8),void 0===n.bevelEnabled&&(n.bevelEnabled=!1),e.ExtrudeGeometry.call(this,r,n),this.type="TextGeometry"},e.TextGeometry.prototype=Object.create(e.ExtrudeGeometry.prototype),e.TextGeometry.prototype.constructor=e.TextGeometry,e.TorusGeometry=function(t,n,r,i,o){e.Geometry.call(this),this.type="TorusGeometry",this.parameters={radius:t,tube:n,radialSegments:r,tubularSegments:i,arc:o},t=t||100,n=n||40,r=r||8,i=i||6,o=o||2*Math.PI;for(var a=new e.Vector3,s=[],u=[],c=0;r>=c;c++)for(var l=0;i>=l;l++){var h=l/i*o,f=c/r*Math.PI*2;a.x=t*Math.cos(h),a.y=t*Math.sin(h);var p=new e.Vector3;p.x=(t+n*Math.cos(f))*Math.cos(h),p.y=(t+n*Math.cos(f))*Math.sin(h),p.z=n*Math.sin(f),this.vertices.push(p),s.push(new e.Vector2(l/i,c/r)),u.push(p.clone().sub(a).normalize())}for(var c=1;r>=c;c++)for(var l=1;i>=l;l++){var d=(i+1)*c+l-1,m=(i+1)*(c-1)+l-1,v=(i+1)*(c-1)+l,g=(i+1)*c+l,y=new e.Face3(d,m,g,[u[d].clone(),u[m].clone(),u[g].clone()]);this.faces.push(y),this.faceVertexUvs[0].push([s[d].clone(),s[m].clone(),s[g].clone()]),y=new e.Face3(m,v,g,[u[m].clone(),u[v].clone(),u[g].clone()]),this.faces.push(y),this.faceVertexUvs[0].push([s[m].clone(),s[v].clone(),s[g].clone()])}this.computeFaceNormals()},e.TorusGeometry.prototype=Object.create(e.Geometry.prototype),e.TorusGeometry.prototype.constructor=e.TorusGeometry,e.TorusKnotGeometry=function(t,n,r,i,o,a,s){function u(t,n,r,i,o){var a=Math.cos(t),s=Math.sin(t),u=n/r*t,c=Math.cos(u),l=i*(2+c)*.5*a,h=i*(2+c)*s*.5,f=o*i*Math.sin(u)*.5;return new e.Vector3(l,h,f)}e.Geometry.call(this),this.type="TorusKnotGeometry",this.parameters={radius:t,tube:n,radialSegments:r,tubularSegments:i,p:o,q:a,heightScale:s},t=t||100,n=n||40,r=r||64,i=i||8,o=o||2,a=a||3,s=s||1;for(var c=new Array(r),l=new e.Vector3,h=new e.Vector3,f=new e.Vector3,p=0;r>p;++p){c[p]=new Array(i);var d=p/r*2*o*Math.PI,m=u(d,a,o,t,s),v=u(d+.01,a,o,t,s);l.subVectors(v,m),h.addVectors(v,m),f.crossVectors(l,h),h.crossVectors(f,l),f.normalize(),h.normalize();for(var g=0;i>g;++g){var y=g/i*2*Math.PI,b=-n*Math.cos(y),x=n*Math.sin(y),w=new e.Vector3;w.x=m.x+b*h.x+x*f.x,w.y=m.y+b*h.y+x*f.y,w.z=m.z+b*h.z+x*f.z,c[p][g]=this.vertices.push(w)-1}}for(var p=0;r>p;++p)for(var g=0;i>g;++g){var _=(p+1)%r,C=(g+1)%i,E=c[p][g],S=c[_][g],M=c[_][C],T=c[p][C],A=new e.Vector2(p/r,g/i),P=new e.Vector2((p+1)/r,g/i),k=new e.Vector2((p+1)/r,(g+1)/i),R=new e.Vector2(p/r,(g+1)/i);this.faces.push(new e.Face3(E,S,T)),this.faceVertexUvs[0].push([A,P,R]),this.faces.push(new e.Face3(S,M,T)),this.faceVertexUvs[0].push([P.clone(),k,R.clone()])}this.computeFaceNormals(),this.computeVertexNormals()},e.TorusKnotGeometry.prototype=Object.create(e.Geometry.prototype),e.TorusKnotGeometry.prototype.constructor=e.TorusKnotGeometry,e.TubeGeometry=function(t,n,r,i,o,a){function s(t,n,r){return k.vertices.push(new e.Vector3(t,n,r))-1}e.Geometry.call(this),this.type="TubeGeometry",this.parameters={path:t,segments:n,radius:r,radialSegments:i,closed:o},n=n||64,r=r||1,i=i||8,o=o||!1,a=a||e.TubeGeometry.NoTaper;var u,c,l,h,f,p,d,m,v,g,y,b,x,w,_,C,E,S,M,T,A,P=[],k=this,R=n+1,I=new e.Vector3,D=new e.TubeGeometry.FrenetFrames(t,n,o),B=D.tangents,V=D.normals,L=D.binormals;for(this.tangents=B,this.normals=V,this.binormals=L,g=0;R>g;g++)for(P[g]=[],h=g/(R-1),v=t.getPointAt(h),u=B[g],c=V[g],l=L[g],p=r*a(h),y=0;i>y;y++)f=y/i*2*Math.PI,d=-p*Math.cos(f),m=p*Math.sin(f),I.copy(v),I.x+=d*c.x+m*l.x,I.y+=d*c.y+m*l.y,I.z+=d*c.z+m*l.z,P[g][y]=s(I.x,I.y,I.z);for(g=0;n>g;g++)for(y=0;i>y;y++)b=o?(g+1)%n:g+1,x=(y+1)%i,w=P[g][y],_=P[b][y],C=P[b][x],E=P[g][x],S=new e.Vector2(g/n,y/i),M=new e.Vector2((g+1)/n,y/i),T=new e.Vector2((g+1)/n,(y+1)/i),A=new e.Vector2(g/n,(y+1)/i),this.faces.push(new e.Face3(w,_,E)),this.faceVertexUvs[0].push([S,M,A]),this.faces.push(new e.Face3(_,C,E)),this.faceVertexUvs[0].push([M.clone(),T,A.clone()]);this.computeFaceNormals(),this.computeVertexNormals()},e.TubeGeometry.prototype=Object.create(e.Geometry.prototype),e.TubeGeometry.prototype.constructor=e.TubeGeometry,e.TubeGeometry.NoTaper=function(){return 1},e.TubeGeometry.SinusoidalTaper=function(e){return Math.sin(Math.PI*e)},e.TubeGeometry.FrenetFrames=function(t,n,r){function i(){d[0]=new e.Vector3,m[0]=new e.Vector3,a=Number.MAX_VALUE,s=Math.abs(p[0].x),u=Math.abs(p[0].y),c=Math.abs(p[0].z),a>=s&&(a=s,f.set(1,0,0)),a>=u&&(a=u,f.set(0,1,0)),a>=c&&f.set(0,0,1),v.crossVectors(p[0],f).normalize(),d[0].crossVectors(p[0],v),m[0].crossVectors(p[0],d[0])}var o,a,s,u,c,l,h,f=new e.Vector3,p=[],d=[],m=[],v=new e.Vector3,g=new e.Matrix4,y=n+1,b=1e-4;for(this.tangents=p,this.normals=d,this.binormals=m,l=0;y>l;l++)h=l/(y-1),p[l]=t.getTangentAt(h),p[l].normalize();for(i(),l=1;y>l;l++)d[l]=d[l-1].clone(),m[l]=m[l-1].clone(),v.crossVectors(p[l-1],p[l]),v.length()>b&&(v.normalize(),o=Math.acos(e.Math.clamp(p[l-1].dot(p[l]),-1,1)),d[l].applyMatrix4(g.makeRotationAxis(v,o))),m[l].crossVectors(p[l],d[l]);if(r)for(o=Math.acos(e.Math.clamp(d[0].dot(d[y-1]),-1,1)),o/=y-1,p[0].dot(v.crossVectors(d[0],d[y-1]))>0&&(o=-o),l=1;y>l;l++)d[l].applyMatrix4(g.makeRotationAxis(p[l],o*l)),m[l].crossVectors(p[l],d[l])},e.PolyhedronGeometry=function(t,n,r,i){function o(t){var n=t.normalize().clone();n.index=h.vertices.push(n)-1;var r=u(t)/2/Math.PI+.5,i=c(t)/Math.PI+.5;return n.uv=new e.Vector2(r,1-i),n}function a(t,n,r){var i=new e.Face3(t.index,n.index,r.index,[t.clone(),n.clone(),r.clone()]);h.faces.push(i),x.copy(t).add(n).add(r).divideScalar(3);var o=u(x);h.faceVertexUvs[0].push([l(t.uv,t,o),l(n.uv,n,o),l(r.uv,r,o)])}function s(e,t){for(var n=Math.pow(2,t),r=o(h.vertices[e.a]),i=o(h.vertices[e.b]),s=o(h.vertices[e.c]),u=[],c=0;n>=c;c++){u[c]=[];for(var l=o(r.clone().lerp(s,c/n)),f=o(i.clone().lerp(s,c/n)),p=n-c,d=0;p>=d;d++)u[c][d]=0==d&&c==n?l:o(l.clone().lerp(f,d/p))}for(var c=0;n>c;c++)for(var d=0;2*(n-c)-1>d;d++){var m=Math.floor(d/2);d%2==0?a(u[c][m+1],u[c+1][m],u[c][m]):a(u[c][m+1],u[c+1][m+1],u[c+1][m])}}function u(e){return Math.atan2(e.z,-e.x)}function c(e){return Math.atan2(-e.y,Math.sqrt(e.x*e.x+e.z*e.z))}function l(t,n,r){return 0>r&&1===t.x&&(t=new e.Vector2(t.x-1,t.y)),0===n.x&&0===n.z&&(t=new e.Vector2(r/2/Math.PI+.5,t.y)),t.clone()}e.Geometry.call(this),this.type="PolyhedronGeometry",this.parameters={vertices:t,indices:n,radius:r,detail:i},r=r||1,i=i||0;for(var h=this,f=0,p=t.length;p>f;f+=3)o(new e.Vector3(t[f],t[f+1],t[f+2]));for(var d=this.vertices,m=[],f=0,v=0,p=n.length;p>f;f+=3,v++){var g=d[n[f]],y=d[n[f+1]],b=d[n[f+2]];m[v]=new e.Face3(g.index,y.index,b.index,[g.clone(),y.clone(),b.clone()])}for(var x=new e.Vector3,f=0,p=m.length;p>f;f++)s(m[f],i);for(var f=0,p=this.faceVertexUvs[0].length;p>f;f++){var w=this.faceVertexUvs[0][f],_=w[0].x,C=w[1].x,E=w[2].x,S=Math.max(_,Math.max(C,E)),M=Math.min(_,Math.min(C,E));S>.9&&.1>M&&(.2>_&&(w[0].x+=1),.2>C&&(w[1].x+=1),.2>E&&(w[2].x+=1))}for(var f=0,p=this.vertices.length;p>f;f++)this.vertices[f].multiplyScalar(r);this.mergeVertices(),this.computeFaceNormals(),this.boundingSphere=new e.Sphere(new e.Vector3,r)},e.PolyhedronGeometry.prototype=Object.create(e.Geometry.prototype),e.PolyhedronGeometry.prototype.constructor=e.PolyhedronGeometry,e.DodecahedronGeometry=function(t,n){this.parameters={radius:t,detail:n};var r=(1+Math.sqrt(5))/2,i=1/r,o=[-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,-r,0,-i,r,0,i,-r,0,i,r,-i,-r,0,-i,r,0,i,-r,0,i,r,0,-r,0,-i,r,0,-i,-r,0,i,r,0,i],a=[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1,18,0,18,16,6,10,2,6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,11,19,7,19,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9];e.PolyhedronGeometry.call(this,o,a,t,n)},e.DodecahedronGeometry.prototype=Object.create(e.Geometry.prototype),e.DodecahedronGeometry.prototype.constructor=e.DodecahedronGeometry,e.IcosahedronGeometry=function(t,n){var r=(1+Math.sqrt(5))/2,i=[-1,r,0,1,r,0,-1,-r,0,1,-r,0,0,-1,r,0,1,r,0,-1,-r,0,1,-r,r,0,-1,r,0,1,-r,0,-1,-r,0,1],o=[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,o,t,n),this.type="IcosahedronGeometry",this.parameters={radius:t,detail:n}},e.IcosahedronGeometry.prototype=Object.create(e.Geometry.prototype),e.IcosahedronGeometry.prototype.constructor=e.IcosahedronGeometry,e.OctahedronGeometry=function(t,n){this.parameters={radius:t,detail:n};var r=[1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],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,r,i,t,n),this.type="OctahedronGeometry",this.parameters={radius:t,detail:n}},e.OctahedronGeometry.prototype=Object.create(e.Geometry.prototype),e.OctahedronGeometry.prototype.constructor=e.OctahedronGeometry,e.TetrahedronGeometry=function(t,n){var r=[1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],i=[2,1,0,0,3,2,1,3,0,2,3,1];e.PolyhedronGeometry.call(this,r,i,t,n),this.type="TetrahedronGeometry",this.parameters={radius:t,detail:n}},e.TetrahedronGeometry.prototype=Object.create(e.Geometry.prototype),e.TetrahedronGeometry.prototype.constructor=e.TetrahedronGeometry,e.ParametricGeometry=function(t,n,r){e.Geometry.call(this),this.type="ParametricGeometry",this.parameters={func:t,slices:n,stacks:r};var i,o,a,s,u,c=this.vertices,l=this.faces,h=this.faceVertexUvs[0],f=n+1;for(i=0;r>=i;i++)for(u=i/r,o=0;n>=o;o++)s=o/n,a=t(s,u),c.push(a);var p,d,m,v,g,y,b,x;for(i=0;r>i;i++)for(o=0;n>o;o++)p=i*f+o,d=i*f+o+1,m=(i+1)*f+o+1,v=(i+1)*f+o,g=new e.Vector2(o/n,i/r),y=new e.Vector2((o+1)/n,i/r),b=new e.Vector2((o+1)/n,(i+1)/r),x=new e.Vector2(o/n,(i+1)/r),l.push(new e.Face3(p,d,v)),h.push([g,y,x]),l.push(new e.Face3(d,m,v)),h.push([y.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 n=new Float32Array([0,0,0,t,0,0,0,0,0,0,t,0,0,0,0,0,0,t]),r=new Float32Array([1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1]),i=new e.BufferGeometry;i.addAttribute("position",new e.BufferAttribute(n,3)),i.addAttribute("color",new e.BufferAttribute(r,3));var o=new e.LineBasicMaterial({vertexColors:e.VertexColors});e.Line.call(this,i,o,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 n=new e.CylinderGeometry(0,.5,1,5,1);return n.applyMatrix((new e.Matrix4).makeTranslation(0,-.5,0)),function(r,i,o,a,s,u){e.Object3D.call(this),void 0===a&&(a=16776960),void 0===o&&(o=1),void 0===s&&(s=.2*o),void 0===u&&(u=.2*s),this.position.copy(i),this.line=new e.Line(t,new e.LineBasicMaterial({color:a})),this.line.matrixAutoUpdate=!1,this.add(this.line),this.cone=new e.Mesh(n,new e.MeshBasicMaterial({color:a})),this.cone.matrixAutoUpdate=!1,this.add(this.cone),this.setDirection(r),this.setLength(o,s,u)}}(),e.ArrowHelper.prototype=Object.create(e.Object3D.prototype),e.ArrowHelper.prototype.constructor=e.ArrowHelper,e.ArrowHelper.prototype.setDirection=function(){var t,n=new e.Vector3;return function(e){e.y>.99999?this.quaternion.set(0,0,0,1):e.y<-.99999?this.quaternion.set(1,0,0,0):(n.set(e.z,0,-e.x).normalize(),t=Math.acos(e.y),this.quaternion.setFromAxisAngle(n,t))}}(),e.ArrowHelper.prototype.setLength=function(e,t,n){void 0===t&&(t=.2*e),void 0===n&&(n=.2*t),this.line.scale.set(1,e-t,1),this.line.updateMatrix(),this.cone.scale.set(n,t,n),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 n=new e.BufferGeometry;n.addAttribute("position",new e.BufferAttribute(new Float32Array(72),3)),e.Line.call(this,n,new e.LineBasicMaterial({color:16776960}),e.LinePieces),void 0!==t&&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;null===t.boundingBox&&t.computeBoundingBox();var n=t.boundingBox.min,r=t.boundingBox.max,i=this.geometry.attributes.position.array;i[0]=r.x,i[1]=r.y,i[2]=r.z,i[3]=n.x,i[4]=r.y,i[5]=r.z,i[6]=n.x,i[7]=r.y,i[8]=r.z,i[9]=n.x,i[10]=n.y,i[11]=r.z,i[12]=n.x,i[13]=n.y,i[14]=r.z,i[15]=r.x,i[16]=n.y,i[17]=r.z,i[18]=r.x,i[19]=n.y,i[20]=r.z,i[21]=r.x,i[22]=r.y,i[23]=r.z,i[24]=r.x,i[25]=r.y,i[26]=n.z,i[27]=n.x,i[28]=r.y,i[29]=n.z,i[30]=n.x,i[31]=r.y,i[32]=n.z,i[33]=n.x,i[34]=n.y,i[35]=n.z,i[36]=n.x,i[37]=n.y,i[38]=n.z,i[39]=r.x,i[40]=n.y,i[41]=n.z,i[42]=r.x,i[43]=n.y,i[44]=n.z,i[45]=r.x,i[46]=r.y,i[47]=n.z,i[48]=r.x,i[49]=r.y,i[50]=r.z,i[51]=r.x,i[52]=r.y,i[53]=n.z,i[54]=n.x,i[55]=r.y,i[56]=r.z,i[57]=n.x,i[58]=r.y,i[59]=n.z,i[60]=n.x,i[61]=n.y,i[62]=r.z,i[63]=n.x,i[64]=n.y,i[65]=n.z,i[66]=r.x,i[67]=n.y,i[68]=r.z,i[69]=r.x,i[70]=n.y,i[71]=n.z,this.geometry.attributes.position.needsUpdate=!0,this.geometry.computeBoundingSphere(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1},e.BoundingBoxHelper=function(t,n){var r=void 0!==n?n:8947848;this.object=t,this.box=new e.Box3,e.Mesh.call(this,new e.BoxGeometry(1,1,1),new e.MeshBasicMaterial({color:r,wireframe:!0}))},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){function n(e,t,n){r(e,n),r(t,n)}function r(t,n){i.vertices.push(new e.Vector3),i.colors.push(new e.Color(n)),void 0===a[t]&&(a[t]=[]),a[t].push(i.vertices.length-1)}var i=new e.Geometry,o=new e.LineBasicMaterial({color:16777215,vertexColors:e.FaceColors}),a={},s=16755200,u=16711680,c=43775,l=16777215,h=3355443;n("n1","n2",s),n("n2","n4",s),n("n4","n3",s),n("n3","n1",s),n("f1","f2",s),n("f2","f4",s),n("f4","f3",s),n("f3","f1",s),n("n1","f1",s),n("n2","f2",s),n("n3","f3",s),n("n4","f4",s),n("p","n1",u),n("p","n2",u),n("p","n3",u),n("p","n4",u),n("u1","u2",c),n("u2","u3",c),n("u3","u1",c),n("c","t",l),n("p","c",h),n("cn1","cn2",h),n("cn3","cn4",h),n("cf1","cf2",h),n("cf3","cf4",h),e.Line.call(this,i,o,e.LinePieces),this.camera=t,this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=a,this.update()},e.CameraHelper.prototype=Object.create(e.Line.prototype),e.CameraHelper.prototype.constructor=e.CameraHelper,e.CameraHelper.prototype.update=function(){var t,n,r=new e.Vector3,i=new e.Camera,o=function(e,o,a,s){r.set(o,a,s).unproject(i);var u=n[e];if(void 0!==u)for(var c=0,l=u.length;l>c;c++)t.vertices[u[c]].copy(r)};return function(){t=this.geometry,n=this.pointMap;var e=1,r=1;i.projectionMatrix.copy(this.camera.projectionMatrix),o("c",0,0,-1),o("t",0,0,1),o("n1",-e,-r,-1),o("n2",e,-r,-1),o("n3",-e,r,-1),o("n4",e,r,-1),o("f1",-e,-r,1),o("f2",e,-r,1),o("f3",-e,r,1),o("f4",e,r,1),o("u1",.7*e,1.1*r,-1),o("u2",.7*-e,1.1*r,-1),o("u3",0,2*r,-1),o("cf1",-e,0,1),o("cf2",e,0,1),o("cf3",0,-r,1),o("cf4",0,r,1),o("cn1",-e,0,-1),o("cn2",e,0,-1),o("cn3",0,-r,-1),o("cn4",0,r,-1),t.verticesNeedUpdate=!0}}(),e.DirectionalLightHelper=function(t,n){e.Object3D.call(this),this.light=t,this.light.updateMatrixWorld(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,n=n||1;var r=new e.Geometry;r.vertices.push(new e.Vector3(-n,n,0),new e.Vector3(n,n,0),new e.Vector3(n,-n,0),new e.Vector3(-n,-n,0),new e.Vector3(-n,n,0));var i=new e.LineBasicMaterial({fog:!1});i.color.copy(this.light.color).multiplyScalar(this.light.intensity),this.lightPlane=new e.Line(r,i),this.add(this.lightPlane),r=new e.Geometry,r.vertices.push(new e.Vector3,new e.Vector3),i=new e.LineBasicMaterial({fog:!1}),i.color.copy(this.light.color).multiplyScalar(this.light.intensity),this.targetLine=new e.Line(r,i),this.add(this.targetLine),this.update()},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,n=new e.Vector3,r=new e.Vector3;return function(){t.setFromMatrixPosition(this.light.matrixWorld),n.setFromMatrixPosition(this.light.target.matrixWorld),r.subVectors(n,t),this.lightPlane.lookAt(r),this.lightPlane.material.color.copy(this.light.color).multiplyScalar(this.light.intensity),this.targetLine.geometry.vertices[1].copy(r),this.targetLine.geometry.verticesNeedUpdate=!0,this.targetLine.material.color.copy(this.lightPlane.material.color)}}(),e.EdgesHelper=function(t,n,r){var i=void 0!==n?n:16777215;r=void 0!==r?r:1;var o,a=Math.cos(e.Math.degToRad(r)),s=[0,0],u={},c=function(e,t){return e-t},l=["a","b","c"],h=new e.BufferGeometry;t.geometry instanceof e.BufferGeometry?(o=new e.Geometry,o.fromBufferGeometry(t.geometry)):o=t.geometry.clone(),o.mergeVertices(),o.computeFaceNormals();for(var f=o.vertices,p=o.faces,d=0,m=0,v=p.length;v>m;m++)for(var g=p[m],y=0;3>y;y++){s[0]=g[l[y]],s[1]=g[l[(y+1)%3]],s.sort(c);var b=s.toString();void 0===u[b]?(u[b]={vert1:s[0],vert2:s[1],face1:m,face2:void 0},d++):u[b].face2=m}var x=new Float32Array(2*d*3),w=0;for(var b in u){var _=u[b];if(void 0===_.face2||p[_.face1].normal.dot(p[_.face2].normal)<=a){var C=f[_.vert1];x[w++]=C.x,x[w++]=C.y,x[w++]=C.z,C=f[_.vert2],x[w++]=C.x,x[w++]=C.y,x[w++]=C.z}}h.addAttribute("position",new e.BufferAttribute(x,3)),e.Line.call(this,h,new e.LineBasicMaterial({color:i}),e.LinePieces),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1},e.EdgesHelper.prototype=Object.create(e.Line.prototype),e.EdgesHelper.prototype.constructor=e.EdgesHelper,e.FaceNormalsHelper=function(t,n,r,i){this.object=t,this.size=void 0!==n?n:1;for(var o=void 0!==r?r:16776960,a=void 0!==i?i:1,s=new e.Geometry,u=this.object.geometry.faces,c=0,l=u.length;l>c;c++)s.vertices.push(new e.Vector3,new e.Vector3);e.Line.call(this,s,new e.LineBasicMaterial({color:o,linewidth:a}),e.LinePieces),this.matrixAutoUpdate=!1,this.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,t=this.object,n=t.geometry.vertices,r=t.geometry.faces,i=t.matrixWorld;t.updateMatrixWorld(!0),this.normalMatrix.getNormalMatrix(i);for(var o=0,a=0,s=r.length;s>o;o++,a+=2){var u=r[o];e[a].copy(n[u.a]).add(n[u.b]).add(n[u.c]).divideScalar(3).applyMatrix4(i),e[a+1].copy(u.normal).applyMatrix3(this.normalMatrix).normalize().multiplyScalar(this.size).add(e[a])}return this.geometry.verticesNeedUpdate=!0,this},e.GridHelper=function(t,n){var r=new e.Geometry,i=new e.LineBasicMaterial({vertexColors:e.VertexColors});this.color1=new e.Color(4473924),this.color2=new e.Color(8947848);for(var o=-t;t>=o;o+=n){r.vertices.push(new e.Vector3(-t,0,o),new e.Vector3(t,0,o),new e.Vector3(o,0,-t),new e.Vector3(o,0,t));var a=0===o?this.color1:this.color2;r.colors.push(a,a,a,a)}e.Line.call(this,r,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=!0},e.HemisphereLightHelper=function(t,n){e.Object3D.call(this),this.light=t,this.light.updateMatrixWorld(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.colors=[new e.Color,new e.Color];var r=new e.SphereGeometry(n,4,2);r.applyMatrix((new e.Matrix4).makeRotationX(-Math.PI/2));for(var i=0,o=8;o>i;i++)r.faces[i].color=this.colors[4>i?0:1];var a=new e.MeshBasicMaterial({vertexColors:e.FaceColors,wireframe:!0});this.lightSphere=new e.Mesh(r,a),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=!0}}(),e.PointLightHelper=function(t,n){this.light=t,this.light.updateMatrixWorld();var r=new e.SphereGeometry(n,4,2),i=new e.MeshBasicMaterial({wireframe:!0,fog:!1});i.color.copy(this.light.color).multiplyScalar(this.light.intensity),e.Mesh.call(this,r,i),this.matrix=this.light.matrixWorld,this.matrixAutoUpdate=!1},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);for(var n=new e.Geometry,r=0;r<this.bones.length;r++){var i=this.bones[r];i.parent instanceof e.Bone&&(n.vertices.push(new e.Vector3),n.vertices.push(new e.Vector3),n.colors.push(new e.Color(0,0,1)),n.colors.push(new e.Color(0,1,0)))}var o=new e.LineBasicMaterial({vertexColors:e.VertexColors,depthTest:!1,depthWrite:!1,transparent:!0});e.Line.call(this,n,o,e.LinePieces),this.root=t,this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.update()},e.SkeletonHelper.prototype=Object.create(e.Line.prototype),e.SkeletonHelper.prototype.constructor=e.SkeletonHelper,e.SkeletonHelper.prototype.getBoneList=function(t){var n=[];t instanceof e.Bone&&n.push(t);for(var r=0;r<t.children.length;r++)n.push.apply(n,this.getBoneList(t.children[r]));return n},e.SkeletonHelper.prototype.update=function(){for(var t=this.geometry,n=(new e.Matrix4).getInverse(this.root.matrixWorld),r=new e.Matrix4,i=0,o=0;o<this.bones.length;o++){var a=this.bones[o];a.parent instanceof e.Bone&&(r.multiplyMatrices(n,a.matrixWorld),t.vertices[i].setFromMatrixPosition(r),r.multiplyMatrices(n,a.parent.matrixWorld),t.vertices[i+1].setFromMatrixPosition(r),i+=2)}t.verticesNeedUpdate=!0,t.computeBoundingSphere()},e.SpotLightHelper=function(t){e.Object3D.call(this),this.light=t,this.light.updateMatrixWorld(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1;var n=new e.CylinderGeometry(0,1,1,8,1,!0);n.applyMatrix((new e.Matrix4).makeTranslation(0,-.5,0)),n.applyMatrix((new e.Matrix4).makeRotationX(-Math.PI/2));var r=new e.MeshBasicMaterial({wireframe:!0,fog:!1});this.cone=new e.Mesh(n,r),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,n=new e.Vector3;return function(){var e=this.light.distance?this.light.distance:1e4,r=e*Math.tan(this.light.angle);this.cone.scale.set(r,r,e),t.setFromMatrixPosition(this.light.matrixWorld),n.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(n.sub(t)),this.cone.material.color.copy(this.light.color).multiplyScalar(this.light.intensity)}}(),e.VertexNormalsHelper=function(t,n,r,i){this.object=t,this.size=void 0!==n?n:1;for(var o=void 0!==r?r:16711680,a=void 0!==i?i:1,s=new e.Geometry,u=t.geometry.faces,c=0,l=u.length;l>c;c++)for(var h=u[c],f=0,p=h.vertexNormals.length;p>f;f++)s.vertices.push(new e.Vector3,new e.Vector3);e.Line.call(this,s,new e.LineBasicMaterial({color:o,linewidth:a}),e.LinePieces),this.matrixAutoUpdate=!1,this.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(){var t=new e.Vector3;return function(){var e=["a","b","c","d"];this.object.updateMatrixWorld(!0),this.normalMatrix.getNormalMatrix(this.object.matrixWorld);for(var n=this.geometry.vertices,r=this.object.geometry.vertices,i=this.object.geometry.faces,o=this.object.matrixWorld,a=0,s=0,u=i.length;u>s;s++)for(var c=i[s],l=0,h=c.vertexNormals.length;h>l;l++){var f=c[e[l]],p=r[f],d=c.vertexNormals[l];n[a].copy(p).applyMatrix4(o),t.copy(d).applyMatrix3(this.normalMatrix).normalize().multiplyScalar(this.size),t.add(n[a]),a+=1,n[a].copy(t),a+=1}return this.geometry.verticesNeedUpdate=!0,this}}(),e.VertexTangentsHelper=function(t,n,r,i){this.object=t,this.size=void 0!==n?n:1;for(var o=void 0!==r?r:255,a=void 0!==i?i:1,s=new e.Geometry,u=t.geometry.faces,c=0,l=u.length;l>c;c++)for(var h=u[c],f=0,p=h.vertexTangents.length;p>f;f++)s.vertices.push(new e.Vector3),s.vertices.push(new e.Vector3);e.Line.call(this,s,new e.LineBasicMaterial({color:o,linewidth:a}),e.LinePieces),this.matrixAutoUpdate=!1,this.update()},e.VertexTangentsHelper.prototype=Object.create(e.Line.prototype),e.VertexTangentsHelper.prototype.constructor=e.VertexTangentsHelper,e.VertexTangentsHelper.prototype.update=function(){var t=new e.Vector3;return function(){var e=["a","b","c","d"];this.object.updateMatrixWorld(!0);for(var n=this.geometry.vertices,r=this.object.geometry.vertices,i=this.object.geometry.faces,o=this.object.matrixWorld,a=0,s=0,u=i.length;u>s;s++)for(var c=i[s],l=0,h=c.vertexTangents.length;h>l;l++){var f=c[e[l]],p=r[f],d=c.vertexTangents[l];n[a].copy(p).applyMatrix4(o),t.copy(d).transformDirection(o).multiplyScalar(this.size),t.add(n[a]),a+=1,n[a].copy(t),a+=1}return this.geometry.verticesNeedUpdate=!0,this}}(),e.WireframeHelper=function(t,n){var r=void 0!==n?n:16777215,i=[0,0],o={},a=function(e,t){return e-t},s=["a","b","c"],u=new e.BufferGeometry;if(t.geometry instanceof e.Geometry){for(var c=t.geometry.vertices,l=t.geometry.faces,h=0,f=new Uint32Array(6*l.length),p=0,d=l.length;d>p;p++)for(var m=l[p],v=0;3>v;v++){i[0]=m[s[v]],i[1]=m[s[(v+1)%3]],i.sort(a);var g=i.toString();void 0===o[g]&&(f[2*h]=i[0],f[2*h+1]=i[1],o[g]=!0,h++)}for(var y=new Float32Array(2*h*3),p=0,d=h;d>p;p++)for(var v=0;2>v;v++){var b=c[f[2*p+v]],x=6*p+3*v;y[x+0]=b.x,y[x+1]=b.y,y[x+2]=b.z}u.addAttribute("position",new e.BufferAttribute(y,3))}else if(t.geometry instanceof e.BufferGeometry)if(void 0!==t.geometry.attributes.index){var c=t.geometry.attributes.position.array,w=t.geometry.attributes.index.array,_=t.geometry.drawcalls,h=0;0===_.length&&(_=[{count:w.length,index:0,start:0}]);for(var f=new Uint32Array(2*w.length),C=0,E=_.length;E>C;++C)for(var S=_[C].start,M=_[C].count,x=_[C].index,p=S,T=S+M;T>p;p+=3)for(var v=0;3>v;v++){i[0]=x+w[p+v],i[1]=x+w[p+(v+1)%3],i.sort(a);var g=i.toString();void 0===o[g]&&(f[2*h]=i[0],f[2*h+1]=i[1],o[g]=!0,h++)}for(var y=new Float32Array(2*h*3),p=0,d=h;d>p;p++)for(var v=0;2>v;v++){var x=6*p+3*v,A=3*f[2*p+v];y[x+0]=c[A],y[x+1]=c[A+1],y[x+2]=c[A+2]}u.addAttribute("position",new e.BufferAttribute(y,3))}else{for(var c=t.geometry.attributes.position.array,h=c.length/3,P=h/3,y=new Float32Array(2*h*3),p=0,d=P;d>p;p++)for(var v=0;3>v;v++){var x=18*p+6*v,k=9*p+3*v;y[x+0]=c[k],y[x+1]=c[k+1],y[x+2]=c[k+2];var A=9*p+3*((v+1)%3);y[x+3]=c[A],y[x+4]=c[A+1],y[x+5]=c[A+2]}u.addAttribute("position",new e.BufferAttribute(y,3))}e.Line.call(this,u,new e.LineBasicMaterial({color:r}),e.LinePieces),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1},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.ImmediateRenderObject.prototype=Object.create(e.Object3D.prototype),e.ImmediateRenderObject.prototype.constructor=e.ImmediateRenderObject,e.MorphBlendMesh=function(t,n){e.Mesh.call(this,t,n),this.animationsMap={},this.animationsList=[];var r=this.geometry.morphTargets.length,i="__default",o=0,a=r-1,s=r/1;this.createAnimation(i,o,a,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,n,r){var i={startFrame:t,endFrame:n,length:n-t+1,fps:r,duration:(n-t)/r,lastFrame:0,currentFrame:0,active:!1,time:0,direction:1,weight:1,directionBackwards:!1,mirroredLoop:!1};
this.animationsMap[e]=i,this.animationsList.push(i)},e.MorphBlendMesh.prototype.autoCreateAnimations=function(e){for(var t,n=/([a-z]+)_?(\d+)/,r={},i=this.geometry,o=0,a=i.morphTargets.length;a>o;o++){var s=i.morphTargets[o],u=s.name.match(n);if(u&&u.length>1){var c=u[1];r[c]||(r[c]={start:1/0,end:-1/0});var l=r[c];o<l.start&&(l.start=o),o>l.end&&(l.end=o),t||(t=c)}}for(var c in r){var l=r[c];this.createAnimation(c,l.start,l.end,e)}this.firstAnimation=t},e.MorphBlendMesh.prototype.setAnimationDirectionForward=function(e){var t=this.animationsMap[e];t&&(t.direction=1,t.directionBackwards=!1)},e.MorphBlendMesh.prototype.setAnimationDirectionBackward=function(e){var t=this.animationsMap[e];t&&(t.direction=-1,t.directionBackwards=!0)},e.MorphBlendMesh.prototype.setAnimationFPS=function(e,t){var n=this.animationsMap[e];n&&(n.fps=t,n.duration=(n.end-n.start)/n.fps)},e.MorphBlendMesh.prototype.setAnimationDuration=function(e,t){var n=this.animationsMap[e];n&&(n.duration=t,n.fps=(n.end-n.start)/n.duration)},e.MorphBlendMesh.prototype.setAnimationWeight=function(e,t){var n=this.animationsMap[e];n&&(n.weight=t)},e.MorphBlendMesh.prototype.setAnimationTime=function(e,t){var n=this.animationsMap[e];n&&(n.time=t)},e.MorphBlendMesh.prototype.getAnimationTime=function(e){var t=0,n=this.animationsMap[e];return n&&(t=n.time),t},e.MorphBlendMesh.prototype.getAnimationDuration=function(e){var t=-1,n=this.animationsMap[e];return n&&(t=n.duration),t},e.MorphBlendMesh.prototype.playAnimation=function(t){var n=this.animationsMap[t];n?(n.time=0,n.active=!0):e.warn("THREE.MorphBlendMesh: animation["+t+"] undefined in .playAnimation()")},e.MorphBlendMesh.prototype.stopAnimation=function(e){var t=this.animationsMap[e];t&&(t.active=!1)},e.MorphBlendMesh.prototype.update=function(t){for(var n=0,r=this.animationsList.length;r>n;n++){var i=this.animationsList[n];if(i.active){var o=i.duration/i.length;i.time+=i.direction*t,i.mirroredLoop?(i.time>i.duration||i.time<0)&&(i.direction*=-1,i.time>i.duration&&(i.time=i.duration,i.directionBackwards=!0),i.time<0&&(i.time=0,i.directionBackwards=!1)):(i.time=i.time%i.duration,i.time<0&&(i.time+=i.duration));var a=i.startFrame+e.Math.clamp(Math.floor(i.time/o),0,i.length-1),s=i.weight;a!==i.currentFrame&&(this.morphTargetInfluences[i.lastFrame]=0,this.morphTargetInfluences[i.currentFrame]=1*s,this.morphTargetInfluences[a]=0,i.lastFrame=i.currentFrame,i.currentFrame=a);var u=i.time%o/o;i.directionBackwards&&(u=1-u),this.morphTargetInfluences[i.currentFrame]=u*s,this.morphTargetInfluences[i.lastFrame]=(1-u)*s}}},function(){var e=0,t=/MSIE (\d+\.\d+);/.test(navigator.userAgent),n=!!navigator.userAgent.match(/Trident\/7.0/),r=navigator.userAgent.indexOf("rv:11.0");t&&(e=new Number(RegExp.$1)),-1!=navigator.appVersion.indexOf("MSIE 10")&&(e=10),n&&-1!=r&&(e=11),e>0&&(HTMLElement.prototype.getBoundingClientRect=function(){var e=HTMLElement.prototype.getBoundingClientRect;return function(){try{return e.apply(this,arguments)}catch(t){return{left:"",right:"",top:"",bottom:""}}}}())}(),e}(),c=this&&this.__extends||function(e,t){function n(){this.constructor=e}for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r]);e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)};!function(e){var t;!function(e){e.VERSION={number:"1.5.3",date:"Dec 13 2016"}}(t=e.Visualization||(e.Visualization={}))}(a||(a={}));var a;!function(e){var t;!function(e){e.THREE=u}(t=e.Visualization||(e.Visualization={}))}(a||(a={}));var a;!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(n){return console.log(n),!1}}e.checkWebGL=t;var n=function(){function t(){}return t.setPickBase=function(e,t,n,r){var i=24,o=e<<i-t|n,a=o>>16&255,s=o>>8&255,u=255&o;r.r=a/255,r.g=s/255,r.b=u/255},t.setPickColor=function(e,t,n,r,i){var o=24,a=e<<o-t|n,s=a>>16&255,u=a>>8&255,c=255&a;r[i]=s/255,r[i+1]=u/255,r[i+2]=c/255},t.toSurface=function(e){for(var t=3*e.vertices.length,n=new Float32Array(t),r=new Float32Array(t),i=new Uint32Array(3*e.faces.length),o=Array(e.vertices.length),a=0;a<e.faces.length;a++){var s=e.faces[a];o[s.a]=s.vertexNormals[0],o[s.b]=s.vertexNormals[1],o[s.c]=s.vertexNormals[2],i[3*a]=s.a,i[3*a+1]=s.b,i[3*a+2]=s.c}for(var a=0;a<e.vertices.length;a++){var u=e.vertices[a];n[3*a]=u.x,n[3*a+1]=u.y,n[3*a+2]=u.z;var c=o[a];r[3*a]=c.x,r[3*a+1]=c.y,r[3*a+2]=c.z}return{vertices:n,vertexCount:e.vertices.length,triangleIndices:i,triangleCount:e.faces.length,normals:r}},t.getIndexedBufferGeometry=function(t){for(var n=3*t.vertices.length,r=new Float32Array(n),i=new Float32Array(n),o=new Uint32Array(3*t.faces.length),a=Array(t.vertices.length),s=0;s<t.faces.length;s++){var u=t.faces[s];a[u.a]=u.vertexNormals[0],a[u.b]=u.vertexNormals[1],a[u.c]=u.vertexNormals[2],o[3*s]=u.a,o[3*s+1]=u.b,o[3*s+2]=u.c}for(var s=0;s<t.vertices.length;s++){var c=t.vertices[s];r[3*s]=c.x,r[3*s+1]=c.y,r[3*s+2]=c.z;var l=a[s];i[3*s]=l.x,i[3*s+1]=l.y,i[3*s+2]=l.z}var h=new e.THREE.BufferGeometry;return h.addAttribute("position",new e.THREE.BufferAttribute(r,3)),h.addAttribute("normal",new e.THREE.BufferAttribute(i,3)),h.addAttribute("index",new e.THREE.BufferAttribute(o,1)),h},t}();e.GeometryHelper=n}(t=e.Visualization||(e.Visualization={}))}(a||(a={}));var a;!function(e){var t;!function(e){var t;!function(t){function n(e,t){t.r=e.r,t.g=e.g,t.b=e.b}function r(e){var t=e.r,n=e.g,r=e.b;return{r:t,g:n,b:r}}function i(t){return new e.THREE.Vector3(t.r,t.g,t.b)}function o(e){return{r:e.x,g:e.y,b:e.z}}function a(e,t,n){return{r:e/255,g:t/255,b:n/255}}function s(e,t,n){return 0>n&&(n+=1),n>1&&(n-=1),1/6>n?e+6*(t-e)*n:.5>n?t:2/3>n?e+(t-e)*(2/3-n)*6:e}function u(e,t,n){var r,i,o;if(0==t)r=i=o=n;else{var a=.5>n?n*(1+t):n+t-n*t,u=2*n-a;r=s(u,a,e+1/3),i=s(u,a,e),o=s(u,a,e-1/3)}return{r:r,g:i,b:o}}function c(e,t,n){var r,i,o=[];if(0===t)r=[n,n,n];else switch(e/=60,i=Math.floor(e),o=[n*(1-t),n*(1-t*(e-i)),n*(1-t*(1-(e-i)))],i){case 0:r=[n,o[2],o[0]];break;case 1:r=[o[1],n,o[0]];break;case 2:r=[o[0],n,o[2]];break;case 3:r=[o[0],o[1],n];break;case 4:r=[o[2],o[0],n];break;default:r=[n,o[0],o[1]]}return{r:r[0],g:r[1],b:r[2]}}function l(){return e.Utils.Palette.getRandomColor()}function h(e){return{r:(e>>16&255)/255,g:(e>>8&255)/255,b:(255&e)/255}}function f(e){return"#"!==e[0]?h(0):4===e.length?f("#"+e[1]+e[1]+e[2]+e[2]+e[3]+e[3]):7===e.length?h(parseInt(e.substr(1),16)):h(0)}function p(e,t,n,r){r.r=e.r+(t.r-e.r)*n,r.g=e.g+(t.g-e.g)*n,r.b=e.b+(t.b-e.b)*n}function d(e){return void 0!==e.r&&void 0!==e.g&&void 0!==e.b}t.copy=n,t.clone=r,t.toVector=i,t.fromVector=o,t.fromRgb=a,t.fromHsl=u,t.fromHsv=c,t.random=l,t.fromHex=h,t.fromHexString=f,t.interpolate=p,t.isColor=d}(t=e.Color||(e.Color={}));var n;!function(e){function n(e){var t=+e.transparency.alpha;return isNaN(t)&&(t=1),.999>=t}function r(e,t,n){var r=e.colors.get(t);return r?r:n}function i(e){void 0===e&&(e={});var n=e.colors,r=void 0===n?new Map:n,i=e.transparency,o=void 0===i?u.Transparency:i,a=e.interactive,s=void 0===a?!0:a,c=e.disableFog,l=void 0===c?!1:c,h=r.get("Uniform");return h||(r.set("Uniform",u.UniformColor),h=u.UniformColor),{colors:r,transparency:o,interactive:s,disableFog:l,setElementColor:function(e,n){t.copy(h,n)}}}function o(e,t){void 0===t&&(t={});var n=t.colors,r=void 0===n?new Map:n,i=t.transparency,o=void 0===i?u.Transparency:i,a=t.interactive,s=void 0===a?!0:a,c=t.disableFog,l=void 0===c?!1:c;return{colors:r,transparency:o?o:u.Transparency,interactive:s,disableFog:l,setElementColor:function(t,n){e.setColor(e.getProperty(t),n)}}}function a(e,t,n){var r=new l(t,n);return{getProperty:e,setColor:function(e,t){return r.setColor(e,t)}}}function s(e,t){var n=new c(t);return{getProperty:e,setColor:function(e,t){return n.setColor(e,t)}}}var u;!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:!1}}(u=e.Default||(e.Default={})),e.isTransparent=n,e.getColor=r,e.createUniform=i,e.createMapping=o,e.createColorMapMapping=a,e.createPalleteMapping=s;var c=function(){function e(e){this.pallete=e,this.colorIndex=0,this.colorMap=new Map}return e.prototype.setColor=function(e,n){var r=this.colorMap.get(e);r||(this.colorIndex=(this.colorIndex+1)%this.pallete.length|0,r=this.pallete[this.colorIndex],this.colorMap.set(e,r)),t.copy(r,n)},e}(),l=function(){function e(e,t){this.map=e,this.fallbackColor=t}return e.prototype.setColor=function(e,n){var r=this.map.get(e);r||(r=this.fallbackColor),t.copy(r,n)},e}()}(n=e.Theme||(e.Theme={}))}(t=e.Visualization||(e.Visualization={}))}(a||(a={}));var a;!function(e){var t;!function(e){var t=function(){function t(){}return 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(n,r,i){var o=!1;t.updateTransparencyAndFog(n,r,i)&&(o=!0),n instanceof e.THREE.ShaderMaterial&&t.updateHighlightColor(n,r)&&(o=!0),o&&(n.needsUpdate=!0)},t.updateHighlightColor=function(n,r){var i=!1,o=n.uniforms.selectionColor.value,a=e.Theme.getColor(r,"Selection",e.Theme.Default.SelectionColor);t.compareVectorAndColor(o,a)||(n.uniforms.selectionColor.value=e.Color.toVector(a),i=!0),o=n.uniforms.highlightColor.value;var s=e.Theme.getColor(r,"Highlight",e.Theme.Default.HighlightColor);return t.compareVectorAndColor(o,s)||(n.uniforms.highlightColor.value=e.Color.toVector(s),i=!0),i},t.updateTransparencyAndFog=function(t,n,r){var i=n.transparency,o=+i.alpha;isNaN(o)&&(o=1);var a=.999>=o,s=!!i.writeDepth;a||(o=1,s=!0),r&&(r.renderOrder=a?1:0);var u=!1;return(t instanceof e.THREE.MeshPhongMaterial||t instanceof e.THREE.ShaderMaterial)&&(t.transparent!==a&&(t.transparent=a,u=!0),t.depthWrite!==s&&(t.depthWrite=s,u=!0),t.opacity!==o&&(t.opacity=o,u=!0),t.fog!==!n.disableFog&&(t.fog=!n.disableFog,u=!0),t instanceof e.THREE.ShaderMaterial&&t.uniforms.opacity&&(t.uniforms.opacity.value=o)),u},t.getMeshMaterial=function(n,r){void 0===n&&(n=e.THREE.SmoothShading),void 0===r&&(r=!1);var i=t.shader,o=(e.THREE.UniformsUtils.clone(i.uniforms),new e.THREE.ShaderMaterial({uniforms:e.THREE.UniformsUtils.clone(i.uniforms),attributes:{vState:{type:"f",value:[]}},lights:!0,fog:!0,vertexShader:i.vertexShader,fragmentShader:i.fragmentShader,shading:n,side:e.THREE.DoubleSide,vertexColors:e.THREE.VertexColors,blending:e.THREE.NormalBlending,wireframe:r,linewidth:1}));return o},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:!0})},t.getDefaultHighlightMaterial=function(){return new e.THREE.MeshPhongMaterial({color:16777215,specular:11184810,shininess:2,shading:e.THREE.SmoothShading,side:e.THREE.DoubleSide,metal:!0})},t.applyColorToMap=function(e,t,n,r){for(var i=n.array,o={r:.45,g:.45,b:.45},a=e.vertexRanges,s=0,u=e.elementIndices;s<u.length;s++){var c=u[s],l=e.elementMap.get(c),h=e.elementRanges[2*l],f=e.elementRanges[2*l+1];if(h!==f){r(c,o);for(var p=h;f>p;p+=2)for(var d=a[p],m=a[p+1],v=d;m>v;v++)i[3*v]=o.r,i[3*v+1]=o.g,i[3*v+2]=o.b}}n.needsUpdate=!0},t}();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"," varying 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"," vNormal = normalize( transformedNormal );","#endif",e.THREE.ShaderChunk.morphtarget_vertex,e.THREE.ShaderChunk.skinning_vertex,e.THREE.ShaderChunk.default_vertex,e.THREE.ShaderChunk.logdepthbuf_vertex," vViewPosition = -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() {"," vec3 outgoingLight = vec3( 0.0 );"," vec4 diffuseColor;"," if (vS < 0.33) { diffuseColor = vec4( vColor, opacity ); }"," else if (vS - floor(vS + 0.1) > 0.33) { diffuseColor = vec4(highlightColor, opacity); }"," else { 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"," gl_FragColor = vec4( outgoingLight, diffuseColor.a );","#endif","}"].join("\n")},e.MaterialsHelper=t}(t=e.Visualization||(e.Visualization={}))}(a||(a={}));var a;!function(e){var t;!function(e){var t=function(){function e(){}return e}();e.GeometryBase=t;var n=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=!1,this.props={},this.tag=void 0}return t.prototype.updateVisibility=function(e){this.dirty=!0,this.object.visible=e,this.pickObject&&(this.pickObject.visible=this.getPickObjectVisibility(e))},t.prototype.getVisibility=function(){return this.object.visible},t.prototype.applyTheme=function(e){this.dirty=!0,this.theme=e,e.interactive?this.pickObject&&(this.pickObject.visible=this.object.visible):this.pickObject&&(this.pickObject.visible=!1),this.applyThemeInternal(e)},t.prototype.updateId=function(t,n){this.id=t;for(var r=0,i=this.pickBufferAttributes;r<i.length;r++){var o=i[r],a=o.array;if(8>=n)for(var s=0,u=a.length;u>s;s+=4)e.Selection.Picking.applySceneIdFast(this.id,s,a);else for(var s=0,u=a.length;u>s;s+=4)e.Selection.Picking.applySceneIdSlow(n-8,this.id,s,a);o.needsUpdate=!0}},t.prototype.dispose=function(){for(var e=0,t=this.disposeList;e<t.length;e++){var n=t[e];n&&n.dispose()}this.disposeList=[]},t.prototype.highlight=function(e){var t=this.highlightInternal(e);return this.dirty=this.dirty||t,t},t.prototype.applySelection=function(e,t){var n=this.applySelectionInternal(e,t);return this.dirty=this.dirty||n,n},t.prototype.getBoundingSphereOfSelection=function(){return void 0},t.prototype.getPickObjectVisibility=function(e){return e&&this.theme.interactive},t}();e.Model=n}(t=e.Visualization||(e.Visualization={}))}(a||(a={}));var a;!function(e){var t;!function(e){var t=function(){function e(e){this.scene=e,this.availableIds=[],this.list=[],this.map=new Map,this.maxId=1,this._idWidth=8}return Object.defineProperty(e.prototype,"idWidth",{get:function(){return this._idWidth},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"all",{get:function(){return this.list},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"count",{get:function(){return this.map.size},enumerable:!0,configurable:!0}),e.prototype.getBySceneId=function(e){return this.map.get(e)},e.prototype.add=function(e,t){void 0===t&&(t=!0);var n=-1;n=this.availableIds.length?this.availableIds.pop():this.maxId++,this.map.set(n,e),this.list.push(e),e.updateId(n,8),e.object&&this.scene.scene.add(e.object),e.pickObject&&this.scene.pickScene.add(e.pickObject),t?this.scene.camera.reset():this.scene.forceRender()},e.prototype.dispose=function(e){e.object&&this.scene.scene.remove(e.object),e.pickObject&&this.scene.pickScene.remove(e.pickObject),e.dispose()},e.prototype.removeAndDispose=function(e){if(this.map.get(e.id)){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(),e.id===this.maxId&&this.maxId--,e.id=-1,this.scene.forceRender()}},e.prototype.clear=function(){for(var e=0,t=this.list;e<t.length;e++){var n=t[e];this.dispose(n)}this.list=[],this.maxId=0,this.availableIds=[],this.map.clear(),this.scene.forceRender()},e}();e.ModelStore=t}(t=e.Visualization||(e.Visualization={}))}(a||(a={}));var a;!function(e){var t;!function(t){var n;!function(e){e[e.Perspective=0]="Perspective",e[e.Orthographic=1]="Orthographic"}(n=t.CameraType||(t.CameraType={}));var r=function(){function t(t){var n=this;this.touchSlabOn=!1,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.planeDelta=this._planeDelta;var r={wheel:function(e){return n.handleMouseWheel(e)},touchStart:function(e){return n.touchstart(e)},touchEnd:function(e){return n.touchend(e)},touchMove:function(e){return n.touchmove(e)}};t.addEventListener("mousewheel",r.wheel),t.addEventListener("DOMMouseScroll",r.wheel),t.addEventListener("touchstart",r.touchStart,!1),t.addEventListener("touchend",r.touchEnd,!1),t.addEventListener("touchmove",r.touchMove,!1),this.subs.push(function(){return t.removeEventListener("mousewheel",r.wheel)}),this.subs.push(function(){return t.removeEventListener("DOMMouseScroll",r.wheel)}),this.subs.push(function(){return t.removeEventListener("touchstart",r.touchStart,!1)}),this.subs.push(function(){return t.removeEventListener("touchend",r.touchEnd,!1)}),this.subs.push(function(){return t.removeEventListener("touchmove",r.touchMove,!1)})}return t.prototype.updateSize=function(e,t){this.width=e,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 n=t[e];n()}this.subs=[],this._planeDelta.onCompleted()},t.prototype.handleMouseWheel=function(e){e.stopPropagation&&e.stopPropagation(),e.preventDefault&&e.preventDefault();var t=0;e.wheelDelta?t=e.wheelDelta:e.detail&&(t=-e.detail);var n=0>t?1:-1;t=this.radius*this.slabWheelRate*n,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;3>t;t++)this.touchStartPosition.x+=e.touches[t].clientX/3,this.touchStartPosition.y+=e.touches[t].clientY/3;this.touchSlabOn=!0;break;default:this.touchSlabOn=!1}},t.prototype.touchend=function(){this.touchSlabOn=!1},t.prototype.touchmove=function(e){if(this.touchSlabOn){this.touchPosition.x=0,this.touchPosition.y=0;for(var t=0;3>t;t++)this.touchPosition.x+=e.touches[t].clientX/3,this.touchPosition.y+=e.touches[t].clientY/3;var n=-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(n)}},t}();t.SlabControls=r;var i=function(){function e(e,n){this.scene=e,this.domElement=n,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=!0,this.fogDelta=0,this.observers=[],this.setup()}return e.shouldInUpdateInclude=function(e){return!isNaN(e.centroid.x)&&e.getVisibility()},e.dist=function(e,t){e.centroid.x-t.centroid.x},e.prototype.updateFocus=function(n){if(n.length){var r=n.filter(function(t){return e.shouldInUpdateInclude(t)}).sort(function(e,t){return t.radius-e.radius});if(r.length){for(var i=[r[0]],o=new t.THREE.Vector3,a=1;a<r.length;a++){for(var s=r[a],u=!0,c=0,l=i;c<l.length;c++){var h=l[c],f=o.subVectors(s.centroid,h.centroid).length();if(f<h.radius){u=!1;break}}u&&i.push(s)}var p=this.focusPoint;p.x=0,p.y=0,p.z=0;for(var d=0,m=i;d<m.length;d++){var h=m[d];p.add(h.centroid)}p.multiplyScalar(1/i.length);for(var v=0,g=0,y=r;g<y.length;g++){var b=y[g];v=Math.max(v,p.distanceTo(b.centroid)+b.radius)}this.focusRadius=v,this.slabControls.updateRadius(this.focusRadius)}}},e.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(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.updateFocus(e),this.nearPlaneDelta=0,this.fogDelta=0,this.controls.panAndMoveToDistance(this.focusPoint,4*this.focusRadius)},e.prototype.focusOnPoint=function(e,t){this.focusPoint.x=e.x,this.focusPoint.y=e.y,this.focusPoint.z=e.z,this.focusRadius=t,this.slabControls.updateRadius(this.focusRadius),this.nearPlaneDelta=0,this.fogDelta=0,this.controls.panAndMoveToDistance(this.focusPoint,4*t)},e.prototype.move=function(e){this.controls.panTo(e)},e.prototype.updateSize=function(e,n){var r=this.camera;r instanceof t.THREE.PerspectiveCamera&&(r.aspect=e/n),this.slabControls.updateSize(e,n),this.camera.updateProjectionMatrix()},Object.defineProperty(e.prototype,"position",{get:function(){return this.camera.position},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"object",{get:function(){return this.camera},enumerable:!0,configurable:!0}),e.prototype.dispose=function(){this.slabControls&&(this.slabControls.destroy(),this.slabControls=void 0),this.unbindCamera&&(this.unbindCamera(),this.unbindCamera=void 0),this.controls&&(this.controls.destroy(),this.controls=void 0)},e.prototype.planeDeltaUpdate=function(e){var t=this.computeNearDistance(),n=t+this.nearPlaneDelta+e;e>0&&n>this.targetDistance&&(e=0),0>e&&.01>n&&(e=0),this.nearPlaneDelta+=e,this.fogDelta+=e,this.cameraUpdated()},e.prototype.computeNearDistance=function(){var e=this.controls.target.distanceTo(this.camera.position);return e>this.focusRadius?e-this.focusRadius:0},e.prototype.cameraUpdated=function(){var e=this.scene.options;this.fogEnabled=!!e.enableFog;var n=this.camera;n instanceof t.THREE.PerspectiveCamera&&(n.fov=e.cameraFOV),this.targetDistance=this.controls.target.distanceTo(this.camera.position);var r=this.computeNearDistance()+this.nearPlaneDelta;if(this.camera.near=Math.max(.01,Math.min(r,this.targetDistance-.5)),e.enableFog){var i=this.targetDistance-this.camera.near+1*this.focusRadius-this.nearPlaneDelta,o=this.targetDistance-this.camera.near+2*this.focusRadius-this.nearPlaneDelta;this.fog.near=Math.max(i,.1),this.fog.far=Math.max(o,.2)}else this.fog.far=1000001,this.fog.near=1e6;this.camera.updateProjectionMatrix(),this.scene.forceRender();for(var a=0,s=this.observers;a<s.length;a++){var u=s[a];u.call(null,this)}},e.prototype.createCamera=function(){if(this.scene.options.cameraType===n.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,r=this.scene.parentElement.clientHeight,i=100,o=r/e*i;this.camera=new t.THREE.OrthographicCamera(.5*i/-2,.5*i/2,o/2,o/-2,.1,1e6)}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 n=this.scene.options.clearColor;this.fog.color.setRGB(n.r,n.g,n.b),this.scene.scene.fog=this.fog;var i=function(){return e.cameraUpdated()};this.slabControls=new r(this.domElement);var o=this.slabControls.planeDelta.subscribe(function(t){return e.planeDeltaUpdate(t)});this.controls.events.addEventListener("change",i),this.unbindCamera=function(){e.controls.events.removeEventListener("change",i),o.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})},e}();t.Camera=i}(t=e.Visualization||(e.Visualization={}))}(a||(a={}));var a;!function(e){var t;!function(t){t.DefaultSceneOptions={alpha:!1,clearColor:{r:0,g:0,b:0},cameraFOV:30,cameraType:t.CameraType.Perspective,enableFog:!0};var n=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=!0,this.rect={left:0,top:0,right:0,bottom:0},this.exactPosition={x:0,y:0},this.isInside=!1,this.isButtonDown=!1}return 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){(this.position.x!==e||this.position.y!==t)&&(this.isDirty=!0,this.position.x=e,this.position.y=t)},e.prototype.update=function(){return this.lastPosition.x===this.position.x&&this.lastPosition.y===this.position.y?!1:(this.lastPosition.x=this.position.x,this.lastPosition.y=this.position.y,!0)},e.prototype.setExactPosition=function(){if(this.isDirty){var e=0|Math.round((this.position.x-this.rect.left)/(this.rect.right-this.rect.left)*this.renderState.width),t=0|Math.round((this.position.y-this.rect.top)/(this.rect.bottom-this.rect.top)*this.renderState.height);this.exactPosition.x=e,this.exactPosition.y=t,this.isDirty=!1}},e}();t.MouseInfo=n;var r=function(){function e(){this.lights=[]}return e.prototype.setup=function(e){{var n=new t.THREE.PointLight(11184810,.75);n.clone()}e.add(n),this.lights=[n];var r=new t.THREE.AmbientLight(10066329);e.add(r)},e.prototype.update=function(e){for(var t=0,n=this.lights;t<n.length;t++){var r=n[t];r.position.copy(e)}},e}();t.DefaultLighting=r;var i=function(){function e(){this.width=0,this.height=0,this.resizing=!1,this.rendered=!1,this.lastRenderTime=0,this.pickDelta=0,this.animationFrame=0}return e}();t.RenderState=i;var o=function(){function o(o,a){void 0===a&&(a={});var s=this;this.renderState=new i,this.pickInfo=new t.Selection.Pick,this.selectInfo=null,this.unbindEvents=[],this.updateSizeInterval=void 0,this.models=new t.ModelStore(this),this.events=new t.THREE.EventDispatcher,this.clearHighlightsCall=function(){return s.clearHighlights(!0)},this.renderFunc=function(e){return s.render(e)},this.pickBuffer=new Uint8Array(4),a=e.Core.Utils.extend({},a,t.DefaultSceneOptions),this.options=a,this.parentElement=o,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=!1,this.renderer=new t.THREE.WebGLRenderer({antialias:!0,alpha:a.alpha,preserveDrawingBuffer:!0}),this.renderer.setClearColor(new t.THREE.Color(a.clearColor.r,a.clearColor.g,a.clearColor.b)),this.renderer.autoClear=!0,this.renderer.sortObjects=!1,this.mouseInfo=new n(this.renderState,this.renderer.domElement),this.lighting=new r,this.lighting.setup(this.scene),this.parentElement.appendChild(this.renderer.domElement);var u=e.Core.Utils.debounce(function(){return s.handleResize()},100),c=function(){s.renderState.resizing=!0,u()};window.addEventListener("resize",c),document.addEventListener("resize",c),this.parentElement.addEventListener("resize",c),this.unbindEvents.push(function(){return window.removeEventListener("resize",c)}),this.unbindEvents.push(function(){return document.removeEventListener("resize",c)}),this.unbindEvents.push(function(){return s.parentElement.removeEventListener("resize",c)}),this.setupMouse(),this.camera=new t.Camera(this,this.renderer.domElement),this.handleResize(),this.renderer.clear(),this.needsRender(),this.renderState.animationFrame=requestAnimationFrame(this.renderFunc)}return o.prototype.updateOptions=function(n){n=e.Core.Utils.extend({},n,this.options);var r=n.cameraType!==this.options.cameraType,i=n.clearColor;this.renderer.setClearColor(new t.THREE.Color(i.r,i.g,i.b)),this.renderer.setClearAlpha(n.alpha?0:1),this.camera.fog.color.setRGB(i.r,i.g,i.b),this.options=n,r&&this.camera.createCamera(),this.camera.cameraUpdated(),this.forceRender()},o.prototype.setupMouse=function(){var e=this,t=function(t){e.mouseInfo.isInside||e.mouseInfo.updateRect(),e.mouseInfo.updatePosition(t.clientX,t.clientY),e.mouseInfo.isInside=!0},n=this.renderer.domElement;n.addEventListener("mousemove",t),this.unbindEvents.push(function(){return n.removeEventListener("mousemove",t)});var r=function(){e.mouseInfo.isInside=!1,e.clearHighlights()};n.addEventListener("mouseleave",r),this.unbindEvents.push(function(){return n.removeEventListener("mouseleave",r)});var i=function(t){e.mouseInfo.isInside?(e.mouseInfo.updateRect(),e.handleSelectStart(t.clientX,t.clientY)):e.selectInfo=null,e.mouseInfo.isButtonDown=!0,e.clearHighlights()};n.addEventListener("mousedown",i),this.unbindEvents.push(function(){return n.removeEventListener("mousedown",i)});var o=function(t){e.mouseInfo.isButtonDown=!1,e.needsRender(),e.handleSelectEnd(t.clientX,t.clientY),e.clearHighlights(!0)};window.addEventListener("mouseup",o),this.unbindEvents.push(function(){return window.removeEventListener("mouseup",o)});var a=function(){e.mouseInfo.updateRect()};window.addEventListener("mousewheel",a),window.addEventListener("DOMMouseScroll",a),this.unbindEvents.push(function(){return window.removeEventListener("mousewheel",a)}),this.unbindEvents.push(function(){return window.removeEventListener("DOMMouseScroll",a)}),n.addEventListener("touchstart",a,!1),this.unbindEvents.push(function(){return n.removeEventListener("touchstart",a,!1)});var s=function(t){var n=t.touches;n.length||(n=t.changedTouches),1===n.length&&e.handleSelectEnd(n[0].clientX,n[0].clientY),setTimeout(e.clearHighlightsCall,1e3/15)
};n.addEventListener("touchend",s,!1),this.unbindEvents.push(function(){return n.removeEventListener("touchend",s,!1)});try{n.addEventListener("touchcancel",s,!1),this.unbindEvents.push(function(){return n.removeEventListener("touchcancel",s,!1)})}catch(u){}},o.prototype.handleSelectStart=function(e,t){this.pickInfo.selectStart(e,t),this.selectInfo=this.pickInfo.getPickInfo()},o.prototype.handleSelectEnd=function(e,t){if(this.pickInfo.selectEnd(e,t)){var n=this.handlePick(!0);this.dispatchSelectEvent(n)}this.selectInfo=null},o.prototype.handleResize=function(){var e=this.parentElement.clientWidth,n=this.parentElement.clientHeight;return this.camera.updateSize(e,n),this.renderState.height===n&&this.renderState.width===e?(this.renderState.resizing=!1,void 0):(this.renderState.width=e,this.renderState.height=n,this.renderer.setSize(e,n),this.pickTarget=new t.THREE.WebGLRenderTarget(e,n,{format:t.THREE.RGBAFormat,minFilter:t.THREE.LinearFilter}),this.pickTarget.generateMipmaps=!1,this.renderState.resizing=!1,this.mouseInfo.updateRect(),this.needsRender(),void 0)},o.prototype.needsRender=function(){this.renderState.rendered=!1},o.prototype.checkDirty=function(){for(var e=!1,t=0,n=this.models.all;t<n.length;t++){var r=n[t];e=e||r.dirty,r.dirty=!1}return e},o.prototype.render=function(e){if(this.renderState.resizing)return this.renderState.animationFrame=requestAnimationFrame(this.renderFunc),void 0;var t=e-this.renderState.lastRenderTime;this.renderState.pickDelta+=t,this.renderState.lastRenderTime=e,this.renderState.pickDelta>33.3333333&&(this.renderState.pickDelta=this.renderState.pickDelta%33.3333333,this.handlePick(!1));var n=this.checkDirty();n&&(this.renderState.rendered=!1),this.renderState.rendered||(this.lighting.update(this.camera.position),this.renderer.sortObjects=!0,this.renderer.render(this.scene,this.camera.object),this.renderer.sortObjects=!1,this.renderState.rendered=!0,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)},o.prototype.dispatchHoverEvent=function(){this.events.dispatchEvent({type:o.hoverEvent,target:null,data:this.pickInfo.getPickInfo()})},o.prototype.dispatchSelectEvent=function(e){e&&this.events.dispatchEvent({type:o.selectEvent,target:null,data:e})},o.prototype.clearHighlights=function(e){void 0===e&&(e=!0);var t=this.pickInfo,n=this.models.getBySceneId(t.currentPickId),r=!1;return n&&(r=n.highlightElement(t.currentPickElementId,!1)),r&&e&&this.needsRender(),this.pickInfo.reset()&&this.dispatchHoverEvent(),r},o.prototype.handlePick=function(e){if((e||this.mouseInfo.update()&&!this.mouseInfo.isButtonDown)&&!this.renderState.resizing){if(!this.mouseInfo.isInside)return void 0;this.mouseInfo.setExactPosition();var n=this.mouseInfo.exactPosition,r=this.pickTarget.height-n.y;if(this.pickTarget.width<n.x-1||n.x<.01||this.pickTarget.height<r-1||.01>r)return void 0;this.renderer.readRenderTargetPixels(this.pickTarget,0|n.x,0|r,1,1,this.pickBuffer);var i=t.Selection.Picking.getSceneId(this.models.idWidth,this.pickBuffer),o=t.Selection.Picking.getElementId(this.models.idWidth,this.pickBuffer),a=this.pickInfo;if(e){if(255===i)return void 0;var s=this.models.getBySceneId(i);return s?{model:s,elements:s.getPickElements(o)}:void 0}if(i===a.currentPickId&&o===a.currentPickElementId)return void 0;var u=this.clearHighlights(!1),s=this.models.getBySceneId(i);return 255!==i&&s?(a.currentPickId=i,a.currentPickElementId=o,(s.highlightElement(o,!0)||u)&&(this.needsRender(),a.current={model:s,elements:s.getPickElements(o)},this.dispatchHoverEvent()),void 0):(u&&this.needsRender(),void 0)}},o.prototype.resized=function(){this.handleResize()},o.prototype.forceRender=function(){this.needsRender()},o.prototype.clear=function(){this.models.clear()},o.prototype.screenshotAsDataURL=function(){var e=this.renderer.domElement.toDataURL("image/png"),t=document.createElement("a");"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()):window.open(e,"_blank")},o.prototype.destroy=function(){this.clear();for(var e=0,t=this.unbindEvents;e<t.length;e++){var n=t[e];try{n()}catch(r){}}for(this.unbindEvents=[],cancelAnimationFrame(this.renderState.animationFrame),this.scene=null,this.pickScene=null,this.camera.dispose(),this.camera=null,this.renderer&&this.renderer.dispose&&this.renderer.dispose(),this.renderer=null,this.pickTarget.dispose(),this.pickTarget=null;this.parentElement.lastChild;)this.parentElement.removeChild(this.parentElement.lastChild)},o}();o.hoverEvent="hover",o.selectEvent="select",t.Scene=o}(t=e.Visualization||(e.Visualization={}))}(a||(a={}));var a;!function(e){var t;!function(e){var t=function(){function t(t,n,r){var i=this;this.camera=t,this.domElement=n,this.scene=r,this.enabled=!0,this.rotateSpeed=3.33,this.zoomSpeed=3.33,this.panSpeed=1,this.noRotate=!1,this.noZoom=!1,this.noPan=!1,this.noRoll=!0,this.staticMoving=!0,this.dynamicDampingFactor=.2,this.minDistance=1.5,this.maxDistance=1e5,this.keys=[65,83,68],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()}return t.prototype.getMouseOnScreen=function(){this.scene.mouseInfo.setExactPosition();var e=this.scene.renderState,t=this.scene.mouseInfo.exactPosition;return this._mouseOnScreen.set(t.x/e.width,t.y/e.height),this._mouseOnScreen},t.prototype.getMouseProjectionOnBall=function(){this.scene.mouseInfo.setExactPosition();var e=this.scene.renderState,t=this.scene.mouseInfo.exactPosition,n=.5*e.width,r=.5*e.height,i=(t.x-n)/(.5*e.width),o=-(t.y-r)/(.5*e.height);this._mouseOnBall.set(i,o,0);var a=this._mouseOnBall.length();return this.noRoll?this._mouseOnBall.z=a<Math.SQRT1_2?Math.sqrt(1-a*a):.5/a:a>1?this._mouseOnBall.normalize():this._mouseOnBall.z=Math.sqrt(1-a*a),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)),this._mouseOnBallProjection},t.prototype.rotateCamera=function(){var e=Math.acos(this._rotateStart.dot(this._rotateEnd)/this._rotateStart.length()/this._rotateEnd.length());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),this.staticMoving?this._rotateStart.copy(this._rotateEnd):(this._rotationQuaternion.setFromAxisAngle(this._rotationAxis,e*(this.dynamicDampingFactor-1)),this._rotateStart.applyQuaternion(this._rotationQuaternion)))},t.prototype.zoomCamera=function(){if(4===this._state){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;1!==e&&e>0&&(this._eye.multiplyScalar(e),this.staticMoving?this._zoomStart.copy(this._zoomEnd):this._zoomStart.y+=(this._zoomEnd.y-this._zoomStart.y)*this.dynamicDampingFactor)}},t.prototype.panCamera=function(){this._panMouseChange.copy(this._panEnd).sub(this._panStart),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),this.staticMoving?this._panStart.copy(this._panEnd):this._panStart.add(this._panMouseChange.subVectors(this._panEnd,this._panStart).multiplyScalar(this.dynamicDampingFactor)))},t.prototype.panTo=function(e){var t=e.x,n=e.y,r=e.z;this._panToVector.set(t,n,r),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),this._panToDelta.lengthSq()>this.EPS&&this.events.dispatchEvent(this.changeEvent)},t.prototype.panAndMoveToDistance=function(e,t){var n=e.x,r=e.y,i=e.z;this._panToVector.set(n,r,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(){this.noZoom&&this.noPan||(this._eye.lengthSq()>this.maxDistance*this.maxDistance&&this.camera.position.addVectors(this.target,this._eye.setLength(this.maxDistance)),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),this.noRotate||this.rotateCamera(),this.noZoom||this.zoomCamera(),this.noPan||this.panCamera(),this.camera.position.addVectors(this.target,this._eye),this.checkDistances(),this.camera.lookAt(this.target),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){this.enabled!==!1&&(window.removeEventListener("keydown",this.eventHandlers.keydown,!1),window.addEventListener("keyup",this.eventHandlers.keyup,!1),this._prevState=this._state,-1===this._state&&(e.keyCode!==this.keys[0]||this.noRotate?e.keyCode!==this.keys[2]||this.noZoom?e.keyCode!==this.keys[1]||this.noPan||(this._state=1):this._state=2:this._state=0,this._keyDownState=this._state))},t.prototype.keyup=function(){this.enabled!==!1&&(this._state=this._prevState,this._keyDownState=-1,window.removeEventListener("keyup",this.eventHandlers.keyup,!1),window.addEventListener("keydown",this.eventHandlers.keydown,!1))},t.prototype.mousedown=function(e){this.enabled!==!1&&(e.preventDefault(),this.scene.mouseInfo.updatePosition(e.clientX,e.clientY),-1!==this._keyDownState&&(this._state=this._keyDownState),-1===this._state&&(this._state=e.button),0!==this._state||this.noRotate?2!==this._state||this.noZoom?1!==this._state||this.noPan||(this._panStart.copy(this.getMouseOnScreen()),this._panEnd.copy(this._panStart)):(this._zoomStart.copy(this.getMouseOnScreen()),this._zoomEnd.copy(this._zoomStart)):(this._rotateStart.copy(this.getMouseProjectionOnBall()),this._rotateEnd.copy(this._rotateStart)),window.addEventListener("mousemove",this.eventHandlers.mousemove,!1),window.addEventListener("mouseup",this.eventHandlers.mouseup,!1),this.events.dispatchEvent(this.startEvent))},t.prototype.mousemove=function(e){this.enabled!==!1&&(e.preventDefault(),this.scene.mouseInfo.updatePosition(e.clientX,e.clientY),0!==this._state||this.noRotate?2!==this._state||this.noZoom?1!==this._state||this.noPan||this._panEnd.copy(this.getMouseOnScreen()):this._zoomEnd.copy(this.getMouseOnScreen()):this._rotateEnd.copy(this.getMouseProjectionOnBall()),this.update())},t.prototype.mouseup=function(e){this.enabled!==!1&&(e.preventDefault(),this._state=-1,window.removeEventListener("mousemove",this.eventHandlers.mousemove,!1),window.removeEventListener("mouseup",this.eventHandlers.mouseup,!1),this.events.dispatchEvent(this.endEvent))},t.prototype.mousewheel=function(e){if(this.enabled!==!1){e.preventDefault();var t=0;e.wheelDelta?t=e.wheelDelta/40:e.detail&&(t=-e.detail/3),this._zoomStart.y+=.01*t,this.events.dispatchEvent(this.startEvent),this.events.dispatchEvent(this.endEvent)}},t.prototype.touchstart=function(e){if(this.enabled!==!1){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,n=e.touches[0].clientY-e.touches[1].clientY;this._touchZoomDistanceEnd=this._touchZoomDistanceStart=Math.sqrt(t*t+n*n);var r=(e.touches[0].clientX+e.touches[1].clientX)/2,i=(e.touches[0].clientY+e.touches[1].clientY)/2;this.scene.mouseInfo.updatePosition(r,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!==!1)switch(e.preventDefault(),e.stopPropagation(),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,n=e.touches[0].clientY-e.touches[1].clientY;this._touchZoomDistanceEnd=Math.sqrt(t*t+n*n);var r=(e.touches[0].clientX+e.touches[1].clientX)/2,i=(e.touches[0].clientY+e.touches[1].clientY)/2;this.scene.mouseInfo.updatePosition(r,i),this._panEnd.copy(this.getMouseOnScreen()),this.update();break;default:this._state=-1}},t.prototype.touchend=function(e){if(this.enabled!==!1){var t=e.touches;switch(t.length||(t=e.changedTouches),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 n=(t[0].clientX+t[1].clientX)/2,r=(t[0].clientY+t[1].clientY)/2;this.scene.mouseInfo.updatePosition(n,r),this._panEnd.copy(this.getMouseOnScreen()),this._panStart.copy(this._panEnd)}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,!1),this.domElement.addEventListener("mousedown",this.eventHandlers.mousedown,!1),this.domElement.addEventListener("touchstart",this.eventHandlers.touchstart,!1),this.domElement.addEventListener("touchend",this.eventHandlers.touchend,!1),this.domElement.addEventListener("touchmove",this.eventHandlers.touchmove,!1),window.addEventListener("keydown",this.eventHandlers.keydown,!1),this.update()},t.prototype.destroy=function(){this.domElement.removeEventListener("contextmenu",this.preventContextMenu,!1),this.domElement.removeEventListener("mousedown",this.eventHandlers.mousedown,!1),window.removeEventListener("keydown",this.eventHandlers.keydown,!1),this.domElement.removeEventListener("touchstart",this.eventHandlers.touchstart,!1),this.domElement.removeEventListener("touchend",this.eventHandlers.touchend,!1),this.domElement.removeEventListener("touchmove",this.eventHandlers.touchmove,!1),this.camera=void 0,this.domElement=void 0},t}();e.CameraControls=t}(t=e.Visualization||(e.Visualization={}))}(a||(a={}));var a;!function(e){var t;!function(t){var n;!function(t){function n(e,t,n,r){var i=!1;if(3===r)for(var o=t;n>o;o++){var a=e[o],s=0|a;.33>a-s&&(e[o]=s+.55,i=!0)}else if(4===r)for(var o=t;n>o;o++){var a=e[o],s=0|a;a-s>.33&&(e[o]=s,i=!0)}else if(1===r)for(var o=t;n>o;o++)e[o]=e[o]+1,i=!0;else if(2===r){for(var o=t;n>o;o++)if(e[o]>.75){var a=e[o]-1;0>a&&(a=0),e[o]=a,i=!0}}else for(var o=t;n>o;o++){var a=e[o];e[o]=0,i=i||0!==a}return i}function r(e,t){var r=e.array,i=n(r,0,r.length,t);return i&&(e.needsUpdate=!0),i}var i=function(){function e(){this.current=null,this.currentPickId=-1,this.currentPickElementId=-1,this.selectPos={x:0,y:0}}return e.prototype.getPickInfo=function(){return this.current?{model:this.current.model,elements:this.current.elements}:this.current},e.prototype.reset=function(){var e=null!==this.current;return this.currentPickId=-1,this.currentPickElementId=-1,this.current=null,e},e.prototype.selectStart=function(e,t){this.selectPos.x=e,this.selectPos.y=t},e.prototype.selectEnd=function(e,t){var n=e-this.selectPos.x,r=t-this.selectPos.y;return 4.5>n*n+r*r},e}();t.Pick=i;var o;!function(e){function t(e,t){var n=e>>16&255,r=e>>8&255,i=255&e;t.r=i/255,t.g=r/255,t.b=n/255}function n(e,t,n){n[t+3]=e/255}function r(e,t,n,r){var i=(t&(1<<e)-1)<<8-e,o=t>>e;r[n+3]=o/255;var a=255*r[n+2]|0;r[n+2]=(a|i)/255}function i(e,t){var n=(1<<16-e)-1;return t[0]|t[1]<<8|(t[2]&n)<<16}function o(e,t){var n=e-8,r=t[2]&(1<<n)-1<<8-n>>8-n,i=t[3]<<n;return r|i}e.assignPickColor=t,e.applySceneIdFast=n,e.applySceneIdSlow=r,e.getElementId=i,e.getSceneId=o}(o=t.Picking||(t.Picking={}));var a=e.Core.Utils.ChunkedArray,s=function(){function e(e){this.elementCount=e,this.elementMap=new Map,this.elementIndex=0,this.elementRangeIndex=0,this.rangeIndex=0,this.added=0,this.elementIndices=a.create(function(e){return new Int32Array(e)},e,1),this.elementRanges=new Int32Array(2*e),this.vertexRanges=a.create(function(e){return new Int32Array(e)},e,2)}return e.prototype.startElement=function(e){this.elementIndex=e,this.elementRangeIndex=this.elementMap.size,this.rangeIndex=this.vertexRanges.elementCount,this.added=0},e.prototype.addVertexRange=function(e,t){this.added++,a.add2(this.vertexRanges,e,t)},e.prototype.endElement=function(){a.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)},e.prototype.getMap=function(){return new u(a.compact(this.elementIndices),this.elementMap,this.elementRanges,a.compact(this.vertexRanges))},e}();t.VertexMapBuilder=s;var u=function(){function e(e,t,n,r){this.elementIndices=e,this.elementMap=t,this.elementRanges=n,this.vertexRanges=r}return e}();t.VertexMap=u,t.applyActionToRange=n,t.applyActionToBuffer=r}(n=t.Selection||(t.Selection={}))}(t=e.Visualization||(e.Visualization={}))}(a||(a={}));var a;!function(e){var t;!function(t){var n;!function(n){function r(e){for(var t=new Int32Array(e.data.annotation.length),n=e.data.annotation,r=0,i=t.length;i>r;r++)t[r]=r;return Array.prototype.sort.call(t,function(e,t){var r=n[e]-n[t];return r?r:e-t}),t}function i(e,t,n,r){for(var i=e,o=e+1;t>i;){for(;t>o&&n[o]-n[o-1]<1.1;)o++;r.addVertexRange(n[i],n[o-1]+1),i=o,o+=1}}function o(e){for(var n=r(e),o=e.data.annotation,a=1,s=0,u=n.length-1;u>s;s++)o[n[s]]!==o[n[s+1]]&&a++;for(var c=new t.Selection.VertexMapBuilder(a),l=new Int32Array(n.length),s=0,u=n.length;u>s;s++)l[s]=o[n[s]];var h=o[n[0]];c.startElement(h);for(var s=0,u=n.length;u>s;s++){var f=o[n[s]];f!==h&&(c.endElement(),c.startElement(f),h=f);var p=s;for(s++;f===o[n[s]];)s++;var d=s;s--,i(p,d,n,c)}return c.endElement(),c.getMap()}function a(e){var n=new t.Selection.VertexMapBuilder(1);return n.startElement(0),n.addVertexRange(0,e.vertexCount),n.endElement(),n.getMap()}function s(e,t){e.computation.update("Computing selection map..."),e.computation.schedule(function(){e.geom.elementToVertexMap=e.data.annotation?o(e):a(e),t()},1e3/15)}function u(e,n,r){var i=1e5,o=n.data.triangleIndices,a=n.data.annotation;if(e>=n.triCount)return r(),void 0;var s=n.pickPlatesVertices,c=n.pickPlatesTris,l=n.pickPlatesColors,h=n.data.vertices,f={r:.45,g:.45,b:.45},p=n.pickTris;if(n.computation.update("Creating selection geometry...",n.computation.abortRequest,e,n.triCount),n.computation.abortRequested)return n.computation.abort(),void 0;for(var d=0,m=e,v=Math.min(e+i,n.triCount);v>m;m++){var g=o[3*m],b=o[3*m+1],x=o[3*m+2],w=a[g],_=a[b],C=a[x];if(w!==_||_!==C){var E=w===_?w:_;y.add3(s,h[3*g],h[3*g+1],h[3*g+2]),y.add3(s,h[3*b],h[3*b+1],h[3*b+2]),y.add3(s,h[3*x],h[3*x+1],h[3*x+2]),y.add3(c,d++,d++,d++),0>E?(f.r=0,f.g=0,f.b=0):t.Selection.Picking.assignPickColor(E,f),y.add4(l,f.r,f.g,f.b,0),y.add4(l,f.r,f.g,f.b,0),y.add4(l,f.r,f.g,f.b,0)}else y.add3(p,g,b,x)}n.platesVertexCount+=d,n.computation.schedule(function(){return u(e+i,n,r)})}function l(e){{var n={r:.45,g:.45,b:.45},r=(e.data.vertices,e.data.annotation);e.data.triangleIndices}e.pickTris=y.forIndexBuffer(e.triCount);for(var i=e.pickColorBuffer,o=0,a=e.vertexCount;a>o;o++){var s=r[o];s>=0&&(t.Selection.Picking.assignPickColor(s,n),i[4*o]=n.r,i[4*o+1]=n.g,i[4*o+2]=n.b)}}function h(e){var n=new t.THREE.BufferGeometry;n.addAttribute("position",new t.THREE.BufferAttribute(e.data.vertices,3)),n.addAttribute("index",new t.THREE.BufferAttribute(e.data.triangleIndices,1)),n.addAttribute("pColor",new t.THREE.BufferAttribute(e.pickColorBuffer,4)),e.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)),e.geom.pickPlatesGeometry=n}function f(e){var n=new t.THREE.BufferGeometry;n.addAttribute("position",new t.THREE.BufferAttribute(e.data.vertices,3)),n.addAttribute("index",new t.THREE.BufferAttribute(y.compact(e.pickTris),1)),n.addAttribute("pColor",new t.THREE.BufferAttribute(e.pickColorBuffer,4)),e.geom.pickGeometry=n,n=new t.THREE.BufferGeometry,n.addAttribute("position",new t.THREE.BufferAttribute(y.compact(e.pickPlatesVertices),3)),n.addAttribute("index",new t.THREE.BufferAttribute(y.compact(e.pickPlatesTris),1)),n.addAttribute("pColor",new t.THREE.BufferAttribute(y.compact(e.pickPlatesColors),4)),e.geom.pickPlatesGeometry=n}function p(e,t,n,r){if(n>r){var i=n;n=r,r=i}var o=((n+r)*(n+r+1)+r)/2|0,a=t.size;t.add(o),t.size!==a&&y.add2(e,n,r)}function d(e){for(var n=e.data.triangleIndices,r=y.create(function(e){return new Uint32Array(e)},1.5*e.triCount|0,2),i=new Set,o=0,a=n.length;a>o;o+=3){var s=n[o],u=n[o+1],c=n[o+2];p(r,i,s,u),p(r,i,s,c),p(r,i,u,c)}return new t.THREE.BufferAttribute(y.compact(r),1)}function m(e,n){var r=new t.THREE.BufferGeometry;r.addAttribute("position",new t.THREE.BufferAttribute(n.data.vertices,3)),r.addAttribute("normal",new t.THREE.BufferAttribute(n.data.normals,3)),r.addAttribute("color",new t.THREE.BufferAttribute(new Float32Array(3*n.data.vertices.length),3)),e?r.addAttribute("index",d(n)):r.addAttribute("index",new t.THREE.BufferAttribute(n.data.triangleIndices,1)),n.geom.geometry=r,n.geom.vertexStateBuffer=new t.THREE.BufferAttribute(new Float32Array(n.data.vertices.length),1),r.addAttribute("vState",n.geom.vertexStateBuffer)}function v(e,t){e.computation.update("Creating selection geometry..."),e.computation.schedule(function(){e.pickColorBuffer=new Float32Array(4*e.vertexCount),e.data.annotation?(l(e),e.pickPlatesVertices=y.forVertex3D(Math.max(e.vertexCount/10,10)),e.pickPlatesTris=y.forIndexBuffer(Math.max(e.triCount/10,10)),e.pickPlatesColors=y.create(function(e){return new Float32Array(e)},Math.max(e.vertexCount/10,10),4),e.platesVertexCount=0,u(0,e,function(){f(e),t()})):(h(e),t())})}function g(t,n,r,i){var o={data:t,computation:n,geom:new b,vertexCount:t.vertices.length/3|0,triCount:t.triangleIndices.length/3|0};n.update("Creating geometry...");e.Core.Geometry.Surface.computeNormals(t).bind(function(t){return e.Core.Geometry.Surface.computeBoundingSphere(t)}).run(n).result.then(function(){n.schedule(function(){s(o,function(){v(o,function(){m(r,o),o.geom.vertexToElementMap=o.data.annotation,i(o.geom)})})})}).catch(n.reject)}var y=e.Core.Utils.ChunkedArray;n.buildGeometry=g;var b=function(e){function n(){var n=e.call(this)||this;return n.geometry=void 0,n.vertexToElementMap=void 0,n.elementToVertexMap=void 0,n.pickGeometry=void 0,n.pickPlatesGeometry=void 0,n.vertexStateBuffer=void 0,n.center=new t.THREE.Vector3(0,0,0),n.radius=0,n}return c(n,e),n.prototype.dispose=function(){this.geometry.dispose(),this.pickGeometry&&(this.pickGeometry.dispose(),this.pickPlatesGeometry.dispose())},n}(t.GeometryBase);n.Geometry=b}(n=t.Surface||(t.Surface={}))}(t=e.Visualization||(e.Visualization={}))}(a||(a={}));var a;!function(e){var t;!function(t){var n;!function(n){n.DefaultSurfaceModelParameters={isWireframe:!1};var r=function(r){function i(){return r.apply(this,arguments)||this}return c(i,r),i.prototype.applySelectionInternal=function(e,n){for(var r=this.geometry.vertexStateBuffer,i=r.array,o=this.geometry.elementToVertexMap,a=o.vertexRanges,s=!1,u=0,c=e;u<c.length;u++){var l=c[u];if(o.elementMap.has(l)){var h=o.elementMap.get(l),f=o.elementRanges[2*h],p=o.elementRanges[2*h+1];if(f!==p)for(var d=f;p>d;d+=2){var m=a[d],v=a[d+1];s=t.Selection.applyActionToRange(i,m,v,n)||s}}}return s?(r.needsUpdate=!0,!0):!1},i.prototype.highlightElement=function(e,t){return this.applySelection([e],t?3:4)},i.prototype.highlightInternal=function(e){return t.Selection.applyActionToBuffer(this.geometry.vertexStateBuffer,e?3:4)},i.prototype.getPickElements=function(e){return[e]},i.prototype.getBoundingSphereOfSelection=function(e){if(!this.geometry.vertexToElementMap)return{radius:this.radius,center:this.centroid};for(var n=this.geometry.geometry.attributes.position.array,r=new t.THREE.Vector3,i=0,o=this.geometry.elementToVertexMap,a=o.vertexRanges,s=0,u=e;s<u.length;s++){var c=u[s];if(o.elementMap.has(c)){var l=o.elementMap.get(c),h=o.elementRanges[2*l],f=o.elementRanges[2*l+1];if(h!==f)for(var p=h;f>p;p+=2)for(var d=a[p],m=a[p+1],v=d;m>v;v++)r.x+=n[3*v],r.y+=n[3*v+1],r.z+=n[3*v+2],i++}}if(!i)return void 0;r.x=r.x/i,r.y=r.y/i,r.z=r.z/i;for(var g=new t.THREE.Vector3,y=0,b=0,x=e;b<x.length;b++){var c=x[b];if(o.elementMap.has(c)){var l=o.elementMap.get(c),h=o.elementRanges[2*l],f=o.elementRanges[2*l+1];if(h!==f)for(var p=h;f>p;p+=2)for(var d=a[p],m=a[p+1],v=d;m>v;v++)g.x=n[3*v],g.y=n[3*v+1],g.z=n[3*v+2],y=Math.max(y,g.distanceToSquared(r))}}return y=Math.sqrt(y),{radius:y,center:{x:r.x,y:r.y,z:r.z}}},i.prototype.applyThemeInternal=function(e){var n={r:0,g:0,b:0};t.MaterialsHelper.updateMaterial(this.material,e,this.object);var r=this.geometry.geometry.attributes.color.array,i=this.geometry.vertexToElementMap;if(i)for(var o=0,a=r.length/3|0;a>o;o++){var s=i[o];0>s?(n.r=0,n.g=0,n.b=0):e.setElementColor(s,n),r[3*o]=n.r,r[3*o+1]=n.g,r[3*o+2]=n.b}else{e.setElementColor(0,n);for(var o=0,a=r.length/3|0;a>o;o++)r[3*o]=n.r,r[3*o+1]=n.g,r[3*o+2]=n.b}this.pickObject&&(this.pickObject.visible=this.getPickObjectVisibility(this.object.visible)),this.geometry.geometry.getAttribute("color").needsUpdate=!0},i.prototype.getPickObjectVisibility=function(e){return t.Theme.isTransparent(this.theme)||!this.theme.interactive?!1:e},i.prototype.createObjects=function(){var e=new t.THREE.Mesh(this.geometry.geometry,this.material),n=void 0;if(this.geometry.pickGeometry){n=new t.THREE.Object3D;var r=new t.THREE.Mesh(this.geometry.pickGeometry,this.pickMaterial);n.add(r),r=new t.THREE.Mesh(this.geometry.pickPlatesGeometry,this.pickMaterial),n.add(r)}return{main:e,pick:n}},i.create=function(r,o){var a=o.surface,s=o.theme,u=o.parameters,c=void 0===u?n.DefaultSurfaceModelParameters:u,l=o.props;return e.Core.Computation.create(function(e){n.buildGeometry(a,e,!!c.isWireframe,function(n){var o=new i;o.surface=a,o.material=t.MaterialsHelper.getMeshMaterial(t.THREE.FlatShading,!!c.isWireframe),o.geometry=n,o.pickMaterial=t.MaterialsHelper.getPickMaterial(),o.entity=r,o.centroid=(new t.THREE.Vector3).copy(a.boundingSphere.center),o.radius=a.boundingSphere.radius,l&&(o.props=l),o.disposeList.push(o.geometry,o.material,o.pickMaterial);var u=o.createObjects();o.object=u.main,o.pickObject=u.pick,o.applyTheme(s),o.pickBufferAttributes=[o.geometry.pickGeometry.attributes.pColor],e.resolve(o)})})},i}(t.Model);n.Model=r}(n=t.Surface||(t.Surface={}))}(t=e.Visualization||(e.Visualization={}))}(a||(a={}));var a;!function(e){var t;!function(e){var t;!function(t){var n=function(t){function n(){var n=t.call(this)||this;return n.geometry=void 0,n.center=new e.THREE.Vector3(0,0,0),n.radius=0,n}return c(n,t),n.prototype.dispose=function(){this.geometry.dispose()},n.create=function(t,r){for(var i=new n,o=new e.THREE.Vector3(0,0,0),a=0,s=t.length;s>a;a+=3)o.x+=t[a],o.y+=t[a+1],o.z+=t[a+2];o.multiplyScalar(1/(t.length/3));for(var u=0,a=0,s=t.length;s>a;a+=3){var c=o.x-t[a],l=o.y-t[a+1],h=o.z-t[a+2],f=c*c+l*l+h*h;f>u&&(u=f)}u=Math.sqrt(u);var p=new e.THREE.BufferGeometry;return p.addAttribute("position",new e.THREE.BufferAttribute(t,3)),p.addAttribute("index",new e.THREE.BufferAttribute(r,1)),i.geometry=p,i.center=o,i.radius=u,i},n}(e.GeometryBase);t.Geometry=n}(t=e.Lines||(e.Lines={}))}(t=e.Visualization||(e.Visualization={}))}(a||(a={}));var a;!function(e){var t;!function(t){var n;!function(n){var r=function(n){function r(){return n.apply(this,arguments)||this}return c(r,n),r.prototype.applySelectionInternal=function(){return!1},r.prototype.highlightElement=function(e,t){return this.applySelection([e],t?3:4)},r.prototype.highlightInternal=function(){return!1},r.prototype.getPickElements=function(e){return[e]},r.prototype.applyThemeInternal=function(e){var n=e.colors.get("Uniform");this.material.color=new t.THREE.Color(n.r,n.g,n.b),this.material.needsUpdate=!0},r.prototype.getPickObjectVisibility=function(){return!1},r.prototype.createObjects=function(){return{main:new t.THREE.Mesh(this.geometry.geometry,this.material),pick:void 0}},r.create=function(n,i){var o=i.geometry,a=i.theme,s=i.props;return e.Core.Computation.create(function(e){var i=new r;i.material=new t.THREE.MeshBasicMaterial({wireframe:!0}),i.geometry=o,i.entity=n,i.centroid=o.center,i.radius=o.radius,s&&(i.props=s),i.disposeList.push(i.geometry,i.material);
var u=i.createObjects();i.object=u.main,i.pickObject=void 0,i.applyTheme(a),i.pickBufferAttributes=[],e.resolve(i)})},r}(t.Model);n.Model=r}(n=t.Lines||(t.Lines={}))}(t=e.Visualization||(e.Visualization={}))}(a||(a={}));var a;!function(e){var t;!function(t){var n;!function(n){var r;!function(r){r.DefaultBallsAndSticksModelParameters={tessalation:3,atomRadius:function(){return.4},hideBonds:!1,bondRadius:.15};var i=function(i){function o(){return i.apply(this,arguments)||this}return c(o,i),o.prototype.applySelectionInternal=function(e,n){for(var r=this.ballsAndSticks.vertexStateBuffer,i=r.array,o=this.ballsAndSticks.atomVertexMap,a=o.vertexRanges,s=!1,u=0,c=e;u<c.length;u++){var l=c[u];if(o.elementMap.has(l)){var h=o.elementMap.get(l),f=o.elementRanges[2*h],p=o.elementRanges[2*h+1];if(f!==p)for(var d=f;p>d;d+=2){var m=a[d],v=a[d+1];s=t.Selection.applyActionToRange(i,m,v,n)||s}}}return s?(r.needsUpdate=!0,!0):!1},o.prototype.getPickElements=function(e){return[e]},o.prototype.highlightElement=function(e,t){return this.applySelection([e],t?3:4)},o.prototype.highlightInternal=function(e){return t.Selection.applyActionToBuffer(this.ballsAndSticks.vertexStateBuffer,e?3:4)},o.prototype.applyThemeInternal=function(e){var r=this,i=this.ballsAndSticks.atomVertexMap;t.MaterialsHelper.applyColorToMap(i,i.elementIndices,this.ballsAndSticks.atomsGeometry.attributes.color,function(e,t){return r.theme.setElementColor(e,t)}),i=this.ballsAndSticks.bondVertexMap;var o=t.Theme.getColor(e,"Bond",n.Colors.DefaultBondColor);t.MaterialsHelper.applyColorToMap(i,i.elementIndices,this.ballsAndSticks.bondsGeometry.attributes.color,function(e,n){return t.Color.copy(o,n)}),t.MaterialsHelper.updateMaterial(this.material,e,this.object),t.MaterialsHelper.updateMaterial(this.bondsMaterial,e,this.object)},o.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 n=new t.THREE.Mesh(this.ballsAndSticks.pickGeometry,this.pickMaterial);return{main:e,pick:n}},o.create=function(n,i){var a=i.model,s=i.atomIndices,u=i.theme,c=i.params,l=i.props;return e.Core.Computation.create(function(e){r.buildGeometry(a,c,s,e,function(r){var i=new o;i.molecule=a,i.ballsAndSticks=r,i.material=t.MaterialsHelper.getMeshMaterial(),i.bondsMaterial=new t.THREE.MeshPhongMaterial({specular:11184810,shininess:1,shading:t.THREE.SmoothShading,side:t.THREE.FrontSide,vertexColors:t.THREE.VertexColors}),i.pickMaterial=t.MaterialsHelper.getPickMaterial(),i.entity=n,i.ballsAndSticks.atomsGeometry.computeBoundingSphere(),i.centroid=i.ballsAndSticks.atomsGeometry.boundingSphere.center,i.radius=i.ballsAndSticks.atomsGeometry.boundingSphere.radius,l&&(i.props=l);var s=i.createObjects();i.object=s.main,i.applyTheme(u),i.disposeList.push(i.ballsAndSticks,i.material,i.bondsMaterial,i.pickMaterial),i.pickObject=s.pick,i.pickBufferAttributes=[i.ballsAndSticks.pickGeometry.attributes.pColor],e.resolve(i)})})},o}(t.Model);r.Model=i}(r=n.BallsAndSticks||(n.BallsAndSticks={}))}(n=t.Molecule||(t.Molecule={}))}(t=e.Visualization||(e.Visualization={}))}(a||(a={}));var a;!function(e){var t;!function(t){var n;!function(n){var r;!function(n){function r(e,t,n,r,i){u.build(e,t,n,r,i)}var i;!function(n){function r(t,n,r){for(var i=e.Core.Structure.Query.Context.Mask.ofIndices(t,n),a=0,s=t.covalentBonds,u=s.atomAIndex,c=s.atomBIndex,l=s.type,h=s.count,f=0;h>f;f++){var p=u[f],d=c[f];if(i.has(p)&&i.has(d)){var m=l[f];(1>m||m>4)&&(m=1),o.add3(r,p,d,m),a+=m}}return a}function i(r,i){var a,s=0;a=i,s=a.length;var u=r.atoms,c=u.x,l=u.y,h=u.z,f=u.elementSymbol,p=u.name,d=u.altLoc,m=u.residueIndex,v=u.entityIndex,g=r.entities.entityType,y=e.Core.Structure.EntityType.Water,b=r.residues.name,x=2,w=r.componentBonds,_=o.create(function(e){return new Int32Array(e)},1.33*a.length|0,3),C=1,E=0,S=0,M=0;if(r.covalentBonds){for(E=n.addPrecomputedBonds(r,i,_);s>S;){var T=m[a[S]];for(M=S;s>M&&m[a[M]]==T;)M++;C++,S=M}return{bonds:o.compact(_),stickCount:E,residueCount:C}}for(var A=e.Core.Geometry.SubdivisionTree3D.create(a,function(e,t){t(c[e],l[e],h[e])}),P=e.Core.Geometry.SubdivisionTree3D.createContextRadius(A,x+1,!1),k=new t.THREE.Vector3,R=new t.THREE.Vector3,I=new Set,D=P.buffer;s>S;){var T=m[a[S]];for(M=S;s>M&&m[a[M]]==T;)M++;var B=void 0;if(w&&(B=w.entries.get(b[m[a[S]]]))){for(var V=S;M-1>V;V++){var L=a[V],N=p[L],O=d[L],F=B.map.get(N);if(F){for(var U=V+1;M>U;U++){var z=a[U],$=d[z];if(!O||!$||O===$){var H=F.get(p[z]);void 0!==H&&((1>H||H>4)&&(H=1),o.add3(_,L,z,H),E+=H)}}I.add(L)}}I.add(a[M-1])}for(var V=S;M>V;V++){var j=a[V];D.reset(),P.nearest(c[j],l[j],h[j],x),k.set(c[j],l[j],h[j]);for(var G="H"===f[j],O=d[j],W=g[v[j]]===y,q=D.count,X=0;q>X;X++){var Y=a[D.indices[X]];if(Y!==j&&!I.has(Y)){var K=R.set(c[Y],l[Y],h[Y]).sub(k).length(),Q="H"===f[Y];if(G&&Q||W&&!Q)continue;if(G||Q){1.1>K&&(o.add3(_,j,Y,1),E++);continue}var $=d[Y];!K||O&&$&&O!==$||(o.add3(_,j,Y,1),E++)}}I.add(j)}C++,S=M}return{bonds:o.compact(_),stickCount:E,residueCount:C}}var o=e.Core.Utils.ChunkedArray;n.addPrecomputedBonds=r,n.analyze=i}(i||(i={}));var o=function(){function e(e,n,r,i,o,a,s,u){this.template=e,this.templateVB=n,this.templateNB=r,this.templateIB=i,this.templateVertexCount=o,this.vertices=a,this.normals=s,this.indices=u,this.atomsVector=new t.THREE.Vector3,this.center=new t.THREE.Vector3,this.rotationAxis=new t.THREE.Vector3,this.upVector=new t.THREE.Vector3(0,1,0),this.scaleMatrix=new t.THREE.Matrix4,this.rotationMatrix=new t.THREE.Matrix4,this.translationMatrix=new t.THREE.Matrix4,this.offsetMatrix=new t.THREE.Matrix4,this.finalMatrix=new t.THREE.Matrix4,this.sticksDone=0,this.radius=.15,this.offset=new t.THREE.Vector3,this.a=new t.THREE.Vector3,this.b=new t.THREE.Vector3}return e}(),a=function(){function e(n,r,i){this.model=n,this.atomIndices=r,this.params=i,this.tessalation=this.params.tessalation,this.atomRadius=this.params.atomRadius,this.bondRadius=this.params.bondRadius,this.hideBonds=this.params.hideBonds,this.bondTemplate=e.getBondTemplate(1,this.tessalation),this.atomTemplate=e.getAtomTemplate(1,this.tessalation),this.bondTemplateVertexBuffer=this.bondTemplate.attributes.position.array,this.bondTemplateVertexBufferLength=this.bondTemplateVertexBuffer.length,this.bondTemplateVertexCount=this.bondTemplateVertexBufferLength/3|0,this.bondTemplateIndexBuffer=this.bondTemplate.attributes.index.array,this.bondTemplateIndexBufferLength=this.bondTemplateIndexBuffer.length,this.bondTemplateNormalBuffer=this.bondTemplate.attributes.normal.array,this.atomTemplateVertexBuffer=this.atomTemplate.attributes.position.array,this.atomTemplateVertexBufferLength=this.atomTemplateVertexBuffer.length,this.atomTemplateVertexCount=this.atomTemplateVertexBufferLength/3|0,this.atomTemplateIndexBuffer=this.atomTemplate.attributes.index.array,this.atomTemplateIndexBufferLength=this.atomTemplateIndexBuffer.length,this.atomTemplateNormalBuffer=this.atomTemplate.attributes.normal.array,this.atomBufferSize=this.atomTemplateVertexBufferLength*this.atomIndices.length,this.atomVertices=new Float32Array(this.atomBufferSize),this.atomNormals=new Float32Array(this.atomBufferSize),this.atomTriangleIndices=new Uint32Array(this.atomTemplateIndexBufferLength*this.atomIndices.length),this.atomColors=new Float32Array(this.atomBufferSize),this.atomPickColors=new Float32Array(4*this.atomTemplateVertexCount*this.atomIndices.length),this.atoms=this.model.atoms,this.cX=this.atoms.x,this.cY=this.atoms.y,this.cZ=this.atoms.z,this.atomSymbols=this.atoms.elementSymbol,this.residueIndex=this.atoms.residueIndex,this.atomsDone=0,this.offset=0,this.bondsDone=0,this.atomsVector=new t.THREE.Vector3,this.center=new t.THREE.Vector3,this.rotationAxis=new t.THREE.Vector3,this.up=new t.THREE.Vector3(0,1,0),this.scaleMatrix=new t.THREE.Matrix4,this.rotationMatrix=new t.THREE.Matrix4,this.translationMatrix=new t.THREE.Matrix4,this.atom1Vec=new t.THREE.Vector3,this.atom2Vec=new t.THREE.Vector3,this.pickColor={r:.1,g:.1,b:.1},this.atomMapBuilder=new t.Selection.VertexMapBuilder(this.atomIndices.length),this.tempVector=new t.THREE.Vector3(0,0,0),this.bs=void 0}return e.getBondTemplate=function(e,n){var r;switch(n){case 0:r=2;break;case 1:r=4;break;case 2:r=6;break;case 3:r=8;break;case 4:r=10;break;case 5:r=12;break;default:r=14}var i=t.GeometryHelper.getIndexedBufferGeometry(new t.THREE.LatheGeometry([new t.THREE.Vector3(0,e,-0.5),new t.THREE.Vector3(0,e,.5)],r,Math.PI));return i.applyMatrix((new t.THREE.Matrix4).makeRotationAxis(new t.THREE.Vector3(1,0,0),-Math.PI/2)),i},e.getAtomTemplate=function(e,n){var r;switch(n){case 0:r=new t.THREE.OctahedronGeometry(e,0);break;case 1:r=new t.THREE.OctahedronGeometry(e,1);break;case 2:r=new t.THREE.IcosahedronGeometry(e,0);break;case 3:r=new t.THREE.IcosahedronGeometry(e,1);break;case 4:r=new t.THREE.IcosahedronGeometry(e,2);break;case 5:r=new t.THREE.OctahedronGeometry(e,3);break;default:r=new t.THREE.IcosahedronGeometry(e,3)}return t.GeometryHelper.getIndexedBufferGeometry(r)},e}(),s=function(){function e(e){this.state=e,this.model=this.state.model,this.atomIndices=this.state.atomIndices,this.info=i.analyze(this.state.model,this.state.atomIndices),this.bondMapBuilder=new t.Selection.VertexMapBuilder(this.info.residueCount),this.bondBufferSize=this.state.bondTemplateVertexBufferLength*this.info.stickCount,this.bondVertices=new Float32Array(this.bondBufferSize),this.bondNormals=new Float32Array(this.bondBufferSize),this.bondColors=new Float32Array(this.bondBufferSize),this.bondIndices=new Uint32Array(this.state.bondTemplateIndexBufferLength*this.info.stickCount),this.bondRadius=this.state.params.bondRadius,this.residueIndex=this.model.atoms.residueIndex,this.currentResidueIndex=this.residueIndex[this.info.bonds[0]],this.bondMapVertexOffsetStart=0,this.bondMapVertexOffsetEnd=0,this.bondState=new o(this.state.bondTemplate,this.state.bondTemplateVertexBuffer,this.state.bondTemplateNormalBuffer,this.state.bondTemplateIndexBuffer,this.state.bondTemplateVertexCount,this.bondVertices,this.bondNormals,this.bondIndices),this.bondCount=this.info.bonds.length/3|0}return e}(),u=function(){function r(){}return r.prototype.dispose=function(){this.atomsGeometry.dispose(),this.bondsGeometry.dispose(),this.pickGeometry.dispose()},r.addAtom=function(e,n){n.atomMapBuilder.startElement(e);var r=n.atomRadius(e);n.scaleMatrix.makeScale(r,r,r),n.tempVector.set(n.cX[e],n.cY[e],n.cZ[e]),n.translationMatrix.makeTranslation(n.tempVector.x,n.tempVector.y,n.tempVector.z).multiply(n.scaleMatrix),n.atomTemplate.applyMatrix(n.translationMatrix);for(var i=0;i<n.atomTemplateVertexBufferLength;i++)n.offset=n.atomsDone*n.atomTemplateVertexBufferLength+i,n.atomVertices[n.offset]=n.atomTemplateVertexBuffer[i],n.atomNormals[n.offset]=n.atomTemplateNormalBuffer[i];for(var i=0;i<n.atomTemplateIndexBufferLength;i++)n.offset=n.atomTemplateIndexBufferLength*n.atomsDone+i,n.atomTriangleIndices[n.offset]=n.atomTemplateIndexBuffer[i]+n.atomTemplateVertexCount*n.atomsDone;t.Selection.Picking.assignPickColor(e,n.pickColor);for(var i=0;i<n.atomTemplateVertexCount;i++)n.offset=n.atomsDone*n.atomTemplateVertexCount*4+4*i,n.atomPickColors[n.offset]=n.pickColor.r,n.atomPickColors[n.offset+1]=n.pickColor.g,n.atomPickColors[n.offset+2]=n.pickColor.b;n.scaleMatrix.getInverse(n.translationMatrix),n.atomTemplate.applyMatrix(n.scaleMatrix),n.atomMapBuilder.addVertexRange(n.atomsDone*n.atomTemplateVertexCount,(n.atomsDone+1)*n.atomTemplateVertexCount),n.atomMapBuilder.endElement(),n.atomsDone++},r.addBond=function(e,t,n){var i=n.info.bonds[3*e],o=n.info.bonds[3*e+1],a=n.info.bonds[3*e+2];n.currentResidueIndex!==n.residueIndex[i]&&(n.bondMapBuilder.addVertexRange(n.bondMapVertexOffsetStart,n.bondMapVertexOffsetEnd),n.bondMapVertexOffsetStart=n.bondMapVertexOffsetEnd,n.bondMapBuilder.endElement(),n.currentResidueIndex=n.residueIndex[i],n.bondMapBuilder.startElement(n.currentResidueIndex)),t.tempVector.set(t.cX[i],t.cY[i],t.cZ[i]),n.bondState.a.set(t.tempVector.x,t.tempVector.y,t.tempVector.z),t.tempVector.set(t.cX[o],t.cY[o],t.cZ[o]),n.bondState.b.set(t.tempVector.x,t.tempVector.y,t.tempVector.z);var s=n.bondRadius,u=2*s/3,c=s/2,l=n.bondState;switch(a){case 2:l.radius=c,l.offset.x=u,l.offset.y=u,r.addBondPart(l),l.offset.x=-u,l.offset.y=-u,r.addBondPart(l);break;case 3:l.radius=c,l.offset.x=0,l.offset.y=u,r.addBondPart(l),l.offset.x=-Math.cos(Math.PI/3)*u,l.offset.y=-Math.sin(Math.PI/3)*u,r.addBondPart(l),l.offset.x=-l.offset.x,r.addBondPart(l);break;case 4:l.radius=c/2,l.offset.x=u,l.offset.y=u,r.addBondPart(l),l.offset.x=-u,l.offset.y=-u,r.addBondPart(l),l.offset.x=-u,l.offset.y=u,r.addBondPart(l),l.offset.x=u,l.offset.y=-u,r.addBondPart(l);break;default:l.radius=s,l.offset.x=0,l.offset.y=0,r.addBondPart(l)}n.bondMapVertexOffsetEnd+=a*n.state.bondTemplateVertexBufferLength},r.addBondPart=function(e){e.atomsVector.subVectors(e.a,e.b);var t=e.atomsVector.length();e.center.addVectors(e.a,e.b).divideScalar(2),e.rotationAxis.crossVectors(e.atomsVector,e.upVector).normalize();var n=e.atomsVector.angleTo(e.upVector);e.scaleMatrix.makeScale(e.radius,t,e.radius),e.offsetMatrix.makeTranslation(e.offset.x,e.offset.y,e.offset.z),e.rotationMatrix.makeRotationAxis(e.rotationAxis,-n),e.translationMatrix.makeTranslation(e.center.x,e.center.y,e.center.z),e.finalMatrix=e.translationMatrix.multiply(e.rotationMatrix).multiply(e.offsetMatrix).multiply(e.scaleMatrix),e.template.applyMatrix(e.finalMatrix),e.vertices.set(e.templateVB,e.templateVB.length*e.sticksDone),e.normals.set(e.templateNB,e.templateVB.length*e.sticksDone);for(var r=e.templateIB,i=e.indices,o=e.templateIB.length*e.sticksDone,a=e.templateVertexCount*e.sticksDone,s=0;s<r.length;s++)i[o++]=r[s]+a;e.rotationMatrix.getInverse(e.finalMatrix),e.template.applyMatrix(e.rotationMatrix),e.sticksDone++},r.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));var n=new t.Selection.VertexMapBuilder(1);return{bondsGeometry:e,bondVertexMap:n.getMap()}},r.getBondsGeometry=function(e){var n=new t.THREE.BufferGeometry;return n.addAttribute("position",new t.THREE.BufferAttribute(e.bondVertices,3)),n.addAttribute("normal",new t.THREE.BufferAttribute(e.bondNormals,3)),n.addAttribute("index",new t.THREE.BufferAttribute(e.bondIndices,1)),n.addAttribute("color",new t.THREE.BufferAttribute(e.bondColors,3)),{bondsGeometry:n,bondVertexMap:e.bondMapBuilder.getMap()}},r.getAtomsGeometry=function(e){var n=new t.THREE.BufferGeometry;n.addAttribute("position",new t.THREE.BufferAttribute(e.atomVertices,3)),n.addAttribute("normal",new t.THREE.BufferAttribute(e.atomNormals,3)),n.addAttribute("index",new t.THREE.BufferAttribute(e.atomTriangleIndices,1)),n.addAttribute("color",new t.THREE.BufferAttribute(e.atomColors,3));var r=new Float32Array(e.atomVertices.length),i=new t.THREE.BufferAttribute(r,1);n.addAttribute("vState",i);var o=new t.THREE.BufferGeometry;return o.addAttribute("position",new t.THREE.BufferAttribute(e.atomVertices,3)),o.addAttribute("index",new t.THREE.BufferAttribute(e.atomTriangleIndices,1)),o.addAttribute("pColor",new t.THREE.BufferAttribute(e.atomPickColors,4)),{vertexStateBuffer:i,atomsGeometry:n,atomsPickGeometry:o,atomVertexMap:e.atomMapBuilder.getMap()}},r.addAtomsChunk=function(e,t,n,i){var o=1250;if(n.abortRequested)return n.abort(),void 0;if(e>=t.atomIndices.length)return i(),void 0;n.update("Adding atoms...",n.abortRequest,e,t.atomIndices.length);for(var a=e,s=Math.min(e+o,t.atomIndices.length);s>a;a++)r.addAtom(t.atomIndices[a],t);n.schedule(function(){return r.addAtomsChunk(e+o,t,n,i)})},r.addBondsChunk=function(e,t,n,i,o){var a=1250;if(i.abortRequested)return i.abort(),void 0;if(e>=n.bondCount)return o(),void 0;i.update("Adding bonds...",i.abortRequest,e,n.bondCount);for(var s=e,u=Math.min(e+a,n.bondCount);u>s;s++)r.addBond(s,t,n);i.schedule(function(){return r.addBondsChunk(e+a,t,n,i,o)})},r.addBonds=function(e,t,n){return e.params.hideBonds?(n(),void 0):(t.update("Computing bonds..."),t.schedule(function(){var i=new s(e);e.bs=i,i.currentResidueIndex=i.residueIndex[i.info.bonds[0]],i.bondMapBuilder.startElement(i.currentResidueIndex),r.addBondsChunk(0,e,i,t,function(){i.bondMapBuilder.addVertexRange(i.bondMapVertexOffsetStart,i.bondMapVertexOffsetEnd),i.bondMapBuilder.endElement(),t.update("Finishing up..."),t.schedule(n,1e3/30)})}),void 0)},r.addAtoms=function(e,t,n){r.addAtomsChunk(0,e,t,n)},r.build=function(t,i,o,s,u){s.update("Creating atoms..."),s.schedule(function(){var c=new a(t,o,e.Core.Utils.extend({},i,n.DefaultBallsAndSticksModelParameters));r.addAtoms(c,s,function(){r.addBonds(c,s,function(){var e=new l;if(c.bs){var t=r.getBondsGeometry(c.bs);e.bondsGeometry=t.bondsGeometry,e.bondVertexMap=t.bondVertexMap}else{var t=r.getEmptyBondsGeometry();e.bondsGeometry=t.bondsGeometry,e.bondVertexMap=t.bondVertexMap}var n=r.getAtomsGeometry(c);e.vertexStateBuffer=n.vertexStateBuffer,e.atomsGeometry=n.atomsGeometry,e.pickGeometry=n.atomsPickGeometry,e.atomVertexMap=n.atomVertexMap,u(e)})})})},r}();n.buildGeometry=r;var l=function(e){function t(){var t=e.apply(this,arguments)||this;return t.atomsGeometry=void 0,t.bondsGeometry=void 0,t.pickGeometry=void 0,t.atomVertexMap=void 0,t.bondVertexMap=void 0,t.vertexStateBuffer=void 0,t}return c(t,e),t.prototype.dispose=function(){this.atomsGeometry.dispose(),this.bondsGeometry.dispose(),this.pickGeometry.dispose()},t}(t.GeometryBase);n.BallsAndSticksGeometry=l}(r=n.BallsAndSticks||(n.BallsAndSticks={}))}(n=t.Molecule||(t.Molecule={}))}(t=e.Visualization||(e.Visualization={}))}(a||(a={}));var a;!function(e){var t;!function(t){var n;!function(n){var r;!function(n){var r;!function(n){function r(t,r,o,a,s,u,c){var l=e.Core.Utils.extend({},a,n.CartoonsGeometryParams.Default),h={computation:u,model:t,atomIndices:r,linearSegments:o,parameters:a,isTrace:s,params:l,state:new n.CartoonsGeometryState(l,t.residues.count),units:void 0,strandArrays:void 0,strandTemplate:void 0,builder:new n.Builder,geom:new i};h.computation.update("Building units..."),h.computation.schedule(function(){h.units=n.CartoonAsymUnit.buildUnits(h.model,h.atomIndices,h.linearSegments),n.buildUnitsChunk(0,h,function(){h.strandTemplate&&h.strandTemplate.geometry.dispose(),h.geom.vertexMap=h.state.vertexMap.getMap(),n.createGeometry(h);for(var e=h.geom,t=0,r=Object.keys(h);t<r.length;t++){var i=r[t];Object.prototype.hasOwnProperty.call(h,i)&&(h[i]=void 0)}c(e)})})}var i=function(e){function t(){var t=e.apply(this,arguments)||this;return t.geometry=void 0,t.pickGeometry=void 0,t.vertexMap=void 0,t.vertexStateBuffer=void 0,t}return c(t,e),t.prototype.dispose=function(){this.geometry.dispose(),this.pickGeometry.dispose()},t}(t.GeometryBase);n.Data=i,n.create=r}(r=n.Geometry||(n.Geometry={}))}(r=n.Cartoons||(n.Cartoons={}))}(n=t.Molecule||(t.Molecule={}))}(t=e.Visualization||(e.Visualization={}))}(a||(a={}));var a;!function(e){var t;!function(t){var n;!function(n){var r;!function(n){var r;!function(n){function r(e){var n,r=e.params.strandLineWidth,i=e.params.tessalation,o=0,a=0;switch(i){case 0:a=2,o=1;break;case 1:a=3,o=2;break;case 2:a=4,o=2;break;case 3:a=8,o=4;break;case 4:a=10,o=6;break;case 5:a=14,o=6;break;default:a=16,o=8}for(var s=[],u=Math.PI/2/o,c=0;o>=c;c++)s[c]=new t.THREE.Vector3(0,r*Math.cos(c*u),.1*Math.sin(c*u)),s[c].z+=.9;n=new t.THREE.LatheGeometry([new t.THREE.Vector3(0,r,0)].concat(s),a,Math.PI);var l=t.GeometryHelper.getIndexedBufferGeometry(n);e.strandTemplate={vertex:l.attributes.position.array,normal:l.attributes.normal.array,index:l.attributes.index.array,geometry:l};var h=e.model.atoms,f=e.model.residues;e.strandArrays={startIndex:f.atomStartIndex,endIndex:f.atomEndIndex,x:h.x,y:h.y,z:h.z,name:h.name}}function i(e,t){for(var n=t.state,i=t.params,o=(t.model.atoms,t.model.residues,t.builder),a=0,s=e.residueCount;s>a;a++){n.vertexMap.startElement(e.residueIndex[a]);var u=n.verticesDone;n.residueIndex=a;var c=e.structureStarts.has(e.residueIndex[a]),l=e.structureEnds.has(e.residueIndex[a]);if(t.isTrace||e.backboneOnly)switch(e.residueType[a]){case 5:o.addTube(e,n,i.strandWidth,i.strandWidth),(c||l)&&o.addTubeCap(e,n,i.strandWidth,i.strandWidth,c,l),t.strandTemplate||r(t),o.addStrandLine(e,n,t.strandTemplate,t.strandArrays,e.residueIndex[a]);break;default:o.addTube(e,n,i.turnWidth,i.turnWidth),(c||l)&&o.addTubeCap(e,n,i.turnWidth,i.turnWidth,c,l)}else switch(e.residueType[a]){case 1:o.addTube(e,n,i.helixWidth,i.helixHeight),c?o.addTubeCap(e,n,i.helixWidth,i.helixHeight,!0,!1):l&&o.addTubeCap(e,n,i.helixWidth,i.helixHeight,!1,!0);break;case 3:o.addSheet(e,n,c,l),(c||l)&&o.addSheetCap(e,n,c,l);break;case 5:o.addTube(e,n,i.strandWidth,i.strandWidth),(c||l)&&o.addTubeCap(e,n,i.strandWidth,i.strandWidth,c,l),t.strandTemplate||r(t),o.addStrandLine(e,n,t.strandTemplate,t.strandArrays,e.residueIndex[a]);break;default:o.addTube(e,n,i.turnWidth,i.turnWidth),(c||l)&&o.addTubeCap(e,n,i.turnWidth,i.turnWidth,c,l)}n.vertexMap.addVertexRange(u,n.verticesDone),n.vertexMap.endElement()}}function o(e,t,n){var r=1e4;if(e>=t.units.length)return n(),void 0;if(t.computation.abortRequested)return t.computation.abort(),void 0;for(var a=0,s=e;r>a&&s<t.units.length;)i(t.units[s],t),a+=t.units[s].residueCount,s++;t.computation.update("Building units...",t.computation.abortRequest,e,t.units.length),t.computation.schedule(function(){return o(s,t,n)})}function a(e){var n=e.state,r=new Float32Array(s.compact(n.vertexBuffer)),i=new Float32Array(s.compact(n.normalBuffer)),o=new Float32Array(3*n.verticesDone),a=new Float32Array(4*n.verticesDone),u=new Uint32Array(s.compact(n.indexBuffer)),c=new Float32Array(n.verticesDone),l=new t.THREE.BufferGeometry;l.addAttribute("position",new t.THREE.BufferAttribute(r,3)),l.addAttribute("normal",new t.THREE.BufferAttribute(i,3)),l.addAttribute("index",new t.THREE.BufferAttribute(u,1)),l.addAttribute("color",new t.THREE.BufferAttribute(o,3)),e.geom.vertexStateBuffer=new t.THREE.BufferAttribute(c,1),l.addAttribute("vState",e.geom.vertexStateBuffer),e.geom.geometry=l;for(var h=e.geom.vertexMap,f={r:.45,g:.45,b:.45},p=h.vertexRanges,d=0,m=h.elementIndices;d<m.length;d++){var v=m[d],g=h.elementMap.get(v),y=h.elementRanges[2*g],b=h.elementRanges[2*g+1];if(y!==b){t.Selection.Picking.assignPickColor(v,f);for(var x=y;b>x;x+=2)for(var w=p[x],_=p[x+1],C=w;_>C;C++)a[4*C]=f.r,a[4*C+1]=f.g,a[4*C+2]=f.b}}var E=new t.THREE.BufferGeometry;E.addAttribute("position",new t.THREE.BufferAttribute(r,3)),E.addAttribute("index",new t.THREE.BufferAttribute(u,1)),E.addAttribute("pColor",new t.THREE.BufferAttribute(a,4)),e.geom.pickGeometry=E}var s=e.Core.Utils.ChunkedArray,u=e.Core.Utils.ArrayBuilder,c=function(){function e(e){this.typeBuilder=u.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=u.forArray(e+4),this.uPositionsBuilder=u.forVertex3D(e+4),this.vPositionsBuilder=u.forVertex3D(e+4),this.pPositionsBuilder=u.forVertex3D(e+4),this.dPositionsBuilder=u.forVertex3D(e+4),u.add(this.typeBuilder,0),u.add(this.typeBuilder,0),u.add3(this.uPositionsBuilder,0,0,0),u.add3(this.uPositionsBuilder,0,0,0),u.add3(this.vPositionsBuilder,0,0,0),u.add3(this.vPositionsBuilder,0,0,0)}return e.prototype.addResidue=function(e,t,n){var r=t.atomStartIndex[e],i=t.atomEndIndex[e],o=!1,a=!1,s=t.name;if(5!==n)for(var c=r;i>c&&(o||"CA"!==s[c]?a||"O"!==s[c]||(u.add3(this.vPositionsBuilder,t.x[c],t.y[c],t.z[c]),a=!0):(u.add3(this.uPositionsBuilder,t.x[c],t.y[c],t.z[c]),o=!0),!o||!a);c++);else if(i-r===1)u.add3(this.uPositionsBuilder,t.x[r],t.y[r],t.z[r]),o=!0;else{for(var l=-1,c=r;i>c&&(o||"O5'"!==s[c]?a||"C3'"!==s[c]||(u.add3(this.vPositionsBuilder,t.x[c],t.y[c],t.z[c]),a=!0):(u.add3(this.uPositionsBuilder,t.x[c],t.y[c],t.z[c]),o=!0),"P"===s[c]&&(l=c),!o||!a);c++);!o&&!a&&l>=0&&(u.add3(this.uPositionsBuilder,t.x[l],t.y[l],t.z[l]),o=!0)}var h=!1;if(a){if(!o){var f=this.vPositionsBuilder.array,p=f.length;u.add3(this.uPositionsBuilder,f[p-3],f[p-2],f[p-1]),h=!0}}else{var f=this.uPositionsBuilder.array,p=f.length;u.add3(this.vPositionsBuilder,f[p-3],f[p-2],f[p-1]),h=!0}return u.add(this.typeBuilder,n),h},e.prototype.finishResidues=function(){u.add(this.typeBuilder,0),u.add(this.typeBuilder,0),u.add3(this.uPositionsBuilder,0,0,0),u.add3(this.uPositionsBuilder,0,0,0),u.add3(this.vPositionsBuilder,0,0,0),u.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){u.add3(this.pPositionsBuilder,e.x,e.y,e.z),u.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},e}();n.CartoonAsymUnitState=c;var l=function(){function n(e,n,r){this.model=e,this.elements=n,this.linearSegmentCount=r,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=new Set,this.structureEnds=new Set,this.residueType=[],this.residueIndex=new Int32Array(0),this.backboneOnly=!1;for(var i=0,o=this.elements;i<o.length;i++){var a=o[i];this.residueCount+=a.endResidueIndex-a.startResidueIndex}var s=new c(this.residueCount);this.controlPointsBuilder=u.forVertex3D(this.residueCount*this.linearSegmentCount+1),this.torsionVectorsBuilder=u.forVertex3D(this.residueCount*this.linearSegmentCount+1),this.normalVectorsBuilder=u.forVertex3D(this.residueCount*this.linearSegmentCount+1),this.createControlPoints(s)}return n.maskSplit=function(t,n,r){for(var i=t,o=t.startResidueIndex,a=t.endResidueIndex,s=o;a>s;s++)if(n[s]){for(i.startResidueIndex!==s&&(i=new e.Core.Structure.SecondaryStructureElement(t.type,t.startResidueId,t.endResidueId),i.startResidueIndex=s);a>s&&n[s];)s++;i.endResidueIndex=s,r[r.length]=i}},n.isCartoonLike=function(e,t,n,r,i,o,a){for(var s=!1,u=!1,c=!1,l=t;n>l;l++){var h=r[e[l]];if(s||h!==i?u||h!==o||(u=!0):s=!0,s&&u)return!0;"P"===h&&(c=!0)}return a?s:c},n.createMask=function(e,t){for(var r=new Uint8Array(e.residues.count),i=e.atoms,o=i.residueIndex,a=i.name,s=e.residues.secondaryStructureIndex,u=e.secondaryStructure,c=0,l=t.length-1;l>c;c++){var h=t[c],f=c,p=o[h];for(c++;p===o[t[c]];)c++;var d=u[s[p]].type;0!==d&&(r[p]=5===d?+n.isCartoonLike(t,f,c,a,"O5'","C3'",!1):+n.isCartoonLike(t,f,c,a,"CA","O",!0),c--)}return r},n.isUnknownSecondaryStructure=function(e){for(var t=!1,n=0,r=e.secondaryStructure;n<r.length;n++){var i=r[n];if(1===i.type||3===i.type||2===i.type)return!1;4===i.type&&(t=!0)}return t},n.approximateSecondaryStructure=function(e,t){if(4!==t.type)return[t];for(var r=[],i=e.atoms.name,o=e.residues,a=o.atomStartIndex,s=o.atomEndIndex,u=new Int32Array(t.endResidueIndex-t.startResidueIndex),c=0,l=!0,h=t.startResidueIndex,f=t.endResidueIndex;f>h;h++){for(var p=!1,d=!1,m=a[h],v=s[f];v>m&&("CA"===i[m]?(p||(u[c++]=m),p=!0):"O"===i[m]&&(d=!0),!d||!p);m++);if(!p||!d){l=!1;break}}return l?(n.zhangSkolnickSStrace(e,u,t,r),r):[t]},n.zhangSkolnickSStrace=function(t,r,i,o){for(var a=new Int32Array(r.length),s=!1,u=t.atoms.residueIndex,c=0,l=r.length;l>c;c++)n.zhangSkolnickSSresidue(t,r,c,n.ZhangHelixDistance,n.ZhangHelixDelta)?(a[c]=1,s=!0):n.zhangSkolnickSSresidue(t,r,c,n.ZhangSheetDistance,n.ZhangSheetDelta)?(a[c]=3,s=!0):a[c]=i.type;if(!s)return o.push(i),void 0;for(var c=0,l=a.length;l>c;c++){var h=a[c];if(h!==i.type){for(var f=c+1;l>f&&h===a[f];)f++;if(f-c>1)c=f-1;else{for(var p=c;f>p;p++)a[p]=i.type;c=f-1}}}for(var c=0,l=a.length;l>c;c++){for(var h=a[c],f=c+1;l>f&&h===a[f];)f++;var d=new e.Core.Structure.SecondaryStructureElement(h,new e.Core.Structure.PolyResidueIdentifier("",c,null),new e.Core.Structure.PolyResidueIdentifier("",f,null));d.startResidueIndex=u[r[c]],d.endResidueIndex=u[r[f-1]]+1,o.push(d),c=f-1}},n.zhangSkolnickSSresidue=function(e,t,r,i,o){for(var a=t.length,s=e.atoms,u=s.x,c=s.y,l=s.z,h=n.ZhangP1,f=n.ZhangP2,p=Math.max(0,r-2);r>=p;p++)for(var d=2;5>d;d++)if(!(p+d>=a)){var m=t[p],v=t[p+d];if(h.set(u[m],c[m],l[m]),f.set(u[v],c[v],l[v]),Math.abs(h.distanceTo(f)-i[d-2])>o)return!1}return!0},n.throwIfEmpty=function(e){if(0===e.length)throw"Cartoons cannot be constructred from this model/selection."},n.buildUnits=function(e,t,r){for(var i=n.createMask(e,t),o=[],a=n.isUnknownSecondaryStructure(e),s=0,u=e.secondaryStructure;s<u.length;s++){var c=u[s];if(a)for(var l=n.approximateSecondaryStructure(e,c),h=0,f=l;h<f.length;h++){var p=f[h];n.maskSplit(p,i,o)}else n.maskSplit(c,i,o)}n.throwIfEmpty(o);var d=o[0],m=e.residues.asymId,v=e.residues.authSeqNumber,g=[],y=[],b=0;d.type===b&&(d=null);for(var x=0,w=o;x<w.length;x++){var c=w[x];c.type===b?(g.length>0&&y.push(new n(e,g,r)),d=null,g=[]):(null===d&&(d=c),m[d.endResidueIndex-1]!==m[c.startResidueIndex]||d!==c&&v[c.startResidueIndex]-v[d.endResidueIndex-1]>1||d.startResidueIndex!==c.startResidueIndex&&c.startResidueIndex-d.endResidueIndex>0?(g.length>0?y.push(new n(e,g,r)):null!==d&&y.push(new n(e,[d],r)),d=null,g=[c]):g[g.length]=c),d=c}return g.length>0&&y.push(new n(e,g,r)),y},n.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},n.prototype.initPositions=function(e){for(var t=this.model.residues,n=this.model.atoms,r={atomStartIndex:t.atomStartIndex,atomEndIndex:t.atomEndIndex,name:n.name,x:n.x,y:n.y,z:n.z},i=[],o=0,a=0,s=0,u=this.elements;s<u.length;s++){var c=u[s];for(this.structureStarts.add(c.startResidueIndex),this.structureEnds.add(c.endResidueIndex-1),a=c.startResidueIndex;a<c.endResidueIndex;a++)this.backboneOnly=e.addResidue(a,r,c.type),i[i.length]=c.type}this.residueIndex=new Int32Array(this.residueCount);for(var l=0,h=this.elements;l<h.length;l++){var c=h[l];for(a=c.startResidueIndex;a<c.endResidueIndex;a++)this.residueIndex[o++]=a}this.residueType=i,e.finishResidues();var f=this.residueCount;if(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],f>2){var p=2,d=3,m=4;5!==e.residueType[0]?(this.reflectPositions(e.uPositions,0,1,p,d,d,m,.4,.6),this.reflectPositions(e.vPositions,0,1,p,d,d,m,.4,.6)):(this.reflectPositions(e.uPositions,1,0,p,d,d,m,.5,.5),this.reflectPositions(e.vPositions,1,0,p,d,d,m,.5,.5)),p=f+1,d=f,m=f-1,5!==e.residueType[f-1]?(this.reflectPositions(e.uPositions,f+2,f+3,p,d,d,m,.4,.6),this.reflectPositions(e.vPositions,f+2,f+3,p,d,d,m,.4,.6)):(this.reflectPositions(e.uPositions,f+2,f+3,p,d,d,m,.5,.5),this.reflectPositions(e.vPositions,f+2,f+3,p,d,d,m,.5,.5))}else if(2===f)for(a=0;2>a;a++)e.uPositions[3*a]=e.uPositions[6],e.uPositions[3*a+1]=e.uPositions[7],e.uPositions[3*a+2]=e.uPositions[8],e.vPositions[3*a]=e.vPositions[6],e.vPositions[3*a+1]=e.vPositions[7],e.vPositions[3*a+2]=e.vPositions[8],e.uPositions[3*(f+2)+3*a]=e.uPositions[3*(f+1)],e.uPositions[3*(f+2)+3*a+1]=e.uPositions[3*(f+1)+1],e.uPositions[3*(f+2)+3*a+2]=e.uPositions[3*(f+1)+2],e.vPositions[3*(f+2)+3*a]=e.vPositions[3*(f+1)],e.vPositions[3*(f+2)+3*a+1]=e.vPositions[3*(f+1)+1],e.vPositions[3*(f+2)+3*a+2]=e.vPositions[3*(f+1)+2];
else for(var v=[e.uPositions[6]-e.vPositions[6],e.uPositions[7]-e.vPositions[7],e.uPositions[8]-e.vPositions[8]],g=0;2>g;g++)for(var y=0;3>y;y++)e.uPositions[3*g+y]=e.uPositions[6+y]-.5*(g+1)*v[y],e.uPositions[9+3*g+y]=e.uPositions[6+y]+.5*(g+1)*v[y],e.vPositions[3*g+y]=e.vPositions[6+y]+.5*(g+1)*v[y],e.vPositions[9+3*g+y]=e.vPositions[6+y]-.5*(g+1)*v[y]},n.prototype.initControlsPoints=function(e){for(var n=new t.THREE.Vector3,r=e.uvLength-1,i=new t.THREE.Vector3,o=new t.THREE.Vector3,a=new t.THREE.Vector3,s=new t.THREE.Vector3,u=new t.THREE.Vector3,c=new t.THREE.Vector3,l=new t.THREE.Vector3,h=new t.THREE.Vector3,f=1,p=0;r>p;p++)u.set(e.uPositions[3*p],e.uPositions[3*p+1],e.uPositions[3*p+2]),c.set(e.vPositions[3*p],e.vPositions[3*p+1],e.vPositions[3*p+2]),p++,l.set(e.uPositions[3*p],e.uPositions[3*p+1],e.uPositions[3*p+2]),p--,h.set((u.x+l.x)/2,(u.y+l.y)/2,(u.z+l.z)/2),i.subVectors(l,u),o.subVectors(c,u),a.crossVectors(i,o),s.crossVectors(a,i),a.normalize(),s.normalize(),e.residueType[p]===f&&e.residueType[p+1]===f&&h.set(h.x+1.5*a.x,h.y+1.5*a.y,h.z+1.5*a.z),p>0&&s.angleTo(n)>Math.PI/2&&s.negate(),n.copy(s),i.addVectors(h,s),e.addControlPoint(h,i);e.finishContols()},n.prototype.computeSplines=function(e){for(var r=new t.THREE.Vector3,i=new t.THREE.Vector3,o=new t.THREE.Vector3,a=e.residueCount,s=e.pPositions,u=e.dPositions,c=new t.THREE.Vector3,l=new t.THREE.Vector3,h=new t.THREE.Vector3,f=new t.THREE.Vector3,p=new t.THREE.Vector3,d=new t.THREE.Vector3,m=new t.THREE.Vector3,v=new t.THREE.Vector3,g=new t.THREE.Vector3,y=new t.THREE.Vector3,b=0;a>b;b++){c.set(s[3*b],s[3*b+1],s[3*b+2]),b++,l.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++,f.set(s[3*b],s[3*b+1],s[3*b+2]),b-=3,p.set(u[3*b],u[3*b+1],u[3*b+2]),b++,d.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-=3;for(var x=1;x<=this.linearSegmentCount;x++){var w=1*x/this.linearSegmentCount;.5>w?(n.spline(i,c,l,h,w+.5),n.spline(o,p,d,m,w+.5)):(n.spline(i,l,h,f,w-.5),n.spline(o,d,m,v,w-.5)),0===b&&1===x&&(n.spline(r,c,l,h,.5),n.spline(g,p,d,m,.5),n.reflect(y,r,i,1),this.addSplineNode(y,r,g)),this.addSplineNode(r,i,o),r.copy(i)}}},n.prototype.addSplineNode=function(e,t,n){u.add3(this.controlPointsBuilder,t.x,t.y,t.z);var r=this.tempA.subVectors(n,t);r.normalize(),u.add3(this.torsionVectorsBuilder,r.x,r.y,r.z);var i=this.tempB.subVectors(t,e),o=this.tempC.crossVectors(r,i);o.normalize(),u.add3(this.normalVectorsBuilder,o.x,o.y,o.z)},n.prototype.reflectPositions=function(e,t,r,i,o,a,s,u,c){this.tempA.set(e[3*i],e[3*i+1],e[3*i+2]),this.tempB.set(e[3*o],e[3*o+1],e[3*o+2]),n.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*a],e[3*a+1],e[3*a+2]),this.tempB.set(e[3*s],e[3*s+1],e[3*s+2]),n.reflect(this.tempC,this.tempA,this.tempB,c),e[3*r]=this.tempC.x,e[3*r+1]=this.tempC.y,e[3*r+2]=this.tempC.z},n.reflect=function(e,t,n,r){e.set(t.x-r*(n.x-t.x),t.y-r*(n.y-t.y),t.z-r*(n.z-t.z))},n.spline=function(e,t,n,r,i){var o=Math.pow(1-i,2)/2,a=Math.pow(i,2)/2,s=1-o-a,u=o*t.x+s*n.x+a*r.x,c=o*t.y+s*n.y+a*r.y,l=o*t.z+s*n.z+a*r.z;e.set(u,c,l)},n}();l.ZhangHelixDistance=[5.45,5.18,6.37],l.ZhangHelixDelta=2.1,l.ZhangSheetDistance=[6.1,10.4,13],l.ZhangSheetDelta=1.42,l.ZhangP1=new t.THREE.Vector3(0,0,0),l.ZhangP2=new t.THREE.Vector3(0,0,0),n.CartoonAsymUnit=l;var h=function(){function e(){this.radialSegmentCount=10,this.turnWidth=.1,this.strandWidth=.15,this.strandLineWidth=.1,this.helixWidth=1.1,this.helixHeight=.1,this.sheetWidth=1.1,this.sheetHeight=.1,this.arrowWidth=1.7,this.tessalation=2}return e}();h.Default=new h,n.CartoonsGeometryParams=h;var f=function(){function e(e,n){this.params=e,this.residueIndex=0,this.verticesDone=0,this.trianglesDone=0,this.vertexBuffer=s.forVertex3D(),this.normalBuffer=s.forVertex3D(),this.indexBuffer=s.forIndexBuffer(),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(n)}return e.prototype.addVertex=function(e,t){s.add3(this.vertexBuffer,e.x,e.y,e.z),s.add3(this.normalBuffer,t.x,t.y,t.z),this.verticesDone++},e.prototype.addTriangle=function(e,t,n){s.add3(this.indexBuffer,e,t,n),this.trianglesDone++},e.prototype.addTriangles=function(e,t,n,r,i,o){s.add3(this.indexBuffer,e,t,n),s.add3(this.indexBuffer,r,i,o),this.trianglesDone+=2},e}();n.CartoonsGeometryState=f,n.buildUnit=i,n.buildUnitsChunk=o,n.createGeometry=a;var p=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]}return e.prototype.setVector=function(e,t,n){return n.set(e[3*t],e[3*t+1],e[3*t+2]),n},e.prototype.addTube=function(e,t,n,r){var i=t.verticesDone,o=0,a=0,s=this.tempVectors[0],u=this.tempVectors[1],c=this.tempVectors[2],l=this.tempVectors[3],h=this.tempVectors[4],f=this.tempVectors[5],p=this.tempVectors[6],d=t.residueIndex*e.linearSegmentCount,m=d+e.linearSegmentCount,v=e.controlPoints,g=e.linearSegmentCount+1,y=e.torsionVectors,b=e.normalVectors,x=t.params.radialSegmentCount;for(o=d;m>=o;o++)for(this.setVector(y,o,f),this.setVector(b,o,p),a=0;x>a;a++){var w=2*Math.PI*a/x;l.copy(f),h.copy(p),s.addVectors(l.multiplyScalar(n*Math.cos(w)),h.multiplyScalar(r*Math.sin(w))),l.copy(f),h.copy(p),u.addVectors(l.multiplyScalar(r*Math.cos(w)),h.multiplyScalar(n*Math.sin(w))),u.normalize(),this.setVector(v,o,c),c.add(s),t.addVertex(c,u)}for(o=0;g-1>o;o++)for(a=0;x>a;a++)t.addTriangles(i+o*x+a,i+(o+1)*x+(a+1)%x,i+o*x+(a+1)%x,i+o*x+a,i+(o+1)*x+a,i+(o+1)*x+(a+1)%x)},e.prototype.addTubeCap=function(e,t,n,r,i,o){var a,s=t.verticesDone,u=this.tempVectors[0],c=this.tempVectors[1],l=this.tempVectors[2],h=this.tempVectors[3],f=this.tempVectors[4],p=this.tempVectors[5],d=this.tempVectors[6],m=this.tempVectors[7],v=t.residueIndex*e.linearSegmentCount,g=e.controlPoints,y=e.linearSegmentCount+1,b=e.torsionVectors,x=e.normalVectors,w=t.params.radialSegmentCount;this.setVector(b,v,d),this.setVector(x,v,m),c.crossVectors(d,m),o&&c.negate();var _=v+(i?0:y-1);this.setVector(g,_,u),t.addVertex(u,c),this.setVector(b,_,f),this.setVector(x,_,p);for(var C=0;w>C;C++)a=2*Math.PI*C/w,l.copy(f),h.copy(p),u.addVectors(l.multiplyScalar(Math.cos(a)*n),h.multiplyScalar(Math.sin(a)*r)),this.setVector(g,_,d),u.add(d),t.addVertex(u,c),i?t.addTriangle(s,s+C+1,s+(C+1)%w+1):t.addTriangle(s,s+(C+1)%w+1,s+C+1)},e.prototype.addSheet=function(e,t,n,r){var i=t.verticesDone,o=t.params,a=0,s=0,u=this.tempVectors[0],c=this.tempVectors[1],l=this.tempVectors[2],h=this.tempVectors[3],f=this.tempVectors[4],p=this.tempVectors[5],d=(this.tempVectors[6],this.tempVectors[7]),m=this.tempVectors[8],v=this.tempVectors[9],g=t.residueIndex*e.linearSegmentCount,y=g+e.linearSegmentCount,b=e.controlPoints,x=(e.linearSegmentCount+1,e.torsionVectors),w=e.normalVectors,_=(t.params.radialSegmentCount,0),C=0;for(h.set(0,0,0),r&&(this.setVector(b,y,d),this.setVector(b,g,m),_=o.arrowWidth/p.subVectors(d,m).length()),a=g;y>=a;a++)C=r?o.arrowWidth*(1-(a-g)/e.linearSegmentCount):o.sheetWidth,this.setVector(x,a,u),u.multiplyScalar(C),this.setVector(w,a,c),c.multiplyScalar(o.sheetHeight),r&&(this.setVector(w,a,d),this.setVector(x,a,m),h.crossVectors(d,m).multiplyScalar(_)),this.setVector(b,a,l),this.setVector(w,a,f),this.setVector(x,a,v),d.copy(l).add(u).add(c),m.copy(f),t.addVertex(d,m),d.copy(l).sub(u).add(c),t.addVertex(d,m),d.copy(l).sub(u).add(c),m.copy(v).negate().add(h),t.addVertex(d,m),d.copy(l).sub(u).sub(c),t.addVertex(d,m),d.copy(l).sub(u).sub(c),m.copy(f).negate(),t.addVertex(d,m),d.copy(l).add(u).sub(c),t.addVertex(d,m),d.copy(l).add(u).sub(c),m.copy(v).add(h),t.addVertex(d,m),d.copy(l).add(u).add(c),t.addVertex(d,m);for(a=0;a<e.linearSegmentCount;a++)for(s=0;4>s;s++)t.addTriangles(i+8*a+2*s,i+8*(a+1)+2*s+1,i+8*a+2*s+1,i+8*a+2*s,i+8*(a+1)+2*s,i+8*(a+1)+2*s+1)},e.prototype.addSheetCap=function(e,t,n){var r=t.params,i=t.residueIndex*e.linearSegmentCount,o=this.setVector(e.controlPoints,i,this.tempVectors[0]),a=this.setVector(e.torsionVectors,i,this.tempVectors[1]).multiplyScalar(r.sheetWidth),s=this.setVector(e.normalVectors,i,this.tempVectors[2]).multiplyScalar(r.sheetHeight),u=this.tempVectors[3].addVectors(o,a).add(s),c=this.tempVectors[4].subVectors(o,a).add(s),l=this.tempVectors[5].subVectors(o,a).sub(s),h=this.tempVectors[6].addVectors(o,a).sub(s);if(n)this.addSheepCapSection(t,u,c,l,h);else{var f=this.setVector(e.torsionVectors,i,this.tempVectors[7]).multiplyScalar(r.arrowWidth),p=this.tempVectors[8].addVectors(o,f).add(s),d=this.tempVectors[9].subVectors(o,f).add(s),m=this.tempVectors[10].subVectors(o,f).sub(s),v=this.tempVectors[11].addVectors(o,f).sub(s);this.addSheepCapSection(t,p,u,h,v),this.addSheepCapSection(t,c,d,m,l)}},e.prototype.addSheepCapSection=function(e,t,n,r,i){var o=e.verticesDone,a=this.tempVectors[12].crossVectors(this.tempVectors[13].subVectors(n,t),this.tempVectors[14].subVectors(i,t)).normalize();e.addVertex(t,a),e.addVertex(n,a),e.addVertex(r,a),e.addVertex(i,a),e.addTriangles(o,o+1,o+2,o+2,o+3,o)},e.prototype.findN3=function(e,t,n){for(var r=t.startIndex[e],i=t.endIndex[e],o=(t.name,!1),a=r;i>a;a++)if("N3"===t.name[a]){n.set(t.x[a],t.y[a],t.z[a]),o=!0;break}return o},e.prototype.addStrandLine=function(e,n,r,i,o){if(this.findN3(o,i,this.tempVectors[3])){var a,s=this.tempVectors[0],u=this.tempVectors[1],c=r.vertex,l=r.normal,h=r.index,f=n.verticesDone,p=c.length,d=h.length,m=n.residueIndex*e.linearSegmentCount+(.5*e.linearSegmentCount+1|0),v=this.setVector(e.controlPoints,m,this.tempVectors[2]),g=this.tempVectors[3].sub(v),y=g.length();for(g.normalize(),n.translationMatrix.makeTranslation(v.x,v.y,v.z),n.scaleMatrix.makeScale(1,1,y),n.rotationMatrix.makeRotationAxis(new t.THREE.Vector3(-g.y,g.x,0),Math.acos(g.z)),n.translationMatrix.multiply(n.rotationMatrix).multiply(n.scaleMatrix),r.geometry.applyMatrix(n.translationMatrix),a=0;p>a;a+=3)s.set(c[a],c[a+1],c[a+2]),u.set(l[a],l[a+1],l[a+2]),n.addVertex(s,u);for(a=0;d>a;a+=3)n.addTriangle(f+h[a],f+h[a+1],f+h[a+2]);n.invMatrix.getInverse(n.translationMatrix),r.geometry.applyMatrix(n.invMatrix)}},e}();n.Builder=p}(r=n.Geometry||(n.Geometry={}))}(r=n.Cartoons||(n.Cartoons={}))}(n=t.Molecule||(t.Molecule={}))}(t=e.Visualization||(e.Visualization={}))}(a||(a={}));var a;!function(e){var t;!function(t){var n;!function(n){var r;!function(n){var r;!function(e){e[e.Default=0]="Default",e[e.AlphaTrace=1]="AlphaTrace"}(r=n.CartoonsModelType||(n.CartoonsModelType={})),n.DefaultCartoonsModelParameters={tessalation:3,drawingType:r.Default};var i=function(i){function o(){return i.apply(this,arguments)||this}return c(o,i),o.prototype.applySelectionInternal=function(e,n){for(var r=this.cartoons.vertexStateBuffer,i=r.array,o=this.cartoons.vertexMap,a=o.vertexRanges,s=!1,u=this.model.atoms.residueIndex,c=0,l=e.length;l>c;c++){var h=u[e[c]];for(c++;u[e[c]]===h;)c++;if(c--,o.elementMap.has(h)){var f=o.elementMap.get(h),p=o.elementRanges[2*f],d=o.elementRanges[2*f+1];if(p!==d)for(var m=p;d>m;m+=2){var v=a[m],g=a[m+1];s=t.Selection.applyActionToRange(i,v,g,n)||s}}}return s?(r.needsUpdate=!0,!0):!1},o.prototype.getPickElements=function(e){for(var t=this.model.residues,n=t.atomStartIndex,r=t.atomEndIndex,i=[],o=n[e],a=r[e];a>o;o++)this.queryContext.hasAtom(o)&&i.push(o);return i},o.prototype.highlightElement=function(e,t){return this.applySelection([this.model.residues.atomStartIndex[e]],t?3:4)},o.prototype.highlightInternal=function(e){return t.Selection.applyActionToBuffer(this.cartoons.vertexStateBuffer,e?3:4)},o.prototype.applyColoring=function(e){for(var t=this.model.residues,n=t.atomStartIndex,r=t.atomEndIndex,i={r:.1,g:.1,b:.1},o={r:.1,g:.1,b:.1},a=this.cartoons.vertexMap,s=(a.elementIndices,this.cartoons.geometry.attributes.color),u=s.array,c=a.vertexRanges,l=0,h=this.model.residues.count;h>l;l++){o.r=0,o.g=0,o.b=0;for(var f=0,p=n[l],d=r[l];d>p;p++)this.queryContext.hasAtom(p)&&(e.setElementColor(p,i),o.r+=i.r,o.g+=i.g,o.b+=i.b,f++);if(f){i.r=o.r/f,i.g=o.g/f,i.b=o.b/f;var m=a.elementMap.get(l),v=a.elementRanges[2*m],g=a.elementRanges[2*m+1];if(v!==g)for(var y=v;g>y;y+=2)for(var b=c[y],x=c[y+1],w=b;x>w;w++)u[3*w]=i.r,u[3*w+1]=i.g,u[3*w+2]=i.b}}s.needsUpdate=!0},o.prototype.applyThemeInternal=function(e){this.cartoons.vertexMap;this.applyColoring(e),t.MaterialsHelper.updateMaterial(this.material,e,this.object)},o.prototype.createObjects=function(){return{main:new t.THREE.Mesh(this.cartoons.geometry,this.material),pick:new t.THREE.Mesh(this.cartoons.pickGeometry,this.pickMaterial)}},o.create=function(i,a){var s=a.model,u=a.queryContext,c=a.atomIndices,l=a.theme,h=a.params,f=a.props;return e.Core.Computation.create(function(a){var p=0,d=0;switch(a.update("Computing cartoons..."),h=e.Core.Utils.extend({},h,n.DefaultCartoonsModelParameters),h.tessalation){case 0:p=1,d=2;break;case 1:p=4,d=3;break;case 2:p=6,d=5;break;case 3:p=10,d=8;break;case 4:p=12,d=10;break;case 5:p=16,d=14;break;default:p=18,d=16}n.Geometry.create(s,c,p,{radialSegmentCount:d,tessalation:h.tessalation},h.drawingType===r.AlphaTrace,a,function(e){var n=new o;n.cartoons=e,n.queryContext=u,n.material=t.MaterialsHelper.getMeshMaterial(),n.pickMaterial=t.MaterialsHelper.getPickMaterial(),f&&(n.props=f),n.entity=i,n.cartoons.geometry.computeBoundingSphere(),n.centroid=n.cartoons.geometry.boundingSphere.center,n.radius=n.cartoons.geometry.boundingSphere.radius;var r=n.createObjects();n.object=r.main,n.pickObject=r.pick,n.pickBufferAttributes=[n.cartoons.pickGeometry.attributes.pColor],n.model=s,n.applyTheme(l),n.disposeList.push(n.cartoons,n.material,n.pickMaterial),a.resolve(n)})})},o}(t.Model);n.Model=i}(r=n.Cartoons||(n.Cartoons={}))}(n=t.Molecule||(t.Molecule={}))}(t=e.Visualization||(e.Visualization={}))}(a||(a={}));var a;!function(e){var t;!function(e){var t;!function(e){var t;!function(e){e.DefaultBondColor={r:.6,g:.6,b:.6},e.DefaultElementColor={r:.6,g:.6,b:.6},e.DefaultElementColorMap=new Map,e.DefaultPallete=[],function(){for(var t=[["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]],n=(new Map,0),r=t;n<r.length;n++){var i=r[n],o=i[0],a={r:i[1],g:i[2],b:i[3]};e.DefaultElementColorMap.set(o,a),e.DefaultElementColorMap.set(o.toUpperCase(),a),e.DefaultElementColorMap.set(o.toLowerCase(),a),e.DefaultPallete.push(a)}}()}(t=e.Colors||(e.Colors={}))}(t=e.Molecule||(e.Molecule={}))}(t=e.Visualization||(e.Visualization={}))}(a||(a={}));var a;!function(e){var t;!function(t){var n;!function(n){function r(n,r,o){var a=new t.THREE.IcosahedronGeometry(r,o),s=t.GeometryHelper.toSurface(a);return(0!==n.x||0!==n.y||0!==n.z)&&e.Core.Geometry.Surface.transformImmediate(s,i.Matrix4.fromTranslation(i.Matrix4.empty(),[n.x,n.y,n.z])),s}var i=e.Core.Geometry.LinearAlgebra;n.createSphereSurface=r}(n=t.Primitive||(t.Primitive={}))}(t=e.Visualization||(e.Visualization={}))}(a||(a={}));var a;!function(e){var t;!function(t){var n;!function(n){function r(r){return e.Core.Computation.create(function(e){e.update("Building surface..."),e.schedule(function(){for(var o=new Map,a=0,s=r;a<s.length;a++){var u=s[a];if("Sphere"===u.type&&!o.has(u.tessalation||0)){{n.createSphereSurface({x:0,y:0,z:0},1,u.tessalation||0)}o.set(u.tessalation||0,n.createSphereSurface({x:0,y:0,z:0},1,u.tessalation||0))}}for(var c={vertexCount:0,triangleCount:0},l=0,h=r;l<h.length;l++){var u=h[l];switch(u.type){case"Sphere":var f=o.get(u.tessalation||0);c.vertexCount+=f.vertexCount,c.triangleCount+=f.triangleCount;break;case"Surface":c.vertexCount+=u.surface.vertexCount,c.triangleCount+=u.surface.triangleCount}}for(var p,d=new Float32Array(3*c.vertexCount),m=new Float32Array(3*c.vertexCount),v=new Uint32Array(3*c.triangleCount),g=new Int32Array(c.vertexCount),y=0,b=0,x=0,w=0,_=new t.THREE.Vector3,C=new t.THREE.Matrix4,E=0,S=r;E<S.length;E++){var u=S[E],M=void 0,T=y/3|0;switch(u.type){case"Sphere":M=o.get(u.tessalation||0),p=M.vertices;for(var A=0,P=3*M.vertexCount;P>A;A+=3)_.x=p[A],_.y=p[A+1],_.z=p[A+2],_.applyMatrix4(C.makeScale(u.radius,u.radius,u.radius)),_.applyMatrix4(C.makeTranslation(u.center.x,u.center.y,u.center.z)),d[y++]=_.x,d[y++]=_.y,d[y++]=_.z;break;case"Surface":M=u.surface,i.computeNormalsImmediate(M),p=M.vertices;for(var A=0,P=p.length;P>A;A++)d[y++]=p[A]}p=M.normals;for(var A=0,P=p.length;P>A;A++)m[b++]=p[A];for(var k=M.triangleIndices,A=0,P=k.length;P>A;A++)v[x++]=T+k[A];for(var A=0,P=M.vertexCount;P>A;A++)g[w++]=u.id}var R={vertices:d,vertexCount:c.vertexCount,triangleIndices:v,triangleCount:c.triangleCount,normals:m,annotation:g};e.resolve(R)})})}var i=e.Core.Geometry.Surface,o=function(){function e(){this.shapes=[]}return e.prototype.add=function(e){return this.shapes.push(e),this},e.prototype.buildSurface=function(){return r(this.shapes)},e.create=function(){return new e},e}();n.Builder=o}(n=t.Primitive||(t.Primitive={}))}(t=e.Visualization||(e.Visualization={}))}(a||(a={}));var a;!function(e){var t;!function(e){var t;!function(e){var t=function(){function e(){}return e.getRandomColor=function(t){void 0===t&&(t=0);for(var n=0;;){n++;var r=e.randomMix({r:166/255,g:0,b:100/255},{r:1,g:1,b:0},{r:0,g:100/255,b:1},t),i=Math.abs(e.previous.r-r.r)+Math.abs(e.previous.g-r.g)+Math.abs(e.previous.b-r.b);if(i>100||10===n)return e.previous=r,r}},e.randomMix=function(e,t,n,r){var i=0|Math.floor(3*Math.random()),o=0===i?Math.random()*r:Math.random(),a=1===i?Math.random()*r:Math.random(),s=2===i?Math.random()*r:Math.random(),u=o+a+s;return o/=u,a/=u,s/=u,{r:o*e.r+a*t.r+s*n.r,g:o*e.g+a*t.g+s*n.g,b:o*e.b+a*t.b+s*n.b}},e.interpolate=function(e,t,n,r,i,o){var a=void 0!==o?o:{r:.1,g:.1,b:.1},s=(i-e)/(n-e);return a.r=t.r+(r.r-t.r)*s,a.g=t.g+(r.g-t.g)*s,a.b=t.b+(r.b-t.b)*s,a},e}();t.previous=t.randomMix({r:.75,g:0,b:.25},{r:1,g:.5,b:0},{r:0,g:.35,b:1},.5),e.Palette=t}(t=e.Utils||(e.Utils={}))}(t=e.Visualization||(e.Visualization={}))}(a||(a={}));var l;!function(e,t){l=t()}({},function(){function e(e,t){t&&(e.prototype=Object.create(t.prototype)),e.prototype.constructor=e}function t(e){return o(e)?e:P(e)}function n(e){return a(e)?e:k(e)}function r(e){return s(e)?e:R(e)}function i(e){return o(e)&&!u(e)?e:I(e)}function o(e){return!(!e||!e[cr])}function a(e){return!(!e||!e[lr])}function s(e){return!(!e||!e[hr])}function u(e){return a(e)||s(e)}function c(e){return!(!e||!e[fr])}function l(e){return e.value=!1,e}function h(e){e&&(e.value=!0)}function f(){}function p(e,t){t=t||0;for(var n=Math.max(0,e.length-t),r=new Array(n),i=0;n>i;i++)r[i]=e[i+t];return r}function d(e){return void 0===e.size&&(e.size=e.__iterate(v)),e.size}function m(e,t){if("number"!=typeof t){var n=t>>>0;if(""+n!==t||4294967295===n)return 0/0;t=n}return 0>t?d(e)+t:t}function v(){return!0}function g(e,t,n){return(0===e||void 0!==n&&-n>=e)&&(void 0===t||void 0!==n&&t>=n)}function y(e,t){return x(e,t,0)}function b(e,t){return x(e,t,t)}function x(e,t,n){return void 0===e?n:0>e?Math.max(0,t+e):void 0===t?e:Math.min(t,e)}function w(e){this.next=e}function _(e,t,n,r){var i=0===e?t:1===e?n:[t,n];return r?r.value=i:r={value:i,done:!1},r}function C(){return{value:void 0,done:!0}}function E(e){return!!T(e)}function S(e){return e&&"function"==typeof e.next}function M(e){var t=T(e);return t&&t.call(e)}function T(e){var t=e&&(Cr&&e[Cr]||e[Er]);return"function"==typeof t?t:void 0}function A(e){return e&&"number"==typeof e.length}function P(e){return null===e||void 0===e?O():o(e)?e.toSeq():z(e)}function k(e){return null===e||void 0===e?O().toKeyedSeq():o(e)?a(e)?e.toSeq():e.fromEntrySeq():F(e)}function R(e){return null===e||void 0===e?O():o(e)?a(e)?e.entrySeq():e.toIndexedSeq():U(e)}function I(e){return(null===e||void 0===e?O():o(e)?a(e)?e.entrySeq():e:U(e)).toSetSeq()}function D(e){this._array=e,this.size=e.length}function B(e){var t=Object.keys(e);this._object=e,this._keys=t,this.size=t.length}function V(e){this._iterable=e,this.size=e.length||e.size}function L(e){this._iterator=e,this._iteratorCache=[]}function N(e){return!(!e||!e[Mr])}function O(){return Tr||(Tr=new D([]))}function F(e){var t=Array.isArray(e)?new D(e).fromEntrySeq():S(e)?new L(e).fromEntrySeq():E(e)?new V(e).fromEntrySeq():"object"==typeof e?new B(e):void 0;if(!t)throw new TypeError("Expected Array or iterable object of [k, v] entries, or keyed object: "+e);return t}function U(e){var t=$(e);if(!t)throw new TypeError("Expected Array or iterable object of values: "+e);return t}function z(e){var t=$(e)||"object"==typeof e&&new B(e);if(!t)throw new TypeError("Expected Array or iterable object of values, or keyed object: "+e);return t}function $(e){return A(e)?new D(e):S(e)?new L(e):E(e)?new V(e):void 0}function H(e,t,n,r){var i=e._cache;if(i){for(var o=i.length-1,a=0;o>=a;a++){var s=i[n?o-a:a];if(t(s[1],r?s[0]:a,e)===!1)return a+1}return a}return e.__iterateUncached(t,n)}function j(e,t,n,r){var i=e._cache;if(i){var o=i.length-1,a=0;return new w(function(){var e=i[n?o-a:a];return a++>o?C():_(t,r?e[0]:a-1,e[1])})}return e.__iteratorUncached(t,n)}function G(e,t){return t?W(t,e,"",{"":e}):q(e)}function W(e,t,n,r){return Array.isArray(t)?e.call(r,n,R(t).map(function(n,r){return W(e,n,r,t)})):X(t)?e.call(r,n,k(t).map(function(n,r){return W(e,n,r,t)})):t}function q(e){return Array.isArray(e)?R(e).map(q).toList():X(e)?k(e).map(q).toMap():e}function X(e){return e&&(e.constructor===Object||void 0===e.constructor)}function Y(e,t){if(e===t||e!==e&&t!==t)return!0;if(!e||!t)return!1;if("function"==typeof e.valueOf&&"function"==typeof t.valueOf){if(e=e.valueOf(),t=t.valueOf(),e===t||e!==e&&t!==t)return!0;if(!e||!t)return!1}return"function"==typeof e.equals&&"function"==typeof t.equals&&e.equals(t)?!0:!1}function K(e,t){if(e===t)return!0;if(!o(t)||void 0!==e.size&&void 0!==t.size&&e.size!==t.size||void 0!==e.__hash&&void 0!==t.__hash&&e.__hash!==t.__hash||a(e)!==a(t)||s(e)!==s(t)||c(e)!==c(t))return!1;if(0===e.size&&0===t.size)return!0;var n=!u(e);if(c(e)){var r=e.entries();return t.every(function(e,t){var i=r.next().value;return i&&Y(i[1],e)&&(n||Y(i[0],t))})&&r.next().done}var i=!1;if(void 0===e.size)if(void 0===t.size)"function"==typeof e.cacheResult&&e.cacheResult();else{i=!0;var l=e;e=t,t=l}var h=!0,f=t.__iterate(function(t,r){return(n?e.has(t):i?Y(t,e.get(r,gr)):Y(e.get(r,gr),t))?void 0:(h=!1,!1)});return h&&e.size===f}function Q(e,t){if(!(this instanceof Q))return new Q(e,t);if(this._value=e,this.size=void 0===t?1/0:Math.max(0,t),0===this.size){if(Ar)return Ar;Ar=this}}function Z(e,t){if(!e)throw new Error(t)}function J(e,t,n){if(!(this instanceof J))return new J(e,t,n);if(Z(0!==n,"Cannot step a Range by 0"),e=e||0,void 0===t&&(t=1/0),n=void 0===n?1:Math.abs(n),e>t&&(n=-n),this._start=e,this._end=t,this._step=n,this.size=Math.max(0,Math.ceil((t-e)/n-1)+1),0===this.size){if(Pr)return Pr;Pr=this}}function et(){throw TypeError("Abstract")}function tt(){}function nt(){}function rt(){}function it(e){return e>>>1&1073741824|3221225471&e}function ot(e){if(e===!1||null===e||void 0===e)return 0;if("function"==typeof e.valueOf&&(e=e.valueOf(),e===!1||null===e||void 0===e))return 0;if(e===!0)return 1;var t=typeof e;if("number"===t){var n=0|e;for(n!==e&&(n^=4294967295*e);e>4294967295;)e/=4294967295,n^=e;return it(n)}if("string"===t)return e.length>Nr?at(e):st(e);if("function"==typeof e.hashCode)return e.hashCode();if("object"===t)return ut(e);if("function"==typeof e.toString)return st(e.toString());throw new Error("Value type "+t+" cannot be hashed.")}function at(e){var t=Ur[e];return void 0===t&&(t=st(e),Fr===Or&&(Fr=0,Ur={}),Fr++,Ur[e]=t),t}function st(e){for(var t=0,n=0;n<e.length;n++)t=31*t+e.charCodeAt(n)|0;return it(t)}function ut(e){var t;if(Br&&(t=kr.get(e),void 0!==t))return t;if(t=e[Lr],void 0!==t)return t;if(!Dr){if(t=e.propertyIsEnumerable&&e.propertyIsEnumerable[Lr],void 0!==t)return t;if(t=ct(e),void 0!==t)return t}if(t=++Vr,1073741824&Vr&&(Vr=0),Br)kr.set(e,t);else{if(void 0!==Ir&&Ir(e)===!1)throw new Error("Non-extensible objects are not allowed as keys.");if(Dr)Object.defineProperty(e,Lr,{enumerable:!1,configurable:!1,writable:!1,value:t});else if(void 0!==e.propertyIsEnumerable&&e.propertyIsEnumerable===e.constructor.prototype.propertyIsEnumerable)e.propertyIsEnumerable=function(){return this.constructor.prototype.propertyIsEnumerable.apply(this,arguments)},e.propertyIsEnumerable[Lr]=t;else{if(void 0===e.nodeType)throw new Error("Unable to set a non-enumerable property on object.");e[Lr]=t}}return t}function ct(e){if(e&&e.nodeType>0)switch(e.nodeType){case 1:return e.uniqueID;case 9:return e.documentElement&&e.documentElement.uniqueID}}function lt(e){Z(1/0!==e,"Cannot perform this action with an infinite size.")}function ht(e){return null===e||void 0===e?_t():ft(e)&&!c(e)?e:_t().withMutations(function(t){var r=n(e);lt(r.size),r.forEach(function(e,n){return t.set(n,e)})})}function ft(e){return!(!e||!e[zr])}function pt(e,t){this.ownerID=e,this.entries=t}function dt(e,t,n){this.ownerID=e,this.bitmap=t,this.nodes=n}function mt(e,t,n){this.ownerID=e,this.count=t,this.nodes=n}function vt(e,t,n){this.ownerID=e,this.keyHash=t,this.entries=n}function gt(e,t,n){this.ownerID=e,this.keyHash=t,this.entry=n}function yt(e,t,n){this._type=t,this._reverse=n,this._stack=e._root&&xt(e._root)}function bt(e,t){return _(e,t[0],t[1])}function xt(e,t){return{node:e,index:0,__prev:t}}function wt(e,t,n,r){var i=Object.create($r);return i.size=e,i._root=t,i.__ownerID=n,i.__hash=r,i.__altered=!1,i}function _t(){return Hr||(Hr=wt(0))}function Ct(e,t,n){var r,i;if(e._root){var o=l(yr),a=l(br);if(r=Et(e._root,e.__ownerID,0,void 0,t,n,o,a),!a.value)return e;i=e.size+(o.value?n===gr?-1:1:0)}else{if(n===gr)return e;i=1,r=new pt(e.__ownerID,[[t,n]])}return e.__ownerID?(e.size=i,e._root=r,e.__hash=void 0,e.__altered=!0,e):r?wt(i,r):_t()}function Et(e,t,n,r,i,o,a,s){return e?e.update(t,n,r,i,o,a,s):o===gr?e:(h(s),h(a),new gt(t,r,[i,o]))}function St(e){return e.constructor===gt||e.constructor===vt}function Mt(e,t,n,r,i){if(e.keyHash===r)return new vt(t,r,[e.entry,i]);var o,a=(0===n?e.keyHash:e.keyHash>>>n)&vr,s=(0===n?r:r>>>n)&vr,u=a===s?[Mt(e,t,n+dr,r,i)]:(o=new gt(t,r,i),s>a?[e,o]:[o,e]);return new dt(t,1<<a|1<<s,u)}function Tt(e,t,n,r){e||(e=new f);for(var i=new gt(e,ot(n),[n,r]),o=0;o<t.length;o++){var a=t[o];i=i.update(e,0,void 0,a[0],a[1])}return i}function At(e,t,n,r){for(var i=0,o=0,a=new Array(n),s=0,u=1,c=t.length;c>s;s++,u<<=1){var l=t[s];void 0!==l&&s!==r&&(i|=u,a[o++]=l)}return new dt(e,i,a)}function Pt(e,t,n,r,i){for(var o=0,a=new Array(mr),s=0;0!==n;s++,n>>>=1)a[s]=1&n?t[o++]:void 0;return a[r]=i,new mt(e,o+1,a)}function kt(e,t,r){for(var i=[],a=0;a<r.length;a++){var s=r[a],u=n(s);o(s)||(u=u.map(function(e){return G(e)})),i.push(u)}return Dt(e,t,i)}function Rt(e,t){return e&&e.mergeDeep&&o(t)?e.mergeDeep(t):Y(e,t)?e:t}function It(e){return function(t,n,r){if(t&&t.mergeDeepWith&&o(n))return t.mergeDeepWith(e,n);var i=e(t,n,r);return Y(t,i)?t:i}}function Dt(e,t,n){return n=n.filter(function(e){return 0!==e.size}),0===n.length?e:0!==e.size||e.__ownerID||1!==n.length?e.withMutations(function(e){for(var r=t?function(n,r){e.update(r,gr,function(e){return e===gr?n:t(e,n,r)})}:function(t,n){e.set(n,t)},i=0;i<n.length;i++)n[i].forEach(r)}):e.constructor(n[0])}function Bt(e,t,n,r){var i=e===gr,o=t.next();if(o.done){var a=i?n:e,s=r(a);return s===a?e:s}Z(i||e&&e.set,"invalid keyPath");var u=o.value,c=i?gr:e.get(u,gr),l=Bt(c,t,n,r);return l===c?e:l===gr?e.remove(u):(i?_t():e).set(u,l)}function Vt(e){return e-=e>>1&1431655765,e=(858993459&e)+(e>>2&858993459),e=e+(e>>4)&252645135,e+=e>>8,e+=e>>16,127&e}function Lt(e,t,n,r){var i=r?e:p(e);return i[t]=n,i}function Nt(e,t,n,r){var i=e.length+1;if(r&&t+1===i)return e[t]=n,e;for(var o=new Array(i),a=0,s=0;i>s;s++)s===t?(o[s]=n,a=-1):o[s]=e[s+a];return o}function Ot(e,t,n){var r=e.length-1;if(n&&t===r)return e.pop(),e;for(var i=new Array(r),o=0,a=0;r>a;a++)a===t&&(o=1),i[a]=e[a+o];return i}function Ft(e){var t=jt();if(null===e||void 0===e)return t;if(Ut(e))return e;var n=r(e),i=n.size;return 0===i?t:(lt(i),i>0&&mr>i?Ht(0,i,dr,null,new zt(n.toArray())):t.withMutations(function(e){e.setSize(i),n.forEach(function(t,n){return e.set(n,t)})}))}function Ut(e){return!(!e||!e[qr])}function zt(e,t){this.array=e,this.ownerID=t}function $t(e,t){function n(e,t,n){return 0===t?r(e,n):i(e,t,n)}function r(e,n){var r=n===s?u&&u.array:e&&e.array,i=n>o?0:o-n,c=a-n;return c>mr&&(c=mr),function(){if(i===c)return Kr;var e=t?--c:i++;return r&&r[e]}}function i(e,r,i){var s,u=e&&e.array,c=i>o?0:o-i>>r,l=(a-i>>r)+1;return l>mr&&(l=mr),function(){for(;;){if(s){var e=s();if(e!==Kr)return e;s=null}if(c===l)return Kr;var o=t?--l:c++;s=n(u&&u[o],r-dr,i+(o<<r))}}}var o=e._origin,a=e._capacity,s=Qt(a),u=e._tail;return n(e._root,e._level,0)}function Ht(e,t,n,r,i,o,a){var s=Object.create(Xr);return s.size=t-e,s._origin=e,s._capacity=t,s._level=n,s._root=r,s._tail=i,s.__ownerID=o,s.__hash=a,s.__altered=!1,s}function jt(){return Yr||(Yr=Ht(0,0,dr))}function Gt(e,t,n){if(t=m(e,t),t!==t)return e;if(t>=e.size||0>t)return e.withMutations(function(e){0>t?Yt(e,t).set(0,n):Yt(e,0,t+1).set(t,n)});t+=e._origin;var r=e._tail,i=e._root,o=l(br);return t>=Qt(e._capacity)?r=Wt(r,e.__ownerID,0,t,n,o):i=Wt(i,e.__ownerID,e._level,t,n,o),o.value?e.__ownerID?(e._root=i,e._tail=r,e.__hash=void 0,e.__altered=!0,e):Ht(e._origin,e._capacity,e._level,i,r):e
}function Wt(e,t,n,r,i,o){var a=r>>>n&vr,s=e&&a<e.array.length;if(!s&&void 0===i)return e;var u;if(n>0){var c=e&&e.array[a],l=Wt(c,t,n-dr,r,i,o);return l===c?e:(u=qt(e,t),u.array[a]=l,u)}return s&&e.array[a]===i?e:(h(o),u=qt(e,t),void 0===i&&a===u.array.length-1?u.array.pop():u.array[a]=i,u)}function qt(e,t){return t&&e&&t===e.ownerID?e:new zt(e?e.array.slice():[],t)}function Xt(e,t){if(t>=Qt(e._capacity))return e._tail;if(t<1<<e._level+dr){for(var n=e._root,r=e._level;n&&r>0;)n=n.array[t>>>r&vr],r-=dr;return n}}function Yt(e,t,n){void 0!==t&&(t=0|t),void 0!==n&&(n=0|n);var r=e.__ownerID||new f,i=e._origin,o=e._capacity,a=i+t,s=void 0===n?o:0>n?o+n:i+n;if(a===i&&s===o)return e;if(a>=s)return e.clear();for(var u=e._level,c=e._root,l=0;0>a+l;)c=new zt(c&&c.array.length?[void 0,c]:[],r),u+=dr,l+=1<<u;l&&(a+=l,i+=l,s+=l,o+=l);for(var h=Qt(o),p=Qt(s);p>=1<<u+dr;)c=new zt(c&&c.array.length?[c]:[],r),u+=dr;var d=e._tail,m=h>p?Xt(e,s-1):p>h?new zt([],r):d;if(d&&p>h&&o>a&&d.array.length){c=qt(c,r);for(var v=c,g=u;g>dr;g-=dr){var y=h>>>g&vr;v=v.array[y]=qt(v.array[y],r)}v.array[h>>>dr&vr]=d}if(o>s&&(m=m&&m.removeAfter(r,0,s)),a>=p)a-=p,s-=p,u=dr,c=null,m=m&&m.removeBefore(r,0,a);else if(a>i||h>p){for(l=0;c;){var b=a>>>u&vr;if(b!==p>>>u&vr)break;b&&(l+=(1<<u)*b),u-=dr,c=c.array[b]}c&&a>i&&(c=c.removeBefore(r,u,a-l)),c&&h>p&&(c=c.removeAfter(r,u,p-l)),l&&(a-=l,s-=l)}return e.__ownerID?(e.size=s-a,e._origin=a,e._capacity=s,e._level=u,e._root=c,e._tail=m,e.__hash=void 0,e.__altered=!0,e):Ht(a,s,u,c,m)}function Kt(e,t,n){for(var i=[],a=0,s=0;s<n.length;s++){var u=n[s],c=r(u);c.size>a&&(a=c.size),o(u)||(c=c.map(function(e){return G(e)})),i.push(c)}return a>e.size&&(e=e.setSize(a)),Dt(e,t,i)}function Qt(e){return mr>e?0:e-1>>>dr<<dr}function Zt(e){return null===e||void 0===e?tn():Jt(e)?e:tn().withMutations(function(t){var r=n(e);lt(r.size),r.forEach(function(e,n){return t.set(n,e)})})}function Jt(e){return ft(e)&&c(e)}function en(e,t,n,r){var i=Object.create(Zt.prototype);return i.size=e?e.size:0,i._map=e,i._list=t,i.__ownerID=n,i.__hash=r,i}function tn(){return Qr||(Qr=en(_t(),jt()))}function nn(e,t,n){var r,i,o=e._map,a=e._list,s=o.get(t),u=void 0!==s;if(n===gr){if(!u)return e;a.size>=mr&&a.size>=2*o.size?(i=a.filter(function(e,t){return void 0!==e&&s!==t}),r=i.toKeyedSeq().map(function(e){return e[0]}).flip().toMap(),e.__ownerID&&(r.__ownerID=i.__ownerID=e.__ownerID)):(r=o.remove(t),i=s===a.size-1?a.pop():a.set(s,void 0))}else if(u){if(n===a.get(s)[1])return e;r=o,i=a.set(s,[t,n])}else r=o.set(t,a.size),i=a.set(a.size,[t,n]);return e.__ownerID?(e.size=r.size,e._map=r,e._list=i,e.__hash=void 0,e):en(r,i)}function rn(e,t){this._iter=e,this._useKeys=t,this.size=e.size}function on(e){this._iter=e,this.size=e.size}function an(e){this._iter=e,this.size=e.size}function sn(e){this._iter=e,this.size=e.size}function un(e){var t=Pn(e);return t._iter=e,t.size=e.size,t.flip=function(){return e},t.reverse=function(){var t=e.reverse.apply(this);return t.flip=function(){return e.reverse()},t},t.has=function(t){return e.includes(t)},t.includes=function(t){return e.has(t)},t.cacheResult=kn,t.__iterateUncached=function(t,n){var r=this;return e.__iterate(function(e,n){return t(n,e,r)!==!1},n)},t.__iteratorUncached=function(t,n){if(t===_r){var r=e.__iterator(t,n);return new w(function(){var e=r.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===wr?xr:wr,n)},t}function cn(e,t,n){var r=Pn(e);return r.size=e.size,r.has=function(t){return e.has(t)},r.get=function(r,i){var o=e.get(r,gr);return o===gr?i:t.call(n,o,r,e)},r.__iterateUncached=function(r,i){var o=this;return e.__iterate(function(e,i,a){return r(t.call(n,e,i,a),i,o)!==!1},i)},r.__iteratorUncached=function(r,i){var o=e.__iterator(_r,i);return new w(function(){var i=o.next();if(i.done)return i;var a=i.value,s=a[0];return _(r,s,t.call(n,a[1],s,e),i)})},r}function ln(e,t){var n=Pn(e);return n._iter=e,n.size=e.size,n.reverse=function(){return e},e.flip&&(n.flip=function(){var t=un(e);return t.reverse=function(){return e.flip()},t}),n.get=function(n,r){return e.get(t?n:-1-n,r)},n.has=function(n){return e.has(t?n:-1-n)},n.includes=function(t){return e.includes(t)},n.cacheResult=kn,n.__iterate=function(t,n){var r=this;return e.__iterate(function(e,n){return t(e,n,r)},!n)},n.__iterator=function(t,n){return e.__iterator(t,!n)},n}function hn(e,t,n,r){var i=Pn(e);return r&&(i.has=function(r){var i=e.get(r,gr);return i!==gr&&!!t.call(n,i,r,e)},i.get=function(r,i){var o=e.get(r,gr);return o!==gr&&t.call(n,o,r,e)?o:i}),i.__iterateUncached=function(i,o){var a=this,s=0;return e.__iterate(function(e,o,u){return t.call(n,e,o,u)?(s++,i(e,r?o:s-1,a)):void 0},o),s},i.__iteratorUncached=function(i,o){var a=e.__iterator(_r,o),s=0;return new w(function(){for(;;){var o=a.next();if(o.done)return o;var u=o.value,c=u[0],l=u[1];if(t.call(n,l,c,e))return _(i,r?c:s++,l,o)}})},i}function fn(e,t,n){var r=ht().asMutable();return e.__iterate(function(i,o){r.update(t.call(n,i,o,e),0,function(e){return e+1})}),r.asImmutable()}function pn(e,t,n){var r=a(e),i=(c(e)?Zt():ht()).asMutable();e.__iterate(function(o,a){i.update(t.call(n,o,a,e),function(e){return e=e||[],e.push(r?[a,o]:o),e})});var o=An(e);return i.map(function(t){return Sn(e,o(t))})}function dn(e,t,n,r){var i=e.size;if(void 0!==t&&(t=0|t),void 0!==n&&(n=0|n),g(t,n,i))return e;var o=y(t,i),a=b(n,i);if(o!==o||a!==a)return dn(e.toSeq().cacheResult(),t,n,r);var s,u=a-o;u===u&&(s=0>u?0:u);var c=Pn(e);return c.size=0===s?s:e.size&&s||void 0,!r&&N(e)&&s>=0&&(c.get=function(t,n){return t=m(this,t),t>=0&&s>t?e.get(t+o,n):n}),c.__iterateUncached=function(t,n){var i=this;if(0===s)return 0;if(n)return this.cacheResult().__iterate(t,n);var a=0,u=!0,c=0;return e.__iterate(function(e,n){return u&&(u=a++<o)?void 0:(c++,t(e,r?n:c-1,i)!==!1&&c!==s)}),c},c.__iteratorUncached=function(t,n){if(0!==s&&n)return this.cacheResult().__iterator(t,n);var i=0!==s&&e.__iterator(t,n),a=0,u=0;return new w(function(){for(;a++<o;)i.next();if(++u>s)return C();var e=i.next();return r||t===wr?e:t===xr?_(t,u-1,void 0,e):_(t,u-1,e.value[1],e)})},c}function mn(e,t,n){var r=Pn(e);return r.__iterateUncached=function(r,i){var o=this;if(i)return this.cacheResult().__iterate(r,i);var a=0;return e.__iterate(function(e,i,s){return t.call(n,e,i,s)&&++a&&r(e,i,o)}),a},r.__iteratorUncached=function(r,i){var o=this;if(i)return this.cacheResult().__iterator(r,i);var a=e.__iterator(_r,i),s=!0;return new w(function(){if(!s)return C();var e=a.next();if(e.done)return e;var i=e.value,u=i[0],c=i[1];return t.call(n,c,u,o)?r===_r?e:_(r,u,c,e):(s=!1,C())})},r}function vn(e,t,n,r){var i=Pn(e);return i.__iterateUncached=function(i,o){var a=this;if(o)return this.cacheResult().__iterate(i,o);var s=!0,u=0;return e.__iterate(function(e,o,c){return s&&(s=t.call(n,e,o,c))?void 0:(u++,i(e,r?o:u-1,a))}),u},i.__iteratorUncached=function(i,o){var a=this;if(o)return this.cacheResult().__iterator(i,o);var s=e.__iterator(_r,o),u=!0,c=0;return new w(function(){var e,o,l;do{if(e=s.next(),e.done)return r||i===wr?e:i===xr?_(i,c++,void 0,e):_(i,c++,e.value[1],e);var h=e.value;o=h[0],l=h[1],u&&(u=t.call(n,l,o,a))}while(u);return i===_r?e:_(i,o,l,e)})},i}function gn(e,t){var r=a(e),i=[e].concat(t).map(function(e){return o(e)?r&&(e=n(e)):e=r?F(e):U(Array.isArray(e)?e:[e]),e}).filter(function(e){return 0!==e.size});if(0===i.length)return e;if(1===i.length){var u=i[0];if(u===e||r&&a(u)||s(e)&&s(u))return u}var c=new D(i);return r?c=c.toKeyedSeq():s(e)||(c=c.toSetSeq()),c=c.flatten(!0),c.size=i.reduce(function(e,t){if(void 0!==e){var n=t.size;if(void 0!==n)return e+n}},0),c}function yn(e,t,n){var r=Pn(e);return r.__iterateUncached=function(r,i){function a(e,c){var l=this;e.__iterate(function(e,i){return(!t||t>c)&&o(e)?a(e,c+1):r(e,n?i:s++,l)===!1&&(u=!0),!u},i)}var s=0,u=!1;return a(e,0),s},r.__iteratorUncached=function(r,i){var a=e.__iterator(r,i),s=[],u=0;return new w(function(){for(;a;){var e=a.next();if(e.done===!1){var c=e.value;if(r===_r&&(c=c[1]),t&&!(s.length<t)||!o(c))return n?e:_(r,u++,c,e);s.push(a),a=c.__iterator(r,i)}else a=s.pop()}return C()})},r}function bn(e,t,n){var r=An(e);return e.toSeq().map(function(i,o){return r(t.call(n,i,o,e))}).flatten(!0)}function xn(e,t){var n=Pn(e);return n.size=e.size&&2*e.size-1,n.__iterateUncached=function(n,r){var i=this,o=0;return e.__iterate(function(e){return(!o||n(t,o++,i)!==!1)&&n(e,o++,i)!==!1},r),o},n.__iteratorUncached=function(n,r){var i,o=e.__iterator(wr,r),a=0;return new w(function(){return(!i||a%2)&&(i=o.next(),i.done)?i:a%2?_(n,a++,t):_(n,a++,i.value,i)})},n}function wn(e,t,n){t||(t=Rn);var r=a(e),i=0,o=e.toSeq().map(function(t,r){return[r,t,i++,n?n(t,r,e):t]}).toArray();return o.sort(function(e,n){return t(e[3],n[3])||e[2]-n[2]}).forEach(r?function(e,t){o[t].length=2}:function(e,t){o[t]=e[1]}),r?k(o):s(e)?R(o):I(o)}function _n(e,t,n){if(t||(t=Rn),n){var r=e.toSeq().map(function(t,r){return[t,n(t,r,e)]}).reduce(function(e,n){return Cn(t,e[1],n[1])?n:e});return r&&r[0]}return e.reduce(function(e,n){return Cn(t,e,n)?n:e})}function Cn(e,t,n){var r=e(n,t);return 0===r&&n!==t&&(void 0===n||null===n||n!==n)||r>0}function En(e,n,r){var i=Pn(e);return i.size=new D(r).map(function(e){return e.size}).min(),i.__iterate=function(e,t){for(var n,r=this.__iterator(wr,t),i=0;!(n=r.next()).done&&e(n.value,i++,this)!==!1;);return i},i.__iteratorUncached=function(e,i){var o=r.map(function(e){return e=t(e),M(i?e.reverse():e)}),a=0,s=!1;return new w(function(){var t;return s||(t=o.map(function(e){return e.next()}),s=t.some(function(e){return e.done})),s?C():_(e,a++,n.apply(null,t.map(function(e){return e.value})))})},i}function Sn(e,t){return N(e)?t:e.constructor(t)}function Mn(e){if(e!==Object(e))throw new TypeError("Expected [K, V] tuple: "+e)}function Tn(e){return lt(e.size),d(e)}function An(e){return a(e)?n:s(e)?r:i}function Pn(e){return Object.create((a(e)?k:s(e)?R:I).prototype)}function kn(){return this._iter.cacheResult?(this._iter.cacheResult(),this.size=this._iter.size,this):P.prototype.cacheResult.call(this)}function Rn(e,t){return e>t?1:t>e?-1:0}function In(e){var n=M(e);if(!n){if(!A(e))throw new TypeError("Expected iterable or array-like: "+e);n=M(t(e))}return n}function Dn(e,t){var n,r=function(o){if(o instanceof r)return o;if(!(this instanceof r))return new r(o);if(!n){n=!0;var a=Object.keys(e);Ln(i,a),i.size=a.length,i._name=t,i._keys=a,i._defaultValues=e}this._map=ht(o)},i=r.prototype=Object.create(Zr);return i.constructor=r,r}function Bn(e,t,n){var r=Object.create(Object.getPrototypeOf(e));return r._map=t,r.__ownerID=n,r}function Vn(e){return e._name||e.constructor.name||"Record"}function Ln(e,t){try{t.forEach(Nn.bind(void 0,e))}catch(n){}}function Nn(e,t){Object.defineProperty(e,t,{get:function(){return this.get(t)},set:function(e){Z(this.__ownerID,"Cannot set on an immutable record."),this.set(t,e)}})}function On(e){return null===e||void 0===e?$n():Fn(e)&&!c(e)?e:$n().withMutations(function(t){var n=i(e);lt(n.size),n.forEach(function(e){return t.add(e)})})}function Fn(e){return!(!e||!e[Jr])}function Un(e,t){return e.__ownerID?(e.size=t.size,e._map=t,e):t===e._map?e:0===t.size?e.__empty():e.__make(t)}function zn(e,t){var n=Object.create(ei);return n.size=e?e.size:0,n._map=e,n.__ownerID=t,n}function $n(){return ti||(ti=zn(_t()))}function Hn(e){return null===e||void 0===e?Wn():jn(e)?e:Wn().withMutations(function(t){var n=i(e);lt(n.size),n.forEach(function(e){return t.add(e)})})}function jn(e){return Fn(e)&&c(e)}function Gn(e,t){var n=Object.create(ni);return n.size=e?e.size:0,n._map=e,n.__ownerID=t,n}function Wn(){return ri||(ri=Gn(tn()))}function qn(e){return null===e||void 0===e?Kn():Xn(e)?e:Kn().unshiftAll(e)}function Xn(e){return!(!e||!e[ii])}function Yn(e,t,n,r){var i=Object.create(oi);return i.size=e,i._head=t,i.__ownerID=n,i.__hash=r,i.__altered=!1,i}function Kn(){return ai||(ai=Yn(0))}function Qn(e,t){var n=function(n){e.prototype[n]=t[n]};return Object.keys(t).forEach(n),Object.getOwnPropertySymbols&&Object.getOwnPropertySymbols(t).forEach(n),e}function Zn(e,t){return t}function Jn(e,t){return[t,e]}function er(e){return function(){return!e.apply(this,arguments)}}function tr(e){return function(){return-e.apply(this,arguments)}}function nr(e){return"string"==typeof e?JSON.stringify(e):e}function rr(){return p(arguments)}function ir(e,t){return t>e?1:e>t?-1:0}function or(e){if(1/0===e.size)return 0;var t=c(e),n=a(e),r=t?1:0,i=e.__iterate(n?t?function(e,t){r=31*r+sr(ot(e),ot(t))|0}:function(e,t){r=r+sr(ot(e),ot(t))|0}:t?function(e){r=31*r+ot(e)|0}:function(e){r=r+ot(e)|0});return ar(i,r)}function ar(e,t){return t=Rr(t,3432918353),t=Rr(t<<15|t>>>-15,461845907),t=Rr(t<<13|t>>>-13,5),t=(t+3864292196|0)^e,t=Rr(t^t>>>16,2246822507),t=Rr(t^t>>>13,3266489909),t=it(t^t>>>16)}function sr(e,t){return e^t+2654435769+(e<<6)+(e>>2)|0}var ur=Array.prototype.slice;e(n,t),e(r,t),e(i,t),t.isIterable=o,t.isKeyed=a,t.isIndexed=s,t.isAssociative=u,t.isOrdered=c,t.Keyed=n,t.Indexed=r,t.Set=i;var cr="@@__IMMUTABLE_ITERABLE__@@",lr="@@__IMMUTABLE_KEYED__@@",hr="@@__IMMUTABLE_INDEXED__@@",fr="@@__IMMUTABLE_ORDERED__@@",pr="delete",dr=5,mr=1<<dr,vr=mr-1,gr={},yr={value:!1},br={value:!1},xr=0,wr=1,_r=2,Cr="function"==typeof Symbol&&Symbol.iterator,Er="@@iterator",Sr=Cr||Er;w.prototype.toString=function(){return"[Iterator]"},w.KEYS=xr,w.VALUES=wr,w.ENTRIES=_r,w.prototype.inspect=w.prototype.toSource=function(){return this.toString()},w.prototype[Sr]=function(){return this},e(P,t),P.of=function(){return P(arguments)},P.prototype.toSeq=function(){return this},P.prototype.toString=function(){return this.__toString("Seq {","}")},P.prototype.cacheResult=function(){return!this._cache&&this.__iterateUncached&&(this._cache=this.entrySeq().toArray(),this.size=this._cache.length),this},P.prototype.__iterate=function(e,t){return H(this,e,t,!0)},P.prototype.__iterator=function(e,t){return j(this,e,t,!0)},e(k,P),k.prototype.toKeyedSeq=function(){return this},e(R,P),R.of=function(){return R(arguments)},R.prototype.toIndexedSeq=function(){return this},R.prototype.toString=function(){return this.__toString("Seq [","]")},R.prototype.__iterate=function(e,t){return H(this,e,t,!1)},R.prototype.__iterator=function(e,t){return j(this,e,t,!1)},e(I,P),I.of=function(){return I(arguments)},I.prototype.toSetSeq=function(){return this},P.isSeq=N,P.Keyed=k,P.Set=I,P.Indexed=R;var Mr="@@__IMMUTABLE_SEQ__@@";P.prototype[Mr]=!0,e(D,R),D.prototype.get=function(e,t){return this.has(e)?this._array[m(this,e)]:t},D.prototype.__iterate=function(e,t){for(var n=this._array,r=n.length-1,i=0;r>=i;i++)if(e(n[t?r-i:i],i,this)===!1)return i+1;return i},D.prototype.__iterator=function(e,t){var n=this._array,r=n.length-1,i=0;return new w(function(){return i>r?C():_(e,i,n[t?r-i++:i++])})},e(B,k),B.prototype.get=function(e,t){return void 0===t||this.has(e)?this._object[e]:t},B.prototype.has=function(e){return this._object.hasOwnProperty(e)},B.prototype.__iterate=function(e,t){for(var n=this._object,r=this._keys,i=r.length-1,o=0;i>=o;o++){var a=r[t?i-o:o];if(e(n[a],a,this)===!1)return o+1}return o},B.prototype.__iterator=function(e,t){var n=this._object,r=this._keys,i=r.length-1,o=0;return new w(function(){var a=r[t?i-o:o];return o++>i?C():_(e,a,n[a])})},B.prototype[fr]=!0,e(V,R),V.prototype.__iterateUncached=function(e,t){if(t)return this.cacheResult().__iterate(e,t);var n=this._iterable,r=M(n),i=0;if(S(r))for(var o;!(o=r.next()).done&&e(o.value,i++,this)!==!1;);return i},V.prototype.__iteratorUncached=function(e,t){if(t)return this.cacheResult().__iterator(e,t);var n=this._iterable,r=M(n);if(!S(r))return new w(C);var i=0;return new w(function(){var t=r.next();return t.done?t:_(e,i++,t.value)})},e(L,R),L.prototype.__iterateUncached=function(e,t){if(t)return this.cacheResult().__iterate(e,t);for(var n=this._iterator,r=this._iteratorCache,i=0;i<r.length;)if(e(r[i],i++,this)===!1)return i;for(var o;!(o=n.next()).done;){var a=o.value;if(r[i]=a,e(a,i++,this)===!1)break}return i},L.prototype.__iteratorUncached=function(e,t){if(t)return this.cacheResult().__iterator(e,t);var n=this._iterator,r=this._iteratorCache,i=0;return new w(function(){if(i>=r.length){var t=n.next();if(t.done)return t;r[i]=t.value}return _(e,i,r[i++])})};var Tr;e(Q,R),Q.prototype.toString=function(){return 0===this.size?"Repeat []":"Repeat [ "+this._value+" "+this.size+" times ]"},Q.prototype.get=function(e,t){return this.has(e)?this._value:t},Q.prototype.includes=function(e){return Y(this._value,e)},Q.prototype.slice=function(e,t){var n=this.size;return g(e,t,n)?this:new Q(this._value,b(t,n)-y(e,n))},Q.prototype.reverse=function(){return this},Q.prototype.indexOf=function(e){return Y(this._value,e)?0:-1},Q.prototype.lastIndexOf=function(e){return Y(this._value,e)?this.size:-1},Q.prototype.__iterate=function(e){for(var t=0;t<this.size;t++)if(e(this._value,t,this)===!1)return t+1;return t},Q.prototype.__iterator=function(e){var t=this,n=0;return new w(function(){return n<t.size?_(e,n++,t._value):C()})},Q.prototype.equals=function(e){return e instanceof Q?Y(this._value,e._value):K(e)};var Ar;e(J,R),J.prototype.toString=function(){return 0===this.size?"Range []":"Range [ "+this._start+"..."+this._end+(1!==this._step?" by "+this._step:"")+" ]"},J.prototype.get=function(e,t){return this.has(e)?this._start+m(this,e)*this._step:t},J.prototype.includes=function(e){var t=(e-this._start)/this._step;return t>=0&&t<this.size&&t===Math.floor(t)},J.prototype.slice=function(e,t){return g(e,t,this.size)?this:(e=y(e,this.size),t=b(t,this.size),e>=t?new J(0,0):new J(this.get(e,this._end),this.get(t,this._end),this._step))},J.prototype.indexOf=function(e){var t=e-this._start;if(t%this._step===0){var n=t/this._step;if(n>=0&&n<this.size)return n}return-1},J.prototype.lastIndexOf=function(e){return this.indexOf(e)},J.prototype.__iterate=function(e,t){for(var n=this.size-1,r=this._step,i=t?this._start+n*r:this._start,o=0;n>=o;o++){if(e(i,o,this)===!1)return o+1;i+=t?-r:r}return o},J.prototype.__iterator=function(e,t){var n=this.size-1,r=this._step,i=t?this._start+n*r:this._start,o=0;return new w(function(){var a=i;return i+=t?-r:r,o>n?C():_(e,o++,a)})},J.prototype.equals=function(e){return e instanceof J?this._start===e._start&&this._end===e._end&&this._step===e._step:K(this,e)};var Pr;e(et,t),e(tt,et),e(nt,et),e(rt,et),et.Keyed=tt,et.Indexed=nt,et.Set=rt;var kr,Rr="function"==typeof Math.imul&&-2===Math.imul(4294967295,2)?Math.imul:function(e,t){e=0|e,t=0|t;var n=65535&e,r=65535&t;return n*r+((e>>>16)*r+n*(t>>>16)<<16>>>0)|0},Ir=Object.isExtensible,Dr=function(){try{return Object.defineProperty({},"@",{}),!0}catch(e){return!1}}(),Br="function"==typeof WeakMap;Br&&(kr=new WeakMap);var Vr=0,Lr="__immutablehash__";"function"==typeof Symbol&&(Lr=Symbol(Lr));var Nr=16,Or=255,Fr=0,Ur={};e(ht,tt),ht.of=function(){var e=ur.call(arguments,0);return _t().withMutations(function(t){for(var n=0;n<e.length;n+=2){if(n+1>=e.length)throw new Error("Missing value for key: "+e[n]);t.set(e[n],e[n+1])}})},ht.prototype.toString=function(){return this.__toString("Map {","}")},ht.prototype.get=function(e,t){return this._root?this._root.get(0,void 0,e,t):t},ht.prototype.set=function(e,t){return Ct(this,e,t)},ht.prototype.setIn=function(e,t){return this.updateIn(e,gr,function(){return t})},ht.prototype.remove=function(e){return Ct(this,e,gr)},ht.prototype.deleteIn=function(e){return this.updateIn(e,function(){return gr})},ht.prototype.update=function(e,t,n){return 1===arguments.length?e(this):this.updateIn([e],t,n)},ht.prototype.updateIn=function(e,t,n){n||(n=t,t=void 0);var r=Bt(this,In(e),t,n);return r===gr?void 0:r},ht.prototype.clear=function(){return 0===this.size?this:this.__ownerID?(this.size=0,this._root=null,this.__hash=void 0,this.__altered=!0,this):_t()},ht.prototype.merge=function(){return kt(this,void 0,arguments)},ht.prototype.mergeWith=function(e){var t=ur.call(arguments,1);return kt(this,e,t)},ht.prototype.mergeIn=function(e){var t=ur.call(arguments,1);return this.updateIn(e,_t(),function(e){return"function"==typeof e.merge?e.merge.apply(e,t):t[t.length-1]})},ht.prototype.mergeDeep=function(){return kt(this,Rt,arguments)},ht.prototype.mergeDeepWith=function(e){var t=ur.call(arguments,1);return kt(this,It(e),t)},ht.prototype.mergeDeepIn=function(e){var t=ur.call(arguments,1);return this.updateIn(e,_t(),function(e){return"function"==typeof e.mergeDeep?e.mergeDeep.apply(e,t):t[t.length-1]})},ht.prototype.sort=function(e){return Zt(wn(this,e))},ht.prototype.sortBy=function(e,t){return Zt(wn(this,t,e))},ht.prototype.withMutations=function(e){var t=this.asMutable();return e(t),t.wasAltered()?t.__ensureOwner(this.__ownerID):this},ht.prototype.asMutable=function(){return this.__ownerID?this:this.__ensureOwner(new f)},ht.prototype.asImmutable=function(){return this.__ensureOwner()},ht.prototype.wasAltered=function(){return this.__altered},ht.prototype.__iterator=function(e,t){return new yt(this,e,t)},ht.prototype.__iterate=function(e,t){var n=this,r=0;return this._root&&this._root.iterate(function(t){return r++,e(t[1],t[0],n)},t),r},ht.prototype.__ensureOwner=function(e){return e===this.__ownerID?this:e?wt(this.size,this._root,e,this.__hash):(this.__ownerID=e,this.__altered=!1,this)},ht.isMap=ft;var zr="@@__IMMUTABLE_MAP__@@",$r=ht.prototype;$r[zr]=!0,$r[pr]=$r.remove,$r.removeIn=$r.deleteIn,pt.prototype.get=function(e,t,n,r){for(var i=this.entries,o=0,a=i.length;a>o;o++)if(Y(n,i[o][0]))return i[o][1];return r},pt.prototype.update=function(e,t,n,r,i,o,a){for(var s=i===gr,u=this.entries,c=0,l=u.length;l>c&&!Y(r,u[c][0]);c++);var f=l>c;if(f?u[c][1]===i:s)return this;if(h(a),(s||!f)&&h(o),!s||1!==u.length){if(!f&&!s&&u.length>=jr)return Tt(e,u,r,i);var d=e&&e===this.ownerID,m=d?u:p(u);return f?s?c===l-1?m.pop():m[c]=m.pop():m[c]=[r,i]:m.push([r,i]),d?(this.entries=m,this):new pt(e,m)}},dt.prototype.get=function(e,t,n,r){void 0===t&&(t=ot(n));var i=1<<((0===e?t:t>>>e)&vr),o=this.bitmap;return 0===(o&i)?r:this.nodes[Vt(o&i-1)].get(e+dr,t,n,r)},dt.prototype.update=function(e,t,n,r,i,o,a){void 0===n&&(n=ot(r));var s=(0===t?n:n>>>t)&vr,u=1<<s,c=this.bitmap,l=0!==(c&u);if(!l&&i===gr)return this;var h=Vt(c&u-1),f=this.nodes,p=l?f[h]:void 0,d=Et(p,e,t+dr,n,r,i,o,a);if(d===p)return this;if(!l&&d&&f.length>=Gr)return Pt(e,f,c,s,d);if(l&&!d&&2===f.length&&St(f[1^h]))return f[1^h];if(l&&d&&1===f.length&&St(d))return d;var m=e&&e===this.ownerID,v=l?d?c:c^u:c|u,g=l?d?Lt(f,h,d,m):Ot(f,h,m):Nt(f,h,d,m);return m?(this.bitmap=v,this.nodes=g,this):new dt(e,v,g)},mt.prototype.get=function(e,t,n,r){void 0===t&&(t=ot(n));var i=(0===e?t:t>>>e)&vr,o=this.nodes[i];return o?o.get(e+dr,t,n,r):r},mt.prototype.update=function(e,t,n,r,i,o,a){void 0===n&&(n=ot(r));var s=(0===t?n:n>>>t)&vr,u=i===gr,c=this.nodes,l=c[s];if(u&&!l)return this;var h=Et(l,e,t+dr,n,r,i,o,a);if(h===l)return this;var f=this.count;if(l){if(!h&&(f--,Wr>f))return At(e,c,f,s)}else f++;var p=e&&e===this.ownerID,d=Lt(c,s,h,p);return p?(this.count=f,this.nodes=d,this):new mt(e,f,d)},vt.prototype.get=function(e,t,n,r){for(var i=this.entries,o=0,a=i.length;a>o;o++)if(Y(n,i[o][0]))return i[o][1];return r},vt.prototype.update=function(e,t,n,r,i,o,a){void 0===n&&(n=ot(r));var s=i===gr;if(n!==this.keyHash)return s?this:(h(a),h(o),Mt(this,e,t,n,[r,i]));for(var u=this.entries,c=0,l=u.length;l>c&&!Y(r,u[c][0]);c++);var f=l>c;if(f?u[c][1]===i:s)return this;if(h(a),(s||!f)&&h(o),s&&2===l)return new gt(e,this.keyHash,u[1^c]);var d=e&&e===this.ownerID,m=d?u:p(u);return f?s?c===l-1?m.pop():m[c]=m.pop():m[c]=[r,i]:m.push([r,i]),d?(this.entries=m,this):new vt(e,this.keyHash,m)},gt.prototype.get=function(e,t,n,r){return Y(n,this.entry[0])?this.entry[1]:r},gt.prototype.update=function(e,t,n,r,i,o,a){var s=i===gr,u=Y(r,this.entry[0]);return(u?i===this.entry[1]:s)?this:(h(a),s?(h(o),void 0):u?e&&e===this.ownerID?(this.entry[1]=i,this):new gt(e,this.keyHash,[r,i]):(h(o),Mt(this,e,t,ot(r),[r,i])))},pt.prototype.iterate=vt.prototype.iterate=function(e,t){for(var n=this.entries,r=0,i=n.length-1;i>=r;r++)if(e(n[t?i-r:r])===!1)return!1},dt.prototype.iterate=mt.prototype.iterate=function(e,t){for(var n=this.nodes,r=0,i=n.length-1;i>=r;r++){var o=n[t?i-r:r];if(o&&o.iterate(e,t)===!1)return!1}},gt.prototype.iterate=function(e){return e(this.entry)},e(yt,w),yt.prototype.next=function(){for(var e=this._type,t=this._stack;t;){var n,r=t.node,i=t.index++;if(r.entry){if(0===i)return bt(e,r.entry)}else if(r.entries){if(n=r.entries.length-1,n>=i)return bt(e,r.entries[this._reverse?n-i:i])}else if(n=r.nodes.length-1,n>=i){var o=r.nodes[this._reverse?n-i:i];if(o){if(o.entry)return bt(e,o.entry);t=this._stack=xt(o,t)}continue}t=this._stack=this._stack.__prev}return C()};var Hr,jr=mr/4,Gr=mr/2,Wr=mr/4;e(Ft,nt),Ft.of=function(){return this(arguments)},Ft.prototype.toString=function(){return this.__toString("List [","]")},Ft.prototype.get=function(e,t){if(e=m(this,e),e>=0&&e<this.size){e+=this._origin;var n=Xt(this,e);return n&&n.array[e&vr]}return t},Ft.prototype.set=function(e,t){return Gt(this,e,t)},Ft.prototype.remove=function(e){return this.has(e)?0===e?this.shift():e===this.size-1?this.pop():this.splice(e,1):this},Ft.prototype.insert=function(e,t){return this.splice(e,0,t)},Ft.prototype.clear=function(){return 0===this.size?this:this.__ownerID?(this.size=this._origin=this._capacity=0,this._level=dr,this._root=this._tail=null,this.__hash=void 0,this.__altered=!0,this):jt()},Ft.prototype.push=function(){var e=arguments,t=this.size;return this.withMutations(function(n){Yt(n,0,t+e.length);for(var r=0;r<e.length;r++)n.set(t+r,e[r])})},Ft.prototype.pop=function(){return Yt(this,0,-1)},Ft.prototype.unshift=function(){var e=arguments;return this.withMutations(function(t){Yt(t,-e.length);for(var n=0;n<e.length;n++)t.set(n,e[n])})},Ft.prototype.shift=function(){return Yt(this,1)},Ft.prototype.merge=function(){return Kt(this,void 0,arguments)},Ft.prototype.mergeWith=function(e){var t=ur.call(arguments,1);return Kt(this,e,t)},Ft.prototype.mergeDeep=function(){return Kt(this,Rt,arguments)},Ft.prototype.mergeDeepWith=function(e){var t=ur.call(arguments,1);return Kt(this,It(e),t)},Ft.prototype.setSize=function(e){return Yt(this,0,e)},Ft.prototype.slice=function(e,t){var n=this.size;return g(e,t,n)?this:Yt(this,y(e,n),b(t,n))},Ft.prototype.__iterator=function(e,t){var n=0,r=$t(this,t);return new w(function(){var t=r();return t===Kr?C():_(e,n++,t)})},Ft.prototype.__iterate=function(e,t){for(var n,r=0,i=$t(this,t);(n=i())!==Kr&&e(n,r++,this)!==!1;);return r},Ft.prototype.__ensureOwner=function(e){return e===this.__ownerID?this:e?Ht(this._origin,this._capacity,this._level,this._root,this._tail,e,this.__hash):(this.__ownerID=e,this)},Ft.isList=Ut;var qr="@@__IMMUTABLE_LIST__@@",Xr=Ft.prototype;Xr[qr]=!0,Xr[pr]=Xr.remove,Xr.setIn=$r.setIn,Xr.deleteIn=Xr.removeIn=$r.removeIn,Xr.update=$r.update,Xr.updateIn=$r.updateIn,Xr.mergeIn=$r.mergeIn,Xr.mergeDeepIn=$r.mergeDeepIn,Xr.withMutations=$r.withMutations,Xr.asMutable=$r.asMutable,Xr.asImmutable=$r.asImmutable,Xr.wasAltered=$r.wasAltered,zt.prototype.removeBefore=function(e,t,n){if(n===t?1<<t:0||0===this.array.length)return this;var r=n>>>t&vr;if(r>=this.array.length)return new zt([],e);var i,o=0===r;if(t>0){var a=this.array[r];if(i=a&&a.removeBefore(e,t-dr,n),i===a&&o)return this}if(o&&!i)return this;var s=qt(this,e);if(!o)for(var u=0;r>u;u++)s.array[u]=void 0;return i&&(s.array[r]=i),s},zt.prototype.removeAfter=function(e,t,n){if(n===(t?1<<t:0)||0===this.array.length)return this;var r=n-1>>>t&vr;if(r>=this.array.length)return this;var i;if(t>0){var o=this.array[r];if(i=o&&o.removeAfter(e,t-dr,n),i===o&&r===this.array.length-1)return this}var a=qt(this,e);return a.array.splice(r+1),i&&(a.array[r]=i),a};var Yr,Kr={};e(Zt,ht),Zt.of=function(){return this(arguments)},Zt.prototype.toString=function(){return this.__toString("OrderedMap {","}")},Zt.prototype.get=function(e,t){var n=this._map.get(e);return void 0!==n?this._list.get(n)[1]:t},Zt.prototype.clear=function(){return 0===this.size?this:this.__ownerID?(this.size=0,this._map.clear(),this._list.clear(),this):tn()},Zt.prototype.set=function(e,t){return nn(this,e,t)},Zt.prototype.remove=function(e){return nn(this,e,gr)},Zt.prototype.wasAltered=function(){return this._map.wasAltered()||this._list.wasAltered()},Zt.prototype.__iterate=function(e,t){var n=this;return this._list.__iterate(function(t){return t&&e(t[1],t[0],n)},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),n=this._list.__ensureOwner(e);return e?en(t,n,e,this.__hash):(this.__ownerID=e,this._map=t,this._list=n,this)},Zt.isOrderedMap=Jt,Zt.prototype[fr]=!0,Zt.prototype[pr]=Zt.prototype.remove;var Qr;e(rn,k),rn.prototype.get=function(e,t){return this._iter.get(e,t)},rn.prototype.has=function(e){return this._iter.has(e)},rn.prototype.valueSeq=function(){return this._iter.valueSeq()},rn.prototype.reverse=function(){var e=this,t=ln(this,!0);return this._useKeys||(t.valueSeq=function(){return e._iter.toSeq().reverse()}),t},rn.prototype.map=function(e,t){var n=this,r=cn(this,e,t);return this._useKeys||(r.valueSeq=function(){return n._iter.toSeq().map(e,t)}),r},rn.prototype.__iterate=function(e,t){var n,r=this;return this._iter.__iterate(this._useKeys?function(t,n){return e(t,n,r)}:(n=t?Tn(this):0,function(i){return e(i,t?--n:n++,r)}),t)},rn.prototype.__iterator=function(e,t){if(this._useKeys)return this._iter.__iterator(e,t);var n=this._iter.__iterator(wr,t),r=t?Tn(this):0;return new w(function(){var i=n.next();return i.done?i:_(e,t?--r:r++,i.value,i)})},rn.prototype[fr]=!0,e(on,R),on.prototype.includes=function(e){return this._iter.includes(e)},on.prototype.__iterate=function(e,t){var n=this,r=0;return this._iter.__iterate(function(t){return e(t,r++,n)},t)},on.prototype.__iterator=function(e,t){var n=this._iter.__iterator(wr,t),r=0;return new w(function(){var t=n.next();return t.done?t:_(e,r++,t.value,t)})},e(an,I),an.prototype.has=function(e){return this._iter.includes(e)},an.prototype.__iterate=function(e,t){var n=this;return this._iter.__iterate(function(t){return e(t,t,n)},t)},an.prototype.__iterator=function(e,t){var n=this._iter.__iterator(wr,t);return new w(function(){var t=n.next();return t.done?t:_(e,t.value,t.value,t)})},e(sn,k),sn.prototype.entrySeq=function(){return this._iter.toSeq()},sn.prototype.__iterate=function(e,t){var n=this;return this._iter.__iterate(function(t){if(t){Mn(t);var r=o(t);return e(r?t.get(1):t[1],r?t.get(0):t[0],n)}},t)},sn.prototype.__iterator=function(e,t){var n=this._iter.__iterator(wr,t);return new w(function(){for(;;){var t=n.next();if(t.done)return t;var r=t.value;if(r){Mn(r);var i=o(r);return _(e,i?r.get(0):r[0],i?r.get(1):r[1],t)}}})},on.prototype.cacheResult=rn.prototype.cacheResult=an.prototype.cacheResult=sn.prototype.cacheResult=kn,e(Dn,tt),Dn.prototype.toString=function(){return this.__toString(Vn(this)+" {","}")},Dn.prototype.has=function(e){return this._defaultValues.hasOwnProperty(e)},Dn.prototype.get=function(e,t){if(!this.has(e))return t;var n=this._defaultValues[e];return this._map?this._map.get(e,n):n},Dn.prototype.clear=function(){if(this.__ownerID)return this._map&&this._map.clear(),this;var e=this.constructor;return e._empty||(e._empty=Bn(this,_t()))},Dn.prototype.set=function(e,t){if(!this.has(e))throw new Error('Cannot set unknown key "'+e+'" on '+Vn(this));if(this._map&&!this._map.has(e)){var n=this._defaultValues[e];if(t===n)return this}var r=this._map&&this._map.set(e,t);return this.__ownerID||r===this._map?this:Bn(this,r)},Dn.prototype.remove=function(e){if(!this.has(e))return this;var t=this._map&&this._map.remove(e);return this.__ownerID||t===this._map?this:Bn(this,t)},Dn.prototype.wasAltered=function(){return this._map.wasAltered()},Dn.prototype.__iterator=function(e,t){var r=this;return n(this._defaultValues).map(function(e,t){return r.get(t)}).__iterator(e,t)},Dn.prototype.__iterate=function(e,t){var r=this;return n(this._defaultValues).map(function(e,t){return r.get(t)
}).__iterate(e,t)},Dn.prototype.__ensureOwner=function(e){if(e===this.__ownerID)return this;var t=this._map&&this._map.__ensureOwner(e);return e?Bn(this,t,e):(this.__ownerID=e,this._map=t,this)};var Zr=Dn.prototype;Zr[pr]=Zr.remove,Zr.deleteIn=Zr.removeIn=$r.removeIn,Zr.merge=$r.merge,Zr.mergeWith=$r.mergeWith,Zr.mergeIn=$r.mergeIn,Zr.mergeDeep=$r.mergeDeep,Zr.mergeDeepWith=$r.mergeDeepWith,Zr.mergeDeepIn=$r.mergeDeepIn,Zr.setIn=$r.setIn,Zr.update=$r.update,Zr.updateIn=$r.updateIn,Zr.withMutations=$r.withMutations,Zr.asMutable=$r.asMutable,Zr.asImmutable=$r.asImmutable,e(On,rt),On.of=function(){return this(arguments)},On.fromKeys=function(e){return this(n(e).keySeq())},On.prototype.toString=function(){return this.__toString("Set {","}")},On.prototype.has=function(e){return this._map.has(e)},On.prototype.add=function(e){return Un(this,this._map.set(e,!0))},On.prototype.remove=function(e){return Un(this,this._map.remove(e))},On.prototype.clear=function(){return Un(this,this._map.clear())},On.prototype.union=function(){var e=ur.call(arguments,0);return e=e.filter(function(e){return 0!==e.size}),0===e.length?this:0!==this.size||this.__ownerID||1!==e.length?this.withMutations(function(t){for(var n=0;n<e.length;n++)i(e[n]).forEach(function(e){return t.add(e)})}):this.constructor(e[0])},On.prototype.intersect=function(){var e=ur.call(arguments,0);if(0===e.length)return this;e=e.map(function(e){return i(e)});var t=this;return this.withMutations(function(n){t.forEach(function(t){e.every(function(e){return e.includes(t)})||n.remove(t)})})},On.prototype.subtract=function(){var e=ur.call(arguments,0);if(0===e.length)return this;e=e.map(function(e){return i(e)});var t=this;return this.withMutations(function(n){t.forEach(function(t){e.some(function(e){return e.includes(t)})&&n.remove(t)})})},On.prototype.merge=function(){return this.union.apply(this,arguments)},On.prototype.mergeWith=function(){var e=ur.call(arguments,1);return this.union.apply(this,e)},On.prototype.sort=function(e){return Hn(wn(this,e))},On.prototype.sortBy=function(e,t){return Hn(wn(this,t,e))},On.prototype.wasAltered=function(){return this._map.wasAltered()},On.prototype.__iterate=function(e,t){var n=this;return this._map.__iterate(function(t,r){return e(r,r,n)},t)},On.prototype.__iterator=function(e,t){return this._map.map(function(e,t){return t}).__iterator(e,t)},On.prototype.__ensureOwner=function(e){if(e===this.__ownerID)return this;var t=this._map.__ensureOwner(e);return e?this.__make(t,e):(this.__ownerID=e,this._map=t,this)},On.isSet=Fn;var Jr="@@__IMMUTABLE_SET__@@",ei=On.prototype;ei[Jr]=!0,ei[pr]=ei.remove,ei.mergeDeep=ei.merge,ei.mergeDeepWith=ei.mergeWith,ei.withMutations=$r.withMutations,ei.asMutable=$r.asMutable,ei.asImmutable=$r.asImmutable,ei.__empty=$n,ei.__make=zn;var ti;e(Hn,On),Hn.of=function(){return this(arguments)},Hn.fromKeys=function(e){return this(n(e).keySeq())},Hn.prototype.toString=function(){return this.__toString("OrderedSet {","}")},Hn.isOrderedSet=jn;var ni=Hn.prototype;ni[fr]=!0,ni.__empty=Wn,ni.__make=Gn;var ri;e(qn,nt),qn.of=function(){return this(arguments)},qn.prototype.toString=function(){return this.__toString("Stack [","]")},qn.prototype.get=function(e,t){var n=this._head;for(e=m(this,e);n&&e--;)n=n.next;return n?n.value:t},qn.prototype.peek=function(){return this._head&&this._head.value},qn.prototype.push=function(){if(0===arguments.length)return this;for(var e=this.size+arguments.length,t=this._head,n=arguments.length-1;n>=0;n--)t={value:arguments[n],next:t};return this.__ownerID?(this.size=e,this._head=t,this.__hash=void 0,this.__altered=!0,this):Yn(e,t)},qn.prototype.pushAll=function(e){if(e=r(e),0===e.size)return this;lt(e.size);var t=this.size,n=this._head;return e.reverse().forEach(function(e){t++,n={value:e,next:n}}),this.__ownerID?(this.size=t,this._head=n,this.__hash=void 0,this.__altered=!0,this):Yn(t,n)},qn.prototype.pop=function(){return this.slice(1)},qn.prototype.unshift=function(){return this.push.apply(this,arguments)},qn.prototype.unshiftAll=function(e){return this.pushAll(e)},qn.prototype.shift=function(){return this.pop.apply(this,arguments)},qn.prototype.clear=function(){return 0===this.size?this:this.__ownerID?(this.size=0,this._head=void 0,this.__hash=void 0,this.__altered=!0,this):Kn()},qn.prototype.slice=function(e,t){if(g(e,t,this.size))return this;var n=y(e,this.size),r=b(t,this.size);if(r!==this.size)return nt.prototype.slice.call(this,e,t);for(var i=this.size-n,o=this._head;n--;)o=o.next;return this.__ownerID?(this.size=i,this._head=o,this.__hash=void 0,this.__altered=!0,this):Yn(i,o)},qn.prototype.__ensureOwner=function(e){return e===this.__ownerID?this:e?Yn(this.size,this._head,e,this.__hash):(this.__ownerID=e,this.__altered=!1,this)},qn.prototype.__iterate=function(e,t){if(t)return this.reverse().__iterate(e);for(var n=0,r=this._head;r&&e(r.value,n++,this)!==!1;)r=r.next;return n},qn.prototype.__iterator=function(e,t){if(t)return this.reverse().__iterator(e);var n=0,r=this._head;return new w(function(){if(r){var t=r.value;return r=r.next,_(e,n++,t)}return C()})},qn.isStack=Xn;var ii="@@__IMMUTABLE_STACK__@@",oi=qn.prototype;oi[ii]=!0,oi.withMutations=$r.withMutations,oi.asMutable=$r.asMutable,oi.asImmutable=$r.asImmutable,oi.wasAltered=$r.wasAltered;var ai;t.Iterator=w,Qn(t,{toArray:function(){lt(this.size);var e=new Array(this.size||0);return this.valueSeq().__iterate(function(t,n){e[n]=t}),e},toIndexedSeq:function(){return new on(this)},toJS:function(){return this.toSeq().map(function(e){return e&&"function"==typeof e.toJS?e.toJS():e}).__toJS()},toJSON:function(){return this.toSeq().map(function(e){return e&&"function"==typeof e.toJSON?e.toJSON():e}).__toJS()},toKeyedSeq:function(){return new rn(this,!0)},toMap:function(){return ht(this.toKeyedSeq())},toObject:function(){lt(this.size);var e={};return this.__iterate(function(t,n){e[n]=t}),e},toOrderedMap:function(){return Zt(this.toKeyedSeq())},toOrderedSet:function(){return Hn(a(this)?this.valueSeq():this)},toSet:function(){return On(a(this)?this.valueSeq():this)},toSetSeq:function(){return new an(this)},toSeq:function(){return s(this)?this.toIndexedSeq():a(this)?this.toKeyedSeq():this.toSetSeq()},toStack:function(){return qn(a(this)?this.valueSeq():this)},toList:function(){return Ft(a(this)?this.valueSeq():this)},toString:function(){return"[Iterable]"},__toString:function(e,t){return 0===this.size?e+t:e+" "+this.toSeq().map(this.__toStringMapper).join(", ")+" "+t},concat:function(){var e=ur.call(arguments,0);return Sn(this,gn(this,e))},includes:function(e){return this.some(function(t){return Y(t,e)})},entries:function(){return this.__iterator(_r)},every:function(e,t){lt(this.size);var n=!0;return this.__iterate(function(r,i,o){return e.call(t,r,i,o)?void 0:(n=!1,!1)}),n},filter:function(e,t){return Sn(this,hn(this,e,t,!0))},find:function(e,t,n){var r=this.findEntry(e,t);return r?r[1]:n},findEntry:function(e,t){var n;return this.__iterate(function(r,i,o){return e.call(t,r,i,o)?(n=[i,r],!1):void 0}),n},findLastEntry:function(e,t){return this.toSeq().reverse().findEntry(e,t)},forEach:function(e,t){return lt(this.size),this.__iterate(t?e.bind(t):e)},join:function(e){lt(this.size),e=void 0!==e?""+e:",";var t="",n=!0;return this.__iterate(function(r){n?n=!1:t+=e,t+=null!==r&&void 0!==r?r.toString():""}),t},keys:function(){return this.__iterator(xr)},map:function(e,t){return Sn(this,cn(this,e,t))},reduce:function(e,t,n){lt(this.size);var r,i;return arguments.length<2?i=!0:r=t,this.__iterate(function(t,o,a){i?(i=!1,r=t):r=e.call(n,r,t,o,a)}),r},reduceRight:function(){var e=this.toKeyedSeq().reverse();return e.reduce.apply(e,arguments)},reverse:function(){return Sn(this,ln(this,!0))},slice:function(e,t){return Sn(this,dn(this,e,t,!0))},some:function(e,t){return!this.every(er(e),t)},sort:function(e){return Sn(this,wn(this,e))},values:function(){return this.__iterator(wr)},butLast:function(){return this.slice(0,-1)},isEmpty:function(){return void 0!==this.size?0===this.size:!this.some(function(){return!0})},count:function(e,t){return d(e?this.toSeq().filter(e,t):this)},countBy:function(e,t){return fn(this,e,t)},equals:function(e){return K(this,e)},entrySeq:function(){var e=this;if(e._cache)return new D(e._cache);var t=e.toSeq().map(Jn).toIndexedSeq();return t.fromEntrySeq=function(){return e.toSeq()},t},filterNot:function(e,t){return this.filter(er(e),t)},findLast:function(e,t,n){return this.toKeyedSeq().reverse().find(e,t,n)},first:function(){return this.find(v)},flatMap:function(e,t){return Sn(this,bn(this,e,t))},flatten:function(e){return Sn(this,yn(this,e,!0))},fromEntrySeq:function(){return new sn(this)},get:function(e,t){return this.find(function(t,n){return Y(n,e)},void 0,t)},getIn:function(e,t){for(var n,r=this,i=In(e);!(n=i.next()).done;){var o=n.value;if(r=r&&r.get?r.get(o,gr):gr,r===gr)return t}return r},groupBy:function(e,t){return pn(this,e,t)},has:function(e){return this.get(e,gr)!==gr},hasIn:function(e){return this.getIn(e,gr)!==gr},isSubset:function(e){return e="function"==typeof e.includes?e:t(e),this.every(function(t){return e.includes(t)})},isSuperset:function(e){return e="function"==typeof e.isSubset?e:t(e),e.isSubset(this)},keySeq:function(){return this.toSeq().map(Zn).toIndexedSeq()},last:function(){return this.toSeq().reverse().first()},max:function(e){return _n(this,e)},maxBy:function(e,t){return _n(this,t,e)},min:function(e){return _n(this,e?tr(e):ir)},minBy:function(e,t){return _n(this,t?tr(t):ir,e)},rest:function(){return this.slice(1)},skip:function(e){return this.slice(Math.max(0,e))},skipLast:function(e){return Sn(this,this.toSeq().reverse().skip(e).reverse())},skipWhile:function(e,t){return Sn(this,vn(this,e,t,!0))},skipUntil:function(e,t){return this.skipWhile(er(e),t)},sortBy:function(e,t){return Sn(this,wn(this,t,e))},take:function(e){return this.slice(0,Math.max(0,e))},takeLast:function(e){return Sn(this,this.toSeq().reverse().take(e).reverse())},takeWhile:function(e,t){return Sn(this,mn(this,e,t))},takeUntil:function(e,t){return this.takeWhile(er(e),t)},valueSeq:function(){return this.toIndexedSeq()},hashCode:function(){return this.__hash||(this.__hash=or(this))}});var si=t.prototype;si[cr]=!0,si[Sr]=si.values,si.__toJS=si.toArray,si.__toStringMapper=nr,si.inspect=si.toSource=function(){return this.toString()},si.chain=si.flatMap,si.contains=si.includes,function(){try{Object.defineProperty(si,"length",{get:function(){if(!t.noLengthWarning){var e;try{throw new Error}catch(n){e=n.stack}if(-1===e.indexOf("_wrapObject"))return 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),this.size}}})}catch(e){}}(),Qn(n,{flip:function(){return Sn(this,un(this))},findKey:function(e,t){var n=this.findEntry(e,t);return n&&n[0]},findLastKey:function(e,t){return this.toSeq().reverse().findKey(e,t)},keyOf:function(e){return this.findKey(function(t){return Y(t,e)})},lastKeyOf:function(e){return this.findLastKey(function(t){return Y(t,e)})},mapEntries:function(e,t){var n=this,r=0;return Sn(this,this.toSeq().map(function(i,o){return e.call(t,[o,i],r++,n)}).fromEntrySeq())},mapKeys:function(e,t){var n=this;return Sn(this,this.toSeq().flip().map(function(r,i){return e.call(t,r,i,n)}).flip())}});var ui=n.prototype;ui[lr]=!0,ui[Sr]=si.entries,ui.__toJS=si.toObject,ui.__toStringMapper=function(e,t){return JSON.stringify(t)+": "+nr(e)},Qn(r,{toKeyedSeq:function(){return new rn(this,!1)},filter:function(e,t){return Sn(this,hn(this,e,t,!1))},findIndex:function(e,t){var n=this.findEntry(e,t);return n?n[0]:-1},indexOf:function(e){var t=this.toKeyedSeq().keyOf(e);return void 0===t?-1:t},lastIndexOf:function(e){var t=this.toKeyedSeq().reverse().keyOf(e);return void 0===t?-1:t},reverse:function(){return Sn(this,ln(this,!1))},slice:function(e,t){return Sn(this,dn(this,e,t,!1))},splice:function(e,t){var n=arguments.length;if(t=Math.max(0|t,0),0===n||2===n&&!t)return this;e=y(e,0>e?this.count():this.size);var r=this.slice(0,e);return Sn(this,1===n?r:r.concat(p(arguments,2),this.slice(e+t)))},findLastIndex:function(e,t){var n=this.toKeyedSeq().findLastKey(e,t);return void 0===n?-1:n},first:function(){return this.get(0)},flatten:function(e){return Sn(this,yn(this,e,!1))},get:function(e,t){return e=m(this,e),0>e||1/0===this.size||void 0!==this.size&&e>this.size?t:this.find(function(t,n){return n===e},void 0,t)},has:function(e){return e=m(this,e),e>=0&&(void 0!==this.size?1/0===this.size||e<this.size:-1!==this.indexOf(e))},interpose:function(e){return Sn(this,xn(this,e))},interleave:function(){var e=[this].concat(p(arguments)),t=En(this.toSeq(),R.of,e),n=t.flatten(!0);return t.size&&(n.size=t.size*e.length),Sn(this,n)},last:function(){return this.get(-1)},skipWhile:function(e,t){return Sn(this,vn(this,e,t,!1))},zip:function(){var e=[this].concat(p(arguments));return Sn(this,En(this,rr,e))},zipWith:function(e){var t=p(arguments);return t[0]=this,Sn(this,En(this,e,t))}}),r.prototype[hr]=!0,r.prototype[fr]=!0,Qn(i,{get:function(e,t){return this.has(e)?e:t},includes:function(e){return this.has(e)},keySeq:function(){return this.valueSeq()}}),i.prototype.has=si.includes,i.prototype.contains=i.prototype.includes,Qn(k,n.prototype),Qn(R,r.prototype),Qn(I,i.prototype),Qn(tt,n.prototype),Qn(nt,r.prototype),Qn(rt,i.prototype);var ci={Iterable:t,Seq:P,Collection:et,Map:ht,OrderedMap:Zt,List:Ft,Stack:qn,Set:On,OrderedSet:Hn,Record:Dn,Range:J,Repeat:Q,is:Y,fromJS:G};return ci});var h={};(function(){function e(e){throw e}function t(e,t){var n=e.split("."),r=M;!(n[0]in r)&&r.execScript&&r.execScript("var "+n[0]);for(var i;n.length&&(i=n.shift());)n.length||t===E?r=r[i]?r[i]:r[i]={}:r[i]=t}function n(t,n){this.index="number"==typeof n?n:0,this.m=0,this.buffer=t instanceof(T?Uint8Array:Array)?t:new(T?Uint8Array:Array)(32768),2*this.buffer.length<=this.index&&e(Error("invalid index")),this.buffer.length<=this.index&&this.f()}function r(e,t,n){var r,i="number"==typeof t?t:t=0,o="number"==typeof n?n:e.length;for(r=-1,i=7&o;i--;++t)r=r>>>8^V[255&(r^e[t])];for(i=o>>3;i--;t+=8)r=r>>>8^V[255&(r^e[t])],r=r>>>8^V[255&(r^e[t+1])],r=r>>>8^V[255&(r^e[t+2])],r=r>>>8^V[255&(r^e[t+3])],r=r>>>8^V[255&(r^e[t+4])],r=r>>>8^V[255&(r^e[t+5])],r=r>>>8^V[255&(r^e[t+6])],r=r>>>8^V[255&(r^e[t+7])];return(4294967295^r)>>>0}function i(){}function o(e){this.buffer=new(T?Uint16Array:Array)(2*e),this.length=0}function a(e){var t,n,r,i,o,a,s,u,c,l,h=e.length,f=0,p=Number.POSITIVE_INFINITY;for(u=0;h>u;++u)e[u]>f&&(f=e[u]),e[u]<p&&(p=e[u]);for(t=1<<f,n=new(T?Uint32Array:Array)(t),r=1,i=0,o=2;f>=r;){for(u=0;h>u;++u)if(e[u]===r){for(a=0,s=i,c=0;r>c;++c)a=a<<1|1&s,s>>=1;for(l=r<<16|u,c=a;t>c;c+=o)n[c]=l;++i}++r,i<<=1,o<<=1}return[n,f,p]}function s(e,t){this.k=N,this.I=0,this.input=T&&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=T&&t.outputBuffer instanceof Array?new Uint8Array(t.outputBuffer):t.outputBuffer),"number"==typeof t.outputIndex&&(this.b=t.outputIndex)),this.a||(this.a=new(T?Uint8Array:Array)(32768))}function u(e,t){this.length=e,this.Q=t}function c(t,n){function r(t,n){var r,i=t.Q,o=[],a=0;r=z[t.length],o[a++]=65535&r,o[a++]=r>>16&255,o[a++]=r>>24;var s;switch(S){case 1===i:s=[0,i-1,0];break;case 2===i:s=[1,i-2,0];break;case 3===i:s=[2,i-3,0];break;case 4===i:s=[3,i-4,0];break;case 6>=i:s=[4,i-5,1];break;case 8>=i:s=[5,i-7,1];break;case 12>=i:s=[6,i-9,2];break;case 16>=i:s=[7,i-13,2];break;case 24>=i:s=[8,i-17,3];break;case 32>=i:s=[9,i-25,3];break;case 48>=i:s=[10,i-33,4];break;case 64>=i:s=[11,i-49,4];break;case 96>=i:s=[12,i-65,5];break;case 128>=i:s=[13,i-97,5];break;case 192>=i:s=[14,i-129,6];break;case 256>=i:s=[15,i-193,6];break;case 384>=i:s=[16,i-257,7];break;case 512>=i:s=[17,i-385,7];break;case 768>=i:s=[18,i-513,8];break;case 1024>=i:s=[19,i-769,8];break;case 1536>=i:s=[20,i-1025,9];break;case 2048>=i:s=[21,i-1537,9];break;case 3072>=i:s=[22,i-2049,10];break;case 4096>=i:s=[23,i-3073,10];break;case 6144>=i:s=[24,i-4097,11];break;case 8192>=i:s=[25,i-6145,11];break;case 12288>=i:s=[26,i-8193,12];break;case 16384>=i:s=[27,i-12289,12];break;case 24576>=i:s=[28,i-16385,13];break;case 32768>=i:s=[29,i-24577,13];break;default:e("invalid distance")}r=s,o[a++]=r[0],o[a++]=r[1],o[a++]=r[2];var u,c;for(u=0,c=o.length;c>u;++u)m[v++]=o[u];y[o[0]]++,b[o[3]]++,g=t.length+n-1,f=null}var i,o,a,s,u,c,h,f,p,d={},m=T?new Uint16Array(2*n.length):[],v=0,g=0,y=new(T?Uint32Array:Array)(286),b=new(T?Uint32Array:Array)(30),x=t.I;if(!T){for(a=0;285>=a;)y[a++]=0;for(a=0;29>=a;)b[a++]=0}for(y[256]=1,i=0,o=n.length;o>i;++i){for(a=u=0,s=3;s>a&&i+a!==o;++a)u=u<<8|n[i+a];if(d[u]===E&&(d[u]=[]),c=d[u],!(0<g--)){for(;0<c.length&&32768<i-c[0];)c.shift();if(i+3>=o){for(f&&r(f,-1),a=0,s=o-i;s>a;++a)p=n[i+a],m[v++]=p,++y[p];break}0<c.length?(h=l(n,i,c),f?f.length<h.length?(p=n[i-1],m[v++]=p,++y[p],r(h,0)):r(f,-1):h.length<x?f=h:r(h,0)):f?r(f,-1):(p=n[i],m[v++]=p,++y[p])}c.push(i)}return m[v++]=256,y[256]++,t.W=y,t.V=b,T?m.subarray(0,v):m}function l(e,t,n){var r,i,o,a,s,c,l=0,h=e.length;a=0,c=n.length;e:for(;c>a;a++){if(r=n[c-a-1],o=3,l>3){for(s=l;s>3;s--)if(e[r+s-1]!==e[t+s-1])continue e;o=l}for(;258>o&&h>t+o&&e[r+o]===e[t+o];)++o;if(o>l&&(i=r,l=o),258===o)break}return new u(l,t-i)}function h(e,t){var n,r,i,a,s,u=e.length,c=new o(572),l=new(T?Uint8Array:Array)(u);if(!T)for(a=0;u>a;a++)l[a]=0;for(a=0;u>a;++a)0<e[a]&&c.push(a,e[a]);if(n=Array(c.length/2),r=new(T?Uint32Array:Array)(c.length/2),1===n.length)return l[c.pop().index]=1,l;for(a=0,s=c.length/2;s>a;++a)n[a]=c.pop(),r[a]=n[a].value;for(i=f(r,r.length,t),a=0,s=n.length;s>a;++a)l[n[a].index]=i[a];return l}function f(e,t,n){function r(e){var n=p[e][d[e]];n===t?(r(e+1),r(e+1)):--h[n],++d[e]}var i,o,a,s,u,c=new(T?Uint16Array:Array)(n),l=new(T?Uint8Array:Array)(n),h=new(T?Uint8Array:Array)(t),f=Array(n),p=Array(n),d=Array(n),m=(1<<n)-t,v=1<<n-1;for(c[n-1]=t,o=0;n>o;++o)v>m?l[o]=0:(l[o]=1,m-=v),m<<=1,c[n-2-o]=(c[n-1-o]/2|0)+t;for(c[0]=l[0],f[0]=Array(c[0]),p[0]=Array(c[0]),o=1;n>o;++o)c[o]>2*c[o-1]+l[o]&&(c[o]=2*c[o-1]+l[o]),f[o]=Array(c[o]),p[o]=Array(c[o]);for(i=0;t>i;++i)h[i]=n;for(a=0;a<c[n-1];++a)f[n-1][a]=e[a],p[n-1][a]=a;for(i=0;n>i;++i)d[i]=0;for(1===l[n-1]&&(--h[0],++d[n-1]),o=n-2;o>=0;--o){for(s=i=0,u=d[o+1],a=0;a<c[o];a++)s=f[o+1][u]+f[o+1][u+1],s>e[i]?(f[o][a]=s,p[o][a]=t,u+=2):(f[o][a]=e[i],p[o][a]=i,++i);d[o]=0,1===l[o]&&r(o)}return h}function p(e){var t,n,r,i,o=new(T?Uint16Array:Array)(e.length),a=[],s=[],u=0;for(t=0,n=e.length;n>t;t++)a[e[t]]=(0|a[e[t]])+1;for(t=1,n=16;n>=t;t++)s[t]=u,u+=0|a[t],u<<=1;for(t=0,n=e.length;n>t;t++)for(u=s[e[t]],s[e[t]]+=1,r=o[t]=0,i=e[t];i>r;r++)o[t]=o[t]<<1|1&u,u>>>=1;return o}function d(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={})}function m(t,n){switch(this.p=[],this.q=32768,this.e=this.j=this.c=this.u=0,this.input=T?new Uint8Array(t):t,this.w=!1,this.r=q,this.M=!1,(n||!(n={}))&&(n.index&&(this.c=n.index),n.bufferSize&&(this.q=n.bufferSize),n.bufferType&&(this.r=n.bufferType),n.resize&&(this.M=n.resize)),this.r){case W:this.b=32768,this.a=new(T?Uint8Array:Array)(32768+this.q+258);break;case q:this.b=0,this.a=new(T?Uint8Array:Array)(this.q),this.f=this.U,this.B=this.R,this.s=this.T;break;default:e(Error("invalid inflate mode"))}}function v(t,n){for(var r,i=t.j,o=t.e,a=t.input,s=t.c,u=a.length;n>o;)s>=u&&e(Error("input buffer is broken")),i|=a[s++]<<o,o+=8;return r=i&(1<<n)-1,t.j=i>>>n,t.e=o-n,t.c=s,r}function g(e,t){for(var n,r,i=e.j,o=e.e,a=e.input,s=e.c,u=a.length,c=t[0],l=t[1];l>o&&!(s>=u);)i|=a[s++]<<o,o+=8;return n=c[i&(1<<l)-1],r=n>>>16,e.j=i>>r,e.e=o-r,e.c=s,65535&n}function y(e){function t(e,t,n){var r,i,o,a=this.J;for(o=0;e>o;)switch(r=g(this,t)){case 16:for(i=3+v(this,2);i--;)n[o++]=a;break;case 17:for(i=3+v(this,3);i--;)n[o++]=0;a=0;break;case 18:for(i=11+v(this,7);i--;)n[o++]=0;a=0;break;default:a=n[o++]=r}return this.J=a,n}var n,r,i,o,s=v(e,5)+257,u=v(e,5)+1,c=v(e,4)+4,l=new(T?Uint8Array:Array)(Z.length);for(o=0;c>o;++o)l[Z[o]]=v(e,3);if(!T)for(o=c,c=l.length;c>o;++o)l[Z[o]]=0;n=a(l),r=new(T?Uint8Array:Array)(s),i=new(T?Uint8Array:Array)(u),e.J=0,e.s(a(t.call(e,s,n,r)),a(t.call(e,u,n,i)))}function b(e){this.input=e,this.c=0,this.t=[],this.D=!1}function x(e){if("string"==typeof e){var t,n,r=e.split("");for(t=0,n=r.length;n>t;t++)r[t]=(255&r[t].charCodeAt(0))>>>0;e=r}for(var i,o=1,a=0,s=e.length,u=0;s>0;){i=s>1024?1024:s,s-=i;do o+=e[u++],a+=o;while(--i);o%=65521,a%=65521}return(a<<16|o)>>>0}function w(t,n){var r,i;switch(this.input=t,this.c=0,(n||!(n={}))&&(n.index&&(this.c=n.index),n.verify&&(this.$=n.verify)),r=t[this.c++],i=t[this.c++],15&r){case pt:this.method=pt;break;default:e(Error("unsupported compression method"))}0!==((r<<8)+i)%31&&e(Error("invalid fcheck flag:"+((r<<8)+i)%31)),32&i&&e(Error("fdict flag is not supported")),this.L=new m(t,{index:this.c,bufferSize:n.bufferSize,bufferType:n.bufferType,resize:n.resize})}function _(e,t){this.input=e,this.a=new(T?Uint8Array:Array)(32768),this.k=dt.o;var n,r={};!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 s(this.input,r)}function C(e,n){var r,i,o,a;if(Object.keys)r=Object.keys(n);else for(i in r=[],o=0,n)r[o++]=i;for(o=0,a=r.length;a>o;++o)i=r[o],t(e+"."+i,n[i])}var E=void 0,S=!0,M=this,T="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Uint32Array&&"undefined"!=typeof DataView;n.prototype.f=function(){var e,t=this.buffer,n=t.length,r=new(T?Uint8Array:Array)(n<<1);if(T)r.set(t);else for(e=0;n>e;++e)r[e]=t[e];return this.buffer=r},n.prototype.d=function(e,t,n){var r,i=this.buffer,o=this.index,a=this.m,s=i[o];if(n&&t>1&&(e=t>8?(D[255&e]<<24|D[e>>>8&255]<<16|D[e>>>16&255]<<8|D[e>>>24&255])>>32-t:D[e]>>8-t),8>t+a)s=s<<t|e,a+=t;else for(r=0;t>r;++r)s=s<<1|e>>t-r-1&1,8===++a&&(a=0,i[o++]=D[s],s=0,o===i.length&&(i=this.f()));i[o]=s,this.buffer=i,this.m=a,this.index=o},n.prototype.finish=function(){var e,t=this.buffer,n=this.index;return 0<this.m&&(t[n]<<=8-this.m,t[n]=D[t[n]],n++),T?e=t.subarray(0,n):(t.length=n,e=t),e};var A,P=new(T?Uint8Array:Array)(256);for(A=0;256>A;++A){for(var k=A,R=k,I=7,k=k>>>1;k;k>>>=1)R<<=1,R|=1&k,--I;P[A]=(R<<I&255)>>>0}var D=P,B=[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],V=T?new Uint32Array(B):B;i.prototype.getName=function(){return this.name},i.prototype.getData=function(){return this.data},i.prototype.Y=function(){return this.Z},t("Zlib.GunzipMember",i),t("Zlib.GunzipMember.prototype.getName",i.prototype.getName),t("Zlib.GunzipMember.prototype.getData",i.prototype.getData),t("Zlib.GunzipMember.prototype.getMtime",i.prototype.Y),o.prototype.getParent=function(e){return 2*((e-2)/4|0)},o.prototype.push=function(e,t){var n,r,i,o=this.buffer;for(n=this.length,o[this.length++]=t,o[this.length++]=e;n>0&&(r=this.getParent(n),o[n]>o[r]);)i=o[n],o[n]=o[r],o[r]=i,i=o[n+1],o[n+1]=o[r+1],o[r+1]=i,n=r;return this.length},o.prototype.pop=function(){var e,t,n,r,i,o=this.buffer;for(t=o[0],e=o[1],this.length-=2,o[0]=o[this.length],o[1]=o[this.length+1],i=0;(r=2*i+2,!(r>=this.length))&&(r+2<this.length&&o[r+2]>o[r]&&(r+=2),o[r]>o[i]);)n=o[i],o[i]=o[r],o[r]=n,n=o[i+1],o[i+1]=o[r+1],o[r+1]=n,i=r;return{index:e,value:t,length:this.length}};var L,N=2,O={NONE:0,v:1,o:N,ba:3},F=[];for(L=0;288>L;L++)switch(S){case 143>=L:F.push([L+48,8]);break;case 255>=L:F.push([L-144+400,9]);break;case 279>=L:F.push([L-256+0,7]);break;case 287>=L:F.push([L-280+192,8]);break;default:e("invalid literal: "+L)}s.prototype.g=function(){var t,r,i,o,a=this.input;switch(this.k){case 0:for(i=0,o=a.length;o>i;){r=T?a.subarray(i,i+65535):a.slice(i,i+65535),i+=r.length;var s=r,u=i===o,l=E,f=E,d=E,m=E,v=E,g=this.a,y=this.b;if(T){for(g=new Uint8Array(this.a.buffer);g.length<=y+s.length+5;)g=new Uint8Array(g.length<<1);g.set(this.a)}if(l=u?1:0,g[y++]=0|l,f=s.length,d=~f+65536&65535,g[y++]=255&f,g[y++]=f>>>8&255,g[y++]=255&d,g[y++]=d>>>8&255,T)g.set(s,y),y+=s.length,g=g.subarray(0,y);else{for(m=0,v=s.length;v>m;++m)g[y++]=s[m];g.length=y}this.b=y,this.a=g}break;case 1:var b=new n(T?new Uint8Array(this.a.buffer):this.a,this.b);b.d(1,1,S),b.d(1,2,S);var x,w,_,C=c(this,a);for(x=0,w=C.length;w>x;x++)if(_=C[x],n.prototype.d.apply(b,F[_]),_>256)b.d(C[++x],C[++x],S),b.d(C[++x],5),b.d(C[++x],C[++x],S);else if(256===_)break;this.a=b.finish(),this.b=this.a.length;break;case N:var M,A,P,k,R,I,D,B,V,L,O,U,z,$,H,j=new n(T?new Uint8Array(this.a.buffer):this.a,this.b),G=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],W=Array(19);for(M=N,j.d(1,1,S),j.d(M,2,S),A=c(this,a),I=h(this.W,15),D=p(I),B=h(this.V,7),V=p(B),P=286;P>257&&0===I[P-1];P--);for(k=30;k>1&&0===B[k-1];k--);var q,X,Y,K,Q,Z,J=P,et=k,tt=new(T?Uint32Array:Array)(J+et),nt=new(T?Uint32Array:Array)(316),rt=new(T?Uint8Array:Array)(19);for(q=X=0;J>q;q++)tt[X++]=I[q];for(q=0;et>q;q++)tt[X++]=B[q];if(!T)for(q=0,K=rt.length;K>q;++q)rt[q]=0;for(q=Q=0,K=tt.length;K>q;q+=X){for(X=1;K>q+X&&tt[q+X]===tt[q];++X);if(Y=X,0===tt[q])if(3>Y)for(;0<Y--;)nt[Q++]=0,rt[0]++;else for(;Y>0;)Z=138>Y?Y:138,Z>Y-3&&Y>Z&&(Z=Y-3),10>=Z?(nt[Q++]=17,nt[Q++]=Z-3,rt[17]++):(nt[Q++]=18,nt[Q++]=Z-11,rt[18]++),Y-=Z;else if(nt[Q++]=tt[q],rt[tt[q]]++,Y--,3>Y)for(;0<Y--;)nt[Q++]=tt[q],rt[tt[q]]++;else for(;Y>0;)Z=6>Y?Y:6,Z>Y-3&&Y>Z&&(Z=Y-3),nt[Q++]=16,nt[Q++]=Z-3,rt[16]++,Y-=Z}for(t=T?nt.subarray(0,Q):nt.slice(0,Q),L=h(rt,7),$=0;19>$;$++)W[$]=L[G[$]];for(R=19;R>4&&0===W[R-1];R--);for(O=p(L),j.d(P-257,5,S),j.d(k-1,5,S),j.d(R-4,4,S),$=0;R>$;$++)j.d(W[$],3,S);for($=0,H=t.length;H>$;$++)if(U=t[$],j.d(O[U],L[U],S),U>=16){switch($++,U){case 16:z=2;break;case 17:z=3;break;case 18:z=7;break;default:e("invalid code: "+U)}j.d(t[$],z,S)}var it,ot,at,st,ut,ct,lt,ht,ft=[D,I],pt=[V,B];for(ut=ft[0],ct=ft[1],lt=pt[0],ht=pt[1],it=0,ot=A.length;ot>it;++it)if(at=A[it],j.d(ut[at],ct[at],S),at>256)j.d(A[++it],A[++it],S),st=A[++it],j.d(lt[st],ht[st],S),j.d(A[++it],A[++it],S);else if(256===at)break;this.a=j.finish(),this.b=this.a.length;break;default:e("invalid compression type")}return this.a};var U=function(){function t(t){switch(S){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,r,i=[];for(n=3;258>=n;n++)r=t(n),i[n]=r[2]<<24|r[1]<<16|r[0];return i}(),z=T?new Uint32Array(U):U;d.prototype.g=function(){var e,t,n,i,o,a,u,c,l=new(T?Uint8Array:Array)(32768),h=0,f=this.input,p=this.c,d=this.filename,m=this.A;if(l[h++]=31,l[h++]=139,l[h++]=8,e=0,this.i.fname&&(e|=j),this.i.fcomment&&(e|=G),this.i.fhcrc&&(e|=H),l[h++]=e,t=(Date.now?Date.now():+new Date)/1e3|0,l[h++]=255&t,l[h++]=t>>>8&255,l[h++]=t>>>16&255,l[h++]=t>>>24&255,l[h++]=0,l[h++]=$,this.i.fname!==E){for(u=0,c=d.length;c>u;++u)a=d.charCodeAt(u),a>255&&(l[h++]=a>>>8&255),l[h++]=255&a;l[h++]=0}if(this.i.comment){for(u=0,c=m.length;c>u;++u)a=m.charCodeAt(u),a>255&&(l[h++]=a>>>8&255),l[h++]=255&a;l[h++]=0}return this.i.fhcrc&&(n=65535&r(l,0,h),l[h++]=255&n,l[h++]=n>>>8&255),this.l.outputBuffer=l,this.l.outputIndex=h,o=new s(f,this.l),l=o.g(),h=o.b,T&&(h+8>l.buffer.byteLength?(this.a=new Uint8Array(h+8),this.a.set(new Uint8Array(l.buffer)),l=this.a):l=new Uint8Array(l.buffer)),i=r(f,E,E),l[h++]=255&i,l[h++]=i>>>8&255,l[h++]=i>>>16&255,l[h++]=i>>>24&255,c=f.length,l[h++]=255&c,l[h++]=c>>>8&255,l[h++]=c>>>16&255,l[h++]=c>>>24&255,this.c=p,T&&h<l.length&&(this.a=l=l.subarray(0,h)),l};var $=255,H=2,j=8,G=16;t("Zlib.Gzip",d),t("Zlib.Gzip.prototype.compress",d.prototype.g);var W=0,q=1,X={O:W,N:q};m.prototype.h=function(){for(;!this.w;){var t=v(this,3);switch(1&t&&(this.w=S),t>>>=1){case 0:var n=this.input,r=this.c,i=this.a,o=this.b,a=n.length,s=E,u=E,c=i.length,l=E;switch(this.e=this.j=0,r+1>=a&&e(Error("invalid uncompressed block header: LEN")),s=n[r++]|n[r++]<<8,r+1>=a&&e(Error("invalid uncompressed block header: NLEN")),u=n[r++]|n[r++]<<8,s===~u&&e(Error("invalid uncompressed block header: length verify")),r+s>n.length&&e(Error("input buffer is broken")),this.r){case W:for(;o+s>i.length;){if(l=c-o,s-=l,T)i.set(n.subarray(r,r+l),o),o+=l,r+=l;else for(;l--;)i[o++]=n[r++];this.b=o,i=this.f(),o=this.b}break;case q:for(;o+s>i.length;)i=this.f({F:2});break;default:e(Error("invalid inflate mode"))}if(T)i.set(n.subarray(r,r+s),o),o+=s,r+=s;else for(;s--;)i[o++]=n[r++];this.c=r,this.b=o,this.a=i;
break;case 1:this.s(lt,ft);break;case 2:y(this);break;default:e(Error("unknown BTYPE: "+t))}}return this.B()};var Y,K,Q=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],Z=T?new Uint16Array(Q):Q,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],et=T?new Uint16Array(J):J,tt=[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],nt=T?new Uint8Array(tt):tt,rt=[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],it=T?new Uint16Array(rt):rt,ot=[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],at=T?new Uint8Array(ot):ot,st=new(T?Uint8Array:Array)(288);for(Y=0,K=st.length;K>Y;++Y)st[Y]=143>=Y?8:255>=Y?9:279>=Y?7:8;var ut,ct,lt=a(st),ht=new(T?Uint8Array:Array)(30);for(ut=0,ct=ht.length;ct>ut;++ut)ht[ut]=5;var ft=a(ht);m.prototype.s=function(e,t){var n=this.a,r=this.b;this.C=e;for(var i,o,a,s,u=n.length-258;256!==(i=g(this,e));)if(256>i)r>=u&&(this.b=r,n=this.f(),r=this.b),n[r++]=i;else for(o=i-257,s=et[o],0<nt[o]&&(s+=v(this,nt[o])),i=g(this,t),a=it[i],0<at[i]&&(a+=v(this,at[i])),r>=u&&(this.b=r,n=this.f(),r=this.b);s--;)n[r]=n[r++-a];for(;8<=this.e;)this.e-=8,this.c--;this.b=r},m.prototype.T=function(e,t){var n=this.a,r=this.b;this.C=e;for(var i,o,a,s,u=n.length;256!==(i=g(this,e));)if(256>i)r>=u&&(n=this.f(),u=n.length),n[r++]=i;else for(o=i-257,s=et[o],0<nt[o]&&(s+=v(this,nt[o])),i=g(this,t),a=it[i],0<at[i]&&(a+=v(this,at[i])),r+s>u&&(n=this.f(),u=n.length);s--;)n[r]=n[r++-a];for(;8<=this.e;)this.e-=8,this.c--;this.b=r},m.prototype.f=function(){var e,t,n=new(T?Uint8Array:Array)(this.b-32768),r=this.b-32768,i=this.a;if(T)n.set(i.subarray(32768,n.length));else for(e=0,t=n.length;t>e;++e)n[e]=i[e+32768];if(this.p.push(n),this.u+=n.length,T)i.set(i.subarray(r,r+32768));else for(e=0;32768>e;++e)i[e]=i[r+e];return this.b=32768,i},m.prototype.U=function(e){var t,n,r,i,o=this.input.length/this.c+1|0,a=this.input,s=this.a;return e&&("number"==typeof e.F&&(o=e.F),"number"==typeof e.P&&(o+=e.P)),2>o?(n=(a.length-this.c)/this.C[2],i=258*(n/2)|0,r=i<s.length?s.length+i:s.length<<1):r=s.length*o,T?(t=new Uint8Array(r),t.set(s)):t=s,this.a=t},m.prototype.B=function(){var e,t,n,r,i,o=0,a=this.a,s=this.p,u=new(T?Uint8Array:Array)(this.u+(this.b-32768));if(0===s.length)return T?this.a.subarray(32768,this.b):this.a.slice(32768,this.b);for(t=0,n=s.length;n>t;++t)for(e=s[t],r=0,i=e.length;i>r;++r)u[o++]=e[r];for(t=32768,n=this.b;n>t;++t)u[o++]=a[t];return this.p=[],this.buffer=u},m.prototype.R=function(){var e,t=this.b;return T?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),this.buffer=e},b.prototype.X=function(){return this.D||this.h(),this.t.slice()},b.prototype.h=function(){for(var t=this.input.length;this.c<t;){var n=new i,o=E,a=E,s=E,u=E,c=E,l=E,h=E,f=E,p=E,d=this.input,v=this.c;switch(n.G=d[v++],n.H=d[v++],(31!==n.G||139!==n.H)&&e(Error("invalid file signature:"+n.G+","+n.H)),n.z=d[v++],n.z){case 8:break;default:e(Error("unknown compression method: "+n.z))}if(n.n=d[v++],f=d[v++]|d[v++]<<8|d[v++]<<16|d[v++]<<24,n.Z=new Date(1e3*f),n.fa=d[v++],n.ea=d[v++],0<(4&n.n)&&(n.aa=d[v++]|d[v++]<<8,v+=n.aa),0<(n.n&j)){for(h=[],l=0;0<(c=d[v++]);)h[l++]=String.fromCharCode(c);n.name=h.join("")}if(0<(n.n&G)){for(h=[],l=0;0<(c=d[v++]);)h[l++]=String.fromCharCode(c);n.A=h.join("")}0<(n.n&H)&&(n.S=65535&r(d,0,v),n.S!==(d[v++]|d[v++]<<8)&&e(Error("invalid header crc16"))),o=d[d.length-4]|d[d.length-3]<<8|d[d.length-2]<<16|d[d.length-1]<<24,d.length-v-4-4<512*o&&(u=o),a=new m(d,{index:v,bufferSize:u}),n.data=s=a.h(),v=a.c,n.ca=p=(d[v++]|d[v++]<<8|d[v++]<<16|d[v++]<<24)>>>0,r(s,E,E)!==p&&e(Error("invalid CRC-32 checksum: 0x"+r(s,E,E).toString(16)+" / 0x"+p.toString(16))),n.da=o=(d[v++]|d[v++]<<8|d[v++]<<16|d[v++]<<24)>>>0,(4294967295&s.length)!==o&&e(Error("invalid input size: "+(4294967295&s.length)+" / "+o)),this.t.push(n),this.c=v}this.D=S;var g,y,b,x=this.t,w=0,_=0;for(g=0,y=x.length;y>g;++g)_+=x[g].data.length;if(T)for(b=new Uint8Array(_),g=0;y>g;++g)b.set(x[g].data,w),w+=x[g].data.length;else{for(b=[],g=0;y>g;++g)b[g]=x[g].data;b=Array.prototype.concat.apply([],b)}return b},t("Zlib.Gunzip",b),t("Zlib.Gunzip.prototype.decompress",b.prototype.h),t("Zlib.Gunzip.prototype.getMembers",b.prototype.X),w.prototype.h=function(){var t,n,r=this.input;return t=this.L.h(),this.c=this.L.c,this.$&&(n=(r[this.c++]<<24|r[this.c++]<<16|r[this.c++]<<8|r[this.c++])>>>0,n!==x(t)&&e(Error("invalid adler-32 checksum"))),t};var pt=8,dt=O;_.prototype.g=function(){var t,n,r,i,o,a,s,u=0;switch(s=this.a,t=pt){case pt:n=Math.LOG2E*Math.log(32768)-8;break;default:e(Error("invalid compression method"))}switch(r=n<<4|t,s[u++]=r,t){case pt:switch(this.k){case dt.NONE:o=0;break;case dt.v:o=1;break;case dt.o:o=2;break;default:e(Error("unsupported compression type"))}break;default:e(Error("invalid compression method"))}return i=o<<6|0,s[u++]=i|31-(256*r+i)%31,a=x(this.input),this.K.b=u,s=this.K.g(),u=s.length,T&&(s=new Uint8Array(s.buffer),s.length<=u+4&&(this.a=new Uint8Array(s.length+4),this.a.set(s),s=this.a),s=s.subarray(0,u+4)),s[u++]=a>>24&255,s[u++]=a>>16&255,s[u++]=a>>8&255,s[u++]=255&a,s},t("Zlib.Inflate",w),t("Zlib.Inflate.prototype.decompress",w.prototype.h),C("Zlib.Inflate.BufferType",{ADAPTIVE:X.N,BLOCK:X.O}),t("Zlib.Deflate",_),t("Zlib.Deflate.compress",function(e,t){return new _(e,t).g()}),t("Zlib.Deflate.prototype.compress",_.prototype.g),C("Zlib.Deflate.CompressionType",{NONE:dt.NONE,FIXED:dt.v,DYNAMIC:dt.o})}).call(h);var a,f=h.Zlib,c=this&&this.__extends||function(e,t){function n(){this.constructor=e}for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r]);e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)};!function(e){var t;!function(e){e.VERSION={number:"1.2.12",date:"Dec 13 2016"}}(t=e.Bootstrap||(e.Bootstrap={}))}(a||(a={}));var a;!function(e){var t;!function(t){t.Immutable=l,t.Rx=e.Core.Rx,t.Promise=e.Core.Promise,t.Zlib=f}(t=e.Bootstrap||(e.Bootstrap={}))}(a||(a={}));var a;!function(e){var t;!function(t){var n;!function(n){function r(e){return d(e,!1)}function i(e){return d(e,!0)}function o(e,t){return d(e,"Binary"===t)}function a(e,t){return v(t,e,!1,!1)}function s(e,t){return v(t,e,!0,!1)}function u(e){return v(e.title,e.url,"Binary"===e.type,e.compression===g.Gzip)}function c(e){var t=new f.Gunzip(new Uint8Array(e));return t.decompress()}function l(e){for(var t=y,n=[],r=[],i=512,o=0,a=e.length;a>o;o+=i){for(var s=0,u=o,c=Math.min(o+i,a);c>u;u++)r[s++]=t[e[u]];n[n.length]=i>s?r.splice(0,s).join(""):r.join("")}return n.join("")}function h(e,t,n,r){try{var i=r.target.result;n?(e.update("Decompressing..."),e.schedule(function(){var n=c(i);t?e.resolve(n.buffer):e.resolve(l(n))},1e3/30)):e.resolve(i)}catch(r){e.reject(r)}}function p(e,t,n,r,i){e.update(t),n.onerror=function(t){var n=t.target.error;e.reject(n?n:"Failed.")},n.onabort=function(){return e.abort()};var o=function(){return n.abort()};n.onprogress=function(n){n.lengthComputable?e.update(t,o,n.loaded,n.total):e.update(t+" "+(n.loaded/1024/1024).toFixed(2)+" MB",o)},n.onload=i}function d(n,r){return t.Task.fromComputation("Open File","Background",e.Core.Computation.create(function(e){var t=new FileReader,i=/\.gz$/i.test(n.name);p(e,"Reading...",t,r,function(t){return h(e,r,i,t)}),i||r?t.readAsArrayBuffer(n):t.readAsBinaryString(n)}))}function m(e,t,n,r){var i=r.target;if(i.status>=200&&i.status<400)if(t){var o=r.target.response;b.deposit(r.target),n?(e.update("Decompressing..."),e.schedule(function(){var t=new f.Gunzip(new Uint8Array(o)),n=t.decompress();e.resolve(n.buffer)})):e.resolve(o)}else{var a=r.target.responseText;b.deposit(r.target),e.resolve(a)}else{var s=i.statusText;b.deposit(r.target),e.reject(s)}}function v(n,r,i,o){return t.Task.fromComputation(n?n:"Download","Background",e.Core.Computation.create(function(e){if(!i&&o)return e.reject("Decompress is only available when downloading binary data."),void 0;var t=b.get();e.update("Waiting for server...",function(){return t.abort()}),p(e,"Downloading...",t,i,function(t){return m(e,i,o,t)}),t.open("get",r,!0),t.responseType=i?"arraybuffer":"text",t.send()}))}var g;!function(e){e[e.None=0]="None",e[e.Gzip=1]="Gzip"}(g=n.DataCompressionMethod||(n.DataCompressionMethod={})),n.readStringFromFile=r,n.readArrayBufferFromFile=i,n.readFromFile=o,n.ajaxGetString=a,n.ajaxGetArrayBuffer=s,n.ajaxGet=u;var y=function(){for(var e=[],t=0;256>t;t++)e[t]=String.fromCharCode(t);return e}(),b=function(){function e(){}return e.get=function(){return this.pool.length?this.pool.pop():new XMLHttpRequest},e.emptyFunc=function(){},e.deposit=function(t){this.pool.length<this.poolSize&&(t.onabort=e.emptyFunc,t.onerror=e.emptyFunc,t.onload=e.emptyFunc,t.onprogress=e.emptyFunc,this.pool.push())},e}();b.pool=[],b.poolSize=15}(n=t.Utils||(t.Utils={}))}(t=e.Bootstrap||(e.Bootstrap={}))}(a||(a={}));var a;!function(e){var t;!function(t){var n;!function(t){var n;!function(t){function n(e){return e&&"."!==e&&"?"!==e?e:null}function r(e){var t=e.match(o);if(!t)return void 0;var r=0|+t[1],i=n(t[2]),a=n(t[3]),s=n(t[4]);return{entityId:s,authSeqNumber:r,authAsymId:i,insCode:a}}function i(t,n){void 0===n&&(n=",");var i=t.split(n).map(function(e){return r(e)}).filter(function(e){return!!e});return e.Core.Structure.Query.Builder.toQuery((o=e.Core.Structure.Query).residues.apply(o,i));var o}var o=/^\s*([1-9][0-9]*)\s+([_.;:""&<>()\/\{}'`~!@#$%A-Za-z0-9*|+-]+)(?:\s+i[:]([.]|[a-zA-Z0-9]))?(?:\s+e[:]([.]|[a-zA-Z0-9]+))?/;t.parseAuthResidueId=i}(n=t.Query||(t.Query={}))}(n=t.Utils||(t.Utils={}))}(t=e.Bootstrap||(e.Bootstrap={}))}(a||(a={}));var a;!function(e){var t;!function(e){var t;!function(e){var t;!function(e){var t=function(){function e(e,t,n){this.isError=e,this.value=t,this.error=n}return e.prototype.bind=function(e){return this.isError?this:e(this.value)},e}();e.ValueOrError=t,function(e){function t(t){return new e(!0,void 0,t)}function n(t){return new e(!0,t)}e.error=t,e.value=n}(t=e.ValueOrError||(e.ValueOrError={}))}(t=e.Query||(e.Query={}))}(t=e.Utils||(e.Utils={}))}(t=e.Bootstrap||(e.Bootstrap={}))}(a||(a={}));var a;!function(e){var t;!function(e){var t;!function(e){var t=function(){function e(){this.first=null,this.last=null}return e.prototype.addFirst=function(e){e.inList=!0,this.first&&(this.first.previous=e),e.next=this.first,this.first=e},e.prototype.addLast=function(e){null!=this.last&&(this.last.next=e),e.previous=this.last,this.last=e,null==this.first&&(this.first=e),e.inList=!0},e.prototype.remove=function(e){e.inList&&(e.inList=!1,null!==e.previous?e.previous.next=e.next:null===e.previous&&(this.first=e.next),null!==e.next?e.next.previous=e.previous:null===e.next&&(this.last=e.previous),e.next=null,e.previous=null)},e}();e.LinkedList=t}(t=e.Utils||(e.Utils={}))}(t=e.Bootstrap||(e.Bootstrap={}))}(a||(a={}));var a;!function(e){var t;!function(e){var t;!function(e){function t(e){return(10>e?"0":"")+e}function n(e){var n=e.getHours(),r=e.getMinutes(),i=e.getSeconds();return n+":"+t(r)+":"+t(i)}function r(e,t){var n=Math.pow(10,t);return Math.round(n*e)/n}function i(e){if(e.isIndeterminate)return e.message;var t=(100*e.current/e.max).toFixed(2);return e.message+" "+t+"%"}function o(){var e=(new Date).getTime();window.performance&&"function"==typeof window.performance.now&&(e+=performance.now());var t="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(t){var n=(e+16*Math.random())%16|0;return e=Math.floor(e/16),("x"==t?n:3&n|8).toString(16)});return t}e.formatTime=n,e.round=r,e.formatProgress=i,e.generateUUID=o}(t=e.Utils||(e.Utils={}))}(t=e.Bootstrap||(e.Bootstrap={}))}(a||(a={}));var a;!function(e){var t;!function(e){var t;!function(e){function t(e){return r||(r=n()),function(e,t){return function(n){var r=t.get(e[n]);return void 0!==r?r:1}}(e.atoms.elementSymbol,r)}function n(){var e={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},t=new Map;for(var n in e)t.set(n,e[n]),t.set(n.toUpperCase(),e[n]),t.set(n.toLowerCase(),e[n]);return t}var r=void 0;e.vdwRadiusFromElementSymbol=t}(t=e.Utils||(e.Utils={}))}(t=e.Bootstrap||(e.Bootstrap={}))}(a||(a={}));var a;!function(e){var t;!function(t){var n;!function(t){function n(t){return e.Core.Utils.extend({},t)}function r(e,t){if(!e)return t?!1:!0;if(!t)return!1;var n=Object.keys(e);if(Object.keys(t).length!==n.length)return!1;for(var r=0,i=n;r<i.length;r++){var o=i[r];if(!u.call(e,o)||e[o]!==t[o])return!1}return!0}function i(e,t){if(!e)return t?!1:!0;if(!t)return!1;var n=Object.keys(e);if(Object.keys(t).length!==n.length)return!1;for(var r=0,o=n;r<o.length;r++){var a=o[r];if(!u.call(e,a))return!1;var s=e[a],c=t[a];if("object"==typeof s&&"object"==typeof c){if(!i(s,c))return!1}else if(s!==c)return!1}return!0}function o(e){for(var t=1;t<arguments.length;t++)for(var n=arguments[t],r=0,i=Object.keys(n);r<i.length;r++){var o=i[r];u.call(n,o)&&(e[o]=n[o])}return e}function a(e,r){for(var i=!1,o=0,a=Object.keys(r);o<a.length;o++){var s=a[o];if(u.call(r,s)&&r[s]!==e[s]){i=!0;break}}return i?t.assign(n(e),r):e}function s(e){for(var n=e,r=1;r<arguments.length;r++)if(arguments[r]&&(n=a(e,arguments[r]),n!==e)){for(var i=r+1;i<arguments.length;i++)n=t.assign(n,arguments[i]);break}return n}var u=Object.prototype.hasOwnProperty;t.shallowClone=n,t.shallowEqual=r,t.deepEqual=i,t.assign=Object.assign||o,t.merge=s}(n=t.Utils||(t.Utils={}))}(t=e.Bootstrap||(e.Bootstrap={}))}(a||(a={}));var a;!function(e){var t;!function(e){var t;!function(t){var n=function(){function t(){this.LOG_DISPATCH_STREAM=!1,this.lanes=[];for(var n=0;n<=t.Lane.Task;n++)this.lanes.push(new e.Rx.Subject)}return t.prototype.dispatch=function(e){this.LOG_DISPATCH_STREAM&&console.log(e.type.name,t.Lane[e.type.lane],e.data),this.lanes[e.type.lane].onNext(e)},t.prototype.schedule=function(e,t,n){return void 0===n&&(n=1e3/31),setTimeout(function(){if(t)try{e.call(null)}catch(n){t.call(null,""+n)}else e.call(null)},n)},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()})},t}();t.Dispatcher=n,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={}))}(n=t.Dispatcher||(t.Dispatcher={}))}(t=e.Service||(e.Service={}))}(t=e.Bootstrap||(e.Bootstrap={}))}(a||(a={}));var a;!function(e){var t;!function(e){var t;!function(t){var n=function(){function t(e){this.context=e}return 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})},t}();t.Logger=n,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={}))}(n=t.Logger||(t.Logger={}))}(t=e.Service||(e.Service={}))}(t=e.Bootstrap||(e.Bootstrap={}))}(a||(a={}));var a;!function(e){var t;!function(e){var t;!function(){}(t=e.Service||(e.Service={}))}(t=e.Bootstrap||(e.Bootstrap={}))}(a||(a={}));var a;!function(e){var t;!function(t){t.serialTaskId=0;var n=function(){function e(e,n,r){this.name=e,this.type=n,this.task=r,this._id=t.serialTaskId++,this.reportTime=!1}return Object.defineProperty(e.prototype,"id",{get:function(){return this._id},enumerable:!0,configurable:!0}),e.prototype.bind=function(t,n,r){var i=this;return e.create(t,n,function(e){i.run(e.context).then(function(t){r(t).run(e.context).then(e.resolve).catch(e.reject)}).catch(e.reject)})},e.prototype.map=function(t,n,r){var i=this;return e.create(t,n,function(e){i.run(e.context).then(function(t){return e.resolve(r(t))}).catch(e.reject)})},e.prototype.run=function(n){var r=this;return new e.Running(function(i,o,a){t.Event.Task.Started.dispatch(n,r),n.performance.start("task"+r.id);var s=new e.Context(n,r,i,o);a(s);try{r.task(new e.Context(n,r,i,o))}catch(u){s.reject(u)}})},e.prototype.setReportTime=function(e){return this.reportTime=e,this},e}();t.Task=n,function(n){function r(e,t,r){return new n(e,t,r)}function i(e,t,n){return r(e,t,function(e){e.resolve(n)})}function o(e,t,n){return r(e,"Normal",function(e){e.reject(n)})}function a(e,n,i){return r(e,n,function(e){var n=i.run();n.progress.subscribe(function(n){return e.update(t.Utils.formatProgress(n),n.requestAbort)}),n.result.then(function(t){return e.resolve(t)}).catch(function(t){return e.reject(t)})})}function s(e,n){return void 0===n&&(n=!1),new t.Promise(function(t,r){var i=[],o=function(a){return a>=e.length?(t(i),void 0):(e[a]().then(function(e){i.push(e),o(a+1)}).catch(function(e){n?o(a+1):r(e)}),void 0)};o(0)})}function u(e,t,n,i,o){return void 0===o&&(o=!1),r(t,n,function(t){var n=[],r=function(a){return a>=i.length?(t.resolve(n),void 0):(i[a]().run(e).then(function(e){n.push(e),r(a+1)}).catch(function(e){o?r(a+1):t.reject(e)}),void 0)};r(0)})}function c(e,n){return new t.Promise(function(t,r){try{n(t,r)}catch(i){e.logger.error("Error (Generic): "+i)}})}function l(e,t){return c(e,function(n,r){var i=function(o){if(o>=t.length)return n(void 0),void 0;var a=t[o];a.stateUpdate(),e.dispatcher.schedule(function(){a.action(),i(o+1)},r)};i(0)})}function h(e){return e.then&&e.catch}var f=function(){function e(e){var n=this;this.promise=new t.Promise(function(t,r){return e(t,r,function(e){return n.ctx=e})})}return e.prototype.then=function(e){return this.promise.then(e)},e.prototype.catch=function(e){return this.promise.catch(e)},e.prototype.discard=function(){this.ctx.discard()},e}();n.Running=f,n.create=r,n.resolve=i,n.reject=o,n.fromComputation=a,n.sequencePromises=s,n.sequence=u,n.guardedPromise=c,n.split=l,n.isPromise=h;var p=function(){function n(e,t,n,r){this.context=e,this.task=t,this._resolve=n,this._reject=r,this.schedulingTime=0,this.scheduleId=0,this.abort=void 0,this.discarded=!1,this.resolve=this.resolve_task.bind(this),this.reject=this.reject_task.bind(this)}return n.prototype.discard=function(){try{this.abort&&this.abort()}catch(e){}this.discarded=!0},n.prototype.update=function(e,n){t.Event.Task.StateUpdated.dispatch(this.context,{taskId:this.task.id,type:this.task.type,name:this.task.name,message:e,abort:n}),this.abort=n},n.prototype.schedule=function(e,t){var n=this,r=this.scheduleId++,i="task"+this.task.id+"-"+r;this.context.performance.start(i),this.context.dispatcher.schedule(function(){n.context.performance.end(i),n.schedulingTime+=n.context.performance.time(i),e()},function(e){n.context.performance.end(i),n.reject(e)},t)},n.prototype.resolve_task=function(n){if(this.abort=void 0,this.discarded)return this.reject("Discarded."),void 0;try{if(this.context.performance.end("task"+this.task.id),this.task.reportTime){var r=this.context.performance.time("task"+this.task.id)-this.schedulingTime;"Silent"!==this.task.type&&this.context.logger.info(this.task.name+" finished in "+e.Core.Utils.PerformanceMonitor.format(r)+".")}}finally{this._resolve(n),t.Event.Task.Completed.dispatch(this.context,this.task.id)}},n.prototype.reject_task=function(e){this.abort=void 0,this.context.performance.end("task"+this.task.id),this.context.performance.formatTime("task"+this.task.id);try{if(!this.discarded)if("Silent"===this.task.type)e.warn?this.context.logger.warning("Warning ("+this.task.name+"): "+e.message):console.error("Error ("+this.task.name+"): "+e,e);else if("Child"!==this.task.type)if(e.warn)this.context.logger.warning("Warning ("+this.task.name+"): "+e.message);else{var n=""+e;n.indexOf("Aborted")>=0?this.context.logger.info(this.task.name+": Aborted."):this.context.logger.error("Error ("+this.task.name+"): "+e)}else{var n=""+e;!e.warn&&n.indexOf("Aborted")<0&&console.log(e)}}catch(n){console.log(n)}finally{this._reject(e),t.Event.Task.Completed.dispatch(this.context,this.task.id)}},n}();n.Context=p}(n=t.Task||(t.Task={}))}(t=e.Bootstrap||(e.Bootstrap={}))}(a||(a={}));var a;!function(e){var t;!function(e){var t;!function(e){function t(e,t){return Object.create(n,{name:{writable:!1,configurable:!1,value:e},lane:{writable:!1,configurable:!1,value:t}})}var n={dispatch:function(e,t){e.dispatcher.dispatch({type:this,data:t})},getStream:function(e){return e.dispatcher.getStream(this)}};e.create=t}(t=e.Event||(e.Event={}))}(t=e.Bootstrap||(e.Bootstrap={}))}(a||(a={}));var a;!function(e){var t;!function(e){var t;!function(t){var n=e.Service.Dispatcher.Lane;t.Log=t.create("bs.Log",n.Log);var r;!function(e){e.LayoutChanged=t.create("bs.Common.LayoutChanged",n.Slow)}(r=t.Common||(t.Common={}));var i;!function(e){e.Started=t.create("bs.Tasks.Started",n.Task),e.Completed=t.create("bs.Tasks.Completed",n.Task),e.StateUpdated=t.create("bs.Tasks.StateUpdated",n.Busy)}(i=t.Task||(t.Task={}));var o;!function(e){e.NodeUpdated=t.create("bs.Tree.NodeUpdated",n.Slow),e.NodeAdded=t.create("bs.Tree.NodeAdded",n.Slow),e.NodeRemoved=t.create("bs.Tree.NodeRemoved",n.Slow),e.TransformStarted=t.create("bs.Tree.TransformStarted",n.Slow),e.TransformFinished=t.create("bs.Tree.TransformFinished",n.Slow),e.TransformerApply=t.create("bs.Tree.TransformerApplied",n.Transformer)}(o=t.Tree||(t.Tree={}));var a;!function(e){e.CurrentChanged=t.create("bs.Entity.CurrentChanged",n.Slow)}(a=t.Entity||(t.Entity={}));var s;!function(e){e.Highlight=t.create("bs.Visuals.HoverElement",n.Fast)}(s=t.Interactivity||(t.Interactivity={}));var u;!function(e){e.VisualHoverElement=t.create("bs.Visual.HoverElement",n.Fast),e.VisualSelectElement=t.create("bs.Visual.SelectElement",n.Fast),e.CameraChanged=t.create("bs.Visual.CameraChanged",n.Fast)}(u=t.Visual||(t.Visual={}));var c;!function(e){e.ModelHighlight=t.create("bs.Molecule.ModelHighlight",n.Fast),e.ModelSelect=t.create("bs.Molecule.ModelSelect",n.Fast)}(c=t.Molecule||(t.Molecule={}))}(t=e.Event||(e.Event={}))}(t=e.Bootstrap||(e.Bootstrap={}))}(a||(a={}));var a;!function(e){var t;!function(t){var n;!function(n){var r,i=t.Service.Dispatcher.Lane,o=t.Event.create;!function(e){e.RemoveNode=o("bs.cmd.Tree.RemoveNode",i.Slow),e.ApplyTransform=o("bs.cmd.Tree.ApplyTransform",i.Slow)}(r=n.Tree||(n.Tree={}));var a;!function(e){e.SetCurrent=o("bs.cmd.Entity.SetCurrentNode",i.Slow),e.ToggleExpanded=o("bs.cmd.Entity.ToggleExpanded",i.Slow),e.SetVisibility=o("bs.cmd.Entity.SetVisibility",i.Slow),e.Focus=o("bs.cmd.Entity.Focus",i.Slow),e.Highlight=o("bs.cmd.Entity.Highlight",i.Slow)}(a=n.Entity||(n.Entity={}));var s;!function(t){t.SetState=e.Bootstrap.Event.create("lm.cmd.Layout.SetState",i.Slow),t.SetViewportOptions=o("bs.cmd.Layout.SetViewportOptions",i.Slow)}(s=n.Layout||(n.Layout={}));var u;!function(e){e.FocusQuery=o("bs.cmd.Molecule.FocusQuery",i.Slow),e.Highlight=o("bs.cmd.Molecule.Highlight",i.Slow),e.CreateSelectInteraction=o("bs.cmd.Molecule.CreateSelectInteraction",i.Slow)}(u=n.Molecule||(n.Molecule={}));var c;!function(e){e.ResetScene=o("bs.cmd.Visual.ResetScene",i.Slow),e.ResetTheme=o("bs.cmd.Visual.ResetTheme",i.Slow),e.UpdateBasicTheme=o("bs.cmd.Visual.UpdateBasicTheme",i.Slow)}(c=n.Visual||(n.Visual={}));var l;!function(e){e.Show=o("bs.cmd.Toast.Show",i.Slow),e.Hide=o("bs.cmd.Toast.Hide",i.Slow)}(l=n.Toast||(n.Toast={}))}(n=t.Command||(t.Command={}))}(t=e.Bootstrap||(e.Bootstrap={}))}(a||(a={}));var a;!function(e){var t;!function(e){var t;!function(t){function n(e,t){var n={version:0,refs:new Map,nodes:new Set,root:t,context:e};return t.parent=t,t.tree=n,n}function r(e){if(e.tree){var t=e.tree.refs.get(e.ref);t?t.push(e):e.tree.refs.set(e.ref,[e])}}function i(e){t.Node.forEach(e,function(e){return r(e)})}function o(e,t){var n=e.refs.get(t.ref);if(n){var r=n.indexOf(t);0>r||(n[r]=n[n.length-1],n.pop(),n.length||e.refs.delete(t.ref))}}function a(n){if(!n.parent)throw"Cannot add a node without a parent.";var r=n.parent.tree;t.Node.forEach(n,function(e){return e.tree=r}),t.Node.addChild(n.parent,n),i(n),e.Entity.nodeUpdated(n.parent),s(n)}function s(n){var r=n.tree.context;t.Node.forEachPreorder(n,function(t){e.Event.Tree.NodeAdded.dispatch(r,t)})}function u(n,r,o){t.Node.replaceChild(r.parent,r,o),h(n.context,r),t.Node.forEach(o,function(e){return e.tree=n}),i(o);for(var a=0,u=o.children;a<u.length;a++){var c=u[a];s(c)}e.Entity.nodeUpdated(o.parent),e.Event.Tree.NodeAdded.dispatch(n.context,o),n.context.currentEntity===r&&e.Entity.setCurrent(o)}function c(n){if(n){for(var r=void 0;n!==n.parent;)r=n,t.Node.update(n),n=n.parent;r&&e.Event.Tree.NodeUpdated.dispatch(n.tree.context,r)}}function l(n){var r=n.root.children;n.root.children=[],t.Node.update(n.root),e.Entity.nodeUpdated(n.root),n.refs.clear();for(var i=0,o=r;i<o.length;i++){var a=o[i];h(n.context,a)}e.Command.Entity.SetCurrent.dispatch(n.context,n.root)}function h(n,r){var i=n.currentEntity,a=!1;return t.Node.forEach(r,function(t){o(n.tree,t),e.Event.Tree.NodeRemoved.dispatch(n,t),t.tree=void 0,t===i&&(a=!0)}),a}function f(n){if(n&&n.tree){if(n.parent===n)return l(n.tree),void 0;var r=t.Node.isHidden(n),i=n.index,o=n.parent,a=n.tree.context;t.Node.removeChild(o,n),e.Entity.nodeUpdated(o);var s=h(a,n);if(s&&!r){for(var u=!1,c=i;c>=0;c--)if(o.children[c]&&!t.Node.isHidden(o.children[c])){e.Command.Entity.SetCurrent.dispatch(a,o.children[c]),u=!0;break}u||e.Command.Entity.SetCurrent.dispatch(a,o)}n.transform.props.isBinding&&!o.children.length&&f(n.parent)}}t.create=n,t.add=a,t.update=u,t.updatePath=c,t.remove=f}(t=e.Tree||(e.Tree={}))}(t=e.Bootstrap||(e.Bootstrap={}))}(a||(a={}));var a;!function(e){var t;!function(e){var t;!function(t){var n;!function(t){function n(e,t){return e&&e.type===t}function r(e,t){if(!t)return!1;for(;;){if(e===t)return!0;if(e=e.parent,!e||e===e.parent)return!1}}function i(e,t){if(!e)return void 0;for(var r=e.parent;;){if(n(r,t))return r;if(r=r.parent,r.parent===r)return void 0}}function o(e,t){if(!e)return void 0;for(var n=e;;){if(t.indexOf(n.type)>=0)return n;if(n=n.parent,n.parent===n)return t.indexOf(n.type)>=0?n:void 0}}function a(){return g++}function s(e){return e.version++,e}function u(t,n){var r=e.Utils.merge(t.props,n);return r===t.props?t:s(t)}function c(t,n){var r=e.Utils.merge(t.state,n);return r===t.state?t:(t.state=r,s(t))}function l(e,t){return t.index=e.children.length,e.children.push(t),s(e)}function h(e,t){for(var n=e.children,r=t.index,i=n.length-1;i>r;r++){var o=n[r+1];o.index--,n[r]=o}return n.pop(),s(e)}function f(e,t,n){return n?(n.index=t.index,e.children[n.index]=n,s(e)):h(e,t)}function p(e,t){for(var n=0,r=e.children;n<r.length;n++){var i=r[n];p(i,t)}t(e)}function d(e,t){t(e);for(var n=0,r=e.children;n<r.length;n++){var i=r[n];p(i,t)}}function m(e){var t=[];return p(e,function(e){return t.push(e)}),t}function v(e){if(e.isHidden)return!0;var t=e.parent;if(!t)return e.isHidden;for(;t.parent!==t;){if(t.isHidden)return!0;if(t=t.parent,!t)return!1}return!1}t.Null={},t.is=n,t.hasAncestor=r,t.findAncestor=i,t.findClosestNodeOfType=o;var g=0;t.createId=a,t.update=s,t.withProps=u,t.withState=c,t.addChild=l,t.removeChild=h,t.replaceChild=f,t.forEach=p,t.forEachPreorder=d,t.collect=m,t.isHidden=v}(n=t.Node||(t.Node={}))}(t=e.Tree||(e.Tree={}))}(t=e.Bootstrap||(e.Bootstrap={}))}(a||(a={}));var a;!function(e){var t;!function(e){var t;!function(e){var t;!function(t){function n(e,t){return r(e)(t)}function r(e){var n,r=e?e:t.root();return n=o(r)?r.compile():i(r)?t.byValue(r).compile():a(r)?r:t.byRef(r).compile()}function i(e){return void 0!==e.ref}function o(e){return void 0!==e.compile}function a(e){return"function"==typeof e}function s(e){return Object.create(w.BuilderPrototype,{compile:{writable:!1,configurable:!1,value:e}})}function u(){return s(function(){return function(e){return[e.root]}})}function c(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return s(function(){return function(t){for(var n=[],r=0,i=e;r<i.length;r++){var o=i[r],a=t.refs.get(o);if(a)for(var s=0,u=a;s<u.length;s++){var c=u[s];n.push(c)}}return n}})}function l(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return s(function(){return function(){return e}})}function h(e,t){var n=r(e);return s(function(){return function(e){for(var r=[],i=0,o=n(e);i<o.length;i++)for(var a=o[i],s=0,u=t(a);s<u.length;s++){var c=u[s];r.push(c)}return r}})}function f(e,t){var n=r(e);return s(function(){return function(e){for(var r=[],i=0,o=n(e);i<o.length;i++){var a=o[i],s=t(a);s&&r.push(s)}return r}})}function p(e){var t=r(e);return s(function(){return function(e){for(var n=new Set,r=[],i=0,o=t(e);i<o.length;i++){var a=o[i];n.has(a.id)||(n.add(a.id),r.push(a))}return r}})}function d(e){var t=r(e);return s(function(){return function(e){return[t(e)[0]]}})}function m(e,t){return h(e,function(e){return t(e)?[e]:[]})}function v(t){return h(t,function(t){return e.Node.collect(t)})}function g(e){return h(e,function(e){return e.children})}function y(e,t){return m(e,function(e){return e.type===t})}function b(t,n){return p(f(t,function(t){return e.Node.findAncestor(t,n)}))}function x(e){return p(f(e,function(e){return e.parent}))}t.select=n,t.compile=r;var w;!function(e){function t(t,n){e.BuilderPrototype[t]=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return n.call.apply(n,[void 0,this].concat(e))}}e.BuilderPrototype={},e.registerModifier=t}(w=t.Helpers||(t.Helpers={})),t.root=u,t.byRef=c,t.byValue=l,w.registerModifier("flatMap",h),t.flatMap=h,w.registerModifier("mapEntity",f),t.mapEntity=f,w.registerModifier("unique",p),t.unique=p,w.registerModifier("first",d),t.first=d,w.registerModifier("filter",m),t.filter=m,w.registerModifier("subtree",v),t.subtree=v,w.registerModifier("children",g),t.children=g,w.registerModifier("ofType",y),t.ofType=y,w.registerModifier("ancestorOfType",b),t.ancestorOfType=b,w.registerModifier("parent",x),t.parent=x}(t=e.Selection||(e.Selection={}))}(t=e.Tree||(e.Tree={}))}(t=e.Bootstrap||(e.Bootstrap={}))}(a||(a={}));var a;!function(e){var t;!function(e){var t;!function(t){var n;!function(n){function r(e,t,n){return new c(e,t,n)}function i(e,t,n,i){return r({id:e,name:e,description:"",from:t,to:n,validateParams:function(){return void 0},defaultParams:function(){return{}}},i)}function o(e,t,n,r,i){try{r.reject(t)}finally{i&&("string"==typeof i?n.logger.error(i):setTimeout(function(){return i.call(null,n,e,t)},0))}}function a(e,n,r,i,o){t.Transform.apply(n,e.action).run(n).then(function(){try{r.resolve(t.Node.Null)}finally{i&&("string"==typeof i?n.logger.message(i):setTimeout(function(){return i.call(null,n,e.context)},0))}}).catch(function(t){try{r.reject(t)}finally{o&&("string"==typeof o?n.logger.error(o):setTimeout(function(){return o.call(null,n,e.context,t)},0))}})}function s(t,n,i,o){return r(t,function(r,s,u){return e.Task.create(t.name,"Background",function(e){var t=n(r,s,u);a({action:t,context:void 0},r,e,i,o)})})}function u(t,n,i,s){return r(t,function(r,u,c){return e.Task.create(t.name,"Background",function(t){var l=n(r,u,c);e.Task.isPromise(l)?l.then(function(e){return a(e,r,t,i,s)}).catch(function(e){return o(void 0,e,r,t,s)}):a(l,r,t,i,s)})})}var c=function(){function n(e,t,n){this.info=e,this.transform=t,this.updater=n
}return n.prototype.getTarget=function(e){var n=this.info;return n.from.length?t.Node.findClosestNodeOfType(e,n.from):e},n.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 n=this.info;return n.from.length&&n.from.indexOf(e.type)<0?"Transform ("+n.name+"): type error, expected '"+n.from.map(function(e){return e.info.name}).join("/")+"', got '"+e.type.info.name+"'.":void 0},n.prototype.validateParams=function(e){var t=this.info;if(t.validateParams){var n=t.validateParams(e.params);if(n&&n.length>0)return"Invalid params: "+n.join(", ")+"."}return void 0},n.prototype.validate=function(t,n){var r=this.info;if(!t)return e.Task.reject(r.name,"Normal","Could not find a suitable node to apply the transformer to.");var i=this.checkTypes(t,n);if(i)return e.Task.reject(r.name,"Normal",i);var o=this.validateParams(n);return o?e.Task.reject(r.name,"Normal",o):void 0},n.prototype.apply=function(t,n,r){if(this.info.isComposed)return this.transform(t,n,r);var i=this.getTarget(n),o=this.validate(i,r);return o?o:(e.Event.Tree.TransformerApply.dispatch(t,{a:i,t:r}),this.transform(t,i,r))},n.prototype.update=function(t,n,r){var i=n.parent;if(this.info.isComposed&&!this.updater)return this.transform(t,i,r);if(this.updater){var o=this.validateParams(r);if(o)return e.Task.reject(this.info.name,"Normal",o);var a=this.updater(t,n,r);if(a)return a}return e.Event.Tree.TransformerApply.dispatch(t,{a:n.parent,t:r}),this.transform(t,i,r)},n.prototype.create=function(e,n){return t.Transform.create(e,n?n:{},this)},n}();n.create=r,n.internal=i,n.action=s,n.actionWithContext=u}(n=t.Transformer||(t.Transformer={}))}(t=e.Tree||(e.Tree={}))}(t=e.Bootstrap||(e.Bootstrap={}))}(a||(a={}));var a;!function(e){var t;!function(e){var t;!function(t){var n;!function(n){function r(t,n,r){var i=e.Utils.shallowClone(n);return i.ref||(i.ref=e.Utils.generateUUID()),new l(t,i,r)}function i(t,n){var r=t.select(n.selector),i=r.map(function(e){return function(){return n.transform.update(t,e)}});return e.Task.sequence(t,"Update transform","Child",i,!0)}function o(t,n){var r=t.select(n.selector),i=r.map(function(e){return function(){return n.transform.apply(t,e)}});return e.Task.sequence(t,"Apply transform","Child",i,!0)}function a(e){return!!e.selector}function s(e){return!!e.compile}function u(t,n){var r;try{r=a(n)?[n]:s(n)?n.compile():n}catch(i){return e.Task.reject("Apply transforms","Child",i)}var u=r.map(function(e){return function(){return o(t,e)}});return e.Task.sequence(t,"Apply transforms","Child",u,!0)}function c(t,n){var r;try{r=a(n)?[n]:s(n)?n.compile():n}catch(o){return e.Task.reject("Apply transforms","Child",o)}var u=r.map(function(e){return function(){return i(t,e)}});return e.Task.sequence(t,"Apply transforms","Child",u,!0)}var l=function(){function n(e,t,n){this.params=e,this.props=t,this.transformer=n,this.isUpdate=!1}return n.prototype.resolveAdd=function(e,n,r){return r===t.Node.Null?(e.resolve(r),void 0):(r.ref=this.props.ref,this.props.isHidden&&(r.isHidden=!0),r.tree||(r.parent=n,t.add(r)),e.resolve(r),void 0)},n.prototype.resolveUpdate=function(e,n,r){if(r===t.Node.Null)return e.resolve(r),void 0;var i=n.parent;r.ref=this.props.ref,r.parent=i,r.tag=n.tag,r.state=n.state,this.props.isHidden&&(r.isHidden=!0),t.update(e.context.tree,n,r),e.resolve(r)},n.prototype.apply=function(t,n){var r=this;return e.Task.create(this.transformer.info.name,"Child",function(i){e.Event.Tree.TransformStarted.dispatch(t,r),r.transformer.apply(t,n,r).run(i.context).then(function(o){r.resolveAdd(i,n,o),e.Event.Tree.TransformFinished.dispatch(t,{transform:r})}).catch(function(n){i.reject(n),e.Event.Tree.TransformFinished.dispatch(t,{transform:r,error:n})})})},n.prototype.update=function(t,n){var r=this;return e.Task.create(this.transformer.info.name,"Child",function(i){r.isUpdate=!0,r.props.ref=n.transform.props.ref,e.Event.Tree.TransformStarted.dispatch(t,r),n.transform.props.isBinding&&(r.props.isBinding=!0),r.transformer.update(t,n,r).run(t).then(function(o){r.resolveUpdate(i,n,o),e.Event.Tree.TransformFinished.dispatch(t,{transform:r})}).catch(function(n){i.reject(n),e.Event.Tree.TransformFinished.dispatch(t,{transform:r,error:n})})})},n}();n.create=r,n.updateInstance=i,n.applyInstance=o,n.apply=u,n.update=c}(n=t.Transform||(t.Transform={}))}(t=e.Tree||(e.Tree={}))}(t=e.Bootstrap||(e.Bootstrap={}))}(a||(a={}));var a;!function(e){var t;!function(e){var t;!function(e){var t;!function(e){function t(){return new n.Impl(void 0,[])}e.build=t;var n;!function(e){var t=function(){function e(e,t){this.last=e,this.transforms=t}return e.prototype.add=function(t,n,r,i){var o={selector:t,transform:n.create(r,i)};return this.transforms.push(o),this.last=o,new e(o,this.transforms)},e.prototype.then=function(t,n,r){if(!this.last)throw"Cannot 'then' on an empty builder";var i=t.create(n,r),o={selector:this.last.transform.props.ref,transform:i};return this.transforms.push(o),new e(o,this.transforms)},e.prototype.compile=function(){return this.transforms},e}();e.Impl=t}(n=e.Builder||(e.Builder={}))}(t=e.Transform||(e.Transform={}))}(t=e.Tree||(e.Tree={}))}(t=e.Bootstrap||(e.Bootstrap={}))}(a||(a={}));var a;!function(e){var t;!function(e){var t;!function(e){function t(e){return 0===e.kind||!e.source.tree}function n(e){return 1===e.kind&&!!e.source.tree}function r(e,t){if(!e&&!t)return!0;if(!e||!t)return!1;if(e.kind!==t.kind)return!1;if(0===e.kind)return!0;if(e.source!==t.source)return!1;var n=e.elements,r=t.elements;if(n.length!==r.length)return!1;for(var i=0,o=n.length;o>i;i++)if(n[i]!==r[i])return!1;return!0}function i(e,t){var n=e.elements,r=t.elements;if(n.length!==r.length)return!1;for(var i=0,o=n.length;o>i;i++)if(n[i]!==r[i])return!1;return!0}var o;!function(e){function t(e,t){return{kind:1,source:e,elements:t}}e.empty={kind:0},e.selection=t}(o=e.Info||(e.Info={})),e.isEmpty=t,e.isSelection=n,e.interactivityInfoEqual=r,e.interactivitySelectionElementsEqual=i}(t=e.Interactivity||(e.Interactivity={}))}(t=e.Bootstrap||(e.Bootstrap={}))}(a||(a={}));var a;!function(e){var t;!function(e){var t;!function(t){var n=function(){function t(t){var n=this;this.context=t,this.providers=[],this.empty=[],e.Event.Visual.VisualHoverElement.getStream(t).subscribe(function(r){return e.Event.Interactivity.Highlight.dispatch(t,n.getInfo(r.data))})}return 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;for(var t=[],n=0,r=this.providers;n<r.length;n++){var i=r[n],o=i.call(null,e);o&&t.push(o)}return t},t}();t.HighlightManager=n}(t=e.Interactivity||(e.Interactivity={}))}(t=e.Bootstrap||(e.Bootstrap={}))}(a||(a={}));var a;!function(e){var t;!function(e){var t;!function(t){var n;!function(n){function r(e,t,n){for(var r,i,o,a,s=t.structure,u=s.atoms,c=u.residueIndex,l=u.chainIndex,h=u.entityIndex,f=u.name,p=u.authName,d=u.id,m=u.occupancy,v=u.tempFactor,g=u.elementSymbol,y=u.x,b=u.y,x=u.z,w=u.altLoc,_=s.residues,C=_.name,E=_.authName,S=_.seqNumber,M=_.authSeqNumber,T=_.insCode,A=_.isHet,P=s.chains,k=P.asymId,R=P.authAsymId,I=s.entities.entityId,D=-1,B=-1,V=-1,L=-1,N=function(){return r={index:B,entityId:I[B]}},O=function(){return i={index:V,asymId:k[V],authAsymId:R[V],entity:r}},F=function(){return o={index:L,name:C[L],authName:E[L],seqNumber:S[L],authSeqNumber:M[L],insCode:T[L],isHet:A[L],chain:i}},U=function(){return a={index:D,id:d[D],name:f[D],authName:p[D],elementSymbol:g[D],occupancy:m[D],tempFactor:v[D],x:y[D],y:b[D],z:x[D],altLoc:w[D],residue:o}},z=[],$=[],H=[],j=[],G=0;G<n.length;G++)D=n[G],t.hasAtom(D)&&(B!==h[D]&&(B=h[D],z.push(N())),V!==l[D]&&(V=l[D],$.push(O())),L!==c[D]&&(L=c[D],H.push(F())),j.push(U()));return{modelRef:e.ref,moleculeId:s.id,modelId:s.modelId,atoms:j,residues:H,chains:$,entities:z}}function i(n){if(t.isEmpty(n))return void 0;var i=e.Utils.Molecule.findModelOrSelection(n.source);if(!i)return void 0;var o=e.Utils.Molecule.findQueryContext(i),a=e.Utils.Molecule.findModel(i);return o&&a?r(a,o,n.elements):void 0}function o(t){var n=[];return 1!==t.occupancy&&n.push("occupancy "+e.Utils.round(t.occupancy,2)),t.altLoc&&n.push("alt. loc "+t.altLoc),n.length?" <small>["+n.join(", ")+"]</small>":""}function a(t){return"<span><b>"+t.name+" "+t.elementSymbol+" "+t.id+"</b>"+o(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+o(e)+"</span>"}function u(e){return"<span>"+e.authName+" "+e.chain.authAsymId+" "+e.authSeqNumber+(null!==e.insCode?" i: "+e.insCode:"")+"</span>"}function c(e){return"1"===e.modelId?"<span><small>["+e.moleculeId+"]</small></span>":"<span><small>["+e.moleculeId+":"+e.modelId+"]</small></span>"}function l(e){return e&&e.atoms.length?1===e.atoms.length?"<span>"+a(e.atoms[0])+" on <b><small>"+u(e.residues[0])+"</small></b> "+c(e)+"</span>":1===e.residues.length?"<span><b>"+u(e.residues[0])+"</b> "+c(e)+"</span>":"<span><small>"+e.atoms.length+" atoms on</small> <b>"+e.residues.length+" residues</b> "+c(e)+"</span>":""}function h(e){return e&&e.atoms.length?1===e.atoms.length?"<span><b>"+s(e.atoms[0])+"<b> "+c(e)+"</span>":1===e.residues.length?"<span><b>"+u(e.residues[0])+"</b> "+c(e)+"</span>":"<span><b>"+e.residues.length+" residues</b> "+c(e)+"</span>":""}function f(n){if(t.isEmpty(n))return!1;var r=e.Utils.Molecule.findModelOrSelection(n.source);return r?!0:!1}n.transformMoleculeAtomIndices=r,n.transformInteraction=i,n.formatInfo=l,n.formatInfoShort=h,n.isMoleculeModelInteractivity=f}(n=t.Molecule||(t.Molecule={}))}(t=e.Interactivity||(e.Interactivity={}))}(t=e.Bootstrap||(e.Bootstrap={}))}(a||(a={}));var a;!function(e){var t;!function(t){var n;!function(n){var r=function(){function e(e,n){var r=this;this.context=e,this.scene=n,this.entries=new Map,this.originalThemes=new Map,t.Event.Tree.NodeAdded.getStream(e).subscribe(function(e){t.Entity.isClass(e.data,t.Entity.VisualClass)&&r.add(e.data)}),t.Event.Tree.NodeRemoved.getStream(e).subscribe(function(e){t.Entity.isClass(e.data,t.Entity.VisualClass)&&r.remove(e.data)}),t.Event.Tree.NodeUpdated.getStream(e).subscribe(function(e){if(t.Entity.isVisual(e.data)){var n=r.entries.get(e.data.id);if(n){var i=2!==n.state.visibility;n.props.model.getVisibility()!==i&&n.props.model.updateVisibility(i)}}}),t.Command.Visual.UpdateBasicTheme.getStream(e).subscribe(function(e){if(r.entries.get(e.data.visual.id)&&t.Entity.isVisual(e.data.visual)){var n=e.data.visual;r.originalThemes.get(n.id)||r.originalThemes.set(n.id,n.props.model.theme),n.props.model.applyTheme(e.data.theme)}}),t.Command.Molecule.Highlight.getStream(e).subscribe(function(e){return r.highlightMoleculeModel(e.data)}),t.Command.Visual.ResetTheme.getStream(e).subscribe(function(e){return r.resetThemesAndHighlight(e.data&&e.data.selection)})}return e.prototype.isEmpty=function(){return!this.entries.size},e.prototype.add=function(e){if(this.entries.has(e.id)||!e.props.model)return!1;this.entries.set(e.id,e),this.scene.scene.models.add(e.props.model,1===this.entries.size);var t=2!==e.state.visibility;return e.props.model.getVisibility()!==t&&e.props.model.updateVisibility(t),e.props.model.tag=e,!0},e.prototype.remove=function(e){return this.entries.has(e.id)?(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,!0):!1},e.prototype.get=function(e){return this.entries.get(e)},e.prototype.resetThemesAndHighlight=function(e){var n=this;if(!e)return this.originalThemes.forEach(function(e,t){n.entries.get(t).props.model.applyTheme(e)}),this.originalThemes.clear(),this.entries.forEach(function(e){return e.props.model.highlight(!1)}),this.scene.scene.forceRender(),void 0;for(var r=this.context.select(e),i=0,o=r;i<o.length;i++){var a=o[i];if(t.Entity.isVisual(a)&&this.originalThemes.has(a.id)){var s=a,u=this.originalThemes.get(s.id);s.props.model.applyTheme(u),s.props.model.highlight(!1),this.originalThemes.delete(s.id)}}this.scene.scene.forceRender()},e.prototype.highlightMoleculeModel=function(e){var n=this,r=t.Utils.Molecule.findModel(e.model);if(!r)return console.warn("Highlight: Trying to highlight a non-molecule model entity, ignoring..."),void 0;var i=[];if(this.context.select(t.Tree.Selection.byValue(e.model).subtree()).forEach(function(e){t.Entity.isVisual(e)&&n.entries.get(e.id)&&i.push(e)}),i.length){var o=t.Utils.Molecule.getModelAndIndicesFromQuery(r,e.query);if(o&&o.indices.length)for(var a=e.isOn?3:4,s=0,u=i;s<u.length;s++){var c=u[s];c.props.model.applySelection(o.indices,a)}}},e}();n.DisplayList=r;var i=function(){function n(n,i,o){var a=this;this.context=i,this._destroyed=!1,this.cameraChanged=new t.Rx.Subject,this.cameraObserver=function(e){return a.cameraChanged.onNext(e)},this.models=new r(i,this),this.scene=new e.Visualization.Scene(n,o),this.scene.camera.observe(this.cameraObserver),this.scene.events.addEventListener("hover",function(e){return a.handleEvent(e,t.Event.Visual.VisualHoverElement)}),this.scene.events.addEventListener("select",function(e){return a.handleEvent(e,t.Event.Visual.VisualSelectElement)}),this.cameraChanged.throttle(1e3/30).subscribe(function(e){t.Event.Visual.CameraChanged.dispatch(a.context,e)}),t.Command.Entity.Focus.getStream(i).subscribe(function(e){if(1===e.data.length){var n=e.data[0];t.Entity.isMoleculeSelection(n)?a.focusMoleculeModelSelection(n):t.Entity.isClass(n,t.Entity.VisualClass)&&a.scene.camera.focusOnModel(n.props.model)}else(r=a.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}));var r}),t.Command.Entity.Highlight.getStream(i).subscribe(function(e){for(var n=0,r=e.data.entities;n<r.length;n++){var i=r[n];t.Entity.isClass(i,t.Entity.VisualClass)&&i.props.model&&i.props.model.highlight(e.data.isOn)}}),t.Command.Visual.ResetScene.getStream(i).subscribe(function(){return a.resetScene()}),t.Command.Molecule.FocusQuery.getStream(i).subscribe(function(e){return a.focusMoleculeModelOnQuery(e.data)})}return n.prototype.resetScene=function(){this._destroyed||(t.Event.Visual.VisualSelectElement.dispatch(this.context,t.Interactivity.Info.empty),this.models.resetThemesAndHighlight(),this.scene.camera.reset())},Object.defineProperty(n.prototype,"camera",{get:function(){return this.scene.camera},enumerable:!0,configurable:!0}),n.prototype.destroy=function(){this._destroyed||(this.scene.camera.stopObserving(this.cameraObserver),this.scene.destroy(),this.scene=void 0,this._destroyed=!0)},n.prototype.handleEvent=function(e,n){var r=e.data;r&&r.model&&r.elements?n.dispatch(this.context,t.Interactivity.Info.selection(r.model.tag,r.elements)):n.dispatch(this.context,t.Interactivity.Info.empty)},n.prototype.focusMoleculeModelSelection=function(e){if(!t.Tree.Node.is(e,t.Entity.Molecule.Selection))return console.warn("Focus: Trying to focus on non-molecule selection, ignoring..."),void 0;var n=t.Utils.Molecule.findModel(e);if(!n)return console.warn("Focus: Molecule model for selection not found, ignoring..."),void 0;var r={x:.1,y:.1,z:.1},i=t.Utils.Molecule.getCentroidAndRadius(n.props.model,e.props.indices,r);this.scene.camera.focusOnPoint(r,i)},n.prototype.focusMoleculeModelOnQuery=function(e){var n=t.Utils.Molecule.getModelAndIndicesFromQuery(e.model,e.query);if(n&&n.indices.length){var r={x:.1,y:.1,z:.1},i=t.Utils.Molecule.getCentroidAndRadius(n.model.props.model,n.indices,r);this.scene.camera.focusOnPoint(r,i)}},n}();n.SceneWrapper=i}(n=t.Visualization||(t.Visualization={}))}(t=e.Bootstrap||(e.Bootstrap={}))}(a||(a={}));var a;!function(e){var t;!function(e){var t;!function(t){var n;!function(e){function t(e){return e}e.create=t}(n=t.Style||(t.Style={}));var r;!function(t){function n(t,n){var r=t.colors||e.Immutable.Map();if(n.colors)for(var i=0,o=Object.keys(n.colors);i<o.length;i++){var a=o[i];r.set(a,n.colors[a])}var s=e.Utils.shallowClone(t);return s.colors=r,n.transparency&&(s.transparency=n.transparency),void 0!==n.interactive&&(s.interactive=n.interactive),s}function r(e){var t=new Map;return e.colors&&e.colors.forEach(function(e,n){return t.set(n,e)}),{colors:t,transparency:e.transparency,interactive:e.interactive,disableFog:e.disableFog}}t.mergeProps=n,t.getProps=r}(r=t.Theme||(t.Theme={}))}(t=e.Visualization||(e.Visualization={}))}(t=e.Bootstrap||(e.Bootstrap={}))}(a||(a={}));var a;!function(e){var t;!function(t){var n;!function(n){var r;!function(n){function r(e,t){return function(n){return t[e[n]]}}function i(e,n){return function(i,o){var a=t.Utils.Molecule.findModel(i).props.model,s=e(a),u=c.Theme.createPalleteMapping(r(s.index,s.property),n);return c.Theme.createMapping(u,o)}}function o(e,t){return t&&t.colors&&t.colors.set("Bond",t.colors.get("Uniform")),c.Theme.createUniform(t)}function a(e,n,i){return function(o,a){var s=t.Utils.Molecule.findModel(o).props.model,u=e(s),l=c.Theme.createColorMapMapping(r(u.index,u.property),n,i);return c.Theme.createMapping(l,a)}}function s(e,t){for(var n=e.residues.count,r={r:new Float32Array(n),g:new Float32Array(n),b:new Float32Array(n)},i=r.r,o=r.g,a=r.b,s=t(e),u=s.count,l=s.residueStartIndex,h=s.residueEndIndex,p=f.length-1,d=c.Color.fromHex(0),m=0;u>m;m++){var v=l[m],g=h[m],y=g-v,b=y-1;1>=b&&(b=1);for(var x=0;y>x;x++){var w=p*x/b,_=Math.floor(w),C=Math.ceil(w);c.Color.interpolate(f[_],f[C],w-_,d),i[v+x]=d.r,o[v+x]=d.g,a[v+x]=d.b}}return{r:i,g:o,b:a}}function u(e){return function(n,r){var i=t.Utils.Molecule.findModel(n).props.model,o=s(i,e),a=new h(i,o);return c.Theme.createMapping(a,r)}}var c=e.Visualization;n.UniformBaseColors=t.Immutable.Map({Uniform:c.Theme.Default.UniformColor,Highlight:c.Theme.Default.HighlightColor,Selection:c.Theme.Default.SelectionColor}),n.ModelVisualBaseColors=t.Immutable.Map({Bond:c.Molecule.Colors.DefaultBondColor,Highlight:c.Theme.Default.HighlightColor,Selection:c.Theme.Default.SelectionColor}),n.createPaletteThemeProvider=i,n.uniformThemeProvider=o,n.createColorMapThemeProvider=a;var l,h=function(){function e(e,t){var n=t.r,r=t.g,i=t.b;this.residueIndex=e.atoms.residueIndex,this.r=n,this.g=r,this.b=i}return 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]},e}(),f=[c.Color.fromHex(13378048),c.Color.fromHex(13399808),c.Color.fromHex(13412864),c.Color.fromHex(52224),c.Color.fromHex(43724),c.Color.fromHex(204),c.Color.fromHex(8989394),c.Color.fromHex(12025059)],p=t.Immutable.Map({Bond:c.Molecule.Colors.DefaultBondColor,Highlight:c.Color.fromHex(16777215),Selection:c.Color.fromHex(9863168)});!function(e){e.Themes=[{name:"Chain ID",description:"Color the surface by Chain ID.",colors:n.ModelVisualBaseColors,provider:i(function(e){return{index:e.atoms.residueIndex,property:e.residues.asymId}},c.Molecule.Colors.DefaultPallete)},{name:"Entity ID",description:"Color the surface by Entity ID.",colors:n.ModelVisualBaseColors,provider:i(function(e){return{index:e.atoms.residueIndex,property:e.residues.entityId}},c.Molecule.Colors.DefaultPallete)},{name:"Entity Type",description:"Color the surface by Entity Type.",colors:n.ModelVisualBaseColors,provider:i(function(e){return{index:e.atoms.entityIndex,property:e.entities.entityType}},c.Molecule.Colors.DefaultPallete)},{name:"Residue Name",description:"Color the surface by residue name.",colors:n.ModelVisualBaseColors,provider:i(function(e){return{index:e.atoms.residueIndex,property:e.residues.name}},c.Molecule.Colors.DefaultPallete)},{name:"Element Symbol",description:"Color the surface by atom elemnt symbol.",colors:n.ModelVisualBaseColors,provider:a(function(e){return{index:e.atoms.indices,property:e.atoms.elementSymbol}},c.Molecule.Colors.DefaultElementColorMap,c.Molecule.Colors.DefaultElementColor)},{name:"Rainbow (Chain)",description:"Color each chain using rainbow palette.",colors:p,provider:u(function(e){return e.chains})},{name:"Rainbow (Entity)",description:"Color each entity using rainbow palette.",colors:p,provider:u(function(e){return e.entities})},{name:"Uniform Color",description:"Same color everywhere.",colors:n.UniformBaseColors,provider:o}],e.CartoonThemeTemplate=e.Themes.filter(function(e){return"Chain ID"===e.name})[0],e.ElementSymbolThemeTemplate=e.Themes.filter(function(e){return"Element Symbol"===e.name})[0],e.SurfaceThemeTemplate=e.Themes.filter(function(e){return"Uniform Color"===e.name})[0],e.UniformThemeTemplate=e.Themes.filter(function(e){return"Uniform Color"===e.name})[0]}(l=n.Default||(n.Default={}))}(r=n.Molecule||(n.Molecule={}))}(n=t.Visualization||(t.Visualization={}))}(t=e.Bootstrap||(e.Bootstrap={}))}(a||(a={}));var a;!function(e){var t;!function(e){var t;!function(e){var t;!function(e){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.BallsAndSticksParams={useVDW:!0,vdwScaling:.22,atomRadius:.35,bondRadius:.09,detail:"Automatic"},e.SurfaceParams={probeRadius:1.4,density:1.1,smoothing:6,isWireframe:!1},e.Transparency={alpha:1,writeDepth:!1},e.ForType=function(){for(var t={Cartoons:{type:"Cartoons",params:{detail:"Automatic"},theme:{template:e.CartoonThemeTemplate,colors:e.CartoonThemeTemplate.colors,transparency:e.Transparency,interactive:!0}},Calpha:{type:"Calpha",params:{detail:"Automatic"},theme:{template:e.CartoonThemeTemplate,colors:e.CartoonThemeTemplate.colors,transparency:e.Transparency,interactive:!0}},BallsAndSticks:{type:"BallsAndSticks",params:e.BallsAndSticksParams,theme:{template:e.ElementSymbolThemeTemplate,colors:e.ElementSymbolThemeTemplate.colors,transparency:e.Transparency,interactive:!0}},VDWBalls:{type:"VDWBalls",params:{detail:"Automatic"},theme:{template:e.ElementSymbolThemeTemplate,colors:e.ElementSymbolThemeTemplate.colors,transparency:e.Transparency,interactive:!0}},Surface:{type:"Surface",params:e.SurfaceParams,theme:{template:e.SurfaceThemeTemplate,colors:e.SurfaceThemeTemplate.colors,transparency:{alpha:.33,writeDepth:!1},interactive:!0}}},n=new Map,r=0,i=Object.keys(t);r<i.length;r++){var o=i[r];n.set(o,t[o])}return n}()}(t=e.Default||(e.Default={}))}(t=e.Molecule||(e.Molecule={}))}(t=e.Visualization||(e.Visualization={}))}(t=e.Bootstrap||(e.Bootstrap={}))}(a||(a={}));var a;!function(e){var t;!function(t){var n;!function(n){var r;!function(r){function i(e,t){if("Automatic"===e)return 75e3>t?3:25e4>t?2:6e5>t?1:0;var n=r.DetailTypes.indexOf(e)-1;return Math.max(n,0)}function o(e,t){return{tessalation:e,drawingType:t?d.Cartoons.CartoonsModelType.AlphaTrace:d.Cartoons.CartoonsModelType.Default}}function a(e,n){if(!n.useVDW)return function(e){return function(){return e}}(n.atomRadius);var r=t.Utils.vdwRadiusFromElementSymbol(e);return function(e,t){return function(n){return e*t(n)}}(n.vdwScaling,r)}function s(e,t,n){return{tessalation:e,bondRadius:n.bondRadius,hideBonds:!1,atomRadius:a(t,n)}}function u(e,n){return{tessalation:e,bondRadius:0,hideBonds:!0,atomRadius:t.Utils.vdwRadiusFromElementSymbol(n)}}function c(e,n,r){var a=t.Utils.Molecule.findModel(e).props.model,c=t.Entity.isMoleculeModel(e)?e.props.model.atoms.indices:e.props.indices;if(!c.length)return void 0;var l=i(n.params.detail,c.length);switch(n.type){case"Cartoons":return d.Cartoons.Model.create(e,{model:a,atomIndices:c,theme:r,queryContext:t.Utils.Molecule.findQueryContext(e),params:o(l,!1)});case"Calpha":return d.Cartoons.Model.create(e,{model:a,atomIndices:c,theme:r,queryContext:t.Utils.Molecule.findQueryContext(e),params:o(l,!0)});case"BallsAndSticks":return p.Molecule.BallsAndSticks.Model.create(e,{model:a,atomIndices:c,theme:r,params:s(l,a,n.params)});case"VDWBalls":return p.Molecule.BallsAndSticks.Model.create(e,{model:a,atomIndices:c,theme:r,params:u(l,a)});default:return void 0}}function l(e,i,o){return t.Task.create("Visual ("+e.props.label+")",o.computationType||"Normal",function(a){var s=r.TypeDescriptions[o.type].label;a.update("Creating "+s+"..."),a.schedule(function(){var r=o.theme.template.provider(t.Utils.Molecule.findModel(e),n.Theme.getProps(o.theme)),u=c(e,o,r);if(!u)return a.reject("Invalid input parameters."),void 0;var l=u.run();l.progress.subscribe(function(e){return a.update(s+": "+t.Utils.formatProgress(e),e.requestAbort)}),l.result.then(function(e){var n=t.Entity.Molecule.Visual.create(i,{label:s,model:e,style:o,isSelectable:!o.isNotSelectable});a.resolve(n)}).catch(a.reject)},0)})}function h(i,o,a){return t.Task.create("Molecular Surface ("+i.props.label+")",a.computationType||"Normal",function(s){var u=t.Utils.Molecule.findModel(i).props.model,c=t.Entity.isMoleculeModel(i)?i.props.model.atoms.indices:i.props.indices,l=a.params,h=r.TypeDescriptions[a.type].label,f=e.Core.Geometry.MolecularSurface.computeMolecularSurfaceAsync({positions:u.atoms,atomIndices:c,parameters:{atomRadius:t.Utils.vdwRadiusFromElementSymbol(u),density:l.density,probeRadius:l.probeRadius,smoothingIterations:2*l.smoothing,interactive:!0}}).run();f.progress.subscribe(function(e){return s.update(h+": "+t.Utils.formatProgress(e),e.requestAbort)}),f.result.then(function(r){var u=a.theme.template.provider(t.Utils.Molecule.findModel(i),n.Theme.getProps(a.theme));s.update("Creating visual..."),s.schedule(function(){var n=e.Visualization.Surface.Model.create(i,{surface:r.surface,theme:u,parameters:{isWireframe:a.params.isWireframe}}).run();n.progress.subscribe(function(e){return s.update(h+": "+t.Utils.formatProgress(e),e.requestAbort)}),n.result.then(function(e){var n="Surface, "+t.Utils.round(l.probeRadius,2)+" Å probe",r=t.Entity.Molecule.Visual.create(o,{label:n,model:e,style:a,isSelectable:!a.isNotSelectable});s.resolve(r)}).catch(s.reject)},0)}).catch(s.reject)})}function f(e,t,n){return"Surface"===n.type?h(e,t,n):l(e,t,n)}var p=e.Visualization,d=e.Visualization.Molecule;r.create=f}(r=n.Molecule||(n.Molecule={}))}(n=t.Visualization||(t.Visualization={}))}(t=e.Bootstrap||(e.Bootstrap={}))}(a||(a={}));var a;!function(e){var t;!function(t){var n;!function(n){var r;!function(r){function i(t,n,r,i){for(var o=r[0]-n[0],a=r[1]-n[1],s=r[2]-n[2],u=[n,[n[0]+o,n[1],n[2]],[n[0],n[1]+a,n[2]],[n[0],n[1],n[2]+s],[n[0]+o,n[1]+a,n[2]],[n[0]+o,n[1],n[2]+s],[n[0],n[1]+a,n[2]+s],[n[0]+o,n[1]+a,n[2]+s]],c=t.dataDimensions.slice(0),l=[0,0,0],h=0,f=u;h<f.length;h++)for(var p=f[h],d=(new e.Visualization.THREE.Vector3).fromArray(p).applyMatrix4(i),m=[d.x,d.y,d.z],v=0;3>v;v++)c[v]=Math.max(0,Math.min(c[v],0|Math.floor(m[v]))),l[v]=Math.min(t.dataDimensions[v],Math.max(l[v],0|Math.ceil(m[v])));return{bottomLeft:c,topRight:l}}function o(o,s,u){var c="Background"===u.computationType?o.props.label:"Density Surface ("+o.props.label+")";return t.Task.create(c,u.computationType||"Normal",function(c){var l=u.params,h=t.Tree.Node.findClosestNodeOfType(o,[t.Entity.Density.Data]);if(!h)return c.reject("Cannot create density visual on "+o.props.label),void 0;var f=h.props.data,p=f.basis,d=(new e.Visualization.THREE.Matrix4).set(p.x[0],p.y[0],p.z[0],0,0,p.y[1],p.z[1],0,0,0,p.z[2],0,0,0,0,1);d.setPosition(new e.Visualization.THREE.Vector3(f.origin[0],f.origin[1],f.origin[2]));var m,v,g=(new e.Visualization.THREE.Matrix4).getInverse(d);if(l.bottomLeft&&l.topRight){var y=i(f,l.bottomLeft,l.topRight,g);m=y.bottomLeft,v=y.topRight}else m=[0,0,0],v=f.dataDimensions;if(!(m[0]-v[0]&&m[1]-v[1]&&m[2]-v[2]))return c.reject({warn:!0,message:"Empty box."}),void 0;var b=void 0===l.isoValueType||l.isoValueType===r.IsoValueType.Sigma,x=b?f.valuesInfo.mean+f.valuesInfo.sigma*l.isoValue:l.isoValue,w=a.MarchingCubes.compute({isoLevel:x,scalarField:f.data,bottomLeft:m,topRight:v}).bind(function(e){return a.Surface.transform(e,d.elements).bind(function(e){return a.Surface.laplacianSmooth(e,l.smoothing)})}).run();w.progress.subscribe(function(e){return c.update("Density Surface ("+h.props.label+"): "+t.Utils.formatProgress(e),e.requestAbort)}),w.result.then(function(r){var i=u.theme.template.provider(h,n.Theme.getProps(u.theme));c.update("Creating visual..."),c.schedule(function(){var n=e.Visualization.Surface.Model.create(h,{surface:r,theme:i,parameters:{isWireframe:u.params.isWireframe}}).run();n.progress.subscribe(function(e){return c.update("Density Surface ("+h.props.label+"): "+t.Utils.formatProgress(e),e.requestAbort)}),n.result.then(function(e){var n="Surface, "+t.Utils.round(l.isoValue,2)+(b?" σ":""),r=t.Entity.Density.Visual.create(s,{label:n,model:e,style:u,isSelectable:!u.isNotSelectable});c.resolve(r)}).catch(c.reject)},0)}).catch(c.reject)})}var a=e.Core.Geometry;r.create=o}(r=n.Density||(n.Density={}))}(n=t.Visualization||(t.Visualization={}))}(t=e.Bootstrap||(e.Bootstrap={}))}(a||(a={}));var a;!function(e){var t;!function(t){var n;!function(n){var r;!function(n){var r;!function(e){e[e.Sigma=0]="Sigma",e[e.Absolute=1]="Absolute"}(r=n.IsoValueType||(n.IsoValueType={}));var i;!function(e){function t(e){var t=o.Theme.colors.set("Uniform",e.color);return{type:{},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:!1,disableFog:!!e.disableFog}}}e.create=t}(i=n.Style||(n.Style={}));var o;!function(n){function i(e,t){return o.Theme.createUniform(t)}n.Params={isoValue:0,isoValueType:r.Sigma,smoothing:1,isWireframe:!1};var o=e.Visualization,a=t.Immutable.Map({Uniform:o.Theme.Default.UniformColor,Highlight:o.Theme.Default.HighlightColor,Selection:o.Theme.Default.SelectionColor});n.Themes=[{name:"Uniform Color",description:"Same color everywhere.",colors:a,provider:i}],n.Transparency={alpha:1,writeDepth:!1},n.Theme=n.Themes[0],n.Style={type:{},params:n.Params,theme:{template:n.Theme,colors:n.Theme.colors,transparency:n.Transparency,interactive:!1,disableFog:!1}}}(o=n.Default||(n.Default={}))}(r=n.Density||(n.Density={}))}(n=t.Visualization||(t.Visualization={}))}(t=e.Bootstrap||(e.Bootstrap={}))}(a||(a={}));var a;!function(e){var t;!function(e){var t;!function(t){function n(e,t){return e.type.info.typeClass===t}function r(e,t){return e.info.typeClass===t}function i(t,n){return new o(e.Utils.generateUUID(),t,n?n:{})}t.isClass=n,t.isTypeClass=r,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 o=function(){function t(e,t,n){this.id=e,this.info=t,this.traits=n}return t.prototype.create=function(t,n){var r={id:e.Tree.Node.createId(),version:0,index:0,ref:"undefined",tag:void 0,tree:void 0,props:n,state:{isCollapsed:!1,visibility:0},isHidden:!1,transform:t,parent:void 0,children:[],type:this};return e.Tree.Node.update(r)},t}();t.create=i}(t=e.Entity||(e.Entity={}))}(t=e.Bootstrap||(e.Bootstrap={}))}(a||(a={}));var a;!function(e){var t;!function(e){var t;!function(t){function n(t){t.tree&&(e.Event.Tree.NodeUpdated.dispatch(t.tree.context,t),t.tree.context.currentEntity===t&&e.Event.Entity.CurrentChanged.dispatch(t.tree.context,t))}function r(t){var r={isCollapsed:!t.state.isCollapsed};e.Tree.Node.withState(t,r),n(t)}function i(t){var r=t.tree.context.currentEntity;if(!(r===t||t&&t.isHidden)){for(var i=t.parent;i.parent!==i;){if(i.isHidden)return;i=i.parent}t.tree.context.currentEntity=t,r&&(e.Tree.Node.update(r),n(r)),t&&(e.Tree.Node.update(t),n(t)),e.Event.Entity.CurrentChanged.dispatch(t.tree.context,t),r&&e.Tree.updatePath(r),e.Tree.updatePath(t.parent)}}function o(t){if(t){for(var r=0,i=0,a=0,s=t.children;a<s.length;a++){var u=s[a],c=u.state.visibility;
0===c?r++:2===c&&i++}var l;if(l=r===t.children.length?0:i===t.children.length?2:1,l!==t.state.visibility){var c={visibility:l};e.Tree.Node.withState(t,c),n(t)}t.parent!==t&&o(t.parent)}}function a(t,r){if(t){var i=r?0:2;e.Tree.Node.forEach(t,function(t){var r=t.state.visibility;if(r!==i){var o={visibility:i};e.Tree.Node.withState(t,o),n(t)}}),o(t.parent)}}t.nodeUpdated=n,t.toggleExpanded=r,t.setCurrent=i,t.updateVisibilityState=o,t.setVisibility=a}(t=e.Entity||(e.Entity={}))}(t=e.Bootstrap||(e.Bootstrap={}))}(a||(a={}));var a;!function(e){var t;!function(e){var t;!function(t){function n(e){return e&&e.type===u.Molecule}function r(e){return e&&e.type===u.Model}function i(e){return e&&e.type===u.Selection}function o(e){return e&&e.type.info.typeClass===t.VisualClass}t.isMolecule=n,t.isMoleculeModel=r,t.isMoleculeSelection=i,t.isVisual=o,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 a;!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."})}(a=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:!0})}(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:!0}),e.Visual=t.create({name:"Molecule Visual",typeClass:"Visual",shortName:"V_M",description:"A visual of a molecule."},{isFocusable:!0});var n;!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."})}(n=e.CoordinateStreaming||(e.CoordinateStreaming={}))}(u=t.Molecule||(t.Molecule={}));var c;!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:!0}),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."})}(c=t.Density||(t.Density={}))}(t=e.Entity||(e.Entity={}))}(t=e.Bootstrap||(e.Bootstrap={}))}(a||(a={}));var a;!function(e){var t;!function(e){var t;!function(t){var n=function(){function t(t){var n=this;this.data=new Map,e.Event.Tree.NodeRemoved.getStream(t).subscribe(function(e){return n.data.delete(e.data.id)})}return t.prototype.get=function(e,t){var n=this.data.get(e.id);return n?n[t]:void 0},t.prototype.set=function(e,t,n){var r=this.data.get(e.id);return r?r[t]=n:this.data.set(e.id,(i={},i[t]=n,i)),n;var i},t}();t.Cache=n,function(e){var t;!function(e){e.QueryContext="queryContext"}(t=e.Keys||(e.Keys={}))}(n=t.Cache||(t.Cache={}))}(t=e.Entity||(e.Entity={}))}(t=e.Bootstrap||(e.Bootstrap={}))}(a||(a={}));var a;!function(e){var t;!function(e){var t;!function(t){var n;!function(n){var r;!function(n){function r(t,r){return i.create(t,function(i,o,a){return e.Task.create(t.name,"Background",function(s){var u=n.CreateGroup.create({label:t.name}).apply(i,o);u.run(i).then(function(t){var n=r.map(function(n){return function(){return e.Task.guardedPromise(i,function(e,r){var s=n.params(a.params,o);if(!s)return e(void 0),void 0;var u=n.transformer.create(s,{isBinding:!0});u.apply(i,t).run(i).then(function(t){e(t)}).catch(r)})}});e.Task.sequencePromises(n,!0).then(function(){s.resolve(t)}).catch(s.reject)})})})}var i=e.Tree.Transformer;n.Root=i.create({id:"root",name:"Root",description:"A transformer that always returns itself.",from:[t.Root],to:[t.Root],validateParams:function(){return void 0},defaultParams:function(){return{}}},function(t,n){return e.Task.resolve("Root","Silent",n)}),n.Fail=i.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(t,n,r){return e.Task.reject(r.params.title,"Background",r.params.message)}),n.CreateGroup=i.create({id:"create-group",name:"Create Group",description:"A transformer that always returns itself.",from:[],to:[t.Group],validateParams:function(){return void 0},defaultParams:function(){return{}}},function(n,r,i){var o=t.Group.create(i,{label:i.params.label?i.params.label:"Group",description:i.params.description});if(i.params.isCollapsed){var a={isCollapsed:!0};o=e.Tree.Node.withState(o,a)}return e.Task.resolve("Group","Silent",o)}),n.group=r}(r=n.Basic||(n.Basic={}))}(n=t.Transformer||(t.Transformer={}))}(t=e.Entity||(e.Entity={}))}(t=e.Bootstrap||(e.Bootstrap={}))}(a||(a={}));var a;!function(e){var t;!function(t){var n;!function(n){var r;!function(r){var i;!function(i){function o(o){return t.Tree.Transformer.action({id:"molecule-download-molecule-"+o.sourceId,name:"Molecule from "+o.name,description:o.description,from:[n.Root],to:[n.Action],defaultParams:function(){return{id:o.defaultId,format:e.Core.Formats.Molecule.SupportedFormats.mmCIF}},validateParams:function(e){return e.id&&e.id.trim().length?void 0:["Enter "+(o.isFullUrl?"URL":"Id")]}},function(e,n,a){var s=o.specificFormat?o.specificFormat:a.params.format;return t.Tree.Transform.build().add(n,r.Data.Download,{url:o.urlTemplate(a.params.id.trim()),type:s.isBinary?"Binary":"String",id:a.params.id,description:o.name,title:"Molecule"}).then(i.CreateFromData,{format:o.specificFormat?o.specificFormat:a.params.format},{isBinding:!0}).then(i.CreateModel,{modelIndex:0},{isBinding:!1})})}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:[n.Root],to:[n.Action],defaultParams:function(){return{file:void 0}},validateParams:function(t){return t.file?e.Core.Formats.FormatInfo.getFormat(t.file.name,e.Core.Formats.Molecule.SupportedFormats.All)?void 0:["Select a supported file format ("+[].concat(e.Core.Formats.Molecule.SupportedFormats.All.map(function(e){return e.extensions})).join(", ")+")."]:["Select a file"]}},function(n,o,a){var s=e.Core.Formats.FormatInfo.getFormat(a.params.file.name,e.Core.Formats.Molecule.SupportedFormats.All);return t.Tree.Transform.build().add(o,r.Data.OpenFile,{file:a.params.file,type:s.isBinary?"Binary":"String"}).then(i.CreateFromData,{format:s},{isBinding:!0}).then(i.CreateModel,{modelIndex:0},{isBinding:!1})}),i.CreateFromData=t.Tree.Transformer.create({id:"molecule-create-from-data",name:"Molecule",description:"Create a molecule from string or binary data.",from:[n.Data.String,n.Data.Binary],to:[n.Molecule.Molecule],defaultParams:function(){return{format:e.Core.Formats.Molecule.SupportedFormats.mmCIF}}},function(e,r,i){return t.Task.fromComputation("Create Molecule ("+r.props.label+")","Normal",i.params.format.parse(r.props.data,{id:i.params.customId})).setReportTime(!0).bind("Create Molecule ("+r.props.label+")","Silent",function(o){if(o.isError)return t.Task.reject("Create Molecule ("+r.props.label+")","Background",o.toString());if(o.warnings&&o.warnings.length>0)for(var a=0,s=o.warnings;a<s.length;a++){var u=s[a];e.logger.warning(u)}var c=n.Molecule.Molecule.create(i,{label:o.result.id,molecule:o.result});return t.Task.resolve("Create Molecule ("+r.props.label+")","Background",c)})}),i.CreateFromMmCif=t.Tree.Transformer.create({id:"molecule-create-from-mmcif",name:"Molecule",description:"Create a molecule from a mmCIF data block.",from:[n.Data.CifDictionary],to:[n.Molecule.Molecule],defaultParams:function(){return{blockIndex:0}}},function(r,i,o){return t.Task.create("Create Molecule ("+i.props.label+")","Normal",function(t){t.update("Creating...");var r=0|o.params.blockIndex,a=i.props.dictionary.dataBlocks[r];return a?(t.schedule(function(){var r=e.Core.Formats.Molecule.mmCIF.ofDataBlock(a);t.resolve(n.Molecule.Molecule.create(o,{label:r.id,molecule:r}))}),void 0):(t.reject("The source contains only "+i.props.dictionary.dataBlocks.length+" data block(s), tried to access the "+(r+1)+"-th."),void 0)}).setReportTime(!0)}),i.CreateModel=t.Tree.Transformer.create({id:"molecule-create-model",name:"Model",description:"Create a model of a molecule.",from:[n.Molecule.Molecule],to:[n.Molecule.Model],isUpdatable:!0,defaultParams:function(){return{modelIndex:0}}},function(e,r,i){return t.Task.create("Create Model ("+r.props.label+")","Background",function(e){var t=i.params,o=0|t.modelIndex,a=r.props.molecule.models[o];return a?(e.resolve(n.Molecule.Model.create(i,{label:"Model "+a.modelId,description:a.atoms.count+" atom"+(1!==a.atoms.count?"s":""),model:a})),void 0):(e.reject("The molecule contains only "+r.props.molecule.models.length+" model(s), tried to access the "+(o+1)+"-th."),void 0)})}),i.CreateSelection=t.Tree.Transformer.create({id:"molecule-create-selection",name:"Selection",description:"Create an atom selection.",from:[n.Molecule.Model,n.Molecule.Visual],to:[n.Molecule.Selection],isUpdatable:!0,defaultParams:function(e){return{queryString:e.settings.get("molecule.model.defaultQuery")||""}},validateParams:function(t){if(!(t.queryString||"").trim().length)return["Enter query"];try{{e.Core.Structure.Query.Builder.toQuery(t.queryString)}return void 0}catch(n){return[""+n]}}},function(r,i,o){return t.Task.create("Create Selection ("+i.props.label+")","Background",function(r){var a=o.params,s=e.Core.Structure.Query.Builder.toQuery(a.queryString),u=o.params.inFullContext?t.Utils.Molecule.findModel(i).props.model.queryContext:t.Utils.Molecule.findQueryContext(i),c=s(u).unionAtomIndices();return c.length?(r.resolve(n.Molecule.Selection.create(o,{label:a.name?a.name:"Selection",description:c.length+" atom"+(1!==c.length?"s":""),indices:c})),void 0):(r.reject({warn:!0,message:"Empty selection"+(o.params.name?" ("+o.params.name+")":"")+"."}),void 0)}).setReportTime(!o.params.silent)}),i.CreateSelectionFromQuery=t.Tree.Transformer.create({id:"molecule-create-selection",name:"Selection",description:"Create an atom selection.",from:[n.Molecule.Model,n.Molecule.Visual],to:[n.Molecule.Selection],defaultParams:function(){return void 0}},function(r,i,o){return t.Task.create("Create Selection ("+i.props.label+")","Background",function(r){var a=o.params,s=e.Core.Structure.Query.Builder.toQuery(a.query),u=o.params.inFullContext?t.Utils.Molecule.findModel(i).props.model.queryContext:t.Utils.Molecule.findQueryContext(i),c=s(u).unionAtomIndices();return c.length?(r.resolve(n.Molecule.Selection.create(o,{label:a.name?a.name:"Selection",description:c.length+" atom"+(1!==c.length?"s":""),indices:c})),void 0):(r.reject({warn:!0,message:"Empty selection"+(o.params.name?" ("+o.params.name+")":"")+"."}),void 0)}).setReportTime(!o.params.silent)}),i.CreateAssembly=t.Tree.Transformer.create({id:"molecule-create-assemly",name:"Assembly",description:"Create an assembly of a molecule.",from:[n.Molecule.Model],to:[n.Molecule.Model],defaultParams:function(e,n){var r=t.Utils.Molecule.findModel(n),i={name:e.settings.get("molecule.model.defaultAssemblyName")||"1"},o=r.props.model.assemblyInfo;return o&&o.assemblies.length?o.assemblies.filter(function(e){return e.name===i.name})?i:(i.name=o.assemblies[0].name,i):i},isUpdatable:!0,isApplicable:function(e){return!!(e&&e.props.model.assemblyInfo&&e.props.model.assemblyInfo.assemblies.length)}},function(r,i,o){return t.Task.create("Create Model ("+i.props.label+")","Background",function(t){var r=i.props.model.assemblyInfo;if(!r||!r.assemblies.length)return t.reject("Assembly info not available."),void 0;var a=r.assemblies.filter(function(e){return e.name===o.params.name})[0];return a?(t.update("Creating..."),t.schedule(function(){var r=e.Core.Structure.buildAssembly(i.props.model,a);t.resolve(n.Molecule.Model.create(o,{label:"Assembly "+a.name,description:r.atoms.count+" atom"+(1!==r.atoms.count?"s":""),model:r}))}),void 0):(t.reject("No assembly called '"+o.params.name+"' found."),void 0)})}),i.CreateSymmetryMates=t.Tree.Transformer.create({id:"molecule-create-symmetry-mates",name:"Crystal Symmetry",description:"Find crystal symmetry mates or interaction partners.",from:[n.Molecule.Model],to:[n.Molecule.Model],defaultParams:function(){return{type:"Interaction",radius:5}},isUpdatable:!0,isApplicable:function(e){return!(!e||!e.props.model.symmetryInfo)}},function(r,i,o){return t.Task.create("Create Model ("+i.props.label+")","Background",function(r){var a=i.props.model.symmetryInfo;if(!a)return r.reject("Spacegroup info info not available."),void 0;var s=Math.max(o.params.radius,0);r.update("Creating..."),r.schedule(function(){var a="Mates"===o.params.type?e.Core.Structure.buildSymmetryMates(i.props.model,s):e.Core.Structure.buildPivotGroupSymmetry(i.props.model,s);r.resolve(n.Molecule.Model.create(o,{label:"Symmetry",model:a,description:a.atoms.count+" atom"+(1!==a.atoms.count?"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:[n.Molecule.Model],to:[n.Molecule.Model],validateParams:function(e){return e&&e.transform&&16===e.transform.length?void 0:["Specify a 4x4 transform matrix."]},defaultParams:function(){return{transform:e.Core.Geometry.LinearAlgebra.Matrix4.identity()}},isUpdatable:!1},function(r,i,o){return t.Task.create("Transform 3D ("+i.props.label+")","Normal",function(t){t.update("Transforming..."),t.schedule(function(){var r=i.props.model,a={t:o.params.transform,v:{x:0,y:0,z:0}},s=e.Core.Structure.MoleculeModel.withTransformedXYZ(r,a,function(t,n,r,i,o){var a=t.v;a.x=n,a.y=r,a.z=i,e.Core.Geometry.LinearAlgebra.Matrix4.transformVector3(o,a,t.t)});t.resolve(n.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:[n.Molecule.Model,n.Molecule.Selection],to:[n.Molecule.Visual],isUpdatable:!0,defaultParams:function(){return{style:t.Visualization.Molecule.Default.ForType.get("Cartoons")}},validateParams:function(e){return e.style?void 0:["Specify Style"]},customController:function(e,n,r){return new t.Components.Transform.MoleculeVisual(e,n,r)}},function(e,n,r){var i=r.params;return t.Visualization.Molecule.create(n,r,i.style).setReportTime("Normal"===r.params.style.computationType)},function(e,r,i){var o=r.transform.params;if(o.style.type!==i.params.style.type||!t.Utils.deepEqual(o.style.params,i.params.style.params))return void 0;var a=r.props.model;if(!a)return void 0;var s=t.Utils.Molecule.findModel(r.parent);if(!s)return void 0;var u=i.params.style.theme,c=u.template.provider(s,t.Visualization.Theme.getProps(u));return a.applyTheme(c),r.props.style=i.params.style,n.nodeUpdated(r),t.Task.resolve(i.transformer.info.name,"Background",t.Tree.Node.Null)}),i.CreateMacromoleculeVisual=t.Tree.Transformer.create({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:[n.Molecule.Model],to:[n.Action],validateParams:function(e){return e.polymer||e.het||e.water?void 0:["Select at least one component"]},defaultParams:function(){return{polymer:!0,het:!0,water:!0}}},function(n,o,a){return t.Task.create("Macromolecule","Normal",function(s){var u=t.Tree.Transform.build().add(o,r.Basic.CreateGroup,{label:"Group",description:"Macromolecule"},{ref:a.params.groupRef});if(a.params.polymer){var c=u.then(i.CreateSelectionFromQuery,{query:e.Core.Structure.Query.nonHetPolymer(),name:"Polymer",silent:!0},{isBinding:!0});c.then(i.CreateVisual,{style:t.Visualization.Molecule.Default.ForType.get("Cartoons")},{ref:a.params.polymerRef})}if(a.params.het){var l=u.then(i.CreateSelectionFromQuery,{query:e.Core.Structure.Query.hetGroups(),name:"HET",silent:!0},{isBinding:!0});l.then(i.CreateVisual,{style:t.Visualization.Molecule.Default.ForType.get("BallsAndSticks")},{ref:a.params.hetRef})}if(a.params.water){var h={type:"BallsAndSticks",params:{useVDW:!1,atomRadius:.23,bondRadius:.09,detail:"Automatic"},theme:{template:t.Visualization.Molecule.Default.ElementSymbolThemeTemplate,colors:t.Visualization.Molecule.Default.ElementSymbolThemeTemplate.colors,transparency:{alpha:.25}}},f=u.then(i.CreateSelectionFromQuery,{query:e.Core.Structure.Query.entities({type:"water"}),name:"Water",silent:!0},{isBinding:!0});f.then(i.CreateVisual,{style:h},{ref:a.params.waterRef})}t.Tree.Transform.apply(n,u).run(n).then(function(){return s.resolve(t.Tree.Node.Null)}).catch(s.reject)})})}(i=r.Molecule||(r.Molecule={}))}(r=n.Transformer||(n.Transformer={}))}(n=t.Entity||(t.Entity={}))}(t=e.Bootstrap||(e.Bootstrap={}))}(a||(a={}));var a;!function(e){var t;!function(t){var n;!function(n){var r;!function(r){var i;!function(r){function i(e){return void 0===e||null===e?"String":"binary"===e.toLowerCase()?"Binary":"String"}function o(e){var n=void 0===e?t.Utils.DataCompressionMethod.None:e;return n!==t.Utils.DataCompressionMethod.None}r.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:[n.Root],to:[n.Data.String,n.Data.Binary],validateParams:function(e){return e.url&&e.url.trim().length?e.type?"String"===e.type&&o(e.responseCompression)?["Decompression is only available for Binary data."]:void 0:["Specify type"]:["Enter URL"]},defaultParams:function(){return{id:"",description:"",type:"String",url:"",responseCompression:t.Utils.DataCompressionMethod.None}}},function(e,r,o){var a=o.params;return t.Utils.ajaxGet({url:a.url,type:i(a.type),compression:a.responseCompression,title:a.title}).setReportTime(!0).map("ToEntity","Child",function(e){return"String"===a.type?n.Data.String.create(o,{label:a.id?a.id:a.url,description:a.description,data:e}):n.Data.Binary.create(o,{label:a.id?a.id:a.url,description:a.description,data:e})})}),r.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:[n.Root],to:[n.Data.String,n.Data.Binary],validateParams:function(e){return e.file?void 0:["Select a file"]},defaultParams:function(){return{type:"String",file:void 0}}},function(e,r,o){var a=o.params;return t.Utils.readFromFile(a.file,i(a.type)).setReportTime(!0).map("ToEntity","Child",function(e){return"String"===a.type?n.Data.String.create(o,{label:a.id?a.id:a.file.name,description:a.description,data:e}):n.Data.Binary.create(o,{label:a.id?a.id:a.file.name,description:a.description,data:e})})}),r.ParseCif=t.Tree.Transformer.create({id:"data-parse-cif",name:"CIF Dictionary",description:"Parse CIF dictionary from a string.",from:[n.Data.String],to:[n.Data.CifDictionary],defaultParams:function(){return{}}},function(r,i,o){return t.Task.create("CIF Parse ("+i.props.label+")","Normal",function(t){t.update("Parsing..."),t.schedule(function(){var r=e.Core.Formats.CIF.Text.parse(i.props.data);return r.isError?(t.reject(r.toString()),void 0):(t.resolve(n.Data.CifDictionary.create(o,{label:o.params.id?o.params.id:"CIF Dictionary",description:o.params.description,dictionary:r.result})),void 0)})}).setReportTime(!0)}),r.ParseBinaryCif=t.Tree.Transformer.create({id:"data-parse-binary-cif",name:"CIF Dictionary",description:"Parse CIF dictionary from BinaryCIF data.",from:[n.Data.Binary],to:[n.Data.CifDictionary],defaultParams:function(){return{}}},function(r,i,o){return t.Task.create("BinaryCIF Parse ("+i.props.label+")","Normal",function(t){t.update("Parsing..."),t.schedule(function(){var r=e.Core.Formats.CIF.Binary.parse(i.props.data);return r.isError?(t.reject(r.toString()),void 0):(t.resolve(n.Data.CifDictionary.create(o,{label:o.params.id?o.params.id:"CIF Dictionary",description:o.params.description,dictionary:r.result})),void 0)})}).setReportTime(!0)}),r.ParseJson=t.Tree.Transformer.create({id:"data-parse-json",name:"JSON",description:"Parse a string to JSON object.",from:[n.Data.String],to:[n.Data.Json],defaultParams:function(){return{}}},function(e,r,i){return t.Task.create("JSON Parse ("+r.props.label+")","Normal",function(e){e.update("Parsing..."),e.schedule(function(){var t=JSON.parse(r.props.data);e.resolve(n.Data.Json.create(i,{label:i.params.id?i.params.id:"JSON Data",description:i.params.description,data:t}))})}).setReportTime(!0)}),r.FromData=t.Tree.Transformer.create({id:"data-from-data",name:"From Data",description:"Creates a data entity from string or binary data",from:[n.Root],to:[n.Data.String,n.Data.Binary],defaultParams:function(){return void 0}},function(e,r,i){var o=i.params.data,a=o instanceof ArrayBuffer?n.Data.Binary.create(i,{label:i.params.id?i.params.id:"Binary Data",description:i.params.description,data:o}):n.Data.String.create(i,{label:i.params.id?i.params.id:"String Data",description:i.params.description,data:o});return t.Task.resolve("From Data","Silent",a)})}(i=r.Data||(r.Data={}))}(r=n.Transformer||(n.Transformer={}))}(n=t.Entity||(t.Entity={}))}(t=e.Bootstrap||(e.Bootstrap={}))}(a||(a={}));var a;!function(e){var t;!function(t){var n;!function(n){var r;!function(r){var i;!function(r){r.ParseData=t.Tree.Transformer.create({id:"density-parse-binary",name:"Density Data",description:"Parse density from binary data.",from:[n.Data.String,n.Data.Binary],to:[n.Density.Data],isUpdatable:!0,defaultParams:function(){return{format:e.Core.Formats.Density.SupportedFormats.CCP4,normalize:!1}}},function(e,r,i){return t.Task.fromComputation("Parse Density ("+r.props.label+")","Normal",i.params.format.parse(r.props.data)).setReportTime(!0).bind("Create Density ("+r.props.label+")","Silent",function(e){if(e.isError)return t.Task.reject("Create Density ("+r.props.label+")","Background",e.toString());i.params.normalize&&e.result.normalize();var o=n.Density.Data.create(i,{label:i.params.id?i.params.id:"Density Data",data:e.result,description:i.params.normalize?"Normalized":""});return t.Task.resolve("Create Density ("+r.props.label+")","Background",o)})},function(r,i,o){return i.props.data.isNormalized===o.params.normalize?t.Task.resolve("Density","Background",t.Tree.Node.Null):t.Task.create("Update Density","Normal",function(t){t.update("Updating..."),t.schedule(function(){var r=i.props.data;r.isNormalized?e.Core.Formats.Density.Data.denormalize(r):e.Core.Formats.Density.Data.normalize(r),t.resolve(n.Density.Data.create(o,{label:o.params.id?o.params.id:"Density Data",data:r,description:o.params.normalize?"Normalized":""}))})})}),r.CreateFromCif=t.Tree.Transformer.create({id:"density-create-from-cif",name:"Density Data",description:"Parse density from CIF data.",from:[n.Data.CifDictionary],to:[n.Density.Data],isUpdatable:!1,defaultParams:function(){return{blockIndex:0}}},function(r,i,o){return t.Task.create("Create Density","Normal",function(r){r.update("Parsing..."),r.schedule(function(){var a=e.Core.Formats.Density.CIF.parse(i.props.dictionary.dataBlocks[o.params.blockIndex]);return a.isError?t.Task.reject("Create Density ("+i.props.label+")","Background",a.toString()):(r.resolve(n.Density.Data.create(o,{label:o.params.id?o.params.id:"Density Data",data:a.result,description:a.result.attributes.name})),void 0)})}).setReportTime(!0)}),r.CreateFromData=t.Tree.Transformer.create({id:"density-create-from-data",name:"Density Data",description:"Create density from data.",from:[],to:[n.Density.Data],isUpdatable:!1,defaultParams:function(){return{}}},function(e,r,i){var o=n.Density.Data.create(i,{label:i.params.id?i.params.id:"Density Data",data:i.params.data,description:i.params.data.attributes.name});return t.Task.resolve("Create Density","Background",o)}),r.CreateVisual=t.Tree.Transformer.create({id:"density-create-visual",name:"Surface",description:"Create a surface from the density data.",from:[n.Density.Data],to:[n.Density.Visual],isUpdatable:!0,defaultParams:function(){return{style:t.Visualization.Density.Default.Style}},validateParams:function(e){return e.style?void 0:["Specify Style"]},customController:function(e,n,r){return new t.Components.Transform.DensityVisual(e,n,r)}},function(e,n,r){var i=r.params;return t.Visualization.Density.create(n,r,i.style).setReportTime("Normal"===r.params.style.computationType)},function(e,r,i){var o=r.transform.params;if(o.style.type!==i.params.style.type||!t.Utils.deepEqual(o.style.params,i.params.style.params))return void 0;var a=t.Tree.Node.findClosestNodeOfType(r,[n.Density.Data]);if(!a)return void 0;var s=r.props.model;if(!s)return void 0;if(!t.Utils.deepEqual(o.style.theme,i.params.style.theme)){var u=i.params.style.theme,c=u.template.provider(a,t.Visualization.Theme.getProps(u));s.applyTheme(c),r.props.style.theme=u,n.nodeUpdated(r)}return t.Task.resolve(i.transformer.info.name,"Background",t.Tree.Node.Null)}),r.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:[n.Density.Data],to:[n.Density.InteractiveSurface],isUpdatable:!0,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:!1}},customController:function(e,n,r){return new t.Components.Transform.DensityVisual(e,n,r)}},function(e,r,i){var o=i.params,a=new t.Behaviour.Density.ShowDynamicDensity(e,{style:o.style,radius:o.radius,showFull:o.showFull}),s=void 0===o.style.params.isoValueType||o.style.params.isoValueType===t.Visualization.Density.IsoValueType.Sigma;return t.Task.resolve("Behaviour","Background",n.Density.InteractiveSurface.create(i,{label:(o.id?i.params.id:"Interactive")+", "+t.Utils.round(o.style.params.isoValue,2)+(s?" σ":""),behaviour:a}))},function(e,r,i){var o=r.transform.params,a=i.params;if(o.style.type!==a.style.type||!t.Utils.deepEqual(o.style.params,a.style.params))return void 0;if(o.isoSigmaMin!==a.isoSigmaMin||o.isoSigmaMax!==a.isoSigmaMax||o.minRadius!==a.minRadius||o.maxRadius!==a.maxRadius||o.radius!==a.radius||o.showFull!==a.showFull)return void 0;var s=t.Tree.Node.findClosestNodeOfType(r,[n.Density.Data]);if(!s)return void 0;var u=a.style.theme;return r.props.behaviour.updateTheme(u),n.nodeUpdated(r),t.Task.resolve(i.transformer.info.name,"Background",t.Tree.Node.Null)})}(i=r.Density||(r.Density={}))}(r=n.Transformer||(n.Transformer={}))}(n=t.Entity||(t.Entity={}))}(t=e.Bootstrap||(e.Bootstrap={}))}(a||(a={}));var a;!function(e){var t;!function(t){var n;!function(n){var r;!function(r){var i;!function(i){var o;!function(o){o.CreateBehaviour=t.Tree.Transformer.create({id:"streaming-create-behaviour",name:"Coordinate Streaming",description:"Enable coordinate data streaming for this molecule.",from:[n.Molecule.Model],to:[n.Molecule.CoordinateStreaming.Behaviour],defaultParams:function(e){return{server:e.settings.get("molecule.coordinateStreaming.defaultServer")||"",radius:e.settings.get("molecule.coordinateStreaming.defaultRadius")||0}}},function(e,r,i){return t.Task.resolve("Behaviour","Background",n.Molecule.CoordinateStreaming.Behaviour.create(i,{label:"Coordinate Streaming",behaviour:new t.Behaviour.Molecule.CoordinateStreaming(e,i.params.server,i.params.radius)}))}),o.CreateModel=t.Tree.Transformer.create({id:"streaming-create-model",name:"Streaming Model",description:"",from:[n.Molecule.CoordinateStreaming.Behaviour],to:[n.Molecule.Model],defaultParams:function(){return void 0}},function(r,i,o){return t.Task.create("Load","Silent",function(t){var r=e.Core.Formats.CIF.Binary.parse(o.params.data);if(!r.isError){var i=e.Core.Formats.Molecule.mmCIF.ofDataBlock(r.result.dataBlocks[0]).models[0];o.params.transform&&e.Core.Structure.Operator.applyToModelUnsafe(o.params.transform,i),t.resolve(n.Molecule.Model.create(o,{label:"part",model:i}))}})}),o.InitStreaming=t.Tree.Transformer.create({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:[n.Root],to:[n.Action],validateParams:function(e){return(e.id||"").trim().length?(e.server||"").trim().length?void 0:["Specify server"]:["Enter id"]},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,n,a){return t.Task.create("Macromolecule","Normal",function(s){var u=t.Tree.Transform.build().add(n,r.Data.Download,{url:t.Behaviour.Molecule.CoordinateStreaming.getBaseUrl(a.params.id,a.params.server),type:"Binary",id:a.params.id}).then(r.Data.ParseBinaryCif,{id:a.params.id},{isBinding:!0}).then(i.CreateFromMmCif,{blockIndex:0},{isBinding:!0}).then(i.CreateModel,{modelIndex:0},{isBinding:!1}).then(o.CreateBehaviour,{server:a.params.server,radius:a.params.radius});t.Tree.Transform.apply(e,u).run(e).then(function(){return s.resolve(t.Tree.Node.Null)}).catch(s.reject)})})}(o=i.CoordinateStreaming||(i.CoordinateStreaming={}))}(i=r.Molecule||(r.Molecule={}))}(r=n.Transformer||(n.Transformer={}))}(n=t.Entity||(t.Entity={}))}(t=e.Bootstrap||(e.Bootstrap={}))}(a||(a={}));var a;!function(e){var t;!function(t){var n;!function(n){var r;!function(n){function r(e){return t.Tree.Node.findClosestNodeOfType(e,p)}function i(e){return t.Tree.Node.findClosestNodeOfType(e,d)}function o(e){return t.Tree.Node.findClosestNodeOfType(e,m)}function a(n){var i=t.Tree.Node.findClosestNodeOfType(n,d);if(t.Entity.isMoleculeModel(i))return i.props.model.queryContext;var o=i.tree.context.entityCache,a=o.get(i,t.Entity.Cache.Keys.QueryContext);return a?a:(a=e.Core.Structure.Query.Context.ofAtomIndices(r(i).props.model,i.props.indices),o.set(i,t.Entity.Cache.Keys.QueryContext,a))}function s(e,t,n,r,i,o){for(var a=e.atoms,s=a.x,u=a.y,c=a.z,l=r.atoms.x,h=r.atoms.y,f=r.atoms.z,p=Number.POSITIVE_INFINITY,d=t;n>d;d++)for(var m=i;o>m;m++){var v=s[d]-l[m],g=u[d]-h[m],y=c[d]-f[m];p=Math.min(p,v*v+g*g+y*y)}return Math.sqrt(p)}function u(e,t,n,r){for(var i=e.atoms,o=i.x,a=i.y,s=i.z,u=n.atoms.x,c=n.atoms.y,l=n.atoms.z,h=Number.POSITIVE_INFINITY,f=0,p=t;f<p.length;f++)for(var d=p[f],m=0,v=r;m<v.length;m++){var g=v[m],y=o[d]-u[g],b=a[d]-c[g],x=s[d]-l[g];h=Math.min(h,y*y+b*b+x*x)}return Math.sqrt(h)}function c(t,n){var i=r(t);if(!i)return console.warn("Could not find a model for query selection."),void 0;var o=a(t);try{var s=e.Core.Structure.Query.Builder.toQuery(n);return{model:i,indices:s(o).unionAtomIndices(),queryContext:o}}catch(u){return console.error("Query Execution",u),void 0}}function l(e,t){for(var n=e.atoms.residueIndex,r=[],i=e.residues.atomStartIndex[n[t]],o=e.residues.atomEndIndex[n[t]];o>i;i++)r.push(i);
return r}function h(e,t,n){for(var r=e.atoms,i=(r.count,r.x),o=r.y,a=r.z,s=[Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE],u=[-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE],c=0,l=t;c<l.length;c++){var h=l[c];s[0]=Math.min(i[h],s[0]),s[1]=Math.min(o[h],s[1]),s[2]=Math.min(a[h],s[2]),u[0]=Math.max(i[h],u[0]),u[1]=Math.max(o[h],u[1]),u[2]=Math.max(a[h],u[2])}return s[0]=s[0]-n,s[1]=s[1]-n,s[2]=s[2]-n,u[0]=u[0]+n,u[1]=u[1]+n,u[2]=u[2]+n,{bottomLeft:s,topRight:u}}function f(e,t,n){n.x=0,n.y=0,n.z=0;for(var r=e.atoms,i=r.x,o=r.y,a=r.z,s=0,u=t;s<u.length;s++){var c=u[s];n.x+=i[c],n.y+=o[c],n.z+=a[c]}var l=t.length;n.x/=l,n.y/=l,n.z/=l;for(var h=0,f=0,p=t;f<p.length;f++){var c=p[f],d=n.x-i[c],m=n.y-o[c],v=n.z-a[c];h=Math.max(h,d*d+m*m+v*v)}return Math.sqrt(h)}var p=[t.Entity.Molecule.Model];n.findModel=r;var d=[t.Entity.Molecule.Model,t.Entity.Molecule.Selection];n.findModelOrSelection=i;var m=[t.Entity.Molecule.Molecule];n.findMolecule=o,n.findQueryContext=a,n.getDistance=s,n.getDistanceSet=u,n.getModelAndIndicesFromQuery=c,n.getResidueIndices=l,n.getBox=h;var v=function(){function e(e){this.model=e,this.center={x:0,y:0,z:0},this.radiusSquared=0,this.count=0,this.x=e.atoms.x,this.y=e.atoms.y,this.z=e.atoms.z}return 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},e.prototype.radiusVisit=function(e){var t=this.center.x-this.x[e],n=this.center.y-this.y[e],r=this.center.z-this.z[e];this.radiusSquared=Math.max(this.radiusSquared,t*t+n*n+r*r)},e}();n.CentroidHelper=v,n.getCentroidAndRadius=f}(r=n.Molecule||(n.Molecule={}))}(n=t.Utils||(t.Utils={}))}(t=e.Bootstrap||(e.Bootstrap={}))}(a||(a={}));var a;!function(e){var t;!function(e){var t;!function(t){var n=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()}return t.prototype.init=function(){var t=this,n=e.Interactivity.Info.empty;e.Event.Tree.NodeRemoved.getStream(this.context).subscribe(function(r){e.Interactivity.isSelection(n)&&n.source===r.data&&(n=e.Interactivity.Info.empty,e.Event.Visual.VisualSelectElement.dispatch(t.context,n))}),e.Event.Visual.VisualSelectElement.getStream(this.context).subscribe(function(r){n=r.data,t.subjects.click.onNext(n),e.Interactivity.isSelection(n)&&e.Entity.isVisual(n.source)&&!n.source.props.isSelectable||t.subjects.select.onNext(n)}),e.Event.Entity.CurrentChanged.getStream(this.context).subscribe(function(e){return t.subjects.currentEntity.onNext(e.data)})},t}();t.Streams=n}(t=e.Behaviour||(e.Behaviour={}))}(t=e.Bootstrap||(e.Bootstrap={}))}(a||(a={}));var a;!function(e){var t;!function(e){var t;!function(t){function n(t){e.Event.Tree.NodeAdded.getStream(t).subscribe(function(n){var r=n.data;r&&(r.transform.isUpdate||r.type.traits.isSilent)||e.Command.Entity.SetCurrent.dispatch(t,r)})}function r(t){e.Event.Tree.NodeAdded.getStream(t).subscribe(function(n){if(e.Tree.Node.is(n.data,e.Entity.Molecule.Model)&&!n.data.isHidden){var r=e.Entity.Transformer.Molecule.CreateMacromoleculeVisual.info.defaultParams(t,n.data);e.Command.Tree.ApplyTransform.dispatch(t,{node:n.data,transform:e.Entity.Transformer.Molecule.CreateMacromoleculeVisual.create(r)})}})}function i(t){e.Event.Tree.NodeAdded.getStream(t).subscribe(function(t){var n=t.data;if(e.Entity.isMoleculeSelection(n)&&e.Entity.isVisual(n.parent)){var r=n,i=n.parent;i.props.model.applySelection(r.props.indices,1)}}),e.Event.Tree.NodeRemoved.getStream(t).subscribe(function(t){var n=t.data;if(e.Entity.isMoleculeSelection(n)&&e.Entity.isVisual(n.parent)){var r=n,i=n.parent;i.props.model.applySelection(r.props.indices,2)}})}function o(t){var n=void 0,r=void 0;t.behaviours.click.subscribe(function(t){r&&(r.applySelection(n,2),r=void 0,n=void 0),!e.Interactivity.isEmpty(t)&&e.Entity.isVisual(t.source)&&(r=t.source.props.model,n=t.elements,r.applySelection(n,1))})}function a(t){var n=e.Interactivity.Info.empty;e.Event.Visual.VisualSelectElement.getStream(t).subscribe(function(r){return e.Interactivity.isEmpty(r.data)||e.Interactivity.isEmpty(n)?(n=r.data,void 0):((e.Tree.Node.hasAncestor(n.source,r.data.source)||e.Tree.Node.hasAncestor(r.data.source,n.source))&&e.Interactivity.interactivitySelectionElementsEqual(r.data,n)?(n=e.Interactivity.Info.empty,setTimeout(function(){return e.Event.Visual.VisualSelectElement.dispatch(t,e.Interactivity.Info.empty)},0)):n=r.data,void 0)})}function s(t,n){var r=e.Utils.Molecule.findModel(n.source).props.model;if(r){var i=n.elements;1===n.elements.length&&(i=e.Utils.Molecule.getResidueIndices(r,n.elements[0]));var o=e.Utils.Molecule.getCentroidAndRadius(r,i,l);if(1===n.elements.length){var a=n.elements[0];l.x=r.atoms.x[a],l.y=r.atoms.y[a],l.z=r.atoms.z[a]}t.scene.camera.focusOnPoint(l,Math.max(o,7))}}function u(t,n){if(!e.Interactivity.isEmpty(n)&&"Visual"===n.source.type.info.typeClass){var r=n.source,i=r.props.model;if(i){var o=i.getBoundingSphereOfSelection(n.elements);o?t.scene.camera.focusOnPoint(o.center,Math.max(o.radius,7)):t.scene.camera.focusOnModel(i)}}}function c(t){t.behaviours.click.subscribe(function(n){e.Interactivity.Molecule.isMoleculeModelInteractivity(n)?s(t,n):u(t,n)})}t.SetEntityToCurrentWhenAdded=n,t.CreateVisualWhenModelIsAdded=r,t.ApplySelectionToVisual=i,t.ApplyInteractivitySelection=o,t.UnselectElementOnRepeatedClick=a;var l={x:0,y:0,z:0};t.FocusCameraOnSelect=c}(t=e.Behaviour||(e.Behaviour={}))}(t=e.Bootstrap||(e.Bootstrap={}))}(a||(a={}));var a;!function(e){var t;!function(t){var n;!function(n){var r;!function(n){function r(n){return function(r){function i(){o&&(t.Command.Tree.RemoveNode.dispatch(r,o),o=void 0,u=void 0)}var o=void 0,u=void 0,c={type:"BallsAndSticks",computationType:"Silent",params:{useVDW:!0,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:!0},l={type:"BallsAndSticks",computationType:"Silent",params:{useVDW:!1,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:!0};r.behaviours.click.subscribe(function(e){if(t.Interactivity.isEmpty(e))return i(),void 0;if(e.source.ref===u){var h=t.Utils.Molecule.findModel(e.source);if(!h)return;var f=a.atomsFromIndices(e.elements);return setTimeout(t.Command.Molecule.CreateSelectInteraction.dispatch(r,{entity:h,query:f}),0),void 0}var p=t.Entity.isVisual(e.source)?e.source.props.isSelectable:!0;if(p&&(i(),!t.Interactivity.isEmpty(e)&&t.Utils.Molecule.findModelOrSelection(e.source))){var d=a.atomsFromIndices(e.elements).wholeResidues(),m=a.atomsFromIndices(e.elements).wholeResidues().ambientResidues(n),v=t.Utils.generateUUID(),g=t.Tree.Transform.build().add(e.source,s.Basic.CreateGroup,{label:"Interaction"},{ref:v,isHidden:!0});o=v,u=t.Utils.generateUUID(),g.then(s.Molecule.CreateSelectionFromQuery,{query:m,name:"Ambience",silent:!0,inFullContext:!0},{isBinding:!0}).then(s.Molecule.CreateVisual,{style:l},{ref:u}),g.then(s.Molecule.CreateSelectionFromQuery,{query:d,name:"Ligand",silent:!0,inFullContext:!0},{isBinding:!0}).then(s.Molecule.CreateVisual,{style:c}),t.Tree.Transform.apply(r,g).run(r)}})}}function i(e){e.highlight.addProvider(function(e){if(!t.Interactivity.Molecule.isMoleculeModelInteractivity(e))return void 0;var n=t.Interactivity.Molecule.transformInteraction(e);return t.Interactivity.Molecule.formatInfo(n)})}function o(e){var n=t.Interactivity.Info.empty,r=void 0,i=void 0;e.behaviours.click.subscribe(function(e){if(t.Interactivity.Molecule.isMoleculeModelInteractivity(e)){n=e;var o=t.Utils.Molecule.findModel(e.source);o?(i=o.props.model,r=t.Interactivity.Molecule.formatInfoShort(t.Interactivity.Molecule.transformInteraction(e))):(n=t.Interactivity.Info.empty,i=void 0,r=void 0)}else n=t.Interactivity.Info.empty,i=void 0,r=void 0}),e.highlight.addProvider(function(e){if(!t.Interactivity.Molecule.isMoleculeModelInteractivity(e))return void 0;if(t.Interactivity.isEmpty(n))return void 0;var o=t.Utils.Molecule.findModel(e.source);if(!o)return void 0;var a=t.Utils.Molecule.getDistanceSet(i,n.elements,o.props.model,e.elements);return 1e-4>a?void 0:"<span><b>"+t.Utils.round(a,2)+" Å</b> from <b>"+r+"</b></span>"})}var a=e.Core.Structure.Query,s=t.Entity.Transformer;n.ShowInteractionOnSelect=r,n.HighlightElementInfo=i,n.DistanceToLastClickedElement=o}(r=n.Molecule||(n.Molecule={}))}(n=t.Behaviour||(t.Behaviour={}))}(t=e.Bootstrap||(e.Bootstrap={}))}(a||(a={}));var a;!function(e){var t;!function(e){var t;!function(t){var n;!function(t){var n="__ShowDynamicDensity-toast",r=function(){function t(t,n){this.context=t,this.params=n,this.obs=[],this.ref=e.Utils.generateUUID(),this.isBusy=!1}return t.prototype.remove=function(){var t=this.getVisual();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))return this.remove(),void 0;e.Command.Toast.Hide.dispatch(this.context,{key:n});var r=e.Utils.shallowClone(this.params.style);if(r.params=e.Utils.shallowClone(r.params),this.params.showFull)r.params.bottomLeft=void 0,r.params.topRight=void 0,r.computationType="Normal";else{var i=t,o=e.Utils.Molecule.findModel(i.source),a=i.elements,s=o.props.model;1===i.elements.length&&(a=e.Utils.Molecule.getResidueIndices(s,i.elements[0]));var u=e.Utils.Molecule.getBox(s,a,this.params.radius);r.params.bottomLeft=u.bottomLeft,r.params.topRight=u.topRight,r.computationType="Silent"}var c,l=this.getVisual();if(l)c=e.Entity.Transformer.Density.CreateVisual.create({style:r},{ref:this.ref,isHidden:!0}).update(this.context,l);else{var h=e.Entity.Transformer.Density.CreateVisual.create({style:r},{ref:this.ref,isHidden:!0});h.isUpdate=!0,c=h.apply(this.context,this.behaviour)}c.run(this.context)},t.prototype.updateTheme=function(t){if(this.params.style.theme=t,this.behaviour){var n=this.getVisual();if(n){var r=e.Tree.Node.findClosestNodeOfType(this.behaviour,[e.Entity.Density.Data]),i=t.template.provider(r,e.Visualization.Theme.getProps(t));n.props.model.applyTheme(i)}}},t.prototype.dispose=function(){this.remove(),e.Command.Toast.Hide.dispatch(this.context,{key:n});for(var t=0,r=this.obs;t<r.length;t++){var i=r[t];i.dispose()}this.obs=[]},t.prototype.register=function(t){var r=this;this.behaviour=t,this.params.showFull||e.Command.Toast.Show.dispatch(this.context,{key:n,title:"Density",message:"Click on a residue or an atom to view the data.",timeoutMs:3e4}),this.obs.push(this.context.behaviours.select.subscribe(function(e){r.update(e)}))},t}();t.ShowDynamicDensity=r}(n=t.Density||(t.Density={}))}(t=e.Behaviour||(e.Behaviour={}))}(t=e.Bootstrap||(e.Bootstrap={}))}(a||(a={}));var a;!function(e){var t;!function(t){var n;!function(n){var r;!function(n){var r=t.Entity.Transformer,i=function(){function n(e,r,i){void 0===i&&(i=5),this.context=e,this.radius=i,this.obs=[],this.target=void 0,this.behaviour=void 0,this.currentRequest=void 0,this.ref=t.Utils.generateUUID(),this.download=void 0,this.cache=new n.Cache(100),this.style={type:"BallsAndSticks",computationType:"Silent",params:{useVDW:!0,vdwScaling:.17,bondRadius:.07,detail:"Automatic"},theme:{template:t.Visualization.Molecule.Default.ElementSymbolThemeTemplate,colors:t.Visualization.Molecule.Default.ElementSymbolThemeTemplate.colors,transparency:{alpha:1}},isNotSelectable:!0},this.server=n.normalizeServerName(r)}return n.prototype.remove=function(){this.download&&(this.download.discard(),this.download=void 0),t.Command.Tree.RemoveNode.dispatch(this.context,this.ref)},n.prototype.isApplicable=function(e){return t.Interactivity.Molecule.isMoleculeModelInteractivity(e)?t.Tree.Node.hasAncestor(e.source,this.target):!1},n.prototype.update=function(n){var r=this;if(this.remove(),this.isApplicable(n)){var i=t.Utils.Molecule.findModel(n.source).props.model,o=i.atoms.residueIndex[n.elements[0]],a=i.residues,s=a.authAsymId[o],u=void 0;if(i.source===e.Core.Structure.MoleculeModelSource.Computed){var c=i.parent,l=a.chainIndex[o],h=i.chains.sourceChainIndex[l];s=c.chains.authAsymId[h],u=i.operators[i.chains.operatorIndex[l]].matrix}var f=this.server+"/"+(i.id.toLocaleLowerCase()+"/ambientResidues?")+("modelId="+encodeURIComponent(i.modelId)+"&")+("entityId="+encodeURIComponent(a.entityId[o])+"&")+("authAsymId="+encodeURIComponent(s)+"&")+("authSeqNumber="+encodeURIComponent(""+a.authSeqNumber[o])+"&")+("insCode="+encodeURIComponent(null!==a.insCode[o]?a.insCode[o]:"")+"&")+("radius="+encodeURIComponent(""+this.radius)+"&")+"atomSitesOnly=1&encoding=bcif&lowPrecisionCoords=1";this.download=t.Utils.ajaxGetArrayBuffer(f).run(this.context);var p=this.cache.get(f);p?this.create(p,u):(this.context.performance.start(this.ref),this.download.then(function(e){r.cache.add(f,e),r.context.performance.end(r.ref),r.context.logger.info("Streaming done in "+r.context.performance.formatTime(r.ref)),r.create(e,u)}).catch(function(){r.context.performance.end(r.ref)}))}},n.prototype.create=function(e,n){var i=t.Tree.Transform.build().add(this.behaviour,t.Entity.Transformer.Molecule.CoordinateStreaming.CreateModel,{data:e,transform:n},{ref:this.ref,isHidden:!0}).then(r.Molecule.CreateVisual,{style:this.style});t.Tree.Transform.apply(this.context,i).run(this.context)},n.prototype.dispose=function(){this.remove();for(var e=0,t=this.obs;e<t.length;e++){var n=t[e];n.dispose()}this.obs=[]},n.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)}))},n}();n.CoordinateStreaming=i,function(e){function n(e){return"/"!==e[e.length-1]?e:e.length>0?e.substr(0,e.length-1):e}function r(e,t){return n(t)+"/"+e.trim().toLocaleLowerCase()+"/cartoon?encoding=bcif&lowPrecisionCoords=1"}e.normalizeServerName=n,e.getBaseUrl=r;var i=function(){function e(e,t){this.key=e,this.data=t,this.previous=null,this.next=null}return e}();e.CacheEntry=i;var o=function(){function e(e){this.size=e,this.count=0,this.entries=new t.Utils.LinkedList,1>e&&(e=1)}return e.prototype.get=function(e){for(var t=this.entries.first;t;t=t.next)if(t.key===e)return t.data;return void 0},e.prototype.add=function(e,t){this.count>this.size&&this.entries.remove(this.entries.first);var n=new i(e,t);return this.entries.addLast(n),t},e}();e.Cache=o}(i=n.CoordinateStreaming||(n.CoordinateStreaming={}))}(r=n.Molecule||(n.Molecule={}))}(n=t.Behaviour||(t.Behaviour={}))}(t=e.Bootstrap||(e.Bootstrap={}))}(a||(a={}));var a;!function(e){var t;!function(e){var t;!function(t){function n(e,t,n,r,i,o,a){if(i.transformer===n)try{var s=window[a],u=o(i.params,r);s&&"undefined"!=typeof u&&s("send","event",t,u,e.id)}catch(c){}}function r(e){return e.format.name}function i(e){return e.url}function o(e){return e.queryString}function a(t,n){if(e.Tree.Node.isHidden(n))return void 0;var r=e.Utils.Molecule.findModel(n);return r?r.props.model.id+" $(name)$ "+t.name:void 0}function s(t,n){if(e.Tree.Node.isHidden(n))return void 0;var r=e.Utils.Molecule.findModel(n);return r?r.props.model.id+" $(type)$ "+t.type+" $(radius)$ "+t.radius:void 0}function u(t,n){var r=e.Utils.Molecule.findModel(n);return r?r.props.model.id+" $(server)$ "+t.server:void 0}function c(t,n){return e.Tree.Node.isHidden(n)?void 0:t.style.type}function l(e){return"$(format)$ "+e.format}function h(e){return e.queryString}function f(t,f){return void 0===f&&(f="default"),function(p){var d="ga-"+p.id+"-"+f;try{!function(e,t,n,r,i,o,a){e.GoogleAnalyticsObject=i,e[i]=e[i]||function(){(e[i].q=e[i].q||[]).push(arguments)},e[i].l=1*+new Date,o=t.createElement(n),a=t.getElementsByTagName(n)[0],o.async=1,o.src=r,a.parentNode.insertBefore(o,a)}(window,document,"script","https://www.google-analytics.com/analytics.js",d),window[d]("create",t,"auto"),setTimeout(function(){try{var e=window[d];e&&e("send","event","Loaded","contextId",p.id)}catch(t){}},1e3)}catch(m){}e.Event.Tree.TransformerApply.getStream(p).subscribe(function(t){n(p,"Download",e.Entity.Transformer.Data.Download,t.data.a,t.data.t,i,d),n(p,"Create Molecule From Data",e.Entity.Transformer.Molecule.CreateFromData,t.data.a,t.data.t,r,d),n(p,"Create Model Selecion",e.Entity.Transformer.Molecule.CreateSelection,t.data.a,t.data.t,o,d),n(p,"Create Assembly",e.Entity.Transformer.Molecule.CreateAssembly,t.data.a,t.data.t,a,d),n(p,"Create Symmetry",e.Entity.Transformer.Molecule.CreateSymmetryMates,t.data.a,t.data.t,s,d),n(p,"Create Visual",e.Entity.Transformer.Molecule.CreateVisual,t.data.a,t.data.t,c,d),n(p,"Coordinate Streaming",e.Entity.Transformer.Molecule.CoordinateStreaming.CreateBehaviour,t.data.a,t.data.t,u,d),n(p,"Parse Density",e.Entity.Transformer.Density.ParseData,t.data.a,t.data.t,l,d),n(p,"Create Model Selection",e.Entity.Transformer.Molecule.CreateSelection,t.data.a,t.data.t,h,d)})}}t.GoogleAnalytics=f}(t=e.Behaviour||(e.Behaviour={}))}(t=e.Bootstrap||(e.Bootstrap={}))}(a||(a={}));var a;!function(e){var t;!function(e){var t;!function(t){var n=function(){function t(t,n){this.context=t,this._state=new e.Rx.Subject,this._latestState=void 0,this._latestState=n}return Object.defineProperty(t.prototype,"dispatcher",{get:function(){return this.context.dispatcher},enumerable:!0,configurable:!0}),t.prototype.setState=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];var r=e.Utils.merge.apply(e.Utils,[this._latestState].concat(t));r!==this._latestState&&(this._latestState=r,this._state.onNext(r))},Object.defineProperty(t.prototype,"state",{get:function(){return this._state},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"latestState",{get:function(){return this._latestState},enumerable:!0,configurable:!0}),t}();t.Component=n}(t=e.Components||(e.Components={}))}(t=e.Bootstrap||(e.Bootstrap={}))}(a||(a={}));var a;!function(e){var t;!function(e){var t;!function(t){function n(){for(var e=[],t=0;t<=r.Root;t++)e.push(new o(r[t].toLowerCase()));return e}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 i;!function(e){e[e.Outside=0]="Outside",e[e.Landscape=1]="Landscape",e[e.Portrait=2]="Portrait"}(i=t.CollapsedControlsLayout||(t.CollapsedControlsLayout={}));var o=function(){function e(e){this.cssClass=e,this.components=[]}return e}();t.LayoutTarget=o,t.makeEmptyTargets=n;var a=function(t){function n(n,r,o){var a=t.call(this,n,{isExpanded:!1,hideControls:!1,collapsedControlsLayout:i.Outside,hiddenRegions:[]})||this;return a.targets=r,a.root=o,a.rootState=void 0,e.Command.Layout.SetState.getStream(a.context).subscribe(function(e){return a.update(e.data)}),a.expandedViewport=document.createElement("meta"),a.expandedViewport.name="viewport",a.expandedViewport.content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0",a}return c(n,t),n.prototype.update=function(t){var n=this,r=!!this.latestState.isExpanded;this.setState(t),"boolean"==typeof t.isExpanded&&t.isExpanded!==r&&this.handleExpand(),this.dispatcher.schedule(function(){return e.Event.Common.LayoutChanged.dispatch(n.context,{})})},n.prototype.getScrollElement=function(){return document.scrollingElement?document.scrollingElement:document.documentElement?document.documentElement:document.body},n.prototype.handleExpand=function(){try{var e=document.getElementsByTagName("body")[0],t=document.getElementsByTagName("head")[0];if(!e||!t)return;if(this.latestState.isExpanded){for(var n=t.children,r=!1,i=[],o=0;o<n.length;o++)n[o]===this.expandedViewport?r=!0:"viewport"===(n[o].name||"").toLowerCase()&&i.push(n[o]);for(var a=0,s=i;a<s.length;a++){var u=s[a];t.removeChild(u)}r||t.appendChild(this.expandedViewport);var c=e.style,l=this.getScrollElement(),h=l.scrollLeft,f=l.scrollTop;this.rootState={top:c.top,bottom:c.bottom,right:c.right,left:c.left,scrollTop:f,scrollLeft:h,position:c.position,overflow:c.overflow,viewports:i,zindex:this.root.style.zIndex,width:c.width,height:c.height,maxWidth:c.maxWidth,maxHeight:c.maxHeight,margin:c.margin,marginLeft:c.marginLeft,marginRight:c.marginRight,marginTop:c.marginTop,marginBottom:c.marginBottom},c.overflow="hidden",c.position="fixed",c.top="0",c.bottom="0",c.right="0",c.left="0",c.width="100%",c.height="100%",c.maxWidth="100%",c.maxHeight="100%",c.margin="0",c.marginLeft="0",c.marginRight="0",c.marginTop="0",c.marginBottom="0",this.root.style.zIndex="100000"}else{for(var n=t.children,o=0;o<n.length;o++)if(n[o]===this.expandedViewport){t.removeChild(this.expandedViewport);break}if(this.rootState){for(var c=e.style,p=this.rootState,d=0,m=p.viewports;d<m.length;d++){var u=m[d];t.appendChild(u)}c.top=p.top,c.bottom=p.bottom,c.left=p.left,c.right=p.right,c.width=p.width,c.height=p.height,c.maxWidth=p.maxWidth,c.maxHeight=p.maxHeight,c.margin=p.margin,c.marginLeft=p.marginLeft,c.marginRight=p.marginRight,c.marginTop=p.marginTop,c.marginBottom=p.marginBottom,c.position=p.position,c.overflow=p.overflow;var l=this.getScrollElement();l.scrollTop=p.scrollTop,l.scrollLeft=p.scrollLeft,this.rootState=void 0,this.root.style.zIndex=p.zindex}}}catch(v){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.",v)}},n}(t.Component);t.Layout=a}(t=e.Components||(e.Components={}))}(t=e.Bootstrap||(e.Bootstrap={}))}(a||(a={}));var a;!function(e){var t;!function(e){var t;!function(t){var n;!function(n){var r=function(t){function n(n,r,i){var o=t.call(this,n,{params:r.info.defaultParams(n,i),canApply:!1,isBusy:!1,issues:void 0,parametersAutoUpdating:!1,isDirty:!1})||this;return o.transformer=r,o.entity=i,o.updateTimeout=new e.Rx.Subject,o.timeout=e.Rx.Observable.timer(50),o.never=e.Rx.Observable.never(),o.anchorParams=o.latestState.params,o.updateParams(o.anchorParams),o.updateTimeout.flatMapLatest(function(e){return e}).forEach(function(){return o.apply()}),o}return c(n,t),n.prototype._update=function(){this.isUpdate&&!this.latestState.isBusy&&this.updateTimeout&&(this.updateTimeout.onNext(this.timeout),this.setState({parametersAutoUpdating:!0}))},n.prototype._reset=function(){this.setState({parametersAutoUpdating:!1}),this.updateTimeout&&this.updateTimeout.onNext(this.never)},n.prototype._updateParams=function(t){var n=e.Utils.merge(this.latestState.params,t);if(this.transformer.info.validateParams){var r=this.transformer.info.validateParams(n);if(r&&r.length>0)return this.setState({params:n,issues:r,canApply:!1}),void 0}var i=!e.Utils.deepEqual(this.anchorParams,n);this.setState({params:n,isDirty:i,issues:void 0,canApply:!0})},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:!0,configurable:!0}),n.prototype.apply=function(){var e=this;if(this._reset(),!this.latestState.isBusy){var t=this.transformer.create(this.latestState.params);this.anchorParams=this.latestState.params,this.setState({isDirty:!1,isBusy:!0});try{var n=this.isUpdate?t.update(this.context,this.entity):t.apply(this.context,this.entity);n.run(this.context).then(function(){return e.setState({isBusy:!1})}).catch(function(){return e.setState({isBusy:!1})})}catch(r){this.setState({isBusy:!1})}}},n.prototype.setParams=function(e){this._reset(),this.anchorParams=e,this.updateParams(e)},n}(t.Component);n.Controller=r}(n=t.Transform||(t.Transform={}))}(t=e.Components||(e.Components={}))}(t=e.Bootstrap||(e.Bootstrap={}))}(a||(a={}));var a;!function(e){var t;!function(e){var t;!function(t){var n;!function(n){var r=function(t){function n(n){var r=t.call(this,n,{update:void 0,transforms:[]})||this;return r.update(),e.Event.Entity.CurrentChanged.getStream(n).subscribe(function(){return r.update()}),r}return c(n,t),n.prototype.update=function(){if(!this.context.currentEntity)return this.setState({transforms:[]}),void 0;var e=this.context.currentEntity,t=this.context.transforms,n=void 0;e.transform.transformer&&e.transform.transformer.info.isUpdatable&&(n=t.getController(e.transform.transformer,e));for(var r=[],i=0,o=this.context.transforms.getBySourceType(e.type);i<o.length;i++){var a=o[i];if(!a.info.isApplicable||a.info.isApplicable(e)){var s=t.getController(a,e);s&&r.push(s)}}this.setState({update:n,transforms:r})},n}(t.Component);n.View=r}(n=t.Transform||(t.Transform={}))}(t=e.Components||(e.Components={}))}(t=e.Bootstrap||(e.Bootstrap={}))}(a||(a={}));var a;!function(e){var t;!function(e){var t;!function(t){var n;!function(t){var n=function(t){function n(){return t.apply(this,arguments)||this}return c(n,t),n.prototype.updateTemplate=function(e,t){var n=t.get(e),r=this.latestState&&this.latestState.params.style.theme,i=n.params,o=r||this.getThemeInstance(n.theme.template),a={type:n.type,params:i,theme:o};this.autoUpdateParams({style:a})},n.prototype.updateStyleParams=function(t){var n=e.Utils.shallowClone(this.latestState.params.style);n.params=e.Utils.merge(n.params,t),this.autoUpdateParams({style:n})},n.prototype.updateStyleTheme=function(t){var n=e.Utils.shallowClone(this.latestState.params.style);n.theme=e.Utils.merge(n.theme,t),this.autoUpdateParams({style:n})},n.prototype.updateThemeColor=function(t,n){var r=this.latestState.params.style.theme;if(r){var i=r.colors;i||(i=e.Immutable.Map()),i=i.set(t,n),this.updateStyleTheme({colors:i})}},n.prototype.updateThemeTransparency=function(e){var t=this.latestState.params.style.theme;t&&this.updateStyleTheme({transparency:e})},n.prototype.getThemeInstance=function(t){var n=this.latestState.params.style.theme,r=e.Visualization.Molecule.Default.ForType.get(this.latestState.params.style.type).theme.transparency;if(!n)return{template:t,colors:t.colors,transparency:r};var i=t.colors;n.colors&&i&&(i=i.withMutations(function(e){n.colors.forEach(function(t,n){e.has(n)&&e.set(n,t)})}));var o=n.transparency?n.transparency:r;return{template:t,colors:i,transparency:o}},n.prototype.updateThemeDefinition=function(e){this.updateStyleTheme(this.getThemeInstance(e))},n}(t.Controller);t.MoleculeVisual=n;var r=function(t){function n(){return t.apply(this,arguments)||this}return c(n,t),n.prototype.cloneStyle=function(t){return e.Utils.shallowClone(this.latestState.params[t||"style"])},n.prototype.getStyle=function(e){return this.latestState.params[e||"style"]},n.prototype.setStyle=function(e,t){this.autoUpdateParams((n={},n[t||"style"]=e,n));var n},n.prototype.updateStyleParams=function(t,n){var r=this.cloneStyle(n);r.params=e.Utils.merge(r.params,t),this.setStyle(r,n)},n.prototype.updateStyleTheme=function(t,n){var r=this.cloneStyle(n);r.theme=e.Utils.merge(r.theme,t),this.setStyle(r,n)},n.prototype.updateThemeColor=function(t,n,r){var i=this.getStyle(r).theme;if(i){var o=i.colors;o||(o=e.Immutable.Map()),o=o.set(t,n),this.updateStyleTheme({colors:o},r)}},n.prototype.updateThemeTransparency=function(e,t){var n=this.getStyle(t).theme;n&&this.updateStyleTheme({transparency:e},t)},n.prototype.getThemeInstance=function(t,n){var r=this.getStyle(n).theme,i=e.Visualization.Density.Default.Transparency;if(!r)return{template:t,colors:t.colors,transparency:i};var o=t.colors;r.colors&&o&&(o=o.withMutations(function(e){r.colors.forEach(function(t,n){e.has(n)&&e.set(n,t)})}));var a=r.transparency?r.transparency:i;return{template:t,colors:o,transparency:a}},n.prototype.updateThemeDefinition=function(e,t){this.updateStyleTheme(this.getThemeInstance(e,t),t)},n}(t.Controller);t.DensityVisual=r}(n=t.Transform||(t.Transform={}))}(t=e.Components||(e.Components={}))}(t=e.Bootstrap||(e.Bootstrap={}))}(a||(a={}));var a;!function(e){var t;!function(e){var t;!function(t){var n;!function(n){var r=function(t){function n(n,r,i){var o=t.call(this,n,{controller:void 0})||this;return o.selector=r,o.header=i,e.Event.Tree.NodeAdded.getStream(n).subscribe(function(){return o.added()}),e.Event.Tree.NodeRemoved.getStream(n).subscribe(function(e){return o.removed(e.data)}),o}return c(n,t),n.prototype.removed=function(e){if(this.latestState.controller){var t=this.latestState.controller.entity;t===e&&this.setState({controller:void 0})}},n.prototype.added=function(){var e=this.context.select(this.selector),t=e[0];if(t&&t.transform){var n=this.context.transforms.getController(t.transform.transformer,t);n&&this.setState({controller:n})}},n}(t.Component);n.Updater=r}(n=t.Transform||(t.Transform={}))}(t=e.Components||(e.Components={}))}(t=e.Bootstrap||(e.Bootstrap={}))}(a||(a={}));var a;!function(e){var t;!function(e){var t;!function(t){var n;!function(n){var r=function(t){function n(n,r,i,o){var a=t.call(this,n,{controller:void 0})||this;return a.selector=r,a.transformer=i,a.header=o,e.Event.Tree.NodeAdded.getStream(n).subscribe(function(){return a.added()}),e.Event.Tree.NodeRemoved.getStream(n).subscribe(function(e){return a.removed(e.data)}),a}return c(n,t),n.prototype.removed=function(e){if(this.latestState.controller){var t=this.latestState.controller.entity;t===e&&this.setState({controller:void 0})}},n.prototype.added=function(){var e=this.context.select(this.selector),t=e[0];if(t){var n=this.context.transforms.getController(this.transformer,t);n&&this.setState({controller:n})}},n}(t.Component);n.Action=r}(n=t.Transform||(t.Transform={}))}(t=e.Components||(e.Components={}))}(t=e.Bootstrap||(e.Bootstrap={}))}(a||(a={}));var a;!function(e){var t;!function(e){var t;!function(t){var n;!function(n){var r=function(t){function n(n){var r=t.call(this,n,{entries:e.Immutable.List()})||this;return e.Event.Log.getStream(r.context).subscribe(function(e){return r.setState({entries:r.latestState.entries.push(e.data)})}),r}return c(n,t),n}(t.Component);n.Log=r}(n=t.Context||(t.Context={}))}(t=e.Components||(e.Components={}))}(t=e.Bootstrap||(e.Bootstrap={}))}(a||(a={}));var a;!function(e){var t;!function(e){var t;!function(t){var n;!function(n){var r=function(t){function n(n){var r=t.call(this,n,{entries:e.Immutable.Map()})||this;return r.serialNumber=0,r.serialId=0,e.Command.Toast.Show.getStream(r.context).subscribe(function(e){return r.show(e.data)}),e.Command.Toast.Hide.getStream(r.context).subscribe(function(e){return r.hide(r.findByKey(e.data.key))}),r}return c(n,t),n.prototype.findByKey=function(e){return this.latestState.entries.find(function(t){return!!t&&t.key===e})},n.prototype.show=function(e){var t,n=this,r=this.latestState.entries,i=void 0,o=++this.serialId;e.key&&(i=this.findByKey(e.key))?(void 0!==i.timeout&&clearTimeout(i.timeout),t=i.serialNumber,r=r.remove(i.id)):t=++this.serialNumber,i={id:o,serialNumber:t,key:e.key,title:e.title,message:e.message,timeout:this.timeout(o,e.timeoutMs),hide:function(){return n.hideId(o)}},r=r.set(o,i),this.setState({entries:r})},n.prototype.timeout=function(e,t){var n=this;return void 0===t?void 0:(0>t&&(t=500),setTimeout(function(){var t=n.latestState.entries.get(e);t.timeout=void 0,n.hide(t)},t))},n.prototype.hideId=function(e){this.hide(this.latestState.entries.get(e))},n.prototype.hide=function(e){if(e){void 0!==e.timeout&&clearTimeout(e.timeout),e.hide=void 0;var t=this.latestState.entries;t=t.delete(e.id),this.setState({entries:t})
}},n}(t.Component);n.Toast=r}(n=t.Context||(t.Context={}))}(t=e.Components||(e.Components={}))}(t=e.Bootstrap||(e.Bootstrap={}))}(a||(a={}));var a;!function(e){var t;!function(e){var t;!function(t){var n;!function(n){var r=function(t){function n(n,r){var i=t.call(this,n,{tasks:e.Immutable.Map()})||this;return i.type=r,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===r}).subscribe(function(e){return i.started(e.data)}),e.Event.Task.Completed.getStream(i.context).subscribe(function(e){return i.completed(e.data)}),i}return c(n,t),n.prototype.updated=function(e){var t=e.type===this.type,n=this.latestState.tasks;return t?(n=n.set(e.taskId,{name:e.name,message:e.message,abort:e.abort}),this.setState({tasks:n}),void 0):(n.has(e.taskId)&&(n=n.delete(e.taskId),this.setState({tasks:n})),void 0)},n.prototype.started=function(e){this.setState({tasks:this.latestState.tasks.set(e.id,{name:e.name,message:"Running..."})})},n.prototype.completed=function(e){this.latestState.tasks.has(e)&&this.setState({tasks:this.latestState.tasks.delete(e)})},n}(t.Component);n.TaskWatcher=r}(n=t.Context||(t.Context={}))}(t=e.Components||(e.Components={}))}(t=e.Bootstrap||(e.Bootstrap={}))}(a||(a={}));var a;!function(e){var t;!function(e){var t;!function(t){var n;!function(n){var r=function(t){function n(n){var r=t.call(this,n,{info:[]})||this;return e.Event.Interactivity.Highlight.getStream(r.context).subscribe(function(e){return r.setState({info:e.data})}),r}return c(n,t),n}(t.Component);n.HighlightInfo=r}(n=t.Visualization||(t.Visualization={}))}(t=e.Components||(e.Components={}))}(t=e.Bootstrap||(e.Bootstrap={}))}(a||(a={}));var a;!function(e){var t;!function(t){var n;!function(n){var r;!function(r){var i=e.Visualization,o=function(n){function r(e){var r=n.call(this,e,t.Utils.shallowClone(i.DefaultSceneOptions))||this;return t.Event.Common.LayoutChanged.getStream(r.context).subscribe(function(){r._scene&&r._scene.scene.resized()}),t.Command.Layout.SetViewportOptions.getStream(r.context).subscribe(function(e){return r.setState(e.data)}),r.state.throttle(1e3/30).subscribe(function(e){r.scene.scene.updateOptions(e)}),r}return c(r,n),Object.defineProperty(r.prototype,"scene",{get:function(){return this._scene},enumerable:!0,configurable:!0}),r.prototype.init=function(n){if(!e.Visualization.checkWebGL())return!1;try{return this._scene=new t.Visualization.SceneWrapper(n,this.context,this.latestState),this.context.scene=this._scene,!0}catch(r){return!1}},r.prototype.destroy=function(){this._scene&&(this._scene.destroy(),this._scene=null)},r}(n.Component);r.Viewport=o}(r=n.Visualization||(n.Visualization={}))}(n=t.Components||(t.Components={}))}(t=e.Bootstrap||(e.Bootstrap={}))}(a||(a={}));var a;!function(e){var t;!function(t){var n=function(){function e(){this.settings=new Map}return e.prototype.set=function(e,t){this.settings.set(e,t)},e.prototype.get=function(e){return this.settings.get(e)},e}();t.Settings=n;var r=function(){function r(r){this.plugin=r,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 n,t.initEventsAndCommands(this)}return r.prototype.createLayout=function(e,n){this.layout=new t.Components.Layout(this,e,n)},r.prototype.select=function(e){return t.Tree.Selection.select(e,this.tree)},r}();t.Context=r}(t=e.Bootstrap||(e.Bootstrap={}))}(a||(a={}));var a;!function(e){var t;!function(e){var t;!function(){}(t=e.Plugin||(e.Plugin={}))}(t=e.Bootstrap||(e.Bootstrap={}))}(a||(a={}));var a;!function(e){var t;!function(e){function t(t,n){if(!e.Utils.Molecule.findModelOrSelection(n.entity))return console.warn("Select: Trying to create a selection event on a non-molecule related entity, ignoring..."),void 0;var r=e.Utils.Molecule.getModelAndIndicesFromQuery(n.entity,n.query);r&&r.indices.length&&e.Event.Visual.VisualSelectElement.dispatch(t,e.Interactivity.Info.selection(n.entity,r.indices))}function n(n){e.Command.Entity.SetCurrent.getStream(n).subscribe(function(t){return e.Entity.setCurrent(t.data)}),e.Command.Entity.SetVisibility.getStream(n).subscribe(function(t){return e.Entity.setVisibility(t.data.entity,t.data.visible)}),e.Command.Entity.ToggleExpanded.getStream(n).subscribe(function(t){return e.Entity.toggleExpanded(t.data)}),e.Command.Tree.RemoveNode.getStream(n).subscribe(function(t){return n.select(t.data).forEach(function(t){return e.Tree.remove(t)})}),e.Command.Tree.ApplyTransform.getStream(n).subscribe(function(e){(e.data.isUpdate?e.data.transform.update(n,e.data.node):e.data.transform.apply(n,e.data.node)).run(n)}),e.Event.Tree.NodeAdded.getStream(n).subscribe(function(t){var n=t.data.parent.state.visibility,r=2!==n;if(e.Entity.setVisibility(t.data,r),e.Entity.isClass(t.data,e.Entity.BehaviourClass)){var i=t.data;i.props.behaviour.register(i)}}),e.Event.Tree.NodeRemoved.getStream(n).subscribe(function(t){if(e.Entity.updateVisibilityState(t.data.parent),e.Entity.isClass(t.data,e.Entity.BehaviourClass)){var n=t.data;n.props.behaviour.dispose()}}),e.Event.Visual.VisualHoverElement.getStream(n).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(n,t)}),e.Event.Visual.VisualSelectElement.getStream(n).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(n,t)}),e.Command.Molecule.CreateSelectInteraction.getStream(n).subscribe(function(e){return t(n,e.data)})}e.initEventsAndCommands=n}(t=e.Bootstrap||(e.Bootstrap={}))}(a||(a={}));var a;!function(e){var t;!function(e){var t=function(){function t(t){var n=this;this.context=t,this.controllerCache=new Map,this.state=new Map,this.byId=new Map,this.bySourceType=new Map,this.byTargetType=new Map,e.Event.Tree.NodeRemoved.getStream(t).subscribe(function(e){n.controllerCache.delete(e.data.id),n.state.delete(e.data.id)})}return t.prototype.addType=function(e,t,n){var r=n.get(e.id);r?r.push(t):n.set(e.id,[t])},t.prototype.getController=function(t,n){if(!this.byId.get(t.info.id))return console.warn("Trying to get contoller for unregistered transform ("+t.info.id+")"),void 0;var r=this.controllerCache.get(n.id);r||(r=new Map,this.controllerCache.set(n.id,r));var i=r.get(t.info.id);if(i)return i;var o=t.info.customController;i=o?o(this.context,t,n):new e.Components.Transform.Controller(this.context,t,n);var a=this.context.plugin&&this.context.plugin.getTransformerInfo(t);return a&&a.initiallyCollapsed?this.hasPersistentState(t,n,"isExpanded")||this.setPersistentState(t,n,"isExpanded",!1):this.hasPersistentState(t,n,"isExpanded")||this.setPersistentState(t,n,"isExpanded",!0),n.transform.transformer===t&&i.setParams(n.transform.params),r.set(t.info.id,i),i},t.prototype.getBySourceType=function(e){return this.bySourceType.get(e.id)||[]},t.prototype.getByTargetType=function(e){return this.byTargetType.get(e.id)||[]},t.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,n=e.info.from;t<n.length;t++){var r=n[t];this.addType(r,e,this.bySourceType)}for(var i=0,o=e.info.to;i<o.length;i++){var r=o[i];this.addType(r,e,this.byTargetType)}},t.prototype.hasPersistentState=function(e,t,n){var r=this.state.get(t.id);if(!r)return!1;var i=r.get(e.info.id);return i&&i.has(n)?!0:!1},t.prototype.getPersistentState=function(e,t,n,r){var i=this.state.get(t.id);if(!i)return r;var o=i.get(e.info.id);return o&&o.has(n)?o.get(n):r},t.prototype.setPersistentState=function(e,t,n,r){var i=this.state.get(t.id);i||(i=new Map,this.state.set(t.id,i));var o=i.get(e.info.id);o||(o=new Map,i.set(e.info.id,o));var a=o.get(n);return o.set(n,r),a!==r},t}();e.TransformManager=t}(t=e.Bootstrap||(e.Bootstrap={}))}(a||(a={}));var p={};!function(e){function t(e){var t=document.getElementsByTagName("head")[0],n=document.createElement("script");n.type="text/javascript",n.charset="utf-8",n.src=f.p+""+e+"."+w+".hot-update.js",t.appendChild(n)}function n(e){if("undefined"==typeof XMLHttpRequest)return e(new Error("No browser support"));try{var t=new XMLHttpRequest,n=f.p+""+w+".hot-update.json";t.open("GET",n,!0),t.timeout=1e4,t.send(null)}catch(r){return e(r)}t.onreadystatechange=function(){if(4===t.readyState)if(0===t.status)e(new Error("Manifest request to "+n+" timed out."));else if(404===t.status)e();else if(200!==t.status&&304!==t.status)e(new Error("Manifest request to "+n+" failed."));else{try{var r=JSON.parse(t.responseText)}catch(i){return e(i),void 0}e(null,r)}}}function r(e){function t(e,t){"ready"===S&&o("prepare"),T++,f.e(e,function(){function n(){T--,"prepare"===S&&(A[e]||c(e),0===T&&0===M&&l())}try{t.call(null,r)}finally{n()}})}var n=R[e];if(!n)return f;var r=function(t){return n.hot.active?R[t]?(R[t].parents.indexOf(e)<0&&R[t].parents.push(e),n.children.indexOf(t)<0&&n.children.push(t)):C=[e]:(console.warn("[HMR] unexpected require("+t+") from disposed module "+e),C=[]),f(t)};for(var i in f)Object.prototype.hasOwnProperty.call(f,i)&&(m?Object.defineProperty(r,i,function(e){return{configurable:!0,enumerable:!0,get:function(){return f[e]},set:function(t){f[e]=t}}}(i)):r[i]=f[i]);return m?Object.defineProperty(r,"e",{enumerable:!0,value:t}):r.e=t,r}function i(e){var t={_acceptedDependencies:{},_declinedDependencies:{},_selfAccepted:!1,_selfDeclined:!1,_disposeHandlers:[],active:!0,accept:function(e,n){if("undefined"==typeof e)t._selfAccepted=!0;else if("function"==typeof e)t._selfAccepted=e;else if("object"==typeof e)for(var r=0;r<e.length;r++)t._acceptedDependencies[e[r]]=n;else t._acceptedDependencies[e]=n},decline:function(e){if("undefined"==typeof e)t._selfDeclined=!0;else if("number"==typeof e)t._declinedDependencies[e]=!0;else for(var n=0;n<e.length;n++)t._declinedDependencies[e[n]]=!0},dispose:function(e){t._disposeHandlers.push(e)},addDisposeHandler:function(e){t._disposeHandlers.push(e)},removeDisposeHandler:function(e){var n=t._disposeHandlers.indexOf(e);n>=0&&t._disposeHandlers.splice(n,1)},check:s,apply:h,status:function(e){return e?(E.push(e),void 0):S},addStatusHandler:function(e){E.push(e)},removeStatusHandler:function(e){var t=E.indexOf(e);t>=0&&E.splice(t,1)},data:_[e]};return t}function o(e){S=e;for(var t=0;t<E.length;t++)E[t].call(null,e)}function a(e){var t=+e+""===e;return t?+e:e}function s(e,t){if("idle"!==S)throw new Error("check() is only allowed in idle status");"function"==typeof e?(x=!1,t=e):(x=e,t=t||function(e){if(e)throw e}),o("check"),n(function(e,n){if(e)return t(e);if(!n)return o("idle"),t(null,null),void 0;P={},k={},A={};for(var r=0;r<n.c.length;r++)k[n.c[r]]=!0;b=n.h,o("prepare"),g=t,y={};var i=0;c(i),"prepare"===S&&0===T&&0===M&&l()})}function u(e,t){if(k[e]&&P[e]){P[e]=!1;for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(y[n]=t[n]);0===--M&&0===T&&l()}}function c(e){k[e]?(P[e]=!0,M++,t(e)):A[e]=!0}function l(){o("ready");var e=g;if(g=null,e)if(x)h(x,e);else{var t=[];for(var n in y)Object.prototype.hasOwnProperty.call(y,n)&&t.push(a(n));e(null,t)}}function h(t,n){function r(e){for(var t=[e],n={},r=t.slice();r.length>0;){var o=r.pop(),e=R[o];if(e&&!e.hot._selfAccepted){if(e.hot._selfDeclined)return new Error("Aborted because of self decline: "+o);if(0===o)return;for(var a=0;a<e.parents.length;a++){var s=e.parents[a],u=R[s];if(u.hot._declinedDependencies[o])return new Error("Aborted because of declined dependency: "+o+" in "+s);t.indexOf(s)>=0||(u.hot._acceptedDependencies[o]?(n[s]||(n[s]=[]),i(n[s],[o])):(delete n[s],t.push(s),r.push(s)))}}}return[t,n]}function i(e,t){for(var n=0;n<t.length;n++){var r=t[n];e.indexOf(r)<0&&e.push(r)}}if("ready"!==S)throw new Error("apply() is only allowed in ready status");"function"==typeof t?(n=t,t={}):t&&"object"==typeof t?n=n||function(e){if(e)throw e}:(t={},n=n||function(e){if(e)throw e});var s={},u=[],c={};for(var l in y)if(Object.prototype.hasOwnProperty.call(y,l)){var h=a(l),p=r(h);if(!p){if(t.ignoreUnaccepted)continue;return o("abort"),n(new Error("Aborted because "+h+" is not accepted"))}if(p instanceof Error)return o("abort"),n(p);c[h]=y[h],i(u,p[0]);for(var h in p[1])Object.prototype.hasOwnProperty.call(p[1],h)&&(s[h]||(s[h]=[]),i(s[h],p[1][h]))}for(var d=[],m=0;m<u.length;m++){var h=u[m];R[h]&&R[h].hot._selfAccepted&&d.push({module:h,errorHandler:R[h].hot._selfAccepted})}o("dispose");for(var v=u.slice();v.length>0;){var h=v.pop(),g=R[h];if(g){for(var x={},E=g.hot._disposeHandlers,M=0;M<E.length;M++){var T=E[M];T(x)}_[h]=x,g.hot.active=!1,delete R[h];for(var M=0;M<g.children.length;M++){var A=R[g.children[M]];if(A){var P=A.parents.indexOf(h);P>=0&&A.parents.splice(P,1)}}}}for(var h in s)if(Object.prototype.hasOwnProperty.call(s,h))for(var g=R[h],k=s[h],M=0;M<k.length;M++){var I=k[M],P=g.children.indexOf(I);P>=0&&g.children.splice(P,1)}o("apply"),w=b;for(var h in c)Object.prototype.hasOwnProperty.call(c,h)&&(e[h]=c[h]);var D=null;for(var h in s)if(Object.prototype.hasOwnProperty.call(s,h)){for(var g=R[h],k=s[h],B=[],m=0;m<k.length;m++){var I=k[m],T=g.hot._acceptedDependencies[I];B.indexOf(T)>=0||B.push(T)}for(var m=0;m<B.length;m++){var T=B[m];try{T(s)}catch(V){D||(D=V)}}}for(var m=0;m<d.length;m++){var L=d[m],h=L.module;C=[h];try{f(h)}catch(V){if("function"==typeof L.errorHandler)try{L.errorHandler(V)}catch(V){D||(D=V)}else D||(D=V)}}return D?(o("fail"),n(D)):(o("idle"),n(null,u),void 0)}function f(t){if(R[t])return R[t].exports;var n=R[t]={exports:{},id:t,loaded:!1,hot:i(t),parents:C,children:[]};return e[t].call(n.exports,n,n.exports,r(t)),n.loaded=!0,n.exports}var p={},d=p.webpackHotUpdate;p.webpackHotUpdate=function(e,t){u(e,t),d&&d(e,t)};var m=!1;try{Object.defineProperty({},"x",{get:function(){}}),m=!0}catch(v){}var g,y,b,x=!0,w="cac23860c44b0ba80f83",_={},C=[],E=[],S="idle",M=0,T=0,A={},P={},k={},R={};return f.m=e,f.c=R,f.p="build/",f.h=function(){return w},r(0)(0)}([function(e,t,n){e.exports=n(1)},function(e,t,n){function r(e){return e&&e.__esModule?e:{"default":e}}var i=n(2),o=r(i);p.ChromePicker=o.default},function(e,t,n){function r(e){return e&&e.__esModule?e:{"default":e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(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)}Object.defineProperty(t,"__esModule",{value:!0}),t.Chrome=void 0;var s=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},u=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),c=n(3),l=r(c),h=n(4),f=r(h),p=n(15),d=n(29),m=r(d),v=n(30),g=r(v),y=n(17),b=r(y),x=n(31),w=r(x),_=t.Chrome=function(e){function t(){for(var e,n,r,a,s=arguments.length,u=Array(s),c=0;s>c;c++)u[c]=arguments[c];return i(this,t),n=r=o(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(u))),r.shouldComponentUpdate=b.default.bind(r,r,arguments[0],arguments[1]),r.handleChange=function(e){r.props.onChange(e)},a=n,o(r,a)}return a(t,e),u(t,[{key:"classes",value:function(){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(){var e=[];if(this.props.colors)for(var t=0;t<this.props.colors.length;t++){var n=this.props.colors[t];e.push(l.default.createElement(w.default,{key:n,color:n,active:n.replace("#","").toLowerCase()==this.props.hex,onClick:this.handleChange}))}return l.default.createElement("div",{style:this.styles().picker},l.default.createElement("div",{style:this.styles().saturation},l.default.createElement(p.Saturation,s({},this.styles().Saturation,this.props,{pointer:g.default,onChange:this.handleChange}))),l.default.createElement("div",{style:this.styles().body},l.default.createElement("div",{style:this.styles().hue},l.default.createElement(p.Hue,s({},this.styles().Hue,this.props,{pointer:m.default,onChange:this.handleChange}))),l.default.createElement("div",{style:this.styles().colors},e)))}}]),t}(f.default.Component);_.defaultProps={colors:["#000000","#808080","#FFFFFF","#D33115","#E27300","#FCC400","#B0BC00","#68BC00","#16A5A5","#009CE0","#7B64FF","#FA28FF","#E20F2E"]},t.default=p.ColorWrap(_)},function(t){t.exports=e},function(e,t,n){e.exports={Component:n(5),inline:n(6),mixin:{css:n(6)}}},function(e,t,n){function r(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 o=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),a=function(e,t,n){for(var r=!0;r;){var i=e,o=t,a=n;r=!1,null===i&&(i=Function.prototype);var s=Object.getOwnPropertyDescriptor(i,o);if(void 0!==s){if("value"in s)return s.value;var u=s.get;if(void 0===u)return;return u.call(a)}var c=Object.getPrototypeOf(i);if(null===c)return;e=c,t=o,n=a,r=!0,s=c=void 0}},s=n(3),u=n(6),c=function(e){function t(){r(this,t),a(Object.getPrototypeOf(t.prototype),"constructor",this).apply(this,arguments)}return i(t,e),o(t,[{key:"css",value:function(e){return u.call(this,e)}},{key:"styles",value:function(){return this.css()}}]),t}(s.Component);c.contextTypes={mixins:s.PropTypes.object},e.exports=c},function(e,t,n){var r=n(7),i=n(8),o=n(9);e.exports=function(e){var t=this;o=n(9);var a=[];if(!this.classes)throw console.warn("Define this.classes on `"+this.constructor.name+"`");i(this.classes());var s=function(e,n){t.classes()[e]?a.push(t.classes()[e]):e&&n&&n.warn===!0&&console.warn("The `"+e+"` css class does not exist on `"+t.constructor.name+"`")};s("default");for(var u in this.props){var c=this.props[u];r(c)||(c===!0?(s(u),s(u+"-true")):s(c?u+"-"+c:u+"-false"))}if(this.props&&this.props.activeBounds)for(var l=0;l<this.props.activeBounds.length;l++){var h=this.props.activeBounds[l];s(h)}for(var f in e){var p=e[f];p===!0&&s(f,{warn:!0})}var d={};return this.context&&this.context.mixins&&(d=this.context.mixins),o(a,d)}},function(e){function t(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}e.exports=t},function(e,t,n){var r=n(7);e.exports=function(e){for(var t in e){var n=e[t];if(r(n))for(var i in n){var o=n[i];r(o)||console.warn("Make sure the value of the element `"+t+"` is an object of css. You passed it `"+n+"`")}else console.warn("Make sure the value of `"+t+"` is an object of html elements. You passed it `"+n+"`")}}},function(e,t,n){var r=n(10),i=n(14);e.exports=function(e,t){var n=r(e);return i(n,t)}},function(e,t,n){var r=n(11),i=n(7),o=n(13);e.exports=function(e){return i(e)&&!o(e)?e:1===e.length?e[0]:r.recursive.apply(void 0,e)}},function(e,t,n){(function(e){!function(t){function n(e,t){if("object"!==i(e))return t;for(var r in t)e[r]="object"===i(e[r])&&"object"===i(t[r])?n(e[r],t[r]):t[r];return e}function r(e,t,r){var a=r[0],s=r.length;(e||"object"!==i(a))&&(a={});for(var u=0;s>u;++u){var c=r[u],l=i(c);if("object"===l)for(var h in c){var f=e?o.clone(c[h]):c[h];a[h]=t?n(a[h],f):f}}return a}function i(e){return{}.toString.call(e).slice(8,-1).toLowerCase()}var o=function(e){return r(e===!0,!1,arguments)},a="merge";o.recursive=function(e){return r(e===!0,!0,arguments)},o.clone=function(e){var t,n,r=e,a=i(e);if("array"===a)for(r=[],n=e.length,t=0;n>t;++t)r[t]=o.clone(e[t]);else if("object"===a){r={};for(t in e)r[t]=o.clone(e[t])}return r},t?e.exports=o:window[a]=o}("object"==typeof e&&e&&"object"==typeof e.exports&&e.exports)}).call(t,n(12)(e))},function(e){e.exports=function(e){return e.webpackPolyfill||(e.deprecate=function(){},e.paths=[],e.children=[],e.webpackPolyfill=1),e}},function(e){var t=Array.isArray;e.exports=t},function(e,t,n){var r=n(7),i=n(13),o=n(11),a={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 n=t[e];return n?n:void 0}},s=function u(e,t,n){var s=o(t,a),c={};for(var l in e){var h=e[l];if(r(h)&&!i(h))c[l]=u(h,t,e);else if(s[l]){var f=s[l](h,n);for(var p in f){var d=f[p];c[p]=d}}else c[l]=h}return c};e.exports=function(e,t,n){return s(e,t,n)}},function(e,t,n){function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var i=n(16);Object.defineProperty(t,"Alpha",{enumerable:!0,get:function(){return r(i).default}});var o=n(20);Object.defineProperty(t,"Checkboard",{enumerable:!0,get:function(){return r(o).default}});var a=n(21);Object.defineProperty(t,"Hue",{enumerable:!0,get:function(){return r(a).default}});var s=n(22);Object.defineProperty(t,"Saturation",{enumerable:!0,get:function(){return r(s).default}});var u=n(24);Object.defineProperty(t,"ColorWrap",{enumerable:!0,get:function(){return r(u).default}})},function(e,t,n){function r(e){return e&&e.__esModule?e:{"default":e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(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)}Object.defineProperty(t,"__esModule",{value:!0}),t.Alpha=void 0;var s=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),u=n(3),c=r(u),l=n(4),h=r(l),f=n(17),p=r(f),d=n(20),m=r(d),v=t.Alpha=function(e){function t(){for(var e,n,r,a,s=arguments.length,u=Array(s),c=0;s>c;c++)u[c]=arguments[c];return i(this,t),n=r=o(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(u))),r.shouldComponentUpdate=p.default.bind(r,r,arguments[0],arguments[1]),r.handleChange=function(e,t){!t&&e.preventDefault();var n,i=r.refs.container,o=i.clientWidth,a=(e.pageX||e.touches[0].pageX)-(i.getBoundingClientRect().left+window.pageXOffset);n=0>a?0:a>o?1:Math.round(100*a/o)/100,r.props.a!==n&&r.props.onChange({h:r.props.hsl.h,s:r.props.hsl.s,l:r.props.hsl.l,a:n,source:"rgb"})},r.handleMouseDown=function(e){r.handleChange(e,!0),window.addEventListener("mousemove",r.handleChange),window.addEventListener("mouseup",r.handleMouseUp)},r.handleMouseUp=function(){r.unbindEventListeners()},r.unbindEventListeners=function(){window.removeEventListener("mousemove",r.handleChange),window.removeEventListener("mouseup",r.handleMouseUp)},a=n,o(r,a)}return a(t,e),s(t,[{key:"classes",value:function(){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:100*this.props.rgb.a+"%"},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(){this.unbindEventListeners()}},{key:"render",value:function(){var e=c.default.createElement("div",{style:this.styles().slider});return this.props.pointer&&(e=c.default.createElement(this.props.pointer,this.props)),c.default.createElement("div",{style:this.styles().alpha},c.default.createElement("div",{style:this.styles().checkboard},c.default.createElement(m.default,null)),c.default.createElement("div",{style:this.styles().gradient}),c.default.createElement("div",{style:this.styles().container,ref:"container",onMouseDown:this.handleMouseDown,onTouchMove:this.handleChange,onTouchStart:this.handleChange},c.default.createElement("div",{style:this.styles().pointer,ref:"pointer"},e)))}}]),t}(h.default.Component);t.default=v},function(e,t,n){e.exports=n(18)},function(e,t,n){function r(e,t,n){return!i(e.props,t)||!i(e.state,n)}var i=n(19);e.exports=r},function(e){function t(e,t){if(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=n.bind(t),a=0;a<r.length;a++)if(!o(r[a])||e[r[a]]!==t[r[a]])return!1;return!0}var n=Object.prototype.hasOwnProperty;e.exports=t},function(e,t,n){function r(e){return e&&e.__esModule?e:{"default":e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(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)}function s(e,t,n){if("undefined"==typeof document)return null;var r=document.createElement("canvas");r.width=r.height=2*n;var i=r.getContext("2d");return i?(i.fillStyle=e,i.fillRect(0,0,r.width,r.height),i.fillStyle=t,i.fillRect(0,0,n,n),i.translate(n,n),i.fillRect(0,0,n,n),r.toDataURL()):null}function u(e,t,n){var r=e+","+t+","+n;if(v[r])return v[r];var i=s(e,t,n);return v[r]=i,i}Object.defineProperty(t,"__esModule",{value:!0}),t.Checkboard=void 0;var c=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),l=n(3),h=r(l),f=n(4),p=r(f),d=n(17),m=r(d),v={},g=t.Checkboard=function(e){function t(){for(var e,n,r,a,s=arguments.length,u=Array(s),c=0;s>c;c++)u[c]=arguments[c];return i(this,t),n=r=o(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(u))),r.shouldComponentUpdate=m.default.bind(r,r,arguments[0],arguments[1]),a=n,o(r,a)}return a(t,e),c(t,[{key:"classes",value:function(){var e=u(this.props.white,this.props.grey,this.props.size);return{"default":{grid:{Absolute:"0 0 0 0",background:"url("+e+") center left"}}}}},{key:"render",value:function(){return h.default.createElement("div",{style:this.styles().grid,ref:"grid"})}}]),t}(p.default.Component);g.defaultProps={size:8,white:"#fff",grey:"#e6e6e6"},t.default=g},function(e,t,n){function r(e){return e&&e.__esModule?e:{"default":e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(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)}Object.defineProperty(t,"__esModule",{value:!0}),t.Hue=void 0;var s=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),u=n(3),c=r(u),l=n(4),h=r(l),f=n(17),p=r(f),d=t.Hue=function(e){function t(){for(var e,n,r,a,s=arguments.length,u=Array(s),c=0;s>c;c++)u[c]=arguments[c];return i(this,t),n=r=o(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(u))),r.shouldComponentUpdate=p.default.bind(r,r,arguments[0],arguments[1]),r.handleChange=function(e,t){!t&&e.preventDefault();var n=r.refs.container,i=n.clientWidth,o=n.clientHeight,a=(e.pageX||e.touches&&e.touches[0].pageX||0)-(n.getBoundingClientRect().left+window.pageXOffset),s=(e.pageY||e.touches&&e.touches[0].pageY||0)-(n.getBoundingClientRect().top+window.pageYOffset);if("vertical"===r.props.direction){var u;if(0>s)u=359;else if(s>o)u=0;else{var c=-(100*s/o)+100;u=360*c/100}r.props.hsl.h!==u&&r.props.onChange({h:u,s:r.props.hsl.s,l:r.props.hsl.l,a:r.props.hsl.a,source:"rgb"})}else{var u;if(0>a)u=0;else if(a>i)u=359;else{var c=100*a/i;u=360*c/100}r.props.hsl.h!==u&&r.props.onChange({h:u,s:r.props.hsl.s,l:r.props.hsl.l,a:r.props.hsl.a,source:"rgb"})
}},r.handleMouseDown=function(e){r.handleChange(e,!0),window.addEventListener("mousemove",r.handleChange),window.addEventListener("mouseup",r.handleMouseUp)},r.handleMouseUp=function(){r.unbindEventListeners()},a=n,o(r,a)}return a(t,e),s(t,[{key:"classes",value:function(){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,boxShadow:this.props.shadow},container:{margin:"0 2px",position:"relative",height:"100%"},pointer:{zIndex:"2",position:"absolute",left:100*this.props.hsl.h/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:-(100*this.props.hsl.h/360)+100+"%"}}}}},{key:"componentWillUnmount",value:function(){this.unbindEventListeners()}},{key:"unbindEventListeners",value:function(){window.removeEventListener("mousemove",this.handleChange),window.removeEventListener("mouseup",this.handleMouseUp)}},{key:"render",value:function(){var e=c.default.createElement("div",{style:this.styles().slider});return this.props.pointer&&(e=c.default.createElement(this.props.pointer,this.props)),c.default.createElement("div",{style:this.styles().hue},c.default.createElement("div",{style:this.styles().container,ref:"container",onMouseDown:this.handleMouseDown,onTouchMove:this.handleChange,onTouchStart:this.handleChange},c.default.createElement("div",{style:this.styles().pointer,ref:"pointer"},e)))}}]),t}(h.default.Component);t.default=d},function(e,t,n){function r(e){return e&&e.__esModule?e:{"default":e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(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)}Object.defineProperty(t,"__esModule",{value:!0}),t.Saturation=void 0;var s=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),u=n(3),c=r(u),l=n(4),h=r(l),f=n(23),p=r(f),d=n(17),m=r(d),v=t.Saturation=function(e){function t(){i(this,t);var e=o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return e.shouldComponentUpdate=m.default.bind(e,e,arguments[0],arguments[1]),e.handleChange=function(t,n){!n&&t.preventDefault();var r=e.refs.container,i=r.clientWidth,o=r.clientHeight,a=(t.pageX||t.touches[0].pageX)-(r.getBoundingClientRect().left+window.pageXOffset),s=(t.pageY||t.touches[0].pageY)-(r.getBoundingClientRect().top+window.pageYOffset);0>a?a=0:a>i?a=i:0>s?s=0:s>o&&(s=o);var u=100*a/i,c=-(100*s/o)+100;e.throttle(e.props.onChange,{h:e.props.hsl.h,s:u,v:c,a:e.props.hsl.a,source:"rgb"})},e.handleMouseDown=function(t){e.handleChange(t,!0),window.addEventListener("mousemove",e.handleChange),window.addEventListener("mouseup",e.handleMouseUp)},e.handleMouseUp=function(){e.unbindEventListeners()},e.throttle=p.default(function(e,t){e(t)},50),e}return a(t,e),s(t,[{key:"classes",value:function(){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:-(100*this.props.hsv.v)+100+"%",left:100*this.props.hsv.s+"%",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(){this.unbindEventListeners()}},{key:"unbindEventListeners",value:function(){window.removeEventListener("mousemove",this.handleChange),window.removeEventListener("mouseup",this.handleMouseUp)}},{key:"render",value:function(){var e=c.default.createElement("div",{style:this.styles().circle});return this.props.pointer&&(e=c.default.createElement(this.props.pointer,this.props)),c.default.createElement("div",{style:this.styles().color,ref:"container",onMouseDown:this.handleMouseDown,onTouchMove:this.handleChange,onTouchStart:this.handleChange},c.default.createElement("div",{style:this.styles().white},c.default.createElement("div",{style:this.styles().black}),c.default.createElement("div",{style:this.styles().pointer,ref:"pointer"},e)))}}]),t}(h.default.Component);t.default=v},function(e,t){(function(t){function n(e,t,n){function r(t){var n=m,r=v;return m=v=void 0,E=t,y=e.apply(r,n)}function o(e){return E=e,b=setTimeout(l,t),S?r(e):y}function a(e){var n=e-x,r=e-E,i=t-n;return M?_(i,g-r):i}function c(e){var n=e-x,r=e-E;return void 0===x||n>=t||0>n||M&&r>=g}function l(){var e=C();return c(e)?h(e):(b=setTimeout(l,a(e)),void 0)}function h(e){return b=void 0,T&&m?r(e):(m=v=void 0,y)}function f(){void 0!==b&&clearTimeout(b),E=0,m=x=v=b=void 0}function p(){return void 0===b?y:h(C())}function d(){var e=C(),n=c(e);if(m=arguments,v=this,x=e,n){if(void 0===b)return o(x);if(M)return b=setTimeout(l,t),r(x)}return void 0===b&&(b=setTimeout(l,t)),y}var m,v,g,y,b,x,E=0,S=!1,M=!1,T=!0;if("function"!=typeof e)throw new TypeError(u);return t=s(t)||0,i(n)&&(S=!!n.leading,M="maxWait"in n,g=M?w(s(n.maxWait)||0,t):g,T="trailing"in n?!!n.trailing:T),d.cancel=f,d.flush=p,d}function r(e,t,r){var o=!0,a=!0;if("function"!=typeof e)throw new TypeError(u);return i(r)&&(o="leading"in r?!!r.leading:o,a="trailing"in r?!!r.trailing:a),n(e,t,{leading:o,maxWait:t,trailing:a})}function i(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function o(e){return!!e&&"object"==typeof e}function a(e){return"symbol"==typeof e||o(e)&&x.call(e)==l}function s(e){if("number"==typeof e)return e;if(a(e))return c;if(i(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=i(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(h,"");var n=p.test(e);return n||d.test(e)?m(e.slice(2),n?2:8):f.test(e)?c:+e}var u="Expected a function",c=0/0,l="[object Symbol]",h=/^\s+|\s+$/g,f=/^[-+]0x[0-9a-f]+$/i,p=/^0b[01]+$/i,d=/^0o[0-7]+$/i,m=parseInt,v="object"==typeof t&&t&&t.Object===Object&&t,g="object"==typeof self&&self&&self.Object===Object&&self,y=v||g||Function("return this")(),b=Object.prototype,x=b.toString,w=Math.max,_=Math.min,C=function(){return y.Date.now()};e.exports=r}).call(t,function(){return this}())},function(e,t,n){function r(e){return e&&e.__esModule?e:{"default":e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(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)}Object.defineProperty(t,"__esModule",{value:!0}),t.ColorWrap=void 0;var s=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},u=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),c=n(3),l=r(c),h=n(11),f=r(h),p=n(25),d=(r(p),n(26)),m=r(d),v=n(27),g=r(v),y=n(17),b=r(y),x=t.ColorWrap=function(e){var t=function(t){function n(e){i(this,n);var t=o(this,(n.__proto__||Object.getPrototypeOf(n)).call(this));return t.shouldComponentUpdate=b.default.bind(t,t,arguments[0],arguments[1]),t.handleChange=function(e){if(e=g.default.simpleCheckForValidColor(e)){var n=g.default.toState(e,e.h||t.state.oldHue);t.setState(n),t.props.onChangeComplete&&t.debounce(t.props.onChangeComplete,n),t.props.onChange&&t.props.onChange(n)}},t.state=f.default(g.default.toState(e.color,0),{visible:e.display}),t.debounce=m.default(function(e,t){e(t)},100),t}return a(n,t),u(n,[{key:"componentWillReceiveProps",value:function(e){this.setState(f.default(g.default.toState(e.color,this.state.oldHue),{visible:e.display}))}},{key:"render",value:function(){return l.default.createElement(e,s({},this.props,this.state,{onChange:this.handleChange}))}}]),n}(l.default.Component);return t.defaultProps={color:{h:250,s:.5,l:.2,a:1}},t};t.default=x},function(e){function t(e){var t=!1;if(null!=e&&"function"!=typeof e.toString)try{t=!!(e+"")}catch(n){}return t}function n(e,t){return function(n){return e(t(n))}}function r(e){return!!e&&"object"==typeof e}function i(e){if(!r(e)||h.call(e)!=o||t(e))return!1;var n=f(e);if(null===n)return!0;var i=c.call(n,"constructor")&&n.constructor;return"function"==typeof i&&i instanceof i&&u.call(i)==l}var o="[object Object]",a=Function.prototype,s=Object.prototype,u=a.toString,c=s.hasOwnProperty,l=u.call(Object),h=s.toString,f=n(Object.getPrototypeOf,Object);e.exports=i},function(e,t){(function(t){function n(e,t,n){function i(t){var n=m,r=v;return m=v=void 0,E=t,y=e.apply(r,n)}function o(e){return E=e,b=setTimeout(l,t),S?i(e):y}function u(e){var n=e-C,r=e-E,i=t-n;return M?w(i,g-r):i}function c(e){var n=e-C,r=e-E;return void 0===C||n>=t||0>n||M&&r>=g}function l(){var e=_();return c(e)?h(e):(b=setTimeout(l,u(e)),void 0)}function h(e){return b=void 0,T&&m?i(e):(m=v=void 0,y)}function f(){void 0!==b&&clearTimeout(b),E=0,m=C=v=b=void 0}function p(){return void 0===b?y:h(_())}function d(){var e=_(),n=c(e);if(m=arguments,v=this,C=e,n){if(void 0===b)return o(C);if(M)return b=setTimeout(l,t),i(C)}return void 0===b&&(b=setTimeout(l,t)),y}var m,v,g,y,b,C,E=0,S=!1,M=!1,T=!0;if("function"!=typeof e)throw new TypeError(s);return t=a(t)||0,r(n)&&(S=!!n.leading,M="maxWait"in n,g=M?x(a(n.maxWait)||0,t):g,T="trailing"in n?!!n.trailing:T),d.cancel=f,d.flush=p,d}function r(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function i(e){return!!e&&"object"==typeof e}function o(e){return"symbol"==typeof e||i(e)&&b.call(e)==c}function a(e){if("number"==typeof e)return e;if(o(e))return u;if(r(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=r(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(l,"");var n=f.test(e);return n||p.test(e)?d(e.slice(2),n?2:8):h.test(e)?u:+e}var s="Expected a function",u=0/0,c="[object Symbol]",l=/^\s+|\s+$/g,h=/^[-+]0x[0-9a-f]+$/i,f=/^0b[01]+$/i,p=/^0o[0-7]+$/i,d=parseInt,m="object"==typeof t&&t&&t.Object===Object&&t,v="object"==typeof self&&self&&self.Object===Object&&self,g=m||v||Function("return this")(),y=Object.prototype,b=y.toString,x=Math.max,w=Math.min,_=function(){return g.Date.now()};e.exports=n}).call(t,function(){return this}())},function(e,t,n){function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var i=n(28),o=r(i);t.default={simpleCheckForValidColor:function(e){for(var t=["r","g","b","a","h","s","a","v"],n=0,r=0,i=0;i<t.length;i++){var o=t[i];e[o]&&(n++,isNaN(e[o])||r++)}return n===r?e:void 0},toState:function(e,t){var n=e.hex?o.default(e.hex):o.default(e),r=n.toHsl(),i=n.toHsv();return 0===r.s&&(r.h=t||0,i.h=t||0),{hsl:r,hex:"#"+n.toHex(),rgb:n.toRgb(),hsv:i,oldHue:e.h||t||r.h,source:e.source}},isValidHex:function(e){return o.default(e).isValid()}}},function(e,t,n){var r;!function(){function i(e,t){if(e=e?e:"",t=t||{},e instanceof i)return e;if(!(this instanceof i))return new i(e,t);var n=o(e);this._originalInput=e,this._r=n.r,this._g=n.g,this._b=n.b,this._a=n.a,this._roundA=H(100*this._a)/100,this._format=t.format||n.format,this._gradientType=t.gradientType,this._r<1&&(this._r=H(this._r)),this._g<1&&(this._g=H(this._g)),this._b<1&&(this._b=H(this._b)),this._ok=n.ok,this._tc_id=z++}function o(e){var t={r:0,g:0,b:0},n=1,r=!1,i=!1;return"string"==typeof e&&(e=N(e)),"object"==typeof e&&(e.hasOwnProperty("r")&&e.hasOwnProperty("g")&&e.hasOwnProperty("b")?(t=a(e.r,e.g,e.b),r=!0,i="%"===String(e.r).substr(-1)?"prgb":"rgb"):e.hasOwnProperty("h")&&e.hasOwnProperty("s")&&e.hasOwnProperty("v")?(e.s=B(e.s,1),e.v=B(e.v,1),t=l(e.h,e.s,e.v),r=!0,i="hsv"):e.hasOwnProperty("h")&&e.hasOwnProperty("s")&&e.hasOwnProperty("l")&&(e.s=B(e.s),e.l=B(e.l),t=u(e.h,e.s,e.l),r=!0,i="hsl"),e.hasOwnProperty("a")&&(n=e.a)),n=T(n),{ok:r,format:e.format||i,r:j(255,G(t.r,0)),g:j(255,G(t.g,0)),b:j(255,G(t.b,0)),a:n}}function a(e,t,n){return{r:255*A(e,255),g:255*A(t,255),b:255*A(n,255)}}function s(e,t,n){e=A(e,255),t=A(t,255),n=A(n,255);var r,i,o=G(e,t,n),a=j(e,t,n),s=(o+a)/2;if(o==a)r=i=0;else{var u=o-a;switch(i=s>.5?u/(2-o-a):u/(o+a),o){case e:r=(t-n)/u+(n>t?6:0);break;case t:r=(n-e)/u+2;break;case n:r=(e-t)/u+4}r/=6}return{h:r,s:i,l:s}}function u(e,t,n){function r(e,t,n){return 0>n&&(n+=1),n>1&&(n-=1),1/6>n?e+6*(t-e)*n:.5>n?t:2/3>n?e+(t-e)*(2/3-n)*6:e}var i,o,a;if(e=A(e,360),t=A(t,100),n=A(n,100),0===t)i=o=a=n;else{var s=.5>n?n*(1+t):n+t-n*t,u=2*n-s;i=r(u,s,e+1/3),o=r(u,s,e),a=r(u,s,e-1/3)}return{r:255*i,g:255*o,b:255*a}}function c(e,t,n){e=A(e,255),t=A(t,255),n=A(n,255);var r,i,o=G(e,t,n),a=j(e,t,n),s=o,u=o-a;if(i=0===o?0:u/o,o==a)r=0;else{switch(o){case e:r=(t-n)/u+(n>t?6:0);break;case t:r=(n-e)/u+2;break;case n:r=(e-t)/u+4}r/=6}return{h:r,s:i,v:s}}function l(e,t,n){e=6*A(e,360),t=A(t,100),n=A(n,100);var r=$.floor(e),i=e-r,o=n*(1-t),a=n*(1-i*t),s=n*(1-(1-i)*t),u=r%6,c=[n,a,o,o,s,n][u],l=[s,n,n,a,o,o][u],h=[o,o,s,n,n,a][u];return{r:255*c,g:255*l,b:255*h}}function h(e,t,n,r){var i=[D(H(e).toString(16)),D(H(t).toString(16)),D(H(n).toString(16))];return r&&i[0].charAt(0)==i[0].charAt(1)&&i[1].charAt(0)==i[1].charAt(1)&&i[2].charAt(0)==i[2].charAt(1)?i[0].charAt(0)+i[1].charAt(0)+i[2].charAt(0):i.join("")}function f(e,t,n,r){var i=[D(V(r)),D(H(e).toString(16)),D(H(t).toString(16)),D(H(n).toString(16))];return i.join("")}function p(e,t){t=0===t?0:t||10;var n=i(e).toHsl();return n.s-=t/100,n.s=P(n.s),i(n)}function d(e,t){t=0===t?0:t||10;var n=i(e).toHsl();return n.s+=t/100,n.s=P(n.s),i(n)}function m(e){return i(e).desaturate(100)}function v(e,t){t=0===t?0:t||10;var n=i(e).toHsl();return n.l+=t/100,n.l=P(n.l),i(n)}function g(e,t){t=0===t?0:t||10;var n=i(e).toRgb();return n.r=G(0,j(255,n.r-H(255*-(t/100)))),n.g=G(0,j(255,n.g-H(255*-(t/100)))),n.b=G(0,j(255,n.b-H(255*-(t/100)))),i(n)}function y(e,t){t=0===t?0:t||10;var n=i(e).toHsl();return n.l-=t/100,n.l=P(n.l),i(n)}function b(e,t){var n=i(e).toHsl(),r=(H(n.h)+t)%360;return n.h=0>r?360+r:r,i(n)}function x(e){var t=i(e).toHsl();return t.h=(t.h+180)%360,i(t)}function w(e){var t=i(e).toHsl(),n=t.h;return[i(e),i({h:(n+120)%360,s:t.s,l:t.l}),i({h:(n+240)%360,s:t.s,l:t.l})]}function _(e){var t=i(e).toHsl(),n=t.h;return[i(e),i({h:(n+90)%360,s:t.s,l:t.l}),i({h:(n+180)%360,s:t.s,l:t.l}),i({h:(n+270)%360,s:t.s,l:t.l})]}function C(e){var t=i(e).toHsl(),n=t.h;return[i(e),i({h:(n+72)%360,s:t.s,l:t.l}),i({h:(n+216)%360,s:t.s,l:t.l})]}function E(e,t,n){t=t||6,n=n||30;var r=i(e).toHsl(),o=360/n,a=[i(e)];for(r.h=(r.h-(o*t>>1)+720)%360;--t;)r.h=(r.h+o)%360,a.push(i(r));return a}function S(e,t){t=t||6;for(var n=i(e).toHsv(),r=n.h,o=n.s,a=n.v,s=[],u=1/t;t--;)s.push(i({h:r,s:o,v:a})),a=(a+u)%1;return s}function M(e){var t={};for(var n in e)e.hasOwnProperty(n)&&(t[e[n]]=n);return t}function T(e){return e=parseFloat(e),(isNaN(e)||0>e||e>1)&&(e=1),e}function A(e,t){R(e)&&(e="100%");var n=I(e);return e=j(t,G(0,parseFloat(e))),n&&(e=parseInt(e*t,10)/100),$.abs(e-t)<1e-6?1:e%t/parseFloat(t)}function P(e){return j(1,G(0,e))}function k(e){return parseInt(e,16)}function R(e){return"string"==typeof e&&-1!=e.indexOf(".")&&1===parseFloat(e)}function I(e){return"string"==typeof e&&-1!=e.indexOf("%")}function D(e){return 1==e.length?"0"+e:""+e}function B(e,t){return t=t||100,1>=e&&(e=e*t+"%"),e}function V(e){return Math.round(255*parseFloat(e)).toString(16)}function L(e){return k(e)/255}function N(e){e=e.replace(F,"").replace(U,"").toLowerCase();var t=!1;if(q[e])e=q[e],t=!0;else if("transparent"==e)return{r:0,g:0,b:0,a:0,format:"name"};var n;return(n=Y.rgb.exec(e))?{r:n[1],g:n[2],b:n[3]}:(n=Y.rgba.exec(e))?{r:n[1],g:n[2],b:n[3],a:n[4]}:(n=Y.hsl.exec(e))?{h:n[1],s:n[2],l:n[3]}:(n=Y.hsla.exec(e))?{h:n[1],s:n[2],l:n[3],a:n[4]}:(n=Y.hsv.exec(e))?{h:n[1],s:n[2],v:n[3]}:(n=Y.hsva.exec(e))?{h:n[1],s:n[2],v:n[3],a:n[4]}:(n=Y.hex8.exec(e))?{a:L(n[1]),r:k(n[2]),g:k(n[3]),b:k(n[4]),format:t?"name":"hex8"}:(n=Y.hex6.exec(e))?{r:k(n[1]),g:k(n[2]),b:k(n[3]),format:t?"name":"hex"}:(n=Y.hex3.exec(e))?{r:k(n[1]+""+n[1]),g:k(n[2]+""+n[2]),b:k(n[3]+""+n[3]),format:t?"name":"hex"}:!1}function O(e){var t,n;return e=e||{level:"AA",size:"small"},t=(e.level||"AA").toUpperCase(),n=(e.size||"small").toLowerCase(),"AA"!==t&&"AAA"!==t&&(t="AA"),"small"!==n&&"large"!==n&&(n="small"),{level:t,size:n}}var F=/^[\s,#]+/,U=/\s+$/,z=0,$=Math,H=$.round,j=$.min,G=$.max,W=$.random;i.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(299*e.r+587*e.g+114*e.b)/1e3},getLuminance:function(){var e,t,n,r,i,o,a=this.toRgb();return e=a.r/255,t=a.g/255,n=a.b/255,r=.03928>=e?e/12.92:Math.pow((e+.055)/1.055,2.4),i=.03928>=t?t/12.92:Math.pow((t+.055)/1.055,2.4),o=.03928>=n?n/12.92:Math.pow((n+.055)/1.055,2.4),.2126*r+.7152*i+.0722*o},setAlpha:function(e){return this._a=T(e),this._roundA=H(100*this._a)/100,this},toHsv:function(){var e=c(this._r,this._g,this._b);return{h:360*e.h,s:e.s,v:e.v,a:this._a}},toHsvString:function(){var e=c(this._r,this._g,this._b),t=H(360*e.h),n=H(100*e.s),r=H(100*e.v);return 1==this._a?"hsv("+t+", "+n+"%, "+r+"%)":"hsva("+t+", "+n+"%, "+r+"%, "+this._roundA+")"},toHsl:function(){var e=s(this._r,this._g,this._b);return{h:360*e.h,s:e.s,l:e.l,a:this._a}},toHslString:function(){var e=s(this._r,this._g,this._b),t=H(360*e.h),n=H(100*e.s),r=H(100*e.l);return 1==this._a?"hsl("+t+", "+n+"%, "+r+"%)":"hsla("+t+", "+n+"%, "+r+"%, "+this._roundA+")"},toHex:function(e){return h(this._r,this._g,this._b,e)},toHexString:function(e){return"#"+this.toHex(e)},toHex8:function(){return f(this._r,this._g,this._b,this._a)},toHex8String:function(){return"#"+this.toHex8()},toRgb:function(){return{r:H(this._r),g:H(this._g),b:H(this._b),a:this._a}},toRgbString:function(){return 1==this._a?"rgb("+H(this._r)+", "+H(this._g)+", "+H(this._b)+")":"rgba("+H(this._r)+", "+H(this._g)+", "+H(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:H(100*A(this._r,255))+"%",g:H(100*A(this._g,255))+"%",b:H(100*A(this._b,255))+"%",a:this._a}},toPercentageRgbString:function(){return 1==this._a?"rgb("+H(100*A(this._r,255))+"%, "+H(100*A(this._g,255))+"%, "+H(100*A(this._b,255))+"%)":"rgba("+H(100*A(this._r,255))+"%, "+H(100*A(this._g,255))+"%, "+H(100*A(this._b,255))+"%, "+this._roundA+")"},toName:function(){return 0===this._a?"transparent":this._a<1?!1:X[h(this._r,this._g,this._b,!0)]||!1},toFilter:function(e){var t="#"+f(this._r,this._g,this._b,this._a),n=t,r=this._gradientType?"GradientType = 1, ":"";if(e){var o=i(e);n=o.toHex8String()}return"progid:DXImageTransform.Microsoft.gradient("+r+"startColorstr="+t+",endColorstr="+n+")"},toString:function(e){var t=!!e;e=e||this._format;var n=!1,r=this._a<1&&this._a>=0,i=!t&&r&&("hex"===e||"hex6"===e||"hex3"===e||"name"===e);return i?"name"===e&&0===this._a?this.toName():this.toRgbString():("rgb"===e&&(n=this.toRgbString()),"prgb"===e&&(n=this.toPercentageRgbString()),("hex"===e||"hex6"===e)&&(n=this.toHexString()),"hex3"===e&&(n=this.toHexString(!0)),"hex8"===e&&(n=this.toHex8String()),"name"===e&&(n=this.toName()),"hsl"===e&&(n=this.toHslString()),"hsv"===e&&(n=this.toHsvString()),n||this.toHexString())},_applyModification:function(e,t){var n=e.apply(null,[this].concat([].slice.call(t)));return this._r=n._r,this._g=n._g,this._b=n._b,this.setAlpha(n._a),this},lighten:function(){return this._applyModification(v,arguments)},brighten:function(){return this._applyModification(g,arguments)},darken:function(){return this._applyModification(y,arguments)},desaturate:function(){return this._applyModification(p,arguments)},saturate:function(){return this._applyModification(d,arguments)},greyscale:function(){return this._applyModification(m,arguments)},spin:function(){return this._applyModification(b,arguments)},_applyCombination:function(e,t){return e.apply(null,[this].concat([].slice.call(t)))},analogous:function(){return this._applyCombination(E,arguments)},complement:function(){return this._applyCombination(x,arguments)},monochromatic:function(){return this._applyCombination(S,arguments)},splitcomplement:function(){return this._applyCombination(C,arguments)},triad:function(){return this._applyCombination(w,arguments)},tetrad:function(){return this._applyCombination(_,arguments)}},i.fromRatio=function(e,t){if("object"==typeof e){var n={};for(var r in e)e.hasOwnProperty(r)&&(n[r]="a"===r?e[r]:B(e[r]));e=n}return i(e,t)},i.equals=function(e,t){return e&&t?i(e).toRgbString()==i(t).toRgbString():!1},i.random=function(){return i.fromRatio({r:W(),g:W(),b:W()})},i.mix=function(e,t,n){n=0===n?0:n||50;var r,o=i(e).toRgb(),a=i(t).toRgb(),s=n/100,u=2*s-1,c=a.a-o.a;r=u*c==-1?u:(u+c)/(1+u*c),r=(r+1)/2;var l=1-r,h={r:a.r*r+o.r*l,g:a.g*r+o.g*l,b:a.b*r+o.b*l,a:a.a*s+o.a*(1-s)};return i(h)},i.readability=function(e,t){var n=i(e),r=i(t);return(Math.max(n.getLuminance(),r.getLuminance())+.05)/(Math.min(n.getLuminance(),r.getLuminance())+.05)},i.isReadable=function(e,t,n){var r,o,a=i.readability(e,t);switch(o=!1,r=O(n),r.level+r.size){case"AAsmall":case"AAAlarge":o=a>=4.5;break;case"AAlarge":o=a>=3;break;case"AAAsmall":o=a>=7}return o},i.mostReadable=function(e,t,n){var r,o,a,s,u=null,c=0;n=n||{},o=n.includeFallbackColors,a=n.level,s=n.size;for(var l=0;l<t.length;l++)r=i.readability(e,t[l]),r>c&&(c=r,u=i(t[l]));return i.isReadable(e,u,{level:a,size:s})||!o?u:(n.includeFallbackColors=!1,i.mostReadable(e,["#fff","#000"],n))};var q=i.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:"90ee90",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"},X=i.hexNames=M(q),Y=function(){var e="[-\\+]?\\d+%?",t="[-\\+]?\\d*\\.\\d+%?",n="(?:"+t+")|(?:"+e+")",r="[\\s|\\(]+("+n+")[,|\\s]+("+n+")[,|\\s]+("+n+")\\s*\\)?",i="[\\s|\\(]+("+n+")[,|\\s]+("+n+")[,|\\s]+("+n+")[,|\\s]+("+n+")\\s*\\)?";return{rgb:new RegExp("rgb"+r),rgba:new RegExp("rgba"+i),hsl:new RegExp("hsl"+r),hsla:new RegExp("hsla"+i),hsv:new RegExp("hsv"+r),hsva:new RegExp("hsva"+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})$/}}();"undefined"!=typeof e&&e.exports?e.exports=i:(r=function(){return i}.call(t,n,t,e),!(void 0!==r&&(e.exports=r)))}()},function(e,t,n){function r(e){return e&&e.__esModule?e:{"default":e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(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)}Object.defineProperty(t,"__esModule",{value:!0}),t.ChromePointer=void 0;var s=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),u=n(3),c=r(u),l=n(4),h=r(l),f=n(17),p=r(f),d=t.ChromePointer=function(e){function t(){for(var e,n,r,a,s=arguments.length,u=Array(s),c=0;s>c;c++)u[c]=arguments[c];return i(this,t),n=r=o(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(u))),r.shouldComponentUpdate=p.default.bind(r,r,arguments[0],arguments[1]),a=n,o(r,a)}return a(t,e),s(t,[{key:"classes",value:function(){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(){return c.default.createElement("div",{style:this.styles().picker})}}]),t}(h.default.Component);t.default=d},function(e,t,n){function r(e){return e&&e.__esModule?e:{"default":e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(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)}Object.defineProperty(t,"__esModule",{value:!0}),t.ChromePointerCircle=void 0;var s=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),u=n(3),c=r(u),l=n(4),h=r(l),f=n(17),p=r(f),d=t.ChromePointerCircle=function(e){function t(){for(var e,n,r,a,s=arguments.length,u=Array(s),c=0;s>c;c++)u[c]=arguments[c];return i(this,t),n=r=o(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(u))),r.shouldComponentUpdate=p.default.bind(r,r,arguments[0],arguments[1]),a=n,o(r,a)}return a(t,e),s(t,[{key:"classes",value:function(){return{"default":{picker:{width:"12px",height:"12px",borderRadius:"6px",boxShadow:"inset 0 0 0 1px #fff",transform:"translate(-6px, -6px)"}}}}},{key:"render",value:function(){return c.default.createElement("div",{style:this.styles().picker})}}]),t}(h.default.Component);t.default=d},function(e,t,n){function r(e){return e&&e.__esModule?e:{"default":e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(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)}Object.defineProperty(t,"__esModule",{value:!0}),t.CompactColor=void 0;var s=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),u=n(3),c=r(u),l=n(4),h=r(l),f=n(17),p=r(f),d=t.CompactColor=function(e){function t(){for(var e,n,r,a,s=arguments.length,u=Array(s),c=0;s>c;c++)u[c]=arguments[c];return i(this,t),n=r=o(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(u))),r.shouldComponentUpdate=p.default.bind(r,r,arguments[0],arguments[1]),r.handleClick=function(){r.props.onClick({hex:r.props.color})},a=n,o(r,a)}return a(t,e),s(t,[{key:"classes",value:function(){return{"default":{color:{background:this.props.color,height:"15px",cursor:"pointer",flexGrow:"1"}}}}},{key:"render",value:function(){return c.default.createElement("div",{style:this.styles().color,ref:"color",onClick:this.handleClick})}}]),t}(h.default.Component);t.default=d}]);var d;!function(){var t={},n={};!function(r){if("object"==typeof t&&"undefined"!=typeof n)n.exports=r(e);else if("function"==typeof define&&define.amd)define(["react"],r);else{var i;i="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,i.ReactDOM=r(i.React)}}(function(e){return e.__SECRET_DOM_DO_NOT_USE_OR_YOU_WILL_BE_FIRED}),d=n.exports}();var a,c=this&&this.__extends||function(e,t){function n(){this.constructor=e}for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r]);e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)},m=this&&this.__assign||Object.assign||function(e){for(var t,n=1,r=arguments.length;r>n;n++){t=arguments[n];
for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])}return e};!function(e){var t;!function(e){e.VERSION={number:"1.2.10",date:"Dec 13 2016"}}(t=e.Plugin||(e.Plugin={}))}(a||(a={}));var a;!function(t){var n;!function(t){t.React=e,t.ReactDOM=d;var n;!function(){}(n=t.Controls||(t.Controls={})),n.ChromePickerHelper=p.ChromePicker}(n=t.Plugin||(t.Plugin={}))}(a||(a={}));var a;!function(e){var t;!function(t){var n;!function(n){function r(e){return 13===e.keyCode||13===e.charCode?!0:!1}function i(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(n.TextBox,{placeholder:e.placeholder,onChange:e.onChange,value:e.value,onKeyPress:function(t){r(t)&&e.onEnter&&e.onEnter.call(null,t)}})))}var o=e.Bootstrap.Utils.shallowEqual,a=function(e){function t(){return e.apply(this,arguments)||this}return c(t,e),t.prototype.shouldComponentUpdate=function(e,t){return!o(this.props,e)||!o(this.state,t)},t}(t.React.Component);n.Pure=a;var s=function(e){function n(){return e.apply(this,arguments)||this}return c(n,e),n.prototype.render=function(){var e=this.props,n="lm-btn";e.size&&"normal"!==e.size&&(n+=" lm-btn-"+e.size),e.asBlock&&(n+=" lm-btn-block"),n+=e.disabled?" lm-btn-"+(e.disabledStyle||e.style||"default"):e.active?" lm-btn-"+(e.activeStyle||e.style||"default"):" lm-btn-"+(e.style||"default"),e.customClass&&(n+=" "+e.customClass);var r=void 0;return e.icon&&(r=e.active&&e.activeIcon?t.React.createElement("span",{className:"lm-icon lm-icon-"+e.activeIcon}):t.React.createElement("span",{className:"lm-icon lm-icon-"+e.icon})),t.React.createElement("button",{title:e.title,className:n,style:e.customStyle,disabled:e.disabled,onClick:function(t){e.onClick.call(null,t),t.target.blur()}},r,e.children)},n}(a);n.Button=s,n.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){e.onBlur&&e.onBlur.call(null,t)},onChange:function(t){return e.onChange.call(null,t.target.value)},onKeyPress:e.onKeyPress})},n.isEnter=r,n.TextBoxGroup=i,n.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))},n.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")))},n.ControlGroupExpander=function(e){return t.React.createElement(n.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"})},n.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))},n.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))}}(n=t.Controls||(t.Controls={}))}(t=e.Plugin||(e.Plugin={}))}(a||(a={}));var a;!function(e){var t;!function(e){var t;!function(t){function n(n){var r=n.caption?n.caption:function(e){return e};return e.React.createElement("div",{className:"lm-control-row lm-options-group",title:n.title},e.React.createElement("span",null,n.label),e.React.createElement("div",null,e.React.createElement(t.OptionsBox,{options:n.options,caption:r,current:n.current,onChange:n.onChange})))}var r=function(t){function n(){var e=t.apply(this,arguments)||this;return e.current=void 0,e}return c(n,t),n.prototype.get=function(e){var t=this.props.options;return"undefined"!=typeof t.get?t.get(e):t[e]},n.prototype.render=function(){var t=this,n=this.props.caption,r=this.props.options.indexOf(this.props.current);return 0>r&&(r=0),e.React.createElement("select",{title:this.props.title,value:r.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,i){return e.React.createElement("option",{key:i,value:""+i,selected:i===r},n(t))}))},n}(e.React.Component);t.OptionsBox=r,t.OptionsGroup=n}(t=e.Controls||(e.Controls={}))}(t=e.Plugin||(e.Plugin={}))}(a||(a={}));var a;!function(e){var t;!function(e){var t;!function(t){var n=function(n){function r(){return n.apply(this,arguments)||this}return c(r,n),r.prototype.header=function(){var n=this,r=this.props.isExpanded,i=this.props.title?this.props.title:this.props.header,o=r?"collapse":"expand",a=e.React.createElement("div",{className:"lm-panel-description lm-panel-description-"+(this.props.topRightAction?"with-action":"standalone"),onClick:function(){return n.props.onExpand.call(null,!n.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"},a,this.props.topRightAction,e.React.createElement("div",{className:"lm-panel-expander-wrapper"},e.React.createElement(t.Button,{title:i,onClick:function(){return n.props.onExpand.call(null,!n.props.isExpanded)},icon:o,customClass:"lm-panel-expander",style:"link"},this.props.badge,this.props.header)))},r.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))},r}(e.React.Component);t.Panel=n,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={}))}(a||(a={}));var a;!function(e){var t;!function(e){var t;!function(t){var n=function(n){function r(){var e=n.apply(this,arguments)||this;return e.state={value:"0"},e.firedValue=0/0,e}return c(r,n),r.prototype.componentWillMount=function(){this.setState({value:""+this.props.value})},r.prototype.componentWillReceiveProps=function(e){this.setState({value:""+e.value})},r.prototype.componentDidMount=function(){var e=this.refs.slider;e.value!==this.state.value&&(e.value=this.state.value)},r.prototype.updateValue=function(e){var t=+e;t<this.props.min?(t=this.props.min,e=""+t):t>this.props.max&&(t=this.props.max,e=""+t),this.setState({value:e})},r.prototype.fire=function(){var e=+this.state.value;isNaN(e)&&(e=this.props.value),e!==this.props.value&&this.firedValue!==e&&(this.firedValue=e,this.props.onChange.call(null,e))},r.prototype.render=function(){var n=this,r=this.props.step;return void 0===r&&(r=1),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("form",{noValidate:!0},e.React.createElement("input",{type:"range",min:this.props.min,max:this.props.max,value:this.state.value,ref:"slider",step:r,onInput:function(e){var t=e.target.value;n.setState({value:t})},onSelect:function(e){n.fire(),e.target.blur()},onBlur:function(){return n.fire()},onTouchEnd:function(){return n.fire()}})))),e.React.createElement("div",null,e.React.createElement(t.TextBox,{value:this.state.value,onChange:function(e){return n.updateValue(e)},onBlur:function(){return n.fire()},onKeyPress:function(e){t.isEnter(e)&&n.fire()}}))))},r}(e.React.Component);t.Slider=n}(t=e.Controls||(e.Controls={}))}(t=e.Plugin||(e.Plugin={}))}(a||(a={}));var a;!function(e){var t;!function(t){var n;!function(n){var r=e.Bootstrap.Utils.shallowEqual,i=function(e){function i(){return e.apply(this,arguments)||this}return c(i,e),i.prototype.shouldComponentUpdate=function(e){return!r(this.props,e)},i.prototype.render=function(){var e=this,r=this.props.color,i=r.r,o=void 0===i?1:i,a=r.g,s=void 0===a?1:a,u=r.b,c=void 0===u?1:u,l={a:1,r:255*o,g:255*s,b:255*c},h=function(t){return e.props.onChange({r:t.rgb.r/255,g:t.rgb.g/255,b:t.rgb.b/255})},f=t.React.createElement(n.ChromePickerHelper,{color:l,onChangeComplete:h});return t.React.createElement("div",{className:"lm-color-picker"},f)},i}(t.React.Component);n.ColorPicker=i;var o=function(e){function r(){var t=e.apply(this,arguments)||this;return t.state={isExpanded:!1},t}return c(r,e),r.prototype.render=function(){var e=this,r=this.state.isExpanded?t.React.createElement(i,m({},this.props)):void 0,o=this.props.color,a=this.props.position?this.props.position:"above";return t.React.createElement("div",{className:"lm-control-row lm-toggle-color-picker lm-toggle-color-picker-"+a,onMouseLeave:function(){return e.setState({isExpanded:!1})}},t.React.createElement("span",null,this.props.label),t.React.createElement("div",null,t.React.createElement(n.Button,{onClick:function(){e.setState({isExpanded:!e.state.isExpanded})},asBlock:!0,customStyle:{backgroundColor:"rgb("+(255*o.r|0)+", "+(255*o.g|0)+", "+(255*o.b|0)+")",color:"rgb("+(255*(1-o.r)|0)+","+(255*(1-o.g)|0)+","+(255*(1-o.b)|0)+")"}})),r)},r}(t.React.Component);n.ToggleColorPicker=o}(n=t.Controls||(t.Controls={}))}(t=e.Plugin||(e.Plugin={}))}(a||(a={}));var a;!function(e){var t;!function(e){var t;!function(t){function n(n){return e.React.createElement("div",{className:"lm-control-row"},e.React.createElement(t.TextBox,{placeholder:"Enter query...",onChange:n.onChange,value:n.value,onKeyPress:function(e){t.isEnter(e)&&n.onEnter&&n.onEnter.call(null,e)}}))}t.QueryEditor=n}(t=e.Controls||(e.Controls={}))}(t=e.Plugin||(e.Plugin={}))}(a||(a={}));var a;!function(e){var t;!function(t){var n;!function(n){var r=e.Bootstrap.Utils.shallowEqual,i=function(t){function n(){return t.apply(this,arguments)||this}return c(n,t),n.prototype.update=function(t){var n=e.Bootstrap.Utils.merge(this.props.state,t);n!==this.props.state&&this.props.onChange(n)},n.prototype.shouldComponentUpdate=function(e,t){return!r(this.props,e)||!r(this.state,t)},n}(t.React.Component);n.PureView=i;var o=function(e){function t(){var t=e.apply(this,arguments)||this;return t.subs=[],t}return c(t,e),t.prototype.subscribe=function(e,t){var n=e.subscribe(t);return this.subs.push(n),n},t.prototype.unsubscribe=function(e){for(var t=this.subs.indexOf(e),n=t;n<this.subs.length-1;n++)this.subs[n]=this.subs[n+1];e.dispose(),this.subs.pop()},t.prototype.componentWillUnmount=function(){for(var e=0,t=this.subs;e<t.length;e++){var n=t[e];n.dispose()}this.subs=[]},t}(t.React.Component);n.Component=o;var a=function(e){function t(){var t=e.apply(this,arguments)||this;return t.subs=[],t}return c(t,e),t.prototype.subscribe=function(e,t){var n=e.subscribe(t);return this.subs.push(n),n},t.prototype.unsubscribe=function(e){for(var t=this.subs.indexOf(e),n=t;n<this.subs.length-1;n++)this.subs[n]=this.subs[n+1];e.dispose(),this.subs.pop()},t.prototype.componentWillUnmount=function(){for(var e=0,t=this.subs;e<t.length;e++){var n=t[e];n.dispose()}this.subs=[]},t}(t.React.Component);n.ObserverView=a;var s=function(e){function t(){return e.apply(this,arguments)||this}return c(t,e),Object.defineProperty(t.prototype,"controller",{get:function(){return this.props.controller},enumerable:!0,configurable:!0}),t.prototype.componentWillMount=function(){var e=this;this.subscribe(this.controller.state,function(){e.forceUpdate()})},t}(a);n.View=s}(n=t.Views||(t.Views={}))}(t=e.Plugin||(e.Plugin={}))}(a||(a={}));var a;!function(e){var t;!function(t){var n;!function(n){var r=e.Bootstrap.Components.LayoutRegion,i=function(n){function i(){return n.apply(this,arguments)||this}return c(i,n),i.prototype.renderTarget=function(e){for(var n=[],r=[],i=0,o=e.components;i<o.length;i++){var a=o[i];a.isStatic?n.push(t.React.createElement(a.view,{controller:a.controller})):r.push(t.React.createElement(a.view,{controller:a.controller}))}return t.React.createElement("div",{className:"lm-layout-region lm-layout-"+e.cssClass},n.length?t.React.createElement("div",{className:"lm-layout-static"},n):void 0,r.length?t.React.createElement("div",{className:"lm-layout-scrollable"},r):void 0)},i.prototype.render=function(){var n,i="",o=this.controller.latestState;if(o.isExpanded)n="lm-layout-expanded";else switch(n="lm-layout-standard ",o.collapsedControlsLayout){case e.Bootstrap.Components.CollapsedControlsLayout.Outside:n+="lm-layout-standard-outside";break;case e.Bootstrap.Components.CollapsedControlsLayout.Landscape:n+="lm-layout-standard-landscape";break;case e.Bootstrap.Components.CollapsedControlsLayout.Portrait:n+="lm-layout-standard-portrait";break;default:n+="lm-layout-standard-outside"}var a=this.controller.targets,s=[this.renderTarget(a[r.Main])],u=o.hiddenRegions||[],c=a[r.Top];o.hideControls||!c.components.length||u.indexOf(r.Top)>=0?i+=" lm-layout-hide-top":s.push(this.renderTarget(c)),c=a[r.Right],o.hideControls||!c.components.length||u.indexOf(r.Right)>=0?i+=" lm-layout-hide-right":s.push(this.renderTarget(c)),c=a[r.Bottom],o.hideControls||!c.components.length||u.indexOf(r.Bottom)>=0?i+=" lm-layout-hide-bottom":s.push(this.renderTarget(c)),c=a[r.Left],o.hideControls||!c.components.length||u.indexOf(r.Left)>=0?i+=" lm-layout-hide-left":s.push(this.renderTarget(c));var l=a[r.Root].components.map(function(e){return t.React.createElement(e.view,{controller:e.controller})});return t.React.createElement("div",{className:"lm-plugin"},t.React.createElement("div",{className:"lm-plugin-content "+n},t.React.createElement("div",{className:i},s,l)))},i}(n.View);n.Layout=i}(n=t.Views||(t.Views={}))}(t=e.Plugin||(e.Plugin={}))}(a||(a={}));var a;!function(e){var t;!function(t){var n;!function(n){var r;!function(r){var i=function(e){function r(){return e.apply(this,arguments)||this}return c(r,e),Object.defineProperty(r.prototype,"params",{get:function(){return this.controller.latestState.params},enumerable:!0,configurable:!0}),r.prototype.updateParams=function(e){this.controller.updateParams(e)},r.prototype.autoUpdateParams=function(e){this.controller.autoUpdateParams(e)},r.prototype.getPersistentState=function(e,t){return this.controller.context.transforms.getPersistentState(this.controller.transformer,this.transformSourceEntity,e,t)},r.prototype.setPersistentState=function(e,t){this.controller.context.transforms.setPersistentState(this.controller.transformer,this.transformSourceEntity,e,t)&&this.forceUpdate()},Object.defineProperty(r.prototype,"transformSourceEntity",{get:function(){return this.isUpdate?this.controller.entity.parent:this.controller.entity},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"isUpdate",{get:function(){return this.controller.isUpdate},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"canApply",{get:function(){var e=this.controller.latestState,t=e.canApply&&(!this.isUpdate||e.isDirty)&&!e.isBusy;return t&&this.isUpdate&&e.parametersAutoUpdating?!1:t},enumerable:!0,configurable:!0}),r.prototype.applyEnter=function(e){this.canApply&&(e.target.blur(),this.controller.apply())},r.prototype.render=function(){var e=this,r=(this.controller.context,this.isUpdate),i=this.controller.latestState,o=i.issues,a=o&&o.length,s=i.isBusy,u=s?"Working...":r&&!a?"Nothing to update":o?o[0]:void 0,c=this.controller.transformer.info,l=t.React.createElement(t.Controls.CommitButton,{action:function(){return e.controller.apply()},isOn:this.canApply,title:o&&o.length?o[0]:this.canApply?r?"An update will remove all child nodes.":void 0:void 0,on:r?"Update":this.props.isAction?"Apply":"Add",off:u}),h=this.canApply||a,f=this.props.customHeader?this.props.customHeader:(r?"Update ":"")+c.name,p=this.getPersistentState("isExpanded",!0);return t.React.createElement("div",{className:"lm-transformer-wrapper"},t.React.createElement(t.Controls.Panel,{header:f,badge:this.props.hideBadge?void 0:t.React.createElement(n.Entity.Badge,{type:c.to[0].info}),className:"lm-control lm-transformer lm-panel-"+c.to[0].info.typeClass,key:c.id,title:c.description,isExpanded:p,onExpand:function(t){e.setPersistentState("isExpanded",t)},description:this.controller.transformer.info.description,topRightAction:this.props.showVisibilityIcon?t.React.createElement(n.Entity.VisibilityControl,{entity:this.controller.entity}):void 0},this.renderControls(),h?l:void 0))},r}(n.View);r.ControllerBase=i;var o=function(e){function n(){return e.apply(this,arguments)||this}return c(n,e),n.prototype.renderControls=function(){return t.React.createElement("div",null)},n}(r.ControllerBase);r.Empty=o;var a=function(e){function n(){return e.apply(this,arguments)||this}return c(n,e),n.prototype.render=function(){var e=this.controller.context,n=e.plugin,r=this.controller.latestState,i=r.transforms,o=i.map(function(e){var r=n.getTransformerInfo(e.transformer).view;return t.React.createElement(r,{controller:e,key:e.transformer.info.id+"-"+e.entity.id})});if(r.update){var a=n.getTransformerInfo(r.update.transformer).view;o.push(t.React.createElement(a,{controller:r.update,key:r.update.transformer.info.id+"-"+r.update.entity.id}))}return t.React.createElement("div",{className:"lm-transform-view"},o)},n}(n.View);r.View=a,r.TransparencyControl=function(e){var n=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:n})};var s=function(n){function r(){return n.apply(this,arguments)||this}return c(r,n),r.prototype.componentWillMount=function(){var t=this;n.prototype.componentWillMount.call(this),this.subscribe(e.Bootstrap.Event.Tree.NodeUpdated.getStream(this.controller.context),function(e){var n=t.controller.latestState.controller,r=n&&n.entity;e.data===r&&t.forceUpdate()})},r.prototype.render=function(){var e=this.controller.latestState.controller;if(!e)return t.React.createElement("div",{className:"lm-empty-control"});var n=this.controller.context,r=n.plugin,i=r.getTransformerInfo(e.transformer).view;return i?t.React.createElement(i,{controller:e,key:e.transformer.info.id+"-"+e.entity.id,customHeader:this.controller.header,hideBadge:!0,showVisibilityIcon:!0}):(console.warn("Count not find view for updater ("+e.transformer.info.id+"), please register it."),t.React.createElement("div",{className:"lm-empty-control"}))},r}(n.View);r.Updater=s;var u=function(e){function n(){return e.apply(this,arguments)||this}return c(n,e),n.prototype.render=function(){var e=this.controller.latestState.controller;if(!e)return t.React.createElement("div",{className:"lm-empty-control"});var n=this.controller.context,r=n.plugin,i=r.getTransformerInfo(e.transformer).view;return i?t.React.createElement(i,{controller:e,key:e.transformer.info.id+"-"+e.entity.id,customHeader:this.controller.header,hideBadge:!0,isAction:!0}):(console.warn("Count not find view for updater ("+e.transformer.info.id+"), please register it."),t.React.createElement("div",{className:"lm-empty-control"}))},n}(n.View);r.Action=u}(r=n.Transform||(n.Transform={}))}(n=t.Views||(t.Views={}))}(t=e.Plugin||(e.Plugin={}))}(a||(a={}));var a;!function(e){var t;!function(t){var n;!function(n){var r;!function(n){var r;!function(r){var i=function(n){function r(){return n.apply(this,arguments)||this}return c(r,n),r.prototype.renderControls=function(){var n=this,r=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:r.type,onChange:function(t){return n.updateParams({type:t,responseCompression:e.Bootstrap.Utils.DataCompressionMethod.None})},label:"Type"}),"Binary"===r.type?t.React.createElement(t.Controls.OptionsGroup,{options:["None","Gzip"],caption:function(e){return e},current:r.responseCompression===e.Bootstrap.Utils.DataCompressionMethod.Gzip?"Gzip":"None",onChange:function(t){return n.updateParams({responseCompression:"None"===t?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:r.url,onChange:function(e){return n.updateParams({url:e})},label:"URL",onEnter:function(e){return n.applyEnter(e)},placeholder:"Enter URL..."}))},r}(n.ControllerBase);r.Download=i;var o=function(n){function r(){return n.apply(this,arguments)||this}return c(r,n),r.prototype.renderControls=function(){var n=this,r=this.params,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:r.type,onChange:function(e){return n.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"}},r.file?r.file.name:"Select a file..."," ",t.React.createElement("input",{disabled:i.isBusy,type:"file",onChange:function(e){return n.updateParams({file:e.target.files[0]})},multiple:!1})))},r}(n.ControllerBase);r.OpenFile=o;var a=function(e){function n(){return e.apply(this,arguments)||this}return c(n,e),n.prototype.renderControls=function(){var e=this,n=this.params;return t.React.createElement("div",null,t.React.createElement(t.Controls.TextBoxGroup,{value:n.id,onChange:function(t){return e.updateParams({id:t})},label:"Id",onEnter:function(t){return e.applyEnter(t)},placeholder:"Enter PDB id..."}))},n}(n.ControllerBase);r.WithIdField=a;var s=function(e){function n(){return e.apply(this,arguments)||this}return c(n,e),n.prototype.renderControls=function(){var e=this,n=this.params;return t.React.createElement("div",null,t.React.createElement(t.Controls.TextBoxGroup,{value:n.id,onChange:function(t){return e.updateParams({id:t})},label:"URL",onEnter:function(t){return e.applyEnter(t)},placeholder:"Enter URL..."}))},n}(n.ControllerBase);r.WithUrlIdField=s}(r=n.Data||(n.Data={}))}(r=n.Transform||(n.Transform={}))}(n=t.Views||(t.Views={}))}(t=e.Plugin||(e.Plugin={}))}(a||(a={}));var a;!function(e){var t;!function(t){var n;!function(n){var r;!function(n){var r;!function(r){var i=function(n){function r(){return n.apply(this,arguments)||this}return c(r,n),r.prototype.renderControls=function(){var n=this,r=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:r.format,onChange:function(e){return n.updateParams({format:e})},label:"Format"}))},r}(n.ControllerBase);r.CreateFromData=i;var o=function(n){function r(){return n.apply(this,arguments)||this}return c(r,n),r.prototype.renderControls=function(){var n=this,r=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:r.format,onChange:function(e){return n.updateParams({format:e})},label:"Format"}),t.React.createElement(t.Controls.TextBoxGroup,{value:r.id,onChange:function(e){return n.updateParams({id:e})},label:"URL",onEnter:function(e){return n.applyEnter(e)},placeholder:"Enter url..."}))},r}(n.ControllerBase);r.DownloadFromUrl=o;var a=function(n){function r(){return n.apply(this,arguments)||this}return c(r,n),r.prototype.renderControls=function(){var n=this,r=this.params,i=this.controller.latestState,o=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"}},r.file?r.file.name:"Select a file..."," ",t.React.createElement("input",{disabled:i.isBusy,type:"file",accept:o,onChange:function(e){return n.updateParams({file:e.target.files[0]})},multiple:!1})))},r}(n.ControllerBase);r.OpenFile=a;var s=function(e){function n(){return e.apply(this,arguments)||this}return c(n,e),n.prototype.renderControls=function(){var e=this,n=this.params;return t.React.createElement("div",null,t.React.createElement(t.Controls.TextBoxGroup,{value:n.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:n.server,onChange:function(t){return e.updateParams({server:t})},label:"Server",onEnter:function(t){return e.applyEnter(t)},placeholder:"Server url..."}))},n}(n.ControllerBase);r.InitCoordinateStreaming=s;var u=function(e){function n(){return e.apply(this,arguments)||this}return c(n,e),n.prototype.renderControls=function(){var e=this,n=(this.params,this.transformSourceEntity),r=n.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:r,caption:function(e){return e.b},current:r[this.params.blockIndex],onChange:function(t){return e.updateParams({blockIndex:t.i})},label:"Source"}))},n}(n.ControllerBase);r.CreateFromMmCif=u;var l=function(e){function n(){return e.apply(this,arguments)||this}return c(n,e),n.prototype.renderControls=function(){var e=this,n=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:n,step:1,value:(0|this.params.modelIndex)+1,title:"Index of the model."}))},n}(n.ControllerBase);r.CreateModel=l;var h=function(n){function r(){return n.apply(this,arguments)||this}return c(r,n),r.prototype.renderControls=function(){var n=this,r=this.params,i=e.Bootstrap.Utils.Molecule.findModel(this.transformSourceEntity),o=i.props.model.assemblyInfo;if(!o)return void 0;var a=o.assemblies.map(function(e){return e.name});return t.React.createElement("div",null,t.React.createElement(t.Controls.OptionsGroup,{options:a,current:r.name,onChange:function(e){return n.updateParams({name:e})},label:"Name"}))},r}(n.ControllerBase);r.CreateAssembly=h;var f=function(e){function n(){return e.apply(this,arguments)||this}return c(n,e),n.prototype.renderControls=function(){var e=this,n=this.params,r=["Mates","Interaction"];return t.React.createElement("div",null,t.React.createElement(t.Controls.OptionsGroup,{options:r,current:n.type,onChange: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:n.radius,title:"Interaction radius."}))},n}(n.ControllerBase);r.CreateSymmetryMates=f;var p=function(e){function n(){return e.apply(this,arguments)||this}return c(n,e),n.prototype.renderControls=function(){var e=this,n=this.params;return t.React.createElement("div",null,t.React.createElement(t.Controls.TextBoxGroup,{value:n.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:n.queryString,onChange:function(t){return e.updateParams({queryString:t})},onEnter:function(t){return e.applyEnter(t)}}))},n}(n.ControllerBase);r.CreateSelection=p;var d=function(e){function n(){return e.apply(this,arguments)||this}return c(n,e),n.prototype.renderControls=function(){var e=this,n=this.params;return t.React.createElement("div",null,t.React.createElement(t.Controls.Toggle,{onChange:function(t){return e.updateParams({polymer:t})},value:n.polymer,label:"Polymer"}),t.React.createElement(t.Controls.Toggle,{onChange:function(t){return e.updateParams({het:t})},value:n.het,label:"HET"}),t.React.createElement(t.Controls.Toggle,{onChange:function(t){return e.updateParams({water:t})},value:n.water,label:"Water"}))},n}(n.ControllerBase);r.CreateMacromoleculeVisual=d;var m=function(r){function i(){return r.apply(this,arguments)||this}return c(i,r),i.prototype.detail=function(){var n=this,r=this.params.style.params;return[t.React.createElement(t.Controls.OptionsGroup,{options:e.Bootstrap.Visualization.Molecule.DetailTypes,caption:function(e){return e},current:r.detail,onChange:function(e){return n.controller.updateStyleParams({detail:e})},label:"Detail"})]},i.prototype.ballsAndSticks=function(){var n=this,r=this.params.style.params,i=[];return i.push(t.React.createElement(t.Controls.Toggle,{title:"Scale atoms using their VDW radius.",onChange:function(e){return n.controller.updateStyleParams({useVDW:e})},value:r.useVDW,label:"VDW"})),r.useVDW?i.push(t.React.createElement(t.Controls.Slider,{label:"Scale",onChange:function(e){return n.controller.updateStyleParams({vdwScaling:e})},min:.1,max:1,step:.01,value:r.vdwScaling,title:"VDW scale factor."})):i.push(t.React.createElement(t.Controls.Slider,{label:"Atom Rds",onChange:function(e){return n.controller.updateStyleParams({atomRadius:e})},min:.05,max:2,step:.01,value:r.atomRadius,title:"Atom Radius"})),i.push(t.React.createElement(t.Controls.Slider,{label:"Bond Rds",onChange:function(e){return n.controller.updateStyleParams({bondRadius:e})},min:.05,max:1,step:.01,value:r.bondRadius,title:"Bond Radius"})),i.push(t.React.createElement(t.Controls.OptionsGroup,{options:e.Bootstrap.Visualization.Molecule.DetailTypes,caption:function(e){return e},current:r.detail,onChange:function(e){return n.controller.updateStyleParams({detail:e})},label:"Detail"})),i},i.prototype.surface=function(){var e=this,n=this.params.style.params;return[t.React.createElement(t.Controls.Slider,{label:"Probe Radius",onChange:function(t){return e.controller.updateStyleParams({probeRadius:t})},min:0,max:6,step:.1,value:n.probeRadius}),t.React.createElement(t.Controls.Slider,{label:"Smoothing",onChange:function(t){return e.controller.updateStyleParams({smoothing:t})},min:0,max:10,step:1,value:n.smoothing,title:"Number of laplacian smoothing itrations."}),t.React.createElement(t.Controls.Slider,{label:"Detail",onChange:function(t){return e.controller.updateStyleParams({density:t})},min:.3,max:3,step:.1,value:n.density,title:"Determines the size of a grid cell."}),t.React.createElement(t.Controls.Toggle,{onChange:function(t){return e.controller.updateStyleParams({isWireframe:t})},value:n.isWireframe,label:"Wireframe"})]},i.prototype.createColors=function(){var e=this,r=this.params.style.theme,i="BallsAndSticks"===this.params.style.type,o=r.colors.filter(function(e,t){return i?!0:"Bond"!==t}).map(function(n,r){return t.React.createElement(t.Controls.ToggleColorPicker,{key:r,label:r,color:n,onChange:function(t){return e.controller.updateThemeColor(r,t)}})}).toArray();return o.push(t.React.createElement(n.TransparencyControl,{definition:r.transparency,onChange:function(t){return e.controller.updateThemeTransparency(t)
}})),o},i.prototype.renderControls=function(){var n,r=this,i=this.params;switch(i.style.type){case"Surface":n=this.surface();break;case"BallsAndSticks":n=this.ballsAndSticks();break;default:n=this.detail()}var o=function(t){return e.Bootstrap.Visualization.Molecule.TypeDescriptions[t]},a=this.getPersistentState("showTypeOptions",!1),s=this.getPersistentState("showThemeOptions",!1);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 o(e).label},current:i.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:a,onChange:function(e){return r.setPersistentState("showTypeOptions",e)}}),options:n,isExpanded:a}),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:i.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}))},i}(n.ControllerBase);r.CreateVisual=m}(r=n.Molecule||(n.Molecule={}))}(r=n.Transform||(n.Transform={}))}(n=t.Views||(t.Views={}))}(t=e.Plugin||(e.Plugin={}))}(a||(a={}));var a;!function(e){var t;!function(t){var n;!function(n){var r;!function(n){var r;!function(r){function i(e,t,n,r){var i=(t-e.valuesInfo.mean)/e.valuesInfo.sigma;return i>r?r:n>i?n:i}function o(e,t){var n=e.valuesInfo.mean+t*e.valuesInfo.sigma;return n>e.valuesInfo.max?e.valuesInfo.max:n<e.valuesInfo.min?e.valuesInfo.min:n}var a=function(n){return t.React.createElement(t.Controls.ExpandableGroup,{select:t.React.createElement(t.Controls.Slider,{label:n.isSigma?"Iso Value (σ)":"Iso Value",onChange:n.onChangeValue,min:n.min,max:n.max,value:n.value,step:.001}),expander:t.React.createElement(t.Controls.ControlGroupExpander,{isExpanded:n.view.getPersistentState("showIsoValueType",!1),onChange:function(e){return n.view.setPersistentState("showIsoValueType",e)}}),options:[t.React.createElement(t.Controls.Toggle,{onChange:function(t){return n.onChangeType(t?e.Bootstrap.Visualization.Density.IsoValueType.Sigma:e.Bootstrap.Visualization.Density.IsoValueType.Absolute)},value:n.isSigma,label:"Relative (σ)"})],isExpanded:n.view.getPersistentState("showIsoValueType",!1)})},s=function(n){function r(){return n.apply(this,arguments)||this}return c(r,n),r.prototype.renderControls=function(){var n=this,r=this.params,i=r.normalize,o=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:r.format.name}),t.React.createElement(t.Controls.RowText,{label:"Sigma",value:o(a.valuesInfo.sigma,3)}),t.React.createElement(t.Controls.RowText,{label:"Mean",value:o(a.valuesInfo.mean,3)}),t.React.createElement(t.Controls.RowText,{label:"Value Range",value:"["+o(a.valuesInfo.min,3)+", "+o(a.valuesInfo.max,3)+"]"}),t.React.createElement(t.Controls.Toggle,{onChange:function(e){return n.controller.updateParams({normalize:e})},value:i,label:"Normalized"}))}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:r.format,onChange:function(e){return n.updateParams({format:e})},label:"Format"}),t.React.createElement(t.Controls.Toggle,{onChange:function(e){return n.controller.updateParams({normalize:e})},value:i,label:"Normalized"}))},r}(n.ControllerBase);r.ParseData=s;var u=function(r){function s(){return r.apply(this,arguments)||this}return c(s,r),s.prototype.surface=function(){var n=this,r=e.Bootstrap.Tree.Node.findClosestNodeOfType(this.transformSourceEntity,[e.Bootstrap.Entity.Density.Data]),s=this.params.style.params,u=s.isoValueType!==e.Bootstrap.Visualization.Density.IsoValueType.Absolute;return t.React.createElement(a,{view:this,onChangeValue:function(e){return n.controller.updateStyleParams({isoValue:e})},onChangeType:function(t){t!==s.isoValueType&&(t===e.Bootstrap.Visualization.Density.IsoValueType.Absolute?n.controller.updateStyleParams({isoValue:o(r.props.data,s.isoValue),isoValueType:t}):n.controller.updateStyleParams({isoValue:i(r.props.data,s.isoValue,-5,5),isoValueType:t}))},min:u?-5:r.props.data.valuesInfo.min,max:u?5:r.props.data.valuesInfo.max,isSigma:s.isoValueType!==e.Bootstrap.Visualization.Density.IsoValueType.Absolute,value:s.isoValue})},s.prototype.colors=function(){var e=this,r=this.params.style.params,i=this.params.style.theme,o=i.colors.get("Uniform"),a=t.React.createElement(t.Controls.ToggleColorPicker,{key:"Uniform",label:"Color",color:o,onChange:function(t){return e.controller.updateThemeColor("Uniform",t)}}),s=[];s.push(t.React.createElement(n.TransparencyControl,{definition:i.transparency,onChange:function(t){return e.controller.updateThemeTransparency(t)}}));this.params.style.params;s.push(t.React.createElement(t.Controls.Toggle,{onChange:function(t){return e.controller.updateStyleParams({isWireframe:t})},value:r.isWireframe,label:"Wireframe"}));var u=this.getPersistentState("showThemeOptions",!1);return t.React.createElement(t.Controls.ExpandableGroup,{select:a,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(){this.params;return t.React.createElement("div",null,this.surface(),this.colors())},s}(n.ControllerBase);r.CreateVisual=u;var l=function(r){function s(){return r.apply(this,arguments)||this}return c(s,r),s.prototype.surface=function(){var n=this,r=e.Bootstrap.Tree.Node.findClosestNodeOfType(this.transformSourceEntity,[e.Bootstrap.Entity.Density.Data]),s=this.params,u=s.style.params,c=u.isoValueType!==e.Bootstrap.Visualization.Density.IsoValueType.Absolute;return t.React.createElement(a,{view:this,onChangeValue:function(e){return n.controller.updateStyleParams({isoValue:e})},onChangeType:function(t){t!==u.isoValueType&&(t===e.Bootstrap.Visualization.Density.IsoValueType.Absolute?n.controller.updateStyleParams({isoValue:o(r.props.data,u.isoValue),isoValueType:t}):n.controller.updateStyleParams({isoValue:i(r.props.data,u.isoValue,s.isoSigmaMin,s.isoSigmaMax),isoValueType:t}))},min:c?s.isoSigmaMin:r.props.data.valuesInfo.min,max:c?s.isoSigmaMax:r.props.data.valuesInfo.max,isSigma:u.isoValueType!==e.Bootstrap.Visualization.Density.IsoValueType.Absolute,value:u.isoValue})},s.prototype.colors=function(){var e=this,r=this.params.style.params,i=this.params.style.theme,o=i.colors.get("Uniform"),a=t.React.createElement(t.Controls.ToggleColorPicker,{key:"Uniform",label:"Color",color:o,onChange:function(t){return e.controller.updateThemeColor("Uniform",t)}}),s=[];s.push(t.React.createElement(n.TransparencyControl,{definition:i.transparency,onChange:function(t){return e.controller.updateThemeTransparency(t)}}));this.params.style.params;s.push(t.React.createElement(t.Controls.Toggle,{onChange:function(t){return e.controller.updateStyleParams({isWireframe:t})},value:r.isWireframe,label:"Wireframe"}));var u=this.getPersistentState("showThemeOptions",!1);return t.React.createElement(t.Controls.ExpandableGroup,{select:a,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,n="Around Selection",r="Everything",i=this.params;return t.React.createElement(t.Controls.OptionsGroup,{options:[n,r],caption:function(e){return e},current:i.showFull?r:n,onChange:function(t){return e.autoUpdateParams({showFull:t===r})},label:"Show"})},s.prototype.renderControls=function(){var e=this,n=this.params;return t.React.createElement("div",null,this.surface(),this.colors(),this.show(),n.showFull?void 0:t.React.createElement(t.Controls.Slider,{label:"Radius",onChange:function(t){return e.autoUpdateParams({radius:t})},min:void 0!==n.minRadius?n.minRadius:0,max:void 0!==n.maxRadius?n.maxRadius:10,step:.005,value:n.radius}))},s}(n.ControllerBase);r.CreateVisualBehaviour=l}(r=n.Density||(n.Density={}))}(r=n.Transform||(n.Transform={}))}(n=t.Views||(t.Views={}))}(t=e.Plugin||(e.Plugin={}))}(a||(a={}));var a;!function(e){var t;!function(t){var n;!function(n){var r;!function(r){var i=e.Bootstrap.Service.Logger.EntryType,o=function(n){function r(){return n.apply(this,arguments)||this}return c(r,n),r.prototype.componentWillMount=function(){var t=this;n.prototype.componentWillMount.call(this),this.subscribe(e.Bootstrap.Event.Common.LayoutChanged.getStream(this.controller.context),function(){return t.scrollToBottom()})},r.prototype.componentDidUpdate=function(){this.scrollToBottom()},r.prototype.scrollToBottom=function(){var e=this.refs.log;e&&(e.scrollTop=e.scrollHeight-e.clientHeight-1)},r.prototype.render=function(){{var n=this.controller.latestState.entries;n.count()}return t.React.createElement("div",{className:"lm-log-wrap"},t.React.createElement("div",{className:"lm-log",ref:"log"},t.React.createElement("ul",{className:"lm-list-unstyled"},n.map(function(n,r){var o,a=n;switch(a.type){case i.Message:o=t.React.createElement("div",{className:"lm-log-entry"},a.message);break;case i.Error:o=t.React.createElement("div",{className:"lm-log-entry"},t.React.createElement("span",{className:"label label-danger"},"Error")," ",a.message);break;case i.Warning:o=t.React.createElement("div",{className:"lm-log-entry"},t.React.createElement("span",{className:"label label-warning"},"Warning")," ",a.message);break;case i.Info:o=t.React.createElement("div",{className:"lm-log-entry"},t.React.createElement("span",{className:"label label-info"},"Info")," ",a.message)}var s=e.Bootstrap.Utils.formatTime(a.timestamp);return t.React.createElement("li",{key:r},t.React.createElement("div",{className:"lm-log-entry-badge lm-log-entry-"+i[a.type].toLowerCase()}),t.React.createElement("div",{className:"lm-log-timestamp"},s),t.React.createElement("div",{className:"lm-log-entry"},a.message))}))))},r}(n.View);r.Log=o}(r=n.Context||(n.Context={}))}(n=t.Views||(t.Views={}))}(t=e.Plugin||(e.Plugin={}))}(a||(a={}));var a;!function(e){var t;!function(e){var t;!function(t){var n;!function(n){var r=function(t){function n(){return t.apply(this,arguments)||this}return c(n,t),n.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)))},n}(e.React.Component),i=function(t){function n(){return t.apply(this,arguments)||this}return c(n,t),n.prototype.render=function(){var t=this.controller.latestState;if(!t.tasks.count())return e.React.createElement("div",{className:"lm-empty-control"});var n=[];return t.tasks.forEach(function(t,i){return n.push(e.React.createElement(r,{key:i,info:t}))}),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,n))))},n}(t.View);n.Overlay=i;var o=function(t){function n(){return t.apply(this,arguments)||this}return c(n,t),n.prototype.render=function(){var t=this.controller.latestState;if(!t.tasks.count())return e.React.createElement("div",{className:"lm-empty-control"});var n=[];return t.tasks.forEach(function(t,i){return n.push(e.React.createElement(r,{key:i,info:t,isSmall:!0}))}),e.React.createElement("div",{className:"lm-background-tasks"},n)},n}(t.View);n.BackgroundTasks=o}(n=t.Context||(t.Context={}))}(t=e.Views||(e.Views={}))}(t=e.Plugin||(e.Plugin={}))}(a||(a={}));var a;!function(e){var t;!function(e){var t;!function(t){var n;!function(n){var r=function(t){function n(){return t.apply(this,arguments)||this}return c(n,t),n.prototype.hide=function(){var e=this.props.entry;(e.hide||function(){}).call(null)},n.prototype.render=function(){var t=this,n=this.props.entry;return e.React.createElement("div",{className:"lm-toast-entry"},e.React.createElement("div",{className:"lm-toast-title",onClick:function(){return t.hide()}},n.title),e.React.createElement("div",{className:"lm-toast-message"},e.React.createElement("div",{dangerouslySetInnerHTML:{__html:n.message}})),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"})))},n}(e.React.Component),i=function(t){function n(){return t.apply(this,arguments)||this}return c(n,t),n.prototype.render=function(){var t=this.controller.latestState;if(!t.entries.count())return e.React.createElement("div",{className:"lm-empty-control"});var n=[];t.entries.forEach(function(e){return n.push(e)}),n.sort(function(e,t){return e.serialNumber-t.serialNumber});var i=n.map(function(t){return e.React.createElement(r,{key:t.serialNumber,entry:t})});return e.React.createElement("div",{className:"lm-toast-container"},e.React.createElement("div",null,i))},n}(t.View);n.Toast=i}(n=t.Context||(t.Context={}))}(t=e.Views||(e.Views={}))}(t=e.Plugin||(e.Plugin={}))}(a||(a={}));var a;!function(e){var t;!function(t){var n;!function(n){var r;!function(r){e.Bootstrap.Entity;r.VisibilityControl=function(n){var r,i,o=n.entity,a=function(){e.Bootstrap.Command.Entity.SetVisibility.dispatch(o.tree.context,{entity:o,visible:0===o.state.visibility?!1:!0})},s=o.state.visibility;return 0===s?(r="full",i="Hide"):2===s?(r="none",i="Show"):(r="partial",i="Show"),t.React.createElement(t.Controls.Button,{title:i,onClick:a,icon:"visual-visibility",style:"link",customClass:"lm-entity-tree-entry-toggle-visible lm-entity-tree-entry-toggle-visible-"+r})};var i=function(n){function i(){var e=n.apply(this,arguments)||this;return e.renderedVersion=-1,e}return c(i,n),i.prototype.ensureVisible=function(){if(this.ctx.currentEntity===this.props.node){var e=this.refs.root;this.props.tree.scrollIntoView(e)}},i.prototype.componentDidMount=function(){this.ensureVisible()},i.prototype.componentDidUpdate=function(){this.ensureVisible()},Object.defineProperty(i.prototype,"node",{get:function(){return this.props.node},enumerable:!0,configurable:!0}),i.prototype.shouldComponentUpdate=function(){return this.node.version!==this.renderedVersion},i.prototype.componentWillMount=function(){var t=this;this.ctx=this.props.node.tree.context;var n=this.node;this.subscribe(e.Bootstrap.Event.Tree.NodeUpdated.getStream(this.ctx),function(r){r.data===n&&(n.version!==t.renderedVersion&&t.forceUpdate(),t.ctx.currentEntity===n&&t.isFullyBound()&&setTimeout(e.Bootstrap.Command.Entity.SetCurrent.dispatch(t.ctx,n.children[0]),0))})},i.prototype.highlight=function(t){var n=this.node;e.Bootstrap.Command.Entity.Highlight.dispatch(this.ctx,{entities:this.ctx.select(e.Bootstrap.Tree.Selection.byValue(n).subtree()),isOn:t})},i.prototype.row=function(n){var i=this,o=this.props.node,a=(o.state,o.props),s=o.parent===o,u=a.label;return a.description&&(u+=" ("+a.description+")"),t.React.createElement("div",{className:"lm-entity-tree-entry-body"+(this.ctx.currentEntity===o?" lm-entity-tree-entry-current":"")+(this.isOnCurrentPath()?" lm-entity-tree-entry-current-path":""),ref:"root"},t.React.createElement(r.Badge,{type:o.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,o)},customClass:"lm-entity-tree-entry-label",style:"link",title:u},t.React.createElement("span",null,a.label,t.React.createElement("span",{className:"lm-entity-tree-entry-label-tag"},a.description?" "+a.description:void 0)))),!s||n?t.React.createElement(t.Controls.Button,{title:"Remove",onClick:function(){return e.Bootstrap.Command.Tree.RemoveNode.dispatch(o.tree.context,o)},icon:"remove",style:"link",customClass:"lm-entity-tree-entry-remove"}):void 0,s&&!n?void 0:t.React.createElement(r.VisibilityControl,{entity:o}))},i.prototype.renderFlat=function(){for(var e=this.node,n=[],r=0,o=e.children;r<o.length;r++){var a=o[r];n.push(t.React.createElement(i,{key:a.id,node:a,tree:this.props.tree}))}return t.React.createElement("div",{key:e.id},n)},i.prototype.isFullyBound=function(){for(var e=!0,t=0,n=this.node.children;t<n.length;t++){var r=n[t];if(!r.transform.props.isBinding){e=!1;break}}return e&&1===this.node.children.length},i.prototype.isOnCurrentPath=function(){if(!this.ctx.currentEntity)return!1;for(var e=this.ctx.currentEntity.parent,t=this.node;e.parent!==e;){if(e===t)return!0;e=e.parent}return!1},i.prototype.render=function(){var n=this,r=this.node;this.renderedVersion=r.version;var o=r.parent===r;if(this.isFullyBound())return this.renderFlat();for(var a=r.state,s=(r.props,0),u=[],c=0,l=r.children;c<l.length;c++){var h=l[c];h.isHidden||(o||u.push(t.React.createElement(i,{key:h.id,node:h,tree:this.props.tree})),s++)}var f;u.length?f=a.isCollapsed?t.React.createElement(t.Controls.Button,{style:"link",title:"Expand",onClick:function(){return e.Bootstrap.Command.Entity.ToggleExpanded.dispatch(n.ctx,r)},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(n.ctx,r)},icon:"collapse",customClass:"lm-entity-tree-entry-toggle-group"}):0===r.state.visibility&&r.type.traits.isFocusable&&(f=t.React.createElement(t.Controls.Button,{style:"link",icon:"focus-on-visual",title:"Focus",onClick:function(){return e.Bootstrap.Command.Entity.Focus.dispatch(n.ctx,n.ctx.select(r))},customClass:"lm-entity-tree-entry-toggle-group"}));var p=t.React.createElement("div",{className:"lm-entity-tree-entry",onMouseEnter:function(){return n.highlight(!0)},onMouseLeave:function(){return n.highlight(!1)},onTouchStart:function(){return setTimeout(function(){return n.highlight(!0)},1e3/30)},onTouchCancel:function(){return setTimeout(function(){return n.highlight(!1)},1e3/30)},onTouchEnd:function(){return setTimeout(function(){return n.highlight(!1)},1e3/30)}},f,this.row(s));return t.React.createElement("div",{key:r.id,className:o?"lm-entity-tree-root":""},p,t.React.createElement("div",{className:"lm-entity-tree-children-wrap",style:{display:a.isCollapsed?"none":"block"}},u))},i}(n.ObserverView),o=function(n){function o(){var e=n.apply(this,arguments)||this;return e.renderedVersion=-1,e.splash=r.SplashInfo.Info(),e}return c(o,n),o.prototype.scrollIntoView=function(e){var t=this.refs.chilren;if(t&&e)try{var n=t.getBoundingClientRect(),r=e.getBoundingClientRect(),i=t.scrollTop;if(r.top<n.top){var o=n.top-r.top;t.scrollTop=i-o}else if(r.bottom>n.bottom){var o=r.bottom-n.bottom;t.scrollTop=i+o}}catch(a){}},o.prototype.componentWillMount=function(){var t=this,n=this.controller.context.tree.root,r=n.tree.context;this.subscribe(e.Bootstrap.Event.Tree.NodeUpdated.getStream(r),function(e){e.data===n&&n.version!==t.renderedVersion&&t.forceUpdate()})},o.prototype.render=function(){var e=this.controller.context.tree.root;this.renderedVersion=e.version;for(var n=[],r=0,o=e.children;r<o.length;r++){var a=o[r];a.isHidden||n.push(t.React.createElement(i,{key:a.id,node:a,tree:this}))}return t.React.createElement("div",{className:"lm-entity-tree",ref:"root"},t.React.createElement(i,{key:e.id,node:e,tree:this}),t.React.createElement("div",{className:"lm-entity-tree-children"},n.length?n:this.splash))},o}(n.View);r.Tree=o}(r=n.Entity||(n.Entity={}))}(n=t.Views||(t.Views={}))}(t=e.Plugin||(e.Plugin={}))}(a||(a={}));var a;!function(e){var t;!function(t){var n;!function(n){var r;!function(r){r.Remove=function(n){return t.React.createElement(t.Controls.Button,{onClick:function(){e.Bootstrap.Command.Tree.RemoveNode.dispatch(n.entity.tree.context,n.entity),n.onRemove.call(null)},style:"link",icon:"remove",customClass:"lm-remove-entity lm-btn-icon"})};var i=function(n){function r(){return n.apply(this,arguments)||this}return c(r,n),r.prototype.shouldComponentUpdate=function(e){return this.props.type!==e.type},r.prototype.part=function(e,n,r,i){switch(r){case 0:return i.push(t.React.createElement("span",null,e.substr(0,n))),i;case 1:return i.push(t.React.createElement("sub",null,e.substr(0,n))),i;default:return i.push(t.React.createElement("sup",null,e.substr(0,n))),i}},r.prototype.split=function(e,t,n){if(e.length){for(var r=0;r<e.length;r++){if("_"===e[r])return this.split(e.substr(r+1),1,this.part(e,r,t,n)),void 0;if("^"===e[r])return this.split(e.substr(r+1),2,this.part(e,r,t,n)),void 0}this.part(e,e.length,t,n)}},r.prototype.createBadge=function(e){var t=[];return this.split(e,0,t),t},r.prototype.render=function(){var n=this.props.type;return t.React.createElement("div",{className:"lm-entity-badge lm-entity-badge-"+this.props.type.typeClass,title:n.name},t.React.createElement("div",null,n===e.Bootstrap.Entity.Root.info?void 0:this.createBadge(n.shortName)))},r}(t.React.Component);r.Badge=i;var o=function(n){function o(){var e=n.apply(this,arguments)||this;return e.state={current:void 0},e}return c(o,n),o.prototype.componentWillMount=function(){var t=this;n.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})})},o.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 n=this.state.current;return t.React.createElement("div",{className:"lm-entity-info",title:n.props.label+" "+(n.props.description?n.props.description:"")},t.React.createElement("div",null,t.React.createElement(i,{type:n.type.info}),t.React.createElement("span",null,n.props.label,t.React.createElement("span",null,n.props.description)),n.parent!==n||n.children.length?t.React.createElement(r.Remove,{entity:n,onRemove:function(){return e.forceUpdate()}}):void 0))},o}(n.View);r.CurrentEntityControl=o;var a;!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 n=function(e){function n(){var t=e.apply(this,arguments)||this;return t.state={isExpanded:!1},t}return c(n,e),n.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))},n}(t.React.Component);e.Info=function(){return t.React.createElement("div",{className:"lm-entity-splash"},t.React.createElement(e.General,null),t.React.createElement(n,{cls:"Root",desc:"The root entity represents the starting point of all actions."}),t.React.createElement(n,{cls:"Action",desc:"Represents a composition of one of more changes to the entity tree."}),t.React.createElement(n,{cls:"Data",desc:"Low level data, for example a string or a CIF dictionary."}),t.React.createElement(n,{cls:"Object",desc:"A more complex structure obtained from low level data. For example a molecule."}),t.React.createElement(n,{cls:"Visual",desc:"A visual representation of an object."}),t.React.createElement(n,{cls:"Selection",desc:"A description of a substructure of an object or a visual."}),t.React.createElement(n,{cls:"Behaviour",desc:"Represents a dynamic behavior of the program. For example creating electron density surface when the selection changes."}),t.React.createElement(n,{cls:"Group",desc:"A collection of related entities."}))}}(a=r.SplashInfo||(r.SplashInfo={}))}(r=n.Entity||(n.Entity={}))}(n=t.Views||(t.Views={}))}(t=e.Plugin||(e.Plugin={}))}(a||(a={}));var a;!function(e){var t;!function(t){var n;!function(n){var r;!function(r){var i=function(n){function r(){var e=n.apply(this,arguments)||this;return e.state={showSceneOptions:!1,showHelp:!1},e}return c(r,n),r.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"))}))},r.prototype.render=function(){var n,r=this,i=this.controller.latestState,o=this.controller.context.layout,a=o.latestState;this.state.showSceneOptions?n=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:i.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:i.cameraFOV}),t.React.createElement(t.Controls.ToggleColorPicker,{color:i.clearColor,label:"Background",position:"below",onChange:function(e){return r.controller.setState({clearColor:e})}})):this.state.showHelp&&(n=this.help());var s=!a.hideControls;return t.React.createElement("div",{className:"lm-viewport-controls",onMouseLeave:function(){return r.setState({showSceneOptions:!1,showHelp:!1})}},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(){return r.setState({showHelp:!r.state.showHelp,showSceneOptions:!1})},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(){return r.setState({showSceneOptions:!r.state.showSceneOptions,showHelp:!1})},title:"Scene Options"}),t.React.createElement(t.Controls.Button,{style:"link",icon:"screenshot",onClick:function(){window.open(r.controller.scene.scene.screenshotAsDataURL(),"_blank")},title:"Screenshot"}),t.React.createElement(t.Controls.Button,{onClick:function(){o.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 o.update({isExpanded:!a.isExpanded})},icon:"expand-layout",title:a.isExpanded?"Collapse":"Expand",active:a.isExpanded,customClass:"lm-btn-link-toggle-"+(a.isExpanded?"on":"off"),style:"link"}),t.React.createElement(t.Controls.Button,{style:"link",icon:"reset-scene",onClick:function(){return e.Bootstrap.Command.Visual.ResetScene.dispatch(r.controller.context,void 0)},title:"Reset scene"})),n)},r}(n.View);r.ViewportControls=i;var o=function(e){function n(){return e.apply(this,arguments)||this}return c(n,e),n.prototype.render=function(){var e=this.controller.latestState,n=e.info;if(!n.length)return t.React.createElement("div",{className:"lm-empty-control"});var r={__html:n.join(", ")};return t.React.createElement("div",{className:"lm-highlight-info"},t.React.createElement("div",{dangerouslySetInnerHTML:r}))},n}(n.View);r.HighlightInfo=o,r.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 a=function(n){function o(){var e=n.apply(this,arguments)||this;return e.state={noWebGl:!1,showLogo:!0},e}return c(o,n),o.prototype.componentDidMount=function(){this.controller.init(this.refs["host-3d"])||this.setState({noWebGl:!0}),this.handleLogo()},o.prototype.componentWillUnmount=function(){n.prototype.componentWillUnmount.call(this),this.controller.destroy()},o.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"),".")))},o.prototype.handleLogo=function(){var t=this;this.subscribe(e.Bootstrap.Event.Tree.NodeAdded.getStream(this.controller.context),function(n){e.Bootstrap.Entity.isClass(n.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(n){e.Bootstrap.Entity.isClass(n.data,e.Bootstrap.Entity.VisualClass)&&setTimeout(function(){return t.setState({showLogo:t.getShowLogo()})},0)})},o.prototype.getShowLogo=function(){try{return this.controller.context.viewport.scene.models.isEmpty()}catch(e){return!0}},o.prototype.render=function(){return this.state.noWebGl?this.renderMissing():t.React.createElement("div",{className:"lm-viewport"},t.React.createElement("div",{ref:"host-3d",className:"lm-viewport-host3d"}),this.state.showLogo?t.React.createElement(r.Logo,null):void 0,t.React.createElement(i,{controller:this.controller}))},o}(n.View);r.Viewport=a}(r=n.Visualization||(n.Visualization={}))}(n=t.Views||(t.Views={}))}(t=e.Plugin||(e.Plugin={}))}(a||(a={}));var a;!function(e){var t;!function(t){var n;!function(n){function r(e,t,n){return function(r,i){return function(o){return{key:e,controller:t(o),region:r,view:n,isStatic:i}}}}n.create=r;var i=function(e){function t(t,n,r){var i=e.call(this,t,{})||this;return i.appName=n,i.appVersion=r,i}return c(t,e),t}(e.Bootstrap.Components.Component);n.AppInfo=i;var o;!function(n){n.Log=r("Context.Log",function(t){return new e.Bootstrap.Components.Context.Log(t)},t.Views.Context.Log),n.Toast=r("Context.Toast",function(t){return new e.Bootstrap.Components.Context.Toast(t)},t.Views.Context.Toast),n.Overlay=r("Context.Overlay",function(t){return new e.Bootstrap.Components.Context.TaskWatcher(t,"Normal")},t.Views.Context.Overlay),n.BackgroundTasks=r("Context.BackgroundTasks",function(t){return new e.Bootstrap.Components.Context.TaskWatcher(t,"Background")
},t.Views.Context.BackgroundTasks)}(o=n.Context||(n.Context={}));var a;!function(n){n.View=r("Transform.View",function(t){return new e.Bootstrap.Components.Transform.View(t)},t.Views.Transform.View)}(a=n.Transform||(n.Transform={}));var s;!function(e){e.Current=function(e,n){return r("EntityInfo",function(t){return new i(t,e,n)},t.Views.Entity.CurrentEntityControl)}}(s=n.Entity||(n.Entity={}));var u;!function(n){n.Viewport=r("Viewport",function(t){return new e.Bootstrap.Components.Visualization.Viewport(t)},t.Views.Visualization.Viewport),n.HighlightInfo=r("HighlightInfo",function(t){return new e.Bootstrap.Components.Visualization.HighlightInfo(t)},t.Views.Visualization.HighlightInfo)}(u=n.Visualization||(n.Visualization={}))}(n=t.Components||(t.Components={}))}(t=e.Plugin||(e.Plugin={}))}(a||(a={}));var a;!function(e){var t;!function(t){t.Context=e.Bootstrap.Context;var n=e.Bootstrap.Components.LayoutRegion,r=function(){function r(n,r){this.spec=n,this.target=r,this.componentMap=new Map,this.transformersInfo=new Map,this.context=new e.Bootstrap.Context(this),this.init(),t.ReactDOM.render(t.React.createElement(this.spec.layoutView,{controller:this.context.layout}),r),e.Bootstrap.Command.Entity.SetCurrent.dispatch(this.context,this.context.tree.root)}return r.prototype.compose=function(){for(var t=0,n=Object.keys(this.spec.settings);t<n.length;t++){var r=n[t];Object.prototype.hasOwnProperty.call(this.spec.settings,r)&&this.context.settings.set(r,this.spec.settings[r])}for(var i=e.Bootstrap.Components.makeEmptyTargets(),o=0,a=this.spec.behaviours||[];o<a.length;o++){var s=a[o];s(this.context)}for(var u=0,c=this.spec.transforms;u<c.length;u++){var l=c[u];this.context.transforms.add(l.transformer),this.transformersInfo.set(l.transformer.info.id,l)}for(var h=0,f=this.spec.components;h<f.length;h++){var p=f[h],d=p(this.context);if(this.componentMap.has(d.key))throw"Component with key '"+d.key+"' was already added. Fix your spec.";i[d.region].components.push(d),this.componentMap.set(d.key,d)}return i},r.prototype.getTransformerInfo=function(e){return this.transformersInfo.get(e.info.id)},r.prototype.destroy=function(){this.context.dispatcher.finished(),t.ReactDOM.unmountComponentAtNode(this.target),this.context=void 0,this.componentMap=void 0,this.spec=void 0,this.target=void 0},r.prototype.init=function(){var t=this.compose();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:!0}),t[n.Main].components.push({key:"lm-internal-viewport",controller:this.context.viewport,region:n.Main,view:this.spec.viewport.view,isStatic:!0}),this.context.createLayout(t,this.target)},r}();t.Instance=r}(t=e.Plugin||(e.Plugin={}))}(a||(a={}));var a;!function(e){var t;!function(t){function n(){return{settings:{"molecule.model.defaultQuery":"residues({ name: 'ALA' })","molecule.model.defaultAssemblyName":"1","molecule.coordinateStreaming.defaultId":"1jj2","molecule.coordinateStreaming.defaultServer":"https://webchemdev.ncbr.muni.cz/CoordinateServer","molecule.coordinateStreaming.defaultRadius":10,"density.defaultVisualBehaviourRadius":5},transforms:[{transformer:i.Molecule.CoordinateStreaming.InitStreaming,view:t.Views.Transform.Molecule.InitCoordinateStreaming,initiallyCollapsed:!0},{transformer:r.DownloadMolecule,view:t.Views.Transform.Data.WithUrlIdField,initiallyCollapsed:!0},{transformer:i.Molecule.OpenMoleculeFromFile,view:t.Views.Transform.Molecule.OpenFile,initiallyCollapsed:!0},{transformer:i.Data.Download,view:t.Views.Transform.Data.Download,initiallyCollapsed:!0},{transformer:i.Data.OpenFile,view:t.Views.Transform.Data.OpenFile,initiallyCollapsed:!0},{transformer:i.Molecule.CreateFromData,view:t.Views.Transform.Molecule.CreateFromData},{transformer:i.Data.ParseCif,view:t.Views.Transform.Empty},{transformer:i.Density.ParseData,view:t.Views.Transform.Density.ParseData},{transformer:i.Molecule.CreateFromMmCif,view:t.Views.Transform.Molecule.CreateFromMmCif},{transformer:i.Molecule.CreateModel,view:t.Views.Transform.Molecule.CreateModel,initiallyCollapsed:!0},{transformer:i.Molecule.CreateSelection,view:t.Views.Transform.Molecule.CreateSelection,initiallyCollapsed:!0},{transformer:i.Molecule.CreateAssembly,view:t.Views.Transform.Molecule.CreateAssembly,initiallyCollapsed:!0},{transformer:i.Molecule.CreateSymmetryMates,view:t.Views.Transform.Molecule.CreateSymmetryMates,initiallyCollapsed:!0},{transformer:i.Molecule.CreateMacromoleculeVisual,view:t.Views.Transform.Empty},{transformer:i.Molecule.CreateVisual,view:t.Views.Transform.Molecule.CreateVisual},{transformer:i.Density.CreateVisual,view:t.Views.Transform.Density.CreateVisual},{transformer:i.Density.CreateVisualBehaviour,view:t.Views.Transform.Density.CreateVisualBehaviour},{transformer:i.Molecule.CoordinateStreaming.CreateBehaviour,view:t.Views.Transform.Empty,initiallyCollapsed:!0}],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(o.Main,!0),t.Components.Entity.Current("LiteMol",t.VERSION.number)(o.Right,!0),t.Components.Transform.View(o.Right),t.Components.Context.Log(o.Bottom,!0),t.Components.Context.Overlay(o.Root),t.Components.Context.Toast(o.Main,!0),t.Components.Context.BackgroundTasks(o.Main,!0)],viewport:{view:t.Views.Visualization.Viewport,controlsView:t.Views.Visualization.ViewportControls},layoutView:t.Views.Layout,tree:{region:o.Left,view:t.Views.Entity.Tree}}}var r,i=e.Bootstrap.Entity.Transformer;!function(e){e.DownloadMolecule=i.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://webchemdev.ncbr.muni.cz/CoordinateServer/1tqn/cartoon",urlTemplate:function(e){return e},isFullUrl:!0})}(r=t.DataSources||(t.DataSources={}));var o=e.Bootstrap.Components.LayoutRegion;t.getDefaultSpecification=n}(t=e.Plugin||(e.Plugin={}))}(a||(a={}));var a;return function(e){var t;!function(t){function n(e){return new o(e)}var r=e.Bootstrap.Entity,i=r.Transformer,o=function(){function n(n){var r=n.customSpecification?n.customSpecification:t.getDefaultSpecification();n.customSpecification||r.behaviours.push(e.Bootstrap.Behaviour.GoogleAnalytics(n.analyticsId?n.analyticsId:"UA-77062725-1"));var i;if(i=n.target instanceof HTMLElement?n.target:document.querySelector(n.target),!i)throw new Error("options.target cannot be undefined.");this._instance=new t.Instance(r,i),n.viewportBackground&&this.setViewportBackground(n.viewportBackground),n.layoutState&&this.setLayoutState(n.layoutState)}return Object.defineProperty(n.prototype,"instance",{get:function(){return this._instance},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"context",{get:function(){return this._instance.context},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"root",{get:function(){return this._instance.context.tree.root},enumerable:!0,configurable:!0}),n.prototype.command=function(e,t){e.dispatch(this.context,t)},n.prototype.selectEntities=function(e){return this.context.select(e)},n.prototype.subscribe=function(e,t){return e.getStream(this.context).subscribe(t)},n.prototype.createTransform=function(){return e.Bootstrap.Tree.Transform.build()},n.prototype.applyTransform=function(t){var n=this.context;return e.Bootstrap.Tree.Transform.apply(n,t).run(n)},n.prototype.clear=function(){this.command(e.Bootstrap.Command.Tree.RemoveNode,this.root)},n.prototype.setViewportBackground=function(t){e.Visualization.Color.isColor(t)?this.command(e.Bootstrap.Command.Layout.SetViewportOptions,{clearColor:t}):this.command(e.Bootstrap.Command.Layout.SetViewportOptions,{clearColor:e.Visualization.Color.fromHexString(t)})},n.prototype.setLayoutState=function(t){this.command(e.Bootstrap.Command.Layout.SetState,t)},n.prototype.loadMolecule=function(t){var n=this.createTransform();if(!t.url&&!t.data)throw new Error("Please specify either url or data");var o=e.Core.Formats.Molecule.SupportedFormats.mmCIF;if(t.format)if(e.Core.Formats.FormatInfo.is(t.format))o=t.format;else{var a=e.Core.Formats.FormatInfo.fromShortcut(e.Core.Formats.Molecule.SupportedFormats.All,t.format);if(!a)throw new Error("'"+t.format+"' is not a supported format.");o=a}var s=t.data?n.add(this.root,r.Transformer.Data.FromData,{data:t.data,id:t.id}):n.add(this.root,i.Data.Download,{url:t.url,type:o.isBinary?"Binary":"String",id:t.id,title:"Molecule"});return s.then(i.Molecule.CreateFromData,{format:o,customId:t.id},{isBinding:!0,ref:t.moleculeRef}).then(i.Molecule.CreateModel,{modelIndex:0},{isBinding:!1,ref:t.modelRef}).then(i.Molecule.CreateMacromoleculeVisual,{polymer:!0,het:!0,water:!0}),this.applyTransform(s)},n.prototype.destroy=function(){this._instance&&(this._instance.destroy(),this._instance=void 0)},n}();t.Controller=o,t.create=n}(t=e.Plugin||(e.Plugin={}))}(a||(a={})),a};if("object"==typeof module&&"object"==typeof module.exports)module.exports=__LiteMol_Plugin();else if("function"==typeof define&&define.amd)define(["require"],function(){return __LiteMol_Plugin()});else{var __target=window?window:this;__target.LiteMol=__LiteMol_Plugin()}!function(e,t,n){"use strict";function r(e,t){return t=t||Error,function(){var n,r,i=2,o=arguments,a=o[0],s="["+(e?e+":":"")+a+"] ",u=o[1];for(s+=u.replace(/\{\d+\}/g,function(e){var t=+e.slice(1,-1),n=t+i;return n<o.length?bt(o[n]):e}),s+="\nhttp://errors.angularjs.org/1.4.7/"+(e?e+"/":"")+a,r=i,n="?";r<o.length;r++,n="&")s+=n+"p"+(r-i)+"="+encodeURIComponent(bt(o[r]));return new t(s)}}function i(e){if(null==e||A(e))return!1;var t="length"in Object(e)&&e.length;return e.nodeType===qi&&t?!0:C(e)||Oi(e)||0===t||"number"==typeof t&&t>0&&t-1 in e}function o(e,t,n){var r,a;if(e)if(M(e))for(r in e)"prototype"==r||"length"==r||"name"==r||e.hasOwnProperty&&!e.hasOwnProperty(r)||t.call(n,e[r],r,e);else if(Oi(e)||i(e)){var s="object"!=typeof e;for(r=0,a=e.length;a>r;r++)(s||r in e)&&t.call(n,e[r],r,e)}else if(e.forEach&&e.forEach!==o)e.forEach(t,n,e);else if(_(e))for(r in e)t.call(n,e[r],r,e);else if("function"==typeof e.hasOwnProperty)for(r in e)e.hasOwnProperty(r)&&t.call(n,e[r],r,e);else for(r in e)wi.call(e,r)&&t.call(n,e[r],r,e);return e}function a(e,t,n){for(var r=Object.keys(e).sort(),i=0;i<r.length;i++)t.call(n,e[r[i]],r[i]);return r}function s(e){return function(t,n){e(n,t)}}function u(){return++Li}function c(e,t){t?e.$$hashKey=t:delete e.$$hashKey}function l(e,t,n){for(var r=e.$$hashKey,i=0,o=t.length;o>i;++i){var a=t[i];if(w(a)||M(a))for(var s=Object.keys(a),u=0,h=s.length;h>u;u++){var f=s[u],p=a[f];n&&w(p)?S(p)?e[f]=new Date(p.valueOf()):T(p)?e[f]=new RegExp(p):(w(e[f])||(e[f]=Oi(p)?[]:{}),l(e[f],[p],!0)):e[f]=p}}return c(e,r),e}function h(e){return l(e,Pi.call(arguments,1),!1)}function f(e){return l(e,Pi.call(arguments,1),!0)}function p(e){return parseInt(e,10)}function d(e,t){return h(Object.create(e),t)}function m(){}function v(e){return e}function g(e){return function(){return e}}function y(e){return M(e.toString)&&e.toString!==Object.prototype.toString}function b(e){return"undefined"==typeof e}function x(e){return"undefined"!=typeof e}function w(e){return null!==e&&"object"==typeof e}function _(e){return null!==e&&"object"==typeof e&&!Di(e)}function C(e){return"string"==typeof e}function E(e){return"number"==typeof e}function S(e){return"[object Date]"===Ii.call(e)}function M(e){return"function"==typeof e}function T(e){return"[object RegExp]"===Ii.call(e)}function A(e){return e&&e.window===e}function P(e){return e&&e.$evalAsync&&e.$watch}function k(e){return"[object File]"===Ii.call(e)}function R(e){return"[object FormData]"===Ii.call(e)}function I(e){return"[object Blob]"===Ii.call(e)}function D(e){return"boolean"==typeof e}function B(e){return e&&M(e.then)}function V(e){return Fi.test(Ii.call(e))}function L(e){return!(!e||!(e.nodeName||e.prop&&e.attr&&e.find))}function N(e){var t,n={},r=e.split(",");for(t=0;t<r.length;t++)n[r[t]]=!0;return n}function O(e){return xi(e.nodeName||e[0]&&e[0].nodeName)}function F(e,t){var n=e.indexOf(t);return n>=0&&e.splice(n,1),n}function U(e,t,n,r){if(A(e)||P(e))throw Bi("cpws","Can't copy! Making copies of Window or Scope instances is not supported.");if(V(t))throw Bi("cpta","Can't copy! TypedArray destination cannot be mutated.");if(t){if(e===t)throw Bi("cpi","Can't copy! Source and destination are identical.");n=n||[],r=r||[],w(e)&&(n.push(e),r.push(t));var i;if(Oi(e)){t.length=0;for(var a=0;a<e.length;a++)t.push(U(e[a],null,n,r))}else{var s=t.$$hashKey;if(Oi(t)?t.length=0:o(t,function(e,n){delete t[n]}),_(e))for(i in e)t[i]=U(e[i],null,n,r);else if(e&&"function"==typeof e.hasOwnProperty)for(i in e)e.hasOwnProperty(i)&&(t[i]=U(e[i],null,n,r));else for(i in e)wi.call(e,i)&&(t[i]=U(e[i],null,n,r));c(t,s)}}else if(t=e,w(e)){var u;if(n&&-1!==(u=n.indexOf(e)))return r[u];if(Oi(e))return U(e,[],n,r);if(V(e))t=new e.constructor(e);else if(S(e))t=new Date(e.getTime());else if(T(e))t=new RegExp(e.source,e.toString().match(/[^\/]*$/)[0]),t.lastIndex=e.lastIndex;else{if(!M(e.cloneNode)){var l=Object.create(Di(e));return U(e,l,n,r)}t=e.cloneNode(!0)}r&&(n.push(e),r.push(t))}return t}function z(e,t){if(Oi(e)){t=t||[];for(var n=0,r=e.length;r>n;n++)t[n]=e[n]}else if(w(e)){t=t||{};for(var i in e)("$"!==i.charAt(0)||"$"!==i.charAt(1))&&(t[i]=e[i])}return t||e}function $(e,t){if(e===t)return!0;if(null===e||null===t)return!1;if(e!==e&&t!==t)return!0;var n,r,i,o=typeof e,a=typeof t;if(o==a&&"object"==o){if(!Oi(e)){if(S(e))return S(t)?$(e.getTime(),t.getTime()):!1;if(T(e))return T(t)?e.toString()==t.toString():!1;if(P(e)||P(t)||A(e)||A(t)||Oi(t)||S(t)||T(t))return!1;i=vt();for(r in e)if("$"!==r.charAt(0)&&!M(e[r])){if(!$(e[r],t[r]))return!1;i[r]=!0}for(r in t)if(!(r in i)&&"$"!==r.charAt(0)&&x(t[r])&&!M(t[r]))return!1;return!0}if(!Oi(t))return!1;if((n=e.length)==t.length){for(r=0;n>r;r++)if(!$(e[r],t[r]))return!1;return!0}}return!1}function H(e,t,n){return e.concat(Pi.call(t,n))}function j(e,t){return Pi.call(e,t||0)}function G(e,t){var n=arguments.length>2?j(arguments,2):[];return!M(t)||t instanceof RegExp?t:n.length?function(){return arguments.length?t.apply(e,H(n,arguments,0)):t.apply(e,n)}:function(){return arguments.length?t.apply(e,arguments):t.call(e)}}function W(e,r){var i=r;return"string"==typeof e&&"$"===e.charAt(0)&&"$"===e.charAt(1)?i=n:A(r)?i="$WINDOW":r&&t===r?i="$DOCUMENT":P(r)&&(i="$SCOPE"),i}function q(e,t){return"undefined"==typeof e?n:(E(t)||(t=t?2:null),JSON.stringify(e,W,t))}function X(e){return C(e)?JSON.parse(e):e}function Y(e,t){var n=Date.parse("Jan 01, 1970 00:00:00 "+e)/6e4;return isNaN(n)?t:n}function K(e,t){return e=new Date(e.getTime()),e.setMinutes(e.getMinutes()+t),e}function Q(e,t,n){n=n?-1:1;var r=Y(t,e.getTimezoneOffset());return K(e,n*(r-e.getTimezoneOffset()))}function Z(e){e=Mi(e).clone();try{e.empty()}catch(t){}var n=Mi("<div>").append(e).html();try{return e[0].nodeType===Yi?xi(n):n.match(/^(<[^>]+>)/)[1].replace(/^<([\w\-]+)/,function(e,t){return"<"+xi(t)})}catch(t){return xi(n)}}function J(e){try{return decodeURIComponent(e)}catch(t){}}function et(e){var t={};return o((e||"").split("&"),function(e){var n,r,i;e&&(r=e=e.replace(/\+/g,"%20"),n=e.indexOf("="),-1!==n&&(r=e.substring(0,n),i=e.substring(n+1)),r=J(r),x(r)&&(i=x(i)?J(i):!0,wi.call(t,r)?Oi(t[r])?t[r].push(i):t[r]=[t[r],i]:t[r]=i))}),t}function tt(e){var t=[];return o(e,function(e,n){Oi(e)?o(e,function(e){t.push(rt(n,!0)+(e===!0?"":"="+rt(e,!0)))}):t.push(rt(n,!0)+(e===!0?"":"="+rt(e,!0)))}),t.length?t.join("&"):""}function nt(e){return rt(e,!0).replace(/%26/gi,"&").replace(/%3D/gi,"=").replace(/%2B/gi,"+")}function rt(e,t){return encodeURIComponent(e).replace(/%40/gi,"@").replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%3B/gi,";").replace(/%20/g,t?"%20":"+")}function it(e,t){var n,r,i=ji.length;for(r=0;i>r;++r)if(n=ji[r]+t,C(n=e.getAttribute(n)))return n;return null}function ot(e,t){var n,r,i={};o(ji,function(t){var i=t+"app";!n&&e.hasAttribute&&e.hasAttribute(i)&&(n=e,r=e.getAttribute(i))}),o(ji,function(t){var i,o=t+"app";!n&&(i=e.querySelector("["+o.replace(":","\\:")+"]"))&&(n=i,r=i.getAttribute(o))}),n&&(i.strictDi=null!==it(n,"strict-di"),t(n,r?[r]:[],i))}function at(n,r,i){w(i)||(i={});var a={strictDi:!1};i=h(a,i);var s=function(){if(n=Mi(n),n.injector()){var e=n[0]===t?"document":Z(n);throw Bi("btstrpd","App Already Bootstrapped with this Element '{0}'",e.replace(/</,"<").replace(/>/,">"))}r=r||[],r.unshift(["$provide",function(e){e.value("$rootElement",n)}]),i.debugInfoEnabled&&r.push(["$compileProvider",function(e){e.debugInfoEnabled(!0)}]),r.unshift("ng");var o=Zt(r,i.strictDi);return o.invoke(["$rootScope","$rootElement","$compile","$injector",function(e,t,n,r){e.$apply(function(){t.data("$injector",r),n(t)(e)})}]),o},u=/^NG_ENABLE_DEBUG_INFO!/,c=/^NG_DEFER_BOOTSTRAP!/;return e&&u.test(e.name)&&(i.debugInfoEnabled=!0,e.name=e.name.replace(u,"")),e&&!c.test(e.name)?s():(e.name=e.name.replace(c,""),Vi.resumeBootstrap=function(e){return o(e,function(e){r.push(e)}),s()},M(Vi.resumeDeferredBootstrap)&&Vi.resumeDeferredBootstrap(),void 0)}function st(){e.name="NG_ENABLE_DEBUG_INFO!"+e.name,e.location.reload()}function ut(e){var t=Vi.element(e).injector();if(!t)throw Bi("test","no injector found for element argument to getTestability");return t.get("$$testability")}function ct(e,t){return t=t||"_",e.replace(Gi,function(e,n){return(n?t:"")+e.toLowerCase()})}function lt(){var t;if(!Wi){var r=Hi();Ti=b(r)?e.jQuery:r?e[r]:n,Ti&&Ti.fn.on?(Mi=Ti,h(Ti.fn,{scope:po.scope,isolateScope:po.isolateScope,controller:po.controller,injector:po.injector,inheritedData:po.inheritedData}),t=Ti.cleanData,Ti.cleanData=function(e){var n;if(Ni)Ni=!1;else for(var r,i=0;null!=(r=e[i]);i++)n=Ti._data(r,"events"),n&&n.$destroy&&Ti(r).triggerHandler("$destroy");t(e)}):Mi=At,Vi.element=Mi,Wi=!0}}function ht(e,t,n){if(!e)throw Bi("areq","Argument '{0}' is {1}",t||"?",n||"required");return e}function ft(e,t,n){return n&&Oi(e)&&(e=e[e.length-1]),ht(M(e),t,"not a function, got "+(e&&"object"==typeof e?e.constructor.name||"Object":typeof e)),e}function pt(e,t){if("hasOwnProperty"===e)throw Bi("badname","hasOwnProperty is not a valid {0} name",t)}function dt(e,t,n){if(!t)return e;for(var r,i=t.split("."),o=e,a=i.length,s=0;a>s;s++)r=i[s],e&&(e=(o=e)[r]);return!n&&M(e)?G(o,e):e}function mt(e){for(var t,n=e[0],r=e[e.length-1],i=1;n!==r&&(n=n.nextSibling);i++)(t||e[i]!==n)&&(t||(t=Mi(Pi.call(e,0,i))),t.push(n));return t||e}function vt(){return Object.create(null)}function gt(e){function t(e,t,n){return e[t]||(e[t]=n())}var n=r("$injector"),i=r("ng"),o=t(e,"angular",Object);return o.$$minErr=o.$$minErr||r,t(o,"module",function(){var e={};return function(r,o,a){var s=function(e,t){if("hasOwnProperty"===e)throw i("badname","hasOwnProperty is not a valid {0} name",t)};return s(r,"module"),o&&e.hasOwnProperty(r)&&(e[r]=null),t(e,r,function(){function e(e,t,n,r){return r||(r=i),function(){return r[n||"push"]([e,t,arguments]),l}}function t(e,t){return function(n,o){return o&&M(o)&&(o.$$moduleName=r),i.push([e,t,arguments]),l}}if(!o)throw n("nomod","Module '{0}' is not available! You either misspelled the module name or forgot to load it. If registering a module ensure that you specify the dependencies as the second argument.",r);var i=[],s=[],u=[],c=e("$injector","invoke","push",s),l={_invokeQueue:i,_configBlocks:s,_runBlocks:u,requires:o,name:r,provider:t("$provide","provider"),factory:t("$provide","factory"),service:t("$provide","service"),value:e("$provide","value"),constant:e("$provide","constant","unshift"),decorator:t("$provide","decorator"),animation:t("$animateProvider","register"),filter:t("$filterProvider","register"),controller:t("$controllerProvider","register"),directive:t("$compileProvider","directive"),config:c,run:function(e){return u.push(e),this}};return a&&c(a),l})}})}function yt(e){var t=[];return JSON.stringify(e,function(e,n){if(n=W(e,n),w(n)){if(t.indexOf(n)>=0)return"...";t.push(n)}return n})}function bt(e){return"function"==typeof e?e.toString().replace(/ \{[\s\S]*$/,""):b(e)?"undefined":"string"!=typeof e?yt(e):e}function xt(t){h(t,{bootstrap:at,copy:U,extend:h,merge:f,equals:$,element:Mi,forEach:o,injector:Zt,noop:m,bind:G,toJson:q,fromJson:X,identity:v,isUndefined:b,isDefined:x,isString:C,isFunction:M,isObject:w,isNumber:E,isElement:L,isArray:Oi,version:Ji,isDate:S,lowercase:xi,uppercase:_i,callbacks:{counter:0},getTestability:ut,$$minErr:r,$$csp:$i,reloadWithDebugInfo:st}),Ai=gt(e),Ai("ng",["ngLocale"],["$provide",function(e){e.provider({$$sanitizeUri:gr}),e.provider("$compile",cn).directive({a:da,input:Ra,textarea:Ra,form:ba,script:Cs,select:Ms,style:As,option:Ts,ngBind:Ba,ngBindHtml:La,ngBindTemplate:Va,ngClass:Oa,ngClassEven:Ua,ngClassOdd:Fa,ngCloak:za,ngController:$a,ngForm:xa,ngHide:gs,ngIf:Ga,ngInclude:Wa,ngInit:Xa,ngNonBindable:us,ngPluralize:fs,ngRepeat:ps,ngShow:vs,ngStyle:ys,ngSwitch:bs,ngSwitchWhen:xs,ngSwitchDefault:ws,ngOptions:hs,ngTransclude:_s,ngModel:os,ngList:Ya,ngChange:Na,pattern:ks,ngPattern:ks,required:Ps,ngRequired:Ps,minlength:Is,ngMinlength:Is,maxlength:Rs,ngMaxlength:Rs,ngValue:Da,ngModelOptions:ss}).directive({ngInclude:qa}).directive(ma).directive(Ha),e.provider({$anchorScroll:Jt,$animate:Po,$animateCss:ko,$$animateQueue:Ao,$$AnimateRunner:To,$browser:an,$cacheFactory:sn,$controller:dn,$document:mn,$exceptionHandler:vn,$filter:Rr,$$forceReflow:Vo,$interpolate:kn,$interval:Rn,$http:Mn,$httpParamSerializer:yn,$httpParamSerializerJQLike:bn,$httpBackend:An,$xhrFactory:Tn,$location:Gn,$log:Wn,$parse:hr,$rootScope:vr,$q:fr,$$q:pr,$sce:wr,$sceDelegate:xr,$sniffer:_r,$templateCache:un,$templateRequest:Cr,$$testability:Er,$timeout:Sr,$window:Ar,$$rAF:mr,$$jqLite:qt,$$HashMap:yo,$$cookieReader:kr})}])}function wt(){return++to}function _t(e){return e.replace(io,function(e,t,n,r){return r?n.toUpperCase():n}).replace(oo,"Moz$1")}function Ct(e){return!co.test(e)}function Et(e){var t=e.nodeType;return t===qi||!t||t===Qi}function St(e){for(var t in eo[e.ng339])return!0;return!1}function Mt(e,t){var n,r,i,a,s=t.createDocumentFragment(),u=[];if(Ct(e))u.push(t.createTextNode(e));else{for(n=n||s.appendChild(t.createElement("div")),r=(lo.exec(e)||["",""])[1].toLowerCase(),i=fo[r]||fo._default,n.innerHTML=i[1]+e.replace(ho,"<$1></$2>")+i[2],a=i[0];a--;)n=n.lastChild;u=H(u,n.childNodes),n=s.firstChild,n.textContent=""}return s.textContent="",s.innerHTML="",o(u,function(e){s.appendChild(e)}),s}function Tt(e,n){n=n||t;var r;return(r=uo.exec(e))?[n.createElement(r[1])]:(r=Mt(e,n))?r.childNodes:[]}function At(e){if(e instanceof At)return e;var t;if(C(e)&&(e=Ui(e),t=!0),!(this instanceof At)){if(t&&"<"!=e.charAt(0))throw so("nosel","Looking up elements via selectors is not supported by jqLite! See: http://docs.angularjs.org/api/angular.element");return new At(e)}t?Ot(this,Tt(e)):Ot(this,e)}function Pt(e){return e.cloneNode(!0)}function kt(e,t){if(t||It(e),e.querySelectorAll)for(var n=e.querySelectorAll("*"),r=0,i=n.length;i>r;r++)It(n[r])}function Rt(e,t,n,r){if(x(r))throw so("offargs","jqLite#off() does not support the `selector` argument");var i=Dt(e),a=i&&i.events,s=i&&i.handle;if(s)if(t)o(t.split(" "),function(t){if(x(n)){var r=a[t];if(F(r||[],n),r&&r.length>0)return}ro(e,t,s),delete a[t]});else for(t in a)"$destroy"!==t&&ro(e,t,s),delete a[t]}function It(e,t){var r=e.ng339,i=r&&eo[r];if(i){if(t)return delete i.data[t],void 0;i.handle&&(i.events.$destroy&&i.handle({},"$destroy"),Rt(e)),delete eo[r],e.ng339=n}}function Dt(e,t){var r=e.ng339,i=r&&eo[r];return t&&!i&&(e.ng339=r=wt(),i=eo[r]={events:{},data:{},handle:n}),i}function Bt(e,t,n){if(Et(e)){var r=x(n),i=!r&&t&&!w(t),o=!t,a=Dt(e,!i),s=a&&a.data;if(r)s[t]=n;else{if(o)return s;if(i)return s&&s[t];h(s,t)}}}function Vt(e,t){return e.getAttribute?(" "+(e.getAttribute("class")||"")+" ").replace(/[\n\t]/g," ").indexOf(" "+t+" ")>-1:!1}function Lt(e,t){t&&e.setAttribute&&o(t.split(" "),function(t){e.setAttribute("class",Ui((" "+(e.getAttribute("class")||"")+" ").replace(/[\n\t]/g," ").replace(" "+Ui(t)+" "," ")))})}function Nt(e,t){if(t&&e.setAttribute){var n=(" "+(e.getAttribute("class")||"")+" ").replace(/[\n\t]/g," ");o(t.split(" "),function(e){e=Ui(e),-1===n.indexOf(" "+e+" ")&&(n+=e+" ")}),e.setAttribute("class",Ui(n))}}function Ot(e,t){if(t)if(t.nodeType)e[e.length++]=t;else{var n=t.length;if("number"==typeof n&&t.window!==t){if(n)for(var r=0;n>r;r++)e[e.length++]=t[r]}else e[e.length++]=t}}function Ft(e,t){return Ut(e,"$"+(t||"ngController")+"Controller")}function Ut(e,t,n){e.nodeType==Qi&&(e=e.documentElement);for(var r=Oi(t)?t:[t];e;){for(var i=0,o=r.length;o>i;i++)if(x(n=Mi.data(e,r[i])))return n;e=e.parentNode||e.nodeType===Zi&&e.host}}function zt(e){for(kt(e,!0);e.firstChild;)e.removeChild(e.firstChild)}function $t(e,t){t||kt(e);var n=e.parentNode;n&&n.removeChild(e)}function Ht(t,n){n=n||e,"complete"===n.document.readyState?n.setTimeout(t):Mi(n).on("load",t)}function jt(e,t){var n=mo[t.toLowerCase()];return n&&vo[O(e)]&&n}function Gt(e){return go[e]}function Wt(e,t){var n=function(n,r){n.isDefaultPrevented=function(){return n.defaultPrevented};var i=t[r||n.type],o=i?i.length:0;if(o){if(b(n.immediatePropagationStopped)){var a=n.stopImmediatePropagation;n.stopImmediatePropagation=function(){n.immediatePropagationStopped=!0,n.stopPropagation&&n.stopPropagation(),a&&a.call(n)}}n.isImmediatePropagationStopped=function(){return n.immediatePropagationStopped===!0},o>1&&(i=z(i));for(var s=0;o>s;s++)n.isImmediatePropagationStopped()||i[s].call(e,n)}};return n.elem=e,n}function qt(){this.$get=function(){return h(At,{hasClass:function(e,t){return e.attr&&(e=e[0]),Vt(e,t)},addClass:function(e,t){return e.attr&&(e=e[0]),Nt(e,t)},removeClass:function(e,t){return e.attr&&(e=e[0]),Lt(e,t)}})}}function Xt(e,t){var n=e&&e.$$hashKey;if(n)return"function"==typeof n&&(n=e.$$hashKey()),n;var r=typeof e;return n="function"==r||"object"==r&&null!==e?e.$$hashKey=r+":"+(t||u)():r+":"+e}function Yt(e,t){if(t){var n=0;this.nextUid=function(){return++n}}o(e,this.put,this)}function Kt(e){var t=e.toString().replace(_o,""),n=t.match(bo);return n?"function("+(n[1]||"").replace(/[\s\r\n]+/," ")+")":"fn"}function Qt(e,t,n){var r,i,a,s;if("function"==typeof e){if(!(r=e.$inject)){if(r=[],e.length){if(t)throw C(n)&&n||(n=e.name||Kt(e)),Co("strictdi","{0} is not using explicit annotation and cannot be invoked in strict mode",n);i=e.toString().replace(_o,""),a=i.match(bo),o(a[1].split(xo),function(e){e.replace(wo,function(e,t,n){r.push(n)})})}e.$inject=r}}else Oi(e)?(s=e.length-1,ft(e[s],"fn"),r=e.slice(0,s)):ft(e,"fn",!0);return r}function Zt(e,t){function r(e){return function(t,n){return w(t)?(o(t,s(e)),void 0):e(t,n)}}function i(e,t){if(pt(e,"service"),(M(t)||Oi(t))&&(t=E.instantiate(t)),!t.$get)throw Co("pget","Provider '{0}' must define $get factory method.",e);return _[e+v]=t}function a(e,t){return function(){var n=T.invoke(t,this);if(b(n))throw Co("undef","Provider '{0}' must return a value from $get factory method.",e);return n}}function u(e,t,n){return i(e,{$get:n!==!1?a(e,t):t})}function c(e,t){return u(e,["$injector",function(e){return e.instantiate(t)}])}function l(e,t){return u(e,g(t),!1)}function h(e,t){pt(e,"constant"),_[e]=t,S[e]=t}function f(e,t){var n=E.get(e+v),r=n.$get;n.$get=function(){var e=T.invoke(r,n);return T.invoke(t,null,{$delegate:e})}}function p(e){ht(b(e)||Oi(e),"modulesToLoad","not an array");var t,n=[];return o(e,function(e){function r(e){var t,n;for(t=0,n=e.length;n>t;t++){var r=e[t],i=E.get(r[0]);i[r[1]].apply(i,r[2])}}if(!x.get(e)){x.put(e,!0);try{C(e)?(t=Ai(e),n=n.concat(p(t.requires)).concat(t._runBlocks),r(t._invokeQueue),r(t._configBlocks)):M(e)?n.push(E.invoke(e)):Oi(e)?n.push(E.invoke(e)):ft(e,"module")}catch(i){throw Oi(e)&&(e=e[e.length-1]),i.message&&i.stack&&-1==i.stack.indexOf(i.message)&&(i=i.message+"\n"+i.stack),Co("modulerr","Failed to instantiate module {0} due to:\n{1}",e,i.stack||i.message||i)}}}),n}function d(e,n){function r(t,r){if(e.hasOwnProperty(t)){if(e[t]===m)throw Co("cdep","Circular dependency found: {0}",t+" <- "+y.join(" <- "));return e[t]}try{return y.unshift(t),e[t]=m,e[t]=n(t,r)}catch(i){throw e[t]===m&&delete e[t],i}finally{y.shift()}}function i(e,n,i,o){"string"==typeof i&&(o=i,i=null);var a,s,u,c=[],l=Zt.$$annotate(e,t,o);for(s=0,a=l.length;a>s;s++){if(u=l[s],"string"!=typeof u)throw Co("itkn","Incorrect injection token! Expected service name as string, got {0}",u);c.push(i&&i.hasOwnProperty(u)?i[u]:r(u,o))}return Oi(e)&&(e=e[a]),e.apply(n,c)}function o(e,t,n){var r=Object.create((Oi(e)?e[e.length-1]:e).prototype||null),o=i(e,r,t,n);return w(o)||M(o)?o:r}return{invoke:i,instantiate:o,get:r,annotate:Zt.$$annotate,has:function(t){return _.hasOwnProperty(t+v)||e.hasOwnProperty(t)}}}t=t===!0;var m={},v="Provider",y=[],x=new Yt([],!0),_={$provide:{provider:r(i),factory:r(u),service:r(c),value:r(l),constant:r(h),decorator:f}},E=_.$injector=d(_,function(e,t){throw Vi.isString(t)&&y.push(t),Co("unpr","Unknown provider: {0}",y.join(" <- "))}),S={},T=S.$injector=d(S,function(e,t){var r=E.get(e+v,t);return T.invoke(r.$get,r,n,e)});return o(p(e),function(e){e&&T.invoke(e)}),T}function Jt(){var e=!0;this.disableAutoScrolling=function(){e=!1},this.$get=["$window","$location","$rootScope",function(t,n,r){function i(e){var t=null;return Array.prototype.some.call(e,function(e){return"a"===O(e)?(t=e,!0):void 0}),t}function o(){var e=s.yOffset;if(M(e))e=e();else if(L(e)){var n=e[0],r=t.getComputedStyle(n);e="fixed"!==r.position?0:n.getBoundingClientRect().bottom}else E(e)||(e=0);return e}function a(e){if(e){e.scrollIntoView();var n=o();if(n){var r=e.getBoundingClientRect().top;t.scrollBy(0,r-n)}}else t.scrollTo(0,0)}function s(e){e=C(e)?e:n.hash();var t;e?(t=u.getElementById(e))?a(t):(t=i(u.getElementsByName(e)))?a(t):"top"===e&&a(null):a(null)}var u=t.document;return e&&r.$watch(function(){return n.hash()},function(e,t){(e!==t||""!==e)&&Ht(function(){r.$evalAsync(s)})}),s}]}function en(e,t){return e||t?e?t?(Oi(e)&&(e=e.join(" ")),Oi(t)&&(t=t.join(" ")),e+" "+t):e:t:""}function tn(e){for(var t=0;t<e.length;t++){var n=e[t];if(n.nodeType===So)return n}}function nn(e){C(e)&&(e=e.split(" "));var t=vt();return o(e,function(e){e.length&&(t[e]=!0)}),t}function rn(e){return w(e)?e:{}}function on(e,t,n,r){function i(e){try{e.apply(null,j(arguments,1))}finally{if(y--,0===y)for(;x.length;)try{x.pop()()}catch(t){n.error(t)}}}function a(e){var t=e.indexOf("#");return-1===t?"":e.substr(t)}function s(){S=null,c(),l()}function u(){try{return p.state}catch(e){}}function c(){w=u(),w=b(w)?null:w,$(w,A)&&(w=A),A=w}function l(){(C!==h.url()||_!==w)&&(C=h.url(),_=w,o(M,function(e){e(h.url(),w)}))}var h=this,f=(t[0],e.location),p=e.history,d=e.setTimeout,v=e.clearTimeout,g={};h.isMock=!1;var y=0,x=[];h.$$completeOutstandingRequest=i,h.$$incOutstandingRequestCount=function(){y++},h.notifyWhenNoOutstandingRequests=function(e){0===y?e():x.push(e)};var w,_,C=f.href,E=t.find("base"),S=null;c(),_=w,h.url=function(t,n,i){if(b(i)&&(i=null),f!==e.location&&(f=e.location),p!==e.history&&(p=e.history),t){var o=_===i;if(C===t&&(!r.history||o))return h;var s=C&&Ln(C)===Ln(t);return C=t,_=i,!r.history||s&&o?((!s||S)&&(S=t),n?f.replace(t):s?f.hash=a(t):f.href=t,f.href!==t&&(S=t)):(p[n?"replaceState":"pushState"](i,"",t),c(),_=w),h}return S||f.href.replace(/%27/g,"'")},h.state=function(){return w};var M=[],T=!1,A=null;h.onUrlChange=function(t){return T||(r.history&&Mi(e).on("popstate",s),Mi(e).on("hashchange",s),T=!0),M.push(t),t},h.$$applicationDestroyed=function(){Mi(e).off("hashchange popstate",s)
},h.$$checkUrlChange=l,h.baseHref=function(){var e=E.attr("href");return e?e.replace(/^(https?\:)?\/\/[^\/]*/,""):""},h.defer=function(e,t){var n;return y++,n=d(function(){delete g[n],i(e)},t||0),g[n]=!0,n},h.defer.cancel=function(e){return g[e]?(delete g[e],v(e),i(m),!0):!1}}function an(){this.$get=["$window","$log","$sniffer","$document",function(e,t,n,r){return new on(e,r,t,n)}]}function sn(){this.$get=function(){function e(e,n){function i(e){e!=f&&(p?p==e&&(p=e.n):p=e,o(e.n,e.p),o(e,f),f=e,f.n=null)}function o(e,t){e!=t&&(e&&(e.p=t),t&&(t.n=e))}if(e in t)throw r("$cacheFactory")("iid","CacheId '{0}' is already taken!",e);var a=0,s=h({},n,{id:e}),u={},c=n&&n.capacity||Number.MAX_VALUE,l={},f=null,p=null;return t[e]={put:function(e,t){if(!b(t)){if(c<Number.MAX_VALUE){var n=l[e]||(l[e]={key:e});i(n)}return e in u||a++,u[e]=t,a>c&&this.remove(p.key),t}},get:function(e){if(c<Number.MAX_VALUE){var t=l[e];if(!t)return;i(t)}return u[e]},remove:function(e){if(c<Number.MAX_VALUE){var t=l[e];if(!t)return;t==f&&(f=t.p),t==p&&(p=t.n),o(t.n,t.p),delete l[e]}delete u[e],a--},removeAll:function(){u={},a=0,l={},f=p=null},destroy:function(){u=null,s=null,l=null,delete t[e]},info:function(){return h({},s,{size:a})}}}var t={};return e.info=function(){var e={};return o(t,function(t,n){e[n]=t.info()}),e},e.get=function(e){return t[e]},e}}function un(){this.$get=["$cacheFactory",function(e){return e("templates")}]}function cn(e,r){function i(e,t,n){var r=/^\s*([@&]|=(\*?))(\??)\s*(\w*)\s*$/,i={};return o(e,function(e,o){var a=e.match(r);if(!a)throw Ro("iscp","Invalid {3} for directive '{0}'. Definition: {... {1}: '{2}' ...}",t,o,e,n?"controller bindings definition":"isolate scope definition");i[o]={mode:a[1][0],collection:"*"===a[2],optional:"?"===a[3],attrName:a[4]||o}}),i}function a(e,t){var n={isolateScope:null,bindToController:null};if(w(e.scope)&&(e.bindToController===!0?(n.bindToController=i(e.scope,t,!0),n.isolateScope={}):n.isolateScope=i(e.scope,t,!1)),w(e.bindToController)&&(n.bindToController=i(e.bindToController,t,!0)),w(n.bindToController)){var r=e.controller,o=e.controllerAs;if(!r)throw Ro("noctrl","Cannot bind to controller without directive '{0}'s controller.",t);if(!pn(r,o))throw Ro("noident","Cannot bind to controller without identifier for directive '{0}'.",t)}return n}function u(e){var t=e.charAt(0);if(!t||t!==xi(t))throw Ro("baddir","Directive name '{0}' is invalid. The first character must be a lowercase letter",e);if(e!==e.trim())throw Ro("baddir","Directive name '{0}' is invalid. The name should not contain leading or trailing whitespaces",e)}var c={},l="Directive",f=/^\s*directive\:\s*([\w\-]+)\s+(.*)$/,p=/(([\w\-]+)(?:\:([^;]+))?;?)/,y=N("ngSrc,ngSrcset,src,srcset"),_=/^(?:(\^\^?)?(\?)?(\^\^?)?)?/,E=/^(on[a-z]+|formaction)$/;this.directive=function T(t,n){return pt(t,"directive"),C(t)?(u(t),ht(n,"directiveFactory"),c.hasOwnProperty(t)||(c[t]=[],e.factory(t+l,["$injector","$exceptionHandler",function(e,n){var r=[];return o(c[t],function(i,o){try{var s=e.invoke(i);M(s)?s={compile:g(s)}:!s.compile&&s.link&&(s.compile=g(s.link)),s.priority=s.priority||0,s.index=o,s.name=s.name||t,s.require=s.require||s.controller&&s.name,s.restrict=s.restrict||"EA";var u=s.$$bindings=a(s,s.name);w(u.isolateScope)&&(s.$$isolateBindings=u.isolateScope),s.$$moduleName=i.$$moduleName,r.push(s)}catch(c){n(c)}}),r}])),c[t].push(n)):o(t,s(T)),this},this.aHrefSanitizationWhitelist=function(e){return x(e)?(r.aHrefSanitizationWhitelist(e),this):r.aHrefSanitizationWhitelist()},this.imgSrcSanitizationWhitelist=function(e){return x(e)?(r.imgSrcSanitizationWhitelist(e),this):r.imgSrcSanitizationWhitelist()};var S=!0;this.debugInfoEnabled=function(e){return x(e)?(S=e,this):S},this.$get=["$injector","$interpolate","$exceptionHandler","$templateRequest","$parse","$controller","$rootScope","$document","$sce","$animate","$$sanitizeUri",function(e,r,i,a,s,u,g,x,T,A,k){function R(e,t){try{e.addClass(t)}catch(n){}}function I(e,t,n,r,i){e instanceof Mi||(e=Mi(e)),o(e,function(t,n){t.nodeType==Yi&&t.nodeValue.match(/\S+/)&&(e[n]=Mi(t).wrap("<span></span>").parent()[0])});var a=B(e,t,e,n,r,i);I.$$addScopeClass(e);var s=null;return function(t,n,r){ht(t,"scope"),r=r||{};var i=r.parentBoundTranscludeFn,o=r.transcludeControllers,u=r.futureParentElement;i&&i.$$boundTransclude&&(i=i.$$boundTransclude),s||(s=D(u));var c;if(c="html"!==s?Mi(J(s,Mi("<div>").append(e).html())):n?po.clone.call(e):e,o)for(var l in o)c.data("$"+l+"Controller",o[l].instance);return I.$$addScopeInfo(c,t),n&&n(c,t),a&&a(t,c,c,i),c}}function D(e){var t=e&&e[0];return t?"foreignobject"!==O(t)&&t.toString().match(/SVG/)?"svg":"html":"html"}function B(e,t,r,i,o,a){function s(e,r,i,o){var a,s,u,c,l,h,f,p,v;if(d){var g=r.length;for(v=new Array(g),l=0;l<m.length;l+=3)f=m[l],v[f]=r[f]}else v=r;for(l=0,h=m.length;h>l;)if(u=v[m[l++]],a=m[l++],s=m[l++],a){if(a.scope){c=e.$new(),I.$$addScopeInfo(Mi(u),c);var y=a.$$destroyBindings;y&&(a.$$destroyBindings=null,c.$on("$destroyed",y))}else c=e;p=a.transcludeOnThisElement?V(e,a.transclude,o):!a.templateOnThisElement&&o?o:!o&&t?V(e,t):null,a(s,c,u,i,p,a)}else s&&s(e,u.childNodes,n,o)}for(var u,c,l,h,f,p,d,m=[],v=0;v<e.length;v++)u=new at,c=L(e[v],[],u,0===v?i:n,o),l=c.length?z(c,e[v],u,t,r,null,[],[],a):null,l&&l.scope&&I.$$addScopeClass(u.$$element),f=l&&l.terminal||!(h=e[v].childNodes)||!h.length?null:B(h,l?(l.transcludeOnThisElement||!l.templateOnThisElement)&&l.transclude:t),(l||f)&&(m.push(v,l,f),p=!0,d=d||l),a=null;return p?s:null}function V(e,t,n){var r=function(r,i,o,a,s){return r||(r=e.$new(!1,s),r.$$transcluded=!0),t(r,i,{parentBoundTranscludeFn:n,transcludeControllers:o,futureParentElement:a})};return r}function L(e,t,n,r,i){var o,a,s=e.nodeType,u=n.$attr;switch(s){case qi:G(t,ln(O(e)),"E",r,i);for(var c,l,h,d,m,v,g=e.attributes,y=0,b=g&&g.length;b>y;y++){var x=!1,_=!1;c=g[y],l=c.name,m=Ui(c.value),d=ln(l),(v=ft.test(d))&&(l=l.replace(Io,"").substr(8).replace(/_(.)/g,function(e,t){return t.toUpperCase()}));var E=d.replace(/(Start|End)$/,"");W(E)&&d===E+"Start"&&(x=l,_=l.substr(0,l.length-5)+"end",l=l.substr(0,l.length-6)),h=ln(l.toLowerCase()),u[h]=l,(v||!n.hasOwnProperty(h))&&(n[h]=m,jt(e,h)&&(n[h]=!0)),tt(e,t,m,h,v),G(t,h,"A",r,i,x,_)}if(a=e.className,w(a)&&(a=a.animVal),C(a)&&""!==a)for(;o=p.exec(a);)h=ln(o[2]),G(t,h,"C",r,i)&&(n[h]=Ui(o[3])),a=a.substr(o.index+o[0].length);break;case Yi:if(11===Si)for(;e.parentNode&&e.nextSibling&&e.nextSibling.nodeType===Yi;)e.nodeValue=e.nodeValue+e.nextSibling.nodeValue,e.parentNode.removeChild(e.nextSibling);Q(t,e.nodeValue);break;case Ki:try{o=f.exec(e.nodeValue),o&&(h=ln(o[1]),G(t,h,"M",r,i)&&(n[h]=Ui(o[2])))}catch(S){}}return t.sort(Y),t}function N(e,t,n){var r=[],i=0;if(t&&e.hasAttribute&&e.hasAttribute(t)){do{if(!e)throw Ro("uterdir","Unterminated attribute, found '{0}' but no matching '{1}' found.",t,n);e.nodeType==qi&&(e.hasAttribute(t)&&i++,e.hasAttribute(n)&&i--),r.push(e),e=e.nextSibling}while(i>0)}else r.push(e);return Mi(r)}function U(e,t,n){return function(r,i,o,a,s){return i=N(i[0],t,n),e(r,i,o,a,s)}}function z(e,r,o,a,s,c,l,h,f){function p(e,t,n,r){e&&(n&&(e=U(e,n,r)),e.require=g.require,e.directiveName=y,(k===g||g.$$isolateScope)&&(e=rt(e,{isolateScope:!0})),l.push(e)),t&&(n&&(t=U(t,n,r)),t.require=g.require,t.directiveName=y,(k===g||g.$$isolateScope)&&(t=rt(t,{isolateScope:!0})),h.push(t))}function d(e,t,n,r){var i;if(C(t)){var o=t.match(_),a=t.substring(o[0].length),s=o[1]||o[3],u="?"===o[2];if("^^"===s?n=n.parent():(i=r&&r[a],i=i&&i.instance),!i){var c="$"+a+"Controller";i=s?n.inheritedData(c):n.data(c)}if(!i&&!u)throw Ro("ctreq","Controller '{0}', required by directive '{1}', can't be found!",a,e)}else if(Oi(t)){i=[];for(var l=0,h=t.length;h>l;l++)i[l]=d(e,t[l],n,r)}return i||null}function m(e,t,n,r,i,o){var a=vt();for(var s in r){var c=r[s],l={$scope:c===k||c.$$isolateScope?i:o,$element:e,$attrs:t,$transclude:n},h=c.controller;"@"==h&&(h=t[c.name]);var f=u(h,l,!0,c.controllerAs);a[c.name]=f,O||e.data("$"+c.name+"Controller",f.instance)}return a}function v(e,t,i,a,s,u){function c(e,t,r){var i;return P(e)||(r=t,t=e,e=n),O&&(i=b),r||(r=O?w.parent():w),s(e,t,i,r,D)}var f,p,v,g,y,b,x,w,_;if(r===i?(_=o,w=o.$$element):(w=Mi(i),_=new at(w,o)),k&&(y=t.$new(!0)),s&&(x=c,x.$$boundTransclude=s),A&&(b=m(w,_,x,A,y,t)),k&&(I.$$addScopeInfo(w,y,!0,!(R&&(R===k||R===k.$$originalDirective))),I.$$addScopeClass(w,!0),y.$$isolateBindings=k.$$isolateBindings,ot(t,_,y,y.$$isolateBindings,k,y)),b){var C,E,S=k||T;S&&b[S.name]&&(C=S.$$bindings.bindToController,g=b[S.name],g&&g.identifier&&C&&(E=g,u.$$destroyBindings=ot(t,_,g.instance,C,S)));for(f in b){g=b[f];var M=g();M!==g.instance&&(g.instance=M,w.data("$"+f+"Controller",M),g===E&&(u.$$destroyBindings(),u.$$destroyBindings=ot(t,_,M,C,S)))}}for(f=0,p=l.length;p>f;f++)v=l[f],it(v,v.isolateScope?y:t,w,_,v.require&&d(v.directiveName,v.require,w,b),x);var D=t;for(k&&(k.template||null===k.templateUrl)&&(D=y),e&&e(D,i.childNodes,n,s),f=h.length-1;f>=0;f--)v=h[f],it(v,v.isolateScope?y:t,w,_,v.require&&d(v.directiveName,v.require,w,b),x)}f=f||{};for(var g,y,b,x,E,S=-Number.MAX_VALUE,T=f.newScopeDirective,A=f.controllerDirectives,k=f.newIsolateScopeDirective,R=f.templateDirective,D=f.nonTlbTranscludeDirective,B=!1,V=!1,O=f.hasElementTranscludeDirective,F=o.$$element=Mi(r),z=c,$=a,G=0,W=e.length;W>G;G++){g=e[G];var Y=g.$$start,Q=g.$$end;if(Y&&(F=N(r,Y,Q)),b=n,S>g.priority)break;if((E=g.scope)&&(g.templateUrl||(w(E)?(K("new/isolated scope",k||T,g,F),k=g):K("new/isolated scope",k,g,F)),T=T||g),y=g.name,!g.templateUrl&&g.controller&&(E=g.controller,A=A||vt(),K("'"+y+"' controller",A[y],g,F),A[y]=g),(E=g.transclude)&&(B=!0,g.$$tlb||(K("transclusion",D,g,F),D=g),"element"==E?(O=!0,S=g.priority,b=F,F=o.$$element=Mi(t.createComment(" "+y+": "+o[y]+" ")),r=F[0],nt(s,j(b),r),$=I(b,a,S,z&&z.name,{nonTlbTranscludeDirective:D})):(b=Mi(Pt(r)).contents(),F.empty(),$=I(b,a))),g.template)if(V=!0,K("template",R,g,F),R=g,E=M(g.template)?g.template(F,o):g.template,E=lt(E),g.replace){if(z=g,b=Ct(E)?[]:fn(J(g.templateNamespace,Ui(E))),r=b[0],1!=b.length||r.nodeType!==qi)throw Ro("tplrt","Template for directive '{0}' must have exactly one root element. {1}",y,"");nt(s,F,r);var et={$attr:{}},tt=L(r,[],et),st=e.splice(G+1,e.length-(G+1));k&&H(tt),e=e.concat(tt).concat(st),q(o,et),W=e.length}else F.html(E);if(g.templateUrl)V=!0,K("template",R,g,F),R=g,g.replace&&(z=g),v=X(e.splice(G,e.length-G),F,o,s,B&&$,l,h,{controllerDirectives:A,newScopeDirective:T!==g&&T,newIsolateScopeDirective:k,templateDirective:R,nonTlbTranscludeDirective:D}),W=e.length;else if(g.compile)try{x=g.compile(F,o,$),M(x)?p(null,x,Y,Q):x&&p(x.pre,x.post,Y,Q)}catch(ut){i(ut,Z(F))}g.terminal&&(v.terminal=!0,S=Math.max(S,g.priority))}return v.scope=T&&T.scope===!0,v.transcludeOnThisElement=B,v.templateOnThisElement=V,v.transclude=$,f.hasElementTranscludeDirective=O,v}function H(e){for(var t=0,n=e.length;n>t;t++)e[t]=d(e[t],{$$isolateScope:!0})}function G(t,n,r,o,a,s,u){if(n===a)return null;var h=null;if(c.hasOwnProperty(n))for(var f,p=e.get(n+l),m=0,v=p.length;v>m;m++)try{f=p[m],(b(o)||o>f.priority)&&-1!=f.restrict.indexOf(r)&&(s&&(f=d(f,{$$start:s,$$end:u})),t.push(f),h=f)}catch(g){i(g)}return h}function W(t){if(c.hasOwnProperty(t))for(var n,r=e.get(t+l),i=0,o=r.length;o>i;i++)if(n=r[i],n.multiElement)return!0;return!1}function q(e,t){var n=t.$attr,r=e.$attr,i=e.$$element;o(e,function(r,i){"$"!=i.charAt(0)&&(t[i]&&t[i]!==r&&(r+=("style"===i?";":" ")+t[i]),e.$set(i,r,!0,n[i]))}),o(t,function(t,o){"class"==o?(R(i,t),e["class"]=(e["class"]?e["class"]+" ":"")+t):"style"==o?(i.attr("style",i.attr("style")+";"+t),e.style=(e.style?e.style+";":"")+t):"$"==o.charAt(0)||e.hasOwnProperty(o)||(e[o]=t,r[o]=n[o])})}function X(e,t,n,r,i,s,u,c){var l,h,f=[],p=t[0],m=e.shift(),v=d(m,{templateUrl:null,transclude:null,replace:null,$$originalDirective:m}),g=M(m.templateUrl)?m.templateUrl(t,n):m.templateUrl,y=m.templateNamespace;return t.empty(),a(g).then(function(a){var d,b,x,_;if(a=lt(a),m.replace){if(x=Ct(a)?[]:fn(J(y,Ui(a))),d=x[0],1!=x.length||d.nodeType!==qi)throw Ro("tplrt","Template for directive '{0}' must have exactly one root element. {1}",m.name,g);b={$attr:{}},nt(r,t,d);var C=L(d,[],b);w(m.scope)&&H(C),e=C.concat(e),q(n,b)}else d=p,t.html(a);for(e.unshift(v),l=z(e,d,n,i,t,m,s,u,c),o(r,function(e,n){e==d&&(r[n]=t[0])}),h=B(t[0].childNodes,i);f.length;){var E=f.shift(),S=f.shift(),M=f.shift(),T=f.shift(),A=t[0];if(!E.$$destroyed){if(S!==p){var P=S.className;c.hasElementTranscludeDirective&&m.replace||(A=Pt(d)),nt(M,Mi(S),A),R(Mi(A),P)}_=l.transcludeOnThisElement?V(E,l.transclude,T):T,l(h,E,A,r,_,l)}}f=null}),function(e,t,n,r,i){var o=i;t.$$destroyed||(f?f.push(t,n,r,o):(l.transcludeOnThisElement&&(o=V(t,l.transclude,i)),l(h,t,n,r,o,l)))}}function Y(e,t){var n=t.priority-e.priority;return 0!==n?n:e.name!==t.name?e.name<t.name?-1:1:e.index-t.index}function K(e,t,n,r){function i(e){return e?" (module: "+e+")":""}if(t)throw Ro("multidir","Multiple directives [{0}{1}, {2}{3}] asking for {4} on: {5}",t.name,i(t.$$moduleName),n.name,i(n.$$moduleName),e,Z(r))}function Q(e,t){var n=r(t,!0);n&&e.push({priority:0,compile:function(e){var t=e.parent(),r=!!t.length;return r&&I.$$addBindingClass(t),function(e,t){var i=t.parent();r||I.$$addBindingClass(i),I.$$addBindingInfo(i,n.expressions),e.$watch(n,function(e){t[0].nodeValue=e})}}})}function J(e,n){switch(e=xi(e||"html")){case"svg":case"math":var r=t.createElement("div");return r.innerHTML="<"+e+">"+n+"</"+e+">",r.childNodes[0].childNodes;default:return n}}function et(e,t){if("srcdoc"==t)return T.HTML;var n=O(e);return"xlinkHref"==t||"form"==n&&"action"==t||"img"!=n&&("src"==t||"ngSrc"==t)?T.RESOURCE_URL:void 0}function tt(e,t,n,i,o){var a=et(e,i);o=y[i]||o;var s=r(n,!0,a,o);if(s){if("multiple"===i&&"select"===O(e))throw Ro("selmulti","Binding to the 'multiple' attribute is not supported. Element: {0}",Z(e));t.push({priority:100,compile:function(){return{pre:function(e,t,u){var c=u.$$observers||(u.$$observers=vt());if(E.test(i))throw Ro("nodomevents","Interpolations for HTML DOM event attributes are disallowed. Please use the ng- versions (such as ng-click instead of onclick) instead.");var l=u[i];l!==n&&(s=l&&r(l,!0,a,o),n=l),s&&(u[i]=s(e),(c[i]||(c[i]=[])).$$inter=!0,(u.$$observers&&u.$$observers[i].$$scope||e).$watch(s,function(e,t){"class"===i&&e!=t?u.$updateClass(e,t):u.$set(i,e)}))}}}})}}function nt(e,n,r){var i,o,a=n[0],s=n.length,u=a.parentNode;if(e)for(i=0,o=e.length;o>i;i++)if(e[i]==a){e[i++]=r;for(var c=i,l=c+s-1,h=e.length;h>c;c++,l++)h>l?e[c]=e[l]:delete e[c];e.length-=s-1,e.context===a&&(e.context=r);break}u&&u.replaceChild(r,a);var f=t.createDocumentFragment();f.appendChild(a),Mi.hasData(a)&&(Mi(r).data(Mi(a).data()),Ti?(Ni=!0,Ti.cleanData([a])):delete Mi.cache[a[Mi.expando]]);for(var p=1,d=n.length;d>p;p++){var m=n[p];Mi(m).remove(),f.appendChild(m),delete n[p]}n[0]=r,n.length=1}function rt(e,t){return h(function(){return e.apply(null,arguments)},e,t)}function it(e,t,n,r,o,a){try{e(t,n,r,o,a)}catch(s){i(s,Z(n))}}function ot(e,t,n,i,a,u){var c;o(i,function(i,o){var u,l,h,f,p=i.attrName,d=i.optional,v=i.mode;switch(v){case"@":d||wi.call(t,p)||(n[o]=t[p]=void 0),t.$observe(p,function(e){C(e)&&(n[o]=e)}),t.$$observers[p].$$scope=e,C(t[p])&&(n[o]=r(t[p])(e));break;case"=":if(!wi.call(t,p)){if(d)break;t[p]=void 0}if(d&&!t[p])break;l=s(t[p]),f=l.literal?$:function(e,t){return e===t||e!==e&&t!==t},h=l.assign||function(){throw u=n[o]=l(e),Ro("nonassign","Expression '{0}' used with directive '{1}' is non-assignable!",t[p],a.name)},u=n[o]=l(e);var g=function(t){return f(t,n[o])||(f(t,u)?h(e,t=n[o]):n[o]=t),u=t};g.$stateful=!0;var y;y=i.collection?e.$watchCollection(t[p],g):e.$watch(s(t[p],g),null,l.literal),c=c||[],c.push(y);break;case"&":if(l=t.hasOwnProperty(p)?s(t[p]):m,l===m&&d)break;n[o]=function(t){return l(e,t)}}});var l=c?function(){for(var e=0,t=c.length;t>e;++e)c[e]()}:m;return u&&l!==m?(u.$on("$destroy",l),m):l}var at=function(e,t){if(t){var n,r,i,o=Object.keys(t);for(n=0,r=o.length;r>n;n++)i=o[n],this[i]=t[i]}else this.$attr={};this.$$element=e};at.prototype={$normalize:ln,$addClass:function(e){e&&e.length>0&&A.addClass(this.$$element,e)},$removeClass:function(e){e&&e.length>0&&A.removeClass(this.$$element,e)},$updateClass:function(e,t){var n=hn(e,t);n&&n.length&&A.addClass(this.$$element,n);var r=hn(t,e);r&&r.length&&A.removeClass(this.$$element,r)},$set:function(e,t,n,r){var a,s=this.$$element[0],u=jt(s,e),c=Gt(e),l=e;if(u?(this.$$element.prop(e,t),r=u):c&&(this[c]=t,l=c),this[e]=t,r?this.$attr[e]=r:(r=this.$attr[e],r||(this.$attr[e]=r=ct(e,"-"))),a=O(this.$$element),"a"===a&&"href"===e||"img"===a&&"src"===e)this[e]=t=k(t,"src"===e);else if("img"===a&&"srcset"===e){for(var h="",f=Ui(t),p=/(\s+\d+x\s*,|\s+\d+w\s*,|\s+,|,\s+)/,d=/\s/.test(f)?p:/(,)/,m=f.split(d),v=Math.floor(m.length/2),g=0;v>g;g++){var y=2*g;h+=k(Ui(m[y]),!0),h+=" "+Ui(m[y+1])}var x=Ui(m[2*g]).split(/\s/);h+=k(Ui(x[0]),!0),2===x.length&&(h+=" "+Ui(x[1])),this[e]=t=h}n!==!1&&(null===t||b(t)?this.$$element.removeAttr(r):this.$$element.attr(r,t));var w=this.$$observers;w&&o(w[l],function(e){try{e(t)}catch(n){i(n)}})},$observe:function(e,t){var n=this,r=n.$$observers||(n.$$observers=vt()),i=r[e]||(r[e]=[]);return i.push(t),g.$evalAsync(function(){i.$$inter||!n.hasOwnProperty(e)||b(n[e])||t(n[e])}),function(){F(i,t)}}};var st=r.startSymbol(),ut=r.endSymbol(),lt="{{"==st||"}}"==ut?v:function(e){return e.replace(/\{\{/g,st).replace(/}}/g,ut)},ft=/^ngAttr[A-Z]/;return I.$$addBindingInfo=S?function(e,t){var n=e.data("$binding")||[];Oi(t)?n=n.concat(t):n.push(t),e.data("$binding",n)}:m,I.$$addBindingClass=S?function(e){R(e,"ng-binding")}:m,I.$$addScopeInfo=S?function(e,t,n,r){var i=n?r?"$isolateScopeNoTemplate":"$isolateScope":"$scope";e.data(i,t)}:m,I.$$addScopeClass=S?function(e,t){R(e,t?"ng-isolate-scope":"ng-scope")}:m,I}]}function ln(e){return _t(e.replace(Io,""))}function hn(e,t){var n="",r=e.split(/\s+/),i=t.split(/\s+/);e:for(var o=0;o<r.length;o++){for(var a=r[o],s=0;s<i.length;s++)if(a==i[s])continue e;n+=(n.length>0?" ":"")+a}return n}function fn(e){e=Mi(e);var t=e.length;if(1>=t)return e;for(;t--;){var n=e[t];n.nodeType===Ki&&ki.call(e,t,1)}return e}function pn(e,t){if(t&&C(t))return t;if(C(e)){var n=Bo.exec(e);if(n)return n[3]}}function dn(){var e={},t=!1;this.register=function(t,n){pt(t,"controller"),w(t)?h(e,t):e[t]=n},this.allowGlobals=function(){t=!0},this.$get=["$injector","$window",function(i,o){function a(e,t,n,i){if(!e||!w(e.$scope))throw r("$controller")("noscp","Cannot export controller '{0}' as '{1}'! No $scope object provided via `locals`.",i,t);e.$scope[t]=n}return function(r,s,u,c){var l,f,p,d;if(u=u===!0,c&&C(c)&&(d=c),C(r)){if(f=r.match(Bo),!f)throw Do("ctrlfmt","Badly formed controller string '{0}'. Must match `__name__ as __id__` or `__name__`.",r);p=f[1],d=d||f[3],r=e.hasOwnProperty(p)?e[p]:dt(s.$scope,p,!0)||(t?dt(o,p,!0):n),ft(r,p,!0)}if(u){var m=(Oi(r)?r[r.length-1]:r).prototype;l=Object.create(m||null),d&&a(s,d,l,p||r.name);var v;return v=h(function(){var e=i.invoke(r,l,s,p);return e!==l&&(w(e)||M(e))&&(l=e,d&&a(s,d,l,p||r.name)),l},{instance:l,identifier:d})}return l=i.instantiate(r,s,p),d&&a(s,d,l,p||r.name),l}}]}function mn(){this.$get=["$window",function(e){return Mi(e.document)}]}function vn(){this.$get=["$log",function(e){return function(){e.error.apply(e,arguments)}}]}function gn(e){return w(e)?S(e)?e.toISOString():q(e):e}function yn(){this.$get=function(){return function(e){if(!e)return"";var t=[];return a(e,function(e,n){null===e||b(e)||(Oi(e)?o(e,function(e){t.push(rt(n)+"="+rt(gn(e)))}):t.push(rt(n)+"="+rt(gn(e))))}),t.join("&")}}}function bn(){this.$get=function(){return function(e){function t(e,r,i){null===e||b(e)||(Oi(e)?o(e,function(e,n){t(e,r+"["+(w(e)?n:"")+"]")}):w(e)&&!S(e)?a(e,function(e,n){t(e,r+(i?"":"[")+n+(i?"":"]"))}):n.push(rt(r)+"="+rt(gn(e))))}if(!e)return"";var n=[];return t(e,"",!0),n.join("&")}}}function xn(e,t){if(C(e)){var n=e.replace(Uo,"").trim();if(n){var r=t("Content-Type");(r&&0===r.indexOf(Lo)||wn(n))&&(e=X(n))}}return e}function wn(e){var t=e.match(Oo);return t&&Fo[t[0]].test(e)}function _n(e){function t(e,t){e&&(r[e]=r[e]?r[e]+", "+t:t)}var n,r=vt();return C(e)?o(e.split("\n"),function(e){n=e.indexOf(":"),t(xi(Ui(e.substr(0,n))),Ui(e.substr(n+1)))}):w(e)&&o(e,function(e,n){t(xi(n),Ui(e))}),r}function Cn(e){var t;return function(n){if(t||(t=_n(e)),n){var r=t[xi(n)];return void 0===r&&(r=null),r}return t}}function En(e,t,n,r){return M(r)?r(e,t,n):(o(r,function(r){e=r(e,t,n)}),e)}function Sn(e){return e>=200&&300>e}function Mn(){var e=this.defaults={transformResponse:[xn],transformRequest:[function(e){return!w(e)||k(e)||I(e)||R(e)?e:q(e)}],headers:{common:{Accept:"application/json, text/plain, */*"},post:z(No),put:z(No),patch:z(No)},xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",paramSerializer:"$httpParamSerializer"},t=!1;this.useApplyAsync=function(e){return x(e)?(t=!!e,this):t};var i=!0;this.useLegacyPromiseExtensions=function(e){return x(e)?(i=!!e,this):i};var a=this.interceptors=[];this.$get=["$httpBackend","$$cookieReader","$cacheFactory","$rootScope","$q","$injector",function(s,u,c,l,f,p){function d(t){function a(e){var t=h({},e);return t.data=e.data?En(e.data,e.headers,e.status,c.transformResponse):e.data,Sn(e.status)?t:f.reject(t)}function s(e,t){var n,r={};return o(e,function(e,i){M(e)?(n=e(t),null!=n&&(r[i]=n)):r[i]=e}),r}function u(t){var n,r,i,o=e.headers,a=h({},t.headers);o=h({},o.common,o[xi(t.method)]);e:for(n in o){r=xi(n);for(i in a)if(xi(i)===r)continue e;a[n]=o[n]}return s(a,z(t))}if(!Vi.isObject(t))throw r("$http")("badreq","Http request configuration must be an object. Received: {0}",t);var c=h({method:"get",transformRequest:e.transformRequest,transformResponse:e.transformResponse,paramSerializer:e.paramSerializer},t);c.headers=u(t),c.method=_i(c.method),c.paramSerializer=C(c.paramSerializer)?p.get(c.paramSerializer):c.paramSerializer;var l=function(t){var r=t.headers,i=En(t.data,Cn(r),n,t.transformRequest);return b(i)&&o(r,function(e,t){"content-type"===xi(t)&&delete r[t]}),b(t.withCredentials)&&!b(e.withCredentials)&&(t.withCredentials=e.withCredentials),g(t,i).then(a,a)},d=[l,n],m=f.when(c);for(o(E,function(e){(e.request||e.requestError)&&d.unshift(e.request,e.requestError),(e.response||e.responseError)&&d.push(e.response,e.responseError)});d.length;){var v=d.shift(),y=d.shift();m=m.then(v,y)}return i?(m.success=function(e){return ft(e,"fn"),m.then(function(t){e(t.data,t.status,t.headers,c)}),m},m.error=function(e){return ft(e,"fn"),m.then(null,function(t){e(t.data,t.status,t.headers,c)}),m}):(m.success=$o("success"),m.error=$o("error")),m}function m(){o(arguments,function(e){d[e]=function(t,n){return d(h({},n||{},{method:e,url:t}))}})}function v(){o(arguments,function(e){d[e]=function(t,n,r){return d(h({},r||{},{method:e,url:t,data:n}))}})}function g(r,i){function o(e,n,r,i){function o(){a(n,e,r,i)}p&&(Sn(e)?p.put(E,[e,n,_n(r),i]):p.remove(E)),t?l.$applyAsync(o):(o(),l.$$phase||l.$apply())}function a(e,t,n,i){t=t>=-1?t:0,(Sn(t)?v.resolve:v.reject)({data:e,status:t,headers:Cn(n),config:r,statusText:i})}function c(e){a(e.data,e.status,z(e.headers()),e.statusText)}function h(){var e=d.pendingRequests.indexOf(r);-1!==e&&d.pendingRequests.splice(e,1)}var p,m,v=f.defer(),g=v.promise,C=r.headers,E=y(r.url,r.paramSerializer(r.params));if(d.pendingRequests.push(r),g.then(h,h),!r.cache&&!e.cache||r.cache===!1||"GET"!==r.method&&"JSONP"!==r.method||(p=w(r.cache)?r.cache:w(e.cache)?e.cache:_),p&&(m=p.get(E),x(m)?B(m)?m.then(c,c):Oi(m)?a(m[1],m[0],z(m[2]),m[3]):a(m,200,{},"OK"):p.put(E,g)),b(m)){var S=Tr(r.url)?u()[r.xsrfCookieName||e.xsrfCookieName]:n;S&&(C[r.xsrfHeaderName||e.xsrfHeaderName]=S),s(r.method,E,i,o,C,r.timeout,r.withCredentials,r.responseType)}return g}function y(e,t){return t.length>0&&(e+=(-1==e.indexOf("?")?"?":"&")+t),e}var _=c("$http");e.paramSerializer=C(e.paramSerializer)?p.get(e.paramSerializer):e.paramSerializer;var E=[];return o(a,function(e){E.unshift(C(e)?p.get(e):p.invoke(e))}),d.pendingRequests=[],m("get","delete","head","jsonp"),v("post","put","patch"),d.defaults=e,d}]}function Tn(){this.$get=function(){return function(){return new e.XMLHttpRequest}}}function An(){this.$get=["$browser","$window","$document","$xhrFactory",function(e,t,n,r){return Pn(e,r,e.defer,t.angular.callbacks,n[0])}]}function Pn(e,t,n,r,i){function a(e,t,n){var o=i.createElement("script"),a=null;return o.type="text/javascript",o.src=e,o.async=!0,a=function(e){ro(o,"load",a),ro(o,"error",a),i.body.removeChild(o),o=null;var s=-1,u="unknown";e&&("load"!==e.type||r[t].called||(e={type:"error"}),u=e.type,s="error"===e.type?404:200),n&&n(s,u)},no(o,"load",a),no(o,"error",a),i.body.appendChild(o),a}return function(i,s,u,c,l,h,f,p){function d(){y&&y(),w&&w.abort()}function v(t,r,i,o,a){x(E)&&n.cancel(E),y=w=null,t(r,i,o,a),e.$$completeOutstandingRequest(m)}if(e.$$incOutstandingRequestCount(),s=s||e.url(),"jsonp"==xi(i)){var g="_"+(r.counter++).toString(36);r[g]=function(e){r[g].data=e,r[g].called=!0};var y=a(s.replace("JSON_CALLBACK","angular.callbacks."+g),g,function(e,t){v(c,e,r[g].data,"",t),r[g]=m})}else{var w=t(i,s);w.open(i,s,!0),o(l,function(e,t){x(e)&&w.setRequestHeader(t,e)}),w.onload=function(){var e=w.statusText||"",t="response"in w?w.response:w.responseText,n=1223===w.status?204:w.status;0===n&&(n=t?200:"file"==Mr(s).protocol?404:0),v(c,n,t,w.getAllResponseHeaders(),e)};var _=function(){v(c,-1,null,null,"")};if(w.onerror=_,w.onabort=_,f&&(w.withCredentials=!0),p)try{w.responseType=p}catch(C){if("json"!==p)throw C}w.send(b(u)?null:u)}if(h>0)var E=n(d,h);else B(h)&&h.then(d)}}function kn(){var e="{{",t="}}";this.startSymbol=function(t){return t?(e=t,this):e},this.endSymbol=function(e){return e?(t=e,this):t},this.$get=["$parse","$exceptionHandler","$sce",function(n,r,i){function o(e){return"\\\\\\"+e}function a(n){return n.replace(f,e).replace(p,t)}function s(e){if(null==e)return"";switch(typeof e){case"string":break;case"number":e=""+e;break;default:e=q(e)}return e}function u(o,u,f,p){function d(e){try{return e=A(e),p&&!x(e)?e:s(e)}catch(t){r(Ho.interr(o,t))}}p=!!p;for(var m,v,g,y=0,w=[],_=[],C=o.length,E=[],S=[];C>y;){if(-1==(m=o.indexOf(e,y))||-1==(v=o.indexOf(t,m+c))){y!==C&&E.push(a(o.substring(y)));break}y!==m&&E.push(a(o.substring(y,m))),g=o.substring(m+c,v),w.push(g),_.push(n(g,d)),y=v+l,S.push(E.length),E.push("")}if(f&&E.length>1&&Ho.throwNoconcat(o),!u||w.length){var T=function(e){for(var t=0,n=w.length;n>t;t++){if(p&&b(e[t]))return;E[S[t]]=e[t]}return E.join("")},A=function(e){return f?i.getTrusted(f,e):i.valueOf(e)};return h(function(e){var t=0,n=w.length,i=new Array(n);try{for(;n>t;t++)i[t]=_[t](e);return T(i)}catch(a){r(Ho.interr(o,a))}},{exp:o,expressions:w,$$watchDelegate:function(e,t){var n;return e.$watchGroup(_,function(r,i){var o=T(r);M(t)&&t.call(this,o,r!==i?n:o,e),n=o})}})}}var c=e.length,l=t.length,f=new RegExp(e.replace(/./g,o),"g"),p=new RegExp(t.replace(/./g,o),"g");return u.startSymbol=function(){return e},u.endSymbol=function(){return t},u}]}function Rn(){this.$get=["$rootScope","$window","$q","$$q",function(e,t,n,r){function i(i,a,s,u){var c=arguments.length>4,l=c?j(arguments,4):[],h=t.setInterval,f=t.clearInterval,p=0,d=x(u)&&!u,m=(d?r:n).defer(),v=m.promise;return s=x(s)?s:0,v.then(null,null,c?function(){i.apply(null,l)}:i),v.$$intervalId=h(function(){m.notify(p++),s>0&&p>=s&&(m.resolve(p),f(v.$$intervalId),delete o[v.$$intervalId]),d||e.$apply()},a),o[v.$$intervalId]=m,v}var o={};return i.cancel=function(e){return e&&e.$$intervalId in o?(o[e.$$intervalId].reject("canceled"),t.clearInterval(e.$$intervalId),delete o[e.$$intervalId],!0):!1},i}]}function In(e){for(var t=e.split("/"),n=t.length;n--;)t[n]=nt(t[n]);return t.join("/")}function Dn(e,t){var n=Mr(e);t.$$protocol=n.protocol,t.$$host=n.hostname,t.$$port=p(n.port)||Go[n.protocol]||null}function Bn(e,t){var n="/"!==e.charAt(0);n&&(e="/"+e);var r=Mr(e);t.$$path=decodeURIComponent(n&&"/"===r.pathname.charAt(0)?r.pathname.substring(1):r.pathname),t.$$search=et(r.search),t.$$hash=decodeURIComponent(r.hash),t.$$path&&"/"!=t.$$path.charAt(0)&&(t.$$path="/"+t.$$path)}function Vn(e,t){return 0===t.indexOf(e)?t.substr(e.length):void 0}function Ln(e){var t=e.indexOf("#");return-1==t?e:e.substr(0,t)}function Nn(e){return e.replace(/(#.+)|#$/,"$1")}function On(e){return e.substr(0,Ln(e).lastIndexOf("/")+1)}function Fn(e){return e.substring(0,e.indexOf("/",e.indexOf("//")+2))}function Un(e,t,n){this.$$html5=!0,n=n||"",Dn(e,this),this.$$parse=function(e){var n=Vn(t,e);if(!C(n))throw Wo("ipthprfx",'Invalid url "{0}", missing path prefix "{1}".',e,t);Bn(n,this),this.$$path||(this.$$path="/"),this.$$compose()},this.$$compose=function(){var e=tt(this.$$search),n=this.$$hash?"#"+nt(this.$$hash):"";this.$$url=In(this.$$path)+(e?"?"+e:"")+n,this.$$absUrl=t+this.$$url.substr(1)},this.$$parseLinkUrl=function(r,i){if(i&&"#"===i[0])return this.hash(i.slice(1)),!0;var o,a,s;return x(o=Vn(e,r))?(a=o,s=x(o=Vn(n,o))?t+(Vn("/",o)||o):e+a):x(o=Vn(t,r))?s=t+o:t==r+"/"&&(s=t),s&&this.$$parse(s),!!s}}function zn(e,t,n){Dn(e,this),this.$$parse=function(r){function i(e,t,n){var r,i=/^\/[A-Z]:(\/.*)/;return 0===t.indexOf(n)&&(t=t.replace(n,"")),i.exec(t)?e:(r=i.exec(e),r?r[1]:e)}var o,a=Vn(e,r)||Vn(t,r);b(a)||"#"!==a.charAt(0)?this.$$html5?o=a:(o="",b(a)&&(e=r,this.replace())):(o=Vn(n,a),b(o)&&(o=a)),Bn(o,this),this.$$path=i(this.$$path,o,e),this.$$compose()},this.$$compose=function(){var t=tt(this.$$search),r=this.$$hash?"#"+nt(this.$$hash):"";this.$$url=In(this.$$path)+(t?"?"+t:"")+r,this.$$absUrl=e+(this.$$url?n+this.$$url:"")},this.$$parseLinkUrl=function(t){return Ln(e)==Ln(t)?(this.$$parse(t),!0):!1}}function $n(e,t,n){this.$$html5=!0,zn.apply(this,arguments),this.$$parseLinkUrl=function(r,i){if(i&&"#"===i[0])return this.hash(i.slice(1)),!0;var o,a;return e==Ln(r)?o=r:(a=Vn(t,r))?o=e+n+a:t===r+"/"&&(o=t),o&&this.$$parse(o),!!o},this.$$compose=function(){var t=tt(this.$$search),r=this.$$hash?"#"+nt(this.$$hash):"";this.$$url=In(this.$$path)+(t?"?"+t:"")+r,this.$$absUrl=e+n+this.$$url}}function Hn(e){return function(){return this[e]}}function jn(e,t){return function(n){return b(n)?this[e]:(this[e]=t(n),this.$$compose(),this)}}function Gn(){var e="",t={enabled:!1,requireBase:!0,rewriteLinks:!0};this.hashPrefix=function(t){return x(t)?(e=t,this):e},this.html5Mode=function(e){return D(e)?(t.enabled=e,this):w(e)?(D(e.enabled)&&(t.enabled=e.enabled),D(e.requireBase)&&(t.requireBase=e.requireBase),D(e.rewriteLinks)&&(t.rewriteLinks=e.rewriteLinks),this):t},this.$get=["$rootScope","$browser","$sniffer","$rootElement","$window",function(n,r,i,o,a){function s(e,t,n){var i=c.url(),o=c.$$state;try{r.url(e,t,n),c.$$state=r.state()}catch(a){throw c.url(i),c.$$state=o,a}}function u(e,t){n.$broadcast("$locationChangeSuccess",c.absUrl(),e,c.$$state,t)}var c,l,h,f=r.baseHref(),p=r.url();if(t.enabled){if(!f&&t.requireBase)throw Wo("nobase","$location in HTML5 mode requires a <base> tag to be present!");h=Fn(p)+(f||"/"),l=i.history?Un:$n}else h=Ln(p),l=zn;var d=On(h);c=new l(h,d,"#"+e),c.$$parseLinkUrl(p,p),c.$$state=r.state();var m=/^\s*(javascript|mailto):/i;o.on("click",function(e){if(t.rewriteLinks&&!e.ctrlKey&&!e.metaKey&&!e.shiftKey&&2!=e.which&&2!=e.button){for(var i=Mi(e.target);"a"!==O(i[0]);)if(i[0]===o[0]||!(i=i.parent())[0])return;var s=i.prop("href"),u=i.attr("href")||i.attr("xlink:href");w(s)&&"[object SVGAnimatedString]"===s.toString()&&(s=Mr(s.animVal).href),m.test(s)||!s||i.attr("target")||e.isDefaultPrevented()||c.$$parseLinkUrl(s,u)&&(e.preventDefault(),c.absUrl()!=r.url()&&(n.$apply(),a.angular["ff-684208-preventDefault"]=!0))}}),Nn(c.absUrl())!=Nn(p)&&r.url(c.absUrl(),!0);var v=!0;return r.onUrlChange(function(e,t){return b(Vn(d,e))?(a.location.href=e,void 0):(n.$evalAsync(function(){var r,i=c.absUrl(),o=c.$$state;c.$$parse(e),c.$$state=t,r=n.$broadcast("$locationChangeStart",e,i,t,o).defaultPrevented,c.absUrl()===e&&(r?(c.$$parse(i),c.$$state=o,s(i,!1,o)):(v=!1,u(i,o)))
}),n.$$phase||n.$digest(),void 0)}),n.$watch(function(){var e=Nn(r.url()),t=Nn(c.absUrl()),o=r.state(),a=c.$$replace,l=e!==t||c.$$html5&&i.history&&o!==c.$$state;(v||l)&&(v=!1,n.$evalAsync(function(){var t=c.absUrl(),r=n.$broadcast("$locationChangeStart",t,e,c.$$state,o).defaultPrevented;c.absUrl()===t&&(r?(c.$$parse(e),c.$$state=o):(l&&s(t,a,o===c.$$state?null:c.$$state),u(e,o)))})),c.$$replace=!1}),c}]}function Wn(){var e=!0,t=this;this.debugEnabled=function(t){return x(t)?(e=t,this):e},this.$get=["$window",function(n){function r(e){return e instanceof Error&&(e.stack?e=e.message&&-1===e.stack.indexOf(e.message)?"Error: "+e.message+"\n"+e.stack:e.stack:e.sourceURL&&(e=e.message+"\n"+e.sourceURL+":"+e.line)),e}function i(e){var t=n.console||{},i=t[e]||t.log||m,a=!1;try{a=!!i.apply}catch(s){}return a?function(){var e=[];return o(arguments,function(t){e.push(r(t))}),i.apply(t,e)}:function(e,t){i(e,null==t?"":t)}}return{log:i("log"),info:i("info"),warn:i("warn"),error:i("error"),debug:function(){var n=i("debug");return function(){e&&n.apply(t,arguments)}}()}}]}function qn(e,t){if("__defineGetter__"===e||"__defineSetter__"===e||"__lookupGetter__"===e||"__lookupSetter__"===e||"__proto__"===e)throw Xo("isecfld","Attempting to access a disallowed field in Angular expressions! Expression: {0}",t);return e}function Xn(e,t){if(e+="",!C(e))throw Xo("iseccst","Cannot convert object to primitive value! Expression: {0}",t);return e}function Yn(e,t){if(e){if(e.constructor===e)throw Xo("isecfn","Referencing Function in Angular expressions is disallowed! Expression: {0}",t);if(e.window===e)throw Xo("isecwindow","Referencing the Window in Angular expressions is disallowed! Expression: {0}",t);if(e.children&&(e.nodeName||e.prop&&e.attr&&e.find))throw Xo("isecdom","Referencing DOM nodes in Angular expressions is disallowed! Expression: {0}",t);if(e===Object)throw Xo("isecobj","Referencing Object in Angular expressions is disallowed! Expression: {0}",t)}return e}function Kn(e,t){if(e){if(e.constructor===e)throw Xo("isecfn","Referencing Function in Angular expressions is disallowed! Expression: {0}",t);if(e===Yo||e===Ko||e===Qo)throw Xo("isecff","Referencing call, apply or bind in Angular expressions is disallowed! Expression: {0}",t)}}function Qn(e,t){if(e&&(e===0..constructor||e===(!1).constructor||e==="".constructor||e==={}.constructor||e===[].constructor||e===Function.constructor))throw Xo("isecaf","Assigning to a constructor is disallowed! Expression: {0}",t)}function Zn(e,t){return"undefined"!=typeof e?e:t}function Jn(e,t){return"undefined"==typeof e?t:"undefined"==typeof t?e:e+t}function er(e,t){var n=e(t);return!n.$stateful}function tr(e,t){var n,r;switch(e.type){case ta.Program:n=!0,o(e.body,function(e){tr(e.expression,t),n=n&&e.expression.constant}),e.constant=n;break;case ta.Literal:e.constant=!0,e.toWatch=[];break;case ta.UnaryExpression:tr(e.argument,t),e.constant=e.argument.constant,e.toWatch=e.argument.toWatch;break;case ta.BinaryExpression:tr(e.left,t),tr(e.right,t),e.constant=e.left.constant&&e.right.constant,e.toWatch=e.left.toWatch.concat(e.right.toWatch);break;case ta.LogicalExpression:tr(e.left,t),tr(e.right,t),e.constant=e.left.constant&&e.right.constant,e.toWatch=e.constant?[]:[e];break;case ta.ConditionalExpression:tr(e.test,t),tr(e.alternate,t),tr(e.consequent,t),e.constant=e.test.constant&&e.alternate.constant&&e.consequent.constant,e.toWatch=e.constant?[]:[e];break;case ta.Identifier:e.constant=!1,e.toWatch=[e];break;case ta.MemberExpression:tr(e.object,t),e.computed&&tr(e.property,t),e.constant=e.object.constant&&(!e.computed||e.property.constant),e.toWatch=[e];break;case ta.CallExpression:n=e.filter?er(t,e.callee.name):!1,r=[],o(e.arguments,function(e){tr(e,t),n=n&&e.constant,e.constant||r.push.apply(r,e.toWatch)}),e.constant=n,e.toWatch=e.filter&&er(t,e.callee.name)?r:[e];break;case ta.AssignmentExpression:tr(e.left,t),tr(e.right,t),e.constant=e.left.constant&&e.right.constant,e.toWatch=[e];break;case ta.ArrayExpression:n=!0,r=[],o(e.elements,function(e){tr(e,t),n=n&&e.constant,e.constant||r.push.apply(r,e.toWatch)}),e.constant=n,e.toWatch=r;break;case ta.ObjectExpression:n=!0,r=[],o(e.properties,function(e){tr(e.value,t),n=n&&e.value.constant,e.value.constant||r.push.apply(r,e.value.toWatch)}),e.constant=n,e.toWatch=r;break;case ta.ThisExpression:e.constant=!1,e.toWatch=[]}}function nr(e){if(1==e.length){var t=e[0].expression,r=t.toWatch;return 1!==r.length?r:r[0]!==t?r:n}}function rr(e){return e.type===ta.Identifier||e.type===ta.MemberExpression}function ir(e){return 1===e.body.length&&rr(e.body[0].expression)?{type:ta.AssignmentExpression,left:e.body[0].expression,right:{type:ta.NGValueParameter},operator:"="}:void 0}function or(e){return 0===e.body.length||1===e.body.length&&(e.body[0].expression.type===ta.Literal||e.body[0].expression.type===ta.ArrayExpression||e.body[0].expression.type===ta.ObjectExpression)}function ar(e){return e.constant}function sr(e,t){this.astBuilder=e,this.$filter=t}function ur(e,t){this.astBuilder=e,this.$filter=t}function cr(e){return"constructor"==e}function lr(e){return M(e.valueOf)?e.valueOf():ra.call(e)}function hr(){var e=vt(),t=vt();this.$get=["$filter",function(r){function i(e,t){return null==e||null==t?e===t:"object"==typeof e&&(e=lr(e),"object"==typeof e)?!1:e===t||e!==e&&t!==t}function a(e,t,r,o,a){var s,u=o.inputs;if(1===u.length){var c=i;return u=u[0],e.$watch(function(e){var t=u(e);return i(t,c)||(s=o(e,n,n,[t]),c=t&&lr(t)),s},t,r,a)}for(var l=[],h=[],f=0,p=u.length;p>f;f++)l[f]=i,h[f]=null;return e.$watch(function(e){for(var t=!1,r=0,a=u.length;a>r;r++){var c=u[r](e);(t||(t=!i(c,l[r])))&&(h[r]=c,l[r]=c&&lr(c))}return t&&(s=o(e,n,n,h)),s},t,r,a)}function s(e,t,n,r){var i,o;return i=e.$watch(function(e){return r(e)},function(e,n,r){o=e,M(t)&&t.apply(this,arguments),x(e)&&r.$$postDigest(function(){x(o)&&i()})},n)}function u(e,t,n,r){function i(e){var t=!0;return o(e,function(e){x(e)||(t=!1)}),t}var a,s;return a=e.$watch(function(e){return r(e)},function(e,n,r){s=e,M(t)&&t.call(this,e,n,r),i(e)&&r.$$postDigest(function(){i(s)&&a()})},n)}function c(e,t,n,r){var i;return i=e.$watch(function(e){return r(e)},function(){M(t)&&t.apply(this,arguments),i()},n)}function l(e,t){if(!t)return e;var n=e.$$watchDelegate,r=n!==u&&n!==s,i=r?function(n,r,i,o){var a=e(n,r,i,o);return t(a,n,r)}:function(n,r,i,o){var a=e(n,r,i,o),s=t(a,n,r);return x(a)?s:a};return e.$$watchDelegate&&e.$$watchDelegate!==a?i.$$watchDelegate=e.$$watchDelegate:t.$stateful||(i.$$watchDelegate=a,i.inputs=e.inputs?e.inputs:[e]),i}var h=$i().noUnsafeEval,f={csp:h,expensiveChecks:!1},p={csp:h,expensiveChecks:!0};return function(n,i,o){var h,d,v;switch(typeof n){case"string":n=n.trim(),v=n;var g=o?t:e;if(h=g[v],!h){":"===n.charAt(0)&&":"===n.charAt(1)&&(d=!0,n=n.substring(2));var y=o?p:f,b=new ea(y),x=new na(b,r,y);h=x.parse(n),h.constant?h.$$watchDelegate=c:d?h.$$watchDelegate=h.literal?u:s:h.inputs&&(h.$$watchDelegate=a),g[v]=h}return l(h,i);case"function":return l(n,i);default:return m}}}]}function fr(){this.$get=["$rootScope","$exceptionHandler",function(e,t){return dr(function(t){e.$evalAsync(t)},t)}]}function pr(){this.$get=["$browser","$exceptionHandler",function(e,t){return dr(function(t){e.defer(t)},t)}]}function dr(e,t){function i(e,t,n){function r(t){return function(n){i||(i=!0,t.call(e,n))}}var i=!1;return[r(t),r(n)]}function a(){this.$$state={status:0}}function s(e,t){return function(n){t.call(e,n)}}function u(e){var r,i,o;o=e.pending,e.processScheduled=!1,e.pending=n;for(var a=0,s=o.length;s>a;++a){i=o[a][0],r=o[a][e.status];try{M(r)?i.resolve(r(e.value)):1===e.status?i.resolve(e.value):i.reject(e.value)}catch(u){i.reject(u),t(u)}}}function c(t){!t.processScheduled&&t.pending&&(t.processScheduled=!0,e(function(){u(t)}))}function l(){this.promise=new a,this.resolve=s(this,this.resolve),this.reject=s(this,this.reject),this.notify=s(this,this.notify)}function f(e){var t=new l,n=0,r=Oi(e)?[]:{};return o(e,function(e,i){n++,y(e).then(function(e){r.hasOwnProperty(i)||(r[i]=e,--n||t.resolve(r))},function(e){r.hasOwnProperty(i)||t.reject(e)})}),0===n&&t.resolve(r),t.promise}var p=r("$q",TypeError),d=function(){return new l};h(a.prototype,{then:function(e,t,n){if(b(e)&&b(t)&&b(n))return this;var r=new l;return this.$$state.pending=this.$$state.pending||[],this.$$state.pending.push([r,e,t,n]),this.$$state.status>0&&c(this.$$state),r.promise},"catch":function(e){return this.then(null,e)},"finally":function(e,t){return this.then(function(t){return g(t,!0,e)},function(t){return g(t,!1,e)},t)}}),h(l.prototype,{resolve:function(e){this.promise.$$state.status||(e===this.promise?this.$$reject(p("qcycle","Expected promise to be resolved with value other than itself '{0}'",e)):this.$$resolve(e))},$$resolve:function(e){var n,r;r=i(this,this.$$resolve,this.$$reject);try{(w(e)||M(e))&&(n=e&&e.then),M(n)?(this.promise.$$state.status=-1,n.call(e,r[0],r[1],this.notify)):(this.promise.$$state.value=e,this.promise.$$state.status=1,c(this.promise.$$state))}catch(o){r[1](o),t(o)}},reject:function(e){this.promise.$$state.status||this.$$reject(e)},$$reject:function(e){this.promise.$$state.value=e,this.promise.$$state.status=2,c(this.promise.$$state)},notify:function(n){var r=this.promise.$$state.pending;this.promise.$$state.status<=0&&r&&r.length&&e(function(){for(var e,i,o=0,a=r.length;a>o;o++){i=r[o][0],e=r[o][3];try{i.notify(M(e)?e(n):n)}catch(s){t(s)}}})}});var m=function(e){var t=new l;return t.reject(e),t.promise},v=function(e,t){var n=new l;return t?n.resolve(e):n.reject(e),n.promise},g=function(e,t,n){var r=null;try{M(n)&&(r=n())}catch(i){return v(i,!1)}return B(r)?r.then(function(){return v(e,t)},function(e){return v(e,!1)}):v(e,t)},y=function(e,t,n,r){var i=new l;return i.resolve(e),i.promise.then(t,n,r)},x=y,_=function C(e){function t(e){r.resolve(e)}function n(e){r.reject(e)}if(!M(e))throw p("norslvr","Expected resolverFn, got '{0}'",e);if(!(this instanceof C))return new C(e);var r=new l;return e(t,n),r.promise};return _.defer=d,_.reject=m,_.when=y,_.resolve=x,_.all=f,_}function mr(){this.$get=["$window","$timeout",function(e,t){var n=e.requestAnimationFrame||e.webkitRequestAnimationFrame,r=e.cancelAnimationFrame||e.webkitCancelAnimationFrame||e.webkitCancelRequestAnimationFrame,i=!!n,o=i?function(e){var t=n(e);return function(){r(t)}}:function(e){var n=t(e,16.66,!1);return function(){t.cancel(n)}};return o.supported=i,o}]}function vr(){function e(e){function t(){this.$$watchers=this.$$nextSibling=this.$$childHead=this.$$childTail=null,this.$$listeners={},this.$$listenerCount={},this.$$watchersCount=0,this.$id=u(),this.$$ChildScope=null}return t.prototype=e,t}var t=10,n=r("$rootScope"),a=null,s=null;this.digestTtl=function(e){return arguments.length&&(t=e),t},this.$get=["$injector","$exceptionHandler","$parse","$browser",function(r,c,l,h){function f(e){e.currentScope.$$destroyed=!0}function p(){this.$id=u(),this.$$phase=this.$parent=this.$$watchers=this.$$nextSibling=this.$$prevSibling=this.$$childHead=this.$$childTail=null,this.$root=this,this.$$destroyed=!1,this.$$listeners={},this.$$listenerCount={},this.$$watchersCount=0,this.$$isolateBindings=null}function d(e){if(E.$$phase)throw n("inprog","{0} already in progress",E.$$phase);E.$$phase=e}function v(){E.$$phase=null}function g(e,t){do e.$$watchersCount+=t;while(e=e.$parent)}function y(e,t,n){do e.$$listenerCount[n]-=t,0===e.$$listenerCount[n]&&delete e.$$listenerCount[n];while(e=e.$parent)}function x(){}function _(){for(;A.length;)try{A.shift()()}catch(e){c(e)}s=null}function C(){null===s&&(s=h.defer(function(){E.$apply(_)}))}p.prototype={constructor:p,$new:function(t,n){var r;return n=n||this,t?(r=new p,r.$root=this.$root):(this.$$ChildScope||(this.$$ChildScope=e(this)),r=new this.$$ChildScope),r.$parent=n,r.$$prevSibling=n.$$childTail,n.$$childHead?(n.$$childTail.$$nextSibling=r,n.$$childTail=r):n.$$childHead=n.$$childTail=r,(t||n!=this)&&r.$on("$destroy",f),r},$watch:function(e,t,n,r){var i=l(e);if(i.$$watchDelegate)return i.$$watchDelegate(this,t,n,i,e);var o=this,s=o.$$watchers,u={fn:t,last:x,get:i,exp:r||e,eq:!!n};return a=null,M(t)||(u.fn=m),s||(s=o.$$watchers=[]),s.unshift(u),g(this,1),function(){F(s,u)>=0&&g(o,-1),a=null}},$watchGroup:function(e,t){function n(){u=!1,c?(c=!1,t(i,i,s)):t(i,r,s)}var r=new Array(e.length),i=new Array(e.length),a=[],s=this,u=!1,c=!0;if(!e.length){var l=!0;return s.$evalAsync(function(){l&&t(i,i,s)}),function(){l=!1}}return 1===e.length?this.$watch(e[0],function(e,n,o){i[0]=e,r[0]=n,t(i,e===n?i:r,o)}):(o(e,function(e,t){var o=s.$watch(e,function(e,o){i[t]=e,r[t]=o,u||(u=!0,s.$evalAsync(n))});a.push(o)}),function(){for(;a.length;)a.shift()()})},$watchCollection:function(e,t){function n(e){o=e;var t,n,r,s,u;if(!b(o)){if(w(o))if(i(o)){a!==p&&(a=p,v=a.length=0,h++),t=o.length,v!==t&&(h++,a.length=v=t);for(var c=0;t>c;c++)u=a[c],s=o[c],r=u!==u&&s!==s,r||u===s||(h++,a[c]=s)}else{a!==d&&(a=d={},v=0,h++),t=0;for(n in o)wi.call(o,n)&&(t++,s=o[n],u=a[n],n in a?(r=u!==u&&s!==s,r||u===s||(h++,a[n]=s)):(v++,a[n]=s,h++));if(v>t){h++;for(n in a)wi.call(o,n)||(v--,delete a[n])}}else a!==o&&(a=o,h++);return h}}function r(){if(m?(m=!1,t(o,o,u)):t(o,s,u),c)if(w(o))if(i(o)){s=new Array(o.length);for(var e=0;e<o.length;e++)s[e]=o[e]}else{s={};for(var n in o)wi.call(o,n)&&(s[n]=o[n])}else s=o}n.$stateful=!0;var o,a,s,u=this,c=t.length>1,h=0,f=l(e,n),p=[],d={},m=!0,v=0;return this.$watch(f,r)},$digest:function(){var e,r,i,o,u,l,f,p,m,g,y=t,b=this,w=[];d("$digest"),h.$$checkUrlChange(),this===E&&null!==s&&(h.defer.cancel(s),_()),a=null;do{for(l=!1,p=b;S.length;){try{g=S.shift(),g.scope.$eval(g.expression,g.locals)}catch(C){c(C)}a=null}e:do{if(o=p.$$watchers)for(u=o.length;u--;)try{if(e=o[u])if((r=e.get(p))===(i=e.last)||(e.eq?$(r,i):"number"==typeof r&&"number"==typeof i&&isNaN(r)&&isNaN(i))){if(e===a){l=!1;break e}}else l=!0,a=e,e.last=e.eq?U(r,null):r,e.fn(r,i===x?r:i,p),5>y&&(m=4-y,w[m]||(w[m]=[]),w[m].push({msg:M(e.exp)?"fn: "+(e.exp.name||e.exp.toString()):e.exp,newVal:r,oldVal:i}))}catch(C){c(C)}if(!(f=p.$$watchersCount&&p.$$childHead||p!==b&&p.$$nextSibling))for(;p!==b&&!(f=p.$$nextSibling);)p=p.$parent}while(p=f);if((l||S.length)&&!y--)throw v(),n("infdig","{0} $digest() iterations reached. Aborting!\nWatchers fired in the last 5 iterations: {1}",t,w)}while(l||S.length);for(v();T.length;)try{T.shift()()}catch(C){c(C)}},$destroy:function(){if(!this.$$destroyed){var e=this.$parent;this.$broadcast("$destroy"),this.$$destroyed=!0,this===E&&h.$$applicationDestroyed(),g(this,-this.$$watchersCount);for(var t in this.$$listenerCount)y(this,this.$$listenerCount[t],t);e&&e.$$childHead==this&&(e.$$childHead=this.$$nextSibling),e&&e.$$childTail==this&&(e.$$childTail=this.$$prevSibling),this.$$prevSibling&&(this.$$prevSibling.$$nextSibling=this.$$nextSibling),this.$$nextSibling&&(this.$$nextSibling.$$prevSibling=this.$$prevSibling),this.$destroy=this.$digest=this.$apply=this.$evalAsync=this.$applyAsync=m,this.$on=this.$watch=this.$watchGroup=function(){return m},this.$$listeners={},this.$parent=this.$$nextSibling=this.$$prevSibling=this.$$childHead=this.$$childTail=this.$root=this.$$watchers=null}},$eval:function(e,t){return l(e)(this,t)},$evalAsync:function(e,t){E.$$phase||S.length||h.defer(function(){S.length&&E.$digest()}),S.push({scope:this,expression:e,locals:t})},$$postDigest:function(e){T.push(e)},$apply:function(e){try{d("$apply");try{return this.$eval(e)}finally{v()}}catch(t){c(t)}finally{try{E.$digest()}catch(t){throw c(t),t}}},$applyAsync:function(e){function t(){n.$eval(e)}var n=this;e&&A.push(t),C()},$on:function(e,t){var n=this.$$listeners[e];n||(this.$$listeners[e]=n=[]),n.push(t);var r=this;do r.$$listenerCount[e]||(r.$$listenerCount[e]=0),r.$$listenerCount[e]++;while(r=r.$parent);var i=this;return function(){var r=n.indexOf(t);-1!==r&&(n[r]=null,y(i,1,e))}},$emit:function(e){var t,n,r,i=[],o=this,a=!1,s={name:e,targetScope:o,stopPropagation:function(){a=!0},preventDefault:function(){s.defaultPrevented=!0},defaultPrevented:!1},u=H([s],arguments,1);do{for(t=o.$$listeners[e]||i,s.currentScope=o,n=0,r=t.length;r>n;n++)if(t[n])try{t[n].apply(null,u)}catch(l){c(l)}else t.splice(n,1),n--,r--;if(a)return s.currentScope=null,s;o=o.$parent}while(o);return s.currentScope=null,s},$broadcast:function(e){var t=this,n=t,r=t,i={name:e,targetScope:t,preventDefault:function(){i.defaultPrevented=!0},defaultPrevented:!1};if(!t.$$listenerCount[e])return i;for(var o,a,s,u=H([i],arguments,1);n=r;){for(i.currentScope=n,o=n.$$listeners[e]||[],a=0,s=o.length;s>a;a++)if(o[a])try{o[a].apply(null,u)}catch(l){c(l)}else o.splice(a,1),a--,s--;if(!(r=n.$$listenerCount[e]&&n.$$childHead||n!==t&&n.$$nextSibling))for(;n!==t&&!(r=n.$$nextSibling);)n=n.$parent}return i.currentScope=null,i}};var E=new p,S=E.$$asyncQueue=[],T=E.$$postDigestQueue=[],A=E.$$applyAsyncQueue=[];return E}]}function gr(){var e=/^\s*(https?|ftp|mailto|tel|file):/,t=/^\s*((https?|ftp|file|blob):|data:image\/)/;this.aHrefSanitizationWhitelist=function(t){return x(t)?(e=t,this):e},this.imgSrcSanitizationWhitelist=function(e){return x(e)?(t=e,this):t},this.$get=function(){return function(n,r){var i,o=r?t:e;return i=Mr(n).href,""===i||i.match(o)?n:"unsafe:"+i}}}function yr(e){if("self"===e)return e;if(C(e)){if(e.indexOf("***")>-1)throw ia("iwcard","Illegal sequence *** in string matcher. String: {0}",e);return e=zi(e).replace("\\*\\*",".*").replace("\\*","[^:/.?&;]*"),new RegExp("^"+e+"$")}if(T(e))return new RegExp("^"+e.source+"$");throw ia("imatcher",'Matchers may only be "self", string patterns or RegExp objects')}function br(e){var t=[];return x(e)&&o(e,function(e){t.push(yr(e))}),t}function xr(){this.SCE_CONTEXTS=oa;var e=["self"],t=[];this.resourceUrlWhitelist=function(t){return arguments.length&&(e=br(t)),e},this.resourceUrlBlacklist=function(e){return arguments.length&&(t=br(e)),t},this.$get=["$injector",function(n){function r(e,t){return"self"===e?Tr(t):!!e.exec(t.href)}function i(n){var i,o,a=Mr(n.toString()),s=!1;for(i=0,o=e.length;o>i;i++)if(r(e[i],a)){s=!0;break}if(s)for(i=0,o=t.length;o>i;i++)if(r(t[i],a)){s=!1;break}return s}function o(e){var t=function(e){this.$$unwrapTrustedValue=function(){return e}};return e&&(t.prototype=new e),t.prototype.valueOf=function(){return this.$$unwrapTrustedValue()},t.prototype.toString=function(){return this.$$unwrapTrustedValue().toString()},t}function a(e,t){var n=h.hasOwnProperty(e)?h[e]:null;if(!n)throw ia("icontext","Attempted to trust a value in invalid context. Context: {0}; Value: {1}",e,t);if(null===t||b(t)||""===t)return t;if("string"!=typeof t)throw ia("itype","Attempted to trust a non-string value in a content requiring a string: Context: {0}",e);return new n(t)}function s(e){return e instanceof l?e.$$unwrapTrustedValue():e}function u(e,t){if(null===t||b(t)||""===t)return t;var n=h.hasOwnProperty(e)?h[e]:null;if(n&&t instanceof n)return t.$$unwrapTrustedValue();if(e===oa.RESOURCE_URL){if(i(t))return t;throw ia("insecurl","Blocked loading resource from url not allowed by $sceDelegate policy. URL: {0}",t.toString())}if(e===oa.HTML)return c(t);throw ia("unsafe","Attempting to use an unsafe value in a safe context.")}var c=function(){throw ia("unsafe","Attempting to use an unsafe value in a safe context.")};n.has("$sanitize")&&(c=n.get("$sanitize"));var l=o(),h={};return h[oa.HTML]=o(l),h[oa.CSS]=o(l),h[oa.URL]=o(l),h[oa.JS]=o(l),h[oa.RESOURCE_URL]=o(h[oa.URL]),{trustAs:a,getTrusted:u,valueOf:s}}]}function wr(){var e=!0;this.enabled=function(t){return arguments.length&&(e=!!t),e},this.$get=["$parse","$sceDelegate",function(t,n){if(e&&8>Si)throw ia("iequirks","Strict Contextual Escaping does not support Internet Explorer version < 11 in quirks mode. You can fix this by adding the text <!doctype html> to the top of your HTML document. See http://docs.angularjs.org/api/ng.$sce for more information.");var r=z(oa);r.isEnabled=function(){return e},r.trustAs=n.trustAs,r.getTrusted=n.getTrusted,r.valueOf=n.valueOf,e||(r.trustAs=r.getTrusted=function(e,t){return t},r.valueOf=v),r.parseAs=function(e,n){var i=t(n);return i.literal&&i.constant?i:t(n,function(t){return r.getTrusted(e,t)})};var i=r.parseAs,a=r.getTrusted,s=r.trustAs;return o(oa,function(e,t){var n=xi(t);r[_t("parse_as_"+n)]=function(t){return i(e,t)},r[_t("get_trusted_"+n)]=function(t){return a(e,t)},r[_t("trust_as_"+n)]=function(t){return s(e,t)}}),r}]}function _r(){this.$get=["$window","$document",function(e,t){var n,r,i={},o=p((/android (\d+)/.exec(xi((e.navigator||{}).userAgent))||[])[1]),a=/Boxee/i.test((e.navigator||{}).userAgent),s=t[0]||{},u=/^(Moz|webkit|ms)(?=[A-Z])/,c=s.body&&s.body.style,l=!1,h=!1;if(c){for(var f in c)if(r=u.exec(f)){n=r[0],n=n.substr(0,1).toUpperCase()+n.substr(1);break}n||(n="WebkitOpacity"in c&&"webkit"),l=!!("transition"in c||n+"Transition"in c),h=!!("animation"in c||n+"Animation"in c),!o||l&&h||(l=C(c.webkitTransition),h=C(c.webkitAnimation))}return{history:!(!e.history||!e.history.pushState||4>o||a),hasEvent:function(e){if("input"===e&&11>=Si)return!1;if(b(i[e])){var t=s.createElement("div");i[e]="on"+e in t}return i[e]},csp:$i(),vendorPrefix:n,transitions:l,animations:h,android:o}}]}function Cr(){this.$get=["$templateCache","$http","$q","$sce",function(e,t,n,r){function i(o,a){function s(e){if(!a)throw Ro("tpload","Failed to load template: {0} (HTTP status: {1} {2})",o,e.status,e.statusText);return n.reject(e)}i.totalPendingRequests++,C(o)&&e.get(o)||(o=r.getTrustedResourceUrl(o));var u=t.defaults&&t.defaults.transformResponse;Oi(u)?u=u.filter(function(e){return e!==xn}):u===xn&&(u=null);var c={cache:e,transformResponse:u};return t.get(o,c)["finally"](function(){i.totalPendingRequests--}).then(function(t){return e.put(o,t.data),t.data},s)}return i.totalPendingRequests=0,i}]}function Er(){this.$get=["$rootScope","$browser","$location",function(e,t,n){var r={};return r.findBindings=function(e,t,n){var r=e.getElementsByClassName("ng-binding"),i=[];return o(r,function(e){var r=Vi.element(e).data("$binding");r&&o(r,function(r){if(n){var o=new RegExp("(^|\\s)"+zi(t)+"(\\s|\\||$)");o.test(r)&&i.push(e)}else-1!=r.indexOf(t)&&i.push(e)})}),i},r.findModels=function(e,t,n){for(var r=["ng-","data-ng-","ng\\:"],i=0;i<r.length;++i){var o=n?"=":"*=",a="["+r[i]+"model"+o+'"'+t+'"]',s=e.querySelectorAll(a);if(s.length)return s}},r.getLocation=function(){return n.url()},r.setLocation=function(t){t!==n.url()&&(n.url(t),e.$digest())},r.whenStable=function(e){t.notifyWhenNoOutstandingRequests(e)},r}]}function Sr(){this.$get=["$rootScope","$browser","$q","$$q","$exceptionHandler",function(e,t,n,r,i){function o(o,s,u){M(o)||(u=s,s=o,o=m);var c,l=j(arguments,3),h=x(u)&&!u,f=(h?r:n).defer(),p=f.promise;return c=t.defer(function(){try{f.resolve(o.apply(null,l))}catch(t){f.reject(t),i(t)}finally{delete a[p.$$timeoutId]}h||e.$apply()},s),p.$$timeoutId=c,a[c]=f,p}var a={};return o.cancel=function(e){return e&&e.$$timeoutId in a?(a[e.$$timeoutId].reject("canceled"),delete a[e.$$timeoutId],t.defer.cancel(e.$$timeoutId)):!1},o}]}function Mr(e){var t=e;return Si&&(aa.setAttribute("href",t),t=aa.href),aa.setAttribute("href",t),{href:aa.href,protocol:aa.protocol?aa.protocol.replace(/:$/,""):"",host:aa.host,search:aa.search?aa.search.replace(/^\?/,""):"",hash:aa.hash?aa.hash.replace(/^#/,""):"",hostname:aa.hostname,port:aa.port,pathname:"/"===aa.pathname.charAt(0)?aa.pathname:"/"+aa.pathname}}function Tr(e){var t=C(e)?Mr(e):e;return t.protocol===sa.protocol&&t.host===sa.host}function Ar(){this.$get=g(e)}function Pr(e){function t(e){try{return decodeURIComponent(e)}catch(t){return e}}var n=e[0]||{},r={},i="";return function(){var e,o,a,s,u,c=n.cookie||"";if(c!==i)for(i=c,e=i.split("; "),r={},a=0;a<e.length;a++)o=e[a],s=o.indexOf("="),s>0&&(u=t(o.substring(0,s)),b(r[u])&&(r[u]=t(o.substring(s+1))));return r}}function kr(){this.$get=Pr}function Rr(e){function t(r,i){if(w(r)){var a={};return o(r,function(e,n){a[n]=t(n,e)}),a}return e.factory(r+n,i)}var n="Filter";this.register=t,this.$get=["$injector",function(e){return function(t){return e.get(t+n)}}],t("currency",Lr),t("date",Yr),t("filter",Ir),t("json",Kr),t("limitTo",Qr),t("lowercase",fa),t("number",Nr),t("orderBy",Zr),t("uppercase",pa)}function Ir(){return function(e,t,n){if(!i(e)){if(null==e)return e;throw r("filter")("notarray","Expected array but received: {0}",e)}var o,a,s=Vr(t);switch(s){case"function":o=t;break;case"boolean":case"null":case"number":case"string":a=!0;case"object":o=Dr(t,n,a);break;default:return e}return Array.prototype.filter.call(e,o)}}function Dr(e,t,n){var r,i=w(e)&&"$"in e;return t===!0?t=$:M(t)||(t=function(e,t){return b(e)?!1:null===e||null===t?e===t:w(t)||w(e)&&!y(e)?!1:(e=xi(""+e),t=xi(""+t),-1!==e.indexOf(t))}),r=function(r){return i&&!w(r)?Br(r,e.$,t,!1):Br(r,e,t,n)}}function Br(e,t,n,r,i){var o=Vr(e),a=Vr(t);if("string"===a&&"!"===t.charAt(0))return!Br(e,t.substring(1),n,r);if(Oi(e))return e.some(function(e){return Br(e,t,n,r)});switch(o){case"object":var s;if(r){for(s in e)if("$"!==s.charAt(0)&&Br(e[s],t,n,!0))return!0;return i?!1:Br(e,t,n,!1)}if("object"===a){for(s in t){var u=t[s];if(!M(u)&&!b(u)){var c="$"===s,l=c?e:e[s];if(!Br(l,u,n,c,c))return!1}}return!0}return n(e,t);case"function":return!1;default:return n(e,t)}}function Vr(e){return null===e?"null":typeof e}function Lr(e){var t=e.NUMBER_FORMATS;return function(e,n,r){return b(n)&&(n=t.CURRENCY_SYM),b(r)&&(r=t.PATTERNS[1].maxFrac),null==e?e:Or(e,t.PATTERNS[1],t.GROUP_SEP,t.DECIMAL_SEP,r).replace(/\u00A4/g,n)}}function Nr(e){var t=e.NUMBER_FORMATS;return function(e,n){return null==e?e:Or(e,t.PATTERNS[0],t.GROUP_SEP,t.DECIMAL_SEP,n)}}function Or(e,t,n,r,i){if(w(e))return"";var o=0>e;e=Math.abs(e);var a=1/0===e;if(!a&&!isFinite(e))return"";var s=e+"",u="",c=!1,l=[];if(a&&(u="∞"),!a&&-1!==s.indexOf("e")){var h=s.match(/([\d\.]+)e(-?)(\d+)/);h&&"-"==h[2]&&h[3]>i+1?e=0:(u=s,c=!0)}if(a||c)i>0&&1>e&&(u=e.toFixed(i),e=parseFloat(u),u=u.replace(ua,r));else{var f=(s.split(ua)[1]||"").length;b(i)&&(i=Math.min(Math.max(t.minFrac,f),t.maxFrac)),e=+(Math.round(+(e.toString()+"e"+i)).toString()+"e"+-i);var p=(""+e).split(ua),d=p[0];p=p[1]||"";var m,v=0,g=t.lgSize,y=t.gSize;if(d.length>=g+y)for(v=d.length-g,m=0;v>m;m++)(v-m)%y===0&&0!==m&&(u+=n),u+=d.charAt(m);for(m=v;m<d.length;m++)(d.length-m)%g===0&&0!==m&&(u+=n),u+=d.charAt(m);for(;p.length<i;)p+="0";i&&"0"!==i&&(u+=r+p.substr(0,i))}return 0===e&&(o=!1),l.push(o?t.negPre:t.posPre,u,o?t.negSuf:t.posSuf),l.join("")}function Fr(e,t,n){var r="";for(0>e&&(r="-",e=-e),e=""+e;e.length<t;)e="0"+e;return n&&(e=e.substr(e.length-t)),r+e}function Ur(e,t,n,r){return n=n||0,function(i){var o=i["get"+e]();return(n>0||o>-n)&&(o+=n),0===o&&-12==n&&(o=12),Fr(o,t,r)}}function zr(e,t){return function(n,r){var i=n["get"+e](),o=_i(t?"SHORT"+e:e);return r[o][i]}}function $r(e,t,n){var r=-1*n,i=r>=0?"+":"";return i+=Fr(Math[r>0?"floor":"ceil"](r/60),2)+Fr(Math.abs(r%60),2)}function Hr(e){var t=new Date(e,0,1).getDay();return new Date(e,0,(4>=t?5:12)-t)}function jr(e){return new Date(e.getFullYear(),e.getMonth(),e.getDate()+(4-e.getDay()))}function Gr(e){return function(t){var n=Hr(t.getFullYear()),r=jr(t),i=+r-+n,o=1+Math.round(i/6048e5);return Fr(o,e)}}function Wr(e,t){return e.getHours()<12?t.AMPMS[0]:t.AMPMS[1]}function qr(e,t){return e.getFullYear()<=0?t.ERAS[0]:t.ERAS[1]}function Xr(e,t){return e.getFullYear()<=0?t.ERANAMES[0]:t.ERANAMES[1]}function Yr(e){function t(e){var t;if(t=e.match(n)){var r=new Date(0),i=0,o=0,a=t[8]?r.setUTCFullYear:r.setFullYear,s=t[8]?r.setUTCHours:r.setHours;t[9]&&(i=p(t[9]+t[10]),o=p(t[9]+t[11])),a.call(r,p(t[1]),p(t[2])-1,p(t[3]));var u=p(t[4]||0)-i,c=p(t[5]||0)-o,l=p(t[6]||0),h=Math.round(1e3*parseFloat("0."+(t[7]||0)));return s.call(r,u,c,l,h),r}return e}var n=/^(\d{4})-?(\d\d)-?(\d\d)(?:T(\d\d)(?::?(\d\d)(?::?(\d\d)(?:\.(\d+))?)?)?(Z|([+-])(\d\d):?(\d\d))?)?$/;return function(n,r,i){var a,s,u="",c=[];if(r=r||"mediumDate",r=e.DATETIME_FORMATS[r]||r,C(n)&&(n=ha.test(n)?p(n):t(n)),E(n)&&(n=new Date(n)),!S(n)||!isFinite(n.getTime()))return n;for(;r;)s=la.exec(r),s?(c=H(c,s,1),r=c.pop()):(c.push(r),r=null);var l=n.getTimezoneOffset();return i&&(l=Y(i,n.getTimezoneOffset()),n=Q(n,i,!0)),o(c,function(t){a=ca[t],u+=a?a(n,e.DATETIME_FORMATS,l):t.replace(/(^'|'$)/g,"").replace(/''/g,"'")}),u}}function Kr(){return function(e,t){return b(t)&&(t=2),q(e,t)}}function Qr(){return function(e,t,n){return t=1/0===Math.abs(Number(t))?Number(t):p(t),isNaN(t)?e:(E(e)&&(e=e.toString()),Oi(e)||C(e)?(n=!n||isNaN(n)?0:p(n),n=0>n&&n>=-e.length?e.length+n:n,t>=0?e.slice(n,n+t):0===n?e.slice(t,e.length):e.slice(Math.max(0,n+t),n)):e)}}function Zr(e){function t(t,n){return n=n?-1:1,t.map(function(t){var r=1,i=v;if(M(t))i=t;else if(C(t)&&(("+"==t.charAt(0)||"-"==t.charAt(0))&&(r="-"==t.charAt(0)?-1:1,t=t.substring(1)),""!==t&&(i=e(t),i.constant))){var o=i();i=function(e){return e[o]}}return{get:i,descending:r*n}})}function n(e){switch(typeof e){case"number":case"boolean":case"string":return!0;default:return!1}}function r(e,t){return"function"==typeof e.valueOf&&(e=e.valueOf(),n(e))?e:y(e)&&(e=e.toString(),n(e))?e:t}function o(e,t){var n=typeof e;return null===e?(n="string",e="null"):"string"===n?e=e.toLowerCase():"object"===n&&(e=r(e,t)),{value:e,type:n}}function a(e,t){var n=0;return e.type===t.type?e.value!==t.value&&(n=e.value<t.value?-1:1):n=e.type<t.type?-1:1,n}return function(e,n,r){function s(e,t){return{value:e,predicateValues:c.map(function(n){return o(n.get(e),t)})}}function u(e,t){for(var n=0,r=0,i=c.length;i>r&&!(n=a(e.predicateValues[r],t.predicateValues[r])*c[r].descending);++r);return n}if(!i(e))return e;Oi(n)||(n=[n]),0===n.length&&(n=["+"]);var c=t(n,r);c.push({get:function(){return{}},descending:r?-1:1});var l=Array.prototype.map.call(e,s);return l.sort(u),e=l.map(function(e){return e.value})}}function Jr(e){return M(e)&&(e={link:e}),e.restrict=e.restrict||"AC",g(e)}function ei(e,t){e.$name=t}function ti(e,t,r,i,a){var s=this,u=[];s.$error={},s.$$success={},s.$pending=n,s.$name=a(t.name||t.ngForm||"")(r),s.$dirty=!1,s.$pristine=!0,s.$valid=!0,s.$invalid=!1,s.$submitted=!1,s.$$parentForm=va,s.$rollbackViewValue=function(){o(u,function(e){e.$rollbackViewValue()})},s.$commitViewValue=function(){o(u,function(e){e.$commitViewValue()})},s.$addControl=function(e){pt(e.$name,"input"),u.push(e),e.$name&&(s[e.$name]=e),e.$$parentForm=s},s.$$renameControl=function(e,t){var n=e.$name;s[n]===e&&delete s[n],s[t]=e,e.$name=t},s.$removeControl=function(e){e.$name&&s[e.$name]===e&&delete s[e.$name],o(s.$pending,function(t,n){s.$setValidity(n,null,e)}),o(s.$error,function(t,n){s.$setValidity(n,null,e)}),o(s.$$success,function(t,n){s.$setValidity(n,null,e)}),F(u,e),e.$$parentForm=va},vi({ctrl:this,$element:e,set:function(e,t,n){var r=e[t];if(r){var i=r.indexOf(n);-1===i&&r.push(n)}else e[t]=[n]},unset:function(e,t,n){var r=e[t];r&&(F(r,n),0===r.length&&delete e[t])},$animate:i}),s.$setDirty=function(){i.removeClass(e,Za),i.addClass(e,Ja),s.$dirty=!0,s.$pristine=!1,s.$$parentForm.$setDirty()},s.$setPristine=function(){i.setClass(e,Za,Ja+" "+ga),s.$dirty=!1,s.$pristine=!0,s.$submitted=!1,o(u,function(e){e.$setPristine()})},s.$setUntouched=function(){o(u,function(e){e.$setUntouched()})},s.$setSubmitted=function(){i.addClass(e,ga),s.$submitted=!0,s.$$parentForm.$setSubmitted()}}function ni(e){e.$formatters.push(function(t){return e.$isEmpty(t)?t:t.toString()})}function ri(e,t,n,r,i,o){ii(e,t,n,r,i,o),ni(r)}function ii(e,t,n,r,i,o){var a=xi(t[0].type);if(!i.android){var s=!1;t.on("compositionstart",function(){s=!0}),t.on("compositionend",function(){s=!1,u()})}var u=function(e){if(c&&(o.defer.cancel(c),c=null),!s){var i=t.val(),u=e&&e.type;"password"===a||n.ngTrim&&"false"===n.ngTrim||(i=Ui(i)),(r.$viewValue!==i||""===i&&r.$$hasNativeValidators)&&r.$setViewValue(i,u)}};if(i.hasEvent("input"))t.on("input",u);else{var c,l=function(e,t,n){c||(c=o.defer(function(){c=null,t&&t.value===n||u(e)}))};t.on("keydown",function(e){var t=e.keyCode;91===t||t>15&&19>t||t>=37&&40>=t||l(e,this,this.value)}),i.hasEvent("paste")&&t.on("paste cut",l)
}t.on("change",u),r.$render=function(){var e=r.$isEmpty(r.$viewValue)?"":r.$viewValue;t.val()!==e&&t.val(e)}}function oi(e,t){if(S(e))return e;if(C(e)){Ta.lastIndex=0;var n=Ta.exec(e);if(n){var r=+n[1],i=+n[2],o=0,a=0,s=0,u=0,c=Hr(r),l=7*(i-1);return t&&(o=t.getHours(),a=t.getMinutes(),s=t.getSeconds(),u=t.getMilliseconds()),new Date(r,0,c.getDate()+l,o,a,s,u)}}return 0/0}function ai(e,t){return function(n,r){var i,a;if(S(n))return n;if(C(n)){if('"'==n.charAt(0)&&'"'==n.charAt(n.length-1)&&(n=n.substring(1,n.length-1)),wa.test(n))return new Date(n);if(e.lastIndex=0,i=e.exec(n))return i.shift(),a=r?{yyyy:r.getFullYear(),MM:r.getMonth()+1,dd:r.getDate(),HH:r.getHours(),mm:r.getMinutes(),ss:r.getSeconds(),sss:r.getMilliseconds()/1e3}:{yyyy:1970,MM:1,dd:1,HH:0,mm:0,ss:0,sss:0},o(i,function(e,n){n<t.length&&(a[t[n]]=+e)}),new Date(a.yyyy,a.MM-1,a.dd,a.HH,a.mm,a.ss||0,1e3*a.sss||0)}return 0/0}}function si(e,t,r,i){return function(o,a,s,u,c,l,h){function f(e){return e&&!(e.getTime&&e.getTime()!==e.getTime())}function p(e){return x(e)&&!S(e)?r(e)||n:e}ui(o,a,s,u),ii(o,a,s,u,c,l);var d,m=u&&u.$options&&u.$options.timezone;if(u.$$parserName=e,u.$parsers.push(function(e){if(u.$isEmpty(e))return null;if(t.test(e)){var i=r(e,d);return m&&(i=Q(i,m)),i}return n}),u.$formatters.push(function(e){if(e&&!S(e))throw rs("datefmt","Expected `{0}` to be a date",e);return f(e)?(d=e,d&&m&&(d=Q(d,m,!0)),h("date")(e,i,m)):(d=null,"")}),x(s.min)||s.ngMin){var v;u.$validators.min=function(e){return!f(e)||b(v)||r(e)>=v},s.$observe("min",function(e){v=p(e),u.$validate()})}if(x(s.max)||s.ngMax){var g;u.$validators.max=function(e){return!f(e)||b(g)||r(e)<=g},s.$observe("max",function(e){g=p(e),u.$validate()})}}}function ui(e,t,r,i){var o=t[0],a=i.$$hasNativeValidators=w(o.validity);a&&i.$parsers.push(function(e){var r=t.prop(bi)||{};return r.badInput&&!r.typeMismatch?n:e})}function ci(e,t,r,i,o,a){if(ui(e,t,r,i),ii(e,t,r,i,o,a),i.$$parserName="number",i.$parsers.push(function(e){return i.$isEmpty(e)?null:Ea.test(e)?parseFloat(e):n}),i.$formatters.push(function(e){if(!i.$isEmpty(e)){if(!E(e))throw rs("numfmt","Expected `{0}` to be a number",e);e=e.toString()}return e}),x(r.min)||r.ngMin){var s;i.$validators.min=function(e){return i.$isEmpty(e)||b(s)||e>=s},r.$observe("min",function(e){x(e)&&!E(e)&&(e=parseFloat(e,10)),s=E(e)&&!isNaN(e)?e:n,i.$validate()})}if(x(r.max)||r.ngMax){var u;i.$validators.max=function(e){return i.$isEmpty(e)||b(u)||u>=e},r.$observe("max",function(e){x(e)&&!E(e)&&(e=parseFloat(e,10)),u=E(e)&&!isNaN(e)?e:n,i.$validate()})}}function li(e,t,n,r,i,o){ii(e,t,n,r,i,o),ni(r),r.$$parserName="url",r.$validators.url=function(e,t){var n=e||t;return r.$isEmpty(n)||_a.test(n)}}function hi(e,t,n,r,i,o){ii(e,t,n,r,i,o),ni(r),r.$$parserName="email",r.$validators.email=function(e,t){var n=e||t;return r.$isEmpty(n)||Ca.test(n)}}function fi(e,t,n,r){b(n.name)&&t.attr("name",u());var i=function(e){t[0].checked&&r.$setViewValue(n.value,e&&e.type)};t.on("click",i),r.$render=function(){var e=n.value;t[0].checked=e==r.$viewValue},n.$observe("value",r.$render)}function pi(e,t,n,r,i){var o;if(x(r)){if(o=e(r),!o.constant)throw rs("constexpr","Expected constant expression for `{0}`, but saw `{1}`.",n,r);return o(t)}return i}function di(e,t,n,r,i,o,a,s){var u=pi(s,e,"ngTrueValue",n.ngTrueValue,!0),c=pi(s,e,"ngFalseValue",n.ngFalseValue,!1),l=function(e){r.$setViewValue(t[0].checked,e&&e.type)};t.on("click",l),r.$render=function(){t[0].checked=r.$viewValue},r.$isEmpty=function(e){return e===!1},r.$formatters.push(function(e){return $(e,u)}),r.$parsers.push(function(e){return e?u:c})}function mi(e,t){return e="ngClass"+e,["$animate",function(n){function r(e,t){var n=[];e:for(var r=0;r<e.length;r++){for(var i=e[r],o=0;o<t.length;o++)if(i==t[o])continue e;n.push(i)}return n}function i(e){var t=[];return Oi(e)?(o(e,function(e){t=t.concat(i(e))}),t):C(e)?e.split(" "):w(e)?(o(e,function(e,n){e&&(t=t.concat(n.split(" ")))}),t):e}return{restrict:"AC",link:function(a,s,u){function c(e){var t=h(e,1);u.$addClass(t)}function l(e){var t=h(e,-1);u.$removeClass(t)}function h(e,t){var n=s.data("$classCounts")||vt(),r=[];return o(e,function(e){(t>0||n[e])&&(n[e]=(n[e]||0)+t,n[e]===+(t>0)&&r.push(e))}),s.data("$classCounts",n),r.join(" ")}function f(e,t){var i=r(t,e),o=r(e,t);i=h(i,1),o=h(o,-1),i&&i.length&&n.addClass(s,i),o&&o.length&&n.removeClass(s,o)}function p(e){if(t===!0||a.$index%2===t){var n=i(e||[]);if(d){if(!$(e,d)){var r=i(d);f(r,n)}}else c(n)}d=z(e)}var d;a.$watch(u[e],p,!0),u.$observe("class",function(){p(a.$eval(u[e]))}),"ngClass"!==e&&a.$watch("$index",function(n,r){var o=1&n;if(o!==(1&r)){var s=i(a.$eval(u[e]));o===t?c(s):l(s)}})}}}]}function vi(e){function t(e,t,u){b(t)?r("$pending",e,u):i("$pending",e,u),D(t)?t?(h(s.$error,e,u),l(s.$$success,e,u)):(l(s.$error,e,u),h(s.$$success,e,u)):(h(s.$error,e,u),h(s.$$success,e,u)),s.$pending?(o(ns,!0),s.$valid=s.$invalid=n,a("",null)):(o(ns,!1),s.$valid=gi(s.$error),s.$invalid=!s.$valid,a("",s.$valid));var c;c=s.$pending&&s.$pending[e]?n:s.$error[e]?!1:s.$$success[e]?!0:null,a(e,c),s.$$parentForm.$setValidity(e,c,s)}function r(e,t,n){s[e]||(s[e]={}),l(s[e],t,n)}function i(e,t,r){s[e]&&h(s[e],t,r),gi(s[e])&&(s[e]=n)}function o(e,t){t&&!c[e]?(f.addClass(u,e),c[e]=!0):!t&&c[e]&&(f.removeClass(u,e),c[e]=!1)}function a(e,t){e=e?"-"+ct(e,"-"):"",o(Ka+e,t===!0),o(Qa+e,t===!1)}var s=e.ctrl,u=e.$element,c={},l=e.set,h=e.unset,f=e.$animate;c[Qa]=!(c[Ka]=u.hasClass(Ka)),s.$setValidity=t}function gi(e){if(e)for(var t in e)if(e.hasOwnProperty(t))return!1;return!0}var yi=/^\/(.+)\/([a-z]*)$/,bi="validity",xi=function(e){return C(e)?e.toLowerCase():e},wi=Object.prototype.hasOwnProperty,_i=function(e){return C(e)?e.toUpperCase():e},Ci=function(e){return C(e)?e.replace(/[A-Z]/g,function(e){return String.fromCharCode(32|e.charCodeAt(0))}):e},Ei=function(e){return C(e)?e.replace(/[a-z]/g,function(e){return String.fromCharCode(-33&e.charCodeAt(0))}):e};"i"!=="I".toLowerCase()&&(xi=Ci,_i=Ei);var Si,Mi,Ti,Ai,Pi=[].slice,ki=[].splice,Ri=[].push,Ii=Object.prototype.toString,Di=Object.getPrototypeOf,Bi=r("ng"),Vi=e.angular||(e.angular={}),Li=0;Si=t.documentMode,m.$inject=[],v.$inject=[];var Ni,Oi=Array.isArray,Fi=/^\[object (Uint8(Clamped)?)|(Uint16)|(Uint32)|(Int8)|(Int16)|(Int32)|(Float(32)|(64))Array\]$/,Ui=function(e){return C(e)?e.trim():e},zi=function(e){return e.replace(/([-()\[\]{}+?*.$\^|,:#<!\\])/g,"\\$1").replace(/\x08/g,"\\x08")},$i=function(){function e(){try{return new Function(""),!1}catch(e){return!0}}if(!x($i.rules)){var n=t.querySelector("[ng-csp]")||t.querySelector("[data-ng-csp]");if(n){var r=n.getAttribute("ng-csp")||n.getAttribute("data-ng-csp");$i.rules={noUnsafeEval:!r||-1!==r.indexOf("no-unsafe-eval"),noInlineStyle:!r||-1!==r.indexOf("no-inline-style")}}else $i.rules={noUnsafeEval:e(),noInlineStyle:!1}}return $i.rules},Hi=function(){if(x(Hi.name_))return Hi.name_;var e,n,r,i,o=ji.length;for(n=0;o>n;++n)if(r=ji[n],e=t.querySelector("["+r.replace(":","\\:")+"jq]")){i=e.getAttribute(r+"jq");break}return Hi.name_=i},ji=["ng-","data-ng-","ng:","x-ng-"],Gi=/[A-Z]/g,Wi=!1,qi=1,Xi=2,Yi=3,Ki=8,Qi=9,Zi=11,Ji={full:"1.4.7",major:1,minor:4,dot:7,codeName:"dark-luminescence"};At.expando="ng339";var eo=At.cache={},to=1,no=function(e,t,n){e.addEventListener(t,n,!1)},ro=function(e,t,n){e.removeEventListener(t,n,!1)};At._data=function(e){return this.cache[e[this.expando]]||{}};var io=/([\:\-\_]+(.))/g,oo=/^moz([A-Z])/,ao={mouseleave:"mouseout",mouseenter:"mouseover"},so=r("jqLite"),uo=/^<([\w-]+)\s*\/?>(?:<\/\1>|)$/,co=/<|&#?\w+;/,lo=/<([\w:-]+)/,ho=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:-]+)[^>]*)\/>/gi,fo={option:[1,'<select multiple="multiple">',"</select>"],thead:[1,"<table>","</table>"],col:[2,"<table><colgroup>","</colgroup></table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],_default:[0,"",""]};fo.optgroup=fo.option,fo.tbody=fo.tfoot=fo.colgroup=fo.caption=fo.thead,fo.th=fo.td;var po=At.prototype={ready:function(n){function r(){i||(i=!0,n())}var i=!1;"complete"===t.readyState?setTimeout(r):(this.on("DOMContentLoaded",r),At(e).on("load",r))},toString:function(){var e=[];return o(this,function(t){e.push(""+t)}),"["+e.join(", ")+"]"},eq:function(e){return e>=0?Mi(this[e]):Mi(this[this.length+e])},length:0,push:Ri,sort:[].sort,splice:[].splice},mo={};o("multiple,selected,checked,disabled,readOnly,required,open".split(","),function(e){mo[xi(e)]=e});var vo={};o("input,select,option,textarea,button,form,details".split(","),function(e){vo[e]=!0});var go={ngMinlength:"minlength",ngMaxlength:"maxlength",ngMin:"min",ngMax:"max",ngPattern:"pattern"};o({data:Bt,removeData:It,hasData:St},function(e,t){At[t]=e}),o({data:Bt,inheritedData:Ut,scope:function(e){return Mi.data(e,"$scope")||Ut(e.parentNode||e,["$isolateScope","$scope"])},isolateScope:function(e){return Mi.data(e,"$isolateScope")||Mi.data(e,"$isolateScopeNoTemplate")},controller:Ft,injector:function(e){return Ut(e,"$injector")},removeAttr:function(e,t){e.removeAttribute(t)},hasClass:Vt,css:function(e,t,n){return t=_t(t),x(n)?(e.style[t]=n,void 0):e.style[t]},attr:function(e,t,r){var i=e.nodeType;if(i!==Yi&&i!==Xi&&i!==Ki){var o=xi(t);if(mo[o]){if(!x(r))return e[t]||(e.attributes.getNamedItem(t)||m).specified?o:n;r?(e[t]=!0,e.setAttribute(t,o)):(e[t]=!1,e.removeAttribute(o))}else if(x(r))e.setAttribute(t,r);else if(e.getAttribute){var a=e.getAttribute(t,2);return null===a?n:a}}},prop:function(e,t,n){return x(n)?(e[t]=n,void 0):e[t]},text:function(){function e(e,t){if(b(t)){var n=e.nodeType;return n===qi||n===Yi?e.textContent:""}e.textContent=t}return e.$dv="",e}(),val:function(e,t){if(b(t)){if(e.multiple&&"select"===O(e)){var n=[];return o(e.options,function(e){e.selected&&n.push(e.value||e.text)}),0===n.length?null:n}return e.value}e.value=t},html:function(e,t){return b(t)?e.innerHTML:(kt(e,!0),e.innerHTML=t,void 0)},empty:zt},function(e,t){At.prototype[t]=function(t,n){var r,i,o=this.length;if(e!==zt&&b(2==e.length&&e!==Vt&&e!==Ft?t:n)){if(w(t)){for(r=0;o>r;r++)if(e===Bt)e(this[r],t);else for(i in t)e(this[r],i,t[i]);return this}for(var a=e.$dv,s=b(a)?Math.min(o,1):o,u=0;s>u;u++){var c=e(this[u],t,n);a=a?a+c:c}return a}for(r=0;o>r;r++)e(this[r],t,n);return this}}),o({removeData:It,on:function Ds(e,t,n,r){if(x(r))throw so("onargs","jqLite#on() does not support the `selector` or `eventData` parameters");if(Et(e)){var i=Dt(e,!0),o=i.events,a=i.handle;a||(a=i.handle=Wt(e,o));for(var s=t.indexOf(" ")>=0?t.split(" "):[t],u=s.length;u--;){t=s[u];var c=o[t];c||(o[t]=[],"mouseenter"===t||"mouseleave"===t?Ds(e,ao[t],function(e){var n=this,r=e.relatedTarget;(!r||r!==n&&!n.contains(r))&&a(e,t)}):"$destroy"!==t&&no(e,t,a),c=o[t]),c.push(n)}}},off:Rt,one:function(e,t,n){e=Mi(e),e.on(t,function r(){e.off(t,n),e.off(t,r)}),e.on(t,n)},replaceWith:function(e,t){var n,r=e.parentNode;kt(e),o(new At(t),function(t){n?r.insertBefore(t,n.nextSibling):r.replaceChild(t,e),n=t})},children:function(e){var t=[];return o(e.childNodes,function(e){e.nodeType===qi&&t.push(e)}),t},contents:function(e){return e.contentDocument||e.childNodes||[]},append:function(e,t){var n=e.nodeType;if(n===qi||n===Zi){t=new At(t);for(var r=0,i=t.length;i>r;r++){var o=t[r];e.appendChild(o)}}},prepend:function(e,t){if(e.nodeType===qi){var n=e.firstChild;o(new At(t),function(t){e.insertBefore(t,n)})}},wrap:function(e,t){t=Mi(t).eq(0).clone()[0];var n=e.parentNode;n&&n.replaceChild(t,e),t.appendChild(e)},remove:$t,detach:function(e){$t(e,!0)},after:function(e,t){var n=e,r=e.parentNode;t=new At(t);for(var i=0,o=t.length;o>i;i++){var a=t[i];r.insertBefore(a,n.nextSibling),n=a}},addClass:Nt,removeClass:Lt,toggleClass:function(e,t,n){t&&o(t.split(" "),function(t){var r=n;b(r)&&(r=!Vt(e,t)),(r?Nt:Lt)(e,t)})},parent:function(e){var t=e.parentNode;return t&&t.nodeType!==Zi?t:null},next:function(e){return e.nextElementSibling},find:function(e,t){return e.getElementsByTagName?e.getElementsByTagName(t):[]},clone:Pt,triggerHandler:function(e,t,n){var r,i,a,s=t.type||t,u=Dt(e),c=u&&u.events,l=c&&c[s];l&&(r={preventDefault:function(){this.defaultPrevented=!0},isDefaultPrevented:function(){return this.defaultPrevented===!0},stopImmediatePropagation:function(){this.immediatePropagationStopped=!0},isImmediatePropagationStopped:function(){return this.immediatePropagationStopped===!0},stopPropagation:m,type:s,target:e},t.type&&(r=h(r,t)),i=z(l),a=n?[r].concat(n):[r],o(i,function(t){r.isImmediatePropagationStopped()||t.apply(e,a)}))}},function(e,t){At.prototype[t]=function(t,n,r){for(var i,o=0,a=this.length;a>o;o++)b(i)?(i=e(this[o],t,n,r),x(i)&&(i=Mi(i))):Ot(i,e(this[o],t,n,r));return x(i)?i:this},At.prototype.bind=At.prototype.on,At.prototype.unbind=At.prototype.off}),Yt.prototype={put:function(e,t){this[Xt(e,this.nextUid)]=t},get:function(e){return this[Xt(e,this.nextUid)]},remove:function(e){var t=this[e=Xt(e,this.nextUid)];return delete this[e],t}};var yo=[function(){this.$get=[function(){return Yt}]}],bo=/^[^\(]*\(\s*([^\)]*)\)/m,xo=/,/,wo=/^\s*(_?)(\S+?)\1\s*$/,_o=/((\/\/.*$)|(\/\*[\s\S]*?\*\/))/gm,Co=r("$injector");Zt.$$annotate=Qt;var Eo=r("$animate"),So=1,Mo="ng-animate",To=function(){this.$get=["$q","$$rAF",function(e,t){function n(){}return n.all=m,n.chain=m,n.prototype={end:m,cancel:m,resume:m,pause:m,complete:m,then:function(n,r){return e(function(e){t(function(){e()})}).then(n,r)}},n}]},Ao=function(){var e=new Yt,t=[];this.$get=["$$AnimateRunner","$rootScope",function(n,r){function i(e,t,n){var r=!1;return t&&(t=C(t)?t.split(" "):Oi(t)?t:[],o(t,function(t){t&&(r=!0,e[t]=n)})),r}function a(){o(t,function(t){var n=e.get(t);if(n){var r=nn(t.attr("class")),i="",a="";o(n,function(e,t){var n=!!r[t];e!==n&&(e?i+=(i.length?" ":"")+t:a+=(a.length?" ":"")+t)}),o(t,function(e){i&&Nt(e,i),a&&Lt(e,a)}),e.remove(t)}}),t.length=0}function s(n,o,s){var u=e.get(n)||{},c=i(u,o,!0),l=i(u,s,!1);(c||l)&&(e.put(n,u),t.push(n),1===t.length&&r.$$postDigest(a))}return{enabled:m,on:m,off:m,pin:m,push:function(e,t,r,i){return i&&i(),r=r||{},r.from&&e.css(r.from),r.to&&e.css(r.to),(r.addClass||r.removeClass)&&s(e,r.addClass,r.removeClass),new n}}}]},Po=["$provide",function(e){var t=this;this.$$registeredAnimations=Object.create(null),this.register=function(n,r){if(n&&"."!==n.charAt(0))throw Eo("notcsel","Expecting class selector starting with '.' got '{0}'.",n);var i=n+"-animation";t.$$registeredAnimations[n.substr(1)]=i,e.factory(i,r)},this.classNameFilter=function(e){if(1===arguments.length&&(this.$$classNameFilter=e instanceof RegExp?e:null,this.$$classNameFilter)){var t=new RegExp("(\\s+|\\/)"+Mo+"(\\s+|\\/)");if(t.test(this.$$classNameFilter.toString()))throw Eo("nongcls",'$animateProvider.classNameFilter(regex) prohibits accepting a regex value which matches/contains the "{0}" CSS class.',Mo)}return this.$$classNameFilter},this.$get=["$$animateQueue",function(e){function t(e,t,n){if(n){var r=tn(n);!r||r.parentNode||r.previousElementSibling||(n=null)}n?n.after(e):t.prepend(e)}return{on:e.on,off:e.off,pin:e.pin,enabled:e.enabled,cancel:function(e){e.end&&e.end()},enter:function(n,r,i,o){return r=r&&Mi(r),i=i&&Mi(i),r=r||i.parent(),t(n,r,i),e.push(n,"enter",rn(o))},move:function(n,r,i,o){return r=r&&Mi(r),i=i&&Mi(i),r=r||i.parent(),t(n,r,i),e.push(n,"move",rn(o))},leave:function(t,n){return e.push(t,"leave",rn(n),function(){t.remove()})},addClass:function(t,n,r){return r=rn(r),r.addClass=en(r.addclass,n),e.push(t,"addClass",r)},removeClass:function(t,n,r){return r=rn(r),r.removeClass=en(r.removeClass,n),e.push(t,"removeClass",r)},setClass:function(t,n,r,i){return i=rn(i),i.addClass=en(i.addClass,n),i.removeClass=en(i.removeClass,r),e.push(t,"setClass",i)},animate:function(t,n,r,i,o){return o=rn(o),o.from=o.from?h(o.from,n):n,o.to=o.to?h(o.to,r):r,i=i||"ng-inline-animate",o.tempClasses=en(o.tempClasses,i),e.push(t,"animate",o)}}}]}],ko=function(){this.$get=["$$rAF","$q",function(e,t){var n=function(){};return n.prototype={done:function(e){this.defer&&this.defer[e===!0?"reject":"resolve"]()},end:function(){this.done()},cancel:function(){this.done(!0)},getPromise:function(){return this.defer||(this.defer=t.defer()),this.defer.promise},then:function(e,t){return this.getPromise().then(e,t)},"catch":function(e){return this.getPromise()["catch"](e)},"finally":function(e){return this.getPromise()["finally"](e)}},function(t,r){function i(){return e(function(){o(),a||s.done(),a=!0}),s}function o(){r.addClass&&(t.addClass(r.addClass),r.addClass=null),r.removeClass&&(t.removeClass(r.removeClass),r.removeClass=null),r.to&&(t.css(r.to),r.to=null)}r.cleanupStyles&&(r.from=r.to=null),r.from&&(t.css(r.from),r.from=null);var a,s=new n;return{start:i,end:i}}}]},Ro=r("$compile");cn.$inject=["$provide","$$sanitizeUriProvider"];var Io=/^((?:x|data)[\:\-_])/i,Do=r("$controller"),Bo=/^(\S+)(\s+as\s+(\w+))?$/,Vo=function(){this.$get=["$document",function(e){return function(t){return t?!t.nodeType&&t instanceof Mi&&(t=t[0]):t=e[0].body,t.offsetWidth+1}}]},Lo="application/json",No={"Content-Type":Lo+";charset=utf-8"},Oo=/^\[|^\{(?!\{)/,Fo={"[":/]$/,"{":/}$/},Uo=/^\)\]\}',?\n/,zo=r("$http"),$o=function(e){return function(){throw zo("legacy","The method `{0}` on the promise returned from `$http` has been disabled.",e)}},Ho=Vi.$interpolateMinErr=r("$interpolate");Ho.throwNoconcat=function(e){throw Ho("noconcat","Error while interpolating: {0}\nStrict Contextual Escaping disallows interpolations that concatenate multiple expressions when a trusted value is required. See http://docs.angularjs.org/api/ng.$sce",e)},Ho.interr=function(e,t){return Ho("interr","Can't interpolate: {0}\n{1}",e,t.toString())};var jo=/^([^\?#]*)(\?([^#]*))?(#(.*))?$/,Go={http:80,https:443,ftp:21},Wo=r("$location"),qo={$$html5:!1,$$replace:!1,absUrl:Hn("$$absUrl"),url:function(e){if(b(e))return this.$$url;var t=jo.exec(e);return(t[1]||""===e)&&this.path(decodeURIComponent(t[1])),(t[2]||t[1]||""===e)&&this.search(t[3]||""),this.hash(t[5]||""),this},protocol:Hn("$$protocol"),host:Hn("$$host"),port:Hn("$$port"),path:jn("$$path",function(e){return e=null!==e?e.toString():"","/"==e.charAt(0)?e:"/"+e}),search:function(e,t){switch(arguments.length){case 0:return this.$$search;case 1:if(C(e)||E(e))e=e.toString(),this.$$search=et(e);else{if(!w(e))throw Wo("isrcharg","The first argument of the `$location#search()` call must be a string or an object.");e=U(e,{}),o(e,function(t,n){null==t&&delete e[n]}),this.$$search=e}break;default:b(t)||null===t?delete this.$$search[e]:this.$$search[e]=t}return this.$$compose(),this},hash:jn("$$hash",function(e){return null!==e?e.toString():""}),replace:function(){return this.$$replace=!0,this}};o([$n,zn,Un],function(e){e.prototype=Object.create(qo),e.prototype.state=function(t){if(!arguments.length)return this.$$state;if(e!==Un||!this.$$html5)throw Wo("nostate","History API state support is available only in HTML5 mode and only in browsers supporting HTML5 History API");return this.$$state=b(t)?null:t,this}});var Xo=r("$parse"),Yo=Function.prototype.call,Ko=Function.prototype.apply,Qo=Function.prototype.bind,Zo=vt();o("+ - * / % === !== == != < > <= >= && || ! = |".split(" "),function(e){Zo[e]=!0});var Jo={n:"\n",f:"\f",r:"\r",t:" ",v:"","'":"'",'"':'"'},ea=function(e){this.options=e};ea.prototype={constructor:ea,lex:function(e){for(this.text=e,this.index=0,this.tokens=[];this.index<this.text.length;){var t=this.text.charAt(this.index);if('"'===t||"'"===t)this.readString(t);else if(this.isNumber(t)||"."===t&&this.isNumber(this.peek()))this.readNumber();else if(this.isIdent(t))this.readIdent();else if(this.is(t,"(){}[].,;:?"))this.tokens.push({index:this.index,text:t}),this.index++;else if(this.isWhitespace(t))this.index++;else{var n=t+this.peek(),r=n+this.peek(2),i=Zo[t],o=Zo[n],a=Zo[r];if(i||o||a){var s=a?r:o?n:t;this.tokens.push({index:this.index,text:s,operator:!0}),this.index+=s.length}else this.throwError("Unexpected next character ",this.index,this.index+1)}}return this.tokens},is:function(e,t){return-1!==t.indexOf(e)},peek:function(e){var t=e||1;return this.index+t<this.text.length?this.text.charAt(this.index+t):!1},isNumber:function(e){return e>="0"&&"9">=e&&"string"==typeof e},isWhitespace:function(e){return" "===e||"\r"===e||" "===e||"\n"===e||""===e||" "===e},isIdent:function(e){return e>="a"&&"z">=e||e>="A"&&"Z">=e||"_"===e||"$"===e},isExpOperator:function(e){return"-"===e||"+"===e||this.isNumber(e)},throwError:function(e,t,n){n=n||this.index;var r=x(t)?"s "+t+"-"+this.index+" ["+this.text.substring(t,n)+"]":" "+n;throw Xo("lexerr","Lexer Error: {0} at column{1} in expression [{2}].",e,r,this.text)},readNumber:function(){for(var e="",t=this.index;this.index<this.text.length;){var n=xi(this.text.charAt(this.index));if("."==n||this.isNumber(n))e+=n;else{var r=this.peek();if("e"==n&&this.isExpOperator(r))e+=n;else if(this.isExpOperator(n)&&r&&this.isNumber(r)&&"e"==e.charAt(e.length-1))e+=n;else{if(!this.isExpOperator(n)||r&&this.isNumber(r)||"e"!=e.charAt(e.length-1))break;this.throwError("Invalid exponent")}}this.index++}this.tokens.push({index:t,text:e,constant:!0,value:Number(e)})},readIdent:function(){for(var e=this.index;this.index<this.text.length;){var t=this.text.charAt(this.index);if(!this.isIdent(t)&&!this.isNumber(t))break;this.index++}this.tokens.push({index:e,text:this.text.slice(e,this.index),identifier:!0})},readString:function(e){var t=this.index;this.index++;for(var n="",r=e,i=!1;this.index<this.text.length;){var o=this.text.charAt(this.index);if(r+=o,i){if("u"===o){var a=this.text.substring(this.index+1,this.index+5);a.match(/[\da-f]{4}/i)||this.throwError("Invalid unicode escape [\\u"+a+"]"),this.index+=4,n+=String.fromCharCode(parseInt(a,16))}else{var s=Jo[o];n+=s||o}i=!1}else if("\\"===o)i=!0;else{if(o===e)return this.index++,this.tokens.push({index:t,text:r,constant:!0,value:n}),void 0;n+=o}this.index++}this.throwError("Unterminated quote",t)}};var ta=function(e,t){this.lexer=e,this.options=t};ta.Program="Program",ta.ExpressionStatement="ExpressionStatement",ta.AssignmentExpression="AssignmentExpression",ta.ConditionalExpression="ConditionalExpression",ta.LogicalExpression="LogicalExpression",ta.BinaryExpression="BinaryExpression",ta.UnaryExpression="UnaryExpression",ta.CallExpression="CallExpression",ta.MemberExpression="MemberExpression",ta.Identifier="Identifier",ta.Literal="Literal",ta.ArrayExpression="ArrayExpression",ta.Property="Property",ta.ObjectExpression="ObjectExpression",ta.ThisExpression="ThisExpression",ta.NGValueParameter="NGValueParameter",ta.prototype={ast:function(e){this.text=e,this.tokens=this.lexer.lex(e);var t=this.program();return 0!==this.tokens.length&&this.throwError("is an unexpected token",this.tokens[0]),t},program:function(){for(var e=[];;)if(this.tokens.length>0&&!this.peek("}",")",";","]")&&e.push(this.expressionStatement()),!this.expect(";"))return{type:ta.Program,body:e}},expressionStatement:function(){return{type:ta.ExpressionStatement,expression:this.filterChain()}},filterChain:function(){for(var e,t=this.expression();e=this.expect("|");)t=this.filter(t);return t},expression:function(){return this.assignment()},assignment:function(){var e=this.ternary();return this.expect("=")&&(e={type:ta.AssignmentExpression,left:e,right:this.assignment(),operator:"="}),e},ternary:function(){var e,t,n=this.logicalOR();return this.expect("?")&&(e=this.expression(),this.consume(":"))?(t=this.expression(),{type:ta.ConditionalExpression,test:n,alternate:e,consequent:t}):n},logicalOR:function(){for(var e=this.logicalAND();this.expect("||");)e={type:ta.LogicalExpression,operator:"||",left:e,right:this.logicalAND()};return e},logicalAND:function(){for(var e=this.equality();this.expect("&&");)e={type:ta.LogicalExpression,operator:"&&",left:e,right:this.equality()};return e},equality:function(){for(var e,t=this.relational();e=this.expect("==","!=","===","!==");)t={type:ta.BinaryExpression,operator:e.text,left:t,right:this.relational()};return t},relational:function(){for(var e,t=this.additive();e=this.expect("<",">","<=",">=");)t={type:ta.BinaryExpression,operator:e.text,left:t,right:this.additive()};return t},additive:function(){for(var e,t=this.multiplicative();e=this.expect("+","-");)t={type:ta.BinaryExpression,operator:e.text,left:t,right:this.multiplicative()};return t},multiplicative:function(){for(var e,t=this.unary();e=this.expect("*","/","%");)t={type:ta.BinaryExpression,operator:e.text,left:t,right:this.unary()};return t},unary:function(){var e;return(e=this.expect("+","-","!"))?{type:ta.UnaryExpression,operator:e.text,prefix:!0,argument:this.unary()}:this.primary()},primary:function(){var e;this.expect("(")?(e=this.filterChain(),this.consume(")")):this.expect("[")?e=this.arrayDeclaration():this.expect("{")?e=this.object():this.constants.hasOwnProperty(this.peek().text)?e=U(this.constants[this.consume().text]):this.peek().identifier?e=this.identifier():this.peek().constant?e=this.constant():this.throwError("not a primary expression",this.peek());for(var t;t=this.expect("(","[",".");)"("===t.text?(e={type:ta.CallExpression,callee:e,arguments:this.parseArguments()},this.consume(")")):"["===t.text?(e={type:ta.MemberExpression,object:e,property:this.expression(),computed:!0},this.consume("]")):"."===t.text?e={type:ta.MemberExpression,object:e,property:this.identifier(),computed:!1}:this.throwError("IMPOSSIBLE");return e},filter:function(e){for(var t=[e],n={type:ta.CallExpression,callee:this.identifier(),arguments:t,filter:!0};this.expect(":");)t.push(this.expression());return n},parseArguments:function(){var e=[];if(")"!==this.peekToken().text)do e.push(this.expression());while(this.expect(","));return e},identifier:function(){var e=this.consume();return e.identifier||this.throwError("is not a valid identifier",e),{type:ta.Identifier,name:e.text}},constant:function(){return{type:ta.Literal,value:this.consume().value}},arrayDeclaration:function(){var e=[];if("]"!==this.peekToken().text)do{if(this.peek("]"))break;e.push(this.expression())}while(this.expect(","));return this.consume("]"),{type:ta.ArrayExpression,elements:e}},object:function(){var e,t=[];if("}"!==this.peekToken().text)do{if(this.peek("}"))break;e={type:ta.Property,kind:"init"},this.peek().constant?e.key=this.constant():this.peek().identifier?e.key=this.identifier():this.throwError("invalid key",this.peek()),this.consume(":"),e.value=this.expression(),t.push(e)}while(this.expect(","));return this.consume("}"),{type:ta.ObjectExpression,properties:t}},throwError:function(e,t){throw Xo("syntax","Syntax Error: Token '{0}' {1} at column {2} of the expression [{3}] starting at [{4}].",t.text,e,t.index+1,this.text,this.text.substring(t.index))},consume:function(e){if(0===this.tokens.length)throw Xo("ueoe","Unexpected end of expression: {0}",this.text);var t=this.expect(e);return t||this.throwError("is unexpected, expecting ["+e+"]",this.peek()),t},peekToken:function(){if(0===this.tokens.length)throw Xo("ueoe","Unexpected end of expression: {0}",this.text);return this.tokens[0]},peek:function(e,t,n,r){return this.peekAhead(0,e,t,n,r)},peekAhead:function(e,t,n,r,i){if(this.tokens.length>e){var o=this.tokens[e],a=o.text;if(a===t||a===n||a===r||a===i||!t&&!n&&!r&&!i)return o}return!1},expect:function(e,t,n,r){var i=this.peek(e,t,n,r);return i?(this.tokens.shift(),i):!1},constants:{"true":{type:ta.Literal,value:!0},"false":{type:ta.Literal,value:!1},"null":{type:ta.Literal,value:null},undefined:{type:ta.Literal,value:n},"this":{type:ta.ThisExpression}}},sr.prototype={compile:function(e,t){var r=this,i=this.astBuilder.ast(e);this.state={nextId:0,filters:{},expensiveChecks:t,fn:{vars:[],body:[],own:{}},assign:{vars:[],body:[],own:{}},inputs:[]},tr(i,r.$filter);var a,s="";if(this.stage="assign",a=ir(i)){this.state.computing="assign";var u=this.nextId();this.recurse(a,u),this.return_(u),s="fn.assign="+this.generateFunction("assign","s,v,l")}var c=nr(i.body);r.stage="inputs",o(c,function(e,t){var n="fn"+t;r.state[n]={vars:[],body:[],own:{}},r.state.computing=n;var i=r.nextId();r.recurse(e,i),r.return_(i),r.state.inputs.push(n),e.watchId=t}),this.state.computing="fn",this.stage="main",this.recurse(i);var l='"'+this.USE+" "+this.STRICT+'";\n'+this.filterPrefix()+"var fn="+this.generateFunction("fn","s,l,a,i")+s+this.watchFns()+"return fn;",h=new Function("$filter","ensureSafeMemberName","ensureSafeObject","ensureSafeFunction","getStringValue","ensureSafeAssignContext","ifDefined","plus","text",l)(this.$filter,qn,Yn,Kn,Xn,Qn,Zn,Jn,e);return this.state=this.stage=n,h.literal=or(i),h.constant=ar(i),h},USE:"use",STRICT:"strict",watchFns:function(){var e=[],t=this.state.inputs,n=this;return o(t,function(t){e.push("var "+t+"="+n.generateFunction(t,"s"))}),t.length&&e.push("fn.inputs=["+t.join(",")+"];"),e.join("")},generateFunction:function(e,t){return"function("+t+"){"+this.varsPrefix(e)+this.body(e)+"};"},filterPrefix:function(){var e=[],t=this;return o(this.state.filters,function(n,r){e.push(n+"=$filter("+t.escape(r)+")")}),e.length?"var "+e.join(",")+";":""},varsPrefix:function(e){return this.state[e].vars.length?"var "+this.state[e].vars.join(",")+";":""},body:function(e){return this.state[e].body.join("")},recurse:function(e,t,r,i,a,s){var u,c,l,h,f=this;if(i=i||m,!s&&x(e.watchId))return t=t||this.nextId(),this.if_("i",this.lazyAssign(t,this.computedMember("i",e.watchId)),this.lazyRecurse(e,t,r,i,a,!0)),void 0;switch(e.type){case ta.Program:o(e.body,function(t,r){f.recurse(t.expression,n,n,function(e){c=e}),r!==e.body.length-1?f.current().body.push(c,";"):f.return_(c)});break;case ta.Literal:h=this.escape(e.value),this.assign(t,h),i(h);break;case ta.UnaryExpression:this.recurse(e.argument,n,n,function(e){c=e}),h=e.operator+"("+this.ifDefined(c,0)+")",this.assign(t,h),i(h);break;case ta.BinaryExpression:this.recurse(e.left,n,n,function(e){u=e}),this.recurse(e.right,n,n,function(e){c=e}),h="+"===e.operator?this.plus(u,c):"-"===e.operator?this.ifDefined(u,0)+e.operator+this.ifDefined(c,0):"("+u+")"+e.operator+"("+c+")",this.assign(t,h),i(h);break;case ta.LogicalExpression:t=t||this.nextId(),f.recurse(e.left,t),f.if_("&&"===e.operator?t:f.not(t),f.lazyRecurse(e.right,t)),i(t);break;case ta.ConditionalExpression:t=t||this.nextId(),f.recurse(e.test,t),f.if_(t,f.lazyRecurse(e.alternate,t),f.lazyRecurse(e.consequent,t)),i(t);break;case ta.Identifier:t=t||this.nextId(),r&&(r.context="inputs"===f.stage?"s":this.assign(this.nextId(),this.getHasOwnProperty("l",e.name)+"?l:s"),r.computed=!1,r.name=e.name),qn(e.name),f.if_("inputs"===f.stage||f.not(f.getHasOwnProperty("l",e.name)),function(){f.if_("inputs"===f.stage||"s",function(){a&&1!==a&&f.if_(f.not(f.nonComputedMember("s",e.name)),f.lazyAssign(f.nonComputedMember("s",e.name),"{}")),f.assign(t,f.nonComputedMember("s",e.name))})},t&&f.lazyAssign(t,f.nonComputedMember("l",e.name))),(f.state.expensiveChecks||cr(e.name))&&f.addEnsureSafeObject(t),i(t);break;case ta.MemberExpression:u=r&&(r.context=this.nextId())||this.nextId(),t=t||this.nextId(),f.recurse(e.object,u,n,function(){f.if_(f.notNull(u),function(){e.computed?(c=f.nextId(),f.recurse(e.property,c),f.getStringValue(c),f.addEnsureSafeMemberName(c),a&&1!==a&&f.if_(f.not(f.computedMember(u,c)),f.lazyAssign(f.computedMember(u,c),"{}")),h=f.ensureSafeObject(f.computedMember(u,c)),f.assign(t,h),r&&(r.computed=!0,r.name=c)):(qn(e.property.name),a&&1!==a&&f.if_(f.not(f.nonComputedMember(u,e.property.name)),f.lazyAssign(f.nonComputedMember(u,e.property.name),"{}")),h=f.nonComputedMember(u,e.property.name),(f.state.expensiveChecks||cr(e.property.name))&&(h=f.ensureSafeObject(h)),f.assign(t,h),r&&(r.computed=!1,r.name=e.property.name))},function(){f.assign(t,"undefined")}),i(t)},!!a);break;case ta.CallExpression:t=t||this.nextId(),e.filter?(c=f.filter(e.callee.name),l=[],o(e.arguments,function(e){var t=f.nextId();f.recurse(e,t),l.push(t)}),h=c+"("+l.join(",")+")",f.assign(t,h),i(t)):(c=f.nextId(),u={},l=[],f.recurse(e.callee,c,u,function(){f.if_(f.notNull(c),function(){f.addEnsureSafeFunction(c),o(e.arguments,function(e){f.recurse(e,f.nextId(),n,function(e){l.push(f.ensureSafeObject(e))
})}),u.name?(f.state.expensiveChecks||f.addEnsureSafeObject(u.context),h=f.member(u.context,u.name,u.computed)+"("+l.join(",")+")"):h=c+"("+l.join(",")+")",h=f.ensureSafeObject(h),f.assign(t,h)},function(){f.assign(t,"undefined")}),i(t)}));break;case ta.AssignmentExpression:if(c=this.nextId(),u={},!rr(e.left))throw Xo("lval","Trying to assing a value to a non l-value");this.recurse(e.left,n,u,function(){f.if_(f.notNull(u.context),function(){f.recurse(e.right,c),f.addEnsureSafeObject(f.member(u.context,u.name,u.computed)),f.addEnsureSafeAssignContext(u.context),h=f.member(u.context,u.name,u.computed)+e.operator+c,f.assign(t,h),i(t||h)})},1);break;case ta.ArrayExpression:l=[],o(e.elements,function(e){f.recurse(e,f.nextId(),n,function(e){l.push(e)})}),h="["+l.join(",")+"]",this.assign(t,h),i(h);break;case ta.ObjectExpression:l=[],o(e.properties,function(e){f.recurse(e.value,f.nextId(),n,function(t){l.push(f.escape(e.key.type===ta.Identifier?e.key.name:""+e.key.value)+":"+t)})}),h="{"+l.join(",")+"}",this.assign(t,h),i(h);break;case ta.ThisExpression:this.assign(t,"s"),i("s");break;case ta.NGValueParameter:this.assign(t,"v"),i("v")}},getHasOwnProperty:function(e,t){var n=e+"."+t,r=this.current().own;return r.hasOwnProperty(n)||(r[n]=this.nextId(!1,e+"&&("+this.escape(t)+" in "+e+")")),r[n]},assign:function(e,t){return e?(this.current().body.push(e,"=",t,";"),e):void 0},filter:function(e){return this.state.filters.hasOwnProperty(e)||(this.state.filters[e]=this.nextId(!0)),this.state.filters[e]},ifDefined:function(e,t){return"ifDefined("+e+","+this.escape(t)+")"},plus:function(e,t){return"plus("+e+","+t+")"},return_:function(e){this.current().body.push("return ",e,";")},if_:function(e,t,n){if(e===!0)t();else{var r=this.current().body;r.push("if(",e,"){"),t(),r.push("}"),n&&(r.push("else{"),n(),r.push("}"))}},not:function(e){return"!("+e+")"},notNull:function(e){return e+"!=null"},nonComputedMember:function(e,t){return e+"."+t},computedMember:function(e,t){return e+"["+t+"]"},member:function(e,t,n){return n?this.computedMember(e,t):this.nonComputedMember(e,t)},addEnsureSafeObject:function(e){this.current().body.push(this.ensureSafeObject(e),";")},addEnsureSafeMemberName:function(e){this.current().body.push(this.ensureSafeMemberName(e),";")},addEnsureSafeFunction:function(e){this.current().body.push(this.ensureSafeFunction(e),";")},addEnsureSafeAssignContext:function(e){this.current().body.push(this.ensureSafeAssignContext(e),";")},ensureSafeObject:function(e){return"ensureSafeObject("+e+",text)"},ensureSafeMemberName:function(e){return"ensureSafeMemberName("+e+",text)"},ensureSafeFunction:function(e){return"ensureSafeFunction("+e+",text)"},getStringValue:function(e){this.assign(e,"getStringValue("+e+",text)")},ensureSafeAssignContext:function(e){return"ensureSafeAssignContext("+e+",text)"},lazyRecurse:function(e,t,n,r,i,o){var a=this;return function(){a.recurse(e,t,n,r,i,o)}},lazyAssign:function(e,t){var n=this;return function(){n.assign(e,t)}},stringEscapeRegex:/[^ a-zA-Z0-9]/g,stringEscapeFn:function(e){return"\\u"+("0000"+e.charCodeAt(0).toString(16)).slice(-4)},escape:function(e){if(C(e))return"'"+e.replace(this.stringEscapeRegex,this.stringEscapeFn)+"'";if(E(e))return e.toString();if(e===!0)return"true";if(e===!1)return"false";if(null===e)return"null";if("undefined"==typeof e)return"undefined";throw Xo("esc","IMPOSSIBLE")},nextId:function(e,t){var n="v"+this.state.nextId++;return e||this.current().vars.push(n+(t?"="+t:"")),n},current:function(){return this.state[this.state.computing]}},ur.prototype={compile:function(e,t){var n=this,r=this.astBuilder.ast(e);this.expression=e,this.expensiveChecks=t,tr(r,n.$filter);var i,a;(i=ir(r))&&(a=this.recurse(i));var s,u=nr(r.body);u&&(s=[],o(u,function(e,t){var r=n.recurse(e);e.input=r,s.push(r),e.watchId=t}));var c=[];o(r.body,function(e){c.push(n.recurse(e.expression))});var l=0===r.body.length?function(){}:1===r.body.length?c[0]:function(e,t){var n;return o(c,function(r){n=r(e,t)}),n};return a&&(l.assign=function(e,t,n){return a(e,n,t)}),s&&(l.inputs=s),l.literal=or(r),l.constant=ar(r),l},recurse:function(e,t,r){var i,a,s,u=this;if(e.input)return this.inputs(e.input,e.watchId);switch(e.type){case ta.Literal:return this.value(e.value,t);case ta.UnaryExpression:return a=this.recurse(e.argument),this["unary"+e.operator](a,t);case ta.BinaryExpression:return i=this.recurse(e.left),a=this.recurse(e.right),this["binary"+e.operator](i,a,t);case ta.LogicalExpression:return i=this.recurse(e.left),a=this.recurse(e.right),this["binary"+e.operator](i,a,t);case ta.ConditionalExpression:return this["ternary?:"](this.recurse(e.test),this.recurse(e.alternate),this.recurse(e.consequent),t);case ta.Identifier:return qn(e.name,u.expression),u.identifier(e.name,u.expensiveChecks||cr(e.name),t,r,u.expression);case ta.MemberExpression:return i=this.recurse(e.object,!1,!!r),e.computed||(qn(e.property.name,u.expression),a=e.property.name),e.computed&&(a=this.recurse(e.property)),e.computed?this.computedMember(i,a,t,r,u.expression):this.nonComputedMember(i,a,u.expensiveChecks,t,r,u.expression);case ta.CallExpression:return s=[],o(e.arguments,function(e){s.push(u.recurse(e))}),e.filter&&(a=this.$filter(e.callee.name)),e.filter||(a=this.recurse(e.callee,!0)),e.filter?function(e,r,i,o){for(var u=[],c=0;c<s.length;++c)u.push(s[c](e,r,i,o));var l=a.apply(n,u,o);return t?{context:n,name:n,value:l}:l}:function(e,n,r,i){var o,c=a(e,n,r,i);if(null!=c.value){Yn(c.context,u.expression),Kn(c.value,u.expression);for(var l=[],h=0;h<s.length;++h)l.push(Yn(s[h](e,n,r,i),u.expression));o=Yn(c.value.apply(c.context,l),u.expression)}return t?{value:o}:o};case ta.AssignmentExpression:return i=this.recurse(e.left,!0,1),a=this.recurse(e.right),function(e,n,r,o){var s=i(e,n,r,o),c=a(e,n,r,o);return Yn(s.value,u.expression),Qn(s.context),s.context[s.name]=c,t?{value:c}:c};case ta.ArrayExpression:return s=[],o(e.elements,function(e){s.push(u.recurse(e))}),function(e,n,r,i){for(var o=[],a=0;a<s.length;++a)o.push(s[a](e,n,r,i));return t?{value:o}:o};case ta.ObjectExpression:return s=[],o(e.properties,function(e){s.push({key:e.key.type===ta.Identifier?e.key.name:""+e.key.value,value:u.recurse(e.value)})}),function(e,n,r,i){for(var o={},a=0;a<s.length;++a)o[s[a].key]=s[a].value(e,n,r,i);return t?{value:o}:o};case ta.ThisExpression:return function(e){return t?{value:e}:e};case ta.NGValueParameter:return function(e,n,r){return t?{value:r}:r}}},"unary+":function(e,t){return function(n,r,i,o){var a=e(n,r,i,o);return a=x(a)?+a:0,t?{value:a}:a}},"unary-":function(e,t){return function(n,r,i,o){var a=e(n,r,i,o);return a=x(a)?-a:0,t?{value:a}:a}},"unary!":function(e,t){return function(n,r,i,o){var a=!e(n,r,i,o);return t?{value:a}:a}},"binary+":function(e,t,n){return function(r,i,o,a){var s=e(r,i,o,a),u=t(r,i,o,a),c=Jn(s,u);return n?{value:c}:c}},"binary-":function(e,t,n){return function(r,i,o,a){var s=e(r,i,o,a),u=t(r,i,o,a),c=(x(s)?s:0)-(x(u)?u:0);return n?{value:c}:c}},"binary*":function(e,t,n){return function(r,i,o,a){var s=e(r,i,o,a)*t(r,i,o,a);return n?{value:s}:s}},"binary/":function(e,t,n){return function(r,i,o,a){var s=e(r,i,o,a)/t(r,i,o,a);return n?{value:s}:s}},"binary%":function(e,t,n){return function(r,i,o,a){var s=e(r,i,o,a)%t(r,i,o,a);return n?{value:s}:s}},"binary===":function(e,t,n){return function(r,i,o,a){var s=e(r,i,o,a)===t(r,i,o,a);return n?{value:s}:s}},"binary!==":function(e,t,n){return function(r,i,o,a){var s=e(r,i,o,a)!==t(r,i,o,a);return n?{value:s}:s}},"binary==":function(e,t,n){return function(r,i,o,a){var s=e(r,i,o,a)==t(r,i,o,a);return n?{value:s}:s}},"binary!=":function(e,t,n){return function(r,i,o,a){var s=e(r,i,o,a)!=t(r,i,o,a);return n?{value:s}:s}},"binary<":function(e,t,n){return function(r,i,o,a){var s=e(r,i,o,a)<t(r,i,o,a);return n?{value:s}:s}},"binary>":function(e,t,n){return function(r,i,o,a){var s=e(r,i,o,a)>t(r,i,o,a);return n?{value:s}:s}},"binary<=":function(e,t,n){return function(r,i,o,a){var s=e(r,i,o,a)<=t(r,i,o,a);return n?{value:s}:s}},"binary>=":function(e,t,n){return function(r,i,o,a){var s=e(r,i,o,a)>=t(r,i,o,a);return n?{value:s}:s}},"binary&&":function(e,t,n){return function(r,i,o,a){var s=e(r,i,o,a)&&t(r,i,o,a);return n?{value:s}:s}},"binary||":function(e,t,n){return function(r,i,o,a){var s=e(r,i,o,a)||t(r,i,o,a);return n?{value:s}:s}},"ternary?:":function(e,t,n,r){return function(i,o,a,s){var u=e(i,o,a,s)?t(i,o,a,s):n(i,o,a,s);return r?{value:u}:u}},value:function(e,t){return function(){return t?{context:n,name:n,value:e}:e}},identifier:function(e,t,r,i,o){return function(a,s){var u=s&&e in s?s:a;i&&1!==i&&u&&!u[e]&&(u[e]={});var c=u?u[e]:n;return t&&Yn(c,o),r?{context:u,name:e,value:c}:c}},computedMember:function(e,t,n,r,i){return function(o,a,s,u){var c,l,h=e(o,a,s,u);return null!=h&&(c=t(o,a,s,u),c=Xn(c),qn(c,i),r&&1!==r&&h&&!h[c]&&(h[c]={}),l=h[c],Yn(l,i)),n?{context:h,name:c,value:l}:l}},nonComputedMember:function(e,t,r,i,o,a){return function(s,u,c,l){var h=e(s,u,c,l);o&&1!==o&&h&&!h[t]&&(h[t]={});var f=null!=h?h[t]:n;return(r||cr(t))&&Yn(f,a),i?{context:h,name:t,value:f}:f}},inputs:function(e,t){return function(n,r,i,o){return o?o[t]:e(n,r,i)}}};var na=function(e,t,n){this.lexer=e,this.$filter=t,this.options=n,this.ast=new ta(this.lexer),this.astCompiler=n.csp?new ur(this.ast,t):new sr(this.ast,t)};na.prototype={constructor:na,parse:function(e){return this.astCompiler.compile(e,this.options.expensiveChecks)}};var ra=(vt(),vt(),Object.prototype.valueOf),ia=r("$sce"),oa={HTML:"html",CSS:"css",URL:"url",RESOURCE_URL:"resourceUrl",JS:"js"},Ro=r("$compile"),aa=t.createElement("a"),sa=Mr(e.location.href);Pr.$inject=["$document"],Rr.$inject=["$provide"],Lr.$inject=["$locale"],Nr.$inject=["$locale"];var ua=".",ca={yyyy:Ur("FullYear",4),yy:Ur("FullYear",2,0,!0),y:Ur("FullYear",1),MMMM:zr("Month"),MMM:zr("Month",!0),MM:Ur("Month",2,1),M:Ur("Month",1,1),dd:Ur("Date",2),d:Ur("Date",1),HH:Ur("Hours",2),H:Ur("Hours",1),hh:Ur("Hours",2,-12),h:Ur("Hours",1,-12),mm:Ur("Minutes",2),m:Ur("Minutes",1),ss:Ur("Seconds",2),s:Ur("Seconds",1),sss:Ur("Milliseconds",3),EEEE:zr("Day"),EEE:zr("Day",!0),a:Wr,Z:$r,ww:Gr(2),w:Gr(1),G:qr,GG:qr,GGG:qr,GGGG:Xr},la=/((?:[^yMdHhmsaZEwG']+)|(?:'(?:[^']|'')*')|(?:E+|y+|M+|d+|H+|h+|m+|s+|a|Z|G+|w+))(.*)/,ha=/^\-?\d+$/;Yr.$inject=["$locale"];var fa=g(xi),pa=g(_i);Zr.$inject=["$parse"];var da=g({restrict:"E",compile:function(e,t){return t.href||t.xlinkHref?void 0:function(e,t){if("a"===t[0].nodeName.toLowerCase()){var n="[object SVGAnimatedString]"===Ii.call(t.prop("href"))?"xlink:href":"href";t.on("click",function(e){t.attr(n)||e.preventDefault()})}}}}),ma={};o(mo,function(e,t){function n(e,n,i){e.$watch(i[r],function(e){i.$set(t,!!e)})}if("multiple"!=e){var r=ln("ng-"+t),i=n;"checked"===e&&(i=function(e,t,i){i.ngModel!==i[r]&&n(e,t,i)}),ma[r]=function(){return{restrict:"A",priority:100,link:i}}}}),o(go,function(e,t){ma[t]=function(){return{priority:100,link:function(e,n,r){if("ngPattern"===t&&"/"==r.ngPattern.charAt(0)){var i=r.ngPattern.match(yi);if(i)return r.$set("ngPattern",new RegExp(i[1],i[2])),void 0}e.$watch(r[t],function(e){r.$set(t,e)})}}}}),o(["src","srcset","href"],function(e){var t=ln("ng-"+e);ma[t]=function(){return{priority:99,link:function(n,r,i){var o=e,a=e;"href"===e&&"[object SVGAnimatedString]"===Ii.call(r.prop("href"))&&(a="xlinkHref",i.$attr[a]="xlink:href",o=null),i.$observe(t,function(t){return t?(i.$set(a,t),Si&&o&&r.prop(o,i[a]),void 0):("href"===e&&i.$set(a,null),void 0)})}}}});var va={$addControl:m,$$renameControl:ei,$removeControl:m,$setValidity:m,$setDirty:m,$setPristine:m,$setSubmitted:m},ga="ng-submitted";ti.$inject=["$element","$attrs","$scope","$animate","$interpolate"];var ya=function(e){return["$timeout","$parse",function(t,r){function i(e){return""===e?r('this[""]').assign:r(e).assign||m}var o={name:"form",restrict:e?"EAC":"E",require:["form","^^?form"],controller:ti,compile:function(r,o){r.addClass(Za).addClass(Ka);var a=o.name?"name":e&&o.ngForm?"ngForm":!1;return{pre:function(e,r,o,s){var u=s[0];if(!("action"in o)){var c=function(t){e.$apply(function(){u.$commitViewValue(),u.$setSubmitted()}),t.preventDefault()};no(r[0],"submit",c),r.on("$destroy",function(){t(function(){ro(r[0],"submit",c)},0,!1)})}var l=s[1]||u.$$parentForm;l.$addControl(u);var f=a?i(u.$name):m;a&&(f(e,u),o.$observe(a,function(t){u.$name!==t&&(f(e,n),u.$$parentForm.$$renameControl(u,t),f=i(u.$name),f(e,u))})),r.on("$destroy",function(){u.$$parentForm.$removeControl(u),f(e,n),h(u,va)})}}}};return o}]},ba=ya(),xa=ya(!0),wa=/\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z)/,_a=/^(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?$/,Ca=/^[a-z0-9!#$%&'*+\/=?^_`{|}~.-]+@[a-z0-9]([a-z0-9-]*[a-z0-9])?(\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)*$/i,Ea=/^\s*(\-|\+)?(\d+|(\d*(\.\d*)))([eE][+-]?\d+)?\s*$/,Sa=/^(\d{4})-(\d{2})-(\d{2})$/,Ma=/^(\d{4})-(\d\d)-(\d\d)T(\d\d):(\d\d)(?::(\d\d)(\.\d{1,3})?)?$/,Ta=/^(\d{4})-W(\d\d)$/,Aa=/^(\d{4})-(\d\d)$/,Pa=/^(\d\d):(\d\d)(?::(\d\d)(\.\d{1,3})?)?$/,ka={text:ri,date:si("date",Sa,ai(Sa,["yyyy","MM","dd"]),"yyyy-MM-dd"),"datetime-local":si("datetimelocal",Ma,ai(Ma,["yyyy","MM","dd","HH","mm","ss","sss"]),"yyyy-MM-ddTHH:mm:ss.sss"),time:si("time",Pa,ai(Pa,["HH","mm","ss","sss"]),"HH:mm:ss.sss"),week:si("week",Ta,oi,"yyyy-Www"),month:si("month",Aa,ai(Aa,["yyyy","MM"]),"yyyy-MM"),number:ci,url:li,email:hi,radio:fi,checkbox:di,hidden:m,button:m,submit:m,reset:m,file:m},Ra=["$browser","$sniffer","$filter","$parse",function(e,t,n,r){return{restrict:"E",require:["?ngModel"],link:{pre:function(i,o,a,s){s[0]&&(ka[xi(a.type)]||ka.text)(i,o,a,s[0],t,e,n,r)}}}}],Ia=/^(true|false|\d+)$/,Da=function(){return{restrict:"A",priority:100,compile:function(e,t){return Ia.test(t.ngValue)?function(e,t,n){n.$set("value",e.$eval(n.ngValue))}:function(e,t,n){e.$watch(n.ngValue,function(e){n.$set("value",e)})}}}},Ba=["$compile",function(e){return{restrict:"AC",compile:function(t){return e.$$addBindingClass(t),function(t,n,r){e.$$addBindingInfo(n,r.ngBind),n=n[0],t.$watch(r.ngBind,function(e){n.textContent=b(e)?"":e})}}}}],Va=["$interpolate","$compile",function(e,t){return{compile:function(n){return t.$$addBindingClass(n),function(n,r,i){var o=e(r.attr(i.$attr.ngBindTemplate));t.$$addBindingInfo(r,o.expressions),r=r[0],i.$observe("ngBindTemplate",function(e){r.textContent=b(e)?"":e})}}}}],La=["$sce","$parse","$compile",function(e,t,n){return{restrict:"A",compile:function(r,i){var o=t(i.ngBindHtml),a=t(i.ngBindHtml,function(e){return(e||"").toString()});return n.$$addBindingClass(r),function(t,r,i){n.$$addBindingInfo(r,i.ngBindHtml),t.$watch(a,function(){r.html(e.getTrustedHtml(o(t))||"")})}}}}],Na=g({restrict:"A",require:"ngModel",link:function(e,t,n,r){r.$viewChangeListeners.push(function(){e.$eval(n.ngChange)})}}),Oa=mi("",!0),Fa=mi("Odd",0),Ua=mi("Even",1),za=Jr({compile:function(e,t){t.$set("ngCloak",n),e.removeClass("ng-cloak")}}),$a=[function(){return{restrict:"A",scope:!0,controller:"@",priority:500}}],Ha={},ja={blur:!0,focus:!0};o("click dblclick mousedown mouseup mouseover mouseout mousemove mouseenter mouseleave keydown keyup keypress submit focus blur copy cut paste".split(" "),function(e){var t=ln("ng-"+e);Ha[t]=["$parse","$rootScope",function(n,r){return{restrict:"A",compile:function(i,o){var a=n(o[t],null,!0);return function(t,n){n.on(e,function(n){var i=function(){a(t,{$event:n})};ja[e]&&r.$$phase?t.$evalAsync(i):t.$apply(i)})}}}}]});var Ga=["$animate",function(e){return{multiElement:!0,transclude:"element",priority:600,terminal:!0,restrict:"A",$$tlb:!0,link:function(n,r,i,o,a){var s,u,c;n.$watch(i.ngIf,function(n){n?u||a(function(n,o){u=o,n[n.length++]=t.createComment(" end ngIf: "+i.ngIf+" "),s={clone:n},e.enter(n,r.parent(),r)}):(c&&(c.remove(),c=null),u&&(u.$destroy(),u=null),s&&(c=mt(s.clone),e.leave(c).then(function(){c=null}),s=null))})}}}],Wa=["$templateRequest","$anchorScroll","$animate",function(e,t,n){return{restrict:"ECA",priority:400,terminal:!0,transclude:"element",controller:Vi.noop,compile:function(r,i){var o=i.ngInclude||i.src,a=i.onload||"",s=i.autoscroll;return function(r,i,u,c,l){var h,f,p,d=0,m=function(){f&&(f.remove(),f=null),h&&(h.$destroy(),h=null),p&&(n.leave(p).then(function(){f=null}),f=p,p=null)};r.$watch(o,function(o){var u=function(){!x(s)||s&&!r.$eval(s)||t()},f=++d;o?(e(o,!0).then(function(e){if(f===d){var t=r.$new();c.template=e;var s=l(t,function(e){m(),n.enter(e,null,i).then(u)});h=t,p=s,h.$emit("$includeContentLoaded",o),r.$eval(a)}},function(){f===d&&(m(),r.$emit("$includeContentError",o))}),r.$emit("$includeContentRequested",o)):(m(),c.template=null)})}}}}],qa=["$compile",function(e){return{restrict:"ECA",priority:-400,require:"ngInclude",link:function(n,r,i,o){return/SVG/.test(r[0].toString())?(r.empty(),e(Mt(o.template,t).childNodes)(n,function(e){r.append(e)},{futureParentElement:r}),void 0):(r.html(o.template),e(r.contents())(n),void 0)}}}],Xa=Jr({priority:450,compile:function(){return{pre:function(e,t,n){e.$eval(n.ngInit)}}}}),Ya=function(){return{restrict:"A",priority:100,require:"ngModel",link:function(e,t,r,i){var a=t.attr(r.$attr.ngList)||", ",s="false"!==r.ngTrim,u=s?Ui(a):a,c=function(e){if(!b(e)){var t=[];return e&&o(e.split(u),function(e){e&&t.push(s?Ui(e):e)}),t}};i.$parsers.push(c),i.$formatters.push(function(e){return Oi(e)?e.join(a):n}),i.$isEmpty=function(e){return!e||!e.length}}}},Ka="ng-valid",Qa="ng-invalid",Za="ng-pristine",Ja="ng-dirty",es="ng-untouched",ts="ng-touched",ns="ng-pending",rs=r("ngModel"),is=["$scope","$exceptionHandler","$attrs","$element","$parse","$animate","$timeout","$rootScope","$q","$interpolate",function(e,t,r,i,a,s,u,c,l,h){this.$viewValue=Number.NaN,this.$modelValue=Number.NaN,this.$$rawModelValue=n,this.$validators={},this.$asyncValidators={},this.$parsers=[],this.$formatters=[],this.$viewChangeListeners=[],this.$untouched=!0,this.$touched=!1,this.$pristine=!0,this.$dirty=!1,this.$valid=!0,this.$invalid=!1,this.$error={},this.$$success={},this.$pending=n,this.$name=h(r.name||"",!1)(e),this.$$parentForm=va;var f,p=a(r.ngModel),d=p.assign,v=p,g=d,y=null,w=this;this.$$setOptions=function(e){if(w.$options=e,e&&e.getterSetter){var t=a(r.ngModel+"()"),n=a(r.ngModel+"($$$p)");v=function(e){var n=p(e);return M(n)&&(n=t(e)),n},g=function(e){M(p(e))?n(e,{$$$p:w.$modelValue}):d(e,w.$modelValue)}}else if(!p.assign)throw rs("nonassign","Expression '{0}' is non-assignable. Element: {1}",r.ngModel,Z(i))},this.$render=m,this.$isEmpty=function(e){return b(e)||""===e||null===e||e!==e};var _=0;vi({ctrl:this,$element:i,set:function(e,t){e[t]=!0},unset:function(e,t){delete e[t]},$animate:s}),this.$setPristine=function(){w.$dirty=!1,w.$pristine=!0,s.removeClass(i,Ja),s.addClass(i,Za)},this.$setDirty=function(){w.$dirty=!0,w.$pristine=!1,s.removeClass(i,Za),s.addClass(i,Ja),w.$$parentForm.$setDirty()},this.$setUntouched=function(){w.$touched=!1,w.$untouched=!0,s.setClass(i,es,ts)},this.$setTouched=function(){w.$touched=!0,w.$untouched=!1,s.setClass(i,ts,es)},this.$rollbackViewValue=function(){u.cancel(y),w.$viewValue=w.$$lastCommittedViewValue,w.$render()},this.$validate=function(){if(!E(w.$modelValue)||!isNaN(w.$modelValue)){var e=w.$$lastCommittedViewValue,t=w.$$rawModelValue,r=w.$valid,i=w.$modelValue,o=w.$options&&w.$options.allowInvalid;w.$$runValidators(t,e,function(e){o||r===e||(w.$modelValue=e?t:n,w.$modelValue!==i&&w.$$writeModelToScope())})}},this.$$runValidators=function(e,t,r){function i(){var e=w.$$parserName||"parse";return b(f)?(u(e,null),!0):(f||(o(w.$validators,function(e,t){u(t,null)}),o(w.$asyncValidators,function(e,t){u(t,null)})),u(e,f),f)}function a(){var n=!0;return o(w.$validators,function(r,i){var o=r(e,t);n=n&&o,u(i,o)}),n?!0:(o(w.$asyncValidators,function(e,t){u(t,null)}),!1)}function s(){var r=[],i=!0;o(w.$asyncValidators,function(o,a){var s=o(e,t);if(!B(s))throw rs("$asyncValidators","Expected asynchronous validator to return a promise but got '{0}' instead.",s);u(a,n),r.push(s.then(function(){u(a,!0)},function(){i=!1,u(a,!1)}))}),r.length?l.all(r).then(function(){c(i)},m):c(!0)}function u(e,t){h===_&&w.$setValidity(e,t)}function c(e){h===_&&r(e)}_++;var h=_;return i()?a()?(s(),void 0):(c(!1),void 0):(c(!1),void 0)},this.$commitViewValue=function(){var e=w.$viewValue;u.cancel(y),(w.$$lastCommittedViewValue!==e||""===e&&w.$$hasNativeValidators)&&(w.$$lastCommittedViewValue=e,w.$pristine&&this.$setDirty(),this.$$parseAndValidate())},this.$$parseAndValidate=function(){function t(){w.$modelValue!==a&&w.$$writeModelToScope()}var r=w.$$lastCommittedViewValue,i=r;if(f=b(i)?n:!0)for(var o=0;o<w.$parsers.length;o++)if(i=w.$parsers[o](i),b(i)){f=!1;break}E(w.$modelValue)&&isNaN(w.$modelValue)&&(w.$modelValue=v(e));var a=w.$modelValue,s=w.$options&&w.$options.allowInvalid;w.$$rawModelValue=i,s&&(w.$modelValue=i,t()),w.$$runValidators(i,w.$$lastCommittedViewValue,function(e){s||(w.$modelValue=e?i:n,t())})},this.$$writeModelToScope=function(){g(e,w.$modelValue),o(w.$viewChangeListeners,function(e){try{e()}catch(n){t(n)}})},this.$setViewValue=function(e,t){w.$viewValue=e,(!w.$options||w.$options.updateOnDefault)&&w.$$debounceViewValueCommit(t)},this.$$debounceViewValueCommit=function(t){var n,r=0,i=w.$options;i&&x(i.debounce)&&(n=i.debounce,E(n)?r=n:E(n[t])?r=n[t]:E(n["default"])&&(r=n["default"])),u.cancel(y),r?y=u(function(){w.$commitViewValue()},r):c.$$phase?w.$commitViewValue():e.$apply(function(){w.$commitViewValue()})},e.$watch(function(){var t=v(e);if(t!==w.$modelValue&&(w.$modelValue===w.$modelValue||t===t)){w.$modelValue=w.$$rawModelValue=t,f=n;for(var r=w.$formatters,i=r.length,o=t;i--;)o=r[i](o);w.$viewValue!==o&&(w.$viewValue=w.$$lastCommittedViewValue=o,w.$render(),w.$$runValidators(t,o,m))}return t})}],os=["$rootScope",function(e){return{restrict:"A",require:["ngModel","^?form","^?ngModelOptions"],controller:is,priority:1,compile:function(t){return t.addClass(Za).addClass(es).addClass(Ka),{pre:function(e,t,n,r){var i=r[0],o=r[1]||i.$$parentForm;i.$$setOptions(r[2]&&r[2].$options),o.$addControl(i),n.$observe("name",function(e){i.$name!==e&&i.$$parentForm.$$renameControl(i,e)}),e.$on("$destroy",function(){i.$$parentForm.$removeControl(i)})},post:function(t,n,r,i){var o=i[0];o.$options&&o.$options.updateOn&&n.on(o.$options.updateOn,function(e){o.$$debounceViewValueCommit(e&&e.type)}),n.on("blur",function(){o.$touched||(e.$$phase?t.$evalAsync(o.$setTouched):t.$apply(o.$setTouched))})}}}}}],as=/(\s+|^)default(\s+|$)/,ss=function(){return{restrict:"A",controller:["$scope","$attrs",function(e,t){var n=this;this.$options=U(e.$eval(t.ngModelOptions)),x(this.$options.updateOn)?(this.$options.updateOnDefault=!1,this.$options.updateOn=Ui(this.$options.updateOn.replace(as,function(){return n.$options.updateOnDefault=!0," "}))):this.$options.updateOnDefault=!0}]}},us=Jr({terminal:!0,priority:1e3}),cs=r("ngOptions"),ls=/^\s*([\s\S]+?)(?:\s+as\s+([\s\S]+?))?(?:\s+group\s+by\s+([\s\S]+?))?(?:\s+disable\s+when\s+([\s\S]+?))?\s+for\s+(?:([\$\w][\$\w]*)|(?:\(\s*([\$\w][\$\w]*)\s*,\s*([\$\w][\$\w]*)\s*\)))\s+in\s+([\s\S]+?)(?:\s+track\s+by\s+([\s\S]+?))?$/,hs=["$compile","$parse",function(e,n){function r(e,t,r){function o(e,t,n,r,i){this.selectValue=e,this.viewValue=t,this.label=n,this.group=r,this.disabled=i}function a(e){var t;if(!c&&i(e))t=e;else{t=[];for(var n in e)e.hasOwnProperty(n)&&"$"!==n.charAt(0)&&t.push(n)}return t}var s=e.match(ls);if(!s)throw cs("iexp","Expected expression in form of '_select_ (as _label_)? for (_key_,)?_value_ in _collection_' but got '{0}'. Element: {1}",e,Z(t));var u=s[5]||s[7],c=s[6],l=/ as /.test(s[0])&&s[1],h=s[9],f=n(s[2]?s[1]:u),p=l&&n(l),d=p||f,m=h&&n(h),v=h?function(e,t){return m(r,t)}:function(e){return Xt(e)},g=function(e,t){return v(e,C(e,t))},y=n(s[2]||s[1]),b=n(s[3]||""),x=n(s[4]||""),w=n(s[8]),_={},C=c?function(e,t){return _[c]=t,_[u]=e,_}:function(e){return _[u]=e,_};return{trackBy:h,getTrackByValue:g,getWatchables:n(w,function(e){var t=[];e=e||[];for(var n=a(e),i=n.length,o=0;i>o;o++){var u=e===n?o:n[o],c=(e[u],C(e[u],u)),l=v(e[u],c);if(t.push(l),s[2]||s[1]){var h=y(r,c);t.push(h)}if(s[4]){var f=x(r,c);t.push(f)}}return t}),getOptions:function(){for(var e=[],t={},n=w(r)||[],i=a(n),s=i.length,u=0;s>u;u++){var c=n===i?u:i[u],l=n[c],f=C(l,c),p=d(r,f),m=v(p,f),_=y(r,f),E=b(r,f),S=x(r,f),M=new o(m,p,_,E,S);e.push(M),t[m]=M}return{items:e,selectValueMap:t,getOptionFromViewValue:function(e){return t[g(e)]},getViewValueFromOption:function(e){return h?Vi.copy(e.viewValue):e.viewValue}}}}}var a=t.createElement("option"),s=t.createElement("optgroup");return{restrict:"A",terminal:!0,require:["select","?ngModel"],link:function(t,n,i,u){function c(e,t){e.element=t,t.disabled=e.disabled,e.label!==t.label&&(t.label=e.label,t.textContent=e.label),e.value!==t.value&&(t.value=e.selectValue)}function l(e,t,n,r){var i;return t&&xi(t.nodeName)===n?i=t:(i=r.cloneNode(!1),t?e.insertBefore(i,t):e.appendChild(i)),i}function h(e){for(var t;e;)t=e.nextSibling,$t(e),e=t}function f(e){var t=m&&m[0],n=_&&_[0];if(t||n)for(;e&&(e===t||e===n||t&&t.nodeType===Ki);)e=e.nextSibling;return e}function p(){var e=C&&v.readValue();C=E.getOptions();var t={},r=n[0].firstChild;if(w&&n.prepend(m),r=f(r),C.items.forEach(function(e){var i,o,u;e.group?(i=t[e.group],i||(o=l(n[0],r,"optgroup",s),r=o.nextSibling,o.label=e.group,i=t[e.group]={groupElement:o,currentOptionElement:o.firstChild}),u=l(i.groupElement,i.currentOptionElement,"option",a),c(e,u),i.currentOptionElement=u.nextSibling):(u=l(n[0],r,"option",a),c(e,u),r=u.nextSibling)}),Object.keys(t).forEach(function(e){h(t[e].currentOptionElement)}),h(r),d.$render(),!d.$isEmpty(e)){var i=v.readValue();(E.trackBy?$(e,i):e===i)||(d.$setViewValue(i),d.$render())}}var d=u[1];if(d){for(var m,v=u[0],g=i.multiple,y=0,b=n.children(),x=b.length;x>y;y++)if(""===b[y].value){m=b.eq(y);break}var w=!!m,_=Mi(a.cloneNode(!1));_.val("?");var C,E=r(i.ngOptions,n,t),S=function(){w||n.prepend(m),n.val(""),m.prop("selected",!0),m.attr("selected",!0)},M=function(){w||m.remove()},T=function(){n.prepend(_),n.val("?"),_.prop("selected",!0),_.attr("selected",!0)},A=function(){_.remove()};g?(d.$isEmpty=function(e){return!e||0===e.length},v.writeValue=function(e){C.items.forEach(function(e){e.element.selected=!1}),e&&e.forEach(function(e){var t=C.getOptionFromViewValue(e);t&&!t.disabled&&(t.element.selected=!0)})},v.readValue=function(){var e=n.val()||[],t=[];return o(e,function(e){var n=C.selectValueMap[e];n&&!n.disabled&&t.push(C.getViewValueFromOption(n))}),t},E.trackBy&&t.$watchCollection(function(){return Oi(d.$viewValue)?d.$viewValue.map(function(e){return E.getTrackByValue(e)}):void 0},function(){d.$render()})):(v.writeValue=function(e){var t=C.getOptionFromViewValue(e);t&&!t.disabled?n[0].value!==t.selectValue&&(A(),M(),n[0].value=t.selectValue,t.element.selected=!0,t.element.setAttribute("selected","selected")):null===e||w?(A(),S()):(M(),T())},v.readValue=function(){var e=C.selectValueMap[n.val()];return e&&!e.disabled?(M(),A(),C.getViewValueFromOption(e)):null},E.trackBy&&t.$watch(function(){return E.getTrackByValue(d.$viewValue)},function(){d.$render()})),w?(m.remove(),e(m)(t),m.removeClass("ng-scope")):m=Mi(a.cloneNode(!1)),p(),t.$watchCollection(E.getWatchables,p)}}}}],fs=["$locale","$interpolate","$log",function(e,t,n){var r=/{}/g,i=/^when(Minus)?(.+)$/;return{link:function(a,s,u){function c(e){s.text(e||"")}var l,h=u.count,f=u.$attr.when&&s.attr(u.$attr.when),p=u.offset||0,d=a.$eval(f)||{},v={},g=t.startSymbol(),y=t.endSymbol(),x=g+h+"-"+p+y,w=Vi.noop;o(u,function(e,t){var n=i.exec(t);if(n){var r=(n[1]?"-":"")+xi(n[2]);d[r]=s.attr(u.$attr[t])}}),o(d,function(e,n){v[n]=t(e.replace(r,x))}),a.$watch(h,function(t){var r=parseFloat(t),i=isNaN(r);if(i||r in d||(r=e.pluralCat(r-p)),r!==l&&!(i&&E(l)&&isNaN(l))){w();var o=v[r];b(o)?(null!=t&&n.debug("ngPluralize: no rule defined for '"+r+"' in "+f),w=m,c()):w=a.$watch(o,c),l=r}})}}}],ps=["$parse","$animate",function(e,a){var s="$$NG_REMOVED",u=r("ngRepeat"),c=function(e,t,n,r,i,o,a){e[n]=r,i&&(e[i]=o),e.$index=t,e.$first=0===t,e.$last=t===a-1,e.$middle=!(e.$first||e.$last),e.$odd=!(e.$even=0===(1&t))},l=function(e){return e.clone[0]},h=function(e){return e.clone[e.clone.length-1]};return{restrict:"A",multiElement:!0,transclude:"element",priority:1e3,terminal:!0,$$tlb:!0,compile:function(r,f){var p=f.ngRepeat,d=t.createComment(" end ngRepeat: "+p+" "),m=p.match(/^\s*([\s\S]+?)\s+in\s+([\s\S]+?)(?:\s+as\s+([\s\S]+?))?(?:\s+track\s+by\s+([\s\S]+?))?\s*$/);if(!m)throw u("iexp","Expected expression in form of '_item_ in _collection_[ track by _id_]' but got '{0}'.",p);var v=m[1],g=m[2],y=m[3],b=m[4];if(m=v.match(/^(?:(\s*[\$\w]+)|\(\s*([\$\w]+)\s*,\s*([\$\w]+)\s*\))$/),!m)throw u("iidexp","'_item_' in '_item_ in _collection_' should be an identifier or '(_key_, _value_)' expression, but got '{0}'.",v);var x=m[3]||m[1],w=m[2];if(y&&(!/^[$a-zA-Z_][$a-zA-Z0-9_]*$/.test(y)||/^(null|undefined|this|\$index|\$first|\$middle|\$last|\$even|\$odd|\$parent|\$root|\$id)$/.test(y)))throw u("badident","alias '{0}' is invalid --- must be a valid JS identifier which is not a reserved name.",y);var _,C,E,S,M={$id:Xt};return b?_=e(b):(E=function(e,t){return Xt(t)},S=function(e){return e}),function(e,t,r,f,m){_&&(C=function(t,n,r){return w&&(M[w]=t),M[x]=n,M.$index=r,_(e,M)});var v=vt();e.$watchCollection(g,function(r){var f,g,b,_,M,T,A,P,k,R,I,D,B=t[0],V=vt();if(y&&(e[y]=r),i(r))k=r,P=C||E;else{P=C||S,k=[];for(var L in r)wi.call(r,L)&&"$"!==L.charAt(0)&&k.push(L)}for(_=k.length,I=new Array(_),f=0;_>f;f++)if(M=r===k?f:k[f],T=r[M],A=P(M,T,f),v[A])R=v[A],delete v[A],V[A]=R,I[f]=R;else{if(V[A])throw o(I,function(e){e&&e.scope&&(v[e.id]=e)}),u("dupes","Duplicates in a repeater are not allowed. Use 'track by' expression to specify unique keys. Repeater: {0}, Duplicate key: {1}, Duplicate value: {2}",p,A,T);I[f]={id:A,scope:n,clone:n},V[A]=!0}for(var N in v){if(R=v[N],D=mt(R.clone),a.leave(D),D[0].parentNode)for(f=0,g=D.length;g>f;f++)D[f][s]=!0;R.scope.$destroy()}for(f=0;_>f;f++)if(M=r===k?f:k[f],T=r[M],R=I[f],R.scope){b=B;do b=b.nextSibling;while(b&&b[s]);l(R)!=b&&a.move(mt(R.clone),null,Mi(B)),B=h(R),c(R.scope,f,x,T,w,M,_)}else m(function(e,t){R.scope=t;var n=d.cloneNode(!1);e[e.length++]=n,a.enter(e,null,Mi(B)),B=n,R.clone=e,V[R.id]=R,c(R.scope,f,x,T,w,M,_)});v=V})}}}}],ds="ng-hide",ms="ng-hide-animate",vs=["$animate",function(e){return{restrict:"A",multiElement:!0,link:function(t,n,r){t.$watch(r.ngShow,function(t){e[t?"removeClass":"addClass"](n,ds,{tempClasses:ms})})}}}],gs=["$animate",function(e){return{restrict:"A",multiElement:!0,link:function(t,n,r){t.$watch(r.ngHide,function(t){e[t?"addClass":"removeClass"](n,ds,{tempClasses:ms})})}}}],ys=Jr(function(e,t,n){e.$watch(n.ngStyle,function(e,n){n&&e!==n&&o(n,function(e,n){t.css(n,"")}),e&&t.css(e)},!0)}),bs=["$animate",function(e){return{require:"ngSwitch",controller:["$scope",function(){this.cases={}}],link:function(n,r,i,a){var s=i.ngSwitch||i.on,u=[],c=[],l=[],h=[],f=function(e,t){return function(){e.splice(t,1)}};n.$watch(s,function(n){var r,i;for(r=0,i=l.length;i>r;++r)e.cancel(l[r]);for(l.length=0,r=0,i=h.length;i>r;++r){var s=mt(c[r].clone);h[r].$destroy();var p=l[r]=e.leave(s);p.then(f(l,r))}c.length=0,h.length=0,(u=a.cases["!"+n]||a.cases["?"])&&o(u,function(n){n.transclude(function(r,i){h.push(i);var o=n.element;r[r.length++]=t.createComment(" end ngSwitchWhen: ");var a={clone:r};c.push(a),e.enter(r,o.parent(),o)})})})}}}],xs=Jr({transclude:"element",priority:1200,require:"^ngSwitch",multiElement:!0,link:function(e,t,n,r,i){r.cases["!"+n.ngSwitchWhen]=r.cases["!"+n.ngSwitchWhen]||[],r.cases["!"+n.ngSwitchWhen].push({transclude:i,element:t})}}),ws=Jr({transclude:"element",priority:1200,require:"^ngSwitch",multiElement:!0,link:function(e,t,n,r,i){r.cases["?"]=r.cases["?"]||[],r.cases["?"].push({transclude:i,element:t})}}),_s=Jr({restrict:"EAC",link:function(e,t,n,i,o){if(!o)throw r("ngTransclude")("orphan","Illegal use of ngTransclude directive in the template! No parent directive that requires a transclusion found. Element: {0}",Z(t));
o(function(e){t.empty(),t.append(e)})}}),Cs=["$templateCache",function(e){return{restrict:"E",terminal:!0,compile:function(t,n){if("text/ng-template"==n.type){var r=n.id,i=t[0].text;e.put(r,i)}}}}],Es={$setViewValue:m,$render:m},Ss=["$element","$scope","$attrs",function(e,r){var i=this,o=new Yt;i.ngModelCtrl=Es,i.unknownOption=Mi(t.createElement("option")),i.renderUnknownOption=function(t){var n="? "+Xt(t)+" ?";i.unknownOption.val(n),e.prepend(i.unknownOption),e.val(n)},r.$on("$destroy",function(){i.renderUnknownOption=m}),i.removeUnknownOption=function(){i.unknownOption.parent()&&i.unknownOption.remove()},i.readValue=function(){return i.removeUnknownOption(),e.val()},i.writeValue=function(t){i.hasOption(t)?(i.removeUnknownOption(),e.val(t),""===t&&i.emptyOption.prop("selected",!0)):null==t&&i.emptyOption?(i.removeUnknownOption(),e.val("")):i.renderUnknownOption(t)},i.addOption=function(e,t){pt(e,'"option value"'),""===e&&(i.emptyOption=t);var n=o.get(e)||0;o.put(e,n+1)},i.removeOption=function(e){var t=o.get(e);t&&(1===t?(o.remove(e),""===e&&(i.emptyOption=n)):o.put(e,t-1))},i.hasOption=function(e){return!!o.get(e)}}],Ms=function(){return{restrict:"E",require:["select","?ngModel"],controller:Ss,link:function(e,t,n,r){var i=r[1];if(i){var a=r[0];if(a.ngModelCtrl=i,i.$render=function(){a.writeValue(i.$viewValue)},t.on("change",function(){e.$apply(function(){i.$setViewValue(a.readValue())})}),n.multiple){a.readValue=function(){var e=[];return o(t.find("option"),function(t){t.selected&&e.push(t.value)}),e},a.writeValue=function(e){var n=new Yt(e);o(t.find("option"),function(e){e.selected=x(n.get(e.value))})};var s,u=0/0;e.$watch(function(){u!==i.$viewValue||$(s,i.$viewValue)||(s=z(i.$viewValue),i.$render()),u=i.$viewValue}),i.$isEmpty=function(e){return!e||0===e.length}}}}}},Ts=["$interpolate",function(e){function t(e){e[0].hasAttribute("selected")&&(e[0].selected=!0)}return{restrict:"E",priority:100,compile:function(n,r){if(x(r.value))var i=e(r.value,!0);else{var o=e(n.text(),!0);o||r.$set("value",n.text())}return function(e,n,r){function a(e){c.addOption(e,n),c.ngModelCtrl.$render(),t(n)}var s="$selectController",u=n.parent(),c=u.data(s)||u.parent().data(s);if(c&&c.ngModelCtrl){if(i){var l;r.$observe("value",function(e){x(l)&&c.removeOption(l),l=e,a(e)})}else o?e.$watch(o,function(e,t){r.$set("value",e),t!==e&&c.removeOption(t),a(e)}):a(r.value);n.on("$destroy",function(){c.removeOption(r.value),c.ngModelCtrl.$render()})}}}}}],As=g({restrict:"E",terminal:!1}),Ps=function(){return{restrict:"A",require:"?ngModel",link:function(e,t,n,r){r&&(n.required=!0,r.$validators.required=function(e,t){return!n.required||!r.$isEmpty(t)},n.$observe("required",function(){r.$validate()}))}}},ks=function(){return{restrict:"A",require:"?ngModel",link:function(e,t,i,o){if(o){var a,s=i.ngPattern||i.pattern;i.$observe("pattern",function(e){if(C(e)&&e.length>0&&(e=new RegExp("^"+e+"$")),e&&!e.test)throw r("ngPattern")("noregexp","Expected {0} to be a RegExp but was {1}. Element: {2}",s,e,Z(t));a=e||n,o.$validate()}),o.$validators.pattern=function(e,t){return o.$isEmpty(t)||b(a)||a.test(t)}}}}},Rs=function(){return{restrict:"A",require:"?ngModel",link:function(e,t,n,r){if(r){var i=-1;n.$observe("maxlength",function(e){var t=p(e);i=isNaN(t)?-1:t,r.$validate()}),r.$validators.maxlength=function(e,t){return 0>i||r.$isEmpty(t)||t.length<=i}}}}},Is=function(){return{restrict:"A",require:"?ngModel",link:function(e,t,n,r){if(r){var i=0;n.$observe("minlength",function(e){i=p(e)||0,r.$validate()}),r.$validators.minlength=function(e,t){return r.$isEmpty(t)||t.length>=i}}}}};return e.angular.bootstrap?(console.log("WARNING: Tried to load angular more than once."),void 0):(lt(),xt(Vi),Vi.module("ngLocale",[],["$provide",function(e){function t(e){e+="";var t=e.indexOf(".");return-1==t?0:e.length-t-1}function r(e,r){var i=r;n===i&&(i=Math.min(t(e),3));var o=Math.pow(10,i),a=(e*o|0)%o;return{v:i,f:a}}var i={ZERO:"zero",ONE:"one",TWO:"two",FEW:"few",MANY:"many",OTHER:"other"};e.value("$locale",{DATETIME_FORMATS:{AMPMS:["AM","PM"],DAY:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],ERANAMES:["Before Christ","Anno Domini"],ERAS:["BC","AD"],FIRSTDAYOFWEEK:6,MONTH:["January","February","March","April","May","June","July","August","September","October","November","December"],SHORTDAY:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],SHORTMONTH:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],WEEKENDRANGE:[5,6],fullDate:"EEEE, MMMM d, y",longDate:"MMMM d, y",medium:"MMM d, y h:mm:ss a",mediumDate:"MMM d, y",mediumTime:"h:mm:ss a","short":"M/d/yy h:mm a",shortDate:"M/d/yy",shortTime:"h:mm a"},NUMBER_FORMATS:{CURRENCY_SYM:"$",DECIMAL_SEP:".",GROUP_SEP:",",PATTERNS:[{gSize:3,lgSize:3,maxFrac:3,minFrac:0,minInt:1,negPre:"-",negSuf:"",posPre:"",posSuf:""},{gSize:3,lgSize:3,maxFrac:2,minFrac:2,minInt:1,negPre:"-¤",negSuf:"",posPre:"¤",posSuf:""}]},id:"en-us",pluralCat:function(e,t){var n=0|e,o=r(e,t);return 1==n&&0==o.v?i.ONE:i.OTHER}})}]),Mi(t).ready(function(){ot(t,at)}),void 0)}(window,document),!window.angular.$$csp().noInlineStyle&&window.angular.element(document.head).prepend('<style type="text/css">@charset "UTF-8";[ng\\:cloak],[ng-cloak],[data-ng-cloak],[x-ng-cloak],.ng-cloak,.x-ng-cloak,.ng-hide:not(.ng-hide-animate){display:none !important;}ng\\:form{display:block;}.ng-animate-shim{visibility:hidden;}.ng-anchor{position:absolute;}</style>'),function(){angular.module("pdb.litemol",[]).directive("pdbLiteMol",["$document",function(e,t,n){return{restrict:"EAC",scope:{pdbId:"=",loadEdMaps:"@",validationAnnotation:"@",domainAnnotation:"@",hideControls:"@",showLogs:"@",customQuery:"@",customRender:"@",treeMenu:"@",isExpanded:"@",subscribeEvents:"@",sourceUrl:"@",sourceFormat:"@",displayFullMapOnload:"@"},template:"",link:function(r,i){var o=function(e){var t={};return angular.forEach(e,function(e){var n;"function"==typeof MouseEvent?n=new MouseEvent(e,{view:window,bubbles:!0,cancelable:!0}):"function"==typeof document.createEvent?(n=document.createEvent("MouseEvents"),n.initEvent(e,!0,!0)):"function"==typeof document.createEventObject&&(n=document.createEventObject()),t[e]=n}),t};r.pdbevents=o(["PDB.litemol.click","PDB.litemol.mouseover","PDB.litemol.mouseout"]),r.hideControls="undefined"!=typeof r.hideControls&&"true"==r.hideControls?!0:!1,r.treeMenu="undefined"!=typeof r.treeMenu&&"true"==r.treeMenu?!0:!1,r.isExpanded="undefined"!=typeof r.isExpanded&&"true"==r.isExpanded?!0:!1,"undefined"==typeof r.subscribeEvents&&(r.subscribeEvents="true");var a,s=this&&this.__extends||function(e,t){function n(){this.constructor=e}for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r]);e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)};!function(e){var t;!function(e){var t=LiteMol.Bootstrap,n=t.Entity;e.DownloadMolecule=n.Transformer.Molecule.downloadMoleculeSource({sourceId:"url-molecule",name:"URL",description:"Download a molecule from the specified Url (if the host server supports cross domain requests).",defaultId:"//www.ebi.ac.uk/pdbe/coordinates/1tqn/cartoon",urlTemplate:function(e){return e},isFullUrl:!0})}(t=e.DataSources||(e.DataSources={}))}(a=LiteMol.Viewer||(LiteMol.Viewer={}));var a;!function(e){var t;!function(e){var t;!function(e){{var t=LiteMol.Bootstrap,n=t.Entity,r=t.Entity.Transformer;t.Visualization}e.DownloadMolecule=r.Molecule.downloadMoleculeSource({sourceId:"pdbe-molecule",name:"PDBe",description:"Download a molecule from PDBe.",defaultId:"1cbs",specificFormat:LiteMol.Core.Formats.Molecule.SupportedFormats.mmCIF,urlTemplate:function(e){return"//www.ebi.ac.uk/pdbe/static/entry/"+e.toLowerCase()+"_updated.cif"}}),e.DownloadBinaryCIFFromCoordinateServer=t.Tree.Transformer.action({id:"molecule-download-bcif-from-coordinate-server",name:"Molecule (BinaryCIF)",description:"Download full or cartoon representation of a PDB entry from the CoordinateServer.",from:[n.Root],to:[n.Action],defaultParams:function(e){return{id:"5iv5",type:"Cartoon",lowPrecisionCoords:!0,serverUrl:e.settings.get("molecule.downloadBinaryCIFFromCoordinateServer.server")?e.settings.get("molecule.downloadBinaryCIFFromCoordinateServer.server"):"http://www.ebi.ac.uk/pdbe/coordinates/"}},validateParams:function(e){return e.id&&e.id.trim().length?e.serverUrl&&e.serverUrl.trim().length?void 0:["Enter CoordinateServer base URL"]:["Enter Id"]}},function(e,r,i){var o="Cartoon"===i.params.type?"cartoon":"full",a=i.params.id.toLowerCase().trim(),s=""+i.params.serverUrl+("/"===i.params.serverUrl[i.params.serverUrl.length-1]?"":"/")+a+"/"+o+"?encoding=bcif&lowPrecisionCoords="+(i.params.lowPrecisionCoords?"1":"2");return t.Tree.Transform.build().add(r,n.Transformer.Data.Download,{url:s,type:"Binary",id:a}).then(n.Transformer.Molecule.CreateFromData,{format:LiteMol.Core.Formats.Molecule.SupportedFormats.mmBCIF},{isBinding:!0}).then(n.Transformer.Molecule.CreateModel,{modelIndex:0},{isBinding:!1})})}(t=e.Data||(e.Data={}))}(t=e.PDBe||(e.PDBe={}))}(a=a||(a={}));var a;!function(e){var n;!function(e){var n;!function(e){function n(e,t,n){var i=h.Tree.Transform.build();n=n.trim().toLowerCase();var o=t.props.ref?t.props.ref:h.Utils.generateUUID(),a=i.add(e,p.Basic.CreateGroup,{label:n,description:"Density"},{ref:o}),s=h.Utils.generateUUID(),u=h.Utils.generateUUID(),c=a.then(p.Data.Download,{url:"//www.ebi.ac.uk/pdbe/coordinates/files/"+n+"_diff.ccp4",type:"Binary",id:n,description:"Fo-Fc",title:"Density"}).then(p.Density.ParseData,{format:LiteMol.Core.Formats.Density.SupportedFormats.CCP4,id:"Fo-Fc",normalize:!1},{isBinding:!0,ref:s});c.then(p.Density.CreateVisualBehaviour,{id:"Fo-Fc(-ve)",isoSigmaMin:-5,isoSigmaMax:0,minRadius:0,maxRadius:10,radius:5,showFull:"undefined"!=typeof r.displayFullMapOnload&&"true"==r.displayFullMapOnload?!0:!1,style:m.Density.Style.create({isoValue:-3,isoValueType:h.Visualization.Density.IsoValueType.Sigma,color:LiteMol.Visualization.Color.fromHex(12268339),isWireframe:t.params.isWireframe,transparency:{alpha:.75}})},{ref:"density-fofc_minus"}),c.then(p.Density.CreateVisualBehaviour,{id:"Fo-Fc(+ve)",isoSigmaMin:0,isoSigmaMax:5,minRadius:0,maxRadius:10,radius:5,showFull:"undefined"!=typeof r.displayFullMapOnload&&"true"==r.displayFullMapOnload?!0:!1,style:m.Density.Style.create({isoValue:3,isoValueType:h.Visualization.Density.IsoValueType.Sigma,color:LiteMol.Visualization.Color.fromHex(3390259),isWireframe:t.params.isWireframe,transparency:{alpha:.75}})},{ref:"density-fofc_plus"});a.then(p.Data.Download,{url:"//www.ebi.ac.uk/pdbe/coordinates/files/"+n+".ccp4",type:"Binary",id:n,description:"2Fo-Fc",title:"Density"}).then(p.Density.ParseData,{format:LiteMol.Core.Formats.Density.SupportedFormats.CCP4,id:"2Fo-Fc",normalize:!1},{isBinding:!0,ref:u}).then(p.Density.CreateVisualBehaviour,{id:"2Fo-Fc",isoSigmaMin:0,isoSigmaMax:2,minRadius:0,maxRadius:10,radius:5,showFull:"undefined"!=typeof r.displayFullMapOnload&&"true"==r.displayFullMapOnload?!0:!1,style:m.Density.Style.create({isoValue:1.5,isoValueType:h.Visualization.Density.IsoValueType.Sigma,color:LiteMol.Visualization.Color.fromHex(3367602),isWireframe:t.params.isWireframe,transparency:{alpha:.4}})},{ref:"density-2fofc"});return{action:i,context:{id:n,refs:[u,s],groupRef:o}}}function i(e,t,n,r,i){var o=h.Tree.Transform.build(),a=h.Utils.generateUUID(),s="EMD-"+n;return o.add(e,p.Data.Download,{url:"//www.ebi.ac.uk/pdbe/static/files/em/maps/emd_"+n+".map.gz",type:"Binary",id:s,description:"EMDB Density",responseCompression:h.Utils.DataCompressionMethod.Gzip,title:"Density"}).then(p.Density.ParseData,{format:LiteMol.Core.Formats.Density.SupportedFormats.CCP4,id:s,normalize:!1},{isBinding:!0,ref:a}).then(p.Density.CreateVisualBehaviour,{id:"Density",isoSigmaMin:void 0!==i.minVal?i.minVal:1.5,isoSigmaMax:void 0!==i.maxVal?i.maxVal:5,minRadius:0,maxRadius:50,radius:5,showFull:!0,style:m.Density.Style.create({isoValue:void 0!==r?r:1.5,isoValueType:void 0!==r?h.Visualization.Density.IsoValueType.Absolute:h.Visualization.Density.IsoValueType.Sigma,color:LiteMol.Visualization.Color.fromHex(6524815),isWireframe:t.params.isWireframe,transparency:{alpha:.3}})},{ref:"em-density-map"}),{action:o,context:{id:n,refs:[a]}}}function o(e,t){return{action:h.Tree.Transform.build().add(e,p.Basic.Fail,{title:"Density",message:t}),context:void 0}}function a(e,t){return 1==r.treeMenu||"true"==r.treeMenu?{action:void 0,context:{id:"abortMaps",refs:["abortMapDownload"],mapSize:t}}:{action:h.Tree.Transform.build().add(e,p.Basic.CreateGroup,{id:"abortMapsgroup",label:"Density Dummy Group",description:"Density Dummy Group"},{ref:"abortMapDownload"}),context:{id:"abortMaps",refs:["abortMapDownload"],mapSize:t}}}function s(e,t,n,r){return new LiteMol.Core.Promise(function(i){r=r.trim().toLowerCase(),h.Utils.ajaxGetString("https://www.ebi.ac.uk/pdbe/api/pdb/entry/summary/"+r,"PDB API").run(e).then(function(a){try{var s=JSON.parse(a),c=void 0,h=s[r];if(!(h&&h[0]&&h[0].related_structures))return i(o(t,"No related EMDB entry found for '"+r+"'.")),void 0;var f=h[0].related_structures.filter(function(e){return"EMDB"===e.resource});if(!f.length)return i(o(t,"No related EMDB entry found for '"+r+"'.")),void 0;c=f[0].accession.split("-")[1],"undefined"!=typeof n.params.checkMapFileSize&&1==n.params.checkMapFileSize?i(l(e,t,n,c,25)):i(u(e,t,n,c))}catch(h){i(o(t,"PDB API call failed."))}}).catch(function(){return i(o(t,"PDB API call failed."))})})}function u(e,t,n,r){return new LiteMol.Core.Promise(function(a){r=r.trim(),h.Utils.ajaxGetString("https://www.ebi.ac.uk/pdbe/api/emdb/entry/map/EMD-"+r,"EMDB API").run(e).then(function(e){try{var s=JSON.parse(e),u=void 0,c={minVal:void 0,maxVal:void 0},l=s["EMD-"+r];l&&l[0]&&l[0].map&&l[0].map.contour_level&&void 0!==l[0].map.contour_level.value&&(u=+l[0].map.contour_level.value),l&&l[0]&&l[0].map&&l[0].map.statistics&&void 0!==l[0].map.statistics.minimum&&(c.minVal=+l[0].map.statistics.minimum),l&&l[0]&&l[0].map&&l[0].map.statistics&&void 0!==l[0].map.statistics.maximum&&(c.maxVal=+l[0].map.statistics.maximum),a(i(t,n,r,u,c))}catch(l){a(o(t,"EMDB API call failed."))}}).catch(function(){return a(o(t,"EMDB API call failed."))})})}function c(e){var t;try{var n=e.plugin.context.select("molecule")[0];if("undefined"!=typeof n){var r=n.props.molecule.properties.experimentMethod;if("undefined"!=typeof r)var i=r}}catch(o){}return t="undefined"!=typeof i&&"Electron Microscopy"==i?"emdb-pdbid":"undefined"!=typeof i&&"X-ray diffraction"==i?"electron-density":i}function l(e,n,r,i,s){return new LiteMol.Core.Promise(function(c){t.head("http://ftp.ebi.ac.uk/pub/databases/emdb/structures/EMD-"+i+"/map/emd_"+i+".map.gz").then(function(t){var o=t.headers("Content-Length"),l="undefined"!=typeof o?o/1024/1024:void 0;"undefined"!=typeof l&&s>=l?c(u(e,n,r,i)):c(a(n,l))},function(){c(o(n,"File size issue."))})})}var h=LiteMol.Bootstrap,f=h.Entity,p=h.Entity.Transformer,d=h.Tree,m=h.Visualization;e.DensityDownloader=f.create({name:"PDBe Density Downloader",typeClass:"Behaviour",shortName:"DD",description:"Represents PDBe Density Downloader."});var v=LiteMol.Bootstrap.Tree.Transformer.create({id:"pdbe-density-download-create",name:"PDBe Density Downloader",description:"Create the PDBe Density Downloader.",from:[f.Root],to:[e.DensityDownloader],defaultParams:function(){return{}}},function(t,n,r){return LiteMol.Bootstrap.Task.create("Density Downloader","Background",function(t){t.resolve(e.DensityDownloader.create(r,{ref:"densityDownloader-transformer"}))}).setReportTime(!0)});e.DensityDownloaderAction=LiteMol.Bootstrap.Tree.Transformer.action({id:"pdbe-density-download-create-action",name:"PDBe Density Downloader Action",description:"PDBe Density Downloader Action",from:[e.DensityDownloader],to:[f.Action],defaultParams:function(){return{}}},function(e,t){var n=LiteMol.Bootstrap.Tree.Transform.build().add(t,v,{id:"densityDwnldrAction"},{isBinding:!0,ref:"densityDownloader-model"});return n},"Density Loader Loaded"),e.DensitySources=["electron-density","emdb-pdbid","emdb-id"],e.DensitySourceLabels={"electron-density":"Electron Density","emdb-pdbid":"EMDB (from PDB ID)","emdb-id":"EMDB"},e.DownloadDensity=h.Tree.Transformer.actionWithContext({id:"pdbe-density-download-data",name:"Density Data from PDBe",description:"Download density data from PDBe.",from:[f.Root],to:[f.Action],defaultParams:function(e){var t=c(e);return{sourceId:"undefined"!=typeof t?t:"electron-density",id:{"electron-density":r.pdbId,"emdb-id":"8003","emdb-pdbid":r.pdbId}}},validateParams:function(e){var t=e.sourceId?e.sourceId:"electron-density";if(!e.id)return["Enter Id"];var n="string"==typeof e.id?e.id:e.id[t];return n.trim().length?void 0:["Enter Id"]}},function(e,t,r){var i,o="undefined"!=typeof r.params.sourceId?r.params.sourceId:c(e);switch(i="string"==typeof r.params.id?r.params.id:r.params.id[r.params.sourceId],o){case"electron-density":return n(t,r,i);case"emdb-id":return u(e,t,r,i);case"emdb-pdbid":return s(e,t,r,i);default:return n(t,r,i)}},function(e,t){if(t){var n=t,i=n.id,o=n.refs,a=n.groupRef;if("abortMaps"==i){var s="You can download the Density using Download option in Controls";"undefined"!=typeof n.mapSize&&(s="Density file size is "+parseInt(n.mapSize)+" MB. You can download it using the <strong>'Download Density'</strong> option in Controls."),h.Command.Toast.Show.dispatch(e,{key:"density-abort-toast",title:"Density",message:s}),h.Event.Visual.VisualSelectElement.getStream(e).subscribe(function(){h.Command.Toast.Hide.dispatch(e,{key:"density-abort-toast"})})}else{var u=e.select((c=d.Selection).byRef.apply(c,o));u.length===o.length?e.logger.message("Density loaded, click on a residue or an atom to view the data."):u.length>0?e.logger.message("Density partially loaded, click on a residue or an atom to view the data."):(e.logger.error("Density for ID '"+i+"' failed to load."),a&&h.Command.Tree.RemoveNode.dispatch(e,a));var c;if(h.Command.Toast.Hide.dispatch(e,{key:"density-abort-toast"}),0==r.treeMenu||"false"==r.treeMenu){var l=e.select("abortMapDownload")[0];"undefined"!=typeof l&&h.Command.Tree.RemoveNode.dispatch(e,"abortMapDownload")}}}})}(n=e.Data||(e.Data={}))}(n=e.PDBe||(e.PDBe={}))}(a=a||(a={}));var a;!function(e){var t;!function(e){var t;!function(e){var t=LiteMol.Bootstrap.Entity,n=LiteMol.Bootstrap.Entity.Transformer;e.Report=t.create({name:"PDBe Molecule Validation Report",typeClass:"Behaviour",shortName:"VR",description:"Represents PDBe validation report."});var r;!function(e){function t(e,t){var n=e.toString();return 0!==(t||"").length&&(n+=" "+t),n}function n(e,t,n,r,i){var o=e[n];return o?(o=o[r])?(o=o[t],o?o[i]:void 0):void 0:void 0}function r(e){var n={};if(!e.molecules)return n;for(var r=0,i=e.molecules;r<i.length;r++){for(var o=i[r],a={},s=0,u=o.chains;s<u.length;s++){for(var c=u[s],l={},h=0,f=c.models;h<f.length;h++){for(var p=f[h],d={},m=0,v=p.residues;m<v.length;m++){var g=v[m],y=t(g.residue_number,g.author_insertion_code),b=d[y];b?(b.residues.push(g),b.numIssues=Math.max(b.numIssues,g.outlier_types.length)):d[y]={residues:[g],numIssues:g.outlier_types.length}}l[p.model_id.toString()]=d}a[c.struct_asym_id]=l}n[o.entity_id.toString()]=a}return n}e.getResidueId=t,e.getEntry=n,e.createReport=r}(r||(r={}));var i;!function(e){var t=function(){function e(e,t){var n=this;this.context=e,this.report=t,this.provider=function(e){try{return n.processInfo(e)}catch(t){return console.error("Error showing validation label",t),void 0}}}return e.prototype.dispose=function(){this.context.highlight.removeProvider(this.provider)},e.prototype.register=function(){this.context.highlight.addProvider(this.provider)},e.prototype.processInfo=function(e){var t=LiteMol.Bootstrap.Interactivity.Molecule.transformInteraction(e);if(!t||t.residues.length>1)return void 0;var n=t.residues[0],i=r.getEntry(this.report,t.modelId,n.chain.entity.entityId,n.chain.asymId,r.getResidueId(n.seqNumber,n.insCode));if(!i)return void 0;var o;if(1===i.residues.length){var a=i.residues[0];return o="Validation: ",o+=a.outlier_types.length?"<b>"+i.residues[0].outlier_types.join(", ")+"</b>":"no issue"}o="";for(var s=0,u=0,c=i.residues;u<c.length;u++){var l=c[u];s>0&&(o+=", "),o+="Validation (altLoc "+l.alt_code+"): <b>"+l.outlier_types.join(", ")+"</b>",s++}return o},e}();e.Behaviour=t}(i||(i={}));var o;!function(e){function t(e,t){for(var n=new Uint8Array(e.residues.count),i=e.modelId,o=e.residues,a=o.asymId,s=o.entityId,u=o.seqNumber,c=o.insCode,l=0,h=e.residues.count;h>l;l++){var f=r.getEntry(t,i,s[l],a[l],r.getResidueId(u[l],c[l]));f&&(n[l]=Math.min(f.numIssues,3))}return n}function n(e,t){for(var n=new Uint8Array(e.residues.count),i=e.modelId,o=e.parent,a=e.residues,s=a.entityId,u=a.seqNumber,c=a.insCode,l=a.chainIndex,h=e.chains.sourceChainIndex,f=o.chains.asymId,p=0,d=e.residues.count;d>p;p++){var m=f[h[l[p]]],v=r.getEntry(t,i,s[p],m,r.getResidueId(u[p],c[p]));v&&(n[p]=Math.min(v.numIssues,3))}return n}function i(e,r){var i=e.props.model,c=i.source===LiteMol.Core.Structure.MoleculeModelSource.File?t(i,r):n(i,r),l=new Map;l.set("Uniform",a),l.set("Selection",s),l.set("Highlight",u);var h=i.atoms.residueIndex,f=LiteMol.Visualization.Theme.createColorMapMapping(function(e){return c[h[e]]},o,a);return LiteMol.Visualization.Theme.createMapping(f,{colors:l,interactive:!0,transparency:{alpha:1}})}var o=function(){var e=new Map;return e.set(0,{r:0,g:1,b:0}),e.set(1,{r:1,g:1,b:0}),e.set(2,{r:1,g:.5,b:0}),e.set(3,{r:1,g:0,b:0}),e}(),a={r:.6,g:.6,b:.6},s={r:0,g:0,b:1},u={r:1,g:0,b:1};e.create=i}(o||(o={}));var a=LiteMol.Bootstrap.Tree.Transformer.create({id:"pdbe-validation-create",name:"PDBe Validation",description:"Create the validation report from a string.",from:[t.Data.String],to:[e.Report],defaultParams:function(){return{}}},function(t,n,o){return LiteMol.Bootstrap.Task.create("Validation Report ("+o.params.id+")","Normal",function(a){a.update("Parsing..."),a.schedule(function(){var s=JSON.parse(n.props.data),u=s[o.params.id],c=r.createReport(u||{});a.resolve(e.Report.create(o,{label:"Validation Report",behaviour:new i.Behaviour(t,c),ref:"validation-visual"}))})}).setReportTime(!0)});e.CustomDownloadAndCreate=LiteMol.Bootstrap.Tree.Transformer.action({id:"pdbe-validation-download-and-create",name:"PDBe Validation Report",description:"Download Validation Report from PDBe",from:[t.Root],to:[t.Action],defaultParams:function(){return{}},customController:function(e,t,n){return new LiteMol.Bootstrap.Components.Transform.Controller(e,t,n,!1)}},function(e,t,r){var i=r.params.id.trim().toLocaleLowerCase(),o=LiteMol.Bootstrap.Tree.Transform.build().add(t,n.Data.Download,{url:"//www.ebi.ac.uk/pdbe/api/validation/residuewise_outlier_summary/entry/"+i,type:"String",id:i,description:"Validation Data"}).then(a,{id:i},{isBinding:!0,ref:"validation-model"});return o},"Validation report loaded. Hovering over residue will now contain validation info. To apply validation coloring, select the entity in the tree and apply it the right panel."),e.DownloadAndCreate=LiteMol.Bootstrap.Tree.Transformer.action({id:"pdbe-validation-download-and-create",name:"PDBe Validation Report",description:"Download Validation Report from PDBe",from:[t.Molecule.Molecule],to:[t.Action],defaultParams:function(){return{}},customController:function(e,t,n){return new LiteMol.Bootstrap.Components.Transform.Controller(e,t,n,!1)}},function(e,t){var r=t.props.molecule.id.trim().toLocaleLowerCase(),i=LiteMol.Bootstrap.Tree.Transform.build().add(t,n.Data.Download,{url:"//www.ebi.ac.uk/pdbe/api/validation/residuewise_outlier_summary/entry/"+r,type:"String",id:r,description:"Validation Data"}).then(a,{id:r},{isBinding:!0});return i},"Validation report loaded. Hovering over residue will now contain validation info. To apply validation coloring, select the entity in the tree and apply it the right panel."),e.ApplyTheme=LiteMol.Bootstrap.Tree.Transformer.create({id:"pdbe-validation-apply-theme",name:"Apply Coloring",description:"Colors all visuals using the validation report.",from:[e.Report],to:[t.Action],defaultParams:function(){return{}}},function(e,t){return LiteMol.Bootstrap.Task.create("Validation Coloring","Background",function(n){var r=LiteMol.Bootstrap.Tree.Node.findAncestor(e.select("polymer-visual")[0],LiteMol.Bootstrap.Entity.Molecule.Molecule);if(!r)return n.reject("No suitable parent found."),void 0;for(var i=new Map,a=e.select(LiteMol.Bootstrap.Tree.Selection.byValue(r).subtree().ofType(LiteMol.Bootstrap.Entity.Molecule.Visual)),s=0,u=a;s<u.length;s++){var c=u[s],l=LiteMol.Bootstrap.Utils.Molecule.findModel(c);if(l){var h=i.get(l.id);h||(h=o.create(l,t.props.behaviour.report),i.set(l.id,h)),LiteMol.Bootstrap.Command.Visual.UpdateBasicTheme.dispatch(e,{visual:c,theme:h})}}e.logger.message("Validation coloring applied."),n.resolve(LiteMol.Bootstrap.Tree.Node.Null)})})}(t=e.Validation||(e.Validation={}))}(t=e.PDBe||(e.PDBe={}))}(a=a||(a={}));var a;!function(e){var t;!function(e){var t;!function(e){function t(t,n,r){var o=LiteMol.Bootstrap.Tree.Transform.build();if(!r)return o;for(var a=LiteMol.Visualization.Color.fromHex(16410880),s=function(n){var s=r[n];if(!s)return"continue";var u=Object.keys(s).filter(function(e){return Object.prototype.hasOwnProperty.call(s,e)});if(!u.length)return"continue";for(var c=o.add(t,i.Basic.CreateGroup,{label:n,isCollapsed:!0},{isBinding:!0,ref:n}),l=0,h=u;l<h.length;l++){var f=h[l];c.then(e.CreateSingle,{data:s[f],id:f,color:a})}},u=0,l=["Pfam","InterPro","CATH","SCOP","UniProt"];u<l.length;u++){var h=l[u];s(h)}return o.add(t,c,{},{isHidden:!0,ref:"domain-annotation-model"}),o}function n(e){return 0===e.length?null:e}var r=LiteMol.Bootstrap.Entity,i=LiteMol.Bootstrap.Entity.Transformer,o=LiteMol.Core.Structure.Query;e.Annotations=r.create({name:"PDBe Sequence Annotations",typeClass:"Data",shortName:"SA",description:"Represents PDBe sequence annotation data."}),e.Annotation=r.create({name:"PDBe Sequence Annotation",typeClass:"Object",shortName:"SA",description:"Represents PDBe sequence annotation."},{isSilent:!0,isFocusable:!0}),e.Behaviour=r.create({name:"PDBe Sequence Annotation Behaviour",typeClass:"Behaviour",shortName:"SA",description:"Represents PDBe sequence annoation behaviour."});var a;!function(t){var n=function(){function t(e){var t=this;this.context=e,this.node=void 0,this.current=void 0,this.subs=[],this.toHighlight=void 0,this.isHighlightOn=!1,this.__highlight=LiteMol.Core.Utils.debounce(function(){return t.highlight()},33)}return t.prototype.dispose=function(){this.resetTheme();for(var e=0,t=this.subs;e<t.length;e++){var n=t[e];n.dispose()}this.subs=[],this.node=void 0},t.prototype.register=function(t){var n=this;this.node=t,this.subs.push(this.context.behaviours.currentEntity.subscribe(function(e){return n.update(e)})),this.subs.push(LiteMol.Bootstrap.Command.Entity.Highlight.getStream(this.context).subscribe(function(t){if(1===t.data.entities.length){var r=t.data.entities[0];if(r.type!==e.Annotation)return;n.toHighlight=r,n.isHighlightOn=t.data.isOn,n.__highlight()}})),this.subs.push(LiteMol.Bootstrap.Command.Entity.Focus.getStream(this.context).subscribe(function(t){if(1===t.data.length){var r=t.data[0];if(r.type!==e.Annotation)return;n.focus(r)}}))},Object.defineProperty(t.prototype,"molecule",{get:function(){return LiteMol.Bootstrap.Utils.Molecule.findMolecule(this.node)},enumerable:!0,configurable:!0}),t.prototype.resetTheme=function(){var e=this.molecule;e&&LiteMol.Bootstrap.Command.Visual.ResetTheme.dispatch(this.context,{selection:LiteMol.Bootstrap.Tree.Selection.byValue(e).subtree()})},t.prototype.getCached=function(e,t){return this.context.entityCache.get(e,"theme-"+t.id)},t.prototype.setCached=function(e,t,n){this.context.entityCache.set(e,"theme-"+t.id,n)},t.prototype.highlight=function(){var t=this.toHighlight;if(this.toHighlight=void 0,t&&t.type===e.Annotation){var n=t;this.isHighlightOn?this.apply(n):this.current?this.update(this.current):this.resetTheme()}},t.prototype.focus=function(e){var t=this.molecule;if(t){var n=this.context.select(LiteMol.Bootstrap.Tree.Selection.byValue(t).subtree().ofType(LiteMol.Bootstrap.Entity.Molecule.Model))[0];n&&(LiteMol.Bootstrap.Command.Molecule.FocusQuery.dispatch(this.context,{model:n,query:e.props.query}),LiteMol.Bootstrap.Command.Entity.SetCurrent.dispatch(this.context,e))}},t.prototype.apply=function(e){var t=this.molecule;if(t)for(var n=this.context.select(LiteMol.Bootstrap.Tree.Selection.byValue(t).subtree().ofType(LiteMol.Bootstrap.Entity.Molecule.Visual)),r=0,i=n;r<i.length;r++){var o=i[r],a=LiteMol.Bootstrap.Utils.Molecule.findModel(o);if(a){var u=this.getCached(e,a);u||(u=s.create(a,e.props.query,e.props.color),this.setCached(e,a,u)),LiteMol.Bootstrap.Command.Visual.UpdateBasicTheme.dispatch(this.context,{visual:o,theme:u})}}},t.prototype.update=function(t){return t&&t.type===e.Annotation?(this.current=t,this.apply(this.current),void 0):(this.current&&this.resetTheme(),this.current=void 0,void 0)},t}();t.Behaviour=n}(a||(a={}));var s;!function(e){function t(e,t){for(var n=new Uint8Array(e.residues.count),r=(e.modelId,e.atoms.residueIndex),i=e.residues,o=(i.asymId,i.entityId,i.seqNumber,i.insCode,0),a=t.fragments;o<a.length;o++)for(var s=a[o],u=0,c=s.atomIndices;u<c.length;u++){var l=c[u];n[r[l]]=1}return n}function n(e,n,s){var u=e.props.model,c=o.Builder.toQuery(n),l=c(u.queryContext),h=t(u,l),f=new Map;f.set("Uniform",r),f.set("Bond",r),f.set("Selection",i),f.set("Highlight",a);var p=new Map;p.set(1,s);var d=u.atoms.residueIndex,m=LiteMol.Visualization.Theme.createColorMapMapping(function(e){return h[d[e]]},p,r);return LiteMol.Visualization.Theme.createMapping(m,{colors:f,interactive:!0,transparency:{alpha:1}})}var r={r:1,g:1,b:1},i=LiteMol.Visualization.Theme.Default.SelectionColor,a=LiteMol.Visualization.Theme.Default.HighlightColor;e.create=n}(s||(s={})),e.Theme=s,e.CreateSingle=LiteMol.Bootstrap.Tree.Transformer.create({id:"pdbe-sequence-annotations-create-single",name:"PDBe Sequence Annotation",description:"Create a sequence annotation object.",from:[],to:[e.Annotation],defaultParams:function(){return{}},isUpdatable:!0},function(t,r,i){return LiteMol.Bootstrap.Task.create("Sequence Annotation","Background",function(t){var r=i.params.data,a=o.or.apply(null,r.mappings.map(function(e){return o.sequence(e.entity_id.toString(),e.struct_asym_id,{seqNumber:e.start.residue_number,insCode:n(e.start.author_insertion_code)},{seqNumber:e.end.residue_number,insCode:n(e.end.author_insertion_code)})})).union();t.resolve(e.Annotation.create(i,{label:r.identifier,description:i.params.id,query:a,color:i.params.color},{ref:r.identifier}))})});var u=LiteMol.Bootstrap.Tree.Transformer.create({id:"pdbe-sequence-annotations-parse",name:"PDBe Sequence Annotations",description:"Parse sequence annotaions JSON.",from:[r.Data.String],to:[e.Annotations],defaultParams:function(){return{}}},function(t,n,r){return LiteMol.Bootstrap.Task.create("Sequence Annotations","Normal",function(t){t.update("Parsing..."),t.schedule(function(){var i=JSON.parse(n.props.data);t.resolve(e.Annotations.create(r,{label:"Sequence Annotations",data:i}))})}).setReportTime(!0)}),c=LiteMol.Bootstrap.Tree.Transformer.create({id:"pdbe-sequence-annotations-create-behaviour",name:"PDBe Sequence Annotation Behaviour",description:"Create sequence annotation behaviour.",from:[e.Annotations],to:[e.Behaviour],defaultParams:function(){return{}}},function(t,n,r){return LiteMol.Bootstrap.Task.resolve("Sequence Annotations","Background",e.Behaviour.create(r,{label:"Sequence Annotations",behaviour:new a.Behaviour(t)}))}),l=LiteMol.Bootstrap.Tree.Transformer.action({id:"pdbe-sequence-annotations-build",name:"PDBe Sequence Annotations",description:"Build sequence validations behaviour.",from:[e.Annotations],to:[r.Action],defaultParams:function(){return{}}},function(e,n){var r=n.props.data,i=Object.keys(r);return t(n,i[0],r[i[0]])},"Sequence annotations downloaded. Selecting or hovering an annotation in the tree will color the visuals.");e.DownloadAndCreate=LiteMol.Bootstrap.Tree.Transformer.action({id:"pdbe-sequence-annotations-download-and-create",name:"PDBe Sequence Annotations",description:"Download Sequence Annotations from PDBe",from:[r.Molecule.Molecule],to:[r.Action],defaultParams:function(){return{}
},customController:function(e,t,n){return new LiteMol.Bootstrap.Components.Transform.Controller(e,t,n,!1)}},function(e,t){var n=t.props.molecule.id.trim().toLocaleLowerCase();return LiteMol.Bootstrap.Tree.Transform.build().add(t,i.Data.Download,{url:"//www.ebi.ac.uk/pdbe/api/mappings/"+n,type:"String",id:n,description:"Annotation Data"}).then(u,{},{isBinding:!0}).then(l,{},{isBinding:!0})}),e.CustomDownloadAndCreate=LiteMol.Bootstrap.Tree.Transformer.action({id:"pdbe-sequence-annotations-download-and-create",name:"PDBe Sequence Annotations",description:"Download Sequence Annotations from PDBe",from:[r.Root],to:[r.Action],defaultParams:function(){return{}},customController:function(e,t,n){return new LiteMol.Bootstrap.Components.Transform.Controller(e,t,n,!1)}},function(e,t,n){var r=n.params.id.trim().toLocaleLowerCase();return LiteMol.Bootstrap.Tree.Transform.build().add(t,i.Data.Download,{url:"//www.ebi.ac.uk/pdbe/api/mappings/"+r,type:"String",id:r,description:"Annotation Data"}).then(u,{},{isBinding:!0}).then(l,{},{isBinding:!0})})}(t=e.SequenceAnnotation||(e.SequenceAnnotation={}))}(t=e.PDBe||(e.PDBe={}))}(a=a||(a={}));var a;!function(e){var t;!function(e){var t;!function(t){var n=LiteMol.Plugin.React,r=LiteMol.Plugin.Controls,i=function(e){function t(){e.apply(this,arguments)}return s(t,e),t.prototype.renderControls=function(){var e=this,t=this.params;return n.createElement("div",null,n.createElement(r.ToggleColorPicker,{label:"Color",color:t.color,onChange:function(t){return e.controller.autoUpdateParams({color:t})},position:"below"}))},t}(LiteMol.Plugin.Views.Transform.ControllerBase);t.CreateSequenceAnnotationView=i;var o=function(e){function t(){e.apply(this,arguments)}return s(t,e),t.prototype.renderControls=function(){var e=this,t=this.params;return n.createElement("div",null,n.createElement(r.TextBoxGroup,{value:t.id,onChange:function(t){return e.updateParams({id:t})},label:"Id",onEnter:function(t){return e.applyEnter(t)},placeholder:"Enter pdb id..."}),n.createElement(r.OptionsGroup,{options:["Cartoon","Full"],caption:function(e){return e},current:t.type,onChange:function(t){return e.updateParams({type:t})},label:"Type",title:"Determines whether to send all atoms or just atoms that are needed for the Cartoon representation."}),n.createElement(r.Toggle,{onChange:function(t){return e.updateParams({lowPrecisionCoords:t})},value:t.lowPrecisionCoords,label:"Low Precicion",title:"If on, sends coordinates with 1 digit precision instead of 3. This saves up to 50% of data that need to be sent."}),n.createElement(r.TextBoxGroup,{value:t.serverUrl,onChange:function(t){return e.updateParams({serverUrl:t})},label:"Server",title:"The base URL of the CoordinateServer.",onEnter:function(t){return e.applyEnter(t)},placeholder:"Enter server URL..."}))},t}(LiteMol.Plugin.Views.Transform.ControllerBase);t.DownloadBinaryCIFFromCoordinateServerView=o;var a=function(t){function i(){return t.apply(this,arguments)||this}return s(i,t),i.prototype.getId=function(){var e=this.params.id;return e?"string"==typeof e?e:e[this.params.sourceId]:""},i.prototype.updateId=function(e){var t=this.params,n=t.id;n&&"string"!=typeof n?n=LiteMol.Bootstrap.Utils.merge(n,(i={},i[t.sourceId]=e,i)):(r={},r[t.sourceId]=e,n=r),this.updateParams({id:n});var r,i},i.prototype.renderControls=function(){var t=this,i=this.params;return n.createElement("div",null,n.createElement(r.OptionsGroup,{options:e.Data.DensitySources,caption:function(t){return e.Data.DensitySourceLabels[t]},current:i.sourceId,onChange:function(e){return t.updateParams({sourceId:e})},label:"Source",title:"Determines where to obtain the data."}),n.createElement(r.TextBoxGroup,{value:this.getId(),onChange:function(e){return t.updateId(e)},label:"Id",onEnter:function(e){return t.applyEnter(e)},placeholder:"Enter id..."}))},i}(LiteMol.Plugin.Views.Transform.ControllerBase);t.DownloadDensityView=a}(t=e.Views||(e.Views={}))}(t=e.PDBe||(e.PDBe={}))}(a=a||(a={}));var a;!function(e){var t;!function(e){var t=LiteMol.Plugin.React,n=LiteMol.Plugin.Controls,r=function(e){function r(){e.apply(this,arguments)}return s(r,e),r.prototype.asm=function(){var e=this,r=this.params.params?this.params.params.name:this.params.assemblyNames[0];return r||(r=this.params.assemblyNames[0]),[t.createElement(n.OptionsGroup,{options:this.params.assemblyNames,current:r,onChange:function(t){return e.updateParams({params:{name:t}})},label:"Asm. Name"})]},r.prototype.symm=function(){var e=this,r=["Mates","Interaction"],i=this.params.params;return[t.createElement(n.OptionsGroup,{options:r,current:i.type,onChange:function(t){return e.updateParams({params:{type:t,radius:i.radius}})},label:"Type",title:"Mates: copies whole asymetric unit. Interaction: Includes only residues that are no more than `radius` from the asymetric unit."}),t.createElement(n.Slider,{label:"Radius",onChange:function(t){return e.updateParams({params:{type:i.type,radius:t}})},min:0,max:25,step:.1,value:i.radius,title:"Interaction radius."})]},r.prototype.updateSource=function(e){switch(e){case"Assembly":this.updateParams({source:e,params:{name:this.params.assemblyNames[0]}});break;case"Symmetry":this.updateParams({source:e,params:{type:"Mates",radius:5}});break;default:this.updateParams({source:"Asymmetric Unit"})}},r.prototype.renderControls=function(){var e=this,r=this.params,i=this.controller.entity.props.molecule,o=i.models[0],a=["Asymmetric Unit"];r.assemblyNames&&r.assemblyNames.length>0&&a.push("Assembly"),o.symmetryInfo&&a.push("Symmetry");var s=i.models.length>1?t.createElement(n.Slider,{label:"Model",onChange:function(t){return e.updateParams({modelIndex:t-1})},min:1,max:i.models.length,step:1,value:r.modelIndex+1,title:"Interaction radius."}):void 0;return t.createElement("div",null,t.createElement(n.OptionsGroup,{options:a,caption:function(e){return e},current:r.source,onChange:function(t){return e.updateSource(t)},label:"Source"}),"Assembly"===r.source?this.asm():"Symmetry"===r.source?this.symm():void 0,s)},r}(LiteMol.Plugin.Views.Transform.ControllerBase);e.RepresentationView=r}(t=e.Custom||(e.Custom={}))}(a||(a={}));var a;!function(e){var t;!function(e){var t=LiteMol.Bootstrap.Entity,n=LiteMol.Bootstrap.Entity.Transformer;e.CreateRepresentation=LiteMol.Bootstrap.Tree.Transformer.action({id:"lm-custom-create-representation",name:"Representation",description:"Create visual representation from the selected source.",from:[t.Molecule.Molecule],to:[t.Action],defaultParams:function(e,t){var n=LiteMol.Bootstrap.Utils.Molecule.findMolecule(t).props.molecule.models[0],r=n.assemblyInfo;return r&&r.assemblies.length?{source:"Asymmetric Unit",assemblyNames:r.assemblies.map(function(e){return e.name}),modelIndex:0}:{source:"Asymmetric Unit",assemblyNames:[]}}},function(e,t,r){var i=LiteMol.Bootstrap.Tree.Selection.byRef("molecule").children();LiteMol.Bootstrap.Command.Tree.RemoveNode.dispatch(e,i);var o=LiteMol.Bootstrap.Tree.Transform.build().add(t,n.Molecule.CreateModel,{modelIndex:r.params.modelIndex||0},{ref:"model"}),a={polymer:!0,polymerRef:"polymer-visual",het:!0,hetRef:"het-visual",water:!0,waterRef:"water-visual"};switch(r.params.source||"Asymmetric Unit"){case"Assembly":o.then(n.Molecule.CreateAssembly,r.params.params).then(n.Molecule.CreateMacromoleculeVisual,a);break;case"Symmetry":o.then(n.Molecule.CreateSymmetryMates,r.params.params).then(n.Molecule.CreateMacromoleculeVisual,a);break;default:o.then(n.Molecule.CreateMacromoleculeVisual,a)}return o})}(t=e.Custom||(e.Custom={}))}(a||(a={}));var a;!function(e){var t;!function(e){var t=LiteMol.Plugin.React,n=LiteMol.Plugin.Controls,r=function(e){function r(){e.apply(this,arguments)}return s(r,e),r.prototype.domainList=function(){for(var e=this,r=this.params.subOptionsList[this.params.type],i=r.length,o=[],a={},s=0;i>s;s++)o.push(r[s].name),a[r[s].name]=r[s].ref;var u=this.params.nodeName;return u||(u=o[0]),[t.createElement(n.OptionsGroup,{options:o,current:u,caption:function(e){return e},onChange:function(t){return e.updateParams({nodeName:t,nodeRef:a[t]})},label:"Name"})]},r.prototype.updateType=function(e){if("Select"===e)this.updateParams({type:e,nodeName:void 0,nodeRef:void 0});else{var t=this.params.subOptionsList[e][0].name,n=this.params.subOptionsList[e][0].ref;this.updateParams({type:e,nodeName:t,nodeRef:n})}},r.prototype.renderControls=function(){var e=this,r=this.params;return t.createElement("div",null,t.createElement(n.OptionsGroup,{options:r.options,caption:function(e){return e},current:r.type,onChange:function(t){return e.updateType(t)},label:"Type"}),"Select"===r.type?void 0:this.domainList())},r}(LiteMol.Plugin.Views.Transform.ControllerBase);e.SeqAnnotationView=r}(t=e.Custom||(e.Custom={}))}(a||(a={}));var a;!function(e){var t;!function(t){{var n=LiteMol.Bootstrap.Entity;LiteMol.Bootstrap.Entity.Transformer}t.CreateSeqAnnotation=LiteMol.Bootstrap.Tree.Transformer.create({id:"lm-custom-create-SeqAnnotation",name:"SeqAnnotation",description:"Colours all visuals as per selected Domain Annotation.",from:[n.Root],to:[n.Action],defaultParams:function(e){for(var t=["Select"],n=["Pfam","InterPro","CATH","SCOP","UniProt"],r={Pfam:[],InterPro:[],CATH:[],SCOP:[],UniProt:[]},i=0;5>i;i++){var o=e.select(n[i])[0];if("undefined"!=typeof o&&o.children.length>0){t.push(n[i]);for(var a=0;a<o.children.length;a++){var s=o.children[a].props.label;r[n[i]].push({name:s,ref:o.children[a].ref})}}}return{type:"Select",nodeRef:void 0,nodeName:void 0,options:t,subOptionsList:r}}},function(t,n,r){return LiteMol.Bootstrap.Task.create("Domain Annotation","Background",function(i){var o=n;if(!o)return i.reject("No suitable parent found."),void 0;if(!r.params.nodeRef)return i.reject("Select valid Domain."),void 0;for(var a=t.select(r.params.nodeRef)[0],s=t.select(LiteMol.Bootstrap.Tree.Selection.byValue(o).subtree().ofType(LiteMol.Bootstrap.Entity.Molecule.Visual)),u=0,c=s;u<c.length;u++){var l=c[u],h=LiteMol.Bootstrap.Utils.Molecule.findModel(l);if(h){var f=t.entityCache.get(a,"theme-"+h.id);f||(f=e.PDBe.SequenceAnnotation.Theme.create(h,a.props.query,a.props.color),t.entityCache.set(a,"theme-"+h.id,f)),LiteMol.Bootstrap.Command.Visual.UpdateBasicTheme.dispatch(t,{visual:l,theme:f})}}t.logger.message("Domain annotation applied."),i.resolve(LiteMol.Bootstrap.Tree.Node.Null)})})}(t=e.Custom||(e.Custom={}))}(a||(a={}));var u=function(){function e(){this.Plugin=LiteMol.Plugin,this.Views=this.Plugin.Views,this.Bootstrap=LiteMol.Bootstrap,this.Entity=this.Bootstrap.Entity,this.Query=LiteMol.Core.Structure.Query,this.Transformer=this.Bootstrap.Entity.Transformer,this.Tree=this.Bootstrap.Tree,this.Transform=this.Tree.Transform,this.LayoutRegion=this.Bootstrap.Components.LayoutRegion,this.CoreVis=LiteMol.Visualization,this.Visualization=this.Bootstrap.Visualization,this.Command=this.Bootstrap.Command,this.Event=this.Bootstrap.Event,this.moleculeId=r.pdbId,this.currentHighLightedDetails,this.element=i[0],this.emMsgChanged=!1,this.spec={settings:{"molecule.model.defaultQuery":"residues({ name: 'ALA' })","molecule.model.defaultAssemblyName":"1","molecule.coordinateStreaming.defaultId":"1jj2","molecule.coordinateStreaming.defaultServer":"//www.ebi.ac.uk/pdbe/coordinates","molecule.coordinateStreaming.defaultRadius":10,"density.defaultVisualBehaviourRadius":5},transforms:[{transformer:a.PDBe.Data.DownloadMolecule,view:this.Views.Transform.Data.WithIdField},{transformer:a.PDBe.Data.DownloadDensity,view:a.PDBe.Views.DownloadDensityView},{transformer:a.PDBe.Data.DownloadBinaryCIFFromCoordinateServer,view:a.PDBe.Views.DownloadBinaryCIFFromCoordinateServerView,initiallyCollapsed:!0},{transformer:this.Transformer.Molecule.CoordinateStreaming.InitStreaming,view:this.Views.Transform.Molecule.InitCoordinateStreaming,initiallyCollapsed:!0},{transformer:a.DataSources.DownloadMolecule,view:this.Views.Transform.Data.WithUrlIdField,initiallyCollapsed:!0},{transformer:this.Transformer.Molecule.OpenMoleculeFromFile,view:this.Views.Transform.Molecule.OpenFile,initiallyCollapsed:!0},{transformer:this.Transformer.Data.Download,view:this.Views.Transform.Data.Download,initiallyCollapsed:!0},{transformer:this.Transformer.Data.OpenFile,view:this.Views.Transform.Data.OpenFile,initiallyCollapsed:!0},{transformer:this.Transformer.Molecule.CreateFromData,view:this.Views.Transform.Molecule.CreateFromData},{transformer:this.Transformer.Data.ParseCif,view:this.Views.Transform.Empty},{transformer:this.Transformer.Data.ParseBinaryCif,view:this.Views.Transform.Empty},{transformer:this.Transformer.Density.ParseData,view:this.Views.Transform.Density.ParseData},{transformer:this.Transformer.Molecule.CreateFromMmCif,view:this.Views.Transform.Molecule.CreateFromMmCif},{transformer:this.Transformer.Molecule.CreateModel,view:this.Views.Transform.Molecule.CreateModel},{transformer:this.Transformer.Molecule.CreateSelection,view:this.Views.Transform.Molecule.CreateSelection,initiallyCollapsed:!0},{transformer:this.Transformer.Molecule.CreateAssembly,view:this.Views.Transform.Molecule.CreateAssembly,initiallyCollapsed:!0},{transformer:this.Transformer.Molecule.CreateSymmetryMates,view:this.Views.Transform.Molecule.CreateSymmetryMates,initiallyCollapsed:!0},{transformer:this.Transformer.Molecule.CreateMacromoleculeVisual,view:this.Views.Transform.Empty},{transformer:this.Transformer.Molecule.CreateVisual,view:this.Views.Transform.Molecule.CreateVisual},{transformer:this.Transformer.Density.CreateVisual,view:this.Views.Transform.Density.CreateVisual},{transformer:this.Transformer.Density.CreateVisualBehaviour,view:this.Views.Transform.Density.CreateVisualBehaviour},{transformer:this.Transformer.Molecule.CoordinateStreaming.CreateBehaviour,view:this.Views.Transform.Empty,initiallyCollapsed:!0},{transformer:a.PDBe.Validation.DownloadAndCreate,view:this.Views.Transform.Empty},{transformer:a.PDBe.Validation.ApplyTheme,view:this.Views.Transform.Empty},{transformer:a.PDBe.SequenceAnnotation.DownloadAndCreate,view:this.Views.Transform.Empty},{transformer:a.PDBe.SequenceAnnotation.CreateSingle,view:a.PDBe.Views.CreateSequenceAnnotationView}],behaviours:[this.Bootstrap.Behaviour.SetEntityToCurrentWhenAdded,this.Bootstrap.Behaviour.FocusCameraOnSelect,this.Bootstrap.Behaviour.UnselectElementOnRepeatedClick,this.Bootstrap.Behaviour.ApplySelectionToVisual,this.Bootstrap.Behaviour.CreateVisualWhenModelIsAdded,this.Bootstrap.Behaviour.Molecule.HighlightElementInfo,this.Bootstrap.Behaviour.Molecule.DistanceToLastClickedElement],components:[this.Plugin.Components.Visualization.HighlightInfo(this.LayoutRegion.Main,!0),this.Plugin.Components.Entity.Current("LiteMol",this.Plugin.VERSION.number)(this.LayoutRegion.Right,!0),this.Plugin.Components.Transform.View(this.LayoutRegion.Right),this.Plugin.Components.Context.Overlay(this.LayoutRegion.Root),this.Plugin.Components.Context.Toast(this.LayoutRegion.Main,!0),this.Plugin.Components.Context.BackgroundTasks(this.LayoutRegion.Main,!0)],viewport:{view:this.Views.Visualization.Viewport,controlsView:this.Views.Visualization.ViewportControls},layoutView:this.Views.Layout,tree:{region:this.LayoutRegion.Left,view:this.Views.Entity.Tree}},_this=this,this.CustomMenuSpec={settings:{"molecule.model.defaultQuery":"residues({ name: 'ALA' })","molecule.model.defaultAssemblyName":"1","molecule.coordinateStreaming.defaultId":"1jj2","molecule.coordinateStreaming.defaultServer":"//www.ebi.ac.uk/pdbe/coordinates","molecule.coordinateStreaming.defaultRadius":10,"density.defaultVisualBehaviourRadius":5},transforms:[{transformer:this.Transformer.Molecule.CreateVisual,view:this.Views.Transform.Molecule.CreateVisual},{transformer:a.Custom.CreateRepresentation,view:a.Custom.RepresentationView},{transformer:this.Transformer.Density.CreateVisual,view:this.Views.Transform.Density.CreateVisual},{transformer:this.Transformer.Density.CreateVisualBehaviour,view:this.Views.Transform.Density.CreateVisualBehaviour},{transformer:a.PDBe.Validation.CustomDownloadAndCreate,view:this.Views.Transform.Empty},{transformer:a.PDBe.Validation.ApplyTheme,view:this.Views.Transform.Empty},{transformer:a.Custom.CreateSeqAnnotation,view:a.Custom.SeqAnnotationView},{transformer:a.PDBe.Data.DownloadDensity,view:this.Views.Transform.Empty},{transformer:a.PDBe.Data.DensityDownloaderAction,view:this.Views.Transform.Empty}],behaviours:[this.Bootstrap.Behaviour.SetEntityToCurrentWhenAdded,this.Bootstrap.Behaviour.FocusCameraOnSelect,this.Bootstrap.Behaviour.UnselectElementOnRepeatedClick,this.Bootstrap.Behaviour.ApplySelectionToVisual,this.Bootstrap.Behaviour.ApplyInteractivitySelection,this.Bootstrap.Behaviour.Molecule.HighlightElementInfo,this.Bootstrap.Behaviour.Molecule.DistanceToLastClickedElement,this.Bootstrap.Behaviour.Molecule.ShowInteractionOnSelect(5)],components:[this.Plugin.Components.Visualization.HighlightInfo(this.LayoutRegion.Main,!0),this.Plugin.Components.create("RepresentationControls",function(e){return new _this.Bootstrap.Components.Transform.Action(e,"molecule",a.Custom.CreateRepresentation,"Source")},_this.Plugin.Views.Transform.Action)(this.LayoutRegion.Right),this.Plugin.Components.create("ValidationControls",function(e){return new _this.Bootstrap.Components.Transform.Action(e,"validation-model",a.PDBe.Validation.ApplyTheme,"Validation Report")},_this.Plugin.Views.Transform.Action)(this.LayoutRegion.Right),this.Plugin.Components.create("AnnotationControls",function(e){return new _this.Bootstrap.Components.Transform.Action(e,"domain-annotation-model",a.Custom.CreateSeqAnnotation,"Domain Annotation")},_this.Plugin.Views.Transform.Action)(this.LayoutRegion.Right),this.Plugin.Components.create("PolymerControls",function(e){return new _this.Bootstrap.Components.Transform.Updater(e,"polymer-visual","Polymer Visual")},_this.Plugin.Views.Transform.Updater)(this.LayoutRegion.Right),this.Plugin.Components.create("HetControls",function(e){return new _this.Bootstrap.Components.Transform.Updater(e,"het-visual","HET Groups Visual")},_this.Plugin.Views.Transform.Updater)(this.LayoutRegion.Right),this.Plugin.Components.create("WaterControls",function(e){return new _this.Bootstrap.Components.Transform.Updater(e,"water-visual","Water Visual")},_this.Plugin.Views.Transform.Updater)(this.LayoutRegion.Right),this.Plugin.Components.create("DensityDownloadControl",function(e){return new _this.Bootstrap.Components.Transform.Action(e,"abortMapDownload",a.PDBe.Data.DownloadDensity,"Download Density")},_this.Plugin.Views.Transform.Action)(this.LayoutRegion.Right),this.Plugin.Components.create("DensityControls-2fofc",function(e){return new _this.Bootstrap.Components.Transform.Updater(e,"density-2fofc","Density : 2Fo-Fc")},_this.Plugin.Views.Transform.Updater)(this.LayoutRegion.Right),this.Plugin.Components.create("DensityControls-fofc_plus",function(e){return new _this.Bootstrap.Components.Transform.Updater(e,"density-fofc_minus","Density : Fo-Fc(-ve)")},_this.Plugin.Views.Transform.Updater)(this.LayoutRegion.Right),this.Plugin.Components.create("DensityControls-fofc_minus",function(e){return new _this.Bootstrap.Components.Transform.Updater(e,"density-fofc_plus","Density : Fo-Fc(+ve)")},_this.Plugin.Views.Transform.Updater)(this.LayoutRegion.Right),this.Plugin.Components.create("DensityControls-em-density",function(e){return new _this.Bootstrap.Components.Transform.Updater(e,"em-density-map","Density")},_this.Plugin.Views.Transform.Updater)(this.LayoutRegion.Right),this.Plugin.Components.Context.Overlay(this.LayoutRegion.Root),this.Plugin.Components.Context.Toast(this.LayoutRegion.Main,!0),this.Plugin.Components.Context.BackgroundTasks(this.LayoutRegion.Main,!0)],viewport:{view:this.Views.Visualization.Viewport,controlsView:this.Views.Visualization.ViewportControls},layoutView:this.Views.Layout,tree:void 0}}return e.prototype.applyTransforms=function(e){return this.Tree.Transform.apply(this.plugin.context,e).run(this.plugin.context)},e.prototype.selectNodes=function(e){return this.plugin.context.select(e)},e.prototype.cleanUp=function(){this.Command.Tree.RemoveNode.dispatch(this.plugin.context,"sequence-selection")},e.prototype.createPlugin=function(){_this=this,this.plugin=this.create(i[0]),this.Command.Layout.SetState.dispatch(this.plugin.context,{hideControls:r.hideControls,isExpanded:r.isExpanded});this.Event.Molecule.ModelSelect.getStream(this.plugin.context).subscribe(function(e){var t=_this.getDispatchEventData(e);_this.dispatchCustomEvent("PDB.litemol.click",t)}),this.Event.Molecule.ModelHighlight.getStream(this.plugin.context).subscribe(function(e){var t=_this.getDispatchEventData(e);_this.dispatchCustomEvent("PDB.litemol.mouseover",t)});this.Command.Visual.ResetScene.getStream(this.plugin.context).subscribe(function(){return _this.cleanUp()}),this.Command.Visual.ResetTheme.getStream(this.plugin.context).subscribe(function(){return _this.cleanUp()})},e.prototype.destroyPlugin=function(){this.plugin.destroy(),this.plugin=void 0},e.prototype.showControls=function(){return this.Command.Layout.SetState.dispatch(this.plugin.context,{hideControls:!1})},e.prototype.hideControls=function(){return this.Command.Layout.SetState.dispatch(this.plugin.context,{hideControls:!0})},e.prototype.expand=function(){return this.Command.Layout.SetState.dispatch(this.plugin.context,{isExpanded:!0})},e.prototype.setBackground=function(){return this.Command.Layout.SetViewportOptions.dispatch(this.plugin.context,{clearColor:this.CoreVis.Color.fromRgb(255,255,255)})},e.prototype.getEMEntryData=function(){var e=this.moleculeId.toLowerCase(),r="//www.ebi.ac.uk/pdbe/api/pdb/entry/summary/"+e,i=n.defer();return t.get(r).then(function(e){i.resolve(e.data)},function(){i.reject("fail response")}),i.promise},e.prototype.getEMDensityData=function(e){var r="//www.ebi.ac.uk/pdbe/api/emdb/entry/map/"+e,i=n.defer();return t.get(r).then(function(e){i.resolve(e.data)},function(){i.reject("fail response")}),i.promise},e.prototype.getMapSize=function(e,r){var i=n.defer();return"em"==r?t.head("http://ftp.ebi.ac.uk/pub/databases/emdb/structures/"+e.toUpperCase()+"/map/"+e.replace("-","_").toLowerCase()+".map.gz").then(function(e){var t=!0,n=e.headers("Content-Length"),r="undefined"!=typeof n?n/1024/1024:void 0;console.log(r+" MB"),"undefined"!=typeof r&&r>100&&(t=!1),i.resolve(t)},function(){i.resolve(!0)}):i.resolve(!0),i.promise},e.prototype.loadFromNonCif=function(e,t){var n=this.moleculeId.toLowerCase(),i=this.Transform.build().add(this.plugin.context.tree.root,this.Transformer.Data.Download,{url:e,type:t.isBinary?"Binary":"String",id:n});return 1==r.treeMenu||"true"==r.treeMenu?i.then(this.Transformer.Molecule.CreateFromData,{format:t,customId:n},{isBinding:!0}).then(this.Transformer.Molecule.CreateModel,{modelIndex:0},{isBinding:!1,ref:"model"}).then(this.Transformer.Molecule.CreateMacromoleculeVisual,{polymer:!0,polymerRef:"polymer-visual",het:!0,water:!0}):i.then(this.Transformer.Molecule.CreateFromData,{format:t,customId:n},{ref:"molecule"}).then(a.Custom.CreateRepresentation,{}),i},e.prototype.loadFromCif=function(e,t){var n=this.moleculeId.toLowerCase(),i=this.Transform.build().add(this.plugin.context.tree.root,this.Transformer.Data.Download,{url:e,type:t.isBinary?"Binary":"String",id:n}).then(t.isBinary?this.Transformer.Data.ParseBinaryCif:this.Transformer.Data.ParseCif,{id:n},{isBinding:!0,ref:"cifDict"});return 1==r.treeMenu||"true"==r.treeMenu?i.then(this.Transformer.Molecule.CreateFromMmCif,{blockIndex:0},{isBinding:!0}).then(this.Transformer.Molecule.CreateModel,{modelIndex:0},{isBinding:!1,ref:"model"}).then(this.Transformer.Molecule.CreateMacromoleculeVisual,{polymer:!0,polymerRef:"polymer-visual",het:!0,water:!0}):i.then(this.Transformer.Molecule.CreateFromMmCif,{blockIndex:0},{ref:"molecule"}).then(a.Custom.CreateRepresentation,{}),i},e.prototype.loadMolecule=function(){var e=this.moleculeId.toLowerCase(),t="//www.ebi.ac.uk/pdbe/static/entry/"+e+"_updated.cif";if("undefined"!=typeof r.customQuery&&(t="//www.ebi.ac.uk/pdbe/coordinates/"+e+"/"+r.customQuery),"undefined"!=typeof r.sourceUrl&&"undefined"==typeof r.sourceFormat)return this.Bootstrap.Command.Toast.Show.dispatch(this.plugin.context,{key:"format-issue",title:"Source Format",message:"Please specify sourceFormat!"}),!1;"undefined"!=typeof r.sourceUrl&&(t=r.sourceUrl);var n=!1;"undefined"!=typeof r.customQuery&&new RegExp("encoding=bcif","i").test(t)&&(r.sourceFormat="bcif",n=!0);var i=LiteMol.Core.Formats.Molecule.SupportedFormats.mmCIF;if("undefined"!=typeof r.sourceFormat){if(LiteMol.Core.Formats.FormatInfo.is(r.sourceFormat))i=r.sourceFormat;else{var o=LiteMol.Core.Formats.FormatInfo.fromShortcut(LiteMol.Core.Formats.Molecule.SupportedFormats.All,r.sourceFormat);if(!o)throw new Error("'"+r.sourceFormat+"' is not a supported format.");i=o}"undefined"!=typeof r.customQuery&&0==n&&(t=new RegExp("\\?").test(t)?t+"&encoding="+r.sourceFormat:t+"?encoding="+r.sourceFormat)}if("undefined"==typeof r.sourceFormat||"sdf"!=r.sourceFormat.toLowerCase()&&"pdb"!=r.sourceFormat.toLowerCase())var a=this.loadFromCif(t,i);else var a=this.loadFromNonCif(t,i);this.applyTransforms(a).then(function(){"undefined"!=typeof r.sourceFormat&&"sdf"==r.sourceFormat.toLowerCase()||"undefined"!=typeof r.loadEdMaps&&"true"===r.loadEdMaps&&r.LiteMolComponent.loadDensity(!1,!0)})},e.prototype.loadDensity=function(e,t){var n=this,r=this.moleculeId.toLowerCase();e="undefined"!=typeof e&&1==e?!0:!1;var i=n.Transform.build().add(n.plugin.context.tree.root,a.PDBe.Data.DownloadDensity,{id:r,isWireframe:e,checkMapFileSize:t},{ref:"density"});n.applyTransforms(i)},e.prototype.toggleDensity=function(){var e=this.selectNodes("density")[0];e&&this.Command.Entity.SetVisibility.dispatch(this.plugin.context,{entity:e,visible:2===e.state.visibility})},e.prototype.loadValidationReport=function(){var e=this.moleculeId.toLowerCase(),t=this.Transform.build().add(this.plugin.context.tree.root,a.PDBe.Validation.CustomDownloadAndCreate,{id:e});this.applyTransforms(t)},e.prototype.loadSequenceAnnotation=function(){var e=this.moleculeId.toLowerCase(),t=this.Transform.build().add(this.plugin.context.tree.root,a.PDBe.SequenceAnnotation.CustomDownloadAndCreate,{id:e});this.applyTransforms(t)},e.prototype.createSelectionTheme=function(e){var t=new Map;return t.set("Uniform",this.CoreVis.Color.fromRgb(207,178,178)),t.set("Selection",e),t.set("Highlight",this.CoreVis.Theme.Default.HighlightColor),this.Visualization.Molecule.uniformThemeProvider(void 0,{colors:t})},e.prototype.SelectExtractFocus=function(e,t,n){_this=this;var r=this.selectNodes("polymer-visual")[0];if(r){this.resetThemeSelHighlight();var i=this.Query.sequence(e.entity_id.toString(),e.struct_asym_id.toString(),{seqNumber:e.start_residue_number},{seqNumber:e.end_residue_number}),o=this.createSelectionTheme(this.CoreVis.Color.fromRgb(t.r,t.g,t.b)),a=this.Transform.build().add(r,this.Transformer.Molecule.CreateSelectionFromQuery,{query:i,name:"My name"},{ref:"sequence-selection"});"undefined"!=typeof n&&1==n&&a.then(this.Transformer.Molecule.CreateVisual,{style:this.Visualization.Molecule.Default.ForType.get("BallsAndSticks")}),this.applyTransforms(a).then(function(){_this.Command.Visual.UpdateBasicTheme.dispatch(_this.plugin.context,{visual:r,theme:o}),_this.Command.Entity.Focus.dispatch(_this.plugin.context,_this.selectNodes("sequence-selection"))})}},e.prototype.highlightOn=function(e){var t=this.selectNodes("model")[0];if(t){"undefined"!=typeof this.currentHighLightedDetails&&this.Command.Molecule.Highlight.dispatch(this.plugin.context,this.currentHighLightedDetails.prevQuery);var n=this.Query.sequence(e.entity_id.toString(),e.struct_asym_id.toString(),{seqNumber:e.start_residue_number},{seqNumber:e.end_residue_number});this.Command.Molecule.Highlight.dispatch(this.plugin.context,{model:t,query:n,isOn:!0}),this.currentHighLightedDetails={prevQueryData:e,prevQuery:{model:t,query:n,isOn:!1}}}},e.prototype.highlightOff=function(){"undefined"!=typeof this.currentHighLightedDetails&&this.Command.Molecule.Highlight.dispatch(this.plugin.context,this.currentHighLightedDetails.prevQuery)},e.prototype.resetThemeSelHighlight=function(){this.Command.Visual.ResetTheme.dispatch(this.plugin.context,void 0),this.cleanUp()},e.prototype.colorChains=function(e,t){var n=this.selectNodes("polymer-visual")[0],r=this.selectNodes("model")[0];if(r&&n){var i=new Map;i.set(e,this.CoreVis.Color.fromRgb(t[0],t[1],t[2]));var o=this.Visualization.Molecule.createColorMapThemeProvider(function(e){return{index:e.atoms.chainIndex,property:e.chains.asymId}},i,this.CoreVis.Color.fromRgb(207,178,178))(r);this.Command.Visual.UpdateBasicTheme.dispatch(this.plugin.context,{visual:n,theme:o})}},e.prototype.create=function(e){var t=this.CustomMenuSpec;if(1==r.treeMenu||"true"==r.treeMenu)var t=this.spec;if("undefined"!=typeof LiteMolSpecConfig){LiteMolSpecConfig.behaviours.length>0&&(t.behaviours=LiteMolSpecConfig.behaviours);var n=LiteMolSpecConfig.components.length;if(n>0)for(var i=0;n>i;i++)t.components.push(LiteMolSpecConfig.components[i])}"undefined"!=typeof r.showLogs&&"true"==r.showLogs&&t.components.push(this.Plugin.Components.Context.Log(this.LayoutRegion.Bottom,!0));var o=new this.Plugin.Instance(t,e);return o.context.logger.message("LiteMol Viewer "+this.Plugin.VERSION.number),o},e.prototype.getDispatchEventData=function(e){var t={},n=e.data;return n&&n.residues&&(t.residuesName=n.residues[0].authName,t.chainId=n.chains[0].authAsymId,t.residueNumber=n.residues[0].seqNumber,t.entityId=n.chains[0].entity.entityId,t.entryId=n.moleculeId),t},e.prototype.dispatchCustomEvent=function(e,t,n){var o=i[0];"undefined"!=typeof n&&(o=n),"undefined"!=typeof t&&(r.pdbevents[e].eventData=t),o.dispatchEvent(r.pdbevents[e])},e}(),c=function(){r.LiteMolComponent.createPlugin(),r.LiteMolComponent.loadMolecule(),"undefined"==typeof r.validationAnnotation||"true"!==r.validationAnnotation||r.treeMenu||r.LiteMolComponent.loadValidationReport(),"undefined"==typeof r.domainAnnotation||"true"!==r.domainAnnotation||r.treeMenu||r.LiteMolComponent.loadSequenceAnnotation()};if(r.LiteMolComponent=new u,"undefined"!=typeof r.customRender||"undefined"==typeof r.pdbId?r.LiteMolComponent.createPlugin():c(),r.$watch("pdbId",function(e,t){"undefined"!=typeof r.pdbId&&e!==t&&(r.LiteMolComponent.moleculeId=r.pdbId,r.LiteMolComponent.destroyPlugin(),c())}),"true"==r.subscribeEvents){e.on("PDB.topologyViewer.click",function(e){if("undefined"!=typeof e.eventData){if(e.eventData.entryId!=r.pdbId)return;var t={entity_id:e.eventData.entityId,struct_asym_id:e.eventData.structAsymId,start_residue_number:e.eventData.residueNumber,end_residue_number:e.eventData.residueNumber};r.LiteMolComponent.SelectExtractFocus(t,{r:0,g:81,b:51},!1)}});var l=["uniprot","pfam","cath","scop","strand","helice"],h=["chain","quality","quality_outlier","binding site","alternate conformer"];e.on("PDB.seqViewer.click",function(e){if("undefined"!=typeof e.eventData){if(e.eventData.entryId!=r.pdbId)return;if("undefined"!=typeof e.eventData.elementData&&h.indexOf(e.eventData.elementData.elementType)>-1){var t={entity_id:e.eventData.entityId,struct_asym_id:e.eventData.elementData.pathData.struct_asym_id,start_residue_number:e.eventData.residueNumber,end_residue_number:e.eventData.residueNumber};r.LiteMolComponent.SelectExtractFocus(t,{r:0,g:81,b:51},!1)}else if("undefined"!=typeof e.eventData.elementData&&l.indexOf(e.eventData.elementData.elementType)>-1){var n=e.eventData.elementData.color,t={entity_id:e.eventData.entityId,struct_asym_id:e.eventData.elementData.pathData.struct_asym_id,start_residue_number:e.eventData.elementData.pathData.start.residue_number,end_residue_number:e.eventData.elementData.pathData.end.residue_number};r.LiteMolComponent.SelectExtractFocus(t,{r:n[0],g:n[1],b:n[2]},!1)}}}),e.on("PDB.seqViewer.mouseover",function(e){if("undefined"!=typeof e.eventData){if(e.eventData.entryId!=r.pdbId)return;if("undefined"!=typeof e.eventData.elementData&&h.indexOf(e.eventData.elementData.elementType)>-1){var t={entity_id:e.eventData.entityId,struct_asym_id:e.eventData.elementData.pathData.struct_asym_id,start_residue_number:e.eventData.residueNumber,end_residue_number:e.eventData.residueNumber};
r.LiteMolComponent.highlightOn(t)}else if("undefined"!=typeof e.eventData.elementData&&l.indexOf(e.eventData.elementData.elementType)>-1){var t=(e.eventData.elementData.pathData.start.residue_number,e.eventData.elementData.pathData.end.residue_number,{entity_id:e.eventData.entityId,struct_asym_id:e.eventData.elementData.pathData.struct_asym_id,start_residue_number:e.eventData.elementData.pathData.start.residue_number,end_residue_number:e.eventData.elementData.pathData.end.residue_number});r.LiteMolComponent.highlightOn(t)}}}),e.on("PDB.seqViewer.mouseout",function(){r.LiteMolComponent.highlightOff()}),e.on("PDB.topologyViewer.mouseover",function(e){if("undefined"!=typeof e.eventData){if(e.eventData.entryId!=r.pdbId)return;var t={entity_id:e.eventData.entityId,struct_asym_id:e.eventData.structAsymId,start_residue_number:e.eventData.residueNumber,end_residue_number:e.eventData.residueNumber};r.LiteMolComponent.highlightOn(t)}}),e.on("PDB.topologyViewer.mouseout",function(){r.LiteMolComponent.highlightOff()})}}}}])}(),function(){"use strict";angular.element(document).ready(function(){angular.bootstrap(document,["pdb.litemol"])})}();