User:Jiywang3/all.js

/*! jQuery UI - v1.11.4 - 2015-03-11
 * http://jqueryui.com
 * Includes: core.js, widget.js, mouse.js, position.js, accordion.js, autocomplete.js, button.js, datepicker.js, dialog.js, draggable.js, droppable.js, effect.js, effect-blind.js, effect-bounce.js, effect-clip.js, effect-drop.js, effect-explode.js, effect-fade.js, effect-fold.js, effect-highlight.js, effect-puff.js, effect-pulsate.js, effect-scale.js, effect-shake.js, effect-size.js, effect-slide.js, effect-transfer.js, menu.js, progressbar.js, resizable.js, selectable.js, selectmenu.js, slider.js, sortable.js, spinner.js, tabs.js, tooltip.js
 * Copyright 2015 jQuery Foundation and other contributors; Licensed MIT */

(function(e){"function"==typeof define&&define.amd?define(["jquery"],e):e(jQuery)})(function(e){function t(t,s){var n,a,o,r=t.nodeName.toLowerCase;return"area"===r?(n=t.parentNode,a=n.name,t.href&&a&&"map"===n.nodeName.toLowerCase?(o=e("img[usemap='#"+a+"']")[0],!!o&&i(o)):!1):(/^(input|select|textarea|button|object)$/.test(r)?!t.disabled:"a"===r?t.href||s:s)&&i(t)}function i(t){return e.expr.filters.visible(t)&&!e(t).parents.addBack.filter(function{return"hidden"===e.css(this,"visibility")}).length}function s(e){for(var t,i;e.length&&e[0]!==document;){if(t=e.css("position"),("absolute"===t||"relative"===t||"fixed"===t)&&(i=parseInt(e.css("zIndex"),10),!isNaN(i)&&0!==i))return i;e=e.parent}return 0}function n{this._curInst=null,this._keyEvent=!1,this._disabledInputs=[],this._datepickerShowing=!1,this._inDialog=!1,this._mainDivId="ui-datepicker-div",this._inlineClass="ui-datepicker-inline",this._appendClass="ui-datepicker-append",this._triggerClass="ui-datepicker-trigger",this._dialogClass="ui-datepicker-dialog",this._disableClass="ui-datepicker-disabled",this._unselectableClass="ui-datepicker-unselectable",this._currentClass="ui-datepicker-current-day",this._dayOverClass="ui-datepicker-days-cell-over",this.regional=[],this.regional[""]={closeText:"Done",prevText:"Prev",nextText:"Next",currentText:"Today",monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],monthNamesShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],dayNamesShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],dayNamesMin:["Su","Mo","Tu","We","Th","Fr","Sa"],weekHeader:"Wk",dateFormat:"mm/dd/yy",firstDay:0,isRTL:!1,showMonthAfterYear:!1,yearSuffix:""},this._defaults={showOn:"focus",showAnim:"fadeIn",showOptions:{},defaultDate:null,appendText:"",buttonText:"...",buttonImage:"",buttonImageOnly:!1,hideIfNoPrevNext:!1,navigationAsDateFormat:!1,gotoCurrent:!1,changeMonth:!1,changeYear:!1,yearRange:"c-10:c+10",showOtherMonths:!1,selectOtherMonths:!1,showWeek:!1,calculateWeek:this.iso8601Week,shortYearCutoff:"+10",minDate:null,maxDate:null,duration:"fast",beforeShowDay:null,beforeShow:null,onSelect:null,onChangeMonthYear:null,onClose:null,numberOfMonths:1,showCurrentAtPos:0,stepMonths:1,stepBigMonths:12,altField:"",altFormat:"",constrainInput:!0,showButtonPanel:!1,autoSize:!1,disabled:!1},e.extend(this._defaults,this.regional[""]),this.regional.en=e.extend(!0,{},this.regional[""]),this.regional["en-US"]=e.extend(!0,{},this.regional.en),this.dpDiv=a(e(" "))}function a(t){var i="button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a";return t.delegate(i,"mouseout",function{e(this).removeClass("ui-state-hover"),-1!==this.className.indexOf("ui-datepicker-prev")&&e(this).removeClass("ui-datepicker-prev-hover"),-1!==this.className.indexOf("ui-datepicker-next")&&e(this).removeClass("ui-datepicker-next-hover")}).delegate(i,"mouseover",o)}function o{e.datepicker._isDisabledDatepicker(v.inline?v.dpDiv.parent[0]:v.input[0])||(e(this).parents(".ui-datepicker-calendar").find("a").removeClass("ui-state-hover"),e(this).addClass("ui-state-hover"),-1!==this.className.indexOf("ui-datepicker-prev")&&e(this).addClass("ui-datepicker-prev-hover"),-1!==this.className.indexOf("ui-datepicker-next")&&e(this).addClass("ui-datepicker-next-hover"))}function r(t,i){e.extend(t,i);for(var s in i)null==i[s]&&(t[s]=i[s]);return t}function h(e){return function{var t=this.element.val;e.apply(this,arguments),this._refresh,t!==this.element.val&&this._trigger("change")}}e.ui=e.ui||{},e.extend(e.ui,{version:"1.11.4",keyCode:{BACKSPACE:8,COMMA:188,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,LEFT:37,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SPACE:32,TAB:9,UP:38}}),e.fn.extend({scrollParent:function(t){var i=this.css("position"),s="absolute"===i,n=t?/(auto|scroll|hidden)/:/(auto|scroll)/,a=this.parents.filter(function{var t=e(this);return s&&"static"===t.css("position")?!1:n.test(t.css("overflow")+t.css("overflow-y")+t.css("overflow-x"))}).eq(0);return"fixed"!==i&&a.length?a:e(this[0].ownerDocument||document)},uniqueId:function{var e=0;return function{return this.each(function{this.id||(this.id="ui-id-"+ ++e)})}},removeUniqueId:function{return this.each(function{/^ui-id-\d+$/.test(this.id)&&e(this).removeAttr("id")})}}),e.extend(e.expr[":"],{data:e.expr.createPseudo?e.expr.createPseudo(function(t){return function(i){return!!e.data(i,t)}}):function(t,i,s){return!!e.data(t,s[3])},focusable:function(i){return t(i,!isNaN(e.attr(i,"tabindex")))},tabbable:function(i){var s=e.attr(i,"tabindex"),n=isNaN(s);return(n||s>=0)&&t(i,!n)}}),e("").outerWidth(1).jquery||e.each(["Width","Height"],function(t,i){function s(t,i,s,a){return e.each(n,function{i-=parseFloat(e.css(t,"padding"+this))||0,s&&(i-=parseFloat(e.css(t,"border"+this+"Width"))||0),a&&(i-=parseFloat(e.css(t,"margin"+this))||0)}),i}var n="Width"===i?["Left","Right"]:["Top","Bottom"],a=i.toLowerCase,o={innerWidth:e.fn.innerWidth,innerHeight:e.fn.innerHeight,outerWidth:e.fn.outerWidth,outerHeight:e.fn.outerHeight};e.fn["inner"+i]=function(t){return void 0===t?o["inner"+i].call(this):this.each(function{e(this).css(a,s(this,t)+"px")})},e.fn["outer"+i]=function(t,n){return"number"!=typeof t?o["outer"+i].call(this,t):this.each(function{e(this).css(a,s(this,t,!0,n)+"px")})}}),e.fn.addBack||(e.fn.addBack=function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e))}),e("").data("a-b","a").removeData("a-b").data("a-b")&&(e.fn.removeData=function(t){return function(i){return arguments.length?t.call(this,e.camelCase(i)):t.call(this)}}(e.fn.removeData)),e.ui.ie=!!/msie [\w.]+/.exec(navigator.userAgent.toLowerCase),e.fn.extend({focus:function(t){return function(i,s){return"number"==typeof i?this.each(function{var t=this;setTimeout(function{e(t).focus,s&&s.call(t)},i)}):t.apply(this,arguments)}}(e.fn.focus),disableSelection:function{var e="onselectstart"in document.createElement("div")?"selectstart":"mousedown";return function{return this.bind(e+".ui-disableSelection",function(e){e.preventDefault})}},enableSelection:function{return this.unbind(".ui-disableSelection")},zIndex:function(t){if(void 0!==t)return this.css("zIndex",t);if(this.length)for(var i,s,n=e(this[0]);n.length&&n[0]!==document;){if(i=n.css("position"),("absolute"===i||"relative"===i||"fixed"===i)&&(s=parseInt(n.css("zIndex"),10),!isNaN(s)&&0!==s))return s;n=n.parent}return 0}}),e.ui.plugin={add:function(t,i,s){var n,a=e.ui[t].prototype;for(n in s)a.plugins[n]=a.plugins[n]||[],a.plugins[n].push([i,s[n]])},call:function(e,t,i,s){var n,a=e.plugins[t];if(a&&(s||e.element[0].parentNode&&11!==e.element[0].parentNode.nodeType))for(n=0;a.length>n;n++)e.options[a[n][0]]&&a[n][1].apply(e.element,i)}};var l=0,u=Array.prototype.slice;e.cleanData=function(t){return function(i){var s,n,a;for(a=0;null!=(n=i[a]);a++)try{s=e._data(n,"events"),s&&s.remove&&e(n).triggerHandler("remove")}catch(o){}t(i)}}(e.cleanData),e.widget=function(t,i,s){var n,a,o,r,h={},l=t.split(".")[0];return t=t.split(".")[1],n=l+"-"+t,s||(s=i,i=e.Widget),e.expr[":"][n.toLowerCase]=function(t){return!!e.data(t,n)},e[l]=e[l]||{},a=e[l][t],o=e[l][t]=function(e,t){return this._createWidget?(arguments.length&&this._createWidget(e,t),void 0):new o(e,t)},e.extend(o,a,{version:s.version,_proto:e.extend({},s),_childConstructors:[]}),r=new i,r.options=e.widget.extend({},r.options),e.each(s,function(t,s){return e.isFunction(s)?(h[t]=function{var e=function{return i.prototype[t].apply(this,arguments)},n=function(e){return i.prototype[t].apply(this,e)};return function{var t,i=this._super,a=this._superApply;return this._super=e,this._superApply=n,t=s.apply(this,arguments),this._super=i,this._superApply=a,t}},void 0):(h[t]=s,void 0)}),o.prototype=e.widget.extend(r,{widgetEventPrefix:a?r.widgetEventPrefix||t:t},h,{constructor:o,namespace:l,widgetName:t,widgetFullName:n}),a?(e.each(a._childConstructors,function(t,i){var s=i.prototype;e.widget(s.namespace+"."+s.widgetName,o,i._proto)}),delete a._childConstructors):i._childConstructors.push(o),e.widget.bridge(t,o),o},e.widget.extend=function(t){for(var i,s,n=u.call(arguments,1),a=0,o=n.length;o>a;a++)for(i in n[a])s=n[a][i],n[a].hasOwnProperty(i)&&void 0!==s&&(t[i]=e.isPlainObject(s)?e.isPlainObject(t[i])?e.widget.extend({},t[i],s):e.widget.extend({},s):s);return t},e.widget.bridge=function(t,i){var s=i.prototype.widgetFullName||t;e.fn[t]=function(n){var a="string"==typeof n,o=u.call(arguments,1),r=this;return a?this.each(function{var i,a=e.data(this,s);return"instance"===n?(r=a,!1):a?e.isFunction(a[n])&&"_"!==n.charAt(0)?(i=a[n].apply(a,o),i!==a&&void 0!==i?(r=i&&i.jquery?r.pushStack(i.get):i,!1):void 0):e.error("no such method '"+n+"' for "+t+" widget instance"):e.error("cannot call methods on "+t+" prior to initialization; "+"attempted to call method '"+n+"'")}):(o.length&&(n=e.widget.extend.apply(null,[n].concat(o))),this.each(function{var t=e.data(this,s);t?(t.option(n||{}),t._init&&t._init):e.data(this,s,new i(n,this))})),r}},e.Widget=function{},e.Widget._childConstructors=[],e.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",defaultElement:" ",options:{disabled:!1,create:null},_createWidget:function(t,i){i=e(i||this.defaultElement||this)[0],this.element=e(i),this.uuid=l++,this.eventNamespace="."+this.widgetName+this.uuid,this.bindings=e,this.hoverable=e,this.focusable=e,i!==this&&(e.data(i,this.widgetFullName,this),this._on(!0,this.element,{remove:function(e){e.target===i&&this.destroy}}),this.document=e(i.style?i.ownerDocument:i.document||i),this.window=e(this.document[0].defaultView||this.document[0].parentWindow)),this.options=e.widget.extend({},this.options,this._getCreateOptions,t),this._create,this._trigger("create",null,this._getCreateEventData),this._init},_getCreateOptions:e.noop,_getCreateEventData:e.noop,_create:e.noop,_init:e.noop,destroy:function{this._destroy,this.element.unbind(this.eventNamespace).removeData(this.widgetFullName).removeData(e.camelCase(this.widgetFullName)),this.widget.unbind(this.eventNamespace).removeAttr("aria-disabled").removeClass(this.widgetFullName+"-disabled "+"ui-state-disabled"),this.bindings.unbind(this.eventNamespace),this.hoverable.removeClass("ui-state-hover"),this.focusable.removeClass("ui-state-focus")},_destroy:e.noop,widget:function{return this.element},option:function(t,i){var s,n,a,o=t;if(0===arguments.length)return e.widget.extend({},this.options);if("string"==typeof t)if(o={},s=t.split("."),t=s.shift,s.length){for(n=o[t]=e.widget.extend({},this.options[t]),a=0;s.length-1>a;a++)n[s[a]]=n[s[a]]||{},n=n[s[a]];if(t=s.pop,1===arguments.length)return void 0===n[t]?null:n[t];n[t]=i}else{if(1===arguments.length)return void 0===this.options[t]?null:this.options[t];o[t]=i}return this._setOptions(o),this},_setOptions:function(e){var t;for(t in e)this._setOption(t,e[t]);return this},_setOption:function(e,t){return this.options[e]=t,"disabled"===e&&(this.widget.toggleClass(this.widgetFullName+"-disabled",!!t),t&&(this.hoverable.removeClass("ui-state-hover"),this.focusable.removeClass("ui-state-focus"))),this},enable:function{return this._setOptions({disabled:!1})},disable:function{return this._setOptions({disabled:!0})},_on:function(t,i,s){var n,a=this;"boolean"!=typeof t&&(s=i,i=t,t=!1),s?(i=n=e(i),this.bindings=this.bindings.add(i)):(s=i,i=this.element,n=this.widget),e.each(s,function(s,o){function r{return t||a.options.disabled!==!0&&!e(this).hasClass("ui-state-disabled")?("string"==typeof o?a[o]:o).apply(a,arguments):void 0}"string"!=typeof o&&(r.guid=o.guid=o.guid||r.guid||e.guid++);var h=s.match(/^([\w:-]*)\s*(.*)$/),l=h[1]+a.eventNamespace,u=h[2];u?n.delegate(u,l,r):i.bind(l,r)})},_off:function(t,i){i=(i||"").split(" ").join(this.eventNamespace+" ")+this.eventNamespace,t.unbind(i).undelegate(i),this.bindings=e(this.bindings.not(t).get),this.focusable=e(this.focusable.not(t).get),this.hoverable=e(this.hoverable.not(t).get)},_delay:function(e,t){function i{return("string"==typeof e?s[e]:e).apply(s,arguments)}var s=this;return setTimeout(i,t||0)},_hoverable:function(t){this.hoverable=this.hoverable.add(t),this._on(t,{mouseenter:function(t){e(t.currentTarget).addClass("ui-state-hover")},mouseleave:function(t){e(t.currentTarget).removeClass("ui-state-hover")}})},_focusable:function(t){this.focusable=this.focusable.add(t),this._on(t,{focusin:function(t){e(t.currentTarget).addClass("ui-state-focus")},focusout:function(t){e(t.currentTarget).removeClass("ui-state-focus")}})},_trigger:function(t,i,s){var n,a,o=this.options[t];if(s=s||{},i=e.Event(i),i.type=(t===this.widgetEventPrefix?t:this.widgetEventPrefix+t).toLowerCase,i.target=this.element[0],a=i.originalEvent)for(n in a)n in i||(i[n]=a[n]);return this.element.trigger(i,s),!(e.isFunction(o)&&o.apply(this.element[0],[i].concat(s))===!1||i.isDefaultPrevented)}},e.each({show:"fadeIn",hide:"fadeOut"},function(t,i){e.Widget.prototype["_"+t]=function(s,n,a){"string"==typeof n&&(n={effect:n});var o,r=n?n===!0||"number"==typeof n?i:n.effect||i:t;n=n||{},"number"==typeof n&&(n={duration:n}),o=!e.isEmptyObject(n),n.complete=a,n.delay&&s.delay(n.delay),o&&e.effects&&e.effects.effect[r]?s[t](n):r!==t&&s[r]?s[r](n.duration,n.easing,a):s.queue(function(i){e(this)[t],a&&a.call(s[0]),i})}}),e.widget;var d=!1;e(document).mouseup(function{d=!1}),e.widget("ui.mouse",{version:"1.11.4",options:{cancel:"input,textarea,button,select,option",distance:1,delay:0},_mouseInit:function{var t=this;this.element.bind("mousedown."+this.widgetName,function(e){return t._mouseDown(e)}).bind("click."+this.widgetName,function(i){return!0===e.data(i.target,t.widgetName+".preventClickEvent")?(e.removeData(i.target,t.widgetName+".preventClickEvent"),i.stopImmediatePropagation,!1):void 0}),this.started=!1},_mouseDestroy:function{this.element.unbind("."+this.widgetName),this._mouseMoveDelegate&&this.document.unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate)},_mouseDown:function(t){if(!d){this._mouseMoved=!1,this._mouseStarted&&this._mouseUp(t),this._mouseDownEvent=t;var i=this,s=1===t.which,n="string"==typeof this.options.cancel&&t.target.nodeName?e(t.target).closest(this.options.cancel).length:!1;return s&&!n&&this._mouseCapture(t)?(this.mouseDelayMet=!this.options.delay,this.mouseDelayMet||(this._mouseDelayTimer=setTimeout(function{i.mouseDelayMet=!0},this.options.delay)),this._mouseDistanceMet(t)&&this._mouseDelayMet(t)&&(this._mouseStarted=this._mouseStart(t)!==!1,!this._mouseStarted)?(t.preventDefault,!0):(!0===e.data(t.target,this.widgetName+".preventClickEvent")&&e.removeData(t.target,this.widgetName+".preventClickEvent"),this._mouseMoveDelegate=function(e){return i._mouseMove(e)},this._mouseUpDelegate=function(e){return i._mouseUp(e)},this.document.bind("mousemove."+this.widgetName,this._mouseMoveDelegate).bind("mouseup."+this.widgetName,this._mouseUpDelegate),t.preventDefault,d=!0,!0)):!0}},_mouseMove:function(t){if(this._mouseMoved){if(e.ui.ie&&(!document.documentMode||9>document.documentMode)&&!t.button)return this._mouseUp(t);if(!t.which)return this._mouseUp(t)}return(t.which||t.button)&&(this._mouseMoved=!0),this._mouseStarted?(this._mouseDrag(t),t.preventDefault):(this._mouseDistanceMet(t)&&this._mouseDelayMet(t)&&(this._mouseStarted=this._mouseStart(this._mouseDownEvent,t)!==!1,this._mouseStarted?this._mouseDrag(t):this._mouseUp(t)),!this._mouseStarted)},_mouseUp:function(t){return this.document.unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate),this._mouseStarted&&(this._mouseStarted=!1,t.target===this._mouseDownEvent.target&&e.data(t.target,this.widgetName+".preventClickEvent",!0),this._mouseStop(t)),d=!1,!1},_mouseDistanceMet:function(e){return Math.max(Math.abs(this._mouseDownEvent.pageX-e.pageX),Math.abs(this._mouseDownEvent.pageY-e.pageY))>=this.options.distance},_mouseDelayMet:function{return this.mouseDelayMet},_mouseStart:function{},_mouseDrag:function{},_mouseStop:function{},_mouseCapture:function{return!0}}),function{function t(e,t,i){return[parseFloat(e[0])*(p.test(e[0])?t/100:1),parseFloat(e[1])*(p.test(e[1])?i/100:1)]}function i(t,i){return parseInt(e.css(t,i),10)||0}function s(t){var i=t[0];return 9===i.nodeType?{width:t.width,height:t.height,offset:{top:0,left:0}}:e.isWindow(i)?{width:t.width,height:t.height,offset:{top:t.scrollTop,left:t.scrollLeft}}:i.preventDefault?{width:0,height:0,offset:{top:i.pageY,left:i.pageX}}:{width:t.outerWidth,height:t.outerHeight,offset:t.offset}}e.ui=e.ui||{};var n,a,o=Math.max,r=Math.abs,h=Math.round,l=/left|center|right/,u=/top|center|bottom/,d=/[\+\-]\d+(\.[\d]+)?%?/,c=/^\w+/,p=/%$/,f=e.fn.position;e.position={scrollbarWidth:function{if(void 0!==n)return n;var t,i,s=e("  "),a=s.children[0];return e("body").append(s),t=a.offsetWidth,s.css("overflow","scroll"),i=a.offsetWidth,t===i&&(i=s[0].clientWidth),s.remove,n=t-i},getScrollInfo:function(t){var i=t.isWindow||t.isDocument?"":t.element.css("overflow-x"),s=t.isWindow||t.isDocument?"":t.element.css("overflow-y"),n="scroll"===i||"auto"===i&&t.width<t.element[0].scrollWidth,a="scroll"===s||"auto"===s&&t.height<t.element[0].scrollHeight;return{width:a?e.position.scrollbarWidth:0,height:n?e.position.scrollbarWidth:0}},getWithinInfo:function(t){var i=e(t||window),s=e.isWindow(i[0]),n=!!i[0]&&9===i[0].nodeType;return{element:i,isWindow:s,isDocument:n,offset:i.offset||{left:0,top:0},scrollLeft:i.scrollLeft,scrollTop:i.scrollTop,width:s||n?i.width:i.outerWidth,height:s||n?i.height:i.outerHeight}}},e.fn.position=function(n){if(!n||!n.of)return f.apply(this,arguments);n=e.extend({},n);var p,m,g,v,y,b,_=e(n.of),x=e.position.getWithinInfo(n.within),w=e.position.getScrollInfo(x),k=(n.collision||"flip").split(" "),T={};return b=s(_),_[0].preventDefault&&(n.at="left top"),m=b.width,g=b.height,v=b.offset,y=e.extend({},v),e.each(["my","at"],function{var e,t,i=(n[this]||"").split(" ");1===i.length&&(i=l.test(i[0])?i.concat(["center"]):u.test(i[0])?["center"].concat(i):["center","center"]),i[0]=l.test(i[0])?i[0]:"center",i[1]=u.test(i[1])?i[1]:"center",e=d.exec(i[0]),t=d.exec(i[1]),T[this]=[e?e[0]:0,t?t[0]:0],n[this]=[c.exec(i[0])[0],c.exec(i[1])[0]]}),1===k.length&&(k[1]=k[0]),"right"===n.at[0]?y.left+=m:"center"===n.at[0]&&(y.left+=m/2),"bottom"===n.at[1]?y.top+=g:"center"===n.at[1]&&(y.top+=g/2),p=t(T.at,m,g),y.left+=p[0],y.top+=p[1],this.each(function{var s,l,u=e(this),d=u.outerWidth,c=u.outerHeight,f=i(this,"marginLeft"),b=i(this,"marginTop"),D=d+f+i(this,"marginRight")+w.width,S=c+b+i(this,"marginBottom")+w.height,M=e.extend({},y),C=t(T.my,u.outerWidth,u.outerHeight);"right"===n.my[0]?M.left-=d:"center"===n.my[0]&&(M.left-=d/2),"bottom"===n.my[1]?M.top-=c:"center"===n.my[1]&&(M.top-=c/2),M.left+=C[0],M.top+=C[1],a||(M.left=h(M.left),M.top=h(M.top)),s={marginLeft:f,marginTop:b},e.each(["left","top"],function(t,i){e.ui.position[k[t]]&&e.ui.position[k[t]][i](M,{targetWidth:m,targetHeight:g,elemWidth:d,elemHeight:c,collisionPosition:s,collisionWidth:D,collisionHeight:S,offset:[p[0]+C[0],p[1]+C[1]],my:n.my,at:n.at,within:x,elem:u})}),n.using&&(l=function(e){var t=v.left-M.left,i=t+m-d,s=v.top-M.top,a=s+g-c,h={target:{element:_,left:v.left,top:v.top,width:m,height:g},element:{element:u,left:M.left,top:M.top,width:d,height:c},horizontal:0>i?"left":t>0?"right":"center",vertical:0>a?"top":s>0?"bottom":"middle"};d>m&&m>r(t+i)&&(h.horizontal="center"),c>g&&g>r(s+a)&&(h.vertical="middle"),h.important=o(r(t),r(i))>o(r(s),r(a))?"horizontal":"vertical",n.using.call(this,e,h)}),u.offset(e.extend(M,{using:l}))})},e.ui.position={fit:{left:function(e,t){var i,s=t.within,n=s.isWindow?s.scrollLeft:s.offset.left,a=s.width,r=e.left-t.collisionPosition.marginLeft,h=n-r,l=r+t.collisionWidth-a-n;t.collisionWidth>a?h>0&&0>=l?(i=e.left+h+t.collisionWidth-a-n,e.left+=h-i):e.left=l>0&&0>=h?n:h>l?n+a-t.collisionWidth:n:h>0?e.left+=h:l>0?e.left-=l:e.left=o(e.left-r,e.left)},top:function(e,t){var i,s=t.within,n=s.isWindow?s.scrollTop:s.offset.top,a=t.within.height,r=e.top-t.collisionPosition.marginTop,h=n-r,l=r+t.collisionHeight-a-n;t.collisionHeight>a?h>0&&0>=l?(i=e.top+h+t.collisionHeight-a-n,e.top+=h-i):e.top=l>0&&0>=h?n:h>l?n+a-t.collisionHeight:n:h>0?e.top+=h:l>0?e.top-=l:e.top=o(e.top-r,e.top)}},flip:{left:function(e,t){var i,s,n=t.within,a=n.offset.left+n.scrollLeft,o=n.width,h=n.isWindow?n.scrollLeft:n.offset.left,l=e.left-t.collisionPosition.marginLeft,u=l-h,d=l+t.collisionWidth-o-h,c="left"===t.my[0]?-t.elemWidth:"right"===t.my[0]?t.elemWidth:0,p="left"===t.at[0]?t.targetWidth:"right"===t.at[0]?-t.targetWidth:0,f=-2*t.offset[0];0>u?(i=e.left+c+p+f+t.collisionWidth-o-a,(0>i||r(u)>i)&&(e.left+=c+p+f)):d>0&&(s=e.left-t.collisionPosition.marginLeft+c+p+f-h,(s>0||d>r(s))&&(e.left+=c+p+f))},top:function(e,t){var i,s,n=t.within,a=n.offset.top+n.scrollTop,o=n.height,h=n.isWindow?n.scrollTop:n.offset.top,l=e.top-t.collisionPosition.marginTop,u=l-h,d=l+t.collisionHeight-o-h,c="top"===t.my[1],p=c?-t.elemHeight:"bottom"===t.my[1]?t.elemHeight:0,f="top"===t.at[1]?t.targetHeight:"bottom"===t.at[1]?-t.targetHeight:0,m=-2*t.offset[1];0>u?(s=e.top+p+f+m+t.collisionHeight-o-a,(0>s||r(u)>s)&&(e.top+=p+f+m)):d>0&&(i=e.top-t.collisionPosition.marginTop+p+f+m-h,(i>0||d>r(i))&&(e.top+=p+f+m))}},flipfit:{left:function{e.ui.position.flip.left.apply(this,arguments),e.ui.position.fit.left.apply(this,arguments)},top:function{e.ui.position.flip.top.apply(this,arguments),e.ui.position.fit.top.apply(this,arguments)}}},function{var t,i,s,n,o,r=document.getElementsByTagName("body")[0],h=document.createElement("div");t=document.createElement(r?"div":"body"),s={visibility:"hidden",width:0,height:0,border:0,margin:0,background:"none"},r&&e.extend(s,{position:"absolute",left:"-1000px",top:"-1000px"});for(o in s)t.style[o]=s[o];t.appendChild(h),i=r||document.documentElement,i.insertBefore(t,i.firstChild),h.style.cssText="position: absolute; left: 10.7432222px;",n=e(h).offset.left,a=n>10&&11>n,t.innerHTML="",i.removeChild(t)}},e.ui.position,e.widget("ui.accordion",{version:"1.11.4",options:{active:0,animate:{},collapsible:!1,event:"click",header:"> li > :first-child,> :not(li):even",heightStyle:"auto",icons:{activeHeader:"ui-icon-triangle-1-s",header:"ui-icon-triangle-1-e"},activate:null,beforeActivate:null},hideProps:{borderTopWidth:"hide",borderBottomWidth:"hide",paddingTop:"hide",paddingBottom:"hide",height:"hide"},showProps:{borderTopWidth:"show",borderBottomWidth:"show",paddingTop:"show",paddingBottom:"show",height:"show"},_create:function{var t=this.options;this.prevShow=this.prevHide=e,this.element.addClass("ui-accordion ui-widget ui-helper-reset").attr("role","tablist"),t.collapsible||t.active!==!1&&null!=t.active||(t.active=0),this._processPanels,0>t.active&&(t.active+=this.headers.length),this._refresh},_getCreateEventData:function{return{header:this.active,panel:this.active.length?this.active.next:e}},_createIcons:function{var t=this.options.icons;t&&(e(" ").addClass("ui-accordion-header-icon ui-icon "+t.header).prependTo(this.headers),this.active.children(".ui-accordion-header-icon").removeClass(t.header).addClass(t.activeHeader),this.headers.addClass("ui-accordion-icons"))},_destroyIcons:function{this.headers.removeClass("ui-accordion-icons").children(".ui-accordion-header-icon").remove},_destroy:function{var e;this.element.removeClass("ui-accordion ui-widget ui-helper-reset").removeAttr("role"),this.headers.removeClass("ui-accordion-header ui-accordion-header-active ui-state-default ui-corner-all ui-state-active ui-state-disabled ui-corner-top").removeAttr("role").removeAttr("aria-expanded").removeAttr("aria-selected").removeAttr("aria-controls").removeAttr("tabIndex").removeUniqueId,this._destroyIcons,e=this.headers.next.removeClass("ui-helper-reset ui-widget-content ui-corner-bottom ui-accordion-content ui-accordion-content-active ui-state-disabled").css("display","").removeAttr("role").removeAttr("aria-hidden").removeAttr("aria-labelledby").removeUniqueId,"content"!==this.options.heightStyle&&e.css("height","")},_setOption:function(e,t){return"active"===e?(this._activate(t),void 0):("event"===e&&(this.options.event&&this._off(this.headers,this.options.event),this._setupEvents(t)),this._super(e,t),"collapsible"!==e||t||this.options.active!==!1||this._activate(0),"icons"===e&&(this._destroyIcons,t&&this._createIcons),"disabled"===e&&(this.element.toggleClass("ui-state-disabled",!!t).attr("aria-disabled",t),this.headers.add(this.headers.next).toggleClass("ui-state-disabled",!!t)),void 0)},_keydown:function(t){if(!t.altKey&&!t.ctrlKey){var i=e.ui.keyCode,s=this.headers.length,n=this.headers.index(t.target),a=!1;switch(t.keyCode){case i.RIGHT:case i.DOWN:a=this.headers[(n+1)%s];break;case i.LEFT:case i.UP:a=this.headers[(n-1+s)%s];break;case i.SPACE:case i.ENTER:this._eventHandler(t);break;case i.HOME:a=this.headers[0];break;case i.END:a=this.headers[s-1]}a&&(e(t.target).attr("tabIndex",-1),e(a).attr("tabIndex",0),a.focus,t.preventDefault)}},_panelKeyDown:function(t){t.keyCode===e.ui.keyCode.UP&&t.ctrlKey&&e(t.currentTarget).prev.focus},refresh:function{var t=this.options;this._processPanels,t.active===!1&&t.collapsible===!0||!this.headers.length?(t.active=!1,this.active=e):t.active===!1?this._activate(0):this.active.length&&!e.contains(this.element[0],this.active[0])?this.headers.length===this.headers.find(".ui-state-disabled").length?(t.active=!1,this.active=e):this._activate(Math.max(0,t.active-1)):t.active=this.headers.index(this.active),this._destroyIcons,this._refresh},_processPanels:function{var e=this.headers,t=this.panels;this.headers=this.element.find(this.options.header).addClass("ui-accordion-header ui-state-default ui-corner-all"),this.panels=this.headers.next.addClass("ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom").filter(":not(.ui-accordion-content-active)").hide,t&&(this._off(e.not(this.headers)),this._off(t.not(this.panels)))},_refresh:function{var t,i=this.options,s=i.heightStyle,n=this.element.parent;this.active=this._findActive(i.active).addClass("ui-accordion-header-active ui-state-active ui-corner-top").removeClass("ui-corner-all"),this.active.next.addClass("ui-accordion-content-active").show,this.headers.attr("role","tab").each(function{var t=e(this),i=t.uniqueId.attr("id"),s=t.next,n=s.uniqueId.attr("id");t.attr("aria-controls",n),s.attr("aria-labelledby",i)}).next.attr("role","tabpanel"),this.headers.not(this.active).attr({"aria-selected":"false","aria-expanded":"false",tabIndex:-1}).next.attr({"aria-hidden":"true"}).hide,this.active.length?this.active.attr({"aria-selected":"true","aria-expanded":"true",tabIndex:0}).next.attr({"aria-hidden":"false"}):this.headers.eq(0).attr("tabIndex",0),this._createIcons,this._setupEvents(i.event),"fill"===s?(t=n.height,this.element.siblings(":visible").each(function{var i=e(this),s=i.css("position");"absolute"!==s&&"fixed"!==s&&(t-=i.outerHeight(!0))}),this.headers.each(function{t-=e(this).outerHeight(!0)}),this.headers.next.each(function{e(this).height(Math.max(0,t-e(this).innerHeight+e(this).height))}).css("overflow","auto")):"auto"===s&&(t=0,this.headers.next.each(function{t=Math.max(t,e(this).css("height","").height)}).height(t))},_activate:function(t){var i=this._findActive(t)[0];i!==this.active[0]&&(i=i||this.active[0],this._eventHandler({target:i,currentTarget:i,preventDefault:e.noop}))},_findActive:function(t){return"number"==typeof t?this.headers.eq(t):e},_setupEvents:function(t){var i={keydown:"_keydown"};t&&e.each(t.split(" "),function(e,t){i[t]="_eventHandler"}),this._off(this.headers.add(this.headers.next)),this._on(this.headers,i),this._on(this.headers.next,{keydown:"_panelKeyDown"}),this._hoverable(this.headers),this._focusable(this.headers)},_eventHandler:function(t){var i=this.options,s=this.active,n=e(t.currentTarget),a=n[0]===s[0],o=a&&i.collapsible,r=o?e:n.next,h=s.next,l={oldHeader:s,oldPanel:h,newHeader:o?e:n,newPanel:r};t.preventDefault,a&&!i.collapsible||this._trigger("beforeActivate",t,l)===!1||(i.active=o?!1:this.headers.index(n),this.active=a?e:n,this._toggle(l),s.removeClass("ui-accordion-header-active ui-state-active"),i.icons&&s.children(".ui-accordion-header-icon").removeClass(i.icons.activeHeader).addClass(i.icons.header),a||(n.removeClass("ui-corner-all").addClass("ui-accordion-header-active ui-state-active ui-corner-top"),i.icons&&n.children(".ui-accordion-header-icon").removeClass(i.icons.header).addClass(i.icons.activeHeader),n.next.addClass("ui-accordion-content-active")))},_toggle:function(t){var i=t.newPanel,s=this.prevShow.length?this.prevShow:t.oldPanel;this.prevShow.add(this.prevHide).stop(!0,!0),this.prevShow=i,this.prevHide=s,this.options.animate?this._animate(i,s,t):(s.hide,i.show,this._toggleComplete(t)),s.attr({"aria-hidden":"true"}),s.prev.attr({"aria-selected":"false","aria-expanded":"false"}),i.length&&s.length?s.prev.attr({tabIndex:-1,"aria-expanded":"false"}):i.length&&this.headers.filter(function{return 0===parseInt(e(this).attr("tabIndex"),10)}).attr("tabIndex",-1),i.attr("aria-hidden","false").prev.attr({"aria-selected":"true","aria-expanded":"true",tabIndex:0})},_animate:function(e,t,i){var s,n,a,o=this,r=0,h=e.css("box-sizing"),l=e.length&&(!t.length||e.index<t.index),u=this.options.animate||{},d=l&&u.down||u,c=function{o._toggleComplete(i)};return"number"==typeof d&&(a=d),"string"==typeof d&&(n=d),n=n||d.easing||u.easing,a=a||d.duration||u.duration,t.length?e.length?(s=e.show.outerHeight,t.animate(this.hideProps,{duration:a,easing:n,step:function(e,t){t.now=Math.round(e)}}),e.hide.animate(this.showProps,{duration:a,easing:n,complete:c,step:function(e,i){i.now=Math.round(e),"height"!==i.prop?"content-box"===h&&(r+=i.now):"content"!==o.options.heightStyle&&(i.now=Math.round(s-t.outerHeight-r),r=0)}}),void 0):t.animate(this.hideProps,a,n,c):e.animate(this.showProps,a,n,c)},_toggleComplete:function(e){var t=e.oldPanel;t.removeClass("ui-accordion-content-active").prev.removeClass("ui-corner-top").addClass("ui-corner-all"),t.length&&(t.parent[0].className=t.parent[0].className),this._trigger("activate",null,e)}}),e.widget("ui.menu",{version:"1.11.4",defaultElement:"",delay:300,options:{icons:{submenu:"ui-icon-carat-1-e"},items:"> *",menus:"ul",position:{my:"left-1 top",at:"right top"},role:"menu",blur:null,focus:null,select:null},_create:function{this.activeMenu=this.element,this.mouseHandled=!1,this.element.uniqueId.addClass("ui-menu ui-widget ui-widget-content").toggleClass("ui-menu-icons",!!this.element.find(".ui-icon").length).attr({role:this.options.role,tabIndex:0}),this.options.disabled&&this.element.addClass("ui-state-disabled").attr("aria-disabled","true"),this._on({"mousedown .ui-menu-item":function(e){e.preventDefault},"click .ui-menu-item":function(t){var i=e(t.target);!this.mouseHandled&&i.not(".ui-state-disabled").length&&(this.select(t),t.isPropagationStopped||(this.mouseHandled=!0),i.has(".ui-menu").length?this.expand(t):!this.element.is(":focus")&&e(this.document[0].activeElement).closest(".ui-menu").length&&(this.element.trigger("focus",[!0]),this.active&&1===this.active.parents(".ui-menu").length&&clearTimeout(this.timer)))},"mouseenter .ui-menu-item":function(t){if(!this.previousFilter){var i=e(t.currentTarget); i.siblings(".ui-state-active").removeClass("ui-state-active"),this.focus(t,i)}},mouseleave:"collapseAll","mouseleave .ui-menu":"collapseAll",focus:function(e,t){var i=this.active||this.element.find(this.options.items).eq(0);t||this.focus(e,i)},blur:function(t){this._delay(function{e.contains(this.element[0],this.document[0].activeElement)||this.collapseAll(t)})},keydown:"_keydown"}),this.refresh,this._on(this.document,{click:function(e){this._closeOnDocumentClick(e)&&this.collapseAll(e),this.mouseHandled=!1}})},_destroy:function{this.element.removeAttr("aria-activedescendant").find(".ui-menu").addBack.removeClass("ui-menu ui-widget ui-widget-content ui-menu-icons ui-front").removeAttr("role").removeAttr("tabIndex").removeAttr("aria-labelledby").removeAttr("aria-expanded").removeAttr("aria-hidden").removeAttr("aria-disabled").removeUniqueId.show,this.element.find(".ui-menu-item").removeClass("ui-menu-item").removeAttr("role").removeAttr("aria-disabled").removeUniqueId.removeClass("ui-state-hover").removeAttr("tabIndex").removeAttr("role").removeAttr("aria-haspopup").children.each(function{var t=e(this);t.data("ui-menu-submenu-carat")&&t.remove}),this.element.find(".ui-menu-divider").removeClass("ui-menu-divider ui-widget-content")},_keydown:function(t){var i,s,n,a,o=!0;switch(t.keyCode){case e.ui.keyCode.PAGE_UP:this.previousPage(t);break;case e.ui.keyCode.PAGE_DOWN:this.nextPage(t);break;case e.ui.keyCode.HOME:this._move("first","first",t);break;case e.ui.keyCode.END:this._move("last","last",t);break;case e.ui.keyCode.UP:this.previous(t);break;case e.ui.keyCode.DOWN:this.next(t);break;case e.ui.keyCode.LEFT:this.collapse(t);break;case e.ui.keyCode.RIGHT:this.active&&!this.active.is(".ui-state-disabled")&&this.expand(t);break;case e.ui.keyCode.ENTER:case e.ui.keyCode.SPACE:this._activate(t);break;case e.ui.keyCode.ESCAPE:this.collapse(t);break;default:o=!1,s=this.previousFilter||"",n=String.fromCharCode(t.keyCode),a=!1,clearTimeout(this.filterTimer),n===s?a=!0:n=s+n,i=this._filterMenuItems(n),i=a&&-1!==i.index(this.active.next)?this.active.nextAll(".ui-menu-item"):i,i.length||(n=String.fromCharCode(t.keyCode),i=this._filterMenuItems(n)),i.length?(this.focus(t,i),this.previousFilter=n,this.filterTimer=this._delay(function{delete this.previousFilter},1e3)):delete this.previousFilter}o&&t.preventDefault},_activate:function(e){this.active.is(".ui-state-disabled")||(this.active.is("[aria-haspopup='true']")?this.expand(e):this.select(e))},refresh:function{var t,i,s=this,n=this.options.icons.submenu,a=this.element.find(this.options.menus);this.element.toggleClass("ui-menu-icons",!!this.element.find(".ui-icon").length),a.filter(":not(.ui-menu)").addClass("ui-menu ui-widget ui-widget-content ui-front").hide.attr({role:this.options.role,"aria-hidden":"true","aria-expanded":"false"}).each(function{var t=e(this),i=t.parent,s=e(" ").addClass("ui-menu-icon ui-icon "+n).data("ui-menu-submenu-carat",!0);i.attr("aria-haspopup","true").prepend(s),t.attr("aria-labelledby",i.attr("id"))}),t=a.add(this.element),i=t.find(this.options.items),i.not(".ui-menu-item").each(function{var t=e(this);s._isDivider(t)&&t.addClass("ui-widget-content ui-menu-divider")}),i.not(".ui-menu-item, .ui-menu-divider").addClass("ui-menu-item").uniqueId.attr({tabIndex:-1,role:this._itemRole}),i.filter(".ui-state-disabled").attr("aria-disabled","true"),this.active&&!e.contains(this.element[0],this.active[0])&&this.blur},_itemRole:function{return{menu:"menuitem",listbox:"option"}[this.options.role]},_setOption:function(e,t){"icons"===e&&this.element.find(".ui-menu-icon").removeClass(this.options.icons.submenu).addClass(t.submenu),"disabled"===e&&this.element.toggleClass("ui-state-disabled",!!t).attr("aria-disabled",t),this._super(e,t)},focus:function(e,t){var i,s;this.blur(e,e&&"focus"===e.type),this._scrollIntoView(t),this.active=t.first,s=this.active.addClass("ui-state-focus").removeClass("ui-state-active"),this.options.role&&this.element.attr("aria-activedescendant",s.attr("id")),this.active.parent.closest(".ui-menu-item").addClass("ui-state-active"),e&&"keydown"===e.type?this._close:this.timer=this._delay(function{this._close},this.delay),i=t.children(".ui-menu"),i.length&&e&&/^mouse/.test(e.type)&&this._startOpening(i),this.activeMenu=t.parent,this._trigger("focus",e,{item:t})},_scrollIntoView:function(t){var i,s,n,a,o,r;this._hasScroll&&(i=parseFloat(e.css(this.activeMenu[0],"borderTopWidth"))||0,s=parseFloat(e.css(this.activeMenu[0],"paddingTop"))||0,n=t.offset.top-this.activeMenu.offset.top-i-s,a=this.activeMenu.scrollTop,o=this.activeMenu.height,r=t.outerHeight,0>n?this.activeMenu.scrollTop(a+n):n+r>o&&this.activeMenu.scrollTop(a+n-o+r))},blur:function(e,t){t||clearTimeout(this.timer),this.active&&(this.active.removeClass("ui-state-focus"),this.active=null,this._trigger("blur",e,{item:this.active}))},_startOpening:function(e){clearTimeout(this.timer),"true"===e.attr("aria-hidden")&&(this.timer=this._delay(function{this._close,this._open(e)},this.delay))},_open:function(t){var i=e.extend({of:this.active},this.options.position);clearTimeout(this.timer),this.element.find(".ui-menu").not(t.parents(".ui-menu")).hide.attr("aria-hidden","true"),t.show.removeAttr("aria-hidden").attr("aria-expanded","true").position(i)},collapseAll:function(t,i){clearTimeout(this.timer),this.timer=this._delay(function{var s=i?this.element:e(t&&t.target).closest(this.element.find(".ui-menu"));s.length||(s=this.element),this._close(s),this.blur(t),this.activeMenu=s},this.delay)},_close:function(e){e||(e=this.active?this.active.parent:this.element),e.find(".ui-menu").hide.attr("aria-hidden","true").attr("aria-expanded","false").end.find(".ui-state-active").not(".ui-state-focus").removeClass("ui-state-active")},_closeOnDocumentClick:function(t){return!e(t.target).closest(".ui-menu").length},_isDivider:function(e){return!/[^\-\u2014\u2013\s]/.test(e.text)},collapse:function(e){var t=this.active&&this.active.parent.closest(".ui-menu-item",this.element);t&&t.length&&(this._close,this.focus(e,t))},expand:function(e){var t=this.active&&this.active.children(".ui-menu ").find(this.options.items).first;t&&t.length&&(this._open(t.parent),this._delay(function{this.focus(e,t)}))},next:function(e){this._move("next","first",e)},previous:function(e){this._move("prev","last",e)},isFirstItem:function{return this.active&&!this.active.prevAll(".ui-menu-item").length},isLastItem:function{return this.active&&!this.active.nextAll(".ui-menu-item").length},_move:function(e,t,i){var s;this.active&&(s="first"===e||"last"===e?this.active["first"===e?"prevAll":"nextAll"](".ui-menu-item").eq(-1):this.active[e+"All"](".ui-menu-item").eq(0)),s&&s.length&&this.active||(s=this.activeMenu.find(this.options.items)[t]),this.focus(i,s)},nextPage:function(t){var i,s,n;return this.active?(this.isLastItem||(this._hasScroll?(s=this.active.offset.top,n=this.element.height,this.active.nextAll(".ui-menu-item").each(function{return i=e(this),0>i.offset.top-s-n}),this.focus(t,i)):this.focus(t,this.activeMenu.find(this.options.items)[this.active?"last":"first"])),void 0):(this.next(t),void 0)},previousPage:function(t){var i,s,n;return this.active?(this.isFirstItem||(this._hasScroll?(s=this.active.offset.top,n=this.element.height,this.active.prevAll(".ui-menu-item").each(function{return i=e(this),i.offset.top-s+n>0}),this.focus(t,i)):this.focus(t,this.activeMenu.find(this.options.items).first)),void 0):(this.next(t),void 0)},_hasScroll:function{return this.element.outerHeight<this.element.prop("scrollHeight")},select:function(t){this.active=this.active||e(t.target).closest(".ui-menu-item");var i={item:this.active};this.active.has(".ui-menu").length||this.collapseAll(t,!0),this._trigger("select",t,i)},_filterMenuItems:function(t){var i=t.replace(/[\-\[\]{}*+?.,\\\^$|#\s]/g,"\\$&"),s=RegExp("^"+i,"i");return this.activeMenu.find(this.options.items).filter(".ui-menu-item").filter(function{return s.test(e.trim(e(this).text))})}}),e.widget("ui.autocomplete",{version:"1.11.4",defaultElement:" ",options:{appendTo:null,autoFocus:!1,delay:300,minLength:1,position:{my:"left top",at:"left bottom",collision:"none"},source:null,change:null,close:null,focus:null,open:null,response:null,search:null,select:null},requestIndex:0,pending:0,_create:function{var t,i,s,n=this.element[0].nodeName.toLowerCase,a="textarea"===n,o="input"===n;this.isMultiLine=a?!0:o?!1:this.element.prop("isContentEditable"),this.valueMethod=this.element[a||o?"val":"text"],this.isNewMenu=!0,this.element.addClass("ui-autocomplete-input").attr("autocomplete","off"),this._on(this.element,{keydown:function(n){if(this.element.prop("readOnly"))return t=!0,s=!0,i=!0,void 0;t=!1,s=!1,i=!1;var a=e.ui.keyCode;switch(n.keyCode){case a.PAGE_UP:t=!0,this._move("previousPage",n);break;case a.PAGE_DOWN:t=!0,this._move("nextPage",n);break;case a.UP:t=!0,this._keyEvent("previous",n);break;case a.DOWN:t=!0,this._keyEvent("next",n);break;case a.ENTER:this.menu.active&&(t=!0,n.preventDefault,this.menu.select(n));break;case a.TAB:this.menu.active&&this.menu.select(n);break;case a.ESCAPE:this.menu.element.is(":visible")&&(this.isMultiLine||this._value(this.term),this.close(n),n.preventDefault);break;default:i=!0,this._searchTimeout(n)}},keypress:function(s){if(t)return t=!1,(!this.isMultiLine||this.menu.element.is(":visible"))&&s.preventDefault,void 0;if(!i){var n=e.ui.keyCode;switch(s.keyCode){case n.PAGE_UP:this._move("previousPage",s);break;case n.PAGE_DOWN:this._move("nextPage",s);break;case n.UP:this._keyEvent("previous",s);break;case n.DOWN:this._keyEvent("next",s)}}},input:function(e){return s?(s=!1,e.preventDefault,void 0):(this._searchTimeout(e),void 0)},focus:function{this.selectedItem=null,this.previous=this._value},blur:function(e){return this.cancelBlur?(delete this.cancelBlur,void 0):(clearTimeout(this.searching),this.close(e),this._change(e),void 0)}}),this._initSource,this.menu=e("").addClass("ui-autocomplete ui-front").appendTo(this._appendTo).menu({role:null}).hide.menu("instance"),this._on(this.menu.element,{mousedown:function(t){t.preventDefault,this.cancelBlur=!0,this._delay(function{delete this.cancelBlur});var i=this.menu.element[0];e(t.target).closest(".ui-menu-item").length||this._delay(function{var t=this;this.document.one("mousedown",function(s){s.target===t.element[0]||s.target===i||e.contains(i,s.target)||t.close})})},menufocus:function(t,i){var s,n;return this.isNewMenu&&(this.isNewMenu=!1,t.originalEvent&&/^mouse/.test(t.originalEvent.type))?(this.menu.blur,this.document.one("mousemove",function{e(t.target).trigger(t.originalEvent)}),void 0):(n=i.item.data("ui-autocomplete-item"),!1!==this._trigger("focus",t,{item:n})&&t.originalEvent&&/^key/.test(t.originalEvent.type)&&this._value(n.value),s=i.item.attr("aria-label")||n.value,s&&e.trim(s).length&&(this.liveRegion.children.hide,e(" ").text(s).appendTo(this.liveRegion)),void 0)},menuselect:function(e,t){var i=t.item.data("ui-autocomplete-item"),s=this.previous;this.element[0]!==this.document[0].activeElement&&(this.element.focus,this.previous=s,this._delay(function{this.previous=s,this.selectedItem=i})),!1!==this._trigger("select",e,{item:i})&&this._value(i.value),this.term=this._value,this.close(e),this.selectedItem=i}}),this.liveRegion=e(" ",{role:"status","aria-live":"assertive","aria-relevant":"additions"}).addClass("ui-helper-hidden-accessible").appendTo(this.document[0].body),this._on(this.window,{beforeunload:function{this.element.removeAttr("autocomplete")}})},_destroy:function{clearTimeout(this.searching),this.element.removeClass("ui-autocomplete-input").removeAttr("autocomplete"),this.menu.element.remove,this.liveRegion.remove},_setOption:function(e,t){this._super(e,t),"source"===e&&this._initSource,"appendTo"===e&&this.menu.element.appendTo(this._appendTo),"disabled"===e&&t&&this.xhr&&this.xhr.abort},_appendTo:function{var t=this.options.appendTo;return t&&(t=t.jquery||t.nodeType?e(t):this.document.find(t).eq(0)),t&&t[0]||(t=this.element.closest(".ui-front")),t.length||(t=this.document[0].body),t},_initSource:function{var t,i,s=this;e.isArray(this.options.source)?(t=this.options.source,this.source=function(i,s){s(e.ui.autocomplete.filter(t,i.term))}):"string"==typeof this.options.source?(i=this.options.source,this.source=function(t,n){s.xhr&&s.xhr.abort,s.xhr=e.ajax({url:i,data:t,dataType:"json",success:function(e){n(e)},error:function{n([])}})}):this.source=this.options.source},_searchTimeout:function(e){clearTimeout(this.searching),this.searching=this._delay(function{var t=this.term===this._value,i=this.menu.element.is(":visible"),s=e.altKey||e.ctrlKey||e.metaKey||e.shiftKey;(!t||t&&!i&&!s)&&(this.selectedItem=null,this.search(null,e))},this.options.delay)},search:function(e,t){return e=null!=e?e:this._value,this.term=this._value,e.length<this.options.minLength?this.close(t):this._trigger("search",t)!==!1?this._search(e):void 0},_search:function(e){this.pending++,this.element.addClass("ui-autocomplete-loading"),this.cancelSearch=!1,this.source({term:e},this._response)},_response:function{var t=++this.requestIndex;return e.proxy(function(e){t===this.requestIndex&&this.__response(e),this.pending--,this.pending||this.element.removeClass("ui-autocomplete-loading")},this)},__response:function(e){e&&(e=this._normalize(e)),this._trigger("response",null,{content:e}),!this.options.disabled&&e&&e.length&&!this.cancelSearch?(this._suggest(e),this._trigger("open")):this._close},close:function(e){this.cancelSearch=!0,this._close(e)},_close:function(e){this.menu.element.is(":visible")&&(this.menu.element.hide,this.menu.blur,this.isNewMenu=!0,this._trigger("close",e))},_change:function(e){this.previous!==this._value&&this._trigger("change",e,{item:this.selectedItem})},_normalize:function(t){return t.length&&t[0].label&&t[0].value?t:e.map(t,function(t){return"string"==typeof t?{label:t,value:t}:e.extend({},t,{label:t.label||t.value,value:t.value||t.label})})},_suggest:function(t){var i=this.menu.element.empty;this._renderMenu(i,t),this.isNewMenu=!0,this.menu.refresh,i.show,this._resizeMenu,i.position(e.extend({of:this.element},this.options.position)),this.options.autoFocus&&this.menu.next},_resizeMenu:function{var e=this.menu.element;e.outerWidth(Math.max(e.width("").outerWidth+1,this.element.outerWidth))},_renderMenu:function(t,i){var s=this;e.each(i,function(e,i){s._renderItemData(t,i)})},_renderItemData:function(e,t){return this._renderItem(e,t).data("ui-autocomplete-item",t)},_renderItem:function(t,i){return e("").text(i.label).appendTo(t)},_move:function(e,t){return this.menu.element.is(":visible")?this.menu.isFirstItem&&/^previous/.test(e)||this.menu.isLastItem&&/^next/.test(e)?(this.isMultiLine||this._value(this.term),this.menu.blur,void 0):(this.menu[e](t),void 0):(this.search(null,t),void 0)},widget:function{return this.menu.element},_value:function{return this.valueMethod.apply(this.element,arguments)},_keyEvent:function(e,t){(!this.isMultiLine||this.menu.element.is(":visible"))&&(this._move(e,t),t.preventDefault)}}),e.extend(e.ui.autocomplete,{escapeRegex:function(e){return e.replace(/[\-\[\]{}*+?.,\\\^$|#\s]/g,"\\$&")},filter:function(t,i){var s=RegExp(e.ui.autocomplete.escapeRegex(i),"i");return e.grep(t,function(e){return s.test(e.label||e.value||e)})}}),e.widget("ui.autocomplete",e.ui.autocomplete,{options:{messages:{noResults:"No search results.",results:function(e){return e+(e>1?" results are":" result is")+" available, use up and down arrow keys to navigate."}}},__response:function(t){var i;this._superApply(arguments),this.options.disabled||this.cancelSearch||(i=t&&t.length?this.options.messages.results(t.length):this.options.messages.noResults,this.liveRegion.children.hide,e(" ").text(i).appendTo(this.liveRegion))}}),e.ui.autocomplete;var c,p="ui-button ui-widget ui-state-default ui-corner-all",f="ui-button-icons-only ui-button-icon-only ui-button-text-icons ui-button-text-icon-primary ui-button-text-icon-secondary ui-button-text-only",m=function{var t=e(this);setTimeout(function{t.find(":ui-button").button("refresh")},1)},g=function(t){var i=t.name,s=t.form,n=e([]);return i&&(i=i.replace(/'/g,"\\'"),n=s?e(s).find("[name='"+i+"'][type=radio]"):e("[name='"+i+"'][type=radio]",t.ownerDocument).filter(function{return!this.form})),n};e.widget("ui.button",{version:"1.11.4",defaultElement:" ",options:{disabled:null,text:!0,label:null,icons:{primary:null,secondary:null}},_create:function{this.element.closest("form").unbind("reset"+this.eventNamespace).bind("reset"+this.eventNamespace,m),"boolean"!=typeof this.options.disabled?this.options.disabled=!!this.element.prop("disabled"):this.element.prop("disabled",this.options.disabled),this._determineButtonType,this.hasTitle=!!this.buttonElement.attr("title");var t=this,i=this.options,s="checkbox"===this.type||"radio"===this.type,n=s?"":"ui-state-active";null===i.label&&(i.label="input"===this.type?this.buttonElement.val:this.buttonElement.html),this._hoverable(this.buttonElement),this.buttonElement.addClass(p).attr("role","button").bind("mouseenter"+this.eventNamespace,function{i.disabled||this===c&&e(this).addClass("ui-state-active")}).bind("mouseleave"+this.eventNamespace,function{i.disabled||e(this).removeClass(n)}).bind("click"+this.eventNamespace,function(e){i.disabled&&(e.preventDefault,e.stopImmediatePropagation)}),this._on({focus:function{this.buttonElement.addClass("ui-state-focus")},blur:function{this.buttonElement.removeClass("ui-state-focus")}}),s&&this.element.bind("change"+this.eventNamespace,function{t.refresh}),"checkbox"===this.type?this.buttonElement.bind("click"+this.eventNamespace,function{return i.disabled?!1:void 0}):"radio"===this.type?this.buttonElement.bind("click"+this.eventNamespace,function{if(i.disabled)return!1;e(this).addClass("ui-state-active"),t.buttonElement.attr("aria-pressed","true");var s=t.element[0];g(s).not(s).map(function{return e(this).button("widget")[0]}).removeClass("ui-state-active").attr("aria-pressed","false")}):(this.buttonElement.bind("mousedown"+this.eventNamespace,function{return i.disabled?!1:(e(this).addClass("ui-state-active"),c=this,t.document.one("mouseup",function{c=null}),void 0)}).bind("mouseup"+this.eventNamespace,function{return i.disabled?!1:(e(this).removeClass("ui-state-active"),void 0)}).bind("keydown"+this.eventNamespace,function(t){return i.disabled?!1:((t.keyCode===e.ui.keyCode.SPACE||t.keyCode===e.ui.keyCode.ENTER)&&e(this).addClass("ui-state-active"),void 0)}).bind("keyup"+this.eventNamespace+" blur"+this.eventNamespace,function{e(this).removeClass("ui-state-active")}),this.buttonElement.is("a")&&this.buttonElement.keyup(function(t){t.keyCode===e.ui.keyCode.SPACE&&e(this).click})),this._setOption("disabled",i.disabled),this._resetButton},_determineButtonType:function{var e,t,i;this.type=this.element.is("[type=checkbox]")?"checkbox":this.element.is("[type=radio]")?"radio":this.element.is("input")?"input":"button","checkbox"===this.type||"radio"===this.type?(e=this.element.parents.last,t="label[for='"+this.element.attr("id")+"']",this.buttonElement=e.find(t),this.buttonElement.length||(e=e.length?e.siblings:this.element.siblings,this.buttonElement=e.filter(t),this.buttonElement.length||(this.buttonElement=e.find(t))),this.element.addClass("ui-helper-hidden-accessible"),i=this.element.is(":checked"),i&&this.buttonElement.addClass("ui-state-active"),this.buttonElement.prop("aria-pressed",i)):this.buttonElement=this.element},widget:function{return this.buttonElement},_destroy:function{this.element.removeClass("ui-helper-hidden-accessible"),this.buttonElement.removeClass(p+" ui-state-active "+f).removeAttr("role").removeAttr("aria-pressed").html(this.buttonElement.find(".ui-button-text").html),this.hasTitle||this.buttonElement.removeAttr("title")},_setOption:function(e,t){return this._super(e,t),"disabled"===e?(this.widget.toggleClass("ui-state-disabled",!!t),this.element.prop("disabled",!!t),t&&("checkbox"===this.type||"radio"===this.type?this.buttonElement.removeClass("ui-state-focus"):this.buttonElement.removeClass("ui-state-focus ui-state-active")),void 0):(this._resetButton,void 0)},refresh:function{var t=this.element.is("input, button")?this.element.is(":disabled"):this.element.hasClass("ui-button-disabled");t!==this.options.disabled&&this._setOption("disabled",t),"radio"===this.type?g(this.element[0]).each(function{e(this).is(":checked")?e(this).button("widget").addClass("ui-state-active").attr("aria-pressed","true"):e(this).button("widget").removeClass("ui-state-active").attr("aria-pressed","false")}):"checkbox"===this.type&&(this.element.is(":checked")?this.buttonElement.addClass("ui-state-active").attr("aria-pressed","true"):this.buttonElement.removeClass("ui-state-active").attr("aria-pressed","false"))},_resetButton:function{if("input"===this.type)return this.options.label&&this.element.val(this.options.label),void 0;var t=this.buttonElement.removeClass(f),i=e(" ",this.document[0]).addClass("ui-button-text").html(this.options.label).appendTo(t.empty).text,s=this.options.icons,n=s.primary&&s.secondary,a=[];s.primary||s.secondary?(this.options.text&&a.push("ui-button-text-icon"+(n?"s":s.primary?"-primary":"-secondary")),s.primary&&t.prepend(" "),s.secondary&&t.append(" "),this.options.text||(a.push(n?"ui-button-icons-only":"ui-button-icon-only"),this.hasTitle||t.attr("title",e.trim(i)))):a.push("ui-button-text-only"),t.addClass(a.join(" "))}}),e.widget("ui.buttonset",{version:"1.11.4",options:{items:"button, input[type=button], input[type=submit], input[type=reset], input[type=checkbox], input[type=radio], a, :data(ui-button)"},_create:function{this.element.addClass("ui-buttonset")},_init:function{this.refresh},_setOption:function(e,t){"disabled"===e&&this.buttons.button("option",e,t),this._super(e,t)},refresh:function{var t="rtl"===this.element.css("direction"),i=this.element.find(this.options.items),s=i.filter(":ui-button");i.not(":ui-button").button,s.button("refresh"),this.buttons=i.map(function{return e(this).button("widget")[0]}).removeClass("ui-corner-all ui-corner-left ui-corner-right").filter(":first").addClass(t?"ui-corner-right":"ui-corner-left").end.filter(":last").addClass(t?"ui-corner-left":"ui-corner-right").end.end},_destroy:function{this.element.removeClass("ui-buttonset"),this.buttons.map(function{return e(this).button("widget")[0]}).removeClass("ui-corner-left ui-corner-right").end.button("destroy")}}),e.ui.button,e.extend(e.ui,{datepicker:{version:"1.11.4"}});var v;e.extend(n.prototype,{markerClassName:"hasDatepicker",maxRows:4,_widgetDatepicker:function{return this.dpDiv},setDefaults:function(e){return r(this._defaults,e||{}),this},_attachDatepicker:function(t,i){var s,n,a;s=t.nodeName.toLowerCase,n="div"===s||"span"===s,t.id||(this.uuid+=1,t.id="dp"+this.uuid),a=this._newInst(e(t),n),a.settings=e.extend({},i||{}),"input"===s?this._connectDatepicker(t,a):n&&this._inlineDatepicker(t,a)},_newInst:function(t,i){var s=t[0].id.replace(/([^A-Za-z0-9_\-])/g,"\\\\$1");return{id:s,input:t,selectedDay:0,selectedMonth:0,selectedYear:0,drawMonth:0,drawYear:0,inline:i,dpDiv:i?a(e(" ")):this.dpDiv}},_connectDatepicker:function(t,i){var s=e(t);i.append=e([]),i.trigger=e([]),s.hasClass(this.markerClassName)||(this._attachments(s,i),s.addClass(this.markerClassName).keydown(this._doKeyDown).keypress(this._doKeyPress).keyup(this._doKeyUp),this._autoSize(i),e.data(t,"datepicker",i),i.settings.disabled&&this._disableDatepicker(t))},_attachments:function(t,i){var s,n,a,o=this._get(i,"appendText"),r=this._get(i,"isRTL");i.append&&i.append.remove,o&&(i.append=e(""+o+" "),t[r?"before":"after"](i.append)),t.unbind("focus",this._showDatepicker),i.trigger&&i.trigger.remove,s=this._get(i,"showOn"),("focus"===s||"both"===s)&&t.focus(this._showDatepicker),("button"===s||"both"===s)&&(n=this._get(i,"buttonText"),a=this._get(i,"buttonImage"),i.trigger=e(this._get(i,"buttonImageOnly")?e(" ").addClass(this._triggerClass).attr({src:a,alt:n,title:n}):e(" ").addClass(this._triggerClass).html(a?e(" ").attr({src:a,alt:n,title:n}):n)),t[r?"before":"after"](i.trigger),i.trigger.click(function{return e.datepicker._datepickerShowing&&e.datepicker._lastInput===t[0]?e.datepicker._hideDatepicker:e.datepicker._datepickerShowing&&e.datepicker._lastInput!==t[0]?(e.datepicker._hideDatepicker,e.datepicker._showDatepicker(t[0])):e.datepicker._showDatepicker(t[0]),!1}))},_autoSize:function(e){if(this._get(e,"autoSize")&&!e.inline){var t,i,s,n,a=new Date(2009,11,20),o=this._get(e,"dateFormat");o.match(/[DM]/)&&(t=function(e){for(i=0,s=0,n=0;e.length>n;n++)e[n].length>i&&(i=e[n].length,s=n);return s},a.setMonth(t(this._get(e,o.match(/MM/)?"monthNames":"monthNamesShort"))),a.setDate(t(this._get(e,o.match(/DD/)?"dayNames":"dayNamesShort"))+20-a.getDay)),e.input.attr("size",this._formatDate(e,a).length)}},_inlineDatepicker:function(t,i){var s=e(t);s.hasClass(this.markerClassName)||(s.addClass(this.markerClassName).append(i.dpDiv),e.data(t,"datepicker",i),this._setDate(i,this._getDefaultDate(i),!0),this._updateDatepicker(i),this._updateAlternate(i),i.settings.disabled&&this._disableDatepicker(t),i.dpDiv.css("display","block"))},_dialogDatepicker:function(t,i,s,n,a){var o,h,l,u,d,c=this._dialogInst;return c||(this.uuid+=1,o="dp"+this.uuid,this._dialogInput=e(""),this._dialogInput.keydown(this._doKeyDown),e("body").append(this._dialogInput),c=this._dialogInst=this._newInst(this._dialogInput,!1),c.settings={},e.data(this._dialogInput[0],"datepicker",c)),r(c.settings,n||{}),i=i&&i.constructor===Date?this._formatDate(c,i):i,this._dialogInput.val(i),this._pos=a?a.length?a:[a.pageX,a.pageY]:null,this._pos||(h=document.documentElement.clientWidth,l=document.documentElement.clientHeight,u=document.documentElement.scrollLeft||document.body.scrollLeft,d=document.documentElement.scrollTop||document.body.scrollTop,this._pos=[h/2-100+u,l/2-150+d]),this._dialogInput.css("left",this._pos[0]+20+"px").css("top",this._pos[1]+"px"),c.settings.onSelect=s,this._inDialog=!0,this.dpDiv.addClass(this._dialogClass),this._showDatepicker(this._dialogInput[0]),e.blockUI&&e.blockUI(this.dpDiv),e.data(this._dialogInput[0],"datepicker",c),this},_destroyDatepicker:function(t){var i,s=e(t),n=e.data(t,"datepicker");s.hasClass(this.markerClassName)&&(i=t.nodeName.toLowerCase,e.removeData(t,"datepicker"),"input"===i?(n.append.remove,n.trigger.remove,s.removeClass(this.markerClassName).unbind("focus",this._showDatepicker).unbind("keydown",this._doKeyDown).unbind("keypress",this._doKeyPress).unbind("keyup",this._doKeyUp)):("div"===i||"span"===i)&&s.removeClass(this.markerClassName).empty,v===n&&(v=null))},_enableDatepicker:function(t){var i,s,n=e(t),a=e.data(t,"datepicker");n.hasClass(this.markerClassName)&&(i=t.nodeName.toLowerCase,"input"===i?(t.disabled=!1,a.trigger.filter("button").each(function{this.disabled=!1}).end.filter("img").css({opacity:"1.0",cursor:""})):("div"===i||"span"===i)&&(s=n.children("."+this._inlineClass),s.children.removeClass("ui-state-disabled"),s.find("select.ui-datepicker-month, select.ui-datepicker-year").prop("disabled",!1)),this._disabledInputs=e.map(this._disabledInputs,function(e){return e===t?null:e}))},_disableDatepicker:function(t){var i,s,n=e(t),a=e.data(t,"datepicker");n.hasClass(this.markerClassName)&&(i=t.nodeName.toLowerCase,"input"===i?(t.disabled=!0,a.trigger.filter("button").each(function{this.disabled=!0}).end.filter("img").css({opacity:"0.5",cursor:"default"})):("div"===i||"span"===i)&&(s=n.children("."+this._inlineClass),s.children.addClass("ui-state-disabled"),s.find("select.ui-datepicker-month, select.ui-datepicker-year").prop("disabled",!0)),this._disabledInputs=e.map(this._disabledInputs,function(e){return e===t?null:e}),this._disabledInputs[this._disabledInputs.length]=t)},_isDisabledDatepicker:function(e){if(!e)return!1;for(var t=0;this._disabledInputs.length>t;t++)if(this._disabledInputs[t]===e)return!0;return!1},_getInst:function(t){try{return e.data(t,"datepicker")}catch(i){throw"Missing instance data for this datepicker"}},_optionDatepicker:function(t,i,s){var n,a,o,h,l=this._getInst(t);return 2===arguments.length&&"string"==typeof i?"defaults"===i?e.extend({},e.datepicker._defaults):l?"all"===i?e.extend({},l.settings):this._get(l,i):null:(n=i||{},"string"==typeof i&&(n={},n[i]=s),l&&(this._curInst===l&&this._hideDatepicker,a=this._getDateDatepicker(t,!0),o=this._getMinMaxDate(l,"min"),h=this._getMinMaxDate(l,"max"),r(l.settings,n),null!==o&&void 0!==n.dateFormat&&void 0===n.minDate&&(l.settings.minDate=this._formatDate(l,o)),null!==h&&void 0!==n.dateFormat&&void 0===n.maxDate&&(l.settings.maxDate=this._formatDate(l,h)),"disabled"in n&&(n.disabled?this._disableDatepicker(t):this._enableDatepicker(t)),this._attachments(e(t),l),this._autoSize(l),this._setDate(l,a),this._updateAlternate(l),this._updateDatepicker(l)),void 0)},_changeDatepicker:function(e,t,i){this._optionDatepicker(e,t,i)},_refreshDatepicker:function(e){var t=this._getInst(e);t&&this._updateDatepicker(t)},_setDateDatepicker:function(e,t){var i=this._getInst(e);i&&(this._setDate(i,t),this._updateDatepicker(i),this._updateAlternate(i))},_getDateDatepicker:function(e,t){var i=this._getInst(e);return i&&!i.inline&&this._setDateFromField(i,t),i?this._getDate(i):null},_doKeyDown:function(t){var i,s,n,a=e.datepicker._getInst(t.target),o=!0,r=a.dpDiv.is(".ui-datepicker-rtl");if(a._keyEvent=!0,e.datepicker._datepickerShowing)switch(t.keyCode){case 9:e.datepicker._hideDatepicker,o=!1;break;case 13:return n=e("td."+e.datepicker._dayOverClass+":not(."+e.datepicker._currentClass+")",a.dpDiv),n[0]&&e.datepicker._selectDay(t.target,a.selectedMonth,a.selectedYear,n[0]),i=e.datepicker._get(a,"onSelect"),i?(s=e.datepicker._formatDate(a),i.apply(a.input?a.input[0]:null,[s,a])):e.datepicker._hideDatepicker,!1;case 27:e.datepicker._hideDatepicker;break;case 33:e.datepicker._adjustDate(t.target,t.ctrlKey?-e.datepicker._get(a,"stepBigMonths"):-e.datepicker._get(a,"stepMonths"),"M");break;case 34:e.datepicker._adjustDate(t.target,t.ctrlKey?+e.datepicker._get(a,"stepBigMonths"):+e.datepicker._get(a,"stepMonths"),"M");break;case 35:(t.ctrlKey||t.metaKey)&&e.datepicker._clearDate(t.target),o=t.ctrlKey||t.metaKey;break;case 36:(t.ctrlKey||t.metaKey)&&e.datepicker._gotoToday(t.target),o=t.ctrlKey||t.metaKey;break;case 37:(t.ctrlKey||t.metaKey)&&e.datepicker._adjustDate(t.target,r?1:-1,"D"),o=t.ctrlKey||t.metaKey,t.originalEvent.altKey&&e.datepicker._adjustDate(t.target,t.ctrlKey?-e.datepicker._get(a,"stepBigMonths"):-e.datepicker._get(a,"stepMonths"),"M");break;case 38:(t.ctrlKey||t.metaKey)&&e.datepicker._adjustDate(t.target,-7,"D"),o=t.ctrlKey||t.metaKey;break;case 39:(t.ctrlKey||t.metaKey)&&e.datepicker._adjustDate(t.target,r?-1:1,"D"),o=t.ctrlKey||t.metaKey,t.originalEvent.altKey&&e.datepicker._adjustDate(t.target,t.ctrlKey?+e.datepicker._get(a,"stepBigMonths"):+e.datepicker._get(a,"stepMonths"),"M");break;case 40:(t.ctrlKey||t.metaKey)&&e.datepicker._adjustDate(t.target,7,"D"),o=t.ctrlKey||t.metaKey;break;default:o=!1}else 36===t.keyCode&&t.ctrlKey?e.datepicker._showDatepicker(this):o=!1;o&&(t.preventDefault,t.stopPropagation)},_doKeyPress:function(t){var i,s,n=e.datepicker._getInst(t.target); return e.datepicker._get(n,"constrainInput")?(i=e.datepicker._possibleChars(e.datepicker._get(n,"dateFormat")),s=String.fromCharCode(null==t.charCode?t.keyCode:t.charCode),t.ctrlKey||t.metaKey||" ">s||!i||i.indexOf(s)>-1):void 0},_doKeyUp:function(t){var i,s=e.datepicker._getInst(t.target);if(s.input.val!==s.lastVal)try{i=e.datepicker.parseDate(e.datepicker._get(s,"dateFormat"),s.input?s.input.val:null,e.datepicker._getFormatConfig(s)),i&&(e.datepicker._setDateFromField(s),e.datepicker._updateAlternate(s),e.datepicker._updateDatepicker(s))}catch(n){}return!0},_showDatepicker:function(t){if(t=t.target||t,"input"!==t.nodeName.toLowerCase&&(t=e("input",t.parentNode)[0]),!e.datepicker._isDisabledDatepicker(t)&&e.datepicker._lastInput!==t){var i,n,a,o,h,l,u;i=e.datepicker._getInst(t),e.datepicker._curInst&&e.datepicker._curInst!==i&&(e.datepicker._curInst.dpDiv.stop(!0,!0),i&&e.datepicker._datepickerShowing&&e.datepicker._hideDatepicker(e.datepicker._curInst.input[0])),n=e.datepicker._get(i,"beforeShow"),a=n?n.apply(t,[t,i]):{},a!==!1&&(r(i.settings,a),i.lastVal=null,e.datepicker._lastInput=t,e.datepicker._setDateFromField(i),e.datepicker._inDialog&&(t.value=""),e.datepicker._pos||(e.datepicker._pos=e.datepicker._findPos(t),e.datepicker._pos[1]+=t.offsetHeight),o=!1,e(t).parents.each(function{return o|="fixed"===e(this).css("position"),!o}),h={left:e.datepicker._pos[0],top:e.datepicker._pos[1]},e.datepicker._pos=null,i.dpDiv.empty,i.dpDiv.css({position:"absolute",display:"block",top:"-1000px"}),e.datepicker._updateDatepicker(i),h=e.datepicker._checkOffset(i,h,o),i.dpDiv.css({position:e.datepicker._inDialog&&e.blockUI?"static":o?"fixed":"absolute",display:"none",left:h.left+"px",top:h.top+"px"}),i.inline||(l=e.datepicker._get(i,"showAnim"),u=e.datepicker._get(i,"duration"),i.dpDiv.css("z-index",s(e(t))+1),e.datepicker._datepickerShowing=!0,e.effects&&e.effects.effect[l]?i.dpDiv.show(l,e.datepicker._get(i,"showOptions"),u):i.dpDiv[l||"show"](l?u:null),e.datepicker._shouldFocusInput(i)&&i.input.focus,e.datepicker._curInst=i))}},_updateDatepicker:function(t){this.maxRows=4,v=t,t.dpDiv.empty.append(this._generateHTML(t)),this._attachHandlers(t);var i,s=this._getNumberOfMonths(t),n=s[1],a=17,r=t.dpDiv.find("."+this._dayOverClass+" a");r.length>0&&o.apply(r.get(0)),t.dpDiv.removeClass("ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4").width(""),n>1&&t.dpDiv.addClass("ui-datepicker-multi-"+n).css("width",a*n+"em"),t.dpDiv[(1!==s[0]||1!==s[1]?"add":"remove")+"Class"]("ui-datepicker-multi"),t.dpDiv[(this._get(t,"isRTL")?"add":"remove")+"Class"]("ui-datepicker-rtl"),t===e.datepicker._curInst&&e.datepicker._datepickerShowing&&e.datepicker._shouldFocusInput(t)&&t.input.focus,t.yearshtml&&(i=t.yearshtml,setTimeout(function{i===t.yearshtml&&t.yearshtml&&t.dpDiv.find("select.ui-datepicker-year:first").replaceWith(t.yearshtml),i=t.yearshtml=null},0))},_shouldFocusInput:function(e){return e.input&&e.input.is(":visible")&&!e.input.is(":disabled")&&!e.input.is(":focus")},_checkOffset:function(t,i,s){var n=t.dpDiv.outerWidth,a=t.dpDiv.outerHeight,o=t.input?t.input.outerWidth:0,r=t.input?t.input.outerHeight:0,h=document.documentElement.clientWidth+(s?0:e(document).scrollLeft),l=document.documentElement.clientHeight+(s?0:e(document).scrollTop);return i.left-=this._get(t,"isRTL")?n-o:0,i.left-=s&&i.left===t.input.offset.left?e(document).scrollLeft:0,i.top-=s&&i.top===t.input.offset.top+r?e(document).scrollTop:0,i.left-=Math.min(i.left,i.left+n>h&&h>n?Math.abs(i.left+n-h):0),i.top-=Math.min(i.top,i.top+a>l&&l>a?Math.abs(a+r):0),i},_findPos:function(t){for(var i,s=this._getInst(t),n=this._get(s,"isRTL");t&&("hidden"===t.type||1!==t.nodeType||e.expr.filters.hidden(t));)t=t[n?"previousSibling":"nextSibling"];return i=e(t).offset,[i.left,i.top]},_hideDatepicker:function(t){var i,s,n,a,o=this._curInst;!o||t&&o!==e.data(t,"datepicker")||this._datepickerShowing&&(i=this._get(o,"showAnim"),s=this._get(o,"duration"),n=function{e.datepicker._tidyDialog(o)},e.effects&&(e.effects.effect[i]||e.effects[i])?o.dpDiv.hide(i,e.datepicker._get(o,"showOptions"),s,n):o.dpDiv["slideDown"===i?"slideUp":"fadeIn"===i?"fadeOut":"hide"](i?s:null,n),i||n,this._datepickerShowing=!1,a=this._get(o,"onClose"),a&&a.apply(o.input?o.input[0]:null,[o.input?o.input.val:"",o]),this._lastInput=null,this._inDialog&&(this._dialogInput.css({position:"absolute",left:"0",top:"-100px"}),e.blockUI&&(e.unblockUI,e("body").append(this.dpDiv))),this._inDialog=!1)},_tidyDialog:function(e){e.dpDiv.removeClass(this._dialogClass).unbind(".ui-datepicker-calendar")},_checkExternalClick:function(t){if(e.datepicker._curInst){var i=e(t.target),s=e.datepicker._getInst(i[0]);(i[0].id!==e.datepicker._mainDivId&&0===i.parents("#"+e.datepicker._mainDivId).length&&!i.hasClass(e.datepicker.markerClassName)&&!i.closest("."+e.datepicker._triggerClass).length&&e.datepicker._datepickerShowing&&(!e.datepicker._inDialog||!e.blockUI)||i.hasClass(e.datepicker.markerClassName)&&e.datepicker._curInst!==s)&&e.datepicker._hideDatepicker}},_adjustDate:function(t,i,s){var n=e(t),a=this._getInst(n[0]);this._isDisabledDatepicker(n[0])||(this._adjustInstDate(a,i+("M"===s?this._get(a,"showCurrentAtPos"):0),s),this._updateDatepicker(a))},_gotoToday:function(t){var i,s=e(t),n=this._getInst(s[0]);this._get(n,"gotoCurrent")&&n.currentDay?(n.selectedDay=n.currentDay,n.drawMonth=n.selectedMonth=n.currentMonth,n.drawYear=n.selectedYear=n.currentYear):(i=new Date,n.selectedDay=i.getDate,n.drawMonth=n.selectedMonth=i.getMonth,n.drawYear=n.selectedYear=i.getFullYear),this._notifyChange(n),this._adjustDate(s)},_selectMonthYear:function(t,i,s){var n=e(t),a=this._getInst(n[0]);a["selected"+("M"===s?"Month":"Year")]=a["draw"+("M"===s?"Month":"Year")]=parseInt(i.options[i.selectedIndex].value,10),this._notifyChange(a),this._adjustDate(n)},_selectDay:function(t,i,s,n){var a,o=e(t);e(n).hasClass(this._unselectableClass)||this._isDisabledDatepicker(o[0])||(a=this._getInst(o[0]),a.selectedDay=a.currentDay=e("a",n).html,a.selectedMonth=a.currentMonth=i,a.selectedYear=a.currentYear=s,this._selectDate(t,this._formatDate(a,a.currentDay,a.currentMonth,a.currentYear)))},_clearDate:function(t){var i=e(t);this._selectDate(i,"")},_selectDate:function(t,i){var s,n=e(t),a=this._getInst(n[0]);i=null!=i?i:this._formatDate(a),a.input&&a.input.val(i),this._updateAlternate(a),s=this._get(a,"onSelect"),s?s.apply(a.input?a.input[0]:null,[i,a]):a.input&&a.input.trigger("change"),a.inline?this._updateDatepicker(a):(this._hideDatepicker,this._lastInput=a.input[0],"object"!=typeof a.input[0]&&a.input.focus,this._lastInput=null)},_updateAlternate:function(t){var i,s,n,a=this._get(t,"altField");a&&(i=this._get(t,"altFormat")||this._get(t,"dateFormat"),s=this._getDate(t),n=this.formatDate(i,s,this._getFormatConfig(t)),e(a).each(function{e(this).val(n)}))},noWeekends:function(e){var t=e.getDay;return[t>0&&6>t,""]},iso8601Week:function(e){var t,i=new Date(e.getTime);return i.setDate(i.getDate+4-(i.getDay||7)),t=i.getTime,i.setMonth(0),i.setDate(1),Math.floor(Math.round((t-i)/864e5)/7)+1},parseDate:function(t,i,s){if(null==t||null==i)throw"Invalid arguments";if(i="object"==typeof i?""+i:i+"",""===i)return null;var n,a,o,r,h=0,l=(s?s.shortYearCutoff:null)||this._defaults.shortYearCutoff,u="string"!=typeof l?l:(new Date).getFullYear%100+parseInt(l,10),d=(s?s.dayNamesShort:null)||this._defaults.dayNamesShort,c=(s?s.dayNames:null)||this._defaults.dayNames,p=(s?s.monthNamesShort:null)||this._defaults.monthNamesShort,f=(s?s.monthNames:null)||this._defaults.monthNames,m=-1,g=-1,v=-1,y=-1,b=!1,_=function(e){var i=t.length>n+1&&t.charAt(n+1)===e;return i&&n++,i},x=function(e){var t=_(e),s="@"===e?14:"!"===e?20:"y"===e&&t?4:"o"===e?3:2,n="y"===e?s:1,a=RegExp("^\\d{"+n+","+s+"}"),o=i.substring(h).match(a);if(!o)throw"Missing number at position "+h;return h+=o[0].length,parseInt(o[0],10)},w=function(t,s,n){var a=-1,o=e.map(_(t)?n:s,function(e,t){returnt,e}).sort(function(e,t){return-(e[1].length-t[1].length)});if(e.each(o,function(e,t){var s=t[1];return i.substr(h,s.length).toLowerCase===s.toLowerCase?(a=t[0],h+=s.length,!1):void 0}),-1!==a)return a+1;throw"Unknown name at position "+h},k=function{if(i.charAt(h)!==t.charAt(n))throw"Unexpected literal at position "+h;h++};for(n=0;t.length>n;n++)if(b)"'"!==t.charAt(n)||_("'")?k:b=!1;else switch(t.charAt(n)){case"d":v=x("d");break;case"D":w("D",d,c);break;case"o":y=x("o");break;case"m":g=x("m");break;case"M":g=w("M",p,f);break;case"y":m=x("y");break;case"@":r=new Date(x("@")),m=r.getFullYear,g=r.getMonth+1,v=r.getDate;break;case"!":r=new Date((x("!")-this._ticksTo1970)/1e4),m=r.getFullYear,g=r.getMonth+1,v=r.getDate;break;case"'":_("'")?k:b=!0;break;default:k}if(i.length>h&&(o=i.substr(h),!/^\s+/.test(o)))throw"Extra/unparsed characters found in date: "+o;if(-1===m?m=(new Date).getFullYear:100>m&&(m+=(new Date).getFullYear-(new Date).getFullYear%100+(u>=m?0:-100)),y>-1)for(g=1,v=y;;){if(a=this._getDaysInMonth(m,g-1),a>=v)break;g++,v-=a}if(r=this._daylightSavingAdjust(new Date(m,g-1,v)),r.getFullYear!==m||r.getMonth+1!==g||r.getDate!==v)throw"Invalid date";return r},ATOM:"yy-mm-dd",COOKIE:"D, dd M yy",ISO_8601:"yy-mm-dd",RFC_822:"D, d M y",RFC_850:"DD, dd-M-y",RFC_1036:"D, d M y",RFC_1123:"D, d M yy",RFC_2822:"D, d M yy",RSS:"D, d M y",TICKS:"!",TIMESTAMP:"@",W3C:"yy-mm-dd",_ticksTo1970:1e7*60*60*24*(718685+Math.floor(492.5)-Math.floor(19.7)+Math.floor(4.925)),formatDate:function(e,t,i){if(!t)return"";var s,n=(i?i.dayNamesShort:null)||this._defaults.dayNamesShort,a=(i?i.dayNames:null)||this._defaults.dayNames,o=(i?i.monthNamesShort:null)||this._defaults.monthNamesShort,r=(i?i.monthNames:null)||this._defaults.monthNames,h=function(t){var i=e.length>s+1&&e.charAt(s+1)===t;return i&&s++,i},l=function(e,t,i){var s=""+t;if(h(e))for(i>s.length;)s="0"+s;return s},u=function(e,t,i,s){return h(e)?s[t]:i[t]},d="",c=!1;if(t)for(s=0;e.length>s;s++)if(c)"'"!==e.charAt(s)||h("'")?d+=e.charAt(s):c=!1;else switch(e.charAt(s)){case"d":d+=l("d",t.getDate,2);break;case"D":d+=u("D",t.getDay,n,a);break;case"o":d+=l("o",Math.round((new Date(t.getFullYear,t.getMonth,t.getDate).getTime-new Date(t.getFullYear,0,0).getTime)/864e5),3);break;case"m":d+=l("m",t.getMonth+1,2);break;case"M":d+=u("M",t.getMonth,o,r);break;case"y":d+=h("y")?t.getFullYear:(10>t.getYear%100?"0":"")+t.getYear%100;break;case"@":d+=t.getTime;break;case"!":d+=1e4*t.getTime+this._ticksTo1970;break;case"'":h("'")?d+="'":c=!0;break;default:d+=e.charAt(s)}return d},_possibleChars:function(e){var t,i="",s=!1,n=function(i){var s=e.length>t+1&&e.charAt(t+1)===i;return s&&t++,s};for(t=0;e.length>t;t++)if(s)"'"!==e.charAt(t)||n("'")?i+=e.charAt(t):s=!1;else switch(e.charAt(t)){case"d":case"m":case"y":case"@":i+="0123456789";break;case"D":case"M":return null;case"'":n("'")?i+="'":s=!0;break;default:i+=e.charAt(t)}return i},_get:function(e,t){return void 0!==e.settings[t]?e.settings[t]:this._defaults[t]},_setDateFromField:function(e,t){if(e.input.val!==e.lastVal){var i=this._get(e,"dateFormat"),s=e.lastVal=e.input?e.input.val:null,n=this._getDefaultDate(e),a=n,o=this._getFormatConfig(e);try{a=this.parseDate(i,s,o)||n}catch(r){s=t?"":s}e.selectedDay=a.getDate,e.drawMonth=e.selectedMonth=a.getMonth,e.drawYear=e.selectedYear=a.getFullYear,e.currentDay=s?a.getDate:0,e.currentMonth=s?a.getMonth:0,e.currentYear=s?a.getFullYear:0,this._adjustInstDate(e)}},_getDefaultDate:function(e){return this._restrictMinMax(e,this._determineDate(e,this._get(e,"defaultDate"),new Date))},_determineDate:function(t,i,s){var n=function(e){var t=new Date;return t.setDate(t.getDate+e),t},a=function(i){try{return e.datepicker.parseDate(e.datepicker._get(t,"dateFormat"),i,e.datepicker._getFormatConfig(t))}catch(s){}for(var n=(i.toLowerCase.match(/^c/)?e.datepicker._getDate(t):null)||new Date,a=n.getFullYear,o=n.getMonth,r=n.getDate,h=/([+\-]?[0-9]+)\s*(d|D|w|W|m|M|y|Y)?/g,l=h.exec(i);l;){switch(l[2]||"d"){case"d":case"D":r+=parseInt(l[1],10);break;case"w":case"W":r+=7*parseInt(l[1],10);break;case"m":case"M":o+=parseInt(l[1],10),r=Math.min(r,e.datepicker._getDaysInMonth(a,o));break;case"y":case"Y":a+=parseInt(l[1],10),r=Math.min(r,e.datepicker._getDaysInMonth(a,o))}l=h.exec(i)}return new Date(a,o,r)},o=null==i||""===i?s:"string"==typeof i?a(i):"number"==typeof i?isNaN(i)?s:n(i):new Date(i.getTime);return o=o&&"Invalid Date"==""+o?s:o,o&&(o.setHours(0),o.setMinutes(0),o.setSeconds(0),o.setMilliseconds(0)),this._daylightSavingAdjust(o)},_daylightSavingAdjust:function(e){return e?(e.setHours(e.getHours>12?e.getHours+2:0),e):null},_setDate:function(e,t,i){var s=!t,n=e.selectedMonth,a=e.selectedYear,o=this._restrictMinMax(e,this._determineDate(e,t,new Date));e.selectedDay=e.currentDay=o.getDate,e.drawMonth=e.selectedMonth=e.currentMonth=o.getMonth,e.drawYear=e.selectedYear=e.currentYear=o.getFullYear,n===e.selectedMonth&&a===e.selectedYear||i||this._notifyChange(e),this._adjustInstDate(e),e.input&&e.input.val(s?"":this._formatDate(e))},_getDate:function(e){var t=!e.currentYear||e.input&&""===e.input.val?null:this._daylightSavingAdjust(new Date(e.currentYear,e.currentMonth,e.currentDay));return t},_attachHandlers:function(t){var i=this._get(t,"stepMonths"),s="#"+t.id.replace(/\\\\/g,"\\");t.dpDiv.find("[data-handler]").map(function{var t={prev:function{e.datepicker._adjustDate(s,-i,"M")},next:function{e.datepicker._adjustDate(s,+i,"M")},hide:function{e.datepicker._hideDatepicker},today:function{e.datepicker._gotoToday(s)},selectDay:function{return e.datepicker._selectDay(s,+this.getAttribute("data-month"),+this.getAttribute("data-year"),this),!1},selectMonth:function{return e.datepicker._selectMonthYear(s,this,"M"),!1},selectYear:function{return e.datepicker._selectMonthYear(s,this,"Y"),!1}};e(this).bind(this.getAttribute("data-event"),t[this.getAttribute("data-handler")])})},_generateHTML:function(e){var t,i,s,n,a,o,r,h,l,u,d,c,p,f,m,g,v,y,b,_,x,w,k,T,D,S,M,C,N,A,P,I,H,z,F,E,O,j,W,L=new Date,R=this._daylightSavingAdjust(new Date(L.getFullYear,L.getMonth,L.getDate)),Y=this._get(e,"isRTL"),B=this._get(e,"showButtonPanel"),J=this._get(e,"hideIfNoPrevNext"),q=this._get(e,"navigationAsDateFormat"),K=this._getNumberOfMonths(e),V=this._get(e,"showCurrentAtPos"),U=this._get(e,"stepMonths"),Q=1!==K[0]||1!==K[1],G=this._daylightSavingAdjust(e.currentDay?new Date(e.currentYear,e.currentMonth,e.currentDay):new Date(9999,9,9)),X=this._getMinMaxDate(e,"min"),$=this._getMinMaxDate(e,"max"),Z=e.drawMonth-V,et=e.drawYear;if(0>Z&&(Z+=12,et--),$)for(t=this._daylightSavingAdjust(new Date($.getFullYear,$.getMonth-K[0]*K[1]+1,$.getDate)),t=X&&X>t?X:t;this._daylightSavingAdjust(new Date(et,Z,1))>t;)Z--,0>Z&&(Z=11,et--);for(e.drawMonth=Z,e.drawYear=et,i=this._get(e,"prevText"),i=q?this.formatDate(i,this._daylightSavingAdjust(new Date(et,Z-U,1)),this._getFormatConfig(e)):i,s=this._canAdjustMonth(e,-1,et,Z)?""+i+" ":J?"":"<span class='ui-icon ui-icon-circle-triangle-"+(Y?"e":"w")+"'>"+i+" </a>",n=this._get(e,"nextText"),n=q?this.formatDate(n,this._daylightSavingAdjust(new Date(et,Z+U,1)),this._getFormatConfig(e)):n,a=this._canAdjustMonth(e,1,et,Z)?"<a class='ui-datepicker-next ui-corner-all' data-handler='next' data-event='click' title='"+n+"'><span class='ui-icon ui-icon-circle-triangle-"+(Y?"w":"e")+"'>"+n+" </a>":J?"":"<a class='ui-datepicker-next ui-corner-all ui-state-disabled' title='"+n+"'><span class='ui-icon ui-icon-circle-triangle-"+(Y?"w":"e")+"'>"+n+" </a>",o=this._get(e,"currentText"),r=this._get(e,"gotoCurrent")&&e.currentDay?G:R,o=q?this.formatDate(o,r,this._getFormatConfig(e)):o,h=e.inline?"":"<button type='button' class='ui-datepicker-close ui-state-default ui-priority-primary ui-corner-all' data-handler='hide' data-event='click'>"+this._get(e,"closeText")+" ",l=B?" "+(Y?h:"")+(this._isInRange(e,r)?"<button type='button' class='ui-datepicker-current ui-state-default ui-priority-secondary ui-corner-all' data-handler='today' data-event='click'>"+o+" ":"")+(Y?"":h)+" ":"",u=parseInt(this._get(e,"firstDay"),10),u=isNaN(u)?0:u,d=this._get(e,"showWeek"),c=this._get(e,"dayNames"),p=this._get(e,"dayNamesMin"),f=this._get(e,"monthNames"),m=this._get(e,"monthNamesShort"),g=this._get(e,"beforeShowDay"),v=this._get(e,"showOtherMonths"),y=this._get(e,"selectOtherMonths"),b=this._getDefaultDate(e),_="",w=0;K[0]>w;w++){for(k="",this.maxRows=4,T=0;K[1]>T;T++){if(D=this._daylightSavingAdjust(new Date(et,Z,e.selectedDay)),S=" ui-corner-all",M="",Q){if(M+="<div class='ui-datepicker-group",K[1]>1)switch(T){case 0:M+=" ui-datepicker-group-first",S=" ui-corner-"+(Y?"right":"left");break;case K[1]-1:M+=" ui-datepicker-group-last",S=" ui-corner-"+(Y?"left":"right");break;default:M+=" ui-datepicker-group-middle",S=""}M+="'>"}for(M+="<div class='ui-datepicker-header ui-widget-header ui-helper-clearfix"+S+"'>"+(/all|left/.test(S)&&0===w?Y?a:s:"")+(/all|right/.test(S)&&0===w?Y?s:a:"")+this._generateMonthYearHeader(e,Z,et,X,$,w>0||T>0,f,m)+" "+(Q?" "+(K[0]>0&&T===K[1]-1?" ":""):""),k+=M}_+=k}return _+=l,e._keyEvent=!1,_},_generateMonthYearHeader:function(e,t,i,s,n,a,o,r){var h,l,u,d,c,p,f,m,g=this._get(e,"changeMonth"),v=this._get(e,"changeYear"),y=this._get(e,"showMonthAfterYear"),b=" ",_="";if(a||!g)_+=" "+o[t]+" ";else{for(h=s&&s.getFullYear===i,l=n&&n.getFullYear===i,_+="<select class='ui-datepicker-month' data-handler='selectMonth' data-event='change'>",u=0;12>u;u++)(!h||u>=s.getMonth)&&(!l||n.getMonth>=u)&&(_+="<option value='"+u+"'"+(u===t?" selected='selected'":"")+">"+r[u]+" ");_+=" "}if(y||(b+=_+(!a&&g&&v?"":"&#xa0;")),!e.yearshtml)if(e.yearshtml="",a||!v)b+=" "+i+" ";else{for(d=this._get(e,"yearRange").split(":"),c=(new Date).getFullYear,p=function(e){var t=e.match(/c[+\-].*/)?i+parseInt(e.substring(1),10):e.match(/[+\-].*/)?c+parseInt(e,10):parseInt(e,10);return isNaN(t)?c:t},f=p(d[0]),m=Math.max(f,p(d[1]||"")),f=s?Math.max(f,s.getFullYear):f,m=n?Math.min(m,n.getFullYear):m,e.yearshtml+="<select class='ui-datepicker-year' data-handler='selectYear' data-event='change'>";m>=f;f++)e.yearshtml+="<option value='"+f+"'"+(f===i?" selected='selected'":"")+">"+f+" ";e.yearshtml+=" ",b+=e.yearshtml,e.yearshtml=null}return b+=this._get(e,"yearSuffix"),y&&(b+=(!a&&g&&v?"":"&#xa0;")+_),b+=" "},_adjustInstDate:function(e,t,i){var s=e.drawYear+("Y"===i?t:0),n=e.drawMonth+("M"===i?t:0),a=Math.min(e.selectedDay,this._getDaysInMonth(s,n))+("D"===i?t:0),o=this._restrictMinMax(e,this._daylightSavingAdjust(new Date(s,n,a)));e.selectedDay=o.getDate,e.drawMonth=e.selectedMonth=o.getMonth,e.drawYear=e.selectedYear=o.getFullYear,("M"===i||"Y"===i)&&this._notifyChange(e)},_restrictMinMax:function(e,t){var i=this._getMinMaxDate(e,"min"),s=this._getMinMaxDate(e,"max"),n=i&&i>t?i:t;return s&&n>s?s:n},_notifyChange:function(e){var t=this._get(e,"onChangeMonthYear");t&&t.apply(e.input?e.input[0]:null,[e.selectedYear,e.selectedMonth+1,e])},_getNumberOfMonths:function(e){var t=this._get(e,"numberOfMonths");return null==t?[1,1]:"number"==typeof t?[1,t]:t},_getMinMaxDate:function(e,t){return this._determineDate(e,this._get(e,t+"Date"),null)},_getDaysInMonth:function(e,t){return 32-this._daylightSavingAdjust(new Date(e,t,32)).getDate},_getFirstDayOfMonth:function(e,t){return new Date(e,t,1).getDay},_canAdjustMonth:function(e,t,i,s){var n=this._getNumberOfMonths(e),a=this._daylightSavingAdjust(new Date(i,s+(0>t?t:n[0]*n[1]),1));return 0>t&&a.setDate(this._getDaysInMonth(a.getFullYear,a.getMonth)),this._isInRange(e,a)},_isInRange:function(e,t){var i,s,n=this._getMinMaxDate(e,"min"),a=this._getMinMaxDate(e,"max"),o=null,r=null,h=this._get(e,"yearRange");return h&&(i=h.split(":"),s=(new Date).getFullYear,o=parseInt(i[0],10),r=parseInt(i[1],10),i[0].match(/[+\-].*/)&&(o+=s),i[1].match(/[+\-].*/)&&(r+=s)),(!n||t.getTime>=n.getTime)&&(!a||t.getTime<=a.getTime)&&(!o||t.getFullYear>=o)&&(!r||r>=t.getFullYear)},_getFormatConfig:function(e){var t=this._get(e,"shortYearCutoff");return t="string"!=typeof t?t:(new Date).getFullYear%100+parseInt(t,10),{shortYearCutoff:t,dayNamesShort:this._get(e,"dayNamesShort"),dayNames:this._get(e,"dayNames"),monthNamesShort:this._get(e,"monthNamesShort"),monthNames:this._get(e,"monthNames")}},_formatDate:function(e,t,i,s){t||(e.currentDay=e.selectedDay,e.currentMonth=e.selectedMonth,e.currentYear=e.selectedYear);var n=t?"object"==typeof t?t:this._daylightSavingAdjust(new Date(s,i,t)):this._daylightSavingAdjust(new Date(e.currentYear,e.currentMonth,e.currentDay));return this.formatDate(this._get(e,"dateFormat"),n,this._getFormatConfig(e))}}),e.fn.datepicker=function(t){if(!this.length)return this;e.datepicker.initialized||(e(document).mousedown(e.datepicker._checkExternalClick),e.datepicker.initialized=!0),0===e("#"+e.datepicker._mainDivId).length&&e("body").append(e.datepicker.dpDiv);var i=Array.prototype.slice.call(arguments,1);return"string"!=typeof t||"isDisabled"!==t&&"getDate"!==t&&"widget"!==t?"option"===t&&2===arguments.length&&"string"==typeof arguments[1]?e.datepicker["_"+t+"Datepicker"].apply(e.datepicker,[this[0]].concat(i)):this.each(function{"string"==typeof t?e.datepicker["_"+t+"Datepicker"].apply(e.datepicker,[this].concat(i)):e.datepicker._attachDatepicker(this,t)}):e.datepicker["_"+t+"Datepicker"].apply(e.datepicker,[this[0]].concat(i))},e.datepicker=new n,e.datepicker.initialized=!1,e.datepicker.uuid=(new Date).getTime,e.datepicker.version="1.11.4",e.datepicker,e.widget("ui.draggable",e.ui.mouse,{version:"1.11.4",widgetEventPrefix:"drag",options:{addClasses:!0,appendTo:"parent",axis:!1,connectToSortable:!1,containment:!1,cursor:"auto",cursorAt:!1,grid:!1,handle:!1,helper:"original",iframeFix:!1,opacity:!1,refreshPositions:!1,revert:!1,revertDuration:500,scope:"default",scroll:!0,scrollSensitivity:20,scrollSpeed:20,snap:!1,snapMode:"both",snapTolerance:20,stack:!1,zIndex:!1,drag:null,start:null,stop:null},_create:function{"original"===this.options.helper&&this._setPositionRelative,this.options.addClasses&&this.element.addClass("ui-draggable"),this.options.disabled&&this.element.addClass("ui-draggable-disabled"),this._setHandleClassName,this._mouseInit},_setOption:function(e,t){this._super(e,t),"handle"===e&&(this._removeHandleClassName,this._setHandleClassName)},_destroy:function{return(this.helper||this.element).is(".ui-draggable-dragging")?(this.destroyOnClear=!0,void 0):(this.element.removeClass("ui-draggable ui-draggable-dragging ui-draggable-disabled"),this._removeHandleClassName,this._mouseDestroy,void 0)},_mouseCapture:function(t){var i=this.options;return this._blurActiveElement(t),this.helper||i.disabled||e(t.target).closest(".ui-resizable-handle").length>0?!1:(this.handle=this._getHandle(t),this.handle?(this._blockFrames(i.iframeFix===!0?"iframe":i.iframeFix),!0):!1)},_blockFrames:function(t){this.iframeBlocks=this.document.find(t).map(function{var t=e(this);return e(" ").css("position","absolute").appendTo(t.parent).outerWidth(t.outerWidth).outerHeight(t.outerHeight).offset(t.offset)[0]})},_unblockFrames:function{this.iframeBlocks&&(this.iframeBlocks.remove,delete this.iframeBlocks)},_blurActiveElement:function(t){var i=this.document[0];if(this.handleElement.is(t.target))try{i.activeElement&&"body"!==i.activeElement.nodeName.toLowerCase&&e(i.activeElement).blur}catch(s){}},_mouseStart:function(t){var i=this.options;return this.helper=this._createHelper(t),this.helper.addClass("ui-draggable-dragging"),this._cacheHelperProportions,e.ui.ddmanager&&(e.ui.ddmanager.current=this),this._cacheMargins,this.cssPosition=this.helper.css("position"),this.scrollParent=this.helper.scrollParent(!0),this.offsetParent=this.helper.offsetParent,this.hasFixedAncestor=this.helper.parents.filter(function{return"fixed"===e(this).css("position")}).length>0,this.positionAbs=this.element.offset,this._refreshOffsets(t),this.originalPosition=this.position=this._generatePosition(t,!1),this.originalPageX=t.pageX,this.originalPageY=t.pageY,i.cursorAt&&this._adjustOffsetFromHelper(i.cursorAt),this._setContainment,this._trigger("start",t)===!1?(this._clear,!1):(this._cacheHelperProportions,e.ui.ddmanager&&!i.dropBehaviour&&e.ui.ddmanager.prepareOffsets(this,t),this._normalizeRightBottom,this._mouseDrag(t,!0),e.ui.ddmanager&&e.ui.ddmanager.dragStart(this,t),!0)},_refreshOffsets:function(e){this.offset={top:this.positionAbs.top-this.margins.top,left:this.positionAbs.left-this.margins.left,scroll:!1,parent:this._getParentOffset,relative:this._getRelativeOffset},this.offset.click={left:e.pageX-this.offset.left,top:e.pageY-this.offset.top}},_mouseDrag:function(t,i){if(this.hasFixedAncestor&&(this.offset.parent=this._getParentOffset),this.position=this._generatePosition(t,!0),this.positionAbs=this._convertPositionTo("absolute"),!i){var s=this._uiHash;if(this._trigger("drag",t,s)===!1)return this._mouseUp({}),!1;this.position=s.position}return this.helper[0].style.left=this.position.left+"px",this.helper[0].style.top=this.position.top+"px",e.ui.ddmanager&&e.ui.ddmanager.drag(this,t),!1},_mouseStop:function(t){var i=this,s=!1;return e.ui.ddmanager&&!this.options.dropBehaviour&&(s=e.ui.ddmanager.drop(this,t)),this.dropped&&(s=this.dropped,this.dropped=!1),"invalid"===this.options.revert&&!s||"valid"===this.options.revert&&s||this.options.revert===!0||e.isFunction(this.options.revert)&&this.options.revert.call(this.element,s)?e(this.helper).animate(this.originalPosition,parseInt(this.options.revertDuration,10),function{i._trigger("stop",t)!==!1&&i._clear}):this._trigger("stop",t)!==!1&&this._clear,!1},_mouseUp:function(t){return this._unblockFrames,e.ui.ddmanager&&e.ui.ddmanager.dragStop(this,t),this.handleElement.is(t.target)&&this.element.focus,e.ui.mouse.prototype._mouseUp.call(this,t)},cancel:function{return this.helper.is(".ui-draggable-dragging")?this._mouseUp({}):this._clear,this},_getHandle:function(t){return this.options.handle?!!e(t.target).closest(this.element.find(this.options.handle)).length:!0},_setHandleClassName:function{this.handleElement=this.options.handle?this.element.find(this.options.handle):this.element,this.handleElement.addClass("ui-draggable-handle")},_removeHandleClassName:function{this.handleElement.removeClass("ui-draggable-handle")},_createHelper:function(t){var i=this.options,s=e.isFunction(i.helper),n=s?e(i.helper.apply(this.element[0],[t])):"clone"===i.helper?this.element.clone.removeAttr("id"):this.element;return n.parents("body").length||n.appendTo("parent"===i.appendTo?this.element[0].parentNode:i.appendTo),s&&n[0]===this.element[0]&&this._setPositionRelative,n[0]===this.element[0]||/(fixed|absolute)/.test(n.css("position"))||n.css("position","absolute"),n},_setPositionRelative:function{/^(?:r|a|f)/.test(this.element.css("position"))||(this.element[0].style.position="relative")},_adjustOffsetFromHelper:function(t){"string"==typeof t&&(t=t.split(" ")),e.isArray(t)&&(t={left:+t[0],top:+t[1]||0}),"left"in t&&(this.offset.click.left=t.left+this.margins.left),"right"in t&&(this.offset.click.left=this.helperProportions.width-t.right+this.margins.left),"top"in t&&(this.offset.click.top=t.top+this.margins.top),"bottom"in t&&(this.offset.click.top=this.helperProportions.height-t.bottom+this.margins.top)},_isRootNode:function(e){return/(html|body)/i.test(e.tagName)||e===this.document[0]},_getParentOffset:function{var t=this.offsetParent.offset,i=this.document[0];return"absolute"===this.cssPosition&&this.scrollParent[0]!==i&&e.contains(this.scrollParent[0],this.offsetParent[0])&&(t.left+=this.scrollParent.scrollLeft,t.top+=this.scrollParent.scrollTop),this._isRootNode(this.offsetParent[0])&&(t={top:0,left:0}),{top:t.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:t.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function{if("relative"!==this.cssPosition)return{top:0,left:0};var e=this.element.position,t=this._isRootNode(this.scrollParent[0]);return{top:e.top-(parseInt(this.helper.css("top"),10)||0)+(t?0:this.scrollParent.scrollTop),left:e.left-(parseInt(this.helper.css("left"),10)||0)+(t?0:this.scrollParent.scrollLeft)}},_cacheMargins:function{this.margins={left:parseInt(this.element.css("marginLeft"),10)||0,top:parseInt(this.element.css("marginTop"),10)||0,right:parseInt(this.element.css("marginRight"),10)||0,bottom:parseInt(this.element.css("marginBottom"),10)||0}},_cacheHelperProportions:function{this.helperProportions={width:this.helper.outerWidth,height:this.helper.outerHeight}},_setContainment:function{var t,i,s,n=this.options,a=this.document[0];return this.relativeContainer=null,n.containment?"window"===n.containment?(this.containment=[e(window).scrollLeft-this.offset.relative.left-this.offset.parent.left,e(window).scrollTop-this.offset.relative.top-this.offset.parent.top,e(window).scrollLeft+e(window).width-this.helperProportions.width-this.margins.left,e(window).scrollTop+(e(window).height||a.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top],void 0):"document"===n.containment?(this.containment=[0,0,e(a).width-this.helperProportions.width-this.margins.left,(e(a).height||a.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top],void 0):n.containment.constructor===Array?(this.containment=n.containment,void 0):("parent"===n.containment&&(n.containment=this.helper[0].parentNode),i=e(n.containment),s=i[0],s&&(t=/(scroll|auto)/.test(i.css("overflow")),this.containment=[(parseInt(i.css("borderLeftWidth"),10)||0)+(parseInt(i.css("paddingLeft"),10)||0),(parseInt(i.css("borderTopWidth"),10)||0)+(parseInt(i.css("paddingTop"),10)||0),(t?Math.max(s.scrollWidth,s.offsetWidth):s.offsetWidth)-(parseInt(i.css("borderRightWidth"),10)||0)-(parseInt(i.css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left-this.margins.right,(t?Math.max(s.scrollHeight,s.offsetHeight):s.offsetHeight)-(parseInt(i.css("borderBottomWidth"),10)||0)-(parseInt(i.css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top-this.margins.bottom],this.relativeContainer=i),void 0):(this.containment=null,void 0) },_convertPositionTo:function(e,t){t||(t=this.position);var i="absolute"===e?1:-1,s=this._isRootNode(this.scrollParent[0]);return{top:t.top+this.offset.relative.top*i+this.offset.parent.top*i-("fixed"===this.cssPosition?-this.offset.scroll.top:s?0:this.offset.scroll.top)*i,left:t.left+this.offset.relative.left*i+this.offset.parent.left*i-("fixed"===this.cssPosition?-this.offset.scroll.left:s?0:this.offset.scroll.left)*i}},_generatePosition:function(e,t){var i,s,n,a,o=this.options,r=this._isRootNode(this.scrollParent[0]),h=e.pageX,l=e.pageY;return r&&this.offset.scroll||(this.offset.scroll={top:this.scrollParent.scrollTop,left:this.scrollParent.scrollLeft}),t&&(this.containment&&(this.relativeContainer?(s=this.relativeContainer.offset,i=[this.containment[0]+s.left,this.containment[1]+s.top,this.containment[2]+s.left,this.containment[3]+s.top]):i=this.containment,e.pageX-this.offset.click.left<i[0]&&(h=i[0]+this.offset.click.left),e.pageY-this.offset.click.top<i[1]&&(l=i[1]+this.offset.click.top),e.pageX-this.offset.click.left>i[2]&&(h=i[2]+this.offset.click.left),e.pageY-this.offset.click.top>i[3]&&(l=i[3]+this.offset.click.top)),o.grid&&(n=o.grid[1]?this.originalPageY+Math.round((l-this.originalPageY)/o.grid[1])*o.grid[1]:this.originalPageY,l=i?n-this.offset.click.top>=i[1]||n-this.offset.click.top>i[3]?n:n-this.offset.click.top>=i[1]?n-o.grid[1]:n+o.grid[1]:n,a=o.grid[0]?this.originalPageX+Math.round((h-this.originalPageX)/o.grid[0])*o.grid[0]:this.originalPageX,h=i?a-this.offset.click.left>=i[0]||a-this.offset.click.left>i[2]?a:a-this.offset.click.left>=i[0]?a-o.grid[0]:a+o.grid[0]:a),"y"===o.axis&&(h=this.originalPageX),"x"===o.axis&&(l=this.originalPageY)),{top:l-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+("fixed"===this.cssPosition?-this.offset.scroll.top:r?0:this.offset.scroll.top),left:h-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+("fixed"===this.cssPosition?-this.offset.scroll.left:r?0:this.offset.scroll.left)}},_clear:function{this.helper.removeClass("ui-draggable-dragging"),this.helper[0]===this.element[0]||this.cancelHelperRemoval||this.helper.remove,this.helper=null,this.cancelHelperRemoval=!1,this.destroyOnClear&&this.destroy},_normalizeRightBottom:function{"y"!==this.options.axis&&"auto"!==this.helper.css("right")&&(this.helper.width(this.helper.width),this.helper.css("right","auto")),"x"!==this.options.axis&&"auto"!==this.helper.css("bottom")&&(this.helper.height(this.helper.height),this.helper.css("bottom","auto"))},_trigger:function(t,i,s){return s=s||this._uiHash,e.ui.plugin.call(this,t,[i,s,this],!0),/^(drag|start|stop)/.test(t)&&(this.positionAbs=this._convertPositionTo("absolute"),s.offset=this.positionAbs),e.Widget.prototype._trigger.call(this,t,i,s)},plugins:{},_uiHash:function{return{helper:this.helper,position:this.position,originalPosition:this.originalPosition,offset:this.positionAbs}}}),e.ui.plugin.add("draggable","connectToSortable",{start:function(t,i,s){var n=e.extend({},i,{item:s.element});s.sortables=[],e(s.options.connectToSortable).each(function{var i=e(this).sortable("instance");i&&!i.options.disabled&&(s.sortables.push(i),i.refreshPositions,i._trigger("activate",t,n))})},stop:function(t,i,s){var n=e.extend({},i,{item:s.element});s.cancelHelperRemoval=!1,e.each(s.sortables,function{var e=this;e.isOver?(e.isOver=0,s.cancelHelperRemoval=!0,e.cancelHelperRemoval=!1,e._storedCSS={position:e.placeholder.css("position"),top:e.placeholder.css("top"),left:e.placeholder.css("left")},e._mouseStop(t),e.options.helper=e.options._helper):(e.cancelHelperRemoval=!0,e._trigger("deactivate",t,n))})},drag:function(t,i,s){e.each(s.sortables,function{var n=!1,a=this;a.positionAbs=s.positionAbs,a.helperProportions=s.helperProportions,a.offset.click=s.offset.click,a._intersectsWith(a.containerCache)&&(n=!0,e.each(s.sortables,function{return this.positionAbs=s.positionAbs,this.helperProportions=s.helperProportions,this.offset.click=s.offset.click,this!==a&&this._intersectsWith(this.containerCache)&&e.contains(a.element[0],this.element[0])&&(n=!1),n})),n?(a.isOver||(a.isOver=1,s._parent=i.helper.parent,a.currentItem=i.helper.appendTo(a.element).data("ui-sortable-item",!0),a.options._helper=a.options.helper,a.options.helper=function{return i.helper[0]},t.target=a.currentItem[0],a._mouseCapture(t,!0),a._mouseStart(t,!0,!0),a.offset.click.top=s.offset.click.top,a.offset.click.left=s.offset.click.left,a.offset.parent.left-=s.offset.parent.left-a.offset.parent.left,a.offset.parent.top-=s.offset.parent.top-a.offset.parent.top,s._trigger("toSortable",t),s.dropped=a.element,e.each(s.sortables,function{this.refreshPositions}),s.currentItem=s.element,a.fromOutside=s),a.currentItem&&(a._mouseDrag(t),i.position=a.position)):a.isOver&&(a.isOver=0,a.cancelHelperRemoval=!0,a.options._revert=a.options.revert,a.options.revert=!1,a._trigger("out",t,a._uiHash(a)),a._mouseStop(t,!0),a.options.revert=a.options._revert,a.options.helper=a.options._helper,a.placeholder&&a.placeholder.remove,i.helper.appendTo(s._parent),s._refreshOffsets(t),i.position=s._generatePosition(t,!0),s._trigger("fromSortable",t),s.dropped=!1,e.each(s.sortables,function{this.refreshPositions}))})}}),e.ui.plugin.add("draggable","cursor",{start:function(t,i,s){var n=e("body"),a=s.options;n.css("cursor")&&(a._cursor=n.css("cursor")),n.css("cursor",a.cursor)},stop:function(t,i,s){var n=s.options;n._cursor&&e("body").css("cursor",n._cursor)}}),e.ui.plugin.add("draggable","opacity",{start:function(t,i,s){var n=e(i.helper),a=s.options;n.css("opacity")&&(a._opacity=n.css("opacity")),n.css("opacity",a.opacity)},stop:function(t,i,s){var n=s.options;n._opacity&&e(i.helper).css("opacity",n._opacity)}}),e.ui.plugin.add("draggable","scroll",{start:function(e,t,i){i.scrollParentNotHidden||(i.scrollParentNotHidden=i.helper.scrollParent(!1)),i.scrollParentNotHidden[0]!==i.document[0]&&"HTML"!==i.scrollParentNotHidden[0].tagName&&(i.overflowOffset=i.scrollParentNotHidden.offset)},drag:function(t,i,s){var n=s.options,a=!1,o=s.scrollParentNotHidden[0],r=s.document[0];o!==r&&"HTML"!==o.tagName?(n.axis&&"x"===n.axis||(s.overflowOffset.top+o.offsetHeight-t.pageY<n.scrollSensitivity?o.scrollTop=a=o.scrollTop+n.scrollSpeed:t.pageY-s.overflowOffset.top<n.scrollSensitivity&&(o.scrollTop=a=o.scrollTop-n.scrollSpeed)),n.axis&&"y"===n.axis||(s.overflowOffset.left+o.offsetWidth-t.pageX<n.scrollSensitivity?o.scrollLeft=a=o.scrollLeft+n.scrollSpeed:t.pageX-s.overflowOffset.left<n.scrollSensitivity&&(o.scrollLeft=a=o.scrollLeft-n.scrollSpeed))):(n.axis&&"x"===n.axis||(t.pageY-e(r).scrollTop<n.scrollSensitivity?a=e(r).scrollTop(e(r).scrollTop-n.scrollSpeed):e(window).height-(t.pageY-e(r).scrollTop)<n.scrollSensitivity&&(a=e(r).scrollTop(e(r).scrollTop+n.scrollSpeed))),n.axis&&"y"===n.axis||(t.pageX-e(r).scrollLeft<n.scrollSensitivity?a=e(r).scrollLeft(e(r).scrollLeft-n.scrollSpeed):e(window).width-(t.pageX-e(r).scrollLeft)<n.scrollSensitivity&&(a=e(r).scrollLeft(e(r).scrollLeft+n.scrollSpeed)))),a!==!1&&e.ui.ddmanager&&!n.dropBehaviour&&e.ui.ddmanager.prepareOffsets(s,t)}}),e.ui.plugin.add("draggable","snap",{start:function(t,i,s){var n=s.options;s.snapElements=[],e(n.snap.constructor!==String?n.snap.items||":data(ui-draggable)":n.snap).each(function{var t=e(this),i=t.offset;this!==s.element[0]&&s.snapElements.push({item:this,width:t.outerWidth,height:t.outerHeight,top:i.top,left:i.left})})},drag:function(t,i,s){var n,a,o,r,h,l,u,d,c,p,f=s.options,m=f.snapTolerance,g=i.offset.left,v=g+s.helperProportions.width,y=i.offset.top,b=y+s.helperProportions.height;for(c=s.snapElements.length-1;c>=0;c--)h=s.snapElements[c].left-s.margins.left,l=h+s.snapElements[c].width,u=s.snapElements[c].top-s.margins.top,d=u+s.snapElements[c].height,h-m>v||g>l+m||u-m>b||y>d+m||!e.contains(s.snapElements[c].item.ownerDocument,s.snapElements[c].item)?(s.snapElements[c].snapping&&s.options.snap.release&&s.options.snap.release.call(s.element,t,e.extend(s._uiHash,{snapItem:s.snapElements[c].item})),s.snapElements[c].snapping=!1):("inner"!==f.snapMode&&(n=m>=Math.abs(u-b),a=m>=Math.abs(d-y),o=m>=Math.abs(h-v),r=m>=Math.abs(l-g),n&&(i.position.top=s._convertPositionTo("relative",{top:u-s.helperProportions.height,left:0}).top),a&&(i.position.top=s._convertPositionTo("relative",{top:d,left:0}).top),o&&(i.position.left=s._convertPositionTo("relative",{top:0,left:h-s.helperProportions.width}).left),r&&(i.position.left=s._convertPositionTo("relative",{top:0,left:l}).left)),p=n||a||o||r,"outer"!==f.snapMode&&(n=m>=Math.abs(u-y),a=m>=Math.abs(d-b),o=m>=Math.abs(h-g),r=m>=Math.abs(l-v),n&&(i.position.top=s._convertPositionTo("relative",{top:u,left:0}).top),a&&(i.position.top=s._convertPositionTo("relative",{top:d-s.helperProportions.height,left:0}).top),o&&(i.position.left=s._convertPositionTo("relative",{top:0,left:h}).left),r&&(i.position.left=s._convertPositionTo("relative",{top:0,left:l-s.helperProportions.width}).left)),!s.snapElements[c].snapping&&(n||a||o||r||p)&&s.options.snap.snap&&s.options.snap.snap.call(s.element,t,e.extend(s._uiHash,{snapItem:s.snapElements[c].item})),s.snapElements[c].snapping=n||a||o||r||p)}}),e.ui.plugin.add("draggable","stack",{start:function(t,i,s){var n,a=s.options,o=e.makeArray(e(a.stack)).sort(function(t,i){return(parseInt(e(t).css("zIndex"),10)||0)-(parseInt(e(i).css("zIndex"),10)||0)});o.length&&(n=parseInt(e(o[0]).css("zIndex"),10)||0,e(o).each(function(t){e(this).css("zIndex",n+t)}),this.css("zIndex",n+o.length))}}),e.ui.plugin.add("draggable","zIndex",{start:function(t,i,s){var n=e(i.helper),a=s.options;n.css("zIndex")&&(a._zIndex=n.css("zIndex")),n.css("zIndex",a.zIndex)},stop:function(t,i,s){var n=s.options;n._zIndex&&e(i.helper).css("zIndex",n._zIndex)}}),e.ui.draggable,e.widget("ui.resizable",e.ui.mouse,{version:"1.11.4",widgetEventPrefix:"resize",options:{alsoResize:!1,animate:!1,animateDuration:"slow",animateEasing:"swing",aspectRatio:!1,autoHide:!1,containment:!1,ghost:!1,grid:!1,handles:"e,s,se",helper:!1,maxHeight:null,maxWidth:null,minHeight:10,minWidth:10,zIndex:90,resize:null,start:null,stop:null},_num:function(e){return parseInt(e,10)||0},_isNumber:function(e){return!isNaN(parseInt(e,10))},_hasScroll:function(t,i){if("hidden"===e(t).css("overflow"))return!1;var s=i&&"left"===i?"scrollLeft":"scrollTop",n=!1;return t[s]>0?!0:(t[s]=1,n=t[s]>0,t[s]=0,n)},_create:function{var t,i,s,n,a,o=this,r=this.options;if(this.element.addClass("ui-resizable"),e.extend(this,{_aspectRatio:!!r.aspectRatio,aspectRatio:r.aspectRatio,originalElement:this.element,_proportionallyResizeElements:[],_helper:r.helper||r.ghost||r.animate?r.helper||"ui-resizable-helper":null}),this.element[0].nodeName.match(/^(canvas|textarea|input|select|button|img)$/i)&&(this.element.wrap(e(" ").css({position:this.element.css("position"),width:this.element.outerWidth,height:this.element.outerHeight,top:this.element.css("top"),left:this.element.css("left")})),this.element=this.element.parent.data("ui-resizable",this.element.resizable("instance")),this.elementIsWrapper=!0,this.element.css({marginLeft:this.originalElement.css("marginLeft"),marginTop:this.originalElement.css("marginTop"),marginRight:this.originalElement.css("marginRight"),marginBottom:this.originalElement.css("marginBottom")}),this.originalElement.css({marginLeft:0,marginTop:0,marginRight:0,marginBottom:0}),this.originalResizeStyle=this.originalElement.css("resize"),this.originalElement.css("resize","none"),this._proportionallyResizeElements.push(this.originalElement.css({position:"static",zoom:1,display:"block"})),this.originalElement.css({margin:this.originalElement.css("margin")}),this._proportionallyResize),this.handles=r.handles||(e(".ui-resizable-handle",this.element).length?{n:".ui-resizable-n",e:".ui-resizable-e",s:".ui-resizable-s",w:".ui-resizable-w",se:".ui-resizable-se",sw:".ui-resizable-sw",ne:".ui-resizable-ne",nw:".ui-resizable-nw"}:"e,s,se"),this._handles=e,this.handles.constructor===String)for("all"===this.handles&&(this.handles="n,e,s,w,se,sw,ne,nw"),t=this.handles.split(","),this.handles={},i=0;t.length>i;i++)s=e.trim(t[i]),a="ui-resizable-"+s,n=e("<div class='ui-resizable-handle "+a+"'> "),n.css({zIndex:r.zIndex}),"se"===s&&n.addClass("ui-icon ui-icon-gripsmall-diagonal-se"),this.handles[s]=".ui-resizable-"+s,this.element.append(n);this._renderAxis=function(t){var i,s,n,a;t=t||this.element;for(i in this.handles)this.handles[i].constructor===String?this.handles[i]=this.element.children(this.handles[i]).first.show:(this.handles[i].jquery||this.handles[i].nodeType)&&(this.handles[i]=e(this.handles[i]),this._on(this.handles[i],{mousedown:o._mouseDown})),this.elementIsWrapper&&this.originalElement[0].nodeName.match(/^(textarea|input|select|button)$/i)&&(s=e(this.handles[i],this.element),a=/sw|ne|nw|se|n|s/.test(i)?s.outerHeight:s.outerWidth,n=["padding",/ne|nw|n/.test(i)?"Top":/se|sw|s/.test(i)?"Bottom":/^e$/.test(i)?"Right":"Left"].join(""),t.css(n,a),this._proportionallyResize),this._handles=this._handles.add(this.handles[i])},this._renderAxis(this.element),this._handles=this._handles.add(this.element.find(".ui-resizable-handle")),this._handles.disableSelection,this._handles.mouseover(function{o.resizing||(this.className&&(n=this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i)),o.axis=n&&n[1]?n[1]:"se")}),r.autoHide&&(this._handles.hide,e(this.element).addClass("ui-resizable-autohide").mouseenter(function{r.disabled||(e(this).removeClass("ui-resizable-autohide"),o._handles.show)}).mouseleave(function{r.disabled||o.resizing||(e(this).addClass("ui-resizable-autohide"),o._handles.hide)})),this._mouseInit},_destroy:function{this._mouseDestroy;var t,i=function(t){e(t).removeClass("ui-resizable ui-resizable-disabled ui-resizable-resizing").removeData("resizable").removeData("ui-resizable").unbind(".resizable").find(".ui-resizable-handle").remove};return this.elementIsWrapper&&(i(this.element),t=this.element,this.originalElement.css({position:t.css("position"),width:t.outerWidth,height:t.outerHeight,top:t.css("top"),left:t.css("left")}).insertAfter(t),t.remove),this.originalElement.css("resize",this.originalResizeStyle),i(this.originalElement),this},_mouseCapture:function(t){var i,s,n=!1;for(i in this.handles)s=e(this.handles[i])[0],(s===t.target||e.contains(s,t.target))&&(n=!0);return!this.options.disabled&&n},_mouseStart:function(t){var i,s,n,a=this.options,o=this.element;return this.resizing=!0,this._renderProxy,i=this._num(this.helper.css("left")),s=this._num(this.helper.css("top")),a.containment&&(i+=e(a.containment).scrollLeft||0,s+=e(a.containment).scrollTop||0),this.offset=this.helper.offset,this.position={left:i,top:s},this.size=this._helper?{width:this.helper.width,height:this.helper.height}:{width:o.width,height:o.height},this.originalSize=this._helper?{width:o.outerWidth,height:o.outerHeight}:{width:o.width,height:o.height},this.sizeDiff={width:o.outerWidth-o.width,height:o.outerHeight-o.height},this.originalPosition={left:i,top:s},this.originalMousePosition={left:t.pageX,top:t.pageY},this.aspectRatio="number"==typeof a.aspectRatio?a.aspectRatio:this.originalSize.width/this.originalSize.height||1,n=e(".ui-resizable-"+this.axis).css("cursor"),e("body").css("cursor","auto"===n?this.axis+"-resize":n),o.addClass("ui-resizable-resizing"),this._propagate("start",t),!0},_mouseDrag:function(t){var i,s,n=this.originalMousePosition,a=this.axis,o=t.pageX-n.left||0,r=t.pageY-n.top||0,h=this._change[a];return this._updatePrevProperties,h?(i=h.apply(this,[t,o,r]),this._updateVirtualBoundaries(t.shiftKey),(this._aspectRatio||t.shiftKey)&&(i=this._updateRatio(i,t)),i=this._respectSize(i,t),this._updateCache(i),this._propagate("resize",t),s=this._applyChanges,!this._helper&&this._proportionallyResizeElements.length&&this._proportionallyResize,e.isEmptyObject(s)||(this._updatePrevProperties,this._trigger("resize",t,this.ui),this._applyChanges),!1):!1},_mouseStop:function(t){this.resizing=!1;var i,s,n,a,o,r,h,l=this.options,u=this;return this._helper&&(i=this._proportionallyResizeElements,s=i.length&&/textarea/i.test(i[0].nodeName),n=s&&this._hasScroll(i[0],"left")?0:u.sizeDiff.height,a=s?0:u.sizeDiff.width,o={width:u.helper.width-a,height:u.helper.height-n},r=parseInt(u.element.css("left"),10)+(u.position.left-u.originalPosition.left)||null,h=parseInt(u.element.css("top"),10)+(u.position.top-u.originalPosition.top)||null,l.animate||this.element.css(e.extend(o,{top:h,left:r})),u.helper.height(u.size.height),u.helper.width(u.size.width),this._helper&&!l.animate&&this._proportionallyResize),e("body").css("cursor","auto"),this.element.removeClass("ui-resizable-resizing"),this._propagate("stop",t),this._helper&&this.helper.remove,!1},_updatePrevProperties:function{this.prevPosition={top:this.position.top,left:this.position.left},this.prevSize={width:this.size.width,height:this.size.height}},_applyChanges:function{var e={};return this.position.top!==this.prevPosition.top&&(e.top=this.position.top+"px"),this.position.left!==this.prevPosition.left&&(e.left=this.position.left+"px"),this.size.width!==this.prevSize.width&&(e.width=this.size.width+"px"),this.size.height!==this.prevSize.height&&(e.height=this.size.height+"px"),this.helper.css(e),e},_updateVirtualBoundaries:function(e){var t,i,s,n,a,o=this.options;a={minWidth:this._isNumber(o.minWidth)?o.minWidth:0,maxWidth:this._isNumber(o.maxWidth)?o.maxWidth:1/0,minHeight:this._isNumber(o.minHeight)?o.minHeight:0,maxHeight:this._isNumber(o.maxHeight)?o.maxHeight:1/0},(this._aspectRatio||e)&&(t=a.minHeight*this.aspectRatio,s=a.minWidth/this.aspectRatio,i=a.maxHeight*this.aspectRatio,n=a.maxWidth/this.aspectRatio,t>a.minWidth&&(a.minWidth=t),s>a.minHeight&&(a.minHeight=s),a.maxWidth>i&&(a.maxWidth=i),a.maxHeight>n&&(a.maxHeight=n)),this._vBoundaries=a},_updateCache:function(e){this.offset=this.helper.offset,this._isNumber(e.left)&&(this.position.left=e.left),this._isNumber(e.top)&&(this.position.top=e.top),this._isNumber(e.height)&&(this.size.height=e.height),this._isNumber(e.width)&&(this.size.width=e.width)},_updateRatio:function(e){var t=this.position,i=this.size,s=this.axis;return this._isNumber(e.height)?e.width=e.height*this.aspectRatio:this._isNumber(e.width)&&(e.height=e.width/this.aspectRatio),"sw"===s&&(e.left=t.left+(i.width-e.width),e.top=null),"nw"===s&&(e.top=t.top+(i.height-e.height),e.left=t.left+(i.width-e.width)),e},_respectSize:function(e){var t=this._vBoundaries,i=this.axis,s=this._isNumber(e.width)&&t.maxWidth&&t.maxWidth<e.width,n=this._isNumber(e.height)&&t.maxHeight&&t.maxHeight<e.height,a=this._isNumber(e.width)&&t.minWidth&&t.minWidth>e.width,o=this._isNumber(e.height)&&t.minHeight&&t.minHeight>e.height,r=this.originalPosition.left+this.originalSize.width,h=this.position.top+this.size.height,l=/sw|nw|w/.test(i),u=/nw|ne|n/.test(i);return a&&(e.width=t.minWidth),o&&(e.height=t.minHeight),s&&(e.width=t.maxWidth),n&&(e.height=t.maxHeight),a&&l&&(e.left=r-t.minWidth),s&&l&&(e.left=r-t.maxWidth),o&&u&&(e.top=h-t.minHeight),n&&u&&(e.top=h-t.maxHeight),e.width||e.height||e.left||!e.top?e.width||e.height||e.top||!e.left||(e.left=null):e.top=null,e},_getPaddingPlusBorderDimensions:function(e){for(var t=0,i=[],s=[e.css("borderTopWidth"),e.css("borderRightWidth"),e.css("borderBottomWidth"),e.css("borderLeftWidth")],n=[e.css("paddingTop"),e.css("paddingRight"),e.css("paddingBottom"),e.css("paddingLeft")];4>t;t++)i[t]=parseInt(s[t],10)||0,i[t]+=parseInt(n[t],10)||0;return{height:i[0]+i[2],width:i[1]+i[3]}},_proportionallyResize:function{if(this._proportionallyResizeElements.length)for(var e,t=0,i=this.helper||this.element;this._proportionallyResizeElements.length>t;t++)e=this._proportionallyResizeElements[t],this.outerDimensions||(this.outerDimensions=this._getPaddingPlusBorderDimensions(e)),e.css({height:i.height-this.outerDimensions.height||0,width:i.width-this.outerDimensions.width||0})},_renderProxy:function{var t=this.element,i=this.options;this.elementOffset=t.offset,this._helper?(this.helper=this.helper||e(" "),this.helper.addClass(this._helper).css({width:this.element.outerWidth-1,height:this.element.outerHeight-1,position:"absolute",left:this.elementOffset.left+"px",top:this.elementOffset.top+"px",zIndex:++i.zIndex}),this.helper.appendTo("body").disableSelection):this.helper=this.element},_change:{e:function(e,t){return{width:this.originalSize.width+t}},w:function(e,t){var i=this.originalSize,s=this.originalPosition;return{left:s.left+t,width:i.width-t}},n:function(e,t,i){var s=this.originalSize,n=this.originalPosition;return{top:n.top+i,height:s.height-i}},s:function(e,t,i){return{height:this.originalSize.height+i}},se:function(t,i,s){return e.extend(this._change.s.apply(this,arguments),this._change.e.apply(this,[t,i,s]))},sw:function(t,i,s){return e.extend(this._change.s.apply(this,arguments),this._change.w.apply(this,[t,i,s]))},ne:function(t,i,s){return e.extend(this._change.n.apply(this,arguments),this._change.e.apply(this,[t,i,s]))},nw:function(t,i,s){return e.extend(this._change.n.apply(this,arguments),this._change.w.apply(this,[t,i,s]))}},_propagate:function(t,i){e.ui.plugin.call(this,t,[i,this.ui]),"resize"!==t&&this._trigger(t,i,this.ui)},plugins:{},ui:function{return{originalElement:this.originalElement,element:this.element,helper:this.helper,position:this.position,size:this.size,originalSize:this.originalSize,originalPosition:this.originalPosition}}}),e.ui.plugin.add("resizable","animate",{stop:function(t){var i=e(this).resizable("instance"),s=i.options,n=i._proportionallyResizeElements,a=n.length&&/textarea/i.test(n[0].nodeName),o=a&&i._hasScroll(n[0],"left")?0:i.sizeDiff.height,r=a?0:i.sizeDiff.width,h={width:i.size.width-r,height:i.size.height-o},l=parseInt(i.element.css("left"),10)+(i.position.left-i.originalPosition.left)||null,u=parseInt(i.element.css("top"),10)+(i.position.top-i.originalPosition.top)||null;i.element.animate(e.extend(h,u&&l?{top:u,left:l}:{}),{duration:s.animateDuration,easing:s.animateEasing,step:function{var s={width:parseInt(i.element.css("width"),10),height:parseInt(i.element.css("height"),10),top:parseInt(i.element.css("top"),10),left:parseInt(i.element.css("left"),10)};n&&n.length&&e(n[0]).css({width:s.width,height:s.height}),i._updateCache(s),i._propagate("resize",t)}})}}),e.ui.plugin.add("resizable","containment",{start:function{var t,i,s,n,a,o,r,h=e(this).resizable("instance"),l=h.options,u=h.element,d=l.containment,c=d instanceof e?d.get(0):/parent/.test(d)?u.parent.get(0):d;c&&(h.containerElement=e(c),/document/.test(d)||d===document?(h.containerOffset={left:0,top:0},h.containerPosition={left:0,top:0},h.parentData={element:e(document),left:0,top:0,width:e(document).width,height:e(document).height||document.body.parentNode.scrollHeight}):(t=e(c),i=[],e(["Top","Right","Left","Bottom"]).each(function(e,s){i[e]=h._num(t.css("padding"+s))}),h.containerOffset=t.offset,h.containerPosition=t.position,h.containerSize={height:t.innerHeight-i[3],width:t.innerWidth-i[1]},s=h.containerOffset,n=h.containerSize.height,a=h.containerSize.width,o=h._hasScroll(c,"left")?c.scrollWidth:a,r=h._hasScroll(c)?c.scrollHeight:n,h.parentData={element:c,left:s.left,top:s.top,width:o,height:r}))},resize:function(t){var i,s,n,a,o=e(this).resizable("instance"),r=o.options,h=o.containerOffset,l=o.position,u=o._aspectRatio||t.shiftKey,d={top:0,left:0},c=o.containerElement,p=!0;c[0]!==document&&/static/.test(c.css("position"))&&(d=h),l.left<(o._helper?h.left:0)&&(o.size.width=o.size.width+(o._helper?o.position.left-h.left:o.position.left-d.left),u&&(o.size.height=o.size.width/o.aspectRatio,p=!1),o.position.left=r.helper?h.left:0),l.top<(o._helper?h.top:0)&&(o.size.height=o.size.height+(o._helper?o.position.top-h.top:o.position.top),u&&(o.size.width=o.size.height*o.aspectRatio,p=!1),o.position.top=o._helper?h.top:0),n=o.containerElement.get(0)===o.element.parent.get(0),a=/relative|absolute/.test(o.containerElement.css("position")),n&&a?(o.offset.left=o.parentData.left+o.position.left,o.offset.top=o.parentData.top+o.position.top):(o.offset.left=o.element.offset.left,o.offset.top=o.element.offset.top),i=Math.abs(o.sizeDiff.width+(o._helper?o.offset.left-d.left:o.offset.left-h.left)),s=Math.abs(o.sizeDiff.height+(o._helper?o.offset.top-d.top:o.offset.top-h.top)),i+o.size.width>=o.parentData.width&&(o.size.width=o.parentData.width-i,u&&(o.size.height=o.size.width/o.aspectRatio,p=!1)),s+o.size.height>=o.parentData.height&&(o.size.height=o.parentData.height-s,u&&(o.size.width=o.size.height*o.aspectRatio,p=!1)),p||(o.position.left=o.prevPosition.left,o.position.top=o.prevPosition.top,o.size.width=o.prevSize.width,o.size.height=o.prevSize.height)},stop:function{var t=e(this).resizable("instance"),i=t.options,s=t.containerOffset,n=t.containerPosition,a=t.containerElement,o=e(t.helper),r=o.offset,h=o.outerWidth-t.sizeDiff.width,l=o.outerHeight-t.sizeDiff.height;t._helper&&!i.animate&&/relative/.test(a.css("position"))&&e(this).css({left:r.left-n.left-s.left,width:h,height:l}),t._helper&&!i.animate&&/static/.test(a.css("position"))&&e(this).css({left:r.left-n.left-s.left,width:h,height:l})}}),e.ui.plugin.add("resizable","alsoResize",{start:function{var t=e(this).resizable("instance"),i=t.options;e(i.alsoResize).each(function{var t=e(this);t.data("ui-resizable-alsoresize",{width:parseInt(t.width,10),height:parseInt(t.height,10),left:parseInt(t.css("left"),10),top:parseInt(t.css("top"),10)})})},resize:function(t,i){var s=e(this).resizable("instance"),n=s.options,a=s.originalSize,o=s.originalPosition,r={height:s.size.height-a.height||0,width:s.size.width-a.width||0,top:s.position.top-o.top||0,left:s.position.left-o.left||0};e(n.alsoResize).each(function{var t=e(this),s=e(this).data("ui-resizable-alsoresize"),n={},a=t.parents(i.originalElement[0]).length?["width","height"]:["width","height","top","left"];e.each(a,function(e,t){var i=(s[t]||0)+(r[t]||0);i&&i>=0&&(n[t]=i||null)}),t.css(n)})},stop:function{e(this).removeData("resizable-alsoresize")}}),e.ui.plugin.add("resizable","ghost",{start:function{var t=e(this).resizable("instance"),i=t.options,s=t.size;t.ghost=t.originalElement.clone,t.ghost.css({opacity:.25,display:"block",position:"relative",height:s.height,width:s.width,margin:0,left:0,top:0}).addClass("ui-resizable-ghost").addClass("string"==typeof i.ghost?i.ghost:""),t.ghost.appendTo(t.helper)},resize:function{var t=e(this).resizable("instance");t.ghost&&t.ghost.css({position:"relative",height:t.size.height,width:t.size.width})},stop:function{var t=e(this).resizable("instance");t.ghost&&t.helper&&t.helper.get(0).removeChild(t.ghost.get(0))}}),e.ui.plugin.add("resizable","grid",{resize:function{var t,i=e(this).resizable("instance"),s=i.options,n=i.size,a=i.originalSize,o=i.originalPosition,r=i.axis,h="number"==typeof s.grid?[s.grid,s.grid]:s.grid,l=h[0]||1,u=h[1]||1,d=Math.round((n.width-a.width)/l)*l,c=Math.round((n.height-a.height)/u)*u,p=a.width+d,f=a.height+c,m=s.maxWidth&&p>s.maxWidth,g=s.maxHeight&&f>s.maxHeight,v=s.minWidth&&s.minWidth>p,y=s.minHeight&&s.minHeight>f;s.grid=h,v&&(p+=l),y&&(f+=u),m&&(p-=l),g&&(f-=u),/^(se|s|e)$/.test(r)?(i.size.width=p,i.size.height=f):/^(ne)$/.test(r)?(i.size.width=p,i.size.height=f,i.position.top=o.top-c):/^(sw)$/.test(r)?(i.size.width=p,i.size.height=f,i.position.left=o.left-d):((0>=f-u||0>=p-l)&&(t=i._getPaddingPlusBorderDimensions(this)),f-u>0?(i.size.height=f,i.position.top=o.top-c):(f=u-t.height,i.size.height=f,i.position.top=o.top+a.height-f),p-l>0?(i.size.width=p,i.position.left=o.left-d):(p=l-t.width,i.size.width=p,i.position.left=o.left+a.width-p))}}),e.ui.resizable,e.widget("ui.dialog",{version:"1.11.4",options:{appendTo:"body",autoOpen:!0,buttons:[],closeOnEscape:!0,closeText:"Close",dialogClass:"",draggable:!0,hide:null,height:"auto",maxHeight:null,maxWidth:null,minHeight:150,minWidth:150,modal:!1,position:{my:"center",at:"center",of:window,collision:"fit",using:function(t){var i=e(this).css(t).offset.top;0>i&&e(this).css("top",t.top-i)}},resizable:!0,show:null,title:null,width:300,beforeClose:null,close:null,drag:null,dragStart:null,dragStop:null,focus:null,open:null,resize:null,resizeStart:null,resizeStop:null},sizeRelatedOptions:{buttons:!0,height:!0,maxHeight:!0,maxWidth:!0,minHeight:!0,minWidth:!0,width:!0},resizableRelatedOptions:{maxHeight:!0,maxWidth:!0,minHeight:!0,minWidth:!0},_create:function{this.originalCss={display:this.element[0].style.display,width:this.element[0].style.width,minHeight:this.element[0].style.minHeight,maxHeight:this.element[0].style.maxHeight,height:this.element[0].style.height},this.originalPosition={parent:this.element.parent,index:this.element.parent.children.index(this.element)},this.originalTitle=this.element.attr("title"),this.options.title=this.options.title||this.originalTitle,this._createWrapper,this.element.show.removeAttr("title").addClass("ui-dialog-content ui-widget-content").appendTo(this.uiDialog),this._createTitlebar,this._createButtonPane,this.options.draggable&&e.fn.draggable&&this._makeDraggable,this.options.resizable&&e.fn.resizable&&this._makeResizable,this._isOpen=!1,this._trackFocus},_init:function{this.options.autoOpen&&this.open},_appendTo:function{var t=this.options.appendTo;return t&&(t.jquery||t.nodeType)?e(t):this.document.find(t||"body").eq(0)},_destroy:function{var e,t=this.originalPosition;this._untrackInstance,this._destroyOverlay,this.element.removeUniqueId.removeClass("ui-dialog-content ui-widget-content").css(this.originalCss).detach,this.uiDialog.stop(!0,!0).remove,this.originalTitle&&this.element.attr("title",this.originalTitle),e=t.parent.children.eq(t.index),e.length&&e[0]!==this.element[0]?e.before(this.element):t.parent.append(this.element)},widget:function{return this.uiDialog},disable:e.noop,enable:e.noop,close:function(t){var i,s=this;if(this._isOpen&&this._trigger("beforeClose",t)!==!1){if(this._isOpen=!1,this._focusedElement=null,this._destroyOverlay,this._untrackInstance,!this.opener.filter(":focusable").focus.length)try{i=this.document[0].activeElement,i&&"body"!==i.nodeName.toLowerCase&&e(i).blur}catch(n){}this._hide(this.uiDialog,this.options.hide,function{s._trigger("close",t)})}},isOpen:function{return this._isOpen},moveToTop:function{this._moveToTop},_moveToTop:function(t,i){var s=!1,n=this.uiDialog.siblings(".ui-front:visible").map(function{return+e(this).css("z-index")}).get,a=Math.max.apply(null,n);return a>=+this.uiDialog.css("z-index")&&(this.uiDialog.css("z-index",a+1),s=!0),s&&!i&&this._trigger("focus",t),s},open:function{var t=this;return this._isOpen?(this._moveToTop&&this._focusTabbable,void 0):(this._isOpen=!0,this.opener=e(this.document[0].activeElement),this._size,this._position,this._createOverlay,this._moveToTop(null,!0),this.overlay&&this.overlay.css("z-index",this.uiDialog.css("z-index")-1),this._show(this.uiDialog,this.options.show,function{t._focusTabbable,t._trigger("focus")}),this._makeFocusTarget,this._trigger("open"),void 0)},_focusTabbable:function{var e=this._focusedElement;e||(e=this.element.find("[autofocus]")),e.length||(e=this.element.find(":tabbable")),e.length||(e=this.uiDialogButtonPane.find(":tabbable")),e.length||(e=this.uiDialogTitlebarClose.filter(":tabbable")),e.length||(e=this.uiDialog),e.eq(0).focus},_keepFocus:function(t){function i{var t=this.document[0].activeElement,i=this.uiDialog[0]===t||e.contains(this.uiDialog[0],t);i||this._focusTabbable}t.preventDefault,i.call(this),this._delay(i)},_createWrapper:function{this.uiDialog=e(" ").addClass("ui-dialog ui-widget ui-widget-content ui-corner-all ui-front "+this.options.dialogClass).hide.attr({tabIndex:-1,role:"dialog"}).appendTo(this._appendTo),this._on(this.uiDialog,{keydown:function(t){if(this.options.closeOnEscape&&!t.isDefaultPrevented&&t.keyCode&&t.keyCode===e.ui.keyCode.ESCAPE)return t.preventDefault,this.close(t),void 0; if(t.keyCode===e.ui.keyCode.TAB&&!t.isDefaultPrevented){var i=this.uiDialog.find(":tabbable"),s=i.filter(":first"),n=i.filter(":last");t.target!==n[0]&&t.target!==this.uiDialog[0]||t.shiftKey?t.target!==s[0]&&t.target!==this.uiDialog[0]||!t.shiftKey||(this._delay(function{n.focus}),t.preventDefault):(this._delay(function{s.focus}),t.preventDefault)}},mousedown:function(e){this._moveToTop(e)&&this._focusTabbable}}),this.element.find("[aria-describedby]").length||this.uiDialog.attr({"aria-describedby":this.element.uniqueId.attr("id")})},_createTitlebar:function{var t;this.uiDialogTitlebar=e(" ").addClass("ui-dialog-titlebar ui-widget-header ui-corner-all ui-helper-clearfix").prependTo(this.uiDialog),this._on(this.uiDialogTitlebar,{mousedown:function(t){e(t.target).closest(".ui-dialog-titlebar-close")||this.uiDialog.focus}}),this.uiDialogTitlebarClose=e("<button type='button'> ").button({label:this.options.closeText,icons:{primary:"ui-icon-closethick"},text:!1}).addClass("ui-dialog-titlebar-close").appendTo(this.uiDialogTitlebar),this._on(this.uiDialogTitlebarClose,{click:function(e){e.preventDefault,this.close(e)}}),t=e(" ").uniqueId.addClass("ui-dialog-title").prependTo(this.uiDialogTitlebar),this._title(t),this.uiDialog.attr({"aria-labelledby":t.attr("id")})},_title:function(e){this.options.title||e.html("&#160;"),e.text(this.options.title)},_createButtonPane:function{this.uiDialogButtonPane=e(" ").addClass("ui-dialog-buttonpane ui-widget-content ui-helper-clearfix"),this.uiButtonSet=e(" ").addClass("ui-dialog-buttonset").appendTo(this.uiDialogButtonPane),this._createButtons},_createButtons:function{var t=this,i=this.options.buttons;return this.uiDialogButtonPane.remove,this.uiButtonSet.empty,e.isEmptyObject(i)||e.isArray(i)&&!i.length?(this.uiDialog.removeClass("ui-dialog-buttons"),void 0):(e.each(i,function(i,s){var n,a;s=e.isFunction(s)?{click:s,text:i}:s,s=e.extend({type:"button"},s),n=s.click,s.click=function{n.apply(t.element[0],arguments)},a={icons:s.icons,text:s.showText},delete s.icons,delete s.showText,e(" ",s).button(a).appendTo(t.uiButtonSet)}),this.uiDialog.addClass("ui-dialog-buttons"),this.uiDialogButtonPane.appendTo(this.uiDialog),void 0)},_makeDraggable:function{function t(e){return{position:e.position,offset:e.offset}}var i=this,s=this.options;this.uiDialog.draggable({cancel:".ui-dialog-content, .ui-dialog-titlebar-close",handle:".ui-dialog-titlebar",containment:"document",start:function(s,n){e(this).addClass("ui-dialog-dragging"),i._blockFrames,i._trigger("dragStart",s,t(n))},drag:function(e,s){i._trigger("drag",e,t(s))},stop:function(n,a){var o=a.offset.left-i.document.scrollLeft,r=a.offset.top-i.document.scrollTop;s.position={my:"left top",at:"left"+(o>=0?"+":"")+o+" "+"top"+(r>=0?"+":"")+r,of:i.window},e(this).removeClass("ui-dialog-dragging"),i._unblockFrames,i._trigger("dragStop",n,t(a))}})},_makeResizable:function{function t(e){return{originalPosition:e.originalPosition,originalSize:e.originalSize,position:e.position,size:e.size}}var i=this,s=this.options,n=s.resizable,a=this.uiDialog.css("position"),o="string"==typeof n?n:"n,e,s,w,se,sw,ne,nw";this.uiDialog.resizable({cancel:".ui-dialog-content",containment:"document",alsoResize:this.element,maxWidth:s.maxWidth,maxHeight:s.maxHeight,minWidth:s.minWidth,minHeight:this._minHeight,handles:o,start:function(s,n){e(this).addClass("ui-dialog-resizing"),i._blockFrames,i._trigger("resizeStart",s,t(n))},resize:function(e,s){i._trigger("resize",e,t(s))},stop:function(n,a){var o=i.uiDialog.offset,r=o.left-i.document.scrollLeft,h=o.top-i.document.scrollTop;s.height=i.uiDialog.height,s.width=i.uiDialog.width,s.position={my:"left top",at:"left"+(r>=0?"+":"")+r+" "+"top"+(h>=0?"+":"")+h,of:i.window},e(this).removeClass("ui-dialog-resizing"),i._unblockFrames,i._trigger("resizeStop",n,t(a))}}).css("position",a)},_trackFocus:function{this._on(this.widget,{focusin:function(t){this._makeFocusTarget,this._focusedElement=e(t.target)}})},_makeFocusTarget:function{this._untrackInstance,this._trackingInstances.unshift(this)},_untrackInstance:function{var t=this._trackingInstances,i=e.inArray(this,t);-1!==i&&t.splice(i,1)},_trackingInstances:function{var e=this.document.data("ui-dialog-instances");return e||(e=[],this.document.data("ui-dialog-instances",e)),e},_minHeight:function{var e=this.options;return"auto"===e.height?e.minHeight:Math.min(e.minHeight,e.height)},_position:function{var e=this.uiDialog.is(":visible");e||this.uiDialog.show,this.uiDialog.position(this.options.position),e||this.uiDialog.hide},_setOptions:function(t){var i=this,s=!1,n={};e.each(t,function(e,t){i._setOption(e,t),e in i.sizeRelatedOptions&&(s=!0),e in i.resizableRelatedOptions&&(n[e]=t)}),s&&(this._size,this._position),this.uiDialog.is(":data(ui-resizable)")&&this.uiDialog.resizable("option",n)},_setOption:function(e,t){var i,s,n=this.uiDialog;"dialogClass"===e&&n.removeClass(this.options.dialogClass).addClass(t),"disabled"!==e&&(this._super(e,t),"appendTo"===e&&this.uiDialog.appendTo(this._appendTo),"buttons"===e&&this._createButtons,"closeText"===e&&this.uiDialogTitlebarClose.button({label:""+t}),"draggable"===e&&(i=n.is(":data(ui-draggable)"),i&&!t&&n.draggable("destroy"),!i&&t&&this._makeDraggable),"position"===e&&this._position,"resizable"===e&&(s=n.is(":data(ui-resizable)"),s&&!t&&n.resizable("destroy"),s&&"string"==typeof t&&n.resizable("option","handles",t),s||t===!1||this._makeResizable),"title"===e&&this._title(this.uiDialogTitlebar.find(".ui-dialog-title")))},_size:function{var e,t,i,s=this.options;this.element.show.css({width:"auto",minHeight:0,maxHeight:"none",height:0}),s.minWidth>s.width&&(s.width=s.minWidth),e=this.uiDialog.css({height:"auto",width:s.width}).outerHeight,t=Math.max(0,s.minHeight-e),i="number"==typeof s.maxHeight?Math.max(0,s.maxHeight-e):"none","auto"===s.height?this.element.css({minHeight:t,maxHeight:i,height:"auto"}):this.element.height(Math.max(0,s.height-e)),this.uiDialog.is(":data(ui-resizable)")&&this.uiDialog.resizable("option","minHeight",this._minHeight)},_blockFrames:function{this.iframeBlocks=this.document.find("iframe").map(function{var t=e(this);return e(" ").css({position:"absolute",width:t.outerWidth,height:t.outerHeight}).appendTo(t.parent).offset(t.offset)[0]})},_unblockFrames:function{this.iframeBlocks&&(this.iframeBlocks.remove,delete this.iframeBlocks)},_allowInteraction:function(t){return e(t.target).closest(".ui-dialog").length?!0:!!e(t.target).closest(".ui-datepicker").length},_createOverlay:function{if(this.options.modal){var t=!0;this._delay(function{t=!1}),this.document.data("ui-dialog-overlays")||this._on(this.document,{focusin:function(e){t||this._allowInteraction(e)||(e.preventDefault,this._trackingInstances[0]._focusTabbable)}}),this.overlay=e(" ").addClass("ui-widget-overlay ui-front").appendTo(this._appendTo),this._on(this.overlay,{mousedown:"_keepFocus"}),this.document.data("ui-dialog-overlays",(this.document.data("ui-dialog-overlays")||0)+1)}},_destroyOverlay:function{if(this.options.modal&&this.overlay){var e=this.document.data("ui-dialog-overlays")-1;e?this.document.data("ui-dialog-overlays",e):this.document.unbind("focusin").removeData("ui-dialog-overlays"),this.overlay.remove,this.overlay=null}}}),e.widget("ui.droppable",{version:"1.11.4",widgetEventPrefix:"drop",options:{accept:"*",activeClass:!1,addClasses:!0,greedy:!1,hoverClass:!1,scope:"default",tolerance:"intersect",activate:null,deactivate:null,drop:null,out:null,over:null},_create:function{var t,i=this.options,s=i.accept;this.isover=!1,this.isout=!0,this.accept=e.isFunction(s)?s:function(e){return e.is(s)},this.proportions=function{return arguments.length?(t=arguments[0],void 0):t?t:t={width:this.element[0].offsetWidth,height:this.element[0].offsetHeight}},this._addToManager(i.scope),i.addClasses&&this.element.addClass("ui-droppable")},_addToManager:function(t){e.ui.ddmanager.droppables[t]=e.ui.ddmanager.droppables[t]||[],e.ui.ddmanager.droppables[t].push(this)},_splice:function(e){for(var t=0;e.length>t;t++)e[t]===this&&e.splice(t,1)},_destroy:function{var t=e.ui.ddmanager.droppables[this.options.scope];this._splice(t),this.element.removeClass("ui-droppable ui-droppable-disabled")},_setOption:function(t,i){if("accept"===t)this.accept=e.isFunction(i)?i:function(e){return e.is(i)};else if("scope"===t){var s=e.ui.ddmanager.droppables[this.options.scope];this._splice(s),this._addToManager(i)}this._super(t,i)},_activate:function(t){var i=e.ui.ddmanager.current;this.options.activeClass&&this.element.addClass(this.options.activeClass),i&&this._trigger("activate",t,this.ui(i))},_deactivate:function(t){var i=e.ui.ddmanager.current;this.options.activeClass&&this.element.removeClass(this.options.activeClass),i&&this._trigger("deactivate",t,this.ui(i))},_over:function(t){var i=e.ui.ddmanager.current;i&&(i.currentItem||i.element)[0]!==this.element[0]&&this.accept.call(this.element[0],i.currentItem||i.element)&&(this.options.hoverClass&&this.element.addClass(this.options.hoverClass),this._trigger("over",t,this.ui(i)))},_out:function(t){var i=e.ui.ddmanager.current;i&&(i.currentItem||i.element)[0]!==this.element[0]&&this.accept.call(this.element[0],i.currentItem||i.element)&&(this.options.hoverClass&&this.element.removeClass(this.options.hoverClass),this._trigger("out",t,this.ui(i)))},_drop:function(t,i){var s=i||e.ui.ddmanager.current,n=!1;return s&&(s.currentItem||s.element)[0]!==this.element[0]?(this.element.find(":data(ui-droppable)").not(".ui-draggable-dragging").each(function{var i=e(this).droppable("instance");return i.options.greedy&&!i.options.disabled&&i.options.scope===s.options.scope&&i.accept.call(i.element[0],s.currentItem||s.element)&&e.ui.intersect(s,e.extend(i,{offset:i.element.offset}),i.options.tolerance,t)?(n=!0,!1):void 0}),n?!1:this.accept.call(this.element[0],s.currentItem||s.element)?(this.options.activeClass&&this.element.removeClass(this.options.activeClass),this.options.hoverClass&&this.element.removeClass(this.options.hoverClass),this._trigger("drop",t,this.ui(s)),this.element):!1):!1},ui:function(e){return{draggable:e.currentItem||e.element,helper:e.helper,position:e.position,offset:e.positionAbs}}}),e.ui.intersect=function{function e(e,t,i){return e>=t&&t+i>e}return function(t,i,s,n){if(!i.offset)return!1;var a=(t.positionAbs||t.position.absolute).left+t.margins.left,o=(t.positionAbs||t.position.absolute).top+t.margins.top,r=a+t.helperProportions.width,h=o+t.helperProportions.height,l=i.offset.left,u=i.offset.top,d=l+i.proportions.width,c=u+i.proportions.height;switch(s){case"fit":return a>=l&&d>=r&&o>=u&&c>=h;case"intersect":return a+t.helperProportions.width/2>l&&d>r-t.helperProportions.width/2&&o+t.helperProportions.height/2>u&&c>h-t.helperProportions.height/2;case"pointer":return e(n.pageY,u,i.proportions.height)&&e(n.pageX,l,i.proportions.width);case"touch":return(o>=u&&c>=o||h>=u&&c>=h||u>o&&h>c)&&(a>=l&&d>=a||r>=l&&d>=r||l>a&&r>d);default:return!1}}},e.ui.ddmanager={current:null,droppables:{"default":[]},prepareOffsets:function(t,i){var s,n,a=e.ui.ddmanager.droppables[t.options.scope]||[],o=i?i.type:null,r=(t.currentItem||t.element).find(":data(ui-droppable)").addBack;e:for(s=0;a.length>s;s++)if(!(a[s].options.disabled||t&&!a[s].accept.call(a[s].element[0],t.currentItem||t.element))){for(n=0;r.length>n;n++)if(r[n]===a[s].element[0]){a[s].proportions.height=0;continue e}a[s].visible="none"!==a[s].element.css("display"),a[s].visible&&("mousedown"===o&&a[s]._activate.call(a[s],i),a[s].offset=a[s].element.offset,a[s].proportions({width:a[s].element[0].offsetWidth,height:a[s].element[0].offsetHeight}))}},drop:function(t,i){var s=!1;return e.each((e.ui.ddmanager.droppables[t.options.scope]||[]).slice,function{this.options&&(!this.options.disabled&&this.visible&&e.ui.intersect(t,this,this.options.tolerance,i)&&(s=this._drop.call(this,i)||s),!this.options.disabled&&this.visible&&this.accept.call(this.element[0],t.currentItem||t.element)&&(this.isout=!0,this.isover=!1,this._deactivate.call(this,i)))}),s},dragStart:function(t,i){t.element.parentsUntil("body").bind("scroll.droppable",function{t.options.refreshPositions||e.ui.ddmanager.prepareOffsets(t,i)})},drag:function(t,i){t.options.refreshPositions&&e.ui.ddmanager.prepareOffsets(t,i),e.each(e.ui.ddmanager.droppables[t.options.scope]||[],function{if(!this.options.disabled&&!this.greedyChild&&this.visible){var s,n,a,o=e.ui.intersect(t,this,this.options.tolerance,i),r=!o&&this.isover?"isout":o&&!this.isover?"isover":null;r&&(this.options.greedy&&(n=this.options.scope,a=this.element.parents(":data(ui-droppable)").filter(function{return e(this).droppable("instance").options.scope===n}),a.length&&(s=e(a[0]).droppable("instance"),s.greedyChild="isover"===r)),s&&"isover"===r&&(s.isover=!1,s.isout=!0,s._out.call(s,i)),this[r]=!0,this["isout"===r?"isover":"isout"]=!1,this["isover"===r?"_over":"_out"].call(this,i),s&&"isout"===r&&(s.isout=!1,s.isover=!0,s._over.call(s,i)))}})},dragStop:function(t,i){t.element.parentsUntil("body").unbind("scroll.droppable"),t.options.refreshPositions||e.ui.ddmanager.prepareOffsets(t,i)}},e.ui.droppable;var y="ui-effects-",b=e;e.effects={effect:{}},function(e,t){function i(e,t,i){var s=d[t.type]||{};return null==e?i||!t.def?null:t.def:(e=s.floor?e:parseFloat(e),isNaN(e)?t.def:s.mod?(e+s.mod)%s.mod:0>e?0:e>s.max?s.max:e)}function s(i){var s=l,n=s._rgba=[];return i=i.toLowerCase,f(h,function(e,a){var o,r=a.re.exec(i),h=r&&a.parse(r),l=a.space||"rgba";return h?(o=s[l](h),s[u[l].cache]=o[u[l].cache],n=s._rgba=o._rgba,!1):t}),n.length?("0,0,0,0"===n.join&&e.extend(n,a.transparent),s):a[i]}function n(e,t,i){return i=(i+1)%1,1>6*i?e+6*(t-e)*i:1>2*i?t:2>3*i?e+6*(t-e)*(2/3-i):e}var a,o="backgroundColor borderBottomColor borderLeftColor borderRightColor borderTopColor color columnRuleColor outlineColor textDecorationColor textEmphasisColor",r=/^([\-+])=\s*(\d+\.?\d*)/,h=[{re:/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,parse:function(e){return[e[1],e[2],e[3],e[4]]}},{re:/rgba?\(\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,parse:function(e){return[2.55*e[1],2.55*e[2],2.55*e[3],e[4]]}},{re:/#([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})/,parse:function(e){return[parseInt(e[1],16),parseInt(e[2],16),parseInt(e[3],16)]}},{re:/#([a-f0-9])([a-f0-9])([a-f0-9])/,parse:function(e){return[parseInt(e[1]+e[1],16),parseInt(e[2]+e[2],16),parseInt(e[3]+e[3],16)]}},{re:/hsla?\(\s*(\d+(?:\.\d+)?)\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,space:"hsla",parse:function(e){return[e[1],e[2]/100,e[3]/100,e[4]]}}],l=e.Color=function(t,i,s,n){return new e.Color.fn.parse(t,i,s,n)},u={rgba:{props:{red:{idx:0,type:"byte"},green:{idx:1,type:"byte"},blue:{idx:2,type:"byte"}}},hsla:{props:{hue:{idx:0,type:"degrees"},saturation:{idx:1,type:"percent"},lightness:{idx:2,type:"percent"}}}},d={"byte":{floor:!0,max:255},percent:{max:1},degrees:{mod:360,floor:!0}},c=l.support={},p=e(" ")[0],f=e.each;p.style.cssText="background-color:rgba(1,1,1,.5)",c.rgba=p.style.backgroundColor.indexOf("rgba")>-1,f(u,function(e,t){t.cache="_"+e,t.props.alpha={idx:3,type:"percent",def:1}}),l.fn=e.extend(l.prototype,{parse:function(n,o,r,h){if(n===t)return this._rgba=[null,null,null,null],this;(n.jquery||n.nodeType)&&(n=e(n).css(o),o=t);var d=this,c=e.type(n),p=this._rgba=[];return o!==t&&(n=[n,o,r,h],c="array"),"string"===c?this.parse(s(n)||a._default):"array"===c?(f(u.rgba.props,function(e,t){p[t.idx]=i(n[t.idx],t)}),this):"object"===c?(n instanceof l?f(u,function(e,t){n[t.cache]&&(d[t.cache]=n[t.cache].slice)}):f(u,function(t,s){var a=s.cache;f(s.props,function(e,t){if(!d[a]&&s.to){if("alpha"===e||null==n[e])return;d[a]=s.to(d._rgba)}d[a][t.idx]=i(n[e],t,!0)}),d[a]&&0>e.inArray(null,d[a].slice(0,3))&&(d[a][3]=1,s.from&&(d._rgba=s.from(d[a])))}),this):t},is:function(e){var i=l(e),s=!0,n=this;return f(u,function(e,a){var o,r=i[a.cache];return r&&(o=n[a.cache]||a.to&&a.to(n._rgba)||[],f(a.props,function(e,i){return null!=r[i.idx]?s=r[i.idx]===o[i.idx]:t})),s}),s},_space:function{var e=[],t=this;return f(u,function(i,s){t[s.cache]&&e.push(i)}),e.pop},transition:function(e,t){var s=l(e),n=s._space,a=u[n],o=0===this.alpha?l("transparent"):this,r=o[a.cache]||a.to(o._rgba),h=r.slice;return s=s[a.cache],f(a.props,function(e,n){var a=n.idx,o=r[a],l=s[a],u=d[n.type]||{};null!==l&&(null===o?h[a]=l:(u.mod&&(l-o>u.mod/2?o+=u.mod:o-l>u.mod/2&&(o-=u.mod)),h[a]=i((l-o)*t+o,n)))}),this[n](h)},blend:function(t){if(1===this._rgba[3])return this;var i=this._rgba.slice,s=i.pop,n=l(t)._rgba;return l(e.map(i,function(e,t){return(1-s)*n[t]+s*e}))},toRgbaString:function{var t="rgba(",i=e.map(this._rgba,function(e,t){return null==e?t>2?1:0:e});return 1===i[3]&&(i.pop,t="rgb("),t+i.join+")"},toHslaString:function{var t="hsla(",i=e.map(this.hsla,function(e,t){return null==e&&(e=t>2?1:0),t&&3>t&&(e=Math.round(100*e)+"%"),e});return 1===i[3]&&(i.pop,t="hsl("),t+i.join+")"},toHexString:function(t){var i=this._rgba.slice,s=i.pop;return t&&i.push((255*s)),"#"+e.map(i,function(e){return e=(e||0).toString(16),1===e.length?"0"+e:e}).join("")},toString:function{return 0===this._rgba[3]?"transparent":this.toRgbaString}}),l.fn.parse.prototype=l.fn,u.hsla.to=function(e){if(null==e[0]||null==e[1]||null==e[2])return[null,null,null,e[3]];var t,i,s=e[0]/255,n=e[1]/255,a=e[2]/255,o=e[3],r=Math.max(s,n,a),h=Math.min(s,n,a),l=r-h,u=r+h,d=.5*u;return t=h===r?0:s===r?60*(n-a)/l+360:n===r?60*(a-s)/l+120:60*(s-n)/l+240,i=0===l?0:.5>=d?l/u:l/(2-u),[Math.round(t)%360,i,d,null==o?1:o]},u.hsla.from=function(e){if(null==e[0]||null==e[1]||null==e[2])return[null,null,null,e[3]];var t=e[0]/360,i=e[1],s=e[2],a=e[3],o=.5>=s?s*(1+i):s+i-s*i,r=2*s-o;return[Math.round(255*n(r,o,t+1/3)),Math.round(255*n(r,o,t)),Math.round(255*n(r,o,t-1/3)),a]},f(u,function(s,n){var a=n.props,o=n.cache,h=n.to,u=n.from;l.fn[s]=function(s){if(h&&!this[o]&&(this[o]=h(this._rgba)),s===t)return this[o].slice;var n,r=e.type(s),d="array"===r||"object"===r?s:arguments,c=this[o].slice;return f(a,function(e,t){var s=d["object"===r?e:t.idx];null==s&&(s=c[t.idx]),c[t.idx]=i(s,t)}),u?(n=l(u(c)),n[o]=c,n):l(c)},f(a,function(t,i){l.fn[t]||(l.fn[t]=function(n){var a,o=e.type(n),h="alpha"===t?this._hsla?"hsla":"rgba":s,l=this[h],u=l[i.idx];return"undefined"===o?u:("function"===o&&(n=n.call(this,u),o=e.type(n)),null==n&&i.empty?this:("string"===o&&(a=r.exec(n),a&&(n=u+parseFloat(a[2])*("+"===a[1]?1:-1))),l[i.idx]=n,this[h](l)))})})}),l.hook=function(t){var i=t.split(" ");f(i,function(t,i){e.cssHooks[i]={set:function(t,n){var a,o,r="";if("transparent"!==n&&("string"!==e.type(n)||(a=s(n)))){if(n=l(a||n),!c.rgba&&1!==n._rgba[3]){for(o="backgroundColor"===i?t.parentNode:t;(""===r||"transparent"===r)&&o&&o.style;)try{r=e.css(o,"backgroundColor"),o=o.parentNode}catch(h){}n=n.blend(r&&"transparent"!==r?r:"_default")}n=n.toRgbaString}try{t.style[i]=n}catch(h){}}},e.fx.step[i]=function(t){t.colorInit||(t.start=l(t.elem,i),t.end=l(t.end),t.colorInit=!0),e.cssHooks[i].set(t.elem,t.start.transition(t.end,t.pos))}})},l.hook(o),e.cssHooks.borderColor={expand:function(e){var t={};return f(["Top","Right","Bottom","Left"],function(i,s){t["border"+s+"Color"]=e}),t}},a=e.Color.names={aqua:"#00ffff",black:"#000000",blue:"#0000ff",fuchsia:"#ff00ff",gray:"#808080",green:"#008000",lime:"#00ff00",maroon:"#800000",navy:"#000080",olive:"#808000",purple:"#800080",red:"#ff0000",silver:"#c0c0c0",teal:"#008080",white:"#ffffff",yellow:"#ffff00",transparent:[null,null,null,0],_default:"#ffffff"}}(b),function{function t(t){var i,s,n=t.ownerDocument.defaultView?t.ownerDocument.defaultView.getComputedStyle(t,null):t.currentStyle,a={};if(n&&n.length&&n[0]&&n[n[0]])for(s=n.length;s--;)i=n[s],"string"==typeof n[i]&&(a[e.camelCase(i)]=n[i]);else for(i in n)"string"==typeof n[i]&&(a[i]=n[i]);return a}function i(t,i){var s,a,o={};for(s in i)a=i[s],t[s]!==a&&(n[s]||(e.fx.step[s]||!isNaN(parseFloat(a)))&&(o[s]=a));return o}var s=["add","remove","toggle"],n={border:1,borderBottom:1,borderColor:1,borderLeft:1,borderRight:1,borderTop:1,borderWidth:1,margin:1,padding:1};e.each(["borderLeftStyle","borderRightStyle","borderBottomStyle","borderTopStyle"],function(t,i){e.fx.step[i]=function(e){("none"!==e.end&&!e.setAttr||1===e.pos&&!e.setAttr)&&(b.style(e.elem,i,e.end),e.setAttr=!0)}}),e.fn.addBack||(e.fn.addBack=function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e))}),e.effects.animateClass=function(n,a,o,r){var h=e.speed(a,o,r);return this.queue(function{var a,o=e(this),r=o.attr("class")||"",l=h.children?o.find("*").addBack:o;l=l.map(function{var i=e(this);return{el:i,start:t(this)}}),a=function{e.each(s,function(e,t){n[t]&&o[t+"Class"](n[t])})},a,l=l.map(function{return this.end=t(this.el[0]),this.diff=i(this.start,this.end),this}),o.attr("class",r),l=l.map(function{var t=this,i=e.Deferred,s=e.extend({},h,{queue:!1,complete:function{i.resolve(t)}});return this.el.animate(this.diff,s),i.promise}),e.when.apply(e,l.get).done(function{a,e.each(arguments,function{var t=this.el;e.each(this.diff,function(e){t.css(e,"")})}),h.complete.call(o[0])})})},e.fn.extend({addClass:function(t){return function(i,s,n,a){return s?e.effects.animateClass.call(this,{add:i},s,n,a):t.apply(this,arguments)}}(e.fn.addClass),removeClass:function(t){return function(i,s,n,a){return arguments.length>1?e.effects.animateClass.call(this,{remove:i},s,n,a):t.apply(this,arguments)}}(e.fn.removeClass),toggleClass:function(t){return function(i,s,n,a,o){return"boolean"==typeof s||void 0===s?n?e.effects.animateClass.call(this,s?{add:i}:{remove:i},n,a,o):t.apply(this,arguments):e.effects.animateClass.call(this,{toggle:i},s,n,a)}}(e.fn.toggleClass),switchClass:function(t,i,s,n,a){return e.effects.animateClass.call(this,{add:i,remove:t},s,n,a)}})},function{function t(t,i,s,n){return e.isPlainObject(t)&&(i=t,t=t.effect),t={effect:t},null==i&&(i={}),e.isFunction(i)&&(n=i,s=null,i={}),("number"==typeof i||e.fx.speeds[i])&&(n=s,s=i,i={}),e.isFunction(s)&&(n=s,s=null),i&&e.extend(t,i),s=s||i.duration,t.duration=e.fx.off?0:"number"==typeof s?s:s in e.fx.speeds?e.fx.speeds[s]:e.fx.speeds._default,t.complete=n||i.complete,t}function i(t){return!t||"number"==typeof t||e.fx.speeds[t]?!0:"string"!=typeof t||e.effects.effect[t]?e.isFunction(t)?!0:"object"!=typeof t||t.effect?!1:!0:!0}e.extend(e.effects,{version:"1.11.4",save:function(e,t){for(var i=0;t.length>i;i++)null!==t[i]&&e.data(y+t[i],e[0].style[t[i]])},restore:function(e,t){var i,s;for(s=0;t.length>s;s++)null!==t[s]&&(i=e.data(y+t[s]),void 0===i&&(i=""),e.css(t[s],i))},setMode:function(e,t){return"toggle"===t&&(t=e.is(":hidden")?"show":"hide"),t},getBaseline:function(e,t){var i,s;switch(e[0]){case"top":i=0;break;case"middle":i=.5;break;case"bottom":i=1;break;default:i=e[0]/t.height}switch(e[1]){case"left":s=0;break;case"center":s=.5;break;case"right":s=1;break;default:s=e[1]/t.width}return{x:s,y:i}},createWrapper:function(t){if(t.parent.is(".ui-effects-wrapper"))return t.parent;var i={width:t.outerWidth(!0),height:t.outerHeight(!0),"float":t.css("float")},s=e("  ").addClass("ui-effects-wrapper").css({fontSize:"100%",background:"transparent",border:"none",margin:0,padding:0}),n={width:t.width,height:t.height},a=document.activeElement;try{a.id}catch(o){a=document.body}return t.wrap(s),(t[0]===a||e.contains(t[0],a))&&e(a).focus,s=t.parent,"static"===t.css("position")?(s.css({position:"relative"}),t.css({position:"relative"})):(e.extend(i,{position:t.css("position"),zIndex:t.css("z-index")}),e.each(["top","left","bottom","right"],function(e,s){i[s]=t.css(s),isNaN(parseInt(i[s],10))&&(i[s]="auto")}),t.css({position:"relative",top:0,left:0,right:"auto",bottom:"auto"})),t.css(n),s.css(i).show},removeWrapper:function(t){var i=document.activeElement;return t.parent.is(".ui-effects-wrapper")&&(t.parent.replaceWith(t),(t[0]===i||e.contains(t[0],i))&&e(i).focus),t},setTransition:function(t,i,s,n){return n=n||{},e.each(i,function(e,i){var a=t.cssUnit(i);a[0]>0&&(n[i]=a[0]*s+a[1])}),n}}),e.fn.extend({effect:function{function i(t){function i{e.isFunction(a)&&a.call(n[0]),e.isFunction(t)&&t}var n=e(this),a=s.complete,r=s.mode;(n.is(":hidden")?"hide"===r:"show"===r)?(n[r],i):o.call(n[0],s,i)}var s=t.apply(this,arguments),n=s.mode,a=s.queue,o=e.effects.effect[s.effect];return e.fx.off||!o?n?this[n](s.duration,s.complete):this.each(function{s.complete&&s.complete.call(this)}):a===!1?this.each(i):this.queue(a||"fx",i)},show:function(e){return function(s){if(i(s))return e.apply(this,arguments);var n=t.apply(this,arguments);return n.mode="show",this.effect.call(this,n)}}(e.fn.show),hide:function(e){return function(s){if(i(s))return e.apply(this,arguments);var n=t.apply(this,arguments);return n.mode="hide",this.effect.call(this,n)}}(e.fn.hide),toggle:function(e){return function(s){if(i(s)||"boolean"==typeof s)return e.apply(this,arguments);var n=t.apply(this,arguments);return n.mode="toggle",this.effect.call(this,n)}}(e.fn.toggle),cssUnit:function(t){var i=this.css(t),s=[];return e.each(["em","px","%","pt"],function(e,t){i.indexOf(t)>0&&(s=[parseFloat(i),t])}),s}})},function{var t={};e.each(["Quad","Cubic","Quart","Quint","Expo"],function(e,i){t[i]=function(t){return Math.pow(t,e+2)}}),e.extend(t,{Sine:function(e){return 1-Math.cos(e*Math.PI/2)},Circ:function(e){return 1-Math.sqrt(1-e*e)},Elastic:function(e){return 0===e||1===e?e:-Math.pow(2,8*(e-1))*Math.sin((80*(e-1)-7.5)*Math.PI/15)},Back:function(e){return e*e*(3*e-2)},Bounce:function(e){for(var t,i=4;((t=Math.pow(2,--i))-1)/11>e;);return 1/Math.pow(4,3-i)-7.5625*Math.pow((3*t-2)/22-e,2)}}),e.each(t,function(t,i){e.easing["easeIn"+t]=i,e.easing["easeOut"+t]=function(e){return 1-i(1-e)},e.easing["easeInOut"+t]=function(e){return.5>e?i(2*e)/2:1-i(-2*e+2)/2}})},e.effects,e.effects.effect.blind=function(t,i){var s,n,a,o=e(this),r=/up|down|vertical/,h=/up|left|vertical|horizontal/,l=["position","top","bottom","left","right","height","width"],u=e.effects.setMode(o,t.mode||"hide"),d=t.direction||"up",c=r.test(d),p=c?"height":"width",f=c?"top":"left",m=h.test(d),g={},v="show"===u;o.parent.is(".ui-effects-wrapper")?e.effects.save(o.parent,l):e.effects.save(o,l),o.show,s=e.effects.createWrapper(o).css({overflow:"hidden"}),n=s[p],a=parseFloat(s.css(f))||0,g[p]=v?n:0,m||(o.css(c?"bottom":"right",0).css(c?"top":"left","auto").css({position:"absolute"}),g[f]=v?a:n+a),v&&(s.css(p,0),m||s.css(f,a+n)),s.animate(g,{duration:t.duration,easing:t.easing,queue:!1,complete:function{"hide"===u&&o.hide,e.effects.restore(o,l),e.effects.removeWrapper(o),i}})},e.effects.effect.bounce=function(t,i){var s,n,a,o=e(this),r=["position","top","bottom","left","right","height","width"],h=e.effects.setMode(o,t.mode||"effect"),l="hide"===h,u="show"===h,d=t.direction||"up",c=t.distance,p=t.times||5,f=2*p+(u||l?1:0),m=t.duration/f,g=t.easing,v="up"===d||"down"===d?"top":"left",y="up"===d||"left"===d,b=o.queue,_=b.length;for((u||l)&&r.push("opacity"),e.effects.save(o,r),o.show,e.effects.createWrapper(o),c||(c=o["top"===v?"outerHeight":"outerWidth"]/3),u&&(a={opacity:1},a[v]=0,o.css("opacity",0).css(v,y?2*-c:2*c).animate(a,m,g)),l&&(c/=Math.pow(2,p-1)),a={},a[v]=0,s=0;p>s;s++)n={},n[v]=(y?"-=":"+=")+c,o.animate(n,m,g).animate(a,m,g),c=l?2*c:c/2;l&&(n={opacity:0},n[v]=(y?"-=":"+=")+c,o.animate(n,m,g)),o.queue(function{l&&o.hide,e.effects.restore(o,r),e.effects.removeWrapper(o),i}),_>1&&b.splice.apply(b,[1,0].concat(b.splice(_,f+1))),o.dequeue},e.effects.effect.clip=function(t,i){var s,n,a,o=e(this),r=["position","top","bottom","left","right","height","width"],h=e.effects.setMode(o,t.mode||"hide"),l="show"===h,u=t.direction||"vertical",d="vertical"===u,c=d?"height":"width",p=d?"top":"left",f={};e.effects.save(o,r),o.show,s=e.effects.createWrapper(o).css({overflow:"hidden"}),n="IMG"===o[0].tagName?s:o,a=n[c],l&&(n.css(c,0),n.css(p,a/2)),f[c]=l?a:0,f[p]=l?0:a/2,n.animate(f,{queue:!1,duration:t.duration,easing:t.easing,complete:function{l||o.hide,e.effects.restore(o,r),e.effects.removeWrapper(o),i}})},e.effects.effect.drop=function(t,i){var s,n=e(this),a=["position","top","bottom","left","right","opacity","height","width"],o=e.effects.setMode(n,t.mode||"hide"),r="show"===o,h=t.direction||"left",l="up"===h||"down"===h?"top":"left",u="up"===h||"left"===h?"pos":"neg",d={opacity:r?1:0};e.effects.save(n,a),n.show,e.effects.createWrapper(n),s=t.distance||n["top"===l?"outerHeight":"outerWidth"](!0)/2,r&&n.css("opacity",0).css(l,"pos"===u?-s:s),d[l]=(r?"pos"===u?"+=":"-=":"pos"===u?"-=":"+=")+s,n.animate(d,{queue:!1,duration:t.duration,easing:t.easing,complete:function{"hide"===o&&n.hide,e.effects.restore(n,a),e.effects.removeWrapper(n),i}})},e.effects.effect.explode=function(t,i){function s{b.push(this),b.length===d*c&&n}function n{p.css({visibility:"visible"}),e(b).remove,m||p.hide,i}var a,o,r,h,l,u,d=t.pieces?Math.round(Math.sqrt(t.pieces)):3,c=d,p=e(this),f=e.effects.setMode(p,t.mode||"hide"),m="show"===f,g=p.show.css("visibility","hidden").offset,v=Math.ceil(p.outerWidth/c),y=Math.ceil(p.outerHeight/d),b=[];for(a=0;d>a;a++)for(h=g.top+a*y,u=a-(d-1)/2,o=0;c>o;o++)r=g.left+o*v,l=o-(c-1)/2,p.clone.appendTo("body").wrap("  ").css({position:"absolute",visibility:"visible",left:-o*v,top:-a*y}).parent.addClass("ui-effects-explode").css({position:"absolute",overflow:"hidden",width:v,height:y,left:r+(m?l*v:0),top:h+(m?u*y:0),opacity:m?0:1}).animate({left:r+(m?0:l*v),top:h+(m?0:u*y),opacity:m?1:0},t.duration||500,t.easing,s)},e.effects.effect.fade=function(t,i){var s=e(this),n=e.effects.setMode(s,t.mode||"toggle");s.animate({opacity:n},{queue:!1,duration:t.duration,easing:t.easing,complete:i})},e.effects.effect.fold=function(t,i){var s,n,a=e(this),o=["position","top","bottom","left","right","height","width"],r=e.effects.setMode(a,t.mode||"hide"),h="show"===r,l="hide"===r,u=t.size||15,d=/([0-9]+)%/.exec(u),c=!!t.horizFirst,p=h!==c,f=p?["width","height"]:["height","width"],m=t.duration/2,g={},v={};e.effects.save(a,o),a.show,s=e.effects.createWrapper(a).css({overflow:"hidden"}),n=p?[s.width,s.height]:[s.height,s.width],d&&(u=parseInt(d[1],10)/100*n[l?0:1]),h&&s.css(c?{height:0,width:u}:{height:u,width:0}),g[f[0]]=h?n[0]:u,v[f[1]]=h?n[1]:0,s.animate(g,m,t.easing).animate(v,m,t.easing,function{l&&a.hide,e.effects.restore(a,o),e.effects.removeWrapper(a),i})},e.effects.effect.highlight=function(t,i){var s=e(this),n=["backgroundImage","backgroundColor","opacity"],a=e.effects.setMode(s,t.mode||"show"),o={backgroundColor:s.css("backgroundColor")};"hide"===a&&(o.opacity=0),e.effects.save(s,n),s.show.css({backgroundImage:"none",backgroundColor:t.color||"#ffff99"}).animate(o,{queue:!1,duration:t.duration,easing:t.easing,complete:function{"hide"===a&&s.hide,e.effects.restore(s,n),i}})},e.effects.effect.size=function(t,i){var s,n,a,o=e(this),r=["position","top","bottom","left","right","width","height","overflow","opacity"],h=["position","top","bottom","left","right","overflow","opacity"],l=["width","height","overflow"],u=["fontSize"],d=["borderTopWidth","borderBottomWidth","paddingTop","paddingBottom"],c=["borderLeftWidth","borderRightWidth","paddingLeft","paddingRight"],p=e.effects.setMode(o,t.mode||"effect"),f=t.restore||"effect"!==p,m=t.scale||"both",g=t.origin||["middle","center"],v=o.css("position"),y=f?r:h,b={height:0,width:0,outerHeight:0,outerWidth:0};"show"===p&&o.show,s={height:o.height,width:o.width,outerHeight:o.outerHeight,outerWidth:o.outerWidth},"toggle"===t.mode&&"show"===p?(o.from=t.to||b,o.to=t.from||s):(o.from=t.from||("show"===p?b:s),o.to=t.to||("hide"===p?b:s)),a={from:{y:o.from.height/s.height,x:o.from.width/s.width},to:{y:o.to.height/s.height,x:o.to.width/s.width}},("box"===m||"both"===m)&&(a.from.y!==a.to.y&&(y=y.concat(d),o.from=e.effects.setTransition(o,d,a.from.y,o.from),o.to=e.effects.setTransition(o,d,a.to.y,o.to)),a.from.x!==a.to.x&&(y=y.concat(c),o.from=e.effects.setTransition(o,c,a.from.x,o.from),o.to=e.effects.setTransition(o,c,a.to.x,o.to))),("content"===m||"both"===m)&&a.from.y!==a.to.y&&(y=y.concat(u).concat(l),o.from=e.effects.setTransition(o,u,a.from.y,o.from),o.to=e.effects.setTransition(o,u,a.to.y,o.to)),e.effects.save(o,y),o.show,e.effects.createWrapper(o),o.css("overflow","hidden").css(o.from),g&&(n=e.effects.getBaseline(g,s),o.from.top=(s.outerHeight-o.outerHeight)*n.y,o.from.left=(s.outerWidth-o.outerWidth)*n.x,o.to.top=(s.outerHeight-o.to.outerHeight)*n.y,o.to.left=(s.outerWidth-o.to.outerWidth)*n.x),o.css(o.from),("content"===m||"both"===m)&&(d=d.concat(["marginTop","marginBottom"]).concat(u),c=c.concat(["marginLeft","marginRight"]),l=r.concat(d).concat(c),o.find("*[width]").each(function{var i=e(this),s={height:i.height,width:i.width,outerHeight:i.outerHeight,outerWidth:i.outerWidth}; f&&e.effects.save(i,l),i.from={height:s.height*a.from.y,width:s.width*a.from.x,outerHeight:s.outerHeight*a.from.y,outerWidth:s.outerWidth*a.from.x},i.to={height:s.height*a.to.y,width:s.width*a.to.x,outerHeight:s.height*a.to.y,outerWidth:s.width*a.to.x},a.from.y!==a.to.y&&(i.from=e.effects.setTransition(i,d,a.from.y,i.from),i.to=e.effects.setTransition(i,d,a.to.y,i.to)),a.from.x!==a.to.x&&(i.from=e.effects.setTransition(i,c,a.from.x,i.from),i.to=e.effects.setTransition(i,c,a.to.x,i.to)),i.css(i.from),i.animate(i.to,t.duration,t.easing,function{f&&e.effects.restore(i,l)})})),o.animate(o.to,{queue:!1,duration:t.duration,easing:t.easing,complete:function{0===o.to.opacity&&o.css("opacity",o.from.opacity),"hide"===p&&o.hide,e.effects.restore(o,y),f||("static"===v?o.css({position:"relative",top:o.to.top,left:o.to.left}):e.each(["top","left"],function(e,t){o.css(t,function(t,i){var s=parseInt(i,10),n=e?o.to.left:o.to.top;return"auto"===i?n+"px":s+n+"px"})})),e.effects.removeWrapper(o),i}})},e.effects.effect.scale=function(t,i){var s=e(this),n=e.extend(!0,{},t),a=e.effects.setMode(s,t.mode||"effect"),o=parseInt(t.percent,10)||(0===parseInt(t.percent,10)?0:"hide"===a?0:100),r=t.direction||"both",h=t.origin,l={height:s.height,width:s.width,outerHeight:s.outerHeight,outerWidth:s.outerWidth},u={y:"horizontal"!==r?o/100:1,x:"vertical"!==r?o/100:1};n.effect="size",n.queue=!1,n.complete=i,"effect"!==a&&(n.origin=h||["middle","center"],n.restore=!0),n.from=t.from||("show"===a?{height:0,width:0,outerHeight:0,outerWidth:0}:l),n.to={height:l.height*u.y,width:l.width*u.x,outerHeight:l.outerHeight*u.y,outerWidth:l.outerWidth*u.x},n.fade&&("show"===a&&(n.from.opacity=0,n.to.opacity=1),"hide"===a&&(n.from.opacity=1,n.to.opacity=0)),s.effect(n)},e.effects.effect.puff=function(t,i){var s=e(this),n=e.effects.setMode(s,t.mode||"hide"),a="hide"===n,o=parseInt(t.percent,10)||150,r=o/100,h={height:s.height,width:s.width,outerHeight:s.outerHeight,outerWidth:s.outerWidth};e.extend(t,{effect:"scale",queue:!1,fade:!0,mode:n,complete:i,percent:a?o:100,from:a?h:{height:h.height*r,width:h.width*r,outerHeight:h.outerHeight*r,outerWidth:h.outerWidth*r}}),s.effect(t)},e.effects.effect.pulsate=function(t,i){var s,n=e(this),a=e.effects.setMode(n,t.mode||"show"),o="show"===a,r="hide"===a,h=o||"hide"===a,l=2*(t.times||5)+(h?1:0),u=t.duration/l,d=0,c=n.queue,p=c.length;for((o||!n.is(":visible"))&&(n.css("opacity",0).show,d=1),s=1;l>s;s++)n.animate({opacity:d},u,t.easing),d=1-d;n.animate({opacity:d},u,t.easing),n.queue(function{r&&n.hide,i}),p>1&&c.splice.apply(c,[1,0].concat(c.splice(p,l+1))),n.dequeue},e.effects.effect.shake=function(t,i){var s,n=e(this),a=["position","top","bottom","left","right","height","width"],o=e.effects.setMode(n,t.mode||"effect"),r=t.direction||"left",h=t.distance||20,l=t.times||3,u=2*l+1,d=Math.round(t.duration/u),c="up"===r||"down"===r?"top":"left",p="up"===r||"left"===r,f={},m={},g={},v=n.queue,y=v.length;for(e.effects.save(n,a),n.show,e.effects.createWrapper(n),f[c]=(p?"-=":"+=")+h,m[c]=(p?"+=":"-=")+2*h,g[c]=(p?"-=":"+=")+2*h,n.animate(f,d,t.easing),s=1;l>s;s++)n.animate(m,d,t.easing).animate(g,d,t.easing);n.animate(m,d,t.easing).animate(f,d/2,t.easing).queue(function{"hide"===o&&n.hide,e.effects.restore(n,a),e.effects.removeWrapper(n),i}),y>1&&v.splice.apply(v,[1,0].concat(v.splice(y,u+1))),n.dequeue},e.effects.effect.slide=function(t,i){var s,n=e(this),a=["position","top","bottom","left","right","width","height"],o=e.effects.setMode(n,t.mode||"show"),r="show"===o,h=t.direction||"left",l="up"===h||"down"===h?"top":"left",u="up"===h||"left"===h,d={};e.effects.save(n,a),n.show,s=t.distance||n["top"===l?"outerHeight":"outerWidth"](!0),e.effects.createWrapper(n).css({overflow:"hidden"}),r&&n.css(l,u?isNaN(s)?"-"+s:-s:s),d[l]=(r?u?"+=":"-=":u?"-=":"+=")+s,n.animate(d,{queue:!1,duration:t.duration,easing:t.easing,complete:function{"hide"===o&&n.hide,e.effects.restore(n,a),e.effects.removeWrapper(n),i}})},e.effects.effect.transfer=function(t,i){var s=e(this),n=e(t.to),a="fixed"===n.css("position"),o=e("body"),r=a?o.scrollTop:0,h=a?o.scrollLeft:0,l=n.offset,u={top:l.top-r,left:l.left-h,height:n.innerHeight,width:n.innerWidth},d=s.offset,c=e(" ").appendTo(document.body).addClass(t.className).css({top:d.top-r,left:d.left-h,height:s.innerHeight,width:s.innerWidth,position:a?"fixed":"absolute"}).animate(u,t.duration,t.easing,function{c.remove,i})},e.widget("ui.progressbar",{version:"1.11.4",options:{max:100,value:0,change:null,complete:null},min:0,_create:function{this.oldValue=this.options.value=this._constrainedValue,this.element.addClass("ui-progressbar ui-widget ui-widget-content ui-corner-all").attr({role:"progressbar","aria-valuemin":this.min}),this.valueDiv=e(" ").appendTo(this.element),this._refreshValue},_destroy:function{this.element.removeClass("ui-progressbar ui-widget ui-widget-content ui-corner-all").removeAttr("role").removeAttr("aria-valuemin").removeAttr("aria-valuemax").removeAttr("aria-valuenow"),this.valueDiv.remove},value:function(e){return void 0===e?this.options.value:(this.options.value=this._constrainedValue(e),this._refreshValue,void 0)},_constrainedValue:function(e){return void 0===e&&(e=this.options.value),this.indeterminate=e===!1,"number"!=typeof e&&(e=0),this.indeterminate?!1:Math.min(this.options.max,Math.max(this.min,e))},_setOptions:function(e){var t=e.value;delete e.value,this._super(e),this.options.value=this._constrainedValue(t),this._refreshValue},_setOption:function(e,t){"max"===e&&(t=Math.max(this.min,t)),"disabled"===e&&this.element.toggleClass("ui-state-disabled",!!t).attr("aria-disabled",t),this._super(e,t)},_percentage:function{return this.indeterminate?100:100*(this.options.value-this.min)/(this.options.max-this.min)},_refreshValue:function{var t=this.options.value,i=this._percentage;this.valueDiv.toggle(this.indeterminate||t>this.min).toggleClass("ui-corner-right",t===this.options.max).width(i.toFixed(0)+"%"),this.element.toggleClass("ui-progressbar-indeterminate",this.indeterminate),this.indeterminate?(this.element.removeAttr("aria-valuenow"),this.overlayDiv||(this.overlayDiv=e(" ").appendTo(this.valueDiv))):(this.element.attr({"aria-valuemax":this.options.max,"aria-valuenow":t}),this.overlayDiv&&(this.overlayDiv.remove,this.overlayDiv=null)),this.oldValue!==t&&(this.oldValue=t,this._trigger("change")),t===this.options.max&&this._trigger("complete")}}),e.widget("ui.selectable",e.ui.mouse,{version:"1.11.4",options:{appendTo:"body",autoRefresh:!0,distance:0,filter:"*",tolerance:"touch",selected:null,selecting:null,start:null,stop:null,unselected:null,unselecting:null},_create:function{var t,i=this;this.element.addClass("ui-selectable"),this.dragged=!1,this.refresh=function{t=e(i.options.filter,i.element[0]),t.addClass("ui-selectee"),t.each(function{var t=e(this),i=t.offset;e.data(this,"selectable-item",{element:this,$element:t,left:i.left,top:i.top,right:i.left+t.outerWidth,bottom:i.top+t.outerHeight,startselected:!1,selected:t.hasClass("ui-selected"),selecting:t.hasClass("ui-selecting"),unselecting:t.hasClass("ui-unselecting")})})},this.refresh,this.selectees=t.addClass("ui-selectee"),this._mouseInit,this.helper=e(" ")},_destroy:function{this.selectees.removeClass("ui-selectee").removeData("selectable-item"),this.element.removeClass("ui-selectable ui-selectable-disabled"),this._mouseDestroy},_mouseStart:function(t){var i=this,s=this.options;this.opos=[t.pageX,t.pageY],this.options.disabled||(this.selectees=e(s.filter,this.element[0]),this._trigger("start",t),e(s.appendTo).append(this.helper),this.helper.css({left:t.pageX,top:t.pageY,width:0,height:0}),s.autoRefresh&&this.refresh,this.selectees.filter(".ui-selected").each(function{var s=e.data(this,"selectable-item");s.startselected=!0,t.metaKey||t.ctrlKey||(s.$element.removeClass("ui-selected"),s.selected=!1,s.$element.addClass("ui-unselecting"),s.unselecting=!0,i._trigger("unselecting",t,{unselecting:s.element}))}),e(t.target).parents.addBack.each(function{var s,n=e.data(this,"selectable-item");return n?(s=!t.metaKey&&!t.ctrlKey||!n.$element.hasClass("ui-selected"),n.$element.removeClass(s?"ui-unselecting":"ui-selected").addClass(s?"ui-selecting":"ui-unselecting"),n.unselecting=!s,n.selecting=s,n.selected=s,s?i._trigger("selecting",t,{selecting:n.element}):i._trigger("unselecting",t,{unselecting:n.element}),!1):void 0}))},_mouseDrag:function(t){if(this.dragged=!0,!this.options.disabled){var i,s=this,n=this.options,a=this.opos[0],o=this.opos[1],r=t.pageX,h=t.pageY;return a>r&&(i=r,r=a,a=i),o>h&&(i=h,h=o,o=i),this.helper.css({left:a,top:o,width:r-a,height:h-o}),this.selectees.each(function{var i=e.data(this,"selectable-item"),l=!1;i&&i.element!==s.element[0]&&("touch"===n.tolerance?l=!(i.left>r||a>i.right||i.top>h||o>i.bottom):"fit"===n.tolerance&&(l=i.left>a&&r>i.right&&i.top>o&&h>i.bottom),l?(i.selected&&(i.$element.removeClass("ui-selected"),i.selected=!1),i.unselecting&&(i.$element.removeClass("ui-unselecting"),i.unselecting=!1),i.selecting||(i.$element.addClass("ui-selecting"),i.selecting=!0,s._trigger("selecting",t,{selecting:i.element}))):(i.selecting&&((t.metaKey||t.ctrlKey)&&i.startselected?(i.$element.removeClass("ui-selecting"),i.selecting=!1,i.$element.addClass("ui-selected"),i.selected=!0):(i.$element.removeClass("ui-selecting"),i.selecting=!1,i.startselected&&(i.$element.addClass("ui-unselecting"),i.unselecting=!0),s._trigger("unselecting",t,{unselecting:i.element}))),i.selected&&(t.metaKey||t.ctrlKey||i.startselected||(i.$element.removeClass("ui-selected"),i.selected=!1,i.$element.addClass("ui-unselecting"),i.unselecting=!0,s._trigger("unselecting",t,{unselecting:i.element})))))}),!1}},_mouseStop:function(t){var i=this;return this.dragged=!1,e(".ui-unselecting",this.element[0]).each(function{var s=e.data(this,"selectable-item");s.$element.removeClass("ui-unselecting"),s.unselecting=!1,s.startselected=!1,i._trigger("unselected",t,{unselected:s.element})}),e(".ui-selecting",this.element[0]).each(function{var s=e.data(this,"selectable-item");s.$element.removeClass("ui-selecting").addClass("ui-selected"),s.selecting=!1,s.selected=!0,s.startselected=!0,i._trigger("selected",t,{selected:s.element})}),this._trigger("stop",t),this.helper.remove,!1}}),e.widget("ui.selectmenu",{version:"1.11.4",defaultElement:" ",options:{appendTo:null,disabled:null,icons:{button:"ui-icon-triangle-1-s"},position:{my:"left top",at:"left bottom",collision:"none"},width:null,change:null,close:null,focus:null,open:null,select:null},_create:function{var e=this.element.uniqueId.attr("id");this.ids={element:e,button:e+"-button",menu:e+"-menu"},this._drawButton,this._drawMenu,this.options.disabled&&this.disable},_drawButton:function{var t=this;this.label=e("label[for='"+this.ids.element+"']").attr("for",this.ids.button),this._on(this.label,{click:function(e){this.button.focus,e.preventDefault}}),this.element.hide,this.button=e(" ",{"class":"ui-selectmenu-button ui-widget ui-state-default ui-corner-all",tabindex:this.options.disabled?-1:0,id:this.ids.button,role:"combobox","aria-expanded":"false","aria-autocomplete":"list","aria-owns":this.ids.menu,"aria-haspopup":"true"}).insertAfter(this.element),e(" ",{"class":"ui-icon "+this.options.icons.button}).prependTo(this.button),this.buttonText=e(" ",{"class":"ui-selectmenu-text"}).appendTo(this.button),this._setText(this.buttonText,this.element.find("option:selected").text),this._resizeButton,this._on(this.button,this._buttonEvents),this.button.one("focusin",function{t.menuItems||t._refreshMenu}),this._hoverable(this.button),this._focusable(this.button)},_drawMenu:function{var t=this;this.menu=e("<ul>",{"aria-hidden":"true","aria-labelledby":this.ids.button,id:this.ids.menu}),this.menuWrap=e(" ",{"class":"ui-selectmenu-menu ui-front"}).append(this.menu).appendTo(this._appendTo),this.menuInstance=this.menu.menu({role:"listbox",select:function(e,i){e.preventDefault,t._setSelection,t._select(i.item.data("ui-selectmenu-item"),e)},focus:function(e,i){var s=i.item.data("ui-selectmenu-item");null!=t.focusIndex&&s.index!==t.focusIndex&&(t._trigger("focus",e,{item:s}),t.isOpen||t._select(s,e)),t.focusIndex=s.index,t.button.attr("aria-activedescendant",t.menuItems.eq(s.index).attr("id"))}}).menu("instance"),this.menu.addClass("ui-corner-bottom").removeClass("ui-corner-all"),this.menuInstance._off(this.menu,"mouseleave"),this.menuInstance._closeOnDocumentClick=function{return!1},this.menuInstance._isDivider=function{return!1}},refresh:function{this._refreshMenu,this._setText(this.buttonText,this._getSelectedItem.text),this.options.width||this._resizeButton},_refreshMenu:function{this.menu.empty;var e,t=this.element.find("option");t.length&&(this._parseOptions(t),this._renderMenu(this.menu,this.items),this.menuInstance.refresh,this.menuItems=this.menu.find("li").not(".ui-selectmenu-optgroup"),e=this._getSelectedItem,this.menuInstance.focus(null,e),this._setAria(e.data("ui-selectmenu-item")),this._setOption("disabled",this.element.prop("disabled")))},open:function(e){this.options.disabled||(this.menuItems?(this.menu.find(".ui-state-focus").removeClass("ui-state-focus"),this.menuInstance.focus(null,this._getSelectedItem)):this._refreshMenu,this.isOpen=!0,this._toggleAttr,this._resizeMenu,this._position,this._on(this.document,this._documentClick),this._trigger("open",e))},_position:function{this.menuWrap.position(e.extend({of:this.button},this.options.position))},close:function(e){this.isOpen&&(this.isOpen=!1,this._toggleAttr,this.range=null,this._off(this.document),this._trigger("close",e))},widget:function{return this.button},menuWidget:function{return this.menu},_renderMenu:function(t,i){var s=this,n="";e.each(i,function(i,a){a.optgroup!==n&&(e("<li>",{"class":"ui-selectmenu-optgroup ui-menu-divider"+(a.element.parent("optgroup").prop("disabled")?" ui-state-disabled":""),text:a.optgroup}).appendTo(t),n=a.optgroup),s._renderItemData(t,a)})},_renderItemData:function(e,t){return this._renderItem(e,t).data("ui-selectmenu-item",t)},_renderItem:function(t,i){var s=e("<li>");return i.disabled&&s.addClass("ui-state-disabled"),this._setText(s,i.label),s.appendTo(t)},_setText:function(e,t){t?e.text(t):e.html("&#160;")},_move:function(e,t){var i,s,n=".ui-menu-item";this.isOpen?i=this.menuItems.eq(this.focusIndex):(i=this.menuItems.eq(this.element[0].selectedIndex),n+=":not(.ui-state-disabled)"),s="first"===e||"last"===e?i["first"===e?"prevAll":"nextAll"](n).eq(-1):i[e+"All"](n).eq(0),s.length&&this.menuInstance.focus(t,s)},_getSelectedItem:function{return this.menuItems.eq(this.element[0].selectedIndex)},_toggle:function(e){this[this.isOpen?"close":"open"](e)},_setSelection:function{var e;this.range&&(window.getSelection?(e=window.getSelection,e.removeAllRanges,e.addRange(this.range)):this.range.select,this.button.focus)},_documentClick:{mousedown:function(t){this.isOpen&&(e(t.target).closest(".ui-selectmenu-menu, #"+this.ids.button).length||this.close(t))}},_buttonEvents:{mousedown:function{var e;window.getSelection?(e=window.getSelection,e.rangeCount&&(this.range=e.getRangeAt(0))):this.range=document.selection.createRange},click:function(e){this._setSelection,this._toggle(e)},keydown:function(t){var i=!0;switch(t.keyCode){case e.ui.keyCode.TAB:case e.ui.keyCode.ESCAPE:this.close(t),i=!1;break;case e.ui.keyCode.ENTER:this.isOpen&&this._selectFocusedItem(t);break;case e.ui.keyCode.UP:t.altKey?this._toggle(t):this._move("prev",t);break;case e.ui.keyCode.DOWN:t.altKey?this._toggle(t):this._move("next",t);break;case e.ui.keyCode.SPACE:this.isOpen?this._selectFocusedItem(t):this._toggle(t);break;case e.ui.keyCode.LEFT:this._move("prev",t);break;case e.ui.keyCode.RIGHT:this._move("next",t);break;case e.ui.keyCode.HOME:case e.ui.keyCode.PAGE_UP:this._move("first",t);break;case e.ui.keyCode.END:case e.ui.keyCode.PAGE_DOWN:this._move("last",t);break;default:this.menu.trigger(t),i=!1}i&&t.preventDefault}},_selectFocusedItem:function(e){var t=this.menuItems.eq(this.focusIndex);t.hasClass("ui-state-disabled")||this._select(t.data("ui-selectmenu-item"),e)},_select:function(e,t){var i=this.element[0].selectedIndex;this.element[0].selectedIndex=e.index,this._setText(this.buttonText,e.label),this._setAria(e),this._trigger("select",t,{item:e}),e.index!==i&&this._trigger("change",t,{item:e}),this.close(t)},_setAria:function(e){var t=this.menuItems.eq(e.index).attr("id");this.button.attr({"aria-labelledby":t,"aria-activedescendant":t}),this.menu.attr("aria-activedescendant",t)},_setOption:function(e,t){"icons"===e&&this.button.find("span.ui-icon").removeClass(this.options.icons.button).addClass(t.button),this._super(e,t),"appendTo"===e&&this.menuWrap.appendTo(this._appendTo),"disabled"===e&&(this.menuInstance.option("disabled",t),this.button.toggleClass("ui-state-disabled",t).attr("aria-disabled",t),this.element.prop("disabled",t),t?(this.button.attr("tabindex",-1),this.close):this.button.attr("tabindex",0)),"width"===e&&this._resizeButton},_appendTo:function{var t=this.options.appendTo;return t&&(t=t.jquery||t.nodeType?e(t):this.document.find(t).eq(0)),t&&t[0]||(t=this.element.closest(".ui-front")),t.length||(t=this.document[0].body),t},_toggleAttr:function{this.button.toggleClass("ui-corner-top",this.isOpen).toggleClass("ui-corner-all",!this.isOpen).attr("aria-expanded",this.isOpen),this.menuWrap.toggleClass("ui-selectmenu-open",this.isOpen),this.menu.attr("aria-hidden",!this.isOpen)},_resizeButton:function{var e=this.options.width;e||(e=this.element.show.outerWidth,this.element.hide),this.button.outerWidth(e)},_resizeMenu:function{this.menu.outerWidth(Math.max(this.button.outerWidth,this.menu.width("").outerWidth+1))},_getCreateOptions:function{return{disabled:this.element.prop("disabled")}},_parseOptions:function(t){var i=[];t.each(function(t,s){var n=e(s),a=n.parent("optgroup");i.push({element:n,index:t,value:n.val,label:n.text,optgroup:a.attr("label")||"",disabled:a.prop("disabled")||n.prop("disabled")})}),this.items=i},_destroy:function{this.menuWrap.remove,this.button.remove,this.element.show,this.element.removeUniqueId,this.label.attr("for",this.ids.element)}}),e.widget("ui.slider",e.ui.mouse,{version:"1.11.4",widgetEventPrefix:"slide",options:{animate:!1,distance:0,max:100,min:0,orientation:"horizontal",range:!1,step:1,value:0,values:null,change:null,slide:null,start:null,stop:null},numPages:5,_create:function{this._keySliding=!1,this._mouseSliding=!1,this._animateOff=!0,this._handleIndex=null,this._detectOrientation,this._mouseInit,this._calculateNewMax,this.element.addClass("ui-slider ui-slider-"+this.orientation+" ui-widget"+" ui-widget-content"+" ui-corner-all"),this._refresh,this._setOption("disabled",this.options.disabled),this._animateOff=!1},_refresh:function{this._createRange,this._createHandles,this._setupEvents,this._refreshValue},_createHandles:function{var t,i,s=this.options,n=this.element.find(".ui-slider-handle").addClass("ui-state-default ui-corner-all"),a=" ",o=[];for(i=s.values&&s.values.length||1,n.length>i&&(n.slice(i).remove,n=n.slice(0,i)),t=n.length;i>t;t++)o.push(a);this.handles=n.add(e(o.join("")).appendTo(this.element)),this.handle=this.handles.eq(0),this.handles.each(function(t){e(this).data("ui-slider-handle-index",t)})},_createRange:function{var t=this.options,i="";t.range?(t.range===!0&&(t.values?t.values.length&&2!==t.values.length?t.values=[t.values[0],t.values[0]]:e.isArray(t.values)&&(t.values=t.values.slice(0)):t.values=[this._valueMin,this._valueMin]),this.range&&this.range.length?this.range.removeClass("ui-slider-range-min ui-slider-range-max").css({left:"",bottom:""}):(this.range=e(" ").appendTo(this.element),i="ui-slider-range ui-widget-header ui-corner-all"),this.range.addClass(i+("min"===t.range||"max"===t.range?" ui-slider-range-"+t.range:""))):(this.range&&this.range.remove,this.range=null)},_setupEvents:function{this._off(this.handles),this._on(this.handles,this._handleEvents),this._hoverable(this.handles),this._focusable(this.handles)},_destroy:function{this.handles.remove,this.range&&this.range.remove,this.element.removeClass("ui-slider ui-slider-horizontal ui-slider-vertical ui-widget ui-widget-content ui-corner-all"),this._mouseDestroy},_mouseCapture:function(t){var i,s,n,a,o,r,h,l,u=this,d=this.options;return d.disabled?!1:(this.elementSize={width:this.element.outerWidth,height:this.element.outerHeight},this.elementOffset=this.element.offset,i={x:t.pageX,y:t.pageY},s=this._normValueFromMouse(i),n=this._valueMax-this._valueMin+1,this.handles.each(function(t){var i=Math.abs(s-u.values(t));(n>i||n===i&&(t===u._lastChangedValue||u.values(t)===d.min))&&(n=i,a=e(this),o=t)}),r=this._start(t,o),r===!1?!1:(this._mouseSliding=!0,this._handleIndex=o,a.addClass("ui-state-active").focus,h=a.offset,l=!e(t.target).parents.addBack.is(".ui-slider-handle"),this._clickOffset=l?{left:0,top:0}:{left:t.pageX-h.left-a.width/2,top:t.pageY-h.top-a.height/2-(parseInt(a.css("borderTopWidth"),10)||0)-(parseInt(a.css("borderBottomWidth"),10)||0)+(parseInt(a.css("marginTop"),10)||0)},this.handles.hasClass("ui-state-hover")||this._slide(t,o,s),this._animateOff=!0,!0))},_mouseStart:function{return!0},_mouseDrag:function(e){var t={x:e.pageX,y:e.pageY},i=this._normValueFromMouse(t);return this._slide(e,this._handleIndex,i),!1},_mouseStop:function(e){return this.handles.removeClass("ui-state-active"),this._mouseSliding=!1,this._stop(e,this._handleIndex),this._change(e,this._handleIndex),this._handleIndex=null,this._clickOffset=null,this._animateOff=!1,!1},_detectOrientation:function{this.orientation="vertical"===this.options.orientation?"vertical":"horizontal"},_normValueFromMouse:function(e){var t,i,s,n,a;return"horizontal"===this.orientation?(t=this.elementSize.width,i=e.x-this.elementOffset.left-(this._clickOffset?this._clickOffset.left:0)):(t=this.elementSize.height,i=e.y-this.elementOffset.top-(this._clickOffset?this._clickOffset.top:0)),s=i/t,s>1&&(s=1),0>s&&(s=0),"vertical"===this.orientation&&(s=1-s),n=this._valueMax-this._valueMin,a=this._valueMin+s*n,this._trimAlignValue(a)},_start:function(e,t){var i={handle:this.handles[t],value:this.value};return this.options.values&&this.options.values.length&&(i.value=this.values(t),i.values=this.values),this._trigger("start",e,i)},_slide:function(e,t,i){var s,n,a;this.options.values&&this.options.values.length?(s=this.values(t?0:1),2===this.options.values.length&&this.options.range===!0&&(0===t&&i>s||1===t&&s>i)&&(i=s),i!==this.values(t)&&(n=this.values,n[t]=i,a=this._trigger("slide",e,{handle:this.handles[t],value:i,values:n}),s=this.values(t?0:1),a!==!1&&this.values(t,i))):i!==this.value&&(a=this._trigger("slide",e,{handle:this.handles[t],value:i}),a!==!1&&this.value(i))},_stop:function(e,t){var i={handle:this.handles[t],value:this.value};this.options.values&&this.options.values.length&&(i.value=this.values(t),i.values=this.values),this._trigger("stop",e,i)},_change:function(e,t){if(!this._keySliding&&!this._mouseSliding){var i={handle:this.handles[t],value:this.value};this.options.values&&this.options.values.length&&(i.value=this.values(t),i.values=this.values),this._lastChangedValue=t,this._trigger("change",e,i)}},value:function(e){return arguments.length?(this.options.value=this._trimAlignValue(e),this._refreshValue,this._change(null,0),void 0):this._value},values:function(t,i){var s,n,a;if(arguments.length>1)return this.options.values[t]=this._trimAlignValue(i),this._refreshValue,this._change(null,t),void 0;if(!arguments.length)return this._values;if(!e.isArray(arguments[0]))return this.options.values&&this.options.values.length?this._values(t):this.value;for(s=this.options.values,n=arguments[0],a=0;s.length>a;a+=1)s[a]=this._trimAlignValue(n[a]),this._change(null,a);this._refreshValue},_setOption:function(t,i){var s,n=0;switch("range"===t&&this.options.range===!0&&("min"===i?(this.options.value=this._values(0),this.options.values=null):"max"===i&&(this.options.value=this._values(this.options.values.length-1),this.options.values=null)),e.isArray(this.options.values)&&(n=this.options.values.length),"disabled"===t&&this.element.toggleClass("ui-state-disabled",!!i),this._super(t,i),t){case"orientation":this._detectOrientation,this.element.removeClass("ui-slider-horizontal ui-slider-vertical").addClass("ui-slider-"+this.orientation),this._refreshValue,this.handles.css("horizontal"===i?"bottom":"left","");break;case"value":this._animateOff=!0,this._refreshValue,this._change(null,0),this._animateOff=!1;break;case"values":for(this._animateOff=!0,this._refreshValue,s=0;n>s;s+=1)this._change(null,s);this._animateOff=!1;break;case"step":case"min":case"max":this._animateOff=!0,this._calculateNewMax,this._refreshValue,this._animateOff=!1;break;case"range":this._animateOff=!0,this._refresh,this._animateOff=!1}},_value:function{var e=this.options.value;return e=this._trimAlignValue(e)},_values:function(e){var t,i,s;if(arguments.length)return t=this.options.values[e],t=this._trimAlignValue(t);if(this.options.values&&this.options.values.length){for(i=this.options.values.slice,s=0;i.length>s;s+=1)i[s]=this._trimAlignValue(i[s]);return i}return[]},_trimAlignValue:function(e){if(this._valueMin>=e)return this._valueMin;if(e>=this._valueMax)return this._valueMax;var t=this.options.step>0?this.options.step:1,i=(e-this._valueMin)%t,s=e-i;return 2*Math.abs(i)>=t&&(s+=i>0?t:-t),parseFloat(s.toFixed(5))},_calculateNewMax:function{var e=this.options.max,t=this._valueMin,i=this.options.step,s=Math.floor(+(e-t).toFixed(this._precision)/i)*i;e=s+t,this.max=parseFloat(e.toFixed(this._precision))},_precision:function{var e=this._precisionOf(this.options.step);return null!==this.options.min&&(e=Math.max(e,this._precisionOf(this.options.min))),e},_precisionOf:function(e){var t=""+e,i=t.indexOf(".");return-1===i?0:t.length-i-1},_valueMin:function{return this.options.min},_valueMax:function{return this.max},_refreshValue:function{var t,i,s,n,a,o=this.options.range,r=this.options,h=this,l=this._animateOff?!1:r.animate,u={};this.options.values&&this.options.values.length?this.handles.each(function(s){i=100*((h.values(s)-h._valueMin)/(h._valueMax-h._valueMin)),u["horizontal"===h.orientation?"left":"bottom"]=i+"%",e(this).stop(1,1)[l?"animate":"css"](u,r.animate),h.options.range===!0&&("horizontal"===h.orientation?(0===s&&h.range.stop(1,1)[l?"animate":"css"]({left:i+"%"},r.animate),1===s&&h.range[l?"animate":"css"]({width:i-t+"%"},{queue:!1,duration:r.animate})):(0===s&&h.range.stop(1,1)[l?"animate":"css"]({bottom:i+"%"},r.animate),1===s&&h.range[l?"animate":"css"]({height:i-t+"%"},{queue:!1,duration:r.animate}))),t=i}):(s=this.value,n=this._valueMin,a=this._valueMax,i=a!==n?100*((s-n)/(a-n)):0,u["horizontal"===this.orientation?"left":"bottom"]=i+"%",this.handle.stop(1,1)[l?"animate":"css"](u,r.animate),"min"===o&&"horizontal"===this.orientation&&this.range.stop(1,1)[l?"animate":"css"]({width:i+"%"},r.animate),"max"===o&&"horizontal"===this.orientation&&this.range[l?"animate":"css"]({width:100-i+"%"},{queue:!1,duration:r.animate}),"min"===o&&"vertical"===this.orientation&&this.range.stop(1,1)[l?"animate":"css"]({height:i+"%"},r.animate),"max"===o&&"vertical"===this.orientation&&this.range[l?"animate":"css"]({height:100-i+"%"},{queue:!1,duration:r.animate}))},_handleEvents:{keydown:function(t){var i,s,n,a,o=e(t.target).data("ui-slider-handle-index");switch(t.keyCode){case e.ui.keyCode.HOME:case e.ui.keyCode.END:case e.ui.keyCode.PAGE_UP:case e.ui.keyCode.PAGE_DOWN:case e.ui.keyCode.UP:case e.ui.keyCode.RIGHT:case e.ui.keyCode.DOWN:case e.ui.keyCode.LEFT:if(t.preventDefault,!this._keySliding&&(this._keySliding=!0,e(t.target).addClass("ui-state-active"),i=this._start(t,o),i===!1))return}switch(a=this.options.step,s=n=this.options.values&&this.options.values.length?this.values(o):this.value,t.keyCode){case e.ui.keyCode.HOME:n=this._valueMin;break;case e.ui.keyCode.END:n=this._valueMax;break;case e.ui.keyCode.PAGE_UP:n=this._trimAlignValue(s+(this._valueMax-this._valueMin)/this.numPages);break;case e.ui.keyCode.PAGE_DOWN:n=this._trimAlignValue(s-(this._valueMax-this._valueMin)/this.numPages);break;case e.ui.keyCode.UP:case e.ui.keyCode.RIGHT:if(s===this._valueMax)return;n=this._trimAlignValue(s+a);break;case e.ui.keyCode.DOWN:case e.ui.keyCode.LEFT:if(s===this._valueMin)return;n=this._trimAlignValue(s-a)}this._slide(t,o,n)},keyup:function(t){var i=e(t.target).data("ui-slider-handle-index");this._keySliding&&(this._keySliding=!1,this._stop(t,i),this._change(t,i),e(t.target).removeClass("ui-state-active"))}}}),e.widget("ui.sortable",e.ui.mouse,{version:"1.11.4",widgetEventPrefix:"sort",ready:!1,options:{appendTo:"parent",axis:!1,connectWith:!1,containment:!1,cursor:"auto",cursorAt:!1,dropOnEmpty:!0,forcePlaceholderSize:!1,forceHelperSize:!1,grid:!1,handle:!1,helper:"original",items:"> *",opacity:!1,placeholder:!1,revert:!1,scroll:!0,scrollSensitivity:20,scrollSpeed:20,scope:"default",tolerance:"intersect",zIndex:1e3,activate:null,beforeStop:null,change:null,deactivate:null,out:null,over:null,receive:null,remove:null,sort:null,start:null,stop:null,update:null},_isOverAxis:function(e,t,i){return e>=t&&t+i>e},_isFloating:function(e){return/left|right/.test(e.css("float"))||/inline|table-cell/.test(e.css("display"))},_create:function{this.containerCache={},this.element.addClass("ui-sortable"),this.refresh,this.offset=this.element.offset,this._mouseInit,this._setHandleClassName,this.ready=!0},_setOption:function(e,t){this._super(e,t),"handle"===e&&this._setHandleClassName},_setHandleClassName:function{this.element.find(".ui-sortable-handle").removeClass("ui-sortable-handle"),e.each(this.items,function{(this.instance.options.handle?this.item.find(this.instance.options.handle):this.item).addClass("ui-sortable-handle")})},_destroy:function{this.element.removeClass("ui-sortable ui-sortable-disabled").find(".ui-sortable-handle").removeClass("ui-sortable-handle"),this._mouseDestroy;for(var e=this.items.length-1;e>=0;e--)this.items[e].item.removeData(this.widgetName+"-item");return this},_mouseCapture:function(t,i){var s=null,n=!1,a=this;return this.reverting?!1:this.options.disabled||"static"===this.options.type?!1:(this._refreshItems(t),e(t.target).parents.each(function{return e.data(this,a.widgetName+"-item")===a?(s=e(this),!1):void 0}),e.data(t.target,a.widgetName+"-item")===a&&(s=e(t.target)),s?!this.options.handle||i||(e(this.options.handle,s).find("*").addBack.each(function{this===t.target&&(n=!0)}),n)?(this.currentItem=s,this._removeCurrentsFromItems,!0):!1:!1)},_mouseStart:function(t,i,s){var n,a,o=this.options;if(this.currentContainer=this,this.refreshPositions,this.helper=this._createHelper(t),this._cacheHelperProportions,this._cacheMargins,this.scrollParent=this.helper.scrollParent,this.offset=this.currentItem.offset,this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left},e.extend(this.offset,{click:{left:t.pageX-this.offset.left,top:t.pageY-this.offset.top},parent:this._getParentOffset,relative:this._getRelativeOffset}),this.helper.css("position","absolute"),this.cssPosition=this.helper.css("position"),this.originalPosition=this._generatePosition(t),this.originalPageX=t.pageX,this.originalPageY=t.pageY,o.cursorAt&&this._adjustOffsetFromHelper(o.cursorAt),this.domPosition={prev:this.currentItem.prev[0],parent:this.currentItem.parent[0]},this.helper[0]!==this.currentItem[0]&&this.currentItem.hide,this._createPlaceholder,o.containment&&this._setContainment,o.cursor&&"auto"!==o.cursor&&(a=this.document.find("body"),this.storedCursor=a.css("cursor"),a.css("cursor",o.cursor),this.storedStylesheet=e(" *{ cursor: "+o.cursor+" !important; } ").appendTo(a)),o.opacity&&(this.helper.css("opacity")&&(this._storedOpacity=this.helper.css("opacity")),this.helper.css("opacity",o.opacity)),o.zIndex&&(this.helper.css("zIndex")&&(this._storedZIndex=this.helper.css("zIndex")),this.helper.css("zIndex",o.zIndex)),this.scrollParent[0]!==this.document[0]&&"HTML"!==this.scrollParent[0].tagName&&(this.overflowOffset=this.scrollParent.offset),this._trigger("start",t,this._uiHash),this._preserveHelperProportions||this._cacheHelperProportions,!s)for(n=this.containers.length-1;n>=0;n--)this.containers[n]._trigger("activate",t,this._uiHash(this)); return e.ui.ddmanager&&(e.ui.ddmanager.current=this),e.ui.ddmanager&&!o.dropBehaviour&&e.ui.ddmanager.prepareOffsets(this,t),this.dragging=!0,this.helper.addClass("ui-sortable-helper"),this._mouseDrag(t),!0},_mouseDrag:function(t){var i,s,n,a,o=this.options,r=!1;for(this.position=this._generatePosition(t),this.positionAbs=this._convertPositionTo("absolute"),this.lastPositionAbs||(this.lastPositionAbs=this.positionAbs),this.options.scroll&&(this.scrollParent[0]!==this.document[0]&&"HTML"!==this.scrollParent[0].tagName?(this.overflowOffset.top+this.scrollParent[0].offsetHeight-t.pageY<o.scrollSensitivity?this.scrollParent[0].scrollTop=r=this.scrollParent[0].scrollTop+o.scrollSpeed:t.pageY-this.overflowOffset.top<o.scrollSensitivity&&(this.scrollParent[0].scrollTop=r=this.scrollParent[0].scrollTop-o.scrollSpeed),this.overflowOffset.left+this.scrollParent[0].offsetWidth-t.pageX<o.scrollSensitivity?this.scrollParent[0].scrollLeft=r=this.scrollParent[0].scrollLeft+o.scrollSpeed:t.pageX-this.overflowOffset.left<o.scrollSensitivity&&(this.scrollParent[0].scrollLeft=r=this.scrollParent[0].scrollLeft-o.scrollSpeed)):(t.pageY-this.document.scrollTop<o.scrollSensitivity?r=this.document.scrollTop(this.document.scrollTop-o.scrollSpeed):this.window.height-(t.pageY-this.document.scrollTop)<o.scrollSensitivity&&(r=this.document.scrollTop(this.document.scrollTop+o.scrollSpeed)),t.pageX-this.document.scrollLeft<o.scrollSensitivity?r=this.document.scrollLeft(this.document.scrollLeft-o.scrollSpeed):this.window.width-(t.pageX-this.document.scrollLeft)<o.scrollSensitivity&&(r=this.document.scrollLeft(this.document.scrollLeft+o.scrollSpeed))),r!==!1&&e.ui.ddmanager&&!o.dropBehaviour&&e.ui.ddmanager.prepareOffsets(this,t)),this.positionAbs=this._convertPositionTo("absolute"),this.options.axis&&"y"===this.options.axis||(this.helper[0].style.left=this.position.left+"px"),this.options.axis&&"x"===this.options.axis||(this.helper[0].style.top=this.position.top+"px"),i=this.items.length-1;i>=0;i--)if(s=this.items[i],n=s.item[0],a=this._intersectsWithPointer(s),a&&s.instance===this.currentContainer&&n!==this.currentItem[0]&&this.placeholder[1===a?"next":"prev"][0]!==n&&!e.contains(this.placeholder[0],n)&&("semi-dynamic"===this.options.type?!e.contains(this.element[0],n):!0)){if(this.direction=1===a?"down":"up","pointer"!==this.options.tolerance&&!this._intersectsWithSides(s))break;this._rearrange(t,s),this._trigger("change",t,this._uiHash);break}return this._contactContainers(t),e.ui.ddmanager&&e.ui.ddmanager.drag(this,t),this._trigger("sort",t,this._uiHash),this.lastPositionAbs=this.positionAbs,!1},_mouseStop:function(t,i){if(t){if(e.ui.ddmanager&&!this.options.dropBehaviour&&e.ui.ddmanager.drop(this,t),this.options.revert){var s=this,n=this.placeholder.offset,a=this.options.axis,o={};a&&"x"!==a||(o.left=n.left-this.offset.parent.left-this.margins.left+(this.offsetParent[0]===this.document[0].body?0:this.offsetParent[0].scrollLeft)),a&&"y"!==a||(o.top=n.top-this.offset.parent.top-this.margins.top+(this.offsetParent[0]===this.document[0].body?0:this.offsetParent[0].scrollTop)),this.reverting=!0,e(this.helper).animate(o,parseInt(this.options.revert,10)||500,function{s._clear(t)})}else this._clear(t,i);return!1}},cancel:function{if(this.dragging){this._mouseUp({target:null}),"original"===this.options.helper?this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper"):this.currentItem.show;for(var t=this.containers.length-1;t>=0;t--)this.containers[t]._trigger("deactivate",null,this._uiHash(this)),this.containers[t].containerCache.over&&(this.containers[t]._trigger("out",null,this._uiHash(this)),this.containers[t].containerCache.over=0)}return this.placeholder&&(this.placeholder[0].parentNode&&this.placeholder[0].parentNode.removeChild(this.placeholder[0]),"original"!==this.options.helper&&this.helper&&this.helper[0].parentNode&&this.helper.remove,e.extend(this,{helper:null,dragging:!1,reverting:!1,_noFinalSort:null}),this.domPosition.prev?e(this.domPosition.prev).after(this.currentItem):e(this.domPosition.parent).prepend(this.currentItem)),this},serialize:function(t){var i=this._getItemsAsjQuery(t&&t.connected),s=[];return t=t||{},e(i).each(function{var i=(e(t.item||this).attr(t.attribute||"id")||"").match(t.expression||/(.+)[\-=_](.+)/);i&&s.push((t.key||i[1]+"[]")+"="+(t.key&&t.expression?i[1]:i[2]))}),!s.length&&t.key&&s.push(t.key+"="),s.join("&")},toArray:function(t){var i=this._getItemsAsjQuery(t&&t.connected),s=[];return t=t||{},i.each(function{s.push(e(t.item||this).attr(t.attribute||"id")||"")}),s},_intersectsWith:function(e){var t=this.positionAbs.left,i=t+this.helperProportions.width,s=this.positionAbs.top,n=s+this.helperProportions.height,a=e.left,o=a+e.width,r=e.top,h=r+e.height,l=this.offset.click.top,u=this.offset.click.left,d="x"===this.options.axis||s+l>r&&h>s+l,c="y"===this.options.axis||t+u>a&&o>t+u,p=d&&c;return"pointer"===this.options.tolerance||this.options.forcePointerForContainers||"pointer"!==this.options.tolerance&&this.helperProportions[this.floating?"width":"height"]>e[this.floating?"width":"height"]?p:t+this.helperProportions.width/2>a&&o>i-this.helperProportions.width/2&&s+this.helperProportions.height/2>r&&h>n-this.helperProportions.height/2},_intersectsWithPointer:function(e){var t="x"===this.options.axis||this._isOverAxis(this.positionAbs.top+this.offset.click.top,e.top,e.height),i="y"===this.options.axis||this._isOverAxis(this.positionAbs.left+this.offset.click.left,e.left,e.width),s=t&&i,n=this._getDragVerticalDirection,a=this._getDragHorizontalDirection;return s?this.floating?a&&"right"===a||"down"===n?2:1:n&&("down"===n?2:1):!1},_intersectsWithSides:function(e){var t=this._isOverAxis(this.positionAbs.top+this.offset.click.top,e.top+e.height/2,e.height),i=this._isOverAxis(this.positionAbs.left+this.offset.click.left,e.left+e.width/2,e.width),s=this._getDragVerticalDirection,n=this._getDragHorizontalDirection;return this.floating&&n?"right"===n&&i||"left"===n&&!i:s&&("down"===s&&t||"up"===s&&!t)},_getDragVerticalDirection:function{var e=this.positionAbs.top-this.lastPositionAbs.top;return 0!==e&&(e>0?"down":"up")},_getDragHorizontalDirection:function{var e=this.positionAbs.left-this.lastPositionAbs.left;return 0!==e&&(e>0?"right":"left")},refresh:function(e){return this._refreshItems(e),this._setHandleClassName,this.refreshPositions,this},_connectWith:function{var e=this.options;return e.connectWith.constructor===String?[e.connectWith]:e.connectWith},_getItemsAsjQuery:function(t){function i{r.push(this)}var s,n,a,o,r=[],h=[],l=this._connectWith;if(l&&t)for(s=l.length-1;s>=0;s--)for(a=e(l[s],this.document[0]),n=a.length-1;n>=0;n--)o=e.data(a[n],this.widgetFullName),o&&o!==this&&!o.options.disabled&&h.push([e.isFunction(o.options.items)?o.options.items.call(o.element):e(o.options.items,o.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"),o]);for(h.push([e.isFunction(this.options.items)?this.options.items.call(this.element,null,{options:this.options,item:this.currentItem}):e(this.options.items,this.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"),this]),s=h.length-1;s>=0;s--)h[s][0].each(i);return e(r)},_removeCurrentsFromItems:function{var t=this.currentItem.find(":data("+this.widgetName+"-item)");this.items=e.grep(this.items,function(e){for(var i=0;t.length>i;i++)if(t[i]===e.item[0])return!1;return!0})},_refreshItems:function(t){this.items=[],this.containers=[this];var i,s,n,a,o,r,h,l,u=this.items,d=e.isFunction(this.options.items)?this.options.items.call(this.element[0],t,{item:this.currentItem}):e(this.options.items,this.element),this,c=this._connectWith;if(c&&this.ready)for(i=c.length-1;i>=0;i--)for(n=e(c[i],this.document[0]),s=n.length-1;s>=0;s--)a=e.data(n[s],this.widgetFullName),a&&a!==this&&!a.options.disabled&&(d.push([e.isFunction(a.options.items)?a.options.items.call(a.element[0],t,{item:this.currentItem}):e(a.options.items,a.element),a]),this.containers.push(a));for(i=d.length-1;i>=0;i--)for(o=d[i][1],r=d[i][0],s=0,l=r.length;l>s;s++)h=e(r[s]),h.data(this.widgetName+"-item",o),u.push({item:h,instance:o,width:0,height:0,left:0,top:0})},refreshPositions:function(t){this.floating=this.items.length?"x"===this.options.axis||this._isFloating(this.items[0].item):!1,this.offsetParent&&this.helper&&(this.offset.parent=this._getParentOffset);var i,s,n,a;for(i=this.items.length-1;i>=0;i--)s=this.items[i],s.instance!==this.currentContainer&&this.currentContainer&&s.item[0]!==this.currentItem[0]||(n=this.options.toleranceElement?e(this.options.toleranceElement,s.item):s.item,t||(s.width=n.outerWidth,s.height=n.outerHeight),a=n.offset,s.left=a.left,s.top=a.top);if(this.options.custom&&this.options.custom.refreshContainers)this.options.custom.refreshContainers.call(this);else for(i=this.containers.length-1;i>=0;i--)a=this.containers[i].element.offset,this.containers[i].containerCache.left=a.left,this.containers[i].containerCache.top=a.top,this.containers[i].containerCache.width=this.containers[i].element.outerWidth,this.containers[i].containerCache.height=this.containers[i].element.outerHeight;return this},_createPlaceholder:function(t){t=t||this;var i,s=t.options;s.placeholder&&s.placeholder.constructor!==String||(i=s.placeholder,s.placeholder={element:function{var s=t.currentItem[0].nodeName.toLowerCase,n=e("<"+s+">",t.document[0]).addClass(i||t.currentItem[0].className+" ui-sortable-placeholder").removeClass("ui-sortable-helper");return"tbody"===s?t._createTrPlaceholder(t.currentItem.find("tr").eq(0),e(" ",t.document[0]).appendTo(n)):"tr"===s?t._createTrPlaceholder(t.currentItem,n):"img"===s&&n.attr("src",t.currentItem.attr("src")),i||n.css("visibility","hidden"),n},update:function(e,n){(!i||s.forcePlaceholderSize)&&(n.height||n.height(t.currentItem.innerHeight-parseInt(t.currentItem.css("paddingTop")||0,10)-parseInt(t.currentItem.css("paddingBottom")||0,10)),n.width||n.width(t.currentItem.innerWidth-parseInt(t.currentItem.css("paddingLeft")||0,10)-parseInt(t.currentItem.css("paddingRight")||0,10)))}}),t.placeholder=e(s.placeholder.element.call(t.element,t.currentItem)),t.currentItem.after(t.placeholder),s.placeholder.update(t,t.placeholder)},_createTrPlaceholder:function(t,i){var s=this;t.children.each(function{e(" &#160; ",s.document[0]).attr("colspan",e(this).attr("colspan")||1).appendTo(i)})},_contactContainers:function(t){var i,s,n,a,o,r,h,l,u,d,c=null,p=null;for(i=this.containers.length-1;i>=0;i--)if(!e.contains(this.currentItem[0],this.containers[i].element[0]))if(this._intersectsWith(this.containers[i].containerCache)){if(c&&e.contains(this.containers[i].element[0],c.element[0]))continue;c=this.containers[i],p=i}else this.containers[i].containerCache.over&&(this.containers[i]._trigger("out",t,this._uiHash(this)),this.containers[i].containerCache.over=0);if(c)if(1===this.containers.length)this.containers[p].containerCache.over||(this.containers[p]._trigger("over",t,this._uiHash(this)),this.containers[p].containerCache.over=1);else{for(n=1e4,a=null,u=c.floating||this._isFloating(this.currentItem),o=u?"left":"top",r=u?"width":"height",d=u?"clientX":"clientY",s=this.items.length-1;s>=0;s--)e.contains(this.containers[p].element[0],this.items[s].item[0])&&this.items[s].item[0]!==this.currentItem[0]&&(h=this.items[s].item.offset[o],l=!1,t[d]-h>this.items[s][r]/2&&(l=!0),n>Math.abs(t[d]-h)&&(n=Math.abs(t[d]-h),a=this.items[s],this.direction=l?"up":"down"));if(!a&&!this.options.dropOnEmpty)return;if(this.currentContainer===this.containers[p])return this.currentContainer.containerCache.over||(this.containers[p]._trigger("over",t,this._uiHash),this.currentContainer.containerCache.over=1),void 0;a?this._rearrange(t,a,null,!0):this._rearrange(t,null,this.containers[p].element,!0),this._trigger("change",t,this._uiHash),this.containers[p]._trigger("change",t,this._uiHash(this)),this.currentContainer=this.containers[p],this.options.placeholder.update(this.currentContainer,this.placeholder),this.containers[p]._trigger("over",t,this._uiHash(this)),this.containers[p].containerCache.over=1}},_createHelper:function(t){var i=this.options,s=e.isFunction(i.helper)?e(i.helper.apply(this.element[0],[t,this.currentItem])):"clone"===i.helper?this.currentItem.clone:this.currentItem;return s.parents("body").length||e("parent"!==i.appendTo?i.appendTo:this.currentItem[0].parentNode)[0].appendChild(s[0]),s[0]===this.currentItem[0]&&(this._storedCSS={width:this.currentItem[0].style.width,height:this.currentItem[0].style.height,position:this.currentItem.css("position"),top:this.currentItem.css("top"),left:this.currentItem.css("left")}),(!s[0].style.width||i.forceHelperSize)&&s.width(this.currentItem.width),(!s[0].style.height||i.forceHelperSize)&&s.height(this.currentItem.height),s},_adjustOffsetFromHelper:function(t){"string"==typeof t&&(t=t.split(" ")),e.isArray(t)&&(t={left:+t[0],top:+t[1]||0}),"left"in t&&(this.offset.click.left=t.left+this.margins.left),"right"in t&&(this.offset.click.left=this.helperProportions.width-t.right+this.margins.left),"top"in t&&(this.offset.click.top=t.top+this.margins.top),"bottom"in t&&(this.offset.click.top=this.helperProportions.height-t.bottom+this.margins.top)},_getParentOffset:function{this.offsetParent=this.helper.offsetParent;var t=this.offsetParent.offset;return"absolute"===this.cssPosition&&this.scrollParent[0]!==this.document[0]&&e.contains(this.scrollParent[0],this.offsetParent[0])&&(t.left+=this.scrollParent.scrollLeft,t.top+=this.scrollParent.scrollTop),(this.offsetParent[0]===this.document[0].body||this.offsetParent[0].tagName&&"html"===this.offsetParent[0].tagName.toLowerCase&&e.ui.ie)&&(t={top:0,left:0}),{top:t.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:t.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function{if("relative"===this.cssPosition){var e=this.currentItem.position;return{top:e.top-(parseInt(this.helper.css("top"),10)||0)+this.scrollParent.scrollTop,left:e.left-(parseInt(this.helper.css("left"),10)||0)+this.scrollParent.scrollLeft}}return{top:0,left:0}},_cacheMargins:function{this.margins={left:parseInt(this.currentItem.css("marginLeft"),10)||0,top:parseInt(this.currentItem.css("marginTop"),10)||0}},_cacheHelperProportions:function{this.helperProportions={width:this.helper.outerWidth,height:this.helper.outerHeight}},_setContainment:function{var t,i,s,n=this.options;"parent"===n.containment&&(n.containment=this.helper[0].parentNode),("document"===n.containment||"window"===n.containment)&&(this.containment=[0-this.offset.relative.left-this.offset.parent.left,0-this.offset.relative.top-this.offset.parent.top,"document"===n.containment?this.document.width:this.window.width-this.helperProportions.width-this.margins.left,("document"===n.containment?this.document.width:this.window.height||this.document[0].body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top]),/^(document|window|parent)$/.test(n.containment)||(t=e(n.containment)[0],i=e(n.containment).offset,s="hidden"!==e(t).css("overflow"),this.containment=[i.left+(parseInt(e(t).css("borderLeftWidth"),10)||0)+(parseInt(e(t).css("paddingLeft"),10)||0)-this.margins.left,i.top+(parseInt(e(t).css("borderTopWidth"),10)||0)+(parseInt(e(t).css("paddingTop"),10)||0)-this.margins.top,i.left+(s?Math.max(t.scrollWidth,t.offsetWidth):t.offsetWidth)-(parseInt(e(t).css("borderLeftWidth"),10)||0)-(parseInt(e(t).css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left,i.top+(s?Math.max(t.scrollHeight,t.offsetHeight):t.offsetHeight)-(parseInt(e(t).css("borderTopWidth"),10)||0)-(parseInt(e(t).css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top])},_convertPositionTo:function(t,i){i||(i=this.position);var s="absolute"===t?1:-1,n="absolute"!==this.cssPosition||this.scrollParent[0]!==this.document[0]&&e.contains(this.scrollParent[0],this.offsetParent[0])?this.scrollParent:this.offsetParent,a=/(html|body)/i.test(n[0].tagName);return{top:i.top+this.offset.relative.top*s+this.offset.parent.top*s-("fixed"===this.cssPosition?-this.scrollParent.scrollTop:a?0:n.scrollTop)*s,left:i.left+this.offset.relative.left*s+this.offset.parent.left*s-("fixed"===this.cssPosition?-this.scrollParent.scrollLeft:a?0:n.scrollLeft)*s}},_generatePosition:function(t){var i,s,n=this.options,a=t.pageX,o=t.pageY,r="absolute"!==this.cssPosition||this.scrollParent[0]!==this.document[0]&&e.contains(this.scrollParent[0],this.offsetParent[0])?this.scrollParent:this.offsetParent,h=/(html|body)/i.test(r[0].tagName);return"relative"!==this.cssPosition||this.scrollParent[0]!==this.document[0]&&this.scrollParent[0]!==this.offsetParent[0]||(this.offset.relative=this._getRelativeOffset),this.originalPosition&&(this.containment&&(t.pageX-this.offset.click.left<this.containment[0]&&(a=this.containment[0]+this.offset.click.left),t.pageY-this.offset.click.top<this.containment[1]&&(o=this.containment[1]+this.offset.click.top),t.pageX-this.offset.click.left>this.containment[2]&&(a=this.containment[2]+this.offset.click.left),t.pageY-this.offset.click.top>this.containment[3]&&(o=this.containment[3]+this.offset.click.top)),n.grid&&(i=this.originalPageY+Math.round((o-this.originalPageY)/n.grid[1])*n.grid[1],o=this.containment?i-this.offset.click.top>=this.containment[1]&&i-this.offset.click.top<=this.containment[3]?i:i-this.offset.click.top>=this.containment[1]?i-n.grid[1]:i+n.grid[1]:i,s=this.originalPageX+Math.round((a-this.originalPageX)/n.grid[0])*n.grid[0],a=this.containment?s-this.offset.click.left>=this.containment[0]&&s-this.offset.click.left<=this.containment[2]?s:s-this.offset.click.left>=this.containment[0]?s-n.grid[0]:s+n.grid[0]:s)),{top:o-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+("fixed"===this.cssPosition?-this.scrollParent.scrollTop:h?0:r.scrollTop),left:a-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+("fixed"===this.cssPosition?-this.scrollParent.scrollLeft:h?0:r.scrollLeft)}},_rearrange:function(e,t,i,s){i?i[0].appendChild(this.placeholder[0]):t.item[0].parentNode.insertBefore(this.placeholder[0],"down"===this.direction?t.item[0]:t.item[0].nextSibling),this.counter=this.counter?++this.counter:1;var n=this.counter;this._delay(function{n===this.counter&&this.refreshPositions(!s)})},_clear:function(e,t){function i(e,t,i){return function(s){i._trigger(e,s,t._uiHash(t))}}this.reverting=!1;var s,n=[];if(!this._noFinalSort&&this.currentItem.parent.length&&this.placeholder.before(this.currentItem),this._noFinalSort=null,this.helper[0]===this.currentItem[0]){for(s in this._storedCSS)("auto"===this._storedCSS[s]||"static"===this._storedCSS[s])&&(this._storedCSS[s]="");this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper")}else this.currentItem.show;for(this.fromOutside&&!t&&n.push(function(e){this._trigger("receive",e,this._uiHash(this.fromOutside))}),!this.fromOutside&&this.domPosition.prev===this.currentItem.prev.not(".ui-sortable-helper")[0]&&this.domPosition.parent===this.currentItem.parent[0]||t||n.push(function(e){this._trigger("update",e,this._uiHash)}),this!==this.currentContainer&&(t||(n.push(function(e){this._trigger("remove",e,this._uiHash)}),n.push(function(e){return function(t){e._trigger("receive",t,this._uiHash(this))}}.call(this,this.currentContainer)),n.push(function(e){return function(t){e._trigger("update",t,this._uiHash(this))}}.call(this,this.currentContainer)))),s=this.containers.length-1;s>=0;s--)t||n.push(i("deactivate",this,this.containers[s])),this.containers[s].containerCache.over&&(n.push(i("out",this,this.containers[s])),this.containers[s].containerCache.over=0);if(this.storedCursor&&(this.document.find("body").css("cursor",this.storedCursor),this.storedStylesheet.remove),this._storedOpacity&&this.helper.css("opacity",this._storedOpacity),this._storedZIndex&&this.helper.css("zIndex","auto"===this._storedZIndex?"":this._storedZIndex),this.dragging=!1,t||this._trigger("beforeStop",e,this._uiHash),this.placeholder[0].parentNode.removeChild(this.placeholder[0]),this.cancelHelperRemoval||(this.helper[0]!==this.currentItem[0]&&this.helper.remove,this.helper=null),!t){for(s=0;n.length>s;s++)n[s].call(this,e);this._trigger("stop",e,this._uiHash)}return this.fromOutside=!1,!this.cancelHelperRemoval},_trigger:function{e.Widget.prototype._trigger.apply(this,arguments)===!1&&this.cancel},_uiHash:function(t){var i=t||this;return{helper:i.helper,placeholder:i.placeholder||e([]),position:i.position,originalPosition:i.originalPosition,offset:i.positionAbs,item:i.currentItem,sender:t?t.element:null}}}),e.widget("ui.spinner",{version:"1.11.4",defaultElement:" ",widgetEventPrefix:"spin",options:{culture:null,icons:{down:"ui-icon-triangle-1-s",up:"ui-icon-triangle-1-n"},incremental:!0,max:null,min:null,numberFormat:null,page:10,step:1,change:null,spin:null,start:null,stop:null},_create:function{this._setOption("max",this.options.max),this._setOption("min",this.options.min),this._setOption("step",this.options.step),""!==this.value&&this._value(this.element.val,!0),this._draw,this._on(this._events),this._refresh,this._on(this.window,{beforeunload:function{this.element.removeAttr("autocomplete")}})},_getCreateOptions:function{var t={},i=this.element;return e.each(["min","max","step"],function(e,s){var n=i.attr(s);void 0!==n&&n.length&&(t[s]=n)}),t},_events:{keydown:function(e){this._start(e)&&this._keydown(e)&&e.preventDefault},keyup:"_stop",focus:function{this.previous=this.element.val},blur:function(e){return this.cancelBlur?(delete this.cancelBlur,void 0):(this._stop,this._refresh,this.previous!==this.element.val&&this._trigger("change",e),void 0)},mousewheel:function(e,t){if(t){if(!this.spinning&&!this._start(e))return!1;this._spin((t>0?1:-1)*this.options.step,e),clearTimeout(this.mousewheelTimer),this.mousewheelTimer=this._delay(function{this.spinning&&this._stop(e)},100),e.preventDefault}},"mousedown .ui-spinner-button":function(t){function i{var e=this.element[0]===this.document[0].activeElement;e||(this.element.focus,this.previous=s,this._delay(function{this.previous=s}))}var s;s=this.element[0]===this.document[0].activeElement?this.previous:this.element.val,t.preventDefault,i.call(this),this.cancelBlur=!0,this._delay(function{delete this.cancelBlur,i.call(this)}),this._start(t)!==!1&&this._repeat(null,e(t.currentTarget).hasClass("ui-spinner-up")?1:-1,t)},"mouseup .ui-spinner-button":"_stop","mouseenter .ui-spinner-button":function(t){return e(t.currentTarget).hasClass("ui-state-active")?this._start(t)===!1?!1:(this._repeat(null,e(t.currentTarget).hasClass("ui-spinner-up")?1:-1,t),void 0):void 0},"mouseleave .ui-spinner-button":"_stop"},_draw:function{var e=this.uiSpinner=this.element.addClass("ui-spinner-input").attr("autocomplete","off").wrap(this._uiSpinnerHtml).parent.append(this._buttonHtml);this.element.attr("role","spinbutton"),this.buttons=e.find(".ui-spinner-button").attr("tabIndex",-1).button.removeClass("ui-corner-all"),this.buttons.height>Math.ceil(.5*e.height)&&e.height>0&&e.height(e.height),this.options.disabled&&this.disable},_keydown:function(t){var i=this.options,s=e.ui.keyCode;switch(t.keyCode){case s.UP:return this._repeat(null,1,t),!0;case s.DOWN:return this._repeat(null,-1,t),!0;case s.PAGE_UP:return this._repeat(null,i.page,t),!0;case s.PAGE_DOWN:return this._repeat(null,-i.page,t),!0}return!1},_uiSpinnerHtml:function{return" "},_buttonHtml:function{return"<a class='ui-spinner-button ui-spinner-up ui-corner-tr'><span class='ui-icon "+this.options.icons.up+"'>&#9650; "+"</a>"+"<a class='ui-spinner-button ui-spinner-down ui-corner-br'>"+"<span class='ui-icon "+this.options.icons.down+"'>&#9660; "+"</a>"},_start:function(e){return this.spinning||this._trigger("start",e)!==!1?(this.counter||(this.counter=1),this.spinning=!0,!0):!1},_repeat:function(e,t,i){e=e||500,clearTimeout(this.timer),this.timer=this._delay(function{this._repeat(40,t,i)},e),this._spin(t*this.options.step,i)},_spin:function(e,t){var i=this.value||0;this.counter||(this.counter=1),i=this._adjustValue(i+e*this._increment(this.counter)),this.spinning&&this._trigger("spin",t,{value:i})===!1||(this._value(i),this.counter++)},_increment:function(t){var i=this.options.incremental;return i?e.isFunction(i)?i(t):Math.floor(t*t*t/5e4-t*t/500+17*t/200+1):1},_precision:function{var e=this._precisionOf(this.options.step);return null!==this.options.min&&(e=Math.max(e,this._precisionOf(this.options.min))),e},_precisionOf:function(e){var t=""+e,i=t.indexOf(".");return-1===i?0:t.length-i-1},_adjustValue:function(e){var t,i,s=this.options;return t=null!==s.min?s.min:0,i=e-t,i=Math.round(i/s.step)*s.step,e=t+i,e=parseFloat(e.toFixed(this._precision)),null!==s.max&&e>s.max?s.max:null!==s.min&&s.min>e?s.min:e},_stop:function(e){this.spinning&&(clearTimeout(this.timer),clearTimeout(this.mousewheelTimer),this.counter=0,this.spinning=!1,this._trigger("stop",e))},_setOption:function(e,t){if("culture"===e||"numberFormat"===e){var i=this._parse(this.element.val);return this.options[e]=t,this.element.val(this._format(i)),void 0}("max"===e||"min"===e||"step"===e)&&"string"==typeof t&&(t=this._parse(t)),"icons"===e&&(this.buttons.first.find(".ui-icon").removeClass(this.options.icons.up).addClass(t.up),this.buttons.last.find(".ui-icon").removeClass(this.options.icons.down).addClass(t.down)),this._super(e,t),"disabled"===e&&(this.widget.toggleClass("ui-state-disabled",!!t),this.element.prop("disabled",!!t),this.buttons.button(t?"disable":"enable"))},_setOptions:h(function(e){this._super(e)}),_parse:function(e){return"string"==typeof e&&""!==e&&(e=window.Globalize&&this.options.numberFormat?Globalize.parseFloat(e,10,this.options.culture):+e),""===e||isNaN(e)?null:e},_format:function(e){return""===e?"":window.Globalize&&this.options.numberFormat?Globalize.format(e,this.options.numberFormat,this.options.culture):e},_refresh:function{this.element.attr({"aria-valuemin":this.options.min,"aria-valuemax":this.options.max,"aria-valuenow":this._parse(this.element.val)})},isValid:function{var e=this.value;return null===e?!1:e===this._adjustValue(e)},_value:function(e,t){var i;""!==e&&(i=this._parse(e),null!==i&&(t||(i=this._adjustValue(i)),e=this._format(i))),this.element.val(e),this._refresh},_destroy:function{this.element.removeClass("ui-spinner-input").prop("disabled",!1).removeAttr("autocomplete").removeAttr("role").removeAttr("aria-valuemin").removeAttr("aria-valuemax").removeAttr("aria-valuenow"),this.uiSpinner.replaceWith(this.element)},stepUp:h(function(e){this._stepUp(e)}),_stepUp:function(e){this._start&&(this._spin((e||1)*this.options.step),this._stop)},stepDown:h(function(e){this._stepDown(e)}),_stepDown:function(e){this._start&&(this._spin((e||1)*-this.options.step),this._stop)},pageUp:h(function(e){this._stepUp((e||1)*this.options.page)}),pageDown:h(function(e){this._stepDown((e||1)*this.options.page)}),value:function(e){return arguments.length?(h(this._value).call(this,e),void 0):this._parse(this.element.val)},widget:function{return this.uiSpinner}}),e.widget("ui.tabs",{version:"1.11.4",delay:300,options:{active:null,collapsible:!1,event:"click",heightStyle:"content",hide:null,show:null,activate:null,beforeActivate:null,beforeLoad:null,load:null},_isLocal:function{var e=/#.*$/;return function(t){var i,s;t=t.cloneNode(!1),i=t.href.replace(e,""),s=location.href.replace(e,"");try{i=decodeURIComponent(i)}catch(n){}try{s=decodeURIComponent(s)}catch(n){}return t.hash.length>1&&i===s}},_create:function{var t=this,i=this.options;this.running=!1,this.element.addClass("ui-tabs ui-widget ui-widget-content ui-corner-all").toggleClass("ui-tabs-collapsible",i.collapsible),this._processTabs,i.active=this._initialActive,e.isArray(i.disabled)&&(i.disabled=e.unique(i.disabled.concat(e.map(this.tabs.filter(".ui-state-disabled"),function(e){return t.tabs.index(e)}))).sort),this.active=this.options.active!==!1&&this.anchors.length?this._findActive(i.active):e,this._refresh,this.active.length&&this.load(i.active)},_initialActive:function{var t=this.options.active,i=this.options.collapsible,s=location.hash.substring(1);return null===t&&(s&&this.tabs.each(function(i,n){return e(n).attr("aria-controls")===s?(t=i,!1):void 0}),null===t&&(t=this.tabs.index(this.tabs.filter(".ui-tabs-active"))),(null===t||-1===t)&&(t=this.tabs.length?0:!1)),t!==!1&&(t=this.tabs.index(this.tabs.eq(t)),-1===t&&(t=i?!1:0)),!i&&t===!1&&this.anchors.length&&(t=0),t},_getCreateEventData:function{return{tab:this.active,panel:this.active.length?this._getPanelForTab(this.active):e}},_tabKeydown:function(t){var i=e(this.document[0].activeElement).closest("li"),s=this.tabs.index(i),n=!0;if(!this._handlePageNav(t)){switch(t.keyCode){case e.ui.keyCode.RIGHT:case e.ui.keyCode.DOWN:s++;break;case e.ui.keyCode.UP:case e.ui.keyCode.LEFT:n=!1,s--;break;case e.ui.keyCode.END:s=this.anchors.length-1;break;case e.ui.keyCode.HOME:s=0;break;case e.ui.keyCode.SPACE:return t.preventDefault,clearTimeout(this.activating),this._activate(s),void 0;case e.ui.keyCode.ENTER:return t.preventDefault,clearTimeout(this.activating),this._activate(s===this.options.active?!1:s),void 0;default:return}t.preventDefault,clearTimeout(this.activating),s=this._focusNextTab(s,n),t.ctrlKey||t.metaKey||(i.attr("aria-selected","false"),this.tabs.eq(s).attr("aria-selected","true"),this.activating=this._delay(function{this.option("active",s)},this.delay))}},_panelKeydown:function(t){this._handlePageNav(t)||t.ctrlKey&&t.keyCode===e.ui.keyCode.UP&&(t.preventDefault,this.active.focus)},_handlePageNav:function(t){return t.altKey&&t.keyCode===e.ui.keyCode.PAGE_UP?(this._activate(this._focusNextTab(this.options.active-1,!1)),!0):t.altKey&&t.keyCode===e.ui.keyCode.PAGE_DOWN?(this._activate(this._focusNextTab(this.options.active+1,!0)),!0):void 0},_findNextTab:function(t,i){function s{return t>n&&(t=0),0>t&&(t=n),t}for(var n=this.tabs.length-1;-1!==e.inArray(s,this.options.disabled);)t=i?t+1:t-1;return t},_focusNextTab:function(e,t){return e=this._findNextTab(e,t),this.tabs.eq(e).focus,e},_setOption:function(e,t){return"active"===e?(this._activate(t),void 0):"disabled"===e?(this._setupDisabled(t),void 0):(this._super(e,t),"collapsible"===e&&(this.element.toggleClass("ui-tabs-collapsible",t),t||this.options.active!==!1||this._activate(0)),"event"===e&&this._setupEvents(t),"heightStyle"===e&&this._setupHeightStyle(t),void 0)},_sanitizeSelector:function(e){return e?e.replace(/[!"$%&'*+,.\/:;<=>?@\[\]\^`{|}~]/g,"\\$&"):""},refresh:function{var t=this.options,i=this.tablist.children(":has(a[href])");t.disabled=e.map(i.filter(".ui-state-disabled"),function(e){return i.index(e)}),this._processTabs,t.active!==!1&&this.anchors.length?this.active.length&&!e.contains(this.tablist[0],this.active[0])?this.tabs.length===t.disabled.length?(t.active=!1,this.active=e):this._activate(this._findNextTab(Math.max(0,t.active-1),!1)):t.active=this.tabs.index(this.active):(t.active=!1,this.active=e),this._refresh},_refresh:function{this._setupDisabled(this.options.disabled),this._setupEvents(this.options.event),this._setupHeightStyle(this.options.heightStyle),this.tabs.not(this.active).attr({"aria-selected":"false","aria-expanded":"false",tabIndex:-1}),this.panels.not(this._getPanelForTab(this.active)).hide.attr({"aria-hidden":"true"}),this.active.length?(this.active.addClass("ui-tabs-active ui-state-active").attr({"aria-selected":"true","aria-expanded":"true",tabIndex:0}),this._getPanelForTab(this.active).show.attr({"aria-hidden":"false"})):this.tabs.eq(0).attr("tabIndex",0)},_processTabs:function{var t=this,i=this.tabs,s=this.anchors,n=this.panels; this.tablist=this._getList.addClass("ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all").attr("role","tablist").delegate("> li","mousedown"+this.eventNamespace,function(t){e(this).is(".ui-state-disabled")&&t.preventDefault}).delegate(".ui-tabs-anchor","focus"+this.eventNamespace,function{e(this).closest("li").is(".ui-state-disabled")&&this.blur}),this.tabs=this.tablist.find("> li:has(a[href])").addClass("ui-state-default ui-corner-top").attr({role:"tab",tabIndex:-1}),this.anchors=this.tabs.map(function{return e("a",this)[0]}).addClass("ui-tabs-anchor").attr({role:"presentation",tabIndex:-1}),this.panels=e,this.anchors.each(function(i,s){var n,a,o,r=e(s).uniqueId.attr("id"),h=e(s).closest("li"),l=h.attr("aria-controls");t._isLocal(s)?(n=s.hash,o=n.substring(1),a=t.element.find(t._sanitizeSelector(n))):(o=h.attr("aria-controls")||e({}).uniqueId[0].id,n="#"+o,a=t.element.find(n),a.length||(a=t._createPanel(o),a.insertAfter(t.panels[i-1]||t.tablist)),a.attr("aria-live","polite")),a.length&&(t.panels=t.panels.add(a)),l&&h.data("ui-tabs-aria-controls",l),h.attr({"aria-controls":o,"aria-labelledby":r}),a.attr("aria-labelledby",r)}),this.panels.addClass("ui-tabs-panel ui-widget-content ui-corner-bottom").attr("role","tabpanel"),i&&(this._off(i.not(this.tabs)),this._off(s.not(this.anchors)),this._off(n.not(this.panels)))},_getList:function{return this.tablist||this.element.find("ol,ul").eq(0)},_createPanel:function(t){return e(" ").attr("id",t).addClass("ui-tabs-panel ui-widget-content ui-corner-bottom").data("ui-tabs-destroy",!0)},_setupDisabled:function(t){e.isArray(t)&&(t.length?t.length===this.anchors.length&&(t=!0):t=!1);for(var i,s=0;i=this.tabs[s];s++)t===!0||-1!==e.inArray(s,t)?e(i).addClass("ui-state-disabled").attr("aria-disabled","true"):e(i).removeClass("ui-state-disabled").removeAttr("aria-disabled");this.options.disabled=t},_setupEvents:function(t){var i={};t&&e.each(t.split(" "),function(e,t){i[t]="_eventHandler"}),this._off(this.anchors.add(this.tabs).add(this.panels)),this._on(!0,this.anchors,{click:function(e){e.preventDefault}}),this._on(this.anchors,i),this._on(this.tabs,{keydown:"_tabKeydown"}),this._on(this.panels,{keydown:"_panelKeydown"}),this._focusable(this.tabs),this._hoverable(this.tabs)},_setupHeightStyle:function(t){var i,s=this.element.parent;"fill"===t?(i=s.height,i-=this.element.outerHeight-this.element.height,this.element.siblings(":visible").each(function{var t=e(this),s=t.css("position");"absolute"!==s&&"fixed"!==s&&(i-=t.outerHeight(!0))}),this.element.children.not(this.panels).each(function{i-=e(this).outerHeight(!0)}),this.panels.each(function{e(this).height(Math.max(0,i-e(this).innerHeight+e(this).height))}).css("overflow","auto")):"auto"===t&&(i=0,this.panels.each(function{i=Math.max(i,e(this).height("").height)}).height(i))},_eventHandler:function(t){var i=this.options,s=this.active,n=e(t.currentTarget),a=n.closest("li"),o=a[0]===s[0],r=o&&i.collapsible,h=r?e:this._getPanelForTab(a),l=s.length?this._getPanelForTab(s):e,u={oldTab:s,oldPanel:l,newTab:r?e:a,newPanel:h};t.preventDefault,a.hasClass("ui-state-disabled")||a.hasClass("ui-tabs-loading")||this.running||o&&!i.collapsible||this._trigger("beforeActivate",t,u)===!1||(i.active=r?!1:this.tabs.index(a),this.active=o?e:a,this.xhr&&this.xhr.abort,l.length||h.length||e.error("jQuery UI Tabs: Mismatching fragment identifier."),h.length&&this.load(this.tabs.index(a),t),this._toggle(t,u))},_toggle:function(t,i){function s{a.running=!1,a._trigger("activate",t,i)}function n{i.newTab.closest("li").addClass("ui-tabs-active ui-state-active"),o.length&&a.options.show?a._show(o,a.options.show,s):(o.show,s)}var a=this,o=i.newPanel,r=i.oldPanel;this.running=!0,r.length&&this.options.hide?this._hide(r,this.options.hide,function{i.oldTab.closest("li").removeClass("ui-tabs-active ui-state-active"),n}):(i.oldTab.closest("li").removeClass("ui-tabs-active ui-state-active"),r.hide,n),r.attr("aria-hidden","true"),i.oldTab.attr({"aria-selected":"false","aria-expanded":"false"}),o.length&&r.length?i.oldTab.attr("tabIndex",-1):o.length&&this.tabs.filter(function{return 0===e(this).attr("tabIndex")}).attr("tabIndex",-1),o.attr("aria-hidden","false"),i.newTab.attr({"aria-selected":"true","aria-expanded":"true",tabIndex:0})},_activate:function(t){var i,s=this._findActive(t);s[0]!==this.active[0]&&(s.length||(s=this.active),i=s.find(".ui-tabs-anchor")[0],this._eventHandler({target:i,currentTarget:i,preventDefault:e.noop}))},_findActive:function(t){return t===!1?e:this.tabs.eq(t)},_getIndex:function(e){return"string"==typeof e&&(e=this.anchors.index(this.anchors.filter("[href$='"+e+"']"))),e},_destroy:function{this.xhr&&this.xhr.abort,this.element.removeClass("ui-tabs ui-widget ui-widget-content ui-corner-all ui-tabs-collapsible"),this.tablist.removeClass("ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all").removeAttr("role"),this.anchors.removeClass("ui-tabs-anchor").removeAttr("role").removeAttr("tabIndex").removeUniqueId,this.tablist.unbind(this.eventNamespace),this.tabs.add(this.panels).each(function{e.data(this,"ui-tabs-destroy")?e(this).remove:e(this).removeClass("ui-state-default ui-state-active ui-state-disabled ui-corner-top ui-corner-bottom ui-widget-content ui-tabs-active ui-tabs-panel").removeAttr("tabIndex").removeAttr("aria-live").removeAttr("aria-busy").removeAttr("aria-selected").removeAttr("aria-labelledby").removeAttr("aria-hidden").removeAttr("aria-expanded").removeAttr("role")}),this.tabs.each(function{var t=e(this),i=t.data("ui-tabs-aria-controls");i?t.attr("aria-controls",i).removeData("ui-tabs-aria-controls"):t.removeAttr("aria-controls")}),this.panels.show,"content"!==this.options.heightStyle&&this.panels.css("height","")},enable:function(t){var i=this.options.disabled;i!==!1&&(void 0===t?i=!1:(t=this._getIndex(t),i=e.isArray(i)?e.map(i,function(e){return e!==t?e:null}):e.map(this.tabs,function(e,i){return i!==t?i:null})),this._setupDisabled(i))},disable:function(t){var i=this.options.disabled;if(i!==!0){if(void 0===t)i=!0;else{if(t=this._getIndex(t),-1!==e.inArray(t,i))return;i=e.isArray(i)?e.merge([t],i).sort:[t]}this._setupDisabled(i)}},load:function(t,i){t=this._getIndex(t);var s=this,n=this.tabs.eq(t),a=n.find(".ui-tabs-anchor"),o=this._getPanelForTab(n),r={tab:n,panel:o},h=function(e,t){"abort"===t&&s.panels.stop(!1,!0),n.removeClass("ui-tabs-loading"),o.removeAttr("aria-busy"),e===s.xhr&&delete s.xhr};this._isLocal(a[0])||(this.xhr=e.ajax(this._ajaxSettings(a,i,r)),this.xhr&&"canceled"!==this.xhr.statusText&&(n.addClass("ui-tabs-loading"),o.attr("aria-busy","true"),this.xhr.done(function(e,t,n){setTimeout(function{o.html(e),s._trigger("load",i,r),h(n,t)},1)}).fail(function(e,t){setTimeout(function{h(e,t)},1)})))},_ajaxSettings:function(t,i,s){var n=this;return{url:t.attr("href"),beforeSend:function(t,a){return n._trigger("beforeLoad",i,e.extend({jqXHR:t,ajaxSettings:a},s))}}},_getPanelForTab:function(t){var i=e(t).attr("aria-controls");return this.element.find(this._sanitizeSelector("#"+i))}}),e.widget("ui.tooltip",{version:"1.11.4",options:{content:function{var t=e(this).attr("title")||"";return e("<a>").text(t).html},hide:!0,items:"[title]:not([disabled])",position:{my:"left top+15",at:"left bottom",collision:"flipfit flip"},show:!0,tooltipClass:null,track:!1,close:null,open:null},_addDescribedBy:function(t,i){var s=(t.attr("aria-describedby")||"").split(/\s+/);s.push(i),t.data("ui-tooltip-id",i).attr("aria-describedby",e.trim(s.join(" ")))},_removeDescribedBy:function(t){var i=t.data("ui-tooltip-id"),s=(t.attr("aria-describedby")||"").split(/\s+/),n=e.inArray(i,s);-1!==n&&s.splice(n,1),t.removeData("ui-tooltip-id"),s=e.trim(s.join(" ")),s?t.attr("aria-describedby",s):t.removeAttr("aria-describedby")},_create:function{this._on({mouseover:"open",focusin:"open"}),this.tooltips={},this.parents={},this.options.disabled&&this._disable,this.liveRegion=e(" ").attr({role:"log","aria-live":"assertive","aria-relevant":"additions"}).addClass("ui-helper-hidden-accessible").appendTo(this.document[0].body)},_setOption:function(t,i){var s=this;return"disabled"===t?(this[i?"_disable":"_enable"],this.options[t]=i,void 0):(this._super(t,i),"content"===t&&e.each(this.tooltips,function(e,t){s._updateContent(t.element)}),void 0)},_disable:function{var t=this;e.each(this.tooltips,function(i,s){var n=e.Event("blur");n.target=n.currentTarget=s.element[0],t.close(n,!0)}),this.element.find(this.options.items).addBack.each(function{var t=e(this);t.is("[title]")&&t.data("ui-tooltip-title",t.attr("title")).removeAttr("title")})},_enable:function{this.element.find(this.options.items).addBack.each(function{var t=e(this);t.data("ui-tooltip-title")&&t.attr("title",t.data("ui-tooltip-title"))})},open:function(t){var i=this,s=e(t?t.target:this.element).closest(this.options.items);s.length&&!s.data("ui-tooltip-id")&&(s.attr("title")&&s.data("ui-tooltip-title",s.attr("title")),s.data("ui-tooltip-open",!0),t&&"mouseover"===t.type&&s.parents.each(function{var t,s=e(this);s.data("ui-tooltip-open")&&(t=e.Event("blur"),t.target=t.currentTarget=this,i.close(t,!0)),s.attr("title")&&(s.uniqueId,i.parents[this.id]={element:this,title:s.attr("title")},s.attr("title",""))}),this._registerCloseHandlers(t,s),this._updateContent(s,t))},_updateContent:function(e,t){var i,s=this.options.content,n=this,a=t?t.type:null;return"string"==typeof s?this._open(t,e,s):(i=s.call(e[0],function(i){n._delay(function{e.data("ui-tooltip-open")&&(t&&(t.type=a),this._open(t,e,i))})}),i&&this._open(t,e,i),void 0)},_open:function(t,i,s){function n(e){l.of=e,o.is(":hidden")||o.position(l)}var a,o,r,h,l=e.extend({},this.options.position);if(s){if(a=this._find(i))return a.tooltip.find(".ui-tooltip-content").html(s),void 0;i.is("[title]")&&(t&&"mouseover"===t.type?i.attr("title",""):i.removeAttr("title")),a=this._tooltip(i),o=a.tooltip,this._addDescribedBy(i,o.attr("id")),o.find(".ui-tooltip-content").html(s),this.liveRegion.children.hide,s.clone?(h=s.clone,h.removeAttr("id").find("[id]").removeAttr("id")):h=s,e(" ").html(h).appendTo(this.liveRegion),this.options.track&&t&&/^mouse/.test(t.type)?(this._on(this.document,{mousemove:n}),n(t)):o.position(e.extend({of:i},this.options.position)),o.hide,this._show(o,this.options.show),this.options.show&&this.options.show.delay&&(r=this.delayedShow=setInterval(function{o.is(":visible")&&(n(l.of),clearInterval(r))},e.fx.interval)),this._trigger("open",t,{tooltip:o})}},_registerCloseHandlers:function(t,i){var s={keyup:function(t){if(t.keyCode===e.ui.keyCode.ESCAPE){var s=e.Event(t);s.currentTarget=i[0],this.close(s,!0)}}};i[0]!==this.element[0]&&(s.remove=function{this._removeTooltip(this._find(i).tooltip)}),t&&"mouseover"!==t.type||(s.mouseleave="close"),t&&"focusin"!==t.type||(s.focusout="close"),this._on(!0,i,s)},close:function(t){var i,s=this,n=e(t?t.currentTarget:this.element),a=this._find(n);return a?(i=a.tooltip,a.closing||(clearInterval(this.delayedShow),n.data("ui-tooltip-title")&&!n.attr("title")&&n.attr("title",n.data("ui-tooltip-title")),this._removeDescribedBy(n),a.hiding=!0,i.stop(!0),this._hide(i,this.options.hide,function{s._removeTooltip(e(this))}),n.removeData("ui-tooltip-open"),this._off(n,"mouseleave focusout keyup"),n[0]!==this.element[0]&&this._off(n,"remove"),this._off(this.document,"mousemove"),t&&"mouseleave"===t.type&&e.each(this.parents,function(t,i){e(i.element).attr("title",i.title),delete s.parents[t]}),a.closing=!0,this._trigger("close",t,{tooltip:i}),a.hiding||(a.closing=!1)),void 0):(n.removeData("ui-tooltip-open"),void 0)},_tooltip:function(t){var i=e(" ").attr("role","tooltip").addClass("ui-tooltip ui-widget ui-corner-all ui-widget-content "+(this.options.tooltipClass||"")),s=i.uniqueId.attr("id");return e(" ").addClass("ui-tooltip-content").appendTo(i),i.appendTo(this.document[0].body),this.tooltips[s]={element:t,tooltip:i}},_find:function(e){var t=e.data("ui-tooltip-id");return t?this.tooltips[t]:null},_removeTooltip:function(e){e.remove,delete this.tooltips[e.attr("id")]},_destroy:function{var t=this;e.each(this.tooltips,function(i,s){var n=e.Event("blur"),a=s.element;n.target=n.currentTarget=a[0],t.close(n,!0),e("#"+i).remove,a.data("ui-tooltip-title")&&(a.attr("title")||a.attr("title",a.data("ui-tooltip-title")),a.removeData("ui-tooltip-title"))}),this.liveRegion.remove}})});

var self = self || {};// threejs.org/license 'use strict';var THREE={REVISION:"71"};"object"===typeof module&&(module.exports=THREE);void 0===Math.sign&&(Math.sign=function(a){return 0>a?-1:0<a?1:+a});THREE.log=function{console.log.apply(console,arguments)};THREE.warn=function{console.warn.apply(console,arguments)};THREE.error=function{console.error.apply(console,arguments)};THREE.MOUSE={LEFT:0,MIDDLE:1,RIGHT:2};THREE.CullFaceNone=0;THREE.CullFaceBack=1;THREE.CullFaceFront=2;THREE.CullFaceFrontBack=3;THREE.FrontFaceDirectionCW=0; THREE.FrontFaceDirectionCCW=1;THREE.BasicShadowMap=0;THREE.PCFShadowMap=1;THREE.PCFSoftShadowMap=2;THREE.FrontSide=0;THREE.BackSide=1;THREE.DoubleSide=2;THREE.NoShading=0;THREE.FlatShading=1;THREE.SmoothShading=2;THREE.NoColors=0;THREE.FaceColors=1;THREE.VertexColors=2;THREE.NoBlending=0;THREE.NormalBlending=1;THREE.AdditiveBlending=2;THREE.SubtractiveBlending=3;THREE.MultiplyBlending=4;THREE.CustomBlending=5;THREE.AddEquation=100;THREE.SubtractEquation=101;THREE.ReverseSubtractEquation=102; THREE.MinEquation=103;THREE.MaxEquation=104;THREE.ZeroFactor=200;THREE.OneFactor=201;THREE.SrcColorFactor=202;THREE.OneMinusSrcColorFactor=203;THREE.SrcAlphaFactor=204;THREE.OneMinusSrcAlphaFactor=205;THREE.DstAlphaFactor=206;THREE.OneMinusDstAlphaFactor=207;THREE.DstColorFactor=208;THREE.OneMinusDstColorFactor=209;THREE.SrcAlphaSaturateFactor=210;THREE.MultiplyOperation=0;THREE.MixOperation=1;THREE.AddOperation=2;THREE.UVMapping=300;THREE.CubeReflectionMapping=301;THREE.CubeRefractionMapping=302; THREE.EquirectangularReflectionMapping=303;THREE.EquirectangularRefractionMapping=304;THREE.SphericalReflectionMapping=305;THREE.RepeatWrapping=1E3;THREE.ClampToEdgeWrapping=1001;THREE.MirroredRepeatWrapping=1002;THREE.NearestFilter=1003;THREE.NearestMipMapNearestFilter=1004;THREE.NearestMipMapLinearFilter=1005;THREE.LinearFilter=1006;THREE.LinearMipMapNearestFilter=1007;THREE.LinearMipMapLinearFilter=1008;THREE.UnsignedByteType=1009;THREE.ByteType=1010;THREE.ShortType=1011; THREE.UnsignedShortType=1012;THREE.IntType=1013;THREE.UnsignedIntType=1014;THREE.FloatType=1015;THREE.HalfFloatType=1025;THREE.UnsignedShort4444Type=1016;THREE.UnsignedShort5551Type=1017;THREE.UnsignedShort565Type=1018;THREE.AlphaFormat=1019;THREE.RGBFormat=1020;THREE.RGBAFormat=1021;THREE.LuminanceFormat=1022;THREE.LuminanceAlphaFormat=1023;THREE.RGBEFormat=THREE.RGBAFormat;THREE.RGB_S3TC_DXT1_Format=2001;THREE.RGBA_S3TC_DXT1_Format=2002;THREE.RGBA_S3TC_DXT3_Format=2003; THREE.RGBA_S3TC_DXT5_Format=2004;THREE.RGB_PVRTC_4BPPV1_Format=2100;THREE.RGB_PVRTC_2BPPV1_Format=2101;THREE.RGBA_PVRTC_4BPPV1_Format=2102;THREE.RGBA_PVRTC_2BPPV1_Format=2103; THREE.Projector=function{THREE.error("THREE.Projector has been moved to /examples/js/renderers/Projector.js.");this.projectVector=function(a,b){THREE.warn("THREE.Projector: .projectVector is now vector.project.");a.project(b)};this.unprojectVector=function(a,b){THREE.warn("THREE.Projector: .unprojectVector is now vector.unproject.");a.unproject(b)};this.pickingRay=function(a,b){THREE.error("THREE.Projector: .pickingRay is now raycaster.setFromCamera.")}}; THREE.CanvasRenderer=function{THREE.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{}};THREE.Color=function(a){return 3===arguments.length?this.setRGB(arguments[0],arguments[1],arguments[2]):this.set(a)}; THREE.Color.prototype={constructor:THREE.Color,r:1,g:1,b:1,set:function(a){a instanceof THREE.Color?this.copy(a):"number"===typeof a?this.setHex(a):"string"===typeof a&&this.setStyle(a);return this},setHex:function(a){a=Math.floor(a);this.r=(a>>16&255)/255;this.g=(a>>8&255)/255;this.b=(a&255)/255;return this},setRGB:function(a,b,c){this.r=a;this.g=b;this.b=c;return this},setHSL:function(a,b,c){if(0===b)this.r=this.g=this.b=c;else{var d=function(a,b,c){0>c&&(c+=1);1<c&&(c-=1);return c<1/6?a+6*(b-a)* c:.5>c?b:c<2/3?a+6*(b-a)*(2/3-c):a};b=.5>=c?c*(1+b):c+b-c*b;c=2*c-b;this.r=d(c,b,a+1/3);this.g=d(c,b,a);this.b=d(c,b,a-1/3)}return this},setStyle:function(a){if(/^rgb\((\d+), ?(\d+), ?(\d+)\)$/i.test(a))return a=/^rgb\((\d+), ?(\d+), ?(\d+)\)$/i.exec(a),this.r=Math.min(255,parseInt(a[1],10))/255,this.g=Math.min(255,parseInt(a[2],10))/255,this.b=Math.min(255,parseInt(a[3],10))/255,this;if(/^rgb\((\d+)\%, ?(\d+)\%, ?(\d+)\%\)$/i.test(a))return a=/^rgb\((\d+)\%, ?(\d+)\%, ?(\d+)\%\)$/i.exec(a),this.r= Math.min(100,parseInt(a[1],10))/100,this.g=Math.min(100,parseInt(a[2],10))/100,this.b=Math.min(100,parseInt(a[3],10))/100,this;if(/^\#([0-9a-f]{6})$/i.test(a))return a=/^\#([0-9a-f]{6})$/i.exec(a),this.setHex(parseInt(a[1],16)),this;if(/^\#([0-9a-f])([0-9a-f])([0-9a-f])$/i.test(a))return a=/^\#([0-9a-f])([0-9a-f])([0-9a-f])$/i.exec(a),this.setHex(parseInt(a[1]+a[1]+a[2]+a[2]+a[3]+a[3],16)),this;if(/^(\w+)$/i.test(a))return this.setHex(THREE.ColorKeywords[a]),this},copy:function(a){this.r=a.r;this.g= a.g;this.b=a.b;return this},copyGammaToLinear:function(a,b){void 0===b&&(b=2);this.r=Math.pow(a.r,b);this.g=Math.pow(a.g,b);this.b=Math.pow(a.b,b);return this},copyLinearToGamma:function(a,b){void 0===b&&(b=2);var c=0<b?1/b:1;this.r=Math.pow(a.r,c);this.g=Math.pow(a.g,c);this.b=Math.pow(a.b,c);return this},convertGammaToLinear:function{var a=this.r,b=this.g,c=this.b;this.r=a*a;this.g=b*b;this.b=c*c;return this},convertLinearToGamma:function{this.r=Math.sqrt(this.r);this.g=Math.sqrt(this.g);this.b= Math.sqrt(this.b);return this},getHex:function{return 255*this.r<<16^255*this.g<<8^255*this.b<<0},getHexString:function{return("000000"+this.getHex.toString(16)).slice(-6)},getHSL:function(a){a=a||{h:0,s:0,l:0};var b=this.r,c=this.g,d=this.b,e=Math.max(b,c,d),f=Math.min(b,c,d),g,h=(f+e)/2;if(f===e)f=g=0;else{var k=e-f,f=.5>=h?k/(e+f):k/(2-e-f);switch(e){case b:g=(c-d)/k+(c<d?6:0);break;case c:g=(d-b)/k+2;break;case d:g=(b-c)/k+4}g/=6}a.h=g;a.s=f;a.l=h;return a},getStyle:function{return"rgb("+ (255*this.r|0)+","+(255*this.g|0)+","+(255*this.b|0)+")"},offsetHSL:function(a,b,c){var d=this.getHSL;d.h+=a;d.s+=b;d.l+=c;this.setHSL(d.h,d.s,d.l);return this},add:function(a){this.r+=a.r;this.g+=a.g;this.b+=a.b;return this},addColors:function(a,b){this.r=a.r+b.r;this.g=a.g+b.g;this.b=a.b+b.b;return this},addScalar:function(a){this.r+=a;this.g+=a;this.b+=a;return this},multiply:function(a){this.r*=a.r;this.g*=a.g;this.b*=a.b;return this},multiplyScalar:function(a){this.r*=a;this.g*=a;this.b*=a; return this},lerp:function(a,b){this.r+=(a.r-this.r)*b;this.g+=(a.g-this.g)*b;this.b+=(a.b-this.b)*b;return this},equals:function(a){return a.r===this.r&&a.g===this.g&&a.b===this.b},fromArray:function(a){this.r=a[0];this.g=a[1];this.b=a[2];return this},toArray:function(a,b){void 0===a&&(a=[]);void 0===b&&(b=0);a[b]=this.r;a[b+1]=this.g;a[b+2]=this.b;return a},clone:function{return(new THREE.Color).setRGB(this.r,this.g,this.b)}}; THREE.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};THREE.Quaternion=function(a,b,c,d){this._x=a||0;this._y=b||0;this._z=c||0;this._w=void 0!==d?d:1}; THREE.Quaternion.prototype={constructor:THREE.Quaternion,_x:0,_y:0,_z:0,_w:0,get x{return this._x},set x(a){this._x=a;this.onChangeCallback},get y{return this._y},set y(a){this._y=a;this.onChangeCallback},get z{return this._z},set z(a){this._z=a;this.onChangeCallback},get w{return this._w},set w(a){this._w=a;this.onChangeCallback},set:function(a,b,c,d){this._x=a;this._y=b;this._z=c;this._w=d;this.onChangeCallback;return this},copy:function(a){this._x=a.x;this._y=a.y;this._z=a.z; this._w=a.w;this.onChangeCallback;return this},setFromEuler:function(a,b){if(!1===a instanceof THREE.Euler)throw Error("THREE.Quaternion: .setFromEuler now expects a Euler rotation rather than a Vector3 and order.");var c=Math.cos(a._x/2),d=Math.cos(a._y/2),e=Math.cos(a._z/2),f=Math.sin(a._x/2),g=Math.sin(a._y/2),h=Math.sin(a._z/2);"XYZ"===a.order?(this._x=f*d*e+c*g*h,this._y=c*g*e-f*d*h,this._z=c*d*h+f*g*e,this._w=c*d*e-f*g*h):"YXZ"===a.order?(this._x=f*d*e+c*g*h,this._y=c*g*e-f*d*h,this._z= c*d*h-f*g*e,this._w=c*d*e+f*g*h):"ZXY"===a.order?(this._x=f*d*e-c*g*h,this._y=c*g*e+f*d*h,this._z=c*d*h+f*g*e,this._w=c*d*e-f*g*h):"ZYX"===a.order?(this._x=f*d*e-c*g*h,this._y=c*g*e+f*d*h,this._z=c*d*h-f*g*e,this._w=c*d*e+f*g*h):"YZX"===a.order?(this._x=f*d*e+c*g*h,this._y=c*g*e+f*d*h,this._z=c*d*h-f*g*e,this._w=c*d*e-f*g*h):"XZY"===a.order&&(this._x=f*d*e-c*g*h,this._y=c*g*e-f*d*h,this._z=c*d*h+f*g*e,this._w=c*d*e+f*g*h);if(!1!==b)this.onChangeCallback;return this},setFromAxisAngle:function(a, b){var c=b/2,d=Math.sin(c);this._x=a.x*d;this._y=a.y*d;this._z=a.z*d;this._w=Math.cos(c);this.onChangeCallback;return this},setFromRotationMatrix:function(a){var b=a.elements,c=b[0];a=b[4];var d=b[8],e=b[1],f=b[5],g=b[9],h=b[2],k=b[6],b=b[10],l=c+f+b;0<l?(c=.5/Math.sqrt(l+1),this._w=.25/c,this._x=(k-g)*c,this._y=(d-h)*c,this._z=(e-a)*c):c>f&&c>b?(c=2*Math.sqrt(1+c-f-b),this._w=(k-g)/c,this._x=.25*c,this._y=(a+e)/c,this._z=(d+h)/c):f>b?(c=2*Math.sqrt(1+f-c-b),this._w=(d-h)/c,this._x=(a+e)/c,this._y= .25*c,this._z=(g+k)/c):(c=2*Math.sqrt(1+b-c-f),this._w=(e-a)/c,this._x=(d+h)/c,this._y=(g+k)/c,this._z=.25*c);this.onChangeCallback;return this},setFromUnitVectors:function{var a,b;return function(c,d){void 0===a&&(a=new THREE.Vector3);b=c.dot(d)+1;1E-6>b?(b=0,Math.abs(c.x)>Math.abs(c.z)?a.set(-c.y,c.x,0):a.set(0,-c.z,c.y)):a.crossVectors(c,d);this._x=a.x;this._y=a.y;this._z=a.z;this._w=b;this.normalize;return this}},inverse:function{this.conjugate.normalize;return this},conjugate:function{this._x*= -1;this._y*=-1;this._z*=-1;this.onChangeCallback;return this},dot:function(a){return this._x*a._x+this._y*a._y+this._z*a._z+this._w*a._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 a=this.length;0===a?(this._z=this._y=this._x=0,this._w=1):(a=1/a,this._x*=a,this._y*=a,this._z*=a,this._w*=a);this.onChangeCallback;return this}, multiply:function(a,b){return void 0!==b?(THREE.warn("THREE.Quaternion: .multiply now only accepts one argument. Use .multiplyQuaternions( a, b ) instead."),this.multiplyQuaternions(a,b)):this.multiplyQuaternions(this,a)},multiplyQuaternions:function(a,b){var c=a._x,d=a._y,e=a._z,f=a._w,g=b._x,h=b._y,k=b._z,l=b._w;this._x=c*l+f*g+d*k-e*h;this._y=d*l+f*h+e*g-c*k;this._z=e*l+f*k+c*h-d*g;this._w=f*l-c*g-d*h-e*k;this.onChangeCallback;return this},multiplyVector3:function(a){THREE.warn("THREE.Quaternion: .multiplyVector3 has been removed. Use is now vector.applyQuaternion( quaternion ) instead."); return a.applyQuaternion(this)},slerp:function(a,b){if(0===b)return this;if(1===b)return this.copy(a);var c=this._x,d=this._y,e=this._z,f=this._w,g=f*a._w+c*a._x+d*a._y+e*a._z;0>g?(this._w=-a._w,this._x=-a._x,this._y=-a._y,this._z=-a._z,g=-g):this.copy(a);if(1<=g)return this._w=f,this._x=c,this._y=d,this._z=e,this;var h=Math.acos(g),k=Math.sqrt(1-g*g);if(.001>Math.abs(k))return this._w=.5*(f+this._w),this._x=.5*(c+this._x),this._y=.5*(d+this._y),this._z=.5*(e+this._z),this;g=Math.sin((1-b)*h)/k;h= Math.sin(b*h)/k;this._w=f*g+this._w*h;this._x=c*g+this._x*h;this._y=d*g+this._y*h;this._z=e*g+this._z*h;this.onChangeCallback;return this},equals:function(a){return a._x===this._x&&a._y===this._y&&a._z===this._z&&a._w===this._w},fromArray:function(a,b){void 0===b&&(b=0);this._x=a[b];this._y=a[b+1];this._z=a[b+2];this._w=a[b+3];this.onChangeCallback;return this},toArray:function(a,b){void 0===a&&(a=[]);void 0===b&&(b=0);a[b]=this._x;a[b+1]=this._y;a[b+2]=this._z;a[b+3]=this._w;return a},onChange:function(a){this.onChangeCallback= a;return this},onChangeCallback:function{},clone:function{return new THREE.Quaternion(this._x,this._y,this._z,this._w)}};THREE.Quaternion.slerp=function(a,b,c,d){return c.copy(a).slerp(b,d)};THREE.Vector2=function(a,b){this.x=a||0;this.y=b||0}; THREE.Vector2.prototype={constructor:THREE.Vector2,set:function(a,b){this.x=a;this.y=b;return this},setX:function(a){this.x=a;return this},setY:function(a){this.y=a;return this},setComponent:function(a,b){switch(a){case 0:this.x=b;break;case 1:this.y=b;break;default:throw Error("index is out of range: "+a);}},getComponent:function(a){switch(a){case 0:return this.x;case 1:return this.y;default:throw Error("index is out of range: "+a);}},copy:function(a){this.x=a.x;this.y=a.y;return this},add:function(a, b){if(void 0!==b)return THREE.warn("THREE.Vector2: .add now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(a,b);this.x+=a.x;this.y+=a.y;return this},addScalar:function(a){this.x+=a;this.y+=a;return this},addVectors:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;return this},sub:function(a,b){if(void 0!==b)return THREE.warn("THREE.Vector2: .sub now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(a,b);this.x-=a.x;this.y-=a.y;return this}, subScalar:function(a){this.x-=a;this.y-=a;return this},subVectors:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;return this},multiply:function(a){this.x*=a.x;this.y*=a.y;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;return this},divide:function(a){this.x/=a.x;this.y/=a.y;return this},divideScalar:function(a){0!==a?(a=1/a,this.x*=a,this.y*=a):this.y=this.x=0;return this},min:function(a){this.x>a.x&&(this.x=a.x);this.y>a.y&&(this.y=a.y);return this},max:function(a){this.x<a.x&&(this.x=a.x); this.y<a.y&&(this.y=a.y);return this},clamp:function(a,b){this.x<a.x?this.x=a.x:this.x>b.x&&(this.x=b.x);this.y<a.y?this.y=a.y:this.y>b.y&&(this.y=b.y);return this},clampScalar:function{var a,b;return function(c,d){void 0===a&&(a=new THREE.Vector2,b=new THREE.Vector2);a.set(c,c);b.set(d,d);return this.clamp(a,b)}},floor:function{this.x=Math.floor(this.x);this.y=Math.floor(this.y);return this},ceil:function{this.x=Math.ceil(this.x);this.y=Math.ceil(this.y);return this},round:function{this.x= Math.round(this.x);this.y=Math.round(this.y);return this},roundToZero:function{this.x=0>this.x?Math.ceil(this.x):Math.floor(this.x);this.y=0>this.y?Math.ceil(this.y):Math.floor(this.y);return this},negate:function{this.x=-this.x;this.y=-this.y;return this},dot:function(a){return this.x*a.x+this.y*a.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(a){return Math.sqrt(this.distanceToSquared(a))}, distanceToSquared:function(a){var b=this.x-a.x;a=this.y-a.y;return b*b+a*a},setLength:function(a){var b=this.length;0!==b&&a!==b&&this.multiplyScalar(a/b);return this},lerp:function(a,b){this.x+=(a.x-this.x)*b;this.y+=(a.y-this.y)*b;return this},lerpVectors:function(a,b,c){this.subVectors(b,a).multiplyScalar(c).add(a);return this},equals:function(a){return a.x===this.x&&a.y===this.y},fromArray:function(a,b){void 0===b&&(b=0);this.x=a[b];this.y=a[b+1];return this},toArray:function(a,b){void 0=== a&&(a=[]);void 0===b&&(b=0);a[b]=this.x;a[b+1]=this.y;return a},fromAttribute:function(a,b,c){void 0===c&&(c=0);b=b*a.itemSize+c;this.x=a.array[b];this.y=a.array[b+1];return this},clone:function{return new THREE.Vector2(this.x,this.y)}};THREE.Vector3=function(a,b,c){this.x=a||0;this.y=b||0;this.z=c||0}; THREE.Vector3.prototype={constructor:THREE.Vector3,set:function(a,b,c){this.x=a;this.y=b;this.z=c;return this},setX:function(a){this.x=a;return this},setY:function(a){this.y=a;return this},setZ:function(a){this.z=a;return this},setComponent:function(a,b){switch(a){case 0:this.x=b;break;case 1:this.y=b;break;case 2:this.z=b;break;default:throw Error("index is out of range: "+a);}},getComponent:function(a){switch(a){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw Error("index is out of range: "+ a);}},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;return this},add:function(a,b){if(void 0!==b)return THREE.warn("THREE.Vector3: .add now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(a,b);this.x+=a.x;this.y+=a.y;this.z+=a.z;return this},addScalar:function(a){this.x+=a;this.y+=a;this.z+=a;return this},addVectors:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;this.z=a.z+b.z;return this},sub:function(a,b){if(void 0!==b)return THREE.warn("THREE.Vector3: .sub now only accepts one argument. Use .subVectors( a, b ) instead."), this.subVectors(a,b);this.x-=a.x;this.y-=a.y;this.z-=a.z;return this},subScalar:function(a){this.x-=a;this.y-=a;this.z-=a;return this},subVectors:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;this.z=a.z-b.z;return this},multiply:function(a,b){if(void 0!==b)return THREE.warn("THREE.Vector3: .multiply now only accepts one argument. Use .multiplyVectors( a, b ) instead."),this.multiplyVectors(a,b);this.x*=a.x;this.y*=a.y;this.z*=a.z;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;this.z*= a;return this},multiplyVectors:function(a,b){this.x=a.x*b.x;this.y=a.y*b.y;this.z=a.z*b.z;return this},applyEuler:function{var a;return function(b){!1===b instanceof THREE.Euler&&THREE.error("THREE.Vector3: .applyEuler now expects a Euler rotation rather than a Vector3 and order.");void 0===a&&(a=new THREE.Quaternion);this.applyQuaternion(a.setFromEuler(b));return this}},applyAxisAngle:function{var a;return function(b,c){void 0===a&&(a=new THREE.Quaternion);this.applyQuaternion(a.setFromAxisAngle(b, c));return this}},applyMatrix3:function(a){var b=this.x,c=this.y,d=this.z;a=a.elements;this.x=a[0]*b+a[3]*c+a[6]*d;this.y=a[1]*b+a[4]*c+a[7]*d;this.z=a[2]*b+a[5]*c+a[8]*d;return this},applyMatrix4:function(a){var b=this.x,c=this.y,d=this.z;a=a.elements;this.x=a[0]*b+a[4]*c+a[8]*d+a[12];this.y=a[1]*b+a[5]*c+a[9]*d+a[13];this.z=a[2]*b+a[6]*c+a[10]*d+a[14];return this},applyProjection:function(a){var b=this.x,c=this.y,d=this.z;a=a.elements;var e=1/(a[3]*b+a[7]*c+a[11]*d+a[15]);this.x=(a[0]*b+a[4]* c+a[8]*d+a[12])*e;this.y=(a[1]*b+a[5]*c+a[9]*d+a[13])*e;this.z=(a[2]*b+a[6]*c+a[10]*d+a[14])*e;return this},applyQuaternion:function(a){var b=this.x,c=this.y,d=this.z,e=a.x,f=a.y,g=a.z;a=a.w;var h=a*b+f*d-g*c,k=a*c+g*b-e*d,l=a*d+e*c-f*b,b=-e*b-f*c-g*d;this.x=h*a+b*-e+k*-g-l*-f;this.y=k*a+b*-f+l*-e-h*-g;this.z=l*a+b*-g+h*-f-k*-e;return this},project:function{var a;return function(b){void 0===a&&(a=new THREE.Matrix4);a.multiplyMatrices(b.projectionMatrix,a.getInverse(b.matrixWorld));return this.applyProjection(a)}}, unproject:function{var a;return function(b){void 0===a&&(a=new THREE.Matrix4);a.multiplyMatrices(b.matrixWorld,a.getInverse(b.projectionMatrix));return this.applyProjection(a)}},transformDirection:function(a){var b=this.x,c=this.y,d=this.z;a=a.elements;this.x=a[0]*b+a[4]*c+a[8]*d;this.y=a[1]*b+a[5]*c+a[9]*d;this.z=a[2]*b+a[6]*c+a[10]*d;this.normalize;return this},divide:function(a){this.x/=a.x;this.y/=a.y;this.z/=a.z;return this},divideScalar:function(a){0!==a?(a=1/a,this.x*=a,this.y*=a,this.z*= a):this.z=this.y=this.x=0;return this},min:function(a){this.x>a.x&&(this.x=a.x);this.y>a.y&&(this.y=a.y);this.z>a.z&&(this.z=a.z);return this},max:function(a){this.x<a.x&&(this.x=a.x);this.y<a.y&&(this.y=a.y);this.z<a.z&&(this.z=a.z);return this},clamp:function(a,b){this.x<a.x?this.x=a.x:this.x>b.x&&(this.x=b.x);this.y<a.y?this.y=a.y:this.y>b.y&&(this.y=b.y);this.z<a.z?this.z=a.z:this.z>b.z&&(this.z=b.z);return this},clampScalar:function{var a,b;return function(c,d){void 0===a&&(a=new THREE.Vector3, b=new THREE.Vector3);a.set(c,c,c);b.set(d,d,d);return this.clamp(a,b)}},floor:function{this.x=Math.floor(this.x);this.y=Math.floor(this.y);this.z=Math.floor(this.z);return this},ceil:function{this.x=Math.ceil(this.x);this.y=Math.ceil(this.y);this.z=Math.ceil(this.z);return this},round:function{this.x=Math.round(this.x);this.y=Math.round(this.y);this.z=Math.round(this.z);return this},roundToZero:function{this.x=0>this.x?Math.ceil(this.x):Math.floor(this.x);this.y=0>this.y?Math.ceil(this.y): Math.floor(this.y);this.z=0>this.z?Math.ceil(this.z):Math.floor(this.z);return this},negate:function{this.x=-this.x;this.y=-this.y;this.z=-this.z;return this},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.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(a){var b=this.length;0!==b&&a!==b&&this.multiplyScalar(a/b);return this},lerp:function(a,b){this.x+=(a.x-this.x)*b;this.y+=(a.y-this.y)*b;this.z+=(a.z-this.z)*b;return this},lerpVectors:function(a,b,c){this.subVectors(b,a).multiplyScalar(c).add(a);return this},cross:function(a,b){if(void 0!==b)return THREE.warn("THREE.Vector3: .cross now only accepts one argument. Use .crossVectors( a, b ) instead."),this.crossVectors(a,b);var c=this.x,d=this.y,e=this.z;this.x=d*a.z-e*a.y;this.y= e*a.x-c*a.z;this.z=c*a.y-d*a.x;return this},crossVectors:function(a,b){var c=a.x,d=a.y,e=a.z,f=b.x,g=b.y,h=b.z;this.x=d*h-e*g;this.y=e*f-c*h;this.z=c*g-d*f;return this},projectOnVector:function{var a,b;return function(c){void 0===a&&(a=new THREE.Vector3);a.copy(c).normalize;b=this.dot(a);return this.copy(a).multiplyScalar(b)}},projectOnPlane:function{var a;return function(b){void 0===a&&(a=new THREE.Vector3);a.copy(this).projectOnVector(b);return this.sub(a)}},reflect:function{var a;return function(b){void 0=== a&&(a=new THREE.Vector3);return this.sub(a.copy(b).multiplyScalar(2*this.dot(b)))}},angleTo:function(a){a=this.dot(a)/(this.length*a.length);return Math.acos(THREE.Math.clamp(a,-1,1))},distanceTo:function(a){return Math.sqrt(this.distanceToSquared(a))},distanceToSquared:function(a){var b=this.x-a.x,c=this.y-a.y;a=this.z-a.z;return b*b+c*c+a*a},setEulerFromRotationMatrix:function(a,b){THREE.error("THREE.Vector3: .setEulerFromRotationMatrix has been removed. Use Euler.setFromRotationMatrix instead.")}, setEulerFromQuaternion:function(a,b){THREE.error("THREE.Vector3: .setEulerFromQuaternion has been removed. Use Euler.setFromQuaternion instead.")},getPositionFromMatrix:function(a){THREE.warn("THREE.Vector3: .getPositionFromMatrix has been renamed to .setFromMatrixPosition.");return this.setFromMatrixPosition(a)},getScaleFromMatrix:function(a){THREE.warn("THREE.Vector3: .getScaleFromMatrix has been renamed to .setFromMatrixScale.");return this.setFromMatrixScale(a)},getColumnFromMatrix:function(a, b){THREE.warn("THREE.Vector3: .getColumnFromMatrix has been renamed to .setFromMatrixColumn.");return this.setFromMatrixColumn(a,b)},setFromMatrixPosition:function(a){this.x=a.elements[12];this.y=a.elements[13];this.z=a.elements[14];return this},setFromMatrixScale:function(a){var b=this.set(a.elements[0],a.elements[1],a.elements[2]).length,c=this.set(a.elements[4],a.elements[5],a.elements[6]).length;a=this.set(a.elements[8],a.elements[9],a.elements[10]).length;this.x=b;this.y=c;this.z=a; return this},setFromMatrixColumn:function(a,b){var c=4*a,d=b.elements;this.x=d[c];this.y=d[c+1];this.z=d[c+2];return this},equals:function(a){return a.x===this.x&&a.y===this.y&&a.z===this.z},fromArray:function(a,b){void 0===b&&(b=0);this.x=a[b];this.y=a[b+1];this.z=a[b+2];return this},toArray:function(a,b){void 0===a&&(a=[]);void 0===b&&(b=0);a[b]=this.x;a[b+1]=this.y;a[b+2]=this.z;return a},fromAttribute:function(a,b,c){void 0===c&&(c=0);b=b*a.itemSize+c;this.x=a.array[b];this.y=a.array[b+1];this.z= a.array[b+2];return this},clone:function{return new THREE.Vector3(this.x,this.y,this.z)}};THREE.Vector4=function(a,b,c,d){this.x=a||0;this.y=b||0;this.z=c||0;this.w=void 0!==d?d:1}; THREE.Vector4.prototype={constructor:THREE.Vector4,set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.w=d;return this},setX:function(a){this.x=a;return this},setY:function(a){this.y=a;return this},setZ:function(a){this.z=a;return this},setW:function(a){this.w=a;return this},setComponent:function(a,b){switch(a){case 0:this.x=b;break;case 1:this.y=b;break;case 2:this.z=b;break;case 3:this.w=b;break;default:throw Error("index is out of range: "+a);}},getComponent:function(a){switch(a){case 0:return this.x; case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw Error("index is out of range: "+a);}},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=void 0!==a.w?a.w:1;return this},add:function(a,b){if(void 0!==b)return THREE.warn("THREE.Vector4: .add now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(a,b);this.x+=a.x;this.y+=a.y;this.z+=a.z;this.w+=a.w;return this},addScalar:function(a){this.x+=a;this.y+=a;this.z+=a;this.w+=a;return this},addVectors:function(a, b){this.x=a.x+b.x;this.y=a.y+b.y;this.z=a.z+b.z;this.w=a.w+b.w;return this},sub:function(a,b){if(void 0!==b)return THREE.warn("THREE.Vector4: .sub now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(a,b);this.x-=a.x;this.y-=a.y;this.z-=a.z;this.w-=a.w;return this},subScalar:function(a){this.x-=a;this.y-=a;this.z-=a;this.w-=a;return this},subVectors:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;this.z=a.z-b.z;this.w=a.w-b.w;return this},multiplyScalar:function(a){this.x*= a;this.y*=a;this.z*=a;this.w*=a;return this},applyMatrix4:function(a){var b=this.x,c=this.y,d=this.z,e=this.w;a=a.elements;this.x=a[0]*b+a[4]*c+a[8]*d+a[12]*e;this.y=a[1]*b+a[5]*c+a[9]*d+a[13]*e;this.z=a[2]*b+a[6]*c+a[10]*d+a[14]*e;this.w=a[3]*b+a[7]*c+a[11]*d+a[15]*e;return this},divideScalar:function(a){0!==a?(a=1/a,this.x*=a,this.y*=a,this.z*=a,this.w*=a):(this.z=this.y=this.x=0,this.w=1);return this},setAxisAngleFromQuaternion:function(a){this.w=2*Math.acos(a.w);var b=Math.sqrt(1-a.w*a.w);1E-4> b?(this.x=1,this.z=this.y=0):(this.x=a.x/b,this.y=a.y/b,this.z=a.z/b);return this},setAxisAngleFromRotationMatrix:function(a){var b,c,d;a=a.elements;var e=a[0];d=a[4];var f=a[8],g=a[1],h=a[5],k=a[9];c=a[2];b=a[6];var l=a[10];if(.01>Math.abs(d-g)&&.01>Math.abs(f-c)&&.01>Math.abs(k-b)){if(.1>Math.abs(d+g)&&.1>Math.abs(f+c)&&.1>Math.abs(k+b)&&.1>Math.abs(e+h+l-3))return this.set(1,0,0,0),this;a=Math.PI;e=(e+1)/2;h=(h+1)/2;l=(l+1)/2;d=(d+g)/4;f=(f+c)/4;k=(k+b)/4;e>h&&e>l?.01>e?(b=0,d=c=.707106781):(b= Math.sqrt(e),c=d/b,d=f/b):h>l?.01>h?(b=.707106781,c=0,d=.707106781):(c=Math.sqrt(h),b=d/c,d=k/c):.01>l?(c=b=.707106781,d=0):(d=Math.sqrt(l),b=f/d,c=k/d);this.set(b,c,d,a);return this}a=Math.sqrt((b-k)*(b-k)+(f-c)*(f-c)+(g-d)*(g-d));.001>Math.abs(a)&&(a=1);this.x=(b-k)/a;this.y=(f-c)/a;this.z=(g-d)/a;this.w=Math.acos((e+h+l-1)/2);return this},min:function(a){this.x>a.x&&(this.x=a.x);this.y>a.y&&(this.y=a.y);this.z>a.z&&(this.z=a.z);this.w>a.w&&(this.w=a.w);return this},max:function(a){this.x<a.x&& (this.x=a.x);this.y<a.y&&(this.y=a.y);this.z<a.z&&(this.z=a.z);this.w<a.w&&(this.w=a.w);return this},clamp:function(a,b){this.x<a.x?this.x=a.x:this.x>b.x&&(this.x=b.x);this.y<a.y?this.y=a.y:this.y>b.y&&(this.y=b.y);this.z<a.z?this.z=a.z:this.z>b.z&&(this.z=b.z);this.w<a.w?this.w=a.w:this.w>b.w&&(this.w=b.w);return this},clampScalar:function{var a,b;return function(c,d){void 0===a&&(a=new THREE.Vector4,b=new THREE.Vector4);a.set(c,c,c,c);b.set(d,d,d,d);return this.clamp(a,b)}},floor:function{this.x= Math.floor(this.x);this.y=Math.floor(this.y);this.z=Math.floor(this.z);this.w=Math.floor(this.w);return this},ceil:function{this.x=Math.ceil(this.x);this.y=Math.ceil(this.y);this.z=Math.ceil(this.z);this.w=Math.ceil(this.w);return this},round:function{this.x=Math.round(this.x);this.y=Math.round(this.y);this.z=Math.round(this.z);this.w=Math.round(this.w);return this},roundToZero:function{this.x=0>this.x?Math.ceil(this.x):Math.floor(this.x);this.y=0>this.y?Math.ceil(this.y):Math.floor(this.y); this.z=0>this.z?Math.ceil(this.z):Math.floor(this.z);this.w=0>this.w?Math.ceil(this.w):Math.floor(this.w);return this},negate:function{this.x=-this.x;this.y=-this.y;this.z=-this.z;this.w=-this.w;return this},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z+this.w*a.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(a){var b=this.length;0!==b&&a!==b&&this.multiplyScalar(a/b);return this},lerp:function(a,b){this.x+=(a.x-this.x)*b;this.y+=(a.y-this.y)*b;this.z+=(a.z-this.z)*b;this.w+=(a.w-this.w)*b;return this},lerpVectors:function(a,b,c){this.subVectors(b,a).multiplyScalar(c).add(a);return this},equals:function(a){return a.x===this.x&&a.y===this.y&&a.z===this.z&&a.w===this.w}, fromArray:function(a,b){void 0===b&&(b=0);this.x=a[b];this.y=a[b+1];this.z=a[b+2];this.w=a[b+3];return this},toArray:function(a,b){void 0===a&&(a=[]);void 0===b&&(b=0);a[b]=this.x;a[b+1]=this.y;a[b+2]=this.z;a[b+3]=this.w;return a},fromAttribute:function(a,b,c){void 0===c&&(c=0);b=b*a.itemSize+c;this.x=a.array[b];this.y=a.array[b+1];this.z=a.array[b+2];this.w=a.array[b+3];return this},clone:function{return new THREE.Vector4(this.x,this.y,this.z,this.w)}}; THREE.Euler=function(a,b,c,d){this._x=a||0;this._y=b||0;this._z=c||0;this._order=d||THREE.Euler.DefaultOrder};THREE.Euler.RotationOrders="XYZ YZX ZXY XZY YXZ ZYX".split(" ");THREE.Euler.DefaultOrder="XYZ"; THREE.Euler.prototype={constructor:THREE.Euler,_x:0,_y:0,_z:0,_order:THREE.Euler.DefaultOrder,get x{return this._x},set x(a){this._x=a;this.onChangeCallback},get y{return this._y},set y(a){this._y=a;this.onChangeCallback},get z{return this._z},set z(a){this._z=a;this.onChangeCallback},get order{return this._order},set order(a){this._order=a;this.onChangeCallback},set:function(a,b,c,d){this._x=a;this._y=b;this._z=c;this._order=d||this._order;this.onChangeCallback;return this},copy:function(a){this._x= a._x;this._y=a._y;this._z=a._z;this._order=a._order;this.onChangeCallback;return this},setFromRotationMatrix:function(a,b,c){var d=THREE.Math.clamp,e=a.elements;a=e[0];var f=e[4],g=e[8],h=e[1],k=e[5],l=e[9],p=e[2],q=e[6],e=e[10];b=b||this._order;"XYZ"===b?(this._y=Math.asin(d(g,-1,1)),.99999>Math.abs(g)?(this._x=Math.atan2(-l,e),this._z=Math.atan2(-f,a)):(this._x=Math.atan2(q,k),this._z=0)):"YXZ"===b?(this._x=Math.asin(-d(l,-1,1)),.99999>Math.abs(l)?(this._y=Math.atan2(g,e),this._z=Math.atan2(h, k)):(this._y=Math.atan2(-p,a),this._z=0)):"ZXY"===b?(this._x=Math.asin(d(q,-1,1)),.99999>Math.abs(q)?(this._y=Math.atan2(-p,e),this._z=Math.atan2(-f,k)):(this._y=0,this._z=Math.atan2(h,a))):"ZYX"===b?(this._y=Math.asin(-d(p,-1,1)),.99999>Math.abs(p)?(this._x=Math.atan2(q,e),this._z=Math.atan2(h,a)):(this._x=0,this._z=Math.atan2(-f,k))):"YZX"===b?(this._z=Math.asin(d(h,-1,1)),.99999>Math.abs(h)?(this._x=Math.atan2(-l,k),this._y=Math.atan2(-p,a)):(this._x=0,this._y=Math.atan2(g,e))):"XZY"===b?(this._z= Math.asin(-d(f,-1,1)),.99999>Math.abs(f)?(this._x=Math.atan2(q,k),this._y=Math.atan2(g,a)):(this._x=Math.atan2(-l,e),this._y=0)):THREE.warn("THREE.Euler: .setFromRotationMatrix given unsupported order: "+b);this._order=b;if(!1!==c)this.onChangeCallback;return this},setFromQuaternion:function{var a;return function(b,c,d){void 0===a&&(a=new THREE.Matrix4);a.makeRotationFromQuaternion(b);this.setFromRotationMatrix(a,c,d);return this}},setFromVector3:function(a,b){return this.set(a.x,a.y,a.z, b||this._order)},reorder:function{var a=new THREE.Quaternion;return function(b){a.setFromEuler(this);this.setFromQuaternion(a,b)}},equals:function(a){return a._x===this._x&&a._y===this._y&&a._z===this._z&&a._order===this._order},fromArray:function(a){this._x=a[0];this._y=a[1];this._z=a[2];void 0!==a[3]&&(this._order=a[3]);this.onChangeCallback;return this},toArray:function(a,b){void 0===a&&(a=[]);void 0===b&&(b=0);a[b]=this._x;a[b+1]=this._y;a[b+2]=this._z;a[b+3]=this._order;return a},toVector3:function(a){return a? a.set(this._x,this._y,this._z):new THREE.Vector3(this._x,this._y,this._z)},onChange:function(a){this.onChangeCallback=a;return this},onChangeCallback:function{},clone:function{return new THREE.Euler(this._x,this._y,this._z,this._order)}};THREE.Line3=function(a,b){this.start=void 0!==a?a:new THREE.Vector3;this.end=void 0!==b?b:new THREE.Vector3}; THREE.Line3.prototype={constructor:THREE.Line3,set:function(a,b){this.start.copy(a);this.end.copy(b);return this},copy:function(a){this.start.copy(a.start);this.end.copy(a.end);return this},center:function(a){return(a||new THREE.Vector3).addVectors(this.start,this.end).multiplyScalar(.5)},delta:function(a){return(a||new THREE.Vector3).subVectors(this.end,this.start)},distanceSq:function{return this.start.distanceToSquared(this.end)},distance:function{return this.start.distanceTo(this.end)},at:function(a, b){var c=b||new THREE.Vector3;return this.delta(c).multiplyScalar(a).add(this.start)},closestPointToPointParameter:function{var a=new THREE.Vector3,b=new THREE.Vector3;return function(c,d){a.subVectors(c,this.start);b.subVectors(this.end,this.start);var e=b.dot(b),e=b.dot(a)/e;d&&(e=THREE.Math.clamp(e,0,1));return e}},closestPointToPoint:function(a,b,c){a=this.closestPointToPointParameter(a,b);c=c||new THREE.Vector3;return this.delta(c).multiplyScalar(a).add(this.start)},applyMatrix4:function(a){this.start.applyMatrix4(a); this.end.applyMatrix4(a);return this},equals:function(a){return a.start.equals(this.start)&&a.end.equals(this.end)},clone:function{return(new THREE.Line3).copy(this)}};THREE.Box2=function(a,b){this.min=void 0!==a?a:new THREE.Vector2(Infinity,Infinity);this.max=void 0!==b?b:new THREE.Vector2(-Infinity,-Infinity)}; THREE.Box2.prototype={constructor:THREE.Box2,set:function(a,b){this.min.copy(a);this.max.copy(b);return this},setFromPoints:function(a){this.makeEmpty;for(var b=0,c=a.length;b<c;b++)this.expandByPoint(a[b]);return this},setFromCenterAndSize:function{var a=new THREE.Vector2;return function(b,c){var d=a.copy(c).multiplyScalar(.5);this.min.copy(b).sub(d);this.max.copy(b).add(d);return this}},copy:function(a){this.min.copy(a.min);this.max.copy(a.max);return this},makeEmpty:function{this.min.x= this.min.y=Infinity;this.max.x=this.max.y=-Infinity;return this},empty:function{return this.max.x<this.min.x||this.max.y<this.min.y},center:function(a){return(a||new THREE.Vector2).addVectors(this.min,this.max).multiplyScalar(.5)},size:function(a){return(a||new THREE.Vector2).subVectors(this.max,this.min)},expandByPoint:function(a){this.min.min(a);this.max.max(a);return this},expandByVector:function(a){this.min.sub(a);this.max.add(a);return this},expandByScalar:function(a){this.min.addScalar(-a); this.max.addScalar(a);return this},containsPoint:function(a){return a.x<this.min.x||a.x>this.max.x||a.y<this.min.y||a.y>this.max.y?!1:!0},containsBox:function(a){return this.min.x<=a.min.x&&a.max.x<=this.max.x&&this.min.y<=a.min.y&&a.max.y<=this.max.y?!0:!1},getParameter:function(a,b){return(b||new THREE.Vector2).set((a.x-this.min.x)/(this.max.x-this.min.x),(a.y-this.min.y)/(this.max.y-this.min.y))},isIntersectionBox:function(a){return a.max.x<this.min.x||a.min.x>this.max.x||a.max.y<this.min.y||a.min.y> this.max.y?!1:!0},clampPoint:function(a,b){return(b||new THREE.Vector2).copy(a).clamp(this.min,this.max)},distanceToPoint:function{var a=new THREE.Vector2;return function(b){return a.copy(b).clamp(this.min,this.max).sub(b).length}},intersect:function(a){this.min.max(a.min);this.max.min(a.max);return this},union:function(a){this.min.min(a.min);this.max.max(a.max);return this},translate:function(a){this.min.add(a);this.max.add(a);return this},equals:function(a){return a.min.equals(this.min)&& a.max.equals(this.max)},clone:function{return(new THREE.Box2).copy(this)}};THREE.Box3=function(a,b){this.min=void 0!==a?a:new THREE.Vector3(Infinity,Infinity,Infinity);this.max=void 0!==b?b:new THREE.Vector3(-Infinity,-Infinity,-Infinity)}; THREE.Box3.prototype={constructor:THREE.Box3,set:function(a,b){this.min.copy(a);this.max.copy(b);return this},setFromPoints:function(a){this.makeEmpty;for(var b=0,c=a.length;b<c;b++)this.expandByPoint(a[b]);return this},setFromCenterAndSize:function{var a=new THREE.Vector3;return function(b,c){var d=a.copy(c).multiplyScalar(.5);this.min.copy(b).sub(d);this.max.copy(b).add(d);return this}},setFromObject:function{var a=new THREE.Vector3;return function(b){var c=this;b.updateMatrixWorld(!0); this.makeEmpty;b.traverse(function(b){var e=b.geometry;if(void 0!==e)if(e instanceof THREE.Geometry)for(var f=e.vertices,e=0,g=f.length;e<g;e++)a.copy(f[e]),a.applyMatrix4(b.matrixWorld),c.expandByPoint(a);else if(e instanceof THREE.BufferGeometry&&void 0!==e.attributes.position)for(f=e.attributes.position.array,e=0,g=f.length;e<g;e+=3)a.set(f[e],f[e+1],f[e+2]),a.applyMatrix4(b.matrixWorld),c.expandByPoint(a)});return this}},copy:function(a){this.min.copy(a.min);this.max.copy(a.max);return this}, makeEmpty:function{this.min.x=this.min.y=this.min.z=Infinity;this.max.x=this.max.y=this.max.z=-Infinity;return this},empty:function{return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z},center:function(a){return(a||new THREE.Vector3).addVectors(this.min,this.max).multiplyScalar(.5)},size:function(a){return(a||new THREE.Vector3).subVectors(this.max,this.min)},expandByPoint:function(a){this.min.min(a);this.max.max(a);return this},expandByVector:function(a){this.min.sub(a); this.max.add(a);return this},expandByScalar:function(a){this.min.addScalar(-a);this.max.addScalar(a);return this},containsPoint:function(a){return a.x<this.min.x||a.x>this.max.x||a.y<this.min.y||a.y>this.max.y||a.z<this.min.z||a.z>this.max.z?!1:!0},containsBox:function(a){return this.min.x<=a.min.x&&a.max.x<=this.max.x&&this.min.y<=a.min.y&&a.max.y<=this.max.y&&this.min.z<=a.min.z&&a.max.z<=this.max.z?!0:!1},getParameter:function(a,b){return(b||new THREE.Vector3).set((a.x-this.min.x)/(this.max.x- this.min.x),(a.y-this.min.y)/(this.max.y-this.min.y),(a.z-this.min.z)/(this.max.z-this.min.z))},isIntersectionBox:function(a){return a.max.x<this.min.x||a.min.x>this.max.x||a.max.y<this.min.y||a.min.y>this.max.y||a.max.z<this.min.z||a.min.z>this.max.z?!1:!0},clampPoint:function(a,b){return(b||new THREE.Vector3).copy(a).clamp(this.min,this.max)},distanceToPoint:function{var a=new THREE.Vector3;return function(b){return a.copy(b).clamp(this.min,this.max).sub(b).length}},getBoundingSphere:function{var a= new THREE.Vector3;return function(b){b=b||new THREE.Sphere;b.center=this.center;b.radius=.5*this.size(a).length;return b}},intersect:function(a){this.min.max(a.min);this.max.min(a.max);return this},union:function(a){this.min.min(a.min);this.max.max(a.max);return this},applyMatrix4:function{var a=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];return function(b){a[0].set(this.min.x,this.min.y, this.min.z).applyMatrix4(b);a[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(b);a[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(b);a[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(b);a[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(b);a[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(b);a[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(b);a[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(b);this.makeEmpty;this.setFromPoints(a);return this}},translate:function(a){this.min.add(a); this.max.add(a);return this},equals:function(a){return a.min.equals(this.min)&&a.max.equals(this.max)},clone:function{return(new THREE.Box3).copy(this)}};THREE.Matrix3=function{this.elements=new Float32Array([1,0,0,0,1,0,0,0,1]);0<arguments.length&&THREE.error("THREE.Matrix3: the constructor no longer reads arguments. use .set instead.")}; THREE.Matrix3.prototype={constructor:THREE.Matrix3,set:function(a,b,c,d,e,f,g,h,k){var l=this.elements;l[0]=a;l[3]=b;l[6]=c;l[1]=d;l[4]=e;l[7]=f;l[2]=g;l[5]=h;l[8]=k;return this},identity:function{this.set(1,0,0,0,1,0,0,0,1);return this},copy:function(a){a=a.elements;this.set(a[0],a[3],a[6],a[1],a[4],a[7],a[2],a[5],a[8]);return this},multiplyVector3:function(a){THREE.warn("THREE.Matrix3: .multiplyVector3 has been removed. Use vector.applyMatrix3( matrix ) instead.");return a.applyMatrix3(this)}, multiplyVector3Array:function(a){THREE.warn("THREE.Matrix3: .multiplyVector3Array has been renamed. Use matrix.applyToVector3Array( array ) instead.");return this.applyToVector3Array(a)},applyToVector3Array:function{var a=new THREE.Vector3;return function(b,c,d){void 0===c&&(c=0);void 0===d&&(d=b.length);for(var e=0;e<d;e+=3,c+=3)a.x=b[c],a.y=b[c+1],a.z=b[c+2],a.applyMatrix3(this),b[c]=a.x,b[c+1]=a.y,b[c+2]=a.z;return b}},multiplyScalar:function(a){var b=this.elements;b[0]*=a;b[3]*=a;b[6]*= a;b[1]*=a;b[4]*=a;b[7]*=a;b[2]*=a;b[5]*=a;b[8]*=a;return this},determinant:function{var a=this.elements,b=a[0],c=a[1],d=a[2],e=a[3],f=a[4],g=a[5],h=a[6],k=a[7],a=a[8];return b*f*a-b*g*k-c*e*a+c*g*h+d*e*k-d*f*h},getInverse:function(a,b){var c=a.elements,d=this.elements;d[0]=c[10]*c[5]-c[6]*c[9];d[1]=-c[10]*c[1]+c[2]*c[9];d[2]=c[6]*c[1]-c[2]*c[5];d[3]=-c[10]*c[4]+c[6]*c[8];d[4]=c[10]*c[0]-c[2]*c[8];d[5]=-c[6]*c[0]+c[2]*c[4];d[6]=c[9]*c[4]-c[5]*c[8];d[7]=-c[9]*c[0]+c[1]*c[8];d[8]=c[5]*c[0]-c[1]*c[4]; c=c[0]*d[0]+c[1]*d[3]+c[2]*d[6];if(0===c){if(b)throw Error("Matrix3.getInverse: can't invert matrix, determinant is 0");THREE.warn("Matrix3.getInverse: can't invert matrix, determinant is 0");this.identity;return this}this.multiplyScalar(1/c);return this},transpose:function{var a,b=this.elements;a=b[1];b[1]=b[3];b[3]=a;a=b[2];b[2]=b[6];b[6]=a;a=b[5];b[5]=b[7];b[7]=a;return this},flattenToArrayOffset:function(a,b){var c=this.elements;a[b]=c[0];a[b+1]=c[1];a[b+2]=c[2];a[b+3]=c[3];a[b+4]=c[4]; a[b+5]=c[5];a[b+6]=c[6];a[b+7]=c[7];a[b+8]=c[8];return a},getNormalMatrix:function(a){this.getInverse(a).transpose;return this},transposeIntoArray:function(a){var b=this.elements;a[0]=b[0];a[1]=b[3];a[2]=b[6];a[3]=b[1];a[4]=b[4];a[5]=b[7];a[6]=b[2];a[7]=b[5];a[8]=b[8];return this},fromArray:function(a){this.elements.set(a);return this},toArray:function{var a=this.elements;return[a[0],a[1],a[2],a[3],a[4],a[5],a[6],a[7],a[8]]},clone:function{return(new THREE.Matrix3).fromArray(this.elements)}}; THREE.Matrix4=function{this.elements=new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]);0<arguments.length&&THREE.error("THREE.Matrix4: the constructor no longer reads arguments. use .set instead.")}; THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(a,b,c,d,e,f,g,h,k,l,p,q,n,t,r,s){var u=this.elements;u[0]=a;u[4]=b;u[8]=c;u[12]=d;u[1]=e;u[5]=f;u[9]=g;u[13]=h;u[2]=k;u[6]=l;u[10]=p;u[14]=q;u[3]=n;u[7]=t;u[11]=r;u[15]=s;return this},identity:function{this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){this.elements.set(a.elements);return this},extractPosition:function(a){THREE.warn("THREE.Matrix4: .extractPosition has been renamed to .copyPosition.");return this.copyPosition(a)}, copyPosition:function(a){var b=this.elements;a=a.elements;b[12]=a[12];b[13]=a[13];b[14]=a[14];return this},extractBasis:function(a,b,c){var d=this.elements;a.set(d[0],d[1],d[2]);b.set(d[4],d[5],d[6]);c.set(d[8],d[9],d[10]);return this},makeBasis:function(a,b,c){this.set(a.x,b.x,c.x,0,a.y,b.y,c.y,0,a.z,b.z,c.z,0,0,0,0,1);return this},extractRotation:function{var a=new THREE.Vector3;return function(b){var c=this.elements;b=b.elements;var d=1/a.set(b[0],b[1],b[2]).length,e=1/a.set(b[4],b[5],b[6]).length, f=1/a.set(b[8],b[9],b[10]).length;c[0]=b[0]*d;c[1]=b[1]*d;c[2]=b[2]*d;c[4]=b[4]*e;c[5]=b[5]*e;c[6]=b[6]*e;c[8]=b[8]*f;c[9]=b[9]*f;c[10]=b[10]*f;return this}},makeRotationFromEuler:function(a){!1===a instanceof THREE.Euler&&THREE.error("THREE.Matrix: .makeRotationFromEuler now expects a Euler rotation rather than a Vector3 and order.");var b=this.elements,c=a.x,d=a.y,e=a.z,f=Math.cos(c),c=Math.sin(c),g=Math.cos(d),d=Math.sin(d),h=Math.cos(e),e=Math.sin(e);if("XYZ"===a.order){a=f*h;var k=f*e, l=c*h,p=c*e;b[0]=g*h;b[4]=-g*e;b[8]=d;b[1]=k+l*d;b[5]=a-p*d;b[9]=-c*g;b[2]=p-a*d;b[6]=l+k*d;b[10]=f*g}else"YXZ"===a.order?(a=g*h,k=g*e,l=d*h,p=d*e,b[0]=a+p*c,b[4]=l*c-k,b[8]=f*d,b[1]=f*e,b[5]=f*h,b[9]=-c,b[2]=k*c-l,b[6]=p+a*c,b[10]=f*g):"ZXY"===a.order?(a=g*h,k=g*e,l=d*h,p=d*e,b[0]=a-p*c,b[4]=-f*e,b[8]=l+k*c,b[1]=k+l*c,b[5]=f*h,b[9]=p-a*c,b[2]=-f*d,b[6]=c,b[10]=f*g):"ZYX"===a.order?(a=f*h,k=f*e,l=c*h,p=c*e,b[0]=g*h,b[4]=l*d-k,b[8]=a*d+p,b[1]=g*e,b[5]=p*d+a,b[9]=k*d-l,b[2]=-d,b[6]=c*g,b[10]=f*g):"YZX"=== a.order?(a=f*g,k=f*d,l=c*g,p=c*d,b[0]=g*h,b[4]=p-a*e,b[8]=l*e+k,b[1]=e,b[5]=f*h,b[9]=-c*h,b[2]=-d*h,b[6]=k*e+l,b[10]=a-p*e):"XZY"===a.order&&(a=f*g,k=f*d,l=c*g,p=c*d,b[0]=g*h,b[4]=-e,b[8]=d*h,b[1]=a*e+p,b[5]=f*h,b[9]=k*e-l,b[2]=l*e-k,b[6]=c*h,b[10]=p*e+a);b[3]=0;b[7]=0;b[11]=0;b[12]=0;b[13]=0;b[14]=0;b[15]=1;return this},setRotationFromQuaternion:function(a){THREE.warn("THREE.Matrix4: .setRotationFromQuaternion has been renamed to .makeRotationFromQuaternion.");return this.makeRotationFromQuaternion(a)}, makeRotationFromQuaternion:function(a){var b=this.elements,c=a.x,d=a.y,e=a.z,f=a.w,g=c+c,h=d+d,k=e+e;a=c*g;var l=c*h,c=c*k,p=d*h,d=d*k,e=e*k,g=f*g,h=f*h,f=f*k;b[0]=1-(p+e);b[4]=l-f;b[8]=c+h;b[1]=l+f;b[5]=1-(a+e);b[9]=d-g;b[2]=c-h;b[6]=d+g;b[10]=1-(a+p);b[3]=0;b[7]=0;b[11]=0;b[12]=0;b[13]=0;b[14]=0;b[15]=1;return this},lookAt:function{var a=new THREE.Vector3,b=new THREE.Vector3,c=new THREE.Vector3;return function(d,e,f){var g=this.elements;c.subVectors(d,e).normalize;0===c.length&&(c.z=1);a.crossVectors(f, c).normalize;0===a.length&&(c.x+=1E-4,a.crossVectors(f,c).normalize);b.crossVectors(c,a);g[0]=a.x;g[4]=b.x;g[8]=c.x;g[1]=a.y;g[5]=b.y;g[9]=c.y;g[2]=a.z;g[6]=b.z;g[10]=c.z;return this}},multiply:function(a,b){return void 0!==b?(THREE.warn("THREE.Matrix4: .multiply now only accepts one argument. Use .multiplyMatrices( a, b ) instead."),this.multiplyMatrices(a,b)):this.multiplyMatrices(this,a)},multiplyMatrices:function(a,b){var c=a.elements,d=b.elements,e=this.elements,f=c[0],g=c[4],h=c[8], k=c[12],l=c[1],p=c[5],q=c[9],n=c[13],t=c[2],r=c[6],s=c[10],u=c[14],v=c[3],x=c[7],D=c[11],c=c[15],w=d[0],y=d[4],A=d[8],E=d[12],G=d[1],F=d[5],z=d[9],I=d[13],U=d[2],M=d[6],H=d[10],L=d[14],P=d[3],N=d[7],R=d[11],d=d[15];e[0]=f*w+g*G+h*U+k*P;e[4]=f*y+g*F+h*M+k*N;e[8]=f*A+g*z+h*H+k*R;e[12]=f*E+g*I+h*L+k*d;e[1]=l*w+p*G+q*U+n*P;e[5]=l*y+p*F+q*M+n*N;e[9]=l*A+p*z+q*H+n*R;e[13]=l*E+p*I+q*L+n*d;e[2]=t*w+r*G+s*U+u*P;e[6]=t*y+r*F+s*M+u*N;e[10]=t*A+r*z+s*H+u*R;e[14]=t*E+r*I+s*L+u*d;e[3]=v*w+x*G+D*U+c*P;e[7]=v*y+ x*F+D*M+c*N;e[11]=v*A+x*z+D*H+c*R;e[15]=v*E+x*I+D*L+c*d;return this},multiplyToArray:function(a,b,c){var d=this.elements;this.multiplyMatrices(a,b);c[0]=d[0];c[1]=d[1];c[2]=d[2];c[3]=d[3];c[4]=d[4];c[5]=d[5];c[6]=d[6];c[7]=d[7];c[8]=d[8];c[9]=d[9];c[10]=d[10];c[11]=d[11];c[12]=d[12];c[13]=d[13];c[14]=d[14];c[15]=d[15];return this},multiplyScalar:function(a){var b=this.elements;b[0]*=a;b[4]*=a;b[8]*=a;b[12]*=a;b[1]*=a;b[5]*=a;b[9]*=a;b[13]*=a;b[2]*=a;b[6]*=a;b[10]*=a;b[14]*=a;b[3]*=a;b[7]*=a;b[11]*= a;b[15]*=a;return this},multiplyVector3:function(a){THREE.warn("THREE.Matrix4: .multiplyVector3 has been removed. Use vector.applyMatrix4( matrix ) or vector.applyProjection( matrix ) instead.");return a.applyProjection(this)},multiplyVector4:function(a){THREE.warn("THREE.Matrix4: .multiplyVector4 has been removed. Use vector.applyMatrix4( matrix ) instead.");return a.applyMatrix4(this)},multiplyVector3Array:function(a){THREE.warn("THREE.Matrix4: .multiplyVector3Array has been renamed. Use matrix.applyToVector3Array( array ) instead."); return this.applyToVector3Array(a)},applyToVector3Array:function{var a=new THREE.Vector3;return function(b,c,d){void 0===c&&(c=0);void 0===d&&(d=b.length);for(var e=0;e<d;e+=3,c+=3)a.x=b[c],a.y=b[c+1],a.z=b[c+2],a.applyMatrix4(this),b[c]=a.x,b[c+1]=a.y,b[c+2]=a.z;return b}},rotateAxis:function(a){THREE.warn("THREE.Matrix4: .rotateAxis has been removed. Use Vector3.transformDirection( matrix ) instead.");a.transformDirection(this)},crossVector:function(a){THREE.warn("THREE.Matrix4: .crossVector has been removed. Use vector.applyMatrix4( matrix ) instead."); return a.applyMatrix4(this)},determinant:function{var a=this.elements,b=a[0],c=a[4],d=a[8],e=a[12],f=a[1],g=a[5],h=a[9],k=a[13],l=a[2],p=a[6],q=a[10],n=a[14];return a[3]*(+e*h*p-d*k*p-e*g*q+c*k*q+d*g*n-c*h*n)+a[7]*(+b*h*n-b*k*q+e*f*q-d*f*n+d*k*l-e*h*l)+a[11]*(+b*k*p-b*g*n-e*f*p+c*f*n+e*g*l-c*k*l)+a[15]*(-d*g*l-b*h*p+b*g*q+d*f*p-c*f*q+c*h*l)},transpose:function{var a=this.elements,b;b=a[1];a[1]=a[4];a[4]=b;b=a[2];a[2]=a[8];a[8]=b;b=a[6];a[6]=a[9];a[9]=b;b=a[3];a[3]=a[12];a[12]=b;b=a[7];a[7]=a[13]; a[13]=b;b=a[11];a[11]=a[14];a[14]=b;return this},flattenToArrayOffset:function(a,b){var c=this.elements;a[b]=c[0];a[b+1]=c[1];a[b+2]=c[2];a[b+3]=c[3];a[b+4]=c[4];a[b+5]=c[5];a[b+6]=c[6];a[b+7]=c[7];a[b+8]=c[8];a[b+9]=c[9];a[b+10]=c[10];a[b+11]=c[11];a[b+12]=c[12];a[b+13]=c[13];a[b+14]=c[14];a[b+15]=c[15];return a},getPosition:function{var a=new THREE.Vector3;return function{THREE.warn("THREE.Matrix4: .getPosition has been removed. Use Vector3.setFromMatrixPosition( matrix ) instead.");var b= this.elements;return a.set(b[12],b[13],b[14])}},setPosition:function(a){var b=this.elements;b[12]=a.x;b[13]=a.y;b[14]=a.z;return this},getInverse:function(a,b){var c=this.elements,d=a.elements,e=d[0],f=d[4],g=d[8],h=d[12],k=d[1],l=d[5],p=d[9],q=d[13],n=d[2],t=d[6],r=d[10],s=d[14],u=d[3],v=d[7],x=d[11],d=d[15];c[0]=p*s*v-q*r*v+q*t*x-l*s*x-p*t*d+l*r*d;c[4]=h*r*v-g*s*v-h*t*x+f*s*x+g*t*d-f*r*d;c[8]=g*q*v-h*p*v+h*l*x-f*q*x-g*l*d+f*p*d;c[12]=h*p*t-g*q*t-h*l*r+f*q*r+g*l*s-f*p*s;c[1]=q*r*u-p*s*u-q*n*x+ k*s*x+p*n*d-k*r*d;c[5]=g*s*u-h*r*u+h*n*x-e*s*x-g*n*d+e*r*d;c[9]=h*p*u-g*q*u-h*k*x+e*q*x+g*k*d-e*p*d;c[13]=g*q*n-h*p*n+h*k*r-e*q*r-g*k*s+e*p*s;c[2]=l*s*u-q*t*u+q*n*v-k*s*v-l*n*d+k*t*d;c[6]=h*t*u-f*s*u-h*n*v+e*s*v+f*n*d-e*t*d;c[10]=f*q*u-h*l*u+h*k*v-e*q*v-f*k*d+e*l*d;c[14]=h*l*n-f*q*n-h*k*t+e*q*t+f*k*s-e*l*s;c[3]=p*t*u-l*r*u-p*n*v+k*r*v+l*n*x-k*t*x;c[7]=f*r*u-g*t*u+g*n*v-e*r*v-f*n*x+e*t*x;c[11]=g*l*u-f*p*u-g*k*v+e*p*v+f*k*x-e*l*x;c[15]=f*p*n-g*l*n+g*k*t-e*p*t-f*k*r+e*l*r;c=e*c[0]+k*c[4]+n*c[8]+u*c[12]; if(0==c){if(b)throw Error("THREE.Matrix4.getInverse: can't invert matrix, determinant is 0");THREE.warn("THREE.Matrix4.getInverse: can't invert matrix, determinant is 0");this.identity;return this}this.multiplyScalar(1/c);return this},translate:function(a){THREE.error("THREE.Matrix4: .translate has been removed.")},rotateX:function(a){THREE.error("THREE.Matrix4: .rotateX has been removed.")},rotateY:function(a){THREE.error("THREE.Matrix4: .rotateY has been removed.")},rotateZ:function(a){THREE.error("THREE.Matrix4: .rotateZ has been removed.")}, rotateByAxis:function(a,b){THREE.error("THREE.Matrix4: .rotateByAxis has been removed.")},scale:function(a){var b=this.elements,c=a.x,d=a.y;a=a.z;b[0]*=c;b[4]*=d;b[8]*=a;b[1]*=c;b[5]*=d;b[9]*=a;b[2]*=c;b[6]*=d;b[10]*=a;b[3]*=c;b[7]*=d;b[11]*=a;return this},getMaxScaleOnAxis:function{var a=this.elements;return Math.sqrt(Math.max(a[0]*a[0]+a[1]*a[1]+a[2]*a[2],Math.max(a[4]*a[4]+a[5]*a[5]+a[6]*a[6],a[8]*a[8]+a[9]*a[9]+a[10]*a[10])))},makeTranslation:function(a,b,c){this.set(1,0,0,a,0,1,0,b,0,0,1, c,0,0,0,1);return this},makeRotationX:function(a){var b=Math.cos(a);a=Math.sin(a);this.set(1,0,0,0,0,b,-a,0,0,a,b,0,0,0,0,1);return this},makeRotationY:function(a){var b=Math.cos(a);a=Math.sin(a);this.set(b,0,a,0,0,1,0,0,-a,0,b,0,0,0,0,1);return this},makeRotationZ:function(a){var b=Math.cos(a);a=Math.sin(a);this.set(b,-a,0,0,a,b,0,0,0,0,1,0,0,0,0,1);return this},makeRotationAxis:function(a,b){var c=Math.cos(b),d=Math.sin(b),e=1-c,f=a.x,g=a.y,h=a.z,k=e*f,l=e*g;this.set(k*f+c,k*g-d*h,k*h+d*g,0,k*g+ d*h,l*g+c,l*h-d*f,0,k*h-d*g,l*h+d*f,e*h*h+c,0,0,0,0,1);return this},makeScale:function(a,b,c){this.set(a,0,0,0,0,b,0,0,0,0,c,0,0,0,0,1);return this},compose:function(a,b,c){this.makeRotationFromQuaternion(b);this.scale(c);this.setPosition(a);return this},decompose:function{var a=new THREE.Vector3,b=new THREE.Matrix4;return function(c,d,e){var f=this.elements,g=a.set(f[0],f[1],f[2]).length,h=a.set(f[4],f[5],f[6]).length,k=a.set(f[8],f[9],f[10]).length;0>this.determinant&&(g=-g);c.x=f[12]; c.y=f[13];c.z=f[14];b.elements.set(this.elements);c=1/g;var f=1/h,l=1/k;b.elements[0]*=c;b.elements[1]*=c;b.elements[2]*=c;b.elements[4]*=f;b.elements[5]*=f;b.elements[6]*=f;b.elements[8]*=l;b.elements[9]*=l;b.elements[10]*=l;d.setFromRotationMatrix(b);e.x=g;e.y=h;e.z=k;return this}},makeFrustum:function(a,b,c,d,e,f){var g=this.elements;g[0]=2*e/(b-a);g[4]=0;g[8]=(b+a)/(b-a);g[12]=0;g[1]=0;g[5]=2*e/(d-c);g[9]=(d+c)/(d-c);g[13]=0;g[2]=0;g[6]=0;g[10]=-(f+e)/(f-e);g[14]=-2*f*e/(f-e);g[3]=0;g[7]=0; g[11]=-1;g[15]=0;return this},makePerspective:function(a,b,c,d){a=c*Math.tan(THREE.Math.degToRad(.5*a));var e=-a;return this.makeFrustum(e*b,a*b,e,a,c,d)},makeOrthographic:function(a,b,c,d,e,f){var g=this.elements,h=b-a,k=c-d,l=f-e;g[0]=2/h;g[4]=0;g[8]=0;g[12]=-((b+a)/h);g[1]=0;g[5]=2/k;g[9]=0;g[13]=-((c+d)/k);g[2]=0;g[6]=0;g[10]=-2/l;g[14]=-((f+e)/l);g[3]=0;g[7]=0;g[11]=0;g[15]=1;return this},fromArray:function(a){this.elements.set(a);return this},toArray:function{var a=this.elements;return[a[0], a[1],a[2],a[3],a[4],a[5],a[6],a[7],a[8],a[9],a[10],a[11],a[12],a[13],a[14],a[15]]},clone:function{return(new THREE.Matrix4).fromArray(this.elements)}};THREE.Ray=function(a,b){this.origin=void 0!==a?a:new THREE.Vector3;this.direction=void 0!==b?b:new THREE.Vector3}; THREE.Ray.prototype={constructor:THREE.Ray,set:function(a,b){this.origin.copy(a);this.direction.copy(b);return this},copy:function(a){this.origin.copy(a.origin);this.direction.copy(a.direction);return this},at:function(a,b){return(b||new THREE.Vector3).copy(this.direction).multiplyScalar(a).add(this.origin)},recast:function{var a=new THREE.Vector3;return function(b){this.origin.copy(this.at(b,a));return this}},closestPointToPoint:function(a,b){var c=b||new THREE.Vector3;c.subVectors(a,this.origin); var d=c.dot(this.direction);return 0>d?c.copy(this.origin):c.copy(this.direction).multiplyScalar(d).add(this.origin)},distanceToPoint:function{var a=new THREE.Vector3;return function(b){var c=a.subVectors(b,this.origin).dot(this.direction);if(0>c)return this.origin.distanceTo(b);a.copy(this.direction).multiplyScalar(c).add(this.origin);return a.distanceTo(b)}},distanceSqToSegment:function{var a=new THREE.Vector3,b=new THREE.Vector3,c=new THREE.Vector3;return function(d,e,f,g){a.copy(d).add(e).multiplyScalar(.5); b.copy(e).sub(d).normalize;c.copy(this.origin).sub(a);var h=.5*d.distanceTo(e),k=-this.direction.dot(b),l=c.dot(this.direction),p=-c.dot(b),q=c.lengthSq,n=Math.abs(1-k*k),t;0<n?(d=k*p-l,e=k*l-p,t=h*n,0<=d?e>=-t?e<=t?(h=1/n,d*=h,e*=h,k=d*(d+k*e+2*l)+e*(k*d+e+2*p)+q):(e=h,d=Math.max(0,-(k*e+l)),k=-d*d+e*(e+2*p)+q):(e=-h,d=Math.max(0,-(k*e+l)),k=-d*d+e*(e+2*p)+q):e<=-t?(d=Math.max(0,-(-k*h+l)),e=0<d?-h:Math.min(Math.max(-h,-p),h),k=-d*d+e*(e+2*p)+q):e<=t?(d=0,e=Math.min(Math.max(-h,-p),h),k=e*(e+ 2*p)+q):(d=Math.max(0,-(k*h+l)),e=0<d?h:Math.min(Math.max(-h,-p),h),k=-d*d+e*(e+2*p)+q)):(e=0<k?-h:h,d=Math.max(0,-(k*e+l)),k=-d*d+e*(e+2*p)+q);f&&f.copy(this.direction).multiplyScalar(d).add(this.origin);g&&g.copy(b).multiplyScalar(e).add(a);return k}},isIntersectionSphere:function(a){return this.distanceToPoint(a.center)<=a.radius},intersectSphere:function{var a=new THREE.Vector3;return function(b,c){a.subVectors(b.center,this.origin);var d=a.dot(this.direction),e=a.dot(a)-d*d,f=b.radius*b.radius; if(e>f)return null;f=Math.sqrt(f-e);e=d-f;d+=f;return 0>e&&0>d?null:0>e?this.at(d,c):this.at(e,c)}},isIntersectionPlane:function(a){var b=a.distanceToPoint(this.origin);return 0===b||0>a.normal.dot(this.direction)*b?!0:!1},distanceToPlane:function(a){var b=a.normal.dot(this.direction);if(0==b)return 0==a.distanceToPoint(this.origin)?0:null;a=-(this.origin.dot(a.normal)+a.constant)/b;return 0<=a?a:null},intersectPlane:function(a,b){var c=this.distanceToPlane(a);return null===c?null:this.at(c,b)}, isIntersectionBox:function{var a=new THREE.Vector3;return function(b){return null!==this.intersectBox(b,a)}},intersectBox:function(a,b){var c,d,e,f,g;d=1/this.direction.x;f=1/this.direction.y;g=1/this.direction.z;var h=this.origin;0<=d?(c=(a.min.x-h.x)*d,d*=a.max.x-h.x):(c=(a.max.x-h.x)*d,d*=a.min.x-h.x);0<=f?(e=(a.min.y-h.y)*f,f*=a.max.y-h.y):(e=(a.max.y-h.y)*f,f*=a.min.y-h.y);if(c>f||e>d)return null;if(e>c||c!==c)c=e;if(f<d||d!==d)d=f;0<=g?(e=(a.min.z-h.z)*g,g*=a.max.z-h.z):(e=(a.max.z-h.z)* g,g*=a.min.z-h.z);if(c>g||e>d)return null;if(e>c||c!==c)c=e;if(g<d||d!==d)d=g;return 0>d?null:this.at(0<=c?c:d,b)},intersectTriangle:function{var a=new THREE.Vector3,b=new THREE.Vector3,c=new THREE.Vector3,d=new THREE.Vector3;return function(e,f,g,h,k){b.subVectors(f,e);c.subVectors(g,e);d.crossVectors(b,c);f=this.direction.dot(d);if(0<f){if(h)return null;h=1}else if(0>f)h=-1,f=-f;else return null;a.subVectors(this.origin,e);e=h*this.direction.dot(c.crossVectors(a,c));if(0>e)return null;g=h*this.direction.dot(b.cross(a)); if(0>g||e+g>f)return null;e=-h*a.dot(d);return 0>e?null:this.at(e/f,k)}},applyMatrix4:function(a){this.direction.add(this.origin).applyMatrix4(a);this.origin.applyMatrix4(a);this.direction.sub(this.origin);this.direction.normalize;return this},equals:function(a){return a.origin.equals(this.origin)&&a.direction.equals(this.direction)},clone:function{return(new THREE.Ray).copy(this)}};THREE.Sphere=function(a,b){this.center=void 0!==a?a:new THREE.Vector3;this.radius=void 0!==b?b:0}; THREE.Sphere.prototype={constructor:THREE.Sphere,set:function(a,b){this.center.copy(a);this.radius=b;return this},setFromPoints:function{var a=new THREE.Box3;return function(b,c){var d=this.center;void 0!==c?d.copy(c):a.setFromPoints(b).center(d);for(var e=0,f=0,g=b.length;f<g;f++)e=Math.max(e,d.distanceToSquared(b[f]));this.radius=Math.sqrt(e);return this}},copy:function(a){this.center.copy(a.center);this.radius=a.radius;return this},empty:function{return 0>=this.radius},containsPoint:function(a){return a.distanceToSquared(this.center)<= this.radius*this.radius},distanceToPoint:function(a){return a.distanceTo(this.center)-this.radius},intersectsSphere:function(a){var b=this.radius+a.radius;return a.center.distanceToSquared(this.center)<=b*b},clampPoint:function(a,b){var c=this.center.distanceToSquared(a),d=b||new THREE.Vector3;d.copy(a);c>this.radius*this.radius&&(d.sub(this.center).normalize,d.multiplyScalar(this.radius).add(this.center));return d},getBoundingBox:function(a){a=a||new THREE.Box3;a.set(this.center,this.center);a.expandByScalar(this.radius); return a},applyMatrix4:function(a){this.center.applyMatrix4(a);this.radius*=a.getMaxScaleOnAxis;return this},translate:function(a){this.center.add(a);return this},equals:function(a){return a.center.equals(this.center)&&a.radius===this.radius},clone:function{return(new THREE.Sphere).copy(this)}}; THREE.Frustum=function(a,b,c,d,e,f){this.planes=[void 0!==a?a:new THREE.Plane,void 0!==b?b:new THREE.Plane,void 0!==c?c:new THREE.Plane,void 0!==d?d:new THREE.Plane,void 0!==e?e:new THREE.Plane,void 0!==f?f:new THREE.Plane]}; THREE.Frustum.prototype={constructor:THREE.Frustum,set:function(a,b,c,d,e,f){var g=this.planes;g[0].copy(a);g[1].copy(b);g[2].copy(c);g[3].copy(d);g[4].copy(e);g[5].copy(f);return this},copy:function(a){for(var b=this.planes,c=0;6>c;c++)b[c].copy(a.planes[c]);return this},setFromMatrix:function(a){var b=this.planes,c=a.elements;a=c[0];var d=c[1],e=c[2],f=c[3],g=c[4],h=c[5],k=c[6],l=c[7],p=c[8],q=c[9],n=c[10],t=c[11],r=c[12],s=c[13],u=c[14],c=c[15];b[0].setComponents(f-a,l-g,t-p,c-r).normalize;b[1].setComponents(f+ a,l+g,t+p,c+r).normalize;b[2].setComponents(f+d,l+h,t+q,c+s).normalize;b[3].setComponents(f-d,l-h,t-q,c-s).normalize;b[4].setComponents(f-e,l-k,t-n,c-u).normalize;b[5].setComponents(f+e,l+k,t+n,c+u).normalize;return this},intersectsObject:function{var a=new THREE.Sphere;return function(b){var c=b.geometry;null===c.boundingSphere&&c.computeBoundingSphere;a.copy(c.boundingSphere);a.applyMatrix4(b.matrixWorld);return this.intersectsSphere(a)}},intersectsSphere:function(a){var b=this.planes, c=a.center;a=-a.radius;for(var d=0;6>d;d++)if(b[d].distanceToPoint(c)<a)return!1;return!0},intersectsBox:function{var a=new THREE.Vector3,b=new THREE.Vector3;return function(c){for(var d=this.planes,e=0;6>e;e++){var f=d[e];a.x=0<f.normal.x?c.min.x:c.max.x;b.x=0<f.normal.x?c.max.x:c.min.x;a.y=0<f.normal.y?c.min.y:c.max.y;b.y=0<f.normal.y?c.max.y:c.min.y;a.z=0<f.normal.z?c.min.z:c.max.z;b.z=0<f.normal.z?c.max.z:c.min.z;var g=f.distanceToPoint(a),f=f.distanceToPoint(b);if(0>g&&0>f)return!1}return!0}}, containsPoint:function(a){for(var b=this.planes,c=0;6>c;c++)if(0>b[c].distanceToPoint(a))return!1;return!0},clone:function{return(new THREE.Frustum).copy(this)}};THREE.Plane=function(a,b){this.normal=void 0!==a?a:new THREE.Vector3(1,0,0);this.constant=void 0!==b?b:0}; THREE.Plane.prototype={constructor:THREE.Plane,set:function(a,b){this.normal.copy(a);this.constant=b;return this},setComponents:function(a,b,c,d){this.normal.set(a,b,c);this.constant=d;return this},setFromNormalAndCoplanarPoint:function(a,b){this.normal.copy(a);this.constant=-b.dot(this.normal);return this},setFromCoplanarPoints:function{var a=new THREE.Vector3,b=new THREE.Vector3;return function(c,d,e){d=a.subVectors(e,d).cross(b.subVectors(c,d)).normalize;this.setFromNormalAndCoplanarPoint(d, c);return this}},copy:function(a){this.normal.copy(a.normal);this.constant=a.constant;return this},normalize:function{var a=1/this.normal.length;this.normal.multiplyScalar(a);this.constant*=a;return this},negate:function{this.constant*=-1;this.normal.negate;return this},distanceToPoint:function(a){return this.normal.dot(a)+this.constant},distanceToSphere:function(a){return this.distanceToPoint(a.center)-a.radius},projectPoint:function(a,b){return this.orthoPoint(a,b).sub(a).negate},orthoPoint:function(a, b){var c=this.distanceToPoint(a);return(b||new THREE.Vector3).copy(this.normal).multiplyScalar(c)},isIntersectionLine:function(a){var b=this.distanceToPoint(a.start);a=this.distanceToPoint(a.end);return 0>b&&0<a||0>a&&0<b},intersectLine:function{var a=new THREE.Vector3;return function(b,c){var d=c||new THREE.Vector3,e=b.delta(a),f=this.normal.dot(e);if(0==f){if(0==this.distanceToPoint(b.start))return d.copy(b.start)}else return f=-(b.start.dot(this.normal)+this.constant)/f,0>f||1<f?void 0:d.copy(e).multiplyScalar(f).add(b.start)}}, coplanarPoint:function(a){return(a||new THREE.Vector3).copy(this.normal).multiplyScalar(-this.constant)},applyMatrix4:function{var a=new THREE.Vector3,b=new THREE.Vector3,c=new THREE.Matrix3;return function(d,e){var f=e||c.getNormalMatrix(d),f=a.copy(this.normal).applyMatrix3(f),g=this.coplanarPoint(b);g.applyMatrix4(d);this.setFromNormalAndCoplanarPoint(f,g);return this}},translate:function(a){this.constant-=a.dot(this.normal);return this},equals:function(a){return a.normal.equals(this.normal)&& a.constant==this.constant},clone:function{return(new THREE.Plane).copy(this)}}; THREE.Math={generateUUID:function{var a="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""),b=Array(36),c=0,d;return function{for(var e=0;36>e;e++)8==e||13==e||18==e||23==e?b[e]="-":14==e?b[e]="4":(2>=c&&(c=33554432+16777216*Math.random|0),d=c&15,c>>=4,b[e]=a[19==e?d&3|8:d]);return b.join("")}},clamp:function(a,b,c){return a<b?b:a>c?c:a},clampBottom:function(a,b){return a<b?b:a},mapLinear:function(a,b,c,d,e){return d+(a-b)*(e-d)/(c-b)},smoothstep:function(a,b,c){if(a<= b)return 0;if(a>=c)return 1;a=(a-b)/(c-b);return a*a*(3-2*a)},smootherstep:function(a,b,c){if(a<=b)return 0;if(a>=c)return 1;a=(a-b)/(c-b);return a*a*a*(a*(6*a-15)+10)},random16:function{return(65280*Math.random+255*Math.random)/65535},randInt:function(a,b){return Math.floor(this.randFloat(a,b))},randFloat:function(a,b){return a+Math.random*(b-a)},randFloatSpread:function(a){return a*(.5-Math.random)},degToRad:function{var a=Math.PI/180;return function(b){return b*a}},radToDeg:function{var a= 180/Math.PI;return function(b){return b*a}},isPowerOfTwo:function(a){return 0===(a&a-1)&&0!==a},nextPowerOfTwo:function(a){a--;a|=a>>1;a|=a>>2;a|=a>>4;a|=a>>8;a|=a>>16;a++;return a}}; THREE.Spline=function(a){function b(a,b,c,d,e,f,g){a=.5*(c-a);d=.5*(d-b);return(2*(b-c)+a+d)*g+(-3*(b-c)-2*a-d)*f+a*e+b}this.points=a;var c=[],d={x:0,y:0,z:0},e,f,g,h,k,l,p,q,n;this.initFromArray=function(a){this.points=[];for(var b=0;b<a.length;b++)this.points[b]={x:a[b][0],y:a[b][1],z:a[b][2]}};this.getPoint=function(a){e=(this.points.length-1)*a;f=Math.floor(e);g=e-f;c[0]=0===f?f:f-1;c[1]=f;c[2]=f>this.points.length-2?this.points.length-1:f+1;c[3]=f>this.points.length-3?this.points.length-1:f+ 2;l=this.points[c[0]];p=this.points[c[1]];q=this.points[c[2]];n=this.points[c[3]];h=g*g;k=g*h;d.x=b(l.x,p.x,q.x,n.x,g,h,k);d.y=b(l.y,p.y,q.y,n.y,g,h,k);d.z=b(l.z,p.z,q.z,n.z,g,h,k);return d};this.getControlPointsArray=function{var a,b,c=this.points.length,d=[];for(a=0;a<c;a++)b=this.points[a],d[a]=[b.x,b.y,b.z];return d};this.getLength=function(a){var b,c,d,e=b=b=0,f=new THREE.Vector3,g=new THREE.Vector3,h=[],k=0;h[0]=0;a||(a=100);c=this.points.length*a;f.copy(this.points[0]);for(a=1;a<c;a++)b= a/c,d=this.getPoint(b),g.copy(d),k+=g.distanceTo(f),f.copy(d),b*=this.points.length-1,b=Math.floor(b),b!=e&&(h[b]=k,e=b);h[h.length]=k;return{chunks:h,total:k}};this.reparametrizeByArcLength=function(a){var b,c,d,e,f,g,h=[],k=new THREE.Vector3,n=this.getLength;h.push(k.copy(this.points[0]).clone);for(b=1;b<this.points.length;b++){c=n.chunks[b]-n.chunks[b-1];g=Math.ceil(a*c/n.total);e=(b-1)/(this.points.length-1);f=b/(this.points.length-1);for(c=1;c<g-1;c++)d=e+1/g*c*(f-e),d=this.getPoint(d),h.push(k.copy(d).clone); h.push(k.copy(this.points[b]).clone)}this.points=h}};THREE.Triangle=function(a,b,c){this.a=void 0!==a?a:new THREE.Vector3;this.b=void 0!==b?b:new THREE.Vector3;this.c=void 0!==c?c:new THREE.Vector3};THREE.Triangle.normal=function{var a=new THREE.Vector3;return function(b,c,d,e){e=e||new THREE.Vector3;e.subVectors(d,c);a.subVectors(b,c);e.cross(a);b=e.lengthSq;return 0<b?e.multiplyScalar(1/Math.sqrt(b)):e.set(0,0,0)}}; THREE.Triangle.barycoordFromPoint=function{var a=new THREE.Vector3,b=new THREE.Vector3,c=new THREE.Vector3;return function(d,e,f,g,h){a.subVectors(g,e);b.subVectors(f,e);c.subVectors(d,e);d=a.dot(a);e=a.dot(b);f=a.dot(c);var k=b.dot(b);g=b.dot(c);var l=d*k-e*e;h=h||new THREE.Vector3;if(0==l)return h.set(-2,-1,-1);l=1/l;k=(k*f-e*g)*l;d=(d*g-e*f)*l;return h.set(1-k-d,d,k)}}; THREE.Triangle.containsPoint=function{var a=new THREE.Vector3;return function(b,c,d,e){b=THREE.Triangle.barycoordFromPoint(b,c,d,e,a);return 0<=b.x&&0<=b.y&&1>=b.x+b.y}}; THREE.Triangle.prototype={constructor:THREE.Triangle,set:function(a,b,c){this.a.copy(a);this.b.copy(b);this.c.copy(c);return this},setFromPointsAndIndices:function(a,b,c,d){this.a.copy(a[b]);this.b.copy(a[c]);this.c.copy(a[d]);return this},copy:function(a){this.a.copy(a.a);this.b.copy(a.b);this.c.copy(a.c);return this},area:function{var a=new THREE.Vector3,b=new THREE.Vector3;return function{a.subVectors(this.c,this.b);b.subVectors(this.a,this.b);return.5*a.cross(b).length}},midpoint:function(a){return(a|| new THREE.Vector3).addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)},normal:function(a){return THREE.Triangle.normal(this.a,this.b,this.c,a)},plane:function(a){return(a||new THREE.Plane).setFromCoplanarPoints(this.a,this.b,this.c)},barycoordFromPoint:function(a,b){return THREE.Triangle.barycoordFromPoint(a,this.a,this.b,this.c,b)},containsPoint:function(a){return THREE.Triangle.containsPoint(a,this.a,this.b,this.c)},equals:function(a){return a.a.equals(this.a)&&a.b.equals(this.b)&&a.c.equals(this.c)}, clone:function{return(new THREE.Triangle).copy(this)}};THREE.Clock=function(a){this.autoStart=void 0!==a?a:!0;this.elapsedTime=this.oldTime=this.startTime=0;this.running=!1}; THREE.Clock.prototype={constructor:THREE.Clock,start:function{this.oldTime=this.startTime=void 0!==self.performance&&void 0!==self.performance.now?self.performance.now:Date.now;this.running=!0},stop:function{this.getElapsedTime;this.running=!1},getElapsedTime:function{this.getDelta;return this.elapsedTime},getDelta:function{var a=0;this.autoStart&&!this.running&&this.start;if(this.running){var b=void 0!==self.performance&&void 0!==self.performance.now?self.performance.now:Date.now, a=.001*(b-this.oldTime);this.oldTime=b;this.elapsedTime+=a}return a}};THREE.EventDispatcher=function{}; THREE.EventDispatcher.prototype={constructor:THREE.EventDispatcher,apply:function(a){a.addEventListener=THREE.EventDispatcher.prototype.addEventListener;a.hasEventListener=THREE.EventDispatcher.prototype.hasEventListener;a.removeEventListener=THREE.EventDispatcher.prototype.removeEventListener;a.dispatchEvent=THREE.EventDispatcher.prototype.dispatchEvent},addEventListener:function(a,b){void 0===this._listeners&&(this._listeners={});var c=this._listeners;void 0===c[a]&&(c[a]=[]);-1===c[a].indexOf(b)&& c[a].push(b)},hasEventListener:function(a,b){if(void 0===this._listeners)return!1;var c=this._listeners;return void 0!==c[a]&&-1!==c[a].indexOf(b)?!0:!1},removeEventListener:function(a,b){if(void 0!==this._listeners){var c=this._listeners[a];if(void 0!==c){var d=c.indexOf(b);-1!==d&&c.splice(d,1)}}},dispatchEvent:function(a){if(void 0!==this._listeners){var b=this._listeners[a.type];if(void 0!==b){a.target=this;for(var c=[],d=b.length,e=0;e<d;e++)c[e]=b[e];for(e=0;e<d;e++)c[e].call(this,a)}}}}; (function(a){a.Raycaster=function(b,c,f,g){this.ray=new a.Ray(b,c);this.near=f||0;this.far=g||Infinity;this.params={Sprite:{},Mesh:{},PointCloud:{threshold:1},LOD:{},Line:{}}};var b=function(a,b){return a.distance-b.distance},c=function(a,b,f,g){a.raycast(b,f);if(!0===g){a=a.children;g=0;for(var h=a.length;g<h;g++)c(a[g],b,f,!0)}};a.Raycaster.prototype={constructor:a.Raycaster,precision:1E-4,linePrecision:1,set:function(a,b){this.ray.set(a,b)},setFromCamera:function(b,c){c instanceof a.PerspectiveCamera? (this.ray.origin.copy(c.position),this.ray.direction.set(b.x,b.y,.5).unproject(c).sub(c.position).normalize):c instanceof a.OrthographicCamera?(this.ray.origin.set(b.x,b.y,-1).unproject(c),this.ray.direction.set(0,0,-1).transformDirection(c.matrixWorld)):a.error("THREE.Raycaster: Unsupported camera type.")},intersectObject:function(a,e){var f=[];c(a,this,f,e);f.sort(b);return f},intersectObjects:function(d,e){var f=[];if(!1===d instanceof Array)return a.warn("THREE.Raycaster.intersectObjects: objects is not an Array."), f;for(var g=0,h=d.length;g<h;g++)c(d[g],this,f,e);f.sort(b);return f}}})(THREE); THREE.Object3D=function{Object.defineProperty(this,"id",{value:THREE.Object3DIdCount++});this.uuid=THREE.Math.generateUUID;this.name="";this.type="Object3D";this.parent=void 0;this.children=[];this.up=THREE.Object3D.DefaultUp.clone;var a=new THREE.Vector3,b=new THREE.Euler,c=new THREE.Quaternion,d=new THREE.Vector3(1,1,1);b.onChange(function{c.setFromEuler(b,!1)});c.onChange(function{b.setFromQuaternion(c,void 0,!1)});Object.defineProperties(this,{position:{enumerable:!0,value:a},rotation:{enumerable:!0, value:b},quaternion:{enumerable:!0,value:c},scale:{enumerable:!0,value:d}});this.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixAutoUpdate=!0;this.matrixWorldNeedsUpdate=!1;this.visible=!0;this.receiveShadow=this.castShadow=!1;this.frustumCulled=!0;this.renderOrder=0;this.userData={}};THREE.Object3D.DefaultUp=new THREE.Vector3(0,1,0); THREE.Object3D.prototype={constructor:THREE.Object3D,get eulerOrder{THREE.warn("THREE.Object3D: .eulerOrder has been moved to .rotation.order.");return this.rotation.order},set eulerOrder(a){THREE.warn("THREE.Object3D: .eulerOrder has been moved to .rotation.order.");this.rotation.order=a},get useQuaternion{THREE.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")},set useQuaternion(a){THREE.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")}, applyMatrix:function(a){this.matrix.multiplyMatrices(a,this.matrix);this.matrix.decompose(this.position,this.quaternion,this.scale)},setRotationFromAxisAngle:function(a,b){this.quaternion.setFromAxisAngle(a,b)},setRotationFromEuler:function(a){this.quaternion.setFromEuler(a,!0)},setRotationFromMatrix:function(a){this.quaternion.setFromRotationMatrix(a)},setRotationFromQuaternion:function(a){this.quaternion.copy(a)},rotateOnAxis:function{var a=new THREE.Quaternion;return function(b,c){a.setFromAxisAngle(b, c);this.quaternion.multiply(a);return this}},rotateX:function{var a=new THREE.Vector3(1,0,0);return function(b){return this.rotateOnAxis(a,b)}},rotateY:function{var a=new THREE.Vector3(0,1,0);return function(b){return this.rotateOnAxis(a,b)}},rotateZ:function{var a=new THREE.Vector3(0,0,1);return function(b){return this.rotateOnAxis(a,b)}},translateOnAxis:function{var a=new THREE.Vector3;return function(b,c){a.copy(b).applyQuaternion(this.quaternion);this.position.add(a.multiplyScalar(c)); return this}},translate:function(a,b){THREE.warn("THREE.Object3D: .translate has been removed. Use .translateOnAxis( axis, distance ) instead.");return this.translateOnAxis(b,a)},translateX:function{var a=new THREE.Vector3(1,0,0);return function(b){return this.translateOnAxis(a,b)}},translateY:function{var a=new THREE.Vector3(0,1,0);return function(b){return this.translateOnAxis(a,b)}},translateZ:function{var a=new THREE.Vector3(0,0,1);return function(b){return this.translateOnAxis(a, b)}},localToWorld:function(a){return a.applyMatrix4(this.matrixWorld)},worldToLocal:function{var a=new THREE.Matrix4;return function(b){return b.applyMatrix4(a.getInverse(this.matrixWorld))}},lookAt:function{var a=new THREE.Matrix4;return function(b){a.lookAt(b,this.position,this.up);this.quaternion.setFromRotationMatrix(a)}},add:function(a){if(1<arguments.length){for(var b=0;b<arguments.length;b++)this.add(arguments[b]);return this}if(a===this)return THREE.error("THREE.Object3D.add: object can't be added as a child of itself.", a),this;a instanceof THREE.Object3D?(void 0!==a.parent&&a.parent.remove(a),a.parent=this,a.dispatchEvent({type:"added"}),this.children.push(a)):THREE.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",a);return this},remove:function(a){if(1<arguments.length)for(var b=0;b<arguments.length;b++)this.remove(arguments[b]);b=this.children.indexOf(a);-1!==b&&(a.parent=void 0,a.dispatchEvent({type:"removed"}),this.children.splice(b,1))},getChildByName:function(a){THREE.warn("THREE.Object3D: .getChildByName has been renamed to .getObjectByName."); return this.getObjectByName(a)},getObjectById:function(a){return this.getObjectByProperty("id",a)},getObjectByName:function(a){return this.getObjectByProperty("name",a)},getObjectByProperty:function(a,b){if(this[a]===b)return this;for(var c=0,d=this.children.length;c<d;c++){var e=this.children[c].getObjectByProperty(a,b);if(void 0!==e)return e}},getWorldPosition:function(a){a=a||new THREE.Vector3;this.updateMatrixWorld(!0);return a.setFromMatrixPosition(this.matrixWorld)},getWorldQuaternion:function{var a= new THREE.Vector3,b=new THREE.Vector3;return function(c){c=c||new THREE.Quaternion;this.updateMatrixWorld(!0);this.matrixWorld.decompose(a,c,b);return c}},getWorldRotation:function{var a=new THREE.Quaternion;return function(b){b=b||new THREE.Euler;this.getWorldQuaternion(a);return b.setFromQuaternion(a,this.rotation.order,!1)}},getWorldScale:function{var a=new THREE.Vector3,b=new THREE.Quaternion;return function(c){c=c||new THREE.Vector3;this.updateMatrixWorld(!0);this.matrixWorld.decompose(a, b,c);return c}},getWorldDirection:function{var a=new THREE.Quaternion;return function(b){b=b||new THREE.Vector3;this.getWorldQuaternion(a);return b.set(0,0,1).applyQuaternion(a)}},raycast:function{},traverse:function(a){a(this);for(var b=0,c=this.children.length;b<c;b++)this.children[b].traverse(a)},traverseVisible:function(a){if(!1!==this.visible){a(this);for(var b=0,c=this.children.length;b<c;b++)this.children[b].traverseVisible(a)}},traverseAncestors:function(a){this.parent&&(a(this.parent), this.parent.traverseAncestors(a))},updateMatrix:function{this.matrix.compose(this.position,this.quaternion,this.scale);this.matrixWorldNeedsUpdate=!0},updateMatrixWorld:function(a){!0===this.matrixAutoUpdate&&this.updateMatrix;if(!0===this.matrixWorldNeedsUpdate||!0===a)void 0===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorldNeedsUpdate=!1,a=!0;for(var b=0,c=this.children.length;b<c;b++)this.children[b].updateMatrixWorld(a)}, toJSON:function{var a={metadata:{version:4.3,type:"Object",generator:"ObjectExporter"}},b={},c={},d=function(b){void 0===a.materials&&(a.materials=[]);if(void 0===c[b.uuid]){var d=b.toJSON;delete d.metadata;c[b.uuid]=d;a.materials.push(d)}return b.uuid},e=function(c){var g={};g.uuid=c.uuid;g.type=c.type;""!==c.name&&(g.name=c.name);"{}"!==JSON.stringify(c.userData)&&(g.userData=c.userData);!0!==c.visible&&(g.visible=c.visible);if(c instanceof THREE.PerspectiveCamera)g.fov=c.fov,g.aspect=c.aspect, g.near=c.near,g.far=c.far;else if(c instanceof THREE.OrthographicCamera)g.left=c.left,g.right=c.right,g.top=c.top,g.bottom=c.bottom,g.near=c.near,g.far=c.far;else if(c instanceof THREE.AmbientLight)g.color=c.color.getHex;else if(c instanceof THREE.DirectionalLight)g.color=c.color.getHex,g.intensity=c.intensity;else if(c instanceof THREE.PointLight)g.color=c.color.getHex,g.intensity=c.intensity,g.distance=c.distance,g.decay=c.decay;else if(c instanceof THREE.SpotLight)g.color=c.color.getHex, g.intensity=c.intensity,g.distance=c.distance,g.angle=c.angle,g.exponent=c.exponent,g.decay=c.decay;else if(c instanceof THREE.HemisphereLight)g.color=c.color.getHex,g.groundColor=c.groundColor.getHex;else if(c instanceof THREE.Mesh||c instanceof THREE.Line||c instanceof THREE.PointCloud){var h=c.geometry;void 0===a.geometries&&(a.geometries=[]);if(void 0===b[h.uuid]){var k=h.toJSON;delete k.metadata;b[h.uuid]=k;a.geometries.push(k)}g.geometry=h.uuid;g.material=d(c.material);c instanceof THREE.Line&& (g.mode=c.mode)}else c instanceof THREE.Sprite&&(g.material=d(c.material));g.matrix=c.matrix.toArray;if(0<c.children.length)for(g.children=[],h=0;h<c.children.length;h++)g.children.push(e(c.children[h]));return g};a.object=e(this);return a},clone:function(a,b){void 0===a&&(a=new THREE.Object3D);void 0===b&&(b=!0);a.name=this.name;a.up.copy(this.up);a.position.copy(this.position);a.quaternion.copy(this.quaternion);a.scale.copy(this.scale);a.rotationAutoUpdate=this.rotationAutoUpdate;a.matrix.copy(this.matrix); a.matrixWorld.copy(this.matrixWorld);a.matrixAutoUpdate=this.matrixAutoUpdate;a.matrixWorldNeedsUpdate=this.matrixWorldNeedsUpdate;a.visible=this.visible;a.castShadow=this.castShadow;a.receiveShadow=this.receiveShadow;a.frustumCulled=this.frustumCulled;a.userData=JSON.parse(JSON.stringify(this.userData));if(!0===b)for(var c=0;c<this.children.length;c++)a.add(this.children[c].clone);return a}};THREE.EventDispatcher.prototype.apply(THREE.Object3D.prototype);THREE.Object3DIdCount=0; THREE.Face3=function(a,b,c,d,e,f){this.a=a;this.b=b;this.c=c;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.color=e instanceof THREE.Color?e:new THREE.Color;this.vertexColors=e instanceof Array?e:[];this.vertexTangents=[];this.materialIndex=void 0!==f?f:0}; THREE.Face3.prototype={constructor:THREE.Face3,clone:function{var a=new THREE.Face3(this.a,this.b,this.c);a.normal.copy(this.normal);a.color.copy(this.color);a.materialIndex=this.materialIndex;for(var b=0,c=this.vertexNormals.length;b<c;b++)a.vertexNormals[b]=this.vertexNormals[b].clone;b=0;for(c=this.vertexColors.length;b<c;b++)a.vertexColors[b]=this.vertexColors[b].clone;b=0;for(c=this.vertexTangents.length;b<c;b++)a.vertexTangents[b]=this.vertexTangents[b].clone;return a}}; THREE.Face4=function(a,b,c,d,e,f,g){THREE.warn("THREE.Face4 has been removed. A THREE.Face3 will be created instead.");return new THREE.Face3(a,b,c,e,f,g)};THREE.BufferAttribute=function(a,b){this.array=a;this.itemSize=b;this.needsUpdate=!1}; THREE.BufferAttribute.prototype={constructor:THREE.BufferAttribute,get length{return this.array.length},copyAt:function(a,b,c){a*=this.itemSize;c*=b.itemSize;for(var d=0,e=this.itemSize;d<e;d++)this.array[a+d]=b.array[c+d];return this},set:function(a,b){void 0===b&&(b=0);this.array.set(a,b);return this},setX:function(a,b){this.array[a*this.itemSize]=b;return this},setY:function(a,b){this.array[a*this.itemSize+1]=b;return this},setZ:function(a,b){this.array[a*this.itemSize+2]=b;return this},setXY:function(a, b,c){a*=this.itemSize;this.array[a]=b;this.array[a+1]=c;return this},setXYZ:function(a,b,c,d){a*=this.itemSize;this.array[a]=b;this.array[a+1]=c;this.array[a+2]=d;return this},setXYZW:function(a,b,c,d,e){a*=this.itemSize;this.array[a]=b;this.array[a+1]=c;this.array[a+2]=d;this.array[a+3]=e;return this},clone:function{return new THREE.BufferAttribute(new this.array.constructor(this.array),this.itemSize)}}; THREE.Int8Attribute=function(a,b){THREE.warn("THREE.Int8Attribute has been removed. Use THREE.BufferAttribute( array, itemSize ) instead.");return new THREE.BufferAttribute(a,b)};THREE.Uint8Attribute=function(a,b){THREE.warn("THREE.Uint8Attribute has been removed. Use THREE.BufferAttribute( array, itemSize ) instead.");return new THREE.BufferAttribute(a,b)}; THREE.Uint8ClampedAttribute=function(a,b){THREE.warn("THREE.Uint8ClampedAttribute has been removed. Use THREE.BufferAttribute( array, itemSize ) instead.");return new THREE.BufferAttribute(a,b)};THREE.Int16Attribute=function(a,b){THREE.warn("THREE.Int16Attribute has been removed. Use THREE.BufferAttribute( array, itemSize ) instead.");return new THREE.BufferAttribute(a,b)}; THREE.Uint16Attribute=function(a,b){THREE.warn("THREE.Uint16Attribute has been removed. Use THREE.BufferAttribute( array, itemSize ) instead.");return new THREE.BufferAttribute(a,b)};THREE.Int32Attribute=function(a,b){THREE.warn("THREE.Int32Attribute has been removed. Use THREE.BufferAttribute( array, itemSize ) instead.");return new THREE.BufferAttribute(a,b)}; THREE.Uint32Attribute=function(a,b){THREE.warn("THREE.Uint32Attribute has been removed. Use THREE.BufferAttribute( array, itemSize ) instead.");return new THREE.BufferAttribute(a,b)};THREE.Float32Attribute=function(a,b){THREE.warn("THREE.Float32Attribute has been removed. Use THREE.BufferAttribute( array, itemSize ) instead.");return new THREE.BufferAttribute(a,b)}; THREE.Float64Attribute=function(a,b){THREE.warn("THREE.Float64Attribute has been removed. Use THREE.BufferAttribute( array, itemSize ) instead.");return new THREE.BufferAttribute(a,b)};THREE.DynamicBufferAttribute=function(a,b){THREE.BufferAttribute.call(this,a,b);this.updateRange={offset:0,count:-1}};THREE.DynamicBufferAttribute.prototype=Object.create(THREE.BufferAttribute.prototype);THREE.DynamicBufferAttribute.prototype.constructor=THREE.DynamicBufferAttribute; THREE.DynamicBufferAttribute.prototype.clone=function{return new THREE.DynamicBufferAttribute(new this.array.constructor(this.array),this.itemSize)};THREE.BufferGeometry=function{Object.defineProperty(this,"id",{value:THREE.GeometryIdCount++});this.uuid=THREE.Math.generateUUID;this.name="";this.type="BufferGeometry";this.attributes={};this.attributesKeys=[];this.offsets=this.drawcalls=[];this.boundingSphere=this.boundingBox=null}; THREE.BufferGeometry.prototype={constructor:THREE.BufferGeometry,addAttribute:function(a,b,c){!1===b instanceof THREE.BufferAttribute?(THREE.warn("THREE.BufferGeometry: .addAttribute now expects ( name, attribute )."),this.attributes[a]={array:b,itemSize:c}):(this.attributes[a]=b,this.attributesKeys=Object.keys(this.attributes))},getAttribute:function(a){return this.attributes[a]},addDrawCall:function(a,b,c){this.drawcalls.push({start:a,count:b,index:void 0!==c?c:0})},applyMatrix:function(a){var b= this.attributes.position;void 0!==b&&(a.applyToVector3Array(b.array),b.needsUpdate=!0);b=this.attributes.normal;void 0!==b&&((new THREE.Matrix3).getNormalMatrix(a).applyToVector3Array(b.array),b.needsUpdate=!0);null!==this.boundingBox&&this.computeBoundingBox;null!==this.boundingSphere&&this.computeBoundingSphere},center:function{this.computeBoundingBox;var a=this.boundingBox.center.negate;this.applyMatrix((new THREE.Matrix4).setPosition(a));return a},fromGeometry:function(a,b){b=b||{vertexColors:THREE.NoColors}; var c=a.vertices,d=a.faces,e=a.faceVertexUvs,f=b.vertexColors,g=0<e[0].length,h=3==d[0].vertexNormals.length,k=new Float32Array(9*d.length);this.addAttribute("position",new THREE.BufferAttribute(k,3));var l=new Float32Array(9*d.length);this.addAttribute("normal",new THREE.BufferAttribute(l,3));if(f!==THREE.NoColors){var p=new Float32Array(9*d.length);this.addAttribute("color",new THREE.BufferAttribute(p,3))}if(!0===g){var q=new Float32Array(6*d.length);this.addAttribute("uv",new THREE.BufferAttribute(q, 2))}for(var n=0,t=0,r=0;n<d.length;n++,t+=6,r+=9){var s=d[n],u=c[s.a],v=c[s.b],x=c[s.c];k[r]=u.x;k[r+1]=u.y;k[r+2]=u.z;k[r+3]=v.x;k[r+4]=v.y;k[r+5]=v.z;k[r+6]=x.x;k[r+7]=x.y;k[r+8]=x.z;!0===h?(u=s.vertexNormals[0],v=s.vertexNormals[1],x=s.vertexNormals[2],l[r]=u.x,l[r+1]=u.y,l[r+2]=u.z,l[r+3]=v.x,l[r+4]=v.y,l[r+5]=v.z,l[r+6]=x.x,l[r+7]=x.y,l[r+8]=x.z):(u=s.normal,l[r]=u.x,l[r+1]=u.y,l[r+2]=u.z,l[r+3]=u.x,l[r+4]=u.y,l[r+5]=u.z,l[r+6]=u.x,l[r+7]=u.y,l[r+8]=u.z);f===THREE.FaceColors?(s=s.color,p[r]= s.r,p[r+1]=s.g,p[r+2]=s.b,p[r+3]=s.r,p[r+4]=s.g,p[r+5]=s.b,p[r+6]=s.r,p[r+7]=s.g,p[r+8]=s.b):f===THREE.VertexColors&&(u=s.vertexColors[0],v=s.vertexColors[1],s=s.vertexColors[2],p[r]=u.r,p[r+1]=u.g,p[r+2]=u.b,p[r+3]=v.r,p[r+4]=v.g,p[r+5]=v.b,p[r+6]=s.r,p[r+7]=s.g,p[r+8]=s.b);!0===g&&(s=e[0][n][0],u=e[0][n][1],v=e[0][n][2],q[t]=s.x,q[t+1]=s.y,q[t+2]=u.x,q[t+3]=u.y,q[t+4]=v.x,q[t+5]=v.y)}this.computeBoundingSphere;return this},computeBoundingBox:function{var a=new THREE.Vector3;return function{null=== this.boundingBox&&(this.boundingBox=new THREE.Box3);var b=this.attributes.position.array;if(b){var c=this.boundingBox;c.makeEmpty;for(var d=0,e=b.length;d<e;d+=3)a.set(b[d],b[d+1],b[d+2]),c.expandByPoint(a)}if(void 0===b||0===b.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))&&THREE.error('THREE.BufferGeometry.computeBoundingBox: Computed min/max have NaN values. The "position" attribute is likely to have NaN values.')}}, computeBoundingSphere:function{var a=new THREE.Box3,b=new THREE.Vector3;return function{null===this.boundingSphere&&(this.boundingSphere=new THREE.Sphere);var c=this.attributes.position.array;if(c){a.makeEmpty;for(var d=this.boundingSphere.center,e=0,f=c.length;e<f;e+=3)b.set(c[e],c[e+1],c[e+2]),a.expandByPoint(b);a.center(d);for(var g=0,e=0,f=c.length;e<f;e+=3)b.set(c[e],c[e+1],c[e+2]),g=Math.max(g,d.distanceToSquared(b));this.boundingSphere.radius=Math.sqrt(g);isNaN(this.boundingSphere.radius)&& THREE.error('THREE.BufferGeometry.computeBoundingSphere: Computed radius is NaN. The "position" attribute is likely to have NaN values.')}}},computeFaceNormals:function{},computeVertexNormals:function{var a=this.attributes;if(a.position){var b=a.position.array;if(void 0===a.normal)this.addAttribute("normal",new THREE.BufferAttribute(new Float32Array(b.length),3));else for(var c=a.normal.array,d=0,e=c.length;d<e;d++)c[d]=0;var c=a.normal.array,f,g,h,k=new THREE.Vector3,l=new THREE.Vector3, p=new THREE.Vector3,q=new THREE.Vector3,n=new THREE.Vector3;if(a.index)for(var t=a.index.array,r=0<this.offsets.length?this.offsets:[{start:0,count:t.length,index:0}],s=0,u=r.length;s<u;++s){e=r[s].start;f=r[s].count;for(var v=r[s].index,d=e,e=e+f;d<e;d+=3)f=3*(v+t[d]),g=3*(v+t[d+1]),h=3*(v+t[d+2]),k.fromArray(b,f),l.fromArray(b,g),p.fromArray(b,h),q.subVectors(p,l),n.subVectors(k,l),q.cross(n),c[f]+=q.x,c[f+1]+=q.y,c[f+2]+=q.z,c[g]+=q.x,c[g+1]+=q.y,c[g+2]+=q.z,c[h]+=q.x,c[h+1]+=q.y,c[h+2]+=q.z}else for(d= 0,e=b.length;d<e;d+=9)k.fromArray(b,d),l.fromArray(b,d+3),p.fromArray(b,d+6),q.subVectors(p,l),n.subVectors(k,l),q.cross(n),c[d]=q.x,c[d+1]=q.y,c[d+2]=q.z,c[d+3]=q.x,c[d+4]=q.y,c[d+5]=q.z,c[d+6]=q.x,c[d+7]=q.y,c[d+8]=q.z;this.normalizeNormals;a.normal.needsUpdate=!0}},computeTangents:function{function a(a,b,c){q.fromArray(d,3*a);n.fromArray(d,3*b);t.fromArray(d,3*c);r.fromArray(f,2*a);s.fromArray(f,2*b);u.fromArray(f,2*c);v=n.x-q.x;x=t.x-q.x;D=n.y-q.y;w=t.y-q.y;y=n.z-q.z;A=t.z-q.z;E=s.x-r.x;G= u.x-r.x;F=s.y-r.y;z=u.y-r.y;I=1/(E*z-G*F);U.set((z*v-F*x)*I,(z*D-F*w)*I,(z*y-F*A)*I);M.set((E*x-G*v)*I,(E*w-G*D)*I,(E*A-G*y)*I);k[a].add(U);k[b].add(U);k[c].add(U);l[a].add(M);l[b].add(M);l[c].add(M)}function b(a){ha.fromArray(e,3*a);O.copy(ha);ba=k[a];oa.copy(ba);oa.sub(ha.multiplyScalar(ha.dot(ba))).normalize;ja.crossVectors(O,ba);qa=ja.dot(l[a]);ca=0>qa?-1:1;h[4*a]=oa.x;h[4*a+1]=oa.y;h[4*a+2]=oa.z;h[4*a+3]=ca}if(void 0===this.attributes.index||void 0===this.attributes.position||void 0===this.attributes.normal|| void 0===this.attributes.uv)THREE.warn("THREE.BufferGeometry: Missing required attributes (index, position, normal or uv) in BufferGeometry.computeTangents");else{var c=this.attributes.index.array,d=this.attributes.position.array,e=this.attributes.normal.array,f=this.attributes.uv.array,g=d.length/3;void 0===this.attributes.tangent&&this.addAttribute("tangent",new THREE.BufferAttribute(new Float32Array(4*g),4));for(var h=this.attributes.tangent.array,k=[],l=[],p=0;p<g;p++)k[p]=new THREE.Vector3, l[p]=new THREE.Vector3;var q=new THREE.Vector3,n=new THREE.Vector3,t=new THREE.Vector3,r=new THREE.Vector2,s=new THREE.Vector2,u=new THREE.Vector2,v,x,D,w,y,A,E,G,F,z,I,U=new THREE.Vector3,M=new THREE.Vector3,H,L,P,N,R;0===this.drawcalls.length&&this.addDrawCall(0,c.length,0);var V=this.drawcalls,p=0;for(L=V.length;p<L;++p){H=V[p].start;P=V[p].count;var J=V[p].index,g=H;for(H+=P;g<H;g+=3)P=J+c[g],N=J+c[g+1],R=J+c[g+2],a(P,N,R)}var oa=new THREE.Vector3,ja=new THREE.Vector3,ha=new THREE.Vector3,O=new THREE.Vector3, ca,ba,qa,p=0;for(L=V.length;p<L;++p)for(H=V[p].start,P=V[p].count,J=V[p].index,g=H,H+=P;g<H;g+=3)P=J+c[g],N=J+c[g+1],R=J+c[g+2],b(P),b(N),b(R)}},computeOffsets:function(a){void 0===a&&(a=65535);for(var b=this.attributes.index.array,c=this.attributes.position.array,d=b.length/3,e=new Uint16Array(b.length),f=0,g=0,h=[{start:0,count:0,index:0}],k=h[0],l=0,p=0,q=new Int32Array(6),n=new Int32Array(c.length),t=new Int32Array(c.length),r=0;r<c.length;r++)n[r]=-1,t[r]=-1;for(c=0;c<d;c++){for(var s=p=0;3> s;s++)r=b[3*c+s],-1==n[r]?(q[2*s]=r,q[2*s+1]=-1,p++):n[r]<k.index?(q[2*s]=r,q[2*s+1]=-1,l++):(q[2*s]=r,q[2*s+1]=n[r]);if(g+p>k.index+a)for(k={start:f,count:0,index:g},h.push(k),p=0;6>p;p+=2)s=q[p+1],-1<s&&s<k.index&&(q[p+1]=-1);for(p=0;6>p;p+=2)r=q[p],s=q[p+1],-1===s&&(s=g++),n[r]=s,t[s]=r,e[f++]=s-k.index,k.count++}this.reorderBuffers(e,t,g);return this.drawcalls=this.offsets=h},merge:function(a,b){if(!1===a instanceof THREE.BufferGeometry)THREE.error("THREE.BufferGeometry.merge: geometry not an instance of THREE.BufferGeometry.", a);else{void 0===b&&(b=0);var c=this.attributes,d;for(d in c)if(void 0!==a.attributes[d])for(var e=c[d].array,f=a.attributes[d],g=f.array,h=0,f=f.itemSize*b;h<g.length;h++,f++)e[f]=g[h];return this}},normalizeNormals:function{for(var a=this.attributes.normal.array,b,c,d,e=0,f=a.length;e<f;e+=3)b=a[e],c=a[e+1],d=a[e+2],b=1/Math.sqrt(b*b+c*c+d*d),a[e]*=b,a[e+1]*=b,a[e+2]*=b},reorderBuffers:function(a,b,c){var d={},e;for(e in this.attributes)"index"!=e&&(d[e]=new this.attributes[e].array.constructor(this.attributes[e].itemSize* c));for(var f=0;f<c;f++){var g=b[f];for(e in this.attributes)if("index"!=e)for(var h=this.attributes[e].array,k=this.attributes[e].itemSize,l=d[e],p=0;p<k;p++)l[f*k+p]=h[g*k+p]}this.attributes.index.array=a;for(e in this.attributes)"index"!=e&&(this.attributes[e].array=d[e],this.attributes[e].numItems=this.attributes[e].itemSize*c)},toJSON:function{var a={metadata:{version:4,type:"BufferGeometry",generator:"BufferGeometryExporter"},uuid:this.uuid,type:this.type,data:{attributes:{}}},b=this.attributes, c=this.offsets,d=this.boundingSphere,e;for(e in b){var f=b[e],g=Array.prototype.slice.call(f.array);a.data.attributes[e]={itemSize:f.itemSize,type:f.array.constructor.name,array:g}}0<c.length&&(a.data.offsets=JSON.parse(JSON.stringify(c)));null!==d&&(a.data.boundingSphere={center:d.center.toArray,radius:d.radius});return a},clone:function{var a=new THREE.BufferGeometry,b;for(b in this.attributes)a.addAttribute(b,this.attributes[b].clone);b=0;for(var c=this.offsets.length;b<c;b++){var d=this.offsets[b]; a.offsets.push({start:d.start,index:d.index,count:d.count})}return a},dispose:function{this.dispatchEvent({type:"dispose"})}};THREE.EventDispatcher.prototype.apply(THREE.BufferGeometry.prototype); THREE.Geometry=function{Object.defineProperty(this,"id",{value:THREE.GeometryIdCount++});this.uuid=THREE.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.boundingSphere=this.boundingBox=null;this.hasTangents=!1;this.dynamic=!0;this.groupsNeedUpdate=this.lineDistancesNeedUpdate=this.colorsNeedUpdate= this.tangentsNeedUpdate=this.normalsNeedUpdate=this.uvsNeedUpdate=this.elementsNeedUpdate=this.verticesNeedUpdate=!1}; THREE.Geometry.prototype={constructor:THREE.Geometry,applyMatrix:function(a){for(var b=(new THREE.Matrix3).getNormalMatrix(a),c=0,d=this.vertices.length;c<d;c++)this.vertices[c].applyMatrix4(a);c=0;for(d=this.faces.length;c<d;c++){a=this.faces[c];a.normal.applyMatrix3(b).normalize;for(var e=0,f=a.vertexNormals.length;e<f;e++)a.vertexNormals[e].applyMatrix3(b).normalize}null!==this.boundingBox&&this.computeBoundingBox;null!==this.boundingSphere&&this.computeBoundingSphere;this.normalsNeedUpdate= this.verticesNeedUpdate=!0},fromBufferGeometry:function(a){for(var b=this,c=a.attributes,d=c.position.array,e=void 0!==c.index?c.index.array:void 0,f=void 0!==c.normal?c.normal.array:void 0,g=void 0!==c.color?c.color.array:void 0,h=void 0!==c.uv?c.uv.array:void 0,k=[],l=[],p=c=0;c<d.length;c+=3,p+=2)b.vertices.push(new THREE.Vector3(d[c],d[c+1],d[c+2])),void 0!==f&&k.push(new THREE.Vector3(f[c],f[c+1],f[c+2])),void 0!==g&&b.colors.push(new THREE.Color(g[c],g[c+1],g[c+2])),void 0!==h&&l.push(new THREE.Vector2(h[p], h[p+1]));var q=function(a,c,d){var e=void 0!==f?[k[a].clone,k[c].clone,k[d].clone]:[],n=void 0!==g?[b.colors[a].clone,b.colors[c].clone,b.colors[d].clone]:[];b.faces.push(new THREE.Face3(a,c,d,e,n));void 0!==h&&b.faceVertexUvs[0].push([l[a].clone,l[c].clone,l[d].clone])};if(void 0!==e)if(d=a.drawcalls,0<d.length)for(c=0;c<d.length;c++)for(var p=d[c],n=p.start,t=p.count,r=p.index,p=n,n=n+t;p<n;p+=3)q(r+e[p],r+e[p+1],r+e[p+2]);else for(c=0;c<e.length;c+=3)q(e[c],e[c+1],e[c+2]);else for(c= 0;c<d.length/3;c+=3)q(c,c+1,c+2);this.computeFaceNormals;null!==a.boundingBox&&(this.boundingBox=a.boundingBox.clone);null!==a.boundingSphere&&(this.boundingSphere=a.boundingSphere.clone);return this},center:function{this.computeBoundingBox;var a=this.boundingBox.center.negate;this.applyMatrix((new THREE.Matrix4).setPosition(a));return a},computeFaceNormals:function{for(var a=new THREE.Vector3,b=new THREE.Vector3,c=0,d=this.faces.length;c<d;c++){var e=this.faces[c],f=this.vertices[e.a], g=this.vertices[e.b];a.subVectors(this.vertices[e.c],g);b.subVectors(f,g);a.cross(b);a.normalize;e.normal.copy(a)}},computeVertexNormals:function(a){var b,c,d;d=Array(this.vertices.length);b=0;for(c=this.vertices.length;b<c;b++)d[b]=new THREE.Vector3;if(a){var e,f,g,h=new THREE.Vector3,k=new THREE.Vector3;a=0;for(b=this.faces.length;a<b;a++)c=this.faces[a],e=this.vertices[c.a],f=this.vertices[c.b],g=this.vertices[c.c],h.subVectors(g,f),k.subVectors(e,f),h.cross(k),d[c.a].add(h),d[c.b].add(h),d[c.c].add(h)}else for(a= 0,b=this.faces.length;a<b;a++)c=this.faces[a],d[c.a].add(c.normal),d[c.b].add(c.normal),d[c.c].add(c.normal);b=0;for(c=this.vertices.length;b<c;b++)d[b].normalize;a=0;for(b=this.faces.length;a<b;a++)c=this.faces[a],c.vertexNormals[0]=d[c.a].clone,c.vertexNormals[1]=d[c.b].clone,c.vertexNormals[2]=d[c.c].clone},computeMorphNormals:function{var a,b,c,d,e;c=0;for(d=this.faces.length;c<d;c++)for(e=this.faces[c],e.__originalFaceNormal?e.__originalFaceNormal.copy(e.normal):e.__originalFaceNormal= e.normal.clone,e.__originalVertexNormals||(e.__originalVertexNormals=[]),a=0,b=e.vertexNormals.length;a<b;a++)e.__originalVertexNormals[a]?e.__originalVertexNormals[a].copy(e.vertexNormals[a]):e.__originalVertexNormals[a]=e.vertexNormals[a].clone;var f=new THREE.Geometry;f.faces=this.faces;a=0;for(b=this.morphTargets.length;a<b;a++){if(!this.morphNormals[a]){this.morphNormals[a]={};this.morphNormals[a].faceNormals=[];this.morphNormals[a].vertexNormals=[];e=this.morphNormals[a].faceNormals;var g= this.morphNormals[a].vertexNormals,h,k;c=0;for(d=this.faces.length;c<d;c++)h=new THREE.Vector3,k={a:new THREE.Vector3,b:new THREE.Vector3,c:new THREE.Vector3},e.push(h),g.push(k)}g=this.morphNormals[a];f.vertices=this.morphTargets[a].vertices;f.computeFaceNormals;f.computeVertexNormals;c=0;for(d=this.faces.length;c<d;c++)e=this.faces[c],h=g.faceNormals[c],k=g.vertexNormals[c],h.copy(e.normal),k.a.copy(e.vertexNormals[0]),k.b.copy(e.vertexNormals[1]),k.c.copy(e.vertexNormals[2])}c=0;for(d=this.faces.length;c< d;c++)e=this.faces[c],e.normal=e.__originalFaceNormal,e.vertexNormals=e.__originalVertexNormals},computeTangents:function{var a,b,c,d,e,f,g,h,k,l,p,q,n,t,r,s,u,v=[],x=[];c=new THREE.Vector3;var D=new THREE.Vector3,w=new THREE.Vector3,y=new THREE.Vector3,A=new THREE.Vector3;a=0;for(b=this.vertices.length;a<b;a++)v[a]=new THREE.Vector3,x[a]=new THREE.Vector3;a=0;for(b=this.faces.length;a<b;a++)e=this.faces[a],f=this.faceVertexUvs[0][a],d=e.a,u=e.b,e=e.c,g=this.vertices[d],h=this.vertices[u],k=this.vertices[e], l=f[0],p=f[1],q=f[2],f=h.x-g.x,n=k.x-g.x,t=h.y-g.y,r=k.y-g.y,h=h.z-g.z,g=k.z-g.z,k=p.x-l.x,s=q.x-l.x,p=p.y-l.y,l=q.y-l.y,q=1/(k*l-s*p),c.set((l*f-p*n)*q,(l*t-p*r)*q,(l*h-p*g)*q),D.set((k*n-s*f)*q,(k*r-s*t)*q,(k*g-s*h)*q),v[d].add(c),v[u].add(c),v[e].add(c),x[d].add(D),x[u].add(D),x[e].add(D);D=["a","b","c","d"];a=0;for(b=this.faces.length;a<b;a++)for(e=this.faces[a],c=0;c<Math.min(e.vertexNormals.length,3);c++)A.copy(e.vertexNormals[c]),d=e[D[c]],u=v[d],w.copy(u),w.sub(A.multiplyScalar(A.dot(u))).normalize, y.crossVectors(e.vertexNormals[c],u),d=y.dot(x[d]),d=0>d?-1:1,e.vertexTangents[c]=new THREE.Vector4(w.x,w.y,w.z,d);this.hasTangents=!0},computeLineDistances:function{for(var a=0,b=this.vertices,c=0,d=b.length;c<d;c++)0<c&&(a+=b[c].distanceTo(b[c-1])),this.lineDistances[c]=a},computeBoundingBox:function{null===this.boundingBox&&(this.boundingBox=new THREE.Box3);this.boundingBox.setFromPoints(this.vertices)},computeBoundingSphere:function{null===this.boundingSphere&&(this.boundingSphere=new THREE.Sphere); this.boundingSphere.setFromPoints(this.vertices)},merge:function(a,b,c){if(!1===a instanceof THREE.Geometry)THREE.error("THREE.Geometry.merge: geometry not an instance of THREE.Geometry.",a);else{var d,e=this.vertices.length,f=this.vertices,g=a.vertices,h=this.faces,k=a.faces,l=this.faceVertexUvs[0];a=a.faceVertexUvs[0];void 0===c&&(c=0);void 0!==b&&(d=(new THREE.Matrix3).getNormalMatrix(b));for(var p=0,q=g.length;p<q;p++){var n=g[p].clone;void 0!==b&&n.applyMatrix4(b);f.push(n)}p=0;for(q=k.length;p< q;p++){var g=k[p],t,r=g.vertexNormals,s=g.vertexColors,n=new THREE.Face3(g.a+e,g.b+e,g.c+e);n.normal.copy(g.normal);void 0!==d&&n.normal.applyMatrix3(d).normalize;b=0;for(f=r.length;b<f;b++)t=r[b].clone,void 0!==d&&t.applyMatrix3(d).normalize,n.vertexNormals.push(t);n.color.copy(g.color);b=0;for(f=s.length;b<f;b++)t=s[b],n.vertexColors.push(t.clone);n.materialIndex=g.materialIndex+c;h.push(n)}p=0;for(q=a.length;p<q;p++)if(c=a[p],d=[],void 0!==c){b=0;for(f=c.length;b<f;b++)d.push(c[b].clone); l.push(d)}}},mergeMesh:function(a){!1===a instanceof THREE.Mesh?THREE.error("THREE.Geometry.mergeMesh: mesh not an instance of THREE.Mesh.",a):(a.matrixAutoUpdate&&a.updateMatrix,this.merge(a.geometry,a.matrix))},mergeVertices:function{var a={},b=[],c=[],d,e=Math.pow(10,4),f,g;f=0;for(g=this.vertices.length;f<g;f++)d=this.vertices[f],d=Math.round(d.x*e)+"_"+Math.round(d.y*e)+"_"+Math.round(d.z*e),void 0===a[d]?(a[d]=f,b.push(this.vertices[f]),c[f]=b.length-1):c[f]=c[a[d]];a=[];f=0;for(g=this.faces.length;f< g;f++)for(e=this.faces[f],e.a=c[e.a],e.b=c[e.b],e.c=c[e.c],e=[e.a,e.b,e.c],d=0;3>d;d++)if(e[d]==e[(d+1)%3]){a.push(f);break}for(f=a.length-1;0<=f;f--)for(e=a[f],this.faces.splice(e,1),c=0,g=this.faceVertexUvs.length;c<g;c++)this.faceVertexUvs[c].splice(e,1);f=this.vertices.length-b.length;this.vertices=b;return f},toJSON:function{function a(a,b,c){return c?a|1<<b:a&~(1<<b)}function b(a){var b=a.x.toString+a.y.toString+a.z.toString;if(void 0!==l[b])return l[b];l[b]=k.length/3;k.push(a.x,a.y, a.z);return l[b]}function c(a){var b=a.r.toString+a.g.toString+a.b.toString;if(void 0!==q[b])return q[b];q[b]=p.length;p.push(a.getHex);return q[b]}function d(a){var b=a.x.toString+a.y.toString;if(void 0!==t[b])return t[b];t[b]=n.length/2;n.push(a.x,a.y);return t[b]}var e={metadata:{version:4,type:"BufferGeometry",generator:"BufferGeometryExporter"},uuid:this.uuid,type:this.type};""!==this.name&&(e.name=this.name);if(void 0!==this.parameters){var f=this.parameters,g;for(g in f)void 0!== f[g]&&(e[g]=f[g]);return e}f=[];for(g=0;g<this.vertices.length;g++){var h=this.vertices[g];f.push(h.x,h.y,h.z)}var h=[],k=[],l={},p=[],q={},n=[],t={};for(g=0;g<this.faces.length;g++){var r=this.faces[g],s=void 0!==this.faceVertexUvs[0][g],u=0<r.normal.length,v=0<r.vertexNormals.length,x=1!==r.color.r||1!==r.color.g||1!==r.color.b,D=0<r.vertexColors.length,w=0,w=a(w,0,0),w=a(w,1,!1),w=a(w,2,!1),w=a(w,3,s),w=a(w,4,u),w=a(w,5,v),w=a(w,6,x),w=a(w,7,D);h.push(w);h.push(r.a,r.b,r.c);s&&(s=this.faceVertexUvs[0][g], h.push(d(s[0]),d(s[1]),d(s[2])));u&&h.push(b(r.normal));v&&(u=r.vertexNormals,h.push(b(u[0]),b(u[1]),b(u[2])));x&&h.push(c(r.color));D&&(r=r.vertexColors,h.push(c(r[0]),c(r[1]),c(r[2])))}e.data={};e.data.vertices=f;e.data.normals=k;0<p.length&&(e.data.colors=p);0<n.length&&(e.data.uvs=[n]);e.data.faces=h;return e},clone:function{for(var a=new THREE.Geometry,b=this.vertices,c=0,d=b.length;c<d;c++)a.vertices.push(b[c].clone);b=this.faces;c=0;for(d=b.length;c<d;c++)a.faces.push(b[c].clone);c=0; for(d=this.faceVertexUvs.length;c<d;c++){b=this.faceVertexUvs[c];void 0===a.faceVertexUvs[c]&&(a.faceVertexUvs[c]=[]);for(var e=0,f=b.length;e<f;e++){for(var g=b[e],h=[],k=0,l=g.length;k<l;k++)h.push(g[k].clone);a.faceVertexUvs[c].push(h)}}return a},dispose:function{this.dispatchEvent({type:"dispose"})}};THREE.EventDispatcher.prototype.apply(THREE.Geometry.prototype);THREE.GeometryIdCount=0; THREE.Camera=function{THREE.Object3D.call(this);this.type="Camera";this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=new THREE.Matrix4};THREE.Camera.prototype=Object.create(THREE.Object3D.prototype);THREE.Camera.prototype.constructor=THREE.Camera;THREE.Camera.prototype.getWorldDirection=function{var a=new THREE.Quaternion;return function(b){b=b||new THREE.Vector3;this.getWorldQuaternion(a);return b.set(0,0,-1).applyQuaternion(a)}}; THREE.Camera.prototype.lookAt=function{var a=new THREE.Matrix4;return function(b){a.lookAt(this.position,b,this.up);this.quaternion.setFromRotationMatrix(a)}};THREE.Camera.prototype.clone=function(a){void 0===a&&(a=new THREE.Camera);THREE.Object3D.prototype.clone.call(this,a);a.matrixWorldInverse.copy(this.matrixWorldInverse);a.projectionMatrix.copy(this.projectionMatrix);return a}; THREE.CubeCamera=function(a,b,c){THREE.Object3D.call(this);this.type="CubeCamera";var d=new THREE.PerspectiveCamera(90,1,a,b);d.up.set(0,-1,0);d.lookAt(new THREE.Vector3(1,0,0));this.add(d);var e=new THREE.PerspectiveCamera(90,1,a,b);e.up.set(0,-1,0);e.lookAt(new THREE.Vector3(-1,0,0));this.add(e);var f=new THREE.PerspectiveCamera(90,1,a,b);f.up.set(0,0,1);f.lookAt(new THREE.Vector3(0,1,0));this.add(f);var g=new THREE.PerspectiveCamera(90,1,a,b);g.up.set(0,0,-1);g.lookAt(new THREE.Vector3(0,-1,0)); this.add(g);var h=new THREE.PerspectiveCamera(90,1,a,b);h.up.set(0,-1,0);h.lookAt(new THREE.Vector3(0,0,1));this.add(h);var k=new THREE.PerspectiveCamera(90,1,a,b);k.up.set(0,-1,0);k.lookAt(new THREE.Vector3(0,0,-1));this.add(k);this.renderTarget=new THREE.WebGLRenderTargetCube(c,c,{format:THREE.RGBFormat,magFilter:THREE.LinearFilter,minFilter:THREE.LinearFilter});this.updateCubeMap=function(a,b){var c=this.renderTarget,n=c.generateMipmaps;c.generateMipmaps=!1;c.activeCubeFace=0;a.render(b,d,c);c.activeCubeFace= 1;a.render(b,e,c);c.activeCubeFace=2;a.render(b,f,c);c.activeCubeFace=3;a.render(b,g,c);c.activeCubeFace=4;a.render(b,h,c);c.generateMipmaps=n;c.activeCubeFace=5;a.render(b,k,c)}};THREE.CubeCamera.prototype=Object.create(THREE.Object3D.prototype);THREE.CubeCamera.prototype.constructor=THREE.CubeCamera; THREE.OrthographicCamera=function(a,b,c,d,e,f){THREE.Camera.call(this);this.type="OrthographicCamera";this.zoom=1;this.left=a;this.right=b;this.top=c;this.bottom=d;this.near=void 0!==e?e:.1;this.far=void 0!==f?f:2E3;this.updateProjectionMatrix};THREE.OrthographicCamera.prototype=Object.create(THREE.Camera.prototype);THREE.OrthographicCamera.prototype.constructor=THREE.OrthographicCamera; THREE.OrthographicCamera.prototype.updateProjectionMatrix=function{var a=(this.right-this.left)/(2*this.zoom),b=(this.top-this.bottom)/(2*this.zoom),c=(this.right+this.left)/2,d=(this.top+this.bottom)/2;this.projectionMatrix.makeOrthographic(c-a,c+a,d+b,d-b,this.near,this.far)}; THREE.OrthographicCamera.prototype.clone=function{var a=new THREE.OrthographicCamera;THREE.Camera.prototype.clone.call(this,a);a.zoom=this.zoom;a.left=this.left;a.right=this.right;a.top=this.top;a.bottom=this.bottom;a.near=this.near;a.far=this.far;a.projectionMatrix.copy(this.projectionMatrix);return a}; THREE.PerspectiveCamera=function(a,b,c,d){THREE.Camera.call(this);this.type="PerspectiveCamera";this.zoom=1;this.fov=void 0!==a?a:50;this.aspect=void 0!==b?b:1;this.near=void 0!==c?c:.1;this.far=void 0!==d?d:2E3;this.updateProjectionMatrix};THREE.PerspectiveCamera.prototype=Object.create(THREE.Camera.prototype);THREE.PerspectiveCamera.prototype.constructor=THREE.PerspectiveCamera; THREE.PerspectiveCamera.prototype.setLens=function(a,b){void 0===b&&(b=24);this.fov=2*THREE.Math.radToDeg(Math.atan(b/(2*a)));this.updateProjectionMatrix};THREE.PerspectiveCamera.prototype.setViewOffset=function(a,b,c,d,e,f){this.fullWidth=a;this.fullHeight=b;this.x=c;this.y=d;this.width=e;this.height=f;this.updateProjectionMatrix}; THREE.PerspectiveCamera.prototype.updateProjectionMatrix=function{var a=THREE.Math.radToDeg(2*Math.atan(Math.tan(.5*THREE.Math.degToRad(this.fov))/this.zoom));if(this.fullWidth){var b=this.fullWidth/this.fullHeight,a=Math.tan(THREE.Math.degToRad(.5*a))*this.near,c=-a,d=b*c,b=Math.abs(b*a-d),c=Math.abs(a-c);this.projectionMatrix.makeFrustum(d+this.x*b/this.fullWidth,d+(this.x+this.width)*b/this.fullWidth,a-(this.y+this.height)*c/this.fullHeight,a-this.y*c/this.fullHeight,this.near,this.far)}else this.projectionMatrix.makePerspective(a, this.aspect,this.near,this.far)};THREE.PerspectiveCamera.prototype.clone=function{var a=new THREE.PerspectiveCamera;THREE.Camera.prototype.clone.call(this,a);a.zoom=this.zoom;a.fov=this.fov;a.aspect=this.aspect;a.near=this.near;a.far=this.far;a.projectionMatrix.copy(this.projectionMatrix);return a};THREE.Light=function(a){THREE.Object3D.call(this);this.type="Light";this.color=new THREE.Color(a)};THREE.Light.prototype=Object.create(THREE.Object3D.prototype);THREE.Light.prototype.constructor=THREE.Light; THREE.Light.prototype.clone=function(a){void 0===a&&(a=new THREE.Light);THREE.Object3D.prototype.clone.call(this,a);a.color.copy(this.color);return a};THREE.AmbientLight=function(a){THREE.Light.call(this,a);this.type="AmbientLight"};THREE.AmbientLight.prototype=Object.create(THREE.Light.prototype);THREE.AmbientLight.prototype.constructor=THREE.AmbientLight;THREE.AmbientLight.prototype.clone=function{var a=new THREE.AmbientLight;THREE.Light.prototype.clone.call(this,a);return a}; THREE.AreaLight=function(a,b){THREE.Light.call(this,a);this.type="AreaLight";this.normal=new THREE.Vector3(0,-1,0);this.right=new THREE.Vector3(1,0,0);this.intensity=void 0!==b?b:1;this.height=this.width=1;this.constantAttenuation=1.5;this.linearAttenuation=.5;this.quadraticAttenuation=.1};THREE.AreaLight.prototype=Object.create(THREE.Light.prototype);THREE.AreaLight.prototype.constructor=THREE.AreaLight; THREE.DirectionalLight=function(a,b){THREE.Light.call(this,a);this.type="DirectionalLight";this.position.set(0,1,0);this.target=new THREE.Object3D;this.intensity=void 0!==b?b:1;this.onlyShadow=this.castShadow=!1;this.shadowCameraNear=50;this.shadowCameraFar=5E3;this.shadowCameraLeft=-500;this.shadowCameraTop=this.shadowCameraRight=500;this.shadowCameraBottom=-500;this.shadowCameraVisible=!1;this.shadowBias=0;this.shadowDarkness=.5;this.shadowMapHeight=this.shadowMapWidth=512;this.shadowCascade=!1; this.shadowCascadeOffset=new THREE.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.shadowMatrix=this.shadowCamera=this.shadowMapSize=this.shadowMap=null};THREE.DirectionalLight.prototype=Object.create(THREE.Light.prototype);THREE.DirectionalLight.prototype.constructor=THREE.DirectionalLight; THREE.DirectionalLight.prototype.clone=function{var a=new THREE.DirectionalLight;THREE.Light.prototype.clone.call(this,a);a.target=this.target.clone;a.intensity=this.intensity;a.castShadow=this.castShadow;a.onlyShadow=this.onlyShadow;a.shadowCameraNear=this.shadowCameraNear;a.shadowCameraFar=this.shadowCameraFar;a.shadowCameraLeft=this.shadowCameraLeft;a.shadowCameraRight=this.shadowCameraRight;a.shadowCameraTop=this.shadowCameraTop;a.shadowCameraBottom=this.shadowCameraBottom;a.shadowCameraVisible= this.shadowCameraVisible;a.shadowBias=this.shadowBias;a.shadowDarkness=this.shadowDarkness;a.shadowMapWidth=this.shadowMapWidth;a.shadowMapHeight=this.shadowMapHeight;a.shadowCascade=this.shadowCascade;a.shadowCascadeOffset.copy(this.shadowCascadeOffset);a.shadowCascadeCount=this.shadowCascadeCount;a.shadowCascadeBias=this.shadowCascadeBias.slice(0);a.shadowCascadeWidth=this.shadowCascadeWidth.slice(0);a.shadowCascadeHeight=this.shadowCascadeHeight.slice(0);a.shadowCascadeNearZ=this.shadowCascadeNearZ.slice(0); a.shadowCascadeFarZ=this.shadowCascadeFarZ.slice(0);return a};THREE.HemisphereLight=function(a,b,c){THREE.Light.call(this,a);this.type="HemisphereLight";this.position.set(0,100,0);this.groundColor=new THREE.Color(b);this.intensity=void 0!==c?c:1};THREE.HemisphereLight.prototype=Object.create(THREE.Light.prototype);THREE.HemisphereLight.prototype.constructor=THREE.HemisphereLight; THREE.HemisphereLight.prototype.clone=function{var a=new THREE.HemisphereLight;THREE.Light.prototype.clone.call(this,a);a.groundColor.copy(this.groundColor);a.intensity=this.intensity;return a};THREE.PointLight=function(a,b,c,d){THREE.Light.call(this,a);this.type="PointLight";this.intensity=void 0!==b?b:1;this.distance=void 0!==c?c:0;this.decay=void 0!==d?d:1};THREE.PointLight.prototype=Object.create(THREE.Light.prototype);THREE.PointLight.prototype.constructor=THREE.PointLight; THREE.PointLight.prototype.clone=function{var a=new THREE.PointLight;THREE.Light.prototype.clone.call(this,a);a.intensity=this.intensity;a.distance=this.distance;a.decay=this.decay;return a}; THREE.SpotLight=function(a,b,c,d,e,f){THREE.Light.call(this,a);this.type="SpotLight";this.position.set(0,1,0);this.target=new THREE.Object3D;this.intensity=void 0!==b?b:1;this.distance=void 0!==c?c:0;this.angle=void 0!==d?d:Math.PI/3;this.exponent=void 0!==e?e:10;this.decay=void 0!==f?f:1;this.onlyShadow=this.castShadow=!1;this.shadowCameraNear=50;this.shadowCameraFar=5E3;this.shadowCameraFov=50;this.shadowCameraVisible=!1;this.shadowBias=0;this.shadowDarkness=.5;this.shadowMapHeight=this.shadowMapWidth= 512;this.shadowMatrix=this.shadowCamera=this.shadowMapSize=this.shadowMap=null};THREE.SpotLight.prototype=Object.create(THREE.Light.prototype);THREE.SpotLight.prototype.constructor=THREE.SpotLight; THREE.SpotLight.prototype.clone=function{var a=new THREE.SpotLight;THREE.Light.prototype.clone.call(this,a);a.target=this.target.clone;a.intensity=this.intensity;a.distance=this.distance;a.angle=this.angle;a.exponent=this.exponent;a.decay=this.decay;a.castShadow=this.castShadow;a.onlyShadow=this.onlyShadow;a.shadowCameraNear=this.shadowCameraNear;a.shadowCameraFar=this.shadowCameraFar;a.shadowCameraFov=this.shadowCameraFov;a.shadowCameraVisible=this.shadowCameraVisible;a.shadowBias=this.shadowBias; a.shadowDarkness=this.shadowDarkness;a.shadowMapWidth=this.shadowMapWidth;a.shadowMapHeight=this.shadowMapHeight;return a};THREE.Cache={files:{},add:function(a,b){this.files[a]=b},get:function(a){return this.files[a]},remove:function(a){delete this.files[a]},clear:function{this.files={}}}; THREE.Loader=function(a){this.statusDomElement=(this.showStatus=a)?THREE.Loader.prototype.addStatusElement:null;this.imageLoader=new THREE.ImageLoader;this.onLoadStart=function{};this.onLoadProgress=function{};this.onLoadComplete=function{}}; THREE.Loader.prototype={constructor:THREE.Loader,crossOrigin:void 0,addStatusElement:function{var a=document.createElement("div");a.style.position="absolute";a.style.right="0px";a.style.top="0px";a.style.fontSize="0.8em";a.style.textAlign="left";a.style.background="rgba(0,0,0,0.25)";a.style.color="#fff";a.style.width="120px";a.style.padding="0.5em 0.5em 0.5em 0.5em";a.style.zIndex=1E3;a.innerHTML="Loading ...";return a},updateProgress:function(a){var b="Loaded ",b=a.total?b+((100*a.loaded/a.total).toFixed(0)+ "%"):b+((a.loaded/1024).toFixed(2)+" KB");this.statusDomElement.innerHTML=b},extractUrlBase:function(a){a=a.split("/");if(1===a.length)return"./";a.pop;return a.join("/")+"/"},initMaterials:function(a,b){for(var c=[],d=0;d<a.length;++d)c[d]=this.createMaterial(a[d],b);return c},needsTangents:function(a){for(var b=0,c=a.length;b<c;b++)if(a[b]instanceof THREE.ShaderMaterial)return!0;return!1},createMaterial:function(a,b){function c(a){a=Math.log(a)/Math.LN2;return Math.pow(2,Math.round(a))}function d(a, d,e,g,h,k,s){var u=b+e,v,x=THREE.Loader.Handlers.get(u);null!==x?v=x.load(u):(v=new THREE.Texture,x=f.imageLoader,x.crossOrigin=f.crossOrigin,x.load(u,function(a){if(!1===THREE.Math.isPowerOfTwo(a.width)||!1===THREE.Math.isPowerOfTwo(a.height)){var b=c(a.width),d=c(a.height),e=document.createElement("canvas");e.width=b;e.height=d;e.getContext("2d").drawImage(a,0,0,b,d);v.image=e}else v.image=a;v.needsUpdate=!0}));v.sourceFile=e;g&&(v.repeat.set(g[0],g[1]),1!==g[0]&&(v.wrapS=THREE.RepeatWrapping), 1!==g[1]&&(v.wrapT=THREE.RepeatWrapping));h&&v.offset.set(h[0],h[1]);k&&(e={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping},void 0!==e[k[0]]&&(v.wrapS=e[k[0]]),void 0!==e[k[1]]&&(v.wrapT=e[k[1]]));s&&(v.anisotropy=s);a[d]=v}function e(a){return(255*a[0]<<16)+(255*a[1]<<8)+255*a[2]}var f=this,g="MeshLambertMaterial",h={color:15658734,opacity:1,map:null,lightMap:null,normalMap:null,bumpMap:null,wireframe:!1};if(a.shading){var k=a.shading.toLowerCase;"phong"===k?g="MeshPhongMaterial": "basic"===k&&(g="MeshBasicMaterial")}void 0!==a.blending&&void 0!==THREE[a.blending]&&(h.blending=THREE[a.blending]);void 0!==a.transparent&&(h.transparent=a.transparent);void 0!==a.opacity&&1>a.opacity&&(h.transparent=!0);void 0!==a.depthTest&&(h.depthTest=a.depthTest);void 0!==a.depthWrite&&(h.depthWrite=a.depthWrite);void 0!==a.visible&&(h.visible=a.visible);void 0!==a.flipSided&&(h.side=THREE.BackSide);void 0!==a.doubleSided&&(h.side=THREE.DoubleSide);void 0!==a.wireframe&&(h.wireframe=a.wireframe); void 0!==a.vertexColors&&("face"===a.vertexColors?h.vertexColors=THREE.FaceColors:a.vertexColors&&(h.vertexColors=THREE.VertexColors));a.colorDiffuse?h.color=e(a.colorDiffuse):a.DbgColor&&(h.color=a.DbgColor);a.colorSpecular&&(h.specular=e(a.colorSpecular));a.colorEmissive&&(h.emissive=e(a.colorEmissive));void 0!==a.transparency&&(console.warn("THREE.Loader: transparency has been renamed to opacity"),a.opacity=a.transparency);void 0!==a.opacity&&(h.opacity=a.opacity);a.specularCoef&&(h.shininess= a.specularCoef);a.mapDiffuse&&b&&d(h,"map",a.mapDiffuse,a.mapDiffuseRepeat,a.mapDiffuseOffset,a.mapDiffuseWrap,a.mapDiffuseAnisotropy);a.mapLight&&b&&d(h,"lightMap",a.mapLight,a.mapLightRepeat,a.mapLightOffset,a.mapLightWrap,a.mapLightAnisotropy);a.mapBump&&b&&d(h,"bumpMap",a.mapBump,a.mapBumpRepeat,a.mapBumpOffset,a.mapBumpWrap,a.mapBumpAnisotropy);a.mapNormal&&b&&d(h,"normalMap",a.mapNormal,a.mapNormalRepeat,a.mapNormalOffset,a.mapNormalWrap,a.mapNormalAnisotropy);a.mapSpecular&&b&&d(h,"specularMap", a.mapSpecular,a.mapSpecularRepeat,a.mapSpecularOffset,a.mapSpecularWrap,a.mapSpecularAnisotropy);a.mapAlpha&&b&&d(h,"alphaMap",a.mapAlpha,a.mapAlphaRepeat,a.mapAlphaOffset,a.mapAlphaWrap,a.mapAlphaAnisotropy);a.mapBumpScale&&(h.bumpScale=a.mapBumpScale);a.mapNormalFactor&&(h.normalScale=new THREE.Vector2(a.mapNormalFactor,a.mapNormalFactor));g=new THREE[g](h);void 0!==a.DbgName&&(g.name=a.DbgName);return g}}; THREE.Loader.Handlers={handlers:[],add:function(a,b){this.handlers.push(a,b)},get:function(a){for(var b=0,c=this.handlers.length;b<c;b+=2){var d=this.handlers[b+1];if(this.handlers[b].test(a))return d}return null}};THREE.XHRLoader=function(a){this.manager=void 0!==a?a:THREE.DefaultLoadingManager}; THREE.XHRLoader.prototype={constructor:THREE.XHRLoader,load:function(a,b,c,d){var e=this,f=THREE.Cache.get(a);void 0!==f?b&&b(f):(f=new XMLHttpRequest,f.open("GET",a,!0),f.addEventListener("load",function(c){THREE.Cache.add(a,this.response);b&&b(this.response);e.manager.itemEnd(a)},!1),void 0!==c&&f.addEventListener("progress",function(a){c(a)},!1),void 0!==d&&f.addEventListener("error",function(a){d(a)},!1),void 0!==this.crossOrigin&&(f.crossOrigin=this.crossOrigin),void 0!==this.responseType&&(f.responseType= this.responseType),f.send(null),e.manager.itemStart(a))},setResponseType:function(a){this.responseType=a},setCrossOrigin:function(a){this.crossOrigin=a}};THREE.ImageLoader=function(a){this.manager=void 0!==a?a:THREE.DefaultLoadingManager}; THREE.ImageLoader.prototype={constructor:THREE.ImageLoader,load:function(a,b,c,d){var e=this,f=THREE.Cache.get(a);if(void 0!==f)b(f);else return f=document.createElement("img"),f.addEventListener("load",function(c){THREE.Cache.add(a,this);b&&b(this);e.manager.itemEnd(a)},!1),void 0!==c&&f.addEventListener("progress",function(a){c(a)},!1),void 0!==d&&f.addEventListener("error",function(a){d(a)},!1),void 0!==this.crossOrigin&&(f.crossOrigin=this.crossOrigin),f.src=a,e.manager.itemStart(a),f},setCrossOrigin:function(a){this.crossOrigin= a}};THREE.JSONLoader=function(a){THREE.Loader.call(this,a);this.withCredentials=!1};THREE.JSONLoader.prototype=Object.create(THREE.Loader.prototype);THREE.JSONLoader.prototype.constructor=THREE.JSONLoader;THREE.JSONLoader.prototype.load=function(a,b,c){c=c&&"string"===typeof c?c:this.extractUrlBase(a);this.onLoadStart;this.loadAjaxJSON(this,a,b,c)}; THREE.JSONLoader.prototype.loadAjaxJSON=function(a,b,c,d,e){var f=new XMLHttpRequest,g=0;f.onreadystatechange=function{if(f.readyState===f.DONE)if(200===f.status||0===f.status){if(f.responseText){var h=JSON.parse(f.responseText),k=h.metadata;if(void 0!==k){if("object"===k.type){THREE.error("THREE.JSONLoader: "+b+" should be loaded with THREE.ObjectLoader instead.");return}if("scene"===k.type){THREE.error("THREE.JSONLoader: "+b+" seems to be a Scene. Use THREE.SceneLoader instead.");return}}h=a.parse(h, d);c(h.geometry,h.materials)}else THREE.error("THREE.JSONLoader: "+b+" seems to be unreachable or the file is empty.");a.onLoadComplete}else THREE.error("THREE.JSONLoader: Couldn't load "+b+" ("+f.status+")");else f.readyState===f.LOADING?e&&(0===g&&(g=f.getResponseHeader("Content-Length")),e({total:g,loaded:f.responseText.length})):f.readyState===f.HEADERS_RECEIVED&&void 0!==e&&(g=f.getResponseHeader("Content-Length"))};f.open("GET",b,!0);f.withCredentials=this.withCredentials;f.send(null)}; THREE.JSONLoader.prototype.parse=function(a,b){var c=new THREE.Geometry,d=void 0!==a.scale?1/a.scale:1;(function(b){var d,g,h,k,l,p,q,n,t,r,s,u,v,x=a.faces;p=a.vertices;var D=a.normals,w=a.colors,y=0;if(void 0!==a.uvs){for(d=0;d<a.uvs.length;d++)a.uvs[d].length&&y++;for(d=0;d<y;d++)c.faceVertexUvs[d]=[]}k=0;for(l=p.length;k<l;)d=new THREE.Vector3,d.x=p[k++]*b,d.y=p[k++]*b,d.z=p[k++]*b,c.vertices.push(d);k=0;for(l=x.length;k<l;)if(b=x[k++],t=b&1,h=b&2,d=b&8,q=b&16,r=b&32,p=b&64,b&=128,t){t=new THREE.Face3; t.a=x[k];t.b=x[k+1];t.c=x[k+3];s=new THREE.Face3;s.a=x[k+1];s.b=x[k+2];s.c=x[k+3];k+=4;h&&(h=x[k++],t.materialIndex=h,s.materialIndex=h);h=c.faces.length;if(d)for(d=0;d<y;d++)for(u=a.uvs[d],c.faceVertexUvs[d][h]=[],c.faceVertexUvs[d][h+1]=[],g=0;4>g;g++)n=x[k++],v=u[2*n],n=u[2*n+1],v=new THREE.Vector2(v,n),2!==g&&c.faceVertexUvs[d][h].push(v),0!==g&&c.faceVertexUvs[d][h+1].push(v);q&&(q=3*x[k++],t.normal.set(D[q++],D[q++],D[q]),s.normal.copy(t.normal));if(r)for(d=0;4>d;d++)q=3*x[k++],r=new THREE.Vector3(D[q++], D[q++],D[q]),2!==d&&t.vertexNormals.push(r),0!==d&&s.vertexNormals.push(r);p&&(p=x[k++],p=w[p],t.color.setHex(p),s.color.setHex(p));if(b)for(d=0;4>d;d++)p=x[k++],p=w[p],2!==d&&t.vertexColors.push(new THREE.Color(p)),0!==d&&s.vertexColors.push(new THREE.Color(p));c.faces.push(t);c.faces.push(s)}else{t=new THREE.Face3;t.a=x[k++];t.b=x[k++];t.c=x[k++];h&&(h=x[k++],t.materialIndex=h);h=c.faces.length;if(d)for(d=0;d<y;d++)for(u=a.uvs[d],c.faceVertexUvs[d][h]=[],g=0;3>g;g++)n=x[k++],v=u[2*n],n=u[2*n+1], v=new THREE.Vector2(v,n),c.faceVertexUvs[d][h].push(v);q&&(q=3*x[k++],t.normal.set(D[q++],D[q++],D[q]));if(r)for(d=0;3>d;d++)q=3*x[k++],r=new THREE.Vector3(D[q++],D[q++],D[q]),t.vertexNormals.push(r);p&&(p=x[k++],t.color.setHex(w[p]));if(b)for(d=0;3>d;d++)p=x[k++],t.vertexColors.push(new THREE.Color(w[p]));c.faces.push(t)}})(d);(function{var b=void 0!==a.influencesPerVertex?a.influencesPerVertex:2;if(a.skinWeights)for(var d=0,g=a.skinWeights.length;d<g;d+=b)c.skinWeights.push(new THREE.Vector4(a.skinWeights[d], 1<b?a.skinWeights[d+1]:0,2<b?a.skinWeights[d+2]:0,3<b?a.skinWeights[d+3]:0));if(a.skinIndices)for(d=0,g=a.skinIndices.length;d<g;d+=b)c.skinIndices.push(new THREE.Vector4(a.skinIndices[d],1<b?a.skinIndices[d+1]:0,2<b?a.skinIndices[d+2]:0,3<b?a.skinIndices[d+3]:0));c.bones=a.bones;c.bones&&0<c.bones.length&&(c.skinWeights.length!==c.skinIndices.length||c.skinIndices.length!==c.vertices.length)&&THREE.warn("THREE.JSONLoader: When skinning, number of vertices ("+c.vertices.length+"), skinIndices ("+ c.skinIndices.length+"), and skinWeights ("+c.skinWeights.length+") should match.");c.animation=a.animation;c.animations=a.animations});(function(b){if(void 0!==a.morphTargets){var d,g,h,k,l,p;d=0;for(g=a.morphTargets.length;d<g;d++)for(c.morphTargets[d]={},c.morphTargets[d].name=a.morphTargets[d].name,c.morphTargets[d].vertices=[],l=c.morphTargets[d].vertices,p=a.morphTargets[d].vertices,h=0,k=p.length;h<k;h+=3){var q=new THREE.Vector3;q.x=p[h]*b;q.y=p[h+1]*b;q.z=p[h+2]*b;l.push(q)}}if(void 0!== a.morphColors)for(d=0,g=a.morphColors.length;d<g;d++)for(c.morphColors[d]={},c.morphColors[d].name=a.morphColors[d].name,c.morphColors[d].colors=[],k=c.morphColors[d].colors,l=a.morphColors[d].colors,b=0,h=l.length;b<h;b+=3)p=new THREE.Color(16755200),p.setRGB(l[b],l[b+1],l[b+2]),k.push(p)})(d);c.computeFaceNormals;c.computeBoundingSphere;if(void 0===a.materials||0===a.materials.length)return{geometry:c};d=this.initMaterials(a.materials,b);this.needsTangents(d)&&c.computeTangents;return{geometry:c, materials:d}};THREE.LoadingManager=function(a,b,c){var d=this,e=0,f=0;this.onLoad=a;this.onProgress=b;this.onError=c;this.itemStart=function(a){f++};this.itemEnd=function(a){e++;if(void 0!==d.onProgress)d.onProgress(a,e,f);if(e===f&&void 0!==d.onLoad)d.onLoad}};THREE.DefaultLoadingManager=new THREE.LoadingManager;THREE.BufferGeometryLoader=function(a){this.manager=void 0!==a?a:THREE.DefaultLoadingManager}; THREE.BufferGeometryLoader.prototype={constructor:THREE.BufferGeometryLoader,load:function(a,b,c,d){var e=this,f=new THREE.XHRLoader(e.manager);f.setCrossOrigin(this.crossOrigin);f.load(a,function(a){b(e.parse(JSON.parse(a)))},c,d)},setCrossOrigin:function(a){this.crossOrigin=a},parse:function(a){var b=new THREE.BufferGeometry,c=a.data.attributes,d;for(d in c){var e=c[d],f=new self[e.type](e.array);b.addAttribute(d,new THREE.BufferAttribute(f,e.itemSize))}c=a.data.offsets;void 0!==c&&(b.offsets=JSON.parse(JSON.stringify(c))); a=a.data.boundingSphere;void 0!==a&&(c=new THREE.Vector3,void 0!==a.center&&c.fromArray(a.center),b.boundingSphere=new THREE.Sphere(c,a.radius));return b}};THREE.MaterialLoader=function(a){this.manager=void 0!==a?a:THREE.DefaultLoadingManager}; THREE.MaterialLoader.prototype={constructor:THREE.MaterialLoader,load:function(a,b,c,d){var e=this,f=new THREE.XHRLoader(e.manager);f.setCrossOrigin(this.crossOrigin);f.load(a,function(a){b(e.parse(JSON.parse(a)))},c,d)},setCrossOrigin:function(a){this.crossOrigin=a},parse:function(a){var b=new THREE[a.type];void 0!==a.color&&b.color.setHex(a.color);void 0!==a.emissive&&b.emissive.setHex(a.emissive);void 0!==a.specular&&b.specular.setHex(a.specular);void 0!==a.shininess&&(b.shininess=a.shininess); void 0!==a.uniforms&&(b.uniforms=a.uniforms);void 0!==a.vertexShader&&(b.vertexShader=a.vertexShader);void 0!==a.fragmentShader&&(b.fragmentShader=a.fragmentShader);void 0!==a.vertexColors&&(b.vertexColors=a.vertexColors);void 0!==a.shading&&(b.shading=a.shading);void 0!==a.blending&&(b.blending=a.blending);void 0!==a.side&&(b.side=a.side);void 0!==a.opacity&&(b.opacity=a.opacity);void 0!==a.transparent&&(b.transparent=a.transparent);void 0!==a.wireframe&&(b.wireframe=a.wireframe);void 0!==a.size&& (b.size=a.size);void 0!==a.sizeAttenuation&&(b.sizeAttenuation=a.sizeAttenuation);if(void 0!==a.materials)for(var c=0,d=a.materials.length;c<d;c++)b.materials.push(this.parse(a.materials[c]));return b}};THREE.ObjectLoader=function(a){this.manager=void 0!==a?a:THREE.DefaultLoadingManager;this.texturePath=""}; THREE.ObjectLoader.prototype={constructor:THREE.ObjectLoader,load:function(a,b,c,d){""===this.texturePath&&(this.texturePath=a.substring(0,a.lastIndexOf("/")+1));var e=this,f=new THREE.XHRLoader(e.manager);f.setCrossOrigin(this.crossOrigin);f.load(a,function(a){e.parse(JSON.parse(a),b)},c,d)},setTexturePath:function(a){this.texturePath=a},setCrossOrigin:function(a){this.crossOrigin=a},parse:function(a,b){var c=this.parseGeometries(a.geometries),d=this.parseImages(a.images,function{void 0!==b&&b(e)}), d=this.parseTextures(a.textures,d),d=this.parseMaterials(a.materials,d),e=this.parseObject(a.object,c,d);void 0!==a.images&&0!==a.images.length||void 0===b||b(e);return e},parseGeometries:function(a){var b={};if(void 0!==a)for(var c=new THREE.JSONLoader,d=new THREE.BufferGeometryLoader,e=0,f=a.length;e<f;e++){var g,h=a[e];switch(h.type){case "PlaneGeometry":case "PlaneBufferGeometry":g=new THREE[h.type](h.width,h.height,h.widthSegments,h.heightSegments);break;case "BoxGeometry":case "CubeGeometry":g= new THREE.BoxGeometry(h.width,h.height,h.depth,h.widthSegments,h.heightSegments,h.depthSegments);break;case "CircleGeometry":g=new THREE.CircleGeometry(h.radius,h.segments);break;case "CylinderGeometry":g=new THREE.CylinderGeometry(h.radiusTop,h.radiusBottom,h.height,h.radialSegments,h.heightSegments,h.openEnded);break;case "SphereGeometry":g=new THREE.SphereGeometry(h.radius,h.widthSegments,h.heightSegments,h.phiStart,h.phiLength,h.thetaStart,h.thetaLength);break;case "IcosahedronGeometry":g=new THREE.IcosahedronGeometry(h.radius, h.detail);break;case "TorusGeometry":g=new THREE.TorusGeometry(h.radius,h.tube,h.radialSegments,h.tubularSegments,h.arc);break;case "TorusKnotGeometry":g=new THREE.TorusKnotGeometry(h.radius,h.tube,h.radialSegments,h.tubularSegments,h.p,h.q,h.heightScale);break;case "BufferGeometry":g=d.parse(h);break;case "Geometry":g=c.parse(h.data).geometry}g.uuid=h.uuid;void 0!==h.name&&(g.name=h.name);b[h.uuid]=g}return b},parseMaterials:function(a,b){var c={};if(void 0!==a)for(var d=function(a){void 0===b[a]&& THREE.warn("THREE.ObjectLoader: Undefined texture",a);return b[a]},e=new THREE.MaterialLoader,f=0,g=a.length;f<g;f++){var h=a[f],k=e.parse(h);k.uuid=h.uuid;void 0!==h.name&&(k.name=h.name);void 0!==h.map&&(k.map=d(h.map));void 0!==h.bumpMap&&(k.bumpMap=d(h.bumpMap),h.bumpScale&&(k.bumpScale=new THREE.Vector2(h.bumpScale,h.bumpScale)));void 0!==h.alphaMap&&(k.alphaMap=d(h.alphaMap));void 0!==h.envMap&&(k.envMap=d(h.envMap));void 0!==h.normalMap&&(k.normalMap=d(h.normalMap),h.normalScale&&(k.normalScale= new THREE.Vector2(h.normalScale,h.normalScale)));void 0!==h.lightMap&&(k.lightMap=d(h.lightMap));void 0!==h.specularMap&&(k.specularMap=d(h.specularMap));c[h.uuid]=k}return c},parseImages:function(a,b){var c=this,d={};if(void 0!==a&&0<a.length){var e=new THREE.LoadingManager(b),f=new THREE.ImageLoader(e);f.setCrossOrigin(this.crossOrigin);for(var e=function(a){c.manager.itemStart(a);return f.load(a,function{c.manager.itemEnd(a)})},g=0,h=a.length;g<h;g++){var k=a[g],l=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(k.url)? k.url:c.texturePath+k.url;d[k.uuid]=e(l)}}return d},parseTextures:function(a,b){var c={};if(void 0!==a)for(var d=0,e=a.length;d<e;d++){var f=a[d];void 0===f.image&&THREE.warn('THREE.ObjectLoader: No "image" speficied for',f.uuid);void 0===b[f.image]&&THREE.warn("THREE.ObjectLoader: Undefined image",f.image);var g=new THREE.Texture(b[f.image]);g.needsUpdate=!0;g.uuid=f.uuid;void 0!==f.name&&(g.name=f.name);void 0!==f.repeat&&(g.repeat=new THREE.Vector2(f.repeat[0],f.repeat[1]));void 0!==f.minFilter&& (g.minFilter=THREE[f.minFilter]);void 0!==f.magFilter&&(g.magFilter=THREE[f.magFilter]);void 0!==f.anisotropy&&(g.anisotropy=f.anisotropy);f.wrap instanceof Array&&(g.wrapS=THREE[f.wrap[0]],g.wrapT=THREE[f.wrap[1]]);c[f.uuid]=g}return c},parseObject:function{var a=new THREE.Matrix4;return function(b,c,d){var e;e=function(a){void 0===c[a]&&THREE.warn("THREE.ObjectLoader: Undefined geometry",a);return c[a]};var f=function(a){void 0===d[a]&&THREE.warn("THREE.ObjectLoader: Undefined material",a);return d[a]}; switch(b.type){case "Scene":e=new THREE.Scene;break;case "PerspectiveCamera":e=new THREE.PerspectiveCamera(b.fov,b.aspect,b.near,b.far);break;case "OrthographicCamera":e=new THREE.OrthographicCamera(b.left,b.right,b.top,b.bottom,b.near,b.far);break;case "AmbientLight":e=new THREE.AmbientLight(b.color);break;case "DirectionalLight":e=new THREE.DirectionalLight(b.color,b.intensity);break;case "PointLight":e=new THREE.PointLight(b.color,b.intensity,b.distance,b.decay);break;case "SpotLight":e=new THREE.SpotLight(b.color, b.intensity,b.distance,b.angle,b.exponent,b.decay);break;case "HemisphereLight":e=new THREE.HemisphereLight(b.color,b.groundColor,b.intensity);break;case "Mesh":e=new THREE.Mesh(e(b.geometry),f(b.material));break;case "Line":e=new THREE.Line(e(b.geometry),f(b.material),b.mode);break;case "PointCloud":e=new THREE.PointCloud(e(b.geometry),f(b.material));break;case "Sprite":e=new THREE.Sprite(f(b.material));break;case "Group":e=new THREE.Group;break;default:e=new THREE.Object3D}e.uuid=b.uuid;void 0!== b.name&&(e.name=b.name);void 0!==b.matrix?(a.fromArray(b.matrix),a.decompose(e.position,e.quaternion,e.scale)):(void 0!==b.position&&e.position.fromArray(b.position),void 0!==b.rotation&&e.rotation.fromArray(b.rotation),void 0!==b.scale&&e.scale.fromArray(b.scale));void 0!==b.visible&&(e.visible=b.visible);void 0!==b.userData&&(e.userData=b.userData);if(void 0!==b.children)for(var g in b.children)e.add(this.parseObject(b.children[g],c,d));return e}}}; THREE.TextureLoader=function(a){this.manager=void 0!==a?a:THREE.DefaultLoadingManager};THREE.TextureLoader.prototype={constructor:THREE.TextureLoader,load:function(a,b,c,d){var e=new THREE.ImageLoader(this.manager);e.setCrossOrigin(this.crossOrigin);e.load(a,function(a){a=new THREE.Texture(a);a.needsUpdate=!0;void 0!==b&&b(a)},c,d)},setCrossOrigin:function(a){this.crossOrigin=a}};THREE.DataTextureLoader=THREE.BinaryTextureLoader=function{this._parser=null}; THREE.BinaryTextureLoader.prototype={constructor:THREE.BinaryTextureLoader,load:function(a,b,c,d){var e=this,f=new THREE.DataTexture,g=new THREE.XHRLoader;g.setResponseType("arraybuffer");g.load(a,function(a){if(a=e._parser(a))void 0!==a.image?f.image=a.image:void 0!==a.data&&(f.image.width=a.width,f.image.height=a.height,f.image.data=a.data),f.wrapS=void 0!==a.wrapS?a.wrapS:THREE.ClampToEdgeWrapping,f.wrapT=void 0!==a.wrapT?a.wrapT:THREE.ClampToEdgeWrapping,f.magFilter=void 0!==a.magFilter?a.magFilter: THREE.LinearFilter,f.minFilter=void 0!==a.minFilter?a.minFilter:THREE.LinearMipMapLinearFilter,f.anisotropy=void 0!==a.anisotropy?a.anisotropy:1,void 0!==a.format&&(f.format=a.format),void 0!==a.type&&(f.type=a.type),void 0!==a.mipmaps&&(f.mipmaps=a.mipmaps),1===a.mipmapCount&&(f.minFilter=THREE.LinearFilter),f.needsUpdate=!0,b&&b(f,a)},c,d);return f}};THREE.CompressedTextureLoader=function{this._parser=null}; THREE.CompressedTextureLoader.prototype={constructor:THREE.CompressedTextureLoader,load:function(a,b,c){var d=this,e=[],f=new THREE.CompressedTexture;f.image=e;var g=new THREE.XHRLoader;g.setResponseType("arraybuffer");if(a instanceof Array){var h=0;c=function(c){g.load(a[c],function(a){a=d._parser(a,!0);e[c]={width:a.width,height:a.height,format:a.format,mipmaps:a.mipmaps};h+=1;6===h&&(1==a.mipmapCount&&(f.minFilter=THREE.LinearFilter),f.format=a.format,f.needsUpdate=!0,b&&b(f))})};for(var k=0,l= a.length;k<l;++k)c(k)}else g.load(a,function(a){a=d._parser(a,!0);if(a.isCubemap)for(var c=a.mipmaps.length/a.mipmapCount,g=0;g<c;g++){e[g]={mipmaps:[]};for(var h=0;h<a.mipmapCount;h++)e[g].mipmaps.push(a.mipmaps[g*a.mipmapCount+h]),e[g].format=a.format,e[g].width=a.width,e[g].height=a.height}else f.image.width=a.width,f.image.height=a.height,f.mipmaps=a.mipmaps;1===a.mipmapCount&&(f.minFilter=THREE.LinearFilter);f.format=a.format;f.needsUpdate=!0;b&&b(f)});return f}}; THREE.Material=function{Object.defineProperty(this,"id",{value:THREE.MaterialIdCount++});this.uuid=THREE.Math.generateUUID;this.name="";this.type="Material";this.side=THREE.FrontSide;this.opacity=1;this.transparent=!1;this.blending=THREE.NormalBlending;this.blendSrc=THREE.SrcAlphaFactor;this.blendDst=THREE.OneMinusSrcAlphaFactor;this.blendEquation=THREE.AddEquation;this.blendEquationAlpha=this.blendDstAlpha=this.blendSrcAlpha=null;this.colorWrite=this.depthWrite=this.depthTest=!0;this.polygonOffset= !1;this.overdraw=this.alphaTest=this.polygonOffsetUnits=this.polygonOffsetFactor=0;this._needsUpdate=this.visible=!0}; THREE.Material.prototype={constructor:THREE.Material,get needsUpdate{return this._needsUpdate},set needsUpdate(a){!0===a&&this.update;this._needsUpdate=a},setValues:function(a){if(void 0!==a)for(var b in a){var c=a[b];if(void 0===c)THREE.warn("THREE.Material: '"+b+"' parameter is undefined.");else if(b in this){var d=this[b];d instanceof THREE.Color?d.set(c):d instanceof THREE.Vector3&&c instanceof THREE.Vector3?d.copy(c):this[b]="overdraw"==b?Number(c):c}}},toJSON:function{var a={metadata:{version:4.2, type:"material",generator:"MaterialExporter"},uuid:this.uuid,type:this.type};""!==this.name&&(a.name=this.name);this instanceof THREE.MeshBasicMaterial?(a.color=this.color.getHex,this.vertexColors!==THREE.NoColors&&(a.vertexColors=this.vertexColors),this.blending!==THREE.NormalBlending&&(a.blending=this.blending),this.side!==THREE.FrontSide&&(a.side=this.side)):this instanceof THREE.MeshLambertMaterial?(a.color=this.color.getHex,a.emissive=this.emissive.getHex,this.vertexColors!==THREE.NoColors&& (a.vertexColors=this.vertexColors),this.shading!==THREE.SmoothShading&&(a.shading=this.shading),this.blending!==THREE.NormalBlending&&(a.blending=this.blending),this.side!==THREE.FrontSide&&(a.side=this.side)):this instanceof THREE.MeshPhongMaterial?(a.color=this.color.getHex,a.emissive=this.emissive.getHex,a.specular=this.specular.getHex,a.shininess=this.shininess,this.vertexColors!==THREE.NoColors&&(a.vertexColors=this.vertexColors),this.shading!==THREE.SmoothShading&&(a.shading=this.shading), this.blending!==THREE.NormalBlending&&(a.blending=this.blending),this.side!==THREE.FrontSide&&(a.side=this.side)):this instanceof THREE.MeshNormalMaterial?(this.blending!==THREE.NormalBlending&&(a.blending=this.blending),this.side!==THREE.FrontSide&&(a.side=this.side)):this instanceof THREE.MeshDepthMaterial?(this.blending!==THREE.NormalBlending&&(a.blending=this.blending),this.side!==THREE.FrontSide&&(a.side=this.side)):this instanceof THREE.PointCloudMaterial?(a.size=this.size,a.sizeAttenuation= this.sizeAttenuation,a.color=this.color.getHex,this.vertexColors!==THREE.NoColors&&(a.vertexColors=this.vertexColors),this.blending!==THREE.NormalBlending&&(a.blending=this.blending)):this instanceof THREE.ShaderMaterial?(a.uniforms=this.uniforms,a.vertexShader=this.vertexShader,a.fragmentShader=this.fragmentShader):this instanceof THREE.SpriteMaterial&&(a.color=this.color.getHex);1>this.opacity&&(a.opacity=this.opacity);!1!==this.transparent&&(a.transparent=this.transparent);!1!==this.wireframe&& (a.wireframe=this.wireframe);return a},clone:function(a){void 0===a&&(a=new THREE.Material);a.name=this.name;a.side=this.side;a.opacity=this.opacity;a.transparent=this.transparent;a.blending=this.blending;a.blendSrc=this.blendSrc;a.blendDst=this.blendDst;a.blendEquation=this.blendEquation;a.blendSrcAlpha=this.blendSrcAlpha;a.blendDstAlpha=this.blendDstAlpha;a.blendEquationAlpha=this.blendEquationAlpha;a.depthTest=this.depthTest;a.depthWrite=this.depthWrite;a.polygonOffset=this.polygonOffset;a.polygonOffsetFactor= this.polygonOffsetFactor;a.polygonOffsetUnits=this.polygonOffsetUnits;a.alphaTest=this.alphaTest;a.overdraw=this.overdraw;a.visible=this.visible;return a},update:function{this.dispatchEvent({type:"update"})},dispose:function{this.dispatchEvent({type:"dispose"})}};THREE.EventDispatcher.prototype.apply(THREE.Material.prototype);THREE.MaterialIdCount=0; THREE.LineBasicMaterial=function(a){THREE.Material.call(this);this.type="LineBasicMaterial";this.color=new THREE.Color(16777215);this.linewidth=1;this.linejoin=this.linecap="round";this.vertexColors=THREE.NoColors;this.fog=!0;this.setValues(a)};THREE.LineBasicMaterial.prototype=Object.create(THREE.Material.prototype);THREE.LineBasicMaterial.prototype.constructor=THREE.LineBasicMaterial; THREE.LineBasicMaterial.prototype.clone=function{var a=new THREE.LineBasicMaterial;THREE.Material.prototype.clone.call(this,a);a.color.copy(this.color);a.linewidth=this.linewidth;a.linecap=this.linecap;a.linejoin=this.linejoin;a.vertexColors=this.vertexColors;a.fog=this.fog;return a}; THREE.LineDashedMaterial=function(a){THREE.Material.call(this);this.type="LineDashedMaterial";this.color=new THREE.Color(16777215);this.scale=this.linewidth=1;this.dashSize=3;this.gapSize=1;this.vertexColors=!1;this.fog=!0;this.setValues(a)};THREE.LineDashedMaterial.prototype=Object.create(THREE.Material.prototype);THREE.LineDashedMaterial.prototype.constructor=THREE.LineDashedMaterial; THREE.LineDashedMaterial.prototype.clone=function{var a=new THREE.LineDashedMaterial;THREE.Material.prototype.clone.call(this,a);a.color.copy(this.color);a.linewidth=this.linewidth;a.scale=this.scale;a.dashSize=this.dashSize;a.gapSize=this.gapSize;a.vertexColors=this.vertexColors;a.fog=this.fog;return a}; THREE.MeshBasicMaterial=function(a){THREE.Material.call(this);this.type="MeshBasicMaterial";this.color=new THREE.Color(16777215);this.envMap=this.alphaMap=this.specularMap=this.lightMap=this.map=null;this.combine=THREE.MultiplyOperation;this.reflectivity=1;this.refractionRatio=.98;this.fog=!0;this.shading=THREE.SmoothShading;this.wireframe=!1;this.wireframeLinewidth=1;this.wireframeLinejoin=this.wireframeLinecap="round";this.vertexColors=THREE.NoColors;this.morphTargets=this.skinning=!1;this.setValues(a)}; THREE.MeshBasicMaterial.prototype=Object.create(THREE.Material.prototype);THREE.MeshBasicMaterial.prototype.constructor=THREE.MeshBasicMaterial; THREE.MeshBasicMaterial.prototype.clone=function{var a=new THREE.MeshBasicMaterial;THREE.Material.prototype.clone.call(this,a);a.color.copy(this.color);a.map=this.map;a.lightMap=this.lightMap;a.specularMap=this.specularMap;a.alphaMap=this.alphaMap;a.envMap=this.envMap;a.combine=this.combine;a.reflectivity=this.reflectivity;a.refractionRatio=this.refractionRatio;a.fog=this.fog;a.shading=this.shading;a.wireframe=this.wireframe;a.wireframeLinewidth=this.wireframeLinewidth;a.wireframeLinecap=this.wireframeLinecap; a.wireframeLinejoin=this.wireframeLinejoin;a.vertexColors=this.vertexColors;a.skinning=this.skinning;a.morphTargets=this.morphTargets;return a}; THREE.MeshLambertMaterial=function(a){THREE.Material.call(this);this.type="MeshLambertMaterial";this.color=new THREE.Color(16777215);this.emissive=new THREE.Color(0);this.wrapAround=!1;this.wrapRGB=new THREE.Vector3(1,1,1);this.envMap=this.alphaMap=this.specularMap=this.lightMap=this.map=null;this.combine=THREE.MultiplyOperation;this.reflectivity=1;this.refractionRatio=.98;this.fog=!0;this.shading=THREE.SmoothShading;this.wireframe=!1;this.wireframeLinewidth=1;this.wireframeLinejoin=this.wireframeLinecap= "round";this.vertexColors=THREE.NoColors;this.morphNormals=this.morphTargets=this.skinning=!1;this.setValues(a)};THREE.MeshLambertMaterial.prototype=Object.create(THREE.Material.prototype);THREE.MeshLambertMaterial.prototype.constructor=THREE.MeshLambertMaterial; THREE.MeshLambertMaterial.prototype.clone=function{var a=new THREE.MeshLambertMaterial;THREE.Material.prototype.clone.call(this,a);a.color.copy(this.color);a.emissive.copy(this.emissive);a.wrapAround=this.wrapAround;a.wrapRGB.copy(this.wrapRGB);a.map=this.map;a.lightMap=this.lightMap;a.specularMap=this.specularMap;a.alphaMap=this.alphaMap;a.envMap=this.envMap;a.combine=this.combine;a.reflectivity=this.reflectivity;a.refractionRatio=this.refractionRatio;a.fog=this.fog;a.shading=this.shading;a.wireframe= this.wireframe;a.wireframeLinewidth=this.wireframeLinewidth;a.wireframeLinecap=this.wireframeLinecap;a.wireframeLinejoin=this.wireframeLinejoin;a.vertexColors=this.vertexColors;a.skinning=this.skinning;a.morphTargets=this.morphTargets;a.morphNormals=this.morphNormals;return a}; THREE.MeshPhongMaterial=function(a){THREE.Material.call(this);this.type="MeshPhongMaterial";this.color=new THREE.Color(16777215);this.emissive=new THREE.Color(0);this.specular=new THREE.Color(1118481);this.shininess=30;this.wrapAround=this.metal=!1;this.wrapRGB=new THREE.Vector3(1,1,1);this.bumpMap=this.lightMap=this.map=null;this.bumpScale=1;this.normalMap=null;this.normalScale=new THREE.Vector2(1,1);this.envMap=this.alphaMap=this.specularMap=null;this.combine=THREE.MultiplyOperation;this.reflectivity= 1;this.refractionRatio=.98;this.fog=!0;this.shading=THREE.SmoothShading;this.wireframe=!1;this.wireframeLinewidth=1;this.wireframeLinejoin=this.wireframeLinecap="round";this.vertexColors=THREE.NoColors;this.morphNormals=this.morphTargets=this.skinning=!1;this.setValues(a)};THREE.MeshPhongMaterial.prototype=Object.create(THREE.Material.prototype);THREE.MeshPhongMaterial.prototype.constructor=THREE.MeshPhongMaterial; THREE.MeshPhongMaterial.prototype.clone=function{var a=new THREE.MeshPhongMaterial;THREE.Material.prototype.clone.call(this,a);a.color.copy(this.color);a.emissive.copy(this.emissive);a.specular.copy(this.specular);a.shininess=this.shininess;a.metal=this.metal;a.wrapAround=this.wrapAround;a.wrapRGB.copy(this.wrapRGB);a.map=this.map;a.lightMap=this.lightMap;a.bumpMap=this.bumpMap;a.bumpScale=this.bumpScale;a.normalMap=this.normalMap;a.normalScale.copy(this.normalScale);a.specularMap=this.specularMap; a.alphaMap=this.alphaMap;a.envMap=this.envMap;a.combine=this.combine;a.reflectivity=this.reflectivity;a.refractionRatio=this.refractionRatio;a.fog=this.fog;a.shading=this.shading;a.wireframe=this.wireframe;a.wireframeLinewidth=this.wireframeLinewidth;a.wireframeLinecap=this.wireframeLinecap;a.wireframeLinejoin=this.wireframeLinejoin;a.vertexColors=this.vertexColors;a.skinning=this.skinning;a.morphTargets=this.morphTargets;a.morphNormals=this.morphNormals;return a}; THREE.MeshDepthMaterial=function(a){THREE.Material.call(this);this.type="MeshDepthMaterial";this.wireframe=this.morphTargets=!1;this.wireframeLinewidth=1;this.setValues(a)};THREE.MeshDepthMaterial.prototype=Object.create(THREE.Material.prototype);THREE.MeshDepthMaterial.prototype.constructor=THREE.MeshDepthMaterial; THREE.MeshDepthMaterial.prototype.clone=function{var a=new THREE.MeshDepthMaterial;THREE.Material.prototype.clone.call(this,a);a.wireframe=this.wireframe;a.wireframeLinewidth=this.wireframeLinewidth;return a};THREE.MeshNormalMaterial=function(a){THREE.Material.call(this,a);this.type="MeshNormalMaterial";this.wireframe=!1;this.wireframeLinewidth=1;this.morphTargets=!1;this.setValues(a)};THREE.MeshNormalMaterial.prototype=Object.create(THREE.Material.prototype); THREE.MeshNormalMaterial.prototype.constructor=THREE.MeshNormalMaterial;THREE.MeshNormalMaterial.prototype.clone=function{var a=new THREE.MeshNormalMaterial;THREE.Material.prototype.clone.call(this,a);a.wireframe=this.wireframe;a.wireframeLinewidth=this.wireframeLinewidth;return a};THREE.MeshFaceMaterial=function(a){this.uuid=THREE.Math.generateUUID;this.type="MeshFaceMaterial";this.materials=a instanceof Array?a:[]}; THREE.MeshFaceMaterial.prototype={constructor:THREE.MeshFaceMaterial,toJSON:function{for(var a={metadata:{version:4.2,type:"material",generator:"MaterialExporter"},uuid:this.uuid,type:this.type,materials:[]},b=0,c=this.materials.length;b<c;b++)a.materials.push(this.materials[b].toJSON);return a},clone:function{for(var a=new THREE.MeshFaceMaterial,b=0;b<this.materials.length;b++)a.materials.push(this.materials[b].clone);return a}}; THREE.PointCloudMaterial=function(a){THREE.Material.call(this);this.type="PointCloudMaterial";this.color=new THREE.Color(16777215);this.map=null;this.size=1;this.sizeAttenuation=!0;this.vertexColors=THREE.NoColors;this.fog=!0;this.setValues(a)};THREE.PointCloudMaterial.prototype=Object.create(THREE.Material.prototype);THREE.PointCloudMaterial.prototype.constructor=THREE.PointCloudMaterial; THREE.PointCloudMaterial.prototype.clone=function{var a=new THREE.PointCloudMaterial;THREE.Material.prototype.clone.call(this,a);a.color.copy(this.color);a.map=this.map;a.size=this.size;a.sizeAttenuation=this.sizeAttenuation;a.vertexColors=this.vertexColors;a.fog=this.fog;return a};THREE.ParticleBasicMaterial=function(a){THREE.warn("THREE.ParticleBasicMaterial has been renamed to THREE.PointCloudMaterial.");return new THREE.PointCloudMaterial(a)}; THREE.ParticleSystemMaterial=function(a){THREE.warn("THREE.ParticleSystemMaterial has been renamed to THREE.PointCloudMaterial.");return new THREE.PointCloudMaterial(a)}; THREE.ShaderMaterial=function(a){THREE.Material.call(this);this.type="ShaderMaterial";this.defines={};this.uniforms={};this.attributes=null;this.vertexShader="void main {\n\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}";this.fragmentShader="void main {\n\tgl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );\n}";this.shading=THREE.SmoothShading;this.linewidth=1;this.wireframe=!1;this.wireframeLinewidth=1;this.lights=this.fog=!1;this.vertexColors=THREE.NoColors;this.morphNormals= this.morphTargets=this.skinning=!1;this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv2:[0,0]};this.index0AttributeName=void 0;this.setValues(a)};THREE.ShaderMaterial.prototype=Object.create(THREE.Material.prototype);THREE.ShaderMaterial.prototype.constructor=THREE.ShaderMaterial; THREE.ShaderMaterial.prototype.clone=function{var a=new THREE.ShaderMaterial;THREE.Material.prototype.clone.call(this,a);a.fragmentShader=this.fragmentShader;a.vertexShader=this.vertexShader;a.uniforms=THREE.UniformsUtils.clone(this.uniforms);a.attributes=this.attributes;a.defines=this.defines;a.shading=this.shading;a.wireframe=this.wireframe;a.wireframeLinewidth=this.wireframeLinewidth;a.fog=this.fog;a.lights=this.lights;a.vertexColors=this.vertexColors;a.skinning=this.skinning;a.morphTargets= this.morphTargets;a.morphNormals=this.morphNormals;return a};THREE.RawShaderMaterial=function(a){THREE.ShaderMaterial.call(this,a);this.type="RawShaderMaterial"};THREE.RawShaderMaterial.prototype=Object.create(THREE.ShaderMaterial.prototype);THREE.RawShaderMaterial.prototype.constructor=THREE.RawShaderMaterial;THREE.RawShaderMaterial.prototype.clone=function{var a=new THREE.RawShaderMaterial;THREE.ShaderMaterial.prototype.clone.call(this,a);return a}; THREE.SpriteMaterial=function(a){THREE.Material.call(this);this.type="SpriteMaterial";this.color=new THREE.Color(16777215);this.map=null;this.rotation=0;this.fog=!1;this.setValues(a)};THREE.SpriteMaterial.prototype=Object.create(THREE.Material.prototype);THREE.SpriteMaterial.prototype.constructor=THREE.SpriteMaterial; THREE.SpriteMaterial.prototype.clone=function{var a=new THREE.SpriteMaterial;THREE.Material.prototype.clone.call(this,a);a.color.copy(this.color);a.map=this.map;a.rotation=this.rotation;a.fog=this.fog;return a}; THREE.Texture=function(a,b,c,d,e,f,g,h,k){Object.defineProperty(this,"id",{value:THREE.TextureIdCount++});this.uuid=THREE.Math.generateUUID;this.sourceFile=this.name="";this.image=void 0!==a?a:THREE.Texture.DEFAULT_IMAGE;this.mipmaps=[];this.mapping=void 0!==b?b:THREE.Texture.DEFAULT_MAPPING;this.wrapS=void 0!==c?c:THREE.ClampToEdgeWrapping;this.wrapT=void 0!==d?d:THREE.ClampToEdgeWrapping;this.magFilter=void 0!==e?e:THREE.LinearFilter;this.minFilter=void 0!==f?f:THREE.LinearMipMapLinearFilter; this.anisotropy=void 0!==k?k:1;this.format=void 0!==g?g:THREE.RGBAFormat;this.type=void 0!==h?h:THREE.UnsignedByteType;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.generateMipmaps=!0;this.premultiplyAlpha=!1;this.flipY=!0;this.unpackAlignment=4;this._needsUpdate=!1;this.onUpdate=null};THREE.Texture.DEFAULT_IMAGE=void 0;THREE.Texture.DEFAULT_MAPPING=THREE.UVMapping; THREE.Texture.prototype={constructor:THREE.Texture,get needsUpdate{return this._needsUpdate},set needsUpdate(a){!0===a&&this.update;this._needsUpdate=a},clone:function(a){void 0===a&&(a=new THREE.Texture);a.image=this.image;a.mipmaps=this.mipmaps.slice(0);a.mapping=this.mapping;a.wrapS=this.wrapS;a.wrapT=this.wrapT;a.magFilter=this.magFilter;a.minFilter=this.minFilter;a.anisotropy=this.anisotropy;a.format=this.format;a.type=this.type;a.offset.copy(this.offset);a.repeat.copy(this.repeat);a.generateMipmaps= this.generateMipmaps;a.premultiplyAlpha=this.premultiplyAlpha;a.flipY=this.flipY;a.unpackAlignment=this.unpackAlignment;return a},update:function{this.dispatchEvent({type:"update"})},dispose:function{this.dispatchEvent({type:"dispose"})}};THREE.EventDispatcher.prototype.apply(THREE.Texture.prototype);THREE.TextureIdCount=0;THREE.CubeTexture=function(a,b,c,d,e,f,g,h,k){b=void 0!==b?b:THREE.CubeReflectionMapping;THREE.Texture.call(this,a,b,c,d,e,f,g,h,k);this.images=a}; THREE.CubeTexture.prototype=Object.create(THREE.Texture.prototype);THREE.CubeTexture.prototype.constructor=THREE.CubeTexture;THREE.CubeTexture.clone=function(a){void 0===a&&(a=new THREE.CubeTexture);THREE.Texture.prototype.clone.call(this,a);a.images=this.images;return a};THREE.CompressedTexture=function(a,b,c,d,e,f,g,h,k,l,p){THREE.Texture.call(this,null,f,g,h,k,l,d,e,p);this.image={width:b,height:c};this.mipmaps=a;this.generateMipmaps=this.flipY=!1};THREE.CompressedTexture.prototype=Object.create(THREE.Texture.prototype); THREE.CompressedTexture.prototype.constructor=THREE.CompressedTexture;THREE.CompressedTexture.prototype.clone=function{var a=new THREE.CompressedTexture;THREE.Texture.prototype.clone.call(this,a);return a};THREE.DataTexture=function(a,b,c,d,e,f,g,h,k,l,p){THREE.Texture.call(this,null,f,g,h,k,l,d,e,p);this.image={data:a,width:b,height:c}};THREE.DataTexture.prototype=Object.create(THREE.Texture.prototype);THREE.DataTexture.prototype.constructor=THREE.DataTexture; THREE.DataTexture.prototype.clone=function{var a=new THREE.DataTexture;THREE.Texture.prototype.clone.call(this,a);return a};THREE.VideoTexture=function(a,b,c,d,e,f,g,h,k){THREE.Texture.call(this,a,b,c,d,e,f,g,h,k);this.generateMipmaps=!1;var l=this,p=function{requestAnimationFrame(p);a.readyState===a.HAVE_ENOUGH_DATA&&(l.needsUpdate=!0)};p};THREE.VideoTexture.prototype=Object.create(THREE.Texture.prototype);THREE.VideoTexture.prototype.constructor=THREE.VideoTexture; THREE.Group=function{THREE.Object3D.call(this);this.type="Group"};THREE.Group.prototype=Object.create(THREE.Object3D.prototype);THREE.Group.prototype.constructor=THREE.Group;THREE.PointCloud=function(a,b){THREE.Object3D.call(this);this.type="PointCloud";this.geometry=void 0!==a?a:new THREE.Geometry;this.material=void 0!==b?b:new THREE.PointCloudMaterial({color:16777215*Math.random})};THREE.PointCloud.prototype=Object.create(THREE.Object3D.prototype);THREE.PointCloud.prototype.constructor=THREE.PointCloud; THREE.PointCloud.prototype.raycast=function{var a=new THREE.Matrix4,b=new THREE.Ray;return function(c,d){var e=this,f=e.geometry,g=c.params.PointCloud.threshold;a.getInverse(this.matrixWorld);b.copy(c.ray).applyMatrix4(a);if(null===f.boundingBox||!1!==b.isIntersectionBox(f.boundingBox)){var h=g/((this.scale.x+this.scale.y+this.scale.z)/3),k=new THREE.Vector3,g=function(a,f){var g=b.distanceToPoint(a);if(g<h){var k=b.closestPointToPoint(a);k.applyMatrix4(e.matrixWorld);var n=c.ray.origin.distanceTo(k); d.push({distance:n,distanceToRay:g,point:k.clone,index:f,face:null,object:e})}};if(f instanceof THREE.BufferGeometry){var l=f.attributes,p=l.position.array;if(void 0!==l.index){var l=l.index.array,q=f.offsets;0===q.length&&(q=[{start:0,count:l.length,index:0}]);for(var n=0,t=q.length;n<t;++n)for(var r=q[n].start,s=q[n].index,f=r,r=r+q[n].count;f<r;f++){var u=s+l[f];k.fromArray(p,3*u);g(k,u)}}else for(l=p.length/3,f=0;f<l;f++)k.set(p[3*f],p[3*f+1],p[3*f+2]),g(k,f)}else for(k=this.geometry.vertices, f=0;f<k.length;f++)g(k[f],f)}}};THREE.PointCloud.prototype.clone=function(a){void 0===a&&(a=new THREE.PointCloud(this.geometry,this.material));THREE.Object3D.prototype.clone.call(this,a);return a};THREE.ParticleSystem=function(a,b){THREE.warn("THREE.ParticleSystem has been renamed to THREE.PointCloud.");return new THREE.PointCloud(a,b)}; THREE.Line=function(a,b,c){THREE.Object3D.call(this);this.type="Line";this.geometry=void 0!==a?a:new THREE.Geometry;this.material=void 0!==b?b:new THREE.LineBasicMaterial({color:16777215*Math.random});this.mode=void 0!==c?c:THREE.LineStrip};THREE.LineStrip=0;THREE.LinePieces=1;THREE.Line.prototype=Object.create(THREE.Object3D.prototype);THREE.Line.prototype.constructor=THREE.Line; THREE.Line.prototype.raycast=function{var a=new THREE.Matrix4,b=new THREE.Ray,c=new THREE.Sphere;return function(d,e){var f=d.linePrecision,f=f*f,g=this.geometry;null===g.boundingSphere&&g.computeBoundingSphere;c.copy(g.boundingSphere);c.applyMatrix4(this.matrixWorld);if(!1!==d.ray.isIntersectionSphere(c)){a.getInverse(this.matrixWorld);b.copy(d.ray).applyMatrix4(a);var h=new THREE.Vector3,k=new THREE.Vector3,l=new THREE.Vector3,p=new THREE.Vector3,q=this.mode===THREE.LineStrip?1:2;if(g instanceof THREE.BufferGeometry){var n=g.attributes;if(void 0!==n.index){var t=n.index.array,n=n.position.array,r=g.offsets;0===r.length&&(r=[{start:0,count:t.length,index:0}]);for(var s=0;s<r.length;s++)for(var u=r[s].start,v=r[s].count,x=r[s].index,g=u;g<u+v-1;g+=q){var D=x+t[g+1];h.fromArray(n,3*(x+t[g]));k.fromArray(n,3*D);D=b.distanceSqToSegment(h,k,p,l);D>f||(D=b.origin.distanceTo(p),D<d.near||D>d.far||e.push({distance:D,point:l.clone.applyMatrix4(this.matrixWorld),index:g,offsetIndex:s,face:null,faceIndex:null, object:this}))}}else for(n=n.position.array,g=0;g<n.length/3-1;g+=q)h.fromArray(n,3*g),k.fromArray(n,3*g+3),D=b.distanceSqToSegment(h,k,p,l),D>f||(D=b.origin.distanceTo(p),D<d.near||D>d.far||e.push({distance:D,point:l.clone.applyMatrix4(this.matrixWorld),index:g,face:null,faceIndex:null,object:this}))}else if(g instanceof THREE.Geometry)for(h=g.vertices,k=h.length,g=0;g<k-1;g+=q)D=b.distanceSqToSegment(h[g],h[g+1],p,l),D>f||(D=b.origin.distanceTo(p),D<d.near||D>d.far||e.push({distance:D,point:l.clone.applyMatrix4(this.matrixWorld), index:g,face:null,faceIndex:null,object:this}))}}};THREE.Line.prototype.clone=function(a){void 0===a&&(a=new THREE.Line(this.geometry,this.material,this.mode));THREE.Object3D.prototype.clone.call(this,a);return a};THREE.Mesh=function(a,b){THREE.Object3D.call(this);this.type="Mesh";this.geometry=void 0!==a?a:new THREE.Geometry;this.material=void 0!==b?b:new THREE.MeshBasicMaterial({color:16777215*Math.random});this.updateMorphTargets};THREE.Mesh.prototype=Object.create(THREE.Object3D.prototype); THREE.Mesh.prototype.constructor=THREE.Mesh;THREE.Mesh.prototype.updateMorphTargets=function{if(void 0!==this.geometry.morphTargets&&0<this.geometry.morphTargets.length){this.morphTargetBase=-1;this.morphTargetForcedOrder=[];this.morphTargetInfluences=[];this.morphTargetDictionary={};for(var a=0,b=this.geometry.morphTargets.length;a<b;a++)this.morphTargetInfluences.push(0),this.morphTargetDictionary[this.geometry.morphTargets[a].name]=a}}; THREE.Mesh.prototype.getMorphTargetIndexByName=function(a){if(void 0!==this.morphTargetDictionary[a])return this.morphTargetDictionary[a];THREE.warn("THREE.Mesh.getMorphTargetIndexByName: morph target "+a+" does not exist. Returning 0.");return 0}; THREE.Mesh.prototype.raycast=function{var a=new THREE.Matrix4,b=new THREE.Ray,c=new THREE.Sphere,d=new THREE.Vector3,e=new THREE.Vector3,f=new THREE.Vector3;return function(g,h){var k=this.geometry;null===k.boundingSphere&&k.computeBoundingSphere;c.copy(k.boundingSphere);c.applyMatrix4(this.matrixWorld);if(!1!==g.ray.isIntersectionSphere(c)&&(a.getInverse(this.matrixWorld),b.copy(g.ray).applyMatrix4(a),null===k.boundingBox||!1!==b.isIntersectionBox(k.boundingBox)))if(k instanceof THREE.BufferGeometry){var l= this.material;if(void 0!==l){var p=k.attributes,q,n,t=g.precision;if(void 0!==p.index){var r=p.index.array,s=p.position.array,u=k.offsets;0===u.length&&(u=[{start:0,count:r.length,index:0}]);for(var v=0,x=u.length;v<x;++v)for(var p=u[v].start,D=u[v].index,k=p,w=p+u[v].count;k<w;k+=3){p=D+r[k];q=D+r[k+1];n=D+r[k+2];d.fromArray(s,3*p);e.fromArray(s,3*q);f.fromArray(s,3*n);var y=l.side===THREE.BackSide?b.intersectTriangle(f,e,d,!0):b.intersectTriangle(d,e,f,l.side!==THREE.DoubleSide);if(null!==y){y.applyMatrix4(this.matrixWorld); var A=g.ray.origin.distanceTo(y);A<t||A<g.near||A>g.far||h.push({distance:A,point:y,face:new THREE.Face3(p,q,n,THREE.Triangle.normal(d,e,f)),faceIndex:null,object:this})}}}else for(s=p.position.array,r=k=0,w=s.length;k<w;k+=3,r+=9)p=k,q=k+1,n=k+2,d.fromArray(s,r),e.fromArray(s,r+3),f.fromArray(s,r+6),y=l.side===THREE.BackSide?b.intersectTriangle(f,e,d,!0):b.intersectTriangle(d,e,f,l.side!==THREE.DoubleSide),null!==y&&(y.applyMatrix4(this.matrixWorld),A=g.ray.origin.distanceTo(y),A<t||A<g.near||A> g.far||h.push({distance:A,point:y,face:new THREE.Face3(p,q,n,THREE.Triangle.normal(d,e,f)),faceIndex:null,object:this}))}}else if(k instanceof THREE.Geometry)for(r=this.material instanceof THREE.MeshFaceMaterial,s=!0===r?this.material.materials:null,t=g.precision,u=k.vertices,v=0,x=k.faces.length;v<x;v++)if(D=k.faces[v],l=!0===r?s[D.materialIndex]:this.material,void 0!==l){p=u[D.a];q=u[D.b];n=u[D.c];if(!0===l.morphTargets){y=k.morphTargets;A=this.morphTargetInfluences;d.set(0,0,0);e.set(0,0,0);f.set(0, 0,0);for(var w=0,E=y.length;w<E;w++){var G=A[w];if(0!==G){var F=y[w].vertices;d.x+=(F[D.a].x-p.x)*G;d.y+=(F[D.a].y-p.y)*G;d.z+=(F[D.a].z-p.z)*G;e.x+=(F[D.b].x-q.x)*G;e.y+=(F[D.b].y-q.y)*G;e.z+=(F[D.b].z-q.z)*G;f.x+=(F[D.c].x-n.x)*G;f.y+=(F[D.c].y-n.y)*G;f.z+=(F[D.c].z-n.z)*G}}d.add(p);e.add(q);f.add(n);p=d;q=e;n=f}y=l.side===THREE.BackSide?b.intersectTriangle(n,q,p,!0):b.intersectTriangle(p,q,n,l.side!==THREE.DoubleSide);null!==y&&(y.applyMatrix4(this.matrixWorld),A=g.ray.origin.distanceTo(y),A<t|| A<g.near||A>g.far||h.push({distance:A,point:y,face:D,faceIndex:v,object:this}))}}};THREE.Mesh.prototype.clone=function(a,b){void 0===a&&(a=new THREE.Mesh(this.geometry,this.material));THREE.Object3D.prototype.clone.call(this,a,b);return a};THREE.Bone=function(a){THREE.Object3D.call(this);this.type="Bone";this.skin=a};THREE.Bone.prototype=Object.create(THREE.Object3D.prototype);THREE.Bone.prototype.constructor=THREE.Bone; THREE.Skeleton=function(a,b,c){this.useVertexTexture=void 0!==c?c:!0;this.identityMatrix=new THREE.Matrix4;a=a||[];this.bones=a.slice(0);this.useVertexTexture?(this.boneTextureHeight=this.boneTextureWidth=a=256<this.bones.length?64:64<this.bones.length?32:16<this.bones.length?16:8,this.boneMatrices=new Float32Array(this.boneTextureWidth*this.boneTextureHeight*4),this.boneTexture=new THREE.DataTexture(this.boneMatrices,this.boneTextureWidth,this.boneTextureHeight,THREE.RGBAFormat,THREE.FloatType), this.boneTexture.minFilter=THREE.NearestFilter,this.boneTexture.magFilter=THREE.NearestFilter,this.boneTexture.generateMipmaps=!1,this.boneTexture.flipY=!1):this.boneMatrices=new Float32Array(16*this.bones.length);if(void 0===b)this.calculateInverses;else if(this.bones.length===b.length)this.boneInverses=b.slice(0);else for(THREE.warn("THREE.Skeleton bonInverses is the wrong length."),this.boneInverses=[],b=0,a=this.bones.length;b<a;b++)this.boneInverses.push(new THREE.Matrix4)}; THREE.Skeleton.prototype.calculateInverses=function{this.boneInverses=[];for(var a=0,b=this.bones.length;a<b;a++){var c=new THREE.Matrix4;this.bones[a]&&c.getInverse(this.bones[a].matrixWorld);this.boneInverses.push(c)}}; THREE.Skeleton.prototype.pose=function{for(var a,b=0,c=this.bones.length;b<c;b++)(a=this.bones[b])&&a.matrixWorld.getInverse(this.boneInverses[b]);b=0;for(c=this.bones.length;b<c;b++)if(a=this.bones[b])a.parent?(a.matrix.getInverse(a.parent.matrixWorld),a.matrix.multiply(a.matrixWorld)):a.matrix.copy(a.matrixWorld),a.matrix.decompose(a.position,a.quaternion,a.scale)}; THREE.Skeleton.prototype.update=function{var a=new THREE.Matrix4;return function{for(var b=0,c=this.bones.length;b<c;b++)a.multiplyMatrices(this.bones[b]?this.bones[b].matrixWorld:this.identityMatrix,this.boneInverses[b]),a.flattenToArrayOffset(this.boneMatrices,16*b);this.useVertexTexture&&(this.boneTexture.needsUpdate=!0)}}; THREE.SkinnedMesh=function(a,b,c){THREE.Mesh.call(this,a,b);this.type="SkinnedMesh";this.bindMode="attached";this.bindMatrix=new THREE.Matrix4;this.bindMatrixInverse=new THREE.Matrix4;a=[];if(this.geometry&&void 0!==this.geometry.bones){for(var d,e,f,g,h=0,k=this.geometry.bones.length;h<k;++h)d=this.geometry.bones[h],e=d.pos,f=d.rotq,g=d.scl,b=new THREE.Bone(this),a.push(b),b.name=d.name,b.position.set(e[0],e[1],e[2]),b.quaternion.set(f[0],f[1],f[2],f[3]),void 0!==g?b.scale.set(g[0],g[1],g[2]):b.scale.set(1, 1,1);h=0;for(k=this.geometry.bones.length;h<k;++h)d=this.geometry.bones[h],-1!==d.parent?a[d.parent].add(a[h]):this.add(a[h])}this.normalizeSkinWeights;this.updateMatrixWorld(!0);this.bind(new THREE.Skeleton(a,void 0,c))};THREE.SkinnedMesh.prototype=Object.create(THREE.Mesh.prototype);THREE.SkinnedMesh.prototype.constructor=THREE.SkinnedMesh;THREE.SkinnedMesh.prototype.bind=function(a,b){this.skeleton=a;void 0===b&&(this.updateMatrixWorld(!0),b=this.matrixWorld);this.bindMatrix.copy(b);this.bindMatrixInverse.getInverse(b)}; THREE.SkinnedMesh.prototype.pose=function{this.skeleton.pose};THREE.SkinnedMesh.prototype.normalizeSkinWeights=function{if(this.geometry instanceof THREE.Geometry)for(var a=0;a<this.geometry.skinIndices.length;a++){var b=this.geometry.skinWeights[a],c=1/b.lengthManhattan;Infinity!==c?b.multiplyScalar(c):b.set(1)}}; THREE.SkinnedMesh.prototype.updateMatrixWorld=function(a){THREE.Mesh.prototype.updateMatrixWorld.call(this,!0);"attached"===this.bindMode?this.bindMatrixInverse.getInverse(this.matrixWorld):"detached"===this.bindMode?this.bindMatrixInverse.getInverse(this.bindMatrix):THREE.warn("THREE.SkinnedMesh unreckognized bindMode: "+this.bindMode)}; THREE.SkinnedMesh.prototype.clone=function(a){void 0===a&&(a=new THREE.SkinnedMesh(this.geometry,this.material,this.useVertexTexture));THREE.Mesh.prototype.clone.call(this,a);return a};THREE.MorphAnimMesh=function(a,b){THREE.Mesh.call(this,a,b);this.type="MorphAnimMesh";this.duration=1E3;this.mirroredLoop=!1;this.currentKeyframe=this.lastKeyframe=this.time=0;this.direction=1;this.directionBackwards=!1;this.setFrameRange(0,this.geometry.morphTargets.length-1)};THREE.MorphAnimMesh.prototype=Object.create(THREE.Mesh.prototype); THREE.MorphAnimMesh.prototype.constructor=THREE.MorphAnimMesh;THREE.MorphAnimMesh.prototype.setFrameRange=function(a,b){this.startKeyframe=a;this.endKeyframe=b;this.length=this.endKeyframe-this.startKeyframe+1};THREE.MorphAnimMesh.prototype.setDirectionForward=function{this.direction=1;this.directionBackwards=!1};THREE.MorphAnimMesh.prototype.setDirectionBackward=function{this.direction=-1;this.directionBackwards=!0}; THREE.MorphAnimMesh.prototype.parseAnimations=function{var a=this.geometry;a.animations||(a.animations={});for(var b,c=a.animations,d=/([a-z]+)_?(\d+)/,e=0,f=a.morphTargets.length;e<f;e++){var g=a.morphTargets[e].name.match(d);if(g&&1<g.length){g=g[1];c[g]||(c[g]={start:Infinity,end:-Infinity});var h=c[g];e<h.start&&(h.start=e);e>h.end&&(h.end=e);b||(b=g)}}a.firstAnimation=b}; THREE.MorphAnimMesh.prototype.setAnimationLabel=function(a,b,c){this.geometry.animations||(this.geometry.animations={});this.geometry.animations[a]={start:b,end:c}};THREE.MorphAnimMesh.prototype.playAnimation=function(a,b){var c=this.geometry.animations[a];c?(this.setFrameRange(c.start,c.end),this.duration=(c.end-c.start)/b*1E3,this.time=0):THREE.warn("THREE.MorphAnimMesh: animation["+a+"] undefined in .playAnimation")}; THREE.MorphAnimMesh.prototype.updateAnimation=function(a){var b=this.duration/this.length;this.time+=this.direction*a;if(this.mirroredLoop){if(this.time>this.duration||0>this.time)this.direction*=-1,this.time>this.duration&&(this.time=this.duration,this.directionBackwards=!0),0>this.time&&(this.time=0,this.directionBackwards=!1)}else this.time%=this.duration,0>this.time&&(this.time+=this.duration);a=this.startKeyframe+THREE.Math.clamp(Math.floor(this.time/b),0,this.length-1);a!==this.currentKeyframe&& (this.morphTargetInfluences[this.lastKeyframe]=0,this.morphTargetInfluences[this.currentKeyframe]=1,this.morphTargetInfluences[a]=0,this.lastKeyframe=this.currentKeyframe,this.currentKeyframe=a);b=this.time%b/b;this.directionBackwards&&(b=1-b);this.morphTargetInfluences[this.currentKeyframe]=b;this.morphTargetInfluences[this.lastKeyframe]=1-b}; THREE.MorphAnimMesh.prototype.interpolateTargets=function(a,b,c){for(var d=this.morphTargetInfluences,e=0,f=d.length;e<f;e++)d[e]=0;-1<a&&(d[a]=1-c);-1<b&&(d[b]=c)}; THREE.MorphAnimMesh.prototype.clone=function(a){void 0===a&&(a=new THREE.MorphAnimMesh(this.geometry,this.material));a.duration=this.duration;a.mirroredLoop=this.mirroredLoop;a.time=this.time;a.lastKeyframe=this.lastKeyframe;a.currentKeyframe=this.currentKeyframe;a.direction=this.direction;a.directionBackwards=this.directionBackwards;THREE.Mesh.prototype.clone.call(this,a);return a};THREE.LOD=function{THREE.Object3D.call(this);this.objects=[]};THREE.LOD.prototype=Object.create(THREE.Object3D.prototype); THREE.LOD.prototype.constructor=THREE.LOD;THREE.LOD.prototype.addLevel=function(a,b){void 0===b&&(b=0);b=Math.abs(b);for(var c=0;c<this.objects.length&&!(b<this.objects[c].distance);c++);this.objects.splice(c,0,{distance:b,object:a});this.add(a)};THREE.LOD.prototype.getObjectForDistance=function(a){for(var b=1,c=this.objects.length;b<c&&!(a<this.objects[b].distance);b++);return this.objects[b-1].object}; THREE.LOD.prototype.raycast=function{var a=new THREE.Vector3;return function(b,c){a.setFromMatrixPosition(this.matrixWorld);var d=b.ray.origin.distanceTo(a);this.getObjectForDistance(d).raycast(b,c)}}; THREE.LOD.prototype.update=function{var a=new THREE.Vector3,b=new THREE.Vector3;return function(c){if(1<this.objects.length){a.setFromMatrixPosition(c.matrixWorld);b.setFromMatrixPosition(this.matrixWorld);c=a.distanceTo(b);this.objects[0].object.visible=!0;for(var d=1,e=this.objects.length;d<e;d++)if(c>=this.objects[d].distance)this.objects[d-1].object.visible=!1,this.objects[d].object.visible=!0;else break;for(d<e;d++)this.objects[d].object.visible=!1}}}; THREE.LOD.prototype.clone=function(a){void 0===a&&(a=new THREE.LOD);THREE.Object3D.prototype.clone.call(this,a);for(var b=0,c=this.objects.length;b<c;b++){var d=this.objects[b].object.clone;d.visible=0===b;a.addLevel(d,this.objects[b].distance)}return a}; THREE.Sprite=function{var a=new Uint16Array([0,1,2,0,2,3]),b=new Float32Array([-.5,-.5,0,.5,-.5,0,.5,.5,0,-.5,.5,0]),c=new Float32Array([0,0,1,0,1,1,0,1]),d=new THREE.BufferGeometry;d.addAttribute("index",new THREE.BufferAttribute(a,1));d.addAttribute("position",new THREE.BufferAttribute(b,3));d.addAttribute("uv",new THREE.BufferAttribute(c,2));return function(a){THREE.Object3D.call(this);this.type="Sprite";this.geometry=d;this.material=void 0!==a?a:new THREE.SpriteMaterial}}; THREE.Sprite.prototype=Object.create(THREE.Object3D.prototype);THREE.Sprite.prototype.constructor=THREE.Sprite;THREE.Sprite.prototype.raycast=function{var a=new THREE.Vector3;return function(b,c){a.setFromMatrixPosition(this.matrixWorld);var d=b.ray.distanceToPoint(a);d>this.scale.x||c.push({distance:d,point:this.position,face:null,object:this})}};THREE.Sprite.prototype.clone=function(a){void 0===a&&(a=new THREE.Sprite(this.material));THREE.Object3D.prototype.clone.call(this,a);return a}; THREE.Particle=THREE.Sprite;THREE.LensFlare=function(a,b,c,d,e){THREE.Object3D.call(this);this.lensFlares=[];this.positionScreen=new THREE.Vector3;this.customUpdateCallback=void 0;void 0!==a&&this.add(a,b,c,d,e)};THREE.LensFlare.prototype=Object.create(THREE.Object3D.prototype);THREE.LensFlare.prototype.constructor=THREE.LensFlare; THREE.LensFlare.prototype.add=function(a,b,c,d,e,f){void 0===b&&(b=-1);void 0===c&&(c=0);void 0===f&&(f=1);void 0===e&&(e=new THREE.Color(16777215));void 0===d&&(d=THREE.NormalBlending);c=Math.min(c,Math.max(0,c));this.lensFlares.push({texture:a,size:b,distance:c,x:0,y:0,z:0,scale:1,rotation:1,opacity:f,color:e,blending:d})}; THREE.LensFlare.prototype.updateLensFlares=function{var a,b=this.lensFlares.length,c,d=2*-this.positionScreen.x,e=2*-this.positionScreen.y;for(a=0;a<b;a++)c=this.lensFlares[a],c.x=this.positionScreen.x+d*c.distance,c.y=this.positionScreen.y+e*c.distance,c.wantedRotation=c.x*Math.PI*.25,c.rotation+=.25*(c.wantedRotation-c.rotation)};THREE.Scene=function{THREE.Object3D.call(this);this.type="Scene";this.overrideMaterial=this.fog=null;this.autoUpdate=!0};THREE.Scene.prototype=Object.create(THREE.Object3D.prototype); THREE.Scene.prototype.constructor=THREE.Scene;THREE.Scene.prototype.clone=function(a){void 0===a&&(a=new THREE.Scene);THREE.Object3D.prototype.clone.call(this,a);null!==this.fog&&(a.fog=this.fog.clone);null!==this.overrideMaterial&&(a.overrideMaterial=this.overrideMaterial.clone);a.autoUpdate=this.autoUpdate;a.matrixAutoUpdate=this.matrixAutoUpdate;return a};THREE.Fog=function(a,b,c){this.name="";this.color=new THREE.Color(a);this.near=void 0!==b?b:1;this.far=void 0!==c?c:1E3}; THREE.Fog.prototype.clone=function{return new THREE.Fog(this.color.getHex,this.near,this.far)};THREE.FogExp2=function(a,b){this.name="";this.color=new THREE.Color(a);this.density=void 0!==b?b:2.5E-4};THREE.FogExp2.prototype.clone=function{return new THREE.FogExp2(this.color.getHex,this.density)};THREE.ShaderChunk={};THREE.ShaderChunk.common="#define PI 3.14159\n#define PI2 6.28318\n#define RECIPROCAL_PI2 0.15915494\n#define LOG2 1.442695\n#define EPSILON 1e-6\n\nfloat square( in float a ) { return a*a; }\nvec2 square( in vec2 a )  { return vec2( a.x*a.x, a.y*a.y ); }\nvec3  square( in vec3 a )  { return vec3( a.x*a.x, a.y*a.y, a.z*a.z ); }\nvec4  square( in vec4 a )  { return vec4( a.x*a.x, a.y*a.y, a.z*a.z, a.w*a.w ); }\nfloat saturate( in float a ) { return clamp( a, 0.0, 1.0 ); }\nvec2  saturate( in vec2 a )  { return clamp( a, 0.0, 1.0 ); }\nvec3  saturate( in vec3 a )  { return clamp( a, 0.0, 1.0 ); }\nvec4  saturate( in vec4 a )  { return clamp( a, 0.0, 1.0 ); }\nfloat average( in float a ) { return a; }\nfloat average( in vec2 a )  { return ( a.x + a.y) * 0.5; }\nfloat average( in vec3 a )  { return ( a.x + a.y + a.z) / 3.0; }\nfloat average( in vec4 a )  { return ( a.x + a.y + a.z + a.w) * 0.25; }\nfloat whiteCompliment( in float a ) { return saturate( 1.0 - a ); }\nvec2  whiteCompliment( in vec2 a )  { return saturate( vec2(1.0) - a ); }\nvec3  whiteCompliment( in vec3 a )  { return saturate( vec3(1.0) - a ); }\nvec4  whiteCompliment( in vec4 a )  { return saturate( vec4(1.0) - a ); }\nvec3 transformDirection( in vec3 normal, in mat4 matrix ) {\n\treturn normalize( ( matrix * vec4( normal, 0.0 ) ).xyz );\n}\n// http://en.wikibooks.org/wiki/GLSL_Programming/Applying_Matrix_Transformations\nvec3 inverseTransformDirection( in vec3 normal, in mat4 matrix ) {\n\treturn normalize( ( vec4( normal, 0.0 ) * matrix ).xyz );\n}\nvec3 projectOnPlane(in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal) {\n\tfloat distance = dot( planeNormal, point-pointOnPlane );\n\treturn point - distance * planeNormal;\n}\nfloat sideOfPlane( in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\treturn sign( dot( point - pointOnPlane, planeNormal ) );\n}\nvec3 linePlaneIntersect( in vec3 pointOnLine, in vec3 lineDirection, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\treturn pointOnLine + lineDirection * ( dot( planeNormal, pointOnPlane - pointOnLine ) / dot( planeNormal, lineDirection ) );\n}\nfloat calcLightAttenuation( float lightDistance, float cutoffDistance, float decayExponent ) {\n\tif ( decayExponent > 0.0 ) {\n\t  return pow( saturate( 1.0 - lightDistance / cutoffDistance ), decayExponent );\n\t}\n\treturn 1.0;\n}\n\nvec3 inputToLinear( in vec3 a ) {\n#ifdef GAMMA_INPUT\n\treturn pow( a, vec3( float( GAMMA_FACTOR ) ) );\n#else\n\treturn a;\n#endif\n}\nvec3 linearToOutput( in vec3 a ) {\n#ifdef GAMMA_OUTPUT\n\treturn pow( a, vec3( 1.0 / float( GAMMA_FACTOR ) ) );\n#else\n\treturn a;\n#endif\n}\n"; THREE.ShaderChunk.alphatest_fragment="#ifdef ALPHATEST\n\n\tif ( diffuseColor.a < ALPHATEST ) discard;\n\n#endif\n";THREE.ShaderChunk.lights_lambert_vertex="vLightFront = vec3( 0.0 );\n\n#ifdef DOUBLE_SIDED\n\n\tvLightBack = vec3( 0.0 );\n\n#endif\n\ntransformedNormal = normalize( transformedNormal );\n\n#if MAX_DIR_LIGHTS > 0\n\nfor( int i = 0; i < MAX_DIR_LIGHTS; i ++ ) {\n\n\tvec3 dirVector = transformDirection( directionalLightDirection[ i ], viewMatrix );\n\n\tfloat dotProduct = dot( transformedNormal, dirVector );\n\tvec3 directionalLightWeighting = vec3( max( dotProduct, 0.0 ) );\n\n\t#ifdef DOUBLE_SIDED\n\n\t\tvec3 directionalLightWeightingBack = vec3( max( -dotProduct, 0.0 ) );\n\n\t\t#ifdef WRAP_AROUND\n\n\t\t\tvec3 directionalLightWeightingHalfBack = vec3( max( -0.5 * dotProduct + 0.5, 0.0 ) );\n\n\t\t#endif\n\n\t#endif\n\n\t#ifdef WRAP_AROUND\n\n\t\tvec3 directionalLightWeightingHalf = vec3( max( 0.5 * dotProduct + 0.5, 0.0 ) );\n\t\tdirectionalLightWeighting = mix( directionalLightWeighting, directionalLightWeightingHalf, wrapRGB );\n\n\t\t#ifdef DOUBLE_SIDED\n\n\t\t\tdirectionalLightWeightingBack = mix( directionalLightWeightingBack, directionalLightWeightingHalfBack, wrapRGB );\n\n\t\t#endif\n\n\t#endif\n\n\tvLightFront += directionalLightColor[ i ] * directionalLightWeighting;\n\n\t#ifdef DOUBLE_SIDED\n\n\t\tvLightBack += directionalLightColor[ i ] * directionalLightWeightingBack;\n\n\t#endif\n\n}\n\n#endif\n\n#if MAX_POINT_LIGHTS > 0\n\n\tfor( int i = 0; i < MAX_POINT_LIGHTS; i ++ ) {\n\n\t\tvec4 lPosition = viewMatrix * vec4( pointLightPosition[ i ], 1.0 );\n\t\tvec3 lVector = lPosition.xyz - mvPosition.xyz;\n\n\t\tfloat attenuation = calcLightAttenuation( length( lVector ), pointLightDistance[ i ], pointLightDecay[ i ] );\n\n\t\tlVector = normalize( lVector );\n\t\tfloat dotProduct = dot( transformedNormal, lVector );\n\n\t\tvec3 pointLightWeighting = vec3( max( dotProduct, 0.0 ) );\n\n\t\t#ifdef DOUBLE_SIDED\n\n\t\t\tvec3 pointLightWeightingBack = vec3( max( -dotProduct, 0.0 ) );\n\n\t\t\t#ifdef WRAP_AROUND\n\n\t\t\t\tvec3 pointLightWeightingHalfBack = vec3( max( -0.5 * dotProduct + 0.5, 0.0 ) );\n\n\t\t\t#endif\n\n\t\t#endif\n\n\t\t#ifdef WRAP_AROUND\n\n\t\t\tvec3 pointLightWeightingHalf = vec3( max( 0.5 * dotProduct + 0.5, 0.0 ) );\n\t\t\tpointLightWeighting = mix( pointLightWeighting, pointLightWeightingHalf, wrapRGB );\n\n\t\t\t#ifdef DOUBLE_SIDED\n\n\t\t\t\tpointLightWeightingBack = mix( pointLightWeightingBack, pointLightWeightingHalfBack, wrapRGB );\n\n\t\t\t#endif\n\n\t\t#endif\n\n\t\tvLightFront += pointLightColor[ i ] * pointLightWeighting * attenuation;\n\n\t\t#ifdef DOUBLE_SIDED\n\n\t\t\tvLightBack += pointLightColor[ i ] * pointLightWeightingBack * attenuation;\n\n\t\t#endif\n\n\t}\n\n#endif\n\n#if MAX_SPOT_LIGHTS > 0\n\n\tfor( int i = 0; i < MAX_SPOT_LIGHTS; i ++ ) {\n\n\t\tvec4 lPosition = viewMatrix * vec4( spotLightPosition[ i ], 1.0 );\n\t\tvec3 lVector = lPosition.xyz - mvPosition.xyz;\n\n\t\tfloat spotEffect = dot( spotLightDirection[ i ], normalize( spotLightPosition[ i ] - worldPosition.xyz ) );\n\n\t\tif ( spotEffect > spotLightAngleCos[ i ] ) {\n\n\t\t\tspotEffect = max( pow( max( spotEffect, 0.0 ), spotLightExponent[ i ] ), 0.0 );\n\n\t\t\tfloat attenuation = calcLightAttenuation( length( lVector ), spotLightDistance[ i ], spotLightDecay[ i ] );\n\n\t\t\tlVector = normalize( lVector );\n\n\t\t\tfloat dotProduct = dot( transformedNormal, lVector );\n\t\t\tvec3 spotLightWeighting = vec3( max( dotProduct, 0.0 ) );\n\n\t\t\t#ifdef DOUBLE_SIDED\n\n\t\t\t\tvec3 spotLightWeightingBack = vec3( max( -dotProduct, 0.0 ) );\n\n\t\t\t\t#ifdef WRAP_AROUND\n\n\t\t\t\t\tvec3 spotLightWeightingHalfBack = vec3( max( -0.5 * dotProduct + 0.5, 0.0 ) );\n\n\t\t\t\t#endif\n\n\t\t\t#endif\n\n\t\t\t#ifdef WRAP_AROUND\n\n\t\t\t\tvec3 spotLightWeightingHalf = vec3( max( 0.5 * dotProduct + 0.5, 0.0 ) );\n\t\t\t\tspotLightWeighting = mix( spotLightWeighting, spotLightWeightingHalf, wrapRGB );\n\n\t\t\t\t#ifdef DOUBLE_SIDED\n\n\t\t\t\t\tspotLightWeightingBack = mix( spotLightWeightingBack, spotLightWeightingHalfBack, wrapRGB );\n\n\t\t\t\t#endif\n\n\t\t\t#endif\n\n\t\t\tvLightFront += spotLightColor[ i ] * spotLightWeighting * attenuation * spotEffect;\n\n\t\t\t#ifdef DOUBLE_SIDED\n\n\t\t\t\tvLightBack += spotLightColor[ i ] * spotLightWeightingBack * attenuation * spotEffect;\n\n\t\t\t#endif\n\n\t\t}\n\n\t}\n\n#endif\n\n#if MAX_HEMI_LIGHTS > 0\n\n\tfor( int i = 0; i < MAX_HEMI_LIGHTS; i ++ ) {\n\n\t\tvec3 lVector = transformDirection( hemisphereLightDirection[ i ], viewMatrix );\n\n\t\tfloat dotProduct = dot( transformedNormal, lVector );\n\n\t\tfloat hemiDiffuseWeight = 0.5 * dotProduct + 0.5;\n\t\tfloat hemiDiffuseWeightBack = -0.5 * dotProduct + 0.5;\n\n\t\tvLightFront += mix( hemisphereLightGroundColor[ i ], hemisphereLightSkyColor[ i ], hemiDiffuseWeight );\n\n\t\t#ifdef DOUBLE_SIDED\n\n\t\t\tvLightBack += mix( hemisphereLightGroundColor[ i ], hemisphereLightSkyColor[ i ], hemiDiffuseWeightBack );\n\n\t\t#endif\n\n\t}\n\n#endif\n\nvLightFront += ambientLightColor;\n\n#ifdef DOUBLE_SIDED\n\n\tvLightBack += ambientLightColor;\n\n#endif\n"; THREE.ShaderChunk.map_particle_pars_fragment="#ifdef USE_MAP\n\n\tuniform vec4 offsetRepeat;\n\tuniform sampler2D map;\n\n#endif\n";THREE.ShaderChunk.default_vertex="#ifdef USE_SKINNING\n\n\tvec4 mvPosition = modelViewMatrix * skinned;\n\n#elif defined( USE_MORPHTARGETS )\n\n\tvec4 mvPosition = modelViewMatrix * vec4( morphed, 1.0 );\n\n#else\n\n\tvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n\n#endif\n\ngl_Position = projectionMatrix * mvPosition;\n"; THREE.ShaderChunk.map_pars_fragment="#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP )\n\n\tvarying vec2 vUv;\n\n#endif\n\n#ifdef USE_MAP\n\n\tuniform sampler2D map;\n\n#endif";THREE.ShaderChunk.skinnormal_vertex="#ifdef USE_SKINNING\n\n\tmat4 skinMatrix = mat4( 0.0 );\n\tskinMatrix += skinWeight.x * boneMatX;\n\tskinMatrix += skinWeight.y * boneMatY;\n\tskinMatrix += skinWeight.z * boneMatZ;\n\tskinMatrix += skinWeight.w * boneMatW;\n\tskinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;\n\n\t#ifdef USE_MORPHNORMALS\n\n\tvec4 skinnedNormal = skinMatrix * vec4( morphedNormal, 0.0 );\n\n\t#else\n\n\tvec4 skinnedNormal = skinMatrix * vec4( normal, 0.0 );\n\n\t#endif\n\n#endif\n"; THREE.ShaderChunk.logdepthbuf_pars_vertex="#ifdef USE_LOGDEPTHBUF\n\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\n\t\tvarying float vFragDepth;\n\n\t#endif\n\n\tuniform float logDepthBufFC;\n\n#endif";THREE.ShaderChunk.lightmap_pars_vertex="#ifdef USE_LIGHTMAP\n\n\tvarying vec2 vUv2;\n\n#endif";THREE.ShaderChunk.lights_phong_fragment="#ifndef FLAT_SHADED\n\n\tvec3 normal = normalize( vNormal );\n\n\t#ifdef DOUBLE_SIDED\n\n\t\tnormal = normal * ( -1.0 + 2.0 * float( gl_FrontFacing ) );\n\n\t#endif\n\n#else\n\n\tvec3 fdx = dFdx( vViewPosition );\n\tvec3 fdy = dFdy( vViewPosition );\n\tvec3 normal = normalize( cross( fdx, fdy ) );\n\n#endif\n\nvec3 viewPosition = normalize( vViewPosition );\n\n#ifdef USE_NORMALMAP\n\n\tnormal = perturbNormal2Arb( -vViewPosition, normal );\n\n#elif defined( USE_BUMPMAP )\n\n\tnormal = perturbNormalArb( -vViewPosition, normal, dHdxy_fwd );\n\n#endif\n\nvec3 totalDiffuseLight = vec3( 0.0 );\nvec3 totalSpecularLight = vec3( 0.0 );\n\n#if MAX_POINT_LIGHTS > 0\n\n\tfor ( int i = 0; i < MAX_POINT_LIGHTS; i ++ ) {\n\n\t\tvec4 lPosition = viewMatrix * vec4( pointLightPosition[ i ], 1.0 );\n\t\tvec3 lVector = lPosition.xyz + vViewPosition.xyz;\n\n\t\tfloat attenuation = calcLightAttenuation( length( lVector ), pointLightDistance[ i ], pointLightDecay[ i ] );\n\n\t\tlVector = normalize( lVector );\n\n\t\t// diffuse\n\n\t\tfloat dotProduct = dot( normal, lVector );\n\n\t\t#ifdef WRAP_AROUND\n\n\t\t\tfloat pointDiffuseWeightFull = max( dotProduct, 0.0 );\n\t\t\tfloat pointDiffuseWeightHalf = max( 0.5 * dotProduct + 0.5, 0.0 );\n\n\t\t\tvec3 pointDiffuseWeight = mix( vec3( pointDiffuseWeightFull ), vec3( pointDiffuseWeightHalf ), wrapRGB );\n\n\t\t#else\n\n\t\t\tfloat pointDiffuseWeight = max( dotProduct, 0.0 );\n\n\t\t#endif\n\n\t\ttotalDiffuseLight += pointLightColor[ i ] * pointDiffuseWeight * attenuation;\n\n\t\t\t\t// specular\n\n\t\tvec3 pointHalfVector = normalize( lVector + viewPosition );\n\t\tfloat pointDotNormalHalf = max( dot( normal, pointHalfVector ), 0.0 );\n\t\tfloat pointSpecularWeight = specularStrength * max( pow( pointDotNormalHalf, shininess ), 0.0 );\n\n\t\tfloat specularNormalization = ( shininess + 2.0 ) / 8.0;\n\n\t\tvec3 schlick = specular + vec3( 1.0 - specular ) * pow( max( 1.0 - dot( lVector, pointHalfVector ), 0.0 ), 5.0 );\n\t\ttotalSpecularLight += schlick * pointLightColor[ i ] * pointSpecularWeight * pointDiffuseWeight * attenuation * specularNormalization;\n\n\t}\n\n#endif\n\n#if MAX_SPOT_LIGHTS > 0\n\n\tfor ( int i = 0; i < MAX_SPOT_LIGHTS; i ++ ) {\n\n\t\tvec4 lPosition = viewMatrix * vec4( spotLightPosition[ i ], 1.0 );\n\t\tvec3 lVector = lPosition.xyz + vViewPosition.xyz;\n\n\t\tfloat attenuation = calcLightAttenuation( length( lVector ), spotLightDistance[ i ], spotLightDecay[ i ] );\n\n\t\tlVector = normalize( lVector );\n\n\t\tfloat spotEffect = dot( spotLightDirection[ i ], normalize( spotLightPosition[ i ] - vWorldPosition ) );\n\n\t\tif ( spotEffect > spotLightAngleCos[ i ] ) {\n\n\t\t\tspotEffect = max( pow( max( spotEffect, 0.0 ), spotLightExponent[ i ] ), 0.0 );\n\n\t\t\t// diffuse\n\n\t\t\tfloat dotProduct = dot( normal, lVector );\n\n\t\t\t#ifdef WRAP_AROUND\n\n\t\t\t\tfloat spotDiffuseWeightFull = max( dotProduct, 0.0 );\n\t\t\t\tfloat spotDiffuseWeightHalf = max( 0.5 * dotProduct + 0.5, 0.0 );\n\n\t\t\t\tvec3 spotDiffuseWeight = mix( vec3( spotDiffuseWeightFull ), vec3( spotDiffuseWeightHalf ), wrapRGB );\n\n\t\t\t#else\n\n\t\t\t\tfloat spotDiffuseWeight = max( dotProduct, 0.0 );\n\n\t\t\t#endif\n\n\t\t\ttotalDiffuseLight += spotLightColor[ i ] * spotDiffuseWeight * attenuation * spotEffect;\n\n\t\t\t// specular\n\n\t\t\tvec3 spotHalfVector = normalize( lVector + viewPosition );\n\t\t\tfloat spotDotNormalHalf = max( dot( normal, spotHalfVector ), 0.0 );\n\t\t\tfloat spotSpecularWeight = specularStrength * max( pow( spotDotNormalHalf, shininess ), 0.0 );\n\n\t\t\tfloat specularNormalization = ( shininess + 2.0 ) / 8.0;\n\n\t\t\tvec3 schlick = specular + vec3( 1.0 - specular ) * pow( max( 1.0 - dot( lVector, spotHalfVector ), 0.0 ), 5.0 );\n\t\t\ttotalSpecularLight += schlick * spotLightColor[ i ] * spotSpecularWeight * spotDiffuseWeight * attenuation * specularNormalization * spotEffect;\n\n\t\t}\n\n\t}\n\n#endif\n\n#if MAX_DIR_LIGHTS > 0\n\n\tfor( int i = 0; i < MAX_DIR_LIGHTS; i ++ ) {\n\n\t\tvec3 dirVector = transformDirection( directionalLightDirection[ i ], viewMatrix );\n\n\t\t// diffuse\n\n\t\tfloat dotProduct = dot( normal, dirVector );\n\n\t\t#ifdef WRAP_AROUND\n\n\t\t\tfloat dirDiffuseWeightFull = max( dotProduct, 0.0 );\n\t\t\tfloat dirDiffuseWeightHalf = max( 0.5 * dotProduct + 0.5, 0.0 );\n\n\t\t\tvec3 dirDiffuseWeight = mix( vec3( dirDiffuseWeightFull ), vec3( dirDiffuseWeightHalf ), wrapRGB );\n\n\t\t#else\n\n\t\t\tfloat dirDiffuseWeight = max( dotProduct, 0.0 );\n\n\t\t#endif\n\n\t\ttotalDiffuseLight += directionalLightColor[ i ] * dirDiffuseWeight;\n\n\t\t// specular\n\n\t\tvec3 dirHalfVector = normalize( dirVector + viewPosition );\n\t\tfloat dirDotNormalHalf = max( dot( normal, dirHalfVector ), 0.0 );\n\t\tfloat dirSpecularWeight = specularStrength * max( pow( dirDotNormalHalf, shininess ), 0.0 );\n\n\t\t/*\n\t\t// fresnel term from skin shader\n\t\tconst float F0 = 0.128;\n\n\t\tfloat base = 1.0 - dot( viewPosition, dirHalfVector );\n\t\tfloat exponential = pow( base, 5.0 );\n\n\t\tfloat fresnel = exponential + F0 * ( 1.0 - exponential );\n\t\t*/\n\n\t\t/*\n\t\t// fresnel term from fresnel shader\n\t\tconst float mFresnelBias = 0.08;\n\t\tconst float mFresnelScale = 0.3;\n\t\tconst float mFresnelPower = 5.0;\n\n\t\tfloat fresnel = mFresnelBias + mFresnelScale * pow( 1.0 + dot( normalize( -viewPosition ), normal ), mFresnelPower );\n\t\t*/\n\n\t\tfloat specularNormalization = ( shininess + 2.0 ) / 8.0;\n\n\t\t// \t\tdirSpecular += specular * directionalLightColor[ i ] * dirSpecularWeight * dirDiffuseWeight * specularNormalization * fresnel;\n\n\t\tvec3 schlick = specular + vec3( 1.0 - specular ) * pow( max( 1.0 - dot( dirVector, dirHalfVector ), 0.0 ), 5.0 );\n\t\ttotalSpecularLight += schlick * directionalLightColor[ i ] * dirSpecularWeight * dirDiffuseWeight * specularNormalization;\n\n\n\t}\n\n#endif\n\n#if MAX_HEMI_LIGHTS > 0\n\n\tfor( int i = 0; i < MAX_HEMI_LIGHTS; i ++ ) {\n\n\t\tvec3 lVector = transformDirection( hemisphereLightDirection[ i ], viewMatrix );\n\n\t\t// diffuse\n\n\t\tfloat dotProduct = dot( normal, lVector );\n\t\tfloat hemiDiffuseWeight = 0.5 * dotProduct + 0.5;\n\n\t\tvec3 hemiColor = mix( hemisphereLightGroundColor[ i ], hemisphereLightSkyColor[ i ], hemiDiffuseWeight );\n\n\t\ttotalDiffuseLight += hemiColor;\n\n\t\t// specular (sky light)\n\n\t\tvec3 hemiHalfVectorSky = normalize( lVector + viewPosition );\n\t\tfloat hemiDotNormalHalfSky = 0.5 * dot( normal, hemiHalfVectorSky ) + 0.5;\n\t\tfloat hemiSpecularWeightSky = specularStrength * max( pow( max( hemiDotNormalHalfSky, 0.0 ), shininess ), 0.0 );\n\n\t\t// specular (ground light)\n\n\t\tvec3 lVectorGround = -lVector;\n\n\t\tvec3 hemiHalfVectorGround = normalize( lVectorGround + viewPosition );\n\t\tfloat hemiDotNormalHalfGround = 0.5 * dot( normal, hemiHalfVectorGround ) + 0.5;\n\t\tfloat hemiSpecularWeightGround = specularStrength * max( pow( max( hemiDotNormalHalfGround, 0.0 ), shininess ), 0.0 );\n\n\t\tfloat dotProductGround = dot( normal, lVectorGround );\n\n\t\tfloat specularNormalization = ( shininess + 2.0 ) / 8.0;\n\n\t\tvec3 schlickSky = specular + vec3( 1.0 - specular ) * pow( max( 1.0 - dot( lVector, hemiHalfVectorSky ), 0.0 ), 5.0 );\n\t\tvec3 schlickGround = specular + vec3( 1.0 - specular ) * pow( max( 1.0 - dot( lVectorGround, hemiHalfVectorGround ), 0.0 ), 5.0 );\n\t\ttotalSpecularLight += hemiColor * specularNormalization * ( schlickSky * hemiSpecularWeightSky * max( dotProduct, 0.0 ) + schlickGround * hemiSpecularWeightGround * max( dotProductGround, 0.0 ) );\n\n\t}\n\n#endif\n\n#ifdef METAL\n\n\toutgoingLight += diffuseColor.rgb * ( totalDiffuseLight + ambientLightColor ) * specular + totalSpecularLight + emissive;\n\n#else\n\n\toutgoingLight += diffuseColor.rgb * ( totalDiffuseLight + ambientLightColor ) + totalSpecularLight + emissive;\n\n#endif\n"; THREE.ShaderChunk.fog_pars_fragment="#ifdef USE_FOG\n\n\tuniform vec3 fogColor;\n\n\t#ifdef FOG_EXP2\n\n\t\tuniform float fogDensity;\n\n\t#else\n\n\t\tuniform float fogNear;\n\t\tuniform float fogFar;\n\t#endif\n\n#endif";THREE.ShaderChunk.morphnormal_vertex="#ifdef USE_MORPHNORMALS\n\n\tvec3 morphedNormal = vec3( 0.0 );\n\n\tmorphedNormal += ( morphNormal0 - normal ) * morphTargetInfluences[ 0 ];\n\tmorphedNormal += ( morphNormal1 - normal ) * morphTargetInfluences[ 1 ];\n\tmorphedNormal += ( morphNormal2 - normal ) * morphTargetInfluences[ 2 ];\n\tmorphedNormal += ( morphNormal3 - normal ) * morphTargetInfluences[ 3 ];\n\n\tmorphedNormal += normal;\n\n#endif"; THREE.ShaderChunk.envmap_pars_fragment="#ifdef USE_ENVMAP\n\n\tuniform float reflectivity;\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tuniform samplerCube envMap;\n\t#else\n\t\tuniform sampler2D envMap;\n\t#endif\n\tuniform float flipEnvMap;\n\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\n\t\tuniform float refractionRatio;\n\n\t#else\n\n\t\tvarying vec3 vReflect;\n\n\t#endif\n\n#endif\n";THREE.ShaderChunk.logdepthbuf_fragment="#if defined(USE_LOGDEPTHBUF) && defined(USE_LOGDEPTHBUF_EXT)\n\n\tgl_FragDepthEXT = log2(vFragDepth) * logDepthBufFC * 0.5;\n\n#endif"; THREE.ShaderChunk.normalmap_pars_fragment="#ifdef USE_NORMALMAP\n\n\tuniform sampler2D normalMap;\n\tuniform vec2 normalScale;\n\n\t// Per-Pixel Tangent Space Normal Mapping\n\t// http://hacksoflife.blogspot.ch/2009/11/per-pixel-tangent-space-normal-mapping.html\n\n\tvec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm ) {\n\n\t\tvec3 q0 = dFdx( eye_pos.xyz );\n\t\tvec3 q1 = dFdy( eye_pos.xyz );\n\t\tvec2 st0 = dFdx( vUv.st );\n\t\tvec2 st1 = dFdy( vUv.st );\n\n\t\tvec3 S = normalize( q0 * st1.t - q1 * st0.t );\n\t\tvec3 T = normalize( -q0 * st1.s + q1 * st0.s );\n\t\tvec3 N = normalize( surf_norm );\n\n\t\tvec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\t\tmapN.xy = normalScale * mapN.xy;\n\t\tmat3 tsn = mat3( S, T, N );\n\t\treturn normalize( tsn * mapN );\n\n\t}\n\n#endif\n"; THREE.ShaderChunk.lights_phong_pars_vertex="#if MAX_SPOT_LIGHTS > 0 || defined( USE_BUMPMAP ) || defined( USE_ENVMAP )\n\n\tvarying vec3 vWorldPosition;\n\n#endif\n";THREE.ShaderChunk.lightmap_pars_fragment="#ifdef USE_LIGHTMAP\n\n\tvarying vec2 vUv2;\n\tuniform sampler2D lightMap;\n\n#endif";THREE.ShaderChunk.shadowmap_vertex="#ifdef USE_SHADOWMAP\n\n\tfor( int i = 0; i < MAX_SHADOWS; i ++ ) {\n\n\t\tvShadowCoord[ i ] = shadowMatrix[ i ] * worldPosition;\n\n\t}\n\n#endif"; THREE.ShaderChunk.lights_phong_vertex="#if MAX_SPOT_LIGHTS > 0 || defined( USE_BUMPMAP ) || defined( USE_ENVMAP )\n\n\tvWorldPosition = worldPosition.xyz;\n\n#endif";THREE.ShaderChunk.map_fragment="#ifdef USE_MAP\n\n\tvec4 texelColor = texture2D( map, vUv );\n\n\ttexelColor.xyz = inputToLinear( texelColor.xyz );\n\n\tdiffuseColor *= texelColor;\n\n#endif";THREE.ShaderChunk.lightmap_vertex="#ifdef USE_LIGHTMAP\n\n\tvUv2 = uv2;\n\n#endif";THREE.ShaderChunk.map_particle_fragment="#ifdef USE_MAP\n\n\tdiffuseColor *= texture2D( map, vec2( gl_PointCoord.x, 1.0 - gl_PointCoord.y ) * offsetRepeat.zw + offsetRepeat.xy );\n\n#endif\n"; THREE.ShaderChunk.color_pars_fragment="#ifdef USE_COLOR\n\n\tvarying vec3 vColor;\n\n#endif\n";THREE.ShaderChunk.color_vertex="#ifdef USE_COLOR\n\n\tvColor.xyz = inputToLinear( color.xyz );\n\n#endif";THREE.ShaderChunk.skinning_vertex="#ifdef USE_SKINNING\n\n\t#ifdef USE_MORPHTARGETS\n\n\tvec4 skinVertex = bindMatrix * vec4( morphed, 1.0 );\n\n\t#else\n\n\tvec4 skinVertex = bindMatrix * vec4( position, 1.0 );\n\n\t#endif\n\n\tvec4 skinned = vec4( 0.0 );\n\tskinned += boneMatX * skinVertex * skinWeight.x;\n\tskinned += boneMatY * skinVertex * skinWeight.y;\n\tskinned += boneMatZ * skinVertex * skinWeight.z;\n\tskinned += boneMatW * skinVertex * skinWeight.w;\n\tskinned = bindMatrixInverse * skinned;\n\n#endif\n"; THREE.ShaderChunk.envmap_pars_vertex="#if defined( USE_ENVMAP ) && ! defined( USE_BUMPMAP ) && ! defined( USE_NORMALMAP ) && ! defined( PHONG )\n\n\tvarying vec3 vReflect;\n\n\tuniform float refractionRatio;\n\n#endif\n";THREE.ShaderChunk.linear_to_gamma_fragment="\n\toutgoingLight = linearToOutput( outgoingLight );\n";THREE.ShaderChunk.color_pars_vertex="#ifdef USE_COLOR\n\n\tvarying vec3 vColor;\n\n#endif";THREE.ShaderChunk.lights_lambert_pars_vertex="uniform vec3 ambientLightColor;\n\n#if MAX_DIR_LIGHTS > 0\n\n\tuniform vec3 directionalLightColor[ MAX_DIR_LIGHTS ];\n\tuniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\n\n#endif\n\n#if MAX_HEMI_LIGHTS > 0\n\n\tuniform vec3 hemisphereLightSkyColor[ MAX_HEMI_LIGHTS ];\n\tuniform vec3 hemisphereLightGroundColor[ MAX_HEMI_LIGHTS ];\n\tuniform vec3 hemisphereLightDirection[ MAX_HEMI_LIGHTS ];\n\n#endif\n\n#if MAX_POINT_LIGHTS > 0\n\n\tuniform vec3 pointLightColor[ MAX_POINT_LIGHTS ];\n\tuniform vec3 pointLightPosition[ MAX_POINT_LIGHTS ];\n\tuniform float pointLightDistance[ MAX_POINT_LIGHTS ];\n\tuniform float pointLightDecay[ MAX_POINT_LIGHTS ];\n\n#endif\n\n#if MAX_SPOT_LIGHTS > 0\n\n\tuniform vec3 spotLightColor[ MAX_SPOT_LIGHTS ];\n\tuniform vec3 spotLightPosition[ MAX_SPOT_LIGHTS ];\n\tuniform vec3 spotLightDirection[ MAX_SPOT_LIGHTS ];\n\tuniform float spotLightDistance[ MAX_SPOT_LIGHTS ];\n\tuniform float spotLightAngleCos[ MAX_SPOT_LIGHTS ];\n\tuniform float spotLightExponent[ MAX_SPOT_LIGHTS ];\n\tuniform float spotLightDecay[ MAX_SPOT_LIGHTS ];\n\n#endif\n\n#ifdef WRAP_AROUND\n\n\tuniform vec3 wrapRGB;\n\n#endif\n"; THREE.ShaderChunk.map_pars_vertex="#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP )\n\n\tvarying vec2 vUv;\n\tuniform vec4 offsetRepeat;\n\n#endif\n";THREE.ShaderChunk.envmap_fragment="#ifdef USE_ENVMAP\n\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\n\t\tvec3 cameraToVertex = normalize( vWorldPosition - cameraPosition );\n\n\t\t// Transforming Normal Vectors with the Inverse Transformation\n\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\n\t\t\tvec3 reflectVec = reflect( cameraToVertex, worldNormal );\n\n\t\t#else\n\n\t\t\tvec3 reflectVec = refract( cameraToVertex, worldNormal, refractionRatio );\n\n\t\t#endif\n\n\t#else\n\n\t\tvec3 reflectVec = vReflect;\n\n\t#endif\n\n\t#ifdef DOUBLE_SIDED\n\t\tfloat flipNormal = ( -1.0 + 2.0 * float( gl_FrontFacing ) );\n\t#else\n\t\tfloat flipNormal = 1.0;\n\t#endif\n\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 envColor = textureCube( envMap, flipNormal * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n\n\t#elif defined( ENVMAP_TYPE_EQUIREC )\n\t\tvec2 sampleUV;\n\t\tsampleUV.y = saturate( flipNormal * reflectVec.y * 0.5 + 0.5 );\n\t\tsampleUV.x = atan( flipNormal * reflectVec.z, flipNormal * reflectVec.x ) * RECIPROCAL_PI2 + 0.5;\n\t\tvec4 envColor = texture2D( envMap, sampleUV );\n\n\t#elif defined( ENVMAP_TYPE_SPHERE )\n\t\tvec3 reflectView = flipNormal * normalize((viewMatrix * vec4( reflectVec, 0.0 )).xyz + vec3(0.0,0.0,1.0));\n\t\tvec4 envColor = texture2D( envMap, reflectView.xy * 0.5 + 0.5 );\n\t#endif\n\n\tenvColor.xyz = inputToLinear( envColor.xyz );\n\n\t#ifdef ENVMAP_BLENDING_MULTIPLY\n\n\t\toutgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n\n\t#elif defined( ENVMAP_BLENDING_MIX )\n\n\t\toutgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n\n\t#elif defined( ENVMAP_BLENDING_ADD )\n\n\t\toutgoingLight += envColor.xyz * specularStrength * reflectivity;\n\n\t#endif\n\n#endif\n"; THREE.ShaderChunk.specularmap_pars_fragment="#ifdef USE_SPECULARMAP\n\n\tuniform sampler2D specularMap;\n\n#endif";THREE.ShaderChunk.logdepthbuf_vertex="#ifdef USE_LOGDEPTHBUF\n\n\tgl_Position.z = log2(max( EPSILON, gl_Position.w + 1.0 )) * logDepthBufFC;\n\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\n\t\tvFragDepth = 1.0 + gl_Position.w;\n\n#else\n\n\t\tgl_Position.z = (gl_Position.z - 1.0) * gl_Position.w;\n\n\t#endif\n\n#endif";THREE.ShaderChunk.morphtarget_pars_vertex="#ifdef USE_MORPHTARGETS\n\n\t#ifndef USE_MORPHNORMALS\n\n\tuniform float morphTargetInfluences[ 8 ];\n\n\t#else\n\n\tuniform float morphTargetInfluences[ 4 ];\n\n\t#endif\n\n#endif"; THREE.ShaderChunk.specularmap_fragment="float specularStrength;\n\n#ifdef USE_SPECULARMAP\n\n\tvec4 texelSpecular = texture2D( specularMap, vUv );\n\tspecularStrength = texelSpecular.r;\n\n#else\n\n\tspecularStrength = 1.0;\n\n#endif";THREE.ShaderChunk.fog_fragment="#ifdef USE_FOG\n\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\n\t\tfloat depth = gl_FragDepthEXT / gl_FragCoord.w;\n\n\t#else\n\n\t\tfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n\n\t#endif\n\n\t#ifdef FOG_EXP2\n\n\t\tfloat fogFactor = exp2( - square( fogDensity ) * square( depth ) * LOG2 );\n\t\tfogFactor = whiteCompliment( fogFactor );\n\n\t#else\n\n\t\tfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n\n\t#endif\n\t\n\toutgoingLight = mix( outgoingLight, fogColor, fogFactor );\n\n#endif"; THREE.ShaderChunk.bumpmap_pars_fragment="#ifdef USE_BUMPMAP\n\n\tuniform sampler2D bumpMap;\n\tuniform float bumpScale;\n\n\t// Derivative maps - bump mapping unparametrized surfaces by Morten Mikkelsen\n\t// http://mmikkelsen3d.blogspot.sk/2011/07/derivative-maps.html\n\n\t// Evaluate the derivative of the height w.r.t. screen-space using forward differencing (listing 2)\n\n\tvec2 dHdxy_fwd {\n\n\t\tvec2 dSTdx = dFdx( vUv );\n\t\tvec2 dSTdy = dFdy( vUv );\n\n\t\tfloat Hll = bumpScale * texture2D( bumpMap, vUv ).x;\n\t\tfloat dBx = bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll;\n\t\tfloat dBy = bumpScale * texture2D( bumpMap, vUv + dSTdy ).x - Hll;\n\n\t\treturn vec2( dBx, dBy );\n\n\t}\n\n\tvec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy ) {\n\n\t\tvec3 vSigmaX = dFdx( surf_pos );\n\t\tvec3 vSigmaY = dFdy( surf_pos );\n\t\tvec3 vN = surf_norm;\t\t// normalized\n\n\t\tvec3 R1 = cross( vSigmaY, vN );\n\t\tvec3 R2 = cross( vN, vSigmaX );\n\n\t\tfloat fDet = dot( vSigmaX, R1 );\n\n\t\tvec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n\t\treturn normalize( abs( fDet ) * surf_norm - vGrad );\n\n\t}\n\n#endif\n"; THREE.ShaderChunk.defaultnormal_vertex="#ifdef USE_SKINNING\n\n\tvec3 objectNormal = skinnedNormal.xyz;\n\n#elif defined( USE_MORPHNORMALS )\n\n\tvec3 objectNormal = morphedNormal;\n\n#else\n\n\tvec3 objectNormal = normal;\n\n#endif\n\n#ifdef FLIP_SIDED\n\n\tobjectNormal = -objectNormal;\n\n#endif\n\nvec3 transformedNormal = normalMatrix * objectNormal;\n";THREE.ShaderChunk.lights_phong_pars_fragment="uniform vec3 ambientLightColor;\n\n#if MAX_DIR_LIGHTS > 0\n\n\tuniform vec3 directionalLightColor[ MAX_DIR_LIGHTS ];\n\tuniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\n\n#endif\n\n#if MAX_HEMI_LIGHTS > 0\n\n\tuniform vec3 hemisphereLightSkyColor[ MAX_HEMI_LIGHTS ];\n\tuniform vec3 hemisphereLightGroundColor[ MAX_HEMI_LIGHTS ];\n\tuniform vec3 hemisphereLightDirection[ MAX_HEMI_LIGHTS ];\n\n#endif\n\n#if MAX_POINT_LIGHTS > 0\n\n\tuniform vec3 pointLightColor[ MAX_POINT_LIGHTS ];\n\n\tuniform vec3 pointLightPosition[ MAX_POINT_LIGHTS ];\n\tuniform float pointLightDistance[ MAX_POINT_LIGHTS ];\n\tuniform float pointLightDecay[ MAX_POINT_LIGHTS ];\n\n#endif\n\n#if MAX_SPOT_LIGHTS > 0\n\n\tuniform vec3 spotLightColor[ MAX_SPOT_LIGHTS ];\n\tuniform vec3 spotLightPosition[ MAX_SPOT_LIGHTS ];\n\tuniform vec3 spotLightDirection[ MAX_SPOT_LIGHTS ];\n\tuniform float spotLightAngleCos[ MAX_SPOT_LIGHTS ];\n\tuniform float spotLightExponent[ MAX_SPOT_LIGHTS ];\n\tuniform float spotLightDistance[ MAX_SPOT_LIGHTS ];\n\tuniform float spotLightDecay[ MAX_SPOT_LIGHTS ];\n\n#endif\n\n#if MAX_SPOT_LIGHTS > 0 || defined( USE_BUMPMAP ) || defined( USE_ENVMAP )\n\n\tvarying vec3 vWorldPosition;\n\n#endif\n\n#ifdef WRAP_AROUND\n\n\tuniform vec3 wrapRGB;\n\n#endif\n\nvarying vec3 vViewPosition;\n\n#ifndef FLAT_SHADED\n\n\tvarying vec3 vNormal;\n\n#endif\n"; THREE.ShaderChunk.skinbase_vertex="#ifdef USE_SKINNING\n\n\tmat4 boneMatX = getBoneMatrix( skinIndex.x );\n\tmat4 boneMatY = getBoneMatrix( skinIndex.y );\n\tmat4 boneMatZ = getBoneMatrix( skinIndex.z );\n\tmat4 boneMatW = getBoneMatrix( skinIndex.w );\n\n#endif";THREE.ShaderChunk.map_vertex="#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP )\n\n\tvUv = uv * offsetRepeat.zw + offsetRepeat.xy;\n\n#endif"; THREE.ShaderChunk.lightmap_fragment="#ifdef USE_LIGHTMAP\n\n\toutgoingLight *= diffuseColor.xyz * texture2D( lightMap, vUv2 ).xyz;\n\n#endif";THREE.ShaderChunk.shadowmap_pars_vertex="#ifdef USE_SHADOWMAP\n\n\tvarying vec4 vShadowCoord[ MAX_SHADOWS ];\n\tuniform mat4 shadowMatrix[ MAX_SHADOWS ];\n\n#endif";THREE.ShaderChunk.color_fragment="#ifdef USE_COLOR\n\n\tdiffuseColor.rgb *= vColor;\n\n#endif";THREE.ShaderChunk.morphtarget_vertex="#ifdef USE_MORPHTARGETS\n\n\tvec3 morphed = vec3( 0.0 );\n\tmorphed += ( morphTarget0 - position ) * morphTargetInfluences[ 0 ];\n\tmorphed += ( morphTarget1 - position ) * morphTargetInfluences[ 1 ];\n\tmorphed += ( morphTarget2 - position ) * morphTargetInfluences[ 2 ];\n\tmorphed += ( morphTarget3 - position ) * morphTargetInfluences[ 3 ];\n\n\t#ifndef USE_MORPHNORMALS\n\n\tmorphed += ( morphTarget4 - position ) * morphTargetInfluences[ 4 ];\n\tmorphed += ( morphTarget5 - position ) * morphTargetInfluences[ 5 ];\n\tmorphed += ( morphTarget6 - position ) * morphTargetInfluences[ 6 ];\n\tmorphed += ( morphTarget7 - position ) * morphTargetInfluences[ 7 ];\n\n\t#endif\n\n\tmorphed += position;\n\n#endif"; THREE.ShaderChunk.envmap_vertex="#if defined( USE_ENVMAP ) && ! defined( USE_BUMPMAP ) && ! defined( USE_NORMALMAP ) && ! defined( PHONG )\n\n\tvec3 worldNormal = transformDirection( objectNormal, modelMatrix );\n\n\tvec3 cameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n\n\t#ifdef ENVMAP_MODE_REFLECTION\n\n\t\tvReflect = reflect( cameraToVertex, worldNormal );\n\n\t#else\n\n\t\tvReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n\n\t#endif\n\n#endif\n"; THREE.ShaderChunk.shadowmap_fragment="#ifdef USE_SHADOWMAP\n\n\t#ifdef SHADOWMAP_DEBUG\n\n\t\tvec3 frustumColors[3];\n\t\tfrustumColors[0] = vec3( 1.0, 0.5, 0.0 );\n\t\tfrustumColors[1] = vec3( 0.0, 1.0, 0.8 );\n\t\tfrustumColors[2] = vec3( 0.0, 0.5, 1.0 );\n\n\t#endif\n\n\t#ifdef SHADOWMAP_CASCADE\n\n\t\tint inFrustumCount = 0;\n\n\t#endif\n\n\tfloat fDepth;\n\tvec3 shadowColor = vec3( 1.0 );\n\n\tfor( int i = 0; i < MAX_SHADOWS; i ++ ) {\n\n\t\tvec3 shadowCoord = vShadowCoord[ i ].xyz / vShadowCoord[ i ].w;\n\n\t\t\t\t// if ( something && something ) breaks ATI OpenGL shader compiler\n\t\t\t\t// if ( all( something, something ) ) using this instead\n\n\t\tbvec4 inFrustumVec = bvec4 ( shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0 );\n\t\tbool inFrustum = all( inFrustumVec );\n\n\t\t\t\t// don't shadow pixels outside of light frustum\n\t\t\t\t// use just first frustum (for cascades)\n\t\t\t\t// don't shadow pixels behind far plane of light frustum\n\n\t\t#ifdef SHADOWMAP_CASCADE\n\n\t\t\tinFrustumCount += int( inFrustum );\n\t\t\tbvec3 frustumTestVec = bvec3( inFrustum, inFrustumCount == 1, shadowCoord.z <= 1.0 );\n\n\t\t#else\n\n\t\t\tbvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 );\n\n\t\t#endif\n\n\t\tbool frustumTest = all( frustumTestVec );\n\n\t\tif ( frustumTest ) {\n\n\t\t\tshadowCoord.z += shadowBias[ i ];\n\n\t\t\t#if defined( SHADOWMAP_TYPE_PCF )\n\n\t\t\t\t\t\t// Percentage-close filtering\n\t\t\t\t\t\t// (9 pixel kernel)\n\t\t\t\t\t\t// http://fabiensanglard.net/shadowmappingPCF/\n\n\t\t\t\tfloat shadow = 0.0;\n\n\t\t/*\n\t\t\t\t\t\t// nested loops breaks shader compiler / validator on some ATI cards when using OpenGL\n\t\t\t\t\t\t// must enroll loop manually\n\n\t\t\t\tfor ( float y = -1.25; y <= 1.25; y += 1.25 )\n\t\t\t\t\tfor ( float x = -1.25; x <= 1.25; x += 1.25 ) {\n\n\t\t\t\t\t\tvec4 rgbaDepth = texture2D( shadowMap[ i ], vec2( x * xPixelOffset, y * yPixelOffset ) + shadowCoord.xy );\n\n\t\t\t\t\t\t\t\t// doesn't seem to produce any noticeable visual difference compared to simple texture2D lookup\n\t\t\t\t\t\t\t\t//vec4 rgbaDepth = texture2DProj( shadowMap[ i ], vec4( vShadowCoord[ i ].w * ( vec2( x * xPixelOffset, y * yPixelOffset ) + shadowCoord.xy ), 0.05, vShadowCoord[ i ].w ) );\n\n\t\t\t\t\t\tfloat fDepth = unpackDepth( rgbaDepth );\n\n\t\t\t\t\t\tif ( fDepth < shadowCoord.z )\n\t\t\t\t\t\t\tshadow += 1.0;\n\n\t\t\t\t}\n\n\t\t\t\tshadow /= 9.0;\n\n\t\t*/\n\n\t\t\t\tconst float shadowDelta = 1.0 / 9.0;\n\n\t\t\t\tfloat xPixelOffset = 1.0 / shadowMapSize[ i ].x;\n\t\t\t\tfloat yPixelOffset = 1.0 / shadowMapSize[ i ].y;\n\n\t\t\t\tfloat dx0 = -1.25 * xPixelOffset;\n\t\t\t\tfloat dy0 = -1.25 * yPixelOffset;\n\t\t\t\tfloat dx1 = 1.25 * xPixelOffset;\n\t\t\t\tfloat dy1 = 1.25 * yPixelOffset;\n\n\t\t\t\tfDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx0, dy0 ) ) );\n\t\t\t\tif ( fDepth < shadowCoord.z ) shadow += shadowDelta;\n\n\t\t\t\tfDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( 0.0, dy0 ) ) );\n\t\t\t\tif ( fDepth < shadowCoord.z ) shadow += shadowDelta;\n\n\t\t\t\tfDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx1, dy0 ) ) );\n\t\t\t\tif ( fDepth < shadowCoord.z ) shadow += shadowDelta;\n\n\t\t\t\tfDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx0, 0.0 ) ) );\n\t\t\t\tif ( fDepth < shadowCoord.z ) shadow += shadowDelta;\n\n\t\t\t\tfDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy ) );\n\t\t\t\tif ( fDepth < shadowCoord.z ) shadow += shadowDelta;\n\n\t\t\t\tfDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx1, 0.0 ) ) );\n\t\t\t\tif ( fDepth < shadowCoord.z ) shadow += shadowDelta;\n\n\t\t\t\tfDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx0, dy1 ) ) );\n\t\t\t\tif ( fDepth < shadowCoord.z ) shadow += shadowDelta;\n\n\t\t\t\tfDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( 0.0, dy1 ) ) );\n\t\t\t\tif ( fDepth < shadowCoord.z ) shadow += shadowDelta;\n\n\t\t\t\tfDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx1, dy1 ) ) );\n\t\t\t\tif ( fDepth < shadowCoord.z ) shadow += shadowDelta;\n\n\t\t\t\tshadowColor = shadowColor * vec3( ( 1.0 - shadowDarkness[ i ] * shadow ) );\n\n\t\t\t#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n\n\t\t\t\t\t\t// Percentage-close filtering\n\t\t\t\t\t\t// (9 pixel kernel)\n\t\t\t\t\t\t// http://fabiensanglard.net/shadowmappingPCF/\n\n\t\t\t\tfloat shadow = 0.0;\n\n\t\t\t\tfloat xPixelOffset = 1.0 / shadowMapSize[ i ].x;\n\t\t\t\tfloat yPixelOffset = 1.0 / shadowMapSize[ i ].y;\n\n\t\t\t\tfloat dx0 = -1.0 * xPixelOffset;\n\t\t\t\tfloat dy0 = -1.0 * yPixelOffset;\n\t\t\t\tfloat dx1 = 1.0 * xPixelOffset;\n\t\t\t\tfloat dy1 = 1.0 * yPixelOffset;\n\n\t\t\t\tmat3 shadowKernel;\n\t\t\t\tmat3 depthKernel;\n\n\t\t\t\tdepthKernel[0][0] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx0, dy0 ) ) );\n\t\t\t\tdepthKernel[0][1] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx0, 0.0 ) ) );\n\t\t\t\tdepthKernel[0][2] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx0, dy1 ) ) );\n\t\t\t\tdepthKernel[1][0] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( 0.0, dy0 ) ) );\n\t\t\t\tdepthKernel[1][1] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy ) );\n\t\t\t\tdepthKernel[1][2] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( 0.0, dy1 ) ) );\n\t\t\t\tdepthKernel[2][0] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx1, dy0 ) ) );\n\t\t\t\tdepthKernel[2][1] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx1, 0.0 ) ) );\n\t\t\t\tdepthKernel[2][2] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx1, dy1 ) ) );\n\n\t\t\t\tvec3 shadowZ = vec3( shadowCoord.z );\n\t\t\t\tshadowKernel[0] = vec3(lessThan(depthKernel[0], shadowZ ));\n\t\t\t\tshadowKernel[0] *= vec3(0.25);\n\n\t\t\t\tshadowKernel[1] = vec3(lessThan(depthKernel[1], shadowZ ));\n\t\t\t\tshadowKernel[1] *= vec3(0.25);\n\n\t\t\t\tshadowKernel[2] = vec3(lessThan(depthKernel[2], shadowZ ));\n\t\t\t\tshadowKernel[2] *= vec3(0.25);\n\n\t\t\t\tvec2 fractionalCoord = 1.0 - fract( shadowCoord.xy * shadowMapSize[i].xy );\n\n\t\t\t\tshadowKernel[0] = mix( shadowKernel[1], shadowKernel[0], fractionalCoord.x );\n\t\t\t\tshadowKernel[1] = mix( shadowKernel[2], shadowKernel[1], fractionalCoord.x );\n\n\t\t\t\tvec4 shadowValues;\n\t\t\t\tshadowValues.x = mix( shadowKernel[0][1], shadowKernel[0][0], fractionalCoord.y );\n\t\t\t\tshadowValues.y = mix( shadowKernel[0][2], shadowKernel[0][1], fractionalCoord.y );\n\t\t\t\tshadowValues.z = mix( shadowKernel[1][1], shadowKernel[1][0], fractionalCoord.y );\n\t\t\t\tshadowValues.w = mix( shadowKernel[1][2], shadowKernel[1][1], fractionalCoord.y );\n\n\t\t\t\tshadow = dot( shadowValues, vec4( 1.0 ) );\n\n\t\t\t\tshadowColor = shadowColor * vec3( ( 1.0 - shadowDarkness[ i ] * shadow ) );\n\n\t\t\t#else\n\n\t\t\t\tvec4 rgbaDepth = texture2D( shadowMap[ i ], shadowCoord.xy );\n\t\t\t\tfloat fDepth = unpackDepth( rgbaDepth );\n\n\t\t\t\tif ( fDepth < shadowCoord.z )\n\n\t\t// spot with multiple shadows is darker\n\n\t\t\t\t\tshadowColor = shadowColor * vec3( 1.0 - shadowDarkness[ i ] );\n\n\t\t// spot with multiple shadows has the same color as single shadow spot\n\n\t\t// \t\t\t\t\tshadowColor = min( shadowColor, vec3( shadowDarkness[ i ] ) );\n\n\t\t\t#endif\n\n\t\t}\n\n\n\t\t#ifdef SHADOWMAP_DEBUG\n\n\t\t\t#ifdef SHADOWMAP_CASCADE\n\n\t\t\t\tif ( inFrustum && inFrustumCount == 1 ) outgoingLight *= frustumColors[ i ];\n\n\t\t\t#else\n\n\t\t\t\tif ( inFrustum ) outgoingLight *= frustumColors[ i ];\n\n\t\t\t#endif\n\n\t\t#endif\n\n\t}\n\n\t// NOTE: I am unsure if this is correct in linear space. -bhouston, Dec 29, 2014\n\tshadowColor = inputToLinear( shadowColor );\n\n\toutgoingLight = outgoingLight * shadowColor;\n\n#endif\n"; THREE.ShaderChunk.worldpos_vertex="#if defined( USE_ENVMAP ) || defined( PHONG ) || defined( LAMBERT ) || defined ( USE_SHADOWMAP )\n\n\t#ifdef USE_SKINNING\n\n\t\tvec4 worldPosition = modelMatrix * skinned;\n\n\t#elif defined( USE_MORPHTARGETS )\n\n\t\tvec4 worldPosition = modelMatrix * vec4( morphed, 1.0 );\n\n\t#else\n\n\t\tvec4 worldPosition = modelMatrix * vec4( position, 1.0 );\n\n\t#endif\n\n#endif\n";THREE.ShaderChunk.shadowmap_pars_fragment="#ifdef USE_SHADOWMAP\n\n\tuniform sampler2D shadowMap[ MAX_SHADOWS ];\n\tuniform vec2 shadowMapSize[ MAX_SHADOWS ];\n\n\tuniform float shadowDarkness[ MAX_SHADOWS ];\n\tuniform float shadowBias[ MAX_SHADOWS ];\n\n\tvarying vec4 vShadowCoord[ MAX_SHADOWS ];\n\n\tfloat unpackDepth( const in vec4 rgba_depth ) {\n\n\t\tconst vec4 bit_shift = vec4( 1.0 / ( 256.0 * 256.0 * 256.0 ), 1.0 / ( 256.0 * 256.0 ), 1.0 / 256.0, 1.0 );\n\t\tfloat depth = dot( rgba_depth, bit_shift );\n\t\treturn depth;\n\n\t}\n\n#endif"; THREE.ShaderChunk.skinning_pars_vertex="#ifdef USE_SKINNING\n\n\tuniform mat4 bindMatrix;\n\tuniform mat4 bindMatrixInverse;\n\n\t#ifdef BONE_TEXTURE\n\n\t\tuniform sampler2D boneTexture;\n\t\tuniform int boneTextureWidth;\n\t\tuniform int boneTextureHeight;\n\n\t\tmat4 getBoneMatrix( const in float i ) {\n\n\t\t\tfloat j = i * 4.0;\n\t\t\tfloat x = mod( j, float( boneTextureWidth ) );\n\t\t\tfloat y = floor( j / float( boneTextureWidth ) );\n\n\t\t\tfloat dx = 1.0 / float( boneTextureWidth );\n\t\t\tfloat dy = 1.0 / float( boneTextureHeight );\n\n\t\t\ty = dy * ( y + 0.5 );\n\n\t\t\tvec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );\n\t\t\tvec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );\n\t\t\tvec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );\n\t\t\tvec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );\n\n\t\t\tmat4 bone = mat4( v1, v2, v3, v4 );\n\n\t\t\treturn bone;\n\n\t\t}\n\n\t#else\n\n\t\tuniform mat4 boneGlobalMatrices[ MAX_BONES ];\n\n\t\tmat4 getBoneMatrix( const in float i ) {\n\n\t\t\tmat4 bone = boneGlobalMatrices[ int(i) ];\n\t\t\treturn bone;\n\n\t\t}\n\n\t#endif\n\n#endif\n"; THREE.ShaderChunk.logdepthbuf_pars_fragment="#ifdef USE_LOGDEPTHBUF\n\n\tuniform float logDepthBufFC;\n\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\n\t\t#extension GL_EXT_frag_depth : enable\n\t\tvarying float vFragDepth;\n\n\t#endif\n\n#endif";THREE.ShaderChunk.alphamap_fragment="#ifdef USE_ALPHAMAP\n\n\tdiffuseColor.a *= texture2D( alphaMap, vUv ).g;\n\n#endif\n";THREE.ShaderChunk.alphamap_pars_fragment="#ifdef USE_ALPHAMAP\n\n\tuniform sampler2D alphaMap;\n\n#endif\n"; THREE.UniformsUtils={merge:function(a){for(var b={},c=0;c<a.length;c++){var d=this.clone(a[c]),e;for(e in d)b[e]=d[e]}return b},clone:function(a){var b={},c;for(c in a){b[c]={};for(var d in a[c]){var e=a[c][d];b[c][d]=e instanceof THREE.Color||e instanceof THREE.Vector2||e instanceof THREE.Vector3||e instanceof THREE.Vector4||e instanceof THREE.Matrix4||e instanceof THREE.Texture?e.clone:e instanceof Array?e.slice:e}}return b}}; THREE.UniformsLib={common:{diffuse:{type:"c",value:new THREE.Color(15658734)},opacity:{type:"f",value:1},map:{type:"t",value:null},offsetRepeat:{type:"v4",value:new THREE.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 THREE.Vector2(1,1)}},fog:{fogDensity:{type:"f",value:2.5E-4},fogNear:{type:"f",value:1},fogFar:{type:"f",value:2E3},fogColor:{type:"c",value:new THREE.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 THREE.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 THREE.Vector4(0,0,1,1)},fogDensity:{type:"f",value:2.5E-4},fogNear:{type:"f",value:1},fogFar:{type:"f",value:2E3},fogColor:{type:"c",value:new THREE.Color(16777215)}},shadowmap:{shadowMap:{type:"tv",value:[]},shadowMapSize:{type:"v2v",value:[]},shadowBias:{type:"fv1",value:[]},shadowDarkness:{type:"fv1",value:[]},shadowMatrix:{type:"m4v",value:[]}}}; THREE.ShaderLib={basic:{uniforms:THREE.UniformsUtils.merge([THREE.UniformsLib.common,THREE.UniformsLib.fog,THREE.UniformsLib.shadowmap]),vertexShader:[THREE.ShaderChunk.common,THREE.ShaderChunk.map_pars_vertex,THREE.ShaderChunk.lightmap_pars_vertex,THREE.ShaderChunk.envmap_pars_vertex,THREE.ShaderChunk.color_pars_vertex,THREE.ShaderChunk.morphtarget_pars_vertex,THREE.ShaderChunk.skinning_pars_vertex,THREE.ShaderChunk.shadowmap_pars_vertex,THREE.ShaderChunk.logdepthbuf_pars_vertex,"void main {", THREE.ShaderChunk.map_vertex,THREE.ShaderChunk.lightmap_vertex,THREE.ShaderChunk.color_vertex,THREE.ShaderChunk.skinbase_vertex,"\t#ifdef USE_ENVMAP",THREE.ShaderChunk.morphnormal_vertex,THREE.ShaderChunk.skinnormal_vertex,THREE.ShaderChunk.defaultnormal_vertex,"\t#endif",THREE.ShaderChunk.morphtarget_vertex,THREE.ShaderChunk.skinning_vertex,THREE.ShaderChunk.default_vertex,THREE.ShaderChunk.logdepthbuf_vertex,THREE.ShaderChunk.worldpos_vertex,THREE.ShaderChunk.envmap_vertex,THREE.ShaderChunk.shadowmap_vertex, "}"].join("\n"),fragmentShader:["uniform vec3 diffuse;\nuniform float opacity;",THREE.ShaderChunk.common,THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_pars_fragment,THREE.ShaderChunk.alphamap_pars_fragment,THREE.ShaderChunk.lightmap_pars_fragment,THREE.ShaderChunk.envmap_pars_fragment,THREE.ShaderChunk.fog_pars_fragment,THREE.ShaderChunk.shadowmap_pars_fragment,THREE.ShaderChunk.specularmap_pars_fragment,THREE.ShaderChunk.logdepthbuf_pars_fragment,"void main {\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );", THREE.ShaderChunk.logdepthbuf_fragment,THREE.ShaderChunk.map_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.alphamap_fragment,THREE.ShaderChunk.alphatest_fragment,THREE.ShaderChunk.specularmap_fragment,"\toutgoingLight = diffuseColor.rgb;",THREE.ShaderChunk.lightmap_fragment,THREE.ShaderChunk.envmap_fragment,THREE.ShaderChunk.shadowmap_fragment,THREE.ShaderChunk.linear_to_gamma_fragment,THREE.ShaderChunk.fog_fragment,"\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n}"].join("\n")}, lambert:{uniforms:THREE.UniformsUtils.merge([THREE.UniformsLib.common,THREE.UniformsLib.fog,THREE.UniformsLib.lights,THREE.UniformsLib.shadowmap,{emissive:{type:"c",value:new THREE.Color(0)},wrapRGB:{type:"v3",value:new THREE.Vector3(1,1,1)}}]),vertexShader:["#define LAMBERT\nvarying vec3 vLightFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n#endif",THREE.ShaderChunk.common,THREE.ShaderChunk.map_pars_vertex,THREE.ShaderChunk.lightmap_pars_vertex,THREE.ShaderChunk.envmap_pars_vertex,THREE.ShaderChunk.lights_lambert_pars_vertex, THREE.ShaderChunk.color_pars_vertex,THREE.ShaderChunk.morphtarget_pars_vertex,THREE.ShaderChunk.skinning_pars_vertex,THREE.ShaderChunk.shadowmap_pars_vertex,THREE.ShaderChunk.logdepthbuf_pars_vertex,"void main {",THREE.ShaderChunk.map_vertex,THREE.ShaderChunk.lightmap_vertex,THREE.ShaderChunk.color_vertex,THREE.ShaderChunk.morphnormal_vertex,THREE.ShaderChunk.skinbase_vertex,THREE.ShaderChunk.skinnormal_vertex,THREE.ShaderChunk.defaultnormal_vertex,THREE.ShaderChunk.morphtarget_vertex,THREE.ShaderChunk.skinning_vertex, THREE.ShaderChunk.default_vertex,THREE.ShaderChunk.logdepthbuf_vertex,THREE.ShaderChunk.worldpos_vertex,THREE.ShaderChunk.envmap_vertex,THREE.ShaderChunk.lights_lambert_vertex,THREE.ShaderChunk.shadowmap_vertex,"}"].join("\n"),fragmentShader:["uniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\nvarying vec3 vLightFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n#endif",THREE.ShaderChunk.common,THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_pars_fragment,THREE.ShaderChunk.alphamap_pars_fragment, THREE.ShaderChunk.lightmap_pars_fragment,THREE.ShaderChunk.envmap_pars_fragment,THREE.ShaderChunk.fog_pars_fragment,THREE.ShaderChunk.shadowmap_pars_fragment,THREE.ShaderChunk.specularmap_pars_fragment,THREE.ShaderChunk.logdepthbuf_pars_fragment,"void main {\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );",THREE.ShaderChunk.logdepthbuf_fragment,THREE.ShaderChunk.map_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.alphamap_fragment,THREE.ShaderChunk.alphatest_fragment, THREE.ShaderChunk.specularmap_fragment,"\t#ifdef DOUBLE_SIDED\n\t\tif ( gl_FrontFacing )\n\t\t\toutgoingLight += diffuseColor.rgb * vLightFront + emissive;\n\t\telse\n\t\t\toutgoingLight += diffuseColor.rgb * vLightBack + emissive;\n\t#else\n\t\toutgoingLight += diffuseColor.rgb * vLightFront + emissive;\n\t#endif",THREE.ShaderChunk.lightmap_fragment,THREE.ShaderChunk.envmap_fragment,THREE.ShaderChunk.shadowmap_fragment,THREE.ShaderChunk.linear_to_gamma_fragment,THREE.ShaderChunk.fog_fragment,"\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n}"].join("\n")}, phong:{uniforms:THREE.UniformsUtils.merge([THREE.UniformsLib.common,THREE.UniformsLib.bump,THREE.UniformsLib.normalmap,THREE.UniformsLib.fog,THREE.UniformsLib.lights,THREE.UniformsLib.shadowmap,{emissive:{type:"c",value:new THREE.Color(0)},specular:{type:"c",value:new THREE.Color(1118481)},shininess:{type:"f",value:30},wrapRGB:{type:"v3",value:new THREE.Vector3(1,1,1)}}]),vertexShader:["#define PHONG\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif",THREE.ShaderChunk.common, THREE.ShaderChunk.map_pars_vertex,THREE.ShaderChunk.lightmap_pars_vertex,THREE.ShaderChunk.envmap_pars_vertex,THREE.ShaderChunk.lights_phong_pars_vertex,THREE.ShaderChunk.color_pars_vertex,THREE.ShaderChunk.morphtarget_pars_vertex,THREE.ShaderChunk.skinning_pars_vertex,THREE.ShaderChunk.shadowmap_pars_vertex,THREE.ShaderChunk.logdepthbuf_pars_vertex,"void main {",THREE.ShaderChunk.map_vertex,THREE.ShaderChunk.lightmap_vertex,THREE.ShaderChunk.color_vertex,THREE.ShaderChunk.morphnormal_vertex,THREE.ShaderChunk.skinbase_vertex, THREE.ShaderChunk.skinnormal_vertex,THREE.ShaderChunk.defaultnormal_vertex,"#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n#endif",THREE.ShaderChunk.morphtarget_vertex,THREE.ShaderChunk.skinning_vertex,THREE.ShaderChunk.default_vertex,THREE.ShaderChunk.logdepthbuf_vertex,"\tvViewPosition = -mvPosition.xyz;",THREE.ShaderChunk.worldpos_vertex,THREE.ShaderChunk.envmap_vertex,THREE.ShaderChunk.lights_phong_vertex,THREE.ShaderChunk.shadowmap_vertex,"}"].join("\n"),fragmentShader:["#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;", THREE.ShaderChunk.common,THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_pars_fragment,THREE.ShaderChunk.alphamap_pars_fragment,THREE.ShaderChunk.lightmap_pars_fragment,THREE.ShaderChunk.envmap_pars_fragment,THREE.ShaderChunk.fog_pars_fragment,THREE.ShaderChunk.lights_phong_pars_fragment,THREE.ShaderChunk.shadowmap_pars_fragment,THREE.ShaderChunk.bumpmap_pars_fragment,THREE.ShaderChunk.normalmap_pars_fragment,THREE.ShaderChunk.specularmap_pars_fragment,THREE.ShaderChunk.logdepthbuf_pars_fragment, "void main {\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );",THREE.ShaderChunk.logdepthbuf_fragment,THREE.ShaderChunk.map_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.alphamap_fragment,THREE.ShaderChunk.alphatest_fragment,THREE.ShaderChunk.specularmap_fragment,THREE.ShaderChunk.lights_phong_fragment,THREE.ShaderChunk.lightmap_fragment,THREE.ShaderChunk.envmap_fragment,THREE.ShaderChunk.shadowmap_fragment,THREE.ShaderChunk.linear_to_gamma_fragment, THREE.ShaderChunk.fog_fragment,"\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n}"].join("\n")},particle_basic:{uniforms:THREE.UniformsUtils.merge([THREE.UniformsLib.particle,THREE.UniformsLib.shadowmap]),vertexShader:["uniform float size;\nuniform float scale;",THREE.ShaderChunk.common,THREE.ShaderChunk.color_pars_vertex,THREE.ShaderChunk.shadowmap_pars_vertex,THREE.ShaderChunk.logdepthbuf_pars_vertex,"void main {",THREE.ShaderChunk.color_vertex,"\tvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n\t#ifdef USE_SIZEATTENUATION\n\t\tgl_PointSize = size * ( scale / length( mvPosition.xyz ) );\n\t#else\n\t\tgl_PointSize = size;\n\t#endif\n\tgl_Position = projectionMatrix * mvPosition;", THREE.ShaderChunk.logdepthbuf_vertex,THREE.ShaderChunk.worldpos_vertex,THREE.ShaderChunk.shadowmap_vertex,"}"].join("\n"),fragmentShader:["uniform vec3 psColor;\nuniform float opacity;",THREE.ShaderChunk.common,THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_particle_pars_fragment,THREE.ShaderChunk.fog_pars_fragment,THREE.ShaderChunk.shadowmap_pars_fragment,THREE.ShaderChunk.logdepthbuf_pars_fragment,"void main {\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( psColor, opacity );", THREE.ShaderChunk.logdepthbuf_fragment,THREE.ShaderChunk.map_particle_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.alphatest_fragment,"\toutgoingLight = diffuseColor.rgb;",THREE.ShaderChunk.shadowmap_fragment,THREE.ShaderChunk.fog_fragment,"\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n}"].join("\n")},dashed:{uniforms:THREE.UniformsUtils.merge([THREE.UniformsLib.common,THREE.UniformsLib.fog,{scale:{type:"f",value:1},dashSize:{type:"f",value:1},totalSize:{type:"f",value:2}}]), vertexShader:["uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;",THREE.ShaderChunk.common,THREE.ShaderChunk.color_pars_vertex,THREE.ShaderChunk.logdepthbuf_pars_vertex,"void main {",THREE.ShaderChunk.color_vertex,"\tvLineDistance = scale * lineDistance;\n\tvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n\tgl_Position = projectionMatrix * mvPosition;",THREE.ShaderChunk.logdepthbuf_vertex,"}"].join("\n"),fragmentShader:["uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;", THREE.ShaderChunk.common,THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.fog_pars_fragment,THREE.ShaderChunk.logdepthbuf_pars_fragment,"void main {\n\tif ( mod( vLineDistance, totalSize ) > dashSize ) {\n\t\tdiscard;\n\t}\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );",THREE.ShaderChunk.logdepthbuf_fragment,THREE.ShaderChunk.color_fragment,"\toutgoingLight = diffuseColor.rgb;",THREE.ShaderChunk.fog_fragment,"\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n}"].join("\n")}, depth:{uniforms:{mNear:{type:"f",value:1},mFar:{type:"f",value:2E3},opacity:{type:"f",value:1}},vertexShader:[THREE.ShaderChunk.common,THREE.ShaderChunk.morphtarget_pars_vertex,THREE.ShaderChunk.logdepthbuf_pars_vertex,"void main {",THREE.ShaderChunk.morphtarget_vertex,THREE.ShaderChunk.default_vertex,THREE.ShaderChunk.logdepthbuf_vertex,"}"].join("\n"),fragmentShader:["uniform float mNear;\nuniform float mFar;\nuniform float opacity;",THREE.ShaderChunk.common,THREE.ShaderChunk.logdepthbuf_pars_fragment, "void main {",THREE.ShaderChunk.logdepthbuf_fragment,"\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tfloat depth = gl_FragDepthEXT / gl_FragCoord.w;\n\t#else\n\t\tfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n\t#endif\n\tfloat color = 1.0 - smoothstep( mNear, mFar, depth );\n\tgl_FragColor = vec4( vec3( color ), opacity );\n}"].join("\n")},normal:{uniforms:{opacity:{type:"f",value:1}},vertexShader:["varying vec3 vNormal;",THREE.ShaderChunk.common,THREE.ShaderChunk.morphtarget_pars_vertex,THREE.ShaderChunk.logdepthbuf_pars_vertex, "void main {\n\tvNormal = normalize( normalMatrix * normal );",THREE.ShaderChunk.morphtarget_vertex,THREE.ShaderChunk.default_vertex,THREE.ShaderChunk.logdepthbuf_vertex,"}"].join("\n"),fragmentShader:["uniform float opacity;\nvarying vec3 vNormal;",THREE.ShaderChunk.common,THREE.ShaderChunk.logdepthbuf_pars_fragment,"void main {\n\tgl_FragColor = vec4( 0.5 * normalize( vNormal ) + 0.5, opacity );",THREE.ShaderChunk.logdepthbuf_fragment,"}"].join("\n")},cube:{uniforms:{tCube:{type:"t",value:null}, tFlip:{type:"f",value:-1}},vertexShader:["varying vec3 vWorldPosition;",THREE.ShaderChunk.common,THREE.ShaderChunk.logdepthbuf_pars_vertex,"void main {\n\tvWorldPosition = transformDirection( position, modelMatrix );\n\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",THREE.ShaderChunk.logdepthbuf_vertex,"}"].join("\n"),fragmentShader:["uniform samplerCube tCube;\nuniform float tFlip;\nvarying vec3 vWorldPosition;",THREE.ShaderChunk.common,THREE.ShaderChunk.logdepthbuf_pars_fragment, "void main {\n\tgl_FragColor = textureCube( tCube, vec3( tFlip * vWorldPosition.x, vWorldPosition.yz ) );",THREE.ShaderChunk.logdepthbuf_fragment,"}"].join("\n")},equirect:{uniforms:{tEquirect:{type:"t",value:null},tFlip:{type:"f",value:-1}},vertexShader:["varying vec3 vWorldPosition;",THREE.ShaderChunk.common,THREE.ShaderChunk.logdepthbuf_pars_vertex,"void main {\n\tvWorldPosition = transformDirection( position, modelMatrix );\n\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );", THREE.ShaderChunk.logdepthbuf_vertex,"}"].join("\n"),fragmentShader:["uniform sampler2D tEquirect;\nuniform float tFlip;\nvarying vec3 vWorldPosition;",THREE.ShaderChunk.common,THREE.ShaderChunk.logdepthbuf_pars_fragment,"void main {\nvec3 direction = normalize( vWorldPosition );\nvec2 sampleUV;\nsampleUV.y = saturate( tFlip * direction.y * -0.5 + 0.5 );\nsampleUV.x = atan( direction.z, direction.x ) * RECIPROCAL_PI2 + 0.5;\ngl_FragColor = texture2D( tEquirect, sampleUV );",THREE.ShaderChunk.logdepthbuf_fragment, "}"].join("\n")},depthRGBA:{uniforms:{},vertexShader:[THREE.ShaderChunk.common,THREE.ShaderChunk.morphtarget_pars_vertex,THREE.ShaderChunk.skinning_pars_vertex,THREE.ShaderChunk.logdepthbuf_pars_vertex,"void main {",THREE.ShaderChunk.skinbase_vertex,THREE.ShaderChunk.morphtarget_vertex,THREE.ShaderChunk.skinning_vertex,THREE.ShaderChunk.default_vertex,THREE.ShaderChunk.logdepthbuf_vertex,"}"].join("\n"),fragmentShader:[THREE.ShaderChunk.common,THREE.ShaderChunk.logdepthbuf_pars_fragment,"vec4 pack_depth( const in float depth ) {\n\tconst vec4 bit_shift = vec4( 256.0 * 256.0 * 256.0, 256.0 * 256.0, 256.0, 1.0 );\n\tconst vec4 bit_mask = vec4( 0.0, 1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0 );\n\tvec4 res = mod( depth * bit_shift * vec4( 255 ), vec4( 256 ) ) / vec4( 255 );\n\tres -= res.xxyz * bit_mask;\n\treturn res;\n}\nvoid main {", THREE.ShaderChunk.logdepthbuf_fragment,"\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tgl_FragData[ 0 ] = pack_depth( gl_FragDepthEXT );\n\t#else\n\t\tgl_FragData[ 0 ] = pack_depth( gl_FragCoord.z );\n\t#endif\n}"].join("\n")}}; THREE.WebGLRenderer=function(a){function b(a){var b=a.geometry;a=a.material;var c=b.vertices.length;if(a.attributes){void 0===b.__webglCustomAttributesList&&(b.__webglCustomAttributesList=[]);for(var d in a.attributes){var e=a.attributes[d];if(!e.__webglInitialized||e.createUniqueBuffers){e.__webglInitialized=!0;var f=1;"v2"===e.type?f=2:"v3"===e.type?f=3:"v4"===e.type?f=4:"c"===e.type&&(f=3);e.size=f;e.array=new Float32Array(c*f);e.buffer=m.createBuffer;e.buffer.belongsToAttribute=d;e.needsUpdate= !0}b.__webglCustomAttributesList.push(e)}}}function c(a,b){return a.material instanceof THREE.MeshFaceMaterial?a.material.materials[b.materialIndex]:a.material}function d(a,b,c,d){c=c.attributes;var e=b.attributes;b=b.attributesKeys;for(var f=0,g=b.length;f<g;f++){var h=b[f],k=e[h];if(0<=k){var n=c[h];void 0!==n?(h=n.itemSize,m.bindBuffer(m.ARRAY_BUFFER,n.buffer),W.enableAttribute(k),m.vertexAttribPointer(k,h,m.FLOAT,!1,0,d*h*4)):void 0!==a.defaultAttributeValues&&(2===a.defaultAttributeValues[h].length? m.vertexAttrib2fv(k,a.defaultAttributeValues[h]):3===a.defaultAttributeValues[h].length&&m.vertexAttrib3fv(k,a.defaultAttributeValues[h]))}}W.disableUnusedAttributes}function e(a,b){return a.object.renderOrder!==b.object.renderOrder?a.object.renderOrder-b.object.renderOrder:a.material.id!==b.material.id?a.material.id-b.material.id:a.z!==b.z?a.z-b.z:a.id-b.id}function f(a,b){return a.object.renderOrder!==b.object.renderOrder?a.object.renderOrder-b.object.renderOrder:a.z!==b.z?b.z-a.z:a.id-b.id}function g(a, b){return b[0]-a[0]}function h(a){if(!1!==a.visible){if(!(a instanceof THREE.Scene||a instanceof THREE.Group)){void 0===a.__webglInit&&(a.__webglInit=!0,a._modelViewMatrix=new THREE.Matrix4,a._normalMatrix=new THREE.Matrix3,a.addEventListener("removed",wb));var c=a.geometry;if(void 0!==c&&void 0===c.__webglInit)if(c.__webglInit=!0,c.addEventListener("dispose",jb),c instanceof THREE.BufferGeometry)B.info.memory.geometries++;else if(a instanceof THREE.Mesh)q(a,c);else if(a instanceof THREE.Line){if(void 0=== c.__webglVertexBuffer){c.__webglVertexBuffer=m.createBuffer;c.__webglColorBuffer=m.createBuffer;c.__webglLineDistanceBuffer=m.createBuffer;B.info.memory.geometries++;var d=c.vertices.length;c.__vertexArray=new Float32Array(3*d);c.__colorArray=new Float32Array(3*d);c.__lineDistanceArray=new Float32Array(1*d);c.__webglLineCount=d;b(a);c.verticesNeedUpdate=!0;c.colorsNeedUpdate=!0;c.lineDistancesNeedUpdate=!0}}else a instanceof THREE.PointCloud&&void 0===c.__webglVertexBuffer&&(c.__webglVertexBuffer= m.createBuffer,c.__webglColorBuffer=m.createBuffer,B.info.memory.geometries++,d=c.vertices.length,c.__vertexArray=new Float32Array(3*d),c.__colorArray=new Float32Array(3*d),c.__webglParticleCount=d,b(a),c.verticesNeedUpdate=!0,c.colorsNeedUpdate=!0);if(void 0===a.__webglActive)if(a.__webglActive=!0,a instanceof THREE.Mesh)if(c instanceof THREE.BufferGeometry)n(ba,c,a);else{if(c instanceof THREE.Geometry)for(var c=Ua[c.id],d=0,e=c.length;d<e;d++)n(ba,c[d],a)}else a instanceof THREE.Line||a instanceof THREE.PointCloud?n(ba,c,a):(a instanceof THREE.ImmediateRenderObject||a.immediateRenderCallback)&&qa.push({id:null,object:a,opaque:null,transparent:null,z:0});if(a instanceof THREE.Light)ca.push(a);else if(a instanceof THREE.Sprite)Xa.push(a);else if(a instanceof THREE.LensFlare)Ya.push(a);else if((c=ba[a.id])&&(!1===a.frustumCulled||!0===cb.intersectsObject(a)))for(d=0,e=c.length;d<e;d++){var f=c[d],g=f,k=g.object,l=g.buffer,p=k.geometry,k=k.material;k instanceof THREE.MeshFaceMaterial?(k=k.materials[p instanceof THREE.BufferGeometry?0:l.materialIndex],g.material=k,k.transparent?Qa.push(g):Ka.push(g)):k&&(g.material=k,k.transparent?Qa.push(g):Ka.push(g));f.render=!0;!0===B.sortObjects&&(wa.setFromMatrixPosition(a.matrixWorld),wa.applyProjection(db),f.z=wa.z)}}d=0;for(e=a.children.length;d<e;d++)h(a.children[d])}}function k(a,b,c,d,e){for(var f,g=0,h=a.length;g<h;g++){f=a[g];var k=f.object,m=f.buffer;w(k,b);if(e)f=e;else{f=f.material;if(!f)continue;u(f)}B.setMaterialFaces(f);m instanceof THREE.BufferGeometry? B.renderBufferDirect(b,c,d,f,m,k):B.renderBuffer(b,c,d,f,m,k)}}function l(a,b,c,d,e,f){for(var g,h=0,k=a.length;h<k;h++){g=a[h];var m=g.object;if(m.visible){if(f)g=f;else{g=g[b];if(!g)continue;u(g)}B.renderImmediateObject(c,d,e,g,m)}}}function p(a){var b=a.object.material;b.transparent?(a.transparent=b,a.opaque=null):(a.opaque=b,a.transparent=null)}function q(a,b){var d=a.material,e=!1;if(void 0===Ua[b.id]||!0===b.groupsNeedUpdate){delete ba[a.id];for(var f=Ua,g=b.id,d=d instanceof THREE.MeshFaceMaterial, h=da.get("OES_element_index_uint")?4294967296:65535,k,e={},l=b.morphTargets.length,p=b.morphNormals.length,q,s={},t=[],r=0,w=b.faces.length;r<w;r++){k=b.faces[r];var u=d?k.materialIndex:0;u in e||(e[u]={hash:u,counter:0});k=e[u].hash+"_"+e[u].counter;k in s||(q={id:Qb++,faces3:[],materialIndex:u,vertices:0,numMorphTargets:l,numMorphNormals:p},s[k]=q,t.push(q));s[k].vertices+3>h&&(e[u].counter+=1,k=e[u].hash+"_"+e[u].counter,k in s||(q={id:Qb++,faces3:[],materialIndex:u,vertices:0,numMorphTargets:l, numMorphNormals:p},s[k]=q,t.push(q)));s[k].faces3.push(r);s[k].vertices+=3}f[g]=t;b.groupsNeedUpdate=!1}f=Ua[b.id];g=0;for(d=f.length;g<d;g++){h=f[g];if(void 0===h.__webglVertexBuffer){e=h;e.__webglVertexBuffer=m.createBuffer;e.__webglNormalBuffer=m.createBuffer;e.__webglTangentBuffer=m.createBuffer;e.__webglColorBuffer=m.createBuffer;e.__webglUVBuffer=m.createBuffer;e.__webglUV2Buffer=m.createBuffer;e.__webglSkinIndicesBuffer=m.createBuffer;e.__webglSkinWeightsBuffer=m.createBuffer; e.__webglFaceBuffer=m.createBuffer;e.__webglLineBuffer=m.createBuffer;if(p=e.numMorphTargets)for(e.__webglMorphTargetsBuffers=[],l=0;l<p;l++)e.__webglMorphTargetsBuffers.push(m.createBuffer);if(p=e.numMorphNormals)for(e.__webglMorphNormalsBuffers=[],l=0;l<p;l++)e.__webglMorphNormalsBuffers.push(m.createBuffer);B.info.memory.geometries++;e=h;r=a;w=r.geometry;p=e.faces3;l=3*p.length;s=1*p.length;t=3*p.length;p=c(r,e);e.__vertexArray=new Float32Array(3*l);e.__normalArray=new Float32Array(3*l); e.__colorArray=new Float32Array(3*l);e.__uvArray=new Float32Array(2*l);1<w.faceVertexUvs.length&&(e.__uv2Array=new Float32Array(2*l));w.hasTangents&&(e.__tangentArray=new Float32Array(4*l));r.geometry.skinWeights.length&&r.geometry.skinIndices.length&&(e.__skinIndexArray=new Float32Array(4*l),e.__skinWeightArray=new Float32Array(4*l));r=null!==da.get("OES_element_index_uint")&&21845<s?Uint32Array:Uint16Array;e.__typeArray=r;e.__faceArray=new r(3*s);e.__lineArray=new r(2*t);if(w=e.numMorphTargets)for(e.__morphTargetsArrays= [],r=0;r<w;r++)e.__morphTargetsArrays.push(new Float32Array(3*l));if(w=e.numMorphNormals)for(e.__morphNormalsArrays=[],r=0;r<w;r++)e.__morphNormalsArrays.push(new Float32Array(3*l));e.__webglFaceCount=3*s;e.__webglLineCount=2*t;if(p.attributes)for(s in void 0===e.__webglCustomAttributesList&&(e.__webglCustomAttributesList=[]),s=void 0,p.attributes){var t=p.attributes[s],r={},v;for(v in t)r[v]=t[v];if(!r.__webglInitialized||r.createUniqueBuffers)r.__webglInitialized=!0,w=1,"v2"===r.type?w=2:"v3"=== r.type?w=3:"v4"===r.type?w=4:"c"===r.type&&(w=3),r.size=w,r.array=new Float32Array(l*w),r.buffer=m.createBuffer,r.buffer.belongsToAttribute=s,t.needsUpdate=!0,r.__original=t;e.__webglCustomAttributesList.push(r)}e.__inittedArrays=!0;b.verticesNeedUpdate=!0;b.morphTargetsNeedUpdate=!0;b.elementsNeedUpdate=!0;b.uvsNeedUpdate=!0;b.normalsNeedUpdate=!0;b.tangentsNeedUpdate=!0;e=b.colorsNeedUpdate=!0}else e=!1;(e||void 0===a.__webglActive)&&n(ba,h,a)}a.__webglActive=!0}function n(a,b,c){var d=c.id;a[d]= a[d]||[];a[d].push({id:d,buffer:b,object:c,material:null,z:0})}function t(a){var b=a.geometry;if(b instanceof THREE.BufferGeometry)for(var d=b.attributes,e=b.attributesKeys,f=0,g=e.length;f<g;f++){var h=e[f],k=d[h],n="index"===h?m.ELEMENT_ARRAY_BUFFER:m.ARRAY_BUFFER;void 0===k.buffer?(k.buffer=m.createBuffer,m.bindBuffer(n,k.buffer),m.bufferData(n,k.array,k instanceof THREE.DynamicBufferAttribute?m.DYNAMIC_DRAW:m.STATIC_DRAW),k.needsUpdate=!1):!0===k.needsUpdate&&(m.bindBuffer(n,k.buffer),void 0=== k.updateRange||-1===k.updateRange.count?m.bufferSubData(n,0,k.array):0===k.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."):(m.bufferSubData(n,k.updateRange.offset*k.array.BYTES_PER_ELEMENT,k.array.subarray(k.updateRange.offset,k.updateRange.offset+k.updateRange.count)),k.updateRange.count=0),k.needsUpdate=!1)}else if(a instanceof THREE.Mesh){!0=== b.groupsNeedUpdate&&q(a,b);for(var l=Ua[b.id],f=0,p=l.length;f<p;f++){var t=l[f],w=c(a,t),u=w.attributes&&r(w);if(b.verticesNeedUpdate||b.morphTargetsNeedUpdate||b.elementsNeedUpdate||b.uvsNeedUpdate||b.normalsNeedUpdate||b.colorsNeedUpdate||b.tangentsNeedUpdate||u){var v=t,x=a,D=m.DYNAMIC_DRAW,A=!b.dynamic,E=w;if(v.__inittedArrays){var G=!1===E instanceof THREE.MeshPhongMaterial&&E.shading===THREE.FlatShading,y=void 0,z=void 0,F=void 0,B=void 0,I=void 0,H=void 0,M=void 0,R=void 0,P=void 0,U=void 0, O=void 0,J=void 0,L=void 0,N=void 0,Ka=void 0,V=void 0,W=void 0,Qa=void 0,Ya=void 0,Xa=void 0,da=void 0,ba=void 0,ja=void 0,Pa=void 0,ka=void 0,Q=void 0,ha=void 0,ia=void 0,ob=void 0,Y=void 0,ub=void 0,pa=void 0,ab=void 0,oa=void 0,ca=void 0,qa=void 0,Ca=void 0,ta=void 0,na=void 0,wa=void 0,La=0,Ma=0,kb=0,yb=0,zb=0,Ra=0,Aa=0,eb=0,Ha=0,la=0,ra=0,K=0,za=void 0,Sa=v.__vertexArray,Ab=v.__uvArray,lb=v.__uv2Array,Na=v.__normalArray,sa=v.__tangentArray,Da=v.__colorArray,Ea=v.__skinIndexArray,Fa=v.__skinWeightArray, Gb=v.__morphTargetsArrays,Bb=v.__morphNormalsArrays,mb=v.__webglCustomAttributesList,C=void 0,Va=v.__faceArray,Ta=v.__lineArray,ea=x.geometry,fb=ea.elementsNeedUpdate,vb=ea.uvsNeedUpdate,Mb=ea.normalsNeedUpdate,Ob=ea.tangentsNeedUpdate,ib=ea.colorsNeedUpdate,sb=ea.morphTargetsNeedUpdate,Cb=ea.vertices,$=v.faces3,xa=ea.faces,Hb=ea.faceVertexUvs[0],Oa=ea.faceVertexUvs[1],$a=ea.skinIndices,Ga=ea.skinWeights,nb=ea.morphTargets,bb=ea.morphNormals;if(ea.verticesNeedUpdate){y=0;for(z=$.length;y<z;y++)B= xa[$[y]],J=Cb[B.a],L=Cb[B.b],N=Cb[B.c],Sa[Ma]=J.x,Sa[Ma+1]=J.y,Sa[Ma+2]=J.z,Sa[Ma+3]=L.x,Sa[Ma+4]=L.y,Sa[Ma+5]=L.z,Sa[Ma+6]=N.x,Sa[Ma+7]=N.y,Sa[Ma+8]=N.z,Ma+=9;m.bindBuffer(m.ARRAY_BUFFER,v.__webglVertexBuffer);m.bufferData(m.ARRAY_BUFFER,Sa,D)}if(sb)for(ca=0,qa=nb.length;ca<qa;ca++){y=ra=0;for(z=$.length;y<z;y++)na=$[y],B=xa[na],J=nb[ca].vertices[B.a],L=nb[ca].vertices[B.b],N=nb[ca].vertices[B.c],Ca=Gb[ca],Ca[ra]=J.x,Ca[ra+1]=J.y,Ca[ra+2]=J.z,Ca[ra+3]=L.x,Ca[ra+4]=L.y,Ca[ra+5]=L.z,Ca[ra+6]=N.x,Ca[ra+ 7]=N.y,Ca[ra+8]=N.z,E.morphNormals&&(G?Xa=Ya=Qa=bb[ca].faceNormals[na]:(wa=bb[ca].vertexNormals[na],Qa=wa.a,Ya=wa.b,Xa=wa.c),ta=Bb[ca],ta[ra]=Qa.x,ta[ra+1]=Qa.y,ta[ra+2]=Qa.z,ta[ra+3]=Ya.x,ta[ra+4]=Ya.y,ta[ra+5]=Ya.z,ta[ra+6]=Xa.x,ta[ra+7]=Xa.y,ta[ra+8]=Xa.z),ra+=9;m.bindBuffer(m.ARRAY_BUFFER,v.__webglMorphTargetsBuffers[ca]);m.bufferData(m.ARRAY_BUFFER,Gb[ca],D);E.morphNormals&&(m.bindBuffer(m.ARRAY_BUFFER,v.__webglMorphNormalsBuffers[ca]),m.bufferData(m.ARRAY_BUFFER,Bb[ca],D))}if(Ga.length){y=0; for(z=$.length;y<z;y++)B=xa[$[y]],Pa=Ga[B.a],ka=Ga[B.b],Q=Ga[B.c],Fa[la]=Pa.x,Fa[la+1]=Pa.y,Fa[la+2]=Pa.z,Fa[la+3]=Pa.w,Fa[la+4]=ka.x,Fa[la+5]=ka.y,Fa[la+6]=ka.z,Fa[la+7]=ka.w,Fa[la+8]=Q.x,Fa[la+9]=Q.y,Fa[la+10]=Q.z,Fa[la+11]=Q.w,ha=$a[B.a],ia=$a[B.b],ob=$a[B.c],Ea[la]=ha.x,Ea[la+1]=ha.y,Ea[la+2]=ha.z,Ea[la+3]=ha.w,Ea[la+4]=ia.x,Ea[la+5]=ia.y,Ea[la+6]=ia.z,Ea[la+7]=ia.w,Ea[la+8]=ob.x,Ea[la+9]=ob.y,Ea[la+10]=ob.z,Ea[la+11]=ob.w,la+=12;0<la&&(m.bindBuffer(m.ARRAY_BUFFER,v.__webglSkinIndicesBuffer), m.bufferData(m.ARRAY_BUFFER,Ea,D),m.bindBuffer(m.ARRAY_BUFFER,v.__webglSkinWeightsBuffer),m.bufferData(m.ARRAY_BUFFER,Fa,D))}if(ib){y=0;for(z=$.length;y<z;y++)B=xa[$[y]],M=B.vertexColors,R=B.color,3===M.length&&E.vertexColors===THREE.VertexColors?(da=M[0],ba=M[1],ja=M[2]):ja=ba=da=R,Da[Ha]=da.r,Da[Ha+1]=da.g,Da[Ha+2]=da.b,Da[Ha+3]=ba.r,Da[Ha+4]=ba.g,Da[Ha+5]=ba.b,Da[Ha+6]=ja.r,Da[Ha+7]=ja.g,Da[Ha+8]=ja.b,Ha+=9;0<Ha&&(m.bindBuffer(m.ARRAY_BUFFER,v.__webglColorBuffer),m.bufferData(m.ARRAY_BUFFER,Da, D))}if(Ob&&ea.hasTangents){y=0;for(z=$.length;y<z;y++)B=xa[$[y]],P=B.vertexTangents,Ka=P[0],V=P[1],W=P[2],sa[Aa]=Ka.x,sa[Aa+1]=Ka.y,sa[Aa+2]=Ka.z,sa[Aa+3]=Ka.w,sa[Aa+4]=V.x,sa[Aa+5]=V.y,sa[Aa+6]=V.z,sa[Aa+7]=V.w,sa[Aa+8]=W.x,sa[Aa+9]=W.y,sa[Aa+10]=W.z,sa[Aa+11]=W.w,Aa+=12;m.bindBuffer(m.ARRAY_BUFFER,v.__webglTangentBuffer);m.bufferData(m.ARRAY_BUFFER,sa,D)}if(Mb){y=0;for(z=$.length;y<z;y++)if(B=xa[$[y]],I=B.vertexNormals,H=B.normal,3===I.length&&!1===G)for(Y=0;3>Y;Y++)pa=I[Y],Na[Ra]=pa.x,Na[Ra+1]= pa.y,Na[Ra+2]=pa.z,Ra+=3;else for(Y=0;3>Y;Y++)Na[Ra]=H.x,Na[Ra+1]=H.y,Na[Ra+2]=H.z,Ra+=3;m.bindBuffer(m.ARRAY_BUFFER,v.__webglNormalBuffer);m.bufferData(m.ARRAY_BUFFER,Na,D)}if(vb&&Hb){y=0;for(z=$.length;y<z;y++)if(F=$[y],U=Hb[F],void 0!==U)for(Y=0;3>Y;Y++)ab=U[Y],Ab[kb]=ab.x,Ab[kb+1]=ab.y,kb+=2;0<kb&&(m.bindBuffer(m.ARRAY_BUFFER,v.__webglUVBuffer),m.bufferData(m.ARRAY_BUFFER,Ab,D))}if(vb&&Oa){y=0;for(z=$.length;y<z;y++)if(F=$[y],O=Oa[F],void 0!==O)for(Y=0;3>Y;Y++)oa=O[Y],lb[yb]=oa.x,lb[yb+1]=oa.y, yb+=2;0<yb&&(m.bindBuffer(m.ARRAY_BUFFER,v.__webglUV2Buffer),m.bufferData(m.ARRAY_BUFFER,lb,D))}if(fb){y=0;for(z=$.length;y<z;y++)Va[zb]=La,Va[zb+1]=La+1,Va[zb+2]=La+2,zb+=3,Ta[eb]=La,Ta[eb+1]=La+1,Ta[eb+2]=La,Ta[eb+3]=La+2,Ta[eb+4]=La+1,Ta[eb+5]=La+2,eb+=6,La+=3;m.bindBuffer(m.ELEMENT_ARRAY_BUFFER,v.__webglFaceBuffer);m.bufferData(m.ELEMENT_ARRAY_BUFFER,Va,D);m.bindBuffer(m.ELEMENT_ARRAY_BUFFER,v.__webglLineBuffer);m.bufferData(m.ELEMENT_ARRAY_BUFFER,Ta,D)}if(mb)for(Y=0,ub=mb.length;Y<ub;Y++)if(C= mb[Y],C.__original.needsUpdate){K=0;if(1===C.size)if(void 0===C.boundTo||"vertices"===C.boundTo)for(y=0,z=$.length;y<z;y++)B=xa[$[y]],C.array[K]=C.value[B.a],C.array[K+1]=C.value[B.b],C.array[K+2]=C.value[B.c],K+=3;else{if("faces"===C.boundTo)for(y=0,z=$.length;y<z;y++)za=C.value[$[y]],C.array[K]=za,C.array[K+1]=za,C.array[K+2]=za,K+=3}else if(2===C.size)if(void 0===C.boundTo||"vertices"===C.boundTo)for(y=0,z=$.length;y<z;y++)B=xa[$[y]],J=C.value[B.a],L=C.value[B.b],N=C.value[B.c],C.array[K]=J.x, C.array[K+1]=J.y,C.array[K+2]=L.x,C.array[K+3]=L.y,C.array[K+4]=N.x,C.array[K+5]=N.y,K+=6;else{if("faces"===C.boundTo)for(y=0,z=$.length;y<z;y++)N=L=J=za=C.value[$[y]],C.array[K]=J.x,C.array[K+1]=J.y,C.array[K+2]=L.x,C.array[K+3]=L.y,C.array[K+4]=N.x,C.array[K+5]=N.y,K+=6}else if(3===C.size){var T;T="c"===C.type?["r","g","b"]:["x","y","z"];if(void 0===C.boundTo||"vertices"===C.boundTo)for(y=0,z=$.length;y<z;y++)B=xa[$[y]],J=C.value[B.a],L=C.value[B.b],N=C.value[B.c],C.array[K]=J[T[0]],C.array[K+1]= J[T[1]],C.array[K+2]=J[T[2]],C.array[K+3]=L[T[0]],C.array[K+4]=L[T[1]],C.array[K+5]=L[T[2]],C.array[K+6]=N[T[0]],C.array[K+7]=N[T[1]],C.array[K+8]=N[T[2]],K+=9;else if("faces"===C.boundTo)for(y=0,z=$.length;y<z;y++)N=L=J=za=C.value[$[y]],C.array[K]=J[T[0]],C.array[K+1]=J[T[1]],C.array[K+2]=J[T[2]],C.array[K+3]=L[T[0]],C.array[K+4]=L[T[1]],C.array[K+5]=L[T[2]],C.array[K+6]=N[T[0]],C.array[K+7]=N[T[1]],C.array[K+8]=N[T[2]],K+=9;else if("faceVertices"===C.boundTo)for(y=0,z=$.length;y<z;y++)za=C.value[$[y]], J=za[0],L=za[1],N=za[2],C.array[K]=J[T[0]],C.array[K+1]=J[T[1]],C.array[K+2]=J[T[2]],C.array[K+3]=L[T[0]],C.array[K+4]=L[T[1]],C.array[K+5]=L[T[2]],C.array[K+6]=N[T[0]],C.array[K+7]=N[T[1]],C.array[K+8]=N[T[2]],K+=9}else if(4===C.size)if(void 0===C.boundTo||"vertices"===C.boundTo)for(y=0,z=$.length;y<z;y++)B=xa[$[y]],J=C.value[B.a],L=C.value[B.b],N=C.value[B.c],C.array[K]=J.x,C.array[K+1]=J.y,C.array[K+2]=J.z,C.array[K+3]=J.w,C.array[K+4]=L.x,C.array[K+5]=L.y,C.array[K+6]=L.z,C.array[K+7]=L.w,C.array[K+ 8]=N.x,C.array[K+9]=N.y,C.array[K+10]=N.z,C.array[K+11]=N.w,K+=12;else if("faces"===C.boundTo)for(y=0,z=$.length;y<z;y++)N=L=J=za=C.value[$[y]],C.array[K]=J.x,C.array[K+1]=J.y,C.array[K+2]=J.z,C.array[K+3]=J.w,C.array[K+4]=L.x,C.array[K+5]=L.y,C.array[K+6]=L.z,C.array[K+7]=L.w,C.array[K+8]=N.x,C.array[K+9]=N.y,C.array[K+10]=N.z,C.array[K+11]=N.w,K+=12;else if("faceVertices"===C.boundTo)for(y=0,z=$.length;y<z;y++)za=C.value[$[y]],J=za[0],L=za[1],N=za[2],C.array[K]=J.x,C.array[K+1]=J.y,C.array[K+2]= J.z,C.array[K+3]=J.w,C.array[K+4]=L.x,C.array[K+5]=L.y,C.array[K+6]=L.z,C.array[K+7]=L.w,C.array[K+8]=N.x,C.array[K+9]=N.y,C.array[K+10]=N.z,C.array[K+11]=N.w,K+=12;m.bindBuffer(m.ARRAY_BUFFER,C.buffer);m.bufferData(m.ARRAY_BUFFER,C.array,D)}A&&(delete v.__inittedArrays,delete v.__colorArray,delete v.__normalArray,delete v.__tangentArray,delete v.__uvArray,delete v.__uv2Array,delete v.__faceArray,delete v.__vertexArray,delete v.__lineArray,delete v.__skinIndexArray,delete v.__skinWeightArray)}}}b.verticesNeedUpdate= !1;b.morphTargetsNeedUpdate=!1;b.elementsNeedUpdate=!1;b.uvsNeedUpdate=!1;b.normalsNeedUpdate=!1;b.colorsNeedUpdate=!1;b.tangentsNeedUpdate=!1;w.attributes&&s(w)}else if(a instanceof THREE.Line){w=c(a,b);u=w.attributes&&r(w);if(b.verticesNeedUpdate||b.colorsNeedUpdate||b.lineDistancesNeedUpdate||u){var Db=m.DYNAMIC_DRAW,S,aa,Z,Ba,X,Eb,Rb=b.vertices,Ib=b.colors,gb=b.lineDistances,ya=Rb.length,pb=Ib.length,qb=gb.length,Wa=b.__vertexArray,tb=b.__colorArray,hb=b.__lineDistanceArray,$b=b.colorsNeedUpdate, Fb=b.lineDistancesNeedUpdate,Sb=b.__webglCustomAttributesList,Jb,cb,ua,Kb,Ia,fa;if(b.verticesNeedUpdate){for(S=0;S<ya;S++)Ba=Rb[S],X=3*S,Wa[X]=Ba.x,Wa[X+1]=Ba.y,Wa[X+2]=Ba.z;m.bindBuffer(m.ARRAY_BUFFER,b.__webglVertexBuffer);m.bufferData(m.ARRAY_BUFFER,Wa,Db)}if($b){for(aa=0;aa<pb;aa++)Eb=Ib[aa],X=3*aa,tb[X]=Eb.r,tb[X+1]=Eb.g,tb[X+2]=Eb.b;m.bindBuffer(m.ARRAY_BUFFER,b.__webglColorBuffer);m.bufferData(m.ARRAY_BUFFER,tb,Db)}if(Fb){for(Z=0;Z<qb;Z++)hb[Z]=gb[Z];m.bindBuffer(m.ARRAY_BUFFER,b.__webglLineDistanceBuffer); m.bufferData(m.ARRAY_BUFFER,hb,Db)}if(Sb)for(Jb=0,cb=Sb.length;Jb<cb;Jb++)if(fa=Sb[Jb],fa.needsUpdate&&(void 0===fa.boundTo||"vertices"===fa.boundTo)){X=0;Kb=fa.value.length;if(1===fa.size)for(ua=0;ua<Kb;ua++)fa.array[ua]=fa.value[ua];else if(2===fa.size)for(ua=0;ua<Kb;ua++)Ia=fa.value[ua],fa.array[X]=Ia.x,fa.array[X+1]=Ia.y,X+=2;else if(3===fa.size)if("c"===fa.type)for(ua=0;ua<Kb;ua++)Ia=fa.value[ua],fa.array[X]=Ia.r,fa.array[X+1]=Ia.g,fa.array[X+2]=Ia.b,X+=3;else for(ua=0;ua<Kb;ua++)Ia=fa.value[ua], fa.array[X]=Ia.x,fa.array[X+1]=Ia.y,fa.array[X+2]=Ia.z,X+=3;else if(4===fa.size)for(ua=0;ua<Kb;ua++)Ia=fa.value[ua],fa.array[X]=Ia.x,fa.array[X+1]=Ia.y,fa.array[X+2]=Ia.z,fa.array[X+3]=Ia.w,X+=4;m.bindBuffer(m.ARRAY_BUFFER,fa.buffer);m.bufferData(m.ARRAY_BUFFER,fa.array,Db);fa.needsUpdate=!1}}b.verticesNeedUpdate=!1;b.colorsNeedUpdate=!1;b.lineDistancesNeedUpdate=!1;w.attributes&&s(w)}else if(a instanceof THREE.PointCloud){w=c(a,b);u=w.attributes&&r(w);if(b.verticesNeedUpdate||b.colorsNeedUpdate|| u){var db=m.DYNAMIC_DRAW,Tb,Ub,ac,ma,bc,Nb=b.vertices,Vb=Nb.length,Pb=b.colors,rb=Pb.length,cc=b.__vertexArray,dc=b.__colorArray,wb=b.colorsNeedUpdate,gc=b.__webglCustomAttributesList,ec,jb,va,Lb,Ja,ga;if(b.verticesNeedUpdate){for(Tb=0;Tb<Vb;Tb++)ac=Nb[Tb],ma=3*Tb,cc[ma]=ac.x,cc[ma+1]=ac.y,cc[ma+2]=ac.z;m.bindBuffer(m.ARRAY_BUFFER,b.__webglVertexBuffer);m.bufferData(m.ARRAY_BUFFER,cc,db)}if(wb){for(Ub=0;Ub<rb;Ub++)bc=Pb[Ub],ma=3*Ub,dc[ma]=bc.r,dc[ma+1]=bc.g,dc[ma+2]=bc.b;m.bindBuffer(m.ARRAY_BUFFER, b.__webglColorBuffer);m.bufferData(m.ARRAY_BUFFER,dc,db)}if(gc)for(ec=0,jb=gc.length;ec<jb;ec++){ga=gc[ec];if(ga.needsUpdate&&(void 0===ga.boundTo||"vertices"===ga.boundTo))if(Lb=ga.value.length,ma=0,1===ga.size)for(va=0;va<Lb;va++)ga.array[va]=ga.value[va];else if(2===ga.size)for(va=0;va<Lb;va++)Ja=ga.value[va],ga.array[ma]=Ja.x,ga.array[ma+1]=Ja.y,ma+=2;else if(3===ga.size)if("c"===ga.type)for(va=0;va<Lb;va++)Ja=ga.value[va],ga.array[ma]=Ja.r,ga.array[ma+1]=Ja.g,ga.array[ma+2]=Ja.b,ma+=3;else for(va= 0;va<Lb;va++)Ja=ga.value[va],ga.array[ma]=Ja.x,ga.array[ma+1]=Ja.y,ga.array[ma+2]=Ja.z,ma+=3;else if(4===ga.size)for(va=0;va<Lb;va++)Ja=ga.value[va],ga.array[ma]=Ja.x,ga.array[ma+1]=Ja.y,ga.array[ma+2]=Ja.z,ga.array[ma+3]=Ja.w,ma+=4;m.bindBuffer(m.ARRAY_BUFFER,ga.buffer);m.bufferData(m.ARRAY_BUFFER,ga.array,db);ga.needsUpdate=!1}}b.verticesNeedUpdate=!1;b.colorsNeedUpdate=!1;w.attributes&&s(w)}}function r(a){for(var b in a.attributes)if(a.attributes[b].needsUpdate)return!0;return!1}function s(a){for(var b in a.attributes)a.attributes[b].needsUpdate= !1}function u(a){!0===a.transparent?W.setBlending(a.blending,a.blendEquation,a.blendSrc,a.blendDst,a.blendEquationAlpha,a.blendSrcAlpha,a.blendDstAlpha):W.setBlending(THREE.NoBlending);W.setDepthTest(a.depthTest);W.setDepthWrite(a.depthWrite);W.setColorWrite(a.colorWrite);W.setPolygonOffset(a.polygonOffset,a.polygonOffsetFactor,a.polygonOffsetUnits)}function v(a,b,c,d,e){var f,g,h,k;Mb=0;if(d.needsUpdate){d.program&&hc(d);d.addEventListener("dispose",ic);var n=pc[d.type];if(n){var l=THREE.ShaderLib[n]; d.__webglShader={uniforms:THREE.UniformsUtils.clone(l.uniforms),vertexShader:l.vertexShader,fragmentShader:l.fragmentShader}}else d.__webglShader={uniforms:d.uniforms,vertexShader:d.vertexShader,fragmentShader:d.fragmentShader};for(var p=0,q=0,r=0,s=0,t=0,w=b.length;t<w;t++){var v=b[t];v.onlyShadow||!1===v.visible||(v instanceof THREE.DirectionalLight&&p++,v instanceof THREE.PointLight&&q++,v instanceof THREE.SpotLight&&r++,v instanceof THREE.HemisphereLight&&s++)}f=p;g=q;h=r;k=s;for(var u,z=0,G= 0,F=b.length;G<F;G++){var J=b[G];J.castShadow&&(J instanceof THREE.SpotLight&&z++,J instanceof THREE.DirectionalLight&&!J.shadowCascade&&z++)}u=z;var H;if(Nb&&e&&e.skeleton&&e.skeleton.useVertexTexture)H=1024;else{var N=m.getParameter(m.MAX_VERTEX_UNIFORM_VECTORS),M=Math.floor((N-20)/4);void 0!==e&&e instanceof THREE.SkinnedMesh&&(M=Math.min(e.skeleton.bones.length,M),M<e.skeleton.bones.length&&THREE.warn("WebGLRenderer: too many bones - "+e.skeleton.bones.length+", this GPU supports just "+M+" (try OpenGL instead of ANGLE)")); H=M}var P={precision:L,supportsVertexTextures:Vb,map:!!d.map,envMap:!!d.envMap,envMapMode:d.envMap&&d.envMap.mapping,lightMap:!!d.lightMap,bumpMap:!!d.bumpMap,normalMap:!!d.normalMap,specularMap:!!d.specularMap,alphaMap:!!d.alphaMap,combine:d.combine,vertexColors:d.vertexColors,fog:c,useFog:d.fog,fogExp:c instanceof THREE.FogExp2,flatShading:d.shading===THREE.FlatShading,sizeAttenuation:d.sizeAttenuation,logarithmicDepthBuffer:ja,skinning:d.skinning,maxBones:H,useVertexTexture:Nb&&e&&e.skeleton&& e.skeleton.useVertexTexture,morphTargets:d.morphTargets,morphNormals:d.morphNormals,maxMorphTargets:B.maxMorphTargets,maxMorphNormals:B.maxMorphNormals,maxDirLights:f,maxPointLights:g,maxSpotLights:h,maxHemiLights:k,maxShadows:u,shadowMapEnabled:B.shadowMapEnabled&&e.receiveShadow&&0<u,shadowMapType:B.shadowMapType,shadowMapDebug:B.shadowMapDebug,shadowMapCascade:B.shadowMapCascade,alphaTest:d.alphaTest,metal:d.metal,wrapAround:d.wrapAround,doubleSided:d.side===THREE.DoubleSide,flipSided:d.side=== THREE.BackSide},R=[];n?R.push(n):(R.push(d.fragmentShader),R.push(d.vertexShader));if(void 0!==d.defines)for(var O in d.defines)R.push(O),R.push(d.defines[O]);for(O in P)R.push(O),R.push(P[O]);for(var Ka=R.join,V,W=0,Qa=Pa.length;W<Qa;W++){var Ya=Pa[W];if(Ya.code===Ka){V=Ya;V.usedTimes++;break}}void 0===V&&(V=new THREE.WebGLProgram(B,Ka,d,P),Pa.push(V),B.info.memory.programs=Pa.length);d.program=V;var Xa=V.attributes;if(d.morphTargets){d.numSupportedMorphTargets=0;for(var ca,da="morphTarget",ba= 0;ba<B.maxMorphTargets;ba++)ca=da+ba,0<=Xa[ca]&&d.numSupportedMorphTargets++}if(d.morphNormals)for(d.numSupportedMorphNormals=0,da="morphNormal",ba=0;ba<B.maxMorphNormals;ba++)ca=da+ba,0<=Xa[ca]&&d.numSupportedMorphNormals++;d.uniformsList=[];for(var ha in d.__webglShader.uniforms){var ta=d.program.uniforms[ha];ta&&d.uniformsList.push([d.__webglShader.uniforms[ha],ta])}d.needsUpdate=!1}d.morphTargets&&!e.__webglMorphTargetInfluences&&(e.__webglMorphTargetInfluences=new Float32Array(B.maxMorphTargets)); var ab=!1,oa=!1,qa=!1,Ua=d.program,ka=Ua.uniforms,Q=d.__webglShader.uniforms;Ua.id!==ob&&(m.useProgram(Ua.program),ob=Ua.id,qa=oa=ab=!0);d.id!==ub&&(-1===ub&&(qa=!0),ub=d.id,oa=!0);if(ab||a!==vb)m.uniformMatrix4fv(ka.projectionMatrix,!1,a.projectionMatrix.elements),ja&&m.uniform1f(ka.logDepthBufFC,2/(Math.log(a.far+1)/Math.LN2)),a!==vb&&(vb=a),(d instanceof THREE.ShaderMaterial||d instanceof THREE.MeshPhongMaterial||d.envMap)&&null!==ka.cameraPosition&&(wa.setFromMatrixPosition(a.matrixWorld),m.uniform3f(ka.cameraPosition, wa.x,wa.y,wa.z)),(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.MeshBasicMaterial||d instanceof THREE.ShaderMaterial||d.skinning)&&null!==ka.viewMatrix&&m.uniformMatrix4fv(ka.viewMatrix,!1,a.matrixWorldInverse.elements);if(d.skinning)if(e.bindMatrix&&null!==ka.bindMatrix&&m.uniformMatrix4fv(ka.bindMatrix,!1,e.bindMatrix.elements),e.bindMatrixInverse&&null!==ka.bindMatrixInverse&&m.uniformMatrix4fv(ka.bindMatrixInverse,!1,e.bindMatrixInverse.elements), Nb&&e.skeleton&&e.skeleton.useVertexTexture){if(null!==ka.boneTexture){var db=D;m.uniform1i(ka.boneTexture,db);B.setTexture(e.skeleton.boneTexture,db)}null!==ka.boneTextureWidth&&m.uniform1i(ka.boneTextureWidth,e.skeleton.boneTextureWidth);null!==ka.boneTextureHeight&&m.uniform1i(ka.boneTextureHeight,e.skeleton.boneTextureHeight)}else e.skeleton&&e.skeleton.boneMatrices&&null!==ka.boneGlobalMatrices&&m.uniformMatrix4fv(ka.boneGlobalMatrices,!1,e.skeleton.boneMatrices);if(oa){c&&d.fog&&(Q.fogColor.value= c.color,c instanceof THREE.Fog?(Q.fogNear.value=c.near,Q.fogFar.value=c.far):c instanceof THREE.FogExp2&&(Q.fogDensity.value=c.density));if(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d.lights){if(Ob){var qa=!0,ia,Za,Y,bb=0,cb=0,ib=0,xb,pb,qb,Ca,jb,na=jc,rb=na.directional.colors,La=na.directional.positions,Ma=na.point.colors,kb=na.point.positions,yb=na.point.distances,zb=na.point.decays,Ra=na.spot.colors,Aa=na.spot.positions,eb=na.spot.distances,Ha=na.spot.directions, la=na.spot.anglesCos,ra=na.spot.exponents,K=na.spot.decays,za=na.hemi.skyColors,Sa=na.hemi.groundColors,Ab=na.hemi.positions,lb=0,Na=0,sa=0,Da=0,Ea=0,Fa=0,Gb=0,Bb=0,mb=0,C=0,Va=0,Ta=0;ia=0;for(Za=b.length;ia<Za;ia++)Y=b[ia],Y.onlyShadow||(xb=Y.color,Ca=Y.intensity,jb=Y.distance,Y instanceof THREE.AmbientLight?Y.visible&&(bb+=xb.r,cb+=xb.g,ib+=xb.b):Y instanceof THREE.DirectionalLight?(Ea+=1,Y.visible&&(pa.setFromMatrixPosition(Y.matrixWorld),wa.setFromMatrixPosition(Y.target.matrixWorld),pa.sub(wa), pa.normalize,mb=3*lb,La[mb]=pa.x,La[mb+1]=pa.y,La[mb+2]=pa.z,y(rb,mb,xb,Ca),lb+=1)):Y instanceof THREE.PointLight?(Fa+=1,Y.visible&&(C=3*Na,y(Ma,C,xb,Ca),wa.setFromMatrixPosition(Y.matrixWorld),kb[C]=wa.x,kb[C+1]=wa.y,kb[C+2]=wa.z,yb[Na]=jb,zb[Na]=0===Y.distance?0:Y.decay,Na+=1)):Y instanceof THREE.SpotLight?(Gb+=1,Y.visible&&(Va=3*sa,y(Ra,Va,xb,Ca),pa.setFromMatrixPosition(Y.matrixWorld),Aa[Va]=pa.x,Aa[Va+1]=pa.y,Aa[Va+2]=pa.z,eb[sa]=jb,wa.setFromMatrixPosition(Y.target.matrixWorld),pa.sub(wa), pa.normalize,Ha[Va]=pa.x,Ha[Va+1]=pa.y,Ha[Va+2]=pa.z,la[sa]=Math.cos(Y.angle),ra[sa]=Y.exponent,K[sa]=0===Y.distance?0:Y.decay,sa+=1)):Y instanceof THREE.HemisphereLight&&(Bb+=1,Y.visible&&(pa.setFromMatrixPosition(Y.matrixWorld),pa.normalize,Ta=3*Da,Ab[Ta]=pa.x,Ab[Ta+1]=pa.y,Ab[Ta+2]=pa.z,pb=Y.color,qb=Y.groundColor,y(za,Ta,pb,Ca),y(Sa,Ta,qb,Ca),Da+=1)));ia=3*lb;for(Za=Math.max(rb.length,3*Ea);ia<Za;ia++)rb[ia]=0;ia=3*Na;for(Za=Math.max(Ma.length,3*Fa);ia<Za;ia++)Ma[ia]=0;ia=3*sa;for(Za=Math.max(Ra.length, 3*Gb);ia<Za;ia++)Ra[ia]=0;ia=3*Da;for(Za=Math.max(za.length,3*Bb);ia<Za;ia++)za[ia]=0;ia=3*Da;for(Za=Math.max(Sa.length,3*Bb);ia<Za;ia++)Sa[ia]=0;na.directional.length=lb;na.point.length=Na;na.spot.length=sa;na.hemi.length=Da;na.ambient[0]=bb;na.ambient[1]=cb;na.ambient[2]=ib;Ob=!1}if(qa){var ea=jc;Q.ambientLightColor.value=ea.ambient;Q.directionalLightColor.value=ea.directional.colors;Q.directionalLightDirection.value=ea.directional.positions;Q.pointLightColor.value=ea.point.colors;Q.pointLightPosition.value= ea.point.positions;Q.pointLightDistance.value=ea.point.distances;Q.pointLightDecay.value=ea.point.decays;Q.spotLightColor.value=ea.spot.colors;Q.spotLightPosition.value=ea.spot.positions;Q.spotLightDistance.value=ea.spot.distances;Q.spotLightDirection.value=ea.spot.directions;Q.spotLightAngleCos.value=ea.spot.anglesCos;Q.spotLightExponent.value=ea.spot.exponents;Q.spotLightDecay.value=ea.spot.decays;Q.hemisphereLightSkyColor.value=ea.hemi.skyColors;Q.hemisphereLightGroundColor.value=ea.hemi.groundColors; Q.hemisphereLightDirection.value=ea.hemi.positions;x(Q,!0)}else x(Q,!1)}if(d instanceof THREE.MeshBasicMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.MeshPhongMaterial){Q.opacity.value=d.opacity;Q.diffuse.value=d.color;Q.map.value=d.map;Q.lightMap.value=d.lightMap;Q.specularMap.value=d.specularMap;Q.alphaMap.value=d.alphaMap;d.bumpMap&&(Q.bumpMap.value=d.bumpMap,Q.bumpScale.value=d.bumpScale);d.normalMap&&(Q.normalMap.value=d.normalMap,Q.normalScale.value.copy(d.normalScale)); var fb;d.map?fb=d.map:d.specularMap?fb=d.specularMap:d.normalMap?fb=d.normalMap:d.bumpMap?fb=d.bumpMap:d.alphaMap&&(fb=d.alphaMap);if(void 0!==fb){var wb=fb.offset,Qb=fb.repeat;Q.offsetRepeat.value.set(wb.x,wb.y,Qb.x,Qb.y)}Q.envMap.value=d.envMap;Q.flipEnvMap.value=d.envMap instanceof THREE.WebGLRenderTargetCube?1:-1;Q.reflectivity.value=d.reflectivity;Q.refractionRatio.value=d.refractionRatio}if(d instanceof THREE.LineBasicMaterial)Q.diffuse.value=d.color,Q.opacity.value=d.opacity;else if(d instanceof THREE.LineDashedMaterial)Q.diffuse.value=d.color,Q.opacity.value=d.opacity,Q.dashSize.value=d.dashSize,Q.totalSize.value=d.dashSize+d.gapSize,Q.scale.value=d.scale;else if(d instanceof THREE.PointCloudMaterial){if(Q.psColor.value=d.color,Q.opacity.value=d.opacity,Q.size.value=d.size,Q.scale.value=U.height/2,Q.map.value=d.map,null!==d.map){var Wb=d.map.offset,Xb=d.map.repeat;Q.offsetRepeat.value.set(Wb.x,Wb.y,Xb.x,Xb.y)}}else d instanceof THREE.MeshPhongMaterial?(Q.shininess.value=d.shininess,Q.emissive.value= d.emissive,Q.specular.value=d.specular,d.wrapAround&&Q.wrapRGB.value.copy(d.wrapRGB)):d instanceof THREE.MeshLambertMaterial?(Q.emissive.value=d.emissive,d.wrapAround&&Q.wrapRGB.value.copy(d.wrapRGB)):d instanceof THREE.MeshDepthMaterial?(Q.mNear.value=a.near,Q.mFar.value=a.far,Q.opacity.value=d.opacity):d instanceof THREE.MeshNormalMaterial&&(Q.opacity.value=d.opacity);if(e.receiveShadow&&!d._shadowPass&&Q.shadowMatrix)for(var sb=0,Cb=0,$=b.length;Cb<$;Cb++){var xa=b[Cb];xa.castShadow&&(xa instanceof THREE.SpotLight||xa instanceof THREE.DirectionalLight&&!xa.shadowCascade)&&(Q.shadowMap.value[sb]=xa.shadowMap,Q.shadowMapSize.value[sb]=xa.shadowMapSize,Q.shadowMatrix.value[sb]=xa.shadowMatrix,Q.shadowDarkness.value[sb]=xa.shadowDarkness,Q.shadowBias.value[sb]=xa.shadowBias,sb++)}for(var Hb=d.uniformsList,Oa,$a,Ga,nb=0,fc=Hb.length;nb<fc;nb++){var T=Hb[nb][0];if(!1!==T.needsUpdate){var Db=T.type,S=T.value,aa=Hb[nb][1];switch(Db){case "1i":m.uniform1i(aa,S);break;case "1f":m.uniform1f(aa,S);break; case "2f":m.uniform2f(aa,S[0],S[1]);break;case "3f":m.uniform3f(aa,S[0],S[1],S[2]);break;case "4f":m.uniform4f(aa,S[0],S[1],S[2],S[3]);break;case "1iv":m.uniform1iv(aa,S);break;case "3iv":m.uniform3iv(aa,S);break;case "1fv":m.uniform1fv(aa,S);break;case "2fv":m.uniform2fv(aa,S);break;case "3fv":m.uniform3fv(aa,S);break;case "4fv":m.uniform4fv(aa,S);break;case "Matrix3fv":m.uniformMatrix3fv(aa,!1,S);break;case "Matrix4fv":m.uniformMatrix4fv(aa,!1,S);break;case "i":m.uniform1i(aa,S);break;case "f":m.uniform1f(aa, S);break;case "v2":m.uniform2f(aa,S.x,S.y);break;case "v3":m.uniform3f(aa,S.x,S.y,S.z);break;case "v4":m.uniform4f(aa,S.x,S.y,S.z,S.w);break;case "c":m.uniform3f(aa,S.r,S.g,S.b);break;case "iv1":m.uniform1iv(aa,S);break;case "iv":m.uniform3iv(aa,S);break;case "fv1":m.uniform1fv(aa,S);break;case "fv":m.uniform3fv(aa,S);break;case "v2v":void 0===T._array&&(T._array=new Float32Array(2*S.length));for(var Z=0,Ba=S.length;Z<Ba;Z++)Ga=2*Z,T._array[Ga]=S[Z].x,T._array[Ga+1]=S[Z].y;m.uniform2fv(aa,T._array); break;case "v3v":void 0===T._array&&(T._array=new Float32Array(3*S.length));Z=0;for(Ba=S.length;Z<Ba;Z++)Ga=3*Z,T._array[Ga]=S[Z].x,T._array[Ga+1]=S[Z].y,T._array[Ga+2]=S[Z].z;m.uniform3fv(aa,T._array);break;case "v4v":void 0===T._array&&(T._array=new Float32Array(4*S.length));Z=0;for(Ba=S.length;Z<Ba;Z++)Ga=4*Z,T._array[Ga]=S[Z].x,T._array[Ga+1]=S[Z].y,T._array[Ga+2]=S[Z].z,T._array[Ga+3]=S[Z].w;m.uniform4fv(aa,T._array);break;case "m3":m.uniformMatrix3fv(aa,!1,S.elements);break;case "m3v":void 0=== T._array&&(T._array=new Float32Array(9*S.length));Z=0;for(Ba=S.length;Z<Ba;Z++)S[Z].flattenToArrayOffset(T._array,9*Z);m.uniformMatrix3fv(aa,!1,T._array);break;case "m4":m.uniformMatrix4fv(aa,!1,S.elements);break;case "m4v":void 0===T._array&&(T._array=new Float32Array(16*S.length));Z=0;for(Ba=S.length;Z<Ba;Z++)S[Z].flattenToArrayOffset(T._array,16*Z);m.uniformMatrix4fv(aa,!1,T._array);break;case "t":Oa=S;$a=D;m.uniform1i(aa,$a);if(!Oa)continue;if(Oa instanceof THREE.CubeTexture||Oa.image instanceof Array&&6===Oa.image.length){var X=Oa,Eb=$a;if(6===X.image.length)if(X.needsUpdate){X.image.__webglTextureCube||(X.addEventListener("dispose",Pb),X.image.__webglTextureCube=m.createTexture,B.info.memory.textures++);m.activeTexture(m.TEXTURE0+Eb);m.bindTexture(m.TEXTURE_CUBE_MAP,X.image.__webglTextureCube);m.pixelStorei(m.UNPACK_FLIP_Y_WEBGL,X.flipY);for(var Rb=X instanceof THREE.CompressedTexture,Ib=X.image[0]instanceof THREE.DataTexture,gb=[],ya=0;6>ya;ya++)gb[ya]=!B.autoScaleCubemaps||Rb||Ib?Ib? X.image[ya].image:X.image[ya]:E(X.image[ya],qc);var Yb=gb[0],Zb=THREE.Math.isPowerOfTwo(Yb.width)&&THREE.Math.isPowerOfTwo(Yb.height),Wa=I(X.format),tb=I(X.type);A(m.TEXTURE_CUBE_MAP,X,Zb);for(ya=0;6>ya;ya++)if(Rb)for(var hb,$b=gb[ya].mipmaps,Fb=0,Sb=$b.length;Fb<Sb;Fb++)hb=$b[Fb],X.format!==THREE.RGBAFormat&&X.format!==THREE.RGBFormat?-1<kc.indexOf(Wa)?m.compressedTexImage2D(m.TEXTURE_CUBE_MAP_POSITIVE_X+ya,Fb,Wa,hb.width,hb.height,0,hb.data):THREE.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setCubeTexture"): m.texImage2D(m.TEXTURE_CUBE_MAP_POSITIVE_X+ya,Fb,Wa,hb.width,hb.height,0,Wa,tb,hb.data);else Ib?m.texImage2D(m.TEXTURE_CUBE_MAP_POSITIVE_X+ya,0,Wa,gb[ya].width,gb[ya].height,0,Wa,tb,gb[ya].data):m.texImage2D(m.TEXTURE_CUBE_MAP_POSITIVE_X+ya,0,Wa,Wa,tb,gb[ya]);X.generateMipmaps&&Zb&&m.generateMipmap(m.TEXTURE_CUBE_MAP);X.needsUpdate=!1;if(X.onUpdate)X.onUpdate}else m.activeTexture(m.TEXTURE0+Eb),m.bindTexture(m.TEXTURE_CUBE_MAP,X.image.__webglTextureCube)}else if(Oa instanceof THREE.WebGLRenderTargetCube){var Jb= Oa;m.activeTexture(m.TEXTURE0+$a);m.bindTexture(m.TEXTURE_CUBE_MAP,Jb.__webglTexture)}else B.setTexture(Oa,$a);break;case "tv":void 0===T._array&&(T._array=[]);Z=0;for(Ba=T.value.length;Z<Ba;Z++)T._array[Z]=D;m.uniform1iv(aa,T._array);Z=0;for(Ba=T.value.length;Z<Ba;Z++)Oa=T.value[Z],$a=T._array[Z],Oa&&B.setTexture(Oa,$a);break;default:THREE.warn("THREE.WebGLRenderer: Unknown uniform type: "+Db)}}}}m.uniformMatrix4fv(ka.modelViewMatrix,!1,e._modelViewMatrix.elements);ka.normalMatrix&&m.uniformMatrix3fv(ka.normalMatrix, !1,e._normalMatrix.elements);null!==ka.modelMatrix&&m.uniformMatrix4fv(ka.modelMatrix,!1,e.matrixWorld.elements);return Ua}function x(a,b){a.ambientLightColor.needsUpdate=b;a.directionalLightColor.needsUpdate=b;a.directionalLightDirection.needsUpdate=b;a.pointLightColor.needsUpdate=b;a.pointLightPosition.needsUpdate=b;a.pointLightDistance.needsUpdate=b;a.pointLightDecay.needsUpdate=b;a.spotLightColor.needsUpdate=b;a.spotLightPosition.needsUpdate=b;a.spotLightDistance.needsUpdate=b;a.spotLightDirection.needsUpdate= b;a.spotLightAngleCos.needsUpdate=b;a.spotLightExponent.needsUpdate=b;a.spotLightDecay.needsUpdate=b;a.hemisphereLightSkyColor.needsUpdate=b;a.hemisphereLightGroundColor.needsUpdate=b;a.hemisphereLightDirection.needsUpdate=b}function D{var a=Mb;a>=Wb&&THREE.warn("WebGLRenderer: trying to use "+a+" texture units while this GPU supports only "+Wb);Mb+=1;return a}function w(a,b){a._modelViewMatrix.multiplyMatrices(b.matrixWorldInverse,a.matrixWorld);a._normalMatrix.getNormalMatrix(a._modelViewMatrix)} function y(a,b,c,d){a[b]=c.r*d;a[b+1]=c.g*d;a[b+2]=c.b*d}function A(a,b,c){c?(m.texParameteri(a,m.TEXTURE_WRAP_S,I(b.wrapS)),m.texParameteri(a,m.TEXTURE_WRAP_T,I(b.wrapT)),m.texParameteri(a,m.TEXTURE_MAG_FILTER,I(b.magFilter)),m.texParameteri(a,m.TEXTURE_MIN_FILTER,I(b.minFilter))):(m.texParameteri(a,m.TEXTURE_WRAP_S,m.CLAMP_TO_EDGE),m.texParameteri(a,m.TEXTURE_WRAP_T,m.CLAMP_TO_EDGE),b.wrapS===THREE.ClampToEdgeWrapping&&b.wrapT===THREE.ClampToEdgeWrapping||THREE.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping. ( "+ b.sourceFile+" )"),m.texParameteri(a,m.TEXTURE_MAG_FILTER,z(b.magFilter)),m.texParameteri(a,m.TEXTURE_MIN_FILTER,z(b.minFilter)),b.minFilter!==THREE.NearestFilter&&b.minFilter!==THREE.LinearFilter&&THREE.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter. ( "+b.sourceFile+" )"));(c=da.get("EXT_texture_filter_anisotropic"))&&b.type!==THREE.FloatType&&b.type!==THREE.HalfFloatType&&(1<b.anisotropy||b.__currentAnisotropy)&& (m.texParameterf(a,c.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(b.anisotropy,B.getMaxAnisotropy)),b.__currentAnisotropy=b.anisotropy)}function E(a,b){if(a.width>b||a.height>b){var c=b/Math.max(a.width,a.height),d=document.createElement("canvas");d.width=Math.floor(a.width*c);d.height=Math.floor(a.height*c);d.getContext("2d").drawImage(a,0,0,a.width,a.height,0,0,d.width,d.height);THREE.warn("THREE.WebGLRenderer: image is too big ("+a.width+"x"+a.height+"). Resized to "+d.width+"x"+d.height,a);return d}return a} function G(a,b){m.bindRenderbuffer(m.RENDERBUFFER,a);b.depthBuffer&&!b.stencilBuffer?(m.renderbufferStorage(m.RENDERBUFFER,m.DEPTH_COMPONENT16,b.width,b.height),m.framebufferRenderbuffer(m.FRAMEBUFFER,m.DEPTH_ATTACHMENT,m.RENDERBUFFER,a)):b.depthBuffer&&b.stencilBuffer?(m.renderbufferStorage(m.RENDERBUFFER,m.DEPTH_STENCIL,b.width,b.height),m.framebufferRenderbuffer(m.FRAMEBUFFER,m.DEPTH_STENCIL_ATTACHMENT,m.RENDERBUFFER,a)):m.renderbufferStorage(m.RENDERBUFFER,m.RGBA4,b.width,b.height)}function F(a){a instanceof THREE.WebGLRenderTargetCube?(m.bindTexture(m.TEXTURE_CUBE_MAP,a.__webglTexture),m.generateMipmap(m.TEXTURE_CUBE_MAP),m.bindTexture(m.TEXTURE_CUBE_MAP,null)):(m.bindTexture(m.TEXTURE_2D,a.__webglTexture),m.generateMipmap(m.TEXTURE_2D),m.bindTexture(m.TEXTURE_2D,null))}function z(a){return a===THREE.NearestFilter||a===THREE.NearestMipMapNearestFilter||a===THREE.NearestMipMapLinearFilter?m.NEAREST:m.LINEAR}function I(a){var b;if(a===THREE.RepeatWrapping)return m.REPEAT;if(a===THREE.ClampToEdgeWrapping)return m.CLAMP_TO_EDGE; if(a===THREE.MirroredRepeatWrapping)return m.MIRRORED_REPEAT;if(a===THREE.NearestFilter)return m.NEAREST;if(a===THREE.NearestMipMapNearestFilter)return m.NEAREST_MIPMAP_NEAREST;if(a===THREE.NearestMipMapLinearFilter)return m.NEAREST_MIPMAP_LINEAR;if(a===THREE.LinearFilter)return m.LINEAR;if(a===THREE.LinearMipMapNearestFilter)return m.LINEAR_MIPMAP_NEAREST;if(a===THREE.LinearMipMapLinearFilter)return m.LINEAR_MIPMAP_LINEAR;if(a===THREE.UnsignedByteType)return m.UNSIGNED_BYTE;if(a===THREE.UnsignedShort4444Type)return m.UNSIGNED_SHORT_4_4_4_4; if(a===THREE.UnsignedShort5551Type)return m.UNSIGNED_SHORT_5_5_5_1;if(a===THREE.UnsignedShort565Type)return m.UNSIGNED_SHORT_5_6_5;if(a===THREE.ByteType)return m.BYTE;if(a===THREE.ShortType)return m.SHORT;if(a===THREE.UnsignedShortType)return m.UNSIGNED_SHORT;if(a===THREE.IntType)return m.INT;if(a===THREE.UnsignedIntType)return m.UNSIGNED_INT;if(a===THREE.FloatType)return m.FLOAT;b=da.get("OES_texture_half_float");if(null!==b&&a===THREE.HalfFloatType)return b.HALF_FLOAT_OES;if(a===THREE.AlphaFormat)return m.ALPHA; if(a===THREE.RGBFormat)return m.RGB;if(a===THREE.RGBAFormat)return m.RGBA;if(a===THREE.LuminanceFormat)return m.LUMINANCE;if(a===THREE.LuminanceAlphaFormat)return m.LUMINANCE_ALPHA;if(a===THREE.AddEquation)return m.FUNC_ADD;if(a===THREE.SubtractEquation)return m.FUNC_SUBTRACT;if(a===THREE.ReverseSubtractEquation)return m.FUNC_REVERSE_SUBTRACT;if(a===THREE.ZeroFactor)return m.ZERO;if(a===THREE.OneFactor)return m.ONE;if(a===THREE.SrcColorFactor)return m.SRC_COLOR;if(a===THREE.OneMinusSrcColorFactor)return m.ONE_MINUS_SRC_COLOR; if(a===THREE.SrcAlphaFactor)return m.SRC_ALPHA;if(a===THREE.OneMinusSrcAlphaFactor)return m.ONE_MINUS_SRC_ALPHA;if(a===THREE.DstAlphaFactor)return m.DST_ALPHA;if(a===THREE.OneMinusDstAlphaFactor)return m.ONE_MINUS_DST_ALPHA;if(a===THREE.DstColorFactor)return m.DST_COLOR;if(a===THREE.OneMinusDstColorFactor)return m.ONE_MINUS_DST_COLOR;if(a===THREE.SrcAlphaSaturateFactor)return m.SRC_ALPHA_SATURATE;b=da.get("WEBGL_compressed_texture_s3tc");if(null!==b){if(a===THREE.RGB_S3TC_DXT1_Format)return b.COMPRESSED_RGB_S3TC_DXT1_EXT; if(a===THREE.RGBA_S3TC_DXT1_Format)return b.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(a===THREE.RGBA_S3TC_DXT3_Format)return b.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(a===THREE.RGBA_S3TC_DXT5_Format)return b.COMPRESSED_RGBA_S3TC_DXT5_EXT}b=da.get("WEBGL_compressed_texture_pvrtc");if(null!==b){if(a===THREE.RGB_PVRTC_4BPPV1_Format)return b.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(a===THREE.RGB_PVRTC_2BPPV1_Format)return b.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(a===THREE.RGBA_PVRTC_4BPPV1_Format)return b.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG; if(a===THREE.RGBA_PVRTC_2BPPV1_Format)return b.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}b=da.get("EXT_blend_minmax");if(null!==b){if(a===THREE.MinEquation)return b.MIN_EXT;if(a===THREE.MaxEquation)return b.MAX_EXT}return 0}console.log("THREE.WebGLRenderer",THREE.REVISION);a=a||{};var U=void 0!==a.canvas?a.canvas:document.createElement("canvas"),M=void 0!==a.context?a.context:null,H=1,L=void 0!==a.precision?a.precision:"highp",P=void 0!==a.alpha?a.alpha:!1,N=void 0!==a.depth?a.depth:!0,R=void 0!==a.stencil? a.stencil:!0,V=void 0!==a.antialias?a.antialias:!1,J=void 0!==a.premultipliedAlpha?a.premultipliedAlpha:!0,oa=void 0!==a.preserveDrawingBuffer?a.preserveDrawingBuffer:!1,ja=void 0!==a.logarithmicDepthBuffer?a.logarithmicDepthBuffer:!1,ha=new THREE.Color(0),O=0,ca=[],ba={},qa=[],Ka=[],Qa=[],Xa=[],Ya=[];this.domElement=U;this.context=null;this.sortObjects=this.autoClearStencil=this.autoClearDepth=this.autoClearColor=this.autoClear=!0;this.gammaFactor=2;this.shadowMapEnabled=this.gammaOutput=this.gammaInput= !1;this.shadowMapType=THREE.PCFShadowMap;this.shadowMapCullFace=THREE.CullFaceFront;this.shadowMapCascade=this.shadowMapDebug=!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 B=this,Pa=[],ob=null,ab=null,ub=-1,ta="",vb=null,Mb=0,ib=0,bb=0,pb=U.width,qb=U.height,Xb=0,fc=0,cb=new THREE.Frustum,db=new THREE.Matrix4,wa=new THREE.Vector3,pa=new THREE.Vector3,Ob=!0,jc={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:[]}},m;try{var Yb={alpha:P,depth:N,stencil:R,antialias:V,premultipliedAlpha:J,preserveDrawingBuffer:oa};m=M||U.getContext("webgl",Yb)||U.getContext("experimental-webgl",Yb);if(null===m){if(null!==U.getContext("webgl"))throw"Error creating WebGL context with your selected attributes."; throw"Error creating WebGL context.";}U.addEventListener("webglcontextlost",function(a){a.preventDefault;Zb;lc;ba={}},!1)}catch(rc){THREE.error("THREE.WebGLRenderer: "+rc)}var W=new THREE.WebGLState(m,I);void 0===m.getShaderPrecisionFormat&&(m.getShaderPrecisionFormat=function{return{rangeMin:1,rangeMax:1,precision:1}});var da=new THREE.WebGLExtensions(m);da.get("OES_texture_float");da.get("OES_texture_float_linear");da.get("OES_texture_half_float");da.get("OES_texture_half_float_linear"); da.get("OES_standard_derivatives");ja&&da.get("EXT_frag_depth");var rb=function(a,b,c,d){!0===J&&(a*=d,b*=d,c*=d);m.clearColor(a,b,c,d)},lc=function{m.clearColor(0,0,0,1);m.clearDepth(1);m.clearStencil(0);m.enable(m.DEPTH_TEST);m.depthFunc(m.LEQUAL);m.frontFace(m.CCW);m.cullFace(m.BACK);m.enable(m.CULL_FACE);m.enable(m.BLEND);m.blendEquation(m.FUNC_ADD);m.blendFunc(m.SRC_ALPHA,m.ONE_MINUS_SRC_ALPHA);m.viewport(ib,bb,pb,qb);rb(ha.r,ha.g,ha.b,O)},Zb=function{vb=ob=null;ta="";ub=-1;Ob=!0;W.reset}; lc;this.context=m;this.state=W;var Wb=m.getParameter(m.MAX_TEXTURE_IMAGE_UNITS),sc=m.getParameter(m.MAX_VERTEX_TEXTURE_IMAGE_UNITS),tc=m.getParameter(m.MAX_TEXTURE_SIZE),qc=m.getParameter(m.MAX_CUBE_MAP_TEXTURE_SIZE),Vb=0<sc,Nb=Vb&&da.get("OES_texture_float"),uc=m.getShaderPrecisionFormat(m.VERTEX_SHADER,m.HIGH_FLOAT),vc=m.getShaderPrecisionFormat(m.VERTEX_SHADER,m.MEDIUM_FLOAT),wc=m.getShaderPrecisionFormat(m.FRAGMENT_SHADER,m.HIGH_FLOAT),xc=m.getShaderPrecisionFormat(m.FRAGMENT_SHADER,m.MEDIUM_FLOAT), kc=function{var a;return function{if(void 0!==a)return a;a=[];if(da.get("WEBGL_compressed_texture_pvrtc")||da.get("WEBGL_compressed_texture_s3tc"))for(var b=m.getParameter(m.COMPRESSED_TEXTURE_FORMATS),c=0;c<b.length;c++)a.push(b[c]);return a}},yc=0<uc.precision&&0<wc.precision,mc=0<vc.precision&&0<xc.precision;"highp"!==L||yc||(mc?(L="mediump",THREE.warn("THREE.WebGLRenderer: highp not supported, using mediump.")):(L="lowp",THREE.warn("THREE.WebGLRenderer: highp and mediump not supported, using lowp."))); "mediump"!==L||mc||(L="lowp",THREE.warn("THREE.WebGLRenderer: mediump not supported, using lowp."));var zc=new THREE.ShadowMapPlugin(this,ca,ba,qa),Ac=new THREE.SpritePlugin(this,Xa),Bc=new THREE.LensFlarePlugin(this,Ya);this.getContext=function{return m};this.forceContextLoss=function{da.get("WEBGL_lose_context").loseContext};this.supportsVertexTextures=function{return Vb};this.supportsFloatTextures=function{return da.get("OES_texture_float")};this.supportsHalfFloatTextures=function{return da.get("OES_texture_half_float")}; this.supportsStandardDerivatives=function{return da.get("OES_standard_derivatives")};this.supportsCompressedTextureS3TC=function{return da.get("WEBGL_compressed_texture_s3tc")};this.supportsCompressedTexturePVRTC=function{return da.get("WEBGL_compressed_texture_pvrtc")};this.supportsBlendMinMax=function{return da.get("EXT_blend_minmax")};this.getMaxAnisotropy=function{var a;return function{if(void 0!==a)return a;var b=da.get("EXT_texture_filter_anisotropic");return a=null!==b?m.getParameter(b.MAX_TEXTURE_MAX_ANISOTROPY_EXT): 0}};this.getPrecision=function{return L};this.getPixelRatio=function{return H};this.setPixelRatio=function(a){H=a};this.setSize=function(a,b,c){U.width=a*H;U.height=b*H;!1!==c&&(U.style.width=a+"px",U.style.height=b+"px");this.setViewport(0,0,a,b)};this.setViewport=function(a,b,c,d){ib=a*H;bb=b*H;pb=c*H;qb=d*H;m.viewport(ib,bb,pb,qb)};this.setScissor=function(a,b,c,d){m.scissor(a*H,b*H,c*H,d*H)};this.enableScissorTest=function(a){a?m.enable(m.SCISSOR_TEST):m.disable(m.SCISSOR_TEST)};this.getClearColor= function{return ha};this.setClearColor=function(a,b){ha.set(a);O=void 0!==b?b:1;rb(ha.r,ha.g,ha.b,O)};this.getClearAlpha=function{return O};this.setClearAlpha=function(a){O=a;rb(ha.r,ha.g,ha.b,O)};this.clear=function(a,b,c){var d=0;if(void 0===a||a)d|=m.COLOR_BUFFER_BIT;if(void 0===b||b)d|=m.DEPTH_BUFFER_BIT;if(void 0===c||c)d|=m.STENCIL_BUFFER_BIT;m.clear(d)};this.clearColor=function{m.clear(m.COLOR_BUFFER_BIT)};this.clearDepth=function{m.clear(m.DEPTH_BUFFER_BIT)};this.clearStencil=function{m.clear(m.STENCIL_BUFFER_BIT)}; this.clearTarget=function(a,b,c,d){this.setRenderTarget(a);this.clear(b,c,d)};this.resetGLState=Zb;var wb=function(a){a.target.traverse(function(a){a.removeEventListener("remove",wb);if(a instanceof THREE.Mesh||a instanceof THREE.PointCloud||a instanceof THREE.Line)delete ba[a.id];else if(a instanceof THREE.ImmediateRenderObject||a.immediateRenderCallback)for(var b=qa,c=b.length-1;0<=c;c--)b[c].object===a&&b.splice(c,1);delete a.__webglInit;delete a._modelViewMatrix;delete a._normalMatrix;delete a.__webglActive})}, jb=function(a){a=a.target;a.removeEventListener("dispose",jb);delete a.__webglInit;if(a instanceof THREE.BufferGeometry){for(var b in a.attributes){var c=a.attributes[b];void 0!==c.buffer&&(m.deleteBuffer(c.buffer),delete c.buffer)}B.info.memory.geometries--}else if(b=Ua[a.id],void 0!==b){for(var c=0,d=b.length;c<d;c++){var e=b[c];if(void 0!==e.numMorphTargets){for(var f=0,g=e.numMorphTargets;f<g;f++)m.deleteBuffer(e.__webglMorphTargetsBuffers[f]);delete e.__webglMorphTargetsBuffers}if(void 0!==e.numMorphNormals){f= 0;for(g=e.numMorphNormals;f<g;f++)m.deleteBuffer(e.__webglMorphNormalsBuffers[f]);delete e.__webglMorphNormalsBuffers}nc(e)}delete Ua[a.id]}else nc(a);ta=""},Pb=function(a){a=a.target;a.removeEventListener("dispose",Pb);a.image&&a.image.__webglTextureCube?(m.deleteTexture(a.image.__webglTextureCube),delete a.image.__webglTextureCube):void 0!==a.__webglInit&&(m.deleteTexture(a.__webglTexture),delete a.__webglTexture,delete a.__webglInit);B.info.memory.textures--},oc=function(a){a=a.target;a.removeEventListener("dispose", oc);if(a&&void 0!==a.__webglTexture){m.deleteTexture(a.__webglTexture);delete a.__webglTexture;if(a instanceof THREE.WebGLRenderTargetCube)for(var b=0;6>b;b++)m.deleteFramebuffer(a.__webglFramebuffer[b]),m.deleteRenderbuffer(a.__webglRenderbuffer[b]);else m.deleteFramebuffer(a.__webglFramebuffer),m.deleteRenderbuffer(a.__webglRenderbuffer);delete a.__webglFramebuffer;delete a.__webglRenderbuffer}B.info.memory.textures--},ic=function(a){a=a.target;a.removeEventListener("dispose",ic);hc(a)},nc=function(a){for(var b= "__webglVertexBuffer __webglNormalBuffer __webglTangentBuffer __webglColorBuffer __webglUVBuffer __webglUV2Buffer __webglSkinIndicesBuffer __webglSkinWeightsBuffer __webglFaceBuffer __webglLineBuffer __webglLineDistanceBuffer".split(" "),c=0,d=b.length;c<d;c++){var e=b[c];void 0!==a[e]&&(m.deleteBuffer(a[e]),delete a[e])}if(void 0!==a.__webglCustomAttributesList){for(e in a.__webglCustomAttributesList)m.deleteBuffer(a.__webglCustomAttributesList[e].buffer);delete a.__webglCustomAttributesList}B.info.memory.geometries--}, hc=function(a){var b=a.program.program;if(void 0!==b){a.program=void 0;var c,d,e=!1;a=0;for(c=Pa.length;a<c;a++)if(d=Pa[a],d.program===b){d.usedTimes--;0===d.usedTimes&&(e=!0);break}if(!0===e){e=[];a=0;for(c=Pa.length;a<c;a++)d=Pa[a],d.program!==b&&e.push(d);Pa=e;m.deleteProgram(b);B.info.memory.programs--}}};this.renderBufferImmediate=function(a,b,c){W.initAttributes;a.hasPositions&&!a.__webglVertexBuffer&&(a.__webglVertexBuffer=m.createBuffer);a.hasNormals&&!a.__webglNormalBuffer&&(a.__webglNormalBuffer= m.createBuffer);a.hasUvs&&!a.__webglUvBuffer&&(a.__webglUvBuffer=m.createBuffer);a.hasColors&&!a.__webglColorBuffer&&(a.__webglColorBuffer=m.createBuffer);a.hasPositions&&(m.bindBuffer(m.ARRAY_BUFFER,a.__webglVertexBuffer),m.bufferData(m.ARRAY_BUFFER,a.positionArray,m.DYNAMIC_DRAW),W.enableAttribute(b.attributes.position),m.vertexAttribPointer(b.attributes.position,3,m.FLOAT,!1,0,0));if(a.hasNormals){m.bindBuffer(m.ARRAY_BUFFER,a.__webglNormalBuffer);if(!1===c instanceof THREE.MeshPhongMaterial&& c.shading===THREE.FlatShading){var d,e,f,g,h,k,n,l,p,q,r,s=3*a.count;for(r=0;r<s;r+=9)q=a.normalArray,d=q[r],e=q[r+1],f=q[r+2],g=q[r+3],k=q[r+4],l=q[r+5],h=q[r+6],n=q[r+7],p=q[r+8],d=(d+g+h)/3,e=(e+k+n)/3,f=(f+l+p)/3,q[r]=d,q[r+1]=e,q[r+2]=f,q[r+3]=d,q[r+4]=e,q[r+5]=f,q[r+6]=d,q[r+7]=e,q[r+8]=f}m.bufferData(m.ARRAY_BUFFER,a.normalArray,m.DYNAMIC_DRAW);W.enableAttribute(b.attributes.normal);m.vertexAttribPointer(b.attributes.normal,3,m.FLOAT,!1,0,0)}a.hasUvs&&c.map&&(m.bindBuffer(m.ARRAY_BUFFER,a.__webglUvBuffer), m.bufferData(m.ARRAY_BUFFER,a.uvArray,m.DYNAMIC_DRAW),W.enableAttribute(b.attributes.uv),m.vertexAttribPointer(b.attributes.uv,2,m.FLOAT,!1,0,0));a.hasColors&&c.vertexColors!==THREE.NoColors&&(m.bindBuffer(m.ARRAY_BUFFER,a.__webglColorBuffer),m.bufferData(m.ARRAY_BUFFER,a.colorArray,m.DYNAMIC_DRAW),W.enableAttribute(b.attributes.color),m.vertexAttribPointer(b.attributes.color,3,m.FLOAT,!1,0,0));W.disableUnusedAttributes;m.drawArrays(m.TRIANGLES,0,a.count);a.count=0};this.renderBufferDirect=function(a, b,c,e,f,g){if(!1!==e.visible)if(t(g),a=v(a,b,c,e,g),b=!1,c="direct_"+f.id+"_"+a.id+"_"+(e.wireframe?1:0),c!==ta&&(ta=c,b=!0),b&&W.initAttributes,g instanceof THREE.Mesh){g=!0===e.wireframe?m.LINES:m.TRIANGLES;var h=f.attributes.index;if(h){var k,n;h.array instanceof Uint32Array&&da.get("OES_element_index_uint")?(k=m.UNSIGNED_INT,n=4):(k=m.UNSIGNED_SHORT,n=2);c=f.offsets;if(0===c.length)b&&(d(e,a,f,0),m.bindBuffer(m.ELEMENT_ARRAY_BUFFER,h.buffer)),m.drawElements(g,h.array.length,k,0),B.info.render.calls++, B.info.render.vertices+=h.array.length,B.info.render.faces+=h.array.length/3;else{b=!0;for(var l=0,p=c.length;l<p;l++){var q=c[l].index;b&&(d(e,a,f,q),m.bindBuffer(m.ELEMENT_ARRAY_BUFFER,h.buffer));m.drawElements(g,c[l].count,k,c[l].start*n);B.info.render.calls++;B.info.render.vertices+=c[l].count;B.info.render.faces+=c[l].count/3}}}else b&&d(e,a,f,0),e=f.attributes.position,m.drawArrays(g,0,e.array.length/e.itemSize),B.info.render.calls++,B.info.render.vertices+=e.array.length/e.itemSize,B.info.render.faces+= e.array.length/(3*e.itemSize)}else if(g instanceof THREE.PointCloud)if(g=m.POINTS,h=f.attributes.index)if(h.array instanceof Uint32Array&&da.get("OES_element_index_uint")?(k=m.UNSIGNED_INT,n=4):(k=m.UNSIGNED_SHORT,n=2),c=f.offsets,0===c.length)b&&(d(e,a,f,0),m.bindBuffer(m.ELEMENT_ARRAY_BUFFER,h.buffer)),m.drawElements(g,h.array.length,k,0),B.info.render.calls++,B.info.render.points+=h.array.length;else for(1<c.length&&(b=!0),l=0,p=c.length;l<p;l++)q=c[l].index,b&&(d(e,a,f,q),m.bindBuffer(m.ELEMENT_ARRAY_BUFFER, h.buffer)),m.drawElements(g,c[l].count,k,c[l].start*n),B.info.render.calls++,B.info.render.points+=c[l].count;else if(b&&d(e,a,f,0),e=f.attributes.position,c=f.offsets,0===c.length)m.drawArrays(g,0,e.array.length/3),B.info.render.calls++,B.info.render.points+=e.array.length/3;else for(l=0,p=c.length;l<p;l++)m.drawArrays(g,c[l].index,c[l].count),B.info.render.calls++,B.info.render.points+=c[l].count;else if(g instanceof THREE.Line)if(g=g.mode===THREE.LineStrip?m.LINE_STRIP:m.LINES,W.setLineWidth(e.linewidth* H),h=f.attributes.index)if(h.array instanceof Uint32Array?(k=m.UNSIGNED_INT,n=4):(k=m.UNSIGNED_SHORT,n=2),c=f.offsets,0===c.length)b&&(d(e,a,f,0),m.bindBuffer(m.ELEMENT_ARRAY_BUFFER,h.buffer)),m.drawElements(g,h.array.length,k,0),B.info.render.calls++,B.info.render.vertices+=h.array.length;else for(1<c.length&&(b=!0),l=0,p=c.length;l<p;l++)q=c[l].index,b&&(d(e,a,f,q),m.bindBuffer(m.ELEMENT_ARRAY_BUFFER,h.buffer)),m.drawElements(g,c[l].count,k,c[l].start*n),B.info.render.calls++,B.info.render.vertices+= c[l].count;else if(b&&d(e,a,f,0),e=f.attributes.position,c=f.offsets,0===c.length)m.drawArrays(g,0,e.array.length/3),B.info.render.calls++,B.info.render.vertices+=e.array.length/3;else for(l=0,p=c.length;l<p;l++)m.drawArrays(g,c[l].index,c[l].count),B.info.render.calls++,B.info.render.vertices+=c[l].count};this.renderBuffer=function(a,b,c,d,e,f){if(!1!==d.visible){t(f);c=v(a,b,c,d,f);b=c.attributes;a=!1;c=e.id+"_"+c.id+"_"+(d.wireframe?1:0);c!==ta&&(ta=c,a=!0);a&&W.initAttributes;if(!d.morphTargets&& 0<=b.position)a&&(m.bindBuffer(m.ARRAY_BUFFER,e.__webglVertexBuffer),W.enableAttribute(b.position),m.vertexAttribPointer(b.position,3,m.FLOAT,!1,0,0));else if(f.morphTargetBase){c=d.program.attributes;-1!==f.morphTargetBase&&0<=c.position?(m.bindBuffer(m.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[f.morphTargetBase]),W.enableAttribute(c.position),m.vertexAttribPointer(c.position,3,m.FLOAT,!1,0,0)):0<=c.position&&(m.bindBuffer(m.ARRAY_BUFFER,e.__webglVertexBuffer),W.enableAttribute(c.position),m.vertexAttribPointer(c.position, 3,m.FLOAT,!1,0,0));if(f.morphTargetForcedOrder.length)for(var h=0,k=f.morphTargetForcedOrder,n=f.morphTargetInfluences,l;h<d.numSupportedMorphTargets&&h<k.length;)l=c["morphTarget"+h],0<=l&&(m.bindBuffer(m.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[k[h]]),W.enableAttribute(l),m.vertexAttribPointer(l,3,m.FLOAT,!1,0,0)),l=c["morphNormal"+h],0<=l&&d.morphNormals&&(m.bindBuffer(m.ARRAY_BUFFER,e.__webglMorphNormalsBuffers[k[h]]),W.enableAttribute(l),m.vertexAttribPointer(l,3,m.FLOAT,!1,0,0)),f.__webglMorphTargetInfluences[h]= n[k[h]],h++;else{k=[];n=f.morphTargetInfluences;h=f.geometry.morphTargets;n.length>h.length&&(console.warn("THREE.WebGLRenderer: Influences array is bigger than morphTargets array."),n.length=h.length);h=0;for(l=n.length;h<l;h++)k.push([n[h],h]);k.length>d.numSupportedMorphTargets?(k.sort(g),k.length=d.numSupportedMorphTargets):k.length>d.numSupportedMorphNormals?k.sort(g):0===k.length&&k.push([0,0]);for(var h=0,p=d.numSupportedMorphTargets;h<p;h++)if(k[h]){var q=k[h][1];l=c["morphTarget"+h];0<=l&& (m.bindBuffer(m.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[q]),W.enableAttribute(l),m.vertexAttribPointer(l,3,m.FLOAT,!1,0,0));l=c["morphNormal"+h];0<=l&&d.morphNormals&&(m.bindBuffer(m.ARRAY_BUFFER,e.__webglMorphNormalsBuffers[q]),W.enableAttribute(l),m.vertexAttribPointer(l,3,m.FLOAT,!1,0,0));f.__webglMorphTargetInfluences[h]=n[q]}else f.__webglMorphTargetInfluences[h]=0}null!==d.program.uniforms.morphTargetInfluences&&m.uniform1fv(d.program.uniforms.morphTargetInfluences,f.__webglMorphTargetInfluences)}if(a){if(e.__webglCustomAttributesList)for(c= 0,n=e.__webglCustomAttributesList.length;c<n;c++)k=e.__webglCustomAttributesList[c],0<=b[k.buffer.belongsToAttribute]&&(m.bindBuffer(m.ARRAY_BUFFER,k.buffer),W.enableAttribute(b[k.buffer.belongsToAttribute]),m.vertexAttribPointer(b[k.buffer.belongsToAttribute],k.size,m.FLOAT,!1,0,0));0<=b.color&&(0<f.geometry.colors.length||0<f.geometry.faces.length?(m.bindBuffer(m.ARRAY_BUFFER,e.__webglColorBuffer),W.enableAttribute(b.color),m.vertexAttribPointer(b.color,3,m.FLOAT,!1,0,0)):void 0!==d.defaultAttributeValues&& m.vertexAttrib3fv(b.color,d.defaultAttributeValues.color));0<=b.normal&&(m.bindBuffer(m.ARRAY_BUFFER,e.__webglNormalBuffer),W.enableAttribute(b.normal),m.vertexAttribPointer(b.normal,3,m.FLOAT,!1,0,0));0<=b.tangent&&(m.bindBuffer(m.ARRAY_BUFFER,e.__webglTangentBuffer),W.enableAttribute(b.tangent),m.vertexAttribPointer(b.tangent,4,m.FLOAT,!1,0,0));0<=b.uv&&(f.geometry.faceVertexUvs[0]?(m.bindBuffer(m.ARRAY_BUFFER,e.__webglUVBuffer),W.enableAttribute(b.uv),m.vertexAttribPointer(b.uv,2,m.FLOAT,!1,0, 0)):void 0!==d.defaultAttributeValues&&m.vertexAttrib2fv(b.uv,d.defaultAttributeValues.uv));0<=b.uv2&&(f.geometry.faceVertexUvs[1]?(m.bindBuffer(m.ARRAY_BUFFER,e.__webglUV2Buffer),W.enableAttribute(b.uv2),m.vertexAttribPointer(b.uv2,2,m.FLOAT,!1,0,0)):void 0!==d.defaultAttributeValues&&m.vertexAttrib2fv(b.uv2,d.defaultAttributeValues.uv2));d.skinning&&0<=b.skinIndex&&0<=b.skinWeight&&(m.bindBuffer(m.ARRAY_BUFFER,e.__webglSkinIndicesBuffer),W.enableAttribute(b.skinIndex),m.vertexAttribPointer(b.skinIndex, 4,m.FLOAT,!1,0,0),m.bindBuffer(m.ARRAY_BUFFER,e.__webglSkinWeightsBuffer),W.enableAttribute(b.skinWeight),m.vertexAttribPointer(b.skinWeight,4,m.FLOAT,!1,0,0));0<=b.lineDistance&&(m.bindBuffer(m.ARRAY_BUFFER,e.__webglLineDistanceBuffer),W.enableAttribute(b.lineDistance),m.vertexAttribPointer(b.lineDistance,1,m.FLOAT,!1,0,0))}W.disableUnusedAttributes;f instanceof THREE.Mesh?(f=e.__typeArray===Uint32Array?m.UNSIGNED_INT:m.UNSIGNED_SHORT,d.wireframe?(W.setLineWidth(d.wireframeLinewidth*H),a&&m.bindBuffer(m.ELEMENT_ARRAY_BUFFER, e.__webglLineBuffer),m.drawElements(m.LINES,e.__webglLineCount,f,0)):(a&&m.bindBuffer(m.ELEMENT_ARRAY_BUFFER,e.__webglFaceBuffer),m.drawElements(m.TRIANGLES,e.__webglFaceCount,f,0)),B.info.render.calls++,B.info.render.vertices+=e.__webglFaceCount,B.info.render.faces+=e.__webglFaceCount/3):f instanceof THREE.Line?(f=f.mode===THREE.LineStrip?m.LINE_STRIP:m.LINES,W.setLineWidth(d.linewidth*H),m.drawArrays(f,0,e.__webglLineCount),B.info.render.calls++):f instanceof THREE.PointCloud&&(m.drawArrays(m.POINTS, 0,e.__webglParticleCount),B.info.render.calls++,B.info.render.points+=e.__webglParticleCount)}};this.render=function(a,b,c,d){if(!1===b instanceof THREE.Camera)THREE.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");else{var g=a.fog;ta="";ub=-1;vb=null;Ob=!0;!0===a.autoUpdate&&a.updateMatrixWorld;void 0===b.parent&&b.updateMatrixWorld;a.traverse(function(a){a instanceof THREE.SkinnedMesh&&a.skeleton.update});b.matrixWorldInverse.getInverse(b.matrixWorld);db.multiplyMatrices(b.projectionMatrix, b.matrixWorldInverse);cb.setFromMatrix(db);ca.length=0;Ka.length=0;Qa.length=0;Xa.length=0;Ya.length=0;h(a);!0===B.sortObjects&&(Ka.sort(e),Qa.sort(f));zc.render(a,b);B.info.render.calls=0;B.info.render.vertices=0;B.info.render.faces=0;B.info.render.points=0;this.setRenderTarget(c);(this.autoClear||d)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);d=0;for(var n=qa.length;d<n;d++){var m=qa[d],q=m.object;q.visible&&(w(q,b),p(m))}a.overrideMaterial?(d=a.overrideMaterial,u(d), k(Ka,b,ca,g,d),k(Qa,b,ca,g,d),l(qa,"",b,ca,g,d)):(W.setBlending(THREE.NoBlending),k(Ka,b,ca,g,null),l(qa,"opaque",b,ca,g,null),k(Qa,b,ca,g,null),l(qa,"transparent",b,ca,g,null));Ac.render(a,b);Bc.render(a,b,Xb,fc);c&&c.generateMipmaps&&c.minFilter!==THREE.NearestFilter&&c.minFilter!==THREE.LinearFilter&&F(c);W.setDepthTest(!0);W.setDepthWrite(!0);W.setColorWrite(!0)}};this.renderImmediateObject=function(a,b,c,d,e){var f=v(a,b,c,d,e);ta="";B.setMaterialFaces(d);e.immediateRenderCallback?e.immediateRenderCallback(f, m,cb):e.render(function(a){B.renderBufferImmediate(a,f,d)})};var Ua={},Qb=0,pc={MeshDepthMaterial:"depth",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointCloudMaterial:"particle_basic"};this.setFaceCulling=function(a,b){a===THREE.CullFaceNone?m.disable(m.CULL_FACE):(b===THREE.FrontFaceDirectionCW?m.frontFace(m.CW):m.frontFace(m.CCW),a===THREE.CullFaceBack?m.cullFace(m.BACK):a=== THREE.CullFaceFront?m.cullFace(m.FRONT):m.cullFace(m.FRONT_AND_BACK),m.enable(m.CULL_FACE))};this.setMaterialFaces=function(a){W.setDoubleSided(a.side===THREE.DoubleSide);W.setFlipSided(a.side===THREE.BackSide)};this.uploadTexture=function(a){void 0===a.__webglInit&&(a.__webglInit=!0,a.addEventListener("dispose",Pb),a.__webglTexture=m.createTexture,B.info.memory.textures++);m.bindTexture(m.TEXTURE_2D,a.__webglTexture);m.pixelStorei(m.UNPACK_FLIP_Y_WEBGL,a.flipY);m.pixelStorei(m.UNPACK_PREMULTIPLY_ALPHA_WEBGL, a.premultiplyAlpha);m.pixelStorei(m.UNPACK_ALIGNMENT,a.unpackAlignment);a.image=E(a.image,tc);var b=a.image,c=THREE.Math.isPowerOfTwo(b.width)&&THREE.Math.isPowerOfTwo(b.height),d=I(a.format),e=I(a.type);A(m.TEXTURE_2D,a,c);var f=a.mipmaps;if(a instanceof THREE.DataTexture)if(0<f.length&&c){for(var g=0,h=f.length;g<h;g++)b=f[g],m.texImage2D(m.TEXTURE_2D,g,d,b.width,b.height,0,d,e,b.data);a.generateMipmaps=!1}else m.texImage2D(m.TEXTURE_2D,0,d,b.width,b.height,0,d,e,b.data);else if(a instanceof THREE.CompressedTexture)for(g= 0,h=f.length;g<h;g++)b=f[g],a.format!==THREE.RGBAFormat&&a.format!==THREE.RGBFormat?-1<kc.indexOf(d)?m.compressedTexImage2D(m.TEXTURE_2D,g,d,b.width,b.height,0,b.data):THREE.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture"):m.texImage2D(m.TEXTURE_2D,g,d,b.width,b.height,0,d,e,b.data);else if(0<f.length&&c){g=0;for(h=f.length;g<h;g++)b=f[g],m.texImage2D(m.TEXTURE_2D,g,d,d,e,b);a.generateMipmaps=!1}else m.texImage2D(m.TEXTURE_2D,0,d,d,e,a.image); a.generateMipmaps&&c&&m.generateMipmap(m.TEXTURE_2D);a.needsUpdate=!1;if(a.onUpdate)a.onUpdate};this.setTexture=function(a,b){m.activeTexture(m.TEXTURE0+b);a.needsUpdate?B.uploadTexture(a):m.bindTexture(m.TEXTURE_2D,a.__webglTexture)};this.setRenderTarget=function(a){var b=a instanceof THREE.WebGLRenderTargetCube;if(a&&void 0===a.__webglFramebuffer){void 0===a.depthBuffer&&(a.depthBuffer=!0);void 0===a.stencilBuffer&&(a.stencilBuffer=!0);a.addEventListener("dispose",oc);a.__webglTexture=m.createTexture; B.info.memory.textures++;var c=THREE.Math.isPowerOfTwo(a.width)&&THREE.Math.isPowerOfTwo(a.height),d=I(a.format),e=I(a.type);if(b){a.__webglFramebuffer=[];a.__webglRenderbuffer=[];m.bindTexture(m.TEXTURE_CUBE_MAP,a.__webglTexture);A(m.TEXTURE_CUBE_MAP,a,c);for(var f=0;6>f;f++){a.__webglFramebuffer[f]=m.createFramebuffer;a.__webglRenderbuffer[f]=m.createRenderbuffer;m.texImage2D(m.TEXTURE_CUBE_MAP_POSITIVE_X+f,0,d,a.width,a.height,0,d,e,null);var g=a,h=m.TEXTURE_CUBE_MAP_POSITIVE_X+f;m.bindFramebuffer(m.FRAMEBUFFER, a.__webglFramebuffer[f]);m.framebufferTexture2D(m.FRAMEBUFFER,m.COLOR_ATTACHMENT0,h,g.__webglTexture,0);G(a.__webglRenderbuffer[f],a)}c&&m.generateMipmap(m.TEXTURE_CUBE_MAP)}else a.__webglFramebuffer=m.createFramebuffer,a.__webglRenderbuffer=a.shareDepthFrom?a.shareDepthFrom.__webglRenderbuffer:m.createRenderbuffer,m.bindTexture(m.TEXTURE_2D,a.__webglTexture),A(m.TEXTURE_2D,a,c),m.texImage2D(m.TEXTURE_2D,0,d,a.width,a.height,0,d,e,null),d=m.TEXTURE_2D,m.bindFramebuffer(m.FRAMEBUFFER,a.__webglFramebuffer), m.framebufferTexture2D(m.FRAMEBUFFER,m.COLOR_ATTACHMENT0,d,a.__webglTexture,0),a.shareDepthFrom?a.depthBuffer&&!a.stencilBuffer?m.framebufferRenderbuffer(m.FRAMEBUFFER,m.DEPTH_ATTACHMENT,m.RENDERBUFFER,a.__webglRenderbuffer):a.depthBuffer&&a.stencilBuffer&&m.framebufferRenderbuffer(m.FRAMEBUFFER,m.DEPTH_STENCIL_ATTACHMENT,m.RENDERBUFFER,a.__webglRenderbuffer):G(a.__webglRenderbuffer,a),c&&m.generateMipmap(m.TEXTURE_2D);b?m.bindTexture(m.TEXTURE_CUBE_MAP,null):m.bindTexture(m.TEXTURE_2D,null);m.bindRenderbuffer(m.RENDERBUFFER, null);m.bindFramebuffer(m.FRAMEBUFFER,null)}a?(b=b?a.__webglFramebuffer[a.activeCubeFace]:a.__webglFramebuffer,c=a.width,a=a.height,e=d=0):(b=null,c=pb,a=qb,d=ib,e=bb);b!==ab&&(m.bindFramebuffer(m.FRAMEBUFFER,b),m.viewport(d,e,c,a),ab=b);Xb=c;fc=a};this.readRenderTargetPixels=function(a,b,c,d,e,f){if(!(a instanceof THREE.WebGLRenderTarget))console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");else if(a.__webglFramebuffer)if(a.format!==THREE.RGBAFormat)console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA format. readPixels can read only RGBA format."); else{var g=!1;a.__webglFramebuffer!==ab&&(m.bindFramebuffer(m.FRAMEBUFFER,a.__webglFramebuffer),g=!0);m.checkFramebufferStatus(m.FRAMEBUFFER)===m.FRAMEBUFFER_COMPLETE?m.readPixels(b,c,d,e,m.RGBA,m.UNSIGNED_BYTE,f):console.error("THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete.");g&&m.bindFramebuffer(m.FRAMEBUFFER,ab)}};this.initMaterial=function{THREE.warn("THREE.WebGLRenderer: .initMaterial has been removed.")};this.addPrePlugin=function{THREE.warn("THREE.WebGLRenderer: .addPrePlugin has been removed.")}; this.addPostPlugin=function{THREE.warn("THREE.WebGLRenderer: .addPostPlugin has been removed.")};this.updateShadowMap=function{THREE.warn("THREE.WebGLRenderer: .updateShadowMap has been removed.")}}; THREE.WebGLRenderTarget=function(a,b,c){this.width=a;this.height=b;c=c||{};this.wrapS=void 0!==c.wrapS?c.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=void 0!==c.wrapT?c.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=void 0!==c.magFilter?c.magFilter:THREE.LinearFilter;this.minFilter=void 0!==c.minFilter?c.minFilter:THREE.LinearMipMapLinearFilter;this.anisotropy=void 0!==c.anisotropy?c.anisotropy:1;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.format=void 0!==c.format?c.format: THREE.RGBAFormat;this.type=void 0!==c.type?c.type:THREE.UnsignedByteType;this.depthBuffer=void 0!==c.depthBuffer?c.depthBuffer:!0;this.stencilBuffer=void 0!==c.stencilBuffer?c.stencilBuffer:!0;this.generateMipmaps=!0;this.shareDepthFrom=void 0!==c.shareDepthFrom?c.shareDepthFrom:null}; THREE.WebGLRenderTarget.prototype={constructor:THREE.WebGLRenderTarget,setSize:function(a,b){this.width=a;this.height=b},clone:function{var a=new THREE.WebGLRenderTarget(this.width,this.height);a.wrapS=this.wrapS;a.wrapT=this.wrapT;a.magFilter=this.magFilter;a.minFilter=this.minFilter;a.anisotropy=this.anisotropy;a.offset.copy(this.offset);a.repeat.copy(this.repeat);a.format=this.format;a.type=this.type;a.depthBuffer=this.depthBuffer;a.stencilBuffer=this.stencilBuffer;a.generateMipmaps=this.generateMipmaps; a.shareDepthFrom=this.shareDepthFrom;return a},dispose:function{this.dispatchEvent({type:"dispose"})}};THREE.EventDispatcher.prototype.apply(THREE.WebGLRenderTarget.prototype);THREE.WebGLRenderTargetCube=function(a,b,c){THREE.WebGLRenderTarget.call(this,a,b,c);this.activeCubeFace=0};THREE.WebGLRenderTargetCube.prototype=Object.create(THREE.WebGLRenderTarget.prototype);THREE.WebGLRenderTargetCube.prototype.constructor=THREE.WebGLRenderTargetCube; THREE.WebGLExtensions=function(a){var b={};this.get=function(c){if(void 0!==b[c])return b[c];var d;switch(c){case "EXT_texture_filter_anisotropic":d=a.getExtension("EXT_texture_filter_anisotropic")||a.getExtension("MOZ_EXT_texture_filter_anisotropic")||a.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case "WEBGL_compressed_texture_s3tc":d=a.getExtension("WEBGL_compressed_texture_s3tc")||a.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||a.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc"); break;case "WEBGL_compressed_texture_pvrtc":d=a.getExtension("WEBGL_compressed_texture_pvrtc")||a.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:d=a.getExtension(c)}null===d&&THREE.warn("THREE.WebGLRenderer: "+c+" extension not supported.");return b[c]=d}}; THREE.WebGLProgram=function{var a=0;return function(b,c,d,e){var f=b.context,g=d.defines,h=d.__webglShader.uniforms,k=d.attributes,l=d.__webglShader.vertexShader,p=d.__webglShader.fragmentShader,q=d.index0AttributeName;void 0===q&&!0===e.morphTargets&&(q="position");var n="SHADOWMAP_TYPE_BASIC";e.shadowMapType===THREE.PCFShadowMap?n="SHADOWMAP_TYPE_PCF":e.shadowMapType===THREE.PCFSoftShadowMap&&(n="SHADOWMAP_TYPE_PCF_SOFT");var t="ENVMAP_TYPE_CUBE",r="ENVMAP_MODE_REFLECTION",s="ENVMAP_BLENDING_MULTIPLY"; if(e.envMap){switch(d.envMap.mapping){case THREE.CubeReflectionMapping:case THREE.CubeRefractionMapping:t="ENVMAP_TYPE_CUBE";break;case THREE.EquirectangularReflectionMapping:case THREE.EquirectangularRefractionMapping:t="ENVMAP_TYPE_EQUIREC";break;case THREE.SphericalReflectionMapping:t="ENVMAP_TYPE_SPHERE"}switch(d.envMap.mapping){case THREE.CubeRefractionMapping:case THREE.EquirectangularRefractionMapping:r="ENVMAP_MODE_REFRACTION"}switch(d.combine){case THREE.MultiplyOperation:s="ENVMAP_BLENDING_MULTIPLY"; break;case THREE.MixOperation:s="ENVMAP_BLENDING_MIX";break;case THREE.AddOperation:s="ENVMAP_BLENDING_ADD"}}var u=0<b.gammaFactor?b.gammaFactor:1,v,x;v=[];for(var D in g)x=g[D],!1!==x&&(x="#define "+D+" "+x,v.push(x));v=v.join("\n");g=f.createProgram;d instanceof THREE.RawShaderMaterial?b=d="":(d=["precision "+e.precision+" float;","precision "+e.precision+" int;",v,e.supportsVertexTextures?"#define VERTEX_TEXTURES":"",b.gammaInput?"#define GAMMA_INPUT":"",b.gammaOutput?"#define GAMMA_OUTPUT": "","#define GAMMA_FACTOR "+u,"#define MAX_DIR_LIGHTS "+e.maxDirLights,"#define MAX_POINT_LIGHTS "+e.maxPointLights,"#define MAX_SPOT_LIGHTS "+e.maxSpotLights,"#define MAX_HEMI_LIGHTS "+e.maxHemiLights,"#define MAX_SHADOWS "+e.maxShadows,"#define MAX_BONES "+e.maxBones,e.map?"#define USE_MAP":"",e.envMap?"#define USE_ENVMAP":"",e.envMap?"#define "+r:"",e.lightMap?"#define USE_LIGHTMAP":"",e.bumpMap?"#define USE_BUMPMAP":"",e.normalMap?"#define USE_NORMALMAP":"",e.specularMap?"#define USE_SPECULARMAP": "",e.alphaMap?"#define USE_ALPHAMAP":"",e.vertexColors?"#define USE_COLOR":"",e.flatShading?"#define FLAT_SHADED":"",e.skinning?"#define USE_SKINNING":"",e.useVertexTexture?"#define BONE_TEXTURE":"",e.morphTargets?"#define USE_MORPHTARGETS":"",e.morphNormals?"#define USE_MORPHNORMALS":"",e.wrapAround?"#define WRAP_AROUND":"",e.doubleSided?"#define DOUBLE_SIDED":"",e.flipSided?"#define FLIP_SIDED":"",e.shadowMapEnabled?"#define USE_SHADOWMAP":"",e.shadowMapEnabled?"#define "+n:"",e.shadowMapDebug? "#define SHADOWMAP_DEBUG":"",e.shadowMapCascade?"#define SHADOWMAP_CASCADE":"",e.sizeAttenuation?"#define USE_SIZEATTENUATION":"",e.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"","uniform mat4 modelMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec2 uv;\nattribute vec2 uv2;\n#ifdef USE_COLOR\n\tattribute vec3 color;\n#endif\n#ifdef USE_MORPHTARGETS\n\tattribute vec3 morphTarget0;\n\tattribute vec3 morphTarget1;\n\tattribute vec3 morphTarget2;\n\tattribute vec3 morphTarget3;\n\t#ifdef USE_MORPHNORMALS\n\t\tattribute vec3 morphNormal0;\n\t\tattribute vec3 morphNormal1;\n\t\tattribute vec3 morphNormal2;\n\t\tattribute vec3 morphNormal3;\n\t#else\n\t\tattribute vec3 morphTarget4;\n\t\tattribute vec3 morphTarget5;\n\t\tattribute vec3 morphTarget6;\n\t\tattribute vec3 morphTarget7;\n\t#endif\n#endif\n#ifdef USE_SKINNING\n\tattribute vec4 skinIndex;\n\tattribute vec4 skinWeight;\n#endif\n"].join("\n"), b=["precision "+e.precision+" float;","precision "+e.precision+" int;",e.bumpMap||e.normalMap||e.flatShading?"#extension GL_OES_standard_derivatives : enable":"",v,"#define MAX_DIR_LIGHTS "+e.maxDirLights,"#define MAX_POINT_LIGHTS "+e.maxPointLights,"#define MAX_SPOT_LIGHTS "+e.maxSpotLights,"#define MAX_HEMI_LIGHTS "+e.maxHemiLights,"#define MAX_SHADOWS "+e.maxShadows,e.alphaTest?"#define ALPHATEST "+e.alphaTest:"",b.gammaInput?"#define GAMMA_INPUT":"",b.gammaOutput?"#define GAMMA_OUTPUT":"","#define GAMMA_FACTOR "+ u,e.useFog&&e.fog?"#define USE_FOG":"",e.useFog&&e.fogExp?"#define FOG_EXP2":"",e.map?"#define USE_MAP":"",e.envMap?"#define USE_ENVMAP":"",e.envMap?"#define "+t:"",e.envMap?"#define "+r:"",e.envMap?"#define "+s:"",e.lightMap?"#define USE_LIGHTMAP":"",e.bumpMap?"#define USE_BUMPMAP":"",e.normalMap?"#define USE_NORMALMAP":"",e.specularMap?"#define USE_SPECULARMAP":"",e.alphaMap?"#define USE_ALPHAMAP":"",e.vertexColors?"#define USE_COLOR":"",e.flatShading?"#define FLAT_SHADED":"",e.metal?"#define METAL": "",e.wrapAround?"#define WRAP_AROUND":"",e.doubleSided?"#define DOUBLE_SIDED":"",e.flipSided?"#define FLIP_SIDED":"",e.shadowMapEnabled?"#define USE_SHADOWMAP":"",e.shadowMapEnabled?"#define "+n:"",e.shadowMapDebug?"#define SHADOWMAP_DEBUG":"",e.shadowMapCascade?"#define SHADOWMAP_CASCADE":"",e.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n"));l=new THREE.WebGLShader(f,f.VERTEX_SHADER,d+l);p=new THREE.WebGLShader(f,f.FRAGMENT_SHADER, b+p);f.attachShader(g,l);f.attachShader(g,p);void 0!==q&&f.bindAttribLocation(g,0,q);f.linkProgram(g);q=f.getProgramInfoLog(g);!1===f.getProgramParameter(g,f.LINK_STATUS)&&THREE.error("THREE.WebGLProgram: shader error: "+f.getError,"gl.VALIDATE_STATUS",f.getProgramParameter(g,f.VALIDATE_STATUS),"gl.getPRogramInfoLog",q);""!==q&&THREE.warn("THREE.WebGLProgram: gl.getProgramInfoLog"+q);f.deleteShader(l);f.deleteShader(p);q="viewMatrix modelViewMatrix projectionMatrix normalMatrix modelMatrix cameraPosition morphTargetInfluences bindMatrix bindMatrixInverse".split(" "); e.useVertexTexture?(q.push("boneTexture"),q.push("boneTextureWidth"),q.push("boneTextureHeight")):q.push("boneGlobalMatrices");e.logarithmicDepthBuffer&&q.push("logDepthBufFC");for(var w in h)q.push(w);h=q;w={};q=0;for(b=h.length;q<b;q++)n=h[q],w[n]=f.getUniformLocation(g,n);this.uniforms=w;q="position normal uv uv2 tangent color skinIndex skinWeight lineDistance".split(" ");for(h=0;h<e.maxMorphTargets;h++)q.push("morphTarget"+h);for(h=0;h<e.maxMorphNormals;h++)q.push("morphNormal"+h);for(var y in k)q.push(y); e=q;k={};y=0;for(h=e.length;y<h;y++)w=e[y],k[w]=f.getAttribLocation(g,w);this.attributes=k;this.attributesKeys=Object.keys(this.attributes);this.id=a++;this.code=c;this.usedTimes=1;this.program=g;this.vertexShader=l;this.fragmentShader=p;return this}}; THREE.WebGLShader=function{var a=function(a){a=a.split("\n");for(var c=0;c<a.length;c++)a[c]=c+1+": "+a[c];return a.join("\n")};return function(b,c,d){c=b.createShader(c);b.shaderSource(c,d);b.compileShader(c);!1===b.getShaderParameter(c,b.COMPILE_STATUS)&&THREE.error("THREE.WebGLShader: Shader couldn't compile.");""!==b.getShaderInfoLog(c)&&THREE.warn("THREE.WebGLShader: gl.getShaderInfoLog",b.getShaderInfoLog(c),a(d));return c}}; THREE.WebGLState=function(a,b){var c=new Uint8Array(16),d=new Uint8Array(16),e=null,f=null,g=null,h=null,k=null,l=null,p=null,q=null,n=null,t=null,r=null,s=null,u=null,v=null,x=null,D=null;this.initAttributes=function{for(var a=0,b=c.length;a<b;a++)c[a]=0};this.enableAttribute=function(b){c[b]=1;0===d[b]&&(a.enableVertexAttribArray(b),d[b]=1)};this.disableUnusedAttributes=function{for(var b=0,e=d.length;b<e;b++)d[b]!==c[b]&&(a.disableVertexAttribArray(b),d[b]=0)};this.setBlending=function(c,d, n,q,r,s,t){c!==e&&(c===THREE.NoBlending?a.disable(a.BLEND):c===THREE.AdditiveBlending?(a.enable(a.BLEND),a.blendEquation(a.FUNC_ADD),a.blendFunc(a.SRC_ALPHA,a.ONE)):c===THREE.SubtractiveBlending?(a.enable(a.BLEND),a.blendEquation(a.FUNC_ADD),a.blendFunc(a.ZERO,a.ONE_MINUS_SRC_COLOR)):c===THREE.MultiplyBlending?(a.enable(a.BLEND),a.blendEquation(a.FUNC_ADD),a.blendFunc(a.ZERO,a.SRC_COLOR)):c===THREE.CustomBlending?a.enable(a.BLEND):(a.enable(a.BLEND),a.blendEquationSeparate(a.FUNC_ADD,a.FUNC_ADD), a.blendFuncSeparate(a.SRC_ALPHA,a.ONE_MINUS_SRC_ALPHA,a.ONE,a.ONE_MINUS_SRC_ALPHA)),e=c);if(c===THREE.CustomBlending){r=r||d;s=s||n;t=t||q;if(d!==f||r!==k)a.blendEquationSeparate(b(d),b(r)),f=d,k=r;if(n!==g||q!==h||s!==l||t!==p)a.blendFuncSeparate(b(n),b(q),b(s),b(t)),g=n,h=q,l=s,p=t}else p=l=k=h=g=f=null};this.setDepthTest=function(b){q!==b&&(b?a.enable(a.DEPTH_TEST):a.disable(a.DEPTH_TEST),q=b)};this.setDepthWrite=function(b){n!==b&&(a.depthMask(b),n=b)};this.setColorWrite=function(b){t!==b&&(a.colorMask(b, b,b,b),t=b)};this.setDoubleSided=function(b){r!==b&&(b?a.disable(a.CULL_FACE):a.enable(a.CULL_FACE),r=b)};this.setFlipSided=function(b){s!==b&&(b?a.frontFace(a.CW):a.frontFace(a.CCW),s=b)};this.setLineWidth=function(b){b!==u&&(a.lineWidth(b),u=b)};this.setPolygonOffset=function(b,c,d){v!==b&&(b?a.enable(a.POLYGON_OFFSET_FILL):a.disable(a.POLYGON_OFFSET_FILL),v=b);!b||x===c&&D===d||(a.polygonOffset(c,d),x=c,D=d)};this.reset=function{for(var a=0;a<d.length;a++)d[a]=0;s=r=t=n=q=e=null}}; THREE.LensFlarePlugin=function(a,b){var c,d,e,f,g,h,k,l,p,q,n=a.context,t,r,s,u,v,x;this.render=function(D,w,y,A){if(0!==b.length){D=new THREE.Vector3;var E=A/y,G=.5*y,F=.5*A,z=16/A,I=new THREE.Vector2(z*E,z),U=new THREE.Vector3(1,1,0),M=new THREE.Vector2(1,1);if(void 0===s){var z=new Float32Array([-1,-1,0,0,1,-1,1,0,1,1,1,1,-1,1,0,1]),H=new Uint16Array([0,1,2,0,2,3]);t=n.createBuffer;r=n.createBuffer;n.bindBuffer(n.ARRAY_BUFFER,t);n.bufferData(n.ARRAY_BUFFER,z,n.STATIC_DRAW);n.bindBuffer(n.ELEMENT_ARRAY_BUFFER, r);n.bufferData(n.ELEMENT_ARRAY_BUFFER,H,n.STATIC_DRAW);v=n.createTexture;x=n.createTexture;n.bindTexture(n.TEXTURE_2D,v);n.texImage2D(n.TEXTURE_2D,0,n.RGB,16,16,0,n.RGB,n.UNSIGNED_BYTE,null);n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_S,n.CLAMP_TO_EDGE);n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_T,n.CLAMP_TO_EDGE);n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MAG_FILTER,n.NEAREST);n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MIN_FILTER,n.NEAREST);n.bindTexture(n.TEXTURE_2D,x);n.texImage2D(n.TEXTURE_2D,0, n.RGBA,16,16,0,n.RGBA,n.UNSIGNED_BYTE,null);n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_S,n.CLAMP_TO_EDGE);n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_T,n.CLAMP_TO_EDGE);n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MAG_FILTER,n.NEAREST);n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MIN_FILTER,n.NEAREST);var z=(u=0<n.getParameter(n.MAX_VERTEX_TEXTURE_IMAGE_UNITS))?{vertexShader:"uniform lowp int renderType;\nuniform vec3 screenPosition;\nuniform vec2 scale;\nuniform float rotation;\nuniform sampler2D occlusionMap;\nattribute vec2 position;\nattribute vec2 uv;\nvarying vec2 vUV;\nvarying float vVisibility;\nvoid main {\nvUV = uv;\nvec2 pos = position;\nif( renderType == 2 ) {\nvec4 visibility = texture2D( occlusionMap, vec2( 0.1, 0.1 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.5, 0.1 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.9, 0.1 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.9, 0.5 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.9, 0.9 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.5, 0.9 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.1, 0.9 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.1, 0.5 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.5, 0.5 ) );\nvVisibility =       visibility.r / 9.0;\nvVisibility *= 1.0 - visibility.g / 9.0;\nvVisibility *=       visibility.b / 9.0;\nvVisibility *= 1.0 - visibility.a / 9.0;\npos.x = cos( rotation ) * position.x - sin( rotation ) * position.y;\npos.y = sin( rotation ) * position.x + cos( rotation ) * position.y;\n}\ngl_Position = vec4( ( pos * scale + screenPosition.xy ).xy, screenPosition.z, 1.0 );\n}", fragmentShader:"uniform lowp int renderType;\nuniform sampler2D map;\nuniform float opacity;\nuniform vec3 color;\nvarying vec2 vUV;\nvarying float vVisibility;\nvoid main {\nif( renderType == 0 ) {\ngl_FragColor = vec4( 1.0, 0.0, 1.0, 0.0 );\n} else if( renderType == 1 ) {\ngl_FragColor = texture2D( map, vUV );\n} else {\nvec4 texture = texture2D( map, vUV );\ntexture.a *= opacity * vVisibility;\ngl_FragColor = texture;\ngl_FragColor.rgb *= color;\n}\n}"}:{vertexShader:"uniform lowp int renderType;\nuniform vec3 screenPosition;\nuniform vec2 scale;\nuniform float rotation;\nattribute vec2 position;\nattribute vec2 uv;\nvarying vec2 vUV;\nvoid main {\nvUV = uv;\nvec2 pos = position;\nif( renderType == 2 ) {\npos.x = cos( rotation ) * position.x - sin( rotation ) * position.y;\npos.y = sin( rotation ) * position.x + cos( rotation ) * position.y;\n}\ngl_Position = vec4( ( pos * scale + screenPosition.xy ).xy, screenPosition.z, 1.0 );\n}", fragmentShader:"precision mediump float;\nuniform lowp int renderType;\nuniform sampler2D map;\nuniform sampler2D occlusionMap;\nuniform float opacity;\nuniform vec3 color;\nvarying vec2 vUV;\nvoid main {\nif( renderType == 0 ) {\ngl_FragColor = vec4( texture2D( map, vUV ).rgb, 0.0 );\n} else if( renderType == 1 ) {\ngl_FragColor = texture2D( map, vUV );\n} else {\nfloat visibility = texture2D( occlusionMap, vec2( 0.5, 0.1 ) ).a;\nvisibility += texture2D( occlusionMap, vec2( 0.9, 0.5 ) ).a;\nvisibility += texture2D( occlusionMap, vec2( 0.5, 0.9 ) ).a;\nvisibility += texture2D( occlusionMap, vec2( 0.1, 0.5 ) ).a;\nvisibility = ( 1.0 - visibility / 4.0 );\nvec4 texture = texture2D( map, vUV );\ntexture.a *= opacity * visibility;\ngl_FragColor = texture;\ngl_FragColor.rgb *= color;\n}\n}"}, H=n.createProgram,L=n.createShader(n.FRAGMENT_SHADER),P=n.createShader(n.VERTEX_SHADER),N="precision "+a.getPrecision+" float;\n";n.shaderSource(L,N+z.fragmentShader);n.shaderSource(P,N+z.vertexShader);n.compileShader(L);n.compileShader(P);n.attachShader(H,L);n.attachShader(H,P);n.linkProgram(H);s=H;p=n.getAttribLocation(s,"position");q=n.getAttribLocation(s,"uv");c=n.getUniformLocation(s,"renderType");d=n.getUniformLocation(s,"map");e=n.getUniformLocation(s,"occlusionMap");f=n.getUniformLocation(s, "opacity");g=n.getUniformLocation(s,"color");h=n.getUniformLocation(s,"scale");k=n.getUniformLocation(s,"rotation");l=n.getUniformLocation(s,"screenPosition")}n.useProgram(s);n.enableVertexAttribArray(p);n.enableVertexAttribArray(q);n.uniform1i(e,0);n.uniform1i(d,1);n.bindBuffer(n.ARRAY_BUFFER,t);n.vertexAttribPointer(p,2,n.FLOAT,!1,16,0);n.vertexAttribPointer(q,2,n.FLOAT,!1,16,8);n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,r);n.disable(n.CULL_FACE);n.depthMask(!1);H=0;for(L=b.length;H<L;H++)if(z=16/A,I.set(z* E,z),P=b[H],D.set(P.matrixWorld.elements[12],P.matrixWorld.elements[13],P.matrixWorld.elements[14]),D.applyMatrix4(w.matrixWorldInverse),D.applyProjection(w.projectionMatrix),U.copy(D),M.x=U.x*G+G,M.y=U.y*F+F,u||0<M.x&&M.x<y&&0<M.y&&M.y<A){n.activeTexture(n.TEXTURE1);n.bindTexture(n.TEXTURE_2D,v);n.copyTexImage2D(n.TEXTURE_2D,0,n.RGB,M.x-8,M.y-8,16,16,0);n.uniform1i(c,0);n.uniform2f(h,I.x,I.y);n.uniform3f(l,U.x,U.y,U.z);n.disable(n.BLEND);n.enable(n.DEPTH_TEST);n.drawElements(n.TRIANGLES,6,n.UNSIGNED_SHORT, 0);n.activeTexture(n.TEXTURE0);n.bindTexture(n.TEXTURE_2D,x);n.copyTexImage2D(n.TEXTURE_2D,0,n.RGBA,M.x-8,M.y-8,16,16,0);n.uniform1i(c,1);n.disable(n.DEPTH_TEST);n.activeTexture(n.TEXTURE1);n.bindTexture(n.TEXTURE_2D,v);n.drawElements(n.TRIANGLES,6,n.UNSIGNED_SHORT,0);P.positionScreen.copy(U);P.customUpdateCallback?P.customUpdateCallback(P):P.updateLensFlares;n.uniform1i(c,2);n.enable(n.BLEND);for(var N=0,R=P.lensFlares.length;N<R;N++){var V=P.lensFlares[N];.001<V.opacity&&.001<V.scale&&(U.x=V.x, U.y=V.y,U.z=V.z,z=V.size*V.scale/A,I.x=z*E,I.y=z,n.uniform3f(l,U.x,U.y,U.z),n.uniform2f(h,I.x,I.y),n.uniform1f(k,V.rotation),n.uniform1f(f,V.opacity),n.uniform3f(g,V.color.r,V.color.g,V.color.b),a.state.setBlending(V.blending,V.blendEquation,V.blendSrc,V.blendDst),a.setTexture(V.texture,1),n.drawElements(n.TRIANGLES,6,n.UNSIGNED_SHORT,0))}}n.enable(n.CULL_FACE);n.enable(n.DEPTH_TEST);n.depthMask(!0);a.resetGLState}}}; THREE.ShadowMapPlugin=function(a,b,c,d){function e(a,b,d){if(b.visible){var f=c[b.id];if(f&&b.castShadow&&(!1===b.frustumCulled||!0===p.intersectsObject(b)))for(var g=0,h=f.length;g<h;g++){var k=f[g];b._modelViewMatrix.multiplyMatrices(d.matrixWorldInverse,b.matrixWorld);s.push(k)}g=0;for(h=b.children.length;g<h;g++)e(a,b.children[g],d)}}var f=a.context,g,h,k,l,p=new THREE.Frustum,q=new THREE.Matrix4,n=new THREE.Vector3,t=new THREE.Vector3,r=new THREE.Vector3,s=[],u=THREE.ShaderLib.depthRGBA,v=THREE.UniformsUtils.clone(u.uniforms); g=new THREE.ShaderMaterial({uniforms:v,vertexShader:u.vertexShader,fragmentShader:u.fragmentShader});h=new THREE.ShaderMaterial({uniforms:v,vertexShader:u.vertexShader,fragmentShader:u.fragmentShader,morphTargets:!0});k=new THREE.ShaderMaterial({uniforms:v,vertexShader:u.vertexShader,fragmentShader:u.fragmentShader,skinning:!0});l=new THREE.ShaderMaterial({uniforms:v,vertexShader:u.vertexShader,fragmentShader:u.fragmentShader,morphTargets:!0,skinning:!0});g._shadowPass=!0;h._shadowPass=!0;k._shadowPass= !0;l._shadowPass=!0;this.render=function(c,v){if(!1!==a.shadowMapEnabled){var u,y,A,E,G,F,z,I,U=[];E=0;f.clearColor(1,1,1,1);f.disable(f.BLEND);f.enable(f.CULL_FACE);f.frontFace(f.CCW);a.shadowMapCullFace===THREE.CullFaceFront?f.cullFace(f.FRONT):f.cullFace(f.BACK);a.state.setDepthTest(!0);u=0;for(y=b.length;u<y;u++)if(A=b[u],A.castShadow)if(A instanceof THREE.DirectionalLight&&A.shadowCascade)for(G=0;G<A.shadowCascadeCount;G++){var M;if(A.shadowCascadeArray[G])M=A.shadowCascadeArray[G];else{z=A; var H=G;M=new THREE.DirectionalLight;M.isVirtual=!0;M.onlyShadow=!0;M.castShadow=!0;M.shadowCameraNear=z.shadowCameraNear;M.shadowCameraFar=z.shadowCameraFar;M.shadowCameraLeft=z.shadowCameraLeft;M.shadowCameraRight=z.shadowCameraRight;M.shadowCameraBottom=z.shadowCameraBottom;M.shadowCameraTop=z.shadowCameraTop;M.shadowCameraVisible=z.shadowCameraVisible;M.shadowDarkness=z.shadowDarkness;M.shadowBias=z.shadowCascadeBias[H];M.shadowMapWidth=z.shadowCascadeWidth[H];M.shadowMapHeight=z.shadowCascadeHeight[H]; M.pointsWorld=[];M.pointsFrustum=[];I=M.pointsWorld;F=M.pointsFrustum;for(var L=0;8>L;L++)I[L]=new THREE.Vector3,F[L]=new THREE.Vector3;I=z.shadowCascadeNearZ[H];z=z.shadowCascadeFarZ[H];F[0].set(-1,-1,I);F[1].set(1,-1,I);F[2].set(-1,1,I);F[3].set(1,1,I);F[4].set(-1,-1,z);F[5].set(1,-1,z);F[6].set(-1,1,z);F[7].set(1,1,z);M.originalCamera=v;F=new THREE.Gyroscope;F.position.copy(A.shadowCascadeOffset);F.add(M);F.add(M.target);v.add(F);A.shadowCascadeArray[G]=M}H=A;I=G;z=H.shadowCascadeArray[I];z.position.copy(H.position); z.target.position.copy(H.target.position);z.lookAt(z.target);z.shadowCameraVisible=H.shadowCameraVisible;z.shadowDarkness=H.shadowDarkness;z.shadowBias=H.shadowCascadeBias[I];F=H.shadowCascadeNearZ[I];H=H.shadowCascadeFarZ[I];z=z.pointsFrustum;z[0].z=F;z[1].z=F;z[2].z=F;z[3].z=F;z[4].z=H;z[5].z=H;z[6].z=H;z[7].z=H;U[E]=M;E++}else U[E]=A,E++;u=0;for(y=U.length;u<y;u++){A=U[u];A.shadowMap||(G=THREE.LinearFilter,a.shadowMapType===THREE.PCFSoftShadowMap&&(G=THREE.NearestFilter),A.shadowMap=new THREE.WebGLRenderTarget(A.shadowMapWidth, A.shadowMapHeight,{minFilter:G,magFilter:G,format:THREE.RGBAFormat}),A.shadowMapSize=new THREE.Vector2(A.shadowMapWidth,A.shadowMapHeight),A.shadowMatrix=new THREE.Matrix4);if(!A.shadowCamera){if(A instanceof THREE.SpotLight)A.shadowCamera=new THREE.PerspectiveCamera(A.shadowCameraFov,A.shadowMapWidth/A.shadowMapHeight,A.shadowCameraNear,A.shadowCameraFar);else if(A instanceof THREE.DirectionalLight)A.shadowCamera=new THREE.OrthographicCamera(A.shadowCameraLeft,A.shadowCameraRight,A.shadowCameraTop, A.shadowCameraBottom,A.shadowCameraNear,A.shadowCameraFar);else{THREE.error("THREE.ShadowMapPlugin: Unsupported light type for shadow",A);continue}c.add(A.shadowCamera);!0===c.autoUpdate&&c.updateMatrixWorld}A.shadowCameraVisible&&!A.cameraHelper&&(A.cameraHelper=new THREE.CameraHelper(A.shadowCamera),c.add(A.cameraHelper));if(A.isVirtual&&M.originalCamera==v){G=v;E=A.shadowCamera;F=A.pointsFrustum;z=A.pointsWorld;n.set(Infinity,Infinity,Infinity);t.set(-Infinity,-Infinity,-Infinity);for(H=0;8> H;H++)I=z[H],I.copy(F[H]),I.unproject(G),I.applyMatrix4(E.matrixWorldInverse),I.x<n.x&&(n.x=I.x),I.x>t.x&&(t.x=I.x),I.y<n.y&&(n.y=I.y),I.y>t.y&&(t.y=I.y),I.z<n.z&&(n.z=I.z),I.z>t.z&&(t.z=I.z);E.left=n.x;E.right=t.x;E.top=t.y;E.bottom=n.y;E.updateProjectionMatrix}E=A.shadowMap;F=A.shadowMatrix;G=A.shadowCamera;G.position.setFromMatrixPosition(A.matrixWorld);r.setFromMatrixPosition(A.target.matrixWorld);G.lookAt(r);G.updateMatrixWorld;G.matrixWorldInverse.getInverse(G.matrixWorld);A.cameraHelper&& (A.cameraHelper.visible=A.shadowCameraVisible);A.shadowCameraVisible&&A.cameraHelper.update;F.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1);F.multiply(G.projectionMatrix);F.multiply(G.matrixWorldInverse);q.multiplyMatrices(G.projectionMatrix,G.matrixWorldInverse);p.setFromMatrix(q);a.setRenderTarget(E);a.clear;s.length=0;e(c,c,G);A=0;for(E=s.length;A<E;A++)z=s[A],F=z.object,z=z.buffer,H=F.material instanceof THREE.MeshFaceMaterial?F.material.materials[0]:F.material,I=void 0!==F.geometry.morphTargets&& 0<F.geometry.morphTargets.length&&H.morphTargets,L=F instanceof THREE.SkinnedMesh&&H.skinning,I=F.customDepthMaterial?F.customDepthMaterial:L?I?l:k:I?h:g,a.setMaterialFaces(H),z instanceof THREE.BufferGeometry?a.renderBufferDirect(G,b,null,I,z,F):a.renderBuffer(G,b,null,I,z,F);A=0;for(E=d.length;A<E;A++)z=d[A],F=z.object,F.visible&&F.castShadow&&(F._modelViewMatrix.multiplyMatrices(G.matrixWorldInverse,F.matrixWorld),a.renderImmediateObject(G,b,null,g,F))}u=a.getClearColor;y=a.getClearAlpha;f.clearColor(u.r, u.g,u.b,y);f.enable(f.BLEND);a.shadowMapCullFace===THREE.CullFaceFront&&f.cullFace(f.BACK);a.resetGLState}}}; THREE.SpritePlugin=function(a,b){var c,d,e,f,g,h,k,l,p,q,n,t,r,s,u,v,x;function D(a,b){return a.z!==b.z?b.z-a.z:b.id-a.id}var w=a.context,y,A,E,G,F=new THREE.Vector3,z=new THREE.Quaternion,I=new THREE.Vector3;this.render=function(U,M){if(0!==b.length){if(void 0===E){var H=new Float32Array([-.5,-.5,0,0,.5,-.5,1,0,.5,.5,1,1,-.5,.5,0,1]),L=new Uint16Array([0,1,2,0,2,3]);y=w.createBuffer;A=w.createBuffer;w.bindBuffer(w.ARRAY_BUFFER,y);w.bufferData(w.ARRAY_BUFFER,H,w.STATIC_DRAW);w.bindBuffer(w.ELEMENT_ARRAY_BUFFER, A);w.bufferData(w.ELEMENT_ARRAY_BUFFER,L,w.STATIC_DRAW);var H=w.createProgram,L=w.createShader(w.VERTEX_SHADER),P=w.createShader(w.FRAGMENT_SHADER);w.shaderSource(L,["precision "+a.getPrecision+" float;","uniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform float rotation;\nuniform vec2 scale;\nuniform vec2 uvOffset;\nuniform vec2 uvScale;\nattribute vec2 position;\nattribute vec2 uv;\nvarying vec2 vUV;\nvoid main {\nvUV = uvOffset + uv * uvScale;\nvec2 alignedPosition = position * scale;\nvec2 rotatedPosition;\nrotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\nrotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\nvec4 finalPosition;\nfinalPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\nfinalPosition.xy += rotatedPosition;\nfinalPosition = projectionMatrix * finalPosition;\ngl_Position = finalPosition;\n}"].join("\n")); w.shaderSource(P,["precision "+a.getPrecision+" float;","uniform vec3 color;\nuniform sampler2D map;\nuniform float opacity;\nuniform int fogType;\nuniform vec3 fogColor;\nuniform float fogDensity;\nuniform float fogNear;\nuniform float fogFar;\nuniform float alphaTest;\nvarying vec2 vUV;\nvoid main {\nvec4 texture = texture2D( map, vUV );\nif ( texture.a < alphaTest ) discard;\ngl_FragColor = vec4( color * texture.xyz, texture.a * opacity );\nif ( fogType > 0 ) {\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\nfloat fogFactor = 0.0;\nif ( fogType == 1 ) {\nfogFactor = smoothstep( fogNear, fogFar, depth );\n} else {\nconst float LOG2 = 1.442695;\nfloat fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n}\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n}\n}"].join("\n")); w.compileShader(L);w.compileShader(P);w.attachShader(H,L);w.attachShader(H,P);w.linkProgram(H);E=H;v=w.getAttribLocation(E,"position");x=w.getAttribLocation(E,"uv");c=w.getUniformLocation(E,"uvOffset");d=w.getUniformLocation(E,"uvScale");e=w.getUniformLocation(E,"rotation");f=w.getUniformLocation(E,"scale");g=w.getUniformLocation(E,"color");h=w.getUniformLocation(E,"map");k=w.getUniformLocation(E,"opacity");l=w.getUniformLocation(E,"modelViewMatrix");p=w.getUniformLocation(E,"projectionMatrix");q= w.getUniformLocation(E,"fogType");n=w.getUniformLocation(E,"fogDensity");t=w.getUniformLocation(E,"fogNear");r=w.getUniformLocation(E,"fogFar");s=w.getUniformLocation(E,"fogColor");u=w.getUniformLocation(E,"alphaTest");H=document.createElement("canvas");H.width=8;H.height=8;L=H.getContext("2d");L.fillStyle="white";L.fillRect(0,0,8,8);G=new THREE.Texture(H);G.needsUpdate=!0}w.useProgram(E);w.enableVertexAttribArray(v);w.enableVertexAttribArray(x);w.disable(w.CULL_FACE);w.enable(w.BLEND);w.bindBuffer(w.ARRAY_BUFFER, y);w.vertexAttribPointer(v,2,w.FLOAT,!1,16,0);w.vertexAttribPointer(x,2,w.FLOAT,!1,16,8);w.bindBuffer(w.ELEMENT_ARRAY_BUFFER,A);w.uniformMatrix4fv(p,!1,M.projectionMatrix.elements);w.activeTexture(w.TEXTURE0);w.uniform1i(h,0);L=H=0;(P=U.fog)?(w.uniform3f(s,P.color.r,P.color.g,P.color.b),P instanceof THREE.Fog?(w.uniform1f(t,P.near),w.uniform1f(r,P.far),w.uniform1i(q,1),L=H=1):P instanceof THREE.FogExp2&&(w.uniform1f(n,P.density),w.uniform1i(q,2),L=H=2)):(w.uniform1i(q,0),L=H=0);for(var P=0,N=b.length;P< N;P++){var R=b[P];R._modelViewMatrix.multiplyMatrices(M.matrixWorldInverse,R.matrixWorld);R.z=-R._modelViewMatrix.elements[14]}b.sort(D);for(var V=[],P=0,N=b.length;P<N;P++){var R=b[P],J=R.material;w.uniform1f(u,J.alphaTest);w.uniformMatrix4fv(l,!1,R._modelViewMatrix.elements);R.matrixWorld.decompose(F,z,I);V[0]=I.x;V[1]=I.y;R=0;U.fog&&J.fog&&(R=L);H!==R&&(w.uniform1i(q,R),H=R);null!==J.map?(w.uniform2f(c,J.map.offset.x,J.map.offset.y),w.uniform2f(d,J.map.repeat.x,J.map.repeat.y)):(w.uniform2f(c, 0,0),w.uniform2f(d,1,1));w.uniform1f(k,J.opacity);w.uniform3f(g,J.color.r,J.color.g,J.color.b);w.uniform1f(e,J.rotation);w.uniform2fv(f,V);a.state.setBlending(J.blending,J.blendEquation,J.blendSrc,J.blendDst);a.state.setDepthTest(J.depthTest);a.state.setDepthWrite(J.depthWrite);J.map&&J.map.image&&J.map.image.width?a.setTexture(J.map,0):a.setTexture(G,0);w.drawElements(w.TRIANGLES,6,w.UNSIGNED_SHORT,0)}w.enable(w.CULL_FACE);a.resetGLState}}}; THREE.GeometryUtils={merge:function(a,b,c){THREE.warn("THREE.GeometryUtils: .merge has been moved to Geometry. Use geometry.merge( geometry2, matrix, materialIndexOffset ) instead.");var d;b instanceof THREE.Mesh&&(b.matrixAutoUpdate&&b.updateMatrix,d=b.matrix,b=b.geometry);a.merge(b,d,c)},center:function(a){THREE.warn("THREE.GeometryUtils: .center has been moved to Geometry. Use geometry.center instead.");return a.center}}; THREE.ImageUtils={crossOrigin:void 0,loadTexture:function(a,b,c,d){var e=new THREE.ImageLoader;e.crossOrigin=this.crossOrigin;var f=new THREE.Texture(void 0,b);e.load(a,function(a){f.image=a;f.needsUpdate=!0;c&&c(f)},void 0,function(a){d&&d(a)});f.sourceFile=a;return f},loadTextureCube:function(a,b,c,d){var e=new THREE.ImageLoader;e.crossOrigin=this.crossOrigin;var f=new THREE.CubeTexture([],b);f.flipY=!1;var g=0;b=function(b){e.load(a[b],function(a){f.images[b]=a;g+=1;6===g&&(f.needsUpdate=!0,c&& c(f))},void 0,d)};for(var h=0,k=a.length;h<k;++h)b(h);return f},loadCompressedTexture:function{THREE.error("THREE.ImageUtils.loadCompressedTexture has been removed. Use THREE.DDSLoader instead.")},loadCompressedTextureCube:function{THREE.error("THREE.ImageUtils.loadCompressedTextureCube has been removed. Use THREE.DDSLoader instead.")},getNormalMap:function(a,b){var c=function(a){var b=Math.sqrt(a[0]*a[0]+a[1]*a[1]+a[2]*a[2]);return[a[0]/b,a[1]/b,a[2]/b]};b|=1;var d=a.width,e=a.height,f=document.createElement("canvas"); f.width=d;f.height=e;var g=f.getContext("2d");g.drawImage(a,0,0);for(var h=g.getImageData(0,0,d,e).data,k=g.createImageData(d,e),l=k.data,p=0;p<d;p++)for(var q=0;q<e;q++){var n=0>q-1?0:q-1,t=q+1>e-1?e-1:q+1,r=0>p-1?0:p-1,s=p+1>d-1?d-1:p+1,u=[],v=[0,0,h[4*(q*d+p)]/255*b];u.push([-1,0,h[4*(q*d+r)]/255*b]);u.push([-1,-1,h[4*(n*d+r)]/255*b]);u.push([0,-1,h[4*(n*d+p)]/255*b]);u.push([1,-1,h[4*(n*d+s)]/255*b]);u.push([1,0,h[4*(q*d+s)]/255*b]);u.push([1,1,h[4*(t*d+s)]/255*b]);u.push([0,1,h[4*(t*d+p)]/255* b]);u.push([-1,1,h[4*(t*d+r)]/255*b]);n=[];r=u.length;for(t=0;t<r;t++){var s=u[t],x=u[(t+1)%r],s=[s[0]-v[0],s[1]-v[1],s[2]-v[2]],x=[x[0]-v[0],x[1]-v[1],x[2]-v[2]];n.push(c([s[1]*x[2]-s[2]*x[1],s[2]*x[0]-s[0]*x[2],s[0]*x[1]-s[1]*x[0]]))}u=[0,0,0];for(t=0;t<n.length;t++)u[0]+=n[t][0],u[1]+=n[t][1],u[2]+=n[t][2];u[0]/=n.length;u[1]/=n.length;u[2]/=n.length;v=4*(q*d+p);l[v]=(u[0]+1)/2*255|0;l[v+1]=(u[1]+1)/2*255|0;l[v+2]=255*u[2]|0;l[v+3]=255}g.putImageData(k,0,0);return f},generateDataTexture:function(a, b,c){var d=a*b,e=new Uint8Array(3*d),f=Math.floor(255*c.r),g=Math.floor(255*c.g);c=Math.floor(255*c.b);for(var h=0;h<d;h++)e[3*h]=f,e[3*h+1]=g,e[3*h+2]=c;a=new THREE.DataTexture(e,a,b,THREE.RGBFormat);a.needsUpdate=!0;return a}}; THREE.SceneUtils={createMultiMaterialObject:function(a,b){for(var c=new THREE.Object3D,d=0,e=b.length;d<e;d++)c.add(new THREE.Mesh(a,b[d]));return c},detach:function(a,b,c){a.applyMatrix(b.matrixWorld);b.remove(a);c.add(a)},attach:function(a,b,c){var d=new THREE.Matrix4;d.getInverse(c.matrixWorld);a.applyMatrix(d);b.remove(a);c.add(a)}}; THREE.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(a){throw"The font "+this.face+" with "+this.weight+" weight and "+this.style+" style is missing.";}},loadFace:function(a){var b=a.familyName.toLowerCase;this.faces[b]=this.faces[b]||{};this.faces[b][a.cssFontWeight]=this.faces[b][a.cssFontWeight]||{};this.faces[b][a.cssFontWeight][a.cssFontStyle]=a;return this.faces[b][a.cssFontWeight][a.cssFontStyle]= a},drawText:function(a){var b=this.getFace,c=this.size/b.resolution,d=0,e=String(a).split(""),f=e.length,g=[];for(a=0;a<f;a++){var h=new THREE.Path,h=this.extractGlyphPoints(e[a],b,c,d,h),d=d+h.offset;g.push(h.path)}return{paths:g,offset:d/2}},extractGlyphPoints:function(a,b,c,d,e){var f=[],g,h,k,l,p,q,n,t,r,s,u,v=b.glyphs[a]||b.glyphs["?"];if(v){if(v.o)for(b=v._cachedOutline||(v._cachedOutline=v.o.split(" ")),l=b.length,a=0;a<l;)switch(k=b[a++],k){case "m":k=b[a++]*c+d;p=b[a++]*c;e.moveTo(k,p); break;case "l":k=b[a++]*c+d;p=b[a++]*c;e.lineTo(k,p);break;case "q":k=b[a++]*c+d;p=b[a++]*c;t=b[a++]*c+d;r=b[a++]*c;e.quadraticCurveTo(t,r,k,p);if(g=f[f.length-1])for(q=g.x,n=g.y,g=1,h=this.divisions;g<=h;g++){var x=g/h;THREE.Shape.Utils.b2(x,q,t,k);THREE.Shape.Utils.b2(x,n,r,p)}break;case "b":if(k=b[a++]*c+d,p=b[a++]*c,t=b[a++]*c+d,r=b[a++]*c,s=b[a++]*c+d,u=b[a++]*c,e.bezierCurveTo(t,r,s,u,k,p),g=f[f.length-1])for(q=g.x,n=g.y,g=1,h=this.divisions;g<=h;g++)x=g/h,THREE.Shape.Utils.b3(x,q,t,s,k),THREE.Shape.Utils.b3(x, n,r,u,p)}return{offset:v.ha*c,path:e}}}}; THREE.FontUtils.generateShapes=function(a,b){b=b||{};var c=void 0!==b.curveSegments?b.curveSegments:4,d=void 0!==b.font?b.font:"helvetiker",e=void 0!==b.weight?b.weight:"normal",f=void 0!==b.style?b.style:"normal";THREE.FontUtils.size=void 0!==b.size?b.size:100;THREE.FontUtils.divisions=c;THREE.FontUtils.face=d;THREE.FontUtils.weight=e;THREE.FontUtils.style=f;c=THREE.FontUtils.drawText(a).paths;d=[];e=0;for(f=c.length;e<f;e++)Array.prototype.push.apply(d,c[e].toShapes);return d}; (function(a){var b=function(a){for(var b=a.length,e=0,f=b-1,g=0;g<b;f=g++)e+=a[f].x*a[g].y-a[g].x*a[f].y;return.5*e};a.Triangulate=function(a,d){var e=a.length;if(3>e)return null;var f=[],g=[],h=[],k,l,p;if(0<b(a))for(l=0;l<e;l++)g[l]=l;else for(l=0;l<e;l++)g[l]=e-1-l;var q=2*e;for(l=e-1;2<e;){if(0>=q--){THREE.warn("THREE.FontUtils: Warning, unable to triangulate polygon! in Triangulate.process");break}k=l;e<=k&&(k=0);l=k+1;e<=l&&(l=0);p=l+1;e<=p&&(p=0);var n;a:{var t=n=void 0,r=void 0,s=void 0, u=void 0,v=void 0,x=void 0,D=void 0,w=void 0,t=a[g[k]].x,r=a[g[k]].y,s=a[g[l]].x,u=a[g[l]].y,v=a[g[p]].x,x=a[g[p]].y;if(1E-10>(s-t)*(x-r)-(u-r)*(v-t))n=!1;else{var y=void 0,A=void 0,E=void 0,G=void 0,F=void 0,z=void 0,I=void 0,U=void 0,M=void 0,H=void 0,M=U=I=w=D=void 0,y=v-s,A=x-u,E=t-v,G=r-x,F=s-t,z=u-r;for(n=0;n<e;n++)if(D=a[g[n]].x,w=a[g[n]].y,!(D===t&&w===r||D===s&&w===u||D===v&&w===x)&&(I=D-t,U=w-r,M=D-s,H=w-u,D-=v,w-=x,M=y*H-A*M,I=F*U-z*I,U=E*w-G*D,-1E-10<=M&&-1E-10<=U&&-1E-10<=I)){n=!1;break a}n= !0}}if(n){f.push([a[g[k]],a[g[l]],a[g[p]]]);h.push([g[k],g[l],g[p]]);k=l;for(p=l+1;p<e;k++,p++)g[k]=g[p];e--;q=2*e}}return d?h:f};a.Triangulate.area=b;return a})(THREE.FontUtils);self._typeface_js={faces:THREE.FontUtils.faces,loadFace:THREE.FontUtils.loadFace};THREE.typeface_js=self._typeface_js; THREE.Audio=function(a){THREE.Object3D.call(this);this.type="Audio";this.context=a.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};THREE.Audio.prototype=Object.create(THREE.Object3D.prototype);THREE.Audio.prototype.constructor=THREE.Audio; THREE.Audio.prototype.load=function(a){var b=this,c=new XMLHttpRequest;c.open("GET",a,!0);c.responseType="arraybuffer";c.onload=function(a){b.context.decodeAudioData(this.response,function(a){b.source.buffer=a;b.autoplay&&b.play})};c.send;return this}; THREE.Audio.prototype.play=function{if(!0===this.isPlaying)THREE.warn("THREE.Audio: Audio is already playing.");else{var a=this.context.createBufferSource;a.buffer=this.source.buffer;a.loop=this.source.loop;a.onended=this.source.onended;a.connect(this.panner);a.start(0,this.startTime);this.isPlaying=!0;this.source=a}};THREE.Audio.prototype.pause=function{this.source.stop;this.startTime=this.context.currentTime};THREE.Audio.prototype.stop=function{this.source.stop;this.startTime=0}; THREE.Audio.prototype.onEnded=function{this.isPlaying=!1};THREE.Audio.prototype.setLoop=function(a){this.source.loop=a};THREE.Audio.prototype.setRefDistance=function(a){this.panner.refDistance=a};THREE.Audio.prototype.setRolloffFactor=function(a){this.panner.rolloffFactor=a};THREE.Audio.prototype.setVolume=function(a){this.gain.gain.value=a}; THREE.Audio.prototype.updateMatrixWorld=function{var a=new THREE.Vector3;return function(b){THREE.Object3D.prototype.updateMatrixWorld.call(this,b);a.setFromMatrixPosition(this.matrixWorld);this.panner.setPosition(a.x,a.y,a.z)}};THREE.AudioListener=function{THREE.Object3D.call(this);this.type="AudioListener";this.context=new (window.AudioContext||window.webkitAudioContext)};THREE.AudioListener.prototype=Object.create(THREE.Object3D.prototype);THREE.AudioListener.prototype.constructor=THREE.AudioListener; THREE.AudioListener.prototype.updateMatrixWorld=function{var a=new THREE.Vector3,b=new THREE.Quaternion,c=new THREE.Vector3,d=new THREE.Vector3,e=new THREE.Vector3,f=new THREE.Vector3;return function(g){THREE.Object3D.prototype.updateMatrixWorld.call(this,g);g=this.context.listener;var h=this.up;this.matrixWorld.decompose(a,b,c);d.set(0,0,-1).applyQuaternion(b);e.subVectors(a,f);g.setPosition(a.x,a.y,a.z);g.setOrientation(d.x,d.y,d.z,h.x,h.y,h.z);g.setVelocity(e.x,e.y,e.z);f.copy(a)}}; THREE.Curve=function{};THREE.Curve.prototype.getPoint=function(a){THREE.warn("THREE.Curve: Warning, getPoint not implemented!");return null};THREE.Curve.prototype.getPointAt=function(a){a=this.getUtoTmapping(a);return this.getPoint(a)};THREE.Curve.prototype.getPoints=function(a){a||(a=5);var b,c=[];for(b=0;b<=a;b++)c.push(this.getPoint(b/a));return c};THREE.Curve.prototype.getSpacedPoints=function(a){a||(a=5);var b,c=[];for(b=0;b<=a;b++)c.push(this.getPointAt(b/a));return c}; THREE.Curve.prototype.getLength=function{var a=this.getLengths;return a[a.length-1]};THREE.Curve.prototype.getLengths=function(a){a||(a=this.__arcLengthDivisions?this.__arcLengthDivisions:200);if(this.cacheArcLengths&&this.cacheArcLengths.length==a+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;var b=[],c,d=this.getPoint(0),e,f=0;b.push(0);for(e=1;e<=a;e++)c=this.getPoint(e/a),f+=c.distanceTo(d),b.push(f),d=c;return this.cacheArcLengths=b}; THREE.Curve.prototype.updateArcLengths=function{this.needsUpdate=!0;this.getLengths};THREE.Curve.prototype.getUtoTmapping=function(a,b){var c=this.getLengths,d=0,e=c.length,f;f=b?b:a*c[e-1];for(var g=0,h=e-1,k;g<=h;)if(d=Math.floor(g+(h-g)/2),k=c[d]-f,0>k)g=d+1;else if(0<k)h=d-1;else{h=d;break}d=h;if(c[d]==f)return d/(e-1);g=c[d];return c=(d+(f-g)/(c[d+1]-g))/(e-1)};THREE.Curve.prototype.getTangent=function(a){var b=a-1E-4;a+=1E-4;0>b&&(b=0);1<a&&(a=1);b=this.getPoint(b);return this.getPoint(a).clone.sub(b).normalize}; THREE.Curve.prototype.getTangentAt=function(a){a=this.getUtoTmapping(a);return this.getTangent(a)}; THREE.Curve.Utils={tangentQuadraticBezier:function(a,b,c,d){return 2*(1-a)*(c-b)+2*a*(d-c)},tangentCubicBezier:function(a,b,c,d,e){return-3*b*(1-a)*(1-a)+3*c*(1-a)*(1-a)-6*a*c*(1-a)+6*a*d*(1-a)-3*a*a*d+3*a*a*e},tangentSpline:function(a,b,c,d,e){return 6*a*a-6*a+(3*a*a-4*a+1)+(-6*a*a+6*a)+(3*a*a-2*a)},interpolate:function(a,b,c,d,e){a=.5*(c-a);d=.5*(d-b);var f=e*e;return(2*b-2*c+a+d)*e*f+(-3*b+3*c-2*a-d)*f+a*e+b}}; THREE.Curve.create=function(a,b){a.prototype=Object.create(THREE.Curve.prototype);a.prototype.constructor=a;a.prototype.getPoint=b;return a};THREE.CurvePath=function{this.curves=[];this.bends=[];this.autoClose=!1};THREE.CurvePath.prototype=Object.create(THREE.Curve.prototype);THREE.CurvePath.prototype.constructor=THREE.CurvePath;THREE.CurvePath.prototype.add=function(a){this.curves.push(a)};THREE.CurvePath.prototype.checkConnection=function{}; THREE.CurvePath.prototype.closePath=function{var a=this.curves[0].getPoint(0),b=this.curves[this.curves.length-1].getPoint(1);a.equals(b)||this.curves.push(new THREE.LineCurve(b,a))};THREE.CurvePath.prototype.getPoint=function(a){var b=a*this.getLength,c=this.getCurveLengths;for(a=0;a<c.length;){if(c[a]>=b)return b=c[a]-b,a=this.curves[a],b=1-b/a.getLength,a.getPointAt(b);a++}return null};THREE.CurvePath.prototype.getLength=function{var a=this.getCurveLengths;return a[a.length-1]}; THREE.CurvePath.prototype.getCurveLengths=function{if(this.cacheLengths&&this.cacheLengths.length==this.curves.length)return this.cacheLengths;var a=[],b=0,c,d=this.curves.length;for(c=0;c<d;c++)b+=this.curves[c].getLength,a.push(b);return this.cacheLengths=a}; THREE.CurvePath.prototype.getBoundingBox=function{var a=this.getPoints,b,c,d,e,f,g;b=c=Number.NEGATIVE_INFINITY;e=f=Number.POSITIVE_INFINITY;var h,k,l,p,q=a[0]instanceof THREE.Vector3;p=q?new THREE.Vector3:new THREE.Vector2;k=0;for(l=a.length;k<l;k++)h=a[k],h.x>b?b=h.x:h.x<e&&(e=h.x),h.y>c?c=h.y:h.y<f&&(f=h.y),q&&(h.z>d?d=h.z:h.z<g&&(g=h.z)),p.add(h);a={minX:e,minY:f,maxX:b,maxY:c};q&&(a.maxZ=d,a.minZ=g);return a}; THREE.CurvePath.prototype.createPointsGeometry=function(a){a=this.getPoints(a,!0);return this.createGeometry(a)};THREE.CurvePath.prototype.createSpacedPointsGeometry=function(a){a=this.getSpacedPoints(a,!0);return this.createGeometry(a)};THREE.CurvePath.prototype.createGeometry=function(a){for(var b=new THREE.Geometry,c=0;c<a.length;c++)b.vertices.push(new THREE.Vector3(a[c].x,a[c].y,a[c].z||0));return b};THREE.CurvePath.prototype.addWrapPath=function(a){this.bends.push(a)}; THREE.CurvePath.prototype.getTransformedPoints=function(a,b){var c=this.getPoints(a),d,e;b||(b=this.bends);d=0;for(e=b.length;d<e;d++)c=this.getWrapPoints(c,b[d]);return c};THREE.CurvePath.prototype.getTransformedSpacedPoints=function(a,b){var c=this.getSpacedPoints(a),d,e;b||(b=this.bends);d=0;for(e=b.length;d<e;d++)c=this.getWrapPoints(c,b[d]);return c}; THREE.CurvePath.prototype.getWrapPoints=function(a,b){var c=this.getBoundingBox,d,e,f,g,h,k;d=0;for(e=a.length;d<e;d++)f=a[d],g=f.x,h=f.y,k=g/c.maxX,k=b.getUtoTmapping(k,g),g=b.getPoint(k),k=b.getTangent(k),k.set(-k.y,k.x).multiplyScalar(h),f.x=g.x+k.x,f.y=g.y+k.y;return a};THREE.Gyroscope=function{THREE.Object3D.call(this)};THREE.Gyroscope.prototype=Object.create(THREE.Object3D.prototype);THREE.Gyroscope.prototype.constructor=THREE.Gyroscope; THREE.Gyroscope.prototype.updateMatrixWorld=function{var a=new THREE.Vector3,b=new THREE.Quaternion,c=new THREE.Vector3,d=new THREE.Vector3,e=new THREE.Quaternion,f=new THREE.Vector3;return function(g){this.matrixAutoUpdate&&this.updateMatrix;if(this.matrixWorldNeedsUpdate||g)this.parent?(this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorld.decompose(d,e,f),this.matrix.decompose(a,b,c),this.matrixWorld.compose(d,b,f)):this.matrixWorld.copy(this.matrix),this.matrixWorldNeedsUpdate= !1,g=!0;for(var h=0,k=this.children.length;h<k;h++)this.children[h].updateMatrixWorld(g)}};THREE.Path=function(a){THREE.CurvePath.call(this);this.actions=[];a&&this.fromPoints(a)};THREE.Path.prototype=Object.create(THREE.CurvePath.prototype);THREE.Path.prototype.constructor=THREE.Path;THREE.PathActions={MOVE_TO:"moveTo",LINE_TO:"lineTo",QUADRATIC_CURVE_TO:"quadraticCurveTo",BEZIER_CURVE_TO:"bezierCurveTo",CSPLINE_THRU:"splineThru",ARC:"arc",ELLIPSE:"ellipse"}; THREE.Path.prototype.fromPoints=function(a){this.moveTo(a[0].x,a[0].y);for(var b=1,c=a.length;b<c;b++)this.lineTo(a[b].x,a[b].y)};THREE.Path.prototype.moveTo=function(a,b){var c=Array.prototype.slice.call(arguments);this.actions.push({action:THREE.PathActions.MOVE_TO,args:c})}; THREE.Path.prototype.lineTo=function(a,b){var c=Array.prototype.slice.call(arguments),d=this.actions[this.actions.length-1].args,d=new THREE.LineCurve(new THREE.Vector2(d[d.length-2],d[d.length-1]),new THREE.Vector2(a,b));this.curves.push(d);this.actions.push({action:THREE.PathActions.LINE_TO,args:c})}; THREE.Path.prototype.quadraticCurveTo=function(a,b,c,d){var e=Array.prototype.slice.call(arguments),f=this.actions[this.actions.length-1].args,f=new THREE.QuadraticBezierCurve(new THREE.Vector2(f[f.length-2],f[f.length-1]),new THREE.Vector2(a,b),new THREE.Vector2(c,d));this.curves.push(f);this.actions.push({action:THREE.PathActions.QUADRATIC_CURVE_TO,args:e})}; THREE.Path.prototype.bezierCurveTo=function(a,b,c,d,e,f){var g=Array.prototype.slice.call(arguments),h=this.actions[this.actions.length-1].args,h=new THREE.CubicBezierCurve(new THREE.Vector2(h[h.length-2],h[h.length-1]),new THREE.Vector2(a,b),new THREE.Vector2(c,d),new THREE.Vector2(e,f));this.curves.push(h);this.actions.push({action:THREE.PathActions.BEZIER_CURVE_TO,args:g})}; THREE.Path.prototype.splineThru=function(a){var b=Array.prototype.slice.call(arguments),c=this.actions[this.actions.length-1].args,c=[new THREE.Vector2(c[c.length-2],c[c.length-1])];Array.prototype.push.apply(c,a);c=new THREE.SplineCurve(c);this.curves.push(c);this.actions.push({action:THREE.PathActions.CSPLINE_THRU,args:b})};THREE.Path.prototype.arc=function(a,b,c,d,e,f){var g=this.actions[this.actions.length-1].args;this.absarc(a+g[g.length-2],b+g[g.length-1],c,d,e,f)}; THREE.Path.prototype.absarc=function(a,b,c,d,e,f){this.absellipse(a,b,c,c,d,e,f)};THREE.Path.prototype.ellipse=function(a,b,c,d,e,f,g){var h=this.actions[this.actions.length-1].args;this.absellipse(a+h[h.length-2],b+h[h.length-1],c,d,e,f,g)};THREE.Path.prototype.absellipse=function(a,b,c,d,e,f,g){var h=Array.prototype.slice.call(arguments),k=new THREE.EllipseCurve(a,b,c,d,e,f,g);this.curves.push(k);k=k.getPoint(1);h.push(k.x);h.push(k.y);this.actions.push({action:THREE.PathActions.ELLIPSE,args:h})}; THREE.Path.prototype.getSpacedPoints=function(a,b){a||(a=40);for(var c=[],d=0;d<a;d++)c.push(this.getPoint(d/a));return c}; THREE.Path.prototype.getPoints=function(a,b){if(this.useSpacedPoints)return console.log("tata"),this.getSpacedPoints(a,b);a=a||12;var c=[],d,e,f,g,h,k,l,p,q,n,t,r,s;d=0;for(e=this.actions.length;d<e;d++)switch(f=this.actions[d],g=f.action,f=f.args,g){case THREE.PathActions.MOVE_TO:c.push(new THREE.Vector2(f[0],f[1]));break;case THREE.PathActions.LINE_TO:c.push(new THREE.Vector2(f[0],f[1]));break;case THREE.PathActions.QUADRATIC_CURVE_TO:h=f[2];k=f[3];q=f[0];n=f[1];0<c.length?(g=c[c.length-1],t=g.x, r=g.y):(g=this.actions[d-1].args,t=g[g.length-2],r=g[g.length-1]);for(f=1;f<=a;f++)s=f/a,g=THREE.Shape.Utils.b2(s,t,q,h),s=THREE.Shape.Utils.b2(s,r,n,k),c.push(new THREE.Vector2(g,s));break;case THREE.PathActions.BEZIER_CURVE_TO:h=f[4];k=f[5];q=f[0];n=f[1];l=f[2];p=f[3];0<c.length?(g=c[c.length-1],t=g.x,r=g.y):(g=this.actions[d-1].args,t=g[g.length-2],r=g[g.length-1]);for(f=1;f<=a;f++)s=f/a,g=THREE.Shape.Utils.b3(s,t,q,l,h),s=THREE.Shape.Utils.b3(s,r,n,p,k),c.push(new THREE.Vector2(g,s));break;case THREE.PathActions.CSPLINE_THRU:g= this.actions[d-1].args;s=[new THREE.Vector2(g[g.length-2],g[g.length-1])];g=a*f[0].length;s=s.concat(f[0]);s=new THREE.SplineCurve(s);for(f=1;f<=g;f++)c.push(s.getPointAt(f/g));break;case THREE.PathActions.ARC:h=f[0];k=f[1];n=f[2];l=f[3];g=f[4];q=!!f[5];t=g-l;r=2*a;for(f=1;f<=r;f++)s=f/r,q||(s=1-s),s=l+s*t,g=h+n*Math.cos(s),s=k+n*Math.sin(s),c.push(new THREE.Vector2(g,s));break;case THREE.PathActions.ELLIPSE:for(h=f[0],k=f[1],n=f[2],p=f[3],l=f[4],g=f[5],q=!!f[6],t=g-l,r=2*a,f=1;f<=r;f++)s=f/r,q|| (s=1-s),s=l+s*t,g=h+n*Math.cos(s),s=k+p*Math.sin(s),c.push(new THREE.Vector2(g,s))}d=c[c.length-1];1E-10>Math.abs(d.x-c[0].x)&&1E-10>Math.abs(d.y-c[0].y)&&c.splice(c.length-1,1);b&&c.push(c[0]);return c}; THREE.Path.prototype.toShapes=function(a,b){function c(a){for(var b=[],c=0,d=a.length;c<d;c++){var e=a[c],f=new THREE.Shape;f.actions=e.actions;f.curves=e.curves;b.push(f)}return b}function d(a,b){for(var c=b.length,d=!1,e=c-1,f=0;f<c;e=f++){var g=b[e],h=b[f],k=h.x-g.x,n=h.y-g.y;if(1E-10<Math.abs(n)){if(0>n&&(g=b[f],k=-k,h=b[e],n=-n),!(a.y<g.y||a.y>h.y))if(a.y==g.y){if(a.x==g.x)return!0}else{e=n*(a.x-g.x)-k*(a.y-g.y);if(0==e)return!0;0>e||(d=!d)}}else if(a.y==g.y&&(h.x<=a.x&&a.x<=g.x||g.x<=a.x&&a.x<= h.x))return!0}return d}var e=function(a){var b,c,d,e,f=[],g=new THREE.Path;b=0;for(c=a.length;b<c;b++)d=a[b],e=d.args,d=d.action,d==THREE.PathActions.MOVE_TO&&0!=g.actions.length&&(f.push(g),g=new THREE.Path),g[d].apply(g,e);0!=g.actions.length&&f.push(g);return f}(this.actions);if(0==e.length)return[];if(!0===b)return c(e);var f,g,h,k=[];if(1==e.length)return g=e[0],h=new THREE.Shape,h.actions=g.actions,h.curves=g.curves,k.push(h),k;var l=!THREE.Shape.Utils.isClockWise(e[0].getPoints),l=a?!l:l; h=[];var p=[],q=[],n=0,t;p[n]=void 0;q[n]=[];var r,s;r=0;for(s=e.length;r<s;r++)g=e[r],t=g.getPoints,f=THREE.Shape.Utils.isClockWise(t),(f=a?!f:f)?(!l&&p[n]&&n++,p[n]={s:new THREE.Shape,p:t},p[n].s.actions=g.actions,p[n].s.curves=g.curves,l&&n++,q[n]=[]):q[n].push({h:g,p:t[0]});if(!p[0])return c(e);if(1<p.length){r=!1;s=[];g=0;for(e=p.length;g<e;g++)h[g]=[];g=0;for(e=p.length;g<e;g++)for(f=q[g],l=0;l<f.length;l++){n=f[l];t=!0;for(var u=0;u<p.length;u++)d(n.p,p[u].p)&&(g!=u&&s.push({froms:g,tos:u, hole:l}),t?(t=!1,h[u].push(n)):r=!0);t&&h[g].push(n)}0<s.length&&(r||(q=h))}r=0;for(s=p.length;r<s;r++)for(h=p[r].s,k.push(h),g=q[r],e=0,f=g.length;e<f;e++)h.holes.push(g[e].h);return k};THREE.Shape=function{THREE.Path.apply(this,arguments);this.holes=[]};THREE.Shape.prototype=Object.create(THREE.Path.prototype);THREE.Shape.prototype.constructor=THREE.Shape;THREE.Shape.prototype.extrude=function(a){return new THREE.ExtrudeGeometry(this,a)}; THREE.Shape.prototype.makeGeometry=function(a){return new THREE.ShapeGeometry(this,a)};THREE.Shape.prototype.getPointsHoles=function(a){var b,c=this.holes.length,d=[];for(b=0;b<c;b++)d[b]=this.holes[b].getTransformedPoints(a,this.bends);return d};THREE.Shape.prototype.getSpacedPointsHoles=function(a){var b,c=this.holes.length,d=[];for(b=0;b<c;b++)d[b]=this.holes[b].getTransformedSpacedPoints(a,this.bends);return d}; THREE.Shape.prototype.extractAllPoints=function(a){return{shape:this.getTransformedPoints(a),holes:this.getPointsHoles(a)}};THREE.Shape.prototype.extractPoints=function(a){return this.useSpacedPoints?this.extractAllSpacedPoints(a):this.extractAllPoints(a)};THREE.Shape.prototype.extractAllSpacedPoints=function(a){return{shape:this.getTransformedSpacedPoints(a),holes:this.getSpacedPointsHoles(a)}}; THREE.Shape.Utils={triangulateShape:function(a,b){function c(a,b,c){return a.x!=b.x?a.x<b.x?a.x<=c.x&&c.x<=b.x:b.x<=c.x&&c.x<=a.x:a.y<b.y?a.y<=c.y&&c.y<=b.y:b.y<=c.y&&c.y<=a.y}function d(a,b,d,e,f){var g=b.x-a.x,h=b.y-a.y,k=e.x-d.x,l=e.y-d.y,p=a.x-d.x,q=a.y-d.y,E=h*k-g*l,G=h*p-g*q;if(1E-10<Math.abs(E)){if(0<E){if(0>G||G>E)return[];k=l*p-k*q;if(0>k||k>E)return[]}else{if(0<G||G<E)return[];k=l*p-k*q;if(0<k||k<E)return[]}if(0==k)return!f||0!=G&&G!=E?[a]:[];if(k==E)return!f||0!=G&&G!=E?[b]:[];if(0==G)return[d]; if(G==E)return[e];f=k/E;return[{x:a.x+f*g,y:a.y+f*h}]}if(0!=G||l*p!=k*q)return[];h=0==g&&0==h;k=0==k&&0==l;if(h&&k)return a.x!=d.x||a.y!=d.y?[]:[a];if(h)return c(d,e,a)?[a]:[];if(k)return c(a,b,d)?[d]:[];0!=g?(a.x<b.x?(g=a,k=a.x,h=b,a=b.x):(g=b,k=b.x,h=a,a=a.x),d.x<e.x?(b=d,E=d.x,l=e,d=e.x):(b=e,E=e.x,l=d,d=d.x)):(a.y<b.y?(g=a,k=a.y,h=b,a=b.y):(g=b,k=b.y,h=a,a=a.y),d.y<e.y?(b=d,E=d.y,l=e,d=e.y):(b=e,E=e.y,l=d,d=d.y));return k<=E?a<E?[]:a==E?f?[]:[b]:a<=d?[b,h]:[b,l]:k>d?[]:k==d?f?[]:[g]:a<=d?[g,h]: [g,l]}function e(a,b,c,d){var e=b.x-a.x,f=b.y-a.y;b=c.x-a.x;c=c.y-a.y;var g=d.x-a.x;d=d.y-a.y;a=e*c-f*b;e=e*d-f*g;return 1E-10<Math.abs(a)?(b=g*c-d*b,0<a?0<=e&&0<=b:0<=e||0<=b):0<e}var f,g,h,k,l,p={};h=a.concat;f=0;for(g=b.length;f<g;f++)Array.prototype.push.apply(h,b[f]);f=0;for(g=h.length;f<g;f++)l=h[f].x+":"+h[f].y,void 0!==p[l]&&THREE.warn("THREE.Shape: Duplicate point",l),p[l]=f;f=function(a,b){function c(a,b){var d=h.length-1,f=a-1;0>f&&(f=d);var g=a+1;g>d&&(g=0);d=e(h[a],h[f],h[g],k[b]); if(!d)return!1;d=k.length-1;f=b-1;0>f&&(f=d);g=b+1;g>d&&(g=0);return(d=e(k[b],k[f],k[g],h[a]))?!0:!1}function f(a,b){var c,e;for(c=0;c<h.length;c++)if(e=c+1,e%=h.length,e=d(a,b,h[c],h[e],!0),0<e.length)return!0;return!1}function g(a,c){var e,f,h,k;for(e=0;e<l.length;e++)for(f=b[l[e]],h=0;h<f.length;h++)if(k=h+1,k%=f.length,k=d(a,c,f[h],f[k],!0),0<k.length)return!0;return!1}var h=a.concat,k,l=[],p,q,A,E,G,F=[],z,I,U,M=0;for(p=b.length;M<p;M++)l.push(M);z=0;for(var H=2*l.length;0<l.length;){H--;if(0> H){console.log("Infinite Loop! Holes left:"+l.length+", Probably Hole outside Shape!");break}for(q=z;q<h.length;q++){A=h[q];p=-1;for(M=0;M<l.length;M++)if(E=l[M],G=A.x+":"+A.y+":"+E,void 0===F[G]){k=b[E];for(I=0;I<k.length;I++)if(E=k[I],c(q,I)&&!f(A,E)&&!g(A,E)){p=I;l.splice(M,1);z=h.slice(0,q+1);E=h.slice(q);I=k.slice(p);U=k.slice(0,p+1);h=z.concat(I).concat(U).concat(E);z=q;break}if(0<=p)break;F[G]=!0}if(0<=p)break}}return h}(a,b);var q=THREE.FontUtils.Triangulate(f,!1);f=0;for(g=q.length;f<g;f++)for(k= q[f],h=0;3>h;h++)l=k[h].x+":"+k[h].y,l=p[l],void 0!==l&&(k[h]=l);return q.concat},isClockWise:function(a){return 0>THREE.FontUtils.Triangulate.area(a)},b2p0:function(a,b){var c=1-a;return c*c*b},b2p1:function(a,b){return 2*(1-a)*a*b},b2p2:function(a,b){return a*a*b},b2:function(a,b,c,d){return this.b2p0(a,b)+this.b2p1(a,c)+this.b2p2(a,d)},b3p0:function(a,b){var c=1-a;return c*c*c*b},b3p1:function(a,b){var c=1-a;return 3*c*c*a*b},b3p2:function(a,b){return 3*(1-a)*a*a*b},b3p3:function(a,b){return a* a*a*b},b3:function(a,b,c,d,e){return this.b3p0(a,b)+this.b3p1(a,c)+this.b3p2(a,d)+this.b3p3(a,e)}};THREE.LineCurve=function(a,b){this.v1=a;this.v2=b};THREE.LineCurve.prototype=Object.create(THREE.Curve.prototype);THREE.LineCurve.prototype.constructor=THREE.LineCurve;THREE.LineCurve.prototype.getPoint=function(a){var b=this.v2.clone.sub(this.v1);b.multiplyScalar(a).add(this.v1);return b};THREE.LineCurve.prototype.getPointAt=function(a){return this.getPoint(a)}; THREE.LineCurve.prototype.getTangent=function(a){return this.v2.clone.sub(this.v1).normalize};THREE.QuadraticBezierCurve=function(a,b,c){this.v0=a;this.v1=b;this.v2=c};THREE.QuadraticBezierCurve.prototype=Object.create(THREE.Curve.prototype);THREE.QuadraticBezierCurve.prototype.constructor=THREE.QuadraticBezierCurve; THREE.QuadraticBezierCurve.prototype.getPoint=function(a){var b=new THREE.Vector2;b.x=THREE.Shape.Utils.b2(a,this.v0.x,this.v1.x,this.v2.x);b.y=THREE.Shape.Utils.b2(a,this.v0.y,this.v1.y,this.v2.y);return b};THREE.QuadraticBezierCurve.prototype.getTangent=function(a){var b=new THREE.Vector2;b.x=THREE.Curve.Utils.tangentQuadraticBezier(a,this.v0.x,this.v1.x,this.v2.x);b.y=THREE.Curve.Utils.tangentQuadraticBezier(a,this.v0.y,this.v1.y,this.v2.y);return b.normalize}; THREE.CubicBezierCurve=function(a,b,c,d){this.v0=a;this.v1=b;this.v2=c;this.v3=d};THREE.CubicBezierCurve.prototype=Object.create(THREE.Curve.prototype);THREE.CubicBezierCurve.prototype.constructor=THREE.CubicBezierCurve;THREE.CubicBezierCurve.prototype.getPoint=function(a){var b;b=THREE.Shape.Utils.b3(a,this.v0.x,this.v1.x,this.v2.x,this.v3.x);a=THREE.Shape.Utils.b3(a,this.v0.y,this.v1.y,this.v2.y,this.v3.y);return new THREE.Vector2(b,a)}; THREE.CubicBezierCurve.prototype.getTangent=function(a){var b;b=THREE.Curve.Utils.tangentCubicBezier(a,this.v0.x,this.v1.x,this.v2.x,this.v3.x);a=THREE.Curve.Utils.tangentCubicBezier(a,this.v0.y,this.v1.y,this.v2.y,this.v3.y);b=new THREE.Vector2(b,a);b.normalize;return b};THREE.SplineCurve=function(a){this.points=void 0==a?[]:a};THREE.SplineCurve.prototype=Object.create(THREE.Curve.prototype);THREE.SplineCurve.prototype.constructor=THREE.SplineCurve; THREE.SplineCurve.prototype.getPoint=function(a){var b=this.points;a*=b.length-1;var c=Math.floor(a);a-=c;var d=b[0==c?c:c-1],e=b[c],f=b[c>b.length-2?b.length-1:c+1],b=b[c>b.length-3?b.length-1:c+2],c=new THREE.Vector2;c.x=THREE.Curve.Utils.interpolate(d.x,e.x,f.x,b.x,a);c.y=THREE.Curve.Utils.interpolate(d.y,e.y,f.y,b.y,a);return c};THREE.EllipseCurve=function(a,b,c,d,e,f,g){this.aX=a;this.aY=b;this.xRadius=c;this.yRadius=d;this.aStartAngle=e;this.aEndAngle=f;this.aClockwise=g}; THREE.EllipseCurve.prototype=Object.create(THREE.Curve.prototype);THREE.EllipseCurve.prototype.constructor=THREE.EllipseCurve;THREE.EllipseCurve.prototype.getPoint=function(a){var b=this.aEndAngle-this.aStartAngle;0>b&&(b+=2*Math.PI);b>2*Math.PI&&(b-=2*Math.PI);a=!0===this.aClockwise?this.aEndAngle+(1-a)*(2*Math.PI-b):this.aStartAngle+a*b;b=new THREE.Vector2;b.x=this.aX+this.xRadius*Math.cos(a);b.y=this.aY+this.yRadius*Math.sin(a);return b}; THREE.ArcCurve=function(a,b,c,d,e,f){THREE.EllipseCurve.call(this,a,b,c,c,d,e,f)};THREE.ArcCurve.prototype=Object.create(THREE.EllipseCurve.prototype);THREE.ArcCurve.prototype.constructor=THREE.ArcCurve;THREE.LineCurve3=THREE.Curve.create(function(a,b){this.v1=a;this.v2=b},function(a){var b=new THREE.Vector3;b.subVectors(this.v2,this.v1);b.multiplyScalar(a);b.add(this.v1);return b}); THREE.QuadraticBezierCurve3=THREE.Curve.create(function(a,b,c){this.v0=a;this.v1=b;this.v2=c},function(a){var b=new THREE.Vector3;b.x=THREE.Shape.Utils.b2(a,this.v0.x,this.v1.x,this.v2.x);b.y=THREE.Shape.Utils.b2(a,this.v0.y,this.v1.y,this.v2.y);b.z=THREE.Shape.Utils.b2(a,this.v0.z,this.v1.z,this.v2.z);return b}); THREE.CubicBezierCurve3=THREE.Curve.create(function(a,b,c,d){this.v0=a;this.v1=b;this.v2=c;this.v3=d},function(a){var b=new THREE.Vector3;b.x=THREE.Shape.Utils.b3(a,this.v0.x,this.v1.x,this.v2.x,this.v3.x);b.y=THREE.Shape.Utils.b3(a,this.v0.y,this.v1.y,this.v2.y,this.v3.y);b.z=THREE.Shape.Utils.b3(a,this.v0.z,this.v1.z,this.v2.z,this.v3.z);return b}); THREE.SplineCurve3=THREE.Curve.create(function(a){this.points=void 0==a?[]:a},function(a){var b=this.points;a*=b.length-1;var c=Math.floor(a);a-=c;var d=b[0==c?c:c-1],e=b[c],f=b[c>b.length-2?b.length-1:c+1],b=b[c>b.length-3?b.length-1:c+2],c=new THREE.Vector3;c.x=THREE.Curve.Utils.interpolate(d.x,e.x,f.x,b.x,a);c.y=THREE.Curve.Utils.interpolate(d.y,e.y,f.y,b.y,a);c.z=THREE.Curve.Utils.interpolate(d.z,e.z,f.z,b.z,a);return c}); THREE.ClosedSplineCurve3=THREE.Curve.create(function(a){this.points=void 0==a?[]:a},function(a){var b=this.points;a*=b.length-0;var c=Math.floor(a);a-=c;var c=c+(0<c?0:(Math.floor(Math.abs(c)/b.length)+1)*b.length),d=b[(c-1)%b.length],e=b[c%b.length],f=b[(c+1)%b.length],b=b[(c+2)%b.length],c=new THREE.Vector3;c.x=THREE.Curve.Utils.interpolate(d.x,e.x,f.x,b.x,a);c.y=THREE.Curve.Utils.interpolate(d.y,e.y,f.y,b.y,a);c.z=THREE.Curve.Utils.interpolate(d.z,e.z,f.z,b.z,a);return c}); THREE.AnimationHandler={LINEAR:0,CATMULLROM:1,CATMULLROM_FORWARD:2,add:function{THREE.warn("THREE.AnimationHandler.add has been deprecated.")},get:function{THREE.warn("THREE.AnimationHandler.get has been deprecated.")},remove:function{THREE.warn("THREE.AnimationHandler.remove has been deprecated.")},animations:[],init:function(a){if(!0===a.initialized)return a;for(var b=0;b<a.hierarchy.length;b++){for(var c=0;c<a.hierarchy[b].keys.length;c++)if(0>a.hierarchy[b].keys[c].time&&(a.hierarchy[b].keys[c].time= 0),void 0!==a.hierarchy[b].keys[c].rot&&!(a.hierarchy[b].keys[c].rot instanceof THREE.Quaternion)){var d=a.hierarchy[b].keys[c].rot;a.hierarchy[b].keys[c].rot=(new THREE.Quaternion).fromArray(d)}if(a.hierarchy[b].keys.length&&void 0!==a.hierarchy[b].keys[0].morphTargets){d={};for(c=0;c<a.hierarchy[b].keys.length;c++)for(var e=0;e<a.hierarchy[b].keys[c].morphTargets.length;e++){var f=a.hierarchy[b].keys[c].morphTargets[e];d[f]=-1}a.hierarchy[b].usedMorphTargets=d;for(c=0;c<a.hierarchy[b].keys.length;c++){var g= {};for(f in d){for(e=0;e<a.hierarchy[b].keys[c].morphTargets.length;e++)if(a.hierarchy[b].keys[c].morphTargets[e]===f){g[f]=a.hierarchy[b].keys[c].morphTargetsInfluences[e];break}e===a.hierarchy[b].keys[c].morphTargets.length&&(g[f]=0)}a.hierarchy[b].keys[c].morphTargetsInfluences=g}}for(c=1;c<a.hierarchy[b].keys.length;c++)a.hierarchy[b].keys[c].time===a.hierarchy[b].keys[c-1].time&&(a.hierarchy[b].keys.splice(c,1),c--);for(c=0;c<a.hierarchy[b].keys.length;c++)a.hierarchy[b].keys[c].index=c}a.initialized= !0;return a},parse:function(a){var b=function(a,c){c.push(a);for(var d=0;d<a.children.length;d++)b(a.children[d],c)},c=[];if(a instanceof THREE.SkinnedMesh)for(var d=0;d<a.skeleton.bones.length;d++)c.push(a.skeleton.bones[d]);else b(a,c);return c},play:function(a){-1===this.animations.indexOf(a)&&this.animations.push(a)},stop:function(a){a=this.animations.indexOf(a);-1!==a&&this.animations.splice(a,1)},update:function(a){for(var b=0;b<this.animations.length;b++)this.animations[b].resetBlendWeights; for(b=0;b<this.animations.length;b++)this.animations[b].update(a)}};THREE.Animation=function(a,b){this.root=a;this.data=THREE.AnimationHandler.init(b);this.hierarchy=THREE.AnimationHandler.parse(a);this.currentTime=0;this.timeScale=1;this.isPlaying=!1;this.loop=!0;this.weight=0;this.interpolationType=THREE.AnimationHandler.LINEAR}; THREE.Animation.prototype={constructor:THREE.Animation,keyTypes:["pos","rot","scl"],play:function(a,b){this.currentTime=void 0!==a?a:0;this.weight=void 0!==b?b:1;this.isPlaying=!0;this.reset;THREE.AnimationHandler.play(this)},stop:function{this.isPlaying=!1;THREE.AnimationHandler.stop(this)},reset:function{for(var a=0,b=this.hierarchy.length;a<b;a++){var c=this.hierarchy[a];void 0===c.animationCache&&(c.animationCache={animations:{},blending:{positionWeight:0,quaternionWeight:0,scaleWeight:0}}); var d=this.data.name,e=c.animationCache.animations,f=e[d];void 0===f&&(f={prevKey:{pos:0,rot:0,scl:0},nextKey:{pos:0,rot:0,scl:0},originalMatrix:c.matrix},e[d]=f);for(c=0;3>c;c++){for(var d=this.keyTypes[c],e=this.data.hierarchy[a].keys[0],g=this.getNextKeyWith(d,a,1);g.time<this.currentTime&&g.index>e.index;)e=g,g=this.getNextKeyWith(d,a,g.index+1);f.prevKey[d]=e;f.nextKey[d]=g}}},resetBlendWeights:function{for(var a=0,b=this.hierarchy.length;a<b;a++){var c=this.hierarchy[a].animationCache;void 0!== c&&(c=c.blending,c.positionWeight=0,c.quaternionWeight=0,c.scaleWeight=0)}},update:function{var a=[],b=new THREE.Vector3,c=new THREE.Vector3,d=new THREE.Quaternion,e=function(a,b){var c=[],d=[],e,q,n,t,r,s;e=(a.length-1)*b;q=Math.floor(e);e-=q;c[0]=0===q?q:q-1;c[1]=q;c[2]=q>a.length-2?q:q+1;c[3]=q>a.length-3?q:q+2;q=a[c[0]];t=a[c[1]];r=a[c[2]];s=a[c[3]];c=e*e;n=e*c;d[0]=f(q[0],t[0],r[0],s[0],e,c,n);d[1]=f(q[1],t[1],r[1],s[1],e,c,n);d[2]=f(q[2],t[2],r[2],s[2],e,c,n);return d},f=function(a,b,c,d, e,f,n){a=.5*(c-a);d=.5*(d-b);return(2*(b-c)+a+d)*n+(-3*(b-c)-2*a-d)*f+a*e+b};return function(f){if(!1!==this.isPlaying&&(this.currentTime+=f*this.timeScale,0!==this.weight)){f=this.data.length;if(this.currentTime>f||0>this.currentTime)this.loop?(this.currentTime%=f,0>this.currentTime&&(this.currentTime+=f),this.reset):this.stop;f=0;for(var h=this.hierarchy.length;f<h;f++)for(var k=this.hierarchy[f],l=k.animationCache.animations[this.data.name],p=k.animationCache.blending,q=0;3>q;q++){var n=this.keyTypes[q], t=l.prevKey[n],r=l.nextKey[n];if(0<this.timeScale&&r.time<=this.currentTime||0>this.timeScale&&t.time>=this.currentTime){t=this.data.hierarchy[f].keys[0];for(r=this.getNextKeyWith(n,f,1);r.time<this.currentTime&&r.index>t.index;)t=r,r=this.getNextKeyWith(n,f,r.index+1);l.prevKey[n]=t;l.nextKey[n]=r}var s=(this.currentTime-t.time)/(r.time-t.time),u=t[n],v=r[n];0>s&&(s=0);1<s&&(s=1);if("pos"===n)if(this.interpolationType===THREE.AnimationHandler.LINEAR)c.x=u[0]+(v[0]-u[0])*s,c.y=u[1]+(v[1]-u[1])*s, c.z=u[2]+(v[2]-u[2])*s,t=this.weight/(this.weight+p.positionWeight),k.position.lerp(c,t),p.positionWeight+=this.weight;else{if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)a[0]=this.getPrevKeyWith("pos",f,t.index-1).pos,a[1]=u,a[2]=v,a[3]=this.getNextKeyWith("pos",f,r.index+1).pos,s=.33*s+.33,r=e(a,s),t=this.weight/(this.weight+p.positionWeight),p.positionWeight+=this.weight,n=k.position,n.x+=(r[0]-n.x)*t,n.y+=(r[1]- n.y)*t,n.z+=(r[2]-n.z)*t,this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD&&(s=e(a,1.01*s),b.set(s[0],s[1],s[2]),b.sub(n),b.y=0,b.normalize,s=Math.atan2(b.x,b.z),k.rotation.set(0,s,0))}else"rot"===n?(THREE.Quaternion.slerp(u,v,d,s),0===p.quaternionWeight?(k.quaternion.copy(d),p.quaternionWeight=this.weight):(t=this.weight/(this.weight+p.quaternionWeight),THREE.Quaternion.slerp(k.quaternion,d,k.quaternion,t),p.quaternionWeight+=this.weight)):"scl"===n&&(c.x=u[0]+(v[0]-u[0])*s,c.y= u[1]+(v[1]-u[1])*s,c.z=u[2]+(v[2]-u[2])*s,t=this.weight/(this.weight+p.scaleWeight),k.scale.lerp(c,t),p.scaleWeight+=this.weight)}return!0}}},getNextKeyWith:function(a,b,c){var d=this.data.hierarchy[b].keys;for(c=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?c<d.length-1?c:d.length-1:c%d.length;c<d.length;c++)if(void 0!==d[c][a])return d[c];return this.data.hierarchy[b].keys[0]},getPrevKeyWith:function(a,b,c){var d= this.data.hierarchy[b].keys;for(c=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?0<c?c:0:0<=c?c:c+d.length;0<=c;c--)if(void 0!==d[c][a])return d[c];return this.data.hierarchy[b].keys[d.length-1]}}; THREE.KeyFrameAnimation=function(a){this.root=a.node;this.data=THREE.AnimationHandler.init(a);this.hierarchy=THREE.AnimationHandler.parse(this.root);this.currentTime=0;this.timeScale=.001;this.isPlaying=!1;this.loop=this.isPaused=!0;a=0;for(var b=this.hierarchy.length;a<b;a++){var c=this.data.hierarchy[a].sids,d=this.hierarchy[a];if(this.data.hierarchy[a].keys.length&&c){for(var e=0;e<c.length;e++){var f=c[e],g=this.getNextKeyWith(f,a,0);g&&g.apply(f)}d.matrixAutoUpdate=!1;this.data.hierarchy[a].node.updateMatrix; d.matrixWorldNeedsUpdate=!0}}}; THREE.KeyFrameAnimation.prototype={constructor:THREE.KeyFrameAnimation,play:function(a){this.currentTime=void 0!==a?a:0;if(!1===this.isPlaying){this.isPlaying=!0;var b=this.hierarchy.length,c,d;for(a=0;a<b;a++)c=this.hierarchy[a],d=this.data.hierarchy[a],void 0===d.animationCache&&(d.animationCache={},d.animationCache.prevKey=null,d.animationCache.nextKey=null,d.animationCache.originalMatrix=c.matrix),c=this.data.hierarchy[a].keys,c.length&&(d.animationCache.prevKey=c[0],d.animationCache.nextKey= c[1],this.startTime=Math.min(c[0].time,this.startTime),this.endTime=Math.max(c[c.length-1].time,this.endTime));this.update(0)}this.isPaused=!1;THREE.AnimationHandler.play(this)},stop:function{this.isPaused=this.isPlaying=!1;THREE.AnimationHandler.stop(this);for(var a=0;a<this.data.hierarchy.length;a++){var b=this.hierarchy[a],c=this.data.hierarchy[a];if(void 0!==c.animationCache){var d=c.animationCache.originalMatrix;d.copy(b.matrix);b.matrix=d;delete c.animationCache}}},update:function(a){if(!1!== this.isPlaying){this.currentTime+=a*this.timeScale;a=this.data.length;!0===this.loop&&this.currentTime>a&&(this.currentTime%=a);this.currentTime=Math.min(this.currentTime,a);a=0;for(var b=this.hierarchy.length;a<b;a++){var c=this.hierarchy[a],d=this.data.hierarchy[a],e=d.keys,d=d.animationCache;if(e.length){var f=d.prevKey,g=d.nextKey;if(g.time<=this.currentTime){for(g.time<this.currentTime&&g.index>f.index;)f=g,g=e[f.index+1];d.prevKey=f;d.nextKey=g}g.time>=this.currentTime?f.interpolate(g,this.currentTime): f.interpolate(g,g.time);this.data.hierarchy[a].node.updateMatrix;c.matrixWorldNeedsUpdate=!0}}}},getNextKeyWith:function(a,b,c){b=this.data.hierarchy[b].keys;for(c%=b.length;c<b.length;c++)if(b[c].hasTarget(a))return b[c];return b[0]},getPrevKeyWith:function(a,b,c){b=this.data.hierarchy[b].keys;for(c=0<=c?c:c+b.length;0<=c;c--)if(b[c].hasTarget(a))return b[c];return b[b.length-1]}}; THREE.MorphAnimation=function(a){this.mesh=a;this.frames=a.morphTargetInfluences.length;this.currentTime=0;this.duration=1E3;this.loop=!0;this.currentFrame=this.lastFrame=0;this.isPlaying=!1}; THREE.MorphAnimation.prototype={constructor:THREE.MorphAnimation,play:function{this.isPlaying=!0},pause:function{this.isPlaying=!1},update:function(a){if(!1!==this.isPlaying){this.currentTime+=a;!0===this.loop&&this.currentTime>this.duration&&(this.currentTime%=this.duration);this.currentTime=Math.min(this.currentTime,this.duration);a=this.duration/this.frames;var b=Math.floor(this.currentTime/a),c=this.mesh.morphTargetInfluences;b!=this.currentFrame&&(c[this.lastFrame]=0,c[this.currentFrame]= 1,c[b]=0,this.lastFrame=this.currentFrame,this.currentFrame=b);c[b]=this.currentTime%a/a;c[this.lastFrame]=1-c[b]}}}; THREE.BoxGeometry=function(a,b,c,d,e,f){function g(a,b,c,d,e,f,g,s){var u,v=h.widthSegments,x=h.heightSegments,D=e/2,w=f/2,y=h.vertices.length;if("x"===a&&"y"===b||"y"===a&&"x"===b)u="z";else if("x"===a&&"z"===b||"z"===a&&"x"===b)u="y",x=h.depthSegments;else if("z"===a&&"y"===b||"y"===a&&"z"===b)u="x",v=h.depthSegments;var A=v+1,E=x+1,G=e/v,F=f/x,z=new THREE.Vector3;z[u]=0<g?1:-1;for(e=0;e<E;e++)for(f=0;f<A;f++){var I=new THREE.Vector3;I[a]=(f*G-D)*c;I[b]=(e*F-w)*d;I[u]=g;h.vertices.push(I)}for(e= 0;e<x;e++)for(f=0;f<v;f++)w=f+A*e,a=f+A*(e+1),b=f+1+A*(e+1),c=f+1+A*e,d=new THREE.Vector2(f/v,1-e/x),g=new THREE.Vector2(f/v,1-(e+1)/x),u=new THREE.Vector2((f+1)/v,1-(e+1)/x),D=new THREE.Vector2((f+1)/v,1-e/x),w=new THREE.Face3(w+y,a+y,c+y),w.normal.copy(z),w.vertexNormals.push(z.clone,z.clone,z.clone),w.materialIndex=s,h.faces.push(w),h.faceVertexUvs[0].push([d,g,D]),w=new THREE.Face3(a+y,b+y,c+y),w.normal.copy(z),w.vertexNormals.push(z.clone,z.clone,z.clone),w.materialIndex=s,h.faces.push(w), h.faceVertexUvs[0].push([g.clone,u,D.clone])}THREE.Geometry.call(this);this.type="BoxGeometry";this.parameters={width:a,height:b,depth:c,widthSegments:d,heightSegments:e,depthSegments:f};this.widthSegments=d||1;this.heightSegments=e||1;this.depthSegments=f||1;var h=this;d=a/2;e=b/2;f=c/2;g("z","y",-1,-1,c,b,d,0);g("z","y",1,-1,c,b,-d,1);g("x","z",1,1,a,c,e,2);g("x","z",1,-1,a,c,-e,3);g("x","y",1,-1,a,b,f,4);g("x","y",-1,-1,a,b,-f,5);this.mergeVertices};THREE.BoxGeometry.prototype=Object.create(THREE.Geometry.prototype); THREE.BoxGeometry.prototype.constructor=THREE.BoxGeometry; THREE.CircleGeometry=function(a,b,c,d){THREE.Geometry.call(this);this.type="CircleGeometry";this.parameters={radius:a,segments:b,thetaStart:c,thetaLength:d};a=a||50;b=void 0!==b?Math.max(3,b):8;c=void 0!==c?c:0;d=void 0!==d?d:2*Math.PI;var e,f=[];e=new THREE.Vector3;var g=new THREE.Vector2(.5,.5);this.vertices.push(e);f.push(g);for(e=0;e<=b;e++){var h=new THREE.Vector3,k=c+e/b*d;h.x=a*Math.cos(k);h.y=a*Math.sin(k);this.vertices.push(h);f.push(new THREE.Vector2((h.x/a+1)/2,(h.y/a+1)/2))}c=new THREE.Vector3(0, 0,1);for(e=1;e<=b;e++)this.faces.push(new THREE.Face3(e,e+1,0,[c.clone,c.clone,c.clone])),this.faceVertexUvs[0].push([f[e].clone,f[e+1].clone,g.clone]);this.computeFaceNormals;this.boundingSphere=new THREE.Sphere(new THREE.Vector3,a)};THREE.CircleGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.CircleGeometry.prototype.constructor=THREE.CircleGeometry; THREE.CubeGeometry=function(a,b,c,d,e,f){THREE.warn("THREE.CubeGeometry has been renamed to THREE.BoxGeometry.");return new THREE.BoxGeometry(a,b,c,d,e,f)}; THREE.CylinderGeometry=function(a,b,c,d,e,f,g,h){THREE.Geometry.call(this);this.type="CylinderGeometry";this.parameters={radiusTop:a,radiusBottom:b,height:c,radialSegments:d,heightSegments:e,openEnded:f,thetaStart:g,thetaLength:h};a=void 0!==a?a:20;b=void 0!==b?b:20;c=void 0!==c?c:100;d=d||8;e=e||1;f=void 0!==f?f:!1;g=void 0!==g?g:0;h=void 0!==h?h:2*Math.PI;var k=c/2,l,p,q=[],n=[];for(p=0;p<=e;p++){var t=[],r=[],s=p/e,u=s*(b-a)+a;for(l=0;l<=d;l++){var v=l/d,x=new THREE.Vector3;x.x=u*Math.sin(v*h+ g);x.y=-s*c+k;x.z=u*Math.cos(v*h+g);this.vertices.push(x);t.push(this.vertices.length-1);r.push(new THREE.Vector2(v,1-s))}q.push(t);n.push(r)}c=(b-a)/c;for(l=0;l<d;l++)for(0!==a?(g=this.vertices[q[0][l]].clone,h=this.vertices[q[0][l+1]].clone):(g=this.vertices[q[1][l]].clone,h=this.vertices[q[1][l+1]].clone),g.setY(Math.sqrt(g.x*g.x+g.z*g.z)*c).normalize,h.setY(Math.sqrt(h.x*h.x+h.z*h.z)*c).normalize,p=0;p<e;p++){var t=q[p][l],r=q[p+1][l],s=q[p+1][l+1],u=q[p][l+1],v=g.clone,x=g.clone, D=h.clone,w=h.clone,y=n[p][l].clone,A=n[p+1][l].clone,E=n[p+1][l+1].clone,G=n[p][l+1].clone;this.faces.push(new THREE.Face3(t,r,u,[v,x,w]));this.faceVertexUvs[0].push([y,A,G]);this.faces.push(new THREE.Face3(r,s,u,[x.clone,D,w.clone]));this.faceVertexUvs[0].push([A.clone,E,G.clone])}if(!1===f&&0<a)for(this.vertices.push(new THREE.Vector3(0,k,0)),l=0;l<d;l++)t=q[0][l],r=q[0][l+1],s=this.vertices.length-1,v=new THREE.Vector3(0,1,0),x=new THREE.Vector3(0,1,0),D=new THREE.Vector3(0, 1,0),y=n[0][l].clone,A=n[0][l+1].clone,E=new THREE.Vector2(A.x,0),this.faces.push(new THREE.Face3(t,r,s,[v,x,D])),this.faceVertexUvs[0].push([y,A,E]);if(!1===f&&0<b)for(this.vertices.push(new THREE.Vector3(0,-k,0)),l=0;l<d;l++)t=q[e][l+1],r=q[e][l],s=this.vertices.length-1,v=new THREE.Vector3(0,-1,0),x=new THREE.Vector3(0,-1,0),D=new THREE.Vector3(0,-1,0),y=n[e][l+1].clone,A=n[e][l].clone,E=new THREE.Vector2(A.x,1),this.faces.push(new THREE.Face3(t,r,s,[v,x,D])),this.faceVertexUvs[0].push([y, A,E]);this.computeFaceNormals};THREE.CylinderGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.CylinderGeometry.prototype.constructor=THREE.CylinderGeometry;THREE.ExtrudeGeometry=function(a,b){"undefined"!==typeof a&&(THREE.Geometry.call(this),this.type="ExtrudeGeometry",a=a instanceof Array?a:[a],this.addShapeList(a,b),this.computeFaceNormals)};THREE.ExtrudeGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.ExtrudeGeometry.prototype.constructor=THREE.ExtrudeGeometry; THREE.ExtrudeGeometry.prototype.addShapeList=function(a,b){for(var c=a.length,d=0;d<c;d++)this.addShape(a[d],b)}; THREE.ExtrudeGeometry.prototype.addShape=function(a,b){function c(a,b,c){b||THREE.error("THREE.ExtrudeGeometry: vec does not exist");return b.clone.multiplyScalar(c).add(a)}function d(a,b,c){var d=1,d=a.x-b.x,e=a.y-b.y,f=c.x-a.x,g=c.y-a.y,h=d*d+e*e;if(1E-10<Math.abs(d*g-e*f)){var k=Math.sqrt(h),l=Math.sqrt(f*f+g*g),h=b.x-e/k;b=b.y+d/k;f=((c.x-g/l-h)*g-(c.y+f/l-b)*f)/(d*g-e*f);c=h+d*f-a.x;a=b+e*f-a.y;d=c*c+a*a;if(2>=d)return new THREE.Vector2(c,a);d=Math.sqrt(d/2)}else a=!1,1E-10<d?1E-10<f&&(a=!0): -1E-10>d?-1E-10>f&&(a=!0):Math.sign(e)==Math.sign(g)&&(a=!0),a?(c=-e,a=d,d=Math.sqrt(h)):(c=d,a=e,d=Math.sqrt(h/2));return new THREE.Vector2(c/d,a/d)}function e(a,b){var c,d;for(O=a.length;0<=--O;){c=O;d=O-1;0>d&&(d=a.length-1);for(var e=0,f=t+2*p,e=0;e<f;e++){var g=oa*e,h=oa*(e+1),k=b+c+g,g=b+d+g,l=b+d+h,h=b+c+h,k=k+U,g=g+U,l=l+U,h=h+U;I.faces.push(new THREE.Face3(k,g,h,null,null,x));I.faces.push(new THREE.Face3(g,l,h,null,null,x));k=D.generateSideWallUV(I,k,g,l,h);I.faceVertexUvs[0].push([k[0], k[1],k[3]]);I.faceVertexUvs[0].push([k[1],k[2],k[3]])}}}function f(a,b,c){I.vertices.push(new THREE.Vector3(a,b,c))}function g(a,b,c){a+=U;b+=U;c+=U;I.faces.push(new THREE.Face3(a,b,c,null,null,v));a=D.generateTopUV(I,a,b,c);I.faceVertexUvs[0].push(a)}var h=void 0!==b.amount?b.amount:100,k=void 0!==b.bevelThickness?b.bevelThickness:6,l=void 0!==b.bevelSize?b.bevelSize:k-2,p=void 0!==b.bevelSegments?b.bevelSegments:3,q=void 0!==b.bevelEnabled?b.bevelEnabled:!0,n=void 0!==b.curveSegments?b.curveSegments: 12,t=void 0!==b.steps?b.steps:1,r=b.extrudePath,s,u=!1,v=b.material,x=b.extrudeMaterial,D=void 0!==b.UVGenerator?b.UVGenerator:THREE.ExtrudeGeometry.WorldUVGenerator,w,y,A,E;r&&(s=r.getSpacedPoints(t),u=!0,q=!1,w=void 0!==b.frames?b.frames:new THREE.TubeGeometry.FrenetFrames(r,t,!1),y=new THREE.Vector3,A=new THREE.Vector3,E=new THREE.Vector3);q||(l=k=p=0);var G,F,z,I=this,U=this.vertices.length,r=a.extractPoints(n),n=r.shape,M=r.holes;if(r=!THREE.Shape.Utils.isClockWise(n)){n=n.reverse;F=0;for(z= M.length;F<z;F++)G=M[F],THREE.Shape.Utils.isClockWise(G)&&(M[F]=G.reverse);r=!1}var H=THREE.Shape.Utils.triangulateShape(n,M),L=n;F=0;for(z=M.length;F<z;F++)G=M[F],n=n.concat(G);var P,N,R,V,J,oa=n.length,ja,ha=H.length,r=[],O=0;R=L.length;P=R-1;for(N=O+1;O<R;O++,P++,N++)P===R&&(P=0),N===R&&(N=0),r[O]=d(L[O],L[P],L[N]);var ca=[],ba,qa=r.concat;F=0;for(z=M.length;F<z;F++){G=M[F];ba=[];O=0;R=G.length;P=R-1;for(N=O+1;O<R;O++,P++,N++)P===R&&(P=0),N===R&&(N=0),ba[O]=d(G[O],G[P],G[N]);ca.push(ba);qa= qa.concat(ba)}for(P=0;P<p;P++){R=P/p;V=k*(1-R);N=l*Math.sin(R*Math.PI/2);O=0;for(R=L.length;O<R;O++)J=c(L[O],r[O],N),f(J.x,J.y,-V);F=0;for(z=M.length;F<z;F++)for(G=M[F],ba=ca[F],O=0,R=G.length;O<R;O++)J=c(G[O],ba[O],N),f(J.x,J.y,-V)}N=l;for(O=0;O<oa;O++)J=q?c(n[O],qa[O],N):n[O],u?(A.copy(w.normals[0]).multiplyScalar(J.x),y.copy(w.binormals[0]).multiplyScalar(J.y),E.copy(s[0]).add(A).add(y),f(E.x,E.y,E.z)):f(J.x,J.y,0);for(R=1;R<=t;R++)for(O=0;O<oa;O++)J=q?c(n[O],qa[O],N):n[O],u?(A.copy(w.normals[R]).multiplyScalar(J.x), y.copy(w.binormals[R]).multiplyScalar(J.y),E.copy(s[R]).add(A).add(y),f(E.x,E.y,E.z)):f(J.x,J.y,h/t*R);for(P=p-1;0<=P;P--){R=P/p;V=k*(1-R);N=l*Math.sin(R*Math.PI/2);O=0;for(R=L.length;O<R;O++)J=c(L[O],r[O],N),f(J.x,J.y,h+V);F=0;for(z=M.length;F<z;F++)for(G=M[F],ba=ca[F],O=0,R=G.length;O<R;O++)J=c(G[O],ba[O],N),u?f(J.x,J.y+s[t-1].y,s[t-1].x+V):f(J.x,J.y,h+V)}(function{if(q){var a;a=0*oa;for(O=0;O<ha;O++)ja=H[O],g(ja[2]+a,ja[1]+a,ja[0]+a);a=t+2*p;a*=oa;for(O=0;O<ha;O++)ja=H[O],g(ja[0]+a,ja[1]+a,ja[2]+ a)}else{for(O=0;O<ha;O++)ja=H[O],g(ja[2],ja[1],ja[0]);for(O=0;O<ha;O++)ja=H[O],g(ja[0]+oa*t,ja[1]+oa*t,ja[2]+oa*t)}});(function{var a=0;e(L,a);a+=L.length;F=0;for(z=M.length;F<z;F++)G=M[F],e(G,a),a+=G.length})}; THREE.ExtrudeGeometry.WorldUVGenerator={generateTopUV:function(a,b,c,d){a=a.vertices;b=a[b];c=a[c];d=a[d];return[new THREE.Vector2(b.x,b.y),new THREE.Vector2(c.x,c.y),new THREE.Vector2(d.x,d.y)]},generateSideWallUV:function(a,b,c,d,e){a=a.vertices;b=a[b];c=a[c];d=a[d];e=a[e];return.01>Math.abs(b.y-c.y)?[new THREE.Vector2(b.x,1-b.z),new THREE.Vector2(c.x,1-c.z),new THREE.Vector2(d.x,1-d.z),new THREE.Vector2(e.x,1-e.z)]:[new THREE.Vector2(b.y,1-b.z),new THREE.Vector2(c.y,1-c.z),new THREE.Vector2(d.y, 1-d.z),new THREE.Vector2(e.y,1-e.z)]}};THREE.ShapeGeometry=function(a,b){THREE.Geometry.call(this);this.type="ShapeGeometry";!1===a instanceof Array&&(a=[a]);this.addShapeList(a,b);this.computeFaceNormals};THREE.ShapeGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.ShapeGeometry.prototype.constructor=THREE.ShapeGeometry;THREE.ShapeGeometry.prototype.addShapeList=function(a,b){for(var c=0,d=a.length;c<d;c++)this.addShape(a[c],b);return this}; THREE.ShapeGeometry.prototype.addShape=function(a,b){void 0===b&&(b={});var c=b.material,d=void 0===b.UVGenerator?THREE.ExtrudeGeometry.WorldUVGenerator:b.UVGenerator,e,f,g,h=this.vertices.length;e=a.extractPoints(void 0!==b.curveSegments?b.curveSegments:12);var k=e.shape,l=e.holes;if(!THREE.Shape.Utils.isClockWise(k))for(k=k.reverse,e=0,f=l.length;e<f;e++)g=l[e],THREE.Shape.Utils.isClockWise(g)&&(l[e]=g.reverse);var p=THREE.Shape.Utils.triangulateShape(k,l);e=0;for(f=l.length;e<f;e++)g=l[e], k=k.concat(g);l=k.length;f=p.length;for(e=0;e<l;e++)g=k[e],this.vertices.push(new THREE.Vector3(g.x,g.y,0));for(e=0;e<f;e++)l=p[e],k=l[0]+h,g=l[1]+h,l=l[2]+h,this.faces.push(new THREE.Face3(k,g,l,null,null,c)),this.faceVertexUvs[0].push(d.generateTopUV(this,k,g,l))}; THREE.LatheGeometry=function(a,b,c,d){THREE.Geometry.call(this);this.type="LatheGeometry";this.parameters={points:a,segments:b,phiStart:c,phiLength:d};b=b||12;c=c||0;d=d||2*Math.PI;for(var e=1/(a.length-1),f=1/b,g=0,h=b;g<=h;g++)for(var k=c+g*f*d,l=Math.cos(k),p=Math.sin(k),k=0,q=a.length;k<q;k++){var n=a[k],t=new THREE.Vector3;t.x=l*n.x-p*n.y;t.y=p*n.x+l*n.y;t.z=n.z;this.vertices.push(t)}c=a.length;g=0;for(h=b;g<h;g++)for(k=0,q=a.length-1;k<q;k++){b=p=k+c*g;d=p+c;var l=p+1+c,p=p+1,n=g*f,t=k*e,r= n+f,s=t+e;this.faces.push(new THREE.Face3(b,d,p));this.faceVertexUvs[0].push([new THREE.Vector2(n,t),new THREE.Vector2(r,t),new THREE.Vector2(n,s)]);this.faces.push(new THREE.Face3(d,l,p));this.faceVertexUvs[0].push([new THREE.Vector2(r,t),new THREE.Vector2(r,s),new THREE.Vector2(n,s)])}this.mergeVertices;this.computeFaceNormals;this.computeVertexNormals};THREE.LatheGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.LatheGeometry.prototype.constructor=THREE.LatheGeometry; THREE.PlaneGeometry=function(a,b,c,d){console.info("THREE.PlaneGeometry: Consider using THREE.PlaneBufferGeometry for lower memory footprint.");THREE.Geometry.call(this);this.type="PlaneGeometry";this.parameters={width:a,height:b,widthSegments:c,heightSegments:d};this.fromBufferGeometry(new THREE.PlaneBufferGeometry(a,b,c,d))};THREE.PlaneGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.PlaneGeometry.prototype.constructor=THREE.PlaneGeometry; THREE.PlaneBufferGeometry=function(a,b,c,d){THREE.BufferGeometry.call(this);this.type="PlaneBufferGeometry";this.parameters={width:a,height:b,widthSegments:c,heightSegments:d};var e=a/2,f=b/2;c=c||1;d=d||1;var g=c+1,h=d+1,k=a/c,l=b/d;b=new Float32Array(g*h*3);a=new Float32Array(g*h*3);for(var p=new Float32Array(g*h*2),q=0,n=0,t=0;t<h;t++)for(var r=t*l-f,s=0;s<g;s++)b[q]=s*k-e,b[q+1]=-r,a[q+2]=1,p[n]=s/c,p[n+1]=1-t/d,q+=3,n+=2;q=0;e=new (65535<b.length/3?Uint32Array:Uint16Array)(c*d*6);for(t=0;t<d;t++)for(s= 0;s<c;s++)f=s+g*(t+1),h=s+1+g*(t+1),k=s+1+g*t,e[q]=s+g*t,e[q+1]=f,e[q+2]=k,e[q+3]=f,e[q+4]=h,e[q+5]=k,q+=6;this.addAttribute("index",new THREE.BufferAttribute(e,1));this.addAttribute("position",new THREE.BufferAttribute(b,3));this.addAttribute("normal",new THREE.BufferAttribute(a,3));this.addAttribute("uv",new THREE.BufferAttribute(p,2))};THREE.PlaneBufferGeometry.prototype=Object.create(THREE.BufferGeometry.prototype);THREE.PlaneBufferGeometry.prototype.constructor=THREE.PlaneBufferGeometry; THREE.RingGeometry=function(a,b,c,d,e,f){THREE.Geometry.call(this);this.type="RingGeometry";this.parameters={innerRadius:a,outerRadius:b,thetaSegments:c,phiSegments:d,thetaStart:e,thetaLength:f};a=a||0;b=b||50;e=void 0!==e?e:0;f=void 0!==f?f:2*Math.PI;c=void 0!==c?Math.max(3,c):8;d=void 0!==d?Math.max(1,d):8;var g,h=[],k=a,l=(b-a)/d;for(a=0;a<d+1;a++){for(g=0;g<c+1;g++){var p=new THREE.Vector3,q=e+g/c*f;p.x=k*Math.cos(q);p.y=k*Math.sin(q);this.vertices.push(p);h.push(new THREE.Vector2((p.x/b+1)/2, (p.y/b+1)/2))}k+=l}b=new THREE.Vector3(0,0,1);for(a=0;a<d;a++)for(e=a*(c+1),g=0;g<c;g++)f=q=g+e,l=q+c+1,p=q+c+2,this.faces.push(new THREE.Face3(f,l,p,[b.clone,b.clone,b.clone])),this.faceVertexUvs[0].push([h[f].clone,h[l].clone,h[p].clone]),f=q,l=q+c+2,p=q+1,this.faces.push(new THREE.Face3(f,l,p,[b.clone,b.clone,b.clone])),this.faceVertexUvs[0].push([h[f].clone,h[l].clone,h[p].clone]);this.computeFaceNormals;this.boundingSphere=new THREE.Sphere(new THREE.Vector3,k)}; THREE.RingGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.RingGeometry.prototype.constructor=THREE.RingGeometry; THREE.SphereGeometry=function(a,b,c,d,e,f,g){THREE.Geometry.call(this);this.type="SphereGeometry";this.parameters={radius:a,widthSegments:b,heightSegments:c,phiStart:d,phiLength:e,thetaStart:f,thetaLength:g};a=a||50;b=Math.max(3,Math.floor(b)||8);c=Math.max(2,Math.floor(c)||6);d=void 0!==d?d:0;e=void 0!==e?e:2*Math.PI;f=void 0!==f?f:0;g=void 0!==g?g:Math.PI;var h,k,l=[],p=[];for(k=0;k<=c;k++){var q=[],n=[];for(h=0;h<=b;h++){var t=h/b,r=k/c,s=new THREE.Vector3;s.x=-a*Math.cos(d+t*e)*Math.sin(f+r*g); s.y=a*Math.cos(f+r*g);s.z=a*Math.sin(d+t*e)*Math.sin(f+r*g);this.vertices.push(s);q.push(this.vertices.length-1);n.push(new THREE.Vector2(t,1-r))}l.push(q);p.push(n)}for(k=0;k<c;k++)for(h=0;h<b;h++){d=l[k][h+1];e=l[k][h];f=l[k+1][h];g=l[k+1][h+1];var q=this.vertices[d].clone.normalize,n=this.vertices[e].clone.normalize,t=this.vertices[f].clone.normalize,r=this.vertices[g].clone.normalize,s=p[k][h+1].clone,u=p[k][h].clone,v=p[k+1][h].clone,x=p[k+1][h+1].clone;Math.abs(this.vertices[d].y)=== a?(s.x=(s.x+u.x)/2,this.faces.push(new THREE.Face3(d,f,g,[q,t,r])),this.faceVertexUvs[0].push([s,v,x])):Math.abs(this.vertices[f].y)===a?(v.x=(v.x+x.x)/2,this.faces.push(new THREE.Face3(d,e,f,[q,n,t])),this.faceVertexUvs[0].push([s,u,v])):(this.faces.push(new THREE.Face3(d,e,g,[q,n,r])),this.faceVertexUvs[0].push([s,u,x]),this.faces.push(new THREE.Face3(e,f,g,[n.clone,t,r.clone])),this.faceVertexUvs[0].push([u.clone,v,x.clone]))}this.computeFaceNormals;this.boundingSphere=new THREE.Sphere(new THREE.Vector3, a)};THREE.SphereGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.SphereGeometry.prototype.constructor=THREE.SphereGeometry;THREE.TextGeometry=function(a,b){b=b||{};var c=THREE.FontUtils.generateShapes(a,b);b.amount=void 0!==b.height?b.height:50;void 0===b.bevelThickness&&(b.bevelThickness=10);void 0===b.bevelSize&&(b.bevelSize=8);void 0===b.bevelEnabled&&(b.bevelEnabled=!1);THREE.ExtrudeGeometry.call(this,c,b);this.type="TextGeometry"};THREE.TextGeometry.prototype=Object.create(THREE.ExtrudeGeometry.prototype); THREE.TextGeometry.prototype.constructor=THREE.TextGeometry; THREE.TorusGeometry=function(a,b,c,d,e){THREE.Geometry.call(this);this.type="TorusGeometry";this.parameters={radius:a,tube:b,radialSegments:c,tubularSegments:d,arc:e};a=a||100;b=b||40;c=c||8;d=d||6;e=e||2*Math.PI;for(var f=new THREE.Vector3,g=[],h=[],k=0;k<=c;k++)for(var l=0;l<=d;l++){var p=l/d*e,q=k/c*Math.PI*2;f.x=a*Math.cos(p);f.y=a*Math.sin(p);var n=new THREE.Vector3;n.x=(a+b*Math.cos(q))*Math.cos(p);n.y=(a+b*Math.cos(q))*Math.sin(p);n.z=b*Math.sin(q);this.vertices.push(n);g.push(new THREE.Vector2(l/ d,k/c));h.push(n.clone.sub(f).normalize)}for(k=1;k<=c;k++)for(l=1;l<=d;l++)a=(d+1)*k+l-1,b=(d+1)*(k-1)+l-1,e=(d+1)*(k-1)+l,f=(d+1)*k+l,p=new THREE.Face3(a,b,f,[h[a].clone,h[b].clone,h[f].clone]),this.faces.push(p),this.faceVertexUvs[0].push([g[a].clone,g[b].clone,g[f].clone]),p=new THREE.Face3(b,e,f,[h[b].clone,h[e].clone,h[f].clone]),this.faces.push(p),this.faceVertexUvs[0].push([g[b].clone,g[e].clone,g[f].clone]);this.computeFaceNormals}; THREE.TorusGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.TorusGeometry.prototype.constructor=THREE.TorusGeometry; THREE.TorusKnotGeometry=function(a,b,c,d,e,f,g){function h(a,b,c,d,e){var f=Math.cos(a),g=Math.sin(a);a*=b/c;b=Math.cos(a);f*=d*(2+b)*.5;g=d*(2+b)*g*.5;d=e*d*Math.sin(a)*.5;return new THREE.Vector3(f,g,d)}THREE.Geometry.call(this);this.type="TorusKnotGeometry";this.parameters={radius:a,tube:b,radialSegments:c,tubularSegments:d,p:e,q:f,heightScale:g};a=a||100;b=b||40;c=c||64;d=d||8;e=e||2;f=f||3;g=g||1;for(var k=Array(c),l=new THREE.Vector3,p=new THREE.Vector3,q=new THREE.Vector3,n=0;n<c;++n){k[n]= Array(d);var t=n/c*2*e*Math.PI,r=h(t,f,e,a,g),t=h(t+.01,f,e,a,g);l.subVectors(t,r);p.addVectors(t,r);q.crossVectors(l,p);p.crossVectors(q,l);q.normalize;p.normalize;for(t=0;t<d;++t){var s=t/d*2*Math.PI,u=-b*Math.cos(s),s=b*Math.sin(s),v=new THREE.Vector3;v.x=r.x+u*p.x+s*q.x;v.y=r.y+u*p.y+s*q.y;v.z=r.z+u*p.z+s*q.z;k[n][t]=this.vertices.push(v)-1}}for(n=0;n<c;++n)for(t=0;t<d;++t)e=(n+1)%c,f=(t+1)%d,a=k[n][t],b=k[e][t],e=k[e][f],f=k[n][f],g=new THREE.Vector2(n/c,t/d),l=new THREE.Vector2((n+1)/c, t/d),p=new THREE.Vector2((n+1)/c,(t+1)/d),q=new THREE.Vector2(n/c,(t+1)/d),this.faces.push(new THREE.Face3(a,b,f)),this.faceVertexUvs[0].push([g,l,q]),this.faces.push(new THREE.Face3(b,e,f)),this.faceVertexUvs[0].push([l.clone,p,q.clone]);this.computeFaceNormals;this.computeVertexNormals};THREE.TorusKnotGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.TorusKnotGeometry.prototype.constructor=THREE.TorusKnotGeometry; THREE.TubeGeometry=function(a,b,c,d,e,f){THREE.Geometry.call(this);this.type="TubeGeometry";this.parameters={path:a,segments:b,radius:c,radialSegments:d,closed:e};b=b||64;c=c||1;d=d||8;e=e||!1;f=f||THREE.TubeGeometry.NoTaper;var g=[],h,k,l=b+1,p,q,n,t,r,s=new THREE.Vector3,u,v,x;u=new THREE.TubeGeometry.FrenetFrames(a,b,e);v=u.normals;x=u.binormals;this.tangents=u.tangents;this.normals=v;this.binormals=x;for(u=0;u<l;u++)for(g[u]=[],p=u/(l-1),r=a.getPointAt(p),h=v[u],k=x[u],n=c*f(p),p=0;p<d;p++)q= p/d*2*Math.PI,t=-n*Math.cos(q),q=n*Math.sin(q),s.copy(r),s.x+=t*h.x+q*k.x,s.y+=t*h.y+q*k.y,s.z+=t*h.z+q*k.z,g[u][p]=this.vertices.push(new THREE.Vector3(s.x,s.y,s.z))-1;for(u=0;u<b;u++)for(p=0;p<d;p++)f=e?(u+1)%b:u+1,l=(p+1)%d,a=g[u][p],c=g[f][p],f=g[f][l],l=g[u][l],s=new THREE.Vector2(u/b,p/d),v=new THREE.Vector2((u+1)/b,p/d),x=new THREE.Vector2((u+1)/b,(p+1)/d),h=new THREE.Vector2(u/b,(p+1)/d),this.faces.push(new THREE.Face3(a,c,l)),this.faceVertexUvs[0].push([s,v,h]),this.faces.push(new THREE.Face3(c, f,l)),this.faceVertexUvs[0].push([v.clone,x,h.clone]);this.computeFaceNormals;this.computeVertexNormals};THREE.TubeGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.TubeGeometry.prototype.constructor=THREE.TubeGeometry;THREE.TubeGeometry.NoTaper=function(a){return 1};THREE.TubeGeometry.SinusoidalTaper=function(a){return Math.sin(Math.PI*a)}; THREE.TubeGeometry.FrenetFrames=function(a,b,c){var d=new THREE.Vector3,e=[],f=[],g=[],h=new THREE.Vector3,k=new THREE.Matrix4;b+=1;var l,p,q;this.tangents=e;this.normals=f;this.binormals=g;for(l=0;l<b;l++)p=l/(b-1),e[l]=a.getTangentAt(p),e[l].normalize;f[0]=new THREE.Vector3;g[0]=new THREE.Vector3;a=Number.MAX_VALUE;l=Math.abs(e[0].x);p=Math.abs(e[0].y);q=Math.abs(e[0].z);l<=a&&(a=l,d.set(1,0,0));p<=a&&(a=p,d.set(0,1,0));q<=a&&d.set(0,0,1);h.crossVectors(e[0],d).normalize;f[0].crossVectors(e[0], h);g[0].crossVectors(e[0],f[0]);for(l=1;l<b;l++)f[l]=f[l-1].clone,g[l]=g[l-1].clone,h.crossVectors(e[l-1],e[l]),1E-4<h.length&&(h.normalize,d=Math.acos(THREE.Math.clamp(e[l-1].dot(e[l]),-1,1)),f[l].applyMatrix4(k.makeRotationAxis(h,d))),g[l].crossVectors(e[l],f[l]);if(c)for(d=Math.acos(THREE.Math.clamp(f[0].dot(f[b-1]),-1,1)),d/=b-1,0<e[0].dot(h.crossVectors(f[0],f[b-1]))&&(d=-d),l=1;l<b;l++)f[l].applyMatrix4(k.makeRotationAxis(e[l],d*l)),g[l].crossVectors(e[l],f[l])}; THREE.PolyhedronGeometry=function(a,b,c,d){function e(a){var b=a.normalize.clone;b.index=k.vertices.push(b)-1;var c=Math.atan2(a.z,-a.x)/2/Math.PI+.5;a=Math.atan2(-a.y,Math.sqrt(a.x*a.x+a.z*a.z))/Math.PI+.5;b.uv=new THREE.Vector2(c,1-a);return b}function f(a,b,c){var d=new THREE.Face3(a.index,b.index,c.index,[a.clone,b.clone,c.clone]);k.faces.push(d);u.copy(a).add(b).add(c).divideScalar(3);d=Math.atan2(u.z,-u.x);k.faceVertexUvs[0].push([h(a.uv,a,d),h(b.uv,b,d),h(c.uv,c,d)])}function g(a, b){for(var c=Math.pow(2,b),d=e(k.vertices[a.a]),g=e(k.vertices[a.b]),h=e(k.vertices[a.c]),l=[],n=0;n<=c;n++){l[n]=[];for(var p=e(d.clone.lerp(h,n/c)),q=e(g.clone.lerp(h,n/c)),s=c-n,r=0;r<=s;r++)l[n][r]=0==r&&n==c?p:e(p.clone.lerp(q,r/s))}for(n=0;n<c;n++)for(r=0;r<2*(c-n)-1;r++)d=Math.floor(r/2),0==r%2?f(l[n][d+1],l[n+1][d],l[n][d]):f(l[n][d+1],l[n+1][d+1],l[n+1][d])}function h(a,b,c){0>c&&1===a.x&&(a=new THREE.Vector2(a.x-1,a.y));0===b.x&&0===b.z&&(a=new THREE.Vector2(c/2/Math.PI+.5,a.y));return a.clone} THREE.Geometry.call(this);this.type="PolyhedronGeometry";this.parameters={vertices:a,indices:b,radius:c,detail:d};c=c||1;d=d||0;for(var k=this,l=0,p=a.length;l<p;l+=3)e(new THREE.Vector3(a[l],a[l+1],a[l+2]));a=this.vertices;for(var q=[],n=l=0,p=b.length;l<p;l+=3,n++){var t=a[b[l]],r=a[b[l+1]],s=a[b[l+2]];q[n]=new THREE.Face3(t.index,r.index,s.index,[t.clone,r.clone,s.clone])}for(var u=new THREE.Vector3,l=0,p=q.length;l<p;l++)g(q[l],d);l=0;for(p=this.faceVertexUvs[0].length;l<p;l++)b=this.faceVertexUvs[0][l], d=b[0].x,a=b[1].x,q=b[2].x,n=Math.max(d,Math.max(a,q)),t=Math.min(d,Math.min(a,q)),.9<n&&.1>t&&(.2>d&&(b[0].x+=1),.2>a&&(b[1].x+=1),.2>q&&(b[2].x+=1));l=0;for(p=this.vertices.length;l<p;l++)this.vertices[l].multiplyScalar(c);this.mergeVertices;this.computeFaceNormals;this.boundingSphere=new THREE.Sphere(new THREE.Vector3,c)};THREE.PolyhedronGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.PolyhedronGeometry.prototype.constructor=THREE.PolyhedronGeometry; THREE.DodecahedronGeometry=function(a,b){this.parameters={radius:a,detail:b};var c=(1+Math.sqrt(5))/2,d=1/c;THREE.PolyhedronGeometry.call(this,[-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-d,-c,0,-d,c,0,d,-c,0,d,c,-d,-c,0,-d,c,0,d,-c,0,d,c,0,-c,0,-d,c,0,-d,-c,0,d,c,0,d],[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],a,b)};THREE.DodecahedronGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.DodecahedronGeometry.prototype.constructor=THREE.DodecahedronGeometry; THREE.IcosahedronGeometry=function(a,b){var c=(1+Math.sqrt(5))/2;THREE.PolyhedronGeometry.call(this,[-1,c,0,1,c,0,-1,-c,0,1,-c,0,0,-1,c,0,1,c,0,-1,-c,0,1,-c,c,0,-1,c,0,1,-c,0,-1,-c,0,1],[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1],a,b);this.type="IcosahedronGeometry";this.parameters={radius:a,detail:b}};THREE.IcosahedronGeometry.prototype=Object.create(THREE.Geometry.prototype); THREE.IcosahedronGeometry.prototype.constructor=THREE.IcosahedronGeometry;THREE.OctahedronGeometry=function(a,b){this.parameters={radius:a,detail:b};THREE.PolyhedronGeometry.call(this,[1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2],a,b);this.type="OctahedronGeometry";this.parameters={radius:a,detail:b}};THREE.OctahedronGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.OctahedronGeometry.prototype.constructor=THREE.OctahedronGeometry; THREE.TetrahedronGeometry=function(a,b){THREE.PolyhedronGeometry.call(this,[1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],[2,1,0,0,3,2,1,3,0,2,3,1],a,b);this.type="TetrahedronGeometry";this.parameters={radius:a,detail:b}};THREE.TetrahedronGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.TetrahedronGeometry.prototype.constructor=THREE.TetrahedronGeometry; THREE.ParametricGeometry=function(a,b,c){THREE.Geometry.call(this);this.type="ParametricGeometry";this.parameters={func:a,slices:b,stacks:c};var d=this.vertices,e=this.faces,f=this.faceVertexUvs[0],g,h,k,l,p=b+1;for(g=0;g<=c;g++)for(l=g/c,h=0;h<=b;h++)k=h/b,k=a(k,l),d.push(k);var q,n,t,r;for(g=0;g<c;g++)for(h=0;h<b;h++)a=g*p+h,d=g*p+h+1,l=(g+1)*p+h+1,k=(g+1)*p+h,q=new THREE.Vector2(h/b,g/c),n=new THREE.Vector2((h+1)/b,g/c),t=new THREE.Vector2((h+1)/b,(g+1)/c),r=new THREE.Vector2(h/b,(g+1)/c),e.push(new THREE.Face3(a, d,k)),f.push([q,n,r]),e.push(new THREE.Face3(d,l,k)),f.push([n.clone,t,r.clone]);this.computeFaceNormals;this.computeVertexNormals};THREE.ParametricGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.ParametricGeometry.prototype.constructor=THREE.ParametricGeometry; THREE.AxisHelper=function(a){a=a||1;var b=new Float32Array([0,0,0,a,0,0,0,0,0,0,a,0,0,0,0,0,0,a]),c=new Float32Array([1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1]);a=new THREE.BufferGeometry;a.addAttribute("position",new THREE.BufferAttribute(b,3));a.addAttribute("color",new THREE.BufferAttribute(c,3));b=new THREE.LineBasicMaterial({vertexColors:THREE.VertexColors});THREE.Line.call(this,a,b,THREE.LinePieces)};THREE.AxisHelper.prototype=Object.create(THREE.Line.prototype); THREE.AxisHelper.prototype.constructor=THREE.AxisHelper; THREE.ArrowHelper=function{var a=new THREE.Geometry;a.vertices.push(new THREE.Vector3(0,0,0),new THREE.Vector3(0,1,0));var b=new THREE.CylinderGeometry(0,.5,1,5,1);b.applyMatrix((new THREE.Matrix4).makeTranslation(0,-.5,0));return function(c,d,e,f,g,h){THREE.Object3D.call(this);void 0===f&&(f=16776960);void 0===e&&(e=1);void 0===g&&(g=.2*e);void 0===h&&(h=.2*g);this.position.copy(d);this.line=new THREE.Line(a,new THREE.LineBasicMaterial({color:f}));this.line.matrixAutoUpdate=!1;this.add(this.line); this.cone=new THREE.Mesh(b,new THREE.MeshBasicMaterial({color:f}));this.cone.matrixAutoUpdate=!1;this.add(this.cone);this.setDirection(c);this.setLength(e,g,h)}};THREE.ArrowHelper.prototype=Object.create(THREE.Object3D.prototype);THREE.ArrowHelper.prototype.constructor=THREE.ArrowHelper; THREE.ArrowHelper.prototype.setDirection=function{var a=new THREE.Vector3,b;return function(c){.99999<c.y?this.quaternion.set(0,0,0,1):-.99999>c.y?this.quaternion.set(1,0,0,0):(a.set(c.z,0,-c.x).normalize,b=Math.acos(c.y),this.quaternion.setFromAxisAngle(a,b))}};THREE.ArrowHelper.prototype.setLength=function(a,b,c){void 0===b&&(b=.2*a);void 0===c&&(c=.2*b);this.line.scale.set(1,a-b,1);this.line.updateMatrix;this.cone.scale.set(c,b,c);this.cone.position.y=a;this.cone.updateMatrix}; THREE.ArrowHelper.prototype.setColor=function(a){this.line.material.color.set(a);this.cone.material.color.set(a)};THREE.BoxHelper=function(a){var b=new THREE.BufferGeometry;b.addAttribute("position",new THREE.BufferAttribute(new Float32Array(72),3));THREE.Line.call(this,b,new THREE.LineBasicMaterial({color:16776960}),THREE.LinePieces);void 0!==a&&this.update(a)};THREE.BoxHelper.prototype=Object.create(THREE.Line.prototype);THREE.BoxHelper.prototype.constructor=THREE.BoxHelper; THREE.BoxHelper.prototype.update=function(a){var b=a.geometry;null===b.boundingBox&&b.computeBoundingBox;var c=b.boundingBox.min,b=b.boundingBox.max,d=this.geometry.attributes.position.array;d[0]=b.x;d[1]=b.y;d[2]=b.z;d[3]=c.x;d[4]=b.y;d[5]=b.z;d[6]=c.x;d[7]=b.y;d[8]=b.z;d[9]=c.x;d[10]=c.y;d[11]=b.z;d[12]=c.x;d[13]=c.y;d[14]=b.z;d[15]=b.x;d[16]=c.y;d[17]=b.z;d[18]=b.x;d[19]=c.y;d[20]=b.z;d[21]=b.x;d[22]=b.y;d[23]=b.z;d[24]=b.x;d[25]=b.y;d[26]=c.z;d[27]=c.x;d[28]=b.y;d[29]=c.z;d[30]=c.x;d[31]=b.y; d[32]=c.z;d[33]=c.x;d[34]=c.y;d[35]=c.z;d[36]=c.x;d[37]=c.y;d[38]=c.z;d[39]=b.x;d[40]=c.y;d[41]=c.z;d[42]=b.x;d[43]=c.y;d[44]=c.z;d[45]=b.x;d[46]=b.y;d[47]=c.z;d[48]=b.x;d[49]=b.y;d[50]=b.z;d[51]=b.x;d[52]=b.y;d[53]=c.z;d[54]=c.x;d[55]=b.y;d[56]=b.z;d[57]=c.x;d[58]=b.y;d[59]=c.z;d[60]=c.x;d[61]=c.y;d[62]=b.z;d[63]=c.x;d[64]=c.y;d[65]=c.z;d[66]=b.x;d[67]=c.y;d[68]=b.z;d[69]=b.x;d[70]=c.y;d[71]=c.z;this.geometry.attributes.position.needsUpdate=!0;this.geometry.computeBoundingSphere;this.matrix=a.matrixWorld; this.matrixAutoUpdate=!1};THREE.BoundingBoxHelper=function(a,b){var c=void 0!==b?b:8947848;this.object=a;this.box=new THREE.Box3;THREE.Mesh.call(this,new THREE.BoxGeometry(1,1,1),new THREE.MeshBasicMaterial({color:c,wireframe:!0}))};THREE.BoundingBoxHelper.prototype=Object.create(THREE.Mesh.prototype);THREE.BoundingBoxHelper.prototype.constructor=THREE.BoundingBoxHelper;THREE.BoundingBoxHelper.prototype.update=function{this.box.setFromObject(this.object);this.box.size(this.scale);this.box.center(this.position)}; THREE.CameraHelper=function(a){function b(a,b,d){c(a,d);c(b,d)}function c(a,b){d.vertices.push(new THREE.Vector3);d.colors.push(new THREE.Color(b));void 0===f[a]&&(f[a]=[]);f[a].push(d.vertices.length-1)}var d=new THREE.Geometry,e=new THREE.LineBasicMaterial({color:16777215,vertexColors:THREE.FaceColors}),f={};b("n1","n2",16755200);b("n2","n4",16755200);b("n4","n3",16755200);b("n3","n1",16755200);b("f1","f2",16755200);b("f2","f4",16755200);b("f4","f3",16755200);b("f3","f1",16755200);b("n1","f1",16755200); b("n2","f2",16755200);b("n3","f3",16755200);b("n4","f4",16755200);b("p","n1",16711680);b("p","n2",16711680);b("p","n3",16711680);b("p","n4",16711680);b("u1","u2",43775);b("u2","u3",43775);b("u3","u1",43775);b("c","t",16777215);b("p","c",3355443);b("cn1","cn2",3355443);b("cn3","cn4",3355443);b("cf1","cf2",3355443);b("cf3","cf4",3355443);THREE.Line.call(this,d,e,THREE.LinePieces);this.camera=a;this.matrix=a.matrixWorld;this.matrixAutoUpdate=!1;this.pointMap=f;this.update}; THREE.CameraHelper.prototype=Object.create(THREE.Line.prototype);THREE.CameraHelper.prototype.constructor=THREE.CameraHelper; THREE.CameraHelper.prototype.update=function{var a,b,c=new THREE.Vector3,d=new THREE.Camera,e=function(e,g,h,k){c.set(g,h,k).unproject(d);e=b[e];if(void 0!==e)for(g=0,h=e.length;g<h;g++)a.vertices[e[g]].copy(c)};return function{a=this.geometry;b=this.pointMap;d.projectionMatrix.copy(this.camera.projectionMatrix);e("c",0,0,-1);e("t",0,0,1);e("n1",-1,-1,-1);e("n2",1,-1,-1);e("n3",-1,1,-1);e("n4",1,1,-1);e("f1",-1,-1,1);e("f2",1,-1,1);e("f3",-1,1,1);e("f4",1,1,1);e("u1",.7,1.1,-1);e("u2",-.7,1.1, -1);e("u3",0,2,-1);e("cf1",-1,0,1);e("cf2",1,0,1);e("cf3",0,-1,1);e("cf4",0,1,1);e("cn1",-1,0,-1);e("cn2",1,0,-1);e("cn3",0,-1,-1);e("cn4",0,1,-1);a.verticesNeedUpdate=!0}}; THREE.DirectionalLightHelper=function(a,b){THREE.Object3D.call(this);this.light=a;this.light.updateMatrixWorld;this.matrix=a.matrixWorld;this.matrixAutoUpdate=!1;b=b||1;var c=new THREE.Geometry;c.vertices.push(new THREE.Vector3(-b,b,0),new THREE.Vector3(b,b,0),new THREE.Vector3(b,-b,0),new THREE.Vector3(-b,-b,0),new THREE.Vector3(-b,b,0));var d=new THREE.LineBasicMaterial({fog:!1});d.color.copy(this.light.color).multiplyScalar(this.light.intensity);this.lightPlane=new THREE.Line(c,d);this.add(this.lightPlane); c=new THREE.Geometry;c.vertices.push(new THREE.Vector3,new THREE.Vector3);d=new THREE.LineBasicMaterial({fog:!1});d.color.copy(this.light.color).multiplyScalar(this.light.intensity);this.targetLine=new THREE.Line(c,d);this.add(this.targetLine);this.update};THREE.DirectionalLightHelper.prototype=Object.create(THREE.Object3D.prototype);THREE.DirectionalLightHelper.prototype.constructor=THREE.DirectionalLightHelper; THREE.DirectionalLightHelper.prototype.dispose=function{this.lightPlane.geometry.dispose;this.lightPlane.material.dispose;this.targetLine.geometry.dispose;this.targetLine.material.dispose}; THREE.DirectionalLightHelper.prototype.update=function{var a=new THREE.Vector3,b=new THREE.Vector3,c=new THREE.Vector3;return function{a.setFromMatrixPosition(this.light.matrixWorld);b.setFromMatrixPosition(this.light.target.matrixWorld);c.subVectors(b,a);this.lightPlane.lookAt(c);this.lightPlane.material.color.copy(this.light.color).multiplyScalar(this.light.intensity);this.targetLine.geometry.vertices[1].copy(c);this.targetLine.geometry.verticesNeedUpdate=!0;this.targetLine.material.color.copy(this.lightPlane.material.color)}}; THREE.EdgesHelper=function(a,b,c){b=void 0!==b?b:16777215;c=Math.cos(THREE.Math.degToRad(void 0!==c?c:1));var d=[0,0],e={},f=function(a,b){return a-b},g=["a","b","c"],h=new THREE.BufferGeometry,k;a.geometry instanceof THREE.BufferGeometry?(k=new THREE.Geometry,k.fromBufferGeometry(a.geometry)):k=a.geometry.clone;k.mergeVertices;k.computeFaceNormals;var l=k.vertices;k=k.faces;for(var p=0,q=0,n=k.length;q<n;q++)for(var t=k[q],r=0;3>r;r++){d[0]=t[g[r]];d[1]=t[g[(r+1)%3]];d.sort(f);var s=d.toString; void 0===e[s]?(e[s]={vert1:d[0],vert2:d[1],face1:q,face2:void 0},p++):e[s].face2=q}d=new Float32Array(6*p);f=0;for(s in e)if(g=e[s],void 0===g.face2||k[g.face1].normal.dot(k[g.face2].normal)<=c)p=l[g.vert1],d[f++]=p.x,d[f++]=p.y,d[f++]=p.z,p=l[g.vert2],d[f++]=p.x,d[f++]=p.y,d[f++]=p.z;h.addAttribute("position",new THREE.BufferAttribute(d,3));THREE.Line.call(this,h,new THREE.LineBasicMaterial({color:b}),THREE.LinePieces);this.matrix=a.matrixWorld;this.matrixAutoUpdate=!1}; THREE.EdgesHelper.prototype=Object.create(THREE.Line.prototype);THREE.EdgesHelper.prototype.constructor=THREE.EdgesHelper; THREE.FaceNormalsHelper=function(a,b,c,d){this.object=a;this.size=void 0!==b?b:1;a=void 0!==c?c:16776960;d=void 0!==d?d:1;b=new THREE.Geometry;c=0;for(var e=this.object.geometry.faces.length;c<e;c++)b.vertices.push(new THREE.Vector3,new THREE.Vector3);THREE.Line.call(this,b,new THREE.LineBasicMaterial({color:a,linewidth:d}),THREE.LinePieces);this.matrixAutoUpdate=!1;this.normalMatrix=new THREE.Matrix3;this.update};THREE.FaceNormalsHelper.prototype=Object.create(THREE.Line.prototype); THREE.FaceNormalsHelper.prototype.constructor=THREE.FaceNormalsHelper; THREE.FaceNormalsHelper.prototype.update=function{var a=this.geometry.vertices,b=this.object,c=b.geometry.vertices,d=b.geometry.faces,e=b.matrixWorld;b.updateMatrixWorld(!0);this.normalMatrix.getNormalMatrix(e);for(var f=b=0,g=d.length;b<g;b++,f+=2){var h=d[b];a[f].copy(c[h.a]).add(c[h.b]).add(c[h.c]).divideScalar(3).applyMatrix4(e);a[f+1].copy(h.normal).applyMatrix3(this.normalMatrix).normalize.multiplyScalar(this.size).add(a[f])}this.geometry.verticesNeedUpdate=!0;return this}; THREE.GridHelper=function(a,b){var c=new THREE.Geometry,d=new THREE.LineBasicMaterial({vertexColors:THREE.VertexColors});this.color1=new THREE.Color(4473924);this.color2=new THREE.Color(8947848);for(var e=-a;e<=a;e+=b){c.vertices.push(new THREE.Vector3(-a,0,e),new THREE.Vector3(a,0,e),new THREE.Vector3(e,0,-a),new THREE.Vector3(e,0,a));var f=0===e?this.color1:this.color2;c.colors.push(f,f,f,f)}THREE.Line.call(this,c,d,THREE.LinePieces)};THREE.GridHelper.prototype=Object.create(THREE.Line.prototype); THREE.GridHelper.prototype.constructor=THREE.GridHelper;THREE.GridHelper.prototype.setColors=function(a,b){this.color1.set(a);this.color2.set(b);this.geometry.colorsNeedUpdate=!0}; THREE.HemisphereLightHelper=function(a,b){THREE.Object3D.call(this);this.light=a;this.light.updateMatrixWorld;this.matrix=a.matrixWorld;this.matrixAutoUpdate=!1;this.colors=[new THREE.Color,new THREE.Color];var c=new THREE.SphereGeometry(b,4,2);c.applyMatrix((new THREE.Matrix4).makeRotationX(-Math.PI/2));for(var d=0;8>d;d++)c.faces[d].color=this.colors[4>d?0:1];d=new THREE.MeshBasicMaterial({vertexColors:THREE.FaceColors,wireframe:!0});this.lightSphere=new THREE.Mesh(c,d);this.add(this.lightSphere); this.update};THREE.HemisphereLightHelper.prototype=Object.create(THREE.Object3D.prototype);THREE.HemisphereLightHelper.prototype.constructor=THREE.HemisphereLightHelper;THREE.HemisphereLightHelper.prototype.dispose=function{this.lightSphere.geometry.dispose;this.lightSphere.material.dispose}; THREE.HemisphereLightHelper.prototype.update=function{var a=new THREE.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(a.setFromMatrixPosition(this.light.matrixWorld).negate);this.lightSphere.geometry.colorsNeedUpdate=!0}}; THREE.PointLightHelper=function(a,b){this.light=a;this.light.updateMatrixWorld;var c=new THREE.SphereGeometry(b,4,2),d=new THREE.MeshBasicMaterial({wireframe:!0,fog:!1});d.color.copy(this.light.color).multiplyScalar(this.light.intensity);THREE.Mesh.call(this,c,d);this.matrix=this.light.matrixWorld;this.matrixAutoUpdate=!1};THREE.PointLightHelper.prototype=Object.create(THREE.Mesh.prototype);THREE.PointLightHelper.prototype.constructor=THREE.PointLightHelper; THREE.PointLightHelper.prototype.dispose=function{this.geometry.dispose;this.material.dispose};THREE.PointLightHelper.prototype.update=function{this.material.color.copy(this.light.color).multiplyScalar(this.light.intensity)}; THREE.SkeletonHelper=function(a){this.bones=this.getBoneList(a);for(var b=new THREE.Geometry,c=0;c<this.bones.length;c++)this.bones[c].parent instanceof THREE.Bone&&(b.vertices.push(new THREE.Vector3),b.vertices.push(new THREE.Vector3),b.colors.push(new THREE.Color(0,0,1)),b.colors.push(new THREE.Color(0,1,0)));c=new THREE.LineBasicMaterial({vertexColors:THREE.VertexColors,depthTest:!1,depthWrite:!1,transparent:!0});THREE.Line.call(this,b,c,THREE.LinePieces);this.root=a;this.matrix=a.matrixWorld; this.matrixAutoUpdate=!1;this.update};THREE.SkeletonHelper.prototype=Object.create(THREE.Line.prototype);THREE.SkeletonHelper.prototype.constructor=THREE.SkeletonHelper;THREE.SkeletonHelper.prototype.getBoneList=function(a){var b=[];a instanceof THREE.Bone&&b.push(a);for(var c=0;c<a.children.length;c++)b.push.apply(b,this.getBoneList(a.children[c]));return b}; THREE.SkeletonHelper.prototype.update=function{for(var a=this.geometry,b=(new THREE.Matrix4).getInverse(this.root.matrixWorld),c=new THREE.Matrix4,d=0,e=0;e<this.bones.length;e++){var f=this.bones[e];f.parent instanceof THREE.Bone&&(c.multiplyMatrices(b,f.matrixWorld),a.vertices[d].setFromMatrixPosition(c),c.multiplyMatrices(b,f.parent.matrixWorld),a.vertices[d+1].setFromMatrixPosition(c),d+=2)}a.verticesNeedUpdate=!0;a.computeBoundingSphere}; THREE.SpotLightHelper=function(a){THREE.Object3D.call(this);this.light=a;this.light.updateMatrixWorld;this.matrix=a.matrixWorld;this.matrixAutoUpdate=!1;a=new THREE.CylinderGeometry(0,1,1,8,1,!0);a.applyMatrix((new THREE.Matrix4).makeTranslation(0,-.5,0));a.applyMatrix((new THREE.Matrix4).makeRotationX(-Math.PI/2));var b=new THREE.MeshBasicMaterial({wireframe:!0,fog:!1});this.cone=new THREE.Mesh(a,b);this.add(this.cone);this.update};THREE.SpotLightHelper.prototype=Object.create(THREE.Object3D.prototype); THREE.SpotLightHelper.prototype.constructor=THREE.SpotLightHelper;THREE.SpotLightHelper.prototype.dispose=function{this.cone.geometry.dispose;this.cone.material.dispose}; THREE.SpotLightHelper.prototype.update=function{var a=new THREE.Vector3,b=new THREE.Vector3;return function{var c=this.light.distance?this.light.distance:1E4,d=c*Math.tan(this.light.angle);this.cone.scale.set(d,d,c);a.setFromMatrixPosition(this.light.matrixWorld);b.setFromMatrixPosition(this.light.target.matrixWorld);this.cone.lookAt(b.sub(a));this.cone.material.color.copy(this.light.color).multiplyScalar(this.light.intensity)}}; THREE.VertexNormalsHelper=function(a,b,c,d){this.object=a;this.size=void 0!==b?b:1;b=void 0!==c?c:16711680;d=void 0!==d?d:1;c=new THREE.Geometry;a=a.geometry.faces;for(var e=0,f=a.length;e<f;e++)for(var g=0,h=a[e].vertexNormals.length;g<h;g++)c.vertices.push(new THREE.Vector3,new THREE.Vector3);THREE.Line.call(this,c,new THREE.LineBasicMaterial({color:b,linewidth:d}),THREE.LinePieces);this.matrixAutoUpdate=!1;this.normalMatrix=new THREE.Matrix3;this.update};THREE.VertexNormalsHelper.prototype=Object.create(THREE.Line.prototype); THREE.VertexNormalsHelper.prototype.constructor=THREE.VertexNormalsHelper; THREE.VertexNormalsHelper.prototype.update=function(a){var b=new THREE.Vector3;return function(a){a=["a","b","c","d"];this.object.updateMatrixWorld(!0);this.normalMatrix.getNormalMatrix(this.object.matrixWorld);for(var d=this.geometry.vertices,e=this.object.geometry.vertices,f=this.object.geometry.faces,g=this.object.matrixWorld,h=0,k=0,l=f.length;k<l;k++)for(var p=f[k],q=0,n=p.vertexNormals.length;q<n;q++){var t=p.vertexNormals[q];d[h].copy(e[p[a[q]]]).applyMatrix4(g);b.copy(t).applyMatrix3(this.normalMatrix).normalize.multiplyScalar(this.size); b.add(d[h]);h+=1;d[h].copy(b);h+=1}this.geometry.verticesNeedUpdate=!0;return this}}; THREE.VertexTangentsHelper=function(a,b,c,d){this.object=a;this.size=void 0!==b?b:1;b=void 0!==c?c:255;d=void 0!==d?d:1;c=new THREE.Geometry;a=a.geometry.faces;for(var e=0,f=a.length;e<f;e++)for(var g=0,h=a[e].vertexTangents.length;g<h;g++)c.vertices.push(new THREE.Vector3),c.vertices.push(new THREE.Vector3);THREE.Line.call(this,c,new THREE.LineBasicMaterial({color:b,linewidth:d}),THREE.LinePieces);this.matrixAutoUpdate=!1;this.update};THREE.VertexTangentsHelper.prototype=Object.create(THREE.Line.prototype); THREE.VertexTangentsHelper.prototype.constructor=THREE.VertexTangentsHelper; THREE.VertexTangentsHelper.prototype.update=function(a){var b=new THREE.Vector3;return function(a){a=["a","b","c","d"];this.object.updateMatrixWorld(!0);for(var d=this.geometry.vertices,e=this.object.geometry.vertices,f=this.object.geometry.faces,g=this.object.matrixWorld,h=0,k=0,l=f.length;k<l;k++)for(var p=f[k],q=0,n=p.vertexTangents.length;q<n;q++){var t=p.vertexTangents[q];d[h].copy(e[p[a[q]]]).applyMatrix4(g);b.copy(t).transformDirection(g).multiplyScalar(this.size);b.add(d[h]);h+=1;d[h].copy(b); h+=1}this.geometry.verticesNeedUpdate=!0;return this}}; THREE.WireframeHelper=function(a,b){var c=void 0!==b?b:16777215,d=[0,0],e={},f=function(a,b){return a-b},g=["a","b","c"],h=new THREE.BufferGeometry;if(a.geometry instanceof THREE.Geometry){for(var k=a.geometry.vertices,l=a.geometry.faces,p=0,q=new Uint32Array(6*l.length),n=0,t=l.length;n<t;n++)for(var r=l[n],s=0;3>s;s++){d[0]=r[g[s]];d[1]=r[g[(s+1)%3]];d.sort(f);var u=d.toString;void 0===e[u]&&(q[2*p]=d[0],q[2*p+1]=d[1],e[u]=!0,p++)}d=new Float32Array(6*p);n=0;for(t=p;n<t;n++)for(s=0;2>s;s++)p= k[q[2*n+s]],g=6*n+3*s,d[g+0]=p.x,d[g+1]=p.y,d[g+2]=p.z;h.addAttribute("position",new THREE.BufferAttribute(d,3))}else if(a.geometry instanceof THREE.BufferGeometry){if(void 0!==a.geometry.attributes.index){k=a.geometry.attributes.position.array;t=a.geometry.attributes.index.array;l=a.geometry.drawcalls;p=0;0===l.length&&(l=[{count:t.length,index:0,start:0}]);for(var q=new Uint32Array(2*t.length),r=0,v=l.length;r<v;++r)for(var s=l[r].start,u=l[r].count,g=l[r].index,n=s,x=s+u;n<x;n+=3)for(s=0;3>s;s++)d[0]= g+t[n+s],d[1]=g+t[n+(s+1)%3],d.sort(f),u=d.toString,void 0===e[u]&&(q[2*p]=d[0],q[2*p+1]=d[1],e[u]=!0,p++);d=new Float32Array(6*p);n=0;for(t=p;n<t;n++)for(s=0;2>s;s++)g=6*n+3*s,p=3*q[2*n+s],d[g+0]=k[p],d[g+1]=k[p+1],d[g+2]=k[p+2]}else for(k=a.geometry.attributes.position.array,p=k.length/3,q=p/3,d=new Float32Array(6*p),n=0,t=q;n<t;n++)for(s=0;3>s;s++)g=18*n+6*s,q=9*n+3*s,d[g+0]=k[q],d[g+1]=k[q+1],d[g+2]=k[q+2],p=9*n+(s+1)%3*3,d[g+3]=k[p],d[g+4]=k[p+1],d[g+5]=k[p+2];h.addAttribute("position",new THREE.BufferAttribute(d, 3))}THREE.Line.call(this,h,new THREE.LineBasicMaterial({color:c}),THREE.LinePieces);this.matrix=a.matrixWorld;this.matrixAutoUpdate=!1};THREE.WireframeHelper.prototype=Object.create(THREE.Line.prototype);THREE.WireframeHelper.prototype.constructor=THREE.WireframeHelper;THREE.ImmediateRenderObject=function{THREE.Object3D.call(this);this.render=function(a){}};THREE.ImmediateRenderObject.prototype=Object.create(THREE.Object3D.prototype);THREE.ImmediateRenderObject.prototype.constructor=THREE.ImmediateRenderObject; THREE.MorphBlendMesh=function(a,b){THREE.Mesh.call(this,a,b);this.animationsMap={};this.animationsList=[];var c=this.geometry.morphTargets.length;this.createAnimation("__default",0,c-1,c/1);this.setAnimationWeight("__default",1)};THREE.MorphBlendMesh.prototype=Object.create(THREE.Mesh.prototype);THREE.MorphBlendMesh.prototype.constructor=THREE.MorphBlendMesh; THREE.MorphBlendMesh.prototype.createAnimation=function(a,b,c,d){b={startFrame:b,endFrame:c,length:c-b+1,fps:d,duration:(c-b)/d,lastFrame:0,currentFrame:0,active:!1,time:0,direction:1,weight:1,directionBackwards:!1,mirroredLoop:!1};this.animationsMap[a]=b;this.animationsList.push(b)}; THREE.MorphBlendMesh.prototype.autoCreateAnimations=function(a){for(var b=/([a-z]+)_?(\d+)/,c,d={},e=this.geometry,f=0,g=e.morphTargets.length;f<g;f++){var h=e.morphTargets[f].name.match(b);if(h&&1<h.length){var k=h[1];d[k]||(d[k]={start:Infinity,end:-Infinity});h=d[k];f<h.start&&(h.start=f);f>h.end&&(h.end=f);c||(c=k)}}for(k in d)h=d[k],this.createAnimation(k,h.start,h.end,a);this.firstAnimation=c}; THREE.MorphBlendMesh.prototype.setAnimationDirectionForward=function(a){if(a=this.animationsMap[a])a.direction=1,a.directionBackwards=!1};THREE.MorphBlendMesh.prototype.setAnimationDirectionBackward=function(a){if(a=this.animationsMap[a])a.direction=-1,a.directionBackwards=!0};THREE.MorphBlendMesh.prototype.setAnimationFPS=function(a,b){var c=this.animationsMap[a];c&&(c.fps=b,c.duration=(c.end-c.start)/c.fps)}; THREE.MorphBlendMesh.prototype.setAnimationDuration=function(a,b){var c=this.animationsMap[a];c&&(c.duration=b,c.fps=(c.end-c.start)/c.duration)};THREE.MorphBlendMesh.prototype.setAnimationWeight=function(a,b){var c=this.animationsMap[a];c&&(c.weight=b)};THREE.MorphBlendMesh.prototype.setAnimationTime=function(a,b){var c=this.animationsMap[a];c&&(c.time=b)};THREE.MorphBlendMesh.prototype.getAnimationTime=function(a){var b=0;if(a=this.animationsMap[a])b=a.time;return b}; THREE.MorphBlendMesh.prototype.getAnimationDuration=function(a){var b=-1;if(a=this.animationsMap[a])b=a.duration;return b};THREE.MorphBlendMesh.prototype.playAnimation=function(a){var b=this.animationsMap[a];b?(b.time=0,b.active=!0):THREE.warn("THREE.MorphBlendMesh: animation["+a+"] undefined in .playAnimation")};THREE.MorphBlendMesh.prototype.stopAnimation=function(a){if(a=this.animationsMap[a])a.active=!1}; THREE.MorphBlendMesh.prototype.update=function(a){for(var b=0,c=this.animationsList.length;b<c;b++){var d=this.animationsList[b];if(d.active){var e=d.duration/d.length;d.time+=d.direction*a;if(d.mirroredLoop){if(d.time>d.duration||0>d.time)d.direction*=-1,d.time>d.duration&&(d.time=d.duration,d.directionBackwards=!0),0>d.time&&(d.time=0,d.directionBackwards=!1)}else d.time%=d.duration,0>d.time&&(d.time+=d.duration);var f=d.startFrame+THREE.Math.clamp(Math.floor(d.time/e),0,d.length-1),g=d.weight; f!==d.currentFrame&&(this.morphTargetInfluences[d.lastFrame]=0,this.morphTargetInfluences[d.currentFrame]=1*g,this.morphTargetInfluences[f]=0,d.lastFrame=d.currentFrame,d.currentFrame=f);e=d.time%e/e;d.directionBackwards&&(e=1-e);this.morphTargetInfluences[d.currentFrame]=e*g;this.morphTargetInfluences[d.lastFrame]=(1-e)*g}}};

// Export the THREE object for **Node.js**, with // backwards-compatibility for the old `require` API. If we're in // the browser, add `_` as a global object via a string identifier, // for Closure Compiler "advanced" mode. if (typeof exports !== 'undefined') { if (typeof module !== 'undefined' && module.exports) { exports = module.exports = THREE; } exports.THREE = THREE; } else { this['THREE'] = THREE; }

var Detector={canvas:!!window.CanvasRenderingContext2D,webgl:function{try{var e=document.createElement("canvas");return!(!window.WebGLRenderingContext||!e.getContext("webgl")&&!e.getContext("experimental-webgl"))}catch(i){return!1}},workers:!!window.Worker,fileapi:window.File&&window.FileReader&&window.FileList&&window.Blob,getWebGLErrorMessage:function{var e=document.createElement("div");return e.id="webgl-error-message",e.style.fontFamily="monospace",e.style.fontSize="13px",e.style.fontWeight="normal",e.style.textAlign="center",e.style.background="#fff",e.style.color="#000",e.style.padding="1.5em",e.style.width="400px",e.style.margin="5em auto 0",this.webgl||(e.innerHTML=window.WebGLRenderingContext?['Your graphics card does not seem to support <a href="http://khronos.org/webgl/wiki/Getting_a_WebGL_Implementation" style="color:#000">WebGL</a>. ','Find out how to get it <a href="http://get.webgl.org/" style="color:#000">here</a>.'].join("\n"):['Your browser does not seem to support <a href="http://khronos.org/webgl/wiki/Getting_a_WebGL_Implementation" style="color:#000">WebGL</a>. ','Find out how to get it <a href="http://get.webgl.org/" style="color:#000">here</a>.'].join("\n")),e},addGetWebGLMessage:function(e){var i,t,n;e=e||{},i=void 0!==e.parent?e.parent:document.body,t=void 0!==e.id?e.id:"oldie",n=Detector.getWebGLErrorMessage,n.id=t,i.appendChild(n)}};if("object"==typeof module&&(module.exports=Detector),THREE.SpriteCanvasMaterial=function(e){THREE.Material.call(this),this.type="SpriteCanvasMaterial",this.color=new THREE.Color(16777215),this.program=function(e,i){},this.setValues(e)},THREE.SpriteCanvasMaterial.prototype=Object.create(THREE.Material.prototype),THREE.SpriteCanvasMaterial.prototype.constructor=THREE.SpriteCanvasMaterial,THREE.SpriteCanvasMaterial.prototype.clone=function{var e=new THREE.SpriteCanvasMaterial;return e.copy(this),e.color.copy(this.color),e.program=this.program,e},THREE.CanvasRenderer=function(e){function i{be.setRGB(0,0,0),ye.setRGB(0,0,0),Ee.setRGB(0,0,0);for(var e=0,i=C.length;i>e;e++){var t=C[e],n=t.color;t instanceof THREE.AmbientLight?be.add(n):t instanceof THREE.DirectionalLight?ye.add(n):t instanceof THREE.PointLight&&Ee.add(n)}}function t(e,i,t){for(var n=0,o=C.length;o>n;n++){var s=C[n];if(pe.copy(s.color),s instanceof THREE.DirectionalLight){var r=_e.setFromMatrixPosition(s.matrixWorld).normalize,a=i.dot(r);if(0>=a)continue;a*=s.intensity,t.add(pe.multiplyScalar(a))}else if(s instanceof THREE.PointLight){var r=_e.setFromMatrixPosition(s.matrixWorld),a=i.dot(_e.subVectors(r,e).normalize);if(0>=a)continue;if(a*=0==s.distance?1:1-Math.min(e.distanceTo(r)/s.distance,1),0==a)continue;a*=s.intensity,t.add(pe.multiplyScalar(a))}}}function n(e,i,t){u(t.opacity),p(t.blending);var n=i.scale.x*U,o=i.scale.y*W,s=.5*Math.sqrt(n*n+o*o);if(ve.min.set(e.x-s,e.y-s),ve.max.set(e.x+s,e.y+s),t instanceof THREE.SpriteMaterial){var r=t.map;if(null!==r){var a=me[r.id];if((void 0===a||a.version!==r.version)&&(a=l(r),me[r.id]=a),void 0!==a.canvas){b(a.canvas);var c=r.image,d=c.width*r.offset.x,h=c.height*r.offset.y,m=c.width*r.repeat.x,g=c.height*r.repeat.y,f=n/m,y=o/g;J.save,J.translate(e.x,e.y),0!==t.rotation&&J.rotate(t.rotation),J.translate(-n/2,-o/2),J.scale(f,y),J.translate(-d,-h),J.fillRect(d,h,m,g),J.restore}}else b(t.color.getStyle),J.save,J.translate(e.x,e.y),0!==t.rotation&&J.rotate(t.rotation),J.scale(n,-o),J.fillRect(-.5,-.5,1,1),J.restore}else t instanceof THREE.SpriteCanvasMaterial&&(v(t.color.getStyle),b(t.color.getStyle),J.save,J.translate(e.x,e.y),0!==t.rotation&&J.rotate(t.rotation),J.scale(n,o),t.program(J),J.restore)}function o(e,i,t,n){if(u(n.opacity),p(n.blending),J.beginPath,J.moveTo(e.positionScreen.x,e.positionScreen.y),J.lineTo(i.positionScreen.x,i.positionScreen.y),n instanceof THREE.LineBasicMaterial){if(m(n.linewidth),g(n.linecap),f(n.linejoin),n.vertexColors!==THREE.VertexColors)v(n.color.getStyle);else{var o=t.vertexColors[0].getStyle,s=t.vertexColors[1].getStyle;if(o===s)v(o);else{try{var r=J.createLinearGradient(e.positionScreen.x,e.positionScreen.y,i.positionScreen.x,i.positionScreen.y);r.addColorStop(0,o),r.addColorStop(1,s)}catch(a){r=o}v(r)}}J.stroke,ve.expandByScalar(2*n.linewidth)}else n instanceof THREE.LineDashedMaterial&&(m(n.linewidth),g(n.linecap),f(n.linejoin),v(n.color.getStyle),y([n.dashSize,n.gapSize]),J.stroke,ve.expandByScalar(2*n.linewidth),y([]))}function s(e,i,n,o,s,l,h,m){if(P.info.render.vertices+=3,P.info.render.faces++,u(m.opacity),p(m.blending),H=e.positionScreen.x,A=e.positionScreen.y,x=i.positionScreen.x,O=i.positionScreen.y,$=n.positionScreen.x,M=n.positionScreen.y,r(H,A,x,O,$,M),(m instanceof THREE.MeshLambertMaterial||m instanceof THREE.MeshPhongMaterial)&&null===m.map)he.copy(m.color),ue.copy(m.emissive),m.vertexColors===THREE.FaceColors&&he.multiply(h.color),de.copy(be),we.copy(e.positionWorld).add(i.positionWorld).add(n.positionWorld).divideScalar(3),t(we,h.normalModel,de),de.multiply(he).add(ue),m.wireframe===!0?a(de,m.wireframeLinewidth,m.wireframeLinecap,m.wireframeLinejoin):c(de);else if(m instanceof THREE.MeshBasicMaterial||m instanceof THREE.MeshLambertMaterial||m instanceof THREE.MeshPhongMaterial)if(null!==m.map){var g=m.map.mapping;g===THREE.UVMapping&&(L=h.uvs,d(H,A,x,O,$,M,L[o].x,L[o].y,L[s].x,L[s].y,L[l].x,L[l].y,m.map))}else null!==m.envMap?m.envMap.mapping===THREE.SphericalReflectionMapping&&(Ce.copy(h.vertexNormalsModel[o]).applyMatrix3(Se),I=.5*Ce.x+.5,D=.5*Ce.y+.5,Ce.copy(h.vertexNormalsModel[s]).applyMatrix3(Se),z=.5*Ce.x+.5,N=.5*Ce.y+.5,Ce.copy(h.vertexNormalsModel[l]).applyMatrix3(Se),q=.5*Ce.x+.5,j=.5*Ce.y+.5,d(H,A,x,O,$,M,I,D,z,N,q,j,m.envMap)):(de.copy(m.color),m.vertexColors===THREE.FaceColors&&de.multiply(h.color),m.wireframe===!0?a(de,m.wireframeLinewidth,m.wireframeLinecap,m.wireframeLinejoin):c(de));else m instanceof THREE.MeshDepthMaterial?(de.r=de.g=de.b=1-E(e.positionScreen.z*e.positionScreen.w,S.near,S.far),m.wireframe===!0?a(de,m.wireframeLinewidth,m.wireframeLinecap,m.wireframeLinejoin):c(de)):m instanceof THREE.MeshNormalMaterial?(Ce.copy(h.normalModel).applyMatrix3(Se),de.setRGB(Ce.x,Ce.y,Ce.z).multiplyScalar(.5).addScalar(.5),m.wireframe===!0?a(de,m.wireframeLinewidth,m.wireframeLinecap,m.wireframeLinejoin):c(de)):(de.setRGB(1,1,1),m.wireframe===!0?a(de,m.wireframeLinewidth,m.wireframeLinecap,m.wireframeLinejoin):c(de))}function r(e,i,t,n,o,s){J.beginPath,J.moveTo(e,i),J.lineTo(t,n),J.lineTo(o,s),J.closePath}function a(e,i,t,n){m(i),g(t),f(n),v(e.getStyle),J.stroke,ve.expandByScalar(2*i)}function c(e){b(e.getStyle),J.fill}function l(e){if(0===e.version||e instanceof THREE.CompressedTexture||e instanceof THREE.DataTexture)return{canvas:void 0,version:e.version};var i=e.image,t=document.createElement("canvas");t.width=i.width,t.height=i.height;var n=t.getContext("2d");n.setTransform(1,0,0,-1,0,i.height),n.drawImage(i,0,0);var o=e.wrapS===THREE.RepeatWrapping,s=e.wrapT===THREE.RepeatWrapping,r="no-repeat";return o===!0&&s===!0?r="repeat":o===!0?r="repeat-x":s===!0&&(r="repeat-y"),{canvas:J.createPattern(t,r),version:e.version}}function d(e,i,t,n,o,s,r,a,c,d,h,u,p){var m=me[p.id];if((void 0===m||m.version!==p.version)&&(m=l(p),me[p.id]=m),void 0===m.canvas)return b("rgba( 0, 0, 0, 1)"),void J.fill;b(m.canvas);var g,f,v,y,E,_,w,C,S=p.offset.x/p.repeat.x,k=p.offset.y/p.repeat.y,R=p.image.width*p.repeat.x,T=p.image.height*p.repeat.y;r=(r+S)*R,a=(a+k)*T,c=(c+S)*R,d=(d+k)*T,h=(h+S)*R,u=(u+k)*T,t-=e,n-=i,o-=e,s-=i,c-=r,d-=a,h-=r,u-=a,w=c*u-h*d,0!==w&&(C=1/w,g=(u*t-d*o)*C,f=(u*n-d*s)*C,v=(c*o-h*t)*C,y=(c*s-h*n)*C,E=e-g*r-v*a,_=i-f*r-y*a,J.save,J.transform(g,f,v,y,E,_),J.fill,J.restore)}function h(e,i,t){var n,o=i.x-e.x,s=i.y-e.y,r=o*o+s*s;0!==r&&(n=t/Math.sqrt(r),o*=n,s*=n,i.x+=o,i.y+=s,e.x-=o,e.y-=s)}function u(e){te!==e&&(J.globalAlpha=e,te=e)}function p(e){ne!==e&&(e===THREE.NormalBlending?J.globalCompositeOperation="source-over":e===THREE.AdditiveBlending?J.globalCompositeOperation="lighter":e===THREE.SubtractiveBlending&&(J.globalCompositeOperation="darker"),ne=e)}function m(e){re!==e&&(J.lineWidth=e,re=e)}function g(e){ae!==e&&(J.lineCap=e,ae=e)}function f(e){ce!==e&&(J.lineJoin=e,ce=e)}function v(e){oe!==e&&(J.strokeStyle=e,oe=e)}function b(e){se!==e&&(J.fillStyle=e,se=e)}function y(e){le.length!==e.length&&(J.setLineDash(e),le=e)}console.log("THREE.CanvasRenderer",THREE.REVISION);var E=THREE.Math.smoothstep;e=e||{};var _,w,C,S,k,R,T,H,A,x,O,$,M,L,I,D,z,N,q,j,P=this,F=new THREE.Projector,B=void 0!==e.canvas?e.canvas:document.createElement("canvas"),V=B.width,G=B.height,U=Math.floor(V/2),W=Math.floor(G/2),Y=0,X=0,Z=V,K=G,Q=1,J=B.getContext("2d",{alpha:e.alpha===!0}),ee=new THREE.Color(0),ie=e.alpha===!0?0:1,te=1,ne=0,oe=null,se=null,re=null,ae=null,ce=null,le=[],de=(new THREE.RenderableVertex,new THREE.RenderableVertex,new THREE.Color),he=(new THREE.Color,new THREE.Color,new THREE.Color,new THREE.Color,new THREE.Color),ue=new THREE.Color,pe=new THREE.Color,me={},ge=new THREE.Box2,fe=new THREE.Box2,ve=new THREE.Box2,be=new THREE.Color,ye=new THREE.Color,Ee=new THREE.Color,_e=new THREE.Vector3,we=new THREE.Vector3,Ce=new THREE.Vector3,Se=new THREE.Matrix3;void 0===J.setLineDash&&(J.setLineDash=function{}),this.domElement=B,this.autoClear=!0,this.sortObjects=!0,this.sortElements=!0,this.info={render:{vertices:0,faces:0}},this.supportsVertexTextures=function{},this.setFaceCulling=function{},this.getContext=function{return J},this.getContextAttributes=function{return J.getContextAttributes},this.getPixelRatio=function{return Q},this.setPixelRatio=function(e){void 0!==e&&(Q=e)},this.setSize=function(e,i,t){V=e*Q,G=i*Q,B.width=V,B.height=G,U=Math.floor(V/2),W=Math.floor(G/2),t!==!1&&(B.style.width=e+"px",B.style.height=i+"px"),ge.min.set(-U,-W),ge.max.set(U,W),fe.min.set(-U,-W),fe.max.set(U,W),te=1,ne=0,oe=null,se=null,re=null,ae=null,ce=null,this.setViewport(0,0,e,i)},this.setViewport=function(e,i,t,n){Y=e*Q,X=i*Q,Z=t*Q,K=n*Q},this.setScissor=function{},this.enableScissorTest=function{},this.setClearColor=function(e,i){ee.set(e),ie=void 0!==i?i:1,fe.min.set(-U,-W),fe.max.set(U,W)},this.setClearColorHex=function(e,i){console.warn("THREE.CanvasRenderer: .setClearColorHex is being removed. Use .setClearColor instead."),this.setClearColor(e,i)},this.getClearColor=function{return ee},this.getClearAlpha=function{return ie},this.getMaxAnisotropy=function{return 0},this.clear=function{fe.empty===!1&&(fe.intersect(ge),fe.expandByScalar(2),fe.min.x=fe.min.x+U,fe.min.y=-fe.min.y+W,fe.max.x=fe.max.x+U,fe.max.y=-fe.max.y+W,1>ie&&J.clearRect(0|fe.min.x,0|fe.max.y,fe.max.x-fe.min.x|0,fe.min.y-fe.max.y|0),ie>0&&(p(THREE.NormalBlending),u(1),b("rgba("+Math.floor(255*ee.r)+","+Math.floor(255*ee.g)+","+Math.floor(255*ee.b)+","+ie+")"),J.fillRect(0|fe.min.x,0|fe.max.y,fe.max.x-fe.min.x|0,fe.min.y-fe.max.y|0)),fe.makeEmpty)},this.clearColor=function{},this.clearDepth=function{},this.clearStencil=function{},this.render=function(e,t){if(t instanceof THREE.Camera==!1)return void console.error("THREE.CanvasRenderer.render: camera is not an instance of THREE.Camera.");this.autoClear===!0&&this.clear,P.info.render.vertices=0,P.info.render.faces=0,J.setTransform(Z/V,0,0,-K/G,Y,G-X),J.translate(U,W),_=F.projectScene(e,t,this.sortObjects,this.sortElements),w=_.elements,C=_.lights,S=t,Se.getNormalMatrix(t.matrixWorldInverse),i;for(var r=0,a=w.length;a>r;r++){var c=w[r],l=c.material;if(void 0!==l&&0!==l.opacity){if(ve.makeEmpty,c instanceof THREE.RenderableSprite)k=c,k.x*=U,k.y*=W,n(k,c,l);else if(c instanceof THREE.RenderableLine)k=c.v1,R=c.v2,k.positionScreen.x*=U,k.positionScreen.y*=W,R.positionScreen.x*=U,R.positionScreen.y*=W,ve.setFromPoints([k.positionScreen,R.positionScreen]),ge.isIntersectionBox(ve)===!0&&o(k,R,c,l);else if(c instanceof THREE.RenderableFace){if(k=c.v1,R=c.v2,T=c.v3,k.positionScreen.z<-1||k.positionScreen.z>1)continue;if(R.positionScreen.z<-1||R.positionScreen.z>1)continue;if(T.positionScreen.z<-1||T.positionScreen.z>1)continue;k.positionScreen.x*=U,k.positionScreen.y*=W,R.positionScreen.x*=U,R.positionScreen.y*=W,T.positionScreen.x*=U,T.positionScreen.y*=W,l.overdraw>0&&(h(k.positionScreen,R.positionScreen,l.overdraw),h(R.positionScreen,T.positionScreen,l.overdraw),h(T.positionScreen,k.positionScreen,l.overdraw)),ve.setFromPoints([k.positionScreen,R.positionScreen,T.positionScreen]),ge.isIntersectionBox(ve)===!0&&s(k,R,T,0,1,2,c,l)}fe.union(ve)}}J.setTransform(1,0,0,1,0,0)}},THREE.TrackballControls=function(e,i,t){function n(e){u.enabled!==!1&&(window.removeEventListener("keydown",n),g=u._state,u._state===u.STATE.NONE&&(e.keyCode!==u.keys[u.STATE.ROTATE]||u.noRotate?e.keyCode!==u.keys[u.STATE.ZOOM]||u.noZoom?e.keyCode!==u.keys[u.STATE.PAN]||u.noPan||(u._state=u.STATE.PAN):u._state=u.STATE.ZOOM:u._state=u.STATE.ROTATE))}function o(e){u.enabled!==!1&&(u._state=g,window.addEventListener("keydown",n,!1))}function s(e){u.enabled!==!1&&(e.preventDefault,e.stopPropagation,u._state===u.STATE.NONE&&(u._state=e.button),u._state!==u.STATE.ROTATE||u.noRotate?u._state!==u.STATE.ZOOM||u.noZoom?u._state!==u.STATE.PAN||u.noPan||(u._panStart.copy(w(e.pageX,e.pageY)),u._panEnd.copy(u._panStart)):(u._zoomStart.copy(w(e.pageX,e.pageY)),u._zoomEnd.copy(u._zoomStart)):(u._rotateStart.copy(C(e.pageX,e.pageY)),u._rotateEnd.copy(u._rotateStart)),document.addEventListener("mousemove",r,!1),document.addEventListener("mouseup",a,!1),u.dispatchEvent(E))}function r(e){u.enabled!==!1&&(e.preventDefault,e.stopPropagation,u._state!==u.STATE.ROTATE||u.noRotate?u._state!==u.STATE.ZOOM||u.noZoom?u._state!==u.STATE.PAN||u.noPan||u._panEnd.copy(w(e.pageX,e.pageY)):u._zoomEnd.copy(w(e.pageX,e.pageY)):u._rotateEnd.copy(C(e.pageX,e.pageY)))}function a(e){u.enabled!==!1&&(e.preventDefault,e.stopPropagation,u._state=u.STATE.NONE,document.removeEventListener("mousemove",r),document.removeEventListener("mouseup",a),u.dispatchEvent(_))}function c(e){if(u.enabled!==!1){e.preventDefault,e.stopPropagation;var i=0;e.wheelDelta?i=e.wheelDelta/40:e.detail&&(i=-e.detail/3),u._zoomStart.y=.01*i,u.dispatchEvent(E),u.dispatchEvent(_)}}function l(e){if(u.enabled!==!1){switch(e.touches.length){case 1:u._state=u.STATE.TOUCH_ROTATE,u._rotateStart.copy(C(e.touches[0].pageX,e.touches[0].pageY)),u._rotateEnd.copy(u._rotateStart);break;case 2:u._state=u.STATE.TOUCH_ZOOM_PAN;var i=e.touches[0].pageX-e.touches[1].pageX,t=e.touches[0].pageY-e.touches[1].pageY;b=v=Math.sqrt(i*i+t*t);var n=(e.touches[0].pageX+e.touches[1].pageX)/2,o=(e.touches[0].pageY+e.touches[1].pageY)/2;u._panStart.copy(w(n,o)),u._panEnd.copy(u._panStart);break;default:u._state=u.STATE.NONE}u.dispatchEvent(E)}}function d(e){if(u.enabled!==!1)switch(e.preventDefault,e.stopPropagation,e.touches.length){case 1:u._rotateEnd.copy(C(e.touches[0].pageX,e.touches[0].pageY));break;case 2:var i=e.touches[0].pageX-e.touches[1].pageX,t=e.touches[0].pageY-e.touches[1].pageY;b=Math.sqrt(i*i+t*t);var n=(e.touches[0].pageX+e.touches[1].pageX)/2,o=(e.touches[0].pageY+e.touches[1].pageY)/2;u._panEnd.copy(w(n,o));break;default:u._state=u.STATE.NONE}}function h(e){if(u.enabled!==!1){switch(e.touches.length){case 1:u._rotateEnd.copy(C(e.touches[0].pageX,e.touches[0].pageY)),u._rotateStart.copy(u._rotateEnd);break;case 2:v=b=0;var i=(e.touches[0].pageX+e.touches[1].pageX)/2,t=(e.touches[0].pageY+e.touches[1].pageY)/2;u._panEnd.copy(w(i,t)),u._panStart.copy(u._panEnd)}u._state=u.STATE.NONE,u.dispatchEvent(_)}}var u=this;this.STATE={NONE:-1,ROTATE:0,ZOOM:1,PAN:2,TOUCH_ROTATE:3,TOUCH_ZOOM_PAN:4},this.object=e,this.domElement=void 0!==i?i:document,this.enabled=!0,this.screen={left:0,top:0,width:0,height:0},this.rotateSpeed=1,this.zoomSpeed=1.2,this.panSpeed=.3,this.noRotate=!1,this.noZoom=!1,this.noPan=!1,this.noRoll=!1,this.staticMoving=!1,this.dynamicDampingFactor=.2,this.minDistance=0,this.maxDistance=1/0,this.keys=[65,83,68],this.target=new THREE.Vector3;var p=1e-6,m=new THREE.Vector3;this._state=this.STATE.NONE;var g=this.STATE.NONE,f=new THREE.Vector3;this._rotateStart=new THREE.Vector3,this._rotateEnd=new THREE.Vector3,this._zoomStart=new THREE.Vector2,this._zoomEnd=new THREE.Vector2;var v=0,b=0;this._panStart=new THREE.Vector2,this._panEnd=new THREE.Vector2,this.target0=this.target.clone,this.position0=this.object.position.clone,this.up0=this.object.up.clone;var y={type:"change"},E={type:"start"},_={type:"end"};this.handleResize=function{if(this.domElement===document)this.screen.left=0,this.screen.top=0,this.screen.width=window.innerWidth,this.screen.height=window.innerHeight;else{var e=this.domElement.getBoundingClientRect,i=this.domElement.ownerDocument.documentElement;this.screen.left=e.left+window.pageXOffset-i.clientLeft,this.screen.top=e.top+window.pageYOffset-i.clientTop,this.screen.width=e.width,this.screen.height=e.height}},this.handleEvent=function(e){"function"==typeof this[e.type]&&this[e.type](e)};var w=function{var e=new THREE.Vector2;return function(i,t){return e.set((i-u.screen.left)/u.screen.width,(t-u.screen.top)/u.screen.height),e}},C=function{var e=new THREE.Vector3,i=new THREE.Vector3,t=new THREE.Vector3;return function(n,o){t.set((n-.5*u.screen.width-u.screen.left)/(.5*u.screen.width),(.5*u.screen.height+u.screen.top-o)/(.5*u.screen.height),0);var s=t.length;return u.noRoll?s<Math.SQRT1_2?t.z=Math.sqrt(1-s*s):t.z=.5/s:s>1?t.normalize:t.z=Math.sqrt(1-s*s),f.copy(u.object.position).sub(u.target),e.copy(u.object.up).setLength(t.y),e.add(i.copy(u.object.up).cross(f).setLength(t.x)),e.add(f.setLength(t.z)),e}};this.rotateCamera=function(e,i){var n=new THREE.Vector3,o=new THREE.Quaternion;return function(e,i){var s;void 0===e&&(s=Math.acos(u._rotateStart.dot(u._rotateEnd)/u._rotateStart.length/u._rotateEnd.length)),(s||void 0!==e)&&(void 0===e?(n.crossVectors(u._rotateStart,u._rotateEnd).normalize,s*=u.rotateSpeed,o.setFromAxisAngle(n,-s)):o.copy(e),(void 0===i||i===!0)&&t.quaternion.multiplyQuaternions(o,t.quaternion),f.applyQuaternion(o),u.object.up.applyQuaternion(o),u._rotateEnd.applyQuaternion(o),u.staticMoving?u._rotateStart.copy(u._rotateEnd):(o.setFromAxisAngle(n,s*(u.dynamicDampingFactor-1)),u._rotateStart.applyQuaternion(o)))}},this.zoomCamera=function(e,i){if(u._state===u.STATE.TOUCH_ZOOM_PAN){var n;void 0!==e?n=e:(n=v/b,v=b),f.multiplyScalar(n),(void 0===i||i===!0)&&(t._zoomFactor*=n)}else{var n;n=void 0!==e?e:1+(u._zoomEnd.y-u._zoomStart.y)*u.zoomSpeed,(void 0===i||i===!0)&&(t._zoomFactor*=n),1!==n&&(f.multiplyScalar(n),u.staticMoving?u._zoomStart.copy(u._zoomEnd):u._zoomStart.y+=(u._zoomEnd.y-u._zoomStart.y)*this.dynamicDampingFactor)}},this.panCamera=function(e,i){var n=new THREE.Vector2,o=new THREE.Vector3,s=new THREE.Vector3;return function(e,i){void 0!==e?(n=e,(void 0===i||i===!0)&&t.mouseChange.add(e)):(n.copy(u._panEnd).sub(u._panStart),(void 0===i||i===!0)&&t.mouseChange.add(u._panEnd).sub(u._panStart)),n.lengthSq&&(n.multiplyScalar(f.length*u.panSpeed),s.copy(f).cross(u.object.up).setLength(n.x),s.add(o.copy(u.object.up).setLength(n.y)),u.object.position.add(s),u.target.add(s),u.staticMoving?u._panStart.copy(u._panEnd):u._panStart.add(n.subVectors(u._panEnd,u._panStart).multiplyScalar(u.dynamicDampingFactor)))}},this.checkDistances=function{u.noZoom&&u.noPan||(f.lengthSq>u.maxDistance*u.maxDistance&&u.object.position.addVectors(u.target,f.setLength(u.maxDistance)),f.lengthSq<u.minDistance*u.minDistance&&u.object.position.addVectors(u.target,f.setLength(u.minDistance)))},this.update=function(e){f.subVectors(u.object.position,u.target),u.noRotate||(void 0!==e&&void 0!==e.quaternion?u.rotateCamera(e.quaternion,e.update):u.rotateCamera),u.noZoom||(void 0!==e&&void 0!==e._zoomFactor?u.zoomCamera(e._zoomFactor,e.update):u.zoomCamera),u.noPan||(void 0!==e&&void 0!==e.mouseChange?u.panCamera(e.mouseChange,e.update):u.panCamera),u.object.position.addVectors(u.target,f),u.checkDistances,u.object.lookAt(u.target),m.distanceToSquared(u.object.position)>p&&(u.dispatchEvent(y),m.copy(u.object.position))},this.reset=function{u._state=u.STATE.NONE,g=u.STATE.NONE,u.target.copy(u.target0),u.object.position.copy(u.position0),u.object.up.copy(u.up0),f.subVectors(u.object.position,u.target),u.object.lookAt(u.target),u.dispatchEvent(y),m.copy(u.object.position)},this.domElement.addEventListener("contextmenu",function(e){e.preventDefault},!1),this.domElement.addEventListener("mousedown",s,!1),this.domElement.addEventListener("mousewheel",c,!1),this.domElement.addEventListener("DOMMouseScroll",c,!1),this.domElement.addEventListener("touchstart",l,!1),this.domElement.addEventListener("touchend",h,!1),this.domElement.addEventListener("touchmove",d,!1),window.addEventListener("keydown",n,!1),window.addEventListener("keyup",o,!1),this.handleResize,this.update},THREE.TrackballControls.prototype=Object.create(THREE.EventDispatcher.prototype),THREE.TrackballControls.prototype.constructor=THREE.TrackballControls,THREE.OrthographicTrackballControls=function(e,i,t){function n(e){u.enabled!==!1&&(window.removeEventListener("keydown",n),v=u._state,u._state===p.NONE&&(e.keyCode!==u.keys[p.ROTATE]||u.noRotate?e.keyCode!==u.keys[p.ZOOM]||u.noZoom?e.keyCode!==u.keys[p.PAN]||u.noPan||(u._state=p.PAN):u._state=p.ZOOM:u._state=p.ROTATE))}function o(e){u.enabled!==!1&&(u._state=v,window.addEventListener("keydown",n,!1))}function s(e){u.enabled!==!1&&(e.preventDefault,e.stopPropagation,u._state===p.NONE&&(u._state=e.button),u._state!==p.ROTATE||u.noRotate?u._state!==p.ZOOM||u.noZoom?u._state!==p.PAN||u.noPan||(u._panStart.copy(k(e.pageX,e.pageY)),u._panEnd.copy(u._panStart)):(u._zoomStart.copy(k(e.pageX,e.pageY)),u._zoomEnd.copy(u._zoomStart)):(u._rotateStart.copy(R(e.pageX,e.pageY)),u._rotateEnd.copy(u._rotateStart)),document.addEventListener("mousemove",r,!1),document.addEventListener("mouseup",a,!1),u.dispatchEvent(C))}function r(e){u.enabled!==!1&&(e.preventDefault,e.stopPropagation,u._state!==p.ROTATE||u.noRotate?u._state!==p.ZOOM||u.noZoom?u._state!==p.PAN||u.noPan||u._panEnd.copy(k(e.pageX,e.pageY)):u._zoomEnd.copy(k(e.pageX,e.pageY)):u._rotateEnd.copy(R(e.pageX,e.pageY)))}function a(e){u.enabled!==!1&&(e.preventDefault,e.stopPropagation,u._state=p.NONE,document.removeEventListener("mousemove",r),document.removeEventListener("mouseup",a),u.dispatchEvent(S))}function c(e){if(u.enabled!==!1){e.preventDefault,e.stopPropagation;var i=0;e.wheelDelta?i=e.wheelDelta/40:e.detail&&(i=-e.detail/3),u._zoomStart.y=.01*i,u.dispatchEvent(C),u.dispatchEvent(S)}}function l(e){if(u.enabled!==!1){switch(e.touches.length){case 1:u._state=p.TOUCH_ROTATE,u._rotateStart.copy(R(e.touches[0].pageX,e.touches[0].pageY)),u._rotateEnd.copy(u._rotateStart);break;case 2:u._state=p.TOUCH_ZOOM_PAN;var i=e.touches[0].pageX-e.touches[1].pageX,t=e.touches[0].pageY-e.touches[1].pageY;_=E=Math.sqrt(i*i+t*t);var n=(e.touches[0].pageX+e.touches[1].pageX)/2,o=(e.touches[0].pageY+e.touches[1].pageY)/2;u._panStart.copy(k(n,o)),u._panEnd.copy(u._panStart);break;default:u._state=p.NONE}u.dispatchEvent(C)}}function d(e){if(u.enabled!==!1)switch(e.preventDefault,e.stopPropagation,e.touches.length){case 1:u._rotateEnd.copy(R(e.touches[0].pageX,e.touches[0].pageY));break;case 2:var i=e.touches[0].pageX-e.touches[1].pageX,t=e.touches[0].pageY-e.touches[1].pageY;_=Math.sqrt(i*i+t*t);var n=(e.touches[0].pageX+e.touches[1].pageX)/2,o=(e.touches[0].pageY+e.touches[1].pageY)/2;u._panEnd.copy(k(n,o));break;default:u._state=p.NONE}}function h(e){if(u.enabled!==!1){switch(e.touches.length){case 1:u._rotateEnd.copy(R(e.touches[0].pageX,e.touches[0].pageY)),u._rotateStart.copy(u._rotateEnd);break;case 2:E=_=0;var i=(e.touches[0].pageX+e.touches[1].pageX)/2,t=(e.touches[0].pageY+e.touches[1].pageY)/2;u._panEnd.copy(k(i,t)),u._panStart.copy(u._panEnd)}u._state=p.NONE,u.dispatchEvent(S)}}var u=this,p={NONE:-1,ROTATE:0,ZOOM:1,PAN:2,TOUCH_ROTATE:3,TOUCH_ZOOM_PAN:4};this.object=e,this.domElement=void 0!==i?i:document,this.enabled=!0,this.screen={left:0,top:0,width:0,height:0},this.rotateSpeed=.5,this.zoomSpeed=1.2;var m=.01;this.zoomSpeed*=m,this.panSpeed=.03,this.noRotate=!1,this.noZoom=!1,this.noPan=!1,this.noRoll=!1,this.staticMoving=!1,this.dynamicDampingFactor=.2,this.keys=[65,83,68],this.target=new THREE.Vector3;var g=1e-6,f=new THREE.Vector3;this._state=p.NONE;var v=p.NONE,b=new THREE.Vector3;this._rotateStart=new THREE.Vector3,this._rotateEnd=new THREE.Vector3,this._zoomStart=new THREE.Vector2,this._zoomEnd=new THREE.Vector2;var y=1,E=0,_=0;this._panStart=new THREE.Vector2,this._panEnd=new THREE.Vector2,this.target0=this.target.clone,this.position0=this.object.position.clone,this.up0=this.object.up.clone,this.left0=this.object.left,this.right0=this.object.right,this.top0=this.object.top,this.bottom0=this.object.bottom,this.center0=new THREE.Vector2((this.left0+this.right0)/2,(this.top0+this.bottom0)/2);var w={type:"change"},C={type:"start"},S={type:"end"};this.handleResize=function{if(this.domElement===document)this.screen.left=0,this.screen.top=0,this.screen.width=window.innerWidth,this.screen.height=window.innerHeight;else{var e=this.domElement.getBoundingClientRect,i=this.domElement.ownerDocument.documentElement;this.screen.left=e.left+window.pageXOffset-i.clientLeft,this.screen.top=e.top+window.pageYOffset-i.clientTop,this.screen.width=e.width,this.screen.height=e.height}this.left0=this.object.left,this.right0=this.object.right,this.top0=this.object.top,this.bottom0=this.object.bottom,this.center0.set((this.left0+this.right0)/2,(this.top0+this.bottom0)/2)},this.handleEvent=function(e){"function"==typeof this[e.type]&&this[e.type](e)};var k=function{var e=new THREE.Vector2;return function(i,t){return e.set((i-u.screen.left)/u.screen.width,(t-u.screen.top)/u.screen.height),e}},R=function{var e=new THREE.Vector3,i=new THREE.Vector3,t=new THREE.Vector3;return function(n,o){t.set((n-.5*u.screen.width-u.screen.left)/(.5*u.screen.width),(.5*u.screen.height+u.screen.top-o)/(.5*u.screen.height),0);var s=t.length;return u.noRoll?s<Math.SQRT1_2?t.z=Math.sqrt(1-s*s):t.z=.5/s:s>1?t.normalize:t.z=Math.sqrt(1-s*s),b.copy(u.object.position).sub(u.target),e.copy(u.object.up).setLength(t.y),e.add(i.copy(u.object.up).cross(b).setLength(t.x)),e.add(b.setLength(t.z)),e}};this.rotateCamera=function(e,i){var n=new THREE.Vector3,o=new THREE.Quaternion;return function(e,i){var s;void 0===e&&(s=Math.acos(u._rotateStart.dot(u._rotateEnd)/u._rotateStart.length/u._rotateEnd.length)),(s||void 0!==e)&&(void 0===e?(n.crossVectors(u._rotateStart,u._rotateEnd).normalize,s*=u.rotateSpeed,o.setFromAxisAngle(n,-s)):o.copy(e),(void 0===i||i===!0)&&t.quaternion.multiplyQuaternions(o,t.quaternion),b.applyQuaternion(o),u.object.up.applyQuaternion(o),u._rotateEnd.applyQuaternion(o),u.staticMoving?u._rotateStart.copy(u._rotateEnd):(o.setFromAxisAngle(n,s*(u.dynamicDampingFactor-1)),u._rotateStart.applyQuaternion(o)))}},this.zoomCamera=function(e,i){var n;u._state===p.TOUCH_ZOOM_PAN?void 0!==e?n=e:(n=E/_,E=_):n=void 0!==e?e:1+(u._zoomEnd.y-u._zoomStart.y)*u.zoomSpeed/m,(void 0===i||i===!0)&&(t._zoomFactor*=n),1!==n&&(y=n,u.object.left=y*u.left0+(1-y)*u.center0.x,u.object.right=y*u.right0+(1-y)*u.center0.x,u.object.top=y*u.top0+(1-y)*u.center0.y,u.object.bottom=y*u.bottom0+(1-y)*u.center0.y,u.staticMoving?u._zoomStart.copy(u._zoomEnd):u._zoomStart.y+=(u._zoomEnd.y-u._zoomStart.y)*this.dynamicDampingFactor)},this.panCamera=function(e,i){var n=new THREE.Vector2,o=new THREE.Vector3,s=new THREE.Vector3;return function(e,i){void 0!==e?(n=e,(void 0===i||i===!0)&&t.mouseChange.add(e)):(n.copy(u._panEnd).sub(u._panStart),(void 0===i||i===!0)&&t.mouseChange.add(u._panEnd).sub(u._panStart)),n.lengthSq&&(n.multiplyScalar(b.length*u.panSpeed),s.copy(b).cross(u.object.up).setLength(n.x),s.add(o.copy(u.object.up).setLength(n.y)),u.object.position.add(s),u.target.add(s),u.staticMoving?u._panStart.copy(u._panEnd):u._panStart.add(n.subVectors(u._panEnd,u._panStart).multiplyScalar(u.dynamicDampingFactor)))}},this.update=function(e){b.subVectors(u.object.position,u.target),u.noRotate||(void 0!==e&&void 0!==e.quaternion?u.rotateCamera(e.quaternion,e.update):u.rotateCamera),u.noZoom||(void 0!==e&&void 0!==e._zoomFactor?u.zoomCamera(e._zoomFactor,e.update):u.zoomCamera,u.object.updateProjectionMatrix),u.noPan||(void 0!==e&&void 0!==e.mouseChange?u.panCamera(e.mouseChange,e.update):u.panCamera),u.object.position.addVectors(u.target,b),u.object.lookAt(u.target),f.distanceToSquared(u.object.position)>g&&(u.dispatchEvent(w),f.copy(u.object.position))},this.reset=function{u._state=p.NONE,v=p.NONE,u.target.copy(u.target0),u.object.position.copy(u.position0),u.object.up.copy(u.up0),b.subVectors(u.object.position,u.target),u.object.left=u.left0,u.object.right=u.right0,u.object.top=u.top0,u.object.bottom=u.bottom0,u.object.lookAt(u.target),u.dispatchEvent(w),f.copy(u.object.position)},this.domElement.addEventListener("contextmenu",function(e){e.preventDefault},!1),this.domElement.addEventListener("mousedown",s,!1),this.domElement.addEventListener("mousewheel",c,!1),this.domElement.addEventListener("DOMMouseScroll",c,!1),this.domElement.addEventListener("touchstart",l,!1),this.domElement.addEventListener("touchend",h,!1),this.domElement.addEventListener("touchmove",d,!1),window.addEventListener("keydown",n,!1),window.addEventListener("keyup",o,!1),this.handleResize,this.update},THREE.OrthographicTrackballControls.prototype=Object.create(THREE.EventDispatcher.prototype),THREE.OrthographicTrackballControls.prototype.constructor=THREE.OrthographicTrackballControls,THREE.RenderableObject=function{this.id=0,this.object=null,this.z=0},THREE.RenderableFace=function{this.id=0,this.v1=new THREE.RenderableVertex,this.v2=new THREE.RenderableVertex,this.v3=new THREE.RenderableVertex,this.normalModel=new THREE.Vector3,this.vertexNormalsModel=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3],this.vertexNormalsLength=0,this.color=new THREE.Color,this.material=null,this.uvs=[new THREE.Vector2,new THREE.Vector2,new THREE.Vector2],this.z=0},THREE.RenderableVertex=function{this.position=new THREE.Vector3,this.positionWorld=new THREE.Vector3,this.positionScreen=new THREE.Vector4,this.visible=!0},THREE.RenderableVertex.prototype.copy=function(e){this.positionWorld.copy(e.positionWorld),this.positionScreen.copy(e.positionScreen)},THREE.RenderableLine=function{this.id=0,this.v1=new THREE.RenderableVertex,this.v2=new THREE.RenderableVertex,this.vertexColors=[new THREE.Color,new THREE.Color],this.material=null,this.z=0},THREE.RenderableSprite=function{this.id=0,this.object=null,this.x=0,this.y=0,this.z=0,this.rotation=0,this.scale=new THREE.Vector2,this.material=null},THREE.Projector=function{function e{if(c===y){var e=new THREE.RenderableObject;return b.push(e),y++,c++,e}return b[c++]}function i{if(d===_){var e=new THREE.RenderableVertex;return E.push(e),_++,d++,e}return E[d++]}function t{if(u===C){var e=new THREE.RenderableFace;return w.push(e),C++,u++,e}return w[u++]}function n{if(m===k){var e=new THREE.RenderableLine;return S.push(e),k++,m++,e}return S[m++]}function o{if(f===T){var e=new THREE.RenderableSprite;return R.push(e),T++,f++,e}return R[f++]}function s(e,i){return e.z!==i.z?i.z-e.z:e.id!==i.id?e.id-i.id:0}function r(e,i){var t=0,n=1,o=e.z+e.w,s=i.z+i.w,r=-e.z+e.w,a=-i.z+i.w;return o>=0&&s>=0&&r>=0&&a>=0?!0:0>o&&0>s||0>r&&0>a?!1:(0>o?t=Math.max(t,o/(o-s)):0>s&&(n=Math.min(n,o/(o-s))),0>r?t=Math.max(t,r/(r-a)):0>a&&(n=Math.min(n,r/(r-a))),t>n?!1:(e.lerp(i,t),i.lerp(e,1-n),!0))}var a,c,l,d,h,u,p,m,g,f,v,b=[],y=0,E=[],_=0,w=[],C=0,S=[],k=0,R=[],T=0,H={objects:[],lights:[],elements:[]},A=new THREE.Vector3,x=new THREE.Vector3,O=new THREE.Vector3,$=new THREE.Vector3,M=new THREE.Vector4,L=new THREE.Box3(new THREE.Vector3(-1,-1,-1),new THREE.Vector3(1,1,1)),I=new THREE.Box3,D=new Array(3),z=(new Array(4),new THREE.Matrix4),N=new THREE.Matrix4,q=new THREE.Matrix4,j=new THREE.Matrix3,P=new THREE.Frustum,F=new THREE.Vector4,B=new THREE.Vector4; this.projectVector=function(e,i){console.warn("THREE.Projector: .projectVector is now vector.project."),e.project(i)},this.unprojectVector=function(e,i){console.warn("THREE.Projector: .unprojectVector is now vector.unproject."),e.unproject(i)},this.pickingRay=function(e,i){console.error("THREE.Projector: .pickingRay is now raycaster.setFromCamera.")};var V=function{var e=[],o=[],s=null,r=null,a=new THREE.Matrix3,c=function(i){s=i,r=s.material,a.getNormalMatrix(s.matrixWorld),e.length=0,o.length=0},d=function(e){var i=e.position,t=e.positionWorld,n=e.positionScreen;t.copy(i).applyMatrix4(v),n.copy(t).applyMatrix4(N);var o=1/n.w;n.x*=o,n.y*=o,n.z*=o,e.visible=n.x>=-1&&n.x<=1&&n.y>=-1&&n.y<=1&&n.z>=-1&&n.z<=1},u=function(e,t,n){l=i,l.position.set(e,t,n),d(l)},m=function(i,t,n){e.push(i,t,n)},g=function(e,i){o.push(e,i)},f=function(e,i,t){return e.visible===!0||i.visible===!0||t.visible===!0?!0:(D[0]=e.positionScreen,D[1]=i.positionScreen,D[2]=t.positionScreen,L.isIntersectionBox(I.setFromPoints(D)))},b=function(e,i,t){return(t.positionScreen.x-e.positionScreen.x)*(i.positionScreen.y-e.positionScreen.y)-(t.positionScreen.y-e.positionScreen.y)*(i.positionScreen.x-e.positionScreen.x)<0},y=function(e,i){var t=E[e],o=E[i];p=n,p.id=s.id,p.v1.copy(t),p.v2.copy(o),p.z=(t.positionScreen.z+o.positionScreen.z)/2,p.material=s.material,H.elements.push(p)},_=function(i,n,c){var l=E[i],d=E[n],u=E[c];if(f(l,d,u)!==!1&&(r.side===THREE.DoubleSide||b(l,d,u)===!0)){h=t,h.id=s.id,h.v1.copy(l),h.v2.copy(d),h.v3.copy(u),h.z=(l.positionScreen.z+d.positionScreen.z+u.positionScreen.z)/3;for(var p=0;3>p;p++){var m=3*arguments[p],g=h.vertexNormalsModel[p];g.set(e[m],e[m+1],e[m+2]),g.applyMatrix3(a).normalize;var v=2*arguments[p],y=h.uvs[p];y.set(o[v],o[v+1])}h.vertexNormalsLength=3,h.material=s.material,H.elements.push(h)}};return{setObject:c,projectVertex:d,checkTriangleVisibility:f,checkBackfaceCulling:b,pushVertex:u,pushNormal:m,pushUv:g,pushLine:y,pushTriangle:_}},G=new V;this.projectScene=function(l,b,y,_){u=0,m=0,f=0,H.elements.length=0,l.autoUpdate===!0&&l.updateMatrixWorld,void 0===b.parent&&b.updateMatrixWorld,z.copy(b.matrixWorldInverse.getInverse(b.matrixWorld)),N.multiplyMatrices(b.projectionMatrix,z),P.setFromMatrix(N),c=0,H.objects.length=0,H.lights.length=0,l.traverseVisible(function(i){if(i instanceof THREE.Light)H.lights.push(i);else if(i instanceof THREE.Mesh||i instanceof THREE.Line||i instanceof THREE.Sprite){if(i.material.visible===!1)return;(i.frustumCulled===!1||P.intersectsObject(i)===!0)&&(a=e,a.id=i.id,a.object=i,$.setFromMatrixPosition(i.matrixWorld),$.applyProjection(N),a.z=$.z,H.objects.push(a))}}),y===!0&&H.objects.sort(s);for(var w=0,C=H.objects.length;C>w;w++){var S=H.objects[w].object,k=S.geometry;if(G.setObject(S),v=S.matrixWorld,d=0,S instanceof THREE.Mesh){if(k instanceof THREE.BufferGeometry){var R=k.attributes,T=k.offsets;if(void 0===R.position)continue;for(var L=R.position.array,I=0,D=L.length;D>I;I+=3)G.pushVertex(L[I],L[I+1],L[I+2]);if(void 0!==R.normal)for(var V=R.normal.array,I=0,D=V.length;D>I;I+=3)G.pushNormal(V[I],V[I+1],V[I+2]);if(void 0!==R.uv)for(var U=R.uv.array,I=0,D=U.length;D>I;I+=2)G.pushUv(U[I],U[I+1]);if(void 0!==R.index){var W=R.index.array;if(T.length>0)for(var w=0;w<T.length;w++)for(var Y=T[w],X=Y.index,I=Y.start,D=Y.start+Y.count;D>I;I+=3)G.pushTriangle(W[I]+X,W[I+1]+X,W[I+2]+X);else for(var I=0,D=W.length;D>I;I+=3)G.pushTriangle(W[I],W[I+1],W[I+2])}else for(var I=0,D=L.length/3;D>I;I+=3)G.pushTriangle(I,I+1,I+2)}else if(k instanceof THREE.Geometry){var Z=k.vertices,K=k.faces,Q=k.faceVertexUvs[0];j.getNormalMatrix(v);for(var J=S.material instanceof THREE.MeshFaceMaterial,ee=J===!0?S.material:null,ie=0,te=Z.length;te>ie;ie++){var ne=Z[ie];G.pushVertex(ne.x,ne.y,ne.z)}for(var oe=0,se=K.length;se>oe;oe++){var re=K[oe],ae=J===!0?ee.materials[re.materialIndex]:S.material;if(void 0!==ae){var ce=ae.side,le=E[re.a],de=E[re.b],he=E[re.c];if(ae.morphTargets===!0){var ue=k.morphTargets,pe=S.morphTargetInfluences,me=le.position,ge=de.position,fe=he.position;A.set(0,0,0),x.set(0,0,0),O.set(0,0,0);for(var ve=0,be=ue.length;be>ve;ve++){var ye=pe[ve];if(0!==ye){var Ee=ue[ve].vertices;A.x+=(Ee[re.a].x-me.x)*ye,A.y+=(Ee[re.a].y-me.y)*ye,A.z+=(Ee[re.a].z-me.z)*ye,x.x+=(Ee[re.b].x-ge.x)*ye,x.y+=(Ee[re.b].y-ge.y)*ye,x.z+=(Ee[re.b].z-ge.z)*ye,O.x+=(Ee[re.c].x-fe.x)*ye,O.y+=(Ee[re.c].y-fe.y)*ye,O.z+=(Ee[re.c].z-fe.z)*ye}}le.position.add(A),de.position.add(x),he.position.add(O),G.projectVertex(le),G.projectVertex(de),G.projectVertex(he)}if(G.checkTriangleVisibility(le,de,he)!==!1){var _e=G.checkBackfaceCulling(le,de,he);if(ce!==THREE.DoubleSide){if(ce===THREE.FrontSide&&_e===!1)continue;if(ce===THREE.BackSide&&_e===!0)continue}h=t,h.id=S.id,h.v1.copy(le),h.v2.copy(de),h.v3.copy(he),h.normalModel.copy(re.normal),_e!==!1||ce!==THREE.BackSide&&ce!==THREE.DoubleSide||h.normalModel.negate,h.normalModel.applyMatrix3(j).normalize;for(var we=re.vertexNormals,Ce=0,Se=Math.min(we.length,3);Se>Ce;Ce++){var ke=h.vertexNormalsModel[Ce];ke.copy(we[Ce]),_e!==!1||ce!==THREE.BackSide&&ce!==THREE.DoubleSide||ke.negate,ke.applyMatrix3(j).normalize}h.vertexNormalsLength=we.length;var Re=Q[oe];if(void 0!==Re)for(var Te=0;3>Te;Te++)h.uvs[Te].copy(Re[Te]);h.color=re.color,h.material=ae,h.z=(le.positionScreen.z+de.positionScreen.z+he.positionScreen.z)/3,H.elements.push(h)}}}}}else if(S instanceof THREE.Line){if(k instanceof THREE.BufferGeometry){var R=k.attributes;if(void 0!==R.position){for(var L=R.position.array,I=0,D=L.length;D>I;I+=3)G.pushVertex(L[I],L[I+1],L[I+2]);if(void 0!==R.index)for(var W=R.index.array,I=0,D=W.length;D>I;I+=2)G.pushLine(W[I],W[I+1]);else for(var He=S.mode===THREE.LinePieces?2:1,I=0,D=L.length/3-1;D>I;I+=He)G.pushLine(I,I+1)}}else if(k instanceof THREE.Geometry){q.multiplyMatrices(N,v);var Z=S.geometry.vertices;if(0===Z.length)continue;le=i,le.positionScreen.copy(Z[0]).applyMatrix4(q);for(var He=S.mode===THREE.LinePieces?2:1,ie=1,te=Z.length;te>ie;ie++)le=i,le.positionScreen.copy(Z[ie]).applyMatrix4(q),(ie+1)%He>0||(de=E[d-2],F.copy(le.positionScreen),B.copy(de.positionScreen),r(F,B)===!0&&(F.multiplyScalar(1/F.w),B.multiplyScalar(1/B.w),p=n,p.id=S.id,p.v1.positionScreen.copy(F),p.v2.positionScreen.copy(B),p.z=Math.max(F.z,B.z),p.material=S.material,S.material.vertexColors===THREE.VertexColors&&(p.vertexColors[0].copy(S.geometry.colors[ie]),p.vertexColors[1].copy(S.geometry.colors[ie-1])),H.elements.push(p)))}}else if(S instanceof THREE.Sprite){M.set(v.elements[12],v.elements[13],v.elements[14],1),M.applyMatrix4(N);var Ae=1/M.w;M.z*=Ae,M.z>=-1&&M.z<=1&&(g=o,g.id=S.id,g.x=M.x*Ae,g.y=M.y*Ae,g.z=M.z,g.object=S,g.rotation=S.rotation,g.scale.x=S.scale.x*Math.abs(g.x-(M.x+b.projectionMatrix.elements[0])/(M.w+b.projectionMatrix.elements[12])),g.scale.y=S.scale.y*Math.abs(g.y-(M.y+b.projectionMatrix.elements[5])/(M.w+b.projectionMatrix.elements[13])),g.material=S.material,H.elements.push(g))}}return _===!0&&H.elements.sort(s),H}},$3Dmol={},$3Dmol.MarchingCubeInitializer=function{var e=2,i={};i.march=function(i,r,a,c){var l=!!c.fulltable,d=c.hasOwnProperty("origin")&&c.origin.hasOwnProperty("x")?c.origin:{x:0,y:0,z:0},h=!!c.voxel,u=c.nX||0,p=c.nY||0,m=c.nZ||0,g=c.scale||1,f=null;f=c.unitCube?c.unitCube:{x:g,y:g,z:g};var v,b,y=new Int32Array(u*p*m);for(v=0,b=y.length;b>v;++v)y[v]=-1;var E=function(e,i,t,n,o,s){var a={x:d.x,y:d.y,z:d.z},c=!!(n&1<<o),l=!!(n&1<<s),u=o;!c&&l&&(u=s),1&u&&t++,2&u&&i++,4&u&&e++,a.x+=f.x*e,a.y+=f.y*i,a.z+=f.z*t;var g=(p*e+i)*m+t;return h?(r.push(a),r.length-1):(y[g]<0&&(y[g]=r.length,r.push(a)),y[g])},_=new Int32Array(12),w=l?o:t,C=l?s:n;for(v=0;u-1>v;++v)for(var S=0;p-1>S;++S)for(var k=0;m-1>k;++k){for(var R=0,T=0;8>T;++T){var H=(p*(v+((4&T)>>2))+S+((2&T)>>1))*m+k+(1&T),A=!!(i[H]&e);R|=A<<T}if(0!==R&&255!==R){var x=w[R];if(0!==x){var O=C[R];1&x&&(_[0]=E(v,S,k,R,0,1)),2&x&&(_[1]=E(v,S,k,R,1,3)),4&x&&(_[2]=E(v,S,k,R,3,2)),8&x&&(_[3]=E(v,S,k,R,2,0)),16&x&&(_[4]=E(v,S,k,R,4,5)),32&x&&(_[5]=E(v,S,k,R,5,7)),64&x&&(_[6]=E(v,S,k,R,7,6)),128&x&&(_[7]=E(v,S,k,R,6,4)),256&x&&(_[8]=E(v,S,k,R,0,4)),512&x&&(_[9]=E(v,S,k,R,1,5)),1024&x&&(_[10]=E(v,S,k,R,3,7)),2048&x&&(_[11]=E(v,S,k,R,2,6));for(var $=0;$<O.length;$+=3){var M=_[O[$]],L=_[O[$+1]],I=_[O[$+2]];h&&$>=3&&(r.push(r[M]),M=r.length-1,r.push(r[L]),L=r.length-1,r.push(r[I]),I=r.length-1),a.push(M),a.push(L),a.push(I)}}}}y=null},i.laplacianSmooth=function(e,i,t){var n,o,s,r,a,c=new Array(i.length);for(n=0,o=i.length;o>n;n++)c[n]={x:0,y:0,z:0};var l,d=new Array(20);for(n=0;20>n;n++)d[n]=new Array(i.length);for(n=0,o=i.length;o>n;n++)d[0][n]=0;for(n=0,o=t.length/3;o>n;n++){var h=3*n,u=3*n+1,p=3*n+2;for(l=!0,s=0,r=d[0][t[h]];r>s;s++)if(t[u]==d[s+1][t[h]]){l=!1;break}for(l&&(d[0][t[h]]++,d[d[0][t[h]]][t[h]]=t[u]),l=!0,s=0,r=d[0][t[h]];r>s;s++)if(t[p]==d[s+1][t[h]]){l=!1;break}for(l&&(d[0][t[h]]++,d[d[0][t[h]]][t[h]]=t[p]),l=!0,s=0,r=d[0][t[u]];r>s;s++)if(t[h]==d[s+1][t[u]]){l=!1;break}for(l&&(d[0][t[u]]++,d[d[0][t[u]]][t[u]]=t[h]),l=!0,s=0,r=d[0][t[u]];r>s;s++)if(t[p]==d[s+1][t[u]]){l=!1;break}for(l&&(d[0][t[u]]++,d[d[0][t[u]]][t[u]]=t[p]),l=!0,s=0;s<d[0][t[p]];s++)if(t[h]==d[s+1][t[p]]){l=!1;break}for(l&&(d[0][t[p]]++,d[d[0][t[p]]][t[p]]=t[h]),l=!0,s=0,r=d[0][t[p]];r>s;s++)if(t[u]==d[s+1][t[p]]){l=!1;break}l&&(d[0][t[p]]++,d[d[0][t[p]]][t[p]]=t[u])}var m=1,g=.5;for(a=0;e>a;a++){for(n=0,o=i.length;o>n;n++)if(d[0][n]<3)c[n].x=i[n].x,c[n].y=i[n].y,c[n].z=i[n].z;else if(3==d[0][n]||4==d[0][n]){for(c[n].x=0,c[n].y=0,c[n].z=0,s=0,r=d[0][n];r>s;s++)c[n].x+=i[d[s+1][n]].x,c[n].y+=i[d[s+1][n]].y,c[n].z+=i[d[s+1][n]].z;c[n].x+=g*i[n].x,c[n].y+=g*i[n].y,c[n].z+=g*i[n].z,c[n].x/=g+d[0][n],c[n].y/=g+d[0][n],c[n].z/=g+d[0][n]}else{for(c[n].x=0,c[n].y=0,c[n].z=0,s=0,r=d[0][n];r>s;s++)c[n].x+=i[d[s+1][n]].x,c[n].y+=i[d[s+1][n]].y,c[n].z+=i[d[s+1][n]].z;c[n].x+=m*i[n].x,c[n].y+=m*i[n].y,c[n].z+=m*i[n].z,c[n].x/=m+d[0][n],c[n].y/=m+d[0][n],c[n].z/=m+d[0][n]}for(n=0,o=i.length;o>n;n++)i[n].x=c[n].x,i[n].y=c[n].y,i[n].z=c[n].z}d=null,c=null},i.edgeTable=[0,0,0,0,0,0,0,2816,0,0,0,1792,0,3328,3584,3840,0,0,0,138,0,21,0,134,0,0,0,652,0,2067,3865,3600,0,0,0,42,0,0,0,294,0,0,21,28,0,3875,1049,3360,0,168,162,170,0,645,2475,2210,0,687,293,172,4010,3747,3497,3232,0,0,0,0,0,69,0,900,0,0,0,1792,138,131,1608,1920,0,81,0,2074,84,85,84,86,0,81,0,3676,330,1105,1881,1616,0,0,0,42,0,69,0,502,0,0,21,3580,138,2035,1273,1520,2816,104,2337,106,840,581,367,102,2816,3695,3429,3180,1898,1635,1385,1120,0,0,0,0,0,0,0,3910,0,0,69,588,42,2083,41,2880,0,0,0,1722,0,2293,4095,3830,0,255,757,764,2538,2291,3065,2800,0,0,81,338,0,3925,1119,3414,84,855,85,340,2130,2899,89,2384,1792,712,194,1162,4036,3781,3535,3270,708,719,197,204,3018,2755,2505,2240,0,0,0,0,168,420,168,1958,162,162,676,2988,170,163,680,928,3328,3096,3328,3642,52,53,1855,1590,2340,2111,2869,2620,298,51,825,560,3584,3584,3090,3482,1668,1941,1183,1430,146,2975,2069,2460,154,915,153,400,3840,3592,3329,3082,1796,1541,1295,1030,2818,2575,2309,2060,778,515,265,0];var t=new Uint32Array(i.edgeTable),n=i.triTable=[[],[],[],[],[],[],[],[11,9,8],[],[],[],[8,10,9],[],[10,8,11],[9,11,10],[8,10,9,8,11,10],[],[],[],[1,7,3],[],[4,2,0],[],[2,1,7],[],[],[],[2,7,3,2,9,7],[],[1,4,11,1,0,4],[3,8,0,11,9,4,11,10,9],[4,11,9,11,10,9],[],[],[],[5,3,1],[],[],[],[2,5,8,2,1,5],[],[],[2,4,0],[3,2,4],[],[0,9,1,8,10,5,8,11,10],[3,4,0,3,10,4],[5,8,10,8,11,10],[],[3,5,7],[7,1,5],[1,7,3,1,5,7],[],[9,2,0,9,7,2],[0,3,8,1,7,11,1,5,7],[11,1,7,1,5,7],[],[9,1,0,5,3,2,5,7,3],[8,2,5,8,0,2],[2,5,3,5,7,3],[3,9,1,3,8,9,7,11,10,7,10,5],[9,1,0,10,7,11,10,5,7],[3,8,0,7,10,5,7,11,10],[11,5,7,11,10,5],[],[],[],[],[],[0,6,2],[],[7,2,9,7,9,8],[],[],[],[8,10,9],[7,1,3],[7,1,0],[6,9,3,6,10,9],[7,10,8,10,9,8],[],[6,0,4],[],[11,1,4,11,3,1],[2,4,6],[2,0,4,2,4,6],[2,4,6],[1,4,2,4,6,2],[],[6,0,4],[],[2,11,3,6,9,4,6,10,9],[8,6,1,8,1,3],[10,0,6,0,4,6],[8,0,3,9,6,10,9,4,6],[10,4,6,10,9,4],[],[],[],[5,3,1],[],[0,6,2],[],[7,4,8,5,2,1,5,6,2],[],[],[2,4,0],[7,4,8,2,11,3,10,5,6],[7,1,3],[5,6,10,0,9,1,8,7,4],[5,6,10,7,0,3,7,4,0],[10,5,6,4,8,7],[9,11,8],[3,5,6],[0,5,11,0,11,8],[6,3,5,3,1,5],[3,9,6,3,8,9],[9,6,0,6,2,0],[0,3,8,2,5,6,2,1,5],[1,6,2,1,5,6],[9,11,8],[1,0,9,6,10,5,11,3,2],[6,10,5,2,8,0,2,11,8],[3,2,11,10,5,6],[10,5,6,9,3,8,9,1,3],[0,9,1,5,6,10],[8,0,3,10,5,6],[10,5,6],[],[],[],[],[],[],[],[1,10,2,9,11,6,9,8,11],[],[],[6,0,2],[3,6,9,3,2,6],[3,5,1],[0,5,1,0,11,5],[0,3,5],[6,9,11,9,8,11],[],[],[],[4,5,9,7,1,10,7,3,1],[],[11,6,7,2,4,5,2,0,4],[11,6,7,8,0,3,1,10,2,9,4,5],[6,7,11,1,10,2,9,4,5],[],[4,1,0,4,5,1,6,7,3,6,3,2],[9,4,5,0,6,7,0,2,6],[4,5,9,6,3,2,6,7,3],[6,7,11,5,3,8,5,1,3],[6,7,11,4,1,0,4,5,1],[4,5,9,3,8,0,11,6,7],[9,4,5,7,11,6],[],[],[0,6,4],[8,6,4,8,1,6],[],[0,10,2,0,9,10,4,8,11,4,11,6],[10,2,1,6,0,3,6,4,0],[10,2,1,11,4,8,11,6,4],[4,2,6],[1,0,9,2,4,8,2,6,4],[2,4,0,2,6,4],[8,2,4,2,6,4],[11,4,1,11,6,4],[0,9,1,4,11,6,4,8,11],[3,6,0,6,4,0],[8,6,4,8,11,6],[10,8,9],[6,3,9,6,7,3],[6,7,1],[10,7,1,7,3,1],[7,11,6,8,10,2,8,9,10],[11,6,7,10,0,9,10,2,0],[2,1,10,7,11,6,8,0,3],[1,10,2,6,7,11],[7,2,6,7,9,2],[1,0,9,3,6,7,3,2,6],[7,0,6,0,2,6],[2,7,3,2,6,7],[7,11,6,3,9,1,3,8,9],[9,1,0,11,6,7],[0,3,8,11,6,7],[11,6,7],[],[],[],[],[5,3,7],[8,5,2,8,7,5],[5,3,7],[1,10,2,5,8,7,5,9,8],[1,7,5],[1,7,5],[9,2,7,9,7,5],[11,3,2,8,5,9,8,7,5],[1,3,7,1,7,5],[0,7,1,7,5,1],[9,3,5,3,7,5],[9,7,5,9,8,7],[8,10,11],[3,4,10,3,10,11],[8,10,11],[5,9,4,1,11,3,1,10,11],[2,4,5],[5,2,4,2,0,4],[0,3,8,5,9,4,10,2,1],[2,1,10,9,4,5],[2,8,5,2,11,8],[3,2,11,1,4,5,1,0,4],[9,4,5,8,2,11,8,0,2],[11,3,2,9,4,5],[8,5,3,5,1,3],[5,0,4,5,1,0],[3,8,0,4,5,9],[9,4,5],[11,9,10],[11,9,10],[1,11,4,1,10,11],[8,7,4,11,1,10,11,3,1],[2,7,9,2,9,10],[4,8,7,0,10,2,0,9,10],[2,1,10,0,7,4,0,3,7],[10,2,1,8,7,4],[1,7,4],[3,2,11,4,8,7,9,1,0],[11,4,2,4,0,2],[2,11,3,7,4,8],[4,1,7,1,3,7],[1,0,9,8,7,4],[3,4,0,3,7,4],[8,7,4],[8,9,10,8,10,11],[3,9,11,9,10,11],[0,10,8,10,11,8],[10,3,1,10,11,3],[2,8,10,8,9,10],[9,2,0,9,10,2],[8,0,3,1,10,2],[10,2,1],[1,11,9,11,8,9],[11,3,2,0,9,1],[11,0,2,11,8,0],[11,3,2],[8,1,3,8,9,1],[9,1,0],[8,0,3],[]],o=[0,265,515,778,2060,2309,2575,2822,1030,1295,1541,1804,3082,3331,3593,3840,400,153,915,666,2460,2197,2975,2710,1430,1183,1941,1692,3482,3219,3993,3728,560,825,51,314,2620,2869,2111,2358,1590,1855,1077,1340,3642,3891,3129,3376,928,681,419,170,2988,2725,2479,2214,1958,1711,1445,1196,4010,3747,3497,3232,2240,2505,2755,3018,204,453,719,966,3270,3535,3781,4044,1226,1475,1737,1984,2384,2137,2899,2650,348,85,863,598,3414,3167,3925,3676,1370,1107,1881,1616,2800,3065,2291,2554,764,1013,255,502,3830,4095,3317,3580,1786,2035,1273,1520,2912,2665,2403,2154,876,613,367,102,3942,3695,3429,3180,1898,1635,1385,1120,1120,1385,1635,1898,3180,3429,3695,3942,102,367,613,876,2154,2403,2665,2912,1520,1273,2035,1786,3580,3317,4095,3830,502,255,1013,764,2554,2291,3065,2800,1616,1881,1107,1370,3676,3925,3167,3414,598,863,85,348,2650,2899,2137,2384,1984,1737,1475,1226,4044,3781,3535,3270,966,719,453,204,3018,2755,2505,2240,3232,3497,3747,4010,1196,1445,1711,1958,2214,2479,2725,2988,170,419,681,928,3376,3129,3891,3642,1340,1077,1855,1590,2358,2111,2869,2620,314,51,825,560,3728,3993,3219,3482,1692,1941,1183,1430,2710,2975,2197,2460,666,915,153,400,3840,3593,3331,3082,1804,1541,1295,1030,2822,2575,2309,2060,778,515,265,0],s=[[],[8,3,0],[9,0,1],[8,3,1,8,1,9],[11,2,3],[11,2,0,11,0,8],[11,2,3,0,1,9],[2,1,11,1,9,11,11,9,8],[10,1,2],[8,3,0,1,2,10],[9,0,2,9,2,10],[3,2,8,2,10,8,8,10,9],[10,1,3,10,3,11],[1,0,10,0,8,10,10,8,11],[0,3,9,3,11,9,9,11,10],[8,10,9,8,11,10],[8,4,7],[3,0,4,3,4,7],[1,9,0,8,4,7],[9,4,1,4,7,1,1,7,3],[2,3,11,7,8,4],[7,11,4,11,2,4,4,2,0],[3,11,2,4,7,8,9,0,1],[2,7,11,2,1,7,1,4,7,1,9,4],[10,1,2,8,4,7],[2,10,1,0,4,7,0,7,3],[4,7,8,0,2,10,0,10,9],[2,7,3,2,9,7,7,9,4,2,10,9],[8,4,7,11,10,1,11,1,3],[11,4,7,1,4,11,1,11,10,1,0,4],[3,8,0,7,11,4,11,9,4,11,10,9],[7,11,4,4,11,9,11,10,9],[9,5,4],[3,0,8,4,9,5],[5,4,0,5,0,1],[4,8,5,8,3,5,5,3,1],[11,2,3,9,5,4],[9,5,4,8,11,2,8,2,0],[3,11,2,1,5,4,1,4,0],[8,5,4,2,5,8,2,8,11,2,1,5],[2,10,1,9,5,4],[0,8,3,5,4,9,10,1,2],[10,5,2,5,4,2,2,4,0],[3,4,8,3,2,4,2,5,4,2,10,5],[5,4,9,1,3,11,1,11,10],[0,9,1,4,8,5,8,10,5,8,11,10],[3,4,0,3,10,4,4,10,5,3,11,10],[4,8,5,5,8,10,8,11,10],[9,5,7,9,7,8],[0,9,3,9,5,3,3,5,7],[8,0,7,0,1,7,7,1,5],[1,7,3,1,5,7],[11,2,3,8,9,5,8,5,7],[9,2,0,9,7,2,2,7,11,9,5,7],[0,3,8,2,1,11,1,7,11,1,5,7],[2,1,11,11,1,7,1,5,7],[1,2,10,5,7,8,5,8,9],[9,1,0,10,5,2,5,3,2,5,7,3],[5,2,10,8,2,5,8,5,7,8,0,2],[10,5,2,2,5,3,5,7,3],[3,9,1,3,8,9,7,11,10,7,10,5],[9,1,0,10,7,11,10,5,7],[3,8,0,7,10,5,7,11,10],[11,5,7,11,10,5],[11,7,6],[0,8,3,11,7,6],[9,0,1,11,7,6],[7,6,11,3,1,9,3,9,8],[2,3,7,2,7,6],[8,7,0,7,6,0,0,6,2],[1,9,0,3,7,6,3,6,2],[7,6,2,7,2,9,2,1,9,7,9,8],[1,2,10,6,11,7],[2,10,1,7,6,11,8,3,0],[11,7,6,10,9,0,10,0,2],[7,6,11,3,2,8,8,2,10,8,10,9],[6,10,7,10,1,7,7,1,3],[6,10,1,6,1,7,7,1,0,7,0,8],[9,0,3,6,9,3,6,10,9,6,3,7],[6,10,7,7,10,8,10,9,8],[8,4,6,8,6,11],[11,3,6,3,0,6,6,0,4],[0,1,9,4,6,11,4,11,8],[1,9,4,11,1,4,11,3,1,11,4,6],[3,8,2,8,4,2,2,4,6],[2,0,4,2,4,6],[1,9,0,3,8,2,2,8,4,2,4,6],[9,4,1,1,4,2,4,6,2],[10,1,2,11,8,4,11,4,6],[10,1,2,11,3,6,6,3,0,6,0,4],[0,2,10,0,10,9,4,11,8,4,6,11],[2,11,3,6,9,4,6,10,9],[8,4,6,8,6,1,6,10,1,8,1,3],[1,0,10,10,0,6,0,4,6],[8,0,3,9,6,10,9,4,6],[10,4,6,10,9,4],[9,5,4,7,6,11],[4,9,5,3,0,8,11,7,6],[6,11,7,4,0,1,4,1,5],[6,11,7,4,8,5,5,8,3,5,3,1],[4,9,5,6,2,3,6,3,7],[9,5,4,8,7,0,0,7,6,0,6,2],[4,0,1,4,1,5,6,3,7,6,2,3],[7,4,8,5,2,1,5,6,2],[6,11,7,1,2,10,9,5,4],[11,7,6,8,3,0,1,2,10,9,5,4],[11,7,6,10,5,2,2,5,4,2,4,0],[7,4,8,2,11,3,10,5,6],[4,9,5,6,10,7,7,10,1,7,1,3],[5,6,10,0,9,1,8,7,4],[5,6,10,7,0,3,7,4,0],[10,5,6,4,8,7],[5,6,9,6,11,9,9,11,8],[0,9,5,0,5,3,3,5,6,3,6,11],[0,1,5,0,5,11,5,6,11,0,11,8],[11,3,6,6,3,5,3,1,5],[9,5,6,3,9,6,3,8,9,3,6,2],[5,6,9,9,6,0,6,2,0],[0,3,8,2,5,6,2,1,5],[1,6,2,1,5,6],[1,2,10,5,6,9,9,6,11,9,11,8],[1,0,9,6,10,5,11,3,2],[6,10,5,2,8,0,2,11,8],[3,2,11,10,5,6],[10,5,6,9,3,8,9,1,3],[0,9,1,5,6,10],[8,0,3,10,5,6],[10,5,6],[10,6,5],[8,3,0,10,6,5],[0,1,9,5,10,6],[10,6,5,9,8,3,9,3,1],[3,11,2,10,6,5],[6,5,10,2,0,8,2,8,11],[1,9,0,6,5,10,11,2,3],[1,10,2,5,9,6,9,11,6,9,8,11],[1,2,6,1,6,5],[0,8,3,2,6,5,2,5,1],[5,9,6,9,0,6,6,0,2],[9,6,5,3,6,9,3,9,8,3,2,6],[11,6,3,6,5,3,3,5,1],[0,5,1,0,11,5,5,11,6,0,8,11],[0,5,9,0,3,5,3,6,5,3,11,6],[5,9,6,6,9,11,9,8,11],[10,6,5,4,7,8],[5,10,6,7,3,0,7,0,4],[5,10,6,0,1,9,8,4,7],[4,5,9,6,7,10,7,1,10,7,3,1],[7,8,4,2,3,11,10,6,5],[11,6,7,10,2,5,2,4,5,2,0,4],[11,6,7,8,0,3,1,10,2,9,4,5],[6,7,11,1,10,2,9,4,5],[7,8,4,5,1,2,5,2,6],[4,1,0,4,5,1,6,7,3,6,3,2],[9,4,5,8,0,7,0,6,7,0,2,6],[4,5,9,6,3,2,6,7,3],[6,7,11,4,5,8,5,3,8,5,1,3],[6,7,11,4,1,0,4,5,1],[4,5,9,3,8,0,11,6,7],[9,4,5,7,11,6],[10,6,4,10,4,9],[8,3,0,9,10,6,9,6,4],[1,10,0,10,6,0,0,6,4],[8,6,4,8,1,6,6,1,10,8,3,1],[2,3,11,6,4,9,6,9,10],[0,10,2,0,9,10,4,8,11,4,11,6],[10,2,1,11,6,3,6,0,3,6,4,0],[10,2,1,11,4,8,11,6,4],[9,1,4,1,2,4,4,2,6],[1,0,9,3,2,8,2,4,8,2,6,4],[2,4,0,2,6,4],[3,2,8,8,2,4,2,6,4],[1,4,9,11,4,1,11,1,3,11,6,4],[0,9,1,4,11,6,4,8,11],[11,6,3,3,6,0,6,4,0],[8,6,4,8,11,6],[6,7,10,7,8,10,10,8,9],[9,3,0,6,3,9,6,9,10,6,7,3],[6,1,10,6,7,1,7,0,1,7,8,0],[6,7,10,10,7,1,7,3,1],[7,11,6,3,8,2,8,10,2,8,9,10],[11,6,7,10,0,9,10,2,0],[2,1,10,7,11,6,8,0,3],[1,10,2,6,7,11],[7,2,6,7,9,2,2,9,1,7,8,9],[1,0,9,3,6,7,3,2,6],[8,0,7,7,0,6,0,2,6],[2,7,3,2,6,7],[7,11,6,3,9,1,3,8,9],[9,1,0,11,6,7],[0,3,8,11,6,7],[11,6,7],[11,7,5,11,5,10],[3,0,8,7,5,10,7,10,11],[9,0,1,10,11,7,10,7,5],[3,1,9,3,9,8,7,10,11,7,5,10],[10,2,5,2,3,5,5,3,7],[5,10,2,8,5,2,8,7,5,8,2,0],[9,0,1,10,2,5,5,2,3,5,3,7],[1,10,2,5,8,7,5,9,8],[2,11,1,11,7,1,1,7,5],[0,8,3,2,11,1,1,11,7,1,7,5],[9,0,2,9,2,7,2,11,7,9,7,5],[11,3,2,8,5,9,8,7,5],[1,3,7,1,7,5],[8,7,0,0,7,1,7,5,1],[0,3,9,9,3,5,3,7,5],[9,7,5,9,8,7],[4,5,8,5,10,8,8,10,11],[3,0,4,3,4,10,4,5,10,3,10,11],[0,1,9,4,5,8,8,5,10,8,10,11],[5,9,4,1,11,3,1,10,11],[3,8,4,3,4,2,2,4,5,2,5,10],[10,2,5,5,2,4,2,0,4],[0,3,8,5,9,4,10,2,1],[2,1,10,9,4,5],[8,4,5,2,8,5,2,11,8,2,5,1],[3,2,11,1,4,5,1,0,4],[9,4,5,8,2,11,8,0,2],[11,3,2,9,4,5],[4,5,8,8,5,3,5,1,3],[5,0,4,5,1,0],[3,8,0,4,5,9],[9,4,5],[7,4,11,4,9,11,11,9,10],[3,0,8,7,4,11,11,4,9,11,9,10],[11,7,4,1,11,4,1,10,11,1,4,0],[8,7,4,11,1,10,11,3,1],[2,3,7,2,7,9,7,4,9,2,9,10],[4,8,7,0,10,2,0,9,10],[2,1,10,0,7,4,0,3,7],[10,2,1,8,7,4],[2,11,7,2,7,1,1,7,4,1,4,9],[3,2,11,4,8,7,9,1,0],[7,4,11,11,4,2,4,0,2],[2,11,3,7,4,8],[9,1,4,4,1,7,1,3,7],[1,0,9,8,7,4],[3,4,0,3,7,4],[8,7,4],[8,9,10,8,10,11],[0,9,3,3,9,11,9,10,11],[1,10,0,0,10,8,10,11,8],[10,3,1,10,11,3],[3,8,2,2,8,10,8,9,10],[9,2,0,9,10,2],[8,0,3,1,10,2],[10,2,1],[2,11,1,1,11,9,11,8,9],[11,3,2,0,9,1],[11,0,2,11,8,0],[11,3,2],[8,1,3,8,9,1],[9,1,0],[8,0,3],[]];return i},$3Dmol.MarchingCube=$3Dmol.MarchingCubeInitializer,"undefined"==typeof console&&(console={log:function{}}),$3Dmol.ProteinSurface=function{var e,t,n,o=1,s=2,r=4,a=0,c=0,l=0,d=1.4,h=2,u=h,p=0,m=0,g=0,f=0,v=null,b=null,y=null,E=0,_=0,w=0,C=0,S=0,R=0,T={H:1.2,Li:1.82,Na:2.27,K:2.75,C:1.7,N:1.55,O:1.52,F:1.47,P:1.8,S:1.8,CL:1.75,BR:1.85,SE:1.9,ZN:1.39,CU:1.4,NI:1.63,X:2},H=function(e){return e.elem&&"undefined"!=typeof T[e.elem]?e.elem:"X"},A={},x={},O=[new Int32Array([1,0,0]),new Int32Array([-1,0,0]),new Int32Array([0,1,0]),new Int32Array([0,-1,0]),new Int32Array([0,0,1]),new Int32Array([0,0,-1]),new Int32Array([1,1,0]),new Int32Array([1,-1,0]),new Int32Array([-1,1,0]),new Int32Array([-1,-1,0]),new Int32Array([1,0,1]),new Int32Array([1,0,-1]),new Int32Array([-1,0,1]),new Int32Array([-1,0,-1]),new Int32Array([0,1,1]),new Int32Array([0,1,-1]),new Int32Array([0,-1,1]),new Int32Array([0,-1,-1]),new Int32Array([1,1,1]),new Int32Array([1,1,-1]),new Int32Array([1,-1,1]),new Int32Array([-1,1,1]),new Int32Array([1,-1,-1]),new Int32Array([-1,-1,1]),new Int32Array([-1,1,-1]),new Int32Array([-1,-1,-1])];this.getFacesAndVertices=function(i){var n,o,s={};for(n=0,o=i.length;o>n;n++)s[i[n]]=!0;var r=t;for(n=0,o=r.length;o>n;n++)r[n].x=r[n].x/u-a,r[n].y=r[n].y/u-c,r[n].z=r[n].z/u-l;var d=[];for(n=0,o=e.length;o>n;n+=3){var h=e[n],p=e[n+1],m=e[n+2],g=r[h].atomid,f=r[p].atomid,E=r[m].atomid,_=g;if(_>f&&(_=f),_>E&&(_=E),s[_]){r[e[n]],r[e[n+1]],r[e[n+2]];h!==p&&p!==m&&h!==m&&d.push({a:h,b:p,c:m})}}return v=null,b=null,y=null,{vertices:r,faces:d}},this.initparm=function(e,i,t){var o=1/u*5.5;n=e,E=e[0][0],C=e[1][0],_=e[0][1],S=e[1][1],w=e[0][2],R=e[1][2],i?(E-=d+o,_-=d+o,w-=d+o,C+=d+o,S+=d+o,R+=d+o):(E-=o,_-=o,w-=o,C+=o,S+=o,R+=o),E=Math.floor(E*u)/u,_=Math.floor(_*u)/u,w=Math.floor(w*u)/u,C=Math.ceil(C*u)/u,S=Math.ceil(S*u)/u,R=Math.ceil(R*u)/u,a=-E,c=-_,l=-w;var s=128;u=C-E,S-_>u&&(u=S-_),R-w>u&&(u=R-w),u=(s-1)/u,s=Math.floor(s*h/u),u=h;var r=180;if(s>r){var k=r/s;s=Math.floor(r),u*=k}g=Math.ceil(u*(C-E))+1,m=Math.ceil(u*(S-_))+1,p=Math.ceil(u*(R-w))+1,this.boundingatom(i),f=d*u,v=new Uint8Array(g*m*p),b=new Float64Array(g*m*p),y=new Int32Array(g*m*p)},this.boundingatom=function(e){var i,t,n,o=[];flagradius=e;for(var s in T)if(T.hasOwnProperty(s)){var r=T[s];for(e?o[s]=(r+d)*u+.5:o[s]=r*u+.5,n=o[s]*o[s],x[s]=Math.floor(o[s])+1,A[s]=new Int32Array(x[s]*x[s]),indx=0,j=0;j<x[s];j++)for(k=0;k<x[s];k++)i=j*j+k*k,i>n?A[s][indx]=-1:(t=Math.sqrt(n-i),A[s][indx]=Math.floor(t)),indx++}},this.fillvoxels=function(e,i){var t,n;for(t=0,n=v.length;n>t;t++)v[t]=0,b[t]=-1,y[t]=-1;for(t in i){var r=e[i[t]];void 0!==r&&this.fillAtom(r,e)}for(t=0,n=v.length;n>t;t++)v[t]&o&&(v[t]|=s)},this.fillAtom=function(e,i){var t,n,s,r,d,h,f,b,E,_,w,C,S,k,R,T,O,$,M;t=Math.floor(.5+u*(e.coord.x+a)),n=Math.floor(.5+u*(e.coord.y+c)),s=Math.floor(.5+u*(e.coord.z+l));var L=H(e),I=0,D=m*p;for(_=0,M=x[L];M>_;_++)for(w=0;M>w;w++){if(-1!=A[L][I])for(T=-1;2>T;T++)for(O=-1;2>O;O++)for($=-1;2>$;$++)if(0!==T&&0!==O&&0!==$)for(f=T*_,E=$*w,C=0;C<=A[L][I];C++)if(b=C*O,S=t+f,k=n+b,R=s+E,!(0>S||0>k||0>R||S>=g||k>=m||R>=p)){var z=S*D+k*p+R;if(v[z]&o){var N=i[y[z]];N.serial!=e.serial&&(r=t+f-Math.floor(.5+u*(N.x+a)),d=n+b-Math.floor(.5+u*(N.y+c)),h=s+E-Math.floor(.5+u*(N.z+l)),r*r+d*d+h*h>f*f+b*b+E*E&&(y[z]=e.serial))}else v[z]|=o,y[z]=e.serial}I++}},this.fillvoxelswaals=function(e,i){var t,n;for(t=0,n=v.length;n>t;t++)v[t]&=~s;for(t in i){var o=e[i[t]];void 0!==o&&this.fillAtomWaals(o,e)}},this.fillAtomWaals=function(e,i){var t,n,o,r,d,h,f,b,E,_,w,C,S,k,R,T,O,$,M,L=0;t=Math.floor(.5+u*(e.coord.x+a)),n=Math.floor(.5+u*(e.coord.y+c)),o=Math.floor(.5+u*(e.coord.z+l));var I=H(e),D=m*p;for(S=0,M=x[I];M>S;S++)for(k=0;M>k;k++){if(-1!=A[I][L])for(T=-1;2>T;T++)for(O=-1;2>O;O++)for($=-1;2>$;$++)if(0!==T&&0!==O&&0!==$)for(f=T*S,E=$*k,R=0;R<=A[I][L];R++)if(b=R*O,_=t+f,w=n+b,C=o+E,!(0>_||0>w||0>C||_>=g||w>=m||C>=p)){var z=_*D+w*p+C;if(v[z]&s){var N=i[y[z]];N.serial!=e.serial&&(r=t+f-Math.floor(.5+u*(N.x+a)),d=n+b-Math.floor(.5+u*(N.y+c)),h=o+E-Math.floor(.5+u*(N.z+l)),r*r+d*d+h*h>f*f+b*b+E*E&&(y[z]=e.serial))}else v[z]|=s,y[z]=e.serial}L++}},this.buildboundary=function{var e=m*p;for(i=0;i<g;i++)for(j=0;j<p;j++)for(k=0;k<m;k++){var t=i*e+k*p+j;if(v[t]&o)for(var n=0;26>n;){var s=i+O[n][0],a=j+O[n][2],c=k+O[n][1];if(s>-1&&g>s&&c>-1&&m>c&&a>-1&&p>a&&!(v[s*e+c*p+a]&o)){v[t]|=r;break}n++}}};var $=function(e,i,t){var n=new Int32Array(e*i*t*3);this.set=function(e,o,s,r){var a=3*((e*i+o)*t+s);n[a]=r.ix,n[a+1]=r.iy,n[a+2]=r.iz},this.get=function(e,o,s){var r=3*((e*i+o)*t+s);return{ix:n[r],iy:n[r+1],iz:n[r+2]}}};this.fastdistancemap=function{var e,i,t,n,a,c=new $(g,m,p),l=m*p,d=f*f,h=[],y=[];for(e=0;g>e;e++)for(i=0;m>i;i++)for(t=0;p>t;t++)if(a=e*l+i*p+t,v[a]&=~s,v[a]&o&&v[a]&r){var E={ix:e,iy:i,iz:t};c.set(e,i,t,E),h.push(E),b[a]=0,v[a]|=s,v[a]&=~r}do for(y=this.fastoneshell(h,c),h=[],e=0,n=y.length;n>e;e++)a=l*y[e].ix+p*y[e].iy+y[e].iz,v[a]&=~r,b[a]<=1.0404*d&&h.push({ix:y[e].ix,iy:y[e].iy,iz:y[e].iz});while(0!==h.length);h=[],y=[],c=null;var _=u-.5;0>_&&(_=0);var w=d-.5/(.1+_);for(e=0;g>e;e++)for(i=0;m>i;i++)for(t=0;p>t;t++)a=e*l+i*p+t,v[a]&=~r,v[a]&o&&(!(v[a]&s)||v[a]&s&&b[a]>=w)&&(v[a]|=r)},this.fastoneshell=function(e,i){var t,n,a,c,l,d,h,u,f,y,E,_,w=[];if(0===e.length)return w;tnv={ix:-1,iy:-1,iz:-1};var C=m*p;for(h=0,f=e.length;f>h;h++)for(t=e[h].ix,n=e[h].iy,a=e[h].iz,E=i.get(t,n,a),u=0;6>u;u++)tnv.ix=t+O[u][0],tnv.iy=n+O[u][1],tnv.iz=a+O[u][2],tnv.ix<g&&tnv.ix>-1&&tnv.iy<m&&tnv.iy>-1&&tnv.iz<p&&tnv.iz>-1&&(_=tnv.ix*C+p*tnv.iy+tnv.iz,v[_]&o&&!(v[_]&s)?(i.set(tnv.ix,tnv.iy,a+O[u][2],E),c=tnv.ix-E.ix,l=tnv.iy-E.iy,d=tnv.iz-E.iz,y=c*c+l*l+d*d,b[_]=y,v[_]|=s,v[_]|=r,w.push({ix:tnv.ix,iy:tnv.iy,iz:tnv.iz})):v[_]&o&&v[_]&s&&(c=tnv.ix-E.ix,l=tnv.iy-E.iy,d=tnv.iz-E.iz,y=c*c+l*l+d*d,y<b[_]&&(i.set(tnv.ix,tnv.iy,tnv.iz,E),b[_]=y,v[_]&r||(v[_]|=r,w.push({ix:tnv.ix,iy:tnv.iy,iz:tnv.iz})))));for(h=0,f=e.length;f>h;h++)for(t=e[h].ix,n=e[h].iy,a=e[h].iz,E=i.get(t,n,a),u=6;18>u;u++)tnv.ix=t+O[u][0],tnv.iy=n+O[u][1],tnv.iz=a+O[u][2],tnv.ix<g&&tnv.ix>-1&&tnv.iy<m&&tnv.iy>-1&&tnv.iz<p&&tnv.iz>-1&&(_=tnv.ix*C+p*tnv.iy+tnv.iz,v[_]&o&&!(v[_]&s)?(i.set(tnv.ix,tnv.iy,a+O[u][2],E),c=tnv.ix-E.ix,l=tnv.iy-E.iy,d=tnv.iz-E.iz,y=c*c+l*l+d*d,b[_]=y,v[_]|=s,v[_]|=r,w.push({ix:tnv.ix,iy:tnv.iy,iz:tnv.iz})):v[_]&o&&v[_]&s&&(c=tnv.ix-E.ix,l=tnv.iy-E.iy,d=tnv.iz-E.iz,y=c*c+l*l+d*d,y<b[_]&&(i.set(tnv.ix,tnv.iy,tnv.iz,E),b[_]=y,v[_]&r||(v[_]|=r,w.push({ix:tnv.ix,iy:tnv.iy,iz:tnv.iz})))));for(h=0,f=e.length;f>h;h++)for(t=e[h].ix,n=e[h].iy,a=e[h].iz,E=i.get(t,n,a),u=18;26>u;u++)tnv.ix=t+O[u][0],tnv.iy=n+O[u][1],tnv.iz=a+O[u][2],tnv.ix<g&&tnv.ix>-1&&tnv.iy<m&&tnv.iy>-1&&tnv.iz<p&&tnv.iz>-1&&(_=tnv.ix*C+p*tnv.iy+tnv.iz,v[_]&o&&!(v[_]&s)?(i.set(tnv.ix,tnv.iy,a+O[u][2],E),c=tnv.ix-E.ix,l=tnv.iy-E.iy,d=tnv.iz-E.iz,y=c*c+l*l+d*d,b[_]=y,v[_]|=s,v[_]|=r,w.push({ix:tnv.ix,iy:tnv.iy,iz:tnv.iz})):v[_]&o&&v[_]&s&&(c=tnv.ix-E.ix,l=tnv.iy-E.iy,d=tnv.iz-E.iz,y=c*c+l*l+d*d,y<b[_]&&(i.set(tnv.ix,tnv.iy,tnv.iz,E),b[_]=y,v[_]&r||(v[_]|=r,w.push({ix:tnv.ix,iy:tnv.iy,iz:tnv.iz})))));return w},this.marchingcubeinit=function(e){for(var i=0,t=v.length;t>i;i++)1==e?v[i]&=~r:4==e?(v[i]&=~s,v[i]&r&&(v[i]|=s),v[i]&=~r):2==e?v[i]&r&&v[i]&s?v[i]&=~r:v[i]&r&&!(v[i]&s)&&(v[i]|=s):3==e&&(v[i]&=~r)};this.marchingcube=function(i){this.marchingcubeinit(i),t=[],e=[],$3Dmol.MarchingCube.march(v,t,e,{smooth:1,nX:g,nY:m,nZ:p});for(var n=m*p,o=0,s=t.length;s>o;o++)t[o].atomid=y[t[o].x*n+p*t[o].y+t[o].z];$3Dmol.MarchingCube.laplacianSmooth(1,t,e)}},$3Dmol.SetupSurface=function(e){var i=void 0,t=new $3Dmol.ProteinSurface;return t.initparm(e.extent,1===e.type?!1:!0,i),t.fillvoxels(e.allatoms,e.extendedAtoms),t.buildboundary,2===e.type&&(t.fastdistancemap,t.boundingatom(!1),t.fillvoxelswaals(e.allatoms,e.extendedAtoms)),t.marchingcube(e.type),t.vpBits=null,t.vpDistance=null,t.vpAtomID=null,t.faces=null,t.verts=null,t.getFacesAndVertices(e.atomsToShow)},"undefined"==typeof jQuery)throw new Error("iCn3D requires jQuery");var iCn3D=function(e){this.REVISION="1",this.id=e,this.container=$("#"+e),this.overdraw=0,this.bHighlight=1,Detector.webgl?(this.renderer=new THREE.WebGLRenderer({canvas:this.container.get(0),antialias:!0,preserveDrawingBuffer:!0}),this.overdraw=0):(alert("Currently your web browser has a problem on WebGL, and CanvasRenderer instead of WebGLRenderer is used. If you are using Chrome, open a new tab for the same URL and WebGL may work again."),this.renderer=new THREE.CanvasRenderer({canvas:this.container.get(0)}),this.overdraw=.5,this.bHighlight=2),this.matShader=this.setOutlineColor("yellow"),this.fractionOfColor=new THREE.Color(.1,.1,.1),this.WIDTH=this.container.width,this.HEIGHT=this.container.height,this.setWidthHeight(this.WIDTH,this.HEIGHT),this.axis=!1,this.picking=1,this.highlightlevel=1,this.pickpair=!1,this.pickedatomNum=0,this.pickedatom=void 0,this.pickedatom2=void 0,this.bCtrlKey=!1,this.bShiftKey=!1,this.bStopRotate=!1,this.bCalphaOnly=!1,this.bSSOnly=!1,this.bAllAtoms=!0,this.bConsiderNeighbors=!1,this.effects={none:this.renderer},this.maxD=500,this.oriMaxD=this.maxD,this.camera_z=2*-this.maxD,this.commands=[],this.optionsHistory=[],this.logs=[],this.bRender=!0,this.highlightColor=new THREE.Color(16776960),this.sphereGeometry=new THREE.SphereGeometry(1,32,32),this.boxGeometry=new THREE.BoxGeometry(1,1,1),this.cylinderGeometry=new THREE.CylinderGeometry(1,1,1,32,1),this.cylinderGeometryOutline=new THREE.CylinderGeometry(1,1,1,32,1,!0),this.sphereRadius=1.5,this.cylinderRadius=.4,this.linewidth=1,this.curveWidth=3,this.helixSheetWidth=1.3,this.coilWidth=.3,this.thickness=.4,this.axisDIV=5,this.strandDIV=6,this.tubeDIV=8,this.LABELSIZE=40,this.nucleicAcidStrandDIV=6,this.nucleicAcidWidth=.8,this.options={camera:"perspective",background:"black",color:"spectrum",sidechains:"nothing",proteins:"cylinder and plate",surface:"nothing",wireframe:"no",opacity:"0.8",ligands:"stick",water:"nothing",ions:"sphere",hbonds:"no",labels:"no",lines:"no",rotationcenter:"molecule center",axis:"no",fog:"no",slab:"no",picking:"residue",nucleotides:"nucleotide cartoon"},this._zoomFactor=1,this.mouseChange=new THREE.Vector2(0,0),this.quaternion=new THREE.Quaternion(0,0,0,1);var i=this;this.container.bind("contextmenu",function(e){e.preventDefault}),i.switchHighlightLevel,i.typetext=!1,$(document).bind("keyup",function(e){16===e.keyCode&&(i.bShiftKey=!1),(17===e.keyCode||224===e.keyCode||91===e.keyCode)&&(i.bCtrlKey=!1)}),$(document).bind("keydown",function(e){if((e.shiftKey||16===e.keyCode)&&(i.bShiftKey=!0),(e.ctrlKey||17===e.keyCode||224===e.keyCode||91===e.keyCode)&&(i.bCtrlKey=!0),i.controls&&(i.bStopRotate=!0,$("input, textarea").focus(function{i.typetext=!0}),$("input, textarea").blur(function{i.typetext=!1}),!i.typetext)){if(90===e.keyCode){var t={};i.camera===i.perspectiveCamera?t._zoomFactor=.9:i.camera===i.orthographicCamera&&(i._zoomFactor<.1?i._zoomFactor=.1:i._zoomFactor>1&&(i._zoomFactor=1),t._zoomFactor=.9*i._zoomFactor,t._zoomFactor<.1&&(t._zoomFactor=.1)),t.update=!0,i.controls.update(t)}else if(88===e.keyCode){var t={};i.camera===i.perspectiveCamera?t._zoomFactor=1.1:i.camera===i.orthographicCamera&&(i._zoomFactor>20?i._zoomFactor=20:i._zoomFactor<1&&(i._zoomFactor=1),t._zoomFactor=1.03*i._zoomFactor,t._zoomFactor>20&&(t._zoomFactor=20)),t.update=!0,i.controls.update(t)}else if(76===e.keyCode){var n=new THREE.Vector3(0,1,0),o=-5/180*Math.PI;n.applyQuaternion(i.camera.quaternion).normalize;var s=new THREE.Quaternion;s.setFromAxisAngle(n,-o);var t={}; t.quaternion=s,t.update=!0,i.controls.update(t)}else if(74===e.keyCode){var n=new THREE.Vector3(0,1,0),o=5/180*Math.PI;n.applyQuaternion(i.camera.quaternion).normalize;var s=new THREE.Quaternion;s.setFromAxisAngle(n,-o);var t={};t.quaternion=s,t.update=!0,i.controls.update(t)}else if(73===e.keyCode){var n=new THREE.Vector3(1,0,0),o=-5/180*Math.PI;n.applyQuaternion(i.camera.quaternion).normalize;var s=new THREE.Quaternion;s.setFromAxisAngle(n,-o);var t={};t.quaternion=s,t.update=!0,i.controls.update(t)}else if(77===e.keyCode){var n=new THREE.Vector3(1,0,0),o=5/180*Math.PI;n.applyQuaternion(i.camera.quaternion).normalize;var s=new THREE.Quaternion;s.setFromAxisAngle(n,-o);var t={};t.quaternion=s,t.update=!0,i.controls.update(t)}i.render}}),this.container.bind("mouseup touchend",function(e){i.isDragging=!1}),this.container.bind("mousedown touchstart",function(e){if(e.preventDefault,i.scene){i.bStopRotate=!0;var t=e.pageX,n=e.pageY;if(e.originalEvent.targetTouches&&e.originalEvent.targetTouches[0]&&(t=e.originalEvent.targetTouches[0].pageX,n=e.originalEvent.targetTouches[0].pageY),i.isDragging=!0,i.picking&&(e.altKey||e.ctrlKey||e.shiftKey||16===e.keyCode||17===e.keyCode||224===e.keyCode||91===e.keyCode)){i.highlightlevel=i.picking,i.mouse.x=(t-i.container.offset.left)/i.container.width*2-1,i.mouse.y=2*-((n-i.container.offset.top)/i.container.height)+1;var o=new THREE.Vector3;o.x=i.mouse.x,o.y=i.mouse.y,this.camera_z>0?o.z=-1:o.z=1,i.camera===i.perspectiveCamera?(this.camera_z>0?o.z=-1:o.z=1,o.unproject(i.camera),i.raycaster.set(i.camera.position,o.sub(i.camera.position).normalize)):i.camera===i.orthographicCamera&&(this.camera_z>0?o.z=1:o.z=-1,o.unproject(i.camera),i.raycaster.set(o,new THREE.Vector3(0,0,-1).transformDirection(i.camera.matrixWorld)));var s=i.raycaster.intersectObjects(i.objects);if(s.length>0){s[0].point.sub(i.mdl.position);for(var r=1,a=i.getAtomsFromPosition(s[0].point,r);!a&&10>r;)++r,a=i.getAtomsFromPosition(s[0].point,r);a?(i.pickpair?(i.pickedatomNum%2===0?i.pickedatom=a:i.pickedatom2=a,++i.pickedatomNum):i.pickedatom=a,i.showPicking(a)):console.log("No atoms were found in 10 andstrom range")}}i.controls.handleResize,i.controls.update,i.render}}),this.container.bind("mousemove touchmove",function(e){e.preventDefault,i.scene&&i.isDragging&&(i.controls.handleResize,i.controls.update,i.render)}),this.container.bind("mousewheel",function(e){e.preventDefault,i.scene&&(i.bStopRotate=!0,i.controls.handleResize,i.controls.update,i.render)}),this.container.bind("DOMMouseScroll",function(e){e.preventDefault,i.scene&&(i.bStopRotate=!0,i.controls.handleResize,i.controls.update,i.render)})};if(iCn3D.prototype={constructor:iCn3D,setOutlineColor:function(e){var i={outline:{vertex_shader:["uniform float offset;","void main {","vec4 pos = modelViewMatrix * vec4( position + normal * offset, 1.0 );","gl_Position = projectionMatrix * pos;","}"].join("\n"),fragment_shader:["void main{","gl_FragColor = vec4( 1.0, 1.0, 0.0, 1.0 );","}"].join("\n")}};"yellow"===e?i.outline.fragment_shader=["void main{","gl_FragColor = vec4( 1.0, 1.0, 0.0, 1.0 );","}"].join("\n"):"green"===e?i.outline.fragment_shader=["void main{","gl_FragColor = vec4( 0.0, 1.0, 0.0, 1.0 );","}"].join("\n"):"red"===e&&(i.outline.fragment_shader=["void main{","gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );","}"].join("\n"));var t={offset:{type:"f",value:.5}},n=i.outline,o=new THREE.ShaderMaterial({uniforms:t,vertexShader:n.vertex_shader,fragmentShader:n.fragment_shader,depthTest:!1,depthWrite:!1,needsUpdate:!0});return o},setWidthHeight:function(e,i){this.renderer.setSize(e,i),this.container.widthInv=1/e,this.container.heightInv=1/i,this.container.whratio=e/i},nucleotidesArray:[" G","  A","  T","  C","  U"," DG"," DA"," DT"," DC"," DU"],ionsArray:[" NA"," MG"," AL"," CA"," TI"," MN"," FE"," NI"," CU"," ZN"," AG"," BA","  F"," CL"," BR","  I"],vdwRadii:{H:1.08,HE:1.34,LI:1.75,BE:2.05,B:1.47,C:1.49,N:1.41,O:1.4,F:1.39,NE:1.68,NA:1.84,MG:2.05,AL:2.11,SI:2.07,P:1.92,S:1.82,CL:1.83,AR:1.93,K:2.05,CA:2.21,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:2.08,GE:2.15,AS:2.06,SE:1.93,BR:1.98,KR:2.12,RB:2.16,SR:2.24,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:2.36,SN:2.33,SB:2.25,TE:2.23,I:2.23,XE:2.21,CS:2.22,BA:2.51,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:2.35,PB:2.32,BI:2.43,PO:2.29,AT:2.36,RN:2.43,FR:2.56,RA:2.43,AC:2.6,TH:2.37,PA:2.43,U:2.4,NP:2.21,PU:2.56,AM:2.56,CM:2.56,BK:2.56,CF:2.56,ES:2.56,FM:2.56},covalentRadii:{H:.31,HE:.28,LI:1.28,BE:.96,B:.84,C:.76,N:.71,O:.66,F:.57,NE:.58,NA:1.66,MG:1.41,AL:1.21,SI:1.11,P:1.07,S:1.05,CL:1.02,AR:1.06,K:2.03,CA:1.76,SC:1.7,TI:1.6,V:1.53,CR:1.39,MN:1.39,FE:1.32,CO:1.26,NI:1.24,CU:1.32,ZN:1.22,GA:1.22,GE:1.2,AS:1.19,SE:1.2,BR:1.2,KR:1.16,RB:2.2,SR:1.95,Y:1.9,ZR:1.75,NB:1.64,MO:1.54,TC:1.47,RU:1.46,RH:1.42,PD:1.39,AG:1.45,CD:1.44,IN:1.42,SN:1.39,SB:1.39,TE:1.38,I:1.39,XE:1.4,CS:2.44,BA:2.15,LA:2.07,CE:2.04,PR:2.03,ND:2.01,PM:1.99,SM:1.98,EU:1.98,GD:1.96,TB:1.94,DY:1.92,HO:1.92,ER:1.89,TM:1.9,YB:1.87,LU:1.87,HF:1.75,TA:1.7,W:1.62,RE:1.51,OS:1.44,IR:1.41,PT:1.36,AU:1.36,HG:1.32,TL:1.45,PB:1.46,BI:1.48,PO:1.4,AT:1.5,RN:1.5,FR:2.6,RA:2.21,AC:2.15,TH:2.06,PA:2,U:1.96,NP:1.9,PU:1.87,AM:1.8,CM:1.69},atomColors:{H:new THREE.Color(16777215),He:new THREE.Color(16761035),HE:new THREE.Color(16761035),Li:new THREE.Color(11674146),LI:new THREE.Color(11674146),B:new THREE.Color(65280),C:new THREE.Color(13158600),N:new THREE.Color(9408511),O:new THREE.Color(15728640),F:new THREE.Color(14329120),Na:new THREE.Color(255),NA:new THREE.Color(255),Mg:new THREE.Color(2263842),MG:new THREE.Color(2263842),Al:new THREE.Color(8421520),AL:new THREE.Color(8421520),Si:new THREE.Color(14329120),SI:new THREE.Color(14329120),P:new THREE.Color(16753920),S:new THREE.Color(16762930),Cl:new THREE.Color(65280),CL:new THREE.Color(65280),Ca:new THREE.Color(8421520),CA:new THREE.Color(8421520),Ti:new THREE.Color(8421520),TI:new THREE.Color(8421520),Cr:new THREE.Color(8421520),CR:new THREE.Color(8421520),Mn:new THREE.Color(8421520),MN:new THREE.Color(8421520),Fe:new THREE.Color(16753920),FE:new THREE.Color(16753920),Ni:new THREE.Color(10824234),NI:new THREE.Color(10824234),Cu:new THREE.Color(10824234),CU:new THREE.Color(10824234),Zn:new THREE.Color(10824234),ZN:new THREE.Color(10824234),Br:new THREE.Color(10824234),BR:new THREE.Color(10824234),Ag:new THREE.Color(8421520),AG:new THREE.Color(8421520),I:new THREE.Color(10494192),Ba:new THREE.Color(16753920),BA:new THREE.Color(16753920),Au:new THREE.Color(14329120),AU:new THREE.Color(14329120)},defaultAtomColor:new THREE.Color(13421772),stdChainColors:[new THREE.Color(3329330),new THREE.Color(2003199),new THREE.Color(16416882),new THREE.Color(16753920),new THREE.Color(52945),new THREE.Color(16738740),new THREE.Color(65280),new THREE.Color(255),new THREE.Color(16711680),new THREE.Color(16776960),new THREE.Color(65535),new THREE.Color(16711935),new THREE.Color(3978097),new THREE.Color(4620980),new THREE.Color(13458524),new THREE.Color(16770229),new THREE.Color(11529966),new THREE.Color(15631086),new THREE.Color(25600),new THREE.Color(139),new THREE.Color(9109504),new THREE.Color(13468991),new THREE.Color(35723),new THREE.Color(9699539)],backgroundColors:{black:new THREE.Color(0),grey:new THREE.Color(13421772),white:new THREE.Color(16777215)},residueColors:{ALA:new THREE.Color(13158600),ARG:new THREE.Color(1334015),ASN:new THREE.Color(56540),ASP:new THREE.Color(15075850),CYS:new THREE.Color(15132160),GLN:new THREE.Color(56540),GLU:new THREE.Color(15075850),GLY:new THREE.Color(15461355),HIS:new THREE.Color(8553170),ILE:new THREE.Color(1016335),LEU:new THREE.Color(1016335),LYS:new THREE.Color(1334015),MET:new THREE.Color(15132160),PHE:new THREE.Color(3289770),PRO:new THREE.Color(14456450),SER:new THREE.Color(16422400),THR:new THREE.Color(16422400),TRP:new THREE.Color(11819700),TYR:new THREE.Color(3289770),VAL:new THREE.Color(1016335),ASX:new THREE.Color(16738740),GLX:new THREE.Color(16738740)},defaultResidueColor:new THREE.Color(12492910),chargeColors:{"  G":new THREE.Color(16711680),"  A":new THREE.Color(16711680),"  T":new THREE.Color(16711680),"  C":new THREE.Color(16711680),"  U":new THREE.Color(16711680)," DG":new THREE.Color(16711680)," DA":new THREE.Color(16711680)," DT":new THREE.Color(16711680)," DC":new THREE.Color(16711680)," DU":new THREE.Color(16711680),G:new THREE.Color(16711680),A:new THREE.Color(16711680),T:new THREE.Color(16711680),C:new THREE.Color(16711680),U:new THREE.Color(16711680),DG:new THREE.Color(16711680),DA:new THREE.Color(16711680),DT:new THREE.Color(16711680),DC:new THREE.Color(16711680),DU:new THREE.Color(16711680),ARG:new THREE.Color(255),LYS:new THREE.Color(255),ASP:new THREE.Color(16711680),GLU:new THREE.Color(16711680),GLY:new THREE.Color(8947848),PRO:new THREE.Color(8947848),ALA:new THREE.Color(8947848),VAL:new THREE.Color(8947848),LEU:new THREE.Color(8947848),ILE:new THREE.Color(8947848),PHE:new THREE.Color(8947848),HIS:new THREE.Color(8947848),SER:new THREE.Color(8947848),THR:new THREE.Color(8947848),ASN:new THREE.Color(8947848),GLN:new THREE.Color(8947848),TYR:new THREE.Color(8947848),MET:new THREE.Color(8947848),CYS:new THREE.Color(8947848),TRP:new THREE.Color(8947848)},hydrophobicColors:{"  G":new THREE.Color(8947848),"  A":new THREE.Color(8947848),"  T":new THREE.Color(8947848),"  C":new THREE.Color(8947848),"  U":new THREE.Color(8947848)," DG":new THREE.Color(8947848)," DA":new THREE.Color(8947848)," DT":new THREE.Color(8947848)," DC":new THREE.Color(8947848)," DU":new THREE.Color(8947848),G:new THREE.Color(8947848),A:new THREE.Color(8947848),T:new THREE.Color(8947848),C:new THREE.Color(8947848),U:new THREE.Color(8947848),DG:new THREE.Color(8947848),DA:new THREE.Color(8947848),DT:new THREE.Color(8947848),DC:new THREE.Color(8947848),DU:new THREE.Color(8947848),ARG:new THREE.Color(8947848),LYS:new THREE.Color(8947848),ASP:new THREE.Color(8947848),GLU:new THREE.Color(8947848),GLY:new THREE.Color(65280),PRO:new THREE.Color(65280),ALA:new THREE.Color(65280),VAL:new THREE.Color(65280),LEU:new THREE.Color(65280),ILE:new THREE.Color(65280),PHE:new THREE.Color(65280),HIS:new THREE.Color(8947848),SER:new THREE.Color(8947848),THR:new THREE.Color(8947848),ASN:new THREE.Color(8947848),GLN:new THREE.Color(8947848),TYR:new THREE.Color(8947848),MET:new THREE.Color(8947848),CYS:new THREE.Color(8947848),TRP:new THREE.Color(8947848)},ssColors:{helix:new THREE.Color(16711808),sheet:new THREE.Color(16762880),coil:new THREE.Color(6324479)},defaultBondColor:new THREE.Color(2200790),surfaces:{1:void 0,2:void 0,3:void 0,4:void 0},hasCovalentBond:function(e,i){var t=this.covalentRadii[e.elem]+this.covalentRadii[i.elem];return e.coord.distanceToSquared(i.coord)<1.3*t*t},init:function{this.structures={},this.chains={},this.residues={},this.secondaries={},this.alignChains={},this.chainsSeq={},this.chainsColor={},this.chainsAnno={},this.chainsAnnoTitle={},this.alignChainsSeq={},this.alignChainsAnno={},this.alignChainsAnnoTitle={},this.displayAtoms={},this.highlightAtoms={},this.pickedAtomList={},this.prevHighlightObjects=[],this.prevSurfaces=[],this.definedNames2Residues={},this.definedNames2Atoms={},this.definedNames2Descr={},this.definedNames2Command={},this.residueId2Name={},this.moleculeTitle="",this.atoms={},this.displayAtoms={},this.highlightAtoms={},this.proteins={},this.sidechains={},this.nucleotides={},this.nucleotidesP={},this.ligands={},this.ions={},this.water={},this.calphas={},this.hbondpoints=[],this.doublebonds={},this.triplebonds={},this.aromaticbonds={},this.atomPrevColors={},this.style2atoms={},this.labels={},this.lines={},this.inputid={idtype:void 0,id:void 0},this.biomtMatrices=[],this.bAssembly=!1,this.rotateCount=0,this.rotateCountMax=30},reinitAfterLoad:function{this.displayAtoms=this.cloneHash(this.atoms),this.highlightAtoms=this.cloneHash(this.atoms),this.prevHighlightObjects=[],this.prevSurfaces=[],this.hbondpoints=[],this.labels={},this.lines={},this.biomtMatrices=[],this.bAssembly=!1},loadPDB:function(e){var i=[],t=[],n=e.split("\n"),o={},s={};this.init;var r,a,c=[],l=[],d=[],h=[],u=[],p=[],m=0,g=1,f="",v="",b="",y={},E={},_="P_ID";for(var w in n){var C=n[w],S=C.substr(0,6);if("HEADER"===S)_=C.substr(62,4),this.moleculeTitle="";else if("TITLE "===S){var k=C.substr(10);this.moleculeTitle+=k.trim+" "}else if("HELIX "===S){for(var R,T=C.substr(19,1),H=parseInt(C.substr(21,4)),A=parseInt(C.substr(33,4)),x=H;A>=x;++x)R=T+"_"+x,h.push(R),x===H&&u.push(R),x===A&&p.push(R);i.push({chain:T,initialResidue:H,initialInscode:C.substr(25,1),terminalResidue:A,terminalInscode:C.substr(37,1)})}else if("SHEET "===S){for(var T=C.substr(21,1),H=parseInt(C.substr(22,4)),A=parseInt(C.substr(33,4)),x=H;A>=x;++x){var R=T+"_"+x;c.push(R),x===H&&l.push(R),x===A&&d.push(R)}t.push({chain:T,initialResidue:H,initialInscode:C.substr(26,1),terminalResidue:A,terminalInscode:C.substr(37,1)})}else if("HBOND "===S){bCalculateHbond=!1;var O=(C.substr(6,1),C.substr(8,4).replace(/ /g,""),C.substr(14,4).replace(/ /g,""),C.substr(18,1),C.substr(20,4).replace(/ /g,""),C.substr(25,4).replace(/ /g,""),parseFloat(C.substr(30,8))),M=parseFloat(C.substr(38,8)),L=parseFloat(C.substr(46,8)),I=parseFloat(C.substr(54,8)),D=parseFloat(C.substr(62,8)),z=parseFloat(C.substr(70,8));C.substr(78,8).replace(/ /g,"");this.hbondpoints.push(new THREE.Vector3(O,M,L)),this.hbondpoints.push(new THREE.Vector3(I,D,z))}else if("REMARK"===S){var N=parseInt(C.substr(7,3));if(350==N&&"BIOMT"==C.substr(13,5)){var q=parseInt(C[18])-1,j=parseInt(C.substr(21,2));void 0==this.biomtMatrices[j]&&(this.biomtMatrices[j]=(new THREE.Matrix4).identity),this.biomtMatrices[j].elements[q]=parseFloat(C.substr(24,9)),this.biomtMatrices[j].elements[q+4]=parseFloat(C.substr(34,9)),this.biomtMatrices[j].elements[q+8]=parseFloat(C.substr(44,9)),this.biomtMatrices[j].elements[q+12]=parseFloat(C.substr(54,10))}else if(465==N&&" "==C.substr(18,1)&&" "==C.substr(20,1)&&"S"!=C.substr(21,1)){var P=C.substr(15,3),F=C.substr(19,1),B=parseInt(C.substr(21,5)),V=parseInt(C.substr(13,1));" "==C.substr(13,1)&&(V=1);var r=V+"_"+F;void 0===E[r]&&(E[r]=[]);var G={};G.resi=B,G.name=this.residueName2Abbr(P).toLowerCase,E[r].push(G)}}else if("ENDMDL"===S)++g;else if("JRNL  "===S)"PMID"===C.substr(12,4)&&(this.pmid=C.substr(19).trim);else if("ATOM  "===S||"HETATM"===S){var U=C.substr(16,1);if("B"===U)continue;++m;var W=parseInt(C.substr(6,5));y[W]=m;var Y=C.substr(76,2).replace(/ /g,"");""===Y&&(Y=C.substr(12,2).replace(/ /g,""));var F=C.substr(21,1);""===F&&(F=1);var B=parseInt(C.substr(22,4)),X=C.substr(12,4).replace(/ /g,""),R=F+"_"+B,Z=parseFloat(C.substr(30,8)),K=parseFloat(C.substr(38,8)),Q=parseFloat(C.substr(46,8)),P=C.substr(17,3),J=new THREE.Vector3(Z,K,Q),V=1===g?_:_+g.toString,ee={het:"H"===S[0],serial:m,name:X,alt:U,resn:P,structure:V,chain:F,resi:B,coord:J,b:parseFloat(C.substr(60,8)),elem:Y,bonds:[],ss:"coil",ssbegin:!1,ssend:!1};this.atoms[m]=ee,this.displayAtoms[m]=1,this.highlightAtoms[m]=1,-1!==$.inArray(R,h)?(this.atoms[m].ss="helix",-1!==$.inArray(R,u)&&(this.atoms[m].ssbegin=!0),-1!==$.inArray(R,p)&&(this.atoms[m].ssend=!0)):-1!==$.inArray(R,c)&&(this.atoms[m].ss="sheet",-1!==$.inArray(R,l)&&(this.atoms[m].ssbegin=!0),-1!==$.inArray(R,d)&&(this.atoms[m].ssend=!0)),r=V+"_"+F,a=r+"_"+B;var ie="-";if("helix"===this.atoms[m].ss?ie="H":"sheet"===this.atoms[m].ss?ie="E":"coil"===this.atoms[m].ss?ie="c":!this.atoms[m].het&&this.residueColors.hasOwnProperty(this.atoms[m].resn.toUpperCase)&&(ie="c"),this.secondaries[a]=ie,a!==v){var te=this.residueName2Abbr(P);if(this.residueId2Name[a]=te,1!==m&&(this.residues[v]=s),s={},r!==f){1!==m&&(this.chains[f]=this.unionHash2Atoms(this.chains[f],o)),o={},void 0===this.structures[V.toString]&&(this.structures[V.toString]=[]),this.structures[V.toString].push(r),void 0===this.chainsSeq[r]&&(this.chainsSeq[r]=[]),void 0===this.chainsAnno[r]&&(this.chainsAnno[r]=[]),void 0===this.chainsAnno[r][0]&&(this.chainsAnno[r][0]=[]),void 0===this.chainsAnno[r][1]&&(this.chainsAnno[r][1]=[]),void 0===this.chainsAnnoTitle[r]&&(this.chainsAnnoTitle[r]=[]),void 0===this.chainsAnnoTitle[r][0]&&(this.chainsAnnoTitle[r][0]=[]),void 0===this.chainsAnnoTitle[r][1]&&(this.chainsAnnoTitle[r][1]=[]);var G={};G.resi=B,G.name=te,this.chainsSeq[r].push(G);var ne="";B%10===0&&(ne=B.toString),this.chainsAnno[r][0].push(ne),this.chainsAnno[r][1].push(ie),this.chainsAnnoTitle[r][0].push(""),this.chainsAnnoTitle[r][1].push("SS")}else{var G={};G.resi=B,G.name=te,this.chainsSeq[r].push(G);var ne="";B%10===0&&(ne=B.toString),this.chainsAnno[r][0].push(ne),this.chainsAnno[r][1].push(ie)}}o[m]=1,s[m]=1,b=S,f=r,v=a}else if("CONECT"===S)for(var oe=parseInt(C.substr(6,5)),x=0;4>x;++x){var se=parseInt(C.substr([11,16,21,26][x],5));isNaN(se)||void 0!==this.atoms[y[oe]]&&this.atoms[y[oe]].bonds.push(y[se])}else"TER   "===S&&++m}for(var r in this.chainsSeq)if(void 0!==E[r]){var w,x,re,ae=this.chainsSeq[r],ce=this.chainsAnno[r][0],le=this.chainsAnno[r][1],de=E[r],j=ae.length,q=de.length,he=new Array(j+q),ue=new Array(j+q),pe=new Array(j+q);for(w=0,x=0,re=0;j>w&&q>x;)ae[w].resi<=de[x].resi?(he[re]=ae[w],ue[re]=ce[w],pe[re]=le[w],w++):(he[re]=de[x],de[x].resi%10===0?ue[re]=de[x].resi.toString:ue[re]="",pe[re]="-",x++),re++;if(j>w)for(var me=w;j>me;me++)he[re]=ae[me],ue[re]=ce[me],pe[re]=le[me],re++;else for(var me=x;q>me;me++)he[re]=de[me],de[me].resi%10===0?ue[re]=de[me].resi.toString:ue[re]="",pe[re]="-",re++;this.chainsSeq[r]=he,this.chainsAnno[r][0]=ue,this.chainsAnno[r][1]=pe}n=null,this.residues[a]=s,this.chains[r]=this.unionHash2Atoms(this.chains[r],o);var ge,fe,ve=[],be=this,ye=function(e){for(var i=ve.length,t=0;i>t;++t){for(var n=ve[t],o=t+1;i>o;++o){var s=ve[o];n.alt===s.alt&&be.hasCovalentBond(n,s)&&(n.bonds.push(s.serial),s.bonds.push(n.serial))}e&&e(n)}},Ee=new THREE.Vector3(9999,9999,9999),_e=new THREE.Vector3(-9999,-9999,-9999),we=new THREE.Vector3,Ce=0;for(var w in this.atoms){var X=this.atoms[w],J=X.coord;we.add(J),Ee.min(J),_e.max(J),++Ce,X.het?X.het&&("HOH"===X.resn||"WAT"===X.resn?this.water[X.serial]=1:-1!==$.inArray(X.resn,this.ionsArray)?this.ions[X.serial]=1:this.ligands[X.serial]=1):-1!==$.inArray(X.resn,this.nucleotidesArray)?(this.nucleotides[X.serial]=1,"P"===X.name&&(this.nucleotidesP[X.serial]=1)):(this.proteins[X.serial]=1,"CA"===X.name&&(this.calphas[X.serial]=1),"N"!==X.name&&"CA"!==X.name&&"C"!==X.name&&"O"!==X.name&&(this.sidechains[X.serial]=1)),(ge!==X.chain||fe!==X.resi)&&(ye(function(e){("C"===e.name&&"N"===X.name||"O3'"===e.name&&"P"===X.name)&&be.hasCovalentBond(e,X)&&(e.bonds.push(X.serial),X.bonds.push(e.serial))}),ge=X.chain,fe=X.resi,ve.length=0),ve.push(X)}ye,this.pmin=Ee,this.pmax=_e,this.cnt=Ce,this.maxD=this.pmax.distanceTo(this.pmin),this.center=we.multiplyScalar(1/this.cnt),this.maxD<25&&(this.maxD=25),this.oriMaxD=this.maxD,this.oriCenter=this.center.clone},cloneHash:function(e){var i={};for(var t in e)i[t]=e[t];return i},residueName2Abbr:function(e){switch(void 0!==e&&" "!==e.charAt(0)&&" "===e.charAt(1)&&(e=e.charAt(0)),e){case"  A":return"A";case"  C":return"C";case"  G":return"G";case"  T":return"T";case"  U":return"U";case"  I":return"I";case" DA":return"A";case" DC":return"C";case" DG":return"G";case" DT":return"T";case" DU":return"U";case" DI":return"I";case"ALA":return"A";case"ARG":return"R";case"ASN":return"N";case"ASP":return"D";case"CYS":return"C";case"GLU":return"E";case"GLN":return"Q";case"GLY":return"G";case"HIS":return"H";case"ILE":return"I";case"LEU":return"L";case"LYS":return"K";case"MET":return"M";case"PHE":return"F";case"PRO":return"P";case"SER":return"S";case"THR":return"T";case"TRP":return"W";case"TYR":return"Y";case"VAL":return"V";case"SEC":return"U";case"HOH":return"O";case"WAT":return"O";default:return e}},calculateLigandHbonds:function(e,i,t){if(0!==Object.keys(e).length&&0!==Object.keys(i).length){var n,o={},s=t*t;for(var r in e){var a=e[r];("N"===a.elem||"O"===a.elem||"F"===a.elem)&&(n=a.structure+"_"+a.chain+"_"+a.resi+"_"+a.name,o[n]=a)}this.highlightAtoms={};for(var r in i){var a=i[r];if("N"===a.elem||"O"===a.elem||"F"===a.elem){n=a.structure+"_"+a.chain+"_"+a.resi+"_"+a.name;for(var c in o){var l=Math.abs(a.coord.x-o[c].coord.x);if(!(l>t)){var d=Math.abs(a.coord.y-o[c].coord.y);if(!(d>t)){var h=Math.abs(a.coord.z-o[c].coord.z);if(!(h>t)){var u=l*l+d*d+h*h;if(!(u>s)){var p=c.indexOf("_"),m=c.lastIndexOf("_"),g=c.substr(0,p),f=c.substr(p+1,m-p-1);m=f.lastIndexOf("_");var v=f.substr(0,m),b=f.substr(m+1);this.hbondpoints.push(a.coord),this.hbondpoints.push(o[c].coord),this.highlightAtoms=this.unionHash(this.highlightAtoms,this.residues[g+"_"+v+"_"+b])}}}}}}}}},createSphere:function(e,i,t,n,o){var s;if(void 0===i&&(i=.8),void 0===t&&(t=!1),void 0===n&&(n=1),2===o){n>.9?n=1.5:.5>n&&(n=1);var r=this.highlightColor;s=new THREE.Mesh(this.sphereGeometry,new THREE.MeshPhongMaterial({transparent:!0,opacity:.5,overdraw:this.overdraw,specular:this.fractionOfColor,shininess:30,emissive:0,color:r}))}else if(1===o)s=new THREE.Mesh(this.sphereGeometry,this.matShader);else{var r=e.color;s=new THREE.Mesh(this.sphereGeometry,new THREE.MeshPhongMaterial({overdraw:this.overdraw,specular:this.fractionOfColor,shininess:30,emissive:0,color:r}))}s.scale.x=s.scale.y=s.scale.z=t?i:(this.vdwRadii[e.elem]||i)*(n?n:1),s.position.copy(e.coord),this.mdl.add(s),1===o||2===o?this.prevHighlightObjects.push(s):this.objects.push(s)},createBox:function(e,i,t,n,o,s){var r;void 0===i&&(i=.8),void 0===t&&(t=!1),void 0===n&&(n=.8),s?(void 0===o&&(o=this.highlightColor),r=new THREE.Mesh(this.boxGeometry,new THREE.MeshPhongMaterial({transparent:!0,opacity:.5,overdraw:this.overdraw,specular:this.fractionOfColor,shininess:30,emissive:0,color:o}))):(void 0===o&&(o=e.color),r=new THREE.Mesh(this.boxGeometry,new THREE.MeshPhongMaterial({overdraw:this.overdraw,specular:this.fractionOfColor,shininess:30,emissive:0,color:o}))),r.scale.x=r.scale.y=r.scale.z=t?i:(this.vdwRadii[e.elem]||i)*(n?n:1),r.position.copy(e.coord),this.mdl.add(r),s?this.prevHighlightObjects.push(r):this.objects.push(r)},createCylinder:function(e,i,t,n,o){var s;if(1===o){if(this.maxD<50)s=new THREE.Mesh(this.cylinderGeometryOutline,this.matShader),s.position.copy(e).add(i).multiplyScalar(.5),s.matrixAutoUpdate=!1,s.lookAt(e),s.updateMatrix,s.matrix.multiply((new THREE.Matrix4).makeScale(t,t,e.distanceTo(i))).multiply((new THREE.Matrix4).makeRotationX(.5*Math.PI));else{var t=.5*this.coilWidth,r=8,a=!1,c=[e,i],l=new THREE.TubeGeometry(new THREE.SplineCurve3(c),c.length,t,r,a);s=new THREE.Mesh(l,this.matShader)}this.mdl.add(s),this.prevHighlightObjects.push(s)}else 2===o?(s=new THREE.Mesh(this.cylinderGeometry,new THREE.MeshPhongMaterial({transparent:!0,opacity:.5,overdraw:this.overdraw,specular:this.fractionOfColor,shininess:30,emissive:0,color:n})),t*=1.5):s=new THREE.Mesh(this.cylinderGeometry,new THREE.MeshPhongMaterial({overdraw:this.overdraw,specular:this.fractionOfColor,shininess:30,emissive:0,color:n})),s.position.copy(e).add(i).multiplyScalar(.5),s.matrixAutoUpdate=!1,s.lookAt(e),s.updateMatrix,s.matrix.multiply((new THREE.Matrix4).makeScale(t,t,e.distanceTo(i))).multiply((new THREE.Matrix4).makeRotationX(.5*Math.PI)),this.mdl.add(s),2===o?this.prevHighlightObjects.push(s):this.objects.push(s)},createRepresentationSub:function(e,i,t){new THREE.Geometry;for(var n in e){var o=e[n];i&&i(o);for(var s in o.bonds){var r=this.atoms[o.bonds[s]];void 0===r||r.serial<o.serial||t&&t(o,r)}}},createSphereRepresentation:function(e,i,t,n,o){var s=this;this.createRepresentationSub(e,function(e){s.createSphere(e,i,t,n,o)})},createBoxRepresentation_P_CA:function(e,i,t){var n=this;this.createRepresentationSub(e,function(e){("CA"===e.name||"P"===e.name)&&n.createBox(e,void 0,void 0,i,void 0,t)})},createStickRepresentation:function(e,i,t,n,o,s){var r=this,a=void 0!==s&&s?i/r.cylinderRadius:1;2!==o?this.createRepresentationSub(e,function(e){r.createSphere(e,i,!n,n,o)},function(e,i){var n=e.coord.clone.add(i.coord).multiplyScalar(.5),s=e.serial+"_"+i.serial;if(r.doublebonds.hasOwnProperty(s)){var c,l,d;e.bonds.length>i.bonds.length?(c=e.serial,l=e.bonds[0],d=e.bonds[1]):(c=i.serial,l=i.bonds[0],d=i.bonds[1]);var h=r.atoms[c].coord.clone;h.sub(r.atoms[l].coord);var u=r.atoms[c].coord.clone;u.sub(r.atoms[d].coord),h.cross(u);var p=i.coord.clone;p.sub(e.coord),p.cross(h).normalize.multiplyScalar(.2*a),e.color===i.color?(r.createCylinder(e.coord.clone.add(p),i.coord.clone.add(p),r.cylinderRadius*a*.3,e.color,o),r.createCylinder(e.coord.clone.sub(p),i.coord.clone.sub(p),r.cylinderRadius*a*.3,e.color,o)):(r.createCylinder(e.coord.clone.add(p),n.clone.add(p),r.cylinderRadius*a*.3,e.color,o),r.createCylinder(i.coord.clone.add(p),n.clone.add(p),r.cylinderRadius*a*.3,i.color,o),r.createCylinder(e.coord.clone.sub(p),n.clone.sub(p),r.cylinderRadius*a*.3,e.color,o),r.createCylinder(i.coord.clone.sub(p),n.clone.sub(p),r.cylinderRadius*a*.3,i.color,o))}else if(r.aromaticbonds.hasOwnProperty(s)){var c,l,d;e.bonds.length>i.bonds.length?(c=e.serial,l=e.bonds[0],d=e.bonds[1]):(c=i.serial,l=i.bonds[0],d=i.bonds[1]);var h=r.atoms[c].coord.clone;h.sub(r.atoms[l].coord);var u=r.atoms[c].coord.clone;u.sub(r.atoms[d].coord),h.cross(u);var p=i.coord.clone;p.sub(e.coord),p.cross(h).normalize.multiplyScalar(.2*a);for(var m=0,g=0,f=e.bondOrder.length;f>g;++g)"1.5"===e.bondOrder[g]&&e.bonds[g]!==i.serial&&(m=e.bonds[g]);var v="add";if(0===m)v="add";else{var b=e.coord.clone.add(p),y=e.coord.clone.sub(p),E=i.coord.clone.sub(b).normalize,_=r.atoms[m].coord.clone.sub(b).normalize,w=i.coord.clone.sub(y).normalize,C=r.atoms[m].coord.clone.sub(y).normalize,S=Math.acos(E.dot(_)),k=Math.acos(w.dot(C));v=k>S?"sub":"add"}if(e.color===i.color){var R,T;"add"===v?(r.createCylinder(e.coord.clone.sub(p),i.coord.clone.sub(p),r.cylinderRadius*a*.3,e.color,o),R=e.coord.clone.add(p),T=i.coord.clone.add(p).sub(R).multiplyScalar(1/11)):(r.createCylinder(e.coord.clone.add(p),i.coord.clone.add(p),r.cylinderRadius*a*.3,e.color,o),R=e.coord.clone.sub(p),T=i.coord.clone.sub(p).sub(R).multiplyScalar(1/11));for(var g=0;10>=g;++g)if(g%2==0){var H=R.clone.add(T.clone.multiplyScalar(g)),A=R.clone.add(T.clone.multiplyScalar(g+1));r.createCylinder(H,A,r.cylinderRadius*a*.3,e.color,o)}}else{var R,T;"add"===v?(r.createCylinder(e.coord.clone.sub(p),n.clone.sub(p),r.cylinderRadius*a*.3,e.color,o),r.createCylinder(i.coord.clone.sub(p),n.clone.sub(p),r.cylinderRadius*a*.3,i.color,o),R=e.coord.clone.add(p),T=i.coord.clone.add(p).sub(R).multiplyScalar(1/11)):(r.createCylinder(e.coord.clone.add(p),n.clone.add(p),r.cylinderRadius*a*.3,e.color,o),r.createCylinder(i.coord.clone.add(p),n.clone.add(p),r.cylinderRadius*a*.3,i.color,o),R=e.coord.clone.sub(p),T=i.coord.clone.sub(p).sub(R).multiplyScalar(1/11));for(var g=0;10>=g;++g)if(g%2==0){var H=R.clone.add(T.clone.multiplyScalar(g)),A=R.clone.add(T.clone.multiplyScalar(g+1));5>g?r.createCylinder(H,A,r.cylinderRadius*a*.3,e.color,o):r.createCylinder(H,A,r.cylinderRadius*a*.3,i.color,o)}}}else if(r.triplebonds.hasOwnProperty(s)){var x=new THREE.Vector3(Math.random,Math.random,Math.random),O=i.coord.clone;O.sub(e.coord);var w=x.clone;w.cross(O).normalize.multiplyScalar(.3*a),e.color===i.color?(r.createCylinder(e.coord,i.coord,r.cylinderRadius*a*.2,e.color,o),r.createCylinder(e.coord.clone.add(w),i.coord.clone.add(w),r.cylinderRadius*a*.2,e.color,o),r.createCylinder(e.coord.clone.sub(w),i.coord.clone.sub(w),r.cylinderRadius*a*.2,e.color,o)):(r.createCylinder(e.coord,n,r.cylinderRadius*a*.2,e.color,o),r.createCylinder(i.coord,n,r.cylinderRadius*a*.2,i.color,o),r.createCylinder(e.coord.clone.add(w),n.clone.add(w),r.cylinderRadius*a*.2,e.color,o),r.createCylinder(i.coord.clone.add(w),n.clone.add(w),r.cylinderRadius*a*.2,i.color,o),r.createCylinder(e.coord.clone.sub(w),n.clone.sub(w),r.cylinderRadius*a*.2,e.color,o),r.createCylinder(i.coord.clone.sub(w),n.clone.sub(w),r.cylinderRadius*a*.2,i.color,o))}else e.color===i.color?r.createCylinder(e.coord,i.coord,t,e.color,o):(r.createCylinder(e.coord,n,t,e.color,o),r.createCylinder(i.coord,n,t,i.color,o))}):2===o&&this.createBoxRepresentation_P_CA(e,1.2,o)},createLineRepresentation:function(e,i){var t=new THREE.Geometry;if(this.createRepresentationSub(e,void 0,function(e,i){if(e.color===i.color)t.vertices.push(e.coord),t.vertices.push(i.coord),t.colors.push(e.color),t.colors.push(i.color);else{var n=e.coord.clone.add(i.coord).multiplyScalar(.5);t.vertices.push(e.coord),t.vertices.push(n),t.vertices.push(i.coord),t.vertices.push(n),t.colors.push(e.color),t.colors.push(e.color),t.colors.push(i.color),t.colors.push(i.color)}}),2!==i){var n;1===i||(n=new THREE.Line(t,new THREE.LineBasicMaterial({linewidth:this.linewidth,vertexColors:!0}),THREE.LinePieces)),this.mdl.add(n),1===i?this.prevHighlightObjects.push(n):this.objects.push(n)}else 2===i&&this.createBoxRepresentation_P_CA(e,.8,i)},subdivide:function(e,i,t,n){var o=[],s=[],r=new Array;r.push(e[0]);for(var a=1,c=e.length-1;c>a;++a){var l=e[a],d=e[a+1];r.push(l.smoothen?l.clone.add(d).multiplyScalar(.5):l)}r.push(e[e.length-1]);for(var h=[],u=[],a=-1,p=r.length,m=1/i;p-3>=a;++a){var l=r[-1===a?0:a],d=r[a+1],g=r[a+2],f=r[a===p-3?p-1:a+3],v=g.clone.sub(l).multiplyScalar(.5),b=f.clone.sub(d).multiplyScalar(.5);a>-1&&void 0!==t&&t[a+1]&&(o=o.concat(h),s=s.concat(u)),h=[],u=[];for(var y=0;i>y;++y){var E=m*y,_=d.x+E*v.x+E*E*(-3*d.x+3*g.x-2*v.x-b.x)+E*E*E*(2*d.x-2*g.x+v.x+b.x),w=d.y+E*v.y+E*E*(-3*d.y+3*g.y-2*v.y-b.y)+E*E*E*(2*d.y-2*g.y+v.y+b.y),C=d.z+E*v.z+E*E*(-3*d.z+3*g.z-2*v.z-b.z)+E*E*E*(2*d.z-2*g.z+v.z+b.z);t?(t[a+1]&&y<=parseInt(i/2)&&(o.push(new THREE.Vector3(_,w,C)),s.push(t[a+1])),t[a+2]&&y>parseInt(i/2)&&(h.push(new THREE.Vector3(_,w,C)),u.push(t[a+2]))):(o.push(new THREE.Vector3(_,w,C)),s.push(a+1))}}return(!t||t[a+1])&&(o=o.concat(h),s=s.concat(u),o.push(r[r.length-1]),s.push(r.length-1)),h=[],u=[],r=[],points_positions=[],points_positions.push(o),points_positions.push(s),points_positions},createCurveSubArrow:function(e,i,t,n,o,s,r,a,c,l,d){var h=[],u=[];h.push(e),u.push(a),this.prepareStrand(h,u,i,t,n,void 0,o,s,r,c,l,!1,d),h=[],u=[]},createCurveSub:function(e,i,t,n,o,s,r,a,c){if(0!==e.length){n=n||5;var l;if(l=r?e:this.subdivide(e,n,a,o)[0],0!==l.length){if(1===o){var d=this.coilWidth/2,h=4,u=!1;if(l.length>1)if(void 0!==c){for(var p,m,g=[],f=0,v=l.length;v>f;++f){if(p=c[f],p!==m&&p!==m+1&&void 0!==m||f===v-1){var b=new THREE.TubeGeometry(new THREE.SplineCurve3(g),g.length,d,h,u);mesh=new THREE.Mesh(b,this.matShader),this.mdl.add(mesh),this.prevHighlightObjects.push(mesh),b=null,g=[]}g.push(l[f]),m=p}g=[]}else{var b=new THREE.TubeGeometry(new THREE.SplineCurve3(l),l.length,d,h,u);mesh=new THREE.Mesh(b,this.matShader),this.mdl.add(mesh),this.prevHighlightObjects.push(mesh),b=null}}else{var y=new THREE.Geometry;if(2===o&&s)for(var f=0,E=1/n;f<l.length;++f)l[f].addScalar(.6),y.vertices.push(l[f]),y.colors.push(new THREE.Color(t[0===f?0:Math.round((f-1)*E)]));else for(var f=0,E=1/n;f<l.length;++f)y.vertices.push(l[f]),y.colors.push(new THREE.Color(t[0===f?0:Math.round((f-1)*E)]));var _=new THREE.Line(y,new THREE.LineBasicMaterial({linewidth:i,vertexColors:!0}),THREE.LineStrip);this.mdl.add(_),2===o?this.prevHighlightObjects.push(_):this.objects.push(_)}l=null}}},createLines:function(e){if(void 0!==e)for(var i in e)for(var t=e[i],n=0,o=t.length;o>n;++n){var s,r=t[n],a=r.position1,c=r.position2;if(r.color){var l=/^\#([0-9a-f]{6})$/i.exec(r.color);s=parseInt(l[1],16)}else s=16776960;var d=r.dashed?r.dashed:!1,h=.3;this.mdl.add(this.createSingleLine(a,c,s,d,h))}},createCylinderCurve:function(e,i,t,n,o){var s,r,a,c=null;for(a in e){var l=e[a]; if(!l.het&&l.name===i){if(null!==c&&s===l.chain&&r+1===l.resi){var d=c.coord.clone.add(l.coord).multiplyScalar(.5);if(o)1===o&&(this.createCylinder(c.coord,d,t,c.color,o),this.createCylinder(d,l.coord,t,l.color,o),this.createSphere(l,t,!0,1,o));else if(n){var h=this.createSingleLine(c.coord,d,c.color,!1);this.mdl.add(h),this.objects.push(h),h=this.createSingleLine(d,l.coord,l.color,!1),this.mdl.add(h),this.objects.push(h)}else this.createCylinder(c.coord,d,t,c.color),this.createCylinder(d,l.coord,t,l.color),this.createSphere(l,t,!0,1)}c=l,s=l.chain,r=l.resi,2===o&&this.createBox(l,void 0,void 0,void 0,void 0,o)}}if(null!==c&&s===l.chain&&r+1===l.resi){var d=c.coord.add(l.coord).multiplyScalar(.5);if(o)1===o&&(this.createCylinder(c.coord,d,t,c.color,o),this.createCylinder(d,l.coord,t,l.color,o),this.createSphere(l,t,!0,1,o));else if(n){var h=this.createSingleLine(c.coord,d,c.color,!1);this.mdl.add(h),this.objects.push(h),h=this.createSingleLine(d,l.coord,l.color,!1),this.mdl.add(h),this.objects.push(h)}else this.createCylinder(c.coord,d,t,c.color),this.createCylinder(d,l.coord,t,l.color)}},prepareStrand:function(e,i,t,n,o,s,r,a,c,l,d,h,u){if(1!==l.length){o=o||this.axisDIV;for(var p,m,g,f,v=2/(c-1),b={},y=[],E=0,_=i.length;_>E;++E)b[E]=[];var w=this.subdivide(l,o)[0];if(1!==w.length){for(var E=0,_=l.length-2;_>E;++E){for(var C=0,S=i.length;S>C;++C)b[C].push(e[C][E]);y.push(n[E])}y.push(n[E]);for(var E=0,_=i.length;_>E;++E)p=-1+v*i[E],m=w.length-1-o,g=l.length-2,f=new THREE.Vector3(w[m].x+d[g].x*p,w[m].y+d[g].y*p,w[m].z+d[g].z*p),b[E].push(f);for(var k=[],E=0,_=i.length;_>E;++E){var R=this.subdivide(b[E],o,u,r);b[E]=R[0],0===E&&(k=R[1])}h?this.createStrip(b[0],b[1],y,o,s,r,!0,void 0,k):this.createCurveSub(b[0],t,y,o,r,a,!0,void 0,k);for(var E in b){for(var T=0,H=b[E].length;H>T;++T)b[E][T]=null;b[E]=[]}y=[],k=[];for(var C=0,S=i.length;S>C;++C){b[C]=[];for(var E=o*(l.length-2),_=o*(l.length-1);u[parseInt(E/o)]&&_>E;E+=o)for(var A=parseInt(E/o),T=0;o>T;++T){var p=-1+v*i[C],x=1.8;p=p*x*(o-T)/o;var O=parseInt(E/o),f=new THREE.Vector3(w[E+T].x+d[O].x*p,w[E+T].y+d[O].y*p,w[E+T].z+d[O].z*p);f.smoothen=!0,b[C].push(f),0===C&&k.push(A)}var p=0,m=w.length-1,g=l.length-1,f=new THREE.Vector3(w[m].x+d[g].x*p,w[m].y+d[g].y*p,w[m].z+d[g].z*p);f.smoothen=!0,b[C].push(f),0===C&&k.push(m)}w=[],y.push(n[n.length-2]),y.push(n[n.length-1]),h?this.createStrip(b[0],b[1],y,o,s,r,!0,void 0,k):this.createCurveSub(b[0],t,y,o,r,a,!0,void 0,k);for(var E in b){for(var T=0,H=b[E].length;H>T;++T)b[E][T]=null;b[E]=[]}b={}}}},createStripArrow:function(e,i,t,n,o,s,r,a,c,l,d,h){var u=[],p=[];u.push(e),u.push(i),p.push(a),p.push(c),this.prepareStrand(u,p,void 0,t,n,o,s,void 0,r,l,d,!0,h),u=[],p=[]},createStrip:function(e,i,t,n,o,s,r,a,c){if(!(e.length<2||(n=n||this.axisDIV,r||(e=this.subdivide(e,n,a,s)[0],i=this.subdivide(i,n,a,s)[0]),e.length<2))){if(1===s){var l=this.coilWidth/2,d=4,h=!1;if(void 0!==c){for(var u,p,m=[],g=[],f=0,v=e.length;v>f;++f){if(u=c[f],u!==p&&u!==p+1&&void 0!==p||f===v-1){var b=new THREE.TubeGeometry(new THREE.SplineCurve3(m),m.length,l,d,h);I=new THREE.Mesh(b,this.matShader),this.mdl.add(I),this.prevHighlightObjects.push(I),b=null;var y=new THREE.TubeGeometry(new THREE.SplineCurve3(g),g.length,l,d,h);I=new THREE.Mesh(y,this.matShader),this.mdl.add(I),this.prevHighlightObjects.push(I),y=null,m=[],g=[]}m.push(e[f]),g.push(i[f]),p=u}m=[],g=[]}else{var b=new THREE.TubeGeometry(new THREE.SplineCurve3(e),e.length,l,d,h);I=new THREE.Mesh(b,this.matShader),this.mdl.add(I),this.prevHighlightObjects.push(I),b=null;var y=new THREE.TubeGeometry(new THREE.SplineCurve3(i),i.length,l,d,h);I=new THREE.Mesh(y,this.matShader),this.mdl.add(I),this.prevHighlightObjects.push(I),y=null}}else{for(var E,_,w,C,S,k=new THREE.Geometry,R=k.vertices,T=k.faces,f=0,H=e.length;H>f;++f)R.push(_=e[f]),R.push(_),R.push(w=i[f]),R.push(w),H-1>f&&(E=i[f].clone.sub(e[f]).cross(e[f+1].clone.sub(e[f])).normalize.multiplyScalar(o)),R.push(C=e[f].clone.add(E)),R.push(C),R.push(S=i[f].clone.add(E)),R.push(S);for(var A=0,2,-6,-8],[-4,-2,6,4],[7,3,-5,-1],[-3,-7,1,5,f=1,H=e.length,x=1/n;H>f;++f)for(var O=8*f,$=new THREE.Color(t[Math.round((f-1)*x)]),M=0;4>M;++M)T.push(new THREE.Face3(O+A[M][0],O+A[M][1],O+A[M][2],void 0,$)),T.push(new THREE.Face3(O+A[M][3],O+A[M][0],O+A[M][2],void 0,$));for(var L=R.length-8,f=0;4>f;++f)R.push(R[2*f]),R.push(R[L+2*f]);L+=8,T.push(new THREE.Face3(L,L+2,L+6,void 0,T[0].color)),T.push(new THREE.Face3(L+4,L,L+6,void 0,T[0].color)),T.push(new THREE.Face3(L+1,L+5,L+7,void 0,T[T.length-3].color)),T.push(new THREE.Face3(L+3,L+1,L+7,void 0,T[T.length-3].color)),k.computeFaceNormals,k.computeVertexNormals(!1);var I;2===s?(I=new THREE.Mesh(k,new THREE.MeshPhongMaterial({transparent:!0,opacity:.5,overdraw:this.overdraw,specular:this.fractionOfColor,shininess:30,emissive:0,vertexColors:THREE.FaceColors,side:THREE.DoubleSide})),this.mdl.add(I),this.prevHighlightObjects.push(I)):(I=new THREE.Mesh(k,new THREE.MeshPhongMaterial({overdraw:this.overdraw,specular:this.fractionOfColor,shininess:30,emissive:0,vertexColors:THREE.FaceColors,side:THREE.DoubleSide})),this.mdl.add(I),this.objects.push(I))}e=null,i=null}},getFirstAtomObj:function(e){var i=Object.keys(e),t=i[0];return this.atoms[t]},getLastAtomObj:function(e){var i=Object.keys(e),t=i[i.length-1];return this.atoms[t]},getResiduesFromAtoms:function(e){var i={};for(var t in e){var n=this.atoms[t].structure+"_"+this.atoms[t].chain+"_"+this.atoms[t].resi;i[n]=1}return i},createStrand:function(e,i,t,n,o,s,r,a,c){var l=n?!0:!1,d={};if(1!==c&&2!==c||this.bAllAtoms)d=e;else{var h,u,p,m,g,f,v,b,y=0,E=Object.keys(e).length;d=this.cloneHash(e);for(var _ in e){if(h=e[_].structure+"_"+e[_].chain,u=parseInt(e[_].resi),p=e[_],void 0===m&&(v=e[_]),h!==m&&void 0!==m||u!==g&&u!==g+1&&void 0!==g||y===E-1){h!==m&&void 0!==m||u!==g&&u!==g+1&&void 0!==g?b=f:y===E-1&&(b=p);var w=v.resi;if("coil"!==v.ss&&!v.ssbegin){for(var C=v.resi-1;C>0;--C){var S=v.structure+"_"+v.chain+"_"+C;if(!this.residues.hasOwnProperty(S))break;var k=this.getFirstAtomObj(this.residues[S]);if(k.ss===v.ss&&k.ssbegin){w=k.resi;break}}for(var C=w;C<v.resi;++C){var S=v.structure+"_"+v.chain+"_"+C;d=this.unionHash(d,this.hash2Atoms(this.residues[S]))}}if(3===this.picking&&1===c&&"coil"===v.ss){var S=v.structure+"_"+v.chain+"_"+(v.resi-1);this.residues.hasOwnProperty(S)&&(d=this.unionHash(d,this.hash2Atoms(this.residues[S])),e=this.unionHash(e,this.hash2Atoms(this.residues[S])))}var R=b.resi;if("coil"!==b.ss&&!b.ssend&&!b.notshow){for(var T=this.getLastAtomObj(this.chains[b.structure+"_"+b.chain]).resi,C=b.resi+1;T>=C;++C){var S=b.structure+"_"+b.chain+"_"+C;if(!this.residues.hasOwnProperty(S))break;var k=this.getFirstAtomObj(this.residues[S]);if(k.ss===b.ss&&k.ssend){R=k.resi;break}}for(var C=b.resi+1;R>=C;++C){var S=b.structure+"_"+b.chain+"_"+C;d=this.unionHash(d,this.hash2Atoms(this.residues[S]))}}if(3===this.picking&&1===c&&"coil"===b.ss){var S=b.structure+"_"+b.chain+"_"+(b.resi+1);this.residues.hasOwnProperty(S)&&(d=this.unionHash(d,this.hash2Atoms(this.residues[S])),e=this.unionHash(e,this.hash2Atoms(this.residues[S])))}b.notshow&&(b.notshow=void 0),v=p}m=h,g=u,f=p,++y}}2===c&&(n?(n=!1,i=null,t=null,o=null,s=null,a=void 0):(n=!0,i=2,t=void 0,o=void 0,s=void 0,a=this.thickness)),i=i||this.strandDIV,t=t||this.axisDIV,o=o||this.coilWidth,r=r||!1,s=s||this.helixSheetWidth;for(var H={},A=0;i>A;++A)H[A]=[];var x,O,$,k,M=[],L=[],I=[],D=[],z=null,N=null,q=null,j=null,P=null,F=null,B=null,V=null,G=!1,U=null,W=null,g=null,Y=!1,X=!1,Z={};this.bCalphaOnly=!1;var y=0,K=30,Q=!1;for(var C in d){if(!(K>y))break;if("CA"!==d[C].name){Q=!0;break}++y}Q||(this.bCalphaOnly=!0);var J={};for(var C in d){var k=d[C];S=k.structure+"_"+k.chain+"_"+k.resi,J[S]=1}var ee=Object.keys(J).length,ie=0,te=0;for(var C in d){k=d[C];if(("O"===k.name||"CA"===k.name)&&!k.het&&("CA"===k.name&&(e.hasOwnProperty(C)&&("coil"===k.ss||k.ssend||k.ssbegin)&&(Z[C]=k),z=k.coord,q=k.color),"O"===k.name||this.bCalphaOnly&&"CA"===k.name)){"O"===k.name&&(N=k.coord);var ne=!0;if((x!==k.chain||O+1!==k.resi)&&(ne=!1),k.ssend&&"sheet"===k.ss?Y=!0:k.ssend&&"helix"===k.ss&&(X=!0),P){1===c||2===c?D.push(this.highlightColor):D.push(F),$="coil"!==V&&"coil"===k.ss?o:G&&k.ssbegin?o:"coil"===V?o:s;var oe;"O"===k.name?(oe=P.clone,null!==j&&void 0!==j?oe.sub(j):(j=P.clone,oe=new THREE.Vector3(Math.random,Math.random,Math.random))):this.bCalphaOnly&&"CA"===k.name&&(oe=new THREE.Vector3(Math.random,Math.random,Math.random)),oe.normalize,oe.multiplyScalar($),null!==B&&oe.dot(B)<0&&oe.negate,B=oe;for(var se=0,re=2/(i-1);i>se;++se){var ae=-1+re*se,ce=new THREE.Vector3(j.x+B.x*ae,j.y+B.y*ae,j.z+B.z*ae);r||"sheet"!==V||(ce.smoothen=!0),H[se].push(ce)}M.push(j),L.push(B),e.hasOwnProperty(W)?(I.push(g),++te):I.push(0),++ie}if((k.ssbegin||k.ssend||ie===ee-1)&&H[0].length>0&&ne){1===c||2===c?D.push(this.highlightColor):D.push(k.color),$=k.ssend&&"sheet"===k.ss?0:"coil"===V&&k.ssbegin?o:G&&k.ssbegin?o:"coil"===k.ss?o:s;var oe;"O"===k.name?(oe=N.clone,oe.sub(z)):this.bCalphaOnly&&"CA"===k.name&&(oe=new THREE.Vector3(Math.random,Math.random,Math.random)),oe.normalize,oe.multiplyScalar($),null!==B&&oe.dot(B)<0&&oe.negate,B=oe;for(var se=0,re=2/(i-1);i>se;++se){var ae=-1+re*se,ce=new THREE.Vector3(z.x+B.x*ae,z.y+B.y*ae,z.z+B.z*ae);r||"sheet"!==V||(ce.smoothen=!0),H[se].push(ce)}U=k.serial,M.push(z),L.push(B),e.hasOwnProperty(U)?I.push(k.resi):I.push(0);for(var se=0;!n&&i>se;++se)Y?this.createCurveSubArrow(H[se],1,D,t,c,l,i,se,M,L,I):this.createCurveSub(H[se],1,D,t,c,l,!1,I);if(n)if(Y){var le=0,de=i-1;this.createStripArrow(H[0],H[i-1],D,t,a,c,i,le,de,M,L,I)}else X?this.createStrip(H[0],H[i-1],D,t,a,c,!1,I):2===c&&this.createStrip(H[0],H[i-1],D,t,a,c,!1,I);for(var A=0;i>A;++A)H[A]=[];D=[],M=[],L=[],I=[],Y=!1,X=!1}if((x!==k.chain||O+1!==k.resi)&&H[0].length>0){for(var se=0;!n&&i>se;++se)Y?this.createCurveSubArrow(H[se],1,D,t,c,l,i,se,M,L,I):X&&this.createCurveSub(H[se],1,D,t,c,l,!1,I);if(n)if(Y){var le=0,de=i-1;this.createStripArrow(H[0],H[i-1],D,t,a,c,i,le,de,M,L,I)}else X&&this.createStrip(H[0],H[i-1],D,t,a,c,!1,I);for(var A=0;i>A;++A)H[A]=[];D=[],M=[],L=[],I=[],Y=!1,X=!1}x=k.chain,O=k.resi,V=k.ss,G=k.ssend,W=k.serial,g=k.resi,j=z,P=k.coord,F=q}}this.createTube(Z,"CA",.3,c),Z={},H={}},createStrandBrick:function(e,i,t,n){var o=this.strandDIV,s=this.axisDIV,r=!1,a=this.helixSheetWidth;2===n&&(t*=1.5,a*=1.5);for(var c={},l=0;o>l;++l)c[l]=[];for(var d=[],h=null,u=0;2>u;++u){var p=e.coords[u];d.push(new THREE.Color(i));var m=new THREE.Vector3(e.coords[2].x,e.coords[2].y,e.coords[2].z);m.normalize,m.multiplyScalar(a),null!==h&&m.dot(h)<0&&m.negate,h=m;for(var g=0,f=2/(o-1);o>g;++g){var v=-1+f*g,b=new THREE.Vector3(p.x+h.x*v,p.y+h.y*v,p.z+h.z*v);r||(b.smoothen=!0),c[g].push(b)}}this.createStrip(c[0],c[o-1],d,s,t,n)},createTubeSub:function(e,i,t,n){if(!(e.length<2)){for(var o,s=this.tubeDIV,r=this.axisDIV,a=1/s,c=1/r,l=new THREE.Geometry,d=this.subdivide(e,r)[0],h=new THREE.Vector3,u=0,p=d.length;p>u;++u){var m,g=(u-1)*c;if(0===u)m=t[0];else if(g%1===0)m=t[g];else{var f=Math.floor(g),v=g-f;m=t[f]*v+t[f+1]*(1-v)}var b,y,E;p-1>u?(b=d[u].clone.sub(d[u+1]),y=new THREE.Vector3(0,-b.z,b.y).normalize.multiplyScalar(m),E=b.clone.cross(y).normalize.multiplyScalar(m),h.dot(y)<0&&(y.negate,E.negate),h=y,o=E):(y=h,E=o);for(var _=0;s>_;++_){var w=2*Math.PI*a*_;l.vertices.push(d[u].clone.add(y.clone.multiplyScalar(Math.cos(w))).add(E.clone.multiplyScalar(Math.sin(w))))}}for(var C=0,u=0,p=d.length-1;p>u;++u){var S=new THREE.Color(i[Math.round((u-1)*c)]),k=0,R=l.vertices[C].clone.sub(l.vertices[C+s]).lengthSq,T=l.vertices[C].clone.sub(l.vertices[C+s+1]).lengthSq;R>T&&(R=T,k=1);for(var _=0;s>_;++_)l.faces.push(new THREE.Face3(C+_,C+(_+k)%s+s,C+(_+1)%s,void 0,S)),l.faces.push(new THREE.Face3(C+(_+1)%s,C+(_+k)%s+s,C+(_+k+1)%s+s,void 0,S));C+=s}l.computeFaceNormals,l.computeVertexNormals(!1);var H;H=2===n?new THREE.Mesh(l,new THREE.MeshPhongMaterial({transparent:!0,opacity:.5,overdraw:this.overdraw,specular:this.fractionOfColor,shininess:30,emissive:0,vertexColors:THREE.FaceColors,side:THREE.DoubleSide})):1===n?new THREE.Mesh(l,this.matShader):new THREE.Mesh(l,new THREE.MeshPhongMaterial({overdraw:this.overdraw,specular:this.fractionOfColor,shininess:30,emissive:0,vertexColors:THREE.FaceColors,side:THREE.DoubleSide})),this.mdl.add(H),1===n||2===n?this.prevHighlightObjects.push(H):this.objects.push(H)}},createTube:function(e,i,t,n){var o,s,r=[],a=[],c=[];for(var l in e){var d=e[l];if(d.name===i&&!d.het){(o!==d.chain||s+1!==d.resi)&&(2!==n&&this.createTubeSub(r,a,c,n),r=[],a=[],c=[]),r.push(d.coord),c.push(t||(d.b>0?.01*d.b:.3)),a.push(d.color),o=d.chain,s=d.resi;var h=1.2;2!==n||d.ssbegin||this.createBox(d,void 0,void 0,h,void 0,n)}}2!==n&&this.createTubeSub(r,a,c,n)},createCylinderHelix:function(e,i,t){var n,o,s,r=null,a={},c={};for(s in e){var l=e[s];l.het||(("helix"!==l.ss&&"sheet"!==l.ss||l.ssend||l.ssbegin)&&(a[l.serial]=l),"sheet"===l.ss&&(c[l.serial]=l),"CA"===l.name&&("helix"===l.ss&&l.ssend&&(null!==r&&n===l.chain&&o<l.resi&&(1===t||2===t?this.createCylinder(r.coord,l.coord,i,this.highlightColor,t):this.createCylinder(r.coord,l.coord,i,l.color)),r=null),null===r&&"helix"===l.ss&&l.ssbegin&&(r=l,n=l.chain,o=l.resi)))}1===t||2===t?(Object.keys(a).length>0&&this.createTube(a,"CA",.3,t),Object.keys(c).length>0&&this.createStrand(c,void 0,void 0,!0,0,this.helixSheetWidth,!1,2*this.thickness,t)):(Object.keys(a).length>0&&this.createTube(a,"CA",.3),Object.keys(c).length>0&&this.createStrand(c,void 0,void 0,!0,0,this.helixSheetWidth,!1,2*this.thickness))},createSurfaceRepresentation:function(e,i,t,n){var o,s=this.getExtent(e),r=5,a=[];a=this.bConsiderNeighbors?Object.keys(this.unionHash(e,this.getAtomsWithinAtom(this.atoms,e,r))):Object.keys(e);var c=$3Dmol.SetupSurface({extent:s,allatoms:this.atoms,atomsToShow:Object.keys(e),extendedAtoms:a,type:i}),l=c.vertices,d=c.faces,h=this;o=new THREE.Geometry,o.vertices=l.map(function(e){var i=new THREE.Vector3(e.x,e.y,e.z);return i.atomid=e.atomid,i}),o.faces=d.map(function(e){return new THREE.Face3(e.a,e.b,e.c)}),c=null,l=null,d=null,o.computeFaceNormals,o.computeVertexNormals(!1),o.colorsNeedUpdate=!0,o.faces.forEach(function(e){e.vertexColors=["a","b","c"].map(function(i){var t=o.vertices[e[i]].atomid;return h.atoms[t].color})});var u=new THREE.Mesh(o,new THREE.MeshLambertMaterial({overdraw:h.overdraw,vertexColors:THREE.VertexColors,wireframe:t,opacity:n,transparent:!0}));h.mdl.add(u),this.prevSurfaces.push(u),o=null},drawNucleicAcidStick:function(e,i){var t,n,o,s=null,r=null;for(o in e){var a=e[o];void 0===a||a.het||((a.resi!==n||a.chain!==t)&&(null!==s&&null!==r&&this.createCylinder(new THREE.Vector3(s.coord.x,s.coord.y,s.coord.z),new THREE.Vector3(r.coord.x,r.coord.y,r.coord.z),.3,s.color,i),s=null,r=null),("O3'"===a.name||"O3*"===a.name)&&(s=a)," A"===a.resn||"  G"===a.resn||" DA"===a.resn||" DG"===a.resn?"N1"===a.name&&(r=a):"N3"===a.name&&(r=a),n=a.resi,t=a.chain)}null!==s&&null!==r&&this.createCylinder(new THREE.Vector3(s.coord.x,s.coord.y,s.coord.z),new THREE.Vector3(r.coord.x,r.coord.y,r.coord.z),.3,s.color,i)},drawCartoonNucleicAcid:function(e,i,t,n){this.drawStrandNucleicAcid(e,2,i,!0,void 0,t,n)},drawStrandNucleicAcid:function(e,i,t,n,o,s,r){2===r&&(i=void 0,s=void 0),o=o||this.nucleicAcidWidth,t=t||this.axisDIV,i=i||this.nucleicAcidStrandDIV;var a,c,l,d=[];for(l=0;i>l;l++)d[l]=[];var h,u,p,m=[],g=null;for(a in e){var f=e[a];if(void 0!==f&&("O3'"===f.name||"OP2"===f.name||"O3*"===f.name||"O2P"===f.name)&&!f.het)if("O3'"===f.name||"O3*"===f.name){if(h!==f.chain||u+1!==f.resi){if(p&&g)for(c=0;i>c;c++){var v=-1+2/(i-1)*c;d[c].push(new THREE.Vector3(p.x+g.x*v,p.y+g.y*v,p.z+g.z*v))}for(n&&this.createStrip(d[0],d[1],m,t,s,r),c=0;!s&&i>c;c++)this.createCurveSub(d[c],1,m,t,r);var d=[];for(l=0;i>l;l++)d[l]=[];m=[],g=null}p=new THREE.Vector3(f.coord.x,f.coord.y,f.coord.z),h=f.chain,u=f.resi,1===r||2===r?m.push(this.highlightColor):m.push(f.color)}else if("OP2"===f.name||"O2P"===f.name){if(!p){g=null;continue}var b=new THREE.Vector3(f.coord.x,f.coord.y,f.coord.z);for(b.sub(p),b.normalize.multiplyScalar(o),null!==g&&b.dot(g)<0&&b.negate,g=b,c=0;i>c;c++){var v=-1+2/(i-1)*c;d[c].push(new THREE.Vector3(p.x+g.x*v,p.y+g.y*v,p.z+g.z*v))}p=null}}if(p&&g)for(c=0;i>c;c++){var v=-1+2/(i-1)*c;d[c].push(new THREE.Vector3(p.x+g.x*v,p.y+g.y*v,p.z+g.z*v))}for(n&&this.createStrip(d[0],d[1],m,t,s,r),c=0;!s&&i>c;c++)this.createCurveSub(d[c],1,m,t,r)},drawSymmetryMates2:function{if(void 0!==this.biomtMatrices){for(var e=1,i=this.center.clone,t=0;t<this.biomtMatrices.length;t++){var n=this.biomtMatrices[t];if(void 0!==n){for(var o=n.toArray,s=1,r=0,a=o.length;a>r;++r)0==r||5==r||10==r?1e3!=parseInt(1e3*o[r])&&(s=0):0!=r&&5!=r&&10!=r&&15!=r&&0!=parseInt(1e3*o[r])&&(s=0);if(!s){var c=this.mdl.clone;c.applyMatrix(n);var l=this.center.clone;l.applyMatrix4(n),i.add(l),this.mdl.add(c),++e}}}this.maxD*=Math.sqrt(e),this.mdl.position.add(this.center).sub(i.multiplyScalar(1/e)),this.setCamera}},makeTextSprite:function(e,i){void 0===i&&(i={});var t=i.hasOwnProperty("fontface")?i.fontface:"Arial",n=i.hasOwnProperty("fontsize")?i.fontsize:18,o=i.hasOwnProperty("alpha")?i.alpha:1,s=!0,r=!1;i.hasOwnProperty("bSchematic")&&i.bSchematic&&(r=!0,n=40);var a,c,l;i.hasOwnProperty("backgroundColor")&&void 0!==i.backgroundColor?(a=this.hexToRgb(i.backgroundColor,o),c=i.hasOwnProperty("borderColor")?this.hexToRgb(i.borderColor,o):{r:0,g:0,b:0,a:1},l=i.hasOwnProperty("borderThickness")?i.borderThickness:4):(s=!1,a=void 0,c=void 0,l=0);var d=1,h=i.hasOwnProperty("textColor")&&void 0!==i.textColor?this.hexToRgb(i.textColor,d):{r:255,g:255,b:0,a:1},u=document.createElement("canvas"),p=u.getContext("2d");p.font="Bold "+n+"px "+t;var m=p.measureText(e),g=m.width,f=g+2*l,v=n+2*l;r&&(f>v?v=f:f=v);var b=6,y=15*this.maxD/100;(r||e.length<=b)&&(u.width=f,u.height=v,y=3*this.maxD/100),p.clearRect(0,0,f,v);p.measureText("M").width;if(s)if(p.fillStyle="rgba("+a.r+","+a.g+","+a.b+","+a.a+")",p.strokeStyle="rgba("+c.r+","+c.g+","+c.b+","+c.a+")",p.lineWidth=l,r){var E=.35*f;this.circle(p,0,0,f,v,E)}else{var E=e.length<=b?.5*v:0;this.roundRect(p,0,0,f,v,E)}p.font="Bold "+n+"px "+t,p.textAlign="center",p.textBaseline="middle",p.fillStyle="rgba("+h.r+", "+h.g+", "+h.b+", 1.0)",p.strokeStyle="rgba("+h.r+", "+h.g+", "+h.b+", 1.0)",p.fillText(e,.5*f,.5*v);var _=new THREE.Texture(u);_.needsUpdate=!0;var w=!0,C=new THREE.SpriteMaterial({map:_,useScreenCoordinates:!1,depthTest:!w,depthWrite:!w}),S=new THREE.Sprite(C),k=1.5;return r?S.scale.set(y,y,1):S.scale.set(k*y,y,1),S},hexToRgb:function(e,i){var t=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);return t?{r:parseInt(t[1],16),g:parseInt(t[2],16),b:parseInt(t[3],16),a:i}:null},roundRect:function(e,i,t,n,o,s){e.beginPath,e.moveTo(i+s,t),e.lineTo(i+n-s,t),e.quadraticCurveTo(i+n,t,i+n,t+s),e.lineTo(i+n,t+o-s),e.quadraticCurveTo(i+n,t+o,i+n-s,t+o),e.lineTo(i+s,t+o),e.quadraticCurveTo(i,t+o,i,t+o-s),e.lineTo(i,t+s),e.quadraticCurveTo(i,t,i+s,t),e.closePath,e.fill,e.stroke},circle:function(e,i,t,n,o,s){e.beginPath,e.arc(i+n/2,t+o/2,s,0,2*Math.PI,!0),e.closePath,e.fill,e.stroke},createLabelRepresentation:function(e){for(var i in e)for(var t=e[i],n=0,o=t.length;o>n;++n){var s=t[n],r=void 0!==s.size?s.size:this.LABELSIZE,a=void 0!==s.color?s.color:"#ffff00",c=void 0!==s.background?s.background:"#cccccc",l=void 0!==s.alpha?s.alpha:1;c=s.background,void 0!==a&&void 0!==c&&a.toLowerCase===c.toLowerCase&&(a="#888888");var d;if(void 0!==s.bSchematic&&s.bSchematic){var h=!1;if(Object.keys(this.proteins).length+Object.keys(this.nucleotides).length>0){var u=this.getFirstAtomObj(this.highlightAtoms);this.ligands.hasOwnProperty(u.serial)&&(h=!0)}var p=this.maxD;h&&(this.maxD=50,this.setCamera),d=this.makeTextSprite(s.text,{fontsize:parseInt(r),textColor:a,borderColor:c,backgroundColor:c,alpha:l,bSchematic:1}),h&&(this.maxD=p,this.setCamera)}else d=this.makeTextSprite(s.text,{fontsize:parseInt(r),textColor:a,borderColor:c,backgroundColor:c,alpha:l,bSchematic:0});d.position.set(s.position.x,s.position.y,s.position.z),this.mdl.add(d)}},getAtomsWithinAtom:function(e,i,t){var n=this.getExtent(i),o=(n[2][0]-n[0][0])*(n[2][0]-n[0][0])+(n[2][1]-n[0][1])*(n[2][1]-n[0][1])+(n[2][2]-n[0][2])*(n[2][2]-n[0][2]),s=(n[2][0]-n[1][0])*(n[2][0]-n[1][0])+(n[2][1]-n[1][1])*(n[2][1]-n[1][1])+(n[2][2]-n[1][2])*(n[2][2]-n[1][2]),r=o>s?o:s,a=Math.sqrt(r),c=(a+t)*(a+t),l={};for(var d in e){var h=e[d];if(!(h.serial in i||h.coord.x<n[0][0]-t||h.coord.x>n[1][0]+t||h.coord.y<n[0][1]-t||h.coord.y>n[1][1]+t||h.coord.z<n[0][2]-t||h.coord.z>n[1][2]+t)){var u=(h.coord.x-n[2][0])*(h.coord.x-n[2][0])+(h.coord.y-n[2][1])*(h.coord.y-n[2][1])+(h.coord.z-n[2][2])*(h.coord.z-n[2][2]);c>u&&(l[h.serial]=h)}}var p={};for(var d in i){var m=i[d],g=this.vdwRadii[m.elem]||this.defaultRadius;for(var f in l){var h=l[f],u=(h.coord.x-m.coord.x)*(h.coord.x-m.coord.x)+(h.coord.y-m.coord.y)*(h.coord.y-m.coord.y)+(h.coord.z-m.coord.z)*(h.coord.z-m.coord.z);c=(g+t)*(g+t),c>u&&(p[h.serial]=h)}}return p},getExtent:function(e){var i,t=ymin=zmin=9999,n=ymax=zmax=-9999,o=ysum=zsum=cnt=0;for(i in e){var s=e[i];cnt++,o+=s.coord.x,ysum+=s.coord.y,zsum+=s.coord.z,t=t<s.coord.x?t:s.coord.x,ymin=ymin<s.coord.y?ymin:s.coord.y,zmin=zmin<s.coord.z?zmin:s.coord.z,n=n>s.coord.x?n:s.coord.x,ymax=ymax>s.coord.y?ymax:s.coord.y,zmax=zmax>s.coord.z?zmax:s.coord.z}returnt,ymin,zmin],[n,ymax,zmax],[o/cnt,ysum/cnt,zsum/cnt},getAtomsFromPosition:function(e,i){var t,n;(void 0===i||null===i)&&(i=1);for(t in this.atoms){var n=this.atoms[t];if(!(n.coord.x<e.x-i||n.coord.x>e.x+i||n.coord.y<e.y-i||n.coord.y>e.y+i||n.coord.z<e.z-i||n.coord.z>e.z+i))return n}return null},buildAxes:function(e){var i=new THREE.Object3D;i.add(this.createSingleLine(new THREE.Vector3(0,0,0),new THREE.Vector3(0+e,0,0),16711680,!1,.5)),i.add(this.createSingleLine(new THREE.Vector3(0,0,0),new THREE.Vector3(0-e,0,0),8388608,!0,.5)),i.add(this.createSingleLine(new THREE.Vector3(0,0,0),new THREE.Vector3(0,0+e,0),65280,!1,.5)),i.add(this.createSingleLine(new THREE.Vector3(0,0,0),new THREE.Vector3(0,0-e,0),32768,!0,.5)),i.add(this.createSingleLine(new THREE.Vector3(0,0,0),new THREE.Vector3(0,0,0+e),255,!1,.5)),i.add(this.createSingleLine(new THREE.Vector3(0,0,0),new THREE.Vector3(0,0,0-e),128,!0,.5)),this.scene.add(i)},createSingleLine:function(e,i,t,n,o){var s,r=new THREE.Geometry;s=n?new THREE.LineDashedMaterial({linewidth:1,color:t,dashSize:o,gapSize:o}):new THREE.LineBasicMaterial({linewidth:1,color:t}),r.vertices.push(e),r.vertices.push(i),n&&r.computeLineDistances;var a=new THREE.Line(r,s,THREE.LinePieces);return a},intersectHash:function(e,i){var t={};if(Object.keys(e).length<Object.keys(i).length)for(var n in e)void 0!==i&&i[n]&&(t[n]=e[n]);else for(var n in i)void 0!==e&&e[n]&&(t[n]=i[n]);return e={},i={},t},excludeHash:function(e,i){var t={};for(var n in e)n in i||(t[n]=e[n]);return e={},i={},t},unionHash:function(e,i){var t=jQuery.extend({},e,i);return e={},i={},t},intersectHash2Atoms:function(e,i){return this.hash2Atoms(this.intersectHash(e,i))},excludeHash2Atoms:function(e,i){return this.hash2Atoms(this.excludeHash(e,i))},unionHash2Atoms:function(e,i){return this.hash2Atoms(this.unionHash(e,i))},hash2Atoms:function(e){var i={};for(var t in e)i[t]=this.atoms[t];return e={},i},centerAtoms:function(e){var i=new THREE.Vector3(9999,9999,9999),t=new THREE.Vector3(-9999,-9999,-9999),n=new THREE.Vector3,o=0;for(var s in e){var r=this.atoms[s],a=r.coord;n.add(a),i.min(a),t.max(a),++o}var c=t.distanceTo(i);return{center:n.multiplyScalar(1/o),maxD:c}},exportCanvas:function{this.render,window.open(this.renderer.domElement.toDataURL("image/png"))},applyPrevColor:function{for(var e in this.atoms){var i=this.atoms[e];i.color=this.atomPrevColors[e]}},applyOriginalColor:function{for(var e in this.atoms){var i=this.atoms[e],t=i.structure+"_"+i.chain;this.chainsColor.hasOwnProperty(t)?i.color=this.chainsColor[t]:i.color=this.atomColors[i.elem]}},setColorByOptions:function(e,i,t){if(void 0!==e)if(void 0!==t&&t)for(var n in i){var o=this.atoms[n];this.atomPrevColors[n]=o.color}else if(0===e.color.indexOf("#"))for(var n in i){var o=this.atoms[n];o.color=(new THREE.Color).setStyle(e.color.toLowerCase),this.atomPrevColors[n]=o.color}else switch(e.color.toLowerCase){case"spectrum":var s=0,r=1/this.cnt;for(var n in i){var o=this.atoms[n];o.color=o.het?this.atomColors[o.elem]||this.defaultAtomColor:(new THREE.Color).setHSL(2/3*(1-s++*r),1,.45),this.atomPrevColors[n]=o.color}break;case"chain":var a=-1,c="",l=this.stdChainColors.length;for(var n in i){var o=this.atoms[n];o.chain!=c&&(++a,a%=l),o.color=this.stdChainColors[a],Object.keys(this.chainsColor).length>0&&this.updateChainsColor(o),this.atomPrevColors[n]=o.color,c=o.chain}break;case"secondary structure":for(var n in i){var o=this.atoms[n];o.color=o.het?this.atomColors[o.elem]||this.defaultAtomColor:this.ssColors[o.ss],this.atomPrevColors[n]=o.color}break;case"residue":for(var n in i){var o=this.atoms[n];o.color=o.het?this.atomColors[o.elem]||this.defaultAtomColor:this.residueColors[o.resn]||this.defaultResidueColor,this.atomPrevColors[n]=o.color}break;case"charge":for(var n in i){var o=this.atoms[n];o.color=o.het?this.defaultAtomColor:this.chargeColors[o.resn]||this.defaultResidueColor,this.atomPrevColors[n]=o.color}break;case"hydrophobic":for(var n in i){var o=this.atoms[n];o.color=o.het?this.defaultAtomColor:this.hydrophobicColors[o.resn]||this.defaultResidueColor,this.atomPrevColors[n]=o.color}break;case"atom":for(var n in i){var o=this.atoms[n];o.color=this.atomColors[o.elem]||this.defaultAtomColor,this.atomPrevColors[n]=o.color}break;case"conserved":for(var n in i){var o=this.atoms[n];o.color=this.defaultAtomColor,this.atomPrevColors[n]=o.color}for(var d in this.alignChainsSeq)for(var h=this.alignChainsSeq[d],n=0,u=h.length;u>n;++n){var p=d+"_"+h[n].resi;for(var m in this.residues[p])if(i.hasOwnProperty(m)){var g=new THREE.Color(h[n].color);this.atoms[m].color=g,this.atomPrevColors[m]=g}}break;case"white":for(var n in i){var o=this.atoms[n];o.color=(new THREE.Color).setHex(16777215),this.atomPrevColors[n]=o.color}break;case"grey":for(var n in i){var o=this.atoms[n];o.color=(new THREE.Color).setHex(8947848),this.atomPrevColors[n]=o.color}break;case"red":for(var n in i){var o=this.atoms[n];o.color=(new THREE.Color).setHex(16711680),this.atomPrevColors[n]=o.color}break;case"green":for(var n in i){var o=this.atoms[n];o.color=(new THREE.Color).setHex(65280),this.atomPrevColors[n]=o.color}break;case"blue":for(var n in i){var o=this.atoms[n];o.color=(new THREE.Color).setHex(255),this.atomPrevColors[n]=o.color}break;case"magenta":for(var n in i){var o=this.atoms[n];o.color=(new THREE.Color).setHex(16711935),this.atomPrevColors[n]=o.color}break;case"yellow":for(var n in i){var o=this.atoms[n];o.color=(new THREE.Color).setHex(16776960),this.atomPrevColors[n]=o.color}break;case"cyan":for(var n in i){var o=this.atoms[n];o.color=(new THREE.Color).setHex(65535),this.atomPrevColors[n]=o.color}break;case"custom":}},updateChainsColor:function(e){var i=e.structure+"_"+e.chain;void 0!==this.chainsColor[i]&&(this.chainsColor[i]=e.color)},drawHelixBrick:function(e,i,t){for(var n in e)for(var o=0,s=e[n].length;s>o;++o)if("helix"===e[n][o].type){var r=1.6,a=new THREE.Color(i[n]),c=new THREE.Vector3(e[n][o].coords[0].x,e[n][o].coords[0].y,e[n][o].coords[0].z),l=new THREE.Vector3(e[n][o].coords[1].x,e[n][o].coords[1].y,e[n][o].coords[1].z);this.createCylinder(c,l,r,a,t)}else if("brick"===e[n][o].type){var d=e[n][o],a=i[n];this.createStrandBrick(d,a,this.thickness,t)}else if("coil"===e[n][o].type){var c=new THREE.Vector3(e[n][o].coords[0].x,e[n][o].coords[0].y,e[n][o].coords[0].z),l=new THREE.Vector3(e[n][o].coords[1].x,e[n][o].coords[1].y,e[n][o].coords[1].z),a=new THREE.Color(i[n]),h=this.createSingleLine(c,l,a,!1);this.mdl.add(h),this.objects.push(h)}},applyOtherOptions:function(e){if(void 0===e&&(e=this.options),this.createLabelRepresentation(this.labels),"yes"===e.hbonds.toLowerCase){var i="#FFFFFF";"black"!==e.background.toLowerCase&&(i="#000000");for(var t=0,n=Math.floor(this.hbondpoints.length/2);n>t;t++){var o=(this.hbondpoints[2*t],this.hbondpoints[2*t+1],{});o.position1=this.hbondpoints[2*t],o.position2=this.hbondpoints[2*t+1],o.color=i,o.dashed=!0,void 0===this.lines.hbond&&(this.lines.hbond=[]),this.lines.hbond.push(o)}this.createLines(this.lines)}else this.createLines(this.lines);for(var t=0,s=this.prevSurfaces.length;s>t;++t)this.mdl.add(this.prevSurfaces[t]);switch(e.rotationcenter.toLowerCase){case"molecule center":void 0!==this.center&&this.mdl.position.sub(this.center);break;case"pick center":void 0!==this.pickedatom&&this.mdl.position.sub(this.pickedatom.coord);break;case"display center":var r=this.centerAtoms(this.displayAtoms).center;this.mdl.position.sub(r);break;case"highlight center":var r=this.centerAtoms(this.highlightAtoms).center;this.mdl.position.sub(r)}switch(e.axis.toLowerCase){case"yes":this.axis=!0,this.buildAxes(this.maxD/2);break;case"no":this.axis=!1}switch(e.picking.toLowerCase){case"atom":this.picking=1;break;case"no":this.picking=0;break;case"residue":this.picking=2;break;case"strand":this.picking=3}},applySurfaceOptions:function(e){switch(void 0===e&&(e=this.options),e.wireframe){case"yes":e.wireframe=!0;break;case"no":e.wireframe=!1}e.opacity=parseFloat(e.opacity);var i={};switch(i=this.hash2Atoms(this.highlightAtoms),e.surface.toLowerCase){case"van der waals surface":this.createSurfaceRepresentation(i,1,e.wireframe,e.opacity);break;case"solvent accessible surface":this.createSurfaceRepresentation(i,3,e.wireframe,e.opacity);break;case"molecular surface":this.createSurfaceRepresentation(i,2,e.wireframe,e.opacity);break;case"nothing":this.removeSurfaces}},applyDisplayOptions:function(e,i,t){void 0===e&&(e=this.options);var n,o={},s={},r={};if(1===t&&Object.keys(i).length<Object.keys(this.atoms).length){r=this.hash2Atoms(i);for(var a in r){var c=r[a];n=c.structure+"_"+c.chain+"_"+c.resi,o[n]=1}for(var a in o){var l=a.lastIndexOf("_"),d=a.substr(0,l+1),h=parseInt(a.substr(l+1)),u=d+(h-1).toString,p=d+(h+1).toString;o.hasOwnProperty(u)||o.hasOwnProperty(u)||(s[a]=1)}if(1===Object.keys(r).length&&Object.keys(this.residues[n]).length>1&&"sphere"!==r[Object.keys(r)[0]].style&&"dot"!==r[Object.keys(r)[0]].style){if(void 0===this.bCid||!this.bCid)for(var a in r){var c=r[a],m=1;this.createBox(c,void 0,void 0,m,void 0,t)}}else for(var n in s){var c=this.getFirstAtomObj(this.residues[n]),u=c.structure+"_"+c.chain+"_"+parseInt(c.resi-1),p=c.structure+"_"+c.chain+"_"+parseInt(c.resi+1);if("cylinder and plate"===c.style&&"helix"===c.ss)for(var a in this.residues[n]){var c=this.atoms[a],m=1;this.createBox(c,void 0,void 0,m,void 0,t)}else if("ribbon"===c.style&&"coil"===c.ss||"strand"===c.style&&"coil"===c.ss||"phosphorus trace"===c.style||"schematic"===c.style||"c alpha trace"===c.style||"b factor tube"===c.style||"cylinder and plate"===c.style&&"helix"!==c.ss){var g=!1;if(!g&&this.residues.hasOwnProperty(p)){var f=Object.keys(this.residues[p])[0],v=this.hash2Atoms(this.residues[p])[f];if(c.style===v.style&&!v.ssbegin||v.ssbegin){var b=this.residues[p];if(i=this.unionHash(i,b),g=!0,v.ssbegin)for(var a in b)this.atoms[a].notshow=!0}}if(!g&&this.residues.hasOwnProperty(u)){var f=Object.keys(this.residues[u])[0],v=this.hash2Atoms(this.residues[u])[f];c.style===v.style&&(i=this.unionHash(i,this.residues[u]),g=!0)}}else if("ribbon"===c.style&&"coil"!==c.ss&&c.ssend||"strand"===c.style&&"coil"!==c.ss&&c.ssend){var g=!1;if(!g&&this.residues.hasOwnProperty(p)){var f=Object.keys(this.residues[p])[0],v=this.hash2Atoms(this.residues[p])[f];i=this.unionHash(i,this.residues[p]),g=!0}}}r={}}this.setStyle2Atoms(i),this.bAllAtoms=Object.keys(i).length===Object.keys(this.atoms).length;var y={};"nothing"!==this.options.sidechains&&(y=this.intersectHash(i,this.calphas)), this.labels.schematic=[];var E=.5*this.cylinderRadius;for(var _ in this.style2atoms)if(atomHash=this.style2atoms[_],"ribbon"===_)this.createStrand(this.hash2Atoms(atomHash),2,void 0,!0,void 0,void 0,!1,this.thickness,t);else if("strand"===_)this.createStrand(this.hash2Atoms(atomHash),null,null,null,null,null,!1,void 0,t);else if("cylinder and plate"===_)this.createCylinderHelix(this.hash2Atoms(atomHash),1.6,t);else if("nucleotide cartoon"===_)this.drawCartoonNucleicAcid(this.hash2Atoms(atomHash),null,this.thickness,t),2!==t&&this.drawNucleicAcidStick(this.hash2Atoms(atomHash),t);else if("phosphorus trace"===_)this.createCylinderCurve(this.hash2Atoms(atomHash),"P",.2,!1,t);else if("phosphorus lines"===_)this.createCylinderCurve(this.hash2Atoms(atomHash),"P",.2,!0,t);else if("schematic"===_){var w=this.getFirstAtomObj(atomHash);this.ligands.hasOwnProperty(w.serial)?(this.addNonCarbonAtomLabels(this.hash2Atoms(atomHash)),bSchematic=!0,this.createStickRepresentation(this.hash2Atoms(atomHash),E,E,void 0,t,bSchematic)):(this.addResiudeLabels(this.hash2Atoms(atomHash),!0),this.createCylinderCurve(this.hash2Atoms(atomHash),"P",.2,!1,t),this.createCylinderCurve(this.hash2Atoms(atomHash),"CA",.2,!1,t))}else"c alpha trace"===_?this.createCylinderCurve(this.hash2Atoms(atomHash),"CA",.2,!1,t):"b factor tube"===_?this.createTube(this.hash2Atoms(atomHash),"CA",null,t):"lines"===_?("lines"===this.options.sidechains&&(atomHash=this.unionHash(atomHash,y)),1===t?this.createStickRepresentation(this.hash2Atoms(atomHash),.1,.1,void 0,t):this.createLineRepresentation(this.hash2Atoms(atomHash),t)):"stick"===_?("stick"===this.options.sidechains&&(atomHash=this.unionHash(atomHash,y)),this.createStickRepresentation(this.hash2Atoms(atomHash),this.cylinderRadius,this.cylinderRadius,void 0,t)):"ball and stick"===_?("ball and stick"===this.options.sidechains&&(atomHash=this.unionHash(atomHash,y)),this.createStickRepresentation(this.hash2Atoms(atomHash),this.cylinderRadius,.5*this.cylinderRadius,.3,t)):"sphere"===_?this.createSphereRepresentation(this.hash2Atoms(atomHash),this.sphereRadius,void 0,void 0,t):"dot"===_&&this.createSphereRepresentation(this.hash2Atoms(atomHash),this.sphereRadius,!1,.3,t)},setStyle2Atoms:function(e){this.style2atoms={};for(var i in e)void 0===this.style2atoms[this.atoms[i].style]&&(this.style2atoms[this.atoms[i].style]={}),this.style2atoms[this.atoms[i].style][i]=1},setAtomStyleByOptions:function(e){void 0===e&&(e=this.options);var i;if(void 0!==e.proteins){i=this.intersectHash(this.highlightAtoms,this.proteins);for(var t in i)this.atoms[t].style=e.proteins.toLowerCase}if(void 0!==e.sidechains){i=this.intersectHash(this.highlightAtoms,this.sidechains);for(var t in i)this.atoms[t].style=e.sidechains.toLowerCase}if(void 0!==e.ligands){i=this.intersectHash(this.highlightAtoms,this.ligands);for(var t in i)this.atoms[t].style=e.ligands.toLowerCase}if(void 0!==e.ions){i=this.intersectHash(this.highlightAtoms,this.ions);for(var t in i)this.atoms[t].style=e.ions.toLowerCase}if(void 0!==e.water){i=this.intersectHash(this.highlightAtoms,this.water);for(var t in i)this.atoms[t].style=e.water.toLowerCase}if(void 0!==e.nucleotides){i=this.intersectHash(this.highlightAtoms,this.nucleotides);for(var t in i)this.atoms[t].style=e.nucleotides.toLowerCase}},rebuildScene:function(e){var i=this;if(jQuery.extend(i.options,e),this.camera_z=2*-this.maxD,void 0!==this.scene)for(var t=this.scene.children.length-1;t>=0;t--){var n=this.scene.children[t];this.scene.remove(n)}else this.scene=new THREE.Scene;this.directionalLight=new THREE.DirectionalLight(16777215,1.2),this.camera_z>0?this.directionalLight.position.set(0,0,1):this.directionalLight.position.set(0,0,-1);var o=new THREE.AmbientLight(2105376);this.scene.add(this.directionalLight),this.scene.add(o),this.mdl=new THREE.Object3D,this.scene.add(this.mdl),this.objects=[],this.raycaster=new THREE.Raycaster,this.projector=new THREE.Projector,this.mouse=new THREE.Vector2;var s=this.backgroundColors[this.options.background.toLowerCase];this.renderer.setClearColor(s),"yes"===this.options.fog?"perspective"===this.options.camera?this.scene.fog=new THREE.Fog(s,2*this.maxD,2.4*this.maxD):"orthographic"===this.options.camera&&(this.scene.fog=new THREE.FogExp2(s,2),this.scene.fog.near=2*this.maxD,this.scene.fog.far=2.4*this.maxD):this.scene.fog=void 0,this.perspectiveCamera=new THREE.PerspectiveCamera(20,this.container.whratio,.1,1e4),this.perspectiveCamera.position.set(0,0,this.camera_z),this.perspectiveCamera.lookAt(new THREE.Vector3(0,0,0)),this.orthographicCamera=new THREE.OrthographicCamera,this.orthographicCamera.position.set(0,0,this.camera_z),this.orthographicCamera.lookAt(new THREE.Vector3(0,0,0)),this.cameras={perspective:this.perspectiveCamera,orthographic:this.orthographicCamera},this.setCamera,this.applyDisplayOptions(this.options,this.displayAtoms),this.applyOtherOptions},setCamera:function{this.camera=this.cameras[this.options.camera.toLowerCase],this.camera===this.perspectiveCamera?(this.camera_z>0?this.camera.position.z=2*this.maxD:this.camera.position.z=2*-this.maxD,"yes"===this.options.slab?this.camera.near=2*this.maxD:this.camera.near=.1,this.camera.far=1e4,this.controls=new THREE.TrackballControls(this.camera,document.getElementById(this.id),this)):this.camera===this.orthographicCamera&&(this.camera.right=this.maxD/2*2.5,this.camera.left=-this.camera.right,this.camera.top=this.camera.right/this.container.whratio,this.camera.bottom=-this.camera.right/this.container.whratio,this.camera_z>0?("yes"===this.options.slab?this.camera.near=2*-this.maxD:this.camera.near=0,this.camera.far=-1e4):("yes"===this.options.slab?this.camera.near=2*this.maxD:this.camera.near=0,this.camera.far=1e4),this.controls=new THREE.OrthographicTrackballControls(this.camera,document.getElementById(this.id),this)),this.camera.updateProjectionMatrix},applyTransformation:function(e,i,t){var n={};n.update=!1,n._zoomFactor=e,n.mouseChange=new THREE.Vector2,n.mouseChange.copy(i),n.quaternion=new THREE.Quaternion,n.quaternion.copy(t),this.controls.update(n)},render:function{this.directionalLight.position.copy(this.camera.position),this.renderer.gammaInput=!0,this.renderer.gammaOutput=!0,this.renderer.setPixelRatio(window.devicePixelRatio),this.renderer.render(this.scene,this.camera)},setRotationCenter:function(e){this.mdl.position.sub(e)},draw:function(e,i){this.rebuildScene(e),(void 0===i||i)&&this.applyPrevColor,this.bSSOnly&&this.drawHelixBrick(this.molid2ss,this.molid2color),this.bAssembly&&this.drawSymmetryMates2,void 0!==this.highlightAtoms&&Object.keys(this.highlightAtoms).length>0&&Object.keys(this.highlightAtoms).length<Object.keys(this.atoms).length&&(this.removeHighlightObjects,(void 0===this.bShowHighlight||this.bShowHighlight)&&this.addHighlightObjects),this.bRender===!0&&(this.applyTransformation(this._zoomFactor,this.mouseChange,this.quaternion),this.render)},zoomIn:function(e){var i={};i._zoomFactor=1-e,i.update=!0,this.controls.update(i),this.render},zoomOut:function(e){var i={};i._zoomFactor=1+e,i.update=!0,this.controls.update(i),this.render},rotateLeft:function(e){var i=new THREE.Vector3(0,1,0),t=-e/180*Math.PI;i.applyQuaternion(this.camera.quaternion).normalize;var n=new THREE.Quaternion;n.setFromAxisAngle(i,-t);var o={};o.quaternion=n,o.update=!0,this.controls.update(o),this.render},rotateRight:function(e){var i=new THREE.Vector3(0,1,0),t=e/180*Math.PI;i.applyQuaternion(this.camera.quaternion).normalize;var n=new THREE.Quaternion;n.setFromAxisAngle(i,-t);var o={};o.quaternion=n,o.update=!0,this.controls.update(o),this.render},rotateUp:function(e){var i=new THREE.Vector3(1,0,0),t=-e/180*Math.PI;i.applyQuaternion(this.camera.quaternion).normalize;var n=new THREE.Quaternion;n.setFromAxisAngle(i,-t);var o={};o.quaternion=n,o.update=!0,this.controls.update(o),this.render},rotateDown:function(e){var i=new THREE.Vector3(1,0,0),t=e/180*Math.PI;i.applyQuaternion(this.camera.quaternion).normalize;var n=new THREE.Quaternion;n.setFromAxisAngle(i,-t);var o={};o.quaternion=n,o.update=!0,this.controls.update(o),this.render},translateLeft:function(e){var i=new THREE.Vector2(0,0);i.x-=e/100;var t={};t.mouseChange=i,t.update=!0,this.controls.update(t),this.render},translateRight:function(e){var i=new THREE.Vector2(0,0);i.x+=e/100;var t={};t.mouseChange=i,t.update=!0,this.controls.update(t),this.render},translateUp:function(e){var i=new THREE.Vector2(0,0);i.y-=e/100;var t={};t.mouseChange=i,t.update=!0,this.controls.update(t),this.render},translateDown:function(e){var i=new THREE.Vector2(0,0);i.y+=e/100;var t={};t.mouseChange=i,t.update=!0,this.controls.update(t),this.render},selectStrandHelixFromAtom:function(e){for(var i=e,t=e,n={},o=i.resi,s=i.resi-1;s>0;--s){var r=i.structure+"_"+i.chain+"_"+s;if(!this.residues.hasOwnProperty(r))break;var e=this.getFirstAtomObj(this.residues[r]);if(o=e.resi,"coil"!==i.ss&&e.ss===i.ss&&e.ssbegin||"coil"===i.ss&&e.ss!==i.ss){"coil"===i.ss&&e.ss!==i.ss&&(o=e.resi+1);break}}for(var s=o;s<=i.resi;++s){var r=i.structure+"_"+i.chain+"_"+s;n=this.unionHash(n,this.hash2Atoms(this.residues[r]))}for(var a=t.resi,c=this.getLastAtomObj(this.chains[t.structure+"_"+t.chain]).resi,s=t.resi+1;c>=s;++s){var r=t.structure+"_"+t.chain+"_"+s;if(!this.residues.hasOwnProperty(r))break;var e=this.getFirstAtomObj(this.residues[r]);if(a=e.resi,"coil"!==t.ss&&e.ss===t.ss&&e.ssend||"coil"===t.ss&&e.ss!==t.ss){"coil"===t.ss&&e.ss!==t.ss&&(a=e.resi-1);break}}for(var s=t.resi+1;a>=s;++s){var r=t.structure+"_"+t.chain+"_"+s;n=this.unionHash(n,this.hash2Atoms(this.residues[r]))}return n},showPickingBase:function(e){if(this.bShiftKey||this.bCtrlKey||this.removeHighlightObjects,this.pickedAtomList={},1===this.picking)this.pickedAtomList[e.serial]=1;else if(2===this.picking){var i=e.structure+"_"+e.chain+"_"+e.resi;this.pickedAtomList=this.residues[i]}else 3===this.picking&&(this.pickedAtomList=this.selectStrandHelixFromAtom(e));if(0===this.picking?this.bShowHighlight=!1:this.bShowHighlight=!0,this.bShiftKey||this.bCtrlKey){if(this.bShiftKey){var t=this.getFirstAtomObj(this.highlightAtoms).serial,n=this.getLastAtomObj(this.highlightAtoms).serial,o=this.getFirstAtomObj(this.pickedAtomList).serial,s=this.getLastAtomObj(this.pickedAtomList).serial,r=o>n?n:s,a=o>n?s+1:t,c="";if(o>n)for(var l=r+1;a>l;++l){var d=this.atoms[l].structure+"_"+this.atoms[l].chain;if(l!==r+1&&d!==c)break;this.highlightAtoms[l]=1,c=d}else for(var l=a-1;l>r;--l){var d=this.atoms[l].structure+"_"+this.atoms[l].chain;if(l!==a-1&&d!==c)break;this.highlightAtoms[l]=1,c=d}}this.bCtrlKey&&(this.highlightAtoms=this.unionHash(this.highlightAtoms,this.pickedAtomList))}else this.highlightAtoms=this.cloneHash(this.pickedAtomList);this.addHighlightObjects},showPicking:function(e){this.showPickingBase(e);var i="."+e.chain+":"+e.resi,t=i+"@"+e.name,n=[],o={};o.position=e.coord,1===this.picking?o.text=t:2===this.picking?o.text=i:3===this.picking&&(o.text=i),n.push(o),this.createLabelRepresentation(n)},removeHighlightObjects:function{for(var e in this.prevHighlightObjects)this.mdl.remove(this.prevHighlightObjects[e]);this.prevHighlightObjects=[]},addHighlightObjects:function(e,i,t){void 0===e&&(e=this.highlightColor),void 0===t&&(t=this.highlightAtoms),this.applyDisplayOptions(this.options,this.intersectHash(t,this.displayAtoms),this.bHighlight),(void 0===i||i)&&this.render},removeSurfaces:function{for(var e=0,i=this.prevSurfaces.length;i>e;++e)this.mdl.remove(this.prevSurfaces[e]);this.prevSurfaces=[]},removeLastSurface:function{this.prevSurfaces.length>0&&(this.mdl.remove(this.prevSurfaces[this.prevSurfaces.length-1]),this.prevSurfaces.slice(this.prevSurfaces.length-1,1))},zoominSelection:function{if(Object.keys(this.highlightAtoms).length>1){var e=this.centerAtoms(this.hash2Atoms(this.highlightAtoms));this.maxD=e.maxD,this.maxD<25&&(this.maxD=25),this.mdl.position.add(this.center).sub(e.center),this.center=e.center,this.setCamera}this.draw},centerSelection:function{if(Object.keys(this.highlightAtoms).length>1){var e=this.centerAtoms(this.hash2Atoms(this.highlightAtoms));this.mdl.position.add(this.center).sub(e.center),this.center=e.center,this.setCamera}this.draw},resetOrientation:function{if(this.commands.length>0){var e=this.commands[0].split("|||");if(2==e.length){var i=JSON.parse(e[1]);this._zoomFactor=i.factor,this.mouseChange.x=i.mouseChange.x,this.mouseChange.y=i.mouseChange.y,this.quaternion._x=i.quaternion._x,this.quaternion._y=i.quaternion._y,this.quaternion._z=i.quaternion._z,this.quaternion._w=i.quaternion._w,this.maxD=this.oriMaxD,this.center=this.oriCenter.clone,this.draw}}},addNonCarbonAtomLabels:function(e){var i=18,t="#FFFFFF",n=this.intersectHash(this.highlightAtoms,e);void 0===this.labels.schematic&&(this.labels.schematic=[]);for(var o in n){var s=this.atoms[o];if(this.residues.hasOwnProperty(s.structure+"_"+s.chain+"_"+s.resi)&&"C"!==s.elem){var r={};r.position=s.coord,r.bSchematic=1,r.text=s.elem,r.size=i,r.color="#"+s.color.getHexString,r.background=t,this.labels.schematic.push(r)}}this.removeHighlightObjects},addResiudeLabels:function(e,i){var t=18,n="#CCCCCC",o=this.intersectHash(this.highlightAtoms,e);i?void 0===this.labels.schematic&&(this.labels.schematic=[]):void 0===this.labels.residue&&(this.labels.residue=[]);var s="";for(var r in o){var a=this.atoms[r];if(!a.het){var c={},l=a.structure+"_"+a.chain+"_"+a.resi;if("CA"===a.name||"P"===a.name||this.water.hasOwnProperty(a.serial)||this.ions.hasOwnProperty(a.serial)||this.ligands.hasOwnProperty(a.serial)&&l!==s){c.position=a.coord,c.bSchematic=0,i&&(c.bSchematic=1),c.text=this.residueName2Abbr(a.resn),c.size=t;var d=a.color.getHexString.toUpperCase;c.color="CCCCCC"===d||"C8C8C8"===d?"#888888":"#"+d,c.background=n,i?this.labels.schematic.push(c):this.labels.residue.push(c)}s=l}}this.removeHighlightObjects},switchHighlightLevelBase:function{var e=this;$(document).bind("keydown",function(i){if(38===i.keyCode){if(i.preventDefault,e.bShiftKey||e.bCtrlKey||e.removeHighlightObjects,1===e.highlightlevel){e.highlightlevel=2;var t=e.getFirstAtomObj(e.pickedAtomList);e.bShiftKey||e.bCtrlKey?e.highlightAtoms=e.unionHash(e.highlightAtoms,e.residues[t.structure+"_"+t.chain+"_"+t.resi]):e.highlightAtoms=e.cloneHash(e.residues[t.structure+"_"+t.chain+"_"+t.resi])}else if(2===e.highlightlevel){e.highlightlevel=3;var t=e.getFirstAtomObj(e.pickedAtomList);e.bShiftKey||e.bCtrlKey?e.highlightAtoms=e.unionHash(e.highlightAtoms,e.selectStrandHelixFromAtom(t)):e.highlightAtoms=e.cloneHash(e.selectStrandHelixFromAtom(t))}else if(3===e.highlightlevel){e.highlightlevel=4;var t=e.getFirstAtomObj(e.pickedAtomList);e.bShiftKey||e.bCtrlKey?e.highlightAtoms=e.unionHash(e.highlightAtoms,e.chains[t.structure+"_"+t.chain]):e.highlightAtoms=e.cloneHash(e.chains[t.structure+"_"+t.chain])}else if(4===e.highlightlevel||5===e.highlightlevel){e.highlightlevel=5;var t=e.getFirstAtomObj(e.pickedAtomList);e.bShiftKey||e.bCtrlKey||(e.highlightAtoms={});for(var n=e.structures[t.structure],o=0,s=n.length;s>o;++o)e.highlightAtoms=e.unionHash(e.highlightAtoms,e.chains[n[o]])}e.addHighlightObjects}else if(40===i.keyCode){if(i.preventDefault,e.removeHighlightObjects,2!==e.highlightlevel&&1!==e.highlightlevel||1!==Object.keys(e.pickedAtomList).length){if(3===e.highlightlevel){var r={};for(var o in e.pickedAtomList)residueid=e.atoms[o].structure+"_"+e.atoms[o].chain+"_"+e.atoms[o].resi,r[residueid]=1;if(1===Object.keys(r).length){e.highlightlevel=2;var t=e.getFirstAtomObj(e.pickedAtomList);e.bShiftKey||e.bCtrlKey?e.highlightAtoms=e.unionHash(e.highlightAtoms,e.residues[t.structure+"_"+t.chain+"_"+t.resi]):e.highlightAtoms=e.cloneHash(e.residues[t.structure+"_"+t.chain+"_"+t.resi])}}else if(4===e.highlightlevel){e.highlightlevel=3;var t=e.getFirstAtomObj(e.pickedAtomList);e.bShiftKey||e.bCtrlKey?e.highlightAtoms=e.unionHash(e.highlightAtoms,e.selectStrandHelixFromAtom(t)):e.highlightAtoms=e.cloneHash(e.selectStrandHelixFromAtom(t))}else if(5===e.highlightlevel){e.highlightlevel=4;var t=e.getFirstAtomObj(e.pickedAtomList);e.bShiftKey||e.bCtrlKey?e.highlightAtoms=e.unionHash(e.highlightAtoms,e.chains[t.structure+"_"+t.chain]):e.highlightAtoms=e.cloneHash(e.chains[t.structure+"_"+t.chain])}}else e.highlightlevel=1,e.highlightAtoms=e.cloneHash(e.pickedAtomList),e.bShiftKey||e.bCtrlKey?e.highlightAtoms=e.unionHash(e.highlightAtoms,e.pickedAtomList):e.highlightAtoms=e.cloneHash(e.pickedAtomList);e.addHighlightObjects}})},switchHighlightLevel:function{this.switchHighlightLevelBase}},"undefined"==typeof jQuery)throw new Error("iCn3DUI requires jQuery");if("undefined"==typeof iCn3D)throw new Error("iCn3DUI requires iCn3D");$.ui.dialog.prototype._makeDraggableBase||($.ui.dialog.prototype._makeDraggableBase=$.ui.dialog.prototype._makeDraggable,$.ui.dialog.prototype._makeDraggable=function{this._makeDraggableBase,this.uiDialog.draggable("option","containment",!1)});var iCn3DUI=function(e){var i=this;i.bFullUi=!0,i.cfg=e,i.divid=i.cfg.divid,i.pre=i.divid+"_",i.inputid="",i.WIDTH=400,i.HEIGHT=400,i.RESIDUE_WIDTH=10,i.MENU_HEIGHT=40,i.MENU_WIDTH=750,i.LESSWIDTH=0,i.LESSWIDTH_RESIZE=20,i.LESSHEIGHT=20,i.ROTATION_DIRECTION="right",i.bHideSelection=!0,i.ALTERNATE_STRUCTURE=-1,i.EXTRAHEIGHT=2.8*i.MENU_HEIGHT,void 0!=i.cfg.showmenu&&0==i.cfg.showmenu&&(i.EXTRAHEIGHT=.8*i.MENU_HEIGHT),i.GREY8="#888888",i.GREYB="#BBBBBB",i.GREYC="#CCCCCC",i.GREYD="#DDDDDD",i.bSelectResidue=!1,i.bSelectAlignResidue=!1,i.selectedResidues={},i.bCrashed=!1,i.prevCommands="",i.options={},i.options.camera="perspective",i.options.background="black",i.options.color="spectrum",i.options.sidechains="nothing",i.options.proteins="ribbon",i.options.surface="nothing",i.options.opacity="0.8",i.options.wireframe="no",i.options.ligands="stick",i.options.water="nothing",i.options.ions="sphere",i.options.hbonds="no",i.options.rotationcenter="molecule center",i.options.axis="no",i.options.fog="no",i.options.slab="no",i.options.picking="residue",i.options.nucleotides="nucleotide cartoon",i.modifyIcn3d,i.bAddCommands=!0,i.bAddLogs=!0,i.bNotLoadStructure=!1,i.bInitial=!0};iCn3DUI.prototype={constructor:iCn3DUI,modifyIcn3d:function{var e=this;e.modifyIcn3dShowPicking,e.modifySwitchHighlightLevel},modifyIcn3dShowPicking:function{var e=this;iCn3D.prototype.showPicking=function(i){if(this.showPickingBase(i),1===this.picking||2===this.picking){var t=this.id.split("_");e.pre=t[0]+"_";var n=i.structure+"_"+i.chain+"_"+i.resi;e.clearSelection,e.icn3d.bShiftKey||(e.removeSeqChainBkgd,e.removeSeqResidueBkgd),0!==$("#"+e.pre+n).length&&$("#"+e.pre+n).addClass("icn3d-highlightSeq"),0!==$("#align"+e.pre+n).length&&$("#align"+e.pre+n).addClass("icn3d-highlightSeq")}else if(3===this.picking){var t=this.id.split("_");e.pre=t[0]+"_";var o=this.getFirstAtomObj(this.highlightAtoms),s=this.getLastAtomObj(this.highlightAtoms);e.clearSelection,e.icn3d.bShiftKey||(e.removeSeqChainBkgd,e.removeSeqResidueBkgd);for(var r=o.resi;r<=s.resi;++r){var n=i.structure+"_"+i.chain+"_"+r;0!==$("#"+e.pre+n).length&&$("#"+e.pre+n).addClass("icn3d-highlightSeq"),0!==$("#align"+e.pre+n).length&&$("#align"+e.pre+n).addClass("icn3d-highlightSeq")}}var a={};a.factor=this._zoomFactor,a.mouseChange=this.mouseChange,a.quaternion={},a.quaternion._x=parseInt(1e3*this.quaternion._x)/1e3,a.quaternion._y=parseInt(1e3*this.quaternion._y)/1e3,a.quaternion._z=parseInt(1e3*this.quaternion._z)/1e3,a.quaternion._w=parseInt(1e3*this.quaternion._w)/1e3,e.bAddCommands&&(this.commands.push("pickatom "+i.serial+"|||"+JSON.stringify(a)),this.optionsHistory.push(this.cloneHash(this.options)),this.optionsHistory[this.optionsHistory.length-1].hlatomcount=Object.keys(this.highlightAtoms).length,e.isSessionStorageSupported&&e.saveCommandsToSession,e.STATENUMBER=this.commands.length),this.logs.push("pickatom "+i.serial+" (chain: "+i.structure+"_"+i.chain+", residue: "+i.resn+", number: "+i.resi+", atom: "+i.name+")"),$("#"+e.pre+"logtext").length&&$("#"+e.pre+"logtext").val("> "+this.logs.join("\n> ")+"\n> ").scrollTop($("#"+e.pre+"logtext")[0].scrollHeight)}},modifySwitchHighlightLevel:function{var e=this;iCn3D.prototype.switchHighlightLevel=function{this.switchHighlightLevelBase,$(document).bind("keydown",function(i){38===i.keyCode?e.updateSeqWinForCurrentAtoms:40===i.keyCode&&e.updateSeqWinForCurrentAtoms})}},show3DStructure:function{var e=this;return e.deferred=$.Deferred(function{e.isSessionStorageSupported&&e.getCommandsBeforeCrash,e.setTopMenusHtml(e.divid),e.setViewerWidthHeight;var i,t;i=-1!==e.cfg.width.toString.indexOf("%")?e.WIDTH*e.cfg.width.substr(0,e.cfg.width.toString.indexOf("%"))/100-e.LESSWIDTH:e.cfg.width,t=-1!==e.cfg.height.toString.indexOf("%")?e.HEIGHT*e.cfg.height.substr(0,e.cfg.height.toString.indexOf("%"))/100-e.EXTRAHEIGHT-e.LESSHEIGHT:e.cfg.height,e.allEventFunctions,e.allCustomEvents,void 0!=e.cfg.showmenu&&0==e.cfg.showmenu?(e.EXTRAHEIGHT=0,e.hideMenu(i,t)):(e.EXTRAHEIGHT=2.8*e.MENU_HEIGHT,e.showMenu(i,t)),e.icn3d=new iCn3D(e.pre+"canvas"),$("#"+e.pre+"canvas").width(i).height(t);var n=parseInt(t)+e.EXTRAHEIGHT;if($("#"+e.pre+"viewer").width(i).height(n),e.icn3d.setWidthHeight(i,t),void 0!==e.cfg.bCalphaOnly&&(e.icn3d.bCalphaOnly=e.cfg.bCalphaOnly),e.icn3d.options=e.icn3d.cloneHash(e.options),e.STATENUMBER=e.icn3d.commands.length,e.isSessionStorageSupported&&e.bCrashed){e.bCrashed=!1;var o=e.commandsBeforeCrash.split("|||")[0],s=o.substr(o.lastIndexOf(" ")+1);if(s===e.cfg.pdbid||s===e.cfg.mmdbid||s===e.cfg.gi||s===e.cfg.cid||s===e.cfg.mmcifid||s===e.cfg.align)return void e.loadScript(e.commandsBeforeCrash,!0)}if(e.icn3d.moleculeTitle="",void 0!==e.cfg.pdbid)e.inputid=e.cfg.pdbid,e.setLogCommand("load pdb "+e.cfg.pdbid,!0),e.downloadPdb(e.cfg.pdbid);else if(void 0!==e.cfg.mmdbid)e.inputid=e.cfg.mmdbid,e.setLogCommand("load mmdb "+e.cfg.mmdbid+" | parameters "+e.cfg.inpara,!0),e.downloadMmdb(e.cfg.mmdbid);else if(void 0!==e.cfg.gi)e.setLogCommand("load gi "+e.cfg.gi,!0),e.downloadGi(e.cfg.gi);else if(void 0!==e.cfg.cid){e.inputid=e.cfg.cid;var r="https://pubchem.ncbi.nlm.nih.gov/rest/pug/compound/cid/"+e.inputid+"/description/jsonp";$.ajax({url:r,dataType:"jsonp",success:function(i){void 0!==i.InformationList&&void 0!==i.InformationList.Information&&(e.icn3d.moleculeTitle=i.InformationList.Information[0].Title)}}),e.setLogCommand("load cid "+e.cfg.cid,!0),e.downloadCid(e.cfg.cid)}else if(void 0!==e.cfg.mmcifid)e.inputid=e.cfg.mmcifid,e.setLogCommand("load mmcif "+e.cfg.mmcifid,!0),e.downloadMmcif(e.cfg.mmcifid);else if(void 0!==e.cfg.align){var a=e.cfg.align.split(",");6===a.length?e.inputid=a[0]+"_"+a[3]:2===a.length&&(e.inputid=a[0]+"_"+a[1]),e.setLogCommand("load alignment "+e.cfg.align+" | parameters "+e.cfg.inpara,!0),e.downloadAlignment(e.cfg.align)}else alert("Please input a gi, MMDB ID, PDB ID, CID, or mmCIF ID...")}),e.deferred},clearSelection:function{var e=this;$("#"+e.pre+"chainid").val(""),$("#"+e.pre+"structureid").val(""),$("#"+e.pre+"alignChainid").val(""),$("#"+e.pre+"customResidues").val(""),$("#"+e.pre+"chainid2").val(""),$("#"+e.pre+"structureid2").val(""),$("#"+e.pre+"alignChainid2").val(""),$("#"+e.pre+"customResidues2").val(""),$("#"+e.pre+"customAtoms").val("")},removeSeqChainBkgd:function(e){$(".icn3d-seqTitle").each(function(i){void 0===e?$(this).removeClass("icn3d-highlightSeq"):$(this).attr("chain")!==e&&$(this).removeClass("icn3d-highlightSeq")})},removeSeqResidueBkgd:function{$(".icn3d-residue").each(function(e){$(this).removeClass("icn3d-highlightSeq")})},hideMenu:function(e,i){var t=this;void 0!==$("#"+t.pre+"menulist")[0]&&($("#"+t.pre+"menulist")[0].style.display="none"),void 0!==$("#"+t.pre+"menuLogSection")[0]&&($("#"+t.pre+"menuLogSection")[0].style.display="none"),void 0!==$("#"+t.pre+"commandlog")[0]&&($("#"+t.pre+"commandlog")[0].style.display="none"),void 0!==$("#"+t.pre+"selection")[0]&&($("#"+t.pre+"selection")[0].style.display="none"),void 0!==$("#"+t.pre+"title")[0]&&($("#"+t.pre+"title")[0].style.display="none"),$("#"+t.pre+"viewer").width(e).height(i),$("#"+t.pre+"canvas").width(e).height(i)},showMenu:function(e,i){var t=this;void 0!==$("#"+t.pre+"menulist")[0]&&($("#"+t.pre+"menulist")[0].style.display="block"),void 0!==$("#"+t.pre+"menuLogSection")[0]&&($("#"+t.pre+"menuLogSection")[0].style.display="block"),void 0!==$("#"+t.pre+"commandlog")[0]&&($("#"+t.pre+"commandlog")[0].style.display="block"),void 0!==$("#"+t.pre+"selection")[0]&&($("#"+t.pre+"selection")[0].style.display="block"),void 0!==$("#"+t.pre+"title")[0]&&($("#"+t.pre+"title")[0].style.display="block");var n=parseInt(i)+t.EXTRAHEIGHT;$("#"+t.pre+"viewer").width(e).height(n),$("#"+t.pre+"canvas").width(e).height(i)},saveSelectionIfSelected:function(e,i){var t=this;(t.bSelectResidue||t.bSelectAlignResidue)&&(t.saveSelection,t.bSelectResidue=!1,t.bSelectAlignResidue=!1)},setOption:function(e,i){var t=this;t.icn3d.options[e]=i,t.saveSelectionIfSelected,"color"===e?(t.icn3d.setColorByOptions(t.icn3d.options,t.icn3d.highlightAtoms),t.icn3d.draw,setTimeout(function{t.updateSeqWinForCurrentAtoms(!1)},0)):"surface"===e||"opacity"===e||"wireframe"===e?(("opacity"===e||"wireframe"===e)&&t.icn3d.removeLastSurface,t.icn3d.applySurfaceOptions,t.icn3d.render):t.icn3d.draw},setStyle:function(e,i){var t=this,n={};switch(e){case"proteins":n=t.icn3d.intersectHash(t.icn3d.highlightAtoms,t.icn3d.proteins);break;case"sidechains":n=t.icn3d.intersectHash(t.icn3d.highlightAtoms,t.icn3d.sidechains);break;case"nucleotides":n=t.icn3d.intersectHash(t.icn3d.highlightAtoms,t.icn3d.nucleotides);break;case"ligands":n=t.icn3d.intersectHash(t.icn3d.highlightAtoms,t.icn3d.ligands);break;case"ions":n=t.icn3d.intersectHash(t.icn3d.highlightAtoms,t.icn3d.ions);break;case"water":n=t.icn3d.intersectHash(t.icn3d.highlightAtoms,t.icn3d.water)}for(var o in n)t.icn3d.atoms[o].style=i;t.icn3d.options[e]=i,t.saveSelectionIfSelected,t.icn3d.draw},setLogCommand:function(e,i,t){var n=this;if(""===e.trim)return!1;var o=e.indexOf("|||");-1!==o&&(e=e.substr(0,o));var s={};if(s.factor=n.icn3d._zoomFactor,s.mouseChange=n.icn3d.mouseChange,s.quaternion={},s.quaternion._x=parseInt(1e3*n.icn3d.quaternion._x)/1e3,s.quaternion._y=parseInt(1e3*n.icn3d.quaternion._y)/1e3,s.quaternion._z=parseInt(1e3*n.icn3d.quaternion._z)/1e3,s.quaternion._w=parseInt(1e3*n.icn3d.quaternion._w)/1e3,i&&n.bAddCommands)if(n.STATENUMBER<n.icn3d.commands.length){var r=n.icn3d.commands[n.STATENUMBER-1],o=r.indexOf("|||");e!==r.substr(0,o)&&(n.icn3d.commands=n.icn3d.commands.slice(0,n.STATENUMBER),n.icn3d.commands.push(e+"|||"+JSON.stringify(s)),n.icn3d.optionsHistory.push(n.icn3d.cloneHash(n.icn3d.options)),n.icn3d.optionsHistory[n.icn3d.optionsHistory.length-1].hlatomcount=Object.keys(n.icn3d.highlightAtoms).length,n.isSessionStorageSupported&&n.saveCommandsToSession,n.STATENUMBER=n.icn3d.commands.length)}else n.icn3d.commands.push(e+"|||"+JSON.stringify(s)),n.icn3d.optionsHistory.push(n.icn3d.cloneHash(n.icn3d.options)),void 0!==n.icn3d.highlightAtoms&&(n.icn3d.optionsHistory[n.icn3d.optionsHistory.length-1].hlatomcount=Object.keys(n.icn3d.highlightAtoms).length),n.isSessionStorageSupported&&n.saveCommandsToSession,n.STATENUMBER=n.icn3d.commands.length;n.bAddLogs&&(n.icn3d.logs.push(e),$("#"+n.pre+"logtext").val("> "+n.icn3d.logs.join("\n> ")+"\n> ").scrollTop($("#"+n.pre+"logtext")[0].scrollHeight)),n.adjustIcon},renderStructure:function{var e=this;e.bInitial?(void 0!==e.cfg.command&&""!==e.cfg.command?(e.icn3d.bRender=!1,e.icn3d.draw(e.options),e.icn3d.bRender=!0,e.loadScript(e.cfg.command)):e.icn3d.draw(e.options),Object.keys(e.icn3d.structures).length>1?$("#"+e.pre+"alternate").show:$("#"+e.pre+"alternate").hide):(e.saveSelectionIfSelected,e.icn3d.draw),void 0!==e.cfg.showseq&&e.cfg.showseq&&e.openDialog(e.pre+"dl_selectresidues","Select residues in sequences"),Object.keys(e.icn3d.highlightAtoms).length===Object.keys(e.icn3d.atoms).length&&(void 0===e.cfg.showmenu||e.cfg.showmenu||e.cfg.showseq||e.cfg.showalignseq)?(e.selectAllUpdateMenuSeq(e.bInitial,!1),e.bInitial=!1):(e.bInitial&&e.setProteinsNucleotidesLigands,e.updateMenus(!1),e.updateSeqWinForCurrentAtoms,e.bInitial=!1)},setStructureMenu:function(e,i){for(var t=this,n="",o=e?" selected":"",s=Object.keys(t.icn3d.structures),r=0,a=s.length;a>r;++r){var c=s[r];void 0!==i&&(o=-1!==i.indexOf(c)?" selected":"");var l=void 0!==t.icn3d.secondId&&0===c.indexOf(t.icn3d.secondId)?"  ":"";if(n+="<option value='"+c+"'"+o+">"+l+s[r]+" "," selected"===o)for(var d in t.icn3d.structures[c]){var h=t.icn3d.structures[c][d];t.icn3d.highlightAtoms=t.icn3d.unionHash(t.icn3d.highlightAtoms,t.icn3d.chains[h])}if(e){var u={};for(var d in t.icn3d.structures[c]){var h=t.icn3d.structures[c][d];u=t.icn3d.unionHash(u,t.icn3d.chains[h])}t.icn3d.definedNames2Atoms[c]=Object.keys(u),t.icn3d.definedNames2Descr[c]=c,t.icn3d.definedNames2Command[c]="select structure "+c,u={}}}return n},setProteinsNucleotidesLigands:function{var e=this;for(var i in e.icn3d.chains)Object.keys(e.icn3d.proteins).length>0&&(e.icn3d.definedNames2Atoms.proteins=Object.keys(e.icn3d.proteins),e.icn3d.definedNames2Residues.proteins=Object.keys(e.icn3d.getResiduesFromAtoms(e.icn3d.proteins)),e.icn3d.definedNames2Descr.proteins="proteins",e.icn3d.definedNames2Command.proteins="select :proteins"),Object.keys(e.icn3d.nucleotides).length>0&&(e.icn3d.definedNames2Atoms.nucleotides=Object.keys(e.icn3d.nucleotides),e.icn3d.definedNames2Residues.nucleotides=Object.keys(e.icn3d.getResiduesFromAtoms(e.icn3d.nucleotides)),e.icn3d.definedNames2Descr.nucleotides="nucleotides",e.icn3d.definedNames2Command.nucleotides="select :nucleotides"),Object.keys(e.icn3d.ligands).length>0&&(e.icn3d.definedNames2Atoms.ligands=Object.keys(e.icn3d.ligands),e.icn3d.definedNames2Residues.ligands=Object.keys(e.icn3d.getResiduesFromAtoms(e.icn3d.ligands)),e.icn3d.definedNames2Descr.ligands="ligands",e.icn3d.definedNames2Command.ligands="select :ligands"),Object.keys(e.icn3d.ions).length>0&&(e.icn3d.definedNames2Atoms.ions=Object.keys(e.icn3d.ions),e.icn3d.definedNames2Residues.ions=Object.keys(e.icn3d.getResiduesFromAtoms(e.icn3d.ions)),e.icn3d.definedNames2Descr.ions="ions",e.icn3d.definedNames2Command.ions="select :ions"),Object.keys(e.icn3d.water).length>0&&(e.icn3d.definedNames2Atoms.water=Object.keys(e.icn3d.water),e.icn3d.definedNames2Residues.water=Object.keys(e.icn3d.getResiduesFromAtoms(e.icn3d.water)),e.icn3d.definedNames2Descr.water="water",e.icn3d.definedNames2Command.water="select :water")},setChainMenu:function(e,i){var t=this,n="",o=e?" selected":"";if(void 0===i)for(var s in t.icn3d.chains){var r=void 0!==t.icn3d.secondId&&0===s.indexOf(t.icn3d.secondId)?" ":"";n+="<option value='"+s+"' "+o+">"+r+s+" "," selected"===o&&(t.icn3d.highlightAtoms=t.icn3d.unionHash(t.icn3d.highlightAtoms,t.icn3d.chains[s])),e&&(t.icn3d.definedNames2Atoms[s]=Object.keys(t.icn3d.chains[s]),t.icn3d.definedNames2Descr[s]=s,t.icn3d.definedNames2Command[s]="select chain "+s)}else for(var s in t.icn3d.chains){var a=s.indexOf("_"),c=s.substr(0,a),r=void 0!==t.icn3d.secondId&&0===s.indexOf(t.icn3d.secondId)?" ":"";null!==i&&-1!==i.toString.toLowerCase.indexOf(c.toLowerCase)?(n+="<option value='"+s+"' selected>"+r+s+" ",t.icn3d.highlightAtoms=t.icn3d.unionHash(t.icn3d.highlightAtoms,t.icn3d.chains[s])):n+="<option value='"+s+"'>"+r+s+" "}return n},setAlignChainMenu:function(e,i){var t=this,n="",o=e?" selected":"";if(void 0===i)for(var s in t.icn3d.alignChains){var r=void 0!==t.icn3d.secondId&&0===s.indexOf(t.icn3d.secondId)?" ":"";n+="<option value='"+s+"' "+o+">"+r+s+" "," selected"===o&&(t.icn3d.highlightAtoms=t.icn3d.unionHash(t.icn3d.highlightAtoms,t.icn3d.alignChains[s])),e&&(t.icn3d.definedNames2Atoms[s]=Object.keys(t.icn3d.alignChains[s]),t.icn3d.definedNames2Descr[s]=s, t.icn3d.definedNames2Command[s]="select alignChain "+s)}else for(var s in t.icn3d.alignChains){var a=s.indexOf("_"),c=s.substr(0,a),r=void 0!==t.icn3d.secondId&&0===s.indexOf(t.icn3d.secondId)?" ":"";null!==i&&-1!==i.toString.toLowerCase.indexOf(c.toLowerCase)?(n+="<option value='"+s+"' selected>"+r+s+" ",t.icn3d.highlightAtoms=t.icn3d.unionHash(t.icn3d.highlightAtoms,t.icn3d.alignChains[s])):n+="<option value='"+s+"'>"+r+s+" "}return n},setResidueMenu:function(e){var i=this,t="",n=!1;for(var o in i.icn3d.definedNames2Residues)o===e?(t+="<option value='"+o+"' selected='selected'>"+o+" ",n=!0):t+="<option value='"+o+"'>"+o+" ";return n&&($("#"+i.pre+"chainid").val(""),$("#"+i.pre+"structureid").val(""),$("#"+i.pre+"chainid2").val(""),$("#"+i.pre+"structureid2").val("")),t},setAtomMenu:function(e){for(var i=this,t="",n=!1,o=Object.keys(i.icn3d.definedNames2Atoms).sort,s=0,r=o.length;r>s;++s){var a=o[s];a===e?(t+="<option value='"+a+"' selected='selected'>"+a+" ",n=!0):t+="<option value='"+a+"'>"+a+" "}return n&&($("#"+i.pre+"chainid").val(""),$("#"+i.pre+"structureid").val(""),$("#"+i.pre+"chainid2").val(""),$("#"+i.pre+"structureid2").val("")),t},getSequencesAnnotations:function(e,i,t,n){var o,s=this,r="Residue labeling: standard residue with coordinates: UPPER case letter; nonstandard residue with coordinates: the first UPPER case letter plus a period except that water residue uses the letter 'O'; residue missing coordinates: lower case letter.",a=s.isMac&&!s.isMobile?" Turn on scroll bar: System preferences -> General -> show scroll bars -> check Always":"";s.isMobile?o='Select Sequences: touch to select, touch again to deselect, multiple selection is allowed without Ctrl key, click "Save Selection" to save the current selection ':(o='Select on 1D Sequences: drag to select, drag again to deselect, multiple selection is allowed without Ctrl key, click "Save Selection" to save the current selection ',o+='Select on 3D structures: hold "Alt" and use mouse to pick, hold "Ctrl" to union selection, hold "Shift" to select a range, press the up/down arrow to switch among atom/residue/strand/chain/structure, click "Save Selection" to save the current selection '),o+=" <Selection:</b> Name: <input type='text' id='"+s.pre+"seq_command_name' value='seq_"+Object.keys(s.icn3d.definedNames2Residues).length+"' size='10'>  Description: <input type='text' id='"+s.pre+"seq_command_desc' value='seq_desc_"+Object.keys(s.icn3d.definedNames2Residues).length+"' size='20'> <button style='white-space:nowrap;' id='"+s.pre+"seq_saveselection'>Save Selection <button style='white-space:nowrap; margin-left:20px;' id='"+s.pre+"seq_clearselection'>Clear Selection  ",o+=r+a+" ",""!==s.icn3d.moleculeTitle&&(o+=" Title: "+s.icn3d.moleculeTitle+"  ");var c=0,l={};if(void 0!==e)for(var d=0,h=e.length;h>d;++d)l[e[d]]=1;for(var d in s.icn3d.chains){var u=void 0!==e&&l.hasOwnProperty(d)?!0:!1;u&&(void 0===i||i)&&(s.icn3d.highlightAtoms=s.icn3d.unionHash(s.icn3d.highlightAtoms,s.icn3d.chains[d]));var p=[],m="",g=void 0!==s.icn3d.chainsSeq[d]?s.icn3d.chainsSeq[d].length:0;g>c&&(c=g);var f=d.indexOf("_"),v=d.substr(0,f),b=d.substr(f+1),y=1;void 0!==s.icn3d.chainsSeq[d]&&(m+=" "+s.icn3d.chainsSeq[d][0].resi+" ",y=parseInt(s.icn3d.chainsSeq[d][0].resi));for(var E=0,_=g;_>E;++E){var w=v+"_"+b+"_"+s.icn3d.chainsSeq[d][E].resi,C=s.icn3d.chainsSeq[d][E].name===s.icn3d.chainsSeq[d][E].name.toUpperCase?!0:!1,S="class='icn3d-residue'";(void 0===n||n)&&(u||C&&void 0!==t&&-1!==t.indexOf(w))&&(S="class='icn3d-residue icn3d-highlightSeq'");var k,R=1===s.icn3d.chainsSeq[d][E].name.length?s.icn3d.chainsSeq[d][E].name:s.icn3d.chainsSeq[d][E].name.trim.substr(0,1)+".",T="O"===s.icn3d.chainsSeq[d][E].name?"HOH":s.icn3d.chainsSeq[d][E].name;if(s.icn3d.residues.hasOwnProperty(w)){var H=s.icn3d.getFirstAtomObj(s.icn3d.residues[w]);k=void 0!==H.color?"#"+H.color.getHexString+";":"#000000;"}else k="#000000;";"#FFFFFF;"===k.toUpperCase&&(k=s.GREYD),m+=C?"<span id='"+s.pre+w+"' title='"+T+s.icn3d.chainsSeq[d][E].resi+"' style='color:"+k+"'"+S+">"+R+" ":"<span title='"+T+s.icn3d.chainsSeq[d][E].resi+"'>"+R+" ",y<parseInt(s.icn3d.chainsSeq[d][E].resi)&&(y=parseInt(s.icn3d.chainsSeq[d][E].resi))}m+=" "+y+" ";for(var A=void 0!==s.icn3d.chainsAnno[d]?s.icn3d.chainsAnno[d].length:0,x=0,O=A;O>x;++x){p[x]="",p[x]+=" ";for(var E=0,_=s.icn3d.chainsAnno[d][x].length;_>E;++E){var $=s.icn3d.chainsAnno[d][x][E];p[x]+=" "+$+" "}p[x]+=" "}for(var x=0,O=A;O>x;++x)o+=" <div class='icn3d-annoTitle' chain='"+d+"' anno='"+x+"'>"+s.icn3d.chainsAnnoTitle[d][x][0]+" "+p[x]+"  ";var M=d;title=void 0!==s.icn3d.pdbid_chain2title?s.icn3d.pdbid_chain2title[d]:"",o+='<div class="icn3d-seqTitle" chain="'+d+'" anno="sequence" title="'+title+'">'+M+' '+m+"  "}return{sequencesHtml:o,maxSeqCnt:c}},getAlignSequencesAnnotations:function(e,i,t,n){var o,s=this,r="Residue labeling: aligned residue with coordinates: UPPER case letter; non-aligned residue with coordinates: lower case letter which can be highlighted; residue missing coordinates: lower case letter which can NOT be highlighted.",a=s.isMac&&!s.isMobile?" Turn on scroll bar: System preferences -> General -> show scroll bars -> check Always":"";s.isMobile?o='Select Aligned Sequences: touch to select, touch again to deselect, multiple selection is allowed without Ctrl key, click "Save Selection" to save the current selection ':(o='Select on 1D Sequences: drag to select, drag again to deselect, multiple selection is allowed without Ctrl key, click "Save Selection" to save the current selection ',o+='Select on 3D structures: hold "Alt" and use mouse to pick, hold "Ctrl" to union selection, hold "Shift" to select a range, press the up/down arrow to switch among atom/residue/strand/chain/structure, click "Save Selection" to save the current selection '),o+=" Selection: Name: <input type='text' id='"+s.pre+"alignseq_command_name' value='alseq_"+Object.keys(s.icn3d.definedNames2Residues).length+"' size='10'>  Description: <input type='text' id='"+s.pre+"alignseq_command_desc' value='alseq_desc_"+Object.keys(s.icn3d.definedNames2Residues).length+"' size='20'> <button style='white-space:nowrap;' id='"+s.pre+"alignseq_saveselection'>Save Selection <button style='white-space:nowrap; margin-left:20px;' id='"+s.pre+"alignseq_clearselection'>Clear Selection  ",o+=r+a+" ";var c=0,l={};if(void 0!==e)for(var d=0,h=e.length;h>d;++d)l[e[d]]=1;for(var d in s.icn3d.alignChains){var u=void 0!==e&&l.hasOwnProperty(d)?!0:!1;u&&(void 0===i||i)&&(s.icn3d.highlightAtoms=s.icn3d.unionHash(s.icn3d.highlightAtoms,s.icn3d.alignChains[d]));var p=[],m="",g=void 0!==s.icn3d.alignChainsSeq[d]?s.icn3d.alignChainsSeq[d].length:0;g>c&&(c=g);var f=d.indexOf("_"),v=d.substr(0,f),b=d.substr(f+1);m+=" "+s.icn3d.alignChainsSeq[d][0].resi+" ";for(var u=void 0!==e&&l.hasOwnProperty(d)?!0:!1,y=0,E=g;E>y;++y){var _="N/A",w="",C="#000";""===s.icn3d.alignChainsSeq[d][y].resi||isNaN(s.icn3d.alignChainsSeq[d][y].resi)||(_=s.icn3d.alignChainsSeq[d][y].resi,w=v+"_"+b+"_"+_,C=s.icn3d.alignChainsSeq[d][y].color);var S="class='icn3d-residue";(void 0===n||n)&&(u||void 0!==t&&""!==w&&-1!==t.indexOf(w))&&(S="class='icn3d-residue icn3d-highlightSeq"),S+=""===w?"'":" "+s.icn3d.alignChainsSeq[d][y]["class"]+"'";var k;if(s.icn3d.residues.hasOwnProperty(w)){var R=s.icn3d.getFirstAtomObj(s.icn3d.residues[w]);k=void 0!==R.color?"#"+R.color.getHexString+";":"#000000;"}else k="#000000;";"#FFFFFF;"===k.toUpperCase&&(k=s.GREYD);var T=""!==w?!0:!1;m+=T?"<span id='align"+s.pre+w+"' "+S+" style='color:"+k+"' title='"+s.icn3d.alignChainsSeq[d][y].resn+s.icn3d.alignChainsSeq[d][y].resi+"'>"+s.icn3d.alignChainsSeq[d][y].resn+" ":"<span title='"+s.icn3d.alignChainsSeq[d][y].resn+s.icn3d.alignChainsSeq[d][y].resi+"'>"+s.icn3d.alignChainsSeq[d][y].resn+" "}m+=" "+s.icn3d.alignChainsSeq[d][g-1].resi+" ";for(var H=void 0!==s.icn3d.alignChainsAnno[d]?s.icn3d.alignChainsAnno[d].length:0,A=0,x=H;x>A;++A){p[A]="",p[A]+=" ";for(var y=0,E=s.icn3d.alignChainsAnno[d][A].length;E>y;++y)p[A]+=" "+s.icn3d.alignChainsAnno[d][A][y]+" ";p[A]+=" "}for(var O=d,$=void 0!==s.icn3d.pdbid_chain2title?s.icn3d.pdbid_chain2title[d]:"",A=H-1;A>=0;--A)o+=" <div class='icn3d-seqTitle' chain='"+d+"' anno='"+A+"'>"+s.icn3d.alignChainsAnnoTitle[d][A][0]+" "+p[A]+"  ";o+='<div class="icn3d-seqTitle" chain="'+d+'" anno="sequence" title="'+$+'">'+O+' '+m+"  "}return{sequencesHtml:o,maxSeqCnt:c}},addCustomSelection:function(e,i,t,n,o,s){var r=this;if(t in r.icn3d.definedNames2Residues){s&&(r.icn3d.definedNames2Residues[t]=r.icn3d.definedNames2Residues[t].concat(e)),r.icn3d.definedNames2Atoms[t]=r.icn3d.definedNames2Atoms[t].concat(i),r.icn3d.definedNames2Descr[t]=n,s?r.icn3d.definedNames2Command[t]+=","+e:r.icn3d.definedNames2Command[t]=o;var a=r.setResidueMenu(t),c=r.setAtomMenu(t);$("#"+r.pre+"customResidues").html(a),$("#"+r.pre+"customResidues2").html(a),$("#"+r.pre+"customAtoms").html(c)}else{s&&(r.icn3d.definedNames2Residues[t]=e),r.icn3d.definedNames2Atoms[t]=i,r.icn3d.definedNames2Descr[t]=n,r.icn3d.definedNames2Command[t]=o;var a=r.setResidueMenu(t),c=r.setAtomMenu(t);$("#"+r.pre+"customResidues").html(a),$("#"+r.pre+"customResidues2").html(a),$("#"+r.pre+"customAtoms").html(c)}},changeStructureid:function(e,i,t){var n=this;n.icn3d.removeHighlightObjects,n.ALTERNATE_STRUCTURE=Object.keys(n.icn3d.structures).indexOf(e[0]),$("#"+n.pre+"chainid").val(""),$("#"+n.pre+"alignChainid").val(""),$("#"+n.pre+"customResidues").val(""),$("#"+n.pre+"chainid2").val(""),$("#"+n.pre+"alignChainid2").val(""),$("#"+n.pre+"customResidues2").val(""),$("#"+n.pre+"customAtoms").val(""),null!==e&&n.setLogCommand("select structure "+e.toString,!0);var o=n.setChainMenu(!1,e);$("#"+n.pre+"chainid").html(o),$("#"+n.pre+"chainid2").html(o);var s=n.setAlignChainMenu(!1,e);$("#"+n.pre+"alignChainid").html(s),$("#"+n.pre+"alignChainid2").html(s);for(var r=[],a=0,c=e.length;c>a;++a)r=r.concat(n.icn3d.structures[e[a]]);if((void 0===i||i)&&(n.icn3d.highlightAtoms={}),void 0===t||t){var l=n.getSequencesAnnotations(r);$("#"+n.pre+"dl_sequence").html(l.sequencesHtml),$("#"+n.pre+"dl_sequence").width(n.RESIDUE_WIDTH*l.maxSeqCnt+200),void 0!==n.cfg.align&&(l=n.getAlignSequencesAnnotations(r),$("#"+n.pre+"dl_sequence2").html(l.sequencesHtml),$("#"+n.pre+"dl_sequence2").width(n.RESIDUE_WIDTH*l.maxSeqCnt+200))}n.icn3d.addHighlightObjects},getResiduesUpdateHighlight:function(e,i){for(var t=this,n=[],o={},s=0,r=e.length;r>s;++s)o[e[s]]=1;for(var a in t.icn3d.residues){var c=a.lastIndexOf("_"),l=a.substr(0,c);o.hasOwnProperty(l)&&(n.push(a),(void 0===i||i)&&(t.icn3d.highlightAtoms=t.icn3d.unionHash(t.icn3d.highlightAtoms,t.icn3d.residues[a])))}return n},changeChainid:function(e){var i=this;i.icn3d.removeHighlightObjects,i.icn3d.highlightAtoms={},$("#"+i.pre+"structureid").val(""),$("#"+i.pre+"alignChainid").val(""),$("#"+i.pre+"customResidues").val(""),$("#"+i.pre+"structureid2").val(""),$("#"+i.pre+"alignChainid2").val(""),$("#"+i.pre+"customResidues2").val(""),$("#"+i.pre+"customAtoms").val(""),null!==e&&i.setLogCommand("select chain "+e.toString,!0);var t=i.getSequencesAnnotations(e);$("#"+i.pre+"dl_sequence").html(t.sequencesHtml),$("#"+i.pre+"dl_sequence").width(i.RESIDUE_WIDTH*t.maxSeqCnt+200),void 0!==i.cfg.align&&(t=i.getAlignSequencesAnnotations(e),$("#"+i.pre+"dl_sequence2").html(t.sequencesHtml),$("#"+i.pre+"dl_sequence2").width(i.RESIDUE_WIDTH*t.maxSeqCnt+200)),i.icn3d.addHighlightObjects},changeAlignChainid:function(e){var i=this;i.icn3d.removeHighlightObjects,i.icn3d.highlightAtoms={},$("#"+i.pre+"structureid").val(""),$("#"+i.pre+"chainid").val(""),$("#"+i.pre+"customResidues").val(""),$("#"+i.pre+"structureid2").val(""),$("#"+i.pre+"chainid2").val(""),$("#"+i.pre+"customResidues2").val(""),$("#"+i.pre+"customAtoms").val(""),null!==e&&i.setLogCommand("select alignChain "+e.toString,!0);var t=i.getAlignSequencesAnnotations(e);$("#"+i.pre+"dl_sequence2").html(t.sequencesHtml),$("#"+i.pre+"dl_sequence2").width(i.RESIDUE_WIDTH*t.maxSeqCnt+200);for(var n={},o=0,s=e.length;s>o;++o){var r=e[o];n=i.icn3d.unionHash(n,i.icn3d.getResiduesFromAtoms(i.icn3d.alignChains[r]))}t=i.getSequencesAnnotations(void 0,!0,Object.keys(n)),$("#"+i.pre+"dl_sequence").html(t.sequencesHtml),$("#"+i.pre+"dl_sequence").width(i.RESIDUE_WIDTH*t.maxSeqCnt+200),i.icn3d.addHighlightObjects},changeResidueid:function(e){var i=this;i.icn3d.removeHighlightObjects,i.icn3d.highlightAtoms={},$("#"+i.pre+"structureid").val(""),$("#"+i.pre+"chainid").val(""),$("#"+i.pre+"alignChainid").val(""),$("#"+i.pre+"customResidues").val(""),$("#"+i.pre+"structureid2").val(""),$("#"+i.pre+"chainid2").val(""),$("#"+i.pre+"alignChainid2").val(""),$("#"+i.pre+"customResidues2").val(""),$("#"+i.pre+"customAtoms").val(""),null!==e&&i.setLogCommand("select residue "+i.residueids2spec(e),!0);for(var t="",n=0,o=e.length;o>n;++n)i.icn3d.highlightAtoms=i.icn3d.unionHash(i.icn3d.highlightAtoms,i.icn3d.residues[e[n]]);t+="Annotation(s): Previously selected residues ";var s=i.getSequencesAnnotations(void 0,!0,e);$("#"+i.pre+"dl_sequence").html(t+s.sequencesHtml),$("#"+i.pre+"dl_sequence").width(i.RESIDUE_WIDTH*s.maxSeqCnt+200),void 0!==i.cfg.align&&(s=i.getAlignSequencesAnnotations(void 0,!0,e),$("#"+i.pre+"dl_sequence2").html(t+s.sequencesHtml),$("#"+i.pre+"dl_sequence2").width(i.RESIDUE_WIDTH*s.maxSeqCnt+200)),i.icn3d.addHighlightObjects},changeCustomResidues:function(e){var i=this;i.icn3d.removeHighlightObjects,i.icn3d.highlightAtoms={},$("#"+i.pre+"chainid").val(""),$("#"+i.pre+"alignChainid").val(""),$("#"+i.pre+"structureid").val(""),$("#"+i.pre+"chainid2").val(""),$("#"+i.pre+"alignChainid2").val(""),$("#"+i.pre+"structureid2").val(""),$("#"+i.pre+"customAtoms").val("");for(var t="",n="",o={},s=0;s<e.length;++s){var r=i.icn3d.definedNames2Residues[e[s]];if(void 0!==r){var a=i.icn3d.definedNames2Descr[e[s]];n+=""+e[s]+": "+a+"; ";for(var c=0,l=r.length;l>c;++c)o[r[c]]=1,i.icn3d.highlightAtoms=i.icn3d.unionHash(i.icn3d.highlightAtoms,i.icn3d.residues[r[c]])}}t+="Annotation(s): "+n+" ";var d=i.getSequencesAnnotations(void 0,!0,Object.keys(o));$("#"+i.pre+"dl_sequence").html(t+d.sequencesHtml),$("#"+i.pre+"dl_sequence").width(i.RESIDUE_WIDTH*d.maxSeqCnt+200),void 0!==i.cfg.align&&(d=i.getAlignSequencesAnnotations(void 0,!0,Object.keys(o)),$("#"+i.pre+"dl_sequence2").html(t+d.sequencesHtml),$("#"+i.pre+"dl_sequence2").width(i.RESIDUE_WIDTH*d.maxSeqCnt+200)),i.icn3d.addHighlightObjects},changeCustomAtoms:function(e){var i=this;i.icn3d.removeHighlightObjects,i.icn3d.highlightAtoms={},$("#"+i.pre+"chainid").val(""),$("#"+i.pre+"alignChainid").val(""),$("#"+i.pre+"structureid").val(""),$("#"+i.pre+"customResidues").val(""),$("#"+i.pre+"chainid2").val(""),$("#"+i.pre+"alignChainid2").val(""),$("#"+i.pre+"structureid2").val(""),$("#"+i.pre+"customResidues2").val(""),$("#"+i.pre+"command").val(""),$("#"+i.pre+"command_name").val(""),$("#"+i.pre+"command_desc").val("");for(var t="",n="",o={},s=0;s<e.length;++s){var r=i.icn3d.definedNames2Atoms[e[s]];if(void 0!==r){for(var a={},c=0,l=r.length;l>c;++c){var d=i.icn3d.atoms[r[c]],h=d.structure+"_"+d.chain+"_"+d.resi;a[h]=1}var u=Object.keys(a);if(void 0!==u){var p=i.icn3d.definedNames2Descr[e[s]];n+=""+e[s]+": "+p+"; ";for(var c=0,l=u.length;l>c;++c)o[u[c]]=1}}}t+="Annotation(s): "+n+" ";var m=i.getSequencesAnnotations(void 0,!0,Object.keys(o));$("#"+i.pre+"dl_sequence").html(t+m.sequencesHtml),$("#"+i.pre+"dl_sequence").width(i.RESIDUE_WIDTH*m.maxSeqCnt+200),void 0!==i.cfg.align&&(m=i.getAlignSequencesAnnotations(void 0,!0,Object.keys(o)),$("#"+i.pre+"dl_sequence2").html(t+m.sequencesHtml),$("#"+i.pre+"dl_sequence2").width(i.RESIDUE_WIDTH*m.maxSeqCnt+200)),i.icn3d.highlightAtoms={};for(var s=0,g=e.length;g>s;++s){var r=i.icn3d.definedNames2Atoms[e[s]],f=i.icn3d.definedNames2Descr[e[s]],v=i.icn3d.definedNames2Command[e[s]];if(void 0!==v){if(-1!==v.indexOf("select ")&&(v=v.replace(/select /g,"")),0===s)$("#"+i.pre+"command").val(v),$("#"+i.pre+"command_name").val(e[s]),$("#"+i.pre+"command_desc").val(f);else{var b=$("#"+i.pre+"command").val;$("#"+i.pre+"command").val(b+" or "+v);var b=$("#"+i.pre+"command_name").val;$("#"+i.pre+"command_name").val(b+" or "+e[s]);var b=$("#"+i.pre+"command_desc").val;$("#"+i.pre+"command_desc").val(b+" or "+f)}for(var c=0,l=r.length;l>c;++c)i.icn3d.highlightAtoms[r[c]]=1}}i.icn3d.addHighlightObjects},exportCustomAtoms:function{for(var e=this,i="",t=Object.keys(e.icn3d.definedNames2Atoms).sort,n=0,o=t.length;o>n;++n){var s=t[n],r=e.icn3d.definedNames2Atoms[s],a=(e.icn3d.definedNames2Descr[s],e.icn3d.definedNames2Command[s]);a=a.replace(/,/g,", "),i+=s+"	select ";for(var c={},l=0,d=r.length;d>l;++l){var h=e.icn3d.atoms[r[l]],u=h.structure+"_"+h.chain+"_"+h.resi;c[u]=1}var p=Object.keys(c);i+=e.residueids2spec(p),i+="\n"}return i},residueids2spec:function(e){var i=this,t="";if(void 0!==e){for(var n,o,s,r,a,c,l,d=e.sort(function(e,i){if(""!==e&&!isNaN(e))return parseInt(e)-parseInt(i);var t=e.lastIndexOf("_"),n=i.lastIndexOf("_");if(e.substr(0,t)<i.substr(0,n))return-1;if(e.substr(0,t)>i.substr(0,n))return 1;if(e.substr(0,t)==i.substr(0,n)){if(parseInt(e.substr(t+1))<parseInt(i.substr(n+1)))return-1;if(parseInt(e.substr(t+1))>parseInt(i.substr(n+1)))return 1;if(parseInt(e.substr(t+1))==parseInt(i.substr(n+1)))return 0}}),h="",u=0,p=1==Object.keys(i.icn3d.structures).length?!1:!0,m=0,g=d.length;g>m;++m){var f=d[m];s=f.lastIndexOf("_"),n=f.substr(0,s),o=parseInt(f.substr(s+1)),r=h.indexOf("_"),a=h.substr(0,r),c=h.substr(r+1),h!==n?(m>0&&(t+=u===l?p?"#"+a+"."+c+":"+l+" or ":"."+c+":"+l+" or ":p?"#"+a+"."+c+":"+l+"-"+u+" or ":"."+c+":"+l+"-"+u+" or "),l=o):h===n&&o!==u+1&&(t+=u===l?p?"#"+a+"."+c+":"+l+" or ":"."+c+":"+l+" or ":p?"#"+a+"."+c+":"+l+"-"+u+" or ":"."+c+":"+l+"-"+u+" or ",l=o),h=n,u=o}r=h.indexOf("_"),a=h.substr(0,r),c=h.substr(r+1),t+=u===l?p?"#"+a+"."+c+":"+l:"."+c+":"+l:p?"#"+a+"."+c+":"+l+"-"+u:"."+c+":"+l+"-"+u}return t},showSelection:function(e){var i=this;i.icn3d.displayAtoms={},i.icn3d.displayAtoms=i.icn3d.cloneHash(i.icn3d.highlightAtoms);var t=i.icn3d.centerAtoms(i.icn3d.hash2Atoms(i.icn3d.displayAtoms));i.icn3d.maxD=t.maxD,i.icn3d.maxD<25&&(i.icn3d.maxD=25),i.icn3d.options.rotationcenter="display center",i.saveSelectionIfSelected,i.icn3d.draw},selectByCommand:function(e,i,t){for(var n=this,o="select"===e.trim.substr(0,6)?e.trim.substr(7):e.trim,s=o.split(" or "),r={},a=0,c=s.length;c>a;++a){var l=s[a].trim.replace(/\s+/g," "),d=l.indexOf(" ");n.icn3d.highlightAtoms={},"and"===l.substr(0,d).toLowerCase?(n.applyCommand("select "+l.substr(d+1)),r=n.icn3d.intersectHash(r,n.icn3d.highlightAtoms)):"not"===l.substr(0,d).toLowerCase?(n.applyCommand("select "+l.substr(d+1)),r=n.icn3d.excludeHash(r,n.icn3d.highlightAtoms)):(n.applyCommand("select "+l),r=n.icn3d.unionHash(r,n.icn3d.highlightAtoms))}n.icn3d.highlightAtoms=n.icn3d.cloneHash(r);var h=Object.keys(n.icn3d.highlightAtoms),u=Object.keys(n.icn3d.getResiduesFromAtoms(n.icn3d.highlightAtoms));if(""!==i){n.addCustomSelection(u,h,i,t,e,!0);var p=[i];n.changeCustomResidues(p),n.changeCustomAtoms(p)}},selectBySpec:function(e,i,t,n){var o=this;e="select"===e.trim.substr(0,6)?e.trim.substr(7):e.trim,o.icn3d.highlightAtoms={};for(var s=e.replace(/\s+/g," ").replace(/ AND /g," and ").split(" and "),r={},a={},c=!0,l=0,d=s.length;d>l;++l){var h,u,p,m,g={},f=s[l].indexOf("#"),v=s[l].indexOf("."),b=s[l].indexOf(":"),y=s[l].indexOf("@"),E=s[l];-1===y?m="*":(m=E.substr(y+1),E=E.substr(0,y)),-1===b?p="*":(p=E.substr(b+1),E=E.substr(0,b)),-1===v?u="*":(u=E.substr(v+1),E=E.substr(0,v)),-1===f?h="*":(h=E.substr(f+1),E=E.substr(0,f)),"*"!==m&&(c=!1);var _,w,C,S,k=[],R=[];if(k="*"===h?Object.keys(o.icn3d.structures):h.split(","),"*"===u)for(var T=Object.keys(o.icn3d.chains),H=0,A=T.length;A>H;++H)w=T[H],_=w.substr(0,w.indexOf("_")),-1!==k.toString.toLowerCase.indexOf(_.toLowerCase)&&R.push(w);else for(var H=0,A=k.length;A>H;++H){_=k[H];var x=u.split(",");for(var O in x)R.push(_+"_"+x[O])}for(var $=p.split(","),H=0,A=$.length;A>H;++H){var M,L=!1,I=$[H].indexOf("-"),D=!1;if(-1!==I)C=$[H].substr(0,I),S=$[H].substr(I+1),L=!0;else if(""===$[H]||isNaN($[H])){if("*"===$[H])D=!0;else if("proteins"!==$[H]&&"nucleotides"!==$[H]&&"ligands"!==$[H]&&"ions"!==$[H]&&"water"!==$[H]){var z=$[H].toUpperCase;M=1===$[H].length?z:o.icn3d.residueName2Abbr(z)}}else C=$[H],S=C,L=!0;for(var N=0,q=R.length;q>N;++N)if(w=R[N],L)for(var O=parseInt(C);O<=parseInt(S);++O){var j=w+"_"+O;0===l?r[j]=1:r[j]=void 0;for(var P in o.icn3d.residues[j])("*"===m||m===o.icn3d.atoms[P].name)&&(0===l?(g[P]=1,a[P]=1):(g[P]=void 0,a[P]=void 0))}else if(w in o.icn3d.chains){var a=o.icn3d.chains[w];for(var P in a){var z=o.icn3d.atoms[P].resn.substr(0,3).toUpperCase;(D||o.icn3d.residueName2Abbr(z)===M||"proteins"===$[H]&&P in o.icn3d.proteins||"nucleotides"===$[H]&&P in o.icn3d.nucleotides||"ligands"===$[H]&&P in o.icn3d.ligands||"ions"===$[H]&&P in o.icn3d.ions||"water"===$[H]&&P in o.icn3d.water)&&(r[w+"_"+o.icn3d.atoms[P].resi]=1,("*"===m||m===o.icn3d.atoms[P].name)&&(0===l?(g[P]=1,a[P]=1):(g[P]=void 0,a[P]=void 0)))}}}0===l?o.icn3d.highlightAtoms=o.icn3d.cloneHash(g):o.icn3d.highlightAtoms=o.icn3d.intersectHash(o.icn3d.highlightAtoms,g)}if((void 0===n||n)&&o.updateSeqWinForCurrentAtoms,""!==i){o.addCustomSelection(Object.keys(r),Object.keys(a),i,t,e,c);var F=[i];o.changeCustomResidues(F),o.changeCustomAtoms(F)}},pickCustomSphere:function(e){var i=this;i.clearSelection;var t="select zone cutoff "+e,n={};for(var o in i.icn3d.highlightAtoms)n[o]=i.icn3d.atoms[o];var s=i.icn3d.getAtomsWithinAtom(i.icn3d.atoms,n,parseFloat(e)),r={},a=[];for(var o in s){var c=s[o],l=c.structure+"_"+c.chain+"_"+c.resi;r[l]=1,a.push(o)}var d=Object.keys(r);i.icn3d.highlightAtoms={};for(var h=0,u=d.length;u>h;++h){var l=d[h];for(var o in i.icn3d.residues[l])i.icn3d.highlightAtoms[o]=1}i.icn3d.displayAtoms=i.icn3d.cloneHash(i.icn3d.atoms);var p,m,g=i.icn3d.getFirstAtomObj(n);p="sphere."+g.chain+":"+i.icn3d.residueName2Abbr(g.resn.substr(0,3))+g.resi+"-"+$("#"+i.pre+"radius_aroundsphere").val+"A",m="select a sphere around currently selected "+Object.keys(i.icn3d.highlightAtoms).length+" atoms with a radius of "+e+" angstrom",i.addCustomSelection(d,a,p,m,t,!0);var f=[p];i.changeCustomResidues(f),i.saveSelectionIfSelected,i.icn3d.draw},showHbonds:function(e){var i=this;i.icn3d.options.hbonds="yes";var t="hbonds "+e,n={};for(var o in i.icn3d.atoms)!i.icn3d.highlightAtoms.hasOwnProperty(o)&&i.icn3d.displayAtoms.hasOwnProperty(o)&&(n[o]=i.icn3d.atoms[o]);var s=i.icn3d.getFirstAtomObj(i.icn3d.highlightAtoms);if(Object.keys(n).length>0&&Object.keys(i.icn3d.highlightAtoms).length>0){i.icn3d.calculateLigandHbonds(n,i.icn3d.intersectHash2Atoms(i.icn3d.displayAtoms,i.icn3d.highlightAtoms),parseFloat(e)),i.clearSelection;var r={},a=[];for(var o in i.icn3d.highlightAtoms){var c=i.icn3d.atoms[o].structure+"_"+i.icn3d.atoms[o].chain+"_"+i.icn3d.atoms[o].resi;r[c]=1,a.push(o)}var l="hbonds_"+s.serial,d="all atoms that are hydrogen-bonded with the selected atoms";i.addCustomSelection(Object.keys(r),a,l,d,t,!0);var h=[l];i.changeCustomResidues(h),i.saveSelectionIfSelected,i.icn3d.draw}},addLabel:function(e,i,t,n,o,s,r,a){var c=this,l={},d=new THREE.Vector3;d.x=i,d.y=t,d.z=n,l.position=d,l.text=e,l.size=o,l.color=s,l.background=r,void 0===c.icn3d.labels[a]&&(c.icn3d.labels[a]=[]),void 0!==a?c.icn3d.labels[a].push(l):c.icn3d.labels.custom.push(l),c.icn3d.removeHighlightObjects},addLine:function(e,i,t,n,o,s,r,a,c){var l=this,d={};d.position1=new THREE.Vector3(e,i,t),d.position2=new THREE.Vector3(n,o,s),d.color=r,d.dashed=a,void 0===l.icn3d.lines[c]&&(l.icn3d.lines[c]=[]),void 0!==c?l.icn3d.lines[c].push(d):l.icn3d.lines.custom.push(d),l.icn3d.removeHighlightObjects},selectAChain:function(e,i){var t=this,i=i.replace(/\s/g,""),n="select chain "+e,o=[],s=[];t.icn3d.removeHighlightObjects,t.icn3d.highlightAtoms={};for(var r in t.icn3d.chainsSeq[e]){var a=t.icn3d.chainsSeq[e][r],c=e+"_"+a.resi,l=a.name;if(""!==l&&"-"!==l){o.push(c);for(var d in t.icn3d.residues[c])s.push(d),t.icn3d.highlightAtoms[d]=1}}t.addCustomSelection(o,s,i,i,n,!0),t.icn3d.addHighlightObjects},selectAAlignChain:function(e,i){var t=this,n=i.replace(/\s/g,""),o="Selection from chain annotation in 'Select Residue' dialog",s=[],r=[];t.icn3d.removeHighlightObjects,t.icn3d.highlightAtoms={};for(var a in t.icn3d.alignChainsSeq[e]){var c=t.icn3d.alignChainsSeq[e][a],l=e+"_"+c.resi;c.resn;if(""!==c.resi){s.push(l);for(var d in t.icn3d.residues[l])r.push(d),t.icn3d.highlightAtoms[d]=1}}t.addCustomSelection(s,r,n,i,o,!0),t.icn3d.addHighlightObjects},selectAResidue:function(e,i){var t=this,i=i.replace(/\s/g,""),n="select residue "+e,o=[],s=[];o.push(e);for(var r in t.icn3d.residues[e])s.push(r),t.icn3d.highlightAtoms[r]=1;t.addCustomSelection(o,s,i,i,n,!0)},selectResidueList:function(e,i,t){var n=this;if(Object.keys(e).length>0){var i=i.replace(/\s/g,""),o="select "+n.residueids2spec(Object.keys(e)),s=Object.keys(e),r=[];for(var a in e)for(var c in n.icn3d.residues[a])r.push(c),n.icn3d.highlightAtoms[c]=1;n.addCustomSelection(s,r,i,t,o,!0)}},back:function{var e=this;e.STATENUMBER--,e.bAddCommands=!1,e.bAddLogs=!1,e.bNotLoadStructure=!0,e.STATENUMBER<1?e.STATENUMBER=1:e.execCommands(e.STATENUMBER),e.adjustIcon,e.bAddCommands=!0,e.bAddLogs=!0},forward:function{var e=this;e.STATENUMBER++,e.bAddCommands=!1,e.bAddLogs=!1,e.bNotLoadStructure=!0,e.STATENUMBER>e.icn3d.commands.length?e.STATENUMBER=e.icn3d.commands.length:e.execCommands(e.STATENUMBER),e.adjustIcon,e.bAddCommands=!0,e.bAddLogs=!0},toggleSelection:function{var e=this;if(e.bHideSelection){for(var i in e.icn3d.displayAtoms)e.icn3d.highlightAtoms.hasOwnProperty(i)&&delete e.icn3d.displayAtoms[i];e.bHideSelection=!1}else e.icn3d.displayAtoms=e.icn3d.unionHash(e.icn3d.displayAtoms,e.icn3d.highlightAtoms),e.bHideSelection=!0;e.icn3d.draw},alternateStructures:function{var e=this;e.icn3d.displayAtoms={};for(var i=Object.keys(e.icn3d.highlightAtoms).length,t=Object.keys(e.icn3d.atoms).length,n=Object.keys(e.icn3d.structures),o=0,s=n.length;s>o;++o){var r=n[o];if(o>e.ALTERNATE_STRUCTURE||e.ALTERNATE_STRUCTURE===s-1&&0===o){for(var a in e.icn3d.structures[r]){var c=e.icn3d.structures[r][a];e.icn3d.displayAtoms=e.icn3d.unionHash(e.icn3d.displayAtoms,e.icn3d.chains[c])}e.ALTERNATE_STRUCTURE=o;break}}t>i&&(e.icn3d.displayAtoms=e.icn3d.intersectHash(e.icn3d.displayAtoms,e.icn3d.highlightAtoms),e.icn3d.bShowHighlight=!1,e.icn3d.options.rotationcenter="highlight center"),e.icn3d.draw,e.icn3d.bShowHighlight=!0,e.icn3d.options.rotationcenter="molecule center"},adjustIcon:function{var e=this;1===e.STATENUMBER?$("#"+e.pre+"back").hasClass("icn3d-middleIcon")&&($("#"+e.pre+"back").toggleClass("icn3d-middleIcon"),$("#"+e.pre+"back").toggleClass("icn3d-endIcon")):$("#"+e.pre+"back").hasClass("icn3d-endIcon")&&($("#"+e.pre+"back").toggleClass("icn3d-middleIcon"),$("#"+e.pre+"back").toggleClass("icn3d-endIcon")),e.STATENUMBER===e.icn3d.commands.length?$("#"+e.pre+"forward").hasClass("icn3d-middleIcon")&&($("#"+e.pre+"forward").toggleClass("icn3d-middleIcon"),$("#"+e.pre+"forward").toggleClass("icn3d-endIcon")):$("#"+e.pre+"forward").hasClass("icn3d-endIcon")&&($("#"+e.pre+"forward").toggleClass("icn3d-middleIcon"),$("#"+e.pre+"forward").toggleClass("icn3d-endIcon"))},toggle:function(e,i,t,n){$("#"+e).toggleClass("ui-icon-plus"),$("#"+e).toggleClass("ui-icon-minus"),$("#"+i).toggleClass("ui-icon-plus"),$("#"+i).toggleClass("ui-icon-minus"),$("#"+e).toggleClass("icn3d-shown"),$("#"+e).toggleClass("icn3d-hidden"),$("#"+i).toggleClass("icn3d-shown"),$("#"+i).toggleClass("icn3d-hidden"),$("#"+t).toggleClass("icn3d-shown"),$("#"+t).toggleClass("icn3d-hidden"),$("#"+n).toggleClass("icn3d-shown"),$("#"+n).toggleClass("icn3d-hidden")},loadScript:function(e,i){var t=this;t.icn3d.bRender=!1,t.icn3d.bStopRotate=!0,e=e.replace(/;/g,"\n");var n=[];t.icn3d.commands.length>0&&(n[0]=t.icn3d.commands[0]),t.icn3d.commands=e.split("\n"),t.STATENUMBER=t.icn3d.commands.length,void 0!==i&&i?(t.icn3d.commands=n.concat(t.icn3d.commands),t.STATENUMBER=t.icn3d.commands.length,t.execCommands(t.STATENUMBER)):(t.execCommands(t.STATENUMBER),t.icn3d.commands=n.concat(t.icn3d.commands),t.STATENUMBER=t.icn3d.commands.length)},loadSelection:function(e){for(var i=this,t=e.trim.split("\n"),n=0,o=t.length;o>n;++n){var s=t[n].split("	"),r=s[0],a=s[1],c=a.indexOf(" ");i.selectByCommand(a.substr(c+1),r,r,!1)}},execCommandsBase:function(e,i,t){for(var n=this,o=e;i>=o;++o){if(-1!==n.icn3d.commands[o].indexOf("load"))return 0===i&&e===i?void(n.bNotLoadStructure?(n.icn3d.highlightAtoms=n.icn3d.cloneHash(n.icn3d.atoms),n.icn3d.bRender=!0,1===n.icn3d.commands.length&&(n.bAddCommands=!0),n.renderFinalStep(t)):$.when(n.applyCommandLoad(n.icn3d.commands[o])).then(function{n.icn3d.bRender=!0,1===n.icn3d.commands.length&&(n.bAddCommands=!0),n.renderFinalStep(t)})):void(n.bNotLoadStructure?(n.icn3d.highlightAtoms=n.icn3d.cloneHash(n.icn3d.atoms),n.execCommandsBase(o+1,i,t)):$.when(n.applyCommandLoad(n.icn3d.commands[o])).then(function{n.execCommandsBase(o+1,i,t)}));n.applyCommand(n.icn3d.commands[o]),o===t-1&&(n.icn3d.bRender=!0,o+1===n.icn3d.commands.length&&(n.bAddCommands=!0),n.renderFinalStep(t))}},renderFinalStep:function(e){var i=this,t=i.icn3d.commands[e-1].split("|||");if(2==t.length){var n=JSON.parse(t[1]);i.icn3d._zoomFactor=n.factor,i.icn3d.mouseChange.x=n.mouseChange.x,i.icn3d.mouseChange.y=n.mouseChange.y,i.icn3d.quaternion._x=n.quaternion._x,i.icn3d.quaternion._y=n.quaternion._y,i.icn3d.quaternion._z=n.quaternion._z,i.icn3d.quaternion._w=n.quaternion._w}if(void 0===i.cfg.command&&(1===e||Object.keys(i.icn3d.highlightAtoms).length===Object.keys(i.icn3d.atoms).length||void 0!==i.icn3d.optionsHistory[e-1]&&i.icn3d.optionsHistory[e-1].hasOwnProperty("hlatomcount")&&i.icn3d.optionsHistory[e-1].hlatomcount===Object.keys(i.icn3d.atoms).length))if(i.icn3d.setAtomStyleByOptions(i.icn3d.optionsHistory[e-1]),i.icn3d.setColorByOptions(i.icn3d.optionsHistory[e-1],i.icn3d.highlightAtoms),i.icn3d.optionsHistory.length>=e){var o=i.icn3d.optionsHistory[e-1].picking;"no"===o?i.icn3d.picking=0:"atom"===o?i.icn3d.picking=1:"residue"===o?i.icn3d.picking=2:"strand"===o&&(i.icn3d.picking=3),1===e&&i.icn3d.applyOriginalColor,i.updateSeqWinForCurrentAtoms,i.icn3d.draw(i.icn3d.optionsHistory[e-1])}else i.updateSeqWinForCurrentAtoms,i.icn3d.draw;else i.icn3d.draw},execCommands:function(e){var i=this;i.icn3d.bRender=!1,i.icn3d.reinitAfterLoad,i.icn3d.options=i.icn3d.cloneHash(i.options),i.execCommandsBase(0,e-1,e)},applyCommandLoad:function(e){var i=this;return i.deferred2=$.Deferred(function{i.bAddCommands=!1;var t=e.split("|||"),n=t[0].replace(/\s\s/g," ").trim,o=n.toLowerCase;if(-1!==o.indexOf("load")){var s=o.split(" | "),r=s[0];if(s.length>1){var a=s[1].indexOf(" "); i.cfg.inpara=s[1].substr(a+1)}var c=r.substr(r.lastIndexOf(" ")+1);-1!==o.indexOf("pdb")?(i.downloadPdb(c),i.cfg.pdbid=c):-1!==o.indexOf("mmcif")?(i.downloadMmcif(c),i.cfg.mmcifid=c):-1!==o.indexOf("mmdb")?(i.downloadMmdb(c),i.cfg.mmdbid=c):-1!==o.indexOf("gi")?(i.downloadGi(c),i.cfg.gi=c):-1!==o.indexOf("cid")?(i.downloadCid(c),i.cfg.cid=c):-1!==o.indexOf("align")&&(i.downloadAlignment(c),i.cfg.align=c)}i.bAddCommands=!0}),i.deferred2},applyCommand:function(e){var i=this;i.bAddCommands=!1;var t=e.split("|||"),n=t[0].replace(/\s+/g," ").trim,o=n.toLowerCase,s=!0;if(-1!==o.indexOf("export state file"));else if(-1!==n.indexOf("select structure")){var r=n.substr(n.lastIndexOf(" ")+1).split(",");null!==r&&i.changeStructureid(r)}else if(-1!==n.indexOf("select chain")){var r=n.substr(n.lastIndexOf(" ")+1).split(",");null!==r&&i.changeChainid(r)}else if(-1!==n.indexOf("select alignChain")){var r=n.substr(n.lastIndexOf(" ")+1).split(",");null!==r&&i.changeAlignChainid(r)}else if(-1!==n.indexOf("select residue")){var r=n.substr(n.lastIndexOf(" ")+1).split(",");null!==r&&i.changeResidueid(r)}else if(-1!==n.indexOf("select saved selection")){var r=n.substr(n.lastIndexOf(" ")+1).split(",");null!==r&&i.changeCustomResidues(r)}else if(-1!==n.indexOf("select saved atoms")){var r=n.substr(n.lastIndexOf(" ")+1).split(",");null!==r&&i.changeCustomAtoms(r)}else if(-1!==o.indexOf("show selection"))i.showSelection;else if(-1!==o.indexOf("select")&&-1!==o.indexOf("name")){for(var a=n.split(" | "),c="",l="",d="",h=0,u=a.length;u>h;++h){var p=a[h];-1!==p.indexOf("select")?c=p.substr(p.indexOf(" ")+1):-1!==p.indexOf("name")?l=p.substr(p.indexOf(" ")+1):-1!==p.indexOf("description")&&(d=p.substr(p.indexOf(" ")+1))}a.length<3&&(d=l),i.selectByCommand(c,l,d)}else if(-1!==o.indexOf("select #")||-1!==o.indexOf("select .")||-1!==o.indexOf("select :")||-1!==o.indexOf("select @")){var a=n.split(" | "),c=a[0].substr(a[0].indexOf(" ")+1),l="",d="";3===a.length&&(l=a[1].substr(a[1].indexOf(" ")+1),d=a[2].substr(a[2].indexOf(" ")+1)),-1!==c.indexOf(" or ")?i.selectByCommand(c,l,d):i.selectBySpec(c,l,d)}else if(-1!==o.indexOf("set picking atom"))i.icn3d.picking=1,i.icn3d.options.picking="atom";else if(-1!==o.indexOf("set picking off"))i.icn3d.picking=0,i.icn3d.options.picking="no",i.icn3d.draw,i.icn3d.removeHighlightObjects;else if(-1!==o.indexOf("set picking residue"))i.icn3d.picking=2,i.icn3d.options.picking="residue";else if(-1!==o.indexOf("set picking strand"))i.icn3d.picking=3,i.icn3d.options.picking="strand";else if(-1!==o.indexOf("pickatom")){var m=parseInt(o.substr(o.lastIndexOf(" ")+1));i.icn3d.pickedatom=i.icn3d.atoms[m],i.icn3d.showPicking(i.icn3d.pickedatom)}else if(-1!==o.indexOf("select zone cutoff")){var g=o.substr(o.lastIndexOf(" ")+1);i.pickCustomSphere(g)}else if(-1!==o.indexOf("style")){var f=o.substr(o.indexOf(" ")+1),v=f.substr(0,f.indexOf(" ")),b=f.substr(f.indexOf(" ")+1);i.setStyle(v,b)}else if(0===o.indexOf("color")){var y=o.substr(o.indexOf(" ")+1);i.icn3d.options.color=y,i.icn3d.setColorByOptions(i.icn3d.options,i.icn3d.highlightAtoms),i.updateSeqWinForCurrentAtoms}else if(-1!==o.indexOf("set surface wireframe on"))i.icn3d.options.wireframe="yes",i.icn3d.applySurfaceOptions;else if(-1!==o.indexOf("set surface wireframe off"))i.icn3d.options.wireframe="no",i.icn3d.applySurfaceOptions;else if(-1!==o.indexOf("set surface opacity")){var E=o.substr(o.lastIndexOf(" ")+1);i.icn3d.options.opacity=E,i.icn3d.applySurfaceOptions}else if(-1!==o.indexOf("set surface neighbors on"))i.icn3d.bConsiderNeighbors=!0,i.icn3d.applySurfaceOptions;else if(-1!==o.indexOf("set surface neighbors off"))i.icn3d.bConsiderNeighbors=!1,i.icn3d.applySurfaceOptions;else if(-1!==o.indexOf("set surface")){var E=o.substr(12);i.icn3d.options.surface=E,i.icn3d.applySurfaceOptions}else if(-1!==o.indexOf("set camera")){var E=o.substr(o.lastIndexOf(" ")+1);i.icn3d.options.camera=E}else if(-1!==o.indexOf("set background")){var E=o.substr(o.lastIndexOf(" ")+1);i.icn3d.options.background=E}else if(-1!==o.indexOf("set axis on"))i.icn3d.options.axis="yes";else if(-1!==o.indexOf("set axis off"))i.icn3d.options.axis="no";else if(-1!==o.indexOf("set fog on"))i.icn3d.options.fog="yes";else if(-1!==o.indexOf("set fog off"))i.icn3d.options.fog="no";else if(-1!==o.indexOf("set slab on"))i.icn3d.options.slab="yes";else if(-1!==o.indexOf("set slab off"))i.icn3d.options.slab="no";else if("reset"===o)i.icn3d.reinitAfterLoad,i.renderFinalStep(1);else if("reset orientation"===o)i.icn3d.resetOrientation;else if(-1!==o.indexOf("toggle highlight"))i.icn3d.prevHighlightObjects.length>0?(i.icn3d.removeHighlightObjects,i.icn3d.bShowHighlight=!1):(i.icn3d.addHighlightObjects,i.icn3d.bShowHighlight=!0);else if(-1!==o.indexOf("clear selection"))i.icn3d.removeHighlightObjects,i.icn3d.bShowHighlight=!1;else if(-1!==o.indexOf("set assembly on"))i.icn3d.bAssembly=!0;else if(-1!==o.indexOf("set assembly off"))i.icn3d.bAssembly=!1;else if(-1!==n.indexOf("add label")){var a=n.split(" | "),_=a[0].substr("add label".length+1);if(6==a.length){var w=a[1].split(" "),C=w[1],S=w[3],k=w[5],R=a[2].substr(a[2].lastIndexOf(" ")+1),y=a[3].substr(a[3].lastIndexOf(" ")+1),T=a[4].substr(a[4].lastIndexOf(" ")+1),H=a[5].substr(a[5].lastIndexOf(" ")+1);("0"===R||""===R||"undefined"===R)&&(R=void 0),("0"===y||""===y||"undefined"===y)&&(y=void 0),("0"===T||""===T||"undefined"===T)&&(T=void 0),i.addLabel(_,C,S,k,R,y,T,H),i.icn3d.draw}else if(5==a.length){var A=i.icn3d.centerAtoms(i.icn3d.hash2Atoms(i.icn3d.highlightAtoms)),C=A.center.x,S=A.center.y,k=A.center.z,R=a[1].substr(a[1].lastIndexOf(" ")+1),y=a[2].substr(a[2].lastIndexOf(" ")+1),T=a[3].substr(a[3].lastIndexOf(" ")+1),H=a[4].substr(a[4].lastIndexOf(" ")+1);("0"===R||""===R||"undefined"===R)&&(R=void 0),("0"===y||""===y||"undefined"===y)&&(y=void 0),("0"===T||""===T||"undefined"===T)&&(T=void 0),i.addLabel(_,C,S,k,R,y,T,H),i.icn3d.draw}}else if(-1!==o.indexOf("add residue labels"))i.icn3d.addResiudeLabels(i.icn3d.highlightAtoms),i.icn3d.draw;else if(-1!==o.indexOf("add line")){var a=o.split(" | "),x=a[1].split(" "),O=a[2].split(" "),y=a[3].substr(a[3].lastIndexOf(" ")+1),$="true"===a[4].substr(a[4].lastIndexOf(" ")+1)?!0:!1,H=a[5].substr(a[5].lastIndexOf(" ")+1);i.addLine(x[1],x[3],x[5],O[1],O[3],O[5],y,$,H)}else if(-1!==o.indexOf("zoom selection"))i.icn3d.zoominSelection;else if(-1!==o.indexOf("center selection"))i.icn3d.centerSelection;else if(-1!==o.indexOf("rotate left"))i.icn3d.bStopRotate=!1,i.ROTATION_DIRECTION="left",i.rotateStructure("left");else if(-1!==o.indexOf("rotate right"))i.icn3d.bStopRotate=!1,i.ROTATION_DIRECTION="right",i.rotateStructure("right");else if(-1!==o.indexOf("rotate up"))i.icn3d.bStopRotate=!1,i.ROTATION_DIRECTION="up",i.rotateStructure("up");else if(-1!==o.indexOf("rotate down"))i.icn3d.bStopRotate=!1,i.ROTATION_DIRECTION="down",i.rotateStructure("down");else if(-1!==o.indexOf("hbonds")){var M=o.substr(o.lastIndexOf(" ")+1);i.showHbonds(M)}else if(-1!==o.indexOf("set hbonds off"))i.icn3d.options.hbonds="no",i.icn3d.draw;else if(-1!==o.indexOf("set lines off"))i.icn3d.draw;else if(-1!==o.indexOf("set labels off"))i.icn3d.draw;else if(-1!==o.indexOf("back"))i.back;else if(-1!==o.indexOf("forward"))i.forward;else if(-1!==o.indexOf("toggle selection"))i.toggleSelection;else if(-1!==o.indexOf("select all"))i.selectAll;else if(-1!==o.indexOf("select complement"))i.selectComplement;else if(-1!==o.indexOf("set highlight color")){var y=o.substr(20);"yellow"===y?(i.icn3d.highlightColor=new THREE.Color(16776960),i.icn3d.matShader=i.icn3d.setOutlineColor("yellow")):"green"===y?(i.icn3d.highlightColor=new THREE.Color(65280),i.icn3d.matShader=i.icn3d.setOutlineColor("green")):"red"===y&&(i.icn3d.highlightColor=new THREE.Color(16711680),i.icn3d.matShader=i.icn3d.setOutlineColor("red")),i.icn3d.draw}else if(-1!==o.indexOf("set highlight style")){var b=o.substr(20);"outline"===b?i.icn3d.bHighlight=1:"3d"===b&&(i.icn3d.bHighlight=2),i.icn3d.draw}else-1!==o.indexOf("output selection")&&i.outputSelection;s&&i.setLogCommand(n,!1),i.bAddCommands=!0},setTopMenusHtml:function(e){var i=this,t="";t+=" ",t+=" ",t+="  <div id='"+i.pre+"menulist' style='position:absolute; z-index:999; float:left; display:table-row; margin: 3px 0px 0px 3px;'>",t+="     ",t+="  ",t+=i.setTools,t+="  <div id='"+i.pre+"title' class='icn3d-commandTitle' style='position:absolute; z-index:1; float:left; display:table-row; margin: 85px 0px 0px 5px; color: "+i.GREYD+"'> ",t+="  <div id='"+i.pre+"viewer' style='position:relative; width:100%; height:100%; background-color: "+i.GREYD+";'>",t+="   <div id='"+i.pre+"menuLogSection'>",t+="    <div style='height: "+i.MENU_HEIGHT+"px;'> ",t+="    <div style='height: "+i.MENU_HEIGHT+"px;'> ",t+="   ",t+="    <div id='"+i.pre+"wait' style='position:absolute; top:180px; left:100px; font-size: 2em; color: #444444;'>Loading the structure... ",t+="    <canvas id='"+i.pre+"canvas' style='width:100%; height: 100%; background-color: #000;'>Your browser does not support WebGL. ",t+=i.setLogWindow,t+=" ",t+=" ",t+=i.setDialogs,t+=i.setCustomDialogs,$("#"+e).html(t),$("accordion").accordion({collapsible:!0,active:!1,heightStyle:"content"}),$("accordion div").removeClass("ui-accordion-content ui-corner-all ui-corner-bottom ui-widget-content"),$(".menu").menu({position:{my:"left top",at:"right top"}}),$(".menu").hover(function{},function{$("accordion").accordion("option","active","none")}),$("#"+i.pre+"accordion1").hover(function{$("#"+i.pre+"accordion1 div").css("display","block")},function{$("#"+i.pre+"accordion1 div").css("display","none")}),$("#"+i.pre+"accordion2").hover(function{$("#"+i.pre+"accordion2 div").css("display","block")},function{$("#"+i.pre+"accordion2 div").css("display","none")}),$("#"+i.pre+"accordion3").hover(function{$("#"+i.pre+"accordion3 div").css("display","block")},function{$("#"+i.pre+"accordion3 div").css("display","none")}),$("#"+i.pre+"accordion4").hover(function{$("#"+i.pre+"accordion4 div").css("display","block")},function{$("#"+i.pre+"accordion4 div").css("display","none")}),$("#"+i.pre+"accordion5").hover(function{$("#"+i.pre+"accordion5 div").css("display","block")},function{$("#"+i.pre+"accordion5 div").css("display","none")}),$("#"+i.pre+"accordion6").hover(function{$("#"+i.pre+"accordion6 div").css("display","block")},function{$("#"+i.pre+"accordion6 div").css("display","none")})},setMenu1:function{var e=this,i="";return i+="    ",i+="          <accordion id='"+e.pre+"accordion1'>",i+="              File ",i+="              ",i+="              <ul class='menu'>",i+="                <li>Retrieve by ID",i+="                  <ul>",i+="                    <li><span id='"+e.pre+"menu1_pdbid' class='icn3d-link'>PDB ID </li>",i+="                    <li><span id='"+e.pre+"menu1_mmcifid' class='icn3d-link'>mmCIF ID </li>",i+="                    <li><span id='"+e.pre+"menu1_mmdbid' class='icn3d-link'>MMDB ID </li>",i+="                    <li><span id='"+e.pre+"menu1_gi' class='icn3d-link'>gi </li>",i+="                    <li><span id='"+e.pre+"menu1_cid' class='icn3d-link'>PubChem CID </li>",i+="                  </ul>",i+="                </li>",i+="                <li>Open File",i+="                  <ul>",i+="                    <li><span id='"+e.pre+"menu1_pdbfile' class='icn3d-link'>PDB File </li>",i+="                    <li><span id='"+e.pre+"menu1_mmciffile' class='icn3d-link'>mmCIF File </li>",i+="                    <li><span id='"+e.pre+"menu1_mol2file' class='icn3d-link'>Mol2 File </li>",i+="                    <li><span id='"+e.pre+"menu1_sdffile' class='icn3d-link'>SDF File </li>",i+="                    <li><span id='"+e.pre+"menu1_xyzfile' class='icn3d-link'>XYZ File </li>",i+="                    <li>-</li>",i+="                    <li><span id='"+e.pre+"menu1_state' class='icn3d-link'>State/Script File </li>",i+="                    <li><span id='"+e.pre+"menu1_selection' class='icn3d-link'>Selection File </li>",i+="                  </ul>",i+="                </li>",i+="                <li>Save File",i+="                  <ul>",i+="                    <li><span id='"+e.pre+"menu1_exportState' class='icn3d-link'>State File  </li>",i+="                    <li><span id='"+e.pre+"menu1_exportSelections' class='icn3d-link'>Selection File </li>",i+="                    <li><span id='"+e.pre+"menu1_exportCanvas' class='icn3d-link'>PNG Image File </li>",i+="                    <li>-</li>",i+="                    <li><span id='"+e.pre+"menu1_exportCounts' class='icn3d-link'>Residue Counts </li>",i+="                  </ul>",i+="                </li>",i+="                <li><span id='"+e.pre+"menu1_sharelink' class='icn3d-link'>Share Link </li>",void 0!==e.cfg.cid?(i+="                <li>Links",i+="                  <ul>",i+="                    <li><span id='"+e.pre+"menu1_link_structure' class='icn3d-link'>Compound Summary </li>",i+="                    <li><span id='"+e.pre+"menu1_link_vast' class='icn3d-link'>Similar Compounds </li>",i+="                    <li><span id='"+e.pre+"menu1_link_bind' class='icn3d-link'>Structures Bound </li>",i+="                  </ul>",i+="                </li>"):(i+="                <li>Links",i+="                  <ul>",i+="                    <li><span id='"+e.pre+"menu1_link_structure' class='icn3d-link'>Structure Summary </li>",i+="                    <li><span id='"+e.pre+"menu1_link_vast' class='icn3d-link'>Similar Structures </li>",i+="                    <li><span id='"+e.pre+"menu1_link_pubmed' class='icn3d-link'>Literature </li>",i+="                  </ul>",i+="                </li>"),i+="              </ul>",i+="              ",i+="          ",i+="    "},setMenu2:function{var e=this,i="";return i+="    ",i+="          <accordion id='"+e.pre+"accordion2'>",i+="              Select ",i+="              ",i+="              <ul class='menu'>",i+="                      <li><input type='radio' name='"+e.pre+"menu2_select' id='"+e.pre+"menu2_command'><label for='"+e.pre+"menu2_command'>Advanced </li>",i+="                      <li><input type='radio' name='"+e.pre+"menu2_select' id='"+e.pre+"menu2_aroundsphere'><label for='"+e.pre+"menu2_aroundsphere'>by Distance </li>",i+="                      <li><input type='radio' name='"+e.pre+"menu2_select' id='"+e.pre+"menu2_selectcomplement'><label for='"+e.pre+"menu2_selectcomplement'>Complement </li>",void 0===e.cfg.cid&&(i+="                      <li><input type='radio' name='"+e.pre+"menu2_select' id='"+e.pre+"menu2_select_chain'><label for='"+e.pre+"menu2_select_chain'>Chain </li>"),i+="                      <li><input type='radio' name='"+e.pre+"menu2_select' id='"+e.pre+"menu2_selectall'><label for='"+e.pre+"menu2_selectall'>All </li>",void 0===e.cfg.cid&&(i+="                      <li><input type='radio' name='"+e.pre+"menu2_select' id='"+e.pre+"menu2_selectresidues'><label for='"+e.pre+"menu2_selectresidues'>Sequence </li>"),void 0!==e.cfg.align&&(i+="                      <li><input type='radio' name='"+e.pre+"menu2_select' id='"+e.pre+"menu2_alignment'><label for='"+e.pre+"menu2_alignment'>Aligned Seq. </li>"),i+='               <li>Picking with "Alt" + Click',i+="                  <ul>",void 0===e.cfg.cid?(i+="                      <li><input type='radio' name='"+e.pre+"menu2_picking' id='"+e.pre+"menu2_pickingStrand'><label for='"+e.pre+"menu2_pickingStrand'>Strand/Helix </li>",i+="                      <li><input type='radio' name='"+e.pre+"menu2_picking' id='"+e.pre+"menu2_pickingResidue' checked><label for='"+e.pre+"menu2_pickingResidue'>Residue </li>",i+="                      <li><input type='radio' name='"+e.pre+"menu2_picking' id='"+e.pre+"menu2_pickingYes'><label for='"+e.pre+"menu2_pickingYes'>Atom </li>"):(i+="                      <li><input type='radio' name='"+e.pre+"menu2_picking' id='"+e.pre+"menu2_pickingStrand'><label for='"+e.pre+"menu2_pickingStrand'>Strand/Helix (Alt) </li>",i+="                      <li><input type='radio' name='"+e.pre+"menu2_picking' id='"+e.pre+"menu2_pickingResidue'><label for='"+e.pre+"menu2_pickingResidue'>Residue (Alt) </li>",i+="                      <li><input type='radio' name='"+e.pre+"menu2_picking' id='"+e.pre+"menu2_pickingYes' checked><label for='"+e.pre+"menu2_pickingYes'>Atom (Alt) </li>"),i+="                  </ul>",i+="                </li>",i+="                <li>Display",i+="                  <ul>",void 0!==e.cfg.align&&(i+="                      <li><input type='radio' name='"+e.pre+"menu2_display' id='"+e.pre+"menu2_alternate'><label for='"+e.pre+"menu2_alternate'>Alternate Selection </li>"),i+="                      <li><input type='radio' name='"+e.pre+"menu2_display' id='"+e.pre+"menu2_show_selected'><label for='"+e.pre+"menu2_show_selected'>Display Selection </li>",i+="                      <li><input type='radio' name='"+e.pre+"menu2_display' id='"+e.pre+"menu2_selectedcenter'><label for='"+e.pre+"menu2_selectedcenter'>Zoom in Selection </li>",i+="                      <li><input type='radio' name='"+e.pre+"menu2_display' id='"+e.pre+"toggleHighlight2'><label for='"+e.pre+"toggleHighlight2'>Toggle Highlight </li>",i+="                  </ul>",i+="                </li>",i+="                    <li>Highlight Color",i+="                      <ul>",i+="                        <li><input type='radio' name='"+e.pre+"menu2_hl_color' id='"+e.pre+"menu2_hl_colorYellow' checked><label for='"+e.pre+"menu2_hl_colorYellow'>Yellow </li>",i+="                        <li><input type='radio' name='"+e.pre+"menu2_hl_color' id='"+e.pre+"menu2_hl_colorGreen'><label for='"+e.pre+"menu2_hl_colorGreen'>Green </li>",i+="                        <li><input type='radio' name='"+e.pre+"menu2_hl_color' id='"+e.pre+"menu2_hl_colorRed'><label for='"+e.pre+"menu2_hl_colorRed'>Red </li>",i+="                      </ul>",i+="                    </li>",i+="                    <li>Highlight Style",i+="                      <ul>",Detector.webgl?(i+="                        <li><input type='radio' name='"+e.pre+"menu2_hl_style' id='"+e.pre+"menu2_hl_styleOutline' checked><label for='"+e.pre+"menu2_hl_styleOutline'>Outline </li>",i+="                        <li><input type='radio' name='"+e.pre+"menu2_hl_style' id='"+e.pre+"menu2_hl_styleObject'><label for='"+e.pre+"menu2_hl_styleObject'>3D Objects </li>"):(i+="                        <li><input type='radio' name='"+e.pre+"menu2_hl_style' id='"+e.pre+"menu2_hl_styleOutline'><label for='"+e.pre+"menu2_hl_styleOutline'>Outline </li>",i+="                        <li><input type='radio' name='"+e.pre+"menu2_hl_style' id='"+e.pre+"menu2_hl_styleObject' checked><label for='"+e.pre+"menu2_hl_styleObject'>3D Objects </li>"),i+="                      </ul>",i+="                    </li>",i+="              </ul>",i+="              ",i+="          ",i+="    "},setMenu3:function{var e=this,i="";return i+="    ",i+="          <accordion id='"+e.pre+"accordion3'>",i+="              Style ",i+="              ",i+="              <ul class='menu'>",void 0===e.cfg.cid?(void 0!==e.cfg.align?(i+="                <li>Proteins",i+="                  <ul>",i+="                      <li><input type='radio' name='"+e.pre+"menu3_proteins' id='"+e.pre+"menu3_proteinsRibbon'><label for='"+e.pre+"menu3_proteinsRibbon'>Ribbon </li>",i+="                      <li><input type='radio' name='"+e.pre+"menu3_proteins' id='"+e.pre+"menu3_proteinsStrand'><label for='"+e.pre+"menu3_proteinsStrand'>Strand </li>",i+="                      <li><input type='radio' name='"+e.pre+"menu3_proteins' id='"+e.pre+"menu3_proteinsCylinder'><label for='"+e.pre+"menu3_proteinsCylinder'>Cylinder and Plate </li>",i+="                      <li><input type='radio' name='"+e.pre+"menu3_proteins' id='"+e.pre+"menu3_proteinsSchematic'><label for='"+e.pre+"menu3_proteinsSchematic'>Schematic </li>",i+="                      <li><input type='radio' name='"+e.pre+"menu3_proteins' id='"+e.pre+"menu3_proteinsCalpha' checked><label for='"+e.pre+"menu3_proteinsCalpha'>C Alpha Trace </li>",i+="                      <li><input type='radio' name='"+e.pre+"menu3_proteins' id='"+e.pre+"menu3_proteinsBfactor'><label for='"+e.pre+"menu3_proteinsBfactor'>B Factor Tube </li>",i+="                      <li><input type='radio' name='"+e.pre+"menu3_proteins' id='"+e.pre+"menu3_proteinsLines'><label for='"+e.pre+"menu3_proteinsLines'>Lines </li>",i+="                      <li><input type='radio' name='"+e.pre+"menu3_proteins' id='"+e.pre+"menu3_proteinsStick'><label for='"+e.pre+"menu3_proteinsStick'>Stick </li>",i+="                      <li><input type='radio' name='"+e.pre+"menu3_proteins' id='"+e.pre+"menu3_proteinsBallstick'><label for='"+e.pre+"menu3_proteinsBallstick'>Ball and Stick </li>",i+="                      <li><input type='radio' name='"+e.pre+"menu3_proteins' id='"+e.pre+"menu3_proteinsSphere'><label for='"+e.pre+"menu3_proteinsSphere'>Sphere </li>",i+="                      <li><input type='radio' name='"+e.pre+"menu3_proteins' id='"+e.pre+"menu3_proteinsNothing'><label for='"+e.pre+"menu3_proteinsNothing'>Hide </li>",i+="                  </ul>",i+="                </li>"):(i+="                <li>Protein",i+="                  <ul>",i+="                      <li><input type='radio' name='"+e.pre+"menu3_proteins' id='"+e.pre+"menu3_proteinsRibbon' checked><label for='"+e.pre+"menu3_proteinsRibbon'>Ribbon </li>",i+="                      <li><input type='radio' name='"+e.pre+"menu3_proteins' id='"+e.pre+"menu3_proteinsStrand'><label for='"+e.pre+"menu3_proteinsStrand'>Strand </li>",i+="                      <li><input type='radio' name='"+e.pre+"menu3_proteins' id='"+e.pre+"menu3_proteinsCylinder'><label for='"+e.pre+"menu3_proteinsCylinder'>Cylinder and Plate </li>",i+="                      <li><input type='radio' name='"+e.pre+"menu3_proteins' id='"+e.pre+"menu3_proteinsSchematic'><label for='"+e.pre+"menu3_proteinsSchematic'>Schematic </li>",i+="                      <li><input type='radio' name='"+e.pre+"menu3_proteins' id='"+e.pre+"menu3_proteinsCalpha'><label for='"+e.pre+"menu3_proteinsCalpha'>C Alpha Trace </li>",i+="                      <li><input type='radio' name='"+e.pre+"menu3_proteins' id='"+e.pre+"menu3_proteinsBfactor'><label for='"+e.pre+"menu3_proteinsBfactor'>B Factor Tube </li>",i+="                      <li><input type='radio' name='"+e.pre+"menu3_proteins' id='"+e.pre+"menu3_proteinsLines'><label for='"+e.pre+"menu3_proteinsLines'>Lines </li>",i+="                      <li><input type='radio' name='"+e.pre+"menu3_proteins' id='"+e.pre+"menu3_proteinsStick'><label for='"+e.pre+"menu3_proteinsStick'>Stick </li>",i+="                      <li><input type='radio' name='"+e.pre+"menu3_proteins' id='"+e.pre+"menu3_proteinsBallstick'><label for='"+e.pre+"menu3_proteinsBallstick'>Ball and Stick </li>",i+="                      <li><input type='radio' name='"+e.pre+"menu3_proteins' id='"+e.pre+"menu3_proteinsSphere'><label for='"+e.pre+"menu3_proteinsSphere'>Sphere </li>",i+="                      <li><input type='radio' name='"+e.pre+"menu3_proteins' id='"+e.pre+"menu3_proteinsNothing'><label for='"+e.pre+"menu3_proteinsNothing'>Hide </li>",i+="                  </ul>",i+="                </li>"),i+="                <li>Side Chains",i+="                  <ul>",i+="                      <li><input type='radio' name='"+e.pre+"menu3_sidechains' id='"+e.pre+"menu3_sidechainsLines'><label for='"+e.pre+"menu3_sidechainsLines'>Lines </li>",i+="                      <li><input type='radio' name='"+e.pre+"menu3_sidechains' id='"+e.pre+"menu3_sidechainsStick'><label for='"+e.pre+"menu3_sidechainsStick'>Stick </li>",i+="                      <li><input type='radio' name='"+e.pre+"menu3_sidechains' id='"+e.pre+"menu3_sidechainsBallstick'><label for='"+e.pre+"menu3_sidechainsBallstick'>Ball and Stick </li>",i+="                      <li><input type='radio' name='"+e.pre+"menu3_sidechains' id='"+e.pre+"menu3_sidechainsSphere'><label for='"+e.pre+"menu3_sidechainsSphere'>Sphere </li>",i+="                      <li><input type='radio' name='"+e.pre+"menu3_sidechains' id='"+e.pre+"menu3_sidechainsNothing' checked><label for='"+e.pre+"menu3_sidechainsNothing'>Hide </li>",i+="                  </ul>",i+="                </li>",i+="                <li>Nucleotides",i+="                  <ul>",i+="                      <li><input type='radio' name='"+e.pre+"menu3_nucl' id='"+e.pre+"menu3_nuclCartoon' checked><label for='"+e.pre+"menu3_nuclCartoon'>Cartoon </li>",i+="                      <li><input type='radio' name='"+e.pre+"menu3_nucl' id='"+e.pre+"menu3_nuclPhos'><label for='"+e.pre+"menu3_nuclPhos'>Phosphorus Trace </li>",i+="                      <li><input type='radio' name='"+e.pre+"menu3_nucl' id='"+e.pre+"menu3_nuclSchematic'><label for='"+e.pre+"menu3_nuclSchematic'>Schematic </li>",i+="                      <li><input type='radio' name='"+e.pre+"menu3_nucl' id='"+e.pre+"menu3_nuclLines'><label for='"+e.pre+"menu3_nuclLines'>Lines </li>",i+="                      <li><input type='radio' name='"+e.pre+"menu3_nucl' id='"+e.pre+"menu3_nuclStick'><label for='"+e.pre+"menu3_nuclStick'>Stick </li>",i+="                      <li><input type='radio' name='"+e.pre+"menu3_nucl' id='"+e.pre+"menu3_nuclBallstick'><label for='"+e.pre+"menu3_nuclBallstick'>Ball and Stick </li>",i+="                      <li><input type='radio' name='"+e.pre+"menu3_nucl' id='"+e.pre+"menu3_nuclSphere'><label for='"+e.pre+"menu3_nuclSphere'>Sphere </li>",i+="                      <li><input type='radio' name='"+e.pre+"menu3_nucl' id='"+e.pre+"menu3_nuclNothing'><label for='"+e.pre+"menu3_nuclNothing'>Hide </li>",i+="                  </ul>",i+="                </li>",i+="                <li>Ligands",i+="                  <ul>",i+="                      <li><input type='radio' name='"+e.pre+"menu3_ligands' id='"+e.pre+"menu3_ligandsLines'><label for='"+e.pre+"menu3_ligandsLines'>Lines </li>",i+="                      <li><input type='radio' name='"+e.pre+"menu3_ligands' id='"+e.pre+"menu3_ligandsStick' checked><label for='"+e.pre+"menu3_ligandsStick'>Stick </li>",i+="                      <li><input type='radio' name='"+e.pre+"menu3_ligands' id='"+e.pre+"menu3_ligandsBallstick'><label for='"+e.pre+"menu3_ligandsBallstick'>Ball and Stick </li>",i+="                      <li><input type='radio' name='"+e.pre+"menu3_ligands' id='"+e.pre+"menu3_ligandsSchematic'><label for='"+e.pre+"menu3_ligandsSchematic'>Schematic </li>",i+="                      <li><input type='radio' name='"+e.pre+"menu3_ligands' id='"+e.pre+"menu3_ligandsSphere'><label for='"+e.pre+"menu3_ligandsSphere'>Sphere </li>",i+="                      <li><input type='radio' name='"+e.pre+"menu3_ligands' id='"+e.pre+"menu3_ligandsNothing'><label for='"+e.pre+"menu3_ligandsNothing'>Hide </li>",i+="                  </ul>",i+="                </li>"):(i+="                <li>Ligands",i+="                  <ul>",i+="                      <li><input type='radio' name='"+e.pre+"menu3_ligands' id='"+e.pre+"menu3_ligandsLines'><label for='"+e.pre+"menu3_ligandsLines'>Lines </li>",i+="                      <li><input type='radio' name='"+e.pre+"menu3_ligands' id='"+e.pre+"menu3_ligandsStick'><label for='"+e.pre+"menu3_ligandsStick'>Stick </li>",i+="                      <li><input type='radio' name='"+e.pre+"menu3_ligands' id='"+e.pre+"menu3_ligandsBallstick' checked><label for='"+e.pre+"menu3_ligandsBallstick'>Ball and Stick </li>",i+="                      <li><input type='radio' name='"+e.pre+"menu3_ligands' id='"+e.pre+"menu3_ligandsSchematic'><label for='"+e.pre+"menu3_ligandsSchematic'>Schematic </li>",i+="                      <li><input type='radio' name='"+e.pre+"menu3_ligands' id='"+e.pre+"menu3_ligandsSphere'><label for='"+e.pre+"menu3_ligandsSphere'>Sphere </li>",i+="                      <li><input type='radio' name='"+e.pre+"menu3_ligands' id='"+e.pre+"menu3_ligandsNothing'><label for='"+e.pre+"menu3_ligandsNothing'>Hide </li>",i+="                  </ul>",i+="                </li>"),i+="                <li>Ions",i+="                  <ul>",i+="                      <li><input type='radio' name='"+e.pre+"menu3_ions' id='"+e.pre+"menu3_ionsSphere' checked><label for='"+e.pre+"menu3_ionsSphere'>Sphere </li>",i+="                      <li><input type='radio' name='"+e.pre+"menu3_ions' id='"+e.pre+"menu3_ionsDot'><label for='"+e.pre+"menu3_ionsDot'>Dot </li>",i+="                      <li><input type='radio' name='"+e.pre+"menu3_ions' id='"+e.pre+"menu3_ionsNothing'><label for='"+e.pre+"menu3_ionsNothing'>Hide </li>",i+="                  </ul>",i+="                </li>",i+="                <li>Water",i+="                  <ul>",i+="                      <li><input type='radio' name='"+e.pre+"menu3_water' id='"+e.pre+"menu3_waterSphere'><label for='"+e.pre+"menu3_waterSphere'>Sphere </li>",i+="                      <li><input type='radio' name='"+e.pre+"menu3_water' id='"+e.pre+"menu3_waterDot'><label for='"+e.pre+"menu3_waterDot'>Dot </li>",i+="                      <li><input type='radio' name='"+e.pre+"menu3_water' id='"+e.pre+"menu3_waterNothing' checked><label for='"+e.pre+"menu3_waterNothing'>Hide </li>",i+="                  </ul>",i+="                </li>",i+="              </ul>",i+="              ",i+="          ",i+="    "},setMenu4:function{var e=this,i="";return i+="    ",i+="          <accordion id='"+e.pre+"accordion4'>",i+="              Color ",i+="              ",i+="              <ul class='menu'>",void 0===e.cfg.cid?(i+=void 0!==e.cfg.mmdbid?" <li><input type='radio' name='"+e.pre+"menu4_color' id='"+e.pre+"menu4_colorSpectrum'><label for='"+e.pre+"menu4_colorSpectrum'>Spectrum </li>":"               <li><input type='radio' name='"+e.pre+"menu4_color' id='"+e.pre+"menu4_colorSpectrum' checked><label for='"+e.pre+"menu4_colorSpectrum'>Spectrum </li>", i+="                <li><input type='radio' name='"+e.pre+"menu4_color' id='"+e.pre+"menu4_colorSS'><label for='"+e.pre+"menu4_colorSS'>Secondary </li>",i+="                <li><input type='radio' name='"+e.pre+"menu4_color' id='"+e.pre+"menu4_colorCharge'><label for='"+e.pre+"menu4_colorCharge'>Charge </li>",i+="                <li><input type='radio' name='"+e.pre+"menu4_color' id='"+e.pre+"menu4_colorHydrophobic'><label for='"+e.pre+"menu4_colorHydrophobic'>Hydrophobic </li>",i+="                <li><input type='radio' name='"+e.pre+"menu4_color' id='"+e.pre+"menu4_colorChain'><label for='"+e.pre+"menu4_colorChain'>Chain </li>",i+="                <li><input type='radio' name='"+e.pre+"menu4_color' id='"+e.pre+"menu4_colorResidue'><label for='"+e.pre+"menu4_colorResidue'>Residue </li>",i+="                <li><input type='radio' name='"+e.pre+"menu4_color' id='"+e.pre+"menu4_colorAtom'><label for='"+e.pre+"menu4_colorAtom'>Atom </li>",void 0!==e.cfg.align&&(i+="                <li><input type='radio' name='"+e.pre+"menu4_color' id='"+e.pre+"menu4_colorConserved'><label for='"+e.pre+"menu4_colorConserved'>Identity </li>")):i+="                <li><input type='radio' name='"+e.pre+"menu4_color' id='"+e.pre+"menu4_colorAtom' checked><label for='"+e.pre+"menu4_colorAtom'>Atom </li>",i+="                <li>-</li>",i+="                <li>Unicolor",i+="                  <ul>",i+="                    <li><input type='radio' name='"+e.pre+"menu4_color' id='"+e.pre+"menu4_colorRed'><label for='"+e.pre+"menu4_colorRed'>Red </li>",i+="                    <li><input type='radio' name='"+e.pre+"menu4_color' id='"+e.pre+"menu4_colorGreen'><label for='"+e.pre+"menu4_colorGreen'>Green </li>",i+="                    <li><input type='radio' name='"+e.pre+"menu4_color' id='"+e.pre+"menu4_colorBlue'><label for='"+e.pre+"menu4_colorBlue'>Blue </li>",i+="                    <li><input type='radio' name='"+e.pre+"menu4_color' id='"+e.pre+"menu4_colorMagenta'><label for='"+e.pre+"menu4_colorMagenta'>Magenta </li>",i+="                    <li><input type='radio' name='"+e.pre+"menu4_color' id='"+e.pre+"menu4_colorYellow'><label for='"+e.pre+"menu4_colorYellow'>Yellow </li>",i+="                    <li><input type='radio' name='"+e.pre+"menu4_color' id='"+e.pre+"menu4_colorCyan'><label for='"+e.pre+"menu4_colorCyan'>Cyan </li>",i+="                    <li><input type='radio' name='"+e.pre+"menu4_color' id='"+e.pre+"menu4_colorWhite'><label for='"+e.pre+"menu4_colorWhite'>White </li>",i+="                    <li><input type='radio' name='"+e.pre+"menu4_color' id='"+e.pre+"menu4_colorGrey'><label for='"+e.pre+"menu4_colorGrey'>Grey </li>",i+="                  </ul>",i+="                <li>-</li>",i+="                <li><input type='radio' name='"+e.pre+"menu4_color' id='"+e.pre+"menu4_colorCustom'><label for='"+e.pre+"menu4_colorCustom'>Custom </li>",i+="              </ul>",i+="              ",i+="          ",i+="    "},setMenu5:function{var e=this,i="";return i+="    ",i+="          <accordion id='"+e.pre+"accordion5'>",i+="              Surface ",i+="              ",i+="              <ul class='menu'>",i+="                <li>Type",i+="                  <ul>",i+="                      <li><input type='radio' name='"+e.pre+"menu5_surface' id='"+e.pre+"menu5_surfaceVDW'><label for='"+e.pre+"menu5_surfaceVDW'>Van der Waals </li>",i+="                      <li><input type='radio' name='"+e.pre+"menu5_surface' id='"+e.pre+"menu5_surfaceMolecular'><label for='"+e.pre+"menu5_surfaceMolecular'>Molecular Surface </li>",i+="                      <li><input type='radio' name='"+e.pre+"menu5_surface' id='"+e.pre+"menu5_surfaceSAS'><label for='"+e.pre+"menu5_surfaceSAS'>Solvent Accessible </li>",i+="                      <li><input type='radio' name='"+e.pre+"menu5_surface' id='"+e.pre+"menu5_surfaceNothing' checked><label for='"+e.pre+"menu5_surfaceNothing'>Remove </li>",i+="                  </ul>",i+="                </li>",i+="                <li>Opacity",i+="                  <ul>",i+="                      <li><input type='radio' name='"+e.pre+"menu5_opacity' id='"+e.pre+"menu5_opacity10'><label for='"+e.pre+"menu5_opacity10'>1.0 </li>",i+="                      <li><input type='radio' name='"+e.pre+"menu5_opacity' id='"+e.pre+"menu5_opacity09'><label for='"+e.pre+"menu5_opacity09'>0.9 </li>",i+="                      <li><input type='radio' name='"+e.pre+"menu5_opacity' id='"+e.pre+"menu5_opacity08' checked><label for='"+e.pre+"menu5_opacity08'>0.8 </li>",i+="                      <li><input type='radio' name='"+e.pre+"menu5_opacity' id='"+e.pre+"menu5_opacity07'><label for='"+e.pre+"menu5_opacity07'>0.7 </li>",i+="                      <li><input type='radio' name='"+e.pre+"menu5_opacity' id='"+e.pre+"menu5_opacity06'><label for='"+e.pre+"menu5_opacity06'>0.6 </li>",i+="                      <li><input type='radio' name='"+e.pre+"menu5_opacity' id='"+e.pre+"menu5_opacity05'><label for='"+e.pre+"menu5_opacity05'>0.5 </li>",i+="                  </ul>",i+="                </li>",i+="                <li>Wireframe",i+="                  <ul>",i+="                      <li><input type='radio' name='"+e.pre+"menu5_wireframe' id='"+e.pre+"menu5_wireframeYes'><label for='"+e.pre+"menu5_wireframeYes'>Yes </li>",i+="                      <li><input type='radio' name='"+e.pre+"menu5_wireframe' id='"+e.pre+"menu5_wireframeNo' checked><label for='"+e.pre+"menu5_wireframeNo'>No </li>",i+="                  </ul>",i+="                </li>",i+="                <li>Neighbors",i+="                  <ul>",i+="                      <li><input type='radio' name='"+e.pre+"menu5_neighbors' id='"+e.pre+"menu5_neighborsYes'><label for='"+e.pre+"menu5_neighborsYes'>Yes </li>",i+="                      <li><input type='radio' name='"+e.pre+"menu5_neighbors' id='"+e.pre+"menu5_neighborsNo' checked><label for='"+e.pre+"menu5_neighborsNo'>No </li>",i+="                  </ul>",i+="                </li>",i+="              </ul>",i+="              ",i+="          ",i+="    "},setMenu6:function{var e=this,i="";return i+="    ",i+="          <accordion id='"+e.pre+"accordion6'>",i+="              Other ",i+="              ",i+="              <ul class='menu'>",i+="                <li><span id='"+e.pre+"reset' class='icn3d-link'>Reset </li>",i+="                <li><span id='"+e.pre+"menu6_resetorientation' class='icn3d-link'>Reset Orien. </li>",i+="               <li><span id='"+e.pre+"menu6_center' class='icn3d-link'>Center </li>",i+="                <li><span id='"+e.pre+"menu6_back' class='icn3d-link'>Backward </li>",i+="                <li><span id='"+e.pre+"menu6_forward' class='icn3d-link'>Forward </li>",void 0===e.cfg.cid&&(i+="                <li>Assembly",i+="                  <ul>",i+="                      <li><input type='radio' name='"+e.pre+"menu6_assembly' id='"+e.pre+"menu6_assemblyYes'><label for='"+e.pre+"menu6_assemblyYes'>Yes </li>",i+="                      <li><input type='radio' name='"+e.pre+"menu6_assembly' id='"+e.pre+"menu6_assemblyNo' checked><label for='"+e.pre+"menu6_assemblyNo'>No </li>",i+="                  </ul>",i+="                </li>",i+="                <li>H-bonds",i+="                  <ul>",i+="                      <li><input type='radio' name='"+e.pre+"menu6_hbonds' id='"+e.pre+"menu6_hbondsYes'><label for='"+e.pre+"menu6_hbondsYes'>Show </li>",i+="                      <li><input type='radio' name='"+e.pre+"menu6_hbonds' id='"+e.pre+"menu6_hbondsNo' checked><label for='"+e.pre+"menu6_hbondsNo'>Hide </li>",i+="                  </ul>",i+="                </li>"),i+="                <li>Label",i+="                  <ul>",i+="                      <li><input type='radio' name='"+e.pre+"menu6_addlabel' id='"+e.pre+"menu6_addlabelYes'><label for='"+e.pre+"menu6_addlabelYes'>by Picking </li>",i+="                      <li><input type='radio' name='"+e.pre+"menu6_addlabel' id='"+e.pre+"menu6_addlabelSelection'><label for='"+e.pre+"menu6_addlabelSelection'>by Selection </li>",void 0===e.cfg.cid&&(i+="                      <li><input type='radio' name='"+e.pre+"menu6_addlabel' id='"+e.pre+"menu6_addlabelResidues'><label for='"+e.pre+"menu6_addlabelResidues'>by Residues </li>"),i+="                      <li><input type='radio' name='"+e.pre+"menu6_addlabel' id='"+e.pre+"menu6_addlabelNo' checked><label for='"+e.pre+"menu6_addlabelNo'>Remove </li>",i+="                  </ul>",i+="                </li>",i+="                <li>Distance",i+="                  <ul>",i+="                      <li><input type='radio' name='"+e.pre+"menu6_distance' id='"+e.pre+"menu6_distanceYes'><label for='"+e.pre+"menu6_distanceYes'>Show </li>",i+="                      <li><input type='radio' name='"+e.pre+"menu6_distance' id='"+e.pre+"menu6_distanceNo' checked><label for='"+e.pre+"menu6_distanceNo'>Hide </li>",i+="                  </ul>",i+="                </li>",i+="                <li>Auto Rotation",i+="                  <ul>",i+="                      <li><span id='"+e.pre+"menu6_rotateleft' class='icn3d-link'>Rotate Left </li>",i+="                      <li><span id='"+e.pre+"menu6_rotateright' class='icn3d-link'>Rotate Right </li>",i+="                      <li><span id='"+e.pre+"menu6_rotateup' class='icn3d-link'>Rotate Up </li>",i+="                      <li><span id='"+e.pre+"menu6_rotatedown' class='icn3d-link'>Rotate Down </li>",i+="                  </ul>",i+="                </li>",i+="                <li>Camera",i+="                  <ul>",i+="                      <li><input type='radio' name='"+e.pre+"menu6_camera' id='"+e.pre+"menu6_cameraPers' checked><label for='"+e.pre+"menu6_cameraPers'>Perspective </li>",i+="                      <li><input type='radio' name='"+e.pre+"menu6_camera' id='"+e.pre+"menu6_cameraOrth'><label for='"+e.pre+"menu6_cameraOrth'>Orthographic </li>",i+="                  </ul>",i+="                </li>",i+="                <li>Background",i+="                  <ul>",i+="                      <li><input type='radio' name='"+e.pre+"menu6_bkgd' id='"+e.pre+"menu6_bkgdBlack' checked><label for='"+e.pre+"menu6_bkgdBlack'>Black </li>",i+="                      <li><input type='radio' name='"+e.pre+"menu6_bkgd' id='"+e.pre+"menu6_bkgdGrey'><label for='"+e.pre+"menu6_bkgdGrey'>Grey </li>",i+="                      <li><input type='radio' name='"+e.pre+"menu6_bkgd' id='"+e.pre+"menu6_bkgdWhite'><label for='"+e.pre+"menu6_bkgdWhite'>White </li>",i+="                  </ul>",i+="                </li>",i+="                <li>Fog",i+="                  <ul>",i+="                      <li><input type='radio' name='"+e.pre+"menu6_showfog' id='"+e.pre+"menu6_showfogYes'><label for='"+e.pre+"menu6_showfogYes'>On </li>",i+="                      <li><input type='radio' name='"+e.pre+"menu6_showfog' id='"+e.pre+"menu6_showfogNo' checked><label for='"+e.pre+"menu6_showfogNo'>Off </li>",i+="                  </ul>",i+="                </li>",i+="                <li>Slab",i+="                  <ul>",i+="                      <li><input type='radio' name='"+e.pre+"menu6_showslab' id='"+e.pre+"menu6_showslabYes'><label for='"+e.pre+"menu6_showslabYes'>On </li>",i+="                      <li><input type='radio' name='"+e.pre+"menu6_showslab' id='"+e.pre+"menu6_showslabNo' checked><label for='"+e.pre+"menu6_showslabNo'>Off </li>",i+="                  </ul>",i+="                </li>",i+="                <li>XYZ-axes",i+="                  <ul>",i+="                      <li><input type='radio' name='"+e.pre+"menu6_showaxis' id='"+e.pre+"menu6_showaxisYes'><label for='"+e.pre+"menu6_showaxisYes'>Show </li>",i+="                      <li><input type='radio' name='"+e.pre+"menu6_showaxis' id='"+e.pre+"menu6_showaxisNo' checked><label for='"+e.pre+"menu6_showaxisNo'>Hide </li>",i+="                  </ul>",i+="                </li>",i+="                <li>Transform Hint",i+="                  <ul>",i+="                    <li>Rotate",i+="                        <ul>",i+="                            <li>Left Mouse</li>",i+="                            <li>Key L: Left</li>",i+="                            <li>Key J: Right</li>",i+="                            <li>Key I: Up</li>",i+="                            <li>Key M: Down</li>",i+="                        </ul>",i+="                    </li>",i+="                    <li>Zoom",i+="                        <ul>",i+="                            <li>Middle Mouse</li>",i+="                            <li>Key Z: Zoom in</li>",i+="                            <li>Key X: Zoom out</li>",i+="                        </ul>",i+="                    </li>",i+="                    <li>Translate",i+="                        <ul>",i+="                            <li>Right Mouse</li>",i+="                        </ul>",i+="                    </li>",i+="                  </ul>",i+="                </li>",i+="                <li><a href='https://www.ncbi.nlm.nih.gov/Structure/icn3d/icn3d.html' target='_blank'>Help</a></li>",i+="              </ul>",i+="              ",i+="          ",i+="    "},setLogWindow:function{var e=this,i="";return i+="  <div id='"+e.pre+"commandlog' style='float:left; margin-top: -5px; width: 100%;'>",i+="    <textarea id='"+e.pre+"logtext' rows='2' style='width: 100%; height: "+.8*e.MENU_HEIGHT+"px; padding: 0px; border: 0px; background-color: "+e.GREYD+";'> ",i+="  "},setDialogs:function{var e=this,i="";return i+="",i+="<div id='"+e.pre+"allselections' class='icn3d-hidden'>",i+="<div id='"+e.pre+"dl_filter' style='overflow:auto; position:relative;'>",i+="  <button id='"+e.pre+"filter'> Show Structure ",i+="<button id='"+e.pre+"highlight_3d_diagram' style='margin-left:10px;'> Highlight ",i+="  <div id='"+e.pre+"dl_filter_table' class='icn3d-box'>",i+="  ",i+=" ",i+="<div id='"+e.pre+"dl_selectresidues'>",i+="  <div id='"+e.pre+"dl_sequence' class='icn3d-dl_sequence'>",i+="  ",i+=" ",void 0!==e.cfg.align&&(i+="<div id='"+e.pre+"dl_alignment'>",i+="  <div id='"+e.pre+"dl_sequence2' class='icn3d-dl_sequence'>",i+="  ",i+=" "),i+="<div id='"+e.pre+"dl_command'>",i+="   ",i+="  <td valign='top'> ",i+="    All Selections: ",i+="    <select id='"+e.pre+"customAtoms' multiple size='3' style='min-width:100px;'>",i+="    ",i+="  ",i+="   ",i+="  <td colspan='2'><a href='https://www.ncbi.nlm.nih.gov/Structure/icn3d/icn3d.html#selectb' target='_blank'> Hint </a>: ",i+='  Specification: In the selection "#1,2,3.A,B,C:5-10,Lys,ligands@CA,C":',i+='  <ul><li>"#1,2,3" uses "#" to indicate structure selection. ',i+=' <li>".A,B,C" uses "." to indicate chain selection. ',i+=' <li>":5-10,Lys,ligands" uses ":" to indicate residue selection. Residue could be predefined names: "proteins", "nucleotides", "ligands", "ions", and "water". ',i+=' <li>"@CA,C" uses "@" to indicate atom selection. ',i+=' <li>Partial definition is allowed, e.g., ":1-10" selects all residue IDs 1-10 in all chains. </ul>',i+=" Set Operation:",i+='  <ul><li>Users can select multiple items in "All Selections" above. ',i+=' <li>Different selections can be unioned (with "or", default), intersected (with "and"), or negated (with "not"). For example, ":1-10 or :Lys" selects all residues 1-10 and all Lys residues. ":1-10 and :Lys" selects all Lys residues in the range of residue number 1-10. ":1-10 or not :Lys" selects all residues 1-10, which are not Lys residues.</ul>',i+="   ",i+=" ",i+="<div id='"+e.pre+"dl_pdbid'>",i+="PDB ID: <input type='text' id='"+e.pre+"pdbid' value='2POR' size=8> ",i+="<button id='"+e.pre+"reload_pdb'>Load ",i+=" ",i+="<div id='"+e.pre+"dl_pdbfile'>",i+="PDB File: <input type='file' id='"+e.pre+"pdbfile' size=8> ",i+="<button id='"+e.pre+"reload_pdbfile'>Load ",i+=" ",i+="<div id='"+e.pre+"dl_mol2file'>",i+="Mol2 File: <input type='file' id='"+e.pre+"mol2file' size=8> ",i+="<button id='"+e.pre+"reload_mol2file'>Load ",i+=" ",i+="<div id='"+e.pre+"dl_sdffile'>",i+="SDF File: <input type='file' id='"+e.pre+"sdffile' size=8> ",i+="<button id='"+e.pre+"reload_sdffile'>Load ",i+=" ",i+="<div id='"+e.pre+"dl_xyzfile'>",i+="XYZ File: <input type='file' id='"+e.pre+"xyzfile' size=8> ",i+="<button id='"+e.pre+"reload_xyzfile'>Load ",i+=" ",i+="<div id='"+e.pre+"dl_mmciffile'>",i+="mmCIF File: <input type='file' id='"+e.pre+"mmciffile' value='2POR' size=8> ",i+="<button id='"+e.pre+"reload_mmciffile'>Load ",i+=" ",i+="<div id='"+e.pre+"dl_mmcifid'>",i+="mmCIF ID: <input type='text' id='"+e.pre+"mmcifid' value='2POR' size=8> ",i+="<button id='"+e.pre+"reload_mmcif'>Load ",i+=" ",i+="<div id='"+e.pre+"dl_mmdbid'>",i+="MMDB ID: <input type='text' id='"+e.pre+"mmdbid' value='2POR' size=8> ",i+="<button id='"+e.pre+"reload_mmdb'>Load ",i+=" ",i+="<div id='"+e.pre+"dl_gi'>",i+="Protein gi: <input type='text' id='"+e.pre+"gi' value='827343227' size=8> ",i+="<button id='"+e.pre+"reload_gi'>Load ",i+=" ",i+="<div id='"+e.pre+"dl_cid'>",i+="PubChem CID: <input type='text' id='"+e.pre+"cid' value='2244' size=8> ",i+="<button id='"+e.pre+"reload_cid'>Load ",i+=" ",i+="<div id='"+e.pre+"dl_state'>",i+="State file: <input type='file' id='"+e.pre+"state'> ",i+="<button id='"+e.pre+"reload_state' style='margin-top: 6px;'>Load ",i+=" ",i+="<div id='"+e.pre+"dl_selection'>",i+="Selection file: <input type='file' id='"+e.pre+"selectionfile'> ",i+="<button id='"+e.pre+"reload_selectionfile' style='margin-top: 6px;'>Load ",i+=" ",i+="<div id='"+e.pre+"dl_color'>",i+="Custom Color: <input type='text' id='"+e.pre+"color' value='#FF0000' size=8> ",i+="<button id='"+e.pre+"applycustomcolor'>Apply ",i+=" ",i+="<div id='"+e.pre+"dl_hbonds'>",i+=" To select residues that have hydrogen bonds with the current selection, please select the threshold of H-bonds. ",i+=" Threshold: <select id='"+e.pre+"hbondthreshold'>",i+="  <option value='3.2'>3.2 ",i+="  <option value='3.3'>3.3 ",i+="  <option value='3.4'>3.4 ",i+="  <option value='3.5' selected>3.5 ",i+="  <option value='3.6'>3.6 ",i+="  <option value='3.7'>3.7 ",i+="  <option value='3.8'>3.8 ",i+="  <option value='3.9'>3.9 ",i+="  <option value='4.0'>4.0 ",i+="  &#197; <button id='"+e.pre+"applyhbonds'>Display ",i+=" ",i+="<div id='"+e.pre+"dl_aroundsphere'",i+="  1. Sphere with a radius: <input type='text' id='"+e.pre+"radius_aroundsphere' value='5' size='2'> &#197; ",i+="  2. <button id='"+e.pre+"applypick_aroundsphere'>Display the sphere around currently selected atoms ",i+=" ",i+="<div id='"+e.pre+"dl_select_chain'>",i+="    ",i+=" ",i+="<div id='"+e.pre+"dl_addlabel'>",i+="1. Text: <input type='text' id='"+e.pre+"labeltext' value='Text' size=4> ",i+="2. Size: <input type='text' id='"+e.pre+"labelsize' value='18' size=4 maxlength=2> ",i+="3. Color: <input type='text' id='"+e.pre+"labelcolor' value='#ffff00' size=4> ",i+="4. Background: <input type='text' id='"+e.pre+"labelbkgd' value='#cccccc' size=4> ",i+=" 5. Pick TWO atoms ",i+=" 6. <button id='"+e.pre+"applypick_labels'>Display ",i+=" ",i+="<div id='"+e.pre+"dl_addlabelselection'>",i+="1. Text: <input type='text' id='"+e.pre+"labeltext2' value='Text' size=4> ",i+="2. Size: <input type='text' id='"+e.pre+"labelsize2' value='18' size=4 maxlength=2> ",i+="3. Color: <input type='text' id='"+e.pre+"labelcolor2' value='#ffff00' size=4> ",i+="4. Background: <input type='text' id='"+e.pre+"labelbkgd2' value='#cccccc' size=4> ",i+=" 5. <button id='"+e.pre+"applyselection_labels'>Display ",i+=" ",i+="<div id='"+e.pre+"dl_distance'>",i+=" 1. Pick TWO atoms ",i+="  2. <button id='"+e.pre+"applypick_measuredistance'>Display ",i+=" ",i+=" ",i+=""},setCustomDialogs:function{var e="";return e},setTools:function{var e=this,i="";i+=" <div id='"+e.pre+"selection' style='position:absolute; z-index:555; float:left; display:table-row; margin: 32px 0px 0px 3px;'>",i+="     ",i+="    "},updateMenus:function(e){var i=this,t=i.setStructureMenu(e),n=i.setChainMenu(e),o=i.setAlignChainMenu(e),s=i.setResidueMenu,r=i.setAtomMenu;$("#"+i.pre+"structureid")&&$("#"+i.pre+"structureid").html(t),$("#"+i.pre+"chainid")&&$("#"+i.pre+"chainid").html(n),$("#"+i.pre+"alignChainid")&&$("#"+i.pre+"alignChainid").html(o),$("#"+i.pre+"customResidues")&&$("#"+i.pre+"customResidues").html(s),$("#"+i.pre+"structureid2")&&$("#"+i.pre+"structureid2").html(t),$("#"+i.pre+"chainid2")&&$("#"+i.pre+"chainid2").html(n),$("#"+i.pre+"alignChainid2")&&$("#"+i.pre+"alignChainid2").html(o),$("#"+i.pre+"customResidues2")&&$("#"+i.pre+"customResidues2").html(s),$("#"+i.pre+"customAtoms")&&$("#"+i.pre+"customAtoms").html(r)},selectAllUpdateMenuSeq:function(e,i){var t=this;e&&t.setProteinsNucleotidesLigands,this.updateMenus(e);var n=t.getSequencesAnnotations(Object.keys(t.icn3d.chains),void 0,void 0,i);$("#"+t.pre+"dl_sequence").html(n.sequencesHtml),$("#"+t.pre+"dl_sequence").width(t.RESIDUE_WIDTH*n.maxSeqCnt+200),void 0!==t.cfg.align&&(n=t.getAlignSequencesAnnotations(Object.keys(t.icn3d.alignChains),void 0,void 0,i),$("#"+t.pre+"dl_sequence2").html(n.sequencesHtml),$("#"+t.pre+"dl_sequence2").width(t.RESIDUE_WIDTH*n.maxSeqCnt+200))},selectAll:function{var e=this;e.icn3d.highlightAtoms={};for(var i in e.icn3d.chains)e.icn3d.highlightAtoms=e.icn3d.unionHash(e.icn3d.highlightAtoms,e.icn3d.chains[i]),e.icn3d.displayAtoms=e.icn3d.unionHash(e.icn3d.displayAtoms,e.icn3d.chains[i]);e.icn3d.removeHighlightObjects,e.bSelectResidue=!1,e.bSelectAlignResidue=!1,e.selectAllUpdateMenuSeq(!0,!1),e.icn3d.draw},selectComplement:function{var e,i=this,t={},n={};for(var o in i.icn3d.atoms)i.icn3d.highlightAtoms.hasOwnProperty(o)||(t[o]=1,e=i.icn3d.atoms[o].structure+"_"+i.icn3d.atoms[o].chain+"_"+i.icn3d.atoms[o].resi,n[e]=1);i.icn3d.highlightAtoms={},i.icn3d.highlightAtoms=i.icn3d.cloneHash(t),i.icn3d.removeHighlightObjects;var s="Annotation(s): Complement of the current selection ",r=i.getSequencesAnnotations(void 0,!0,Object.keys(n));$("#"+i.pre+"dl_sequence").html(s+r.sequencesHtml),$("#"+i.pre+"dl_sequence").width(i.RESIDUE_WIDTH*r.maxSeqCnt+200),i.icn3d.addHighlightObjects},updateSeqWinForCurrentAtoms:function(e){var i=this,t=i.icn3d.getResiduesFromAtoms(i.icn3d.highlightAtoms),n=i.getSequencesAnnotations(void 0,!1,Object.keys(t),e);$("#"+i.pre+"dl_sequence").html(n.sequencesHtml),$("#"+i.pre+"dl_sequence").width(i.RESIDUE_WIDTH*n.maxSeqCnt+200),void 0!==i.cfg.align&&(n=i.getAlignSequencesAnnotations(void 0,!1,Object.keys(t),e),$("#"+i.pre+"dl_sequence2").html(n.sequencesHtml),$("#"+i.pre+"dl_sequence2").width(i.RESIDUE_WIDTH*n.maxSeqCnt+200))},outputSelection:function{var e=this,i={};for(var t in e.icn3d.highlightAtoms){var n=e.icn3d.atoms[t].structure+"_"+e.icn3d.atoms[t].chain+"_"+e.icn3d.atoms[t].resi;i[n]=1}for(var o=Object.keys(i).sort(function(e,i){if(""!==e&&!isNaN(e))return parseInt(e)-parseInt(i);var t=e.lastIndexOf("_"),n=i.lastIndexOf("_");if(e.substr(0,t)<i.substr(0,t))return-1;if(e.substr(0,t)>i.substr(0,t))return 1;if(e.substr(0,t)==i.substr(0,t)){if(parseInt(e.substr(t+1))<parseInt(i.substr(n+1)))return-1;if(parseInt(e.substr(t+1))>parseInt(i.substr(n+1)))return 1;if(parseInt(e.substr(t+1))==parseInt(i.substr(n+1)))return 0}}),s=" ",t+="Counts by Chain for atoms with coordinates:  ",e.saveFile(e.inputid+"_counts.html","html",t)})},clickMenu1_exportSelections:function{var e=this;$("#"+e.pre+"menu1_exportSelections").click(function(i){e.setLogCommand("export all selections",!1);var t=e.exportCustomAtoms;e.saveFile(e.inputid+"_selections.txt","text",t)})},clickMenu1_sharelink:function{var e=this;$("#"+e.pre+"menu1_sharelink").click(function(i){var t="./full.html?",n=inpara.indexOf("&command="),o=-1!==n?inpara.substr(0,n):inpara;t+=o.substr(1)+"&command=";for(var s=1,r=e.icn3d.commands.length;r>s;++s){var a=e.icn3d.commands[s].split("|||");if(s===r-1){var c=a.length>1?"|||"+a[1]:"";1!==s&&(t+="; "),t+=a[0]+c}else 1===s?t+=a[0]:1!==s&&s!==r-1&&(t+="; "+a[0])}e.setLogCommand("share link: "+t,!1),t.length>4e3&&alert("The url is more than 4000 characters and may not work. Please export the 'State File' and open it in the viewer."),window.open(t,"_blank")})},clickMenu1_link_structure:function{var e=this;$("#"+e.pre+"menu1_link_structure").click(function(i){var t=e.getLinkToStructureSummary(!0);window.open(t,"_blank")})},clickMenu1_link_bind:function{var e=this;$("#"+e.pre+"menu1_link_bind").click(function(i){url="https://www.ncbi.nlm.nih.gov/pccompound?LinkName=pccompound_structure&from_uid="+e.inputid,e.setLogCommand("link to 3D protein structures bound to CID "+e.inputid+": "+url,!1),window.open(url,"_blank")})},clickMenu1_link_vast:function{var e=this;$("#"+e.pre+"menu1_link_vast").click(function(i){if(void 0===e.inputid)t="https://www.ncbi.nlm.nih.gov/pccompound?term="+e.icn3d.moleculeTitle,e.setLogCommand("link to compounds "+e.icn3d.moleculeTitle+": "+t,!1);else{if(void 0!==e.cfg.cid)t="https://www.ncbi.nlm.nih.gov/pccompound?LinkName=pccompound_pccompound_3d&from_uid="+e.inputid,e.setLogCommand("link to compounds with structure similar to CID "+e.inputid+": "+t,!1);else{var t,n=e.inputid.split("_");1===n.length?(t="https://www.ncbi.nlm.nih.gov/Structure/vastplus/vastplus.cgi?uid="+e.inputid,e.setLogCommand("link to structures similar to "+e.inputid+": "+t,!1)):2===n.length&&(t="https://www.ncbi.nlm.nih.gov/Structure/vastplus/vastplus.cgi?uid="+n[0],e.setLogCommand("link to structures similar to "+n[0]+": "+t,!1))}window.open(t,"_blank")}})},clickMenu1_link_pubmed:function{var e=this;$("#"+e.pre+"menu1_link_pubmed").click(function(i){var t;if(void 0===e.inputid){var t;t="https://www.ncbi.nlm.nih.gov/pubmed/?term="+e.icn3d.moleculeTitle,e.setLogCommand("link to literature about "+e.icn3d.moleculeTitle+": "+t,!1),window.open(t,"_blank")}else if(void 0!==e.pmid){var t,n=e.pmid.toString.split("_");1===n.length?(t="https://www.ncbi.nlm.nih.gov/pubmed/"+e.pmid,e.setLogCommand("link to PubMed ID "+e.pmid+": "+t,!1)):2===n.length&&(t="https://www.ncbi.nlm.nih.gov/pubmed/?term="+n[0]+" OR "+n[1],e.setLogCommand("link to PubMed IDs "+n[0]+", "+n[1]+": "+t,!1)),window.open(t,"_blank")}else if(isNaN(e.inputid)){var t,n=e.inputid.toString.split("_");1===n.length?(t="https://www.ncbi.nlm.nih.gov/pubmed/?term="+e.inputid,e.setLogCommand("link to literature about PDB "+e.inputid+": "+t,!1)):2===n.length&&(t="https://www.ncbi.nlm.nih.gov/pubmed/?term="+n[0]+" OR "+n[1],e.setLogCommand("link to literature about PDB "+n[0]+" OR "+n[1]+": "+t,!1)),window.open(t,"_blank")}else void 0!==e.cfg.cid?alert("No literature information is available for this compound in the SDF file."):alert("No literature information is available for this structure.")})},clickMenu2_selectresidues:function{var e=this;$("#"+e.pre+"menu2_selectresidues").click(function(i){e.openDialog(e.pre+"dl_selectresidues","Select residues in sequences")})},clickMenu2_selectall:function{var e=this;$("#"+e.pre+"menu2_selectall").add("#"+e.pre+"selectall").click(function(i){e.setLogCommand("select all",!0),e.selectAll})},clickMenu2_selectcomplement:function{var e=this;$("#"+e.pre+"menu2_selectcomplement").click(function(i){Object.keys(e.icn3d.highlightAtoms).length<Object.keys(e.icn3d.atoms).length&&(e.setLogCommand("select complement",!0),e.selectComplement)})},clickMenu2_alignment:function{var e=this;$("#"+e.pre+"menu2_alignment").click(function(i){e.openDialog(e.pre+"dl_alignment","Select residues in aligned sequences")})},clickMenu2_command:function{var e=this;$("#"+e.pre+"menu2_command").click(function(i){e.openDialog(e.pre+"dl_command","Advanced set selection")})},clickMenu2_pickingNo:function{var e=this;$("#"+e.pre+"menu2_pickingNo").click(function(i){e.icn3d.picking=0,e.icn3d.options.picking="no",e.setLogCommand("set picking off",!0),e.icn3d.draw,e.icn3d.removeHighlightObjects})},clickMenu2_pickingYes:function{var e=this;$("#"+e.pre+"menu2_pickingYes").click(function(i){e.icn3d.picking=1,e.icn3d.options.picking="atom",e.setLogCommand("set picking atom",!0)})},clickMenu2_pickingResidue:function{var e=this;$("#"+e.pre+"menu2_pickingResidue").click(function(i){e.icn3d.picking=2,e.icn3d.options.picking="residue",e.setLogCommand("set picking residue",!0)})},clickMenu2_pickingStrand:function{var e=this;$("#"+e.pre+"menu2_pickingStrand").click(function(i){e.icn3d.picking=3,e.icn3d.options.picking="strand",e.setLogCommand("set picking strand",!0)})},clickMenu2_aroundsphere:function{var e=this;$("#"+e.pre+"menu2_aroundsphere").click(function(i){e.openDialog(e.pre+"dl_aroundsphere","Select a sphere around current selection")})},clickMenu2_select_chain:function{var e=this;$("#"+e.pre+"menu2_select_chain").click(function(i){e.openDialog(e.pre+"dl_select_chain","Select Structure/Chain/Custom Selection")})},clickmenu3_proteinsRibbon:function{var e=this;$("#"+e.pre+"menu3_proteinsRibbon").click(function(i){e.setStyle("proteins","ribbon"),e.setLogCommand("style proteins ribbon",!0)})},clickmenu3_proteinsStrand:function{var e=this;$("#"+e.pre+"menu3_proteinsStrand").click(function(i){e.setStyle("proteins","strand"),e.setLogCommand("style proteins strand",!0)})},clickmenu3_proteinsCylinder:function{var e=this;$("#"+e.pre+"menu3_proteinsCylinder").click(function(i){e.setStyle("proteins","cylinder and plate"),e.setLogCommand("style proteins cylinder and plate",!0)})},clickMenu3_proteinsSchematic:function{var e=this;$("#"+e.pre+"menu3_proteinsSchematic").click(function(i){e.setStyle("proteins","schematic"),e.setLogCommand("style proteins schematic",!0)})},clickmenu3_proteinsCalpha:function{var e=this;$("#"+e.pre+"menu3_proteinsCalpha").click(function(i){e.setStyle("proteins","c alpha trace"),e.setLogCommand("style proteins c alpha trace",!0)})},clickmenu3_proteinsBfactor:function{var e=this;$("#"+e.pre+"menu3_proteinsBfactor").click(function(i){e.setStyle("proteins","b factor tube"),e.setLogCommand("style proteins b factor tube",!0)})},clickmenu3_proteinsLines:function{var e=this;$("#"+e.pre+"menu3_proteinsLines").click(function(i){e.setStyle("proteins","lines"),e.setLogCommand("style proteins lines",!0)})},clickmenu3_proteinsStick:function{var e=this;$("#"+e.pre+"menu3_proteinsStick").click(function(i){e.setStyle("proteins","stick"),e.setLogCommand("style proteins stick",!0)})},clickmenu3_proteinsBallstick:function{var e=this;$("#"+e.pre+"menu3_proteinsBallstick").click(function(i){e.setStyle("proteins","ball and stick"),e.setLogCommand("style proteins ball and stick",!0)})},clickmenu3_proteinsSphere:function{var e=this;$("#"+e.pre+"menu3_proteinsSphere").click(function(i){e.setStyle("proteins","sphere"),e.setLogCommand("style proteins sphere",!0)})},clickmenu3_proteinsNothing:function{var e=this;$("#"+e.pre+"menu3_proteinsNothing").click(function(i){e.setStyle("proteins","nothing"),e.setLogCommand("style proteins nothing",!0)})},clickMenu3_sidechainsLines:function{var e=this;$("#"+e.pre+"menu3_sidechainsLines").click(function(i){e.setStyle("sidechains","lines"),e.setLogCommand("style sidechains lines",!0)})},clickMenu3_sidechainsStick:function{var e=this;$("#"+e.pre+"menu3_sidechainsStick").click(function(i){e.setStyle("sidechains","stick"),e.setLogCommand("style sidechains stick",!0)})},clickMenu3_sidechainsBallstick:function{var e=this;$("#"+e.pre+"menu3_sidechainsBallstick").click(function(i){e.setStyle("sidechains","ball and stick"),e.setLogCommand("style sidechains ball and stick",!0)})},clickMenu3_sidechainsSphere:function{var e=this;$("#"+e.pre+"menu3_sidechainsSphere").click(function(i){e.setStyle("sidechains","sphere"),e.setLogCommand("style sidechains sphere",!0)})},clickMenu3_sidechainsNothing:function{var e=this;$("#"+e.pre+"menu3_sidechainsNothing").click(function(i){e.setStyle("sidechains","nothing"),e.setLogCommand("style sidechains nothing",!0)})},clickmenu3_nuclCartoon:function{var e=this;$("#"+e.pre+"menu3_nuclCartoon").click(function(i){e.setStyle("nucleotides","nucleotide cartoon"),e.setLogCommand("style nucleotides nucleotide cartoon",!0)})},clickmenu3_nuclSchematic:function{var e=this;$("#"+e.pre+"menu3_nuclSchematic").click(function(i){e.setStyle("nucleotides","schematic"),e.setLogCommand("style nucleotides schematic",!0)})},clickmenu3_nuclPhos:function{var e=this;$("#"+e.pre+"menu3_nuclPhos").click(function(i){e.setStyle("nucleotides","phosphorus trace"),e.setLogCommand("style nucleotides phosphorus trace",!0)})},clickmenu3_nuclLines:function{var e=this;$("#"+e.pre+"menu3_nuclLines").click(function(i){e.setStyle("nucleotides","lines"),e.setLogCommand("style nucleotides lines",!0)})},clickmenu3_nuclStick:function{var e=this;$("#"+e.pre+"menu3_nuclStick").click(function(i){e.setStyle("nucleotides","stick"),e.setLogCommand("style nucleotides stick",!0)})},clickmenu3_nuclBallstick:function{var e=this;$("#"+e.pre+"menu3_nuclBallstick").click(function(i){e.setStyle("nucleotides","ball and stick"),e.setLogCommand("style nucleotides ball and stick",!0)})},clickmenu3_nuclSphere:function{var e=this;$("#"+e.pre+"menu3_nuclSphere").click(function(i){e.setStyle("nucleotides","sphere"),e.setLogCommand("style nucleotides sphere",!0)})},clickmenu3_nuclNothing:function{var e=this;$("#"+e.pre+"menu3_nuclNothing").click(function(i){e.setStyle("nucleotides","nothing"),e.setLogCommand("style nucleotides nothing",!0)})},clickMenu3_ligandsLines:function{var e=this;$("#"+e.pre+"menu3_ligandsLines").click(function(i){e.setStyle("ligands","lines"),e.setLogCommand("style ligands lines",!0)})},clickMenu3_ligandsStick:function{var e=this;$("#"+e.pre+"menu3_ligandsStick").click(function(i){e.setStyle("ligands","stick"),e.setLogCommand("style ligands stick",!0)})},clickMenu3_ligandsBallstick:function{var e=this;$("#"+e.pre+"menu3_ligandsBallstick").click(function(i){e.setStyle("ligands","ball and stick"),e.setLogCommand("style ligands ball and stick",!0)})},clickMenu3_ligandsSchematic:function{var e=this;$("#"+e.pre+"menu3_ligandsSchematic").click(function(i){e.setStyle("ligands","schematic"),e.setLogCommand("style ligands schematic",!0)})},clickMenu3_ligandsSphere:function{var e=this;$("#"+e.pre+"menu3_ligandsSphere").click(function(i){e.setStyle("ligands","sphere"),e.setLogCommand("style ligands sphere",!0)})},clickMenu3_ligandsNothing:function{var e=this;$("#"+e.pre+"menu3_ligandsNothing").click(function(i){e.setStyle("ligands","nothing"),e.setLogCommand("style ligands nothing",!0)})},clickMenu3_ionsSphere:function{var e=this;$("#"+e.pre+"menu3_ionsSphere").click(function(i){e.setStyle("ions","sphere"),e.setLogCommand("style ions sphere",!0)})},clickMenu3_ionsDot:function{var e=this;$("#"+e.pre+"menu3_ionsDot").click(function(i){e.setStyle("ions","dot"),e.setLogCommand("style ions dot",!0)})},clickMenu3_ionsNothing:function{var e=this;$("#"+e.pre+"menu3_ionsNothing").click(function(i){e.setStyle("ions","nothing"),e.setLogCommand("style ions nothing",!0)})},clickMenu3_waterSphere:function{var e=this;$("#"+e.pre+"menu3_waterSphere").click(function(i){e.setStyle("water","sphere"),e.setLogCommand("style water sphere",!0)})},clickMenu3_waterDot:function{var e=this;$("#"+e.pre+"menu3_waterDot").click(function(i){e.setStyle("water","dot"),e.setLogCommand("style water dot",!0)})},clickMenu3_waterNothing:function{var e=this;$("#"+e.pre+"menu3_waterNothing").click(function(i){e.setStyle("water","nothing"),e.setLogCommand("style water nothing",!0)})},clickMenu4_colorSpectrum:function{var e=this;$("#"+e.pre+"menu4_colorSpectrum").click(function(i){e.setOption("color","spectrum"),e.setLogCommand("color spectrum",!0)})},clickMenu4_colorChain:function{var e=this;$("#"+e.pre+"menu4_colorChain").click(function(i){e.setOption("color","chain"),e.setLogCommand("color chain",!0)})},clickMenu4_colorSS:function{var e=this;$("#"+e.pre+"menu4_colorSS").click(function(i){e.setOption("color","secondary structure"),e.setLogCommand("color secondary structure",!0)})},clickMenu4_colorResidue:function{var e=this;$("#"+e.pre+"menu4_colorResidue").click(function(i){e.setOption("color","residue"),e.setLogCommand("color residue",!0)})},clickMenu4_colorCharge:function{var e=this;$("#"+e.pre+"menu4_colorCharge").click(function(i){e.setOption("color","charge"),e.setLogCommand("color charge",!0)})},clickMenu4_colorHydrophobic:function{var e=this;$("#"+e.pre+"menu4_colorHydrophobic").click(function(i){e.setOption("color","hydrophobic"),e.setLogCommand("color hydrophobic",!0)})},clickMenu4_colorAtom:function{var e=this;$("#"+e.pre+"menu4_colorAtom").click(function(i){e.setOption("color","atom"),e.setLogCommand("color atom",!0)})},clickMenu4_colorConserved:function{var e=this;$("#"+e.pre+"menu4_colorConserved").click(function(i){e.setOption("color","conserved"),e.setLogCommand("color conserved",!0)})},clickMenu4_colorRed:function{var e=this;$("#"+e.pre+"menu4_colorRed").click(function(i){e.setOption("color","red"),e.setLogCommand("color red",!0)})},clickMenu4_colorGreen:function{var e=this;$("#"+e.pre+"menu4_colorGreen").click(function(i){e.setOption("color","green"),e.setLogCommand("color green",!0)})},clickMenu4_colorBlue:function{var e=this;$("#"+e.pre+"menu4_colorBlue").click(function(i){e.setOption("color","blue"),e.setLogCommand("color blue",!0)})},clickMenu4_colorMagenta:function{var e=this;$("#"+e.pre+"menu4_colorMagenta").click(function(i){e.setOption("color","magenta"),e.setLogCommand("color magenta",!0)})},clickMenu4_colorYellow:function{var e=this;$("#"+e.pre+"menu4_colorYellow").click(function(i){e.setOption("color","yellow"),e.setLogCommand("color yellow",!0)})},clickMenu4_colorCyan:function{var e=this;$("#"+e.pre+"menu4_colorCyan").click(function(i){e.setOption("color","cyan"),e.setLogCommand("color cyan",!0)})},clickMenu4_colorWhite:function{var e=this;$("#"+e.pre+"menu4_colorWhite").click(function(i){e.setOption("color","white"),e.setLogCommand("color white",!0)})},clickMenu4_colorGrey:function{var e=this;$("#"+e.pre+"menu4_colorGrey").click(function(i){e.setOption("color","grey"),e.setLogCommand("color grey",!0)})},clickMenu4_colorCustom:function{var e=this;$("#"+e.pre+"menu4_colorCustom").click(function(i){e.openDialog(e.pre+"dl_color","Choose custom color")})},clickMenu5_neighborsYes:function{var e=this;$("#"+e.pre+"menu5_neighborsYes").click(function(i){e.icn3d.bConsiderNeighbors=!0,e.icn3d.removeLastSurface,e.icn3d.applySurfaceOptions,e.icn3d.render,e.setLogCommand("set surface neighbors on",!0)})},clickMenu5_neighborsNo:function{var e=this;$("#"+e.pre+"menu5_neighborsNo").click(function(i){e.icn3d.bConsiderNeighbors=!1,e.icn3d.removeLastSurface,e.icn3d.applySurfaceOptions,e.icn3d.render,e.setLogCommand("set surface neighbors off",!0)})},clickMenu5_surfaceVDW:function{var e=this;$("#"+e.pre+"menu5_surfaceVDW").click(function(i){e.setOption("surface","Van der Waals surface"),e.setLogCommand("set surface Van der Waals surface",!0)})},clickMenu5_surfaceSAS:function{var e=this;$("#"+e.pre+"menu5_surfaceSAS").click(function(i){e.setOption("surface","solvent accessible surface"),e.setLogCommand("set surface solvent accessible surface",!0)})},clickMenu5_surfaceMolecular:function{var e=this;$("#"+e.pre+"menu5_surfaceMolecular").click(function(i){e.setOption("surface","molecular surface"),e.setLogCommand("set surface molecular surface",!0)})},clickMenu5_surfaceNothing:function{var e=this;$("#"+e.pre+"menu5_surfaceNothing").click(function(i){e.setOption("surface","nothing"),e.setLogCommand("set surface nothing",!0)})},clickMenu5_opacity10:function{var e=this;$("#"+e.pre+"menu5_opacity10").click(function(i){e.setOption("opacity","1.0"),e.setLogCommand("set surface opacity 1.0",!0)})},clickMenu5_opacity09:function{var e=this;$("#"+e.pre+"menu5_opacity09").click(function(i){e.setOption("opacity","0.9"),e.setLogCommand("set surface opacity 0.9",!0)})},clickMenu5_opacity08:function{var e=this;$("#"+e.pre+"menu5_opacity08").click(function(i){e.setOption("opacity","0.8"),e.setLogCommand("set surface opacity 0.8",!0)})},clickMenu5_opacity07:function{var e=this;$("#"+e.pre+"menu5_opacity07").click(function(i){e.setOption("opacity","0.7"),e.setLogCommand("set surface opacity 0.7",!0)})},clickMenu5_opacity06:function{var e=this;$("#"+e.pre+"menu5_opacity06").click(function(i){e.setOption("opacity","0.6"),e.setLogCommand("set surface opacity 0.6",!0)})},clickMenu5_opacity05:function{var e=this;$("#"+e.pre+"menu5_opacity05").click(function(i){e.setOption("opacity","0.5"),e.setLogCommand("set surface opacity 0.5",!0)})},clickMenu5_wireframeYes:function{var e=this;$("#"+e.pre+"menu5_wireframeYes").click(function(i){e.setOption("wireframe","yes"),e.setLogCommand("set surface wireframe on",!0)})},clickMenu5_wireframeNo:function{var e=this;$("#"+e.pre+"menu5_wireframeNo").click(function(i){e.setOption("wireframe","no"),e.setLogCommand("set surface wireframe off",!0)})},clickMenu6_assemblyYes:function{var e=this;$("#"+e.pre+"menu6_assemblyYes").click(function(i){e.icn3d.bAssembly=!0,e.setLogCommand("set assembly on",!0),e.icn3d.draw})},clickMenu6_assemblyNo:function{var e=this;$("#"+e.pre+"menu6_assemblyNo").click(function(i){e.icn3d.bAssembly=!1,e.setLogCommand("set assembly off",!0),e.icn3d.draw})},clickMenu6_addlabelResidues:function{var e=this;$("#"+e.pre+"menu6_addlabelResidues").click(function(i){e.setLogCommand("add residue labels",!0),e.icn3d.addResiudeLabels(e.icn3d.highlightAtoms),e.saveSelectionIfSelected,e.icn3d.draw})},clickMenu6_addlabelYes:function{var e=this;$("#"+e.pre+"menu6_addlabelYes").click(function(i){e.openDialog(e.pre+"dl_addlabel","Add custom labels by picking"),e.icn3d.picking=1,e.icn3d.options.picking="atom",e.icn3d.pickpair=!0,e.icn3d.pickedatomNum=0})},clickMenu6_addlabelSelection:function{var e=this;$("#"+e.pre+"menu6_addlabelSelection").click(function(i){e.openDialog(e.pre+"dl_addlabelselection","Add custom labels by the current selection")})},clickMenu6_addlabelNo:function{var e=this;$("#"+e.pre+"menu6_addlabelNo").click(function(i){e.icn3d.pickpair=!1,e.icn3d.labels.residue=[],e.icn3d.labels.custom=[];var t="set labels off";e.setLogCommand(t,!0);for(var n in e.icn3d.labels)("residue"===n||"custom"===n)&&(e.icn3d.labels[n]=[]);e.icn3d.draw})},clickMenu6_distanceYes:function{var e=this;$("#"+e.pre+"menu6_distanceYes").click(function(i){e.openDialog(e.pre+"dl_distance","Measure the distance of atoms"),e.icn3d.picking=1,e.icn3d.options.picking="atom",e.icn3d.pickpair=!0,e.icn3d.pickedatomNum=0})},clickMenu6_distanceNo:function{var e=this;$("#"+e.pre+"menu6_distanceNo").click(function(i){e.icn3d.pickpair=!1;var t="set lines off";e.setLogCommand(t,!0),e.icn3d.labels.distance=[],e.icn3d.lines.distance=[],e.icn3d.draw})},clickmenu2_selectedcenter:function{var e=this;$("#"+e.pre+"menu2_selectedcenter").add("#"+e.pre+"zoomin_selection").click(function(i){e.setLogCommand("zoom selection",!0),e.icn3d.zoominSelection})},clickMenu6_center:function{var e=this;$("#"+e.pre+"menu6_center").click(function(i){e.setLogCommand("center selection",!0),e.icn3d.centerSelection})},clickMenu6_resetorientation:function{var e=this;$("#"+e.pre+"menu6_resetorientation").add("#"+e.pre+"resetorientation").click(function(i){e.setLogCommand("reset orientation",!0),e.icn3d.resetOrientation})},clickMenu6_rotateleft:function{var e=this;$("#"+e.pre+"menu6_rotateleft").click(function(i){e.setLogCommand("rotate left",!0),e.icn3d.bStopRotate=!1,e.icn3d.rotateCount=0,e.icn3d.rotateCountMax=6e3,e.ROTATION_DIRECTION="left",e.rotateStructure("left")})},clickMenu6_rotateright:function{var e=this;$("#"+e.pre+"menu6_rotateright").click(function(i){e.setLogCommand("rotate right",!0),e.icn3d.bStopRotate=!1,e.icn3d.rotateCount=0,e.icn3d.rotateCountMax=6e3,e.ROTATION_DIRECTION="right",e.rotateStructure("right")})},clickMenu6_rotateup:function{var e=this;$("#"+e.pre+"menu6_rotateup").click(function(i){e.setLogCommand("rotate up",!0),e.icn3d.bStopRotate=!1,e.icn3d.rotateCount=0,e.icn3d.rotateCountMax=6e3,e.ROTATION_DIRECTION="up",e.rotateStructure("up")})},clickMenu6_rotatedown:function{var e=this;$("#"+e.pre+"menu6_rotatedown").click(function(i){e.setLogCommand("rotate down",!0),e.icn3d.bStopRotate=!1,e.icn3d.rotateCount=0,e.icn3d.rotateCountMax=6e3,e.ROTATION_DIRECTION="down",e.rotateStructure("down")})},clickMenu6_cameraPers:function{var e=this;$("#"+e.pre+"menu6_cameraPers").click(function(i){e.setOption("camera","perspective"),e.setLogCommand("set camera perspective",!0)})},clickMenu6_cameraOrth:function{var e=this;$("#"+e.pre+"menu6_cameraOrth").click(function(i){e.setOption("camera","orthographic"),e.setLogCommand("set camera orthographic",!0)})},clickMenu6_bkgdBlack:function{var e=this;$("#"+e.pre+"menu6_bkgdBlack").click(function(i){e.setOption("background","black"),e.setLogCommand("set background black",!0)})},clickMenu6_bkgdGrey:function{var e=this;$("#"+e.pre+"menu6_bkgdGrey").click(function(i){e.setOption("background","grey"),e.setLogCommand("set background grey",!0)})},clickMenu6_bkgdWhite:function{var e=this;$("#"+e.pre+"menu6_bkgdWhite").click(function(i){e.setOption("background","white"),e.setLogCommand("set background white",!0)})},clickMenu6_showfogYes:function{var e=this;$("#"+e.pre+"menu6_showfogYes").click(function(i){e.setOption("fog","yes"),e.setLogCommand("set fog on",!0)})},clickMenu6_showfogNo:function{var e=this;$("#"+e.pre+"menu6_showfogNo").click(function(i){e.setOption("fog","no"),e.setLogCommand("set fog off",!0)})},clickMenu6_showslabYes:function{var e=this;$("#"+e.pre+"menu6_showslabYes").click(function(i){e.setOption("slab","yes"),e.setLogCommand("set slab on",!0)})},clickMenu6_showslabNo:function{var e=this;$("#"+e.pre+"menu6_showslabNo").click(function(i){e.setOption("slab","no"),e.setLogCommand("set slab off",!0)})},clickMenu6_showaxisYes:function{var e=this;$("#"+e.pre+"menu6_showaxisYes").click(function(i){e.setOption("axis","yes"),e.setLogCommand("set axis on",!0)})},clickMenu6_showaxisNo:function{var e=this;$("#"+e.pre+"menu6_showaxisNo").click(function(i){e.setOption("axis","no"),e.setLogCommand("set axis off",!0)})},clickMenu6_hbondsYes:function{var e=this;$("#"+e.pre+"menu6_hbondsYes").click(function(i){e.openDialog(e.pre+"dl_hbonds","Hydrogen bonds to selection")})},clickMenu6_hbondsNo:function{var e=this;$("#"+e.pre+"menu6_hbondsNo").click(function(i){e.icn3d.options.hbonds="no";var t="set hbonds off";e.setLogCommand(t,!0),e.icn3d.lines.hbond=[],e.icn3d.draw})},selectSequenceNonMobile:function{var e=this;$("#"+e.pre+"dl_sequence").selectable({stop:function{$("#"+e.pre+"chainid").val(""),$("#"+e.pre+"structureid").val(""),$("#"+e.pre+"chainid2").val(""),$("#"+e.pre+"structureid2").val(""),e.bSelectResidue===!1&&(e.removeSeqChainBkgd,e.removeSeqResidueBkgd,e.selectedResidues={},e.icn3d.highlightAtoms={},e.icn3d.removeHighlightObjects),$(".ui-selected",this).each(function{var i=$(this).attr("id");if(void 0!==i&&""!==i){"align"===i.substr(0,5)&&(i=i.substr(5)),e.bSelectResidue=!0,$(this).toggleClass("icn3d-highlightSeq");var t=i.substr(i.indexOf("_")+1);if($(this).hasClass("icn3d-highlightSeq")){for(var n in e.icn3d.residues[t])e.icn3d.highlightAtoms[n]=1;e.selectedResidues[t]=1}else{for(var o in e.icn3d.residues[t])e.icn3d.highlightAtoms[o]=void 0;e.selectedResidues[t]=void 0,e.icn3d.removeHighlightObjects}}}),e.icn3d.addHighlightObjects,$("#"+e.pre+"chainid").val(""),$("#"+e.pre+"structureid").val(""),$("#"+e.pre+"chainid2").val(""),$("#"+e.pre+"structureid2").val(""),$(".ui-selected",this).each(function{var i=$(this).attr("chain");if($(this).hasClass("icn3d-seqTitle")){e.bSelectResidue=!1,e.removeSeqChainBkgd(i),e.removeSeqResidueBkgd,$(this).toggleClass("icn3d-highlightSeq");var t=$(this).attr("chain"),n=t;if($(this).hasClass("icn3d-highlightSeq")){var o="select chain "+t;e.selectAChain(t,n),e.setLogCommand(o,!0)}else e.icn3d.removeHighlightObjects,e.icn3d.highlightAtoms={},$("#"+e.pre+"customResidues").val(""),$("#"+e.pre+"customResidues2").val(""),$("#"+e.pre+"customAtoms").val("")}})}}),$("#"+e.pre+"dl_sequence2").selectable({stop:function{$("#"+e.pre+"chainid").val(""),$("#"+e.pre+"structureid").val(""),$("#"+e.pre+"chainid2").val(""),$("#"+e.pre+"structureid2").val(""),e.bSelectAlignResidue===!1&&(e.removeSeqChainBkgd,e.removeSeqResidueBkgd,e.selectedResidues={},e.icn3d.highlightAtoms={},e.icn3d.removeHighlightObjects),$(".ui-selected",this).each(function{var i=$(this).attr("id");if(void 0!==i&&""!==i){"align"===i.substr(0,5)&&(i=i.substr(5)),e.bSelectAlignResidue=!0,$(this).toggleClass("icn3d-highlightSeq");var t=i.substr(i.indexOf("_")+1);if($(this).hasClass("icn3d-highlightSeq")){for(var n in e.icn3d.residues[t])e.icn3d.highlightAtoms[n]=1;e.selectedResidues[t]=1}else{for(var n in e.icn3d.residues[t])e.icn3d.highlightAtoms[n]=void 0;e.selectedResidues[t]=void 0,e.icn3d.removeHighlightObjects}}}),e.icn3d.addHighlightObjects,$("#"+e.pre+"chainid").val(""),$("#"+e.pre+"structureid").val(""),$("#"+e.pre+"chainid2").val(""),$("#"+e.pre+"structureid2").val(""),$(".ui-selected",this).each(function{var i=$(this).attr("chain");if($(this).hasClass("icn3d-seqTitle")){e.bSelectAlignResidue=!1,e.removeSeqChainBkgd(i),e.removeSeqResidueBkgd,$(this).toggleClass("icn3d-highlightSeq");var t=$(this).attr("chain"),n="align_"+t;$(this).hasClass("icn3d-highlightSeq")?(e.selectAAlignChain(t,n),e.setLogCommand("select alignChain "+t,!0)):(e.icn3d.removeHighlightObjects,e.icn3d.highlightAtoms={},$("#"+e.pre+"customResidues").val(""),$("#"+e.pre+"customResidues2").val(""),$("#"+e.pre+"customAtoms").val(""))}})}})},selectSequenceMobile:function{var e=this;$("#"+e.pre+"dl_sequence").on("click",".icn3d-residue",function(i){$("#"+e.pre+"chainid").val(""),$("#"+e.pre+"structureid").val(""),$("#"+e.pre+"chainid2").val(""),$("#"+e.pre+"structureid2").val("");var t=$(this).attr("id");if(void 0!==t&&""!==t){"align"===t.substr(0,5)&&(t=t.substr(5)),e.bSelectResidue===!1&&(e.removeSeqChainBkgd,e.removeSeqResidueBkgd,e.selectedResidues={},e.icn3d.highlightAtoms={},e.icn3d.removeHighlightObjects,e.bSelectResidue=!0),$(this).toggleClass("icn3d-highlightSeq");var n=t.substr(t.indexOf("_")+1);if($(this).hasClass("icn3d-highlightSeq")){for(var o in e.icn3d.residues[n])e.icn3d.highlightAtoms[o]=1;e.selectedResidues[n]=1}else{for(var o in e.icn3d.residues[n])e.icn3d.highlightAtoms[o]=void 0;e.selectedResidues[n]=void 0,e.icn3d.removeHighlightObjects}}e.icn3d.addHighlightObjects}),$("#"+e.pre+"dl_sequence2").on("click",".icn3d-residue",function(i){$("#"+e.pre+"chainid").val(""),$("#"+e.pre+"structureid").val(""),$("#"+e.pre+"chainid2").val(""),$("#"+e.pre+"structureid2").val("");var t=$(this).attr("id");if(void 0!==t&&""!==t){"align"===t.substr(0,5)&&(t=t.substr(5)),e.bSelectAlignResidue===!1&&(e.removeSeqChainBkgd,e.removeSeqResidueBkgd,e.selectedResidues={},e.icn3d.highlightAtoms={},e.icn3d.removeHighlightObjects,e.bSelectAlignResidue=!0),$(this).toggleClass("icn3d-highlightSeq");var n=t.substr(t.indexOf("_")+1);if($(this).hasClass("icn3d-highlightSeq")){for(var o in e.icn3d.residues[n])e.icn3d.highlightAtoms[o]=1;e.selectedResidues[n]=1}else{for(var o in e.icn3d.residues[n])e.icn3d.highlightAtoms[o]=void 0;e.selectedResidues[n]=void 0,e.icn3d.removeHighlightObjects}}e.icn3d.addHighlightObjects})},selectChainMobile:function{var e=this;$("#"+e.pre+"dl_sequence").on("click",".icn3d-seqTitle",function(i){$("#"+e.pre+"chainid").val(""),$("#"+e.pre+"structureid").val(""),$("#"+e.pre+"chainid2").val(""),$("#"+e.pre+"structureid2").val("");var t=$(this).attr("chain");e.bSelectResidue=!1,e.removeSeqChainBkgd(t),e.removeSeqResidueBkgd,$(this).toggleClass("icn3d-highlightSeq");var n=$(this).attr("chain"),o=n;if($(this).hasClass("icn3d-highlightSeq")){var s="select chain "+n;e.selectAChain(n,o),e.setLogCommand(s,!0); }else e.icn3d.removeHighlightObjects,e.icn3d.highlightAtoms={},$("#"+e.pre+"customResidues").val(""),$("#"+e.pre+"customResidues2").val(""),$("#"+e.pre+"customAtoms").val("")}),$("#"+e.pre+"dl_sequence2").on("click",".icn3d-seqTitle",function(i){$("#"+e.pre+"chainid").val(""),$("#"+e.pre+"structureid").val(""),$("#"+e.pre+"chainid2").val(""),$("#"+e.pre+"structureid2").val("");var t=$(this).attr("chain");e.bSelectAlignResidue=!1,e.removeSeqChainBkgd(t),e.removeSeqResidueBkgd,$(this).toggleClass("icn3d-highlightSeq");var n=$(this).attr("chain"),o="align_"+n;$(this).hasClass("icn3d-highlightSeq")?(e.selectAAlignChain(n,o),e.setLogCommand("select alignChain "+n,!0)):(e.icn3d.removeHighlightObjects,e.icn3d.highlightAtoms={},$("#"+e.pre+"customResidues").val(""),$("#"+e.pre+"customResidues2").val(""),$("#"+e.pre+"customAtoms").val(""))})},clickStructureid:function{var e=this;$("#"+e.pre+"structureid").change(function(i){var t=$(this).val;$("#"+e.pre+"structureid2").val(""),e.changeStructureid(t)}),$("#"+e.pre+"structureid2").change(function(i){var t=$(this).val;$("#"+e.pre+"structureid").val(""),e.changeStructureid(t)}),$("#"+e.pre+"structureid").focus(function(i){e.isMobile&&$("#"+e.pre+"structureid").val(""),$(this).attr("size",$("#"+e.pre+"structureid option").length)}),$("#"+e.pre+"structureid").blur(function(e){$(this).attr("size",1)})},clickChainid:function{var e=this;$("#"+e.pre+"chainid").change(function(i){var t=$(this).val;$("#"+e.pre+"chainid2").val(""),e.changeChainid(t)}),$("#"+e.pre+"chainid2").change(function(i){var t=$(this).val;$("#"+e.pre+"chainid").val(""),e.changeChainid(t)}),$("#"+e.pre+"chainid").focus(function(i){e.isMobile&&$("#"+e.pre+"chainid").val(""),$(this).attr("size",$("#"+e.pre+"chainid option").length)}),$("#"+e.pre+"chainid").blur(function(e){$(this).attr("size",1)})},clickAlignChainid:function{var e=this;$("#"+e.pre+"alignChainid").change(function(i){var t=$(this).val;$("#"+e.pre+"alignChainid2").val,e.changeAlignChainid(t)}),$("#"+e.pre+"alignChainid2").change(function(i){var t=$(this).val;$("#"+e.pre+"alignChainid").val,e.changeAlignChainid(t)}),$("#"+e.pre+"alignChainid").focus(function(i){e.isMobile&&$("#"+e.pre+"alignChainid").val(""),$(this).attr("size",$("#"+e.pre+"alignChainid option").length)}),$("#"+e.pre+"alignChainid").blur(function(e){$(this).attr("size",1)})},clickCustomResidues:function{var e=this;$("#"+e.pre+"customResidues").change(function(i){var t=$(this).val;$("#"+e.pre+"customResidues2").val(""),null!==t&&(e.setLogCommand("select saved selection "+t.toString,!0),e.changeCustomResidues(t))}),$("#"+e.pre+"customResidues2").change(function(i){var t=$(this).val;$("#"+e.pre+"customResidues").val(""),null!==t&&(e.setLogCommand("select saved selection "+t.toString,!0),e.changeCustomResidues(t))}),$("#"+e.pre+"customResidues").focus(function(i){e.isMobile&&$("#"+e.pre+"customResidues").val(""),$(this).attr("size",$("#"+e.pre+"customResidues option").length)}),$("#"+e.pre+"customResidues").blur(function(e){$(this).attr("size",1)})},clickCustomAtoms:function{var e=this;$("#"+e.pre+"customAtoms").change(function(i){var t=$(this).val;null!==t&&(e.setLogCommand("select saved atoms "+t.toString,!0),e.changeCustomAtoms(t))}),$("#"+e.pre+"customAtoms").focus(function(i){e.isMobile&&$("#"+e.pre+"customAtoms").val("")})},clickShow_selected:function{var e=this;$("#"+e.pre+"show_selected").add("#"+e.pre+"menu2_show_selected").click(function(i){e.setLogCommand("show selection",!0),e.showSelection})},clickShow_sequences:function{var e=this;$("#"+e.pre+"show_sequences").click(function(i){e.openDialog(e.pre+"dl_selectresidues","Select residues in sequences")})},clickShow_alignsequences:function{var e=this;$("#"+e.pre+"show_alignsequences").click(function(i){e.openDialog(e.pre+"dl_alignment","Select residues in aligned sequences")})},clickShow_selected_atom:function{var e=this;$("#"+e.pre+"show_selected_atom").click(function(i){i.preventDefault,e.setLogCommand("show selection",!0),e.showSelection})},clickCommand_apply:function{var e=this;$("#"+e.pre+"command_apply").click(function(i){i.preventDefault;var t=$("#"+e.pre+"command").val,n=$("#"+e.pre+"command_name").val.replace(/;/g,"_").replace(/\s+/g,"_"),o=$("#"+e.pre+"command_desc").val.replace(/;/g,"_").replace(/\s+/g,"_");e.setLogCommand("select "+t+" | name "+n+" | description "+o,!0),e.selectByCommand(t,n,o)})},clickReload_pdb:function{var e=this;$("#"+e.pre+"reload_pdb").click(function(i){i.preventDefault,dialog.dialog("close"),e.setLogCommand("load pdb "+$("#"+e.pre+"pdbid").val,!1),window.open("http://www.ncbi.nlm.nih.gov/Structure/icn3d/full.html?pdbid="+$("#"+e.pre+"pdbid").val,"_blank")})},clickReload_mmcif:function{var e=this;$("#"+e.pre+"reload_mmcif").click(function(i){i.preventDefault,dialog.dialog("close"),e.setLogCommand("load mmcif "+$("#"+e.pre+"mmcifid").val,!1),window.open("https://www.ncbi.nlm.nih.gov/Structure/icn3d/full.html?mmcifid="+$("#"+e.pre+"mmcifid").val,"_blank")})},clickReload_mmdb:function{var e=this;$("#"+e.pre+"reload_mmdb").click(function(i){i.preventDefault,dialog.dialog("close"),e.setLogCommand("load mmdb "+$("#"+e.pre+"mmdbid").val,!1),window.open("https://www.ncbi.nlm.nih.gov/Structure/icn3d/full.html?mmdbid="+$("#"+e.pre+"mmdbid").val,"_blank")})},clickReload_gi:function{var e=this;$("#"+e.pre+"reload_gi").click(function(i){i.preventDefault,dialog.dialog("close"),e.setLogCommand("load gi "+$("#"+e.pre+"gi").val,!1),window.open("https://www.ncbi.nlm.nih.gov/Structure/icn3d/full.html?gi="+$("#"+e.pre+"gi").val,"_blank")})},clickReload_cid:function{var e=this;$("#"+e.pre+"reload_cid").click(function(i){i.preventDefault,dialog.dialog("close"),e.setLogCommand("load cid "+$("#"+e.pre+"cid").val,!1),window.open("https://www.ncbi.nlm.nih.gov/Structure/icn3d/full.html?cid="+$("#"+e.pre+"cid").val,"_blank")})},clickReload_state:function{var e=this;$("#"+e.pre+"reload_state").click(function(i){i.preventDefault,dialog.dialog("close");var t=$("#"+e.pre+"state")[0].files[0];if(t){window.File&&window.FileReader&&window.FileList&&window.Blob||alert("The File APIs are not fully supported in this browser.");var n=new FileReader;n.onload=function(i){var t=i.target.result;e.setLogCommand("load state file "+$("#"+e.pre+"state").val,!1),e.icn3d.commands=[],e.icn3d.optionsHistory=[],e.loadScript(t,!0)},n.readAsText(t)}else alert("Please select a file before clicking 'Load'")})},clickReload_selectionfile:function{var e=this;$("#"+e.pre+"reload_selectionfile").click(function(i){i.preventDefault,dialog.dialog("close");var t=$("#"+e.pre+"selectionfile")[0].files[0];if(t){window.File&&window.FileReader&&window.FileList&&window.Blob||alert("The File APIs are not fully supported in this browser.");var n=new FileReader;n.onload=function(i){var t=i.target.result;e.setLogCommand("load selection file "+$("#"+e.pre+"selectionfile").val,!1),e.loadSelection(t)},n.readAsText(t)}else alert("Please select a file before clicking 'Load'")})},clickReload_pdbfile:function{var e=this;$("#"+e.pre+"reload_pdbfile").click(function(i){i.preventDefault,dialog.dialog("close");var t=$("#"+e.pre+"pdbfile")[0].files[0];if(t){window.File&&window.FileReader&&window.FileList&&window.Blob||alert("The File APIs are not fully supported in this browser.");var n=new FileReader;n.onload=function(i){var t=i.target.result;e.setLogCommand("load pdb file "+$("#"+e.pre+"pdbfile").val,!1),e.icn3d.moleculeTitle="",e.loadPdbData(t)},n.readAsText(t)}else alert("Please select a file before clicking 'Load'")})},clickReload_mol2file:function{var e=this;$("#"+e.pre+"reload_mol2file").click(function(i){i.preventDefault,dialog.dialog("close");var t=$("#"+e.pre+"mol2file")[0].files[0];if(t){window.File&&window.FileReader&&window.FileList&&window.Blob||alert("The File APIs are not fully supported in this browser.");var n=new FileReader;n.onload=function(i){var t=i.target.result;e.setLogCommand("load mol2 file "+$("#"+e.pre+"mol2file").val,!1),e.icn3d.moleculeTitle="",e.inputid=void 0,e.loadMol2Data(t)},n.readAsText(t)}else alert("Please select a file before clicking 'Load'")})},clickReload_sdffile:function{var e=this;$("#"+e.pre+"reload_sdffile").click(function(i){i.preventDefault,dialog.dialog("close");var t=$("#"+e.pre+"sdffile")[0].files[0];if(t){window.File&&window.FileReader&&window.FileList&&window.Blob||alert("The File APIs are not fully supported in this browser.");var n=new FileReader;n.onload=function(i){var t=i.target.result;e.setLogCommand("load sdf file "+$("#"+e.pre+"sdffile").val,!1),e.icn3d.moleculeTitle="",e.inputid=void 0,e.loadSdfData(t)},n.readAsText(t)}else alert("Please select a file before clicking 'Load'")})},clickReload_xyzfile:function{var e=this;$("#"+e.pre+"reload_xyzfile").click(function(i){i.preventDefault,dialog.dialog("close");var t=$("#"+e.pre+"xyzfile")[0].files[0];if(t){window.File&&window.FileReader&&window.FileList&&window.Blob||alert("The File APIs are not fully supported in this browser.");var n=new FileReader;n.onload=function(i){var t=i.target.result;e.setLogCommand("load xyz file "+$("#"+e.pre+"xyzfile").val,!1),e.icn3d.moleculeTitle="",e.inputid=void 0,e.loadXyzData(t)},n.readAsText(t)}else alert("Please select a file before clicking 'Load'")})},clickReload_mmciffile:function{var e=this;$("#"+e.pre+"reload_mmciffile").click(function(i){i.preventDefault,dialog.dialog("close");var t=$("#"+e.pre+"mmciffile")[0].files[0];if(t){window.File&&window.FileReader&&window.FileList&&window.Blob||alert("The File APIs are not fully supported in this browser.");var n=new FileReader;n.onload=function(i){var t=i.target.result;e.setLogCommand("load mmcif file "+$("#"+e.pre+"mmciffile").val,!1),e.icn3d.moleculeTitle="";var n="//www.ncbi.nlm.nih.gov/Structure/mmcifparser/mmcifparser.cgi";e.icn3d.bCid=void 0,$.ajax({url:n,type:"POST",data:{mmciffile:t},dataType:"jsonp",cache:!0,beforeSend:function{$("#"+e.pre+"wait")&&$("#"+e.pre+"wait").show,$("#"+e.pre+"canvas")&&$("#"+e.pre+"canvas").hide,$("#"+e.pre+"commandlog")&&$("#"+e.pre+"commandlog").hide},complete:function{$("#"+e.pre+"wait")&&$("#"+e.pre+"wait").hide,$("#"+e.pre+"canvas")&&$("#"+e.pre+"canvas").show,$("#"+e.pre+"commandlog")&&$("#"+e.pre+"commandlog").show},success:function(i){e.loadMmcifData(i)}})},n.readAsText(t)}else alert("Please select a file before clicking 'Load'")})},clickApplycustomcolor:function{var e=this;$("#"+e.pre+"applycustomcolor").click(function(i){i.preventDefault,dialog.dialog("close"),e.setOption("color",$("#"+e.pre+"color").val),e.setLogCommand("color "+$("#"+e.pre+"color").val,!0)})},clickApplypick_aroundsphere:function{var e=this;$("#"+e.pre+"applypick_aroundsphere").click(function(i){i.preventDefault,dialog.dialog("close");var t=$("#"+e.pre+"radius_aroundsphere").val,n="select zone cutoff "+t;e.setLogCommand(n,!0),e.pickCustomSphere(t)})},clickApplyhbonds:function{var e=this;$("#"+e.pre+"applyhbonds").click(function(i){i.preventDefault,dialog.dialog("close");var t=$("#"+e.pre+"hbondthreshold").val,n="hbonds "+t;e.setLogCommand(n,!0),e.showHbonds(t)})},clickApplypick_labels:function{var e=this;$("#"+e.pre+"applypick_labels").click(function(i){i.preventDefault,dialog.dialog("close");var t=$("#"+e.pre+"labeltext").val,n=$("#"+e.pre+"labelsize").val,o=$("#"+e.pre+"labelcolor").val,s=$("#"+e.pre+"labelbkgd").val;if(("0"===s||""===s||"undefined"===s)&&(s=void 0),void 0===e.icn3d.pickedatom||void 0===e.icn3d.pickedatom2)alert("Please pick another atom");else{var r=(e.icn3d.pickedatom.coord.x+e.icn3d.pickedatom2.coord.x)/2,a=(e.icn3d.pickedatom.coord.y+e.icn3d.pickedatom2.coord.y)/2,c=(e.icn3d.pickedatom.coord.z+e.icn3d.pickedatom2.coord.z)/2;e.setLogCommand("add label "+t+" | x "+r+" y "+a+" z "+c+" | size "+n+" | color "+o+" | background "+s+" | type custom",!0),e.addLabel(t,r,a,c,n,o,s,"custom"),e.icn3d.pickpair=!1,e.icn3d.draw}})},clickApplyselection_labels:function{var e=this;$("#"+e.pre+"applyselection_labels").click(function(i){i.preventDefault,dialog.dialog("close");var t=$("#"+e.pre+"labeltext2").val,n=$("#"+e.pre+"labelsize2").val,o=$("#"+e.pre+"labelcolor2").val,s=$("#"+e.pre+"labelbkgd2").val;("0"===s||""===s||"undefined"===s)&&(s=void 0);var r=e.icn3d.centerAtoms(e.icn3d.hash2Atoms(e.icn3d.highlightAtoms)),a=r.center.x,c=r.center.y,l=r.center.z;e.setLogCommand("add label "+t+" | size "+n+" | color "+o+" | background "+s+" | type custom",!0),e.addLabel(t,a,c,l,n,o,s,"custom"),e.icn3d.draw})},clickApplypick_measuredistance:function{var e=this;$("#"+e.pre+"applypick_measuredistance").click(function(i){if(i.preventDefault,dialog.dialog("close"),void 0===e.icn3d.pickedatom||void 0===e.icn3d.pickedatom2)alert("Please pick another atom");else{var t,n,o,s=parseInt(10*e.icn3d.pickedatom.coord.distanceTo(e.icn3d.pickedatom2.coord))/10,r=s.toString+" A",a=(e.icn3d.pickedatom.coord.x+e.icn3d.pickedatom2.coord.x)/2,c=(e.icn3d.pickedatom.coord.y+e.icn3d.pickedatom2.coord.y)/2,l=(e.icn3d.pickedatom.coord.z+e.icn3d.pickedatom2.coord.z)/2;e.setLogCommand("add label "+r+" | x "+a+" y "+c+" z "+l+" | size "+t+" | color "+n+" | background "+o+" | type distance",!0),e.addLabel(r,a,c,l,t,n,o,"distance");var n="#FFFF00",d=!0;e.setLogCommand("add line | x1 "+e.icn3d.pickedatom.coord.x+" y1 "+e.icn3d.pickedatom.coord.y+" z1 "+e.icn3d.pickedatom.coord.z+" | x2 "+e.icn3d.pickedatom2.coord.x+" y2 "+e.icn3d.pickedatom2.coord.y+" z2 "+e.icn3d.pickedatom2.coord.z+" | color "+n+" | dashed "+d+" | type distance",!0),e.addLine(e.icn3d.pickedatom.coord.x,e.icn3d.pickedatom.coord.y,e.icn3d.pickedatom.coord.z,e.icn3d.pickedatom2.coord.x,e.icn3d.pickedatom2.coord.y,e.icn3d.pickedatom2.coord.z,n,d,"distance"),e.icn3d.pickpair=!1,e.icn3d.draw}})},clickReset:function{var e=this;$("#"+e.pre+"reset").click(function(i){e.setLogCommand("reset",!0),e.icn3d.maxD=e.icn3d.oriMaxD,e.icn3d.center=e.icn3d.oriCenter.clone,e.icn3d.reinitAfterLoad,e.renderFinalStep(1),e.removeSeqChainBkgd,e.removeSeqResidueBkgd})},toggleHighlight:function{var e=this;e.setLogCommand("toggle highlight",!0),e.icn3d.prevHighlightObjects.length>0?(e.icn3d.removeHighlightObjects,e.icn3d.render,e.removeSeqChainBkgd,e.removeSeqResidueBkgd,e.bSelectResidue=!1):(e.icn3d.addHighlightObjects,e.updateSeqWinForCurrentAtoms,e.bSelectResidue=!0)},clearHighlight:function{var e=this;e.setLogCommand("clear selection",!0),e.icn3d.removeHighlightObjects,e.icn3d.render,e.removeSeqChainBkgd,e.removeSeqResidueBkgd,e.bSelectResidue=!1},clickToggleHighlight:function{var e=this;$("#"+e.pre+"toggleHighlight").add("#"+e.pre+"toggleHighlight2").click(function(i){e.toggleHighlight}),$(document).on("click","#"+e.pre+"seq_clearselection",function(i){e.clearHighlight}),$(document).on("click","#"+e.pre+"alignseq_clearselection",function(i){e.clearHighlight})},pressCommandtext:function{var e=this;$("#"+e.pre+"logtext").keypress(function(i){e.bAddLogs=!1;var t=i.keyCode?i.keyCode:i.which;if(13==t){i.preventDefault;var n=$(this).val;e.icn3d.bRender=!0;var o=n.split("\n"),s=o[o.length-1].substr(2);if(e.icn3d.logs.push(s),$("#"+e.pre+"logtext").val("> "+e.icn3d.logs.join("\n> ")+"\n> ").scrollTop($("#"+e.pre+"logtext")[0].scrollHeight),""!==s){var r={};r.factor=e.icn3d._zoomFactor,r.mouseChange=e.icn3d.mouseChange,r.quaternion=e.icn3d.quaternion,e.icn3d.commands.push(s+"|||"+JSON.stringify(r)),e.icn3d.optionsHistory.push(e.icn3d.cloneHash(e.icn3d.options)),e.icn3d.optionsHistory[e.icn3d.optionsHistory.length-1].hlatomcount=Object.keys(e.icn3d.highlightAtoms).length,e.isSessionStorageSupported&&e.saveCommandsToSession,e.STATENUMBER=e.icn3d.commands.length,e.applyCommand(s+"|||"+JSON.stringify(r)),e.saveSelectionIfSelected,e.icn3d.draw}}e.bAddLogs=!0})},clickFilter_ckbx_all:function{var e=this;$("#"+e.pre+"filter_ckbx_all").click(function(i){var t=document.getElementsByName(e.pre+"filter_ckbx");if(1==$(this)[0].checked)for(var n=0,o=t.length;o>n;++n)t[n].checked=!0;else for(var n=0,o=t.length;o>n;++n)t[n].checked=!1})},clickFilter:function{var e=this;$("#"+e.pre+"filter").click(function(i){for(var t=document.getElementsByName(e.pre+"filter_ckbx"),n="",o="&het=0",s=0,r=t.length;r>s;++s)t[s].checked&&("ligands"==t[s].value?o="&het=2":n+=t[s].value+",");""==n&&(n=t[0].value);var a=document.URL+"&mols="+n+"&complexity=2"+o;window.open(a,"_self")})},saveSelection:function{var e=this;e.bSelectResidue=!1;var i=$("#"+e.pre+"seq_command_name").val.replace(/\s+/g,"_"),t=$("#"+e.pre+"seq_command_desc").val;if(0===Object.keys(e.selectedResidues).length)for(var n in e.icn3d.highlightAtoms){var o=e.icn3d.atoms[n].structure+"_"+e.icn3d.atoms[n].chain+"_"+e.icn3d.atoms[n].resi;e.selectedResidues[o]=1}e.setLogCommand("select "+e.residueids2spec(Object.keys(e.selectedResidues))+" | name "+i+" | description "+t,!0),e.selectResidueList(e.selectedResidues,i,t),e.updateSelectionNameDesc},clickSeqSaveSelection:function{var e=this;$(document).on("click","#"+e.pre+"seq_saveselection",function(i){e.saveSelection})},clickAlignSeqSaveSelection:function{var e=this;$(document).on("click","#"+e.pre+"alignseq_saveselection",function(i){e.bSelectAlignResidue=!1;var t=$("#"+e.pre+"alignseq_command_name").val.replace(/\s+/g,"_"),n=$("#"+e.pre+"alignseq_command_desc").val;if(0===Object.keys(e.selectedResidues).length)for(var o in e.icn3d.highlightAtoms){var s=e.icn3d.atoms[o].structure+"_"+e.icn3d.atoms[o].chain+"_"+e.icn3d.atoms[o].resi;e.selectedResidues[s]=1}e.setLogCommand("select "+e.residueids2spec(Object.keys(e.selectedResidues))+" | name "+t+" | description "+n,!0),e.selectResidueList(e.selectedResidues,t,n),e.updateSelectionNameDesc})},clickOutputSelection:function{var e=this;$(document).on("click","."+e.pre+"outputselection",function(i){e.bSelectResidue=!1,e.bSelectAlignResidue=!1,e.setLogCommand("output selection",!0),e.outputSelection})},bindMouseup:function{var e=this;$("accordion").bind("mouseup touchend",function(i){e.icn3d.controls&&(e.icn3d.controls.noRotate=!1,e.icn3d.controls.noZoom=!1,e.icn3d.controls.noPan=!1)})},bindMousedown:function{var e=this;$("accordion").bind("mousedown touchstart",function(i){e.icn3d.controls&&(e.icn3d.controls.noRotate=!0,e.icn3d.controls.noZoom=!0,e.icn3d.controls.noPan=!0)})},getCommandsBeforeCrash:function{var e=this;window.addEventListener("load",function{sessionStorage.setItem("good_exit","pending")}),window.addEventListener("beforeunload",function{sessionStorage.setItem("good_exit","true")}),sessionStorage.getItem("good_exit")&&"pending"===sessionStorage.getItem("good_exit")&&(e.isMac||(e.bCrashed=!0),e.commandsBeforeCrash=sessionStorage.getItem("commands"))},allEventFunctions:function{var e=this;e.isMobile?(e.selectSequenceMobile,e.selectChainMobile):e.selectSequenceNonMobile,e.clickBack,e.clickForward,e.clickToggle,e.clickHlColorYellow,e.clickHlColorGreen,e.clickHlColorRed,e.clickHlStyleOutline,e.clickHlStyleObject,e.clickAlternate,e.clickMenu1_pdbid,e.clickMenu1_pdbfile,e.clickMenu1_mol2file,e.clickMenu1_sdffile,e.clickMenu1_xyzfile,e.clickMenu1_mmciffile,e.clickMenu1_mmcifid,e.clickMenu1_mmdbid,e.clickMenu1_gi,e.clickMenu1_cid,e.clickMenu1_state,e.clickMenu1_selection,e.clickMenu1_exportState,e.clickMenu1_exportCanvas,e.clickMenu1_exportCounts,e.clickMenu1_exportSelections,e.clickMenu1_sharelink,e.clickMenu1_link_structure,e.clickMenu1_link_bind,e.clickMenu1_link_vast,e.clickMenu1_link_pubmed,e.clickMenu2_selectresidues,e.clickMenu2_selectcomplement,e.clickMenu2_selectall,e.clickMenu2_alignment,e.clickMenu2_command,e.clickMenu2_pickingYes,e.clickMenu2_pickingNo,e.clickMenu2_pickingResidue,e.clickMenu2_pickingStrand,e.clickMenu2_aroundsphere,e.clickMenu2_select_chain,e.clickmenu3_proteinsRibbon,e.clickmenu3_proteinsStrand,e.clickmenu3_proteinsCylinder,e.clickMenu3_proteinsSchematic,e.clickmenu3_proteinsCalpha,e.clickmenu3_proteinsBfactor,e.clickmenu3_proteinsLines,e.clickmenu3_proteinsStick,e.clickmenu3_proteinsBallstick,e.clickmenu3_proteinsSphere,e.clickmenu3_proteinsNothing,e.clickMenu3_sidechainsLines,e.clickMenu3_sidechainsStick,e.clickMenu3_sidechainsBallstick,e.clickMenu3_sidechainsSphere,e.clickMenu3_sidechainsNothing,e.clickmenu3_nuclCartoon,e.clickmenu3_nuclSchematic,e.clickmenu3_nuclPhos,e.clickmenu3_nuclLines,e.clickmenu3_nuclStick,e.clickmenu3_nuclBallstick,e.clickmenu3_nuclSphere,e.clickmenu3_nuclNothing,e.clickMenu3_ligandsLines,e.clickMenu3_ligandsStick,e.clickMenu3_ligandsBallstick,e.clickMenu3_ligandsSchematic,e.clickMenu3_ligandsSphere,e.clickMenu3_ligandsNothing,e.clickMenu3_ionsSphere,e.clickMenu3_ionsDot,e.clickMenu3_ionsNothing,e.clickMenu3_waterSphere,e.clickMenu3_waterDot,e.clickMenu3_waterNothing,e.clickMenu4_colorSpectrum,e.clickMenu4_colorChain,e.clickMenu4_colorSS,e.clickMenu4_colorResidue,e.clickMenu4_colorCharge,e.clickMenu4_colorHydrophobic,e.clickMenu4_colorAtom,e.clickMenu4_colorConserved,e.clickMenu4_colorRed,e.clickMenu4_colorGreen,e.clickMenu4_colorBlue,e.clickMenu4_colorMagenta,e.clickMenu4_colorYellow,e.clickMenu4_colorCyan,e.clickMenu4_colorWhite,e.clickMenu4_colorGrey,e.clickMenu4_colorCustom,e.clickMenu5_neighborsYes,e.clickMenu5_neighborsNo,e.clickMenu5_surfaceVDW,e.clickMenu5_surfaceSAS,e.clickMenu5_surfaceMolecular,e.clickMenu5_surfaceNothing,e.clickMenu5_opacity10,e.clickMenu5_opacity09,e.clickMenu5_opacity08,e.clickMenu5_opacity07,e.clickMenu5_opacity06,e.clickMenu5_opacity05,e.clickMenu5_wireframeYes,e.clickMenu5_wireframeNo,e.clickMenu6_assemblyYes,e.clickMenu6_assemblyNo,e.clickMenu6_addlabelResidues,e.clickMenu6_addlabelYes,e.clickMenu6_addlabelSelection,e.clickMenu6_addlabelNo,e.clickMenu6_distanceYes,e.clickMenu6_distanceNo,e.clickmenu2_selectedcenter,e.clickMenu6_center,e.clickMenu6_resetorientation,e.clickMenu6_rotateleft,e.clickMenu6_rotateright,e.clickMenu6_rotateup,e.clickMenu6_rotatedown,e.clickMenu6_cameraPers,e.clickMenu6_cameraOrth,e.clickMenu6_bkgdBlack,e.clickMenu6_bkgdGrey,e.clickMenu6_bkgdWhite,e.clickMenu6_showfogYes,e.clickMenu6_showfogNo,e.clickMenu6_showslabYes,e.clickMenu6_showslabNo,e.clickMenu6_showaxisYes,e.clickMenu6_showaxisNo,e.clickMenu6_hbondsYes,e.clickMenu6_hbondsNo,e.clickStructureid,e.clickChainid,e.clickAlignChainid,e.clickCustomResidues,e.clickCustomAtoms,e.clickShow_selected,e.clickShow_sequences,e.clickShow_alignsequences,e.clickShow_selected_atom,e.clickCommand_apply,e.clickReload_pdb,e.clickReload_pdbfile,e.clickReload_mol2file,e.clickReload_sdffile,e.clickReload_xyzfile,e.clickReload_mmciffile,e.clickReload_mmcif,e.clickReload_mmdb,e.clickReload_gi,e.clickReload_cid,e.clickReload_state,e.clickReload_selectionfile,e.clickApplycustomcolor,e.clickApplypick_aroundsphere,e.clickApplyhbonds,e.clickApplypick_labels,e.clickApplyselection_labels,e.clickApplypick_measuredistance,e.clickReset,e.clickToggleHighlight,e.pressCommandtext,e.clickFilter_ckbx_all,e.clickFilter,e.clickHighlight_3d_diagram,e.clickSeqSaveSelection,e.clickAlignSeqSaveSelection,e.clickOutputSelection,e.bindMouseup,e.bindMousedown,e.windowResize},allCustomEvents:function{}},iCn3DUI.prototype.clickHighlight_3d_diagram=function{var e=this;$("#"+e.pre+"highlight_3d_diagram").click(function(i){e.icn3d.removeHighlightObjects;var t=document.getElementsByName(e.pre+"filter_ckbx"),n={},o={};e.icn3d.highlightAtoms={};for(var s=0,r=t.length;r>s;++s)if(t[s].checked&&"ligands"!=t[s].value){var a=t[s].value,c=t[s].getAttribute("chain");e.icn3d.molid2ss.hasOwnProperty(a)?(n[a]=e.icn3d.molid2ss[a],o[a]=e.icn3d.molid2color[a]):e.icn3d.highlightAtoms=e.icn3d.unionHash(e.icn3d.highlightAtoms,e.icn3d.chains[c])}e.icn3d.drawHelixBrick(n,o,e.icn3d.bHighlight),e.icn3d.addHighlightObjects(void 0,!1),e.icn3d.render})},iCn3DUI.prototype.rotateStructure=function(e,i){var t=this;if(t.icn3d.bStopRotate)return!1;if(t.icn3d.rotateCount>t.icn3d.rotateCountMax)return!1;if(++t.icn3d.rotateCount,void 0!==i&&i)if("left"===e)t.ROTATION_DIRECTION="left";else if("right"===e)t.ROTATION_DIRECTION="right";else if("up"===e)t.ROTATION_DIRECTION="up";else{if("down"!==e)return!1;t.ROTATION_DIRECTION="down"}if("left"===e&&"left"===t.ROTATION_DIRECTION)t.icn3d.rotateLeft(1);else if("right"===e&&"right"===t.ROTATION_DIRECTION)t.icn3d.rotateRight(1);else if("up"===e&&"up"===t.ROTATION_DIRECTION)t.icn3d.rotateUp(1);else{if("down"!==e||"down"!==t.ROTATION_DIRECTION)return!1;t.icn3d.rotateDown(1)}setTimeout(function{t.rotateStructure(e)},100)},iCn3DUI.prototype.showTitle=function{var e=this;if(void 0!==e.icn3d.moleculeTitle&&""!==e.icn3d.moleculeTitle){var i=e.icn3d.moleculeTitle;if(void 0===e.inputid)e.icn3d.moleculeTitle.length>40&&(i=e.icn3d.moleculeTitle.substr(0,40)+"..."),$("#"+e.pre+"title").html(i);else if(void 0!==e.cfg.cid){var t=e.getLinkToStructureSummary;$("#"+e.pre+"title").html(i+" (PubChem CID <a href='"+t+"' target='_blank' style='color:"+e.GREYD+"'>"+e.inputid.toUpperCase+"</a>)")}else if(void 0!==e.cfg.align)$("#"+e.pre+"title").html(i);else{var t=e.getLinkToStructureSummary;e.icn3d.moleculeTitle.length>40&&(i=e.icn3d.moleculeTitle.substr(0,40)+"..."),$("#"+e.pre+"title").html(i+" (PDB ID <a href='"+t+"' target='_blank' style='color:"+e.GREYD+"'>"+e.inputid.toUpperCase+"</a>)")}}else $("#"+e.pre+"title").html("")},iCn3DUI.prototype.getLinkToStructureSummary=function(e){var i=this,t="https://www.ncbi.nlm.nih.gov/structure/?term=";if(t=void 0!==i.cfg.cid?"https://www.ncbi.nlm.nih.gov/pccompound/?term=":-1!==i.inputid.indexOf(",")?"https://www.ncbi.nlm.nih.gov/structure/?term=":"https://www.ncbi.nlm.nih.gov/Structure/mmdb/mmdbsrv.cgi?uid=",void 0===i.inputid)t="https://www.ncbi.nlm.nih.gov/pccompound/?term="+i.moleculeTitle;else{var n=i.inputid.split("_");1===n.length?(t+=i.inputid,void 0!==e&&e&&i.setLogCommand("link to Structure Summary "+i.inputid+": "+t,!1)):2===n.length&&(t+=n[0]+" OR "+n[1],void 0!==e&&e&&i.setLogCommand("link to structures "+n[0]+" and "+n[1]+": "+t,!1))}return t},iCn3DUI.prototype.isIE=function{var e=window.navigator.userAgent,i=e.indexOf("MSIE ");return i>0||navigator.userAgent.match(/Trident.*rv\:11\./)?!0:!1},iCn3DUI.prototype.saveFile=function(e,i,t){var n=this;if(n.isIE){if(window.navigator.msSaveBlob)if("command"===i){for(var o="",s=0,r=n.icn3d.commands.length;r>s;++s)o+=n.icn3d.commands[s].trim+"\n";var a=decodeURIComponent(o),c=new Blob([a],{type:"text;charset=utf-8;"});navigator.msSaveBlob(c,e)}else if("png"===i){n.icn3d.render;var c=n.icn3d.renderer.domElement.msToBlob;navigator.msSaveBlob(c,e)}else if("html"===i){var o=t,a=decodeURIComponent(o),c=new Blob([a],{type:"text/html;charset=utf-8;"});navigator.msSaveBlob(c,e)}else if("text"===i){var o=t,a=decodeURIComponent(o),c=new Blob([a],{type:"text;charset=utf-8;"});navigator.msSaveBlob(c,e)}}else{var a;if("command"===i){for(var o="",s=0,r=n.icn3d.commands.length;r>s;++s)o+=n.icn3d.commands[s].trim+"\n";a="data:text;charset=utf-8,"+encodeURIComponent(o)}else if("png"===i){n.icn3d.render;var o=n.icn3d.renderer.domElement.toDataURL("image/png");a=o}else if("html"===i){var o=t;a="data:text/html;charset=utf-8,"+encodeURIComponent(o)}else if("text"===i){var o=t;a="data:text;charset=utf-8,"+encodeURIComponent(o)}window.open(a,"_blank")}},iCn3DUI.prototype.isMobile=function{return/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)},iCn3DUI.prototype.isMac=function{return/Mac/i.test(navigator.userAgent)},iCn3DUI.prototype.isSessionStorageSupported=function{var e="test";try{return sessionStorage.setItem(e,"1"),sessionStorage.removeItem(e),!0}catch(i){return!1}},iCn3DUI.prototype.downloadPdb=function(e){var i,t,n=this;if("https:"===document.location.protocol){var o=document.location.href;return o=o.replace("https","http"),void window.open(o,"_self")}i="http://files.rcsb.org/view/"+e+".pdb",t="text",n.icn3d.bCid=void 0,$.ajax({url:i,dataType:t,cache:!0,beforeSend:function{$("#"+n.pre+"wait")&&$("#"+n.pre+"wait").show,$("#"+n.pre+"canvas")&&$("#"+n.pre+"canvas").hide,$("#"+n.pre+"commandlog")&&$("#"+n.pre+"commandlog").hide},complete:function{$("#"+n.pre+"wait")&&$("#"+n.pre+"wait").hide,$("#"+n.pre+"canvas")&&$("#"+n.pre+"canvas").show,$("#"+n.pre+"commandlog")&&$("#"+n.pre+"commandlog").show},success:function(e){"https:"!==document.location.protocol?n.loadPdbData(e):n.loadPdbData(e.data)}})},iCn3DUI.prototype.loadPdbData=function(e){var i=this;i.icn3d.loadPDB(e),i.pmid=i.icn3d.pmid,void 0===i.cfg.align&&1==Object.keys(i.icn3d.structures).length&&$("#"+i.pre+"alternateWrapper").hide,i.icn3d.setAtomStyleByOptions(i.options),i.icn3d.setColorByOptions(i.options,i.icn3d.atoms),i.renderStructure,i.showTitle,void 0!==i.cfg.rotate&&i.rotateStructure(i.cfg.rotate,!0),void 0!==i.deferred&&i.deferred.resolve,void 0!==i.deferred2&&i.deferred2.resolve},iCn3DUI.prototype.downloadMmcif=function(e){var i,t=this;return"https:"===document.location.protocol?(i=document.location.href,i=i.replace("https","http"),void window.open(i,"_self")):(i="http://files.rcsb.org/view/"+e+".cif",t.icn3d.bCid=void 0,void $.ajax({url:i,dataType:"text",cache:!0,beforeSend:function{$("#"+t.pre+"wait")&&$("#"+t.pre+"wait").show,$("#"+t.pre+"canvas")&&$("#"+t.pre+"canvas").hide,$("#"+t.pre+"commandlog")&&$("#"+t.pre+"commandlog").hide},complete:function{$("#"+t.pre+"wait")&&$("#"+t.pre+"wait").hide,$("#"+t.pre+"canvas")&&$("#"+t.pre+"canvas").show,$("#"+t.pre+"commandlog")&&$("#"+t.pre+"commandlog").show},success:function(e){i="//www.ncbi.nlm.nih.gov/Structure/mmcifparser/mmcifparser.cgi",$.ajax({url:i,type:"POST",data:{mmciffile:e},dataType:"jsonp",cache:!0,beforeSend:function{$("#"+t.pre+"wait")&&$("#"+t.pre+"wait").show,$("#"+t.pre+"canvas")&&$("#"+t.pre+"canvas").hide,$("#"+t.pre+"commandlog")&&$("#"+t.pre+"commandlog").hide},complete:function{$("#"+t.pre+"wait")&&$("#"+t.pre+"wait").hide,$("#"+t.pre+"canvas")&&$("#"+t.pre+"canvas").show,$("#"+t.pre+"commandlog")&&$("#"+t.pre+"commandlog").show},success:function(e){t.loadMmcifData(e)}})}}))},iCn3DUI.prototype.loadMmcifData=function(e){var i=this;if(void 0===e.atoms)return alert("invalid atoms data."),!1;i.loadAtomDataIn(e,e.mmcif,"mmcifid"),void 0===i.cfg.align&&1==Object.keys(i.icn3d.structures).length&&$("#"+i.pre+"alternateWrapper").hide;for(var t=e.assembly,n=0,o=t.length;o>n;++n){void 0==i.icn3d.biomtMatrices[n]&&(i.icn3d.biomtMatrices[n]=(new THREE.Matrix4).identity);for(var s=0,r=t[n].length;r>s;++s)i.icn3d.biomtMatrices[n].elements[s]=t[n][s]}i.icn3d.setAtomStyleByOptions(i.options),i.icn3d.setColorByOptions(i.options,i.icn3d.atoms),i.renderStructure,void 0!==i.cfg.rotate&&i.rotateStructure(i.cfg.rotate,!0),void 0!==i.cfg.showseq&&i.cfg.showseq&&i.openDialog(i.pre+"dl_selectresidues","Select residues in sequences"),void 0!==i.deferred&&i.deferred.resolve,void 0!==i.deferred2&&i.deferred2.resolve},iCn3DUI.prototype.downloadAlignment=function(e){var i=this;if(i.options.proteins="c alpha trace",i.icn3d.options.proteins="c alpha trace",i.bFullUi&&i.isMac&&i.isMobile){i.MENU_WIDTH=950,i.setViewerWidthHeight;var t=i.WIDTH-i.LESSWIDTH,n=i.HEIGHT-i.LESSHEIGHT;i.resizeCanvas(t,n,!0,!1)}var o=e.split(","),s=(2===o.length?"uids=":"ids=")+e,r="https://www.ncbi.nlm.nih.gov/Structure/vastplus/vastplus.cgi?cmd=c&w3d&"+s,a="https://www.ncbi.nlm.nih.gov/Structure/vastplus/vastplus.cgi?cmd=c1&d&"+s;void 0!==i.cfg.inpara&&(r+=i.cfg.inpara,a+=i.cfg.inpara),i.icn3d.bCid=void 0,i.icn3d.pdbid_chain2title={};var c=$.ajax({url:a,dataType:"jsonp",cache:!0,beforeSend:function{$("#"+i.pre+"wait")&&$("#"+i.pre+"wait").show, $("#"+i.pre+"canvas")&&$("#"+i.pre+"canvas").hide,$("#"+i.pre+"commandlog")&&$("#"+i.pre+"commandlog").hide},complete:function{$("#"+i.pre+"wait")&&$("#"+i.pre+"wait").hide,$("#"+i.pre+"canvas")&&$("#"+i.pre+"canvas").show,$("#"+i.pre+"commandlog")&&$("#"+i.pre+"commandlog").show}}),l={},d=c.then(function(e){if(l=e.seqalign,void 0===l)return alert("These two MMDB IDs "+o+" do not have 3D alignment data."),!1;var t=0;for(var n in e){if(2>t){var s=e[n].pdbid,a=e[n].molecule;for(var c in a){var d=a[c].chain;i.icn3d.pdbid_chain2title[s+"_"+d]=a[c].name}}++t}return $.ajax({url:r,dataType:"jsonp",cache:!0,beforeSend:function{$("#"+i.pre+"wait")&&$("#"+i.pre+"wait").show,$("#"+i.pre+"canvas")&&$("#"+i.pre+"canvas").hide,$("#"+i.pre+"commandlog")&&$("#"+i.pre+"commandlog").hide},complete:function{$("#"+i.pre+"wait")&&$("#"+i.pre+"wait").hide,$("#"+i.pre+"canvas")&&$("#"+i.pre+"canvas").show,$("#"+i.pre+"commandlog")&&$("#"+i.pre+"commandlog").show}})});d.done(function(e){return void 0===e.atoms?(alert("invalid atoms data."),!1):(i.loadAtomDataIn(e,void 0,"align",l),void 0===i.cfg.align&&1==Object.keys(i.icn3d.structures).length&&$("#"+i.pre+"alternateWrapper").hide,i.icn3d.setAtomStyleByOptions(i.options),i.icn3d.setColorByOptions(i.options,i.icn3d.atoms,!0),i.renderStructure,void 0!==i.cfg.rotate&&i.rotateStructure(i.cfg.rotate,!0),void 0!==i.cfg.showalignseq&&i.cfg.showalignseq&&i.openDialog(i.pre+"dl_alignment","Select residues in aligned sequences"),void 0!==i.cfg.showseq&&i.cfg.showseq&&i.openDialog(i.pre+"dl_selectresidues","Select residues in sequences"),void 0!==i.deferred&&i.deferred.resolve,void 0!==i.deferred2&&i.deferred2.resolve,void 0)})},iCn3DUI.prototype.downloadCid=function(e){var i=this,t="https://pubchem.ncbi.nlm.nih.gov/rest/pug/compound/cid/"+e+"/record/SDF/?record_type=3d&response_type=display";i.options.picking="atom",i.options.ligands="ball and stick",i.icn3d.options.picking="atom",i.icn3d.options.ligands="ball and stick",i.icn3d.bCid=!0,$.ajax({url:t,dataType:"text",cache:!0,beforeSend:function{$("#"+i.pre+"wait")&&$("#"+i.pre+"wait").show,$("#"+i.pre+"canvas")&&$("#"+i.pre+"canvas").hide,$("#"+i.pre+"commandlog")&&$("#"+i.pre+"commandlog").hide},complete:function{$("#"+i.pre+"wait")&&$("#"+i.pre+"wait").hide,$("#"+i.pre+"canvas")&&$("#"+i.pre+"canvas").show,$("#"+i.pre+"commandlog")&&$("#"+i.pre+"commandlog").show},success:function(t){var n=i.loadSdfAtomData(t);void 0===i.cfg.align&&1==Object.keys(i.icn3d.structures).length&&$("#"+i.pre+"alternateWrapper").hide,n?(i.icn3d.setAtomStyleByOptions(i.options),i.icn3d.setColorByOptions(i.options,i.icn3d.atoms),i.renderStructure,void 0!==i.cfg.rotate&&i.rotateStructure(i.cfg.rotate,!0),void 0!==i.deferred&&i.deferred.resolve,void 0!==i.deferred2&&i.deferred2.resolve):alert("The SDF of CID "+e+" has the wrong format...")}}).fail(function{alert("This CID may not have 3D structure...")})},iCn3DUI.prototype.loadMol2Data=function(e){var i=this,t=i.loadMol2AtomData(e);void 0===i.cfg.align&&1==Object.keys(i.icn3d.structures).length&&$("#"+i.pre+"alternateWrapper").hide,t?(i.icn3d.setAtomStyleByOptions(i.options),i.icn3d.setColorByOptions(i.options,i.icn3d.atoms),i.renderStructure,void 0!==i.cfg.rotate&&i.rotateStructure(i.cfg.rotate,!0),void 0!==i.deferred&&i.deferred.resolve,void 0!==i.deferred2&&i.deferred2.resolve):alert("The Mol2 file has the wrong format...")},iCn3DUI.prototype.loadSdfData=function(e){var i=this,t=i.loadSdfAtomData(e);void 0===i.cfg.align&&1==Object.keys(i.icn3d.structures).length&&$("#"+i.pre+"alternateWrapper").hide,t?(i.icn3d.setAtomStyleByOptions(i.options),i.icn3d.setColorByOptions(i.options,i.icn3d.atoms),i.renderStructure,void 0!==i.cfg.rotate&&i.rotateStructure(i.cfg.rotate,!0),void 0!==i.deferred&&i.deferred.resolve,void 0!==i.deferred2&&i.deferred2.resolve):alert("The SDF file has the wrong format...")},iCn3DUI.prototype.loadXyzData=function(e){var i=this,t=i.loadXyzAtomData(e);void 0===i.cfg.align&&1==Object.keys(i.icn3d.structures).length&&$("#"+i.pre+"alternateWrapper").hide,t?(i.icn3d.setAtomStyleByOptions(i.options),i.icn3d.setColorByOptions(i.options,i.icn3d.atoms),i.renderStructure,void 0!==i.cfg.rotate&&i.rotateStructure(i.cfg.rotate,!0),void 0!==i.deferred&&i.deferred.resolve,void 0!==i.deferred2&&i.deferred2.resolve):alert("The XYZ file has the wrong format...")},iCn3DUI.prototype.loadMol2AtomData=function(e){var i=this,t=e.split(/\r?\n|\r/);if(t.length<4)return!1;i.icn3d.init;for(var n,o,s=1,r="A",a="LIG",c=1,l={},d=1,h="1_A",u="1_A_1",p=0,m=0,g=1,f=!1,v=!1,b={},y={},E="",_=0,w=t.length;w>_;++_){var C=t[_].trim;if(""!==C&&"#"!==C.substr(0,1)){if("@<TRIPOS>MOLECULE"==C){i.icn3d.moleculeTitle=t[_+1].trim;var S=t[_+2].trim.replace(/\s+/g," ").split(" ");n=S[0],o=S[1],_+=4}else"@<TRIPOS>ATOM"==C?(g=1,f=!0,++_):"@<TRIPOS>BOND"==C?(v=!0,f=!1,++_):"@<TRIPOS>SUBSTRUCTURE"==C&&(v=!1,++_);if(C=t[_].trim,""!==C&&"#"!==C.substr(0,1)){if(f&&n>p){var k=C.replace(/\s+/g," ").split(" "),R=parseInt(k[0]);b[R]=g;var T,H=k[1],A=parseFloat(k[2]),x=parseFloat(k[3]),O=parseFloat(k[4]),M=new THREE.Vector3(A,x,O),L=k[5],I=L.indexOf(".");if(T=-1===I?L:L.substr(0,I),"H"===T&&T===L)y[R]=1;else{var D={het:!0,serial:g,name:H,resn:a,structure:s,chain:r,resi:c,coord:M,b:0,elem:T,bonds:[],ss:"coil",ssbegin:!1,ssend:!1,bondOrder:[]};i.icn3d.atoms[g]=D,l[g]=1,++g}++p}if(v&&o>m){var z=C.replace(/\s+/g," ").split(" "),N=parseInt(z[1]),q=parseInt(z[2]),j=z[3],P=j;if("am"===j&&(P="1"),"ar"===j&&(P="1.5"),!(y.hasOwnProperty(N)||y.hasOwnProperty(q)||"1"!==P&&"2"!==P&&"3"!==P&&"1.5"!==P)){var F=P,B=b[N],V=b[q];i.icn3d.atoms[B].bonds.push(V),i.icn3d.atoms[B].bondOrder.push(F),i.icn3d.atoms[V].bonds.push(B),i.icn3d.atoms[V].bondOrder.push(F),"2"==F?(i.icn3d.doublebonds[B+"_"+V]=1,i.icn3d.doublebonds[V+"_"+B]=1):"3"==F?(i.icn3d.triplebonds[B+"_"+V]=1,i.icn3d.triplebonds[V+"_"+B]=1):"1.5"==F&&(i.icn3d.aromaticbonds[B+"_"+V]=1,i.icn3d.aromaticbonds[V+"_"+B]=1)}++m,E=j}}}}i.icn3d.displayAtoms=l,i.icn3d.highlightAtoms=l,i.icn3d.structures[d]=[h],i.icn3d.chains[h]=l,i.icn3d.residues[u]=l,i.icn3d.residueId2Name[u]=a,void 0===i.icn3d.chainsSeq[h]&&(i.icn3d.chainsSeq[h]=[]),void 0===i.icn3d.chainsAnno[h]&&(i.icn3d.chainsAnno[h]=[]),void 0===i.icn3d.chainsAnno[h][0]&&(i.icn3d.chainsAnno[h][0]=[]),void 0===i.icn3d.chainsAnnoTitle[h]&&(i.icn3d.chainsAnnoTitle[h]=[]),void 0===i.icn3d.chainsAnnoTitle[h][0]&&(i.icn3d.chainsAnnoTitle[h][0]=[]);var G={};G.resi=c,G.name=a,i.icn3d.chainsSeq[h].push(G),i.icn3d.chainsAnno[h][0].push(c),i.icn3d.chainsAnnoTitle[h][0].push("");var U=new THREE.Vector3(9999,9999,9999),W=new THREE.Vector3(-9999,-9999,-9999),Y=new THREE.Vector3,X=0;for(var _ in i.icn3d.atoms){var Z=i.icn3d.atoms[_],M=Z.coord;Y.add(M),U.min(M),W.max(M),++X,Z.het&&(-1!==$.inArray(Z.elem,i.icn3d.ionsArray)?i.icn3d.ions[Z.serial]=1:i.icn3d.ligands[Z.serial]=1)}return i.icn3d.pmin=U,i.icn3d.pmax=W,i.icn3d.cnt=X,i.icn3d.maxD=i.icn3d.pmax.distanceTo(i.icn3d.pmin),i.icn3d.center=Y.multiplyScalar(1/i.icn3d.cnt),i.icn3d.maxD<25&&(i.icn3d.maxD=25),i.icn3d.oriMaxD=i.icn3d.maxD,i.icn3d.oriCenter=i.icn3d.center.clone,i.showTitle,!0},iCn3DUI.prototype.loadSdfAtomData=function(e){var i=this,t=e.split(/\r?\n|\r/);if(t.length<4)return!1;i.icn3d.init;var n=1,o="A",s=1,r="LIG",a=n,c=n+"_"+o,l=c+"_"+s,d=parseInt(t[3].substr(0,3));if(isNaN(d)||0>=d)return!1;var h=parseInt(t[3].substr(3,3)),u=4;if(t.length<u+d+h)return!1;var p,m,g=0,f=d,v={},b={},y={},E=1;for(p=g;f>p;p++){m=t[u],u++;var _=m.substr(31,3).replace(/ /g,"");if("H"!==_){var w=parseFloat(m.substr(0,10)),C=parseFloat(m.substr(10,10)),S=parseFloat(m.substr(20,10)),k=new THREE.Vector3(w,C,S),R={het:!0,serial:E,name:_,resn:r,structure:n,chain:o,resi:s,coord:k,b:0,elem:_,bonds:[],ss:"coil",ssbegin:!1,ssend:!1,bondOrder:[]};i.icn3d.atoms[E]=R,y[E]=1,v[p]=E,++E}else b[p]=1}i.icn3d.displayAtoms=y,i.icn3d.highlightAtoms=y,i.icn3d.structures[a]=[c],i.icn3d.chains[c]=y,i.icn3d.residues[l]=y,i.icn3d.residueId2Name[l]=r,void 0===i.icn3d.chainsSeq[c]&&(i.icn3d.chainsSeq[c]=[]),void 0===i.icn3d.chainsAnno[c]&&(i.icn3d.chainsAnno[c]=[]),void 0===i.icn3d.chainsAnno[c][0]&&(i.icn3d.chainsAnno[c][0]=[]),void 0===i.icn3d.chainsAnnoTitle[c]&&(i.icn3d.chainsAnnoTitle[c]=[]),void 0===i.icn3d.chainsAnnoTitle[c][0]&&(i.icn3d.chainsAnnoTitle[c][0]=[]);var T={};for(T.resi=s,T.name=r,i.icn3d.chainsSeq[c].push(T),i.icn3d.chainsAnno[c][0].push(s),i.icn3d.chainsAnnoTitle[c][0].push(""),p=0;h>p;p++){m=t[u],u++;var H=parseInt(m.substr(0,3))-1+g,A=parseInt(m.substr(3,3))-1+g,x=m.substr(6,3).trim;if(!b.hasOwnProperty(H)&&!b.hasOwnProperty(A)){var O=v[H],M=v[A];i.icn3d.atoms[O].bonds.push(M),i.icn3d.atoms[O].bondOrder.push(x),i.icn3d.atoms[M].bonds.push(O),i.icn3d.atoms[M].bondOrder.push(x),"2"==x?(i.icn3d.doublebonds[O+"_"+M]=1,i.icn3d.doublebonds[M+"_"+O]=1):"3"==x&&(i.icn3d.triplebonds[O+"_"+M]=1,i.icn3d.triplebonds[M+"_"+O]=1)}}var L=new THREE.Vector3(9999,9999,9999),I=new THREE.Vector3(-9999,-9999,-9999),D=new THREE.Vector3,z=0;for(var p in i.icn3d.atoms){var N=i.icn3d.atoms[p],k=N.coord;D.add(k),L.min(k),I.max(k),++z,N.het&&(-1!==$.inArray(N.elem,i.icn3d.ionsArray)?i.icn3d.ions[N.serial]=1:i.icn3d.ligands[N.serial]=1)}return i.icn3d.pmin=L,i.icn3d.pmax=I,i.icn3d.cnt=z,i.icn3d.maxD=i.icn3d.pmax.distanceTo(i.icn3d.pmin),i.icn3d.center=D.multiplyScalar(1/i.icn3d.cnt),i.icn3d.maxD<25&&(i.icn3d.maxD=25),i.icn3d.oriMaxD=i.icn3d.maxD,i.icn3d.oriCenter=i.icn3d.center.clone,i.showTitle,!0},iCn3DUI.prototype.setXyzAtomSeq=function(e,i,t,n){var o=this;o.icn3d.displayAtoms=o.icn3d.unionHash(o.icn3d.displayAtoms,e),o.icn3d.highlightAtoms=o.icn3d.unionHash(o.icn3d.highlightAtoms,e),o.icn3d.structures[i]=[t],o.icn3d.chains[t]=e,o.icn3d.residues[n]=e,o.icn3d.residueId2Name[n]="LIG",void 0===o.icn3d.chainsSeq[t]&&(o.icn3d.chainsSeq[t]=[]),void 0===o.icn3d.chainsAnno[t]&&(o.icn3d.chainsAnno[t]=[]),void 0===o.icn3d.chainsAnno[t][0]&&(o.icn3d.chainsAnno[t][0]=[]),void 0===o.icn3d.chainsAnnoTitle[t]&&(o.icn3d.chainsAnnoTitle[t]=[]),void 0===o.icn3d.chainsAnnoTitle[t][0]&&(o.icn3d.chainsAnnoTitle[t][0]=[]);var s={};s.resi=1,s.name="LIG",o.icn3d.chainsSeq[t].push(s),o.icn3d.chainsAnno[t][0].push(1),o.icn3d.chainsAnnoTitle[t][0].push("");for(var r=Object.keys(e),a=0,c=r.length;c>a;++a)for(var l=o.icn3d.atoms[r[a]],d=a+1,h=r.length;h>d;++d){var u=o.icn3d.atoms[r[d]],p=1.2*(o.icn3d.covalentRadii[l.elem]+o.icn3d.covalentRadii[u.elem]);Math.abs(l.coord.x-u.coord.x)>p||Math.abs(l.coord.y-u.coord.y)>p||Math.abs(l.coord.z-u.coord.z)>p||o.icn3d.hasCovalentBond(l,u)&&(o.icn3d.atoms[r[a]].bonds.push(r[d]),o.icn3d.atoms[r[d]].bonds.push(r[a]))}},iCn3DUI.prototype.loadXyzAtomData=function(e){var i=this,t=e.split(/\r?\n|\r/);if(t.length<3)return!1;i.icn3d.init;var n,o,s,r,a="A",c="LIG",l=1,d={},h=0,u=1,p=2;i.icn3d.moleculeTitle="";for(var m=0,g=t.length;g>m;++m){var f=t[m].trim;if(""!==f&&(""===f||isNaN(f)||(0!==m&&i.setXyzAtomSeq(d,h,n,o),++h,d={},s=h,n=s+"_"+a,o=n+"_"+l,r=parseInt(f),h>1&&(i.icn3d.moleculeTitle+="; "),i.icn3d.moleculeTitle+=t[m+1].trim,m+=p),f=t[m].trim,""!==f)){var v=f.replace(/,/," ").replace(/\s+/g," ").split(" "),b=v[0],y=parseFloat(v[1]),E=parseFloat(v[2]),_=parseFloat(v[3]),w=new THREE.Vector3(y,E,_),C={het:!0,serial:u,name:b,resn:c,structure:s,chain:a,resi:l,coord:w,b:0,elem:b,bonds:[],ss:"coil",ssbegin:!1,ssend:!1,bondOrder:[]};i.icn3d.atoms[u]=C,d[u]=1,++u}}i.setXyzAtomSeq(d,h,n,o);var S=new THREE.Vector3(9999,9999,9999),k=new THREE.Vector3(-9999,-9999,-9999),R=new THREE.Vector3,T=0;for(var m in i.icn3d.atoms){var H=i.icn3d.atoms[m],w=H.coord;R.add(w),S.min(w),k.max(w),++T,H.het&&(-1!==$.inArray(H.elem,i.icn3d.ionsArray)?i.icn3d.ions[H.serial]=1:i.icn3d.ligands[H.serial]=1)}return i.icn3d.pmin=S,i.icn3d.pmax=k,i.icn3d.cnt=T,i.icn3d.maxD=i.icn3d.pmax.distanceTo(i.icn3d.pmin),i.icn3d.center=R.multiplyScalar(1/i.icn3d.cnt),i.icn3d.maxD<25&&(i.icn3d.maxD=25),i.icn3d.oriMaxD=i.icn3d.maxD,i.icn3d.oriCenter=i.icn3d.center.clone,i.showTitle,!0},iCn3DUI.prototype.downloadMmdb=function(e,i){var t,n=this;t=void 0!==i&&i?"https://www.ncbi.nlm.nih.gov/Structure/mmdb/mmdb_strview.cgi?program=w3d&seq=1&gi="+e:"https://www.ncbi.nlm.nih.gov/Structure/mmdb/mmdb_strview.cgi?program=w3d&seq=1&uid="+e,n.icn3d.bCid=void 0,void 0!==n.cfg.inpara&&(t+=n.cfg.inpara),$.ajax({url:t,dataType:"jsonp",cache:!0,beforeSend:function{$("#"+n.pre+"wait")&&$("#"+n.pre+"wait").show,$("#"+n.pre+"canvas")&&$("#"+n.pre+"canvas").hide,$("#"+n.pre+"commandlog")&&$("#"+n.pre+"commandlog").hide},complete:function{$("#"+n.pre+"wait")&&$("#"+n.pre+"wait").hide,$("#"+n.pre+"canvas")&&$("#"+n.pre+"canvas").show,$("#"+n.pre+"commandlog")&&$("#"+n.pre+"commandlog").show},error:function(t,o,s){return i?alert("This gi "+e+" has no corresponding 3D structure..."):alert("This mmdbid "+e+" with the parameters "+n.cfg.inpara+" has no corresponding 3D structure..."),!1},success:function(e){var i=void 0!==e.pdbId?e.pdbId:e.mmdbId;if(n.inputid=i,(void 0!==n.cfg.inpara&&-1!=n.cfg.inpara.indexOf("mols=")||e.atomcount<=e.threshold&&void 0!==e.atoms)&&($("#"+n.pre+"accordion5").show,n.loadAtomDataIn(e,i,"mmdbid"),void 0===n.cfg.align&&1==Object.keys(n.icn3d.structures).length&&null!==$("#"+n.pre+"alternateWrapper")&&$("#"+n.pre+"alternateWrapper").hide,n.icn3d.setAtomStyleByOptions(n.options),n.icn3d.setColorByOptions(n.options,n.icn3d.atoms,!0),n.renderStructure,void 0!==n.cfg.rotate&&n.rotateStructure(n.cfg.rotate,!0)),void 0!==n.cfg.inpara&&-1==n.cfg.inpara.indexOf("mols=")&&e.atomcount>e.threshold&&void 0!==e.molid2rescount){$("#"+n.pre+"accordion5").hide;n.icn3d.bSSOnly=!0,n.cfg.showseq=!1,n.loadAtomDataIn(e,i,"mmdbid");var t=n.icn3d.cloneHash(n.options);t.nucleotides="phosphorus lines",n.icn3d.setAtomStyleByOptions(t),n.icn3d.setColorByOptions(t,n.icn3d.atoms,!0);var o=e.molid2rescount,s={},r={},a={},c=" ",molid2ss={};for(var h in e.helix)for(var f=0,v=e.helix[h].length;v>f;++f){var b=e.helix[h][f],y={};y.type="helix",y.startResi=b.from,y.endResi=b.to,y.coords=[],y.coords.push(b.end),y.coords.push(b.start),void 0===molid2ss[h]&&(molid2ss[h]=[]),molid2ss[h].push(y)}for(var h in e.brick)for(var f=0,v=e.brick[h].length;v>f;++f){var E=e.brick[h][f],y={};y.type="brick",y.startResi=E.from,y.endResi=E.to,y.coords=[];var _={},w={},C={};_.x=.25*(E["000"][0]+E["010"][0]+E["011"][0]+E["001"][0]),_.y=.25*(E["000"][1]+E["010"][1]+E["011"][1]+E["001"][1]),_.z=.25*(E["000"][2]+E["010"][2]+E["011"][2]+E["001"][2]),w.x=.25*(E[100][0]+E[110][0]+E[111][0]+E[101][0]),w.y=.25*(E[100][1]+E[110][1]+E[111][1]+E[101][1]),w.z=.25*(E[100][2]+E[110][2]+E[111][2]+E[101][2]),C.x=E["010"][0]-E["000"][0],C.y=E["010"][1]-E["000"][1],C.z=E["010"][2]-E["000"][2],y.coords.push(_),y.coords.push(w),y.coords.push(C),void 0===molid2ss[h]&&(molid2ss[h]=[]),molid2ss[h].push(y)}for(var h in molid2ss)molid2ss[h].sort(function(e,i){return parseFloat(e.startResi)-parseFloat(i.startResi)});if(0!==n.icn3d.cnt)var S=n.icn3d.pmin,k=n.icn3d.pmax,R=n.icn3d.center.multiplyScalar(n.icn3d.cnt),T=n.icn3d.cnt;else var S=new THREE.Vector3(9999,9999,9999),k=new THREE.Vector3(-9999,-9999,-9999),R=new THREE.Vector3,T=0;for(var h in molid2ss){for(var H=new THREE.Vector3(9999,9999,9999),A=new THREE.Vector3(-9999,-9999,-9999),x=new THREE.Vector3,O=0,f=0,v=molid2ss[h].length;v>f;++f){var M=molid2ss[h][f].coords[0];S.min(M),k.max(M),R.add(M),H.min(M),A.max(M),x.add(M),++T,++O,M=molid2ss[h][f].coords[1],S.min(M),k.max(M),R.add(M),H.min(M),A.max(M),x.add(M),++T,++O}x.multiplyScalar(1/O)}n.icn3d.maxD=k.distanceTo(S),n.icn3d.center=R.multiplyScalar(1/T),n.icn3d.oriMaxD=n.icn3d.maxD,n.icn3d.oriCenter=n.icn3d.center.clone;for(var h in molid2ss)for(var f=1,v=molid2ss[h].length;v>f;++f){var y={};y.type="coil",y.startResi=molid2ss[h][f-1].endResi,y.endResi=molid2ss[h][f].startResi,y.coords=[],y.coords.push(molid2ss[h][f-1].coords[1]),y.coords.push(molid2ss[h][f].coords[0]),molid2ss[h].push(y)}n.icn3d.molid2ss=molid2ss,n.icn3d.molid2color=s,n.renderStructure,void 0!==n.cfg.rotate&&n.rotateStructure(n.cfg.rotate,!0),$("#"+n.pre+"dl_filter_table").html(c);var L="Select chains to display",i=n.pre+"dl_filter";n.openDialog(i,L)}return void 0!==n.cfg.showseq&&n.cfg.showseq&&n.openDialog(n.pre+"dl_selectresidues","Select residues in sequences"),void 0!==n.deferred&&n.deferred.resolve,void 0!==n.deferred2&&n.deferred2.resolve,void 0===e.atoms&&void 0===e.molid2rescount?(alert("invalid MMDB data."),!1):void 0}})},iCn3DUI.prototype.downloadGi=function(e){var i=this;i.icn3d.bCid=void 0;var t=!0;i.downloadMmdb(e,t)},iCn3DUI.prototype.loadAtomDataIn=function(e,i,t,n){var o=this;o.icn3d.init;var s=new THREE.Vector3(9999,9999,9999),r=new THREE.Vector3(-9999,-9999,-9999),a=new THREE.Vector3,c=e.atoms,l=0,d=0,h={},u={};if(o.pmid=e.pubmedid,"align"===t){o.pmid="";var p=-1!==o.cfg.inpara.indexOf("atype=1")?"Invariant Core ":"";o.icn3d.moleculeTitle=p+"Structure Alignment of ";for(var m=0,g=e.aligned_structures.length;g>m;++m){var f=e.aligned_structures[m];1===m&&(o.icn3d.secondId=f.pdbid);for(var v=f.range[0];v<=f.range[1];++v){var b=f.pdbid,y=f.mmdbid;h[v]=b.toString,u[y]=b}o.icn3d.moleculeTitle+='<a href="https://www.ncbi.nlm.nih.gov/Structure/mmdb/mmdbsrv.cgi?uid='+f.pdbid.toUpperCase+'" target="_blank" style="color: '+o.GREYD+';">'+f.pdbid.toUpperCase+"</a>",void 0!==f.descr&&(o.pmid+=f.descr.pubmedid),0===m&&(o.icn3d.moleculeTitle+=" and ",void 0!==f.descr&&(o.pmid+="_"))}o.icn3d.moleculeTitle+=" from VAST+"}else void 0!==e.descr&&(o.icn3d.moleculeTitle+=e.descr.name);var E={},_={};if("mmdbid"===t||"align"===t){if("mmdbid"===t){if(void 0!==e.molid2chain){var w={};for(var C in e.molid2chain){var S=e.molid2chain[C].chain.trim;void 0===w[S]?w[S]=1:++w[S],E[C]=1===w[S]?S:S+w[S].toString}}}else if("align"===t&&void 0!==e.molid2chain)for(var k in e.molid2chain){var R={};for(var C in e.molid2chain[k]){var T=e.molid2chain[k][C].chain.trim;void 0===R[T]?R[T]=1:++R[T],_[u[k]+"_"+C]=1===R[T]?T:T+R[T].toString}}if("mmdbid"===t){var H=e.molid2rescount;for(var m in H){var A="#"+("000000"+H[m].color.toString(16)).slice(-6),S=i+"_"+H[m].chain;o.icn3d.chainsColor[S]=new THREE.Color(A)}}else if("align"===t&&void 0!==e.molid2chain)for(var k in e.molid2chain){var R={};for(var C in e.molid2chain[k]){var T=e.molid2chain[k][C].chain.trim;void 0===R[T]?R[T]=1:++R[T];var A="#"+("000000"+e.molid2chain[k][C].color.toString(16)).slice(-6),S=1===R[T]?u[k]+"_"+T:u[k]+"_"+T+R[T].toString;o.icn3d.chainsColor[S]=new THREE.Color(A)}}}var x={};if("mmdbid"===t||"mmcifid"===t)for(var S in e.sequences){var O=e.sequences[S],M=i+"_"+S;"mmcifid"===t&&(M="1_"+S),d=-999;for(var L=0,I=!0,m=0,g=O.length;g>m;++m){var D=O[m][1];"mmcifid"===t&&(D=o.icn3d.residueName2Abbr(D));var z={};if(z.resi=m+1,0===parseInt(O[m][0])&&-1!==d)z.name=D.toLowerCase,++L,I=!0;else{if(z.name=D.toLowerCase,I&&L>0){void 0===x[S]&&(x[S]=[]);var N=[L,parseInt(O[m][0])];x[S].push(N),L=0}I=!1}void 0===o.icn3d.chainsSeq[M]&&(o.icn3d.chainsSeq[M]=[]),void 0===o.icn3d.chainsAnno[M]&&(o.icn3d.chainsAnno[M]=[]),void 0===o.icn3d.chainsAnno[M][0]&&(o.icn3d.chainsAnno[M][0]=[]),void 0===o.icn3d.chainsAnno[M][1]&&(o.icn3d.chainsAnno[M][1]=[]);var q="";z.resi%10===0&&(q=z.resi.toString);var j="-";o.icn3d.chainsSeq[M].push(z),o.icn3d.chainsAnno[M][0].push(q),o.icn3d.chainsAnno[M][1].push(j),d=parseInt(O[m][0])}}var P,F={},B="",V="",G="",U="",W="",Y="",X=-999;d=0;var C,Z=0,K=!0,Q=[],J="",ee="";for(var m in c){++l,F[m]=l;var ie=c[m];ie.serial=l;var te;if("mmdbid"===t||"mmcifid"===t?te=i:"align"===t&&(te=h[l]),te!==ee&&(Q=[]),void 0!==ie.chain||"mmdbid"!==t&&"align"!==t)ie.chain=""===ie.chain?"Misc":ie.chain;else if("mmdbid"===t)if(C=ie.ids.m,void 0!==E[C])ie.chain=E[C];else{C!==J&&Q.push(ie.resi);var ne;ne=$.inArray(ie.resi,Q)===Q.length-1?"Misc":"Misc2",ie.chain=ne}else if("align"===t)if(C=ie.ids.m,void 0!==_[te+"_"+C])ie.chain=_[te+"_"+C];else{C!==J&&Q.push(ie.resi);var ne;ne=$.inArray(ie.resi,Q)===Q.length-1?"Misc":"Misc2",ie.chain=ne}void 0!==ie.color&&(ie.color=new THREE.Color(ie.color)),ie.coord=new THREE.Vector3(ie.coord.x,ie.coord.y,ie.coord.z),("mmdbid"===t||"align"===t)&&(ie.structure=te),U=ie.structure,W=U+"_"+ie.chain,W!==V&&(Z=0,d=0);var oe=o.icn3d.residueName2Abbr(ie.resn.substr(0,3));if(ie.resi=parseInt(ie.resi),"mmdbid"===t){if(P=ie.resi,ie.resi!==X&&ie.resi!==X+1&&void 0!==x[ie.chain]&&void 0!==x[ie.chain][Z]&&ie.resi===x[ie.chain][Z][1]){var se=x[ie.chain][Z][0];d+=se,++Z}ie.resi!==X||C!==J?ie.resi=d+1:ie.resi=d,X=P}o.icn3d.secondaries[ie.structure+"_"+ie.chain+"_"+ie.resi]=j,s.min(ie.coord),r.max(ie.coord),a.add(ie.coord),"p"===ie.mt||"n"===ie.mt?("p"===ie.mt?(o.icn3d.proteins[l]=1,"CA"===ie.name&&(o.icn3d.calphas[l]=1),"N"!==ie.name&&"CA"!==ie.name&&"C"!==ie.name&&"O"!==ie.name&&(o.icn3d.sidechains[l]=1)):"n"===ie.mt&&(o.icn3d.nucleotides[l]=1,"P"==ie.name&&(o.icn3d.nucleotidesP[l]=1)),o.icn3d.het=!1):"s"===ie.mt?(o.icn3d.water[l]=1,o.icn3d.het=!0):"l"===ie.mt&&(ie.elem===ie.resn?o.icn3d.ions[l]=1:o.icn3d.ligands[l]=1,o.icn3d.het=!0)," "!==ie.resn.charAt(0)&&" "===ie.resn.charAt(1)&&(ie.resn=ie.resn.charAt(0)),"HOH"==ie.resn&&(o.icn3d.water[l]=1),o.icn3d.atoms[l]=ie,o.icn3d.displayAtoms[l]=1,o.icn3d.highlightAtoms[l]=1;var M=ie.structure+"_"+ie.chain;void 0===o.icn3d.chains[M]&&(o.icn3d.chains[M]={}),o.icn3d.chains[M][l]=1;var re=ie.structure+"_"+ie.chain+"_"+ie.resi;void 0===o.icn3d.residues[re]&&(o.icn3d.residues[re]={}),o.icn3d.residues[re][l]=1,Y=W+"_"+ie.resi,Y!==G&&W!==V&&(K=!0,1!==l&&(void 0===o.icn3d.structures[B]&&(o.icn3d.structures[B]=[]),o.icn3d.structures[B].push(V))),o.icn3d.residueId2Name[re]=oe;var j="-";if("helix"===ie.ss?j="H":"sheet"===ie.ss?j="E":"coil"===ie.ss?j="c":!ie.het&&o.icn3d.residueColors.hasOwnProperty(ie.resn.toUpperCase)&&(j="c"),ie.resi!=d||C!=J){if(void 0===o.icn3d.chainsSeq[M]&&(o.icn3d.chainsSeq[M]=[],K=!1),void 0===o.icn3d.chainsAnno[M]&&(o.icn3d.chainsAnno[M]=[]),void 0===o.icn3d.chainsAnno[M][0]&&(o.icn3d.chainsAnno[M][0]=[]),void 0===o.icn3d.chainsAnno[M][1]&&(o.icn3d.chainsAnno[M][1]=[]),void 0===o.icn3d.chainsAnnoTitle[M]&&(o.icn3d.chainsAnnoTitle[M]=[]),void 0===o.icn3d.chainsAnnoTitle[M][0]&&(o.icn3d.chainsAnnoTitle[M][0]=[]),void 0===o.icn3d.chainsAnnoTitle[M][1]&&(o.icn3d.chainsAnnoTitle[M][1]=[]),"mmdbid"!==t&&"mmcifid"!==t||!K||void 0===o.icn3d.chainsSeq[M][ie.resi-1]){var z={};z.resi=ie.resi,z.name=oe;var q="";ie.resi%10===0&&(q=ie.resi.toString),o.icn3d.chainsSeq[M].push(z),o.icn3d.chainsAnno[M][0].push(q),o.icn3d.chainsAnno[M][1].push(j)}else o.icn3d.chainsSeq[M][ie.resi-1].name=oe,o.icn3d.chainsAnno[M][1][ie.resi-1]=j;o.icn3d.chainsAnnoTitle[M][0].push(""),o.icn3d.chainsAnnoTitle[M][1].push("SS")}d=ie.resi,B=U,V=W,G=Y,J=C,ee=te}if(e.atoms={},void 0===o.icn3d.structures[U]&&(o.icn3d.structures[U]=[]),o.icn3d.structures[U].push(W),"mmcifid"!==t)for(var m in o.icn3d.atoms)for(var ae=void 0===o.icn3d.atoms[m].bonds?0:o.icn3d.atoms[m].bonds.length,v=0;ae>v;++v)o.icn3d.atoms[m].bonds[v]=F[o.icn3d.atoms[m].bonds[v]];if(o.icn3d.cnt=l,o.icn3d.pmin=s,o.icn3d.pmax=r,o.icn3d.maxD=r.distanceTo(s),o.icn3d.center=a.multiplyScalar(1/o.icn3d.cnt),o.icn3d.maxD<25&&(o.icn3d.maxD=25),o.icn3d.oriMaxD=o.icn3d.maxD,o.icn3d.oriCenter=o.icn3d.center.clone,"align"===t&&void 0!==n){for(var ce={},le=e.aligned_structures[0].pdbid,de=e.aligned_structures[1].pdbid,he=le+"_cons",ue=le+"_ncons",pe=le+"_nalign",me=de+"_cons",ge=de+"_ncons",fe=de+"_nalign",ve={},be={},ye={},Ee={},_e={},we={},m=0,g=n.length;g>m;++m){for(var Ce=n[m][0],Se=Ce.mid,ke=_[le+"_"+Se],Re=le+"_"+ke,Te={},He=Ce.mseq.length,Ae=-1,v=0,xe=Ce.mseq.length;xe>v;++v){var Oe=Ce.mseq[v][1],$e="~"===Ce.mseq[v][2]?"-":Ce.mseq[v][2];$e=$e.toUpperCase;var Me=Ce.mseq[v][3];1==Me&&(He>v&&(He=v),v>Ae&&(Ae=v)),Te[v]={resi:Oe,resn:$e,aligned:Me}}Ce=n[m][1];var Le=Ce.sid,Ie=_[de+"_"+Le],De=de+"_"+Ie;void 0===o.icn3d.alignChainsAnnoTitle[Re]&&(o.icn3d.alignChainsAnnoTitle[Re]=[]),void 0===o.icn3d.alignChainsAnnoTitle[Re][0]&&(o.icn3d.alignChainsAnnoTitle[Re][0]=[]),void 0===o.icn3d.alignChainsAnnoTitle[Re][1]&&(o.icn3d.alignChainsAnnoTitle[Re][1]=[]),void 0===o.icn3d.alignChainsAnnoTitle[Re][2]&&(o.icn3d.alignChainsAnnoTitle[Re][2]=[]),void 0===o.icn3d.alignChainsAnnoTitle[Re][3]&&(o.icn3d.alignChainsAnnoTitle[Re][3]=[]),void 0===o.icn3d.alignChainsAnnoTitle[Re][4]&&(o.icn3d.alignChainsAnnoTitle[Re][4]=[]),void 0===o.icn3d.alignChainsAnnoTitle[Re][5]&&(o.icn3d.alignChainsAnnoTitle[Re][5]=[]),o.icn3d.alignChainsAnnoTitle[Re][0].push("SS"),o.icn3d.alignChainsAnnoTitle[Re][1].push(""),o.icn3d.alignChainsAnnoTitle[Re][2].push(""),o.icn3d.alignChainsAnnoTitle[Re][3].push(De),o.icn3d.alignChainsAnnoTitle[Re][4].push(Re),o.icn3d.alignChainsAnnoTitle[Re][5].push("");for(var ze=1,v=He;Ae>=v;++v){var Oe=Ce.sseq[v][1],$e="~"===Ce.sseq[v][2]?"-":Ce.sseq[v][2];$e=$e.toUpperCase;var A,Ne,Me=Te[v].aligned+Ce.sseq[v][3];2===Me?(Te[v].resn===$e?(A="#FF0000",Ne="icn3d-cons",ve[Re+"_"+Te[v].resi]=1,Ee[De+"_"+Oe]=1):(A="#0000FF",Ne="icn3d-ncons",be[Re+"_"+Te[v].resi]=1,_e[De+"_"+Oe]=1),ce=o.icn3d.unionHash(ce,o.icn3d.residues[Re+"_"+Te[v].resi]),ce=o.icn3d.unionHash(ce,o.icn3d.residues[De+"_"+Oe])):(A=o.GREY8,Ne="icn3d-nalign",ye[Re+"_"+Te[v].resi]=1,we[De+"_"+Oe]=1),void 0===o.icn3d.alignChainsSeq[Re]&&(o.icn3d.alignChainsSeq[Re]=[]);var z={};z.mmdbid=le,z.chain=ke,z.resi=Te[v].resi,z.resn=""===z.resi||"icn3d-nalign"===Ne?Te[v].resn.toLowerCase:Te[v].resn,z.aligned=Me,z.color=""===z.resi?o.GREYC:A,z["class"]=Ne,o.icn3d.alignChainsSeq[Re].push(z),""!==Te[v].resi&&(void 0===o.icn3d.alignChains[Re]&&(o.icn3d.alignChains[Re]={}),$.extend(o.icn3d.alignChains[Re],o.icn3d.residues[Re+"_"+Te[v].resi])),void 0===o.icn3d.alignChainsSeq[De]&&(o.icn3d.alignChainsSeq[De]=[]),z={},z.mmdbid=de,z.chain=Ie,z.resi=Oe,z.resn=""===z.resi||"icn3d-nalign"===Ne?$e.toLowerCase:$e,z.aligned=Me,z.color=""===z.resi?o.GREYC:A,z["class"]=Ne,o.icn3d.alignChainsSeq[De].push(z),""!==z.resi&&(void 0===o.icn3d.alignChains[De]&&(o.icn3d.alignChains[De]={}),$.extend(o.icn3d.alignChains[De],o.icn3d.residues[De+"_"+Oe])),void 0===o.icn3d.alignChainsAnno[Re]&&(o.icn3d.alignChainsAnno[Re]=[]),void 0===o.icn3d.alignChainsAnno[Re][0]&&(o.icn3d.alignChainsAnno[Re][0]=[]),void 0===o.icn3d.alignChainsAnno[Re][1]&&(o.icn3d.alignChainsAnno[Re][1]=[]),void 0===o.icn3d.alignChainsAnno[Re][2]&&(o.icn3d.alignChainsAnno[Re][2]=[]),v===He&&(void 0===o.icn3d.alignChainsAnno[Re][3]&&(o.icn3d.alignChainsAnno[Re][3]=[]),void 0===o.icn3d.alignChainsAnno[Re][4]&&(o.icn3d.alignChainsAnno[Re][4]=[]),void 0===o.icn3d.alignChainsAnno[Re][5]&&(o.icn3d.alignChainsAnno[Re][5]=[]),o.icn3d.alignChainsAnno[Re][3].push(o.icn3d.pdbid_chain2title[De]),o.icn3d.alignChainsAnno[Re][4].push(o.icn3d.pdbid_chain2title[Re]),o.icn3d.alignChainsAnno[Re][5].push(""));var re=Re+"_"+Te[v].resi,qe=o.icn3d.secondaries[re];void 0!==qe?o.icn3d.alignChainsAnno[Re][0].push(qe):o.icn3d.alignChainsAnno[Re][0].push("-");var je=".";ze%5===0&&(je="*"),ze%10===0&&(je="|"),o.icn3d.alignChainsAnno[Re][1].push(je);var q="";ze%10===0&&(q=ze.toString),o.icn3d.alignChainsAnno[Re][2].push(q),++ze}}o.bFullUi&&(o.selectResidueList(ve,he,he),o.selectResidueList(Ee,me,me),o.selectResidueList(be,ue,ue),o.selectResidueList(_e,ge,ge),o.selectResidueList(ye,pe,pe),o.selectResidueList(we,fe,fe));var A=new THREE.Color(o.GREYB);for(var m in o.icn3d.atoms)ce.hasOwnProperty(m)||(o.icn3d.atoms[m].color=A);n={}}o.showTitle,e={}},iCn3DUI.prototype.openDialogHalfWindow=function(e,i,t,n){var o=this,s=!1;o.resizeCanvas(o.WIDTH-t-o.LESSWIDTH,o.HEIGHT-o.LESSHEIGHT,n),height=s?"auto":o.HEIGHT-o.LESSHEIGHT-o.EXTRAHEIGHT,width=s?"auto":t;var r;r=o.cfg.showmenu?{my:"left top",at:"right top+80",of:"#"+o.pre+"viewer",collision:"none"}:{my:"left top",at:"right top",of:"#"+o.pre+"viewer",collision:"none"},o.cfg.resize=!1,window.dialog=$("#"+e).dialog({autoOpen:!0,title:i,height:height,width:width,modal:!1,position:r,close:function(i){var t=$("#"+o.pre+"dl_selectresidues").hasClass("ui-dialog-content")?!0:!1,n=$("#"+o.pre+"dl_alignment").hasClass("ui-dialog-content")?!0:!1,s=$("#"+o.pre+"dl_filter").hasClass("ui-dialog-content")?!0:!1;(e!==o.pre+"dl_selectresidues"||n&&$("#"+o.pre+"dl_alignment").dialog("isOpen")!==!1||s&&$("#"+o.pre+"dl_filter").dialog("isOpen")!==!1)&&(e!==o.pre+"dl_alignment"||t&&$("#"+o.pre+"dl_selectresidues").dialog("isOpen")!==!1||s&&$("#"+o.pre+"dl_filter").dialog("isOpen")!==!1)&&(e!==o.pre+"dl_filter"||n&&$("#"+o.pre+"dl_alignment").dialog("isOpen")!==!1||t&&$("#"+o.pre+"dl_selectresidues").dialog("isOpen")!==!1)||o.resizeCanvas(o.WIDTH-o.LESSWIDTH,o.HEIGHT-o.LESSHEIGHT,!0)}})},iCn3DUI.prototype.openDialog=function(e,i){var t=this,n=400,o=150,s=!1;if(e===t.pre+"dl_selectresidues"||e===t.pre+"dl_alignment"||e===t.pre+"dl_filter"){var r=.5*t.WIDTH>250?250:.5*(t.WIDTH-t.LESSWIDTH),a=e===t.pre+"dl_filter"?r:.5*(t.WIDTH-t.LESSWIDTH);if(t.WIDTH-t.LESSWIDTH>=t.HEIGHT-t.LESSHEIGHT-t.EXTRAHEIGHT)t.openDialogHalfWindow(e,i,a,!0);else{t.resizeCanvas(t.WIDTH-t.LESSWIDTH,.5*(t.HEIGHT-t.LESSHEIGHT-t.EXTRAHEIGHT)+t.EXTRAHEIGHT,!0),o=s?"auto":.5*(t.HEIGHT-t.LESSHEIGHT-t.EXTRAHEIGHT),n=s?"auto":t.WIDTH-t.LESSWIDTH;var c={my:"left top",at:"left bottom+32",of:"#"+t.pre+"canvas",collision:"none"};window.dialog=$("#"+e).dialog({autoOpen:!0,title:i,height:o,width:n,modal:!1,position:c,close:function(i){var n=$("#"+t.pre+"dl_selectresidues").hasClass("ui-dialog-content")?!0:!1,o=$("#"+t.pre+"dl_alignment").hasClass("ui-dialog-content")?!0:!1,s=$("#"+t.pre+"dl_filter").hasClass("ui-dialog-content")?!0:!1;(e!==t.pre+"dl_selectresidues"||o&&$("#"+t.pre+"dl_alignment").dialog("isOpen")!==!1||s&&$("#"+t.pre+"dl_filter").dialog("isOpen")!==!1)&&(e!==t.pre+"dl_alignment"||n&&$("#"+t.pre+"dl_selectresidues").dialog("isOpen")!==!1||s&&$("#"+t.pre+"dl_filter").dialog("isOpen")!==!1)&&(e!==t.pre+"dl_filter"||o&&$("#"+t.pre+"dl_alignment").dialog("isOpen")!==!1||n&&$("#"+t.pre+"dl_selectresidues").dialog("isOpen")!==!1)||t.resizeCanvas(t.WIDTH-t.LESSWIDTH,t.HEIGHT-t.LESSHEIGHT,!0)}})}}else{o="auto",n="auto";var c;c=t.isMobile?{my:"left top",at:"left bottom-50",of:"#"+t.pre+"canvas",collision:"none"}:{my:"left top",at:"left top+50",of:"#"+t.pre+"canvas",collision:"none"},window.dialog=$("#"+e).dialog({autoOpen:!0,title:i,height:o,width:n,modal:!1,position:c})}$(".ui-dialog .ui-button span").removeClass("ui-icon-closethick").addClass("ui-icon-close")},iCn3DUI.prototype.resizeCanvas=function(e,i,t,n){var o=this;if(void 0!==t&&t||void 0!==o.cfg.resize&&o.cfg.resize){var s=parseInt(i)-o.EXTRAHEIGHT;$("#"+o.pre+"canvas").width(e).height(s),$("#"+o.pre+"viewer").width(e).height(i),o.icn3d.setWidthHeight(e,s),(void 0===n||n)&&o.icn3d.draw}},iCn3DUI.prototype.windowResize=function{var e=this;void 0!==e.cfg.resize&&e.cfg.resize&&!e.isMobile&&$(window).resize(function{e.WIDTH=$(window).width,e.HEIGHT=$(window).height;var i=e.WIDTH-e.LESSWIDTH_RESIZE,t=e.HEIGHT-e.LESSHEIGHT;void 0!==e.icn3d&&e.resizeCanvas(i,t)})},iCn3DUI.prototype.setViewerWidthHeight=function{var e=this;e.WIDTH=$(window).width,e.HEIGHT=$(window).height;var i=$("#"+e.pre+"viewer").width,t=$("#"+e.pre+"viewer").height;i&&e.WIDTH>i&&(e.WIDTH=i),t&&e.height>t&&(e.height=t),e.isMac&&e.isMobile&&(e.WIDTH<e.MENU_WIDTH&&(e.WIDTH=e.MENU_WIDTH), e.HEIGHT=$(window).height/$(window).width*e.MENU_WIDTH),-1===e.cfg.width.toString.indexOf("%")&&(e.WIDTH=parseInt(e.cfg.width)+e.LESSWIDTH),-1===e.cfg.height.toString.indexOf("%")&&(e.HEIGHT=parseInt(e.cfg.height)+e.EXTRAHEIGHT+e.LESSHEIGHT)};

$( document ).ready(function {         var cfg = {              divid: 'icn3dwrap',              width: 200,              height: 200,              resize: true,              rotate: 'right',              showmenu: false          };          cfg['mmdbid'] = '2por';

var icn3dui = new iCn3DUI(cfg);

//communicate with the 3D viewer with chained functions $.when(icn3dui.show3DStructure).then(function {              //icn3dui.setOption('color', 'cyan');          }); });