text: (function(e,t){function n(e){var t=dt[e]={};return Y.each(e.split(tt),function(e,n){t[n]=!0}),t}function r(e,n,r){if(r===t&&e.nodeType===1){var i="data-"+n.replace(mt,"-$1").toLowerCase();r=e.getAttribute(i);if(typeof r=="string"){try{r=r==="true"?!0:r==="false"?!1:r==="null"?null:+r+""===r?+r:vt.test(r)?Y.parseJSON(r):r}catch(s){}Y.data(e,n,r)}else r=t}return r}function i(e){var t;for(t in e){if(t==="data"&&Y.isEmptyObject(e[t]))continue;if(t!=="toJSON")return!1}return!0}function s(){return!1}function o(){return!0}function u(e){return!e||!e.parentNode||e.parentNode.nodeType===11}function a(e,t){do e=e[t];while(e&&e.nodeType!==1);return e}function f(e,t,n){t=t||0;if(Y.isFunction(t))return Y.grep(e,function(e,r){var i=!!t.call(e,r,e);return i===n});if(t.nodeType)return Y.grep(e,function(e,r){return e===t===n});if(typeof t=="string"){var r=Y.grep(e,function(e){return e.nodeType===1});if(Bt.test(t))return Y.filter(t,r,!n);t=Y.filter(t,r)}return Y.grep(e,function(e,r){return Y.inArray(e,t)>=0===n})}function l(e){var t=
  It.split("|"),n=e.createDocumentFragment();if(n.createElement)while(t.length)n.createElement(t.pop());return n}function c(e,t){return e.getElementsByTagName(t)[0]||e.appendChild(e.ownerDocument.createElement(t))}function h(e,t){if(t.nodeType!==1||!Y.hasData(e))return;var n,r,i,s=Y._data(e),o=Y._data(t,s),u=s.events;if(u){delete o.handle,o.events={};for(n in u)for(r=0,i=u[n].length;r<i;r++)Y.event.add(t,n,u[n][r])}o.data&&(o.data=Y.extend({},o.data))}function p(e,t){var n;if(t.nodeType!==1)return;t.clearAttributes&&t.clearAttributes(),t.mergeAttributes&&t.mergeAttributes(e),n=t.nodeName.toLowerCase(),n==="object"?(t.parentNode&&(t.outerHTML=e.outerHTML),Y.support.html5Clone&&e.innerHTML&&!Y.trim(t.innerHTML)&&(t.innerHTML=e.innerHTML)):n==="input"&&Kt.test(e.type)?(t.defaultChecked=t.checked=e.checked,t.value!==e.value&&(t.value=e.value)):n==="option"?t.selected=e.defaultSelected:n==="input"||n==="textarea"?t.defaultValue=e.defaultValue:n==="script"&&t.text!==e.text&&(t.text=e.text),t.removeAttribute(Y.expando)
  }function d(e){return typeof e.getElementsByTagName!="undefined"?e.getElementsByTagName("*"):typeof e.querySelectorAll!="undefined"?e.querySelectorAll("*"):[]}function v(e){Kt.test(e.type)&&(e.defaultChecked=e.checked)}function m(e,t){if(t in e)return t;var n=t.charAt(0).toUpperCase()+t.slice(1),r=t,i=yn.length;while(i--){t=yn[i]+n;if(t in e)return t}return r}function g(e,t){return e=t||e,Y.css(e,"display")==="none"||!Y.contains(e.ownerDocument,e)}function y(e,t){var n,r,i=[],s=0,o=e.length;for(;s<o;s++){n=e[s];if(!n.style)continue;i[s]=Y._data(n,"olddisplay"),t?(!i[s]&&n.style.display==="none"&&(n.style.display=""),n.style.display===""&&g(n)&&(i[s]=Y._data(n,"olddisplay",S(n.nodeName)))):(r=nn(n,"display"),!i[s]&&r!=="none"&&Y._data(n,"olddisplay",r))}for(s=0;s<o;s++){n=e[s];if(!n.style)continue;if(!t||n.style.display==="none"||n.style.display==="")n.style.display=t?i[s]||"":"none"}return e}function b(e,t,n){var r=cn.exec(t);return r?Math.max(0,r[1]-(n||0))+(r[2]||"px"):t}function w(e,t,n,r){var i=n===(r?"border"
  :"content")?4:t==="width"?1:0,s=0;for(;i<4;i+=2)n==="margin"&&(s+=Y.css(e,n+gn[i],!0)),r?(n==="content"&&(s-=parseFloat(nn(e,"padding"+gn[i]))||0),n!=="margin"&&(s-=parseFloat(nn(e,"border"+gn[i]+"Width"))||0)):(s+=parseFloat(nn(e,"padding"+gn[i]))||0,n!=="padding"&&(s+=parseFloat(nn(e,"border"+gn[i]+"Width"))||0));return s}function E(e,t,n){var r=t==="width"?e.offsetWidth:e.offsetHeight,i=!0,s=Y.support.boxSizing&&Y.css(e,"boxSizing")==="border-box";if(r<=0||r==null){r=nn(e,t);if(r<0||r==null)r=e.style[t];if(hn.test(r))return r;i=s&&(Y.support.boxSizingReliable||r===e.style[t]),r=parseFloat(r)||0}return r+w(e,t,n||(s?"border":"content"),i)+"px"}function S(e){if(dn[e])return dn[e];var t=Y("<"+e+">").appendTo(R.body),n=t.css("display");t.remove();if(n==="none"||n===""){rn=R.body.appendChild(rn||Y.extend(R.createElement("iframe"),{frameBorder:0,width:0,height:0}));if(!sn||!rn.createElement)sn=(rn.contentWindow||rn.contentDocument).document,sn.write("<!doctype html><html><body>"),sn.close();t=sn.body.appendChild(
  sn.createElement(e)),n=nn(t,"display"),R.body.removeChild(rn)}return dn[e]=n,n}function x(e,t,n,r){var i;if(Y.isArray(t))Y.each(t,function(t,i){n||En.test(e)?r(e,i):x(e+"["+(typeof i=="object"?t:"")+"]",i,n,r)});else if(!n&&Y.type(t)==="object")for(i in t)x(e+"["+i+"]",t[i],n,r);else r(e,t)}function T(e){return function(t,n){typeof t!="string"&&(n=t,t="*");var r,i,s,o=t.toLowerCase().split(tt),u=0,a=o.length;if(Y.isFunction(n))for(;u<a;u++)r=o[u],s=/^\+/.test(r),s&&(r=r.substr(1)||"*"),i=e[r]=e[r]||[],i[s?"unshift":"push"](n)}}function N(e,n,r,i,s,o){s=s||n.dataTypes[0],o=o||{},o[s]=!0;var u,a=e[s],f=0,l=a?a.length:0,c=e===jn;for(;f<l&&(c||!u);f++)u=a[f](n,r,i),typeof u=="string"&&(!c||o[u]?u=t:(n.dataTypes.unshift(u),u=N(e,n,r,i,u,o)));return(c||!u)&&!o["*"]&&(u=N(e,n,r,i,"*",o)),u}function C(e,n){var r,i,s=Y.ajaxSettings.flatOptions||{};for(r in n)n[r]!==t&&((s[r]?e:i||(i={}))[r]=n[r]);i&&Y.extend(!0,e,i)}function k(e,n,r){var i,s,o,u,a=e.contents,f=e.dataTypes,l=e.responseFields;for(s in l)s in r&&(n[l[s]]=
  r[s]);while(f[0]==="*")f.shift(),i===t&&(i=e.mimeType||n.getResponseHeader("content-type"));if(i)for(s in a)if(a[s]&&a[s].test(i)){f.unshift(s);break}if(f[0]in r)o=f[0];else{for(s in r){if(!f[0]||e.converters[s+" "+f[0]]){o=s;break}u||(u=s)}o=o||u}if(o)return o!==f[0]&&f.unshift(o),r[o]}function L(e,t){var n,r,i,s,o=e.dataTypes.slice(),u=o[0],a={},f=0;e.dataFilter&&(t=e.dataFilter(t,e.dataType));if(o[1])for(n in e.converters)a[n.toLowerCase()]=e.converters[n];for(;i=o[++f];)if(i!=="*"){if(u!=="*"&&u!==i){n=a[u+" "+i]||a["* "+i];if(!n)for(r in a){s=r.split(" ");if(s[1]===i){n=a[u+" "+s[0]]||a["* "+s[0]];if(n){n===!0?n=a[r]:a[r]!==!0&&(i=s[0],o.splice(f--,0,i));break}}}if(n!==!0)if(n&&e["throws"])t=n(t);else try{t=n(t)}catch(l){return{state:"parsererror",error:n?l:"No conversion from "+u+" to "+i}}}u=i}return{state:"success",data:t}}function A(){try{return new e.XMLHttpRequest}catch(t){}}function O(){try{return new e.ActiveXObject("Microsoft.XMLHTTP")}catch(t){}}function M(){return setTimeout(function(){Jn=t},0)
  ,Jn=Y.now()}function _(e,t){Y.each(t,function(t,n){var r=(er[t]||[]).concat(er["*"]),i=0,s=r.length;for(;i<s;i++)if(r[i].call(e,t,n))return})}function D(e,t,n){var r,i=0,s=0,o=Zn.length,u=Y.Deferred().always(function(){delete a.elem}),a=function(){var t=Jn||M(),n=Math.max(0,f.startTime+f.duration-t),r=1-(n/f.duration||0),i=0,s=f.tweens.length;for(;i<s;i++)f.tweens[i].run(r);return u.notifyWith(e,[f,r,n]),r<1&&s?n:(u.resolveWith(e,[f]),!1)},f=u.promise({elem:e,props:Y.extend({},t),opts:Y.extend(!0,{specialEasing:{}},n),originalProperties:t,originalOptions:n,startTime:Jn||M(),duration:n.duration,tweens:[],createTween:function(t,n,r){var i=Y.Tween(e,f.opts,t,n,f.opts.specialEasing[t]||f.opts.easing);return f.tweens.push(i),i},stop:function(t){var n=0,r=t?f.tweens.length:0;for(;n<r;n++)f.tweens[n].run(1);return t?u.resolveWith(e,[f,t]):u.rejectWith(e,[f,t]),this}}),l=f.props;P(l,f.opts.specialEasing);for(;i<o;i++){r=Zn[i].call(f,e,l,f.opts);if(r)return r}return _(f,l),Y.isFunction(f.opts.start)&&f.opts.start.call(
  e,f),Y.fx.timer(Y.extend(a,{anim:f,queue:f.opts.queue,elem:e})),f.progress(f.opts.progress).done(f.opts.done,f.opts.complete).fail(f.opts.fail).always(f.opts.always)}function P(e,t){var n,r,i,s,o;for(n in e){r=Y.camelCase(n),i=t[r],s=e[n],Y.isArray(s)&&(i=s[1],s=e[n]=s[0]),n!==r&&(e[r]=s,delete e[n]),o=Y.cssHooks[r];if(o&&"expand"in o){s=o.expand(s),delete e[r];for(n in s)n in e||(e[n]=s[n],t[n]=i)}else t[r]=i}}function H(e,t,n){var r,i,s,o,u,a,f,l,c=this,h=e.style,p={},d=[],v=e.nodeType&&g(e);n.queue||(f=Y._queueHooks(e,"fx"),f.unqueued==null&&(f.unqueued=0,l=f.empty.fire,f.empty.fire=function(){f.unqueued||l()}),f.unqueued++,c.always(function(){c.always(function(){f.unqueued--,Y.queue(e,"fx").length||f.empty.fire()})})),e.nodeType===1&&("height"in t||"width"in t)&&(n.overflow=[h.overflow,h.overflowX,h.overflowY],Y.css(e,"display")==="inline"&&Y.css(e,"float")==="none"&&(!Y.support.inlineBlockNeedsLayout||S(e.nodeName)==="inline"?h.display="inline-block":h.zoom=1)),n.overflow&&(h.overflow="hidden",Y.support.shrinkWrapBlocks||
  c.done(function(){h.overflow=n.overflow[0],h.overflowX=n.overflow[1],h.overflowY=n.overflow[2]}));for(r in t){s=t[r];if(Qn.exec(s)){delete t[r];if(s===(v?"hide":"show"))continue;d.push(r)}}o=d.length;if(o){u=Y._data(e,"fxshow")||Y._data(e,"fxshow",{}),v?Y(e).show():c.done(function(){Y(e).hide()}),c.done(function(){var t;Y.removeData(e,"fxshow",!0);for(t in p)Y.style(e,t,p[t])});for(r=0;r<o;r++)i=d[r],a=c.createTween(i,v?u[i]:0),p[i]=u[i]||Y.style(e,i),i in u||(u[i]=a.start,v&&(a.end=a.start,a.start=i==="width"||i==="height"?1:0))}}function B(e,t,n,r,i){return new B.prototype.init(e,t,n,r,i)}function j(e,t){var n,r={height:e},i=0;t=t?1:0;for(;i<4;i+=2-t)n=gn[i],r["margin"+n]=r["padding"+n]=e;return t&&(r.opacity=r.width=e),r}function F(e){return Y.isWindow(e)?e:e.nodeType===9?e.defaultView||e.parentWindow:!1}var I,q,R=e.document,U=e.location,z=e.navigator,W=e.jQuery,X=e.$,V=Array.prototype.push,$=Array.prototype.slice,J=Array.prototype.indexOf,K=Object.prototype.toString,Q=Object.prototype.hasOwnProperty,G=String
  .prototype.trim,Y=function(e,t){return new Y.fn.init(e,t,I)},Z=/[\-+]?(?:\d*\.|)\d+(?:[eE][\-+]?\d+|)/.source,et=/\S/,tt=/\s+/,nt=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,rt=/^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/,it=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,st=/^[\],:{}\s]*$/,ot=/(?:^|:|,)(?:\s*\[)+/g,ut=/\\(?:["\\\/bfnrt]|u[\da-fA-F]{4})/g,at=/"[^"\\\r\n]*"|true|false|null|-?(?:\d\d*\.|)\d+(?:[eE][\-+]?\d+|)/g,ft=/^-ms-/,lt=/-([\da-z])/gi,ct=function(e,t){return(t+"").toUpperCase()},ht=function(){R.addEventListener?(R.removeEventListener("DOMContentLoaded",ht,!1),Y.ready()):R.readyState==="complete"&&(R.detachEvent("onreadystatechange",ht),Y.ready())},pt={};Y.fn=Y.prototype={constructor:Y,init:function(e,n,r){var i,s,o,u;if(!e)return this;if(e.nodeType)return this.context=this[0]=e,this.length=1,this;if(typeof e=="string"){e.charAt(0)==="<"&&e.charAt(e.length-1)===">"&&e.length>=3?i=[null,e,null]:i=rt.exec(e);if(i&&(i[1]||!n)){if(i[1])return n=n instanceof Y?n[0]:n,u=n&&n.nodeType?n.ownerDocument||n:R,e=Y.parseHTML(i[1],u
  ,!0),it.test(i[1])&&Y.isPlainObject(n)&&this.attr.call(e,n,!0),Y.merge(this,e);s=R.getElementById(i[2]);if(s&&s.parentNode){if(s.id!==i[2])return r.find(e);this.length=1,this[0]=s}return this.context=R,this.selector=e,this}return!n||n.jquery?(n||r).find(e):this.constructor(n).find(e)}return Y.isFunction(e)?r.ready(e):(e.selector!==t&&(this.selector=e.selector,this.context=e.context),Y.makeArray(e,this))},selector:"",jquery:"1.8.1",length:0,size:function(){return this.length},toArray:function(){return $.call(this)},get:function(e){return e==null?this.toArray():e<0?this[this.length+e]:this[e]},pushStack:function(e,t,n){var r=Y.merge(this.constructor(),e);return r.prevObject=this,r.context=this.context,t==="find"?r.selector=this.selector+(this.selector?" ":"")+n:t&&(r.selector=this.selector+"."+t+"("+n+")"),r},each:function(e,t){return Y.each(this,e,t)},ready:function(e){return Y.ready.promise().done(e),this},eq:function(e){return e=+e,e===-1?this.slice(e):this.slice(e,e+1)},first:function(){return this.eq(0)},last
  :function(){return this.eq(-1)},slice:function(){return this.pushStack($.apply(this,arguments),"slice",$.call(arguments).join(","))},map:function(e){return this.pushStack(Y.map(this,function(t,n){return e.call(t,n,t)}))},end:function(){return this.prevObject||this.constructor(null)},push:V,sort:[].sort,splice:[].splice},Y.fn.init.prototype=Y.fn,Y.extend=Y.fn.extend=function(){var e,n,r,i,s,o,u=arguments[0]||{},a=1,f=arguments.length,l=!1;typeof u=="boolean"&&(l=u,u=arguments[1]||{},a=2),typeof u!="object"&&!Y.isFunction(u)&&(u={}),f===a&&(u=this,--a);for(;a<f;a++)if((e=arguments[a])!=null)for(n in e){r=u[n],i=e[n];if(u===i)continue;l&&i&&(Y.isPlainObject(i)||(s=Y.isArray(i)))?(s?(s=!1,o=r&&Y.isArray(r)?r:[]):o=r&&Y.isPlainObject(r)?r:{},u[n]=Y.extend(l,o,i)):i!==t&&(u[n]=i)}return u},Y.extend({noConflict:function(t){return e.$===Y&&(e.$=X),t&&e.jQuery===Y&&(e.jQuery=W),Y},isReady:!1,readyWait:1,holdReady:function(e){e?Y.readyWait++:Y.ready(!0)},ready:function(e){if(e===!0?--Y.readyWait:Y.isReady)return;if(!R.body
  )return setTimeout(Y.ready,1);Y.isReady=!0;if(e!==!0&&--Y.readyWait>0)return;q.resolveWith(R,[Y]),Y.fn.trigger&&Y(R).trigger("ready").off("ready")},isFunction:function(e){return Y.type(e)==="function"},isArray:Array.isArray||function(e){return Y.type(e)==="array"},isWindow:function(e){return e!=null&&e==e.window},isNumeric:function(e){return!isNaN(parseFloat(e))&&isFinite(e)},type:function(e){return e==null?String(e):pt[K.call(e)]||"object"},isPlainObject:function(e){if(!e||Y.type(e)!=="object"||e.nodeType||Y.isWindow(e))return!1;try{if(e.constructor&&!Q.call(e,"constructor")&&!Q.call(e.constructor.prototype,"isPrototypeOf"))return!1}catch(n){return!1}var r;for(r in e);return r===t||Q.call(e,r)},isEmptyObject:function(e){var t;for(t in e)return!1;return!0},error:function(e){throw new Error(e)},parseHTML:function(e,t,n){var r;return!e||typeof e!="string"?null:(typeof t=="boolean"&&(n=t,t=0),t=t||R,(r=it.exec(e))?[t.createElement(r[1])]:(r=Y.buildFragment([e],t,n?null:[]),Y.merge([],(r.cacheable?Y.clone(r.fragment
  ):r.fragment).childNodes)))},parseJSON:function(t){if(!t||typeof t!="string")return null;t=Y.trim(t);if(e.JSON&&e.JSON.parse)return e.JSON.parse(t);if(st.test(t.replace(ut,"@").replace(at,"]").replace(ot,"")))return(new Function("return "+t))();Y.error("Invalid JSON: "+t)},parseXML:function(n){var r,i;if(!n||typeof n!="string")return null;try{e.DOMParser?(i=new DOMParser,r=i.parseFromString(n,"text/xml")):(r=new ActiveXObject("Microsoft.XMLDOM"),r.async="false",r.loadXML(n))}catch(s){r=t}return(!r||!r.documentElement||r.getElementsByTagName("parsererror").length)&&Y.error("Invalid XML: "+n),r},noop:function(){},globalEval:function(t){t&&et.test(t)&&(e.execScript||function(t){e.eval.call(e,t)})(t)},camelCase:function(e){return e.replace(ft,"ms-").replace(lt,ct)},nodeName:function(e,t){return e.nodeName&&e.nodeName.toUpperCase()===t.toUpperCase()},each:function(e,n,r){var i,s=0,o=e.length,u=o===t||Y.isFunction(e);if(r){if(u){for(i in e)if(n.apply(e[i],r)===!1)break}else for(;s<o;)if(n.apply(e[s++],r)===!1)break}
  else if(u){for(i in e)if(n.call(e[i],i,e[i])===!1)break}else for(;s<o;)if(n.call(e[s],s,e[s++])===!1)break;return e},trim:G&&!G.call("﻿ ")?function(e){return e==null?"":G.call(e)}:function(e){return e==null?"":e.toString().replace(nt,"")},makeArray:function(e,t){var n,r=t||[];return e!=null&&(n=Y.type(e),e.length==null||n==="string"||n==="function"||n==="regexp"||Y.isWindow(e)?V.call(r,e):Y.merge(r,e)),r},inArray:function(e,t,n){var r;if(t){if(J)return J.call(t,e,n);r=t.length,n=n?n<0?Math.max(0,r+n):n:0;for(;n<r;n++)if(n in t&&t[n]===e)return n}return-1},merge:function(e,n){var r=n.length,i=e.length,s=0;if(typeof r=="number")for(;s<r;s++)e[i++]=n[s];else while(n[s]!==t)e[i++]=n[s++];return e.length=i,e},grep:function(e,t,n){var r,i=[],s=0,o=e.length;n=!!n;for(;s<o;s++)r=!!t(e[s],s),n!==r&&i.push(e[s]);return i},map:function(e,n,r){var i,s,o=[],u=0,a=e.length,f=e instanceof Y||a!==t&&typeof a=="number"&&(a>0&&e[0]&&e[a-1]||a===0||Y.isArray(e));if(f)for(;u<a;u++)i=n(e[u],u,r),i!=null&&(o[o.length]=i);else for(s in 
  e)i=n(e[s],s,r),i!=null&&(o[o.length]=i);return o.concat.apply([],o)},guid:1,proxy:function(e,n){var r,i,s;return typeof n=="string"&&(r=e[n],n=e,e=r),Y.isFunction(e)?(i=$.call(arguments,2),s=function(){return e.apply(n,i.concat($.call(arguments)))},s.guid=e.guid=e.guid||s.guid||Y.guid++,s):t},access:function(e,n,r,i,s,o,u){var a,f=r==null,l=0,c=e.length;if(r&&typeof r=="object"){for(l in r)Y.access(e,n,l,r[l],1,o,i);s=1}else if(i!==t){a=u===t&&Y.isFunction(i),f&&(a?(a=n,n=function(e,t,n){return a.call(Y(e),n)}):(n.call(e,i),n=null));if(n)for(;l<c;l++)n(e[l],r,a?i.call(e[l],l,n(e[l],r)):i,u);s=1}return s?e:f?n.call(e):c?n(e[0],r):o},now:function(){return(new Date).getTime()}}),Y.ready.promise=function(t){if(!q){q=Y.Deferred();if(R.readyState==="complete")setTimeout(Y.ready,1);else if(R.addEventListener)R.addEventListener("DOMContentLoaded",ht,!1),e.addEventListener("load",Y.ready,!1);else{R.attachEvent("onreadystatechange",ht),e.attachEvent("onload",Y.ready);var n=!1;try{n=e.frameElement==null&&R.documentElement
  }catch(r){}n&&n.doScroll&&function i(){if(!Y.isReady){try{n.doScroll("left")}catch(e){return setTimeout(i,50)}Y.ready()}}()}}return q.promise(t)},Y.each("Boolean Number String Function Array Date RegExp Object".split(" "),function(e,t){pt["[object "+t+"]"]=t.toLowerCase()}),I=Y(R);var dt={};Y.Callbacks=function(e){e=typeof e=="string"?dt[e]||n(e):Y.extend({},e);var r,i,s,o,u,a,f=[],l=!e.once&&[],c=function(t){r=e.memory&&t,i=!0,a=o||0,o=0,u=f.length,s=!0;for(;f&&a<u;a++)if(f[a].apply(t[0],t[1])===!1&&e.stopOnFalse){r=!1;break}s=!1,f&&(l?l.length&&c(l.shift()):r?f=[]:h.disable())},h={add:function(){if(f){var t=f.length;(function n(t){Y.each(t,function(t,r){var i=Y.type(r);i==="function"&&(!e.unique||!h.has(r))?f.push(r):r&&r.length&&i!=="string"&&n(r)})})(arguments),s?u=f.length:r&&(o=t,c(r))}return this},remove:function(){return f&&Y.each(arguments,function(e,t){var n;while((n=Y.inArray(t,f,n))>-1)f.splice(n,1),s&&(n<=u&&u--,n<=a&&a--)}),this},has:function(e){return Y.inArray(e,f)>-1},empty:function(){return f=
  [],this},disable:function(){return f=l=r=t,this},disabled:function(){return!f},lock:function(){return l=t,r||h.disable(),this},locked:function(){return!l},fireWith:function(e,t){return t=t||[],t=[e,t.slice?t.slice():t],f&&(!i||l)&&(s?l.push(t):c(t)),this},fire:function(){return h.fireWith(this,arguments),this},fired:function(){return!!i}};return h},Y.extend({Deferred:function(e){var t=[["resolve","done",Y.Callbacks("once memory"),"resolved"],["reject","fail",Y.Callbacks("once memory"),"rejected"],["notify","progress",Y.Callbacks("memory")]],n="pending",r={state:function(){return n},always:function(){return i.done(arguments).fail(arguments),this},then:function(){var e=arguments;return Y.Deferred(function(n){Y.each(t,function(t,r){var s=r[0],o=e[t];i[r[1]](Y.isFunction(o)?function(){var e=o.apply(this,arguments);e&&Y.isFunction(e.promise)?e.promise().done(n.resolve).fail(n.reject).progress(n.notify):n[s+"With"](this===i?n:this,[e])}:n[s])}),e=null}).promise()},promise:function(e){return typeof e=="object"?Y.extend
  (e,r):r}},i={};return r.pipe=r.then,Y.each(t,function(e,s){var o=s[2],u=s[3];r[s[1]]=o.add,u&&o.add(function(){n=u},t[e^1][2].disable,t[2][2].lock),i[s[0]]=o.fire,i[s[0]+"With"]=o.fireWith}),r.promise(i),e&&e.call(i,i),i},when:function(e){var t=0,n=$.call(arguments),r=n.length,i=r!==1||e&&Y.isFunction(e.promise)?r:0,s=i===1?e:Y.Deferred(),o=function(e,t,n){return function(r){t[e]=this,n[e]=arguments.length>1?$.call(arguments):r,n===u?s.notifyWith(t,n):--i||s.resolveWith(t,n)}},u,a,f;if(r>1){u=new Array(r),a=new Array(r),f=new Array(r);for(;t<r;t++)n[t]&&Y.isFunction(n[t].promise)?n[t].promise().done(o(t,f,n)).fail(s.reject).progress(o(t,a,u)):--i}return i||s.resolveWith(f,n),s.promise()}}),Y.support=function(){var t,n,r,i,s,o,u,a,f,l,c,h=R.createElement("div");h.setAttribute("className","t"),h.innerHTML="  <link/><table></table><a href='/a'>a</a><input type='checkbox'/>",n=h.getElementsByTagName("*"),r=h.getElementsByTagName("a")[0],r.style.cssText="top:1px;float:left;opacity:.5";if(!n||!n.length||!r)return{};
  i=R.createElement("select"),s=i.appendChild(R.createElement("option")),o=h.getElementsByTagName("input")[0],t={leadingWhitespace:h.firstChild.nodeType===3,tbody:!h.getElementsByTagName("tbody").length,htmlSerialize:!!h.getElementsByTagName("link").length,style:/top/.test(r.getAttribute("style")),hrefNormalized:r.getAttribute("href")==="/a",opacity:/^0.5/.test(r.style.opacity),cssFloat:!!r.style.cssFloat,checkOn:o.value==="on",optSelected:s.selected,getSetAttribute:h.className!=="t",enctype:!!R.createElement("form").enctype,html5Clone:R.createElement("nav").cloneNode(!0).outerHTML!=="<:nav></:nav>",boxModel:R.compatMode==="CSS1Compat",submitBubbles:!0,changeBubbles:!0,focusinBubbles:!1,deleteExpando:!0,noCloneEvent:!0,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableMarginRight:!0,boxSizingReliable:!0,pixelPosition:!1},o.checked=!0,t.noCloneChecked=o.cloneNode(!0).checked,i.disabled=!0,t.optDisabled=!s.disabled;try{delete h.test}catch(p){t.deleteExpando=!1}!h.addEventListener&&h.attachEvent&&h.fireEvent&&(
  h.attachEvent("onclick",c=function(){t.noCloneEvent=!1}),h.cloneNode(!0).fireEvent("onclick"),h.detachEvent("onclick",c)),o=R.createElement("input"),o.value="t",o.setAttribute("type","radio"),t.radioValue=o.value==="t",o.setAttribute("checked","checked"),o.setAttribute("name","t"),h.appendChild(o),u=R.createDocumentFragment(),u.appendChild(h.lastChild),t.checkClone=u.cloneNode(!0).cloneNode(!0).lastChild.checked,t.appendChecked=o.checked,u.removeChild(o),u.appendChild(h);if(h.attachEvent)for(f in{submit:!0,change:!0,focusin:!0})a="on"+f,l=a in h,l||(h.setAttribute(a,"return;"),l=typeof h[a]=="function"),t[f+"Bubbles"]=l;return Y(function(){var n,r,i,s,o="padding:0;margin:0;border:0;display:block;overflow:hidden;",u=R.getElementsByTagName("body")[0];if(!u)return;n=R.createElement("div"),n.style.cssText="visibility:hidden;border:0;width:0;height:0;position:static;top:0;margin-top:1px",u.insertBefore(n,u.firstChild),r=R.createElement("div"),n.appendChild(r),r.innerHTML="<table><tr><td></td><td>t</td></tr></table>"
  ,i=r.getElementsByTagName("td"),i[0].style.cssText="padding:0;margin:0;border:0;display:none",l=i[0].offsetHeight===0,i[0].style.display="",i[1].style.display="none",t.reliableHiddenOffsets=l&&i[0].offsetHeight===0,r.innerHTML="",r.style.cssText="box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;position:absolute;top:1%;",t.boxSizing=r.offsetWidth===4,t.doesNotIncludeMarginInBodyOffset=u.offsetTop!==1,e.getComputedStyle&&(t.pixelPosition=(e.getComputedStyle(r,null)||{}).top!=="1%",t.boxSizingReliable=(e.getComputedStyle(r,null)||{width:"4px"}).width==="4px",s=R.createElement("div"),s.style.cssText=r.style.cssText=o,s.style.marginRight=s.style.width="0",r.style.width="1px",r.appendChild(s),t.reliableMarginRight=!parseFloat((e.getComputedStyle(s,null)||{}).marginRight)),typeof r.style.zoom!="undefined"&&(r.innerHTML="",r.style.cssText=o+"width:1px;padding:1px;display:inline;zoom:1",t.inlineBlockNeedsLayout=r.offsetWidth===3
  ,r.style.display="block",r.style.overflow="visible",r.innerHTML="<div></div>",r.firstChild.style.width="5px",t.shrinkWrapBlocks=r.offsetWidth!==3,n.style.zoom=1),u.removeChild(n),n=r=i=s=null}),u.removeChild(h),n=r=i=s=o=u=h=null,t}();var vt=/(?:\{[\s\S]*\}|\[[\s\S]*\])$/,mt=/([A-Z])/g;Y.extend({cache:{},deletedIds:[],uuid:0,expando:"jQuery"+(Y.fn.jquery+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(e){return e=e.nodeType?Y.cache[e[Y.expando]]:e[Y.expando],!!e&&!i(e)},data:function(e,n,r,i){if(!Y.acceptData(e))return;var s,o,u=Y.expando,a=typeof n=="string",f=e.nodeType,l=f?Y.cache:e,c=f?e[u]:e[u]&&u;if((!c||!l[c]||!i&&!l[c].data)&&a&&r===t)return;c||(f?e[u]=c=Y.deletedIds.pop()||++Y.uuid:c=u),l[c]||(l[c]={},f||(l[c].toJSON=Y.noop));if(typeof n=="object"||typeof n=="function")i?l[c]=Y.extend(l[c],n):l[c].data=Y.extend(l[c].data,n);return s=l[c],i||(s.data||(s.data={}),s=s.data),r!==t&&(s[Y.camelCase(n)]=r),a?(o=s[n],o==null&&(o=
  s[Y.camelCase(n)])):o=s,o},removeData:function(e,t,n){if(!Y.acceptData(e))return;var r,s,o,u=e.nodeType,a=u?Y.cache:e,f=u?e[Y.expando]:Y.expando;if(!a[f])return;if(t){r=n?a[f]:a[f].data;if(r){Y.isArray(t)||(t in r?t=[t]:(t=Y.camelCase(t),t in r?t=[t]:t=t.split(" ")));for(s=0,o=t.length;s<o;s++)delete r[t[s]];if(!(n?i:Y.isEmptyObject)(r))return}}if(!n){delete a[f].data;if(!i(a[f]))return}u?Y.cleanData([e],!0):Y.support.deleteExpando||a!=a.window?delete a[f]:a[f]=null},_data:function(e,t,n){return Y.data(e,t,n,!0)},acceptData:function(e){var t=e.nodeName&&Y.noData[e.nodeName.toLowerCase()];return!t||t!==!0&&e.getAttribute("classid")===t}}),Y.fn.extend({data:function(e,n){var i,s,o,u,a,f=this[0],l=0,c=null;if(e===t){if(this.length){c=Y.data(f);if(f.nodeType===1&&!Y._data(f,"parsedAttrs")){o=f.attributes;for(a=o.length;l<a;l++)u=o[l].name,u.indexOf("data-")===0&&(u=Y.camelCase(u.substring(5)),r(f,u,c[u]));Y._data(f,"parsedAttrs",!0)}}return c}return typeof e=="object"?this.each(function(){Y.data(this,e)}):(i=e.split
  (".",2),i[1]=i[1]?"."+i[1]:"",s=i[1]+"!",Y.access(this,function(n){if(n===t)return c=this.triggerHandler("getData"+s,[i[0]]),c===t&&f&&(c=Y.data(f,e),c=r(f,e,c)),c===t&&i[1]?this.data(i[0]):c;i[1]=n,this.each(function(){var t=Y(this);t.triggerHandler("setData"+s,i),Y.data(this,e,n),t.triggerHandler("changeData"+s,i)})},null,n,arguments.length>1,null,!1))},removeData:function(e){return this.each(function(){Y.removeData(this,e)})}}),Y.extend({queue:function(e,t,n){var r;if(e)return t=(t||"fx")+"queue",r=Y._data(e,t),n&&(!r||Y.isArray(n)?r=Y._data(e,t,Y.makeArray(n)):r.push(n)),r||[]},dequeue:function(e,t){t=t||"fx";var n=Y.queue(e,t),r=n.length,i=n.shift(),s=Y._queueHooks(e,t),o=function(){Y.dequeue(e,t)};i==="inprogress"&&(i=n.shift(),r--),i&&(t==="fx"&&n.unshift("inprogress"),delete s.stop,i.call(e,o,s)),!r&&s&&s.empty.fire()},_queueHooks:function(e,t){var n=t+"queueHooks";return Y._data(e,n)||Y._data(e,n,{empty:Y.Callbacks("once memory").add(function(){Y.removeData(e,t+"queue",!0),Y.removeData(e,n,!0)})})}}),
  Y.fn.extend({queue:function(e,n){var r=2;return typeof e!="string"&&(n=e,e="fx",r--),arguments.length<r?Y.queue(this[0],e):n===t?this:this.each(function(){var t=Y.queue(this,e,n);Y._queueHooks(this,e),e==="fx"&&t[0]!=="inprogress"&&Y.dequeue(this,e)})},dequeue:function(e){return this.each(function(){Y.dequeue(this,e)})},delay:function(e,t){return e=Y.fx?Y.fx.speeds[e]||e:e,t=t||"fx",this.queue(t,function(t,n){var r=setTimeout(t,e);n.stop=function(){clearTimeout(r)}})},clearQueue:function(e){return this.queue(e||"fx",[])},promise:function(e,n){var r,i=1,s=Y.Deferred(),o=this,u=this.length,a=function(){--i||s.resolveWith(o,[o])};typeof e!="string"&&(n=e,e=t),e=e||"fx";while(u--)r=Y._data(o[u],e+"queueHooks"),r&&r.empty&&(i++,r.empty.add(a));return a(),s.promise(n)}});var gt,yt,bt,wt=/[\t\r\n]/g,Et=/\r/g,St=/^(?:button|input)$/i,xt=/^(?:button|input|object|select|textarea)$/i,Tt=/^a(?:rea|)$/i,Nt=/^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i
  ,Ct=Y.support.getSetAttribute;Y.fn.extend({attr:function(e,t){return Y.access(this,Y.attr,e,t,arguments.length>1)},removeAttr:function(e){return this.each(function(){Y.removeAttr(this,e)})},prop:function(e,t){return Y.access(this,Y.prop,e,t,arguments.length>1)},removeProp:function(e){return e=Y.propFix[e]||e,this.each(function(){try{this[e]=t,delete this[e]}catch(n){}})},addClass:function(e){var t,n,r,i,s,o,u;if(Y.isFunction(e))return this.each(function(t){Y(this).addClass(e.call(this,t,this.className))});if(e&&typeof e=="string"){t=e.split(tt);for(n=0,r=this.length;n<r;n++){i=this[n];if(i.nodeType===1)if(!i.className&&t.length===1)i.className=e;else{s=" "+i.className+" ";for(o=0,u=t.length;o<u;o++)~s.indexOf(" "+t[o]+" ")||(s+=t[o]+" ");i.className=Y.trim(s)}}}return this},removeClass:function(e){var n,r,i,s,o,u,a;if(Y.isFunction(e))return this.each(function(t){Y(this).removeClass(e.call(this,t,this.className))});if(e&&typeof e=="string"||e===t){n=(e||"").split(tt);for(u=0,a=this.length;u<a;u++){i=this[u];if(
  i.nodeType===1&&i.className){r=(" "+i.className+" ").replace(wt," ");for(s=0,o=n.length;s<o;s++)while(r.indexOf(" "+n[s]+" ")>-1)r=r.replace(" "+n[s]+" "," ");i.className=e?Y.trim(r):""}}}return this},toggleClass:function(e,t){var n=typeof e,r=typeof t=="boolean";return Y.isFunction(e)?this.each(function(n){Y(this).toggleClass(e.call(this,n,this.className,t),t)}):this.each(function(){if(n==="string"){var i,s=0,o=Y(this),u=t,a=e.split(tt);while(i=a[s++])u=r?u:!o.hasClass(i),o[u?"addClass":"removeClass"](i)}else if(n==="undefined"||n==="boolean")this.className&&Y._data(this,"__className__",this.className),this.className=this.className||e===!1?"":Y._data(this,"__className__")||""})},hasClass:function(e){var t=" "+e+" ",n=0,r=this.length;for(;n<r;n++)if(this[n].nodeType===1&&(" "+this[n].className+" ").replace(wt," ").indexOf(t)>-1)return!0;return!1},val:function(e){var n,r,i,s=this[0];if(!arguments.length){if(s)return n=Y.valHooks[s.type]||Y.valHooks[s.nodeName.toLowerCase()],n&&"get"in n&&(r=n.get(s,"value"))!==
  t?r:(r=s.value,typeof r=="string"?r.replace(Et,""):r==null?"":r);return}return i=Y.isFunction(e),this.each(function(r){var s,o=Y(this);if(this.nodeType!==1)return;i?s=e.call(this,r,o.val()):s=e,s==null?s="":typeof s=="number"?s+="":Y.isArray(s)&&(s=Y.map(s,function(e){return e==null?"":e+""})),n=Y.valHooks[this.type]||Y.valHooks[this.nodeName.toLowerCase()];if(!n||!("set"in n)||n.set(this,s,"value")===t)this.value=s})}}),Y.extend({valHooks:{option:{get:function(e){var t=e.attributes.value;return!t||t.specified?e.value:e.text}},select:{get:function(e){var t,n,r,i,s=e.selectedIndex,o=[],u=e.options,a=e.type==="select-one";if(s<0)return null;n=a?s:0,r=a?s+1:u.length;for(;n<r;n++){i=u[n];if(i.selected&&(Y.support.optDisabled?!i.disabled:i.getAttribute("disabled")===null)&&(!i.parentNode.disabled||!Y.nodeName(i.parentNode,"optgroup"))){t=Y(i).val();if(a)return t;o.push(t)}}return a&&!o.length&&u.length?Y(u[s]).val():o},set:function(e,t){var n=Y.makeArray(t);return Y(e).find("option").each(function(){this.selected=Y
  .inArray(Y(this).val(),n)>=0}),n.length||(e.selectedIndex=-1),n}}},attrFn:{},attr:function(e,n,r,i){var s,o,u,a=e.nodeType;if(!e||a===3||a===8||a===2)return;if(i&&Y.isFunction(Y.fn[n]))return Y(e)[n](r);if(typeof e.getAttribute=="undefined")return Y.prop(e,n,r);u=a!==1||!Y.isXMLDoc(e),u&&(n=n.toLowerCase(),o=Y.attrHooks[n]||(Nt.test(n)?yt:gt));if(r!==t){if(r===null){Y.removeAttr(e,n);return}return o&&"set"in o&&u&&(s=o.set(e,r,n))!==t?s:(e.setAttribute(n,""+r),r)}return o&&"get"in o&&u&&(s=o.get(e,n))!==null?s:(s=e.getAttribute(n),s===null?t:s)},removeAttr:function(e,t){var n,r,i,s,o=0;if(t&&e.nodeType===1){r=t.split(tt);for(;o<r.length;o++)i=r[o],i&&(n=Y.propFix[i]||i,s=Nt.test(i),s||Y.attr(e,i,""),e.removeAttribute(Ct?i:n),s&&n in e&&(e[n]=!1))}},attrHooks:{type:{set:function(e,t){if(St.test(e.nodeName)&&e.parentNode)Y.error("type property can't be changed");else if(!Y.support.radioValue&&t==="radio"&&Y.nodeName(e,"input")){var n=e.value;return e.setAttribute("type",t),n&&(e.value=n),t}}},value:{get:function(
  e,t){return gt&&Y.nodeName(e,"button")?gt.get(e,t):t in e?e.value:null},set:function(e,t,n){if(gt&&Y.nodeName(e,"button"))return gt.set(e,t,n);e.value=t}}},propFix:{tabindex:"tabIndex",readonly:"readOnly","for":"htmlFor","class":"className",maxlength:"maxLength",cellspacing:"cellSpacing",cellpadding:"cellPadding",rowspan:"rowSpan",colspan:"colSpan",usemap:"useMap",frameborder:"frameBorder",contenteditable:"contentEditable"},prop:function(e,n,r){var i,s,o,u=e.nodeType;if(!e||u===3||u===8||u===2)return;return o=u!==1||!Y.isXMLDoc(e),o&&(n=Y.propFix[n]||n,s=Y.propHooks[n]),r!==t?s&&"set"in s&&(i=s.set(e,r,n))!==t?i:e[n]=r:s&&"get"in s&&(i=s.get(e,n))!==null?i:e[n]},propHooks:{tabIndex:{get:function(e){var n=e.getAttributeNode("tabindex");return n&&n.specified?parseInt(n.value,10):xt.test(e.nodeName)||Tt.test(e.nodeName)&&e.href?0:t}}}}),yt={get:function(e,n){var r,i=Y.prop(e,n);return i===!0||typeof i!="boolean"&&(r=e.getAttributeNode(n))&&r.nodeValue!==!1?n.toLowerCase():t},set:function(e,t,n){var r;return t===!1?
  Y.removeAttr(e,n):(r=Y.propFix[n]||n,r in e&&(e[r]=!0),e.setAttribute(n,n.toLowerCase())),n}},Ct||(bt={name:!0,id:!0,coords:!0},gt=Y.valHooks.button={get:function(e,n){var r;return r=e.getAttributeNode(n),r&&(bt[n]?r.value!=="":r.specified)?r.value:t},set:function(e,t,n){var r=e.getAttributeNode(n);return r||(r=R.createAttribute(n),e.setAttributeNode(r)),r.value=t+""}},Y.each(["width","height"],function(e,t){Y.attrHooks[t]=Y.extend(Y.attrHooks[t],{set:function(e,n){if(n==="")return e.setAttribute(t,"auto"),n}})}),Y.attrHooks.contenteditable={get:gt.get,set:function(e,t,n){t===""&&(t="false"),gt.set(e,t,n)}}),Y.support.hrefNormalized||Y.each(["href","src","width","height"],function(e,n){Y.attrHooks[n]=Y.extend(Y.attrHooks[n],{get:function(e){var r=e.getAttribute(n,2);return r===null?t:r}})}),Y.support.style||(Y.attrHooks.style={get:function(e){return e.style.cssText.toLowerCase()||t},set:function(e,t){return e.style.cssText=""+t}}),Y.support.optSelected||(Y.propHooks.selected=Y.extend(Y.propHooks.selected,{get:
  function(e){var t=e.parentNode;return t&&(t.selectedIndex,t.parentNode&&t.parentNode.selectedIndex),null}})),Y.support.enctype||(Y.propFix.enctype="encoding"),Y.support.checkOn||Y.each(["radio","checkbox"],function(){Y.valHooks[this]={get:function(e){return e.getAttribute("value")===null?"on":e.value}}}),Y.each(["radio","checkbox"],function(){Y.valHooks[this]=Y.extend(Y.valHooks[this],{set:function(e,t){if(Y.isArray(t))return e.checked=Y.inArray(Y(e).val(),t)>=0}})});var kt=/^(?:textarea|input|select)$/i,Lt=/^([^\.]*|)(?:\.(.+)|)$/,At=/(?:^|\s)hover(\.\S+|)\b/,Ot=/^key/,Mt=/^(?:mouse|contextmenu)|click/,_t=/^(?:focusinfocus|focusoutblur)$/,Dt=function(e){return Y.event.special.hover?e:e.replace(At,"mouseenter$1 mouseleave$1")};Y.event={add:function(e,n,r,i,s){var o,u,a,f,l,c,h,p,d,v,m;if(e.nodeType===3||e.nodeType===8||!n||!r||!(o=Y._data(e)))return;r.handler&&(d=r,r=d.handler,s=d.selector),r.guid||(r.guid=Y.guid++),a=o.events,a||(o.events=a={}),u=o.handle,u||(o.handle=u=function(e){return typeof Y=="undefined"||!!
  e&&Y.event.triggered===e.type?t:Y.event.dispatch.apply(u.elem,arguments)},u.elem=e),n=Y.trim(Dt(n)).split(" ");for(f=0;f<n.length;f++){l=Lt.exec(n[f])||[],c=l[1],h=(l[2]||"").split(".").sort(),m=Y.event.special[c]||{},c=(s?m.delegateType:m.bindType)||c,m=Y.event.special[c]||{},p=Y.extend({type:c,origType:l[1],data:i,handler:r,guid:r.guid,selector:s,namespace:h.join(".")},d),v=a[c];if(!v){v=a[c]=[],v.delegateCount=0;if(!m.setup||m.setup.call(e,i,h,u)===!1)e.addEventListener?e.addEventListener(c,u,!1):e.attachEvent&&e.attachEvent("on"+c,u)}m.add&&(m.add.call(e,p),p.handler.guid||(p.handler.guid=r.guid)),s?v.splice(v.delegateCount++,0,p):v.push(p),Y.event.global[c]=!0}e=null},global:{},remove:function(e,t,n,r,i){var s,o,u,a,f,l,c,h,p,d,v,m=Y.hasData(e)&&Y._data(e);if(!m||!(h=m.events))return;t=Y.trim(Dt(t||"")).split(" ");for(s=0;s<t.length;s++){o=Lt.exec(t[s])||[],u=a=o[1],f=o[2];if(!u){for(u in h)Y.event.remove(e,u+t[s],n,r,!0);continue}p=Y.event.special[u]||{},u=(r?p.delegateType:p.bindType)||u,d=h[u]||[],l=d.
  length,f=f?new RegExp("(^|\\.)"+f.split(".").sort().join("\\.(?:.*\\.|)")+"(\\.|$)"):null;for(c=0;c<d.length;c++)v=d[c],(i||a===v.origType)&&(!n||n.guid===v.guid)&&(!f||f.test(v.namespace))&&(!r||r===v.selector||r==="**"&&v.selector)&&(d.splice(c--,1),v.selector&&d.delegateCount--,p.remove&&p.remove.call(e,v));d.length===0&&l!==d.length&&((!p.teardown||p.teardown.call(e,f,m.handle)===!1)&&Y.removeEvent(e,u,m.handle),delete h[u])}Y.isEmptyObject(h)&&(delete m.handle,Y.removeData(e,"events",!0))},customEvent:{getData:!0,setData:!0,changeData:!0},trigger:function(n,r,i,s){if(!i||i.nodeType!==3&&i.nodeType!==8){var o,u,a,f,l,c,h,p,d,v,m=n.type||n,g=[];if(_t.test(m+Y.event.triggered))return;m.indexOf("!")>=0&&(m=m.slice(0,-1),u=!0),m.indexOf(".")>=0&&(g=m.split("."),m=g.shift(),g.sort());if((!i||Y.event.customEvent[m])&&!Y.event.global[m])return;n=typeof n=="object"?n[Y.expando]?n:new Y.Event(m,n):new Y.Event(m),n.type=m,n.isTrigger=!0,n.exclusive=u,n.namespace=g.join("."),n.namespace_re=n.namespace?new RegExp("(^|\\.)"+
  g.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,c=m.indexOf(":")<0?"on"+m:"";if(!i){o=Y.cache;for(a in o)o[a].events&&o[a].events[m]&&Y.event.trigger(n,r,o[a].handle.elem,!0);return}n.result=t,n.target||(n.target=i),r=r!=null?Y.makeArray(r):[],r.unshift(n),h=Y.event.special[m]||{};if(h.trigger&&h.trigger.apply(i,r)===!1)return;d=[[i,h.bindType||m]];if(!s&&!h.noBubble&&!Y.isWindow(i)){v=h.delegateType||m,f=_t.test(v+m)?i:i.parentNode;for(l=i;f;f=f.parentNode)d.push([f,v]),l=f;l===(i.ownerDocument||R)&&d.push([l.defaultView||l.parentWindow||e,v])}for(a=0;a<d.length&&!n.isPropagationStopped();a++)f=d[a][0],n.type=d[a][1],p=(Y._data(f,"events")||{})[n.type]&&Y._data(f,"handle"),p&&p.apply(f,r),p=c&&f[c],p&&Y.acceptData(f)&&p.apply(f,r)===!1&&n.preventDefault();return n.type=m,!s&&!n.isDefaultPrevented()&&(!h._default||h._default.apply(i.ownerDocument,r)===!1)&&(m!=="click"||!Y.nodeName(i,"a"))&&Y.acceptData(i)&&c&&i[m]&&(m!=="focus"&&m!=="blur"||n.target.offsetWidth!==0)&&!Y.isWindow(i)&&(l=i[c],l&&(i[c]=null),Y.event.triggered=
  m,i[m](),Y.event.triggered=t,l&&(i[c]=l)),n.result}return},dispatch:function(n){n=Y.event.fix(n||e.event);var r,i,s,o,u,a,f,l,c,h,p=(Y._data(this,"events")||{})[n.type]||[],d=p.delegateCount,v=[].slice.call(arguments),m=!n.exclusive&&!n.namespace,g=Y.event.special[n.type]||{},y=[];v[0]=n,n.delegateTarget=this;if(g.preDispatch&&g.preDispatch.call(this,n)===!1)return;if(d&&(!n.button||n.type!=="click"))for(s=n.target;s!=this;s=s.parentNode||this)if(s.disabled!==!0||n.type!=="click"){u={},f=[];for(r=0;r<d;r++)l=p[r],c=l.selector,u[c]===t&&(u[c]=Y(c,this).index(s)>=0),u[c]&&f.push(l);f.length&&y.push({elem:s,matches:f})}p.length>d&&y.push({elem:this,matches:p.slice(d)});for(r=0;r<y.length&&!n.isPropagationStopped();r++){a=y[r],n.currentTarget=a.elem;for(i=0;i<a.matches.length&&!n.isImmediatePropagationStopped();i++){l=a.matches[i];if(m||!n.namespace&&!l.namespace||n.namespace_re&&n.namespace_re.test(l.namespace))n.data=l.data,n.handleObj=l,o=((Y.event.special[l.origType]||{}).handle||l.handler).apply(a.elem,v),o!==
  t&&(n.result=o,o===!1&&(n.preventDefault(),n.stopPropagation()))}}return g.postDispatch&&g.postDispatch.call(this,n),n.result},props:"attrChange attrName relatedNode srcElement altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),fixHooks:{},keyHooks:{props:"char charCode key keyCode".split(" "),filter:function(e,t){return e.which==null&&(e.which=t.charCode!=null?t.charCode:t.keyCode),e}},mouseHooks:{props:"button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(e,n){var r,i,s,o=n.button,u=n.fromElement;return e.pageX==null&&n.clientX!=null&&(r=e.target.ownerDocument||R,i=r.documentElement,s=r.body,e.pageX=n.clientX+(i&&i.scrollLeft||s&&s.scrollLeft||0)-(i&&i.clientLeft||s&&s.clientLeft||0),e.pageY=n.clientY+(i&&i.scrollTop||s&&s.scrollTop||0)-(i&&i.clientTop||s&&s.clientTop||0)),!e.relatedTarget&&u&&(e.relatedTarget=u===e.target?n.toElement:u),!e.which&&o!==t&&(e.which=
  o&1?1:o&2?3:o&4?2:0),e}},fix:function(e){if(e[Y.expando])return e;var t,n,r=e,i=Y.event.fixHooks[e.type]||{},s=i.props?this.props.concat(i.props):this.props;e=Y.Event(r);for(t=s.length;t;)n=s[--t],e[n]=r[n];return e.target||(e.target=r.srcElement||R),e.target.nodeType===3&&(e.target=e.target.parentNode),e.metaKey=!!e.metaKey,i.filter?i.filter(e,r):e},special:{load:{noBubble:!0},focus:{delegateType:"focusin"},blur:{delegateType:"focusout"},beforeunload:{setup:function(e,t,n){Y.isWindow(this)&&(this.onbeforeunload=n)},teardown:function(e,t){this.onbeforeunload===t&&(this.onbeforeunload=null)}}},simulate:function(e,t,n,r){var i=Y.extend(new Y.Event,n,{type:e,isSimulated:!0,originalEvent:{}});r?Y.event.trigger(i,null,t):Y.event.dispatch.call(t,i),i.isDefaultPrevented()&&n.preventDefault()}},Y.event.handle=Y.event.dispatch,Y.removeEvent=R.removeEventListener?function(e,t,n){e.removeEventListener&&e.removeEventListener(t,n,!1)}:function(e,t,n){var r="on"+t;e.detachEvent&&(typeof e[r]=="undefined"&&(e[r]=null),e.detachEvent
  (r,n))},Y.Event=function(e,t){if(!(this instanceof Y.Event))return new Y.Event(e,t);e&&e.type?(this.originalEvent=e,this.type=e.type,this.isDefaultPrevented=e.defaultPrevented||e.returnValue===!1||e.getPreventDefault&&e.getPreventDefault()?o:s):this.type=e,t&&Y.extend(this,t),this.timeStamp=e&&e.timeStamp||Y.now(),this[Y.expando]=!0},Y.Event.prototype={preventDefault:function(){this.isDefaultPrevented=o;var e=this.originalEvent;if(!e)return;e.preventDefault?e.preventDefault():e.returnValue=!1},stopPropagation:function(){this.isPropagationStopped=o;var e=this.originalEvent;if(!e)return;e.stopPropagation&&e.stopPropagation(),e.cancelBubble=!0},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=o,this.stopPropagation()},isDefaultPrevented:s,isPropagationStopped:s,isImmediatePropagationStopped:s},Y.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(e,t){Y.event.special[e]={delegateType:t,bindType:t,handle:function(e){var n,r=this,i=e.relatedTarget,s=e.handleObj,o=s.selector;if(!i||i!==
  r&&!Y.contains(r,i))e.type=s.origType,n=s.handler.apply(this,arguments),e.type=t;return n}}}),Y.support.submitBubbles||(Y.event.special.submit={setup:function(){if(Y.nodeName(this,"form"))return!1;Y.event.add(this,"click._submit keypress._submit",function(e){var n=e.target,r=Y.nodeName(n,"input")||Y.nodeName(n,"button")?n.form:t;r&&!Y._data(r,"_submit_attached")&&(Y.event.add(r,"submit._submit",function(e){e._submit_bubble=!0}),Y._data(r,"_submit_attached",!0))})},postDispatch:function(e){e._submit_bubble&&(delete e._submit_bubble,this.parentNode&&!e.isTrigger&&Y.event.simulate("submit",this.parentNode,e,!0))},teardown:function(){if(Y.nodeName(this,"form"))return!1;Y.event.remove(this,"._submit")}}),Y.support.changeBubbles||(Y.event.special.change={setup:function(){if(kt.test(this.nodeName)){if(this.type==="checkbox"||this.type==="radio")Y.event.add(this,"propertychange._change",function(e){e.originalEvent.propertyName==="checked"&&(this._just_changed=!0)}),Y.event.add(this,"click._change",function(e){this._just_changed&&!
  e.isTrigger&&(this._just_changed=!1),Y.event.simulate("change",this,e,!0)});return!1}Y.event.add(this,"beforeactivate._change",function(e){var t=e.target;kt.test(t.nodeName)&&!Y._data(t,"_change_attached")&&(Y.event.add(t,"change._change",function(e){this.parentNode&&!e.isSimulated&&!e.isTrigger&&Y.event.simulate("change",this.parentNode,e,!0)}),Y._data(t,"_change_attached",!0))})},handle:function(e){var t=e.target;if(this!==t||e.isSimulated||e.isTrigger||t.type!=="radio"&&t.type!=="checkbox")return e.handleObj.handler.apply(this,arguments)},teardown:function(){return Y.event.remove(this,"._change"),!kt.test(this.nodeName)}}),Y.support.focusinBubbles||Y.each({focus:"focusin",blur:"focusout"},function(e,t){var n=0,r=function(e){Y.event.simulate(t,e.target,Y.event.fix(e),!0)};Y.event.special[t]={setup:function(){n++===0&&R.addEventListener(e,r,!0)},teardown:function(){--n===0&&R.removeEventListener(e,r,!0)}}}),Y.fn.extend({on:function(e,n,r,i,o){var u,a;if(typeof e=="object"){typeof n!="string"&&(r=r||n,n=t);for(
  a in e)this.on(a,n,r,e[a],o);return this}r==null&&i==null?(i=n,r=n=t):i==null&&(typeof n=="string"?(i=r,r=t):(i=r,r=n,n=t));if(i===!1)i=s;else if(!i)return this;return o===1&&(u=i,i=function(e){return Y().off(e),u.apply(this,arguments)},i.guid=u.guid||(u.guid=Y.guid++)),this.each(function(){Y.event.add(this,e,i,r,n)})},one:function(e,t,n,r){return this.on(e,t,n,r,1)},off:function(e,n,r){var i,o;if(e&&e.preventDefault&&e.handleObj)return i=e.handleObj,Y(e.delegateTarget).off(i.namespace?i.origType+"."+i.namespace:i.origType,i.selector,i.handler),this;if(typeof e=="object"){for(o in e)this.off(o,n,e[o]);return this}if(n===!1||typeof n=="function")r=n,n=t;return r===!1&&(r=s),this.each(function(){Y.event.remove(this,e,r,n)})},bind:function(e,t,n){return this.on(e,null,t,n)},unbind:function(e,t){return this.off(e,null,t)},live:function(e,t,n){return Y(this.context).on(e,this.selector,t,n),this},die:function(e,t){return Y(this.context).off(e,this.selector||"**",t),this},delegate:function(e,t,n,r){return this.on(t,e
  ,n,r)},undelegate:function(e,t,n){return arguments.length==1?this.off(e,"**"):this.off(t,e||"**",n)},trigger:function(e,t){return this.each(function(){Y.event.trigger(e,t,this)})},triggerHandler:function(e,t){if(this[0])return Y.event.trigger(e,t,this[0],!0)},toggle:function(e){var t=arguments,n=e.guid||Y.guid++,r=0,i=function(n){var i=(Y._data(this,"lastToggle"+e.guid)||0)%r;return Y._data(this,"lastToggle"+e.guid,i+1),n.preventDefault(),t[i].apply(this,arguments)||!1};i.guid=n;while(r<t.length)t[r++].guid=n;return this.click(i)},hover:function(e,t){return this.mouseenter(e).mouseleave(t||e)}}),Y.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error contextmenu".split(" "),function(e,t){Y.fn[t]=function(e,n){return n==null&&(n=e,e=null),arguments.length>0?this.on(t,null,e,n):this.trigger(t)},Ot.test(t)&&(Y.event.fixHooks[t]=Y.event.keyHooks),Mt.test(t)&&(Y.event.fixHooks[
  t]=Y.event.mouseHooks)}),function(e,t){function n(e,t,n,r){n=n||[],t=t||L;var i,s,o,u,a=t.nodeType;if(a!==1&&a!==9)return[];if(!e||typeof e!="string")return n;o=w(t);if(!o&&!r)if(i=K.exec(e))if(u=i[1]){if(a===9){s=t.getElementById(u);if(!s||!s.parentNode)return n;if(s.id===u)return n.push(s),n}else if(t.ownerDocument&&(s=t.ownerDocument.getElementById(u))&&E(t,s)&&s.id===u)return n.push(s),n}else{if(i[2])return _.apply(n,M.call(t.getElementsByTagName(e),0)),n;if((u=i[3])&&at&&t.getElementsByClassName)return _.apply(n,M.call(t.getElementsByClassName(u),0)),n}return d(e,t,n,r,o)}function r(e){return function(t){var n=t.nodeName.toLowerCase();return n==="input"&&t.type===e}}function i(e){return function(t){var n=t.nodeName.toLowerCase();return(n==="input"||n==="button")&&t.type===e}}function s(e,t,n){if(e===t)return n;var r=e.nextSibling;while(r){if(r===t)return-1;r=r.nextSibling}return 1}function o(e,t,r,i){var s,o,u,a,f,l,c,h,p,d,v=!r&&t!==L,m=(v?"<s>":"")+e.replace(X,"$1<s>"),g=B[k][m];if(g)return i?0:M.call(g
  ,0);f=e,l=[],h=0,p=y.preFilter,d=y.filter;while(f){if(!s||(o=V.exec(f)))o&&(f=f.slice(o[0].length),u.selector=c),l.push(u=[]),c="",v&&(f=" "+f);s=!1;if(o=$.exec(f))c+=o[0],f=f.slice(o[0].length),s=u.push({part:o.pop().replace(X," "),string:o[0],captures:o});for(a in d)(o=rt[a].exec(f))&&(!p[a]||(o=p[a](o,t,r)))&&(c+=o[0],f=f.slice(o[0].length),s=u.push({part:a,string:o.shift(),captures:o}));if(!s)break}return c&&(u.selector=c),i?f.length:f?n.error(e):M.call(B(m,l),0)}function u(e,t,n,r){var i=t.dir,s=O++;return e||(e=function(e){return e===n}),t.first?function(t){while(t=t[i])if(t.nodeType===1)return e(t)&&t}:r?function(t){while(t=t[i])if(t.nodeType===1&&e(t))return t}:function(t){var n,r=s+"."+v,o=r+"."+m;while(t=t[i])if(t.nodeType===1){if((n=t[k])===o)return t.sizset;if(typeof n=="string"&&n.indexOf(r)===0){if(t.sizset)return t}else{t[k]=o;if(e(t))return t.sizset=!0,t;t.sizset=!1}}}}function a(e,t){return e?function(n){var r=t(n);return r&&e(r===!0?n:r)}:t}function f(e,t,n){var r,i,s=0;for(;r=e[s];s++)y.relative
  [r.part]?i=u(i,y.relative[r.part],t,n):i=a(i,y.filter[r.part].apply(null,r.captures.concat(t,n)));return i}function l(e){return function(t){var n,r=0;for(;n=e[r];r++)if(n(t))return!0;return!1}}function c(e,t,r,i){var s=0,o=t.length;for(;s<o;s++)n(e,t[s],r,i)}function h(e,t,r,i,s,o){var u,a=y.setFilters[t.toLowerCase()];return a||n.error(t),(e||!(u=s))&&c(e||"*",i,u=[],s),u.length>0?a(u,r,o):[]}function p(e,r,i,s){var o,u,a,f,l,p,d,v,m,g,y,b,w,E=0,S=e.length,x=rt.POS,T=new RegExp("^"+x.source+"(?!"+F+")","i"),N=function(){var e=1,n=arguments.length-2;for(;e<n;e++)arguments[e]===t&&(m[e]=t)};for(;E<S;E++){o=e[E],u="",v=s;for(a=0,f=o.length;a<f;a++){l=o[a],p=l.string;if(l.part==="PSEUDO"){x.exec(""),d=0;while(m=x.exec(p)){g=!0,y=x.lastIndex=m.index+m[0].length;if(y>d){u+=p.slice(d,m.index),d=y,b=[r],$.test(u)&&(v&&(b=v),v=s);if(w=Z.test(u))u=u.slice(0,-5).replace($,"$&*"),d++;m.length>1&&m[0].replace(T,N),v=h(u,m[1],m[2],b,v,w)}u=""}}g||(u+=p),g=!1}u?$.test(u)?c(u,v||[r],i,s):n(u,r,i,s?s.concat(v):v):_.apply(i,v)
  }return S===1?i:n.uniqueSort(i)}function d(e,t,n,r,i){e=e.replace(X,"$1");var s,u,a,f,l,c,h,d,g,b,w=o(e,t,i),E=t.nodeType;if(rt.POS.test(e))return p(w,t,n,r);if(r)s=M.call(r,0);else if(w.length===1){if((c=M.call(w[0],0)).length>2&&(h=c[0]).part==="ID"&&E===9&&!i&&y.relative[c[1].part]){t=y.find.ID(h.captures[0].replace(nt,""),t,i)[0];if(!t)return n;e=e.slice(c.shift().string.length)}g=(w=G.exec(c[0].string))&&!w.index&&t.parentNode||t,d="";for(l=c.length-1;l>=0;l--){h=c[l],b=h.part,d=h.string+d;if(y.relative[b])break;if(y.order.test(b)){s=y.find[b](h.captures[0].replace(nt,""),g,i);if(s==null)continue;e=e.slice(0,e.length-d.length)+d.replace(rt[b],""),e||_.apply(n,M.call(s,0));break}}}if(e){u=S(e,t,i),v=u.dirruns++,s==null&&(s=y.find.TAG("*",G.test(e)&&t.parentNode||t));for(l=0;f=s[l];l++)m=u.runs++,u(f)&&n.push(f)}return n}var v,m,g,y,b,w,E,S,x,T,N=!0,C="undefined",k=("sizcache"+Math.random()).replace(".",""),L=e.document,A=L.documentElement,O=0,M=[].slice,_=[].push,D=function(e,t){return e[k]=t||!0,e},P=function(
  ){var e={},t=[];return D(function(n,r){return t.push(n)>y.cacheLength&&delete e[t.shift()],e[n]=r},e)},H=P(),B=P(),j=P(),F="[\\x20\\t\\r\\n\\f]",I="(?:\\\\.|[-\\w]|[^\\x00-\\xa0])+",q=I.replace("w","w#"),R="([*^$|!~]?=)",U="\\["+F+"*("+I+")"+F+"*(?:"+R+F+"*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|("+q+")|)|)"+F+"*\\]",z=":("+I+")(?:\\((?:(['\"])((?:\\\\.|[^\\\\])*?)\\2|([^()[\\]]*|(?:(?:"+U+")|[^:]|\\\\.)*|.*))\\)|)",W=":(nth|eq|gt|lt|first|last|even|odd)(?:\\(((?:-\\d)?\\d*)\\)|)(?=[^-]|$)",X=new RegExp("^"+F+"+|((?:^|[^\\\\])(?:\\\\.)*)"+F+"+$","g"),V=new RegExp("^"+F+"*,"+F+"*"),$=new RegExp("^"+F+"*([\\x20\\t\\r\\n\\f>+~])"+F+"*"),J=new RegExp(z),K=/^(?:#([\w\-]+)|(\w+)|\.([\w\-]+))$/,Q=/^:not/,G=/[\x20\t\r\n\f]*[+~]/,Z=/:not\($/,et=/h\d/i,tt=/input|select|textarea|button/i,nt=/\\(?!\\)/g,rt={ID:new RegExp("^#("+I+")"),CLASS:new RegExp("^\\.("+I+")"),NAME:new RegExp("^\\[name=['\"]?("+I+")['\"]?\\]"),TAG:new RegExp("^("+I.replace("w","w*")+")"),ATTR:new RegExp("^"+U),PSEUDO:new RegExp("^"+z),CHILD:new RegExp("^:(only|nth|last|first)-child(?:\\("+
  F+"*(even|odd|(([+-]|)(\\d*)n|)"+F+"*(?:([+-]|)"+F+"*(\\d+)|))"+F+"*\\)|)","i"),POS:new RegExp(W,"ig"),needsContext:new RegExp("^"+F+"*[>+~]|"+W,"i")},it=function(e){var t=L.createElement("div");try{return e(t)}catch(n){return!1}finally{t=null}},st=it(function(e){return e.appendChild(L.createComment("")),!e.getElementsByTagName("*").length}),ot=it(function(e){return e.innerHTML="<a href='#'></a>",e.firstChild&&typeof e.firstChild.getAttribute!==C&&e.firstChild.getAttribute("href")==="#"}),ut=it(function(e){e.innerHTML="<select></select>";var t=typeof e.lastChild.getAttribute("multiple");return t!=="boolean"&&t!=="string"}),at=it(function(e){return e.innerHTML="<div class='hidden e'></div><div class='hidden'></div>",!e.getElementsByClassName||!e.getElementsByClassName("e").length?!1:(e.lastChild.className="e",e.getElementsByClassName("e").length===2)}),ft=it(function(e){e.id=k+0,e.innerHTML="<a name='"+k+"'></a><div name='"+k+"'></div>",A.insertBefore(e,A.firstChild);var t=L.getElementsByName&&L.getElementsByName
  (k).length===2+L.getElementsByName(k+0).length;return g=!L.getElementById(k),A.removeChild(e),t});try{M.call(A.childNodes,0)[0].nodeType}catch(lt){M=function(e){var t,n=[];for(;t=this[e];e++)n.push(t);return n}}n.matches=function(e,t){return n(e,null,null,t)},n.matchesSelector=function(e,t){return n(t,null,null,[e]).length>0},b=n.getText=function(e){var t,n="",r=0,i=e.nodeType;if(i){if(i===1||i===9||i===11){if(typeof e.textContent=="string")return e.textContent;for(e=e.firstChild;e;e=e.nextSibling)n+=b(e)}else if(i===3||i===4)return e.nodeValue}else for(;t=e[r];r++)n+=b(t);return n},w=n.isXML=function(e){var t=e&&(e.ownerDocument||e).documentElement;return t?t.nodeName!=="HTML":!1},E=n.contains=A.contains?function(e,t){var n=e.nodeType===9?e.documentElement:e,r=t&&t.parentNode;return e===r||!!(r&&r.nodeType===1&&n.contains&&n.contains(r))}:A.compareDocumentPosition?function(e,t){return t&&!!(e.compareDocumentPosition(t)&16)}:function(e,t){while(t=t.parentNode)if(t===e)return!0;return!1},n.attr=function(e,t){var n
  ,r=w(e);return r||(t=t.toLowerCase()),y.attrHandle[t]?y.attrHandle[t](e):ut||r?e.getAttribute(t):(n=e.getAttributeNode(t),n?typeof e[t]=="boolean"?e[t]?t:null:n.specified?n.value:null:null)},y=n.selectors={cacheLength:50,createPseudo:D,match:rt,order:new RegExp("ID|TAG"+(ft?"|NAME":"")+(at?"|CLASS":"")),attrHandle:ot?{}:{href:function(e){return e.getAttribute("href",2)},type:function(e){return e.getAttribute("type")}},find:{ID:g?function(e,t,n){if(typeof t.getElementById!==C&&!n){var r=t.getElementById(e);return r&&r.parentNode?[r]:[]}}:function(e,n,r){if(typeof n.getElementById!==C&&!r){var i=n.getElementById(e);return i?i.id===e||typeof i.getAttributeNode!==C&&i.getAttributeNode("id").value===e?[i]:t:[]}},TAG:st?function(e,t){if(typeof t.getElementsByTagName!==C)return t.getElementsByTagName(e)}:function(e,t){var n=t.getElementsByTagName(e);if(e==="*"){var r,i=[],s=0;for(;r=n[s];s++)r.nodeType===1&&i.push(r);return i}return n},NAME:function(e,t){if(typeof t.getElementsByName!==C)return t.getElementsByName(name
  )},CLASS:function(e,t,n){if(typeof t.getElementsByClassName!==C&&!n)return t.getElementsByClassName(e)}},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(nt,""),e[3]=(e[4]||e[5]||"").replace(nt,""),e[2]==="~="&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),e[1]==="nth"?(e[2]||n.error(e[0]),e[3]=+(e[3]?e[4]+(e[5]||1):2*(e[2]==="even"||e[2]==="odd")),e[4]=+(e[6]+e[7]||e[2]==="odd")):e[2]&&n.error(e[0]),e},PSEUDO:function(e,t,n){var r,i;if(rt.CHILD.test(e[0]))return null;if(e[3])e[2]=e[3];else if(r=e[4])J.test(r)&&(i=o(r,t,n,!0))&&(i=r.indexOf(")",r.length-i)-r.length)&&(r=r.slice(0,i),e[0]=e[0].slice(0,i)),e[2]=r;return e.slice(0,3)}},filter:{ID:g?function(e){return e=e.replace(nt,""),function(t){return t.getAttribute("id")===e}}:function(e){return e=e.replace(nt,""),function(t){var n=typeof t.getAttributeNode!==C&&t.getAttributeNode("id");return n&&
  n.value===e}},TAG:function(e){return e==="*"?function(){return!0}:(e=e.replace(nt,"").toLowerCase(),function(t){return t.nodeName&&t.nodeName.toLowerCase()===e})},CLASS:function(e){var t=H[k][e];return t||(t=H(e,new RegExp("(^|"+F+")"+e+"("+F+"|$)"))),function(e){return t.test(e.className||typeof e.getAttribute!==C&&e.getAttribute("class")||"")}},ATTR:function(e,t,r){return t?function(i){var s=n.attr(i,e),o=s+"";if(s==null)return t==="!=";switch(t){case"=":return o===r;case"!=":return o!==r;case"^=":return r&&o.indexOf(r)===0;case"*=":return r&&o.indexOf(r)>-1;case"$=":return r&&o.substr(o.length-r.length)===r;case"~=":return(" "+o+" ").indexOf(r)>-1;case"|=":return o===r||o.substr(0,r.length+1)===r+"-"}}:function(t){return n.attr(t,e)!=null}},CHILD:function(e,t,n,r){if(e==="nth"){var i=O++;return function(e){var t,s,o=0,u=e;if(n===1&&r===0)return!0;t=e.parentNode;if(t&&(t[k]!==i||!e.sizset)){for(u=t.firstChild;u;u=u.nextSibling)if(u.nodeType===1){u.sizset=++o;if(u===e)break}t[k]=i}return s=e.sizset-r,n===0?s===0
  :s%n===0&&s/n>=0}}return function(t){var n=t;switch(e){case"only":case"first":while(n=n.previousSibling)if(n.nodeType===1)return!1;if(e==="first")return!0;n=t;case"last":while(n=n.nextSibling)if(n.nodeType===1)return!1;return!0}}},PSEUDO:function(e,t,r,i){var s,o=y.pseudos[e]||y.pseudos[e.toLowerCase()];return o||n.error("unsupported pseudo: "+e),o[k]?o(t,r,i):o.length>1?(s=[e,e,"",t],function(e){return o(e,0,s)}):o}},pseudos:{not:D(function(e,t,n){var r=S(e.replace(X,"$1"),t,n);return function(e){return!r(e)}}),enabled:function(e){return e.disabled===!1},disabled:function(e){return e.disabled===!0},checked:function(e){var t=e.nodeName.toLowerCase();return t==="input"&&!!e.checked||t==="option"&&!!e.selected},selected:function(e){return e.parentNode&&e.parentNode.selectedIndex,e.selected===!0},parent:function(e){return!y.pseudos.empty(e)},empty:function(e){var t;e=e.firstChild;while(e){if(e.nodeName>"@"||(t=e.nodeType)===3||t===4)return!1;e=e.nextSibling}return!0},contains:D(function(e){return function(t){return(
  t.textContent||t.innerText||b(t)).indexOf(e)>-1}}),has:D(function(e){return function(t){return n(e,t).length>0}}),header:function(e){return et.test(e.nodeName)},text:function(e){var t,n;return e.nodeName.toLowerCase()==="input"&&(t=e.type)==="text"&&((n=e.getAttribute("type"))==null||n.toLowerCase()===t)},radio:r("radio"),checkbox:r("checkbox"),file:r("file"),password:r("password"),image:r("image"),submit:i("submit"),reset:i("reset"),button:function(e){var t=e.nodeName.toLowerCase();return t==="input"&&e.type==="button"||t==="button"},input:function(e){return tt.test(e.nodeName)},focus:function(e){var t=e.ownerDocument;return e===t.activeElement&&(!t.hasFocus||t.hasFocus())&&(!!e.type||!!e.href)},active:function(e){return e===e.ownerDocument.activeElement}},setFilters:{first:function(e,t,n){return n?e.slice(1):[e[0]]},last:function(e,t,n){var r=e.pop();return n?e:[r]},even:function(e,t,n){var r=[],i=n?1:0,s=e.length;for(;i<s;i+=2)r.push(e[i]);return r},odd:function(e,t,n){var r=[],i=n?0:1,s=e.length;for(;i<s;i+=2
  )r.push(e[i]);return r},lt:function(e,t,n){return n?e.slice(+t):e.slice(0,+t)},gt:function(e,t,n){return n?e.slice(0,+t+1):e.slice(+t+1)},eq:function(e,t,n){var r=e.splice(+t,1);return n?e:r}}},x=A.compareDocumentPosition?function(e,t){return e===t?(T=!0,0):(!e.compareDocumentPosition||!t.compareDocumentPosition?e.compareDocumentPosition:e.compareDocumentPosition(t)&4)?-1:1}:function(e,t){if(e===t)return T=!0,0;if(e.sourceIndex&&t.sourceIndex)return e.sourceIndex-t.sourceIndex;var n,r,i=[],o=[],u=e.parentNode,a=t.parentNode,f=u;if(u===a)return s(e,t);if(!u)return-1;if(!a)return 1;while(f)i.unshift(f),f=f.parentNode;f=a;while(f)o.unshift(f),f=f.parentNode;n=i.length,r=o.length;for(var l=0;l<n&&l<r;l++)if(i[l]!==o[l])return s(i[l],o[l]);return l===n?s(e,o[l],-1):s(i[l],t,1)},[0,0].sort(x),N=!T,n.uniqueSort=function(e){var t,n=1;T=N,e.sort(x);if(T)for(;t=e[n];n++)t===e[n-1]&&e.splice(n--,1);return e},n.error=function(e){throw new Error("Syntax error, unrecognized expression: "+e)},S=n.compile=function(e,t,n){var r
  ,i,s,u=j[k][e];if(u&&u.context===t)return u;r=o(e,t,n);for(i=0,s=r.length;i<s;i++)r[i]=f(r[i],t,n);return u=j(e,l(r)),u.context=t,u.runs=u.dirruns=0,u},L.querySelectorAll&&function(){var e,t=d,r=/'|\\/g,i=/\=[\x20\t\r\n\f]*([^'"\]]*)[\x20\t\r\n\f]*\]/g,s=[],u=[":active"],a=A.matchesSelector||A.mozMatchesSelector||A.webkitMatchesSelector||A.oMatchesSelector||A.msMatchesSelector;it(function(e){e.innerHTML="<select><option selected=''></option></select>",e.querySelectorAll("[selected]").length||s.push("\\["+F+"*(?:checked|disabled|ismap|multiple|readonly|selected|value)"),e.querySelectorAll(":checked").length||s.push(":checked")}),it(function(e){e.innerHTML="<p test=''></p>",e.querySelectorAll("[test^='']").length&&s.push("[*^$]="+F+"*(?:\"\"|'')"),e.innerHTML="<input type='hidden'/>",e.querySelectorAll(":enabled").length||s.push(":enabled",":disabled")}),s=s.length&&new RegExp(s.join("|")),d=function(e,n,i,u,a){if(!u&&!a&&(!s||!s.test(e)))if(n.nodeType===9)try{return _.apply(i,M.call(n.querySelectorAll(e),0)),i}
  catch(f){}else if(n.nodeType===1&&n.nodeName.toLowerCase()!=="object"){var l,c,h,p=n.getAttribute("id"),d=p||k,v=G.test(e)&&n.parentNode||n;p?d=d.replace(r,"\\$&"):n.setAttribute("id",d),l=o(e,n,a),d="[id='"+d+"']";for(c=0,h=l.length;c<h;c++)l[c]=d+l[c].selector;try{return _.apply(i,M.call(v.querySelectorAll(l.join(",")),0)),i}catch(f){}finally{p||n.removeAttribute("id")}}return t(e,n,i,u,a)},a&&(it(function(t){e=a.call(t,"div");try{a.call(t,"[test!='']:sizzle"),u.push(rt.PSEUDO.source,rt.POS.source,"!=")}catch(n){}}),u=new RegExp(u.join("|")),n.matchesSelector=function(t,r){r=r.replace(i,"='$1']");if(!w(t)&&!u.test(r)&&(!s||!s.test(r)))try{var o=a.call(t,r);if(o||e||t.document&&t.document.nodeType!==11)return o}catch(f){}return n(r,null,null,[t]).length>0})}(),y.setFilters.nth=y.setFilters.eq,y.filters=y.pseudos,n.attr=Y.attr,Y.find=n,Y.expr=n.selectors,Y.expr[":"]=Y.expr.pseudos,Y.unique=n.uniqueSort,Y.text=n.getText,Y.isXMLDoc=n.isXML,Y.contains=n.contains}(e);var Pt=/Until$/,Ht=/^(?:parents|prev(?:Until|All))/
  ,Bt=/^.[^:#\[\.,]*$/,jt=Y.expr.match.needsContext,Ft={children:!0,contents:!0,next:!0,prev:!0};Y.fn.extend({find:function(e){var t,n,r,i,s,o,u=this;if(typeof e!="string")return Y(e).filter(function(){for(t=0,n=u.length;t<n;t++)if(Y.contains(u[t],this))return!0});o=this.pushStack("","find",e);for(t=0,n=this.length;t<n;t++){r=o.length,Y.find(e,this[t],o);if(t>0)for(i=r;i<o.length;i++)for(s=0;s<r;s++)if(o[s]===o[i]){o.splice(i--,1);break}}return o},has:function(e){var t,n=Y(e,this),r=n.length;return this.filter(function(){for(t=0;t<r;t++)if(Y.contains(this,n[t]))return!0})},not:function(e){return this.pushStack(f(this,e,!1),"not",e)},filter:function(e){return this.pushStack(f(this,e,!0),"filter",e)},is:function(e){return!!e&&(typeof e=="string"?jt.test(e)?Y(e,this.context).index(this[0])>=0:Y.filter(e,this).length>0:this.filter(e).length>0)},closest:function(e,t){var n,r=0,i=this.length,s=[],o=jt.test(e)||typeof e!="string"?Y(e,t||this.context):0;for(;r<i;r++){n=this[r];while(n&&n.ownerDocument&&n!==t&&n.nodeType!==11
  ){if(o?o.index(n)>-1:Y.find.matchesSelector(n,e)){s.push(n);break}n=n.parentNode}}return s=s.length>1?Y.unique(s):s,this.pushStack(s,"closest",e)},index:function(e){return e?typeof e=="string"?Y.inArray(this[0],Y(e)):Y.inArray(e.jquery?e[0]:e,this):this[0]&&this[0].parentNode?this.prevAll().length:-1},add:function(e,t){var n=typeof e=="string"?Y(e,t):Y.makeArray(e&&e.nodeType?[e]:e),r=Y.merge(this.get(),n);return this.pushStack(u(n[0])||u(r[0])?r:Y.unique(r))},addBack:function(e){return this.add(e==null?this.prevObject:this.prevObject.filter(e))}}),Y.fn.andSelf=Y.fn.addBack,Y.each({parent:function(e){var t=e.parentNode;return t&&t.nodeType!==11?t:null},parents:function(e){return Y.dir(e,"parentNode")},parentsUntil:function(e,t,n){return Y.dir(e,"parentNode",n)},next:function(e){return a(e,"nextSibling")},prev:function(e){return a(e,"previousSibling")},nextAll:function(e){return Y.dir(e,"nextSibling")},prevAll:function(e){return Y.dir(e,"previousSibling")},nextUntil:function(e,t,n){return Y.dir(e,"nextSibling",
  n)},prevUntil:function(e,t,n){return Y.dir(e,"previousSibling",n)},siblings:function(e){return Y.sibling((e.parentNode||{}).firstChild,e)},children:function(e){return Y.sibling(e.firstChild)},contents:function(e){return Y.nodeName(e,"iframe")?e.contentDocument||e.contentWindow.document:Y.merge([],e.childNodes)}},function(e,t){Y.fn[e]=function(n,r){var i=Y.map(this,t,n);return Pt.test(e)||(r=n),r&&typeof r=="string"&&(i=Y.filter(r,i)),i=this.length>1&&!Ft[e]?Y.unique(i):i,this.length>1&&Ht.test(e)&&(i=i.reverse()),this.pushStack(i,e,$.call(arguments).join(","))}}),Y.extend({filter:function(e,t,n){return n&&(e=":not("+e+")"),t.length===1?Y.find.matchesSelector(t[0],e)?[t[0]]:[]:Y.find.matches(e,t)},dir:function(e,n,r){var i=[],s=e[n];while(s&&s.nodeType!==9&&(r===t||s.nodeType!==1||!Y(s).is(r)))s.nodeType===1&&i.push(s),s=s[n];return i},sibling:function(e,t){var n=[];for(;e;e=e.nextSibling)e.nodeType===1&&e!==t&&n.push(e);return n}});var It="abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video"
  ,qt=/ jQuery\d+="(?:null|\d+)"/g,Rt=/^\s+/,Ut=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,zt=/<([\w:]+)/,Wt=/<tbody/i,Xt=/<|&#?\w+;/,Vt=/<(?:script|style|link)/i,$t=/<(?:script|object|embed|option|style)/i,Jt=new RegExp("<(?:"+It+")[\\s/>]","i"),Kt=/^(?:checkbox|radio)$/,Qt=/checked\s*(?:[^=]|=\s*.checked.)/i,Gt=/\/(java|ecma)script/i,Yt=/^\s*<!(?:\[CDATA\[|\-\-)|[\]\-]{2}>\s*$/g,Zt={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],area:[1,"<map>","</map>"],_default:[0,"",""]},en=l(R),tn=en.appendChild(R.createElement("div"));Zt.optgroup=Zt.option,Zt.tbody=Zt.tfoot=Zt.colgroup=Zt.caption=Zt.thead,Zt.th=Zt.td,Y.support.htmlSerialize||(Zt._default=[1,"X<div>","</div>"]),Y.fn.extend({text:function(e){return Y.access(this,function(e){return e===t?Y.text(this
  ):this.empty().append((this[0]&&this[0].ownerDocument||R).createTextNode(e))},null,e,arguments.length)},wrapAll:function(e){if(Y.isFunction(e))return this.each(function(t){Y(this).wrapAll(e.call(this,t))});if(this[0]){var t=Y(e,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&t.insertBefore(this[0]),t.map(function(){var e=this;while(e.firstChild&&e.firstChild.nodeType===1)e=e.firstChild;return e}).append(this)}return this},wrapInner:function(e){return Y.isFunction(e)?this.each(function(t){Y(this).wrapInner(e.call(this,t))}):this.each(function(){var t=Y(this),n=t.contents();n.length?n.wrapAll(e):t.append(e)})},wrap:function(e){var t=Y.isFunction(e);return this.each(function(n){Y(this).wrapAll(t?e.call(this,n):e)})},unwrap:function(){return this.parent().each(function(){Y.nodeName(this,"body")||Y(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,!0,function(e){(this.nodeType===1||this.nodeType===11)&&this.appendChild(e)})},prepend:function(){return this.domManip
  (arguments,!0,function(e){(this.nodeType===1||this.nodeType===11)&&this.insertBefore(e,this.firstChild)})},before:function(){if(!u(this[0]))return this.domManip(arguments,!1,function(e){this.parentNode.insertBefore(e,this)});if(arguments.length){var e=Y.clean(arguments);return this.pushStack(Y.merge(e,this),"before",this.selector)}},after:function(){if(!u(this[0]))return this.domManip(arguments,!1,function(e){this.parentNode.insertBefore(e,this.nextSibling)});if(arguments.length){var e=Y.clean(arguments);return this.pushStack(Y.merge(this,e),"after",this.selector)}},remove:function(e,t){var n,r=0;for(;(n=this[r])!=null;r++)if(!e||Y.filter(e,[n]).length)!t&&n.nodeType===1&&(Y.cleanData(n.getElementsByTagName("*")),Y.cleanData([n])),n.parentNode&&n.parentNode.removeChild(n);return this},empty:function(){var e,t=0;for(;(e=this[t])!=null;t++){e.nodeType===1&&Y.cleanData(e.getElementsByTagName("*"));while(e.firstChild)e.removeChild(e.firstChild)}return this},clone:function(e,t){return e=e==null?!1:e,t=t==null?e:t,this
  .map(function(){return Y.clone(this,e,t)})},html:function(e){return Y.access(this,function(e){var n=this[0]||{},r=0,i=this.length;if(e===t)return n.nodeType===1?n.innerHTML.replace(qt,""):t;if(typeof e=="string"&&!Vt.test(e)&&(Y.support.htmlSerialize||!Jt.test(e))&&(Y.support.leadingWhitespace||!Rt.test(e))&&!Zt[(zt.exec(e)||["",""])[1].toLowerCase()]){e=e.replace(Ut,"<$1></$2>");try{for(;r<i;r++)n=this[r]||{},n.nodeType===1&&(Y.cleanData(n.getElementsByTagName("*")),n.innerHTML=e);n=0}catch(s){}}n&&this.empty().append(e)},null,e,arguments.length)},replaceWith:function(e){return u(this[0])?this.length?this.pushStack(Y(Y.isFunction(e)?e():e),"replaceWith",e):this:Y.isFunction(e)?this.each(function(t){var n=Y(this),r=n.html();n.replaceWith(e.call(this,t,r))}):(typeof e!="string"&&(e=Y(e).detach()),this.each(function(){var t=this.nextSibling,n=this.parentNode;Y(this).remove(),t?Y(t).before(e):Y(n).append(e)}))},detach:function(e){return this.remove(e,!0)},domManip:function(e,n,r){e=[].concat.apply([],e);var i,s,o
  ,u,a=0,f=e[0],l=[],h=this.length;if(!Y.support.checkClone&&h>1&&typeof f=="string"&&Qt.test(f))return this.each(function(){Y(this).domManip(e,n,r)});if(Y.isFunction(f))return this.each(function(i){var s=Y(this);e[0]=f.call(this,i,n?s.html():t),s.domManip(e,n,r)});if(this[0]){i=Y.buildFragment(e,this,l),o=i.fragment,s=o.firstChild,o.childNodes.length===1&&(o=s);if(s){n=n&&Y.nodeName(s,"tr");for(u=i.cacheable||h-1;a<h;a++)r.call(n&&Y.nodeName(this[a],"table")?c(this[a],"tbody"):this[a],a===u?o:Y.clone(o,!0,!0))}o=s=null,l.length&&Y.each(l,function(e,t){t.src?Y.ajax?Y.ajax({url:t.src,type:"GET",dataType:"script",async:!1,global:!1,"throws":!0}):Y.error("no ajax"):Y.globalEval((t.text||t.textContent||t.innerHTML||"").replace(Yt,"")),t.parentNode&&t.parentNode.removeChild(t)})}return this}}),Y.buildFragment=function(e,n,r){var i,s,o,u=e[0];return n=n||R,n=!n.nodeType&&n[0]||n,n=n.ownerDocument||n,e.length===1&&typeof u=="string"&&u.length<512&&n===R&&u.charAt(0)==="<"&&!$t.test(u)&&(Y.support.checkClone||!Qt.test(u
  ))&&(Y.support.html5Clone||!Jt.test(u))&&(s=!0,i=Y.fragments[u],o=i!==t),i||(i=n.createDocumentFragment(),Y.clean(e,n,i,r),s&&(Y.fragments[u]=o&&i)),{fragment:i,cacheable:s}},Y.fragments={},Y.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(e,t){Y.fn[e]=function(n){var r,i=0,s=[],o=Y(n),u=o.length,a=this.length===1&&this[0].parentNode;if((a==null||a&&a.nodeType===11&&a.childNodes.length===1)&&u===1)return o[t](this[0]),this;for(;i<u;i++)r=(i>0?this.clone(!0):this).get(),Y(o[i])[t](r),s=s.concat(r);return this.pushStack(s,e,o.selector)}}),Y.extend({clone:function(e,t,n){var r,i,s,o;Y.support.html5Clone||Y.isXMLDoc(e)||!Jt.test("<"+e.nodeName+">")?o=e.cloneNode(!0):(tn.innerHTML=e.outerHTML,tn.removeChild(o=tn.firstChild));if((!Y.support.noCloneEvent||!Y.support.noCloneChecked)&&(e.nodeType===1||e.nodeType===11)&&!Y.isXMLDoc(e)){p(e,o),r=d(e),i=d(o);for(s=0;r[s];++s)i[s]&&p(r[s],i[s])}if(t){h(e,o);if(n){r=d(e),i=d(o);for(s=0;r[s];++s)h(r[s],
  i[s])}}return r=i=null,o},clean:function(e,t,n,r){var i,s,o,u,a,f,c,h,p,d,m,g,y=t===R&&en,b=[];if(!t||typeof t.createDocumentFragment=="undefined")t=R;for(i=0;(o=e[i])!=null;i++){typeof o=="number"&&(o+="");if(!o)continue;if(typeof o=="string")if(!Xt.test(o))o=t.createTextNode(o);else{y=y||l(t),c=t.createElement("div"),y.appendChild(c),o=o.replace(Ut,"<$1></$2>"),u=(zt.exec(o)||["",""])[1].toLowerCase(),a=Zt[u]||Zt._default,f=a[0],c.innerHTML=a[1]+o+a[2];while(f--)c=c.lastChild;if(!Y.support.tbody){h=Wt.test(o),p=u==="table"&&!h?c.firstChild&&c.firstChild.childNodes:a[1]==="<table>"&&!h?c.childNodes:[];for(s=p.length-1;s>=0;--s)Y.nodeName(p[s],"tbody")&&!p[s].childNodes.length&&p[s].parentNode.removeChild(p[s])}!Y.support.leadingWhitespace&&Rt.test(o)&&c.insertBefore(t.createTextNode(Rt.exec(o)[0]),c.firstChild),o=c.childNodes,c.parentNode.removeChild(c)}o.nodeType?b.push(o):Y.merge(b,o)}c&&(o=c=y=null);if(!Y.support.appendChecked)for(i=0;(o=b[i])!=null;i++)Y.nodeName(o,"input")?v(o):typeof o.getElementsByTagName!="undefined"&&
  Y.grep(o.getElementsByTagName("input"),v);if(n){m=function(e){if(!e.type||Gt.test(e.type))return r?r.push(e.parentNode?e.parentNode.removeChild(e):e):n.appendChild(e)};for(i=0;(o=b[i])!=null;i++)if(!Y.nodeName(o,"script")||!m(o))n.appendChild(o),typeof o.getElementsByTagName!="undefined"&&(g=Y.grep(Y.merge([],o.getElementsByTagName("script")),m),b.splice.apply(b,[i+1,0].concat(g)),i+=g.length)}return b},cleanData:function(e,t){var n,r,i,s,o=0,u=Y.expando,a=Y.cache,f=Y.support.deleteExpando,l=Y.event.special;for(;(i=e[o])!=null;o++)if(t||Y.acceptData(i)){r=i[u],n=r&&a[r];if(n){if(n.events)for(s in n.events)l[s]?Y.event.remove(i,s):Y.removeEvent(i,s,n.handle);a[r]&&(delete a[r],f?delete i[u]:i.removeAttribute?i.removeAttribute(u):i[u]=null,Y.deletedIds.push(r))}}}}),function(){var e,t;Y.uaMatch=function(e){e=e.toLowerCase();var t=/(chrome)[ \/]([\w.]+)/.exec(e)||/(webkit)[ \/]([\w.]+)/.exec(e)||/(opera)(?:.*version|)[ \/]([\w.]+)/.exec(e)||/(msie) ([\w.]+)/.exec(e)||e.indexOf("compatible")<0&&/(mozilla)(?:.*? rv:([\w.]+)|)/
  .exec(e)||[];return{browser:t[1]||"",version:t[2]||"0"}},e=Y.uaMatch(z.userAgent),t={},e.browser&&(t[e.browser]=!0,t.version=e.version),t.chrome?t.webkit=!0:t.webkit&&(t.safari=!0),Y.browser=t,Y.sub=function(){function e(t,n){return new e.fn.init(t,n)}Y.extend(!0,e,this),e.superclass=this,e.fn=e.prototype=this(),e.fn.constructor=e,e.sub=this.sub,e.fn.init=function n(n,r){return r&&r instanceof Y&&!(r instanceof e)&&(r=e(r)),Y.fn.init.call(this,n,r,t)},e.fn.init.prototype=e.fn;var t=e(R);return e}}();var nn,rn,sn,on=/alpha\([^)]*\)/i,un=/opacity=([^)]*)/,an=/^(top|right|bottom|left)$/,fn=/^(none|table(?!-c[ea]).+)/,ln=/^margin/,cn=new RegExp("^("+Z+")(.*)$","i"),hn=new RegExp("^("+Z+")(?!px)[a-z%]+$","i"),pn=new RegExp("^([-+])=("+Z+")","i"),dn={},vn={position:"absolute",visibility:"hidden",display:"block"},mn={letterSpacing:0,fontWeight:400},gn=["Top","Right","Bottom","Left"],yn=["Webkit","O","Moz","ms"],bn=Y.fn.toggle;Y.fn.extend({css:function(e,n){return Y.access(this,function(e,n,r){return r!==t?Y.style(e,n
  ,r):Y.css(e,n)},e,n,arguments.length>1)},show:function(){return y(this,!0)},hide:function(){return y(this)},toggle:function(e,t){var n=typeof e=="boolean";return Y.isFunction(e)&&Y.isFunction(t)?bn.apply(this,arguments):this.each(function(){(n?e:g(this))?Y(this).show():Y(this).hide()})}}),Y.extend({cssHooks:{opacity:{get:function(e,t){if(t){var n=nn(e,"opacity");return n===""?"1":n}}}},cssNumber:{fillOpacity:!0,fontWeight:!0,lineHeight:!0,opacity:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":Y.support.cssFloat?"cssFloat":"styleFloat"},style:function(e,n,r,i){if(!e||e.nodeType===3||e.nodeType===8||!e.style)return;var s,o,u,a=Y.camelCase(n),f=e.style;n=Y.cssProps[a]||(Y.cssProps[a]=m(f,a)),u=Y.cssHooks[n]||Y.cssHooks[a];if(r===t)return u&&"get"in u&&(s=u.get(e,!1,i))!==t?s:f[n];o=typeof r,o==="string"&&(s=pn.exec(r))&&(r=(s[1]+1)*s[2]+parseFloat(Y.css(e,n)),o="number");if(r==null||o==="number"&&isNaN(r))return;o==="number"&&!Y.cssNumber[a]&&(r+="px");if(!u||!("set"in u)||(r=u.set(e,r,i))!==t)try{f
  [n]=r}catch(l){}},css:function(e,n,r,i){var s,o,u,a=Y.camelCase(n);return n=Y.cssProps[a]||(Y.cssProps[a]=m(e.style,a)),u=Y.cssHooks[n]||Y.cssHooks[a],u&&"get"in u&&(s=u.get(e,!0,i)),s===t&&(s=nn(e,n)),s==="normal"&&n in mn&&(s=mn[n]),r||i!==t?(o=parseFloat(s),r||Y.isNumeric(o)?o||0:s):s},swap:function(e,t,n){var r,i,s={};for(i in t)s[i]=e.style[i],e.style[i]=t[i];r=n.call(e);for(i in t)e.style[i]=s[i];return r}}),e.getComputedStyle?nn=function(t,n){var r,i,s,o,u=e.getComputedStyle(t,null),a=t.style;return u&&(r=u[n],r===""&&!Y.contains(t.ownerDocument,t)&&(r=Y.style(t,n)),hn.test(r)&&ln.test(n)&&(i=a.width,s=a.minWidth,o=a.maxWidth,a.minWidth=a.maxWidth=a.width=r,r=u.width,a.width=i,a.minWidth=s,a.maxWidth=o)),r}:R.documentElement.currentStyle&&(nn=function(e,t){var n,r,i=e.currentStyle&&e.currentStyle[t],s=e.style;return i==null&&s&&s[t]&&(i=s[t]),hn.test(i)&&!an.test(t)&&(n=s.left,r=e.runtimeStyle&&e.runtimeStyle.left,r&&(e.runtimeStyle.left=e.currentStyle.left),s.left=t==="fontSize"?"1em":i,i=s.pixelLeft+"px"
  ,s.left=n,r&&(e.runtimeStyle.left=r)),i===""?"auto":i}),Y.each(["height","width"],function(e,t){Y.cssHooks[t]={get:function(e,n,r){if(n)return e.offsetWidth===0&&fn.test(nn(e,"display"))?Y.swap(e,vn,function(){return E(e,t,r)}):E(e,t,r)},set:function(e,n,r){return b(e,n,r?w(e,t,r,Y.support.boxSizing&&Y.css(e,"boxSizing")==="border-box"):0)}}}),Y.support.opacity||(Y.cssHooks.opacity={get:function(e,t){return un.test((t&&e.currentStyle?e.currentStyle.filter:e.style.filter)||"")?.01*parseFloat(RegExp.$1)+"":t?"1":""},set:function(e,t){var n=e.style,r=e.currentStyle,i=Y.isNumeric(t)?"alpha(opacity="+t*100+")":"",s=r&&r.filter||n.filter||"";n.zoom=1;if(t>=1&&Y.trim(s.replace(on,""))===""&&n.removeAttribute){n.removeAttribute("filter");if(r&&!r.filter)return}n.filter=on.test(s)?s.replace(on,i):s+" "+i}}),Y(function(){Y.support.reliableMarginRight||(Y.cssHooks.marginRight={get:function(e,t){return Y.swap(e,{display:"inline-block"},function(){if(t)return nn(e,"marginRight")})}}),!Y.support.pixelPosition&&Y.fn.position&&
  Y.each(["top","left"],function(e,t){Y.cssHooks[t]={get:function(e,n){if(n){var r=nn(e,t);return hn.test(r)?Y(e).position()[t]+"px":r}}}})}),Y.expr&&Y.expr.filters&&(Y.expr.filters.hidden=function(e){return e.offsetWidth===0&&e.offsetHeight===0||!Y.support.reliableHiddenOffsets&&(e.style&&e.style.display||nn(e,"display"))==="none"},Y.expr.filters.visible=function(e){return!Y.expr.filters.hidden(e)}),Y.each({margin:"",padding:"",border:"Width"},function(e,t){Y.cssHooks[e+t]={expand:function(n){var r,i=typeof n=="string"?n.split(" "):[n],s={};for(r=0;r<4;r++)s[e+gn[r]+t]=i[r]||i[r-2]||i[0];return s}},ln.test(e)||(Y.cssHooks[e+t].set=b)});var wn=/%20/g,En=/\[\]$/,Sn=/\r?\n/g,xn=/^(?:color|date|datetime|datetime-local|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,Tn=/^(?:select|textarea)/i;Y.fn.extend({serialize:function(){return Y.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?Y.makeArray(this.elements):this}).filter(function(){return this
  .name&&!this.disabled&&(this.checked||Tn.test(this.nodeName)||xn.test(this.type))}).map(function(e,t){var n=Y(this).val();return n==null?null:Y.isArray(n)?Y.map(n,function(e,n){return{name:t.name,value:e.replace(Sn,"\r\n")}}):{name:t.name,value:n.replace(Sn,"\r\n")}}).get()}}),Y.param=function(e,n){var r,i=[],s=function(e,t){t=Y.isFunction(t)?t():t==null?"":t,i[i.length]=encodeURIComponent(e)+"="+encodeURIComponent(t)};n===t&&(n=Y.ajaxSettings&&Y.ajaxSettings.traditional);if(Y.isArray(e)||e.jquery&&!Y.isPlainObject(e))Y.each(e,function(){s(this.name,this.value)});else for(r in e)x(r,e[r],n,s);return i.join("&").replace(wn,"+")};var Nn,Cn,kn=/#.*$/,Ln=/^(.*?):[ \t]*([^\r\n]*)\r?$/mg,An=/^(?:about|app|app\-storage|.+\-extension|file|res|widget):$/,On=/^(?:GET|HEAD)$/,Mn=/^\/\//,_n=/\?/,Dn=/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,Pn=/([?&])_=[^&]*/,Hn=/^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+)|)|)/,Bn=Y.fn.load,jn={},Fn={},In=["*/"]+["*"];try{Nn=U.href}catch(qn){Nn=R.createElement("a"),Nn.href="",Nn=
  Nn.href}Cn=Hn.exec(Nn.toLowerCase())||[],Y.fn.load=function(e,n,r){if(typeof e!="string"&&Bn)return Bn.apply(this,arguments);if(!this.length)return this;var i,s,o,u=this,a=e.indexOf(" ");return a>=0&&(i=e.slice(a,e.length),e=e.slice(0,a)),Y.isFunction(n)?(r=n,n=t):n&&typeof n=="object"&&(s="POST"),Y.ajax({url:e,type:s,dataType:"html",data:n,complete:function(e,t){r&&u.each(r,o||[e.responseText,t,e])}}).done(function(e){o=arguments,u.html(i?Y("<div>").append(e.replace(Dn,"")).find(i):e)}),this},Y.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(e,t){Y.fn[t]=function(e){return this.on(t,e)}}),Y.each(["get","post"],function(e,n){Y[n]=function(e,r,i,s){return Y.isFunction(r)&&(s=s||i,i=r,r=t),Y.ajax({type:n,url:e,data:r,success:i,dataType:s})}}),Y.extend({getScript:function(e,n){return Y.get(e,t,n,"script")},getJSON:function(e,t,n){return Y.get(e,t,n,"json")},ajaxSetup:function(e,t){return t?C(e,Y.ajaxSettings):(t=e,e=Y.ajaxSettings),C(e,t),e},ajaxSettings:{url:Nn,isLocal:An
  .test(Cn[1]),global:!0,type:"GET",contentType:"application/x-www-form-urlencoded; charset=UTF-8",processData:!0,async:!0,accepts:{xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript","*":In},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":e.String,"text html":!0,"text json":Y.parseJSON,"text xml":Y.parseXML},flatOptions:{context:!0,url:!0}},ajaxPrefilter:T(jn),ajaxTransport:T(Fn),ajax:function(e,n){function r(e,n,r,o){var f,c,y,b,E,x=n;if(w===2)return;w=2,a&&clearTimeout(a),u=t,s=o||"",S.readyState=e>0?4:0,r&&(b=k(h,S,r));if(e>=200&&e<300||e===304)h.ifModified&&(E=S.getResponseHeader("Last-Modified"),E&&(Y.lastModified[i]=E),E=S.getResponseHeader("Etag"),E&&(Y.etag[i]=E)),e===304?(x="notmodified",f=!0):(f=L(h,b),x=f.state,c=f.data,y=f.error,f=!y);else{y=x;if(!x||e)x="error",e<0&&(e=0)}S.status=e,S.statusText=""+(n||x),f?v.resolveWith(p,[c,x,S]):v.rejectWith(p,[S,x,y]),S.statusCode(g),
  g=t,l&&d.trigger("ajax"+(f?"Success":"Error"),[S,h,f?c:y]),m.fireWith(p,[S,x]),l&&(d.trigger("ajaxComplete",[S,h]),--Y.active||Y.event.trigger("ajaxStop"))}typeof e=="object"&&(n=e,e=t),n=n||{};var i,s,o,u,a,f,l,c,h=Y.ajaxSetup({},n),p=h.context||h,d=p!==h&&(p.nodeType||p instanceof Y)?Y(p):Y.event,v=Y.Deferred(),m=Y.Callbacks("once memory"),g=h.statusCode||{},y={},b={},w=0,E="canceled",S={readyState:0,setRequestHeader:function(e,t){if(!w){var n=e.toLowerCase();e=b[n]=b[n]||e,y[e]=t}return this},getAllResponseHeaders:function(){return w===2?s:null},getResponseHeader:function(e){var n;if(w===2){if(!o){o={};while(n=Ln.exec(s))o[n[1].toLowerCase()]=n[2]}n=o[e.toLowerCase()]}return n===t?null:n},overrideMimeType:function(e){return w||(h.mimeType=e),this},abort:function(e){return e=e||E,u&&u.abort(e),r(0,e),this}};v.promise(S),S.success=S.done,S.error=S.fail,S.complete=m.add,S.statusCode=function(e){if(e){var t;if(w<2)for(t in e)g[t]=[g[t],e[t]];else t=e[S.status],S.always(t)}return this},h.url=((e||h.url)+"").replace
  (kn,"").replace(Mn,Cn[1]+"//"),h.dataTypes=Y.trim(h.dataType||"*").toLowerCase().split(tt),h.crossDomain==null&&(f=Hn.exec(h.url.toLowerCase()),h.crossDomain=!(!f||f[1]==Cn[1]&&f[2]==Cn[2]&&(f[3]||(f[1]==="http:"?80:443))==(Cn[3]||(Cn[1]==="http:"?80:443)))),h.data&&h.processData&&typeof h.data!="string"&&(h.data=Y.param(h.data,h.traditional)),N(jn,h,n,S);if(w===2)return S;l=h.global,h.type=h.type.toUpperCase(),h.hasContent=!On.test(h.type),l&&Y.active++===0&&Y.event.trigger("ajaxStart");if(!h.hasContent){h.data&&(h.url+=(_n.test(h.url)?"&":"?")+h.data,delete h.data),i=h.url;if(h.cache===!1){var x=Y.now(),T=h.url.replace(Pn,"$1_="+x);h.url=T+(T===h.url?(_n.test(h.url)?"&":"?")+"_="+x:"")}}(h.data&&h.hasContent&&h.contentType!==!1||n.contentType)&&S.setRequestHeader("Content-Type",h.contentType),h.ifModified&&(i=i||h.url,Y.lastModified[i]&&S.setRequestHeader("If-Modified-Since",Y.lastModified[i]),Y.etag[i]&&S.setRequestHeader("If-None-Match",Y.etag[i])),S.setRequestHeader("Accept",h.dataTypes[0]&&h.accepts[h.dataTypes
  [0]]?h.accepts[h.dataTypes[0]]+(h.dataTypes[0]!=="*"?", "+In+"; q=0.01":""):h.accepts["*"]);for(c in h.headers)S.setRequestHeader(c,h.headers[c]);if(!h.beforeSend||h.beforeSend.call(p,S,h)!==!1&&w!==2){E="abort";for(c in{success:1,error:1,complete:1})S[c](h[c]);u=N(Fn,h,n,S);if(!u)r(-1,"No Transport");else{S.readyState=1,l&&d.trigger("ajaxSend",[S,h]),h.async&&h.timeout>0&&(a=setTimeout(function(){S.abort("timeout")},h.timeout));try{w=1,u.send(y,r)}catch(C){if(!(w<2))throw C;r(-1,C)}}return S}return S.abort()},active:0,lastModified:{},etag:{}});var Rn=[],Un=/\?/,zn=/(=)\?(?=&|$)|\?\?/,Wn=Y.now();Y.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=Rn.pop()||Y.expando+"_"+Wn++;return this[e]=!0,e}}),Y.ajaxPrefilter("json jsonp",function(n,r,i){var s,o,u,a=n.data,f=n.url,l=n.jsonp!==!1,c=l&&zn.test(f),h=l&&!c&&typeof a=="string"&&!(n.contentType||"").indexOf("application/x-www-form-urlencoded")&&zn.test(a);if(n.dataTypes[0]==="jsonp"||c||h)return s=n.jsonpCallback=Y.isFunction(n.jsonpCallback)?n.jsonpCallback
  ():n.jsonpCallback,o=e[s],c?n.url=f.replace(zn,"$1"+s):h?n.data=a.replace(zn,"$1"+s):l&&(n.url+=(Un.test(f)?"&":"?")+n.jsonp+"="+s),n.converters["script json"]=function(){return u||Y.error(s+" was not called"),u[0]},n.dataTypes[0]="json",e[s]=function(){u=arguments},i.always(function(){e[s]=o,n[s]&&(n.jsonpCallback=r.jsonpCallback,Rn.push(s)),u&&Y.isFunction(o)&&o(u[0]),u=o=t}),"script"}),Y.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/javascript|ecmascript/},converters:{"text script":function(e){return Y.globalEval(e),e}}}),Y.ajaxPrefilter("script",function(e){e.cache===t&&(e.cache=!1),e.crossDomain&&(e.type="GET",e.global=!1)}),Y.ajaxTransport("script",function(e){if(e.crossDomain){var n,r=R.head||R.getElementsByTagName("head")[0]||R.documentElement;return{send:function(i,s){n=R.createElement("script"),n.async="async",e.scriptCharset&&(n.charset=e.scriptCharset),n.src=e.url,n.onload=n.onreadystatechange=function(e,i){
  if(i||!n.readyState||/loaded|complete/.test(n.readyState))n.onload=n.onreadystatechange=null,r&&n.parentNode&&r.removeChild(n),n=t,i||s(200,"success")},r.insertBefore(n,r.firstChild)},abort:function(){n&&n.onload(0,1)}}}});var Xn,Vn=e.ActiveXObject?function(){for(var e in Xn)Xn[e](0,1)}:!1,$n=0;Y.ajaxSettings.xhr=e.ActiveXObject?function(){return!this.isLocal&&A()||O()}:A,function(e){Y.extend(Y.support,{ajax:!!e,cors:!!e&&"withCredentials"in e})}(Y.ajaxSettings.xhr()),Y.support.ajax&&Y.ajaxTransport(function(n){if(!n.crossDomain||Y.support.cors){var r;return{send:function(i,s){var o,u,a=n.xhr();n.username?a.open(n.type,n.url,n.async,n.username,n.password):a.open(n.type,n.url,n.async);if(n.xhrFields)for(u in n.xhrFields)a[u]=n.xhrFields[u];n.mimeType&&a.overrideMimeType&&a.overrideMimeType(n.mimeType),!n.crossDomain&&!i["X-Requested-With"]&&(i["X-Requested-With"]="XMLHttpRequest");try{for(u in i)a.setRequestHeader(u,i[u])}catch(f){}a.send(n.hasContent&&n.data||null),r=function(e,i){var u,f,l,c,h;try{if(r&&(i||a
  .readyState===4)){r=t,o&&(a.onreadystatechange=Y.noop,Vn&&delete Xn[o]);if(i)a.readyState!==4&&a.abort();else{u=a.status,l=a.getAllResponseHeaders(),c={},h=a.responseXML,h&&h.documentElement&&(c.xml=h);try{c.text=a.responseText}catch(e){}try{f=a.statusText}catch(p){f=""}!u&&n.isLocal&&!n.crossDomain?u=c.text?200:404:u===1223&&(u=204)}}}catch(d){i||s(-1,d)}c&&s(u,f,c,l)},n.async?a.readyState===4?setTimeout(r,0):(o=++$n,Vn&&(Xn||(Xn={},Y(e).unload(Vn)),Xn[o]=r),a.onreadystatechange=r):r()},abort:function(){r&&r(0,1)}}}});var Jn,Kn,Qn=/^(?:toggle|show|hide)$/,Gn=new RegExp("^(?:([-+])=|)("+Z+")([a-z%]*)$","i"),Yn=/queueHooks$/,Zn=[H],er={"*":[function(e,t){var n,r,i,s=this.createTween(e,t),o=Gn.exec(t),u=s.cur(),a=+u||0,f=1;if(o){n=+o[2],r=o[3]||(Y.cssNumber[e]?"":"px");if(r!=="px"&&a){a=Y.css(s.elem,e,!0)||n||1;do i=f=f||".5",a/=f,Y.style(s.elem,e,a+r),f=s.cur()/u;while(f!==1&&f!==i)}s.unit=r,s.start=a,s.end=o[1]?a+(o[1]+1)*n:n}return s}]};Y.Animation=Y.extend(D,{tweener:function(e,t){Y.isFunction(e)?(t=e,e=["*"
  ]):e=e.split(" ");var n,r=0,i=e.length;for(;r<i;r++)n=e[r],er[n]=er[n]||[],er[n].unshift(t)},prefilter:function(e,t){t?Zn.unshift(e):Zn.push(e)}}),Y.Tween=B,B.prototype={constructor:B,init:function(e,t,n,r,i,s){this.elem=e,this.prop=n,this.easing=i||"swing",this.options=t,this.start=this.now=this.cur(),this.end=r,this.unit=s||(Y.cssNumber[n]?"":"px")},cur:function(){var e=B.propHooks[this.prop];return e&&e.get?e.get(this):B.propHooks._default.get(this)},run:function(e){var t,n=B.propHooks[this.prop];return this.options.duration?this.pos=t=Y.easing[this.easing](e,this.options.duration*e,0,1,this.options.duration):this.pos=t=e,this.now=(this.end-this.start)*t+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),n&&n.set?n.set(this):B.propHooks._default.set(this),this}},B.prototype.init.prototype=B.prototype,B.propHooks={_default:{get:function(e){var t;return e.elem[e.prop]==null||!!e.elem.style&&e.elem.style[e.prop]!=null?(t=Y.css(e.elem,e.prop,!1,""),!t||t==="auto"?0:t):e.elem[e.prop]},
  set:function(e){Y.fx.step[e.prop]?Y.fx.step[e.prop](e):e.elem.style&&(e.elem.style[Y.cssProps[e.prop]]!=null||Y.cssHooks[e.prop])?Y.style(e.elem,e.prop,e.now+e.unit):e.elem[e.prop]=e.now}}},B.propHooks.scrollTop=B.propHooks.scrollLeft={set:function(e){e.elem.nodeType&&e.elem.parentNode&&(e.elem[e.prop]=e.now)}},Y.each(["toggle","show","hide"],function(e,t){var n=Y.fn[t];Y.fn[t]=function(r,i,s){return r==null||typeof r=="boolean"||!e&&Y.isFunction(r)&&Y.isFunction(i)?n.apply(this,arguments):this.animate(j(t,!0),r,i,s)}}),Y.fn.extend({fadeTo:function(e,t,n,r){return this.filter(g).css("opacity",0).show().end().animate({opacity:t},e,n,r)},animate:function(e,t,n,r){var i=Y.isEmptyObject(e),s=Y.speed(t,n,r),o=function(){var t=D(this,Y.extend({},e),s);i&&t.stop(!0)};return i||s.queue===!1?this.each(o):this.queue(s.queue,o)},stop:function(e,n,r){var i=function(e){var t=e.stop;delete e.stop,t(r)};return typeof e!="string"&&(r=n,n=e,e=t),n&&e!==!1&&this.queue(e||"fx",[]),this.each(function(){var t=!0,n=e!=null&&e+"queueHooks"
  ,s=Y.timers,o=Y._data(this);if(n)o[n]&&o[n].stop&&i(o[n]);else for(n in o)o[n]&&o[n].stop&&Yn.test(n)&&i(o[n]);for(n=s.length;n--;)s[n].elem===this&&(e==null||s[n].queue===e)&&(s[n].anim.stop(r),t=!1,s.splice(n,1));(t||!r)&&Y.dequeue(this,e)})}}),Y.each({slideDown:j("show"),slideUp:j("hide"),slideToggle:j("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(e,t){Y.fn[e]=function(e,n,r){return this.animate(t,e,n,r)}}),Y.speed=function(e,t,n){var r=e&&typeof e=="object"?Y.extend({},e):{complete:n||!n&&t||Y.isFunction(e)&&e,duration:e,easing:n&&t||t&&!Y.isFunction(t)&&t};r.duration=Y.fx.off?0:typeof r.duration=="number"?r.duration:r.duration in Y.fx.speeds?Y.fx.speeds[r.duration]:Y.fx.speeds._default;if(r.queue==null||r.queue===!0)r.queue="fx";return r.old=r.complete,r.complete=function(){Y.isFunction(r.old)&&r.old.call(this),r.queue&&Y.dequeue(this,r.queue)},r},Y.easing={linear:function(e){return e},swing:function(e){return.5-Math.cos(e*Math.PI)/2}},Y.timers=[],Y.fx=
  B.prototype.init,Y.fx.tick=function(){var e,t=Y.timers,n=0;for(;n<t.length;n++)e=t[n],!e()&&t[n]===e&&t.splice(n--,1);t.length||Y.fx.stop()},Y.fx.timer=function(e){e()&&Y.timers.push(e)&&!Kn&&(Kn=setInterval(Y.fx.tick,Y.fx.interval))},Y.fx.interval=13,Y.fx.stop=function(){clearInterval(Kn),Kn=null},Y.fx.speeds={slow:600,fast:200,_default:400},Y.fx.step={},Y.expr&&Y.expr.filters&&(Y.expr.filters.animated=function(e){return Y.grep(Y.timers,function(t){return e===t.elem}).length});var tr=/^(?:body|html)$/i;Y.fn.offset=function(e){if(arguments.length)return e===t?this:this.each(function(t){Y.offset.setOffset(this,e,t)});var n,r,i,s,o,u,a,f,l,c,h=this[0],p=h&&h.ownerDocument;if(!p)return;return(i=p.body)===h?Y.offset.bodyOffset(h):(r=p.documentElement,Y.contains(r,h)?(n=h.getBoundingClientRect(),s=F(p),o=r.clientTop||i.clientTop||0,u=r.clientLeft||i.clientLeft||0,a=s.pageYOffset||r.scrollTop,f=s.pageXOffset||r.scrollLeft,l=n.top+a-o,c=n.left+f-u,{top:l,left:c}):{top:0,left:0})},Y.offset={bodyOffset:function(e){var t=
  e.offsetTop,n=e.offsetLeft;return Y.support.doesNotIncludeMarginInBodyOffset&&(t+=parseFloat(Y.css(e,"marginTop"))||0,n+=parseFloat(Y.css(e,"marginLeft"))||0),{top:t,left:n}},setOffset:function(e,t,n){var r=Y.css(e,"position");r==="static"&&(e.style.position="relative");var i=Y(e),s=i.offset(),o=Y.css(e,"top"),u=Y.css(e,"left"),a=(r==="absolute"||r==="fixed")&&Y.inArray("auto",[o,u])>-1,f={},l={},c,h;a?(l=i.position(),c=l.top,h=l.left):(c=parseFloat(o)||0,h=parseFloat(u)||0),Y.isFunction(t)&&(t=t.call(e,n,s)),t.top!=null&&(f.top=t.top-s.top+c),t.left!=null&&(f.left=t.left-s.left+h),"using"in t?t.using.call(e,f):i.css(f)}},Y.fn.extend({position:function(){if(!this[0])return;var e=this[0],t=this.offsetParent(),n=this.offset(),r=tr.test(t[0].nodeName)?{top:0,left:0}:t.offset();return n.top-=parseFloat(Y.css(e,"marginTop"))||0,n.left-=parseFloat(Y.css(e,"marginLeft"))||0,r.top+=parseFloat(Y.css(t[0],"borderTopWidth"))||0,r.left+=parseFloat(Y.css(t[0],"borderLeftWidth"))||0,{top:n.top-r.top,left:n.left-r.left}},offsetParent
  :function(){return this.map(function(){var e=this.offsetParent||R.body;while(e&&!tr.test(e.nodeName)&&Y.css(e,"position")==="static")e=e.offsetParent;return e||R.body})}}),Y.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(e,n){var r=/Y/.test(n);Y.fn[e]=function(i){return Y.access(this,function(e,i,s){var o=F(e);if(s===t)return o?n in o?o[n]:o.document.documentElement[i]:e[i];o?o.scrollTo(r?Y(o).scrollLeft():s,r?s:Y(o).scrollTop()):e[i]=s},e,i,arguments.length,null)}}),Y.each({Height:"height",Width:"width"},function(e,n){Y.each({padding:"inner"+e,content:n,"":"outer"+e},function(r,i){Y.fn[i]=function(i,s){var o=arguments.length&&(r||typeof i!="boolean"),u=r||(i===!0||s===!0?"margin":"border");return Y.access(this,function(n,r,i){var s;return Y.isWindow(n)?n.document.documentElement["client"+e]:n.nodeType===9?(s=n.documentElement,Math.max(n.body["scroll"+e],s["scroll"+e],n.body["offset"+e],s["offset"+e],s["client"+e])):i===t?Y.css(n,r,i,u):Y.style(n,r,i,u)},n,o?i:t,o,null)}})}),e.jQuery=e.$=Y,typeof 
  define=="function"&&define.amd&&define.amd.jQuery&&define("jquery",[],function(){return Y})})(window);var dat=dat||{};dat.gui=dat.gui||{},dat.utils=dat.utils||{},dat.controllers=dat.controllers||{},dat.dom=dat.dom||{},dat.color=dat.color||{},dat.utils.css=function(){return{load:function(e,t){var t=t||document,n=t.createElement("link");n.type="text/css",n.rel="stylesheet",n.href=e,t.getElementsByTagName("head")[0].appendChild(n)},inject:function(e,t){var t=t||document,n=document.createElement("style");n.type="text/css",n.innerHTML=e,t.getElementsByTagName("head")[0].appendChild(n)}}}(),dat.utils.common=function(){var e=Array.prototype.forEach,t=Array.prototype.slice;return{BREAK:{},extend:function(e){return this.each(t.call(arguments,1),function(t){for(var n in t)this.isUndefined(t[n])||(e[n]=t[n])},this),e},defaults:function(e){return this.each(t.call(arguments,1),function(t){for(var n in t)this.isUndefined(e[n])&&(e[n]=t[n])},this),e},compose:function(){var e=t.call(arguments);return function(){for(var n=t.call
  (arguments),r=e.length-1;r>=0;r--)n=[e[r].apply(this,n)];return n[0]}},each:function(t,n,r){if(e&&t.forEach===e)t.forEach(n,r);else if(t.length===t.length+0){for(var i=0,s=t.length;i<s;i++)if(i in t&&n.call(r,t[i],i)===this.BREAK)break}else for(i in t)if(n.call(r,t[i],i)===this.BREAK)break},defer:function(e){setTimeout(e,0)},toArray:function(e){return e.toArray?e.toArray():t.call(e)},isUndefined:function(e){return e===void 0},isNull:function(e){return e===null},isNaN:function(e){return e!==e},isArray:Array.isArray||function(e){return e.constructor===Array},isObject:function(e){return e===Object(e)},isNumber:function(e){return e===e+0},isString:function(e){return e===e+""},isBoolean:function(e){return e===!1||e===!0},isFunction:function(e){return Object.prototype.toString.call(e)==="[object Function]"}}}(),dat.controllers.Controller=function(e){var t=function(e,t){this.initialValue=e[t],this.domElement=document.createElement("div"),this.object=e,this.property=t,this.__onFinishChange=this.__onChange=void 0};return e
  .extend(t.prototype,{onChange:function(e){return this.__onChange=e,this},onFinishChange:function(e){return this.__onFinishChange=e,this},setValue:function(e){return this.object[this.property]=e,this.__onChange&&this.__onChange.call(this,e),this.updateDisplay(),this},getValue:function(){return this.object[this.property]},updateDisplay:function(){return this},isModified:function(){return this.initialValue!==this.getValue()}}),t}(dat.utils.common),dat.dom.dom=function(e){function t(t){return t==="0"||e.isUndefined(t)?0:(t=t.match(r),e.isNull(t)?0:parseFloat(t[1]))}var n={};e.each({HTMLEvents:["change"],MouseEvents:["click","mousemove","mousedown","mouseup","mouseover"],KeyboardEvents:["keydown"]},function(t,r){e.each(t,function(e){n[e]=r})});var r=/(\d+(\.\d+)?)px/,i={makeSelectable:function(e,t){e!==void 0&&e.style!==void 0&&(e.onselectstart=t?function(){return!1}:function(){},e.style.MozUserSelect=t?"auto":"none",e.style.KhtmlUserSelect=t?"auto":"none",e.unselectable=t?"on":"off")},makeFullscreen:function(t,n,r
  ){e.isUndefined(n)&&(n=!0),e.isUndefined(r)&&(r=!0),t.style.position="absolute",n&&(t.style.left=0,t.style.right=0),r&&(t.style.top=0,t.style.bottom=0)},fakeEvent:function(t,r,i,s){var i=i||{},o=n[r];if(!o)throw Error("Event type "+r+" not supported.");var u=document.createEvent(o);switch(o){case"MouseEvents":u.initMouseEvent(r,i.bubbles||!1,i.cancelable||!0,window,i.clickCount||1,0,0,i.x||i.clientX||0,i.y||i.clientY||0,!1,!1,!1,!1,0,null);break;case"KeyboardEvents":o=u.initKeyboardEvent||u.initKeyEvent,e.defaults(i,{cancelable:!0,ctrlKey:!1,altKey:!1,shiftKey:!1,metaKey:!1,keyCode:void 0,charCode:void 0}),o(r,i.bubbles||!1,i.cancelable,window,i.ctrlKey,i.altKey,i.shiftKey,i.metaKey,i.keyCode,i.charCode);break;default:u.initEvent(r,i.bubbles||!1,i.cancelable||!0)}e.defaults(u,s),t.dispatchEvent(u)},bind:function(e,t,n,r){return e.addEventListener?e.addEventListener(t,n,r||!1):e.attachEvent&&e.attachEvent("on"+t,n),i},unbind:function(e,t,n,r){return e.removeEventListener?e.removeEventListener(t,n,r||!1):e.detachEvent&&
  e.detachEvent("on"+t,n),i},addClass:function(e,t){if(e.className===void 0)e.className=t;else if(e.className!==t){var n=e.className.split(/ +/);n.indexOf(t)==-1&&(n.push(t),e.className=n.join(" ").replace(/^\s+/,"").replace(/\s+$/,""))}return i},removeClass:function(e,t){if(t){if(e.className!==void 0)if(e.className===t)e.removeAttribute("class");else{var n=e.className.split(/ +/),r=n.indexOf(t);r!=-1&&(n.splice(r,1),e.className=n.join(" "))}}else e.className=void 0;return i},hasClass:function(e,t){return RegExp("(?:^|\\s+)"+t+"(?:\\s+|$)").test(e.className)||!1},getWidth:function(e){return e=getComputedStyle(e),t(e["border-left-width"])+t(e["border-right-width"])+t(e["padding-left"])+t(e["padding-right"])+t(e.width)},getHeight:function(e){return e=getComputedStyle(e),t(e["border-top-width"])+t(e["border-bottom-width"])+t(e["padding-top"])+t(e["padding-bottom"])+t(e.height)},getOffset:function(e){var t={left:0,top:0};if(e.offsetParent)do t.left+=e.offsetLeft,t.top+=e.offsetTop;while(e=e.offsetParent);return t},isActive
  :function(e){return e===document.activeElement&&(e.type||e.href)}};return i}(dat.utils.common),dat.controllers.OptionController=function(e,t,n){var r=function(e,i,s){r.superclass.call(this,e,i);var o=this;this.__select=document.createElement("select");if(n.isArray(s)){var u={};n.each(s,function(e){u[e]=e}),s=u}n.each(s,function(e,t){var n=document.createElement("option");n.innerHTML=t,n.setAttribute("value",e),o.__select.appendChild(n)}),this.updateDisplay(),t.bind(this.__select,"change",function(){o.setValue(this.options[this.selectedIndex].value)}),this.domElement.appendChild(this.__select)};return r.superclass=e,n.extend(r.prototype,e.prototype,{setValue:function(e){return e=r.superclass.prototype.setValue.call(this,e),this.__onFinishChange&&this.__onFinishChange.call(this,this.getValue()),e},updateDisplay:function(){return this.__select.value=this.getValue(),r.superclass.prototype.updateDisplay.call(this)}}),r}(dat.controllers.Controller,dat.dom.dom,dat.utils.common),dat.controllers.NumberController=function(
  e,t){var n=function(e,r,i){n.superclass.call(this,e,r),i=i||{},this.__min=i.min,this.__max=i.max,this.__step=i.step,e=this.__impliedStep=t.isUndefined(this.__step)?this.initialValue==0?1:Math.pow(10,Math.floor(Math.log(this.initialValue)/Math.LN10))/10:this.__step,e=e.toString(),this.__precision=e.indexOf(".")>-1?e.length-e.indexOf(".")-1:0};return n.superclass=e,t.extend(n.prototype,e.prototype,{setValue:function(e){return this.__min!==void 0&&e<this.__min?e=this.__min:this.__max!==void 0&&e>this.__max&&(e=this.__max),this.__step!==void 0&&e%this.__step!=0&&(e=Math.round(e/this.__step)*this.__step),n.superclass.prototype.setValue.call(this,e)},min:function(e){return this.__min=e,this},max:function(e){return this.__max=e,this},step:function(e){return this.__step=e,this}}),n}(dat.controllers.Controller,dat.utils.common),dat.controllers.NumberControllerBox=function(e,t,n){var r=function(e,i,s){function o(){var e=parseFloat(l.__input.value);n.isNaN(e)||l.setValue(e)}function u(e){var t=h-e.clientY;l.setValue(l.getValue
  ()+t*l.__impliedStep),h=e.clientY}function f(){t.unbind(window,"mousemove",u),t.unbind(window,"mouseup",f)}this.__truncationSuspended=!1,r.superclass.call(this,e,i,s);var l=this,h;this.__input=document.createElement("input"),this.__input.setAttribute("type","text"),t.bind(this.__input,"change",o),t.bind(this.__input,"blur",function(){o(),l.__onFinishChange&&l.__onFinishChange.call(l,l.getValue())}),t.bind(this.__input,"mousedown",function(e){t.bind(window,"mousemove",u),t.bind(window,"mouseup",f),h=e.clientY}),t.bind(this.__input,"keydown",function(e){e.keyCode===13&&(l.__truncationSuspended=!0,this.blur(),l.__truncationSuspended=!1)}),this.updateDisplay(),this.domElement.appendChild(this.__input)};return r.superclass=e,n.extend(r.prototype,e.prototype,{updateDisplay:function(){var e=this.__input,t;if(this.__truncationSuspended)t=this.getValue();else{t=this.getValue();var n=Math.pow(10,this.__precision);t=Math.round(t*n)/n}return e.value=t,r.superclass.prototype.updateDisplay.call(this)}}),r}(dat.controllers.NumberController
  ,dat.dom.dom,dat.utils.common),dat.controllers.NumberControllerSlider=function(e,t,n,r,i){var s=function(e,n,r,i,o){function u(e){e.preventDefault();var n=t.getOffset(l.__background),r=t.getWidth(l.__background);return l.setValue(l.__min+(l.__max-l.__min)*((e.clientX-n.left)/(n.left+r-n.left))),!1}function f(){t.unbind(window,"mousemove",u),t.unbind(window,"mouseup",f),l.__onFinishChange&&l.__onFinishChange.call(l,l.getValue())}s.superclass.call(this,e,n,{min:r,max:i,step:o});var l=this;this.__background=document.createElement("div"),this.__foreground=document.createElement("div"),t.bind(this.__background,"mousedown",function(e){t.bind(window,"mousemove",u),t.bind(window,"mouseup",f),u(e)}),t.addClass(this.__background,"slider"),t.addClass(this.__foreground,"slider-fg"),this.updateDisplay(),this.__background.appendChild(this.__foreground),this.domElement.appendChild(this.__background)};return s.superclass=e,s.useDefaultStyles=function(){n.inject(i)},r.extend(s.prototype,e.prototype,{updateDisplay:function(){return this
  .__foreground.style.width=(this.getValue()-this.__min)/(this.__max-this.__min)*100+"%",s.superclass.prototype.updateDisplay.call(this)}}),s}(dat.controllers.NumberController,dat.dom.dom,dat.utils.css,dat.utils.common,".slider {\n  box-shadow: inset 0 2px 4px rgba(0,0,0,0.15);\n  height: 1em;\n  border-radius: 1em;\n  background-color: #eee;\n  padding: 0 0.5em;\n  overflow: hidden;\n}\n\n.slider-fg {\n  padding: 1px 0 2px 0;\n  background-color: #aaa;\n  height: 1em;\n  margin-left: -0.5em;\n  padding-right: 0.5em;\n  border-radius: 1em 0 0 1em;\n}\n\n.slider-fg:after {\n  display: inline-block;\n  border-radius: 1em;\n  background-color: #fff;\n  border:  1px solid #aaa;\n  content: '';\n  float: right;\n  margin-right: -1em;\n  margin-top: -1px;\n  height: 0.9em;\n  width: 0.9em;\n}"),dat.controllers.FunctionController=function(e,t,n){var r=function(e,n,i){r.superclass.call(this,e,n);var s=this;this.__button=document.createElement("div"),this.__button.innerHTML=i===void 0?"Fire":i,t.bind(this.__button,"click"
  ,function(e){return e.preventDefault(),s.fire(),!1}),t.addClass(this.__button,"button"),this.domElement.appendChild(this.__button)};return r.superclass=e,n.extend(r.prototype,e.prototype,{fire:function(){this.__onChange&&this.__onChange.call(this),this.__onFinishChange&&this.__onFinishChange.call(this,this.getValue()),this.getValue().call(this.object)}}),r}(dat.controllers.Controller,dat.dom.dom,dat.utils.common),dat.controllers.BooleanController=function(e,t,n){var r=function(e,n){r.superclass.call(this,e,n);var i=this;this.__prev=this.getValue(),this.__checkbox=document.createElement("input"),this.__checkbox.setAttribute("type","checkbox"),t.bind(this.__checkbox,"change",function(){i.setValue(!i.__prev)},!1),this.domElement.appendChild(this.__checkbox),this.updateDisplay()};return r.superclass=e,n.extend(r.prototype,e.prototype,{setValue:function(e){return e=r.superclass.prototype.setValue.call(this,e),this.__onFinishChange&&this.__onFinishChange.call(this,this.getValue()),this.__prev=this.getValue(),e},updateDisplay
  :function(){return this.getValue()===!0?(this.__checkbox.setAttribute("checked","checked"),this.__checkbox.checked=!0):this.__checkbox.checked=!1,r.superclass.prototype.updateDisplay.call(this)}}),r}(dat.controllers.Controller,dat.dom.dom,dat.utils.common),dat.color.toString=function(e){return function(t){if(t.a==1||e.isUndefined(t.a)){for(t=t.hex.toString(16);t.length<6;)t="0"+t;return"#"+t}return"rgba("+Math.round(t.r)+","+Math.round(t.g)+","+Math.round(t.b)+","+t.a+")"}}(dat.utils.common),dat.color.interpret=function(e,t){var n,r,i=[{litmus:t.isString,conversions:{THREE_CHAR_HEX:{read:function(e){return e=e.match(/^#([A-F0-9])([A-F0-9])([A-F0-9])$/i),e===null?!1:{space:"HEX",hex:parseInt("0x"+e[1].toString()+e[1].toString()+e[2].toString()+e[2].toString()+e[3].toString()+e[3].toString())}},write:e},SIX_CHAR_HEX:{read:function(e){return e=e.match(/^#([A-F0-9]{6})$/i),e===null?!1:{space:"HEX",hex:parseInt("0x"+e[1].toString())}},write:e},CSS_RGB:{read:function(e){return e=e.match(/^rgb\(\s*(.+)\s*,\s*(.+)\s*,\s*(.+)\s*\)/
  ),e===null?!1:{space:"RGB",r:parseFloat(e[1]),g:parseFloat(e[2]),b:parseFloat(e[3])}},write:e},CSS_RGBA:{read:function(e){return e=e.match(/^rgba\(\s*(.+)\s*,\s*(.+)\s*,\s*(.+)\s*\,\s*(.+)\s*\)/),e===null?!1:{space:"RGB",r:parseFloat(e[1]),g:parseFloat(e[2]),b:parseFloat(e[3]),a:parseFloat(e[4])}},write:e}}},{litmus:t.isNumber,conversions:{HEX:{read:function(e){return{space:"HEX",hex:e,conversionName:"HEX"}},write:function(e){return e.hex}}}},{litmus:t.isArray,conversions:{RGB_ARRAY:{read:function(e){return e.length!=3?!1:{space:"RGB",r:e[0],g:e[1],b:e[2]}},write:function(e){return[e.r,e.g,e.b]}},RGBA_ARRAY:{read:function(e){return e.length!=4?!1:{space:"RGB",r:e[0],g:e[1],b:e[2],a:e[3]}},write:function(e){return[e.r,e.g,e.b,e.a]}}}},{litmus:t.isObject,conversions:{RGBA_OBJ:{read:function(e){return t.isNumber(e.r)&&t.isNumber(e.g)&&t.isNumber(e.b)&&t.isNumber(e.a)?{space:"RGB",r:e.r,g:e.g,b:e.b,a:e.a}:!1},write:function(e){return{r:e.r,g:e.g,b:e.b,a:e.a}}},RGB_OBJ:{read:function(e){return t.isNumber(e.r)&&t.isNumber
  (e.g)&&t.isNumber(e.b)?{space:"RGB",r:e.r,g:e.g,b:e.b}:!1},write:function(e){return{r:e.r,g:e.g,b:e.b}}},HSVA_OBJ:{read:function(e){return t.isNumber(e.h)&&t.isNumber(e.s)&&t.isNumber(e.v)&&t.isNumber(e.a)?{space:"HSV",h:e.h,s:e.s,v:e.v,a:e.a}:!1},write:function(e){return{h:e.h,s:e.s,v:e.v,a:e.a}}},HSV_OBJ:{read:function(e){return t.isNumber(e.h)&&t.isNumber(e.s)&&t.isNumber(e.v)?{space:"HSV",h:e.h,s:e.s,v:e.v}:!1},write:function(e){return{h:e.h,s:e.s,v:e.v}}}}}];return function(){r=!1;var e=arguments.length>1?t.toArray(arguments):arguments[0];return t.each(i,function(i){if(i.litmus(e))return t.each(i.conversions,function(i,s){n=i.read(e);if(r===!1&&n!==!1)return r=n,n.conversionName=s,n.conversion=i,t.BREAK}),t.BREAK}),r}}(dat.color.toString,dat.utils.common),dat.GUI=dat.gui.GUI=function(e,t,n,r,i,s,o,u,a,f,l,c,h,p,d){function v(e,t,n,s){if(t[n]===void 0)throw Error("Object "+t+' has no property "'+n+'"');s.color?t=new l(t,n):(t=[t,n].concat(s.factoryArgs),t=r.apply(e,t)),s.before instanceof i&&(s.before=s.before
  .__li),y(e,t),p.addClass(t.domElement,"c"),n=document.createElement("span"),p.addClass(n,"property-name"),n.innerHTML=t.property;var o=document.createElement("div");return o.appendChild(n),o.appendChild(t.domElement),s=m(e,o,s.before),p.addClass(s,P.CLASS_CONTROLLER_ROW),p.addClass(s,typeof t.getValue()),g(e,s,t),e.__controllers.push(t),t}function m(e,t,n){var r=document.createElement("li");return t&&r.appendChild(t),n?e.__ul.insertBefore(r,params.before):e.__ul.appendChild(r),e.onResize(),r}function g(e,t,n){n.__li=t,n.__gui=e,d.extend(n,{options:function(t){if(arguments.length>1)return n.remove(),v(e,n.object,n.property,{before:n.__li.nextElementSibling,factoryArgs:[d.toArray(arguments)]});if(d.isArray(t)||d.isObject(t))return n.remove(),v(e,n.object,n.property,{before:n.__li.nextElementSibling,factoryArgs:[t]})},name:function(e){return n.__li.firstElementChild.firstElementChild.innerHTML=e,n},listen:function(){return n.__gui.listen(n),n},remove:function(){return n.__gui.remove(n),n}});if(n instanceof a){var r=new 
  u(n.object,n.property,{min:n.__min,max:n.__max,step:n.__step});d.each(["updateDisplay","onChange","onFinishChange"],function(e){var t=n[e],i=r[e];n[e]=r[e]=function(){var e=Array.prototype.slice.call(arguments);return t.apply(n,e),i.apply(r,e)}}),p.addClass(t,"has-slider"),n.domElement.insertBefore(r.domElement,n.domElement.firstElementChild)}else if(n instanceof u){var i=function(t){return d.isNumber(n.__min)&&d.isNumber(n.__max)?(n.remove(),v(e,n.object,n.property,{before:n.__li.nextElementSibling,factoryArgs:[n.__min,n.__max,n.__step]})):t};n.min=d.compose(i,n.min),n.max=d.compose(i,n.max)}else n instanceof s?(p.bind(t,"click",function(){p.fakeEvent(n.__checkbox,"click")}),p.bind(n.__checkbox,"click",function(e){e.stopPropagation()})):n instanceof o?(p.bind(t,"click",function(){p.fakeEvent(n.__button,"click")}),p.bind(t,"mouseover",function(){p.addClass(n.__button,"hover")}),p.bind(t,"mouseout",function(){p.removeClass(n.__button,"hover")})):n instanceof l&&(p.addClass(t,"color"),n.updateDisplay=d.compose(function(
  e){return t.style.borderLeftColor=n.__color.toString(),e},n.updateDisplay),n.updateDisplay());n.setValue=d.compose(function(t){return e.getRoot().__preset_select&&n.isModified()&&T(e.getRoot(),!0),t},n.setValue)}function y(e,t){var n=e.getRoot(),r=n.__rememberedObjects.indexOf(t.object);if(r!=-1){var i=n.__rememberedObjectIndecesToControllers[r];i===void 0&&(i={},n.__rememberedObjectIndecesToControllers[r]=i),i[t.property]=t;if(n.load&&n.load.remembered){n=n.load.remembered;if(n[e.preset])n=n[e.preset];else{if(!n[C])return;n=n[C]}n[r]&&n[r][t.property]!==void 0&&(r=n[r][t.property],t.initialValue=r,t.setValue(r))}}}function b(e){var t=e.__save_row=document.createElement("li");p.addClass(e.domElement,"has-save"),e.__ul.insertBefore(t,e.__ul.firstChild),p.addClass(t,"save-row");var n=document.createElement("span");n.innerHTML="&nbsp;",p.addClass(n,"button gears");var r=document.createElement("span");r.innerHTML="Save",p.addClass(r,"button"),p.addClass(r,"save");var i=document.createElement("span");i.innerHTML="New"
  ,p.addClass(i,"button"),p.addClass(i,"save-as");var s=document.createElement("span");s.innerHTML="Revert",p.addClass(s,"button"),p.addClass(s,"revert");var o=e.__preset_select=document.createElement("select");e.load&&e.load.remembered?d.each(e.load.remembered,function(t,n){x(e,n,n==e.preset)}):x(e,C,!1),p.bind(o,"change",function(){for(var t=0;t<e.__preset_select.length;t++)e.__preset_select[t].innerHTML=e.__preset_select[t].value;e.preset=this.value}),t.appendChild(o),t.appendChild(n),t.appendChild(r),t.appendChild(i),t.appendChild(s);if(k){var t=document.getElementById("dg-save-locally"),u=document.getElementById("dg-local-explain");t.style.display="block",t=document.getElementById("dg-local-storage"),localStorage.getItem(document.location.href+".isLocal")==="true"&&t.setAttribute("checked","checked");var a=function(){u.style.display=e.useLocalStorage?"block":"none"};a(),p.bind(t,"change",function(){e.useLocalStorage=!e.useLocalStorage,a()})}var f=document.getElementById("dg-new-constructor");p.bind(f,"keydown"
  ,function(e){e.metaKey&&(e.which===67||e.keyCode==67)&&A.hide()}),p.bind(n,"click",function(){f.innerHTML=JSON.stringify(e.getSaveObject(),void 0,2),A.show(),f.focus(),f.select()}),p.bind(r,"click",function(){e.save()}),p.bind(i,"click",function(){var t=prompt("Enter a new preset name.");t&&e.saveAs(t)}),p.bind(s,"click",function(){e.revert()})}function w(e){function t(t){return t.preventDefault(),i=t.clientX,p.addClass(e.__closeButton,P.CLASS_DRAG),p.bind(window,"mousemove",n),p.bind(window,"mouseup",r),!1}function n(t){return t.preventDefault(),e.width+=i-t.clientX,e.onResize(),i=t.clientX,!1}function r(){p.removeClass(e.__closeButton,P.CLASS_DRAG),p.unbind(window,"mousemove",n),p.unbind(window,"mouseup",r)}e.__resize_handle=document.createElement("div"),d.extend(e.__resize_handle.style,{width:"6px",marginLeft:"-3px",height:"200px",cursor:"ew-resize",position:"absolute"});var i;p.bind(e.__resize_handle,"mousedown",t),p.bind(e.__closeButton,"mousedown",t),e.domElement.insertBefore(e.__resize_handle,e.domElement
  .firstElementChild)}function E(e,t){e.domElement.style.width=t+"px",e.__save_row&&e.autoPlace&&(e.__save_row.style.width=t+"px"),e.__closeButton&&(e.__closeButton.style.width=t+"px")}function S(e,t){var n={};return d.each(e.__rememberedObjects,function(r,i){var s={};d.each(e.__rememberedObjectIndecesToControllers[i],function(e,n){s[n]=t?e.initialValue:e.getValue()}),n[i]=s}),n}function x(e,t,n){var r=document.createElement("option");r.innerHTML=t,r.value=t,e.__preset_select.appendChild(r),n&&(e.__preset_select.selectedIndex=e.__preset_select.length-1)}function T(e,t){var n=e.__preset_select[e.__preset_select.selectedIndex];n.innerHTML=t?n.value+"*":n.value}function N(e){e.length!=0&&c(function(){N(e)}),d.each(e,function(e){e.updateDisplay()})}e.inject(n);var C="Default",k;try{k="localStorage"in window&&window.localStorage!==null}catch(L){k=!1}var A,O=!0,M,_=!1,D=[],P=function(e){function t(){localStorage.setItem(document.location.href+".gui",JSON.stringify(r.getSaveObject()))}function n(){var e=r.getRoot();e.width+=1
  ,d.defer(function(){e.width-=1})}var r=this;this.domElement=document.createElement("div"),this.__ul=document.createElement("ul"),this.domElement.appendChild(this.__ul),p.addClass(this.domElement,"dg"),this.__folders={},this.__controllers=[],this.__rememberedObjects=[],this.__rememberedObjectIndecesToControllers=[],this.__listening=[],e=e||{},e=d.defaults(e,{autoPlace:!0,width:P.DEFAULT_WIDTH}),e=d.defaults(e,{resizable:e.autoPlace,hideable:e.autoPlace}),d.isUndefined(e.load)?e.load={preset:C}:e.preset&&(e.load.preset=e.preset),d.isUndefined(e.parent)&&e.hideable&&D.push(this),e.resizable=d.isUndefined(e.parent)&&e.resizable,e.autoPlace&&d.isUndefined(e.scrollable)&&(e.scrollable=!0);var i=k&&localStorage.getItem(document.location.href+".isLocal")==="true";Object.defineProperties(this,{parent:{get:function(){return e.parent}},scrollable:{get:function(){return e.scrollable}},autoPlace:{get:function(){return e.autoPlace}},preset:{get:function(){return r.parent?r.getRoot().preset:e.load.preset},set:function(t){r.parent?
  r.getRoot().preset=t:e.load.preset=t;for(t=0;t<this.__preset_select.length;t++)this.__preset_select[t].value==this.preset&&(this.__preset_select.selectedIndex=t);r.revert()}},width:{get:function(){return e.width},set:function(t){e.width=t,E(r,t)}},name:{get:function(){return e.name},set:function(t){e.name=t,o&&(o.innerHTML=e.name)}},closed:{get:function(){return e.closed},set:function(t){e.closed=t,e.closed?p.addClass(r.__ul,P.CLASS_CLOSED):p.removeClass(r.__ul,P.CLASS_CLOSED),this.onResize(),r.__closeButton&&(r.__closeButton.innerHTML=t?P.TEXT_OPEN:P.TEXT_CLOSED)}},load:{get:function(){return e.load}},useLocalStorage:{get:function(){return i},set:function(e){k&&((i=e)?p.bind(window,"unload",t):p.unbind(window,"unload",t),localStorage.setItem(document.location.href+".isLocal",e))}}});if(d.isUndefined(e.parent)){e.closed=!1,p.addClass(this.domElement,P.CLASS_MAIN),p.makeSelectable(this.domElement,!1);if(k&&i){r.useLocalStorage=!0;var s=localStorage.getItem(document.location.href+".gui");s&&(e.load=JSON.parse(s)
  )}this.__closeButton=document.createElement("div"),this.__closeButton.innerHTML=P.TEXT_CLOSED,p.addClass(this.__closeButton,P.CLASS_CLOSE_BUTTON),this.domElement.appendChild(this.__closeButton),p.bind(this.__closeButton,"click",function(){r.closed=!r.closed})}else{e.closed===void 0&&(e.closed=!0);var o=document.createTextNode(e.name);p.addClass(o,"controller-name"),s=m(r,o),p.addClass(this.__ul,P.CLASS_CLOSED),p.addClass(s,"title"),p.bind(s,"click",function(e){return e.preventDefault(),r.closed=!r.closed,!1}),e.closed||(this.closed=!1)}e.autoPlace&&(d.isUndefined(e.parent)&&(O&&(M=document.createElement("div"),p.addClass(M,"dg"),p.addClass(M,P.CLASS_AUTO_PLACE_CONTAINER),document.body.appendChild(M),O=!1),M.appendChild(this.domElement),p.addClass(this.domElement,P.CLASS_AUTO_PLACE)),this.parent||E(r,e.width)),p.bind(window,"resize",function(){r.onResize()}),p.bind(this.__ul,"webkitTransitionEnd",function(){r.onResize()}),p.bind(this.__ul,"transitionend",function(){r.onResize()}),p.bind(this.__ul,"oTransitionEnd"
  ,function(){r.onResize()}),this.onResize(),e.resizable&&w(this),r.getRoot(),e.parent||n()};return P.toggleHide=function(){_=!_,d.each(D,function(e){e.domElement.style.zIndex=_?-999:999,e.domElement.style.opacity=_?0:1})},P.CLASS_AUTO_PLACE="a",P.CLASS_AUTO_PLACE_CONTAINER="ac",P.CLASS_MAIN="main",P.CLASS_CONTROLLER_ROW="cr",P.CLASS_TOO_TALL="taller-than-window",P.CLASS_CLOSED="closed",P.CLASS_CLOSE_BUTTON="close-button",P.CLASS_DRAG="drag",P.DEFAULT_WIDTH=245,P.TEXT_CLOSED="Close Controls",P.TEXT_OPEN="Open Controls",p.bind(window,"keydown",function(e){document.activeElement.type!=="text"&&(e.which===72||e.keyCode==72)&&P.toggleHide()},!1),d.extend(P.prototype,{add:function(e,t){return v(this,e,t,{factoryArgs:Array.prototype.slice.call(arguments,2)})},addColor:function(e,t){return v(this,e,t,{color:!0})},remove:function(e){this.__ul.removeChild(e.__li),this.__controllers.slice(this.__controllers.indexOf(e),1);var t=this;d.defer(function(){t.onResize()})},destroy:function(){this.autoPlace&&M.removeChild(this.domElement
  )},addFolder:function(e){if(this.__folders[e]!==void 0)throw Error('You already have a folder in this GUI by the name "'+e+'"');var t={name:e,parent:this};return t.autoPlace=this.autoPlace,this.load&&this.load.folders&&this.load.folders[e]&&(t.closed=this.load.folders[e].closed,t.load=this.load.folders[e]),t=new P(t),this.__folders[e]=t,e=m(this,t.domElement),p.addClass(e,"folder"),t},open:function(){this.closed=!1},close:function(){this.closed=!0},onResize:function(){var e=this.getRoot();if(e.scrollable){var t=p.getOffset(e.__ul).top,n=0;d.each(e.__ul.childNodes,function(t){e.autoPlace&&t===e.__save_row||(n+=p.getHeight(t))}),window.innerHeight-t-20<n?(p.addClass(e.domElement,P.CLASS_TOO_TALL),e.__ul.style.height=window.innerHeight-t-20+"px"):(p.removeClass(e.domElement,P.CLASS_TOO_TALL),e.__ul.style.height="auto")}e.__resize_handle&&d.defer(function(){e.__resize_handle.style.height=e.__ul.offsetHeight+"px"}),e.__closeButton&&(e.__closeButton.style.width=e.width+"px")},remember:function(){d.isUndefined(A)&&(A=new 
  h,A.domElement.innerHTML=t);if(this.parent)throw Error("You can only call remember on a top level GUI.");var e=this;d.each(Array.prototype.slice.call(arguments),function(t){e.__rememberedObjects.length==0&&b(e),e.__rememberedObjects.indexOf(t)==-1&&e.__rememberedObjects.push(t)}),this.autoPlace&&E(this,this.width)},getRoot:function(){for(var e=this;e.parent;)e=e.parent;return e},getSaveObject:function(){var e=this.load;return e.closed=this.closed,this.__rememberedObjects.length>0&&(e.preset=this.preset,e.remembered||(e.remembered={}),e.remembered[this.preset]=S(this)),e.folders={},d.each(this.__folders,function(t,n){e.folders[n]=t.getSaveObject()}),e},save:function(){this.load.remembered||(this.load.remembered={}),this.load.remembered[this.preset]=S(this),T(this,!1)},saveAs:function(e){this.load.remembered||(this.load.remembered={},this.load.remembered[C]=S(this,!0)),this.load.remembered[e]=S(this),this.preset=e,x(this,e,!0)},revert:function(e){d.each(this.__controllers,function(t){this.getRoot().load.remembered?
  y(e||this.getRoot(),t):t.setValue(t.initialValue)},this),d.each(this.__folders,function(e){e.revert(e)}),e||T(this.getRoot(),!1)},listen:function(e){var t=this.__listening.length==0;this.__listening.push(e),t&&N(this.__listening)}}),P}(dat.utils.css,'<div id="dg-save" class="dg dialogue">\n\n  Here\'s the new load parameter for your <code>GUI</code>\'s constructor:\n\n  <textarea id="dg-new-constructor"></textarea>\n\n  <div id="dg-save-locally">\n\n    <input id="dg-local-storage" type="checkbox"/> Automatically save\n    values to <code>localStorage</code> on exit.\n\n    <div id="dg-local-explain">The values saved to <code>localStorage</code> will\n      override those passed to <code>dat.GUI</code>\'s constructor. This makes it\n      easier to work incrementally, but <code>localStorage</code> is fragile,\n      and your friends may not see the same values you do.\n      \n    </div>\n    \n  </div>\n\n</div>',".dg ul{list-style:none;margin:0;padding:0;width:100%;clear:both}.dg.ac{position:fixed;top:0;left:0;right:0;height:0;z-index:0}.dg:not(.ac) .main{overflow:hidden}.dg.main{-webkit-transition:opacity 0.1s linear;-o-transition:opacity 0.1s linear;-moz-transition:opacity 0.1s linear;transition:opacity 0.1s linear}.dg.main.taller-than-window{overflow-y:auto}.dg.main.taller-than-window .close-button{opacity:1;margin-top:-1px;border-top:1px solid #2c2c2c}.dg.main ul.closed .close-button{opacity:1 !important}.dg.main:hover .close-button,.dg.main .close-button.drag{opacity:1}.dg.main .close-button{-webkit-transition:opacity 0.1s linear;-o-transition:opacity 0.1s linear;-moz-transition:opacity 0.1s linear;transition:opacity 0.1s linear;border:0;position:absolute;line-height:19px;height:20px;cursor:pointer;text-align:center;background-color:#000}.dg.main .close-button:hover{background-color:#111}.dg.a{float:right;margin-right:15px;overflow-x:hidden}.dg.a.has-save ul{margin-top:27px}.dg.a.has-save ul.closed{margin-top:0}.dg.a .save-row{position:fixed;top:0;z-index:1002}.dg li{-webkit-transition:height 0.1s ease-out;-o-transition:height 0.1s ease-out;-moz-transition:height 0.1s ease-out;transition:height 0.1s ease-out}.dg li:not(.folder){cursor:auto;height:27px;line-height:27px;overflow:hidden;padding:0 4px 0 5px}.dg li.folder{padding:0;border-left:4px solid rgba(0,0,0,0)}.dg li.title{cursor:pointer;margin-left:-4px}.dg .closed li:not(.title),.dg .closed ul li,.dg .closed ul li > *{height:0;overflow:hidden;border:0}.dg .cr{clear:both;padding-left:3px;height:27px}.dg .property-name{cursor:default;float:left;clear:left;width:40%;overflow:hidden;text-overflow:ellipsis}.dg .c{float:left;width:60%}.dg .c input[type=text]{border:0;margin-top:4px;padding:3px;width:100%;float:right}.dg .has-slider input[type=text]{width:30%;margin-left:0}.dg .slider{float:left;width:66%;margin-left:-5px;margin-right:0;height:19px;margin-top:4px}.dg .slider-fg{height:100%}.dg .c input[type=checkbox]{margin-top:9px}.dg .c select{margin-top:5px}.dg .cr.function,.dg .cr.function .property-name,.dg .cr.function *,.dg .cr.boolean,.dg .cr.boolean *{cursor:pointer}.dg .selector{display:none;position:absolute;margin-left:-9px;margin-top:23px;z-index:10}.dg .c:hover .selector,.dg .selector.drag{display:block}.dg li.save-row{padding:0}.dg li.save-row .button{display:inline-block;padding:0px 6px}.dg.dialogue{background-color:#222;width:460px;padding:15px;font-size:13px;line-height:15px}#dg-new-constructor{padding:10px;color:#222;font-family:Monaco, monospace;font-size:10px;border:0;resize:none;box-shadow:inset 1px 1px 1px #888;word-wrap:break-word;margin:12px 0;display:block;width:440px;overflow-y:scroll;height:100px;position:relative}#dg-local-explain{display:none;font-size:11px;line-height:17px;border-radius:3px;background-color:#333;padding:8px;margin-top:10px}#dg-local-explain code{font-size:10px}#dat-gui-save-locally{display:none}.dg{color:#eee;font:11px 'Lucida Grande', sans-serif;text-shadow:0 -1px 0 #111}.dg.main::-webkit-scrollbar{width:5px;background:#1a1a1a}.dg.main::-webkit-scrollbar-corner{height:0;display:none}.dg.main::-webkit-scrollbar-thumb{border-radius:5px;background:#676767}.dg li:not(.folder){background:#1a1a1a;border-bottom:1px solid #2c2c2c}.dg li.save-row{line-height:25px;background:#dad5cb;border:0}.dg li.save-row select{margin-left:5px;width:108px}.dg li.save-row .button{margin-left:5px;margin-top:1px;border-radius:2px;font-size:9px;line-height:7px;padding:4px 4px 5px 4px;background:#c5bdad;color:#fff;text-shadow:0 1px 0 #b0a58f;box-shadow:0 -1px 0 #b0a58f;cursor:pointer}.dg li.save-row .button.gears{background:#c5bdad url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAsAAAANCAYAAAB/9ZQ7AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAQJJREFUeNpiYKAU/P//PwGIC/ApCABiBSAW+I8AClAcgKxQ4T9hoMAEUrxx2QSGN6+egDX+/vWT4e7N82AMYoPAx/evwWoYoSYbACX2s7KxCxzcsezDh3evFoDEBYTEEqycggWAzA9AuUSQQgeYPa9fPv6/YWm/Acx5IPb7ty/fw+QZblw67vDs8R0YHyQhgObx+yAJkBqmG5dPPDh1aPOGR/eugW0G4vlIoTIfyFcA+QekhhHJhPdQxbiAIguMBTQZrPD7108M6roWYDFQiIAAv6Aow/1bFwXgis+f2LUAynwoIaNcz8XNx3Dl7MEJUDGQpx9gtQ8YCueB+D26OECAAQDadt7e46D42QAAAABJRU5ErkJggg==) 2px 1px no-repeat;height:7px;width:8px}.dg li.save-row .button:hover{background-color:#bab19e;box-shadow:0 -1px 0 #b0a58f}.dg li.folder{border-bottom:0}.dg li.title{padding-left:16px;background:#000 url(data:image/gif;base64,R0lGODlhBQAFAJEAAP////Pz8////////yH5BAEAAAIALAAAAAAFAAUAAAIIlI+hKgFxoCgAOw==) 6px 10px no-repeat;cursor:pointer;border-bottom:1px solid rgba(255,255,255,0.2)}.dg .closed li.title{background-image:url(data:image/gif;base64,R0lGODlhBQAFAJEAAP////Pz8////////yH5BAEAAAIALAAAAAAFAAUAAAIIlGIWqMCbWAEAOw==)}.dg .cr.boolean{border-left:3px solid #806787}.dg .cr.function{border-left:3px solid #e61d5f}.dg .cr.number{border-left:3px solid #2fa1d6}.dg .cr.number input[type=text]{color:#2fa1d6}.dg .cr.string{border-left:3px solid #1ed36f}.dg .cr.string input[type=text]{color:#1ed36f}.dg .cr.function:hover,.dg .cr.boolean:hover{background:#111}.dg .c input[type=text]{background:#303030;outline:none}.dg .c input[type=text]:hover{background:#3c3c3c}.dg .c input[type=text]:focus{background:#494949;color:#fff}.dg .c .slider{background:#303030;cursor:ew-resize}.dg .c .slider-fg{background:#2fa1d6}.dg .c .slider:hover{background:#3c3c3c}.dg .c .slider:hover .slider-fg{background:#44abda}\n"
  ,dat.controllers.factory=function(e,t,n,r,i,s,o){return function(u,l,h,p){var v=u[l];if(o.isArray(h)||o.isObject(h))return new e(u,l,h);if(o.isNumber(v))return o.isNumber(h)&&o.isNumber(p)?new n(u,l,h,p):new t(u,l,{min:h,max:p});if(o.isString(v))return new r(u,l);if(o.isFunction(v))return new i(u,l,"");if(o.isBoolean(v))return new s(u,l)}}(dat.controllers.OptionController,dat.controllers.NumberControllerBox,dat.controllers.NumberControllerSlider,dat.controllers.StringController=function(e,t,n){var r=function(e,n){function i(){s.setValue(s.__input.value)}r.superclass.call(this,e,n);var s=this;this.__input=document.createElement("input"),this.__input.setAttribute("type","text"),t.bind(this.__input,"keyup",i),t.bind(this.__input,"change",i),t.bind(this.__input,"blur",function(){s.__onFinishChange&&s.__onFinishChange.call(s,s.getValue())}),t.bind(this.__input,"keydown",function(e){e.keyCode===13&&this.blur()}),this.updateDisplay(),this.domElement.appendChild(this.__input)};return r.superclass=e,n.extend(r.prototype
  ,e.prototype,{updateDisplay:function(){return t.isActive(this.__input)||(this.__input.value=this.getValue()),r.superclass.prototype.updateDisplay.call(this)}}),r}(dat.controllers.Controller,dat.dom.dom,dat.utils.common),dat.controllers.FunctionController,dat.controllers.BooleanController,dat.utils.common),dat.controllers.Controller,dat.controllers.BooleanController,dat.controllers.FunctionController,dat.controllers.NumberControllerBox,dat.controllers.NumberControllerSlider,dat.controllers.OptionController,dat.controllers.ColorController=function(e,t,n,r,i){function s(e,t,n,r){e.style.background="",i.each(a,function(i){e.style.cssText+="background: "+i+"linear-gradient("+t+", "+n+" 0%, "+r+" 100%); "})}function o(e){e.style.background="",e.style.cssText+="background: -moz-linear-gradient(top,  #ff0000 0%, #ff00ff 17%, #0000ff 34%, #00ffff 50%, #00ff00 67%, #ffff00 84%, #ff0000 100%);",e.style.cssText+="background: -webkit-linear-gradient(top,  #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);"
  ,e.style.cssText+="background: -o-linear-gradient(top,  #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",e.style.cssText+="background: -ms-linear-gradient(top,  #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",e.style.cssText+="background: linear-gradient(top,  #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);"}var u=function(e,a){function l(e){g(e),t.bind(window,"mousemove",g),t.bind(window,"mouseup",p)}function p(){t.unbind(window,"mousemove",g),t.unbind(window,"mouseup",p)}function v(){var e=r(this.value);e!==!1?(w.__color.__state=e,w.setValue(w.__color.toOriginal())):this.value=w.__color.toString()}function m(){t.unbind(window,"mousemove",y),t.unbind(window,"mouseup",m)}function g(e){e.preventDefault();var n=t.getWidth(w.__saturation_field),r=t.getOffset(w.__saturation_field),i=(e.clientX-r.left+document.body.scrollLeft)/n,e=1-(e.clientY-r.top+document.body.scrollTop)/n;return e>1?e=1:e<0&&(e=0),
  i>1?i=1:i<0&&(i=0),w.__color.v=e,w.__color.s=i,w.setValue(w.__color.toOriginal()),!1}function y(e){e.preventDefault();var n=t.getHeight(w.__hue_field),r=t.getOffset(w.__hue_field),e=1-(e.clientY-r.top+document.body.scrollTop)/n;return e>1?e=1:e<0&&(e=0),w.__color.h=e*360,w.setValue(w.__color.toOriginal()),!1}u.superclass.call(this,e,a),this.__color=new n(this.getValue()),this.__temp=new n(0);var w=this;this.domElement=document.createElement("div"),t.makeSelectable(this.domElement,!1),this.__selector=document.createElement("div"),this.__selector.className="selector",this.__saturation_field=document.createElement("div"),this.__saturation_field.className="saturation-field",this.__field_knob=document.createElement("div"),this.__field_knob.className="field-knob",this.__field_knob_border="2px solid ",this.__hue_knob=document.createElement("div"),this.__hue_knob.className="hue-knob",this.__hue_field=document.createElement("div"),this.__hue_field.className="hue-field",this.__input=document.createElement("input"),this.
  __input.type="text",this.__input_textShadow="0 1px 1px ",t.bind(this.__input,"keydown",function(e){e.keyCode===13&&v.call(this)}),t.bind(this.__input,"blur",v),t.bind(this.__selector,"mousedown",function(){t.addClass(this,"drag").bind(window,"mouseup",function(){t.removeClass(w.__selector,"drag")})});var E=document.createElement("div");i.extend(this.__selector.style,{width:"122px",height:"102px",padding:"3px",backgroundColor:"#222",boxShadow:"0px 1px 3px rgba(0,0,0,0.3)"}),i.extend(this.__field_knob.style,{position:"absolute",width:"12px",height:"12px",border:this.__field_knob_border+(this.__color.v<.5?"#fff":"#000"),boxShadow:"0px 1px 3px rgba(0,0,0,0.5)",borderRadius:"12px",zIndex:1}),i.extend(this.__hue_knob.style,{position:"absolute",width:"15px",height:"2px",borderRight:"4px solid #fff",zIndex:1}),i.extend(this.__saturation_field.style,{width:"100px",height:"100px",border:"1px solid #555",marginRight:"3px",display:"inline-block",cursor:"pointer"}),i.extend(E.style,{width:"100%",height:"100%",background:"none"
  }),s(E,"top","rgba(0,0,0,0)","#000"),i.extend(this.__hue_field.style,{width:"15px",height:"100px",display:"inline-block",border:"1px solid #555",cursor:"ns-resize"}),o(this.__hue_field),i.extend(this.__input.style,{outline:"none",textAlign:"center",color:"#fff",border:0,fontWeight:"bold",textShadow:this.__input_textShadow+"rgba(0,0,0,0.7)"}),t.bind(this.__saturation_field,"mousedown",l),t.bind(this.__field_knob,"mousedown",l),t.bind(this.__hue_field,"mousedown",function(e){y(e),t.bind(window,"mousemove",y),t.bind(window,"mouseup",m)}),this.__saturation_field.appendChild(E),this.__selector.appendChild(this.__field_knob),this.__selector.appendChild(this.__saturation_field),this.__selector.appendChild(this.__hue_field),this.__hue_field.appendChild(this.__hue_knob),this.domElement.appendChild(this.__input),this.domElement.appendChild(this.__selector),this.updateDisplay()};u.superclass=e,i.extend(u.prototype,e.prototype,{updateDisplay:function(){var e=r(this.getValue());if(e!==!1){var t=!1;i.each(n.COMPONENTS,function(
  n){if(!i.isUndefined(e[n])&&!i.isUndefined(this.__color.__state[n])&&e[n]!==this.__color.__state[n])return t=!0,{}},this),t&&i.extend(this.__color.__state,e)}i.extend(this.__temp.__state,this.__color.__state),this.__temp.a=1;var o=this.__color.v<.5||this.__color.s>.5?255:0,u=255-o;i.extend(this.__field_knob.style,{marginLeft:100*this.__color.s-7+"px",marginTop:100*(1-this.__color.v)-7+"px",backgroundColor:this.__temp.toString(),border:this.__field_knob_border+"rgb("+o+","+o+","+o+")"}),this.__hue_knob.style.marginTop=(1-this.__color.h/360)*100+"px",this.__temp.s=1,this.__temp.v=1,s(this.__saturation_field,"left","#fff",this.__temp.toString()),i.extend(this.__input.style,{backgroundColor:this.__input.value=this.__color.toString(),color:"rgb("+o+","+o+","+o+")",textShadow:this.__input_textShadow+"rgba("+u+","+u+","+u+",.7)"})}});var a=["-moz-","-o-","-webkit-","-ms-",""];return u}(dat.controllers.Controller,dat.dom.dom,dat.color.Color=function(e,t,n,r){function i(e,t,n){Object.defineProperty(e,t,{get:function(){
  return this.__state.space==="RGB"?this.__state[t]:(o(this,t,n),this.__state[t])},set:function(e){this.__state.space!=="RGB"&&(o(this,t,n),this.__state.space="RGB"),this.__state[t]=e}})}function s(e,t){Object.defineProperty(e,t,{get:function(){return this.__state.space==="HSV"?this.__state[t]:(u(this),this.__state[t])},set:function(e){this.__state.space!=="HSV"&&(u(this),this.__state.space="HSV"),this.__state[t]=e}})}function o(e,n,i){if(e.__state.space==="HEX")e.__state[n]=t.component_from_hex(e.__state.hex,i);else{if(e.__state.space!=="HSV")throw"Corrupted color state";r.extend(e.__state,t.hsv_to_rgb(e.__state.h,e.__state.s,e.__state.v))}}function u(e){var n=t.rgb_to_hsv(e.r,e.g,e.b);r.extend(e.__state,{s:n.s,v:n.v}),r.isNaN(n.h)?r.isUndefined(e.__state.h)&&(e.__state.h=0):e.__state.h=n.h}var a=function(){this.__state=e.apply(this,arguments);if(this.__state===!1)throw"Failed to interpret color arguments";this.__state.a=this.__state.a||1};return a.COMPONENTS="r,g,b,h,s,v,hex,a".split(","),r.extend(a.prototype,
  {toString:function(){return n(this)},toOriginal:function(){return this.__state.conversion.write(this)}}),i(a.prototype,"r",2),i(a.prototype,"g",1),i(a.prototype,"b",0),s(a.prototype,"h"),s(a.prototype,"s"),s(a.prototype,"v"),Object.defineProperty(a.prototype,"a",{get:function(){return this.__state.a},set:function(e){this.__state.a=e}}),Object.defineProperty(a.prototype,"hex",{get:function(){return!this.__state.space!=="HEX"&&(this.__state.hex=t.rgb_to_hex(this.r,this.g,this.b)),this.__state.hex},set:function(e){this.__state.space="HEX",this.__state.hex=e}}),a}(dat.color.interpret,dat.color.math=function(){var e;return{hsv_to_rgb:function(e,t,n){var r=e/60-Math.floor(e/60),i=n*(1-t),s=n*(1-r*t),t=n*(1-(1-r)*t),e=[[n,t,i],[s,n,i],[i,n,t],[i,s,n],[t,i,n],[n,i,s]][Math.floor(e/60)%6];return{r:e[0]*255,g:e[1]*255,b:e[2]*255}},rgb_to_hsv:function(e,t,n){var r=Math.min(e,t,n),i=Math.max(e,t,n),r=i-r;return i==0?{h:NaN,s:0,v:0}:(e=e==i?(t-n)/r:t==i?2+(n-e)/r:4+(e-t)/r,e/=6,e<0&&(e+=1),{h:e*360,s:r/i,v:i/255})},rgb_to_hex
  :function(e,t,n){return e=this.hex_with_component(0,2,e),e=this.hex_with_component(e,1,t),e=this.hex_with_component(e,0,n)},component_from_hex:function(e,t){return e>>t*8&255},hex_with_component:function(t,n,r){return r<<(e=n*8)|t&~(255<<e)}}}(),dat.color.toString,dat.utils.common),dat.color.interpret,dat.utils.common),dat.utils.requestAnimationFrame=function(){return window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(e){window.setTimeout(e,1e3/60)}}(),dat.dom.CenteredDiv=function(e,t){var n=function(){this.backgroundElement=document.createElement("div"),t.extend(this.backgroundElement.style,{backgroundColor:"rgba(0,0,0,0.8)",top:0,left:0,display:"none",zIndex:"1000",opacity:0,WebkitTransition:"opacity 0.2s linear"}),e.makeFullscreen(this.backgroundElement),this.backgroundElement.style.position="fixed",this.domElement=document.createElement("div"),t.extend(this.domElement.style,{position:"fixed",display:"none",zIndex:"1001"
  ,opacity:0,WebkitTransition:"-webkit-transform 0.2s ease-out, opacity 0.2s linear"}),document.body.appendChild(this.backgroundElement),document.body.appendChild(this.domElement);var n=this;e.bind(this.backgroundElement,"click",function(){n.hide()})};return n.prototype.show=function(){var e=this;this.backgroundElement.style.display="block",this.domElement.style.display="block",this.domElement.style.opacity=0,this.domElement.style.webkitTransform="scale(1.1)",this.layout(),t.defer(function(){e.backgroundElement.style.opacity=1,e.domElement.style.opacity=1,e.domElement.style.webkitTransform="scale(1)"})},n.prototype.hide=function(){var t=this,n=function(){t.domElement.style.display="none",t.backgroundElement.style.display="none",e.unbind(t.domElement,"webkitTransitionEnd",n),e.unbind(t.domElement,"transitionend",n),e.unbind(t.domElement,"oTransitionEnd",n)};e.bind(this.domElement,"webkitTransitionEnd",n),e.bind(this.domElement,"transitionend",n),e.bind(this.domElement,"oTransitionEnd",n),this.backgroundElement.style
  .opacity=0,this.domElement.style.opacity=0,this.domElement.style.webkitTransform="scale(1.1)"},n.prototype.layout=function(){this.domElement.style.left=window.innerWidth/2-e.getWidth(this.domElement)/2+"px",this.domElement.style.top=window.innerHeight/2-e.getHeight(this.domElement)/2+"px"},n}(dat.dom.dom,dat.utils.common),dat.dom.dom,dat.utils.common);var THREE=THREE||{REVISION:"54dev"};self.console=self.console||{info:function(){},log:function(){},debug:function(){},warn:function(){},error:function(){}},self.Int32Array=self.Int32Array||Array,self.Float32Array=self.Float32Array||Array,String.prototype.startsWith=String.prototype.startsWith||function(e){return this.slice(0,e.length)===e},String.prototype.endsWith=String.prototype.endsWith||function(e){var t=String(e),n=this.lastIndexOf(t);return(-1<n&&n)===this.length-t.length},String.prototype.trim=String.prototype.trim||function(){return this.replace(/^\s+|\s+$/g,"")},function(){var e=0,t=["ms","moz","webkit","o"];for(var n=0;n<t.length&&!window.requestAnimationFrame
  ;++n)window.requestAnimationFrame=window[t[n]+"RequestAnimationFrame"],window.cancelAnimationFrame=window[t[n]+"CancelAnimationFrame"]||window[t[n]+"CancelRequestAnimationFrame"];window.requestAnimationFrame===undefined&&(window.requestAnimationFrame=function(t,n){var r=Date.now(),i=Math.max(0,16-(r-e)),s=window.setTimeout(function(){t(r+i)},i);return e=r+i,s}),window.cancelAnimationFrame=window.cancelAnimationFrame||function(e){window.clearTimeout(e)}}(),THREE.CullFaceNone=0,THREE.CullFaceBack=1,THREE.CullFaceFront=2,THREE.CullFaceFrontBack=3,THREE.FrontFaceDirectionCW=0,THREE.FrontFaceDirectionCCW=1,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.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=function(){},THREE.CubeReflectionMapping=function(){},THREE.CubeRefractionMapping=function(){},THREE.SphericalReflectionMapping=function(){},THREE.SphericalRefractionMapping=function(){},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.UnsignedShort4444Type=1016
  ,THREE.UnsignedShort5551Type=1017,THREE.UnsignedShort565Type=1018,THREE.AlphaFormat=1019,THREE.RGBFormat=1020,THREE.RGBAFormat=1021,THREE.LuminanceFormat=1022,THREE.LuminanceAlphaFormat=1023,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.Clock=function(e){this.autoStart=e!==undefined?e:!0,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1},THREE.Clock.prototype.start=function(){this.startTime=Date.now(),this.oldTime=this.startTime,this.running=!0},THREE.Clock.prototype.stop=function(){this.getElapsedTime(),this.running=!1},THREE.Clock.prototype.getElapsedTime=function(){return this.getDelta(),this.elapsedTime},THREE.Clock.prototype.getDelta=function(){var e=0;this.autoStart&&!this.running&&this.start();if(this.running){var t=Date.now();e=.001*(t-this.oldTime),this.oldTime=t,this.elapsedTime+=e}return e},THREE.Color=function(e){return e!==undefined&&this.set(e),this},THREE.Color.prototype={constructor:THREE
  .Color,r:1,g:1,b:1,copy:function(e){return this.r=e.r,this.g=e.g,this.b=e.b,this},copyGammaToLinear:function(e){return this.r=e.r*e.r,this.g=e.g*e.g,this.b=e.b*e.b,this},copyLinearToGamma:function(e){return this.r=Math.sqrt(e.r),this.g=Math.sqrt(e.g),this.b=Math.sqrt(e.b),this},convertGammaToLinear:function(){var e=this.r,t=this.g,n=this.b;return this.r=e*e,this.g=t*t,this.b=n*n,this},convertLinearToGamma:function(){return this.r=Math.sqrt(this.r),this.g=Math.sqrt(this.g),this.b=Math.sqrt(this.b),this},set:function(e){switch(typeof e){case"number":this.setHex(e);break;case"string":this.setStyle(e)}},setRGB:function(e,t,n){return this.r=e,this.g=t,this.b=n,this},setHSV:function(e,t,n){var r,i,s,o,u;return n===0?this.r=this.g=this.b=0:(r=Math.floor(e*6),i=e*6-r,s=n*(1-t),o=n*(1-t*i),u=n*(1-t*(1-i)),r===0?(this.r=n,this.g=u,this.b=s):r===1?(this.r=o,this.g=n,this.b=s):r===2?(this.r=s,this.g=n,this.b=u):r===3?(this.r=s,this.g=o,this.b=n):r===4?(this.r=u,this.g=s,this.b=n):r===5&&(this.r=n,this.g=s,this.b=o)),this}
  ,getHex:function(){return this.r*255<<16^this.g*255<<8^this.b*255<<0},setHex:function(e){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,this},getHexString:function(){return("000000"+this.getHex().toString(16)).slice(-6)},getStyle:function(){return"rgb("+(this.r*255|0)+","+(this.g*255|0)+","+(this.b*255|0)+")"},setStyle:function(e){if(/^rgb\((\d+),(\d+),(\d+)\)$/i.test(e)){var t=/^rgb\((\d+),(\d+),(\d+)\)$/i.exec(e);return this.r=Math.min(255,parseInt(t[1],10))/255,this.g=Math.min(255,parseInt(t[2],10))/255,this.b=Math.min(255,parseInt(t[3],10))/255,this}if(/^rgb\((\d+)\%,(\d+)\%,(\d+)\%\)$/i.test(e)){var t=/^rgb\((\d+)\%,(\d+)\%,(\d+)\%\)$/i.exec(e);return this.r=Math.min(100,parseInt(t[1],10))/100,this.g=Math.min(100,parseInt(t[2],10))/100,this.b=Math.min(100,parseInt(t[3],10))/100,this}if(/^\#([0-9a-f]{6})$/i.test(e)){var t=/^\#([0-9a-f]{6})$/i.exec(e);return this.setHex(parseInt(t[1],16)),this}if(/^\#([0-9a-f])([0-9a-f])([0-9a-f])$/i.test(e)){var t=/^\#([0-9a-f])([0-9a-f])([0-9a-f])$/i
  .exec(e);return this.setHex(parseInt(t[1]+t[1]+t[2]+t[2]+t[3]+t[3],16)),this}if(/^(\w+)$/i.test(e))return this.setHex(THREE.ColorKeywords[e]),this},getHSV:function(e){var t=this.r,n=this.g,r=this.b,i=Math.max(Math.max(t,n),r),s=Math.min(Math.min(t,n),r),o,u,a=i;if(s===i)o=0,u=0;else{var f=i-s;u=f/i,t===i?o=(n-r)/f:n===i?o=2+(r-t)/f:o=4+(t-n)/f,o/=6,o<0&&(o+=1),o>1&&(o-=1)}return e===undefined&&(e={h:0,s:0,v:0}),e.h=o,e.s=u,e.v=a,e},lerpSelf:function(e,t){return this.r+=(e.r-this.r)*t,this.g+=(e.g-this.g)*t,this.b+=(e.b-this.b)*t,this},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.Vector2=function(e,t){this.x=e||0,this.y=t||0},THREE.Vector2.prototype={constructor:THREE.Vector2,set:function(e,t){return this.x=e,this.y=t,this},copy:function(e){return this.x=e.x,this.y=e.y,this},add:function(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this},addSelf:function(e){return this.x+=e.x,this.y+=e.y,this},sub:function(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this},subSelf:function(e){return this.x-=e.x,this.y-=e.y,this},multiplyScalar:function(e){return this.x*=e,this.y*=e,this},divideScalar:function(e){return e?(this.x/=e,this.y/=e):this.set(0,0),this},negate:function(){return this.multiplyScalar(-1)},dot:function(e){return this.x*e.x+this.y*e.y},lengthSq:function(){return this.x*this.x+this.y*this.y},length:function(){return Math.sqrt(this.lengthSq())},normalize:function(
  ){return this.divideScalar(this.length())},distanceTo:function(e){return Math.sqrt(this.distanceToSquared(e))},distanceToSquared:function(e){var t=this.x-e.x,n=this.y-e.y;return t*t+n*n},setLength:function(e){return this.normalize().multiplyScalar(e)},lerpSelf:function(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this},equals:function(e){return e.x===this.x&&e.y===this.y},clone:function(){return new THREE.Vector2(this.x,this.y)}},THREE.Vector3=function(e,t,n){this.x=e||0,this.y=t||0,this.z=n||0},THREE.Vector3.prototype={constructor:THREE.Vector3,set:function(e,t,n){return this.x=e,this.y=t,this.z=n,this},setX:function(e){return this.x=e,this},setY:function(e){return this.y=e,this},setZ:function(e){return this.z=e,this},copy:function(e){return this.x=e.x,this.y=e.y,this.z=e.z,this},add:function(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this},addSelf:function(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this},addScalar:function(e){return this.x+=e,this.y+=e,this.z+=e,this},sub:function(
  e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this},subSelf:function(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this},multiply:function(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this},multiplySelf:function(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this},multiplyScalar:function(e){return this.x*=e,this.y*=e,this.z*=e,this},divideSelf:function(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this},divideScalar:function(e){return e?(this.x/=e,this.y/=e,this.z/=e):(this.x=0,this.y=0,this.z=0),this},negate:function(){return this.multiplyScalar(-1)},dot:function(e){return this.x*e.x+this.y*e.y+this.z*e.z},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},length:function(){return Math.sqrt(this.lengthSq())},lengthManhattan:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)},normalize:function(){return this.divideScalar(this.length())},setLength:function(e){return this.normalize().multiplyScalar(e)},lerpSelf:function(e,t){return this.x+=(e.x-this.x)*t
  ,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this},cross:function(e,t){return this.x=e.y*t.z-e.z*t.y,this.y=e.z*t.x-e.x*t.z,this.z=e.x*t.y-e.y*t.x,this},crossSelf:function(e){var t=this.x,n=this.y,r=this.z;return this.x=n*e.z-r*e.y,this.y=r*e.x-t*e.z,this.z=t*e.y-n*e.x,this},angleTo:function(e){return Math.acos(this.dot(e)/this.length()/e.length())},distanceTo:function(e){return Math.sqrt(this.distanceToSquared(e))},distanceToSquared:function(e){return(new THREE.Vector3).sub(this,e).lengthSq()},getPositionFromMatrix:function(e){return this.x=e.elements[12],this.y=e.elements[13],this.z=e.elements[14],this},setEulerFromRotationMatrix:function(e,t){function n(e){return Math.min(Math.max(e,-1),1)}var r=e.elements,i=r[0],s=r[4],o=r[8],u=r[1],a=r[5],f=r[9],l=r[2],c=r[6],h=r[10];return t===undefined||t==="XYZ"?(this.y=Math.asin(n(o)),Math.abs(o)<.99999?(this.x=Math.atan2(-f,h),this.z=Math.atan2(-s,i)):(this.x=Math.atan2(c,a),this.z=0)):t==="YXZ"?(this.x=Math.asin(-n(f)),Math.abs(f)<.99999?(this.y=Math.atan2(o,h),this
  .z=Math.atan2(u,a)):(this.y=Math.atan2(-l,i),this.z=0)):t==="ZXY"?(this.x=Math.asin(n(c)),Math.abs(c)<.99999?(this.y=Math.atan2(-l,h),this.z=Math.atan2(-s,a)):(this.y=0,this.z=Math.atan2(u,i))):t==="ZYX"?(this.y=Math.asin(-n(l)),Math.abs(l)<.99999?(this.x=Math.atan2(c,h),this.z=Math.atan2(u,i)):(this.x=0,this.z=Math.atan2(-s,a))):t==="YZX"?(this.z=Math.asin(n(u)),Math.abs(u)<.99999?(this.x=Math.atan2(-f,a),this.y=Math.atan2(-l,i)):(this.x=0,this.y=Math.atan2(o,h))):t==="XZY"&&(this.z=Math.asin(-n(s)),Math.abs(s)<.99999?(this.x=Math.atan2(c,a),this.y=Math.atan2(o,i)):(this.x=Math.atan2(-f,h),this.y=0)),this},setEulerFromQuaternion:function(e,t){function n(e){return Math.min(Math.max(e,-1),1)}var r=e.x*e.x,i=e.y*e.y,s=e.z*e.z,o=e.w*e.w;return t===undefined||t==="XYZ"?(this.x=Math.atan2(2*(e.x*e.w-e.y*e.z),o-r-i+s),this.y=Math.asin(n(2*(e.x*e.z+e.y*e.w))),this.z=Math.atan2(2*(e.z*e.w-e.x*e.y),o+r-i-s)):t==="YXZ"?(this.x=Math.asin(n(2*(e.x*e.w-e.y*e.z))),this.y=Math.atan2(2*(e.x*e.z+e.y*e.w),o-r-i+s),this.z=Math.atan2
  (2*(e.x*e.y+e.z*e.w),o-r+i-s)):t==="ZXY"?(this.x=Math.asin(n(2*(e.x*e.w+e.y*e.z))),this.y=Math.atan2(2*(e.y*e.w-e.z*e.x),o-r-i+s),this.z=Math.atan2(2*(e.z*e.w-e.x*e.y),o-r+i-s)):t==="ZYX"?(this.x=Math.atan2(2*(e.x*e.w+e.z*e.y),o-r-i+s),this.y=Math.asin(n(2*(e.y*e.w-e.x*e.z))),this.z=Math.atan2(2*(e.x*e.y+e.z*e.w),o+r-i-s)):t==="YZX"?(this.x=Math.atan2(2*(e.x*e.w-e.z*e.y),o-r+i-s),this.y=Math.atan2(2*(e.y*e.w-e.x*e.z),o+r-i-s),this.z=Math.asin(n(2*(e.x*e.y+e.z*e.w)))):t==="XZY"&&(this.x=Math.atan2(2*(e.x*e.w+e.y*e.z),o-r+i-s),this.y=Math.atan2(2*(e.x*e.z+e.y*e.w),o+r-i-s),this.z=Math.asin(n(2*(e.z*e.w-e.x*e.y)))),this},getScaleFromMatrix:function(e){var t=this.set(e.elements[0],e.elements[1],e.elements[2]).length(),n=this.set(e.elements[4],e.elements[5],e.elements[6]).length(),r=this.set(e.elements[8],e.elements[9],e.elements[10]).length();return this.x=t,this.y=n,this.z=r,this},equals:function(e){return e.x===this.x&&e.y===this.y&&e.z===this.z},clone:function(){return new THREE.Vector3(this.x,this.y,this.z)}},
  THREE.Vector4=function(e,t,n,r){this.x=e||0,this.y=t||0,this.z=n||0,this.w=r!==undefined?r:1},THREE.Vector4.prototype={constructor:THREE.Vector4,set:function(e,t,n,r){return this.x=e,this.y=t,this.z=n,this.w=r,this},copy:function(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w!==undefined?e.w:1,this},add:function(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this},addSelf:function(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this},sub:function(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this},subSelf:function(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this},multiplyScalar:function(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this},divideScalar:function(e){return e?(this.x/=e,this.y/=e,this.z/=e,this.w/=e):(this.x=0,this.y=0,this.z=0,this.w=1),this},negate:function(){return this.multiplyScalar(-1)},dot:function(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w},lengthSq:function(){return this.dot(this)},length:function(
  ){return Math.sqrt(this.lengthSq())},lengthManhattan:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)},normalize:function(){return this.divideScalar(this.length())},setLength:function(e){return this.normalize().multiplyScalar(e)},lerpSelf:function(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)},setAxisAngleFromQuaternion:function(e){this.w=2*Math.acos(e.w);var t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this},setAxisAngleFromRotationMatrix:function(e){var t,n,r,i,s=.01,o=.1,u=e.elements,a=u[0],f=u[4],l=u[8],c=u[1],h=u[5],p=u[9],d=u[2],v=u[6],m=u[10];if(Math.abs(f-c)<s&&Math.abs(l-d)<s&&Math.abs(p-v)<s){if(Math.abs(f+c)<o&&Math.abs(l+d)<o&&Math.abs(p+v)<o&&Math.abs(a+h+m-3)<o)return this.set(1,0,0,0),this;t=Math.PI;var g=(a+1)/2,y=(h+1)/2,b=(m+1)/2,w=(f+c)/4,E=(l+d)/4,S=(p+v)/4;return g>
  y&&g>b?g<s?(n=0,r=.707106781,i=.707106781):(n=Math.sqrt(g),r=w/n,i=E/n):y>b?y<s?(n=.707106781,r=0,i=.707106781):(r=Math.sqrt(y),n=w/r,i=S/r):b<s?(n=.707106781,r=.707106781,i=0):(i=Math.sqrt(b),n=E/i,r=S/i),this.set(n,r,i,t),this}var x=Math.sqrt((v-p)*(v-p)+(l-d)*(l-d)+(c-f)*(c-f));return Math.abs(x)<.001&&(x=1),this.x=(v-p)/x,this.y=(l-d)/x,this.z=(c-f)/x,this.w=Math.acos((a+h+m-1)/2),this}},THREE.Matrix3=function(){this.elements=new Float32Array(9)},THREE.Matrix3.prototype={constructor:THREE.Matrix3,multiplyVector3:function(e){var t=this.elements,n=e.x,r=e.y,i=e.z;return e.x=t[0]*n+t[3]*r+t[6]*i,e.y=t[1]*n+t[4]*r+t[7]*i,e.z=t[2]*n+t[5]*r+t[8]*i,e},multiplyVector3Array:function(e){var t=THREE.Matrix3.__v1;for(var n=0,r=e.length;n<r;n+=3)t.x=e[n],t.y=e[n+1],t.z=e[n+2],this.multiplyVector3(t),e[n]=t.x,e[n+1]=t.y,e[n+2]=t.z;return e},getInverse:function(e){var t=e.elements,n=t[10]*t[5]-t[6]*t[9],r=-t[10]*t[1]+t[2]*t[9],i=t[6]*t[1]-t[2]*t[5],s=-t[10]*t[4]+t[6]*t[8],o=t[10]*t[0]-t[2]*t[8],u=-t[6]*t[0]+t[2]*t[4],a=t
  [9]*t[4]-t[5]*t[8],f=-t[9]*t[0]+t[1]*t[8],l=t[5]*t[0]-t[1]*t[4],c=t[0]*n+t[1]*s+t[2]*a;c===0&&console.warn("Matrix3.getInverse(): determinant == 0");var h=1/c,p=this.elements;return p[0]=h*n,p[1]=h*r,p[2]=h*i,p[3]=h*s,p[4]=h*o,p[5]=h*u,p[6]=h*a,p[7]=h*f,p[8]=h*l,this},transpose:function(){var e,t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this},transposeIntoArray:function(e){var t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}},THREE.Matrix3.__v1=new THREE.Vector3,THREE.Matrix4=function(e,t,n,r,i,s,o,u,a,f,l,c,h,p,d,v){this.elements=new Float32Array(16),this.set(e!==undefined?e:1,t||0,n||0,r||0,i||0,s!==undefined?s:1,o||0,u||0,a||0,f||0,l!==undefined?l:1,c||0,h||0,p||0,d||0,v!==undefined?v:1)},THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(e,t,n,r,i,s,o,u,a,f,l,c,h,p,d,v){var m=this.elements;return m[0]=e,m[4]=t,m[8]=n,m[12]=r,m[1]=i,m[5]=s,m[9]=o,m[13]=u,m[2]=a,m[6]=f,m[10]=
  l,m[14]=c,m[3]=h,m[7]=p,m[11]=d,m[15]=v,this},identity:function(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this},copy:function(e){var t=e.elements;return this.set(t[0],t[4],t[8],t[12],t[1],t[5],t[9],t[13],t[2],t[6],t[10],t[14],t[3],t[7],t[11],t[15]),this},lookAt:function(e,t,n){var r=this.elements,i=THREE.Matrix4.__v1,s=THREE.Matrix4.__v2,o=THREE.Matrix4.__v3;return o.sub(e,t).normalize(),o.length()===0&&(o.z=1),i.cross(n,o).normalize(),i.length()===0&&(o.x+=1e-4,i.cross(n,o).normalize()),s.cross(o,i),r[0]=i.x,r[4]=s.x,r[8]=o.x,r[1]=i.y,r[5]=s.y,r[9]=o.y,r[2]=i.z,r[6]=s.z,r[10]=o.z,this},multiply:function(e,t){var n=e.elements,r=t.elements,i=this.elements,s=n[0],o=n[4],u=n[8],a=n[12],f=n[1],l=n[5],c=n[9],h=n[13],p=n[2],d=n[6],v=n[10],m=n[14],g=n[3],y=n[7],b=n[11],w=n[15],E=r[0],S=r[4],x=r[8],T=r[12],N=r[1],C=r[5],k=r[9],L=r[13],A=r[2],O=r[6],M=r[10],_=r[14],D=r[3],P=r[7],H=r[11],B=r[15];return i[0]=s*E+o*N+u*A+a*D,i[4]=s*S+o*C+u*O+a*P,i[8]=s*x+o*k+u*M+a*H,i[12]=s*T+o*L+u*_+a*B,i[1]=f*E+l*N+c*A+h*D,i[5]=
  f*S+l*C+c*O+h*P,i[9]=f*x+l*k+c*M+h*H,i[13]=f*T+l*L+c*_+h*B,i[2]=p*E+d*N+v*A+m*D,i[6]=p*S+d*C+v*O+m*P,i[10]=p*x+d*k+v*M+m*H,i[14]=p*T+d*L+v*_+m*B,i[3]=g*E+y*N+b*A+w*D,i[7]=g*S+y*C+b*O+w*P,i[11]=g*x+y*k+b*M+w*H,i[15]=g*T+y*L+b*_+w*B,this},multiplySelf:function(e){return this.multiply(this,e)},multiplyToArray:function(e,t,n){var r=this.elements;return this.multiply(e,t),n[0]=r[0],n[1]=r[1],n[2]=r[2],n[3]=r[3],n[4]=r[4],n[5]=r[5],n[6]=r[6],n[7]=r[7],n[8]=r[8],n[9]=r[9],n[10]=r[10],n[11]=r[11],n[12]=r[12],n[13]=r[13],n[14]=r[14],n[15]=r[15],this},multiplyScalar:function(e){var t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this},multiplyVector3:function(e){var t=this.elements,n=e.x,r=e.y,i=e.z,s=1/(t[3]*n+t[7]*r+t[11]*i+t[15]);return e.x=(t[0]*n+t[4]*r+t[8]*i+t[12])*s,e.y=(t[1]*n+t[5]*r+t[9]*i+t[13])*s,e.z=(t[2]*n+t[6]*r+t[10]*i+t[14])*s,e},multiplyVector4:function(e){var t=this.elements,n=e.x,r=e.y,i=e.z,s=
  e.w;return e.x=t[0]*n+t[4]*r+t[8]*i+t[12]*s,e.y=t[1]*n+t[5]*r+t[9]*i+t[13]*s,e.z=t[2]*n+t[6]*r+t[10]*i+t[14]*s,e.w=t[3]*n+t[7]*r+t[11]*i+t[15]*s,e},multiplyVector3Array:function(e){var t=THREE.Matrix4.__v1;for(var n=0,r=e.length;n<r;n+=3)t.x=e[n],t.y=e[n+1],t.z=e[n+2],this.multiplyVector3(t),e[n]=t.x,e[n+1]=t.y,e[n+2]=t.z;return e},rotateAxis:function(e){var t=this.elements,n=e.x,r=e.y,i=e.z;return e.x=n*t[0]+r*t[4]+i*t[8],e.y=n*t[1]+r*t[5]+i*t[9],e.z=n*t[2]+r*t[6]+i*t[10],e.normalize(),e},crossVector:function(e){var t=this.elements,n=new THREE.Vector4;return n.x=t[0]*e.x+t[4]*e.y+t[8]*e.z+t[12]*e.w,n.y=t[1]*e.x+t[5]*e.y+t[9]*e.z+t[13]*e.w,n.z=t[2]*e.x+t[6]*e.y+t[10]*e.z+t[14]*e.w,n.w=e.w?t[3]*e.x+t[7]*e.y+t[11]*e.z+t[15]*e.w:1,n},determinant:function(){var e=this.elements,t=e[0],n=e[4],r=e[8],i=e[12],s=e[1],o=e[5],u=e[9],a=e[13],f=e[2],l=e[6],c=e[10],h=e[14],p=e[3],d=e[7],v=e[11],m=e[15];return i*u*l*p-r*a*l*p-i*o*c*p+n*a*c*p+r*o*h*p-n*u*h*p-i*u*f*d+r*a*f*d+i*s*c*d-t*a*c*d-r*s*h*d+t*u*h*d+i*o*f*v-n*a*f*v-i*s*
  l*v+t*a*l*v+n*s*h*v-t*o*h*v-r*o*f*m+n*u*f*m+r*s*l*m-t*u*l*m-n*s*c*m+t*o*c*m},transpose:function(){var e=this.elements,t;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this},flattenToArray:function(e){var t=this.elements;return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e},flattenToArrayOffset:function(e,t){var n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e[t+9]=n[9],e[t+10]=n[10],e[t+11]=n[11],e[t+12]=n[12],e[t+13]=n[13],e[t+14]=n[14],e[t+15]=n[15],e},getPosition:function(){var e=this.elements;return THREE.Matrix4.__v1.set(e[12],e[13],e[14])},setPosition:function(e){var t=this.elements;return t[12]=e.x,t[13]=e.y,t[14]=e.z,this},getColumnX:function(){var e=this.elements;return THREE.Matrix4.__v1
  .set(e[0],e[1],e[2])},getColumnY:function(){var e=this.elements;return THREE.Matrix4.__v1.set(e[4],e[5],e[6])},getColumnZ:function(){var e=this.elements;return THREE.Matrix4.__v1.set(e[8],e[9],e[10])},getInverse:function(e){var t=this.elements,n=e.elements,r=n[0],i=n[4],s=n[8],o=n[12],u=n[1],a=n[5],f=n[9],l=n[13],c=n[2],h=n[6],p=n[10],d=n[14],v=n[3],m=n[7],g=n[11],y=n[15];return t[0]=f*d*m-l*p*m+l*h*g-a*d*g-f*h*y+a*p*y,t[4]=o*p*m-s*d*m-o*h*g+i*d*g+s*h*y-i*p*y,t[8]=s*l*m-o*f*m+o*a*g-i*l*g-s*a*y+i*f*y,t[12]=o*f*h-s*l*h-o*a*p+i*l*p+s*a*d-i*f*d,t[1]=l*p*v-f*d*v-l*c*g+u*d*g+f*c*y-u*p*y,t[5]=s*d*v-o*p*v+o*c*g-r*d*g-s*c*y+r*p*y,t[9]=o*f*v-s*l*v-o*u*g+r*l*g+s*u*y-r*f*y,t[13]=s*l*c-o*f*c+o*u*p-r*l*p-s*u*d+r*f*d,t[2]=a*d*v-l*h*v+l*c*m-u*d*m-a*c*y+u*h*y,t[6]=o*h*v-i*d*v-o*c*m+r*d*m+i*c*y-r*h*y,t[10]=i*l*v-o*a*v+o*u*m-r*l*m-i*u*y+r*a*y,t[14]=o*a*c-i*l*c-o*u*h+r*l*h+i*u*d-r*a*d,t[3]=f*h*v-a*p*v-f*c*m+u*p*m+a*c*g-u*h*g,t[7]=i*p*v-s*h*v+s*c*m-r*p*m-i*c*g+r*h*g,t[11]=s*a*v-i*f*v-s*u*m+r*f*m+i*u*g-r*a*g,t[15]=i*f*c-s*a*c+s*u*h-
  r*f*h-i*u*p+r*a*p,this.multiplyScalar(1/e.determinant()),this},setRotationFromEuler:function(e,t){var n=this.elements,r=e.x,i=e.y,s=e.z,o=Math.cos(r),u=Math.sin(r),a=Math.cos(i),f=Math.sin(i),l=Math.cos(s),c=Math.sin(s);if(t===undefined||t==="XYZ"){var h=o*l,p=o*c,d=u*l,v=u*c;n[0]=a*l,n[4]=-a*c,n[8]=f,n[1]=p+d*f,n[5]=h-v*f,n[9]=-u*a,n[2]=v-h*f,n[6]=d+p*f,n[10]=o*a}else if(t==="YXZ"){var m=a*l,g=a*c,y=f*l,b=f*c;n[0]=m+b*u,n[4]=y*u-g,n[8]=o*f,n[1]=o*c,n[5]=o*l,n[9]=-u,n[2]=g*u-y,n[6]=b+m*u,n[10]=o*a}else if(t==="ZXY"){var m=a*l,g=a*c,y=f*l,b=f*c;n[0]=m-b*u,n[4]=-o*c,n[8]=y+g*u,n[1]=g+y*u,n[5]=o*l,n[9]=b-m*u,n[2]=-o*f,n[6]=u,n[10]=o*a}else if(t==="ZYX"){var h=o*l,p=o*c,d=u*l,v=u*c;n[0]=a*l,n[4]=d*f-p,n[8]=h*f+v,n[1]=a*c,n[5]=v*f+h,n[9]=p*f-d,n[2]=-f,n[6]=u*a,n[10]=o*a}else if(t==="YZX"){var w=o*a,E=o*f,S=u*a,x=u*f;n[0]=a*l,n[4]=x-w*c,n[8]=S*c+E,n[1]=c,n[5]=o*l,n[9]=-u*l,n[2]=-f*l,n[6]=E*c+S,n[10]=w-x*c}else if(t==="XZY"){var w=o*a,E=o*f,S=u*a,x=u*f;n[0]=a*l,n[4]=-c,n[8]=f*l,n[1]=w*c+x,n[5]=o*l,n[9]=E*c-S,n[2]=S*c-
  E,n[6]=u*l,n[10]=x*c+w}return this},setRotationFromQuaternion:function(e){var t=this.elements,n=e.x,r=e.y,i=e.z,s=e.w,o=n+n,u=r+r,a=i+i,f=n*o,l=n*u,c=n*a,h=r*u,p=r*a,d=i*a,v=s*o,m=s*u,g=s*a;return t[0]=1-(h+d),t[4]=l-g,t[8]=c+m,t[1]=l+g,t[5]=1-(f+d),t[9]=p-v,t[2]=c-m,t[6]=p+v,t[10]=1-(f+h),this},compose:function(e,t,n){var r=this.elements,i=THREE.Matrix4.__m1,s=THREE.Matrix4.__m2;return i.identity(),i.setRotationFromQuaternion(t),s.makeScale(n.x,n.y,n.z),this.multiply(i,s),r[12]=e.x,r[13]=e.y,r[14]=e.z,this},decompose:function(e,t,n){var r=this.elements,i=THREE.Matrix4.__v1,s=THREE.Matrix4.__v2,o=THREE.Matrix4.__v3;i.set(r[0],r[1],r[2]),s.set(r[4],r[5],r[6]),o.set(r[8],r[9],r[10]),e=e instanceof THREE.Vector3?e:new THREE.Vector3,t=t instanceof THREE.Quaternion?t:new THREE.Quaternion,n=n instanceof THREE.Vector3?n:new THREE.Vector3,n.x=i.length(),n.y=s.length(),n.z=o.length(),e.x=r[12],e.y=r[13],e.z=r[14];var u=THREE.Matrix4.__m1;return u.copy(this),u.elements[0]/=n.x,u.elements[1]/=n.x,u.elements[2]/=n.x,u.elements
  [4]/=n.y,u.elements[5]/=n.y,u.elements[6]/=n.y,u.elements[8]/=n.z,u.elements[9]/=n.z,u.elements[10]/=n.z,t.setFromRotationMatrix(u),[e,t,n]},extractPosition:function(e){var t=this.elements,n=e.elements;return t[12]=n[12],t[13]=n[13],t[14]=n[14],this},extractRotation:function(e){var t=this.elements,n=e.elements,r=THREE.Matrix4.__v1,i=1/r.set(n[0],n[1],n[2]).length(),s=1/r.set(n[4],n[5],n[6]).length(),o=1/r.set(n[8],n[9],n[10]).length();return t[0]=n[0]*i,t[1]=n[1]*i,t[2]=n[2]*i,t[4]=n[4]*s,t[5]=n[5]*s,t[6]=n[6]*s,t[8]=n[8]*o,t[9]=n[9]*o,t[10]=n[10]*o,this},translate:function(e){var t=this.elements,n=e.x,r=e.y,i=e.z;return t[12]=t[0]*n+t[4]*r+t[8]*i+t[12],t[13]=t[1]*n+t[5]*r+t[9]*i+t[13],t[14]=t[2]*n+t[6]*r+t[10]*i+t[14],t[15]=t[3]*n+t[7]*r+t[11]*i+t[15],this},rotateX:function(e){var t=this.elements,n=t[4],r=t[5],i=t[6],s=t[7],o=t[8],u=t[9],a=t[10],f=t[11],l=Math.cos(e),c=Math.sin(e);return t[4]=l*n+c*o,t[5]=l*r+c*u,t[6]=l*i+c*a,t[7]=l*s+c*f,t[8]=l*o-c*n,t[9]=l*u-c*r,t[10]=l*a-c*i,t[11]=l*f-c*s,this},rotateY:function(
  e){var t=this.elements,n=t[0],r=t[1],i=t[2],s=t[3],o=t[8],u=t[9],a=t[10],f=t[11],l=Math.cos(e),c=Math.sin(e);return t[0]=l*n-c*o,t[1]=l*r-c*u,t[2]=l*i-c*a,t[3]=l*s-c*f,t[8]=l*o+c*n,t[9]=l*u+c*r,t[10]=l*a+c*i,t[11]=l*f+c*s,this},rotateZ:function(e){var t=this.elements,n=t[0],r=t[1],i=t[2],s=t[3],o=t[4],u=t[5],a=t[6],f=t[7],l=Math.cos(e),c=Math.sin(e);return t[0]=l*n+c*o,t[1]=l*r+c*u,t[2]=l*i+c*a,t[3]=l*s+c*f,t[4]=l*o-c*n,t[5]=l*u-c*r,t[6]=l*a-c*i,t[7]=l*f-c*s,this},rotateByAxis:function(e,t){var n=this.elements;if(e.x===1&&e.y===0&&e.z===0)return this.rotateX(t);if(e.x===0&&e.y===1&&e.z===0)return this.rotateY(t);if(e.x===0&&e.y===0&&e.z===1)return this.rotateZ(t);var r=e.x,i=e.y,s=e.z,o=Math.sqrt(r*r+i*i+s*s);r/=o,i/=o,s/=o;var u=r*r,a=i*i,f=s*s,l=Math.cos(t),c=Math.sin(t),h=1-l,p=r*i*h,d=r*s*h,v=i*s*h,m=r*c,g=i*c,y=s*c,b=u+(1-u)*l,w=p+y,E=d-g,S=p-y,x=a+(1-a)*l,T=v+m,N=d+g,C=v-m,k=f+(1-f)*l,L=n[0],A=n[1],O=n[2],M=n[3],_=n[4],D=n[5],P=n[6],H=n[7],B=n[8],j=n[9],F=n[10],I=n[11],q=n[12],R=n[13],U=n[14],z=n[15];return n
  [0]=b*L+w*_+E*B,n[1]=b*A+w*D+E*j,n[2]=b*O+w*P+E*F,n[3]=b*M+w*H+E*I,n[4]=S*L+x*_+T*B,n[5]=S*A+x*D+T*j,n[6]=S*O+x*P+T*F,n[7]=S*M+x*H+T*I,n[8]=N*L+C*_+k*B,n[9]=N*A+C*D+k*j,n[10]=N*O+C*P+k*F,n[11]=N*M+C*H+k*I,this},scale:function(e){var t=this.elements,n=e.x,r=e.y,i=e.z;return t[0]*=n,t[4]*=r,t[8]*=i,t[1]*=n,t[5]*=r,t[9]*=i,t[2]*=n,t[6]*=r,t[10]*=i,t[3]*=n,t[7]*=r,t[11]*=i,this},getMaxScaleOnAxis:function(){var e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],n=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],r=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,Math.max(n,r)))},makeTranslation:function(e,t,n){return this.set(1,0,0,e,0,1,0,t,0,0,1,n,0,0,0,1),this},makeRotationX:function(e){var t=Math.cos(e),n=Math.sin(e);return this.set(1,0,0,0,0,t,-n,0,0,n,t,0,0,0,0,1),this},makeRotationY:function(e){var t=Math.cos(e),n=Math.sin(e);return this.set(t,0,n,0,0,1,0,0,-n,0,t,0,0,0,0,1),this},makeRotationZ:function(e){var t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,0,n,t,0,0,0,0,1,0,0,0,0,1),this},makeRotationAxis:function(
  e,t){var n=Math.cos(t),r=Math.sin(t),i=1-n,s=e.x,o=e.y,u=e.z,a=i*s,f=i*o;return this.set(a*s+n,a*o-r*u,a*u+r*o,0,a*o+r*u,f*o+n,f*u-r*s,0,a*u-r*o,f*u+r*s,i*u*u+n,0,0,0,0,1),this},makeScale:function(e,t,n){return this.set(e,0,0,0,0,t,0,0,0,0,n,0,0,0,0,1),this},makeFrustum:function(e,t,n,r,i,s){var o=this.elements,u=2*i/(t-e),a=2*i/(r-n),f=(t+e)/(t-e),l=(r+n)/(r-n),c=-(s+i)/(s-i),h=-2*s*i/(s-i);return o[0]=u,o[4]=0,o[8]=f,o[12]=0,o[1]=0,o[5]=a,o[9]=l,o[13]=0,o[2]=0,o[6]=0,o[10]=c,o[14]=h,o[3]=0,o[7]=0,o[11]=-1,o[15]=0,this},makePerspective:function(e,t,n,r){var i=n*Math.tan(e*Math.PI/360),s=-i,o=s*t,u=i*t;return this.makeFrustum(o,u,s,i,n,r)},makeOrthographic:function(e,t,n,r,i,s){var o=this.elements,u=t-e,a=n-r,f=s-i,l=(t+e)/u,c=(n+r)/a,h=(s+i)/f;return o[0]=2/u,o[4]=0,o[8]=0,o[12]=-l,o[1]=0,o[5]=2/a,o[9]=0,o[13]=-c,o[2]=0,o[6]=0,o[10]=-2/f,o[14]=-h,o[3]=0,o[7]=0,o[11]=0,o[15]=1,this},clone:function(){var e=this.elements;return new THREE.Matrix4(e[0],e[4],e[8],e[12],e[1],e[5],e[9],e[13],e[2],e[6],e[10],e[14],e[3
  ],e[7],e[11],e[15])}},THREE.Matrix4.__v1=new THREE.Vector3,THREE.Matrix4.__v2=new THREE.Vector3,THREE.Matrix4.__v3=new THREE.Vector3,THREE.Matrix4.__m1=new THREE.Matrix4,THREE.Matrix4.__m2=new THREE.Matrix4,THREE.EventTarget=function(){var e={};this.addEventListener=function(t,n){e[t]===undefined&&(e[t]=[]),e[t].indexOf(n)===-1&&e[t].push(n)},this.dispatchEvent=function(t){var n=e[t.type];if(n!==undefined)for(var r=0,i=n.length;r<i;r++)n[r](t)},this.removeEventListener=function(t,n){var r=e[t].indexOf(n);r!==-1&&e[t].splice(r,1)}},THREE.Frustum=function(){this.planes=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4]},THREE.Frustum.prototype.setFromMatrix=function(e){var t,n=this.planes,r=e.elements,i=r[0],s=r[1],o=r[2],u=r[3],a=r[4],f=r[5],l=r[6],c=r[7],h=r[8],p=r[9],d=r[10],v=r[11],m=r[12],g=r[13],y=r[14],b=r[15];n[0].set(u-i,c-a,v-h,b-m),n[1].set(u+i,c+a,v+h,b+m),n[2].set(u+s,c+f,v+p,b+g),n[3].set(u-s,c-f,v-p,b-g),n[4].set(u-o,c-l,v-d,b-y),n[5].set(
  u+o,c+l,v+d,b+y);for(var w=0;w<6;w++)t=n[w],t.divideScalar(Math.sqrt(t.x*t.x+t.y*t.y+t.z*t.z))},THREE.Frustum.prototype.contains=function(e){var t=0,n=this.planes,r=e.matrixWorld,i=r.elements,s=-e.geometry.boundingSphere.radius*r.getMaxScaleOnAxis();for(var o=0;o<6;o++){t=n[o].x*i[12]+n[o].y*i[13]+n[o].z*i[14]+n[o].w;if(t<=s)return!1}return!0},THREE.Frustum.__v1=new THREE.Vector3,function(e){e.Ray=function(t,n,r,i){this.origin=t||new e.Vector3,this.direction=n||new e.Vector3,this.near=r||0,this.far=i||Infinity};var t=new e.Vector3,n=new e.Vector3,r=new e.Vector3,i=new e.Vector3,s=new e.Vector3,o=new e.Vector3,u=new e.Matrix4,a=function(e,t){return e.distance-t.distance},f=new e.Vector3,l=new e.Vector3,c=new e.Vector3,h=function(e,t,n){f.sub(n,e);var r=f.dot(t),i=l.add(e,c.copy(t).multiplyScalar(r)),s=n.distanceTo(i);return s},p=function(e,t,n,r){f.sub(r,t),l.sub(n,t),c.sub(e,t);var i=f.dot(f),s=f.dot(l),o=f.dot(c),u=l.dot(l),a=l.dot(c),h=1/(i*u-s*s),p=(u*o-s*a)*h,d=(i*a-s*o)*h;return p>=0&&d>=0&&p+d<1},d=function(
  s,a,f){if(s instanceof e.Particle){var l=h(a.origin,a.direction,s.matrixWorld.getPosition());if(l>s.scale.x)return f;f.push({distance:l,point:s.position,face:null,object:s})}else if(s instanceof e.Mesh){var c=s.geometry.boundingSphere.radius*s.matrixWorld.getMaxScaleOnAxis(),l=h(a.origin,a.direction,s.matrixWorld.getPosition());if(l>c)return f;var d=s.geometry,v=d.vertices,m=s.material instanceof e.MeshFaceMaterial,g=m===!0?s.material.materials:null,y=s.material.side,b,w,E,S,x=a.precision;s.matrixRotationWorld.extractRotation(s.matrixWorld),t.copy(a.origin),u.getInverse(s.matrixWorld),n.copy(t),u.multiplyVector3(n),r.copy(a.direction),u.rotateAxis(r).normalize();for(var T=0,N=d.faces.length;T<N;T++){var C=d.faces[T],k=m===!0?g[C.materialIndex]:s.material;if(k===undefined)continue;y=k.side,i.sub(C.centroid,n);var L=C.normal,A=r.dot(L);if(Math.abs(A)<x)continue;var O=L.dot(i)/A;if(O<0)continue;if(y===e.DoubleSide||(y===e.FrontSide?A<0:A>0)){o.add(n,r.multiplyScalar(O));if(C instanceof e.Face3){b=v[C.a],w=v[C.b],
  E=v[C.c];if(p(o,b,w,E)){var M=s.matrixWorld.multiplyVector3(o.clone());l=t.distanceTo(M);if(l<a.near||l>a.far)continue;f.push({distance:l,point:M,face:C,faceIndex:T,object:s})}}else if(C instanceof e.Face4){b=v[C.a],w=v[C.b],E=v[C.c],S=v[C.d];if(p(o,b,w,S)||p(o,w,E,S)){var M=s.matrixWorld.multiplyVector3(o.clone());l=t.distanceTo(M);if(l<a.near||l>a.far)continue;f.push({distance:l,point:M,face:C,faceIndex:T,object:s})}}}}}},v=function(e,t,n){var r=e.getDescendants();for(var i=0,s=r.length;i<s;i++)d(r[i],t,n)};e.Ray.prototype.precision=1e-4,e.Ray.prototype.set=function(e,t){this.origin=e,this.direction=t},e.Ray.prototype.intersectObject=function(e,t){var n=[];return t===!0&&v(e,this,n),d(e,this,n),n.sort(a),n},e.Ray.prototype.intersectObjects=function(e,t){var n=[];for(var r=0,i=e.length;r<i;r++)d(e[r],this,n),t===!0&&v(e[r],this,n);return n.sort(a),n}}(THREE),THREE.Rectangle=function(){function u(){i=n-e,s=r-t}var e=0,t=0,n=0,r=0,i=0,s=0,o=!0;this.getX=function(){return e},this.getY=function(){return t},this.getWidth=
  function(){return i},this.getHeight=function(){return s},this.getLeft=function(){return e},this.getTop=function(){return t},this.getRight=function(){return n},this.getBottom=function(){return r},this.set=function(i,s,a,f){o=!1,e=i,t=s,n=a,r=f,u()},this.addPoint=function(i,s){o===!0?(o=!1,e=i,t=s,n=i,r=s,u()):(e=e<i?e:i,t=t<s?t:s,n=n>i?n:i,r=r>s?r:s,u())},this.add3Points=function(i,s,a,f,l,c){o===!0?(o=!1,e=i<a?i<l?i:l:a<l?a:l,t=s<f?s<c?s:c:f<c?f:c,n=i>a?i>l?i:l:a>l?a:l,r=s>f?s>c?s:c:f>c?f:c,u()):(e=i<a?i<l?i<e?i:e:l<e?l:e:a<l?a<e?a:e:l<e?l:e,t=s<f?s<c?s<t?s:t:c<t?c:t:f<c?f<t?f:t:c<t?c:t,n=i>a?i>l?i>n?i:n:l>n?l:n:a>l?a>n?a:n:l>n?l:n,r=s>f?s>c?s>r?s:r:c>r?c:r:f>c?f>r?f:r:c>r?c:r,u())},this.addRectangle=function(i){o===!0?(o=!1,e=i.getLeft(),t=i.getTop(),n=i.getRight(),r=i.getBottom(),u()):(e=e<i.getLeft()?e:i.getLeft(),t=t<i.getTop()?t:i.getTop(),n=n>i.getRight()?n:i.getRight(),r=r>i.getBottom()?r:i.getBottom(),u())},this.inflate=function(i){e-=i,t-=i,n+=i,r+=i,u()},this.minSelf=function(i){e=e>i.getLeft()?e:i.getLeft
  (),t=t>i.getTop()?t:i.getTop(),n=n<i.getRight()?n:i.getRight(),r=r<i.getBottom()?r:i.getBottom(),u()},this.intersects=function(i){return n<i.getLeft()?!1:e>i.getRight()?!1:r<i.getTop()?!1:t>i.getBottom()?!1:!0},this.empty=function(){o=!0,e=0,t=0,n=0,r=0,u()},this.isEmpty=function(){return o}},THREE.Math={clamp:function(e,t,n){return e<t?t:e>n?n:e},clampBottom:function(e,t){return e<t?t:e},mapLinear:function(e,t,n,r,i){return r+(e-t)*(i-r)/(n-t)},random16:function(){return(65280*Math.random()+255*Math.random())/65535},randInt:function(e,t){return e+Math.floor(Math.random()*(t-e+1))},randFloat:function(e,t){return e+Math.random()*(t-e)},randFloatSpread:function(e){return e*(.5-Math.random())},sign:function(e){return e<0?-1:e>0?1:0}},THREE.Object3D=function(){THREE.Object3DLibrary.push(this),this.id=THREE.Object3DIdCount++,this.name="",this.properties={},this.parent=undefined,this.children=[],this.up=new THREE.Vector3(0,1,0),this.position=new THREE.Vector3,this.rotation=new THREE.Vector3,this.eulerOrder=THREE.Object3D
  .defaultEulerOrder,this.scale=new THREE.Vector3(1,1,1),this.renderDepth=null,this.rotationAutoUpdate=!0,this.matrix=new THREE.Matrix4,this.matrixWorld=new THREE.Matrix4,this.matrixRotationWorld=new THREE.Matrix4,this.matrixAutoUpdate=!0,this.matrixWorldNeedsUpdate=!0,this.quaternion=new THREE.Quaternion,this.useQuaternion=!1,this.boundRadius=0,this.boundRadiusScale=1,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this._vector=new THREE.Vector3},THREE.Object3D.prototype={constructor:THREE.Object3D,applyMatrix:function(e){this.matrix.multiply(e,this.matrix),this.scale.getScaleFromMatrix(this.matrix);var t=(new THREE.Matrix4).extractRotation(this.matrix);this.rotation.setEulerFromRotationMatrix(t,this.eulerOrder),this.position.getPositionFromMatrix(this.matrix)},translate:function(e,t){this.matrix.rotateAxis(t),this.position.addSelf(t.multiplyScalar(e))},translateX:function(e){this.translate(e,this._vector.set(1,0,0))},translateY:function(e){this.translate(e,this._vector.set(0,1,0)
  )},translateZ:function(e){this.translate(e,this._vector.set(0,0,1))},localToWorld:function(e){return this.matrixWorld.multiplyVector3(e)},worldToLocal:function(e){return THREE.Object3D.__m1.getInverse(this.matrixWorld).multiplyVector3(e)},lookAt:function(e){this.matrix.lookAt(e,this.position,this.up),this.rotationAutoUpdate&&(this.useQuaternion===!1?this.rotation.setEulerFromRotationMatrix(this.matrix,this.eulerOrder):this.quaternion.copy(this.matrix.decompose()[1]))},add:function(e){if(e===this){console.warn("THREE.Object3D.add: An object can't be added as a child of itself.");return}if(e instanceof THREE.Object3D){e.parent!==undefined&&e.parent.remove(e),e.parent=this,this.children.push(e);var t=this;while(t.parent!==undefined)t=t.parent;t!==undefined&&t instanceof THREE.Scene&&t.__addObject(e)}},remove:function(e){var t=this.children.indexOf(e);if(t!==-1){e.parent=undefined,this.children.splice(t,1);var n=this;while(n.parent!==undefined)n=n.parent;n!==undefined&&n instanceof THREE.Scene&&n.__removeObject(e)
  }},traverse:function(e){e(this);for(var t=0,n=this.children.length;t<n;t++)this.children[t].traverse(e)},getChildByName:function(e,t){for(var n=0,r=this.children.length;n<r;n++){var i=this.children[n];if(i.name===e)return i;if(t===!0){i=i.getChildByName(e,t);if(i!==undefined)return i}}return undefined},getDescendants:function(e){e===undefined&&(e=[]),Array.prototype.push.apply(e,this.children);for(var t=0,n=this.children.length;t<n;t++)this.children[t].getDescendants(e);return e},updateMatrix:function(){this.matrix.setPosition(this.position),this.useQuaternion===!1?this.matrix.setRotationFromEuler(this.rotation,this.eulerOrder):this.matrix.setRotationFromQuaternion(this.quaternion);if(this.scale.x!==1||this.scale.y!==1||this.scale.z!==1)this.matrix.scale(this.scale),this.boundRadiusScale=Math.max(this.scale.x,Math.max(this.scale.y,this.scale.z));this.matrixWorldNeedsUpdate=!0},updateMatrixWorld:function(e){this.matrixAutoUpdate===!0&&this.updateMatrix();if(this.matrixWorldNeedsUpdate===!0||e===!0)this.parent===
  undefined?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiply(this.parent.matrixWorld,this.matrix),this.matrixWorldNeedsUpdate=!1,e=!0;for(var t=0,n=this.children.length;t<n;t++)this.children[t].updateMatrixWorld(e)},clone:function(e){e===undefined&&(e=new THREE.Object3D),e.name=this.name,e.up.copy(this.up),e.position.copy(this.position),e.rotation instanceof THREE.Vector3&&e.rotation.copy(this.rotation),e.eulerOrder=this.eulerOrder,e.scale.copy(this.scale),e.renderDepth=this.renderDepth,e.rotationAutoUpdate=this.rotationAutoUpdate,e.matrix.copy(this.matrix),e.matrixWorld.copy(this.matrixWorld),e.matrixRotationWorld.copy(this.matrixRotationWorld),e.matrixAutoUpdate=this.matrixAutoUpdate,e.matrixWorldNeedsUpdate=this.matrixWorldNeedsUpdate,e.quaternion.copy(this.quaternion),e.useQuaternion=this.useQuaternion,e.boundRadius=this.boundRadius,e.boundRadiusScale=this.boundRadiusScale,e.visible=this.visible,e.castShadow=this.castShadow,e.receiveShadow=this.receiveShadow,e.frustumCulled=this.frustumCulled;for(
  var t=0;t<this.children.length;t++){var n=this.children[t];e.add(n.clone())}return e},deallocate:function(){var e=THREE.Object3DLibrary.indexOf(this);e!==-1&&THREE.Object3DLibrary.splice(e,1)}},THREE.Object3D.__m1=new THREE.Matrix4,THREE.Object3D.defaultEulerOrder="XYZ",THREE.Object3DIdCount=0,THREE.Object3DLibrary=[],THREE.Projector=function(){function P(){if(t===r){var e=new THREE.RenderableObject;return n.push(e),r++,t++,e}return n[t++]}function H(){if(s===u){var e=new THREE.RenderableVertex;return o.push(e),u++,s++,e}return o[s++]}function B(){if(f===c){var e=new THREE.RenderableFace3;return l.push(e),c++,f++,e}return l[f++]}function j(){if(h===d){var e=new THREE.RenderableFace4;return p.push(e),d++,h++,e}return p[h++]}function F(){if(m===y){var e=new THREE.RenderableLine;return g.push(e),y++,m++,e}return g[m++]}function I(){if(w===S){var e=new THREE.RenderableParticle;return E.push(e),S++,w++,e}return E[w++]}function q(e,t){return t.z-e.z}function R(e,t){var n=0,r=1,i=e.z+e.w,s=t.z+t.w,o=-e.z+e.w,u=-t.z+t
  .w;return i>=0&&s>=0&&o>=0&&u>=0?!0:i<0&&s<0||o<0&&u<0?!1:(i<0?n=Math.max(n,i/(i-s)):s<0&&(r=Math.min(r,i/(i-s))),o<0?n=Math.max(n,o/(o-u)):u<0&&(r=Math.min(r,o/(o-u))),r<n?!1:(e.lerpSelf(t,n),t.lerpSelf(e,1-r),!0))}var e,t,n=[],r=0,i,s,o=[],u=0,a,f,l=[],c=0,h,p=[],d=0,v,m,g=[],y=0,b,w,E=[],S=0,x={objects:[],sprites:[],lights:[],elements:[]},T=new THREE.Vector3,N=new THREE.Vector4,C=new THREE.Matrix4,k=new THREE.Matrix4,L=new THREE.Matrix3,A=new THREE.Frustum,O=new THREE.Vector4,M=new THREE.Vector4,_;this.projectVector=function(e,t){return t.matrixWorldInverse.getInverse(t.matrixWorld),C.multiply(t.projectionMatrix,t.matrixWorldInverse),C.multiplyVector3(e),e},this.unprojectVector=function(e,t){return t.projectionMatrixInverse.getInverse(t.projectionMatrix),C.multiply(t.matrixWorld,t.projectionMatrixInverse),C.multiplyVector3(e),e},this.pickingRay=function(e,t){var n,r,i;return e.z=-1,n=new THREE.Vector3(e.x,e.y,1),this.unprojectVector(e,t),this.unprojectVector(n,t),n.subSelf(e).normalize(),new THREE.Ray(e,n)}
  ;var D=function(n,r){t=0,x.objects.length=0,x.sprites.length=0,x.lights.length=0;var i=function(t){for(var n=0,r=t.children.length;n<r;n++){var s=t.children[n];if(s.visible===!1)continue;if(s instanceof THREE.Light)x.lights.push(s);else if(s instanceof THREE.Mesh||s instanceof THREE.Line){if(s.frustumCulled===!1||A.contains(s)===!0)e=P(),e.object=s,s.renderDepth!==null?e.z=s.renderDepth:(T.copy(s.matrixWorld.getPosition()),C.multiplyVector3(T),e.z=T.z),x.objects.push(e)}else s instanceof THREE.Sprite||s instanceof THREE.Particle?(e=P(),e.object=s,s.renderDepth!==null?e.z=s.renderDepth:(T.copy(s.matrixWorld.getPosition()),C.multiplyVector3(T),e.z=T.z),x.sprites.push(e)):(e=P(),e.object=s,s.renderDepth!==null?e.z=s.renderDepth:(T.copy(s.matrixWorld.getPosition()),C.multiplyVector3(T),e.z=T.z),x.objects.push(e));i(s)}};return i(n),r===!0&&x.objects.sort(q),x};this.projectScene=function(e,t,n,r){var u=t.near,l=t.far,c=!1,p,d,g,y,E,S,T,_,P,U,z,W,X,V,$,J,K,Q,G,Y,Z,et,tt,nt,rt,it,st,ot,ut,at,ft,lt;f=0,h=0,m=0,w=0,x.elements
  .length=0,e.updateMatrixWorld(),t.parent===undefined&&t.updateMatrixWorld(),t.matrixWorldInverse.getInverse(t.matrixWorld),C.multiply(t.projectionMatrix,t.matrixWorldInverse),A.setFromMatrix(C),x=D(e,n);for(p=0,d=x.objects.length;p<d;p++){X=x.objects[p].object,V=X.matrixWorld,s=0;if(X instanceof THREE.Mesh){$=X.geometry,J=$.vertices,G=$.faces,tt=$.faceVertexUvs,L.getInverse(V),L.transpose(),ut=X.material instanceof THREE.MeshFaceMaterial,at=ut===!0?X.material:null,lt=X.material.side;for(g=0,y=J.length;g<y;g++)i=H(),i.positionWorld.copy(J[g]),V.multiplyVector3(i.positionWorld),i.positionScreen.copy(i.positionWorld),C.multiplyVector4(i.positionScreen),i.positionScreen.x/=i.positionScreen.w,i.positionScreen.y/=i.positionScreen.w,i.visible=i.positionScreen.z>u&&i.positionScreen.z<l;for(E=0,S=G.length;E<S;E++){Y=G[E],ft=ut===!0?at.materials[Y.materialIndex]:X.material;if(ft===undefined)continue;lt=ft.side;if(Y instanceof THREE.Face3){rt=o[Y.a],it=o[Y.b],st=o[Y.c];if(rt.visible!==!0||it.visible!==!0||st.visible!==!0
  )continue;c=(st.positionScreen.x-rt.positionScreen.x)*(it.positionScreen.y-rt.positionScreen.y)-(st.positionScreen.y-rt.positionScreen.y)*(it.positionScreen.x-rt.positionScreen.x)<0;if(lt!==THREE.DoubleSide&&c!==(lt===THREE.FrontSide))continue;a=B(),a.v1.copy(rt),a.v2.copy(it),a.v3.copy(st)}else if(Y instanceof THREE.Face4){rt=o[Y.a],it=o[Y.b],st=o[Y.c],ot=o[Y.d];if(rt.visible!==!0||it.visible!==!0||st.visible!==!0||ot.visible!==!0)continue;c=(ot.positionScreen.x-rt.positionScreen.x)*(it.positionScreen.y-rt.positionScreen.y)-(ot.positionScreen.y-rt.positionScreen.y)*(it.positionScreen.x-rt.positionScreen.x)<0||(it.positionScreen.x-st.positionScreen.x)*(ot.positionScreen.y-st.positionScreen.y)-(it.positionScreen.y-st.positionScreen.y)*(ot.positionScreen.x-st.positionScreen.x)<0;if(lt!==THREE.DoubleSide&&c!==(lt===THREE.FrontSide))continue;a=j(),a.v1.copy(rt),a.v2.copy(it),a.v3.copy(st),a.v4.copy(ot)}a.normalWorld.copy(Y.normal),c===!1&&(lt===THREE.BackSide||lt===THREE.DoubleSide)&&a.normalWorld.negate(),L.multiplyVector3
  (a.normalWorld).normalize(),a.centroidWorld.copy(Y.centroid),V.multiplyVector3(a.centroidWorld),a.centroidScreen.copy(a.centroidWorld),C.multiplyVector3(a.centroidScreen),Z=Y.vertexNormals;for(T=0,_=Z.length;T<_;T++)et=a.vertexNormalsWorld[T],et.copy(Z[T]),c===!1&&(lt===THREE.BackSide||lt===THREE.DoubleSide)&&et.negate(),L.multiplyVector3(et).normalize();a.vertexNormalsLength=Z.length;for(P=0,U=tt.length;P<U;P++){nt=tt[P][E];if(nt===undefined)continue;for(z=0,W=nt.length;z<W;z++)a.uvs[P][z]=nt[z]}a.color=Y.color,a.material=ft,a.z=a.centroidScreen.z,x.elements.push(a)}}else if(X instanceof THREE.Line){k.multiply(C,V),J=X.geometry.vertices,rt=H(),rt.positionScreen.copy(J[0]),k.multiplyVector4(rt.positionScreen);var ct=X.type===THREE.LinePieces?2:1;for(g=1,y=J.length;g<y;g++){rt=H(),rt.positionScreen.copy(J[g]),k.multiplyVector4(rt.positionScreen);if((g+1)%ct>0)continue;it=o[s-2],O.copy(rt.positionScreen),M.copy(it.positionScreen),R(O,M)===!0&&(O.multiplyScalar(1/O.w),M.multiplyScalar(1/M.w),v=F(),v.v1.positionScreen
  .copy(O),v.v2.positionScreen.copy(M),v.z=Math.max(O.z,M.z),v.material=X.material,x.elements.push(v))}}}for(p=0,d=x.sprites.length;p<d;p++)X=x.sprites[p].object,V=X.matrixWorld,X instanceof THREE.Particle&&(N.set(V.elements[12],V.elements[13],V.elements[14],1),C.multiplyVector4(N),N.z/=N.w,N.z>0&&N.z<1&&(b=I(),b.object=X,b.x=N.x/N.w,b.y=N.y/N.w,b.z=N.z,b.rotation=X.rotation.z,b.scale.x=X.scale.x*Math.abs(b.x-(N.x+t.projectionMatrix.elements[0])/(N.w+t.projectionMatrix.elements[12])),b.scale.y=X.scale.y*Math.abs(b.y-(N.y+t.projectionMatrix.elements[5])/(N.w+t.projectionMatrix.elements[13])),b.material=X.material,x.elements.push(b)));return r===!0&&x.elements.sort(q),x}},THREE.Quaternion=function(e,t,n,r){this.x=e||0,this.y=t||0,this.z=n||0,this.w=r!==undefined?r:1},THREE.Quaternion.prototype={constructor:THREE.Quaternion,set:function(e,t,n,r){return this.x=e,this.y=t,this.z=n,this.w=r,this},copy:function(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w,this},setFromEuler:function(e,t){var n=Math.cos(e.x/2),
  r=Math.cos(e.y/2),i=Math.cos(e.z/2),s=Math.sin(e.x/2),o=Math.sin(e.y/2),u=Math.sin(e.z/2);return t===undefined||t==="XYZ"?(this.x=s*r*i+n*o*u,this.y=n*o*i-s*r*u,this.z=n*r*u+s*o*i,this.w=n*r*i-s*o*u):t==="YXZ"?(this.x=s*r*i+n*o*u,this.y=n*o*i-s*r*u,this.z=n*r*u-s*o*i,this.w=n*r*i+s*o*u):t==="ZXY"?(this.x=s*r*i-n*o*u,this.y=n*o*i+s*r*u,this.z=n*r*u+s*o*i,this.w=n*r*i-s*o*u):t==="ZYX"?(this.x=s*r*i-n*o*u,this.y=n*o*i+s*r*u,this.z=n*r*u-s*o*i,this.w=n*r*i+s*o*u):t==="YZX"?(this.x=s*r*i+n*o*u,this.y=n*o*i+s*r*u,this.z=n*r*u-s*o*i,this.w=n*r*i-s*o*u):t==="XZY"&&(this.x=s*r*i-n*o*u,this.y=n*o*i-s*r*u,this.z=n*r*u+s*o*i,this.w=n*r*i+s*o*u),this},setFromAxisAngle:function(e,t){var n=t/2,r=Math.sin(n);return this.x=e.x*r,this.y=e.y*r,this.z=e.z*r,this.w=Math.cos(n),this},setFromRotationMatrix:function(e){var t=e.elements,n=t[0],r=t[4],i=t[8],s=t[1],o=t[5],u=t[9],a=t[2],f=t[6],l=t[10],c=n+o+l,h;return c>0?(h=.5/Math.sqrt(c+1),this.w=.25/h,this.x=(f-u)*h,this.y=(i-a)*h,this.z=(s-r)*h):n>o&&n>l?(h=2*Math.sqrt(1+n-o-l),this
  .w=(f-u)/h,this.x=.25*h,this.y=(r+s)/h,this.z=(i+a)/h):o>l?(h=2*Math.sqrt(1+o-n-l),this.w=(i-a)/h,this.x=(r+s)/h,this.y=.25*h,this.z=(u+f)/h):(h=2*Math.sqrt(1+l-n-o),this.w=(s-r)/h,this.x=(i+a)/h,this.y=(u+f)/h,this.z=.25*h),this},inverse:function(){return this.conjugate().normalize(),this},conjugate:function(){return this.x*=-1,this.y*=-1,this.z*=-1,this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var e=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);return e===0?(this.x=0,this.y=0,this.z=0,this.w=1):(e=1/e,this.x=this.x*e,this.y=this.y*e,this.z=this.z*e,this.w=this.w*e),this},multiply:function(e,t){var n=e.x,r=e.y,i=e.z,s=e.w,o=t.x,u=t.y,a=t.z,f=t.w;return this.x=n*f+r*a-i*u+s*o,this.y=-n*a+r*f+i*o+s*u,this.z=n*u-r*o+i*f+s*a,this.w=-n*o-r*u-i*a+s*f,this},multiplySelf:function(e){var t=this.x,n=this.y,r=this.z,i=this.w,s=e.x,o=e.y,u=e.z,a=e.w;return this.x=t*a+i*s+n*u-r*o,this.y=n*a+i*o+r*s-t*u,this.z=r*a+i*u+t*o-n*s,this
  .w=i*a-t*s-n*o-r*u,this},multiplyVector3:function(e,t){t||(t=e);var n=e.x,r=e.y,i=e.z,s=this.x,o=this.y,u=this.z,a=this.w,f=a*n+o*i-u*r,l=a*r+u*n-s*i,c=a*i+s*r-o*n,h=-s*n-o*r-u*i;return t.x=f*a+h*-s+l*-u-c*-o,t.y=l*a+h*-o+c*-s-f*-u,t.z=c*a+h*-u+f*-o-l*-s,t},slerpSelf:function(e,t){var n=this.x,r=this.y,i=this.z,s=this.w,o=s*e.w+n*e.x+r*e.y+i*e.z;o<0?(this.w=-e.w,this.x=-e.x,this.y=-e.y,this.z=-e.z,o=-o):this.copy(e);if(o>=1)return this.w=s,this.x=n,this.y=r,this.z=i,this;var u=Math.acos(o),a=Math.sqrt(1-o*o);if(Math.abs(a)<.001)return this.w=.5*(s+this.w),this.x=.5*(n+this.x),this.y=.5*(r+this.y),this.z=.5*(i+this.z),this;var f=Math.sin((1-t)*u)/a,l=Math.sin(t*u)/a;return this.w=s*f+this.w*l,this.x=n*f+this.x*l,this.y=r*f+this.y*l,this.z=i*f+this.z*l,this},clone:function(){return new THREE.Quaternion(this.x,this.y,this.z,this.w)}},THREE.Quaternion.slerp=function(e,t,n,r){var i=e.w*t.w+e.x*t.x+e.y*t.y+e.z*t.z;i<0?(n.w=-t.w,n.x=-t.x,n.y=-t.y,n.z=-t.z,i=-i):n.copy(t);if(Math.abs(i)>=1)return n.w=e.w,n.x=e.x,n.y=e
  .y,n.z=e.z,n;var s=Math.acos(i),o=Math.sqrt(1-i*i);if(Math.abs(o)<.001)return n.w=.5*(e.w+n.w),n.x=.5*(e.x+n.x),n.y=.5*(e.y+n.y),n.z=.5*(e.z+n.z),n;var u=Math.sin((1-r)*s)/o,a=Math.sin(r*s)/o;return n.w=e.w*u+n.w*a,n.x=e.x*u+n.x*a,n.y=e.y*u+n.y*a,n.z=e.z*u+n.z*a,n},THREE.Vertex=function(e){return console.warn("THREE.Vertex has been DEPRECATED. Use THREE.Vector3 instead."),e},THREE.Face3=function(e,t,n,r,i,s){this.a=e,this.b=t,this.c=n,this.normal=r instanceof THREE.Vector3?r:new THREE.Vector3,this.vertexNormals=r instanceof Array?r:[],this.color=i instanceof THREE.Color?i:new THREE.Color,this.vertexColors=i instanceof Array?i:[],this.vertexTangents=[],this.materialIndex=s!==undefined?s:0,this.centroid=new THREE.Vector3},THREE.Face3.prototype={constructor:THREE.Face3,clone:function(){var e=new THREE.Face3(this.a,this.b,this.c);e.normal.copy(this.normal),e.color.copy(this.color),e.centroid.copy(this.centroid),e.materialIndex=this.materialIndex;var t,n;for(t=0,n=this.vertexNormals.length;t<n;t++)e.vertexNormals[t
  ]=this.vertexNormals[t].clone();for(t=0,n=this.vertexColors.length;t<n;t++)e.vertexColors[t]=this.vertexColors[t].clone();for(t=0,n=this.vertexTangents.length;t<n;t++)e.vertexTangents[t]=this.vertexTangents[t].clone();return e}},THREE.Face4=function(e,t,n,r,i,s,o){this.a=e,this.b=t,this.c=n,this.d=r,this.normal=i instanceof THREE.Vector3?i:new THREE.Vector3,this.vertexNormals=i instanceof Array?i:[],this.color=s instanceof THREE.Color?s:new THREE.Color,this.vertexColors=s instanceof Array?s:[],this.vertexTangents=[],this.materialIndex=o!==undefined?o:0,this.centroid=new THREE.Vector3},THREE.Face4.prototype={constructor:THREE.Face4,clone:function(){var e=new THREE.Face4(this.a,this.b,this.c,this.d);e.normal.copy(this.normal),e.color.copy(this.color),e.centroid.copy(this.centroid),e.materialIndex=this.materialIndex;var t,n;for(t=0,n=this.vertexNormals.length;t<n;t++)e.vertexNormals[t]=this.vertexNormals[t].clone();for(t=0,n=this.vertexColors.length;t<n;t++)e.vertexColors[t]=this.vertexColors[t].clone();for(t=0,n=
  this.vertexTangents.length;t<n;t++)e.vertexTangents[t]=this.vertexTangents[t].clone();return e}},THREE.UV=function(e,t){this.u=e||0,this.v=t||0},THREE.UV.prototype={constructor:THREE.UV,set:function(e,t){return this.u=e,this.v=t,this},copy:function(e){return this.u=e.u,this.v=e.v,this},lerpSelf:function(e,t){return this.u+=(e.u-this.u)*t,this.v+=(e.v-this.v)*t,this},clone:function(){return new THREE.UV(this.u,this.v)}},THREE.Geometry=function(){THREE.GeometryLibrary.push(this),this.id=THREE.GeometryIdCount++,this.name="",this.vertices=[],this.colors=[],this.normals=[],this.faces=[],this.faceUvs=[[]],this.faceVertexUvs=[[]],this.morphTargets=[],this.morphColors=[],this.morphNormals=[],this.skinWeights=[],this.skinIndices=[],this.lineDistances=[],this.boundingBox=null,this.boundingSphere=null,this.hasTangents=!1,this.dynamic=!0,this.verticesNeedUpdate=!1,this.elementsNeedUpdate=!1,this.uvsNeedUpdate=!1,this.normalsNeedUpdate=!1,this.tangentsNeedUpdate=!1,this.colorsNeedUpdate=!1,this.lineDistancesNeedUpdate=!1,this
  .buffersNeedUpdate=!1},THREE.Geometry.prototype={constructor:THREE.Geometry,applyMatrix:function(e){var t=new THREE.Matrix3;t.getInverse(e).transpose();for(var n=0,r=this.vertices.length;n<r;n++){var i=this.vertices[n];e.multiplyVector3(i)}for(var n=0,r=this.faces.length;n<r;n++){var s=this.faces[n];t.multiplyVector3(s.normal).normalize();for(var o=0,u=s.vertexNormals.length;o<u;o++)t.multiplyVector3(s.vertexNormals[o]).normalize();e.multiplyVector3(s.centroid)}},computeCentroids:function(){var e,t,n;for(e=0,t=this.faces.length;e<t;e++)n=this.faces[e],n.centroid.set(0,0,0),n instanceof THREE.Face3?(n.centroid.addSelf(this.vertices[n.a]),n.centroid.addSelf(this.vertices[n.b]),n.centroid.addSelf(this.vertices[n.c]),n.centroid.divideScalar(3)):n instanceof THREE.Face4&&(n.centroid.addSelf(this.vertices[n.a]),n.centroid.addSelf(this.vertices[n.b]),n.centroid.addSelf(this.vertices[n.c]),n.centroid.addSelf(this.vertices[n.d]),n.centroid.divideScalar(4))},computeFaceNormals:function(){var e,t,n,r,i,s,o,u,a,f,l,c=new 
  THREE.Vector3,h=new THREE.Vector3;for(s=0,o=this.faces.length;s<o;s++)u=this.faces[s],a=this.vertices[u.a],f=this.vertices[u.b],l=this.vertices[u.c],c.sub(l,f),h.sub(a,f),c.crossSelf(h),c.normalize(),u.normal.copy(c)},computeVertexNormals:function(e){var t,n,r,i,s,o;if(this.__tmpVertices===undefined){this.__tmpVertices=new Array(this.vertices.length),o=this.__tmpVertices;for(t=0,n=this.vertices.length;t<n;t++)o[t]=new THREE.Vector3;for(r=0,i=this.faces.length;r<i;r++)s=this.faces[r],s instanceof THREE.Face3?s.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]:s instanceof THREE.Face4&&(s.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3])}else{o=this.__tmpVertices;for(t=0,n=this.vertices.length;t<n;t++)o[t].set(0,0,0)}if(e){var u,a,f,l,c=new THREE.Vector3,h=new THREE.Vector3,p=new THREE.Vector3,d=new THREE.Vector3,v=new THREE.Vector3;for(r=0,i=this.faces.length;r<i;r++)s=this.faces[r],s instanceof THREE.Face3?(u=this.vertices[s.a],a=this.vertices[s.b],f=this
  .vertices[s.c],c.sub(f,a),h.sub(u,a),c.crossSelf(h),o[s.a].addSelf(c),o[s.b].addSelf(c),o[s.c].addSelf(c)):s instanceof THREE.Face4&&(u=this.vertices[s.a],a=this.vertices[s.b],f=this.vertices[s.c],l=this.vertices[s.d],p.sub(l,a),h.sub(u,a),p.crossSelf(h),o[s.a].addSelf(p),o[s.b].addSelf(p),o[s.d].addSelf(p),d.sub(l,f),v.sub(a,f),d.crossSelf(v),o[s.b].addSelf(d),o[s.c].addSelf(d),o[s.d].addSelf(d))}else for(r=0,i=this.faces.length;r<i;r++)s=this.faces[r],s instanceof THREE.Face3?(o[s.a].addSelf(s.normal),o[s.b].addSelf(s.normal),o[s.c].addSelf(s.normal)):s instanceof THREE.Face4&&(o[s.a].addSelf(s.normal),o[s.b].addSelf(s.normal),o[s.c].addSelf(s.normal),o[s.d].addSelf(s.normal));for(t=0,n=this.vertices.length;t<n;t++)o[t].normalize();for(r=0,i=this.faces.length;r<i;r++)s=this.faces[r],s instanceof THREE.Face3?(s.vertexNormals[0].copy(o[s.a]),s.vertexNormals[1].copy(o[s.b]),s.vertexNormals[2].copy(o[s.c])):s instanceof THREE.Face4&&(s.vertexNormals[0].copy(o[s.a]),s.vertexNormals[1].copy(o[s.b]),s.vertexNormals
  [2].copy(o[s.c]),s.vertexNormals[3].copy(o[s.d]))},computeMorphNormals:function(){var e,t,n,r,i;for(n=0,r=this.faces.length;n<r;n++){i=this.faces[n],i.__originalFaceNormal?i.__originalFaceNormal.copy(i.normal):i.__originalFaceNormal=i.normal.clone(),i.__originalVertexNormals||(i.__originalVertexNormals=[]);for(e=0,t=i.vertexNormals.length;e<t;e++)i.__originalVertexNormals[e]?i.__originalVertexNormals[e].copy(i.vertexNormals[e]):i.__originalVertexNormals[e]=i.vertexNormals[e].clone()}var s=new THREE.Geometry;s.faces=this.faces;for(e=0,t=this.morphTargets.length;e<t;e++){if(!this.morphNormals[e]){this.morphNormals[e]={},this.morphNormals[e].faceNormals=[],this.morphNormals[e].vertexNormals=[];var o=this.morphNormals[e].faceNormals,u=this.morphNormals[e].vertexNormals,a,f;for(n=0,r=this.faces.length;n<r;n++)i=this.faces[n],a=new THREE.Vector3,i instanceof THREE.Face3?f={a:new THREE.Vector3,b:new THREE.Vector3,c:new THREE.Vector3}:f={a:new THREE.Vector3,b:new THREE.Vector3,c:new THREE.Vector3,d:new THREE.Vector3},
  o.push(a),u.push(f)}var l=this.morphNormals[e];s.vertices=this.morphTargets[e].vertices,s.computeFaceNormals(),s.computeVertexNormals();var a,f;for(n=0,r=this.faces.length;n<r;n++)i=this.faces[n],a=l.faceNormals[n],f=l.vertexNormals[n],a.copy(i.normal),i instanceof THREE.Face3?(f.a.copy(i.vertexNormals[0]),f.b.copy(i.vertexNormals[1]),f.c.copy(i.vertexNormals[2])):(f.a.copy(i.vertexNormals[0]),f.b.copy(i.vertexNormals[1]),f.c.copy(i.vertexNormals[2]),f.d.copy(i.vertexNormals[3]))}for(n=0,r=this.faces.length;n<r;n++)i=this.faces[n],i.normal=i.__originalFaceNormal,i.vertexNormals=i.__originalVertexNormals},computeTangents:function(){function B(e,t,n,r,i,s,o){f=e.vertices[t],l=e.vertices[n],c=e.vertices[r],h=a[i],p=a[s],d=a[o],v=l.x-f.x,m=c.x-f.x,g=l.y-f.y,y=c.y-f.y,b=l.z-f.z,w=c.z-f.z,E=p.u-h.u,S=d.u-h.u,x=p.v-h.v,T=d.v-h.v,N=1/(E*T-S*x),O.set((T*v-x*m)*N,(T*g-x*y)*N,(T*b-x*w)*N),M.set((E*m-S*v)*N,(E*y-S*g)*N,(E*w-S*b)*N),L[t].addSelf(O),L[n].addSelf(O),L[r].addSelf(O),A[t].addSelf(M),A[n].addSelf(M),A[r].addSelf
  (M)}var e,t,n,r,i,s,o,u,a,f,l,c,h,p,d,v,m,g,y,b,w,E,S,x,T,N,C,k,L=[],A=[],O=new THREE.Vector3,M=new THREE.Vector3,_=new THREE.Vector3,D=new THREE.Vector3,P=new THREE.Vector3,H;for(n=0,r=this.vertices.length;n<r;n++)L[n]=new THREE.Vector3,A[n]=new THREE.Vector3;for(e=0,t=this.faces.length;e<t;e++)u=this.faces[e],a=this.faceVertexUvs[0][e],u instanceof THREE.Face3?B(this,u.a,u.b,u.c,0,1,2):u instanceof THREE.Face4&&(B(this,u.a,u.b,u.d,0,1,3),B(this,u.b,u.c,u.d,1,2,3));var j=["a","b","c","d"];for(e=0,t=this.faces.length;e<t;e++){u=this.faces[e];for(i=0;i<u.vertexNormals.length;i++)P.copy(u.vertexNormals[i]),o=u[j[i]],C=L[o],_.copy(C),_.subSelf(P.multiplyScalar(P.dot(C))).normalize(),D.cross(u.vertexNormals[i],C),k=D.dot(A[o]),H=k<0?-1:1,u.vertexTangents[i]=new THREE.Vector4(_.x,_.y,_.z,H)}this.hasTangents=!0},computeLineDistances:function(){var e=0,t=this.vertices;for(var n=0,r=t.length;n<r;n++)n>0&&(e+=t[n].distanceTo(t[n-1])),this.lineDistances[n]=e},computeBoundingBox:function(){this.boundingBox||(this.boundingBox=
  {min:new THREE.Vector3,max:new THREE.Vector3});if(this.vertices.length>0){var e,t=this.vertices[0];this.boundingBox.min.copy(t),this.boundingBox.max.copy(t);var n=this.boundingBox.min,r=this.boundingBox.max;for(var i=1,s=this.vertices.length;i<s;i++)e=this.vertices[i],e.x<n.x?n.x=e.x:e.x>r.x&&(r.x=e.x),e.y<n.y?n.y=e.y:e.y>r.y&&(r.y=e.y),e.z<n.z?n.z=e.z:e.z>r.z&&(r.z=e.z)}else this.boundingBox.min.set(0,0,0),this.boundingBox.max.set(0,0,0)},computeBoundingSphere:function(){var e=0;this.boundingSphere===null&&(this.boundingSphere={radius:0});for(var t=0,n=this.vertices.length;t<n;t++){var r=this.vertices[t].lengthSq();r>e&&(e=r)}this.boundingSphere.radius=Math.sqrt(e)},mergeVertices:function(){var e={},t=[],n=[],r,i,s=4,o=Math.pow(10,s),u,a,f,l="abcd",c,h,p,d,v;for(u=0,a=this.vertices.length;u<a;u++)r=this.vertices[u],i=[Math.round(r.x*o),Math.round(r.y*o),Math.round(r.z*o)].join("_"),e[i]===undefined?(e[i]=u,t.push(this.vertices[u]),n[u]=t.length-1):n[u]=n[e[i]];for(u=0,a=this.faces.length;u<a;u++){f=this.faces
  [u];if(f instanceof THREE.Face3)f.a=n[f.a],f.b=n[f.b],f.c=n[f.c];else if(f instanceof THREE.Face4){f.a=n[f.a],f.b=n[f.b],f.c=n[f.c],f.d=n[f.d],c=[f.a,f.b,f.c,f.d];for(h=3;h>0;h--)if(c.indexOf(f[l[h]])!==h){c.splice(h,1),this.faces[u]=new THREE.Face3(c[0],c[1],c[2],f.normal,f.color,f.materialIndex);for(p=0,d=this.faceVertexUvs.length;p<d;p++)v=this.faceVertexUvs[p][u],v&&v.splice(h,1);this.faces[u].vertexColors=f.vertexColors;break}}}var m=this.vertices.length-t.length;return this.vertices=t,m},clone:function(){var e=new THREE.Geometry,t=this.vertices;for(var n=0,r=t.length;n<r;n++)e.vertices.push(t[n].clone());var i=this.faces;for(var n=0,r=i.length;n<r;n++)e.faces.push(i[n].clone());var s=this.faceVertexUvs[0];for(var n=0,r=s.length;n<r;n++){var o=s[n],u=[];for(var a=0,f=o.length;a<f;a++)u.push(new THREE.UV(o[a].u,o[a].v));e.faceVertexUvs[0].push(u)}return e},deallocate:function(){var e=THREE.GeometryLibrary.indexOf(this);e!==-1&&THREE.GeometryLibrary.splice(e,1)}},THREE.GeometryIdCount=0,THREE.GeometryLibrary=
  [],THREE.BufferGeometry=function(){THREE.GeometryLibrary.push(this),this.id=THREE.GeometryIdCount++,this.attributes={},this.dynamic=!1,this.offsets=[],this.boundingBox=null,this.boundingSphere=null,this.hasTangents=!1,this.morphTargets=[]},THREE.BufferGeometry.prototype={constructor:THREE.BufferGeometry,applyMatrix:function(e){var t,n;this.attributes.position&&(t=this.attributes.position.array),this.attributes.normal&&(n=this.attributes.normal.array),t!==undefined&&(e.multiplyVector3Array(t),this.verticesNeedUpdate=!0);if(n!==undefined){var r=new THREE.Matrix3;r.getInverse(e).transpose(),r.multiplyVector3Array(n),this.normalizeNormals(),this.normalsNeedUpdate=!0}},computeBoundingBox:function(){this.boundingBox||(this.boundingBox={min:new THREE.Vector3(Infinity,Infinity,Infinity),max:new THREE.Vector3(-Infinity,-Infinity,-Infinity)});var e=this.attributes.position.array;if(e){var t=this.boundingBox,n,r,i;for(var s=0,o=e.length;s<o;s+=3)n=e[s],r=e[s+1],i=e[s+2],n<t.min.x?t.min.x=n:n>t.max.x&&(t.max.x=n),r<t.min.
  y?t.min.y=r:r>t.max.y&&(t.max.y=r),i<t.min.z?t.min.z=i:i>t.max.z&&(t.max.z=i)}if(e===undefined||e.length===0)this.boundingBox.min.set(0,0,0),this.boundingBox.max.set(0,0,0)},computeBoundingSphere:function(){this.boundingSphere||(this.boundingSphere={radius:0});var e=this.attributes.position.array;if(e){var t,n=0,r,i,s;for(var o=0,u=e.length;o<u;o+=3)r=e[o],i=e[o+1],s=e[o+2],t=r*r+i*i+s*s,t>n&&(n=t);this.boundingSphere.radius=Math.sqrt(n)}},computeVertexNormals:function(){if(this.attributes.position){var e,t,n,r,i=this.attributes.position.array.length;if(this.attributes.normal===undefined)this.attributes.normal={itemSize:3,array:new Float32Array(i),numItems:i};else for(e=0,t=this.attributes.normal.array.length;e<t;e++)this.attributes.normal.array[e]=0;var s=this.attributes.position.array,o=this.attributes.normal.array,u,a,f,l,c,h,p=new THREE.Vector3,d=new THREE.Vector3,v=new THREE.Vector3,m=new THREE.Vector3,g=new THREE.Vector3;if(this.attributes.index){var y=this.attributes.index.array,b=this.offsets;for(n=0,r=
  b.length;n<r;++n){var w=b[n].start,E=b[n].count,S=b[n].index;for(e=w,t=w+E;e<t;e+=3)u=S+y[e],a=S+y[e+1],f=S+y[e+2],l=s[u*3],c=s[u*3+1],h=s[u*3+2],p.set(l,c,h),l=s[a*3],c=s[a*3+1],h=s[a*3+2],d.set(l,c,h),l=s[f*3],c=s[f*3+1],h=s[f*3+2],v.set(l,c,h),m.sub(v,d),g.sub(p,d),m.crossSelf(g),o[u*3]+=m.x,o[u*3+1]+=m.y,o[u*3+2]+=m.z,o[a*3]+=m.x,o[a*3+1]+=m.y,o[a*3+2]+=m.z,o[f*3]+=m.x,o[f*3+1]+=m.y,o[f*3+2]+=m.z}}else for(e=0,t=s.length;e<t;e+=9)l=s[e],c=s[e+1],h=s[e+2],p.set(l,c,h),l=s[e+3],c=s[e+4],h=s[e+5],d.set(l,c,h),l=s[e+6],c=s[e+7],h=s[e+8],v.set(l,c,h),m.sub(v,d),g.sub(p,d),m.crossSelf(g),o[e]=m.x,o[e+1]=m.y,o[e+2]=m.z,o[e+3]=m.x,o[e+4]=m.y,o[e+5]=m.z,o[e+6]=m.x,o[e+7]=m.y,o[e+8]=m.z;this.normalizeNormals(),this.normalsNeedUpdate=!0}},normalizeNormals:function(){var e=this.attributes.normal.array,t,n,r,i;for(var s=0,o=e.length;s<o;s+=3)t=e[s],n=e[s+1],r=e[s+2],i=1/Math.sqrt(t*t+n*n+r*r),e[s]*=i,e[s+1]*=i,e[s+2]*=i},computeTangents:function(){function F(e,n,i){l=t[e*3],c=t[e*3+1],h=t[e*3+2],p=t[n*3],d=t[n*3+1],v=t
  [n*3+2],m=t[i*3],g=t[i*3+1],y=t[i*3+2],b=r[e*2],w=r[e*2+1],E=r[n*2],S=r[n*2+1],x=r[i*2],T=r[i*2+1],N=p-l,C=m-l,k=d-c,L=g-c,A=v-h,O=y-h,M=E-b,_=x-b,D=S-w,P=T-w,H=1/(M*P-_*D),B.set((P*N-D*C)*H,(P*k-D*L)*H,(P*A-D*O)*H),j.set((M*C-_*N)*H,(M*L-_*k)*H,(M*O-_*A)*H),u[e].addSelf(B),u[n].addSelf(B),u[i].addSelf(B),a[e].addSelf(j),a[n].addSelf(j),a[i].addSelf(j)}function ot(e){Y.x=n[e*3],Y.y=n[e*3+1],Y.z=n[e*3+2],Z.copy(Y),tt=u[e],Q.copy(tt),Q.subSelf(Y.multiplyScalar(Y.dot(tt))).normalize(),G.cross(Z,tt),nt=G.dot(a[e]),et=nt<0?-1:1,o[e*4]=Q.x,o[e*4+1]=Q.y,o[e*4+2]=Q.z,o[e*4+3]=et}if(this.attributes.index===undefined||this.attributes.position===undefined||this.attributes.normal===undefined||this.attributes.uv===undefined){console.warn("Missing required attributes (index, position, normal or uv) in BufferGeometry.computeTangents()");return}var e=this.attributes.index.array,t=this.attributes.position.array,n=this.attributes.normal.array,r=this.attributes.uv.array,i=t.length/3;if(this.attributes.tangent===undefined){var s=4*
  i;this.attributes.tangent={itemSize:4,array:new Float32Array(s),numItems:s}}var o=this.attributes.tangent.array,u=[],a=[];for(var f=0;f<i;f++)u[f]=new THREE.Vector3,a[f]=new THREE.Vector3;var l,c,h,p,d,v,m,g,y,b,w,E,S,x,T,N,C,k,L,A,O,M,_,D,P,H,B=new THREE.Vector3,j=new THREE.Vector3,I,q,R,U,z,W,X,V=this.offsets;for(R=0,U=V.length;R<U;++R){var $=V[R].start,J=V[R].count,K=V[R].index;for(I=$,q=$+J;I<q;I+=3)z=K+e[I],W=K+e[I+1],X=K+e[I+2],F(z,W,X)}var Q=new THREE.Vector3,G=new THREE.Vector3,Y=new THREE.Vector3,Z=new THREE.Vector3,et,tt,nt,rt,it,st;for(R=0,U=V.length;R<U;++R){var $=V[R].start,J=V[R].count,K=V[R].index;for(I=$,q=$+J;I<q;I+=3)z=K+e[I],W=K+e[I+1],X=K+e[I+2],ot(z),ot(W),ot(X)}this.hasTangents=!0,this.tangentsNeedUpdate=!0},deallocate:function(){var e=THREE.GeometryLibrary.indexOf(this);e!==-1&&THREE.GeometryLibrary.splice(e,1)}},THREE.Spline=function(e){function h(e,t,n,r,i,s,o){var u=(n-e)*.5,a=(r-t)*.5;return(2*(t-n)+u+a)*o+(-3*(t-n)-2*u-a)*s+u*i+t}this.points=e;var t=[],n={x:0,y:0,z:0},r,i,s,o,u,a,f,
  l,c;this.initFromArray=function(e){this.points=[];for(var t=0;t<e.length;t++)this.points[t]={x:e[t][0],y:e[t][1],z:e[t][2]}},this.getPoint=function(e){return r=(this.points.length-1)*e,i=Math.floor(r),s=r-i,t[0]=i===0?i:i-1,t[1]=i,t[2]=i>this.points.length-2?this.points.length-1:i+1,t[3]=i>this.points.length-3?this.points.length-1:i+2,a=this.points[t[0]],f=this.points[t[1]],l=this.points[t[2]],c=this.points[t[3]],o=s*s,u=s*o,n.x=h(a.x,f.x,l.x,c.x,s,o,u),n.y=h(a.y,f.y,l.y,c.y,s,o,u),n.z=h(a.z,f.z,l.z,c.z,s,o,u),n},this.getControlPointsArray=function(){var e,t,n=this.points.length,r=[];for(e=0;e<n;e++)t=this.points[e],r[e]=[t.x,t.y,t.z];return r},this.getLength=function(e){var t,n,r,i,s=0,o=0,u=0,a=new THREE.Vector3,f=new THREE.Vector3,l=[],c=0;l[0]=0,e||(e=100),r=this.points.length*e,a.copy(this.points[0]);for(t=1;t<r;t++)n=t/r,i=this.getPoint(n),f.copy(i),c+=f.distanceTo(a),a.copy(i),s=(this.points.length-1)*n,o=Math.floor(s),o!=u&&(l[o]=c,u=o);return l[l.length]=c,{chunks:l,total:c}},this.reparametrizeByArcLength=
  function(e){var t,n,r,i,s,o,u,a,f,l=[],c=new THREE.Vector3,h=this.getLength();l.push(c.copy(this.points[0]).clone());for(t=1;t<this.points.length;t++){u=h.chunks[t]-h.chunks[t-1],a=Math.ceil(e*u/h.total),i=(t-1)/(this.points.length-1),s=t/(this.points.length-1);for(n=1;n<a-1;n++)r=i+n*(1/a)*(s-i),f=this.getPoint(r),l.push(c.copy(f).clone());l.push(c.copy(this.points[t]).clone())}this.points=l}},THREE.Camera=function(){THREE.Object3D.call(this),this.matrixWorldInverse=new THREE.Matrix4,this.projectionMatrix=new THREE.Matrix4,this.projectionMatrixInverse=new THREE.Matrix4},THREE.Camera.prototype=Object.create(THREE.Object3D.prototype),THREE.Camera.prototype.lookAt=function(e){this.matrix.lookAt(this.position,e,this.up),this.rotationAutoUpdate===!0&&(this.useQuaternion===!1?this.rotation.setEulerFromRotationMatrix(this.matrix,this.eulerOrder):this.quaternion.copy(this.matrix.decompose()[1]))},THREE.OrthographicCamera=function(e,t,n,r,i,s){THREE.Camera.call(this),this.left=e,this.right=t,this.top=n,this.bottom=r,this
  .near=i!==undefined?i:.1,this.far=s!==undefined?s:2e3,this.updateProjectionMatrix()},THREE.OrthographicCamera.prototype=Object.create(THREE.Camera.prototype),THREE.OrthographicCamera.prototype.updateProjectionMatrix=function(){this.projectionMatrix.makeOrthographic(this.left,this.right,this.top,this.bottom,this.near,this.far)},THREE.PerspectiveCamera=function(e,t,n,r){THREE.Camera.call(this),this.fov=e!==undefined?e:50,this.aspect=t!==undefined?t:1,this.near=n!==undefined?n:.1,this.far=r!==undefined?r:2e3,this.updateProjectionMatrix()},THREE.PerspectiveCamera.prototype=Object.create(THREE.Camera.prototype),THREE.PerspectiveCamera.prototype.setLens=function(e,t){t===undefined&&(t=24),this.fov=2*Math.atan(t/(e*2))*(180/Math.PI),this.updateProjectionMatrix()},THREE.PerspectiveCamera.prototype.setViewOffset=function(e,t,n,r,i,s){this.fullWidth=e,this.fullHeight=t,this.x=n,this.y=r,this.width=i,this.height=s,this.updateProjectionMatrix()},THREE.PerspectiveCamera.prototype.updateProjectionMatrix=function(){if(this.fullWidth
  ){var e=this.fullWidth/this.fullHeight,t=Math.tan(this.fov*Math.PI/360)*this.near,n=-t,r=e*n,i=e*t,s=Math.abs(i-r),o=Math.abs(t-n);this.projectionMatrix.makeFrustum(r+this.x*s/this.fullWidth,r+(this.x+this.width)*s/this.fullWidth,t-(this.y+this.height)*o/this.fullHeight,t-this.y*o/this.fullHeight,this.near,this.far)}else this.projectionMatrix.makePerspective(this.fov,this.aspect,this.near,this.far)},THREE.Light=function(e){THREE.Object3D.call(this),this.color=new THREE.Color(e)},THREE.Light.prototype=Object.create(THREE.Object3D.prototype),THREE.AmbientLight=function(e){THREE.Light.call(this,e)},THREE.AmbientLight.prototype=Object.create(THREE.Light.prototype),THREE.DirectionalLight=function(e,t){THREE.Light.call(this,e),this.position=new THREE.Vector3(0,1,0),this.target=new THREE.Object3D,this.intensity=t!==undefined?t:1,this.castShadow=!1,this.onlyShadow=!1,this.shadowCameraNear=50,this.shadowCameraFar=5e3,this.shadowCameraLeft=-500,this.shadowCameraRight=500,this.shadowCameraTop=500,this.shadowCameraBottom=-500
  ,this.shadowCameraVisible=!1,this.shadowBias=0,this.shadowDarkness=.5,this.shadowMapWidth=512,this.shadowMapHeight=512,this.shadowCascade=!1,this.shadowCascadeOffset=new 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.shadowMap=null,this.shadowMapSize=null,this.shadowCamera=null,this.shadowMatrix=null},THREE.DirectionalLight.prototype=Object.create(THREE.Light.prototype),THREE.HemisphereLight=function(e,t,n){THREE.Light.call(this,e),this.groundColor=new THREE.Color(t),this.position=new THREE.Vector3(0,100,0),this.intensity=n!==undefined?n:1},THREE.HemisphereLight.prototype=Object.create(THREE.Light.prototype),THREE.PointLight=function(e,t,n){THREE.Light.call(this,e),this.position=new THREE.Vector3(0,0,0),this.intensity=t!==undefined?t:1,this.distance=n!==undefined?n:0},THREE.PointLight.prototype=Object
  .create(THREE.Light.prototype),THREE.SpotLight=function(e,t,n,r,i){THREE.Light.call(this,e),this.position=new THREE.Vector3(0,1,0),this.target=new THREE.Object3D,this.intensity=t!==undefined?t:1,this.distance=n!==undefined?n:0,this.angle=r!==undefined?r:Math.PI/2,this.exponent=i!==undefined?i:10,this.castShadow=!1,this.onlyShadow=!1,this.shadowCameraNear=50,this.shadowCameraFar=5e3,this.shadowCameraFov=50,this.shadowCameraVisible=!1,this.shadowBias=0,this.shadowDarkness=.5,this.shadowMapWidth=512,this.shadowMapHeight=512,this.shadowMap=null,this.shadowMapSize=null,this.shadowCamera=null,this.shadowMatrix=null},THREE.SpotLight.prototype=Object.create(THREE.Light.prototype),THREE.Loader=function(e){this.showStatus=e,this.statusDomElement=e?THREE.Loader.prototype.addStatusElement():null,this.onLoadStart=function(){},this.onLoadProgress=function(){},this.onLoadComplete=function(){}},THREE.Loader.prototype={constructor:THREE.Loader,crossOrigin:"anonymous",addStatusElement:function(){var e=document.createElement("div"
  );return e.style.position="absolute",e.style.right="0px",e.style.top="0px",e.style.fontSize="0.8em",e.style.textAlign="left",e.style.background="rgba(0,0,0,0.25)",e.style.color="#fff",e.style.width="120px",e.style.padding="0.5em 0.5em 0.5em 0.5em",e.style.zIndex=1e3,e.innerHTML="Loading ...",e},updateProgress:function(e){var t="Loaded ";e.total?t+=(100*e.loaded/e.total).toFixed(0)+"%":t+=(e.loaded/1e3).toFixed(2)+" KB",this.statusDomElement.innerHTML=t},extractUrlBase:function(e){var t=e.split("/");return t.pop(),(t.length<1?".":t.join("/"))+"/"},initMaterials:function(e,t){var n=[];for(var r=0;r<e.length;++r)n[r]=THREE.Loader.prototype.createMaterial(e[r],t);return n},needsTangents:function(e){for(var t=0,n=e.length;t<n;t++){var r=e[t];if(r instanceof THREE.ShaderMaterial)return!0}return!1},createMaterial:function(e,t){function r(e){var t=Math.log(e)/Math.LN2;return Math.floor(t)==t}function i(e){var t=Math.log(e)/Math.LN2;return Math.pow(2,Math.round(t))}function s(e,t){var s=new Image;s.onload=function(){if(!
  r(this.width)||!r(this.height)){var t=i(this.width),n=i(this.height);e.image.width=t,e.image.height=n,e.image.getContext("2d").drawImage(this,0,0,t,n)}else e.image=this;e.needsUpdate=!0},s.crossOrigin=n.crossOrigin,s.src=t}function o(e,n,r,i,o,u,a){var f=r.toLowerCase().endsWith(".dds"),l=t+"/"+r;if(f){var c=THREE.ImageUtils.loadCompressedTexture(l);e[n]=c}else{var c=document.createElement("canvas");e[n]=new THREE.Texture(c)}e[n].sourceFile=r,i&&(e[n].repeat.set(i[0],i[1]),i[0]!==1&&(e[n].wrapS=THREE.RepeatWrapping),i[1]!==1&&(e[n].wrapT=THREE.RepeatWrapping)),o&&e[n].offset.set(o[0],o[1]);if(u){var h={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};h[u[0]]!==undefined&&(e[n].wrapS=h[u[0]]),h[u[1]]!==undefined&&(e[n].wrapT=h[u[1]])}a&&(e[n].anisotropy=a),f||s(e[n],l)}function u(e){return(e[0]*255<<16)+(e[1]*255<<8)+e[2]*255}var n=this,a="MeshLambertMaterial",f={color:15658734,opacity:1,map:null,lightMap:null,normalMap:null,bumpMap:null,wireframe:!1};if(e.shading){var l=e.shading.toLowerCase();
  l==="phong"?a="MeshPhongMaterial":l==="basic"&&(a="MeshBasicMaterial")}e.blending!==undefined&&THREE[e.blending]!==undefined&&(f.blending=THREE[e.blending]);if(e.transparent!==undefined||e.opacity<1)f.transparent=e.transparent;e.depthTest!==undefined&&(f.depthTest=e.depthTest),e.depthWrite!==undefined&&(f.depthWrite=e.depthWrite),e.visible!==undefined&&(f.visible=e.visible),e.flipSided!==undefined&&(f.side=THREE.BackSide),e.doubleSided!==undefined&&(f.side=THREE.DoubleSide),e.wireframe!==undefined&&(f.wireframe=e.wireframe),e.vertexColors!==undefined&&(e.vertexColors==="face"?f.vertexColors=THREE.FaceColors:e.vertexColors&&(f.vertexColors=THREE.VertexColors)),e.colorDiffuse?f.color=u(e.colorDiffuse):e.DbgColor&&(f.color=e.DbgColor),e.colorSpecular&&(f.specular=u(e.colorSpecular)),e.colorAmbient&&(f.ambient=u(e.colorAmbient)),e.transparency&&(f.opacity=e.transparency),e.specularCoef&&(f.shininess=e.specularCoef),e.mapDiffuse&&t&&o(f,"map",e.mapDiffuse,e.mapDiffuseRepeat,e.mapDiffuseOffset,e.mapDiffuseWrap,e.mapDiffuseAnisotropy
  ),e.mapLight&&t&&o(f,"lightMap",e.mapLight,e.mapLightRepeat,e.mapLightOffset,e.mapLightWrap,e.mapLightAnisotropy),e.mapBump&&t&&o(f,"bumpMap",e.mapBump,e.mapBumpRepeat,e.mapBumpOffset,e.mapBumpWrap,e.mapBumpAnisotropy),e.mapNormal&&t&&o(f,"normalMap",e.mapNormal,e.mapNormalRepeat,e.mapNormalOffset,e.mapNormalWrap,e.mapNormalAnisotropy),e.mapSpecular&&t&&o(f,"specularMap",e.mapSpecular,e.mapSpecularRepeat,e.mapSpecularOffset,e.mapSpecularWrap,e.mapSpecularAnisotropy),e.mapBumpScale&&(f.bumpScale=e.mapBumpScale);if(e.mapNormal){var c=THREE.ShaderUtils.lib.normal,h=THREE.UniformsUtils.clone(c.uniforms);h.tNormal.value=f.normalMap,e.mapNormalFactor&&h.uNormalScale.value.set(e.mapNormalFactor,e.mapNormalFactor),f.map&&(h.tDiffuse.value=f.map,h.enableDiffuse.value=!0),f.specularMap&&(h.tSpecular.value=f.specularMap,h.enableSpecular.value=!0),f.lightMap&&(h.tAO.value=f.lightMap,h.enableAO.value=!0),h.uDiffuseColor.value.setHex(f.color),h.uSpecularColor.value.setHex(f.specular),h.uAmbientColor.value.setHex(f.ambient),
  h.uShininess.value=f.shininess,f.opacity!==undefined&&(h.uOpacity.value=f.opacity);var p={fragmentShader:c.fragmentShader,vertexShader:c.vertexShader,uniforms:h,lights:!0,fog:!0},d=new THREE.ShaderMaterial(p)}else var d=new THREE[a](f);return e.DbgName!==undefined&&(d.name=e.DbgName),d}},THREE.BinaryLoader=function(e){THREE.Loader.call(this,e)},THREE.BinaryLoader.prototype=Object.create(THREE.Loader.prototype),THREE.BinaryLoader.prototype.load=function(e,t,n,r){n=n&&typeof n=="string"?n:this.extractUrlBase(e),r=r&&typeof r=="string"?r:this.extractUrlBase(e);var i=this.showProgress?THREE.Loader.prototype.updateProgress:null;this.onLoadStart(),this.loadAjaxJSON(this,e,t,n,r,i)},THREE.BinaryLoader.prototype.loadAjaxJSON=function(e,t,n,r,i,s){var o=new XMLHttpRequest;o.onreadystatechange=function(){if(o.readyState==4)if(o.status==200||o.status==0){var u=JSON.parse(o.responseText);e.loadAjaxBuffers(u,n,i,r,s)}else console.error("THREE.BinaryLoader: Couldn't load ["+t+"] ["+o.status+"]")},o.open("GET",t,!0),o.send(null
  )},THREE.BinaryLoader.prototype.loadAjaxBuffers=function(e,t,n,r,i){var s=new XMLHttpRequest,o=n+"/"+e.buffers,u=0;s.onreadystatechange=function(){if(s.readyState==4)if(s.status==200||s.status==0){var n=s.response;n===undefined&&(n=(new Uint8Array(s.responseBody)).buffer),THREE.BinaryLoader.prototype.createBinModel(n,t,r,e.materials)}else console.error("THREE.BinaryLoader: Couldn't load ["+o+"] ["+s.status+"]");else s.readyState==3?i&&(u==0&&(u=s.getResponseHeader("Content-Length")),i({total:u,loaded:s.responseText.length})):s.readyState==2&&(u=s.getResponseHeader("Content-Length"))},s.open("GET",o,!0),s.responseType="arraybuffer",s.send(null)},THREE.BinaryLoader.prototype.createBinModel=function(e,t,n,r){function s(e,t,n,r){e.vertices.push(new THREE.Vector3(t,n,r))}function o(e,t,n,r,i){e.faces.push(new THREE.Face3(t,n,r,null,null,i))}function u(e,t,n,r,i,s){e.faces.push(new THREE.Face4(t,n,r,i,null,null,s))}function a(e,t,n,r,i,s,o,u,a){var f=t[o*3],l=t[o*3+1],c=t[o*3+2],h=t[u*3],p=t[u*3+1],d=t[u*3+2],v=t[a*3
  ],m=t[a*3+1],g=t[a*3+2];e.faces.push(new THREE.Face3(n,r,i,[new THREE.Vector3(f,l,c),new THREE.Vector3(h,p,d),new THREE.Vector3(v,m,g)],null,s))}function f(e,t,n,r,i,s,o,u,a,f,l){var c=t[u*3],h=t[u*3+1],p=t[u*3+2],d=t[a*3],v=t[a*3+1],m=t[a*3+2],g=t[f*3],y=t[f*3+1],b=t[f*3+2],w=t[l*3],E=t[l*3+1],S=t[l*3+2];e.faces.push(new THREE.Face4(n,r,i,s,[new THREE.Vector3(c,h,p),new THREE.Vector3(d,v,m),new THREE.Vector3(g,y,b),new THREE.Vector3(w,E,S)],null,o))}function l(e,t,n,r,i,s,o){e.push([new THREE.UV(t,n),new THREE.UV(r,i),new THREE.UV(s,o)])}function c(e,t,n,r,i,s,o,u,a){e.push([new THREE.UV(t,n),new THREE.UV(r,i),new THREE.UV(s,o),new THREE.UV(u,a)])}var i=function(t){function _(e){return e%4?4-e%4:0}function D(e,t){var n={signature:P(e,t,12),header_bytes:H(e,t+12),vertex_coordinate_bytes:H(e,t+13),normal_coordinate_bytes:H(e,t+14),uv_coordinate_bytes:H(e,t+15),vertex_index_bytes:H(e,t+16),normal_index_bytes:H(e,t+17),uv_index_bytes:H(e,t+18),material_index_bytes:H(e,t+19),nvertices:B(e,t+20),nnormals:B(e,t+20+4
  ),nuvs:B(e,t+20+8),ntri_flat:B(e,t+20+12),ntri_smooth:B(e,t+20+16),ntri_flat_uv:B(e,t+20+20),ntri_smooth_uv:B(e,t+20+24),nquad_flat:B(e,t+20+28),nquad_smooth:B(e,t+20+32),nquad_flat_uv:B(e,t+20+36),nquad_smooth_uv:B(e,t+20+40)};return n}function P(e,t,n){var r=new Uint8Array(e,t,n),i="";for(var s=0;s<n;s++)i+=String.fromCharCode(r[t+s]);return i}function H(e,t){var n=new Uint8Array(e,t,1);return n[0]}function B(e,t){var n=new Uint32Array(e,t,1);return n[0]}function j(t){var r=i.nvertices,o=new Float32Array(e,t,r*3),u,a,f,l;for(u=0;u<r;u++)a=o[u*3],f=o[u*3+1],l=o[u*3+2],s(n,a,f,l);return r*3*Float32Array.BYTES_PER_ELEMENT}function F(t){var n=i.nnormals;if(n){var r=new Int8Array(e,t,n*3),s,o,u,a;for(s=0;s<n;s++)o=r[s*3],u=r[s*3+1],a=r[s*3+2],h.push(o/127,u/127,a/127)}return n*3*Int8Array.BYTES_PER_ELEMENT}function I(t){var n=i.nuvs;if(n){var r=new Float32Array(e,t,n*2),s,o,u;for(s=0;s<n;s++)o=r[s*2],u=r[s*2+1],p.push(o,u)}return n*2*Float32Array.BYTES_PER_ELEMENT}function q(t,r){var i,s,o,u,a,f,c,h,d,v,m=new Uint32Array
  (e,r,3*t);for(i=0;i<t;i++)s=m[i*3],o=m[i*3+1],u=m[i*3+2],a=p[s*2],h=p[s*2+1],f=p[o*2],d=p[o*2+1],c=p[u*2],v=p[u*2+1],l(n.faceVertexUvs[0],a,h,f,d,c,v)}function R(t,r){var i,s,o,u,a,f,l,h,d,v,m,g,y,b=new Uint32Array(e,r,4*t);for(i=0;i<t;i++)s=b[i*4],o=b[i*4+1],u=b[i*4+2],a=b[i*4+3],f=p[s*2],v=p[s*2+1],l=p[o*2],m=p[o*2+1],h=p[u*2],g=p[u*2+1],d=p[a*2],y=p[a*2+1],c(n.faceVertexUvs[0],f,v,l,m,h,g,d,y)}function U(t,r,i){var s,u,a,f,l,c=new Uint32Array(e,r,3*t),h=new Uint16Array(e,i,t);for(s=0;s<t;s++)u=c[s*3],a=c[s*3+1],f=c[s*3+2],l=h[s],o(n,u,a,f,l)}function z(t,r,i){var s,o,a,f,l,c,h=new Uint32Array(e,r,4*t),p=new Uint16Array(e,i,t);for(s=0;s<t;s++)o=h[s*4],a=h[s*4+1],f=h[s*4+2],l=h[s*4+3],c=p[s],u(n,o,a,f,l,c)}function W(t,r,i,s){var o,u,f,l,c,p,d,v,m=new Uint32Array(e,r,3*t),g=new Uint32Array(e,i,3*t),y=new Uint16Array(e,s,t);for(o=0;o<t;o++)u=m[o*3],f=m[o*3+1],l=m[o*3+2],p=g[o*3],d=g[o*3+1],v=g[o*3+2],c=y[o],a(n,h,u,f,l,c,p,d,v)}function X(t,r,i,s){var o,u,a,l,c,p,d,v,m,g,y=new Uint32Array(e,r,4*t),b=new Uint32Array
  (e,i,4*t),w=new Uint16Array(e,s,t);for(o=0;o<t;o++)u=y[o*4],a=y[o*4+1],l=y[o*4+2],c=y[o*4+3],d=b[o*4],v=b[o*4+1],m=b[o*4+2],g=b[o*4+3],p=w[o],f(n,h,u,a,l,c,p,d,v,m,g)}function V(e){var t=i.ntri_flat;if(t){var n=e+t*Uint32Array.BYTES_PER_ELEMENT*3;U(t,e,n)}}function $(e){var t=i.ntri_flat_uv;if(t){var n=e+t*Uint32Array.BYTES_PER_ELEMENT*3,r=n+t*Uint32Array.BYTES_PER_ELEMENT*3;U(t,e,r),q(t,n)}}function J(e){var t=i.ntri_smooth;if(t){var n=e+t*Uint32Array.BYTES_PER_ELEMENT*3,r=n+t*Uint32Array.BYTES_PER_ELEMENT*3;W(t,e,n,r)}}function K(e){var t=i.ntri_smooth_uv;if(t){var n=e+t*Uint32Array.BYTES_PER_ELEMENT*3,r=n+t*Uint32Array.BYTES_PER_ELEMENT*3,s=r+t*Uint32Array.BYTES_PER_ELEMENT*3;W(t,e,n,s),q(t,r)}}function Q(e){var t=i.nquad_flat;if(t){var n=e+t*Uint32Array.BYTES_PER_ELEMENT*4;z(t,e,n)}}function G(e){var t=i.nquad_flat_uv;if(t){var n=e+t*Uint32Array.BYTES_PER_ELEMENT*4,r=n+t*Uint32Array.BYTES_PER_ELEMENT*4;z(t,e,r),R(t,n)}}function Y(e){var t=i.nquad_smooth;if(t){var n=e+t*Uint32Array.BYTES_PER_ELEMENT*4,r=n+t*
  Uint32Array.BYTES_PER_ELEMENT*4;X(t,e,n,r)}}function Z(e){var t=i.nquad_smooth_uv;if(t){var n=e+t*Uint32Array.BYTES_PER_ELEMENT*4,r=n+t*Uint32Array.BYTES_PER_ELEMENT*4,s=r+t*Uint32Array.BYTES_PER_ELEMENT*4;X(t,e,n,s),R(t,r)}}var n=this,r=0,i,h=[],p=[],d,v,m,g,y,b,w,E,S,x,T,N,C,k,L,A,O,M;THREE.Geometry.call(this),i=D(e,r),r+=i.header_bytes,S=i.vertex_index_bytes*3+i.material_index_bytes,x=i.vertex_index_bytes*4+i.material_index_bytes,T=i.ntri_flat*S,N=i.ntri_smooth*(S+i.normal_index_bytes*3),C=i.ntri_flat_uv*(S+i.uv_index_bytes*3),k=i.ntri_smooth_uv*(S+i.normal_index_bytes*3+i.uv_index_bytes*3),L=i.nquad_flat*x,A=i.nquad_smooth*(x+i.normal_index_bytes*4),O=i.nquad_flat_uv*(x+i.uv_index_bytes*4),M=i.nquad_smooth_uv*(x+i.normal_index_bytes*4+i.uv_index_bytes*4),r+=j(r),r+=F(r),r+=_(i.nnormals*3),r+=I(r),d=r,v=d+T+_(i.ntri_flat*2),m=v+N+_(i.ntri_smooth*2),g=m+C+_(i.ntri_flat_uv*2),y=g+k+_(i.ntri_smooth_uv*2),b=y+L+_(i.nquad_flat*2),w=b+A+_(i.nquad_smooth*2),E=w+O+_(i.nquad_flat_uv*2),$(m),K(g),G(w),Z(E),V(d),J(v),
  Q(y),Y(b),this.computeCentroids(),this.computeFaceNormals()};i.prototype=Object.create(THREE.Geometry.prototype);var h=new i(n),p=this.initMaterials(r,n);this.needsTangents(p)&&h.computeTangents(),t(h,p)},THREE.ImageLoader=function(){THREE.EventTarget.call(this),this.crossOrigin=null},THREE.ImageLoader.prototype={constructor:THREE.ImageLoader,load:function(e,t){var n=this;t===undefined&&(t=new Image),t.addEventListener("load",function(){n.dispatchEvent({type:"load",content:t})},!1),t.addEventListener("error",function(){n.dispatchEvent({type:"error",message:"Couldn't load URL ["+e+"]"})},!1),n.crossOrigin&&(t.crossOrigin=n.crossOrigin),t.src=e}},THREE.JSONLoader=function(e){THREE.Loader.call(this,e),this.withCredentials=!1},THREE.JSONLoader.prototype=Object.create(THREE.Loader.prototype),THREE.JSONLoader.prototype.load=function(e,t,n){var r=this;n=n&&typeof n=="string"?n:this.extractUrlBase(e),this.onLoadStart(),this.loadAjaxJSON(this,e,t,n)},THREE.JSONLoader.prototype.loadAjaxJSON=function(e,t,n,r,i){var s=new 
  XMLHttpRequest,o=0;s.withCredentials=this.withCredentials,s.onreadystatechange=function(){if(s.readyState===s.DONE)if(s.status===200||s.status===0){if(s.responseText){var u=JSON.parse(s.responseText);e.createModel(u,n,r)}else console.warn("THREE.JSONLoader: ["+t+"] seems to be unreachable or file there is empty");e.onLoadComplete()}else console.error("THREE.JSONLoader: Couldn't load ["+t+"] ["+s.status+"]");else s.readyState===s.LOADING?i&&(o===0&&(o=s.getResponseHeader("Content-Length")),i({total:o,loaded:s.responseText.length})):s.readyState===s.HEADERS_RECEIVED&&(o=s.getResponseHeader("Content-Length"))},s.open("GET",t,!0),s.send(null)},THREE.JSONLoader.prototype.createModel=function(e,t,n){function o(t){function n(e,t){return e&1<<t}var r,s,o,u,a,f,l,c,h,p,d,v,m,g,y,b,w,E,S,x,T,N,C,k,L,A,O,M=e.faces,_=e.vertices,D=e.normals,P=e.colors,H=0;for(r=0;r<e.uvs.length;r++)e.uvs[r].length&&H++;for(r=0;r<H;r++)i.faceUvs[r]=[],i.faceVertexUvs[r]=[];u=0,a=_.length;while(u<a)x=new THREE.Vector3,x.x=_[u++]*t,x.y=_[u++]*
  t,x.z=_[u++]*t,i.vertices.push(x);u=0,a=M.length;while(u<a){d=M[u++],v=n(d,0),m=n(d,1),g=n(d,2),y=n(d,3),b=n(d,4),w=n(d,5),E=n(d,6),S=n(d,7),v?(T=new THREE.Face4,T.a=M[u++],T.b=M[u++],T.c=M[u++],T.d=M[u++],f=4):(T=new THREE.Face3,T.a=M[u++],T.b=M[u++],T.c=M[u++],f=3),m&&(p=M[u++],T.materialIndex=p),o=i.faces.length;if(g)for(r=0;r<H;r++)k=e.uvs[r],h=M[u++],A=k[h*2],O=k[h*2+1],i.faceUvs[r][o]=new THREE.UV(A,O);if(y)for(r=0;r<H;r++){k=e.uvs[r],L=[];for(s=0;s<f;s++)h=M[u++],A=k[h*2],O=k[h*2+1],L[s]=new THREE.UV(A,O);i.faceVertexUvs[r][o]=L}b&&(c=M[u++]*3,C=new THREE.Vector3,C.x=D[c++],C.y=D[c++],C.z=D[c],T.normal=C);if(w)for(r=0;r<f;r++)c=M[u++]*3,C=new THREE.Vector3,C.x=D[c++],C.y=D[c++],C.z=D[c],T.vertexNormals.push(C);E&&(l=M[u++],N=new THREE.Color(P[l]),T.color=N);if(S)for(r=0;r<f;r++)l=M[u++],N=new THREE.Color(P[l]),T.vertexColors.push(N);i.faces.push(T)}}function u(){var t,n,r,s,o,u,a,f,l,c;if(e.skinWeights)for(t=0,n=e.skinWeights.length;t<n;t+=2)r=e.skinWeights[t],s=e.skinWeights[t+1],o=0,u=0,i.skinWeights.
  push(new THREE.Vector4(r,s,o,u));if(e.skinIndices)for(t=0,n=e.skinIndices.length;t<n;t+=2)a=e.skinIndices[t],f=e.skinIndices[t+1],l=0,c=0,i.skinIndices.push(new THREE.Vector4(a,f,l,c));i.bones=e.bones,i.animation=e.animation}function a(t){if(e.morphTargets!==undefined){var n,r,s,o,u,a;for(n=0,r=e.morphTargets.length;n<r;n++){i.morphTargets[n]={},i.morphTargets[n].name=e.morphTargets[n].name,i.morphTargets[n].vertices=[],u=i.morphTargets[n].vertices,a=e.morphTargets[n].vertices;for(s=0,o=a.length;s<o;s+=3){var f=new THREE.Vector3;f.x=a[s]*t,f.y=a[s+1]*t,f.z=a[s+2]*t,u.push(f)}}}if(e.morphColors!==undefined){var n,r,l,c,h,p,d;for(n=0,r=e.morphColors.length;n<r;n++){i.morphColors[n]={},i.morphColors[n].name=e.morphColors[n].name,i.morphColors[n].colors=[],h=i.morphColors[n].colors,p=e.morphColors[n].colors;for(l=0,c=p.length;l<c;l+=3)d=new THREE.Color(16755200),d.setRGB(p[l],p[l+1],p[l+2]),h.push(d)}}}var r=this,i=new THREE.Geometry,s=e.scale!==undefined?1/e.scale:1;o(s),u(),a(s),i.computeCentroids(),i.computeFaceNormals
  ();var f=this.initMaterials(e.materials,n);this.needsTangents(f)&&i.computeTangents(),t(i,f)},THREE.LoadingMonitor=function(){THREE.EventTarget.call(this);var e=this,t=0,n=0,r=function(r){t++,e.dispatchEvent({type:"progress",loaded:t,total:n}),t===n&&e.dispatchEvent({type:"load"})};this.add=function(e){n++,e.addEventListener("load",r,!1)}},THREE.SceneLoader=function(){this.onLoadStart=function(){},this.onLoadProgress=function(){},this.onLoadComplete=function(){},this.callbackSync=function(){},this.callbackProgress=function(){},this.geometryHandlerMap={},this.hierarchyHandlerMap={},this.addGeometryHandler("ascii",THREE.JSONLoader),this.addGeometryHandler("binary",THREE.BinaryLoader)},THREE.SceneLoader.prototype.constructor=THREE.SceneLoader,THREE.SceneLoader.prototype.load=function(e,t){var n=this,r=new XMLHttpRequest;r.onreadystatechange=function(){if(r.readyState===4)if(r.status===200||r.status===0){var i=JSON.parse(r.responseText);n.parse(i,t,e)}else console.error("THREE.SceneLoader: Couldn't load ["+e+"] ["+
  r.status+"]")},r.open("GET",e,!0),r.send(null)},THREE.SceneLoader.prototype.addGeometryHandler=function(e,t){this.geometryHandlerMap[e]={loaderClass:t}},THREE.SceneLoader.prototype.addHierarchyHandler=function(e,t){this.hierarchyHandlerMap[e]={loaderClass:t}},THREE.SceneLoader.prototype.parse=function(e,t,n){function X(e,t){return t=="relativeToHTML"?e:i+"/"+e}function V(){$(j.scene,I.objects)}function $(e,t){for(var n in t)if(j.objects[n]===undefined){var i=t[n],s=null;if(i.type&&i.type in r.hierarchyHandlerMap&&i.loading===undefined){var o={};for(var u in l)u!=="type"&&u!=="url"&&(o[u]=l[u]);N=j.materials[i.material],i.loading=!0;var a=r.hierarchyHandlerMap[i.type].loaderObject;a.addEventListener?(a.addEventListener("load",G(n,e,N,i)),a.load(X(i.url,I.urlBaseType))):a.options?a.load(X(i.url,I.urlBaseType),G(n,e,N,i)):a.load(X(i.url,I.urlBaseType),G(n,e,N,i),o)}else if(i.geometry!==undefined){T=j.geometries[i.geometry];if(T){var f=!1;N=j.materials[i.material],f=N instanceof THREE.ShaderMaterial,d=i.position,v=
  i.rotation,m=i.quaternion,g=i.scale,c=i.matrix,m=0,i.material||(N=new THREE.MeshFaceMaterial(j.face_materials[i.geometry])),N instanceof THREE.MeshFaceMaterial&&N.materials.length===0&&(N=new THREE.MeshFaceMaterial(j.face_materials[i.geometry]));if(N instanceof THREE.MeshFaceMaterial)for(var h=0;h<N.materials.length;h++)f=f||N.materials[h]instanceof THREE.ShaderMaterial;f&&T.computeTangents(),i.skin?s=new THREE.SkinnedMesh(T,N):i.morph?(s=new THREE.MorphAnimMesh(T,N),i.duration!==undefined&&(s.duration=i.duration),i.time!==undefined&&(s.time=i.time),i.mirroredLoop!==undefined&&(s.mirroredLoop=i.mirroredLoop),N.morphNormals&&T.computeMorphNormals()):s=new THREE.Mesh(T,N),s.name=n,c?(s.matrixAutoUpdate=!1,s.matrix.set(c[0],c[1],c[2],c[3],c[4],c[5],c[6],c[7],c[8],c[9],c[10],c[11],c[12],c[13],c[14],c[15])):(s.position.set(d[0],d[1],d[2]),m?(s.quaternion.set(m[0],m[1],m[2],m[3]),s.useQuaternion=!0):s.rotation.set(v[0],v[1],v[2]),s.scale.set(g[0],g[1],g[2])),s.visible=i.visible,s.castShadow=i.castShadow,s.receiveShadow=
  i.receiveShadow,e.add(s),j.objects[n]=s}}else i.type==="DirectionalLight"||i.type==="PointLight"||i.type==="AmbientLight"?(M=i.color!==undefined?i.color:16777215,_=i.intensity!==undefined?i.intensity:1,i.type==="DirectionalLight"?(d=i.direction,O=new THREE.DirectionalLight(M,_),O.position.set(d[0],d[1],d[2]),i.target&&(F.push({object:O,targetName:i.target}),O.target=null)):i.type==="PointLight"?(d=i.position,p=i.distance,O=new THREE.PointLight(M,_,p),O.position.set(d[0],d[1],d[2])):i.type==="AmbientLight"&&(O=new THREE.AmbientLight(M)),e.add(O),O.name=n,j.lights[n]=O,j.objects[n]=O):i.type==="PerspectiveCamera"||i.type==="OrthographicCamera"?(i.type==="PerspectiveCamera"?C=new THREE.PerspectiveCamera(i.fov,i.aspect,i.near,i.far):i.type==="OrthographicCamera"&&(C=new THREE.OrthographicCamera(y.left,y.right,y.top,y.bottom,y.near,y.far)),d=i.position,C.position.set(d[0],d[1],d[2]),e.add(C),C.name=n,j.cameras[n]=C,j.objects[n]=C):(d=i.position,v=i.rotation,m=i.quaternion,g=i.scale,m=0,s=new THREE.Object3D,s.name=n
  ,s.position.set(d[0],d[1],d[2]),m?(s.quaternion.set(m[0],m[1],m[2],m[3]),s.useQuaternion=!0):s.rotation.set(v[0],v[1],v[2]),s.scale.set(g[0],g[1],g[2]),s.visible=i.visible!==undefined?i.visible:!1,e.add(s),j.objects[n]=s,j.empties[n]=s);if(s){if(i.properties!==undefined)for(var b in i.properties){var w=i.properties[b];s.properties[b]=w}i.children!==undefined&&$(s,i.children)}}}function J(e,t,n){j.geometries[n]=e,j.face_materials[n]=t,V()}function K(e,t,n,r,i){var s=i.position,o=i.rotation,u=i.quaternion,a=i.scale;e.position.set(s[0],s[1],s[2]),u?(e.quaternion.set(u[0],u[1],u[2],u[3]),e.useQuaternion=!0):e.rotation.set(o[0],o[1],o[2]),e.scale.set(a[0],a[1],a[2]),r&&e.traverse(function(e){e.material=r}),n.add(e),j.objects[t]=e,V()}function Q(e){return function(t,n){J(t,n,e),D-=1,r.onLoadComplete(),Z()}}function G(e,t,n,i){return function(s){var o;s.content?o=s.content:s.dae?o=s.scene:o=s,K(o,e,t,n,i),D-=1,r.onLoadComplete(),Z()}}function Y(e){return function(t,n){j.geometries[e]=t,j.face_materials[e]=n}}function Z
  (){var e={totalModels:H,totalTextures:B,loadedModels:H-D,loadedTextures:B-P};r.callbackProgress(e,j),r.onLoadProgress(),D===0&&P===0&&(et(),t(j))}function et(){for(var e=0;e<F.length;e++){var t=F[e],n=j.objects[t.targetName];n?t.object.target=n:(t.object.target=new THREE.Object3D,j.scene.add(t.object.target)),t.object.target.properties.targetInverse=t.object}}var r=this,i=THREE.Loader.prototype.extractUrlBase(n),s,o,u,a,f,l,c,h,p,d,v,m,g,y,b,w,E,S,x,T,N,C,k,L,A,O,M,_,D,P,H,B,j,F=[],I=e;for(var q in this.geometryHandlerMap){var R=this.geometryHandlerMap[q].loaderClass;this.geometryHandlerMap[q].loaderObject=new R}for(var q in this.hierarchyHandlerMap){var R=this.hierarchyHandlerMap[q].loaderClass;this.hierarchyHandlerMap[q].loaderObject=new R}D=0,P=0,j={scene:new THREE.Scene,geometries:{},face_materials:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},empties:{}};if(I.transform){var U=I.transform.position,z=I.transform.rotation,W=I.transform.scale;U&&j.scene.position.set(U[0],U[1],U[2]),z&&j.
  scene.rotation.set(z[0],z[1],z[2]),W&&j.scene.scale.set(W[0],W[1],W[2]);if(U||z||W)j.scene.updateMatrix(),j.scene.updateMatrixWorld()}var tt=function(e){P-=e,Z(),r.onLoadComplete()},nt=function(e){return function(){tt(e)}};for(a in I.fogs)w=I.fogs[a],w.type==="linear"?k=new THREE.Fog(0,w.near,w.far):w.type==="exp2"&&(k=new THREE.FogExp2(0,w.density)),y=w.color,k.color.setRGB(y[0],y[1],y[2]),j.fogs[a]=k;for(s in I.geometries)l=I.geometries[s],l.type in this.geometryHandlerMap&&(D+=1,r.onLoadStart());for(var rt in I.objects){var it=I.objects[rt];it.type&&it.type in this.hierarchyHandlerMap&&(D+=1,r.onLoadStart())}H=D;for(s in I.geometries){l=I.geometries[s];if(l.type==="cube")T=new THREE.CubeGeometry(l.width,l.height,l.depth,l.widthSegments,l.heightSegments,l.depthSegments),j.geometries[s]=T;else if(l.type==="plane")T=new THREE.PlaneGeometry(l.width,l.height,l.widthSegments,l.heightSegments),j.geometries[s]=T;else if(l.type==="sphere")T=new THREE.SphereGeometry(l.radius,l.widthSegments,l.heightSegments),j.geometries
  [s]=T;else if(l.type==="cylinder")T=new THREE.CylinderGeometry(l.topRad,l.botRad,l.height,l.radSegs,l.heightSegs),j.geometries[s]=T;else if(l.type==="torus")T=new THREE.TorusGeometry(l.radius,l.tube,l.segmentsR,l.segmentsT),j.geometries[s]=T;else if(l.type==="icosahedron")T=new THREE.IcosahedronGeometry(l.radius,l.subdivisions),j.geometries[s]=T;else if(l.type in this.geometryHandlerMap){var st={};for(var ot in l)ot!=="type"&&ot!=="url"&&(st[ot]=l[ot]);var ut=this.geometryHandlerMap[l.type].loaderObject;ut.load(X(l.url,I.urlBaseType),Q(s),st)}else if(l.type==="embedded"){var at=I.embeds[l.id],ft="";at.metadata=I.metadata;if(at){var lt=this.geometryHandlerMap.ascii.loaderObject;lt.createModel(at,Y(s),ft)}}}for(f in I.textures){E=I.textures[f];if(E.url instanceof Array){P+=E.url.length;for(var ct=0;ct<E.url.length;ct++)r.onLoadStart()}else P+=1,r.onLoadStart()}B=P;for(f in I.textures){E=I.textures[f],E.mapping!==undefined&&THREE[E.mapping]!==undefined&&(E.mapping=new THREE[E.mapping]);if(E.url instanceof Array){
  var ht=E.url.length,pt=[];for(var dt=0;dt<ht;dt++)pt[dt]=X(E.url[dt],I.urlBaseType);var vt=pt[0].endsWith(".dds");vt?L=THREE.ImageUtils.loadCompressedTextureCube(pt,E.mapping,nt(ht)):L=THREE.ImageUtils.loadTextureCube(pt,E.mapping,nt(ht))}else{var vt=E.url.toLowerCase().endsWith(".dds"),mt=X(E.url,I.urlBaseType),gt=nt(1);vt?L=THREE.ImageUtils.loadCompressedTexture(mt,E.mapping,gt):L=THREE.ImageUtils.loadTexture(mt,E.mapping,gt),THREE[E.minFilter]!==undefined&&(L.minFilter=THREE[E.minFilter]),THREE[E.magFilter]!==undefined&&(L.magFilter=THREE[E.magFilter]),E.anisotropy&&(L.anisotropy=E.anisotropy),E.repeat&&(L.repeat.set(E.repeat[0],E.repeat[1]),E.repeat[0]!==1&&(L.wrapS=THREE.RepeatWrapping),E.repeat[1]!==1&&(L.wrapT=THREE.RepeatWrapping)),E.offset&&L.offset.set(E.offset[0],E.offset[1]);if(E.wrap){var yt={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};yt[E.wrap[0]]!==undefined&&(L.wrapS=yt[E.wrap[0]]),yt[E.wrap[1]]!==undefined&&(L.wrapT=yt[E.wrap[1]])}}j.textures[f]=L}for(o in I.materials){c=
  I.materials[o];for(S in c.parameters)if(S==="envMap"||S==="map"||S==="lightMap"||S==="bumpMap")c.parameters[S]=j.textures[c.parameters[S]];else if(S==="shading")c.parameters[S]=c.parameters[S]==="flat"?THREE.FlatShading:THREE.SmoothShading;else if(S==="side")c.parameters[S]=="double"?c.parameters[S]=THREE.DoubleSide:c.parameters[S]=="back"?c.parameters[S]=THREE.BackSide:c.parameters[S]=THREE.FrontSide;else if(S==="blending")c.parameters[S]=c.parameters[S]in THREE?THREE[c.parameters[S]]:THREE.NormalBlending;else if(S==="combine")c.parameters[S]=c.parameters[S]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(S==="vertexColors")c.parameters[S]=="face"?c.parameters[S]=THREE.FaceColors:c.parameters[S]&&(c.parameters[S]=THREE.VertexColors);else if(S==="wrapRGB"){var bt=c.parameters[S];c.parameters[S]=new THREE.Vector3(bt[0],bt[1],bt[2])}c.parameters.opacity!==undefined&&c.parameters.opacity<1&&(c.parameters.transparent=!0);if(c.parameters.normalMap){var wt=THREE.ShaderUtils.lib.normal,Et=THREE.UniformsUtils
  .clone(wt.uniforms),St=c.parameters.color,xt=c.parameters.specular,Tt=c.parameters.ambient,Nt=c.parameters.shininess;Et.tNormal.value=j.textures[c.parameters.normalMap],c.parameters.normalScale&&Et.uNormalScale.value.set(c.parameters.normalScale[0],c.parameters.normalScale[1]),c.parameters.map&&(Et.tDiffuse.value=c.parameters.map,Et.enableDiffuse.value=!0),c.parameters.envMap&&(Et.tCube.value=c.parameters.envMap,Et.enableReflection.value=!0,Et.uReflectivity.value=c.parameters.reflectivity),c.parameters.lightMap&&(Et.tAO.value=c.parameters.lightMap,Et.enableAO.value=!0),c.parameters.specularMap&&(Et.tSpecular.value=j.textures[c.parameters.specularMap],Et.enableSpecular.value=!0),c.parameters.displacementMap&&(Et.tDisplacement.value=j.textures[c.parameters.displacementMap],Et.enableDisplacement.value=!0,Et.uDisplacementBias.value=c.parameters.displacementBias,Et.uDisplacementScale.value=c.parameters.displacementScale),Et.uDiffuseColor.value.setHex(St),Et.uSpecularColor.value.setHex(xt),Et.uAmbientColor.value.setHex
  (Tt),Et.uShininess.value=Nt,c.parameters.opacity&&(Et.uOpacity.value=c.parameters.opacity);var Ct={fragmentShader:wt.fragmentShader,vertexShader:wt.vertexShader,uniforms:Et,lights:!0,fog:!0};N=new THREE.ShaderMaterial(Ct)}else N=new THREE[c.type](c.parameters);j.materials[o]=N}for(o in I.materials){c=I.materials[o];if(c.parameters.materials){var kt=[];for(var dt=0;dt<c.parameters.materials.length;dt++){var Lt=c.parameters.materials[dt];kt.push(j.materials[Lt])}j.materials[o].materials=kt}}V(),j.cameras&&I.defaults.camera&&(j.currentCamera=j.cameras[I.defaults.camera]),j.fogs&&I.defaults.fog&&(j.scene.fog=j.fogs[I.defaults.fog]),y=I.defaults.bgcolor,j.bgColor=new THREE.Color,j.bgColor.setRGB(y[0],y[1],y[2]),j.bgColorAlpha=I.defaults.bgalpha,r.callbackSync(j),Z()},THREE.TextureLoader=function(){THREE.EventTarget.call(this),this.crossOrigin=null},THREE.TextureLoader.prototype={constructor:THREE.TextureLoader,load:function(e){var t=this,n=new Image;n.addEventListener("load",function(){var e=new THREE.Texture(n);e.
  needsUpdate=!0,t.dispatchEvent({type:"load",content:e})},!1),n.addEventListener("error",function(){t.dispatchEvent({type:"error",message:"Couldn't load URL ["+e+"]"})},!1),t.crossOrigin&&(n.crossOrigin=t.crossOrigin),n.src=e}},THREE.Material=function(){THREE.MaterialLibrary.push(this),this.id=THREE.MaterialIdCount++,this.name="",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.depthTest=!0,this.depthWrite=!0,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.alphaTest=0,this.overdraw=!1,this.visible=!0,this.needsUpdate=!0},THREE.Material.prototype.setValues=function(e){if(e===undefined)return;for(var t in e){var n=e[t];if(n===undefined){console.warn("THREE.Material: '"+t+"' parameter is undefined.");continue}if(t in this){var r=this[t];r instanceof THREE.Color&&n instanceof THREE.Color?r.copy(n):r instanceof THREE.Color?
  r.set(n):r instanceof THREE.Vector3&&n instanceof THREE.Vector3?r.copy(n):this[t]=n}}},THREE.Material.prototype.clone=function(e){return e===undefined&&(e=new THREE.Material),e.name=this.name,e.side=this.side,e.opacity=this.opacity,e.transparent=this.transparent,e.blending=this.blending,e.blendSrc=this.blendSrc,e.blendDst=this.blendDst,e.blendEquation=this.blendEquation,e.depthTest=this.depthTest,e.depthWrite=this.depthWrite,e.polygonOffset=this.polygonOffset,e.polygonOffsetFactor=this.polygonOffsetFactor,e.polygonOffsetUnits=this.polygonOffsetUnits,e.alphaTest=this.alphaTest,e.overdraw=this.overdraw,e.visible=this.visible,e},THREE.Material.prototype.deallocate=function(){var e=THREE.MaterialLibrary.indexOf(this);e!==-1&&THREE.MaterialLibrary.splice(e,1)},THREE.MaterialIdCount=0,THREE.MaterialLibrary=[],THREE.LineBasicMaterial=function(e){THREE.Material.call(this),this.color=new THREE.Color(16777215),this.linewidth=1,this.linecap="round",this.linejoin="round",this.vertexColors=!1,this.fog=!0,this.setValues(e)}
  ,THREE.LineBasicMaterial.prototype=Object.create(THREE.Material.prototype),THREE.LineBasicMaterial.prototype.clone=function(){var e=new THREE.LineBasicMaterial;return THREE.Material.prototype.clone.call(this,e),e.color.copy(this.color),e.linewidth=this.linewidth,e.linecap=this.linecap,e.linejoin=this.linejoin,e.vertexColors=this.vertexColors,e.fog=this.fog,e},THREE.LineDashedMaterial=function(e){THREE.Material.call(this),this.color=new THREE.Color(16777215),this.linewidth=1,this.scale=1,this.dashSize=3,this.gapSize=1,this.vertexColors=!1,this.fog=!0,this.setValues(e)},THREE.LineDashedMaterial.prototype=Object.create(THREE.Material.prototype),THREE.LineDashedMaterial.prototype.clone=function(){var e=new THREE.LineDashedMaterial;return THREE.Material.prototype.clone.call(this,e),e.color.copy(this.color),e.linewidth=this.linewidth,e.scale=this.scale,e.dashSize=this.dashSize,e.gapSize=this.gapSize,e.vertexColors=this.vertexColors,e.fog=this.fog,e},THREE.MeshBasicMaterial=function(e){THREE.Material.call(this),this.
  color=new THREE.Color(16777215),this.map=null,this.lightMap=null,this.specularMap=null,this.envMap=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.wireframeLinecap="round",this.wireframeLinejoin="round",this.vertexColors=THREE.NoColors,this.skinning=!1,this.morphTargets=!1,this.setValues(e)},THREE.MeshBasicMaterial.prototype=Object.create(THREE.Material.prototype),THREE.MeshBasicMaterial.prototype.clone=function(){var e=new THREE.MeshBasicMaterial;return THREE.Material.prototype.clone.call(this,e),e.color.copy(this.color),e.map=this.map,e.lightMap=this.lightMap,e.specularMap=this.specularMap,e.envMap=this.envMap,e.combine=this.combine,e.reflectivity=this.reflectivity,e.refractionRatio=this.refractionRatio,e.fog=this.fog,e.shading=this.shading,e.wireframe=this.wireframe,e.wireframeLinewidth=this.wireframeLinewidth,e.wireframeLinecap=this.wireframeLinecap,e.wireframeLinejoin=this.wireframeLinejoin
  ,e.vertexColors=this.vertexColors,e.skinning=this.skinning,e.morphTargets=this.morphTargets,e},THREE.MeshLambertMaterial=function(e){THREE.Material.call(this),this.color=new THREE.Color(16777215),this.ambient=new THREE.Color(16777215),this.emissive=new THREE.Color(0),this.wrapAround=!1,this.wrapRGB=new THREE.Vector3(1,1,1),this.map=null,this.lightMap=null,this.specularMap=null,this.envMap=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.wireframeLinecap="round",this.wireframeLinejoin="round",this.vertexColors=THREE.NoColors,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(e)},THREE.MeshLambertMaterial.prototype=Object.create(THREE.Material.prototype),THREE.MeshLambertMaterial.prototype.clone=function(){var e=new THREE.MeshLambertMaterial;return THREE.Material.prototype.clone.call(this,e),e.color.copy(this.color),e.ambient.copy(this.ambient),e.emissive.copy
  (this.emissive),e.wrapAround=this.wrapAround,e.wrapRGB.copy(this.wrapRGB),e.map=this.map,e.lightMap=this.lightMap,e.specularMap=this.specularMap,e.envMap=this.envMap,e.combine=this.combine,e.reflectivity=this.reflectivity,e.refractionRatio=this.refractionRatio,e.fog=this.fog,e.shading=this.shading,e.wireframe=this.wireframe,e.wireframeLinewidth=this.wireframeLinewidth,e.wireframeLinecap=this.wireframeLinecap,e.wireframeLinejoin=this.wireframeLinejoin,e.vertexColors=this.vertexColors,e.skinning=this.skinning,e.morphTargets=this.morphTargets,e.morphNormals=this.morphNormals,e},THREE.MeshPhongMaterial=function(e){THREE.Material.call(this),this.color=new THREE.Color(16777215),this.ambient=new THREE.Color(16777215),this.emissive=new THREE.Color(0),this.specular=new THREE.Color(1118481),this.shininess=30,this.metal=!1,this.perPixel=!0,this.wrapAround=!1,this.wrapRGB=new THREE.Vector3(1,1,1),this.map=null,this.lightMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalScale=new THREE.Vector2(1,1)
  ,this.specularMap=null,this.envMap=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.wireframeLinecap="round",this.wireframeLinejoin="round",this.vertexColors=THREE.NoColors,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(e)},THREE.MeshPhongMaterial.prototype=Object.create(THREE.Material.prototype),THREE.MeshPhongMaterial.prototype.clone=function(){var e=new THREE.MeshPhongMaterial;return THREE.Material.prototype.clone.call(this,e),e.color.copy(this.color),e.ambient.copy(this.ambient),e.emissive.copy(this.emissive),e.specular.copy(this.specular),e.shininess=this.shininess,e.metal=this.metal,e.perPixel=this.perPixel,e.wrapAround=this.wrapAround,e.wrapRGB.copy(this.wrapRGB),e.map=this.map,e.lightMap=this.lightMap,e.bumpMap=this.bumpMap,e.bumpScale=this.bumpScale,e.normalMap=this.normalMap,e.normalScale.copy(this.normalScale),e.specularMap=this.specularMap,e.
  envMap=this.envMap,e.combine=this.combine,e.reflectivity=this.reflectivity,e.refractionRatio=this.refractionRatio,e.fog=this.fog,e.shading=this.shading,e.wireframe=this.wireframe,e.wireframeLinewidth=this.wireframeLinewidth,e.wireframeLinecap=this.wireframeLinecap,e.wireframeLinejoin=this.wireframeLinejoin,e.vertexColors=this.vertexColors,e.skinning=this.skinning,e.morphTargets=this.morphTargets,e.morphNormals=this.morphNormals,e},THREE.MeshDepthMaterial=function(e){THREE.Material.call(this),this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(e)},THREE.MeshDepthMaterial.prototype=Object.create(THREE.Material.prototype),THREE.MeshDepthMaterial.prototype.clone=function(){var e=new THREE.LineBasicMaterial;return THREE.Material.prototype.clone.call(this,e),e.wireframe=this.wireframe,e.wireframeLinewidth=this.wireframeLinewidth,e},THREE.MeshNormalMaterial=function(e){THREE.Material.call(this,e),this.shading=THREE.FlatShading,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(e)},THREE.MeshNormalMaterial
  .prototype=Object.create(THREE.Material.prototype),THREE.MeshNormalMaterial.prototype.clone=function(){var e=new THREE.MeshNormalMaterial;return THREE.Material.prototype.clone.call(this,e),e.shading=this.shading,e.wireframe=this.wireframe,e.wireframeLinewidth=this.wireframeLinewidth,e},THREE.MeshFaceMaterial=function(e){this.materials=e instanceof Array?e:[]},THREE.MeshFaceMaterial.prototype.clone=function(){return new THREE.MeshFaceMaterial(this.materials.slice(0))},THREE.ParticleBasicMaterial=function(e){THREE.Material.call(this),this.color=new THREE.Color(16777215),this.map=null,this.size=1,this.sizeAttenuation=!0,this.vertexColors=!1,this.fog=!0,this.setValues(e)},THREE.ParticleBasicMaterial.prototype=Object.create(THREE.Material.prototype),THREE.ParticleBasicMaterial.prototype.clone=function(){var e=new THREE.ParticleBasicMaterial;return THREE.Material.prototype.clone.call(this,e),e.color.copy(this.color),e.map=this.map,e.size=this.size,e.sizeAttenuation=this.sizeAttenuation,e.vertexColors=this.vertexColors
  ,e.fog=this.fog,e},THREE.ParticleCanvasMaterial=function(e){THREE.Material.call(this),this.color=new THREE.Color(16777215),this.program=function(e,t){},this.setValues(e)},THREE.ParticleCanvasMaterial.prototype=Object.create(THREE.Material.prototype),THREE.ParticleCanvasMaterial.prototype.clone=function(){var e=new THREE.ParticleCanvasMaterial;return THREE.Material.prototype.clone.call(this,e),e.color.copy(this.color),e.program=this.program,e},THREE.ParticleDOMMaterial=function(e){this.element=e},THREE.ParticleDOMMaterial.prototype.clone=function(){return new THREE.ParticleDOMMaterial(this.element)},THREE.ShaderMaterial=function(e){THREE.Material.call(this),this.fragmentShader="void main() {}",this.vertexShader="void main() {}",this.uniforms={},this.defines={},this.attributes=null,this.shading=THREE.SmoothShading,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.vertexColors=THREE.NoColors,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(e)},THREE.ShaderMaterial
  .prototype=Object.create(THREE.Material.prototype),THREE.ShaderMaterial.prototype.clone=function(){var e=new THREE.ShaderMaterial;return THREE.Material.prototype.clone.call(this,e),e.fragmentShader=this.fragmentShader,e.vertexShader=this.vertexShader,e.uniforms=THREE.UniformsUtils.clone(this.uniforms),e.attributes=this.attributes,e.defines=this.defines,e.shading=this.shading,e.wireframe=this.wireframe,e.wireframeLinewidth=this.wireframeLinewidth,e.fog=this.fog,e.lights=this.lights,e.vertexColors=this.vertexColors,e.skinning=this.skinning,e.morphTargets=this.morphTargets,e.morphNormals=this.morphNormals,e},THREE.SpriteMaterial=function(e){THREE.Material.call(this),this.color=new THREE.Color(16777215),this.map=new THREE.Texture,this.useScreenCoordinates=!0,this.depthTest=!this.useScreenCoordinates,this.sizeAttenuation=!this.useScreenCoordinates,this.scaleByViewport=!this.sizeAttenuation,this.alignment=THREE.SpriteAlignment.center.clone(),this.fog=!1,this.uvOffset=new THREE.Vector2(0,0),this.uvScale=new THREE.Vector2
  (1,1),this.setValues(e),e=e||{},e.depthTest===undefined&&(this.depthTest=!this.useScreenCoordinates),e.sizeAttenuation===undefined&&(this.sizeAttenuation=!this.useScreenCoordinates),e.scaleByViewport===undefined&&(this.scaleByViewport=!this.sizeAttenuation)},THREE.SpriteMaterial.prototype=Object.create(THREE.Material.prototype),THREE.SpriteMaterial.prototype.clone=function(){var e=new THREE.SpriteMaterial;return THREE.Material.prototype.clone.call(this,e),e.color.copy(this.color),e.map=this.map,e.useScreenCoordinates=this.useScreenCoordinates,e.sizeAttenuation=this.sizeAttenuation,e.scaleByViewport=this.scaleByViewport,e.alignment.copy(this.alignment),e.uvOffset.copy(this.uvOffset),e.uvScale.copy(this.uvScale),e.fog=this.fog,e},THREE.SpriteAlignment={},THREE.SpriteAlignment.topLeft=new THREE.Vector2(1,-1),THREE.SpriteAlignment.topCenter=new THREE.Vector2(0,-1),THREE.SpriteAlignment.topRight=new THREE.Vector2(-1,-1),THREE.SpriteAlignment.centerLeft=new THREE.Vector2(1,0),THREE.SpriteAlignment.center=new THREE.Vector2
  (0,0),THREE.SpriteAlignment.centerRight=new THREE.Vector2(-1,0),THREE.SpriteAlignment.bottomLeft=new THREE.Vector2(1,1),THREE.SpriteAlignment.bottomCenter=new THREE.Vector2(0,1),THREE.SpriteAlignment.bottomRight=new THREE.Vector2(-1,1),THREE.Texture=function(e,t,n,r,i,s,o,u,a){THREE.TextureLibrary.push(this),this.id=THREE.TextureIdCount++,this.name="",this.image=e,this.mipmaps=[],this.mapping=t!==undefined?t:new THREE.UVMapping,this.wrapS=n!==undefined?n:THREE.ClampToEdgeWrapping,this.wrapT=r!==undefined?r:THREE.ClampToEdgeWrapping,this.magFilter=i!==undefined?i:THREE.LinearFilter,this.minFilter=s!==undefined?s:THREE.LinearMipMapLinearFilter,this.anisotropy=a!==undefined?a:1,this.format=o!==undefined?o:THREE.RGBAFormat,this.type=u!==undefined?u: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.prototype={constructor:THREE.Texture,
  clone:function(e){return e===undefined&&(e=new THREE.Texture),e.image=this.image,e.mipmaps=this.mipmaps.slice(0),e.mapping=this.mapping,e.wrapS=this.wrapS,e.wrapT=this.wrapT,e.magFilter=this.magFilter,e.minFilter=this.minFilter,e.anisotropy=this.anisotropy,e.format=this.format,e.type=this.type,e.offset.copy(this.offset),e.repeat.copy(this.repeat),e.generateMipmaps=this.generateMipmaps,e.premultiplyAlpha=this.premultiplyAlpha,e.flipY=this.flipY,e.unpackAlignment=this.unpackAlignment,e},deallocate:function(){var e=THREE.TextureLibrary.indexOf(this);e!==-1&&THREE.TextureLibrary.splice(e,1)}},THREE.TextureIdCount=0,THREE.TextureLibrary=[],THREE.CompressedTexture=function(e,t,n,r,i,s,o,u,a,f,l){THREE.Texture.call(this,null,s,o,u,a,f,r,i,l),this.image={width:t,height:n},this.mipmaps=e,this.generateMipmaps=!1},THREE.CompressedTexture.prototype=Object.create(THREE.Texture.prototype),THREE.CompressedTexture.prototype.clone=function(){var e=new THREE.CompressedTexture;return THREE.Texture.prototype.clone.call(this,e),e}
  ,THREE.DataTexture=function(e,t,n,r,i,s,o,u,a,f,l){THREE.Texture.call(this,null,s,o,u,a,f,r,i,l),this.image={data:e,width:t,height:n}},THREE.DataTexture.prototype=Object.create(THREE.Texture.prototype),THREE.DataTexture.prototype.clone=function(){var e=new THREE.DataTexture;return THREE.Texture.prototype.clone.call(this,e),e},THREE.Particle=function(e){THREE.Object3D.call(this),this.material=e},THREE.Particle.prototype=Object.create(THREE.Object3D.prototype),THREE.Particle.prototype.clone=function(e){return e===undefined&&(e=new THREE.Particle(this.material)),THREE.Object3D.prototype.clone.call(this,e),e},THREE.ParticleSystem=function(e,t){THREE.Object3D.call(this),this.geometry=e,this.material=t!==undefined?t:new THREE.ParticleBasicMaterial({color:Math.random()*16777215}),this.sortParticles=!1,this.geometry&&(this.geometry.boundingSphere===null&&this.geometry.computeBoundingSphere(),this.boundRadius=e.boundingSphere.radius),this.frustumCulled=!1},THREE.ParticleSystem.prototype=Object.create(THREE.Object3D.prototype
  ),THREE.ParticleSystem.prototype.clone=function(e){return e===undefined&&(e=new THREE.ParticleSystem(this.geometry,this.material)),e.sortParticles=this.sortParticles,THREE.Object3D.prototype.clone.call(this,e),e},THREE.Line=function(e,t,n){THREE.Object3D.call(this),this.geometry=e,this.material=t!==undefined?t:new THREE.LineBasicMaterial({color:Math.random()*16777215}),this.type=n!==undefined?n:THREE.LineStrip,this.geometry&&(this.geometry.boundingSphere||this.geometry.computeBoundingSphere())},THREE.LineStrip=0,THREE.LinePieces=1,THREE.Line.prototype=Object.create(THREE.Object3D.prototype),THREE.Line.prototype.clone=function(e){return e===undefined&&(e=new THREE.Line(this.geometry,this.material,this.type)),THREE.Object3D.prototype.clone.call(this,e),e},THREE.Mesh=function(e,t){THREE.Object3D.call(this),this.geometry=e,this.material=t!==undefined?t:new THREE.MeshBasicMaterial({color:Math.random()*16777215,wireframe:!0});if(this.geometry){this.geometry.boundingSphere===null&&this.geometry.computeBoundingSphere(
  ),this.boundRadius=e.boundingSphere.radius;if(this.geometry.morphTargets.length){this.morphTargetBase=-1,this.morphTargetForcedOrder=[],this.morphTargetInfluences=[],this.morphTargetDictionary={};for(var n=0;n<this.geometry.morphTargets.length;n++)this.morphTargetInfluences.push(0),this.morphTargetDictionary[this.geometry.morphTargets[n].name]=n}}},THREE.Mesh.prototype=Object.create(THREE.Object3D.prototype),THREE.Mesh.prototype.getMorphTargetIndexByName=function(e){return this.morphTargetDictionary[e]!==undefined?this.morphTargetDictionary[e]:(console.log("THREE.Mesh.getMorphTargetIndexByName: morph target "+e+" does not exist. Returning 0."),0)},THREE.Mesh.prototype.clone=function(e){return e===undefined&&(e=new THREE.Mesh(this.geometry,this.material)),THREE.Object3D.prototype.clone.call(this,e),e},THREE.Bone=function(e){THREE.Object3D.call(this),this.skin=e,this.skinMatrix=new THREE.Matrix4},THREE.Bone.prototype=Object.create(THREE.Object3D.prototype),THREE.Bone.prototype.update=function(e,t){this.matrixAutoUpdate&&
  (t|=this.updateMatrix());if(t||this.matrixWorldNeedsUpdate)e?this.skinMatrix.multiply(e,this.matrix):this.skinMatrix.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,t=!0;var n,r,i=this.children.length;for(r=0;r<i;r++)this.children[r].update(this.skinMatrix,t)},THREE.SkinnedMesh=function(e,t,n){THREE.Mesh.call(this,e,t),this.useVertexTexture=n!==undefined?n:!0,this.identityMatrix=new THREE.Matrix4,this.bones=[],this.boneMatrices=[];var r,i,s,o,u,a;if(this.geometry&&this.geometry.bones!==undefined){for(r=0;r<this.geometry.bones.length;r++)s=this.geometry.bones[r],o=s.pos,u=s.rotq,a=s.scl,i=this.addBone(),i.name=s.name,i.position.set(o[0],o[1],o[2]),i.quaternion.set(u[0],u[1],u[2],u[3]),i.useQuaternion=!0,a!==undefined?i.scale.set(a[0],a[1],a[2]):i.scale.set(1,1,1);for(r=0;r<this.bones.length;r++)s=this.geometry.bones[r],i=this.bones[r],s.parent===-1?this.add(i):this.bones[s.parent].add(i);var f=this.bones.length;if(this.useVertexTexture){var l;f>256?l=64:f>64?l=32:f>16?l=16:l=8,this.boneTextureWidth=l,this.boneTextureHeight=
  l,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}else this.boneMatrices=new Float32Array(16*f);this.pose()}},THREE.SkinnedMesh.prototype=Object.create(THREE.Mesh.prototype),THREE.SkinnedMesh.prototype.addBone=function(e){return e===undefined&&(e=new THREE.Bone(this)),this.bones.push(e),e},THREE.SkinnedMesh.prototype.updateMatrixWorld=function(e){this.matrixAutoUpdate&&this.updateMatrix();if(this.matrixWorldNeedsUpdate||e)this.parent?this.matrixWorld.multiply(this.parent.matrixWorld,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,e=!0;for(var t=0,n=this.children.length;t<n;t++){var r=this.children[t];r instanceof THREE.Bone?r.update(this.identityMatrix,!1):r.
  updateMatrixWorld(!0)}if(this.boneInverses==undefined){this.boneInverses=[];for(var i=0,s=this.bones.length;i<s;i++){var o=new THREE.Matrix4;o.getInverse(this.bones[i].skinMatrix),this.boneInverses.push(o)}}for(var i=0,s=this.bones.length;i<s;i++)THREE.SkinnedMesh.offsetMatrix.multiply(this.bones[i].skinMatrix,this.boneInverses[i]),THREE.SkinnedMesh.offsetMatrix.flattenToArrayOffset(this.boneMatrices,i*16);this.useVertexTexture&&(this.boneTexture.needsUpdate=!0)},THREE.SkinnedMesh.prototype.pose=function(){this.updateMatrixWorld(!0);for(var e=0;e<this.geometry.skinIndices.length;e++){var t=this.geometry.skinWeights[e],n=1/t.lengthManhattan();n!==Infinity?t.multiplyScalar(n):t.set(1)}},THREE.SkinnedMesh.prototype.clone=function(e){return e===undefined&&(e=new THREE.SkinnedMesh(this.geometry,this.material,this.useVertexTexture)),THREE.Mesh.prototype.clone.call(this,e),e},THREE.SkinnedMesh.offsetMatrix=new THREE.Matrix4,THREE.MorphAnimMesh=function(e,t){THREE.Mesh.call(this,e,t),this.duration=1e3,this.mirroredLoop=!1
  ,this.time=0,this.lastKeyframe=0,this.currentKeyframe=0,this.direction=1,this.directionBackwards=!1,this.setFrameRange(0,this.geometry.morphTargets.length-1)},THREE.MorphAnimMesh.prototype=Object.create(THREE.Mesh.prototype),THREE.MorphAnimMesh.prototype.setFrameRange=function(e,t){this.startKeyframe=e,this.endKeyframe=t,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 e=this.geometry;e.animations||(e.animations={});var t,n=e.animations,r=/([a-z]+)(\d+)/;for(var i=0,s=e.morphTargets.length;i<s;i++){var o=e.morphTargets[i],u=o.name.match(r);if(u&&u.length>1){var a=u[1],f=u[2];n[a]||(n[a]={start:Infinity,end:-Infinity});var l=n[a];i<l.start&&(l.start=i),i>l.end&&(l.end=i),t||(t=a)}}e.firstAnimation=t},THREE.MorphAnimMesh.prototype.setAnimationLabel=
  function(e,t,n){this.geometry.animations||(this.geometry.animations={}),this.geometry.animations[e]={start:t,end:n}},THREE.MorphAnimMesh.prototype.playAnimation=function(e,t){var n=this.geometry.animations[e];n?(this.setFrameRange(n.start,n.end),this.duration=1e3*((n.end-n.start)/t),this.time=0):console.warn("animation["+e+"] undefined")},THREE.MorphAnimMesh.prototype.updateAnimation=function(e){var t=this.duration/this.length;this.time+=this.direction*e;if(this.mirroredLoop){if(this.time>this.duration||this.time<0)this.direction*=-1,this.time>this.duration&&(this.time=this.duration,this.directionBackwards=!0),this.time<0&&(this.time=0,this.directionBackwards=!1)}else this.time=this.time%this.duration,this.time<0&&(this.time+=this.duration);var n=this.startKeyframe+THREE.Math.clamp(Math.floor(this.time/t),0,this.length-1);n!==this.currentKeyframe&&(this.morphTargetInfluences[this.lastKeyframe]=0,this.morphTargetInfluences[this.currentKeyframe]=1,this.morphTargetInfluences[n]=0,this.lastKeyframe=this.currentKeyframe
  ,this.currentKeyframe=n);var r=this.time%t/t;this.directionBackwards&&(r=1-r),this.morphTargetInfluences[this.currentKeyframe]=r,this.morphTargetInfluences[this.lastKeyframe]=1-r},THREE.MorphAnimMesh.prototype.clone=function(e){return e===undefined&&(e=new THREE.MorphAnimMesh(this.geometry,this.material)),e.duration=this.duration,e.mirroredLoop=this.mirroredLoop,e.time=this.time,e.lastKeyframe=this.lastKeyframe,e.currentKeyframe=this.currentKeyframe,e.direction=this.direction,e.directionBackwards=this.directionBackwards,THREE.Mesh.prototype.clone.call(this,e),e},THREE.Ribbon=function(e,t){THREE.Object3D.call(this),this.geometry=e,this.material=t},THREE.Ribbon.prototype=Object.create(THREE.Object3D.prototype),THREE.Ribbon.prototype.clone=function(e){return e===undefined&&(e=new THREE.Ribbon(this.geometry,this.material)),THREE.Object3D.prototype.clone.call(this,e),e},THREE.LOD=function(){THREE.Object3D.call(this),this.LODs=[]},THREE.LOD.prototype=Object.create(THREE.Object3D.prototype),THREE.LOD.prototype.addLevel=
  function(e,t){t===undefined&&(t=0),t=Math.abs(t);for(var n=0;n<this.LODs.length;n++)if(t<this.LODs[n].visibleAtDistance)break;this.LODs.splice(n,0,{visibleAtDistance:t,object3D:e}),this.add(e)},THREE.LOD.prototype.update=function(e){if(this.LODs.length>1){e.matrixWorldInverse.getInverse(e.matrixWorld);var t=e.matrixWorldInverse,n=-(t.elements[2]*this.matrixWorld.elements[12]+t.elements[6]*this.matrixWorld.elements[13]+t.elements[10]*this.matrixWorld.elements[14]+t.elements[14]);this.LODs[0].object3D.visible=!0;for(var r=1;r<this.LODs.length;r++){if(!(n>=this.LODs[r].visibleAtDistance))break;this.LODs[r-1].object3D.visible=!1,this.LODs[r].object3D.visible=!0}for(;r<this.LODs.length;r++)this.LODs[r].object3D.visible=!1}},THREE.LOD.prototype.clone=function(){},THREE.Sprite=function(e){THREE.Object3D.call(this),this.material=e!==undefined?e:new THREE.SpriteMaterial,this.rotation3d=this.rotation,this.rotation=0},THREE.Sprite.prototype=Object.create(THREE.Object3D.prototype),THREE.Sprite.prototype.updateMatrix=function(
  ){this.matrix.setPosition(this.position),this.rotation3d.set(0,0,this.rotation),this.matrix.setRotationFromEuler(this.rotation3d);if(this.scale.x!==1||this.scale.y!==1)this.matrix.scale(this.scale),this.boundRadiusScale=Math.max(this.scale.x,this.scale.y);this.matrixWorldNeedsUpdate=!0},THREE.Sprite.prototype.clone=function(e){return e===undefined&&(e=new THREE.Sprite(this.material)),THREE.Object3D.prototype.clone.call(this,e),e},THREE.Scene=function(){THREE.Object3D.call(this),this.fog=null,this.overrideMaterial=null,this.matrixAutoUpdate=!1,this.__objects=[],this.__lights=[],this.__objectsAdded=[],this.__objectsRemoved=[]},THREE.Scene.prototype=Object.create(THREE.Object3D.prototype),THREE.Scene.prototype.__addObject=function(e){if(e instanceof THREE.Light)this.__lights.indexOf(e)===-1&&this.__lights.push(e),e.target&&e.target.parent===undefined&&this.add(e.target);else if(!(e instanceof THREE.Camera||e instanceof THREE.Bone)&&this.__objects.indexOf(e)===-1){this.__objects.push(e),this.__objectsAdded.push(e)
  ;var t=this.__objectsRemoved.indexOf(e);t!==-1&&this.__objectsRemoved.splice(t,1)}for(var n=0;n<e.children.length;n++)this.__addObject(e.children[n])},THREE.Scene.prototype.__removeObject=function(e){if(e instanceof THREE.Light){var t=this.__lights.indexOf(e);t!==-1&&this.__lights.splice(t,1)}else if(!(e instanceof THREE.Camera)){var t=this.__objects.indexOf(e);if(t!==-1){this.__objects.splice(t,1),this.__objectsRemoved.push(e);var n=this.__objectsAdded.indexOf(e);n!==-1&&this.__objectsAdded.splice(n,1)}}for(var r=0;r<e.children.length;r++)this.__removeObject(e.children[r])},THREE.Fog=function(e,t,n){this.name="",this.color=new THREE.Color(e),this.near=t!==undefined?t:1,this.far=n!==undefined?n:1e3},THREE.Fog.prototype.clone=function(){return new THREE.Fog(this.color.getHex(),this.near,this.far)},THREE.FogExp2=function(e,t){this.name="",this.color=new THREE.Color(e),this.density=t!==undefined?t:25e-5},THREE.FogExp2.prototype.clone=function(){return new THREE.FogExp2(this.color.getHex(),this.density)},THREE.CanvasRenderer=
  function(e){function wt(e){d!==e&&(c.globalAlpha=e,d=e)}function Et(e){v!==e&&(e===THREE.NormalBlending?c.globalCompositeOperation="source-over":e===THREE.AdditiveBlending?c.globalCompositeOperation="lighter":e===THREE.SubtractiveBlending&&(c.globalCompositeOperation="darker"),v=e)}function St(e){y!==e&&(c.lineWidth=e,y=e)}function xt(e){b!==e&&(c.lineCap=e,b=e)}function Tt(e){w!==e&&(c.lineJoin=e,w=e)}function Nt(e){m!==e&&(c.strokeStyle=e,m=e)}function Ct(e){g!==e&&(c.fillStyle=e,g=e)}console.log("THREE.CanvasRenderer",THREE.REVISION),e=e||{};var t=this,n,r,i,s=new THREE.Projector,o=e.canvas!==undefined?e.canvas:document.createElement("canvas"),u,a,f,l,c=o.getContext("2d"),h=new THREE.Color(0),p=0,d=1,v=0,m=null,g=null,y=null,b=null,w=null,E,S,x,T,N=new THREE.RenderableVertex,C=new THREE.RenderableVertex,k,L,A,O,M,_,D,P,H,B,j,F,I=new THREE.Color,q=new THREE.Color,R=new THREE.Color,U=new THREE.Color,z=new THREE.Color,W=new THREE.Color,X=new THREE.Color,V={},$={},J,K,Q,G,Y,Z,et,tt,nt,rt,it=new THREE.Rectangle,
  st=new THREE.Rectangle,ot=new THREE.Rectangle,ut=!1,at=new THREE.Color,ft=new THREE.Color,lt=new THREE.Color,ct=Math.PI*2,ht=new THREE.Vector3,pt,dt,vt,mt,gt,yt,bt=16;pt=document.createElement("canvas"),pt.width=pt.height=2,dt=pt.getContext("2d"),dt.fillStyle="rgba(0,0,0,1)",dt.fillRect(0,0,2,2),vt=dt.getImageData(0,0,2,2),mt=vt.data,gt=document.createElement("canvas"),gt.width=gt.height=bt,yt=gt.getContext("2d"),yt.translate(-bt/2,-bt/2),yt.scale(bt,bt),bt--,this.domElement=o,this.autoClear=!0,this.sortObjects=!0,this.sortElements=!0,this.info={render:{vertices:0,faces:0}},this.setSize=function(e,t){u=e,a=t,f=Math.floor(u/2),l=Math.floor(a/2),o.width=u,o.height=a,it.set(-f,-l,f,l),st.set(-f,-l,f,l),d=1,v=0,m=null,g=null,y=null,b=null,w=null},this.setClearColor=function(e,t){h.copy(e),p=t!==undefined?t:1,st.set(-f,-l,f,l)},this.setClearColorHex=function(e,t){h.setHex(e),p=t!==undefined?t:1,st.set(-f,-l,f,l)},this.getMaxAnisotropy=function(){return 0},this.clear=function(){c.setTransform(1,0,0,-1,f,l),st.isEmpty
  ()===!1&&(st.minSelf(it),st.inflate(2),p<1&&c.clearRect(Math.floor(st.getX()),Math.floor(st.getY()),Math.floor(st.getWidth()),Math.floor(st.getHeight())),p>0&&(Et(THREE.NormalBlending),wt(1),Ct("rgba("+Math.floor(h.r*255)+","+Math.floor(h.g*255)+","+Math.floor(h.b*255)+","+p+")"),c.fillRect(Math.floor(st.getX()),Math.floor(st.getY()),Math.floor(st.getWidth()),Math.floor(st.getHeight()))),st.empty())},this.render=function(e,o){function d(){at.setRGB(0,0,0),ft.setRGB(0,0,0),lt.setRGB(0,0,0);for(var e=0,t=i.length;e<t;e++){var n=i[e],r=n.color;n instanceof THREE.AmbientLight?(at.r+=r.r,at.g+=r.g,at.b+=r.b):n instanceof THREE.DirectionalLight?(ft.r+=r.r,ft.g+=r.g,ft.b+=r.b):n instanceof THREE.PointLight&&(lt.r+=r.r,lt.g+=r.g,lt.b+=r.b)}}function v(e,t,n){for(var r=0,s=i.length;r<s;r++){var o=i[r],u=o.color;if(o instanceof THREE.DirectionalLight){var a=o.matrixWorld.getPosition().normalize(),f=t.dot(a);if(f<=0)continue;f*=o.intensity,n.r+=u.r*f,n.g+=u.g*f,n.b+=u.b*f}else if(o instanceof THREE.PointLight){var a=o.matrixWorld
  .getPosition(),f=t.dot(ht.sub(a,e).normalize());if(f<=0)continue;f*=o.distance==0?1:1-Math.min(e.distanceTo(a)/o.distance,1);if(f==0)continue;f*=o.intensity,n.r+=u.r*f,n.g+=u.g*f,n.b+=u.b*f}}}function m(e,t,n,r){wt(n.opacity),Et(n.blending);var i,s,o,u,a,h,p;if(n instanceof THREE.ParticleBasicMaterial)if(n.map===null){o=t.object.scale.x,u=t.object.scale.y,o*=t.scale.x*f,u*=t.scale.y*l,ot.set(e.x-o,e.y-u,e.x+o,e.y+u);if(it.intersects(ot)===!1)return;Ct(n.color.getStyle()),c.save(),c.translate(e.x,e.y),c.rotate(-t.rotation),c.scale(o,u),c.fillRect(-1,-1,2,2),c.restore()}else{a=n.map.image,h=a.width>>1,p=a.height>>1,o=t.scale.x*f,u=t.scale.y*l,i=o*h,s=u*p,ot.set(e.x-i,e.y-s,e.x+i,e.y+s);if(it.intersects(ot)===!1)return;c.save(),c.translate(e.x,e.y),c.rotate(-t.rotation),c.scale(o,-u),c.translate(-h,-p),c.drawImage(a,0,0),c.restore()}else if(n instanceof THREE.ParticleCanvasMaterial){i=t.scale.x*f,s=t.scale.y*l,ot.set(e.x-i,e.y-s,e.x+i,e.y+s);if(it.intersects(ot)===!1)return;Nt(n.color.getStyle()),Ct(n.color.getStyle
  ()),c.save(),c.translate(e.x,e.y),c.rotate(-t.rotation),c.scale(i,s),n.program(c),c.restore()}}function g(e,t,n,r,i){wt(r.opacity),Et(r.blending),c.beginPath(),c.moveTo(e.positionScreen.x,e.positionScreen.y),c.lineTo(t.positionScreen.x,t.positionScreen.y),r instanceof THREE.LineBasicMaterial&&(St(r.linewidth),xt(r.linecap),Tt(r.linejoin),Nt(r.color.getStyle()),c.stroke(),ot.inflate(r.linewidth*2))}function y(e,n,r,i,s,u,a,f,l){t.info.render.vertices+=3,t.info.render.faces++,wt(f.opacity),Et(f.blending),k=e.positionScreen.x,L=e.positionScreen.y,A=n.positionScreen.x,O=n.positionScreen.y,M=r.positionScreen.x,_=r.positionScreen.y,w(k,L,A,O,M,_);if((f instanceof THREE.MeshLambertMaterial||f instanceof THREE.MeshPhongMaterial)&&f.map===null&&f.map===null)W.copy(f.color),X.copy(f.emissive),f.vertexColors===THREE.FaceColors&&(W.r*=a.color.r,W.g*=a.color.g,W.b*=a.color.b),ut===!0?f.wireframe===!1&&f.shading==THREE.SmoothShading&&a.vertexNormalsLength==3?(q.r=R.r=U.r=at.r,q.g=R.g=U.g=at.g,q.b=R.b=U.b=at.b,v(a.v1.positionWorld
  ,a.vertexNormalsWorld[0],q),v(a.v2.positionWorld,a.vertexNormalsWorld[1],R),v(a.v3.positionWorld,a.vertexNormalsWorld[2],U),q.r=q.r*W.r+X.r,q.g=q.g*W.g+X.g,q.b=q.b*W.b+X.b,R.r=R.r*W.r+X.r,R.g=R.g*W.g+X.g,R.b=R.b*W.b+X.b,U.r=U.r*W.r+X.r,U.g=U.g*W.g+X.g,U.b=U.b*W.b+X.b,z.r=(R.r+U.r)*.5,z.g=(R.g+U.g)*.5,z.b=(R.b+U.b)*.5,Q=Ot(q,R,U,z),At(k,L,A,O,M,_,0,0,1,0,0,1,Q)):(I.r=at.r,I.g=at.g,I.b=at.b,v(a.centroidWorld,a.normalWorld,I),I.r=I.r*W.r+X.r,I.g=I.g*W.g+X.g,I.b=I.b*W.b+X.b,f.wireframe===!0?bt(I,f.wireframeLinewidth,f.wireframeLinecap,f.wireframeLinejoin):kt(I)):f.wireframe===!0?bt(f.color,f.wireframeLinewidth,f.wireframeLinecap,f.wireframeLinejoin):kt(f.color);else if(f instanceof THREE.MeshBasicMaterial||f instanceof THREE.MeshLambertMaterial||f instanceof THREE.MeshPhongMaterial)if(f.map!==null)f.map.mapping instanceof THREE.UVMapping&&(G=a.uvs[0],Lt(k,L,A,O,M,_,G[i].u,G[i].v,G[s].u,G[s].v,G[u].u,G[u].v,f.map));else if(f.envMap!==null){if(f.envMap.mapping instanceof THREE.SphericalReflectionMapping){var c=o.matrixWorldInverse
  ;ht.copy(a.vertexNormalsWorld[i]),Y=(ht.x*c.elements[0]+ht.y*c.elements[4]+ht.z*c.elements[8])*.5+.5,Z=(ht.x*c.elements[1]+ht.y*c.elements[5]+ht.z*c.elements[9])*.5+.5,ht.copy(a.vertexNormalsWorld[s]),et=(ht.x*c.elements[0]+ht.y*c.elements[4]+ht.z*c.elements[8])*.5+.5,tt=(ht.x*c.elements[1]+ht.y*c.elements[5]+ht.z*c.elements[9])*.5+.5,ht.copy(a.vertexNormalsWorld[u]),nt=(ht.x*c.elements[0]+ht.y*c.elements[4]+ht.z*c.elements[8])*.5+.5,rt=(ht.x*c.elements[1]+ht.y*c.elements[5]+ht.z*c.elements[9])*.5+.5,Lt(k,L,A,O,M,_,Y,Z,et,tt,nt,rt,f.envMap)}}else I.copy(f.color),f.vertexColors===THREE.FaceColors&&(I.r*=a.color.r,I.g*=a.color.g,I.b*=a.color.b),f.wireframe===!0?bt(I,f.wireframeLinewidth,f.wireframeLinecap,f.wireframeLinejoin):kt(I);else f instanceof THREE.MeshDepthMaterial?(J=o.near,K=o.far,q.r=q.g=q.b=1-Mt(e.positionScreen.z,J,K),R.r=R.g=R.b=1-Mt(n.positionScreen.z,J,K),U.r=U.g=U.b=1-Mt(r.positionScreen.z,J,K),z.r=(R.r+U.r)*.5,z.g=(R.g+U.g)*.5,z.b=(R.b+U.b)*.5,Q=Ot(q,R,U,z),At(k,L,A,O,M,_,0,0,1,0,0,1,Q)):f instanceof 
  THREE.MeshNormalMaterial&&(I.r=_t(a.normalWorld.x),I.g=_t(a.normalWorld.y),I.b=_t(a.normalWorld.z),f.wireframe===!0?bt(I,f.wireframeLinewidth,f.wireframeLinecap,f.wireframeLinejoin):kt(I))}function b(e,n,r,i,s,u,a,f,l){t.info.render.vertices+=4,t.info.render.faces++,wt(f.opacity),Et(f.blending);if(f.map!==undefined&&f.map!==null||f.envMap!==undefined&&f.envMap!==null){y(e,n,i,0,1,3,a,f,l),y(s,r,u,1,2,3,a,f,l);return}k=e.positionScreen.x,L=e.positionScreen.y,A=n.positionScreen.x,O=n.positionScreen.y,M=r.positionScreen.x,_=r.positionScreen.y,D=i.positionScreen.x,P=i.positionScreen.y,H=s.positionScreen.x,B=s.positionScreen.y,j=u.positionScreen.x,F=u.positionScreen.y,f instanceof THREE.MeshLambertMaterial||f instanceof THREE.MeshPhongMaterial?(W.copy(f.color),X.copy(f.emissive),f.vertexColors===THREE.FaceColors&&(W.r*=a.color.r,W.g*=a.color.g,W.b*=a.color.b),ut===!0?f.wireframe===!1&&f.shading==THREE.SmoothShading&&a.vertexNormalsLength==4?(q.r=R.r=U.r=z.r=at.r,q.g=R.g=U.g=z.g=at.g,q.b=R.b=U.b=z.b=at.b,v(a.v1.positionWorld
  ,a.vertexNormalsWorld[0],q),v(a.v2.positionWorld,a.vertexNormalsWorld[1],R),v(a.v4.positionWorld,a.vertexNormalsWorld[3],U),v(a.v3.positionWorld,a.vertexNormalsWorld[2],z),q.r=q.r*W.r+X.r,q.g=q.g*W.g+X.g,q.b=q.b*W.b+X.b,R.r=R.r*W.r+X.r,R.g=R.g*W.g+X.g,R.b=R.b*W.b+X.b,U.r=U.r*W.r+X.r,U.g=U.g*W.g+X.g,U.b=U.b*W.b+X.b,z.r=z.r*W.r+X.r,z.g=z.g*W.g+X.g,z.b=z.b*W.b+X.b,Q=Ot(q,R,U,z),w(k,L,A,O,D,P),At(k,L,A,O,D,P,0,0,1,0,0,1,Q),w(H,B,M,_,j,F),At(H,B,M,_,j,F,1,0,1,1,0,1,Q)):(I.r=at.r,I.g=at.g,I.b=at.b,v(a.centroidWorld,a.normalWorld,I),I.r=I.r*W.r+X.r,I.g=I.g*W.g+X.g,I.b=I.b*W.b+X.b,ct(k,L,A,O,M,_,D,P),f.wireframe===!0?bt(I,f.wireframeLinewidth,f.wireframeLinecap,f.wireframeLinejoin):kt(I)):(I.r=W.r+X.r,I.g=W.g+X.g,I.b=W.b+X.b,ct(k,L,A,O,M,_,D,P),f.wireframe===!0?bt(I,f.wireframeLinewidth,f.wireframeLinecap,f.wireframeLinejoin):kt(I))):f instanceof THREE.MeshBasicMaterial?(I.copy(f.color),f.vertexColors===THREE.FaceColors&&(I.r*=a.color.r,I.g*=a.color.g,I.b*=a.color.b),ct(k,L,A,O,M,_,D,P),f.wireframe===!0?bt(I,f.wireframeLinewidth
  ,f.wireframeLinecap,f.wireframeLinejoin):kt(I)):f instanceof THREE.MeshNormalMaterial?(I.r=_t(a.normalWorld.x),I.g=_t(a.normalWorld.y),I.b=_t(a.normalWorld.z),ct(k,L,A,O,M,_,D,P),f.wireframe===!0?bt(I,f.wireframeLinewidth,f.wireframeLinecap,f.wireframeLinejoin):kt(I)):f instanceof THREE.MeshDepthMaterial&&(J=o.near,K=o.far,q.r=q.g=q.b=1-Mt(e.positionScreen.z,J,K),R.r=R.g=R.b=1-Mt(n.positionScreen.z,J,K),U.r=U.g=U.b=1-Mt(i.positionScreen.z,J,K),z.r=z.g=z.b=1-Mt(r.positionScreen.z,J,K),Q=Ot(q,R,U,z),w(k,L,A,O,D,P),At(k,L,A,O,D,P,0,0,1,0,0,1,Q),w(H,B,M,_,j,F),At(H,B,M,_,j,F,1,0,1,1,0,1,Q))}function w(e,t,n,r,i,s){c.beginPath(),c.moveTo(e,t),c.lineTo(n,r),c.lineTo(i,s),c.closePath()}function ct(e,t,n,r,i,s,o,u){c.beginPath(),c.moveTo(e,t),c.lineTo(n,r),c.lineTo(i,s),c.lineTo(o,u),c.closePath()}function bt(e,t,n,r){St(t),xt(n),Tt(r),Nt(e.getStyle()),c.stroke(),ot.inflate(t*2)}function kt(e){Ct(e.getStyle()),c.fill()}function Lt(e,t,n,r,i,s,o,u,a,f,l,h,p){if(p instanceof THREE.DataTexture||p.image===undefined||p.image
  .width==0)return;if(p.needsUpdate===!0){var d=p.wrapS==THREE.RepeatWrapping,v=p.wrapT==THREE.RepeatWrapping;V[p.id]=c.createPattern(p.image,d===!0&&v===!0?"repeat":d===!0&&v===!1?"repeat-x":d===!1&&v===!0?"repeat-y":"no-repeat"),p.needsUpdate=!1}V[p.id]===undefined?Ct("rgba(0,0,0,1)"):Ct(V[p.id]);var m,g,y,b,w,E,S,x,T=p.offset.x/p.repeat.x,N=p.offset.y/p.repeat.y,C=p.image.width*p.repeat.x,k=p.image.height*p.repeat.y;o=(o+T)*C,u=(1-u+N)*k,a=(a+T)*C,f=(1-f+N)*k,l=(l+T)*C,h=(1-h+N)*k,n-=e,r-=t,i-=e,s-=t,a-=o,f-=u,l-=o,h-=u,S=a*h-l*f;if(S===0){if($[p.id]===undefined){var L=document.createElement("canvas");L.width=p.image.width,L.height=p.image.height;var A=L.getContext("2d");A.drawImage(p.image,0,0),$[p.id]=A.getImageData(0,0,p.image.width,p.image.height).data}var O=$[p.id],M=(Math.floor(o)+Math.floor(u)*p.image.width)*4;I.setRGB(O[M]/255,O[M+1]/255,O[M+2]/255),kt(I);return}x=1/S,m=(h*n-f*i)*x,g=(h*r-f*s)*x,y=(a*i-l*n)*x,b=(a*s-l*r)*x,w=e-m*o-y*u,E=t-g*o-b*u,c.save(),c.transform(m,g,y,b,w,E),c.fill(),c.restore()}
  function At(e,t,n,r,i,s,o,u,a,f,l,h,p){var d,v,m,g,y,b,w,E,S=p.width-1,x=p.height-1;o*=S,u*=x,a*=S,f*=x,l*=S,h*=x,n-=e,r-=t,i-=e,s-=t,a-=o,f-=u,l-=o,h-=u,w=a*h-l*f,E=1/w,d=(h*n-f*i)*E,v=(h*r-f*s)*E,m=(a*i-l*n)*E,g=(a*s-l*r)*E,y=e-d*o-m*u,b=t-v*o-g*u,c.save(),c.transform(d,v,m,g,y,b),c.clip(),c.drawImage(p,0,0),c.restore()}function Ot(e,t,n,r){return mt[0]=e.r*255|0,mt[1]=e.g*255|0,mt[2]=e.b*255|0,mt[4]=t.r*255|0,mt[5]=t.g*255|0,mt[6]=t.b*255|0,mt[8]=n.r*255|0,mt[9]=n.g*255|0,mt[10]=n.b*255|0,mt[12]=r.r*255|0,mt[13]=r.g*255|0,mt[14]=r.b*255|0,dt.putImageData(vt,0,0),yt.drawImage(pt,0,0),gt}function Mt(e,t,n){var r=(e-t)/(n-t);return r*r*(3-2*r)}function _t(e){var t=(e+1)*.5;return t<0?0:t>1?1:t}function Dt(e,t){var n=t.x-e.x,r=t.y-e.y,i=n*n+r*r,s;if(i===0)return;s=1/Math.sqrt(i),n*=s,r*=s,t.x+=n,t.y+=r,e.x-=n,e.y-=r}if(o instanceof THREE.Camera==0){console.error("THREE.CanvasRenderer.render: camera is not an instance of THREE.Camera.");return}var u,a,h,p;this.autoClear===!0?this.clear():c.setTransform(1,0,0,-1,
  f,l),t.info.render.vertices=0,t.info.render.faces=0,n=s.projectScene(e,o,this.sortObjects,this.sortElements),r=n.elements,i=n.lights,ut=i.length>0,ut===!0&&d();for(u=0,a=r.length;u<a;u++){h=r[u],p=h.material;if(p===undefined||p.visible===!1)continue;ot.empty(),h instanceof THREE.RenderableParticle?(E=h,E.x*=f,E.y*=l,m(E,h,p,e)):h instanceof THREE.RenderableLine?(E=h.v1,S=h.v2,E.positionScreen.x*=f,E.positionScreen.y*=l,S.positionScreen.x*=f,S.positionScreen.y*=l,ot.addPoint(E.positionScreen.x,E.positionScreen.y),ot.addPoint(S.positionScreen.x,S.positionScreen.y),it.intersects(ot)===!0&&g(E,S,h,p,e)):h instanceof THREE.RenderableFace3?(E=h.v1,S=h.v2,x=h.v3,E.positionScreen.x*=f,E.positionScreen.y*=l,S.positionScreen.x*=f,S.positionScreen.y*=l,x.positionScreen.x*=f,x.positionScreen.y*=l,p.overdraw===!0&&(Dt(E.positionScreen,S.positionScreen),Dt(S.positionScreen,x.positionScreen),Dt(x.positionScreen,E.positionScreen)),ot.add3Points(E.positionScreen.x,E.positionScreen.y,S.positionScreen.x,S.positionScreen.y,x.positionScreen
  .x,x.positionScreen.y),it.intersects(ot)===!0&&y(E,S,x,0,1,2,h,p,e)):h instanceof THREE.RenderableFace4&&(E=h.v1,S=h.v2,x=h.v3,T=h.v4,E.positionScreen.x*=f,E.positionScreen.y*=l,S.positionScreen.x*=f,S.positionScreen.y*=l,x.positionScreen.x*=f,x.positionScreen.y*=l,T.positionScreen.x*=f,T.positionScreen.y*=l,N.positionScreen.copy(S.positionScreen),C.positionScreen.copy(T.positionScreen),p.overdraw===!0&&(Dt(E.positionScreen,S.positionScreen),Dt(S.positionScreen,T.positionScreen),Dt(T.positionScreen,E.positionScreen),Dt(x.positionScreen,N.positionScreen),Dt(x.positionScreen,C.positionScreen)),ot.addPoint(E.positionScreen.x,E.positionScreen.y),ot.addPoint(S.positionScreen.x,S.positionScreen.y),ot.addPoint(x.positionScreen.x,x.positionScreen.y),ot.addPoint(T.positionScreen.x,T.positionScreen.y),it.intersects(ot)===!0&&b(E,S,x,T,N,C,h,p,e)),st.addRectangle(ot)}c.setTransform(1,0,0,1,0,0)}},THREE.ShaderChunk={fog_pars_fragment:["#ifdef USE_FOG","uniform vec3 fogColor;","#ifdef FOG_EXP2","uniform float fogDensity;","#else"
  ,"uniform float fogNear;","uniform float fogFar;","#endif","#endif"].join("\n"),fog_fragment:["#ifdef USE_FOG","float depth = gl_FragCoord.z / gl_FragCoord.w;","#ifdef FOG_EXP2","const float LOG2 = 1.442695;","float fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );","fogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );","#else","float fogFactor = smoothstep( fogNear, fogFar, depth );","#endif","gl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );","#endif"].join("\n"),envmap_pars_fragment:["#ifdef USE_ENVMAP","uniform float reflectivity;","uniform samplerCube envMap;","uniform float flipEnvMap;","uniform int combine;","#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP )","uniform bool useRefract;","uniform float refractionRatio;","#else","varying vec3 vReflect;","#endif","#endif"].join("\n"),envmap_fragment:["#ifdef USE_ENVMAP","vec3 reflectVec;","#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP )","vec3 cameraToVertex = normalize( vWorldPosition - cameraPosition );"
  ,"if ( useRefract ) {","reflectVec = refract( cameraToVertex, normal, refractionRatio );","} else { ","reflectVec = reflect( cameraToVertex, normal );","}","#else","reflectVec = vReflect;","#endif","#ifdef DOUBLE_SIDED","float flipNormal = ( -1.0 + 2.0 * float( gl_FrontFacing ) );","vec4 cubeColor = textureCube( envMap, flipNormal * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );","#else","vec4 cubeColor = textureCube( envMap, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );","#endif","#ifdef GAMMA_INPUT","cubeColor.xyz *= cubeColor.xyz;","#endif","if ( combine == 1 ) {","gl_FragColor.xyz = mix( gl_FragColor.xyz, cubeColor.xyz, specularStrength * reflectivity );","} else if ( combine == 2 ) {","gl_FragColor.xyz += cubeColor.xyz * specularStrength * reflectivity;","} else {","gl_FragColor.xyz = mix( gl_FragColor.xyz, gl_FragColor.xyz * cubeColor.xyz, specularStrength * reflectivity );","}","#endif"].join("\n"),envmap_pars_vertex:["#if defined( USE_ENVMAP ) && ! defined( USE_BUMPMAP ) && ! defined( USE_NORMALMAP )"
  ,"varying vec3 vReflect;","uniform float refractionRatio;","uniform bool useRefract;","#endif"].join("\n"),worldpos_vertex:["#if defined( USE_ENVMAP ) || defined( PHONG ) || defined( LAMBERT ) || defined ( USE_SHADOWMAP )","#ifdef USE_SKINNING","vec4 worldPosition = modelMatrix * skinned;","#endif","#if defined( USE_MORPHTARGETS ) && ! defined( USE_SKINNING )","vec4 worldPosition = modelMatrix * vec4( morphed, 1.0 );","#endif","#if ! defined( USE_MORPHTARGETS ) && ! defined( USE_SKINNING )","vec4 worldPosition = modelMatrix * vec4( position, 1.0 );","#endif","#endif"].join("\n"),envmap_vertex:["#if defined( USE_ENVMAP ) && ! defined( USE_BUMPMAP ) && ! defined( USE_NORMALMAP )","vec3 worldNormal = mat3( modelMatrix[ 0 ].xyz, modelMatrix[ 1 ].xyz, modelMatrix[ 2 ].xyz ) * objectNormal;","worldNormal = normalize( worldNormal );","vec3 cameraToVertex = normalize( worldPosition.xyz - cameraPosition );","if ( useRefract ) {","vReflect = refract( cameraToVertex, worldNormal, refractionRatio );","} else {","vReflect = reflect( cameraToVertex, worldNormal );"
  ,"}","#endif"].join("\n"),map_particle_pars_fragment:["#ifdef USE_MAP","uniform sampler2D map;","#endif"].join("\n"),map_particle_fragment:["#ifdef USE_MAP","gl_FragColor = gl_FragColor * texture2D( map, vec2( gl_PointCoord.x, 1.0 - gl_PointCoord.y ) );","#endif"].join("\n"),map_pars_vertex:["#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP )","varying vec2 vUv;","uniform vec4 offsetRepeat;","#endif"].join("\n"),map_pars_fragment:["#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP )","varying vec2 vUv;","#endif","#ifdef USE_MAP","uniform sampler2D map;","#endif"].join("\n"),map_vertex:["#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP )","vUv = uv * offsetRepeat.zw + offsetRepeat.xy;","#endif"].join("\n"),map_fragment:["#ifdef USE_MAP","#ifdef GAMMA_INPUT","vec4 texelColor = texture2D( map, vUv );","texelColor.xyz *= texelColor.xyz;","gl_FragColor = gl_FragColor * texelColor;"
  ,"#else","gl_FragColor = gl_FragColor * texture2D( map, vUv );","#endif","#endif"].join("\n"),lightmap_pars_fragment:["#ifdef USE_LIGHTMAP","varying vec2 vUv2;","uniform sampler2D lightMap;","#endif"].join("\n"),lightmap_pars_vertex:["#ifdef USE_LIGHTMAP","varying vec2 vUv2;","#endif"].join("\n"),lightmap_fragment:["#ifdef USE_LIGHTMAP","gl_FragColor = gl_FragColor * texture2D( lightMap, vUv2 );","#endif"].join("\n"),lightmap_vertex:["#ifdef USE_LIGHTMAP","vUv2 = uv2;","#endif"].join("\n"),bumpmap_pars_fragment:["#ifdef USE_BUMPMAP","uniform sampler2D bumpMap;","uniform float bumpScale;","vec2 dHdxy_fwd() {","vec2 dSTdx = dFdx( vUv );","vec2 dSTdy = dFdy( vUv );","float Hll = bumpScale * texture2D( bumpMap, vUv ).x;","float dBx = bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll;","float dBy = bumpScale * texture2D( bumpMap, vUv + dSTdy ).x - Hll;","return vec2( dBx, dBy );","}","vec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy ) {","vec3 vSigmaX = dFdx( surf_pos );","vec3 vSigmaY = dFdy( surf_pos );"
  ,"vec3 vN = surf_norm;","vec3 R1 = cross( vSigmaY, vN );","vec3 R2 = cross( vN, vSigmaX );","float fDet = dot( vSigmaX, R1 );","vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );","return normalize( abs( fDet ) * surf_norm - vGrad );","}","#endif"].join("\n"),normalmap_pars_fragment:["#ifdef USE_NORMALMAP","uniform sampler2D normalMap;","uniform vec2 normalScale;","vec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm ) {","vec3 q0 = dFdx( eye_pos.xyz );","vec3 q1 = dFdy( eye_pos.xyz );","vec2 st0 = dFdx( vUv.st );","vec2 st1 = dFdy( vUv.st );","vec3 S = normalize(  q0 * st1.t - q1 * st0.t );","vec3 T = normalize( -q0 * st1.s + q1 * st0.s );","vec3 N = normalize( surf_norm );","vec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;","mapN.xy = normalScale * mapN.xy;","mat3 tsn = mat3( S, T, N );","return normalize( tsn * mapN );","}","#endif"].join("\n"),specularmap_pars_fragment:["#ifdef USE_SPECULARMAP","uniform sampler2D specularMap;","#endif"].join("\n"),specularmap_fragment:["float specularStrength;"
  ,"#ifdef USE_SPECULARMAP","vec4 texelSpecular = texture2D( specularMap, vUv );","specularStrength = texelSpecular.r;","#else","specularStrength = 1.0;","#endif"].join("\n"),lights_lambert_pars_vertex:["uniform vec3 ambient;","uniform vec3 diffuse;","uniform vec3 emissive;","uniform vec3 ambientLightColor;","#if MAX_DIR_LIGHTS > 0","uniform vec3 directionalLightColor[ MAX_DIR_LIGHTS ];","uniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];","#endif","#if MAX_HEMI_LIGHTS > 0","uniform vec3 hemisphereLightSkyColor[ MAX_HEMI_LIGHTS ];","uniform vec3 hemisphereLightGroundColor[ MAX_HEMI_LIGHTS ];","uniform vec3 hemisphereLightDirection[ MAX_HEMI_LIGHTS ];","#endif","#if MAX_POINT_LIGHTS > 0","uniform vec3 pointLightColor[ MAX_POINT_LIGHTS ];","uniform vec3 pointLightPosition[ MAX_POINT_LIGHTS ];","uniform float pointLightDistance[ MAX_POINT_LIGHTS ];","#endif","#if MAX_SPOT_LIGHTS > 0","uniform vec3 spotLightColor[ MAX_SPOT_LIGHTS ];","uniform vec3 spotLightPosition[ MAX_SPOT_LIGHTS ];","uniform vec3 spotLightDirection[ MAX_SPOT_LIGHTS ];"
  ,"uniform float spotLightDistance[ MAX_SPOT_LIGHTS ];","uniform float spotLightAngleCos[ MAX_SPOT_LIGHTS ];","uniform float spotLightExponent[ MAX_SPOT_LIGHTS ];","#endif","#ifdef WRAP_AROUND","uniform vec3 wrapRGB;","#endif"].join("\n"),lights_lambert_vertex:["vLightFront = vec3( 0.0 );","#ifdef DOUBLE_SIDED","vLightBack = vec3( 0.0 );","#endif","transformedNormal = normalize( transformedNormal );","#if MAX_DIR_LIGHTS > 0","for( int i = 0; i < MAX_DIR_LIGHTS; i ++ ) {","vec4 lDirection = viewMatrix * vec4( directionalLightDirection[ i ], 0.0 );","vec3 dirVector = normalize( lDirection.xyz );","float dotProduct = dot( transformedNormal, dirVector );","vec3 directionalLightWeighting = vec3( max( dotProduct, 0.0 ) );","#ifdef DOUBLE_SIDED","vec3 directionalLightWeightingBack = vec3( max( -dotProduct, 0.0 ) );","#ifdef WRAP_AROUND","vec3 directionalLightWeightingHalfBack = vec3( max( -0.5 * dotProduct + 0.5, 0.0 ) );","#endif","#endif","#ifdef WRAP_AROUND","vec3 directionalLightWeightingHalf = vec3( max( 0.5 * dotProduct + 0.5, 0.0 ) );"
  ,"directionalLightWeighting = mix( directionalLightWeighting, directionalLightWeightingHalf, wrapRGB );","#ifdef DOUBLE_SIDED","directionalLightWeightingBack = mix( directionalLightWeightingBack, directionalLightWeightingHalfBack, wrapRGB );","#endif","#endif","vLightFront += directionalLightColor[ i ] * directionalLightWeighting;","#ifdef DOUBLE_SIDED","vLightBack += directionalLightColor[ i ] * directionalLightWeightingBack;","#endif","}","#endif","#if MAX_POINT_LIGHTS > 0","for( int i = 0; i < MAX_POINT_LIGHTS; i ++ ) {","vec4 lPosition = viewMatrix * vec4( pointLightPosition[ i ], 1.0 );","vec3 lVector = lPosition.xyz - mvPosition.xyz;","float lDistance = 1.0;","if ( pointLightDistance[ i ] > 0.0 )","lDistance = 1.0 - min( ( length( lVector ) / pointLightDistance[ i ] ), 1.0 );","lVector = normalize( lVector );","float dotProduct = dot( transformedNormal, lVector );","vec3 pointLightWeighting = vec3( max( dotProduct, 0.0 ) );","#ifdef DOUBLE_SIDED","vec3 pointLightWeightingBack = vec3( max( -dotProduct, 0.0 ) );"
  ,"#ifdef WRAP_AROUND","vec3 pointLightWeightingHalfBack = vec3( max( -0.5 * dotProduct + 0.5, 0.0 ) );","#endif","#endif","#ifdef WRAP_AROUND","vec3 pointLightWeightingHalf = vec3( max( 0.5 * dotProduct + 0.5, 0.0 ) );","pointLightWeighting = mix( pointLightWeighting, pointLightWeightingHalf, wrapRGB );","#ifdef DOUBLE_SIDED","pointLightWeightingBack = mix( pointLightWeightingBack, pointLightWeightingHalfBack, wrapRGB );","#endif","#endif","vLightFront += pointLightColor[ i ] * pointLightWeighting * lDistance;","#ifdef DOUBLE_SIDED","vLightBack += pointLightColor[ i ] * pointLightWeightingBack * lDistance;","#endif","}","#endif","#if MAX_SPOT_LIGHTS > 0","for( int i = 0; i < MAX_SPOT_LIGHTS; i ++ ) {","vec4 lPosition = viewMatrix * vec4( spotLightPosition[ i ], 1.0 );","vec3 lVector = lPosition.xyz - mvPosition.xyz;","float spotEffect = dot( spotLightDirection[ i ], normalize( spotLightPosition[ i ] - worldPosition.xyz ) );","if ( spotEffect > spotLightAngleCos[ i ] ) {","spotEffect = max( pow( spotEffect, spotLightExponent[ i ] ), 0.0 );"
  ,"float lDistance = 1.0;","if ( spotLightDistance[ i ] > 0.0 )","lDistance = 1.0 - min( ( length( lVector ) / spotLightDistance[ i ] ), 1.0 );","lVector = normalize( lVector );","float dotProduct = dot( transformedNormal, lVector );","vec3 spotLightWeighting = vec3( max( dotProduct, 0.0 ) );","#ifdef DOUBLE_SIDED","vec3 spotLightWeightingBack = vec3( max( -dotProduct, 0.0 ) );","#ifdef WRAP_AROUND","vec3 spotLightWeightingHalfBack = vec3( max( -0.5 * dotProduct + 0.5, 0.0 ) );","#endif","#endif","#ifdef WRAP_AROUND","vec3 spotLightWeightingHalf = vec3( max( 0.5 * dotProduct + 0.5, 0.0 ) );","spotLightWeighting = mix( spotLightWeighting, spotLightWeightingHalf, wrapRGB );","#ifdef DOUBLE_SIDED","spotLightWeightingBack = mix( spotLightWeightingBack, spotLightWeightingHalfBack, wrapRGB );","#endif","#endif","vLightFront += spotLightColor[ i ] * spotLightWeighting * lDistance * spotEffect;","#ifdef DOUBLE_SIDED","vLightBack += spotLightColor[ i ] * spotLightWeightingBack * lDistance * spotEffect;","#endif","}","}"
  ,"#endif","#if MAX_HEMI_LIGHTS > 0","for( int i = 0; i < MAX_HEMI_LIGHTS; i ++ ) {","vec4 lDirection = viewMatrix * vec4( hemisphereLightDirection[ i ], 0.0 );","vec3 lVector = normalize( lDirection.xyz );","float dotProduct = dot( transformedNormal, lVector );","float hemiDiffuseWeight = 0.5 * dotProduct + 0.5;","float hemiDiffuseWeightBack = -0.5 * dotProduct + 0.5;","vLightFront += mix( hemisphereLightGroundColor[ i ], hemisphereLightSkyColor[ i ], hemiDiffuseWeight );","#ifdef DOUBLE_SIDED","vLightBack += mix( hemisphereLightGroundColor[ i ], hemisphereLightSkyColor[ i ], hemiDiffuseWeightBack );","#endif","}","#endif","vLightFront = vLightFront * diffuse + ambient * ambientLightColor + emissive;","#ifdef DOUBLE_SIDED","vLightBack = vLightBack * diffuse + ambient * ambientLightColor + emissive;","#endif"].join("\n"),lights_phong_pars_vertex:["#ifndef PHONG_PER_PIXEL","#if MAX_POINT_LIGHTS > 0","uniform vec3 pointLightPosition[ MAX_POINT_LIGHTS ];","uniform float pointLightDistance[ MAX_POINT_LIGHTS ];","varying vec4 vPointLight[ MAX_POINT_LIGHTS ];"
  ,"#endif","#if MAX_SPOT_LIGHTS > 0","uniform vec3 spotLightPosition[ MAX_SPOT_LIGHTS ];","uniform float spotLightDistance[ MAX_SPOT_LIGHTS ];","varying vec4 vSpotLight[ MAX_SPOT_LIGHTS ];","#endif","#endif","#if MAX_SPOT_LIGHTS > 0 || defined( USE_BUMPMAP )","varying vec3 vWorldPosition;","#endif"].join("\n"),lights_phong_vertex:["#ifndef PHONG_PER_PIXEL","#if MAX_POINT_LIGHTS > 0","for( int i = 0; i < MAX_POINT_LIGHTS; i ++ ) {","vec4 lPosition = viewMatrix * vec4( pointLightPosition[ i ], 1.0 );","vec3 lVector = lPosition.xyz - mvPosition.xyz;","float lDistance = 1.0;","if ( pointLightDistance[ i ] > 0.0 )","lDistance = 1.0 - min( ( length( lVector ) / pointLightDistance[ i ] ), 1.0 );","vPointLight[ i ] = vec4( lVector, lDistance );","}","#endif","#if MAX_SPOT_LIGHTS > 0","for( int i = 0; i < MAX_SPOT_LIGHTS; i ++ ) {","vec4 lPosition = viewMatrix * vec4( spotLightPosition[ i ], 1.0 );","vec3 lVector = lPosition.xyz - mvPosition.xyz;","float lDistance = 1.0;","if ( spotLightDistance[ i ] > 0.0 )","lDistance = 1.0 - min( ( length( lVector ) / spotLightDistance[ i ] ), 1.0 );"
  ,"vSpotLight[ i ] = vec4( lVector, lDistance );","}","#endif","#endif","#if MAX_SPOT_LIGHTS > 0 || defined( USE_BUMPMAP )","vWorldPosition = worldPosition.xyz;","#endif"].join("\n"),lights_phong_pars_fragment:["uniform vec3 ambientLightColor;","#if MAX_DIR_LIGHTS > 0","uniform vec3 directionalLightColor[ MAX_DIR_LIGHTS ];","uniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];","#endif","#if MAX_HEMI_LIGHTS > 0","uniform vec3 hemisphereLightSkyColor[ MAX_HEMI_LIGHTS ];","uniform vec3 hemisphereLightGroundColor[ MAX_HEMI_LIGHTS ];","uniform vec3 hemisphereLightDirection[ MAX_HEMI_LIGHTS ];","#endif","#if MAX_POINT_LIGHTS > 0","uniform vec3 pointLightColor[ MAX_POINT_LIGHTS ];","#ifdef PHONG_PER_PIXEL","uniform vec3 pointLightPosition[ MAX_POINT_LIGHTS ];","uniform float pointLightDistance[ MAX_POINT_LIGHTS ];","#else","varying vec4 vPointLight[ MAX_POINT_LIGHTS ];","#endif","#endif","#if MAX_SPOT_LIGHTS > 0","uniform vec3 spotLightColor[ MAX_SPOT_LIGHTS ];","uniform vec3 spotLightPosition[ MAX_SPOT_LIGHTS ];"
  ,"uniform vec3 spotLightDirection[ MAX_SPOT_LIGHTS ];","uniform float spotLightAngleCos[ MAX_SPOT_LIGHTS ];","uniform float spotLightExponent[ MAX_SPOT_LIGHTS ];","#ifdef PHONG_PER_PIXEL","uniform float spotLightDistance[ MAX_SPOT_LIGHTS ];","#else","varying vec4 vSpotLight[ MAX_SPOT_LIGHTS ];","#endif","#endif","#if MAX_SPOT_LIGHTS > 0 || defined( USE_BUMPMAP )","varying vec3 vWorldPosition;","#endif","#ifdef WRAP_AROUND","uniform vec3 wrapRGB;","#endif","varying vec3 vViewPosition;","varying vec3 vNormal;"].join("\n"),lights_phong_fragment:["vec3 normal = normalize( vNormal );","vec3 viewPosition = normalize( vViewPosition );","#ifdef DOUBLE_SIDED","normal = normal * ( -1.0 + 2.0 * float( gl_FrontFacing ) );","#endif","#ifdef USE_NORMALMAP","normal = perturbNormal2Arb( -viewPosition, normal );","#elif defined( USE_BUMPMAP )","normal = perturbNormalArb( -vViewPosition, normal, dHdxy_fwd() );","#endif","#if MAX_POINT_LIGHTS > 0","vec3 pointDiffuse  = vec3( 0.0 );","vec3 pointSpecular = vec3( 0.0 );","for ( int i = 0; i < MAX_POINT_LIGHTS; i ++ ) {"
  ,"#ifdef PHONG_PER_PIXEL","vec4 lPosition = viewMatrix * vec4( pointLightPosition[ i ], 1.0 );","vec3 lVector = lPosition.xyz + vViewPosition.xyz;","float lDistance = 1.0;","if ( pointLightDistance[ i ] > 0.0 )","lDistance = 1.0 - min( ( length( lVector ) / pointLightDistance[ i ] ), 1.0 );","lVector = normalize( lVector );","#else","vec3 lVector = normalize( vPointLight[ i ].xyz );","float lDistance = vPointLight[ i ].w;","#endif","float dotProduct = dot( normal, lVector );","#ifdef WRAP_AROUND","float pointDiffuseWeightFull = max( dotProduct, 0.0 );","float pointDiffuseWeightHalf = max( 0.5 * dotProduct + 0.5, 0.0 );","vec3 pointDiffuseWeight = mix( vec3 ( pointDiffuseWeightFull ), vec3( pointDiffuseWeightHalf ), wrapRGB );","#else","float pointDiffuseWeight = max( dotProduct, 0.0 );","#endif","pointDiffuse  += diffuse * pointLightColor[ i ] * pointDiffuseWeight * lDistance;","vec3 pointHalfVector = normalize( lVector + viewPosition );","float pointDotNormalHalf = max( dot( normal, pointHalfVector ), 0.0 );"
  ,"float pointSpecularWeight = specularStrength * max( pow( pointDotNormalHalf, shininess ), 0.0 );","#ifdef PHYSICALLY_BASED_SHADING","float specularNormalization = ( shininess + 2.0001 ) / 8.0;","vec3 schlick = specular + vec3( 1.0 - specular ) * pow( 1.0 - dot( lVector, pointHalfVector ), 5.0 );","pointSpecular += schlick * pointLightColor[ i ] * pointSpecularWeight * pointDiffuseWeight * lDistance * specularNormalization;","#else","pointSpecular += specular * pointLightColor[ i ] * pointSpecularWeight * pointDiffuseWeight * lDistance;","#endif","}","#endif","#if MAX_SPOT_LIGHTS > 0","vec3 spotDiffuse  = vec3( 0.0 );","vec3 spotSpecular = vec3( 0.0 );","for ( int i = 0; i < MAX_SPOT_LIGHTS; i ++ ) {","#ifdef PHONG_PER_PIXEL","vec4 lPosition = viewMatrix * vec4( spotLightPosition[ i ], 1.0 );","vec3 lVector = lPosition.xyz + vViewPosition.xyz;","float lDistance = 1.0;","if ( spotLightDistance[ i ] > 0.0 )","lDistance = 1.0 - min( ( length( lVector ) / spotLightDistance[ i ] ), 1.0 );","lVector = normalize( lVector );"
  ,"#else","vec3 lVector = normalize( vSpotLight[ i ].xyz );","float lDistance = vSpotLight[ i ].w;","#endif","float spotEffect = dot( spotLightDirection[ i ], normalize( spotLightPosition[ i ] - vWorldPosition ) );","if ( spotEffect > spotLightAngleCos[ i ] ) {","spotEffect = max( pow( spotEffect, spotLightExponent[ i ] ), 0.0 );","float dotProduct = dot( normal, lVector );","#ifdef WRAP_AROUND","float spotDiffuseWeightFull = max( dotProduct, 0.0 );","float spotDiffuseWeightHalf = max( 0.5 * dotProduct + 0.5, 0.0 );","vec3 spotDiffuseWeight = mix( vec3 ( spotDiffuseWeightFull ), vec3( spotDiffuseWeightHalf ), wrapRGB );","#else","float spotDiffuseWeight = max( dotProduct, 0.0 );","#endif","spotDiffuse += diffuse * spotLightColor[ i ] * spotDiffuseWeight * lDistance * spotEffect;","vec3 spotHalfVector = normalize( lVector + viewPosition );","float spotDotNormalHalf = max( dot( normal, spotHalfVector ), 0.0 );","float spotSpecularWeight = specularStrength * max( pow( spotDotNormalHalf, shininess ), 0.0 );","#ifdef PHYSICALLY_BASED_SHADING"
  ,"float specularNormalization = ( shininess + 2.0001 ) / 8.0;","vec3 schlick = specular + vec3( 1.0 - specular ) * pow( 1.0 - dot( lVector, spotHalfVector ), 5.0 );","spotSpecular += schlick * spotLightColor[ i ] * spotSpecularWeight * spotDiffuseWeight * lDistance * specularNormalization * spotEffect;","#else","spotSpecular += specular * spotLightColor[ i ] * spotSpecularWeight * spotDiffuseWeight * lDistance * spotEffect;","#endif","}","}","#endif","#if MAX_DIR_LIGHTS > 0","vec3 dirDiffuse  = vec3( 0.0 );","vec3 dirSpecular = vec3( 0.0 );","for( int i = 0; i < MAX_DIR_LIGHTS; i ++ ) {","vec4 lDirection = viewMatrix * vec4( directionalLightDirection[ i ], 0.0 );","vec3 dirVector = normalize( lDirection.xyz );","float dotProduct = dot( normal, dirVector );","#ifdef WRAP_AROUND","float dirDiffuseWeightFull = max( dotProduct, 0.0 );","float dirDiffuseWeightHalf = max( 0.5 * dotProduct + 0.5, 0.0 );","vec3 dirDiffuseWeight = mix( vec3( dirDiffuseWeightFull ), vec3( dirDiffuseWeightHalf ), wrapRGB );","#else","float dirDiffuseWeight = max( dotProduct, 0.0 );"
  ,"#endif","dirDiffuse  += diffuse * directionalLightColor[ i ] * dirDiffuseWeight;","vec3 dirHalfVector = normalize( dirVector + viewPosition );","float dirDotNormalHalf = max( dot( normal, dirHalfVector ), 0.0 );","float dirSpecularWeight = specularStrength * max( pow( dirDotNormalHalf, shininess ), 0.0 );","#ifdef PHYSICALLY_BASED_SHADING","float specularNormalization = ( shininess + 2.0001 ) / 8.0;","vec3 schlick = specular + vec3( 1.0 - specular ) * pow( 1.0 - dot( dirVector, dirHalfVector ), 5.0 );","dirSpecular += schlick * directionalLightColor[ i ] * dirSpecularWeight * dirDiffuseWeight * specularNormalization;","#else","dirSpecular += specular * directionalLightColor[ i ] * dirSpecularWeight * dirDiffuseWeight;","#endif","}","#endif","#if MAX_HEMI_LIGHTS > 0","vec3 hemiDiffuse  = vec3( 0.0 );","vec3 hemiSpecular = vec3( 0.0 );","for( int i = 0; i < MAX_HEMI_LIGHTS; i ++ ) {","vec4 lDirection = viewMatrix * vec4( hemisphereLightDirection[ i ], 0.0 );","vec3 lVector = normalize( lDirection.xyz );","float dotProduct = dot( normal, lVector );"
  ,"float hemiDiffuseWeight = 0.5 * dotProduct + 0.5;","vec3 hemiColor = mix( hemisphereLightGroundColor[ i ], hemisphereLightSkyColor[ i ], hemiDiffuseWeight );","hemiDiffuse += diffuse * hemiColor;","vec3 hemiHalfVectorSky = normalize( lVector + viewPosition );","float hemiDotNormalHalfSky = 0.5 * dot( normal, hemiHalfVectorSky ) + 0.5;","float hemiSpecularWeightSky = specularStrength * max( pow( hemiDotNormalHalfSky, shininess ), 0.0 );","vec3 lVectorGround = -lVector;","vec3 hemiHalfVectorGround = normalize( lVectorGround + viewPosition );","float hemiDotNormalHalfGround = 0.5 * dot( normal, hemiHalfVectorGround ) + 0.5;","float hemiSpecularWeightGround = specularStrength * max( pow( hemiDotNormalHalfGround, shininess ), 0.0 );","#ifdef PHYSICALLY_BASED_SHADING","float dotProductGround = dot( normal, lVectorGround );","float specularNormalization = ( shininess + 2.0001 ) / 8.0;","vec3 schlickSky = specular + vec3( 1.0 - specular ) * pow( 1.0 - dot( lVector, hemiHalfVectorSky ), 5.0 );","vec3 schlickGround = specular + vec3( 1.0 - specular ) * pow( 1.0 - dot( lVectorGround, hemiHalfVectorGround ), 5.0 );"
  ,"hemiSpecular += hemiColor * specularNormalization * ( schlickSky * hemiSpecularWeightSky * max( dotProduct, 0.0 ) + schlickGround * hemiSpecularWeightGround * max( dotProductGround, 0.0 ) );","#else","hemiSpecular += specular * hemiColor * ( hemiSpecularWeightSky + hemiSpecularWeightGround ) * hemiDiffuseWeight;","#endif","}","#endif","vec3 totalDiffuse = vec3( 0.0 );","vec3 totalSpecular = vec3( 0.0 );","#if MAX_DIR_LIGHTS > 0","totalDiffuse += dirDiffuse;","totalSpecular += dirSpecular;","#endif","#if MAX_HEMI_LIGHTS > 0","totalDiffuse += hemiDiffuse;","totalSpecular += hemiSpecular;","#endif","#if MAX_POINT_LIGHTS > 0","totalDiffuse += pointDiffuse;","totalSpecular += pointSpecular;","#endif","#if MAX_SPOT_LIGHTS > 0","totalDiffuse += spotDiffuse;","totalSpecular += spotSpecular;","#endif","#ifdef METAL","gl_FragColor.xyz = gl_FragColor.xyz * ( emissive + totalDiffuse + ambientLightColor * ambient + totalSpecular );","#else","gl_FragColor.xyz = gl_FragColor.xyz * ( emissive + totalDiffuse + ambientLightColor * ambient ) + totalSpecular;"
  ,"#endif"].join("\n"),color_pars_fragment:["#ifdef USE_COLOR","varying vec3 vColor;","#endif"].join("\n"),color_fragment:["#ifdef USE_COLOR","gl_FragColor = gl_FragColor * vec4( vColor, opacity );","#endif"].join("\n"),color_pars_vertex:["#ifdef USE_COLOR","varying vec3 vColor;","#endif"].join("\n"),color_vertex:["#ifdef USE_COLOR","#ifdef GAMMA_INPUT","vColor = color * color;","#else","vColor = color;","#endif","#endif"].join("\n"),skinning_pars_vertex:["#ifdef USE_SKINNING","#ifdef BONE_TEXTURE","uniform sampler2D boneTexture;","mat4 getBoneMatrix( const in float i ) {","float j = i * 4.0;","float x = mod( j, N_BONE_PIXEL_X );","float y = floor( j / N_BONE_PIXEL_X );","const float dx = 1.0 / N_BONE_PIXEL_X;","const float dy = 1.0 / N_BONE_PIXEL_Y;","y = dy * ( y + 0.5 );","vec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );","vec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );","vec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );","vec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );"
  ,"mat4 bone = mat4( v1, v2, v3, v4 );","return bone;","}","#else","uniform mat4 boneGlobalMatrices[ MAX_BONES ];","mat4 getBoneMatrix( const in float i ) {","mat4 bone = boneGlobalMatrices[ int(i) ];","return bone;","}","#endif","#endif"].join("\n"),skinbase_vertex:["#ifdef USE_SKINNING","mat4 boneMatX = getBoneMatrix( skinIndex.x );","mat4 boneMatY = getBoneMatrix( skinIndex.y );","#endif"].join("\n"),skinning_vertex:["#ifdef USE_SKINNING","#ifdef USE_MORPHTARGETS","vec4 skinVertex = vec4( morphed, 1.0 );","#else","vec4 skinVertex = vec4( position, 1.0 );","#endif","vec4 skinned  = boneMatX * skinVertex * skinWeight.x;","skinned 	  += boneMatY * skinVertex * skinWeight.y;","#endif"].join("\n"),morphtarget_pars_vertex:["#ifdef USE_MORPHTARGETS","#ifndef USE_MORPHNORMALS","uniform float morphTargetInfluences[ 8 ];","#else","uniform float morphTargetInfluences[ 4 ];","#endif","#endif"].join("\n"),morphtarget_vertex:["#ifdef USE_MORPHTARGETS","vec3 morphed = vec3( 0.0 );","morphed += ( morphTarget0 - position ) * morphTargetInfluences[ 0 ];"
  ,"morphed += ( morphTarget1 - position ) * morphTargetInfluences[ 1 ];","morphed += ( morphTarget2 - position ) * morphTargetInfluences[ 2 ];","morphed += ( morphTarget3 - position ) * morphTargetInfluences[ 3 ];","#ifndef USE_MORPHNORMALS","morphed += ( morphTarget4 - position ) * morphTargetInfluences[ 4 ];","morphed += ( morphTarget5 - position ) * morphTargetInfluences[ 5 ];","morphed += ( morphTarget6 - position ) * morphTargetInfluences[ 6 ];","morphed += ( morphTarget7 - position ) * morphTargetInfluences[ 7 ];","#endif","morphed += position;","#endif"].join("\n"),default_vertex:["vec4 mvPosition;","#ifdef USE_SKINNING","mvPosition = modelViewMatrix * skinned;","#endif","#if !defined( USE_SKINNING ) && defined( USE_MORPHTARGETS )","mvPosition = modelViewMatrix * vec4( morphed, 1.0 );","#endif","#if !defined( USE_SKINNING ) && ! defined( USE_MORPHTARGETS )","mvPosition = modelViewMatrix * vec4( position, 1.0 );","#endif","gl_Position = projectionMatrix * mvPosition;"].join("\n"),morphnormal_vertex:["#ifdef USE_MORPHNORMALS"
  ,"vec3 morphedNormal = vec3( 0.0 );","morphedNormal +=  ( morphNormal0 - normal ) * morphTargetInfluences[ 0 ];","morphedNormal +=  ( morphNormal1 - normal ) * morphTargetInfluences[ 1 ];","morphedNormal +=  ( morphNormal2 - normal ) * morphTargetInfluences[ 2 ];","morphedNormal +=  ( morphNormal3 - normal ) * morphTargetInfluences[ 3 ];","morphedNormal += normal;","#endif"].join("\n"),skinnormal_vertex:["#ifdef USE_SKINNING","mat4 skinMatrix = skinWeight.x * boneMatX;","skinMatrix 	+= skinWeight.y * boneMatY;","#ifdef USE_MORPHNORMALS","vec4 skinnedNormal = skinMatrix * vec4( morphedNormal, 0.0 );","#else","vec4 skinnedNormal = skinMatrix * vec4( normal, 0.0 );","#endif","#endif"].join("\n"),defaultnormal_vertex:["vec3 objectNormal;","#ifdef USE_SKINNING","objectNormal = skinnedNormal.xyz;","#endif","#if !defined( USE_SKINNING ) && defined( USE_MORPHNORMALS )","objectNormal = morphedNormal;","#endif","#if !defined( USE_SKINNING ) && ! defined( USE_MORPHNORMALS )","objectNormal = normal;","#endif","#ifdef FLIP_SIDED"
  ,"objectNormal = -objectNormal;","#endif","vec3 transformedNormal = normalMatrix * objectNormal;"].join("\n"),shadowmap_pars_fragment:["#ifdef USE_SHADOWMAP","uniform sampler2D shadowMap[ MAX_SHADOWS ];","uniform vec2 shadowMapSize[ MAX_SHADOWS ];","uniform float shadowDarkness[ MAX_SHADOWS ];","uniform float shadowBias[ MAX_SHADOWS ];","varying vec4 vShadowCoord[ MAX_SHADOWS ];","float unpackDepth( const in vec4 rgba_depth ) {","const vec4 bit_shift = vec4( 1.0 / ( 256.0 * 256.0 * 256.0 ), 1.0 / ( 256.0 * 256.0 ), 1.0 / 256.0, 1.0 );","float depth = dot( rgba_depth, bit_shift );","return depth;","}","#endif"].join("\n"),shadowmap_fragment:["#ifdef USE_SHADOWMAP","#ifdef SHADOWMAP_DEBUG","vec3 frustumColors[3];","frustumColors[0] = vec3( 1.0, 0.5, 0.0 );","frustumColors[1] = vec3( 0.0, 1.0, 0.8 );","frustumColors[2] = vec3( 0.0, 0.5, 1.0 );","#endif","#ifdef SHADOWMAP_CASCADE","int inFrustumCount = 0;","#endif","float fDepth;","vec3 shadowColor = vec3( 1.0 );","for( int i = 0; i < MAX_SHADOWS; i ++ ) {","vec3 shadowCoord = vShadowCoord[ i ].xyz / vShadowCoord[ i ].w;"
  ,"bvec4 inFrustumVec = bvec4 ( shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0 );","bool inFrustum = all( inFrustumVec );","#ifdef SHADOWMAP_CASCADE","inFrustumCount += int( inFrustum );","bvec3 frustumTestVec = bvec3( inFrustum, inFrustumCount == 1, shadowCoord.z <= 1.0 );","#else","bvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 );","#endif","bool frustumTest = all( frustumTestVec );","if ( frustumTest ) {","shadowCoord.z += shadowBias[ i ];","#ifdef SHADOWMAP_SOFT","float shadow = 0.0;","const float shadowDelta = 1.0 / 9.0;","float xPixelOffset = 1.0 / shadowMapSize[ i ].x;","float yPixelOffset = 1.0 / shadowMapSize[ i ].y;","float dx0 = -1.25 * xPixelOffset;","float dy0 = -1.25 * yPixelOffset;","float dx1 = 1.25 * xPixelOffset;","float dy1 = 1.25 * yPixelOffset;","fDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx0, dy0 ) ) );","if ( fDepth < shadowCoord.z ) shadow += shadowDelta;","fDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( 0.0, dy0 ) ) );"
  ,"if ( fDepth < shadowCoord.z ) shadow += shadowDelta;","fDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx1, dy0 ) ) );","if ( fDepth < shadowCoord.z ) shadow += shadowDelta;","fDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx0, 0.0 ) ) );","if ( fDepth < shadowCoord.z ) shadow += shadowDelta;","fDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy ) );","if ( fDepth < shadowCoord.z ) shadow += shadowDelta;","fDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx1, 0.0 ) ) );","if ( fDepth < shadowCoord.z ) shadow += shadowDelta;","fDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx0, dy1 ) ) );","if ( fDepth < shadowCoord.z ) shadow += shadowDelta;","fDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( 0.0, dy1 ) ) );","if ( fDepth < shadowCoord.z ) shadow += shadowDelta;","fDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx1, dy1 ) ) );","if ( fDepth < shadowCoord.z ) shadow += shadowDelta;"
  ,"shadowColor = shadowColor * vec3( ( 1.0 - shadowDarkness[ i ] * shadow ) );","#else","vec4 rgbaDepth = texture2D( shadowMap[ i ], shadowCoord.xy );","float fDepth = unpackDepth( rgbaDepth );","if ( fDepth < shadowCoord.z )","shadowColor = shadowColor * vec3( 1.0 - shadowDarkness[ i ] );","#endif","}","#ifdef SHADOWMAP_DEBUG","#ifdef SHADOWMAP_CASCADE","if ( inFrustum && inFrustumCount == 1 ) gl_FragColor.xyz *= frustumColors[ i ];","#else","if ( inFrustum ) gl_FragColor.xyz *= frustumColors[ i ];","#endif","#endif","}","#ifdef GAMMA_OUTPUT","shadowColor *= shadowColor;","#endif","gl_FragColor.xyz = gl_FragColor.xyz * shadowColor;","#endif"].join("\n"),shadowmap_pars_vertex:["#ifdef USE_SHADOWMAP","varying vec4 vShadowCoord[ MAX_SHADOWS ];","uniform mat4 shadowMatrix[ MAX_SHADOWS ];","#endif"].join("\n"),shadowmap_vertex:["#ifdef USE_SHADOWMAP","for( int i = 0; i < MAX_SHADOWS; i ++ ) {","vShadowCoord[ i ] = shadowMatrix[ i ] * worldPosition;","}","#endif"].join("\n"),alphatest_fragment:["#ifdef ALPHATEST","if ( gl_FragColor.a < ALPHATEST ) discard;"
  ,"#endif"].join("\n"),linear_to_gamma_fragment:["#ifdef GAMMA_OUTPUT","gl_FragColor.xyz = sqrt( gl_FragColor.xyz );","#endif"].join("\n")},THREE.UniformsUtils={merge:function(e){var t,n,r,i={};for(t=0;t<e.length;t++){r=this.clone(e[t]);for(n in r)i[n]=r[n]}return i},clone:function(e){var t,n,r,i,s={};for(t in e){s[t]={};for(n in e[t])i=e[t][n],i instanceof THREE.Color||i instanceof THREE.Vector2||i instanceof THREE.Vector3||i instanceof THREE.Vector4||i instanceof THREE.Matrix4||i instanceof THREE.Texture?s[t][n]=i.clone():i instanceof Array?s[t][n]=i.slice():s[t][n]=i}return s}},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},envMap:{type:"t",value:null},flipEnvMap:{type:"f",value:-1},useRefract:{type:"i",value:0},reflectivity:{type:"f",value:1},refractionRatio:{type:"f",value:.98},combine:{type:"i",value:0
  },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:25e-5},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:[]},spotLightColor:{type:"fv",value:[]},spotLightPosition:{type:"fv",value:[]},spotLightDirection:{type:"fv",value:[]},spotLightDistance:{type:"fv1",value:[]},spotLightAngleCos:{type:"fv1",value:[]},spotLightExponent:{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},fogDensity:{type:"f",value:25e-5},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={depth:{uniforms:{mNear:{type:"f",value:1},mFar:{type:"f",value:2e3},opacity:{type:"f",value:1}},vertexShader:["void main() {","gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),fragmentShader:["uniform float mNear;","uniform float mFar;","uniform float opacity;","void main() {","float depth = gl_FragCoord.z / gl_FragCoord.w;","float color = 1.0 - smoothstep( mNear, mFar, depth );","gl_FragColor = vec4( vec3( color ), opacity );","}"].join("\n")},normal:{uniforms:{opacity:{type:"f",value:1}},vertexShader:["varying vec3 vNormal;"
  ,"void main() {","vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );","vNormal = normalize( normalMatrix * normal );","gl_Position = projectionMatrix * mvPosition;","}"].join("\n"),fragmentShader:["uniform float opacity;","varying vec3 vNormal;","void main() {","gl_FragColor = vec4( 0.5 * normalize( vNormal ) + 0.5, opacity );","}"].join("\n")},basic:{uniforms:THREE.UniformsUtils.merge([THREE.UniformsLib.common,THREE.UniformsLib.fog,THREE.UniformsLib.shadowmap]),vertexShader:[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,"void main() {",THREE.ShaderChunk.map_vertex,THREE.ShaderChunk.lightmap_vertex,THREE.ShaderChunk.color_vertex,"#ifdef USE_ENVMAP",THREE.ShaderChunk.morphnormal_vertex,THREE.ShaderChunk.skinbase_vertex,THREE.ShaderChunk.skinnormal_vertex,THREE.ShaderChunk.defaultnormal_vertex
  ,"#endif",THREE.ShaderChunk.morphtarget_vertex,THREE.ShaderChunk.skinning_vertex,THREE.ShaderChunk.default_vertex,THREE.ShaderChunk.worldpos_vertex,THREE.ShaderChunk.envmap_vertex,THREE.ShaderChunk.shadowmap_vertex,"}"].join("\n"),fragmentShader:["uniform vec3 diffuse;","uniform float opacity;",THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_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,"void main() {","gl_FragColor = vec4( diffuse, opacity );",THREE.ShaderChunk.map_fragment,THREE.ShaderChunk.alphatest_fragment,THREE.ShaderChunk.specularmap_fragment,THREE.ShaderChunk.lightmap_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.envmap_fragment,THREE.ShaderChunk.shadowmap_fragment,THREE.ShaderChunk.linear_to_gamma_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n")},lambert:{uniforms:THREE.UniformsUtils.merge([THREE.UniformsLib
  .common,THREE.UniformsLib.fog,THREE.UniformsLib.lights,THREE.UniformsLib.shadowmap,{ambient:{type:"c",value:new THREE.Color(16777215)},emissive:{type:"c",value:new THREE.Color(0)},wrapRGB:{type:"v3",value:new THREE.Vector3(1,1,1)}}]),vertexShader:["#define LAMBERT","varying vec3 vLightFront;","#ifdef DOUBLE_SIDED","varying vec3 vLightBack;","#endif",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,"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.worldpos_vertex,THREE.ShaderChunk.envmap_vertex,THREE.ShaderChunk.lights_lambert_vertex,THREE.ShaderChunk.shadowmap_vertex,"}"].join("\n"),fragmentShader:["uniform float opacity;","varying vec3 vLightFront;","#ifdef DOUBLE_SIDED","varying vec3 vLightBack;","#endif",THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_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,"void main() {","gl_FragColor = vec4( vec3 ( 1.0 ), opacity );",THREE.ShaderChunk.map_fragment,THREE.ShaderChunk.alphatest_fragment,THREE.ShaderChunk.specularmap_fragment,"#ifdef DOUBLE_SIDED","if ( gl_FrontFacing )","gl_FragColor.xyz *= vLightFront;","else","gl_FragColor.xyz *= vLightBack;","#else","gl_FragColor.xyz *= vLightFront;","#endif",THREE.ShaderChunk.lightmap_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.envmap_fragment,THREE.ShaderChunk.shadowmap_fragment
  ,THREE.ShaderChunk.linear_to_gamma_fragment,THREE.ShaderChunk.fog_fragment,"}"].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,{ambient:{type:"c",value:new THREE.Color(16777215)},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","varying vec3 vViewPosition;","varying vec3 vNormal;",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,"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,"vNormal = normalize( transformedNormal );",THREE.ShaderChunk.morphtarget_vertex,THREE.ShaderChunk.skinning_vertex,THREE.ShaderChunk.default_vertex,"vViewPosition = -mvPosition.xyz;",THREE.ShaderChunk.worldpos_vertex,THREE.ShaderChunk.envmap_vertex,THREE.ShaderChunk.lights_phong_vertex,THREE.ShaderChunk.shadowmap_vertex,"}"].join("\n"),fragmentShader:["uniform vec3 diffuse;","uniform float opacity;","uniform vec3 ambient;","uniform vec3 emissive;","uniform vec3 specular;","uniform float shininess;",THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_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
  ,"void main() {","gl_FragColor = vec4( vec3 ( 1.0 ), opacity );",THREE.ShaderChunk.map_fragment,THREE.ShaderChunk.alphatest_fragment,THREE.ShaderChunk.specularmap_fragment,THREE.ShaderChunk.lights_phong_fragment,THREE.ShaderChunk.lightmap_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.envmap_fragment,THREE.ShaderChunk.shadowmap_fragment,THREE.ShaderChunk.linear_to_gamma_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n")},particle_basic:{uniforms:THREE.UniformsUtils.merge([THREE.UniformsLib.particle,THREE.UniformsLib.shadowmap]),vertexShader:["uniform float size;","uniform float scale;",THREE.ShaderChunk.color_pars_vertex,THREE.ShaderChunk.shadowmap_pars_vertex,"void main() {",THREE.ShaderChunk.color_vertex,"vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );","#ifdef USE_SIZEATTENUATION","gl_PointSize = size * ( scale / length( mvPosition.xyz ) );","#else","gl_PointSize = size;","#endif","gl_Position = projectionMatrix * mvPosition;",THREE.ShaderChunk.worldpos_vertex,THREE.ShaderChunk.
  shadowmap_vertex,"}"].join("\n"),fragmentShader:["uniform vec3 psColor;","uniform float opacity;",THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_particle_pars_fragment,THREE.ShaderChunk.fog_pars_fragment,THREE.ShaderChunk.shadowmap_pars_fragment,"void main() {","gl_FragColor = vec4( psColor, opacity );",THREE.ShaderChunk.map_particle_fragment,THREE.ShaderChunk.alphatest_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.shadowmap_fragment,THREE.ShaderChunk.fog_fragment,"}"].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;","attribute float lineDistance;","varying float vLineDistance;",THREE.ShaderChunk.color_pars_vertex,"void main() {",THREE.ShaderChunk.color_vertex,"vLineDistance = scale * lineDistance;","vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );","gl_Position = projectionMatrix * mvPosition;","}"]
  .join("\n"),fragmentShader:["uniform vec3 diffuse;","uniform float opacity;","uniform float dashSize;","uniform float totalSize;","varying float vLineDistance;",THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.fog_pars_fragment,"void main() {","if ( mod( vLineDistance, totalSize ) > dashSize ) {","discard;","}","gl_FragColor = vec4( diffuse, opacity );",THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n")},depthRGBA:{uniforms:{},vertexShader:[THREE.ShaderChunk.morphtarget_pars_vertex,THREE.ShaderChunk.skinning_pars_vertex,"void main() {",THREE.ShaderChunk.skinbase_vertex,THREE.ShaderChunk.morphtarget_vertex,THREE.ShaderChunk.skinning_vertex,THREE.ShaderChunk.default_vertex,"}"].join("\n"),fragmentShader:["vec4 pack_depth( const in float depth ) {","const vec4 bit_shift = vec4( 256.0 * 256.0 * 256.0, 256.0 * 256.0, 256.0, 1.0 );","const vec4 bit_mask  = vec4( 0.0, 1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0 );","vec4 res = fract( depth * bit_shift );","res -= res.xxyz * bit_mask;","return res;"
  ,"}","void main() {","gl_FragData[ 0 ] = pack_depth( gl_FragCoord.z );","}"].join("\n")}},THREE.WebGLRenderer=function(e){function st(e){e.__webglVertexBuffer=V.createBuffer(),e.__webglColorBuffer=V.createBuffer(),l.info.memory.geometries++}function ot(e){e.__webglVertexBuffer=V.createBuffer(),e.__webglColorBuffer=V.createBuffer(),e.__webglLineDistanceBuffer=V.createBuffer(),l.info.memory.geometries++}function ut(e){e.__webglVertexBuffer=V.createBuffer(),e.__webglColorBuffer=V.createBuffer(),e.__webglNormalBuffer=V.createBuffer(),l.info.memory.geometries++}function at(e){e.__webglVertexBuffer=V.createBuffer(),e.__webglNormalBuffer=V.createBuffer(),e.__webglTangentBuffer=V.createBuffer(),e.__webglColorBuffer=V.createBuffer(),e.__webglUVBuffer=V.createBuffer(),e.__webglUV2Buffer=V.createBuffer(),e.__webglSkinIndicesBuffer=V.createBuffer(),e.__webglSkinWeightsBuffer=V.createBuffer(),e.__webglFaceBuffer=V.createBuffer(),e.__webglLineBuffer=V.createBuffer();var t,n;if(e.numMorphTargets){e.__webglMorphTargetsBuffers=
  [];for(t=0,n=e.numMorphTargets;t<n;t++)e.__webglMorphTargetsBuffers.push(V.createBuffer())}if(e.numMorphNormals){e.__webglMorphNormalsBuffers=[];for(t=0,n=e.numMorphNormals;t<n;t++)e.__webglMorphNormalsBuffers.push(V.createBuffer())}l.info.memory.geometries++}function ft(e){V.deleteBuffer(e.__webglVertexBuffer),V.deleteBuffer(e.__webglColorBuffer),pt(e),l.info.memory.geometries--}function lt(e){V.deleteBuffer(e.__webglVertexBuffer),V.deleteBuffer(e.__webglColorBuffer),V.deleteBuffer(e.__webglLineDistanceBuffer),pt(e),l.info.memory.geometries--}function ct(e){V.deleteBuffer(e.__webglVertexBuffer),V.deleteBuffer(e.__webglColorBuffer),V.deleteBuffer(e.__webglNormalBuffer),pt(e),l.info.memory.geometries--}function ht(e){V.deleteBuffer(e.__webglVertexBuffer),V.deleteBuffer(e.__webglNormalBuffer),V.deleteBuffer(e.__webglTangentBuffer),V.deleteBuffer(e.__webglColorBuffer),V.deleteBuffer(e.__webglUVBuffer),V.deleteBuffer(e.__webglUV2Buffer),V.deleteBuffer(e.__webglSkinIndicesBuffer),V.deleteBuffer(e.__webglSkinWeightsBuffer
  ),V.deleteBuffer(e.__webglFaceBuffer),V.deleteBuffer(e.__webglLineBuffer);var t,n;if(e.numMorphTargets)for(t=0,n=e.numMorphTargets;t<n;t++)V.deleteBuffer(e.__webglMorphTargetsBuffers[t]);if(e.numMorphNormals)for(t=0,n=e.numMorphNormals;t<n;t++)V.deleteBuffer(e.__webglMorphNormalsBuffers[t]);pt(e),l.info.memory.geometries--}function pt(e){if(e.__webglCustomAttributesList)for(var t in e.__webglCustomAttributesList)V.deleteBuffer(e.__webglCustomAttributesList[t].buffer)}function dt(e,t){var n=e.vertices.length,r=t.material;if(r.attributes){e.__webglCustomAttributesList===undefined&&(e.__webglCustomAttributesList=[]);for(var i in r.attributes){var s=r.attributes[i];if(!s.__webglInitialized||s.createUniqueBuffers){s.__webglInitialized=!0;var o=1;s.type==="v2"?o=2:s.type==="v3"?o=3:s.type==="v4"?o=4:s.type==="c"&&(o=3),s.size=o,s.array=new Float32Array(n*o),s.buffer=V.createBuffer(),s.buffer.belongsToAttribute=i,s.needsUpdate=!0}e.__webglCustomAttributesList.push(s)}}}function vt(e,t){var n=e.vertices.length;e.__vertexArray=new 
  Float32Array(n*3),e.__colorArray=new Float32Array(n*3),e.__sortArray=[],e.__webglParticleCount=n,dt(e,t)}function mt(e,t){var n=e.vertices.length;e.__vertexArray=new Float32Array(n*3),e.__colorArray=new Float32Array(n*3),e.__lineDistanceArray=new Float32Array(n*1),e.__webglLineCount=n,dt(e,t)}function gt(e,t){var n=e.vertices.length;e.__vertexArray=new Float32Array(n*3),e.__colorArray=new Float32Array(n*3),e.__normalArray=new Float32Array(n*3),e.__webglVertexCount=n,dt(e,t)}function yt(e,t){var n=t.geometry,r=e.faces3,i=e.faces4,s=r.length*3+i.length*4,o=r.length*1+i.length*2,u=r.length*3+i.length*4,a=bt(t,e),f=xt(a),l=Et(a),c=St(a);e.__vertexArray=new Float32Array(s*3),l&&(e.__normalArray=new Float32Array(s*3)),n.hasTangents&&(e.__tangentArray=new Float32Array(s*4)),c&&(e.__colorArray=new Float32Array(s*3));if(f){if(n.faceUvs.length>0||n.faceVertexUvs.length>0)e.__uvArray=new Float32Array(s*2);if(n.faceUvs.length>1||n.faceVertexUvs.length>1)e.__uv2Array=new Float32Array(s*2)}t.geometry.skinWeights.length&&t.geometry
  .skinIndices.length&&(e.__skinIndexArray=new Float32Array(s*4),e.__skinWeightArray=new Float32Array(s*4)),e.__faceArray=new Uint16Array(o*3),e.__lineArray=new Uint16Array(u*2);var h,p;if(e.numMorphTargets){e.__morphTargetsArrays=[];for(h=0,p=e.numMorphTargets;h<p;h++)e.__morphTargetsArrays.push(new Float32Array(s*3))}if(e.numMorphNormals){e.__morphNormalsArrays=[];for(h=0,p=e.numMorphNormals;h<p;h++)e.__morphNormalsArrays.push(new Float32Array(s*3))}e.__webglFaceCount=o*3,e.__webglLineCount=u*2;if(a.attributes){e.__webglCustomAttributesList===undefined&&(e.__webglCustomAttributesList=[]);for(var d in a.attributes){var v=a.attributes[d],m={};for(var g in v)m[g]=v[g];if(!m.__webglInitialized||m.createUniqueBuffers){m.__webglInitialized=!0;var y=1;m.type==="v2"?y=2:m.type==="v3"?y=3:m.type==="v4"?y=4:m.type==="c"&&(y=3),m.size=y,m.array=new Float32Array(s*y),m.buffer=V.createBuffer(),m.buffer.belongsToAttribute=d,v.needsUpdate=!0,m.__original=v}e.__webglCustomAttributesList.push(m)}}e.__inittedArrays=!0}function bt
  (e,t){return e.material instanceof THREE.MeshFaceMaterial?e.material.materials[t.materialIndex]:e.material}function wt(e){return e&&e.shading!==undefined&&e.shading===THREE.SmoothShading}function Et(e){return e instanceof THREE.MeshBasicMaterial&&!e.envMap||e instanceof THREE.MeshDepthMaterial?!1:wt(e)?THREE.SmoothShading:THREE.FlatShading}function St(e){return e.vertexColors?e.vertexColors:!1}function xt(e){return e.map||e.lightMap||e.bumpMap||e.normalMap||e.specularMap||e instanceof THREE.ShaderMaterial?!0:!1}function Tt(e){var t,n,r;for(t in e.attributes)t==="index"?r=V.ELEMENT_ARRAY_BUFFER:r=V.ARRAY_BUFFER,n=e.attributes[t],n.buffer=V.createBuffer(),V.bindBuffer(r,n.buffer),V.bufferData(r,n.array,V.STATIC_DRAW)}function Nt(e,t,n){var r,i,s,o,u,a,f=e.vertices,l=f.length,c=e.colors,h=c.length,p=e.__vertexArray,d=e.__colorArray,v=e.__sortArray,m=e.verticesNeedUpdate,g=e.elementsNeedUpdate,y=e.colorsNeedUpdate,b=e.__webglCustomAttributesList,w,E,S,x,T,N,C;if(n.sortParticles){R.copy(q),R.multiplySelf(n.matrixWorld
  );for(r=0;r<l;r++)s=f[r],U.copy(s),R.multiplyVector3(U),v[r]=[U.z,r];v.sort(function(e,t){return t[0]-e[0]});for(r=0;r<l;r++)s=f[v[r][1]],o=r*3,p[o]=s.x,p[o+1]=s.y,p[o+2]=s.z;for(i=0;i<h;i++)o=i*3,a=c[v[i][1]],d[o]=a.r,d[o+1]=a.g,d[o+2]=a.b;if(b)for(w=0,E=b.length;w<E;w++){C=b[w];if(C.boundTo!==undefined&&C.boundTo!=="vertices")continue;o=0,T=C.value.length;if(C.size===1)for(x=0;x<T;x++)u=v[x][1],C.array[x]=C.value[u];else if(C.size===2)for(x=0;x<T;x++)u=v[x][1],N=C.value[u],C.array[o]=N.x,C.array[o+1]=N.y,o+=2;else if(C.size===3)if(C.type==="c")for(x=0;x<T;x++)u=v[x][1],N=C.value[u],C.array[o]=N.r,C.array[o+1]=N.g,C.array[o+2]=N.b,o+=3;else for(x=0;x<T;x++)u=v[x][1],N=C.value[u],C.array[o]=N.x,C.array[o+1]=N.y,C.array[o+2]=N.z,o+=3;else if(C.size===4)for(x=0;x<T;x++)u=v[x][1],N=C.value[u],C.array[o]=N.x,C.array[o+1]=N.y,C.array[o+2]=N.z,C.array[o+3]=N.w,o+=4}}else{if(m)for(r=0;r<l;r++)s=f[r],o=r*3,p[o]=s.x,p[o+1]=s.y,p[o+2]=s.z;if(y)for(i=0;i<h;i++)a=c[i],o=i*3,d[o]=a.r,d[o+1]=a.g,d[o+2]=a.b;if(b)for(w=0,E=b.
  length;w<E;w++){C=b[w];if(C.needsUpdate&&(C.boundTo===undefined||C.boundTo==="vertices")){T=C.value.length,o=0;if(C.size===1)for(x=0;x<T;x++)C.array[x]=C.value[x];else if(C.size===2)for(x=0;x<T;x++)N=C.value[x],C.array[o]=N.x,C.array[o+1]=N.y,o+=2;else if(C.size===3)if(C.type==="c")for(x=0;x<T;x++)N=C.value[x],C.array[o]=N.r,C.array[o+1]=N.g,C.array[o+2]=N.b,o+=3;else for(x=0;x<T;x++)N=C.value[x],C.array[o]=N.x,C.array[o+1]=N.y,C.array[o+2]=N.z,o+=3;else if(C.size===4)for(x=0;x<T;x++)N=C.value[x],C.array[o]=N.x,C.array[o+1]=N.y,C.array[o+2]=N.z,C.array[o+3]=N.w,o+=4}}}if(m||n.sortParticles)V.bindBuffer(V.ARRAY_BUFFER,e.__webglVertexBuffer),V.bufferData(V.ARRAY_BUFFER,p,t);if(y||n.sortParticles)V.bindBuffer(V.ARRAY_BUFFER,e.__webglColorBuffer),V.bufferData(V.ARRAY_BUFFER,d,t);if(b)for(w=0,E=b.length;w<E;w++){C=b[w];if(C.needsUpdate||n.sortParticles)V.bindBuffer(V.ARRAY_BUFFER,C.buffer),V.bufferData(V.ARRAY_BUFFER,C.array,t)}}function Ct(e,t){var n,r,i,s,o,u,a=e.vertices,f=e.colors,l=e.lineDistances,c=a.length,h=
  f.length,p=l.length,d=e.__vertexArray,v=e.__colorArray,m=e.__lineDistanceArray,g=e.verticesNeedUpdate,y=e.colorsNeedUpdate,b=e.lineDistancesNeedUpdate,w=e.__webglCustomAttributesList,E,S,x,T,N,C,k;if(g){for(n=0;n<c;n++)s=a[n],o=n*3,d[o]=s.x,d[o+1]=s.y,d[o+2]=s.z;V.bindBuffer(V.ARRAY_BUFFER,e.__webglVertexBuffer),V.bufferData(V.ARRAY_BUFFER,d,t)}if(y){for(r=0;r<h;r++)u=f[r],o=r*3,v[o]=u.r,v[o+1]=u.g,v[o+2]=u.b;V.bindBuffer(V.ARRAY_BUFFER,e.__webglColorBuffer),V.bufferData(V.ARRAY_BUFFER,v,t)}if(b){for(i=0;i<p;i++)m[i]=l[i];V.bindBuffer(V.ARRAY_BUFFER,e.__webglLineDistanceBuffer),V.bufferData(V.ARRAY_BUFFER,m,t)}if(w)for(E=0,S=w.length;E<S;E++){k=w[E];if(k.needsUpdate&&(k.boundTo===undefined||k.boundTo==="vertices")){o=0,N=k.value.length;if(k.size===1)for(T=0;T<N;T++)k.array[T]=k.value[T];else if(k.size===2)for(T=0;T<N;T++)C=k.value[T],k.array[o]=C.x,k.array[o+1]=C.y,o+=2;else if(k.size===3)if(k.type==="c")for(T=0;T<N;T++)C=k.value[T],k.array[o]=C.r,k.array[o+1]=C.g,k.array[o+2]=C.b,o+=3;else for(T=0;T<N;T++)C=k
  .value[T],k.array[o]=C.x,k.array[o+1]=C.y,k.array[o+2]=C.z,o+=3;else if(k.size===4)for(T=0;T<N;T++)C=k.value[T],k.array[o]=C.x,k.array[o+1]=C.y,k.array[o+2]=C.z,k.array[o+3]=C.w,o+=4;V.bindBuffer(V.ARRAY_BUFFER,k.buffer),V.bufferData(V.ARRAY_BUFFER,k.array,t)}}}function kt(e,t){var n,r,i,s,o,u,a,f,l,c,h,p,d,v=e.vertices,m=e.colors,g=e.normals,y=v.length,b=m.length,w=g.length,E=e.__vertexArray,S=e.__colorArray,x=e.__normalArray,T=e.verticesNeedUpdate,N=e.colorsNeedUpdate,C=e.normalsNeedUpdate,k=e.__webglCustomAttributesList;if(T){for(n=0;n<y;n++)s=v[n],o=n*3,E[o]=s.x,E[o+1]=s.y,E[o+2]=s.z;V.bindBuffer(V.ARRAY_BUFFER,e.__webglVertexBuffer),V.bufferData(V.ARRAY_BUFFER,E,t)}if(N){for(r=0;r<b;r++)u=m[r],o=r*3,S[o]=u.r,S[o+1]=u.g,S[o+2]=u.b;V.bindBuffer(V.ARRAY_BUFFER,e.__webglColorBuffer),V.bufferData(V.ARRAY_BUFFER,S,t)}if(C){for(i=0;i<w;i++)a=g[i],o=i*3,x[o]=a.x,x[o+1]=a.y,x[o+2]=a.z;V.bindBuffer(V.ARRAY_BUFFER,e.__webglNormalBuffer),V.bufferData(V.ARRAY_BUFFER,x,t)}if(k)for(f=0,l=k.length;f<l;f++){p=k[f];if(p.needsUpdate&&
  (p.boundTo===undefined||p.boundTo==="vertices")){o=0,h=p.value.length;if(p.size===1)for(c=0;c<h;c++)p.array[c]=p.value[c];else if(p.size===2)for(c=0;c<h;c++)d=p.value[c],p.array[o]=d.x,p.array[o+1]=d.y,o+=2;else if(p.size===3)if(p.type==="c")for(c=0;c<h;c++)d=p.value[c],p.array[o]=d.r,p.array[o+1]=d.g,p.array[o+2]=d.b,o+=3;else for(c=0;c<h;c++)d=p.value[c],p.array[o]=d.x,p.array[o+1]=d.y,p.array[o+2]=d.z,o+=3;else if(p.size===4)for(c=0;c<h;c++)d=p.value[c],p.array[o]=d.x,p.array[o+1]=d.y,p.array[o+2]=d.z,p.array[o+3]=d.w,o+=4;V.bindBuffer(V.ARRAY_BUFFER,p.buffer),V.bufferData(V.ARRAY_BUFFER,p.array,t)}}}function Lt(e,t,n,r,i){if(!e.__inittedArrays)return;var s=Et(i),o=St(i),u=xt(i),a=s===THREE.SmoothShading,f,l,c,h,p,d,v,m,g,y,b,w,E,S,x,T,N,C,k,L,A,O,M,_,D,P,H,B,j,F,I,q,R,U,z,W,X,$,J,K,Q,G,Y,Z,et,tt,nt,rt,it,st,ot,ut,at,ft,lt,ct,ht,pt,dt=0,vt=0,mt=0,gt=0,yt=0,bt=0,wt=0,Tt=0,Nt=0,Ct=0,kt=0,Lt=0,At=0,Ot,Mt=e.__vertexArray,_t=e.__uvArray,Dt=e.__uv2Array,Pt=e.__normalArray,Ht=e.__tangentArray,Bt=e.__colorArray,jt=
  e.__skinIndexArray,Ft=e.__skinWeightArray,It=e.__morphTargetsArrays,qt=e.__morphNormalsArrays,Rt=e.__webglCustomAttributesList,Ut,zt=e.__faceArray,Wt=e.__lineArray,Xt=t.geometry,Vt=Xt.verticesNeedUpdate,$t=Xt.elementsNeedUpdate,Jt=Xt.uvsNeedUpdate,Kt=Xt.normalsNeedUpdate,Qt=Xt.tangentsNeedUpdate,Gt=Xt.colorsNeedUpdate,Yt=Xt.morphTargetsNeedUpdate,Zt=Xt.vertices,en=e.faces3,tn=e.faces4,nn=Xt.faces,rn=Xt.faceVertexUvs[0],sn=Xt.faceVertexUvs[1],on=Xt.colors,un=Xt.skinIndices,an=Xt.skinWeights,fn=Xt.morphTargets,ln=Xt.morphNormals;if(Vt){for(f=0,l=en.length;f<l;f++)h=nn[en[f]],E=Zt[h.a],S=Zt[h.b],x=Zt[h.c],Mt[vt]=E.x,Mt[vt+1]=E.y,Mt[vt+2]=E.z,Mt[vt+3]=S.x,Mt[vt+4]=S.y,Mt[vt+5]=S.z,Mt[vt+6]=x.x,Mt[vt+7]=x.y,Mt[vt+8]=x.z,vt+=9;for(f=0,l=tn.length;f<l;f++)h=nn[tn[f]],E=Zt[h.a],S=Zt[h.b],x=Zt[h.c],T=Zt[h.d],Mt[vt]=E.x,Mt[vt+1]=E.y,Mt[vt+2]=E.z,Mt[vt+3]=S.x,Mt[vt+4]=S.y,Mt[vt+5]=S.z,Mt[vt+6]=x.x,Mt[vt+7]=x.y,Mt[vt+8]=x.z,Mt[vt+9]=T.x,Mt[vt+10]=T.y,Mt[vt+11]=T.z,vt+=12;V.bindBuffer(V.ARRAY_BUFFER,e.__webglVertexBuffer),
  V.bufferData(V.ARRAY_BUFFER,Mt,n)}if(Yt)for(ut=0,at=fn.length;ut<at;ut++){kt=0;for(f=0,l=en.length;f<l;f++)ct=en[f],h=nn[ct],E=fn[ut].vertices[h.a],S=fn[ut].vertices[h.b],x=fn[ut].vertices[h.c],ft=It[ut],ft[kt]=E.x,ft[kt+1]=E.y,ft[kt+2]=E.z,ft[kt+3]=S.x,ft[kt+4]=S.y,ft[kt+5]=S.z,ft[kt+6]=x.x,ft[kt+7]=x.y,ft[kt+8]=x.z,i.morphNormals&&(a?(ht=ln[ut].vertexNormals[ct],A=ht.a,O=ht.b,M=ht.c):(A=ln[ut].faceNormals[ct],O=A,M=A),lt=qt[ut],lt[kt]=A.x,lt[kt+1]=A.y,lt[kt+2]=A.z,lt[kt+3]=O.x,lt[kt+4]=O.y,lt[kt+5]=O.z,lt[kt+6]=M.x,lt[kt+7]=M.y,lt[kt+8]=M.z),kt+=9;for(f=0,l=tn.length;f<l;f++)ct=tn[f],h=nn[ct],E=fn[ut].vertices[h.a],S=fn[ut].vertices[h.b],x=fn[ut].vertices[h.c],T=fn[ut].vertices[h.d],ft=It[ut],ft[kt]=E.x,ft[kt+1]=E.y,ft[kt+2]=E.z,ft[kt+3]=S.x,ft[kt+4]=S.y,ft[kt+5]=S.z,ft[kt+6]=x.x,ft[kt+7]=x.y,ft[kt+8]=x.z,ft[kt+9]=T.x,ft[kt+10]=T.y,ft[kt+11]=T.z,i.morphNormals&&(a?(ht=ln[ut].vertexNormals[ct],A=ht.a,O=ht.b,M=ht.c,_=ht.d):(A=ln[ut].faceNormals[ct],O=A,M=A,_=A),lt=qt[ut],lt[kt]=A.x,lt[kt+1]=A.y,lt[kt+2]=A.z,lt
  [kt+3]=O.x,lt[kt+4]=O.y,lt[kt+5]=O.z,lt[kt+6]=M.x,lt[kt+7]=M.y,lt[kt+8]=M.z,lt[kt+9]=_.x,lt[kt+10]=_.y,lt[kt+11]=_.z),kt+=12;V.bindBuffer(V.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[ut]),V.bufferData(V.ARRAY_BUFFER,It[ut],n),i.morphNormals&&(V.bindBuffer(V.ARRAY_BUFFER,e.__webglMorphNormalsBuffers[ut]),V.bufferData(V.ARRAY_BUFFER,qt[ut],n))}if(an.length){for(f=0,l=en.length;f<l;f++)h=nn[en[f]],j=an[h.a],F=an[h.b],I=an[h.c],Ft[Ct]=j.x,Ft[Ct+1]=j.y,Ft[Ct+2]=j.z,Ft[Ct+3]=j.w,Ft[Ct+4]=F.x,Ft[Ct+5]=F.y,Ft[Ct+6]=F.z,Ft[Ct+7]=F.w,Ft[Ct+8]=I.x,Ft[Ct+9]=I.y,Ft[Ct+10]=I.z,Ft[Ct+11]=I.w,R=un[h.a],U=un[h.b],z=un[h.c],jt[Ct]=R.x,jt[Ct+1]=R.y,jt[Ct+2]=R.z,jt[Ct+3]=R.w,jt[Ct+4]=U.x,jt[Ct+5]=U.y,jt[Ct+6]=U.z,jt[Ct+7]=U.w,jt[Ct+8]=z.x,jt[Ct+9]=z.y,jt[Ct+10]=z.z,jt[Ct+11]=z.w,Ct+=12;for(f=0,l=tn.length;f<l;f++)h=nn[tn[f]],j=an[h.a],F=an[h.b],I=an[h.c],q=an[h.d],Ft[Ct]=j.x,Ft[Ct+1]=j.y,Ft[Ct+2]=j.z,Ft[Ct+3]=j.w,Ft[Ct+4]=F.x,Ft[Ct+5]=F.y,Ft[Ct+6]=F.z,Ft[Ct+7]=F.w,Ft[Ct+8]=I.x,Ft[Ct+9]=I.y,Ft[Ct+10]=I.z,Ft[Ct+11]=I.w,Ft[Ct+12]=q.x
  ,Ft[Ct+13]=q.y,Ft[Ct+14]=q.z,Ft[Ct+15]=q.w,R=un[h.a],U=un[h.b],z=un[h.c],W=un[h.d],jt[Ct]=R.x,jt[Ct+1]=R.y,jt[Ct+2]=R.z,jt[Ct+3]=R.w,jt[Ct+4]=U.x,jt[Ct+5]=U.y,jt[Ct+6]=U.z,jt[Ct+7]=U.w,jt[Ct+8]=z.x,jt[Ct+9]=z.y,jt[Ct+10]=z.z,jt[Ct+11]=z.w,jt[Ct+12]=W.x,jt[Ct+13]=W.y,jt[Ct+14]=W.z,jt[Ct+15]=W.w,Ct+=16;Ct>0&&(V.bindBuffer(V.ARRAY_BUFFER,e.__webglSkinIndicesBuffer),V.bufferData(V.ARRAY_BUFFER,jt,n),V.bindBuffer(V.ARRAY_BUFFER,e.__webglSkinWeightsBuffer),V.bufferData(V.ARRAY_BUFFER,Ft,n))}if(Gt&&o){for(f=0,l=en.length;f<l;f++)h=nn[en[f]],m=h.vertexColors,g=h.color,m.length===3&&o===THREE.VertexColors?(D=m[0],P=m[1],H=m[2]):(D=g,P=g,H=g),Bt[Nt]=D.r,Bt[Nt+1]=D.g,Bt[Nt+2]=D.b,Bt[Nt+3]=P.r,Bt[Nt+4]=P.g,Bt[Nt+5]=P.b,Bt[Nt+6]=H.r,Bt[Nt+7]=H.g,Bt[Nt+8]=H.b,Nt+=9;for(f=0,l=tn.length;f<l;f++)h=nn[tn[f]],m=h.vertexColors,g=h.color,m.length===4&&o===THREE.VertexColors?(D=m[0],P=m[1],H=m[2],B=m[3]):(D=g,P=g,H=g,B=g),Bt[Nt]=D.r,Bt[Nt+1]=D.g,Bt[Nt+2]=D.b,Bt[Nt+3]=P.r,Bt[Nt+4]=P.g,Bt[Nt+5]=P.b,Bt[Nt+6]=H.r,Bt[Nt+7]=H.g,Bt[Nt+8]=
  H.b,Bt[Nt+9]=B.r,Bt[Nt+10]=B.g,Bt[Nt+11]=B.b,Nt+=12;Nt>0&&(V.bindBuffer(V.ARRAY_BUFFER,e.__webglColorBuffer),V.bufferData(V.ARRAY_BUFFER,Bt,n))}if(Qt&&Xt.hasTangents){for(f=0,l=en.length;f<l;f++)h=nn[en[f]],y=h.vertexTangents,N=y[0],C=y[1],k=y[2],Ht[wt]=N.x,Ht[wt+1]=N.y,Ht[wt+2]=N.z,Ht[wt+3]=N.w,Ht[wt+4]=C.x,Ht[wt+5]=C.y,Ht[wt+6]=C.z,Ht[wt+7]=C.w,Ht[wt+8]=k.x,Ht[wt+9]=k.y,Ht[wt+10]=k.z,Ht[wt+11]=k.w,wt+=12;for(f=0,l=tn.length;f<l;f++)h=nn[tn[f]],y=h.vertexTangents,N=y[0],C=y[1],k=y[2],L=y[3],Ht[wt]=N.x,Ht[wt+1]=N.y,Ht[wt+2]=N.z,Ht[wt+3]=N.w,Ht[wt+4]=C.x,Ht[wt+5]=C.y,Ht[wt+6]=C.z,Ht[wt+7]=C.w,Ht[wt+8]=k.x,Ht[wt+9]=k.y,Ht[wt+10]=k.z,Ht[wt+11]=k.w,Ht[wt+12]=L.x,Ht[wt+13]=L.y,Ht[wt+14]=L.z,Ht[wt+15]=L.w,wt+=16;V.bindBuffer(V.ARRAY_BUFFER,e.__webglTangentBuffer),V.bufferData(V.ARRAY_BUFFER,Ht,n)}if(Kt&&s){for(f=0,l=en.length;f<l;f++){h=nn[en[f]],p=h.vertexNormals,d=h.normal;if(p.length===3&&a)for(nt=0;nt<3;nt++)it=p[nt],Pt[bt]=it.x,Pt[bt+1]=it.y,Pt[bt+2]=it.z,bt+=3;else for(nt=0;nt<3;nt++)Pt[bt]=d.x,Pt[bt+1]=d.y,Pt
  [bt+2]=d.z,bt+=3}for(f=0,l=tn.length;f<l;f++){h=nn[tn[f]],p=h.vertexNormals,d=h.normal;if(p.length===4&&a)for(nt=0;nt<4;nt++)it=p[nt],Pt[bt]=it.x,Pt[bt+1]=it.y,Pt[bt+2]=it.z,bt+=3;else for(nt=0;nt<4;nt++)Pt[bt]=d.x,Pt[bt+1]=d.y,Pt[bt+2]=d.z,bt+=3}V.bindBuffer(V.ARRAY_BUFFER,e.__webglNormalBuffer),V.bufferData(V.ARRAY_BUFFER,Pt,n)}if(Jt&&rn&&u){for(f=0,l=en.length;f<l;f++){c=en[f],b=rn[c];if(b===undefined)continue;for(nt=0;nt<3;nt++)st=b[nt],_t[mt]=st.u,_t[mt+1]=st.v,mt+=2}for(f=0,l=tn.length;f<l;f++){c=tn[f],b=rn[c];if(b===undefined)continue;for(nt=0;nt<4;nt++)st=b[nt],_t[mt]=st.u,_t[mt+1]=st.v,mt+=2}mt>0&&(V.bindBuffer(V.ARRAY_BUFFER,e.__webglUVBuffer),V.bufferData(V.ARRAY_BUFFER,_t,n))}if(Jt&&sn&&u){for(f=0,l=en.length;f<l;f++){c=en[f],w=sn[c];if(w===undefined)continue;for(nt=0;nt<3;nt++)ot=w[nt],Dt[gt]=ot.u,Dt[gt+1]=ot.v,gt+=2}for(f=0,l=tn.length;f<l;f++){c=tn[f],w=sn[c];if(w===undefined)continue;for(nt=0;nt<4;nt++)ot=w[nt],Dt[gt]=ot.u,Dt[gt+1]=ot.v,gt+=2}gt>0&&(V.bindBuffer(V.ARRAY_BUFFER,e.__webglUV2Buffer
  ),V.bufferData(V.ARRAY_BUFFER,Dt,n))}if($t){for(f=0,l=en.length;f<l;f++)zt[yt]=dt,zt[yt+1]=dt+1,zt[yt+2]=dt+2,yt+=3,Wt[Tt]=dt,Wt[Tt+1]=dt+1,Wt[Tt+2]=dt,Wt[Tt+3]=dt+2,Wt[Tt+4]=dt+1,Wt[Tt+5]=dt+2,Tt+=6,dt+=3;for(f=0,l=tn.length;f<l;f++)zt[yt]=dt,zt[yt+1]=dt+1,zt[yt+2]=dt+3,zt[yt+3]=dt+1,zt[yt+4]=dt+2,zt[yt+5]=dt+3,yt+=6,Wt[Tt]=dt,Wt[Tt+1]=dt+1,Wt[Tt+2]=dt,Wt[Tt+3]=dt+3,Wt[Tt+4]=dt+1,Wt[Tt+5]=dt+2,Wt[Tt+6]=dt+2,Wt[Tt+7]=dt+3,Tt+=8,dt+=4;V.bindBuffer(V.ELEMENT_ARRAY_BUFFER,e.__webglFaceBuffer),V.bufferData(V.ELEMENT_ARRAY_BUFFER,zt,n),V.bindBuffer(V.ELEMENT_ARRAY_BUFFER,e.__webglLineBuffer),V.bufferData(V.ELEMENT_ARRAY_BUFFER,Wt,n)}if(Rt)for(nt=0,rt=Rt.length;nt<rt;nt++){Ut=Rt[nt];if(!Ut.__original.needsUpdate)continue;Lt=0,At=0;if(Ut.size===1){if(Ut.boundTo===undefined||Ut.boundTo==="vertices"){for(f=0,l=en.length;f<l;f++)h=nn[en[f]],Ut.array[Lt]=Ut.value[h.a],Ut.array[Lt+1]=Ut.value[h.b],Ut.array[Lt+2]=Ut.value[h.c],Lt+=3;for(f=0,l=tn.length;f<l;f++)h=nn[tn[f]],Ut.array[Lt]=Ut.value[h.a],Ut.array[Lt+1]=Ut.value[
  h.b],Ut.array[Lt+2]=Ut.value[h.c],Ut.array[Lt+3]=Ut.value[h.d],Lt+=4}else if(Ut.boundTo==="faces"){for(f=0,l=en.length;f<l;f++)Ot=Ut.value[en[f]],Ut.array[Lt]=Ot,Ut.array[Lt+1]=Ot,Ut.array[Lt+2]=Ot,Lt+=3;for(f=0,l=tn.length;f<l;f++)Ot=Ut.value[tn[f]],Ut.array[Lt]=Ot,Ut.array[Lt+1]=Ot,Ut.array[Lt+2]=Ot,Ut.array[Lt+3]=Ot,Lt+=4}}else if(Ut.size===2){if(Ut.boundTo===undefined||Ut.boundTo==="vertices"){for(f=0,l=en.length;f<l;f++)h=nn[en[f]],E=Ut.value[h.a],S=Ut.value[h.b],x=Ut.value[h.c],Ut.array[Lt]=E.x,Ut.array[Lt+1]=E.y,Ut.array[Lt+2]=S.x,Ut.array[Lt+3]=S.y,Ut.array[Lt+4]=x.x,Ut.array[Lt+5]=x.y,Lt+=6;for(f=0,l=tn.length;f<l;f++)h=nn[tn[f]],E=Ut.value[h.a],S=Ut.value[h.b],x=Ut.value[h.c],T=Ut.value[h.d],Ut.array[Lt]=E.x,Ut.array[Lt+1]=E.y,Ut.array[Lt+2]=S.x,Ut.array[Lt+3]=S.y,Ut.array[Lt+4]=x.x,Ut.array[Lt+5]=x.y,Ut.array[Lt+6]=T.x,Ut.array[Lt+7]=T.y,Lt+=8}else if(Ut.boundTo==="faces"){for(f=0,l=en.length;f<l;f++)Ot=Ut.value[en[f]],E=Ot,S=Ot,x=Ot,Ut.array[Lt]=E.x,Ut.array[Lt+1]=E.y,Ut.array[Lt+2]=S.x,Ut.array[Lt+3
  ]=S.y,Ut.array[Lt+4]=x.x,Ut.array[Lt+5]=x.y,Lt+=6;for(f=0,l=tn.length;f<l;f++)Ot=Ut.value[tn[f]],E=Ot,S=Ot,x=Ot,T=Ot,Ut.array[Lt]=E.x,Ut.array[Lt+1]=E.y,Ut.array[Lt+2]=S.x,Ut.array[Lt+3]=S.y,Ut.array[Lt+4]=x.x,Ut.array[Lt+5]=x.y,Ut.array[Lt+6]=T.x,Ut.array[Lt+7]=T.y,Lt+=8}}else if(Ut.size===3){var cn;Ut.type==="c"?cn=["r","g","b"]:cn=["x","y","z"];if(Ut.boundTo===undefined||Ut.boundTo==="vertices"){for(f=0,l=en.length;f<l;f++)h=nn[en[f]],E=Ut.value[h.a],S=Ut.value[h.b],x=Ut.value[h.c],Ut.array[Lt]=E[cn[0]],Ut.array[Lt+1]=E[cn[1]],Ut.array[Lt+2]=E[cn[2]],Ut.array[Lt+3]=S[cn[0]],Ut.array[Lt+4]=S[cn[1]],Ut.array[Lt+5]=S[cn[2]],Ut.array[Lt+6]=x[cn[0]],Ut.array[Lt+7]=x[cn[1]],Ut.array[Lt+8]=x[cn[2]],Lt+=9;for(f=0,l=tn.length;f<l;f++)h=nn[tn[f]],E=Ut.value[h.a],S=Ut.value[h.b],x=Ut.value[h.c],T=Ut.value[h.d],Ut.array[Lt]=E[cn[0]],Ut.array[Lt+1]=E[cn[1]],Ut.array[Lt+2]=E[cn[2]],Ut.array[Lt+3]=S[cn[0]],Ut.array[Lt+4]=S[cn[1]],Ut.array[Lt+5]=S[cn[2]],Ut.array[Lt+6]=x[cn[0]],Ut.array[Lt+7]=x[cn[1]],Ut.array[Lt+8]=x[cn[2
  ]],Ut.array[Lt+9]=T[cn[0]],Ut.array[Lt+10]=T[cn[1]],Ut.array[Lt+11]=T[cn[2]],Lt+=12}else if(Ut.boundTo==="faces"){for(f=0,l=en.length;f<l;f++)Ot=Ut.value[en[f]],E=Ot,S=Ot,x=Ot,Ut.array[Lt]=E[cn[0]],Ut.array[Lt+1]=E[cn[1]],Ut.array[Lt+2]=E[cn[2]],Ut.array[Lt+3]=S[cn[0]],Ut.array[Lt+4]=S[cn[1]],Ut.array[Lt+5]=S[cn[2]],Ut.array[Lt+6]=x[cn[0]],Ut.array[Lt+7]=x[cn[1]],Ut.array[Lt+8]=x[cn[2]],Lt+=9;for(f=0,l=tn.length;f<l;f++)Ot=Ut.value[tn[f]],E=Ot,S=Ot,x=Ot,T=Ot,Ut.array[Lt]=E[cn[0]],Ut.array[Lt+1]=E[cn[1]],Ut.array[Lt+2]=E[cn[2]],Ut.array[Lt+3]=S[cn[0]],Ut.array[Lt+4]=S[cn[1]],Ut.array[Lt+5]=S[cn[2]],Ut.array[Lt+6]=x[cn[0]],Ut.array[Lt+7]=x[cn[1]],Ut.array[Lt+8]=x[cn[2]],Ut.array[Lt+9]=T[cn[0]],Ut.array[Lt+10]=T[cn[1]],Ut.array[Lt+11]=T[cn[2]],Lt+=12}else if(Ut.boundTo==="faceVertices"){for(f=0,l=en.length;f<l;f++)Ot=Ut.value[en[f]],E=Ot[0],S=Ot[1],x=Ot[2],Ut.array[Lt]=E[cn[0]],Ut.array[Lt+1]=E[cn[1]],Ut.array[Lt+2]=E[cn[2]],Ut.array[Lt+3]=S[cn[0]],Ut.array[Lt+4]=S[cn[1]],Ut.array[Lt+5]=S[cn[2]],Ut.array[Lt+6]=x[
  cn[0]],Ut.array[Lt+7]=x[cn[1]],Ut.array[Lt+8]=x[cn[2]],Lt+=9;for(f=0,l=tn.length;f<l;f++)Ot=Ut.value[tn[f]],E=Ot[0],S=Ot[1],x=Ot[2],T=Ot[3],Ut.array[Lt]=E[cn[0]],Ut.array[Lt+1]=E[cn[1]],Ut.array[Lt+2]=E[cn[2]],Ut.array[Lt+3]=S[cn[0]],Ut.array[Lt+4]=S[cn[1]],Ut.array[Lt+5]=S[cn[2]],Ut.array[Lt+6]=x[cn[0]],Ut.array[Lt+7]=x[cn[1]],Ut.array[Lt+8]=x[cn[2]],Ut.array[Lt+9]=T[cn[0]],Ut.array[Lt+10]=T[cn[1]],Ut.array[Lt+11]=T[cn[2]],Lt+=12}}else if(Ut.size===4)if(Ut.boundTo===undefined||Ut.boundTo==="vertices"){for(f=0,l=en.length;f<l;f++)h=nn[en[f]],E=Ut.value[h.a],S=Ut.value[h.b],x=Ut.value[h.c],Ut.array[Lt]=E.x,Ut.array[Lt+1]=E.y,Ut.array[Lt+2]=E.z,Ut.array[Lt+3]=E.w,Ut.array[Lt+4]=S.x,Ut.array[Lt+5]=S.y,Ut.array[Lt+6]=S.z,Ut.array[Lt+7]=S.w,Ut.array[Lt+8]=x.x,Ut.array[Lt+9]=x.y,Ut.array[Lt+10]=x.z,Ut.array[Lt+11]=x.w,Lt+=12;for(f=0,l=tn.length;f<l;f++)h=nn[tn[f]],E=Ut.value[h.a],S=Ut.value[h.b],x=Ut.value[h.c],T=Ut.value[h.d],Ut.array[Lt]=E.x,Ut.array[Lt+1]=E.y,Ut.array[Lt+2]=E.z,Ut.array[Lt+3]=E.w,Ut.array[Lt+4]=S
  .x,Ut.array[Lt+5]=S.y,Ut.array[Lt+6]=S.z,Ut.array[Lt+7]=S.w,Ut.array[Lt+8]=x.x,Ut.array[Lt+9]=x.y,Ut.array[Lt+10]=x.z,Ut.array[Lt+11]=x.w,Ut.array[Lt+12]=T.x,Ut.array[Lt+13]=T.y,Ut.array[Lt+14]=T.z,Ut.array[Lt+15]=T.w,Lt+=16}else if(Ut.boundTo==="faces"){for(f=0,l=en.length;f<l;f++)Ot=Ut.value[en[f]],E=Ot,S=Ot,x=Ot,Ut.array[Lt]=E.x,Ut.array[Lt+1]=E.y,Ut.array[Lt+2]=E.z,Ut.array[Lt+3]=E.w,Ut.array[Lt+4]=S.x,Ut.array[Lt+5]=S.y,Ut.array[Lt+6]=S.z,Ut.array[Lt+7]=S.w,Ut.array[Lt+8]=x.x,Ut.array[Lt+9]=x.y,Ut.array[Lt+10]=x.z,Ut.array[Lt+11]=x.w,Lt+=12;for(f=0,l=tn.length;f<l;f++)Ot=Ut.value[tn[f]],E=Ot,S=Ot,x=Ot,T=Ot,Ut.array[Lt]=E.x,Ut.array[Lt+1]=E.y,Ut.array[Lt+2]=E.z,Ut.array[Lt+3]=E.w,Ut.array[Lt+4]=S.x,Ut.array[Lt+5]=S.y,Ut.array[Lt+6]=S.z,Ut.array[Lt+7]=S.w,Ut.array[Lt+8]=x.x,Ut.array[Lt+9]=x.y,Ut.array[Lt+10]=x.z,Ut.array[Lt+11]=x.w,Ut.array[Lt+12]=T.x,Ut.array[Lt+13]=T.y,Ut.array[Lt+14]=T.z,Ut.array[Lt+15]=T.w,Lt+=16}else if(Ut.boundTo==="faceVertices"){for(f=0,l=en.length;f<l;f++)Ot=Ut.value[en[f]],E=Ot[0]
  ,S=Ot[1],x=Ot[2],Ut.array[Lt]=E.x,Ut.array[Lt+1]=E.y,Ut.array[Lt+2]=E.z,Ut.array[Lt+3]=E.w,Ut.array[Lt+4]=S.x,Ut.array[Lt+5]=S.y,Ut.array[Lt+6]=S.z,Ut.array[Lt+7]=S.w,Ut.array[Lt+8]=x.x,Ut.array[Lt+9]=x.y,Ut.array[Lt+10]=x.z,Ut.array[Lt+11]=x.w,Lt+=12;for(f=0,l=tn.length;f<l;f++)Ot=Ut.value[tn[f]],E=Ot[0],S=Ot[1],x=Ot[2],T=Ot[3],Ut.array[Lt]=E.x,Ut.array[Lt+1]=E.y,Ut.array[Lt+2]=E.z,Ut.array[Lt+3]=E.w,Ut.array[Lt+4]=S.x,Ut.array[Lt+5]=S.y,Ut.array[Lt+6]=S.z,Ut.array[Lt+7]=S.w,Ut.array[Lt+8]=x.x,Ut.array[Lt+9]=x.y,Ut.array[Lt+10]=x.z,Ut.array[Lt+11]=x.w,Ut.array[Lt+12]=T.x,Ut.array[Lt+13]=T.y,Ut.array[Lt+14]=T.z,Ut.array[Lt+15]=T.w,Lt+=16}V.bindBuffer(V.ARRAY_BUFFER,Ut.buffer),V.bufferData(V.ARRAY_BUFFER,Ut.array,n)}r&&(delete e.__inittedArrays,delete e.__colorArray,delete e.__normalArray,delete e.__tangentArray,delete e.__uvArray,delete e.__uv2Array,delete e.__faceArray,delete e.__vertexArray,delete e.__lineArray,delete e.__skinIndexArray,delete e.__skinWeightArray)}function At(e,t,n){var r=e.attributes,i=r.index
  ,s=r.position,o=r.normal,u=r.uv,a=r.color,f=r.tangent;e.elementsNeedUpdate&&i!==undefined&&(V.bindBuffer(V.ELEMENT_ARRAY_BUFFER,i.buffer),V.bufferData(V.ELEMENT_ARRAY_BUFFER,i.array,t)),e.verticesNeedUpdate&&s!==undefined&&(V.bindBuffer(V.ARRAY_BUFFER,s.buffer),V.bufferData(V.ARRAY_BUFFER,s.array,t)),e.normalsNeedUpdate&&o!==undefined&&(V.bindBuffer(V.ARRAY_BUFFER,o.buffer),V.bufferData(V.ARRAY_BUFFER,o.array,t)),e.uvsNeedUpdate&&u!==undefined&&(V.bindBuffer(V.ARRAY_BUFFER,u.buffer),V.bufferData(V.ARRAY_BUFFER,u.array,t)),e.colorsNeedUpdate&&a!==undefined&&(V.bindBuffer(V.ARRAY_BUFFER,a.buffer),V.bufferData(V.ARRAY_BUFFER,a.array,t)),e.tangentsNeedUpdate&&f!==undefined&&(V.bindBuffer(V.ARRAY_BUFFER,f.buffer),V.bufferData(V.ARRAY_BUFFER,f.array,t));if(n)for(var l in e.attributes)delete e.attributes[l].array}function Ot(e){F[e]||(V.enableVertexAttribArray(e),F[e]=!0)}function Mt(){for(var e in F)F[e]&&(V.disableVertexAttribArray(e),F[e]=!1)}function _t(e,t,n){var r=e.program.attributes;n.morphTargetBase!==-1&&r.
  position>=0?(V.bindBuffer(V.ARRAY_BUFFER,t.__webglMorphTargetsBuffers[n.morphTargetBase]),Ot(r.position),V.vertexAttribPointer(r.position,3,V.FLOAT,!1,0,0)):r.position>=0&&(V.bindBuffer(V.ARRAY_BUFFER,t.__webglVertexBuffer),Ot(r.position),V.vertexAttribPointer(r.position,3,V.FLOAT,!1,0,0));if(n.morphTargetForcedOrder.length){var i=0,s=n.morphTargetForcedOrder,o=n.morphTargetInfluences;while(i<e.numSupportedMorphTargets&&i<s.length)r["morphTarget"+i]>=0&&(V.bindBuffer(V.ARRAY_BUFFER,t.__webglMorphTargetsBuffers[s[i]]),Ot(r["morphTarget"+i]),V.vertexAttribPointer(r["morphTarget"+i],3,V.FLOAT,!1,0,0)),r["morphNormal"+i]>=0&&e.morphNormals&&(V.bindBuffer(V.ARRAY_BUFFER,t.__webglMorphNormalsBuffers[s[i]]),Ot(r["morphNormal"+i]),V.vertexAttribPointer(r["morphNormal"+i],3,V.FLOAT,!1,0,0)),n.__webglMorphTargetInfluences[i]=o[s[i]],i++}else{var u,a=[],o=n.morphTargetInfluences,f,l=o.length;for(f=0;f<l;f++)u=o[f],u>0&&a.push([f,u]);a.length>e.numSupportedMorphTargets?(a.sort(Pt),a.length=e.numSupportedMorphTargets):a.length>
  e.numSupportedMorphNormals?a.sort(Pt):a.length===0&&a.push([0,0]);var c,i=0;while(i<e.numSupportedMorphTargets)a[i]?(c=a[i][0],r["morphTarget"+i]>=0&&(V.bindBuffer(V.ARRAY_BUFFER,t.__webglMorphTargetsBuffers[c]),Ot(r["morphTarget"+i]),V.vertexAttribPointer(r["morphTarget"+i],3,V.FLOAT,!1,0,0)),r["morphNormal"+i]>=0&&e.morphNormals&&(V.bindBuffer(V.ARRAY_BUFFER,t.__webglMorphNormalsBuffers[c]),Ot(r["morphNormal"+i]),V.vertexAttribPointer(r["morphNormal"+i],3,V.FLOAT,!1,0,0)),n.__webglMorphTargetInfluences[i]=o[c]):n.__webglMorphTargetInfluences[i]=0,i++}e.program.uniforms.morphTargetInfluences!==null&&V.uniform1fv(e.program.uniforms.morphTargetInfluences,n.__webglMorphTargetInfluences)}function Dt(e,t){return e.z!==t.z?t.z-e.z:t.id-e.id}function Pt(e,t){return t[1]-e[1]}function Ht(e,t,n){if(!e.length)return;for(var r=0,i=e.length;r<i;r++)p=null,g=null,S=-1,C=-1,k=-1,w=-1,E=-1,m=-1,v=-1,W=!0,e[r].render(t,n,B,j),p=null,g=null,S=-1,C=-1,k=-1,w=-1,E=-1,m=-1,v=-1,W=!0}function Bt(e,t,n,r,i,s,o,u){var a,f,c,h,p,d,v
  ;t?(p=e.length-1,d=-1,v=-1):(p=0,d=e.length,v=1);for(var m=p;m!==d;m+=v){a=e[m];if(a.render){f=a.object,c=a.buffer;if(u)h=u;else{h=a[n];if(!h)continue;o&&l.setBlending(h.blending,h.blendEquation,h.blendSrc,h.blendDst),l.setDepthTest(h.depthTest),l.setDepthWrite(h.depthWrite),mn(h.polygonOffset,h.polygonOffsetFactor,h.polygonOffsetUnits)}l.setMaterialFaces(h),c instanceof THREE.BufferGeometry?l.renderBufferDirect(r,i,s,h,c,f):l.renderBuffer(r,i,s,h,c,f)}}}function jt(e,t,n,r,i,s,o){var u,a,f,c;for(var h=0,p=e.length;h<p;h++){u=e[h],a=u.object;if(a.visible){if(o)f=o;else{f=u[t];if(!f)continue;s&&l.setBlending(f.blending,f.blendEquation,f.blendSrc,f.blendDst),l.setDepthTest(f.depthTest),l.setDepthWrite(f.depthWrite),mn(f.polygonOffset,f.polygonOffsetFactor,f.polygonOffsetUnits)}l.renderImmediateObject(n,r,i,f,a)}}}function Ft(e){var t=e.object,n=t.material;n.transparent?(e.transparent=n,e.opaque=null):(e.opaque=n,e.transparent=null)}function It(e){var t=e.object,n=e.buffer,r,i,s;s=t.material,s instanceof THREE.MeshFaceMaterial?
  (i=n.materialIndex,r=s.materials[i],r.transparent?(e.transparent=r,e.opaque=null):(e.opaque=r,e.transparent=null)):(r=s,r&&(r.transparent?(e.transparent=r,e.opaque=null):(e.opaque=r,e.transparent=null)))}function qt(e,t){var n,r,i,s,o,u,a={},f=e.morphTargets.length,l=e.morphNormals.length,c=t instanceof THREE.MeshFaceMaterial;e.geometryGroups={};for(n=0,r=e.faces.length;n<r;n++)i=e.faces[n],s=c?i.materialIndex:0,a[s]===undefined&&(a[s]={hash:s,counter:0}),u=a[s].hash+"_"+a[s].counter,e.geometryGroups[u]===undefined&&(e.geometryGroups[u]={faces3:[],faces4:[],materialIndex:s,vertices:0,numMorphTargets:f,numMorphNormals:l}),o=i instanceof THREE.Face3?3:4,e.geometryGroups[u].vertices+o>65535&&(a[s].counter+=1,u=a[s].hash+"_"+a[s].counter,e.geometryGroups[u]===undefined&&(e.geometryGroups[u]={faces3:[],faces4:[],materialIndex:s,vertices:0,numMorphTargets:f,numMorphNormals:l})),i instanceof THREE.Face3?e.geometryGroups[u].faces3.push(n):e.geometryGroups[u].faces4.push(n),e.geometryGroups[u].vertices+=o;e.geometryGroupsList=
  [];for(var h in e.geometryGroups)e.geometryGroups[h].id=y++,e.geometryGroupsList.push(e.geometryGroups[h])}function Rt(e,t){var n,r,i,s;if(!e.__webglInit){e.__webglInit=!0,e._modelViewMatrix=new THREE.Matrix4,e._normalMatrix=new THREE.Matrix3;if(e instanceof THREE.Mesh){r=e.geometry,i=e.material;if(r instanceof THREE.Geometry){r.geometryGroups===undefined&&qt(r,i);for(n in r.geometryGroups)s=r.geometryGroups[n],s.__webglVertexBuffer||(at(s),yt(s,e),r.verticesNeedUpdate=!0,r.morphTargetsNeedUpdate=!0,r.elementsNeedUpdate=!0,r.uvsNeedUpdate=!0,r.normalsNeedUpdate=!0,r.tangentsNeedUpdate=!0,r.colorsNeedUpdate=!0)}else r instanceof THREE.BufferGeometry&&Tt(r)}else e instanceof THREE.Ribbon?(r=e.geometry,r.__webglVertexBuffer||(ut(r),gt(r,e),r.verticesNeedUpdate=!0,r.colorsNeedUpdate=!0,r.normalsNeedUpdate=!0)):e instanceof THREE.Line?(r=e.geometry,r.__webglVertexBuffer||(ot(r),mt(r,e),r.verticesNeedUpdate=!0,r.colorsNeedUpdate=!0,r.lineDistancesNeedUpdate=!0)):e instanceof THREE.ParticleSystem&&(r=e.geometry,r.__webglVertexBuffer||
  (r instanceof THREE.Geometry?(st(r),vt(r,e),r.verticesNeedUpdate=!0,r.colorsNeedUpdate=!0):r instanceof THREE.BufferGeometry&&Tt(r)))}if(!e.__webglActive){if(e instanceof THREE.Mesh){r=e.geometry;if(r instanceof THREE.BufferGeometry)Ut(t.__webglObjects,r,e);else for(n in r.geometryGroups)s=r.geometryGroups[n],Ut(t.__webglObjects,s,e)}else e instanceof THREE.Ribbon||e instanceof THREE.Line||e instanceof THREE.ParticleSystem?(r=e.geometry,Ut(t.__webglObjects,r,e)):e instanceof THREE.ImmediateRenderObject||e.immediateRenderCallback?zt(t.__webglObjectsImmediate,e):e instanceof THREE.Sprite?t.__webglSprites.push(e):e instanceof THREE.LensFlare&&t.__webglFlares.push(e);e.__webglActive=!0}}function Ut(e,t,n){e.push({buffer:t,object:n,opaque:null,transparent:null})}function zt(e,t){e.push({object:t,opaque:null,transparent:null})}function Wt(e){var t=e.geometry,n,r,i;if(e instanceof THREE.Mesh)if(t instanceof THREE.BufferGeometry)(t.verticesNeedUpdate||t.elementsNeedUpdate||t.uvsNeedUpdate||t.normalsNeedUpdate||t.colorsNeedUpdate||
  t.tangentsNeedUpdate)&&At(t,V.DYNAMIC_DRAW,!t.dynamic),t.verticesNeedUpdate=!1,t.elementsNeedUpdate=!1,t.uvsNeedUpdate=!1,t.normalsNeedUpdate=!1,t.colorsNeedUpdate=!1,t.tangentsNeedUpdate=!1;else{for(var s=0,o=t.geometryGroupsList.length;s<o;s++)n=t.geometryGroupsList[s],i=bt(e,n),t.buffersNeedUpdate&&yt(n,e),r=i.attributes&&Xt(i),(t.verticesNeedUpdate||t.morphTargetsNeedUpdate||t.elementsNeedUpdate||t.uvsNeedUpdate||t.normalsNeedUpdate||t.colorsNeedUpdate||t.tangentsNeedUpdate||r)&&Lt(n,e,V.DYNAMIC_DRAW,!t.dynamic,i);t.verticesNeedUpdate=!1,t.morphTargetsNeedUpdate=!1,t.elementsNeedUpdate=!1,t.uvsNeedUpdate=!1,t.normalsNeedUpdate=!1,t.colorsNeedUpdate=!1,t.tangentsNeedUpdate=!1,t.buffersNeedUpdate=!1,i.attributes&&Vt(i)}else e instanceof THREE.Ribbon?(i=bt(e,t),r=i.attributes&&Xt(i),(t.verticesNeedUpdate||t.colorsNeedUpdate||t.normalsNeedUpdate||r)&&kt(t,V.DYNAMIC_DRAW),t.verticesNeedUpdate=!1,t.colorsNeedUpdate=!1,t.normalsNeedUpdate=!1,i.attributes&&Vt(i)):e instanceof THREE.Line?(i=bt(e,t),r=i.attributes&&
  Xt(i),(t.verticesNeedUpdate||t.colorsNeedUpdate||t.lineDistancesNeedUpdate||r)&&Ct(t,V.DYNAMIC_DRAW),t.verticesNeedUpdate=!1,t.colorsNeedUpdate=!1,t.lineDistancesNeedUpdate=!1,i.attributes&&Vt(i)):e instanceof THREE.ParticleSystem&&(t instanceof THREE.BufferGeometry?((t.verticesNeedUpdate||t.colorsNeedUpdate)&&At(t,V.DYNAMIC_DRAW,!t.dynamic),t.verticesNeedUpdate=!1,t.colorsNeedUpdate=!1):(i=bt(e,t),r=i.attributes&&Xt(i),(t.verticesNeedUpdate||t.colorsNeedUpdate||e.sortParticles||r)&&Nt(t,V.DYNAMIC_DRAW,e),t.verticesNeedUpdate=!1,t.colorsNeedUpdate=!1,i.attributes&&Vt(i)))}function Xt(e){for(var t in e.attributes)if(e.attributes[t].needsUpdate)return!0;return!1}function Vt(e){for(var t in e.attributes)e.attributes[t].needsUpdate=!1}function $t(e,t){e instanceof THREE.Mesh||e instanceof THREE.ParticleSystem||e instanceof THREE.Ribbon||e instanceof THREE.Line?Jt(t.__webglObjects,e):e instanceof THREE.Sprite?Kt(t.__webglSprites,e):e instanceof THREE.LensFlare?Kt(t.__webglFlares,e):(e instanceof THREE.ImmediateRenderObject||
  e.immediateRenderCallback)&&Jt(t.__webglObjectsImmediate,e),e.__webglActive=!1}function Jt(e,t){for(var n=e.length-1;n>=0;n--)e[n].object===t&&e.splice(n,1)}function Kt(e,t){for(var n=e.length-1;n>=0;n--)e[n]===t&&e.splice(n,1)}function Qt(e,t){e.uniforms=THREE.UniformsUtils.clone(t.uniforms),e.vertexShader=t.vertexShader,e.fragmentShader=t.fragmentShader}function Gt(e,t,n,r,i){b=0,r.needsUpdate&&(r.program&&l.deallocateMaterial(r),l.initMaterial(r,t,n,i),r.needsUpdate=!1),r.morphTargets&&(i.__webglMorphTargetInfluences||(i.__webglMorphTargetInfluences=new Float32Array(l.maxMorphTargets)));var s=!1,o=r.program,u=o.uniforms,a=r.uniforms;o!==p&&(V.useProgram(o),p=o,s=!0),r.id!==v&&(v=r.id,s=!0);if(s||e!==g)V.uniformMatrix4fv(u.projectionMatrix,!1,e.projectionMatrix.elements),e!==g&&(g=e);if(r.skinning)if(rt&&i.useVertexTexture){if(u.boneTexture!==null){var f=fn();V.uniform1i(u.boneTexture,f),l.setTexture(i.boneTexture,f)}}else u.boneGlobalMatrices!==null&&V.uniformMatrix4fv(u.boneGlobalMatrices,!1,i.boneMatrices
  );if(s){n&&r.fog&&nn(a,n);if(r instanceof THREE.MeshPhongMaterial||r instanceof THREE.MeshLambertMaterial||r.lights)W&&(dn(o,t),W=!1),on(a,X);(r instanceof THREE.MeshBasicMaterial||r instanceof THREE.MeshLambertMaterial||r instanceof THREE.MeshPhongMaterial)&&Yt(a,r),r instanceof THREE.LineBasicMaterial?Zt(a,r):r instanceof THREE.LineDashedMaterial?(Zt(a,r),en(a,r)):r instanceof THREE.ParticleBasicMaterial?tn(a,r):r instanceof THREE.MeshPhongMaterial?rn(a,r):r instanceof THREE.MeshLambertMaterial?sn(a,r):r instanceof THREE.MeshDepthMaterial?(a.mNear.value=e.near,a.mFar.value=e.far,a.opacity.value=r.opacity):r instanceof THREE.MeshNormalMaterial&&(a.opacity.value=r.opacity),i.receiveShadow&&!r._shadowPass&&un(a,t),ln(o,r.uniformsList);if(r instanceof THREE.ShaderMaterial||r instanceof THREE.MeshPhongMaterial||r.envMap)if(u.cameraPosition!==null){var c=e.matrixWorld.getPosition();V.uniform3f(u.cameraPosition,c.x,c.y,c.z)}(r instanceof THREE.MeshPhongMaterial||r instanceof THREE.MeshLambertMaterial||r instanceof 
  THREE.ShaderMaterial||r.skinning)&&u.viewMatrix!==null&&V.uniformMatrix4fv(u.viewMatrix,!1,e.matrixWorldInverse.elements)}return an(u,i),u.modelMatrix!==null&&V.uniformMatrix4fv(u.modelMatrix,!1,i.matrixWorld.elements),o}function Yt(e,t){e.opacity.value=t.opacity,l.gammaInput?e.diffuse.value.copyGammaToLinear(t.color):e.diffuse.value=t.color,e.map.value=t.map,e.lightMap.value=t.lightMap,e.specularMap.value=t.specularMap,t.bumpMap&&(e.bumpMap.value=t.bumpMap,e.bumpScale.value=t.bumpScale),t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale));var n;t.map?n=t.map:t.specularMap?n=t.specularMap:t.normalMap?n=t.normalMap:t.bumpMap&&(n=t.bumpMap);if(n!==undefined){var r=n.offset,i=n.repeat;e.offsetRepeat.value.set(r.x,r.y,i.x,i.y)}e.envMap.value=t.envMap,e.flipEnvMap.value=t.envMap instanceof THREE.WebGLRenderTargetCube?1:-1,l.gammaInput?e.reflectivity.value=t.reflectivity:e.reflectivity.value=t.reflectivity,e.refractionRatio.value=t.refractionRatio,e.combine.value=t.combine,e.useRefract
  .value=t.envMap&&t.envMap.mapping instanceof THREE.CubeRefractionMapping}function Zt(e,t){e.diffuse.value=t.color,e.opacity.value=t.opacity}function en(e,t){e.dashSize.value=t.dashSize,e.totalSize.value=t.dashSize+t.gapSize,e.scale.value=t.scale}function tn(e,n){e.psColor.value=n.color,e.opacity.value=n.opacity,e.size.value=n.size,e.scale.value=t.height/2,e.map.value=n.map}function nn(e,t){e.fogColor.value=t.color,t instanceof THREE.Fog?(e.fogNear.value=t.near,e.fogFar.value=t.far):t instanceof THREE.FogExp2&&(e.fogDensity.value=t.density)}function rn(e,t){e.shininess.value=t.shininess,l.gammaInput?(e.ambient.value.copyGammaToLinear(t.ambient),e.emissive.value.copyGammaToLinear(t.emissive),e.specular.value.copyGammaToLinear(t.specular)):(e.ambient.value=t.ambient,e.emissive.value=t.emissive,e.specular.value=t.specular),t.wrapAround&&e.wrapRGB.value.copy(t.wrapRGB)}function sn(e,t){l.gammaInput?(e.ambient.value.copyGammaToLinear(t.ambient),e.emissive.value.copyGammaToLinear(t.emissive)):(e.ambient.value=t.ambient
  ,e.emissive.value=t.emissive),t.wrapAround&&e.wrapRGB.value.copy(t.wrapRGB)}function on(e,t){e.ambientLightColor.value=t.ambient,e.directionalLightColor.value=t.directional.colors,e.directionalLightDirection.value=t.directional.positions,e.pointLightColor.value=t.point.colors,e.pointLightPosition.value=t.point.positions,e.pointLightDistance.value=t.point.distances,e.spotLightColor.value=t.spot.colors,e.spotLightPosition.value=t.spot.positions,e.spotLightDistance.value=t.spot.distances,e.spotLightDirection.value=t.spot.directions,e.spotLightAngleCos.value=t.spot.anglesCos,e.spotLightExponent.value=t.spot.exponents,e.hemisphereLightSkyColor.value=t.hemi.skyColors,e.hemisphereLightGroundColor.value=t.hemi.groundColors,e.hemisphereLightDirection.value=t.hemi.positions}function un(e,t){if(e.shadowMatrix){var n=0;for(var r=0,i=t.length;r<i;r++){var s=t[r];if(!s.castShadow)continue;if(s instanceof THREE.SpotLight||s instanceof THREE.DirectionalLight&&!s.shadowCascade)e.shadowMap.value[n]=s.shadowMap,e.shadowMapSize.value
  [n]=s.shadowMapSize,e.shadowMatrix.value[n]=s.shadowMatrix,e.shadowDarkness.value[n]=s.shadowDarkness,e.shadowBias.value[n]=s.shadowBias,n++}}}function an(e,t){V.uniformMatrix4fv(e.modelViewMatrix,!1,t._modelViewMatrix.elements),e.normalMatrix&&V.uniformMatrix3fv(e.normalMatrix,!1,t._normalMatrix.elements)}function fn(){var e=b;return e>=G&&console.warn("Trying to use "+e+" texture units while this GPU supports only "+G),b+=1,e}function ln(e,t){var n,r,i,s,o,u,a,f,c,h,p;for(c=0,h=t.length;c<h;c++){s=e.uniforms[t[c][1]];if(!s)continue;n=t[c][0],i=n.type,r=n.value;if(i==="i")V.uniform1i(s,r);else if(i==="f")V.uniform1f(s,r);else if(i==="v2")V.uniform2f(s,r.x,r.y);else if(i==="v3")V.uniform3f(s,r.x,r.y,r.z);else if(i==="v4")V.uniform4f(s,r.x,r.y,r.z,r.w);else if(i==="c")V.uniform3f(s,r.r,r.g,r.b);else if(i==="iv1")V.uniform1iv(s,r);else if(i==="iv")V.uniform3iv(s,r);else if(i==="fv1")V.uniform1fv(s,r);else if(i==="fv")V.uniform3fv(s,r);else if(i==="v2v"){n._array===undefined&&(n._array=new Float32Array(2*r.length
  ));for(a=0,f=r.length;a<f;a++)p=a*2,n._array[p]=r[a].x,n._array[p+1]=r[a].y;V.uniform2fv(s,n._array)}else if(i==="v3v"){n._array===undefined&&(n._array=new Float32Array(3*r.length));for(a=0,f=r.length;a<f;a++)p=a*3,n._array[p]=r[a].x,n._array[p+1]=r[a].y,n._array[p+2]=r[a].z;V.uniform3fv(s,n._array)}else if(i==="v4v"){n._array===undefined&&(n._array=new Float32Array(4*r.length));for(a=0,f=r.length;a<f;a++)p=a*4,n._array[p]=r[a].x,n._array[p+1]=r[a].y,n._array[p+2]=r[a].z,n._array[p+3]=r[a].w;V.uniform4fv(s,n._array)}else if(i==="m4")n._array===undefined&&(n._array=new Float32Array(16)),r.flattenToArray(n._array),V.uniformMatrix4fv(s,!1,n._array);else if(i==="m4v"){n._array===undefined&&(n._array=new Float32Array(16*r.length));for(a=0,f=r.length;a<f;a++)r[a].flattenToArrayOffset(n._array,a*16);V.uniformMatrix4fv(s,!1,n._array)}else if(i==="t"){o=r,u=fn(),V.uniform1i(s,u);if(!o)continue;o.image instanceof Array&&o.image.length===6?Cn(o,u):o instanceof THREE.WebGLRenderTargetCube?kn(o,u):l.setTexture(o,u)}else if(
  i==="tv"){n._array===undefined&&(n._array=[]);for(a=0,f=n.value.length;a<f;a++)n._array[a]=fn();V.uniform1iv(s,n._array);for(a=0,f=n.value.length;a<f;a++){o=n.value[a],u=n._array[a];if(!o)continue;l.setTexture(o,u)}}}}function cn(e,t){e._modelViewMatrix.multiply(t.matrixWorldInverse,e.matrixWorld),e._normalMatrix.getInverse(e._modelViewMatrix),e._normalMatrix.transpose()}function hn(e,t,n,r){e[t]=n.r*n.r*r,e[t+1]=n.g*n.g*r,e[t+2]=n.b*n.b*r}function pn(e,t,n,r){e[t]=n.r*r,e[t+1]=n.g*r,e[t+2]=n.b*r}function dn(e,t){var n,r,i,s,o=0,u=0,a=0,f,c,h,p,d,v,m,g=X,y=g.directional.colors,b=g.directional.positions,w=g.point.colors,E=g.point.positions,S=g.point.distances,x=g.spot.colors,T=g.spot.positions,N=g.spot.distances,C=g.spot.directions,k=g.spot.anglesCos,L=g.spot.exponents,A=g.hemi.skyColors,O=g.hemi.groundColors,M=g.hemi.positions,_=0,D=0,P=0,H=0,B=0,j=0,F=0,I=0,q=0,R=0,U=0,W=0;for(n=0,r=t.length;n<r;n++){i=t[n];if(i.onlyShadow)continue;f=i.color,p=i.intensity,m=i.distance;if(i instanceof THREE.AmbientLight){if(!i
  .visible)continue;l.gammaInput?(o+=f.r*f.r,u+=f.g*f.g,a+=f.b*f.b):(o+=f.r,u+=f.g,a+=f.b)}else if(i instanceof THREE.DirectionalLight){B+=1;if(!i.visible)continue;q=_*3,l.gammaInput?hn(y,q,f,p*p):pn(y,q,f,p),z.copy(i.matrixWorld.getPosition()),z.subSelf(i.target.matrixWorld.getPosition()),z.normalize(),b[q]=z.x,b[q+1]=z.y,b[q+2]=z.z,_+=1}else if(i instanceof THREE.PointLight){j+=1;if(!i.visible)continue;R=D*3,l.gammaInput?hn(w,R,f,p*p):pn(w,R,f,p),v=i.matrixWorld.getPosition(),E[R]=v.x,E[R+1]=v.y,E[R+2]=v.z,S[D]=m,D+=1}else if(i instanceof THREE.SpotLight){F+=1;if(!i.visible)continue;U=P*3,l.gammaInput?hn(x,U,f,p*p):pn(x,U,f,p),v=i.matrixWorld.getPosition(),T[U]=v.x,T[U+1]=v.y,T[U+2]=v.z,N[P]=m,z.copy(v),z.subSelf(i.target.matrixWorld.getPosition()),z.normalize(),C[U]=z.x,C[U+1]=z.y,C[U+2]=z.z,k[P]=Math.cos(i.angle),L[P]=i.exponent,P+=1}else if(i instanceof THREE.HemisphereLight){I+=1;if(!i.visible)continue;c=i.color,h=i.groundColor,W=H*3,l.gammaInput?(d=p*p,hn(A,W,c,d),hn(O,W,h,d)):(pn(A,W,c,p),pn(O,W,h,p)),z.
  copy(i.matrixWorld.getPosition()),z.normalize(),M[W]=z.x,M[W+1]=z.y,M[W+2]=z.z,H+=1}}for(n=_*3,r=Math.max(y.length,B*3);n<r;n++)y[n]=0;for(n=_*3,r=Math.max(b.length,B*3);n<r;n++)b[n]=0;for(n=D*3,r=Math.max(w.length,j*3);n<r;n++)w[n]=0;for(n=D*3,r=Math.max(E.length,j*3);n<r;n++)E[n]=0;for(n=D,r=Math.max(S.length,j);n<r;n++)S[n]=0;for(n=P*3,r=Math.max(x.length,F*3);n<r;n++)x[n]=0;for(n=P*3,r=Math.max(T.length,F*3);n<r;n++)T[n]=0;for(n=P*3,r=Math.max(C.length,F*3);n<r;n++)C[n]=0;for(n=P,r=Math.max(k.length,F);n<r;n++)k[n]=0;for(n=P,r=Math.max(L.length,F);n<r;n++)L[n]=0;for(n=P,r=Math.max(N.length,F);n<r;n++)N[n]=0;for(n=H*3,r=Math.max(A.length,I*3);n<r;n++)A[n]=0;for(n=H*3,r=Math.max(O.length,I*3);n<r;n++)O[n]=0;for(n=H*3,r=Math.max(M.length,I*3);n<r;n++)M[n]=0;g.directional.length=_,g.point.length=D,g.spot.length=P,g.hemi.length=H,g.ambient[0]=o,g.ambient[1]=u,g.ambient[2]=a}function vn(e){e!==M&&(V.lineWidth(e),M=e)}function mn(e,t,n){L!==e&&(e?V.enable(V.POLYGON_OFFSET_FILL):V.disable(V.POLYGON_OFFSET_FILL),L=
  e),e&&(A!==t||O!==n)&&(V.polygonOffset(t,n),A=t,O=n)}function gn(e){var t,n,r=[];for(var i in e){t=e[i];if(t===!1)continue;n="#define "+i+" "+t,r.push(n)}return r.join("\n")}function yn(e,t,r,i,s,o,u){var a,f,p,d,v,m=[];e?m.push(e):(m.push(t),m.push(r));for(p in o)m.push(p),m.push(o[p]);for(a in u)m.push(a),m.push(u[a]);v=m.join();for(a=0,f=c.length;a<f;a++){var g=c[a];if(g.code===v)return g.usedTimes++,g.program}var y=gn(o);d=V.createProgram();var b=["precision "+n+" float;",y,nt?"#define VERTEX_TEXTURES":"",l.gammaInput?"#define GAMMA_INPUT":"",l.gammaOutput?"#define GAMMA_OUTPUT":"",l.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"","#define MAX_DIR_LIGHTS "+u.maxDirLights,"#define MAX_POINT_LIGHTS "+u.maxPointLights,"#define MAX_SPOT_LIGHTS "+u.maxSpotLights,"#define MAX_HEMI_LIGHTS "+u.maxHemiLights,"#define MAX_SHADOWS "+u.maxShadows,"#define MAX_BONES "+u.maxBones,u.map?"#define USE_MAP":"",u.envMap?"#define USE_ENVMAP":"",u.lightMap?"#define USE_LIGHTMAP":"",u.bumpMap?"#define USE_BUMPMAP":""
  ,u.normalMap?"#define USE_NORMALMAP":"",u.specularMap?"#define USE_SPECULARMAP":"",u.vertexColors?"#define USE_COLOR":"",u.skinning?"#define USE_SKINNING":"",u.useVertexTexture?"#define BONE_TEXTURE":"",u.boneTextureWidth?"#define N_BONE_PIXEL_X "+u.boneTextureWidth.toFixed(1):"",u.boneTextureHeight?"#define N_BONE_PIXEL_Y "+u.boneTextureHeight.toFixed(1):"",u.morphTargets?"#define USE_MORPHTARGETS":"",u.morphNormals?"#define USE_MORPHNORMALS":"",u.perPixel?"#define PHONG_PER_PIXEL":"",u.wrapAround?"#define WRAP_AROUND":"",u.doubleSided?"#define DOUBLE_SIDED":"",u.flipSided?"#define FLIP_SIDED":"",u.shadowMapEnabled?"#define USE_SHADOWMAP":"",u.shadowMapSoft?"#define SHADOWMAP_SOFT":"",u.shadowMapDebug?"#define SHADOWMAP_DEBUG":"",u.shadowMapCascade?"#define SHADOWMAP_CASCADE":"",u.sizeAttenuation?"#define USE_SIZEATTENUATION":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","attribute vec3 position;"
  ,"attribute vec3 normal;","attribute vec2 uv;","attribute vec2 uv2;","#ifdef USE_COLOR","attribute vec3 color;","#endif","#ifdef USE_MORPHTARGETS","attribute vec3 morphTarget0;","attribute vec3 morphTarget1;","attribute vec3 morphTarget2;","attribute vec3 morphTarget3;","#ifdef USE_MORPHNORMALS","attribute vec3 morphNormal0;","attribute vec3 morphNormal1;","attribute vec3 morphNormal2;","attribute vec3 morphNormal3;","#else","attribute vec3 morphTarget4;","attribute vec3 morphTarget5;","attribute vec3 morphTarget6;","attribute vec3 morphTarget7;","#endif","#endif","#ifdef USE_SKINNING","attribute vec4 skinIndex;","attribute vec4 skinWeight;","#endif",""].join("\n"),w=["precision "+n+" float;",u.bumpMap||u.normalMap?"#extension GL_OES_standard_derivatives : enable":"",y,"#define MAX_DIR_LIGHTS "+u.maxDirLights,"#define MAX_POINT_LIGHTS "+u.maxPointLights,"#define MAX_SPOT_LIGHTS "+u.maxSpotLights,"#define MAX_HEMI_LIGHTS "+u.maxHemiLights,"#define MAX_SHADOWS "+u.maxShadows,u.alphaTest?"#define ALPHATEST "+u.alphaTest
  :"",l.gammaInput?"#define GAMMA_INPUT":"",l.gammaOutput?"#define GAMMA_OUTPUT":"",l.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"",u.useFog&&u.fog?"#define USE_FOG":"",u.useFog&&u.fogExp?"#define FOG_EXP2":"",u.map?"#define USE_MAP":"",u.envMap?"#define USE_ENVMAP":"",u.lightMap?"#define USE_LIGHTMAP":"",u.bumpMap?"#define USE_BUMPMAP":"",u.normalMap?"#define USE_NORMALMAP":"",u.specularMap?"#define USE_SPECULARMAP":"",u.vertexColors?"#define USE_COLOR":"",u.metal?"#define METAL":"",u.perPixel?"#define PHONG_PER_PIXEL":"",u.wrapAround?"#define WRAP_AROUND":"",u.doubleSided?"#define DOUBLE_SIDED":"",u.flipSided?"#define FLIP_SIDED":"",u.shadowMapEnabled?"#define USE_SHADOWMAP":"",u.shadowMapSoft?"#define SHADOWMAP_SOFT":"",u.shadowMapDebug?"#define SHADOWMAP_DEBUG":"",u.shadowMapCascade?"#define SHADOWMAP_CASCADE":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;",""].join("\n"),E=Sn("fragment",w+t),S=Sn("vertex",b+r);V.attachShader(d,S),V.attachShader(d,E),V.linkProgram(d),V.getProgramParameter
  (d,V.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+V.getProgramParameter(d,V.VALIDATE_STATUS)+", gl error ["+V.getError()+"]"),V.deleteShader(E),V.deleteShader(S),d.uniforms={},d.attributes={};var x,T,N,C;x=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","modelMatrix","cameraPosition","morphTargetInfluences"],u.useVertexTexture?x.push("boneTexture"):x.push("boneGlobalMatrices");for(T in i)x.push(T);bn(d,x),x=["position","normal","uv","uv2","tangent","color","skinIndex","skinWeight","lineDistance"];for(C=0;C<u.maxMorphTargets;C++)x.push("morphTarget"+C);for(C=0;C<u.maxMorphNormals;C++)x.push("morphNormal"+C);for(N in s)x.push(N);return wn(d,x),d.id=h++,c.push({program:d,code:v,usedTimes:1}),l.info.memory.programs=c.length,d}function bn(e,t){var n,r,i;for(n=0,r=t.length;n<r;n++)i=t[n],e.uniforms[i]=V.getUniformLocation(e,i)}function wn(e,t){var n,r,i;for(n=0,r=t.length;n<r;n++)i=t[n],e.attributes[i]=V.getAttribLocation(e,i)}function En(e){var t=e.split("\n");for(var n=0
  ,r=t.length;n<r;n++)t[n]=n+1+": "+t[n];return t.join("\n")}function Sn(e,t){var n;return e==="fragment"?n=V.createShader(V.FRAGMENT_SHADER):e==="vertex"&&(n=V.createShader(V.VERTEX_SHADER)),V.shaderSource(n,t),V.compileShader(n),V.getShaderParameter(n,V.COMPILE_STATUS)?n:(console.error(V.getShaderInfoLog(n)),console.error(En(t)),null)}function xn(e){return(e&e-1)===0}function Tn(e,t,n){n?(V.texParameteri(e,V.TEXTURE_WRAP_S,_n(t.wrapS)),V.texParameteri(e,V.TEXTURE_WRAP_T,_n(t.wrapT)),V.texParameteri(e,V.TEXTURE_MAG_FILTER,_n(t.magFilter)),V.texParameteri(e,V.TEXTURE_MIN_FILTER,_n(t.minFilter))):(V.texParameteri(e,V.TEXTURE_WRAP_S,V.CLAMP_TO_EDGE),V.texParameteri(e,V.TEXTURE_WRAP_T,V.CLAMP_TO_EDGE),V.texParameteri(e,V.TEXTURE_MAG_FILTER,Mn(t.magFilter)),V.texParameteri(e,V.TEXTURE_MIN_FILTER,Mn(t.minFilter))),K&&t.type!==THREE.FloatType&&(t.anisotropy>1||t.__oldAnisotropy)&&(V.texParameterf(e,K.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(t.anisotropy,tt)),t.__oldAnisotropy=t.anisotropy)}function Nn(e,t){if(e.width<=t&&e
  .height<=t)return e;var n=Math.max(e.width,e.height),r=Math.floor(e.width*t/n),i=Math.floor(e.height*t/n),s=document.createElement("canvas");s.width=r,s.height=i;var o=s.getContext("2d");return o.drawImage(e,0,0,e.width,e.height,0,0,r,i),s}function Cn(e,t){if(e.image.length===6)if(e.needsUpdate){e.image.__webglTextureCube||(e.image.__webglTextureCube=V.createTexture(),l.info.memory.textures++),V.activeTexture(V.TEXTURE0+t),V.bindTexture(V.TEXTURE_CUBE_MAP,e.image.__webglTextureCube),V.pixelStorei(V.UNPACK_FLIP_Y_WEBGL,e.flipY);var n=e instanceof THREE.CompressedTexture,r=[];for(var i=0;i<6;i++)l.autoScaleCubemaps&&!n?r[i]=Nn(e.image[i],et):r[i]=e.image[i];var s=r[0],o=xn(s.width)&&xn(s.height),u=_n(e.format),a=_n(e.type);Tn(V.TEXTURE_CUBE_MAP,e,o);for(var i=0;i<6;i++)if(n){var f,c=r[i].mipmaps;for(var h=0,p=c.length;h<p;h++)f=c[h],V.compressedTexImage2D(V.TEXTURE_CUBE_MAP_POSITIVE_X+i,h,u,f.width,f.height,0,f.data)}else V.texImage2D(V.TEXTURE_CUBE_MAP_POSITIVE_X+i,0,u,u,a,r[i]);e.generateMipmaps&&o&&V.generateMipmap
  (V.TEXTURE_CUBE_MAP),e.needsUpdate=!1,e.onUpdate&&e.onUpdate()}else V.activeTexture(V.TEXTURE0+t),V.bindTexture(V.TEXTURE_CUBE_MAP,e.image.__webglTextureCube)}function kn(e,t){V.activeTexture(V.TEXTURE0+t),V.bindTexture(V.TEXTURE_CUBE_MAP,e.__webglTexture)}function Ln(e,t,n){V.bindFramebuffer(V.FRAMEBUFFER,e),V.framebufferTexture2D(V.FRAMEBUFFER,V.COLOR_ATTACHMENT0,n,t.__webglTexture,0)}function An(e,t){V.bindRenderbuffer(V.RENDERBUFFER,e),t.depthBuffer&&!t.stencilBuffer?(V.renderbufferStorage(V.RENDERBUFFER,V.DEPTH_COMPONENT16,t.width,t.height),V.framebufferRenderbuffer(V.FRAMEBUFFER,V.DEPTH_ATTACHMENT,V.RENDERBUFFER,e)):t.depthBuffer&&t.stencilBuffer?(V.renderbufferStorage(V.RENDERBUFFER,V.DEPTH_STENCIL,t.width,t.height),V.framebufferRenderbuffer(V.FRAMEBUFFER,V.DEPTH_STENCIL_ATTACHMENT,V.RENDERBUFFER,e)):V.renderbufferStorage(V.RENDERBUFFER,V.RGBA4,t.width,t.height)}function On(e){e instanceof THREE.WebGLRenderTargetCube?(V.bindTexture(V.TEXTURE_CUBE_MAP,e.__webglTexture),V.generateMipmap(V.TEXTURE_CUBE_MAP
  ),V.bindTexture(V.TEXTURE_CUBE_MAP,null)):(V.bindTexture(V.TEXTURE_2D,e.__webglTexture),V.generateMipmap(V.TEXTURE_2D),V.bindTexture(V.TEXTURE_2D,null))}function Mn(e){return e===THREE.NearestFilter||e===THREE.NearestMipMapNearestFilter||e===THREE.NearestMipMapLinearFilter?V.NEAREST:V.LINEAR}function _n(e){if(e===THREE.RepeatWrapping)return V.REPEAT;if(e===THREE.ClampToEdgeWrapping)return V.CLAMP_TO_EDGE;if(e===THREE.MirroredRepeatWrapping)return V.MIRRORED_REPEAT;if(e===THREE.NearestFilter)return V.NEAREST;if(e===THREE.NearestMipMapNearestFilter)return V.NEAREST_MIPMAP_NEAREST;if(e===THREE.NearestMipMapLinearFilter)return V.NEAREST_MIPMAP_LINEAR;if(e===THREE.LinearFilter)return V.LINEAR;if(e===THREE.LinearMipMapNearestFilter)return V.LINEAR_MIPMAP_NEAREST;if(e===THREE.LinearMipMapLinearFilter)return V.LINEAR_MIPMAP_LINEAR;if(e===THREE.UnsignedByteType)return V.UNSIGNED_BYTE;if(e===THREE.UnsignedShort4444Type)return V.UNSIGNED_SHORT_4_4_4_4;if(e===THREE.UnsignedShort5551Type)return V.UNSIGNED_SHORT_5_5_5_1;if(
  e===THREE.UnsignedShort565Type)return V.UNSIGNED_SHORT_5_6_5;if(e===THREE.ByteType)return V.BYTE;if(e===THREE.ShortType)return V.SHORT;if(e===THREE.UnsignedShortType)return V.UNSIGNED_SHORT;if(e===THREE.IntType)return V.INT;if(e===THREE.UnsignedIntType)return V.UNSIGNED_INT;if(e===THREE.FloatType)return V.FLOAT;if(e===THREE.AlphaFormat)return V.ALPHA;if(e===THREE.RGBFormat)return V.RGB;if(e===THREE.RGBAFormat)return V.RGBA;if(e===THREE.LuminanceFormat)return V.LUMINANCE;if(e===THREE.LuminanceAlphaFormat)return V.LUMINANCE_ALPHA;if(e===THREE.AddEquation)return V.FUNC_ADD;if(e===THREE.SubtractEquation)return V.FUNC_SUBTRACT;if(e===THREE.ReverseSubtractEquation)return V.FUNC_REVERSE_SUBTRACT;if(e===THREE.ZeroFactor)return V.ZERO;if(e===THREE.OneFactor)return V.ONE;if(e===THREE.SrcColorFactor)return V.SRC_COLOR;if(e===THREE.OneMinusSrcColorFactor)return V.ONE_MINUS_SRC_COLOR;if(e===THREE.SrcAlphaFactor)return V.SRC_ALPHA;if(e===THREE.OneMinusSrcAlphaFactor)return V.ONE_MINUS_SRC_ALPHA;if(e===THREE.DstAlphaFactor)return V
  .DST_ALPHA;if(e===THREE.OneMinusDstAlphaFactor)return V.ONE_MINUS_DST_ALPHA;if(e===THREE.DstColorFactor)return V.DST_COLOR;if(e===THREE.OneMinusDstColorFactor)return V.ONE_MINUS_DST_COLOR;if(e===THREE.SrcAlphaSaturateFactor)return V.SRC_ALPHA_SATURATE;if(Q!==undefined){if(e===THREE.RGB_S3TC_DXT1_Format)return Q.COMPRESSED_RGB_S3TC_DXT1_EXT;if(e===THREE.RGBA_S3TC_DXT1_Format)return Q.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(e===THREE.RGBA_S3TC_DXT3_Format)return Q.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(e===THREE.RGBA_S3TC_DXT5_Format)return Q.COMPRESSED_RGBA_S3TC_DXT5_EXT}return 0}function Dn(e){if(rt&&e&&e.useVertexTexture)return 1024;var t=V.getParameter(V.MAX_VERTEX_UNIFORM_VECTORS),n=Math.floor((t-20)/4),r=n;return e!==undefined&&e instanceof THREE.SkinnedMesh&&(r=Math.min(e.bones.length,r),r<e.bones.length&&console.warn("WebGLRenderer: too many bones - "+e.bones.length+", this GPU supports just "+r+" (try OpenGL instead of ANGLE)")),r}function Pn(e){var t,n,r,i,s,o,u;i=s=o=u=0;for(t=0,n=e.length;t<n;t++){r=e[t];if(r.onlyShadow
  )continue;r instanceof THREE.DirectionalLight&&i++,r instanceof THREE.PointLight&&s++,r instanceof THREE.SpotLight&&o++,r instanceof THREE.HemisphereLight&&u++}return{directional:i,point:s,spot:o,hemi:u}}function Hn(e){var t,n,r,i=0;for(t=0,n=e.length;t<n;t++){r=e[t];if(!r.castShadow)continue;r instanceof THREE.SpotLight&&i++,r instanceof THREE.DirectionalLight&&!r.shadowCascade&&i++}return i}function Bn(){try{if(!(V=t.getContext("experimental-webgl",{alpha:r,premultipliedAlpha:i,antialias:s,stencil:o,preserveDrawingBuffer:u})))throw"Error creating WebGL context."}catch(e){console.error(e)}$=V.getExtension("OES_texture_float"),J=V.getExtension("OES_standard_derivatives"),K=V.getExtension("EXT_texture_filter_anisotropic")||V.getExtension("MOZ_EXT_texture_filter_anisotropic")||V.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),Q=V.getExtension("WEBGL_compressed_texture_s3tc")||V.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||V.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc"),$||console.log("THREE.WebGLRenderer: Float textures not supported."
  ),J||console.log("THREE.WebGLRenderer: Standard derivatives not supported."),K||console.log("THREE.WebGLRenderer: Anisotropic texture filtering not supported."),Q||console.log("THREE.WebGLRenderer: S3TC compressed textures not supported.")}function jn(){V.clearColor(0,0,0,1),V.clearDepth(1),V.clearStencil(0),V.enable(V.DEPTH_TEST),V.depthFunc(V.LEQUAL),V.frontFace(V.CCW),V.cullFace(V.BACK),V.enable(V.CULL_FACE),V.enable(V.BLEND),V.blendEquation(V.FUNC_ADD),V.blendFunc(V.SRC_ALPHA,V.ONE_MINUS_SRC_ALPHA),V.clearColor(a.r,a.g,a.b,f)}console.log("THREE.WebGLRenderer",THREE.REVISION),e=e||{};var t=e.canvas!==undefined?e.canvas:document.createElement("canvas"),n=e.precision!==undefined?e.precision:"highp",r=e.alpha!==undefined?e.alpha:!0,i=e.premultipliedAlpha!==undefined?e.premultipliedAlpha:!0,s=e.antialias!==undefined?e.antialias:!1,o=e.stencil!==undefined?e.stencil:!0,u=e.preserveDrawingBuffer!==undefined?e.preserveDrawingBuffer:!1,a=e.clearColor!==undefined?new THREE.Color(e.clearColor):new THREE.Color(0),f=e.clearAlpha!==
  undefined?e.clearAlpha:0;this.domElement=t,this.context=null,this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.autoUpdateObjects=!0,this.autoUpdateScene=!0,this.gammaInput=!1,this.gammaOutput=!1,this.physicallyBasedShading=!1,this.shadowMapEnabled=!1,this.shadowMapAutoUpdate=!0,this.shadowMapSoft=!0,this.shadowMapCullFace=THREE.CullFaceFront,this.shadowMapDebug=!1,this.shadowMapCascade=!1,this.maxMorphTargets=8,this.maxMorphNormals=4,this.autoScaleCubemaps=!0,this.renderPluginsPre=[],this.renderPluginsPost=[],this.info={memory:{programs:0,geometries:0,textures:0},render:{calls:0,vertices:0,faces:0,points:0}};var l=this,c=[],h=0,p=null,d=null,v=-1,m=null,g=null,y=0,b=0,w=-1,E=-1,S=-1,x=-1,T=-1,N=-1,C=-1,k=-1,L=null,A=null,O=null,M=null,_=0,D=0,P=0,H=0,B=0,j=0,F={},I=new THREE.Frustum,q=new THREE.Matrix4,R=new THREE.Matrix4,U=new THREE.Vector4,z=new THREE.Vector3,W=!0,X={ambient:[0,0,0],directional:{length:0,colors:new Array,positions:new Array},point
  :{length:0,colors:new Array,positions:new Array,distances:new Array},spot:{length:0,colors:new Array,positions:new Array,distances:new Array,directions:new Array,anglesCos:new Array,exponents:new Array},hemi:{length:0,skyColors:new Array,groundColors:new Array,positions:new Array}},V,$,J,K,Q;Bn(),jn(),this.context=V;var G=V.getParameter(V.MAX_TEXTURE_IMAGE_UNITS),Y=V.getParameter(V.MAX_VERTEX_TEXTURE_IMAGE_UNITS),Z=V.getParameter(V.MAX_TEXTURE_SIZE),et=V.getParameter(V.MAX_CUBE_MAP_TEXTURE_SIZE),tt=K?V.getParameter(K.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0,nt=Y>0,rt=nt&&$,it=Q?V.getParameter(V.COMPRESSED_TEXTURE_FORMATS):[];this.getContext=function(){return V},this.supportsVertexTextures=function(){return nt},this.getMaxAnisotropy=function(){return tt},this.setSize=function(e,n){t.width=e,t.height=n,this.setViewport(0,0,t.width,t.height)},this.setViewport=function(e,n,r,i){_=e!==undefined?e:0,D=n!==undefined?n:0,P=r!==undefined?r:t.width,H=i!==undefined?i:t.height,V.viewport(_,D,P,H)},this.setScissor=function(e,t,n,
  r){V.scissor(e,t,n,r)},this.enableScissorTest=function(e){e?V.enable(V.SCISSOR_TEST):V.disable(V.SCISSOR_TEST)},this.setClearColorHex=function(e,t){a.setHex(e),f=t,V.clearColor(a.r,a.g,a.b,f)},this.setClearColor=function(e,t){a.copy(e),f=t,V.clearColor(a.r,a.g,a.b,f)},this.getClearColor=function(){return a},this.getClearAlpha=function(){return f},this.clear=function(e,t,n){var r=0;if(e===undefined||e)r|=V.COLOR_BUFFER_BIT;if(t===undefined||t)r|=V.DEPTH_BUFFER_BIT;if(n===undefined||n)r|=V.STENCIL_BUFFER_BIT;V.clear(r)},this.clearTarget=function(e,t,n,r){this.setRenderTarget(e),this.clear(t,n,r)},this.addPostPlugin=function(e){e.init(this),this.renderPluginsPost.push(e)},this.addPrePlugin=function(e){e.init(this),this.renderPluginsPre.push(e)},this.deallocateObject=function(e){if(!e.__webglInit)return;e.__webglInit=!1,delete e._modelViewMatrix,delete e._normalMatrix;if(e instanceof THREE.Mesh)for(var t in e.geometry.geometryGroups)ht(e.geometry.geometryGroups[t]);else e instanceof THREE.Ribbon?ct(e.geometry):e instanceof 
  THREE.Line?lt(e.geometry):e instanceof THREE.ParticleSystem&&ft(e.geometry)},this.deallocateTexture=function(e){if(e.image&&e.image.__webglTextureCube)V.deleteTexture(e.image.__webglTextureCube);else{if(!e.__webglInit)return;e.__webglInit=!1,V.deleteTexture(e.__webglTexture)}l.info.memory.textures--},this.deallocateRenderTarget=function(e){if(!e||!e.__webglTexture)return;V.deleteTexture(e.__webglTexture);if(e instanceof THREE.WebGLRenderTargetCube)for(var t=0;t<6;t++)V.deleteFramebuffer(e.__webglFramebuffer[t]),V.deleteRenderbuffer(e.__webglRenderbuffer[t]);else V.deleteFramebuffer(e.__webglFramebuffer),V.deleteRenderbuffer(e.__webglRenderbuffer)},this.deallocateMaterial=function(e){var t=e.program;if(!t)return;e.program=undefined;var n,r,i,s=!1;for(n=0,r=c.length;n<r;n++){i=c[n];if(i.program===t){i.usedTimes--,i.usedTimes===0&&(s=!0);break}}if(s){var o=[];for(n=0,r=c.length;n<r;n++)i=c[n],i.program!==t&&o.push(i);c=o,V.deleteProgram(t),l.info.memory.programs--}},this.updateShadowMap=function(e,t){p=null,S=-1,
  C=-1,k=-1,m=-1,v=-1,W=!0,w=-1,E=-1,this.shadowMapPlugin.update(e,t)},this.renderBufferImmediate=function(e,t,n){e.hasPositions&&!e.__webglVertexBuffer&&(e.__webglVertexBuffer=V.createBuffer()),e.hasNormals&&!e.__webglNormalBuffer&&(e.__webglNormalBuffer=V.createBuffer()),e.hasUvs&&!e.__webglUvBuffer&&(e.__webglUvBuffer=V.createBuffer()),e.hasColors&&!e.__webglColorBuffer&&(e.__webglColorBuffer=V.createBuffer()),e.hasPositions&&(V.bindBuffer(V.ARRAY_BUFFER,e.__webglVertexBuffer),V.bufferData(V.ARRAY_BUFFER,e.positionArray,V.DYNAMIC_DRAW),V.enableVertexAttribArray(t.attributes.position),V.vertexAttribPointer(t.attributes.position,3,V.FLOAT,!1,0,0));if(e.hasNormals){V.bindBuffer(V.ARRAY_BUFFER,e.__webglNormalBuffer);if(n.shading===THREE.FlatShading){var r,i,s,o,u,a,f,l,c,h,p,d,v,m,g=e.count*3;for(m=0;m<g;m+=9)v=e.normalArray,o=v[m],f=v[m+1],h=v[m+2],u=v[m+3],l=v[m+4],p=v[m+5],a=v[m+6],c=v[m+7],d=v[m+8],r=(o+u+a)/3,i=(f+l+c)/3,s=(h+p+d)/3,v[m]=r,v[m+1]=i,v[m+2]=s,v[m+3]=r,v[m+4]=i,v[m+5]=s,v[m+6]=r,v[m+7]=i,v[m+8]=
  s}V.bufferData(V.ARRAY_BUFFER,e.normalArray,V.DYNAMIC_DRAW),V.enableVertexAttribArray(t.attributes.normal),V.vertexAttribPointer(t.attributes.normal,3,V.FLOAT,!1,0,0)}e.hasUvs&&n.map&&(V.bindBuffer(V.ARRAY_BUFFER,e.__webglUvBuffer),V.bufferData(V.ARRAY_BUFFER,e.uvArray,V.DYNAMIC_DRAW),V.enableVertexAttribArray(t.attributes.uv),V.vertexAttribPointer(t.attributes.uv,2,V.FLOAT,!1,0,0)),e.hasColors&&n.vertexColors!==THREE.NoColors&&(V.bindBuffer(V.ARRAY_BUFFER,e.__webglColorBuffer),V.bufferData(V.ARRAY_BUFFER,e.colorArray,V.DYNAMIC_DRAW),V.enableVertexAttribArray(t.attributes.color),V.vertexAttribPointer(t.attributes.color,3,V.FLOAT,!1,0,0)),V.drawArrays(V.TRIANGLES,0,e.count),e.count=0},this.renderBufferDirect=function(e,t,n,r,i,s){if(r.visible===!1)return;var o,u,a,f,c,h;o=Gt(e,t,n,r,s),u=o.attributes;var p=!1,d=r.wireframe?1:0,v=i.id*16777215+o.id*2+d;v!==m&&(m=v,p=!0),p&&Mt();if(s instanceof THREE.Mesh){var g=i.attributes.index;if(g){var y=i.offsets;y.length>1&&(p=!0);for(var b=0,w=y.length;b<w;b++){var E=y[b]
  .index;if(p){var S=i.attributes.position,x=S.itemSize;V.bindBuffer(V.ARRAY_BUFFER,S.buffer),Ot(u.position),V.vertexAttribPointer(u.position,x,V.FLOAT,!1,0,E*x*4);var T=i.attributes.normal;if(u.normal>=0&&T){var N=T.itemSize;V.bindBuffer(V.ARRAY_BUFFER,T.buffer),Ot(u.normal),V.vertexAttribPointer(u.normal,N,V.FLOAT,!1,0,E*N*4)}var C=i.attributes.uv;if(u.uv>=0&&C){var k=C.itemSize;V.bindBuffer(V.ARRAY_BUFFER,C.buffer),Ot(u.uv),V.vertexAttribPointer(u.uv,k,V.FLOAT,!1,0,E*k*4)}var L=i.attributes.color;if(u.color>=0&&L){var A=L.itemSize;V.bindBuffer(V.ARRAY_BUFFER,L.buffer),Ot(u.color),V.vertexAttribPointer(u.color,A,V.FLOAT,!1,0,E*A*4)}var O=i.attributes.tangent;if(u.tangent>=0&&O){var M=O.itemSize;V.bindBuffer(V.ARRAY_BUFFER,O.buffer),Ot(u.tangent),V.vertexAttribPointer(u.tangent,M,V.FLOAT,!1,0,E*M*4)}V.bindBuffer(V.ELEMENT_ARRAY_BUFFER,g.buffer)}V.drawElements(V.TRIANGLES,y[b].count,V.UNSIGNED_SHORT,y[b].start*2),l.info.render.calls++,l.info.render.vertices+=y[b].count,l.info.render.faces+=y[b].count/3}}else{if(
  p){var S=i.attributes.position,x=S.itemSize;V.bindBuffer(V.ARRAY_BUFFER,S.buffer),Ot(u.position),V.vertexAttribPointer(u.position,x,V.FLOAT,!1,0,0);var T=i.attributes.normal;if(u.normal>=0&&T){var N=T.itemSize;V.bindBuffer(V.ARRAY_BUFFER,T.buffer),Ot(u.normal),V.vertexAttribPointer(u.normal,N,V.FLOAT,!1,0,0)}var C=i.attributes.uv;if(u.uv>=0&&C){var k=C.itemSize;V.bindBuffer(V.ARRAY_BUFFER,C.buffer),Ot(u.uv),V.vertexAttribPointer(u.uv,k,V.FLOAT,!1,0,0)}var L=i.attributes.color;if(u.color>=0&&L){var A=L.itemSize;V.bindBuffer(V.ARRAY_BUFFER,L.buffer),Ot(u.color),V.vertexAttribPointer(u.color,A,V.FLOAT,!1,0,0)}var O=i.attributes.tangent;if(u.tangent>=0&&O){var M=O.itemSize;V.bindBuffer(V.ARRAY_BUFFER,O.buffer),Ot(u.tangent),V.vertexAttribPointer(u.tangent,M,V.FLOAT,!1,0,0)}}V.drawArrays(V.TRIANGLES,0,S.numItems/3),l.info.render.calls++,l.info.render.vertices+=S.numItems/3,l.info.render.faces+=S.numItems/3/3}}else if(s instanceof THREE.ParticleSystem&&p){var S=i.attributes.position,x=S.itemSize;V.bindBuffer(V.ARRAY_BUFFER
  ,S.buffer),Ot(u.position),V.vertexAttribPointer(u.position,x,V.FLOAT,!1,0,0);var L=i.attributes.color;if(u.color>=0&&L){var A=L.itemSize;V.bindBuffer(V.ARRAY_BUFFER,L.buffer),Ot(u.color),V.vertexAttribPointer(u.color,A,V.FLOAT,!1,0,0)}V.drawArrays(V.POINTS,0,S.numItems/3),l.info.render.calls++,l.info.render.points+=S.numItems/3}},this.renderBuffer=function(e,t,n,r,i,s){if(r.visible===!1)return;var o,u,a,f,c,h,p,d;o=Gt(e,t,n,r,s),u=o.attributes;var v=!1,g=r.wireframe?1:0,y=i.id*16777215+o.id*2+g;y!==m&&(m=y,v=!0),v&&Mt(),!r.morphTargets&&u.position>=0?v&&(V.bindBuffer(V.ARRAY_BUFFER,i.__webglVertexBuffer),Ot(u.position),V.vertexAttribPointer(u.position,3,V.FLOAT,!1,0,0)):s.morphTargetBase&&_t(r,i,s);if(v){if(i.__webglCustomAttributesList)for(p=0,d=i.__webglCustomAttributesList.length;p<d;p++)h=i.__webglCustomAttributesList[p],u[h.buffer.belongsToAttribute]>=0&&(V.bindBuffer(V.ARRAY_BUFFER,h.buffer),Ot(u[h.buffer.belongsToAttribute]),V.vertexAttribPointer(u[h.buffer.belongsToAttribute],h.size,V.FLOAT,!1,0,0));u.
  color>=0&&(V.bindBuffer(V.ARRAY_BUFFER,i.__webglColorBuffer),Ot(u.color),V.vertexAttribPointer(u.color,3,V.FLOAT,!1,0,0)),u.normal>=0&&(V.bindBuffer(V.ARRAY_BUFFER,i.__webglNormalBuffer),Ot(u.normal),V.vertexAttribPointer(u.normal,3,V.FLOAT,!1,0,0)),u.tangent>=0&&(V.bindBuffer(V.ARRAY_BUFFER,i.__webglTangentBuffer),Ot(u.tangent),V.vertexAttribPointer(u.tangent,4,V.FLOAT,!1,0,0)),u.uv>=0&&(V.bindBuffer(V.ARRAY_BUFFER,i.__webglUVBuffer),Ot(u.uv),V.vertexAttribPointer(u.uv,2,V.FLOAT,!1,0,0)),u.uv2>=0&&(V.bindBuffer(V.ARRAY_BUFFER,i.__webglUV2Buffer),Ot(u.uv2),V.vertexAttribPointer(u.uv2,2,V.FLOAT,!1,0,0)),r.skinning&&u.skinIndex>=0&&u.skinWeight>=0&&(V.bindBuffer(V.ARRAY_BUFFER,i.__webglSkinIndicesBuffer),Ot(u.skinIndex),V.vertexAttribPointer(u.skinIndex,4,V.FLOAT,!1,0,0),V.bindBuffer(V.ARRAY_BUFFER,i.__webglSkinWeightsBuffer),Ot(u.skinWeight),V.vertexAttribPointer(u.skinWeight,4,V.FLOAT,!1,0,0)),u.lineDistance>=0&&(V.bindBuffer(V.ARRAY_BUFFER,i.__webglLineDistanceBuffer),Ot(u.lineDistance),V.vertexAttribPointer(
  u.lineDistance,1,V.FLOAT,!1,0,0))}s instanceof THREE.Mesh?(r.wireframe?(vn(r.wireframeLinewidth),v&&V.bindBuffer(V.ELEMENT_ARRAY_BUFFER,i.__webglLineBuffer),V.drawElements(V.LINES,i.__webglLineCount,V.UNSIGNED_SHORT,0)):(v&&V.bindBuffer(V.ELEMENT_ARRAY_BUFFER,i.__webglFaceBuffer),V.drawElements(V.TRIANGLES,i.__webglFaceCount,V.UNSIGNED_SHORT,0)),l.info.render.calls++,l.info.render.vertices+=i.__webglFaceCount,l.info.render.faces+=i.__webglFaceCount/3):s instanceof THREE.Line?(f=s.type===THREE.LineStrip?V.LINE_STRIP:V.LINES,vn(r.linewidth),V.drawArrays(f,0,i.__webglLineCount),l.info.render.calls++):s instanceof THREE.ParticleSystem?(V.drawArrays(V.POINTS,0,i.__webglParticleCount),l.info.render.calls++,l.info.render.points+=i.__webglParticleCount):s instanceof THREE.Ribbon&&(V.drawArrays(V.TRIANGLE_STRIP,0,i.__webglVertexCount),l.info.render.calls++)},this.render=function(e,t,n,r){if(t instanceof THREE.Camera==0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}var i
  ,s,o,u,a,f=e.__lights,c=e.fog;v=-1,W=!0,this.autoUpdateScene&&e.updateMatrixWorld(),t.parent===undefined&&t.updateMatrixWorld(),t.matrixWorldInverse.getInverse(t.matrixWorld),q.multiply(t.projectionMatrix,t.matrixWorldInverse),I.setFromMatrix(q),this.autoUpdateObjects&&this.initWebGLObjects(e),Ht(this.renderPluginsPre,e,t),l.info.render.calls=0,l.info.render.vertices=0,l.info.render.faces=0,l.info.render.points=0,this.setRenderTarget(n),(this.autoClear||r)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil),a=e.__webglObjects;for(i=0,s=a.length;i<s;i++)o=a[i],u=o.object,o.render=!1,u.visible&&(!(u instanceof THREE.Mesh||u instanceof THREE.ParticleSystem)||!u.frustumCulled||I.contains(u))&&(cn(u,t),It(o),o.render=!0,this.sortObjects===!0&&(u.renderDepth!==null?o.z=u.renderDepth:(U.copy(u.matrixWorld.getPosition()),q.multiplyVector3(U),o.z=U.z),o.id=u.id));this.sortObjects&&a.sort(Dt),a=e.__webglObjectsImmediate;for(i=0,s=a.length;i<s;i++)o=a[i],u=o.object,u.visible&&(cn(u,t),Ft(o));if(e.overrideMaterial
  ){var h=e.overrideMaterial;this.setBlending(h.blending,h.blendEquation,h.blendSrc,h.blendDst),this.setDepthTest(h.depthTest),this.setDepthWrite(h.depthWrite),mn(h.polygonOffset,h.polygonOffsetFactor,h.polygonOffsetUnits),Bt(e.__webglObjects,!1,"",t,f,c,!0,h),jt(e.__webglObjectsImmediate,"",t,f,c,!1,h)}else{var h=null;this.setBlending(THREE.NoBlending),Bt(e.__webglObjects,!0,"opaque",t,f,c,!1,h),jt(e.__webglObjectsImmediate,"opaque",t,f,c,!1,h),Bt(e.__webglObjects,!1,"transparent",t,f,c,!0,h),jt(e.__webglObjectsImmediate,"transparent",t,f,c,!0,h)}Ht(this.renderPluginsPost,e,t),n&&n.generateMipmaps&&n.minFilter!==THREE.NearestFilter&&n.minFilter!==THREE.LinearFilter&&On(n),this.setDepthTest(!0),this.setDepthWrite(!0)},this.renderImmediateObject=function(e,t,n,r,i){var s=Gt(e,t,n,r,i);m=-1,l.setMaterialFaces(r),i.immediateRenderCallback?i.immediateRenderCallback(s,V,I):i.render(function(e){l.renderBufferImmediate(e,s,r)})},this.initWebGLObjects=function(e){e.__webglObjects||(e.__webglObjects=[],e.__webglObjectsImmediate=
  [],e.__webglSprites=[],e.__webglFlares=[]);while(e.__objectsAdded.length)Rt(e.__objectsAdded[0],e),e.__objectsAdded.splice(0,1);while(e.__objectsRemoved.length)$t(e.__objectsRemoved[0],e),e.__objectsRemoved.splice(0,1);for(var t=0,n=e.__webglObjects.length;t<n;t++)Wt(e.__webglObjects[t].object)},this.initMaterial=function(e,t,n,r){var i,s,o,u,a,f,l,c,h;e instanceof THREE.MeshDepthMaterial?h="depth":e instanceof THREE.MeshNormalMaterial?h="normal":e instanceof THREE.MeshBasicMaterial?h="basic":e instanceof THREE.MeshLambertMaterial?h="lambert":e instanceof THREE.MeshPhongMaterial?h="phong":e instanceof THREE.LineBasicMaterial?h="basic":e instanceof THREE.LineDashedMaterial?h="dashed":e instanceof THREE.ParticleBasicMaterial&&(h="particle_basic"),h&&Qt(e,THREE.ShaderLib[h]),f=Pn(t),c=Hn(t),l=Dn(r),a={map:!!e.map,envMap:!!e.envMap,lightMap:!!e.lightMap,bumpMap:!!e.bumpMap,normalMap:!!e.normalMap,specularMap:!!e.specularMap,vertexColors:e.vertexColors,fog:n,useFog:e.fog,fogExp:n instanceof THREE.FogExp2,sizeAttenuation
  :e.sizeAttenuation,skinning:e.skinning,maxBones:l,useVertexTexture:rt&&r&&r.useVertexTexture,boneTextureWidth:r&&r.boneTextureWidth,boneTextureHeight:r&&r.boneTextureHeight,morphTargets:e.morphTargets,morphNormals:e.morphNormals,maxMorphTargets:this.maxMorphTargets,maxMorphNormals:this.maxMorphNormals,maxDirLights:f.directional,maxPointLights:f.point,maxSpotLights:f.spot,maxHemiLights:f.hemi,maxShadows:c,shadowMapEnabled:this.shadowMapEnabled&&r.receiveShadow,shadowMapSoft:this.shadowMapSoft,shadowMapDebug:this.shadowMapDebug,shadowMapCascade:this.shadowMapCascade,alphaTest:e.alphaTest,metal:e.metal,perPixel:e.perPixel,wrapAround:e.wrapAround,doubleSided:e.side===THREE.DoubleSide,flipSided:e.side===THREE.BackSide},e.program=yn(h,e.fragmentShader,e.vertexShader,e.uniforms,e.attributes,e.defines,a);var p=e.program.attributes;if(e.morphTargets){e.numSupportedMorphTargets=0;var d,v="morphTarget";for(u=0;u<this.maxMorphTargets;u++)d=v+u,p[d]>=0&&e.numSupportedMorphTargets++}if(e.morphNormals){e.numSupportedMorphNormals=0
  ;var d,v="morphNormal";for(u=0;u<this.maxMorphNormals;u++)d=v+u,p[d]>=0&&e.numSupportedMorphNormals++}e.uniformsList=[];for(i in e.uniforms)e.uniformsList.push([e.uniforms[i],i])},this.setFaceCulling=function(e,t){e===THREE.CullFaceNone?V.disable(V.CULL_FACE):(t===THREE.FrontFaceDirectionCW?V.frontFace(V.CW):V.frontFace(V.CCW),e===THREE.CullFaceBack?V.cullFace(V.BACK):e===THREE.CullFaceFront?V.cullFace(V.FRONT):V.cullFace(V.FRONT_AND_BACK),V.enable(V.CULL_FACE))},this.setMaterialFaces=function(e){var t=e.side===THREE.DoubleSide,n=e.side===THREE.BackSide;w!==t&&(t?V.disable(V.CULL_FACE):V.enable(V.CULL_FACE),w=t),E!==n&&(n?V.frontFace(V.CW):V.frontFace(V.CCW),E=n)},this.setDepthTest=function(e){C!==e&&(e?V.enable(V.DEPTH_TEST):V.disable(V.DEPTH_TEST),C=e)},this.setDepthWrite=function(e){k!==e&&(V.depthMask(e),k=e)},this.setBlending=function(e,t,n,r){e!==S&&(e===THREE.NoBlending?V.disable(V.BLEND):e===THREE.AdditiveBlending?(V.enable(V.BLEND),V.blendEquation(V.FUNC_ADD),V.blendFunc(V.SRC_ALPHA,V.ONE)):e===THREE.
  SubtractiveBlending?(V.enable(V.BLEND),V.blendEquation(V.FUNC_ADD),V.blendFunc(V.ZERO,V.ONE_MINUS_SRC_COLOR)):e===THREE.MultiplyBlending?(V.enable(V.BLEND),V.blendEquation(V.FUNC_ADD),V.blendFunc(V.ZERO,V.SRC_COLOR)):e===THREE.CustomBlending?V.enable(V.BLEND):(V.enable(V.BLEND),V.blendEquationSeparate(V.FUNC_ADD,V.FUNC_ADD),V.blendFuncSeparate(V.SRC_ALPHA,V.ONE_MINUS_SRC_ALPHA,V.ONE,V.ONE_MINUS_SRC_ALPHA)),S=e);if(e===THREE.CustomBlending){t!==x&&(V.blendEquation(_n(t)),x=t);if(n!==T||r!==N)V.blendFunc(_n(n),_n(r)),T=n,N=r}else x=null,T=null,N=null},this.setTexture=function(e,t){if(e.needsUpdate){e.__webglInit||(e.__webglInit=!0,e.__webglTexture=V.createTexture(),l.info.memory.textures++),V.activeTexture(V.TEXTURE0+t),V.bindTexture(V.TEXTURE_2D,e.__webglTexture),V.pixelStorei(V.UNPACK_FLIP_Y_WEBGL,e.flipY),V.pixelStorei(V.UNPACK_PREMULTIPLY_ALPHA_WEBGL,e.premultiplyAlpha),V.pixelStorei(V.UNPACK_ALIGNMENT,e.unpackAlignment);var n=e.image,r=xn(n.width)&&xn(n.height),i=_n(e.format),s=_n(e.type);Tn(V.TEXTURE_2D,e,
  r);var o,u=e.mipmaps;if(e instanceof THREE.DataTexture)if(u.length>0&&r){for(var a=0,f=u.length;a<f;a++)o=u[a],V.texImage2D(V.TEXTURE_2D,a,i,o.width,o.height,0,i,s,o.data);e.generateMipmaps=!1}else V.texImage2D(V.TEXTURE_2D,0,i,n.width,n.height,0,i,s,n.data);else if(e instanceof THREE.CompressedTexture)for(var a=0,f=u.length;a<f;a++)o=u[a],V.compressedTexImage2D(V.TEXTURE_2D,a,i,o.width,o.height,0,o.data);else if(u.length>0&&r){for(var a=0,f=u.length;a<f;a++)o=u[a],V.texImage2D(V.TEXTURE_2D,a,i,i,s,o);e.generateMipmaps=!1}else V.texImage2D(V.TEXTURE_2D,0,i,i,s,e.image);e.generateMipmaps&&r&&V.generateMipmap(V.TEXTURE_2D),e.needsUpdate=!1,e.onUpdate&&e.onUpdate()}else V.activeTexture(V.TEXTURE0+t),V.bindTexture(V.TEXTURE_2D,e.__webglTexture)},this.setRenderTarget=function(e){var t=e instanceof THREE.WebGLRenderTargetCube;if(e&&!e.__webglFramebuffer){e.depthBuffer===undefined&&(e.depthBuffer=!0),e.stencilBuffer===undefined&&(e.stencilBuffer=!0),e.__webglTexture=V.createTexture(),l.info.memory.textures++;var n=xn
  (e.width)&&xn(e.height),r=_n(e.format),i=_n(e.type);if(t){e.__webglFramebuffer=[],e.__webglRenderbuffer=[],V.bindTexture(V.TEXTURE_CUBE_MAP,e.__webglTexture),Tn(V.TEXTURE_CUBE_MAP,e,n);for(var s=0;s<6;s++)e.__webglFramebuffer[s]=V.createFramebuffer(),e.__webglRenderbuffer[s]=V.createRenderbuffer(),V.texImage2D(V.TEXTURE_CUBE_MAP_POSITIVE_X+s,0,r,e.width,e.height,0,r,i,null),Ln(e.__webglFramebuffer[s],e,V.TEXTURE_CUBE_MAP_POSITIVE_X+s),An(e.__webglRenderbuffer[s],e);n&&V.generateMipmap(V.TEXTURE_CUBE_MAP)}else e.__webglFramebuffer=V.createFramebuffer(),e.__webglRenderbuffer=V.createRenderbuffer(),V.bindTexture(V.TEXTURE_2D,e.__webglTexture),Tn(V.TEXTURE_2D,e,n),V.texImage2D(V.TEXTURE_2D,0,r,e.width,e.height,0,r,i,null),Ln(e.__webglFramebuffer,e,V.TEXTURE_2D),An(e.__webglRenderbuffer,e),n&&V.generateMipmap(V.TEXTURE_2D);t?V.bindTexture(V.TEXTURE_CUBE_MAP,null):V.bindTexture(V.TEXTURE_2D,null),V.bindRenderbuffer(V.RENDERBUFFER,null),V.bindFramebuffer(V.FRAMEBUFFER,null)}var o,u,a,f,c;e?(t?o=e.__webglFramebuffer[e
  .activeCubeFace]:o=e.__webglFramebuffer,u=e.width,a=e.height,f=0,c=0):(o=null,u=P,a=H,f=_,c=D),o!==d&&(V.bindFramebuffer(V.FRAMEBUFFER,o),V.viewport(f,c,u,a),d=o),B=u,j=a},this.shadowMapPlugin=new THREE.ShadowMapPlugin,this.addPrePlugin(this.shadowMapPlugin),this.addPostPlugin(new THREE.SpritePlugin),this.addPostPlugin(new THREE.LensFlarePlugin)},THREE.WebGLRenderTarget=function(e,t,n){this.width=e,this.height=t,n=n||{},this.wrapS=n.wrapS!==undefined?n.wrapS:THREE.ClampToEdgeWrapping,this.wrapT=n.wrapT!==undefined?n.wrapT:THREE.ClampToEdgeWrapping,this.magFilter=n.magFilter!==undefined?n.magFilter:THREE.LinearFilter,this.minFilter=n.minFilter!==undefined?n.minFilter:THREE.LinearMipMapLinearFilter,this.anisotropy=n.anisotropy!==undefined?n.anisotropy:1,this.offset=new THREE.Vector2(0,0),this.repeat=new THREE.Vector2(1,1),this.format=n.format!==undefined?n.format:THREE.RGBAFormat,this.type=n.type!==undefined?n.type:THREE.UnsignedByteType,this.depthBuffer=n.depthBuffer!==undefined?n.depthBuffer:!0,this.stencilBuffer=
  n.stencilBuffer!==undefined?n.stencilBuffer:!0,this.generateMipmaps=!0},THREE.WebGLRenderTarget.prototype.clone=function(){var e=new THREE.WebGLRenderTarget(this.width,this.height);return e.wrapS=this.wrapS,e.wrapT=this.wrapT,e.magFilter=this.magFilter,e.anisotropy=this.anisotropy,e.minFilter=this.minFilter,e.offset.copy(this.offset),e.repeat.copy(this.repeat),e.format=this.format,e.type=this.type,e.depthBuffer=this.depthBuffer,e.stencilBuffer=this.stencilBuffer,e.generateMipmaps=this.generateMipmaps,e},THREE.WebGLRenderTargetCube=function(e,t,n){THREE.WebGLRenderTarget.call(this,e,t,n),this.activeCubeFace=0},THREE.WebGLRenderTargetCube.prototype=Object.create(THREE.WebGLRenderTarget.prototype),THREE.RenderableVertex=function(){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.RenderableFace3=function(){this.v1=new THREE.RenderableVertex
  ,this.v2=new THREE.RenderableVertex,this.v3=new THREE.RenderableVertex,this.centroidWorld=new THREE.Vector3,this.centroidScreen=new THREE.Vector3,this.normalWorld=new THREE.Vector3,this.vertexNormalsWorld=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3],this.vertexNormalsLength=0,this.color=null,this.material=null,this.uvs=[[]],this.z=null},THREE.RenderableFace4=function(){this.v1=new THREE.RenderableVertex,this.v2=new THREE.RenderableVertex,this.v3=new THREE.RenderableVertex,this.v4=new THREE.RenderableVertex,this.centroidWorld=new THREE.Vector3,this.centroidScreen=new THREE.Vector3,this.normalWorld=new THREE.Vector3,this.vertexNormalsWorld=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3],this.vertexNormalsLength=0,this.color=null,this.material=null,this.uvs=[[]],this.z=null},THREE.RenderableObject=function(){this.object=null,this.z=null},THREE.RenderableParticle=function(){this.object=null,this.x=null,this.y=null,this.z=null,this.rotation=null,this.scale=new THREE.Vector2,this
  .material=null},THREE.RenderableLine=function(){this.z=null,this.v1=new THREE.RenderableVertex,this.v2=new THREE.RenderableVertex,this.material=null},THREE.ColorUtils={adjustHSV:function(e,t,n,r){var i=THREE.ColorUtils.__hsv;e.getHSV(i),i.h=THREE.Math.clamp(i.h+t,0,1),i.s=THREE.Math.clamp(i.s+n,0,1),i.v=THREE.Math.clamp(i.v+r,0,1),e.setHSV(i.h,i.s,i.v)}},THREE.ColorUtils.__hsv={h:0,s:0,v:0},THREE.GeometryUtils={merge:function(e,t){var n,r,i=e.vertices.length,s=e.faceVertexUvs[0].length,o=t instanceof THREE.Mesh?t.geometry:t,u=e.vertices,a=o.vertices,f=e.faces,l=o.faces,c=e.faceVertexUvs[0],h=o.faceVertexUvs[0];t instanceof THREE.Mesh&&(t.matrixAutoUpdate&&t.updateMatrix(),n=t.matrix,r=new THREE.Matrix4,r.extractRotation(n,t.scale));for(var p=0,d=a.length;p<d;p++){var v=a[p],m=v.clone();n&&n.multiplyVector3(m),u.push(m)}for(p=0,d=l.length;p<d;p++){var g=l[p],y,b,w,E=g.vertexNormals,S=g.vertexColors;g instanceof THREE.Face3?y=new THREE.Face3(g.a+i,g.b+i,g.c+i):g instanceof THREE.Face4&&(y=new THREE.Face4(g.a+i,g
  .b+i,g.c+i,g.d+i)),y.normal.copy(g.normal),r&&r.multiplyVector3(y.normal);for(var x=0,T=E.length;x<T;x++)b=E[x].clone(),r&&r.multiplyVector3(b),y.vertexNormals.push(b);y.color.copy(g.color);for(var x=0,T=S.length;x<T;x++)w=S[x],y.vertexColors.push(w.clone());y.materialIndex=g.materialIndex,y.centroid.copy(g.centroid),n&&n.multiplyVector3(y.centroid),f.push(y)}for(p=0,d=h.length;p<d;p++){var N=h[p],C=[];for(var x=0,T=N.length;x<T;x++)C.push(new THREE.UV(N[x].u,N[x].v));c.push(C)}},removeMaterials:function(e,t){var n={};for(var r=0,i=t.length;r<i;r++)n[t[r]]=!0;var s,o=[];for(var r=0,i=e.faces.length;r<i;r++)s=e.faces[r],s.materialIndex in n||o.push(s);e.faces=o},randomPointInTriangle:function(e,t,n){var r,i,s,o=new THREE.Vector3,u=THREE.GeometryUtils.__v1;return r=THREE.GeometryUtils.random(),i=THREE.GeometryUtils.random(),r+i>1&&(r=1-r,i=1-i),s=1-r-i,o.copy(e),o.multiplyScalar(r),u.copy(t),u.multiplyScalar(i),o.addSelf(u),u.copy(n),u.multiplyScalar(s),o.addSelf(u),o},randomPointInFace:function(e,t,n){var r,i,s
  ,o;if(e instanceof THREE.Face3)return r=t.vertices[e.a],i=t.vertices[e.b],s=t.vertices[e.c],THREE.GeometryUtils.randomPointInTriangle(r,i,s);if(e instanceof THREE.Face4){r=t.vertices[e.a],i=t.vertices[e.b],s=t.vertices[e.c],o=t.vertices[e.d];var u,a;n?e._area1&&e._area2?(u=e._area1,a=e._area2):(u=THREE.GeometryUtils.triangleArea(r,i,o),a=THREE.GeometryUtils.triangleArea(i,s,o),e._area1=u,e._area2=a):(u=THREE.GeometryUtils.triangleArea(r,i,o),a=THREE.GeometryUtils.triangleArea(i,s,o));var f=THREE.GeometryUtils.random()*(u+a);return f<u?THREE.GeometryUtils.randomPointInTriangle(r,i,o):THREE.GeometryUtils.randomPointInTriangle(i,s,o)}},randomPointsInGeometry:function(e,t){function p(e){function t(n,r){if(r<n)return n;var i=n+Math.floor((r-n)/2);return a[i]>e?t(n,i-1):a[i]<e?t(i+1,r):i}var n=t(0,a.length-1);return n}var n,r,i=e.faces,s=e.vertices,o=i.length,u=0,a=[],f,l,c,h;for(r=0;r<o;r++)n=i[r],n instanceof THREE.Face3?(f=s[n.a],l=s[n.b],c=s[n.c],n._area=THREE.GeometryUtils.triangleArea(f,l,c)):n instanceof THREE
  .Face4&&(f=s[n.a],l=s[n.b],c=s[n.c],h=s[n.d],n._area1=THREE.GeometryUtils.triangleArea(f,l,h),n._area2=THREE.GeometryUtils.triangleArea(l,c,h),n._area=n._area1+n._area2),u+=n._area,a[r]=u;var d,v,m=[],g={};for(r=0;r<t;r++)d=THREE.GeometryUtils.random()*u,v=p(d),m[r]=THREE.GeometryUtils.randomPointInFace(i[v],e,!0),g[v]?g[v]+=1:g[v]=1;return m},triangleArea:function(e,t,n){var r,i,s,o,u=THREE.GeometryUtils.__v1;return u.sub(e,t),i=u.length(),u.sub(e,n),s=u.length(),u.sub(t,n),o=u.length(),r=.5*(i+s+o),Math.sqrt(r*(r-i)*(r-s)*(r-o))},center:function(e){e.computeBoundingBox();var t=e.boundingBox,n=new THREE.Vector3;return n.add(t.min,t.max),n.multiplyScalar(-0.5),e.applyMatrix((new THREE.Matrix4).makeTranslation(n.x,n.y,n.z)),e.computeBoundingBox(),n},normalizeUVs:function(e){var t=e.faceVertexUvs[0];for(var n=0,r=t.length;n<r;n++){var i=t[n];for(var s=0,o=i.length;s<o;s++)i[s].u!==1&&(i[s].u=i[s].u-Math.floor(i[s].u)),i[s].v!==1&&(i[s].v=i[s].v-Math.floor(i[s].v))}},triangulateQuads:function(e){var t,n,r,i,s=[],
  o=[],u=[];for(t=0,n=e.faceUvs.length;t<n;t++)o[t]=[];for(t=0,n=e.faceVertexUvs.length;t<n;t++)u[t]=[];for(t=0,n=e.faces.length;t<n;t++){var a=e.faces[t];if(a instanceof THREE.Face4){var f=a.a,l=a.b,c=a.c,h=a.d,p=new THREE.Face3,d=new THREE.Face3;p.color.copy(a.color),d.color.copy(a.color),p.materialIndex=a.materialIndex,d.materialIndex=a.materialIndex,p.a=f,p.b=l,p.c=h,d.a=l,d.b=c,d.c=h,a.vertexColors.length===4&&(p.vertexColors[0]=a.vertexColors[0].clone(),p.vertexColors[1]=a.vertexColors[1].clone(),p.vertexColors[2]=a.vertexColors[3].clone(),d.vertexColors[0]=a.vertexColors[1].clone(),d.vertexColors[1]=a.vertexColors[2].clone(),d.vertexColors[2]=a.vertexColors[3].clone()),s.push(p,d);for(r=0,i=e.faceVertexUvs.length;r<i;r++)if(e.faceVertexUvs[r].length){var v=e.faceVertexUvs[r][t],m=v[0],g=v[1],y=v[2],b=v[3],w=[m.clone(),g.clone(),b.clone()],E=[g.clone(),y.clone(),b.clone()];u[r].push(w,E)}for(r=0,i=e.faceUvs.length;r<i;r++)if(e.faceUvs[r].length){var S=e.faceUvs[r][t];o[r].push(S,S)}}else{s.push(a);for(r=0,
  i=e.faceUvs.length;r<i;r++)o[r].push(e.faceUvs[r][t]);for(r=0,i=e.faceVertexUvs.length;r<i;r++)u[r].push(e.faceVertexUvs[r][t])}}e.faces=s,e.faceUvs=o,e.faceVertexUvs=u,e.computeCentroids(),e.computeFaceNormals(),e.computeVertexNormals(),e.hasTangents&&e.computeTangents()},explode:function(e){var t=[];for(var n=0,r=e.faces.length;n<r;n++){var i=t.length,s=e.faces[n];if(s instanceof THREE.Face4){var o=s.a,u=s.b,a=s.c,f=s.d,l=e.vertices[o],c=e.vertices[u],h=e.vertices[a],p=e.vertices[f];t.push(l.clone()),t.push(c.clone()),t.push(h.clone()),t.push(p.clone()),s.a=i,s.b=i+1,s.c=i+2,s.d=i+3}else{var o=s.a,u=s.b,a=s.c,l=e.vertices[o],c=e.vertices[u],h=e.vertices[a];t.push(l.clone()),t.push(c.clone()),t.push(h.clone()),s.a=i,s.b=i+1,s.c=i+2}}e.vertices=t,delete e.__tmpVertices},tessellate:function(e,t){var n,r,i,s,o,u,a,f,l,c,h,p,d,v,m,g,y,b,w,E,S,x,T,N,C,k,L,A,O,M,_,D,P,H=[],B=[];for(n=0,r=e.faceVertexUvs.length;n<r;n++)B[n]=[];for(n=0,r=e.faces.length;n<r;n++){i=e.faces[n];if(i instanceof THREE.Face3){s=i.a,o=i.b,u=
  i.c,f=e.vertices[s],l=e.vertices[o],c=e.vertices[u],p=f.distanceTo(l),d=l.distanceTo(c),v=f.distanceTo(c);if(p>t||d>t||v>t){y=e.vertices.length,O=i.clone(),M=i.clone(),p>=d&&p>=v?(E=f.clone(),E.lerpSelf(l,.5),O.a=s,O.b=y,O.c=u,M.a=y,M.b=o,M.c=u,i.vertexNormals.length===3&&(T=i.vertexNormals[0].clone(),T.lerpSelf(i.vertexNormals[1],.5),O.vertexNormals[1].copy(T),M.vertexNormals[0].copy(T)),i.vertexColors.length===3&&(k=i.vertexColors[0].clone(),k.lerpSelf(i.vertexColors[1],.5),O.vertexColors[1].copy(k),M.vertexColors[0].copy(k)),P=0):d>=p&&d>=v?(E=l.clone(),E.lerpSelf(c,.5),O.a=s,O.b=o,O.c=y,M.a=y,M.b=u,M.c=s,i.vertexNormals.length===3&&(T=i.vertexNormals[1].clone(),T.lerpSelf(i.vertexNormals[2],.5),O.vertexNormals[2].copy(T),M.vertexNormals[0].copy(T),M.vertexNormals[1].copy(i.vertexNormals[2]),M.vertexNormals[2].copy(i.vertexNormals[0])),i.vertexColors.length===3&&(k=i.vertexColors[1].clone(),k.lerpSelf(i.vertexColors[2],.5),O.vertexColors[2].copy(k),M.vertexColors[0].copy(k),M.vertexColors[1].copy(i.vertexColors
  [2]),M.vertexColors[2].copy(i.vertexColors[0])),P=1):(E=f.clone(),E.lerpSelf(c,.5),O.a=s,O.b=o,O.c=y,M.a=y,M.b=o,M.c=u,i.vertexNormals.length===3&&(T=i.vertexNormals[0].clone(),T.lerpSelf(i.vertexNormals[2],.5),O.vertexNormals[2].copy(T),M.vertexNormals[0].copy(T)),i.vertexColors.length===3&&(k=i.vertexColors[0].clone(),k.lerpSelf(i.vertexColors[2],.5),O.vertexColors[2].copy(k),M.vertexColors[0].copy(k)),P=2),H.push(O,M),e.vertices.push(E);var j,F,I,q,R,U,z,W,X;for(j=0,F=e.faceVertexUvs.length;j<F;j++)e.faceVertexUvs[j].length&&(I=e.faceVertexUvs[j][n],q=I[0],R=I[1],U=I[2],P===0?(z=q.clone(),z.lerpSelf(R,.5),W=[q.clone(),z.clone(),U.clone()],X=[z.clone(),R.clone(),U.clone()]):P===1?(z=R.clone(),z.lerpSelf(U,.5),W=[q.clone(),R.clone(),z.clone()],X=[z.clone(),U.clone(),q.clone()]):(z=q.clone(),z.lerpSelf(U,.5),W=[q.clone(),R.clone(),z.clone()],X=[z.clone(),R.clone(),U.clone()]),B[j].push(W,X))}else{H.push(i);for(j=0,F=e.faceVertexUvs.length;j<F;j++)B[j].push(e.faceVertexUvs[j][n])}}else{s=i.a,o=i.b,u=i.c,a=i.d,f=
  e.vertices[s],l=e.vertices[o],c=e.vertices[u],h=e.vertices[a],p=f.distanceTo(l),d=l.distanceTo(c),m=c.distanceTo(h),g=f.distanceTo(h);if(p>t||d>t||m>t||g>t){b=e.vertices.length,w=e.vertices.length+1,_=i.clone(),D=i.clone(),p>=d&&p>=m&&p>=g||m>=d&&m>=p&&m>=g?(S=f.clone(),S.lerpSelf(l,.5),x=c.clone(),x.lerpSelf(h,.5),_.a=s,_.b=b,_.c=w,_.d=a,D.a=b,D.b=o,D.c=u,D.d=w,i.vertexNormals.length===4&&(N=i.vertexNormals[0].clone(),N.lerpSelf(i.vertexNormals[1],.5),C=i.vertexNormals[2].clone(),C.lerpSelf(i.vertexNormals[3],.5),_.vertexNormals[1].copy(N),_.vertexNormals[2].copy(C),D.vertexNormals[0].copy(N),D.vertexNormals[3].copy(C)),i.vertexColors.length===4&&(L=i.vertexColors[0].clone(),L.lerpSelf(i.vertexColors[1],.5),A=i.vertexColors[2].clone(),A.lerpSelf(i.vertexColors[3],.5),_.vertexColors[1].copy(L),_.vertexColors[2].copy(A),D.vertexColors[0].copy(L),D.vertexColors[3].copy(A)),P=0):(S=l.clone(),S.lerpSelf(c,.5),x=h.clone(),x.lerpSelf(f,.5),_.a=s,_.b=o,_.c=b,_.d=w,D.a=w,D.b=b,D.c=u,D.d=a,i.vertexNormals.length===4&&(
  N=i.vertexNormals[1].clone(),N.lerpSelf(i.vertexNormals[2],.5),C=i.vertexNormals[3].clone(),C.lerpSelf(i.vertexNormals[0],.5),_.vertexNormals[2].copy(N),_.vertexNormals[3].copy(C),D.vertexNormals[0].copy(C),D.vertexNormals[1].copy(N)),i.vertexColors.length===4&&(L=i.vertexColors[1].clone(),L.lerpSelf(i.vertexColors[2],.5),A=i.vertexColors[3].clone(),A.lerpSelf(i.vertexColors[0],.5),_.vertexColors[2].copy(L),_.vertexColors[3].copy(A),D.vertexColors[0].copy(A),D.vertexColors[1].copy(L)),P=1),H.push(_,D),e.vertices.push(S,x);var j,F,I,q,R,U,V,$,J,K,Q;for(j=0,F=e.faceVertexUvs.length;j<F;j++)e.faceVertexUvs[j].length&&(I=e.faceVertexUvs[j][n],q=I[0],R=I[1],U=I[2],V=I[3],P===0?($=q.clone(),$.lerpSelf(R,.5),J=U.clone(),J.lerpSelf(V,.5),K=[q.clone(),$.clone(),J.clone(),V.clone()],Q=[$.clone(),R.clone(),U.clone(),J.clone()]):($=R.clone(),$.lerpSelf(U,.5),J=V.clone(),J.lerpSelf(q,.5),K=[q.clone(),R.clone(),$.clone(),J.clone()],Q=[J.clone(),$.clone(),U.clone(),V.clone()]),B[j].push(K,Q))}else{H.push(i);for(j=0,F=e.faceVertexUvs
  .length;j<F;j++)B[j].push(e.faceVertexUvs[j][n])}}}e.faces=H,e.faceVertexUvs=B}},THREE.GeometryUtils.random=THREE.Math.random16,THREE.GeometryUtils.__v1=new THREE.Vector3,THREE.ImageUtils={crossOrigin:"anonymous",loadTexture:function(e,t,n,r){var i=new Image,s=new THREE.Texture(i,t),o=new THREE.ImageLoader;return o.addEventListener("load",function(e){s.image=e.content,s.needsUpdate=!0,n&&n(s)}),o.addEventListener("error",function(e){r&&r(e.message)}),o.crossOrigin=this.crossOrigin,o.load(e,i),s.sourceFile=e,s},loadCompressedTexture:function(e,t,n,r){var i=new THREE.CompressedTexture;i.mapping=t;var s=new XMLHttpRequest;return s.onload=function(){var e=s.response,t=THREE.ImageUtils.parseDDS(e,!0);i.format=t.format,i.mipmaps=t.mipmaps,i.image.width=t.width,i.image.height=t.height,i.generateMipmaps=!1,i.needsUpdate=!0,n&&n(i)},s.onerror=r,s.open("GET",e,!0),s.responseType="arraybuffer",s.send(null),i},loadTextureCube:function(e,t,n,r){var i=[];i.loadCount=0;var s=new THREE.Texture;s.image=i,t!==undefined&&(s.mapping=
  t),s.flipY=!1;for(var o=0,u=e.length;o<u;++o){var a=new Image;i[o]=a,a.onload=function(){i.loadCount+=1,i.loadCount===6&&(s.needsUpdate=!0,n&&n(s))},a.onerror=r,a.crossOrigin=this.crossOrigin,a.src=e[o]}return s},loadCompressedTextureCube:function(e,t,n,r){var i=[];i.loadCount=0;var s=new THREE.CompressedTexture;s.image=i,t!==undefined&&(s.mapping=t),s.flipY=!1,s.generateMipmaps=!1;var o=function(e,t){return function(){var r=e.response,o=THREE.ImageUtils.parseDDS(r,!0);t.format=o.format,t.mipmaps=o.mipmaps,t.width=o.width,t.height=o.height,i.loadCount+=1,i.loadCount===6&&(s.format=o.format,s.needsUpdate=!0,n&&n(s))}};if(e instanceof Array)for(var u=0,a=e.length;u<a;++u){var f={};i[u]=f;var l=new XMLHttpRequest;l.onload=o(l,f),l.onerror=r;var c=e[u];l.open("GET",c,!0),l.responseType="arraybuffer",l.send(null)}else{var c=e,l=new XMLHttpRequest;l.onload=function(){var e=l.response,t=THREE.ImageUtils.parseDDS(e,!0);if(t.isCubemap){var r=t.mipmaps.length/t.mipmapCount;for(var o=0;o<r;o++){i[o]={mipmaps:[]};for(var u=0
  ;u<t.mipmapCount;u++)i[o].mipmaps.push(t.mipmaps[o*t.mipmapCount+u]),i[o].format=t.format,i[o].width=t.width,i[o].height=t.height}s.format=t.format,s.needsUpdate=!0,n&&n(s)}},l.onerror=r,l.open("GET",c,!0),l.responseType="arraybuffer",l.send(null)}return s},parseDDS:function(e,t){function A(e){return e.charCodeAt(0)+(e.charCodeAt(1)<<8)+(e.charCodeAt(2)<<16)+(e.charCodeAt(3)<<24)}function O(e){return String.fromCharCode(e&255,e>>8&255,e>>16&255,e>>24&255)}var n={mipmaps:[],width:0,height:0,format:null,mipmapCount:1},r=542327876,i=1,s=2,o=4,u=8,a=4096,f=131072,l=524288,c=8388608,h=8,p=4194304,d=4096,v=512,m=1024,g=2048,y=4096,b=8192,w=16384,E=32768,S=2097152,x=1,T=2,N=4,C=64,k=512,L=131072,M=A("DXT1"),_=A("DXT3"),D=A("DXT5"),P=31,H=0,B=1,j=2,F=3,I=4,q=7,R=20,U=21,z=27,W=28,X=29,V=30,$=new Int32Array(e,0,P);if($[H]!==r)return console.error("ImageUtils.parseDDS(): Invalid magic number in DDS header"),n;if(!$[R]&N)return console.error("ImageUtils.parseDDS(): Unsupported format, must contain a FourCC code"),n;var J
  ,K=$[U];switch(K){case M:J=8,n.format=THREE.RGB_S3TC_DXT1_Format;break;case _:J=16,n.format=THREE.RGBA_S3TC_DXT3_Format;break;case D:J=16,n.format=THREE.RGBA_S3TC_DXT5_Format;break;default:return console.error("ImageUtils.parseDDS(): Unsupported FourCC code: ",O(K)),n}n.mipmapCount=1,$[j]&f&&t!==!1&&(n.mipmapCount=Math.max(1,$[q])),n.isCubemap=$[W]&v?!0:!1,n.width=$[I],n.height=$[F];var Q=$[B]+4,G=n.width,Y=n.height,Z=n.isCubemap?6:1;for(var et=0;et<Z;et++){for(var tt=0;tt<n.mipmapCount;tt++){var nt=Math.max(4,G)/4*Math.max(4,Y)/4*J,rt=new Uint8Array(e,Q,nt),it={data:rt,width:G,height:Y};n.mipmaps.push(it),Q+=nt,G=Math.max(G*.5,1),Y=Math.max(Y*.5,1)}G=n.width,Y=n.height}return n},getNormalMap:function(e,t){var n=function(e,t){return[e[1]*t[2]-e[2]*t[1],e[2]*t[0]-e[0]*t[2],e[0]*t[1]-e[1]*t[0]]},r=function(e,t){return[e[0]-t[0],e[1]-t[1],e[2]-t[2]]},i=function(e){var t=Math.sqrt(e[0]*e[0]+e[1]*e[1]+e[2]*e[2]);return[e[0]/t,e[1]/t,e[2]/t]};t|=1;var s=e.width,o=e.height,u=document.createElement("canvas");u.width=s
  ,u.height=o;var a=u.getContext("2d");a.drawImage(e,0,0);var f=a.getImageData(0,0,s,o).data,l=a.createImageData(s,o),c=l.data;for(var h=0;h<s;h++)for(var p=0;p<o;p++){var d=p-1<0?0:p-1,v=p+1>o-1?o-1:p+1,m=h-1<0?0:h-1,g=h+1>s-1?s-1:h+1,y=[],b=[0,0,f[(p*s+h)*4]/255*t];y.push([-1,0,f[(p*s+m)*4]/255*t]),y.push([-1,-1,f[(d*s+m)*4]/255*t]),y.push([0,-1,f[(d*s+h)*4]/255*t]),y.push([1,-1,f[(d*s+g)*4]/255*t]),y.push([1,0,f[(p*s+g)*4]/255*t]),y.push([1,1,f[(v*s+g)*4]/255*t]),y.push([0,1,f[(v*s+h)*4]/255*t]),y.push([-1,1,f[(v*s+m)*4]/255*t]);var w=[],E=y.length;for(var S=0;S<E;S++){var x=y[S],T=y[(S+1)%E];x=r(x,b),T=r(T,b),w.push(i(n(x,T)))}var N=[0,0,0];for(var S=0;S<w.length;S++)N[0]+=w[S][0],N[1]+=w[S][1],N[2]+=w[S][2];N[0]/=w.length,N[1]/=w.length,N[2]/=w.length;var C=(p*s+h)*4;c[C]=(N[0]+1)/2*255|0,c[C+1]=(N[1]+1)/2*255|0,c[C+2]=N[2]*255|0,c[C+3]=255}return a.putImageData(l,0,0),u},generateDataTexture:function(e,t,n){var r=e*t,i=new Uint8Array(3*r),s=Math.floor(n.r*255),o=Math.floor(n.g*255),u=Math.floor(n.b*255);for(
  var a=0;a<r;a++)i[a*3]=s,i[a*3+1]=o,i[a*3+2]=u;var f=new THREE.DataTexture(i,e,t,THREE.RGBFormat);return f.needsUpdate=!0,f}},THREE.SceneUtils={createMultiMaterialObject:function(e,t){var n=new THREE.Object3D;for(var r=0,i=t.length;r<i;r++)n.add(new THREE.Mesh(e,t[r]));return n},detach:function(e,t,n){e.applyMatrix(t.matrixWorld),t.remove(e),n.add(e)},attach:function(e,t,n){var r=new THREE.Matrix4;r.getInverse(n.matrixWorld),e.applyMatrix(r),t.remove(e),n.add(e)}},THREE.ShaderUtils={lib:{fresnel:{uniforms:{mRefractionRatio:{type:"f",value:1.02},mFresnelBias:{type:"f",value:.1},mFresnelPower:{type:"f",value:2},mFresnelScale:{type:"f",value:1},tCube:{type:"t",value:null}},fragmentShader:["uniform samplerCube tCube;","varying vec3 vReflect;","varying vec3 vRefract[3];","varying float vReflectionFactor;","void main() {","vec4 reflectedColor = textureCube( tCube, vec3( -vReflect.x, vReflect.yz ) );","vec4 refractedColor = vec4( 1.0 );","refractedColor.r = textureCube( tCube, vec3( -vRefract[0].x, vRefract[0].yz ) ).r;"
  ,"refractedColor.g = textureCube( tCube, vec3( -vRefract[1].x, vRefract[1].yz ) ).g;","refractedColor.b = textureCube( tCube, vec3( -vRefract[2].x, vRefract[2].yz ) ).b;","gl_FragColor = mix( refractedColor, reflectedColor, clamp( vReflectionFactor, 0.0, 1.0 ) );","}"].join("\n"),vertexShader:["uniform float mRefractionRatio;","uniform float mFresnelBias;","uniform float mFresnelScale;","uniform float mFresnelPower;","varying vec3 vReflect;","varying vec3 vRefract[3];","varying float vReflectionFactor;","void main() {","vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );","vec4 worldPosition = modelMatrix * vec4( position, 1.0 );","vec3 worldNormal = normalize( mat3( modelMatrix[0].xyz, modelMatrix[1].xyz, modelMatrix[2].xyz ) * normal );","vec3 I = worldPosition.xyz - cameraPosition;","vReflect = reflect( I, worldNormal );","vRefract[0] = refract( normalize( I ), worldNormal, mRefractionRatio );","vRefract[1] = refract( normalize( I ), worldNormal, mRefractionRatio * 0.99 );","vRefract[2] = refract( normalize( I ), worldNormal, mRefractionRatio * 0.98 );"
  ,"vReflectionFactor = mFresnelBias + mFresnelScale * pow( 1.0 + dot( normalize( I ), worldNormal ), mFresnelPower );","gl_Position = projectionMatrix * mvPosition;","}"].join("\n")},normal:{uniforms:THREE.UniformsUtils.merge([THREE.UniformsLib.fog,THREE.UniformsLib.lights,THREE.UniformsLib.shadowmap,{enableAO:{type:"i",value:0},enableDiffuse:{type:"i",value:0},enableSpecular:{type:"i",value:0},enableReflection:{type:"i",value:0},enableDisplacement:{type:"i",value:0},tDisplacement:{type:"t",value:null},tDiffuse:{type:"t",value:null},tCube:{type:"t",value:null},tNormal:{type:"t",value:null},tSpecular:{type:"t",value:null},tAO:{type:"t",value:null},uNormalScale:{type:"v2",value:new THREE.Vector2(1,1)},uDisplacementBias:{type:"f",value:0},uDisplacementScale:{type:"f",value:1},uDiffuseColor:{type:"c",value:new THREE.Color(16777215)},uSpecularColor:{type:"c",value:new THREE.Color(1118481)},uAmbientColor:{type:"c",value:new THREE.Color(16777215)},uShininess:{type:"f",value:30},uOpacity:{type:"f",value:1},useRefract:{
  type:"i",value:0},uRefractionRatio:{type:"f",value:.98},uReflectivity:{type:"f",value:.5},uOffset:{type:"v2",value:new THREE.Vector2(0,0)},uRepeat:{type:"v2",value:new THREE.Vector2(1,1)},wrapRGB:{type:"v3",value:new THREE.Vector3(1,1,1)}}]),fragmentShader:["uniform vec3 uAmbientColor;","uniform vec3 uDiffuseColor;","uniform vec3 uSpecularColor;","uniform float uShininess;","uniform float uOpacity;","uniform bool enableDiffuse;","uniform bool enableSpecular;","uniform bool enableAO;","uniform bool enableReflection;","uniform sampler2D tDiffuse;","uniform sampler2D tNormal;","uniform sampler2D tSpecular;","uniform sampler2D tAO;","uniform samplerCube tCube;","uniform vec2 uNormalScale;","uniform bool useRefract;","uniform float uRefractionRatio;","uniform float uReflectivity;","varying vec3 vTangent;","varying vec3 vBinormal;","varying vec3 vNormal;","varying vec2 vUv;","uniform vec3 ambientLightColor;","#if MAX_DIR_LIGHTS > 0","uniform vec3 directionalLightColor[ MAX_DIR_LIGHTS ];","uniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];"
  ,"#endif","#if MAX_HEMI_LIGHTS > 0","uniform vec3 hemisphereLightSkyColor[ MAX_HEMI_LIGHTS ];","uniform vec3 hemisphereLightGroundColor[ MAX_HEMI_LIGHTS ];","uniform vec3 hemisphereLightDirection[ MAX_HEMI_LIGHTS ];","#endif","#if MAX_POINT_LIGHTS > 0","uniform vec3 pointLightColor[ MAX_POINT_LIGHTS ];","uniform vec3 pointLightPosition[ MAX_POINT_LIGHTS ];","uniform float pointLightDistance[ MAX_POINT_LIGHTS ];","#endif","#if MAX_SPOT_LIGHTS > 0","uniform vec3 spotLightColor[ MAX_SPOT_LIGHTS ];","uniform vec3 spotLightPosition[ MAX_SPOT_LIGHTS ];","uniform vec3 spotLightDirection[ MAX_SPOT_LIGHTS ];","uniform float spotLightAngleCos[ MAX_SPOT_LIGHTS ];","uniform float spotLightExponent[ MAX_SPOT_LIGHTS ];","uniform float spotLightDistance[ MAX_SPOT_LIGHTS ];","#endif","#ifdef WRAP_AROUND","uniform vec3 wrapRGB;","#endif","varying vec3 vWorldPosition;","varying vec3 vViewPosition;",THREE.ShaderChunk.shadowmap_pars_fragment,THREE.ShaderChunk.fog_pars_fragment,"void main() {","gl_FragColor = vec4( vec3( 1.0 ), uOpacity );"
  ,"vec3 specularTex = vec3( 1.0 );","vec3 normalTex = texture2D( tNormal, vUv ).xyz * 2.0 - 1.0;","normalTex.xy *= uNormalScale;","normalTex = normalize( normalTex );","if( enableDiffuse ) {","#ifdef GAMMA_INPUT","vec4 texelColor = texture2D( tDiffuse, vUv );","texelColor.xyz *= texelColor.xyz;","gl_FragColor = gl_FragColor * texelColor;","#else","gl_FragColor = gl_FragColor * texture2D( tDiffuse, vUv );","#endif","}","if( enableAO ) {","#ifdef GAMMA_INPUT","vec4 aoColor = texture2D( tAO, vUv );","aoColor.xyz *= aoColor.xyz;","gl_FragColor.xyz = gl_FragColor.xyz * aoColor.xyz;","#else","gl_FragColor.xyz = gl_FragColor.xyz * texture2D( tAO, vUv ).xyz;","#endif","}","if( enableSpecular )","specularTex = texture2D( tSpecular, vUv ).xyz;","mat3 tsb = mat3( normalize( vTangent ), normalize( vBinormal ), normalize( vNormal ) );","vec3 finalNormal = tsb * normalTex;","#ifdef FLIP_SIDED","finalNormal = -finalNormal;","#endif","vec3 normal = normalize( finalNormal );","vec3 viewPosition = normalize( vViewPosition );","#if MAX_POINT_LIGHTS > 0"
  ,"vec3 pointDiffuse = vec3( 0.0 );","vec3 pointSpecular = vec3( 0.0 );","for ( int i = 0; i < MAX_POINT_LIGHTS; i ++ ) {","vec4 lPosition = viewMatrix * vec4( pointLightPosition[ i ], 1.0 );","vec3 pointVector = lPosition.xyz + vViewPosition.xyz;","float pointDistance = 1.0;","if ( pointLightDistance[ i ] > 0.0 )","pointDistance = 1.0 - min( ( length( pointVector ) / pointLightDistance[ i ] ), 1.0 );","pointVector = normalize( pointVector );","#ifdef WRAP_AROUND","float pointDiffuseWeightFull = max( dot( normal, pointVector ), 0.0 );","float pointDiffuseWeightHalf = max( 0.5 * dot( normal, pointVector ) + 0.5, 0.0 );","vec3 pointDiffuseWeight = mix( vec3 ( pointDiffuseWeightFull ), vec3( pointDiffuseWeightHalf ), wrapRGB );","#else","float pointDiffuseWeight = max( dot( normal, pointVector ), 0.0 );","#endif","pointDiffuse += pointDistance * pointLightColor[ i ] * uDiffuseColor * pointDiffuseWeight;","vec3 pointHalfVector = normalize( pointVector + viewPosition );","float pointDotNormalHalf = max( dot( normal, pointHalfVector ), 0.0 );"
  ,"float pointSpecularWeight = specularTex.r * max( pow( pointDotNormalHalf, uShininess ), 0.0 );","#ifdef PHYSICALLY_BASED_SHADING","float specularNormalization = ( uShininess + 2.0001 ) / 8.0;","vec3 schlick = uSpecularColor + vec3( 1.0 - uSpecularColor ) * pow( 1.0 - dot( pointVector, pointHalfVector ), 5.0 );","pointSpecular += schlick * pointLightColor[ i ] * pointSpecularWeight * pointDiffuseWeight * pointDistance * specularNormalization;","#else","pointSpecular += pointDistance * pointLightColor[ i ] * uSpecularColor * pointSpecularWeight * pointDiffuseWeight;","#endif","}","#endif","#if MAX_SPOT_LIGHTS > 0","vec3 spotDiffuse = vec3( 0.0 );","vec3 spotSpecular = vec3( 0.0 );","for ( int i = 0; i < MAX_SPOT_LIGHTS; i ++ ) {","vec4 lPosition = viewMatrix * vec4( spotLightPosition[ i ], 1.0 );","vec3 spotVector = lPosition.xyz + vViewPosition.xyz;","float spotDistance = 1.0;","if ( spotLightDistance[ i ] > 0.0 )","spotDistance = 1.0 - min( ( length( spotVector ) / spotLightDistance[ i ] ), 1.0 );","spotVector = normalize( spotVector );"
  ,"float spotEffect = dot( spotLightDirection[ i ], normalize( spotLightPosition[ i ] - vWorldPosition ) );","if ( spotEffect > spotLightAngleCos[ i ] ) {","spotEffect = max( pow( spotEffect, spotLightExponent[ i ] ), 0.0 );","#ifdef WRAP_AROUND","float spotDiffuseWeightFull = max( dot( normal, spotVector ), 0.0 );","float spotDiffuseWeightHalf = max( 0.5 * dot( normal, spotVector ) + 0.5, 0.0 );","vec3 spotDiffuseWeight = mix( vec3 ( spotDiffuseWeightFull ), vec3( spotDiffuseWeightHalf ), wrapRGB );","#else","float spotDiffuseWeight = max( dot( normal, spotVector ), 0.0 );","#endif","spotDiffuse += spotDistance * spotLightColor[ i ] * uDiffuseColor * spotDiffuseWeight * spotEffect;","vec3 spotHalfVector = normalize( spotVector + viewPosition );","float spotDotNormalHalf = max( dot( normal, spotHalfVector ), 0.0 );","float spotSpecularWeight = specularTex.r * max( pow( spotDotNormalHalf, uShininess ), 0.0 );","#ifdef PHYSICALLY_BASED_SHADING","float specularNormalization = ( uShininess + 2.0001 ) / 8.0;","vec3 schlick = uSpecularColor + vec3( 1.0 - uSpecularColor ) * pow( 1.0 - dot( spotVector, spotHalfVector ), 5.0 );"
  ,"spotSpecular += schlick * spotLightColor[ i ] * spotSpecularWeight * spotDiffuseWeight * spotDistance * specularNormalization * spotEffect;","#else","spotSpecular += spotDistance * spotLightColor[ i ] * uSpecularColor * spotSpecularWeight * spotDiffuseWeight * spotEffect;","#endif","}","}","#endif","#if MAX_DIR_LIGHTS > 0","vec3 dirDiffuse = vec3( 0.0 );","vec3 dirSpecular = vec3( 0.0 );","for( int i = 0; i < MAX_DIR_LIGHTS; i++ ) {","vec4 lDirection = viewMatrix * vec4( directionalLightDirection[ i ], 0.0 );","vec3 dirVector = normalize( lDirection.xyz );","#ifdef WRAP_AROUND","float directionalLightWeightingFull = max( dot( normal, dirVector ), 0.0 );","float directionalLightWeightingHalf = max( 0.5 * dot( normal, dirVector ) + 0.5, 0.0 );","vec3 dirDiffuseWeight = mix( vec3( directionalLightWeightingFull ), vec3( directionalLightWeightingHalf ), wrapRGB );","#else","float dirDiffuseWeight = max( dot( normal, dirVector ), 0.0 );","#endif","dirDiffuse += directionalLightColor[ i ] * uDiffuseColor * dirDiffuseWeight;"
  ,"vec3 dirHalfVector = normalize( dirVector + viewPosition );","float dirDotNormalHalf = max( dot( normal, dirHalfVector ), 0.0 );","float dirSpecularWeight = specularTex.r * max( pow( dirDotNormalHalf, uShininess ), 0.0 );","#ifdef PHYSICALLY_BASED_SHADING","float specularNormalization = ( uShininess + 2.0001 ) / 8.0;","vec3 schlick = uSpecularColor + vec3( 1.0 - uSpecularColor ) * pow( 1.0 - dot( dirVector, dirHalfVector ), 5.0 );","dirSpecular += schlick * directionalLightColor[ i ] * dirSpecularWeight * dirDiffuseWeight * specularNormalization;","#else","dirSpecular += directionalLightColor[ i ] * uSpecularColor * dirSpecularWeight * dirDiffuseWeight;","#endif","}","#endif","#if MAX_HEMI_LIGHTS > 0","vec3 hemiDiffuse  = vec3( 0.0 );","vec3 hemiSpecular = vec3( 0.0 );","for( int i = 0; i < MAX_HEMI_LIGHTS; i ++ ) {","vec4 lDirection = viewMatrix * vec4( hemisphereLightDirection[ i ], 0.0 );","vec3 lVector = normalize( lDirection.xyz );","float dotProduct = dot( normal, lVector );","float hemiDiffuseWeight = 0.5 * dotProduct + 0.5;"
  ,"vec3 hemiColor = mix( hemisphereLightGroundColor[ i ], hemisphereLightSkyColor[ i ], hemiDiffuseWeight );","hemiDiffuse += uDiffuseColor * hemiColor;","vec3 hemiHalfVectorSky = normalize( lVector + viewPosition );","float hemiDotNormalHalfSky = 0.5 * dot( normal, hemiHalfVectorSky ) + 0.5;","float hemiSpecularWeightSky = specularTex.r * max( pow( hemiDotNormalHalfSky, uShininess ), 0.0 );","vec3 lVectorGround = -lVector;","vec3 hemiHalfVectorGround = normalize( lVectorGround + viewPosition );","float hemiDotNormalHalfGround = 0.5 * dot( normal, hemiHalfVectorGround ) + 0.5;","float hemiSpecularWeightGround = specularTex.r * max( pow( hemiDotNormalHalfGround, uShininess ), 0.0 );","#ifdef PHYSICALLY_BASED_SHADING","float dotProductGround = dot( normal, lVectorGround );","float specularNormalization = ( uShininess + 2.0001 ) / 8.0;","vec3 schlickSky = uSpecularColor + vec3( 1.0 - uSpecularColor ) * pow( 1.0 - dot( lVector, hemiHalfVectorSky ), 5.0 );","vec3 schlickGround = uSpecularColor + vec3( 1.0 - uSpecularColor ) * pow( 1.0 - dot( lVectorGround, hemiHalfVectorGround ), 5.0 );"
  ,"hemiSpecular += hemiColor * specularNormalization * ( schlickSky * hemiSpecularWeightSky * max( dotProduct, 0.0 ) + schlickGround * hemiSpecularWeightGround * max( dotProductGround, 0.0 ) );","#else","hemiSpecular += uSpecularColor * hemiColor * ( hemiSpecularWeightSky + hemiSpecularWeightGround ) * hemiDiffuseWeight;","#endif","}","#endif","vec3 totalDiffuse = vec3( 0.0 );","vec3 totalSpecular = vec3( 0.0 );","#if MAX_DIR_LIGHTS > 0","totalDiffuse += dirDiffuse;","totalSpecular += dirSpecular;","#endif","#if MAX_HEMI_LIGHTS > 0","totalDiffuse += hemiDiffuse;","totalSpecular += hemiSpecular;","#endif","#if MAX_POINT_LIGHTS > 0","totalDiffuse += pointDiffuse;","totalSpecular += pointSpecular;","#endif","#if MAX_SPOT_LIGHTS > 0","totalDiffuse += spotDiffuse;","totalSpecular += spotSpecular;","#endif","#ifdef METAL","gl_FragColor.xyz = gl_FragColor.xyz * ( totalDiffuse + ambientLightColor * uAmbientColor + totalSpecular );","#else","gl_FragColor.xyz = gl_FragColor.xyz * ( totalDiffuse + ambientLightColor * uAmbientColor ) + totalSpecular;"
  ,"#endif","if ( enableReflection ) {","vec3 vReflect;","vec3 cameraToVertex = normalize( vWorldPosition - cameraPosition );","if ( useRefract ) {","vReflect = refract( cameraToVertex, normal, uRefractionRatio );","} else {","vReflect = reflect( cameraToVertex, normal );","}","vec4 cubeColor = textureCube( tCube, vec3( -vReflect.x, vReflect.yz ) );","#ifdef GAMMA_INPUT","cubeColor.xyz *= cubeColor.xyz;","#endif","gl_FragColor.xyz = mix( gl_FragColor.xyz, cubeColor.xyz, specularTex.r * uReflectivity );","}",THREE.ShaderChunk.shadowmap_fragment,THREE.ShaderChunk.linear_to_gamma_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n"),vertexShader:["attribute vec4 tangent;","uniform vec2 uOffset;","uniform vec2 uRepeat;","uniform bool enableDisplacement;","#ifdef VERTEX_TEXTURES","uniform sampler2D tDisplacement;","uniform float uDisplacementScale;","uniform float uDisplacementBias;","#endif","varying vec3 vTangent;","varying vec3 vBinormal;","varying vec3 vNormal;","varying vec2 vUv;","varying vec3 vWorldPosition;"
  ,"varying vec3 vViewPosition;",THREE.ShaderChunk.skinning_pars_vertex,THREE.ShaderChunk.shadowmap_pars_vertex,"void main() {",THREE.ShaderChunk.skinbase_vertex,THREE.ShaderChunk.skinnormal_vertex,"#ifdef USE_SKINNING","vNormal = normalize( normalMatrix * skinnedNormal.xyz );","vec4 skinnedTangent = skinMatrix * vec4( tangent.xyz, 0.0 );","vTangent = normalize( normalMatrix * skinnedTangent.xyz );","#else","vNormal = normalize( normalMatrix * normal );","vTangent = normalize( normalMatrix * tangent.xyz );","#endif","vBinormal = normalize( cross( vNormal, vTangent ) * tangent.w );","vUv = uv * uRepeat + uOffset;","vec3 displacedPosition;","#ifdef VERTEX_TEXTURES","if ( enableDisplacement ) {","vec3 dv = texture2D( tDisplacement, uv ).xyz;","float df = uDisplacementScale * dv.x + uDisplacementBias;","displacedPosition = position + normalize( normal ) * df;","} else {","#ifdef USE_SKINNING","vec4 skinVertex = vec4( position, 1.0 );","vec4 skinned  = boneMatX * skinVertex * skinWeight.x;","skinned 	  += boneMatY * skinVertex * skinWeight.y;"
  ,"displacedPosition  = skinned.xyz;","#else","displacedPosition = position;","#endif","}","#else","#ifdef USE_SKINNING","vec4 skinVertex = vec4( position, 1.0 );","vec4 skinned  = boneMatX * skinVertex * skinWeight.x;","skinned 	  += boneMatY * skinVertex * skinWeight.y;","displacedPosition  = skinned.xyz;","#else","displacedPosition = position;","#endif","#endif","vec4 mvPosition = modelViewMatrix * vec4( displacedPosition, 1.0 );","vec4 worldPosition = modelMatrix * vec4( displacedPosition, 1.0 );","gl_Position = projectionMatrix * mvPosition;","vWorldPosition = worldPosition.xyz;","vViewPosition = -mvPosition.xyz;","#ifdef USE_SHADOWMAP","for( int i = 0; i < MAX_SHADOWS; i ++ ) {","vShadowCoord[ i ] = shadowMatrix[ i ] * worldPosition;","}","#endif","}"].join("\n")},cube:{uniforms:{tCube:{type:"t",value:null},tFlip:{type:"f",value:-1}},vertexShader:["varying vec3 vWorldPosition;","void main() {","vec4 worldPosition = modelMatrix * vec4( position, 1.0 );","vWorldPosition = worldPosition.xyz;","gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );"
  ,"}"].join("\n"),fragmentShader:["uniform samplerCube tCube;","uniform float tFlip;","varying vec3 vWorldPosition;","void main() {","gl_FragColor = textureCube( tCube, vec3( tFlip * vWorldPosition.x, vWorldPosition.yz ) );","}"].join("\n")}}},THREE.FontUtils={faces:{},face:"helvetiker",weight:"normal",style:"normal",size:150,divisions:10,getFace:function(){return this.faces[this.face][this.weight][this.style]},loadFace:function(e){var t=e.familyName.toLowerCase(),n=this;n.faces[t]=n.faces[t]||{},n.faces[t][e.cssFontWeight]=n.faces[t][e.cssFontWeight]||{},n.faces[t][e.cssFontWeight][e.cssFontStyle]=e;var r=n.faces[t][e.cssFontWeight][e.cssFontStyle]=e;return e},drawText:function(e){var t=[],n=[],r,i,s=this.getFace(),o=this.size/s.resolution,u=0,a=String(e).split(""),f=a.length,l=[];for(r=0;r<f;r++){var c=new THREE.Path,h=this.extractGlyphPoints(a[r],s,o,u,c);u+=h.offset,l.push(h.path)}var p=u/2;return{paths:l,offset:p}},extractGlyphPoints:function(e,t,n,r,i){var s=[],o,u,a,f,l,c,h,p,d,v,m,g,y,b,w,E,S,x,T,N=t.glyphs
  [e]||t.glyphs["?"];if(!N)return;if(N.o){f=N._cachedOutline||(N._cachedOutline=N.o.split(" ")),c=f.length,h=n,p=n;for(o=0;o<c;){l=f[o++];switch(l){case"m":d=f[o++]*h+r,v=f[o++]*p,i.moveTo(d,v);break;case"l":d=f[o++]*h+r,v=f[o++]*p,i.lineTo(d,v);break;case"q":m=f[o++]*h+r,g=f[o++]*p,w=f[o++]*h+r,E=f[o++]*p,i.quadraticCurveTo(w,E,m,g),T=s[s.length-1];if(T){y=T.x,b=T.y;for(u=1,a=this.divisions;u<=a;u++)var C=u/a,k=THREE.Shape.Utils.b2(C,y,w,m),L=THREE.Shape.Utils.b2(C,b,E,g)}break;case"b":m=f[o++]*h+r,g=f[o++]*p,w=f[o++]*h+r,E=f[o++]*-p,S=f[o++]*h+r,x=f[o++]*-p,i.bezierCurveTo(m,g,w,E,S,x),T=s[s.length-1];if(T){y=T.x,b=T.y;for(u=1,a=this.divisions;u<=a;u++)var C=u/a,k=THREE.Shape.Utils.b3(C,y,w,S,m),L=THREE.Shape.Utils.b3(C,b,E,x,g)}}}}return{offset:N.ha*n,path:i}}},THREE.FontUtils.generateShapes=function(e,t){t=t||{};var n=t.size!==undefined?t.size:100,r=t.curveSegments!==undefined?t.curveSegments:4,i=t.font!==undefined?t.font:"helvetiker",s=t.weight!==undefined?t.weight:"normal",o=t.style!==undefined?t.style:"normal"
  ;THREE.FontUtils.size=n,THREE.FontUtils.divisions=r,THREE.FontUtils.face=i,THREE.FontUtils.weight=s,THREE.FontUtils.style=o;var u=THREE.FontUtils.drawText(e),a=u.paths,f=[];for(var l=0,c=a.length;l<c;l++)Array.prototype.push.apply(f,a[l].toShapes());return f},function(e){var t=1e-10,n=function(e,t){var n=e.length;if(n<3)return null;var i=[],o=[],u=[],a,f,l;if(r(e)>0)for(f=0;f<n;f++)o[f]=f;else for(f=0;f<n;f++)o[f]=n-1-f;var c=n,h=2*c;for(f=c-1;c>2;){if(h--<=0)return console.log("Warning, unable to triangulate polygon!"),t?u:i;a=f,c<=a&&(a=0),f=a+1,c<=f&&(f=0),l=f+1,c<=l&&(l=0);if(s(e,a,f,l,c,o)){var p,d,v,m,g;p=o[a],d=o[f],v=o[l],i.push([e[p],e[d],e[v]]),u.push([o[a],o[f],o[l]]);for(m=f,g=f+1;g<c;m++,g++)o[m]=o[g];c--,h=2*c}}return t?u:i},r=function(e){var t=e.length,n=0;for(var r=t-1,i=0;i<t;r=i++)n+=e[r].x*e[i].y-e[i].x*e[r].y;return n*.5},i=function(e,t,n,r,i,s,o,u){var a,f,l,c,h,p,d,v,m,g,y,b,w,E,S;return a=i-n,f=s-r,l=e-i,c=t-s,h=n-e,p=r-t,d=o-e,v=u-t,m=o-n,g=u-r,y=o-i,b=u-s,S=a*g-f*m,w=h*v-p*d,E=l*b-c*y,
  S>=0&&E>=0&&w>=0},s=function(e,n,r,s,o,u){var a,f,l,c,h,p,d,v,m;f=e[u[n]].x,l=e[u[n]].y,c=e[u[r]].x,h=e[u[r]].y,p=e[u[s]].x,d=e[u[s]].y;if(t>(c-f)*(d-l)-(h-l)*(p-f))return!1;for(a=0;a<o;a++){if(a==n||a==r||a==s)continue;v=e[u[a]].x,m=e[u[a]].y;if(i(f,l,c,h,p,d,v,m))return!1}return!0};return e.Triangulate=n,e.Triangulate.area=r,e}(THREE.FontUtils),self._typeface_js={faces:THREE.FontUtils.faces,loadFace:THREE.FontUtils.loadFace},THREE.Curve=function(){},THREE.Curve.prototype.getPoint=function(e){return console.log("Warning, getPoint() not implemented!"),null},THREE.Curve.prototype.getPointAt=function(e){var t=this.getUtoTmapping(e);return this.getPoint(t)},THREE.Curve.prototype.getPoints=function(e){e||(e=5);var t,n=[];for(t=0;t<=e;t++)n.push(this.getPoint(t/e));return n},THREE.Curve.prototype.getSpacedPoints=function(e){e||(e=5);var t,n=[];for(t=0;t<=e;t++)n.push(this.getPointAt(t/e));return n},THREE.Curve.prototype.getLength=function(){var e=this.getLengths();return e[e.length-1]},THREE.Curve.prototype.getLengths=
  function(e){e||(e=this.__arcLengthDivisions?this.__arcLengthDivisions:200);if(this.cacheArcLengths&&this.cacheArcLengths.length==e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;var t=[],n,r=this.getPoint(0),i,s=0;t.push(0);for(i=1;i<=e;i++)n=this.getPoint(i/e),s+=n.distanceTo(r),t.push(s),r=n;return this.cacheArcLengths=t,t},THREE.Curve.prototype.updateArcLengths=function(){this.needsUpdate=!0,this.getLengths()},THREE.Curve.prototype.getUtoTmapping=function(e,t){var n=this.getLengths(),r=0,i=n.length,s;t?s=t:s=e*n[i-1];var o=0,u=i-1,a;while(o<=u){r=Math.floor(o+(u-o)/2),a=n[r]-s;if(a<0){o=r+1;continue}if(a>0){u=r-1;continue}u=r;break}r=u;if(n[r]==s){var f=r/(i-1);return f}var l=n[r],c=n[r+1],h=c-l,p=(s-l)/h,f=(r+p)/(i-1);return f},THREE.Curve.prototype.getNormalVector=function(e){var t=this.getTangent(e);return new THREE.Vector2(-t.y,t.x)},THREE.Curve.prototype.getTangent=function(e){var t=1e-4,n=e-t,r=e+t;n<0&&(n=0),r>1&&(r=1);var i=this.getPoint(n),s=this.getPoint(r),o=s.clone().subSelf
  (i);return o.normalize()},THREE.Curve.prototype.getTangentAt=function(e){var t=this.getUtoTmapping(e);return this.getTangent(t)},THREE.LineCurve=function(e,t){this.v1=e,this.v2=t},THREE.LineCurve.prototype=Object.create(THREE.Curve.prototype),THREE.LineCurve.prototype.getPoint=function(e){var t=this.v2.clone().subSelf(this.v1);return t.multiplyScalar(e).addSelf(this.v1),t},THREE.LineCurve.prototype.getPointAt=function(e){return this.getPoint(e)},THREE.LineCurve.prototype.getTangent=function(e){var t=this.v2.clone().subSelf(this.v1);return t.normalize()},THREE.QuadraticBezierCurve=function(e,t,n){this.v0=e,this.v1=t,this.v2=n},THREE.QuadraticBezierCurve.prototype=Object.create(THREE.Curve.prototype),THREE.QuadraticBezierCurve.prototype.getPoint=function(e){var t,n;return t=THREE.Shape.Utils.b2(e,this.v0.x,this.v1.x,this.v2.x),n=THREE.Shape.Utils.b2(e,this.v0.y,this.v1.y,this.v2.y),new THREE.Vector2(t,n)},THREE.QuadraticBezierCurve.prototype.getTangent=function(e){var t,n;t=THREE.Curve.Utils.tangentQuadraticBezier
  (e,this.v0.x,this.v1.x,this.v2.x),n=THREE.Curve.Utils.tangentQuadraticBezier(e,this.v0.y,this.v1.y,this.v2.y);var r=new THREE.Vector2(t,n);return r.normalize(),r},THREE.CubicBezierCurve=function(e,t,n,r){this.v0=e,this.v1=t,this.v2=n,this.v3=r},THREE.CubicBezierCurve.prototype=Object.create(THREE.Curve.prototype),THREE.CubicBezierCurve.prototype.getPoint=function(e){var t,n;return t=THREE.Shape.Utils.b3(e,this.v0.x,this.v1.x,this.v2.x,this.v3.x),n=THREE.Shape.Utils.b3(e,this.v0.y,this.v1.y,this.v2.y,this.v3.y),new THREE.Vector2(t,n)},THREE.CubicBezierCurve.prototype.getTangent=function(e){var t,n;t=THREE.Curve.Utils.tangentCubicBezier(e,this.v0.x,this.v1.x,this.v2.x,this.v3.x),n=THREE.Curve.Utils.tangentCubicBezier(e,this.v0.y,this.v1.y,this.v2.y,this.v3.y);var r=new THREE.Vector2(t,n);return r.normalize(),r},THREE.SplineCurve=function(e){this.points=e==undefined?[]:e},THREE.SplineCurve.prototype=Object.create(THREE.Curve.prototype),THREE.SplineCurve.prototype.getPoint=function(e){var t=new THREE.Vector2,n=[],
  r=this.points,i,s,o;return i=(r.length-1)*e,s=Math.floor(i),o=i-s,n[0]=s==0?s:s-1,n[1]=s,n[2]=s>r.length-2?r.length-1:s+1,n[3]=s>r.length-3?r.length-1:s+2,t.x=THREE.Curve.Utils.interpolate(r[n[0]].x,r[n[1]].x,r[n[2]].x,r[n[3]].x,o),t.y=THREE.Curve.Utils.interpolate(r[n[0]].y,r[n[1]].y,r[n[2]].y,r[n[3]].y,o),t},THREE.EllipseCurve=function(e,t,n,r,i,s,o){this.aX=e,this.aY=t,this.xRadius=n,this.yRadius=r,this.aStartAngle=i,this.aEndAngle=s,this.aClockwise=o},THREE.EllipseCurve.prototype=Object.create(THREE.Curve.prototype),THREE.EllipseCurve.prototype.getPoint=function(e){var t=this.aEndAngle-this.aStartAngle;this.aClockwise||(e=1-e);var n=this.aStartAngle+e*t,r=this.aX+this.xRadius*Math.cos(n),i=this.aY+this.yRadius*Math.sin(n);return new THREE.Vector2(r,i)},THREE.ArcCurve=function(e,t,n,r,i,s){THREE.EllipseCurve.call(this,e,t,n,n,r,i,s)},THREE.ArcCurve.prototype=Object.create(THREE.EllipseCurve.prototype),THREE.Curve.Utils={tangentQuadraticBezier:function(e,t,n,r){return 2*(1-e)*(n-t)+2*e*(r-n)},tangentCubicBezier
  :function(e,t,n,r,i){return-3*t*(1-e)*(1-e)+3*n*(1-e)*(1-e)-6*e*n*(1-e)+6*e*r*(1-e)-3*e*e*r+3*e*e*i},tangentSpline:function(e,t,n,r,i){var s=6*e*e-6*e,o=3*e*e-4*e+1,u=-6*e*e+6*e,a=3*e*e-2*e;return s+o+u+a},interpolate:function(e,t,n,r,i){var s=(n-e)*.5,o=(r-t)*.5,u=i*i,a=i*u;return(2*t-2*n+s+o)*a+(-3*t+3*n-2*s-o)*u+s*i+t}},THREE.Curve.create=function(e,t){return e.prototype=Object.create(THREE.Curve.prototype),e.prototype.getPoint=t,e},THREE.LineCurve3=THREE.Curve.create(function(e,t){this.v1=e,this.v2=t},function(e){var t=new THREE.Vector3;return t.sub(this.v2,this.v1),t.multiplyScalar(e),t.addSelf(this.v1),t}),THREE.QuadraticBezierCurve3=THREE.Curve.create(function(e,t,n){this.v0=e,this.v1=t,this.v2=n},function(e){var t,n,r;return t=THREE.Shape.Utils.b2(e,this.v0.x,this.v1.x,this.v2.x),n=THREE.Shape.Utils.b2(e,this.v0.y,this.v1.y,this.v2.y),r=THREE.Shape.Utils.b2(e,this.v0.z,this.v1.z,this.v2.z),new THREE.Vector3(t,n,r)}),THREE.CubicBezierCurve3=THREE.Curve.create(function(e,t,n,r){this.v0=e,this.v1=t,this.v2=
  n,this.v3=r},function(e){var t,n,r;return t=THREE.Shape.Utils.b3(e,this.v0.x,this.v1.x,this.v2.x,this.v3.x),n=THREE.Shape.Utils.b3(e,this.v0.y,this.v1.y,this.v2.y,this.v3.y),r=THREE.Shape.Utils.b3(e,this.v0.z,this.v1.z,this.v2.z,this.v3.z),new THREE.Vector3(t,n,r)}),THREE.SplineCurve3=THREE.Curve.create(function(e){this.points=e==undefined?[]:e},function(e){var t=new THREE.Vector3,n=[],r=this.points,i,s,o;i=(r.length-1)*e,s=Math.floor(i),o=i-s,n[0]=s==0?s:s-1,n[1]=s,n[2]=s>r.length-2?r.length-1:s+1,n[3]=s>r.length-3?r.length-1:s+2;var u=r[n[0]],a=r[n[1]],f=r[n[2]],l=r[n[3]];return t.x=THREE.Curve.Utils.interpolate(u.x,a.x,f.x,l.x,o),t.y=THREE.Curve.Utils.interpolate(u.y,a.y,f.y,l.y,o),t.z=THREE.Curve.Utils.interpolate(u.z,a.z,f.z,l.z,o),t}),THREE.ClosedSplineCurve3=THREE.Curve.create(function(e){this.points=e==undefined?[]:e},function(e){var t=new THREE.Vector3,n=[],r=this.points,i,s,o;return i=(r.length-0)*e,s=Math.floor(i),o=i-s,s+=s>0?0:(Math.floor(Math.abs(s)/r.length)+1)*r.length,n[0]=(s-1)%r.length,n[1]=
  s%r.length,n[2]=(s+1)%r.length,n[3]=(s+2)%r.length,t.x=THREE.Curve.Utils.interpolate(r[n[0]].x,r[n[1]].x,r[n[2]].x,r[n[3]].x,o),t.y=THREE.Curve.Utils.interpolate(r[n[0]].y,r[n[1]].y,r[n[2]].y,r[n[3]].y,o),t.z=THREE.Curve.Utils.interpolate(r[n[0]].z,r[n[1]].z,r[n[2]].z,r[n[3]].z,o),t}),THREE.CurvePath=function(){this.curves=[],this.bends=[],this.autoClose=!1},THREE.CurvePath.prototype=Object.create(THREE.Curve.prototype),THREE.CurvePath.prototype.add=function(e){this.curves.push(e)},THREE.CurvePath.prototype.checkConnection=function(){},THREE.CurvePath.prototype.closePath=function(){var e=this.curves[0].getPoint(0),t=this.curves[this.curves.length-1].getPoint(1);e.equals(t)||this.curves.push(new THREE.LineCurve(t,e))},THREE.CurvePath.prototype.getPoint=function(e){var t=e*this.getLength(),n=this.getCurveLengths(),r=0,i,s;while(r<n.length){if(n[r]>=t){i=n[r]-t,s=this.curves[r];var o=1-i/s.getLength();return s.getPointAt(o)}r++}return null},THREE.CurvePath.prototype.getLength=function(){var e=this.getCurveLengths
  ();return e[e.length-1]},THREE.CurvePath.prototype.getCurveLengths=function(){if(this.cacheLengths&&this.cacheLengths.length==this.curves.length)return this.cacheLengths;var e=[],t=0,n,r=this.curves.length;for(n=0;n<r;n++)t+=this.curves[n].getLength(),e.push(t);return this.cacheLengths=e,e},THREE.CurvePath.prototype.getBoundingBox=function(){var e=this.getPoints(),t,n,r,i,s,o;t=n=Number.NEGATIVE_INFINITY,i=s=Number.POSITIVE_INFINITY;var u,a,f,l,c=e[0]instanceof THREE.Vector3;l=c?new THREE.Vector3:new THREE.Vector2;for(a=0,f=e.length;a<f;a++)u=e[a],u.x>t?t=u.x:u.x<i&&(i=u.x),u.y>n?n=u.y:u.y<s&&(s=u.y),c&&(u.z>r?r=u.z:u.z<o&&(o=u.z)),l.addSelf(u);var h={minX:i,minY:s,maxX:t,maxY:n,centroid:l.divideScalar(f)};return c&&(h.maxZ=r,h.minZ=o),h},THREE.CurvePath.prototype.createPointsGeometry=function(e){var t=this.getPoints(e,!0);return this.createGeometry(t)},THREE.CurvePath.prototype.createSpacedPointsGeometry=function(e){var t=this.getSpacedPoints(e,!0);return this.createGeometry(t)},THREE.CurvePath.prototype.createGeometry=
  function(e){var t=new THREE.Geometry;for(var n=0;n<e.length;n++)t.vertices.push(new THREE.Vector3(e[n].x,e[n].y,e[n].z||0));return t},THREE.CurvePath.prototype.addWrapPath=function(e){this.bends.push(e)},THREE.CurvePath.prototype.getTransformedPoints=function(e,t){var n=this.getPoints(e),r,i;t||(t=this.bends);for(r=0,i=t.length;r<i;r++)n=this.getWrapPoints(n,t[r]);return n},THREE.CurvePath.prototype.getTransformedSpacedPoints=function(e,t){var n=this.getSpacedPoints(e),r,i;t||(t=this.bends);for(r=0,i=t.length;r<i;r++)n=this.getWrapPoints(n,t[r]);return n},THREE.CurvePath.prototype.getWrapPoints=function(e,t){var n=this.getBoundingBox(),r,i,s,o,u,a;for(r=0,i=e.length;r<i;r++){s=e[r],o=s.x,u=s.y,a=o/n.maxX,a=t.getUtoTmapping(a,o);var f=t.getPoint(a),l=t.getNormalVector(a).multiplyScalar(u);s.x=f.x+l.x,s.y=f.y+l.y}return e},THREE.Gyroscope=function(){THREE.Object3D.call(this)},THREE.Gyroscope.prototype=Object.create(THREE.Object3D.prototype),THREE.Gyroscope.prototype.updateMatrixWorld=function(e){this.matrixAutoUpdate&&
  this.updateMatrix();if(this.matrixWorldNeedsUpdate||e)this.parent?(this.matrixWorld.multiply(this.parent.matrixWorld,this.matrix),this.matrixWorld.decompose(this.translationWorld,this.rotationWorld,this.scaleWorld),this.matrix.decompose(this.translationObject,this.rotationObject,this.scaleObject),this.matrixWorld.compose(this.translationWorld,this.rotationObject,this.scaleWorld)):this.matrixWorld.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,e=!0;for(var t=0,n=this.children.length;t<n;t++)this.children[t].updateMatrixWorld(e)},THREE.Gyroscope.prototype.translationWorld=new THREE.Vector3,THREE.Gyroscope.prototype.translationObject=new THREE.Vector3,THREE.Gyroscope.prototype.rotationWorld=new THREE.Quaternion,THREE.Gyroscope.prototype.rotationObject=new THREE.Quaternion,THREE.Gyroscope.prototype.scaleWorld=new THREE.Vector3,THREE.Gyroscope.prototype.scaleObject=new THREE.Vector3,THREE.Path=function(e){THREE.CurvePath.call(this),this.actions=[],e&&this.fromPoints(e)},THREE.Path.prototype=Object.create(THREE.CurvePath
  .prototype),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(e){this.moveTo(e[0].x,e[0].y);for(var t=1,n=e.length;t<n;t++)this.lineTo(e[t].x,e[t].y)},THREE.Path.prototype.moveTo=function(e,t){var n=Array.prototype.slice.call(arguments);this.actions.push({action:THREE.PathActions.MOVE_TO,args:n})},THREE.Path.prototype.lineTo=function(e,t){var n=Array.prototype.slice.call(arguments),r=this.actions[this.actions.length-1].args,i=r[r.length-2],s=r[r.length-1],o=new THREE.LineCurve(new THREE.Vector2(i,s),new THREE.Vector2(e,t));this.curves.push(o),this.actions.push({action:THREE.PathActions.LINE_TO,args:n})},THREE.Path.prototype.quadraticCurveTo=function(e,t,n,r){var i=Array.prototype.slice.call(arguments),s=this.actions[this.actions.length-1].args,o=s[s.length-2],u=s[s.length-1],a=new THREE.QuadraticBezierCurve(new THREE.Vector2(o,u),new THREE.Vector2
  (e,t),new THREE.Vector2(n,r));this.curves.push(a),this.actions.push({action:THREE.PathActions.QUADRATIC_CURVE_TO,args:i})},THREE.Path.prototype.bezierCurveTo=function(e,t,n,r,i,s){var o=Array.prototype.slice.call(arguments),u=this.actions[this.actions.length-1].args,a=u[u.length-2],f=u[u.length-1],l=new THREE.CubicBezierCurve(new THREE.Vector2(a,f),new THREE.Vector2(e,t),new THREE.Vector2(n,r),new THREE.Vector2(i,s));this.curves.push(l),this.actions.push({action:THREE.PathActions.BEZIER_CURVE_TO,args:o})},THREE.Path.prototype.splineThru=function(e){var t=Array.prototype.slice.call(arguments),n=this.actions[this.actions.length-1].args,r=n[n.length-2],i=n[n.length-1],s=[new THREE.Vector2(r,i)];Array.prototype.push.apply(s,e);var o=new THREE.SplineCurve(s);this.curves.push(o),this.actions.push({action:THREE.PathActions.CSPLINE_THRU,args:t})},THREE.Path.prototype.arc=function(e,t,n,r,i,s){var o=this.actions[this.actions.length-1].args,u=o[o.length-2],a=o[o.length-1];this.absarc(e+u,t+a,n,r,i,s)},THREE.Path.prototype
  .absarc=function(e,t,n,r,i,s){this.absellipse(e,t,n,n,r,i,s)},THREE.Path.prototype.ellipse=function(e,t,n,r,i,s,o){var u=this.actions[this.actions.length-1].args,a=u[u.length-2],f=u[u.length-1];this.absellipse(e+a,t+f,n,r,i,s,o)},THREE.Path.prototype.absellipse=function(e,t,n,r,i,s,o){var u=Array.prototype.slice.call(arguments),a=new THREE.EllipseCurve(e,t,n,r,i,s,o);this.curves.push(a);var f=a.getPoint(o?1:0);u.push(f.x),u.push(f.y),this.actions.push({action:THREE.PathActions.ELLIPSE,args:u})},THREE.Path.prototype.getSpacedPoints=function(e,t){e||(e=40);var n=[];for(var r=0;r<e;r++)n.push(this.getPoint(r/e));return n},THREE.Path.prototype.getPoints=function(e,t){if(this.useSpacedPoints)return console.log("tata"),this.getSpacedPoints(e,t);e=e||12;var n=[],r,i,s,o,u,a,f,l,c,h,p,d,v,m,g,y,b,w;for(r=0,i=this.actions.length;r<i;r++){s=this.actions[r],o=s.action,u=s.args;switch(o){case THREE.PathActions.MOVE_TO:n.push(new THREE.Vector2(u[0],u[1]));break;case THREE.PathActions.LINE_TO:n.push(new THREE.Vector2(u[0],u
  [1]));break;case THREE.PathActions.QUADRATIC_CURVE_TO:a=u[2],f=u[3],h=u[0],p=u[1],n.length>0?(m=n[n.length-1],d=m.x,v=m.y):(m=this.actions[r-1].args,d=m[m.length-2],v=m[m.length-1]);for(g=1;g<=e;g++)y=g/e,b=THREE.Shape.Utils.b2(y,d,h,a),w=THREE.Shape.Utils.b2(y,v,p,f),n.push(new THREE.Vector2(b,w));break;case THREE.PathActions.BEZIER_CURVE_TO:a=u[4],f=u[5],h=u[0],p=u[1],l=u[2],c=u[3],n.length>0?(m=n[n.length-1],d=m.x,v=m.y):(m=this.actions[r-1].args,d=m[m.length-2],v=m[m.length-1]);for(g=1;g<=e;g++)y=g/e,b=THREE.Shape.Utils.b3(y,d,h,l,a),w=THREE.Shape.Utils.b3(y,v,p,c,f),n.push(new THREE.Vector2(b,w));break;case THREE.PathActions.CSPLINE_THRU:m=this.actions[r-1].args;var E=new THREE.Vector2(m[m.length-2],m[m.length-1]),S=[E],x=e*u[0].length;S=S.concat(u[0]);var T=new THREE.SplineCurve(S);for(g=1;g<=x;g++)n.push(T.getPointAt(g/x));break;case THREE.PathActions.ARC:var N=u[0],C=u[1],k=u[2],L=u[3],A=u[4],O=!!u[5],M=A-L,_,D=e*2;for(g=1;g<=D;g++)y=g/D,O||(y=1-y),_=L+y*M,b=N+k*Math.cos(_),w=C+k*Math.sin(_),n.push(new 
  THREE.Vector2(b,w));break;case THREE.PathActions.ELLIPSE:var N=u[0],C=u[1],P=u[2],H=u[3],L=u[4],A=u[5],O=!!u[6],M=A-L,_,D=e*2;for(g=1;g<=D;g++)y=g/D,O||(y=1-y),_=L+y*M,b=N+P*Math.cos(_),w=C+H*Math.sin(_),n.push(new THREE.Vector2(b,w))}}var B=n[n.length-1],j=1e-10;return Math.abs(B.x-n[0].x)<j&&Math.abs(B.y-n[0].y)<j&&n.splice(n.length-1,1),t&&n.push(n[0]),n},THREE.Path.prototype.toShapes=function(){var e,t,n,r,i,s=[],o=new THREE.Path;for(e=0,t=this.actions.length;e<t;e++)n=this.actions[e],i=n.args,r=n.action,r==THREE.PathActions.MOVE_TO&&o.actions.length!=0&&(s.push(o),o=new THREE.Path),o[r].apply(o,i);o.actions.length!=0&&s.push(o);if(s.length==0)return[];var u,a,f=[],l=!THREE.Shape.Utils.isClockWise(s[0].getPoints());if(s.length==1)return u=s[0],a=new THREE.Shape,a.actions=u.actions,a.curves=u.curves,f.push(a),f;if(l){a=new THREE.Shape;for(e=0,t=s.length;e<t;e++)u=s[e],THREE.Shape.Utils.isClockWise(u.getPoints())?(a.actions=u.actions,a.curves=u.curves,f.push(a),a=new THREE.Shape):a.holes.push(u)}else{for(e=0
  ,t=s.length;e<t;e++)u=s[e],THREE.Shape.Utils.isClockWise(u.getPoints())?(a&&f.push(a),a=new THREE.Shape,a.actions=u.actions,a.curves=u.curves):a.holes.push(u);f.push(a)}return f},THREE.Shape=function(){THREE.Path.apply(this,arguments),this.holes=[]},THREE.Shape.prototype=Object.create(THREE.Path.prototype),THREE.Shape.prototype.extrude=function(e){var t=new THREE.ExtrudeGeometry(this,e);return t},THREE.Shape.prototype.makeGeometry=function(e){var t=new THREE.ShapeGeometry(this,e);return t},THREE.Shape.prototype.getPointsHoles=function(e){var t,n=this.holes.length,r=[];for(t=0;t<n;t++)r[t]=this.holes[t].getTransformedPoints(e,this.bends);return r},THREE.Shape.prototype.getSpacedPointsHoles=function(e){var t,n=this.holes.length,r=[];for(t=0;t<n;t++)r[t]=this.holes[t].getTransformedSpacedPoints(e,this.bends);return r},THREE.Shape.prototype.extractAllPoints=function(e){return{shape:this.getTransformedPoints(e),holes:this.getPointsHoles(e)}},THREE.Shape.prototype.extractPoints=function(e){return this.useSpacedPoints?
  this.extractAllSpacedPoints(e):this.extractAllPoints(e)},THREE.Shape.prototype.extractAllSpacedPoints=function(e){return{shape:this.getTransformedSpacedPoints(e),holes:this.getSpacedPointsHoles(e)}},THREE.Shape.Utils={removeHoles:function(e,t){var n=e.concat(),r=n.concat(),i,s,o,u,a,f,l,c,h,p,d,v,m,g,y,b,w,E,S,x,T=[];for(h=0;h<t.length;h++){d=t[h],Array.prototype.push.apply(r,d),v=Number.POSITIVE_INFINITY;for(p=0;p<d.length;p++){y=d[p];var N=[];for(g=0;g<n.length;g++)b=n[g],m=y.distanceToSquared(b),N.push(m),m<v&&(v=m,a=p,f=g)}i=f-1>=0?f-1:n.length-1,o=a-1>=0?a-1:d.length-1;var C=[d[a],n[f],n[i]],k=THREE.FontUtils.Triangulate.area(C),L=[d[a],d[o],n[f]],A=THREE.FontUtils.Triangulate.area(L),O=1,M=-1,_=f,D=a;f+=O,a+=M,f<0&&(f+=n.length),f%=n.length,a<0&&(a+=d.length),a%=d.length,i=f-1>=0?f-1:n.length-1,o=a-1>=0?a-1:d.length-1,C=[d[a],n[f],n[i]];var P=THREE.FontUtils.Triangulate.area(C);L=[d[a],d[o],n[f]];var H=THREE.FontUtils.Triangulate.area(L);k+A>P+H&&(f=_,a=D,f<0&&(f+=n.length),f%=n.length,a<0&&(a+=d.length)
  ,a%=d.length,i=f-1>=0?f-1:n.length-1,o=a-1>=0?a-1:d.length-1),w=n.slice(0,f),E=n.slice(f),S=d.slice(a),x=d.slice(0,a);var B=[d[a],n[f],n[i]],j=[d[a],d[o],n[f]];T.push(B),T.push(j),n=w.concat(S).concat(x).concat(E)}return{shape:n,isolatedPts:T,allpoints:r}},triangulateShape:function(e,t){var n=THREE.Shape.Utils.removeHoles(e,t),r=n.shape,i=n.allpoints,s=n.isolatedPts,o=THREE.FontUtils.Triangulate(r,!1),u,a,f,l,c,h,p={},d={};for(u=0,a=i.length;u<a;u++)c=i[u].x+":"+i[u].y,p[c]!==undefined&&console.log("Duplicate point",c),p[c]=u;for(u=0,a=o.length;u<a;u++){l=o[u];for(f=0;f<3;f++)c=l[f].x+":"+l[f].y,h=p[c],h!==undefined&&(l[f]=h)}for(u=0,a=s.length;u<a;u++){l=s[u];for(f=0;f<3;f++)c=l[f].x+":"+l[f].y,h=p[c],h!==undefined&&(l[f]=h)}return o.concat(s)},isClockWise:function(e){return THREE.FontUtils.Triangulate.area(e)<0},b2p0:function(e,t){var n=1-e;return n*n*t},b2p1:function(e,t){return 2*(1-e)*e*t},b2p2:function(e,t){return e*e*t},b2:function(e,t,n,r){return this.b2p0(e,t)+this.b2p1(e,n)+this.b2p2(e,r)},b3p0:function(
  e,t){var n=1-e;return n*n*n*t},b3p1:function(e,t){var n=1-e;return 3*n*n*e*t},b3p2:function(e,t){var n=1-e;return 3*n*e*e*t},b3p3:function(e,t){return e*e*e*t},b3:function(e,t,n,r,i){return this.b3p0(e,t)+this.b3p1(e,n)+this.b3p2(e,r)+this.b3p3(e,i)}},THREE.AnimationHandler=function(){var e=[],t={},n={};n.update=function(t){for(var n=0;n<e.length;n++)e[n].update(t)},n.addToUpdate=function(t){e.indexOf(t)===-1&&e.push(t)},n.removeFromUpdate=function(t){var n=e.indexOf(t);n!==-1&&e.splice(n,1)},n.add=function(e){t[e.name]!==undefined&&console.log("THREE.AnimationHandler.add: Warning! "+e.name+" already exists in library. Overwriting."),t[e.name]=e,i(e)},n.get=function(e){if(typeof e=="string")return t[e]?t[e]:(console.log("THREE.AnimationHandler.get: Couldn't find animation "+e),null)},n.parse=function(e){var t=[];if(e instanceof THREE.SkinnedMesh)for(var n=0;n<e.bones.length;n++)t.push(e.bones[n]);else r(e,t);return t};var r=function(e,t){t.push(e);for(var n=0;n<e.children.length;n++)r(e.children[n],t)},i=function(
  e){if(e.initialized===!0)return;for(var t=0;t<e.hierarchy.length;t++){for(var n=0;n<e.hierarchy[t].keys.length;n++){e.hierarchy[t].keys[n].time<0&&(e.hierarchy[t].keys[n].time=0);if(e.hierarchy[t].keys[n].rot!==undefined&&!(e.hierarchy[t].keys[n].rot instanceof THREE.Quaternion)){var r=e.hierarchy[t].keys[n].rot;e.hierarchy[t].keys[n].rot=new THREE.Quaternion(r[0],r[1],r[2],r[3])}}if(e.hierarchy[t].keys.length&&e.hierarchy[t].keys[0].morphTargets!==undefined){var i={};for(var n=0;n<e.hierarchy[t].keys.length;n++)for(var s=0;s<e.hierarchy[t].keys[n].morphTargets.length;s++){var o=e.hierarchy[t].keys[n].morphTargets[s];i[o]=-1}e.hierarchy[t].usedMorphTargets=i;for(var n=0;n<e.hierarchy[t].keys.length;n++){var u={};for(var o in i){for(var s=0;s<e.hierarchy[t].keys[n].morphTargets.length;s++)if(e.hierarchy[t].keys[n].morphTargets[s]===o){u[o]=e.hierarchy[t].keys[n].morphTargetsInfluences[s];break}s===e.hierarchy[t].keys[n].morphTargets.length&&(u[o]=0)}e.hierarchy[t].keys[n].morphTargetsInfluences=u}}for(var n=1;n<
  e.hierarchy[t].keys.length;n++)e.hierarchy[t].keys[n].time===e.hierarchy[t].keys[n-1].time&&(e.hierarchy[t].keys.splice(n,1),n--);for(var n=0;n<e.hierarchy[t].keys.length;n++)e.hierarchy[t].keys[n].index=n}var a=parseInt(e.length*e.fps,10);e.JIT={},e.JIT.hierarchy=[];for(var t=0;t<e.hierarchy.length;t++)e.JIT.hierarchy.push(new Array(a));e.initialized=!0};return n.LINEAR=0,n.CATMULLROM=1,n.CATMULLROM_FORWARD=2,n}(),THREE.Animation=function(e,t,n){this.root=e,this.data=THREE.AnimationHandler.get(t),this.hierarchy=THREE.AnimationHandler.parse(e),this.currentTime=0,this.timeScale=1,this.isPlaying=!1,this.isPaused=!0,this.loop=!0,this.interpolationType=n!==undefined?n:THREE.AnimationHandler.LINEAR,this.points=[],this.target=new THREE.Vector3},THREE.Animation.prototype.play=function(e,t){if(this.isPlaying===!1){this.isPlaying=!0,this.loop=e!==undefined?e:!0,this.currentTime=t!==undefined?t:0;var n,r=this.hierarchy.length,i;for(n=0;n<r;n++){i=this.hierarchy[n],this.interpolationType!==THREE.AnimationHandler.CATMULLROM_FORWARD&&
  (i.useQuaternion=!0),i.matrixAutoUpdate=!0,i.animationCache===undefined&&(i.animationCache={},i.animationCache.prevKey={pos:0,rot:0,scl:0},i.animationCache.nextKey={pos:0,rot:0,scl:0},i.animationCache.originalMatrix=i instanceof THREE.Bone?i.skinMatrix:i.matrix);var s=i.animationCache.prevKey,o=i.animationCache.nextKey;s.pos=this.data.hierarchy[n].keys[0],s.rot=this.data.hierarchy[n].keys[0],s.scl=this.data.hierarchy[n].keys[0],o.pos=this.getNextKeyWith("pos",n,1),o.rot=this.getNextKeyWith("rot",n,1),o.scl=this.getNextKeyWith("scl",n,1)}this.update(0)}this.isPaused=!1,THREE.AnimationHandler.addToUpdate(this)},THREE.Animation.prototype.pause=function(){this.isPaused===!0?THREE.AnimationHandler.addToUpdate(this):THREE.AnimationHandler.removeFromUpdate(this),this.isPaused=!this.isPaused},THREE.Animation.prototype.stop=function(){this.isPlaying=!1,this.isPaused=!1,THREE.AnimationHandler.removeFromUpdate(this)},THREE.Animation.prototype.update=function(e){if(this.isPlaying===!1)return;var t=["pos","rot","scl"],n,r,
  i,s,o,u,a,f,l,c,h=this.data.JIT.hierarchy,p,d,v,m,g;this.currentTime+=e*this.timeScale,d=this.currentTime,p=this.currentTime=this.currentTime%this.data.length,c=parseInt(Math.min(p*this.data.fps,this.data.length*this.data.fps),10);for(var y=0,b=this.hierarchy.length;y<b;y++){f=this.hierarchy[y],l=f.animationCache;for(var w=0;w<3;w++){n=t[w],u=l.prevKey[n],a=l.nextKey[n];if(a.time<=d){if(p<d){if(!this.loop){this.stop();return}u=this.data.hierarchy[y].keys[0],a=this.getNextKeyWith(n,y,1);while(a.time<p)u=a,a=this.getNextKeyWith(n,y,a.index+1)}else do u=a,a=this.getNextKeyWith(n,y,a.index+1);while(a.time<p);l.prevKey[n]=u,l.nextKey[n]=a}f.matrixAutoUpdate=!0,f.matrixWorldNeedsUpdate=!0,r=(p-u.time)/(a.time-u.time),s=u[n],o=a[n];if(r<0||r>1)console.log("THREE.Animation.update: Warning! Scale out of bounds:"+r+" on bone "+y),r=r<0?0:1;if(n==="pos"){i=f.position;if(this.interpolationType===THREE.AnimationHandler.LINEAR)i.x=s[0]+(o[0]-s[0])*r,i.y=s[1]+(o[1]-s[1])*r,i.z=s[2]+(o[2]-s[2])*r;else if(this.interpolationType===
  THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)this.points[0]=this.getPrevKeyWith("pos",y,u.index-1).pos,this.points[1]=s,this.points[2]=o,this.points[3]=this.getNextKeyWith("pos",y,a.index+1).pos,r=r*.33+.33,v=this.interpolateCatmullRom(this.points,r),i.x=v[0],i.y=v[1],i.z=v[2],this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD&&(m=this.interpolateCatmullRom(this.points,r*1.01),this.target.set(m[0],m[1],m[2]),this.target.subSelf(i),this.target.y=0,this.target.normalize(),g=Math.atan2(this.target.x,this.target.z),f.rotation.set(0,g,0))}else n==="rot"?THREE.Quaternion.slerp(s,o,f.quaternion,r):n==="scl"&&(i=f.scale,i.x=s[0]+(o[0]-s[0])*r,i.y=s[1]+(o[1]-s[1])*r,i.z=s[2]+(o[2]-s[2])*r)}}},THREE.Animation.prototype.interpolateCatmullRom=function(e,t){var n=[],r=[],i,s,o,u,a,f,l,c,h;return i=(e.length-1)*t,s=Math.floor(i),o=i-s,n[0]=s===0?s:s-1,n[1]=s,n[2]=s>e.length-2?s:s+1,n[3]=s>e.length-3?s:s+2,f=e[n[0]],l=e[n[1]],c=e[n[2]],h=e[n[3]],u=o*o,a=
  o*u,r[0]=this.interpolate(f[0],l[0],c[0],h[0],o,u,a),r[1]=this.interpolate(f[1],l[1],c[1],h[1],o,u,a),r[2]=this.interpolate(f[2],l[2],c[2],h[2],o,u,a),r},THREE.Animation.prototype.interpolate=function(e,t,n,r,i,s,o){var u=(n-e)*.5,a=(r-t)*.5;return(2*(t-n)+u+a)*o+(-3*(t-n)-2*u-a)*s+u*i+t},THREE.Animation.prototype.getNextKeyWith=function(e,t,n){var r=this.data.hierarchy[t].keys;this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?n=n<r.length-1?n:r.length-1:n%=r.length;for(;n<r.length;n++)if(r[n][e]!==undefined)return r[n];return this.data.hierarchy[t].keys[0]},THREE.Animation.prototype.getPrevKeyWith=function(e,t,n){var r=this.data.hierarchy[t].keys;this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?n=n>0?n:0:n=n>=0?n:n+r.length;for(;n>=0;n--)if(r[n][e]!==undefined)return r[n];return this.data.hierarchy[t].keys[r.length-1]},THREE.KeyFrameAnimation=function(e,t,n
  ){this.root=e,this.data=THREE.AnimationHandler.get(t),this.hierarchy=THREE.AnimationHandler.parse(e),this.currentTime=0,this.timeScale=.001,this.isPlaying=!1,this.isPaused=!0,this.loop=!0,this.JITCompile=n!==undefined?n:!0;for(var r=0,i=this.hierarchy.length;r<i;r++){var s=this.data.hierarchy[r].keys,o=this.data.hierarchy[r].sids,u=this.hierarchy[r];if(s.length&&o){for(var a=0;a<o.length;a++){var f=o[a],l=this.getNextKeyWith(f,r,0);l&&l.apply(f)}u.matrixAutoUpdate=!1,this.data.hierarchy[r].node.updateMatrix(),u.matrixWorldNeedsUpdate=!0}}},THREE.KeyFrameAnimation.prototype.play=function(e,t){if(!this.isPlaying){this.isPlaying=!0,this.loop=e!==undefined?e:!0,this.currentTime=t!==undefined?t:0,this.startTimeMs=t,this.startTime=1e7,this.endTime=-this.startTime;var n,r=this.hierarchy.length,i,s;for(n=0;n<r;n++){i=this.hierarchy[n],s=this.data.hierarchy[n],i.useQuaternion=!0,s.animationCache===undefined&&(s.animationCache={},s.animationCache.prevKey=null,s.animationCache.nextKey=null,s.animationCache.originalMatrix=
  i instanceof THREE.Bone?i.skinMatrix:i.matrix);var o=this.data.hierarchy[n].keys;o.length&&(s.animationCache.prevKey=o[0],s.animationCache.nextKey=o[1],this.startTime=Math.min(o[0].time,this.startTime),this.endTime=Math.max(o[o.length-1].time,this.endTime))}this.update(0)}this.isPaused=!1,THREE.AnimationHandler.addToUpdate(this)},THREE.KeyFrameAnimation.prototype.pause=function(){this.isPaused?THREE.AnimationHandler.addToUpdate(this):THREE.AnimationHandler.removeFromUpdate(this),this.isPaused=!this.isPaused},THREE.KeyFrameAnimation.prototype.stop=function(){this.isPlaying=!1,this.isPaused=!1,THREE.AnimationHandler.removeFromUpdate(this);for(var e=0;e<this.data.hierarchy.length;e++){var t=this.hierarchy[e],n=this.data.hierarchy[e];if(n.animationCache!==undefined){var r=n.animationCache.originalMatrix;t instanceof THREE.Bone?(r.copy(t.skinMatrix),t.skinMatrix=r):(r.copy(t.matrix),t.matrix=r),delete n.animationCache}}},THREE.KeyFrameAnimation.prototype.update=function(e){if(!this.isPlaying)return;var t,n,r,i,s,o=
  this.data.JIT.hierarchy,u,a,f;this.currentTime+=e*this.timeScale,a=this.currentTime,u=this.currentTime=this.currentTime%this.data.length,u<this.startTimeMs&&(u=this.currentTime=this.startTimeMs+u),s=parseInt(Math.min(u*this.data.fps,this.data.length*this.data.fps),10),f=u<a;if(f&&!this.loop){for(var l=0,c=this.hierarchy.length;l<c;l++){var h=this.data.hierarchy[l].keys,p=this.data.hierarchy[l].sids,d=h.length-1,v=this.hierarchy[l];if(h.length){for(var m=0;m<p.length;m++){var g=p[m],y=this.getPrevKeyWith(g,l,d);y&&y.apply(g)}this.data.hierarchy[l].node.updateMatrix(),v.matrixWorldNeedsUpdate=!0}}this.stop();return}if(u<this.startTime)return;for(var l=0,c=this.hierarchy.length;l<c;l++){r=this.hierarchy[l],i=this.data.hierarchy[l];var h=i.keys,b=i.animationCache;if(this.JITCompile&&o[l][s]!==undefined)r instanceof THREE.Bone?(r.skinMatrix=o[l][s],r.matrixWorldNeedsUpdate=!1):(r.matrix=o[l][s],r.matrixWorldNeedsUpdate=!0);else if(h.length){this.JITCompile&&b&&(r instanceof THREE.Bone?r.skinMatrix=b.originalMatrix:
  r.matrix=b.originalMatrix),t=b.prevKey,n=b.nextKey;if(t&&n){if(n.time<=a){if(f&&this.loop){t=h[0],n=h[1];while(n.time<u)t=n,n=h[t.index+1]}else if(!f){var w=h.length-1;while(n.time<u&&n.index!==w)t=n,n=h[t.index+1]}b.prevKey=t,b.nextKey=n}n.time>=u?t.interpolate(n,u):t.interpolate(n,n.time)}this.data.hierarchy[l].node.updateMatrix(),r.matrixWorldNeedsUpdate=!0}}if(this.JITCompile&&o[0][s]===undefined){this.hierarchy[0].updateMatrixWorld(!0);for(var l=0;l<this.hierarchy.length;l++)this.hierarchy[l]instanceof THREE.Bone?o[l][s]=this.hierarchy[l].skinMatrix.clone():o[l][s]=this.hierarchy[l].matrix.clone()}},THREE.KeyFrameAnimation.prototype.getNextKeyWith=function(e,t,n){var r=this.data.hierarchy[t].keys;n%=r.length;for(;n<r.length;n++)if(r[n].hasTarget(e))return r[n];return r[0]},THREE.KeyFrameAnimation.prototype.getPrevKeyWith=function(e,t,n){var r=this.data.hierarchy[t].keys;n=n>=0?n:n+r.length;for(;n>=0;n--)if(r[n].hasTarget(e))return r[n];return r[r.length-1]},THREE.CubeCamera=function(e,t,n){THREE.Object3D.
  call(this);var r=90,i=1,s=new THREE.PerspectiveCamera(r,i,e,t);s.up.set(0,-1,0),s.lookAt(new THREE.Vector3(1,0,0)),this.add(s);var o=new THREE.PerspectiveCamera(r,i,e,t);o.up.set(0,-1,0),o.lookAt(new THREE.Vector3(-1,0,0)),this.add(o);var u=new THREE.PerspectiveCamera(r,i,e,t);u.up.set(0,0,1),u.lookAt(new THREE.Vector3(0,1,0)),this.add(u);var a=new THREE.PerspectiveCamera(r,i,e,t);a.up.set(0,0,-1),a.lookAt(new THREE.Vector3(0,-1,0)),this.add(a);var f=new THREE.PerspectiveCamera(r,i,e,t);f.up.set(0,-1,0),f.lookAt(new THREE.Vector3(0,0,1)),this.add(f);var l=new THREE.PerspectiveCamera(r,i,e,t);l.up.set(0,-1,0),l.lookAt(new THREE.Vector3(0,0,-1)),this.add(l),this.renderTarget=new THREE.WebGLRenderTargetCube(n,n,{format:THREE.RGBFormat,magFilter:THREE.LinearFilter,minFilter:THREE.LinearFilter}),this.updateCubeMap=function(e,t){var n=this.renderTarget,r=n.generateMipmaps;n.generateMipmaps=!1,n.activeCubeFace=0,e.render(t,s,n),n.activeCubeFace=1,e.render(t,o,n),n.activeCubeFace=2,e.render(t,u,n),n.activeCubeFace=3,e
  .render(t,a,n),n.activeCubeFace=4,e.render(t,f,n),n.generateMipmaps=r,n.activeCubeFace=5,e.render(t,l,n)}},THREE.CubeCamera.prototype=Object.create(THREE.Object3D.prototype),THREE.CombinedCamera=function(e,t,n,r,i,s,o){THREE.Camera.call(this),this.fov=n,this.left=-e/2,this.right=e/2,this.top=t/2,this.bottom=-t/2,this.cameraO=new THREE.OrthographicCamera(e/-2,e/2,t/2,t/-2,s,o),this.cameraP=new THREE.PerspectiveCamera(n,e/t,r,i),this.zoom=1,this.toPerspective();var u=e/t},THREE.CombinedCamera.prototype=Object.create(THREE.Camera.prototype),THREE.CombinedCamera.prototype.toPerspective=function(){this.near=this.cameraP.near,this.far=this.cameraP.far,this.cameraP.fov=this.fov/this.zoom,this.cameraP.updateProjectionMatrix(),this.projectionMatrix=this.cameraP.projectionMatrix,this.inPerspectiveMode=!0,this.inOrthographicMode=!1},THREE.CombinedCamera.prototype.toOrthographic=function(){var e=this.fov,t=this.cameraP.aspect,n=this.cameraP.near,r=this.cameraP.far,i=(n+r)/2,s=Math.tan(e/2)*i,o=2*s,u=o*t,a=u/2;s/=this.zoom
  ,a/=this.zoom,this.cameraO.left=-a,this.cameraO.right=a,this.cameraO.top=s,this.cameraO.bottom=-s,this.cameraO.updateProjectionMatrix(),this.near=this.cameraO.near,this.far=this.cameraO.far,this.projectionMatrix=this.cameraO.projectionMatrix,this.inPerspectiveMode=!1,this.inOrthographicMode=!0},THREE.CombinedCamera.prototype.setSize=function(e,t){this.cameraP.aspect=e/t,this.left=-e/2,this.right=e/2,this.top=t/2,this.bottom=-t/2},THREE.CombinedCamera.prototype.setFov=function(e){this.fov=e,this.inPerspectiveMode?this.toPerspective():this.toOrthographic()},THREE.CombinedCamera.prototype.updateProjectionMatrix=function(){this.inPerspectiveMode?this.toPerspective():(this.toPerspective(),this.toOrthographic())},THREE.CombinedCamera.prototype.setLens=function(e,t){t===undefined&&(t=24);var n=2*Math.atan(t/(e*2))*(180/Math.PI);return this.setFov(n),n},THREE.CombinedCamera.prototype.setZoom=function(e){this.zoom=e,this.inPerspectiveMode?this.toPerspective():this.toOrthographic()},THREE.CombinedCamera.prototype.toFrontView=
  function(){this.rotation.x=0,this.rotation.y=0,this.rotation.z=0,this.rotationAutoUpdate=!1},THREE.CombinedCamera.prototype.toBackView=function(){this.rotation.x=0,this.rotation.y=Math.PI,this.rotation.z=0,this.rotationAutoUpdate=!1},THREE.CombinedCamera.prototype.toLeftView=function(){this.rotation.x=0,this.rotation.y=-Math.PI/2,this.rotation.z=0,this.rotationAutoUpdate=!1},THREE.CombinedCamera.prototype.toRightView=function(){this.rotation.x=0,this.rotation.y=Math.PI/2,this.rotation.z=0,this.rotationAutoUpdate=!1},THREE.CombinedCamera.prototype.toTopView=function(){this.rotation.x=-Math.PI/2,this.rotation.y=0,this.rotation.z=0,this.rotationAutoUpdate=!1},THREE.CombinedCamera.prototype.toBottomView=function(){this.rotation.x=Math.PI/2,this.rotation.y=0,this.rotation.z=0,this.rotationAutoUpdate=!1},THREE.AsteriskGeometry=function(e,t){THREE.Geometry.call(this);var n=e,r=t,i=.707*n,s=.707*r,o=[[n,0,0],[r,0,0],[-n,0,0],[-r,0,0],[0,n,0],[0,r,0],[0,-n,0],[0,-r,0],[0,0,n],[0,0,r],[0,0,-n],[0,0,-r],[i,i,0],[s,s,0],[-
  i,-i,0],[-s,-s,0],[i,-i,0],[s,-s,0],[-i,i,0],[-s,s,0],[i,0,i],[s,0,s],[-i,0,-i],[-s,0,-s],[i,0,-i],[s,0,-s],[-i,0,i],[-s,0,s],[0,i,i],[0,s,s],[0,-i,-i],[0,-s,-s],[0,i,-i],[0,s,-s],[0,-i,i],[0,-s,s]];for(var u=0,a=o.length;u<a;u++){var f=o[u][0],l=o[u][1],c=o[u][2];this.vertices.push(new THREE.Vector3(f,l,c))}},THREE.AsteriskGeometry.prototype=Object.create(THREE.Geometry.prototype),THREE.CircleGeometry=function(e,t,n,r){THREE.Geometry.call(this),e=e||50,n=n!==undefined?n:0,r=r!==undefined?r:Math.PI*2,t=t!==undefined?Math.max(3,t):8;var i,s=[],o=new THREE.Vector3,u=new THREE.UV(.5,.5);this.vertices.push(o),s.push(u);for(i=0;i<=t;i++){var a=new THREE.Vector3;a.x=e*Math.cos(n+i/t*r),a.y=e*Math.sin(n+i/t*r),this.vertices.push(a),s.push(new THREE.UV((a.x/e+1)/2,-(a.y/e+1)/2+1))}var f=new THREE.Vector3(0,0,-1);for(i=1;i<=t;i++){var l=i,c=i+1,h=0;this.faces.push(new THREE.Face3(l,c,h,[f,f,f])),this.faceVertexUvs[0].push([s[i],s[i+1],u])}this.computeCentroids(),this.computeFaceNormals(),this.boundingSphere={radius:e}}
  ,THREE.CircleGeometry.prototype=Object.create(THREE.Geometry.prototype),THREE.CubeGeometry=function(e,t,n,r,i,s){function l(e,t,n,r,i,s,u,a){var f,l,c,h=o.widthSegments,p=o.heightSegments,d=i/2,v=s/2,m=o.vertices.length;if(e==="x"&&t==="y"||e==="y"&&t==="x")f="z";else if(e==="x"&&t==="z"||e==="z"&&t==="x")f="y",p=o.depthSegments;else if(e==="z"&&t==="y"||e==="y"&&t==="z")f="x",h=o.depthSegments;var g=h+1,y=p+1,b=i/h,w=s/p,E=new THREE.Vector3;E[f]=u>0?1:-1;for(c=0;c<y;c++)for(l=0;l<g;l++){var S=new THREE.Vector3;S[e]=(l*b-d)*n,S[t]=(c*w-v)*r,S[f]=u,o.vertices.push(S)}for(c=0;c<p;c++)for(l=0;l<h;l++){var x=l+g*c,T=l+g*(c+1),N=l+1+g*(c+1),C=l+1+g*c,k=new THREE.Face4(x+m,T+m,N+m,C+m);k.normal.copy(E),k.vertexNormals.push(E.clone(),E.clone(),E.clone(),E.clone()),k.materialIndex=a,o.faces.push(k),o.faceVertexUvs[0].push([new THREE.UV(l/h,1-c/p),new THREE.UV(l/h,1-(c+1)/p),new THREE.UV((l+1)/h,1-(c+1)/p),new THREE.UV((l+1)/h,1-c/p)])}}THREE.Geometry.call(this);var o=this;this.width=e,this.height=t,this.depth=n,this.widthSegments=
  r||1,this.heightSegments=i||1,this.depthSegments=s||1;var u=this.width/2,a=this.height/2,f=this.depth/2;l("z","y",-1,-1,this.depth,this.height,u,0),l("z","y",1,-1,this.depth,this.height,-u,1),l("x","z",1,1,this.width,this.depth,a,2),l("x","z",1,-1,this.width,this.depth,-a,3),l("x","y",1,-1,this.width,this.height,f,4),l("x","y",-1,-1,this.width,this.height,-f,5),this.computeCentroids(),this.mergeVertices()},THREE.CubeGeometry.prototype=Object.create(THREE.Geometry.prototype),THREE.CylinderGeometry=function(e,t,n,r,i,s){THREE.Geometry.call(this),e=e!==undefined?e:20,t=t!==undefined?t:20,n=n!==undefined?n:100;var o=n/2,u=r||8,a=i||1,f,l,c=[],h=[];for(l=0;l<=a;l++){var p=[],d=[],v=l/a,m=v*(t-e)+e;for(f=0;f<=u;f++){var g=f/u,y=new THREE.Vector3;y.x=m*Math.sin(g*Math.PI*2),y.y=-v*n+o,y.z=m*Math.cos(g*Math.PI*2),this.vertices.push(y),p.push(this.vertices.length-1),d.push(new THREE.UV(g,1-v))}c.push(p),h.push(d)}var b=(t-e)/n,w,E;for(f=0;f<u;f++){e!==0?(w=this.vertices[c[0][f]].clone(),E=this.vertices[c[0][f+1]].clone
  ()):(w=this.vertices[c[1][f]].clone(),E=this.vertices[c[1][f+1]].clone()),w.setY(Math.sqrt(w.x*w.x+w.z*w.z)*b).normalize(),E.setY(Math.sqrt(E.x*E.x+E.z*E.z)*b).normalize();for(l=0;l<a;l++){var S=c[l][f],x=c[l+1][f],T=c[l+1][f+1],N=c[l][f+1],C=w.clone(),k=w.clone(),L=E.clone(),A=E.clone(),O=h[l][f].clone(),M=h[l+1][f].clone(),_=h[l+1][f+1].clone(),D=h[l][f+1].clone();this.faces.push(new THREE.Face4(S,x,T,N,[C,k,L,A])),this.faceVertexUvs[0].push([O,M,_,D])}}if(!s&&e>0){this.vertices.push(new THREE.Vector3(0,o,0));for(f=0;f<u;f++){var S=c[0][f],x=c[0][f+1],T=this.vertices.length-1,C=new THREE.Vector3(0,1,0),k=new THREE.Vector3(0,1,0),L=new THREE.Vector3(0,1,0),O=h[0][f].clone(),M=h[0][f+1].clone(),_=new THREE.UV(M.u,0);this.faces.push(new THREE.Face3(S,x,T,[C,k,L])),this.faceVertexUvs[0].push([O,M,_])}}if(!s&&t>0){this.vertices.push(new THREE.Vector3(0,-o,0));for(f=0;f<u;f++){var S=c[l][f+1],x=c[l][f],T=this.vertices.length-1,C=new THREE.Vector3(0,-1,0),k=new THREE.Vector3(0,-1,0),L=new THREE.Vector3(0,-1,0),O=h[
  l][f+1].clone(),M=h[l][f].clone(),_=new THREE.UV(M.u,1);this.faces.push(new THREE.Face3(S,x,T,[C,k,L])),this.faceVertexUvs[0].push([O,M,_])}}this.computeCentroids(),this.computeFaceNormals()},THREE.CylinderGeometry.prototype=Object.create(THREE.Geometry.prototype),THREE.ExtrudeGeometry=function(e,t){if(typeof e=="undefined"){e=[];return}THREE.Geometry.call(this),e=e instanceof Array?e:[e],this.shapebb=e[e.length-1].getBoundingBox(),this.addShapeList(e,t),this.computeCentroids(),this.computeFaceNormals()},THREE.ExtrudeGeometry.prototype=Object.create(THREE.Geometry.prototype),THREE.ExtrudeGeometry.prototype.addShapeList=function(e,t){var n=e.length;for(var r=0;r<n;r++){var i=e[r];this.addShape(i,t)}},THREE.ExtrudeGeometry.prototype.addShape=function(e,t){function _(e,t,n){return t||console.log("die"),t.clone().multiplyScalar(n).addSelf(e)}function W(e,t,n){return V(e,t,n)}function X(e,t,n){var r=Math.atan2(t.y-e.y,t.x-e.x),i=Math.atan2(n.y-e.y,n.x-e.x);r>i&&(i+=Math.PI*2);var s=(r+i)/2,o=-Math.cos(s),u=-Math.sin
  (s),a=new THREE.Vector2(o,u);return a}function V(e,t,n){var r=THREE.ExtrudeGeometry.__v1,i=THREE.ExtrudeGeometry.__v2,s=THREE.ExtrudeGeometry.__v3,o=THREE.ExtrudeGeometry.__v4,u=THREE.ExtrudeGeometry.__v5,a=THREE.ExtrudeGeometry.__v6,f,l,c,h,p,d;return r.set(e.x-t.x,e.y-t.y),i.set(e.x-n.x,e.y-n.y),f=r.normalize(),l=i.normalize(),s.set(-f.y,f.x),o.set(l.y,-l.x),u.copy(e).addSelf(s),a.copy(e).addSelf(o),u.equals(a)?o.clone():(u.copy(t).addSelf(s),a.copy(n).addSelf(o),c=f.dot(o),h=a.subSelf(u).dot(o),c===0&&(console.log("Either infinite or no solutions!"),h===0?console.log("Its finite solutions."):console.log("Too bad, no solutions.")),p=h/c,p<0?X(e,t,n):(d=f.multiplyScalar(p).addSelf(u),d.subSelf(e).clone()))}function st(){if(o){var e=0,t=F*e;for(J=0;J<q;J++)I=O[J],ft(I[2]+t,I[1]+t,I[0]+t,!0);e=a+s*2,t=F*e;for(J=0;J<q;J++)I=O[J],ft(I[0]+t,I[1]+t,I[2]+t,!1)}else{for(J=0;J<q;J++)I=O[J],ft(I[2],I[1],I[0],!0);for(J=0;J<q;J++)I=O[J],ft(I[0]+F*a,I[1]+F*a,I[2]+F*a,!1)}}function ot(){var e=0;ut(M,e),e+=M.length;for(E=0,
  S=L.length;E<S;E++)w=L[E],ut(w,e),e+=w.length}function ut(e,t){var n,r;J=e.length;while(--J>=0){n=J,r=J-1,r<0&&(r=e.length-1);var i=0,o=a+s*2;for(i=0;i<o;i++){var u=F*i,f=F*(i+1),l=t+n+u,c=t+r+u,h=t+r+f,p=t+n+f;lt(l,c,h,p,e,i,o,n,r)}}}function at(e,t,n){x.vertices.push(new THREE.Vector3(e,t,n))}function ft(n,r,i,s){n+=N,r+=N,i+=N,x.faces.push(new THREE.Face3(n,r,i,null,null,h));var o=s?d.generateBottomUV(x,e,t,n,r,i):d.generateTopUV(x,e,t,n,r,i);x.faceVertexUvs[0].push(o)}function lt(n,r,i,s,o,u,a,f,l){n+=N,r+=N,i+=N,s+=N,x.faces.push(new THREE.Face4(n,r,i,s,null,null,p));var c=d.generateSideWallUV(x,e,o,t,n,r,i,s,u,a,f,l);x.faceVertexUvs[0].push(c)}var n=t.amount!==undefined?t.amount:100,r=t.bevelThickness!==undefined?t.bevelThickness:6,i=t.bevelSize!==undefined?t.bevelSize:r-2,s=t.bevelSegments!==undefined?t.bevelSegments:3,o=t.bevelEnabled!==undefined?t.bevelEnabled:!0,u=t.curveSegments!==undefined?t.curveSegments:12,a=t.steps!==undefined?t.steps:1,f=t.extrudePath,l,c=!1,h=t.material,p=t.extrudeMaterial,d=t
  .UVGenerator!==undefined?t.UVGenerator:THREE.ExtrudeGeometry.WorldUVGenerator,v=this.shapebb,m,g,y,b;f&&(l=f.getSpacedPoints(a),c=!0,o=!1,m=t.frames!==undefined?t.frames:new THREE.TubeGeometry.FrenetFrames(f,a,!1),g=new THREE.Vector3,y=new THREE.Vector3,b=new THREE.Vector3),o||(s=0,r=0,i=0);var w,E,S,x=this,T=[],N=this.vertices.length,C=e.extractPoints(u),k=C.shape,L=C.holes,A=!THREE.Shape.Utils.isClockWise(k);if(A){k=k.reverse();for(E=0,S=L.length;E<S;E++)w=L[E],THREE.Shape.Utils.isClockWise(w)&&(L[E]=w.reverse());A=!1}var O=THREE.Shape.Utils.triangulateShape(k,L),M=k;for(E=0,S=L.length;E<S;E++)w=L[E],k=k.concat(w);var D,P,H,B,j,F=k.length,I,q=O.length,R,U=M.length,z=180/Math.PI,$=[];for(var J=0,K=M.length,Q=K-1,G=J+1;J<K;J++,Q++,G++){Q===K&&(Q=0),G===K&&(G=0);var Y=M[J],Z=M[Q],et=M[G];$[J]=W(M[J],M[Q],M[G])}var tt=[],nt,rt=$.concat();for(E=0,S=L.length;E<S;E++){w=L[E],nt=[];for(J=0,K=w.length,Q=K-1,G=J+1;J<K;J++,Q++,G++)Q===K&&(Q=0),G===K&&(G=0),nt[J]=W(w[J],w[Q],w[G]);tt.push(nt),rt=rt.concat(nt)}for(D=0;D<
  s;D++){H=D/s,B=r*(1-H),P=i*Math.sin(H*Math.PI/2);for(J=0,K=M.length;J<K;J++)j=_(M[J],$[J],P),at(j.x,j.y,-B);for(E=0,S=L.length;E<S;E++){w=L[E],nt=tt[E];for(J=0,K=w.length;J<K;J++)j=_(w[J],nt[J],P),at(j.x,j.y,-B)}}P=i;for(J=0;J<F;J++)j=o?_(k[J],rt[J],P):k[J],c?(y.copy(m.normals[0]).multiplyScalar(j.x),g.copy(m.binormals[0]).multiplyScalar(j.y),b.copy(l[0]).addSelf(y).addSelf(g),at(b.x,b.y,b.z)):at(j.x,j.y,0);var it;for(it=1;it<=a;it++)for(J=0;J<F;J++)j=o?_(k[J],rt[J],P):k[J],c?(y.copy(m.normals[it]).multiplyScalar(j.x),g.copy(m.binormals[it]).multiplyScalar(j.y),b.copy(l[it]).addSelf(y).addSelf(g),at(b.x,b.y,b.z)):at(j.x,j.y,n/a*it);for(D=s-1;D>=0;D--){H=D/s,B=r*(1-H),P=i*Math.sin(H*Math.PI/2);for(J=0,K=M.length;J<K;J++)j=_(M[J],$[J],P),at(j.x,j.y,n+B);for(E=0,S=L.length;E<S;E++){w=L[E],nt=tt[E];for(J=0,K=w.length;J<K;J++)j=_(w[J],nt[J],P),c?at(j.x,j.y+l[a-1].y,l[a-1].x+B):at(j.x,j.y,n+B)}}st(),ot()},THREE.ExtrudeGeometry.WorldUVGenerator={generateTopUV:function(e,t,n,r,i,s){var o=e.vertices[r].x,u=e.vertices[r
  ].y,a=e.vertices[i].x,f=e.vertices[i].y,l=e.vertices[s].x,c=e.vertices[s].y;return[new THREE.UV(o,u),new THREE.UV(a,f),new THREE.UV(l,c)]},generateBottomUV:function(e,t,n,r,i,s){return this.generateTopUV(e,t,n,r,i,s)},generateSideWallUV:function(e,t,n,r,i,s,o,u,a,f,l,c){var h=e.vertices[i].x,p=e.vertices[i].y,d=e.vertices[i].z,v=e.vertices[s].x,m=e.vertices[s].y,g=e.vertices[s].z,y=e.vertices[o].x,b=e.vertices[o].y,w=e.vertices[o].z,E=e.vertices[u].x,S=e.vertices[u].y,x=e.vertices[u].z;return Math.abs(p-m)<.01?[new THREE.UV(h,1-d),new THREE.UV(v,1-g),new THREE.UV(y,1-w),new THREE.UV(E,1-x)]:[new THREE.UV(p,1-d),new THREE.UV(m,1-g),new THREE.UV(b,1-w),new THREE.UV(S,1-x)]}},THREE.ExtrudeGeometry.__v1=new THREE.Vector2,THREE.ExtrudeGeometry.__v2=new THREE.Vector2,THREE.ExtrudeGeometry.__v3=new THREE.Vector2,THREE.ExtrudeGeometry.__v4=new THREE.Vector2,THREE.ExtrudeGeometry.__v5=new THREE.Vector2,THREE.ExtrudeGeometry.__v6=new THREE.Vector2,THREE.ShapeGeometry=function(e,t){THREE.Geometry.call(this),e instanceof 
  Array==0&&(e=[e]),this.shapebb=e[e.length-1].getBoundingBox(),this.addShapeList(e,t),this.computeCentroids(),this.computeFaceNormals()},THREE.ShapeGeometry.prototype=Object.create(THREE.Geometry.prototype),THREE.ShapeGeometry.prototype.addShapeList=function(e,t){for(var n=0,r=e.length;n<r;n++)this.addShape(e[n],t);return this},THREE.ShapeGeometry.prototype.addShape=function(e,t){t===undefined&&(t={});var n=t.curveSegments!==undefined?t.curveSegments:12,r=t.material,i=t.UVGenerator===undefined?THREE.ExtrudeGeometry.WorldUVGenerator:t.UVGenerator,s=this.shapebb,o,u,a,f,l=this.vertices.length,c=e.extractPoints(n),h=c.shape,p=c.holes,d=!THREE.Shape.Utils.isClockWise(h);if(d){h=h.reverse();for(o=0,u=p.length;o<u;o++)a=p[o],THREE.Shape.Utils.isClockWise(a)&&(p[o]=a.reverse());d=!1}var v=THREE.Shape.Utils.triangulateShape(h,p),m=h;for(o=0,u=p.length;o<u;o++)a=p[o],h=h.concat(a);var g,y=h.length,b,w=v.length,E,S=m.length;for(o=0;o<y;o++)g=h[o],this.vertices.push(new THREE.Vector3(g.x,g.y,0));for(o=0;o<w;o++){b=v[o];var x=
  b[0]+l,T=b[1]+l,N=b[2]+l;this.faces.push(new THREE.Face3(x,T,N,null,null,r)),this.faceVertexUvs[0].push(i.generateBottomUV(this,e,t,x,T,N))}},THREE.LatheGeometry=function(e,t,n){THREE.Geometry.call(this);var r=t||12,i=n||2*Math.PI,s=[],o=(new THREE.Matrix4).makeRotationZ(i/r);for(var u=0;u<e.length;u++)s[u]=e[u].clone(),this.vertices.push(s[u]);var a,f=r+1;for(a=0;a<f;a++)for(var u=0;u<s.length;u++)s[u]=o.multiplyVector3(s[u].clone()),this.vertices.push(s[u]);for(a=0;a<r;a++)for(var l=0,c=e.length;l<c-1;l++){var h=a*c+l,p=(a+1)%f*c+l,d=(a+1)%f*c+(l+1)%c,v=a*c+(l+1)%c;this.faces.push(new THREE.Face4(h,p,d,v)),this.faceVertexUvs[0].push([new THREE.UV(1-a/r,l/c),new THREE.UV(1-(a+1)/r,l/c),new THREE.UV(1-(a+1)/r,(l+1)/c),new THREE.UV(1-a/r,(l+1)/c)])}this.computeCentroids(),this.computeFaceNormals(),this.computeVertexNormals()},THREE.LatheGeometry.prototype=Object.create(THREE.Geometry.prototype),THREE.PlaneGeometry=function(e,t,n,r){THREE.Geometry.call(this),this.width=e,this.height=t,this.widthSegments=n||1,this
  .heightSegments=r||1;var i,s,o=e/2,u=t/2,a=this.widthSegments,f=this.heightSegments,l=a+1,c=f+1,h=this.width/a,p=this.height/f,d=new THREE.Vector3(0,0,1);for(s=0;s<c;s++)for(i=0;i<l;i++){var v=i*h-o,m=s*p-u;this.vertices.push(new THREE.Vector3(v,-m,0))}for(s=0;s<f;s++)for(i=0;i<a;i++){var g=i+l*s,y=i+l*(s+1),b=i+1+l*(s+1),w=i+1+l*s,E=new THREE.Face4(g,y,b,w);E.normal.copy(d),E.vertexNormals.push(d.clone(),d.clone(),d.clone(),d.clone()),this.faces.push(E),this.faceVertexUvs[0].push([new THREE.UV(i/a,1-s/f),new THREE.UV(i/a,1-(s+1)/f),new THREE.UV((i+1)/a,1-(s+1)/f),new THREE.UV((i+1)/a,1-s/f)])}this.computeCentroids()},THREE.PlaneGeometry.prototype=Object.create(THREE.Geometry.prototype),THREE.SphereGeometry=function(e,t,n,r,i,s,o){THREE.Geometry.call(this),this.radius=e||50,this.widthSegments=Math.max(3,Math.floor(t)||8),this.heightSegments=Math.max(2,Math.floor(n)||6),r=r!==undefined?r:0,i=i!==undefined?i:Math.PI*2,s=s!==undefined?s:0,o=o!==undefined?o:Math.PI;var u,a,f=[],l=[];for(a=0;a<=this.heightSegments;
  a++){var c=[],h=[];for(u=0;u<=this.widthSegments;u++){var p=u/this.widthSegments,d=a/this.heightSegments,v=new THREE.Vector3;v.x=-this.radius*Math.cos(r+p*i)*Math.sin(s+d*o),v.y=this.radius*Math.cos(s+d*o),v.z=this.radius*Math.sin(r+p*i)*Math.sin(s+d*o),this.vertices.push(v),c.push(this.vertices.length-1),h.push(new THREE.UV(p,1-d))}f.push(c),l.push(h)}for(a=0;a<this.heightSegments;a++)for(u=0;u<this.widthSegments;u++){var m=f[a][u+1],g=f[a][u],y=f[a+1][u],b=f[a+1][u+1],w=this.vertices[m].clone().normalize(),E=this.vertices[g].clone().normalize(),S=this.vertices[y].clone().normalize(),x=this.vertices[b].clone().normalize(),T=l[a][u+1].clone(),N=l[a][u].clone(),C=l[a+1][u].clone(),k=l[a+1][u+1].clone();Math.abs(this.vertices[m].y)===this.radius?(this.faces.push(new THREE.Face3(m,y,b,[w,S,x])),this.faceVertexUvs[0].push([T,C,k])):Math.abs(this.vertices[y].y)===this.radius?(this.faces.push(new THREE.Face3(m,g,y,[w,E,S])),this.faceVertexUvs[0].push([T,N,C])):(this.faces.push(new THREE.Face4(m,g,y,b,[w,E,S,x])),this
  .faceVertexUvs[0].push([T,N,C,k]))}this.computeCentroids(),this.computeFaceNormals(),this.boundingSphere={radius:this.radius}},THREE.SphereGeometry.prototype=Object.create(THREE.Geometry.prototype),THREE.TextGeometry=function(e,t){var n=THREE.FontUtils.generateShapes(e,t);t.amount=t.height!==undefined?t.height:50,t.bevelThickness===undefined&&(t.bevelThickness=10),t.bevelSize===undefined&&(t.bevelSize=8),t.bevelEnabled===undefined&&(t.bevelEnabled=!1),THREE.ExtrudeGeometry.call(this,n,t)},THREE.TextGeometry.prototype=Object.create(THREE.ExtrudeGeometry.prototype),THREE.TorusGeometry=function(e,t,n,r,i){THREE.Geometry.call(this);var s=this;this.radius=e||100,this.tube=t||40,this.radialSegments=n||8,this.tubularSegments=r||6,this.arc=i||Math.PI*2;var o=new THREE.Vector3,u=[],a=[];for(var f=0;f<=this.radialSegments;f++)for(var l=0;l<=this.tubularSegments;l++){var c=l/this.tubularSegments*this.arc,h=f/this.radialSegments*Math.PI*2;o.x=this.radius*Math.cos(c),o.y=this.radius*Math.sin(c);var p=new THREE.Vector3;p.x=
  (this.radius+this.tube*Math.cos(h))*Math.cos(c),p.y=(this.radius+this.tube*Math.cos(h))*Math.sin(c),p.z=this.tube*Math.sin(h),this.vertices.push(p),u.push(new THREE.UV(l/this.tubularSegments,f/this.radialSegments)),a.push(p.clone().subSelf(o).normalize())}for(var f=1;f<=this.radialSegments;f++)for(var l=1;l<=this.tubularSegments;l++){var d=(this.tubularSegments+1)*f+l-1,v=(this.tubularSegments+1)*(f-1)+l-1,m=(this.tubularSegments+1)*(f-1)+l,g=(this.tubularSegments+1)*f+l,y=new THREE.Face4(d,v,m,g,[a[d],a[v],a[m],a[g]]);y.normal.addSelf(a[d]),y.normal.addSelf(a[v]),y.normal.addSelf(a[m]),y.normal.addSelf(a[g]),y.normal.normalize(),this.faces.push(y),this.faceVertexUvs[0].push([u[d].clone(),u[v].clone(),u[m].clone(),u[g].clone()])}this.computeCentroids()},THREE.TorusGeometry.prototype=Object.create(THREE.Geometry.prototype),THREE.TorusKnotGeometry=function(e,t,n,r,i,s,o){function A(e,t,n){return u.vertices.push(new THREE.Vector3(e,t,n))-1}function O(e,t,n,r,i,s){var o=Math.cos(e),u=Math.cos(t),a=Math.sin(e),f=n/
  r*e,l=Math.cos(f),c=i*(2+l)*.5*o,h=i*(2+l)*a*.5,p=s*i*Math.sin(f)*.5;return new THREE.Vector3(c,h,p)}THREE.Geometry.call(this);var u=this;this.radius=e||200,this.tube=t||40,this.radialSegments=n||64,this.tubularSegments=r||8,this.p=i||2,this.q=s||3,this.heightScale=o||1,this.grid=new Array(this.radialSegments);var a=new THREE.Vector3,f=new THREE.Vector3,l=new THREE.Vector3;for(var c=0;c<this.radialSegments;++c){this.grid[c]=new Array(this.tubularSegments);for(var h=0;h<this.tubularSegments;++h){var p=c/this.radialSegments*2*this.p*Math.PI,d=h/this.tubularSegments*2*Math.PI,v=O(p,d,this.q,this.p,this.radius,this.heightScale),m=O(p+.01,d,this.q,this.p,this.radius,this.heightScale),g,y;a.sub(m,v),f.add(m,v),l.cross(a,f),f.cross(l,a),l.normalize(),f.normalize(),g=-this.tube*Math.cos(d),y=this.tube*Math.sin(d),v.x+=g*f.x+y*l.x,v.y+=g*f.y+y*l.y,v.z+=g*f.z+y*l.z,this.grid[c][h]=A(v.x,v.y,v.z)}}for(var c=0;c<this.radialSegments;++c)for(var h=0;h<this.tubularSegments;++h){var b=(c+1)%this.radialSegments,w=(h+1)%this.tubularSegments
  ,E=this.grid[c][h],S=this.grid[b][h],x=this.grid[b][w],T=this.grid[c][w],N=new THREE.UV(c/this.radialSegments,h/this.tubularSegments),C=new THREE.UV((c+1)/this.radialSegments,h/this.tubularSegments),k=new THREE.UV((c+1)/this.radialSegments,(h+1)/this.tubularSegments),L=new THREE.UV(c/this.radialSegments,(h+1)/this.tubularSegments);this.faces.push(new THREE.Face4(E,S,x,T)),this.faceVertexUvs[0].push([N,C,k,L])}this.computeCentroids(),this.computeFaceNormals(),this.computeVertexNormals()},THREE.TorusKnotGeometry.prototype=Object.create(THREE.Geometry.prototype),THREE.TubeGeometry=function(e,t,n,r,i,s){function I(e,t,n){return o.vertices.push(new THREE.Vector3(e,t,n))-1}THREE.Geometry.call(this),this.path=e,this.segments=t||64,this.radius=n||1,this.radiusSegments=r||8,this.closed=i||!1,s&&(this.debug=new THREE.Object3D),this.grid=[];var o=this,u,a,f,l=this.segments+1,c,h,p,d,v,m,g,y,b,w,E,S=new THREE.Vector3,x,T,N,C,k,L,A,O,M,_,D,P,H=new THREE.TubeGeometry.FrenetFrames(this.path,this.segments,this.closed),B=H.tangents
  ,j=H.normals,F=H.binormals;this.tangents=B,this.normals=j,this.binormals=F;for(x=0;x<l;x++){this.grid[x]=[],g=x/(l-1),E=e.getPointAt(g),u=B[x],a=j[x],f=F[x],this.debug&&(this.debug.add(new THREE.ArrowHelper(u,E,n,255)),this.debug.add(new THREE.ArrowHelper(a,E,n,16711680)),this.debug.add(new THREE.ArrowHelper(f,E,n,65280)));for(T=0;T<this.radiusSegments;T++)y=T/this.radiusSegments*2*Math.PI,b=-this.radius*Math.cos(y),w=this.radius*Math.sin(y),S.copy(E),S.x+=b*a.x+w*f.x,S.y+=b*a.y+w*f.y,S.z+=b*a.z+w*f.z,this.grid[x][T]=I(S.x,S.y,S.z)}for(x=0;x<this.segments;x++)for(T=0;T<this.radiusSegments;T++)N=this.closed?(x+1)%this.segments:x+1,C=(T+1)%this.radiusSegments,k=this.grid[x][T],L=this.grid[N][T],A=this.grid[N][C],O=this.grid[x][C],M=new THREE.UV(x/this.segments,T/this.radiusSegments),_=new THREE.UV((x+1)/this.segments,T/this.radiusSegments),D=new THREE.UV((x+1)/this.segments,(T+1)/this.radiusSegments),P=new THREE.UV(x/this.segments,(T+1)/this.radiusSegments),this.faces.push(new THREE.Face4(k,L,A,O)),this.faceVertexUvs
  [0].push([M,_,D,P]);this.computeCentroids(),this.computeFaceNormals(),this.computeVertexNormals()},THREE.TubeGeometry.prototype=Object.create(THREE.Geometry.prototype),THREE.TubeGeometry.FrenetFrames=function(e,t,n){function E(e){u[0]=new THREE.Vector3,a[0]=new THREE.Vector3,e===undefined&&(e=new THREE.Vector3(0,0,1)),u[0].cross(e,o[0]).normalize(),a[0].cross(o[0],u[0]).normalize()}function S(){var t=e.getTangentAt(p);u[0]=(new THREE.Vector3).sub(t,o[0]).normalize(),a[0]=(new THREE.Vector3).cross(o[0],u[0]),u[0].cross(a[0],o[0]).normalize(),a[0].cross(o[0],u[0]).normalize()}function x(){u[0]=new THREE.Vector3,a[0]=new THREE.Vector3,d=Number.MAX_VALUE,v=Math.abs(o[0].x),m=Math.abs(o[0].y),g=Math.abs(o[0].z),v<=d&&(d=v,i.set(1,0,0)),m<=d&&(d=m,i.set(0,1,0)),g<=d&&i.set(0,0,1),f.cross(o[0],i).normalize(),u[0].cross(o[0],f),a[0].cross(o[0],u[0])}var r=new THREE.Vector3,i=new THREE.Vector3,s=new THREE.Vector3,o=[],u=[],a=[],f=new THREE.Vector3,l=new THREE.Matrix4,c=t+1,h,p=1e-4,d,v,m,g,y,b,w;this.tangents=o,this.normals=
  u,this.binormals=a;for(y=0;y<c;y++)b=y/(c-1),o[y]=e.getTangentAt(b),o[y].normalize();x();for(y=1;y<c;y++)u[y]=u[y-1].clone(),a[y]=a[y-1].clone(),f.cross(o[y-1],o[y]),f.length()>p&&(f.normalize(),h=Math.acos(o[y-1].dot(o[y])),l.makeRotationAxis(f,h).multiplyVector3(u[y])),a[y].cross(o[y],u[y]);if(n){h=Math.acos(u[0].dot(u[c-1])),h/=c-1,o[0].dot(f.cross(u[0],u[c-1]))>0&&(h=-h);for(y=1;y<c;y++)l.makeRotationAxis(o[y],h*y).multiplyVector3(u[y]),a[y].cross(o[y],u[y])}},THREE.PolyhedronGeometry=function(e,t,n,r){function f(e){var t=e.normalize().clone();t.index=i.vertices.push(t)-1;var n=h(e)/2/Math.PI+.5,r=p(e)/Math.PI+.5;return t.uv=new THREE.UV(n,1-r),t}function l(e,t,n,r){if(r<1){var s=new THREE.Face3(e.index,t.index,n.index,[e.clone(),t.clone(),n.clone()]);s.centroid.addSelf(e).addSelf(t).addSelf(n).divideScalar(3),s.normal=s.centroid.clone().normalize(),i.faces.push(s);var o=h(s.centroid);i.faceVertexUvs[0].push([d(e.uv,e,o),d(t.uv,t,o),d(n.uv,n,o)])}else r-=1,l(e,c(e,t),c(e,n),r),l(c(e,t),t,c(t,n),r),l(c(e,n)
  ,c(t,n),n,r),l(c(e,t),c(t,n),c(e,n),r)}function c(e,t){u[e.index]||(u[e.index]=[]),u[t.index]||(u[t.index]=[]);var n=u[e.index][t.index];return n===undefined&&(u[e.index][t.index]=u[t.index][e.index]=n=f((new THREE.Vector3).add(e,t).divideScalar(2))),n}function h(e){return Math.atan2(e.z,-e.x)}function p(e){return Math.atan2(-e.y,Math.sqrt(e.x*e.x+e.z*e.z))}function d(e,t,n){return n<0&&e.u===1&&(e=new THREE.UV(e.u-1,e.v)),t.x===0&&t.z===0&&(e=new THREE.UV(n/2/Math.PI+.5,e.v)),e}THREE.Geometry.call(this),n=n||1,r=r||0;var i=this;for(var s=0,o=e.length;s<o;s++)f(new THREE.Vector3(e[s][0],e[s][1],e[s][2]));var u=[],a=this.vertices;for(var s=0,o=t.length;s<o;s++)l(a[t[s][0]],a[t[s][1]],a[t[s][2]],r);this.mergeVertices();for(var s=0,o=this.vertices.length;s<o;s++)this.vertices[s].multiplyScalar(n);this.computeCentroids(),this.boundingSphere={radius:n}},THREE.PolyhedronGeometry.prototype=Object.create(THREE.Geometry.prototype),THREE.IcosahedronGeometry=function(e,t){var n=(1+Math.sqrt(5))/2,r=[[-1,n,0],[1,n,0],[-1,-
  n,0],[1,-n,0],[0,-1,n],[0,1,n],[0,-1,-n],[0,1,-n],[n,0,-1],[n,0,1],[-n,0,-1],[-n,0,1]],i=[[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]];THREE.PolyhedronGeometry.call(this,r,i,e,t)},THREE.IcosahedronGeometry.prototype=Object.create(THREE.Geometry.prototype),THREE.OctahedronGeometry=function(e,t){var n=[[1,0,0],[-1,0,0],[0,1,0],[0,-1,0],[0,0,1],[0,0,-1]],r=[[0,2,4],[0,4,3],[0,3,5],[0,5,2],[1,2,5],[1,5,3],[1,3,4],[1,4,2]];THREE.PolyhedronGeometry.call(this,n,r,e,t)},THREE.OctahedronGeometry.prototype=Object.create(THREE.Geometry.prototype),THREE.TetrahedronGeometry=function(e,t){var n=[[1,1,1],[-1,-1,1],[-1,1,-1],[1,-1,-1]],r=[[2,1,0],[0,3,2],[1,3,0],[2,3,1]];THREE.PolyhedronGeometry.call(this,n,r,e,t)},THREE.TetrahedronGeometry.prototype=Object.create(THREE.Geometry.prototype),THREE.ParametricGeometry=function(e,t,n,r){THREE.Geometry.call(this);var i=this.vertices,s=this.faces,o=this.faceVertexUvs
  [0];r=r===undefined?!1:r;var u,a,f,l,c,h,p=n+1,d=t+1;for(u=0;u<=n;u++){h=u/n;for(f=0;f<=t;f++)c=f/t,l=e(c,h),i.push(l)}var v,m,g,y,b,w,E,S;for(u=0;u<n;u++)for(f=0;f<t;f++)v=u*d+f,m=u*d+f+1,g=(u+1)*d+f,y=(u+1)*d+f+1,b=new THREE.UV(f/t,u/n),w=new THREE.UV((f+1)/t,u/n),E=new THREE.UV(f/t,(u+1)/n),S=new THREE.UV((f+1)/t,(u+1)/n),r?(s.push(new THREE.Face3(v,m,g)),s.push(new THREE.Face3(m,y,g)),o.push([b,w,E]),o.push([w,S,E])):(s.push(new THREE.Face4(v,m,y,g)),o.push([b,w,S,E]));this.computeCentroids(),this.computeFaceNormals(),this.computeVertexNormals()},THREE.ParametricGeometry.prototype=Object.create(THREE.Geometry.prototype),THREE.ConvexGeometry=function(e){function r(n){var r=e[n].clone(),s=r.length();r.x+=s*u(),r.y+=s*u(),r.z+=s*u();var a=[];for(var f=0;f<t.length;){var l=t[f];if(i(l,r)){for(var c=0;c<3;c++){var h=[l[c],l[(c+1)%3]],p=!0;for(var d=0;d<a.length;d++)if(o(a[d],h)){a[d]=a[a.length-1],a.pop(),p=!1;break}p&&a.push(h)}t[f]=t[t.length-1],t.pop()}else f++}for(var d=0;d<a.length;d++)t.push([a[d][0],a[d]
  [1],n])}function i(t,n){var r=e[t[0]],i=e[t[1]],o=e[t[2]],u=s(r,i,o),a=u.dot(r);return u.dot(n)>=a}function s(e,t,n){var r=new THREE.Vector3,i=new THREE.Vector3;return r.sub(n,t),i.sub(e,t),r.crossSelf(i),r.normalize(),r}function o(e,t){return e[0]===t[1]&&e[1]===t[0]}function u(){return(Math.random()-.5)*2*1e-6}function a(e){var t=e.length();return new THREE.UV(e.x/t,e.y/t)}THREE.Geometry.call(this);var t=[[0,1,2],[0,2,1]];for(var n=3;n<e.length;n++)r(n);var f=0,l=new Array(e.length);for(var n=0;n<t.length;n++){var c=t[n];for(var h=0;h<3;h++)l[c[h]]===undefined&&(l[c[h]]=f++,this.vertices.push(e[c[h]])),c[h]=l[c[h]]}for(var n=0;n<t.length;n++)this.faces.push(new THREE.Face3(t[n][0],t[n][1],t[n][2]));for(var n=0;n<this.faces.length;n++){var c=this.faces[n];this.faceVertexUvs[0].push([a(this.vertices[c.a]),a(this.vertices[c.b]),a(this.vertices[c.c])])}this.computeCentroids(),this.computeFaceNormals(),this.computeVertexNormals()},THREE.ConvexGeometry.prototype=Object.create(THREE.Geometry.prototype),THREE.AxisHelper=
  function(e){var t=new THREE.Geometry;t.vertices.push(new THREE.Vector3,new THREE.Vector3(e||1,0,0),new THREE.Vector3,new THREE.Vector3(0,e||1,0),new THREE.Vector3,new THREE.Vector3(0,0,e||1)),t.colors.push(new THREE.Color(16711680),new THREE.Color(16755200),new THREE.Color(65280),new THREE.Color(11206400),new THREE.Color(255),new THREE.Color(43775));var n=new THREE.LineBasicMaterial({vertexColors:THREE.VertexColors});THREE.Line.call(this,t,n,THREE.LinePieces)},THREE.AxisHelper.prototype=Object.create(THREE.Line.prototype),THREE.ArrowHelper=function(e,t,n,r){THREE.Object3D.call(this),r===undefined&&(r=16776960),n===undefined&&(n=20);var i=new THREE.Geometry;i.vertices.push(new THREE.Vector3(0,0,0)),i.vertices.push(new THREE.Vector3(0,1,0)),this.line=new THREE.Line(i,new THREE.LineBasicMaterial({color:r})),this.add(this.line);var s=new THREE.CylinderGeometry(0,.05,.25,5,1);this.cone=new THREE.Mesh(s,new THREE.MeshBasicMaterial({color:r})),this.cone.position.set(0,1,0),this.add(this.cone),t instanceof THREE.Vector3&&
  (this.position=t),this.setDirection(e),this.setLength(n)},THREE.ArrowHelper.prototype=Object.create(THREE.Object3D.prototype),THREE.ArrowHelper.prototype.setDirection=function(e){var t=(new THREE.Vector3(0,1,0)).crossSelf(e),n=Math.acos((new THREE.Vector3(0,1,0)).dot(e.clone().normalize()));this.matrix=(new THREE.Matrix4).makeRotationAxis(t.normalize(),n),this.rotation.setEulerFromRotationMatrix(this.matrix,this.eulerOrder)},THREE.ArrowHelper.prototype.setLength=function(e){this.scale.set(e,e,e)},THREE.ArrowHelper.prototype.setColor=function(e){this.line.material.color.setHex(e),this.cone.material.color.setHex(e)},THREE.CameraHelper=function(e){function u(e,t,n){a(e,n),a(t,n)}function a(e,n){t.geometry.vertices.push(new THREE.Vector3),t.geometry.colors.push(new THREE.Color(n)),t.pointMap[e]===undefined&&(t.pointMap[e]=[]),t.pointMap[e].push(t.geometry.vertices.length-1)}THREE.Line.call(this);var t=this;this.geometry=new THREE.Geometry,this.material=new THREE.LineBasicMaterial({color:16777215,vertexColors:THREE
  .FaceColors}),this.type=THREE.LinePieces,this.matrixWorld=e.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap={};var n=16755200,r=16711680,i=43775,s=16777215,o=3355443;u("n1","n2",n),u("n2","n4",n),u("n4","n3",n),u("n3","n1",n),u("f1","f2",n),u("f2","f4",n),u("f4","f3",n),u("f3","f1",n),u("n1","f1",n),u("n2","f2",n),u("n3","f3",n),u("n4","f4",n),u("p","n1",r),u("p","n2",r),u("p","n3",r),u("p","n4",r),u("u1","u2",i),u("u2","u3",i),u("u3","u1",i),u("c","t",s),u("p","c",o),u("cn1","cn2",o),u("cn3","cn4",o),u("cf1","cf2",o),u("cf3","cf4",o),this.camera=e,this.update(e)},THREE.CameraHelper.prototype=Object.create(THREE.Line.prototype),THREE.CameraHelper.prototype.update=function(){function r(t,n,r,i){THREE.CameraHelper.__v.set(n,r,i),THREE.CameraHelper.__projector.unprojectVector(THREE.CameraHelper.__v,THREE.CameraHelper.__c);var s=e.pointMap[t];if(s!==undefined)for(var o=0,u=s.length;o<u;o++)e.geometry.vertices[s[o]].copy(THREE.CameraHelper.__v)}var e=this,t=1,n=1;THREE.CameraHelper.__c.projectionMatrix.copy(this
  .camera.projectionMatrix),r("c",0,0,-1),r("t",0,0,1),r("n1",-t,-n,-1),r("n2",t,-n,-1),r("n3",-t,n,-1),r("n4",t,n,-1),r("f1",-t,-n,1),r("f2",t,-n,1),r("f3",-t,n,1),r("f4",t,n,1),r("u1",t*.7,n*1.1,-1),r("u2",-t*.7,n*1.1,-1),r("u3",0,n*2,-1),r("cf1",-t,0,1),r("cf2",t,0,1),r("cf3",0,-n,1),r("cf4",0,n,1),r("cn1",-t,0,-1),r("cn2",t,0,-1),r("cn3",0,-n,-1),r("cn4",0,n,-1),this.geometry.verticesNeedUpdate=!0},THREE.CameraHelper.__projector=new THREE.Projector,THREE.CameraHelper.__v=new THREE.Vector3,THREE.CameraHelper.__c=new THREE.Camera,THREE.DirectionalLightHelper=function(e,t,n){THREE.Object3D.call(this),this.light=e,this.position=e.position,this.direction=new THREE.Vector3,this.direction.sub(e.target.position,e.position),this.color=e.color.clone();var r=THREE.Math.clamp(e.intensity,0,1);this.color.r*=r,this.color.g*=r,this.color.b*=r;var i=this.color.getHex(),s=new THREE.SphereGeometry(t,16,8),o=new THREE.AsteriskGeometry(t*1.25,t*2.25),u=new THREE.MeshBasicMaterial({color:i,fog:!1}),a=new THREE.LineBasicMaterial(
  {color:i,fog:!1});this.lightArrow=new THREE.ArrowHelper(this.direction,null,n,i),this.lightSphere=new THREE.Mesh(s,u),this.lightArrow.cone.material.fog=!1,this.lightArrow.line.material.fog=!1,this.lightRays=new THREE.Line(o,a,THREE.LinePieces),this.add(this.lightArrow),this.add(this.lightSphere),this.add(this.lightRays),this.lightSphere.properties.isGizmo=!0,this.lightSphere.properties.gizmoSubject=e,this.lightSphere.properties.gizmoRoot=this,this.targetSphere=null;if(e.target.properties.targetInverse){var f=new THREE.SphereGeometry(t,8,4),l=new THREE.MeshBasicMaterial({color:i,wireframe:!0,fog:!1});this.targetSphere=new THREE.Mesh(f,l),this.targetSphere.position=e.target.position,this.targetSphere.properties.isGizmo=!0,this.targetSphere.properties.gizmoSubject=e.target,this.targetSphere.properties.gizmoRoot=this.targetSphere;var c=new THREE.LineDashedMaterial({color:i,dashSize:4,gapSize:4,opacity:.75,transparent:!0,fog:!1}),h=new THREE.Geometry;h.vertices.push(this.position.clone()),h.vertices.push(this.targetSphere
  .position.clone()),h.computeLineDistances(),this.targetLine=new THREE.Line(h,c),this.targetLine.properties.isGizmo=!0}this.properties.isGizmo=!0},THREE.DirectionalLightHelper.prototype=Object.create(THREE.Object3D.prototype),THREE.DirectionalLightHelper.prototype.update=function(){this.direction.sub(this.light.target.position,this.light.position),this.lightArrow.setDirection(this.direction),this.color.copy(this.light.color);var e=THREE.Math.clamp(this.light.intensity,0,1);this.color.r*=e,this.color.g*=e,this.color.b*=e,this.lightArrow.setColor(this.color.getHex()),this.lightSphere.material.color.copy(this.color),this.lightRays.material.color.copy(this.color),this.targetSphere.material.color.copy(this.color),this.targetLine.material.color.copy(this.color),this.targetLine.geometry.vertices[0].copy(this.light.position),this.targetLine.geometry.vertices[1].copy(this.light.target.position),this.targetLine.geometry.computeLineDistances(),this.targetLine.geometry.verticesNeedUpdate=!0},THREE.HemisphereLightHelper=function(
  e,t,n,r){THREE.Object3D.call(this),this.light=e,this.position=e.position;var i=THREE.Math.clamp(e.intensity,0,1);this.color=e.color.clone(),this.color.r*=i,this.color.g*=i,this.color.b*=i;var s=this.color.getHex();this.groundColor=e.groundColor.clone(),this.groundColor.r*=i,this.groundColor.g*=i,this.groundColor.b*=i;var o=this.groundColor.getHex(),u=new THREE.SphereGeometry(t,16,8,0,Math.PI*2,0,Math.PI*.5),a=new THREE.SphereGeometry(t,16,8,0,Math.PI*2,Math.PI*.5,Math.PI),f=new THREE.MeshBasicMaterial({color:s,fog:!1}),l=new THREE.MeshBasicMaterial({color:o,fog:!1});for(var c=0,h=u.faces.length;c<h;c++)u.faces[c].materialIndex=0;for(var c=0,h=a.faces.length;c<h;c++)a.faces[c].materialIndex=1;THREE.GeometryUtils.merge(u,a),this.lightSphere=new THREE.Mesh(u,new THREE.MeshFaceMaterial([f,l])),this.lightArrow=new THREE.ArrowHelper(new THREE.Vector3(0,1,0),new THREE.Vector3(0,(t+n)*1.1,0),n,s),this.lightArrow.rotation.x=Math.PI,this.lightArrowGround=new THREE.ArrowHelper(new THREE.Vector3(0,1,0),new THREE.Vector3(0
  ,(t+n)*-1.1,0),n,o);var p=new THREE.Object3D;p.rotation.x=-Math.PI*.5,p.add(this.lightSphere),p.add(this.lightArrow),p.add(this.lightArrowGround),this.add(p),this.lightSphere.properties.isGizmo=!0,this.lightSphere.properties.gizmoSubject=e,this.lightSphere.properties.gizmoRoot=this,this.properties.isGizmo=!0,this.target=new THREE.Vector3,this.lookAt(this.target)},THREE.HemisphereLightHelper.prototype=Object.create(THREE.Object3D.prototype),THREE.HemisphereLightHelper.prototype.update=function(){var e=THREE.Math.clamp(this.light.intensity,0,1);this.color.copy(this.light.color),this.groundColor.copy(this.light.groundColor),this.color.r*=e,this.color.g*=e,this.color.b*=e,this.groundColor.r*=e,this.groundColor.g*=e,this.groundColor.b*=e,this.lightSphere.material.materials[0].color.copy(this.color),this.lightSphere.material.materials[1].color.copy(this.groundColor),this.lightArrow.setColor(this.color.getHex()),this.lightArrowGround.setColor(this.groundColor.getHex()),this.lookAt(this.target)},THREE.PointLightHelper=
  function(e,t){THREE.Object3D.call(this),this.light=e,this.position=e.position,this.color=e.color.clone();var n=THREE.Math.clamp(e.intensity,0,1);this.color.r*=n,this.color.g*=n,this.color.b*=n;var r=this.color.getHex(),i=new THREE.SphereGeometry(t,16,8),s=new THREE.AsteriskGeometry(t*1.25,t*2.25),o=new THREE.IcosahedronGeometry(1,2),u=new THREE.MeshBasicMaterial({color:r,fog:!1}),a=new THREE.LineBasicMaterial({color:r,fog:!1}),f=new THREE.MeshBasicMaterial({color:r,fog:!1,wireframe:!0,opacity:.1,transparent:!0});this.lightSphere=new THREE.Mesh(i,u),this.lightRays=new THREE.Line(s,a,THREE.LinePieces),this.lightDistance=new THREE.Mesh(o,f);var l=e.distance;l===0?this.lightDistance.visible=!1:this.lightDistance.scale.set(l,l,l),this.add(this.lightSphere),this.add(this.lightRays),this.add(this.lightDistance),this.lightSphere.properties.isGizmo=!0,this.lightSphere.properties.gizmoSubject=e,this.lightSphere.properties.gizmoRoot=this,this.properties.isGizmo=!0},THREE.PointLightHelper.prototype=Object.create(THREE.Object3D
  .prototype),THREE.PointLightHelper.prototype.update=function(){this.color.copy(this.light.color);var e=THREE.Math.clamp(this.light.intensity,0,1);this.color.r*=e,this.color.g*=e,this.color.b*=e,this.lightSphere.material.color.copy(this.color),this.lightRays.material.color.copy(this.color),this.lightDistance.material.color.copy(this.color);var t=this.light.distance;t===0?this.lightDistance.visible=!1:(this.lightDistance.visible=!0,this.lightDistance.scale.set(t,t,t))},THREE.SpotLightHelper=function(e,t,n){THREE.Object3D.call(this),this.light=e,this.position=e.position,this.direction=new THREE.Vector3,this.direction.sub(e.target.position,e.position),this.color=e.color.clone();var r=THREE.Math.clamp(e.intensity,0,1);this.color.r*=r,this.color.g*=r,this.color.b*=r;var i=this.color.getHex(),s=new THREE.SphereGeometry(t,16,8),o=new THREE.AsteriskGeometry(t*1.25,t*2.25),u=new THREE.CylinderGeometry(1e-4,1,1,8,1,!0),a=new THREE.Matrix4;a.rotateX(-Math.PI/2),a.translate(new THREE.Vector3(0,-0.5,0)),u.applyMatrix(a);var f=new 
  THREE.MeshBasicMaterial({color:i,fog:!1}),l=new THREE.LineBasicMaterial({color:i,fog:!1}),c=new THREE.MeshBasicMaterial({color:i,fog:!1,wireframe:!0,opacity:.3,transparent:!0});this.lightArrow=new THREE.ArrowHelper(this.direction,null,n,i),this.lightSphere=new THREE.Mesh(s,f),this.lightCone=new THREE.Mesh(u,c);var h=e.distance?e.distance:1e4,p=h*Math.tan(e.angle*.5)*2;this.lightCone.scale.set(p,p,h),this.lightArrow.cone.material.fog=!1,this.lightArrow.line.material.fog=!1,this.lightRays=new THREE.Line(o,l,THREE.LinePieces),this.gyroscope=new THREE.Gyroscope,this.gyroscope.add(this.lightArrow),this.gyroscope.add(this.lightSphere),this.gyroscope.add(this.lightRays),this.add(this.gyroscope),this.add(this.lightCone),this.lookAt(e.target.position),this.lightSphere.properties.isGizmo=!0,this.lightSphere.properties.gizmoSubject=e,this.lightSphere.properties.gizmoRoot=this,this.targetSphere=null;if(e.target.properties.targetInverse){var d=new THREE.SphereGeometry(t,8,4),v=new THREE.MeshBasicMaterial({color:i,wireframe
  :!0,fog:!1});this.targetSphere=new THREE.Mesh(d,v),this.targetSphere.position=e.target.position,this.targetSphere.properties.isGizmo=!0,this.targetSphere.properties.gizmoSubject=e.target,this.targetSphere.properties.gizmoRoot=this.targetSphere;var m=new THREE.LineDashedMaterial({color:i,dashSize:4,gapSize:4,opacity:.75,transparent:!0,fog:!1}),g=new THREE.Geometry;g.vertices.push(this.position.clone()),g.vertices.push(this.targetSphere.position.clone()),g.computeLineDistances(),this.targetLine=new THREE.Line(g,m),this.targetLine.properties.isGizmo=!0}this.properties.isGizmo=!0},THREE.SpotLightHelper.prototype=Object.create(THREE.Object3D.prototype),THREE.SpotLightHelper.prototype.update=function(){this.direction.sub(this.light.target.position,this.light.position),this.lightArrow.setDirection(this.direction),this.lookAt(this.light.target.position);var e=this.light.distance?this.light.distance:1e4,t=e*Math.tan(this.light.angle*.5)*2;this.lightCone.scale.set(t,t,e),this.color.copy(this.light.color);var n=THREE.Math
  .clamp(this.light.intensity,0,1);this.color.r*=n,this.color.g*=n,this.color.b*=n,this.lightArrow.setColor(this.color.getHex()),this.lightSphere.material.color.copy(this.color),this.lightRays.material.color.copy(this.color),this.lightCone.material.color.copy(this.color),this.targetSphere.material.color.copy(this.color),this.targetLine.material.color.copy(this.color),this.targetLine.geometry.vertices[0].copy(this.light.position),this.targetLine.geometry.vertices[1].copy(this.light.target.position),this.targetLine.geometry.computeLineDistances(),this.targetLine.geometry.verticesNeedUpdate=!0},THREE.SubdivisionModifier=function(e){this.subdivisions=e===undefined?1:e,this.useOldVertexColors=!1,this.supportUVs=!0,this.debug=!1},THREE.SubdivisionModifier.prototype.modify=function(e){var t=this.subdivisions;while(t-->0)this.smooth(e)},THREE.GeometryUtils.orderedKey=function(e,t){return Math.min(e,t)+"_"+Math.max(e,t)},THREE.GeometryUtils.computeEdgeFaces=function(e){function d(e,t){h[e]===undefined&&(h[e]=[]),h[e].push
  (t)}var t,n,r,i,s,o,u,a,f,l,c,h={},p=THREE.GeometryUtils.orderedKey;for(t=0,n=e.faces.length;t<n;t++)u=e.faces[t],u instanceof THREE.Face3?(c=p(u.a,u.b),d(c,t),c=p(u.b,u.c),d(c,t),c=p(u.c,u.a),d(c,t)):u instanceof THREE.Face4&&(c=p(u.a,u.b),d(c,t),c=p(u.b,u.c),d(c,t),c=p(u.c,u.d),d(c,t),c=p(u.d,u.a),d(c,t));return h},THREE.SubdivisionModifier.prototype.smooth=function(e){function i(e,n,r){t.push(new THREE.Vector3(e,n,r))}function a(){s.debug&&console&&console.assert&&console.assert.apply(console,arguments)}function f(){s.debug&&console.log.apply(console,arguments)}function l(){console&&console.log.apply(console,arguments)}function c(e,t,i,o,u,a,l){var c=new THREE.Face4(e,t,i,o,null,u.color,u.materialIndex);if(s.useOldVertexColors){c.vertexColors=[];var h,p,d;for(var v=0;v<4;v++){d=a[v],h=new THREE.Color,h.setRGB(0,0,0);for(var m=0,g=0;m<d.length;m++)p=u.vertexColors[d[m]-1],h.r+=p.r,h.g+=p.g,h.b+=p.b;h.r/=d.length,h.g/=d.length,h.b/=d.length,c.vertexColors[v]=h}}n.push(c);if(s.supportUVs){var y=[S(e,""),S(t,l)
  ,S(i,l),S(o,l)];y[0]?y[1]?y[2]?y[3]?r.push(y):f("d :( ",o+":"+l):f("c :( ",i+":"+l):f("b :( ",t+":"+l):f("a :( ",e+":"+l)}}function E(){console.log("facePoints",m,"edgePoints",g),console.log("edgeFaceMap",H,"vertexEdgeMap",W)}function S(e,t){var n,r,i=e+":"+t,s=w[i];return s?s:(e>=d&&e<d+p.length?f("face pt"):f("edge pt"),l("warning, UV not found for",i),null)}function x(e,t,n){var r=e+":"+t;r in w?l("dup vertexNo",e,"oldFaceNo",t,"value",n,"key",r,w[r]):w[r]=n}function V(e,t){W[e]===undefined&&(W[e]=[]),W[e].push(t)}function $(e,t,n){X[e]===undefined&&(X[e]={}),X[e][t]=n}var t=[],n=[],r=[],s=this,o=THREE.GeometryUtils.orderedKey,u=THREE.GeometryUtils.computeEdgeFaces,h=e.vertices,p=e.faces,d=h.length,v=h.concat(),m=[],g={},y={},b=[],w={},T,N,C,k,L,A=e.faceVertexUvs[0],O="abcd",M;f("originalFaces, uvs, originalVerticesLength",p.length,A.length,d);if(s.supportUVs)for(T=0,N=A.length;T<N;T++)for(C=0,k=A[T].length;C<k;C++)M=p[T][O.charAt(C)],x(M,T,A[T][C]);A.length==0&&(s.supportUVs=!1);var _=0;for(var D in w)_++;
  _||(s.supportUVs=!1,f("no uvs"));var P;for(T=0,N=p.length;T<N;T++){L=p[T],m.push(L.centroid),v.push(L.centroid);if(!s.supportUVs)continue;P=new THREE.UV,L instanceof THREE.Face3?(P.u=S(L.a,T).u+S(L.b,T).u+S(L.c,T).u,P.v=S(L.a,T).v+S(L.b,T).v+S(L.c,T).v,P.u/=3,P.v/=3):L instanceof THREE.Face4&&(P.u=S(L.a,T).u+S(L.b,T).u+S(L.c,T).u+S(L.d,T).u,P.v=S(L.a,T).v+S(L.b,T).v+S(L.c,T).v+S(L.d,T).v,P.u/=4,P.v/=4),x(d+T,"",P)}var H=u(e),B,j,F,I,q=0,R,U,z,W={},X={};for(T in H){B=H[T],R=T.split("_"),U=R[0],z=R[1],V(U,[U,z]),V(z,[U,z]);for(C=0,k=B.length;C<k;C++)L=B[C],$(U,L,T),$(z,L,T);B.length<2&&(y[T]=!0,b[U]=!0,b[z]=!0)}for(T in H){B=H[T],j=B[0],F=B[1],R=T.split("_"),U=R[0],z=R[1],I=new THREE.Vector3,a(B.length>0,"an edge without faces?!"),B.length==1?(I.addSelf(h[U]),I.addSelf(h[z]),I.multiplyScalar(.5),b[v.length]=!0):(I.addSelf(m[j]),I.addSelf(m[F]),I.addSelf(h[U]),I.addSelf(h[z]),I.multiplyScalar(.25)),g[T]=d+p.length+q,v.push(I),q++;if(!s.supportUVs)continue;P=new THREE.UV,P.u=S(U,j).u+S(z,j).u,P.v=S(U,j).v+S(z,j).v
  ,P.u/=2,P.v/=2,x(g[T],j,P),B.length>=2&&(a(B.length==2,"did we plan for more than 2 edges?"),P=new THREE.UV,P.u=S(U,F).u+S(z,F).u,P.v=S(U,F).v+S(z,F).v,P.u/=2,P.v/=2,x(g[T],F,P))}f("-- Step 2 done");var J,K,Q,G,Y,Z,et,tt=["123","12","2","23"],nt=["123","23","3","31"],rt=["123","31","1","12"],it=["1234","12","2","23"],st=["1234","23","3","34"],ot=["1234","34","4","41"],ut=["1234","41","1","12"];for(T=0,N=m.length;T<N;T++)J=m[T],L=p[T],K=d+T,L instanceof THREE.Face3?(Q=o(L.a,L.b),G=o(L.b,L.c),et=o(L.c,L.a),c(K,g[Q],L.b,g[G],L,tt,T),c(K,g[G],L.c,g[et],L,nt,T),c(K,g[et],L.a,g[Q],L,rt,T)):L instanceof THREE.Face4?(Q=o(L.a,L.b),G=o(L.b,L.c),Y=o(L.c,L.d),Z=o(L.d,L.a),c(K,g[Q],L.b,g[G],L,it,T),c(K,g[G],L.c,g[Y],L,st,T),c(K,g[Y],L.d,g[Z],L,ot,T),c(K,g[Z],L.a,g[Q],L,ut,T)):f("face should be a face!",L);t=v;var at=new THREE.Vector3,ft=new THREE.Vector3,lt;for(T=0,N=h.length;T<N;T++){if(W[T]===undefined)continue;at.set(0,0,0),ft.set(0,0,0);var ct=new THREE.Vector3(0,0,0),ht=0;for(C in X[T])at.addSelf(m[C]),ht++;var pt=0;lt=
  W[T].length;var dt=ht!=lt;for(C=0;C<lt;C++)y[o(W[T][C][0],W[T][C][1])]&&pt++;at.divideScalar(ht);var vt=0;if(dt){var mt;for(C=0;C<lt;C++){B=W[T][C],mt=H[o(B[0],B[1])].length==1;if(mt){var gt=h[B[0]].clone().addSelf(h[B[1]]).divideScalar(2);ft.addSelf(gt),vt++}}ft.divideScalar(4),a(vt==2,"should have only 2 boundary edges")}else{for(C=0;C<lt;C++){B=W[T][C];var gt=h[B[0]].clone().addSelf(h[B[1]]).divideScalar(2);ft.addSelf(gt)}ft.divideScalar(lt)}ct.addSelf(h[T]),dt?(ct.divideScalar(2),ct.addSelf(ft)):(ct.multiplyScalar(lt-3),ct.addSelf(at),ct.addSelf(ft.multiplyScalar(2)),ct.divideScalar(lt)),t[T]=ct}var yt=e;yt.vertices=t,yt.faces=n,yt.faceVertexUvs[0]=r,delete yt.__tmpVertices,yt.computeCentroids(),yt.computeFaceNormals(),yt.computeVertexNormals()},THREE.ImmediateRenderObject=function(){THREE.Object3D.call(this),this.render=function(e){}},THREE.ImmediateRenderObject.prototype=Object.create(THREE.Object3D.prototype),THREE.LensFlare=function(e,t,n,r,i){THREE.Object3D.call(this),this.lensFlares=[],this.positionScreen=new 
  THREE.Vector3,this.customUpdateCallback=undefined,e!==undefined&&this.add(e,t,n,r,i)},THREE.LensFlare.prototype=Object.create(THREE.Object3D.prototype),THREE.LensFlare.prototype.add=function(e,t,n,r,i,s){t===undefined&&(t=-1),n===undefined&&(n=0),s===undefined&&(s=1),i===undefined&&(i=new THREE.Color(16777215)),r===undefined&&(r=THREE.NormalBlending),n=Math.min(n,Math.max(0,n)),this.lensFlares.push({texture:e,size:t,distance:n,x:0,y:0,z:0,scale:1,rotation:1,opacity:s,color:i,blending:r})},THREE.LensFlare.prototype.updateLensFlares=function(){var e,t=this.lensFlares.length,n,r=-this.positionScreen.x*2,i=-this.positionScreen.y*2;for(e=0;e<t;e++)n=this.lensFlares[e],n.x=this.positionScreen.x+r*n.distance,n.y=this.positionScreen.y+i*n.distance,n.wantedRotation=n.x*Math.PI*.25,n.rotation+=(n.wantedRotation-n.rotation)*.25},THREE.MorphBlendMesh=function(e,t){THREE.Mesh.call(this,e,t),this.animationsMap={},this.animationsList=[];var n=this.geometry.morphTargets.length,r="__default",i=0,s=n-1,o=n/1;this.createAnimation
  (r,i,s,o),this.setAnimationWeight(r,1)},THREE.MorphBlendMesh.prototype=Object.create(THREE.Mesh.prototype),THREE.MorphBlendMesh.prototype.createAnimation=function(e,t,n,r){var i={startFrame:t,endFrame:n,length:n-t+1,fps:r,duration:(n-t)/r,lastFrame:0,currentFrame:0,active:!1,time:0,direction:1,weight:1,directionBackwards:!1,mirroredLoop:!1};this.animationsMap[e]=i,this.animationsList.push(i)},THREE.MorphBlendMesh.prototype.autoCreateAnimations=function(e){var t=/([a-z]+)(\d+)/,n,r={},i=this.geometry;for(var s=0,o=i.morphTargets.length;s<o;s++){var u=i.morphTargets[s],a=u.name.match(t);if(a&&a.length>1){var f=a[1],l=a[2];r[f]||(r[f]={start:Infinity,end:-Infinity});var c=r[f];s<c.start&&(c.start=s),s>c.end&&(c.end=s),n||(n=f)}}for(var f in r){var c=r[f];this.createAnimation(f,c.start,c.end,e)}this.firstAnimation=n},THREE.MorphBlendMesh.prototype.setAnimationDirectionForward=function(e){var t=this.animationsMap[e];t&&(t.direction=1,t.directionBackwards=!1)},THREE.MorphBlendMesh.prototype.setAnimationDirectionBackward=
  function(e){var t=this.animationsMap[e];t&&(t.direction=-1,t.directionBackwards=!0)},THREE.MorphBlendMesh.prototype.setAnimationFPS=function(e,t){var n=this.animationsMap[e];n&&(n.fps=t,n.duration=(n.end-n.start)/n.fps)},THREE.MorphBlendMesh.prototype.setAnimationDuration=function(e,t){var n=this.animationsMap[e];n&&(n.duration=t,n.fps=(n.end-n.start)/n.duration)},THREE.MorphBlendMesh.prototype.setAnimationWeight=function(e,t){var n=this.animationsMap[e];n&&(n.weight=t)},THREE.MorphBlendMesh.prototype.setAnimationTime=function(e,t){var n=this.animationsMap[e];n&&(n.time=t)},THREE.MorphBlendMesh.prototype.getAnimationTime=function(e){var t=0,n=this.animationsMap[e];return n&&(t=n.time),t},THREE.MorphBlendMesh.prototype.getAnimationDuration=function(e){var t=-1,n=this.animationsMap[e];return n&&(t=n.duration),t},THREE.MorphBlendMesh.prototype.playAnimation=function(e){var t=this.animationsMap[e];t?(t.time=0,t.active=!0):console.warn("animation["+e+"] undefined")},THREE.MorphBlendMesh.prototype.stopAnimation=function(
  e){var t=this.animationsMap[e];t&&(t.active=!1)},THREE.MorphBlendMesh.prototype.update=function(e){for(var t=0,n=this.animationsList.length;t<n;t++){var r=this.animationsList[t];if(!r.active)continue;var i=r.duration/r.length;r.time+=r.direction*e;if(r.mirroredLoop){if(r.time>r.duration||r.time<0)r.direction*=-1,r.time>r.duration&&(r.time=r.duration,r.directionBackwards=!0),r.time<0&&(r.time=0,r.directionBackwards=!1)}else r.time=r.time%r.duration,r.time<0&&(r.time+=r.duration);var s=r.startFrame+THREE.Math.clamp(Math.floor(r.time/i),0,r.length-1),o=r.weight;s!==r.currentFrame&&(this.morphTargetInfluences[r.lastFrame]=0,this.morphTargetInfluences[r.currentFrame]=1*o,this.morphTargetInfluences[s]=0,r.lastFrame=r.currentFrame,r.currentFrame=s);var u=r.time%i/i;r.directionBackwards&&(u=1-u),this.morphTargetInfluences[r.currentFrame]=u*o,this.morphTargetInfluences[r.lastFrame]=(1-u)*o}},THREE.LensFlarePlugin=function(){function r(t){var n=e.createProgram(),r=e.createShader(e.FRAGMENT_SHADER),i=e.createShader(e.VERTEX_SHADER
  );return e.shaderSource(r,t.fragmentShader),e.shaderSource(i,t.vertexShader),e.compileShader(r),e.compileShader(i),e.attachShader(n,r),e.attachShader(n,i),e.linkProgram(n),n}var e,t,n={};this.init=function(i){e=i.context,t=i,n.vertices=new Float32Array(16),n.faces=new Uint16Array(6);var s=0;n.vertices[s++]=-1,n.vertices[s++]=-1,n.vertices[s++]=0,n.vertices[s++]=0,n.vertices[s++]=1,n.vertices[s++]=-1,n.vertices[s++]=1,n.vertices[s++]=0,n.vertices[s++]=1,n.vertices[s++]=1,n.vertices[s++]=1,n.vertices[s++]=1,n.vertices[s++]=-1,n.vertices[s++]=1,n.vertices[s++]=0,n.vertices[s++]=1,s=0,n.faces[s++]=0,n.faces[s++]=1,n.faces[s++]=2,n.faces[s++]=0,n.faces[s++]=2,n.faces[s++]=3,n.vertexBuffer=e.createBuffer(),n.elementBuffer=e.createBuffer(),e.bindBuffer(e.ARRAY_BUFFER,n.vertexBuffer),e.bufferData(e.ARRAY_BUFFER,n.vertices,e.STATIC_DRAW),e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,n.elementBuffer),e.bufferData(e.ELEMENT_ARRAY_BUFFER,n.faces,e.STATIC_DRAW),n.tempTexture=e.createTexture(),n.occlusionTexture=e.createTexture(),e.bindTexture
  (e.TEXTURE_2D,n.tempTexture),e.texImage2D(e.TEXTURE_2D,0,e.RGB,16,16,0,e.RGB,e.UNSIGNED_BYTE,null),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.NEAREST),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.NEAREST),e.bindTexture(e.TEXTURE_2D,n.occlusionTexture),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,16,16,0,e.RGBA,e.UNSIGNED_BYTE,null),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.NEAREST),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.NEAREST),e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS)<=0?(n.hasVertexTexture=!1,n.program=r(THREE.ShaderFlares.lensFlare)):(n.hasVertexTexture=!0,n.program=r(THREE.ShaderFlares.lensFlareVertexTexture)),n.attributes={},n.uniforms={},n.attributes.vertex=e.getAttribLocation(n.program,"position"),n.attributes.uv=e.getAttribLocation
  (n.program,"uv"),n.uniforms.renderType=e.getUniformLocation(n.program,"renderType"),n.uniforms.map=e.getUniformLocation(n.program,"map"),n.uniforms.occlusionMap=e.getUniformLocation(n.program,"occlusionMap"),n.uniforms.opacity=e.getUniformLocation(n.program,"opacity"),n.uniforms.color=e.getUniformLocation(n.program,"color"),n.uniforms.scale=e.getUniformLocation(n.program,"scale"),n.uniforms.rotation=e.getUniformLocation(n.program,"rotation"),n.uniforms.screenPosition=e.getUniformLocation(n.program,"screenPosition")},this.render=function(r,i,s,o){var u=r.__webglFlares,a=u.length;if(!a)return;var f=new THREE.Vector3,l=o/s,c=s*.5,h=o*.5,p=16/o,d=new THREE.Vector2(p*l,p),v=new THREE.Vector3(1,1,0),m=new THREE.Vector2(1,1),g=n.uniforms,y=n.attributes;e.useProgram(n.program),e.enableVertexAttribArray(n.attributes.vertex),e.enableVertexAttribArray(n.attributes.uv),e.uniform1i(g.occlusionMap,0),e.uniform1i(g.map,1),e.bindBuffer(e.ARRAY_BUFFER,n.vertexBuffer),e.vertexAttribPointer(y.vertex,2,e.FLOAT,!1,16,0),e.vertexAttribPointer
  (y.uv,2,e.FLOAT,!1,16,8),e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,n.elementBuffer),e.disable(e.CULL_FACE),e.depthMask(!1);var b,w,E,S,x;for(b=0;b<a;b++){p=16/o,d.set(p*l,p),S=u[b],f.set(S.matrixWorld.elements[12],S.matrixWorld.elements[13],S.matrixWorld.elements[14]),i.matrixWorldInverse.multiplyVector3(f),i.projectionMatrix.multiplyVector3(f),v.copy(f),m.x=v.x*c+c,m.y=v.y*h+h;if(n.hasVertexTexture||m.x>0&&m.x<s&&m.y>0&&m.y<o){e.activeTexture(e.TEXTURE1),e.bindTexture(e.TEXTURE_2D,n.tempTexture),e.copyTexImage2D(e.TEXTURE_2D,0,e.RGB,m.x-8,m.y-8,16,16,0),e.uniform1i(g.renderType,0),e.uniform2f(g.scale,d.x,d.y),e.uniform3f(g.screenPosition,v.x,v.y,v.z),e.disable(e.BLEND),e.enable(e.DEPTH_TEST),e.drawElements(e.TRIANGLES,6,e.UNSIGNED_SHORT,0),e.activeTexture(e.TEXTURE0),e.bindTexture(e.TEXTURE_2D,n.occlusionTexture),e.copyTexImage2D(e.TEXTURE_2D,0,e.RGBA,m.x-8,m.y-8,16,16,0),e.uniform1i(g.renderType,1),e.disable(e.DEPTH_TEST),e.activeTexture(e.TEXTURE1),e.bindTexture(e.TEXTURE_2D,n.tempTexture),e.drawElements(e.TRIANGLES
  ,6,e.UNSIGNED_SHORT,0),S.positionScreen.copy(v),S.customUpdateCallback?S.customUpdateCallback(S):S.updateLensFlares(),e.uniform1i(g.renderType,2),e.enable(e.BLEND);for(w=0,E=S.lensFlares.length;w<E;w++)x=S.lensFlares[w],x.opacity>.001&&x.scale>.001&&(v.x=x.x,v.y=x.y,v.z=x.z,p=x.size*x.scale/o,d.x=p*l,d.y=p,e.uniform3f(g.screenPosition,v.x,v.y,v.z),e.uniform2f(g.scale,d.x,d.y),e.uniform1f(g.rotation,x.rotation),e.uniform1f(g.opacity,x.opacity),e.uniform3f(g.color,x.color.r,x.color.g,x.color.b),t.setBlending(x.blending,x.blendEquation,x.blendSrc,x.blendDst),t.setTexture(x.texture,1),e.drawElements(e.TRIANGLES,6,e.UNSIGNED_SHORT,0))}}e.enable(e.CULL_FACE),e.enable(e.DEPTH_TEST),e.depthMask(!0)}},THREE.ShadowMapPlugin=function(){function l(e,t){var n=new THREE.DirectionalLight;n.isVirtual=!0,n.onlyShadow=!0,n.castShadow=!0,n.shadowCameraNear=e.shadowCameraNear,n.shadowCameraFar=e.shadowCameraFar,n.shadowCameraLeft=e.shadowCameraLeft,n.shadowCameraRight=e.shadowCameraRight,n.shadowCameraBottom=e.shadowCameraBottom,
  n.shadowCameraTop=e.shadowCameraTop,n.shadowCameraVisible=e.shadowCameraVisible,n.shadowDarkness=e.shadowDarkness,n.shadowBias=e.shadowCascadeBias[t],n.shadowMapWidth=e.shadowCascadeWidth[t],n.shadowMapHeight=e.shadowCascadeHeight[t],n.pointsWorld=[],n.pointsFrustum=[];var r=n.pointsWorld,i=n.pointsFrustum;for(var s=0;s<8;s++)r[s]=new THREE.Vector3,i[s]=new THREE.Vector3;var o=e.shadowCascadeNearZ[t],u=e.shadowCascadeFarZ[t];return i[0].set(-1,-1,o),i[1].set(1,-1,o),i[2].set(-1,1,o),i[3].set(1,1,o),i[4].set(-1,-1,u),i[5].set(1,-1,u),i[6].set(-1,1,u),i[7].set(1,1,u),n}function c(e,t){var n=e.shadowCascadeArray[t];n.position.copy(e.position),n.target.position.copy(e.target.position),n.lookAt(n.target),n.shadowCameraVisible=e.shadowCameraVisible,n.shadowDarkness=e.shadowDarkness,n.shadowBias=e.shadowCascadeBias[t];var r=e.shadowCascadeNearZ[t],i=e.shadowCascadeFarZ[t],s=n.pointsFrustum;s[0].z=r,s[1].z=r,s[2].z=r,s[3].z=r,s[4].z=i,s[5].z=i,s[6].z=i,s[7].z=i}function h(e,t){var n=t.shadowCamera,r=t.pointsFrustum,i=
  t.pointsWorld;a.set(Infinity,Infinity,Infinity),f.set(-Infinity,-Infinity,-Infinity);for(var s=0;s<8;s++){var o=i[s];o.copy(r[s]),THREE.ShadowMapPlugin.__projector.unprojectVector(o,e),n.matrixWorldInverse.multiplyVector3(o),o.x<a.x&&(a.x=o.x),o.x>f.x&&(f.x=o.x),o.y<a.y&&(a.y=o.y),o.y>f.y&&(f.y=o.y),o.z<a.z&&(a.z=o.z),o.z>f.z&&(f.z=o.z)}n.left=a.x,n.right=f.x,n.top=f.y,n.bottom=a.y,n.updateProjectionMatrix()}function p(e){return e.material instanceof THREE.MeshFaceMaterial?e.material.materials[0]:e.material}var e,t,n,r,i,s,o=new THREE.Frustum,u=new THREE.Matrix4,a=new THREE.Vector3,f=new THREE.Vector3;this.init=function(o){e=o.context,t=o;var u=THREE.ShaderLib.depthRGBA,a=THREE.UniformsUtils.clone(u.uniforms);n=new THREE.ShaderMaterial({fragmentShader:u.fragmentShader,vertexShader:u.vertexShader,uniforms:a}),r=new THREE.ShaderMaterial({fragmentShader:u.fragmentShader,vertexShader:u.vertexShader,uniforms:a,morphTargets:!0}),i=new THREE.ShaderMaterial({fragmentShader:u.fragmentShader,vertexShader:u.vertexShader,
  uniforms:a,skinning:!0}),s=new THREE.ShaderMaterial({fragmentShader:u.fragmentShader,vertexShader:u.vertexShader,uniforms:a,morphTargets:!0,skinning:!0}),n._shadowPass=!0,r._shadowPass=!0,i._shadowPass=!0,s._shadowPass=!0},this.render=function(e,n){if(!t.shadowMapEnabled||!t.shadowMapAutoUpdate)return;this.update(e,n)},this.update=function(a,f){var d,v,m,g,y,b,w,E,S,x,T,N,C,k,L,A=[],O=0,M=null;e.clearColor(1,1,1,1),e.disable(e.BLEND),e.enable(e.CULL_FACE),e.frontFace(e.CCW),t.shadowMapCullFace===THREE.CullFaceFront?e.cullFace(e.FRONT):e.cullFace(e.BACK),t.setDepthTest(!0);for(d=0,v=a.__lights.length;d<v;d++){k=a.__lights[d];if(!k.castShadow)continue;if(k instanceof THREE.DirectionalLight&&k.shadowCascade)for(y=0;y<k.shadowCascadeCount;y++){var _;if(!k.shadowCascadeArray[y]){_=l(k,y),_.originalCamera=f;var D=new THREE.Gyroscope;D.position=k.shadowCascadeOffset,D.add(_),D.add(_.target),f.add(D),k.shadowCascadeArray[y]=_,console.log("Created virtualLight",_)}else _=k.shadowCascadeArray[y];c(k,y),A[O]=_,O++}else A
  [O]=k,O++}for(d=0,v=A.length;d<v;d++){k=A[d];if(!k.shadowMap){var P={minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,format:THREE.RGBAFormat};k.shadowMap=new THREE.WebGLRenderTarget(k.shadowMapWidth,k.shadowMapHeight,P),k.shadowMapSize=new THREE.Vector2(k.shadowMapWidth,k.shadowMapHeight),k.shadowMatrix=new THREE.Matrix4}if(!k.shadowCamera){if(k instanceof THREE.SpotLight)k.shadowCamera=new THREE.PerspectiveCamera(k.shadowCameraFov,k.shadowMapWidth/k.shadowMapHeight,k.shadowCameraNear,k.shadowCameraFar);else{if(!(k instanceof THREE.DirectionalLight)){console.error("Unsupported light type for shadow");continue}k.shadowCamera=new THREE.OrthographicCamera(k.shadowCameraLeft,k.shadowCameraRight,k.shadowCameraTop,k.shadowCameraBottom,k.shadowCameraNear,k.shadowCameraFar)}a.add(k.shadowCamera),t.autoUpdateScene&&a.updateMatrixWorld()}k.shadowCameraVisible&&!k.cameraHelper&&(k.cameraHelper=new THREE.CameraHelper(k.shadowCamera),k.shadowCamera.add(k.cameraHelper)),k.isVirtual&&_.originalCamera==f&&h(f,k),b=k
  .shadowMap,w=k.shadowMatrix,E=k.shadowCamera,E.position.copy(k.matrixWorld.getPosition()),E.lookAt(k.target.matrixWorld.getPosition()),E.updateMatrixWorld(),E.matrixWorldInverse.getInverse(E.matrixWorld),k.cameraHelper&&(k.cameraHelper.visible=k.shadowCameraVisible),k.shadowCameraVisible&&k.cameraHelper.update(),w.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),w.multiplySelf(E.projectionMatrix),w.multiplySelf(E.matrixWorldInverse),u.multiply(E.projectionMatrix,E.matrixWorldInverse),o.setFromMatrix(u),t.setRenderTarget(b),t.clear(),L=a.__webglObjects;for(m=0,g=L.length;m<g;m++)N=L[m],C=N.object,N.render=!1,C.visible&&C.castShadow&&(!(C instanceof THREE.Mesh||C instanceof THREE.ParticleSystem)||!C.frustumCulled||o.contains(C))&&(C._modelViewMatrix.multiply(E.matrixWorldInverse,C.matrixWorld),N.render=!0);var H,B,j;for(m=0,g=L.length;m<g;m++)N=L[m],N.render&&(C=N.object,x=N.buffer,H=p(C),B=C.geometry.morphTargets.length>0&&H.morphTargets,j=C instanceof THREE.SkinnedMesh&&H.skinning,C.customDepthMaterial?T=C.customDepthMaterial
  :j?T=B?s:i:B?T=r:T=n,x instanceof THREE.BufferGeometry?t.renderBufferDirect(E,a.__lights,M,T,x,C):t.renderBuffer(E,a.__lights,M,T,x,C));L=a.__webglObjectsImmediate;for(m=0,g=L.length;m<g;m++)N=L[m],C=N.object,C.visible&&C.castShadow&&(C._modelViewMatrix.multiply(E.matrixWorldInverse,C.matrixWorld),t.renderImmediateObject(E,a.__lights,M,n,C))}var F=t.getClearColor(),I=t.getClearAlpha();e.clearColor(F.r,F.g,F.b,I),e.enable(e.BLEND),t.shadowMapCullFace===THREE.CullFaceFront&&e.cullFace(e.BACK)}},THREE.ShadowMapPlugin.__projector=new THREE.Projector,THREE.SpritePlugin=function(){function r(t){var n=e.createProgram(),r=e.createShader(e.FRAGMENT_SHADER),i=e.createShader(e.VERTEX_SHADER);return e.shaderSource(r,t.fragmentShader),e.shaderSource(i,t.vertexShader),e.compileShader(r),e.compileShader(i),e.attachShader(n,r),e.attachShader(n,i),e.linkProgram(n),n}function i(e,t){return e.z!==t.z?t.z-e.z:t.id-e.id}var e,t,n={};this.init=function(i){e=i.context,t=i,n.vertices=new Float32Array(16),n.faces=new Uint16Array(6);var s=0
  ;n.vertices[s++]=-1,n.vertices[s++]=-1,n.vertices[s++]=0,n.vertices[s++]=0,n.vertices[s++]=1,n.vertices[s++]=-1,n.vertices[s++]=1,n.vertices[s++]=0,n.vertices[s++]=1,n.vertices[s++]=1,n.vertices[s++]=1,n.vertices[s++]=1,n.vertices[s++]=-1,n.vertices[s++]=1,n.vertices[s++]=0,n.vertices[s++]=1,s=0,n.faces[s++]=0,n.faces[s++]=1,n.faces[s++]=2,n.faces[s++]=0,n.faces[s++]=2,n.faces[s++]=3,n.vertexBuffer=e.createBuffer(),n.elementBuffer=e.createBuffer(),e.bindBuffer(e.ARRAY_BUFFER,n.vertexBuffer),e.bufferData(e.ARRAY_BUFFER,n.vertices,e.STATIC_DRAW),e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,n.elementBuffer),e.bufferData(e.ELEMENT_ARRAY_BUFFER,n.faces,e.STATIC_DRAW),n.program=r(THREE.ShaderSprite.sprite),n.attributes={},n.uniforms={},n.attributes.position=e.getAttribLocation(n.program,"position"),n.attributes.uv=e.getAttribLocation(n.program,"uv"),n.uniforms.uvOffset=e.getUniformLocation(n.program,"uvOffset"),n.uniforms.uvScale=e.getUniformLocation(n.program,"uvScale"),n.uniforms.rotation=e.getUniformLocation(n.program,"rotation"
  ),n.uniforms.scale=e.getUniformLocation(n.program,"scale"),n.uniforms.alignment=e.getUniformLocation(n.program,"alignment"),n.uniforms.color=e.getUniformLocation(n.program,"color"),n.uniforms.map=e.getUniformLocation(n.program,"map"),n.uniforms.opacity=e.getUniformLocation(n.program,"opacity"),n.uniforms.useScreenCoordinates=e.getUniformLocation(n.program,"useScreenCoordinates"),n.uniforms.sizeAttenuation=e.getUniformLocation(n.program,"sizeAttenuation"),n.uniforms.screenPosition=e.getUniformLocation(n.program,"screenPosition"),n.uniforms.modelViewMatrix=e.getUniformLocation(n.program,"modelViewMatrix"),n.uniforms.projectionMatrix=e.getUniformLocation(n.program,"projectionMatrix"),n.uniforms.fogType=e.getUniformLocation(n.program,"fogType"),n.uniforms.fogDensity=e.getUniformLocation(n.program,"fogDensity"),n.uniforms.fogNear=e.getUniformLocation(n.program,"fogNear"),n.uniforms.fogFar=e.getUniformLocation(n.program,"fogFar"),n.uniforms.fogColor=e.getUniformLocation(n.program,"fogColor"),n.uniforms.alphaTest=e.getUniformLocation
  (n.program,"alphaTest")},this.render=function(r,s,o,u){var a=r.__webglSprites,f=a.length;if(!f)return;var l=n.attributes,c=n.uniforms,h=u/o,p=o*.5,d=u*.5;e.useProgram(n.program),e.enableVertexAttribArray(l.position),e.enableVertexAttribArray(l.uv),e.disable(e.CULL_FACE),e.enable(e.BLEND),e.bindBuffer(e.ARRAY_BUFFER,n.vertexBuffer),e.vertexAttribPointer(l.position,2,e.FLOAT,!1,16,0),e.vertexAttribPointer(l.uv,2,e.FLOAT,!1,16,8),e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,n.elementBuffer),e.uniformMatrix4fv(c.projectionMatrix,!1,s.projectionMatrix.elements),e.activeTexture(e.TEXTURE0),e.uniform1i(c.map,0);var v=0,m=0,g=r.fog;g?(e.uniform3f(c.fogColor,g.color.r,g.color.g,g.color.b),g instanceof THREE.Fog?(e.uniform1f(c.fogNear,g.near),e.uniform1f(c.fogFar,g.far),e.uniform1i(c.fogType,1),v=1,m=1):g instanceof THREE.FogExp2&&(e.uniform1f(c.fogDensity,g.density),e.uniform1i(c.fogType,2),v=2,m=2)):(e.uniform1i(c.fogType,0),v=0,m=0);var y,b,w,E,S,x,T=[];for(y=0;y<f;y++){b=a[y],w=b.material;if(!b.visible||w.opacity===0)continue;
  w.useScreenCoordinates?b.z=-b.position.z:(b._modelViewMatrix.multiply(s.matrixWorldInverse,b.matrixWorld),b.z=-b._modelViewMatrix.elements[14])}a.sort(i);for(y=0;y<f;y++){b=a[y],w=b.material;if(!b.visible||w.opacity===0)continue;w.map&&w.map.image&&w.map.image.width&&(e.uniform1f(c.alphaTest,w.alphaTest),w.useScreenCoordinates?(e.uniform1i(c.useScreenCoordinates,1),e.uniform3f(c.screenPosition,(b.position.x-p)/p,(d-b.position.y)/d,Math.max(0,Math.min(1,b.position.z)))):(e.uniform1i(c.useScreenCoordinates,0),e.uniform1i(c.sizeAttenuation,w.sizeAttenuation?1:0),e.uniformMatrix4fv(c.modelViewMatrix,!1,b._modelViewMatrix.elements)),r.fog&&w.fog?x=m:x=0,v!==x&&(e.uniform1i(c.fogType,x),v=x),S=1/(w.scaleByViewport?u:1),T[0]=S*h*b.scale.x,T[1]=S*b.scale.y,e.uniform2f(c.uvScale,w.uvScale.x,w.uvScale.y),e.uniform2f(c.uvOffset,w.uvOffset.x,w.uvOffset.y),e.uniform2f(c.alignment,w.alignment.x,w.alignment.y),e.uniform1f(c.opacity,w.opacity),e.uniform3f(c.color,w.color.r,w.color.g,w.color.b),e.uniform1f(c.rotation,b.rotation
  ),e.uniform2fv(c.scale,T),t.setBlending(w.blending,w.blendEquation,w.blendSrc,w.blendDst),t.setDepthTest(w.depthTest),t.setDepthWrite(w.depthWrite),t.setTexture(w.map,0),e.drawElements(e.TRIANGLES,6,e.UNSIGNED_SHORT,0))}e.enable(e.CULL_FACE)}},THREE.DepthPassPlugin=function(){function a(e){return e.material instanceof THREE.MeshFaceMaterial?e.material.materials[0]:e.material}this.enabled=!1,this.renderTarget=null;var e,t,n,r,i,s,o=new THREE.Frustum,u=new THREE.Matrix4;this.init=function(o){e=o.context,t=o;var u=THREE.ShaderLib.depthRGBA,a=THREE.UniformsUtils.clone(u.uniforms);n=new THREE.ShaderMaterial({fragmentShader:u.fragmentShader,vertexShader:u.vertexShader,uniforms:a}),r=new THREE.ShaderMaterial({fragmentShader:u.fragmentShader,vertexShader:u.vertexShader,uniforms:a,morphTargets:!0}),i=new THREE.ShaderMaterial({fragmentShader:u.fragmentShader,vertexShader:u.vertexShader,uniforms:a,skinning:!0}),s=new THREE.ShaderMaterial({fragmentShader:u.fragmentShader,vertexShader:u.vertexShader,uniforms:a,morphTargets
  :!0,skinning:!0}),n._shadowPass=!0,r._shadowPass=!0,i._shadowPass=!0,s._shadowPass=!0},this.render=function(e,t){if(!this.enabled)return;this.update(e,t)},this.update=function(f,l){var c,h,p,d,v,m,g,y,b,w,E,S,x=null;e.clearColor(1,1,1,1),e.disable(e.BLEND),t.setDepthTest(!0),t.autoUpdateScene&&f.updateMatrixWorld(),l.matrixWorldInverse.getInverse(l.matrixWorld),u.multiply(l.projectionMatrix,l.matrixWorldInverse),o.setFromMatrix(u),t.setRenderTarget(this.renderTarget),t.clear(),S=f.__webglObjects;for(p=0,d=S.length;p<d;p++)b=S[p],w=b.object,b.render=!1,w.visible&&(!(w instanceof THREE.Mesh||w instanceof THREE.ParticleSystem)||!w.frustumCulled||o.contains(w))&&(w._modelViewMatrix.multiply(l.matrixWorldInverse,w.matrixWorld),b.render=!0);var T,N,C;for(p=0,d=S.length;p<d;p++){b=S[p];if(b.render){w=b.object,g=b.buffer;if(w instanceof THREE.ParticleSystem&&!w.customDepthMaterial)continue;T=a(w),T&&t.setMaterialFaces(w.material),N=w.geometry.morphTargets.length>0&&T.morphTargets,C=w instanceof THREE.SkinnedMesh&&T.skinning
  ,w.customDepthMaterial?y=w.customDepthMaterial:C?y=N?s:i:N?y=r:y=n,g instanceof THREE.BufferGeometry?t.renderBufferDirect(l,f.__lights,x,y,g,w):t.renderBuffer(l,f.__lights,x,y,g,w)}}S=f.__webglObjectsImmediate;for(p=0,d=S.length;p<d;p++)b=S[p],w=b.object,w.visible&&(w._modelViewMatrix.multiply(l.matrixWorldInverse,w.matrixWorld),t.renderImmediateObject(l,f.__lights,x,n,w));var k=t.getClearColor(),L=t.getClearAlpha();e.clearColor(k.r,k.g,k.b,L),e.enable(e.BLEND)}},THREE.ShaderFlares={lensFlareVertexTexture:{vertexShader:["uniform vec3 screenPosition;","uniform vec2 scale;","uniform float rotation;","uniform int renderType;","uniform sampler2D occlusionMap;","attribute vec2 position;","attribute vec2 uv;","varying vec2 vUV;","varying float vVisibility;","void main() {","vUV = uv;","vec2 pos = position;","if( renderType == 2 ) {","vec4 visibility = texture2D( occlusionMap, vec2( 0.1, 0.1 ) ) +","texture2D( occlusionMap, vec2( 0.5, 0.1 ) ) +","texture2D( occlusionMap, vec2( 0.9, 0.1 ) ) +","texture2D( occlusionMap, vec2( 0.9, 0.5 ) ) +"
  ,"texture2D( occlusionMap, vec2( 0.9, 0.9 ) ) +","texture2D( occlusionMap, vec2( 0.5, 0.9 ) ) +","texture2D( occlusionMap, vec2( 0.1, 0.9 ) ) +","texture2D( occlusionMap, vec2( 0.1, 0.5 ) ) +","texture2D( occlusionMap, vec2( 0.5, 0.5 ) );","vVisibility = (       visibility.r / 9.0 ) *","( 1.0 - visibility.g / 9.0 ) *","(       visibility.b / 9.0 ) *","( 1.0 - visibility.a / 9.0 );","pos.x = cos( rotation ) * position.x - sin( rotation ) * position.y;","pos.y = sin( rotation ) * position.x + cos( rotation ) * position.y;","}","gl_Position = vec4( ( pos * scale + screenPosition.xy ).xy, screenPosition.z, 1.0 );","}"].join("\n"),fragmentShader:["precision mediump float;","uniform sampler2D map;","uniform float opacity;","uniform int renderType;","uniform vec3 color;","varying vec2 vUV;","varying float vVisibility;","void main() {","if( renderType == 0 ) {","gl_FragColor = vec4( 1.0, 0.0, 1.0, 0.0 );","} else if( renderType == 1 ) {","gl_FragColor = texture2D( map, vUV );","} else {","vec4 texture = texture2D( map, vUV );"
  ,"texture.a *= opacity * vVisibility;","gl_FragColor = texture;","gl_FragColor.rgb *= color;","}","}"].join("\n")},lensFlare:{vertexShader:["uniform vec3 screenPosition;","uniform vec2 scale;","uniform float rotation;","uniform int renderType;","attribute vec2 position;","attribute vec2 uv;","varying vec2 vUV;","void main() {","vUV = uv;","vec2 pos = position;","if( renderType == 2 ) {","pos.x = cos( rotation ) * position.x - sin( rotation ) * position.y;","pos.y = sin( rotation ) * position.x + cos( rotation ) * position.y;","}","gl_Position = vec4( ( pos * scale + screenPosition.xy ).xy, screenPosition.z, 1.0 );","}"].join("\n"),fragmentShader:["precision mediump float;","uniform sampler2D map;","uniform sampler2D occlusionMap;","uniform float opacity;","uniform int renderType;","uniform vec3 color;","varying vec2 vUV;","void main() {","if( renderType == 0 ) {","gl_FragColor = vec4( texture2D( map, vUV ).rgb, 0.0 );","} else if( renderType == 1 ) {","gl_FragColor = texture2D( map, vUV );","} else {","float visibility = texture2D( occlusionMap, vec2( 0.5, 0.1 ) ).a +"
  ,"texture2D( occlusionMap, vec2( 0.9, 0.5 ) ).a +","texture2D( occlusionMap, vec2( 0.5, 0.9 ) ).a +","texture2D( occlusionMap, vec2( 0.1, 0.5 ) ).a;","visibility = ( 1.0 - visibility / 4.0 );","vec4 texture = texture2D( map, vUV );","texture.a *= opacity * visibility;","gl_FragColor = texture;","gl_FragColor.rgb *= color;","}","}"].join("\n")}},THREE.ShaderSprite={sprite:{vertexShader:["uniform int useScreenCoordinates;","uniform int sizeAttenuation;","uniform vec3 screenPosition;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform float rotation;","uniform vec2 scale;","uniform vec2 alignment;","uniform vec2 uvOffset;","uniform vec2 uvScale;","attribute vec2 position;","attribute vec2 uv;","varying vec2 vUV;","void main() {","vUV = uvOffset + uv * uvScale;","vec2 alignedPosition = position + alignment;","vec2 rotatedPosition;","rotatedPosition.x = ( cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y ) * scale.x;","rotatedPosition.y = ( sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y ) * scale.y;"
  ,"vec4 finalPosition;","if( useScreenCoordinates != 0 ) {","finalPosition = vec4( screenPosition.xy + rotatedPosition, screenPosition.z, 1.0 );","} else {","finalPosition = projectionMatrix * modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );","finalPosition.xy += rotatedPosition * ( sizeAttenuation == 1 ? 1.0 : finalPosition.z );","}","gl_Position = finalPosition;","}"].join("\n"),fragmentShader:["precision mediump float;","uniform vec3 color;","uniform sampler2D map;","uniform float opacity;","uniform int fogType;","uniform vec3 fogColor;","uniform float fogDensity;","uniform float fogNear;","uniform float fogFar;","uniform float alphaTest;","varying vec2 vUV;","void main() {","vec4 texture = texture2D( map, vUV );","if ( texture.a < alphaTest ) discard;","gl_FragColor = vec4( color * texture.xyz, texture.a * opacity );","if ( fogType > 0 ) {","float depth = gl_FragCoord.z / gl_FragCoord.w;","float fogFactor = 0.0;","if ( fogType == 1 ) {","fogFactor = smoothstep( fogNear, fogFar, depth );","} else {","const float LOG2 = 1.442695;"
  ,"float fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );","fogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );","}","gl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );","}","}"].join("\n")}},THREE.ShaderExtras={screen:{uniforms:{tDiffuse:{type:"t",value:null},opacity:{type:"f",value:1}},vertexShader:["varying vec2 vUv;","void main() {","vUv = uv;","gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),fragmentShader:["uniform float opacity;","uniform sampler2D tDiffuse;","varying vec2 vUv;","void main() {","vec4 texel = texture2D( tDiffuse, vUv );","gl_FragColor = opacity * texel;","}"].join("\n")},convolution:{uniforms:{tDiffuse:{type:"t",value:null},uImageIncrement:{type:"v2",value:new THREE.Vector2(.001953125,0)},cKernel:{type:"fv1",value:[]}},vertexShader:["uniform vec2 uImageIncrement;","varying vec2 vUv;","void main() {","vUv = uv - ( ( KERNEL_SIZE - 1.0 ) / 2.0 ) * uImageIncrement;","gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );"
  ,"}"].join("\n"),fragmentShader:["uniform float cKernel[ KERNEL_SIZE ];","uniform sampler2D tDiffuse;","uniform vec2 uImageIncrement;","varying vec2 vUv;","void main() {","vec2 imageCoord = vUv;","vec4 sum = vec4( 0.0, 0.0, 0.0, 0.0 );","for( int i = 0; i < KERNEL_SIZE; i ++ ) {","sum += texture2D( tDiffuse, imageCoord ) * cKernel[ i ];","imageCoord += uImageIncrement;","}","gl_FragColor = sum;","}"].join("\n")},film:{uniforms:{tDiffuse:{type:"t",value:null},time:{type:"f",value:0},nIntensity:{type:"f",value:.5},sIntensity:{type:"f",value:.05},sCount:{type:"f",value:4096},grayscale:{type:"i",value:1}},vertexShader:["varying vec2 vUv;","void main() {","vUv = uv;","gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),fragmentShader:["uniform float time;","uniform bool grayscale;","uniform float nIntensity;","uniform float sIntensity;","uniform float sCount;","uniform sampler2D tDiffuse;","varying vec2 vUv;","void main() {","vec4 cTextureScreen = texture2D( tDiffuse, vUv );","float x = vUv.x * vUv.y * time *  1000.0;"
  ,"x = mod( x, 13.0 ) * mod( x, 123.0 );","float dx = mod( x, 0.01 );","vec3 cResult = cTextureScreen.rgb + cTextureScreen.rgb * clamp( 0.1 + dx * 100.0, 0.0, 1.0 );","vec2 sc = vec2( sin( vUv.y * sCount ), cos( vUv.y * sCount ) );","cResult += cTextureScreen.rgb * vec3( sc.x, sc.y, sc.x ) * sIntensity;","cResult = cTextureScreen.rgb + clamp( nIntensity, 0.0,1.0 ) * ( cResult - cTextureScreen.rgb );","if( grayscale ) {","cResult = vec3( cResult.r * 0.3 + cResult.g * 0.59 + cResult.b * 0.11 );","}","gl_FragColor =  vec4( cResult, cTextureScreen.a );","}"].join("\n")},bokeh:{uniforms:{tColor:{type:"t",value:null},tDepth:{type:"t",value:null},focus:{type:"f",value:1},aspect:{type:"f",value:1},aperture:{type:"f",value:.025},maxblur:{type:"f",value:1}},vertexShader:["varying vec2 vUv;","void main() {","vUv = uv;","gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),fragmentShader:["varying vec2 vUv;","uniform sampler2D tColor;","uniform sampler2D tDepth;","uniform float maxblur;"
  ,"uniform float aperture;","uniform float focus;","uniform float aspect;","void main() {","vec2 aspectcorrect = vec2( 1.0, aspect );","vec4 depth1 = texture2D( tDepth, vUv );","float factor = depth1.x - focus;","vec2 dofblur = vec2 ( clamp( factor * aperture, -maxblur, maxblur ) );","vec2 dofblur9 = dofblur * 0.9;","vec2 dofblur7 = dofblur * 0.7;","vec2 dofblur4 = dofblur * 0.4;","vec4 col = vec4( 0.0 );","col += texture2D( tColor, vUv.xy );","col += texture2D( tColor, vUv.xy + ( vec2(  0.0,   0.4  ) * aspectcorrect ) * dofblur );","col += texture2D( tColor, vUv.xy + ( vec2(  0.15,  0.37 ) * aspectcorrect ) * dofblur );","col += texture2D( tColor, vUv.xy + ( vec2(  0.29,  0.29 ) * aspectcorrect ) * dofblur );","col += texture2D( tColor, vUv.xy + ( vec2( -0.37,  0.15 ) * aspectcorrect ) * dofblur );","col += texture2D( tColor, vUv.xy + ( vec2(  0.40,  0.0  ) * aspectcorrect ) * dofblur );","col += texture2D( tColor, vUv.xy + ( vec2(  0.37, -0.15 ) * aspectcorrect ) * dofblur );","col += texture2D( tColor, vUv.xy + ( vec2(  0.29, -0.29 ) * aspectcorrect ) * dofblur );"
  ,"col += texture2D( tColor, vUv.xy + ( vec2( -0.15, -0.37 ) * aspectcorrect ) * dofblur );","col += texture2D( tColor, vUv.xy + ( vec2(  0.0,  -0.4  ) * aspectcorrect ) * dofblur );","col += texture2D( tColor, vUv.xy + ( vec2( -0.15,  0.37 ) * aspectcorrect ) * dofblur );","col += texture2D( tColor, vUv.xy + ( vec2( -0.29,  0.29 ) * aspectcorrect ) * dofblur );","col += texture2D( tColor, vUv.xy + ( vec2(  0.37,  0.15 ) * aspectcorrect ) * dofblur );","col += texture2D( tColor, vUv.xy + ( vec2( -0.4,   0.0  ) * aspectcorrect ) * dofblur );","col += texture2D( tColor, vUv.xy + ( vec2( -0.37, -0.15 ) * aspectcorrect ) * dofblur );","col += texture2D( tColor, vUv.xy + ( vec2( -0.29, -0.29 ) * aspectcorrect ) * dofblur );","col += texture2D( tColor, vUv.xy + ( vec2(  0.15, -0.37 ) * aspectcorrect ) * dofblur );","col += texture2D( tColor, vUv.xy + ( vec2(  0.15,  0.37 ) * aspectcorrect ) * dofblur9 );","col += texture2D( tColor, vUv.xy + ( vec2( -0.37,  0.15 ) * aspectcorrect ) * dofblur9 );","col += texture2D( tColor, vUv.xy + ( vec2(  0.37, -0.15 ) * aspectcorrect ) * dofblur9 );"
  ,"col += texture2D( tColor, vUv.xy + ( vec2( -0.15, -0.37 ) * aspectcorrect ) * dofblur9 );","col += texture2D( tColor, vUv.xy + ( vec2( -0.15,  0.37 ) * aspectcorrect ) * dofblur9 );","col += texture2D( tColor, vUv.xy + ( vec2(  0.37,  0.15 ) * aspectcorrect ) * dofblur9 );","col += texture2D( tColor, vUv.xy + ( vec2( -0.37, -0.15 ) * aspectcorrect ) * dofblur9 );","col += texture2D( tColor, vUv.xy + ( vec2(  0.15, -0.37 ) * aspectcorrect ) * dofblur9 );","col += texture2D( tColor, vUv.xy + ( vec2(  0.29,  0.29 ) * aspectcorrect ) * dofblur7 );","col += texture2D( tColor, vUv.xy + ( vec2(  0.40,  0.0  ) * aspectcorrect ) * dofblur7 );","col += texture2D( tColor, vUv.xy + ( vec2(  0.29, -0.29 ) * aspectcorrect ) * dofblur7 );","col += texture2D( tColor, vUv.xy + ( vec2(  0.0,  -0.4  ) * aspectcorrect ) * dofblur7 );","col += texture2D( tColor, vUv.xy + ( vec2( -0.29,  0.29 ) * aspectcorrect ) * dofblur7 );","col += texture2D( tColor, vUv.xy + ( vec2( -0.4,   0.0  ) * aspectcorrect ) * dofblur7 );","col += texture2D( tColor, vUv.xy + ( vec2( -0.29, -0.29 ) * aspectcorrect ) * dofblur7 );"
  ,"col += texture2D( tColor, vUv.xy + ( vec2(  0.0,   0.4  ) * aspectcorrect ) * dofblur7 );","col += texture2D( tColor, vUv.xy + ( vec2(  0.29,  0.29 ) * aspectcorrect ) * dofblur4 );","col += texture2D( tColor, vUv.xy + ( vec2(  0.4,   0.0  ) * aspectcorrect ) * dofblur4 );","col += texture2D( tColor, vUv.xy + ( vec2(  0.29, -0.29 ) * aspectcorrect ) * dofblur4 );","col += texture2D( tColor, vUv.xy + ( vec2(  0.0,  -0.4  ) * aspectcorrect ) * dofblur4 );","col += texture2D( tColor, vUv.xy + ( vec2( -0.29,  0.29 ) * aspectcorrect ) * dofblur4 );","col += texture2D( tColor, vUv.xy + ( vec2( -0.4,   0.0  ) * aspectcorrect ) * dofblur4 );","col += texture2D( tColor, vUv.xy + ( vec2( -0.29, -0.29 ) * aspectcorrect ) * dofblur4 );","col += texture2D( tColor, vUv.xy + ( vec2(  0.0,   0.4  ) * aspectcorrect ) * dofblur4 );","gl_FragColor = col / 41.0;","gl_FragColor.a = 1.0;","}"].join("\n")},dofmipmap:{uniforms:{tColor:{type:"t",value:null},tDepth:{type:"t",value:null},focus:{type:"f",value:1},maxblur:{type:"f",value
  :1}},vertexShader:["varying vec2 vUv;","void main() {","vUv = uv;","gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),fragmentShader:["uniform float focus;","uniform float maxblur;","uniform sampler2D tColor;","uniform sampler2D tDepth;","varying vec2 vUv;","void main() {","vec4 depth = texture2D( tDepth, vUv );","float factor = depth.x - focus;","vec4 col = texture2D( tColor, vUv, 2.0 * maxblur * abs( focus - depth.x ) );","gl_FragColor = col;","gl_FragColor.a = 1.0;","}"].join("\n")},sepia:{uniforms:{tDiffuse:{type:"t",value:null},amount:{type:"f",value:1}},vertexShader:["varying vec2 vUv;","void main() {","vUv = uv;","gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),fragmentShader:["uniform float amount;","uniform sampler2D tDiffuse;","varying vec2 vUv;","void main() {","vec4 color = texture2D( tDiffuse, vUv );","vec3 c = color.rgb;","color.r = dot( c, vec3( 1.0 - 0.607 * amount, 0.769 * amount, 0.189 * amount ) );","color.g = dot( c, vec3( 0.349 * amount, 1.0 - 0.314 * amount, 0.168 * amount ) );"
  ,"color.b = dot( c, vec3( 0.272 * amount, 0.534 * amount, 1.0 - 0.869 * amount ) );","gl_FragColor = vec4( min( vec3( 1.0 ), color.rgb ), color.a );","}"].join("\n")},dotscreen:{uniforms:{tDiffuse:{type:"t",value:null},tSize:{type:"v2",value:new THREE.Vector2(256,256)},center:{type:"v2",value:new THREE.Vector2(.5,.5)},angle:{type:"f",value:1.57},scale:{type:"f",value:1}},vertexShader:["varying vec2 vUv;","void main() {","vUv = uv;","gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),fragmentShader:["uniform vec2 center;","uniform float angle;","uniform float scale;","uniform vec2 tSize;","uniform sampler2D tDiffuse;","varying vec2 vUv;","float pattern() {","float s = sin( angle ), c = cos( angle );","vec2 tex = vUv * tSize - center;","vec2 point = vec2( c * tex.x - s * tex.y, s * tex.x + c * tex.y ) * scale;","return ( sin( point.x ) * sin( point.y ) ) * 4.0;","}","void main() {","vec4 color = texture2D( tDiffuse, vUv );","float average = ( color.r + color.g + color.b ) / 3.0;"
  ,"gl_FragColor = vec4( vec3( average * 10.0 - 5.0 + pattern() ), color.a );","}"].join("\n")},vignette:{uniforms:{tDiffuse:{type:"t",value:null},offset:{type:"f",value:1},darkness:{type:"f",value:1}},vertexShader:["varying vec2 vUv;","void main() {","vUv = uv;","gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),fragmentShader:["uniform float offset;","uniform float darkness;","uniform sampler2D tDiffuse;","varying vec2 vUv;","void main() {","vec4 texel = texture2D( tDiffuse, vUv );","vec2 uv = ( vUv - vec2( 0.5 ) ) * vec2( offset );","gl_FragColor = vec4( mix( texel.rgb, vec3( 1.0 - darkness ), dot( uv, uv ) ), texel.a );","}"].join("\n")},bleachbypass:{uniforms:{tDiffuse:{type:"t",value:null},opacity:{type:"f",value:1}},vertexShader:["varying vec2 vUv;","void main() {","vUv = uv;","gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),fragmentShader:["uniform float opacity;","uniform sampler2D tDiffuse;","varying vec2 vUv;","void main() {"
  ,"vec4 base = texture2D( tDiffuse, vUv );","vec3 lumCoeff = vec3( 0.25, 0.65, 0.1 );","float lum = dot( lumCoeff, base.rgb );","vec3 blend = vec3( lum );","float L = min( 1.0, max( 0.0, 10.0 * ( lum - 0.45 ) ) );","vec3 result1 = 2.0 * base.rgb * blend;","vec3 result2 = 1.0 - 2.0 * ( 1.0 - blend ) * ( 1.0 - base.rgb );","vec3 newColor = mix( result1, result2, L );","float A2 = opacity * base.a;","vec3 mixRGB = A2 * newColor.rgb;","mixRGB += ( ( 1.0 - A2 ) * base.rgb );","gl_FragColor = vec4( mixRGB, base.a );","}"].join("\n")},focus:{uniforms:{tDiffuse:{type:"t",value:null},screenWidth:{type:"f",value:1024},screenHeight:{type:"f",value:1024},sampleDistance:{type:"f",value:.94},waveFactor:{type:"f",value:.00125}},vertexShader:["varying vec2 vUv;","void main() {","vUv = uv;","gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),fragmentShader:["uniform float screenWidth;","uniform float screenHeight;","uniform float sampleDistance;","uniform float waveFactor;","uniform sampler2D tDiffuse;"
  ,"varying vec2 vUv;","void main() {","vec4 color, org, tmp, add;","float sample_dist, f;","vec2 vin;","vec2 uv = vUv;","add = color = org = texture2D( tDiffuse, uv );","vin = ( uv - vec2( 0.5 ) ) * vec2( 1.4 );","sample_dist = dot( vin, vin ) * 2.0;","f = ( waveFactor * 100.0 + sample_dist ) * sampleDistance * 4.0;","vec2 sampleSize = vec2(  1.0 / screenWidth, 1.0 / screenHeight ) * vec2( f );","add += tmp = texture2D( tDiffuse, uv + vec2( 0.111964, 0.993712 ) * sampleSize );","if( tmp.b < color.b ) color = tmp;","add += tmp = texture2D( tDiffuse, uv + vec2( 0.846724, 0.532032 ) * sampleSize );","if( tmp.b < color.b ) color = tmp;","add += tmp = texture2D( tDiffuse, uv + vec2( 0.943883, -0.330279 ) * sampleSize );","if( tmp.b < color.b ) color = tmp;","add += tmp = texture2D( tDiffuse, uv + vec2( 0.330279, -0.943883 ) * sampleSize );","if( tmp.b < color.b ) color = tmp;","add += tmp = texture2D( tDiffuse, uv + vec2( -0.532032, -0.846724 ) * sampleSize );","if( tmp.b < color.b ) color = tmp;","add += tmp = texture2D( tDiffuse, uv + vec2( -0.993712, -0.111964 ) * sampleSize );"
  ,"if( tmp.b < color.b ) color = tmp;","add += tmp = texture2D( tDiffuse, uv + vec2( -0.707107, 0.707107 ) * sampleSize );","if( tmp.b < color.b ) color = tmp;","color = color * vec4( 2.0 ) - ( add / vec4( 8.0 ) );","color = color + ( add / vec4( 8.0 ) - color ) * ( vec4( 1.0 ) - vec4( sample_dist * 0.5 ) );","gl_FragColor = vec4( color.rgb * color.rgb * vec3( 0.95 ) + color.rgb, 1.0 );","}"].join("\n")},triangleBlur:{uniforms:{texture:{type:"t",value:null},delta:{type:"v2",value:new THREE.Vector2(1,1)}},vertexShader:["varying vec2 vUv;","void main() {","vUv = uv;","gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),fragmentShader:["#define ITERATIONS 10.0","uniform sampler2D texture;","uniform vec2 delta;","varying vec2 vUv;","float random( vec3 scale, float seed ) {","return fract( sin( dot( gl_FragCoord.xyz + seed, scale ) ) * 43758.5453 + seed );","}","void main() {","vec4 color = vec4( 0.0 );","float total = 0.0;","float offset = random( vec3( 12.9898, 78.233, 151.7182 ), 0.0 );"
  ,"for ( float t = -ITERATIONS; t <= ITERATIONS; t ++ ) {","float percent = ( t + offset - 0.5 ) / ITERATIONS;","float weight = 1.0 - abs( percent );","color += texture2D( texture, vUv + delta * percent ) * weight;","total += weight;","}","gl_FragColor = color / total;","}"].join("\n")},basic:{uniforms:{},vertexShader:["void main() {","gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),fragmentShader:["void main() {","gl_FragColor = vec4( 1.0, 0.0, 0.0, 0.5 );","}"].join("\n")},horizontalBlur:{uniforms:{tDiffuse:{type:"t",value:null},h:{type:"f",value:1/512}},vertexShader:["varying vec2 vUv;","void main() {","vUv = uv;","gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),fragmentShader:["uniform sampler2D tDiffuse;","uniform float h;","varying vec2 vUv;","void main() {","vec4 sum = vec4( 0.0 );","sum += texture2D( tDiffuse, vec2( vUv.x - 4.0 * h, vUv.y ) ) * 0.051;","sum += texture2D( tDiffuse, vec2( vUv.x - 3.0 * h, vUv.y ) ) * 0.0918;"
  ,"sum += texture2D( tDiffuse, vec2( vUv.x - 2.0 * h, vUv.y ) ) * 0.12245;","sum += texture2D( tDiffuse, vec2( vUv.x - 1.0 * h, vUv.y ) ) * 0.1531;","sum += texture2D( tDiffuse, vec2( vUv.x, 		  	vUv.y ) ) * 0.1633;","sum += texture2D( tDiffuse, vec2( vUv.x + 1.0 * h, vUv.y ) ) * 0.1531;","sum += texture2D( tDiffuse, vec2( vUv.x + 2.0 * h, vUv.y ) ) * 0.12245;","sum += texture2D( tDiffuse, vec2( vUv.x + 3.0 * h, vUv.y ) ) * 0.0918;","sum += texture2D( tDiffuse, vec2( vUv.x + 4.0 * h, vUv.y ) ) * 0.051;","gl_FragColor = sum;","}"].join("\n")},verticalBlur:{uniforms:{tDiffuse:{type:"t",value:null},v:{type:"f",value:1/512}},vertexShader:["varying vec2 vUv;","void main() {","vUv = uv;","gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),fragmentShader:["uniform sampler2D tDiffuse;","uniform float v;","varying vec2 vUv;","void main() {","vec4 sum = vec4( 0.0 );","sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 4.0 * v ) ) * 0.051;","sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 3.0 * v ) ) * 0.0918;"
  ,"sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 2.0 * v ) ) * 0.12245;","sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 1.0 * v ) ) * 0.1531;","sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y			  ) ) * 0.1633;","sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 1.0 * v ) ) * 0.1531;","sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 2.0 * v ) ) * 0.12245;","sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 3.0 * v ) ) * 0.0918;","sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 4.0 * v ) ) * 0.051;","gl_FragColor = sum;","}"].join("\n")},horizontalTiltShift:{uniforms:{tDiffuse:{type:"t",value:null},h:{type:"f",value:1/512},r:{type:"f",value:.35}},vertexShader:["varying vec2 vUv;","void main() {","vUv = uv;","gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),fragmentShader:["uniform sampler2D tDiffuse;","uniform float h;","uniform float r;","varying vec2 vUv;","void main() {","vec4 sum = vec4( 0.0 );","float hh = h * abs( r - vUv.y );","sum += texture2D( tDiffuse, vec2( vUv.x - 4.0 * hh, vUv.y ) ) * 0.051;"
  ,"sum += texture2D( tDiffuse, vec2( vUv.x - 3.0 * hh, vUv.y ) ) * 0.0918;","sum += texture2D( tDiffuse, vec2( vUv.x - 2.0 * hh, vUv.y ) ) * 0.12245;","sum += texture2D( tDiffuse, vec2( vUv.x - 1.0 * hh, vUv.y ) ) * 0.1531;","sum += texture2D( tDiffuse, vec2( vUv.x, 		  	 vUv.y ) ) * 0.1633;","sum += texture2D( tDiffuse, vec2( vUv.x + 1.0 * hh, vUv.y ) ) * 0.1531;","sum += texture2D( tDiffuse, vec2( vUv.x + 2.0 * hh, vUv.y ) ) * 0.12245;","sum += texture2D( tDiffuse, vec2( vUv.x + 3.0 * hh, vUv.y ) ) * 0.0918;","sum += texture2D( tDiffuse, vec2( vUv.x + 4.0 * hh, vUv.y ) ) * 0.051;","gl_FragColor = sum;","}"].join("\n")},verticalTiltShift:{uniforms:{tDiffuse:{type:"t",value:null},v:{type:"f",value:1/512},r:{type:"f",value:.35}},vertexShader:["varying vec2 vUv;","void main() {","vUv = uv;","gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),fragmentShader:["uniform sampler2D tDiffuse;","uniform float v;","uniform float r;","varying vec2 vUv;","void main() {","vec4 sum = vec4( 0.0 );"
  ,"float vv = v * abs( r - vUv.y );","sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 4.0 * vv ) ) * 0.051;","sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 3.0 * vv ) ) * 0.0918;","sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 2.0 * vv ) ) * 0.12245;","sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 1.0 * vv ) ) * 0.1531;","sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y			   ) ) * 0.1633;","sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 1.0 * vv ) ) * 0.1531;","sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 2.0 * vv ) ) * 0.12245;","sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 3.0 * vv ) ) * 0.0918;","sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 4.0 * vv ) ) * 0.051;","gl_FragColor = sum;","}"].join("\n")},blend:{uniforms:{tDiffuse1:{type:"t",value:null},tDiffuse2:{type:"t",value:null},mixRatio:{type:"f",value:.5},opacity:{type:"f",value:1}},vertexShader:["varying vec2 vUv;","void main() {","vUv = uv;","gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"
  ),fragmentShader:["uniform float opacity;","uniform float mixRatio;","uniform sampler2D tDiffuse1;","uniform sampler2D tDiffuse2;","varying vec2 vUv;","void main() {","vec4 texel1 = texture2D( tDiffuse1, vUv );","vec4 texel2 = texture2D( tDiffuse2, vUv );","gl_FragColor = opacity * mix( texel1, texel2, mixRatio );","}"].join("\n")},fxaa:{uniforms:{tDiffuse:{type:"t",value:null},resolution:{type:"v2",value:new THREE.Vector2(1/1024,1/512)}},vertexShader:["varying vec2 vUv;","void main() {","vUv = uv;","gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),fragmentShader:["uniform sampler2D tDiffuse;","uniform vec2 resolution;","varying vec2 vUv;","#define FXAA_REDUCE_MIN   (1.0/128.0)","#define FXAA_REDUCE_MUL   (1.0/8.0)","#define FXAA_SPAN_MAX     8.0","void main() {","vec3 rgbNW = texture2D( tDiffuse, ( gl_FragCoord.xy + vec2( -1.0, -1.0 ) ) * resolution ).xyz;","vec3 rgbNE = texture2D( tDiffuse, ( gl_FragCoord.xy + vec2( 1.0, -1.0 ) ) * resolution ).xyz;","vec3 rgbSW = texture2D( tDiffuse, ( gl_FragCoord.xy + vec2( -1.0, 1.0 ) ) * resolution ).xyz;"
  ,"vec3 rgbSE = texture2D( tDiffuse, ( gl_FragCoord.xy + vec2( 1.0, 1.0 ) ) * resolution ).xyz;","vec4 rgbaM  = texture2D( tDiffuse,  gl_FragCoord.xy  * resolution );","vec3 rgbM  = rgbaM.xyz;","float opacity  = rgbaM.w;","vec3 luma = vec3( 0.299, 0.587, 0.114 );","float lumaNW = dot( rgbNW, luma );","float lumaNE = dot( rgbNE, luma );","float lumaSW = dot( rgbSW, luma );","float lumaSE = dot( rgbSE, luma );","float lumaM  = dot( rgbM,  luma );","float lumaMin = min( lumaM, min( min( lumaNW, lumaNE ), min( lumaSW, lumaSE ) ) );","float lumaMax = max( lumaM, max( max( lumaNW, lumaNE) , max( lumaSW, lumaSE ) ) );","vec2 dir;","dir.x = -((lumaNW + lumaNE) - (lumaSW + lumaSE));","dir.y =  ((lumaNW + lumaSW) - (lumaNE + lumaSE));","float dirReduce = max( ( lumaNW + lumaNE + lumaSW + lumaSE ) * ( 0.25 * FXAA_REDUCE_MUL ), FXAA_REDUCE_MIN );","float rcpDirMin = 1.0 / ( min( abs( dir.x ), abs( dir.y ) ) + dirReduce );","dir = min( vec2( FXAA_SPAN_MAX,  FXAA_SPAN_MAX),","max( vec2(-FXAA_SPAN_MAX, -FXAA_SPAN_MAX),","dir * rcpDirMin)) * resolution;"
  ,"vec3 rgbA = 0.5 * (","texture2D( tDiffuse, gl_FragCoord.xy  * resolution + dir * ( 1.0 / 3.0 - 0.5 ) ).xyz +","texture2D( tDiffuse, gl_FragCoord.xy  * resolution + dir * ( 2.0 / 3.0 - 0.5 ) ).xyz );","vec3 rgbB = rgbA * 0.5 + 0.25 * (","texture2D( tDiffuse, gl_FragCoord.xy  * resolution + dir * -0.5 ).xyz +","texture2D( tDiffuse, gl_FragCoord.xy  * resolution + dir * 0.5 ).xyz );","float lumaB = dot( rgbB, luma );","if ( ( lumaB < lumaMin ) || ( lumaB > lumaMax ) ) {","gl_FragColor = vec4( rgbA, opacity );","} else {","gl_FragColor = vec4( rgbB, opacity );","}","}"].join("\n")},luminosity:{uniforms:{tDiffuse:{type:"t",value:null}},vertexShader:["varying vec2 vUv;","void main() {","vUv = uv;","gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),fragmentShader:["uniform sampler2D tDiffuse;","varying vec2 vUv;","void main() {","vec4 texel = texture2D( tDiffuse, vUv );","vec3 luma = vec3( 0.299, 0.587, 0.114 );","float v = dot( texel.xyz, luma );","gl_FragColor = vec4( v, v, v, texel.w );"
  ,"}"].join("\n")},colorCorrection:{uniforms:{tDiffuse:{type:"t",value:null},powRGB:{type:"v3",value:new THREE.Vector3(2,2,2)},mulRGB:{type:"v3",value:new THREE.Vector3(1,1,1)}},vertexShader:["varying vec2 vUv;","void main() {","vUv = uv;","gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),fragmentShader:["uniform sampler2D tDiffuse;","uniform vec3 powRGB;","uniform vec3 mulRGB;","varying vec2 vUv;","void main() {","gl_FragColor = texture2D( tDiffuse, vUv );","gl_FragColor.rgb = mulRGB * pow( gl_FragColor.rgb, powRGB );","}"].join("\n")},brightnessContrast:{uniforms:{tDiffuse:{type:"t",value:null},brightness:{type:"f",value:0},contrast:{type:"f",value:0}},vertexShader:["varying vec2 vUv;","void main() {","vUv = uv;","gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),fragmentShader:["uniform sampler2D tDiffuse;","uniform float brightness;","uniform float contrast;","varying vec2 vUv;","void main() {","gl_FragColor = texture2D( tDiffuse, vUv );"
  ,"gl_FragColor.rgb += brightness;","if (contrast > 0.0) {","gl_FragColor.rgb = (gl_FragColor.rgb - 0.5) / (1.0 - contrast) + 0.5;","} else {","gl_FragColor.rgb = (gl_FragColor.rgb - 0.5) * (1.0 + contrast) + 0.5;","}","}"].join("\n")},hueSaturation:{uniforms:{tDiffuse:{type:"t",value:null},hue:{type:"f",value:0},saturation:{type:"f",value:0}},vertexShader:["varying vec2 vUv;","void main() {","vUv = uv;","gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),fragmentShader:["uniform sampler2D tDiffuse;","uniform float hue;","uniform float saturation;","varying vec2 vUv;","void main() {","gl_FragColor = texture2D( tDiffuse, vUv );","float angle = hue * 3.14159265;","float s = sin(angle), c = cos(angle);","vec3 weights = (vec3(2.0 * c, -sqrt(3.0) * s - c, sqrt(3.0) * s - c) + 1.0) / 3.0;","float len = length(gl_FragColor.rgb);","gl_FragColor.rgb = vec3(","dot(gl_FragColor.rgb, weights.xyz),","dot(gl_FragColor.rgb, weights.zxy),","dot(gl_FragColor.rgb, weights.yzx)",");","float average = (gl_FragColor.r + gl_FragColor.g + gl_FragColor.b) / 3.0;"
  ,"if (saturation > 0.0) {","gl_FragColor.rgb += (average - gl_FragColor.rgb) * (1.0 - 1.0 / (1.001 - saturation));","} else {","gl_FragColor.rgb += (average - gl_FragColor.rgb) * (-saturation);","}","}"].join("\n")},normalmap:{uniforms:{heightMap:{type:"t",value:null},resolution:{type:"v2",value:new THREE.Vector2(512,512)},scale:{type:"v2",value:new THREE.Vector2(1,1)},height:{type:"f",value:.05}},vertexShader:["varying vec2 vUv;","void main() {","vUv = uv;","gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),fragmentShader:["uniform float height;","uniform vec2 resolution;","uniform sampler2D heightMap;","varying vec2 vUv;","void main() {","float val = texture2D( heightMap, vUv ).x;","float valU = texture2D( heightMap, vUv + vec2( 1.0 / resolution.x, 0.0 ) ).x;","float valV = texture2D( heightMap, vUv + vec2( 0.0, 1.0 / resolution.y ) ).x;","gl_FragColor = vec4( ( 0.5 * normalize( vec3( val - valU, val - valV, height  ) ) + 0.5 ), 1.0 );","}"].join("\n")},ssao:{uniforms
  :{tDiffuse:{type:"t",value:null},tDepth:{type:"t",value:null},size:{type:"v2",value:new THREE.Vector2(512,512)},cameraNear:{type:"f",value:1},cameraFar:{type:"f",value:100},fogNear:{type:"f",value:5},fogFar:{type:"f",value:100},fogEnabled:{type:"i",value:0},onlyAO:{type:"i",value:0},aoClamp:{type:"f",value:.3},lumInfluence:{type:"f",value:.9}},vertexShader:["varying vec2 vUv;","void main() {","vUv = uv;","gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),fragmentShader:["uniform float cameraNear;","uniform float cameraFar;","uniform float fogNear;","uniform float fogFar;","uniform bool fogEnabled;","uniform bool onlyAO;","uniform vec2 size;","uniform float aoClamp;","uniform float lumInfluence;","uniform sampler2D tDiffuse;","uniform sampler2D tDepth;","varying vec2 vUv;","#define DL 2.399963229728653","#define EULER 2.718281828459045","float width = size.x;","float height = size.y;","float cameraFarPlusNear = cameraFar + cameraNear;","float cameraFarMinusNear = cameraFar - cameraNear;"
  ,"float cameraCoef = 2.0 * cameraNear;","const int samples = 8;","const float radius = 5.0;","const bool useNoise = false;","const float noiseAmount = 0.0003;","const float diffArea = 0.4;","const float gDisplace = 0.4;","const vec3 onlyAOColor = vec3( 1.0, 0.7, 0.5 );","float unpackDepth( const in vec4 rgba_depth ) {","const vec4 bit_shift = vec4( 1.0 / ( 256.0 * 256.0 * 256.0 ), 1.0 / ( 256.0 * 256.0 ), 1.0 / 256.0, 1.0 );","float depth = dot( rgba_depth, bit_shift );","return depth;","}","vec2 rand( const vec2 coord ) {","vec2 noise;","if ( useNoise ) {","float nx = dot ( coord, vec2( 12.9898, 78.233 ) );","float ny = dot ( coord, vec2( 12.9898, 78.233 ) * 2.0 );","noise = clamp( fract ( 43758.5453 * sin( vec2( nx, ny ) ) ), 0.0, 1.0 );","} else {","float ff = fract( 1.0 - coord.s * ( width / 2.0 ) );","float gg = fract( coord.t * ( height / 2.0 ) );","noise = vec2( 0.25, 0.75 ) * vec2( ff ) + vec2( 0.75, 0.25 ) * gg;","}","return ( noise * 2.0  - 1.0 ) * noiseAmount;","}","float doFog() {","float zdepth = unpackDepth( texture2D( tDepth, vUv ) );"
  ,"float depth = -cameraFar * cameraNear / ( zdepth * cameraFarMinusNear - cameraFar );","return smoothstep( fogNear, fogFar, depth );","}","float readDepth( const in vec2 coord ) {","return cameraCoef / ( cameraFarPlusNear - unpackDepth( texture2D( tDepth, coord ) ) * cameraFarMinusNear );","}","float compareDepths( const in float depth1, const in float depth2, inout int far ) {","float garea = 2.0;","float diff = ( depth1 - depth2 ) * 100.0;","if ( diff < gDisplace ) {","garea = diffArea;","} else {","far = 1;","}","float dd = diff - gDisplace;","float gauss = pow( EULER, -2.0 * dd * dd / ( garea * garea ) );","return gauss;","}","float calcAO( float depth, float dw, float dh ) {","float dd = radius - depth * radius;","vec2 vv = vec2( dw, dh );","vec2 coord1 = vUv + dd * vv;","vec2 coord2 = vUv - dd * vv;","float temp1 = 0.0;","float temp2 = 0.0;","int far = 0;","temp1 = compareDepths( depth, readDepth( coord1 ), far );","if ( far > 0 ) {","temp2 = compareDepths( readDepth( coord2 ), depth, far );","temp1 += ( 1.0 - temp1 ) * temp2;"
  ,"}","return temp1;","}","void main() {","vec2 noise = rand( vUv );","float depth = readDepth( vUv );","float tt = clamp( depth, aoClamp, 1.0 );","float w = ( 1.0 / width )  / tt + ( noise.x * ( 1.0 - noise.x ) );","float h = ( 1.0 / height ) / tt + ( noise.y * ( 1.0 - noise.y ) );","float pw;","float ph;","float ao;","float dz = 1.0 / float( samples );","float z = 1.0 - dz / 2.0;","float l = 0.0;","for ( int i = 0; i <= samples; i ++ ) {","float r = sqrt( 1.0 - z );","pw = cos( l ) * r;","ph = sin( l ) * r;","ao += calcAO( depth, pw * w, ph * h );","z = z - dz;","l = l + DL;","}","ao /= float( samples );","ao = 1.0 - ao;","if ( fogEnabled ) {","ao = mix( ao, 1.0, doFog() );","}","vec3 color = texture2D( tDiffuse, vUv ).rgb;","vec3 lumcoeff = vec3( 0.299, 0.587, 0.114 );","float lum = dot( color.rgb, lumcoeff );","vec3 luminance = vec3( lum );","vec3 final = vec3( color * mix( vec3( ao ), vec3( 1.0 ), luminance * lumInfluence ) );","if ( onlyAO ) {","final = onlyAOColor * vec3( mix( vec3( ao ), vec3( 1.0 ), luminance * lumInfluence ) );"
  ,"}","gl_FragColor = vec4( final, 1.0 );","}"].join("\n")},colorify:{uniforms:{tDiffuse:{type:"t",value:null},color:{type:"c",value:new THREE.Color(16777215)}},vertexShader:["varying vec2 vUv;","void main() {","vUv = uv;","gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),fragmentShader:["uniform vec3 color;","uniform sampler2D tDiffuse;","varying vec2 vUv;","void main() {","vec4 texel = texture2D( tDiffuse, vUv );","vec3 luma = vec3( 0.299, 0.587, 0.114 );","float v = dot( texel.xyz, luma );","gl_FragColor = vec4( v * color, texel.w );","}"].join("\n")},unpackDepthRGBA:{uniforms:{tDiffuse:{type:"t",value:null},opacity:{type:"f",value:1}},vertexShader:["varying vec2 vUv;","void main() {","vUv = uv;","gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),fragmentShader:["uniform float opacity;","uniform sampler2D tDiffuse;","varying vec2 vUv;","float unpackDepth( const in vec4 rgba_depth ) {","const vec4 bit_shift = vec4( 1.0 / ( 256.0 * 256.0 * 256.0 ), 1.0 / ( 256.0 * 256.0 ), 1.0 / 256.0, 1.0 );"
  ,"float depth = dot( rgba_depth, bit_shift );","return depth;","}","void main() {","float depth = 1.0 - unpackDepth( texture2D( tDiffuse, vUv ) );","gl_FragColor = opacity * vec4( vec3( depth ), 1.0 );","}"].join("\n")},buildKernel:function(e){function t(e,t){return Math.exp(-(e*e)/(2*t*t))}var n,r,i,s,o=25,u=2*Math.ceil(e*3)+1;u>o&&(u=o),s=(u-1)*.5,r=new Array(u),i=0;for(n=0;n<u;++n)r[n]=t(n-s,e),i+=r[n];for(n=0;n<u;++n)r[n]/=i;return r}},THREE.MaskPass=function(e,t){this.scene=e,this.camera=t,this.enabled=!0,this.clear=!0,this.needsSwap=!1,this.inverse=!1},THREE.MaskPass.prototype={render:function(e,t,n,r){var i=e.context;i.colorMask(!1,!1,!1,!1),i.depthMask(!1);var s,o;this.inverse?(s=0,o=1):(s=1,o=0),i.enable(i.STENCIL_TEST),i.stencilOp(i.REPLACE,i.REPLACE,i.REPLACE),i.stencilFunc(i.ALWAYS,s,4294967295),i.clearStencil(o),e.render(this.scene,this.camera,n,this.clear),e.render(this.scene,this.camera,t,this.clear),i.colorMask(!0,!0,!0,!0),i.depthMask(!0),i.stencilFunc(i.EQUAL,1,4294967295),i.stencilOp(i.KEEP,
  i.KEEP,i.KEEP)}},THREE.ClearMaskPass=function(){this.enabled=!0},THREE.ClearMaskPass.prototype={render:function(e,t,n,r){var i=e.context;i.disable(i.STENCIL_TEST)}},THREE.ShaderPass=function(e,t){this.textureID=t!==undefined?t:"tDiffuse",this.uniforms=THREE.UniformsUtils.clone(e.uniforms),this.material=new THREE.ShaderMaterial({uniforms:this.uniforms,vertexShader:e.vertexShader,fragmentShader:e.fragmentShader}),this.renderToScreen=!1,this.enabled=!0,this.needsSwap=!0,this.clear=!1},THREE.ShaderPass.prototype={render:function(e,t,n,r){this.uniforms[this.textureID]&&(this.uniforms[this.textureID].value=n),THREE.EffectComposer.quad.material=this.material,this.renderToScreen?e.render(THREE.EffectComposer.scene,THREE.EffectComposer.camera):e.render(THREE.EffectComposer.scene,THREE.EffectComposer.camera,t,this.clear)}},THREE.RenderPass=function(e,t,n,r,i){this.scene=e,this.camera=t,this.overrideMaterial=n,this.clearColor=r,this.clearAlpha=i!==undefined?i:1,this.oldClearColor=new THREE.Color,this.oldClearAlpha=1,this
  .enabled=!0,this.clear=!0,this.needsSwap=!1},THREE.RenderPass.prototype={render:function(e,t,n,r){this.scene.overrideMaterial=this.overrideMaterial,this.clearColor&&(this.oldClearColor.copy(e.getClearColor()),this.oldClearAlpha=e.getClearAlpha(),e.setClearColor(this.clearColor,this.clearAlpha)),e.render(this.scene,this.camera,n,this.clear),this.clearColor&&e.setClearColor(this.oldClearColor,this.oldClearAlpha),this.scene.overrideMaterial=null}},THREE.BloomPass=function(e,t,n,r){e=e!==undefined?e:1,t=t!==undefined?t:25,n=n!==undefined?n:4,r=r!==undefined?r:256;var i={minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,format:THREE.RGBFormat};this.renderTargetX=new THREE.WebGLRenderTarget(r,r,i),this.renderTargetY=new THREE.WebGLRenderTarget(r,r,i);var s=THREE.ShaderExtras.screen;this.screenUniforms=THREE.UniformsUtils.clone(s.uniforms),this.screenUniforms.opacity.value=e,this.materialScreen=new THREE.ShaderMaterial({uniforms:this.screenUniforms,vertexShader:s.vertexShader,fragmentShader:s.fragmentShader,blending
  :THREE.AdditiveBlending,transparent:!0});var o=THREE.ShaderExtras.convolution;this.convolutionUniforms=THREE.UniformsUtils.clone(o.uniforms),this.convolutionUniforms.uImageIncrement.value=THREE.BloomPass.blurx,this.convolutionUniforms.cKernel.value=THREE.ShaderExtras.buildKernel(n),this.materialConvolution=new THREE.ShaderMaterial({uniforms:this.convolutionUniforms,vertexShader:"#define KERNEL_SIZE "+t+".0\n"+o.vertexShader,fragmentShader:"#define KERNEL_SIZE "+t+"\n"+o.fragmentShader}),this.enabled=!0,this.needsSwap=!1,this.clear=!1},THREE.BloomPass.prototype={render:function(e,t,n,r,i){i&&e.context.disable(e.context.STENCIL_TEST),THREE.EffectComposer.quad.material=this.materialConvolution,this.convolutionUniforms.tDiffuse.value=n,this.convolutionUniforms.uImageIncrement.value=THREE.BloomPass.blurX,e.render(THREE.EffectComposer.scene,THREE.EffectComposer.camera,this.renderTargetX,!0),this.convolutionUniforms.tDiffuse.value=this.renderTargetX,this.convolutionUniforms.uImageIncrement.value=THREE.BloomPass.blurY
  ,e.render(THREE.EffectComposer.scene,THREE.EffectComposer.camera,this.renderTargetY,!0),THREE.EffectComposer.quad.material=this.materialScreen,this.screenUniforms.tDiffuse.value=this.renderTargetY,i&&e.context.enable(e.context.STENCIL_TEST),e.render(THREE.EffectComposer.scene,THREE.EffectComposer.camera,n,this.clear)}},THREE.BloomPass.blurX=new THREE.Vector2(.001953125,0),THREE.BloomPass.blurY=new THREE.Vector2(0,.001953125),THREE.TexturePass=function(e,t){var n=THREE.ShaderExtras.screen;this.uniforms=THREE.UniformsUtils.clone(n.uniforms),this.uniforms.opacity.value=t!==undefined?t:1,this.uniforms.tDiffuse.value=e,this.material=new THREE.ShaderMaterial({uniforms:this.uniforms,vertexShader:n.vertexShader,fragmentShader:n.fragmentShader}),this.enabled=!0,this.needsSwap=!1},THREE.TexturePass.prototype={render:function(e,t,n,r){THREE.EffectComposer.quad.material=this.material,e.render(THREE.EffectComposer.scene,THREE.EffectComposer.camera,n)}},THREE.SavePass=function(e){var t=THREE.ShaderExtras.screen;this.textureID="tDiffuse"
  ,this.uniforms=THREE.UniformsUtils.clone(t.uniforms),this.material=new THREE.ShaderMaterial({uniforms:this.uniforms,vertexShader:t.vertexShader,fragmentShader:t.fragmentShader}),this.renderTarget=e,this.renderTarget===undefined&&(this.renderTargetParameters={minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,format:THREE.RGBFormat,stencilBuffer:!1},this.renderTarget=new THREE.WebGLRenderTarget(window.innerWidth,window.innerHeight,this.renderTargetParameters)),this.enabled=!0,this.needsSwap=!1,this.clear=!1},THREE.SavePass.prototype={render:function(e,t,n,r){this.uniforms[this.textureID]&&(this.uniforms[this.textureID].value=n),THREE.EffectComposer.quad.material=this.material,e.render(THREE.EffectComposer.scene,THREE.EffectComposer.camera,this.renderTarget,this.clear)}},THREE.FilmPass=function(e,t,n,r){var i=THREE.ShaderExtras.film;this.uniforms=THREE.UniformsUtils.clone(i.uniforms),this.material=new THREE.ShaderMaterial({uniforms:this.uniforms,vertexShader:i.vertexShader,fragmentShader:i.fragmentShader}
  ),r!==undefined&&(this.uniforms.grayscale.value=r),e!==undefined&&(this.uniforms.nIntensity.value=e),t!==undefined&&(this.uniforms.sIntensity.value=t),n!==undefined&&(this.uniforms.sCount.value=n),this.enabled=!0,this.renderToScreen=!1,this.needsSwap=!0},THREE.FilmPass.prototype={render:function(e,t,n,r){this.uniforms.tDiffuse.value=n,this.uniforms.time.value+=r,THREE.EffectComposer.quad.material=this.material,this.renderToScreen?e.render(THREE.EffectComposer.scene,THREE.EffectComposer.camera):e.render(THREE.EffectComposer.scene,THREE.EffectComposer.camera,t,!1)}},THREE.EffectComposer=function(e,t){this.renderer=e,this.renderTarget1=t;if(this.renderTarget1===undefined){var n=window.innerWidth||1,r=window.innerHeight||1;this.renderTargetParameters={minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,format:THREE.RGBFormat,stencilBuffer:!1},this.renderTarget1=new THREE.WebGLRenderTarget(n,r,this.renderTargetParameters)}this.renderTarget2=this.renderTarget1.clone(),this.writeBuffer=this.renderTarget1,this.readBuffer=
  this.renderTarget2,this.passes=[],this.copyPass=new THREE.ShaderPass(THREE.ShaderExtras.screen)},THREE.EffectComposer.prototype={swapBuffers:function(){var e=this.readBuffer;this.readBuffer=this.writeBuffer,this.writeBuffer=e},addPass:function(e){this.passes.push(e)},render:function(e){this.writeBuffer=this.renderTarget1,this.readBuffer=this.renderTarget2;var t=!1,n,r,i=this.passes.length;for(r=0;r<i;r++){n=this.passes[r];if(!n.enabled)continue;n.render(this.renderer,this.writeBuffer,this.readBuffer,e,t);if(n.needsSwap){if(t){var s=this.renderer.context;s.stencilFunc(s.NOTEQUAL,1,4294967295),this.copyPass.render(this.renderer,this.writeBuffer,this.readBuffer,e),s.stencilFunc(s.EQUAL,1,4294967295)}this.swapBuffers()}n instanceof THREE.MaskPass?t=!0:n instanceof THREE.ClearMaskPass&&(t=!1)}},reset:function(e){this.renderTarget1=e,this.renderTarget1===undefined&&(this.renderTarget1=new THREE.WebGLRenderTarget(window.innerWidth,window.innerHeight,this.renderTargetParameters)),this.renderTarget2=this.renderTarget1.
  clone(),this.writeBuffer=this.renderTarget1,this.readBuffer=this.renderTarget2}},THREE.EffectComposer.camera=new THREE.OrthographicCamera(-1,1,1,-1,0,1),THREE.EffectComposer.quad=new THREE.Mesh(new THREE.PlaneGeometry(2,2),null),THREE.EffectComposer.scene=new THREE.Scene,THREE.EffectComposer.scene.add(THREE.EffectComposer.quad);var Fireworks={EffectsStackBuilder:function(e){this._emitter=e}};Fireworks.EffectsStackBuilder.prototype.emitter=function(){return this._emitter},Fireworks.EffectsStackBuilder.prototype.back=function(){return this._emitter},Fireworks.EffectsStackBuilder.prototype.createEffect=function(e,t){var n=Fireworks.createEffect(e,t).pushTo(this._emitter).back(this);return n.effect().emitter(this._emitter),n},Fireworks.createEffect=function(e,t){"object"==typeof e&&(t=e,e=void 0);var n=new Fireworks.Effect;n.opts=t,n.name=e,n.back=null;var r={onCreate:function(e){return n.onCreate=e,r},onBirth:function(e){return n.onBirth=e,r},onUpdate:function(e){return n.onUpdate=e,r},onDeath:function(e){return n
  .onDeath=e,r},onPreUpdate:function(e){return n.onPreUpdate=e,r},onPreRender:function(e){return n.onPreRender=e,r},onRender:function(e){return n.onRender=e,r},onPostRender:function(e){return n.onPostRender=e,r},onIntensityChange:function(e){return n.onIntensityChange=e,r},pushTo:function(e){return e.effects().push(n),r},back:function(e){return e===void 0?n.back:(n.back=e,r)},effect:function(){return n}};return r},Fireworks.Effect=function(){this._emitter=null},Fireworks.Effect.prototype.destroy=function(){},Fireworks.Effect.prototype.emitter=function(e){return void 0===e?this._emitter:(this._emitter=e,this)},Fireworks.createEmitter=function(e){return new Fireworks.Emitter(e)},Fireworks.Emitter=function(e){this._nParticles=void 0!==e.nParticles?e.nParticles:100,this._particles=[],this._effects=[],this._started=!1,this._onUpdated=null,this._intensity=0,this._maxDeltaTime=1/3,this._effectsStackBuilder=new Fireworks.EffectsStackBuilder(this)},Fireworks.Emitter.prototype.destroy=function(){this._effects.forEach(function(
  e){e.destroy()}),this._particles.forEach(function(e){e.destroy()})},Fireworks.Emitter.prototype.effects=function(){return this._effects},Fireworks.Emitter.prototype.effect=function(e){for(var t=0;t<this._effects.length;t++){var n=this._effects[t];if(n.name===e)return n}return null},Fireworks.Emitter.prototype.particles=function(){return this._particles},Fireworks.Emitter.prototype.liveParticles=function(){return this._liveParticles},Fireworks.Emitter.prototype.deadParticles=function(){return this._deadParticles},Fireworks.Emitter.prototype.nParticles=function(){return this._nParticles},Fireworks.Emitter.prototype.effectsStackBuilder=function(){return this._effectsStackBuilder},Fireworks.Emitter.prototype.intensity=function(e){if(void 0===e)return this._intensity;if(e===this._intensity)return this;console.assert(0<=e,"Fireworks.Emitter.intensity: invalid value.",e),console.assert(1>=e,"Fireworks.Emitter.intensity: invalid value.",e);var t=this._intensity;return this._intensity=e,this._effects.forEach(function(e
  ){e.onIntensityChange&&e.onIntensityChange(this._intensity,t)}.bind(this)),this},Fireworks.Emitter.prototype.maxDeltaTime=function(e){return void 0===e?this._maxDeltaTime:(this._maxDeltaTime=e,this)},Fireworks.Emitter.prototype.setParticleData=function(e,t,n){e.set(t,n)},Fireworks.Emitter.prototype.getParticleData=function(e,t){return e.get(t)},Fireworks.Emitter.prototype.start=function(){console.assert(0<this._effects.length,"At least one effect MUST be set"),console.assert(!1===this._started),this._particles=Array(this._nParticles);for(var e=0;e<this._nParticles;e++)this._particles[e]=new Fireworks.Particle;return this._liveParticles=[],this._deadParticles=this._particles.slice(0),this._started=!0,this._effects.forEach(function(e){e.onCreate&&this._particles.forEach(function(t,n){e.onCreate(t,n)})}.bind(this)),this.intensity(1),this},Fireworks.Emitter.prototype.update=function(e){return e=Math.min(this._maxDeltaTime,e),this._effects.forEach(function(t){t.onPreUpdate&&t.onPreUpdate(e)}.bind(this)),this._effects
  .forEach(function(t){t.onUpdate&&this._liveParticles.forEach(function(n){t.onUpdate(n,e)})}.bind(this)),this},Fireworks.Emitter.prototype.render=function(){return this._effects.forEach(function(e){e.onPreRender&&e.onPreRender()}.bind(this)),this._effects.forEach(function(e){e.onRender&&this._liveParticles.forEach(function(t){e.onRender(t)})}.bind(this)),this._effects.forEach(function(e){e.onPostRender&&e.onPostRender()}.bind(this)),this},Fireworks.Emitter.prototype.killParticle=function(e){var t=this._liveParticles.indexOf(e);console.assert(-1!==t),this._liveParticles.splice(t,1),this._deadParticles.push(e),this.effects().forEach(function(t){t.onDeath&&t.onDeath(e)}.bind(this))},Fireworks.Emitter.prototype.spawnParticle=function(){console.assert(1<=this._deadParticles.length,"no more particle available");var e=this.deadParticles().pop();this.liveParticles().push(e),this.effects().forEach(function(t){t.onBirth&&t.onBirth(e)}.bind(this))},Fireworks.createLinearGradient=function(e){return new Fireworks.LinearGradient
  (e)},Fireworks.LinearGradient=function(){this._keyPoints=[]},Fireworks.LinearGradient.prototype.push=function(e,t){return this._keyPoints.push({x:e,y:t}),this},Fireworks.LinearGradient.prototype.get=function(e){for(var t=0;t<this._keyPoints.length&&!(e<=this._keyPoints[t].x);t++);if(0===t)return this._keyPoints[0].y;console.assert(t<this._keyPoints.length);var n=this._keyPoints[t-1],t=this._keyPoints[t];return n.y+(e-n.x)/(t.x-n.x)*(t.y-n.y)},Fireworks.Particle=function(){},Fireworks.Particle.prototype.set=function(e,t){return console.assert(void 0===this[e],"key already defined: "+e),this[e]=t,this[e]},Fireworks.Particle.prototype.get=function(e){return console.assert(void 0!==this[e],"key undefined: "+e),this[e]},Fireworks.Particle.prototype.has=function(e){return void 0!==this[e]?!0:!1},Fireworks.Shape=function(){},Fireworks.createVector=function(e,t,n){return new Fireworks.Vector(e,t,n)},Fireworks.Vector=function(e,t,n){this.x=e||0,this.y=t||0,this.z=n||0},Fireworks.Vector.prototype={constructor:Fireworks.
  Vector,set:function(e,t,n){return this.x=e,this.y=t,this.z=n,this},setX:function(e){return this.x=e,this},setY:function(e){return this.y=e,this},setZ:function(e){return this.z=e,this},random:function(){return this.x=Math.random()-.5,this.y=Math.random()-.5,this.z=Math.random()-.5,this},toString:function(){return JSON.stringify(this)},copy:function(e){return this.x=e.x,this.y=e.y,this.z=e.z,this},add:function(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this},addSelf:function(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this},addScalar:function(e){return this.x+=e,this.y+=e,this.z+=e,this},sub:function(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this},subSelf:function(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this},multiply:function(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this},multiplySelf:function(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this},multiplyScalar:function(e){return this.x*=e,this.y*=e,this.z*=e,this},divideSelf:function(e){return this.x/=e.x,this
  .y/=e.y,this.z/=e.z,this},divideScalar:function(e){return e?(this.x/=e,this.y/=e,this.z/=e):this.z=this.y=this.x=0,this},negate:function(){return this.multiplyScalar(-1)},dot:function(e){return this.x*e.x+this.y*e.y+this.z*e.z},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},length:function(){return Math.sqrt(this.lengthSq())},normalize:function(){return this.divideScalar(this.length())},setLength:function(e){return this.normalize().multiplyScalar(e)},cross:function(e,t){return this.x=e.y*t.z-e.z*t.y,this.y=e.z*t.x-e.x*t.z,this.z=e.x*t.y-e.y*t.x,this},crossSelf:function(e){var t=this.x,n=this.y,r=this.z;return this.x=n*e.z-r*e.y,this.y=r*e.x-t*e.z,this.z=t*e.y-n*e.x,this},distanceTo:function(e){return Math.sqrt(this.distanceToSquared(e))},distanceToSquared:function(e){return(new Fireworks.Vector).sub(this,e).lengthSq()},equals:function(e){return e.x===this.x&&e.y===this.y&&e.z===this.z},isZero:function(){return 1e-4>this.lengthSq()},clone:function(){return new Fireworks.Vector(this.x,this
  .y,this.z)}},Fireworks.EffectsStackBuilder.prototype.acceleration=function(e){var e=e||{},t=e.effectId||"acceleration";return console.assert(e.shape instanceof Fireworks.Shape),Fireworks.createEffect(t,{shape:e.shape}).onCreate(function(e){e.set("acceleration",{vector:new Fireworks.Vector})}).onBirth(function(e){e=e.get("acceleration").vector,this.opts.shape.randomPoint(e)}).onUpdate(function(e,t){var n=e.get("velocity").vector,r=e.get("acceleration").vector;n.x+=r.x*t,n.y+=r.y*t,n.z+=r.z*t}).pushTo(this._emitter),this},Fireworks.EffectsStackBuilder.prototype.friction=function(e){return e=void 0!==e?e:1,console.assert(0<=e&&1>=e),Fireworks.createEffect("friction").onCreate(function(t){t.set("friction",{value:e})}).onBirth(function(t){t.get("friction").value=e}).onUpdate(function(e){var t=e.get("friction").value;e.get("velocity").vector.multiplyScalar(t)}).pushTo(this._emitter),this},Fireworks.EffectsStackBuilder.prototype.lifeTime=function(e,t){console.assert(void 0!==e),void 0===t&&(t=e),console.assert(void 0!==
  t);var n=this._emitter;return Fireworks.createEffect("lifeTime",{minAge:e,maxAge:t}).onCreate(function(e){var t=e.set("lifeTime",{curAge:0,minAge:0,maxAge:0,normalizedAge:function(){return(t.curAge-t.minAge)/(t.maxAge-t.minAge)}})}).onBirth(function(e){e=e.get("lifeTime"),e.curAge=0,e.maxAge=this.opts.minAge+Math.random()*(this.opts.maxAge-this.opts.minAge)}).onUpdate(function(e,t){var r=e.get("lifeTime");r.curAge+=t,r.curAge>r.maxAge&&n.killParticle(e)}).pushTo(this._emitter),this},Fireworks.EffectsStackBuilder.prototype.position=function(e){return console.assert(e instanceof Fireworks.Shape),Fireworks.createEffect("position",{shape:e}).onCreate(function(e){e.set("position",{vector:new Fireworks.Vector})}).onBirth(function(e){e=e.get("position").vector,this.opts.shape.randomPoint(e)}).pushTo(this._emitter),this},Fireworks.EffectsStackBuilder.prototype.radialVelocity=function(e,t){return Fireworks.createEffect("radialVelocity",{minSpeed:e,maxSpeed:t}).onCreate(function(e){e.set("velocity",{vector:new Fireworks
  .Vector})}).onBirth(function(e){var t=e.get("position").vector,e=e.get("velocity").vector,n=this.opts.minSpeed+(this.opts.maxSpeed-this.opts.minSpeed)*Math.random();e.copy(t).setLength(n)}).onUpdate(function(e,t){var n=e.get("position").vector,r=e.get("velocity").vector;n.x+=r.x*t,n.y+=r.y*t,n.z+=r.z*t}).pushTo(this._emitter),this},Fireworks.EffectsStackBuilder.prototype.randomVelocityDrift=function(e){return Fireworks.createEffect("randomVelocityDrift",{drift:e}).onUpdate(function(e,t){var n=e.get("velocity").vector;n.x+=(2*Math.random()-1)*this.opts.drift.x*t,n.y+=(2*Math.random()-1)*this.opts.drift.y*t,n.z+=(2*Math.random()-1)*this.opts.drift.z*t}).pushTo(this._emitter),this},Fireworks.EffectsStackBuilder.prototype.velocity=function(e,t){return Fireworks.createEffect("velocity",{shape:e,speed:void 0!==t?t:-1}).onCreate(function(e){e.set("velocity",{vector:new Fireworks.Vector})}).onBirth(function(e){e=e.get("velocity").vector,this.opts.shape.randomPoint(e),-1!==this.opts.speed&&e.setLength(this.opts.speed)}
  ).onUpdate(function(e,t){var n=e.get("position").vector,r=e.get("velocity").vector;n.x+=r.x*t,n.y+=r.y*t,n.z+=r.z*t}).pushTo(this._emitter),this},Fireworks.createShapeBox=function(e,t,n,r,i,s){return e=new Fireworks.Vector(e,t,n),r=new Fireworks.Vector(r,i,s),new Fireworks.Shape.Box(e,r)},Fireworks.Shape.Box=function(e,t){this.center=e,this.size=t,this._vector=new Fireworks.Vector},Fireworks.Shape.Box.prototype=new Fireworks.Shape,Fireworks.Shape.Box.prototype.constructor=Fireworks.Shape.Box,Fireworks.Shape.Box.prototype.contains=function(e){return e=this._vector.sub(e,this.center),Math.abs(e.x)>this.size.x/2||Math.abs(e.y)>this.size.y/2||Math.abs(e.z)>this.size.z/2?!1:!0},Fireworks.Shape.Box.prototype.randomPoint=function(e){return e=e||this._vector,e.x=Math.random()*this.size.x-this.size.x/2,e.y=Math.random()*this.size.y-this.size.y/2,e.z=Math.random()*this.size.z-this.size.z/2,e.addSelf(this.center),e},Fireworks.createShapePoint=function(e,t,n){return e=new Fireworks.Vector(e,t,n),new Fireworks.Shape.Point(
  e)},Fireworks.Shape.Point=function(e){this.position=e,this._vector=new Fireworks.Vector},Fireworks.Shape.Point.prototype=new Fireworks.Shape,Fireworks.Shape.Point.prototype.constructor=Fireworks.Shape.Point,Fireworks.Shape.Point.prototype.contains=function(e){return e.x!==this.position.x||e.y!==this.position.y||e.z!==this.position.z?!1:!0},Fireworks.Shape.Point.prototype.randomPoint=function(e){return e=e||this._vector,e.copy(this.position),e},Fireworks.createShapeSphere=function(e,t,n,r){return e=new Fireworks.Vector(e,t,n),new Fireworks.ShapeSphere(e,r)},Fireworks.ShapeSphere=function(e,t){this.center=e,this.radius=t,this._vector=new Fireworks.Vector},Fireworks.ShapeSphere.prototype=new Fireworks.Shape,Fireworks.ShapeSphere.prototype.constructor=Fireworks.ShapeSphere,Fireworks.ShapeSphere.prototype.contains=function(e){return this._vector.sub(e,this.center).length()<=this.radius},Fireworks.ShapeSphere.prototype.randomPoint=function(e){e=e||this._vector,e.x=Math.random()-.5,e.y=Math.random()-.5,e.z=Math.random
  ()-.5;var t=Math.random()*this.radius;return e.setLength(t),e.addSelf(this.center),e},Fireworks.EffectsStackBuilder.prototype.spawnerOneShot=function(e){var e=e||this.emitter().nParticles(),t=this.emitter(),n=0,r=!0;return Fireworks.createEffect("spawner",{start:function(){r=!0},stop:function(){r=!1}}).onPreUpdate(function(){if(!1!==r&&e!==n){for(var i=e-n,i=Math.min(i,t.deadParticles().length),s=0;s<i;s++)t.spawnParticle();n+=i}}).pushTo(this._emitter),this},Fireworks.EffectsStackBuilder.prototype.spawnerSteadyRate=function(e){var e=void 0!==e?e:1,t=this.emitter(),n=1,r=!0;return Fireworks.createEffect("spawner",{rate:e,start:function(){r=!0},stop:function(){r=!1}}).onPreUpdate(function(e){var i=this.opts.rate;if(!1!==r){n+=i*e,e=Math.floor(n),e=Math.min(e,t.deadParticles().length),n-=e;for(i=0;i<e;i++)t.spawnParticle()}}).pushTo(this._emitter),this},Fireworks.EffectsStackBuilder.prototype.renderToCanvas=function(e){var e=e||{},t;(t=e.ctx)||(t=document.createElement("canvas"),t.width=window.innerWidth,t.height=
  window.innerHeight,document.body.appendChild(t),t.style.position="absolute",t.style.left=0,t.style.top=0,t=t.getContext("2d"));var n=t;t=Fireworks.createEffect("renderToCanvas",{ctx:n}).pushTo(this._emitter);if("arc"===e.type)t.onCreate(function(e){e.set("renderToCanvas",{size:3})}).onRender(function(e){var t=e.get("position").vector,e=e.get("renderToCanvas").size;n.beginPath(),n.arc(t.x+canvas.width/2,t.y+canvas.height/2,e,0,2*Math.PI,!0),n.fill()});else if("drawImage"===e.type){if("string"==typeof e.image){var r=[new Image];r[0].src=e.image}else e.image instanceof Image?r=[e.image]:e.image instanceof Array?r=e.image:console.assert(!1,"invalid .renderToCanvas() options");t.onCreate(function(e){e.set("renderToCanvas",{scale:1,opacity:1,rotation:0*Math.PI})}).onRender(function(e){var t=e.get("position").vector,i=e.get("renderToCanvas"),e=e.get("lifeTime").normalizedAge(),e=r[Math.floor(e*r.length)];n.save(),n.translate(t.x+canvas.width/2,t.y+canvas.height/2),n.scale(i.scale,i.scale),n.rotate(i.rotation),n.globalAlpha=
  i.opacity,e instanceof Image?n.drawImage(e,-e.width/2,-e.height/2):"object"==typeof e?n.drawImage(e.image,e.offsetX,e.offsetY,e.width,e.height,-e.width/2,-e.height/2,e.width,e.height):console.assert(!1),n.restore()})}else console.assert(!1,"renderToCanvas opts.type is invalid: ");return this},Fireworks.EffectsStackBuilder.prototype.renderToThreejsObject3D=function(e){var t=e.container;return Fireworks.createEffect(e.effectId||"renderToThreeParticleSystem").onCreate(function(t){t.set("threejsObject3D",{object3d:e.create()}),console.assert(t.get("threejsObject3D").object3d instanceof THREE.Object3D),t.get("threejsObject3D")}).onBirth(function(e){e=e.get("threejsObject3D").object3d,t.add(e)}).onDeath(function(e){e=e.get("threejsObject3D").object3d,t.remove(e)}).onRender(function(e){var t=e.get("threejsObject3D").object3d,e=e.get("position").vector;t.position.set(e.x,e.y,e.z)}).pushTo(this._emitter),this},Fireworks.EffectsStackBuilder.prototype.renderToThreejsParticleSystem=function(e){function t(e){for(var t=new 
  THREE.Geometry,n=0;n<e.nParticles();n++)t.vertices.push(new THREE.Vector3);var e=THREE.ParticleBasicMaterial,n=128,r=document.createElement("canvas"),i=r.getContext("2d");r.width=r.height=n;var s=i.createRadialGradient(r.width/2,r.height/2,0,r.width/2,r.height/2,r.width/2);return s.addColorStop(0,"rgba(255,255,255,1)"),s.addColorStop(.5,"rgba(255,255,255,1)"),s.addColorStop(.7,"rgba(128,128,128,1)"),s.addColorStop(1,"rgba(0,0,0,1)"),i.beginPath(),i.arc(n/2,n/2,n/2,0,2*Math.PI,!1),i.closePath(),i.fillStyle=s,i.fill(),n=new THREE.Texture(r),n.needsUpdate=!0,e=new e({size:5,sizeAttenuation:!0,color:14687082,map:n,blending:THREE.AdditiveBlending,depthWrite:!1,transparent:!0}),t=new THREE.ParticleSystem(t,e),t.dynamic=!0,t.sortParticles=!0,t}var e=e||{},n=e.effectId||"renderToThreejsParticleSystem",e=e.particleSystem||t;"function"==typeof e&&(e=e(this._emitter)),console.assert(e instanceof THREE.ParticleSystem,"particleSystem MUST be THREE.ParticleSystem");var r=e.geometry;return console.assert(r.vertices.length>=this
  ._emitter.nParticles()),Fireworks.createEffect(n,{particleSystem:e}).onCreate(function(e,t){e.set("threejsParticle",{particleIdx:t}),r.vertices[t].set(Infinity,Infinity,Infinity)}).onDeath(function(e){e=e.get("threejsParticle").particleIdx,r.vertices[e].set(Infinity,Infinity,Infinity)}).onRender(function(e){var t=e.get("threejsParticle").particleIdx,t=r.vertices[t],e=e.get("position").vector;t.set(e.x,e.y,e.z)}).pushTo(this._emitter),this},Fireworks.Emitter.prototype.bindTriggerDomEvents=function(e){return new Fireworks.BindTriggerDomEvents(this,e),this},Fireworks.BindTriggerDomEvents=function(e,t){this._domElement=t||document.body,this._onMouseDown=function(){e.effect("spawner").opts.start()},this._onMouseUp=function(){e.effect("spawner").opts.stop()},this._domElement.addEventListener("mousedown",this._onMouseDown),this._domElement.addEventListener("mouseup",this._onMouseUp),this._onMouseWheel=function(t){var n=e.intensity(),n=n+(0>t.wheelDelta?-0.05:.05),n=Math.max(n,0),n=Math.min(n,1);e.intensity(n)},this._domElement
  .addEventListener("mousewheel",this._onMouseWheel)},Fireworks.BindTriggerDomEvents.prototype.destroy=function(){this._domElement.removeEventListener("mousedown",this._onMouseDown),this._domElement.removeEventListener("mouseup",this._onMouseUp),this._domElement.removeEventListener("mousewheel",this._onMouseWheel)},Fireworks.DatGui4Emitter=function(e){var t=new dat.GUI;return e.effects().forEach(function(e,n){var r=e.name||"effect-"+n,i=e.opts||{},s=Object.keys(i).filter(function(e){return i[e]instanceof Fireworks.Vector?!0:"object"==typeof i[e]?!1:!0});if(s.length){var o=t.addFolder("Effect: "+r);s.forEach(function(e){i[e]instanceof Fireworks.Vector?(o.add(i[e],"x").name(e+"X"),o.add(i[e],"y").name(e+"Y"),o.add(i[e],"z").name(e+"Z")):o.add(i,e)})}}),t},Fireworks.ProceduralTextures={},Fireworks.ProceduralTextures.buildTexture=function(e){var e=e||150,t=document.createElement("canvas"),n=t.getContext("2d");t.width=t.height=e;var r=n.createRadialGradient(t.width/2,t.height/2,0,t.width/2,t.height/2,t.width/2);return r
  .addColorStop(0,"rgba(255,255,255,1)"),r.addColorStop(.5,"rgba(255,255,255,1)"),r.addColorStop(.7,"rgba(128,128,128,1)"),r.addColorStop(1,"rgba(0,0,0,1)"),n.beginPath(),n.arc(e/2,e/2,e/2,0,2*Math.PI,!1),n.closePath(),n.fillStyle=r,n.fill(),e=new THREE.Texture(t),e.needsUpdate=!0,e};var PF=function(){var e=function(t,n){var r=e.resolve(t,n||"/"),i=e.modules[r];if(!i)throw new Error("Failed to resolve module "+t+", tried "+r);var s=i._cached?i._cached:i();return s};return e.paths=[],e.modules={},e.extensions=[".js",".coffee"],e._core={assert:!0,events:!0,fs:!0,path:!0,vm:!0},e.resolve=function(){return function(t,n){function r(t){if(e.modules[t])return t;for(var n=0;n<e.extensions.length;n++){var r=e.extensions[n];if(e.modules[t+r])return t+r}}function i(t){t=t.replace(/\/+$/,"");var n=t+"/package.json";if(e.modules[n]){var i=e.modules[n](),s=i.browserify;if(typeof s=="object"&&s.main){var o=r(u.resolve(t,s.main));if(o)return o}else if(typeof s=="string"){var o=r(u.resolve(t,s));if(o)return o}else if(i.main){var o=
  r(u.resolve(t,i.main));if(o)return o}}return r(t+"/index")}function s(e,t){var n=o(t);for(var s=0;s<n.length;s++){var u=n[s],a=r(u+"/"+e);if(a)return a;var f=i(u+"/"+e);if(f)return f}var a=r(e);if(a)return a}function o(e){var t;e==="/"?t=[""]:t=u.normalize(e).split("/");var n=[];for(var r=t.length-1;r>=0;r--){if(t[r]==="node_modules")continue;var i=t.slice(0,r+1).join("/")+"/node_modules";n.push(i)}return n}n||(n="/");if(e._core[t])return t;var u=e.modules.path();n=u.resolve("/",n);var a=n||"/";if(t.match(/^(?:\.\.?\/|\/)/)){var f=r(u.resolve(a,t))||i(u.resolve(a,t));if(f)return f}var l=s(t,a);if(l)return l;throw new Error("Cannot find module '"+t+"'")}}(),e.alias=function(t,n){var r=e.modules.path(),i=null;try{i=e.resolve(t+"/package.json","/")}catch(s){i=e.resolve(t,"/")}var o=r.dirname(i),u=(Object.keys||function(e){var t=[];for(var n in e)t.push(n);return t})(e.modules);for(var a=0;a<u.length;a++){var f=u[a];if(f.slice(0,o.length+1)===o+"/"){var l=f.slice(o.length);e.modules[n+l]=e.modules[o+l]}else f===o&&
  (e.modules[n]=e.modules[o])}},e.define=function(t,n){var r=e._core[t]?"":e.modules.path().dirname(t),i=function(t){return e(t,r)};i.resolve=function(t){return e.resolve(t,r)},i.modules=e.modules,i.define=e.define;var s={exports:{}};e.modules[t]=function(){return e.modules[t]._cached=s.exports,n.call(s.exports,i,s,s.exports,r,t),e.modules[t]._cached=s.exports,s.exports}},typeof process=="undefined"&&(process={}),process.nextTick||(process.nextTick=function(){var e=[],t=typeof window!="undefined"&&window.postMessage&&window.addEventListener;return t&&window.addEventListener("message",function(t){if(t.source===window&&t.data==="browserify-tick"){t.stopPropagation();if(e.length>0){var n=e.shift();n()}}},!0),function(n){t?(e.push(n),window.postMessage("browserify-tick","*")):setTimeout(n,0)}}()),process.title||(process.title="browser"),process.binding||(process.binding=function(t){if(t==="evals")return e("vm");throw new Error("No such module")}),process.cwd||(process.cwd=function(){return"."}),process.env||(process
  .env={}),process.argv||(process.argv=[]),e.define("path",function(e,t,n,r,i){function s(e,t){var n=[];for(var r=0;r<e.length;r++)t(e[r],r,e)&&n.push(e[r]);return n}function o(e,t){var n=0;for(var r=e.length;r>=0;r--){var i=e[r];i=="."?e.splice(r,1):i===".."?(e.splice(r,1),n++):n&&(e.splice(r,1),n--)}if(t)for(;n--;n)e.unshift("..");return e}var u=/^(.+\/(?!$)|\/)?((?:.+?)?(\.[^.]*)?)$/;n.resolve=function(){var e="",t=!1;for(var n=arguments.length;n>=-1&&!t;n--){var r=n>=0?arguments[n]:process.cwd();if(typeof r!="string"||!r)continue;e=r+"/"+e,t=r.charAt(0)==="/"}return e=o(s(e.split("/"),function(e){return!!e}),!t).join("/"),(t?"/":"")+e||"."},n.normalize=function(e){var t=e.charAt(0)==="/",n=e.slice(-1)==="/";return e=o(s(e.split("/"),function(e){return!!e}),!t).join("/"),!e&&!t&&(e="."),e&&n&&(e+="/"),(t?"/":"")+e},n.join=function(){var e=Array.prototype.slice.call(arguments,0);return n.normalize(s(e,function(e,t){return e&&typeof e=="string"}).join("/"))},n.dirname=function(e){var t=u.exec(e)[1]||"",n=!1;return t?
  t.length===1||n&&t.length<=3&&t.charAt(1)===":"?t:t.substring(0,t.length-1):"."},n.basename=function(e,t){var n=u.exec(e)[2]||"";return t&&n.substr(-1*t.length)===t&&(n=n.substr(0,n.length-t.length)),n},n.extname=function(e){return u.exec(e)[3]||""}}),e.define("/core/Node.js",function(e,t,n,r,i){function s(e,t,n){this.x=e,this.y=t,this.walkable=n===undefined?!0:n}t.exports=s}),e.define("/core/Grid.js",function(e,t,n,r,i){function s(e,t,n){this.width=e,this.height=t,this.nodes=this._buildNodes(e,t,n)}var o=e("./Node");s.prototype._buildNodes=function(e,t,n){var r,i,s=new Array(t),u;for(r=0;r<t;++r){s[r]=new Array(e);for(i=0;i<e;++i)s[r][i]=new o(i,r)}if(n===undefined)return s;if(n.length!==t||n[0].length!==e)throw new Error("Matrix size does not fit");for(r=0;r<t;++r)for(i=0;i<e;++i)n[r][i]&&(s[r][i].walkable=!1);return s},s.prototype.getNodeAt=function(e,t){return this.nodes[t][e]},s.prototype.isWalkableAt=function(e,t){return this.isInside(e,t)&&this.nodes[t][e].walkable},s.prototype.isInside=function(e,t){return e>=0&&
  e<this.width&&t>=0&&t<this.height},s.prototype.setWalkableAt=function(e,t,n){this.nodes[t][e].walkable=n},s.prototype.getNeighbors=function(e,t,n){var r=e.x,i=e.y,s=[],o=!1,u=!1,a=!1,f=!1,l=!1,c=!1,h=!1,p=!1,d=this.nodes;return this.isWalkableAt(r,i-1)&&(s.push(d[i-1][r]),o=!0),this.isWalkableAt(r+1,i)&&(s.push(d[i][r+1]),a=!0),this.isWalkableAt(r,i+1)&&(s.push(d[i+1][r]),l=!0),this.isWalkableAt(r-1,i)&&(s.push(d[i][r-1]),h=!0),t?(n?(u=h&&o,f=o&&a,c=a&&l,p=l&&h):(u=h||o,f=o||a,c=a||l,p=l||h),u&&this.isWalkableAt(r-1,i-1)&&s.push(d[i-1][r-1]),f&&this.isWalkableAt(r+1,i-1)&&s.push(d[i-1][r+1]),c&&this.isWalkableAt(r+1,i+1)&&s.push(d[i+1][r+1]),p&&this.isWalkableAt(r-1,i+1)&&s.push(d[i+1][r-1]),s):s},s.prototype.clone=function(){var e,t,n=this.width,r=this.height,i=this.nodes,u=new s(n,r),a=new Array(r),f;for(e=0;e<r;++e){a[e]=new Array(n);for(t=0;t<n;++t)a[e][t]=new o(t,e,i[e][t].walkable)}return u.nodes=a,u},t.exports=s}),e.define("/core/Heap.js",function(e,t,n,r,i){(function(){var e,n,r,i,s,o,u,a,f,l,c,h,p,d,v
  ;r=Math.floor,l=Math.min,n=function(e,t){return e<t?-1:e>t?1:0},f=function(e,t,i,s,o){var u;i==null&&(i=0),o==null&&(o=n);if(i<0)throw new Error("lo must be non-negative");s==null&&(s=e.length);while(o(i,s)<0)u=r((i+s)/2),o(t,e[u])<0?s=u:i=u+1;return[].splice.apply(e,[i,i-i].concat(t)),t},o=function(e,t,r){return r==null&&(r=n),e.push(t),d(e,0,e.length-1,r)},s=function(e,t){var r,i;return t==null&&(t=n),r=e.pop(),e.length?(i=e[0],e[0]=r,v(e,0,t)):i=r,i},a=function(e,t,r){var i;return r==null&&(r=n),i=e[0],e[0]=t,v(e,0,r),i},u=function(e,t,r){var i;return r==null&&(r=n),e.length&&r(e[0],t)<0&&(i=[e[0],t],t=i[0],e[0]=i[1],v(e,0,r)),t},i=function(e,t){var i,s,o,u,a,f,l,c;t==null&&(t=n),f=function(){c=[];for(var t=0,n=r(e.length/2);0<=n?t<n:t>n;0<=n?t++:t--)c.push(t);return c}.apply(this).reverse(),l=[];for(s=0,u=f.length;s<u;s++)i=f[s],l.push(v(e,i,t));return l},p=function(e,t,r){var i;return r==null&&(r=n),i=e.indexOf(t),d(e,0,i,r),v(e,i,r)},c=function(e,t,r){var s,o,a,f,l;r==null&&(r=n),o=e.slice(0,t);if(!o.length
  )return o;i(o,r),l=e.slice(t);for(a=0,f=l.length;a<f;a++)s=l[a],u(o,s,r);return o.sort(r).reverse()},h=function(e,t,r){var o,u,a,c,h,p,d,v,m,g;r==null&&(r=n);if(t*10<=e.length){c=e.slice(0,t).sort(r);if(!c.length)return c;a=c[c.length-1],v=e.slice(t);for(h=0,d=v.length;h<d;h++)o=v[h],r(o,a)<0&&(f(c,o,0,null,r),c.pop(),a=c[c.length-1]);return c}i(e,r),g=[];for(u=p=0,m=l(t,e.length);0<=m?p<m:p>m;u=0<=m?++p:--p)g.push(s(e,r));return g},d=function(e,t,r,i){var s,o,u;i==null&&(i=n),s=e[r];while(r>t){u=r-1>>1,o=e[u];if(i(s,o)<0){e[r]=o,r=u;continue}break}return e[r]=s},v=function(e,t,r){var i,s,o,u,a;r==null&&(r=n),s=e.length,a=t,o=e[t],i=2*t+1;while(i<s)u=i+1,u<s&&!(r(e[i],e[u])<0)&&(i=u),e[t]=e[i],t=i,i=2*t+1;return e[t]=o,d(e,a,t,r)},e=function(){function e(e){this.cmp=e!=null?e:n,this.nodes=[]}return e.name="Heap",e.push=o,e.pop=s,e.replace=a,e.pushpop=u,e.heapify=i,e.nlargest=c,e.nsmallest=h,e.prototype.push=function(e){return o(this.nodes,e,this.cmp)},e.prototype.pop=function(){return s(this.nodes,this.cmp)},e
  .prototype.peek=function(){return this.nodes[0]},e.prototype.contains=function(e){return this.nodes.indexOf(e)!==-1},e.prototype.replace=function(e){return a(this.nodes,e,this.cmp)},e.prototype.pushpop=function(e){return u(this.nodes,e,this.cmp)},e.prototype.heapify=function(){return i(this.nodes,this.cmp)},e.prototype.updateItem=function(e){return p(this.nodes,e,this.cmp)},e.prototype.clear=function(){return this.nodes=[]},e.prototype.empty=function(){return this.nodes.length===0},e.prototype.size=function(){return this.nodes.length},e.prototype.clone=function(){var t;return t=new e,t.nodes=this.nodes.slice(0),t},e.prototype.toArray=function(){return this.nodes.slice(0)},e.prototype.insert=e.prototype.push,e.prototype.remove=e.prototype.pop,e.prototype.top=e.prototype.peek,e.prototype.front=e.prototype.peek,e.prototype.has=e.prototype.contains,e.prototype.copy=e.prototype.clone,e}(),(typeof t!="undefined"&&t!==null?t.exports:void 0)?t.exports=e:window.Heap=e}).call(this)}),e.define("/core/Util.js",function(e,
  t,n,r,i){function s(e){var t=[[e.x,e.y]];while(e.parent)e=e.parent,t.push([e.x,e.y]);return t.reverse()}function o(e,t){var n=s(e),r=s(t);return n.concat(r.reverse())}function u(e){var t,n=0,r,i,s,o;for(t=1;t<e.length;++t)r=e[t-1],i=e[t],s=r[0]-i[0],o=r[1]-i[1],n+=Math.sqrt(s*s+o*o);return n}function a(e,t,n,r){var i=Math.abs,s=[],o,u,a,f,l,c;a=i(n-e),f=i(r-t),o=e<n?1:-1,u=t<r?1:-1,l=a-f;for(;;){s.push([e,t]);if(e===n&&t===r)break;c=2*l,c>-f&&(l-=f,e+=o),c<a&&(l+=a,t+=u)}return s}function f(e,t){var n=t.length,r=t[0][0],i=t[0][1],s=t[n-1][0],o=t[n-1][1],u,f,l,c,h,p,d,v,m,g,y,b,w;u=r,f=i,h=t[1][0],p=t[1][1],d=[[u,f]];for(v=2;v<n;++v){g=t[v],l=g[0],c=g[1],y=a(u,f,l,c),w=!1;for(m=1;m<y.length;++m){b=y[m];if(!e.isWalkableAt(b[0],b[1])){w=!0,d.push([h,p]),u=h,f=p;break}}w||(h=l,p=c)}return d.push([s,o]),d}n.backtrace=s,n.biBacktrace=o,n.pathLength=u,n.getLine=a,n.smoothenPath=f}),e.define("/core/Heuristic.js",function(e,t,n,r,i){t.exports={manhattan:function(e,t){return e+t},euclidean:function(e,t){return Math.sqrt
  (e*e+t*t)},chebyshev:function(e,t){return Math.max(e,t)}}}),e.define("/finders/AStarFinder.js",function(e,t,n,r,i){function s(e){e=e||{},this.allowDiagonal=e.allowDiagonal,this.dontCrossCorners=e.dontCrossCorners,this.heuristic=e.heuristic||a.manhattan}var o=e("../core/Heap"),u=e("../core/Util"),a=e("../core/Heuristic");s.prototype.findPath=function(e,t,n,r,i){var s=new o(function(e,t){return e.f-t.f}),a=i.getNodeAt(e,t),f=i.getNodeAt(n,r),l=this.heuristic,c=this.allowDiagonal,h=this.dontCrossCorners,p=Math.abs,d=Math.SQRT2,v,m,g,y,b,w,E,S;a.g=0,a.f=0,s.push(a),a.opened=!0;while(!s.empty()){v=s.pop(),v.closed=!0;if(v===f)return u.backtrace(f);m=i.getNeighbors(v,c,h);for(y=0,b=m.length;y<b;++y){g=m[y];if(g.closed)continue;w=g.x,E=g.y,S=v.g+(w-v.x===0||E-v.y===0?1:d);if(!g.opened||S<g.g)g.g=S,g.h=g.h||l(p(w-n),p(E-r)),g.f=g.g+g.h,g.parent=v,g.opened?s.updateItem(g):(s.push(g),g.opened=!0)}}return[]},t.exports=s}),e.define("/finders/BestFirstFinder.js",function(e,t,n,r,i){function s(e){o.call(this,e);var t=this.heuristic
  ;this.heuristic=function(e,n){return t(e,n)*1e6}}var o=e("./AStarFinder");s.prototype=new o,s.prototype.constructor=s,t.exports=s}),e.define("/finders/BreadthFirstFinder.js",function(e,t,n,r,i){function s(e){e=e||{},this.allowDiagonal=e.allowDiagonal,this.dontCrossCorners=e.dontCrossCorners}var o=e("../core/Util");s.prototype.findPath=function(e,t,n,r,i){var s=[],u=this.allowDiagonal,a=this.dontCrossCorners,f=i.getNodeAt(e,t),l=i.getNodeAt(n,r),c,h,p,d,v;s.push(f),f.opened=!0;while(s.length){p=s.shift(),p.closed=!0;if(p===l)return o.backtrace(l);c=i.getNeighbors(p,u,a);for(d=0,v=c.length;d<v;++d){h=c[d];if(h.closed||h.opened)continue;s.push(h),h.opened=!0,h.parent=p}}return[]},t.exports=s}),e.define("/finders/DijkstraFinder.js",function(e,t,n,r,i){function s(e){o.call(this,e),this.heuristic=function(e,t){return 0}}var o=e("./AStarFinder");s.prototype=new o,s.prototype.constructor=s,t.exports=s}),e.define("/finders/BiAStarFinder.js",function(e,t,n,r,i){function s(e){e=e||{},this.allowDiagonal=e.allowDiagonal,this
  .dontCrossCorners=e.dontCrossCorners,this.heuristic=e.heuristic||a.manhattan}var o=e("../core/Heap"),u=e("../core/Util"),a=e("../core/Heuristic");s.prototype.findPath=function(e,t,n,r,i){var s=function(e,t){return e.f-t.f},a=new o(s),f=new o(s),l=i.getNodeAt(e,t),c=i.getNodeAt(n,r),h=this.heuristic,p=this.allowDiagonal,d=this.dontCrossCorners,v=Math.abs,m=Math.SQRT2,g,y,b,w,E,S,x,T,N=1,C=2;l.g=0,l.f=0,a.push(l),l.opened=N,c.g=0,c.f=0,f.push(c),c.opened=C;while(!a.empty()&&!f.empty()){g=a.pop(),g.closed=!0,y=i.getNeighbors(g,p,d);for(w=0,E=y.length;w<E;++w){b=y[w];if(b.closed)continue;if(b.opened===C)return u.biBacktrace(g,b);S=b.x,x=b.y,T=g.g+(S-g.x===0||x-g.y===0?1:m);if(!b.opened||T<b.g)b.g=T,b.h=b.h||h(v(S-n),v(x-r)),b.f=b.g+b.h,b.parent=g,b.opened?a.updateItem(b):(a.push(b),b.opened=N)}g=f.pop(),g.closed=!0,y=i.getNeighbors(g,p,d);for(w=0,E=y.length;w<E;++w){b=y[w];if(b.closed)continue;if(b.opened===N)return u.biBacktrace(b,g);S=b.x,x=b.y,T=g.g+(S-g.x===0||x-g.y===0?1:m);if(!b.opened||T<b.g)b.g=T,b.h=b.h||
  h(v(S-e),v(x-t)),b.f=b.g+b.h,b.parent=g,b.opened?f.updateItem(b):(f.push(b),b.opened=C)}}return[]},t.exports=s}),e.define("/finders/BiBestFirstFinder.js",function(e,t,n,r,i){function s(e){o.call(this,e);var t=this.heuristic;this.heuristic=function(e,n){return t(e,n)*1e6}}var o=e("./BiAStarFinder");s.prototype=new o,s.prototype.constructor=s,t.exports=s}),e.define("/finders/BiBreadthFirstFinder.js",function(e,t,n,r,i){function s(e){e=e||{},this.allowDiagonal=e.allowDiagonal,this.dontCrossCorners=e.dontCrossCorners}var o=e("../core/Util");s.prototype.findPath=function(e,t,n,r,i){var s=i.getNodeAt(e,t),u=i.getNodeAt(n,r),a=[],f=[],l,c,h,p=this.allowDiagonal,d=this.dontCrossCorners,v=0,m=1,g,y;a.push(s),s.opened=!0,s.by=v,f.push(u),u.opened=!0,u.by=m;while(a.length&&f.length){h=a.shift(),h.closed=!0,l=i.getNeighbors(h,p,d);for(g=0,y=l.length;g<y;++g){c=l[g];if(c.closed)continue;if(c.opened){if(c.by===m)return o.biBacktrace(h,c);continue}a.push(c),c.parent=h,c.opened=!0,c.by=v}h=f.shift(),h.closed=!0,l=i.getNeighbors
  (h,p,d);for(g=0,y=l.length;g<y;++g){c=l[g];if(c.closed)continue;if(c.opened){if(c.by===v)return o.biBacktrace(c,h);continue}f.push(c),c.parent=h,c.opened=!0,c.by=m}}return[]},t.exports=s}),e.define("/finders/BiDijkstraFinder.js",function(e,t,n,r,i){function s(e){o.call(this,e),this.heuristic=function(e,t){return 0}}var o=e("./BiAStarFinder");s.prototype=new o,s.prototype.constructor=s,t.exports=s}),e.define("/finders/JumpPointFinder.js",function(e,t,n,r,i){function s(e){e=e||{},this.heuristic=e.heuristic||a.manhattan}var o=e("../core/Heap"),u=e("../core/Util"),a=e("../core/Heuristic");s.prototype.findPath=function(e,t,n,r,i){var s=this.openList=new o(function(e,t){return e.f-t.f}),a=this.startNode=i.getNodeAt(e,t),f=this.endNode=i.getNodeAt(n,r),l;this.grid=i,a.g=0,a.f=0,s.push(a),a.opened=!0;while(!s.empty()){l=s.pop(),l.closed=!0;if(l===f)return u.backtrace(f);this._identifySuccessors(l)}return[]},s.prototype._identifySuccessors=function(e){var t=this.grid,n=this.heuristic,r=this.openList,i=this.endNode.x,s=
  this.endNode.y,o,u,f,l,c,h=e.x,p=e.y,d,v,m,g,y,b,w,E=Math.abs,S=Math.max;o=this._findNeighbors(e);for(l=0,c=o.length;l<c;++l){u=o[l],f=this._jump(u[0],u[1],h,p);if(f){d=f[0],v=f[1],w=t.getNodeAt(d,v);if(w.closed)continue;y=a.euclidean(E(d-h),E(v-p)),b=e.g+y;if(!w.opened||b<w.g)w.g=b,w.h=w.h||n(E(d-i),E(v-s)),w.f=w.g+w.h,w.parent=e,w.opened?r.updateItem(w):(r.push(w),w.opened=!0)}}},s.prototype._jump=function(e,t,n,r){var i=this.grid,s=e-n,o=t-r,u,a;if(!i.isWalkableAt(e,t))return null;if(i.getNodeAt(e,t)===this.endNode)return[e,t];if(s!==0&&o!==0){if(i.isWalkableAt(e-s,t+o)&&!i.isWalkableAt(e-s,t)||i.isWalkableAt(e+s,t-o)&&!i.isWalkableAt(e,t-o))return[e,t]}else if(s!==0){if(i.isWalkableAt(e+s,t+1)&&!i.isWalkableAt(e,t+1)||i.isWalkableAt(e+s,t-1)&&!i.isWalkableAt(e,t-1))return[e,t]}else if(i.isWalkableAt(e+1,t+o)&&!i.isWalkableAt(e+1,t)||i.isWalkableAt(e-1,t+o)&&!i.isWalkableAt(e-1,t))return[e,t];if(s!==0&&o!==0){u=this._jump(e+s,t,e,t),a=this._jump(e,t+o,e,t);if(u||a)return[e,t]}return i.isWalkableAt(e+s,t)||i
  .isWalkableAt(e,t+o)?this._jump(e+s,t+o,e,t):null},s.prototype._findNeighbors=function(e){var t=e.parent,n=e.x,r=e.y,i=this.grid,s,o,u,a,f,l,c=[],h,p,d,v;if(t)s=t.x,o=t.y,f=(n-s)/Math.max(Math.abs(n-s),1),l=(r-o)/Math.max(Math.abs(r-o),1),f!==0&&l!==0?(i.isWalkableAt(n,r+l)&&c.push([n,r+l]),i.isWalkableAt(n+f,r)&&c.push([n+f,r]),(i.isWalkableAt(n,r+l)||i.isWalkableAt(n+f,r))&&c.push([n+f,r+l]),!i.isWalkableAt(n-f,r)&&i.isWalkableAt(n,r+l)&&c.push([n-f,r+l]),!i.isWalkableAt(n,r-l)&&i.isWalkableAt(n+f,r)&&c.push([n+f,r-l])):f===0?i.isWalkableAt(n,r+l)&&(i.isWalkableAt(n,r+l)&&c.push([n,r+l]),i.isWalkableAt(n+1,r)||c.push([n+1,r+l]),i.isWalkableAt(n-1,r)||c.push([n-1,r+l])):i.isWalkableAt(n+f,r)&&(i.isWalkableAt(n+f,r)&&c.push([n+f,r]),i.isWalkableAt(n,r+1)||c.push([n+f,r+1]),i.isWalkableAt(n,r-1)||c.push([n+f,r-1]));else{h=i.getNeighbors(e,!0);for(d=0,v=h.length;d<v;++d)p=h[d],c.push([p.x,p.y])}return c},t.exports=s}),e.define("/PathFinding.js",function(e,t,n,r,i){t.exports={Node:e("./core/Node"),Grid:e("./core/Grid"
  ),Heap:e("./core/Heap"),Util:e("./core/Util"),Heuristic:e("./core/Heuristic"),AStarFinder:e("./finders/AStarFinder"),BestFirstFinder:e("./finders/BestFirstFinder"),BreadthFirstFinder:e("./finders/BreadthFirstFinder"),DijkstraFinder:e("./finders/DijkstraFinder"),BiAStarFinder:e("./finders/BiAStarFinder"),BiBestFirstFinder:e("./finders/BiBestFirstFinder"),BiBreadthFirstFinder:e("./finders/BiBreadthFirstFinder"),BiDijkstraFinder:e("./finders/BiDijkstraFinder"),JumpPointFinder:e("./finders/JumpPointFinder")}}),e("/PathFinding.js"),e("/PathFinding")}();Detector={canvas:!!window.CanvasRenderingContext2D,webgl:function(){try{return!!window.WebGLRenderingContext&&!!document.createElement("canvas").getContext("experimental-webgl")}catch(e){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>.<br />','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>.<br/>','Find out how to get it <a href="http://get.webgl.org/" style="color:#000">here</a>.'].join("\n")),e},addGetWebGLMessage:function(e){var t,n,r;e=e||{},t=e.parent!==undefined?e.parent:document.body,n=e.id!==undefined?e.id:"oldie",r=Detector.getWebGLErrorMessage(),r.id=n,t.appendChild(r)}};var Stats=function(){var e=Date.now(),t=e,n=0,r=Infinity,i=0,s=0,o=Infinity,u=0,a=0,f=0,l=document.createElement("div");l.id="stats",l
  .addEventListener("mousedown",function(e){e.preventDefault(),y(++f%2)},!1),l.style.cssText="width:80px;opacity:0.9;cursor:pointer";var c=document.createElement("div");c.id="fps",c.style.cssText="padding:0 0 3px 3px;text-align:left;background-color:#002",l.appendChild(c);var h=document.createElement("div");h.id="fpsText",h.style.cssText="color:#0ff;font-family:Helvetica,Arial,sans-serif;font-size:9px;font-weight:bold;line-height:15px",h.innerHTML="FPS",c.appendChild(h);var p=document.createElement("div");p.id="fpsGraph",p.style.cssText="position:relative;width:74px;height:30px;background-color:#0ff";for(c.appendChild(p);74>p.children.length;){var d=document.createElement("span");d.style.cssText="width:1px;height:30px;float:left;background-color:#113",p.appendChild(d)}var v=document.createElement("div");v.id="ms",v.style.cssText="padding:0 0 3px 3px;text-align:left;background-color:#020;display:none",l.appendChild(v);var m=document.createElement("div");m.id="msText",m.style.cssText="color:#0f0;font-family:Helvetica,Arial,sans-serif;font-size:9px;font-weight:bold;line-height:15px"
  ,m.innerHTML="MS",v.appendChild(m);var g=document.createElement("div");g.id="msGraph",g.style.cssText="position:relative;width:74px;height:30px;background-color:#0f0";for(v.appendChild(g);74>g.children.length;)d=document.createElement("span"),d.style.cssText="width:1px;height:30px;float:left;background-color:#131",g.appendChild(d);var y=function(e){f=e;switch(f){case 0:c.style.display="block",v.style.display="none";break;case 1:c.style.display="none",v.style.display="block"}};return{REVISION:11,domElement:l,setMode:y,begin:function(){e=Date.now()},end:function(){var f=Date.now();n=f-e,r=Math.min(r,n),i=Math.max(i,n),m.textContent=n+" MS ("+r+"-"+i+")";var l=Math.min(30,30-30*(n/200));return g.appendChild(g.firstChild).style.height=l+"px",a++,f>t+1e3&&(s=Math.round(1e3*a/(f-t)),o=Math.min(o,s),u=Math.max(u,s),h.textContent=s+" FPS ("+o+"-"+u+")",l=Math.min(30,30-30*(s/100)),p.appendChild(p.firstChild).style.height=l+"px",t=f,a=0),f},update:function(){e=this.end()}}};"use strict",window.Physijs=function(){var e=
  parseInt(THREE.REVISION,10),t,n=new THREE.Matrix4,r=!1,i=s,s={},o,u,a,f,l,c,h,p,d=new THREE.Vector3,v=new THREE.Vector3,m=new THREE.Matrix4,g=new THREE.Quaternion,y={WORLDREPORT:0,COLLISIONREPORT:1,VEHICLEREPORT:2,CONSTRAINTREPORT:3},b=14,w=9,E=6;return s.scripts={},o=function(){this._eventListeners={}},o.prototype.addEventListener=function(e,t){this._eventListeners.hasOwnProperty(e)||(this._eventListeners[e]=[]),this._eventListeners[e].push(t)},o.prototype.removeEventListener=function(e,t){var n;return this._eventListeners.hasOwnProperty(e)?(n=this._eventListeners[e].indexOf(t))>=0?(this._eventListeners[e].splice(n,1),!0):!1:!1},o.prototype.dispatchEvent=function(e){var t,n=Array.prototype.splice.call(arguments,1);if(this._eventListeners.hasOwnProperty(e))for(t=0;t<this._eventListeners[e].length;t++)this._eventListeners[e][t].apply(this,n)},o.make=function(e){e.prototype.addEventListener=o.prototype.addEventListener,e.prototype.removeEventListener=o.prototype.removeEventListener,e.prototype.dispatchEvent=o.prototype
  .dispatchEvent},u=function(){var e=0;return function(){return e++}}(),a=function(e,t,n,r){return new THREE.Vector3(Math.atan2(2*(e*r-t*n),r*r-e*e-t*t+n*n),Math.asin(2*(e*n+t*r)),Math.atan2(2*(n*r-e*t),r*r+e*e-t*t-n*n))},f=function(e,t,n){var r,i,s,o,u,a,f,l;return r=Math.cos(t),i=Math.sin(t),s=Math.cos(-n),o=Math.sin(-n),u=Math.cos(e),a=Math.sin(e),f=r*s,l=i*o,{w:f*u-l*a,x:f*a+l*u,y:i*s*u+r*o*a,z:r*o*u-i*s*a}},l=function(e,t){return m.identity(),t.useQuaternion?m.identity().setRotationFromQuaternion(t.quaternion):m.identity().setRotationFromEuler(t.rotation),m.getInverse(m),d.copy(e),v.copy(t.position),m.multiplyVector3(d.subSelf(v))},s.noConflict=function(){return window.Physijs=i,s},s.createMaterial=function(e,t,n){var r=function(){};return r.prototype=e,r=new r,r._physijs={id:e.id,friction:t===undefined?.8:t,restitution:n===undefined?.2:n},r},s.PointConstraint=function(e,t,n){n===undefined&&(n=t,t=undefined),this.type="point",this.appliedImpulse=0,this.id=u(),this.objecta=e._physijs.id,this.positiona=l(n,e)
  .clone(),t&&(this.objectb=t._physijs.id,this.positionb=l(n,t).clone())},s.PointConstraint.prototype.getDefinition=function(){return{type:this.type,id:this.id,objecta:this.objecta,objectb:this.objectb,positiona:this.positiona,positionb:this.positionb}},s.HingeConstraint=function(e,t,n,r){r===undefined&&(r=n,n=t,t=undefined),this.type="hinge",this.appliedImpulse=0,this.id=u(),this.scene=e.parent,this.objecta=e._physijs.id,this.positiona=l(n,e).clone(),this.position=n.clone(),this.axis=r,t&&(this.objectb=t._physijs.id,this.positionb=l(n,t).clone())},s.HingeConstraint.prototype.getDefinition=function(){return{type:this.type,id:this.id,objecta:this.objecta,objectb:this.objectb,positiona:this.positiona,positionb:this.positionb,axis:this.axis}},s.HingeConstraint.prototype.setLimits=function(e,t,n,r){this.scene.execute("hinge_setLimits",{constraint:this.id,low:e,high:t,bias_factor:n,relaxation_factor:r})},s.HingeConstraint.prototype.enableAngularMotor=function(e,t){this.scene.execute("hinge_enableAngularMotor",{constraint
  :this.id,velocity:e,acceleration:t})},s.HingeConstraint.prototype.disableMotor=function(e,t){this.scene.execute("hinge_disableMotor",{constraint:this.id})},s.SliderConstraint=function(e,t,n,r){r===undefined&&(r=n,n=t,t=undefined),this.type="slider",this.appliedImpulse=0,this.id=u(),this.scene=e.parent,this.objecta=e._physijs.id,this.positiona=l(n,e).clone(),this.axis=r,t&&(this.objectb=t._physijs.id,this.positionb=l(n,t).clone())},s.SliderConstraint.prototype.getDefinition=function(){return{type:this.type,id:this.id,objecta:this.objecta,objectb:this.objectb,positiona:this.positiona,positionb:this.positionb,axis:this.axis}},s.SliderConstraint.prototype.setLimits=function(e,t,n,r){this.scene.execute("slider_setLimits",{constraint:this.id,lin_lower:e,lin_upper:t,ang_lower:n,ang_upper:r})},s.SliderConstraint.prototype.setRestitution=function(e,t){this.scene.execute("slider_setRestitution",{constraint:this.id,linear:e,angular:t})},s.SliderConstraint.prototype.enableLinearMotor=function(e,t){this.scene.execute("slider_enableLinearMotor"
  ,{constraint:this.id,velocity:e,acceleration:t})},s.SliderConstraint.prototype.disableLinearMotor=function(){this.scene.execute("slider_disableLinearMotor",{constraint:this.id})},s.SliderConstraint.prototype.enableAngularMotor=function(e,t){this.scene.execute("slider_enableAngularMotor",{constraint:this.id,velocity:e,acceleration:t})},s.SliderConstraint.prototype.disableAngularMotor=function(){this.scene.execute("slider_disableAngularMotor",{constraint:this.id})},s.ConeTwistConstraint=function(e,t,n){if(n===undefined)throw"Both objects must be defined in a ConeTwistConstraint.";this.type="conetwist",this.appliedImpulse=0,this.id=u(),this.scene=e.parent,this.objecta=e._physijs.id,this.positiona=l(n,e).clone(),this.objectb=t._physijs.id,this.positionb=l(n,t).clone(),this.axisa={x:e.rotation.x,y:e.rotation.y,z:e.rotation.z},this.axisb={x:t.rotation.x,y:t.rotation.y,z:t.rotation.z}},s.ConeTwistConstraint.prototype.getDefinition=function(){return{type:this.type,id:this.id,objecta:this.objecta,objectb:this.objectb,positiona
  :this.positiona,positionb:this.positionb,axisa:this.axisa,axisb:this.axisb}},s.ConeTwistConstraint.prototype.setLimit=function(e,t,n){this.scene.execute("conetwist_setLimit",{constraint:this.id,x:e,y:t,z:n})},s.ConeTwistConstraint.prototype.enableMotor=function(){this.scene.execute("conetwist_enableMotor",{constraint:this.id})},s.ConeTwistConstraint.prototype.setMaxMotorImpulse=function(e){this.scene.execute("conetwist_setMaxMotorImpulse",{constraint:this.id,max_impulse:e})},s.ConeTwistConstraint.prototype.setMotorTarget=function(e){if(e instanceof THREE.Vector3)throw"Wait for Three.js r50 to setMotorTarget from Vector3 - use Matrix4 or Quaternion instead";e instanceof THREE.Matrix4&&(e=(new THREE.Quaternion).setFromRotationMatrix(e)),this.scene.execute("conetwist_setMotorTarget",{constraint:this.id,x:e.x,y:e.y,z:e.z,w:e.w})},s.ConeTwistConstraint.prototype.disableMotor=function(){this.scene.execute("conetwist_disableMotor",{constraint:this.id})},s.DOFConstraint=function(e,t,n){n===undefined&&(n=t,t=undefined)
  ,this.type="dof",this.appliedImpulse=0,this.id=u(),this.scene=e.parent,this.objecta=e._physijs.id,this.positiona=l(n,e).clone(),this.axisa={x:e.rotation.x,y:e.rotation.y,z:e.rotation.z},t&&(this.objectb=t._physijs.id,this.positionb=l(n,t).clone(),this.axisb={x:t.rotation.x,y:t.rotation.y,z:t.rotation.z})},s.DOFConstraint.prototype.getDefinition=function(){return{type:this.type,id:this.id,objecta:this.objecta,objectb:this.objectb,positiona:this.positiona,positionb:this.positionb,axisa:this.axisa,axisb:this.axisb}},s.DOFConstraint.prototype.setLinearLowerLimit=function(e){this.scene.execute("dof_setLinearLowerLimit",{constraint:this.id,x:e.x,y:e.y,z:e.z})},s.DOFConstraint.prototype.setLinearUpperLimit=function(e){this.scene.execute("dof_setLinearUpperLimit",{constraint:this.id,x:e.x,y:e.y,z:e.z})},s.DOFConstraint.prototype.setAngularLowerLimit=function(e){this.scene.execute("dof_setAngularLowerLimit",{constraint:this.id,x:e.x,y:e.y,z:e.z})},s.DOFConstraint.prototype.setAngularUpperLimit=function(e){this.scene.execute
  ("dof_setAngularUpperLimit",{constraint:this.id,x:e.x,y:e.y,z:e.z})},s.DOFConstraint.prototype.enableAngularMotor=function(e){this.scene.execute("dof_enableAngularMotor",{constraint:this.id,which:e})},s.DOFConstraint.prototype.configureAngularMotor=function(e,t,n,r,i){this.scene.execute("dof_configureAngularMotor",{constraint:this.id,which:e,low_angle:t,high_angle:n,velocity:r,max_force:i})},s.DOFConstraint.prototype.disableAngularMotor=function(e){this.scene.execute("dof_disableAngularMotor",{constraint:this.id,which:e})},s.Scene=function(e){var n=this;o.call(this),THREE.Scene.call(this),this._worker=new Worker(s.scripts.worker||"physijs_worker.js"),this._worker.transferableMessage=this._worker.webkitPostMessage||this._worker.postMessage,this._materials={},this._objects={},this._vehicles={},this._constraints={};var r=new ArrayBuffer(1);this._worker.transferableMessage(r,[r]),t=r.byteLength===0,this._worker.onmessage=function(e){var t,r=e.data;r instanceof ArrayBuffer&&r.byteLength!==1&&(r=new Float32Array(r))
  ;if(r instanceof Float32Array)switch(r[0]){case y.WORLDREPORT:n._updateScene(r);break;case y.COLLISIONREPORT:n._updateCollisions(r);break;case y.VEHICLEREPORT:n._updateVehicles(r);break;case y.CONSTRAINTREPORT:n._updateConstraints(r)}else if(r.cmd)switch(r.cmd){case"objectReady":t=r.params,n._objects[t]&&n._objects[t].dispatchEvent("ready");break;case"worldReady":n.dispatchEvent("ready");break;case"vehicle":window.test=r;break;default:console.debug("Received: "+r.cmd),console.dir(r.params)}else switch(r[0]){case y.WORLDREPORT:n._updateScene(r);break;case y.COLLISIONREPORT:n._updateCollisions(r);break;case y.VEHICLEREPORT:n._updateVehicles(r);break;case y.CONSTRAINTREPORT:n._updateConstraints(r)}},e=e||{},e.ammo=s.scripts.ammo||"ammo.js",e.fixedTimeStep=e.fixedTimeStep||1/60,e.rateLimit=e.rateLimit||!0,this.execute("init",e)},s.Scene.prototype=new THREE.Scene,s.Scene.prototype.constructor=s.Scene,o.make(s.Scene),s.Scene.prototype._updateScene=function(e){var n=e[1],i,s,o;for(s=0;s<n;s++){o=2+s*b,i=this._objects
  [e[o]];if(i===undefined)continue;i.__dirtyPosition===!1&&i.position.set(e[o+1],e[o+2],e[o+3]),i.__dirtyRotation===!1&&(i.useQuaternion?i.quaternion.set(e[o+4],e[o+5],e[o+6],e[o+7]):i.rotation=a(e[o+4],e[o+5],e[o+6],e[o+7])),i._physijs.linearVelocity.set(e[o+8],e[o+9],e[o+10]),i._physijs.angularVelocity.set(e[o+11],e[o+12],e[o+13])}t&&this._worker.transferableMessage(e.buffer,[e.buffer]),r=!1,this.dispatchEvent("update")},s.Scene.prototype._updateVehicles=function(e){var n,r,i,s;for(i=0;i<(e.length-1)/w;i++){s=1+i*w,n=this._vehicles[e[s]];if(n===undefined)continue;r=n.wheels[e[s+1]],r.position.set(e[s+2],e[s+3],e[s+4]),r.useQuaternion?r.quaternion.set(e[s+5],e[s+6],e[s+7],e[s+8]):r.rotation=a(e[s+5],e[s+6],e[s+7],e[s+8])}t&&this._worker.transferableMessage(e.buffer,[e.buffer])},s.Scene.prototype._updateConstraints=function(e){var n,r,i,s;for(i=0;i<(e.length-1)/E;i++){s=1+i*E,n=this._constraints[e[s]],r=this._objects[e[s+1]];if(n===undefined||r===undefined)continue;d.set(e[s+2],e[s+3],e[s+4]),m.extractRotation(r
  .matrix),m.multiplyVector3(d),n.positiona.add(r.position,d),n.appliedImpulse=e[s+5]}t&&this._worker.transferableMessage(e.buffer,[e.buffer])},s.Scene.prototype._updateCollisions=function(e){var n,r,i,s,o,u={},a=[];for(n=0;n<e[1];n++)i=2+n*2,s=e[i],o=e[i+1],u[s]||(u[s]=[]),u[s].push(o);for(s in this._objects){if(!this._objects.hasOwnProperty(s))return;s=this._objects[s];if(u[s._physijs.id]){a.length=0;for(r=0;r<u[s._physijs.id].length;r++)o=this._objects[u[s._physijs.id][r]],s._physijs.touches.indexOf(o._physijs.id)===-1&&(s._physijs.touches.push(o._physijs.id),d.sub(s.getLinearVelocity(),o.getLinearVelocity()),h=d.clone(),d.sub(s.getAngularVelocity(),o.getAngularVelocity()),p=d,s.dispatchEvent("collision",o,h,p),o.dispatchEvent("collision",s,h,p)),a.push(o._physijs.id);for(r=0;r<s._physijs.touches.length;r++)a.indexOf(s._physijs.touches[r])===-1&&s._physijs.touches.splice(r--,1)}else s._physijs.touches.length=0}t&&this._worker.transferableMessage(e.buffer,[e.buffer])},s.Scene.prototype.addConstraint=function(e
  ,t){this._constraints[e.id]=e,this.execute("addConstraint",e.getDefinition());if(t){var n;switch(e.type){case"point":n=new THREE.Mesh(new THREE.SphereGeometry(1.5),new THREE.MeshNormalMaterial),n.position.copy(e.positiona),this._objects[e.objecta].add(n);break;case"hinge":n=new THREE.Mesh(new THREE.SphereGeometry(1.5),new THREE.MeshNormalMaterial),n.position.copy(e.positiona),this._objects[e.objecta].add(n);break;case"slider":n=new THREE.Mesh(new THREE.CubeGeometry(10,1,1),new THREE.MeshNormalMaterial),n.position.copy(e.positiona),n.rotation.set(e.axis.y,e.axis.x,e.axis.z),this._objects[e.objecta].add(n);break;case"conetwist":n=new THREE.Mesh(new THREE.SphereGeometry(1.5),new THREE.MeshNormalMaterial),n.position.copy(e.positiona),this._objects[e.objecta].add(n);break;case"dof":n=new THREE.Mesh(new THREE.SphereGeometry(1.5),new THREE.MeshNormalMaterial),n.position.copy(e.positiona),this._objects[e.objecta].add(n)}}return e},s.Scene.prototype.removeConstraint=function(e){this._constraints[e.id]!==undefined&&(this
  .execute("removeConstraint",{id:e.id}),delete this._constraints[e.id])},s.Scene.prototype.execute=function(e,t){this._worker.postMessage({cmd:e,params:t})},c=function(e,t){var n;for(n=0;n<t.children.length;n++)t.children[n]._physijs&&(t.children[n].updateMatrix(),t.children[n].updateMatrixWorld(),d.getPositionFromMatrix(t.children[n].matrixWorld),g.setFromRotationMatrix(t.children[n].matrixWorld),t.children[n]._physijs.position_offset={x:d.x,y:d.y,z:d.z},t.children[n]._physijs.rotation={x:g.x,y:g.y,z:g.z,w:g.w},e._physijs.children.push(t.children[n]._physijs)),c(e,t.children[n])},s.Scene.prototype.add=function(e){THREE.Mesh.prototype.add.call(this,e);if(e._physijs){e.world=this;if(e instanceof s.Vehicle)this.add(e.mesh),this._vehicles[e._physijs.id]=e,this.execute("addVehicle",e._physijs);else{e.__dirtyPosition=!1,e.__dirtyRotation=!1,this._objects[e._physijs.id]=e,e.children.length&&(e._physijs.children=[],c(e,e)),e.material._physijs&&(this._materials.hasOwnProperty(e.material._physijs.id)||(this.execute("registerMaterial"
  ,e.material._physijs),e._physijs.materialId=e.material._physijs.id)),e._physijs.position={x:e.position.x,y:e.position.y,z:e.position.z},e.useQuaternion||(n.identity().setRotationFromEuler(e.rotation),e.quaternion.setFromRotationMatrix(n)),e._physijs.rotation={x:e.quaternion.x,y:e.quaternion.y,z:e.quaternion.z,w:e.quaternion.w};var t=new THREE.Vector3(1,1,1);e._physijs.width&&(e._physijs.width*=e.scale.x),e._physijs.height&&(e._physijs.height*=e.scale.y),e._physijs.depth&&(e._physijs.depth*=e.scale.z),this.execute("addObject",e._physijs)}}},s.Scene.prototype.remove=function(e){if(e instanceof s.Vehicle){this.execute("removeVehicle",{id:e._physijs.id});while(e.wheels.length)this.remove(e.wheels.pop());this.remove(e.mesh),delete this._vehicles[e._physijs.id]}else THREE.Mesh.prototype.remove.call(this,e),e._physijs&&(delete this._objects[e._physijs.id],this.execute("removeObject",{id:e._physijs.id}))},s.Scene.prototype.setFixedTimeStep=function(e){e&&this.execute("setFixedTimeStep",e)},s.Scene.prototype.setGravity=
  function(e){e&&this.execute("setGravity",e)},s.Scene.prototype.simulate=function(e,t){var i,s,o;if(r)return!1;r=!0;for(i in this._objects){if(!this._objects.hasOwnProperty(i))continue;s=this._objects[i];if(s.__dirtyPosition||s.__dirtyRotation)o={id:s._physijs.id},s.__dirtyPosition&&(o.pos={x:s.position.x,y:s.position.y,z:s.position.z},s.__dirtyPosition=!1),s.__dirtyRotation&&(s.useQuaternion||(n.identity().setRotationFromEuler(s.rotation),s.quaternion.setFromRotationMatrix(n)),o.quat={x:s.quaternion.x,y:s.quaternion.y,z:s.quaternion.z,w:s.quaternion.w},s.__dirtyRotation=!1),this.execute("updateTransform",o)}return this.execute("simulate",{timeStep:e,maxSubSteps:t}),!0},s.Mesh=function(e,t,n){var r;if(!e)return;o.call(this),THREE.Mesh.call(this,e,t),e.boundingBox||e.computeBoundingBox(),this._physijs={type:null,id:u(),mass:n||0,touches:[],linearVelocity:new THREE.Vector3,angularVelocity:new THREE.Vector3}},s.Mesh.prototype=new THREE.Mesh,s.Mesh.prototype.constructor=s.Mesh,o.make(s.Mesh),s.Mesh.prototype.__defineGetter__
  ("mass",function(){return this._physijs.mass}),s.Mesh.prototype.__defineSetter__("mass",function(e){this._physijs.mass=e,this.world&&this.world.execute("updateMass",{id:this._physijs.id,mass:e})}),s.Mesh.prototype.applyCentralImpulse=function(e){this.world&&this.world.execute("applyCentralImpulse",{id:this._physijs.id,x:e.x,y:e.y,z:e.z})},s.Mesh.prototype.applyImpulse=function(e,t){this.world&&this.world.execute("applyImpulse",{id:this._physijs.id,impulse_x:e.x,impulse_y:e.y,impulse_z:e.z,x:t.x,y:t.y,z:t.z})},s.Mesh.prototype.applyCentralForce=function(e){this.world&&this.world.execute("applyCentralForce",{id:this._physijs.id,x:e.x,y:e.y,z:e.z})},s.Mesh.prototype.applyForce=function(e,t){this.world&&this.world.execute("applyForce",{id:this._physijs.id,force_x:e.x,force_y:e.y,force_z:e.z,x:t.x,y:t.y,z:t.z})},s.Mesh.prototype.getAngularVelocity=function(){return this._physijs.angularVelocity},s.Mesh.prototype.setAngularVelocity=function(e){this.world&&this.world.execute("setAngularVelocity",{id:this._physijs.id,
  x:e.x,y:e.y,z:e.z})},s.Mesh.prototype.getLinearVelocity=function(){return this._physijs.linearVelocity},s.Mesh.prototype.setLinearVelocity=function(e){this.world&&this.world.execute("setLinearVelocity",{id:this._physijs.id,x:e.x,y:e.y,z:e.z})},s.Mesh.prototype.setAngularFactor=function(e){this.world&&this.world.execute("setAngularFactor",{id:this._physijs.id,x:e.x,y:e.y,z:e.z})},s.Mesh.prototype.setLinearFactor=function(e){this.world&&this.world.execute("setLinearFactor",{id:this._physijs.id,x:e.x,y:e.y,z:e.z})},s.Mesh.prototype.setDamping=function(e,t){this.world&&this.world.execute("setDamping",{id:this._physijs.id,linear:e,angular:t})},s.Mesh.prototype.setCcdMotionThreshold=function(e){this.world&&this.world.execute("setCcdMotionThreshold",{id:this._physijs.id,threshold:e})},s.Mesh.prototype.setCcdSweptSphereRadius=function(e){this.world&&this.world.execute("setCcdSweptSphereRadius",{id:this._physijs.id,radius:e})},s.PlaneMesh=function(e,t,n){var r,i;s.Mesh.call(this,e,t,n),e.boundingBox||e.computeBoundingBox
  (),r=e.boundingBox.max.x-e.boundingBox.min.x,i=e.boundingBox.max.y-e.boundingBox.min.y,this._physijs.type="plane",this._physijs.normal=e.faces[0].normal.clone(),this._physijs.mass=typeof n=="undefined"?r*i:n},s.PlaneMesh.prototype=new s.Mesh,s.PlaneMesh.prototype.constructor=s.PlaneMesh,s.HeightfieldMesh=function(e,t,n,r,i){s.Mesh.call(this,e,t,n),this._physijs.type="heightfield",this._physijs.xsize=e.boundingBox.max.x-e.boundingBox.min.x,this._physijs.ysize=e.boundingBox.max.y-e.boundingBox.min.y,this._physijs.xpts=typeof r=="undefined"?Math.sqrt(e.vertices.length):r+1,this._physijs.ypts=typeof i=="undefined"?Math.sqrt(e.vertices.length):i+1,this._physijs.absMaxHeight=Math.max(e.boundingBox.max.z,Math.abs(e.boundingBox.min.z));var o=[],u,a;for(var f=0;f<e.vertices.length;f++)u=f%this._physijs.xpts,a=Math.round(f/this._physijs.xpts-f%this._physijs.xpts/this._physijs.xpts),o[f]=e.vertices[u+(this._physijs.ypts-a-1)*this._physijs.ypts].z;this._physijs.points=o},s.HeightfieldMesh.prototype=new s.Mesh,s.HeightfieldMesh
  .prototype.constructor=s.HeightfieldMesh,s.BoxMesh=function(e,t,n){var r,i,o;s.Mesh.call(this,e,t,n),e.boundingBox||e.computeBoundingBox(),r=e.boundingBox.max.x-e.boundingBox.min.x,i=e.boundingBox.max.y-e.boundingBox.min.y,o=e.boundingBox.max.z-e.boundingBox.min.z,this._physijs.type="box",this._physijs.width=r,this._physijs.height=i,this._physijs.depth=o,this._physijs.mass=typeof n=="undefined"?r*i*o:n},s.BoxMesh.prototype=new s.Mesh,s.BoxMesh.prototype.constructor=s.BoxMesh,s.SphereMesh=function(e,t,n){s.Mesh.call(this,e,t,n),e.boundingSphere||e.computeBoundingSphere(),this._physijs.type="sphere",this._physijs.radius=e.boundingSphere.radius,this._physijs.mass=typeof n=="undefined"?4/3*Math.PI*Math.pow(this._physijs.radius,3):n},s.SphereMesh.prototype=new s.Mesh,s.SphereMesh.prototype.constructor=s.SphereMesh,s.CylinderMesh=function(e,t,n){var r,i,o;s.Mesh.call(this,e,t,n),e.boundingBox||e.computeBoundingBox(),r=e.boundingBox.max.x-e.boundingBox.min.x,i=e.boundingBox.max.y-e.boundingBox.min.y,o=e.boundingBox.max
  .z-e.boundingBox.min.z,this._physijs.type="cylinder",this._physijs.width=r,this._physijs.height=i,this._physijs.depth=o,this._physijs.mass=typeof n=="undefined"?r*i*o:n},s.CylinderMesh.prototype=new s.Mesh,s.CylinderMesh.prototype.constructor=s.CylinderMesh,s.CapsuleMesh=function(e,t,n){var r,i,o;s.Mesh.call(this,e,t,n),e.boundingBox||e.computeBoundingBox(),r=e.boundingBox.max.x-e.boundingBox.min.x,i=e.boundingBox.max.y-e.boundingBox.min.y,o=e.boundingBox.max.z-e.boundingBox.min.z,this._physijs.type="capsule",this._physijs.radius=Math.max(r/2,o/2),this._physijs.height=i,this._physijs.mass=typeof n=="undefined"?r*i*o:n},s.CapsuleMesh.prototype=new s.Mesh,s.CapsuleMesh.prototype.constructor=s.CapsuleMesh,s.ConeMesh=function(e,t,n){var r,i,o;s.Mesh.call(this,e,t,n),e.boundingBox||e.computeBoundingBox(),r=e.boundingBox.max.x-e.boundingBox.min.x,i=e.boundingBox.max.y-e.boundingBox.min.y,this._physijs.type="cone",this._physijs.radius=r/2,this._physijs.height=i,this._physijs.mass=typeof n=="undefined"?r*i:n},s.ConeMesh
  .prototype=new s.Mesh,s.ConeMesh.prototype.constructor=s.ConeMesh,s.ConcaveMesh=function(e,t,n){var r,i,o,u,a,f,l=[];s.Mesh.call(this,e,t,n),e.boundingBox||e.computeBoundingBox(),a=e.vertices;for(r=0;r<e.faces.length;r++)f=e.faces[r],f instanceof THREE.Face3?l.push([{x:a[f.a].x,y:a[f.a].y,z:a[f.a].z},{x:a[f.b].x,y:a[f.b].y,z:a[f.b].z},{x:a[f.c].x,y:a[f.c].y,z:a[f.c].z}]):f instanceof THREE.Face4&&(l.push([{x:a[f.a].x,y:a[f.a].y,z:a[f.a].z},{x:a[f.b].x,y:a[f.b].y,z:a[f.b].z},{x:a[f.d].x,y:a[f.d].y,z:a[f.d].z}]),l.push([{x:a[f.b].x,y:a[f.b].y,z:a[f.b].z},{x:a[f.c].x,y:a[f.c].y,z:a[f.c].z},{x:a[f.d].x,y:a[f.d].y,z:a[f.d].z}]));i=e.boundingBox.max.x-e.boundingBox.min.x,o=e.boundingBox.max.y-e.boundingBox.min.y,u=e.boundingBox.max.z-e.boundingBox.min.z,this._physijs.type="concave",this._physijs.triangles=l,this._physijs.mass=typeof n=="undefined"?i*o*u:n},s.ConcaveMesh.prototype=new s.Mesh,s.ConcaveMesh.prototype.constructor=s.ConcaveMesh,s.ConvexMesh=function(t,n,r){var i,o,u,a,f=[];s.Mesh.call(this,t,n,r),t.boundingBox||
  t.computeBoundingBox();for(i=0;i<t.vertices.length;i++)e>=49?f.push({x:t.vertices[i].x,y:t.vertices[i].y,z:t.vertices[i].z}):f.push({x:t.vertices[i].position.x,y:t.vertices[i].position.y,z:t.vertices[i].position.z});o=t.boundingBox.max.x-t.boundingBox.min.x,u=t.boundingBox.max.y-t.boundingBox.min.y,a=t.boundingBox.max.z-t.boundingBox.min.z,this._physijs.type="convex",this._physijs.points=f,this._physijs.mass=typeof r=="undefined"?o*u*a:r},s.ConvexMesh.prototype=new s.Mesh,s.ConvexMesh.prototype.constructor=s.ConvexMesh,s.Vehicle=function(e,t){t=t||new s.VehicleTuning,this.mesh=e,this.wheels=[],this._physijs={id:u(),rigidBody:e._physijs.id,suspension_stiffness:t.suspension_stiffness,suspension_compression:t.suspension_compression,suspension_damping:t.suspension_damping,max_suspension_travel:t.max_suspension_travel,friction_slip:t.friction_slip,max_suspension_force:t.max_suspension_force}},s.Vehicle.prototype.addWheel=function(e,t,n,r,i,s,o,u,a){var f=new THREE.Mesh(e,t);f.castShadow=f.receiveShadow=!0,f.position
  .copy(r).multiplyScalar(s/100).addSelf(n),this.world.add(f),this.wheels.push(f),this.world.execute("addWheel",{id:this._physijs.id,connection_point:{x:n.x,y:n.y,z:n.z},wheel_direction:{x:r.x,y:r.y,z:r.z},wheel_axle:{x:i.x,y:i.y,z:i.z},suspension_rest_length:s,wheel_radius:o,is_front_wheel:u,tuning:a})},s.Vehicle.prototype.setSteering=function(e,t){if(t!==undefined&&this.wheels[t]!==undefined)this.world.execute("setSteering",{id:this._physijs.id,wheel:t,steering:e});else if(this.wheels.length>0)for(var n=0;n<this.wheels.length;n++)this.world.execute("setSteering",{id:this._physijs.id,wheel:n,steering:e})},s.Vehicle.prototype.setBrake=function(e,t){if(t!==undefined&&this.wheels[t]!==undefined)this.world.execute("setBrake",{id:this._physijs.id,wheel:t,brake:e});else if(this.wheels.length>0)for(var n=0;n<this.wheels.length;n++)this.world.execute("setBrake",{id:this._physijs.id,wheel:n,brake:e})},s.Vehicle.prototype.applyEngineForce=function(e,t){if(t!==undefined&&this.wheels[t]!==undefined)this.world.execute("applyEngineForce"
  ,{id:this._physijs.id,wheel:t,force:e});else if(this.wheels.length>0)for(var n=0;n<this.wheels.length;n++)this.world.execute("applyEngineForce",{id:this._physijs.id,wheel:n,force:e})},s.VehicleTuning=function(e,t,n,r,i,s){this.suspension_stiffness=e!==undefined?e:5.88,this.suspension_compression=t!==undefined?t:.83,this.suspension_damping=n!==undefined?n:.88,this.max_suspension_travel=r!==undefined?r:500,this.friction_slip=i!==undefined?i:10.5,this.max_suspension_force=s!==undefined?s:6e3},s}();