%PDF- %PDF-
Direktori : /var/www/html/shaban/laviva/wp-content/themes/levelup/assets/js/ |
Current File : /var/www/html/shaban/laviva/wp-content/themes/levelup/assets/js/plugins.min.js |
function hexToRgb(a){var b=/^#?([a-f\d])([a-f\d])([a-f\d])$/i;a=a.replace(b,function(a,b,c,d){return b+b+c+c+d+d});var c=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(a);return c?{r:parseInt(c[1],16),g:parseInt(c[2],16),b:parseInt(c[3],16)}:null}function clamp(a,b,c){return Math.min(Math.max(a,b),c)}function isInArray(a,b){return b.indexOf(a)>-1}function GlitchFx(){this.domElement=document.createElement("div"),this.domElement.className="glitch",this.bindMethods(),this.setupContext(),this.render(),this.enabled=!0,this.glitchFrames=0,this.glitching=!1,this.onProbability=.005,this.offProbability=.2,this.minGlitchedFrames=5,this.maxGlitchedFrames=30,this.distortionProbability=.35,this.maxSeedValue=.2,this.maxDistortion=.2,this.strengthDivisor=60}window.Modernizr=function(a,b,c){function d(a){s.cssText=a}function e(a,b){return d(v.join(a+";")+(b||""))}function f(a,b){return typeof a===b}function g(a,b){return!!~(""+a).indexOf(b)}function h(a,b){for(var d in a){var e=a[d];if(!g(e,"-")&&s[e]!==c)return"pfx"!=b||e}return!1}function i(a,b,d){for(var e in a){var g=b[a[e]];if(g!==c)return!1===d?a[e]:f(g,"function")?g.bind(d||b):g}return!1}function j(a,b,c){var d=a.charAt(0).toUpperCase()+a.slice(1),e=(a+" "+x.join(d+" ")+d).split(" ");return f(b,"string")||f(b,"undefined")?h(e,b):(e=(a+" "+y.join(d+" ")+d).split(" "),i(e,b,c))}var k,l,m="2.8.3",n={},o=!0,p=b.documentElement,q="modernizr",r=b.createElement(q),s=r.style,t=":)",u={}.toString,v=" -webkit- -moz- -o- -ms- ".split(" "),w="Webkit Moz O ms",x=w.split(" "),y=w.toLowerCase().split(" "),z={svg:"http://www.w3.org/2000/svg"},A={},B=[],C=B.slice,D=function(a,c,d,e){var f,g,h,i,j=b.createElement("div"),k=b.body,l=k||b.createElement("body");if(parseInt(d,10))for(;d--;)h=b.createElement("div"),h.id=e?e[d]:q+(d+1),j.appendChild(h);return f=["­",'<style id="s',q,'">',a,"</style>"].join(""),j.id=q,(k?j:l).innerHTML+=f,l.appendChild(j),k||(l.style.background="",l.style.overflow="hidden",i=p.style.overflow,p.style.overflow="hidden",p.appendChild(l)),g=c(j,a),k?j.parentNode.removeChild(j):(l.parentNode.removeChild(l),p.style.overflow=i),!!g},E={}.hasOwnProperty;l=f(E,"undefined")||f(E.call,"undefined")?function(a,b){return b in a&&f(a.constructor.prototype[b],"undefined")}:function(a,b){return E.call(a,b)},Function.prototype.bind||(Function.prototype.bind=function(a){var b=this;if("function"!=typeof b)throw new TypeError;var c=C.call(arguments,1),d=function(){if(this instanceof d){var e=function(){};e.prototype=b.prototype;var f=new e,g=b.apply(f,c.concat(C.call(arguments)));return Object(g)===g?g:f}return b.apply(a,c.concat(C.call(arguments)))};return d}),A.flexbox=function(){return j("flexWrap")},A.flexboxlegacy=function(){return j("boxDirection")},A.webgl=function(){return!!a.WebGLRenderingContext},A.touch=function(){var c;return"ontouchstart"in a||a.DocumentTouch&&b instanceof DocumentTouch?c=!0:D(["@media (",v.join("touch-enabled),("),q,")","{#modernizr{top:9px;position:absolute}}"].join(""),function(a){c=9===a.offsetTop}),c},A.geolocation=function(){return"geolocation"in navigator},A.rgba=function(){return d("background-color:rgba(150,255,150,.5)"),g(s.backgroundColor,"rgba")},A.hsla=function(){return d("background-color:hsla(120,40%,100%,.5)"),g(s.backgroundColor,"rgba")||g(s.backgroundColor,"hsla")},A.multiplebgs=function(){return d("background:url(https://),url(https://),red url(https://)"),/(url\s*\(.*?){3}/.test(s.background)},A.backgroundsize=function(){return j("backgroundSize")},A.borderimage=function(){return j("borderImage")},A.borderradius=function(){return j("borderRadius")},A.boxshadow=function(){return j("boxShadow")},A.textshadow=function(){return""===b.createElement("div").style.textShadow},A.opacity=function(){return e("opacity:.55"),/^0.55$/.test(s.opacity)},A.cssanimations=function(){return j("animationName")},A.csscolumns=function(){return j("columnCount")},A.cssgradients=function(){var a="background-image:";return d((a+"-webkit- ".split(" ").join("gradient(linear,left top,right bottom,from(#9f9),to(white));"+a)+v.join("linear-gradient(left top,#9f9, white);"+a)).slice(0,-a.length)),g(s.backgroundImage,"gradient")},A.cssreflections=function(){return j("boxReflect")},A.csstransforms=function(){return!!j("transform")},A.csstransforms3d=function(){var a=!!j("perspective");return a&&"webkitPerspective"in p.style&&D("@media (transform-3d),(-webkit-transform-3d){#modernizr{left:9px;position:absolute;height:3px;}}",function(b,c){a=9===b.offsetLeft&&3===b.offsetHeight}),a},A.csstransitions=function(){return j("transition")},A.fontface=function(){var a;return D('@font-face {font-family:"font";src:url("https://")}',function(c,d){var e=b.getElementById("smodernizr"),f=e.sheet||e.styleSheet,g=f?f.cssRules&&f.cssRules[0]?f.cssRules[0].cssText:f.cssText||"":"";a=/src/i.test(g)&&0===g.indexOf(d.split(" ")[0])}),a},A.generatedcontent=function(){var a;return D(["#",q,"{font:0/0 a}#",q,':after{content:"',t,'";visibility:hidden;font:3px/1 a}'].join(""),function(b){a=b.offsetHeight>=3}),a},A.svg=function(){return!!b.createElementNS&&!!b.createElementNS(z.svg,"svg").createSVGRect},A.inlinesvg=function(){var a=b.createElement("div");return a.innerHTML="<svg/>",(a.firstChild&&a.firstChild.namespaceURI)==z.svg},A.smil=function(){return!!b.createElementNS&&/SVGAnimate/.test(u.call(b.createElementNS(z.svg,"animate")))},A.svgclippaths=function(){return!!b.createElementNS&&/SVGClipPath/.test(u.call(b.createElementNS(z.svg,"clipPath")))};for(var F in A)l(A,F)&&(k=F.toLowerCase(),n[k]=A[F](),B.push((n[k]?"":"no-")+k));return n.addTest=function(a,b){if("object"==typeof a)for(var d in a)l(a,d)&&n.addTest(d,a[d]);else{if(a=a.toLowerCase(),n[a]!==c)return n;b="function"==typeof b?b():b,void 0!==o&&o&&(p.className+=" "+(b?"":"no-")+a),n[a]=b}return n},d(""),r=null,function(a,b){function c(a,b){var c=a.createElement("p"),d=a.getElementsByTagName("head")[0]||a.documentElement;return c.innerHTML="x<style>"+b+"</style>",d.insertBefore(c.lastChild,d.firstChild)}function d(){var a=s.elements;return"string"==typeof a?a.split(" "):a}function e(a){var b=r[a[p]];return b||(b={},q++,a[p]=q,r[q]=b),b}function f(a,c,d){if(c||(c=b),k)return c.createElement(a);d||(d=e(c));var f;return f=d.cache[a]?d.cache[a].cloneNode():o.test(a)?(d.cache[a]=d.createElem(a)).cloneNode():d.createElem(a),!f.canHaveChildren||n.test(a)||f.tagUrn?f:d.frag.appendChild(f)}function g(a,c){if(a||(a=b),k)return a.createDocumentFragment();c=c||e(a);for(var f=c.frag.cloneNode(),g=0,h=d(),i=h.length;g<i;g++)f.createElement(h[g]);return f}function h(a,b){b.cache||(b.cache={},b.createElem=a.createElement,b.createFrag=a.createDocumentFragment,b.frag=b.createFrag()),a.createElement=function(c){return s.shivMethods?f(c,a,b):b.createElem(c)},a.createDocumentFragment=Function("h,f","return function(){var n=f.cloneNode(),c=n.createElement;h.shivMethods&&("+d().join().replace(/[\w\-]+/g,function(a){return b.createElem(a),b.frag.createElement(a),'c("'+a+'")'})+");return n}")(s,b.frag)}function i(a){a||(a=b);var d=e(a);return s.shivCSS&&!j&&!d.hasCSS&&(d.hasCSS=!!c(a,"article,aside,dialog,figcaption,figure,footer,header,hgroup,main,nav,section{display:block}mark{background:#FF0;color:#000}template{display:none}")),k||h(a,d),a}var j,k,l="3.7.0",m=a.html5||{},n=/^<|^(?:button|map|select|textarea|object|iframe|option|optgroup)$/i,o=/^(?:a|b|code|div|fieldset|h1|h2|h3|h4|h5|h6|i|label|li|ol|p|q|span|strong|style|table|tbody|td|th|tr|ul)$/i,p="_html5shiv",q=0,r={};!function(){try{var a=b.createElement("a");a.innerHTML="<xyz></xyz>",j="hidden"in a,k=1==a.childNodes.length||function(){b.createElement("a");var a=b.createDocumentFragment();return void 0===a.cloneNode||void 0===a.createDocumentFragment||void 0===a.createElement}()}catch(l){j=!0,k=!0}}();var s={elements:m.elements||"abbr article aside audio bdi canvas data datalist details dialog figcaption figure footer header hgroup main mark meter nav output progress section summary template time video",version:l,shivCSS:!1!==m.shivCSS,supportsUnknownElements:k,shivMethods:!1!==m.shivMethods,type:"default",shivDocument:i,createElement:f,createDocumentFragment:g};a.html5=s,i(b)}(this,b),n._version=m,n._prefixes=v,n._domPrefixes=y,n._cssomPrefixes=x,n.testProp=function(a){return h([a])},n.testAllProps=j,n.testStyles=D,n.prefixed=function(a,b,c){return b?j(a,b,c):j(a,"pfx")},p.className=p.className.replace(/(^|\s)no-js(\s|$)/,"$1$2")+(o?" js "+B.join(" "):""),n}(this,this.document),function(a,b,c){function d(a){return"[object Function]"==q.call(a)}function e(a){return"string"==typeof a}function f(){}function g(a){return!a||"loaded"==a||"complete"==a||"uninitialized"==a}function h(){var a=r.shift();s=1,a?a.t?o(function(){("c"==a.t?m.injectCss:m.injectJs)(a.s,0,a.a,a.x,a.e,1)},0):(a(),h()):s=0}function i(a,c,d,e,f,i,j){function k(b){if(!n&&g(l.readyState)&&(t.r=n=1,!s&&h(),l.onload=l.onreadystatechange=null,b)){"img"!=a&&o(function(){v.removeChild(l)},50);for(var d in A[c])A[c].hasOwnProperty(d)&&A[c][d].onload()}}var j=j||m.errorTimeout,l=b.createElement(a),n=0,q=0,t={t:d,s:c,e:f,a:i,x:j};1===A[c]&&(q=1,A[c]=[]),"object"==a?l.data=c:(l.src=c,l.type=a),l.width=l.height="0",l.onerror=l.onload=l.onreadystatechange=function(){k.call(this,q)},r.splice(e,0,t),"img"!=a&&(q||2===A[c]?(v.insertBefore(l,u?null:p),o(k,j)):A[c].push(l))}function j(a,b,c,d,f){return s=0,b=b||"j",e(a)?i("c"==b?x:w,a,b,this.i++,c,d,f):(r.splice(this.i++,0,a),1==r.length&&h()),this}function k(){var a=m;return a.loader={load:j,i:0},a}var l,m,n=b.documentElement,o=a.setTimeout,p=b.getElementsByTagName("script")[0],q={}.toString,r=[],s=0,t="MozAppearance"in n.style,u=t&&!!b.createRange().compareNode,v=u?n:p.parentNode,n=a.opera&&"[object Opera]"==q.call(a.opera),n=!!b.attachEvent&&!n,w=t?"object":n?"script":"img",x=n?"script":w,y=Array.isArray||function(a){return"[object Array]"==q.call(a)},z=[],A={},B={timeout:function(a,b){return b.length&&(a.timeout=b[0]),a}};m=function(a){function b(a){var b,c,d,a=a.split("!"),e=z.length,f=a.pop(),g=a.length,f={url:f,origUrl:f,prefixes:a};for(c=0;c<g;c++)d=a[c].split("="),(b=B[d.shift()])&&(f=b(f,d));for(c=0;c<e;c++)f=z[c](f);return f}function g(a,e,f,g,h){var i=b(a),j=i.autoCallback;i.url.split(".").pop().split("?").shift(),i.bypass||(e&&(e=d(e)?e:e[a]||e[g]||e[a.split("/").pop().split("?")[0]]),i.instead?i.instead(a,e,f,g,h):(A[i.url]?i.noexec=!0:A[i.url]=1,f.load(i.url,i.forceCSS||!i.forceJS&&"css"==i.url.split(".").pop().split("?").shift()?"c":c,i.noexec,i.attrs,i.timeout),(d(e)||d(j))&&f.load(function(){k(),e&&e(i.origUrl,h,g),j&&j(i.origUrl,h,g),A[i.url]=2})))}function h(a,b){function c(a,c){if(a){if(e(a))c||(l=function(){var a=[].slice.call(arguments);m.apply(this,a),n()}),g(a,l,b,0,j);else if(Object(a)===a)for(i in h=function(){var b,c=0;for(b in a)a.hasOwnProperty(b)&&c++;return c}(),a)a.hasOwnProperty(i)&&(!c&&!--h&&(d(l)?l=function(){var a=[].slice.call(arguments);m.apply(this,a),n()}:l[i]=function(a){return function(){var b=[].slice.call(arguments);a&&a.apply(this,b),n()}}(m[i])),g(a[i],l,b,i,j))}else!c&&n()}var h,i,j=!!a.test,k=a.load||a.both,l=a.callback||f,m=l,n=a.complete||f;c(j?a.yep:a.nope,!!k),k&&c(k)}var i,j,l=this.yepnope.loader;if(e(a))g(a,0,l,0);else if(y(a))for(i=0;i<a.length;i++)j=a[i],e(j)?g(j,0,l,0):y(j)?m(j):Object(j)===j&&h(j,l);else Object(a)===a&&h(a,l)},m.addPrefix=function(a,b){B[a]=b},m.addFilter=function(a){z.push(a)},m.errorTimeout=1e4,null==b.readyState&&b.addEventListener&&(b.readyState="loading",b.addEventListener("DOMContentLoaded",l=function(){b.removeEventListener("DOMContentLoaded",l,0),b.readyState="complete"},0)),a.yepnope=k(),a.yepnope.executeStack=h,a.yepnope.injectJs=function(a,c,d,e,i,j){var k,l,n=b.createElement("script"),e=e||m.errorTimeout;n.src=a;for(l in d)n.setAttribute(l,d[l]);c=j?h:c||f,n.onreadystatechange=n.onload=function(){!k&&g(n.readyState)&&(k=1,c(),n.onload=n.onreadystatechange=null)},o(function(){k||(k=1,c(1))},e),i?n.onload():p.parentNode.insertBefore(n,p)},a.yepnope.injectCss=function(a,c,d,e,g,i){var j,e=b.createElement("link"),c=i?h:c||f;e.href=a,e.rel="stylesheet",e.type="text/css";for(j in d)e.setAttribute(j,d[j]);g||(p.parentNode.insertBefore(e,p),o(c,0))}}(this,document),Modernizr.load=function(){yepnope.apply(window,[].slice.call(arguments,0))},function(a,b){"function"==typeof define&&define.amd?define("ev-emitter/ev-emitter",b):"object"==typeof module&&module.exports?module.exports=b():a.EvEmitter=b()}(this,function(){function a(){}var b=a.prototype;return b.on=function(a,b){if(a&&b){var c=this._events=this._events||{},d=c[a]=c[a]||[];return-1==d.indexOf(b)&&d.push(b),this}},b.once=function(a,b){if(a&&b){this.on(a,b);var c=this._onceEvents=this._onceEvents||{};return(c[a]=c[a]||[])[b]=!0,this}},b.off=function(a,b){var c=this._events&&this._events[a];if(c&&c.length){var d=c.indexOf(b);return-1!=d&&c.splice(d,1),this}},b.emitEvent=function(a,b){var c=this._events&&this._events[a];if(c&&c.length){var d=0,e=c[d];b=b||[];for(var f=this._onceEvents&&this._onceEvents[a];e;){var g=f&&f[e];g&&(this.off(a,e),delete f[e]),e.apply(this,b),d+=g?0:1,e=c[d]}return this}},a}),function(a,b){"use strict";"function"==typeof define&&define.amd?define(["ev-emitter/ev-emitter"],function(c){return b(a,c)}):"object"==typeof module&&module.exports?module.exports=b(a,require("ev-emitter")):a.imagesLoaded=b(a,a.EvEmitter)}(window,function(a,b){function c(a,b){for(var c in b)a[c]=b[c];return a}function d(a){var b=[];if(Array.isArray(a))b=a;else if("number"==typeof a.length)for(var c=0;c<a.length;c++)b.push(a[c]);else b.push(a);return b}function e(a,b,f){return this instanceof e?("string"==typeof a&&(a=document.querySelectorAll(a)),this.elements=d(a),this.options=c({},this.options),"function"==typeof b?f=b:c(this.options,b),f&&this.on("always",f),this.getImages(),h&&(this.jqDeferred=new h.Deferred),void setTimeout(function(){this.check()}.bind(this))):new e(a,b,f)}function f(a){this.img=a}function g(a,b){this.url=a,this.element=b,this.img=new Image}var h=a.jQuery,i=a.console;e.prototype=Object.create(b.prototype),e.prototype.options={},e.prototype.getImages=function(){this.images=[],this.elements.forEach(this.addElementImages,this)},e.prototype.addElementImages=function(a){"IMG"==a.nodeName&&this.addImage(a),!0===this.options.background&&this.addElementBackgroundImages(a);var b=a.nodeType;if(b&&j[b]){for(var c=a.querySelectorAll("img"),d=0;d<c.length;d++){var e=c[d];this.addImage(e)}if("string"==typeof this.options.background){var f=a.querySelectorAll(this.options.background);for(d=0;d<f.length;d++){var g=f[d];this.addElementBackgroundImages(g)}}}};var j={1:!0,9:!0,11:!0};return e.prototype.addElementBackgroundImages=function(a){var b=getComputedStyle(a);if(b)for(var c=/url\((['"])?(.*?)\1\)/gi,d=c.exec(b.backgroundImage);null!==d;){var e=d&&d[2];e&&this.addBackground(e,a),d=c.exec(b.backgroundImage)}},e.prototype.addImage=function(a){var b=new f(a);this.images.push(b)},e.prototype.addBackground=function(a,b){var c=new g(a,b);this.images.push(c)},e.prototype.check=function(){function a(a,c,d){setTimeout(function(){b.progress(a,c,d)})}var b=this;return this.progressedCount=0,this.hasAnyBroken=!1,this.images.length?void this.images.forEach(function(b){b.once("progress",a),b.check()}):void this.complete()},e.prototype.progress=function(a,b,c){this.progressedCount++,this.hasAnyBroken=this.hasAnyBroken||!a.isLoaded,this.emitEvent("progress",[this,a,b]),this.jqDeferred&&this.jqDeferred.notify&&this.jqDeferred.notify(this,a),this.progressedCount==this.images.length&&this.complete(),this.options.debug&&i&&i.log("progress: "+c,a,b)},e.prototype.complete=function(){var a=this.hasAnyBroken?"fail":"done";if(this.isComplete=!0,this.emitEvent(a,[this]),this.emitEvent("always",[this]),this.jqDeferred){var b=this.hasAnyBroken?"reject":"resolve";this.jqDeferred[b](this)}},f.prototype=Object.create(b.prototype),f.prototype.check=function(){return this.getIsImageComplete()?void this.confirm(0!==this.img.naturalWidth,"naturalWidth"):(this.proxyImage=new Image,this.proxyImage.addEventListener("load",this),this.proxyImage.addEventListener("error",this),this.img.addEventListener("load",this),this.img.addEventListener("error",this),void(this.proxyImage.src=this.img.src))},f.prototype.getIsImageComplete=function(){return this.img.complete&&void 0!==this.img.naturalWidth},f.prototype.confirm=function(a,b){this.isLoaded=a,this.emitEvent("progress",[this,this.img,b])},f.prototype.handleEvent=function(a){var b="on"+a.type;this[b]&&this[b](a)},f.prototype.onload=function(){this.confirm(!0,"onload"),this.unbindEvents()},f.prototype.onerror=function(){this.confirm(!1,"onerror"),this.unbindEvents()},f.prototype.unbindEvents=function(){this.proxyImage.removeEventListener("load",this),this.proxyImage.removeEventListener("error",this),this.img.removeEventListener("load",this),this.img.removeEventListener("error",this)},g.prototype=Object.create(f.prototype),g.prototype.check=function(){this.img.addEventListener("load",this),this.img.addEventListener("error",this),this.img.src=this.url,this.getIsImageComplete()&&(this.confirm(0!==this.img.naturalWidth,"naturalWidth"),this.unbindEvents())},g.prototype.unbindEvents=function(){this.img.removeEventListener("load",this),this.img.removeEventListener("error",this)},g.prototype.confirm=function(a,b){this.isLoaded=a,this.emitEvent("progress",[this,this.element,b])},e.makeJQueryPlugin=function(b){(b=b||a.jQuery)&&(h=b,h.fn.imagesLoaded=function(a,b){return new e(this,a,b).jqDeferred.promise(h(this))})},e.makeJQueryPlugin(),e}),function(a,b){"use strict";var c=function(){var c={bcClass:"sf-breadcrumb",menuClass:"sf-js-enabled",anchorClass:"sf-with-ul",menuArrowClass:"sf-arrows"},d=function(){var b=/^(?![\w\W]*Windows Phone)[\w\W]*(iPhone|iPad|iPod)/i.test(navigator.userAgent);return b&&a("html").css("cursor","pointer").on("click",a.noop),b}(),e=function(){var a=document.documentElement.style;return"behavior"in a&&"fill"in a&&/iemobile/i.test(navigator.userAgent)}(),f=function(){return!!b.PointerEvent}(),g=function(a,b,d){var e,f=c.menuClass;b.cssArrows&&(f+=" "+c.menuArrowClass),e=d?"addClass":"removeClass",a[e](f)},h=function(b,d){return b.find("li."+d.pathClass).slice(0,d.pathLevels).addClass(d.hoverClass+" "+c.bcClass).filter(function(){return a(this).children(d.popUpSelector).hide().show().length}).removeClass(d.pathClass)},i=function(a,b){var d=b?"addClass":"removeClass";a.children("a")[d](c.anchorClass)},j=function(a){var b=a.css("ms-touch-action"),c=a.css("touch-action");c=c||b,c="pan-y"===c?"auto":"pan-y",a.css({"ms-touch-action":c,"touch-action":c})},k=function(a){return a.closest("."+c.menuClass)},l=function(a){return k(a).data("sfOptions")},m=function(){var b=a(this),c=l(b);clearTimeout(c.sfTimer),b.siblings().superfish("hide").end().superfish("show")},n=function(b){b.retainPath=a.inArray(this[0],b.$path)>-1,this.superfish("hide"),this.parents("."+b.hoverClass).length||(b.onIdle.call(k(this)),b.$path.length&&a.proxy(m,b.$path)())},o=function(){var b=a(this),c=l(b);d?a.proxy(n,b,c)():(clearTimeout(c.sfTimer),c.sfTimer=setTimeout(a.proxy(n,b,c),c.delay))},p=function(b){var c=a(this),d=l(c),e=c.siblings(b.data.popUpSelector);return!1===d.onHandleTouch.call(e)?this:void(e.length>0&&e.is(":hidden")&&(c.one("click.superfish",!1),"MSPointerDown"===b.type||"pointerdown"===b.type?c.trigger("focus"):a.proxy(m,c.parent("li"))()))},q=function(b,c){var g="li:has("+c.popUpSelector+")";a.fn.hoverIntent&&!c.disableHI?b.hoverIntent(m,o,g):b.on("mouseenter.superfish",g,m).on("mouseleave.superfish",g,o);var h="MSPointerDown.superfish";f&&(h="pointerdown.superfish"),d||(h+=" touchend.superfish"),e&&(h+=" mousedown.superfish"),b.on("focusin.superfish","li",m).on("focusout.superfish","li",o).on(h,"a",c,p)};return{hide:function(b){if(this.length){var c=this,d=l(c);if(!d)return this;var e=!0===d.retainPath?d.$path:"",f=c.find("li."+d.hoverClass).add(this).not(e).removeClass(d.hoverClass).children(d.popUpSelector),g=d.speedOut;if(b&&(f.show(),g=0),d.retainPath=!1,!1===d.onBeforeHide.call(f))return this;f.stop(!0,!0).animate(d.animationOut,g,function(){var b=a(this);d.onHide.call(b)})}return this},show:function(){var a=l(this);if(!a)return this;var b=this.addClass(a.hoverClass),c=b.children(a.popUpSelector);return!1===a.onBeforeShow.call(c)?this:(c.stop(!0,!0).animate(a.animation,a.speed,function(){a.onShow.call(c)}),this)},destroy:function(){return this.each(function(){var b,d=a(this),e=d.data("sfOptions");return!!e&&(b=d.find(e.popUpSelector).parent("li"),clearTimeout(e.sfTimer),g(d,e),i(b),j(d),d.off(".superfish").off(".hoverIntent"),b.children(e.popUpSelector).attr("style",function(a,b){return b.replace(/display[^;]+;?/g,"")}),e.$path.removeClass(e.hoverClass+" "+c.bcClass).addClass(e.pathClass),d.find("."+e.hoverClass).removeClass(e.hoverClass),e.onDestroy.call(d),void d.removeData("sfOptions"))})},init:function(b){return this.each(function(){var d=a(this);if(d.data("sfOptions"))return!1;var e=a.extend({},a.fn.superfish.defaults,b),f=d.find(e.popUpSelector).parent("li");e.$path=h(d,e),d.data("sfOptions",e),g(d,e,!0),i(f,!0),j(d),q(d,e),f.not("."+c.bcClass).superfish("hide",!0),e.onInit.call(this)})}}}();a.fn.superfish=function(b,d){return c[b]?c[b].apply(this,Array.prototype.slice.call(arguments,1)):"object"!=typeof b&&b?a.error("Method "+b+" does not exist on jQuery.fn.superfish"):c.init.apply(this,arguments)},a.fn.superfish.defaults={popUpSelector:"ul,.sf-mega",hoverClass:"sfHover",pathClass:"overrideThisToUse",pathLevels:1,delay:800,animation:{opacity:"show"},animationOut:{opacity:"hide"},speed:"normal",speedOut:"fast",cssArrows:!0,disableHI:!1,onInit:a.noop,onBeforeShow:a.noop,onShow:a.noop,onBeforeHide:a.noop,onHide:a.noop,onIdle:a.noop,onDestroy:a.noop,onHandleTouch:a.noop}}(jQuery,window),function(a){"function"==typeof define&&define.amd?define(["jquery"],a):a(jQuery)}(function(a){var b=0,c=Array.prototype.slice;a.cleanData=function(b){return function(c){var d,e,f;for(f=0;null!=(e=c[f]);f++)try{(d=a._data(e,"events"))&&d.remove&&a(e).triggerHandler("remove")}catch(g){}b(c)}}(a.cleanData),a.widget=function(b,c,d){var e,f,g,h,i={},j=b.split(".")[0];return b=b.split(".")[1],e=j+"-"+b,d||(d=c,c=a.Widget),a.expr[":"][e.toLowerCase()]=function(b){return!!a.data(b,e)},a[j]=a[j]||{},f=a[j][b],g=a[j][b]=function(a,b){return this._createWidget?void(arguments.length&&this._createWidget(a,b)):new g(a,b)},a.extend(g,f,{version:d.version,_proto:a.extend({},d),_childConstructors:[]}),h=new c,h.options=a.widget.extend({},h.options),a.each(d,function(b,d){return a.isFunction(d)?void(i[b]=function(){var a=function(){return c.prototype[b].apply(this,arguments)},e=function(a){return c.prototype[b].apply(this,a)};return function(){var b,c=this._super,f=this._superApply;return this._super=a,this._superApply=e,b=d.apply(this,arguments),this._super=c,this._superApply=f,b}}()):void(i[b]=d)}),g.prototype=a.widget.extend(h,{widgetEventPrefix:f?h.widgetEventPrefix||b:b},i,{constructor:g,namespace:j,widgetName:b,widgetFullName:e}),f?(a.each(f._childConstructors,function(b,c){var d=c.prototype;a.widget(d.namespace+"."+d.widgetName,g,c._proto)}),delete f._childConstructors):c._childConstructors.push(g),a.widget.bridge(b,g),g},a.widget.extend=function(b){for(var d,e,f=c.call(arguments,1),g=0,h=f.length;h>g;g++)for(d in f[g])e=f[g][d],f[g].hasOwnProperty(d)&&void 0!==e&&(b[d]=a.isPlainObject(e)?a.isPlainObject(b[d])?a.widget.extend({},b[d],e):a.widget.extend({},e):e);return b},a.widget.bridge=function(b,d){var e=d.prototype.widgetFullName||b;a.fn[b]=function(f){var g="string"==typeof f,h=c.call(arguments,1),i=this;return f=!g&&h.length?a.widget.extend.apply(null,[f].concat(h)):f,g?this.each(function(){var c,d=a.data(this,e);return"instance"===f?(i=d,!1):d?a.isFunction(d[f])&&"_"!==f.charAt(0)?(c=d[f].apply(d,h),c!==d&&void 0!==c?(i=c&&c.jquery?i.pushStack(c.get()):c,!1):void 0):a.error("no such method '"+f+"' for "+b+" widget instance"):a.error("cannot call methods on "+b+" prior to initialization; attempted to call method '"+f+"'")}):this.each(function(){var b=a.data(this,e);b?(b.option(f||{}),b._init&&b._init()):a.data(this,e,new d(f,this))}),i}},a.Widget=function(){},a.Widget._childConstructors=[],a.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",defaultElement:"<div>",options:{disabled:!1,create:null},_createWidget:function(c,d){d=a(d||this.defaultElement||this)[0],this.element=a(d),this.uuid=b++,this.eventNamespace="."+this.widgetName+this.uuid,this.bindings=a(),this.hoverable=a(),this.focusable=a(),d!==this&&(a.data(d,this.widgetFullName,this),this._on(!0,this.element,{remove:function(a){a.target===d&&this.destroy()}}),this.document=a(d.style?d.ownerDocument:d.document||d),this.window=a(this.document[0].defaultView||this.document[0].parentWindow)),this.options=a.widget.extend({},this.options,this._getCreateOptions(),c),this._create(),this._trigger("create",null,this._getCreateEventData()),this._init()},_getCreateOptions:a.noop,_getCreateEventData:a.noop,_create:a.noop,_init:a.noop,destroy:function(){this._destroy(),this.element.unbind(this.eventNamespace).removeData(this.widgetFullName).removeData(a.camelCase(this.widgetFullName)),this.widget().unbind(this.eventNamespace).removeAttr("aria-disabled").removeClass(this.widgetFullName+"-disabled ui-state-disabled"),this.bindings.unbind(this.eventNamespace),this.hoverable.removeClass("ui-state-hover"),this.focusable.removeClass("ui-state-focus")},_destroy:a.noop,widget:function(){return this.element},option:function(b,c){var d,e,f,g=b;if(0===arguments.length)return a.widget.extend({},this.options);if("string"==typeof b)if(g={},d=b.split("."),b=d.shift(),d.length){for(e=g[b]=a.widget.extend({},this.options[b]),f=0;d.length-1>f;f++)e[d[f]]=e[d[f]]||{},e=e[d[f]];if(b=d.pop(),1===arguments.length)return void 0===e[b]?null:e[b];e[b]=c}else{if(1===arguments.length)return void 0===this.options[b]?null:this.options[b];g[b]=c}return this._setOptions(g),this},_setOptions:function(a){var b;for(b in a)this._setOption(b,a[b]);return this},_setOption:function(a,b){return this.options[a]=b,"disabled"===a&&(this.widget().toggleClass(this.widgetFullName+"-disabled",!!b),b&&(this.hoverable.removeClass("ui-state-hover"),this.focusable.removeClass("ui-state-focus"))),this},enable:function(){return this._setOptions({disabled:!1})},disable:function(){return this._setOptions({disabled:!0})},_on:function(b,c,d){var e,f=this;"boolean"!=typeof b&&(d=c,c=b,b=!1),d?(c=e=a(c),this.bindings=this.bindings.add(c)):(d=c,c=this.element,e=this.widget()),a.each(d,function(d,g){function h(){return b||!0!==f.options.disabled&&!a(this).hasClass("ui-state-disabled")?("string"==typeof g?f[g]:g).apply(f,arguments):void 0}"string"!=typeof g&&(h.guid=g.guid=g.guid||h.guid||a.guid++);var i=d.match(/^([\w:-]*)\s*(.*)$/),j=i[1]+f.eventNamespace,k=i[2];k?e.delegate(k,j,h):c.bind(j,h)})},_off:function(b,c){c=(c||"").split(" ").join(this.eventNamespace+" ")+this.eventNamespace,b.unbind(c).undelegate(c),this.bindings=a(this.bindings.not(b).get()),this.focusable=a(this.focusable.not(b).get()),this.hoverable=a(this.hoverable.not(b).get())},_delay:function(a,b){function c(){return("string"==typeof a?d[a]:a).apply(d,arguments)}var d=this;return setTimeout(c,b||0)},_hoverable:function(b){this.hoverable=this.hoverable.add(b),this._on(b,{mouseenter:function(b){a(b.currentTarget).addClass("ui-state-hover")},mouseleave:function(b){a(b.currentTarget).removeClass("ui-state-hover")}})},_focusable:function(b){this.focusable=this.focusable.add(b),this._on(b,{focusin:function(b){a(b.currentTarget).addClass("ui-state-focus")},focusout:function(b){a(b.currentTarget).removeClass("ui-state-focus")}})},_trigger:function(b,c,d){var e,f,g=this.options[b];if(d=d||{},c=a.Event(c),c.type=(b===this.widgetEventPrefix?b:this.widgetEventPrefix+b).toLowerCase(),c.target=this.element[0],f=c.originalEvent)for(e in f)e in c||(c[e]=f[e]);return this.element.trigger(c,d),!(a.isFunction(g)&&!1===g.apply(this.element[0],[c].concat(d))||c.isDefaultPrevented())}},a.each({show:"fadeIn",hide:"fadeOut"},function(b,c){a.Widget.prototype["_"+b]=function(d,e,f){"string"==typeof e&&(e={effect:e});var g,h=e?!0===e||"number"==typeof e?c:e.effect||c:b;e=e||{},"number"==typeof e&&(e={duration:e}),g=!a.isEmptyObject(e),e.complete=f,e.delay&&d.delay(e.delay),g&&a.effects&&a.effects.effect[h]?d[b](e):h!==b&&d[h]?d[h](e.duration,e.easing,f):d.queue(function(c){a(this)[b](),f&&f.call(d[0]),c()})}}),a.widget}),function(a){"use strict";a.widget("aerolab.midnight",{options:{headerClass:"midnightHeader",innerClass:"midnightInner",defaultClass:"default",classPrefix:"",otherObjects:"",otherObjectHeight:""},_headers:{},_headerInfo:{top:0,height:0},_$sections:[],_sections:[],_scrollTop:0,_documentHeight:0,_transformMode:!1,_currentClass:"",_transformY:0,refresh:function(){this._headerInfo={top:0,height:0},this._$sections=a("[data-midnight]"),this._sections=[],this._setupHeaders(),this.recalculate()},_create:function(){var b=this;if(this._scrollTop=window.pageYOffset||document.documentElement.scrollTop,this._documentHeight=a(document).height(),this._headers={},this._transformMode=this._getSupportedTransform(),this.refresh(),setInterval(function(){b._recalculateSections()},1e3),a(window).resize(function(){b.recalculate()}).trigger("resize"),this._updateHeadersLoop(),this.options.otherObjects){var c=0;c=this.options.otherObjectHeight?this.options.otherObjectHeight:a(this.options.otherObjects).outerHeight(),this._transformY=c/2+(this.element.position().top+parseInt(this.element.css("marginTop")))}},recalculate:function(){this._recalculateSections(),this._updateHeaderHeight(),this._recalculateHeaders(),this._updateHeaders()},_getSupportedTransform:function(){for(var a=["transform","WebkitTransform","MozTransform","OTransform","msTransform"],b=0;b<a.length;b++)if(void 0!==document.createElement("div").style[a[b]])return a[b];return!1},_getContainerHeight:function(){var b=this.element.find("> ."+this.options.headerClass),c=0,d=0,e=this;return b.length?b.each(function(){var b=a(this),f=b.find("> ."+e.options.innerClass);f.length?(f.css("bottom","auto").css("overflow","auto"),d=f.outerHeight(),f.css("bottom","0")):(b.css("bottom","auto"),d=b.outerHeight(),b.css("bottom","0")),c=d>c?d:c}):c=d=this.element.outerHeight(),c},_setupHeaders:function(){var b=this;this._headers[this.options.defaultClass]={},this._$sections.each(function(){var c=a(this),d=c.data("midnight");"string"==typeof d&&""!==(d=d.trim())&&(b._headers[d]={})});this.element.css("padding-top"),this.element.css("padding-right"),this.element.css("padding-bottom"),this.element.css("padding-left")},_recalculateHeaders:function(){this._scrollTop=window.pageYOffset||document.body.scrollTop||document.documentElement.scrollTop,this._scrollTop=Math.max(this._scrollTop,0),this._scrollTop=Math.min(this._scrollTop,this._documentHeight);var a=this._headerInfo.height,b=this._scrollTop+this._headerInfo.top,c=b+a;if("function"==typeof window.getComputedStyle){var d=window.getComputedStyle(this.element[0],null),e=0,f=this._transformY;if(!1!==this._transformMode&&"string"==typeof d.transform){var g=d.transform.match(/(-?[0-9\.]+)/g);null!==g&&g.length>=6&&!isNaN(parseFloat(g[5]))&&(f=parseFloat(g[5]))}b+=e+f,c+=e+f}for(var h in this._headers)this._headers.hasOwnProperty(h)&&(this._headers[h].from="",this._headers[h].progress=0);for(var i=0;i<this._sections.length;i++)c>=this._sections[i].start&&b<=this._sections[i].end&&(this._headers[this._sections[i].className].visible=!0,b>=this._sections[i].start&&c<=this._sections[i].end?(this._headers[this._sections[i].className].from="top",this._headers[this._sections[i].className].progress+=1):c>this._sections[i].end&&b<this._sections[i].end?(this._headers[this._sections[i].className].from="top", this._headers[this._sections[i].className].progress=1-(c-this._sections[i].end)/a):c>this._sections[i].start&&b<this._sections[i].start&&("top"===this._headers[this._sections[i].className].from?this._headers[this._sections[i].className].progress+=(c-this._sections[i].start)/a:(this._headers[this._sections[i].className].from="bottom",this._headers[this._sections[i].className].progress=(c-this._sections[i].start)/a)))},_updateHeaders:function(){if(void 0!==this._headers[this.options.defaultClass]){var b="",b="";for(var c in this._headers)this._headers.hasOwnProperty(c)&&""!==!this._headers[c].from&&1==this._headers[c].progress&&(this._currentClass!=c&&(this.element.attr("data-color",c),this._currentClass=c,this.options.otherObjects&&a(this.options.otherObjects).attr("data-color",c)),b=c);return void(""==b&&this._currentClass!=b&&(this.element.attr("data-color","default"),this._currentClass="default",this.options.otherObjects&&a(this.options.otherObjects).attr("data-color","default")))}},_recalculateSections:function(){this._documentHeight=a(document).height(),this._sections=[];for(var b=0;b<this._$sections.length;b++){var c=a(this._$sections[b]),d=!1;"none"==c.parent(".row_section").css("display")&&(d=!0),d||this._sections.push({element:c,className:c.data("midnight"),start:c.offset().top,end:c.offset().top+c.outerHeight()})}},_updateHeaderHeight:function(){},_updateHeadersLoop:function(){var a=this;this._requestAnimationFrame(function(){a._updateHeadersLoop()}),this._recalculateHeaders(),this._updateHeaders()},_requestAnimationFrame:function(a){var b=b||function(){return window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||function(a){window.setTimeout(a,1e3/60)}}();b(a)}})}(jQuery),function(a){"function"==typeof define&&define.amd?define(["jquery"],a):a("object"==typeof module&&module.exports?require("jquery"):jQuery)}(function(a){var b={},c={exclude:[],excludeWithin:[],offset:0,direction:"top",delegateSelector:null,scrollElement:null,scrollTarget:null,beforeScroll:function(){},afterScroll:function(){},easing:"swing",speed:400,autoCoefficient:2,preventDefault:!0,animationEngine:""},d=function(b){var c=[],d=!1,e=b.dir&&"left"===b.dir?"scrollLeft":"scrollTop";return this.each(function(){var b=a(this);if(this!==document&&this!==window)return!document.scrollingElement||this!==document.documentElement&&this!==document.body?void(b[e]()>0?c.push(this):(b[e](1),d=b[e]()>0,d&&c.push(this),b[e](0))):(c.push(document.scrollingElement),!1)}),c.length||this.each(function(){this===document.documentElement&&"smooth"===a(this).css("scrollBehavior")&&(c=[this]),c.length||"BODY"!==this.nodeName||(c=[this])}),"first"===b.el&&c.length>1&&(c=[c[0]]),c};a.fn.extend({scrollable:function(a){var b=d.call(this,{dir:a});return this.pushStack(b)},firstScrollable:function(a){var b=d.call(this,{el:"first",dir:a});return this.pushStack(b)},smoothScroll:function(b,c){if("options"===(b=b||{}))return c?this.each(function(){var b=a(this),d=a.extend(b.data("ssOpts")||{},c);a(this).data("ssOpts",d)}):this.first().data("ssOpts");var d=a.extend({},a.fn.smoothScroll.defaults,b),e=function(b){var c=function(a){return a.replace(/(:|\.|\/)/g,"\\$1")},e=this,f=a(this),g=a.extend({},d,f.data("ssOpts")||{}),h=d.exclude,i=g.excludeWithin,j=0,k=0,l=!0,m={},n=a.smoothScroll.filterPath(location.pathname),o=a.smoothScroll.filterPath(e.pathname),p=location.hostname===e.hostname||!e.hostname,q=g.scrollTarget||o===n,r=c(e.hash);if(r&&!a(r).length&&(l=!1),g.scrollTarget||p&&q&&r){for(;l&&j<h.length;)f.is(c(h[j++]))&&(l=!1);for(;l&&k<i.length;)f.closest(i[k++]).length&&(l=!1)}else l=!1;l&&(g.preventDefault&&b.preventDefault(),a.extend(m,g,{scrollTarget:g.scrollTarget||r,link:e}),a.smoothScroll(m))};return null!==b.delegateSelector?this.undelegate(b.delegateSelector,"click.smoothscroll").delegate(b.delegateSelector,"click.smoothscroll",e):this.unbind("click.smoothscroll").bind("click.smoothscroll",e),this}}),a.smoothScroll=function(c,d){if("options"===c&&"object"==typeof d)return a.extend(b,d);var e,f,g,h,i,j=0,k="offset",l="scrollTop",m={},n={};"number"==typeof c?(e=a.extend({link:null},a.fn.smoothScroll.defaults,b),g=c):(e=a.extend({link:null},a.fn.smoothScroll.defaults,c||{},b),e.scrollElement&&(k="position","static"===e.scrollElement.css("position")&&e.scrollElement.css("position","relative"))),l="left"===e.direction?"scrollLeft":l,e.scrollElement?(f=e.scrollElement,/^(?:HTML|BODY)$/.test(f[0].nodeName)||(j=f[l]())):f=a("html, body").firstScrollable(e.direction),e.beforeScroll.call(f,e),g="number"==typeof c?c:d||a(e.scrollTarget)[k]()&&a(e.scrollTarget)[k]()[e.direction]||0,m[l]=g+j+e.offset,h=e.speed,"auto"===h&&(i=Math.abs(m[l]-f[l]()),h=i/e.autoCoefficient),n={duration:h,easing:e.easing,complete:function(){e.afterScroll.call(e.link,e)}},e.step&&(n.step=e.step),f.length?"velocity"==e.animationEngine?a(e.scrollTarget).velocity("stop").velocity("scroll",n):f.stop().animate(m,n):e.afterScroll.call(e.link,e)},a.smoothScroll.version="1.7.2",a.smoothScroll.filterPath=function(a){return a=a||"",a.replace(/^\//,"").replace(/(?:index|default).[a-zA-Z]{3,4}$/,"").replace(/\/$/,"")},a.fn.smoothScroll.defaults=c}),function(a,b){"use strict";"function"==typeof define&&define.amd?define("seriously",function(){var c=b(a);return a.Seriously||(a.Seriously=c),c}):"object"==typeof exports?module.exports=b(a):"function"!=typeof a.Seriously&&(a.Seriously=b(a))}(window,function(a){"use strict";function b(a,b){var c,d;if("string"==typeof a)c=x.querySelector(a);else if(!a)return!1;return a.tagName&&(c=a),c?(d=c.tagName.toLowerCase(),b&&b.indexOf(d)<0?a:c):a}function c(a,b){var d,e;a.prototype&&b.prototype&&a.prototype!==b.prototype&&c(a.prototype,b.prototype);for(d in b)b.hasOwnProperty(d)&&(e=Object.getOwnPropertyDescriptor(b,d),e.get||e.set?Object.defineProperty(a,d,{configurable:!0,enumerable:!0,get:e.get,set:e.set}):a[d]=b[d]);return a}function d(a){var b;if(!y)return K;if("function"==typeof y[a])b=y[a];else{if("function"!=typeof y.log)return K;b=y.log}return b.bind?b.bind(y):function(){b.apply(y,arguments)}}function e(b,c){if(c||(c="HTMLElement"),b instanceof a[c])return!0;if(!b||"object"!=typeof b)return!1;for(;b;)if((b=Object.getPrototypeOf(b))&&b.constructor.name===c)return!0;return!1}function f(a,b,c,d,e){function f(a,b,c){return c%=1,c<0&&(c+=1),c<1/6?a+(b-a)*c*6:c<.5?b:c<2/3?a+(b-a)*(2/3-c)*6:a}var g,h;return h=c<.5?c*(b+1):c+b-c*b,g=2*c-h,e||(e=[]),e[0]=f(g,h,a+1/3),e[1]=f(g,h,a),e[2]=f(g,h,a-1/3),e[3]=d,e}function g(a){var b,c,d,e="#",f=a[3]<1?4:3;for(b=0;b<f;b++)c=Math.min(255,Math.round(255*a[b]||0)),d=c.toString(16),c<16&&(d="0"+d),e+=d;return e}function h(a){return Array.isArray(a)||a&&a.BYTES_PER_ELEMENT&&"length"in a}function i(b){function c(){D.length&&D.shift()()}if("function"!=typeof b)throw new Error("setTimeoutZero argument is not a function");if(D.push(b),"file:"===a.location.protocol)return void setTimeout(c,0);a.postMessage("seriously-timeout-message",a.location)}function j(b,c){var d;try{d=a.WebGLDebugUtils&&c&&c.debugContext?a.WebGLDebugUtils.makeDebugContext(b.getContext("webgl",c)):b.getContext("webgl",c)}catch(e){}if(!d)try{d=b.getContext("experimental-webgl",c)}catch(f){}return d}function k(){var b;return q&&q.getError()===q.CONTEXT_LOST_WEBGL&&(q=void 0),q||!a.WebGLRenderingContext||s?q:(b=x.createElement("canvas"),q=j(b),q?b.addEventListener("webglcontextlost",function a(c){c.preventDefault(),q&&q.canvas===this&&(q=void 0,b.removeEventListener("webglcontextlost",a,!1))},!1):p.logger.warn("Unable to access WebGL."),q)}function l(c){var d,e,f,g;if(!(d=b(c,["img","canvas","video"])))return!1;if(!(e=x.createElement("canvas")))return p.logger.warn("Browser does not support canvas or Seriously.js"),!1;if(0===d.naturalWidth&&"IMG"===d.tagName)return p.logger.warn("Image not loaded"),!1;if(0===d.readyState&&0===d.videoWidth&&"VIDEO"===d.tagName)return p.logger.warn("Video not loaded"),!1;if(f=k()){g=f.createTexture(),g||p.logger.error("Test WebGL context has been lost"),f.bindTexture(f.TEXTURE_2D,g);try{f.texImage2D(f.TEXTURE_2D,0,f.RGBA,f.RGBA,f.UNSIGNED_BYTE,d)}catch(h){return h.code===a.DOMException.SECURITY_ERR?p.logger.log("Unable to access cross-domain image"):p.logger.error("Error storing image to texture: "+h.message),f.deleteTexture(g),!1}f.deleteTexture(g)}else{f=e.getContext("2d");try{f.drawImage(d,0,0),f.getImageData(0,0,1,1)}catch(i){return i.code===a.DOMException.SECURITY_ERR?p.logger.log("Unable to access cross-domain image"):p.logger.error("Error drawing image to canvas: "+i.message),!1}}return!0}function m(a){function b(a,b){var c,f;h(a)?(c=a[0],f=a[1]||c):c=a,"string"==typeof c?c=c.toLowerCase():"number"==typeof c?c=String(c):c||(c=""),e[c]=f,b||(d.firstValue=c)}function c(a){return a}var d,e,f;for(f in a.inputs)if(a.inputs.hasOwnProperty(f)){if(a.reserved.indexOf(f)>=0||Object.prototype[f])throw new Error("Reserved input name: "+f);d=a.inputs[f],d.name=f,isNaN(d.min)&&(d.min=-1/0),isNaN(d.max)&&(d.max=1/0),isNaN(d.minCount)&&(d.minCount=-1/0),isNaN(d.maxCount)&&(d.maxCount=1/0),isNaN(d.step)&&(d.step=0),isNaN(d.mod)&&(d.mod=0),"enum"===d.type&&d.options&&h(d.options)&&d.options.length&&(e={},d.options.forEach(b),d.options=e),"vector"===d.type?d.dimensions<2?d.dimensions=2:d.dimensions>4?d.dimensions=4:!d.dimensions||isNaN(d.dimensions)?d.dimensions=4:d.dimensions=Math.round(d.dimensions):d.dimensions=1,d.shaderDirty=!!d.shaderDirty,"function"!=typeof d.validate&&(d.validate=p.inputValidators[d.type]||c),a.defaultImageInput||"image"!==d.type||(a.defaultImageInput=f)}}function n(a,b,c,d){var e,f,g,h,i=!0===d?d:d&&d.useFloat;i=!1,this.type=i?a.FLOAT:a.UNSIGNED_BYTE,e=a.createFramebuffer(),a.bindFramebuffer(a.FRAMEBUFFER,e),d&&d.texture?(this.texture=d.texture,a.bindTexture(a.TEXTURE_2D,this.texture),this.ownTexture=!1):(this.texture=a.createTexture(),a.bindTexture(a.TEXTURE_2D,this.texture),a.pixelStorei(a.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MAG_FILTER,a.LINEAR),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MIN_FILTER,a.LINEAR),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_S,a.CLAMP_TO_EDGE),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_T,a.CLAMP_TO_EDGE),this.ownTexture=!0);try{this.type===a.FLOAT?(g=new Float32Array(b*c*4),a.texImage2D(a.TEXTURE_2D,0,a.RGBA,b,c,0,a.RGBA,a.FLOAT,g)):(a.texImage2D(a.TEXTURE_2D,0,a.RGBA,b,c,0,a.RGBA,a.UNSIGNED_BYTE,null),this.type=a.UNSIGNED_BYTE)}catch(j){this.type=a.UNSIGNED_BYTE,g=new Uint8Array(b*c*4),a.texImage2D(a.TEXTURE_2D,0,a.RGBA,b,c,0,a.RGBA,a.UNSIGNED_BYTE,g)}if(f=a.createRenderbuffer(),a.bindRenderbuffer(a.RENDERBUFFER,f),a.renderbufferStorage(a.RENDERBUFFER,a.DEPTH_COMPONENT16,b,c),a.framebufferRenderbuffer(a.FRAMEBUFFER,a.DEPTH_ATTACHMENT,a.RENDERBUFFER,f),a.framebufferTexture2D(a.FRAMEBUFFER,a.COLOR_ATTACHMENT0,a.TEXTURE_2D,this.texture,0),(h=a.checkFramebufferStatus(a.FRAMEBUFFER))===a.FRAMEBUFFER_INCOMPLETE_ATTACHMENT)throw new Error("Incomplete framebuffer: FRAMEBUFFER_INCOMPLETE_ATTACHMENT");if(h===a.FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT)throw new Error("Incomplete framebuffer: FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT");if(h===a.FRAMEBUFFER_INCOMPLETE_DIMENSIONS)throw new Error("Incomplete framebuffer: FRAMEBUFFER_INCOMPLETE_DIMENSIONS");if(h===a.FRAMEBUFFER_UNSUPPORTED)throw new Error("Incomplete framebuffer: FRAMEBUFFER_UNSUPPORTED");if(h!==a.FRAMEBUFFER_COMPLETE)throw new Error("Incomplete framebuffer: "+h);a.bindTexture(a.TEXTURE_2D,null),a.bindRenderbuffer(a.RENDERBUFFER,null),a.bindFramebuffer(a.FRAMEBUFFER,null),this.gl=a,this.frameBuffer=e,this.renderBuffer=f,this.width=b,this.height=c}function o(a,b,c){function d(b,c){var d,e;if(d=c?a.createShader(a.FRAGMENT_SHADER):a.createShader(a.VERTEX_SHADER),a.shaderSource(d,b),a.compileShader(d),!a.getShaderParameter(d,a.COMPILE_STATUS)){for(b=b.split(/[\n\r]/),e=0;e<b.length;e++)b[e]=e+1+":\t"+b[e];throw b.unshift("Error compiling "+(c?"fragment":"vertex")+" shader:"),p.logger.error(b.join("\n")),new Error("Shader error: "+a.getShaderInfoLog(d))}return d}function e(b,c){if(b.type===a.SAMPLER_2D)return function(d){b.glTexture=a["TEXTURE"+d],a.uniform1i(c,d)};if(b.type===a.BOOL||b.type===a.INT)return b.size>1?function(b){a.uniform1iv(c,b)}:function(b){a.uniform1i(c,b)};if(b.type===a.FLOAT)return b.size>1?function(b){a.uniform1fv(c,b)}:function(b){a.uniform1f(c,b)};if(b.type===a.FLOAT_VEC2)return function(b){a.uniform2f(c,b[0],b[1])};if(b.type===a.FLOAT_VEC3)return function(b){a.uniform3f(c,b[0],b[1],b[2])};if(b.type===a.FLOAT_VEC4)return function(b){a.uniform4f(c,b[0],b[1],b[2],b[3])};if(b.type===a.FLOAT_MAT3)return function(b){a.uniformMatrix3fv(c,!1,b)};if(b.type===a.FLOAT_MAT4)return function(b){a.uniformMatrix4fv(c,!1,b)};throw new Error("Unknown shader uniform type: "+b.type)}function f(b){return function(){return a.getUniform(g,b)}}var g,h,i,j,k,l,m,n,o="";if(h=d(b),i=d(c,!0),g=a.createProgram(),a.attachShader(g,h),j=a.getShaderInfoLog(h),j&&(o+="Vertex shader error: "+j+"\n"),a.attachShader(g,i),j=a.getShaderInfoLog(i),j&&(o+="Fragment shader error: "+j+"\n"),a.linkProgram(g),!a.getProgramParameter(g,a.LINK_STATUS))throw o+=a.getProgramInfoLog(g),a.deleteProgram(g),a.deleteShader(h),a.deleteShader(i),m=S.exec(b)||S.exec(c),m&&(o="Shader = "+m[1]+"\n"+o),R.forEach(function(b){o+="\n"+b+": "+a.getParameter(a[b])}),new Error("Could not initialize shader:\n"+o);for(a.useProgram(g),this.uniforms={},l=a.getProgramParameter(g,a.ACTIVE_UNIFORMS),k=0;k<l;++k)n={info:a.getActiveUniform(g,k)},n.name=n.info.name.replace(/\[0\]$/,""),n.loc=a.getUniformLocation(g,n.name),n.set=e(n.info,n.loc),n.get=f(n.loc),this.uniforms[n.name]=n,this[n.name]||(this[n.name]=n);for(this.attributes={},this.location={},l=a.getProgramParameter(g,a.ACTIVE_ATTRIBUTES),k=0;k<l;++k)n={info:a.getActiveAttrib(g,k)},n.name=n.info.name,n.location=a.getAttribLocation(g,n.name),this.attributes[n.name]=n,this.location[n.name]=n.location;this.gl=a,this.program=g,this.destroy=function(){var b;a&&(a.deleteProgram(g),a.deleteShader(h),a.deleteShader(i));for(b in this)this.hasOwnProperty(b)&&delete this[b];g=null,h=null,i=null}}function p(d){function f(a,b){var c,d,e;return!!b&&(c=b.createBuffer(),b.bindBuffer(b.ARRAY_BUFFER,c),b.bufferData(b.ARRAY_BUFFER,a.vertices,b.STATIC_DRAW),c.size=3,d=b.createBuffer(),b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,d),b.bufferData(b.ELEMENT_ARRAY_BUFFER,a.indices,b.STATIC_DRAW),e=b.createBuffer(),b.bindBuffer(b.ARRAY_BUFFER,e),b.bufferData(b.ARRAY_BUFFER,a.coords,b.STATIC_DRAW),e.size=2,{vertex:c,index:d,texCoord:e,length:a.indices.length,mode:a.mode||b.TRIANGLES})}function h(a){var b={};return b.vertices=new Float32Array([-1,-1,0,1,-1,0,1,1,0,-1,1,0]),b.indices=new Uint16Array([0,1,2,0,2,3]),b.coords=new Float32Array([0,0,1,0,1,1,0,1]),f(b,a)}function k(a){var b,c;if(!H){if(a.canvas.addEventListener("webglcontextlost",q,!1),a.canvas.addEventListener("webglcontextrestored",l,!1),a.isContextLost())return void p.logger.warn("Unable to attach lost WebGL context. Will try again when context is restored.");for(H=a,D=a.canvas,M=h(H),N=new o(H,"#define SHADER_NAME seriously.base\n"+v,"#define SHADER_NAME seriously.base\n"+w),b=0;b<ka.length;b++)c=ka[b],c.gl=H,c.initialize(),c.buildShader();for(b=0;b<ha.length;b++)c=ha[b],c.initialize();for(b=0;b<ia.length;b++)c=ia[b],c.model||(c.model=M,c.shader=N)}}function l(){var a,b,c,d;if(L&&!H){if(b=L.target,e(b,"WebGLFramebuffer"))return void p.logger.error("Unable to restore target built on WebGLFramebuffer");if(a=j(b,{alpha:!0,premultipliedAlpha:!0,preserveDrawingBuffer:!0,stencil:!0,debugContext:L.debugContext})){if(a.isContextLost())return void p.logger.error("Unable to restore WebGL Context");for(k(a),L.renderToTexture?L.frameBuffer=new n(H,L.width,L.height,!1):L.frameBuffer={frameBuffer:null},c=0;c<ea.length;c++)d=ea[c],d.setDirty(),d.emit("webglcontextrestored");p.logger.log("WebGL context restored")}}}function q(a){var b,c;for(a&&(p.logger.warn("WebGL context lost"),a.preventDefault()),ba&&(V(ba),ba=0),D&&D.removeEventListener("webglcontextlost",q,!1),b=0;b<ka.length;b++)c=ka[b],c.gl=null,c.initialized=!1,c.baseShader=null,c.model=null,c.frameBuffer=null,c.texture=null,c.shader&&c.shader.destroy&&(c.shader.destroy(),c.effect.commonShader&&delete pa[c.hook]),c.shaderDirty=!0,c.shader=null,c.effect.lostContext&&c.effect.lostContext.call(c),a&&c.emit("webglcontextlost");for(b=0;b<ha.length;b++)c=ha[b],c.texture=null,c.initialized=!1,c.allowRefresh=!1,a&&c.emit("webglcontextlost");for(b=0;b<ja.length;b++)c=ja[b],c.frameBuffer=null,c.texture=null,a&&c.emit("webglcontextlost");for(b=0;b<ia.length;b++)c=ia[b],c.model=!1,c.frameBuffer=null,a&&c.emit("webglcontextlost");N&&N.destroy&&N.destroy(),H&&(H.deleteBuffer(M.vertex),H.deleteBuffer(M.texCoord),H.deleteBuffer(M.index)),M&&(delete M.vertex,delete M.texCoord,delete M.index),M=null,N=null,H=null,D=null}function r(a){var b,c,d=!1;if(ba=0,ma.length)for(d=!0,b=0;b<ma.length;b++)ma[b].call(da,a);if(ha&&ha.length)for(d=!0,b=0;b<ha.length;b++)c=ha[b],(c.dirty||c.checkDirty&&c.checkDirty())&&(c.dirty=!1,c.setDirty());for(b=0;b<ia.length;b++)c=ia[b],c.auto&&c.dirty&&c.render();if(na.length)for(d=!0,b=0;b<na.length;b++)na[b].call(da);d&&!ba&&(ba=U(r))}function s(a,b,c,d,f,g){var h,i,j,k,l,m,n,o,p,q=0,r=f&&f.gl||H;if(r){f?(k=g&&g.width||f.width||r.canvas.width,l=g&&g.height||f.height||r.canvas.height):(k=g&&g.width||r.canvas.width,l=g&&g.height||r.canvas.height),a.use(),r.viewport(0,0,k,l),r.bindFramebuffer(r.FRAMEBUFFER,d),r.enableVertexAttribArray(a.location.position),r.enableVertexAttribArray(a.location.texCoord),b.texCoord&&(r.bindBuffer(r.ARRAY_BUFFER,b.texCoord),r.vertexAttribPointer(a.location.texCoord,b.texCoord.size,r.FLOAT,!1,0,0)),r.bindBuffer(r.ARRAY_BUFFER,b.vertex),r.vertexAttribPointer(a.location.position,b.vertex.size,r.FLOAT,!1,0,0),r.bindBuffer(r.ELEMENT_ARRAY_BUFFER,b.index),g&&g.depth?H.enable(H.DEPTH_TEST):H.disable(H.DEPTH_TEST),g?void 0===g.blend||g.blend?(H.enable(H.BLEND),m=void 0===g.srcRGB?H.ONE:g.srcRGB,o=g.dstRGB||H.ZERO,n=void 0===g.srcAlpha?m:g.srcAlpha,p=void 0===g.dstAlpha?o:g.dstAlpha,H.blendFuncSeparate(m,o,n,p),H.blendEquation(g.blendEquation||H.FUNC_ADD)):H.disable(H.BLEND):(H.enable(H.BLEND),H.blendFunc(H.ONE,H.ZERO),H.blendEquation(H.FUNC_ADD));for(h in c)c.hasOwnProperty(h)&&(i=c[h],(j=a.uniforms[h])&&(e(i,"WebGLTexture")?(r.activeTexture(r.TEXTURE0+q),r.bindTexture(r.TEXTURE_2D,i),j.set(q),q++):i instanceof P||i instanceof R||i instanceof W?i.texture&&(r.activeTexture(r.TEXTURE0+q),r.bindTexture(r.TEXTURE_2D,i.texture),j.set(q),q++):void 0!==i&&null!==i&&j.set(i)));g&&void 0!==g.clear&&!g.clear||(r.clearColor(0,0,0,0),r.clear(r.COLOR_BUFFER_BIT|r.DEPTH_BUFFER_BIT)),r.drawElements(b.mode,b.length,r.UNSIGNED_SHORT,0),H.enable(H.DEPTH_TEST)}}function u(a,c,d){var e,f;if(("string"!=typeof a||!c&&0!==c)&&(d&&"object"==typeof d||(d=c),c=a),"string"==typeof a&&B[a]||(a=null),c instanceof P||c instanceof R||c instanceof W)e=c;else if(c instanceof Z||c instanceof $||c instanceof _){if(!(e=fa[c.id]))throw new Error("Cannot connect a foreign node")}else{for("string"==typeof c&&isNaN(c)&&(c=b(c,["canvas","img","video"])),f=0;f<ha.length;f++)if(e=ha[f],(!a||a===e.hook)&&e.compare&&e.compare(c,d))return e;e=new P(a,c,d)}return e}function y(a,b){var c,d,e;if(!(a instanceof R||a instanceof W))return!1;if(a===b)return!0;e=a.sources;for(c in e)if(e.hasOwnProperty(c)&&((d=e[c])===b||y(d,b)))return!0;return!1}if(a===this||!(this instanceof p)||void 0!==this.id)return new p(d);var D,H,L,M,N,O,P,R,W,X,Z,$,_,aa,ba,ca=++J,da=this,ea=[],fa={},ga=0,ha=[],ia=[],ja=[],ka=[],la={},ma=[],na=[],oa={},pa={},qa=!1,ra=!1;O=function(){this.ready=!1,this.width=1,this.height=1,this.gl=H,this.uniforms={resolution:[this.width,this.height],transform:null},this.dirty=!0,this.isDestroyed=!1,this.seriously=da,this.listeners={},this.id=ga,ga++},O.prototype.setReady=function(){var a;if(!this.ready&&(this.ready=!0,this.emit("ready"),this.targets))for(a=0;a<this.targets.length;a++)this.targets[a].setReady()},O.prototype.setUnready=function(){var a;if(this.ready&&(this.ready=!1,this.emit("unready"),this.targets))for(a=0;a<this.targets.length;a++)this.targets[a].setUnready()},O.prototype.setDirty=function(){var a;if(!this.dirty&&(this.emit("dirty"),this.dirty=!0,this.targets))for(a=0;a<this.targets.length;a++)this.targets[a].setDirty()},O.prototype.initFrameBuffer=function(a){H&&(this.frameBuffer=new n(H,this.width,this.height,a))},O.prototype.readPixels=function(a,b,c,d,f){var g=this.gl||H;if(!H)throw new Error("Cannot read pixels until a canvas is connected");if(this.frameBuffer||(this.initFrameBuffer(),this.setDirty()),this.render(),void 0===f)f=new Uint8Array(c*d*4);else if(!e(f,"Uint8Array"))throw new Error("Incompatible array type");return g.bindFramebuffer(H.FRAMEBUFFER,this.frameBuffer.frameBuffer),g.readPixels(a,b,c,d,H.RGBA,H.UNSIGNED_BYTE,f),f},O.prototype.resize=function(){var a,b;this.source?(a=this.source.width,b=this.source.height):this.sources&&this.sources.source?(a=this.sources.source.width,b=this.sources.source.height):this.inputs&&this.inputs.width?(a=this.inputs.width,b=this.inputs.height||a):this.inputs&&this.inputs.height?a=b=this.inputs.height:(a=1,b=1),a=Math.floor(a),b=Math.floor(b),this.width===a&&this.height===b||(this.width=a,this.height=b,this.emit("resize"),this.setDirty()),this.uniforms&&this.uniforms.resolution&&(this.uniforms.resolution[0]=a,this.uniforms.resolution[1]=b),this.frameBuffer&&this.frameBuffer.resize&&this.frameBuffer.resize(a,b)},O.prototype.on=function(a,b){var c,d=-1;a&&"function"==typeof b&&(c=this.listeners[a],c?d=c.indexOf(b):c=this.listeners[a]=[],d<0&&c.push(b))},O.prototype.off=function(a,b){var c,d=-1;a&&"function"==typeof b&&(c=this.listeners[a])&&(d=c.indexOf(b))>=0&&c.splice(d,1)},O.prototype.emit=function(a){var b,c=this.listeners[a];if(c&&c.length)for(b=0;b<c.length;b++)i(c[b])},O.prototype.destroy=function(){var a,b;delete this.gl,delete this.seriously;for(b in this.listeners)this.listeners.hasOwnProperty(b)&&delete this.listeners[b];for(a in this.uniforms)this.uniforms.hasOwnProperty(a)&&delete this.uniforms[a];this.targets&&delete this.targets,this.frameBuffer&&this.frameBuffer.destroy&&(this.frameBuffer.destroy(),delete this.frameBuffer),a=ea.indexOf(this),a>=0&&ea.splice(a,1),delete fa[this.id],this.isDestroyed=!0},Z=function(a){function d(a,c){var d,f,h;return h=l.effect.inputs[a],d=l.inputElements[a],"string"==typeof c&&isNaN(c)&&("enum"===h.type?h.options.hasOwnProperty(c)||(c=b(c,["select"])):"number"===h.type||"boolean"===h.type?c=b(c,["input","select"]):"image"===h.type&&(c=b(c,["canvas","img","video"]))),e(c,"HTMLInputElement")||e(c,"HTMLSelectElement")?(f=c.value,d&&d.element!==c&&(d.element.removeEventListener("change",d.listener,!0),d.element.removeEventListener("input",d.listener,!0),delete l.inputElements[a],d=null),d||(d={element:c,listener:function(a,b){return function(){var d,e;d="checkbox"===c.type?c.checked:b.value,e=l.setInput(a,d),"color"===h.type&&(e=g(e).substr(0,7)),e!==d&&(b.value=e)}}(a,c)},l.inputElements[a]=d,"range"===c.type?(c.addEventListener("input",d.listener,!0),c.addEventListener("change",d.listener,!0)):c.addEventListener("change",d.listener,!0)),d&&"checkbox"===c.type&&(f=c.checked)):(d&&(d.element.removeEventListener("change",d.listener,!0),d.element.removeEventListener("input",d.listener,!0),delete l.inputElements[a]),f=c),l.setInput(a,f),l.inputs[a]}function f(a){return function(b){var c=d(a,b);return c&&c.pub}}function h(a){return function(){var b=l.inputs[a];return b&&b.pub}}function i(a){return function(b){return d(a,b)}}function j(a){return function(){return l.inputs[a]}}var k,l=a;for(k in l.effect.inputs)if(l.effect.inputs.hasOwnProperty(k)){if(void 0!==this[k])throw new Error("Cannot overwrite Seriously."+k);"image"===l.effect.inputs[k].type?Object.defineProperty(this,k,{configurable:!0,enumerable:!0,get:h(k),set:f(k)}):Object.defineProperty(this,k,{configurable:!0,enumerable:!0,get:j(k),set:i(k)})}Object.defineProperties(this,{effect:{enumerable:!0,configurable:!0,get:function(){return l.hook}},title:{enumerable:!0,configurable:!0,get:function(){return l.effect.title||l.hook}},width:{enumerable:!0,configurable:!0,get:function(){return l.width}},height:{enumerable:!0,configurable:!0,get:function(){return l.height}},id:{enumerable:!0,configurable:!0,get:function(){return l.id}}}),this.render=function(){return l.render(),this},this.readPixels=function(a,b,c,d,e){return l.readPixels(a,b,c,d,e)},this.on=function(a,b){l.on(a,b)},this.off=function(a,b){l.off(a,b)},this.inputs=function(a){var b,d,e,f;if(e=l.effect.inputs,a)return(d=e[a])?(b={type:d.type,defaultValue:d.defaultValue,title:d.title||a},"number"===d.type?(b.min=d.min,b.max=d.max,b.step=d.step,b.mod=d.mod):"enum"===d.type?b.options=c({},d.options):"vector"===d.type&&(b.dimensions=d.dimensions),d.description&&(b.description=d.description),b):null;b={};for(f in e)e.hasOwnProperty(f)&&(b[f]=this.inputs(f));return b},this.alias=function(a,b){return l.alias(a,b),this},this.matte=function(a){l.matte(a)},this.destroy=function(){var a,b;l.destroy();for(a in this)this.hasOwnProperty(a)&&"isDestroyed"!==a&&"id"!==a&&(b=Object.getOwnPropertyDescriptor(this,a),b.get||b.set||"function"!=typeof this[a]?delete this[a]:this[a]=K)},this.isDestroyed=function(){return l.isDestroyed},this.isReady=function(){return l.ready}},R=function(a,b){var d,e,f,g,h={};O.call(this,b),this.gl=H,this.effectRef=z[a],this.sources={},this.targets=[],this.inputElements={},this.dirty=!0,this.shaderDirty=!0,this.hook=a,this.options=b,this.transform=null,this.effect=c({},this.effectRef),this.effectRef.definition&&c(this.effect,this.effectRef.definition.call(this,b)),m(this.effect),this.uniforms.transform=t,this.inputs={},g=oa[a];for(d in this.effect.inputs)this.effect.inputs.hasOwnProperty(d)&&(e=this.effect.inputs[d],void 0!==e.defaultValue&&null!==e.defaultValue||("number"===e.type?e.defaultValue=Math.min(Math.max(0,e.min),e.max):"color"===e.type?e.defaultValue=[0,0,0,0]:"boolean"===e.type?e.defaultValue=!1:"string"===e.type?e.defaultValue="":"enum"===e.type&&(e.defaultValue=e.firstValue)),f=e.validate.call(this,e.defaultValue,e),g&&void 0!==g[d]&&(f=e.validate.call(this,g[d],e,e.defaultValue,f),g[d]=f,"image"===e.type&&(h[d]=f)),this.inputs[d]=f,e.uniform&&(this.uniforms[e.uniform]=e.defaultValue));H&&(this.initialize(),this.effect.commonShader&&this.buildShader()),this.updateReady(),this.inPlace=this.effect.inPlace,this.pub=new Z(this),ea.push(this),fa[this.id]=this,ka.push(this),E[a].push(this);for(d in h)h.hasOwnProperty(d)&&this.setInput(d,h[d])},R.prototype=Object.create(O.prototype),R.prototype.constructor=R,R.prototype.initialize=function(){if(!this.initialized){var a=this;this.baseShader=N,this.shape?this.model=f(this.shape,this.gl):this.model=M,"function"==typeof this.effect.initialize?this.effect.initialize.call(this,function(){a.initFrameBuffer(!0)},H):this.initFrameBuffer(!0),this.frameBuffer&&(this.texture=this.frameBuffer.texture),this.initialized=!0}},R.prototype.resize=function(){var a;for(O.prototype.resize.call(this),this.effect.resize&&this.effect.resize.call(this),a=0;a<this.targets.length;a++)this.targets[a].resize()},R.prototype.updateReady=function(){var a,b,c,d,e,f=!0;d=this.effect;for(c in d.inputs)if(d.inputs.hasOwnProperty(c)&&(b=this.effect.inputs[c],"image"===b.type&&(!this.sources[c]||!this.sources[c].ready)&&(!d.requires||d.requires.call(this,c,this.inputs)))){f=!1;break}if(this.ready!==f&&(this.ready=f,this.emit(f?"ready":"unready"),e=f?"setReady":"setUnready",this.targets))for(a=0;a<this.targets.length;a++)this.targets[a][e]()},R.prototype.setReady=R.prototype.updateReady,R.prototype.setUnready=R.prototype.updateReady,R.prototype.addTarget=function(a){var b;for(b=0;b<this.targets.length;b++)if(this.targets[b]===a)return;this.targets.push(a)},R.prototype.removeTarget=function(a){var b=this.targets&&this.targets.indexOf(a);b>=0&&this.targets.splice(b,1)},R.prototype.removeSource=function(a){var b,c=a&&a.pub;for(b in this.inputs)!this.inputs.hasOwnProperty(b)||this.inputs[b]!==a&&this.inputs[b]!==c||(this.inputs[b]=null);for(b in this.sources)!this.sources.hasOwnProperty(b)||this.sources[b]!==a&&this.sources[b]!==c||(this.sources[b]=null)},R.prototype.buildShader=function(){function a(a){return S.test(a)?a:"#define SHADER_NAME seriously."+d.hook+"\n"+a}var b,c=this.effect,d=this;this.shaderDirty&&(c.commonShader&&pa[this.hook]?(this.shader||pa[this.hook].count++,this.shader=pa[this.hook].shader):c.shader?(this.shader&&!c.commonShader&&this.shader.destroy(),b=c.shader.call(this,this.inputs,{vertex:v,fragment:w},p.util),b instanceof o?this.shader=b:b&&b.vertex&&b.fragment?this.shader=new o(H,a(b.vertex),a(b.fragment)):this.shader=N,c.commonShader&&(pa[this.hook]={count:1,shader:this.shader})):this.shader=N,this.shaderDirty=!1)},R.prototype.render=function(){function a(a,b,c,d,e,g){s(a,b,c,d,e||f,g)}var b,c,d,e=this.effect,f=this;if(H){if(this.initialized||this.initialize(),this.shaderDirty&&this.buildShader(),this.dirty&&this.ready){for(b in this.sources)!this.sources.hasOwnProperty(b)||e.requires&&!e.requires.call(this,b,this.inputs)||(d="function"==typeof this.inPlace?this.inPlace(b):this.inPlace,this.sources[b].render(!d));this.frameBuffer&&(c=this.frameBuffer.frameBuffer),"function"==typeof e.draw?(e.draw.call(this,this.shader,this.model,this.uniforms,c,a),this.emit("render")):c&&(s(this.shader,this.model,this.uniforms,c,this),this.emit("render")),this.dirty=!1}return this.texture}},R.prototype.setInput=function(a,b){function c(){var b,c=i.sources[a];if(c){for(b in i.sources)if(b!==a&&i.sources.hasOwnProperty(b)&&i.sources[b]===c)return;c.removeTarget(i)}}var d,e,f,g,h,i=this;if(this.effect.inputs.hasOwnProperty(a)){if(d=this.effect.inputs[a],"image"===d.type){if(b){if((b=u(b))!==this.sources[a]){if(c(),y(b,this))throw new Error("Attempt to make cyclical connection.");this.sources[a]=b,b.addTarget(this)}}else delete this.sources[a],b=!1;e=this.sources[a],f=Object.keys(this.sources),!0===this.inPlace&&1===f.length?(g=this.sources[f[0]],this.uniforms.transform=g&&g.cumulativeMatrix||t):this.uniforms.transform=t}else h=oa[this.hook]&&void 0!==oa[this.hook][a]?oa[this.hook][a]:d.defaultValue,b=d.validate.call(this,b,d,h,this.inputs[a]),e=b;return this.inputs[a]===b&&"color"!==d.type&&"vector"!==d.type?b:(this.inputs[a]=b,d.uniform&&(this.uniforms[d.uniform]=e),"image"===d.type?(this.resize(),this.updateReady()):d.updateSources&&this.updateReady(),d.shaderDirty&&(this.shaderDirty=!0),this.setDirty(),d.update&&d.update.call(this,b),b)}},R.prototype.alias=function(a,b){var c=this;if(Y.indexOf(b)>=0)throw new Error("'"+b+"' is a reserved name and cannot be used as an alias.");return this.effect.inputs.hasOwnProperty(a)&&(b||(b=a),da.removeAlias(b),la[b]={node:this,input:a},Object.defineProperty(da,b,{configurable:!0,enumerable:!0,get:function(){return c.inputs[a]},set:function(b){return c.setInput(a,b)}})),this},R.prototype.matte=function(a){function b(a){return a&&a.length&&Array.isArray(a)?Array.isArray(a[0])?Array.isArray(a[0])&&!isNaN(a[0][0])?[a]:a:[a]:[]}function c(a,b,c,d){var e,f,g,h,i;return e=(d.x-c.x)*(a.y-c.y)-(d.y-c.y)*(a.x-c.x),f=(b.x-a.x)*(a.y-c.y)-(b.y-a.y)*(a.x-c.x),!!((g=(d.y-c.y)*(b.x-a.x)-(d.x-c.x)*(b.y-a.y))&&(h=e/g,i=f/g,h>0&&h<=1&&i>0&&i<=1))&&{x:a.x+h*(b.x-a.x),y:a.y+h*(b.y-a.y)}}function d(a){var b,d,e,f,g,h,i,j,k,l,m,n=[];if(!a.simple){for(b=0;b<a.edges.length;b++)for(e=a.edges[b],d=b+1;d<a.edges.length;d++)f=a.edges[d],(g=c(e[0],e[1],f[0],f[1]))&&(g.edge1=e,g.edge2=f,n.push(g));if(n.length){for(k=[],b=0;b<n.length;b++)g=n[b],e=g.edge1,f=g.edge2,l={x:g.x,y:g.y,prev:e[0],next:f[1],id:p.length},a.vertices.push(l),p.push(l),m={x:g.x,y:g.y,prev:f[0],next:e[1],id:p.length},a.vertices.push(m),p.push(l),l.prev.next=l,l.next.prev=l,m.prev.next=m,m.next.prev=m;do{h={edges:[],vertices:[],simple:!0},k.push(h),j=a.vertices[0],i=j;do{b=a.vertices.indexOf(j),a.vertices.splice(b,1),h.edges.push([j,j.next]), h.vertices.push(j),j=j.next}while(j!==i)}while(a.vertices.length);for(b=o.indexOf(a),o.splice(b,1),b=0;b<k.length;b++)o.push(k[b])}else a.simple=!0}}function e(a){var b,c,d,e,f=a.vertices.length,g=0;for(b=f-1,c=0;c<f;b=c,c++)d=a.vertices[b],e=a.vertices[c],g+=d.x*e.y-e.x*d.y;return g>0}function g(a){function b(a,b,c,d){var e,f,g,h,i,j,k,l,m,n,o,p,q,r,s;return e=c.x-b.x,f=c.y-b.y,g=a.x-c.x,h=a.y-c.y,i=b.x-a.x,j=b.y-a.y,k=d.x-a.x,l=d.y-a.y,m=d.x-b.x,n=d.y-b.y,o=d.x-c.x,p=d.y-c.y,s=e*n-f*m,q=i*l-j*k,r=g*p-h*o,s>=0&&r>=0&&q>=0}function c(a,c,d,e,f){var g,h,i,j,k;if(h=q[f[a]],i=q[f[c]],j=q[f[d]],0>(i.x-h.x)*(j.y-h.y)-(i.y-h.y)*(j.x-h.x))return!1;for(g=0;g<e;g++)if(g!==a&&g!==c&&g!==d&&(k=q[f[g]],b(h,i,j,k)))return!1;return!0}var d,e,f,g,h,j,k,l,m,n,o,p,q=a.vertices,r=[],s=[];if(e=q.length,a.clockWise)for(d=0;d<e;d++)r[d]=d;else for(d=0;d<e;d++)r[d]=e-1-d;for(f=e,g=2*f,h=0,d=f-1;f>2;){if(g--<=0)return s;if(j=d,f<=j&&(j=0),d=j+1,f<=d&&(d=0),k=d+1,f<k&&(k=0),c(j,d,k,f,r)){for(l=r[j],m=r[d],n=r[k],a.clockWise?(s.push(q[l]),s.push(q[m]),s.push(q[n])):(s.push(q[n]),s.push(q[m]),s.push(q[l])),h++,o=d,p=d+1;p<f;o++,p++)r[o]=r[p];f--,g=2*f}}i.indices=s}var h,i,j,k,l,m,n,o=[],p=[],q={};for(h=b(a),j=0;j<h.length;j++){for(a=h[j],n=null,i={vertices:[],edges:[]},k=0;k<a.length;k++)l=a[k],"object"!=typeof l||isNaN(l.x)||isNaN(l.y)?l.length>=2&&!isNaN(l[0])&&!isNaN(l[1])&&(m={x:l[0],y:l[1],id:p.length}):m={x:l.x,y:l.y,id:p.length},m&&(n?(n.next=m,m.prev=n,m.next=i.vertices[0],i.vertices[0].prev=m):(i.head=m,m.next=m,m.prev=m),p.push(m),i.vertices.push(m),n=m);if(i.vertices.length>2)for(3===i.vertices.length&&(i.simple=!0),o.push(i),k=0;k<i.vertices.length;k++)m=i.vertices[k],i.edges.push([m,m.next])}for(j=o.length-1;j>=0;j--)i=o[j],d(i);for(j=0;j<o.length;j++)i=o[j],i.clockWise=e(i),g(i);for(q.vertices=[],q.coords=[],j=0;j<p.length;j++)l=p[j],q.vertices.push(2*l.x-1),q.vertices.push(-2*l.y+1),q.vertices.push(-1),q.coords.push(l.x),q.coords.push(-1*l.y+1);for(q.vertices=new Float32Array(q.vertices),q.coords=new Float32Array(q.coords),q.indices=[],j=0;j<o.length;j++)for(i=o[j],k=0;k<i.indices.length;k++)l=i.indices[k],q.indices.push(l.id);q.indices=new Uint16Array(q.indices),this.shape=q,this.gl&&f(q,this.gl)},R.prototype.destroy=function(){var a,b,c,d=this.hook;this.effect.destroy&&"function"==typeof this.effect.destroy&&this.effect.destroy.call(this),delete this.effect,pa[d]&&(--pa[d].count||delete pa[d]),this.shader&&this.shader.destroy&&this.shader!==N&&!pa[d]&&this.shader.destroy(),delete this.shader;for(b in this.inputElements)this.inputElements.hasOwnProperty(b)&&(c=this.inputElements[b],c.element.removeEventListener("change",c.listener,!0),c.element.removeEventListener("input",c.listener,!0));for(b in this.sources)this.sources.hasOwnProperty(b)&&(c=this.sources[b],c&&c.removeTarget&&c.removeTarget(this),delete this.sources[b]);for(;this.targets.length;)(c=this.targets.pop())&&c.removeSource&&c.removeSource(this);for(b in this)this.hasOwnProperty(b)&&"id"!==b&&delete this[b];for(b in la)la.hasOwnProperty(b)&&(c=la[b],c.node===this&&da.removeAlias(b));a=ka.indexOf(this),a>=0&&ka.splice(a,1),a=E[d].indexOf(this),a>=0&&E[d].splice(a,1),O.prototype.destroy.call(this)},$=function(a){var b=a;Object.defineProperties(this,{original:{enumerable:!0,configurable:!0,get:function(){return b.source}},id:{enumerable:!0,configurable:!0,get:function(){return b.id}},width:{enumerable:!0,configurable:!0,get:function(){return b.width}},height:{enumerable:!0,configurable:!0,get:function(){return b.height}}}),this.render=function(){b.render()},this.update=function(){b.setDirty()},this.readPixels=function(a,c,d,e,f){return b.readPixels(a,c,d,e,f)},this.on=function(a,c){b.on(a,c)},this.off=function(a,c){b.off(a,c)},this.destroy=function(){var a,c;b.destroy();for(a in this)this.hasOwnProperty(a)&&"isDestroyed"!==a&&"id"!==a&&(c=Object.getOwnPropertyDescriptor(this,a),c.get||c.set||"function"!=typeof this[a]?delete this[a]:this[a]=K)},this.isDestroyed=function(){return b.isDestroyed},this.isReady=function(){return b.ready}},P=function(a,d,f){function g(a,b,d,e){var f=B[a];if(f.definition){if(!(f=f.definition.call(p,b,d,e)))return null;f=c(c({},B[a]),f)}return f}function h(a){return p.source===a}var i,j,k=f||{},l=void 0===k.flip||k.flip,m=k.width,n=k.height,o=!1,p=this,q=!1;if(O.call(this),(a&&"string"!=typeof a||!d&&0!==d)&&(f&&"object"==typeof f||(f=d),d=a),"string"==typeof d&&isNaN(d)&&(d=b(d,["canvas","img","video"])),"string"==typeof a&&B[a]&&(j=g(a,d,f,!0))&&(this.hook=a,q=!0,o=j.deferTexture,this.plugin=j,this.compare=j.compare,this.checkDirty=j.checkDirty,j.source&&(d=j.source)),!j&&e(d))"CANVAS"===d.tagName?(this.width=d.width,this.height=d.height,this.render=this.renderImageCanvas,q=!0,this.hook="canvas",this.compare=h):"IMG"===d.tagName&&(this.width=d.naturalWidth||1,this.height=d.naturalHeight||1,d.complete&&d.naturalWidth||(o=!0),d.addEventListener("load",function(){p.isDestroyed||(p.width===d.naturalWidth&&p.height===d.naturalHeight||(p.width=d.naturalWidth,p.height=d.naturalHeight,p.resize()),p.setDirty(),p.setReady())},!0),this.render=this.renderImageCanvas,q=!0,this.hook="image",this.compare=h);else if(!j&&e(d,"WebGLTexture")){if(H&&!H.isTexture(d))throw new Error("Not a valid WebGL texture.");isNaN(m)?isNaN(n)||(m=n):isNaN(n)&&(n=m),this.width=m,this.height=n,void 0===k.flip&&(l=!1),q=!0,this.texture=d,this.initialized=!0,this.hook="texture",this.compare=h,this.render=function(){}}if(!q&&!j)for(i in B)if(B.hasOwnProperty(i)&&B[i]&&(j=g(i,d,f,!1))){this.hook=i,q=!0,o=j.deferTexture,this.plugin=j,this.compare=j.compare,this.checkDirty=j.checkDirty,j.source&&(d=j.source);break}if(!q)throw new Error("Unknown source type");this.source=d,void 0===this.flip&&(this.flip=l),this.targets=[],o||p.setReady(),this.pub=new $(this),ea.push(this),fa[this.id]=this,ha.push(this),G[this.hook].push(this),ha.length&&!ba&&r()},P.prototype=Object.create(O.prototype),P.prototype.constructor=P,P.prototype.initialize=function(){var a;H&&!this.texture&&this.ready&&(a=H.createTexture(),H.bindTexture(H.TEXTURE_2D,a),H.pixelStorei(H.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),H.texParameteri(H.TEXTURE_2D,H.TEXTURE_MAG_FILTER,H.LINEAR),H.texParameteri(H.TEXTURE_2D,H.TEXTURE_MIN_FILTER,H.LINEAR),H.texParameteri(H.TEXTURE_2D,H.TEXTURE_WRAP_S,H.CLAMP_TO_EDGE),H.texParameteri(H.TEXTURE_2D,H.TEXTURE_WRAP_T,H.CLAMP_TO_EDGE),H.bindTexture(H.TEXTURE_2D,null),this.texture=a,this.initialized=!0,this.allowRefresh=!0,this.setDirty())},P.prototype.initFrameBuffer=function(a){H&&(this.frameBuffer=new n(H,this.width,this.height,{texture:this.texture,useFloat:a}))},P.prototype.addTarget=function(a){var b;for(b=0;b<this.targets.length;b++)if(this.targets[b]===a)return;this.targets.push(a)},P.prototype.removeTarget=function(a){var b=this.targets&&this.targets.indexOf(a);b>=0&&this.targets.splice(b,1)},P.prototype.resize=function(){var a,b;if(this.uniforms.resolution[0]=this.width,this.uniforms.resolution[1]=this.height,this.framebuffer&&this.framebuffer.resize(this.width,this.height),this.emit("resize"),this.setDirty(),this.targets)for(a=0;a<this.targets.length;a++)b=this.targets[a],b.resize(),b.setTransformDirty&&b.setTransformDirty()},P.prototype.setReady=function(){var a;if(!this.ready&&(this.ready=!0,this.resize(),this.initialize(),this.emit("ready"),this.targets))for(a=0;a<this.targets.length;a++)this.targets[a].setReady()},P.prototype.render=function(){var a=this.source;H&&(a||0===a)&&this.ready&&(this.initialized||this.initialize(),this.allowRefresh&&this.plugin&&this.plugin.render&&(this.dirty||this.checkDirty&&this.checkDirty())&&this.plugin.render.call(this,H,s,M,N)&&(this.dirty=!1,this.emit("render")))},P.prototype.renderImageCanvas=function(){var b=this.source;if(H&&b&&this.ready&&(this.initialized||this.initialize(),this.allowRefresh&&this.dirty)){H.bindTexture(H.TEXTURE_2D,this.texture),H.pixelStorei(H.UNPACK_FLIP_Y_WEBGL,this.flip),H.pixelStorei(H.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1);try{return H.texImage2D(H.TEXTURE_2D,0,H.RGBA,H.RGBA,H.UNSIGNED_BYTE,b),this.dirty=!1,this.emit("render"),!0}catch(c){c.code===a.DOMException.SECURITY_ERR&&(this.allowRefresh=!1,p.logger.error("Unable to access cross-domain image"))}return!1}},P.prototype.destroy=function(){var a,b,c;for(this.plugin&&this.plugin.destroy&&this.plugin.destroy.call(this),H&&this.texture&&H.deleteTexture(this.texture);this.targets.length;)(c=this.targets.pop())&&c.removeSource&&c.removeSource(this);a=ha.indexOf(this),a>=0&&ha.splice(a,1),(a=G[this.hook].indexOf(this))>=0&&G[this.hook].splice(a,1);for(b in this)this.hasOwnProperty(b)&&"id"!==b&&delete this[b];O.prototype.destroy.call(this)},aa=function(a){var b=a;Object.defineProperties(this,{source:{enumerable:!0,configurable:!0,get:function(){if(b.source)return b.source.pub},set:function(a){b.setSource(a)}},original:{enumerable:!0,configurable:!0,get:function(){return b.target}},width:{enumerable:!0,configurable:!0,get:function(){return b.width},set:function(a){!isNaN(a)&&a>0&&b.width!==a&&(b.width=a,b.resize(),b.setTransformDirty())}},height:{enumerable:!0,configurable:!0,get:function(){return b.height},set:function(a){!isNaN(a)&&a>0&&b.height!==a&&(b.height=a,b.resize(),b.setTransformDirty())}},id:{enumerable:!0,configurable:!0,get:function(){return b.id}}}),this.render=function(){b.render()},this.readPixels=function(a,c,d,e,f){return b.readPixels(a,c,d,e,f)},this.on=function(a,c){b.on(a,c)},this.off=function(a,c){b.off(a,c)},this.go=function(a){b.go(a)},this.stop=function(){b.stop()},this.getTexture=function(){return b.frameBuffer.texture},this.destroy=function(){var a,c;b.destroy();for(a in this)this.hasOwnProperty(a)&&"isDestroyed"!==a&&"id"!==a&&(c=Object.getOwnPropertyDescriptor(this,a),c.get||c.set||"function"!=typeof this[a]?delete this[a]:this[a]=K)},this.inputs=function(a){return{source:{type:"image"}}},this.isDestroyed=function(){return b.isDestroyed},this.isReady=function(){return b.ready}},X=function(a,b,d){function f(a,b,d,e){var f=C[a];if(f.definition){if(!(f=f.definition.call(x,b,d,e)))return null;f=c(c({},C[a]),f),x.hook=u,y=!0,x.plugin=f,x.compare=f.compare,f.target&&(b=f.target),f.gl&&!x.gl&&(x.gl=f.gl,H||k(f.gl)),x.gl===H&&(x.model=M,x.shader=N)}return f}var g,i,l,m,q,r,s,t,u,x=this,y=!1;if(O.call(this),(a&&"string"!=typeof a||!b&&0!==b)&&(d&&"object"==typeof d||(d=b),b=a),g=d||{},i=void 0===g.flip||g.flip,l=parseInt(g.width,10),m=parseInt(g.height,10),r=g.debugContext,"string"==typeof a&&C[a]&&f(a,b,g,!0),this.renderToTexture=g.renderToTexture,e(b,"WebGLFramebuffer"))if(s=b,e(g,"HTMLCanvasElement"))b=g;else if(e(g,"WebGLRenderingContext"))b=g.canvas;else if(e(g.canvas,"HTMLCanvasElement"))b=g.canvas;else{if(!e(g.context,"WebGLRenderingContext"))throw new Error("Must provide a canvas with WebGLFramebuffer target");b=g.context.canvas}if(e(b,"HTMLCanvasElement")){if(l=b.width,m=b.height,(!H||H.canvas!==b&&g.allowSecondaryWebGL)&&(!0,q=j(b,{alpha:!0,premultipliedAlpha:!0,preserveDrawingBuffer:!0,stencil:!0,debugContext:r})),q)H&&H!==q?(this.gl=q,this.frameBuffer={frameBuffer:s||null},this.shader=new o(this.gl,v,w),this.model=h.call(this,this.gl),this.pixels=null,this.texture=this.gl.createTexture(),this.gl.bindTexture(H.TEXTURE_2D,this.texture),this.gl.texParameteri(H.TEXTURE_2D,H.TEXTURE_MAG_FILTER,H.LINEAR),this.gl.texParameteri(H.TEXTURE_2D,H.TEXTURE_MIN_FILTER,H.LINEAR),this.gl.texParameteri(H.TEXTURE_2D,H.TEXTURE_WRAP_S,H.CLAMP_TO_EDGE),this.gl.texParameteri(H.TEXTURE_2D,H.TEXTURE_WRAP_T,H.CLAMP_TO_EDGE),this.render=this.renderSecondaryWebGL):(L||(L=this),H||k(q),this.render=this.renderWebGL,g.renderToTexture?H&&(this.frameBuffer=new n(H,l,m,!1)):this.frameBuffer={frameBuffer:s||null});else{if(!g.allowSecondaryWebGL&&H&&H.canvas!==b)throw new Error("Only one WebGL target canvas allowed. Set allowSecondaryWebGL option to create secondary context.");this.render=K,p.logger.log("Unable to create WebGL context.")}y=!0}if(!y)for(u in C)if(C.hasOwnProperty(u)&&C[u]&&f(u,b,g,!1))break;if(!y)throw new Error("Unknown target type");I&&(t=I.get(b),t?p.logger.warn("Target already in use by another instance",b,Object.keys(t).map(function(a){return t[a]})):(t={},I.set(b,t)),t[da.id]=da),this.target=b,this.transform=null,this.transformDirty=!0,this.flip=i,l&&(this.width=l),m&&(this.height=m),this.uniforms.resolution[0]=this.width,this.uniforms.resolution[1]=this.height,void 0!==g.auto?this.auto=g.auto:this.auto=qa,this.frames=0,this.pub=new aa(this),ea.push(this),fa[this.id]=this,ia.push(this)},X.prototype=Object.create(O.prototype),X.prototype.constructor=X,X.prototype.setSource=function(a){var b;(b=u(a))!==this.source&&(this.source&&this.source.removeTarget(this),this.source=b,b.addTarget(this),b&&(this.resize(),b.ready?this.setReady():this.setUnready()),this.setDirty())},X.prototype.setDirty=function(){this.dirty=!0,this.auto&&!ba&&(ba=U(r))},X.prototype.resize=function(){e(this.target,"HTMLCanvasElement")?this.width===this.target.width&&this.height===this.target.height||(this.target.width=this.width,this.target.height=this.height,this.uniforms.resolution[0]=this.width,this.uniforms.resolution[1]=this.height,this.emit("resize"),this.setTransformDirty()):this.plugin&&this.plugin.resize&&this.plugin.resize.call(this),!this.source||this.source.width===this.width&&this.source.height===this.height||this.transform||(this.transform=new Float32Array(16))},X.prototype.setTransformDirty=function(){this.transformDirty=!0,this.setDirty()},X.prototype.go=function(){this.auto=!0,this.setDirty()},X.prototype.stop=function(){this.auto=!1},X.prototype.render=function(){H&&this.plugin&&this.plugin.render&&this.plugin.render.call(this,s,N,M)},X.prototype.renderWebGL=function(){var a,b,c;if(this.resize(),H&&this.dirty&&this.ready){if(!this.source)return;this.source.render(),this.uniforms.source=this.source.texture,this.source.width===this.width&&this.source.height===this.height?this.uniforms.transform=this.source.cumulativeMatrix||t:this.transformDirty&&(a=this.transform,T.copy(a,this.source.cumulativeMatrix||t),b=this.source.width/this.width,c=this.source.height/this.height,a[0]*=b,a[1]*=b,a[2]*=b,a[3]*=b,a[4]*=c,a[5]*=c,a[6]*=c,a[7]*=c,this.uniforms.transform=a,this.transformDirty=!1),s(N,M,this.uniforms,this.frameBuffer.frameBuffer,this,Q),this.emit("render"),this.dirty=!1}},X.prototype.renderSecondaryWebGL=function(){var a,b,c,d,e;this.dirty&&this.ready&&this.source&&(this.emit("render"),this.source.render(!0),a=this.source.width,b=this.source.height,this.pixels&&this.pixels.length===a*b*4||(this.pixels=new Uint8Array(a*b*4)),this.source.readPixels(0,0,a,b,this.pixels),this.gl.texImage2D(this.gl.TEXTURE_2D,0,this.gl.RGBA,a,b,0,this.gl.RGBA,this.gl.UNSIGNED_BYTE,this.pixels),a===this.width&&b===this.height?this.uniforms.transform=t:this.transformDirty&&(c=this.transform,T.copy(c,t),d=this.source.width/this.width,e=this.source.height/this.height,c[0]*=d,c[1]*=d,c[2]*=d,c[3]*=d,c[4]*=e,c[5]*=e,c[6]*=e,c[7]*=e,this.uniforms.transform=c,this.transformDirty=!1),this.uniforms.source=this.texture,s(this.shader,this.model,this.uniforms,null,this,Q),this.dirty=!1)},X.prototype.removeSource=function(a){this.source!==a&&this.source!==a.pub||(this.source=null)},X.prototype.destroy=function(){var a,b;this.source&&this.source.removeTarget&&this.source.removeTarget(this),I&&(b=I.get(this.target),delete b[da.id],Object.keys(b).length||I.delete(this.target)),this.plugin&&this.plugin.destroy&&this.plugin.destroy.call(this),delete this.source,delete this.target,delete this.pub,delete this.uniforms,delete this.pixels,delete this.auto,a=ia.indexOf(this),a>=0&&ia.splice(a,1),O.prototype.destroy.call(this),this===L&&(D.removeEventListener("webglcontextrestored",l,!1),q(),L=null)},_=function(a){function d(a,c,d){var f,h;f=j.inputElements[a],"string"==typeof d&&isNaN(d)&&("enum"===c.type?c.options.hasOwnProperty(d)||(d=b(d,["select"])):"number"===c.type||"boolean"===c.type?d=b(d,["input","select"]):"image"===c.type&&(d=b(d,["canvas","img","video"]))),e(d,"HTMLInputElement")||e(d,"HTMLSelectElement")?(h=d.value,f&&f.element!==d&&(f.element.removeEventListener("change",f.listener,!0),f.element.removeEventListener("input",f.listener,!0),delete j.inputElements[a],f=null),f||(f={element:d,listener:function(b){return function(){var c,e;c="checkbox"===d.type?d.checked:b.value,e=j.setInput(a,c),"color"===d.type&&(e=g(e)),e!==c&&(b.value=e)}}(d)},j.inputElements[a]=f,"range"===d.type?(d.addEventListener("input",f.listener,!0),d.addEventListener("change",f.listener,!0)):d.addEventListener("change",f.listener,!0)),f&&"checkbox"===d.type&&(h=d.checked)):(f&&(f.element.removeEventListener("change",f.listener,!0),f.element.removeEventListener("input",f.listener,!0),delete j.inputElements[a]),h=d),j.setInput(a,h)}function f(a,b){Object.defineProperty(k,a,{configurable:!0,enumerable:!0,get:function(){return b.get.call(j)},set:function(c){d(a,b,c)}})}function h(a){return function(){a.apply(j,arguments)&&j.setTransformDirty()}}var i,j=a,k=this;Object.defineProperties(this,{transform:{enumerable:!0,configurable:!0,get:function(){return j.hook}},title:{enumerable:!0,configurable:!0,get:function(){return j.plugin.title||j.hook}},width:{enumerable:!0,configurable:!0,get:function(){return j.width}},height:{enumerable:!0,configurable:!0,get:function(){return j.height}},id:{enumerable:!0,configurable:!0,get:function(){return j.id}},source:{enumerable:!0,configurable:!0,get:function(){return j.source&&j.source.pub},set:function(a){j.setSource(a)}}});for(i in j.methods)j.methods.hasOwnProperty(i)&&(this[i]=h(j.methods[i]));for(i in j.inputs)j.inputs.hasOwnProperty(i)&&f(i,j.inputs[i]);this.update=function(){j.setDirty()},this.inputs=function(a){var b,d,e,f;if(e=j.plugin.inputs,a)return!(d=e[a])||d.method?null:(b={type:d.type,defaultValue:d.defaultValue,title:d.title||a},"number"===d.type?(b.min=d.min,b.max=d.max,b.step=d.step,b.mod=d.mod):"enum"===d.type?b.options=c({},d.options):"vector"===d.type&&(b.dimensions=d.dimensions),d.description&&(b.description=d.description),b);b={};for(f in e)e.hasOwnProperty(f)&&!e[f].method&&(b[f]=this.inputs(f));return b},this.alias=function(a,b){return j.alias(a,b),this},this.on=function(a,b){j.on(a,b)},this.off=function(a,b){j.off(a,b)},this.destroy=function(){var a,b;j.destroy();for(a in this)this.hasOwnProperty(a)&&"isDestroyed"!==a&&"id"!==a&&(b=Object.getOwnPropertyDescriptor(this,a),b.get||b.set||"function"!=typeof this[a]?delete this[a]:this[a]=K)},this.isDestroyed=function(){return j.isDestroyed},this.isReady=function(){return j.ready}},W=function(a,b){var d,e,f,g,h;this.matrix=new Float32Array(16),this.cumulativeMatrix=new Float32Array(16),this.ready=!1,this.width=1,this.height=1,this.seriously=da,this.transformRef=A[a],this.hook=a,this.id=ga,ga++,this.options=b,this.sources=null,this.targets=[],this.inputElements={},this.inputs={},this.methods={},this.listeners={},this.texture=null,this.frameBuffer=null,this.uniforms=null,this.dirty=!0,this.transformDirty=!0,this.renderDirty=!1,this.isDestroyed=!1,this.transformed=!1,this.plugin=c({},this.transformRef),this.transformRef.definition&&c(this.plugin,this.transformRef.definition.call(this,b));for(d in this.plugin.inputs)this.plugin.inputs.hasOwnProperty(d)&&(e=this.plugin.inputs[d],e.method&&"function"==typeof e.method?this.methods[d]=e.method:"function"==typeof e.set&&"function"==typeof e.get&&(this.inputs[d]=e));m(this.plugin),h=oa[a];for(d in this.plugin.inputs)this.plugin.inputs.hasOwnProperty(d)&&(e=this.plugin.inputs[d],"function"==typeof e.set&&"function"==typeof e.get&&"function"!=typeof e.method&&(f=e.get.call(this),g=void 0===e.defaultValue?f:e.defaultValue,g=e.validate.call(this,g,e,f),h&&void 0!==h[d]&&(g=e.validate.call(this,h[d],e,e.defaultValue,g),h[d]=g),g!==f&&e.set.call(this,g)));ea.push(this),fa[this.id]=this,this.pub=new _(this),ja.push(this),F[a].push(this)},W.prototype=Object.create(O.prototype),W.prototype.constructor=W,W.prototype.setDirty=function(){this.renderDirty=!0,O.prototype.setDirty.call(this)},W.prototype.setTransformDirty=function(){var a,b;for(this.transformDirty=!0,this.dirty=!0,this.renderDirty=!0,a=0;a<this.targets.length;a++)b=this.targets[a],b.setTransformDirty?b.setTransformDirty():b.setDirty()},W.prototype.resize=function(){var a;for(O.prototype.resize.call(this),this.plugin.resize&&this.plugin.resize.call(this),a=0;a<this.targets.length;a++)this.targets[a].resize();this.setTransformDirty()},W.prototype.setSource=function(a){var b;if((b=u(a))!==this.source){if(y(b,this))throw new Error("Attempt to make cyclical connection.");this.source&&this.source.removeTarget(this),this.source=b,b.addTarget(this),b&&b.ready?this.setReady():this.setUnready(),this.resize()}},W.prototype.addTarget=function(a){var b;for(b=0;b<this.targets.length;b++)if(this.targets[b]===a)return;this.targets.push(a)},W.prototype.removeTarget=function(a){var b=this.targets&&this.targets.indexOf(a);b>=0&&this.targets.splice(b,1),this.targets&&this.targets.length&&this.resize()},W.prototype.setInput=function(a,b){var c,d,e;if(this.plugin.inputs.hasOwnProperty(a))return c=this.plugin.inputs[a],d=oa[this.hook]&&void 0!==oa[this.hook][a]?oa[this.hook][a]:c.defaultValue,e=c.get.call(this),void 0===d&&(d=e),b=c.validate.call(this,b,c,d,e),c.set.call(this,b)&&this.setTransformDirty(),c.get.call(this)},W.prototype.alias=function(a,b){var c,d,e=this;if(Y.indexOf(b)>=0)throw new Error("'"+b+"' is a reserved name and cannot be used as an alias.");return this.plugin.inputs.hasOwnProperty(a)&&(b||(b=a),da.removeAlias(b),c=this.inputs[a],c?(d=e.inputs[a],Object.defineProperty(da,b,{configurable:!0,enumerable:!0,get:function(){return d.get.call(e)},set:function(a){d.set.call(e,a)&&e.setTransformDirty()}})):(c=this.methods[a])&&(d=c,da[b]=function(){d.apply(e,arguments)&&e.setTransformDirty()}),c&&(la[b]={node:this,input:a})),this},W.prototype.render=function(a){return this.source?(this.source.render(),this.transformDirty&&(this.transformed?this.source.cumulativeMatrix?T.multiply(this.cumulativeMatrix,this.matrix,this.source.cumulativeMatrix):T.copy(this.cumulativeMatrix,this.matrix):T.copy(this.cumulativeMatrix,this.source.cumulativeMatrix||t),this.transformDirty=!1),a&&H?(this.renderDirty&&(this.frameBuffer||(this.uniforms={resolution:[this.width,this.height]},this.frameBuffer=new n(H,this.width,this.height)),this.uniforms.source=this.source.texture,this.uniforms.transform=this.cumulativeMatrix||t,s(N,M,this.uniforms,this.frameBuffer.frameBuffer,this),this.renderDirty=!1),this.texture=this.frameBuffer.texture):this.source?this.texture=this.source.texture:this.texture=null,this.dirty=!1,this.texture):(this.transformDirty&&(T.copy(this.cumulativeMatrix,this.matrix),this.transformDirty=!1),this.texture=null,void(this.dirty=!1))},W.prototype.readPixels=function(a,b,c,d,f){var g=this.gl||H;if(!H)throw new Error("Cannot read pixels until a canvas is connected");if(this.render(!0),void 0===f)f=new Uint8Array(c*d*4);else if(!e(f,"Uint8Array"))throw new Error("Incompatible array type");return g.bindFramebuffer(H.FRAMEBUFFER,this.frameBuffer.frameBuffer),g.readPixels(a,b,c,d,H.RGBA,H.UNSIGNED_BYTE,f),f},W.prototype.destroy=function(){var a,b,c,d=this.hook;this.plugin.destroy&&"function"==typeof this.plugin.destroy&&this.plugin.destroy.call(this),delete this.effect,this.frameBuffer&&(this.frameBuffer.destroy(),delete this.frameBuffer,delete this.texture);for(a in this.inputElements)this.inputElements.hasOwnProperty(a)&&(c=this.inputElements[a],c.element.removeEventListener("change",c.listener,!0),c.element.removeEventListener("input",c.listener,!0));for(this.source&&this.source.removeTarget(this);this.targets.length;)(c=this.targets.pop())&&c.removeSource&&c.removeSource(this);for(b in this)this.hasOwnProperty(b)&&"id"!==b&&delete this[b];for(b in la)la.hasOwnProperty(b)&&(c=la[b],c.node===this&&da.removeAlias(b));a=ja.indexOf(this),a>=0&&ja.splice(a,1),a=F[d].indexOf(this),a>=0&&F[d].splice(a,1),O.prototype.destroy.call(this)},W.prototype.setReady=O.prototype.setReady,W.prototype.setUnready=O.prototype.setUnready,W.prototype.on=O.prototype.on,W.prototype.off=O.prototype.off,W.prototype.emit=O.prototype.emit,d=e(d,"HTMLCanvasElement")?{canvas:d}:d||{},d.canvas,this.effect=function(a,b){if(!z[a])throw new Error("Unknown effect: "+a);return new R(a,b).pub},this.source=function(a,b,c){return u(a,b,c).pub},this.transform=function(a,b){var c;if("string"!=typeof a&&(b=a,a=!1),a){if(!A[a])throw new Error("Unknown transform: "+a)}else if(a=d&&d.defaultTransform||"2d",!A[a])throw new Error("No transform specified");return c=new W(a,b),c.pub},this.target=function(a,b,c){var d,e,f;for(a&&"string"==typeof a&&!C[a]&&(e=x.querySelector(a)),("string"!=typeof a||!b&&0!==b||e)&&(c&&"object"==typeof c||(c=b),b=e||a,a=null),"string"==typeof b&&isNaN(b)&&(b=x.querySelector(b)),f=0;f<ia.length;f++)if(d=ia[f],(!a||a===d.hook)&&(d.target===b||d.compare&&d.compare(b,c)))return d.pub;return d=new X(a,b,c),d.pub},this.aliases=function(){return Object.keys(la)},this.removeAlias=function(a){la[a]&&(delete this[a],delete la[a])},this.defaults=function(a,b){var d;if(a)if("object"!=typeof a)null===b?delete oa[a]:"object"==typeof b&&(oa[a]=c({},b));else for(d in a)a.hasOwnProperty(d)&&this.defaults(d,a[d]);else if(null===a)for(d in oa)oa.hasOwnProperty(d)&&delete oa[d]},this.go=function(a,b){var c;for("function"==typeof a&&ma.indexOf(a)<0&&ma.push(a),"function"==typeof b&&na.indexOf(b)<0&&na.push(b),qa=!0,c=0;c<ia.length;c++)ia[c].go();ba||!ma.length&&!na.length||r()},this.stop=function(){ma.length=0,na.length=0,V(ba),ba=0},this.render=function(){var a;for(a=0;a<ia.length;a++)ia[a].render(d)},this.destroy=function(){for(var a,b,c;ea.length;)b=ea[0],b.pub.destroy();for(a in this)this.hasOwnProperty(a)&&"isDestroyed"!==a&&"id"!==a&&(c=Object.getOwnPropertyDescriptor(this,a),c.get||c.set||"function"!=typeof this[a]?delete this[a]:this[a]=K);da=null,ha=[],ia=[],ka=[],ea=[],ma.length=0,na.length=0,V(ba),ba=0,ra=!0},this.isDestroyed=function(){return ra},this.incompatible=function(a){var b,c,d=!1;if(d=p.incompatible(a))return d;if(!a){for(b in E)if(E.hasOwnProperty(b)&&E[b].length&&(c=z[b])&&"function"==typeof c.compatible&&!c.compatible.call(this))return"plugin-"+b;for(b in G)if(G.hasOwnProperty(b)&&G[b].length&&(c=B[b])&&"function"==typeof c.compatible&&!c.compatible.call(this))return"source-"+b}return!1},this.isNode=function(a){var b;return!(!a||!(b=fa[a.id])||b.isDestroyed)},this.isSource=function(a){return this.isNode(a)&&a instanceof $},this.isEffect=function(a){return this.isNode(a)&&a instanceof Z},this.isTransform=function(a){return this.isNode(a)&&a instanceof _},this.isTarget=function(a){return this.isNode(a)&&a instanceof aa},Object.defineProperties(this,{id:{enumerable:!0,configurable:!0,get:function(){return ca}}}),this.defaults(d.defaults)}var q,r,s,t,u,v,w,x=a.document,y=a.console,z={},A={},B={},C={},D=[],E={},F={},G={canvas:[],image:[],video:[]},H={},I=a.WeakMap&&new WeakMap,J=0,K=function(){},L={transparent:[0,0,0,0],black:[0,0,0,1],red:[1,0,0,1],green:[0,128/255,0,1],blue:[0,0,1,1],white:[1,1,1,1],silver:[192/255,192/255,192/255,1],gray:[128/255,128/255,128/255,1],maroon:[128/255,0,0,1],purple:[128/255,0,128/255,1],fuchsia:[1,0,1,1],lime:[0,1,0,1],olive:[128/255,128/255,0,1],yellow:[1,1,0,1],navy:[0,0,128/255,1],teal:[0,128/255,128/255,1],aqua:[0,1,1,1],orange:[1,165/255,0,1]},M=/^(rgb|hsl)a?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(,\s*(\d+(\.\d*)?)\s*)?\)/i,N=/^#(([0-9a-fA-F]{3,8}))/,O=["x","y","z","w"],P=["r","g","b","a"],Q={srcRGB:770,dstRGB:771,srcAlpha:1,dstAlpha:771},R=["MAX_COMBINED_TEXTURE_IMAGE_UNITS","MAX_FRAGMENT_UNIFORM_VECTORS","MAX_TEXTURE_IMAGE_UNITS","MAX_VARYING_VECTORS","MAX_VERTEX_ATTRIBS","MAX_VERTEX_TEXTURE_IMAGE_UNITS","MAX_VERTEX_UNIFORM_VECTORS"],S=/^[\t ]*#define[\t ]+SHADER_NAME\s+([^$\n\r]+)/i,T={frustum:function(a,b,c,d,e,f,g){g||(g=T.create());var h=b-a,i=d-c,j=f-e;return g[0]=2*e/h,g[1]=0,g[2]=0,g[3]=0,g[4]=0,g[5]=2*e/i,g[6]=0,g[7]=0,g[8]=(b+a)/h,g[9]=(d+c)/i,g[10]=-(f+e)/j,g[11]=-1,g[12]=0,g[13]=0,g[14]=-f*e*2/j,g[15]=0,g},perspective:function(a,b,c,d,e){var f=c*Math.tan(a*Math.PI/360),g=f*b;return T.frustum(-g,g,-f,f,c,d,e)},multiply:function(a,b,c){var d=b[0],e=b[1],f=b[2],g=b[3],h=b[4],i=b[5],j=b[6],k=b[7],l=b[8],m=b[9],n=b[10],o=b[11],p=b[12],q=b[13],r=b[14],s=b[15],t=c[0],u=c[1],v=c[2],w=c[3];return a[0]=t*d+u*h+v*l+w*p,a[1]=t*e+u*i+v*m+w*q,a[2]=t*f+u*j+v*n+w*r,a[3]=t*g+u*k+v*o+w*s,t=c[4],u=c[5],v=c[6],w=c[7],a[4]=t*d+u*h+v*l+w*p,a[5]=t*e+u*i+v*m+w*q,a[6]=t*f+u*j+v*n+w*r,a[7]=t*g+u*k+v*o+w*s,t=c[8],u=c[9],v=c[10],w=c[11],a[8]=t*d+u*h+v*l+w*p,a[9]=t*e+u*i+v*m+w*q,a[10]=t*f+u*j+v*n+w*r,a[11]=t*g+u*k+v*o+w*s,t=c[12],u=c[13],v=c[14],w=c[15],a[12]=t*d+u*h+v*l+w*p,a[13]=t*e+u*i+v*m+w*q,a[14]=t*f+u*j+v*n+w*r,a[15]=t*g+u*k+v*o+w*s,a},identity:function(a){return a[0]=1,a[1]=0,a[2]=0,a[3]=0,a[4]=0,a[5]=1,a[6]=0,a[7]=0,a[8]=0,a[9]=0,a[10]=1,a[11]=0,a[12]=0,a[13]=0,a[14]=0,a[15]=1,a},copy:function(a,b){return a[0]=b[0],a[1]=b[1],a[2]=b[2],a[3]=b[3],a[4]=b[4],a[5]=b[5],a[6]=b[6],a[7]=b[7],a[8]=b[8],a[9]=b[9],a[10]=b[10],a[11]=b[11],a[12]=b[12],a[13]=b[13],a[14]=b[14],a[15]=b[15],a}},U=function(){var b=0;return a.requestAnimationFrame||a.webkitRequestAnimationFrame||a.mozRequestAnimationFrame||a.oRequestAnimationFrame||a.msRequestAnimationFrame||function(c){function d(){c(e+f)}var e,f,g;return e=(new Date).getTime(),f=Math.max(0,16-(e-b)),g=a.setTimeout(d,f),b=e+f,g}}(),V=function(){return a.cancelAnimationFrame||a.webkitCancelAnimationFrame||a.mozCancelAnimationFrame||a.oCancelAnimationFrame||a.msCancelAnimationFrame||function(b){a.cancelTimeout(b)}}(),W=["alias","destroy","effect","id","initialize","inputs","isDestroyed","isReady","matte","off","on","readPixels","render","title","update"],X=["alias","destroy","id","inputs","isDestroyed","isReady","off","on","source","title","update"],Y=["aliases","defaults","destroy","effect","go","id","incompatible","isDestroyed","isEffect","isNode","isSource","isTarget","isTransform","removeAlias","render","source","stop","target","transform"];return a.addEventListener("message",function(b){if(b.source===a&&"seriously-timeout-message"===b.data&&(b.stopPropagation(),D.length>0)){D.shift()()}},!0),n.prototype.resize=function(a,b){var c=this.gl;this.width===a&&this.height===b||(this.width=a,this.height=b,c&&(c.bindTexture(c.TEXTURE_2D,this.texture),c.bindFramebuffer(c.FRAMEBUFFER,this.frameBuffer),c.bindRenderbuffer(c.RENDERBUFFER,this.renderBuffer),c.texImage2D(c.TEXTURE_2D,0,c.RGBA,a,b,0,c.RGBA,c.UNSIGNED_BYTE,null),c.renderbufferStorage(c.RENDERBUFFER,c.DEPTH_COMPONENT16,a,b),c.framebufferTexture2D(c.FRAMEBUFFER,c.COLOR_ATTACHMENT0,c.TEXTURE_2D,this.texture,0),c.bindTexture(c.TEXTURE_2D,null),c.bindRenderbuffer(c.RENDERBUFFER,null),c.bindFramebuffer(c.FRAMEBUFFER,null)))},n.prototype.destroy=function(){var a=this.gl;a&&(a.deleteFramebuffer(this.frameBuffer),a.deleteRenderbuffer(this.renderBuffer),this.ownTexture&&a.deleteTexture(this.texture)),delete this.frameBuffer,delete this.renderBuffer,delete this.texture,delete this.gl},o.prototype.use=function(){this.gl.useProgram(this.program)},p.incompatible=function(b){var c,d,e;if(void 0===s&&(c=x.createElement("canvas"),c&&c.getContext?a.WebGLRenderingContext?(d=k())||(s="context"):s="webgl":s="canvas"),s)return s;if(b){if((e=z[b])&&"function"==typeof e.compatible&&!e.compatible(d))return"plugin-"+b;if((e=B[b])&&"function"==typeof e.compatible&&!e.compatible(d))return"source-"+b}return!1},p.plugin=function(a,b,d){var e;return z[a]?void p.logger.warn("Effect ["+a+"] already loaded"):(void 0===d&&"object"==typeof b&&(d=b),d?(e=c({},d),"function"==typeof b&&(e.definition=b),e.reserved=W,e.inputs&&m(e),e.title||(e.title=a),z[a]=e,E[a]=[],e):void 0)},p.removePlugin=function(a){var b,c;if(!a)return this;if(!z[a])return this;if(b=E[a]){for(;b.length;)c=b.shift(),c.destroy();delete E[a]}return delete z[a],this},p.source=function(a,b,d){var e;return B[a]?void p.logger.warn("Source ["+a+"] already loaded"):(void 0===d&&"object"==typeof b&&(d=b), d||b?(e=c({},d),"function"==typeof b&&(e.definition=b),e.title||(e.title=a),B[a]=e,G[a]=[],e):void 0)},p.removeSource=function(a){var b,c;if(!a)return this;if(!B[a])return this;if(b=G[a]){for(;b.length;)c=b.shift(),c.destroy();delete G[a]}return delete B[a],this},p.transform=function(a,b,d){var e;return A[a]?void p.logger.warn("Transform ["+a+"] already loaded"):(void 0===d&&"object"==typeof b&&(d=b),d||b?(e=c({},d),"function"==typeof b&&(e.definition=b),e.reserved=X,e.inputs&&m(e),e.title||(e.title=a),A[a]=e,F[a]=[],e):void 0)},p.removeTransform=function(a){var b,c;if(!a)return this;if(!A[a])return this;if(b=F[a]){for(;b.length;)c=b.shift(),c.destroy();delete F[a]}return delete A[a],this},p.target=function(a,b,d){var e;return C[a]?void p.logger.warn("Target ["+a+"] already loaded"):(void 0===d&&"object"==typeof b&&(d=b),d||b?(e=c({},d),"function"==typeof b&&(e.definition=b),e.title||(e.title=a),C[a]=e,H[a]=[],e):void 0)},p.removeTarget=function(a){var b,c;if(!a)return this;if(!C[a])return this;if(b=H[a]){for(;b.length;)c=b.shift(),c.destroy();delete H[a]}return delete C[a],this},p.inputValidators={color:function(a,b,c,d){var e,g,i,j;if(g=d||[],"string"==typeof a){if((i=M.exec(a))&&i.length){if(i.length<3)return g[0]=g[1]=g[2]=g[3]=0,g;for(g[3]=1,j=0;j<3;j++)g[j]=parseFloat(i[j+2])/255;return isNaN(i[6])||(g[3]=parseFloat(i[6])),"hsl"===i[1].toLowerCase()?f(g[0],g[1],g[2],g[3],g):g}if((i=N.exec(a))&&i.length)return e=i[1],3===e.length?(g[0]=parseInt(e[0],16)/15,g[1]=parseInt(e[1],16)/15,g[2]=parseInt(e[2],16)/15,g[3]=1):4===e.length?(g[0]=parseInt(e[0],16)/15,g[1]=parseInt(e[1],16)/15,g[2]=parseInt(e[2],16)/15,g[3]=parseInt(e[3],16)/15):6===e.length?(g[0]=parseInt(e.substr(0,2),16)/255,g[1]=parseInt(e.substr(2,2),16)/255,g[2]=parseInt(e.substr(4,2),16)/255,g[3]=1):8===e.length?(g[0]=parseInt(e.substr(0,2),16)/255,g[1]=parseInt(e.substr(2,2),16)/255,g[2]=parseInt(e.substr(4,2),16)/255,g[3]=parseInt(e.substr(6,2),16)/255):g[0]=g[1]=g[2]=g[3]=0,g;if(i=L[a.toLowerCase()]){for(j=0;j<4;j++)g[j]=i[j];return g}return r||(r=x.createElement("canvas").getContext("2d")),(r.fillStyle=a,(e=r.fillStyle)&&"#000000"!==e)?p.inputValidators.color(e,b,c,d):(g[0]=g[1]=g[2]=g[3]=0,g)}if(h(a)){if(g=a,g.length<3)return g[0]=g[1]=g[2]=g[3]=0,g;for(j=0;j<3;j++)if(isNaN(g[j]))return g[0]=g[1]=g[2]=g[3]=0,g;return g.length<4&&g.push(1),g}if("number"==typeof a)return g[0]=g[1]=g[2]=a,g[3]=1,g;if("object"==typeof a){for(j=0;j<4;j++)e=P[j],null===a[e]||isNaN(a[e])?g[j]=3===j?1:0:g[j]=a[e];return g}return g[0]=g[1]=g[2]=g[3]=0,g},number:function(a,b,c){return a=parseFloat(a),isNaN(a)?c||0:(b.mod&&(a-=b.mod*Math.floor(a/b.mod)),a<b.min?b.min:a>b.max?b.max:b.step?Math.round(a/b.step)*b.step:a)},enum:function(a,b,c){var d=b.options||[];return"string"==typeof a?a=a.toLowerCase():"number"==typeof a?a=a.toString():a||(a=""),d.hasOwnProperty(a)?a:c||""},vector:function(a,b,c,d){var e,f,g,i=b.dimensions||4;if(e=d||[],h(a)){for(f=0;f<i;f++)e[f]=a[f]||0;return e}if("object"==typeof a){for(f=0;f<i;f++)g=O[f],void 0===a[g]&&(g=P[f]),e[f]=a[g]||0;return e}for(a=parseFloat(a)||0,f=0;f<i;f++)e[f]=a;return e},boolean:function(a){return!!a&&(!a||!a.toLowerCase||"false"!==a.toLowerCase())},string:function(a){return"string"==typeof a?a:0===a||a?a.toString?a.toString():String(a):""}},p.prototype.effects=p.effects=function(){var a,b,c,d,e,f={};for(a in z)if(z.hasOwnProperty(a)){b=z[a],c={title:b.title||a,description:b.description||"",inputs:{}};for(e in b.inputs)b.inputs.hasOwnProperty(e)&&(d=b.inputs[e],c.inputs[e]={type:d.type,defaultValue:d.defaultValue,step:d.step,min:d.min,max:d.max,mod:d.mod,minCount:d.minCount,maxCount:d.maxCount,dimensions:d.dimensions,title:d.title||e,description:d.description||"",options:d.options||[]});f[a]=c}return f},a.Float32Array&&(t=new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])),a.Seriously&&"object"==typeof a.Seriously&&function(){var b;for(b in a.Seriously)a.Seriously.hasOwnProperty(b)&&"plugin"!==b&&"object"==typeof a.Seriously[b]&&p.plugin(b,a.Seriously[b])}(),p.logger={log:d("log"),info:d("info"),warn:d("warn"),error:d("error")},p.util={mat4:T,checkSource:l,hslToRgb:f,colors:L,setTimeoutZero:i,ShaderProgram:o,FrameBuffer:n,requestAnimationFrame:U,shader:{makeNoise:"float makeNoise(float u, float v, float timer) {\n\tfloat x = u * v * mod(timer * 1000.0, 100.0);\n\tx = mod(x, 13.0) * mod(x, 127.0);\n\tfloat dx = mod(x, 0.01);\n\treturn clamp(0.1 + dx * 100.0, 0.0, 1.0);\n}\n",random:"#ifndef RANDOM\n#define RANDOM\nfloat random(vec2 n) {\n\treturn 0.5 + 0.5 * fract(sin(dot(n.xy, vec2(12.9898, 78.233)))* 43758.5453);\n}\n#endif\n"}},p.source("video",function(b,c,d){function f(){b.removeEventListener("loadedmetadata",f,!0),l||(b.videoWidth?(k.width===b.videoWidth&&k.height===b.videoHeight||(k.width=b.videoWidth,k.height=b.videoHeight,k.resize()),m&&k.setReady()):(m=!0,setTimeout(f,50)))}function g(){n=!0}function h(){n=!1,k.setDirty()}var i,j,k=this,l=!1,m=!1,n=!1,o=0;if(e(b,"HTMLVideoElement"))return b.readyState?f():(m=!0,b.addEventListener("loadedmetadata",f,!0)),b.addEventListener("seeking",g,!1),b.addEventListener("seeked",h,!1),{deferTexture:m,source:b,render:function c(d){var e;if(o=b.currentTime,!b.videoHeight||!b.videoWidth)return!1;u?(j||(j=x.createElement("canvas").getContext("2d"),i=j.canvas,i.width=k.width,i.height=k.height),e=i,j.drawImage(b,0,0,k.width,k.height)):e=b,d.bindTexture(d.TEXTURE_2D,k.texture),d.pixelStorei(d.UNPACK_FLIP_Y_WEBGL,k.flip),d.pixelStorei(d.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1);try{if(d.texImage2D(d.TEXTURE_2D,0,d.RGBA,d.RGBA,d.UNSIGNED_BYTE,e),void 0===u){if(d.getError()===d.INVALID_VALUE)return u=!0,c(d);u=!1}return!0}catch(f){f.code===a.DOMException.SECURITY_ERR?(k.allowRefresh=!1,p.logger.error("Unable to access cross-domain image")):p.logger.error("Error rendering video source",f)}return!1},checkDirty:function(){return!n&&b.currentTime!==o},compare:function(a){return k.source===a},destroy:function(){l=!0,b.removeEventListener("seeking",g,!1),b.removeEventListener("seeked",h,!1),b.removeEventListener("loadedmetadata",f,!0)}}},{title:"Video"}),p.transform("2d",function(a){function b(){function a(a,b){x[12]=x[0]*a+x[4]*b+x[12],x[13]=x[1]*a+x[5]*b+x[13],x[14]=x[2]*a+x[6]*b+x[14],x[15]=x[3]*a+x[7]*b+x[15]}var b,n,o,p,q,r,s,t,u,v,w,x=c.matrix;if(!(i||j||k||l||m||1!==g||1!==h))return void(c.transformed=!1);T.identity(x),a(i+e,j+f),l&&(x[4]=l/c.width),m&&(x[1]=m/c.height),k&&(p=x[0],q=x[1],r=x[2],s=x[3],t=x[4],u=x[5],v=x[6],w=x[7],b=-(d?k*Math.PI/180:k),n=Math.sin(b),o=Math.cos(b),x[0]=p*o+t*n,x[1]=q*o+u*n,x[2]=r*o+v*n,x[3]=s*o+w*n,x[4]=t*o-p*n,x[5]=u*o-q*n,x[6]=v*o-r*n,x[7]=w*o-s*n),1!==g&&(x[0]*=g,x[1]*=g,x[2]*=g,x[3]*=g),1!==h&&(x[4]*=h,x[5]*=h,x[6]*=h,x[7]*=h),a(-e,-f),c.transformed=!0}var c=this,d=!(a&&a.radians),e=0,f=0,g=1,h=1,i=0,j=0,k=0,l=0,m=0;return{inputs:{reset:{method:function(){return e=0,f=0,g=1,h=1,i=0,j=0,k=0,l=0,m=0,!!c.transformed&&(c.transformed=!1,!0)}},translate:{method:function(a,c){return isNaN(a)&&(a=i),isNaN(c)&&(c=j),(a!==i||c!==j)&&(i=a,j=c,b(),!0)},type:["number","number"]},translateX:{get:function(){return i},set:function(a){return a!==i&&(i=a,b(),!0)},type:"number"},translateY:{get:function(){return j},set:function(a){return a!==j&&(j=a,b(),!0)},type:"number"},rotation:{get:function(){return k},set:function(a){return a!==k&&(k=parseFloat(a),b(),!0)},type:"number"},center:{method:function(a,c){return isNaN(a)&&(a=e),isNaN(c)&&(c=f),(a!==e||c!==f)&&(e=a,f=c,b(),!0)},type:["number","number"]},centerX:{get:function(){return e},set:function(a){return a!==e&&(e=a,b(),!0)},type:"number"},centerY:{get:function(){return f},set:function(a){return a!==f&&(f=a,b(),!0)},type:"number"},skew:{method:function(a,c){return isNaN(a)&&(a=l),isNaN(c)&&(c=m),(a!==l||c!==m)&&(l=a,m=c,b(),!0)},type:["number","number"]},skewX:{get:function(){return l},set:function(a){return a!==l&&(l=a,b(),!0)},type:"number"},skewY:{get:function(){return m},set:function(a){return a!==m&&(m=a,b(),!0)},type:"number"},scale:{method:function(a,c){var d,e;if(d=isNaN(a)?g:a,isNaN(c)){if(isNaN(a))return!1;e=d}else e=c;return(d!==g||e!==h)&&(g=d,h=e,b(),!0)},type:["number","number"]},scaleX:{get:function(){return g},set:function(a){return a!==g&&(g=a,b(),!0)},type:"number"},scaleY:{get:function(){return h},set:function(a){return a!==h&&(h=a,b(),!0)},type:"number"}}}},{title:"2D Transform",description:"Translate, Rotate, Scale, Skew"}),p.transform("flip",function(){function a(){var a=b.matrix;c?(a[0]=-1,a[5]=1):(a[0]=1,a[5]=-1)}var b=this,c=!0;return T.identity(b.matrix),a(),b.transformDirty=!0,b.transformed=!0,{inputs:{direction:{get:function(){return c?"horizontal":"vertical"},set:function(b){var d;return(d="vertical"!==b)!==c&&(c=d,a(),!0)},type:"string"}}}},{title:"Flip",description:"Flip Horizontal/Vertical"}),p.transform("reformat",function(){function a(){var a,b,c,h,i=f.matrix,j=d||f.width,k=e||f.height,l=f.source,m=l&&l.width||1,n=l&&l.height||1;return"distort"===g||j===m&&k===n?void(f.transformed=!1):(c=m/n,h=j/k,"none"===g?(a=m/j,b=n/k):"width"===g||"contain"===g&&h<=c?(a=1,b=h/c):"height"===g||"contain"===g&&h>c?(a=c/h,b=1):h>c?(a=1,b=h/c):(a=c/h,b=1),1===a&&1===b?void(f.transformed=!1):(T.identity(i),1!==a&&(i[0]*=a,i[1]*=a,i[2]*=a,i[3]*=a),1!==b&&(i[4]*=b,i[5]*=b,i[6]*=b,i[7]*=b),void(f.transformed=!0)))}function b(){return d||f.source&&f.source.width||1}function c(){return e||f.source&&f.source.height||1}var d,e,f=this,g="contain";return this.resize=function(){var d,e=b(),f=c();if(this.width!==e||this.height!==f)for(this.width=e,this.height=f,this.uniforms&&this.uniforms.resolution&&(this.uniforms.resolution[0]=e,this.uniforms.resolution[1]=f),this.frameBuffer&&this.frameBuffer.resize&&this.frameBuffer.resize(e,f),d=0;d<this.targets.length;d++)this.targets[d].resize();this.setTransformDirty(),a()},{inputs:{width:{get:b,set:function(a){return(a=Math.floor(a))!==d&&(d=a,this.resize(),!1)},type:"number"},height:{get:c,set:function(a){return(a=Math.floor(a))!==e&&(e=a,this.resize(),!1)},type:"number"},mode:{get:function(){return g},set:function(b){return b!==g&&(g=b,a(),!0)},type:"enum",options:["cover","contain","distort","width","height","none"]}}}},{title:"Reformat",description:"Change output dimensions"}),v=["precision mediump float;","attribute vec4 position;","attribute vec2 texCoord;","uniform vec2 resolution;","uniform mat4 transform;","varying vec2 vTexCoord;","void main(void) {","\tvec4 screenPosition = vec4(position.xy * resolution / 2.0, position.z, position.w);","\tscreenPosition = transform * screenPosition;","\tgl_Position.xy = screenPosition.xy * 2.0 / resolution;","\tgl_Position.z = screenPosition.z * 2.0 / (resolution.x / resolution.y);","\tgl_Position.w = screenPosition.w;","\tvTexCoord = texCoord;","}\n"].join("\n"),w=["precision mediump float;","varying vec2 vTexCoord;","uniform sampler2D source;","void main(void) {","\t\tgl_FragColor = texture2D(source, vTexCoord);","}"].join("\n"),p.util.shader.noiseHelpers="#ifndef NOISE_HELPERS\n#define NOISE_HELPERS\nvec2 mod289(vec2 x) {\n\treturn x - floor(x * (1.0 / 289.0)) * 289.0;\n}\nvec3 mod289(vec3 x) {\n\treturn x - floor(x * (1.0 / 289.0)) * 289.0;\n}\nvec4 mod289(vec4 x) {\n\treturn x - floor(x * (1.0 / 289.0)) * 289.0;\n}\nvec3 permute(vec3 x) {\n\treturn mod289(((x*34.0)+1.0)*x);\n}\nvec4 permute(vec4 x) {\n\treturn mod289(((x*34.0)+1.0)*x);\n}\nvec4 taylorInvSqrt(vec4 r) {\n\treturn 1.79284291400159 - 0.85373472095314 * r;\n}\nfloat taylorInvSqrt(float r) {\n\treturn 1.79284291400159 - 0.85373472095314 * r;\n}\n#endif\n",p.util.shader.snoise2d="#ifndef NOISE2D\n#define NOISE2D\nfloat snoise(vec2 v) {\n\tconst vec4 C = vec4(0.211324865405187, // (3.0-sqrt(3.0))/6.0\n\t\t0.366025403784439, // 0.5*(sqrt(3.0)-1.0)\n\t\t-0.577350269189626, // -1.0 + 2.0 * C.x\n\t\t0.024390243902439); // 1.0 / 41.0\n\tvec2 i = floor(v + dot(v, C.yy));\n\tvec2 x0 = v - i + dot(i, C.xx);\n\tvec2 i1;\n\t//i1.x = step(x0.y, x0.x); // x0.x > x0.y ? 1.0 : 0.0\n\t//i1.y = 1.0 - i1.x;\n\ti1 = (x0.x > x0.y) ? vec2(1.0, 0.0) : vec2(0.0, 1.0);\n\t// x0 = x0 - 0.0 + 0.0 * C.xx ;\n\t// x1 = x0 - i1 + 1.0 * C.xx ;\n\t// x2 = x0 - 1.0 + 2.0 * C.xx ;\n\tvec4 x12 = x0.xyxy + C.xxzz;\n\tx12.xy -= i1;\n\ti = mod289(i); // Avoid truncation effects in permutation\n\tvec3 p = permute(permute(i.y + vec3(0.0, i1.y, 1.0)) + i.x + vec3(0.0, i1.x, 1.0));\n\tvec3 m = max(0.5 - vec3(dot(x0, x0), dot(x12.xy, x12.xy), dot(x12.zw, x12.zw)), 0.0);\n\tm = m*m ;\n\tm = m*m ;\n\tvec3 x = 2.0 * fract(p * C.www) - 1.0;\n\tvec3 h = abs(x) - 0.5;\n\tvec3 ox = floor(x + 0.5);\n\tvec3 a0 = x - ox;\n\tm *= 1.79284291400159 - 0.85373472095314 * (a0*a0 + h*h);\n\tvec3 g;\n\tg.x = a0.x * x0.x + h.x * x0.y;\n\tg.yz = a0.yz * x12.xz + h.yz * x12.yw;\n\treturn 130.0 * dot(m, g);\n}\n#endif\n",p.util.shader.snoise3d="#ifndef NOISE3D\n#define NOISE3D\nfloat snoise(vec3 v) {\n\tconst vec2 C = vec2(1.0/6.0, 1.0/3.0) ;\n\tconst vec4 D = vec4(0.0, 0.5, 1.0, 2.0);\n\tvec3 i = floor(v + dot(v, C.yyy));\n\tvec3 x0 = v - i + dot(i, C.xxx) ;\n\tvec3 g = step(x0.yzx, x0.xyz);\n\tvec3 l = 1.0 - g;\n\tvec3 i1 = min(g.xyz, l.zxy);\n\tvec3 i2 = max(g.xyz, l.zxy);\n\t// x0 = x0 - 0.0 + 0.0 * C.xxx;\n\t// x1 = x0 - i1 + 1.0 * C.xxx;\n\t// x2 = x0 - i2 + 2.0 * C.xxx;\n\t// x3 = x0 - 1.0 + 3.0 * C.xxx;\n\tvec3 x1 = x0 - i1 + C.xxx;\n\tvec3 x2 = x0 - i2 + C.yyy; // 2.0*C.x = 1/3 = C.y\n\tvec3 x3 = x0 - D.yyy; // -1.0+3.0*C.x = -0.5 = -D.y\n\ti = mod289(i);\n\tvec4 p = permute(permute(permute(\n\t\t\t\t\t\ti.z + vec4(0.0, i1.z, i2.z, 1.0))\n\t\t\t\t\t\t+ i.y + vec4(0.0, i1.y, i2.y, 1.0))\n\t\t\t\t\t\t+ i.x + vec4(0.0, i1.x, i2.x, 1.0));\n\tfloat n_ = 0.142857142857; // 1.0/7.0\n\tvec3 ns = n_ * D.wyz - D.xzx;\n\tvec4 j = p - 49.0 * floor(p * ns.z * ns.z); // mod(p, 7 * 7)\n\tvec4 x_ = floor(j * ns.z);\n\tvec4 y_ = floor(j - 7.0 * x_); // mod(j, N)\n\tvec4 x = x_ * ns.x + ns.yyyy;\n\tvec4 y = y_ * ns.x + ns.yyyy;\n\tvec4 h = 1.0 - abs(x) - abs(y);\n\tvec4 b0 = vec4(x.xy, y.xy);\n\tvec4 b1 = vec4(x.zw, y.zw);\n\t//vec4 s0 = vec4(lessThan(b0, 0.0)) * 2.0 - 1.0;\n\t//vec4 s1 = vec4(lessThan(b1, 0.0)) * 2.0 - 1.0;\n\tvec4 s0 = floor(b0) * 2.0 + 1.0;\n\tvec4 s1 = floor(b1) * 2.0 + 1.0;\n\tvec4 sh = -step(h, vec4(0.0));\n\tvec4 a0 = b0.xzyw + s0.xzyw * sh.xxyy ;\n\tvec4 a1 = b1.xzyw + s1.xzyw * sh.zzww ;\n\tvec3 p0 = vec3(a0.xy, h.x);\n\tvec3 p1 = vec3(a0.zw, h.y);\n\tvec3 p2 = vec3(a1.xy, h.z);\n\tvec3 p3 = vec3(a1.zw, h.w);\n\tvec4 norm = taylorInvSqrt(vec4(dot(p0, p0), dot(p1, p1), dot(p2, p2), dot(p3, p3)));\n\tp0 *= norm.x;\n\tp1 *= norm.y;\n\tp2 *= norm.z;\n\tp3 *= norm.w;\n\tvec4 m = max(0.6 - vec4(dot(x0, x0), dot(x1, x1), dot(x2, x2), dot(x3, x3)), 0.0);\n\tm = m * m;\n\treturn 42.0 * dot(m*m, vec4(dot(p0, x0), dot(p1, x1), dot(p2, x2), dot(p3, x3)));\n}\n#endif\n",p.util.shader.snoise4d="#ifndef NOISE4D\n#define NOISE4D\nvec4 grad4(float j, vec4 ip)\n\t{\n\tconst vec4 ones = vec4(1.0, 1.0, 1.0, -1.0);\n\tvec4 p, s;\n\n\tp.xyz = floor(fract (vec3(j) * ip.xyz) * 7.0) * ip.z - 1.0;\n\tp.w = 1.5 - dot(abs(p.xyz), ones.xyz);\n\ts = vec4(lessThan(p, vec4(0.0)));\n\tp.xyz = p.xyz + (s.xyz*2.0 - 1.0) * s.www;\n\n\treturn p;\n\t}\n\n#define F4 0.309016994374947451\n\nfloat snoise(vec4 v)\n\t{\n\tconst vec4 C = vec4(0.138196601125011, // (5 - sqrt(5))/20 G4\n\t\t\t\t\t\t0.276393202250021, // 2 * G4\n\t\t\t\t\t\t0.414589803375032, // 3 * G4\n\t\t\t\t\t\t-0.447213595499958); // -1 + 4 * G4\n\n\tvec4 i = floor(v + dot(v, vec4(F4)));\n\tvec4 x0 = v - i + dot(i, C.xxxx);\n\n\n\tvec4 i0;\n\tvec3 isX = step(x0.yzw, x0.xxx);\n\tvec3 isYZ = step(x0.zww, x0.yyz);\n\ti0.x = isX.x + isX.y + isX.z;\n\ti0.yzw = 1.0 - isX;\n\ti0.y += isYZ.x + isYZ.y;\n\ti0.zw += 1.0 - isYZ.xy;\n\ti0.z += isYZ.z;\n\ti0.w += 1.0 - isYZ.z;\n\n\tvec4 i3 = clamp(i0, 0.0, 1.0);\n\tvec4 i2 = clamp(i0 - 1.0, 0.0, 1.0);\n\tvec4 i1 = clamp(i0 - 2.0, 0.0, 1.0);\n\n\tvec4 x1 = x0 - i1 + C.xxxx;\n\tvec4 x2 = x0 - i2 + C.yyyy;\n\tvec4 x3 = x0 - i3 + C.zzzz;\n\tvec4 x4 = x0 + C.wwww;\n\n\ti = mod289(i);\n\tfloat j0 = permute(permute(permute(permute(i.w) + i.z) + i.y) + i.x);\n\tvec4 j1 = permute(permute(permute(permute (\n\t\t\t\t\ti.w + vec4(i1.w, i2.w, i3.w, 1.0))\n\t\t\t\t\t+ i.z + vec4(i1.z, i2.z, i3.z, 1.0))\n\t\t\t\t\t+ i.y + vec4(i1.y, i2.y, i3.y, 1.0))\n\t\t\t\t\t+ i.x + vec4(i1.x, i2.x, i3.x, 1.0));\n\n\tvec4 ip = vec4(1.0/294.0, 1.0/49.0, 1.0/7.0, 0.0) ;\n\n\tvec4 p0 = grad4(j0, ip);\n\tvec4 p1 = grad4(j1.x, ip);\n\tvec4 p2 = grad4(j1.y, ip);\n\tvec4 p3 = grad4(j1.z, ip);\n\tvec4 p4 = grad4(j1.w, ip);\n\n\tvec4 norm = taylorInvSqrt(vec4(dot(p0, p0), dot(p1, p1), dot(p2, p2), dot(p3, p3)));\n\tp0 *= norm.x;\n\tp1 *= norm.y;\n\tp2 *= norm.z;\n\tp3 *= norm.w;\n\tp4 *= taylorInvSqrt(dot(p4, p4));\n\n\tvec3 m0 = max(0.6 - vec3(dot(x0, x0), dot(x1, x1), dot(x2, x2)), 0.0);\n\tvec2 m1 = max(0.6 - vec2(dot(x3, x3), dot(x4, x4)), 0.0);\n\tm0 = m0 * m0;\n\tm1 = m1 * m1;\n\treturn 49.0 * (dot(m0*m0, vec3(dot(p0, x0), dot(p1, x1), dot(p2, x2)))\n\t\t\t\t\t\t\t+ dot(m1*m1, vec2(dot(p3, x3), dot(p4, x4)))) ;\n}\n#endif\n",p}),function(a,b){"use strict";"function"==typeof define&&define.amd?define(["seriously"],b):"object"==typeof exports?b(require("seriously")):(a.Seriously||(a.Seriously={plugin:function(a,b){this[a]=b}}),b(a.Seriously))}(window,function(a){"use strict";function b(a,b,c){function d(a){var d={base:(b||"base")+"."+a,blend:(c||"blend")+"."+a};return function(a){return d[a]||a}}return"vec3("+a.replace(/blend|base/g,d("r"))+", "+a.replace(/blend|base/g,d("g"))+", "+a.replace(/blend|base/g,d("b"))+")"}var c={normal:"blend",lighten:"max(blend, base)",darken:"min(blend, base)",multiply:"(base * blend)",average:"(base + blend / TWO)",add:"min(base + blend, ONE)",subtract:"max(base - blend, ZERO)",divide:"base / blend",difference:"abs(base - blend)",negation:"(ONE - abs(ONE - base - blend))",exclusion:"(base + blend - TWO * base * blend)",screen:"(ONE - ((ONE - base) * (ONE - blend)))",lineardodge:"min(base + blend, ONE)",phoenix:"(min(base, blend) - max(base, blend) + ONE)",linearburn:"max(base + blend - ONE, ZERO)",hue:"BlendHue(base, blend)",saturation:"BlendSaturation(base, blend)",color:"BlendColor(base, blend)",luminosity:"BlendLuminosity(base, blend)",darkercolor:"BlendDarkerColor(base, blend)",lightercolor:"BlendLighterColor(base, blend)",overlay:b("base < 0.5 ? (2.0 * base * blend) : (1.0 - 2.0 * (1.0 - base) * (1.0 - blend))"),softlight:b("blend < 0.5 ? (2.0 * base * blend + base * base * (1.0 - 2.0 * blend)) : (sqrt(base) * (2.0 * blend - 1.0) + 2.0 * base * (1.0 - blend))"),hardlight:b("base < 0.5 ? (2.0 * base * blend) : (1.0 - 2.0 * (1.0 - base) * (1.0 - blend))","blend","base"),colordodge:b("blend == 1.0 ? blend : min(base / (1.0 - blend), 1.0)"),colorburn:b("blend == 0.0 ? blend : max((1.0 - ((1.0 - base) / blend)), 0.0)"),linearlight:b("BlendLinearLightf(base, blend)"),vividlight:b("BlendVividLightf(base, blend)"),pinlight:b("BlendPinLightf(base, blend)"),hardmix:b("BlendHardMixf(base, blend)"),reflect:b("BlendReflectf(base, blend)"),glow:b("BlendReflectf(blend, base)")},d={},e=new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]);a.plugin("blend",function(){function a(){var a=g&&d[g.mode];a&&h&&(i.blendEquation=h[a[0]],i.srcRGB=h[a[1]],i.dstRGB=h[a[2]],i.srcAlpha=h[a[3]],i.dstAlpha=h[a[4]])}var b,f,g,h,i={clear:!1};return this.resize=function(){var a,c,d,e,g,h=this.inputs.sizeMode,i=this.inputs.bottom,j=this.inputs.top;for("bottom"===h||"top"===h?(d=this.inputs[h],d?(a=d.width,c=d.height):(a=1,c=1)):i?j?(e="union"===h?Math.max:Math.min,a=e(i.width,j.width),c=e(i.height,j.height)):(a=i.width,c=i.height):j?(a=j.width,c=j.height):(a=1,c=1),this.width===a&&this.height===c||(this.width=a,this.height=c,this.uniforms.resolution[0]=a,this.uniforms.resolution[1]=c,this.frameBuffer&&this.frameBuffer.resize(a,c),this.emit("resize"),this.setDirty()),this.uniforms.resBottom[0]=i&&i.width||1,this.uniforms.resBottom[1]=i&&i.height||1,this.uniforms.resTop[0]=j&&j.width||1,this.uniforms.resTop[1]=j&&j.height||1,b&&(i&&(f.resolution[0]=i.width,f.resolution[1]=i.height),j&&(b.resolution[0]=j.width,b.resolution[1]=j.height)),g=0;g<this.targets.length;g++)this.targets[g].resize()},this.uniforms.resTop=[1,1],this.uniforms.resBottom=[1,1],{initialize:function(b){g=this.inputs,b(),h=this.gl,a()},shader:function(a,g){var h,i=a.mode||"normal";return i=i.toLowerCase(),d[i]?(b||(h=this.inputs.top,b={resolution:[h&&h.width||1,h&&h.height||1],targetRes:this.uniforms.resolution,source:h,transform:h&&h.cumulativeMatrix||e,opacity:this.inputs.opacity},h=this.inputs.bottom,f={resolution:[h&&h.width||1,h&&h.height||1],targetRes:this.uniforms.resolution,source:h,transform:h&&h.cumulativeMatrix||e,opacity:1}),g.vertex=["#define SHADER_NAME seriously.blend."+i,"precision mediump float;","attribute vec4 position;","attribute vec2 texCoord;","uniform vec2 resolution;","uniform vec2 targetRes;","uniform mat4 transform;","varying vec2 vTexCoord;","void main(void) {","\tvec4 screenPosition = vec4(position.xy * resolution / 2.0, position.z, position.w);","\tscreenPosition = transform * screenPosition;","\tgl_Position.xy = screenPosition.xy * 2.0 / resolution;","\tgl_Position.z = screenPosition.z * 2.0 / (resolution.x / resolution.y);","\tgl_Position.xy *= resolution / targetRes;","\tgl_Position.w = screenPosition.w;","\tvTexCoord = texCoord;","}\n"].join("\n"),g.fragment=["#define SHADER_NAME seriously.blend."+i,"precision mediump float;","varying vec2 vTexCoord;","uniform sampler2D source;","uniform float opacity;","void main(void) {","\tgl_FragColor = texture2D(source, vTexCoord);","\tgl_FragColor.a *= opacity;","}"].join("\n"),g):(b=null,f=null,g.vertex=["#define SHADER_NAME seriously.blend."+i,"precision mediump float;","attribute vec4 position;","attribute vec2 texCoord;","uniform vec2 resolution;","uniform vec2 resBottom;","uniform vec2 resTop;","varying vec2 texCoordBottom;","varying vec2 texCoordTop;","const vec2 HALF = vec2(0.5);","void main(void) {","\tgl_Position = position;","\tvec2 adjusted = (texCoord - HALF) * resolution;","\ttexCoordBottom = adjusted / resBottom + HALF;","\ttexCoordTop = adjusted / resTop + HALF;","}"].join("\n"),g.fragment=["#define SHADER_NAME seriously.blend."+i,"precision mediump float;","const vec3 ZERO = vec3(0.0);","const vec3 ONE = vec3(1.0);","const vec3 HALF = vec3(0.5);","const vec3 TWO = vec3(2.0);","#define BlendAddf(base, blend)\t\t\tmin(base + blend, 1.0)","#define BlendLinearDodgef(base, blend)\tBlendAddf(base, blend)","#define BlendLinearBurnf(base, blend)\tmax(base + blend - 1.0, 0.0)","#define BlendLightenf(base, blend)\t\tmax(blend, base)","#define BlendDarkenf(base, blend)\t\tmin(blend, base)","#define BlendLinearLightf(base, blend)\t(blend < 0.5 ? BlendLinearBurnf(base, (2.0 * blend)) : BlendLinearDodgef(base, (2.0 * (blend - 0.5))))","#define BlendScreenf(base, blend)\t\t(1.0 - ((1.0 - base) * (1.0 - blend)))","#define BlendOverlayf(base, blend)\t\t(base < 0.5 ? (2.0 * base * blend) : (1.0 - 2.0 * (1.0 - base) * (1.0 - blend)))","#define BlendSoftLightf(base, blend)\t((blend < 0.5) ? (2.0 * base * blend + base * base * (1.0 - 2.0 * blend)) : (sqrt(base) * (2.0 * blend - 1.0) + 2.0 * base * (1.0 - blend)))","#define BlendColorDodgef(base, blend)\t((blend == 1.0) ? blend : min(base / (1.0 - blend), 1.0))","#define BlendColorBurnf(base, blend)\t((blend == 0.0) ? blend : max((1.0 - ((1.0 - base) / blend)), 0.0))","#define BlendVividLightf(base, blend)\t((blend < 0.5) ? BlendColorBurnf(base, (2.0 * blend)) : BlendColorDodgef(base, (2.0 * (blend - 0.5))))","#define BlendPinLightf(base, blend)\t((blend < 0.5) ? BlendDarkenf(base, (2.0 * blend)) : BlendLightenf(base, (2.0 *(blend - 0.5))))","#define BlendHardMixf(base, blend)\t\t((BlendVividLightf(base, blend) < 0.5) ? 0.0 : 1.0)","#define BlendReflectf(base, blend)\t\t((blend == 1.0) ? blend : min(base * base / (1.0 - blend), 1.0))","vec3 RGBToHSL(vec3 color) {","\tvec3 hsl;","\tfloat fmin = min(min(color.r, color.g), color.b);","\tfloat fmax = max(max(color.r, color.g), color.b);","\tfloat delta = fmax - fmin;","\thsl.z = (fmax + fmin) / 2.0;","\tif (delta == 0.0) {","\t\thsl.x = 0.0;","\t\thsl.y = 0.0;","\t} else {","\t\tif (hsl.z < 0.5)","\t\t\thsl.y = delta / (fmax + fmin);","\t\telse","\t\t\thsl.y = delta / (2.0 - fmax - fmin);","\t\tfloat deltaR = (((fmax - color.r) / 6.0) + (delta / 2.0)) / delta;","\t\tfloat deltaG = (((fmax - color.g) / 6.0) + (delta / 2.0)) / delta;","\t\tfloat deltaB = (((fmax - color.b) / 6.0) + (delta / 2.0)) / delta;","\t\tif (color.r == fmax )","\t\t\thsl.x = deltaB - deltaG;","\t\telse if (color.g == fmax)","\t\t\thsl.x = (1.0 / 3.0) + deltaR - deltaB;","\t\telse if (color.b == fmax)","\t\t\thsl.x = (2.0 / 3.0) + deltaG - deltaR;","\t\tif (hsl.x < 0.0)","\t\t\thsl.x += 1.0;","\t\telse if (hsl.x > 1.0)","\t\t\thsl.x -= 1.0;","\t}","\treturn hsl;","}","float HueToRGB(float f1, float f2, float hue) {","\tif (hue < 0.0)","\t\thue += 1.0;","\telse if (hue > 1.0)","\t\thue -= 1.0;","\tfloat res;","\tif ((6.0 * hue) < 1.0)","\t\tres = f1 + (f2 - f1) * 6.0 * hue;","\telse if ((2.0 * hue) < 1.0)","\t\tres = f2;","\telse if ((3.0 * hue) < 2.0)","\t\tres = f1 + (f2 - f1) * ((2.0 / 3.0) - hue) * 6.0;","\telse","\t\tres = f1;","\treturn res;","}","vec3 HSLToRGB(vec3 hsl) {","\tvec3 rgb;","\tif (hsl.y == 0.0)","\t\trgb = vec3(hsl.z);","\telse {","\t\tfloat f2;","\t\tif (hsl.z < 0.5)","\t\t\tf2 = hsl.z * (1.0 + hsl.y);","\t\telse","\t\t\tf2 = (hsl.z + hsl.y) - (hsl.y * hsl.z);","\t\tfloat f1 = 2.0 * hsl.z - f2;","\t\trgb.r = HueToRGB(f1, f2, hsl.x + (1.0/3.0));","\t\trgb.g = HueToRGB(f1, f2, hsl.x);","\t\trgb.b= HueToRGB(f1, f2, hsl.x - (1.0/3.0));","\t}","\treturn rgb;","}","vec3 BlendHue(vec3 base, vec3 blend) {","\tvec3 baseHSL = RGBToHSL(base);","\treturn HSLToRGB(vec3(RGBToHSL(blend).r, baseHSL.g, baseHSL.b));","}","vec3 BlendSaturation(vec3 base, vec3 blend) {","\tvec3 baseHSL = RGBToHSL(base);","\treturn HSLToRGB(vec3(baseHSL.r, RGBToHSL(blend).g, baseHSL.b));","}","vec3 BlendColor(vec3 base, vec3 blend) {","\tvec3 blendHSL = RGBToHSL(blend);","\treturn HSLToRGB(vec3(blendHSL.r, blendHSL.g, RGBToHSL(base).b));","}","vec3 BlendLuminosity(vec3 base, vec3 blend) {","\tvec3 baseHSL = RGBToHSL(base);","\treturn HSLToRGB(vec3(baseHSL.r, baseHSL.g, RGBToHSL(blend).b));","}","vec3 BlendLighterColor(vec3 base, vec3 blend) {","\tfloat baseTotal = base.r + base.g + base.b;","\tfloat blendTotal = blend.r + blend.g + blend.b;","\treturn blendTotal > baseTotal ? blend : base;","}","vec3 BlendDarkerColor(vec3 base, vec3 blend) {","\tfloat baseTotal = base.r + base.g + base.b;","\tfloat blendTotal = blend.r + blend.g + blend.b;","\treturn blendTotal < baseTotal ? blend : base;","}","#define BlendFunction(base, blend) "+c[i],"varying vec2 texCoordBottom;","varying vec2 texCoordTop;","uniform sampler2D top;","uniform sampler2D bottom;","uniform float opacity;","uniform float blendGamma;","vec3 BlendOpacity(vec4 base, vec4 blend, float opacity) {","\tvec3 blendedColor = BlendFunction(base.rgb, blend.rgb);","\treturn mix(base.rgb, blendedColor, opacity * blend.a);","}","vec4 linear(vec4 color, vec3 gamma) {","\treturn vec4(pow(color.rgb, gamma), color.a);","}","void main(void) {","\tvec3 exp = vec3(blendGamma);","\tvec4 topPixel = linear(texture2D(top, texCoordTop), exp);","\tvec4 bottomPixel = texture2D(bottom, texCoordBottom);","\tif (topPixel.a == 0.0) {","\t\tgl_FragColor = bottomPixel;","\t} else {","\t\tbottomPixel = linear(bottomPixel, exp);","\t\tgl_FragColor = vec4(pow(BlendOpacity(bottomPixel, topPixel, opacity), 1.0 / exp), bottomPixel.a);","\t}","}"].join("\n"),g)},draw:function(a,c,e,g,j){d[this.inputs.mode]?(this.inputs.bottom?j(a,c,f,g):(h.viewport(0,0,this.width,this.height),h.bindFramebuffer(h.FRAMEBUFFER,g),h.clearColor(0,0,0,0),h.clear(h.COLOR_BUFFER_BIT|h.DEPTH_BUFFER_BIT)),this.inputs.top&&this.inputs.opacity&&j(a,c,b,g,null,i)):j(a,c,e,g)},requires:function(a){return!(!this.inputs.opacity&&"top"===a)},inputs:{top:{type:"image",uniform:"top",update:function(){b&&(b.source=this.inputs.top,b.transform=this.inputs.top.cumulativeMatrix||e),this.resize()}},bottom:{type:"image",uniform:"bottom",update:function(){f&&(f.source=this.inputs.bottom,f.transform=this.inputs.bottom.cumulativeMatrix||e),this.resize()}},opacity:{type:"number",uniform:"opacity",defaultValue:1,min:0,max:1,updateSources:!0,update:function(a){b&&(b.opacity=a)}},blendGamma:{type:"number",uniform:"blendGamma",defaultValue:2.2,min:0,max:4},sizeMode:{type:"enum",defaultValue:"bottom",options:["bottom","top","union","intersection"],update:function(){this.resize()}},mode:{type:"enum",shaderDirty:!0,defaultValue:"normal",options:[["normal","Normal"],["lighten","Lighten"],["darken","Darken"],["multiply","Multiply"],["average","Average"],["add","Add"],["subtract","Subtract"],["divide","Divide"],["difference","Difference"],["negation","Negation"],["exclusion","Exclusion"],["screen","Screen"],["overlay","Overlay"],["softlight","Soft Light"],["hardlight","Hard Light"],["colordodge","Color Dodge"],["colorburn","Color Burn"],["lineardodge","Linear Dodge"],["linearburn","Linear Burn"],["linearlight","Linear Light"],["vividlight","Vivid Light"],["pinlight","Pin Light"],["hardmix","Hard Mix"],["reflect","Reflect"],["glow","Glow"],["phoenix","Phoenix"],["hue","Hue"],["saturation","Saturation"],["color","color"],["luminosity","Luminosity"],["darkercolor","Darker Color"],["lightercolor","Lighter Color"]],update:function(){a()}}}}},{inPlace:function(){return!!d[this.inputs.mode]},description:"Blend two layers",title:"Blend"})}),function(a,b){"use strict";"function"==typeof define&&define.amd?define(["seriously"],b):"object"==typeof exports?b(require("seriously")):(a.Seriously||(a.Seriously={plugin:function(a,b){this[a]=b}}),b(a.Seriously))}(window,function(a){"use strict";function b(a,b){var c;for(c=0;c<b.length;c++)b[c]*=a;return b}var c,d,e,f,g,h=Math.sqrt,i=[];for(e=[b(1/(2*h(2)),[1,h(2),1,0,0,0,-1,-h(2),-1]),b(1/(2*h(2)),[1,0,-1,h(2),0,-h(2),1,0,-1]),b(1/(2*h(2)),[0,-1,h(2),1,0,-1,-h(2),1,0]),b(1/(2*h(2)),[h(2),-1,0,-1,0,1,0,1,-h(2)]),b(.5,[0,1,0,-1,0,-1,0,1,0]),b(.5,[-1,0,1,0,0,0,1,0,-1]),b(1/6,[1,-2,1,-2,4,-2,1,-2,1]),b(1/6,[-2,1,-2,1,4,1,-2,1,-2]),b(1/3,[1,1,1,1,1,1,1,1,1])],c=0;c<e.length;c++)for(d=0;d<e[c].length;d++)i.push(e[c][d]);f=new Float32Array(i),g=new Float32Array([1,2,1,0,0,0,-1,-2,-1,1,0,-1,2,0,-2,1,0,-1]),a.plugin("edge",{initialize:function(a){a(),this.uniforms.pixelWidth=1/this.width,this.uniforms.pixelHeight=1/this.height,"sobel"===this.inputs.mode?this.uniforms.G=g:this.uniforms.G=f},shader:function(a,b){var c;return c="sobel"===a.mode?"#define N_MATRICES 2\n#define SOBEL\n":"#define N_MATRICES 9\n",b.fragment=[c,"precision mediump float;","varying vec2 vTexCoord;","uniform sampler2D source;","uniform float pixelWidth;","uniform float pixelHeight;","uniform mat3 G[9];","void main(void) {","\tmat3 I;","\tfloat dp3, cnv[9];","\tvec3 tc;","\tfloat fi = 0.0, fj = 0.0;","\tfor (int i = 0; i < 3; i++) {","\t\tfj = 0.0;","\t\tfor (int j = 0; j < 3; j++) {","\t\t\tI[i][j] = length( texture2D(source, vTexCoord + vec2((fi - 1.0) * pixelWidth, (fj - 1.0) * pixelHeight)).rgb );","\t\t\tfj += 1.0;","\t\t};","\t\tfi += 1.0;","\t};","\tfor (int i = 0; i < N_MATRICES; i++) {","\t\tdp3 = dot(G[i][0], I[0]) + dot(G[i][1], I[1]) + dot(G[i][2], I[2]);","\t\tcnv[i] = dp3 * dp3;","\t};","#ifdef SOBEL","\ttc = vec3(0.5 * sqrt(cnv[0]*cnv[0]+cnv[1]*cnv[1]));","#else","\tfloat M = (cnv[4] + cnv[5]) + (cnv[6] + cnv[7]);","\tfloat S = (cnv[0] + cnv[1]) + (cnv[2] + cnv[3]) + (cnv[4] + cnv[5]) + (cnv[6] + cnv[7]) + cnv[8];","\ttc = vec3(sqrt(M/S));","#endif","\tgl_FragColor = vec4(tc, 1.0);","}"].join("\n"),b},resize:function(){this.uniforms.pixelWidth=1/this.width,this.uniforms.pixelHeight=1/this.height},inputs:{source:{type:"image",uniform:"source"},mode:{type:"enum",shaderDirty:!0,defaultValue:"sobel",options:[["sobel","Sobel"],["frei-chen","Frei-Chen"]],update:function(){"sobel"===this.inputs.mode?this.uniforms.G=g:this.uniforms.G=f}}},description:"Edge Detect",title:"Edge Detect"})}), function(a,b){"use strict";"function"==typeof define&&define.amd?define(["seriously"],b):"object"==typeof exports?b(require("seriously")):(a.Seriously||(a.Seriously={plugin:function(a,b){this[a]=b}}),b(a.Seriously))}(window,function(a){"use strict";a.plugin("hue-saturation",{commonShader:!0,shader:function(a,b){return b.vertex=["precision mediump float;","attribute vec4 position;","attribute vec2 texCoord;","uniform vec2 resolution;","uniform mat4 projection;","uniform mat4 transform;","uniform float hue;","uniform float saturation;","varying vec2 vTexCoord;","varying vec3 weights;","void main(void) {","\tfloat angle = hue * 3.14159265358979323846264;","\tfloat s = sin(angle);","\tfloat c = cos(angle);","\tweights = (vec3(2.0 * c, -sqrt(3.0) * s - c, sqrt(3.0) * s - c) + 1.0) / 3.0;","\tvec4 screenPosition = vec4(position.xy * resolution / 2.0, position.z, position.w);","\tscreenPosition = transform * screenPosition;","\tgl_Position = screenPosition;","\tgl_Position.xy = screenPosition.xy * 2.0 / resolution;","\tgl_Position.z = screenPosition.z * 2.0 / (resolution.x / resolution.y);","\tvTexCoord = texCoord;","}"].join("\n"),b.fragment=["precision mediump float;","varying vec2 vTexCoord;","varying vec3 weights;","uniform sampler2D source;","uniform float hue;","uniform float saturation;","void main(void) {","\tvec4 color = texture2D(source, vTexCoord);","\tfloat len = length(color.rgb);","\tcolor.rgb = vec3(dot(color.rgb, weights.xyz), dot(color.rgb, weights.zxy), dot(color.rgb, weights.yzx) );","\tvec3 adjustment = (color.r + color.g + color.b) / 3.0 - color.rgb;","\tif (saturation > 0.0) {","\t\tadjustment *= (1.0 - 1.0 / (1.0 - saturation));","\t} else {","\t\tadjustment *= (-saturation);","\t}","\tcolor.rgb += adjustment;","\tgl_FragColor = color;","}"].join("\n"),b},inPlace:!0,inputs:{source:{type:"image",uniform:"source"},hue:{type:"number",uniform:"hue",defaultValue:.4,min:-1,max:1},saturation:{type:"number",uniform:"saturation",defaultValue:0,min:-1,max:1}},title:"Hue/Saturation",description:"Rotate hue and multiply saturation."})}),function(a,b){"use strict";"function"==typeof define&&define.amd?define(["seriously"],b):"object"==typeof exports?b(require("seriously")):(a.Seriously||(a.Seriously={plugin:function(a,b){this[a]=b}}),b(a.Seriously))}(window,function(a){"use strict";var b=new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]),c=/\d+/;a.plugin("layers",function(a){function d(){h.resize()}var e,f,g,h=this,i={clear:!1};for("number"==typeof a&&a>=2?e=a:(e=a&&a.count||4,e=Math.max(2,e)),g={sizeMode:{type:"enum",defaultValue:"0",options:["union","intersection"],update:function(){this.resize()}}},f=0;f<e;f++)g.sizeMode.options.push(f.toString()),g.sizeMode.options.push("source"+f),g["source"+f]={type:"image",update:d},g["opacity"+f]={type:"number",defaultValue:1,min:0,max:1,updateSources:!0};return this.uniforms.layerResolution=[1,1],this.resize=function(){var a,b,d,f,g,h,i=this.inputs.sizeMode;if("union"===i)for(a=0,b=0,d=0;d<e;d++)(g=this.inputs["source"+d])&&(a=Math.max(a,g.width),b=Math.max(b,g.height));else if("intersection"===i)for(a=1/0,b=1/0,d=0;d<e;d++)(g=this.inputs["source"+d])&&(a=Math.min(a,g.width),b=Math.min(b,g.height));else a=1,b=1,f=e-1,h=c.exec(this.inputs.sizeMode),h&&(f=Math.min(parseInt(h[0],10),f)),(g=this.inputs["source"+f])&&(a=g.width,b=g.height);if(this.width!==a||this.height!==b)for(this.width=a,this.height=b,this.uniforms.resolution[0]=a,this.uniforms.resolution[1]=b,this.frameBuffer&&this.frameBuffer.resize(a,b),this.emit("resize"),this.setDirty(),d=0;d<this.targets.length;d++)this.targets[d].resize()},{initialize:function(a){var b=this.gl;a(),i.blendEquation=b.FUNC_ADD,i.srcRGB=b.SRC_ALPHA,i.dstRGB=b.ONE_MINUS_SRC_ALPHA,i.srcAlpha=b.SRC_ALPHA,i.dstAlpha=b.DST_ALPHA},commonShader:!0,shader:function(a,b){return b.vertex=["precision mediump float;","attribute vec4 position;","attribute vec2 texCoord;","uniform vec2 resolution;","uniform vec2 layerResolution;","uniform mat4 transform;","varying vec2 vTexCoord;","void main(void) {","\tvec4 screenPosition = vec4(position.xy * layerResolution / 2.0, position.z, position.w);","\tscreenPosition = transform * screenPosition;","\tgl_Position.xy = screenPosition.xy * 2.0 / layerResolution;","\tgl_Position.z = screenPosition.z * 2.0 / (layerResolution.x / layerResolution.y);","\tgl_Position.xy *= layerResolution / resolution;","\tgl_Position.w = screenPosition.w;","\tvTexCoord = texCoord;","}\n"].join("\n"),b.fragment=["precision mediump float;","varying vec2 vTexCoord;","uniform sampler2D source;","uniform float opacity;","void main(void) {","\tif (any(lessThan(vTexCoord, vec2(0.0))) || any(greaterThanEqual(vTexCoord, vec2(1.0)))) {","\t\tgl_FragColor = vec4(0.0);","\t} else {","\t\tgl_FragColor = texture2D(source, vTexCoord);","\t\tgl_FragColor *= opacity;","\t}","}"].join("\n"),b},requires:function(a,b){var d,f=e;return d=c.exec(this.inputs.sizeMode),d&&(f=parseInt(d[0],10)),!(f>=e)&&!(!b[a]||!b["opacity"+f])},draw:function(a,c,d,f,g){var h,j,k,l=this.gl;for(l.viewport(0,0,this.width,this.height),l.bindFramebuffer(l.FRAMEBUFFER,f),l.clearColor(0,0,0,0),l.clear(l.COLOR_BUFFER_BIT|l.DEPTH_BUFFER_BIT),h=0;h<e;h++)k=this.inputs["source"+h],j=this.inputs["opacity"+h],k&&j&&(d.opacity=j,d.layerResolution[0]=k.width,d.layerResolution[1]=k.height,d.source=k,d.transform=k.cumulativeMatrix||b,g(a,c,d,f,null,i))},inputs:g}},{inPlace:!0,description:"Multiple layers",title:"Layers"})}),function(a,b){"use strict";"function"==typeof define&&define.amd?define(["seriously"],b):"object"==typeof exports?b(require("seriously")):(a.Seriously||(a.Seriously={plugin:function(a,b){this[a]=b}}),b(a.Seriously))}(window,function(a){"use strict";a.plugin("linear-transfer",{commonShader:!0,shader:function(a,b){return b.fragment=["precision mediump float;","varying vec2 vTexCoord;","uniform sampler2D source;","uniform vec4 slope;","uniform vec4 intercept;","const vec3 half3 = vec3(0.5);","void main(void) {","\tvec4 pixel = texture2D(source, vTexCoord);","\tgl_FragColor = pixel * slope + intercept;","}"].join("\n"),b},inPlace:!0,inputs:{source:{type:"image",uniform:"source"},slope:{type:"vector",dimensions:4,uniform:"slope",defaultValue:[1,1,1,1]},intercept:{type:"vector",uniform:"intercept",dimensions:4,defaultValue:[0,0,0,0]}},title:"Linear Transfer",description:"For each color channel: [slope] * [value] + [intercept]"})}),function(a,b){"use strict";"function"==typeof define&&define.amd?define(["seriously"],b):"object"==typeof exports?b(require("seriously")):(a.Seriously||(a.Seriously={plugin:function(a,b){this[a]=b}}),b(a.Seriously))}(window,function(a){"use strict";a.plugin("tone",{commonShader:!0,shader:function(a,b){return b.fragment=["precision mediump float;","varying vec2 vTexCoord;","uniform sampler2D source;","uniform vec4 light;","uniform vec4 dark;","uniform float desat;","uniform float toned;","const vec3 lumcoeff = vec3(0.2125,0.7154,0.0721);","void main(void) {","\tvec4 sourcePixel = texture2D(source, vTexCoord);","\tvec3 sceneColor = light.rgb * sourcePixel.rgb;","\tvec3 gray = vec3(dot(lumcoeff, sceneColor));","\tvec3 muted = mix(sceneColor, gray, desat);","\tvec3 tonedColor = mix(dark.rgb, light.rgb, gray);","\tgl_FragColor = vec4(mix(muted, tonedColor, toned), sourcePixel.a);","}"].join("\n"),b},inPlace:!0,inputs:{source:{type:"image",uniform:"source"},light:{type:"color",uniform:"light",defaultValue:[1,.9,.5,1]},dark:{type:"color",uniform:"dark",defaultValue:[.2,.05,0,1]},toned:{type:"number",uniform:"toned",defaultValue:1,minimumRange:0,maximumRange:1},desat:{type:"number",uniform:"desat",defaultValue:.5,minimumRange:0,maximumRange:1}},title:"Tone",description:""})});var pJS=function(a,b){var c=document.querySelector("#"+a+" > .particles-js-canvas-el");this.pJS={canvas:{el:c,w:c.offsetWidth,h:c.offsetHeight},particles:{number:{value:400,density:{enable:!0,value_area:800}},color:{value:"#fff"},shape:{type:"circle",stroke:{width:0,color:"#ff0000"},polygon:{nb_sides:5},image:{src:"",width:100,height:100}},opacity:{value:1,random:!1,anim:{enable:!1,speed:2,opacity_min:0,sync:!1}},size:{value:20,random:!1,anim:{enable:!1,speed:20,size_min:0,sync:!1}},line_linked:{enable:!0,distance:100,color:"#fff",opacity:1,width:1},move:{enable:!0,speed:2,direction:"none",random:!1,straight:!1,out_mode:"out",bounce:!1,attract:{enable:!1,rotateX:3e3,rotateY:3e3}},array:[]},interactivity:{detect_on:"canvas",events:{onhover:{enable:!0,mode:"grab"},onclick:{enable:!0,mode:"push"},resize:!0},modes:{grab:{distance:100,line_linked:{opacity:1}},bubble:{distance:200,size:80,duration:.4},repulse:{distance:200,duration:.4},push:{particles_nb:4},remove:{particles_nb:2}},mouse:{}},retina_detect:!1,fn:{interact:{},modes:{},vendors:{}},tmp:{}};var d=this.pJS;b&&Object.deepExtend(d,b),d.tmp.obj={size_value:d.particles.size.value,size_anim_speed:d.particles.size.anim.speed,move_speed:d.particles.move.speed,line_linked_distance:d.particles.line_linked.distance,line_linked_width:d.particles.line_linked.width,mode_grab_distance:d.interactivity.modes.grab.distance,mode_bubble_distance:d.interactivity.modes.bubble.distance,mode_bubble_size:d.interactivity.modes.bubble.size,mode_repulse_distance:d.interactivity.modes.repulse.distance},d.fn.retinaInit=function(){d.retina_detect&&window.devicePixelRatio>1?(d.canvas.pxratio=window.devicePixelRatio,d.tmp.retina=!0):(d.canvas.pxratio=1,d.tmp.retina=!1),d.canvas.w=d.canvas.el.offsetWidth*d.canvas.pxratio,d.canvas.h=d.canvas.el.offsetHeight*d.canvas.pxratio,d.particles.size.value=d.tmp.obj.size_value*d.canvas.pxratio,d.particles.size.anim.speed=d.tmp.obj.size_anim_speed*d.canvas.pxratio,d.particles.move.speed=d.tmp.obj.move_speed*d.canvas.pxratio,d.particles.line_linked.distance=d.tmp.obj.line_linked_distance*d.canvas.pxratio,d.interactivity.modes.grab.distance=d.tmp.obj.mode_grab_distance*d.canvas.pxratio,d.interactivity.modes.bubble.distance=d.tmp.obj.mode_bubble_distance*d.canvas.pxratio,d.particles.line_linked.width=d.tmp.obj.line_linked_width*d.canvas.pxratio,d.interactivity.modes.bubble.size=d.tmp.obj.mode_bubble_size*d.canvas.pxratio,d.interactivity.modes.repulse.distance=d.tmp.obj.mode_repulse_distance*d.canvas.pxratio},d.fn.canvasInit=function(){d.canvas.ctx=d.canvas.el.getContext("2d")},d.fn.canvasSize=function(){d.canvas.el.width=d.canvas.w,d.canvas.el.height=d.canvas.h,d&&d.interactivity.events.resize&&window.addEventListener("resize",function(){d.canvas.w=d.canvas.el.offsetWidth,d.canvas.h=d.canvas.el.offsetHeight,d.tmp.retina&&(d.canvas.w*=d.canvas.pxratio,d.canvas.h*=d.canvas.pxratio),d.canvas.el.width=d.canvas.w,d.canvas.el.height=d.canvas.h,d.particles.move.enable||(d.fn.particlesEmpty(),d.fn.particlesCreate(),d.fn.particlesDraw(),d.fn.vendors.densityAutoParticles()),d.fn.vendors.densityAutoParticles()})},d.fn.canvasPaint=function(){d.canvas.ctx.fillRect(0,0,d.canvas.w,d.canvas.h)},d.fn.canvasClear=function(){d.canvas.ctx.clearRect(0,0,d.canvas.w,d.canvas.h)},d.fn.particle=function(a,b,c){if(this.radius=(d.particles.size.random?Math.random():1)*d.particles.size.value,d.particles.size.anim.enable&&(this.size_status=!1,this.vs=d.particles.size.anim.speed/100,d.particles.size.anim.sync||(this.vs=this.vs*Math.random())),this.x=c?c.x:Math.random()*d.canvas.w,this.y=c?c.y:Math.random()*d.canvas.h,this.x>d.canvas.w-2*this.radius?this.x=this.x-this.radius:this.x<2*this.radius&&(this.x=this.x+this.radius),this.y>d.canvas.h-2*this.radius?this.y=this.y-this.radius:this.y<2*this.radius&&(this.y=this.y+this.radius),d.particles.move.bounce&&d.fn.vendors.checkOverlap(this,c),this.color={},"object"==typeof a.value)if(a.value instanceof Array){var e=a.value[Math.floor(Math.random()*d.particles.color.value.length)];this.color.rgb=hexToRgb(e)}else void 0!=a.value.r&&void 0!=a.value.g&&void 0!=a.value.b&&(this.color.rgb={r:a.value.r,g:a.value.g,b:a.value.b}),void 0!=a.value.h&&void 0!=a.value.s&&void 0!=a.value.l&&(this.color.hsl={h:a.value.h,s:a.value.s,l:a.value.l});else"random"==a.value?this.color.rgb={r:Math.floor(256*Math.random())+0,g:Math.floor(256*Math.random())+0,b:Math.floor(256*Math.random())+0}:"string"==typeof a.value&&(this.color=a,this.color.rgb=hexToRgb(this.color.value));this.opacity=(d.particles.opacity.random?Math.random():1)*d.particles.opacity.value,d.particles.opacity.anim.enable&&(this.opacity_status=!1,this.vo=d.particles.opacity.anim.speed/100,d.particles.opacity.anim.sync||(this.vo=this.vo*Math.random()));var f={};switch(d.particles.move.direction){case"top":f={x:0,y:-1};break;case"top-right":f={x:.5,y:-.5};break;case"right":f={x:1,y:-0};break;case"bottom-right":f={x:.5,y:.5};break;case"bottom":f={x:0,y:1};break;case"bottom-left":f={x:-.5,y:1};break;case"left":f={x:-1,y:0};break;case"top-left":f={x:-.5,y:-.5};break;default:f={x:0,y:0}}d.particles.move.straight?(this.vx=f.x,this.vy=f.y,d.particles.move.random&&(this.vx=this.vx*Math.random(),this.vy=this.vy*Math.random())):(this.vx=f.x+Math.random()-.5,this.vy=f.y+Math.random()-.5),this.vx_i=this.vx,this.vy_i=this.vy;var g=d.particles.shape.type;if("object"==typeof g){if(g instanceof Array){var h=g[Math.floor(Math.random()*g.length)];this.shape=h}}else this.shape=g;if("image"==this.shape){var i=d.particles.shape;this.img={src:i.image.src,ratio:i.image.width/i.image.height},this.img.ratio||(this.img.ratio=1),"svg"==d.tmp.img_type&&void 0!=d.tmp.source_svg&&(d.fn.vendors.createSvgImg(this),d.tmp.pushing&&(this.img.loaded=!1))}},d.fn.particle.prototype.draw=function(){function a(){d.canvas.ctx.drawImage(g,b.x-c,b.y-c,2*c,2*c/b.img.ratio)}var b=this;if(void 0!=b.radius_bubble)var c=b.radius_bubble;else var c=b.radius;if(void 0!=b.opacity_bubble)var e=b.opacity_bubble;else var e=b.opacity;if(b.color.rgb)var f="rgba("+b.color.rgb.r+","+b.color.rgb.g+","+b.color.rgb.b+","+e+")";else var f="hsla("+b.color.hsl.h+","+b.color.hsl.s+"%,"+b.color.hsl.l+"%,"+e+")";switch(d.canvas.ctx.fillStyle=f,d.canvas.ctx.beginPath(),b.shape){case"circle":d.canvas.ctx.arc(b.x,b.y,c,0,2*Math.PI,!1);break;case"edge":d.canvas.ctx.rect(b.x-c,b.y-c,2*c,2*c);break;case"triangle":d.fn.vendors.drawShape(d.canvas.ctx,b.x-c,b.y+c/1.66,2*c,3,2);break;case"polygon":d.fn.vendors.drawShape(d.canvas.ctx,b.x-c/(d.particles.shape.polygon.nb_sides/3.5),b.y-c/.76,2.66*c/(d.particles.shape.polygon.nb_sides/3),d.particles.shape.polygon.nb_sides,1);break;case"star":d.fn.vendors.drawShape(d.canvas.ctx,b.x-2*c/(d.particles.shape.polygon.nb_sides/4),b.y-c/1.52,2*c*2.66/(d.particles.shape.polygon.nb_sides/3),d.particles.shape.polygon.nb_sides,2);break;case"image":if("svg"==d.tmp.img_type)var g=b.img.obj;else var g=d.tmp.img_obj;g&&a()}d.canvas.ctx.closePath(),d.particles.shape.stroke.width>0&&(d.canvas.ctx.strokeStyle=d.particles.shape.stroke.color,d.canvas.ctx.lineWidth=d.particles.shape.stroke.width,d.canvas.ctx.stroke()),d.canvas.ctx.fill()},d.fn.particlesCreate=function(){for(var a=0;a<d.particles.number.value;a++)d.particles.array.push(new d.fn.particle(d.particles.color,d.particles.opacity.value))},d.fn.particlesUpdate=function(){for(var a=0;a<d.particles.array.length;a++){var b=d.particles.array[a];if(d.particles.move.enable){var c=d.particles.move.speed/2;b.x+=b.vx*c,b.y+=b.vy*c}if(d.particles.opacity.anim.enable&&(1==b.opacity_status?(b.opacity>=d.particles.opacity.value&&(b.opacity_status=!1),b.opacity+=b.vo):(b.opacity<=d.particles.opacity.anim.opacity_min&&(b.opacity_status=!0),b.opacity-=b.vo),b.opacity<0&&(b.opacity=0)),d.particles.size.anim.enable&&(1==b.size_status?(b.radius>=d.particles.size.value&&(b.size_status=!1),b.radius+=b.vs):(b.radius<=d.particles.size.anim.size_min&&(b.size_status=!0),b.radius-=b.vs),b.radius<0&&(b.radius=0)),"bounce"==d.particles.move.out_mode)var e={x_left:b.radius,x_right:d.canvas.w,y_top:b.radius,y_bottom:d.canvas.h};else var e={x_left:-b.radius,x_right:d.canvas.w+b.radius,y_top:-b.radius,y_bottom:d.canvas.h+b.radius};switch(b.x-b.radius>d.canvas.w?(b.x=e.x_left,b.y=Math.random()*d.canvas.h):b.x+b.radius<0&&(b.x=e.x_right,b.y=Math.random()*d.canvas.h),b.y-b.radius>d.canvas.h?(b.y=e.y_top,b.x=Math.random()*d.canvas.w):b.y+b.radius<0&&(b.y=e.y_bottom,b.x=Math.random()*d.canvas.w),d.particles.move.out_mode){case"bounce":b.x+b.radius>d.canvas.w?b.vx=-b.vx:b.x-b.radius<0&&(b.vx=-b.vx),b.y+b.radius>d.canvas.h?b.vy=-b.vy:b.y-b.radius<0&&(b.vy=-b.vy)}if(isInArray("grab",d.interactivity.events.onhover.mode)&&d.fn.modes.grabParticle(b),(isInArray("bubble",d.interactivity.events.onhover.mode)||isInArray("bubble",d.interactivity.events.onclick.mode))&&d.fn.modes.bubbleParticle(b),(isInArray("repulse",d.interactivity.events.onhover.mode)||isInArray("repulse",d.interactivity.events.onclick.mode))&&d.fn.modes.repulseParticle(b),d.particles.line_linked.enable||d.particles.move.attract.enable)for(var f=a+1;f<d.particles.array.length;f++){var g=d.particles.array[f];d.particles.line_linked.enable&&d.fn.interact.linkParticles(b,g),d.particles.move.attract.enable&&d.fn.interact.attractParticles(b,g),d.particles.move.bounce&&d.fn.interact.bounceParticles(b,g)}}},d.fn.particlesDraw=function(){d.canvas.ctx.clearRect(0,0,d.canvas.w,d.canvas.h),d.fn.particlesUpdate();for(var a=0;a<d.particles.array.length;a++){d.particles.array[a].draw()}},d.fn.particlesEmpty=function(){d.particles.array=[]},d.fn.particlesRefresh=function(){cancelRequestAnimFrame(d.fn.checkAnimFrame),cancelRequestAnimFrame(d.fn.drawAnimFrame),d.tmp.source_svg=void 0,d.tmp.img_obj=void 0,d.tmp.count_svg=0,d.fn.particlesEmpty(),d.fn.canvasClear(),d.fn.vendors.start()},d.fn.interact.linkParticles=function(a,b){var c=a.x-b.x,e=a.y-b.y,f=Math.sqrt(c*c+e*e);if(f<=d.particles.line_linked.distance){var g=d.particles.line_linked.opacity-f/(1/d.particles.line_linked.opacity)/d.particles.line_linked.distance;if(g>0){var h=d.particles.line_linked.color_rgb_line;d.canvas.ctx.strokeStyle="rgba("+h.r+","+h.g+","+h.b+","+g+")",d.canvas.ctx.lineWidth=d.particles.line_linked.width,d.canvas.ctx.beginPath(),d.canvas.ctx.moveTo(a.x,a.y),d.canvas.ctx.lineTo(b.x,b.y),d.canvas.ctx.stroke(),d.canvas.ctx.closePath()}}},d.fn.interact.attractParticles=function(a,b){var c=a.x-b.x,e=a.y-b.y;if(Math.sqrt(c*c+e*e)<=d.particles.line_linked.distance){var f=c/(1e3*d.particles.move.attract.rotateX),g=e/(1e3*d.particles.move.attract.rotateY);a.vx-=f,a.vy-=g,b.vx+=f,b.vy+=g}},d.fn.interact.bounceParticles=function(a,b){var c=a.x-b.x,d=a.y-b.y;Math.sqrt(c*c+d*d)<=a.radius+b.radius&&(a.vx=-a.vx,a.vy=-a.vy,b.vx=-b.vx,b.vy=-b.vy)},d.fn.modes.pushParticles=function(a,b){d.tmp.pushing=!0;for(var c=0;c<a;c++)d.particles.array.push(new d.fn.particle(d.particles.color,d.particles.opacity.value,{x:b?b.pos_x:Math.random()*d.canvas.w,y:b?b.pos_y:Math.random()*d.canvas.h})),c==a-1&&(d.particles.move.enable||d.fn.particlesDraw(),d.tmp.pushing=!1)},d.fn.modes.removeParticles=function(a){d.particles.array.splice(0,a),d.particles.move.enable||d.fn.particlesDraw()},d.fn.modes.bubbleParticle=function(a){function b(){a.opacity_bubble=a.opacity,a.radius_bubble=a.radius}function c(b,c,e,f,h){if(b!=c)if(d.tmp.bubble_duration_end){if(void 0!=e){var i=f-l*(f-b)/d.interactivity.modes.bubble.duration,j=b-i;m=b+j,"size"==h&&(a.radius_bubble=m),"opacity"==h&&(a.opacity_bubble=m)}}else if(g<=d.interactivity.modes.bubble.distance){if(void 0!=e)var k=e;else var k=f;if(k!=b){var m=f-l*(f-b)/d.interactivity.modes.bubble.duration;"size"==h&&(a.radius_bubble=m),"opacity"==h&&(a.opacity_bubble=m)}}else"size"==h&&(a.radius_bubble=void 0),"opacity"==h&&(a.opacity_bubble=void 0)}if(d.interactivity.events.onhover.enable&&isInArray("bubble",d.interactivity.events.onhover.mode)){var e=a.x-d.interactivity.mouse.pos_x,f=a.y-d.interactivity.mouse.pos_y,g=Math.sqrt(e*e+f*f),h=1-g/d.interactivity.modes.bubble.distance;if(g<=d.interactivity.modes.bubble.distance){if(h>=0&&"mousemove"==d.interactivity.status){if(d.interactivity.modes.bubble.size!=d.particles.size.value)if(d.interactivity.modes.bubble.size>d.particles.size.value){var i=a.radius+d.interactivity.modes.bubble.size*h;i>=0&&(a.radius_bubble=i)}else{var j=a.radius-d.interactivity.modes.bubble.size,i=a.radius-j*h;a.radius_bubble=i>0?i:0}if(d.interactivity.modes.bubble.opacity!=d.particles.opacity.value)if(d.interactivity.modes.bubble.opacity>d.particles.opacity.value){var k=d.interactivity.modes.bubble.opacity*h;k>a.opacity&&k<=d.interactivity.modes.bubble.opacity&&(a.opacity_bubble=k)}else{var k=a.opacity-(d.particles.opacity.value-d.interactivity.modes.bubble.opacity)*h;k<a.opacity&&k>=d.interactivity.modes.bubble.opacity&&(a.opacity_bubble=k)}}}else b();"mouseleave"==d.interactivity.status&&b()}else if(d.interactivity.events.onclick.enable&&isInArray("bubble",d.interactivity.events.onclick.mode)){if(d.tmp.bubble_clicking){var e=a.x-d.interactivity.mouse.click_pos_x,f=a.y-d.interactivity.mouse.click_pos_y,g=Math.sqrt(e*e+f*f),l=((new Date).getTime()-d.interactivity.mouse.click_time)/1e3;l>d.interactivity.modes.bubble.duration&&(d.tmp.bubble_duration_end=!0),l>2*d.interactivity.modes.bubble.duration&&(d.tmp.bubble_clicking=!1,d.tmp.bubble_duration_end=!1)}d.tmp.bubble_clicking&&(c(d.interactivity.modes.bubble.size,d.particles.size.value,a.radius_bubble,a.radius,"size"),c(d.interactivity.modes.bubble.opacity,d.particles.opacity.value,a.opacity_bubble,a.opacity,"opacity"))}},d.fn.modes.repulseParticle=function(a){function b(){var b=Math.atan2(m,l);if(a.vx=o*Math.cos(b),a.vy=o*Math.sin(b),"bounce"==d.particles.move.out_mode){var c={x:a.x+a.vx,y:a.y+a.vy};c.x+a.radius>d.canvas.w?a.vx=-a.vx:c.x-a.radius<0&&(a.vx=-a.vx),c.y+a.radius>d.canvas.h?a.vy=-a.vy:c.y-a.radius<0&&(a.vy=-a.vy)}}if(d.interactivity.events.onhover.enable&&isInArray("repulse",d.interactivity.events.onhover.mode)&&"mousemove"==d.interactivity.status){var c=a.x-d.interactivity.mouse.pos_x,e=a.y-d.interactivity.mouse.pos_y,f=Math.sqrt(c*c+e*e),g={x:c/f,y:e/f},h=d.interactivity.modes.repulse.distance,i=100,j=clamp(1/h*(-1*Math.pow(f/h,2)+1)*h*i,0,50),k={x:a.x+g.x*j,y:a.y+g.y*j};"bounce"==d.particles.move.out_mode?(k.x-a.radius>0&&k.x+a.radius<d.canvas.w&&(a.x=k.x),k.y-a.radius>0&&k.y+a.radius<d.canvas.h&&(a.y=k.y)):(a.x=k.x,a.y=k.y)}else if(d.interactivity.events.onclick.enable&&isInArray("repulse",d.interactivity.events.onclick.mode))if(d.tmp.repulse_finish||++d.tmp.repulse_count==d.particles.array.length&&(d.tmp.repulse_finish=!0),d.tmp.repulse_clicking){var h=Math.pow(d.interactivity.modes.repulse.distance/6,3),l=d.interactivity.mouse.click_pos_x-a.x,m=d.interactivity.mouse.click_pos_y-a.y,n=l*l+m*m,o=-h/n*1;n<=h&&b()}else 0==d.tmp.repulse_clicking&&(a.vx=a.vx_i,a.vy=a.vy_i)},d.fn.modes.grabParticle=function(a){if(d.interactivity.events.onhover.enable&&"mousemove"==d.interactivity.status){var b=a.x-d.interactivity.mouse.pos_x,c=a.y-d.interactivity.mouse.pos_y,e=Math.sqrt(b*b+c*c);if(e<=d.interactivity.modes.grab.distance){var f=d.interactivity.modes.grab.line_linked.opacity-e/(1/d.interactivity.modes.grab.line_linked.opacity)/d.interactivity.modes.grab.distance;if(f>0){var g=d.particles.line_linked.color_rgb_line;d.canvas.ctx.strokeStyle="rgba("+g.r+","+g.g+","+g.b+","+f+")",d.canvas.ctx.lineWidth=d.particles.line_linked.width,d.canvas.ctx.beginPath(),d.canvas.ctx.moveTo(a.x,a.y),d.canvas.ctx.lineTo(d.interactivity.mouse.pos_x,d.interactivity.mouse.pos_y),d.canvas.ctx.stroke(),d.canvas.ctx.closePath()}}}},d.fn.vendors.eventsListeners=function(){"window"==d.interactivity.detect_on&&(d.interactivity.el=window),"row"==d.interactivity.detect_on?d.interactivity.el=d.canvas.el.parentNode.parentNode:d.interactivity.el=d.canvas.el,(d.interactivity.events.onhover.enable||d.interactivity.events.onclick.enable)&&("row"==d.interactivity.detect_on?$(d.interactivity.el).mousemove(function(a){var b=a.pageX-$(a.currentTarget).offset().left;pos_y=a.pageY-$(a.currentTarget).offset().top,d.interactivity.mouse.pos_x=b,d.interactivity.mouse.pos_y=pos_y,d.tmp.retina&&(d.interactivity.mouse.pos_x*=d.canvas.pxratio,d.interactivity.mouse.pos_y*=d.canvas.pxratio),d.interactivity.status="mousemove"}):d.interactivity.el.addEventListener("mousemove",function(a){if(d.interactivity.el==window)var b=a.clientX,c=a.clientY;else var b=a.offsetX||a.clientX,c=a.offsetY||a.clientY;d.interactivity.mouse.pos_x=b,d.interactivity.mouse.pos_y=c,d.tmp.retina&&(d.interactivity.mouse.pos_x*=d.canvas.pxratio,d.interactivity.mouse.pos_y*=d.canvas.pxratio),d.interactivity.status="mousemove"}),d.interactivity.el.addEventListener("mouseleave",function(a){d.interactivity.mouse.pos_x=null,d.interactivity.mouse.pos_y=null,d.interactivity.status="mouseleave"})),d.interactivity.events.onclick.enable&&d.interactivity.el.addEventListener("click",function(){if(d.interactivity.mouse.click_pos_x=d.interactivity.mouse.pos_x,d.interactivity.mouse.click_pos_y=d.interactivity.mouse.pos_y,d.interactivity.mouse.click_time=(new Date).getTime(),d.interactivity.events.onclick.enable)switch(d.interactivity.events.onclick.mode){case"push":d.particles.move.enable?d.fn.modes.pushParticles(d.interactivity.modes.push.particles_nb,d.interactivity.mouse):1==d.interactivity.modes.push.particles_nb?d.fn.modes.pushParticles(d.interactivity.modes.push.particles_nb,d.interactivity.mouse):d.interactivity.modes.push.particles_nb>1&&d.fn.modes.pushParticles(d.interactivity.modes.push.particles_nb);break;case"remove":d.fn.modes.removeParticles(d.interactivity.modes.remove.particles_nb);break;case"bubble":d.tmp.bubble_clicking=!0;break;case"repulse":d.tmp.repulse_clicking=!0,d.tmp.repulse_count=0,d.tmp.repulse_finish=!1,setTimeout(function(){d.tmp.repulse_clicking=!1},1e3*d.interactivity.modes.repulse.duration)}})},d.fn.vendors.densityAutoParticles=function(){if(d.particles.number.density.enable){var a=d.canvas.el.width*d.canvas.el.height/1e3;d.tmp.retina&&(a/=2*d.canvas.pxratio);var b=a*d.particles.number.value/d.particles.number.density.value_area,c=d.particles.array.length-b;c<0?d.fn.modes.pushParticles(Math.abs(c)):d.fn.modes.removeParticles(c)}},d.fn.vendors.checkOverlap=function(a,b){for(var c=0;c<d.particles.array.length;c++){var e=d.particles.array[c],f=a.x-e.x,g=a.y-e.y;Math.sqrt(f*f+g*g)<=a.radius+e.radius&&(a.x=b?b.x:Math.random()*d.canvas.w,a.y=b?b.y:Math.random()*d.canvas.h,d.fn.vendors.checkOverlap(a))}},d.fn.vendors.createSvgImg=function(a){var b=d.tmp.source_svg,c=/#([0-9A-F]{3,6})/gi,e=b.replace(c,function(b,c,d,e){if(a.color.rgb)var f="rgba("+a.color.rgb.r+","+a.color.rgb.g+","+a.color.rgb.b+","+a.opacity+")";else var f="hsla("+a.color.hsl.h+","+a.color.hsl.s+"%,"+a.color.hsl.l+"%,"+a.opacity+")";return f}),f=new Blob([e],{type:"image/svg+xml;charset=utf-8"}),g=window.URL||window.webkitURL||window,h=g.createObjectURL(f),i=new Image;i.addEventListener("load",function(){a.img.obj=i,a.img.loaded=!0,g.revokeObjectURL(h),d.tmp.count_svg++}),i.src=h},d.fn.vendors.destroypJS=function(){cancelAnimationFrame(d.fn.drawAnimFrame),c.remove(),pJSDom=null},d.fn.vendors.drawShape=function(a,b,c,d,e,f){var g=e*f,h=e/f,i=180*(h-2)/h,j=Math.PI-Math.PI*i/180;a.save(),a.beginPath(),a.translate(b,c),a.moveTo(0,0);for(var k=0;k<g;k++)a.lineTo(d,0),a.translate(d,0),a.rotate(j);a.fill(),a.restore()},d.fn.vendors.exportImg=function(){window.open(d.canvas.el.toDataURL("image/png"),"_blank")},d.fn.vendors.loadImg=function(a){if(d.tmp.img_error=void 0,""!=d.particles.shape.image.src)if("svg"==a){var b=new XMLHttpRequest;b.open("GET",d.particles.shape.image.src),b.onreadystatechange=function(a){4==b.readyState&&(200==b.status?(d.tmp.source_svg=a.currentTarget.response,d.fn.vendors.checkBeforeDraw()):(console.log("Error pJS - Image not found"),d.tmp.img_error=!0))},b.send()}else{var c=new Image;c.addEventListener("load",function(){d.tmp.img_obj=c,d.fn.vendors.checkBeforeDraw()}),c.src=d.particles.shape.image.src}else console.log("Error pJS - No image.src"),d.tmp.img_error=!0},d.fn.vendors.draw=function(){"image"==d.particles.shape.type?"svg"==d.tmp.img_type?d.tmp.count_svg>=d.particles.number.value?(d.fn.particlesDraw(),d.particles.move.enable?d.fn.drawAnimFrame=requestAnimFrame(d.fn.vendors.draw):cancelRequestAnimFrame(d.fn.drawAnimFrame)):d.tmp.img_error||(d.fn.drawAnimFrame=requestAnimFrame(d.fn.vendors.draw)):void 0!=d.tmp.img_obj?(d.fn.particlesDraw(),d.particles.move.enable?d.fn.drawAnimFrame=requestAnimFrame(d.fn.vendors.draw):cancelRequestAnimFrame(d.fn.drawAnimFrame)):d.tmp.img_error||(d.fn.drawAnimFrame=requestAnimFrame(d.fn.vendors.draw)):(d.fn.particlesDraw(),d.particles.move.enable?d.fn.drawAnimFrame=requestAnimFrame(d.fn.vendors.draw):cancelRequestAnimFrame(d.fn.drawAnimFrame))},d.fn.vendors.checkBeforeDraw=function(){"image"==d.particles.shape.type?"svg"==d.tmp.img_type&&void 0==d.tmp.source_svg?d.tmp.checkAnimFrame=requestAnimFrame(check):(cancelRequestAnimFrame(d.tmp.checkAnimFrame),d.tmp.img_error||(d.fn.vendors.init(),d.fn.vendors.draw())):(d.fn.vendors.init(),d.fn.vendors.draw())},d.fn.vendors.init=function(){d.fn.retinaInit(),d.fn.canvasInit(),d.fn.canvasSize(),d.fn.canvasPaint(),d.fn.particlesCreate(),d.fn.vendors.densityAutoParticles(),d.particles.line_linked.color_rgb_line=hexToRgb(d.particles.line_linked.color)},d.fn.vendors.start=function(){isInArray("image",d.particles.shape.type)?(d.tmp.img_type=d.particles.shape.image.src.substr(d.particles.shape.image.src.length-3),d.fn.vendors.loadImg(d.tmp.img_type)):d.fn.vendors.checkBeforeDraw()},d.fn.vendors.eventsListeners(),d.fn.vendors.start()};Object.deepExtend=function(a,b){for(var c in b)b[c]&&b[c].constructor&&b[c].constructor===Object?(a[c]=a[c]||{},arguments.callee(a[c],b[c])):a[c]=b[c];return a},window.requestAnimFrame=function(){return window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(a){window.setTimeout(a,1e3/60)}}(),window.cancelRequestAnimFrame=function(){return window.cancelAnimationFrame||window.webkitCancelRequestAnimationFrame||window.mozCancelRequestAnimationFrame||window.oCancelRequestAnimationFrame||window.msCancelRequestAnimationFrame||clearTimeout}(),window.pJSDom=[],window.particlesJS=function(a,b){"string"!=typeof a&&(b=a,a="particles-js"),a||(a="particles-js");var c;c=document.getElementById(a);var d="particles-js-canvas-el",e=c.getElementsByClassName(d);if(e.length)for(;e.length>0;)c.removeChild(e[0]);var f=document.createElement("canvas");f.className=d,f.style.width="100%",f.style.height="100%",null!=document.getElementById(a).appendChild(f)&&pJSDom.push(new pJS(a,b))},window.particlesJS.load=function(a,b,c){var d=new XMLHttpRequest;d.open("GET",b),d.onreadystatechange=function(b){if(4==d.readyState)if(200==d.status){var e=JSON.parse(b.currentTarget.response);window.particlesJS(a,e),c&&c()}else console.log("Error pJS - XMLHttpRequest status: "+d.status),console.log("Error pJS - File config not found")},d.send()},function(a,b){"object"==typeof exports&&"undefined"!=typeof module?b(exports):"function"==typeof define&&define.amd?define(["exports"],b):b(a.THREE=a.THREE||{})}(this,function(a){function b(){}function c(a,b){this.x=a||0,this.y=b||0}function d(a,b,e,f,g,h,i,j,k,l){Object.defineProperty(this,"id",{value:Ud++}),this.uuid=Td.generateUUID(),this.sourceFile=this.name="",this.image=void 0!==a?a:d.DEFAULT_IMAGE,this.mipmaps=[],this.mapping=void 0!==b?b:d.DEFAULT_MAPPING,this.wrapS=void 0!==e?e:1001,this.wrapT=void 0!==f?f:1001,this.magFilter=void 0!==g?g:1006,this.minFilter=void 0!==h?h:1008,this.anisotropy=void 0!==k?k:1,this.format=void 0!==i?i:1023,this.type=void 0!==j?j:1009,this.offset=new c(0,0),this.repeat=new c(1,1),this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.encoding=void 0!==l?l:3e3,this.version=0,this.onUpdate=null}function e(a,b,c,d){this.x=a||0,this.y=b||0,this.z=c||0,this.w=void 0!==d?d:1}function f(a,b,c){this.uuid=Td.generateUUID(),this.width=a,this.height=b,this.scissor=new e(0,0,a,b),this.scissorTest=!1,this.viewport=new e(0,0,a,b),c=c||{},void 0===c.minFilter&&(c.minFilter=1006), this.texture=new d(void 0,void 0,c.wrapS,c.wrapT,c.magFilter,c.minFilter,c.format,c.type,c.anisotropy,c.encoding),this.depthBuffer=void 0===c.depthBuffer||c.depthBuffer,this.stencilBuffer=void 0===c.stencilBuffer||c.stencilBuffer,this.depthTexture=void 0!==c.depthTexture?c.depthTexture:null}function g(a,b,c){f.call(this,a,b,c),this.activeMipMapLevel=this.activeCubeFace=0}function h(a,b,c,d){this._x=a||0,this._y=b||0,this._z=c||0,this._w=void 0!==d?d:1}function i(a,b,c){this.x=a||0,this.y=b||0,this.z=c||0}function j(){this.elements=new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]),0<arguments.length&&console.error("THREE.Matrix4: the constructor no longer reads arguments. use .set() instead.")}function k(a,b,c,e,f,g,h,i,j,k){a=void 0!==a?a:[],d.call(this,a,void 0!==b?b:301,c,e,f,g,h,i,j,k),this.flipY=!1}function l(a,b,c){var d=a[0];if(0>=d||0<d)return a;var e=b*c,f=Xd[e];if(void 0===f&&(f=new Float32Array(e),Xd[e]=f),0!==b)for(d.toArray(f,0),d=1,e=0;d!==b;++d)e+=c,a[d].toArray(f,e);return f}function m(a,b){var c=Yd[b];void 0===c&&(c=new Int32Array(b),Yd[b]=c);for(var d=0;d!==b;++d)c[d]=a.allocTextureUnit();return c}function n(a,b){a.uniform1f(this.addr,b)}function o(a,b){a.uniform1i(this.addr,b)}function p(a,b){void 0===b.x?a.uniform2fv(this.addr,b):a.uniform2f(this.addr,b.x,b.y)}function q(a,b){void 0!==b.x?a.uniform3f(this.addr,b.x,b.y,b.z):void 0!==b.r?a.uniform3f(this.addr,b.r,b.g,b.b):a.uniform3fv(this.addr,b)}function r(a,b){void 0===b.x?a.uniform4fv(this.addr,b):a.uniform4f(this.addr,b.x,b.y,b.z,b.w)}function s(a,b){a.uniformMatrix2fv(this.addr,!1,b.elements||b)}function t(a,b){a.uniformMatrix3fv(this.addr,!1,b.elements||b)}function u(a,b){a.uniformMatrix4fv(this.addr,!1,b.elements||b)}function v(a,b,c){var d=c.allocTextureUnit();a.uniform1i(this.addr,d),c.setTexture2D(b||Vd,d)}function w(a,b,c){var d=c.allocTextureUnit();a.uniform1i(this.addr,d),c.setTextureCube(b||Wd,d)}function x(a,b){a.uniform2iv(this.addr,b)}function y(a,b){a.uniform3iv(this.addr,b)}function z(a,b){a.uniform4iv(this.addr,b)}function A(a){switch(a){case 5126:return n;case 35664:return p;case 35665:return q;case 35666:return r;case 35674:return s;case 35675:return t;case 35676:return u;case 35678:return v;case 35680:return w;case 5124:case 35670:return o;case 35667:case 35671:return x;case 35668:case 35672:return y;case 35669:case 35673:return z}}function B(a,b){a.uniform1fv(this.addr,b)}function C(a,b){a.uniform1iv(this.addr,b)}function D(a,b){a.uniform2fv(this.addr,l(b,this.size,2))}function E(a,b){a.uniform3fv(this.addr,l(b,this.size,3))}function F(a,b){a.uniform4fv(this.addr,l(b,this.size,4))}function G(a,b){a.uniformMatrix2fv(this.addr,!1,l(b,this.size,4))}function H(a,b){a.uniformMatrix3fv(this.addr,!1,l(b,this.size,9))}function I(a,b){a.uniformMatrix4fv(this.addr,!1,l(b,this.size,16))}function J(a,b,c){var d=b.length,e=m(c,d);for(a.uniform1iv(this.addr,e),a=0;a!==d;++a)c.setTexture2D(b[a]||Vd,e[a])}function K(a,b,c){var d=b.length,e=m(c,d);for(a.uniform1iv(this.addr,e),a=0;a!==d;++a)c.setTextureCube(b[a]||Wd,e[a])}function L(a){switch(a){case 5126:return B;case 35664:return D;case 35665:return E;case 35666:return F;case 35674:return G;case 35675:return H;case 35676:return I;case 35678:return J;case 35680:return K;case 5124:case 35670:return C;case 35667:case 35671:return x;case 35668:case 35672:return y;case 35669:case 35673:return z}}function M(a,b,c){this.id=a,this.addr=c,this.setValue=A(b.type)}function N(a,b,c){this.id=a,this.addr=c,this.size=b.size,this.setValue=L(b.type)}function O(a){this.id=a,this.seq=[],this.map={}}function P(a,b,c){this.seq=[],this.map={},this.renderer=c,c=a.getProgramParameter(b,a.ACTIVE_UNIFORMS);for(var d=0;d!==c;++d){var e=a.getActiveUniform(b,d),f=a.getUniformLocation(b,e.name),g=this,h=e.name,i=h.length;for(Zd.lastIndex=0;;){var j=Zd.exec(h),k=Zd.lastIndex,l=j[1],m=j[3];if("]"===j[2]&&(l|=0),void 0===m||"["===m&&k+2===i){h=g,e=void 0===m?new M(l,e,f):new N(l,e,f),h.seq.push(e),h.map[e.id]=e;break}m=g.map[l],void 0===m&&(m=new O(l),l=g,g=m,l.seq.push(g),l.map[g.id]=g),g=m}}}function Q(a,b,c){return void 0===b&&void 0===c?this.set(a):this.setRGB(a,b,c)}function R(a,b){this.min=void 0!==a?a:new c(1/0,1/0),this.max=void 0!==b?b:new c(-1/0,-1/0)}function S(a,b){var d,e,f,g,h,j,k,l,m,n,o,p,q,r,s,t,u=a.context,v=a.state;this.render=function(w,x,y){if(0!==b.length){w=new i;var z=y.w/y.z,A=.5*y.z,B=.5*y.w,C=16/y.w,D=new c(C*z,C),E=new i(1,1,0),F=new c(1,1),G=new R;if(G.min.set(y.x,y.y),G.max.set(y.x+(y.z-16),y.y+(y.w-16)),void 0===r){var C=new Float32Array([-1,-1,0,0,1,-1,1,0,1,1,1,1,-1,1,0,1]),H=new Uint16Array([0,1,2,0,2,3]);o=u.createBuffer(),p=u.createBuffer(),u.bindBuffer(u.ARRAY_BUFFER,o),u.bufferData(u.ARRAY_BUFFER,C,u.STATIC_DRAW),u.bindBuffer(u.ELEMENT_ARRAY_BUFFER,p),u.bufferData(u.ELEMENT_ARRAY_BUFFER,H,u.STATIC_DRAW),s=u.createTexture(),t=u.createTexture(),v.bindTexture(u.TEXTURE_2D,s),u.texImage2D(u.TEXTURE_2D,0,u.RGB,16,16,0,u.RGB,u.UNSIGNED_BYTE,null),u.texParameteri(u.TEXTURE_2D,u.TEXTURE_WRAP_S,u.CLAMP_TO_EDGE),u.texParameteri(u.TEXTURE_2D,u.TEXTURE_WRAP_T,u.CLAMP_TO_EDGE),u.texParameteri(u.TEXTURE_2D,u.TEXTURE_MAG_FILTER,u.NEAREST),u.texParameteri(u.TEXTURE_2D,u.TEXTURE_MIN_FILTER,u.NEAREST),v.bindTexture(u.TEXTURE_2D,t),u.texImage2D(u.TEXTURE_2D,0,u.RGBA,16,16,0,u.RGBA,u.UNSIGNED_BYTE,null),u.texParameteri(u.TEXTURE_2D,u.TEXTURE_WRAP_S,u.CLAMP_TO_EDGE),u.texParameteri(u.TEXTURE_2D,u.TEXTURE_WRAP_T,u.CLAMP_TO_EDGE),u.texParameteri(u.TEXTURE_2D,u.TEXTURE_MAG_FILTER,u.NEAREST),u.texParameteri(u.TEXTURE_2D,u.TEXTURE_MIN_FILTER,u.NEAREST);var C=q={vertexShader:"uniform lowp int renderType;\nuniform vec3 screenPosition;\nuniform vec2 scale;\nuniform float rotation;\nuniform sampler2D occlusionMap;\nattribute vec2 position;\nattribute vec2 uv;\nvarying vec2 vUV;\nvarying float vVisibility;\nvoid main() {\nvUV = uv;\nvec2 pos = position;\nif ( renderType == 2 ) {\nvec4 visibility = texture2D( occlusionMap, vec2( 0.1, 0.1 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.5, 0.1 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.9, 0.1 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.9, 0.5 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.9, 0.9 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.5, 0.9 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.1, 0.9 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.1, 0.5 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.5, 0.5 ) );\nvVisibility = visibility.r / 9.0;\nvVisibility *= 1.0 - visibility.g / 9.0;\nvVisibility *= visibility.b / 9.0;\nvVisibility *= 1.0 - visibility.a / 9.0;\npos.x = cos( rotation ) * position.x - sin( rotation ) * position.y;\npos.y = sin( rotation ) * position.x + cos( rotation ) * position.y;\n}\ngl_Position = vec4( ( pos * scale + screenPosition.xy ).xy, screenPosition.z, 1.0 );\n}",fragmentShader:"uniform lowp int renderType;\nuniform sampler2D map;\nuniform float opacity;\nuniform vec3 color;\nvarying vec2 vUV;\nvarying float vVisibility;\nvoid main() {\nif ( renderType == 0 ) {\ngl_FragColor = vec4( 1.0, 0.0, 1.0, 0.0 );\n} else if ( renderType == 1 ) {\ngl_FragColor = texture2D( map, vUV );\n} else {\nvec4 texture = texture2D( map, vUV );\ntexture.a *= opacity * vVisibility;\ngl_FragColor = texture;\ngl_FragColor.rgb *= color;\n}\n}"},H=u.createProgram(),I=u.createShader(u.FRAGMENT_SHADER),J=u.createShader(u.VERTEX_SHADER),K="precision "+a.getPrecision()+" float;\n";u.shaderSource(I,K+C.fragmentShader),u.shaderSource(J,K+C.vertexShader),u.compileShader(I),u.compileShader(J),u.attachShader(H,I),u.attachShader(H,J),u.linkProgram(H),r=H,m=u.getAttribLocation(r,"position"),n=u.getAttribLocation(r,"uv"),d=u.getUniformLocation(r,"renderType"),e=u.getUniformLocation(r,"map"),f=u.getUniformLocation(r,"occlusionMap"),g=u.getUniformLocation(r,"opacity"),h=u.getUniformLocation(r,"color"),j=u.getUniformLocation(r,"scale"),k=u.getUniformLocation(r,"rotation"),l=u.getUniformLocation(r,"screenPosition")}for(u.useProgram(r),v.initAttributes(),v.enableAttribute(m),v.enableAttribute(n),v.disableUnusedAttributes(),u.uniform1i(f,0),u.uniform1i(e,1),u.bindBuffer(u.ARRAY_BUFFER,o),u.vertexAttribPointer(m,2,u.FLOAT,!1,16,0),u.vertexAttribPointer(n,2,u.FLOAT,!1,16,8),u.bindBuffer(u.ELEMENT_ARRAY_BUFFER,p),v.disable(u.CULL_FACE),v.setDepthWrite(!1),H=0,I=b.length;H<I;H++)if(C=16/y.w,D.set(C*z,C),J=b[H],w.set(J.matrixWorld.elements[12],J.matrixWorld.elements[13],J.matrixWorld.elements[14]),w.applyMatrix4(x.matrixWorldInverse),w.applyProjection(x.projectionMatrix),E.copy(w),F.x=y.x+E.x*A+A-8,F.y=y.y+E.y*B+B-8,!0===G.containsPoint(F)){v.activeTexture(u.TEXTURE0),v.bindTexture(u.TEXTURE_2D,null),v.activeTexture(u.TEXTURE1),v.bindTexture(u.TEXTURE_2D,s),u.copyTexImage2D(u.TEXTURE_2D,0,u.RGB,F.x,F.y,16,16,0),u.uniform1i(d,0),u.uniform2f(j,D.x,D.y),u.uniform3f(l,E.x,E.y,E.z),v.disable(u.BLEND),v.enable(u.DEPTH_TEST),u.drawElements(u.TRIANGLES,6,u.UNSIGNED_SHORT,0),v.activeTexture(u.TEXTURE0),v.bindTexture(u.TEXTURE_2D,t),u.copyTexImage2D(u.TEXTURE_2D,0,u.RGBA,F.x,F.y,16,16,0),u.uniform1i(d,1),v.disable(u.DEPTH_TEST),v.activeTexture(u.TEXTURE1),v.bindTexture(u.TEXTURE_2D,s),u.drawElements(u.TRIANGLES,6,u.UNSIGNED_SHORT,0),J.positionScreen.copy(E),J.customUpdateCallback?J.customUpdateCallback(J):J.updateLensFlares(),u.uniform1i(d,2),v.enable(u.BLEND);for(var K=0,L=J.lensFlares.length;K<L;K++){var M=J.lensFlares[K];.001<M.opacity&&.001<M.scale&&(E.x=M.x,E.y=M.y,E.z=M.z,C=M.size*M.scale/y.w,D.x=C*z,D.y=C,u.uniform3f(l,E.x,E.y,E.z),u.uniform2f(j,D.x,D.y),u.uniform1f(k,M.rotation),u.uniform1f(g,M.opacity),u.uniform3f(h,M.color.r,M.color.g,M.color.b),v.setBlending(M.blending,M.blendEquation,M.blendSrc,M.blendDst),a.setTexture2D(M.texture,1),u.drawElements(u.TRIANGLES,6,u.UNSIGNED_SHORT,0))}}v.enable(u.CULL_FACE),v.enable(u.DEPTH_TEST),v.setDepthWrite(!0),a.resetGLState()}}}function T(a,b){function c(a,b){return a.renderOrder!==b.renderOrder?a.renderOrder-b.renderOrder:a.z!==b.z?b.z-a.z:b.id-a.id}var e,f,g,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B=a.context,C=a.state,D=new i,E=new h,F=new i;this.render=function(h,i){if(0!==b.length){if(void 0===z){var G=new Float32Array([-.5,-.5,0,0,.5,-.5,1,0,.5,.5,1,1,-.5,.5,0,1]),H=new Uint16Array([0,1,2,0,2,3]);x=B.createBuffer(),y=B.createBuffer(),B.bindBuffer(B.ARRAY_BUFFER,x),B.bufferData(B.ARRAY_BUFFER,G,B.STATIC_DRAW),B.bindBuffer(B.ELEMENT_ARRAY_BUFFER,y),B.bufferData(B.ELEMENT_ARRAY_BUFFER,H,B.STATIC_DRAW);var G=B.createProgram(),H=B.createShader(B.VERTEX_SHADER),I=B.createShader(B.FRAGMENT_SHADER);B.shaderSource(H,["precision "+a.getPrecision()+" float;","uniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform float rotation;\nuniform vec2 scale;\nuniform vec2 uvOffset;\nuniform vec2 uvScale;\nattribute vec2 position;\nattribute vec2 uv;\nvarying vec2 vUV;\nvoid main() {\nvUV = uvOffset + uv * uvScale;\nvec2 alignedPosition = position * scale;\nvec2 rotatedPosition;\nrotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\nrotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\nvec4 finalPosition;\nfinalPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\nfinalPosition.xy += rotatedPosition;\nfinalPosition = projectionMatrix * finalPosition;\ngl_Position = finalPosition;\n}"].join("\n")),B.shaderSource(I,["precision "+a.getPrecision()+" float;","uniform vec3 color;\nuniform sampler2D map;\nuniform float opacity;\nuniform int fogType;\nuniform vec3 fogColor;\nuniform float fogDensity;\nuniform float fogNear;\nuniform float fogFar;\nuniform float alphaTest;\nvarying vec2 vUV;\nvoid main() {\nvec4 texture = texture2D( map, vUV );\nif ( texture.a < alphaTest ) discard;\ngl_FragColor = vec4( color * texture.xyz, texture.a * opacity );\nif ( fogType > 0 ) {\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\nfloat fogFactor = 0.0;\nif ( fogType == 1 ) {\nfogFactor = smoothstep( fogNear, fogFar, depth );\n} else {\nconst float LOG2 = 1.442695;\nfogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n}\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n}\n}"].join("\n")),B.compileShader(H),B.compileShader(I),B.attachShader(G,H),B.attachShader(G,I),B.linkProgram(G),z=G,v=B.getAttribLocation(z,"position"),w=B.getAttribLocation(z,"uv"),e=B.getUniformLocation(z,"uvOffset"),f=B.getUniformLocation(z,"uvScale"),g=B.getUniformLocation(z,"rotation"),j=B.getUniformLocation(z,"scale"),k=B.getUniformLocation(z,"color"),l=B.getUniformLocation(z,"map"),m=B.getUniformLocation(z,"opacity"),n=B.getUniformLocation(z,"modelViewMatrix"),o=B.getUniformLocation(z,"projectionMatrix"),p=B.getUniformLocation(z,"fogType"),q=B.getUniformLocation(z,"fogDensity"),r=B.getUniformLocation(z,"fogNear"),s=B.getUniformLocation(z,"fogFar"),t=B.getUniformLocation(z,"fogColor"),u=B.getUniformLocation(z,"alphaTest"),G=document.createElementNS("http://www.w3.org/1999/xhtml","canvas"),G.width=8,G.height=8,H=G.getContext("2d"),H.fillStyle="white",H.fillRect(0,0,8,8),A=new d(G),A.needsUpdate=!0}B.useProgram(z),C.initAttributes(),C.enableAttribute(v),C.enableAttribute(w),C.disableUnusedAttributes(),C.disable(B.CULL_FACE),C.enable(B.BLEND),B.bindBuffer(B.ARRAY_BUFFER,x),B.vertexAttribPointer(v,2,B.FLOAT,!1,16,0),B.vertexAttribPointer(w,2,B.FLOAT,!1,16,8),B.bindBuffer(B.ELEMENT_ARRAY_BUFFER,y),B.uniformMatrix4fv(o,!1,i.projectionMatrix.elements),C.activeTexture(B.TEXTURE0),B.uniform1i(l,0),H=G=0,(I=h.fog)?(B.uniform3f(t,I.color.r,I.color.g,I.color.b),I&&I.isFog?(B.uniform1f(r,I.near),B.uniform1f(s,I.far),B.uniform1i(p,1),H=G=1):I&&I.isFogExp2&&(B.uniform1f(q,I.density),B.uniform1i(p,2),H=G=2)):(B.uniform1i(p,0),H=G=0);for(var I=0,J=b.length;I<J;I++){var K=b[I];K.modelViewMatrix.multiplyMatrices(i.matrixWorldInverse,K.matrixWorld),K.z=-K.modelViewMatrix.elements[14]}b.sort(c);for(var L=[],I=0,J=b.length;I<J;I++){var K=b[I],M=K.material;!1!==M.visible&&(B.uniform1f(u,M.alphaTest),B.uniformMatrix4fv(n,!1,K.modelViewMatrix.elements),K.matrixWorld.decompose(D,E,F),L[0]=F.x,L[1]=F.y,K=0,h.fog&&M.fog&&(K=H),G!==K&&(B.uniform1i(p,K),G=K),null!==M.map?(B.uniform2f(e,M.map.offset.x,M.map.offset.y),B.uniform2f(f,M.map.repeat.x,M.map.repeat.y)):(B.uniform2f(e,0,0),B.uniform2f(f,1,1)),B.uniform1f(m,M.opacity),B.uniform3f(k,M.color.r,M.color.g,M.color.b),B.uniform1f(g,M.rotation),B.uniform2fv(j,L),C.setBlending(M.blending,M.blendEquation,M.blendSrc,M.blendDst),C.setDepthTest(M.depthTest),C.setDepthWrite(M.depthWrite),M.map?a.setTexture2D(M.map,0):a.setTexture2D(A,0),B.drawElements(B.TRIANGLES,6,B.UNSIGNED_SHORT,0))}C.enable(B.CULL_FACE),a.resetGLState()}}}function U(){Object.defineProperty(this,"id",{value:de++}),this.uuid=Td.generateUUID(),this.name="",this.type="Material",this.lights=this.fog=!0,this.blending=1,this.side=0,this.shading=2,this.vertexColors=0,this.opacity=1,this.transparent=!1,this.blendSrc=204,this.blendDst=205,this.blendEquation=100,this.blendEquationAlpha=this.blendDstAlpha=this.blendSrcAlpha=null,this.depthFunc=3,this.depthWrite=this.depthTest=!0,this.clippingPlanes=null,this.clipShadows=this.clipIntersection=!1,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.alphaTest=this.polygonOffsetUnits=this.polygonOffsetFactor=0,this.premultipliedAlpha=!1,this.overdraw=0,this._needsUpdate=this.visible=!0}function V(a){U.call(this),this.type="ShaderMaterial",this.defines={},this.uniforms={},this.vertexShader="void main() {\n\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",this.fragmentShader="void main() {\n\tgl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );\n}",this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.morphNormals=this.morphTargets=this.skinning=this.clipping=this.lights=this.fog=!1,this.extensions={derivatives:!1,fragDepth:!1,drawBuffers:!1,shaderTextureLOD:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv2:[0,0]},this.index0AttributeName=void 0,void 0!==a&&(void 0!==a.attributes&&console.error("THREE.ShaderMaterial: attributes should now be defined in THREE.BufferGeometry instead."),this.setValues(a))}function W(a){U.call(this),this.type="MeshDepthMaterial",this.depthPacking=3200,this.morphTargets=this.skinning=!1,this.displacementMap=this.alphaMap=this.map=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.lights=this.fog=!1,this.setValues(a)}function X(a,b){this.min=void 0!==a?a:new i(1/0,1/0,1/0),this.max=void 0!==b?b:new i(-1/0,-1/0,-1/0)}function Y(a,b){this.center=void 0!==a?a:new i,this.radius=void 0!==b?b:0}function Z(){this.elements=new Float32Array([1,0,0,0,1,0,0,0,1]),0<arguments.length&&console.error("THREE.Matrix3: the constructor no longer reads arguments. use .set() instead.")}function $(a,b){this.normal=void 0!==a?a:new i(1,0,0),this.constant=void 0!==b?b:0}function _(a,b,c,d,e,f){this.planes=[void 0!==a?a:new $,void 0!==b?b:new $,void 0!==c?c:new $,void 0!==d?d:new $,void 0!==e?e:new $,void 0!==f?f:new $]}function aa(a,b,d,g){function h(b,c,d,e){var f,g=b.geometry;f=v;var h=b.customDepthMaterial;return d&&(f=w,h=b.customDistanceMaterial),h?f=h:(h=!1,c.morphTargets&&(g&&g.isBufferGeometry?h=g.morphAttributes&&g.morphAttributes.position&&0<g.morphAttributes.position.length:g&&g.isGeometry&&(h=g.morphTargets&&0<g.morphTargets.length)),b=b.isSkinnedMesh&&c.skinning,g=0,h&&(g|=1),b&&(g|=2),f=f[g]),a.localClippingEnabled&&!0===c.clipShadows&&0!==c.clippingPlanes.length&&(g=f.uuid,h=c.uuid,b=x[g],void 0===b&&(b={},x[g]=b),g=b[h],void 0===g&&(g=f.clone(),b[h]=g),f=g),f.visible=c.visible,f.wireframe=c.wireframe,h=c.side,G.renderSingleSided&&2==h&&(h=0),G.renderReverseSided&&(0===h?h=1:1===h&&(h=0)),f.side=h,f.clipShadows=c.clipShadows,f.clippingPlanes=c.clippingPlanes,f.wireframeLinewidth=c.wireframeLinewidth,f.linewidth=c.linewidth,d&&void 0!==f.uniforms.lightPos&&f.uniforms.lightPos.value.copy(e),f}function k(a,b,c){if(!1!==a.visible){0!=(a.layers.mask&b.layers.mask)&&(a.isMesh||a.isLine||a.isPoints)&&a.castShadow&&(!1===a.frustumCulled||!0===n.intersectsObject(a))&&!0===a.material.visible&&(a.modelViewMatrix.multiplyMatrices(c.matrixWorldInverse,a.matrixWorld),u.push(a)),a=a.children;for(var d=0,e=a.length;d<e;d++)k(a[d],b,c)}}var l=a.context,m=a.state,n=new _,o=new j,p=b.shadows,q=new c,r=new c(g.maxTextureSize,g.maxTextureSize),s=new i,t=new i,u=[],v=Array(4),w=Array(4),x={},y=[new i(1,0,0),new i(-1,0,0),new i(0,0,1),new i(0,0,-1),new i(0,1,0),new i(0,-1,0)],z=[new i(0,1,0),new i(0,1,0),new i(0,1,0),new i(0,1,0),new i(0,0,1),new i(0,0,-1)],A=[new e,new e,new e,new e,new e,new e];b=new W,b.depthPacking=3201,b.clipping=!0,g=ce.distanceRGBA;for(var B=$d.clone(g.uniforms),C=0;4!==C;++C){var D=0!=(1&C),E=0!=(2&C),F=b.clone();F.morphTargets=D,F.skinning=E,v[C]=F,D=new V({defines:{USE_SHADOWMAP:""},uniforms:B,vertexShader:g.vertexShader,fragmentShader:g.fragmentShader,morphTargets:D,skinning:E,clipping:!0}),w[C]=D}var G=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=1,this.renderSingleSided=this.renderReverseSided=!0,this.render=function(b,c){if(!1!==G.enabled&&(!1!==G.autoUpdate||!1!==G.needsUpdate)&&0!==p.length){m.clearColor(1,1,1,1),m.disable(l.BLEND),m.setDepthTest(!0),m.setScissorTest(!1);for(var e,g,i=0,j=p.length;i<j;i++){var v=p[i],w=v.shadow;if(void 0===w)console.warn("THREE.WebGLShadowMap:",v,"has no shadow.");else{var x=w.camera;if(q.copy(w.mapSize),q.min(r),v&&v.isPointLight){e=6,g=!0;var B=q.x,C=q.y;A[0].set(2*B,C,B,C),A[1].set(0,C,B,C),A[2].set(3*B,C,B,C),A[3].set(B,C,B,C),A[4].set(3*B,0,B,C),A[5].set(B,0,B,C),q.x*=4,q.y*=2}else e=1,g=!1;for(null===w.map&&(w.map=new f(q.x,q.y,{minFilter:1003,magFilter:1003,format:1023}),x.updateProjectionMatrix()),w&&w.isSpotLightShadow&&w.update(v),B=w.map,w=w.matrix,t.setFromMatrixPosition(v.matrixWorld),x.position.copy(t),a.setRenderTarget(B),a.clear(),B=0;B<e;B++){g?(s.copy(x.position),s.add(y[B]),x.up.copy(z[B]),x.lookAt(s),m.viewport(A[B])):(s.setFromMatrixPosition(v.target.matrixWorld),x.lookAt(s)),x.updateMatrixWorld(),x.matrixWorldInverse.getInverse(x.matrixWorld),w.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),w.multiply(x.projectionMatrix),w.multiply(x.matrixWorldInverse),o.multiplyMatrices(x.projectionMatrix,x.matrixWorldInverse),n.setFromMatrix(o),u.length=0,k(b,c,x);for(var C=0,D=u.length;C<D;C++){var E=u[C],F=d.update(E),H=E.material;if(H&&H.isMultiMaterial)for(var I=F.groups,H=H.materials,J=0,K=I.length;J<K;J++){var L=I[J],M=H[L.materialIndex];!0===M.visible&&(M=h(E,M,g,t),a.renderBufferDirect(x,null,F,M,E,L))}else M=h(E,H,g,t),a.renderBufferDirect(x,null,F,M,E,null)}}}}e=a.getClearColor(),g=a.getClearAlpha(),a.setClearColor(e,g),G.needsUpdate=!1}}}function ba(a,b){this.origin=void 0!==a?a:new i,this.direction=void 0!==b?b:new i}function ca(a,b,c,d){this._x=a||0,this._y=b||0,this._z=c||0,this._order=d||ca.DefaultOrder}function da(){this.mask=1}function ea(){Object.defineProperty(this,"id",{value:ee++}),this.uuid=Td.generateUUID(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=ea.DefaultUp.clone();var a=new i,b=new ca,c=new h,d=new i(1,1,1);b.onChange(function(){c.setFromEuler(b,!1)}),c.onChange(function(){b.setFromQuaternion(c,void 0,!1)}),Object.defineProperties(this,{position:{enumerable:!0,value:a},rotation:{enumerable:!0,value:b},quaternion:{enumerable:!0,value:c},scale:{enumerable:!0,value:d},modelViewMatrix:{value:new j},normalMatrix:{value:new Z}}),this.matrix=new j,this.matrixWorld=new j,this.matrixAutoUpdate=ea.DefaultMatrixAutoUpdate,this.matrixWorldNeedsUpdate=!1,this.layers=new da,this.visible=!0,this.receiveShadow=this.castShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.userData={},this.onBeforeRender=function(){},this.onAfterRender=function(){}}function fa(a,b){this.start=void 0!==a?a:new i,this.end=void 0!==b?b:new i}function ga(a,b,c){this.a=void 0!==a?a:new i,this.b=void 0!==b?b:new i,this.c=void 0!==c?c:new i}function ha(a,b,c,d,e,f){this.a=a,this.b=b,this.c=c,this.normal=d&&d.isVector3?d:new i,this.vertexNormals=Array.isArray(d)?d:[],this.color=e&&e.isColor?e:new Q,this.vertexColors=Array.isArray(e)?e:[],this.materialIndex=void 0!==f?f:0}function ia(a){U.call(this),this.type="MeshBasicMaterial",this.color=new Q(16777215),this.aoMap=this.map=null,this.aoMapIntensity=1,this.envMap=this.alphaMap=this.specularMap=null,this.combine=0,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinejoin=this.wireframeLinecap="round",this.lights=this.morphTargets=this.skinning=!1,this.setValues(a)}function ja(a,b,c){if(Array.isArray(a))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.uuid=Td.generateUUID(),this.array=a,this.itemSize=b,this.count=void 0!==a?a.length/b:0,this.normalized=!0===c,this.dynamic=!1,this.updateRange={offset:0,count:-1},this.version=0}function ka(a,b){return new ja(new Uint16Array(a),b)}function la(a,b){return new ja(new Uint32Array(a),b)}function ma(a,b){return new ja(new Float32Array(a),b)}function na(){Object.defineProperty(this,"id",{value:fe++}),this.uuid=Td.generateUUID(),this.name="",this.type="Geometry",this.vertices=[],this.colors=[],this.faces=[],this.faceVertexUvs=[[]],this.morphTargets=[],this.morphNormals=[],this.skinWeights=[],this.skinIndices=[],this.lineDistances=[],this.boundingSphere=this.boundingBox=null,this.groupsNeedUpdate=this.lineDistancesNeedUpdate=this.colorsNeedUpdate=this.normalsNeedUpdate=this.uvsNeedUpdate=this.verticesNeedUpdate=this.elementsNeedUpdate=!1}function oa(){Object.defineProperty(this,"id",{value:fe++}),this.uuid=Td.generateUUID(),this.name="",this.type="DirectGeometry",this.indices=[],this.vertices=[],this.normals=[],this.colors=[],this.uvs=[],this.uvs2=[],this.groups=[],this.morphTargets={},this.skinWeights=[],this.skinIndices=[],this.boundingSphere=this.boundingBox=null,this.groupsNeedUpdate=this.uvsNeedUpdate=this.colorsNeedUpdate=this.normalsNeedUpdate=this.verticesNeedUpdate=!1}function pa(){Object.defineProperty(this,"id",{value:fe++}),this.uuid=Td.generateUUID(),this.name="",this.type="BufferGeometry",this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingSphere=this.boundingBox=null,this.drawRange={start:0,count:1/0}}function qa(a,b){ea.call(this),this.type="Mesh",this.geometry=void 0!==a?a:new pa,this.material=void 0!==b?b:new ia({color:16777215*Math.random()}),this.drawMode=0,this.updateMorphTargets()}function ra(a,b,c,d,e,f){function g(a,b,c,d,e,f,g,j,k,u,v){var w=f/k,x=g/u,y=f/2,z=g/2,A=j/2;g=k+1;for(var B=u+1,C=f=0,D=new i,E=0;E<B;E++)for(var F=E*x-z,G=0;G<g;G++)D[a]=(G*w-y)*d,D[b]=F*e,D[c]=A,m[p]=D.x,m[p+1]=D.y,m[p+2]=D.z,D[a]=0,D[b]=0,D[c]=0<j?1:-1,n[p]=D.x,n[p+1]=D.y,n[p+2]=D.z,o[q]=G/k,o[q+1]=1-E/u,p+=3,q+=2,f+=1;for(E=0;E<u;E++)for(G=0;G<k;G++)a=s+G+g*(E+1),b=s+(G+1)+g*(E+1),c=s+(G+1)+g*E,l[r]=s+G+g*E,l[r+1]=a,l[r+2]=c,l[r+3]=a,l[r+4]=b,l[r+5]=c,r+=6,C+=6;h.addGroup(t,C,v),t+=C,s+=f}pa.call(this),this.type="BoxBufferGeometry",this.parameters={width:a,height:b,depth:c,widthSegments:d,heightSegments:e,depthSegments:f};var h=this;d=Math.floor(d)||1,e=Math.floor(e)||1,f=Math.floor(f)||1;var j=function(a,b,c){return a=0+(a+1)*(b+1)*2+(a+1)*(c+1)*2+(c+1)*(b+1)*2}(d,e,f),k=function(a,b,c){return 6*(a=0+a*b*2+a*c*2+c*b*2)}(d,e,f),l=new(65535<k?Uint32Array:Uint16Array)(k),m=new Float32Array(3*j),n=new Float32Array(3*j),o=new Float32Array(2*j),p=0,q=0,r=0,s=0,t=0;g("z","y","x",-1,-1,c,b,a,f,e,0),g("z","y","x",1,-1,c,b,-a,f,e,1),g("x","z","y",1,1,a,c,b,d,f,2),g("x","z","y",1,-1,a,c,-b,d,f,3),g("x","y","z",1,-1,a,b,c,d,e,4),g("x","y","z",-1,-1,a,b,-c,d,e,5),this.setIndex(new ja(l,1)),this.addAttribute("position",new ja(m,3)),this.addAttribute("normal",new ja(n,3)),this.addAttribute("uv",new ja(o,2))}function sa(a,b,c,d){pa.call(this),this.type="PlaneBufferGeometry",this.parameters={width:a,height:b,widthSegments:c,heightSegments:d};var e=a/2,f=b/2;c=Math.floor(c)||1,d=Math.floor(d)||1;var g=c+1,h=d+1,i=a/c,j=b/d;b=new Float32Array(g*h*3),a=new Float32Array(g*h*3);for(var k=new Float32Array(g*h*2),l=0,m=0,n=0;n<h;n++)for(var o=n*j-f,p=0;p<g;p++)b[l]=p*i-e,b[l+1]=-o,a[l+2]=1,k[m]=p/c,k[m+1]=1-n/d,l+=3,m+=2;for(l=0,e=new(65535<b.length/3?Uint32Array:Uint16Array)(c*d*6),n=0;n<d;n++)for(p=0;p<c;p++)f=p+g*(n+1),h=p+1+g*(n+1),i=p+1+g*n,e[l]=p+g*n,e[l+1]=f,e[l+2]=i,e[l+3]=f,e[l+4]=h,e[l+5]=i,l+=6;this.setIndex(new ja(e,1)),this.addAttribute("position",new ja(b,3)),this.addAttribute("normal",new ja(a,3)),this.addAttribute("uv",new ja(k,2))}function ta(){ea.call(this),this.type="Camera",this.matrixWorldInverse=new j,this.projectionMatrix=new j}function ua(a,b,c,d){ta.call(this),this.type="PerspectiveCamera",this.fov=void 0!==a?a:50,this.zoom=1,this.near=void 0!==c?c:.1,this.far=void 0!==d?d:2e3,this.focus=10,this.aspect=void 0!==b?b:1,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}function va(a,b,c,d,e,f){ta.call(this),this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=a,this.right=b,this.top=c,this.bottom=d,this.near=void 0!==e?e:.1,this.far=void 0!==f?f:2e3,this.updateProjectionMatrix()}function wa(a,b,c){var d,e,f;return{setMode:function(a){d=a},setIndex:function(c){c.array instanceof Uint32Array&&b.get("OES_element_index_uint")?(e=a.UNSIGNED_INT,f=4):(e=a.UNSIGNED_SHORT,f=2)},render:function(b,g){a.drawElements(d,g,e,b*f),c.calls++,c.vertices+=g,d===a.TRIANGLES&&(c.faces+=g/3)},renderInstances:function(g,h,i){var j=b.get("ANGLE_instanced_arrays");null===j?console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays."):(j.drawElementsInstancedANGLE(d,i,e,h*f,g.maxInstancedCount),c.calls++,c.vertices+=i*g.maxInstancedCount,d===a.TRIANGLES&&(c.faces+=g.maxInstancedCount*i/3))}}}function xa(a,b,c){var d;return{setMode:function(a){d=a},render:function(b,e){a.drawArrays(d,b,e),c.calls++,c.vertices+=e,d===a.TRIANGLES&&(c.faces+=e/3)},renderInstances:function(e){var f=b.get("ANGLE_instanced_arrays");if(null===f)console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");else{var g=e.attributes.position,g=g&&g.isInterleavedBufferAttribute?g.data.count:g.count;f.drawArraysInstancedANGLE(d,0,g,e.maxInstancedCount),c.calls++,c.vertices+=g*e.maxInstancedCount,d===a.TRIANGLES&&(c.faces+=e.maxInstancedCount*g/3)}}}}function ya(){var a={};return{get:function(b){if(void 0!==a[b.id])return a[b.id];var d;switch(b.type){case"DirectionalLight":d={direction:new i,color:new Q,shadow:!1,shadowBias:0,shadowRadius:1,shadowMapSize:new c};break;case"SpotLight":d={position:new i,direction:new i,color:new Q,distance:0,coneCos:0,penumbraCos:0,decay:0,shadow:!1,shadowBias:0,shadowRadius:1,shadowMapSize:new c};break;case"PointLight":d={position:new i,color:new Q,distance:0,decay:0,shadow:!1,shadowBias:0,shadowRadius:1,shadowMapSize:new c};break;case"HemisphereLight":d={direction:new i,skyColor:new Q,groundColor:new Q}}return a[b.id]=d}}}function za(a){a=a.split("\n");for(var b=0;b<a.length;b++)a[b]=b+1+": "+a[b];return a.join("\n")}function Aa(a,b,c){var d=a.createShader(b);return a.shaderSource(d,c),a.compileShader(d),!1===a.getShaderParameter(d,a.COMPILE_STATUS)&&console.error("THREE.WebGLShader: Shader couldn't compile."),""!==a.getShaderInfoLog(d)&&console.warn("THREE.WebGLShader: gl.getShaderInfoLog()",b===a.VERTEX_SHADER?"vertex":"fragment",a.getShaderInfoLog(d),za(c)),d}function Ba(a){switch(a){case 3e3:return["Linear","( value )"];case 3001:return["sRGB","( value )"];case 3002:return["RGBE","( value )"];case 3004:return["RGBM","( value, 7.0 )"];case 3005:return["RGBM","( value, 16.0 )"];case 3006:return["RGBD","( value, 256.0 )"];case 3007:return["Gamma","( value, float( GAMMA_FACTOR ) )"];default:throw Error("unsupported encoding: "+a)}}function Ca(a,b){var c=Ba(b);return"vec4 "+a+"( vec4 value ) { return "+c[0]+"ToLinear"+c[1]+"; }"}function Da(a,b){var c=Ba(b);return"vec4 "+a+"( vec4 value ) { return LinearTo"+c[0]+c[1]+"; }"}function Ea(a,b){var c;switch(b){case 1:c="Linear";break;case 2:c="Reinhard";break;case 3:c="Uncharted2";break;case 4:c="OptimizedCineon";break;default:throw Error("unsupported toneMapping: "+b)}return"vec3 "+a+"( vec3 color ) { return "+c+"ToneMapping( color ); }"}function Fa(a,b,c){return a=a||{},[a.derivatives||b.envMapCubeUV||b.bumpMap||b.normalMap||b.flatShading?"#extension GL_OES_standard_derivatives : enable":"",(a.fragDepth||b.logarithmicDepthBuffer)&&c.get("EXT_frag_depth")?"#extension GL_EXT_frag_depth : enable":"",a.drawBuffers&&c.get("WEBGL_draw_buffers")?"#extension GL_EXT_draw_buffers : require":"",(a.shaderTextureLOD||b.envMap)&&c.get("EXT_shader_texture_lod")?"#extension GL_EXT_shader_texture_lod : enable":""].filter(Ha).join("\n")}function Ga(a){var b,c=[];for(b in a){var d=a[b];!1!==d&&c.push("#define "+b+" "+d)}return c.join("\n")}function Ha(a){return""!==a}function Ia(a,b){return a.replace(/NUM_DIR_LIGHTS/g,b.numDirLights).replace(/NUM_SPOT_LIGHTS/g,b.numSpotLights).replace(/NUM_POINT_LIGHTS/g,b.numPointLights).replace(/NUM_HEMI_LIGHTS/g,b.numHemiLights)}function Ja(a){return a.replace(/#include +<([\w\d.]+)>/g,function(a,b){var c=_d[b];if(void 0===c)throw Error("Can not resolve #include <"+b+">");return Ja(c)})}function Ka(a){return a.replace(/for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}/g,function(a,b,c,d){for(a="",b=parseInt(b);b<parseInt(c);b++)a+=d.replace(/\[ i \]/g,"[ "+b+" ]");return a})}function La(a,b,c,d){var e=a.context,f=c.extensions,g=c.defines,h=c.__webglShader.vertexShader,i=c.__webglShader.fragmentShader,j="SHADOWMAP_TYPE_BASIC";1===d.shadowMapType?j="SHADOWMAP_TYPE_PCF":2===d.shadowMapType&&(j="SHADOWMAP_TYPE_PCF_SOFT");var k="ENVMAP_TYPE_CUBE",l="ENVMAP_MODE_REFLECTION",m="ENVMAP_BLENDING_MULTIPLY";if(d.envMap){switch(c.envMap.mapping){case 301:case 302:k="ENVMAP_TYPE_CUBE";break;case 306:case 307: k="ENVMAP_TYPE_CUBE_UV";break;case 303:case 304:k="ENVMAP_TYPE_EQUIREC";break;case 305:k="ENVMAP_TYPE_SPHERE"}switch(c.envMap.mapping){case 302:case 304:l="ENVMAP_MODE_REFRACTION"}switch(c.combine){case 0:m="ENVMAP_BLENDING_MULTIPLY";break;case 1:m="ENVMAP_BLENDING_MIX";break;case 2:m="ENVMAP_BLENDING_ADD"}}var n=0<a.gammaFactor?a.gammaFactor:1,f=Fa(f,d,a.extensions),o=Ga(g),p=e.createProgram();c.isRawShaderMaterial?(g=[o,"\n"].filter(Ha).join("\n"),j=[f,o,"\n"].filter(Ha).join("\n")):(g=["precision "+d.precision+" float;","precision "+d.precision+" int;","#define SHADER_NAME "+c.__webglShader.name,o,d.supportsVertexTextures?"#define VERTEX_TEXTURES":"","#define GAMMA_FACTOR "+n,"#define MAX_BONES "+d.maxBones,d.map?"#define USE_MAP":"",d.envMap?"#define USE_ENVMAP":"",d.envMap?"#define "+l:"",d.lightMap?"#define USE_LIGHTMAP":"",d.aoMap?"#define USE_AOMAP":"",d.emissiveMap?"#define USE_EMISSIVEMAP":"",d.bumpMap?"#define USE_BUMPMAP":"",d.normalMap?"#define USE_NORMALMAP":"",d.displacementMap&&d.supportsVertexTextures?"#define USE_DISPLACEMENTMAP":"",d.specularMap?"#define USE_SPECULARMAP":"",d.roughnessMap?"#define USE_ROUGHNESSMAP":"",d.metalnessMap?"#define USE_METALNESSMAP":"",d.alphaMap?"#define USE_ALPHAMAP":"",d.vertexColors?"#define USE_COLOR":"",d.flatShading?"#define FLAT_SHADED":"",d.skinning?"#define USE_SKINNING":"",d.useVertexTexture?"#define BONE_TEXTURE":"",d.morphTargets?"#define USE_MORPHTARGETS":"",d.morphNormals&&!1===d.flatShading?"#define USE_MORPHNORMALS":"",d.doubleSided?"#define DOUBLE_SIDED":"",d.flipSided?"#define FLIP_SIDED":"","#define NUM_CLIPPING_PLANES "+d.numClippingPlanes,d.shadowMapEnabled?"#define USE_SHADOWMAP":"",d.shadowMapEnabled?"#define "+j:"",d.sizeAttenuation?"#define USE_SIZEATTENUATION":"",d.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",d.logarithmicDepthBuffer&&a.extensions.get("EXT_frag_depth")?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_COLOR","\tattribute vec3 color;","#endif","#ifdef USE_MORPHTARGETS","\tattribute vec3 morphTarget0;","\tattribute vec3 morphTarget1;","\tattribute vec3 morphTarget2;","\tattribute vec3 morphTarget3;","\t#ifdef USE_MORPHNORMALS","\t\tattribute vec3 morphNormal0;","\t\tattribute vec3 morphNormal1;","\t\tattribute vec3 morphNormal2;","\t\tattribute vec3 morphNormal3;","\t#else","\t\tattribute vec3 morphTarget4;","\t\tattribute vec3 morphTarget5;","\t\tattribute vec3 morphTarget6;","\t\tattribute vec3 morphTarget7;","\t#endif","#endif","#ifdef USE_SKINNING","\tattribute vec4 skinIndex;","\tattribute vec4 skinWeight;","#endif","\n"].filter(Ha).join("\n"),j=[f,"precision "+d.precision+" float;","precision "+d.precision+" int;","#define SHADER_NAME "+c.__webglShader.name,o,d.alphaTest?"#define ALPHATEST "+d.alphaTest:"","#define GAMMA_FACTOR "+n,d.useFog&&d.fog?"#define USE_FOG":"",d.useFog&&d.fogExp?"#define FOG_EXP2":"",d.map?"#define USE_MAP":"",d.envMap?"#define USE_ENVMAP":"",d.envMap?"#define "+k:"",d.envMap?"#define "+l:"",d.envMap?"#define "+m:"",d.lightMap?"#define USE_LIGHTMAP":"",d.aoMap?"#define USE_AOMAP":"",d.emissiveMap?"#define USE_EMISSIVEMAP":"",d.bumpMap?"#define USE_BUMPMAP":"",d.normalMap?"#define USE_NORMALMAP":"",d.specularMap?"#define USE_SPECULARMAP":"",d.roughnessMap?"#define USE_ROUGHNESSMAP":"",d.metalnessMap?"#define USE_METALNESSMAP":"",d.alphaMap?"#define USE_ALPHAMAP":"",d.vertexColors?"#define USE_COLOR":"",d.flatShading?"#define FLAT_SHADED":"",d.doubleSided?"#define DOUBLE_SIDED":"",d.flipSided?"#define FLIP_SIDED":"","#define NUM_CLIPPING_PLANES "+d.numClippingPlanes,"#define UNION_CLIPPING_PLANES "+(d.numClippingPlanes-d.numClipIntersection),d.shadowMapEnabled?"#define USE_SHADOWMAP":"",d.shadowMapEnabled?"#define "+j:"",d.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",d.physicallyCorrectLights?"#define PHYSICALLY_CORRECT_LIGHTS":"",d.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",d.logarithmicDepthBuffer&&a.extensions.get("EXT_frag_depth")?"#define USE_LOGDEPTHBUF_EXT":"",d.envMap&&a.extensions.get("EXT_shader_texture_lod")?"#define TEXTURE_LOD_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;",0!==d.toneMapping?"#define TONE_MAPPING":"",0!==d.toneMapping?_d.tonemapping_pars_fragment:"",0!==d.toneMapping?Ea("toneMapping",d.toneMapping):"",d.outputEncoding||d.mapEncoding||d.envMapEncoding||d.emissiveMapEncoding?_d.encodings_pars_fragment:"",d.mapEncoding?Ca("mapTexelToLinear",d.mapEncoding):"",d.envMapEncoding?Ca("envMapTexelToLinear",d.envMapEncoding):"",d.emissiveMapEncoding?Ca("emissiveMapTexelToLinear",d.emissiveMapEncoding):"",d.outputEncoding?Da("linearToOutputTexel",d.outputEncoding):"",d.depthPacking?"#define DEPTH_PACKING "+c.depthPacking:"","\n"].filter(Ha).join("\n")),h=Ja(h,d),h=Ia(h,d),i=Ja(i,d),i=Ia(i,d),c.isShaderMaterial||(h=Ka(h),i=Ka(i)),i=j+i,h=Aa(e,e.VERTEX_SHADER,g+h),i=Aa(e,e.FRAGMENT_SHADER,i),e.attachShader(p,h),e.attachShader(p,i),void 0!==c.index0AttributeName?e.bindAttribLocation(p,0,c.index0AttributeName):!0===d.morphTargets&&e.bindAttribLocation(p,0,"position"),e.linkProgram(p),d=e.getProgramInfoLog(p),k=e.getShaderInfoLog(h),l=e.getShaderInfoLog(i),n=m=!0,!1===e.getProgramParameter(p,e.LINK_STATUS)?(m=!1,console.error("THREE.WebGLProgram: shader error: ",e.getError(),"gl.VALIDATE_STATUS",e.getProgramParameter(p,e.VALIDATE_STATUS),"gl.getProgramInfoLog",d,k,l)):""!==d?console.warn("THREE.WebGLProgram: gl.getProgramInfoLog()",d):""!==k&&""!==l||(n=!1),n&&(this.diagnostics={runnable:m,material:c,programLog:d,vertexShader:{log:k,prefix:g},fragmentShader:{log:l,prefix:j}}),e.deleteShader(h),e.deleteShader(i);var q;this.getUniforms=function(){return void 0===q&&(q=new P(e,p,a)),q};var r;return this.getAttributes=function(){if(void 0===r){for(var a={},b=e.getProgramParameter(p,e.ACTIVE_ATTRIBUTES),c=0;c<b;c++){var d=e.getActiveAttrib(p,c).name;a[d]=e.getAttribLocation(p,d)}r=a}return r},this.destroy=function(){e.deleteProgram(p),this.program=void 0},Object.defineProperties(this,{uniforms:{get:function(){return console.warn("THREE.WebGLProgram: .uniforms is now .getUniforms()."),this.getUniforms()}},attributes:{get:function(){return console.warn("THREE.WebGLProgram: .attributes is now .getAttributes()."),this.getAttributes()}}}),this.id=ge++,this.code=b,this.usedTimes=1,this.program=p,this.vertexShader=h,this.fragmentShader=i,this}function Ma(a,b){function c(a,b){var c;return a?a&&a.isTexture?c=a.encoding:a&&a.isWebGLRenderTarget&&(console.warn("THREE.WebGLPrograms.getTextureEncodingFromMap: don't use render targets as textures. Use their .texture property instead."),c=a.texture.encoding):c=3e3,3e3===c&&b&&(c=3007),c}var d=[],e={MeshDepthMaterial:"depth",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points"},f="precision supportsVertexTextures map mapEncoding envMap envMapMode envMapEncoding lightMap aoMap emissiveMap emissiveMapEncoding bumpMap normalMap displacementMap specularMap roughnessMap metalnessMap alphaMap combine vertexColors fog useFog fogExp flatShading sizeAttenuation logarithmicDepthBuffer skinning maxBones useVertexTexture morphTargets morphNormals maxMorphTargets maxMorphNormals premultipliedAlpha numDirLights numPointLights numSpotLights numHemiLights shadowMapEnabled shadowMapType toneMapping physicallyCorrectLights alphaTest doubleSided flipSided numClippingPlanes numClipIntersection depthPacking".split(" ");this.getParameters=function(d,f,g,h,i,j){var k,l=e[d.type];b.floatVertexTextures&&j&&j.skeleton&&j.skeleton.useVertexTexture?k=1024:(k=Math.floor((b.maxVertexUniforms-20)/4),void 0!==j&&j&&j.isSkinnedMesh&&(k=Math.min(j.skeleton.bones.length,k))<j.skeleton.bones.length&&console.warn("WebGLRenderer: too many bones - "+j.skeleton.bones.length+", this GPU supports just "+k+" (try OpenGL instead of ANGLE)"));var m=a.getPrecision();null!==d.precision&&(m=b.getMaxPrecision(d.precision))!==d.precision&&console.warn("THREE.WebGLProgram.getParameters:",d.precision,"not supported, using",m,"instead.");var n=a.getCurrentRenderTarget();return{shaderID:l,precision:m,supportsVertexTextures:b.vertexTextures,outputEncoding:c(n?n.texture:null,a.gammaOutput),map:!!d.map,mapEncoding:c(d.map,a.gammaInput),envMap:!!d.envMap,envMapMode:d.envMap&&d.envMap.mapping,envMapEncoding:c(d.envMap,a.gammaInput),envMapCubeUV:!!d.envMap&&(306===d.envMap.mapping||307===d.envMap.mapping),lightMap:!!d.lightMap,aoMap:!!d.aoMap,emissiveMap:!!d.emissiveMap,emissiveMapEncoding:c(d.emissiveMap,a.gammaInput),bumpMap:!!d.bumpMap,normalMap:!!d.normalMap,displacementMap:!!d.displacementMap,roughnessMap:!!d.roughnessMap,metalnessMap:!!d.metalnessMap,specularMap:!!d.specularMap,alphaMap:!!d.alphaMap,combine:d.combine,vertexColors:d.vertexColors,fog:!!g,useFog:d.fog,fogExp:g&&g.isFogExp2,flatShading:1===d.shading,sizeAttenuation:d.sizeAttenuation,logarithmicDepthBuffer:b.logarithmicDepthBuffer,skinning:d.skinning,maxBones:k,useVertexTexture:b.floatVertexTextures&&j&&j.skeleton&&j.skeleton.useVertexTexture,morphTargets:d.morphTargets,morphNormals:d.morphNormals,maxMorphTargets:a.maxMorphTargets,maxMorphNormals:a.maxMorphNormals,numDirLights:f.directional.length,numPointLights:f.point.length,numSpotLights:f.spot.length,numHemiLights:f.hemi.length,numClippingPlanes:h,numClipIntersection:i,shadowMapEnabled:a.shadowMap.enabled&&j.receiveShadow&&0<f.shadows.length,shadowMapType:a.shadowMap.type,toneMapping:a.toneMapping,physicallyCorrectLights:a.physicallyCorrectLights,premultipliedAlpha:d.premultipliedAlpha,alphaTest:d.alphaTest,doubleSided:2===d.side,flipSided:1===d.side,depthPacking:void 0!==d.depthPacking&&d.depthPacking}},this.getProgramCode=function(a,b){var c=[];if(b.shaderID?c.push(b.shaderID):(c.push(a.fragmentShader),c.push(a.vertexShader)),void 0!==a.defines)for(var d in a.defines)c.push(d),c.push(a.defines[d]);for(d=0;d<f.length;d++)c.push(b[f[d]]);return c.join()},this.acquireProgram=function(b,c,e){for(var f,g=0,h=d.length;g<h;g++){var i=d[g];if(i.code===e){f=i,++f.usedTimes;break}}return void 0===f&&(f=new La(a,e,b,c),d.push(f)),f},this.releaseProgram=function(a){if(0==--a.usedTimes){var b=d.indexOf(a);d[b]=d[d.length-1],d.pop(),a.destroy()}},this.programs=d}function Na(a,b,c){function d(a){var g=a.target;a=f[g.id],null!==a.index&&e(a.index);var h,i=a.attributes;for(h in i)e(i[h]);g.removeEventListener("dispose",d),delete f[g.id],h=b.get(g),h.wireframe&&e(h.wireframe),b.delete(g),g=b.get(a),g.wireframe&&e(g.wireframe),b.delete(a),c.memory.geometries--}function e(c){var d;void 0!==(d=c.isInterleavedBufferAttribute?b.get(c.data).__webglBuffer:b.get(c).__webglBuffer)&&(a.deleteBuffer(d),c.isInterleavedBufferAttribute?b.delete(c.data):b.delete(c))}var f={};return{get:function(a){var b=a.geometry;if(void 0!==f[b.id])return f[b.id];b.addEventListener("dispose",d);var e;return b.isBufferGeometry?e=b:b.isGeometry&&(void 0===b._bufferGeometry&&(b._bufferGeometry=(new pa).setFromObject(a)),e=b._bufferGeometry),f[b.id]=e,c.memory.geometries++,e}}}function Oa(a,b,c){function d(c,d){var e=c.isInterleavedBufferAttribute?c.data:c,f=b.get(e);void 0===f.__webglBuffer?(f.__webglBuffer=a.createBuffer(),a.bindBuffer(d,f.__webglBuffer),a.bufferData(d,e.array,e.dynamic?a.DYNAMIC_DRAW:a.STATIC_DRAW),f.version=e.version):f.version!==e.version&&(a.bindBuffer(d,f.__webglBuffer),!1===e.dynamic?a.bufferData(d,e.array,a.STATIC_DRAW):-1===e.updateRange.count?a.bufferSubData(d,0,e.array):0===e.updateRange.count?console.error("THREE.WebGLObjects.updateBuffer: dynamic THREE.BufferAttribute marked as needsUpdate but updateRange.count is 0, ensure you are using set methods or updating manually."):(a.bufferSubData(d,e.updateRange.offset*e.array.BYTES_PER_ELEMENT,e.array.subarray(e.updateRange.offset,e.updateRange.offset+e.updateRange.count)),e.updateRange.count=0),f.version=e.version)}var e=new Na(a,b,c);return{getAttributeBuffer:function(a){return a.isInterleavedBufferAttribute?b.get(a.data).__webglBuffer:b.get(a).__webglBuffer},getWireframeAttribute:function(c){var e=b.get(c);if(void 0!==e.wireframe)return e.wireframe;var f=[],g=c.index,h=c.attributes;if(c=h.position,null!==g)for(var g=g.array,h=0,i=g.length;h<i;h+=3){var j=g[h+0],k=g[h+1],l=g[h+2];f.push(j,k,k,l,l,j)}else for(g=h.position.array,h=0,i=g.length/3-1;h<i;h+=3)j=h+0,k=h+1,l=h+2,f.push(j,k,k,l,l,j);return f=new ja(new(65535<c.count?Uint32Array:Uint16Array)(f),1),d(f,a.ELEMENT_ARRAY_BUFFER),e.wireframe=f},update:function(b){var c=e.get(b);b.geometry.isGeometry&&c.updateFromObject(b),b=c.index;var f=c.attributes;null!==b&&d(b,a.ELEMENT_ARRAY_BUFFER);for(var g in f)d(f[g],a.ARRAY_BUFFER);b=c.morphAttributes;for(g in b)for(var f=b[g],h=0,i=f.length;h<i;h++)d(f[h],a.ARRAY_BUFFER);return c}}}function Pa(a,b,c,d,e,f,g){function h(a,b){if(a.width>b||a.height>b){var c=b/Math.max(a.width,a.height),d=document.createElementNS("http://www.w3.org/1999/xhtml","canvas");return d.width=Math.floor(a.width*c),d.height=Math.floor(a.height*c),d.getContext("2d").drawImage(a,0,0,a.width,a.height,0,0,d.width,d.height),console.warn("THREE.WebGLRenderer: image is too big ("+a.width+"x"+a.height+"). Resized to "+d.width+"x"+d.height,a),d}return a}function i(a){return Td.isPowerOfTwo(a.width)&&Td.isPowerOfTwo(a.height)}function j(b){return 1003===b||1004===b||1005===b?a.NEAREST:a.LINEAR}function k(b){b=b.target,b.removeEventListener("dispose",k);a:{var c=d.get(b);if(b.image&&c.__image__webglTextureCube)a.deleteTexture(c.__image__webglTextureCube);else{if(void 0===c.__webglInit)break a;a.deleteTexture(c.__webglTexture)}d.delete(b)}q.textures--}function l(b){b=b.target,b.removeEventListener("dispose",l);var c=d.get(b),e=d.get(b.texture);if(b){if(void 0!==e.__webglTexture&&a.deleteTexture(e.__webglTexture),b.depthTexture&&b.depthTexture.dispose(),b&&b.isWebGLRenderTargetCube)for(e=0;6>e;e++)a.deleteFramebuffer(c.__webglFramebuffer[e]),c.__webglDepthbuffer&&a.deleteRenderbuffer(c.__webglDepthbuffer[e]);else a.deleteFramebuffer(c.__webglFramebuffer),c.__webglDepthbuffer&&a.deleteRenderbuffer(c.__webglDepthbuffer);d.delete(b.texture),d.delete(b)}q.textures--}function m(b,g){var j=d.get(b);if(0<b.version&&j.__version!==b.version){var l=b.image;if(void 0===l)console.warn("THREE.WebGLRenderer: Texture marked for update but image is undefined",b);else{if(!1!==l.complete){void 0===j.__webglInit&&(j.__webglInit=!0,b.addEventListener("dispose",k),j.__webglTexture=a.createTexture(),q.textures++),c.activeTexture(a.TEXTURE0+g),c.bindTexture(a.TEXTURE_2D,j.__webglTexture),a.pixelStorei(a.UNPACK_FLIP_Y_WEBGL,b.flipY),a.pixelStorei(a.UNPACK_PREMULTIPLY_ALPHA_WEBGL,b.premultiplyAlpha),a.pixelStorei(a.UNPACK_ALIGNMENT,b.unpackAlignment);var m=h(b.image,e.maxTextureSize);if((1001!==b.wrapS||1001!==b.wrapT||1003!==b.minFilter&&1006!==b.minFilter)&&!1===i(m))if((l=m)instanceof HTMLImageElement||l instanceof HTMLCanvasElement){var o=document.createElementNS("http://www.w3.org/1999/xhtml","canvas");o.width=Td.nearestPowerOfTwo(l.width),o.height=Td.nearestPowerOfTwo(l.height),o.getContext("2d").drawImage(l,0,0,o.width,o.height),console.warn("THREE.WebGLRenderer: image is not power of two ("+l.width+"x"+l.height+"). Resized to "+o.width+"x"+o.height,l),m=o}else m=l;var l=i(m),o=f(b.format),p=f(b.type);n(a.TEXTURE_2D,b,l);var s=b.mipmaps;if(b&&b.isDepthTexture){if(s=a.DEPTH_COMPONENT,1015===b.type){if(!r)throw Error("Float Depth Texture only supported in WebGL2.0");s=a.DEPTH_COMPONENT32F}else r&&(s=a.DEPTH_COMPONENT16);1027===b.format&&(s=a.DEPTH_STENCIL),c.texImage2D(a.TEXTURE_2D,0,s,m.width,m.height,0,o,p,null)}else if(b&&b.isDataTexture)if(0<s.length&&l){for(var t=0,u=s.length;t<u;t++)m=s[t],c.texImage2D(a.TEXTURE_2D,t,o,m.width,m.height,0,o,p,m.data);b.generateMipmaps=!1}else c.texImage2D(a.TEXTURE_2D,0,o,m.width,m.height,0,o,p,m.data);else if(b&&b.isCompressedTexture)for(t=0,u=s.length;t<u;t++)m=s[t],1023!==b.format&&1022!==b.format?-1<c.getCompressedTextureFormats().indexOf(o)?c.compressedTexImage2D(a.TEXTURE_2D,t,o,m.width,m.height,0,m.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):c.texImage2D(a.TEXTURE_2D,t,o,m.width,m.height,0,o,p,m.data);else if(0<s.length&&l){for(t=0,u=s.length;t<u;t++)m=s[t],c.texImage2D(a.TEXTURE_2D,t,o,o,p,m);b.generateMipmaps=!1}else c.texImage2D(a.TEXTURE_2D,0,o,o,p,m);return b.generateMipmaps&&l&&a.generateMipmap(a.TEXTURE_2D),j.__version=b.version,void(b.onUpdate&&b.onUpdate(b))}console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete",b)}}c.activeTexture(a.TEXTURE0+g),c.bindTexture(a.TEXTURE_2D,j.__webglTexture)}function n(c,g,h){h?(a.texParameteri(c,a.TEXTURE_WRAP_S,f(g.wrapS)),a.texParameteri(c,a.TEXTURE_WRAP_T,f(g.wrapT)),a.texParameteri(c,a.TEXTURE_MAG_FILTER,f(g.magFilter)),a.texParameteri(c,a.TEXTURE_MIN_FILTER,f(g.minFilter))):(a.texParameteri(c,a.TEXTURE_WRAP_S,a.CLAMP_TO_EDGE),a.texParameteri(c,a.TEXTURE_WRAP_T,a.CLAMP_TO_EDGE),1001===g.wrapS&&1001===g.wrapT||console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping.",g),a.texParameteri(c,a.TEXTURE_MAG_FILTER,j(g.magFilter)),a.texParameteri(c,a.TEXTURE_MIN_FILTER,j(g.minFilter)),1003!==g.minFilter&&1006!==g.minFilter&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.",g)),!(h=b.get("EXT_texture_filter_anisotropic"))||1015===g.type&&null===b.get("OES_texture_float_linear")||1016===g.type&&null===b.get("OES_texture_half_float_linear")||!(1<g.anisotropy||d.get(g).__currentAnisotropy)||(a.texParameterf(c,h.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(g.anisotropy,e.getMaxAnisotropy())),d.get(g).__currentAnisotropy=g.anisotropy)}function o(b,e,g,h){var i=f(e.texture.format),j=f(e.texture.type);c.texImage2D(h,0,i,e.width,e.height,0,i,j,null),a.bindFramebuffer(a.FRAMEBUFFER,b),a.framebufferTexture2D(a.FRAMEBUFFER,g,h,d.get(e.texture).__webglTexture,0),a.bindFramebuffer(a.FRAMEBUFFER,null)}function p(b,c){a.bindRenderbuffer(a.RENDERBUFFER,b),c.depthBuffer&&!c.stencilBuffer?(a.renderbufferStorage(a.RENDERBUFFER,a.DEPTH_COMPONENT16,c.width,c.height),a.framebufferRenderbuffer(a.FRAMEBUFFER,a.DEPTH_ATTACHMENT,a.RENDERBUFFER,b)):c.depthBuffer&&c.stencilBuffer?(a.renderbufferStorage(a.RENDERBUFFER,a.DEPTH_STENCIL,c.width,c.height),a.framebufferRenderbuffer(a.FRAMEBUFFER,a.DEPTH_STENCIL_ATTACHMENT,a.RENDERBUFFER,b)):a.renderbufferStorage(a.RENDERBUFFER,a.RGBA4,c.width,c.height),a.bindRenderbuffer(a.RENDERBUFFER,null)}var q=g.memory,r="undefined"!=typeof WebGL2RenderingContext&&a instanceof WebGL2RenderingContext;this.setTexture2D=m,this.setTextureCube=function(b,g){var j=d.get(b);if(6===b.image.length)if(0<b.version&&j.__version!==b.version){j.__image__webglTextureCube||(b.addEventListener("dispose",k),j.__image__webglTextureCube=a.createTexture(),q.textures++),c.activeTexture(a.TEXTURE0+g),c.bindTexture(a.TEXTURE_CUBE_MAP,j.__image__webglTextureCube),a.pixelStorei(a.UNPACK_FLIP_Y_WEBGL,b.flipY);for(var l=b&&b.isCompressedTexture,m=b.image[0]&&b.image[0].isDataTexture,o=[],p=0;6>p;p++)o[p]=l||m?m?b.image[p].image:b.image[p]:h(b.image[p],e.maxCubemapSize);var r=i(o[0]),s=f(b.format),t=f(b.type);for(n(a.TEXTURE_CUBE_MAP,b,r),p=0;6>p;p++)if(l)for(var u,v=o[p].mipmaps,w=0,x=v.length;w<x;w++)u=v[w],1023!==b.format&&1022!==b.format?-1<c.getCompressedTextureFormats().indexOf(s)?c.compressedTexImage2D(a.TEXTURE_CUBE_MAP_POSITIVE_X+p,w,s,u.width,u.height,0,u.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):c.texImage2D(a.TEXTURE_CUBE_MAP_POSITIVE_X+p,w,s,u.width,u.height,0,s,t,u.data);else m?c.texImage2D(a.TEXTURE_CUBE_MAP_POSITIVE_X+p,0,s,o[p].width,o[p].height,0,s,t,o[p].data):c.texImage2D(a.TEXTURE_CUBE_MAP_POSITIVE_X+p,0,s,s,t,o[p]);b.generateMipmaps&&r&&a.generateMipmap(a.TEXTURE_CUBE_MAP),j.__version=b.version,b.onUpdate&&b.onUpdate(b)}else c.activeTexture(a.TEXTURE0+g),c.bindTexture(a.TEXTURE_CUBE_MAP,j.__image__webglTextureCube)},this.setTextureCubeDynamic=function(b,e){c.activeTexture(a.TEXTURE0+e),c.bindTexture(a.TEXTURE_CUBE_MAP,d.get(b).__webglTexture)},this.setupRenderTarget=function(b){var e=d.get(b),f=d.get(b.texture);b.addEventListener("dispose",l),f.__webglTexture=a.createTexture(),q.textures++;var g=b&&b.isWebGLRenderTargetCube,h=i(b);if(g){e.__webglFramebuffer=[];for(var j=0;6>j;j++)e.__webglFramebuffer[j]=a.createFramebuffer()}else e.__webglFramebuffer=a.createFramebuffer();if(g){for(c.bindTexture(a.TEXTURE_CUBE_MAP,f.__webglTexture),n(a.TEXTURE_CUBE_MAP,b.texture,h),j=0;6>j;j++)o(e.__webglFramebuffer[j],b,a.COLOR_ATTACHMENT0,a.TEXTURE_CUBE_MAP_POSITIVE_X+j);b.texture.generateMipmaps&&h&&a.generateMipmap(a.TEXTURE_CUBE_MAP),c.bindTexture(a.TEXTURE_CUBE_MAP,null)}else c.bindTexture(a.TEXTURE_2D,f.__webglTexture),n(a.TEXTURE_2D,b.texture,h),o(e.__webglFramebuffer,b,a.COLOR_ATTACHMENT0,a.TEXTURE_2D),b.texture.generateMipmaps&&h&&a.generateMipmap(a.TEXTURE_2D),c.bindTexture(a.TEXTURE_2D,null);if(b.depthBuffer){if(e=d.get(b),f=b&&b.isWebGLRenderTargetCube,b.depthTexture){if(f)throw Error("target.depthTexture not supported in Cube render targets");if(b&&b.isWebGLRenderTargetCube)throw Error("Depth Texture with cube render targets is not supported!");if(a.bindFramebuffer(a.FRAMEBUFFER,e.__webglFramebuffer),!b.depthTexture||!b.depthTexture.isDepthTexture)throw Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");if(d.get(b.depthTexture).__webglTexture&&b.depthTexture.image.width===b.width&&b.depthTexture.image.height===b.height||(b.depthTexture.image.width=b.width,b.depthTexture.image.height=b.height,b.depthTexture.needsUpdate=!0),m(b.depthTexture,0),e=d.get(b.depthTexture).__webglTexture,1026===b.depthTexture.format)a.framebufferTexture2D(a.FRAMEBUFFER,a.DEPTH_ATTACHMENT,a.TEXTURE_2D,e,0);else{if(1027!==b.depthTexture.format)throw Error("Unknown depthTexture format");a.framebufferTexture2D(a.FRAMEBUFFER,a.DEPTH_STENCIL_ATTACHMENT,a.TEXTURE_2D,e,0)}}else if(f)for(e.__webglDepthbuffer=[],f=0;6>f;f++)a.bindFramebuffer(a.FRAMEBUFFER,e.__webglFramebuffer[f]),e.__webglDepthbuffer[f]=a.createRenderbuffer(),p(e.__webglDepthbuffer[f],b);else a.bindFramebuffer(a.FRAMEBUFFER,e.__webglFramebuffer),e.__webglDepthbuffer=a.createRenderbuffer(),p(e.__webglDepthbuffer,b);a.bindFramebuffer(a.FRAMEBUFFER,null)}},this.updateRenderTargetMipmap=function(b){var e=b.texture;e.generateMipmaps&&i(b)&&1003!==e.minFilter&&1006!==e.minFilter&&(b=b&&b.isWebGLRenderTargetCube?a.TEXTURE_CUBE_MAP:a.TEXTURE_2D,e=d.get(e).__webglTexture,c.bindTexture(b,e),a.generateMipmap(b),c.bindTexture(b,null))}}function Qa(){var a={};return{get:function(b){b=b.uuid;var c=a[b];return void 0===c&&(c={},a[b]=c),c},delete:function(b){delete a[b.uuid]},clear:function(){a={}}}}function Ra(a,b,c){function d(b,c,d){var e=new Uint8Array(4),f=a.createTexture();for(a.bindTexture(b,f),a.texParameteri(b,a.TEXTURE_MIN_FILTER,a.NEAREST),a.texParameteri(b,a.TEXTURE_MAG_FILTER,a.NEAREST),b=0;b<d;b++)a.texImage2D(c+b,0,a.RGBA,1,1,0,a.RGBA,a.UNSIGNED_BYTE,e);return f}function f(b){!0!==w[b]&&(a.enable(b),w[b]=!0)}function g(b){!1!==w[b]&&(a.disable(b),w[b]=!1)}function h(b,d,e,h,i,j,k,l){0!==b?f(a.BLEND):g(a.BLEND),b===y&&l===F||(2===b?l?(a.blendEquationSeparate(a.FUNC_ADD,a.FUNC_ADD),a.blendFuncSeparate(a.ONE,a.ONE,a.ONE,a.ONE)):(a.blendEquation(a.FUNC_ADD),a.blendFunc(a.SRC_ALPHA,a.ONE)):3===b?l?(a.blendEquationSeparate(a.FUNC_ADD,a.FUNC_ADD),a.blendFuncSeparate(a.ZERO,a.ZERO,a.ONE_MINUS_SRC_COLOR,a.ONE_MINUS_SRC_ALPHA)):(a.blendEquation(a.FUNC_ADD),a.blendFunc(a.ZERO,a.ONE_MINUS_SRC_COLOR)):4===b?l?(a.blendEquationSeparate(a.FUNC_ADD,a.FUNC_ADD),a.blendFuncSeparate(a.ZERO,a.SRC_COLOR,a.ZERO,a.SRC_ALPHA)):(a.blendEquation(a.FUNC_ADD),a.blendFunc(a.ZERO,a.SRC_COLOR)):l?(a.blendEquationSeparate(a.FUNC_ADD,a.FUNC_ADD),a.blendFuncSeparate(a.ONE,a.ONE_MINUS_SRC_ALPHA,a.ONE,a.ONE_MINUS_SRC_ALPHA)):(a.blendEquationSeparate(a.FUNC_ADD,a.FUNC_ADD),a.blendFuncSeparate(a.SRC_ALPHA,a.ONE_MINUS_SRC_ALPHA,a.ONE,a.ONE_MINUS_SRC_ALPHA)),y=b,F=l),5===b?(i=i||d,j=j||e,k=k||h,d===z&&i===C||(a.blendEquationSeparate(c(d),c(i)),z=d,C=i),e===A&&h===B&&j===D&&k===E||(a.blendFuncSeparate(c(e),c(h),c(j),c(k)),A=e,B=h,D=j,E=k)):E=D=C=B=A=z=null}function i(a){q.setFunc(a)}function j(b){G!==b&&(b?a.frontFace(a.CW):a.frontFace(a.CCW),G=b)}function k(b){0!==b?(f(a.CULL_FACE),b!==H&&(1===b?a.cullFace(a.BACK):2===b?a.cullFace(a.FRONT):a.cullFace(a.FRONT_AND_BACK))):g(a.CULL_FACE),H=b}function l(b){void 0===b&&(b=a.TEXTURE0+M-1),N!==b&&(a.activeTexture(b),N=b)}function m(a,b,c,d){p.setClear(a,b,c,d)}function n(a){q.setClear(a)}function o(a){r.setClear(a)}var p=new function(){var b=!1,c=new e,d=null,f=new e;return{setMask:function(c){d===c||b||(a.colorMask(c,c,c,c),d=c)},setLocked:function(a){b=a},setClear:function(b,d,e,g){c.set(b,d,e,g),!1===f.equals(c)&&(a.clearColor(b,d,e,g),f.copy(c))},reset:function(){b=!1,d=null,f.set(0,0,0,1)}}},q=new function(){var b=!1,c=null,d=null,e=null;return{setTest:function(b){b?f(a.DEPTH_TEST):g(a.DEPTH_TEST)},setMask:function(d){c===d||b||(a.depthMask(d),c=d)},setFunc:function(b){if(d!==b){if(b)switch(b){case 0:a.depthFunc(a.NEVER);break;case 1:a.depthFunc(a.ALWAYS);break;case 2:a.depthFunc(a.LESS);break;case 3:a.depthFunc(a.LEQUAL);break;case 4:a.depthFunc(a.EQUAL);break;case 5:a.depthFunc(a.GEQUAL);break;case 6:a.depthFunc(a.GREATER);break;case 7:a.depthFunc(a.NOTEQUAL);break;default:a.depthFunc(a.LEQUAL)}else a.depthFunc(a.LEQUAL);d=b}},setLocked:function(a){b=a},setClear:function(b){e!==b&&(a.clearDepth(b),e=b)},reset:function(){b=!1,e=d=c=null}}},r=new function(){var b=!1,c=null,d=null,e=null,h=null,i=null,j=null,k=null,l=null;return{setTest:function(b){b?f(a.STENCIL_TEST):g(a.STENCIL_TEST)},setMask:function(d){c===d||b||(a.stencilMask(d),c=d)},setFunc:function(b,c,f){d===b&&e===c&&h===f||(a.stencilFunc(b,c,f),d=b,e=c,h=f)},setOp:function(b,c,d){i===b&&j===c&&k===d||(a.stencilOp(b,c,d),i=b,j=c,k=d)},setLocked:function(a){b=a},setClear:function(b){l!==b&&(a.clearStencil(b),l=b)},reset:function(){b=!1,l=k=j=i=h=e=d=c=null}}},s=a.getParameter(a.MAX_VERTEX_ATTRIBS),t=new Uint8Array(s),u=new Uint8Array(s),v=new Uint8Array(s),w={},x=null,y=null,z=null,A=null,B=null,C=null,D=null,E=null,F=!1,G=null,H=null,I=null,J=null,K=null,L=null,M=a.getParameter(a.MAX_TEXTURE_IMAGE_UNITS),N=null,O={},P=new e,Q=new e,R={};return R[a.TEXTURE_2D]=d(a.TEXTURE_2D,a.TEXTURE_2D,1),R[a.TEXTURE_CUBE_MAP]=d(a.TEXTURE_CUBE_MAP,a.TEXTURE_CUBE_MAP_POSITIVE_X,6),{buffers:{color:p,depth:q,stencil:r},init:function(){m(0,0,0,1),n(1),o(0),f(a.DEPTH_TEST),i(3),j(!1),k(1),f(a.CULL_FACE),f(a.BLEND),h(1)},initAttributes:function(){for(var a=0,b=t.length;a<b;a++)t[a]=0},enableAttribute:function(c){t[c]=1,0===u[c]&&(a.enableVertexAttribArray(c),u[c]=1),0!==v[c]&&(b.get("ANGLE_instanced_arrays").vertexAttribDivisorANGLE(c,0),v[c]=0)},enableAttributeAndDivisor:function(b,c,d){t[b]=1,0===u[b]&&(a.enableVertexAttribArray(b),u[b]=1),v[b]!==c&&(d.vertexAttribDivisorANGLE(b,c),v[b]=c)},disableUnusedAttributes:function(){for(var b=0,c=u.length;b!==c;++b)u[b]!==t[b]&&(a.disableVertexAttribArray(b),u[b]=0)},enable:f,disable:g,getCompressedTextureFormats:function(){if(null===x&&(x=[],b.get("WEBGL_compressed_texture_pvrtc")||b.get("WEBGL_compressed_texture_s3tc")||b.get("WEBGL_compressed_texture_etc1")))for(var c=a.getParameter(a.COMPRESSED_TEXTURE_FORMATS),d=0;d<c.length;d++)x.push(c[d]);return x},setBlending:h,setColorWrite:function(a){p.setMask(a)},setDepthTest:function(a){q.setTest(a)},setDepthWrite:function(a){q.setMask(a)},setDepthFunc:i,setStencilTest:function(a){r.setTest(a)},setStencilWrite:function(a){r.setMask(a)},setStencilFunc:function(a,b,c){r.setFunc(a,b,c)},setStencilOp:function(a,b,c){r.setOp(a,b,c)},setFlipSided:j,setCullFace:k,setLineWidth:function(b){b!==I&&(a.lineWidth(b),I=b)},setPolygonOffset:function(b,c,d){b?(f(a.POLYGON_OFFSET_FILL),(J!==c||K!==d)&&(a.polygonOffset(c,d),J=c,K=d)):g(a.POLYGON_OFFSET_FILL)},getScissorTest:function(){return L},setScissorTest:function(b){(L=b)?f(a.SCISSOR_TEST):g(a.SCISSOR_TEST)},activeTexture:l,bindTexture:function(b,c){null===N&&l();var d=O[N];void 0===d&&(d={type:void 0,texture:void 0},O[N]=d),d.type===b&&d.texture===c||(a.bindTexture(b,c||R[b]),d.type=b,d.texture=c)},compressedTexImage2D:function(){try{a.compressedTexImage2D.apply(a,arguments)}catch(b){console.error(b)}},texImage2D:function(){try{a.texImage2D.apply(a,arguments)}catch(b){console.error(b)}},clearColor:m,clearDepth:n,clearStencil:o,scissor:function(b){!1===P.equals(b)&&(a.scissor(b.x,b.y,b.z,b.w),P.copy(b))},viewport:function(b){!1===Q.equals(b)&&(a.viewport(b.x,b.y,b.z,b.w),Q.copy(b))},reset:function(){for(var b=0;b<u.length;b++)1===u[b]&&(a.disableVertexAttribArray(b),u[b]=0);w={},N=x=null,O={},H=G=y=null,p.reset(),q.reset(),r.reset()}}}function Sa(a,b,c){function d(b){if("highp"===b){if(0<a.getShaderPrecisionFormat(a.VERTEX_SHADER,a.HIGH_FLOAT).precision&&0<a.getShaderPrecisionFormat(a.FRAGMENT_SHADER,a.HIGH_FLOAT).precision)return"highp";b="mediump"}return"mediump"===b&&0<a.getShaderPrecisionFormat(a.VERTEX_SHADER,a.MEDIUM_FLOAT).precision&&0<a.getShaderPrecisionFormat(a.FRAGMENT_SHADER,a.MEDIUM_FLOAT).precision?"mediump":"lowp"}var e,f=void 0!==c.precision?c.precision:"highp",g=d(f);g!==f&&(console.warn("THREE.WebGLRenderer:",f,"not supported, using",g,"instead."),f=g),c=!0===c.logarithmicDepthBuffer&&!!b.get("EXT_frag_depth");var g=a.getParameter(a.MAX_TEXTURE_IMAGE_UNITS),h=a.getParameter(a.MAX_VERTEX_TEXTURE_IMAGE_UNITS),i=a.getParameter(a.MAX_TEXTURE_SIZE),j=a.getParameter(a.MAX_CUBE_MAP_TEXTURE_SIZE),k=a.getParameter(a.MAX_VERTEX_ATTRIBS),l=a.getParameter(a.MAX_VERTEX_UNIFORM_VECTORS),m=a.getParameter(a.MAX_VARYING_VECTORS),n=a.getParameter(a.MAX_FRAGMENT_UNIFORM_VECTORS),o=0<h,p=!!b.get("OES_texture_float");return{getMaxAnisotropy:function(){if(void 0!==e)return e;var c=b.get("EXT_texture_filter_anisotropic");return e=null!==c?a.getParameter(c.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0},getMaxPrecision:d,precision:f,logarithmicDepthBuffer:c,maxTextures:g,maxVertexTextures:h,maxTextureSize:i,maxCubemapSize:j,maxAttributes:k,maxVertexUniforms:l,maxVaryings:m,maxFragmentUniforms:n,vertexTextures:o,floatFragmentTextures:p,floatVertexTextures:o&&p}}function Ta(a){var b={};return{get:function(c){if(void 0!==b[c])return b[c];var d;switch(c){case"WEBGL_depth_texture":d=a.getExtension("WEBGL_depth_texture")||a.getExtension("MOZ_WEBGL_depth_texture")||a.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":d=a.getExtension("EXT_texture_filter_anisotropic")||a.getExtension("MOZ_EXT_texture_filter_anisotropic")||a.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":d=a.getExtension("WEBGL_compressed_texture_s3tc")||a.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||a.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":d=a.getExtension("WEBGL_compressed_texture_pvrtc")||a.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;case"WEBGL_compressed_texture_etc1":d=a.getExtension("WEBGL_compressed_texture_etc1");break;default:d=a.getExtension(c)}return null===d&&console.warn("THREE.WebGLRenderer: "+c+" extension not supported."),b[c]=d}}}function Ua(){function a(){j.value!==d&&(j.value=d,j.needsUpdate=0<e),c.numPlanes=e,c.numIntersection=0}function b(a,b,d,e){var f=null!==a?a.length:0,g=null;if(0!==f){if(g=j.value,!0!==e||null===g)for(e=d+4*f,b=b.matrixWorldInverse,i.getNormalMatrix(b),(null===g||g.length<e)&&(g=new Float32Array(e)),e=0;e!==f;++e, d+=4)h.copy(a[e]).applyMatrix4(b,i),h.normal.toArray(g,d),g[d+3]=h.constant;j.value=g,j.needsUpdate=!0}return c.numPlanes=f,g}var c=this,d=null,e=0,f=!1,g=!1,h=new $,i=new Z,j={value:null,needsUpdate:!1};this.uniform=j,this.numIntersection=this.numPlanes=0,this.init=function(a,c,g){var h=0!==a.length||c||0!==e||f;return f=c,d=b(a,g,0),e=a.length,h},this.beginShadows=function(){g=!0,b(null)},this.endShadows=function(){g=!1,a()},this.setState=function(c,h,i,k,l,m){if(!f||null===c||0===c.length||g&&!i)g?b(null):a();else{i=g?0:e;var n=4*i,o=l.clippingState||null;for(j.value=o,o=b(c,k,n,m),c=0;c!==n;++c)o[c]=d[c];l.clippingState=o,this.numIntersection=h?this.numPlanes:0,this.numPlanes+=i}}}function Va(a){function b(a,b,c,d){!0===B&&(a*=d,b*=d,c*=d),Ga.clearColor(a,b,c,d)}function c(){Ga.init(),Ga.scissor(X.copy(ha).multiplyScalar(ga)),Ga.viewport($.copy(ka).multiplyScalar(ga)),b(ca.r,ca.g,ca.b,da)}function d(){W=M=null,U="",R=-1,Ga.reset()}function f(a){a.preventDefault(),d(),c(),Ha.clear()}function g(a){a=a.target,a.removeEventListener("dispose",g),h(a),Ha.delete(a)}function h(a){var b=Ha.get(a).program;a.program=void 0,void 0!==b&&Ka.releaseProgram(b)}function k(a,b){return Math.abs(b[0])-Math.abs(a[0])}function l(a,b){return a.object.renderOrder!==b.object.renderOrder?a.object.renderOrder-b.object.renderOrder:a.material.program&&b.material.program&&a.material.program!==b.material.program?a.material.program.id-b.material.program.id:a.material.id!==b.material.id?a.material.id-b.material.id:a.z!==b.z?a.z-b.z:a.id-b.id}function m(a,b){return a.object.renderOrder!==b.object.renderOrder?a.object.renderOrder-b.object.renderOrder:a.z!==b.z?b.z-a.z:a.id-b.id}function n(a,b,c,d,e){var f;c.transparent?(d=G,f=++H):(d=E,f=++F),f=d[f],void 0!==f?(f.id=a.id,f.object=a,f.geometry=b,f.material=c,f.z=Aa.z,f.group=e):(f={id:a.id,object:a,geometry:b,material:c,z:Aa.z,group:e},d.push(f))}function o(a){if(!la.intersectsSphere(a))return!1;var b=ma.numPlanes;if(0===b)return!0;var c=L.clippingPlanes,d=a.center;a=-a.radius;var e=0;do{if(c[e].distanceToPoint(d)<a)return!1}while(++e!==b);return!0}function p(a,b){if(!1!==a.visible){if(0!=(a.layers.mask&b.layers.mask))if(a.isLight)D.push(a);else if(a.isSprite){var c;(c=!1===a.frustumCulled)||(ta.center.set(0,0,0),ta.radius=.7071067811865476,ta.applyMatrix4(a.matrixWorld),c=!0===o(ta)),c&&J.push(a)}else if(a.isLensFlare)K.push(a);else if(a.isImmediateRenderObject)!0===L.sortObjects&&(Aa.setFromMatrixPosition(a.matrixWorld),Aa.applyProjection(za)),n(a,null,a.material,Aa.z,null);else if((a.isMesh||a.isLine||a.isPoints)&&(a.isSkinnedMesh&&a.skeleton.update(),(c=!1===a.frustumCulled)||(c=a.geometry,null===c.boundingSphere&&c.computeBoundingSphere(),ta.copy(c.boundingSphere).applyMatrix4(a.matrixWorld),c=!0===o(ta)),c)){var d=a.material;if(!0===d.visible)if(!0===L.sortObjects&&(Aa.setFromMatrixPosition(a.matrixWorld),Aa.applyProjection(za)),c=Ja.update(a),d.isMultiMaterial)for(var e=c.groups,f=d.materials,d=0,g=e.length;d<g;d++){var h=e[d],i=f[h.materialIndex];!0===i.visible&&n(a,c,i,Aa.z,h)}else n(a,c,d,Aa.z,null)}for(c=a.children,d=0,g=c.length;d<g;d++)p(c[d],b)}}function q(a,b,c,d){for(var e=0,f=a.length;e<f;e++){var g=a[e],h=g.object,i=g.geometry,j=void 0===d?g.material:d,g=g.group;if(h.modelViewMatrix.multiplyMatrices(c.matrixWorldInverse,h.matrixWorld),h.normalMatrix.getNormalMatrix(h.modelViewMatrix),h.onBeforeRender(L,b,c,i,j,g),h.isImmediateRenderObject){r(j);var k=s(c,b.fog,j,h);U="",h.render(function(a){L.renderBufferImmediate(a,k,j)})}else L.renderBufferDirect(c,b.fog,i,j,h,g);h.onAfterRender(L,b,c,i,j,g)}}function r(a){2===a.side?Ga.disable(Da.CULL_FACE):Ga.enable(Da.CULL_FACE),Ga.setFlipSided(1===a.side),!0===a.transparent?Ga.setBlending(a.blending,a.blendEquation,a.blendSrc,a.blendDst,a.blendEquationAlpha,a.blendSrcAlpha,a.blendDstAlpha,a.premultipliedAlpha):Ga.setBlending(0),Ga.setDepthFunc(a.depthFunc),Ga.setDepthTest(a.depthTest),Ga.setDepthWrite(a.depthWrite),Ga.setColorWrite(a.colorWrite),Ga.setPolygonOffset(a.polygonOffset,a.polygonOffsetFactor,a.polygonOffsetUnits)}function s(a,b,c,d){ba=0;var e=Ha.get(c);if(na&&(oa||a!==W)&&ma.setState(c.clippingPlanes,c.clipIntersection,c.clipShadows,a,e,a===W&&c.id===R),!1===c.needsUpdate&&(void 0===e.program?c.needsUpdate=!0:c.fog&&e.fog!==b?c.needsUpdate=!0:c.lights&&e.lightsHash!==Ba.hash?c.needsUpdate=!0:void 0===e.numClippingPlanes||e.numClippingPlanes===ma.numPlanes&&e.numIntersection===ma.numIntersection||(c.needsUpdate=!0)),c.needsUpdate){a:{var f=Ha.get(c),i=Ka.getParameters(c,Ba,b,ma.numPlanes,ma.numIntersection,d),j=Ka.getProgramCode(c,i),k=f.program,l=!0;if(void 0===k)c.addEventListener("dispose",g);else if(k.code!==j)h(c);else{if(void 0!==i.shaderID)break a;l=!1}if(l&&(i.shaderID?(k=ce[i.shaderID],f.__webglShader={name:c.type,uniforms:$d.clone(k.uniforms),vertexShader:k.vertexShader,fragmentShader:k.fragmentShader}):f.__webglShader={name:c.type,uniforms:c.uniforms,vertexShader:c.vertexShader,fragmentShader:c.fragmentShader},c.__webglShader=f.__webglShader,k=Ka.acquireProgram(c,i,j),f.program=k,c.program=k),i=k.getAttributes(),c.morphTargets)for(j=c.numSupportedMorphTargets=0;j<L.maxMorphTargets;j++)0<=i["morphTarget"+j]&&c.numSupportedMorphTargets++;if(c.morphNormals)for(j=c.numSupportedMorphNormals=0;j<L.maxMorphNormals;j++)0<=i["morphNormal"+j]&&c.numSupportedMorphNormals++;i=f.__webglShader.uniforms,(c.isShaderMaterial||c.isRawShaderMaterial)&&!0!==c.clipping||(f.numClippingPlanes=ma.numPlanes,f.numIntersection=ma.numIntersection,i.clippingPlanes=ma.uniform),f.fog=b,f.lightsHash=Ba.hash,c.lights&&(i.ambientLightColor.value=Ba.ambient,i.directionalLights.value=Ba.directional,i.spotLights.value=Ba.spot,i.pointLights.value=Ba.point,i.hemisphereLights.value=Ba.hemi,i.directionalShadowMap.value=Ba.directionalShadowMap,i.directionalShadowMatrix.value=Ba.directionalShadowMatrix,i.spotShadowMap.value=Ba.spotShadowMap,i.spotShadowMatrix.value=Ba.spotShadowMatrix,i.pointShadowMap.value=Ba.pointShadowMap,i.pointShadowMatrix.value=Ba.pointShadowMatrix),j=f.program.getUniforms(),i=P.seqWithValue(j.seq,i),f.uniformsList=i}c.needsUpdate=!1}var m=!1,l=k=!1,f=e.program,i=f.getUniforms(),j=e.__webglShader.uniforms;if(f.id!==M&&(Da.useProgram(f.program),M=f.id,l=k=m=!0),c.id!==R&&(R=c.id,k=!0),(m||a!==W)&&(i.set(Da,a,"projectionMatrix"),Fa.logarithmicDepthBuffer&&i.setValue(Da,"logDepthBufFC",2/(Math.log(a.far+1)/Math.LN2)),a!==W&&(W=a,l=k=!0),(c.isShaderMaterial||c.isMeshPhongMaterial||c.isMeshStandardMaterial||c.envMap)&&void 0!==(m=i.map.cameraPosition)&&m.setValue(Da,Aa.setFromMatrixPosition(a.matrixWorld)),(c.isMeshPhongMaterial||c.isMeshLambertMaterial||c.isMeshBasicMaterial||c.isMeshStandardMaterial||c.isShaderMaterial||c.skinning)&&i.setValue(Da,"viewMatrix",a.matrixWorldInverse),i.set(Da,L,"toneMappingExposure"),i.set(Da,L,"toneMappingWhitePoint")),c.skinning&&(i.setOptional(Da,d,"bindMatrix"),i.setOptional(Da,d,"bindMatrixInverse"),a=d.skeleton)&&(Fa.floatVertexTextures&&a.useVertexTexture?(i.set(Da,a,"boneTexture"),i.set(Da,a,"boneTextureWidth"),i.set(Da,a,"boneTextureHeight")):i.setOptional(Da,a,"boneMatrices")),k){if(c.lights&&(a=l,j.ambientLightColor.needsUpdate=a,j.directionalLights.needsUpdate=a,j.pointLights.needsUpdate=a,j.spotLights.needsUpdate=a,j.hemisphereLights.needsUpdate=a),b&&c.fog&&(j.fogColor.value=b.color,b.isFog?(j.fogNear.value=b.near,j.fogFar.value=b.far):b.isFogExp2&&(j.fogDensity.value=b.density)),c.isMeshBasicMaterial||c.isMeshLambertMaterial||c.isMeshPhongMaterial||c.isMeshStandardMaterial||c.isMeshDepthMaterial){j.opacity.value=c.opacity,j.diffuse.value=c.color,c.emissive&&j.emissive.value.copy(c.emissive).multiplyScalar(c.emissiveIntensity),j.map.value=c.map,j.specularMap.value=c.specularMap,j.alphaMap.value=c.alphaMap,c.aoMap&&(j.aoMap.value=c.aoMap,j.aoMapIntensity.value=c.aoMapIntensity);var n;c.map?n=c.map:c.specularMap?n=c.specularMap:c.displacementMap?n=c.displacementMap:c.normalMap?n=c.normalMap:c.bumpMap?n=c.bumpMap:c.roughnessMap?n=c.roughnessMap:c.metalnessMap?n=c.metalnessMap:c.alphaMap?n=c.alphaMap:c.emissiveMap&&(n=c.emissiveMap),void 0!==n&&(n.isWebGLRenderTarget&&(n=n.texture),b=n.offset,n=n.repeat,j.offsetRepeat.value.set(b.x,b.y,n.x,n.y)),j.envMap.value=c.envMap,j.flipEnvMap.value=c.envMap&&c.envMap.isCubeTexture?-1:1,j.reflectivity.value=c.reflectivity,j.refractionRatio.value=c.refractionRatio}c.isLineBasicMaterial?(j.diffuse.value=c.color,j.opacity.value=c.opacity):c.isLineDashedMaterial?(j.diffuse.value=c.color,j.opacity.value=c.opacity,j.dashSize.value=c.dashSize,j.totalSize.value=c.dashSize+c.gapSize,j.scale.value=c.scale):c.isPointsMaterial?(j.diffuse.value=c.color,j.opacity.value=c.opacity,j.size.value=c.size*ga,j.scale.value=.5*fa,j.map.value=c.map,null!==c.map&&(n=c.map.offset,c=c.map.repeat,j.offsetRepeat.value.set(n.x,n.y,c.x,c.y))):c.isMeshLambertMaterial?(c.lightMap&&(j.lightMap.value=c.lightMap,j.lightMapIntensity.value=c.lightMapIntensity),c.emissiveMap&&(j.emissiveMap.value=c.emissiveMap)):c.isMeshPhongMaterial?(j.specular.value=c.specular,j.shininess.value=Math.max(c.shininess,1e-4),c.lightMap&&(j.lightMap.value=c.lightMap,j.lightMapIntensity.value=c.lightMapIntensity),c.emissiveMap&&(j.emissiveMap.value=c.emissiveMap),c.bumpMap&&(j.bumpMap.value=c.bumpMap,j.bumpScale.value=c.bumpScale),c.normalMap&&(j.normalMap.value=c.normalMap,j.normalScale.value.copy(c.normalScale)),c.displacementMap&&(j.displacementMap.value=c.displacementMap,j.displacementScale.value=c.displacementScale,j.displacementBias.value=c.displacementBias)):c.isMeshPhysicalMaterial?(j.clearCoat.value=c.clearCoat,j.clearCoatRoughness.value=c.clearCoatRoughness,t(j,c)):c.isMeshStandardMaterial?t(j,c):c.isMeshDepthMaterial?c.displacementMap&&(j.displacementMap.value=c.displacementMap,j.displacementScale.value=c.displacementScale,j.displacementBias.value=c.displacementBias):c.isMeshNormalMaterial&&(j.opacity.value=c.opacity),P.upload(Da,e.uniformsList,j,L)}return i.set(Da,d,"modelViewMatrix"),i.set(Da,d,"normalMatrix"),i.setValue(Da,"modelMatrix",d.matrixWorld),f}function t(a,b){a.roughness.value=b.roughness,a.metalness.value=b.metalness,b.roughnessMap&&(a.roughnessMap.value=b.roughnessMap),b.metalnessMap&&(a.metalnessMap.value=b.metalnessMap),b.lightMap&&(a.lightMap.value=b.lightMap,a.lightMapIntensity.value=b.lightMapIntensity),b.emissiveMap&&(a.emissiveMap.value=b.emissiveMap),b.bumpMap&&(a.bumpMap.value=b.bumpMap,a.bumpScale.value=b.bumpScale),b.normalMap&&(a.normalMap.value=b.normalMap,a.normalScale.value.copy(b.normalScale)),b.displacementMap&&(a.displacementMap.value=b.displacementMap,a.displacementScale.value=b.displacementScale,a.displacementBias.value=b.displacementBias),b.envMap&&(a.envMapIntensity.value=b.envMapIntensity)}function u(a){var b;if(1e3===a)return Da.REPEAT;if(1001===a)return Da.CLAMP_TO_EDGE;if(1002===a)return Da.MIRRORED_REPEAT;if(1003===a)return Da.NEAREST;if(1004===a)return Da.NEAREST_MIPMAP_NEAREST;if(1005===a)return Da.NEAREST_MIPMAP_LINEAR;if(1006===a)return Da.LINEAR;if(1007===a)return Da.LINEAR_MIPMAP_NEAREST;if(1008===a)return Da.LINEAR_MIPMAP_LINEAR;if(1009===a)return Da.UNSIGNED_BYTE;if(1017===a)return Da.UNSIGNED_SHORT_4_4_4_4;if(1018===a)return Da.UNSIGNED_SHORT_5_5_5_1;if(1019===a)return Da.UNSIGNED_SHORT_5_6_5;if(1010===a)return Da.BYTE;if(1011===a)return Da.SHORT;if(1012===a)return Da.UNSIGNED_SHORT;if(1013===a)return Da.INT;if(1014===a)return Da.UNSIGNED_INT;if(1015===a)return Da.FLOAT;if(1016===a&&null!==(b=Ea.get("OES_texture_half_float")))return b.HALF_FLOAT_OES;if(1021===a)return Da.ALPHA;if(1022===a)return Da.RGB;if(1023===a)return Da.RGBA;if(1024===a)return Da.LUMINANCE;if(1025===a)return Da.LUMINANCE_ALPHA;if(1026===a)return Da.DEPTH_COMPONENT;if(1027===a)return Da.DEPTH_STENCIL;if(100===a)return Da.FUNC_ADD;if(101===a)return Da.FUNC_SUBTRACT;if(102===a)return Da.FUNC_REVERSE_SUBTRACT;if(200===a)return Da.ZERO;if(201===a)return Da.ONE;if(202===a)return Da.SRC_COLOR;if(203===a)return Da.ONE_MINUS_SRC_COLOR;if(204===a)return Da.SRC_ALPHA;if(205===a)return Da.ONE_MINUS_SRC_ALPHA;if(206===a)return Da.DST_ALPHA;if(207===a)return Da.ONE_MINUS_DST_ALPHA;if(208===a)return Da.DST_COLOR;if(209===a)return Da.ONE_MINUS_DST_COLOR;if(210===a)return Da.SRC_ALPHA_SATURATE;if((2001===a||2002===a||2003===a||2004===a)&&null!==(b=Ea.get("WEBGL_compressed_texture_s3tc"))){if(2001===a)return b.COMPRESSED_RGB_S3TC_DXT1_EXT;if(2002===a)return b.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(2003===a)return b.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(2004===a)return b.COMPRESSED_RGBA_S3TC_DXT5_EXT}if((2100===a||2101===a||2102===a||2103===a)&&null!==(b=Ea.get("WEBGL_compressed_texture_pvrtc"))){if(2100===a)return b.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(2101===a)return b.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(2102===a)return b.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(2103===a)return b.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(2151===a&&null!==(b=Ea.get("WEBGL_compressed_texture_etc1")))return b.COMPRESSED_RGB_ETC1_WEBGL;if((103===a||104===a)&&null!==(b=Ea.get("EXT_blend_minmax"))){if(103===a)return b.MIN_EXT;if(104===a)return b.MAX_EXT}return 1020===a&&null!==(b=Ea.get("WEBGL_depth_texture"))?b.UNSIGNED_INT_24_8_WEBGL:0}console.log("THREE.WebGLRenderer","82"),a=a||{};var v=void 0!==a.canvas?a.canvas:document.createElementNS("http://www.w3.org/1999/xhtml","canvas"),w=void 0!==a.context?a.context:null,x=void 0!==a.alpha&&a.alpha,y=void 0===a.depth||a.depth,z=void 0===a.stencil||a.stencil,A=void 0!==a.antialias&&a.antialias,B=void 0===a.premultipliedAlpha||a.premultipliedAlpha,C=void 0!==a.preserveDrawingBuffer&&a.preserveDrawingBuffer,D=[],E=[],F=-1,G=[],H=-1,I=new Float32Array(8),J=[],K=[];this.domElement=v,this.context=null,this.sortObjects=this.autoClearStencil=this.autoClearDepth=this.autoClearColor=this.autoClear=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.gammaFactor=2,this.physicallyCorrectLights=this.gammaOutput=this.gammaInput=!1,this.toneMappingWhitePoint=this.toneMappingExposure=this.toneMapping=1,this.maxMorphTargets=8,this.maxMorphNormals=4;var L=this,M=null,N=null,O=null,R=-1,U="",W=null,X=new e,Z=null,$=new e,ba=0,ca=new Q(0),da=0,ea=v.width,fa=v.height,ga=1,ha=new e(0,0,ea,fa),ja=!1,ka=new e(0,0,ea,fa),la=new _,ma=new Ua,na=!1,oa=!1,ta=new Y,za=new j,Aa=new i,Ba={hash:"",ambient:[0,0,0],directional:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotShadowMap:[],spotShadowMatrix:[],point:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],shadows:[]},Ca={calls:0,vertices:0,faces:0,points:0};this.info={render:Ca,memory:{geometries:0,textures:0},programs:null};var Da;try{if(x={alpha:x,depth:y,stencil:z,antialias:A,premultipliedAlpha:B,preserveDrawingBuffer:C},null===(Da=w||v.getContext("webgl",x)||v.getContext("experimental-webgl",x))){if(null!==v.getContext("webgl"))throw"Error creating WebGL context with your selected attributes.";throw"Error creating WebGL context."}void 0===Da.getShaderPrecisionFormat&&(Da.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}}),v.addEventListener("webglcontextlost",f,!1)}catch(bb){console.error("THREE.WebGLRenderer: "+bb)}var Ea=new Ta(Da);Ea.get("WEBGL_depth_texture"),Ea.get("OES_texture_float"),Ea.get("OES_texture_float_linear"),Ea.get("OES_texture_half_float"),Ea.get("OES_texture_half_float_linear"),Ea.get("OES_standard_derivatives"),Ea.get("ANGLE_instanced_arrays"),Ea.get("OES_element_index_uint")&&(pa.MaxIndex=4294967296);var Fa=new Sa(Da,Ea,a),Ga=new Ra(Da,Ea,u),Ha=new Qa,Ia=new Pa(Da,Ea,Ga,Ha,Fa,u,this.info),Ja=new Oa(Da,Ha,this.info),Ka=new Ma(this,Fa),La=new ya;this.info.programs=Ka.programs;var Na=new xa(Da,Ea,Ca),Va=new wa(Da,Ea,Ca),Wa=new va(-1,1,1,-1,0,1),Xa=new ua,Ya=new qa(new sa(2,2),new ia({depthTest:!1,depthWrite:!1,fog:!1}));a=ce.cube;var Za=new qa(new ra(5,5,5),new V({uniforms:a.uniforms,vertexShader:a.vertexShader,fragmentShader:a.fragmentShader,side:1,depthTest:!1,depthWrite:!1,fog:!1}));c(),this.context=Da,this.capabilities=Fa,this.extensions=Ea,this.properties=Ha,this.state=Ga;var $a=new aa(this,Ba,Ja,Fa);this.shadowMap=$a;var _a=new T(this,J),ab=new S(this,K);this.getContext=function(){return Da},this.getContextAttributes=function(){return Da.getContextAttributes()},this.forceContextLoss=function(){Ea.get("WEBGL_lose_context").loseContext()},this.getMaxAnisotropy=function(){return Fa.getMaxAnisotropy()},this.getPrecision=function(){return Fa.precision},this.getPixelRatio=function(){return ga},this.setPixelRatio=function(a){void 0!==a&&(ga=a,this.setSize(ka.z,ka.w,!1))},this.getSize=function(){return{width:ea,height:fa}},this.setSize=function(a,b,c){ea=a,fa=b,v.width=a*ga,v.height=b*ga,!1!==c&&(v.style.width=a+"px",v.style.height=b+"px"),this.setViewport(0,0,a,b)},this.setViewport=function(a,b,c,d){Ga.viewport(ka.set(a,b,c,d))},this.setScissor=function(a,b,c,d){Ga.scissor(ha.set(a,b,c,d))},this.setScissorTest=function(a){Ga.setScissorTest(ja=a)},this.getClearColor=function(){return ca},this.setClearColor=function(a,c){ca.set(a),da=void 0!==c?c:1,b(ca.r,ca.g,ca.b,da)},this.getClearAlpha=function(){return da},this.setClearAlpha=function(a){da=a,b(ca.r,ca.g,ca.b,da)},this.clear=function(a,b,c){var d=0;(void 0===a||a)&&(d|=Da.COLOR_BUFFER_BIT),(void 0===b||b)&&(d|=Da.DEPTH_BUFFER_BIT),(void 0===c||c)&&(d|=Da.STENCIL_BUFFER_BIT),Da.clear(d)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.clearTarget=function(a,b,c,d){this.setRenderTarget(a),this.clear(b,c,d)},this.resetGLState=d,this.dispose=function(){G=[],H=-1,E=[],F=-1,v.removeEventListener("webglcontextlost",f,!1)},this.renderBufferImmediate=function(a,b,c){Ga.initAttributes();var d=Ha.get(a);if(a.hasPositions&&!d.position&&(d.position=Da.createBuffer()),a.hasNormals&&!d.normal&&(d.normal=Da.createBuffer()),a.hasUvs&&!d.uv&&(d.uv=Da.createBuffer()),a.hasColors&&!d.color&&(d.color=Da.createBuffer()),b=b.getAttributes(),a.hasPositions&&(Da.bindBuffer(Da.ARRAY_BUFFER,d.position),Da.bufferData(Da.ARRAY_BUFFER,a.positionArray,Da.DYNAMIC_DRAW),Ga.enableAttribute(b.position),Da.vertexAttribPointer(b.position,3,Da.FLOAT,!1,0,0)),a.hasNormals){if(Da.bindBuffer(Da.ARRAY_BUFFER,d.normal),!c.isMeshPhongMaterial&&!c.isMeshStandardMaterial&&1===c.shading)for(var e=0,f=3*a.count;e<f;e+=9){var g=a.normalArray,h=(g[e+0]+g[e+3]+g[e+6])/3,i=(g[e+1]+g[e+4]+g[e+7])/3,j=(g[e+2]+g[e+5]+g[e+8])/3;g[e+0]=h,g[e+1]=i,g[e+2]=j,g[e+3]=h,g[e+4]=i,g[e+5]=j,g[e+6]=h,g[e+7]=i,g[e+8]=j}Da.bufferData(Da.ARRAY_BUFFER,a.normalArray,Da.DYNAMIC_DRAW),Ga.enableAttribute(b.normal),Da.vertexAttribPointer(b.normal,3,Da.FLOAT,!1,0,0)}a.hasUvs&&c.map&&(Da.bindBuffer(Da.ARRAY_BUFFER,d.uv),Da.bufferData(Da.ARRAY_BUFFER,a.uvArray,Da.DYNAMIC_DRAW),Ga.enableAttribute(b.uv),Da.vertexAttribPointer(b.uv,2,Da.FLOAT,!1,0,0)),a.hasColors&&0!==c.vertexColors&&(Da.bindBuffer(Da.ARRAY_BUFFER,d.color),Da.bufferData(Da.ARRAY_BUFFER,a.colorArray,Da.DYNAMIC_DRAW),Ga.enableAttribute(b.color),Da.vertexAttribPointer(b.color,3,Da.FLOAT,!1,0,0)),Ga.disableUnusedAttributes(),Da.drawArrays(Da.TRIANGLES,0,a.count),a.count=0},this.renderBufferDirect=function(a,b,c,d,e,f){r(d);var g=s(a,b,d,e),h=!1;if(a=c.id+"_"+g.id+"_"+d.wireframe,a!==U&&(U=a,h=!0),void 0!==(b=e.morphTargetInfluences)){var i=[];a=0;for(var j=b.length;a<j;a++)h=b[a],i.push([h,a]);i.sort(k),8<i.length&&(i.length=8);var l=c.morphAttributes;for(a=0,j=i.length;a<j;a++)h=i[a],I[a]=h[0],0!==h[0]?(b=h[1],!0===d.morphTargets&&l.position&&c.addAttribute("morphTarget"+a,l.position[b]),!0===d.morphNormals&&l.normal&&c.addAttribute("morphNormal"+a,l.normal[b])):(!0===d.morphTargets&&c.removeAttribute("morphTarget"+a),!0===d.morphNormals&&c.removeAttribute("morphNormal"+a));for(a=i.length,b=I.length;a<b;a++)I[a]=0;g.getUniforms().setValue(Da,"morphTargetInfluences",I),h=!0}if(b=c.index,j=c.attributes.position,i=1,!0===d.wireframe&&(b=Ja.getWireframeAttribute(c),i=2),null!==b?(a=Va,a.setIndex(b)):a=Na,h){var m,h=void 0;if(c&&c.isInstancedBufferGeometry&&null===(m=Ea.get("ANGLE_instanced_arrays")))console.error("THREE.WebGLRenderer.setupVertexAttributes: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");else{void 0===h&&(h=0),Ga.initAttributes();var n,l=c.attributes,g=g.getAttributes(),o=d.defaultAttributeValues;for(n in g){var p=g[n];if(0<=p){var q=l[n];if(void 0!==q){var t=Da.FLOAT,u=q.array,v=q.normalized;u instanceof Float32Array?t=Da.FLOAT:u instanceof Float64Array?console.warn("Unsupported data buffer format: Float64Array"):u instanceof Uint16Array?t=Da.UNSIGNED_SHORT:u instanceof Int16Array?t=Da.SHORT:u instanceof Uint32Array?t=Da.UNSIGNED_INT:u instanceof Int32Array?t=Da.INT:u instanceof Int8Array?t=Da.BYTE:u instanceof Uint8Array&&(t=Da.UNSIGNED_BYTE);var u=q.itemSize,w=Ja.getAttributeBuffer(q);if(q.isInterleavedBufferAttribute){var x=q.data,y=x.stride,q=q.offset;x&&x.isInstancedInterleavedBuffer?(Ga.enableAttributeAndDivisor(p,x.meshPerAttribute,m),void 0===c.maxInstancedCount&&(c.maxInstancedCount=x.meshPerAttribute*x.count)):Ga.enableAttribute(p),Da.bindBuffer(Da.ARRAY_BUFFER,w),Da.vertexAttribPointer(p,u,t,v,y*x.array.BYTES_PER_ELEMENT,(h*y+q)*x.array.BYTES_PER_ELEMENT)}else q.isInstancedBufferAttribute?(Ga.enableAttributeAndDivisor(p,q.meshPerAttribute,m),void 0===c.maxInstancedCount&&(c.maxInstancedCount=q.meshPerAttribute*q.count)):Ga.enableAttribute(p),Da.bindBuffer(Da.ARRAY_BUFFER,w),Da.vertexAttribPointer(p,u,t,v,0,h*u*q.array.BYTES_PER_ELEMENT)}else if(void 0!==o&&void 0!==(t=o[n]))switch(t.length){case 2:Da.vertexAttrib2fv(p,t);break;case 3:Da.vertexAttrib3fv(p,t);break;case 4:Da.vertexAttrib4fv(p,t);break;default:Da.vertexAttrib1fv(p,t)}}}Ga.disableUnusedAttributes()}null!==b&&Da.bindBuffer(Da.ELEMENT_ARRAY_BUFFER,Ja.getAttributeBuffer(b))}if(m=0,null!==b?m=b.count:void 0!==j&&(m=j.count),b=c.drawRange.start*i,j=null!==f?f.start*i:0,n=Math.max(b,j),0!==(f=Math.max(0,Math.min(m,b+c.drawRange.count*i,j+(null!==f?f.count*i:1/0))-1-n+1))){if(e.isMesh)if(!0===d.wireframe)Ga.setLineWidth(d.wireframeLinewidth*(null===N?ga:1)),a.setMode(Da.LINES);else switch(e.drawMode){case 0:a.setMode(Da.TRIANGLES);break;case 1:a.setMode(Da.TRIANGLE_STRIP);break;case 2:a.setMode(Da.TRIANGLE_FAN)}else e.isLine?(d=d.linewidth,void 0===d&&(d=1),Ga.setLineWidth(d*(null===N?ga:1)),e.isLineSegments?a.setMode(Da.LINES):a.setMode(Da.LINE_STRIP)):e.isPoints&&a.setMode(Da.POINTS);c&&c.isInstancedBufferGeometry?0<c.maxInstancedCount&&a.renderInstances(c,n,f):a.render(n,f)}},this.render=function(a,c,d,e){if(void 0!==c&&!0!==c.isCamera)console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");else{U="",R=-1,W=null,!0===a.autoUpdate&&a.updateMatrixWorld(),null===c.parent&&c.updateMatrixWorld(),c.matrixWorldInverse.getInverse(c.matrixWorld),za.multiplyMatrices(c.projectionMatrix,c.matrixWorldInverse),la.setFromMatrix(za),D.length=0,H=F=-1,J.length=0,K.length=0,oa=this.localClippingEnabled,na=ma.init(this.clippingPlanes,oa,c),p(a,c),E.length=F+1,G.length=H+1,!0===L.sortObjects&&(E.sort(l),G.sort(m)),na&&ma.beginShadows();for(var f=D,g=0,h=0,i=f.length;h<i;h++){var k=f[h];k.castShadow&&(Ba.shadows[g++]=k)}Ba.shadows.length=g,$a.render(a,c);for(var n,o,r,s,f=D,t=k=0,u=0,v=c.matrixWorldInverse,w=0,x=0,y=0,z=0,g=0,h=f.length;g<h;g++)if(i=f[g],n=i.color,o=i.intensity,r=i.distance,s=i.shadow&&i.shadow.map?i.shadow.map.texture:null,i.isAmbientLight)k+=n.r*o,t+=n.g*o,u+=n.b*o;else if(i.isDirectionalLight){var A=La.get(i);A.color.copy(i.color).multiplyScalar(i.intensity),A.direction.setFromMatrixPosition(i.matrixWorld),Aa.setFromMatrixPosition(i.target.matrixWorld),A.direction.sub(Aa),A.direction.transformDirection(v),(A.shadow=i.castShadow)&&(A.shadowBias=i.shadow.bias,A.shadowRadius=i.shadow.radius,A.shadowMapSize=i.shadow.mapSize),Ba.directionalShadowMap[w]=s,Ba.directionalShadowMatrix[w]=i.shadow.matrix,Ba.directional[w++]=A}else i.isSpotLight?(A=La.get(i),A.position.setFromMatrixPosition(i.matrixWorld),A.position.applyMatrix4(v),A.color.copy(n).multiplyScalar(o),A.distance=r,A.direction.setFromMatrixPosition(i.matrixWorld),Aa.setFromMatrixPosition(i.target.matrixWorld),A.direction.sub(Aa),A.direction.transformDirection(v),A.coneCos=Math.cos(i.angle),A.penumbraCos=Math.cos(i.angle*(1-i.penumbra)),A.decay=0===i.distance?0:i.decay,(A.shadow=i.castShadow)&&(A.shadowBias=i.shadow.bias,A.shadowRadius=i.shadow.radius,A.shadowMapSize=i.shadow.mapSize),Ba.spotShadowMap[y]=s,Ba.spotShadowMatrix[y]=i.shadow.matrix,Ba.spot[y++]=A):i.isPointLight?(A=La.get(i),A.position.setFromMatrixPosition(i.matrixWorld),A.position.applyMatrix4(v),A.color.copy(i.color).multiplyScalar(i.intensity),A.distance=i.distance,A.decay=0===i.distance?0:i.decay,(A.shadow=i.castShadow)&&(A.shadowBias=i.shadow.bias,A.shadowRadius=i.shadow.radius,A.shadowMapSize=i.shadow.mapSize),Ba.pointShadowMap[x]=s,void 0===Ba.pointShadowMatrix[x]&&(Ba.pointShadowMatrix[x]=new j),Aa.setFromMatrixPosition(i.matrixWorld).negate(),Ba.pointShadowMatrix[x].identity().setPosition(Aa),Ba.point[x++]=A):i.isHemisphereLight&&(A=La.get(i),A.direction.setFromMatrixPosition(i.matrixWorld),A.direction.transformDirection(v),A.direction.normalize(),A.skyColor.copy(i.color).multiplyScalar(o),A.groundColor.copy(i.groundColor).multiplyScalar(o),Ba.hemi[z++]=A);Ba.ambient[0]=k,Ba.ambient[1]=t,Ba.ambient[2]=u,Ba.directional.length=w,Ba.spot.length=y,Ba.point.length=x,Ba.hemi.length=z,Ba.hash=w+","+x+","+y+","+z+","+Ba.shadows.length,na&&ma.endShadows(),Ca.calls=0,Ca.vertices=0,Ca.faces=0,Ca.points=0,void 0===d&&(d=null),this.setRenderTarget(d),f=a.background,null===f?b(ca.r,ca.g,ca.b,da):f&&f.isColor&&(b(f.r,f.g,f.b,1),e=!0),(this.autoClear||e)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil),f&&f.isCubeTexture?(Xa.projectionMatrix.copy(c.projectionMatrix),Xa.matrixWorld.extractRotation(c.matrixWorld),Xa.matrixWorldInverse.getInverse(Xa.matrixWorld),Za.material.uniforms.tCube.value=f,Za.modelViewMatrix.multiplyMatrices(Xa.matrixWorldInverse,Za.matrixWorld),Ja.update(Za),L.renderBufferDirect(Xa,null,Za.geometry,Za.material,Za,null)):f&&f.isTexture&&(Ya.material.map=f,Ja.update(Ya),L.renderBufferDirect(Wa,null,Ya.geometry,Ya.material,Ya,null)),a.overrideMaterial?(e=a.overrideMaterial,q(E,a,c,e),q(G,a,c,e)):(Ga.setBlending(0),q(E,a,c),q(G,a,c)),_a.render(a,c),ab.render(a,c,$),d&&Ia.updateRenderTargetMipmap(d),Ga.setDepthTest(!0),Ga.setDepthWrite(!0),Ga.setColorWrite(!0)}},this.setFaceCulling=function(a,b){Ga.setCullFace(a),Ga.setFlipSided(0===b)},this.allocTextureUnit=function(){var a=ba;return a>=Fa.maxTextures&&console.warn("WebGLRenderer: trying to use "+a+" texture units while this GPU supports only "+Fa.maxTextures),ba+=1,a},this.setTexture2D=function(){var a=!1;return function(b,c){b&&b.isWebGLRenderTarget&&(a||(console.warn("THREE.WebGLRenderer.setTexture2D: don't use render targets as textures. Use their .texture property instead."),a=!0),b=b.texture),Ia.setTexture2D(b,c)}}(),this.setTexture=function(){var a=!1;return function(b,c){a||(console.warn("THREE.WebGLRenderer: .setTexture is deprecated, use setTexture2D instead."),a=!0),Ia.setTexture2D(b,c)}}(),this.setTextureCube=function(){var a=!1;return function(b,c){b&&b.isWebGLRenderTargetCube&&(a||(console.warn("THREE.WebGLRenderer.setTextureCube: don't use cube render targets as textures. Use their .texture property instead."),a=!0),b=b.texture),b&&b.isCubeTexture||Array.isArray(b.image)&&6===b.image.length?Ia.setTextureCube(b,c):Ia.setTextureCubeDynamic(b,c)}}(),this.getCurrentRenderTarget=function(){return N},this.setRenderTarget=function(a){(N=a)&&void 0===Ha.get(a).__webglFramebuffer&&Ia.setupRenderTarget(a);var b,c=a&&a.isWebGLRenderTargetCube;a?(b=Ha.get(a),b=c?b.__webglFramebuffer[a.activeCubeFace]:b.__webglFramebuffer,X.copy(a.scissor),Z=a.scissorTest,$.copy(a.viewport)):(b=null,X.copy(ha).multiplyScalar(ga),Z=ja,$.copy(ka).multiplyScalar(ga)),O!==b&&(Da.bindFramebuffer(Da.FRAMEBUFFER,b),O=b),Ga.scissor(X),Ga.setScissorTest(Z),Ga.viewport($),c&&(c=Ha.get(a.texture),Da.framebufferTexture2D(Da.FRAMEBUFFER,Da.COLOR_ATTACHMENT0,Da.TEXTURE_CUBE_MAP_POSITIVE_X+a.activeCubeFace,c.__webglTexture,a.activeMipMapLevel))},this.readRenderTargetPixels=function(a,b,c,d,e,f){if(!1===(a&&a.isWebGLRenderTarget))console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");else{var g=Ha.get(a).__webglFramebuffer;if(g){var h=!1;g!==O&&(Da.bindFramebuffer(Da.FRAMEBUFFER,g),h=!0);try{var i=a.texture,j=i.format,k=i.type;1023!==j&&u(j)!==Da.getParameter(Da.IMPLEMENTATION_COLOR_READ_FORMAT)?console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format."):1009===k||u(k)===Da.getParameter(Da.IMPLEMENTATION_COLOR_READ_TYPE)||1015===k&&(Ea.get("OES_texture_float")||Ea.get("WEBGL_color_buffer_float"))||1016===k&&Ea.get("EXT_color_buffer_half_float")?Da.checkFramebufferStatus(Da.FRAMEBUFFER)===Da.FRAMEBUFFER_COMPLETE?0<=b&&b<=a.width-d&&0<=c&&c<=a.height-e&&Da.readPixels(b,c,d,e,u(j),u(k),f):console.error("THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete."):console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.")}finally{h&&Da.bindFramebuffer(Da.FRAMEBUFFER,O)}}}}}function Wa(a,b){this.name="",this.color=new Q(a),this.density=void 0!==b?b:25e-5}function Xa(a,b,c){this.name="",this.color=new Q(a),this.near=void 0!==b?b:1,this.far=void 0!==c?c:1e3}function Ya(){ea.call(this),this.type="Scene",this.overrideMaterial=this.fog=this.background=null,this.autoUpdate=!0}function Za(a,b,c,d,e){ea.call(this),this.lensFlares=[],this.positionScreen=new i,this.customUpdateCallback=void 0,void 0!==a&&this.add(a,b,c,d,e)}function $a(a){U.call(this),this.type="SpriteMaterial",this.color=new Q(16777215),this.map=null,this.rotation=0,this.lights=this.fog=!1,this.setValues(a)}function _a(a){ea.call(this),this.type="Sprite",this.material=void 0!==a?a:new $a}function ab(){ea.call(this),this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]}})}function bb(a,b,c,e,f,g,h,i,j,k,l,m){d.call(this,null,g,h,i,j,k,e,f,l,m),this.image={data:a,width:b,height:c},this.magFilter=void 0!==j?j:1003,this.minFilter=void 0!==k?k:1003,this.flipY=this.generateMipmaps=!1,this.unpackAlignment=1}function cb(a,b,c){if(this.useVertexTexture=void 0===c||c,this.identityMatrix=new j,a=a||[],this.bones=a.slice(0),this.useVertexTexture?(a=Math.sqrt(4*this.bones.length),a=Td.nextPowerOfTwo(Math.ceil(a)),this.boneTextureHeight=this.boneTextureWidth=a=Math.max(a,4),this.boneMatrices=new Float32Array(this.boneTextureWidth*this.boneTextureHeight*4),this.boneTexture=new bb(this.boneMatrices,this.boneTextureWidth,this.boneTextureHeight,1023,1015)):this.boneMatrices=new Float32Array(16*this.bones.length),void 0===b)this.calculateInverses();else if(this.bones.length===b.length)this.boneInverses=b.slice(0);else for(console.warn("THREE.Skeleton bonInverses is the wrong length."),this.boneInverses=[],b=0,a=this.bones.length;b<a;b++)this.boneInverses.push(new j)}function db(a){ea.call(this),this.type="Bone",this.skin=a}function eb(a,b,c){if(qa.call(this,a,b),this.type="SkinnedMesh",this.bindMode="attached",this.bindMatrix=new j,this.bindMatrixInverse=new j,a=[],this.geometry&&void 0!==this.geometry.bones){for(var d,e=0,f=this.geometry.bones.length;e<f;++e)d=this.geometry.bones[e],b=new db(this),a.push(b),b.name=d.name,b.position.fromArray(d.pos),b.quaternion.fromArray(d.rotq),void 0!==d.scl&&b.scale.fromArray(d.scl);for(e=0,f=this.geometry.bones.length;e<f;++e)d=this.geometry.bones[e],-1!==d.parent&&null!==d.parent&&void 0!==a[d.parent]?a[d.parent].add(a[e]):this.add(a[e])}this.normalizeSkinWeights(),this.updateMatrixWorld(!0),this.bind(new cb(a,void 0,c),this.matrixWorld)}function fb(a){U.call(this),this.type="LineBasicMaterial",this.color=new Q(16777215),this.linewidth=1,this.linejoin=this.linecap="round", this.lights=!1,this.setValues(a)}function gb(a,b,c){if(1===c)return console.warn("THREE.Line: parameter THREE.LinePieces no longer supported. Created THREE.LineSegments instead."),new hb(a,b);ea.call(this),this.type="Line",this.geometry=void 0!==a?a:new pa,this.material=void 0!==b?b:new fb({color:16777215*Math.random()})}function hb(a,b){gb.call(this,a,b),this.type="LineSegments"}function ib(a){U.call(this),this.type="PointsMaterial",this.color=new Q(16777215),this.map=null,this.size=1,this.sizeAttenuation=!0,this.lights=!1,this.setValues(a)}function jb(a,b){ea.call(this),this.type="Points",this.geometry=void 0!==a?a:new pa,this.material=void 0!==b?b:new ib({color:16777215*Math.random()})}function kb(){ea.call(this),this.type="Group"}function lb(a,b,c,e,f,g,h,i,j){function k(){requestAnimationFrame(k),a.readyState>=a.HAVE_CURRENT_DATA&&(l.needsUpdate=!0)}d.call(this,a,b,c,e,f,g,h,i,j),this.generateMipmaps=!1;var l=this;k()}function mb(a,b,c,e,f,g,h,i,j,k,l,m){d.call(this,null,g,h,i,j,k,e,f,l,m),this.image={width:b,height:c},this.mipmaps=a,this.generateMipmaps=this.flipY=!1}function nb(a,b,c,e,f,g,h,i,j){d.call(this,a,b,c,e,f,g,h,i,j),this.needsUpdate=!0}function ob(a,b,c,e,f,g,h,i,j,k){if(1026!==(k=void 0!==k?k:1026)&&1027!==k)throw Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");d.call(this,null,e,f,g,h,i,k,c,j),this.image={width:a,height:b},this.type=void 0!==c?c:1012,this.magFilter=void 0!==h?h:1003,this.minFilter=void 0!==i?i:1003,this.generateMipmaps=this.flipY=!1}function pb(a){function b(a,b){return a-b}pa.call(this);var c=[0,0],d={},e=["a","b","c"];if(a&&a.isGeometry){var f=a.vertices,g=a.faces,h=0,i=new Uint32Array(6*g.length);a=0;for(var j=g.length;a<j;a++)for(var k=g[a],l=0;3>l;l++){c[0]=k[e[l]],c[1]=k[e[(l+1)%3]],c.sort(b);var m=c.toString();void 0===d[m]&&(i[2*h]=c[0],i[2*h+1]=c[1],d[m]=!0,h++)}for(c=new Float32Array(6*h),a=0,j=h;a<j;a++)for(l=0;2>l;l++)d=f[i[2*a+l]],h=6*a+3*l,c[h+0]=d.x,c[h+1]=d.y,c[h+2]=d.z;this.addAttribute("position",new ja(c,3))}else if(a&&a.isBufferGeometry){if(null!==a.index){for(j=a.index.array,f=a.attributes.position,e=a.groups,h=0,0===e.length&&a.addGroup(0,j.length),i=new Uint32Array(2*j.length),g=0,k=e.length;g<k;++g){a=e[g],l=a.start,m=a.count,a=l;for(var n=l+m;a<n;a+=3)for(l=0;3>l;l++)c[0]=j[a+l],c[1]=j[a+(l+1)%3],c.sort(b),m=c.toString(),void 0===d[m]&&(i[2*h]=c[0],i[2*h+1]=c[1],d[m]=!0,h++)}for(c=new Float32Array(6*h),a=0,j=h;a<j;a++)for(l=0;2>l;l++)h=6*a+3*l,d=i[2*a+l],c[h+0]=f.getX(d),c[h+1]=f.getY(d),c[h+2]=f.getZ(d)}else for(f=a.attributes.position.array,h=f.length/3,i=h/3,c=new Float32Array(6*h),a=0,j=i;a<j;a++)for(l=0;3>l;l++)h=18*a+6*l,i=9*a+3*l,c[h+0]=f[i],c[h+1]=f[i+1],c[h+2]=f[i+2],d=9*a+(l+1)%3*3,c[h+3]=f[d],c[h+4]=f[d+1],c[h+5]=f[d+2];this.addAttribute("position",new ja(c,3))}}function qb(a,b,c){pa.call(this),this.type="ParametricBufferGeometry",this.parameters={func:a,slices:b,stacks:c};var d,e,f,g,h,i=[],j=[],k=b+1;for(d=0;d<=c;d++)for(h=d/c,e=0;e<=b;e++)g=e/b,f=a(g,h),i.push(f.x,f.y,f.z),j.push(g,h);a=[];var l;for(d=0;d<c;d++)for(e=0;e<b;e++)f=d*k+e,g=d*k+e+1,h=(d+1)*k+e+1,l=(d+1)*k+e,a.push(f,g,l),a.push(g,h,l);this.setIndex((65535<a.length?la:ka)(a,1)),this.addAttribute("position",ma(i,3)),this.addAttribute("uv",ma(j,2)),this.computeVertexNormals()}function rb(a,b,c){na.call(this),this.type="ParametricGeometry",this.parameters={func:a,slices:b,stacks:c},this.fromBufferGeometry(new qb(a,b,c)),this.mergeVertices()}function sb(a,b,d,e){function f(a){j.push(a.x,a.y,a.z)}function g(b,c){var d=3*b;c.x=a[d+0],c.y=a[d+1],c.z=a[d+2]}function h(a,b,c,d){0>d&&1===a.x&&(k[b]=a.x-1),0===c.x&&0===c.z&&(k[b]=d/2/Math.PI+.5)}pa.call(this),this.type="PolyhedronBufferGeometry",this.parameters={vertices:a,indices:b,radius:d,detail:e},d=d||1;var j=[],k=[];!function(a){for(var c=new i,d=new i,e=new i,h=0;h<b.length;h+=3){g(b[h+0],c),g(b[h+1],d),g(b[h+2],e);var j,k,l=c,m=d,n=e,o=Math.pow(2,a),p=[];for(j=0;j<=o;j++){p[j]=[];var q=l.clone().lerp(n,j/o),r=m.clone().lerp(n,j/o),s=o-j;for(k=0;k<=s;k++)p[j][k]=0===k&&j===o?q:q.clone().lerp(r,k/s)}for(j=0;j<o;j++)for(k=0;k<2*(o-j)-1;k++)l=Math.floor(k/2),0==k%2?(f(p[j][l+1]),f(p[j+1][l]),f(p[j][l])):(f(p[j][l+1]),f(p[j+1][l+1]),f(p[j+1][l]))}}(e||0),function(a){for(var b=new i,c=0;c<j.length;c+=3)b.x=j[c+0],b.y=j[c+1],b.z=j[c+2],b.normalize().multiplyScalar(a),j[c+0]=b.x,j[c+1]=b.y,j[c+2]=b.z}(d),function(){for(var a=new i,b=0;b<j.length;b+=3)a.x=j[b+0],a.y=j[b+1],a.z=j[b+2],k.push(Math.atan2(a.z,-a.x)/2/Math.PI+.5,1-(Math.atan2(-a.y,Math.sqrt(a.x*a.x+a.z*a.z))/Math.PI+.5));for(var a=new i,b=new i,d=new i,e=new i,f=new c,g=new c,l=new c,m=0,n=0;m<j.length;m+=9,n+=6){a.set(j[m+0],j[m+1],j[m+2]),b.set(j[m+3],j[m+4],j[m+5]),d.set(j[m+6],j[m+7],j[m+8]),f.set(k[n+0],k[n+1]),g.set(k[n+2],k[n+3]),l.set(k[n+4],k[n+5]),e.copy(a).add(b).add(d).divideScalar(3);var o=Math.atan2(e.z,-e.x);h(f,n+0,a,o),h(g,n+2,b,o),h(l,n+4,d,o)}for(a=0;a<k.length;a+=6)b=k[a+0],d=k[a+2],e=k[a+4],f=Math.min(b,d,e),.9<Math.max(b,d,e)&&.1>f&&(.2>b&&(k[a+0]+=1),.2>d&&(k[a+2]+=1),.2>e&&(k[a+4]+=1))}(),this.addAttribute("position",ma(j,3)),this.addAttribute("normal",ma(j.slice(),3)),this.addAttribute("uv",ma(k,2)),this.normalizeNormals(),this.boundingSphere=new Y(new i,d)}function tb(a,b){sb.call(this,[1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],[2,1,0,0,3,2,1,3,0,2,3,1],a,b),this.type="TetrahedronBufferGeometry",this.parameters={radius:a,detail:b}}function ub(a,b){na.call(this),this.type="TetrahedronGeometry",this.parameters={radius:a,detail:b},this.fromBufferGeometry(new tb(a,b)),this.mergeVertices()}function vb(a,b){sb.call(this,[1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2],a,b),this.type="OctahedronBufferGeometry",this.parameters={radius:a,detail:b}}function wb(a,b){na.call(this),this.type="OctahedronGeometry",this.parameters={radius:a,detail:b},this.fromBufferGeometry(new vb(a,b)),this.mergeVertices()}function xb(a,b){var c=(1+Math.sqrt(5))/2;sb.call(this,[-1,c,0,1,c,0,-1,-c,0,1,-c,0,0,-1,c,0,1,c,0,-1,-c,0,1,-c,c,0,-1,c,0,1,-c,0,-1,-c,0,1],[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1],a,b),this.type="IcosahedronBufferGeometry",this.parameters={radius:a,detail:b}}function yb(a,b){na.call(this),this.type="IcosahedronGeometry",this.parameters={radius:a,detail:b},this.fromBufferGeometry(new xb(a,b)),this.mergeVertices()}function zb(a,b){var c=(1+Math.sqrt(5))/2,d=1/c;sb.call(this,[-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-d,-c,0,-d,c,0,d,-c,0,d,c,-d,-c,0,-d,c,0,d,-c,0,d,c,0,-c,0,-d,c,0,-d,-c,0,d,c,0,d],[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1,18,0,18,16,6,10,2,6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,11,19,7,19,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9],a,b),this.type="DodecahedronBufferGeometry",this.parameters={radius:a,detail:b}}function Ab(a,b){na.call(this),this.type="DodecahedronGeometry",this.parameters={radius:a,detail:b},this.fromBufferGeometry(new zb(a,b)),this.mergeVertices()}function Bb(a,b,c,d){na.call(this),this.type="PolyhedronGeometry",this.parameters={vertices:a,indices:b,radius:c,detail:d},this.fromBufferGeometry(new sb(a,b,c,d)),this.mergeVertices()}function Cb(a,b,d,e,f){function g(c){var f=a.getPointAt(c/b),g=h.normals[c];for(c=h.binormals[c],k=0;k<=e;k++){var i=k/e*Math.PI*2,j=Math.sin(i),i=-Math.cos(i);m.x=i*g.x+j*c.x,m.y=i*g.y+j*c.y,m.z=i*g.z+j*c.z,m.normalize(),p.push(m.x,m.y,m.z),l.x=f.x+d*m.x,l.y=f.y+d*m.y,l.z=f.z+d*m.z,o.push(l.x,l.y,l.z)}}pa.call(this),this.type="TubeBufferGeometry",this.parameters={path:a,tubularSegments:b,radius:d,radialSegments:e,closed:f},b=b||64,d=d||1,e=e||8,f=f||!1;var h=a.computeFrenetFrames(b,f);this.tangents=h.tangents,this.normals=h.normals,this.binormals=h.binormals;var j,k,l=new i,m=new i,n=new c,o=[],p=[],q=[],r=[];for(j=0;j<b;j++)g(j);for(g(!1===f?b:0),j=0;j<=b;j++)for(k=0;k<=e;k++)n.x=j/b,n.y=k/e,q.push(n.x,n.y);!function(){for(k=1;k<=b;k++)for(j=1;j<=e;j++){var a=(e+1)*k+(j-1),c=(e+1)*k+j,d=(e+1)*(k-1)+j;r.push((e+1)*(k-1)+(j-1),a,d),r.push(a,c,d)}}(),this.setIndex((65535<r.length?la:ka)(r,1)),this.addAttribute("position",ma(o,3)),this.addAttribute("normal",ma(p,3)),this.addAttribute("uv",ma(q,2))}function Db(a,b,c,d,e,f){na.call(this),this.type="TubeGeometry",this.parameters={path:a,tubularSegments:b,radius:c,radialSegments:d,closed:e},void 0!==f&&console.warn("THREE.TubeGeometry: taper has been removed."),a=new Cb(a,b,c,d,e),this.tangents=a.tangents,this.normals=a.normals,this.binormals=a.binormals,this.fromBufferGeometry(a),this.mergeVertices()}function Eb(a,b,d,e,f,g){function h(a,b,c,d,e){var f=Math.sin(a);b=c/b*a,c=Math.cos(b),e.x=d*(2+c)*.5*Math.cos(a),e.y=d*(2+c)*f*.5,e.z=d*Math.sin(b)*.5}pa.call(this),this.type="TorusKnotBufferGeometry",this.parameters={radius:a,tube:b,tubularSegments:d,radialSegments:e,p:f,q:g},a=a||100,b=b||40,d=Math.floor(d)||64,e=Math.floor(e)||8,f=f||2,g=g||3;var j,k,l=(e+1)*(d+1),m=e*d*6,m=new ja(new(65535<m?Uint32Array:Uint16Array)(m),1),n=new ja(new Float32Array(3*l),3),o=new ja(new Float32Array(3*l),3),l=new ja(new Float32Array(2*l),2),p=0,q=0,r=new i,s=new i,t=new c,u=new i,v=new i,w=new i,x=new i,y=new i;for(j=0;j<=d;++j)for(k=j/d*f*Math.PI*2,h(k,f,g,a,u),h(k+.01,f,g,a,v),x.subVectors(v,u),y.addVectors(v,u),w.crossVectors(x,y),y.crossVectors(w,x),w.normalize(),y.normalize(),k=0;k<=e;++k){var z=k/e*Math.PI*2,A=-b*Math.cos(z),z=b*Math.sin(z);r.x=u.x+(A*y.x+z*w.x),r.y=u.y+(A*y.y+z*w.y),r.z=u.z+(A*y.z+z*w.z),n.setXYZ(p,r.x,r.y,r.z),s.subVectors(r,u).normalize(),o.setXYZ(p,s.x,s.y,s.z),t.x=j/d,t.y=k/e,l.setXY(p,t.x,t.y),p++}for(k=1;k<=d;k++)for(j=1;j<=e;j++)a=(e+1)*k+(j-1),b=(e+1)*k+j,f=(e+1)*(k-1)+j,m.setX(q,(e+1)*(k-1)+(j-1)),q++,m.setX(q,a),q++,m.setX(q,f),q++,m.setX(q,a),q++,m.setX(q,b),q++,m.setX(q,f),q++;this.setIndex(m),this.addAttribute("position",n),this.addAttribute("normal",o),this.addAttribute("uv",l)}function Fb(a,b,c,d,e,f,g){na.call(this),this.type="TorusKnotGeometry",this.parameters={radius:a,tube:b,tubularSegments:c,radialSegments:d,p:e,q:f},void 0!==g&&console.warn("THREE.TorusKnotGeometry: heightScale has been deprecated. Use .scale( x, y, z ) instead."),this.fromBufferGeometry(new Eb(a,b,c,d,e,f)),this.mergeVertices()}function Gb(a,b,c,d,e){pa.call(this),this.type="TorusBufferGeometry",this.parameters={radius:a,tube:b,radialSegments:c,tubularSegments:d,arc:e},a=a||100,b=b||40,c=Math.floor(c)||8,d=Math.floor(d)||6,e=e||2*Math.PI;var f,g,h=(c+1)*(d+1),j=c*d*6,j=new(65535<j?Uint32Array:Uint16Array)(j),k=new Float32Array(3*h),l=new Float32Array(3*h),h=new Float32Array(2*h),m=0,n=0,o=0,p=new i,q=new i,r=new i;for(f=0;f<=c;f++)for(g=0;g<=d;g++){var s=g/d*e,t=f/c*Math.PI*2;q.x=(a+b*Math.cos(t))*Math.cos(s),q.y=(a+b*Math.cos(t))*Math.sin(s),q.z=b*Math.sin(t),k[m]=q.x,k[m+1]=q.y,k[m+2]=q.z,p.x=a*Math.cos(s),p.y=a*Math.sin(s),r.subVectors(q,p).normalize(),l[m]=r.x,l[m+1]=r.y,l[m+2]=r.z,h[n]=g/d,h[n+1]=f/c,m+=3,n+=2}for(f=1;f<=c;f++)for(g=1;g<=d;g++)a=(d+1)*(f-1)+g-1,b=(d+1)*(f-1)+g,e=(d+1)*f+g,j[o]=(d+1)*f+g-1,j[o+1]=a,j[o+2]=e,j[o+3]=a,j[o+4]=b,j[o+5]=e,o+=6;this.setIndex(new ja(j,1)),this.addAttribute("position",new ja(k,3)),this.addAttribute("normal",new ja(l,3)),this.addAttribute("uv",new ja(h,2))}function Hb(a,b,c,d,e){na.call(this),this.type="TorusGeometry",this.parameters={radius:a,tube:b,radialSegments:c,tubularSegments:d,arc:e},this.fromBufferGeometry(new Gb(a,b,c,d,e))}function Ib(a,b){void 0!==a&&(na.call(this),this.type="ExtrudeGeometry",a=Array.isArray(a)?a:[a],this.addShapeList(a,b),this.computeFaceNormals())}function Jb(a,b){b=b||{};var c=b.font;if(!1===(c&&c.isFont))return console.error("THREE.TextGeometry: font parameter is not an instance of THREE.Font."),new na;c=c.generateShapes(a,b.size,b.curveSegments),b.amount=void 0!==b.height?b.height:50,void 0===b.bevelThickness&&(b.bevelThickness=10),void 0===b.bevelSize&&(b.bevelSize=8),void 0===b.bevelEnabled&&(b.bevelEnabled=!1),Ib.call(this,c,b),this.type="TextGeometry"}function Kb(a,b,c,d,e,f,g){pa.call(this),this.type="SphereBufferGeometry",this.parameters={radius:a,widthSegments:b,heightSegments:c,phiStart:d,phiLength:e,thetaStart:f,thetaLength:g},a=a||50,b=Math.max(3,Math.floor(b)||8),c=Math.max(2,Math.floor(c)||6),d=void 0!==d?d:0,e=void 0!==e?e:2*Math.PI,f=void 0!==f?f:0,g=void 0!==g?g:Math.PI;for(var h=f+g,j=(b+1)*(c+1),k=new ja(new Float32Array(3*j),3),l=new ja(new Float32Array(3*j),3),j=new ja(new Float32Array(2*j),2),m=0,n=[],o=new i,p=0;p<=c;p++){for(var q=[],r=p/c,s=0;s<=b;s++){var t=s/b,u=-a*Math.cos(d+t*e)*Math.sin(f+r*g),v=a*Math.cos(f+r*g),w=a*Math.sin(d+t*e)*Math.sin(f+r*g);o.set(u,v,w).normalize(),k.setXYZ(m,u,v,w),l.setXYZ(m,o.x,o.y,o.z),j.setXY(m,t,1-r),q.push(m),m++}n.push(q)}for(d=[],p=0;p<c;p++)for(s=0;s<b;s++)e=n[p][s+1],g=n[p][s],m=n[p+1][s],o=n[p+1][s+1],(0!==p||0<f)&&d.push(e,g,o),(p!==c-1||h<Math.PI)&&d.push(g,m,o);this.setIndex(new(65535<k.count?la:ka)(d,1)),this.addAttribute("position",k),this.addAttribute("normal",l),this.addAttribute("uv",j),this.boundingSphere=new Y(new i,a)}function Lb(a,b,c,d,e,f,g){na.call(this),this.type="SphereGeometry",this.parameters={radius:a,widthSegments:b,heightSegments:c,phiStart:d,phiLength:e,thetaStart:f,thetaLength:g},this.fromBufferGeometry(new Kb(a,b,c,d,e,f,g))}function Mb(a,b,d,e,f,g){pa.call(this),this.type="RingBufferGeometry",this.parameters={innerRadius:a,outerRadius:b,thetaSegments:d,phiSegments:e,thetaStart:f,thetaLength:g},a=a||20,b=b||50,f=void 0!==f?f:0,g=void 0!==g?g:2*Math.PI,d=void 0!==d?Math.max(3,d):8,e=void 0!==e?Math.max(1,e):1;var h,j,k=(d+1)*(e+1),l=d*e*6,l=new ja(new(65535<l?Uint32Array:Uint16Array)(l),1),m=new ja(new Float32Array(3*k),3),n=new ja(new Float32Array(3*k),3),k=new ja(new Float32Array(2*k),2),o=0,p=0,q=a,r=(b-a)/e,s=new i,t=new c;for(a=0;a<=e;a++){for(j=0;j<=d;j++)h=f+j/d*g,s.x=q*Math.cos(h),s.y=q*Math.sin(h),m.setXYZ(o,s.x,s.y,s.z),n.setXYZ(o,0,0,1),t.x=(s.x/b+1)/2,t.y=(s.y/b+1)/2,k.setXY(o,t.x,t.y),o++;q+=r}for(a=0;a<e;a++)for(b=a*(d+1),j=0;j<d;j++)f=h=j+b,g=h+d+1,o=h+d+2,h+=1,l.setX(p,f),p++,l.setX(p,g),p++,l.setX(p,o),p++,l.setX(p,f),p++,l.setX(p,o),p++,l.setX(p,h),p++;this.setIndex(l),this.addAttribute("position",m),this.addAttribute("normal",n),this.addAttribute("uv",k)}function Nb(a,b,c,d,e,f){na.call(this),this.type="RingGeometry",this.parameters={innerRadius:a,outerRadius:b,thetaSegments:c,phiSegments:d,thetaStart:e,thetaLength:f},this.fromBufferGeometry(new Mb(a,b,c,d,e,f))}function Ob(a,b,c,d){na.call(this),this.type="PlaneGeometry",this.parameters={width:a,height:b,widthSegments:c,heightSegments:d},this.fromBufferGeometry(new sa(a,b,c,d))}function Pb(a,b,d,e){pa.call(this),this.type="LatheBufferGeometry",this.parameters={points:a,segments:b,phiStart:d,phiLength:e},b=Math.floor(b)||12,d=d||0,e=e||2*Math.PI,e=Td.clamp(e,0,2*Math.PI);for(var f=(b+1)*a.length,g=b*a.length*6,h=new ja(new(65535<g?Uint32Array:Uint16Array)(g),1),j=new ja(new Float32Array(3*f),3),k=new ja(new Float32Array(2*f),2),l=0,m=0,n=1/b,o=new i,p=new c,f=0;f<=b;f++)for(var g=d+f*n*e,q=Math.sin(g),r=Math.cos(g),g=0;g<=a.length-1;g++)o.x=a[g].x*q,o.y=a[g].y,o.z=a[g].x*r,j.setXYZ(l,o.x,o.y,o.z),p.x=f/b,p.y=g/(a.length-1),k.setXY(l,p.x,p.y),l++;for(f=0;f<b;f++)for(g=0;g<a.length-1;g++)d=g+f*a.length,l=d+a.length,n=d+a.length+1,o=d+1,h.setX(m,d),m++,h.setX(m,l),m++,h.setX(m,o),m++,h.setX(m,l),m++,h.setX(m,n),m++,h.setX(m,o),m++;if(this.setIndex(h),this.addAttribute("position",j),this.addAttribute("uv",k),this.computeVertexNormals(),e===2*Math.PI)for(e=this.attributes.normal.array,h=new i,j=new i,k=new i,d=b*a.length*3,g=f=0;f<a.length;f++,g+=3)h.x=e[g+0],h.y=e[g+1],h.z=e[g+2],j.x=e[d+g+0],j.y=e[d+g+1],j.z=e[d+g+2],k.addVectors(h,j).normalize(),e[g+0]=e[d+g+0]=k.x,e[g+1]=e[d+g+1]=k.y,e[g+2]=e[d+g+2]=k.z}function Qb(a,b,c,d){na.call(this),this.type="LatheGeometry",this.parameters={points:a,segments:b,phiStart:c,phiLength:d},this.fromBufferGeometry(new Pb(a,b,c,d)),this.mergeVertices()}function Rb(a,b){na.call(this),this.type="ShapeGeometry",!1===Array.isArray(a)&&(a=[a]),this.addShapeList(a,b),this.computeFaceNormals()}function Sb(a,b){function c(a,b){return a-b}pa.call(this);var d,e=Math.cos(Td.DEG2RAD*(void 0!==b?b:1)),f=[0,0],g={},h=["a","b","c"];a&&a.isBufferGeometry?(d=new na,d.fromBufferGeometry(a)):d=a.clone(),d.mergeVertices(),d.computeFaceNormals();var i=d.vertices;d=d.faces;for(var j=0,k=d.length;j<k;j++)for(var l=d[j],m=0;3>m;m++){f[0]=l[h[m]],f[1]=l[h[(m+1)%3]],f.sort(c);var n=f.toString();void 0===g[n]?g[n]={vert1:f[0],vert2:f[1],face1:j,face2:void 0}:g[n].face2=j}f=[];for(n in g)h=g[n],(void 0===h.face2||d[h.face1].normal.dot(d[h.face2].normal)<=e)&&(j=i[h.vert1],f.push(j.x),f.push(j.y),f.push(j.z),j=i[h.vert2],f.push(j.x),f.push(j.y),f.push(j.z));this.addAttribute("position",new ja(new Float32Array(f),3))}function Tb(a,b,d,e,f,g,h,j){function k(d){var f,g,k,m=new c,n=new i,o=0,v=!0===d?a:b,y=!0===d?1:-1;for(g=t,f=1;f<=e;f++)q.setXYZ(t,0,w*y,0),r.setXYZ(t,0,y,0),m.x=.5,m.y=.5,s.setXY(t,m.x,m.y),t++;for(k=t,f=0;f<=e;f++){var z=f/e*j+h,A=Math.cos(z),z=Math.sin(z);n.x=v*z,n.y=w*y,n.z=v*A,q.setXYZ(t,n.x,n.y,n.z),r.setXYZ(t,0,y,0),m.x=.5*A+.5,m.y=.5*z*y+.5,s.setXY(t,m.x,m.y),t++}for(f=0;f<e;f++)m=g+f,n=k+f,!0===d?(p.setX(u,n),u++,p.setX(u,n+1)):(p.setX(u,n+1),u++,p.setX(u,n)),u++,p.setX(u,m),u++,o+=3;l.addGroup(x,o,!0===d?1:2),x+=o}pa.call(this),this.type="CylinderBufferGeometry",this.parameters={radiusTop:a,radiusBottom:b,height:d,radialSegments:e,heightSegments:f,openEnded:g,thetaStart:h,thetaLength:j};var l=this;a=void 0!==a?a:20,b=void 0!==b?b:20,d=void 0!==d?d:100,e=Math.floor(e)||8,f=Math.floor(f)||1,g=void 0!==g&&g,h=void 0!==h?h:0,j=void 0!==j?j:2*Math.PI;var m=0;!1===g&&(0<a&&m++,0<b&&m++);var n=function(){var a=(e+1)*(f+1);return!1===g&&(a+=(e+1)*m+e*m),a}(),o=function(){var a=e*f*6;return!1===g&&(a+=e*m*3),a}(),p=new ja(new(65535<o?Uint32Array:Uint16Array)(o),1),q=new ja(new Float32Array(3*n),3),r=new ja(new Float32Array(3*n),3),s=new ja(new Float32Array(2*n),2),t=0,u=0,v=[],w=d/2,x=0;!function(){var c,g,k=new i,m=new i,n=0,o=(b-a)/d;for(g=0;g<=f;g++){var y=[],z=g/f,A=z*(b-a)+a;for(c=0;c<=e;c++){var B=c/e,C=B*j+h,D=Math.sin(C),C=Math.cos(C);m.x=A*D,m.y=-z*d+w,m.z=A*C,q.setXYZ(t,m.x,m.y,m.z),k.set(D,o,C).normalize(),r.setXYZ(t,k.x,k.y,k.z),s.setXY(t,B,1-z),y.push(t),t++}v.push(y)}for(c=0;c<e;c++)for(g=0;g<f;g++)k=v[g+1][c],m=v[g+1][c+1],o=v[g][c+1],p.setX(u,v[g][c]),u++,p.setX(u,k),u++,p.setX(u,o),u++,p.setX(u,k),u++,p.setX(u,m),u++,p.setX(u,o),u++,n+=6;l.addGroup(x,n,0),x+=n}(),!1===g&&(0<a&&k(!0),0<b&&k(!1)),this.setIndex(p),this.addAttribute("position",q),this.addAttribute("normal",r),this.addAttribute("uv",s)}function Ub(a,b,c,d,e,f,g,h){na.call(this),this.type="CylinderGeometry",this.parameters={radiusTop:a,radiusBottom:b,height:c,radialSegments:d,heightSegments:e,openEnded:f,thetaStart:g,thetaLength:h},this.fromBufferGeometry(new Tb(a,b,c,d,e,f,g,h)),this.mergeVertices()}function Vb(a,b,c,d,e,f,g){Ub.call(this,0,a,b,c,d,e,f,g),this.type="ConeGeometry",this.parameters={radius:a,height:b,radialSegments:c,heightSegments:d,openEnded:e,thetaStart:f,thetaLength:g}}function Wb(a,b,c,d,e,f,g){Tb.call(this,0,a,b,c,d,e,f,g),this.type="ConeBufferGeometry",this.parameters={radius:a,height:b,radialSegments:c,heightSegments:d,openEnded:e,thetaStart:f,thetaLength:g}}function Xb(a,b,c,d){pa.call(this),this.type="CircleBufferGeometry",this.parameters={radius:a,segments:b,thetaStart:c,thetaLength:d},a=a||50,b=void 0!==b?Math.max(3,b):8,c=void 0!==c?c:0,d=void 0!==d?d:2*Math.PI;var e=b+2,f=new Float32Array(3*e),g=new Float32Array(3*e),e=new Float32Array(2*e);g[2]=1,e[0]=.5,e[1]=.5;for(var h=0,j=3,k=2;h<=b;h++,j+=3,k+=2){var l=c+h/b*d;f[j]=a*Math.cos(l),f[j+1]=a*Math.sin(l),g[j+2]=1,e[k]=(f[j]/a+1)/2,e[k+1]=(f[j+1]/a+1)/2}for(c=[],j=1;j<=b;j++)c.push(j,j+1,0);this.setIndex(new ja(new Uint16Array(c),1)),this.addAttribute("position",new ja(f,3)),this.addAttribute("normal",new ja(g,3)),this.addAttribute("uv",new ja(e,2)),this.boundingSphere=new Y(new i,a)}function Yb(a,b,c,d){na.call(this),this.type="CircleGeometry",this.parameters={radius:a,segments:b,thetaStart:c,thetaLength:d},this.fromBufferGeometry(new Xb(a,b,c,d))}function Zb(a,b,c,d,e,f){na.call(this),this.type="BoxGeometry",this.parameters={width:a,height:b,depth:c,widthSegments:d,heightSegments:e,depthSegments:f},this.fromBufferGeometry(new ra(a,b,c,d,e,f)),this.mergeVertices()}function $b(){V.call(this,{uniforms:$d.merge([be.lights,{opacity:{value:1}}]),vertexShader:_d.shadow_vert,fragmentShader:_d.shadow_frag}),this.transparent=this.lights=!0,Object.defineProperties(this,{opacity:{enumerable:!0,get:function(){return this.uniforms.opacity.value},set:function(a){this.uniforms.opacity.value=a}}})}function _b(a){V.call(this,a),this.type="RawShaderMaterial"}function ac(a){this.uuid=Td.generateUUID(),this.type="MultiMaterial",this.materials=a instanceof Array?a:[],this.visible=!0}function bc(a){U.call(this),this.defines={STANDARD:""},this.type="MeshStandardMaterial",this.color=new Q(16777215),this.metalness=this.roughness=.5,this.lightMap=this.map=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Q(0),this.emissiveIntensity=1,this.bumpMap=this.emissiveMap=null,this.bumpScale=1,this.normalMap=null,this.normalScale=new c(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.envMap=this.alphaMap=this.metalnessMap=this.roughnessMap=null,this.envMapIntensity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinejoin=this.wireframeLinecap="round",this.morphNormals=this.morphTargets=this.skinning=!1,this.setValues(a)}function cc(a){bc.call(this),this.defines={PHYSICAL:""},this.type="MeshPhysicalMaterial",this.reflectivity=.5,this.clearCoatRoughness=this.clearCoat=0,this.setValues(a)}function dc(a){U.call(this),this.type="MeshPhongMaterial",this.color=new Q(16777215),this.specular=new Q(1118481),this.shininess=30,this.lightMap=this.map=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Q(0),this.emissiveIntensity=1,this.bumpMap=this.emissiveMap=null,this.bumpScale=1,this.normalMap=null,this.normalScale=new c(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.envMap=this.alphaMap=this.specularMap=null,this.combine=0,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinejoin=this.wireframeLinecap="round",this.morphNormals=this.morphTargets=this.skinning=!1,this.setValues(a)}function ec(a){U.call(this,a),this.type="MeshNormalMaterial",this.wireframe=!1,this.wireframeLinewidth=1,this.morphTargets=this.lights=this.fog=!1,this.setValues(a)}function fc(a){U.call(this),this.type="MeshLambertMaterial",this.color=new Q(16777215),this.lightMap=this.map=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Q(0),this.emissiveIntensity=1,this.envMap=this.alphaMap=this.specularMap=this.emissiveMap=null,this.combine=0,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinejoin=this.wireframeLinecap="round",this.morphNormals=this.morphTargets=this.skinning=!1,this.setValues(a)}function gc(a){U.call(this),this.type="LineDashedMaterial",this.color=new Q(16777215),this.scale=this.linewidth=1,this.dashSize=3,this.gapSize=1,this.lights=!1,this.setValues(a)}function hc(a,b,c){var d=this,e=!1,f=0,g=0;this.onStart=void 0,this.onLoad=a,this.onProgress=b,this.onError=c,this.itemStart=function(a){g++,!1===e&&void 0!==d.onStart&&d.onStart(a,f,g),e=!0},this.itemEnd=function(a){f++,void 0!==d.onProgress&&d.onProgress(a,f,g),f===g&&(e=!1,void 0!==d.onLoad)&&d.onLoad()},this.itemError=function(a){void 0!==d.onError&&d.onError(a)}}function ic(a){this.manager=void 0!==a?a:le}function jc(a){this.manager=void 0!==a?a:le,this._parser=null}function kc(a){this.manager=void 0!==a?a:le,this._parser=null}function lc(a){this.manager=void 0!==a?a:le}function mc(a){this.manager=void 0!==a?a:le}function nc(a){this.manager=void 0!==a?a:le}function oc(a,b){ea.call(this),this.type="Light",this.color=new Q(a),this.intensity=void 0!==b?b:1,this.receiveShadow=void 0}function pc(a,b,c){oc.call(this,a,c),this.type="HemisphereLight",this.castShadow=void 0,this.position.copy(ea.DefaultUp),this.updateMatrix(),this.groundColor=new Q(b)}function qc(a){this.camera=a,this.bias=0,this.radius=1,this.mapSize=new c(512,512),this.map=null,this.matrix=new j}function rc(){qc.call(this,new ua(50,1,.5,500))}function sc(a,b,c,d,e,f){oc.call(this,a,b),this.type="SpotLight",this.position.copy(ea.DefaultUp),this.updateMatrix(),this.target=new ea,Object.defineProperty(this,"power",{get:function(){return this.intensity*Math.PI},set:function(a){this.intensity=a/Math.PI}}),this.distance=void 0!==c?c:0,this.angle=void 0!==d?d:Math.PI/3,this.penumbra=void 0!==e?e:0,this.decay=void 0!==f?f:1,this.shadow=new rc}function tc(a,b,c,d){oc.call(this,a,b),this.type="PointLight",Object.defineProperty(this,"power",{get:function(){return 4*this.intensity*Math.PI},set:function(a){this.intensity=a/(4*Math.PI)}}),this.distance=void 0!==c?c:0,this.decay=void 0!==d?d:1,this.shadow=new qc(new ua(90,1,.5,500))}function uc(a){qc.call(this,new va(-5,5,5,-5,.5,500))}function vc(a,b){oc.call(this,a,b),this.type="DirectionalLight",this.position.copy(ea.DefaultUp),this.updateMatrix(),this.target=new ea,this.shadow=new uc}function wc(a,b){oc.call(this,a,b),this.type="AmbientLight",this.castShadow=void 0}function xc(a,b,c,d){this.parameterPositions=a,this._cachedIndex=0,this.resultBuffer=void 0!==d?d:new b.constructor(c),this.sampleValues=b,this.valueSize=c}function yc(a,b,c,d){xc.call(this,a,b,c,d),this._offsetNext=this._weightNext=this._offsetPrev=this._weightPrev=-0}function zc(a,b,c,d){xc.call(this,a,b,c,d)}function Ac(a,b,c,d){xc.call(this,a,b,c,d)}function Bc(a,b,c,d){if(void 0===a)throw Error("track name is undefined");if(void 0===b||0===b.length)throw Error("no keyframes in track named "+a);this.name=a,this.times=me.convertArray(b,this.TimeBufferType),this.values=me.convertArray(c,this.ValueBufferType),this.setInterpolation(d||this.DefaultInterpolation),this.validate(),this.optimize()}function Cc(a,b,c,d){Bc.call(this,a,b,c,d)}function Dc(a,b,c,d){xc.call(this,a,b,c,d)}function Ec(a,b,c,d){Bc.call(this,a,b,c,d)}function Fc(a,b,c,d){Bc.call(this,a,b,c,d)}function Gc(a,b,c,d){Bc.call(this,a,b,c,d)}function Hc(a,b,c){Bc.call(this,a,b,c)}function Ic(a,b,c,d){Bc.call(this,a,b,c,d)}function Jc(a,b,c,d){Bc.apply(this,arguments)}function Kc(a,b,c){this.name=a,this.tracks=c,this.duration=void 0!==b?b:-1,this.uuid=Td.generateUUID(),0>this.duration&&this.resetDuration(),this.optimize()}function Lc(a){this.manager=void 0!==a?a:le,this.textures={}}function Mc(a){this.manager=void 0!==a?a:le}function Nc(){this.onLoadStart=function(){},this.onLoadProgress=function(){},this.onLoadComplete=function(){}}function Oc(a){"boolean"==typeof a&&(console.warn("THREE.JSONLoader: showStatus parameter has been removed from constructor."),a=void 0),this.manager=void 0!==a?a:le,this.withCredentials=!1}function Pc(a){this.manager=void 0!==a?a:le,this.texturePath=""}function Qc(){}function Rc(a,b){this.v1=a,this.v2=b}function Sc(){this.curves=[],this.autoClose=!1}function Tc(a,b,c,d,e,f,g,h){this.aX=a,this.aY=b,this.xRadius=c,this.yRadius=d,this.aStartAngle=e,this.aEndAngle=f,this.aClockwise=g,this.aRotation=h||0}function Uc(a){this.points=void 0===a?[]:a}function Vc(a,b,c,d){this.v0=a,this.v1=b,this.v2=c,this.v3=d}function Wc(a,b,c){this.v0=a,this.v1=b,this.v2=c}function Xc(){Yc.apply(this,arguments),this.holes=[]}function Yc(a){Sc.call(this),this.currentPoint=new c,a&&this.fromPoints(a)}function Zc(){this.subPaths=[],this.currentPath=null}function $c(a){this.data=a}function _c(a){this.manager=void 0!==a?a:le}function ad(){return void 0===qe&&(qe=new(window.AudioContext||window.webkitAudioContext)),qe}function bd(a){this.manager=void 0!==a?a:le}function cd(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new ua,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new ua,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1}function dd(a,b,c){ea.call(this),this.type="CubeCamera";var d=new ua(90,1,a,b);d.up.set(0,-1,0),d.lookAt(new i(1,0,0)),this.add(d);var e=new ua(90,1,a,b);e.up.set(0,-1,0),e.lookAt(new i(-1,0,0)),this.add(e);var f=new ua(90,1,a,b);f.up.set(0,0,1),f.lookAt(new i(0,1,0)),this.add(f);var h=new ua(90,1,a,b);h.up.set(0,0,-1),h.lookAt(new i(0,-1,0)),this.add(h);var j=new ua(90,1,a,b);j.up.set(0,-1,0),j.lookAt(new i(0,0,1)),this.add(j);var k=new ua(90,1,a,b);k.up.set(0,-1,0),k.lookAt(new i(0,0,-1)),this.add(k),this.renderTarget=new g(c,c,{format:1022,magFilter:1006,minFilter:1006}),this.updateCubeMap=function(a,b){null===this.parent&&this.updateMatrixWorld();var c=this.renderTarget,g=c.texture.generateMipmaps;c.texture.generateMipmaps=!1,c.activeCubeFace=0,a.render(b,d,c),c.activeCubeFace=1,a.render(b,e,c),c.activeCubeFace=2,a.render(b,f,c),c.activeCubeFace=3,a.render(b,h,c),c.activeCubeFace=4,a.render(b,j,c),c.texture.generateMipmaps=g,c.activeCubeFace=5,a.render(b,k,c),a.setRenderTarget(null)}}function ed(){ea.call(this),this.type="AudioListener",this.context=ad(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null}function fd(a){ea.call(this),this.type="Audio",this.context=a.context,this.source=this.context.createBufferSource(),this.source.onended=this.onEnded.bind(this),this.gain=this.context.createGain(),this.gain.connect(a.getInput()),this.autoplay=!1,this.startTime=0,this.playbackRate=1,this.isPlaying=!1,this.hasPlaybackControl=!0,this.sourceType="empty",this.filters=[]}function gd(a){fd.call(this,a),this.panner=this.context.createPanner(),this.panner.connect(this.gain)}function hd(a,b){this.analyser=a.context.createAnalyser(),this.analyser.fftSize=void 0!==b?b:2048,this.data=new Uint8Array(this.analyser.frequencyBinCount),a.getOutput().connect(this.analyser)}function id(a,b,c){switch(this.binding=a,this.valueSize=c,a=Float64Array,b){case"quaternion":b=this._slerp;break;case"string":case"bool":a=Array,b=this._select;break;default:b=this._lerp}this.buffer=new a(4*c),this._mixBufferRegion=b,this.referenceCount=this.useCount=this.cumulativeWeight=0}function jd(a,b,c){this.path=b,this.parsedPath=c||jd.parseTrackName(b),this.node=jd.findNode(a,this.parsedPath.nodeName)||a,this.rootNode=a}function kd(a){this.uuid=Td.generateUUID(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;var b={};this._indicesByUUID=b;for(var c=0,d=arguments.length;c!==d;++c)b[arguments[c].uuid]=c;this._paths=[],this._parsedPaths=[],this._bindings=[],this._bindingsIndicesByPath={};var e=this;this.stats={objects:{get total(){return e._objects.length},get inUse(){return this.total-e.nCachedObjects_}},get bindingsPerObject(){return e._bindings.length}}}function ld(a,b,c){this._mixer=a,this._clip=b,this._localRoot=c||null,a=b.tracks,b=a.length,c=Array(b);for(var d={endingStart:2400,endingEnd:2400},e=0;e!==b;++e){var f=a[e].createInterpolant(null);c[e]=f,f.settings=d}this._interpolantSettings=d,this._interpolants=c,this._propertyBindings=Array(b),this._weightInterpolant=this._timeScaleInterpolant=this._byClipCacheIndex=this._cacheIndex=null,this.loop=2201,this._loopCount=-1,this._startTime=null,this.time=0,this._effectiveWeight=this.weight=this._effectiveTimeScale=this.timeScale=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtEnd=this.zeroSlopeAtStart=!0}function md(a){this._root=a,this._initMemoryManager(),this.time=this._accuIndex=0,this.timeScale=1}function nd(a,b){"string"==typeof a&&(console.warn("THREE.Uniform: Type parameter is no longer needed."),a=b),this.value=a}function od(){pa.call(this), this.type="InstancedBufferGeometry",this.maxInstancedCount=void 0}function pd(a,b,c,d){this.uuid=Td.generateUUID(),this.data=a,this.itemSize=b,this.offset=c,this.normalized=!0===d}function qd(a,b){this.uuid=Td.generateUUID(),this.array=a,this.stride=b,this.count=void 0!==a?a.length/b:0,this.dynamic=!1,this.updateRange={offset:0,count:-1},this.version=0}function rd(a,b,c){qd.call(this,a,b),this.meshPerAttribute=c||1}function sd(a,b,c){ja.call(this,a,b),this.meshPerAttribute=c||1}function td(a,b,c,d){this.ray=new ba(a,b),this.near=c||0,this.far=d||1/0,this.params={Mesh:{},Line:{},LOD:{},Points:{threshold:1},Sprite:{}},Object.defineProperties(this.params,{PointCloud:{get:function(){return console.warn("THREE.Raycaster: params.PointCloud has been renamed to params.Points."),this.Points}}})}function ud(a,b){return a.distance-b.distance}function vd(a,b,c,d){if(!1!==a.visible&&(a.raycast(b,c),!0===d)){a=a.children,d=0;for(var e=a.length;d<e;d++)vd(a[d],b,c,!0)}}function wd(a){this.autoStart=void 0===a||a,this.elapsedTime=this.oldTime=this.startTime=0,this.running=!1}function xd(a,b,c){return this.radius=void 0!==a?a:1,this.phi=void 0!==b?b:0,this.theta=void 0!==c?c:0,this}function yd(a,b){qa.call(this,a,b),this.animationsMap={},this.animationsList=[];var c=this.geometry.morphTargets.length;this.createAnimation("__default",0,c-1,c/1),this.setAnimationWeight("__default",1)}function zd(a){ea.call(this),this.material=a,this.render=function(a){}}function Ad(a,b,c,d){this.object=a,this.size=void 0!==b?b:1,a=void 0!==c?c:16711680,d=void 0!==d?d:1,b=0,(c=this.object.geometry)&&c.isGeometry?b=3*c.faces.length:c&&c.isBufferGeometry&&(b=c.attributes.normal.count),c=new pa,b=new ma(6*b,3),c.addAttribute("position",b),hb.call(this,c,new fb({color:a,linewidth:d})),this.matrixAutoUpdate=!1,this.update()}function Bd(a){ea.call(this),this.light=a,this.light.updateMatrixWorld(),this.matrix=a.matrixWorld,this.matrixAutoUpdate=!1,a=new pa;for(var b=[0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,-1,0,1,0,0,0,0,1,1,0,0,0,0,-1,1],c=0,d=1;32>c;c++,d++){var e=c/32*Math.PI*2,f=d/32*Math.PI*2;b.push(Math.cos(e),Math.sin(e),1,Math.cos(f),Math.sin(f),1)}a.addAttribute("position",new ma(b,3)),b=new fb({fog:!1}),this.cone=new hb(a,b),this.add(this.cone),this.update()}function Cd(a){this.bones=this.getBoneList(a);for(var b=new na,c=0;c<this.bones.length;c++){var d=this.bones[c];d.parent&&d.parent.isBone&&(b.vertices.push(new i),b.vertices.push(new i),b.colors.push(new Q(0,0,1)),b.colors.push(new Q(0,1,0)))}b.dynamic=!0,c=new fb({vertexColors:2,depthTest:!1,depthWrite:!1,transparent:!0}),hb.call(this,b,c),this.root=a,this.matrix=a.matrixWorld,this.matrixAutoUpdate=!1,this.update()}function Dd(a,b){this.light=a,this.light.updateMatrixWorld();var c=new Kb(b,4,2),d=new ia({wireframe:!0,fog:!1});d.color.copy(this.light.color).multiplyScalar(this.light.intensity),qa.call(this,c,d),this.matrix=this.light.matrixWorld,this.matrixAutoUpdate=!1}function Ed(a,b){ea.call(this),this.light=a,this.light.updateMatrixWorld(),this.matrix=a.matrixWorld,this.matrixAutoUpdate=!1,this.colors=[new Q,new Q];var c=new Lb(b,4,2);c.rotateX(-Math.PI/2);for(var d=0;8>d;d++)c.faces[d].color=this.colors[4>d?0:1];d=new ia({vertexColors:1,wireframe:!0}),this.lightSphere=new qa(c,d),this.add(this.lightSphere),this.update()}function Fd(a,b,c,d){b=b||1,c=new Q(void 0!==c?c:4473924),d=new Q(void 0!==d?d:8947848);for(var e=b/2,f=2*a/b,g=[],h=[],i=0,j=0,k=-a;i<=b;i++,k+=f){g.push(-a,0,k,a,0,k),g.push(k,0,-a,k,0,a);var l=i===e?c:d;l.toArray(h,j),j+=3,l.toArray(h,j),j+=3,l.toArray(h,j),j+=3,l.toArray(h,j),j+=3}a=new pa,a.addAttribute("position",new ma(g,3)),a.addAttribute("color",new ma(h,3)),g=new fb({vertexColors:2}),hb.call(this,a,g)}function Gd(a,b,c,d){this.object=a,this.size=void 0!==b?b:1,a=void 0!==c?c:16776960,d=void 0!==d?d:1,b=0,(c=this.object.geometry)&&c.isGeometry?b=c.faces.length:console.warn("THREE.FaceNormalsHelper: only THREE.Geometry is supported. Use THREE.VertexNormalsHelper, instead."),c=new pa,b=new ma(6*b,3),c.addAttribute("position",b),hb.call(this,c,new fb({color:a,linewidth:d})),this.matrixAutoUpdate=!1,this.update()}function Hd(a,b){ea.call(this),this.light=a,this.light.updateMatrixWorld(),this.matrix=a.matrixWorld,this.matrixAutoUpdate=!1,void 0===b&&(b=1);var c=new pa;c.addAttribute("position",new ma([-b,b,0,b,b,0,b,-b,0,-b,-b,0,-b,b,0],3));var d=new fb({fog:!1});this.add(new gb(c,d)),c=new pa,c.addAttribute("position",new ma([0,0,0,0,0,1],3)),this.add(new gb(c,d)),this.update()}function Id(a){function b(a,b,d){c(a,d),c(b,d)}function c(a,b){d.vertices.push(new i),d.colors.push(new Q(b)),void 0===f[a]&&(f[a]=[]),f[a].push(d.vertices.length-1)}var d=new na,e=new fb({color:16777215,vertexColors:1}),f={};b("n1","n2",16755200),b("n2","n4",16755200),b("n4","n3",16755200),b("n3","n1",16755200),b("f1","f2",16755200),b("f2","f4",16755200),b("f4","f3",16755200),b("f3","f1",16755200),b("n1","f1",16755200),b("n2","f2",16755200),b("n3","f3",16755200),b("n4","f4",16755200),b("p","n1",16711680),b("p","n2",16711680),b("p","n3",16711680),b("p","n4",16711680),b("u1","u2",43775),b("u2","u3",43775),b("u3","u1",43775),b("c","t",16777215),b("p","c",3355443),b("cn1","cn2",3355443),b("cn3","cn4",3355443),b("cf1","cf2",3355443),b("cf3","cf4",3355443),hb.call(this,d,e),this.camera=a,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=a.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=f,this.update()}function Jd(a,b){var c=void 0!==b?b:8947848;this.object=a,this.box=new X,qa.call(this,new Zb(1,1,1),new ia({color:c,wireframe:!0}))}function Kd(a,b){void 0===b&&(b=16776960);var c=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),d=new Float32Array(24),e=new pa;e.setIndex(new ja(c,1)),e.addAttribute("position",new ja(d,3)),hb.call(this,e,new fb({color:b})),void 0!==a&&this.update(a)}function Ld(a,b,c,d,e,f){ea.call(this),void 0===d&&(d=16776960),void 0===c&&(c=1),void 0===e&&(e=.2*c),void 0===f&&(f=.2*e),this.position.copy(b),this.line=new gb(re,new fb({color:d})),this.line.matrixAutoUpdate=!1,this.add(this.line),this.cone=new qa(se,new ia({color:d})),this.cone.matrixAutoUpdate=!1,this.add(this.cone),this.setDirection(a),this.setLength(c,e,f)}function Md(a){a=a||1;var b=new Float32Array([0,0,0,a,0,0,0,0,0,0,a,0,0,0,0,0,0,a]),c=new Float32Array([1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1]);a=new pa,a.addAttribute("position",new ja(b,3)),a.addAttribute("color",new ja(c,3)),b=new fb({vertexColors:2}),hb.call(this,a,b)}function Nd(a){console.warn("THREE.ClosedSplineCurve3 has been deprecated. Please use THREE.CatmullRomCurve3."),te.call(this,a),this.type="catmullrom",this.closed=!0}function Od(a,b,c,d,e,f){Tc.call(this,a,b,c,c,d,e,f)}void 0===Number.EPSILON&&(Number.EPSILON=Math.pow(2,-52)),void 0===Math.sign&&(Math.sign=function(a){return 0>a?-1:0<a?1:+a}),void 0===Function.prototype.name&&Object.defineProperty(Function.prototype,"name",{get:function(){return this.toString().match(/^\s*function\s*(\S*)\s*\(/)[1]}}),void 0===Object.assign&&function(){Object.assign=function(a){if(void 0===a||null===a)throw new TypeError("Cannot convert undefined or null to object");for(var b=Object(a),c=1;c<arguments.length;c++){var d=arguments[c];if(void 0!==d&&null!==d)for(var e in d)Object.prototype.hasOwnProperty.call(d,e)&&(b[e]=d[e])}return b}}(),Object.assign(b.prototype,{addEventListener:function(a,b){void 0===this._listeners&&(this._listeners={});var c=this._listeners;void 0===c[a]&&(c[a]=[]),-1===c[a].indexOf(b)&&c[a].push(b)},hasEventListener:function(a,b){if(void 0===this._listeners)return!1;var c=this._listeners;return void 0!==c[a]&&-1!==c[a].indexOf(b)},removeEventListener:function(a,b){if(void 0!==this._listeners){var c=this._listeners[a];if(void 0!==c){var d=c.indexOf(b);-1!==d&&c.splice(d,1)}}},dispatchEvent:function(a){if(void 0!==this._listeners){var b=this._listeners[a.type];if(void 0!==b){a.target=this;var c,d=[],e=b.length;for(c=0;c<e;c++)d[c]=b[c];for(c=0;c<e;c++)d[c].call(this,a)}}}});var Pd={NoBlending:0,NormalBlending:1,AdditiveBlending:2,SubtractiveBlending:3,MultiplyBlending:4,CustomBlending:5},Qd={UVMapping:300,CubeReflectionMapping:301,CubeRefractionMapping:302,EquirectangularReflectionMapping:303,EquirectangularRefractionMapping:304,SphericalReflectionMapping:305,CubeUVReflectionMapping:306,CubeUVRefractionMapping:307},Rd={RepeatWrapping:1e3,ClampToEdgeWrapping:1001,MirroredRepeatWrapping:1002},Sd={NearestFilter:1003,NearestMipMapNearestFilter:1004,NearestMipMapLinearFilter:1005,LinearFilter:1006,LinearMipMapNearestFilter:1007,LinearMipMapLinearFilter:1008},Td={DEG2RAD:Math.PI/180,RAD2DEG:180/Math.PI,generateUUID:function(){var a,b="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""),c=Array(36),d=0;return function(){for(var e=0;36>e;e++)8===e||13===e||18===e||23===e?c[e]="-":14===e?c[e]="4":(2>=d&&(d=33554432+16777216*Math.random()|0),a=15&d,d>>=4,c[e]=b[19===e?3&a|8:a]);return c.join("")}}(),clamp:function(a,b,c){return Math.max(b,Math.min(c,a))},euclideanModulo:function(a,b){return(a%b+b)%b},mapLinear:function(a,b,c,d,e){return d+(a-b)*(e-d)/(c-b)},lerp:function(a,b,c){return(1-c)*a+c*b},smoothstep:function(a,b,c){return a<=b?0:a>=c?1:(a=(a-b)/(c-b))*a*(3-2*a)},smootherstep:function(a,b,c){return a<=b?0:a>=c?1:(a=(a-b)/(c-b))*a*a*(a*(6*a-15)+10)},random16:function(){return console.warn("THREE.Math.random16() has been deprecated. Use Math.random() instead."),Math.random()},randInt:function(a,b){return a+Math.floor(Math.random()*(b-a+1))},randFloat:function(a,b){return a+Math.random()*(b-a)},randFloatSpread:function(a){return a*(.5-Math.random())},degToRad:function(a){return a*Td.DEG2RAD},radToDeg:function(a){return a*Td.RAD2DEG},isPowerOfTwo:function(a){return 0==(a&a-1)&&0!==a},nearestPowerOfTwo:function(a){return Math.pow(2,Math.round(Math.log(a)/Math.LN2))},nextPowerOfTwo:function(a){return a--,a|=a>>1,a|=a>>2,a|=a>>4,a|=a>>8,a|=a>>16,++a}};c.prototype={constructor:c,isVector2:!0,get width(){return this.x},set width(a){this.x=a},get height(){return this.y},set height(a){this.y=a},set:function(a,b){return this.x=a,this.y=b,this},setScalar:function(a){return this.y=this.x=a,this},setX:function(a){return this.x=a,this},setY:function(a){return this.y=a,this},setComponent:function(a,b){switch(a){case 0:this.x=b;break;case 1:this.y=b;break;default:throw Error("index is out of range: "+a)}return this},getComponent:function(a){switch(a){case 0:return this.x;case 1:return this.y;default:throw Error("index is out of range: "+a)}},clone:function(){return new this.constructor(this.x,this.y)},copy:function(a){return this.x=a.x,this.y=a.y,this},add:function(a,b){return void 0!==b?(console.warn("THREE.Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(a,b)):(this.x+=a.x,this.y+=a.y,this)},addScalar:function(a){return this.x+=a,this.y+=a,this},addVectors:function(a,b){return this.x=a.x+b.x,this.y=a.y+b.y,this},addScaledVector:function(a,b){return this.x+=a.x*b,this.y+=a.y*b,this},sub:function(a,b){return void 0!==b?(console.warn("THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(a,b)):(this.x-=a.x,this.y-=a.y,this)},subScalar:function(a){return this.x-=a,this.y-=a,this},subVectors:function(a,b){return this.x=a.x-b.x,this.y=a.y-b.y,this},multiply:function(a){return this.x*=a.x,this.y*=a.y,this},multiplyScalar:function(a){return isFinite(a)?(this.x*=a,this.y*=a):this.y=this.x=0,this},divide:function(a){return this.x/=a.x,this.y/=a.y,this},divideScalar:function(a){return this.multiplyScalar(1/a)},min:function(a){return this.x=Math.min(this.x,a.x),this.y=Math.min(this.y,a.y),this},max:function(a){return this.x=Math.max(this.x,a.x),this.y=Math.max(this.y,a.y),this},clamp:function(a,b){return this.x=Math.max(a.x,Math.min(b.x,this.x)),this.y=Math.max(a.y,Math.min(b.y,this.y)),this},clampScalar:function(){var a,b;return function(d,e){return void 0===a&&(a=new c,b=new c),a.set(d,d),b.set(e,e),this.clamp(a,b)}}(),clampLength:function(a,b){var c=this.length();return this.multiplyScalar(Math.max(a,Math.min(b,c))/c)},floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},roundToZero:function(){return this.x=0>this.x?Math.ceil(this.x):Math.floor(this.x),this.y=0>this.y?Math.ceil(this.y):Math.floor(this.y),this},negate:function(){return this.x=-this.x,this.y=-this.y,this},dot:function(a){return this.x*a.x+this.y*a.y},lengthSq:function(){return this.x*this.x+this.y*this.y},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},lengthManhattan:function(){return Math.abs(this.x)+Math.abs(this.y)},normalize:function(){return this.divideScalar(this.length())},angle:function(){var a=Math.atan2(this.y,this.x);return 0>a&&(a+=2*Math.PI),a},distanceTo:function(a){return Math.sqrt(this.distanceToSquared(a))},distanceToSquared:function(a){var b=this.x-a.x;return a=this.y-a.y,b*b+a*a},distanceToManhattan:function(a){return Math.abs(this.x-a.x)+Math.abs(this.y-a.y)},setLength:function(a){return this.multiplyScalar(a/this.length())},lerp:function(a,b){return this.x+=(a.x-this.x)*b,this.y+=(a.y-this.y)*b,this},lerpVectors:function(a,b,c){return this.subVectors(b,a).multiplyScalar(c).add(a)},equals:function(a){return a.x===this.x&&a.y===this.y},fromArray:function(a,b){return void 0===b&&(b=0),this.x=a[b],this.y=a[b+1],this},toArray:function(a,b){return void 0===a&&(a=[]),void 0===b&&(b=0),a[b]=this.x,a[b+1]=this.y,a},fromAttribute:function(a,b,c){return void 0===c&&(c=0),b=b*a.itemSize+c,this.x=a.array[b],this.y=a.array[b+1],this},rotateAround:function(a,b){var c=Math.cos(b),d=Math.sin(b),e=this.x-a.x,f=this.y-a.y;return this.x=e*c-f*d+a.x,this.y=e*d+f*c+a.y,this}},d.DEFAULT_IMAGE=void 0,d.DEFAULT_MAPPING=300,d.prototype={constructor:d,isTexture:!0,set needsUpdate(a){!0===a&&this.version++},clone:function(){return(new this.constructor).copy(this)},copy:function(a){return this.image=a.image,this.mipmaps=a.mipmaps.slice(0),this.mapping=a.mapping,this.wrapS=a.wrapS,this.wrapT=a.wrapT,this.magFilter=a.magFilter,this.minFilter=a.minFilter,this.anisotropy=a.anisotropy,this.format=a.format,this.type=a.type,this.offset.copy(a.offset),this.repeat.copy(a.repeat),this.generateMipmaps=a.generateMipmaps,this.premultiplyAlpha=a.premultiplyAlpha,this.flipY=a.flipY,this.unpackAlignment=a.unpackAlignment,this.encoding=a.encoding,this},toJSON:function(a){if(void 0!==a.textures[this.uuid])return a.textures[this.uuid];var b={metadata:{version:4.4,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,mapping:this.mapping,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],wrap:[this.wrapS,this.wrapT],minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY};if(void 0!==this.image){var c=this.image;if(void 0===c.uuid&&(c.uuid=Td.generateUUID()),void 0===a.images[c.uuid]){var d,e=a.images,f=c.uuid,g=c.uuid;void 0!==c.toDataURL?d=c:(d=document.createElementNS("http://www.w3.org/1999/xhtml","canvas"),d.width=c.width,d.height=c.height,d.getContext("2d").drawImage(c,0,0,c.width,c.height)),d=2048<d.width||2048<d.height?d.toDataURL("image/jpeg",.6):d.toDataURL("image/png"),e[f]={uuid:g,url:d}}b.image=c.uuid}return a.textures[this.uuid]=b},dispose:function(){this.dispatchEvent({type:"dispose"})},transformUv:function(a){if(300===this.mapping){if(a.multiply(this.repeat),a.add(this.offset),0>a.x||1<a.x)switch(this.wrapS){case 1e3:a.x-=Math.floor(a.x);break;case 1001:a.x=0>a.x?0:1;break;case 1002:a.x=1===Math.abs(Math.floor(a.x)%2)?Math.ceil(a.x)-a.x:a.x-Math.floor(a.x)}if(0>a.y||1<a.y)switch(this.wrapT){case 1e3:a.y-=Math.floor(a.y);break;case 1001:a.y=0>a.y?0:1;break;case 1002:a.y=1===Math.abs(Math.floor(a.y)%2)?Math.ceil(a.y)-a.y:a.y-Math.floor(a.y)}this.flipY&&(a.y=1-a.y)}}},Object.assign(d.prototype,b.prototype);var Ud=0;e.prototype={constructor:e,isVector4:!0,set:function(a,b,c,d){return this.x=a,this.y=b,this.z=c,this.w=d,this},setScalar:function(a){return this.w=this.z=this.y=this.x=a,this},setX:function(a){return this.x=a,this},setY:function(a){return this.y=a,this},setZ:function(a){return this.z=a,this},setW:function(a){return this.w=a,this},setComponent:function(a,b){switch(a){case 0:this.x=b;break;case 1:this.y=b;break;case 2:this.z=b;break;case 3:this.w=b;break;default:throw Error("index is out of range: "+a)}return this},getComponent:function(a){switch(a){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw Error("index is out of range: "+a)}},clone:function(){return new this.constructor(this.x,this.y,this.z,this.w)},copy:function(a){return this.x=a.x,this.y=a.y,this.z=a.z,this.w=void 0!==a.w?a.w:1,this},add:function(a,b){return void 0!==b?(console.warn("THREE.Vector4: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(a,b)):(this.x+=a.x,this.y+=a.y,this.z+=a.z,this.w+=a.w,this)},addScalar:function(a){return this.x+=a,this.y+=a,this.z+=a,this.w+=a,this},addVectors:function(a,b){return this.x=a.x+b.x,this.y=a.y+b.y,this.z=a.z+b.z,this.w=a.w+b.w,this},addScaledVector:function(a,b){return this.x+=a.x*b,this.y+=a.y*b,this.z+=a.z*b,this.w+=a.w*b,this},sub:function(a,b){return void 0!==b?(console.warn("THREE.Vector4: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(a,b)):(this.x-=a.x,this.y-=a.y,this.z-=a.z,this.w-=a.w,this)},subScalar:function(a){return this.x-=a,this.y-=a,this.z-=a,this.w-=a,this},subVectors:function(a,b){return this.x=a.x-b.x,this.y=a.y-b.y,this.z=a.z-b.z,this.w=a.w-b.w,this},multiplyScalar:function(a){return isFinite(a)?(this.x*=a,this.y*=a,this.z*=a,this.w*=a):this.w=this.z=this.y=this.x=0,this},applyMatrix4:function(a){var b=this.x,c=this.y,d=this.z,e=this.w;return a=a.elements,this.x=a[0]*b+a[4]*c+a[8]*d+a[12]*e,this.y=a[1]*b+a[5]*c+a[9]*d+a[13]*e,this.z=a[2]*b+a[6]*c+a[10]*d+a[14]*e,this.w=a[3]*b+a[7]*c+a[11]*d+a[15]*e,this},divideScalar:function(a){return this.multiplyScalar(1/a)},setAxisAngleFromQuaternion:function(a){this.w=2*Math.acos(a.w);var b=Math.sqrt(1-a.w*a.w);return 1e-4>b?(this.x=1,this.z=this.y=0):(this.x=a.x/b,this.y=a.y/b,this.z=a.z/b),this},setAxisAngleFromRotationMatrix:function(a){var b,c,d;a=a.elements;var e=a[0];d=a[4];var f=a[8],g=a[1],h=a[5],i=a[9];c=a[2],b=a[6];var j=a[10];return.01>Math.abs(d-g)&&.01>Math.abs(f-c)&&.01>Math.abs(i-b)?.1>Math.abs(d+g)&&.1>Math.abs(f+c)&&.1>Math.abs(i+b)&&.1>Math.abs(e+h+j-3)?(this.set(1,0,0,0),this):(a=Math.PI,e=(e+1)/2,h=(h+1)/2,j=(j+1)/2,d=(d+g)/4,f=(f+c)/4,i=(i+b)/4,e>h&&e>j?.01>e?(b=0,d=c=.707106781):(b=Math.sqrt(e),c=d/b,d=f/b):h>j?.01>h?(b=.707106781,c=0,d=.707106781):(c=Math.sqrt(h),b=d/c,d=i/c):.01>j?(c=b=.707106781,d=0):(d=Math.sqrt(j),b=f/d,c=i/d),this.set(b,c,d,a),this):(a=Math.sqrt((b-i)*(b-i)+(f-c)*(f-c)+(g-d)*(g-d)),.001>Math.abs(a)&&(a=1),this.x=(b-i)/a,this.y=(f-c)/a,this.z=(g-d)/a,this.w=Math.acos((e+h+j-1)/2),this)},min:function(a){return this.x=Math.min(this.x,a.x),this.y=Math.min(this.y,a.y),this.z=Math.min(this.z,a.z),this.w=Math.min(this.w,a.w),this},max:function(a){return this.x=Math.max(this.x,a.x),this.y=Math.max(this.y,a.y),this.z=Math.max(this.z,a.z),this.w=Math.max(this.w,a.w),this},clamp:function(a,b){return this.x=Math.max(a.x,Math.min(b.x,this.x)),this.y=Math.max(a.y,Math.min(b.y,this.y)),this.z=Math.max(a.z,Math.min(b.z,this.z)),this.w=Math.max(a.w,Math.min(b.w,this.w)),this},clampScalar:function(){var a,b;return function(c,d){return void 0===a&&(a=new e,b=new e),a.set(c,c,c,c),b.set(d,d,d,d),this.clamp(a,b)}}(),floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this},roundToZero:function(){return this.x=0>this.x?Math.ceil(this.x):Math.floor(this.x),this.y=0>this.y?Math.ceil(this.y):Math.floor(this.y),this.z=0>this.z?Math.ceil(this.z):Math.floor(this.z),this.w=0>this.w?Math.ceil(this.w):Math.floor(this.w),this},negate:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z+this.w*a.w},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},lengthManhattan:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)},normalize:function(){return this.divideScalar(this.length())},setLength:function(a){return this.multiplyScalar(a/this.length())},lerp:function(a,b){return this.x+=(a.x-this.x)*b,this.y+=(a.y-this.y)*b,this.z+=(a.z-this.z)*b,this.w+=(a.w-this.w)*b,this},lerpVectors:function(a,b,c){return this.subVectors(b,a).multiplyScalar(c).add(a)},equals:function(a){return a.x===this.x&&a.y===this.y&&a.z===this.z&&a.w===this.w},fromArray:function(a,b){return void 0===b&&(b=0),this.x=a[b],this.y=a[b+1],this.z=a[b+2],this.w=a[b+3],this},toArray:function(a,b){return void 0===a&&(a=[]),void 0===b&&(b=0),a[b]=this.x,a[b+1]=this.y,a[b+2]=this.z,a[b+3]=this.w,a},fromAttribute:function(a,b,c){return void 0===c&&(c=0),b=b*a.itemSize+c,this.x=a.array[b],this.y=a.array[b+1],this.z=a.array[b+2],this.w=a.array[b+3],this}},Object.assign(f.prototype,b.prototype,{isWebGLRenderTarget:!0,setSize:function(a,b){this.width===a&&this.height===b||(this.width=a,this.height=b,this.dispose()),this.viewport.set(0,0,a,b),this.scissor.set(0,0,a,b)},clone:function(){return(new this.constructor).copy(this)},copy:function(a){return this.width=a.width,this.height=a.height,this.viewport.copy(a.viewport),this.texture=a.texture.clone(),this.depthBuffer=a.depthBuffer,this.stencilBuffer=a.stencilBuffer,this.depthTexture=a.depthTexture,this},dispose:function(){this.dispatchEvent({type:"dispose"})}}),g.prototype=Object.create(f.prototype),g.prototype.constructor=g,g.prototype.isWebGLRenderTargetCube=!0,h.prototype={constructor:h,get x(){return this._x},set x(a){this._x=a,this.onChangeCallback()},get y(){return this._y},set y(a){this._y=a,this.onChangeCallback()},get z(){return this._z},set z(a){this._z=a,this.onChangeCallback()},get w(){return this._w},set w(a){this._w=a,this.onChangeCallback()},set:function(a,b,c,d){return this._x=a,this._y=b,this._z=c,this._w=d,this.onChangeCallback(),this},clone:function(){return new this.constructor(this._x,this._y,this._z,this._w)},copy:function(a){return this._x=a.x,this._y=a.y,this._z=a.z,this._w=a.w,this.onChangeCallback(),this},setFromEuler:function(a,b){if(!1===(a&&a.isEuler))throw Error("THREE.Quaternion: .setFromEuler() now expects an Euler rotation rather than a Vector3 and order.");var c=Math.cos(a._x/2),d=Math.cos(a._y/2),e=Math.cos(a._z/2),f=Math.sin(a._x/2),g=Math.sin(a._y/2),h=Math.sin(a._z/2),i=a.order;return"XYZ"===i?(this._x=f*d*e+c*g*h,this._y=c*g*e-f*d*h,this._z=c*d*h+f*g*e,this._w=c*d*e-f*g*h):"YXZ"===i?(this._x=f*d*e+c*g*h,this._y=c*g*e-f*d*h,this._z=c*d*h-f*g*e,this._w=c*d*e+f*g*h):"ZXY"===i?(this._x=f*d*e-c*g*h,this._y=c*g*e+f*d*h,this._z=c*d*h+f*g*e,this._w=c*d*e-f*g*h):"ZYX"===i?(this._x=f*d*e-c*g*h,this._y=c*g*e+f*d*h,this._z=c*d*h-f*g*e,this._w=c*d*e+f*g*h):"YZX"===i?(this._x=f*d*e+c*g*h,this._y=c*g*e+f*d*h,this._z=c*d*h-f*g*e,this._w=c*d*e-f*g*h):"XZY"===i&&(this._x=f*d*e-c*g*h,this._y=c*g*e-f*d*h,this._z=c*d*h+f*g*e,this._w=c*d*e+f*g*h),!1!==b&&this.onChangeCallback(),this},setFromAxisAngle:function(a,b){var c=b/2,d=Math.sin(c);return this._x=a.x*d,this._y=a.y*d,this._z=a.z*d,this._w=Math.cos(c),this.onChangeCallback(),this},setFromRotationMatrix:function(a){var b=a.elements,c=b[0];a=b[4];var d=b[8],e=b[1],f=b[5],g=b[9],h=b[2],i=b[6],b=b[10],j=c+f+b;return 0<j?(c=.5/Math.sqrt(j+1),this._w=.25/c,this._x=(i-g)*c,this._y=(d-h)*c,this._z=(e-a)*c):c>f&&c>b?(c=2*Math.sqrt(1+c-f-b),this._w=(i-g)/c,this._x=.25*c,this._y=(a+e)/c,this._z=(d+h)/c):f>b?(c=2*Math.sqrt(1+f-c-b),this._w=(d-h)/c,this._x=(a+e)/c,this._y=.25*c,this._z=(g+i)/c):(c=2*Math.sqrt(1+b-c-f),this._w=(e-a)/c,this._x=(d+h)/c,this._y=(g+i)/c,this._z=.25*c),this.onChangeCallback(),this},setFromUnitVectors:function(){var a,b;return function(c,d){return void 0===a&&(a=new i),b=c.dot(d)+1,1e-6>b?(b=0,Math.abs(c.x)>Math.abs(c.z)?a.set(-c.y,c.x,0):a.set(0,-c.z,c.y)):a.crossVectors(c,d),this._x=a.x,this._y=a.y,this._z=a.z,this._w=b,this.normalize()}}(),inverse:function(){return this.conjugate().normalize()},conjugate:function(){return this._x*=-1,this._y*=-1,this._z*=-1,this.onChangeCallback(),this},dot:function(a){return this._x*a._x+this._y*a._y+this._z*a._z+this._w*a._w},lengthSq:function(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w},length:function(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)},normalize:function(){var a=this.length();return 0===a?(this._z=this._y=this._x=0,this._w=1):(a=1/a,this._x*=a,this._y*=a,this._z*=a,this._w*=a),this.onChangeCallback(),this},multiply:function(a,b){return void 0!==b?(console.warn("THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead."),this.multiplyQuaternions(a,b)):this.multiplyQuaternions(this,a)},premultiply:function(a){return this.multiplyQuaternions(a,this)},multiplyQuaternions:function(a,b){var c=a._x,d=a._y,e=a._z,f=a._w,g=b._x,h=b._y,i=b._z,j=b._w;return this._x=c*j+f*g+d*i-e*h,this._y=d*j+f*h+e*g-c*i,this._z=e*j+f*i+c*h-d*g,this._w=f*j-c*g-d*h-e*i,this.onChangeCallback(),this},slerp:function(a,b){if(0===b)return this;if(1===b)return this.copy(a);var c=this._x,d=this._y,e=this._z,f=this._w,g=f*a._w+c*a._x+d*a._y+e*a._z;if(0>g?(this._w=-a._w,this._x=-a._x,this._y=-a._y,this._z=-a._z,g=-g):this.copy(a),1<=g)return this._w=f,this._x=c,this._y=d,this._z=e,this;var h=Math.sqrt(1-g*g);if(.001>Math.abs(h))return this._w=.5*(f+this._w),this._x=.5*(c+this._x),this._y=.5*(d+this._y),this._z=.5*(e+this._z),this;var i=Math.atan2(h,g),g=Math.sin((1-b)*i)/h,h=Math.sin(b*i)/h;return this._w=f*g+this._w*h,this._x=c*g+this._x*h,this._y=d*g+this._y*h,this._z=e*g+this._z*h,this.onChangeCallback(),this},equals:function(a){return a._x===this._x&&a._y===this._y&&a._z===this._z&&a._w===this._w},fromArray:function(a,b){return void 0===b&&(b=0),this._x=a[b],this._y=a[b+1],this._z=a[b+2],this._w=a[b+3],this.onChangeCallback(),this},toArray:function(a,b){return void 0===a&&(a=[]),void 0===b&&(b=0),a[b]=this._x,a[b+1]=this._y,a[b+2]=this._z,a[b+3]=this._w,a},onChange:function(a){return this.onChangeCallback=a,this},onChangeCallback:function(){}},Object.assign(h,{slerp:function(a,b,c,d){return c.copy(a).slerp(b,d)},slerpFlat:function(a,b,c,d,e,f,g){var h=c[d+0],i=c[d+1],j=c[d+2];c=c[d+3],d=e[f+0];var k=e[f+1],l=e[f+2];if(e=e[f+3],c!==e||h!==d||i!==k||j!==l){f=1-g;var m=h*d+i*k+j*l+c*e,n=0<=m?1:-1,o=1-m*m;o>Number.EPSILON&&(o=Math.sqrt(o),m=Math.atan2(o,m*n),f=Math.sin(f*m)/o,g=Math.sin(g*m)/o),n*=g,h=h*f+d*n,i=i*f+k*n,j=j*f+l*n,c=c*f+e*n,f===1-g&&(g=1/Math.sqrt(h*h+i*i+j*j+c*c),h*=g,i*=g,j*=g,c*=g)}a[b]=h,a[b+1]=i,a[b+2]=j,a[b+3]=c}}),i.prototype={constructor:i,isVector3:!0,set:function(a,b,c){return this.x=a,this.y=b,this.z=c,this},setScalar:function(a){return this.z=this.y=this.x=a,this},setX:function(a){return this.x=a,this},setY:function(a){return this.y=a,this},setZ:function(a){return this.z=a,this},setComponent:function(a,b){switch(a){case 0:this.x=b;break;case 1:this.y=b;break;case 2:this.z=b;break;default:throw Error("index is out of range: "+a)}return this},getComponent:function(a){switch(a){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw Error("index is out of range: "+a)}},clone:function(){return new this.constructor(this.x,this.y,this.z)},copy:function(a){return this.x=a.x,this.y=a.y,this.z=a.z,this},add:function(a,b){return void 0!==b?(console.warn("THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(a,b)):(this.x+=a.x,this.y+=a.y,this.z+=a.z,this)},addScalar:function(a){return this.x+=a,this.y+=a,this.z+=a,this},addVectors:function(a,b){return this.x=a.x+b.x,this.y=a.y+b.y,this.z=a.z+b.z,this},addScaledVector:function(a,b){return this.x+=a.x*b,this.y+=a.y*b,this.z+=a.z*b,this},sub:function(a,b){return void 0!==b?(console.warn("THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(a,b)):(this.x-=a.x,this.y-=a.y,this.z-=a.z,this)},subScalar:function(a){return this.x-=a,this.y-=a,this.z-=a,this},subVectors:function(a,b){return this.x=a.x-b.x,this.y=a.y-b.y,this.z=a.z-b.z,this},multiply:function(a,b){return void 0!==b?(console.warn("THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead."),this.multiplyVectors(a,b)):(this.x*=a.x,this.y*=a.y,this.z*=a.z,this)},multiplyScalar:function(a){return isFinite(a)?(this.x*=a,this.y*=a,this.z*=a):this.z=this.y=this.x=0,this},multiplyVectors:function(a,b){return this.x=a.x*b.x,this.y=a.y*b.y,this.z=a.z*b.z,this},applyEuler:function(){var a;return function(b){return!1===(b&&b.isEuler)&&console.error("THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order."),void 0===a&&(a=new h),this.applyQuaternion(a.setFromEuler(b))}}(),applyAxisAngle:function(){var a;return function(b,c){return void 0===a&&(a=new h),this.applyQuaternion(a.setFromAxisAngle(b,c))}}(),applyMatrix3:function(a){var b=this.x,c=this.y,d=this.z;return a=a.elements,this.x=a[0]*b+a[3]*c+a[6]*d,this.y=a[1]*b+a[4]*c+a[7]*d,this.z=a[2]*b+a[5]*c+a[8]*d,this},applyMatrix4:function(a){var b=this.x,c=this.y,d=this.z;return a=a.elements,this.x=a[0]*b+a[4]*c+a[8]*d+a[12],this.y=a[1]*b+a[5]*c+a[9]*d+a[13],this.z=a[2]*b+a[6]*c+a[10]*d+a[14],this},applyProjection:function(a){var b=this.x,c=this.y,d=this.z;a=a.elements;var e=1/(a[3]*b+a[7]*c+a[11]*d+a[15]);return this.x=(a[0]*b+a[4]*c+a[8]*d+a[12])*e,this.y=(a[1]*b+a[5]*c+a[9]*d+a[13])*e,this.z=(a[2]*b+a[6]*c+a[10]*d+a[14])*e,this},applyQuaternion:function(a){var b=this.x,c=this.y,d=this.z,e=a.x,f=a.y,g=a.z;a=a.w;var h=a*b+f*d-g*c,i=a*c+g*b-e*d,j=a*d+e*c-f*b,b=-e*b-f*c-g*d;return this.x=h*a+b*-e+i*-g-j*-f,this.y=i*a+b*-f+j*-e-h*-g,this.z=j*a+b*-g+h*-f-i*-e,this},project:function(){var a;return function(b){return void 0===a&&(a=new j),a.multiplyMatrices(b.projectionMatrix,a.getInverse(b.matrixWorld)),this.applyProjection(a)}}(),unproject:function(){var a;return function(b){return void 0===a&&(a=new j),a.multiplyMatrices(b.matrixWorld,a.getInverse(b.projectionMatrix)),this.applyProjection(a)}}(),transformDirection:function(a){var b=this.x,c=this.y,d=this.z;return a=a.elements,this.x=a[0]*b+a[4]*c+a[8]*d,this.y=a[1]*b+a[5]*c+a[9]*d,this.z=a[2]*b+a[6]*c+a[10]*d,this.normalize()},divide:function(a){return this.x/=a.x,this.y/=a.y,this.z/=a.z,this},divideScalar:function(a){return this.multiplyScalar(1/a)},min:function(a){return this.x=Math.min(this.x,a.x),this.y=Math.min(this.y,a.y),this.z=Math.min(this.z,a.z),this},max:function(a){return this.x=Math.max(this.x,a.x),this.y=Math.max(this.y,a.y),this.z=Math.max(this.z,a.z),this},clamp:function(a,b){return this.x=Math.max(a.x,Math.min(b.x,this.x)),this.y=Math.max(a.y,Math.min(b.y,this.y)),this.z=Math.max(a.z,Math.min(b.z,this.z)),this},clampScalar:function(){var a,b;return function(c,d){return void 0===a&&(a=new i,b=new i),a.set(c,c,c),b.set(d,d,d),this.clamp(a,b)}}(),clampLength:function(a,b){var c=this.length();return this.multiplyScalar(Math.max(a,Math.min(b,c))/c)},floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this},round:function(){ return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this},roundToZero:function(){return this.x=0>this.x?Math.ceil(this.x):Math.floor(this.x),this.y=0>this.y?Math.ceil(this.y):Math.floor(this.y),this.z=0>this.z?Math.ceil(this.z):Math.floor(this.z),this},negate:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},lengthManhattan:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)},normalize:function(){return this.divideScalar(this.length())},setLength:function(a){return this.multiplyScalar(a/this.length())},lerp:function(a,b){return this.x+=(a.x-this.x)*b,this.y+=(a.y-this.y)*b,this.z+=(a.z-this.z)*b,this},lerpVectors:function(a,b,c){return this.subVectors(b,a).multiplyScalar(c).add(a)},cross:function(a,b){if(void 0!==b)return console.warn("THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead."),this.crossVectors(a,b);var c=this.x,d=this.y,e=this.z;return this.x=d*a.z-e*a.y,this.y=e*a.x-c*a.z,this.z=c*a.y-d*a.x,this},crossVectors:function(a,b){var c=a.x,d=a.y,e=a.z,f=b.x,g=b.y,h=b.z;return this.x=d*h-e*g,this.y=e*f-c*h,this.z=c*g-d*f,this},projectOnVector:function(a){var b=a.dot(this)/a.lengthSq();return this.copy(a).multiplyScalar(b)},projectOnPlane:function(){var a;return function(b){return void 0===a&&(a=new i),a.copy(this).projectOnVector(b),this.sub(a)}}(),reflect:function(){var a;return function(b){return void 0===a&&(a=new i),this.sub(a.copy(b).multiplyScalar(2*this.dot(b)))}}(),angleTo:function(a){return a=this.dot(a)/Math.sqrt(this.lengthSq()*a.lengthSq()),Math.acos(Td.clamp(a,-1,1))},distanceTo:function(a){return Math.sqrt(this.distanceToSquared(a))},distanceToSquared:function(a){var b=this.x-a.x,c=this.y-a.y;return a=this.z-a.z,b*b+c*c+a*a},distanceToManhattan:function(a){return Math.abs(this.x-a.x)+Math.abs(this.y-a.y)+Math.abs(this.z-a.z)},setFromSpherical:function(a){var b=Math.sin(a.phi)*a.radius;return this.x=b*Math.sin(a.theta),this.y=Math.cos(a.phi)*a.radius,this.z=b*Math.cos(a.theta),this},setFromMatrixPosition:function(a){return this.setFromMatrixColumn(a,3)},setFromMatrixScale:function(a){var b=this.setFromMatrixColumn(a,0).length(),c=this.setFromMatrixColumn(a,1).length();return a=this.setFromMatrixColumn(a,2).length(),this.x=b,this.y=c,this.z=a,this},setFromMatrixColumn:function(a,b){if("number"==typeof a){console.warn("THREE.Vector3: setFromMatrixColumn now expects ( matrix, index ).");var c=a;a=b,b=c}return this.fromArray(a.elements,4*b)},equals:function(a){return a.x===this.x&&a.y===this.y&&a.z===this.z},fromArray:function(a,b){return void 0===b&&(b=0),this.x=a[b],this.y=a[b+1],this.z=a[b+2],this},toArray:function(a,b){return void 0===a&&(a=[]),void 0===b&&(b=0),a[b]=this.x,a[b+1]=this.y,a[b+2]=this.z,a},fromAttribute:function(a,b,c){return void 0===c&&(c=0),b=b*a.itemSize+c,this.x=a.array[b],this.y=a.array[b+1],this.z=a.array[b+2],this}},j.prototype={constructor:j,isMatrix4:!0,set:function(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p){var q=this.elements;return q[0]=a,q[4]=b,q[8]=c,q[12]=d,q[1]=e,q[5]=f,q[9]=g,q[13]=h,q[2]=i,q[6]=j,q[10]=k,q[14]=l,q[3]=m,q[7]=n,q[11]=o,q[15]=p,this},identity:function(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this},clone:function(){return(new j).fromArray(this.elements)},copy:function(a){return this.elements.set(a.elements),this},copyPosition:function(a){var b=this.elements;return a=a.elements,b[12]=a[12],b[13]=a[13],b[14]=a[14],this},extractBasis:function(a,b,c){return a.setFromMatrixColumn(this,0),b.setFromMatrixColumn(this,1),c.setFromMatrixColumn(this,2),this},makeBasis:function(a,b,c){return this.set(a.x,b.x,c.x,0,a.y,b.y,c.y,0,a.z,b.z,c.z,0,0,0,0,1),this},extractRotation:function(){var a;return function(b){void 0===a&&(a=new i);var c=this.elements,d=b.elements,e=1/a.setFromMatrixColumn(b,0).length(),f=1/a.setFromMatrixColumn(b,1).length();return b=1/a.setFromMatrixColumn(b,2).length(),c[0]=d[0]*e,c[1]=d[1]*e,c[2]=d[2]*e,c[4]=d[4]*f,c[5]=d[5]*f,c[6]=d[6]*f,c[8]=d[8]*b,c[9]=d[9]*b,c[10]=d[10]*b,this}}(),makeRotationFromEuler:function(a){!1===(a&&a.isEuler)&&console.error("THREE.Matrix: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.");var b=this.elements,c=a.x,d=a.y,e=a.z,f=Math.cos(c),c=Math.sin(c),g=Math.cos(d),d=Math.sin(d),h=Math.cos(e),e=Math.sin(e);if("XYZ"===a.order){a=f*h;var i=f*e,j=c*h,k=c*e;b[0]=g*h,b[4]=-g*e,b[8]=d,b[1]=i+j*d,b[5]=a-k*d,b[9]=-c*g,b[2]=k-a*d,b[6]=j+i*d,b[10]=f*g}else"YXZ"===a.order?(a=g*h,i=g*e,j=d*h,k=d*e,b[0]=a+k*c,b[4]=j*c-i,b[8]=f*d,b[1]=f*e,b[5]=f*h,b[9]=-c,b[2]=i*c-j,b[6]=k+a*c,b[10]=f*g):"ZXY"===a.order?(a=g*h,i=g*e,j=d*h,k=d*e,b[0]=a-k*c,b[4]=-f*e,b[8]=j+i*c,b[1]=i+j*c,b[5]=f*h,b[9]=k-a*c,b[2]=-f*d,b[6]=c,b[10]=f*g):"ZYX"===a.order?(a=f*h,i=f*e,j=c*h,k=c*e,b[0]=g*h,b[4]=j*d-i,b[8]=a*d+k,b[1]=g*e,b[5]=k*d+a,b[9]=i*d-j,b[2]=-d,b[6]=c*g,b[10]=f*g):"YZX"===a.order?(a=f*g,i=f*d,j=c*g,k=c*d,b[0]=g*h,b[4]=k-a*e,b[8]=j*e+i,b[1]=e,b[5]=f*h,b[9]=-c*h,b[2]=-d*h,b[6]=i*e+j,b[10]=a-k*e):"XZY"===a.order&&(a=f*g,i=f*d,j=c*g,k=c*d,b[0]=g*h,b[4]=-e,b[8]=d*h,b[1]=a*e+k,b[5]=f*h,b[9]=i*e-j,b[2]=j*e-i,b[6]=c*h,b[10]=k*e+a);return b[3]=0,b[7]=0,b[11]=0,b[12]=0,b[13]=0,b[14]=0,b[15]=1,this},makeRotationFromQuaternion:function(a){var b=this.elements,c=a.x,d=a.y,e=a.z,f=a.w,g=c+c,h=d+d,i=e+e;a=c*g;var j=c*h,c=c*i,k=d*h,d=d*i,e=e*i,g=f*g,h=f*h,f=f*i;return b[0]=1-(k+e),b[4]=j-f,b[8]=c+h,b[1]=j+f,b[5]=1-(a+e),b[9]=d-g,b[2]=c-h,b[6]=d+g,b[10]=1-(a+k),b[3]=0,b[7]=0,b[11]=0,b[12]=0,b[13]=0,b[14]=0,b[15]=1,this},lookAt:function(){var a,b,c;return function(d,e,f){void 0===a&&(a=new i,b=new i,c=new i);var g=this.elements;return c.subVectors(d,e).normalize(),0===c.lengthSq()&&(c.z=1),a.crossVectors(f,c).normalize(),0===a.lengthSq()&&(c.z+=1e-4,a.crossVectors(f,c).normalize()),b.crossVectors(c,a),g[0]=a.x,g[4]=b.x,g[8]=c.x,g[1]=a.y,g[5]=b.y,g[9]=c.y,g[2]=a.z,g[6]=b.z,g[10]=c.z,this}}(),multiply:function(a,b){return void 0!==b?(console.warn("THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead."),this.multiplyMatrices(a,b)):this.multiplyMatrices(this,a)},premultiply:function(a){return this.multiplyMatrices(a,this)},multiplyMatrices:function(a,b){var c=a.elements,d=b.elements,e=this.elements,f=c[0],g=c[4],h=c[8],i=c[12],j=c[1],k=c[5],l=c[9],m=c[13],n=c[2],o=c[6],p=c[10],q=c[14],r=c[3],s=c[7],t=c[11],c=c[15],u=d[0],v=d[4],w=d[8],x=d[12],y=d[1],z=d[5],A=d[9],B=d[13],C=d[2],D=d[6],E=d[10],F=d[14],G=d[3],H=d[7],I=d[11],d=d[15];return e[0]=f*u+g*y+h*C+i*G,e[4]=f*v+g*z+h*D+i*H,e[8]=f*w+g*A+h*E+i*I,e[12]=f*x+g*B+h*F+i*d,e[1]=j*u+k*y+l*C+m*G,e[5]=j*v+k*z+l*D+m*H,e[9]=j*w+k*A+l*E+m*I,e[13]=j*x+k*B+l*F+m*d,e[2]=n*u+o*y+p*C+q*G,e[6]=n*v+o*z+p*D+q*H,e[10]=n*w+o*A+p*E+q*I,e[14]=n*x+o*B+p*F+q*d,e[3]=r*u+s*y+t*C+c*G,e[7]=r*v+s*z+t*D+c*H,e[11]=r*w+s*A+t*E+c*I,e[15]=r*x+s*B+t*F+c*d,this},multiplyToArray:function(a,b,c){var d=this.elements;return this.multiplyMatrices(a,b),c[0]=d[0],c[1]=d[1],c[2]=d[2],c[3]=d[3],c[4]=d[4],c[5]=d[5],c[6]=d[6],c[7]=d[7],c[8]=d[8],c[9]=d[9],c[10]=d[10],c[11]=d[11],c[12]=d[12],c[13]=d[13],c[14]=d[14],c[15]=d[15],this},multiplyScalar:function(a){var b=this.elements;return b[0]*=a,b[4]*=a,b[8]*=a,b[12]*=a,b[1]*=a,b[5]*=a,b[9]*=a,b[13]*=a,b[2]*=a,b[6]*=a,b[10]*=a,b[14]*=a,b[3]*=a,b[7]*=a,b[11]*=a,b[15]*=a,this},applyToVector3Array:function(){var a;return function(b,c,d){void 0===a&&(a=new i),void 0===c&&(c=0),void 0===d&&(d=b.length);for(var e=0;e<d;e+=3,c+=3)a.fromArray(b,c),a.applyMatrix4(this),a.toArray(b,c);return b}}(),applyToBuffer:function(){var a;return function(b,c,d){void 0===a&&(a=new i),void 0===c&&(c=0),void 0===d&&(d=b.length/b.itemSize);for(var e=0;e<d;e++,c++)a.x=b.getX(c),a.y=b.getY(c),a.z=b.getZ(c),a.applyMatrix4(this),b.setXYZ(c,a.x,a.y,a.z);return b}}(),determinant:function(){var a=this.elements,b=a[0],c=a[4],d=a[8],e=a[12],f=a[1],g=a[5],h=a[9],i=a[13],j=a[2],k=a[6],l=a[10],m=a[14];return a[3]*(+e*h*k-d*i*k-e*g*l+c*i*l+d*g*m-c*h*m)+a[7]*(+b*h*m-b*i*l+e*f*l-d*f*m+d*i*j-e*h*j)+a[11]*(+b*i*k-b*g*m-e*f*k+c*f*m+e*g*j-c*i*j)+a[15]*(-d*g*j-b*h*k+b*g*l+d*f*k-c*f*l+c*h*j)},transpose:function(){var a,b=this.elements;return a=b[1],b[1]=b[4],b[4]=a,a=b[2],b[2]=b[8],b[8]=a,a=b[6],b[6]=b[9],b[9]=a,a=b[3],b[3]=b[12],b[12]=a,a=b[7],b[7]=b[13],b[13]=a,a=b[11],b[11]=b[14],b[14]=a,this},flattenToArrayOffset:function(a,b){return console.warn("THREE.Matrix3: .flattenToArrayOffset is deprecated - just use .toArray instead."),this.toArray(a,b)},getPosition:function(){var a;return function(){return void 0===a&&(a=new i),console.warn("THREE.Matrix4: .getPosition() has been removed. Use Vector3.setFromMatrixPosition( matrix ) instead."),a.setFromMatrixColumn(this,3)}}(),setPosition:function(a){var b=this.elements;return b[12]=a.x,b[13]=a.y,b[14]=a.z,this},getInverse:function(a,b){var c=this.elements,d=a.elements,e=d[0],f=d[1],g=d[2],h=d[3],i=d[4],j=d[5],k=d[6],l=d[7],m=d[8],n=d[9],o=d[10],p=d[11],q=d[12],r=d[13],s=d[14],d=d[15],t=n*s*l-r*o*l+r*k*p-j*s*p-n*k*d+j*o*d,u=q*o*l-m*s*l-q*k*p+i*s*p+m*k*d-i*o*d,v=m*r*l-q*n*l+q*j*p-i*r*p-m*j*d+i*n*d,w=q*n*k-m*r*k-q*j*o+i*r*o+m*j*s-i*n*s,x=e*t+f*u+g*v+h*w;if(0===x){if(!0===b)throw Error("THREE.Matrix4.getInverse(): can't invert matrix, determinant is 0");return console.warn("THREE.Matrix4.getInverse(): can't invert matrix, determinant is 0"),this.identity()}return x=1/x,c[0]=t*x,c[1]=(r*o*h-n*s*h-r*g*p+f*s*p+n*g*d-f*o*d)*x,c[2]=(j*s*h-r*k*h+r*g*l-f*s*l-j*g*d+f*k*d)*x,c[3]=(n*k*h-j*o*h-n*g*l+f*o*l+j*g*p-f*k*p)*x,c[4]=u*x,c[5]=(m*s*h-q*o*h+q*g*p-e*s*p-m*g*d+e*o*d)*x,c[6]=(q*k*h-i*s*h-q*g*l+e*s*l+i*g*d-e*k*d)*x,c[7]=(i*o*h-m*k*h+m*g*l-e*o*l-i*g*p+e*k*p)*x,c[8]=v*x,c[9]=(q*n*h-m*r*h-q*f*p+e*r*p+m*f*d-e*n*d)*x,c[10]=(i*r*h-q*j*h+q*f*l-e*r*l-i*f*d+e*j*d)*x,c[11]=(m*j*h-i*n*h-m*f*l+e*n*l+i*f*p-e*j*p)*x,c[12]=w*x,c[13]=(m*r*g-q*n*g+q*f*o-e*r*o-m*f*s+e*n*s)*x,c[14]=(q*j*g-i*r*g-q*f*k+e*r*k+i*f*s-e*j*s)*x,c[15]=(i*n*g-m*j*g+m*f*k-e*n*k-i*f*o+e*j*o)*x,this},scale:function(a){var b=this.elements,c=a.x,d=a.y;return a=a.z,b[0]*=c,b[4]*=d,b[8]*=a,b[1]*=c,b[5]*=d,b[9]*=a,b[2]*=c,b[6]*=d,b[10]*=a,b[3]*=c,b[7]*=d,b[11]*=a,this},getMaxScaleOnAxis:function(){var a=this.elements;return Math.sqrt(Math.max(a[0]*a[0]+a[1]*a[1]+a[2]*a[2],a[4]*a[4]+a[5]*a[5]+a[6]*a[6],a[8]*a[8]+a[9]*a[9]+a[10]*a[10]))},makeTranslation:function(a,b,c){return this.set(1,0,0,a,0,1,0,b,0,0,1,c,0,0,0,1),this},makeRotationX:function(a){var b=Math.cos(a);return a=Math.sin(a),this.set(1,0,0,0,0,b,-a,0,0,a,b,0,0,0,0,1),this},makeRotationY:function(a){var b=Math.cos(a);return a=Math.sin(a),this.set(b,0,a,0,0,1,0,0,-a,0,b,0,0,0,0,1),this},makeRotationZ:function(a){var b=Math.cos(a);return a=Math.sin(a),this.set(b,-a,0,0,a,b,0,0,0,0,1,0,0,0,0,1),this},makeRotationAxis:function(a,b){var c=Math.cos(b),d=Math.sin(b),e=1-c,f=a.x,g=a.y,h=a.z,i=e*f,j=e*g;return this.set(i*f+c,i*g-d*h,i*h+d*g,0,i*g+d*h,j*g+c,j*h-d*f,0,i*h-d*g,j*h+d*f,e*h*h+c,0,0,0,0,1),this},makeScale:function(a,b,c){return this.set(a,0,0,0,0,b,0,0,0,0,c,0,0,0,0,1),this},compose:function(a,b,c){return this.makeRotationFromQuaternion(b),this.scale(c),this.setPosition(a),this},decompose:function(){var a,b;return function(c,d,e){void 0===a&&(a=new i,b=new j);var f=this.elements,g=a.set(f[0],f[1],f[2]).length(),h=a.set(f[4],f[5],f[6]).length(),k=a.set(f[8],f[9],f[10]).length();0>this.determinant()&&(g=-g),c.x=f[12],c.y=f[13],c.z=f[14],b.elements.set(this.elements),c=1/g;var f=1/h,l=1/k;return b.elements[0]*=c,b.elements[1]*=c,b.elements[2]*=c,b.elements[4]*=f,b.elements[5]*=f,b.elements[6]*=f,b.elements[8]*=l,b.elements[9]*=l,b.elements[10]*=l,d.setFromRotationMatrix(b),e.x=g,e.y=h,e.z=k,this}}(),makeFrustum:function(a,b,c,d,e,f){var g=this.elements;return g[0]=2*e/(b-a),g[4]=0,g[8]=(b+a)/(b-a),g[12]=0,g[1]=0,g[5]=2*e/(d-c),g[9]=(d+c)/(d-c),g[13]=0,g[2]=0,g[6]=0,g[10]=-(f+e)/(f-e),g[14]=-2*f*e/(f-e),g[3]=0,g[7]=0,g[11]=-1,g[15]=0,this},makePerspective:function(a,b,c,d){a=c*Math.tan(Td.DEG2RAD*a*.5);var e=-a;return this.makeFrustum(e*b,a*b,e,a,c,d)},makeOrthographic:function(a,b,c,d,e,f){var g=this.elements,h=1/(b-a),i=1/(c-d),j=1/(f-e);return g[0]=2*h,g[4]=0,g[8]=0,g[12]=-(b+a)*h,g[1]=0,g[5]=2*i,g[9]=0,g[13]=-(c+d)*i,g[2]=0,g[6]=0,g[10]=-2*j,g[14]=-(f+e)*j,g[3]=0,g[7]=0,g[11]=0,g[15]=1,this},equals:function(a){var b=this.elements;a=a.elements;for(var c=0;16>c;c++)if(b[c]!==a[c])return!1;return!0},fromArray:function(a,b){void 0===b&&(b=0);for(var c=0;16>c;c++)this.elements[c]=a[c+b];return this},toArray:function(a,b){void 0===a&&(a=[]),void 0===b&&(b=0);var c=this.elements;return a[b]=c[0],a[b+1]=c[1],a[b+2]=c[2],a[b+3]=c[3],a[b+4]=c[4],a[b+5]=c[5],a[b+6]=c[6],a[b+7]=c[7],a[b+8]=c[8],a[b+9]=c[9],a[b+10]=c[10],a[b+11]=c[11],a[b+12]=c[12],a[b+13]=c[13],a[b+14]=c[14],a[b+15]=c[15],a}},k.prototype=Object.create(d.prototype),k.prototype.constructor=k,k.prototype.isCubeTexture=!0,Object.defineProperty(k.prototype,"images",{get:function(){return this.image},set:function(a){this.image=a}});var Vd=new d,Wd=new k,Xd=[],Yd=[];O.prototype.setValue=function(a,b){for(var c=this.seq,d=0,e=c.length;d!==e;++d){var f=c[d];f.setValue(a,b[f.id])}};var Zd=/([\w\d_]+)(\])?(\[|\.)?/g;P.prototype.setValue=function(a,b,c){void 0!==(b=this.map[b])&&b.setValue(a,c,this.renderer)},P.prototype.set=function(a,b,c){var d=this.map[c];void 0!==d&&d.setValue(a,b[c],this.renderer)},P.prototype.setOptional=function(a,b,c){void 0!==(b=b[c])&&this.setValue(a,c,b)},P.upload=function(a,b,c,d){for(var e=0,f=b.length;e!==f;++e){var g=b[e],h=c[g.id];!1!==h.needsUpdate&&g.setValue(a,h.value,d)}},P.seqWithValue=function(a,b){for(var c=[],d=0,e=a.length;d!==e;++d){var f=a[d];f.id in b&&c.push(f)}return c};var $d={merge:function(a){for(var b={},c=0;c<a.length;c++){var d,e=this.clone(a[c]);for(d in e)b[d]=e[d]}return b},clone:function(a){var b,c={};for(b in a){c[b]={};for(var d in a[b]){var e=a[b][d];e&&(e.isColor||e.isMatrix3||e.isMatrix4||e.isVector2||e.isVector3||e.isVector4||e.isTexture)?c[b][d]=e.clone():Array.isArray(e)?c[b][d]=e.slice():c[b][d]=e}}return c}},_d={alphamap_fragment:"#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, vUv ).g;\n#endif\n",alphamap_pars_fragment:"#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif\n",alphatest_fragment:"#ifdef ALPHATEST\n\tif ( diffuseColor.a < ALPHATEST ) discard;\n#endif\n",aomap_fragment:"#ifdef USE_AOMAP\n\tfloat ambientOcclusion = ( texture2D( aoMap, vUv2 ).r - 1.0 ) * aoMapIntensity + 1.0;\n\treflectedLight.indirectDiffuse *= ambientOcclusion;\n\t#if defined( USE_ENVMAP ) && defined( PHYSICAL )\n\t\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\t\treflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.specularRoughness );\n\t#endif\n#endif\n",aomap_pars_fragment:"#ifdef USE_AOMAP\n\tuniform sampler2D aoMap;\n\tuniform float aoMapIntensity;\n#endif",begin_vertex:"\nvec3 transformed = vec3( position );\n",beginnormal_vertex:"\nvec3 objectNormal = vec3( normal );\n",bsdfs:"bool testLightInRange( const in float lightDistance, const in float cutoffDistance ) {\n\treturn any( bvec2( cutoffDistance == 0.0, lightDistance < cutoffDistance ) );\n}\nfloat punctualLightIntensityToIrradianceFactor( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n\t\tif( decayExponent > 0.0 ) {\n#if defined ( PHYSICALLY_CORRECT_LIGHTS )\n\t\t\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n\t\t\tfloat maxDistanceCutoffFactor = pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\t\t\treturn distanceFalloff * maxDistanceCutoffFactor;\n#else\n\t\t\treturn pow( saturate( -lightDistance / cutoffDistance + 1.0 ), decayExponent );\n#endif\n\t\t}\n\t\treturn 1.0;\n}\nvec3 BRDF_Diffuse_Lambert( const in vec3 diffuseColor ) {\n\treturn RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 specularColor, const in float dotLH ) {\n\tfloat fresnel = exp2( ( -5.55473 * dotLH - 6.98316 ) * dotLH );\n\treturn ( 1.0 - specularColor ) * fresnel + specularColor;\n}\nfloat G_GGX_Smith( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gl = dotNL + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\tfloat gv = dotNV + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\treturn 1.0 / ( gl * gv );\n}\nfloat G_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\tfloat gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\treturn 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n\tfloat a2 = pow2( alpha );\n\tfloat denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n\treturn RECIPROCAL_PI * a2 / pow2( denom );\n}\nvec3 BRDF_Specular_GGX( const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float roughness ) {\n\tfloat alpha = pow2( roughness );\n\tvec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );\n\tfloat dotNL = saturate( dot( geometry.normal, incidentLight.direction ) );\n\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\tfloat dotNH = saturate( dot( geometry.normal, halfDir ) );\n\tfloat dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, dotLH );\n\tfloat G = G_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\tfloat D = D_GGX( alpha, dotNH );\n\treturn F * ( G * D );\n}\nvec3 BRDF_Specular_GGX_Environment( const in GeometricContext geometry, const in vec3 specularColor, const in float roughness ) {\n\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\tconst vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n\tconst vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n\tvec4 r = roughness * c0 + c1;\n\tfloat a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n\tvec2 AB = vec2( -1.04, 1.04 ) * a004 + r.zw;\n\treturn specularColor * AB.x + AB.y;\n}\nfloat G_BlinnPhong_Implicit( ) {\n\treturn 0.25;\n}\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\n\treturn RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\n}\nvec3 BRDF_Specular_BlinnPhong( const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float shininess ) {\n\tvec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );\n\tfloat dotNH = saturate( dot( geometry.normal, halfDir ) );\n\tfloat dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, dotLH );\n\tfloat G = G_BlinnPhong_Implicit( );\n\tfloat D = D_BlinnPhong( shininess, dotNH );\n\treturn F * ( G * D );\n}\nfloat GGXRoughnessToBlinnExponent( const in float ggxRoughness ) {\n\treturn ( 2.0 / pow2( ggxRoughness + 0.0001 ) - 2.0 );\n}\nfloat BlinnExponentToGGXRoughness( const in float blinnExponent ) {\n\treturn sqrt( 2.0 / ( blinnExponent + 2.0 ) );\n}\n",bumpmap_pars_fragment:"#ifdef USE_BUMPMAP\n\tuniform sampler2D bumpMap;\n\tuniform float bumpScale;\n\tvec2 dHdxy_fwd() {\n\t\tvec2 dSTdx = dFdx( vUv );\n\t\tvec2 dSTdy = dFdy( vUv );\n\t\tfloat Hll = bumpScale * texture2D( bumpMap, vUv ).x;\n\t\tfloat dBx = bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll;\n\t\tfloat dBy = bumpScale * texture2D( bumpMap, vUv + dSTdy ).x - Hll;\n\t\treturn vec2( dBx, dBy );\n\t}\n\tvec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy ) {\n\t\tvec3 vSigmaX = dFdx( surf_pos );\n\t\tvec3 vSigmaY = dFdy( surf_pos );\n\t\tvec3 vN = surf_norm;\n\t\tvec3 R1 = cross( vSigmaY, vN );\n\t\tvec3 R2 = cross( vN, vSigmaX );\n\t\tfloat fDet = dot( vSigmaX, R1 );\n\t\tvec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n\t\treturn normalize( abs( fDet ) * surf_norm - vGrad );\n\t}\n#endif\n",clipping_planes_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; ++ i ) {\n\t\tvec4 plane = clippingPlanes[ i ];\n\t\tif ( dot( vViewPosition, plane.xyz ) > plane.w ) discard;\n\t}\n\t\t\n\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\tbool clipped = true;\n\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; ++ i ) {\n\t\t\tvec4 plane = clippingPlanes[ i ];\n\t\t\tclipped = ( dot( vViewPosition, plane.xyz ) > plane.w ) && clipped;\n\t\t}\n\t\tif ( clipped ) discard;\n\t\n\t#endif\n#endif\n",clipping_planes_pars_fragment:"#if NUM_CLIPPING_PLANES > 0\n\t#if ! defined( PHYSICAL ) && ! defined( PHONG )\n\t\tvarying vec3 vViewPosition;\n\t#endif\n\tuniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif\n",clipping_planes_pars_vertex:"#if NUM_CLIPPING_PLANES > 0 && ! defined( PHYSICAL ) && ! defined( PHONG )\n\tvarying vec3 vViewPosition;\n#endif\n",clipping_planes_vertex:"#if NUM_CLIPPING_PLANES > 0 && ! defined( PHYSICAL ) && ! defined( PHONG )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n",color_fragment:"#ifdef USE_COLOR\n\tdiffuseColor.rgb *= vColor;\n#endif",color_pars_fragment:"#ifdef USE_COLOR\n\tvarying vec3 vColor;\n#endif\n",color_pars_vertex:"#ifdef USE_COLOR\n\tvarying vec3 vColor;\n#endif",color_vertex:"#ifdef USE_COLOR\n\tvColor.xyz = color.xyz;\n#endif",common:"#define PI 3.14159265359\n#define PI2 6.28318530718\n#define RECIPROCAL_PI 0.31830988618\n#define RECIPROCAL_PI2 0.15915494\n#define LOG2 1.442695\n#define EPSILON 1e-6\n#define saturate(a) clamp( a, 0.0, 1.0 )\n#define whiteCompliment(a) ( 1.0 - saturate( a ) )\nfloat pow2( const in float x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat average( const in vec3 color ) { return dot( color, vec3( 0.3333 ) ); }\nhighp float rand( const in vec2 uv ) {\n\tconst highp float a = 12.9898, b = 78.233, c = 43758.5453;\n\thighp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n\treturn fract(sin(sn) * c);\n}\nstruct IncidentLight {\n\tvec3 color;\n\tvec3 direction;\n\tbool visible;\n};\nstruct ReflectedLight {\n\tvec3 directDiffuse;\n\tvec3 directSpecular;\n\tvec3 indirectDiffuse;\n\tvec3 indirectSpecular;\n};\nstruct GeometricContext {\n\tvec3 position;\n\tvec3 normal;\n\tvec3 viewDir;\n};\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n}\nvec3 projectOnPlane(in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\tfloat distance = dot( planeNormal, point - pointOnPlane );\n\treturn - distance * planeNormal + point;\n}\nfloat sideOfPlane( in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\treturn sign( dot( point - pointOnPlane, planeNormal ) );\n}\nvec3 linePlaneIntersect( in vec3 pointOnLine, in vec3 lineDirection, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\treturn lineDirection * ( dot( planeNormal, pointOnPlane - pointOnLine ) / dot( planeNormal, lineDirection ) ) + pointOnLine;\n}\n",cube_uv_reflection_fragment:"#ifdef ENVMAP_TYPE_CUBE_UV\n#define cubeUV_textureSize (1024.0)\nint getFaceFromDirection(vec3 direction) {\n\tvec3 absDirection = abs(direction);\n\tint face = -1;\n\tif( absDirection.x > absDirection.z ) {\n\t\tif(absDirection.x > absDirection.y )\n\t\t\tface = direction.x > 0.0 ? 0 : 3;\n\t\telse\n\t\t\tface = direction.y > 0.0 ? 1 : 4;\n\t}\n\telse {\n\t\tif(absDirection.z > absDirection.y )\n\t\t\tface = direction.z > 0.0 ? 2 : 5;\n\t\telse\n\t\t\tface = direction.y > 0.0 ? 1 : 4;\n\t}\n\treturn face;\n}\n#define cubeUV_maxLods1 (log2(cubeUV_textureSize*0.25) - 1.0)\n#define cubeUV_rangeClamp (exp2((6.0 - 1.0) * 2.0))\nvec2 MipLevelInfo( vec3 vec, float roughnessLevel, float roughness ) {\n\tfloat scale = exp2(cubeUV_maxLods1 - roughnessLevel);\n\tfloat dxRoughness = dFdx(roughness);\n\tfloat dyRoughness = dFdy(roughness);\n\tvec3 dx = dFdx( vec * scale * dxRoughness );\n\tvec3 dy = dFdy( vec * scale * dyRoughness );\n\tfloat d = max( dot( dx, dx ), dot( dy, dy ) );\n\td = clamp(d, 1.0, cubeUV_rangeClamp);\n\tfloat mipLevel = 0.5 * log2(d);\n\treturn vec2(floor(mipLevel), fract(mipLevel));\n}\n#define cubeUV_maxLods2 (log2(cubeUV_textureSize*0.25) - 2.0)\n#define cubeUV_rcpTextureSize (1.0 / cubeUV_textureSize)\nvec2 getCubeUV(vec3 direction, float roughnessLevel, float mipLevel) {\n\tmipLevel = roughnessLevel > cubeUV_maxLods2 - 3.0 ? 0.0 : mipLevel;\n\tfloat a = 16.0 * cubeUV_rcpTextureSize;\n\tvec2 exp2_packed = exp2( vec2( roughnessLevel, mipLevel ) );\n\tvec2 rcp_exp2_packed = vec2( 1.0 ) / exp2_packed;\n\tfloat powScale = exp2_packed.x * exp2_packed.y;\n\tfloat scale = rcp_exp2_packed.x * rcp_exp2_packed.y * 0.25;\n\tfloat mipOffset = 0.75*(1.0 - rcp_exp2_packed.y) * rcp_exp2_packed.x;\n\tbool bRes = mipLevel == 0.0;\n\tscale = bRes && (scale < a) ? a : scale;\n\tvec3 r;\n\tvec2 offset;\n\tint face = getFaceFromDirection(direction);\n\tfloat rcpPowScale = 1.0 / powScale;\n\tif( face == 0) {\n\t\tr = vec3(direction.x, -direction.z, direction.y);\n\t\toffset = vec2(0.0+mipOffset,0.75 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? a : offset.y;\n\t}\n\telse if( face == 1) {\n\t\tr = vec3(direction.y, direction.x, direction.z);\n\t\toffset = vec2(scale+mipOffset, 0.75 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? a : offset.y;\n\t}\n\telse if( face == 2) {\n\t\tr = vec3(direction.z, direction.x, direction.y);\n\t\toffset = vec2(2.0*scale+mipOffset, 0.75 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? a : offset.y;\n\t}\n\telse if( face == 3) {\n\t\tr = vec3(direction.x, direction.z, direction.y);\n\t\toffset = vec2(0.0+mipOffset,0.5 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? 0.0 : offset.y;\n\t}\n\telse if( face == 4) {\n\t\tr = vec3(direction.y, direction.x, -direction.z);\n\t\toffset = vec2(scale+mipOffset, 0.5 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? 0.0 : offset.y;\n\t}\n\telse {\n\t\tr = vec3(direction.z, -direction.x, direction.y);\n\t\toffset = vec2(2.0*scale+mipOffset, 0.5 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? 0.0 : offset.y;\n\t}\n\tr = normalize(r);\n\tfloat texelOffset = 0.5 * cubeUV_rcpTextureSize;\n\tvec2 s = ( r.yz / abs( r.x ) + vec2( 1.0 ) ) * 0.5;\n\tvec2 base = offset + vec2( texelOffset );\n\treturn base + s * ( scale - 2.0 * texelOffset );\n}\n#define cubeUV_maxLods3 (log2(cubeUV_textureSize*0.25) - 3.0)\nvec4 textureCubeUV(vec3 reflectedDirection, float roughness ) {\n\tfloat roughnessVal = roughness* cubeUV_maxLods3;\n\tfloat r1 = floor(roughnessVal);\n\tfloat r2 = r1 + 1.0;\n\tfloat t = fract(roughnessVal);\n\tvec2 mipInfo = MipLevelInfo(reflectedDirection, r1, roughness);\n\tfloat s = mipInfo.y;\n\tfloat level0 = mipInfo.x;\n\tfloat level1 = level0 + 1.0;\n\tlevel1 = level1 > 5.0 ? 5.0 : level1;\n\tlevel0 += min( floor( s + 0.5 ), 5.0 );\n\tvec2 uv_10 = getCubeUV(reflectedDirection, r1, level0);\n\tvec4 color10 = envMapTexelToLinear(texture2D(envMap, uv_10));\n\tvec2 uv_20 = getCubeUV(reflectedDirection, r2, level0);\n\tvec4 color20 = envMapTexelToLinear(texture2D(envMap, uv_20));\n\tvec4 result = mix(color10, color20, t);\n\treturn vec4(result.rgb, 1.0);\n}\n#endif\n",defaultnormal_vertex:"#ifdef FLIP_SIDED\n\tobjectNormal = -objectNormal;\n#endif\nvec3 transformedNormal = normalMatrix * objectNormal;\n",displacementmap_pars_vertex:"#ifdef USE_DISPLACEMENTMAP\n\tuniform sampler2D displacementMap;\n\tuniform float displacementScale;\n\tuniform float displacementBias;\n#endif\n",displacementmap_vertex:"#ifdef USE_DISPLACEMENTMAP\n\ttransformed += normal * ( texture2D( displacementMap, uv ).x * displacementScale + displacementBias );\n#endif\n",emissivemap_fragment:"#ifdef USE_EMISSIVEMAP\n\tvec4 emissiveColor = texture2D( emissiveMap, vUv );\n\temissiveColor.rgb = emissiveMapTexelToLinear( emissiveColor ).rgb;\n\ttotalEmissiveRadiance *= emissiveColor.rgb;\n#endif\n",emissivemap_pars_fragment:"#ifdef USE_EMISSIVEMAP\n\tuniform sampler2D emissiveMap;\n#endif\n",encodings_fragment:" gl_FragColor = linearToOutputTexel( gl_FragColor );\n",encodings_pars_fragment:"\nvec4 LinearToLinear( in vec4 value ) {\n return value;\n}\nvec4 GammaToLinear( in vec4 value, in float gammaFactor ) {\n return vec4( pow( value.xyz, vec3( gammaFactor ) ), value.w );\n}\nvec4 LinearToGamma( in vec4 value, in float gammaFactor ) {\n return vec4( pow( value.xyz, vec3( 1.0 / gammaFactor ) ), value.w );\n}\nvec4 sRGBToLinear( in vec4 value ) {\n return vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.w );\n}\nvec4 LinearTosRGB( in vec4 value ) {\n return vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.w );\n}\nvec4 RGBEToLinear( in vec4 value ) {\n return vec4( value.rgb * exp2( value.a * 255.0 - 128.0 ), 1.0 );\n}\nvec4 LinearToRGBE( in vec4 value ) {\n float maxComponent = max( max( value.r, value.g ), value.b );\n float fExp = clamp( ceil( log2( maxComponent ) ), -128.0, 127.0 );\n return vec4( value.rgb / exp2( fExp ), ( fExp + 128.0 ) / 255.0 );\n}\nvec4 RGBMToLinear( in vec4 value, in float maxRange ) {\n return vec4( value.xyz * value.w * maxRange, 1.0 );\n}\nvec4 LinearToRGBM( in vec4 value, in float maxRange ) {\n float maxRGB = max( value.x, max( value.g, value.b ) );\n float M = clamp( maxRGB / maxRange, 0.0, 1.0 );\n M = ceil( M * 255.0 ) / 255.0;\n return vec4( value.rgb / ( M * maxRange ), M );\n}\nvec4 RGBDToLinear( in vec4 value, in float maxRange ) {\n return vec4( value.rgb * ( ( maxRange / 255.0 ) / value.a ), 1.0 );\n}\nvec4 LinearToRGBD( in vec4 value, in float maxRange ) {\n float maxRGB = max( value.x, max( value.g, value.b ) );\n float D = max( maxRange / maxRGB, 1.0 );\n D = min( floor( D ) / 255.0, 1.0 );\n return vec4( value.rgb * ( D * ( 255.0 / maxRange ) ), D );\n}\nconst mat3 cLogLuvM = mat3( 0.2209, 0.3390, 0.4184, 0.1138, 0.6780, 0.7319, 0.0102, 0.1130, 0.2969 );\nvec4 LinearToLogLuv( in vec4 value ) {\n vec3 Xp_Y_XYZp = value.rgb * cLogLuvM;\n Xp_Y_XYZp = max(Xp_Y_XYZp, vec3(1e-6, 1e-6, 1e-6));\n vec4 vResult;\n vResult.xy = Xp_Y_XYZp.xy / Xp_Y_XYZp.z;\n float Le = 2.0 * log2(Xp_Y_XYZp.y) + 127.0;\n vResult.w = fract(Le);\n vResult.z = (Le - (floor(vResult.w*255.0))/255.0)/255.0;\n return vResult;\n}\nconst mat3 cLogLuvInverseM = mat3( 6.0014, -2.7008, -1.7996, -1.3320, 3.1029, -5.7721, 0.3008, -1.0882, 5.6268 );\nvec4 LogLuvToLinear( in vec4 value ) {\n float Le = value.z * 255.0 + value.w;\n vec3 Xp_Y_XYZp;\n Xp_Y_XYZp.y = exp2((Le - 127.0) / 2.0);\n Xp_Y_XYZp.z = Xp_Y_XYZp.y / value.y;\n Xp_Y_XYZp.x = value.x * Xp_Y_XYZp.z;\n vec3 vRGB = Xp_Y_XYZp.rgb * cLogLuvInverseM;\n return vec4( max(vRGB, 0.0), 1.0 );\n}\n", envmap_fragment:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\t\tvec3 cameraToVertex = normalize( vWorldPosition - cameraPosition );\n\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( cameraToVertex, worldNormal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( cameraToVertex, worldNormal, refractionRatio );\n\t\t#endif\n\t#else\n\t\tvec3 reflectVec = vReflect;\n\t#endif\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 envColor = textureCube( envMap, flipNormal * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n\t#elif defined( ENVMAP_TYPE_EQUIREC )\n\t\tvec2 sampleUV;\n\t\tsampleUV.y = saturate( flipNormal * reflectVec.y * 0.5 + 0.5 );\n\t\tsampleUV.x = atan( flipNormal * reflectVec.z, flipNormal * reflectVec.x ) * RECIPROCAL_PI2 + 0.5;\n\t\tvec4 envColor = texture2D( envMap, sampleUV );\n\t#elif defined( ENVMAP_TYPE_SPHERE )\n\t\tvec3 reflectView = flipNormal * normalize( ( viewMatrix * vec4( reflectVec, 0.0 ) ).xyz + vec3( 0.0, 0.0, 1.0 ) );\n\t\tvec4 envColor = texture2D( envMap, reflectView.xy * 0.5 + 0.5 );\n\t#else\n\t\tvec4 envColor = vec4( 0.0 );\n\t#endif\n\tenvColor = envMapTexelToLinear( envColor );\n\t#ifdef ENVMAP_BLENDING_MULTIPLY\n\t\toutgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_MIX )\n\t\toutgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_ADD )\n\t\toutgoingLight += envColor.xyz * specularStrength * reflectivity;\n\t#endif\n#endif\n",envmap_pars_fragment:"#if defined( USE_ENVMAP ) || defined( PHYSICAL )\n\tuniform float reflectivity;\n\tuniform float envMapIntenstiy;\n#endif\n#ifdef USE_ENVMAP\n\t#if ! defined( PHYSICAL ) && ( defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) )\n\t\tvarying vec3 vWorldPosition;\n\t#endif\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tuniform samplerCube envMap;\n\t#else\n\t\tuniform sampler2D envMap;\n\t#endif\n\tuniform float flipEnvMap;\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( PHYSICAL )\n\t\tuniform float refractionRatio;\n\t#else\n\t\tvarying vec3 vReflect;\n\t#endif\n#endif\n",envmap_pars_vertex:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\t\tvarying vec3 vWorldPosition;\n\t#else\n\t\tvarying vec3 vReflect;\n\t\tuniform float refractionRatio;\n\t#endif\n#endif\n",envmap_vertex:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\t\tvWorldPosition = worldPosition.xyz;\n\t#else\n\t\tvec3 cameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n\t\tvec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvReflect = reflect( cameraToVertex, worldNormal );\n\t\t#else\n\t\t\tvReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n\t\t#endif\n\t#endif\n#endif\n",fog_fragment:"#ifdef USE_FOG\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tfloat depth = gl_FragDepthEXT / gl_FragCoord.w;\n\t#else\n\t\tfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n\t#endif\n\t#ifdef FOG_EXP2\n\t\tfloat fogFactor = whiteCompliment( exp2( - fogDensity * fogDensity * depth * depth * LOG2 ) );\n\t#else\n\t\tfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n\t#endif\n\tgl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n#endif\n",fog_pars_fragment:"#ifdef USE_FOG\n\tuniform vec3 fogColor;\n\t#ifdef FOG_EXP2\n\t\tuniform float fogDensity;\n\t#else\n\t\tuniform float fogNear;\n\t\tuniform float fogFar;\n\t#endif\n#endif",lightmap_fragment:"#ifdef USE_LIGHTMAP\n\treflectedLight.indirectDiffuse += PI * texture2D( lightMap, vUv2 ).xyz * lightMapIntensity;\n#endif\n",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\n\tuniform sampler2D lightMap;\n\tuniform float lightMapIntensity;\n#endif",lights_lambert_vertex:"vec3 diffuse = vec3( 1.0 );\nGeometricContext geometry;\ngeometry.position = mvPosition.xyz;\ngeometry.normal = normalize( transformedNormal );\ngeometry.viewDir = normalize( -mvPosition.xyz );\nGeometricContext backGeometry;\nbackGeometry.position = geometry.position;\nbackGeometry.normal = -geometry.normal;\nbackGeometry.viewDir = geometry.viewDir;\nvLightFront = vec3( 0.0 );\n#ifdef DOUBLE_SIDED\n\tvLightBack = vec3( 0.0 );\n#endif\nIncidentLight directLight;\nfloat dotNL;\nvec3 directLightColor_Diffuse;\n#if NUM_POINT_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tgetPointDirectLightIrradiance( pointLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tgetSpotDirectLightIrradiance( spotLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n#endif\n#if NUM_DIR_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tgetDirectionalDirectLightIrradiance( directionalLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\tvLightFront += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += getHemisphereLightIrradiance( hemisphereLights[ i ], backGeometry );\n\t\t#endif\n\t}\n#endif\n",lights_pars:"uniform vec3 ambientLightColor;\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n\tvec3 irradiance = ambientLightColor;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treturn irradiance;\n}\n#if NUM_DIR_LIGHTS > 0\n\tstruct DirectionalLight {\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tint shadow;\n\t\tfloat shadowBias;\n\t\tfloat shadowRadius;\n\t\tvec2 shadowMapSize;\n\t};\n\tuniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n\tvoid getDirectionalDirectLightIrradiance( const in DirectionalLight directionalLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tdirectLight.color = directionalLight.color;\n\t\tdirectLight.direction = directionalLight.direction;\n\t\tdirectLight.visible = true;\n\t}\n#endif\n#if NUM_POINT_LIGHTS > 0\n\tstruct PointLight {\n\t\tvec3 position;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tint shadow;\n\t\tfloat shadowBias;\n\t\tfloat shadowRadius;\n\t\tvec2 shadowMapSize;\n\t};\n\tuniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n\tvoid getPointDirectLightIrradiance( const in PointLight pointLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tvec3 lVector = pointLight.position - geometry.position;\n\t\tdirectLight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tif ( testLightInRange( lightDistance, pointLight.distance ) ) {\n\t\t\tdirectLight.color = pointLight.color;\n\t\t\tdirectLight.color *= punctualLightIntensityToIrradianceFactor( lightDistance, pointLight.distance, pointLight.decay );\n\t\t\tdirectLight.visible = true;\n\t\t} else {\n\t\t\tdirectLight.color = vec3( 0.0 );\n\t\t\tdirectLight.visible = false;\n\t\t}\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\tstruct SpotLight {\n\t\tvec3 position;\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tfloat coneCos;\n\t\tfloat penumbraCos;\n\t\tint shadow;\n\t\tfloat shadowBias;\n\t\tfloat shadowRadius;\n\t\tvec2 shadowMapSize;\n\t};\n\tuniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n\tvoid getSpotDirectLightIrradiance( const in SpotLight spotLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tvec3 lVector = spotLight.position - geometry.position;\n\t\tdirectLight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tfloat angleCos = dot( directLight.direction, spotLight.direction );\n\t\tif ( all( bvec2( angleCos > spotLight.coneCos, testLightInRange( lightDistance, spotLight.distance ) ) ) ) {\n\t\t\tfloat spotEffect = smoothstep( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n\t\t\tdirectLight.color = spotLight.color;\n\t\t\tdirectLight.color *= spotEffect * punctualLightIntensityToIrradianceFactor( lightDistance, spotLight.distance, spotLight.decay );\n\t\t\tdirectLight.visible = true;\n\t\t} else {\n\t\t\tdirectLight.color = vec3( 0.0 );\n\t\t\tdirectLight.visible = false;\n\t\t}\n\t}\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\tstruct HemisphereLight {\n\t\tvec3 direction;\n\t\tvec3 skyColor;\n\t\tvec3 groundColor;\n\t};\n\tuniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n\tvec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in GeometricContext geometry ) {\n\t\tfloat dotNL = dot( geometry.normal, hemiLight.direction );\n\t\tfloat hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n\t\tvec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tirradiance *= PI;\n\t\t#endif\n\t\treturn irradiance;\n\t}\n#endif\n#if defined( USE_ENVMAP ) && defined( PHYSICAL )\n\tvec3 getLightProbeIndirectIrradiance( const in GeometricContext geometry, const in int maxMIPLevel ) {\n\t\t#include <normal_flip>\n\t\tvec3 worldNormal = inverseTransformDirection( geometry.normal, viewMatrix );\n\t\t#ifdef ENVMAP_TYPE_CUBE\n\t\t\tvec3 queryVec = flipNormal * vec3( flipEnvMap * worldNormal.x, worldNormal.yz );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = textureCubeLodEXT( envMap, queryVec, float( maxMIPLevel ) );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = textureCube( envMap, queryVec, float( maxMIPLevel ) );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec3 queryVec = flipNormal * vec3( flipEnvMap * worldNormal.x, worldNormal.yz );\n\t\t\tvec4 envMapColor = textureCubeUV( queryVec, 1.0 );\n\t\t#else\n\t\t\tvec4 envMapColor = vec4( 0.0 );\n\t\t#endif\n\t\treturn PI * envMapColor.rgb * envMapIntensity;\n\t}\n\tfloat getSpecularMIPLevel( const in float blinnShininessExponent, const in int maxMIPLevel ) {\n\t\tfloat maxMIPLevelScalar = float( maxMIPLevel );\n\t\tfloat desiredMIPLevel = maxMIPLevelScalar - 0.79248 - 0.5 * log2( pow2( blinnShininessExponent ) + 1.0 );\n\t\treturn clamp( desiredMIPLevel, 0.0, maxMIPLevelScalar );\n\t}\n\tvec3 getLightProbeIndirectRadiance( const in GeometricContext geometry, const in float blinnShininessExponent, const in int maxMIPLevel ) {\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( -geometry.viewDir, geometry.normal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( -geometry.viewDir, geometry.normal, refractionRatio );\n\t\t#endif\n\t\t#include <normal_flip>\n\t\treflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n\t\tfloat specularMIPLevel = getSpecularMIPLevel( blinnShininessExponent, maxMIPLevel );\n\t\t#ifdef ENVMAP_TYPE_CUBE\n\t\t\tvec3 queryReflectVec = flipNormal * vec3( flipEnvMap * reflectVec.x, reflectVec.yz );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = textureCubeLodEXT( envMap, queryReflectVec, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = textureCube( envMap, queryReflectVec, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec3 queryReflectVec = flipNormal * vec3( flipEnvMap * reflectVec.x, reflectVec.yz );\n\t\t\tvec4 envMapColor = textureCubeUV(queryReflectVec, BlinnExponentToGGXRoughness(blinnShininessExponent));\n\t\t#elif defined( ENVMAP_TYPE_EQUIREC )\n\t\t\tvec2 sampleUV;\n\t\t\tsampleUV.y = saturate( flipNormal * reflectVec.y * 0.5 + 0.5 );\n\t\t\tsampleUV.x = atan( flipNormal * reflectVec.z, flipNormal * reflectVec.x ) * RECIPROCAL_PI2 + 0.5;\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = texture2DLodEXT( envMap, sampleUV, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = texture2D( envMap, sampleUV, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_SPHERE )\n\t\t\tvec3 reflectView = flipNormal * normalize( ( viewMatrix * vec4( reflectVec, 0.0 ) ).xyz + vec3( 0.0,0.0,1.0 ) );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = texture2DLodEXT( envMap, reflectView.xy * 0.5 + 0.5, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = texture2D( envMap, reflectView.xy * 0.5 + 0.5, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#endif\n\t\treturn envMapColor.rgb * envMapIntensity;\n\t}\n#endif\n",lights_phong_fragment:"BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;\n",lights_phong_pars_fragment:"varying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\nstruct BlinnPhongMaterial {\n\tvec3\tdiffuseColor;\n\tvec3\tspecularColor;\n\tfloat\tspecularShininess;\n\tfloat\tspecularStrength;\n};\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treflectedLight.directDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n\treflectedLight.directSpecular += irradiance * BRDF_Specular_BlinnPhong( directLight, geometry, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_BlinnPhong\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_BlinnPhong\n#define Material_LightProbeLOD( material )\t(0)\n",lights_physical_fragment:"PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nmaterial.specularRoughness = clamp( roughnessFactor, 0.04, 1.0 );\n#ifdef STANDARD\n\tmaterial.specularColor = mix( vec3( DEFAULT_SPECULAR_COEFFICIENT ), diffuseColor.rgb, metalnessFactor );\n#else\n\tmaterial.specularColor = mix( vec3( MAXIMUM_SPECULAR_COEFFICIENT * pow2( reflectivity ) ), diffuseColor.rgb, metalnessFactor );\n\tmaterial.clearCoat = saturate( clearCoat );\tmaterial.clearCoatRoughness = clamp( clearCoatRoughness, 0.04, 1.0 );\n#endif\n",lights_physical_pars_fragment:"struct PhysicalMaterial {\n\tvec3\tdiffuseColor;\n\tfloat\tspecularRoughness;\n\tvec3\tspecularColor;\n\t#ifndef STANDARD\n\t\tfloat clearCoat;\n\t\tfloat clearCoatRoughness;\n\t#endif\n};\n#define MAXIMUM_SPECULAR_COEFFICIENT 0.16\n#define DEFAULT_SPECULAR_COEFFICIENT 0.04\nfloat clearCoatDHRApprox( const in float roughness, const in float dotNL ) {\n\treturn DEFAULT_SPECULAR_COEFFICIENT + ( 1.0 - DEFAULT_SPECULAR_COEFFICIENT ) * ( pow( 1.0 - dotNL, 5.0 ) * pow( 1.0 - roughness, 2.0 ) );\n}\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\t#ifndef STANDARD\n\t\tfloat clearCoatDHR = material.clearCoat * clearCoatDHRApprox( material.clearCoatRoughness, dotNL );\n\t#else\n\t\tfloat clearCoatDHR = 0.0;\n\t#endif\n\treflectedLight.directSpecular += ( 1.0 - clearCoatDHR ) * irradiance * BRDF_Specular_GGX( directLight, geometry, material.specularColor, material.specularRoughness );\n\treflectedLight.directDiffuse += ( 1.0 - clearCoatDHR ) * irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n\t#ifndef STANDARD\n\t\treflectedLight.directSpecular += irradiance * material.clearCoat * BRDF_Specular_GGX( directLight, geometry, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearCoatRoughness );\n\t#endif\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 clearCoatRadiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t#ifndef STANDARD\n\t\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\t\tfloat dotNL = dotNV;\n\t\tfloat clearCoatDHR = material.clearCoat * clearCoatDHRApprox( material.clearCoatRoughness, dotNL );\n\t#else\n\t\tfloat clearCoatDHR = 0.0;\n\t#endif\n\treflectedLight.indirectSpecular += ( 1.0 - clearCoatDHR ) * radiance * BRDF_Specular_GGX_Environment( geometry, material.specularColor, material.specularRoughness );\n\t#ifndef STANDARD\n\t\treflectedLight.indirectSpecular += clearCoatRadiance * material.clearCoat * BRDF_Specular_GGX_Environment( geometry, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearCoatRoughness );\n\t#endif\n}\n#define RE_Direct\t\t\t\tRE_Direct_Physical\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular\t\tRE_IndirectSpecular_Physical\n#define Material_BlinnShininessExponent( material ) GGXRoughnessToBlinnExponent( material.specularRoughness )\n#define Material_ClearCoat_BlinnShininessExponent( material ) GGXRoughnessToBlinnExponent( material.clearCoatRoughness )\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n\treturn saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}\n",lights_template:"\nGeometricContext geometry;\ngeometry.position = - vViewPosition;\ngeometry.normal = normal;\ngeometry.viewDir = normalize( vViewPosition );\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n\tPointLight pointLight;\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tgetPointDirectLightIrradiance( pointLight, geometry, directLight );\n\t\t#ifdef USE_SHADOWMAP\n\t\tdirectLight.color *= all( bvec2( pointLight.shadow, directLight.visible ) ) ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n\tSpotLight spotLight;\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tgetSpotDirectLightIrradiance( spotLight, geometry, directLight );\n\t\t#ifdef USE_SHADOWMAP\n\t\tdirectLight.color *= all( bvec2( spotLight.shadow, directLight.visible ) ) ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n\tDirectionalLight directionalLight;\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tgetDirectionalDirectLightIrradiance( directionalLight, geometry, directLight );\n\t\t#ifdef USE_SHADOWMAP\n\t\tdirectLight.color *= all( bvec2( directionalLight.shadow, directLight.visible ) ) ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if defined( RE_IndirectDiffuse )\n\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n\t#ifdef USE_LIGHTMAP\n\t\tvec3 lightMapIrradiance = texture2D( lightMap, vUv2 ).xyz * lightMapIntensity;\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tlightMapIrradiance *= PI;\n\t\t#endif\n\t\tirradiance += lightMapIrradiance;\n\t#endif\n\t#if ( NUM_HEMI_LIGHTS > 0 )\n\t\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\t\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\t\t}\n\t#endif\n\t#if defined( USE_ENVMAP ) && defined( PHYSICAL ) && defined( ENVMAP_TYPE_CUBE_UV )\n\t \tirradiance += getLightProbeIndirectIrradiance( geometry, 8 );\n\t#endif\n\tRE_IndirectDiffuse( irradiance, geometry, material, reflectedLight );\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\tvec3 radiance = getLightProbeIndirectRadiance( geometry, Material_BlinnShininessExponent( material ), 8 );\n\t#ifndef STANDARD\n\t\tvec3 clearCoatRadiance = getLightProbeIndirectRadiance( geometry, Material_ClearCoat_BlinnShininessExponent( material ), 8 );\n\t#else\n\t\tvec3 clearCoatRadiance = vec3( 0.0 );\n\t#endif\n\t\t\n\tRE_IndirectSpecular( radiance, clearCoatRadiance, geometry, material, reflectedLight );\n#endif\n",logdepthbuf_fragment:"#if defined(USE_LOGDEPTHBUF) && defined(USE_LOGDEPTHBUF_EXT)\n\tgl_FragDepthEXT = log2(vFragDepth) * logDepthBufFC * 0.5;\n#endif",logdepthbuf_pars_fragment:"#ifdef USE_LOGDEPTHBUF\n\tuniform float logDepthBufFC;\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvarying float vFragDepth;\n\t#endif\n#endif\n",logdepthbuf_pars_vertex:"#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvarying float vFragDepth;\n\t#endif\n\tuniform float logDepthBufFC;\n#endif",logdepthbuf_vertex:"#ifdef USE_LOGDEPTHBUF\n\tgl_Position.z = log2(max( EPSILON, gl_Position.w + 1.0 )) * logDepthBufFC;\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvFragDepth = 1.0 + gl_Position.w;\n\t#else\n\t\tgl_Position.z = (gl_Position.z - 1.0) * gl_Position.w;\n\t#endif\n#endif\n",map_fragment:"#ifdef USE_MAP\n\tvec4 texelColor = texture2D( map, vUv );\n\ttexelColor = mapTexelToLinear( texelColor );\n\tdiffuseColor *= texelColor;\n#endif\n",map_pars_fragment:"#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif\n",map_particle_fragment:"#ifdef USE_MAP\n\tvec4 mapTexel = texture2D( map, vec2( gl_PointCoord.x, 1.0 - gl_PointCoord.y ) * offsetRepeat.zw + offsetRepeat.xy );\n\tdiffuseColor *= mapTexelToLinear( mapTexel );\n#endif\n",map_particle_pars_fragment:"#ifdef USE_MAP\n\tuniform vec4 offsetRepeat;\n\tuniform sampler2D map;\n#endif\n",metalnessmap_fragment:"float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n\tvec4 texelMetalness = texture2D( metalnessMap, vUv );\n\tmetalnessFactor *= texelMetalness.r;\n#endif\n",metalnessmap_pars_fragment:"#ifdef USE_METALNESSMAP\n\tuniform sampler2D metalnessMap;\n#endif",morphnormal_vertex:"#ifdef USE_MORPHNORMALS\n\tobjectNormal += ( morphNormal0 - normal ) * morphTargetInfluences[ 0 ];\n\tobjectNormal += ( morphNormal1 - normal ) * morphTargetInfluences[ 1 ];\n\tobjectNormal += ( morphNormal2 - normal ) * morphTargetInfluences[ 2 ];\n\tobjectNormal += ( morphNormal3 - normal ) * morphTargetInfluences[ 3 ];\n#endif\n",morphtarget_pars_vertex:"#ifdef USE_MORPHTARGETS\n\t#ifndef USE_MORPHNORMALS\n\tuniform float morphTargetInfluences[ 8 ];\n\t#else\n\tuniform float morphTargetInfluences[ 4 ];\n\t#endif\n#endif",morphtarget_vertex:"#ifdef USE_MORPHTARGETS\n\ttransformed += ( morphTarget0 - position ) * morphTargetInfluences[ 0 ];\n\ttransformed += ( morphTarget1 - position ) * morphTargetInfluences[ 1 ];\n\ttransformed += ( morphTarget2 - position ) * morphTargetInfluences[ 2 ];\n\ttransformed += ( morphTarget3 - position ) * morphTargetInfluences[ 3 ];\n\t#ifndef USE_MORPHNORMALS\n\ttransformed += ( morphTarget4 - position ) * morphTargetInfluences[ 4 ];\n\ttransformed += ( morphTarget5 - position ) * morphTargetInfluences[ 5 ];\n\ttransformed += ( morphTarget6 - position ) * morphTargetInfluences[ 6 ];\n\ttransformed += ( morphTarget7 - position ) * morphTargetInfluences[ 7 ];\n\t#endif\n#endif\n",normal_flip:"#ifdef DOUBLE_SIDED\n\tfloat flipNormal = ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n#else\n\tfloat flipNormal = 1.0;\n#endif\n",normal_fragment:"#ifdef FLAT_SHADED\n\tvec3 fdx = vec3( dFdx( vViewPosition.x ), dFdx( vViewPosition.y ), dFdx( vViewPosition.z ) );\n\tvec3 fdy = vec3( dFdy( vViewPosition.x ), dFdy( vViewPosition.y ), dFdy( vViewPosition.z ) );\n\tvec3 normal = normalize( cross( fdx, fdy ) );\n#else\n\tvec3 normal = normalize( vNormal ) * flipNormal;\n#endif\n#ifdef USE_NORMALMAP\n\tnormal = perturbNormal2Arb( -vViewPosition, normal );\n#elif defined( USE_BUMPMAP )\n\tnormal = perturbNormalArb( -vViewPosition, normal, dHdxy_fwd() );\n#endif\n",normalmap_pars_fragment:"#ifdef USE_NORMALMAP\n\tuniform sampler2D normalMap;\n\tuniform vec2 normalScale;\n\tvec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm ) {\n\t\tvec3 q0 = dFdx( eye_pos.xyz );\n\t\tvec3 q1 = dFdy( eye_pos.xyz );\n\t\tvec2 st0 = dFdx( vUv.st );\n\t\tvec2 st1 = dFdy( vUv.st );\n\t\tvec3 S = normalize( q0 * st1.t - q1 * st0.t );\n\t\tvec3 T = normalize( -q0 * st1.s + q1 * st0.s );\n\t\tvec3 N = normalize( surf_norm );\n\t\tvec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\t\tmapN.xy = normalScale * mapN.xy;\n\t\tmat3 tsn = mat3( S, T, N );\n\t\treturn normalize( tsn * mapN );\n\t}\n#endif\n",packing:"vec3 packNormalToRGB( const in vec3 normal ) {\n return normalize( normal ) * 0.5 + 0.5;\n}\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\n return 1.0 - 2.0 * rgb.xyz;\n}\nconst float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;\nconst vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );\nconst vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. );\nconst float ShiftRight8 = 1. / 256.;\nvec4 packDepthToRGBA( const in float v ) {\n\tvec4 r = vec4( fract( v * PackFactors ), v );\n\tr.yzw -= r.xyz * ShiftRight8;\treturn r * PackUpscale;\n}\nfloat unpackRGBAToDepth( const in vec4 v ) {\n\treturn dot( v, UnpackFactors );\n}\nfloat viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {\n return ( viewZ + near ) / ( near - far );\n}\nfloat orthographicDepthToViewZ( const in float linearClipZ, const in float near, const in float far ) {\n return linearClipZ * ( near - far ) - near;\n}\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\n return (( near + viewZ ) * far ) / (( far - near ) * viewZ );\n}\nfloat perspectiveDepthToViewZ( const in float invClipZ, const in float near, const in float far ) {\n return ( near * far ) / ( ( far - near ) * invClipZ - far );\n}\n",premultiplied_alpha_fragment:"#ifdef PREMULTIPLIED_ALPHA\n\tgl_FragColor.rgb *= gl_FragColor.a;\n#endif\n",project_vertex:"#ifdef USE_SKINNING\n\tvec4 mvPosition = modelViewMatrix * skinned;\n#else\n\tvec4 mvPosition = modelViewMatrix * vec4( transformed, 1.0 );\n#endif\ngl_Position = projectionMatrix * mvPosition;\n",roughnessmap_fragment:"float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n\tvec4 texelRoughness = texture2D( roughnessMap, vUv );\n\troughnessFactor *= texelRoughness.r;\n#endif\n",roughnessmap_pars_fragment:"#ifdef USE_ROUGHNESSMAP\n\tuniform sampler2D roughnessMap;\n#endif", shadowmap_pars_fragment:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHTS > 0\n\t\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHTS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHTS ];\n\t#endif\n\t#if NUM_SPOT_LIGHTS > 0\n\t\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHTS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHTS ];\n\t#endif\n\t#if NUM_POINT_LIGHTS > 0\n\t\tuniform sampler2D pointShadowMap[ NUM_POINT_LIGHTS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHTS ];\n\t#endif\n\tfloat texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n\t\treturn step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\n\t}\n\tfloat texture2DShadowLerp( sampler2D depths, vec2 size, vec2 uv, float compare ) {\n\t\tconst vec2 offset = vec2( 0.0, 1.0 );\n\t\tvec2 texelSize = vec2( 1.0 ) / size;\n\t\tvec2 centroidUV = floor( uv * size + 0.5 ) / size;\n\t\tfloat lb = texture2DCompare( depths, centroidUV + texelSize * offset.xx, compare );\n\t\tfloat lt = texture2DCompare( depths, centroidUV + texelSize * offset.xy, compare );\n\t\tfloat rb = texture2DCompare( depths, centroidUV + texelSize * offset.yx, compare );\n\t\tfloat rt = texture2DCompare( depths, centroidUV + texelSize * offset.yy, compare );\n\t\tvec2 f = fract( uv * size + 0.5 );\n\t\tfloat a = mix( lb, lt, f.y );\n\t\tfloat b = mix( rb, rt, f.y );\n\t\tfloat c = mix( a, b, f.x );\n\t\treturn c;\n\t}\n\tfloat getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\t\tshadowCoord.xyz /= shadowCoord.w;\n\t\tshadowCoord.z += shadowBias;\n\t\tbvec4 inFrustumVec = bvec4 ( shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0 );\n\t\tbool inFrustum = all( inFrustumVec );\n\t\tbvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 );\n\t\tbool frustumTest = all( frustumTestVec );\n\t\tif ( frustumTest ) {\n\t\t#if defined( SHADOWMAP_TYPE_PCF )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx0 = - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 = - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 = + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 = + texelSize.y * shadowRadius;\n\t\t\treturn (\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx0 = - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 = - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 = + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 = + texelSize.y * shadowRadius;\n\t\t\treturn (\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#else\n\t\t\treturn texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#endif\n\t\t}\n\t\treturn 1.0;\n\t}\n\tvec2 cubeToUV( vec3 v, float texelSizeY ) {\n\t\tvec3 absV = abs( v );\n\t\tfloat scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );\n\t\tabsV *= scaleToCube;\n\t\tv *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );\n\t\tvec2 planar = v.xy;\n\t\tfloat almostATexel = 1.5 * texelSizeY;\n\t\tfloat almostOne = 1.0 - almostATexel;\n\t\tif ( absV.z >= almostOne ) {\n\t\t\tif ( v.z > 0.0 )\n\t\t\t\tplanar.x = 4.0 - v.x;\n\t\t} else if ( absV.x >= almostOne ) {\n\t\t\tfloat signX = sign( v.x );\n\t\t\tplanar.x = v.z * signX + 2.0 * signX;\n\t\t} else if ( absV.y >= almostOne ) {\n\t\t\tfloat signY = sign( v.y );\n\t\t\tplanar.x = v.x + 2.0 * signY + 2.0;\n\t\t\tplanar.y = v.z * signY - 2.0;\n\t\t}\n\t\treturn vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );\n\t}\n\tfloat getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\t\tvec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\n\t\tvec3 lightToPosition = shadowCoord.xyz;\n\t\tvec3 bd3D = normalize( lightToPosition );\n\t\tfloat dp = ( length( lightToPosition ) - shadowBias ) / 1000.0;\n\t\t#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT )\n\t\t\tvec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;\n\t\t\treturn (\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#else\n\t\t\treturn texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\n\t\t#endif\n\t}\n#endif\n",shadowmap_pars_vertex:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHTS > 0\n\t\tuniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHTS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHTS ];\n\t#endif\n\t#if NUM_SPOT_LIGHTS > 0\n\t\tuniform mat4 spotShadowMatrix[ NUM_SPOT_LIGHTS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHTS ];\n\t#endif\n\t#if NUM_POINT_LIGHTS > 0\n\t\tuniform mat4 pointShadowMatrix[ NUM_POINT_LIGHTS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHTS ];\n\t#endif\n#endif\n",shadowmap_vertex:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tvDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * worldPosition;\n\t}\n\t#endif\n\t#if NUM_SPOT_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tvSpotShadowCoord[ i ] = spotShadowMatrix[ i ] * worldPosition;\n\t}\n\t#endif\n\t#if NUM_POINT_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tvPointShadowCoord[ i ] = pointShadowMatrix[ i ] * worldPosition;\n\t}\n\t#endif\n#endif\n",shadowmask_pars_fragment:"float getShadowMask() {\n\tfloat shadow = 1.0;\n\t#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHTS > 0\n\tDirectionalLight directionalLight;\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tshadow *= bool( directionalLight.shadow ) ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t}\n\t#endif\n\t#if NUM_SPOT_LIGHTS > 0\n\tSpotLight spotLight;\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tshadow *= bool( spotLight.shadow ) ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t}\n\t#endif\n\t#if NUM_POINT_LIGHTS > 0\n\tPointLight pointLight;\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tshadow *= bool( pointLight.shadow ) ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ] ) : 1.0;\n\t}\n\t#endif\n\t#endif\n\treturn shadow;\n}\n",skinbase_vertex:"#ifdef USE_SKINNING\n\tmat4 boneMatX = getBoneMatrix( skinIndex.x );\n\tmat4 boneMatY = getBoneMatrix( skinIndex.y );\n\tmat4 boneMatZ = getBoneMatrix( skinIndex.z );\n\tmat4 boneMatW = getBoneMatrix( skinIndex.w );\n#endif",skinning_pars_vertex:"#ifdef USE_SKINNING\n\tuniform mat4 bindMatrix;\n\tuniform mat4 bindMatrixInverse;\n\t#ifdef BONE_TEXTURE\n\t\tuniform sampler2D boneTexture;\n\t\tuniform int boneTextureWidth;\n\t\tuniform int boneTextureHeight;\n\t\tmat4 getBoneMatrix( const in float i ) {\n\t\t\tfloat j = i * 4.0;\n\t\t\tfloat x = mod( j, float( boneTextureWidth ) );\n\t\t\tfloat y = floor( j / float( boneTextureWidth ) );\n\t\t\tfloat dx = 1.0 / float( boneTextureWidth );\n\t\t\tfloat dy = 1.0 / float( boneTextureHeight );\n\t\t\ty = dy * ( y + 0.5 );\n\t\t\tvec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );\n\t\t\tvec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );\n\t\t\tvec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );\n\t\t\tvec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );\n\t\t\tmat4 bone = mat4( v1, v2, v3, v4 );\n\t\t\treturn bone;\n\t\t}\n\t#else\n\t\tuniform mat4 boneMatrices[ MAX_BONES ];\n\t\tmat4 getBoneMatrix( const in float i ) {\n\t\t\tmat4 bone = boneMatrices[ int(i) ];\n\t\t\treturn bone;\n\t\t}\n\t#endif\n#endif\n",skinning_vertex:"#ifdef USE_SKINNING\n\tvec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\n\tvec4 skinned = vec4( 0.0 );\n\tskinned += boneMatX * skinVertex * skinWeight.x;\n\tskinned += boneMatY * skinVertex * skinWeight.y;\n\tskinned += boneMatZ * skinVertex * skinWeight.z;\n\tskinned += boneMatW * skinVertex * skinWeight.w;\n\tskinned = bindMatrixInverse * skinned;\n#endif\n",skinnormal_vertex:"#ifdef USE_SKINNING\n\tmat4 skinMatrix = mat4( 0.0 );\n\tskinMatrix += skinWeight.x * boneMatX;\n\tskinMatrix += skinWeight.y * boneMatY;\n\tskinMatrix += skinWeight.z * boneMatZ;\n\tskinMatrix += skinWeight.w * boneMatW;\n\tskinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;\n\tobjectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n#endif\n",specularmap_fragment:"float specularStrength;\n#ifdef USE_SPECULARMAP\n\tvec4 texelSpecular = texture2D( specularMap, vUv );\n\tspecularStrength = texelSpecular.r;\n#else\n\tspecularStrength = 1.0;\n#endif",specularmap_pars_fragment:"#ifdef USE_SPECULARMAP\n\tuniform sampler2D specularMap;\n#endif",tonemapping_fragment:"#if defined( TONE_MAPPING )\n gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif\n",tonemapping_pars_fragment:"#define saturate(a) clamp( a, 0.0, 1.0 )\nuniform float toneMappingExposure;\nuniform float toneMappingWhitePoint;\nvec3 LinearToneMapping( vec3 color ) {\n return toneMappingExposure * color;\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n color *= toneMappingExposure;\n return saturate( color / ( vec3( 1.0 ) + color ) );\n}\n#define Uncharted2Helper( x ) max( ( ( x * ( 0.15 * x + 0.10 * 0.50 ) + 0.20 * 0.02 ) / ( x * ( 0.15 * x + 0.50 ) + 0.20 * 0.30 ) ) - 0.02 / 0.30, vec3( 0.0 ) )\nvec3 Uncharted2ToneMapping( vec3 color ) {\n color *= toneMappingExposure;\n return saturate( Uncharted2Helper( color ) / Uncharted2Helper( vec3( toneMappingWhitePoint ) ) );\n}\nvec3 OptimizedCineonToneMapping( vec3 color ) {\n color *= toneMappingExposure;\n color = max( vec3( 0.0 ), color - 0.004 );\n return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\n",uv_pars_fragment:"#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP ) || defined( USE_EMISSIVEMAP ) || defined( USE_ROUGHNESSMAP ) || defined( USE_METALNESSMAP )\n\tvarying vec2 vUv;\n#endif",uv_pars_vertex:"#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP ) || defined( USE_EMISSIVEMAP ) || defined( USE_ROUGHNESSMAP ) || defined( USE_METALNESSMAP )\n\tvarying vec2 vUv;\n\tuniform vec4 offsetRepeat;\n#endif\n",uv_vertex:"#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP ) || defined( USE_EMISSIVEMAP ) || defined( USE_ROUGHNESSMAP ) || defined( USE_METALNESSMAP )\n\tvUv = uv * offsetRepeat.zw + offsetRepeat.xy;\n#endif",uv2_pars_fragment:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvarying vec2 vUv2;\n#endif",uv2_pars_vertex:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tattribute vec2 uv2;\n\tvarying vec2 vUv2;\n#endif",uv2_vertex:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvUv2 = uv2;\n#endif",worldpos_vertex:"#if defined( USE_ENVMAP ) || defined( PHONG ) || defined( PHYSICAL ) || defined( LAMBERT ) || defined ( USE_SHADOWMAP )\n\t#ifdef USE_SKINNING\n\t\tvec4 worldPosition = modelMatrix * skinned;\n\t#else\n\t\tvec4 worldPosition = modelMatrix * vec4( transformed, 1.0 );\n\t#endif\n#endif\n",cube_frag:"uniform samplerCube tCube;\nuniform float tFlip;\nuniform float opacity;\nvarying vec3 vWorldPosition;\n#include <common>\nvoid main() {\n\tgl_FragColor = textureCube( tCube, vec3( tFlip * vWorldPosition.x, vWorldPosition.yz ) );\n\tgl_FragColor.a *= opacity;\n}\n",cube_vert:"varying vec3 vWorldPosition;\n#include <common>\nvoid main() {\n\tvWorldPosition = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n}\n",depth_frag:"#if DEPTH_PACKING == 3200\n\tuniform float opacity;\n#endif\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#if DEPTH_PACKING == 3200\n\t\tdiffuseColor.a = opacity;\n\t#endif\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <logdepthbuf_fragment>\n\t#if DEPTH_PACKING == 3200\n\t\tgl_FragColor = vec4( vec3( gl_FragCoord.z ), opacity );\n\t#elif DEPTH_PACKING == 3201\n\t\tgl_FragColor = packDepthToRGBA( gl_FragCoord.z );\n\t#endif\n}\n",depth_vert:"#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <skinbase_vertex>\n\t#include <begin_vertex>\n\t#include <displacementmap_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n}\n",distanceRGBA_frag:"uniform vec3 lightPos;\nvarying vec4 vWorldPosition;\n#include <common>\n#include <packing>\n#include <clipping_planes_pars_fragment>\nvoid main () {\n\t#include <clipping_planes_fragment>\n\tgl_FragColor = packDepthToRGBA( length( vWorldPosition.xyz - lightPos.xyz ) / 1000.0 );\n}\n",distanceRGBA_vert:"varying vec4 vWorldPosition;\n#include <common>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <skinbase_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <worldpos_vertex>\n\t#include <clipping_planes_vertex>\n\tvWorldPosition = worldPosition;\n}\n",equirect_frag:"uniform sampler2D tEquirect;\nuniform float tFlip;\nvarying vec3 vWorldPosition;\n#include <common>\nvoid main() {\n\tvec3 direction = normalize( vWorldPosition );\n\tvec2 sampleUV;\n\tsampleUV.y = saturate( tFlip * direction.y * -0.5 + 0.5 );\n\tsampleUV.x = atan( direction.z, direction.x ) * RECIPROCAL_PI2 + 0.5;\n\tgl_FragColor = texture2D( tEquirect, sampleUV );\n}\n",equirect_vert:"varying vec3 vWorldPosition;\n#include <common>\nvoid main() {\n\tvWorldPosition = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n}\n",linedashed_frag:"uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;\n#include <common>\n#include <color_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tif ( mod( vLineDistance, totalSize ) > dashSize ) {\n\t\tdiscard;\n\t}\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <color_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <premultiplied_alpha_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n}\n",linedashed_vert:"uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include <common>\n#include <color_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <color_vertex>\n\tvLineDistance = scale * lineDistance;\n\tvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n\tgl_Position = projectionMatrix * mvPosition;\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n}\n",meshbasic_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\tReflectedLight reflectedLight;\n\treflectedLight.directDiffuse = vec3( 0.0 );\n\treflectedLight.directSpecular = vec3( 0.0 );\n\treflectedLight.indirectDiffuse = diffuseColor.rgb;\n\treflectedLight.indirectSpecular = vec3( 0.0 );\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.indirectDiffuse;\n\t#include <normal_flip>\n\t#include <envmap_fragment>\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <premultiplied_alpha_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n}\n",meshbasic_vert:"#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <skinbase_vertex>\n\t#ifdef USE_ENVMAP\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <worldpos_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <envmap_vertex>\n}\n",meshlambert_frag:"uniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\nvarying vec3 vLightFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n#endif\n#include <common>\n#include <packing>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_pars_fragment>\n#include <bsdfs>\n#include <lights_pars>\n#include <fog_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\t#include <emissivemap_fragment>\n\treflectedLight.indirectDiffuse = getAmbientLightIrradiance( ambientLightColor );\n\t#include <lightmap_fragment>\n\treflectedLight.indirectDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb );\n\t#ifdef DOUBLE_SIDED\n\t\treflectedLight.directDiffuse = ( gl_FrontFacing ) ? vLightFront : vLightBack;\n\t#else\n\t\treflectedLight.directDiffuse = vLightFront;\n\t#endif\n\treflectedLight.directDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb ) * getShadowMask();\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include <normal_flip>\n\t#include <envmap_fragment>\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <premultiplied_alpha_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n}\n",meshlambert_vert:"#define LAMBERT\nvarying vec3 vLightFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <envmap_pars_vertex>\n#include <bsdfs>\n#include <lights_pars>\n#include <color_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <lights_lambert_vertex>\n\t#include <shadowmap_vertex>\n}\n",meshphong_frag:"#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars>\n#include <lights_phong_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\t#include <normal_flip>\n\t#include <normal_fragment>\n\t#include <emissivemap_fragment>\n\t#include <lights_phong_fragment>\n\t#include <lights_template>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\t#include <envmap_fragment>\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <premultiplied_alpha_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n}\n",meshphong_vert:"#define PHONG\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n#endif\n\t#include <begin_vertex>\n\t#include <displacementmap_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <shadowmap_vertex>\n}\n",meshphysical_frag:"#define PHYSICAL\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifndef STANDARD\n\tuniform float clearCoat;\n\tuniform float clearCoatRoughness;\n#endif\nuniform float envMapIntensity;\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <packing>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <cube_uv_reflection_fragment>\n#include <lights_pars>\n#include <lights_physical_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <roughnessmap_pars_fragment>\n#include <metalnessmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\t#include <roughnessmap_fragment>\n\t#include <metalnessmap_fragment>\n\t#include <normal_flip>\n\t#include <normal_fragment>\n\t#include <emissivemap_fragment>\n\t#include <lights_physical_fragment>\n\t#include <lights_template>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <premultiplied_alpha_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n}\n",meshphysical_vert:"#define PHYSICAL\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n#endif\n\t#include <begin_vertex>\n\t#include <displacementmap_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n}\n",normal_frag:"uniform float opacity;\nvarying vec3 vNormal;\n#include <common>\n#include <packing>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tgl_FragColor = vec4( packNormalToRGB( vNormal ), opacity );\n\t#include <logdepthbuf_fragment>\n}\n",normal_vert:"varying vec3 vNormal;\n#include <common>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\tvNormal = normalize( normalMatrix * normal );\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n}\n",points_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <color_pars_fragment>\n#include <map_particle_pars_fragment>\n#include <fog_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_particle_fragment>\n\t#include <color_fragment>\n\t#include <alphatest_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <premultiplied_alpha_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n}\n", points_vert:"uniform float size;\nuniform float scale;\n#include <common>\n#include <color_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <color_vertex>\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\t#ifdef USE_SIZEATTENUATION\n\t\tgl_PointSize = size * ( scale / - mvPosition.z );\n\t#else\n\t\tgl_PointSize = size;\n\t#endif\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n}\n",shadow_frag:"uniform float opacity;\n#include <common>\n#include <packing>\n#include <bsdfs>\n#include <lights_pars>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\nvoid main() {\n\tgl_FragColor = vec4( 0.0, 0.0, 0.0, opacity * ( 1.0 - getShadowMask() ) );\n}\n",shadow_vert:"#include <shadowmap_pars_vertex>\nvoid main() {\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n}\n"};Q.prototype={constructor:Q,isColor:!0,r:1,g:1,b:1,set:function(a){return a&&a.isColor?this.copy(a):"number"==typeof a?this.setHex(a):"string"==typeof a&&this.setStyle(a),this},setScalar:function(a){return this.b=this.g=this.r=a,this},setHex:function(a){return a=Math.floor(a),this.r=(a>>16&255)/255,this.g=(a>>8&255)/255,this.b=(255&a)/255,this},setRGB:function(a,b,c){return this.r=a,this.g=b,this.b=c,this},setHSL:function(){function a(a,b,c){return 0>c&&(c+=1),1<c&&--c,c<1/6?a+6*(b-a)*c:.5>c?b:c<2/3?a+6*(b-a)*(2/3-c):a}return function(b,c,d){return b=Td.euclideanModulo(b,1),c=Td.clamp(c,0,1),d=Td.clamp(d,0,1),0===c?this.r=this.g=this.b=d:(c=.5>=d?d*(1+c):d+c-d*c,d=2*d-c,this.r=a(d,c,b+1/3),this.g=a(d,c,b),this.b=a(d,c,b-1/3)),this}}(),setStyle:function(a){function b(b){void 0!==b&&1>parseFloat(b)&&console.warn("THREE.Color: Alpha component of "+a+" will be ignored.")}var c;if(c=/^((?:rgb|hsl)a?)\(\s*([^\)]*)\)/.exec(a)){var d=c[2];switch(c[1]){case"rgb":case"rgba":if(c=/^(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(d))return this.r=Math.min(255,parseInt(c[1],10))/255,this.g=Math.min(255,parseInt(c[2],10))/255,this.b=Math.min(255,parseInt(c[3],10))/255,b(c[5]),this;if(c=/^(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(d))return this.r=Math.min(100,parseInt(c[1],10))/100,this.g=Math.min(100,parseInt(c[2],10))/100,this.b=Math.min(100,parseInt(c[3],10))/100,b(c[5]),this;break;case"hsl":case"hsla":if(c=/^([0-9]*\.?[0-9]+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(d)){var d=parseFloat(c[1])/360,e=parseInt(c[2],10)/100,f=parseInt(c[3],10)/100;return b(c[5]),this.setHSL(d,e,f)}}}else if(c=/^\#([A-Fa-f0-9]+)$/.exec(a)){if(c=c[1],3===(d=c.length))return this.r=parseInt(c.charAt(0)+c.charAt(0),16)/255,this.g=parseInt(c.charAt(1)+c.charAt(1),16)/255,this.b=parseInt(c.charAt(2)+c.charAt(2),16)/255,this;if(6===d)return this.r=parseInt(c.charAt(0)+c.charAt(1),16)/255,this.g=parseInt(c.charAt(2)+c.charAt(3),16)/255,this.b=parseInt(c.charAt(4)+c.charAt(5),16)/255,this}return a&&0<a.length&&(c=ae[a],void 0!==c?this.setHex(c):console.warn("THREE.Color: Unknown color "+a)),this},clone:function(){return new this.constructor(this.r,this.g,this.b)},copy:function(a){return this.r=a.r,this.g=a.g,this.b=a.b,this},copyGammaToLinear:function(a,b){return void 0===b&&(b=2),this.r=Math.pow(a.r,b),this.g=Math.pow(a.g,b),this.b=Math.pow(a.b,b),this},copyLinearToGamma:function(a,b){void 0===b&&(b=2);var c=0<b?1/b:1;return this.r=Math.pow(a.r,c),this.g=Math.pow(a.g,c),this.b=Math.pow(a.b,c),this},convertGammaToLinear:function(){var a=this.r,b=this.g,c=this.b;return this.r=a*a,this.g=b*b,this.b=c*c,this},convertLinearToGamma:function(){return this.r=Math.sqrt(this.r),this.g=Math.sqrt(this.g),this.b=Math.sqrt(this.b),this},getHex:function(){return 255*this.r<<16^255*this.g<<8^255*this.b<<0},getHexString:function(){return("000000"+this.getHex().toString(16)).slice(-6)},getHSL:function(a){a=a||{h:0,s:0,l:0};var b,c=this.r,d=this.g,e=this.b,f=Math.max(c,d,e),g=Math.min(c,d,e),h=(g+f)/2;if(g===f)g=b=0;else{var i=f-g,g=.5>=h?i/(f+g):i/(2-f-g);switch(f){case c:b=(d-e)/i+(d<e?6:0);break;case d:b=(e-c)/i+2;break;case e:b=(c-d)/i+4}b/=6}return a.h=b,a.s=g,a.l=h,a},getStyle:function(){return"rgb("+(255*this.r|0)+","+(255*this.g|0)+","+(255*this.b|0)+")"},offsetHSL:function(a,b,c){var d=this.getHSL();return d.h+=a,d.s+=b,d.l+=c,this.setHSL(d.h,d.s,d.l),this},add:function(a){return this.r+=a.r,this.g+=a.g,this.b+=a.b,this},addColors:function(a,b){return this.r=a.r+b.r,this.g=a.g+b.g,this.b=a.b+b.b,this},addScalar:function(a){return this.r+=a,this.g+=a,this.b+=a,this},sub:function(a){return this.r=Math.max(0,this.r-a.r),this.g=Math.max(0,this.g-a.g),this.b=Math.max(0,this.b-a.b),this},multiply:function(a){return this.r*=a.r,this.g*=a.g,this.b*=a.b,this},multiplyScalar:function(a){return this.r*=a,this.g*=a,this.b*=a,this},lerp:function(a,b){return this.r+=(a.r-this.r)*b,this.g+=(a.g-this.g)*b,this.b+=(a.b-this.b)*b,this},equals:function(a){return a.r===this.r&&a.g===this.g&&a.b===this.b},fromArray:function(a,b){return void 0===b&&(b=0),this.r=a[b],this.g=a[b+1],this.b=a[b+2],this},toArray:function(a,b){return void 0===a&&(a=[]),void 0===b&&(b=0),a[b]=this.r,a[b+1]=this.g,a[b+2]=this.b,a},toJSON:function(){return this.getHex()}};var ae={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},be={common:{diffuse:{value:new Q(15658734)},opacity:{value:1},map:{value:null},offsetRepeat:{value:new e(0,0,1,1)},specularMap:{value:null},alphaMap:{value:null},envMap:{value:null},flipEnvMap:{value:-1},reflectivity:{value:1},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1}},emissivemap:{emissiveMap:{value:null}},bumpmap:{bumpMap:{value:null},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalScale:{value:new c(1,1)}},displacementmap:{displacementMap:{value:null},displacementScale:{value:1},displacementBias:{value:0}},roughnessmap:{roughnessMap:{value:null}},metalnessmap:{metalnessMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new Q(16777215)}},lights:{ambientLightColor:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{},shadow:{},shadowBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{},shadow:{},shadowBias:{},shadowRadius:{},shadowMapSize:{}}},spotShadowMap:{value:[]},spotShadowMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{},shadow:{},shadowBias:{},shadowRadius:{},shadowMapSize:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}}},points:{diffuse:{value:new Q(15658734)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},offsetRepeat:{value:new e(0,0,1,1)}}},ce={basic:{uniforms:$d.merge([be.common,be.aomap,be.fog]),vertexShader:_d.meshbasic_vert,fragmentShader:_d.meshbasic_frag},lambert:{uniforms:$d.merge([be.common,be.aomap,be.lightmap,be.emissivemap,be.fog,be.lights,{emissive:{value:new Q(0)}}]),vertexShader:_d.meshlambert_vert,fragmentShader:_d.meshlambert_frag},phong:{uniforms:$d.merge([be.common,be.aomap,be.lightmap,be.emissivemap,be.bumpmap,be.normalmap,be.displacementmap,be.fog,be.lights,{emissive:{value:new Q(0)},specular:{value:new Q(1118481)},shininess:{value:30}}]),vertexShader:_d.meshphong_vert,fragmentShader:_d.meshphong_frag},standard:{uniforms:$d.merge([be.common,be.aomap,be.lightmap,be.emissivemap,be.bumpmap,be.normalmap,be.displacementmap,be.roughnessmap,be.metalnessmap,be.fog,be.lights,{emissive:{value:new Q(0)},roughness:{value:.5},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:_d.meshphysical_vert,fragmentShader:_d.meshphysical_frag},points:{uniforms:$d.merge([be.points,be.fog]),vertexShader:_d.points_vert,fragmentShader:_d.points_frag},dashed:{uniforms:$d.merge([be.common,be.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:_d.linedashed_vert,fragmentShader:_d.linedashed_frag},depth:{uniforms:$d.merge([be.common,be.displacementmap]),vertexShader:_d.depth_vert,fragmentShader:_d.depth_frag},normal:{uniforms:{opacity:{value:1}},vertexShader:_d.normal_vert,fragmentShader:_d.normal_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:_d.cube_vert,fragmentShader:_d.cube_frag},equirect:{uniforms:{tEquirect:{value:null},tFlip:{value:-1}},vertexShader:_d.equirect_vert,fragmentShader:_d.equirect_frag},distanceRGBA:{uniforms:{lightPos:{value:new i}},vertexShader:_d.distanceRGBA_vert,fragmentShader:_d.distanceRGBA_frag}};ce.physical={uniforms:$d.merge([ce.standard.uniforms,{clearCoat:{value:0},clearCoatRoughness:{value:0}}]),vertexShader:_d.meshphysical_vert,fragmentShader:_d.meshphysical_frag},R.prototype={constructor:R,set:function(a,b){return this.min.copy(a),this.max.copy(b),this},setFromPoints:function(a){this.makeEmpty();for(var b=0,c=a.length;b<c;b++)this.expandByPoint(a[b]);return this},setFromCenterAndSize:function(){var a=new c;return function(b,c){var d=a.copy(c).multiplyScalar(.5);return this.min.copy(b).sub(d),this.max.copy(b).add(d),this}}(),clone:function(){return(new this.constructor).copy(this)},copy:function(a){return this.min.copy(a.min),this.max.copy(a.max),this},makeEmpty:function(){return this.min.x=this.min.y=1/0,this.max.x=this.max.y=-1/0,this},isEmpty:function(){return this.max.x<this.min.x||this.max.y<this.min.y},getCenter:function(a){return a=a||new c,this.isEmpty()?a.set(0,0):a.addVectors(this.min,this.max).multiplyScalar(.5)},getSize:function(a){return a=a||new c,this.isEmpty()?a.set(0,0):a.subVectors(this.max,this.min)},expandByPoint:function(a){return this.min.min(a),this.max.max(a),this},expandByVector:function(a){return this.min.sub(a),this.max.add(a),this},expandByScalar:function(a){return this.min.addScalar(-a),this.max.addScalar(a),this},containsPoint:function(a){return!(a.x<this.min.x||a.x>this.max.x||a.y<this.min.y||a.y>this.max.y)},containsBox:function(a){return this.min.x<=a.min.x&&a.max.x<=this.max.x&&this.min.y<=a.min.y&&a.max.y<=this.max.y},getParameter:function(a,b){return(b||new c).set((a.x-this.min.x)/(this.max.x-this.min.x),(a.y-this.min.y)/(this.max.y-this.min.y))},intersectsBox:function(a){return!(a.max.x<this.min.x||a.min.x>this.max.x||a.max.y<this.min.y||a.min.y>this.max.y)},clampPoint:function(a,b){return(b||new c).copy(a).clamp(this.min,this.max)},distanceToPoint:function(){var a=new c;return function(b){return a.copy(b).clamp(this.min,this.max).sub(b).length()}}(),intersect:function(a){return this.min.max(a.min),this.max.min(a.max),this},union:function(a){return this.min.min(a.min),this.max.max(a.max),this},translate:function(a){return this.min.add(a),this.max.add(a),this},equals:function(a){return a.min.equals(this.min)&&a.max.equals(this.max)}},U.prototype={constructor:U,isMaterial:!0,get needsUpdate(){return this._needsUpdate},set needsUpdate(a){!0===a&&this.update(),this._needsUpdate=a},setValues:function(a){if(void 0!==a)for(var b in a){var c=a[b];if(void 0===c)console.warn("THREE.Material: '"+b+"' parameter is undefined.");else{var d=this[b];void 0===d?console.warn("THREE."+this.type+": '"+b+"' is not a property of this material."):d&&d.isColor?d.set(c):d&&d.isVector3&&c&&c.isVector3?d.copy(c):this[b]="overdraw"===b?Number(c):c}}},toJSON:function(a){function b(a){var b,c=[];for(b in a){var d=a[b];delete d.metadata,c.push(d)}return c}var c=void 0===a;c&&(a={textures:{},images:{}});var d={metadata:{version:4.4,type:"Material",generator:"Material.toJSON"}};return d.uuid=this.uuid,d.type=this.type,""!==this.name&&(d.name=this.name),this.color&&this.color.isColor&&(d.color=this.color.getHex()),void 0!==this.roughness&&(d.roughness=this.roughness),void 0!==this.metalness&&(d.metalness=this.metalness),this.emissive&&this.emissive.isColor&&(d.emissive=this.emissive.getHex()),this.specular&&this.specular.isColor&&(d.specular=this.specular.getHex()),void 0!==this.shininess&&(d.shininess=this.shininess),this.map&&this.map.isTexture&&(d.map=this.map.toJSON(a).uuid),this.alphaMap&&this.alphaMap.isTexture&&(d.alphaMap=this.alphaMap.toJSON(a).uuid),this.lightMap&&this.lightMap.isTexture&&(d.lightMap=this.lightMap.toJSON(a).uuid),this.bumpMap&&this.bumpMap.isTexture&&(d.bumpMap=this.bumpMap.toJSON(a).uuid,d.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(d.normalMap=this.normalMap.toJSON(a).uuid,d.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(d.displacementMap=this.displacementMap.toJSON(a).uuid,d.displacementScale=this.displacementScale,d.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(d.roughnessMap=this.roughnessMap.toJSON(a).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(d.metalnessMap=this.metalnessMap.toJSON(a).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(d.emissiveMap=this.emissiveMap.toJSON(a).uuid),this.specularMap&&this.specularMap.isTexture&&(d.specularMap=this.specularMap.toJSON(a).uuid),this.envMap&&this.envMap.isTexture&&(d.envMap=this.envMap.toJSON(a).uuid,d.reflectivity=this.reflectivity),void 0!==this.size&&(d.size=this.size),void 0!==this.sizeAttenuation&&(d.sizeAttenuation=this.sizeAttenuation),1!==this.blending&&(d.blending=this.blending),2!==this.shading&&(d.shading=this.shading),0!==this.side&&(d.side=this.side),0!==this.vertexColors&&(d.vertexColors=this.vertexColors),1>this.opacity&&(d.opacity=this.opacity),!0===this.transparent&&(d.transparent=this.transparent),d.depthFunc=this.depthFunc,d.depthTest=this.depthTest,d.depthWrite=this.depthWrite,0<this.alphaTest&&(d.alphaTest=this.alphaTest),!0===this.premultipliedAlpha&&(d.premultipliedAlpha=this.premultipliedAlpha),!0===this.wireframe&&(d.wireframe=this.wireframe),1<this.wireframeLinewidth&&(d.wireframeLinewidth=this.wireframeLinewidth),"round"!==this.wireframeLinecap&&(d.wireframeLinecap=this.wireframeLinecap),"round"!==this.wireframeLinejoin&&(d.wireframeLinejoin=this.wireframeLinejoin),d.skinning=this.skinning,d.morphTargets=this.morphTargets,c&&(c=b(a.textures),a=b(a.images),0<c.length&&(d.textures=c),0<a.length&&(d.images=a)),d},clone:function(){return(new this.constructor).copy(this)},copy:function(a){this.name=a.name,this.fog=a.fog,this.lights=a.lights,this.blending=a.blending,this.side=a.side,this.shading=a.shading,this.vertexColors=a.vertexColors,this.opacity=a.opacity,this.transparent=a.transparent,this.blendSrc=a.blendSrc,this.blendDst=a.blendDst,this.blendEquation=a.blendEquation,this.blendSrcAlpha=a.blendSrcAlpha,this.blendDstAlpha=a.blendDstAlpha,this.blendEquationAlpha=a.blendEquationAlpha,this.depthFunc=a.depthFunc,this.depthTest=a.depthTest,this.depthWrite=a.depthWrite,this.colorWrite=a.colorWrite,this.precision=a.precision,this.polygonOffset=a.polygonOffset,this.polygonOffsetFactor=a.polygonOffsetFactor,this.polygonOffsetUnits=a.polygonOffsetUnits,this.alphaTest=a.alphaTest,this.premultipliedAlpha=a.premultipliedAlpha,this.overdraw=a.overdraw,this.visible=a.visible,this.clipShadows=a.clipShadows,this.clipIntersection=a.clipIntersection,a=a.clippingPlanes;var b=null;if(null!==a)for(var c=a.length,b=Array(c),d=0;d!==c;++d)b[d]=a[d].clone();return this.clippingPlanes=b,this},update:function(){this.dispatchEvent({type:"update"})},dispose:function(){this.dispatchEvent({type:"dispose"})}},Object.assign(U.prototype,b.prototype);var de=0;V.prototype=Object.create(U.prototype),V.prototype.constructor=V,V.prototype.isShaderMaterial=!0,V.prototype.copy=function(a){return U.prototype.copy.call(this,a),this.fragmentShader=a.fragmentShader,this.vertexShader=a.vertexShader,this.uniforms=$d.clone(a.uniforms),this.defines=a.defines,this.wireframe=a.wireframe,this.wireframeLinewidth=a.wireframeLinewidth,this.lights=a.lights,this.clipping=a.clipping,this.skinning=a.skinning,this.morphTargets=a.morphTargets,this.morphNormals=a.morphNormals,this.extensions=a.extensions,this},V.prototype.toJSON=function(a){return a=U.prototype.toJSON.call(this,a),a.uniforms=this.uniforms,a.vertexShader=this.vertexShader,a.fragmentShader=this.fragmentShader,a},W.prototype=Object.create(U.prototype),W.prototype.constructor=W,W.prototype.isMeshDepthMaterial=!0,W.prototype.copy=function(a){return U.prototype.copy.call(this,a),this.depthPacking=a.depthPacking,this.skinning=a.skinning,this.morphTargets=a.morphTargets,this.map=a.map,this.alphaMap=a.alphaMap,this.displacementMap=a.displacementMap,this.displacementScale=a.displacementScale,this.displacementBias=a.displacementBias,this.wireframe=a.wireframe,this.wireframeLinewidth=a.wireframeLinewidth,this},X.prototype={constructor:X,isBox3:!0,set:function(a,b){return this.min.copy(a),this.max.copy(b),this},setFromArray:function(a){for(var b=1/0,c=1/0,d=1/0,e=-1/0,f=-1/0,g=-1/0,h=0,i=a.length;h<i;h+=3){var j=a[h],k=a[h+1],l=a[h+2];j<b&&(b=j),k<c&&(c=k),l<d&&(d=l),j>e&&(e=j),k>f&&(f=k),l>g&&(g=l)}this.min.set(b,c,d),this.max.set(e,f,g)},setFromPoints:function(a){this.makeEmpty();for(var b=0,c=a.length;b<c;b++)this.expandByPoint(a[b]);return this},setFromCenterAndSize:function(){var a=new i;return function(b,c){var d=a.copy(c).multiplyScalar(.5);return this.min.copy(b).sub(d),this.max.copy(b).add(d),this}}(),setFromObject:function(){var a=new i;return function(b){var c=this;return b.updateMatrixWorld(!0),this.makeEmpty(),b.traverse(function(b){var d=b.geometry;if(void 0!==d)if(d&&d.isGeometry)for(var d=d.vertices,e=0,f=d.length;e<f;e++)a.copy(d[e]),a.applyMatrix4(b.matrixWorld),c.expandByPoint(a);else if(d&&d.isBufferGeometry&&void 0!==(f=d.attributes.position)){var g;for(f&&f.isInterleavedBufferAttribute?(d=f.data.array,e=f.offset,g=f.data.stride):(d=f.array,e=0,g=3),f=d.length;e<f;e+=g)a.fromArray(d,e),a.applyMatrix4(b.matrixWorld),c.expandByPoint(a)}}),this}}(),clone:function(){return(new this.constructor).copy(this)},copy:function(a){return this.min.copy(a.min),this.max.copy(a.max),this},makeEmpty:function(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this},isEmpty:function(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z},getCenter:function(a){return a=a||new i,this.isEmpty()?a.set(0,0,0):a.addVectors(this.min,this.max).multiplyScalar(.5)},getSize:function(a){return a=a||new i,this.isEmpty()?a.set(0,0,0):a.subVectors(this.max,this.min)},expandByPoint:function(a){return this.min.min(a),this.max.max(a),this},expandByVector:function(a){return this.min.sub(a),this.max.add(a),this},expandByScalar:function(a){return this.min.addScalar(-a),this.max.addScalar(a),this},containsPoint:function(a){return!(a.x<this.min.x||a.x>this.max.x||a.y<this.min.y||a.y>this.max.y||a.z<this.min.z||a.z>this.max.z)},containsBox:function(a){return this.min.x<=a.min.x&&a.max.x<=this.max.x&&this.min.y<=a.min.y&&a.max.y<=this.max.y&&this.min.z<=a.min.z&&a.max.z<=this.max.z},getParameter:function(a,b){return(b||new i).set((a.x-this.min.x)/(this.max.x-this.min.x),(a.y-this.min.y)/(this.max.y-this.min.y),(a.z-this.min.z)/(this.max.z-this.min.z))},intersectsBox:function(a){return!(a.max.x<this.min.x||a.min.x>this.max.x||a.max.y<this.min.y||a.min.y>this.max.y||a.max.z<this.min.z||a.min.z>this.max.z)},intersectsSphere:function(){var a;return function(b){return void 0===a&&(a=new i),this.clampPoint(b.center,a),a.distanceToSquared(b.center)<=b.radius*b.radius}}(),intersectsPlane:function(a){var b,c;return 0<a.normal.x?(b=a.normal.x*this.min.x,c=a.normal.x*this.max.x):(b=a.normal.x*this.max.x,c=a.normal.x*this.min.x),0<a.normal.y?(b+=a.normal.y*this.min.y,c+=a.normal.y*this.max.y):(b+=a.normal.y*this.max.y,c+=a.normal.y*this.min.y),0<a.normal.z?(b+=a.normal.z*this.min.z,c+=a.normal.z*this.max.z):(b+=a.normal.z*this.max.z,c+=a.normal.z*this.min.z),b<=a.constant&&c>=a.constant},clampPoint:function(a,b){return(b||new i).copy(a).clamp(this.min,this.max)},distanceToPoint:function(){var a=new i;return function(b){return a.copy(b).clamp(this.min,this.max).sub(b).length()}}(),getBoundingSphere:function(){var a=new i;return function(b){return b=b||new Y,this.getCenter(b.center),b.radius=.5*this.getSize(a).length(),b}}(),intersect:function(a){return this.min.max(a.min),this.max.min(a.max),this.isEmpty()&&this.makeEmpty(),this},union:function(a){return this.min.min(a.min),this.max.max(a.max),this},applyMatrix4:function(){var a=[new i,new i,new i,new i,new i,new i,new i,new i];return function(b){return this.isEmpty()?this:(a[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(b),a[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(b),a[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(b),a[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(b),a[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(b),a[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(b),a[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(b),a[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(b),this.setFromPoints(a),this)}}(),translate:function(a){return this.min.add(a),this.max.add(a),this},equals:function(a){return a.min.equals(this.min)&&a.max.equals(this.max)}},Y.prototype={constructor:Y,set:function(a,b){return this.center.copy(a),this.radius=b,this},setFromPoints:function(){var a=new X;return function(b,c){var d=this.center;void 0!==c?d.copy(c):a.setFromPoints(b).getCenter(d);for(var e=0,f=0,g=b.length;f<g;f++)e=Math.max(e,d.distanceToSquared(b[f]));return this.radius=Math.sqrt(e),this}}(),clone:function(){return(new this.constructor).copy(this)},copy:function(a){return this.center.copy(a.center),this.radius=a.radius,this},empty:function(){return 0>=this.radius},containsPoint:function(a){return a.distanceToSquared(this.center)<=this.radius*this.radius},distanceToPoint:function(a){return a.distanceTo(this.center)-this.radius},intersectsSphere:function(a){var b=this.radius+a.radius;return a.center.distanceToSquared(this.center)<=b*b},intersectsBox:function(a){return a.intersectsSphere(this)},intersectsPlane:function(a){return Math.abs(this.center.dot(a.normal)-a.constant)<=this.radius},clampPoint:function(a,b){var c=this.center.distanceToSquared(a),d=b||new i;return d.copy(a),c>this.radius*this.radius&&(d.sub(this.center).normalize(),d.multiplyScalar(this.radius).add(this.center)),d},getBoundingBox:function(a){return a=a||new X,a.set(this.center,this.center),a.expandByScalar(this.radius),a},applyMatrix4:function(a){return this.center.applyMatrix4(a),this.radius*=a.getMaxScaleOnAxis(),this},translate:function(a){return this.center.add(a),this},equals:function(a){return a.center.equals(this.center)&&a.radius===this.radius}},Z.prototype={constructor:Z,isMatrix3:!0,set:function(a,b,c,d,e,f,g,h,i){var j=this.elements;return j[0]=a,j[1]=d,j[2]=g,j[3]=b,j[4]=e,j[5]=h,j[6]=c,j[7]=f,j[8]=i,this},identity:function(){return this.set(1,0,0,0,1,0,0,0,1),this},clone:function(){return(new this.constructor).fromArray(this.elements)},copy:function(a){return a=a.elements,this.set(a[0],a[3],a[6],a[1],a[4],a[7],a[2],a[5],a[8]),this},setFromMatrix4:function(a){return a=a.elements,this.set(a[0],a[4],a[8],a[1],a[5],a[9],a[2],a[6],a[10]),this},applyToVector3Array:function(){var a;return function(b,c,d){void 0===a&&(a=new i),void 0===c&&(c=0),void 0===d&&(d=b.length);for(var e=0;e<d;e+=3,c+=3)a.fromArray(b,c),a.applyMatrix3(this),a.toArray(b,c);return b}}(),applyToBuffer:function(){var a;return function(b,c,d){void 0===a&&(a=new i),void 0===c&&(c=0),void 0===d&&(d=b.length/b.itemSize);for(var e=0;e<d;e++,c++)a.x=b.getX(c),a.y=b.getY(c),a.z=b.getZ(c),a.applyMatrix3(this),b.setXYZ(c,a.x,a.y,a.z);return b}}(),multiplyScalar:function(a){var b=this.elements;return b[0]*=a,b[3]*=a,b[6]*=a,b[1]*=a,b[4]*=a,b[7]*=a,b[2]*=a,b[5]*=a,b[8]*=a,this},determinant:function(){var a=this.elements,b=a[0],c=a[1],d=a[2],e=a[3],f=a[4],g=a[5],h=a[6],i=a[7],a=a[8];return b*f*a-b*g*i-c*e*a+c*g*h+d*e*i-d*f*h},getInverse:function(a,b){a&&a.isMatrix4&&console.error("THREE.Matrix3.getInverse no longer takes a Matrix4 argument.");var c=a.elements,d=this.elements,e=c[0],f=c[1],g=c[2],h=c[3],i=c[4],j=c[5],k=c[6],l=c[7],c=c[8],m=c*i-j*l,n=j*k-c*h,o=l*h-i*k,p=e*m+f*n+g*o;if(0===p){if(!0===b)throw Error("THREE.Matrix3.getInverse(): can't invert matrix, determinant is 0");return console.warn("THREE.Matrix3.getInverse(): can't invert matrix, determinant is 0"),this.identity()}return p=1/p,d[0]=m*p,d[1]=(g*l-c*f)*p,d[2]=(j*f-g*i)*p,d[3]=n*p,d[4]=(c*e-g*k)*p,d[5]=(g*h-j*e)*p,d[6]=o*p,d[7]=(f*k-l*e)*p,d[8]=(i*e-f*h)*p,this},transpose:function(){var a,b=this.elements;return a=b[1],b[1]=b[3],b[3]=a,a=b[2],b[2]=b[6],b[6]=a,a=b[5],b[5]=b[7],b[7]=a,this},flattenToArrayOffset:function(a,b){return console.warn("THREE.Matrix3: .flattenToArrayOffset is deprecated - just use .toArray instead."),this.toArray(a,b)},getNormalMatrix:function(a){return this.setFromMatrix4(a).getInverse(this).transpose()},transposeIntoArray:function(a){var b=this.elements;return a[0]=b[0],a[1]=b[3],a[2]=b[6],a[3]=b[1],a[4]=b[4],a[5]=b[7],a[6]=b[2],a[7]=b[5],a[8]=b[8],this},fromArray:function(a,b){void 0===b&&(b=0);for(var c=0;9>c;c++)this.elements[c]=a[c+b];return this},toArray:function(a,b){void 0===a&&(a=[]),void 0===b&&(b=0);var c=this.elements;return a[b]=c[0],a[b+1]=c[1],a[b+2]=c[2],a[b+3]=c[3],a[b+4]=c[4],a[b+5]=c[5],a[b+6]=c[6],a[b+7]=c[7],a[b+8]=c[8],a}},$.prototype={constructor:$,set:function(a,b){return this.normal.copy(a),this.constant=b,this},setComponents:function(a,b,c,d){return this.normal.set(a,b,c),this.constant=d,this},setFromNormalAndCoplanarPoint:function(a,b){return this.normal.copy(a),this.constant=-b.dot(this.normal),this},setFromCoplanarPoints:function(){var a=new i,b=new i;return function(c,d,e){return d=a.subVectors(e,d).cross(b.subVectors(c,d)).normalize(),this.setFromNormalAndCoplanarPoint(d,c),this}}(),clone:function(){return(new this.constructor).copy(this)},copy:function(a){return this.normal.copy(a.normal),this.constant=a.constant,this},normalize:function(){var a=1/this.normal.length();return this.normal.multiplyScalar(a),this.constant*=a,this},negate:function(){return this.constant*=-1,this.normal.negate(),this},distanceToPoint:function(a){return this.normal.dot(a)+this.constant},distanceToSphere:function(a){return this.distanceToPoint(a.center)-a.radius},projectPoint:function(a,b){return this.orthoPoint(a,b).sub(a).negate()},orthoPoint:function(a,b){var c=this.distanceToPoint(a);return(b||new i).copy(this.normal).multiplyScalar(c)},intersectLine:function(){var a=new i;return function(b,c){var d=c||new i,e=b.delta(a),f=this.normal.dot(e);return 0!==f?(f=-(b.start.dot(this.normal)+this.constant)/f,0>f||1<f?void 0:d.copy(e).multiplyScalar(f).add(b.start)):0===this.distanceToPoint(b.start)?d.copy(b.start):void 0}}(),intersectsLine:function(a){var b=this.distanceToPoint(a.start);return a=this.distanceToPoint(a.end),0>b&&0<a||0>a&&0<b},intersectsBox:function(a){return a.intersectsPlane(this)},intersectsSphere:function(a){return a.intersectsPlane(this)},coplanarPoint:function(a){return(a||new i).copy(this.normal).multiplyScalar(-this.constant)},applyMatrix4:function(){var a=new i,b=new Z;return function(c,d){var e=this.coplanarPoint(a).applyMatrix4(c),f=d||b.getNormalMatrix(c),f=this.normal.applyMatrix3(f).normalize();return this.constant=-e.dot(f),this}}(),translate:function(a){return this.constant-=a.dot(this.normal),this},equals:function(a){return a.normal.equals(this.normal)&&a.constant===this.constant}},_.prototype={constructor:_,set:function(a,b,c,d,e,f){var g=this.planes;return g[0].copy(a),g[1].copy(b),g[2].copy(c),g[3].copy(d),g[4].copy(e),g[5].copy(f),this},clone:function(){return(new this.constructor).copy(this)},copy:function(a){for(var b=this.planes,c=0;6>c;c++)b[c].copy(a.planes[c]);return this},setFromMatrix:function(a){var b=this.planes,c=a.elements;a=c[0];var d=c[1],e=c[2],f=c[3],g=c[4],h=c[5],i=c[6],j=c[7],k=c[8],l=c[9],m=c[10],n=c[11],o=c[12],p=c[13],q=c[14],c=c[15];return b[0].setComponents(f-a,j-g,n-k,c-o).normalize(),b[1].setComponents(f+a,j+g,n+k,c+o).normalize(),b[2].setComponents(f+d,j+h,n+l,c+p).normalize(),b[3].setComponents(f-d,j-h,n-l,c-p).normalize(),b[4].setComponents(f-e,j-i,n-m,c-q).normalize(),b[5].setComponents(f+e,j+i,n+m,c+q).normalize(),this},intersectsObject:function(){var a=new Y;return function(b){var c=b.geometry;return null===c.boundingSphere&&c.computeBoundingSphere(),a.copy(c.boundingSphere).applyMatrix4(b.matrixWorld),this.intersectsSphere(a)}}(),intersectsSprite:function(){var a=new Y;return function(b){return a.center.set(0,0,0),a.radius=.7071067811865476,a.applyMatrix4(b.matrixWorld),this.intersectsSphere(a)}}(),intersectsSphere:function(a){var b=this.planes,c=a.center;a=-a.radius;for(var d=0;6>d;d++)if(b[d].distanceToPoint(c)<a)return!1;return!0},intersectsBox:function(){var a=new i,b=new i;return function(c){for(var d=this.planes,e=0;6>e;e++){var f=d[e];a.x=0<f.normal.x?c.min.x:c.max.x,b.x=0<f.normal.x?c.max.x:c.min.x,a.y=0<f.normal.y?c.min.y:c.max.y,b.y=0<f.normal.y?c.max.y:c.min.y,a.z=0<f.normal.z?c.min.z:c.max.z,b.z=0<f.normal.z?c.max.z:c.min.z;var g=f.distanceToPoint(a),f=f.distanceToPoint(b);if(0>g&&0>f)return!1}return!0}}(), containsPoint:function(a){for(var b=this.planes,c=0;6>c;c++)if(0>b[c].distanceToPoint(a))return!1;return!0}},ba.prototype={constructor:ba,set:function(a,b){return this.origin.copy(a),this.direction.copy(b),this},clone:function(){return(new this.constructor).copy(this)},copy:function(a){return this.origin.copy(a.origin),this.direction.copy(a.direction),this},at:function(a,b){return(b||new i).copy(this.direction).multiplyScalar(a).add(this.origin)},lookAt:function(a){return this.direction.copy(a).sub(this.origin).normalize(),this},recast:function(){var a=new i;return function(b){return this.origin.copy(this.at(b,a)),this}}(),closestPointToPoint:function(a,b){var c=b||new i;c.subVectors(a,this.origin);var d=c.dot(this.direction);return 0>d?c.copy(this.origin):c.copy(this.direction).multiplyScalar(d).add(this.origin)},distanceToPoint:function(a){return Math.sqrt(this.distanceSqToPoint(a))},distanceSqToPoint:function(){var a=new i;return function(b){var c=a.subVectors(b,this.origin).dot(this.direction);return 0>c?this.origin.distanceToSquared(b):(a.copy(this.direction).multiplyScalar(c).add(this.origin),a.distanceToSquared(b))}}(),distanceSqToSegment:function(){var a=new i,b=new i,c=new i;return function(d,e,f,g){a.copy(d).add(e).multiplyScalar(.5),b.copy(e).sub(d).normalize(),c.copy(this.origin).sub(a);var h,i=.5*d.distanceTo(e),j=-this.direction.dot(b),k=c.dot(this.direction),l=-c.dot(b),m=c.lengthSq(),n=Math.abs(1-j*j);return 0<n?(d=j*l-k,e=j*k-l,h=i*n,0<=d?e>=-h?e<=h?(i=1/n,d*=i,e*=i,j=d*(d+j*e+2*k)+e*(j*d+e+2*l)+m):(e=i,d=Math.max(0,-(j*e+k)),j=-d*d+e*(e+2*l)+m):(e=-i,d=Math.max(0,-(j*e+k)),j=-d*d+e*(e+2*l)+m):e<=-h?(d=Math.max(0,-(-j*i+k)),e=0<d?-i:Math.min(Math.max(-i,-l),i),j=-d*d+e*(e+2*l)+m):e<=h?(d=0,e=Math.min(Math.max(-i,-l),i),j=e*(e+2*l)+m):(d=Math.max(0,-(j*i+k)),e=0<d?i:Math.min(Math.max(-i,-l),i),j=-d*d+e*(e+2*l)+m)):(e=0<j?-i:i,d=Math.max(0,-(j*e+k)),j=-d*d+e*(e+2*l)+m),f&&f.copy(this.direction).multiplyScalar(d).add(this.origin),g&&g.copy(b).multiplyScalar(e).add(a),j}}(),intersectSphere:function(){var a=new i;return function(b,c){a.subVectors(b.center,this.origin);var d=a.dot(this.direction),e=a.dot(a)-d*d,f=b.radius*b.radius;return e>f?null:(f=Math.sqrt(f-e),e=d-f,d+=f,0>e&&0>d?null:0>e?this.at(d,c):this.at(e,c))}}(),intersectsSphere:function(a){return this.distanceToPoint(a.center)<=a.radius},distanceToPlane:function(a){var b=a.normal.dot(this.direction);return 0===b?0===a.distanceToPoint(this.origin)?0:null:(a=-(this.origin.dot(a.normal)+a.constant)/b,0<=a?a:null)},intersectPlane:function(a,b){var c=this.distanceToPlane(a);return null===c?null:this.at(c,b)},intersectsPlane:function(a){var b=a.distanceToPoint(this.origin);return 0===b||0>a.normal.dot(this.direction)*b},intersectBox:function(a,b){var c,d,e,f,g;d=1/this.direction.x,f=1/this.direction.y,g=1/this.direction.z;var h=this.origin;return 0<=d?(c=(a.min.x-h.x)*d,d*=a.max.x-h.x):(c=(a.max.x-h.x)*d,d*=a.min.x-h.x),0<=f?(e=(a.min.y-h.y)*f,f*=a.max.y-h.y):(e=(a.max.y-h.y)*f,f*=a.min.y-h.y),c>f||e>d?null:((e>c||c!==c)&&(c=e),(f<d||d!==d)&&(d=f),0<=g?(e=(a.min.z-h.z)*g,g*=a.max.z-h.z):(e=(a.max.z-h.z)*g,g*=a.min.z-h.z),c>g||e>d?null:((e>c||c!==c)&&(c=e),(g<d||d!==d)&&(d=g),0>d?null:this.at(0<=c?c:d,b)))},intersectsBox:function(){var a=new i;return function(b){return null!==this.intersectBox(b,a)}}(),intersectTriangle:function(){var a=new i,b=new i,c=new i,d=new i;return function(e,f,g,h,i){if(b.subVectors(f,e),c.subVectors(g,e),d.crossVectors(b,c),0<(f=this.direction.dot(d))){if(h)return null;h=1}else{if(!(0>f))return null;h=-1,f=-f}return a.subVectors(this.origin,e),0>(e=h*this.direction.dot(c.crossVectors(a,c)))?null:0>(g=h*this.direction.dot(b.cross(a)))||e+g>f?null:(e=-h*a.dot(d),0>e?null:this.at(e/f,i))}}(),applyMatrix4:function(a){return this.direction.add(this.origin).applyMatrix4(a),this.origin.applyMatrix4(a),this.direction.sub(this.origin),this.direction.normalize(),this},equals:function(a){return a.origin.equals(this.origin)&&a.direction.equals(this.direction)}},ca.RotationOrders="XYZ YZX ZXY XZY YXZ ZYX".split(" "),ca.DefaultOrder="XYZ",ca.prototype={constructor:ca,isEuler:!0,get x(){return this._x},set x(a){this._x=a,this.onChangeCallback()},get y(){return this._y},set y(a){this._y=a,this.onChangeCallback()},get z(){return this._z},set z(a){this._z=a,this.onChangeCallback()},get order(){return this._order},set order(a){this._order=a,this.onChangeCallback()},set:function(a,b,c,d){return this._x=a,this._y=b,this._z=c,this._order=d||this._order,this.onChangeCallback(),this},clone:function(){return new this.constructor(this._x,this._y,this._z,this._order)},copy:function(a){return this._x=a._x,this._y=a._y,this._z=a._z,this._order=a._order,this.onChangeCallback(),this},setFromRotationMatrix:function(a,b,c){var d=Td.clamp,e=a.elements;a=e[0];var f=e[4],g=e[8],h=e[1],i=e[5],j=e[9],k=e[2],l=e[6],e=e[10];return b=b||this._order,"XYZ"===b?(this._y=Math.asin(d(g,-1,1)),.99999>Math.abs(g)?(this._x=Math.atan2(-j,e),this._z=Math.atan2(-f,a)):(this._x=Math.atan2(l,i),this._z=0)):"YXZ"===b?(this._x=Math.asin(-d(j,-1,1)),.99999>Math.abs(j)?(this._y=Math.atan2(g,e),this._z=Math.atan2(h,i)):(this._y=Math.atan2(-k,a),this._z=0)):"ZXY"===b?(this._x=Math.asin(d(l,-1,1)),.99999>Math.abs(l)?(this._y=Math.atan2(-k,e),this._z=Math.atan2(-f,i)):(this._y=0,this._z=Math.atan2(h,a))):"ZYX"===b?(this._y=Math.asin(-d(k,-1,1)),.99999>Math.abs(k)?(this._x=Math.atan2(l,e),this._z=Math.atan2(h,a)):(this._x=0,this._z=Math.atan2(-f,i))):"YZX"===b?(this._z=Math.asin(d(h,-1,1)),.99999>Math.abs(h)?(this._x=Math.atan2(-j,i),this._y=Math.atan2(-k,a)):(this._x=0,this._y=Math.atan2(g,e))):"XZY"===b?(this._z=Math.asin(-d(f,-1,1)),.99999>Math.abs(f)?(this._x=Math.atan2(l,i),this._y=Math.atan2(g,a)):(this._x=Math.atan2(-j,e),this._y=0)):console.warn("THREE.Euler: .setFromRotationMatrix() given unsupported order: "+b),this._order=b,!1!==c&&this.onChangeCallback(),this},setFromQuaternion:function(){var a;return function(b,c,d){return void 0===a&&(a=new j),a.makeRotationFromQuaternion(b),this.setFromRotationMatrix(a,c,d)}}(),setFromVector3:function(a,b){return this.set(a.x,a.y,a.z,b||this._order)},reorder:function(){var a=new h;return function(b){return a.setFromEuler(this),this.setFromQuaternion(a,b)}}(),equals:function(a){return a._x===this._x&&a._y===this._y&&a._z===this._z&&a._order===this._order},fromArray:function(a){return this._x=a[0],this._y=a[1],this._z=a[2],void 0!==a[3]&&(this._order=a[3]),this.onChangeCallback(),this},toArray:function(a,b){return void 0===a&&(a=[]),void 0===b&&(b=0),a[b]=this._x,a[b+1]=this._y,a[b+2]=this._z,a[b+3]=this._order,a},toVector3:function(a){return a?a.set(this._x,this._y,this._z):new i(this._x,this._y,this._z)},onChange:function(a){return this.onChangeCallback=a,this},onChangeCallback:function(){}},da.prototype={constructor:da,set:function(a){this.mask=1<<a},enable:function(a){this.mask|=1<<a},toggle:function(a){this.mask^=1<<a},disable:function(a){this.mask&=~(1<<a)},test:function(a){return 0!=(this.mask&a.mask)}},ea.DefaultUp=new i(0,1,0),ea.DefaultMatrixAutoUpdate=!0,Object.assign(ea.prototype,b.prototype,{isObject3D:!0,applyMatrix:function(a){this.matrix.multiplyMatrices(a,this.matrix),this.matrix.decompose(this.position,this.quaternion,this.scale)},setRotationFromAxisAngle:function(a,b){this.quaternion.setFromAxisAngle(a,b)},setRotationFromEuler:function(a){this.quaternion.setFromEuler(a,!0)},setRotationFromMatrix:function(a){this.quaternion.setFromRotationMatrix(a)},setRotationFromQuaternion:function(a){this.quaternion.copy(a)},rotateOnAxis:function(){var a=new h;return function(b,c){return a.setFromAxisAngle(b,c),this.quaternion.multiply(a),this}}(),rotateX:function(){var a=new i(1,0,0);return function(b){return this.rotateOnAxis(a,b)}}(),rotateY:function(){var a=new i(0,1,0);return function(b){return this.rotateOnAxis(a,b)}}(),rotateZ:function(){var a=new i(0,0,1);return function(b){return this.rotateOnAxis(a,b)}}(),translateOnAxis:function(){var a=new i;return function(b,c){return a.copy(b).applyQuaternion(this.quaternion),this.position.add(a.multiplyScalar(c)),this}}(),translateX:function(){var a=new i(1,0,0);return function(b){return this.translateOnAxis(a,b)}}(),translateY:function(){var a=new i(0,1,0);return function(b){return this.translateOnAxis(a,b)}}(),translateZ:function(){var a=new i(0,0,1);return function(b){return this.translateOnAxis(a,b)}}(),localToWorld:function(a){return a.applyMatrix4(this.matrixWorld)},worldToLocal:function(){var a=new j;return function(b){return b.applyMatrix4(a.getInverse(this.matrixWorld))}}(),lookAt:function(){var a=new j;return function(b){a.lookAt(b,this.position,this.up),this.quaternion.setFromRotationMatrix(a)}}(),add:function(a){if(1<arguments.length){for(var b=0;b<arguments.length;b++)this.add(arguments[b]);return this}return a===this?(console.error("THREE.Object3D.add: object can't be added as a child of itself.",a),this):(a&&a.isObject3D?(null!==a.parent&&a.parent.remove(a),a.parent=this,a.dispatchEvent({type:"added"}),this.children.push(a)):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",a),this)},remove:function(a){if(1<arguments.length)for(var b=0;b<arguments.length;b++)this.remove(arguments[b]);-1!==(b=this.children.indexOf(a))&&(a.parent=null,a.dispatchEvent({type:"removed"}),this.children.splice(b,1))},getObjectById:function(a){return this.getObjectByProperty("id",a)},getObjectByName:function(a){return this.getObjectByProperty("name",a)},getObjectByProperty:function(a,b){if(this[a]===b)return this;for(var c=0,d=this.children.length;c<d;c++){var e=this.children[c].getObjectByProperty(a,b);if(void 0!==e)return e}},getWorldPosition:function(a){return a=a||new i,this.updateMatrixWorld(!0),a.setFromMatrixPosition(this.matrixWorld)},getWorldQuaternion:function(){var a=new i,b=new i;return function(c){return c=c||new h,this.updateMatrixWorld(!0),this.matrixWorld.decompose(a,c,b),c}}(),getWorldRotation:function(){var a=new h;return function(b){return b=b||new ca,this.getWorldQuaternion(a),b.setFromQuaternion(a,this.rotation.order,!1)}}(),getWorldScale:function(){var a=new i,b=new h;return function(c){return c=c||new i,this.updateMatrixWorld(!0),this.matrixWorld.decompose(a,b,c),c}}(),getWorldDirection:function(){var a=new h;return function(b){return b=b||new i,this.getWorldQuaternion(a),b.set(0,0,1).applyQuaternion(a)}}(),raycast:function(){},traverse:function(a){a(this);for(var b=this.children,c=0,d=b.length;c<d;c++)b[c].traverse(a)},traverseVisible:function(a){if(!1!==this.visible){a(this);for(var b=this.children,c=0,d=b.length;c<d;c++)b[c].traverseVisible(a)}},traverseAncestors:function(a){var b=this.parent;null!==b&&(a(b),b.traverseAncestors(a))},updateMatrix:function(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0},updateMatrixWorld:function(a){!0===this.matrixAutoUpdate&&this.updateMatrix(),!0!==this.matrixWorldNeedsUpdate&&!0!==a||(null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorldNeedsUpdate=!1,a=!0);for(var b=this.children,c=0,d=b.length;c<d;c++)b[c].updateMatrixWorld(a)},toJSON:function(a){function b(a){var b,c=[];for(b in a){var d=a[b];delete d.metadata,c.push(d)}return c}var c=void 0===a||""===a,d={};c&&(a={geometries:{},materials:{},textures:{},images:{}},d.metadata={version:4.4,type:"Object",generator:"Object3D.toJSON"});var e={};if(e.uuid=this.uuid,e.type=this.type,""!==this.name&&(e.name=this.name),"{}"!==JSON.stringify(this.userData)&&(e.userData=this.userData),!0===this.castShadow&&(e.castShadow=!0),!0===this.receiveShadow&&(e.receiveShadow=!0),!1===this.visible&&(e.visible=!1),e.matrix=this.matrix.toArray(),void 0!==this.geometry&&(void 0===a.geometries[this.geometry.uuid]&&(a.geometries[this.geometry.uuid]=this.geometry.toJSON(a)),e.geometry=this.geometry.uuid),void 0!==this.material&&(void 0===a.materials[this.material.uuid]&&(a.materials[this.material.uuid]=this.material.toJSON(a)),e.material=this.material.uuid),0<this.children.length){e.children=[];for(var f=0;f<this.children.length;f++)e.children.push(this.children[f].toJSON(a).object)}if(c){var c=b(a.geometries),f=b(a.materials),g=b(a.textures);a=b(a.images),0<c.length&&(d.geometries=c),0<f.length&&(d.materials=f),0<g.length&&(d.textures=g),0<a.length&&(d.images=a)}return d.object=e,d},clone:function(a){return(new this.constructor).copy(this,a)},copy:function(a,b){if(void 0===b&&(b=!0),this.name=a.name,this.up.copy(a.up),this.position.copy(a.position),this.quaternion.copy(a.quaternion),this.scale.copy(a.scale),this.matrix.copy(a.matrix),this.matrixWorld.copy(a.matrixWorld),this.matrixAutoUpdate=a.matrixAutoUpdate,this.matrixWorldNeedsUpdate=a.matrixWorldNeedsUpdate,this.visible=a.visible,this.castShadow=a.castShadow,this.receiveShadow=a.receiveShadow,this.frustumCulled=a.frustumCulled,this.renderOrder=a.renderOrder,this.userData=JSON.parse(JSON.stringify(a.userData)),!0===b)for(var c=0;c<a.children.length;c++)this.add(a.children[c].clone());return this}});var ee=0;fa.prototype={constructor:fa,set:function(a,b){return this.start.copy(a),this.end.copy(b),this},clone:function(){return(new this.constructor).copy(this)},copy:function(a){return this.start.copy(a.start),this.end.copy(a.end),this},getCenter:function(a){return(a||new i).addVectors(this.start,this.end).multiplyScalar(.5)},delta:function(a){return(a||new i).subVectors(this.end,this.start)},distanceSq:function(){return this.start.distanceToSquared(this.end)},distance:function(){return this.start.distanceTo(this.end)},at:function(a,b){var c=b||new i;return this.delta(c).multiplyScalar(a).add(this.start)},closestPointToPointParameter:function(){var a=new i,b=new i;return function(c,d){a.subVectors(c,this.start),b.subVectors(this.end,this.start);var e=b.dot(b),e=b.dot(a)/e;return d&&(e=Td.clamp(e,0,1)),e}}(),closestPointToPoint:function(a,b,c){return a=this.closestPointToPointParameter(a,b),c=c||new i,this.delta(c).multiplyScalar(a).add(this.start)},applyMatrix4:function(a){return this.start.applyMatrix4(a),this.end.applyMatrix4(a),this},equals:function(a){return a.start.equals(this.start)&&a.end.equals(this.end)}},ga.normal=function(){var a=new i;return function(b,c,d,e){return e=e||new i,e.subVectors(d,c),a.subVectors(b,c),e.cross(a),b=e.lengthSq(),0<b?e.multiplyScalar(1/Math.sqrt(b)):e.set(0,0,0)}}(),ga.barycoordFromPoint=function(){var a=new i,b=new i,c=new i;return function(d,e,f,g,h){a.subVectors(g,e),b.subVectors(f,e),c.subVectors(d,e),d=a.dot(a),e=a.dot(b),f=a.dot(c);var j=b.dot(b);g=b.dot(c);var k=d*j-e*e;return h=h||new i,0===k?h.set(-2,-1,-1):(k=1/k,j=(j*f-e*g)*k,d=(d*g-e*f)*k,h.set(1-j-d,d,j))}}(),ga.containsPoint=function(){var a=new i;return function(b,c,d,e){return b=ga.barycoordFromPoint(b,c,d,e,a),0<=b.x&&0<=b.y&&1>=b.x+b.y}}(),ga.prototype={constructor:ga,set:function(a,b,c){return this.a.copy(a),this.b.copy(b),this.c.copy(c),this},setFromPointsAndIndices:function(a,b,c,d){return this.a.copy(a[b]),this.b.copy(a[c]),this.c.copy(a[d]),this},clone:function(){return(new this.constructor).copy(this)},copy:function(a){return this.a.copy(a.a),this.b.copy(a.b),this.c.copy(a.c),this},area:function(){var a=new i,b=new i;return function(){return a.subVectors(this.c,this.b),b.subVectors(this.a,this.b),.5*a.cross(b).length()}}(),midpoint:function(a){return(a||new i).addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)},normal:function(a){return ga.normal(this.a,this.b,this.c,a)},plane:function(a){return(a||new $).setFromCoplanarPoints(this.a,this.b,this.c)},barycoordFromPoint:function(a,b){return ga.barycoordFromPoint(a,this.a,this.b,this.c,b)},containsPoint:function(a){return ga.containsPoint(a,this.a,this.b,this.c)},closestPointToPoint:function(){var a,b,c,d;return function(e,f){void 0===a&&(a=new $,b=[new fa,new fa,new fa],c=new i,d=new i);var g=f||new i,h=1/0;if(a.setFromCoplanarPoints(this.a,this.b,this.c),a.projectPoint(e,c),!0===this.containsPoint(c))g.copy(c);else{b[0].set(this.a,this.b),b[1].set(this.b,this.c),b[2].set(this.c,this.a);for(var j=0;j<b.length;j++){b[j].closestPointToPoint(c,!0,d);var k=c.distanceToSquared(d);k<h&&(h=k,g.copy(d))}}return g}}(),equals:function(a){return a.a.equals(this.a)&&a.b.equals(this.b)&&a.c.equals(this.c)}},ha.prototype={constructor:ha,clone:function(){return(new this.constructor).copy(this)},copy:function(a){this.a=a.a,this.b=a.b,this.c=a.c,this.normal.copy(a.normal),this.color.copy(a.color),this.materialIndex=a.materialIndex;for(var b=0,c=a.vertexNormals.length;b<c;b++)this.vertexNormals[b]=a.vertexNormals[b].clone();for(b=0,c=a.vertexColors.length;b<c;b++)this.vertexColors[b]=a.vertexColors[b].clone();return this}},ia.prototype=Object.create(U.prototype),ia.prototype.constructor=ia,ia.prototype.isMeshBasicMaterial=!0,ia.prototype.copy=function(a){return U.prototype.copy.call(this,a),this.color.copy(a.color),this.map=a.map,this.aoMap=a.aoMap,this.aoMapIntensity=a.aoMapIntensity,this.specularMap=a.specularMap,this.alphaMap=a.alphaMap,this.envMap=a.envMap,this.combine=a.combine,this.reflectivity=a.reflectivity,this.refractionRatio=a.refractionRatio,this.wireframe=a.wireframe,this.wireframeLinewidth=a.wireframeLinewidth,this.wireframeLinecap=a.wireframeLinecap,this.wireframeLinejoin=a.wireframeLinejoin,this.skinning=a.skinning,this.morphTargets=a.morphTargets,this},ja.prototype={constructor:ja,isBufferAttribute:!0,set needsUpdate(a){!0===a&&this.version++},setArray:function(a){if(Array.isArray(a))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.count=void 0!==a?a.length/this.itemSize:0,this.array=a},setDynamic:function(a){return this.dynamic=a,this},copy:function(a){return this.array=new a.array.constructor(a.array),this.itemSize=a.itemSize,this.count=a.count,this.normalized=a.normalized,this.dynamic=a.dynamic,this},copyAt:function(a,b,c){a*=this.itemSize,c*=b.itemSize;for(var d=0,e=this.itemSize;d<e;d++)this.array[a+d]=b.array[c+d];return this},copyArray:function(a){return this.array.set(a),this},copyColorsArray:function(a){for(var b=this.array,c=0,d=0,e=a.length;d<e;d++){var f=a[d];void 0===f&&(console.warn("THREE.BufferAttribute.copyColorsArray(): color is undefined",d),f=new Q),b[c++]=f.r,b[c++]=f.g,b[c++]=f.b}return this},copyIndicesArray:function(a){for(var b=this.array,c=0,d=0,e=a.length;d<e;d++){var f=a[d];b[c++]=f.a,b[c++]=f.b,b[c++]=f.c}return this},copyVector2sArray:function(a){for(var b=this.array,d=0,e=0,f=a.length;e<f;e++){var g=a[e];void 0===g&&(console.warn("THREE.BufferAttribute.copyVector2sArray(): vector is undefined",e),g=new c),b[d++]=g.x,b[d++]=g.y}return this},copyVector3sArray:function(a){for(var b=this.array,c=0,d=0,e=a.length;d<e;d++){var f=a[d];void 0===f&&(console.warn("THREE.BufferAttribute.copyVector3sArray(): vector is undefined",d),f=new i),b[c++]=f.x,b[c++]=f.y,b[c++]=f.z}return this},copyVector4sArray:function(a){for(var b=this.array,c=0,d=0,f=a.length;d<f;d++){var g=a[d];void 0===g&&(console.warn("THREE.BufferAttribute.copyVector4sArray(): vector is undefined",d),g=new e),b[c++]=g.x,b[c++]=g.y,b[c++]=g.z,b[c++]=g.w}return this},set:function(a,b){return void 0===b&&(b=0),this.array.set(a,b),this},getX:function(a){return this.array[a*this.itemSize]},setX:function(a,b){return this.array[a*this.itemSize]=b,this},getY:function(a){return this.array[a*this.itemSize+1]},setY:function(a,b){return this.array[a*this.itemSize+1]=b,this},getZ:function(a){return this.array[a*this.itemSize+2]},setZ:function(a,b){return this.array[a*this.itemSize+2]=b,this},getW:function(a){return this.array[a*this.itemSize+3]},setW:function(a,b){return this.array[a*this.itemSize+3]=b,this},setXY:function(a,b,c){return a*=this.itemSize,this.array[a+0]=b,this.array[a+1]=c,this},setXYZ:function(a,b,c,d){return a*=this.itemSize,this.array[a+0]=b,this.array[a+1]=c,this.array[a+2]=d,this},setXYZW:function(a,b,c,d,e){return a*=this.itemSize,this.array[a+0]=b,this.array[a+1]=c,this.array[a+2]=d,this.array[a+3]=e,this},clone:function(){return(new this.constructor).copy(this)}},Object.assign(na.prototype,b.prototype,{isGeometry:!0,applyMatrix:function(a){for(var b=(new Z).getNormalMatrix(a),c=0,d=this.vertices.length;c<d;c++)this.vertices[c].applyMatrix4(a);for(c=0,d=this.faces.length;c<d;c++){a=this.faces[c],a.normal.applyMatrix3(b).normalize();for(var e=0,f=a.vertexNormals.length;e<f;e++)a.vertexNormals[e].applyMatrix3(b).normalize()}return null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this.normalsNeedUpdate=this.verticesNeedUpdate=!0,this},rotateX:function(){var a;return function(b){return void 0===a&&(a=new j),a.makeRotationX(b),this.applyMatrix(a),this}}(),rotateY:function(){var a;return function(b){return void 0===a&&(a=new j),a.makeRotationY(b),this.applyMatrix(a),this}}(),rotateZ:function(){var a;return function(b){return void 0===a&&(a=new j),a.makeRotationZ(b),this.applyMatrix(a),this}}(),translate:function(){var a;return function(b,c,d){return void 0===a&&(a=new j),a.makeTranslation(b,c,d),this.applyMatrix(a),this}}(),scale:function(){var a;return function(b,c,d){return void 0===a&&(a=new j),a.makeScale(b,c,d),this.applyMatrix(a),this}}(),lookAt:function(){var a;return function(b){void 0===a&&(a=new ea),a.lookAt(b),a.updateMatrix(),this.applyMatrix(a.matrix)}}(),fromBufferGeometry:function(a){function b(a,b,c,e){e=new ha(a,b,c,void 0!==h?[m[a].clone(),m[b].clone(),m[c].clone()]:[],void 0!==j?[d.colors[a].clone(),d.colors[b].clone(),d.colors[c].clone()]:[],e),d.faces.push(e),void 0!==k&&d.faceVertexUvs[0].push([n[a].clone(),n[b].clone(),n[c].clone()]),void 0!==l&&d.faceVertexUvs[1].push([o[a].clone(),o[b].clone(),o[c].clone()])}var d=this,e=null!==a.index?a.index.array:void 0,f=a.attributes,g=f.position.array,h=void 0!==f.normal?f.normal.array:void 0,j=void 0!==f.color?f.color.array:void 0,k=void 0!==f.uv?f.uv.array:void 0,l=void 0!==f.uv2?f.uv2.array:void 0;void 0!==l&&(this.faceVertexUvs[1]=[]);for(var m=[],n=[],o=[],p=f=0;f<g.length;f+=3,p+=2)d.vertices.push(new i(g[f],g[f+1],g[f+2])),void 0!==h&&m.push(new i(h[f],h[f+1],h[f+2])),void 0!==j&&d.colors.push(new Q(j[f],j[f+1],j[f+2])),void 0!==k&&n.push(new c(k[p],k[p+1])),void 0!==l&&o.push(new c(l[p],l[p+1]));if(void 0!==e)if(g=a.groups,0<g.length)for(f=0;f<g.length;f++)for(var q=g[f],r=q.start,s=q.count,p=r,r=r+s;p<r;p+=3)b(e[p],e[p+1],e[p+2],q.materialIndex);else for(f=0;f<e.length;f+=3)b(e[f],e[f+1],e[f+2]);else for(f=0;f<g.length/3;f+=3)b(f,f+1,f+2);return this.computeFaceNormals(),null!==a.boundingBox&&(this.boundingBox=a.boundingBox.clone()),null!==a.boundingSphere&&(this.boundingSphere=a.boundingSphere.clone()),this},center:function(){this.computeBoundingBox();var a=this.boundingBox.getCenter().negate();return this.translate(a.x,a.y,a.z),a},normalize:function(){this.computeBoundingSphere();var a=this.boundingSphere.center,b=this.boundingSphere.radius,b=0===b?1:1/b,c=new j;return c.set(b,0,0,-b*a.x,0,b,0,-b*a.y,0,0,b,-b*a.z,0,0,0,1),this.applyMatrix(c),this},computeFaceNormals:function(){for(var a=new i,b=new i,c=0,d=this.faces.length;c<d;c++){var e=this.faces[c],f=this.vertices[e.a],g=this.vertices[e.b];a.subVectors(this.vertices[e.c],g),b.subVectors(f,g),a.cross(b),a.normalize(),e.normal.copy(a)}},computeVertexNormals:function(a){void 0===a&&(a=!0);var b,c,d;for(d=Array(this.vertices.length),b=0,c=this.vertices.length;b<c;b++)d[b]=new i;if(a){var e,f,g,h=new i,j=new i;for(a=0,b=this.faces.length;a<b;a++)c=this.faces[a],e=this.vertices[c.a],f=this.vertices[c.b],g=this.vertices[c.c],h.subVectors(g,f),j.subVectors(e,f),h.cross(j),d[c.a].add(h),d[c.b].add(h),d[c.c].add(h)}else for(this.computeFaceNormals(),a=0,b=this.faces.length;a<b;a++)c=this.faces[a],d[c.a].add(c.normal),d[c.b].add(c.normal),d[c.c].add(c.normal);for(b=0,c=this.vertices.length;b<c;b++)d[b].normalize();for(a=0,b=this.faces.length;a<b;a++)c=this.faces[a],e=c.vertexNormals,3===e.length?(e[0].copy(d[c.a]),e[1].copy(d[c.b]),e[2].copy(d[c.c])):(e[0]=d[c.a].clone(),e[1]=d[c.b].clone(),e[2]=d[c.c].clone());0<this.faces.length&&(this.normalsNeedUpdate=!0)},computeFlatVertexNormals:function(){var a,b,c;for(this.computeFaceNormals(),a=0,b=this.faces.length;a<b;a++){c=this.faces[a];var d=c.vertexNormals;3===d.length?(d[0].copy(c.normal),d[1].copy(c.normal),d[2].copy(c.normal)):(d[0]=c.normal.clone(),d[1]=c.normal.clone(),d[2]=c.normal.clone())}0<this.faces.length&&(this.normalsNeedUpdate=!0)},computeMorphNormals:function(){var a,b,c,d,e;for(c=0,d=this.faces.length;c<d;c++)for(e=this.faces[c],e.__originalFaceNormal?e.__originalFaceNormal.copy(e.normal):e.__originalFaceNormal=e.normal.clone(),e.__originalVertexNormals||(e.__originalVertexNormals=[]),a=0,b=e.vertexNormals.length;a<b;a++)e.__originalVertexNormals[a]?e.__originalVertexNormals[a].copy(e.vertexNormals[a]):e.__originalVertexNormals[a]=e.vertexNormals[a].clone();var f=new na;for(f.faces=this.faces,a=0,b=this.morphTargets.length;a<b;a++){if(!this.morphNormals[a]){this.morphNormals[a]={},this.morphNormals[a].faceNormals=[],this.morphNormals[a].vertexNormals=[],e=this.morphNormals[a].faceNormals;var g,h,j=this.morphNormals[a].vertexNormals;for(c=0,d=this.faces.length;c<d;c++)g=new i,h={a:new i,b:new i,c:new i},e.push(g),j.push(h)}for(j=this.morphNormals[a],f.vertices=this.morphTargets[a].vertices,f.computeFaceNormals(),f.computeVertexNormals(),c=0,d=this.faces.length;c<d;c++)e=this.faces[c],g=j.faceNormals[c],h=j.vertexNormals[c],g.copy(e.normal),h.a.copy(e.vertexNormals[0]),h.b.copy(e.vertexNormals[1]),h.c.copy(e.vertexNormals[2])}for(c=0,d=this.faces.length;c<d;c++)e=this.faces[c],e.normal=e.__originalFaceNormal,e.vertexNormals=e.__originalVertexNormals},computeTangents:function(){console.warn("THREE.Geometry: .computeTangents() has been removed.")},computeLineDistances:function(){for(var a=0,b=this.vertices,c=0,d=b.length;c<d;c++)0<c&&(a+=b[c].distanceTo(b[c-1])),this.lineDistances[c]=a},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new X),this.boundingBox.setFromPoints(this.vertices)},computeBoundingSphere:function(){null===this.boundingSphere&&(this.boundingSphere=new Y),this.boundingSphere.setFromPoints(this.vertices)},merge:function(a,b,c){if(!1===(a&&a.isGeometry))console.error("THREE.Geometry.merge(): geometry not an instance of THREE.Geometry.",a);else{var d,e=this.vertices.length,f=this.vertices,g=a.vertices,h=this.faces,i=a.faces,j=this.faceVertexUvs[0],k=a.faceVertexUvs[0],l=this.colors,m=a.colors;void 0===c&&(c=0),void 0!==b&&(d=(new Z).getNormalMatrix(b)),a=0;for(var n=g.length;a<n;a++){var o=g[a].clone();void 0!==b&&o.applyMatrix4(b),f.push(o)}for(a=0,n=m.length;a<n;a++)l.push(m[a].clone());for(a=0,n=i.length;a<n;a++){var g=i[a],p=g.vertexNormals,m=g.vertexColors,l=new ha(g.a+e,g.b+e,g.c+e);for(l.normal.copy(g.normal),void 0!==d&&l.normal.applyMatrix3(d).normalize(),b=0,f=p.length;b<f;b++)o=p[b].clone(),void 0!==d&&o.applyMatrix3(d).normalize(),l.vertexNormals.push(o);for(l.color.copy(g.color),b=0,f=m.length;b<f;b++)o=m[b],l.vertexColors.push(o.clone());l.materialIndex=g.materialIndex+c,h.push(l)}for(a=0,n=k.length;a<n;a++)if(c=k[a],d=[],void 0!==c){for(b=0,f=c.length;b<f;b++)d.push(c[b].clone());j.push(d)}}},mergeMesh:function(a){!1===(a&&a.isMesh)?console.error("THREE.Geometry.mergeMesh(): mesh not an instance of THREE.Mesh.",a):(a.matrixAutoUpdate&&a.updateMatrix(),this.merge(a.geometry,a.matrix))},mergeVertices:function(){var a,b,c,d={},e=[],f=[],g=Math.pow(10,4);for(b=0,c=this.vertices.length;b<c;b++)a=this.vertices[b],a=Math.round(a.x*g)+"_"+Math.round(a.y*g)+"_"+Math.round(a.z*g),void 0===d[a]?(d[a]=b,e.push(this.vertices[b]),f[b]=e.length-1):f[b]=f[d[a]];for(d=[],b=0,c=this.faces.length;b<c;b++)for(g=this.faces[b],g.a=f[g.a],g.b=f[g.b],g.c=f[g.c],g=[g.a,g.b,g.c],a=0;3>a;a++)if(g[a]===g[(a+1)%3]){d.push(b);break}for(b=d.length-1;0<=b;b--)for(g=d[b],this.faces.splice(g,1),f=0,c=this.faceVertexUvs.length;f<c;f++)this.faceVertexUvs[f].splice(g,1);return b=this.vertices.length-e.length,this.vertices=e,b},sortFacesByMaterialIndex:function(){for(var a=this.faces,b=a.length,c=0;c<b;c++)a[c]._id=c;a.sort(function(a,b){return a.materialIndex-b.materialIndex});var d,e,f=this.faceVertexUvs[0],g=this.faceVertexUvs[1];for(f&&f.length===b&&(d=[]),g&&g.length===b&&(e=[]),c=0;c<b;c++){var h=a[c]._id;d&&d.push(f[h]),e&&e.push(g[h])}d&&(this.faceVertexUvs[0]=d),e&&(this.faceVertexUvs[1]=e)},toJSON:function(){function a(a,b,c){return c?a|1<<b:a&~(1<<b)}function b(a){var b=a.x.toString()+a.y.toString()+a.z.toString();return void 0!==j[b]?j[b]:(j[b]=i.length/3,i.push(a.x,a.y,a.z),j[b])}function c(a){var b=a.r.toString()+a.g.toString()+a.b.toString();return void 0!==l[b]?l[b]:(l[b]=k.length,k.push(a.getHex()),l[b])}function d(a){var b=a.x.toString()+a.y.toString();return void 0!==n[b]?n[b]:(n[b]=m.length/2,m.push(a.x,a.y),n[b])}var e={metadata:{version:4.4,type:"Geometry",generator:"Geometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.type,""!==this.name&&(e.name=this.name),void 0!==this.parameters){var f,g=this.parameters;for(f in g)void 0!==g[f]&&(e[f]=g[f]);return e}for(g=[],f=0;f<this.vertices.length;f++){var h=this.vertices[f];g.push(h.x,h.y,h.z)}var h=[],i=[],j={},k=[],l={},m=[],n={};for(f=0;f<this.faces.length;f++){var o=this.faces[f],p=void 0!==this.faceVertexUvs[0][f],q=0<o.normal.length(),r=0<o.vertexNormals.length,s=1!==o.color.r||1!==o.color.g||1!==o.color.b,t=0<o.vertexColors.length,u=0,u=a(u,0,0),u=a(u,1,!0),u=a(u,2,!1),u=a(u,3,p),u=a(u,4,q),u=a(u,5,r),u=a(u,6,s),u=a(u,7,t);h.push(u),h.push(o.a,o.b,o.c),h.push(o.materialIndex),p&&(p=this.faceVertexUvs[0][f],h.push(d(p[0]),d(p[1]),d(p[2]))),q&&h.push(b(o.normal)),r&&(q=o.vertexNormals,h.push(b(q[0]),b(q[1]),b(q[2]))),s&&h.push(c(o.color)),t&&(o=o.vertexColors,h.push(c(o[0]),c(o[1]),c(o[2])))}return e.data={},e.data.vertices=g,e.data.normals=i,0<k.length&&(e.data.colors=k),0<m.length&&(e.data.uvs=[m]),e.data.faces=h,e},clone:function(){return(new na).copy(this)},copy:function(a){this.vertices=[],this.faces=[],this.faceVertexUvs=[[]],this.colors=[];for(var b=a.vertices,c=0,d=b.length;c<d;c++)this.vertices.push(b[c].clone());for(b=a.colors,c=0,d=b.length;c<d;c++)this.colors.push(b[c].clone());for(b=a.faces,c=0,d=b.length;c<d;c++)this.faces.push(b[c].clone());for(c=0,d=a.faceVertexUvs.length;c<d;c++){b=a.faceVertexUvs[c],void 0===this.faceVertexUvs[c]&&(this.faceVertexUvs[c]=[]);for(var e=0,f=b.length;e<f;e++){for(var g=b[e],h=[],i=0,j=g.length;i<j;i++)h.push(g[i].clone());this.faceVertexUvs[c].push(h)}}return this},dispose:function(){this.dispatchEvent({type:"dispose"})}});var fe=0;Object.assign(oa.prototype,b.prototype,{computeBoundingBox:na.prototype.computeBoundingBox,computeBoundingSphere:na.prototype.computeBoundingSphere,computeFaceNormals:function(){console.warn("THREE.DirectGeometry: computeFaceNormals() is not a method of this type of geometry.")},computeVertexNormals:function(){console.warn("THREE.DirectGeometry: computeVertexNormals() is not a method of this type of geometry.")},computeGroups:function(a){var b,c,d=[];a=a.faces;for(var e=0;e<a.length;e++){var f=a[e];f.materialIndex!==c&&(c=f.materialIndex,void 0!==b&&(b.count=3*e-b.start,d.push(b)),b={start:3*e,materialIndex:c})}void 0!==b&&(b.count=3*e-b.start,d.push(b)),this.groups=d},fromGeometry:function(a){var b,d=a.faces,e=a.vertices,f=a.faceVertexUvs,g=f[0]&&0<f[0].length,h=f[1]&&0<f[1].length,i=a.morphTargets,j=i.length;if(0<j){b=[];for(var k=0;k<j;k++)b[k]=[];this.morphTargets.position=b}var l,m=a.morphNormals,n=m.length;if(0<n){for(l=[],k=0;k<n;k++)l[k]=[];this.morphTargets.normal=l}for(var o=a.skinIndices,p=a.skinWeights,q=o.length===e.length,r=p.length===e.length,k=0;k<d.length;k++){var s=d[k];this.vertices.push(e[s.a],e[s.b],e[s.c]);var t=s.vertexNormals;for(3===t.length?this.normals.push(t[0],t[1],t[2]):(t=s.normal,this.normals.push(t,t,t)),t=s.vertexColors,3===t.length?this.colors.push(t[0],t[1],t[2]):(t=s.color,this.colors.push(t,t,t)),!0===g&&(t=f[0][k], void 0!==t?this.uvs.push(t[0],t[1],t[2]):(console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv ",k),this.uvs.push(new c,new c,new c))),!0===h&&(t=f[1][k],void 0!==t?this.uvs2.push(t[0],t[1],t[2]):(console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv2 ",k),this.uvs2.push(new c,new c,new c))),t=0;t<j;t++){var u=i[t].vertices;b[t].push(u[s.a],u[s.b],u[s.c])}for(t=0;t<n;t++)u=m[t].vertexNormals[k],l[t].push(u.a,u.b,u.c);q&&this.skinIndices.push(o[s.a],o[s.b],o[s.c]),r&&this.skinWeights.push(p[s.a],p[s.b],p[s.c])}return this.computeGroups(a),this.verticesNeedUpdate=a.verticesNeedUpdate,this.normalsNeedUpdate=a.normalsNeedUpdate,this.colorsNeedUpdate=a.colorsNeedUpdate,this.uvsNeedUpdate=a.uvsNeedUpdate,this.groupsNeedUpdate=a.groupsNeedUpdate,this},dispose:function(){this.dispatchEvent({type:"dispose"})}}),Object.assign(pa.prototype,b.prototype,{isBufferGeometry:!0,getIndex:function(){return this.index},setIndex:function(a){this.index=a},addAttribute:function(a,b,c){if(!1===(b&&b.isBufferAttribute)&&!1===(b&&b.isInterleavedBufferAttribute))console.warn("THREE.BufferGeometry: .addAttribute() now expects ( name, attribute )."),this.addAttribute(a,new ja(b,c));else{if("index"!==a)return this.attributes[a]=b,this;console.warn("THREE.BufferGeometry.addAttribute: Use .setIndex() for index attribute."),this.setIndex(b)}},getAttribute:function(a){return this.attributes[a]},removeAttribute:function(a){return delete this.attributes[a],this},addGroup:function(a,b,c){this.groups.push({start:a,count:b,materialIndex:void 0!==c?c:0})},clearGroups:function(){this.groups=[]},setDrawRange:function(a,b){this.drawRange.start=a,this.drawRange.count=b},applyMatrix:function(a){var b=this.attributes.position;return void 0!==b&&(a.applyToVector3Array(b.array),b.needsUpdate=!0),b=this.attributes.normal,void 0!==b&&((new Z).getNormalMatrix(a).applyToVector3Array(b.array),b.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this},rotateX:function(){var a;return function(b){return void 0===a&&(a=new j),a.makeRotationX(b),this.applyMatrix(a),this}}(),rotateY:function(){var a;return function(b){return void 0===a&&(a=new j),a.makeRotationY(b),this.applyMatrix(a),this}}(),rotateZ:function(){var a;return function(b){return void 0===a&&(a=new j),a.makeRotationZ(b),this.applyMatrix(a),this}}(),translate:function(){var a;return function(b,c,d){return void 0===a&&(a=new j),a.makeTranslation(b,c,d),this.applyMatrix(a),this}}(),scale:function(){var a;return function(b,c,d){return void 0===a&&(a=new j),a.makeScale(b,c,d),this.applyMatrix(a),this}}(),lookAt:function(){var a;return function(b){void 0===a&&(a=new ea),a.lookAt(b),a.updateMatrix(),this.applyMatrix(a.matrix)}}(),center:function(){this.computeBoundingBox();var a=this.boundingBox.getCenter().negate();return this.translate(a.x,a.y,a.z),a},setFromObject:function(a){var b=a.geometry;if(a&&a.isPoints||a&&a.isLine){a=new ma(3*b.vertices.length,3);var c=new ma(3*b.colors.length,3);this.addAttribute("position",a.copyVector3sArray(b.vertices)),this.addAttribute("color",c.copyColorsArray(b.colors)),b.lineDistances&&b.lineDistances.length===b.vertices.length&&(a=new ma(b.lineDistances.length,1),this.addAttribute("lineDistance",a.copyArray(b.lineDistances))),null!==b.boundingSphere&&(this.boundingSphere=b.boundingSphere.clone()),null!==b.boundingBox&&(this.boundingBox=b.boundingBox.clone())}else a&&a.isMesh&&b&&b.isGeometry&&this.fromGeometry(b);return this},updateFromObject:function(a){var b=a.geometry;if(a&&a.isMesh){var c=b.__directGeometry;if(!0===b.elementsNeedUpdate&&(c=void 0,b.elementsNeedUpdate=!1),void 0===c)return this.fromGeometry(b);c.verticesNeedUpdate=b.verticesNeedUpdate,c.normalsNeedUpdate=b.normalsNeedUpdate,c.colorsNeedUpdate=b.colorsNeedUpdate,c.uvsNeedUpdate=b.uvsNeedUpdate,c.groupsNeedUpdate=b.groupsNeedUpdate,b.verticesNeedUpdate=!1,b.normalsNeedUpdate=!1,b.colorsNeedUpdate=!1,b.uvsNeedUpdate=!1,b.groupsNeedUpdate=!1,b=c}return!0===b.verticesNeedUpdate&&(c=this.attributes.position,void 0!==c&&(c.copyVector3sArray(b.vertices),c.needsUpdate=!0),b.verticesNeedUpdate=!1),!0===b.normalsNeedUpdate&&(c=this.attributes.normal,void 0!==c&&(c.copyVector3sArray(b.normals),c.needsUpdate=!0),b.normalsNeedUpdate=!1),!0===b.colorsNeedUpdate&&(c=this.attributes.color,void 0!==c&&(c.copyColorsArray(b.colors),c.needsUpdate=!0),b.colorsNeedUpdate=!1),b.uvsNeedUpdate&&(c=this.attributes.uv,void 0!==c&&(c.copyVector2sArray(b.uvs),c.needsUpdate=!0),b.uvsNeedUpdate=!1),b.lineDistancesNeedUpdate&&(c=this.attributes.lineDistance,void 0!==c&&(c.copyArray(b.lineDistances),c.needsUpdate=!0),b.lineDistancesNeedUpdate=!1),b.groupsNeedUpdate&&(b.computeGroups(a.geometry),this.groups=b.groups,b.groupsNeedUpdate=!1),this},fromGeometry:function(a){return a.__directGeometry=(new oa).fromGeometry(a),this.fromDirectGeometry(a.__directGeometry)},fromDirectGeometry:function(a){var b=new Float32Array(3*a.vertices.length);this.addAttribute("position",new ja(b,3).copyVector3sArray(a.vertices)),0<a.normals.length&&(b=new Float32Array(3*a.normals.length),this.addAttribute("normal",new ja(b,3).copyVector3sArray(a.normals))),0<a.colors.length&&(b=new Float32Array(3*a.colors.length),this.addAttribute("color",new ja(b,3).copyColorsArray(a.colors))),0<a.uvs.length&&(b=new Float32Array(2*a.uvs.length),this.addAttribute("uv",new ja(b,2).copyVector2sArray(a.uvs))),0<a.uvs2.length&&(b=new Float32Array(2*a.uvs2.length),this.addAttribute("uv2",new ja(b,2).copyVector2sArray(a.uvs2))),0<a.indices.length&&(b=new(65535<a.vertices.length?Uint32Array:Uint16Array)(3*a.indices.length),this.setIndex(new ja(b,1).copyIndicesArray(a.indices))),this.groups=a.groups;for(var c in a.morphTargets){for(var b=[],d=a.morphTargets[c],e=0,f=d.length;e<f;e++){var g=d[e],h=new ma(3*g.length,3);b.push(h.copyVector3sArray(g))}this.morphAttributes[c]=b}return 0<a.skinIndices.length&&(c=new ma(4*a.skinIndices.length,4),this.addAttribute("skinIndex",c.copyVector4sArray(a.skinIndices))),0<a.skinWeights.length&&(c=new ma(4*a.skinWeights.length,4),this.addAttribute("skinWeight",c.copyVector4sArray(a.skinWeights))),null!==a.boundingSphere&&(this.boundingSphere=a.boundingSphere.clone()),null!==a.boundingBox&&(this.boundingBox=a.boundingBox.clone()),this},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new X);var a=this.attributes.position.array;void 0!==a?this.boundingBox.setFromArray(a):this.boundingBox.makeEmpty(),(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&console.error('THREE.BufferGeometry.computeBoundingBox: Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)},computeBoundingSphere:function(){var a=new X,b=new i;return function(){null===this.boundingSphere&&(this.boundingSphere=new Y);var c=this.attributes.position;if(c){var c=c.array,d=this.boundingSphere.center;a.setFromArray(c),a.getCenter(d);for(var e=0,f=0,g=c.length;f<g;f+=3)b.fromArray(c,f),e=Math.max(e,d.distanceToSquared(b));this.boundingSphere.radius=Math.sqrt(e),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}}(),computeFaceNormals:function(){},computeVertexNormals:function(){var a=this.index,b=this.attributes,c=this.groups;if(b.position){var d=b.position.array;if(void 0===b.normal)this.addAttribute("normal",new ja(new Float32Array(d.length),3));else for(var e=b.normal.array,f=0,g=e.length;f<g;f++)e[f]=0;var h,j,k,e=b.normal.array,l=new i,m=new i,n=new i,o=new i,p=new i;if(a){a=a.array,0===c.length&&this.addGroup(0,a.length);for(var q=0,r=c.length;q<r;++q)for(f=c[q],g=f.start,h=f.count,f=g,g+=h;f<g;f+=3)h=3*a[f+0],j=3*a[f+1],k=3*a[f+2],l.fromArray(d,h),m.fromArray(d,j),n.fromArray(d,k),o.subVectors(n,m),p.subVectors(l,m),o.cross(p),e[h]+=o.x,e[h+1]+=o.y,e[h+2]+=o.z,e[j]+=o.x,e[j+1]+=o.y,e[j+2]+=o.z,e[k]+=o.x,e[k+1]+=o.y,e[k+2]+=o.z}else for(f=0,g=d.length;f<g;f+=9)l.fromArray(d,f),m.fromArray(d,f+3),n.fromArray(d,f+6),o.subVectors(n,m),p.subVectors(l,m),o.cross(p),e[f]=o.x,e[f+1]=o.y,e[f+2]=o.z,e[f+3]=o.x,e[f+4]=o.y,e[f+5]=o.z,e[f+6]=o.x,e[f+7]=o.y,e[f+8]=o.z;this.normalizeNormals(),b.normal.needsUpdate=!0}},merge:function(a,b){if(!1!==(a&&a.isBufferGeometry)){void 0===b&&(b=0);var c,d=this.attributes;for(c in d)if(void 0!==a.attributes[c])for(var e=d[c].array,f=a.attributes[c],g=f.array,h=0,f=f.itemSize*b;h<g.length;h++,f++)e[f]=g[h];return this}console.error("THREE.BufferGeometry.merge(): geometry not an instance of THREE.BufferGeometry.",a)},normalizeNormals:function(){for(var a,b,c,d=this.attributes.normal.array,e=0,f=d.length;e<f;e+=3)a=d[e],b=d[e+1],c=d[e+2],a=1/Math.sqrt(a*a+b*b+c*c),d[e]*=a,d[e+1]*=a,d[e+2]*=a},toNonIndexed:function(){if(null===this.index)return console.warn("THREE.BufferGeometry.toNonIndexed(): Geometry is already non-indexed."),this;var a,b=new pa,c=this.index.array,d=this.attributes;for(a in d){for(var e,f=d[a],g=f.array,f=f.itemSize,h=new g.constructor(c.length*f),i=0,j=0,k=c.length;j<k;j++){e=c[j]*f;for(var l=0;l<f;l++)h[i++]=g[e++]}b.addAttribute(a,new ja(h,f))}return b},toJSON:function(){var a={metadata:{version:4.4,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(a.uuid=this.uuid,a.type=this.type,""!==this.name&&(a.name=this.name),void 0!==this.parameters){var b,c=this.parameters;for(b in c)void 0!==c[b]&&(a[b]=c[b]);return a}a.data={attributes:{}};var d=this.index;null!==d&&(c=Array.prototype.slice.call(d.array),a.data.index={type:d.array.constructor.name,array:c}),d=this.attributes;for(b in d){var e=d[b],c=Array.prototype.slice.call(e.array);a.data.attributes[b]={itemSize:e.itemSize,type:e.array.constructor.name,array:c,normalized:e.normalized}}return b=this.groups,0<b.length&&(a.data.groups=JSON.parse(JSON.stringify(b))),b=this.boundingSphere,null!==b&&(a.data.boundingSphere={center:b.center.toArray(),radius:b.radius}),a},clone:function(){return(new pa).copy(this)},copy:function(a){var b=a.index;null!==b&&this.setIndex(b.clone());var c,b=a.attributes;for(c in b)this.addAttribute(c,b[c].clone());for(a=a.groups,c=0,b=a.length;c<b;c++){var d=a[c];this.addGroup(d.start,d.count,d.materialIndex)}return this},dispose:function(){this.dispatchEvent({type:"dispose"})}}),pa.MaxIndex=65535,qa.prototype=Object.assign(Object.create(ea.prototype),{constructor:qa,isMesh:!0,setDrawMode:function(a){this.drawMode=a},copy:function(a){return ea.prototype.copy.call(this,a),this.drawMode=a.drawMode,this},updateMorphTargets:function(){var a=this.geometry.morphTargets;if(void 0!==a&&0<a.length){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(var b=0,c=a.length;b<c;b++)this.morphTargetInfluences.push(0),this.morphTargetDictionary[a[b].name]=b}},raycast:function(){function a(a,b,c,d,e,f,g){return ga.barycoordFromPoint(a,b,c,d,s),e.multiplyScalar(s.x),f.multiplyScalar(s.y),g.multiplyScalar(s.z),e.add(f).add(g),e.clone()}function b(a,b,c,d,e,f,g){var h=a.material;return null===(1===h.side?c.intersectTriangle(f,e,d,!0,g):c.intersectTriangle(d,e,f,2!==h.side,g))?null:(u.copy(g),u.applyMatrix4(a.matrixWorld),c=b.ray.origin.distanceTo(u),c<b.near||c>b.far?null:{distance:c,point:u.clone(),object:a})}function d(c,d,e,f,g,i,j,m){return h.fromArray(f,3*i),k.fromArray(f,3*j),l.fromArray(f,3*m),(c=b(c,d,e,h,k,l,t))&&(g&&(p.fromArray(g,2*i),q.fromArray(g,2*j),r.fromArray(g,2*m),c.uv=a(t,h,k,l,p,q,r)),c.face=new ha(i,j,m,ga.normal(h,k,l)),c.faceIndex=i),c}var e=new j,f=new ba,g=new Y,h=new i,k=new i,l=new i,m=new i,n=new i,o=new i,p=new c,q=new c,r=new c,s=new i,t=new i,u=new i;return function(c,i){var j=this.geometry,s=this.material,u=this.matrixWorld;if(void 0!==s&&(null===j.boundingSphere&&j.computeBoundingSphere(),g.copy(j.boundingSphere),g.applyMatrix4(u),!1!==c.ray.intersectsSphere(g)&&(e.getInverse(u),f.copy(c.ray).applyMatrix4(e),null===j.boundingBox||!1!==f.intersectsBox(j.boundingBox)))){var v,w;if(j&&j.isBufferGeometry){var x,y,s=j.index,u=j.attributes,j=u.position.array;if(void 0!==u.uv&&(v=u.uv.array),null!==s)for(var u=s.array,z=0,A=u.length;z<A;z+=3)s=u[z],x=u[z+1],y=u[z+2],(w=d(this,c,f,j,v,s,x,y))&&(w.faceIndex=Math.floor(z/3),i.push(w));else for(z=0,A=j.length;z<A;z+=9)s=z/3,x=s+1,y=s+2,(w=d(this,c,f,j,v,s,x,y))&&(w.index=s,i.push(w))}else if(j&&j.isGeometry){var B,C,u=s&&s.isMultiMaterial,z=!0===u?s.materials:null,A=j.vertices;x=j.faces,y=j.faceVertexUvs[0],0<y.length&&(v=y);for(var D=0,E=x.length;D<E;D++){var F=x[D];if(void 0!==(w=!0===u?z[F.materialIndex]:s)){if(y=A[F.a],B=A[F.b],C=A[F.c],!0===w.morphTargets){w=j.morphTargets;var G=this.morphTargetInfluences;h.set(0,0,0),k.set(0,0,0),l.set(0,0,0);for(var H=0,I=w.length;H<I;H++){var J=G[H];if(0!==J){var K=w[H].vertices;h.addScaledVector(m.subVectors(K[F.a],y),J),k.addScaledVector(n.subVectors(K[F.b],B),J),l.addScaledVector(o.subVectors(K[F.c],C),J)}}h.add(y),k.add(B),l.add(C),y=h,B=k,C=l}(w=b(this,c,f,y,B,C,t))&&(v&&(G=v[D],p.copy(G[0]),q.copy(G[1]),r.copy(G[2]),w.uv=a(t,y,B,C,p,q,r)),w.face=F,w.faceIndex=D,i.push(w))}}}}}}(),clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}}),ra.prototype=Object.create(pa.prototype),ra.prototype.constructor=ra,sa.prototype=Object.create(pa.prototype),sa.prototype.constructor=sa,ta.prototype=Object.create(ea.prototype),ta.prototype.constructor=ta,ta.prototype.isCamera=!0,ta.prototype.getWorldDirection=function(){var a=new h;return function(b){return b=b||new i,this.getWorldQuaternion(a),b.set(0,0,-1).applyQuaternion(a)}}(),ta.prototype.lookAt=function(){var a=new j;return function(b){a.lookAt(this.position,b,this.up),this.quaternion.setFromRotationMatrix(a)}}(),ta.prototype.clone=function(){return(new this.constructor).copy(this)},ta.prototype.copy=function(a){return ea.prototype.copy.call(this,a),this.matrixWorldInverse.copy(a.matrixWorldInverse),this.projectionMatrix.copy(a.projectionMatrix),this},ua.prototype=Object.assign(Object.create(ta.prototype),{constructor:ua,isPerspectiveCamera:!0,copy:function(a){return ta.prototype.copy.call(this,a),this.fov=a.fov,this.zoom=a.zoom,this.near=a.near,this.far=a.far,this.focus=a.focus,this.aspect=a.aspect,this.view=null===a.view?null:Object.assign({},a.view),this.filmGauge=a.filmGauge,this.filmOffset=a.filmOffset,this},setFocalLength:function(a){a=.5*this.getFilmHeight()/a,this.fov=2*Td.RAD2DEG*Math.atan(a),this.updateProjectionMatrix()},getFocalLength:function(){var a=Math.tan(.5*Td.DEG2RAD*this.fov);return.5*this.getFilmHeight()/a},getEffectiveFOV:function(){return 2*Td.RAD2DEG*Math.atan(Math.tan(.5*Td.DEG2RAD*this.fov)/this.zoom)},getFilmWidth:function(){return this.filmGauge*Math.min(this.aspect,1)},getFilmHeight:function(){return this.filmGauge/Math.max(this.aspect,1)},setViewOffset:function(a,b,c,d,e,f){this.aspect=a/b,this.view={fullWidth:a,fullHeight:b,offsetX:c,offsetY:d,width:e,height:f},this.updateProjectionMatrix()},clearViewOffset:function(){this.view=null,this.updateProjectionMatrix()},updateProjectionMatrix:function(){var a=this.near,b=a*Math.tan(.5*Td.DEG2RAD*this.fov)/this.zoom,c=2*b,d=this.aspect*c,e=-.5*d,f=this.view;if(null!==f)var g=f.fullWidth,h=f.fullHeight,e=e+f.offsetX*d/g,b=b-f.offsetY*c/h,d=f.width/g*d,c=f.height/h*c;f=this.filmOffset,0!==f&&(e+=a*f/this.getFilmWidth()),this.projectionMatrix.makeFrustum(e,e+d,b-c,b,a,this.far)},toJSON:function(a){return a=ea.prototype.toJSON.call(this,a),a.object.fov=this.fov,a.object.zoom=this.zoom,a.object.near=this.near,a.object.far=this.far,a.object.focus=this.focus,a.object.aspect=this.aspect,null!==this.view&&(a.object.view=Object.assign({},this.view)),a.object.filmGauge=this.filmGauge,a.object.filmOffset=this.filmOffset,a}}),va.prototype=Object.assign(Object.create(ta.prototype),{constructor:va,isOrthographicCamera:!0,copy:function(a){return ta.prototype.copy.call(this,a),this.left=a.left,this.right=a.right,this.top=a.top,this.bottom=a.bottom,this.near=a.near,this.far=a.far,this.zoom=a.zoom,this.view=null===a.view?null:Object.assign({},a.view),this},setViewOffset:function(a,b,c,d,e,f){this.view={fullWidth:a,fullHeight:b,offsetX:c,offsetY:d,width:e,height:f},this.updateProjectionMatrix()},clearViewOffset:function(){this.view=null,this.updateProjectionMatrix()},updateProjectionMatrix:function(){var a=(this.right-this.left)/(2*this.zoom),b=(this.top-this.bottom)/(2*this.zoom),c=(this.right+this.left)/2,d=(this.top+this.bottom)/2,e=c-a,c=c+a,a=d+b,b=d-b;if(null!==this.view)var c=this.zoom/(this.view.width/this.view.fullWidth),b=this.zoom/(this.view.height/this.view.fullHeight),f=(this.right-this.left)/this.view.width,d=(this.top-this.bottom)/this.view.height,e=e+this.view.offsetX/c*f,c=e+this.view.width/c*f,a=a-this.view.offsetY/b*d,b=a-this.view.height/b*d;this.projectionMatrix.makeOrthographic(e,c,a,b,this.near,this.far)},toJSON:function(a){return a=ea.prototype.toJSON.call(this,a),a.object.zoom=this.zoom,a.object.left=this.left,a.object.right=this.right,a.object.top=this.top,a.object.bottom=this.bottom,a.object.near=this.near,a.object.far=this.far,null!==this.view&&(a.object.view=Object.assign({},this.view)),a}});var ge=0;Wa.prototype.isFogExp2=!0,Wa.prototype.clone=function(){return new Wa(this.color.getHex(),this.density)},Wa.prototype.toJSON=function(a){return{type:"FogExp2",color:this.color.getHex(),density:this.density}},Xa.prototype.isFog=!0,Xa.prototype.clone=function(){return new Xa(this.color.getHex(),this.near,this.far)},Xa.prototype.toJSON=function(a){return{type:"Fog",color:this.color.getHex(),near:this.near,far:this.far}},Ya.prototype=Object.create(ea.prototype),Ya.prototype.constructor=Ya,Ya.prototype.copy=function(a,b){return ea.prototype.copy.call(this,a,b),null!==a.background&&(this.background=a.background.clone()),null!==a.fog&&(this.fog=a.fog.clone()),null!==a.overrideMaterial&&(this.overrideMaterial=a.overrideMaterial.clone()),this.autoUpdate=a.autoUpdate,this.matrixAutoUpdate=a.matrixAutoUpdate,this},Ya.prototype.toJSON=function(a){var b=ea.prototype.toJSON.call(this,a);return null!==this.background&&(b.object.background=this.background.toJSON(a)),null!==this.fog&&(b.object.fog=this.fog.toJSON()),b},Za.prototype=Object.assign(Object.create(ea.prototype),{constructor:Za,isLensFlare:!0,copy:function(a){ea.prototype.copy.call(this,a),this.positionScreen.copy(a.positionScreen),this.customUpdateCallback=a.customUpdateCallback;for(var b=0,c=a.lensFlares.length;b<c;b++)this.lensFlares.push(a.lensFlares[b]);return this},add:function(a,b,c,d,e,f){void 0===b&&(b=-1),void 0===c&&(c=0),void 0===f&&(f=1),void 0===e&&(e=new Q(16777215)),void 0===d&&(d=1),c=Math.min(c,Math.max(0,c)),this.lensFlares.push({texture:a,size:b,distance:c,x:0,y:0,z:0,scale:1,rotation:0,opacity:f,color:e,blending:d})},updateLensFlares:function(){var a,b,c=this.lensFlares.length,d=2*-this.positionScreen.x,e=2*-this.positionScreen.y;for(a=0;a<c;a++)b=this.lensFlares[a],b.x=this.positionScreen.x+d*b.distance,b.y=this.positionScreen.y+e*b.distance,b.wantedRotation=b.x*Math.PI*.25,b.rotation+=.25*(b.wantedRotation-b.rotation)}}),$a.prototype=Object.create(U.prototype),$a.prototype.constructor=$a,$a.prototype.copy=function(a){return U.prototype.copy.call(this,a),this.color.copy(a.color),this.map=a.map,this.rotation=a.rotation,this},_a.prototype=Object.assign(Object.create(ea.prototype),{constructor:_a,isSprite:!0,raycast:function(){var a=new i;return function(b,c){a.setFromMatrixPosition(this.matrixWorld);var d=b.ray.distanceSqToPoint(a);d>this.scale.x*this.scale.y/4||c.push({distance:Math.sqrt(d),point:this.position,face:null,object:this})}}(),clone:function(){return new this.constructor(this.material).copy(this)}}),ab.prototype=Object.assign(Object.create(ea.prototype),{constructor:ab,copy:function(a){ea.prototype.copy.call(this,a,!1),a=a.levels;for(var b=0,c=a.length;b<c;b++){var d=a[b];this.addLevel(d.object.clone(),d.distance)}return this},addLevel:function(a,b){void 0===b&&(b=0),b=Math.abs(b);for(var c=this.levels,d=0;d<c.length&&!(b<c[d].distance);d++);c.splice(d,0,{distance:b,object:a}),this.add(a)},getObjectForDistance:function(a){for(var b=this.levels,c=1,d=b.length;c<d&&!(a<b[c].distance);c++);return b[c-1].object},raycast:function(){var a=new i;return function(b,c){a.setFromMatrixPosition(this.matrixWorld);var d=b.ray.origin.distanceTo(a);this.getObjectForDistance(d).raycast(b,c)}}(),update:function(){var a=new i,b=new i;return function(c){var d=this.levels;if(1<d.length){a.setFromMatrixPosition(c.matrixWorld),b.setFromMatrixPosition(this.matrixWorld),c=a.distanceTo(b),d[0].object.visible=!0;for(var e=1,f=d.length;e<f&&c>=d[e].distance;e++)d[e-1].object.visible=!1,d[e].object.visible=!0;for(;e<f;e++)d[e].object.visible=!1}}}(),toJSON:function(a){a=ea.prototype.toJSON.call(this,a),a.object.levels=[];for(var b=this.levels,c=0,d=b.length;c<d;c++){var e=b[c];a.object.levels.push({object:e.object.uuid,distance:e.distance})}return a}}),bb.prototype=Object.create(d.prototype),bb.prototype.constructor=bb,bb.prototype.isDataTexture=!0,Object.assign(cb.prototype,{calculateInverses:function(){this.boneInverses=[];for(var a=0,b=this.bones.length;a<b;a++){var c=new j;this.bones[a]&&c.getInverse(this.bones[a].matrixWorld),this.boneInverses.push(c)}},pose:function(){for(var a,b=0,c=this.bones.length;b<c;b++)(a=this.bones[b])&&a.matrixWorld.getInverse(this.boneInverses[b]);for(b=0,c=this.bones.length;b<c;b++)(a=this.bones[b])&&(a.parent&&a.parent.isBone?(a.matrix.getInverse(a.parent.matrixWorld),a.matrix.multiply(a.matrixWorld)):a.matrix.copy(a.matrixWorld),a.matrix.decompose(a.position,a.quaternion,a.scale))},update:function(){var a=new j;return function(){for(var b=0,c=this.bones.length;b<c;b++)a.multiplyMatrices(this.bones[b]?this.bones[b].matrixWorld:this.identityMatrix,this.boneInverses[b]),a.toArray(this.boneMatrices,16*b);this.useVertexTexture&&(this.boneTexture.needsUpdate=!0)}}(),clone:function(){return new cb(this.bones,this.boneInverses,this.useVertexTexture)}}),db.prototype=Object.assign(Object.create(ea.prototype),{constructor:db,isBone:!0,copy:function(a){return ea.prototype.copy.call(this,a),this.skin=a.skin,this}}),eb.prototype=Object.assign(Object.create(qa.prototype),{constructor:eb,isSkinnedMesh:!0,bind:function(a,b){this.skeleton=a,void 0===b&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),b=this.matrixWorld),this.bindMatrix.copy(b),this.bindMatrixInverse.getInverse(b)},pose:function(){this.skeleton.pose()},normalizeSkinWeights:function(){if(this.geometry&&this.geometry.isGeometry)for(var a=0;a<this.geometry.skinWeights.length;a++){var b=this.geometry.skinWeights[a],c=1/b.lengthManhattan();1/0!==c?b.multiplyScalar(c):b.set(1,0,0,0)}else if(this.geometry&&this.geometry.isBufferGeometry)for(var b=new e,d=this.geometry.attributes.skinWeight,a=0;a<d.count;a++)b.x=d.getX(a),b.y=d.getY(a),b.z=d.getZ(a),b.w=d.getW(a),c=1/b.lengthManhattan(),1/0!==c?b.multiplyScalar(c):b.set(1,0,0,0),d.setXYZW(a,b.x,b.y,b.z,b.w)},updateMatrixWorld:function(a){qa.prototype.updateMatrixWorld.call(this,!0),"attached"===this.bindMode?this.bindMatrixInverse.getInverse(this.matrixWorld):"detached"===this.bindMode?this.bindMatrixInverse.getInverse(this.bindMatrix):console.warn("THREE.SkinnedMesh unrecognized bindMode: "+this.bindMode)},clone:function(){return new this.constructor(this.geometry,this.material,this.skeleton.useVertexTexture).copy(this)}}),fb.prototype=Object.create(U.prototype),fb.prototype.constructor=fb,fb.prototype.isLineBasicMaterial=!0,fb.prototype.copy=function(a){return U.prototype.copy.call(this,a),this.color.copy(a.color),this.linewidth=a.linewidth,this.linecap=a.linecap,this.linejoin=a.linejoin,this},gb.prototype=Object.assign(Object.create(ea.prototype),{constructor:gb,isLine:!0,raycast:function(){var a=new j,b=new ba,c=new Y;return function(d,e){var f=d.linePrecision,f=f*f,g=this.geometry,h=this.matrixWorld;if(null===g.boundingSphere&&g.computeBoundingSphere(),c.copy(g.boundingSphere),c.applyMatrix4(h),!1!==d.ray.intersectsSphere(c)){a.getInverse(h),b.copy(d.ray).applyMatrix4(a);var j=new i,k=new i,h=new i,l=new i,m=this&&this.isLineSegments?2:1;if(g&&g.isBufferGeometry){var n=g.index,o=g.attributes.position.array;if(null!==n)for(var n=n.array,g=0,p=n.length-1;g<p;g+=m){var q=n[g+1];j.fromArray(o,3*n[g]),k.fromArray(o,3*q),q=b.distanceSqToSegment(j,k,l,h),q>f||(l.applyMatrix4(this.matrixWorld),(q=d.ray.origin.distanceTo(l))<d.near||q>d.far||e.push({distance:q,point:h.clone().applyMatrix4(this.matrixWorld),index:g,face:null,faceIndex:null,object:this}))}else for(g=0,p=o.length/3-1;g<p;g+=m)j.fromArray(o,3*g),k.fromArray(o,3*g+3),(q=b.distanceSqToSegment(j,k,l,h))>f||(l.applyMatrix4(this.matrixWorld),(q=d.ray.origin.distanceTo(l))<d.near||q>d.far||e.push({distance:q,point:h.clone().applyMatrix4(this.matrixWorld),index:g,face:null,faceIndex:null,object:this}))}else if(g&&g.isGeometry)for(j=g.vertices,k=j.length,g=0;g<k-1;g+=m)(q=b.distanceSqToSegment(j[g],j[g+1],l,h))>f||(l.applyMatrix4(this.matrixWorld),(q=d.ray.origin.distanceTo(l))<d.near||q>d.far||e.push({distance:q,point:h.clone().applyMatrix4(this.matrixWorld),index:g,face:null,faceIndex:null,object:this}))}}}(),clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}}),hb.prototype=Object.assign(Object.create(gb.prototype),{constructor:hb,isLineSegments:!0}),ib.prototype=Object.create(U.prototype),ib.prototype.constructor=ib,ib.prototype.isPointsMaterial=!0,ib.prototype.copy=function(a){return U.prototype.copy.call(this,a),this.color.copy(a.color),this.map=a.map,this.size=a.size,this.sizeAttenuation=a.sizeAttenuation,this},jb.prototype=Object.assign(Object.create(ea.prototype),{constructor:jb,isPoints:!0,raycast:function(){var a=new j,b=new ba,c=new Y;return function(d,e){function f(a,c){var f=b.distanceSqToPoint(a);if(f<l){var h=b.closestPointToPoint(a);h.applyMatrix4(j);var i=d.ray.origin.distanceTo(h);i<d.near||i>d.far||e.push({distance:i,distanceToRay:Math.sqrt(f),point:h.clone(),index:c,face:null,object:g})}}var g=this,h=this.geometry,j=this.matrixWorld,k=d.params.Points.threshold;if(null===h.boundingSphere&&h.computeBoundingSphere(),c.copy(h.boundingSphere),c.applyMatrix4(j),!1!==d.ray.intersectsSphere(c)){a.getInverse(j),b.copy(d.ray).applyMatrix4(a);var k=k/((this.scale.x+this.scale.y+this.scale.z)/3),l=k*k,k=new i;if(h&&h.isBufferGeometry){var m=h.index,h=h.attributes.position.array;if(null!==m)for(var n=m.array,m=0,o=n.length;m<o;m++){var p=n[m];k.fromArray(h,3*p),f(k,p)}else for(m=0,n=h.length/3;m<n;m++)k.fromArray(h,3*m),f(k,m)}else for(k=h.vertices,m=0,n=k.length;m<n;m++)f(k[m],m)}}}(),clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}}),kb.prototype=Object.assign(Object.create(ea.prototype),{constructor:kb}),lb.prototype=Object.create(d.prototype),lb.prototype.constructor=lb,mb.prototype=Object.create(d.prototype),mb.prototype.constructor=mb,mb.prototype.isCompressedTexture=!0,nb.prototype=Object.create(d.prototype),nb.prototype.constructor=nb,ob.prototype=Object.create(d.prototype),ob.prototype.constructor=ob,ob.prototype.isDepthTexture=!0,pb.prototype=Object.create(pa.prototype),pb.prototype.constructor=pb,qb.prototype=Object.create(pa.prototype),qb.prototype.constructor=qb,rb.prototype=Object.create(na.prototype),rb.prototype.constructor=rb,sb.prototype=Object.create(pa.prototype),sb.prototype.constructor=sb,tb.prototype=Object.create(sb.prototype),tb.prototype.constructor=tb,ub.prototype=Object.create(na.prototype),ub.prototype.constructor=ub,vb.prototype=Object.create(sb.prototype),vb.prototype.constructor=vb,wb.prototype=Object.create(na.prototype),wb.prototype.constructor=wb,xb.prototype=Object.create(sb.prototype),xb.prototype.constructor=xb,yb.prototype=Object.create(na.prototype),yb.prototype.constructor=yb,zb.prototype=Object.create(sb.prototype),zb.prototype.constructor=zb,Ab.prototype=Object.create(na.prototype),Ab.prototype.constructor=Ab,Bb.prototype=Object.create(na.prototype),Bb.prototype.constructor=Bb,Cb.prototype=Object.create(pa.prototype),Cb.prototype.constructor=Cb,Db.prototype=Object.create(na.prototype),Db.prototype.constructor=Db,Eb.prototype=Object.create(pa.prototype),Eb.prototype.constructor=Eb,Fb.prototype=Object.create(na.prototype),Fb.prototype.constructor=Fb,Gb.prototype=Object.create(pa.prototype),Gb.prototype.constructor=Gb,Hb.prototype=Object.create(na.prototype),Hb.prototype.constructor=Hb;var he={area:function(a){for(var b=a.length,c=0,d=b-1,e=0;e<b;d=e++)c+=a[d].x*a[e].y-a[e].x*a[d].y;return.5*c},triangulate:function(){return function(a,b){var c=a.length;if(3>c)return null;var d,e,f,g=[],h=[],i=[];if(0<he.area(a))for(e=0;e<c;e++)h[e]=e;else for(e=0;e<c;e++)h[e]=c-1-e;var j=2*c;for(e=c-1;2<c;){if(0>=j--){console.warn("THREE.ShapeUtils: Unable to triangulate polygon! in triangulate()");break}d=e,c<=d&&(d=0),e=d+1,c<=e&&(e=0),f=e+1,c<=f&&(f=0);var k;a:{var l,m,n,o,p,q,r,s;if(l=a[h[d]].x,m=a[h[d]].y,n=a[h[e]].x,o=a[h[e]].y,p=a[h[f]].x,q=a[h[f]].y,0>=(n-l)*(q-m)-(o-m)*(p-l))k=!1;else{var t,u,v,w,x,y,z,A,B,C;for(t=p-n,u=q-o,v=l-p,w=m-q,x=n-l,y=o-m,k=0;k<c;k++)if(r=a[h[k]].x,s=a[h[k]].y,!(r===l&&s===m||r===n&&s===o||r===p&&s===q)&&(z=r-l,A=s-m,B=r-n,C=s-o,r-=p,s-=q,B=t*C-u*B,z=x*A-y*z,A=v*s-w*r,B>=-Number.EPSILON&&A>=-Number.EPSILON&&z>=-Number.EPSILON)){k=!1;break a}k=!0}}if(k){for(g.push([a[h[d]],a[h[e]],a[h[f]]]),i.push([h[d],h[e],h[f]]),d=e,f=e+1;f<c;d++,f++)h[d]=h[f];c--,j=2*c}}return b?i:g}}(),triangulateShape:function(a,b){function c(a){var b=a.length;2<b&&a[b-1].equals(a[0])&&a.pop()}function d(a,b,c){return a.x!==b.x?a.x<b.x?a.x<=c.x&&c.x<=b.x:b.x<=c.x&&c.x<=a.x:a.y<b.y?a.y<=c.y&&c.y<=b.y:b.y<=c.y&&c.y<=a.y}function e(a,b,c,e,f){var g=b.x-a.x,h=b.y-a.y,i=e.x-c.x,j=e.y-c.y,k=a.x-c.x,l=a.y-c.y,m=h*i-g*j,n=h*k-g*l;if(Math.abs(m)>Number.EPSILON){if(0<m){if(0>n||n>m)return[];if(0>(i=j*k-i*l)||i>m)return[]}else{if(0<n||n<m)return[];if(0<(i=j*k-i*l)||i<m)return[]}return 0===i?!f||0!==n&&n!==m?[a]:[]:i===m?!f||0!==n&&n!==m?[b]:[]:0===n?[c]:n===m?[e]:(f=i/m,[{x:a.x+f*g,y:a.y+f*h}])}return 0!==n||j*k!=i*l?[]:(h=0===g&&0===h,i=0===i&&0===j,h&&i?a.x!==c.x||a.y!==c.y?[]:[a]:h?d(c,e,a)?[a]:[]:i?d(a,b,c)?[c]:[]:(0!==g?(a.x<b.x?(g=a,i=a.x,h=b,a=b.x):(g=b,i=b.x,h=a,a=a.x),c.x<e.x?(b=c,m=c.x,j=e,c=e.x):(b=e,m=e.x,j=c,c=c.x)):(a.y<b.y?(g=a,i=a.y,h=b,a=b.y):(g=b,i=b.y,h=a,a=a.y),c.y<e.y?(b=c,m=c.y,j=e,c=e.y):(b=e,m=e.y,j=c,c=c.y)),i<=m?a<m?[]:a===m?f?[]:[b]:a<=c?[b,h]:[b,j]:i>c?[]:i===c?f?[]:[g]:a<=c?[g,h]:[g,j]))}function f(a,b,c,d){var e=b.x-a.x,f=b.y-a.y;b=c.x-a.x,c=c.y-a.y;var g=d.x-a.x;return d=d.y-a.y,a=e*c-f*b,e=e*d-f*g,Math.abs(a)>Number.EPSILON?(b=g*c-d*b,0<a?0<=e&&0<=b:0<=e||0<=b):0<e}c(a),b.forEach(c);var g,h,i,j,k,l={};for(i=a.concat(),g=0,h=b.length;g<h;g++)Array.prototype.push.apply(i,b[g]);for(g=0,h=i.length;g<h;g++)k=i[g].x+":"+i[g].y,void 0!==l[k]&&console.warn("THREE.ShapeUtils: Duplicate point",k,g),l[k]=g;g=function(a,b){function c(a,b){var c=q.length-1,d=a-1;0>d&&(d=c);var e=a+1;return e>c&&(e=0),!!(c=f(q[a],q[d],q[e],h[b]))&&(c=h.length-1,d=b-1,0>d&&(d=c),e=b+1,e>c&&(e=0),!!(c=f(h[b],h[d],h[e],q[a])))}function d(a,b){var c,d;for(c=0;c<q.length;c++)if(d=c+1,d%=q.length,d=e(a,b,q[c],q[d],!0),0<d.length)return!0;return!1}function g(a,c){var d,f,g,h;for(d=0;d<r.length;d++)for(f=b[r[d]],g=0;g<f.length;g++)if(h=g+1,h%=f.length,h=e(a,c,f[g],f[h],!0),0<h.length)return!0;return!1}var h,i,j,k,l,m,n,o,p,q=a.concat(),r=[],s=[],t=0;for(i=b.length;t<i;t++)r.push(t);n=0;for(var u=2*r.length;0<r.length;){if(0>--u){console.log("Infinite Loop! Holes left:"+r.length+", Probably Hole outside Shape!");break}for(j=n;j<q.length;j++){for(k=q[j],i=-1,t=0;t<r.length;t++)if(l=r[t],m=k.x+":"+k.y+":"+l,void 0===s[m]){for(h=b[l],o=0;o<h.length;o++)if(l=h[o],c(j,o)&&!d(k,l)&&!g(k,l)){i=o,r.splice(t,1),n=q.slice(0,j+1),l=q.slice(j),o=h.slice(i),p=h.slice(0,i+1),q=n.concat(o).concat(p).concat(l),n=j;break}if(0<=i)break;s[m]=!0}if(0<=i)break}}return q}(a,b);var m=he.triangulate(g,!1);for(g=0, h=m.length;g<h;g++)for(j=m[g],i=0;3>i;i++)k=j[i].x+":"+j[i].y,void 0!==(k=l[k])&&(j[i]=k);return m.concat()},isClockWise:function(a){return 0>he.area(a)},b2:function(){return function(a,b,c,d){var e=1-a;return e*e*b+2*(1-a)*a*c+a*a*d}}(),b3:function(){return function(a,b,c,d,e){var f=1-a,g=1-a;return f*f*f*b+3*g*g*a*c+3*(1-a)*a*a*d+a*a*a*e}}()};Ib.prototype=Object.create(na.prototype),Ib.prototype.constructor=Ib,Ib.prototype.addShapeList=function(a,b){for(var c=a.length,d=0;d<c;d++)this.addShape(a[d],b)},Ib.prototype.addShape=function(a,b){function d(a,b,c){return b||console.error("THREE.ExtrudeGeometry: vec does not exist"),b.clone().multiplyScalar(c).add(a)}function e(a,b,d){var e,f,g;f=a.x-b.x,g=a.y-b.y,e=d.x-a.x;var h=d.y-a.y,i=f*f+g*g;if(Math.abs(f*h-g*e)>Number.EPSILON){var j=Math.sqrt(i),k=Math.sqrt(e*e+h*h),i=b.x-g/j;if(b=b.y+f/j,h=((d.x-h/k-i)*h-(d.y+e/k-b)*e)/(f*h-g*e),e=i+f*h-a.x,f=b+g*h-a.y,2>=(g=e*e+f*f))return new c(e,f);g=Math.sqrt(g/2)}else a=!1,f>Number.EPSILON?e>Number.EPSILON&&(a=!0):f<-Number.EPSILON?e<-Number.EPSILON&&(a=!0):Math.sign(g)===Math.sign(h)&&(a=!0),a?(e=-g,g=Math.sqrt(i)):(e=f,f=g,g=Math.sqrt(i/2));return new c(e/g,f/g)}function f(a,b){var c,d;for(O=a.length;0<=--O;){c=O,d=O-1,0>d&&(d=a.length-1);var e,f=u+2*r;for(e=0;e<f;e++){var g=M*e,h=M*(e+1),i=b+c+g,g=b+d+g,j=b+d+h,h=b+c+h,i=i+C,g=g+C,j=j+C,h=h+C;B.faces.push(new ha(i,g,h,null,null,1)),B.faces.push(new ha(g,j,h,null,null,1)),i=x.generateSideWallUV(B,i,g,j,h),B.faceVertexUvs[0].push([i[0],i[1],i[3]]),B.faceVertexUvs[0].push([i[1],i[2],i[3]])}}}function g(a,b,c){B.vertices.push(new i(a,b,c))}function h(a,b,c){a+=C,b+=C,c+=C,B.faces.push(new ha(a,b,c,null,null,0)),a=x.generateTopUV(B,a,b,c),B.faceVertexUvs[0].push(a)}var j,k,l,m,n,o=void 0!==b.amount?b.amount:100,p=void 0!==b.bevelThickness?b.bevelThickness:6,q=void 0!==b.bevelSize?b.bevelSize:p-2,r=void 0!==b.bevelSegments?b.bevelSegments:3,s=void 0===b.bevelEnabled||b.bevelEnabled,t=void 0!==b.curveSegments?b.curveSegments:12,u=void 0!==b.steps?b.steps:1,v=b.extrudePath,w=!1,x=void 0!==b.UVGenerator?b.UVGenerator:Ib.WorldUVGenerator;v&&(j=v.getSpacedPoints(u),w=!0,s=!1,k=void 0!==b.frames?b.frames:v.computeFrenetFrames(u,!1),l=new i,m=new i,n=new i),s||(q=p=r=0);var y,z,A,B=this,C=this.vertices.length,v=a.extractPoints(t),t=v.shape,D=v.holes;if(v=!he.isClockWise(t)){for(t=t.reverse(),z=0,A=D.length;z<A;z++)y=D[z],he.isClockWise(y)&&(D[z]=y.reverse());v=!1}var E=he.triangulateShape(t,D),F=t;for(z=0,A=D.length;z<A;z++)y=D[z],t=t.concat(y);var G,H,I,J,K,L,M=t.length,N=E.length,v=[],O=0;for(I=F.length,G=I-1,H=O+1;O<I;O++,G++,H++)G===I&&(G=0),H===I&&(H=0),v[O]=e(F[O],F[G],F[H]);var P,Q=[],R=v.concat();for(z=0,A=D.length;z<A;z++){for(y=D[z],P=[],O=0,I=y.length,G=I-1,H=O+1;O<I;O++,G++,H++)G===I&&(G=0),H===I&&(H=0),P[O]=e(y[O],y[G],y[H]);Q.push(P),R=R.concat(P)}for(G=0;G<r;G++){for(I=G/r,J=p*Math.cos(I*Math.PI/2),H=q*Math.sin(I*Math.PI/2),O=0,I=F.length;O<I;O++)K=d(F[O],v[O],H),g(K.x,K.y,-J);for(z=0,A=D.length;z<A;z++)for(y=D[z],P=Q[z],O=0,I=y.length;O<I;O++)K=d(y[O],P[O],H),g(K.x,K.y,-J)}for(H=q,O=0;O<M;O++)K=s?d(t[O],R[O],H):t[O],w?(m.copy(k.normals[0]).multiplyScalar(K.x),l.copy(k.binormals[0]).multiplyScalar(K.y),n.copy(j[0]).add(m).add(l),g(n.x,n.y,n.z)):g(K.x,K.y,0);for(I=1;I<=u;I++)for(O=0;O<M;O++)K=s?d(t[O],R[O],H):t[O],w?(m.copy(k.normals[I]).multiplyScalar(K.x),l.copy(k.binormals[I]).multiplyScalar(K.y),n.copy(j[I]).add(m).add(l),g(n.x,n.y,n.z)):g(K.x,K.y,o/u*I);for(G=r-1;0<=G;G--){for(I=G/r,J=p*Math.cos(I*Math.PI/2),H=q*Math.sin(I*Math.PI/2),O=0,I=F.length;O<I;O++)K=d(F[O],v[O],H),g(K.x,K.y,o+J);for(z=0,A=D.length;z<A;z++)for(y=D[z],P=Q[z],O=0,I=y.length;O<I;O++)K=d(y[O],P[O],H),w?g(K.x,K.y+j[u-1].y,j[u-1].x+J):g(K.x,K.y,o+J)}!function(){if(s){var a=0*M;for(O=0;O<N;O++)L=E[O],h(L[2]+a,L[1]+a,L[0]+a);for(a=M*(u+2*r),O=0;O<N;O++)L=E[O],h(L[0]+a,L[1]+a,L[2]+a)}else{for(O=0;O<N;O++)L=E[O],h(L[2],L[1],L[0]);for(O=0;O<N;O++)L=E[O],h(L[0]+M*u,L[1]+M*u,L[2]+M*u)}}(),function(){var a=0;for(f(F,a),a+=F.length,z=0,A=D.length;z<A;z++)y=D[z],f(y,a),a+=y.length}()},Ib.WorldUVGenerator={generateTopUV:function(a,b,d,e){return a=a.vertices,b=a[b],d=a[d],e=a[e],[new c(b.x,b.y),new c(d.x,d.y),new c(e.x,e.y)]},generateSideWallUV:function(a,b,d,e,f){return a=a.vertices,b=a[b],d=a[d],e=a[e],f=a[f],.01>Math.abs(b.y-d.y)?[new c(b.x,1-b.z),new c(d.x,1-d.z),new c(e.x,1-e.z),new c(f.x,1-f.z)]:[new c(b.y,1-b.z),new c(d.y,1-d.z),new c(e.y,1-e.z),new c(f.y,1-f.z)]}},Jb.prototype=Object.create(Ib.prototype),Jb.prototype.constructor=Jb,Kb.prototype=Object.create(pa.prototype),Kb.prototype.constructor=Kb,Lb.prototype=Object.create(na.prototype),Lb.prototype.constructor=Lb,Mb.prototype=Object.create(pa.prototype),Mb.prototype.constructor=Mb,Nb.prototype=Object.create(na.prototype),Nb.prototype.constructor=Nb,Ob.prototype=Object.create(na.prototype),Ob.prototype.constructor=Ob,Pb.prototype=Object.create(pa.prototype),Pb.prototype.constructor=Pb,Qb.prototype=Object.create(na.prototype),Qb.prototype.constructor=Qb,Rb.prototype=Object.create(na.prototype),Rb.prototype.constructor=Rb,Rb.prototype.addShapeList=function(a,b){for(var c=0,d=a.length;c<d;c++)this.addShape(a[c],b);return this},Rb.prototype.addShape=function(a,b){void 0===b&&(b={});var c,d,e,f=b.material,g=void 0===b.UVGenerator?Ib.WorldUVGenerator:b.UVGenerator,h=this.vertices.length;c=a.extractPoints(void 0!==b.curveSegments?b.curveSegments:12);var j=c.shape,k=c.holes;if(!he.isClockWise(j))for(j=j.reverse(),c=0,d=k.length;c<d;c++)e=k[c],he.isClockWise(e)&&(k[c]=e.reverse());var l=he.triangulateShape(j,k);for(c=0,d=k.length;c<d;c++)e=k[c],j=j.concat(e);for(k=j.length,d=l.length,c=0;c<k;c++)e=j[c],this.vertices.push(new i(e.x,e.y,0));for(c=0;c<d;c++)k=l[c],j=k[0]+h,e=k[1]+h,k=k[2]+h,this.faces.push(new ha(j,e,k,null,null,f)),this.faceVertexUvs[0].push(g.generateTopUV(this,j,e,k))},Sb.prototype=Object.create(pa.prototype),Sb.prototype.constructor=Sb,Tb.prototype=Object.create(pa.prototype),Tb.prototype.constructor=Tb,Ub.prototype=Object.create(na.prototype),Ub.prototype.constructor=Ub,Vb.prototype=Object.create(Ub.prototype),Vb.prototype.constructor=Vb,Wb.prototype=Object.create(Tb.prototype),Wb.prototype.constructor=Wb,Xb.prototype=Object.create(pa.prototype),Xb.prototype.constructor=Xb,Yb.prototype=Object.create(na.prototype),Yb.prototype.constructor=Yb,Zb.prototype=Object.create(na.prototype),Zb.prototype.constructor=Zb;var ie=Object.freeze({WireframeGeometry:pb,ParametricGeometry:rb,ParametricBufferGeometry:qb,TetrahedronGeometry:ub,TetrahedronBufferGeometry:tb,OctahedronGeometry:wb,OctahedronBufferGeometry:vb,IcosahedronGeometry:yb,IcosahedronBufferGeometry:xb,DodecahedronGeometry:Ab,DodecahedronBufferGeometry:zb,PolyhedronGeometry:Bb,PolyhedronBufferGeometry:sb,TubeGeometry:Db,TubeBufferGeometry:Cb,TorusKnotGeometry:Fb,TorusKnotBufferGeometry:Eb,TorusGeometry:Hb,TorusBufferGeometry:Gb,TextGeometry:Jb,SphereBufferGeometry:Kb,SphereGeometry:Lb,RingGeometry:Nb,RingBufferGeometry:Mb,PlaneBufferGeometry:sa,PlaneGeometry:Ob,LatheGeometry:Qb,LatheBufferGeometry:Pb,ShapeGeometry:Rb,ExtrudeGeometry:Ib,EdgesGeometry:Sb,ConeGeometry:Vb,ConeBufferGeometry:Wb,CylinderGeometry:Ub,CylinderBufferGeometry:Tb,CircleBufferGeometry:Xb,CircleGeometry:Yb,BoxBufferGeometry:ra,BoxGeometry:Zb});$b.prototype=Object.create(V.prototype),$b.prototype.constructor=$b,$b.prototype.isShadowMaterial=!0,_b.prototype=Object.create(V.prototype),_b.prototype.constructor=_b,_b.prototype.isRawShaderMaterial=!0,ac.prototype={constructor:ac,isMultiMaterial:!0,toJSON:function(a){for(var b={metadata:{version:4.2,type:"material",generator:"MaterialExporter"},uuid:this.uuid,type:this.type,materials:[]},c=this.materials,d=0,e=c.length;d<e;d++){var f=c[d].toJSON(a);delete f.metadata,b.materials.push(f)}return b.visible=this.visible,b},clone:function(){for(var a=new this.constructor,b=0;b<this.materials.length;b++)a.materials.push(this.materials[b].clone());return a.visible=this.visible,a}},bc.prototype=Object.create(U.prototype),bc.prototype.constructor=bc,bc.prototype.isMeshStandardMaterial=!0,bc.prototype.copy=function(a){return U.prototype.copy.call(this,a),this.defines={STANDARD:""},this.color.copy(a.color),this.roughness=a.roughness,this.metalness=a.metalness,this.map=a.map,this.lightMap=a.lightMap,this.lightMapIntensity=a.lightMapIntensity,this.aoMap=a.aoMap,this.aoMapIntensity=a.aoMapIntensity,this.emissive.copy(a.emissive),this.emissiveMap=a.emissiveMap,this.emissiveIntensity=a.emissiveIntensity,this.bumpMap=a.bumpMap,this.bumpScale=a.bumpScale,this.normalMap=a.normalMap,this.normalScale.copy(a.normalScale),this.displacementMap=a.displacementMap,this.displacementScale=a.displacementScale,this.displacementBias=a.displacementBias,this.roughnessMap=a.roughnessMap,this.metalnessMap=a.metalnessMap,this.alphaMap=a.alphaMap,this.envMap=a.envMap,this.envMapIntensity=a.envMapIntensity,this.refractionRatio=a.refractionRatio,this.wireframe=a.wireframe,this.wireframeLinewidth=a.wireframeLinewidth,this.wireframeLinecap=a.wireframeLinecap,this.wireframeLinejoin=a.wireframeLinejoin,this.skinning=a.skinning,this.morphTargets=a.morphTargets,this.morphNormals=a.morphNormals,this},cc.prototype=Object.create(bc.prototype),cc.prototype.constructor=cc,cc.prototype.isMeshPhysicalMaterial=!0,cc.prototype.copy=function(a){return bc.prototype.copy.call(this,a),this.defines={PHYSICAL:""},this.reflectivity=a.reflectivity,this.clearCoat=a.clearCoat,this.clearCoatRoughness=a.clearCoatRoughness,this},dc.prototype=Object.create(U.prototype),dc.prototype.constructor=dc,dc.prototype.isMeshPhongMaterial=!0,dc.prototype.copy=function(a){return U.prototype.copy.call(this,a),this.color.copy(a.color),this.specular.copy(a.specular),this.shininess=a.shininess,this.map=a.map,this.lightMap=a.lightMap,this.lightMapIntensity=a.lightMapIntensity,this.aoMap=a.aoMap,this.aoMapIntensity=a.aoMapIntensity,this.emissive.copy(a.emissive),this.emissiveMap=a.emissiveMap,this.emissiveIntensity=a.emissiveIntensity,this.bumpMap=a.bumpMap,this.bumpScale=a.bumpScale,this.normalMap=a.normalMap,this.normalScale.copy(a.normalScale),this.displacementMap=a.displacementMap,this.displacementScale=a.displacementScale,this.displacementBias=a.displacementBias,this.specularMap=a.specularMap,this.alphaMap=a.alphaMap,this.envMap=a.envMap,this.combine=a.combine,this.reflectivity=a.reflectivity,this.refractionRatio=a.refractionRatio,this.wireframe=a.wireframe,this.wireframeLinewidth=a.wireframeLinewidth,this.wireframeLinecap=a.wireframeLinecap,this.wireframeLinejoin=a.wireframeLinejoin,this.skinning=a.skinning,this.morphTargets=a.morphTargets,this.morphNormals=a.morphNormals,this},ec.prototype=Object.create(U.prototype),ec.prototype.constructor=ec,ec.prototype.isMeshNormalMaterial=!0,ec.prototype.copy=function(a){return U.prototype.copy.call(this,a),this.wireframe=a.wireframe,this.wireframeLinewidth=a.wireframeLinewidth,this},fc.prototype=Object.create(U.prototype),fc.prototype.constructor=fc,fc.prototype.isMeshLambertMaterial=!0,fc.prototype.copy=function(a){return U.prototype.copy.call(this,a),this.color.copy(a.color),this.map=a.map,this.lightMap=a.lightMap,this.lightMapIntensity=a.lightMapIntensity,this.aoMap=a.aoMap,this.aoMapIntensity=a.aoMapIntensity,this.emissive.copy(a.emissive),this.emissiveMap=a.emissiveMap,this.emissiveIntensity=a.emissiveIntensity,this.specularMap=a.specularMap,this.alphaMap=a.alphaMap,this.envMap=a.envMap,this.combine=a.combine,this.reflectivity=a.reflectivity,this.refractionRatio=a.refractionRatio,this.wireframe=a.wireframe,this.wireframeLinewidth=a.wireframeLinewidth,this.wireframeLinecap=a.wireframeLinecap,this.wireframeLinejoin=a.wireframeLinejoin,this.skinning=a.skinning,this.morphTargets=a.morphTargets,this.morphNormals=a.morphNormals,this},gc.prototype=Object.create(U.prototype),gc.prototype.constructor=gc,gc.prototype.isLineDashedMaterial=!0,gc.prototype.copy=function(a){return U.prototype.copy.call(this,a),this.color.copy(a.color),this.linewidth=a.linewidth,this.scale=a.scale,this.dashSize=a.dashSize,this.gapSize=a.gapSize,this};var je=Object.freeze({ShadowMaterial:$b,SpriteMaterial:$a,RawShaderMaterial:_b,ShaderMaterial:V,PointsMaterial:ib,MultiMaterial:ac,MeshPhysicalMaterial:cc,MeshStandardMaterial:bc,MeshPhongMaterial:dc,MeshNormalMaterial:ec,MeshLambertMaterial:fc,MeshDepthMaterial:W,MeshBasicMaterial:ia,LineDashedMaterial:gc,LineBasicMaterial:fb,Material:U}),ke={enabled:!1,files:{},add:function(a,b){!1!==this.enabled&&(this.files[a]=b)},get:function(a){if(!1!==this.enabled)return this.files[a]},remove:function(a){delete this.files[a]},clear:function(){this.files={}}},le=new hc;Object.assign(ic.prototype,{load:function(a,b,c,d){void 0===a&&(a=""),void 0!==this.path&&(a=this.path+a);var e=this,f=ke.get(a);if(void 0!==f)return e.manager.itemStart(a),setTimeout(function(){b&&b(f),e.manager.itemEnd(a)},0),f;var g=a.match(/^data:(.*?)(;base64)?,(.*)$/);if(g){var h=g[1],j=!!g[2],g=g[3],g=window.decodeURIComponent(g);j&&(g=window.atob(g));try{var k,l=(this.responseType||"").toLowerCase();switch(l){case"arraybuffer":case"blob":k=new ArrayBuffer(g.length);for(var m=new Uint8Array(k),j=0;j<g.length;j++)m[j]=g.charCodeAt(j);"blob"===l&&(k=new Blob([k],{type:h}));break;case"document":k=(new DOMParser).parseFromString(g,h);break;case"json":k=JSON.parse(g);break;default:k=g}window.setTimeout(function(){b&&b(k),e.manager.itemEnd(a)},0)}catch(i){window.setTimeout(function(){d&&d(i),e.manager.itemError(a)},0)}}else{var n=new XMLHttpRequest;n.open("GET",a,!0),n.addEventListener("load",function(c){var f=c.target.response;ke.add(a,f),200===this.status?(b&&b(f),e.manager.itemEnd(a)):0===this.status?(console.warn("THREE.XHRLoader: HTTP Status 0 received."),b&&b(f),e.manager.itemEnd(a)):(d&&d(c),e.manager.itemError(a))},!1),void 0!==c&&n.addEventListener("progress",function(a){c(a)},!1),n.addEventListener("error",function(b){d&&d(b),e.manager.itemError(a)},!1),void 0!==this.responseType&&(n.responseType=this.responseType),void 0!==this.withCredentials&&(n.withCredentials=this.withCredentials),n.overrideMimeType&&n.overrideMimeType("text/plain"),n.send(null)}return e.manager.itemStart(a),n},setPath:function(a){return this.path=a,this},setResponseType:function(a){return this.responseType=a,this},setWithCredentials:function(a){return this.withCredentials=a,this}}),Object.assign(jc.prototype,{load:function(a,b,c,d){function e(e){i.load(a[e],function(a){a=f._parser(a,!0),g[e]={width:a.width,height:a.height,format:a.format,mipmaps:a.mipmaps},6===(j+=1)&&(1===a.mipmapCount&&(h.minFilter=1006),h.format=a.format,h.needsUpdate=!0,b&&b(h))},c,d)}var f=this,g=[],h=new mb;h.image=g;var i=new ic(this.manager);if(i.setPath(this.path),i.setResponseType("arraybuffer"),Array.isArray(a))for(var j=0,k=0,l=a.length;k<l;++k)e(k);else i.load(a,function(a){if(a=f._parser(a,!0),a.isCubemap)for(var c=a.mipmaps.length/a.mipmapCount,d=0;d<c;d++){g[d]={mipmaps:[]};for(var e=0;e<a.mipmapCount;e++)g[d].mipmaps.push(a.mipmaps[d*a.mipmapCount+e]),g[d].format=a.format,g[d].width=a.width,g[d].height=a.height}else h.image.width=a.width,h.image.height=a.height,h.mipmaps=a.mipmaps;1===a.mipmapCount&&(h.minFilter=1006),h.format=a.format,h.needsUpdate=!0,b&&b(h)},c,d);return h},setPath:function(a){return this.path=a,this}}),Object.assign(kc.prototype,{load:function(a,b,c,d){var e=this,f=new bb,g=new ic(this.manager);return g.setResponseType("arraybuffer"),g.load(a,function(a){(a=e._parser(a))&&(void 0!==a.image?f.image=a.image:void 0!==a.data&&(f.image.width=a.width,f.image.height=a.height,f.image.data=a.data),f.wrapS=void 0!==a.wrapS?a.wrapS:1001,f.wrapT=void 0!==a.wrapT?a.wrapT:1001,f.magFilter=void 0!==a.magFilter?a.magFilter:1006,f.minFilter=void 0!==a.minFilter?a.minFilter:1008,f.anisotropy=void 0!==a.anisotropy?a.anisotropy:1,void 0!==a.format&&(f.format=a.format),void 0!==a.type&&(f.type=a.type),void 0!==a.mipmaps&&(f.mipmaps=a.mipmaps),1===a.mipmapCount&&(f.minFilter=1006),f.needsUpdate=!0,b&&b(f,a))},c,d),f}}),Object.assign(lc.prototype,{load:function(a,b,c,d){var e=this,f=document.createElementNS("http://www.w3.org/1999/xhtml","img");if(f.onload=function(){f.onload=null,URL.revokeObjectURL(f.src),b&&b(f),e.manager.itemEnd(a)},f.onerror=d,0===a.indexOf("data:"))f.src=a;else{var g=new ic;g.setPath(this.path),g.setResponseType("blob"),g.setWithCredentials(this.withCredentials),g.load(a,function(a){f.src=URL.createObjectURL(a)},c,d)}return e.manager.itemStart(a),f},setCrossOrigin:function(a){return this.crossOrigin=a,this},setWithCredentials:function(a){return this.withCredentials=a,this},setPath:function(a){return this.path=a,this}}),Object.assign(mc.prototype,{load:function(a,b,c,d){function e(c){g.load(a[c],function(a){f.images[c]=a,6===++h&&(f.needsUpdate=!0,b&&b(f))},void 0,d)}var f=new k,g=new lc(this.manager);g.setCrossOrigin(this.crossOrigin),g.setPath(this.path);var h=0;for(c=0;c<a.length;++c)e(c);return f},setCrossOrigin:function(a){return this.crossOrigin=a,this},setPath:function(a){return this.path=a,this}}),Object.assign(nc.prototype,{load:function(a,b,c,e){var f=new d,g=new lc(this.manager);return g.setCrossOrigin(this.crossOrigin),g.setWithCredentials(this.withCredentials),g.setPath(this.path),g.load(a,function(c){var d=0<a.search(/\.(jpg|jpeg)$/)||0===a.search(/^data\:image\/jpeg/);f.format=d?1022:1023,f.image=c,f.needsUpdate=!0,void 0!==b&&b(f)},c,e),f},setCrossOrigin:function(a){return this.crossOrigin=a,this},setWithCredentials:function(a){return this.withCredentials=a,this},setPath:function(a){return this.path=a,this}}),oc.prototype=Object.assign(Object.create(ea.prototype),{constructor:oc,isLight:!0,copy:function(a){return ea.prototype.copy.call(this,a),this.color.copy(a.color),this.intensity=a.intensity,this},toJSON:function(a){return a=ea.prototype.toJSON.call(this,a),a.object.color=this.color.getHex(),a.object.intensity=this.intensity,void 0!==this.groundColor&&(a.object.groundColor=this.groundColor.getHex()),void 0!==this.distance&&(a.object.distance=this.distance),void 0!==this.angle&&(a.object.angle=this.angle),void 0!==this.decay&&(a.object.decay=this.decay),void 0!==this.penumbra&&(a.object.penumbra=this.penumbra),void 0!==this.shadow&&(a.object.shadow=this.shadow.toJSON()),a}}),pc.prototype=Object.assign(Object.create(oc.prototype),{constructor:pc,isHemisphereLight:!0,copy:function(a){return oc.prototype.copy.call(this,a),this.groundColor.copy(a.groundColor),this}}),Object.assign(qc.prototype,{copy:function(a){return this.camera=a.camera.clone(),this.bias=a.bias,this.radius=a.radius,this.mapSize.copy(a.mapSize),this},clone:function(){return(new this.constructor).copy(this)},toJSON:function(){var a={};return 0!==this.bias&&(a.bias=this.bias),1!==this.radius&&(a.radius=this.radius),512===this.mapSize.x&&512===this.mapSize.y||(a.mapSize=this.mapSize.toArray()),a.camera=this.camera.toJSON(!1).object,delete a.camera.matrix,a}}),rc.prototype=Object.assign(Object.create(qc.prototype),{constructor:rc,isSpotLightShadow:!0,update:function(a){var b=2*Td.RAD2DEG*a.angle,c=this.mapSize.width/this.mapSize.height;a=a.distance||500;var d=this.camera;b===d.fov&&c===d.aspect&&a===d.far||(d.fov=b,d.aspect=c,d.far=a,d.updateProjectionMatrix())}}),sc.prototype=Object.assign(Object.create(oc.prototype),{constructor:sc,isSpotLight:!0,copy:function(a){return oc.prototype.copy.call(this,a),this.distance=a.distance,this.angle=a.angle,this.penumbra=a.penumbra,this.decay=a.decay,this.target=a.target.clone(),this.shadow=a.shadow.clone(),this}}),tc.prototype=Object.assign(Object.create(oc.prototype),{constructor:tc,isPointLight:!0,copy:function(a){return oc.prototype.copy.call(this,a),this.distance=a.distance,this.decay=a.decay,this.shadow=a.shadow.clone(),this}}),uc.prototype=Object.assign(Object.create(qc.prototype),{constructor:uc}),vc.prototype=Object.assign(Object.create(oc.prototype),{constructor:vc,isDirectionalLight:!0,copy:function(a){return oc.prototype.copy.call(this,a),this.target=a.target.clone(),this.shadow=a.shadow.clone(),this}}),wc.prototype=Object.assign(Object.create(oc.prototype),{constructor:wc,isAmbientLight:!0});var me={arraySlice:function(a,b,c){return me.isTypedArray(a)?new a.constructor(a.subarray(b,c)):a.slice(b,c)},convertArray:function(a,b,c){return!a||!c&&a.constructor===b?a:"number"==typeof b.BYTES_PER_ELEMENT?new b(a):Array.prototype.slice.call(a)},isTypedArray:function(a){return ArrayBuffer.isView(a)&&!(a instanceof DataView)},getKeyframeOrder:function(a){for(var b=a.length,c=Array(b),d=0;d!==b;++d)c[d]=d;return c.sort(function(b,c){return a[b]-a[c]}),c},sortedArray:function(a,b,c){for(var d=a.length,e=new a.constructor(d),f=0,g=0;g!==d;++f)for(var h=c[f]*b,i=0;i!==b;++i)e[g++]=a[h+i];return e},flattenJSON:function(a,b,c,d){for(var e=1,f=a[0];void 0!==f&&void 0===f[d];)f=a[e++];if(void 0!==f){var g=f[d];if(void 0!==g)if(Array.isArray(g))do{g=f[d],void 0!==g&&(b.push(f.time),c.push.apply(c,g)),f=a[e++]}while(void 0!==f);else if(void 0!==g.toArray)do{g=f[d],void 0!==g&&(b.push(f.time),g.toArray(c,c.length)),f=a[e++]}while(void 0!==f);else do{g=f[d],void 0!==g&&(b.push(f.time),c.push(g)),f=a[e++]}while(void 0!==f)}}};xc.prototype={constructor:xc,evaluate:function(a){var b=this.parameterPositions,c=this._cachedIndex,d=b[c],e=b[c-1];a:{b:{c:{d:if(!(a<d)){for(var f=c+2;;){if(void 0===d){if(a<e)break d;return this._cachedIndex=c=b.length,this.afterEnd_(c-1,a,e)}if(c===f)break;if(e=d,d=b[++c],a<d)break b}d=b.length;break c}if(a>=e)break a;for(f=b[1],a<f&&(c=2,e=f),f=c-2;;){if(void 0===e)return this._cachedIndex=0,this.beforeStart_(0,a,d);if(c===f)break;if(d=e,e=b[--c-1],a>=e)break b}d=c,c=0}for(;c<d;)e=c+d>>>1,a<b[e]?d=e:c=e+1;if(d=b[c],void 0===(e=b[c-1]))return this._cachedIndex=0,this.beforeStart_(0,a,d);if(void 0===d)return this._cachedIndex=c=b.length,this.afterEnd_(c-1,e,a)}this._cachedIndex=c,this.intervalChanged_(c,e,d)}return this.interpolate_(c,e,a,d)},settings:null,DefaultSettings_:{},getSettings_:function(){return this.settings||this.DefaultSettings_},copySampleValue_:function(a){var b=this.resultBuffer,c=this.sampleValues,d=this.valueSize;a*=d;for(var e=0;e!==d;++e)b[e]=c[a+e];return b},interpolate_:function(a,b,c,d){throw Error("call to abstract method")},intervalChanged_:function(a,b,c){}},Object.assign(xc.prototype,{beforeStart_:xc.prototype.copySampleValue_,afterEnd_:xc.prototype.copySampleValue_}),yc.prototype=Object.assign(Object.create(xc.prototype),{constructor:yc,DefaultSettings_:{endingStart:2400,endingEnd:2400},intervalChanged_:function(a,b,c){var d=this.parameterPositions,e=a-2,f=a+1,g=d[e],h=d[f];if(void 0===g)switch(this.getSettings_().endingStart){case 2401:e=a,g=2*b-c;break;case 2402:e=d.length-2,g=b+d[e]-d[e+1];break;default:e=a,g=c}if(void 0===h)switch(this.getSettings_().endingEnd){case 2401:f=a,h=2*c-b;break;case 2402:f=1,h=c+d[1]-d[0];break;default:f=a-1,h=b}a=.5*(c-b),d=this.valueSize,this._weightPrev=a/(b-g),this._weightNext=a/(h-c),this._offsetPrev=e*d,this._offsetNext=f*d},interpolate_:function(a,b,c,d){var e=this.resultBuffer,f=this.sampleValues,g=this.valueSize;a*=g;var h=a-g,i=this._offsetPrev,j=this._offsetNext,k=this._weightPrev,l=this._weightNext,m=(c-b)/(d-b);for(c=m*m,d=c*m,b=-k*d+2*k*c-k*m,k=(1+k)*d+(-1.5-2*k)*c+(-.5+k)*m+1,m=(-1-l)*d+(1.5+l)*c+.5*m,l=l*d-l*c,c=0;c!==g;++c)e[c]=b*f[i+c]+k*f[h+c]+m*f[a+c]+l*f[j+c];return e}}),zc.prototype=Object.assign(Object.create(xc.prototype),{constructor:zc,interpolate_:function(a,b,c,d){var e=this.resultBuffer,f=this.sampleValues,g=this.valueSize;a*=g;var h=a-g;for(b=(c-b)/(d-b),c=1-b,d=0;d!==g;++d)e[d]=f[h+d]*c+f[a+d]*b;return e}}),Ac.prototype=Object.assign(Object.create(xc.prototype),{constructor:Ac,interpolate_:function(a,b,c,d){return this.copySampleValue_(a-1)}});var ne;ne={TimeBufferType:Float32Array,ValueBufferType:Float32Array,DefaultInterpolation:2301,InterpolantFactoryMethodDiscrete:function(a){return new Ac(this.times,this.values,this.getValueSize(),a)},InterpolantFactoryMethodLinear:function(a){return new zc(this.times,this.values,this.getValueSize(),a)},InterpolantFactoryMethodSmooth:function(a){return new yc(this.times,this.values,this.getValueSize(),a)},setInterpolation:function(a){var b;switch(a){case 2300:b=this.InterpolantFactoryMethodDiscrete;break;case 2301:b=this.InterpolantFactoryMethodLinear;break;case 2302:b=this.InterpolantFactoryMethodSmooth}if(void 0===b){if(b="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name,void 0===this.createInterpolant){if(a===this.DefaultInterpolation)throw Error(b);this.setInterpolation(this.DefaultInterpolation)}console.warn(b)}else this.createInterpolant=b},getInterpolation:function(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return 2300;case this.InterpolantFactoryMethodLinear:return 2301;case this.InterpolantFactoryMethodSmooth:return 2302}},getValueSize:function(){return this.values.length/this.times.length},shift:function(a){if(0!==a)for(var b=this.times,c=0,d=b.length;c!==d;++c)b[c]+=a;return this},scale:function(a){if(1!==a)for(var b=this.times,c=0,d=b.length;c!==d;++c)b[c]*=a;return this},trim:function(a,b){for(var c=this.times,d=c.length,e=0,f=d-1;e!==d&&c[e]<a;)++e;for(;-1!==f&&c[f]>b;)--f;return++f,0===e&&f===d||(e>=f&&(f=Math.max(f,1),e=f-1),d=this.getValueSize(),this.times=me.arraySlice(c,e,f),this.values=me.arraySlice(this.values,e*d,f*d)),this},validate:function(){var a=!0,b=this.getValueSize();0!=b-Math.floor(b)&&(console.error("invalid value size in track",this),a=!1);var c=this.times,b=this.values,d=c.length;0===d&&(console.error("track is empty",this),a=!1);for(var e=null,f=0;f!==d;f++){var g=c[f];if("number"==typeof g&&isNaN(g)){console.error("time is not a valid number",this,f,g),a=!1;break}if(null!==e&&e>g){console.error("out of order keys",this,f,g,e),a=!1;break}e=g}if(void 0!==b&&me.isTypedArray(b))for(f=0,c=b.length;f!==c;++f)if(d=b[f],isNaN(d)){console.error("value is not a valid number",this,f,d),a=!1;break}return a},optimize:function(){for(var a=this.times,b=this.values,c=this.getValueSize(),d=2302===this.getInterpolation(),e=1,f=a.length-1,g=1;g<f;++g){var h=!1,i=a[g];if(i!==a[g+1]&&(1!==g||i!==i[0]))if(d)h=!0;else for(var j=g*c,k=j-c,l=j+c,i=0;i!==c;++i){var m=b[j+i];if(m!==b[k+i]||m!==b[l+i]){h=!0;break}}if(h){if(g!==e)for(a[e]=a[g],h=g*c,j=e*c,i=0;i!==c;++i)b[j+i]=b[h+i];++e}}if(0<f){for(a[e]=a[f],h=f*c,j=e*c,i=0;i!==c;++i)b[j+i]=b[h+i];++e}return e!==a.length&&(this.times=me.arraySlice(a,0,e),this.values=me.arraySlice(b,0,e*c)),this}},Cc.prototype=Object.assign(Object.create(ne),{constructor:Cc,ValueTypeName:"vector"}),Dc.prototype=Object.assign(Object.create(xc.prototype),{constructor:Dc,interpolate_:function(a,b,c,d){var e=this.resultBuffer,f=this.sampleValues,g=this.valueSize;for(a*=g,b=(c-b)/(d-b),c=a+g;a!==c;a+=4)h.slerpFlat(e,0,f,a-g,f,a,b);return e}}),Ec.prototype=Object.assign(Object.create(ne),{constructor:Ec,ValueTypeName:"quaternion",DefaultInterpolation:2301,InterpolantFactoryMethodLinear:function(a){return new Dc(this.times,this.values,this.getValueSize(),a)},InterpolantFactoryMethodSmooth:void 0}),Fc.prototype=Object.assign(Object.create(ne),{constructor:Fc,ValueTypeName:"number"}),Gc.prototype=Object.assign(Object.create(ne),{constructor:Gc,ValueTypeName:"string",ValueBufferType:Array,DefaultInterpolation:2300,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0}),Hc.prototype=Object.assign(Object.create(ne),{constructor:Hc,ValueTypeName:"bool",ValueBufferType:Array,DefaultInterpolation:2300,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0}),Ic.prototype=Object.assign(Object.create(ne),{constructor:Ic,ValueTypeName:"color"}),Jc.prototype=ne,ne.constructor=Jc,Object.assign(Jc,{parse:function(a){if(void 0===a.type)throw Error("track type undefined, can not parse");var b=Jc._getTrackTypeForValueTypeName(a.type);if(void 0===a.times){var c=[],d=[];me.flattenJSON(a.keys,c,d,"value"),a.times=c,a.values=d}return void 0!==b.parse?b.parse(a):new b(a.name,a.times,a.values,a.interpolation)},toJSON:function(a){var b=a.constructor;if(void 0!==b.toJSON)b=b.toJSON(a);else{var b={name:a.name,times:me.convertArray(a.times,Array),values:me.convertArray(a.values,Array)},c=a.getInterpolation();c!==a.DefaultInterpolation&&(b.interpolation=c)}return b.type=a.ValueTypeName,b},_getTrackTypeForValueTypeName:function(a){switch(a.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return Fc;case"vector":case"vector2":case"vector3":case"vector4":return Cc;case"color":return Ic;case"quaternion":return Ec;case"bool":case"boolean":return Hc;case"string":return Gc}throw Error("Unsupported typeName: "+a)}}),Kc.prototype={constructor:Kc,resetDuration:function(){for(var a=0,b=0,c=this.tracks.length;b!==c;++b)var d=this.tracks[b],a=Math.max(a,d.times[d.times.length-1]);this.duration=a},trim:function(){for(var a=0;a<this.tracks.length;a++)this.tracks[a].trim(0,this.duration);return this},optimize:function(){for(var a=0;a<this.tracks.length;a++)this.tracks[a].optimize();return this}},Object.assign(Kc,{parse:function(a){for(var b=[],c=a.tracks,d=1/(a.fps||1),e=0,f=c.length;e!==f;++e)b.push(Jc.parse(c[e]).scale(d));return new Kc(a.name,a.duration,b)},toJSON:function(a){var b=[],c=a.tracks;a={name:a.name,duration:a.duration,tracks:b};for(var d=0,e=c.length;d!==e;++d)b.push(Jc.toJSON(c[d]));return a},CreateFromMorphTargetSequence:function(a,b,c,d){for(var e=b.length,f=[],g=0;g<e;g++){var h=[],i=[];h.push((g+e-1)%e,g,(g+1)%e),i.push(0,1,0);var j=me.getKeyframeOrder(h),h=me.sortedArray(h,1,j),i=me.sortedArray(i,1,j);d||0!==h[0]||(h.push(e),i.push(i[0])),f.push(new Fc(".morphTargetInfluences["+b[g].name+"]",h,i).scale(1/c))}return new Kc(a,-1,f)},findByName:function(a,b){var c=a;Array.isArray(a)||(c=a.geometry&&a.geometry.animations||a.animations);for(var d=0;d<c.length;d++)if(c[d].name===b)return c[d];return null},CreateClipsFromMorphTargetSequences:function(a,b,c){for(var d={},e=/^([\w-]*?)([\d]+)$/,f=0,g=a.length;f<g;f++){var h=a[f],i=h.name.match(e);if(i&&1<i.length){var j=i[1];(i=d[j])||(d[j]=i=[]),i.push(h)}}a=[];for(j in d)a.push(Kc.CreateFromMorphTargetSequence(j,d[j],b,c));return a},parseAnimation:function(a,b){if(!a)return console.error(" no animation in JSONLoader data"),null;for(var c=function(a,b,c,d,e){if(0!==c.length){var f=[],g=[];me.flattenJSON(c,f,g,d),0!==f.length&&e.push(new a(b,f,g))}},d=[],e=a.name||"default",f=a.length||-1,g=a.fps||30,h=a.hierarchy||[],i=0;i<h.length;i++){var j=h[i].keys;if(j&&0!==j.length)if(j[0].morphTargets){for(var f={},k=0;k<j.length;k++)if(j[k].morphTargets)for(var l=0;l<j[k].morphTargets.length;l++)f[j[k].morphTargets[l]]=-1;for(var m in f){for(var n=[],o=[],l=0;l!==j[k].morphTargets.length;++l){var p=j[k];n.push(p.time),o.push(p.morphTarget===m?1:0)}d.push(new Fc(".morphTargetInfluence["+m+"]",n,o))}f=f.length*(g||1)}else k=".bones["+b[i].name+"]",c(Cc,k+".position",j,"pos",d),c(Ec,k+".quaternion",j,"rot",d),c(Cc,k+".scale",j,"scl",d)}return 0===d.length?null:new Kc(e,f,d)}}),Object.assign(Lc.prototype,{load:function(a,b,c,d){var e=this;new ic(e.manager).load(a,function(a){b(e.parse(JSON.parse(a)))},c,d)},setTextures:function(a){this.textures=a},parse:function(a){function b(a){return void 0===d[a]&&console.warn("THREE.MaterialLoader: Undefined texture",a),d[a]}var d=this.textures,e=new je[a.type];if(void 0!==a.uuid&&(e.uuid=a.uuid),void 0!==a.name&&(e.name=a.name),void 0!==a.color&&e.color.setHex(a.color),void 0!==a.roughness&&(e.roughness=a.roughness),void 0!==a.metalness&&(e.metalness=a.metalness),void 0!==a.emissive&&e.emissive.setHex(a.emissive),void 0!==a.specular&&e.specular.setHex(a.specular),void 0!==a.shininess&&(e.shininess=a.shininess),void 0!==a.uniforms&&(e.uniforms=a.uniforms),void 0!==a.vertexShader&&(e.vertexShader=a.vertexShader),void 0!==a.fragmentShader&&(e.fragmentShader=a.fragmentShader),void 0!==a.vertexColors&&(e.vertexColors=a.vertexColors),void 0!==a.fog&&(e.fog=a.fog),void 0!==a.shading&&(e.shading=a.shading),void 0!==a.blending&&(e.blending=a.blending), void 0!==a.side&&(e.side=a.side),void 0!==a.opacity&&(e.opacity=a.opacity),void 0!==a.transparent&&(e.transparent=a.transparent),void 0!==a.alphaTest&&(e.alphaTest=a.alphaTest),void 0!==a.depthTest&&(e.depthTest=a.depthTest),void 0!==a.depthWrite&&(e.depthWrite=a.depthWrite),void 0!==a.colorWrite&&(e.colorWrite=a.colorWrite),void 0!==a.wireframe&&(e.wireframe=a.wireframe),void 0!==a.wireframeLinewidth&&(e.wireframeLinewidth=a.wireframeLinewidth),void 0!==a.wireframeLinecap&&(e.wireframeLinecap=a.wireframeLinecap),void 0!==a.wireframeLinejoin&&(e.wireframeLinejoin=a.wireframeLinejoin),void 0!==a.skinning&&(e.skinning=a.skinning),void 0!==a.morphTargets&&(e.morphTargets=a.morphTargets),void 0!==a.size&&(e.size=a.size),void 0!==a.sizeAttenuation&&(e.sizeAttenuation=a.sizeAttenuation),void 0!==a.map&&(e.map=b(a.map)),void 0!==a.alphaMap&&(e.alphaMap=b(a.alphaMap),e.transparent=!0),void 0!==a.bumpMap&&(e.bumpMap=b(a.bumpMap)),void 0!==a.bumpScale&&(e.bumpScale=a.bumpScale),void 0!==a.normalMap&&(e.normalMap=b(a.normalMap)),void 0!==a.normalScale){var f=a.normalScale;!1===Array.isArray(f)&&(f=[f,f]),e.normalScale=(new c).fromArray(f)}if(void 0!==a.displacementMap&&(e.displacementMap=b(a.displacementMap)),void 0!==a.displacementScale&&(e.displacementScale=a.displacementScale),void 0!==a.displacementBias&&(e.displacementBias=a.displacementBias),void 0!==a.roughnessMap&&(e.roughnessMap=b(a.roughnessMap)),void 0!==a.metalnessMap&&(e.metalnessMap=b(a.metalnessMap)),void 0!==a.emissiveMap&&(e.emissiveMap=b(a.emissiveMap)),void 0!==a.emissiveIntensity&&(e.emissiveIntensity=a.emissiveIntensity),void 0!==a.specularMap&&(e.specularMap=b(a.specularMap)),void 0!==a.envMap&&(e.envMap=b(a.envMap)),void 0!==a.reflectivity&&(e.reflectivity=a.reflectivity),void 0!==a.lightMap&&(e.lightMap=b(a.lightMap)),void 0!==a.lightMapIntensity&&(e.lightMapIntensity=a.lightMapIntensity),void 0!==a.aoMap&&(e.aoMap=b(a.aoMap)),void 0!==a.aoMapIntensity&&(e.aoMapIntensity=a.aoMapIntensity),void 0!==a.materials)for(var f=0,g=a.materials.length;f<g;f++)e.materials.push(this.parse(a.materials[f]));return e}}),Object.assign(Mc.prototype,{load:function(a,b,c,d){var e=this;new ic(e.manager).load(a,function(a){b(e.parse(JSON.parse(a)))},c,d)},parse:function(a){var b=new pa,c=a.data.index,d={Int8Array:Int8Array,Uint8Array:Uint8Array,Uint8ClampedArray:Uint8ClampedArray,Int16Array:Int16Array,Uint16Array:Uint16Array,Int32Array:Int32Array,Uint32Array:Uint32Array,Float32Array:Float32Array,Float64Array:Float64Array};void 0!==c&&(c=new d[c.type](c.array),b.setIndex(new ja(c,1)));var e,f=a.data.attributes;for(e in f){var g=f[e],c=new d[g.type](g.array);b.addAttribute(e,new ja(c,g.itemSize,g.normalized))}if(void 0!==(d=a.data.groups||a.data.drawcalls||a.data.offsets))for(e=0,c=d.length;e!==c;++e)f=d[e],b.addGroup(f.start,f.count,f.materialIndex);return a=a.data.boundingSphere,void 0!==a&&(d=new i,void 0!==a.center&&d.fromArray(a.center),b.boundingSphere=new Y(d,a.radius)),b}}),Nc.prototype={constructor:Nc,crossOrigin:void 0,extractUrlBase:function(a){return a=a.split("/"),1===a.length?"./":(a.pop(),a.join("/")+"/")},initMaterials:function(a,b,c){for(var d=[],e=0;e<a.length;++e)d[e]=this.createMaterial(a[e],b,c);return d},createMaterial:function(){var a,b,c;return function(d,e,f){function g(a,c,d,g,h){a=e+a;var j=Nc.Handlers.get(a);return null!==j?a=j.load(a):(b.setCrossOrigin(f),a=b.load(a)),void 0!==c&&(a.repeat.fromArray(c),1!==c[0]&&(a.wrapS=1e3),1!==c[1]&&(a.wrapT=1e3)),void 0!==d&&a.offset.fromArray(d),void 0!==g&&("repeat"===g[0]&&(a.wrapS=1e3),"mirror"===g[0]&&(a.wrapS=1002),"repeat"===g[1]&&(a.wrapT=1e3),"mirror"===g[1]&&(a.wrapT=1002)),void 0!==h&&(a.anisotropy=h),c=Td.generateUUID(),i[c]=a,c}void 0===a&&(a=new Q),void 0===b&&(b=new nc),void 0===c&&(c=new Lc);var h,i={},j={uuid:Td.generateUUID(),type:"MeshLambertMaterial"};for(h in d){var k=d[h];switch(h){case"DbgColor":case"DbgIndex":case"opticalDensity":case"illumination":break;case"DbgName":j.name=k;break;case"blending":j.blending=Pd[k];break;case"colorAmbient":case"mapAmbient":console.warn("THREE.Loader.createMaterial:",h,"is no longer supported.");break;case"colorDiffuse":j.color=a.fromArray(k).getHex();break;case"colorSpecular":j.specular=a.fromArray(k).getHex();break;case"colorEmissive":j.emissive=a.fromArray(k).getHex();break;case"specularCoef":j.shininess=k;break;case"shading":"basic"===k.toLowerCase()&&(j.type="MeshBasicMaterial"),"phong"===k.toLowerCase()&&(j.type="MeshPhongMaterial"),"standard"===k.toLowerCase()&&(j.type="MeshStandardMaterial");break;case"mapDiffuse":j.map=g(k,d.mapDiffuseRepeat,d.mapDiffuseOffset,d.mapDiffuseWrap,d.mapDiffuseAnisotropy);break;case"mapDiffuseRepeat":case"mapDiffuseOffset":case"mapDiffuseWrap":case"mapDiffuseAnisotropy":break;case"mapEmissive":j.emissiveMap=g(k,d.mapEmissiveRepeat,d.mapEmissiveOffset,d.mapEmissiveWrap,d.mapEmissiveAnisotropy);break;case"mapEmissiveRepeat":case"mapEmissiveOffset":case"mapEmissiveWrap":case"mapEmissiveAnisotropy":break;case"mapLight":j.lightMap=g(k,d.mapLightRepeat,d.mapLightOffset,d.mapLightWrap,d.mapLightAnisotropy);break;case"mapLightRepeat":case"mapLightOffset":case"mapLightWrap":case"mapLightAnisotropy":break;case"mapAO":j.aoMap=g(k,d.mapAORepeat,d.mapAOOffset,d.mapAOWrap,d.mapAOAnisotropy);break;case"mapAORepeat":case"mapAOOffset":case"mapAOWrap":case"mapAOAnisotropy":break;case"mapBump":j.bumpMap=g(k,d.mapBumpRepeat,d.mapBumpOffset,d.mapBumpWrap,d.mapBumpAnisotropy);break;case"mapBumpScale":j.bumpScale=k;break;case"mapBumpRepeat":case"mapBumpOffset":case"mapBumpWrap":case"mapBumpAnisotropy":break;case"mapNormal":j.normalMap=g(k,d.mapNormalRepeat,d.mapNormalOffset,d.mapNormalWrap,d.mapNormalAnisotropy);break;case"mapNormalFactor":j.normalScale=[k,k];break;case"mapNormalRepeat":case"mapNormalOffset":case"mapNormalWrap":case"mapNormalAnisotropy":break;case"mapSpecular":j.specularMap=g(k,d.mapSpecularRepeat,d.mapSpecularOffset,d.mapSpecularWrap,d.mapSpecularAnisotropy);break;case"mapSpecularRepeat":case"mapSpecularOffset":case"mapSpecularWrap":case"mapSpecularAnisotropy":break;case"mapMetalness":j.metalnessMap=g(k,d.mapMetalnessRepeat,d.mapMetalnessOffset,d.mapMetalnessWrap,d.mapMetalnessAnisotropy);break;case"mapMetalnessRepeat":case"mapMetalnessOffset":case"mapMetalnessWrap":case"mapMetalnessAnisotropy":break;case"mapRoughness":j.roughnessMap=g(k,d.mapRoughnessRepeat,d.mapRoughnessOffset,d.mapRoughnessWrap,d.mapRoughnessAnisotropy);break;case"mapRoughnessRepeat":case"mapRoughnessOffset":case"mapRoughnessWrap":case"mapRoughnessAnisotropy":break;case"mapAlpha":j.alphaMap=g(k,d.mapAlphaRepeat,d.mapAlphaOffset,d.mapAlphaWrap,d.mapAlphaAnisotropy);break;case"mapAlphaRepeat":case"mapAlphaOffset":case"mapAlphaWrap":case"mapAlphaAnisotropy":break;case"flipSided":j.side=1;break;case"doubleSided":j.side=2;break;case"transparency":console.warn("THREE.Loader.createMaterial: transparency has been renamed to opacity"),j.opacity=k;break;case"depthTest":case"depthWrite":case"colorWrite":case"opacity":case"reflectivity":case"transparent":case"visible":case"wireframe":j[h]=k;break;case"vertexColors":!0===k&&(j.vertexColors=2),"face"===k&&(j.vertexColors=1);break;default:console.error("THREE.Loader.createMaterial: Unsupported",h,k)}}return"MeshBasicMaterial"===j.type&&delete j.emissive,"MeshPhongMaterial"!==j.type&&delete j.specular,1>j.opacity&&(j.transparent=!0),c.setTextures(i),c.parse(j)}}()},Nc.Handlers={handlers:[],add:function(a,b){this.handlers.push(a,b)},get:function(a){for(var b=this.handlers,c=0,d=b.length;c<d;c+=2){var e=b[c+1];if(b[c].test(a))return e}return null}},Object.assign(Oc.prototype,{load:function(a,b,c,d){var e=this,f=this.texturePath&&"string"==typeof this.texturePath?this.texturePath:Nc.prototype.extractUrlBase(a),g=new ic(this.manager);g.setWithCredentials(this.withCredentials),g.load(a,function(c){c=JSON.parse(c);var d=c.metadata;if(void 0!==d&&void 0!==(d=d.type)){if("object"===d.toLowerCase())return void console.error("THREE.JSONLoader: "+a+" should be loaded with THREE.ObjectLoader instead.");if("scene"===d.toLowerCase())return void console.error("THREE.JSONLoader: "+a+" should be loaded with THREE.SceneLoader instead.")}c=e.parse(c,f),b(c.geometry,c.materials)},c,d)},setTexturePath:function(a){this.texturePath=a},parse:function(a,b){var d=new na,f=void 0!==a.scale?1/a.scale:1;return function(b){var e,f,g,h,j,k,l,m,n,o,p,q,r,s=a.faces;k=a.vertices;var t=a.normals,u=a.colors,v=0;if(void 0!==a.uvs){for(e=0;e<a.uvs.length;e++)a.uvs[e].length&&v++;for(e=0;e<v;e++)d.faceVertexUvs[e]=[]}for(h=0,j=k.length;h<j;)e=new i,e.x=k[h++]*b,e.y=k[h++]*b,e.z=k[h++]*b,d.vertices.push(e);for(h=0,j=s.length;h<j;)if(b=s[h++],n=1&b,g=2&b,e=8&b,l=16&b,o=32&b,k=64&b,b&=128,n){if(n=new ha,n.a=s[h],n.b=s[h+1],n.c=s[h+3],p=new ha,p.a=s[h+1],p.b=s[h+2],p.c=s[h+3],h+=4,g&&(g=s[h++],n.materialIndex=g,p.materialIndex=g),g=d.faces.length,e)for(e=0;e<v;e++)for(q=a.uvs[e],d.faceVertexUvs[e][g]=[],d.faceVertexUvs[e][g+1]=[],f=0;4>f;f++)m=s[h++],r=q[2*m],m=q[2*m+1],r=new c(r,m),2!==f&&d.faceVertexUvs[e][g].push(r),0!==f&&d.faceVertexUvs[e][g+1].push(r);if(l&&(l=3*s[h++],n.normal.set(t[l++],t[l++],t[l]),p.normal.copy(n.normal)),o)for(e=0;4>e;e++)l=3*s[h++],o=new i(t[l++],t[l++],t[l]),2!==e&&n.vertexNormals.push(o),0!==e&&p.vertexNormals.push(o);if(k&&(k=s[h++],k=u[k],n.color.setHex(k),p.color.setHex(k)),b)for(e=0;4>e;e++)k=s[h++],k=u[k],2!==e&&n.vertexColors.push(new Q(k)),0!==e&&p.vertexColors.push(new Q(k));d.faces.push(n),d.faces.push(p)}else{if(n=new ha,n.a=s[h++],n.b=s[h++],n.c=s[h++],g&&(g=s[h++],n.materialIndex=g),g=d.faces.length,e)for(e=0;e<v;e++)for(q=a.uvs[e],d.faceVertexUvs[e][g]=[],f=0;3>f;f++)m=s[h++],r=q[2*m],m=q[2*m+1],r=new c(r,m),d.faceVertexUvs[e][g].push(r);if(l&&(l=3*s[h++],n.normal.set(t[l++],t[l++],t[l])),o)for(e=0;3>e;e++)l=3*s[h++],o=new i(t[l++],t[l++],t[l]),n.vertexNormals.push(o);if(k&&(k=s[h++],n.color.setHex(u[k])),b)for(e=0;3>e;e++)k=s[h++],n.vertexColors.push(new Q(u[k]));d.faces.push(n)}}(f),function(){var b=void 0!==a.influencesPerVertex?a.influencesPerVertex:2;if(a.skinWeights)for(var c=0,f=a.skinWeights.length;c<f;c+=b)d.skinWeights.push(new e(a.skinWeights[c],1<b?a.skinWeights[c+1]:0,2<b?a.skinWeights[c+2]:0,3<b?a.skinWeights[c+3]:0));if(a.skinIndices)for(c=0,f=a.skinIndices.length;c<f;c+=b)d.skinIndices.push(new e(a.skinIndices[c],1<b?a.skinIndices[c+1]:0,2<b?a.skinIndices[c+2]:0,3<b?a.skinIndices[c+3]:0));d.bones=a.bones,d.bones&&0<d.bones.length&&(d.skinWeights.length!==d.skinIndices.length||d.skinIndices.length!==d.vertices.length)&&console.warn("When skinning, number of vertices ("+d.vertices.length+"), skinIndices ("+d.skinIndices.length+"), and skinWeights ("+d.skinWeights.length+") should match.")}(),function(b){if(void 0!==a.morphTargets)for(var c=0,e=a.morphTargets.length;c<e;c++){d.morphTargets[c]={},d.morphTargets[c].name=a.morphTargets[c].name,d.morphTargets[c].vertices=[];for(var f=d.morphTargets[c].vertices,g=a.morphTargets[c].vertices,h=0,j=g.length;h<j;h+=3){var k=new i;k.x=g[h]*b,k.y=g[h+1]*b,k.z=g[h+2]*b,f.push(k)}}if(void 0!==a.morphColors&&0<a.morphColors.length)for(console.warn('THREE.JSONLoader: "morphColors" no longer supported. Using them as face colors.'),b=d.faces,f=a.morphColors[0].colors,c=0,e=b.length;c<e;c++)b[c].color.fromArray(f,3*c)}(f),function(){var b=[],c=[];void 0!==a.animation&&c.push(a.animation),void 0!==a.animations&&(a.animations.length?c=c.concat(a.animations):c.push(a.animations));for(var e=0;e<c.length;e++){var f=Kc.parseAnimation(c[e],d.bones);f&&b.push(f)}d.morphTargets&&(c=Kc.CreateClipsFromMorphTargetSequences(d.morphTargets,10),b=b.concat(c)),0<b.length&&(d.animations=b)}(),d.computeFaceNormals(),d.computeBoundingSphere(),void 0===a.materials||0===a.materials.length?{geometry:d}:(f=Nc.prototype.initMaterials(a.materials,b,this.crossOrigin),{geometry:d,materials:f})}}),Object.assign(Pc.prototype,{load:function(a,b,c,d){""===this.texturePath&&(this.texturePath=a.substring(0,a.lastIndexOf("/")+1));var e=this;new ic(e.manager).load(a,function(a){e.parse(JSON.parse(a),b)},c,d)},setTexturePath:function(a){this.texturePath=a},setCrossOrigin:function(a){this.crossOrigin=a},parse:function(a,b){var c=this.parseGeometries(a.geometries),d=this.parseImages(a.images,function(){void 0!==b&&b(e)}),d=this.parseTextures(a.textures,d),d=this.parseMaterials(a.materials,d),e=this.parseObject(a.object,c,d);return a.animations&&(e.animations=this.parseAnimations(a.animations)),void 0!==a.images&&0!==a.images.length||void 0===b||b(e),e},parseGeometries:function(a){var b={};if(void 0!==a)for(var c=new Oc,d=new Mc,e=0,f=a.length;e<f;e++){var g,h=a[e];switch(h.type){case"PlaneGeometry":case"PlaneBufferGeometry":g=new ie[h.type](h.width,h.height,h.widthSegments,h.heightSegments);break;case"BoxGeometry":case"BoxBufferGeometry":case"CubeGeometry":g=new ie[h.type](h.width,h.height,h.depth,h.widthSegments,h.heightSegments,h.depthSegments);break;case"CircleGeometry":case"CircleBufferGeometry":g=new ie[h.type](h.radius,h.segments,h.thetaStart,h.thetaLength);break;case"CylinderGeometry":case"CylinderBufferGeometry":g=new ie[h.type](h.radiusTop,h.radiusBottom,h.height,h.radialSegments,h.heightSegments,h.openEnded,h.thetaStart,h.thetaLength);break;case"ConeGeometry":case"ConeBufferGeometry":g=new ie[h.type](h.radius,h.height,h.radialSegments,h.heightSegments,h.openEnded,h.thetaStart,h.thetaLength);break;case"SphereGeometry":case"SphereBufferGeometry":g=new ie[h.type](h.radius,h.widthSegments,h.heightSegments,h.phiStart,h.phiLength,h.thetaStart,h.thetaLength);break;case"DodecahedronGeometry":case"IcosahedronGeometry":case"OctahedronGeometry":case"TetrahedronGeometry":g=new ie[h.type](h.radius,h.detail);break;case"RingGeometry":case"RingBufferGeometry":g=new ie[h.type](h.innerRadius,h.outerRadius,h.thetaSegments,h.phiSegments,h.thetaStart,h.thetaLength);break;case"TorusGeometry":case"TorusBufferGeometry":g=new ie[h.type](h.radius,h.tube,h.radialSegments,h.tubularSegments,h.arc);break;case"TorusKnotGeometry":case"TorusKnotBufferGeometry":g=new ie[h.type](h.radius,h.tube,h.tubularSegments,h.radialSegments,h.p,h.q);break;case"LatheGeometry":case"LatheBufferGeometry":g=new ie[h.type](h.points,h.segments,h.phiStart,h.phiLength);break;case"BufferGeometry":g=d.parse(h);break;case"Geometry":g=c.parse(h.data,this.texturePath).geometry;break;default:console.warn('THREE.ObjectLoader: Unsupported geometry type "'+h.type+'"');continue}g.uuid=h.uuid,void 0!==h.name&&(g.name=h.name),b[h.uuid]=g}return b},parseMaterials:function(a,b){var c={};if(void 0!==a){var d=new Lc;d.setTextures(b);for(var e=0,f=a.length;e<f;e++){var g=d.parse(a[e]);c[g.uuid]=g}}return c},parseAnimations:function(a){for(var b=[],c=0;c<a.length;c++){var d=Kc.parse(a[c]);b.push(d)}return b},parseImages:function(a,b){function c(a){return d.manager.itemStart(a),g.load(a,function(){d.manager.itemEnd(a)},void 0,function(){d.manager.itemError(a)})}var d=this,e={};if(void 0!==a&&0<a.length){var f=new hc(b),g=new lc(f);g.setCrossOrigin(this.crossOrigin);for(var f=0,h=a.length;f<h;f++){var i=a[f],j=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(i.url)?i.url:d.texturePath+i.url;e[i.uuid]=c(j)}}return e},parseTextures:function(a,b){function c(a,b){return"number"==typeof a?a:(console.warn("THREE.ObjectLoader.parseTexture: Constant should be in numeric form.",a),b[a])}var e={};if(void 0!==a)for(var f=0,g=a.length;f<g;f++){var h=a[f];void 0===h.image&&console.warn('THREE.ObjectLoader: No "image" specified for',h.uuid),void 0===b[h.image]&&console.warn("THREE.ObjectLoader: Undefined image",h.image);var i=new d(b[h.image]);i.needsUpdate=!0,i.uuid=h.uuid,void 0!==h.name&&(i.name=h.name),void 0!==h.mapping&&(i.mapping=c(h.mapping,Qd)),void 0!==h.offset&&i.offset.fromArray(h.offset),void 0!==h.repeat&&i.repeat.fromArray(h.repeat),void 0!==h.wrap&&(i.wrapS=c(h.wrap[0],Rd),i.wrapT=c(h.wrap[1],Rd)),void 0!==h.minFilter&&(i.minFilter=c(h.minFilter,Sd)),void 0!==h.magFilter&&(i.magFilter=c(h.magFilter,Sd)),void 0!==h.anisotropy&&(i.anisotropy=h.anisotropy),void 0!==h.flipY&&(i.flipY=h.flipY),e[h.uuid]=i}return e},parseObject:function(){var a=new j;return function(b,c,d){function e(a){return void 0===c[a]&&console.warn("THREE.ObjectLoader: Undefined geometry",a),c[a]}function f(a){if(void 0!==a)return void 0===d[a]&&console.warn("THREE.ObjectLoader: Undefined material",a),d[a]}var g;switch(b.type){case"Scene":g=new Ya,void 0!==b.background&&Number.isInteger(b.background)&&(g.background=new Q(b.background)),void 0!==b.fog&&("Fog"===b.fog.type?g.fog=new Xa(b.fog.color,b.fog.near,b.fog.far):"FogExp2"===b.fog.type&&(g.fog=new Wa(b.fog.color,b.fog.density)));break;case"PerspectiveCamera":g=new ua(b.fov,b.aspect,b.near,b.far),void 0!==b.focus&&(g.focus=b.focus),void 0!==b.zoom&&(g.zoom=b.zoom),void 0!==b.filmGauge&&(g.filmGauge=b.filmGauge),void 0!==b.filmOffset&&(g.filmOffset=b.filmOffset),void 0!==b.view&&(g.view=Object.assign({},b.view));break;case"OrthographicCamera":g=new va(b.left,b.right,b.top,b.bottom,b.near,b.far);break;case"AmbientLight":g=new wc(b.color,b.intensity);break;case"DirectionalLight":g=new vc(b.color,b.intensity);break;case"PointLight":g=new tc(b.color,b.intensity,b.distance,b.decay);break;case"SpotLight":g=new sc(b.color,b.intensity,b.distance,b.angle,b.penumbra,b.decay);break;case"HemisphereLight":g=new pc(b.color,b.groundColor,b.intensity);break;case"Mesh":g=e(b.geometry);var h=f(b.material);g=g.bones&&0<g.bones.length?new eb(g,h):new qa(g,h);break;case"LOD":g=new ab;break;case"Line":g=new gb(e(b.geometry),f(b.material),b.mode);break;case"LineSegments":g=new hb(e(b.geometry),f(b.material));break;case"PointCloud":case"Points":g=new jb(e(b.geometry),f(b.material));break;case"Sprite":g=new _a(f(b.material));break;case"Group":g=new kb;break;default:g=new ea}if(g.uuid=b.uuid,void 0!==b.name&&(g.name=b.name),void 0!==b.matrix?(a.fromArray(b.matrix),a.decompose(g.position,g.quaternion,g.scale)):(void 0!==b.position&&g.position.fromArray(b.position),void 0!==b.rotation&&g.rotation.fromArray(b.rotation),void 0!==b.quaternion&&g.quaternion.fromArray(b.quaternion),void 0!==b.scale&&g.scale.fromArray(b.scale)),void 0!==b.castShadow&&(g.castShadow=b.castShadow),void 0!==b.receiveShadow&&(g.receiveShadow=b.receiveShadow),b.shadow&&(void 0!==b.shadow.bias&&(g.shadow.bias=b.shadow.bias),void 0!==b.shadow.radius&&(g.shadow.radius=b.shadow.radius),void 0!==b.shadow.mapSize&&g.shadow.mapSize.fromArray(b.shadow.mapSize),void 0!==b.shadow.camera&&(g.shadow.camera=this.parseObject(b.shadow.camera))),void 0!==b.visible&&(g.visible=b.visible),void 0!==b.userData&&(g.userData=b.userData),void 0!==b.children)for(var i in b.children)g.add(this.parseObject(b.children[i],c,d));if("LOD"===b.type)for(b=b.levels,h=0;h<b.length;h++){var j=b[h];i=g.getObjectByProperty("uuid",j.object),void 0!==i&&g.addLevel(i,j.distance)}return g}}()}),Qc.prototype={constructor:Qc,getPoint:function(a){return console.warn("THREE.Curve: Warning, getPoint() not implemented!"),null},getPointAt:function(a){return a=this.getUtoTmapping(a),this.getPoint(a)},getPoints:function(a){a||(a=5);for(var b=[],c=0;c<=a;c++)b.push(this.getPoint(c/a));return b},getSpacedPoints:function(a){a||(a=5);for(var b=[],c=0;c<=a;c++)b.push(this.getPointAt(c/a));return b},getLength:function(){var a=this.getLengths();return a[a.length-1]},getLengths:function(a){if(a||(a=this.__arcLengthDivisions?this.__arcLengthDivisions:200),this.cacheArcLengths&&this.cacheArcLengths.length===a+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;var b,c,d=[],e=this.getPoint(0),f=0;for(d.push(0),c=1;c<=a;c++)b=this.getPoint(c/a),f+=b.distanceTo(e),d.push(f),e=b;return this.cacheArcLengths=d},updateArcLengths:function(){this.needsUpdate=!0,this.getLengths()},getUtoTmapping:function(a,b){var c,d,e=this.getLengths(),f=e.length;d=b||a*e[f-1];for(var g,h=0,i=f-1;h<=i;)if(c=Math.floor(h+(i-h)/2),0>(g=e[c]-d))h=c+1;else{if(!(0<g)){i=c;break}i=c-1}return c=i,e[c]===d?c/(f-1):(h=e[c],(c+(d-h)/(e[c+1]-h))/(f-1))},getTangent:function(a){var b=a-1e-4;return a+=1e-4,0>b&&(b=0),1<a&&(a=1),b=this.getPoint(b),this.getPoint(a).clone().sub(b).normalize()},getTangentAt:function(a){return a=this.getUtoTmapping(a),this.getTangent(a)},computeFrenetFrames:function(a,b){var c,d,e=new i,f=[],g=[],h=[],k=new i,l=new j;for(c=0;c<=a;c++)d=c/a,f[c]=this.getTangentAt(d),f[c].normalize();g[0]=new i,h[0]=new i,c=Number.MAX_VALUE,d=Math.abs(f[0].x);var m=Math.abs(f[0].y),n=Math.abs(f[0].z);for(d<=c&&(c=d,e.set(1,0,0)),m<=c&&(c=m,e.set(0,1,0)),n<=c&&e.set(0,0,1),k.crossVectors(f[0],e).normalize(),g[0].crossVectors(f[0],k),h[0].crossVectors(f[0],g[0]),c=1;c<=a;c++)g[c]=g[c-1].clone(),h[c]=h[c-1].clone(),k.crossVectors(f[c-1],f[c]),k.length()>Number.EPSILON&&(k.normalize(),e=Math.acos(Td.clamp(f[c-1].dot(f[c]),-1,1)),g[c].applyMatrix4(l.makeRotationAxis(k,e))),h[c].crossVectors(f[c],g[c]);if(!0===b)for(e=Math.acos(Td.clamp(g[0].dot(g[a]),-1,1)),e/=a,0<f[0].dot(k.crossVectors(g[0],g[a]))&&(e=-e),c=1;c<=a;c++)g[c].applyMatrix4(l.makeRotationAxis(f[c],e*c)),h[c].crossVectors(f[c],g[c]);return{tangents:f,normals:g,binormals:h}}},Qc.create=function(a,b){return a.prototype=Object.create(Qc.prototype),a.prototype.constructor=a,a.prototype.getPoint=b,a},Rc.prototype=Object.create(Qc.prototype),Rc.prototype.constructor=Rc,Rc.prototype.isLineCurve=!0,Rc.prototype.getPoint=function(a){if(1===a)return this.v2.clone();var b=this.v2.clone().sub(this.v1);return b.multiplyScalar(a).add(this.v1),b},Rc.prototype.getPointAt=function(a){return this.getPoint(a)},Rc.prototype.getTangent=function(a){return this.v2.clone().sub(this.v1).normalize()},Sc.prototype=Object.assign(Object.create(Qc.prototype),{constructor:Sc,add:function(a){this.curves.push(a)},closePath:function(){var a=this.curves[0].getPoint(0),b=this.curves[this.curves.length-1].getPoint(1);a.equals(b)||this.curves.push(new Rc(b,a))},getPoint:function(a){var b=a*this.getLength(),c=this.getCurveLengths();for(a=0;a<c.length;){if(c[a]>=b)return b=c[a]-b,a=this.curves[a],c=a.getLength(),a.getPointAt(0===c?0:1-b/c);a++}return null},getLength:function(){var a=this.getCurveLengths();return a[a.length-1]},updateArcLengths:function(){this.needsUpdate=!0,this.cacheLengths=null,this.getLengths()},getCurveLengths:function(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;for(var a=[],b=0,c=0,d=this.curves.length;c<d;c++)b+=this.curves[c].getLength(),a.push(b);return this.cacheLengths=a},getSpacedPoints:function(a){a||(a=40);for(var b=[],c=0;c<=a;c++)b.push(this.getPoint(c/a));return this.autoClose&&b.push(b[0]),b},getPoints:function(a){a=a||12;for(var b,c=[],d=0,e=this.curves;d<e.length;d++)for(var f=e[d],f=f.getPoints(f&&f.isEllipseCurve?2*a:f&&f.isLineCurve?1:f&&f.isSplineCurve?a*f.points.length:a),g=0;g<f.length;g++){var h=f[g];b&&b.equals(h)||(c.push(h),b=h)}return this.autoClose&&1<c.length&&!c[c.length-1].equals(c[0])&&c.push(c[0]),c},createPointsGeometry:function(a){return a=this.getPoints(a),this.createGeometry(a)},createSpacedPointsGeometry:function(a){return a=this.getSpacedPoints(a),this.createGeometry(a)},createGeometry:function(a){for(var b=new na,c=0,d=a.length;c<d;c++){var e=a[c];b.vertices.push(new i(e.x,e.y,e.z||0))}return b}}),Tc.prototype=Object.create(Qc.prototype),Tc.prototype.constructor=Tc,Tc.prototype.isEllipseCurve=!0,Tc.prototype.getPoint=function(a){for(var b=2*Math.PI,d=this.aEndAngle-this.aStartAngle,e=Math.abs(d)<Number.EPSILON;0>d;)d+=b;for(;d>b;)d-=b;d<Number.EPSILON&&(d=e?0:b),!0!==this.aClockwise||e||(d=d===b?-b:d-b),b=this.aStartAngle+a*d,a=this.aX+this.xRadius*Math.cos(b);var f=this.aY+this.yRadius*Math.sin(b);return 0!==this.aRotation&&(b=Math.cos(this.aRotation),d=Math.sin(this.aRotation),e=a-this.aX,f-=this.aY,a=e*b-f*d+this.aX,f=e*d+f*b+this.aY),new c(a,f)};var oe={tangentQuadraticBezier:function(a,b,c,d){return 2*(1-a)*(c-b)+2*a*(d-c)},tangentCubicBezier:function(a,b,c,d,e){return-3*b*(1-a)*(1-a)+3*c*(1-a)*(1-a)-6*a*c*(1-a)+6*a*d*(1-a)-3*a*a*d+3*a*a*e},tangentSpline:function(a,b,c,d,e){return 6*a*a-6*a+(3*a*a-4*a+1)+(-6*a*a+6*a)+(3*a*a-2*a)},interpolate:function(a,b,c,d,e){a=.5*(c-a),d=.5*(d-b);var f=e*e;return(2*b-2*c+a+d)*e*f+(-3*b+3*c-2*a-d)*f+a*e+b}};Uc.prototype=Object.create(Qc.prototype),Uc.prototype.constructor=Uc,Uc.prototype.isSplineCurve=!0,Uc.prototype.getPoint=function(a){var b=this.points;a*=b.length-1;var d=Math.floor(a);a-=d;var e=b[0===d?d:d-1],f=b[d],g=b[d>b.length-2?b.length-1:d+1],b=b[d>b.length-3?b.length-1:d+2],d=oe.interpolate;return new c(d(e.x,f.x,g.x,b.x,a),d(e.y,f.y,g.y,b.y,a))},Vc.prototype=Object.create(Qc.prototype),Vc.prototype.constructor=Vc,Vc.prototype.getPoint=function(a){var b=he.b3;return new c(b(a,this.v0.x,this.v1.x,this.v2.x,this.v3.x),b(a,this.v0.y,this.v1.y,this.v2.y,this.v3.y))},Vc.prototype.getTangent=function(a){var b=oe.tangentCubicBezier;return new c(b(a,this.v0.x,this.v1.x,this.v2.x,this.v3.x),b(a,this.v0.y,this.v1.y,this.v2.y,this.v3.y)).normalize()},Wc.prototype=Object.create(Qc.prototype),Wc.prototype.constructor=Wc,Wc.prototype.getPoint=function(a){var b=he.b2;return new c(b(a,this.v0.x,this.v1.x,this.v2.x),b(a,this.v0.y,this.v1.y,this.v2.y))},Wc.prototype.getTangent=function(a){var b=oe.tangentQuadraticBezier;return new c(b(a,this.v0.x,this.v1.x,this.v2.x),b(a,this.v0.y,this.v1.y,this.v2.y)).normalize()};var pe=Object.assign(Object.create(Sc.prototype),{fromPoints:function(a){this.moveTo(a[0].x,a[0].y);for(var b=1,c=a.length;b<c;b++)this.lineTo(a[b].x,a[b].y)},moveTo:function(a,b){this.currentPoint.set(a,b)},lineTo:function(a,b){var d=new Rc(this.currentPoint.clone(),new c(a,b));this.curves.push(d),this.currentPoint.set(a,b)},quadraticCurveTo:function(a,b,d,e){a=new Wc(this.currentPoint.clone(),new c(a,b),new c(d,e)),this.curves.push(a),this.currentPoint.set(d,e)},bezierCurveTo:function(a,b,d,e,f,g){a=new Vc(this.currentPoint.clone(),new c(a,b),new c(d,e),new c(f,g)),this.curves.push(a),this.currentPoint.set(f,g)},splineThru:function(a){var b=[this.currentPoint.clone()].concat(a),b=new Uc(b);this.curves.push(b),this.currentPoint.copy(a[a.length-1])},arc:function(a,b,c,d,e,f){this.absarc(a+this.currentPoint.x,b+this.currentPoint.y,c,d,e,f)},absarc:function(a,b,c,d,e,f){this.absellipse(a,b,c,c,d,e,f)},ellipse:function(a,b,c,d,e,f,g,h){this.absellipse(a+this.currentPoint.x,b+this.currentPoint.y,c,d,e,f,g,h)},absellipse:function(a,b,c,d,e,f,g,h){a=new Tc(a,b,c,d,e,f,g,h),0<this.curves.length&&(b=a.getPoint(0),b.equals(this.currentPoint)||this.lineTo(b.x,b.y)),this.curves.push(a),a=a.getPoint(1),this.currentPoint.copy(a)}});Xc.prototype=Object.assign(Object.create(pe),{constructor:Xc,getPointsHoles:function(a){for(var b=[],c=0,d=this.holes.length;c<d;c++)b[c]=this.holes[c].getPoints(a);return b},extractAllPoints:function(a){return{shape:this.getPoints(a),holes:this.getPointsHoles(a)}},extractPoints:function(a){return this.extractAllPoints(a)}}),Yc.prototype=pe,pe.constructor=Yc,Zc.prototype={moveTo:function(a,b){this.currentPath=new Yc,this.subPaths.push(this.currentPath),this.currentPath.moveTo(a,b)},lineTo:function(a,b){this.currentPath.lineTo(a,b)},quadraticCurveTo:function(a,b,c,d){this.currentPath.quadraticCurveTo(a,b,c,d)},bezierCurveTo:function(a,b,c,d,e,f){this.currentPath.bezierCurveTo(a,b,c,d,e,f)},splineThru:function(a){this.currentPath.splineThru(a)},toShapes:function(a,b){function c(a){for(var b=[],c=0,d=a.length;c<d;c++){var e=a[c],f=new Xc;f.curves=e.curves,b.push(f)}return b}function d(a,b){for(var c=b.length,d=!1,e=c-1,f=0;f<c;e=f++){var g=b[e],h=b[f],i=h.x-g.x,j=h.y-g.y;if(Math.abs(j)>Number.EPSILON){if(0>j&&(g=b[f],i=-i,h=b[e],j=-j),!(a.y<g.y||a.y>h.y))if(a.y===g.y){if(a.x===g.x)return!0}else{if(0===(e=j*(a.x-g.x)-i*(a.y-g.y)))return!0;0>e||(d=!d)}}else if(a.y===g.y&&(h.x<=a.x&&a.x<=g.x||g.x<=a.x&&a.x<=h.x))return!0}return d}var e=he.isClockWise,f=this.subPaths;if(0===f.length)return[];if(!0===b)return c(f);var g,h,i,j=[];if(1===f.length)return h=f[0],i=new Xc,i.curves=h.curves,j.push(i),j;var k=!e(f[0].getPoints()),k=a?!k:k;i=[];var l,m=[],n=[],o=0;m[o]=void 0,n[o]=[];for(var p=0,q=f.length;p<q;p++)h=f[p],l=h.getPoints(),g=e(l),(g=a?!g:g)?(!k&&m[o]&&o++,m[o]={s:new Xc,p:l},m[o].s.curves=h.curves,k&&o++,n[o]=[]):n[o].push({h:h,p:l[0]});if(!m[0])return c(f);if(1<m.length){for(p=!1,h=[],e=0,f=m.length;e<f;e++)i[e]=[];for(e=0,f=m.length;e<f;e++)for(g=n[e],k=0;k<g.length;k++){for(o=g[k],l=!0,q=0;q<m.length;q++)d(o.p,m[q].p)&&(e!==q&&h.push({froms:e,tos:q,hole:k}),l?(l=!1,i[q].push(o)):p=!0);l&&i[e].push(o)}0<h.length&&(p||(n=i))}for(p=0,e=m.length;p<e;p++)for(i=m[p].s,j.push(i),h=n[p],f=0,g=h.length;f<g;f++)i.holes.push(h[f].h);return j}},Object.assign($c.prototype,{isFont:!0,generateShapes:function(a,b,c){void 0===b&&(b=100),void 0===c&&(c=4);var d=this.data;a=String(a).split("");var e=b/d.resolution,f=0;b=[];for(var g=0;g<a.length;g++){var h;h=e;var i=f,j=d.glyphs[a[g]]||d.glyphs["?"];if(j){var k,l,m,n,o,p,q,r,s=new Zc,t=[],u=he.b2,v=he.b3;if(j.o)for(var w=j._cachedOutline||(j._cachedOutline=j.o.split(" ")),x=0,y=w.length;x<y;)switch(w[x++]){case"m":k=w[x++]*h+i,l=w[x++]*h,s.moveTo(k,l);break;case"l":k=w[x++]*h+i,l=w[x++]*h,s.lineTo(k,l);break;case"q":if(k=w[x++]*h+i,l=w[x++]*h,o=w[x++]*h+i,p=w[x++]*h,s.quadraticCurveTo(o,p,k,l),n=t[t.length-1]){m=n.x,n=n.y;for(var z=1;z<=c;z++){var A=z/c;u(A,m,o,k),u(A,n,p,l)}}break;case"b":if(k=w[x++]*h+i,l=w[x++]*h,o=w[x++]*h+i,p=w[x++]*h,q=w[x++]*h+i,r=w[x++]*h,s.bezierCurveTo(o,p,q,r,k,l),n=t[t.length-1])for(m=n.x,n=n.y,z=1;z<=c;z++)A=z/c,v(A,m,o,q,k),v(A,n,p,r,l)}h={offset:j.ha*h,path:s}}else h=void 0;f+=h.offset,b.push(h.path)}for(c=[],d=0,a=b.length;d<a;d++)Array.prototype.push.apply(c,b[d].toShapes());return c}}),Object.assign(_c.prototype,{load:function(a,b,c,d){var e=this;new ic(this.manager).load(a,function(a){var c;try{c=JSON.parse(a)}catch(d){console.warn("THREE.FontLoader: typeface.js support is being deprecated. Use typeface.json instead."),c=JSON.parse(a.substring(65,a.length-2))}a=e.parse(c),b&&b(a)},c,d)},parse:function(a){return new $c(a)}});var qe;Object.assign(bd.prototype,{load:function(a,b,c,d){var e=new ic(this.manager);e.setResponseType("arraybuffer"),e.load(a,function(a){ad().decodeAudioData(a,function(a){b(a)})},c,d)}}),Object.assign(cd.prototype,{update:function(){var a,b,c,d,e,f,g,h=new j,i=new j;return function(j){if(a!==this||b!==j.focus||c!==j.fov||d!==j.aspect*this.aspect||e!==j.near||f!==j.far||g!==j.zoom){a=this,b=j.focus,c=j.fov,d=j.aspect*this.aspect,e=j.near,f=j.far,g=j.zoom;var k,l=j.projectionMatrix.clone(),m=this.eyeSep/2,n=m*e/b,o=e*Math.tan(Td.DEG2RAD*c*.5)/g;i.elements[12]=-m,h.elements[12]=m,m=-o*d+n,k=o*d+n,l.elements[0]=2*e/(k-m),l.elements[8]=(k+m)/(k-m),this.cameraL.projectionMatrix.copy(l),m=-o*d-n,k=o*d-n,l.elements[0]=2*e/(k-m),l.elements[8]=(k+m)/(k-m),this.cameraR.projectionMatrix.copy(l)}this.cameraL.matrixWorld.copy(j.matrixWorld).multiply(i),this.cameraR.matrixWorld.copy(j.matrixWorld).multiply(h)}}()}),dd.prototype=Object.create(ea.prototype),dd.prototype.constructor=dd,ed.prototype=Object.assign(Object.create(ea.prototype),{constructor:ed,getInput:function(){return this.gain},removeFilter:function(){null!==this.filter&&(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination),this.gain.connect(this.context.destination),this.filter=null)},getFilter:function(){return this.filter},setFilter:function(a){null!==this.filter?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination),this.filter=a,this.gain.connect(this.filter),this.filter.connect(this.context.destination)},getMasterVolume:function(){return this.gain.gain.value},setMasterVolume:function(a){this.gain.gain.value=a},updateMatrixWorld:function(){var a=new i,b=new h,c=new i,d=new i;return function(e){ea.prototype.updateMatrixWorld.call(this,e),e=this.context.listener;var f=this.up;this.matrixWorld.decompose(a,b,c),d.set(0,0,-1).applyQuaternion(b),e.setPosition(a.x,a.y,a.z),e.setOrientation(d.x,d.y,d.z,f.x,f.y,f.z)}}()}), fd.prototype=Object.assign(Object.create(ea.prototype),{constructor:fd,getOutput:function(){return this.gain},setNodeSource:function(a){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=a,this.connect(),this},setBuffer:function(a){return this.source.buffer=a,this.sourceType="buffer",this.autoplay&&this.play(),this},play:function(){if(!0===this.isPlaying)console.warn("THREE.Audio: Audio is already playing.");else{if(!1!==this.hasPlaybackControl){var a=this.context.createBufferSource();return a.buffer=this.source.buffer,a.loop=this.source.loop,a.onended=this.source.onended,a.start(0,this.startTime),a.playbackRate.value=this.playbackRate,this.isPlaying=!0,this.source=a,this.connect()}console.warn("THREE.Audio: this Audio has no playback control.")}},pause:function(){if(!1!==this.hasPlaybackControl)return this.source.stop(),this.startTime=this.context.currentTime,this.isPlaying=!1,this;console.warn("THREE.Audio: this Audio has no playback control.")},stop:function(){if(!1!==this.hasPlaybackControl)return this.source.stop(),this.startTime=0,this.isPlaying=!1,this;console.warn("THREE.Audio: this Audio has no playback control.")},connect:function(){if(0<this.filters.length){this.source.connect(this.filters[0]);for(var a=1,b=this.filters.length;a<b;a++)this.filters[a-1].connect(this.filters[a]);this.filters[this.filters.length-1].connect(this.getOutput())}else this.source.connect(this.getOutput());return this},disconnect:function(){if(0<this.filters.length){this.source.disconnect(this.filters[0]);for(var a=1,b=this.filters.length;a<b;a++)this.filters[a-1].disconnect(this.filters[a]);this.filters[this.filters.length-1].disconnect(this.getOutput())}else this.source.disconnect(this.getOutput());return this},getFilters:function(){return this.filters},setFilters:function(a){return a||(a=[]),!0===this.isPlaying?(this.disconnect(),this.filters=a,this.connect()):this.filters=a,this},getFilter:function(){return this.getFilters()[0]},setFilter:function(a){return this.setFilters(a?[a]:[])},setPlaybackRate:function(a){if(!1!==this.hasPlaybackControl)return this.playbackRate=a,!0===this.isPlaying&&(this.source.playbackRate.value=this.playbackRate),this;console.warn("THREE.Audio: this Audio has no playback control.")},getPlaybackRate:function(){return this.playbackRate},onEnded:function(){this.isPlaying=!1},getLoop:function(){return!1===this.hasPlaybackControl?(console.warn("THREE.Audio: this Audio has no playback control."),!1):this.source.loop},setLoop:function(a){!1===this.hasPlaybackControl?console.warn("THREE.Audio: this Audio has no playback control."):this.source.loop=a},getVolume:function(){return this.gain.gain.value},setVolume:function(a){return this.gain.gain.value=a,this}}),gd.prototype=Object.assign(Object.create(fd.prototype),{constructor:gd,getOutput:function(){return this.panner},getRefDistance:function(){return this.panner.refDistance},setRefDistance:function(a){this.panner.refDistance=a},getRolloffFactor:function(){return this.panner.rolloffFactor},setRolloffFactor:function(a){this.panner.rolloffFactor=a},getDistanceModel:function(){return this.panner.distanceModel},setDistanceModel:function(a){this.panner.distanceModel=a},getMaxDistance:function(){return this.panner.maxDistance},setMaxDistance:function(a){this.panner.maxDistance=a},updateMatrixWorld:function(){var a=new i;return function(b){ea.prototype.updateMatrixWorld.call(this,b),a.setFromMatrixPosition(this.matrixWorld),this.panner.setPosition(a.x,a.y,a.z)}}()}),Object.assign(hd.prototype,{getFrequencyData:function(){return this.analyser.getByteFrequencyData(this.data),this.data},getAverageFrequency:function(){for(var a=0,b=this.getFrequencyData(),c=0;c<b.length;c++)a+=b[c];return a/b.length}}),id.prototype={constructor:id,accumulate:function(a,b){var c=this.buffer,d=this.valueSize,e=a*d+d,f=this.cumulativeWeight;if(0===f){for(f=0;f!==d;++f)c[e+f]=c[f];f=b}else f+=b,this._mixBufferRegion(c,e,0,b/f,d);this.cumulativeWeight=f},apply:function(a){var b=this.valueSize,c=this.buffer;a=a*b+b;var d=this.cumulativeWeight,e=this.binding;this.cumulativeWeight=0,1>d&&this._mixBufferRegion(c,a,3*b,1-d,b);for(var d=b,f=b+b;d!==f;++d)if(c[d]!==c[d+b]){e.setValue(c,a);break}},saveOriginalState:function(){var a=this.buffer,b=this.valueSize,c=3*b;this.binding.getValue(a,c);for(var d=b;d!==c;++d)a[d]=a[c+d%b];this.cumulativeWeight=0},restoreOriginalState:function(){this.binding.setValue(this.buffer,3*this.valueSize)},_select:function(a,b,c,d,e){if(.5<=d)for(d=0;d!==e;++d)a[b+d]=a[c+d]},_slerp:function(a,b,c,d,e){h.slerpFlat(a,b,a,b,a,c,d)},_lerp:function(a,b,c,d,e){for(var f=1-d,g=0;g!==e;++g){var h=b+g;a[h]=a[h]*f+a[c+g]*d}}},jd.prototype={constructor:jd,getValue:function(a,b){this.bind(),this.getValue(a,b)},setValue:function(a,b){this.bind(),this.setValue(a,b)},bind:function(){var a=this.node,b=this.parsedPath,c=b.objectName,d=b.propertyName,e=b.propertyIndex;if(a||(this.node=a=jd.findNode(this.rootNode,b.nodeName)||this.rootNode),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,a){if(c){var f=b.objectIndex;switch(c){case"materials":if(!a.material)return void console.error(" can not bind to material as node does not have a material",this);if(!a.material.materials)return void console.error(" can not bind to material.materials as node.material does not have a materials array",this);a=a.material.materials;break;case"bones":if(!a.skeleton)return void console.error(" can not bind to bones as node does not have a skeleton",this);for(a=a.skeleton.bones,c=0;c<a.length;c++)if(a[c].name===f){f=c;break}break;default:if(void 0===a[c])return void console.error(" can not bind to objectName of node, undefined",this);a=a[c]}if(void 0!==f){if(void 0===a[f])return void console.error(" trying to bind to objectIndex of objectName, but is undefined:",this,a);a=a[f]}}if(void 0===(f=a[d]))console.error(" trying to update property for track: "+b.nodeName+"."+d+" but it wasn't found.",a);else{if(b=this.Versioning.None,void 0!==a.needsUpdate?(b=this.Versioning.NeedsUpdate,this.targetObject=a):void 0!==a.matrixWorldNeedsUpdate&&(b=this.Versioning.MatrixWorldNeedsUpdate,this.targetObject=a),c=this.BindingType.Direct,void 0!==e){if("morphTargetInfluences"===d){if(!a.geometry)return void console.error(" can not bind to morphTargetInfluences becasuse node does not have a geometry",this);if(!a.geometry.morphTargets)return void console.error(" can not bind to morphTargetInfluences becasuse node does not have a geometry.morphTargets",this);for(c=0;c<this.node.geometry.morphTargets.length;c++)if(a.geometry.morphTargets[c].name===e){e=c;break}}c=this.BindingType.ArrayElement,this.resolvedProperty=f,this.propertyIndex=e}else void 0!==f.fromArray&&void 0!==f.toArray?(c=this.BindingType.HasFromToArray,this.resolvedProperty=f):void 0!==f.length?(c=this.BindingType.EntireArray,this.resolvedProperty=f):this.propertyName=d;this.getValue=this.GetterByBindingType[c],this.setValue=this.SetterByBindingTypeAndVersioning[c][b]}}else console.error(" trying to update node for track: "+this.path+" but it wasn't found.")},unbind:function(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}},Object.assign(jd.prototype,{_getValue_unavailable:function(){},_setValue_unavailable:function(){},_getValue_unbound:jd.prototype.getValue,_setValue_unbound:jd.prototype.setValue,BindingType:{Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3},Versioning:{None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2},GetterByBindingType:[function(a,b){a[b]=this.node[this.propertyName]},function(a,b){for(var c=this.resolvedProperty,d=0,e=c.length;d!==e;++d)a[b++]=c[d]},function(a,b){a[b]=this.resolvedProperty[this.propertyIndex]},function(a,b){this.resolvedProperty.toArray(a,b)}],SetterByBindingTypeAndVersioning:[[function(a,b){this.node[this.propertyName]=a[b]},function(a,b){this.node[this.propertyName]=a[b],this.targetObject.needsUpdate=!0},function(a,b){this.node[this.propertyName]=a[b],this.targetObject.matrixWorldNeedsUpdate=!0}],[function(a,b){for(var c=this.resolvedProperty,d=0,e=c.length;d!==e;++d)c[d]=a[b++]},function(a,b){for(var c=this.resolvedProperty,d=0,e=c.length;d!==e;++d)c[d]=a[b++];this.targetObject.needsUpdate=!0},function(a,b){for(var c=this.resolvedProperty,d=0,e=c.length;d!==e;++d)c[d]=a[b++];this.targetObject.matrixWorldNeedsUpdate=!0}],[function(a,b){this.resolvedProperty[this.propertyIndex]=a[b]},function(a,b){this.resolvedProperty[this.propertyIndex]=a[b],this.targetObject.needsUpdate=!0},function(a,b){this.resolvedProperty[this.propertyIndex]=a[b],this.targetObject.matrixWorldNeedsUpdate=!0}],[function(a,b){this.resolvedProperty.fromArray(a,b)},function(a,b){this.resolvedProperty.fromArray(a,b),this.targetObject.needsUpdate=!0},function(a,b){this.resolvedProperty.fromArray(a,b),this.targetObject.matrixWorldNeedsUpdate=!0}]]}),jd.Composite=function(a,b,c){c=c||jd.parseTrackName(b),this._targetGroup=a,this._bindings=a.subscribe_(b,c)},jd.Composite.prototype={constructor:jd.Composite,getValue:function(a,b){this.bind();var c=this._bindings[this._targetGroup.nCachedObjects_];void 0!==c&&c.getValue(a,b)},setValue:function(a,b){for(var c=this._bindings,d=this._targetGroup.nCachedObjects_,e=c.length;d!==e;++d)c[d].setValue(a,b)},bind:function(){for(var a=this._bindings,b=this._targetGroup.nCachedObjects_,c=a.length;b!==c;++b)a[b].bind()},unbind:function(){for(var a=this._bindings,b=this._targetGroup.nCachedObjects_,c=a.length;b!==c;++b)a[b].unbind()}},jd.create=function(a,b,c){return a&&a.isAnimationObjectGroup?new jd.Composite(a,b,c):new jd(a,b,c)},jd.parseTrackName=function(a){var b=/^((?:\w+[\/:])*)(\w+)?(?:\.(\w+)(?:\[(.+)\])?)?\.(\w+)(?:\[(.+)\])?$/.exec(a);if(!b)throw Error("cannot parse trackName at all: "+a);if(b={nodeName:b[2],objectName:b[3],objectIndex:b[4],propertyName:b[5],propertyIndex:b[6]},null===b.propertyName||0===b.propertyName.length)throw Error("can not parse propertyName from trackName: "+a);return b},jd.findNode=function(a,b){if(!b||""===b||"root"===b||"."===b||-1===b||b===a.name||b===a.uuid)return a;if(a.skeleton){var c=function(a){for(var c=0;c<a.bones.length;c++){var d=a.bones[c];if(d.name===b)return d}return null}(a.skeleton);if(c)return c}if(a.children){var d=function(a){for(var c=0;c<a.length;c++){var e=a[c];if(e.name===b||e.uuid===b||(e=d(e.children)))return e}return null};if(c=d(a.children))return c}return null},kd.prototype={constructor:kd,isAnimationObjectGroup:!0,add:function(a){for(var b=this._objects,c=b.length,d=this.nCachedObjects_,e=this._indicesByUUID,f=this._paths,g=this._parsedPaths,h=this._bindings,i=h.length,j=0,k=arguments.length;j!==k;++j){var l=arguments[j],m=l.uuid,n=e[m];if(void 0===n){n=c++,e[m]=n,b.push(l);for(var m=0,o=i;m!==o;++m)h[m].push(new jd(l,f[m],g[m]))}else if(n<d){var p=b[n],q=--d,o=b[q];for(e[o.uuid]=n,b[n]=o,e[m]=q,b[q]=l,m=0,o=i;m!==o;++m){var r=h[m],s=r[n];r[n]=r[q],void 0===s&&(s=new jd(l,f[m],g[m])),r[q]=s}}else b[n]!==p&&console.error("Different objects with the same UUID detected. Clean the caches or recreate your infrastructure when reloading scenes...")}this.nCachedObjects_=d},remove:function(a){for(var b=this._objects,c=this.nCachedObjects_,d=this._indicesByUUID,e=this._bindings,f=e.length,g=0,h=arguments.length;g!==h;++g){var i=arguments[g],j=i.uuid,k=d[j];if(void 0!==k&&k>=c){var l=c++,m=b[l];for(d[m.uuid]=k,b[k]=m,d[j]=l,b[l]=i,i=0,j=f;i!==j;++i){var m=e[i],n=m[k];m[k]=m[l],m[l]=n}}}this.nCachedObjects_=c},uncache:function(a){for(var b=this._objects,c=b.length,d=this.nCachedObjects_,e=this._indicesByUUID,f=this._bindings,g=f.length,h=0,i=arguments.length;h!==i;++h){var j=arguments[h].uuid,k=e[j];if(void 0!==k)if(delete e[j],k<d){var j=--d,l=b[j],m=--c,n=b[m];for(e[l.uuid]=k,b[k]=l,e[n.uuid]=j,b[j]=n,b.pop(),l=0,n=g;l!==n;++l){var o=f[l],p=o[m];o[k]=o[j],o[j]=p,o.pop()}}else for(m=--c,n=b[m],e[n.uuid]=k,b[k]=n,b.pop(),l=0,n=g;l!==n;++l)o=f[l],o[k]=o[m],o.pop()}this.nCachedObjects_=d},subscribe_:function(a,b){var c=this._bindingsIndicesByPath,d=c[a],e=this._bindings;if(void 0!==d)return e[d];var f=this._paths,g=this._parsedPaths,h=this._objects,i=this.nCachedObjects_,j=Array(h.length),d=e.length;for(c[a]=d,f.push(a),g.push(b),e.push(j),c=i,d=h.length;c!==d;++c)j[c]=new jd(h[c],a,b);return j},unsubscribe_:function(a){var b=this._bindingsIndicesByPath,c=b[a];if(void 0!==c){var d=this._paths,e=this._parsedPaths,f=this._bindings,g=f.length-1,h=f[g];b[a[g]]=c,f[c]=h,f.pop(),e[c]=e[g],e.pop(),d[c]=d[g],d.pop()}}},ld.prototype={constructor:ld,play:function(){return this._mixer._activateAction(this),this},stop:function(){return this._mixer._deactivateAction(this),this.reset()},reset:function(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()},isRunning:function(){return this.enabled&&!this.paused&&0!==this.timeScale&&null===this._startTime&&this._mixer._isActiveAction(this)},isScheduled:function(){return this._mixer._isActiveAction(this)},startAt:function(a){return this._startTime=a,this},setLoop:function(a,b){return this.loop=a,this.repetitions=b,this},setEffectiveWeight:function(a){return this.weight=a,this._effectiveWeight=this.enabled?a:0,this.stopFading()},getEffectiveWeight:function(){return this._effectiveWeight},fadeIn:function(a){return this._scheduleFading(a,0,1)},fadeOut:function(a){return this._scheduleFading(a,1,0)},crossFadeFrom:function(a,b,c){if(a.fadeOut(b),this.fadeIn(b),c){c=this._clip.duration;var d=a._clip.duration,e=c/d;a.warp(1,d/c,b),this.warp(e,1,b)}return this},crossFadeTo:function(a,b,c){return a.crossFadeFrom(this,b,c)},stopFading:function(){var a=this._weightInterpolant;return null!==a&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(a)),this},setEffectiveTimeScale:function(a){return this.timeScale=a,this._effectiveTimeScale=this.paused?0:a,this.stopWarping()},getEffectiveTimeScale:function(){return this._effectiveTimeScale},setDuration:function(a){return this.timeScale=this._clip.duration/a,this.stopWarping()},syncWith:function(a){return this.time=a.time,this.timeScale=a.timeScale,this.stopWarping()},halt:function(a){return this.warp(this._effectiveTimeScale,0,a)},warp:function(a,b,c){var d=this._mixer,e=d.time,f=this._timeScaleInterpolant,g=this.timeScale;return null===f&&(this._timeScaleInterpolant=f=d._lendControlInterpolant()),d=f.parameterPositions,f=f.sampleValues,d[0]=e,d[1]=e+c,f[0]=a/g,f[1]=b/g,this},stopWarping:function(){var a=this._timeScaleInterpolant;return null!==a&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(a)),this},getMixer:function(){return this._mixer},getClip:function(){return this._clip},getRoot:function(){return this._localRoot||this._mixer._root},_update:function(a,b,c,d){var e=this._startTime;if(null!==e){if(0>(b=(a-e)*c)||0===c)return;this._startTime=null,b*=c}if(b*=this._updateTimeScale(a),c=this._updateTime(b),0<(a=this._updateWeight(a))){b=this._interpolants;for(var e=this._propertyBindings,f=0,g=b.length;f!==g;++f)b[f].evaluate(c),e[f].accumulate(d,a)}},_updateWeight:function(a){var b=0;if(this.enabled){var b=this.weight,c=this._weightInterpolant;if(null!==c){var d=c.evaluate(a)[0],b=b*d;a>c.parameterPositions[1]&&(this.stopFading(),0===d&&(this.enabled=!1))}}return this._effectiveWeight=b},_updateTimeScale:function(a){var b=0;if(!this.paused){var b=this.timeScale,c=this._timeScaleInterpolant;if(null!==c){var d=c.evaluate(a)[0],b=b*d;a>c.parameterPositions[1]&&(this.stopWarping(),0===b?this.paused=!0:this.timeScale=b)}}return this._effectiveTimeScale=b},_updateTime:function(a){var b=this.time+a;if(0===a)return b;var c=this._clip.duration,d=this.loop,e=this._loopCount;if(2200===d)a:{if(-1===e&&(this.loopCount=0,this._setEndings(!0,!0,!1)),b>=c)b=c;else{if(!(0>b))break a;b=0}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this._mixer.dispatchEvent({type:"finished",action:this,direction:0>a?-1:1})}else{if(d=2202===d,-1===e&&(0<=a?(e=0,this._setEndings(!0,0===this.repetitions,d)):this._setEndings(0===this.repetitions,!0,d)),b>=c||0>b){var f=Math.floor(b/c),b=b-c*f,e=e+Math.abs(f),g=this.repetitions-e;0>g?(this.clampWhenFinished?this.paused=!0:this.enabled=!1,b=0<a?c:0,this._mixer.dispatchEvent({type:"finished",action:this,direction:0<a?1:-1})):(0===g?(a=0>a,this._setEndings(a,!a,d)):this._setEndings(!1,!1,d),this._loopCount=e,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:f}))}if(d&&1==(1&e))return this.time=b,c-b}return this.time=b},_setEndings:function(a,b,c){var d=this._interpolantSettings;c?(d.endingStart=2401,d.endingEnd=2401):(d.endingStart=a?this.zeroSlopeAtStart?2401:2400:2402,d.endingEnd=b?this.zeroSlopeAtEnd?2401:2400:2402)},_scheduleFading:function(a,b,c){var d=this._mixer,e=d.time,f=this._weightInterpolant;return null===f&&(this._weightInterpolant=f=d._lendControlInterpolant()),d=f.parameterPositions,f=f.sampleValues,d[0]=e,f[0]=b,d[1]=e+a,f[1]=c,this}},Object.assign(md.prototype,b.prototype,{clipAction:function(a,b){var c=b||this._root,d=c.uuid,e="string"==typeof a?Kc.findByName(c,a):a,c=null!==e?e.uuid:a,f=this._actionsByClip[c],g=null;if(void 0!==f){if(void 0!==(g=f.actionByRoot[d]))return g;g=f.knownActions[0],null===e&&(e=g._clip)}return null===e?null:(e=new ld(this,e,b),this._bindAction(e,g),this._addInactiveAction(e,c,d),e)},existingAction:function(a,b){var c=b||this._root,d=c.uuid,c="string"==typeof a?Kc.findByName(c,a):a,c=this._actionsByClip[c?c.uuid:a];return void 0!==c?c.actionByRoot[d]||null:null},stopAllAction:function(){for(var a=this._actions,b=this._nActiveActions,c=this._bindings,d=this._nActiveBindings,e=this._nActiveBindings=this._nActiveActions=0;e!==b;++e)a[e].reset();for(e=0;e!==d;++e)c[e].useCount=0;return this},update:function(a){a*=this.timeScale;for(var b=this._actions,c=this._nActiveActions,d=this.time+=a,e=Math.sign(a),f=this._accuIndex^=1,g=0;g!==c;++g){var h=b[g];h.enabled&&h._update(d,a,e,f)}for(a=this._bindings,b=this._nActiveBindings,g=0;g!==b;++g)a[g].apply(f);return this},getRoot:function(){return this._root},uncacheClip:function(a){var b=this._actions;a=a.uuid;var c=this._actionsByClip,d=c[a];if(void 0!==d){for(var d=d.knownActions,e=0,f=d.length;e!==f;++e){var g=d[e];this._deactivateAction(g);var h=g._cacheIndex,i=b[b.length-1];g._cacheIndex=null,g._byClipCacheIndex=null,i._cacheIndex=h,b[h]=i,b.pop(),this._removeInactiveBindingsForAction(g)}delete c[a]}},uncacheRoot:function(a){a=a.uuid;var b,c=this._actionsByClip;for(b in c){var d=c[b].actionByRoot[a];void 0!==d&&(this._deactivateAction(d),this._removeInactiveAction(d))}if(void 0!==(b=this._bindingsByRootAndName[a]))for(var e in b)a=b[e],a.restoreOriginalState(),this._removeInactiveBinding(a)},uncacheAction:function(a,b){var c=this.existingAction(a,b);null!==c&&(this._deactivateAction(c),this._removeInactiveAction(c))}}),Object.assign(md.prototype,{_bindAction:function(a,b){var c=a._localRoot||this._root,d=a._clip.tracks,e=d.length,f=a._propertyBindings,g=a._interpolants,h=c.uuid,i=this._bindingsByRootAndName,j=i[h];for(void 0===j&&(j={},i[h]=j),i=0;i!==e;++i){var k=d[i],l=k.name,m=j[l];if(void 0===m){if(void 0!==(m=f[i])){null===m._cacheIndex&&(++m.referenceCount,this._addInactiveBinding(m,h,l));continue}m=new id(jd.create(c,l,b&&b._propertyBindings[i].binding.parsedPath),k.ValueTypeName,k.getValueSize()),++m.referenceCount,this._addInactiveBinding(m,h,l)}f[i]=m,g[i].resultBuffer=m.buffer}},_activateAction:function(a){if(!this._isActiveAction(a)){if(null===a._cacheIndex){var b=(a._localRoot||this._root).uuid,c=a._clip.uuid,d=this._actionsByClip[c];this._bindAction(a,d&&d.knownActions[0]),this._addInactiveAction(a,c,b)}for(b=a._propertyBindings,c=0,d=b.length;c!==d;++c){var e=b[c];0==e.useCount++&&(this._lendBinding(e),e.saveOriginalState())}this._lendAction(a)}},_deactivateAction:function(a){if(this._isActiveAction(a)){for(var b=a._propertyBindings,c=0,d=b.length;c!==d;++c){var e=b[c];0==--e.useCount&&(e.restoreOriginalState(),this._takeBackBinding(e))}this._takeBackAction(a)}},_initMemoryManager:function(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;var a=this;this.stats={actions:{get total(){return a._actions.length},get inUse(){return a._nActiveActions}},bindings:{get total(){return a._bindings.length},get inUse(){return a._nActiveBindings}},controlInterpolants:{get total(){return a._controlInterpolants.length},get inUse(){return a._nActiveControlInterpolants}}}},_isActiveAction:function(a){return null!==(a=a._cacheIndex)&&a<this._nActiveActions},_addInactiveAction:function(a,b,c){var d=this._actions,e=this._actionsByClip,f=e[b];void 0===f?(f={knownActions:[a],actionByRoot:{}},a._byClipCacheIndex=0,e[b]=f):(b=f.knownActions,a._byClipCacheIndex=b.length,b.push(a)),a._cacheIndex=d.length,d.push(a),f.actionByRoot[c]=a},_removeInactiveAction:function(a){var b=this._actions,c=b[b.length-1],d=a._cacheIndex;c._cacheIndex=d,b[d]=c,b.pop(),a._cacheIndex=null;var c=a._clip.uuid,d=this._actionsByClip,e=d[c],f=e.knownActions,g=f[f.length-1],h=a._byClipCacheIndex;g._byClipCacheIndex=h,f[h]=g,f.pop(),a._byClipCacheIndex=null,delete e.actionByRoot[(b._localRoot||this._root).uuid],0===f.length&&delete d[c],this._removeInactiveBindingsForAction(a)},_removeInactiveBindingsForAction:function(a){a=a._propertyBindings;for(var b=0,c=a.length;b!==c;++b){var d=a[b];0==--d.referenceCount&&this._removeInactiveBinding(d)}},_lendAction:function(a){var b=this._actions,c=a._cacheIndex,d=this._nActiveActions++,e=b[d];a._cacheIndex=d,b[d]=a,e._cacheIndex=c,b[c]=e},_takeBackAction:function(a){var b=this._actions,c=a._cacheIndex,d=--this._nActiveActions,e=b[d];a._cacheIndex=d,b[d]=a,e._cacheIndex=c,b[c]=e},_addInactiveBinding:function(a,b,c){var d=this._bindingsByRootAndName,e=d[b],f=this._bindings;void 0===e&&(e={},d[b]=e),e[c]=a,a._cacheIndex=f.length,f.push(a)},_removeInactiveBinding:function(a){var b=this._bindings,c=a.binding,d=c.rootNode.uuid,c=c.path,e=this._bindingsByRootAndName,f=e[d],g=b[b.length-1];a=a._cacheIndex,g._cacheIndex=a,b[a]=g,b.pop(),delete f[c];a:{for(var h in f)break a;delete e[d]}},_lendBinding:function(a){var b=this._bindings,c=a._cacheIndex,d=this._nActiveBindings++,e=b[d];a._cacheIndex=d,b[d]=a,e._cacheIndex=c,b[c]=e},_takeBackBinding:function(a){var b=this._bindings,c=a._cacheIndex,d=--this._nActiveBindings,e=b[d];a._cacheIndex=d,b[d]=a,e._cacheIndex=c,b[c]=e},_lendControlInterpolant:function(){var a=this._controlInterpolants,b=this._nActiveControlInterpolants++,c=a[b];return void 0===c&&(c=new zc(new Float32Array(2),new Float32Array(2),1,this._controlInterpolantsResultBuffer),c.__cacheIndex=b,a[b]=c),c},_takeBackControlInterpolant:function(a){var b=this._controlInterpolants,c=a.__cacheIndex,d=--this._nActiveControlInterpolants,e=b[d];a.__cacheIndex=d,b[d]=a,e.__cacheIndex=c,b[c]=e},_controlInterpolantsResultBuffer:new Float32Array(1)}),od.prototype=Object.create(pa.prototype),od.prototype.constructor=od,od.prototype.isInstancedBufferGeometry=!0,od.prototype.addGroup=function(a,b,c){this.groups.push({start:a,count:b,materialIndex:c})},od.prototype.copy=function(a){var b=a.index;null!==b&&this.setIndex(b.clone());var c,b=a.attributes;for(c in b)this.addAttribute(c,b[c].clone());for(a=a.groups,c=0,b=a.length;c<b;c++){var d=a[c];this.addGroup(d.start,d.count,d.materialIndex)}return this},pd.prototype={constructor:pd,isInterleavedBufferAttribute:!0,get count(){return this.data.count},get array(){return this.data.array},setX:function(a,b){return this.data.array[a*this.data.stride+this.offset]=b,this},setY:function(a,b){return this.data.array[a*this.data.stride+this.offset+1]=b,this},setZ:function(a,b){return this.data.array[a*this.data.stride+this.offset+2]=b,this},setW:function(a,b){return this.data.array[a*this.data.stride+this.offset+3]=b,this},getX:function(a){return this.data.array[a*this.data.stride+this.offset]},getY:function(a){return this.data.array[a*this.data.stride+this.offset+1]},getZ:function(a){return this.data.array[a*this.data.stride+this.offset+2]},getW:function(a){return this.data.array[a*this.data.stride+this.offset+3]},setXY:function(a,b,c){return a=a*this.data.stride+this.offset,this.data.array[a+0]=b,this.data.array[a+1]=c,this},setXYZ:function(a,b,c,d){return a=a*this.data.stride+this.offset,this.data.array[a+0]=b,this.data.array[a+1]=c,this.data.array[a+2]=d,this},setXYZW:function(a,b,c,d,e){return a=a*this.data.stride+this.offset,this.data.array[a+0]=b,this.data.array[a+1]=c,this.data.array[a+2]=d,this.data.array[a+3]=e,this}},qd.prototype={constructor:qd,isInterleavedBuffer:!0,set needsUpdate(a){!0===a&&this.version++},setArray:function(a){if(Array.isArray(a))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.count=void 0!==a?a.length/this.stride:0,this.array=a},setDynamic:function(a){return this.dynamic=a,this},copy:function(a){return this.array=new a.array.constructor(a.array),this.count=a.count,this.stride=a.stride,this.dynamic=a.dynamic,this},copyAt:function(a,b,c){a*=this.stride,c*=b.stride;for(var d=0,e=this.stride;d<e;d++)this.array[a+d]=b.array[c+d];return this},set:function(a,b){return void 0===b&&(b=0),this.array.set(a,b),this},clone:function(){return(new this.constructor).copy(this)}},rd.prototype=Object.create(qd.prototype),rd.prototype.constructor=rd,rd.prototype.isInstancedInterleavedBuffer=!0,rd.prototype.copy=function(a){return qd.prototype.copy.call(this,a),this.meshPerAttribute=a.meshPerAttribute,this},sd.prototype=Object.create(ja.prototype),sd.prototype.constructor=sd,sd.prototype.isInstancedBufferAttribute=!0,sd.prototype.copy=function(a){return ja.prototype.copy.call(this,a),this.meshPerAttribute=a.meshPerAttribute,this},td.prototype={constructor:td,linePrecision:1,set:function(a,b){this.ray.set(a,b)},setFromCamera:function(a,b){b&&b.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(b.matrixWorld),this.ray.direction.set(a.x,a.y,.5).unproject(b).sub(this.ray.origin).normalize()):b&&b.isOrthographicCamera?(this.ray.origin.set(a.x,a.y,(b.near+b.far)/(b.near-b.far)).unproject(b),this.ray.direction.set(0,0,-1).transformDirection(b.matrixWorld)):console.error("THREE.Raycaster: Unsupported camera type.")},intersectObject:function(a,b){var c=[];return vd(a,this,c,b),c.sort(ud),c},intersectObjects:function(a,b){var c=[];if(!1===Array.isArray(a))return console.warn("THREE.Raycaster.intersectObjects: objects is not an Array."),c;for(var d=0,e=a.length;d<e;d++)vd(a[d],this,c,b);return c.sort(ud),c}},wd.prototype={constructor:wd,start:function(){this.oldTime=this.startTime=(performance||Date).now(),this.elapsedTime=0,this.running=!0},stop:function(){this.getElapsedTime(),this.running=!1},getElapsedTime:function(){return this.getDelta(),this.elapsedTime},getDelta:function(){var a=0;if(this.autoStart&&!this.running&&this.start(),this.running){var b=(performance||Date).now(),a=(b-this.oldTime)/1e3;this.oldTime=b,this.elapsedTime+=a}return a}},xd.prototype={constructor:xd,set:function(a,b,c){return this.radius=a,this.phi=b,this.theta=c,this},clone:function(){return(new this.constructor).copy(this)},copy:function(a){return this.radius=a.radius,this.phi=a.phi,this.theta=a.theta,this},makeSafe:function(){return this.phi=Math.max(1e-6,Math.min(Math.PI-1e-6,this.phi)),this},setFromVector3:function(a){return this.radius=a.length(),0===this.radius?this.phi=this.theta=0:(this.theta=Math.atan2(a.x,a.z),this.phi=Math.acos(Td.clamp(a.y/this.radius,-1,1))),this}},yd.prototype=Object.create(qa.prototype),yd.prototype.constructor=yd,yd.prototype.createAnimation=function(a,b,c,d){b={start:b,end:c,length:c-b+1,fps:d,duration:(c-b)/d,lastFrame:0,currentFrame:0,active:!1,time:0,direction:1,weight:1,directionBackwards:!1,mirroredLoop:!1},this.animationsMap[a]=b,this.animationsList.push(b)},yd.prototype.autoCreateAnimations=function(a){for(var b,c=/([a-z]+)_?(\d+)/i,d={},e=this.geometry,f=0,g=e.morphTargets.length;f<g;f++){var h=e.morphTargets[f].name.match(c);if(h&&1<h.length){var i=h[1];d[i]||(d[i]={start:1/0,end:-1/0}),h=d[i],f<h.start&&(h.start=f),f>h.end&&(h.end=f),b||(b=i)}}for(i in d)h=d[i],this.createAnimation(i,h.start,h.end,a);this.firstAnimation=b},yd.prototype.setAnimationDirectionForward=function(a){(a=this.animationsMap[a])&&(a.direction=1,a.directionBackwards=!1)},yd.prototype.setAnimationDirectionBackward=function(a){(a=this.animationsMap[a])&&(a.direction=-1,a.directionBackwards=!0)},yd.prototype.setAnimationFPS=function(a,b){var c=this.animationsMap[a];c&&(c.fps=b,c.duration=(c.end-c.start)/c.fps)},yd.prototype.setAnimationDuration=function(a,b){var c=this.animationsMap[a];c&&(c.duration=b,c.fps=(c.end-c.start)/c.duration)},yd.prototype.setAnimationWeight=function(a,b){var c=this.animationsMap[a];c&&(c.weight=b)},yd.prototype.setAnimationTime=function(a,b){var c=this.animationsMap[a];c&&(c.time=b)},yd.prototype.getAnimationTime=function(a){var b=0;return(a=this.animationsMap[a])&&(b=a.time),b},yd.prototype.getAnimationDuration=function(a){var b=-1;return(a=this.animationsMap[a])&&(b=a.duration),b},yd.prototype.playAnimation=function(a){var b=this.animationsMap[a];b?(b.time=0,b.active=!0):console.warn("THREE.MorphBlendMesh: animation["+a+"] undefined in .playAnimation()")},yd.prototype.stopAnimation=function(a){(a=this.animationsMap[a])&&(a.active=!1)},yd.prototype.update=function(a){for(var b=0,c=this.animationsList.length;b<c;b++){var d=this.animationsList[b];if(d.active){var e=d.duration/d.length;d.time+=d.direction*a,d.mirroredLoop?(d.time>d.duration||0>d.time)&&(d.direction*=-1,d.time>d.duration&&(d.time=d.duration,d.directionBackwards=!0),0>d.time&&(d.time=0,d.directionBackwards=!1)):(d.time%=d.duration,0>d.time&&(d.time+=d.duration));var f=d.start+Td.clamp(Math.floor(d.time/e),0,d.length-1),g=d.weight;f!==d.currentFrame&&(this.morphTargetInfluences[d.lastFrame]=0,this.morphTargetInfluences[d.currentFrame]=1*g,this.morphTargetInfluences[f]=0,d.lastFrame=d.currentFrame,d.currentFrame=f),e=d.time%e/e,d.directionBackwards&&(e=1-e),d.currentFrame!==d.lastFrame?(this.morphTargetInfluences[d.currentFrame]=e*g,this.morphTargetInfluences[d.lastFrame]=(1-e)*g):this.morphTargetInfluences[d.currentFrame]=g}}},zd.prototype=Object.create(ea.prototype),zd.prototype.constructor=zd,zd.prototype.isImmediateRenderObject=!0,Ad.prototype=Object.create(hb.prototype),Ad.prototype.constructor=Ad,Ad.prototype.update=function(){var a=new i,b=new i,c=new Z;return function(){var d=["a","b","c"];this.object.updateMatrixWorld(!0),c.getNormalMatrix(this.object.matrixWorld);var e=this.object.matrixWorld,f=this.geometry.attributes.position,g=this.object.geometry;if(g&&g.isGeometry)for(var h=g.vertices,i=g.faces,j=g=0,k=i.length;j<k;j++)for(var l=i[j],m=0,n=l.vertexNormals.length;m<n;m++){var o=l.vertexNormals[m];a.copy(h[l[d[m]]]).applyMatrix4(e),b.copy(o).applyMatrix3(c).normalize().multiplyScalar(this.size).add(a),f.setXYZ(g,a.x,a.y,a.z),g+=1,f.setXYZ(g,b.x,b.y,b.z),g+=1}else if(g&&g.isBufferGeometry)for(d=g.attributes.position,h=g.attributes.normal,m=g=0,n=d.count;m<n;m++)a.set(d.getX(m),d.getY(m),d.getZ(m)).applyMatrix4(e),b.set(h.getX(m),h.getY(m),h.getZ(m)),b.applyMatrix3(c).normalize().multiplyScalar(this.size).add(a),f.setXYZ(g,a.x,a.y,a.z),g+=1,f.setXYZ(g,b.x,b.y,b.z),g+=1;return f.needsUpdate=!0,this}}(),Bd.prototype=Object.create(ea.prototype),Bd.prototype.constructor=Bd,Bd.prototype.dispose=function(){this.cone.geometry.dispose(),this.cone.material.dispose()},Bd.prototype.update=function(){var a=new i,b=new i;return function(){var c=this.light.distance?this.light.distance:1e3,d=c*Math.tan(this.light.angle);this.cone.scale.set(d,d,c),a.setFromMatrixPosition(this.light.matrixWorld),b.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(b.sub(a)),this.cone.material.color.copy(this.light.color).multiplyScalar(this.light.intensity)}}(),Cd.prototype=Object.create(hb.prototype),Cd.prototype.constructor=Cd, Cd.prototype.getBoneList=function(a){var b=[];a&&a.isBone&&b.push(a);for(var c=0;c<a.children.length;c++)b.push.apply(b,this.getBoneList(a.children[c]));return b},Cd.prototype.update=function(){for(var a=this.geometry,b=(new j).getInverse(this.root.matrixWorld),c=new j,d=0,e=0;e<this.bones.length;e++){var f=this.bones[e];f.parent&&f.parent.isBone&&(c.multiplyMatrices(b,f.matrixWorld),a.vertices[d].setFromMatrixPosition(c),c.multiplyMatrices(b,f.parent.matrixWorld),a.vertices[d+1].setFromMatrixPosition(c),d+=2)}a.verticesNeedUpdate=!0,a.computeBoundingSphere()},Dd.prototype=Object.create(qa.prototype),Dd.prototype.constructor=Dd,Dd.prototype.dispose=function(){this.geometry.dispose(),this.material.dispose()},Dd.prototype.update=function(){this.material.color.copy(this.light.color).multiplyScalar(this.light.intensity)},Ed.prototype=Object.create(ea.prototype),Ed.prototype.constructor=Ed,Ed.prototype.dispose=function(){this.lightSphere.geometry.dispose(),this.lightSphere.material.dispose()},Ed.prototype.update=function(){var a=new i;return function(){this.colors[0].copy(this.light.color).multiplyScalar(this.light.intensity),this.colors[1].copy(this.light.groundColor).multiplyScalar(this.light.intensity),this.lightSphere.lookAt(a.setFromMatrixPosition(this.light.matrixWorld).negate()),this.lightSphere.geometry.colorsNeedUpdate=!0}}(),Fd.prototype=Object.create(hb.prototype),Fd.prototype.constructor=Fd,Fd.prototype.setColors=function(){console.error("THREE.GridHelper: setColors() has been deprecated, pass them in the constructor instead.")},Gd.prototype=Object.create(hb.prototype),Gd.prototype.constructor=Gd,Gd.prototype.update=function(){var a=new i,b=new i,c=new Z;return function(){this.object.updateMatrixWorld(!0),c.getNormalMatrix(this.object.matrixWorld);for(var d=this.object.matrixWorld,e=this.geometry.attributes.position,f=this.object.geometry,g=f.vertices,f=f.faces,h=0,i=0,j=f.length;i<j;i++){var k=f[i],l=k.normal;a.copy(g[k.a]).add(g[k.b]).add(g[k.c]).divideScalar(3).applyMatrix4(d),b.copy(l).applyMatrix3(c).normalize().multiplyScalar(this.size).add(a),e.setXYZ(h,a.x,a.y,a.z),h+=1,e.setXYZ(h,b.x,b.y,b.z),h+=1}return e.needsUpdate=!0,this}}(),Hd.prototype=Object.create(ea.prototype),Hd.prototype.constructor=Hd,Hd.prototype.dispose=function(){var a=this.children[0],b=this.children[1];a.geometry.dispose(),a.material.dispose(),b.geometry.dispose(),b.material.dispose()},Hd.prototype.update=function(){var a=new i,b=new i,c=new i;return function(){a.setFromMatrixPosition(this.light.matrixWorld),b.setFromMatrixPosition(this.light.target.matrixWorld),c.subVectors(b,a);var d=this.children[0],e=this.children[1];d.lookAt(c),d.material.color.copy(this.light.color).multiplyScalar(this.light.intensity),e.lookAt(c),e.scale.z=c.length()}}(),Id.prototype=Object.create(hb.prototype),Id.prototype.constructor=Id,Id.prototype.update=function(){function a(a,f,g,h){if(d.set(f,g,h).unproject(e),void 0!==(a=c[a]))for(f=0,g=a.length;f<g;f++)b.vertices[a[f]].copy(d)}var b,c,d=new i,e=new ta;return function(){b=this.geometry,c=this.pointMap,e.projectionMatrix.copy(this.camera.projectionMatrix),a("c",0,0,-1),a("t",0,0,1),a("n1",-1,-1,-1),a("n2",1,-1,-1),a("n3",-1,1,-1),a("n4",1,1,-1),a("f1",-1,-1,1),a("f2",1,-1,1),a("f3",-1,1,1),a("f4",1,1,1),a("u1",.7,1.1,-1),a("u2",-.7,1.1,-1),a("u3",0,2,-1),a("cf1",-1,0,1),a("cf2",1,0,1),a("cf3",0,-1,1),a("cf4",0,1,1),a("cn1",-1,0,-1),a("cn2",1,0,-1),a("cn3",0,-1,-1),a("cn4",0,1,-1),b.verticesNeedUpdate=!0}}(),Jd.prototype=Object.create(qa.prototype),Jd.prototype.constructor=Jd,Jd.prototype.update=function(){this.box.setFromObject(this.object),this.box.getSize(this.scale),this.box.getCenter(this.position)},Kd.prototype=Object.create(hb.prototype),Kd.prototype.constructor=Kd,Kd.prototype.update=function(){var a=new X;return function(b){if(b&&b.isBox3?a.copy(b):a.setFromObject(b),!a.isEmpty()){b=a.min;var c=a.max,d=this.geometry.attributes.position,e=d.array;e[0]=c.x,e[1]=c.y,e[2]=c.z,e[3]=b.x,e[4]=c.y,e[5]=c.z,e[6]=b.x,e[7]=b.y,e[8]=c.z,e[9]=c.x,e[10]=b.y,e[11]=c.z,e[12]=c.x,e[13]=c.y,e[14]=b.z,e[15]=b.x,e[16]=c.y,e[17]=b.z,e[18]=b.x,e[19]=b.y,e[20]=b.z,e[21]=c.x,e[22]=b.y,e[23]=b.z,d.needsUpdate=!0,this.geometry.computeBoundingSphere()}}}();var re=new pa;re.addAttribute("position",new ma([0,0,0,0,1,0],3));var se=new Tb(0,.5,1,5,1);se.translate(0,-.5,0),Ld.prototype=Object.create(ea.prototype),Ld.prototype.constructor=Ld,Ld.prototype.setDirection=function(){var a,b=new i;return function(c){.99999<c.y?this.quaternion.set(0,0,0,1):-.99999>c.y?this.quaternion.set(1,0,0,0):(b.set(c.z,0,-c.x).normalize(),a=Math.acos(c.y),this.quaternion.setFromAxisAngle(b,a))}}(),Ld.prototype.setLength=function(a,b,c){void 0===b&&(b=.2*a),void 0===c&&(c=.2*b),this.line.scale.set(1,Math.max(0,a-b),1),this.line.updateMatrix(),this.cone.scale.set(c,b,c),this.cone.position.y=a,this.cone.updateMatrix()},Ld.prototype.setColor=function(a){this.line.material.color.copy(a),this.cone.material.color.copy(a)},Md.prototype=Object.create(hb.prototype),Md.prototype.constructor=Md;var te=function(){function a(){}var b=new i,c=new a,d=new a,e=new a;return a.prototype.init=function(a,b,c,d){this.c0=a,this.c1=c,this.c2=-3*a+3*b-2*c-d,this.c3=2*a-2*b+c+d},a.prototype.initNonuniformCatmullRom=function(a,b,c,d,e,f,g){this.init(b,c,((b-a)/e-(c-a)/(e+f)+(c-b)/f)*f,((c-b)/f-(d-b)/(f+g)+(d-c)/g)*f)},a.prototype.initCatmullRom=function(a,b,c,d,e){this.init(b,c,e*(c-a),e*(d-b))},a.prototype.calc=function(a){var b=a*a;return this.c0+this.c1*a+this.c2*b+this.c3*b*a},Qc.create(function(a){this.points=a||[],this.closed=!1},function(a){var f,g,h=this.points;g=h.length,2>g&&console.log("duh, you need at least 2 points"),a*=g-(this.closed?0:1),f=Math.floor(a),a-=f,this.closed?f+=0<f?0:(Math.floor(Math.abs(f)/h.length)+1)*h.length:0===a&&f===g-1&&(f=g-2,a=1);var j,k,l;if(this.closed||0<f?j=h[(f-1)%g]:(b.subVectors(h[0],h[1]).add(h[0]),j=b),k=h[f%g],l=h[(f+1)%g],this.closed||f+2<g?h=h[(f+2)%g]:(b.subVectors(h[g-1],h[g-2]).add(h[g-1]),h=b),void 0===this.type||"centripetal"===this.type||"chordal"===this.type){var m="chordal"===this.type?.5:.25;g=Math.pow(j.distanceToSquared(k),m),f=Math.pow(k.distanceToSquared(l),m),m=Math.pow(l.distanceToSquared(h),m),1e-4>f&&(f=1),1e-4>g&&(g=f),1e-4>m&&(m=f),c.initNonuniformCatmullRom(j.x,k.x,l.x,h.x,g,f,m),d.initNonuniformCatmullRom(j.y,k.y,l.y,h.y,g,f,m),e.initNonuniformCatmullRom(j.z,k.z,l.z,h.z,g,f,m)}else"catmullrom"===this.type&&(g=void 0!==this.tension?this.tension:.5,c.initCatmullRom(j.x,k.x,l.x,h.x,g),d.initCatmullRom(j.y,k.y,l.y,h.y,g),e.initCatmullRom(j.z,k.z,l.z,h.z,g));return new i(c.calc(a),d.calc(a),e.calc(a))})}();Nd.prototype=Object.create(te.prototype);var ue=Qc.create(function(a){console.warn("THREE.SplineCurve3 will be deprecated. Please use THREE.CatmullRomCurve3"),this.points=void 0===a?[]:a},function(a){var b=this.points;a*=b.length-1;var c=Math.floor(a);a-=c;var d=b[0==c?c:c-1],e=b[c],f=b[c>b.length-2?b.length-1:c+1],b=b[c>b.length-3?b.length-1:c+2],c=oe.interpolate;return new i(c(d.x,e.x,f.x,b.x,a),c(d.y,e.y,f.y,b.y,a),c(d.z,e.z,f.z,b.z,a))}),ve=Qc.create(function(a,b,c,d){this.v0=a,this.v1=b,this.v2=c,this.v3=d},function(a){var b=he.b3;return new i(b(a,this.v0.x,this.v1.x,this.v2.x,this.v3.x),b(a,this.v0.y,this.v1.y,this.v2.y,this.v3.y),b(a,this.v0.z,this.v1.z,this.v2.z,this.v3.z))}),we=Qc.create(function(a,b,c){this.v0=a,this.v1=b,this.v2=c},function(a){var b=he.b2;return new i(b(a,this.v0.x,this.v1.x,this.v2.x),b(a,this.v0.y,this.v1.y,this.v2.y),b(a,this.v0.z,this.v1.z,this.v2.z))}),xe=Qc.create(function(a,b){this.v1=a,this.v2=b},function(a){if(1===a)return this.v2.clone();var b=new i;return b.subVectors(this.v2,this.v1),b.multiplyScalar(a),b.add(this.v1),b});Od.prototype=Object.create(Tc.prototype),Od.prototype.constructor=Od,Object.assign(R.prototype,{center:function(a){return console.warn("THREE.Box2: .center() has been renamed to .getCenter()."),this.getCenter(a)},empty:function(){return console.warn("THREE.Box2: .empty() has been renamed to .isEmpty()."),this.isEmpty()},isIntersectionBox:function(a){return console.warn("THREE.Box2: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(a)},size:function(a){return console.warn("THREE.Box2: .size() has been renamed to .getSize()."),this.getSize(a)}}),Object.assign(X.prototype,{center:function(a){return console.warn("THREE.Box3: .center() has been renamed to .getCenter()."),this.getCenter(a)},empty:function(){return console.warn("THREE.Box3: .empty() has been renamed to .isEmpty()."),this.isEmpty()},isIntersectionBox:function(a){return console.warn("THREE.Box3: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(a)},isIntersectionSphere:function(a){return console.warn("THREE.Box3: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(a)},size:function(a){return console.warn("THREE.Box3: .size() has been renamed to .getSize()."),this.getSize(a)}}),Object.assign(fa.prototype,{center:function(a){return console.warn("THREE.Line3: .center() has been renamed to .getCenter()."),this.getCenter(a)}}),Object.assign(Z.prototype,{multiplyVector3:function(a){return console.warn("THREE.Matrix3: .multiplyVector3() has been removed. Use vector.applyMatrix3( matrix ) instead."),a.applyMatrix3(this)},multiplyVector3Array:function(a){return console.warn("THREE.Matrix3: .multiplyVector3Array() has been renamed. Use matrix.applyToVector3Array( array ) instead."),this.applyToVector3Array(a)}}),Object.assign(j.prototype,{extractPosition:function(a){return console.warn("THREE.Matrix4: .extractPosition() has been renamed to .copyPosition()."),this.copyPosition(a)},setRotationFromQuaternion:function(a){return console.warn("THREE.Matrix4: .setRotationFromQuaternion() has been renamed to .makeRotationFromQuaternion()."),this.makeRotationFromQuaternion(a)},multiplyVector3:function(a){return console.warn("THREE.Matrix4: .multiplyVector3() has been removed. Use vector.applyMatrix4( matrix ) or vector.applyProjection( matrix ) instead."),a.applyProjection(this)},multiplyVector4:function(a){return console.warn("THREE.Matrix4: .multiplyVector4() has been removed. Use vector.applyMatrix4( matrix ) instead."),a.applyMatrix4(this)},multiplyVector3Array:function(a){return console.warn("THREE.Matrix4: .multiplyVector3Array() has been renamed. Use matrix.applyToVector3Array( array ) instead."),this.applyToVector3Array(a)},rotateAxis:function(a){console.warn("THREE.Matrix4: .rotateAxis() has been removed. Use Vector3.transformDirection( matrix ) instead."),a.transformDirection(this)},crossVector:function(a){return console.warn("THREE.Matrix4: .crossVector() has been removed. Use vector.applyMatrix4( matrix ) instead."),a.applyMatrix4(this)},translate:function(a){console.error("THREE.Matrix4: .translate() has been removed.")},rotateX:function(a){console.error("THREE.Matrix4: .rotateX() has been removed.")},rotateY:function(a){console.error("THREE.Matrix4: .rotateY() has been removed.")},rotateZ:function(a){console.error("THREE.Matrix4: .rotateZ() has been removed.")},rotateByAxis:function(a,b){console.error("THREE.Matrix4: .rotateByAxis() has been removed.")}}),Object.assign($.prototype,{isIntersectionLine:function(a){return console.warn("THREE.Plane: .isIntersectionLine() has been renamed to .intersectsLine()."),this.intersectsLine(a)}}),Object.assign(h.prototype,{multiplyVector3:function(a){return console.warn("THREE.Quaternion: .multiplyVector3() has been removed. Use is now vector.applyQuaternion( quaternion ) instead."),a.applyQuaternion(this)}}),Object.assign(ba.prototype,{isIntersectionBox:function(a){return console.warn("THREE.Ray: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(a)},isIntersectionPlane:function(a){return console.warn("THREE.Ray: .isIntersectionPlane() has been renamed to .intersectsPlane()."),this.intersectsPlane(a)},isIntersectionSphere:function(a){return console.warn("THREE.Ray: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(a)}}),Object.assign(Xc.prototype,{extrude:function(a){return console.warn("THREE.Shape: .extrude() has been removed. Use ExtrudeGeometry() instead."),new Ib(this,a)},makeGeometry:function(a){return console.warn("THREE.Shape: .makeGeometry() has been removed. Use ShapeGeometry() instead."),new Rb(this,a)}}),Object.assign(i.prototype,{setEulerFromRotationMatrix:function(){console.error("THREE.Vector3: .setEulerFromRotationMatrix() has been removed. Use Euler.setFromRotationMatrix() instead.")},setEulerFromQuaternion:function(){console.error("THREE.Vector3: .setEulerFromQuaternion() has been removed. Use Euler.setFromQuaternion() instead.")},getPositionFromMatrix:function(a){return console.warn("THREE.Vector3: .getPositionFromMatrix() has been renamed to .setFromMatrixPosition()."),this.setFromMatrixPosition(a)},getScaleFromMatrix:function(a){return console.warn("THREE.Vector3: .getScaleFromMatrix() has been renamed to .setFromMatrixScale()."),this.setFromMatrixScale(a)},getColumnFromMatrix:function(a,b){return console.warn("THREE.Vector3: .getColumnFromMatrix() has been renamed to .setFromMatrixColumn()."),this.setFromMatrixColumn(b,a)}}),Object.assign(ea.prototype,{getChildByName:function(a){return console.warn("THREE.Object3D: .getChildByName() has been renamed to .getObjectByName()."),this.getObjectByName(a)},renderDepth:function(a){console.warn("THREE.Object3D: .renderDepth has been removed. Use .renderOrder, instead.")},translate:function(a,b){return console.warn("THREE.Object3D: .translate() has been removed. Use .translateOnAxis( axis, distance ) instead."),this.translateOnAxis(b,a)}}),Object.defineProperties(ea.prototype,{eulerOrder:{get:function(){return console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order},set:function(a){console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order=a}},useQuaternion:{get:function(){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")},set:function(a){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")}}}),Object.defineProperties(ab.prototype,{objects:{get:function(){return console.warn("THREE.LOD: .objects has been renamed to .levels."),this.levels}}}),ua.prototype.setLens=function(a,b){console.warn("THREE.PerspectiveCamera.setLens is deprecated. Use .setFocalLength and .filmGauge for a photographic setup."),void 0!==b&&(this.filmGauge=b),this.setFocalLength(a)},Object.defineProperties(oc.prototype,{onlyShadow:{set:function(a){console.warn("THREE.Light: .onlyShadow has been removed.")}},shadowCameraFov:{set:function(a){console.warn("THREE.Light: .shadowCameraFov is now .shadow.camera.fov."),this.shadow.camera.fov=a}},shadowCameraLeft:{set:function(a){console.warn("THREE.Light: .shadowCameraLeft is now .shadow.camera.left."),this.shadow.camera.left=a}},shadowCameraRight:{set:function(a){console.warn("THREE.Light: .shadowCameraRight is now .shadow.camera.right."),this.shadow.camera.right=a}},shadowCameraTop:{set:function(a){console.warn("THREE.Light: .shadowCameraTop is now .shadow.camera.top."),this.shadow.camera.top=a}},shadowCameraBottom:{set:function(a){console.warn("THREE.Light: .shadowCameraBottom is now .shadow.camera.bottom."),this.shadow.camera.bottom=a}},shadowCameraNear:{set:function(a){console.warn("THREE.Light: .shadowCameraNear is now .shadow.camera.near."),this.shadow.camera.near=a}},shadowCameraFar:{set:function(a){console.warn("THREE.Light: .shadowCameraFar is now .shadow.camera.far."),this.shadow.camera.far=a}},shadowCameraVisible:{set:function(a){console.warn("THREE.Light: .shadowCameraVisible has been removed. Use new THREE.CameraHelper( light.shadow.camera ) instead.")}},shadowBias:{set:function(a){console.warn("THREE.Light: .shadowBias is now .shadow.bias."),this.shadow.bias=a}},shadowDarkness:{set:function(a){console.warn("THREE.Light: .shadowDarkness has been removed.")}},shadowMapWidth:{set:function(a){console.warn("THREE.Light: .shadowMapWidth is now .shadow.mapSize.width."),this.shadow.mapSize.width=a}},shadowMapHeight:{set:function(a){console.warn("THREE.Light: .shadowMapHeight is now .shadow.mapSize.height."),this.shadow.mapSize.height=a}}}),Object.defineProperties(ja.prototype,{length:{get:function(){return console.warn("THREE.BufferAttribute: .length has been deprecated. Please use .count."),this.array.length}}}),Object.assign(pa.prototype,{addIndex:function(a){console.warn("THREE.BufferGeometry: .addIndex() has been renamed to .setIndex()."),this.setIndex(a)},addDrawCall:function(a,b,c){void 0!==c&&console.warn("THREE.BufferGeometry: .addDrawCall() no longer supports indexOffset."),console.warn("THREE.BufferGeometry: .addDrawCall() is now .addGroup()."),this.addGroup(a,b)},clearDrawCalls:function(){console.warn("THREE.BufferGeometry: .clearDrawCalls() is now .clearGroups()."),this.clearGroups()},computeTangents:function(){console.warn("THREE.BufferGeometry: .computeTangents() has been removed.")},computeOffsets:function(){console.warn("THREE.BufferGeometry: .computeOffsets() has been removed.")}}),Object.defineProperties(pa.prototype,{drawcalls:{get:function(){return console.error("THREE.BufferGeometry: .drawcalls has been renamed to .groups."),this.groups}},offsets:{get:function(){return console.warn("THREE.BufferGeometry: .offsets has been renamed to .groups."),this.groups}}}),Object.defineProperties(U.prototype,{wrapAround:{get:function(){console.warn("THREE."+this.type+": .wrapAround has been removed.")},set:function(a){console.warn("THREE."+this.type+": .wrapAround has been removed.")}},wrapRGB:{get:function(){return console.warn("THREE."+this.type+": .wrapRGB has been removed."),new Q}}}),Object.defineProperties(dc.prototype,{metal:{get:function(){return console.warn("THREE.MeshPhongMaterial: .metal has been removed. Use THREE.MeshStandardMaterial instead."),!1},set:function(a){console.warn("THREE.MeshPhongMaterial: .metal has been removed. Use THREE.MeshStandardMaterial instead")}}}),Object.defineProperties(V.prototype,{derivatives:{get:function(){return console.warn("THREE.ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives},set:function(a){console.warn("THREE. ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives=a}}}),b.prototype=Object.assign(Object.create({constructor:b,apply:function(a){console.warn("THREE.EventDispatcher: .apply is deprecated, just inherit or Object.assign the prototype to mix-in."),Object.assign(a,this)}}),b.prototype),Object.defineProperties(nd.prototype,{dynamic:{set:function(a){console.warn("THREE.Uniform: .dynamic has been removed. Use object.onBeforeRender() instead.")}},onUpdate:{value:function(){return console.warn("THREE.Uniform: .onUpdate() has been removed. Use object.onBeforeRender() instead."),this}}}),Object.assign(Va.prototype,{supportsFloatTextures:function(){return console.warn("THREE.WebGLRenderer: .supportsFloatTextures() is now .extensions.get( 'OES_texture_float' )."),this.extensions.get("OES_texture_float")},supportsHalfFloatTextures:function(){return console.warn("THREE.WebGLRenderer: .supportsHalfFloatTextures() is now .extensions.get( 'OES_texture_half_float' )."),this.extensions.get("OES_texture_half_float")},supportsStandardDerivatives:function(){return console.warn("THREE.WebGLRenderer: .supportsStandardDerivatives() is now .extensions.get( 'OES_standard_derivatives' )."),this.extensions.get("OES_standard_derivatives")},supportsCompressedTextureS3TC:function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTextureS3TC() is now .extensions.get( 'WEBGL_compressed_texture_s3tc' )."),this.extensions.get("WEBGL_compressed_texture_s3tc")},supportsCompressedTexturePVRTC:function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTexturePVRTC() is now .extensions.get( 'WEBGL_compressed_texture_pvrtc' )."),this.extensions.get("WEBGL_compressed_texture_pvrtc")},supportsBlendMinMax:function(){return console.warn("THREE.WebGLRenderer: .supportsBlendMinMax() is now .extensions.get( 'EXT_blend_minmax' )."),this.extensions.get("EXT_blend_minmax")},supportsVertexTextures:function(){return this.capabilities.vertexTextures},supportsInstancedArrays:function(){return console.warn("THREE.WebGLRenderer: .supportsInstancedArrays() is now .extensions.get( 'ANGLE_instanced_arrays' )."),this.extensions.get("ANGLE_instanced_arrays")},enableScissorTest:function(a){console.warn("THREE.WebGLRenderer: .enableScissorTest() is now .setScissorTest()."),this.setScissorTest(a)},initMaterial:function(){console.warn("THREE.WebGLRenderer: .initMaterial() has been removed.")},addPrePlugin:function(){console.warn("THREE.WebGLRenderer: .addPrePlugin() has been removed.")},addPostPlugin:function(){console.warn("THREE.WebGLRenderer: .addPostPlugin() has been removed.")},updateShadowMap:function(){console.warn("THREE.WebGLRenderer: .updateShadowMap() has been removed.")}}),Object.defineProperties(Va.prototype,{shadowMapEnabled:{get:function(){return this.shadowMap.enabled},set:function(a){console.warn("THREE.WebGLRenderer: .shadowMapEnabled is now .shadowMap.enabled."),this.shadowMap.enabled=a}},shadowMapType:{get:function(){return this.shadowMap.type},set:function(a){console.warn("THREE.WebGLRenderer: .shadowMapType is now .shadowMap.type."),this.shadowMap.type=a}},shadowMapCullFace:{get:function(){return this.shadowMap.cullFace},set:function(a){console.warn("THREE.WebGLRenderer: .shadowMapCullFace is now .shadowMap.cullFace."),this.shadowMap.cullFace=a}}}),Object.defineProperties(aa.prototype,{cullFace:{get:function(){return this.renderReverseSided?2:1},set:function(a){a=1!==a,console.warn("WebGLRenderer: .shadowMap.cullFace is deprecated. Set .shadowMap.renderReverseSided to "+a+"."),this.renderReverseSided=a}}}),Object.defineProperties(f.prototype,{wrapS:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS},set:function(a){console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS=a}},wrapT:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT},set:function(a){console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT=a}},magFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter},set:function(a){console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter=a}},minFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter},set:function(a){console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter=a}},anisotropy:{get:function(){return console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy},set:function(a){console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy=a}},offset:{get:function(){return console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset},set:function(a){console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset=a}},repeat:{get:function(){return console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat},set:function(a){console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat=a}},format:{get:function(){return console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format},set:function(a){console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format=a}},type:{get:function(){return console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type},set:function(a){console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type=a}},generateMipmaps:{get:function(){return console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps},set:function(a){console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps=a}}}),Object.assign(fd.prototype,{load:function(a){console.warn("THREE.Audio: .load has been deprecated. Please use THREE.AudioLoader.");var b=this;return(new bd).load(a,function(a){b.setBuffer(a)}),this}}),Object.assign(hd.prototype,{getData:function(a){return console.warn("THREE.AudioAnalyser: .getData() is now .getFrequencyData()."),this.getFrequencyData()}}),a.WebGLRenderTargetCube=g,a.WebGLRenderTarget=f,a.WebGLRenderer=Va,a.ShaderLib=ce,a.UniformsLib=be,a.UniformsUtils=$d,a.ShaderChunk=_d,a.FogExp2=Wa,a.Fog=Xa,a.Scene=Ya,a.LensFlare=Za,a.Sprite=_a,a.LOD=ab,a.SkinnedMesh=eb,a.Skeleton=cb,a.Bone=db,a.Mesh=qa,a.LineSegments=hb,a.Line=gb,a.Points=jb,a.Group=kb,a.VideoTexture=lb,a.DataTexture=bb,a.CompressedTexture=mb,a.CubeTexture=k,a.CanvasTexture=nb,a.DepthTexture=ob,a.TextureIdCount=function(){return Ud++},a.Texture=d,a.MaterialIdCount=function(){return de++},a.CompressedTextureLoader=jc,a.BinaryTextureLoader=kc,a.DataTextureLoader=kc,a.CubeTextureLoader=mc,a.TextureLoader=nc,a.ObjectLoader=Pc,a.MaterialLoader=Lc,a.BufferGeometryLoader=Mc,a.DefaultLoadingManager=le,a.LoadingManager=hc,a.JSONLoader=Oc,a.ImageLoader=lc,a.FontLoader=_c,a.XHRLoader=ic,a.Loader=Nc,a.Cache=ke,a.AudioLoader=bd,a.SpotLightShadow=rc,a.SpotLight=sc,a.PointLight=tc,a.HemisphereLight=pc,a.DirectionalLightShadow=uc,a.DirectionalLight=vc,a.AmbientLight=wc,a.LightShadow=qc,a.Light=oc,a.StereoCamera=cd,a.PerspectiveCamera=ua,a.OrthographicCamera=va,a.CubeCamera=dd,a.Camera=ta,a.AudioListener=ed,a.PositionalAudio=gd,a.getAudioContext=ad,a.AudioAnalyser=hd,a.Audio=fd,a.VectorKeyframeTrack=Cc,a.StringKeyframeTrack=Gc,a.QuaternionKeyframeTrack=Ec,a.NumberKeyframeTrack=Fc,a.ColorKeyframeTrack=Ic,a.BooleanKeyframeTrack=Hc,a.PropertyMixer=id,a.PropertyBinding=jd,a.KeyframeTrack=Jc,a.AnimationUtils=me,a.AnimationObjectGroup=kd,a.AnimationMixer=md,a.AnimationClip=Kc,a.Uniform=nd,a.InstancedBufferGeometry=od,a.BufferGeometry=pa,a.GeometryIdCount=function(){return fe++},a.Geometry=na,a.InterleavedBufferAttribute=pd,a.InstancedInterleavedBuffer=rd,a.InterleavedBuffer=qd,a.InstancedBufferAttribute=sd,a.DynamicBufferAttribute=function(a,b){return console.warn("THREE.DynamicBufferAttribute has been removed. Use new THREE.BufferAttribute().setDynamic( true ) instead."),new ja(a,b).setDynamic(!0)},a.Float64Attribute=function(a,b){return new ja(new Float64Array(a),b)},a.Float32Attribute=ma,a.Uint32Attribute=la,a.Int32Attribute=function(a,b){return new ja(new Int32Array(a),b)},a.Uint16Attribute=ka,a.Int16Attribute=function(a,b){return new ja(new Int16Array(a),b)},a.Uint8ClampedAttribute=function(a,b){return new ja(new Uint8ClampedArray(a),b)},a.Uint8Attribute=function(a,b){return new ja(new Uint8Array(a),b)},a.Int8Attribute=function(a,b){return new ja(new Int8Array(a),b)},a.BufferAttribute=ja,a.Face3=ha,a.Object3DIdCount=function(){return ee++},a.Object3D=ea,a.Raycaster=td,a.Layers=da,a.EventDispatcher=b,a.Clock=wd,a.QuaternionLinearInterpolant=Dc,a.LinearInterpolant=zc,a.DiscreteInterpolant=Ac,a.CubicInterpolant=yc,a.Interpolant=xc,a.Triangle=ga,a.Spline=function(a){function b(a,b,c,d,e,f,g){return a=.5*(c-a),d=.5*(d-b),(2*(b-c)+a+d)*g+(-3*(b-c)-2*a-d)*f+a*e+b}this.points=a;var c,d,e,f,g,h,j,k,l,m=[],n={x:0,y:0,z:0};this.initFromArray=function(a){this.points=[];for(var b=0;b<a.length;b++)this.points[b]={x:a[b][0],y:a[b][1],z:a[b][2]}},this.getPoint=function(a){return c=(this.points.length-1)*a,d=Math.floor(c),e=c-d,m[0]=0===d?d:d-1,m[1]=d,m[2]=d>this.points.length-2?this.points.length-1:d+1,m[3]=d>this.points.length-3?this.points.length-1:d+2,h=this.points[m[0]],j=this.points[m[1]],k=this.points[m[2]],l=this.points[m[3]],f=e*e,g=e*f,n.x=b(h.x,j.x,k.x,l.x,e,f,g),n.y=b(h.y,j.y,k.y,l.y,e,f,g),n.z=b(h.z,j.z,k.z,l.z,e,f,g),n},this.getControlPointsArray=function(){var a,b,c=this.points.length,d=[];for(a=0;a<c;a++)b=this.points[a],d[a]=[b.x,b.y,b.z];return d},this.getLength=function(a){var b,c,d,e=0,f=new i,g=new i,h=[],j=0;for(h[0]=0,a||(a=100),c=this.points.length*a,f.copy(this.points[0]),a=1;a<c;a++)b=a/c,d=this.getPoint(b),g.copy(d),j+=g.distanceTo(f),f.copy(d),b*=this.points.length-1,(b=Math.floor(b))!==e&&(h[b]=j,e=b);return h[h.length]=j,{chunks:h,total:j}},this.reparametrizeByArcLength=function(a){var b,c,d,e,f,g,h=[],j=new i,k=this.getLength();for(h.push(j.copy(this.points[0]).clone()),b=1;b<this.points.length;b++){for(c=k.chunks[b]-k.chunks[b-1],g=Math.ceil(a*c/k.total),e=(b-1)/(this.points.length-1),f=b/(this.points.length-1),c=1;c<g-1;c++)d=e+1/g*c*(f-e),d=this.getPoint(d),h.push(j.copy(d).clone());h.push(j.copy(this.points[b]).clone())}this.points=h}},a.Math=Td,a.Spherical=xd,a.Plane=$,a.Frustum=_,a.Sphere=Y,a.Ray=ba,a.Matrix4=j,a.Matrix3=Z,a.Box3=X,a.Box2=R,a.Line3=fa,a.Euler=ca,a.Vector4=e,a.Vector3=i,a.Vector2=c,a.Quaternion=h,a.ColorKeywords=ae,a.Color=Q,a.MorphBlendMesh=yd,a.ImmediateRenderObject=zd,a.VertexNormalsHelper=Ad,a.SpotLightHelper=Bd,a.SkeletonHelper=Cd,a.PointLightHelper=Dd,a.HemisphereLightHelper=Ed,a.GridHelper=Fd,a.FaceNormalsHelper=Gd,a.DirectionalLightHelper=Hd,a.CameraHelper=Id,a.BoundingBoxHelper=Jd,a.BoxHelper=Kd,a.ArrowHelper=Ld,a.AxisHelper=Md,a.ClosedSplineCurve3=Nd,a.CatmullRomCurve3=te,a.SplineCurve3=ue,a.CubicBezierCurve3=ve,a.QuadraticBezierCurve3=we,a.LineCurve3=xe,a.ArcCurve=Od,a.EllipseCurve=Tc,a.SplineCurve=Uc,a.CubicBezierCurve=Vc,a.QuadraticBezierCurve=Wc,a.LineCurve=Rc,a.Shape=Xc,a.ShapePath=Zc,a.Path=Yc,a.Font=$c,a.CurvePath=Sc,a.Curve=Qc,a.ShapeUtils=he,a.SceneUtils={createMultiMaterialObject:function(a,b){for(var c=new kb,d=0,e=b.length;d<e;d++)c.add(new qa(a,b[d]));return c},detach:function(a,b,c){a.applyMatrix(b.matrixWorld),b.remove(a),c.add(a)},attach:function(a,b,c){var d=new j;d.getInverse(c.matrixWorld),a.applyMatrix(d),b.remove(a),c.add(a)}},a.CurveUtils=oe,a.WireframeGeometry=pb,a.ParametricGeometry=rb;a.ParametricBufferGeometry=qb,a.TetrahedronGeometry=ub,a.TetrahedronBufferGeometry=tb,a.OctahedronGeometry=wb,a.OctahedronBufferGeometry=vb,a.IcosahedronGeometry=yb,a.IcosahedronBufferGeometry=xb,a.DodecahedronGeometry=Ab,a.DodecahedronBufferGeometry=zb,a.PolyhedronGeometry=Bb,a.PolyhedronBufferGeometry=sb,a.TubeGeometry=Db,a.TubeBufferGeometry=Cb,a.TorusKnotGeometry=Fb,a.TorusKnotBufferGeometry=Eb,a.TorusGeometry=Hb,a.TorusBufferGeometry=Gb,a.TextGeometry=Jb,a.SphereBufferGeometry=Kb,a.SphereGeometry=Lb,a.RingGeometry=Nb,a.RingBufferGeometry=Mb,a.PlaneBufferGeometry=sa,a.PlaneGeometry=Ob,a.LatheGeometry=Qb,a.LatheBufferGeometry=Pb,a.ShapeGeometry=Rb,a.ExtrudeGeometry=Ib,a.EdgesGeometry=Sb,a.ConeGeometry=Vb,a.ConeBufferGeometry=Wb,a.CylinderGeometry=Ub,a.CylinderBufferGeometry=Tb,a.CircleBufferGeometry=Xb,a.CircleGeometry=Yb,a.BoxBufferGeometry=ra,a.BoxGeometry=Zb,a.ShadowMaterial=$b,a.SpriteMaterial=$a,a.RawShaderMaterial=_b,a.ShaderMaterial=V,a.PointsMaterial=ib,a.MultiMaterial=ac,a.MeshPhysicalMaterial=cc,a.MeshStandardMaterial=bc,a.MeshPhongMaterial=dc,a.MeshNormalMaterial=ec,a.MeshLambertMaterial=fc,a.MeshDepthMaterial=W,a.MeshBasicMaterial=ia,a.LineDashedMaterial=gc,a.LineBasicMaterial=fb,a.Material=U,a.REVISION="82",a.MOUSE={LEFT:0,MIDDLE:1,RIGHT:2},a.CullFaceNone=0,a.CullFaceBack=1,a.CullFaceFront=2,a.CullFaceFrontBack=3,a.FrontFaceDirectionCW=0,a.FrontFaceDirectionCCW=1,a.BasicShadowMap=0,a.PCFShadowMap=1,a.PCFSoftShadowMap=2,a.FrontSide=0,a.BackSide=1,a.DoubleSide=2,a.FlatShading=1,a.SmoothShading=2,a.NoColors=0,a.FaceColors=1,a.VertexColors=2,a.NoBlending=0,a.NormalBlending=1,a.AdditiveBlending=2,a.SubtractiveBlending=3,a.MultiplyBlending=4,a.CustomBlending=5,a.BlendingMode=Pd, a.AddEquation=100,a.SubtractEquation=101,a.ReverseSubtractEquation=102,a.MinEquation=103,a.MaxEquation=104,a.ZeroFactor=200,a.OneFactor=201,a.SrcColorFactor=202,a.OneMinusSrcColorFactor=203,a.SrcAlphaFactor=204,a.OneMinusSrcAlphaFactor=205,a.DstAlphaFactor=206,a.OneMinusDstAlphaFactor=207,a.DstColorFactor=208,a.OneMinusDstColorFactor=209,a.SrcAlphaSaturateFactor=210,a.NeverDepth=0,a.AlwaysDepth=1,a.LessDepth=2,a.LessEqualDepth=3,a.EqualDepth=4,a.GreaterEqualDepth=5,a.GreaterDepth=6,a.NotEqualDepth=7,a.MultiplyOperation=0,a.MixOperation=1,a.AddOperation=2,a.NoToneMapping=0,a.LinearToneMapping=1,a.ReinhardToneMapping=2,a.Uncharted2ToneMapping=3,a.CineonToneMapping=4,a.UVMapping=300,a.CubeReflectionMapping=301,a.CubeRefractionMapping=302,a.EquirectangularReflectionMapping=303,a.EquirectangularRefractionMapping=304,a.SphericalReflectionMapping=305,a.CubeUVReflectionMapping=306,a.CubeUVRefractionMapping=307,a.TextureMapping=Qd,a.RepeatWrapping=1e3,a.ClampToEdgeWrapping=1001,a.MirroredRepeatWrapping=1002,a.TextureWrapping=Rd,a.NearestFilter=1003,a.NearestMipMapNearestFilter=1004,a.NearestMipMapLinearFilter=1005,a.LinearFilter=1006,a.LinearMipMapNearestFilter=1007,a.LinearMipMapLinearFilter=1008,a.TextureFilter=Sd,a.UnsignedByteType=1009,a.ByteType=1010,a.ShortType=1011,a.UnsignedShortType=1012,a.IntType=1013,a.UnsignedIntType=1014,a.FloatType=1015,a.HalfFloatType=1016,a.UnsignedShort4444Type=1017,a.UnsignedShort5551Type=1018,a.UnsignedShort565Type=1019,a.UnsignedInt248Type=1020,a.AlphaFormat=1021,a.RGBFormat=1022,a.RGBAFormat=1023,a.LuminanceFormat=1024,a.LuminanceAlphaFormat=1025,a.RGBEFormat=1023,a.DepthFormat=1026,a.DepthStencilFormat=1027,a.RGB_S3TC_DXT1_Format=2001,a.RGBA_S3TC_DXT1_Format=2002,a.RGBA_S3TC_DXT3_Format=2003,a.RGBA_S3TC_DXT5_Format=2004,a.RGB_PVRTC_4BPPV1_Format=2100,a.RGB_PVRTC_2BPPV1_Format=2101,a.RGBA_PVRTC_4BPPV1_Format=2102,a.RGBA_PVRTC_2BPPV1_Format=2103,a.RGB_ETC1_Format=2151,a.LoopOnce=2200,a.LoopRepeat=2201,a.LoopPingPong=2202,a.InterpolateDiscrete=2300,a.InterpolateLinear=2301,a.InterpolateSmooth=2302,a.ZeroCurvatureEnding=2400,a.ZeroSlopeEnding=2401,a.WrapAroundEnding=2402,a.TrianglesDrawMode=0,a.TriangleStripDrawMode=1,a.TriangleFanDrawMode=2,a.LinearEncoding=3e3,a.sRGBEncoding=3001,a.GammaEncoding=3007,a.RGBEEncoding=3002,a.LogLuvEncoding=3003,a.RGBM7Encoding=3004,a.RGBM16Encoding=3005,a.RGBDEncoding=3006,a.BasicDepthPacking=3200,a.RGBADepthPacking=3201,a.CubeGeometry=Zb,a.Face4=function(a,b,c,d,e,f,g){return console.warn("THREE.Face4 has been removed. A THREE.Face3 will be created instead."),new ha(a,b,c,e,f,g)},a.LineStrip=0,a.LinePieces=1,a.MeshFaceMaterial=ac,a.PointCloud=function(a,b){return console.warn("THREE.PointCloud has been renamed to THREE.Points."),new jb(a,b)},a.Particle=_a,a.ParticleSystem=function(a,b){return console.warn("THREE.ParticleSystem has been renamed to THREE.Points."),new jb(a,b)},a.PointCloudMaterial=function(a){return console.warn("THREE.PointCloudMaterial has been renamed to THREE.PointsMaterial."),new ib(a)},a.ParticleBasicMaterial=function(a){return console.warn("THREE.ParticleBasicMaterial has been renamed to THREE.PointsMaterial."),new ib(a)},a.ParticleSystemMaterial=function(a){return console.warn("THREE.ParticleSystemMaterial has been renamed to THREE.PointsMaterial."),new ib(a)},a.Vertex=function(a,b,c){return console.warn("THREE.Vertex has been removed. Use THREE.Vector3 instead."),new i(a,b,c)},a.EdgesHelper=function(a,b){return console.warn("THREE.EdgesHelper has been removed. Use THREE.EdgesGeometry instead."),new hb(new Sb(a.geometry),new fb({color:void 0!==b?b:16777215}))},a.WireframeHelper=function(a,b){return console.warn("THREE.WireframeHelper has been removed. Use THREE.WireframeGeometry instead."),new hb(new pb(a.geometry),new fb({color:void 0!==b?b:16777215}))},a.GeometryUtils={merge:function(a,b,c){console.warn("THREE.GeometryUtils: .merge() has been moved to Geometry. Use geometry.merge( geometry2, matrix, materialIndexOffset ) instead.");var d;b.isMesh&&(b.matrixAutoUpdate&&b.updateMatrix(),d=b.matrix,b=b.geometry),a.merge(b,d,c)},center:function(a){return console.warn("THREE.GeometryUtils: .center() has been moved to Geometry. Use geometry.center() instead."),a.center()}},a.ImageUtils={crossOrigin:void 0,loadTexture:function(a,b,c,d){console.warn("THREE.ImageUtils.loadTexture has been deprecated. Use THREE.TextureLoader() instead.");var e=new nc;return e.setCrossOrigin(this.crossOrigin),a=e.load(a,c,void 0,d),b&&(a.mapping=b),a},loadTextureCube:function(a,b,c,d){console.warn("THREE.ImageUtils.loadTextureCube has been deprecated. Use THREE.CubeTextureLoader() instead.");var e=new mc;return e.setCrossOrigin(this.crossOrigin),a=e.load(a,c,void 0,d),b&&(a.mapping=b),a},loadCompressedTexture:function(){console.error("THREE.ImageUtils.loadCompressedTexture has been removed. Use THREE.DDSLoader instead.")},loadCompressedTextureCube:function(){console.error("THREE.ImageUtils.loadCompressedTextureCube has been removed. Use THREE.DDSLoader instead.")}},a.Projector=function(){console.error("THREE.Projector has been moved to /examples/js/renderers/Projector.js."),this.projectVector=function(a,b){console.warn("THREE.Projector: .projectVector() is now vector.project()."),a.project(b)},this.unprojectVector=function(a,b){console.warn("THREE.Projector: .unprojectVector() is now vector.unproject()."),a.unproject(b)},this.pickingRay=function(a,b){console.error("THREE.Projector: .pickingRay() is now raycaster.setFromCamera().")}},a.CanvasRenderer=function(){console.error("THREE.CanvasRenderer has been moved to /examples/js/renderers/CanvasRenderer.js"),this.domElement=document.createElementNS("http://www.w3.org/1999/xhtml","canvas"),this.clear=function(){},this.render=function(){},this.setClearColor=function(){},this.setSize=function(){}};Object.defineProperty(a,"__esModule",{value:!0}),Object.defineProperty(a,"AudioContext",{get:function(){return a.getAudioContext()}})}),THREE.RenderableObject=function(){this.id=0,this.object=null,this.z=0,this.renderOrder=0},THREE.RenderableFace=function(){this.id=0,this.v1=new THREE.RenderableVertex,this.v2=new THREE.RenderableVertex,this.v3=new THREE.RenderableVertex,this.normalModel=new THREE.Vector3,this.vertexNormalsModel=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3],this.vertexNormalsLength=0,this.color=new THREE.Color,this.material=null,this.uvs=[new THREE.Vector2,new THREE.Vector2,new THREE.Vector2],this.z=0,this.renderOrder=0},THREE.RenderableVertex=function(){this.position=new THREE.Vector3,this.positionWorld=new THREE.Vector3,this.positionScreen=new THREE.Vector4,this.visible=!0},THREE.RenderableVertex.prototype.copy=function(a){this.positionWorld.copy(a.positionWorld),this.positionScreen.copy(a.positionScreen)},THREE.RenderableLine=function(){this.id=0,this.v1=new THREE.RenderableVertex,this.v2=new THREE.RenderableVertex,this.vertexColors=[new THREE.Color,new THREE.Color],this.material=null,this.z=0,this.renderOrder=0},THREE.RenderableSprite=function(){this.id=0,this.object=null,this.x=0,this.y=0,this.z=0,this.rotation=0,this.scale=new THREE.Vector2,this.material=null,this.renderOrder=0},THREE.Projector=function(){function a(){if(i===t){var a=new THREE.RenderableObject;return s.push(a),t++,i++,a}return s[i++]}function b(){if(k===v){var a=new THREE.RenderableVertex;return u.push(a),v++,k++,a}return u[k++]}function c(){if(m===x){var a=new THREE.RenderableFace;return w.push(a),x++,m++,a}return w[m++]}function d(){if(o===z){var a=new THREE.RenderableLine;return y.push(a),z++,o++,a}return y[o++]}function e(){if(q===B){var a=new THREE.RenderableSprite;return A.push(a),B++,q++,a}return A[q++]}function f(a,b){return a.renderOrder!==b.renderOrder?a.renderOrder-b.renderOrder:a.z!==b.z?b.z-a.z:a.id!==b.id?a.id-b.id:0}function g(a,b){var c=0,d=1,e=a.z+a.w,f=b.z+b.w,g=-a.z+a.w,h=-b.z+b.w;return e>=0&&f>=0&&g>=0&&h>=0||!(e<0&&f<0||g<0&&h<0)&&(e<0?c=Math.max(c,e/(e-f)):f<0&&(d=Math.min(d,e/(e-f))),g<0?c=Math.max(c,g/(g-h)):h<0&&(d=Math.min(d,g/(g-h))),!(d<c)&&(a.lerp(b,c),b.lerp(a,1-d),!0))}var h,i,j,k,l,m,n,o,p,q,r,s=[],t=0,u=[],v=0,w=[],x=0,y=[],z=0,A=[],B=0,C={objects:[],lights:[],elements:[]},D=new THREE.Vector3,E=new THREE.Vector4,F=new THREE.Box3(new THREE.Vector3(-1,-1,-1),new THREE.Vector3(1,1,1)),G=new THREE.Box3,H=new Array(3),I=(new Array(4),new THREE.Matrix4),J=new THREE.Matrix4,K=new THREE.Matrix4,L=new THREE.Matrix3,M=new THREE.Frustum,N=new THREE.Vector4,O=new THREE.Vector4;this.projectVector=function(a,b){console.warn("THREE.Projector: .projectVector() is now vector.project()."),a.project(b)},this.unprojectVector=function(a,b){console.warn("THREE.Projector: .unprojectVector() is now vector.unproject()."),a.unproject(b)},this.pickingRay=function(a,b){console.error("THREE.Projector: .pickingRay() is now raycaster.setFromCamera().")};var P=function(){function a(a){s=a,t=s.material,v.getNormalMatrix(s.matrixWorld),p.length=0,q.length=0}function e(a){var b=a.position,c=a.positionWorld,d=a.positionScreen;c.copy(b).applyMatrix4(r),d.copy(c).applyMatrix4(J);var e=1/d.w;d.x*=e,d.y*=e,d.z*=e,a.visible=d.x>=-1&&d.x<=1&&d.y>=-1&&d.y<=1&&d.z>=-1&&d.z<=1}function f(a,c,d){j=b(),j.position.set(a,c,d),e(j)}function g(a,b,c){p.push(a,b,c)}function h(a,b){q.push(a,b)}function i(a,b,c){return!0===a.visible||!0===b.visible||!0===c.visible||(H[0]=a.positionScreen,H[1]=b.positionScreen,H[2]=c.positionScreen,F.intersectsBox(G.setFromPoints(H)))}function k(a,b,c){return(c.positionScreen.x-a.positionScreen.x)*(b.positionScreen.y-a.positionScreen.y)-(c.positionScreen.y-a.positionScreen.y)*(b.positionScreen.x-a.positionScreen.x)<0}function m(a,b){var c=u[a],e=u[b];n=d(),n.id=s.id,n.v1.copy(c),n.v2.copy(e),n.z=(c.positionScreen.z+e.positionScreen.z)/2,n.renderOrder=s.renderOrder,n.material=s.material,C.elements.push(n)}function o(a,b,d){var e=u[a],f=u[b],g=u[d];if(!1!==i(e,f,g)&&(t.side===THREE.DoubleSide||!0===k(e,f,g))){l=c(),l.id=s.id,l.v1.copy(e),l.v2.copy(f),l.v3.copy(g),l.z=(e.positionScreen.z+f.positionScreen.z+g.positionScreen.z)/3,l.renderOrder=s.renderOrder,l.normalModel.fromArray(p,3*a),l.normalModel.applyMatrix3(v).normalize();for(var h=0;h<3;h++){var j=l.vertexNormalsModel[h];j.fromArray(p,3*arguments[h]),j.applyMatrix3(v).normalize();l.uvs[h].fromArray(q,2*arguments[h])}l.vertexNormalsLength=3,l.material=s.material,C.elements.push(l)}}var p=[],q=[],s=null,t=null,v=new THREE.Matrix3;return{setObject:a,projectVertex:e,checkTriangleVisibility:i,checkBackfaceCulling:k,pushVertex:f,pushNormal:g,pushUv:h,pushLine:m,pushTriangle:o}},Q=new P;this.projectScene=function(j,s,t,v){function w(b){h=a(),h.id=b.id,h.object=b,D.setFromMatrixPosition(b.matrixWorld),D.applyProjection(J),h.z=D.z,h.renderOrder=b.renderOrder,C.objects.push(h)}m=0,o=0,q=0,C.elements.length=0,!0===j.autoUpdate&&j.updateMatrixWorld(),null===s.parent&&s.updateMatrixWorld(),I.copy(s.matrixWorldInverse.getInverse(s.matrixWorld)),J.multiplyMatrices(s.projectionMatrix,I),M.setFromMatrix(J),i=0,C.objects.length=0,C.lights.length=0,j.traverseVisible(function(a){if(a instanceof THREE.Light)C.lights.push(a);else if(a instanceof THREE.Mesh||a instanceof THREE.Line){if(!1===a.material.visible)return;if(!0===a.frustumCulled&&!1===M.intersectsObject(a))return;w(a)}else if(a instanceof THREE.Sprite){if(!1===a.material.visible)return;if(!0===a.frustumCulled&&!1===M.intersectsSprite(a))return;w(a)}}),!0===t&&C.objects.sort(f);for(var x=0,y=C.objects.length;x<y;x++){var z=C.objects[x].object,A=z.geometry;if(Q.setObject(z),r=z.matrixWorld,k=0,z instanceof THREE.Mesh){if(A instanceof THREE.BufferGeometry){var B=A.attributes,F=A.groups;if(void 0===B.position)continue;for(var G=B.position.array,H=0,P=G.length;H<P;H+=3)Q.pushVertex(G[H],G[H+1],G[H+2]);if(void 0!==B.normal)for(var R=B.normal.array,H=0,P=R.length;H<P;H+=3)Q.pushNormal(R[H],R[H+1],R[H+2]);if(void 0!==B.uv)for(var S=B.uv.array,H=0,P=S.length;H<P;H+=2)Q.pushUv(S[H],S[H+1]);if(null!==A.index){var T=A.index.array;if(F.length>0)for(var x=0;x<F.length;x++)for(var U=F[x],H=U.start,P=U.start+U.count;H<P;H+=3)Q.pushTriangle(T[H],T[H+1],T[H+2]);else for(var H=0,P=T.length;H<P;H+=3)Q.pushTriangle(T[H],T[H+1],T[H+2])}else for(var H=0,P=G.length/3;H<P;H+=3)Q.pushTriangle(H,H+1,H+2)}else if(A instanceof THREE.Geometry){var V=A.vertices,W=A.faces,X=A.faceVertexUvs[0];L.getNormalMatrix(r);for(var Y=z.material,Z=Y instanceof THREE.MultiMaterial,$=!0===Z?z.material:null,_=0,aa=V.length;_<aa;_++){var ba=V[_];if(D.copy(ba),!0===Y.morphTargets)for(var ca=A.morphTargets,da=z.morphTargetInfluences,ea=0,fa=ca.length;ea<fa;ea++){var ga=da[ea];if(0!==ga){var ha=ca[ea],ia=ha.vertices[_];D.x+=(ia.x-ba.x)*ga,D.y+=(ia.y-ba.y)*ga,D.z+=(ia.z-ba.z)*ga}}Q.pushVertex(D.x,D.y,D.z)}for(var ja=0,ka=W.length;ja<ka;ja++){var la=W[ja];if(void 0!==(Y=!0===Z?$.materials[la.materialIndex]:z.material)){var ma=Y.side,na=u[la.a],oa=u[la.b],pa=u[la.c];if(!1!==Q.checkTriangleVisibility(na,oa,pa)){var qa=Q.checkBackfaceCulling(na,oa,pa);if(ma!==THREE.DoubleSide){if(ma===THREE.FrontSide&&!1===qa)continue;if(ma===THREE.BackSide&&!0===qa)continue}l=c(),l.id=z.id,l.v1.copy(na),l.v2.copy(oa),l.v3.copy(pa),l.normalModel.copy(la.normal),!1!==qa||ma!==THREE.BackSide&&ma!==THREE.DoubleSide||l.normalModel.negate(),l.normalModel.applyMatrix3(L).normalize();for(var ra=la.vertexNormals,sa=0,ta=Math.min(ra.length,3);sa<ta;sa++){var ua=l.vertexNormalsModel[sa];ua.copy(ra[sa]),!1!==qa||ma!==THREE.BackSide&&ma!==THREE.DoubleSide||ua.negate(),ua.applyMatrix3(L).normalize()}l.vertexNormalsLength=ra.length;var va=X[ja];if(void 0!==va)for(var wa=0;wa<3;wa++)l.uvs[wa].copy(va[wa]);l.color=la.color,l.material=Y,l.z=(na.positionScreen.z+oa.positionScreen.z+pa.positionScreen.z)/3,l.renderOrder=z.renderOrder,C.elements.push(l)}}}}}else if(z instanceof THREE.Line){if(A instanceof THREE.BufferGeometry){var B=A.attributes;if(void 0!==B.position){for(var G=B.position.array,H=0,P=G.length;H<P;H+=3)Q.pushVertex(G[H],G[H+1],G[H+2]);if(null!==A.index)for(var T=A.index.array,H=0,P=T.length;H<P;H+=2)Q.pushLine(T[H],T[H+1]);else for(var xa=z instanceof THREE.LineSegments?2:1,H=0,P=G.length/3-1;H<P;H+=xa)Q.pushLine(H,H+1)}}else if(A instanceof THREE.Geometry){K.multiplyMatrices(J,r);var V=z.geometry.vertices;if(0===V.length)continue;na=b(),na.positionScreen.copy(V[0]).applyMatrix4(K);for(var xa=z instanceof THREE.LineSegments?2:1,_=1,aa=V.length;_<aa;_++)na=b(),na.positionScreen.copy(V[_]).applyMatrix4(K),(_+1)%xa>0||(oa=u[k-2],N.copy(na.positionScreen),O.copy(oa.positionScreen),!0===g(N,O)&&(N.multiplyScalar(1/N.w),O.multiplyScalar(1/O.w),n=d(),n.id=z.id,n.v1.positionScreen.copy(N),n.v2.positionScreen.copy(O),n.z=Math.max(N.z,O.z),n.renderOrder=z.renderOrder,n.material=z.material,z.material.vertexColors===THREE.VertexColors&&(n.vertexColors[0].copy(z.geometry.colors[_]),n.vertexColors[1].copy(z.geometry.colors[_-1])),C.elements.push(n)))}}else if(z instanceof THREE.Sprite){E.set(r.elements[12],r.elements[13],r.elements[14],1),E.applyMatrix4(J);var ya=1/E.w;E.z*=ya,E.z>=-1&&E.z<=1&&(p=e(),p.id=z.id,p.x=E.x*ya,p.y=E.y*ya,p.z=E.z,p.renderOrder=z.renderOrder,p.object=z,p.rotation=z.rotation,p.scale.x=z.scale.x*Math.abs(p.x-(E.x+s.projectionMatrix.elements[0])/(E.w+s.projectionMatrix.elements[12])),p.scale.y=z.scale.y*Math.abs(p.y-(E.y+s.projectionMatrix.elements[5])/(E.w+s.projectionMatrix.elements[13])),p.material=z.material,C.elements.push(p))}}return!0===v&&C.elements.sort(f),C}},THREE.SpriteCanvasMaterial=function(a){THREE.Material.call(this),this.type="SpriteCanvasMaterial",this.color=new THREE.Color(16777215),this.program=function(a,b){},this.setValues(a)},THREE.SpriteCanvasMaterial.prototype=Object.create(THREE.Material.prototype),THREE.SpriteCanvasMaterial.prototype.constructor=THREE.SpriteCanvasMaterial,THREE.SpriteCanvasMaterial.prototype.clone=function(){var a=new THREE.SpriteCanvasMaterial;return a.copy(this),a.color.copy(this.color),a.program=this.program,a},THREE.CanvasRenderer=function(a){function b(){ra.setRGB(0,0,0),sa.setRGB(0,0,0),ta.setRGB(0,0,0);for(var a=0,b=w.length;a<b;a++){var c=w[a],d=c.color;c instanceof THREE.AmbientLight?ra.add(d):c instanceof THREE.DirectionalLight?sa.add(d):c instanceof THREE.PointLight&&ta.add(d)}}function c(a,b,c){for(var d=0,e=w.length;d<e;d++){var f=w[d];if(ma.copy(f.color),f instanceof THREE.DirectionalLight){var g=ua.setFromMatrixPosition(f.matrixWorld).normalize(),h=b.dot(g);if(h<=0)continue;h*=f.intensity,c.add(ma.multiplyScalar(h))}else if(f instanceof THREE.PointLight){var g=ua.setFromMatrixPosition(f.matrixWorld),h=b.dot(ua.subVectors(g,a).normalize());if(h<=0)continue;if(0==(h*=0==f.distance?1:1-Math.min(a.distanceTo(g)/f.distance,1)))continue;h*=f.intensity,c.add(ma.multiplyScalar(h))}}}function d(a,b,c){m(c.opacity),n(c.blending);var d=b.scale.x*T,e=b.scale.y*U,f=.5*Math.sqrt(d*d+e*e);if(qa.min.set(a.x-f,a.y-f),qa.max.set(a.x+f,a.y+f),c instanceof THREE.SpriteMaterial){var g=c.map;if(null!==g){var h=na[g.id];if(void 0!==h&&h.version===g.version||(h=j(g),na[g.id]=h),void 0!==h.canvas){s(h.canvas);var i=g.image,k=i.width*g.offset.x,l=i.height*g.offset.y,o=i.width*g.repeat.x,p=i.height*g.repeat.y,q=d/o,t=e/p;$.save(),$.translate(a.x,a.y),0!==c.rotation&&$.rotate(c.rotation),$.translate(-d/2,-e/2),$.scale(q,t),$.translate(-k,-l),$.fillRect(k,l,o,p),$.restore()}}else s(c.color.getStyle()),$.save(),$.translate(a.x,a.y),0!==c.rotation&&$.rotate(c.rotation),$.scale(d,-e),$.fillRect(-.5,-.5,1,1),$.restore()}else c instanceof THREE.SpriteCanvasMaterial&&(r(c.color.getStyle()),s(c.color.getStyle()),$.save(),$.translate(a.x,a.y),0!==c.rotation&&$.rotate(c.rotation),$.scale(d,e),c.program($),$.restore())}function e(a,b,c,d){if(m(d.opacity),n(d.blending),$.beginPath(),$.moveTo(a.positionScreen.x,a.positionScreen.y),$.lineTo(b.positionScreen.x,b.positionScreen.y),d instanceof THREE.LineBasicMaterial){if(o(d.linewidth),p(d.linecap),q(d.linejoin),d.vertexColors!==THREE.VertexColors)r(d.color.getStyle());else{var e=c.vertexColors[0].getStyle(),f=c.vertexColors[1].getStyle();if(e===f)r(e);else{try{var g=$.createLinearGradient(a.positionScreen.x,a.positionScreen.y,b.positionScreen.x,b.positionScreen.y);g.addColorStop(0,e),g.addColorStop(1,f)}catch(h){g=e}r(g)}}$.stroke(),qa.expandByScalar(2*d.linewidth)}else d instanceof THREE.LineDashedMaterial&&(o(d.linewidth),p(d.linecap),q(d.linejoin),r(d.color.getStyle()),t([d.dashSize,d.gapSize]),$.stroke(),qa.expandByScalar(2*d.linewidth),t([]))}function f(a,b,d,e,f,j,l,o){if(O.info.render.vertices+=3,O.info.render.faces++,m(o.opacity),n(o.blending),B=a.positionScreen.x,C=a.positionScreen.y,D=b.positionScreen.x,E=b.positionScreen.y,F=d.positionScreen.x,G=d.positionScreen.y,g(B,C,D,E,F,G),(o instanceof THREE.MeshLambertMaterial||o instanceof THREE.MeshPhongMaterial)&&null===o.map)ka.copy(o.color),la.copy(o.emissive),o.vertexColors===THREE.FaceColors&&ka.multiply(l.color),ja.copy(ra),va.copy(a.positionWorld).add(b.positionWorld).add(d.positionWorld).divideScalar(3),c(va,l.normalModel,ja),ja.multiply(ka).add(la),!0===o.wireframe?h(ja,o.wireframeLinewidth,o.wireframeLinecap,o.wireframeLinejoin):i(ja);else if(o instanceof THREE.MeshBasicMaterial||o instanceof THREE.MeshLambertMaterial||o instanceof THREE.MeshPhongMaterial)if(null!==o.map){var p=o.map.mapping;p===THREE.UVMapping&&(H=l.uvs,k(B,C,D,E,F,G,H[e].x,H[e].y,H[f].x,H[f].y,H[j].x,H[j].y,o.map))}else null!==o.envMap?o.envMap.mapping===THREE.SphericalReflectionMapping&&(wa.copy(l.vertexNormalsModel[e]).applyMatrix3(xa),I=.5*wa.x+.5,J=.5*wa.y+.5,wa.copy(l.vertexNormalsModel[f]).applyMatrix3(xa),K=.5*wa.x+.5,L=.5*wa.y+.5,wa.copy(l.vertexNormalsModel[j]).applyMatrix3(xa),M=.5*wa.x+.5,N=.5*wa.y+.5,k(B,C,D,E,F,G,I,J,K,L,M,N,o.envMap)):(ja.copy(o.color),o.vertexColors===THREE.FaceColors&&ja.multiply(l.color),!0===o.wireframe?h(ja,o.wireframeLinewidth,o.wireframeLinecap,o.wireframeLinejoin):i(ja));else o instanceof THREE.MeshNormalMaterial?(wa.copy(l.normalModel).applyMatrix3(xa),ja.setRGB(wa.x,wa.y,wa.z).multiplyScalar(.5).addScalar(.5),!0===o.wireframe?h(ja,o.wireframeLinewidth,o.wireframeLinecap,o.wireframeLinejoin):i(ja)):(ja.setRGB(1,1,1),!0===o.wireframe?h(ja,o.wireframeLinewidth,o.wireframeLinecap,o.wireframeLinejoin):i(ja))}function g(a,b,c,d,e,f){$.beginPath(),$.moveTo(a,b),$.lineTo(c,d),$.lineTo(e,f),$.closePath()}function h(a,b,c,d){o(b),p(c),q(d),r(a.getStyle()),$.stroke(),qa.expandByScalar(2*b)}function i(a){s(a.getStyle()),$.fill()}function j(a){if(0===a.version||a instanceof THREE.CompressedTexture||a instanceof THREE.DataTexture)return{canvas:void 0,version:a.version};var b=a.image;if(!1===b.complete)return{canvas:void 0,version:0};var c=document.createElement("canvas");c.width=b.width,c.height=b.height;var d=c.getContext("2d");d.setTransform(1,0,0,-1,0,b.height),d.drawImage(b,0,0);var e=a.wrapS===THREE.RepeatWrapping,f=a.wrapT===THREE.RepeatWrapping,g="no-repeat";!0===e&&!0===f?g="repeat":!0===e?g="repeat-x":!0===f&&(g="repeat-y");var h=$.createPattern(c,g);return a.onUpdate&&a.onUpdate(a),{canvas:h,version:a.version}}function k(a,b,c,d,e,f,g,h,i,k,l,m,n){var o=na[n.id];if(void 0!==o&&o.version===n.version||(o=j(n),na[n.id]=o),void 0===o.canvas)return s("rgba( 0, 0, 0, 1)"),void $.fill();s(o.canvas);var p,q,r,t,u,v,w,x,y=n.offset.x/n.repeat.x,z=n.offset.y/n.repeat.y,A=n.image.width*n.repeat.x,B=n.image.height*n.repeat.y;g=(g+y)*A,h=(h+z)*B,i=(i+y)*A,k=(k+z)*B,l=(l+y)*A,m=(m+z)*B,c-=a,d-=b,e-=a,f-=b,i-=g,k-=h,l-=g,m-=h,0!==(w=i*m-l*k)&&(x=1/w,p=(m*c-k*e)*x,q=(m*d-k*f)*x,r=(i*e-l*c)*x,t=(i*f-l*d)*x,u=a-p*g-r*h,v=b-q*g-t*h,$.save(),$.transform(p,q,r,t,u,v),$.fill(),$.restore())}function l(a,b,c){var d,e=b.x-a.x,f=b.y-a.y,g=e*e+f*f;0!==g&&(d=c/Math.sqrt(g),e*=d,f*=d,b.x+=e,b.y+=f,a.x-=e,a.y-=f)}function m(a){ba!==a&&($.globalAlpha=a,ba=a)}function n(a){ca!==a&&(a===THREE.NormalBlending?$.globalCompositeOperation="source-over":a===THREE.AdditiveBlending?$.globalCompositeOperation="lighter":a===THREE.SubtractiveBlending?$.globalCompositeOperation="darker":a===THREE.MultiplyBlending&&($.globalCompositeOperation="multiply"),ca=a)}function o(a){fa!==a&&($.lineWidth=a,fa=a)}function p(a){ga!==a&&($.lineCap=a,ga=a)}function q(a){ha!==a&&($.lineJoin=a,ha=a)}function r(a){da!==a&&($.strokeStyle=a,da=a)}function s(a){ea!==a&&($.fillStyle=a,ea=a)}function t(a){ia.length!==a.length&&($.setLineDash(a),ia=a)}console.log("THREE.CanvasRenderer",THREE.REVISION),a=a||{};var u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O=this,P=new THREE.Projector,Q=void 0!==a.canvas?a.canvas:document.createElement("canvas"),R=Q.width,S=Q.height,T=Math.floor(R/2),U=Math.floor(S/2),V=0,W=0,X=R,Y=S,Z=1,$=Q.getContext("2d",{alpha:!0===a.alpha}),_=new THREE.Color(0),aa=!0===a.alpha?0:1,ba=1,ca=0,da=null,ea=null,fa=null,ga=null,ha=null,ia=[],ja=(new THREE.RenderableVertex,new THREE.RenderableVertex,new THREE.Color),ka=(new THREE.Color,new THREE.Color,new THREE.Color,new THREE.Color,new THREE.Color),la=new THREE.Color,ma=new THREE.Color,na={},oa=new THREE.Box2,pa=new THREE.Box2,qa=new THREE.Box2,ra=new THREE.Color,sa=new THREE.Color,ta=new THREE.Color,ua=new THREE.Vector3,va=new THREE.Vector3,wa=new THREE.Vector3,xa=new THREE.Matrix3;void 0===$.setLineDash&&($.setLineDash=function(){}),this.domElement=Q,this.autoClear=!0,this.sortObjects=!0,this.sortElements=!0,this.info={render:{vertices:0,faces:0}},this.supportsVertexTextures=function(){},this.setFaceCulling=function(){},this.getContext=function(){return $},this.getContextAttributes=function(){return $.getContextAttributes()},this.getPixelRatio=function(){return Z},this.setPixelRatio=function(a){void 0!==a&&(Z=a)},this.setSize=function(a,b,c){R=a*Z,S=b*Z,Q.width=R,Q.height=S,T=Math.floor(R/2),U=Math.floor(S/2),!1!==c&&(Q.style.width=a+"px",Q.style.height=b+"px"),oa.min.set(-T,-U),oa.max.set(T,U),pa.min.set(-T,-U),pa.max.set(T,U),ba=1,ca=0,da=null,ea=null,fa=null,ga=null,ha=null,this.setViewport(0,0,a,b)},this.setViewport=function(a,b,c,d){V=a*Z,W=b*Z,X=c*Z,Y=d*Z},this.setScissor=function(){},this.setScissorTest=function(){},this.setClearColor=function(a,b){_.set(a),aa=void 0!==b?b:1,pa.min.set(-T,-U),pa.max.set(T,U)},this.setClearColorHex=function(a,b){console.warn("THREE.CanvasRenderer: .setClearColorHex() is being removed. Use .setClearColor() instead."),this.setClearColor(a,b)},this.getClearColor=function(){return _},this.getClearAlpha=function(){return aa},this.getMaxAnisotropy=function(){return 0},this.clear=function(){!1===pa.isEmpty()&&(pa.intersect(oa),pa.expandByScalar(2),pa.min.x=pa.min.x+T,pa.min.y=-pa.min.y+U,pa.max.x=pa.max.x+T,pa.max.y=-pa.max.y+U,aa<1&&$.clearRect(0|pa.min.x,0|pa.max.y,pa.max.x-pa.min.x|0,pa.min.y-pa.max.y|0),aa>0&&(n(THREE.NormalBlending),m(1),s("rgba("+Math.floor(255*_.r)+","+Math.floor(255*_.g)+","+Math.floor(255*_.b)+","+aa+")"),$.fillRect(0|pa.min.x,0|pa.max.y,pa.max.x-pa.min.x|0,pa.min.y-pa.max.y|0)),pa.makeEmpty())},this.clearColor=function(){},this.clearDepth=function(){},this.clearStencil=function(){},this.render=function(a,c){if(c instanceof THREE.Camera==!1)return void console.error("THREE.CanvasRenderer.render: camera is not an instance of THREE.Camera.");!0===this.autoClear&&this.clear(),O.info.render.vertices=0,O.info.render.faces=0,$.setTransform(X/R,0,0,-Y/S,V,S-W),$.translate(T,U),u=P.projectScene(a,c,this.sortObjects,this.sortElements),v=u.elements,w=u.lights,x=c,xa.getNormalMatrix(c.matrixWorldInverse),b();for(var g=0,h=v.length;g<h;g++){var i=v[g],j=i.material;if(void 0!==j&&0!==j.opacity){if(qa.makeEmpty(),i instanceof THREE.RenderableSprite)y=i,y.x*=T,y.y*=U,d(y,i,j);else if(i instanceof THREE.RenderableLine)y=i.v1,z=i.v2,y.positionScreen.x*=T,y.positionScreen.y*=U,z.positionScreen.x*=T,z.positionScreen.y*=U,qa.setFromPoints([y.positionScreen,z.positionScreen]),!0===oa.intersectsBox(qa)&&e(y,z,i,j);else if(i instanceof THREE.RenderableFace){if(y=i.v1,z=i.v2,A=i.v3,y.positionScreen.z<-1||y.positionScreen.z>1)continue;if(z.positionScreen.z<-1||z.positionScreen.z>1)continue;if(A.positionScreen.z<-1||A.positionScreen.z>1)continue;y.positionScreen.x*=T,y.positionScreen.y*=U,z.positionScreen.x*=T,z.positionScreen.y*=U,A.positionScreen.x*=T,A.positionScreen.y*=U,j.overdraw>0&&(l(y.positionScreen,z.positionScreen,j.overdraw),l(z.positionScreen,A.positionScreen,j.overdraw),l(A.positionScreen,y.positionScreen,j.overdraw)),qa.setFromPoints([y.positionScreen,z.positionScreen,A.positionScreen]),!0===oa.intersectsBox(qa)&&f(y,z,A,0,1,2,i,j)}pa.union(qa)}}$.setTransform(1,0,0,1,0,0)}};var GL=function(){"use strict";function a(a,c,d){for(var e in c)!d&&e in a&&b(a[e])||(a[e]=c[e]);return a}function b(a){return null!=a}function c(a){return 0==(a&a-1)}function d(a,b){var c=new Image;c.onload=function(){b(c)},c.src=a}function e(a,b){return"uniform{m}{d}{t}{a}".replace("{m}",/mat/i.test(a)?"Matrix":"").replace("{d}",/\d$/.test(a)?a.match(/\d$/)[0]:1).replace("{t}",/^[bis]/i.test(a)?"i":"f").replace("{a}",b>0?"v":"")}function f(a){return/\d/.test(a)?parseInt(a.match(/\d$/)[0],10):1}function g(a){return/^[bi]/i.test(a)?O:M}function h(a){return{}.toString.call(a).match(/\s([a-zA-Z0-9]+)/)[1].toLowerCase()}function i(a,b){var c=/\d+:(\d+)/g.exec(a);throw c&&(c=parseInt(c[1],10)-1,b=b.split("\n"),console.log("%c"+b.splice(0,c).join("\n")+"%c\n"+b[0]+"\n%c"+b.splice(1).join("\n"),"color: #ccc","color: red","color: #ccc")),a}var j={create:function(j){var O;if(j||(j=document.createElement("canvas")),!(O=j.getContext("webgl")||j.getContext("experimental-webgl")))throw"Error creating WebGL context";var P,Q={};return a(O,{bindings:Q,shader:function(a,b){return a=l+"\n"+a,O.shaderSource(P=O.createShader(b),a),O.compileShader(P),O.getShaderParameter(P,w)||i(O.getShaderInfoLog(P),a),P},program:function(b,c){var d,e,f,g,h,i,j,e=O.createProgram();if(e.state={},O.attachShader(e,O.shader(b,D)),O.attachShader(e,O.shader(c,v)),O.linkProgram(e),!O.getProgramParameter(e,H))throw O.getProgramInfoLog(e);for(g=[b,c].join("\n").replace(o,"");d=m.exec(g);)i=d[1],h=d[2],e[h]||(e[h]=O.attribute(e,h,i));for(;f=n.exec(g);)i=f[1],h=f[2],j=f[5],e[h]||(e[h]=O.uniform(e,h,i,j));return a(e,{on:function(){O.usedProgram!==e&&O.useProgram(O.usedProgram=e)},draw:function(a,b,c,d){e.on();var f,g,h,i=0;for(f in h=a.attributes)e[f]&&h[f].on(e[f]);for(f in h=a.uniforms)e[f]&&e[f].set(h[f]);for(f in h=a.textures)e[f]&&(h[f].on(i),e[f].set(i++));for(f in h=a.vertices)(g=h[f]).on(e[f]);a.indices?(a.indices.on(),O.drawElements(J,a.indices.length,x,0)):O.drawArrays(b||a.mode,c||0,d||g.length/e[f].size)}})},attribute:function(a,b,c){var d=O.getAttribLocation(a,b),e=g(c),h=f(c),i=!1;return{name:b,type:c,size:h,dataType:e,location:d,on:function(){i||O.enableVertexAttribArray(d),O.vertexAttribPointer(d,h,e,!1,0,0),i=!0},off:function(){O.disableVertexAttribArray(d)}}},uniform:function(a,b,c,d){var f=O.getUniformLocation(a,b),g=O[e(c,d)],h=a.state;return{name:b,type:c,span:d||1,location:f,setter:g,get:function(){return O.getUniform(a,f)},set:function(c){h[b]!==c&&(a.on(),g.apply(O,[f].concat(h[b]=c)))}}},buffer:function(b,c){var d=b===E?Float32Array:Uint16Array,e=O.createBuffer();return a(e,{length:0,on:function(a){Q[b]!==e&&(O.bindBuffer(b,Q[b]=e),a&&a.on())},fill:function(a,c){"array"==h(a)&&(a=new d(a)),O.bindBuffer(b,e),O.bufferData(b,a,c||G),e.length=a.length},push:function(a,c){isArray(a)&&(a=new d(a)),O.bindBuffer(b,e),O.bufferSubData(b,c,a)}}),c&&e.fill(c),e},vbo:function(a){return O.buffer(E,a)},ibo:function(a){return O.buffer(p,a)},fbo:function(b,c,d,e){var f=O.createFramebuffer(),g=O.texture();return a(f,{texture:g,set:function(a,b,c,d){f.on(),g.set(a,f.width=b,f.height=c,d),O.framebufferTexture2D(F,u,I,g,0),f.off()},on:function(){O.bindFramebuffer(F,f)},off:function(){O.bindFramebuffer(F,null)}}),f.set(d,b||1,c||1,e),f},texture:function(e,f,g,i){var j,l,m=O.createTexture();return"object"==typeof f&&(i=f),a(m,{param:function(a,b){O.texParameteri(I,a,b)},setup:function(b){b=a(b||{},{min:L,mag:L,s:B,t:B}),m.on(),m.param(s,b.mag),m.param(t,b.min),m.param(y,b.s),m.param(z,b.t),b.mipmap&&O.generateMipmap(I),m.off()},on:function(a){b(a)&&O.activeTexture(K+a),O.bindTexture(I,m)},off:function(){O.bindTexture(I,null)},set:function(b,e,f,g){g=a(g||{},{mipmap:l=e>1&&f>1&&c(e)&&c(f),format:N,min:l?q:L,flip:!0});var i="string"==typeof b;if(i||!b&&!e&&!f)return m.set(k,1,1),void(i&&d(b,m.set));var n=/^float/i.test(h(b))?M:C;m.on(),O.pixelStorei(r,g.flip),e&&f?O.texImage2D(I,0,g.format,e,f,0,g.format,n,b):O.texImage2D(I,0,g.format,g.format,C,b),b!==j&&m.setup(g),j=b,m.off()}}),m.set(e,f,g,i),m},size:function(a,b){O.viewport(0,0,a,b),O.height=j.height=b,O.width=j.width=a},mesh:function(b){return a(b||{},{mode:A,attributes:{},uniforms:{},textures:{},indices:null,vertices:{}})}})}},k=new Uint8Array([0,0,0,0]),l="#ifdef GL_ES\nprecision mediump float;\n#endif",m=/attribute\s+(\w+)\s+([\w_-]+)/gi,n=/uniform\s+(\w+)\s+([\w_-]+)(\[(\s+)?([\w_-]+))?/gi,o=/(\/\/.+|\/\*[^(\*\/)]+\*\/)/i,p=34963,q=9987,r=37440,s=10240,t=10241,u=36064,v=35632,w=35713,x=5123,y=10242,z=10243,A=5,B=33071,C=5121,D=35633,E=34962,F=36160,G=35044,H=35714,I=3553,J=4,K=33984,L=9729,M=5126,N=6408,O=5124;Object.defineProperty;return j}(),Shaders=Shaders||{};Shaders.Glitch={},Shaders.Glitch.VertexShader=["attribute vec2 aPosition;","attribute vec2 aTexCoord;","varying vec2 vTexCoord;","void main() {","gl_Position = vec4( aPosition, 0, 1 );","vTexCoord = aTexCoord;","}"].join("\n"), Shaders.Glitch.FragmentShader=["uniform sampler2D uTexture;","uniform sampler2D uOffsets;","varying vec2 vTexCoord;","uniform int uSkip;","uniform float uAmount;","uniform float uAngle;","uniform float uSeed;","uniform float uSeedX;","uniform float uSeedY;","uniform float uDistortionX;","uniform float uDistortionY;","uniform float uColS;","float rand(vec2 co){","return fract(sin(dot(co.xy ,vec2(12.9898,78.233))) * 43758.5453);","}","void main() {","vec4 texel = texture2D( uTexture, vTexCoord );","gl_FragColor = texel;","if (uSkip < 1) {","vec2 p = vTexCoord;","float xs = floor(gl_FragCoord.x / 0.5);","float ys = floor(gl_FragCoord.y / 0.5);","//based on staffantans glitch shader for unity https://github.com/staffantan/unityglitch","vec4 normal = texture2D(uOffsets, p * uSeed * uSeed);","if (p.y < uDistortionX + uColS && p.y > uDistortionX - uColS * uSeed) {","if(uSeedX > 0.0){","p.y = 1.0 - (p.y + uDistortionY);","}","else {","p.y = uDistortionY;","}","}","if (p.x < uDistortionY + uColS && p.x > uDistortionY - uColS * uSeed) {","if (uSeedY > 0.0){","p.x = uDistortionX;","}","else {","p.x = 1. - (p.x + uDistortionX);","}","}","p.x += normal.x * uSeedX * (uSeed /5.0);","p.y += normal.y * uSeedY * (uSeed /5.0);","//base from RGB shift shader","vec2 offset = uAmount * vec2( cos(uAngle), sin(uAngle) );","vec4 cr = texture2D(uTexture, p + offset);","vec4 cga = texture2D(uTexture, p);","vec4 cb = texture2D(uTexture, p - offset);","gl_FragColor = vec4(cr.r, cga.g, cb.b, cga.a);","}","else {","gl_FragColor = texture2D(uTexture, vTexCoord);","}","}"].join("\n"),GlitchFx.prototype.enable=function(){this.enabled=!0},GlitchFx.prototype.disable=function(){this.enabled&&(this.enabled=!1,this.updateProgramUniforms(),this.program.draw(this.mesh))},GlitchFx.prototype.bindMethods=function(){this.onImageLoaded=this.onImageLoaded.bind(this),this.resize=this.resize.bind(this),this.render=this.render.bind(this)},GlitchFx.prototype.setupContext=function(){try{this.canvas=document.createElement("canvas"),this.context=GL.create(this.canvas),this.domElement.appendChild(this.canvas),this.hasWebGL=!0}catch(a){this.hasWebGL=!1}this.hasWebGL&&(window.addEventListener("resize",this.resize,!1),this.enableWebGLExtensions(),this.program=this.context.program(Shaders.Glitch.VertexShader,Shaders.Glitch.FragmentShader),this.texture=this.context.texture(),this.mesh=this.createQuadMesh(),this.setupProgramUniforms(),this.frame=0)},GlitchFx.prototype.createQuadMesh=function(){return this.context.mesh({textures:{uTexture:this.texture,uOffsets:this.generateHeightMap(64)},vertices:{aPosition:this.createScreenSpaceQuad()},attributes:{aTexCoord:this.createUVCoordinates()}})},GlitchFx.prototype.createScreenSpaceQuad=function(){return this.context.vbo([-1,1,1,1,-1,-1,1,-1])},GlitchFx.prototype.createUVCoordinates=function(){return this.context.vbo([0,1,1,1,0,0,1,0])},GlitchFx.prototype.enableWebGLExtensions=function(){this.context.getExtension("OES_texture_float"),this.context.getExtension("OES_half_float_linear"),this.context.getExtension("OES_float_linear")},GlitchFx.prototype.setupProgramUniforms=function(arguments){this.program.uSkip.set(1),this.program.uAmount.set(.01),this.program.uAngle.set(.01),this.program.uSeed.set(.01),this.program.uSeedX.set(.01),this.program.uSeedY.set(.01),this.program.uDistortionX.set(.1),this.program.uDistortionY.set(.1),this.program.uColS.set(.1),this.generateTrigger()},GlitchFx.prototype.updateProgramUniforms=function(){if(!this.enabled)return this.glitching=!1,void this.program.uSkip.set(1);this.glitching?(this.program.uSeed.set(Math.random()),this.program.uSkip.set(0),this.program.uAmount.set(Math.random()/this.strengthDivisor),this.program.uAngle.set(this.randomFloat(-Math.PI,Math.PI)),this.program.uSeedX.set(this.randomFloat(-this.maxSeedValue,this.maxSeedValue)),this.program.uSeedY.set(this.randomFloat(-this.maxSeedValue,this.maxSeedValue)),Math.random()<this.distortionProbability&&(this.program.uDistortionX.set(this.randomFloat(0,this.maxDistortion)),this.program.uDistortionY.set(this.randomFloat(0,this.maxDistortion))),this.glitchFrames>this.minGlitchedFrames&&(this.glitchFrames>this.maxGlitchedFrames||Math.random()<this.offProbability)&&(this.program.uSkip.set(1),this.glitching=!1),this.glitchFrames++):(this.glitching=Math.random()<this.onProbability,this.glitchFrames=0),this.frame++},GlitchFx.prototype.generateHeightMap=function(a){for(var b,c,d=new Float32Array(a*a*3),e=a*a,f=0;f<e;f++)c=3*f,b=Math.random(),d[c]=b,d[c+1]=b,d[c+2]=b;return this.context.texture(d,a,a,{format:this.context.RGB,mipmap:!1,min:this.context.NEAREST,mag:this.context.NEAREST,s:this.context.REPEAT,t:this.context.REPEAT})},GlitchFx.prototype.generateTrigger=function(){this.randX=Math.floor(this.randomFloat(120,240))},GlitchFx.prototype.randomFloat=function(a,b){return void 0===b&&(b=a,a=0),a+Math.random()*(b-a)},GlitchFx.prototype.resize=function(){this.domElement.offsetWidth,this.domElement.offsetHeight,this.image.width,this.image.height},GlitchFx.prototype.render=function(){requestAnimationFrame(this.render),this.enabled&&(this.updateProgramUniforms(),this.program.draw(this.mesh))},GlitchFx.prototype.setImagePath=function(a,b){void 0==b&&(b=!0),b&&(this.domElement.style.backgroundImage="url("+a+")"),this.hasWebGL&&(this.image=new Image,this.image.onload=this.onImageLoaded,this.image.src=a)},GlitchFx.prototype.onImageLoaded=function(){this.context.size(this.image.width,this.image.height),this.texture.set(this.image),this.resize()},function(a){"use strict";a.fn.absoluteCounter=function(b){return b=a.extend({},a.fn.absoluteCounter.defaults,b||{}),a(this).each(function(){var c=this,d=b.speed,e=b.setStyles,f=b.delayedStart,g=b.fadeInDelay;e&&a(c).css({display:"block",position:"relative",overflow:"hidden"}).addClass("animated"),a(c).css("opacity","0"),a(c).animate({opacity:0},f,function(){var f=a(c).text();a(c).text("");for(var h=0;h<f.length;h++){var i=f.charAt(h),j="";if(parseInt(i,10)>=0){j='<span class="onedigit p'+(f.length-h)+" d"+i+'">';for(var k=0;k<=parseInt(i,10);k++)j+='<span class="n'+k%10+'">'+k%10+"</span>";j+="</span>"}else j='<span class="onedigit p'+(f.length-h)+' char"><span class="c">'+i+"</span></span>";a(c).append(j)}a(c).animate({opacity:1},g),a("span.onedigit",c).each(function(f,g){e&&(a(g).css({float:"left",position:"relative"}),a("span",a(g)).css({display:"block"}));var h=a("span",a(g)).length,i=a(c).height();a(g).css({height:h*i+"px",top:"0"}),a("span",a(g)).css({height:i+"px"}),a(g).animate({top:(h-1)*i*-1+"px"},d,function(){"function"==typeof b.onComplete&&b.onComplete.call(c)})})})})},a.fn.absoluteCounter.defaults={speed:2e3,setStyles:!0,onComplete:null,delayedStart:0,fadeInDelay:0}}(jQuery),function(a){"use strict";a.fn.countTo=function(b){b=a.extend({},a.fn.countTo.defaults,b||{});var c=Math.ceil(b.speed/b.refreshInterval),d=(b.to-b.from)/c;return a(this).each(function(){function e(){h+=d,g++,a(f).html(h.toFixed(b.decimals)),"function"==typeof b.onUpdate&&b.onUpdate.call(f,h),g>=c&&(clearInterval(i),h=b.to,"function"==typeof b.onComplete&&b.onComplete.call(f,h))}var f=this,g=0,h=b.from,i=setInterval(e,b.refreshInterval)})},a.fn.countTo.defaults={from:0,to:100,speed:1e3,refreshInterval:100,decimals:0,onUpdate:null,onComplete:null}}(jQuery),function(a){"use strict";var b=["weeks","days","hours","minutes","seconds"],c=1e3,d=60*c,e=60*d,f=24*e,g=7*f,h=function(b){var h=new Date,i=b.end-h;if(i<=0)return void clearInterval(b.countdown);switch(b.time.weeks=Math.floor(i/g),b.time.days=Math.floor(i%g/f),b.time.hours=Math.floor(i%f/e),b.time.minutes=Math.floor(i%e/d),b.time.seconds=Math.floor(i%d/c),b.data.maximum){case 1:b.time.seconds=Math.floor(i/c);break;case 2:b.time.minutes=Math.floor(i/d);break;case 3:b.time.hours=Math.floor(i/e);break;case 4:b.time.days=Math.floor(i/f)}for(var j in b.time)if("object"==typeof b.update[j]&&(b.firstrun||b.oldtime[j]!=b.time[j])){var k=1===b.time[j]?"single":"multi";b.update[j].time_container.text(b.time[j]),b.update[j].label_container.text(b.update[j][k])}b.firstrun&&b.container.addClass("rdy-countdown-active"),b.oldtime=a.extend({},b.time),b.firstrun=!1};a.fn.rdyCountdown=function(c){if(this.length)return this.each(function(){var c={};c.update={},c.time={},c.oldtime={},c.firstrun=!0,c.container=a(this),c.data=c.container.data(),c.end=new Date(c.data.year,c.data.month,c.data.day,c.data.hour,c.data.minute);for(var d in b)c.update[b[d]]={time_container:c.container.find(".rdy-countdown-"+b[d]+" .rdy-countdown-time"),label_container:c.container.find(".rdy-countdown-"+b[d]+" .rdy-countdown-time-label")},c.update[b[d]].label_container.length&&(c.update[b[d]].single=c.update[b[d]].label_container.data("label"),c.update[b[d]].multi=c.update[b[d]].label_container.data("label-multi"));h(c),c.countdown=setInterval(function(){h(c)},c.data.interval)})}}(jQuery);var CanvasRenderer=function(a,b){var c,d=document.createElement("canvas");a.appendChild(d),"undefined"!=typeof G_vmlCanvasManager&&G_vmlCanvasManager.initElement(d);var e=d.getContext("2d");d.width=d.height=b.size;var f=1;window.devicePixelRatio>1&&(f=window.devicePixelRatio,d.style.width=d.style.height=[b.size,"px"].join(""),d.width=d.height=b.size*f,e.scale(f,f)),e.translate(b.size/2,b.size/2),e.rotate((b.rotate/180-.5)*Math.PI);var g=(b.size-b.lineWidth)/2;b.scaleColor&&b.scaleLength&&(g-=b.scaleLength+2),Date.now=Date.now||function(){return+new Date};var h=function(a,b,c){c=Math.min(Math.max(-1,c||0),1);var d=c<=0;e.beginPath(),e.arc(0,0,g,0,2*Math.PI*c,d),e.strokeStyle=a,e.lineWidth=b,e.stroke()},i=function(){var a,c;e.lineWidth=1,e.fillStyle=b.scaleColor,e.save();for(var d=24;d>0;--d)d%6==0?(c=b.scaleLength,a=0):(c=.6*b.scaleLength,a=b.scaleLength-c),e.fillRect(-b.size/2+a,0,c,1),e.rotate(Math.PI/12);e.restore()},j=function(){return window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||function(a){window.setTimeout(a,1e3/60)}}(),k=function(){b.scaleColor&&i(),b.trackColor&&h(b.trackColor,b.lineWidth,1)};this.getCanvas=function(){return d},this.getCtx=function(){return e},this.clear=function(){e.clearRect(b.size/-2,b.size/-2,b.size,b.size)},this.draw=function(a){b.scaleColor||b.trackColor?e.getImageData&&e.putImageData?c?e.putImageData(c,0,0):(k(),c=e.getImageData(0,0,b.size*f,b.size*f)):(this.clear(),k()):this.clear(),e.lineCap=b.lineCap;var d;d="function"==typeof b.barColor?b.barColor(a):b.barColor,h(d,b.lineWidth,a/100)}.bind(this),this.animate=function(a,c){var d=Date.now();b.onStart(a,c);var e=function(){var f=Math.min(Date.now()-d,b.animate.duration),g=b.easing(this,f,a,c-a,b.animate.duration);this.draw(g),b.onStep(a,c,g),f>=b.animate.duration?b.onStop(a,c):j(e)}.bind(this);j(e)}.bind(this)},Detector={canvas:!!window.CanvasRenderingContext2D,webgl:function(){try{var a=document.createElement("canvas");return!(!window.WebGLRenderingContext||!a.getContext("webgl")&&!a.getContext("experimental-webgl"))}catch(b){return!1}}(),workers:!!window.Worker,fileapi:window.File&&window.FileReader&&window.FileList&&window.Blob};"object"==typeof module&&(module.exports=Detector),window.PIXI=window.PIXI||{},PIXI.RandomDataGenerator=function(a){void 0===a&&(a=[]),this.c=1,this.s0=0,this.s1=0,this.s2=0,this.sow(a)},PIXI.RandomDataGenerator.prototype={rnd:function(){var a=2091639*this.s0+2.3283064365386963e-10*this.c;return this.c=0|a,this.s0=this.s1,this.s1=this.s2,this.s2=a-this.c,this.s2},sow:function(a){if(this.s0=this.hash(" "),this.s1=this.hash(this.s0),this.s2=this.hash(this.s1),this.c=1,a)for(var b=0;b<a.length&&null!=a[b];b++){var c=a[b];this.s0-=this.hash(c),this.s0+=~~(this.s0<0),this.s1-=this.hash(c),this.s1+=~~(this.s1<0),this.s2-=this.hash(c),this.s2+=~~(this.s2<0)}},hash:function(a){var b,c,d;for(d=4022871197,a=a.toString(),c=0;c<a.length;c++)d+=a.charCodeAt(c),b=.02519603282416938*d,d=b>>>0,b-=d,b*=d,d=b>>>0,b-=d,d+=4294967296*b;return 2.3283064365386963e-10*(d>>>0)},integer:function(){return 4294967296*this.rnd.apply(this)},frac:function(){return this.rnd.apply(this)+1.1102230246251565e-16*(2097152*this.rnd.apply(this)|0)},real:function(){return this.integer()+this.frac()},integerInRange:function(a,b){return Math.floor(this.realInRange(0,b-a+1)+a)},between:function(a,b){return this.integerInRange(a,b)},realInRange:function(a,b){return this.frac()*(b-a)+a},normal:function(){return 1-2*this.frac()},uuid:function(){var a="",b="";for(b=a="";a++<36;b+=~a%5|3*a&4?(15^a?8^this.frac()*(20^a?16:4):4).toString(16):"-");return b},pick:function(a){return a[this.integerInRange(0,a.length-1)]},weightedPick:function(a){return a[~~(Math.pow(this.frac(),2)*(a.length-1))]},timestamp:function(a,b){return this.realInRange(a||9466848e5,b||1577862e6)},angle:function(){return this.integerInRange(-180,180)}},PIXI.RandomDataGenerator.prototype.constructor=PIXI.RandomDataGenerator,function(a,b){"function"==typeof define&&define.amd?define(["jquery"],function(a){return b(a)}):"object"==typeof exports?module.exports=b(require("jquery")):b(jQuery)}(0,function(a){var b=function(a,b){var c,d=document.createElement("canvas");a.appendChild(d),"object"==typeof G_vmlCanvasManager&&G_vmlCanvasManager.initElement(d);var e=d.getContext("2d");d.width=d.height=b.size;var f=1;window.devicePixelRatio>1&&(f=window.devicePixelRatio,d.style.width=d.style.height=[b.size,"px"].join(""),d.width=d.height=b.size*f,e.scale(f,f)),e.translate(b.size/2,b.size/2),e.rotate((b.rotate/180-.5)*Math.PI);var g=(b.size-b.lineWidth)/2;b.scaleColor&&b.scaleLength&&(g-=b.scaleLength+2),Date.now=Date.now||function(){return+new Date};var h=function(a,b,c){c=Math.min(Math.max(-1,c||0),1);var d=0>=c;e.beginPath(),e.arc(0,0,g,0,2*Math.PI*c,d),e.strokeStyle=a,e.lineWidth=b,e.stroke()},i=function(){var a,c;e.lineWidth=1,e.fillStyle=b.scaleColor,e.save();for(var d=24;d>0;--d)d%6==0?(c=b.scaleLength,a=0):(c=.6*b.scaleLength,a=b.scaleLength-c),e.fillRect(-b.size/2+a,0,c,1),e.rotate(Math.PI/12);e.restore()},j=function(){return window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||function(a){window.setTimeout(a,1e3/60)}}(),k=function(){b.scaleColor&&i(),b.trackColor&&h(b.trackColor,b.trackWidth||b.lineWidth,1)};this.getCanvas=function(){return d},this.getCtx=function(){return e},this.clear=function(){e.clearRect(b.size/-2,b.size/-2,b.size,b.size)},this.draw=function(a){b.scaleColor||b.trackColor?e.getImageData&&e.putImageData?c?e.putImageData(c,0,0):(k(),c=e.getImageData(0,0,b.size*f,b.size*f)):(this.clear(),k()):this.clear(),e.lineCap=b.lineCap;var d;d="function"==typeof b.barColor?b.barColor(a):b.barColor,h(d,b.lineWidth,a/100)}.bind(this),this.animate=function(a,c){var d=Date.now();b.onStart(a,c);var e=function(){var f=Math.min(Date.now()-d,b.animate.duration),g=b.easing(this,f,a,c-a,b.animate.duration);this.draw(g),b.onStep(a,c,g),f>=b.animate.duration?b.onStop(a,c):j(e)}.bind(this);j(e)}.bind(this)},c=function(a,c){var d={barColor:"#ef1e25",trackColor:"#f9f9f9",scaleColor:"#dfe0e0",scaleLength:5,lineCap:"round",lineWidth:3,trackWidth:void 0,size:110,rotate:0,animate:{duration:1e3,enabled:!0},easing:function(a,b,c,d,e){return b/=e/2,1>b?d/2*b*b+c:-d/2*(--b*(b-2)-1)+c},onStart:function(a,b){},onStep:function(a,b,c){},onStop:function(a,b){}};if(void 0!==b)d.renderer=b;else{if("undefined"==typeof SVGRenderer)throw new Error("Please load either the SVG- or the CanvasRenderer");d.renderer=SVGRenderer}var e={},f=0,g=function(){this.el=a,this.options=e;for(var b in d)d.hasOwnProperty(b)&&(e[b]=c&&void 0!==c[b]?c[b]:d[b],"function"==typeof e[b]&&(e[b]=e[b].bind(this)));"string"==typeof e.easing&&"undefined"!=typeof jQuery&&jQuery.isFunction(jQuery.easing[e.easing])?e.easing=jQuery.easing[e.easing]:e.easing=d.easing,"number"==typeof e.animate&&(e.animate={duration:e.animate,enabled:!0}),"boolean"!=typeof e.animate||e.animate||(e.animate={duration:1e3,enabled:e.animate}),this.renderer=new e.renderer(a,e),this.renderer.draw(f),a.dataset&&a.dataset.percent?this.update(parseFloat(a.dataset.percent)):a.getAttribute&&a.getAttribute("data-percent")&&this.update(parseFloat(a.getAttribute("data-percent")))}.bind(this);this.update=function(a){return a=parseFloat(a),e.animate.enabled?this.renderer.animate(f,a):this.renderer.draw(a),f=a,this}.bind(this),this.disableAnimation=function(){return e.animate.enabled=!1,this},this.enableAnimation=function(){return e.animate.enabled=!0,this},g()};a.fn.easyPieChart=function(b){return this.each(function(){var d;a.data(this,"easyPieChart")||(d=a.extend({},b,a(this).data()),a.data(this,"easyPieChart",new c(this,d)))})}}),function(a,b,c,d){var e=a(b);a.fn.lazyload=function(f){function g(){var b=0;i.each(function(){var c=a(this);if(!j.skip_invisible||c.is(":visible"))if(a.abovethetop(this,j)||a.leftofbegin(this,j));else if(a.belowthefold(this,j)||a.rightoffold(this,j)){if(++b>j.failure_limit)return!1}else c.trigger("appear"),b=0})}var h,i=this,j={threshold:0,failure_limit:0,event:"scroll",effect:"show",container:b,data_attribute:"original",skip_invisible:!1,appear:null,load:null,placeholder:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB/AAffA0nNPuCLAAAAAElFTkSuQmCC"};return f&&(d!==f.failurelimit&&(f.failure_limit=f.failurelimit,delete f.failurelimit),d!==f.effectspeed&&(f.effect_speed=f.effectspeed,delete f.effectspeed),a.extend(j,f)),h=j.container===d||j.container===b?e:a(j.container),0===j.event.indexOf("scroll")&&h.bind(j.event,function(){return g()}),this.each(function(){var b=this,c=a(b);b.loaded=!1,(c.attr("src")===d||!1===c.attr("src"))&&c.is("img")&&c.attr("src",j.placeholder),c.one("appear",function(){if(!this.loaded){if(j.appear){var d=i.length;j.appear.call(b,d,j)}a("<img />").bind("load",function(){var d=c.attr("data-"+j.data_attribute);c.hide(),c.is("img")?c.attr("src",d):c.css("background-image","url('"+d+"')"),c[j.effect](j.effect_speed),b.loaded=!0;var e=a.grep(i,function(a){return!a.loaded});if(i=a(e),j.load){var f=i.length;j.load.call(b,f,j)}}).attr("src",c.attr("data-"+j.data_attribute))}}),0!==j.event.indexOf("scroll")&&c.bind(j.event,function(){b.loaded||c.trigger("appear")})}),e.bind("resize",function(){g()}),/(?:iphone|ipod|ipad).*os 5/gi.test(navigator.appVersion)&&e.bind("pageshow",function(b){b.originalEvent&&b.originalEvent.persisted&&i.each(function(){a(this).trigger("appear")})}),a(c).ready(function(){g()}),this},a.belowthefold=function(c,f){return(f.container===d||f.container===b?(b.innerHeight?b.innerHeight:e.height())+e.scrollTop():a(f.container).offset().top+a(f.container).height())<=a(c).offset().top-f.threshold},a.rightoffold=function(c,f){return(f.container===d||f.container===b?e.width()+e.scrollLeft():a(f.container).offset().left+a(f.container).width())<=a(c).offset().left-f.threshold},a.abovethetop=function(c,f){return(f.container===d||f.container===b?e.scrollTop():a(f.container).offset().top)>=a(c).offset().top+f.threshold+a(c).height()},a.leftofbegin=function(c,f){return(f.container===d||f.container===b?e.scrollLeft():a(f.container).offset().left)>=a(c).offset().left+f.threshold+a(c).width()},a.inviewport=function(b,c){return!(a.rightoffold(b,c)||a.leftofbegin(b,c)||a.belowthefold(b,c)||a.abovethetop(b,c))},a.extend(a.expr[":"],{"below-the-fold":function(b){return a.belowthefold(b,{threshold:0})},"above-the-top":function(b){return!a.belowthefold(b,{threshold:0})},"right-of-screen":function(b){return a.rightoffold(b,{threshold:0})},"left-of-screen":function(b){return!a.rightoffold(b,{threshold:0})},"in-viewport":function(b){return a.inviewport(b,{threshold:0})},"above-the-fold":function(b){return!a.belowthefold(b,{threshold:0})},"right-of-fold":function(b){return a.rightoffold(b,{threshold:0})},"left-of-fold":function(b){return!a.rightoffold(b,{threshold:0})}})}(jQuery,window,document),function(a){"use strict";a.fn.fitVids=function(b){var c={customSelector:null,ignore:null};if(!document.getElementById("fit-vids-style")){var d=document.head||document.getElementsByTagName("head")[0],e=document.createElement("div");e.innerHTML='<p>x</p><style id="fit-vids-style">'+".fluid-width-video-wrapper{width:100%;position:relative;padding:0;}.fluid-width-video-wrapper iframe,.fluid-width-video-wrapper object,.fluid-width-video-wrapper embed {position:absolute;top:0;left:0;width:100%;height:100%;}"+"</style>",d.appendChild(e.childNodes[1])}return b&&a.extend(c,b),this.each(function(){var b=['iframe[src*="player.vimeo.com"]','iframe[src*="youtube.com"]','iframe[src*="youtube-nocookie.com"]','iframe[src*="kickstarter.com"][src*="video.html"]',"object","embed"];c.customSelector&&b.push(c.customSelector);var d=".fitvidsignore";c.ignore&&(d=d+", "+c.ignore);var e=a(this).find(b.join(","));e=e.not("object object"),e=e.not(d),e.each(function(b){var c=a(this);if(!(c.parents(d).length>0||"embed"===this.tagName.toLowerCase()&&c.parent("object").length||c.parent(".fluid-width-video-wrapper").length)){c.css("height")||c.css("width")||!isNaN(c.attr("height"))&&!isNaN(c.attr("width"))||(c.attr("height",9),c.attr("width",16));var e="object"===this.tagName.toLowerCase()||c.attr("height")&&!isNaN(parseInt(c.attr("height"),10))?parseInt(c.attr("height"),10):c.height(),f=isNaN(parseInt(c.attr("width"),10))?c.width():parseInt(c.attr("width"),10),g=e/f;if(!c.attr("id")){var h="fitvid"+b;c.attr("id",h)}c.wrap('<div class="fluid-width-video-wrapper"></div>').parent(".fluid-width-video-wrapper").css("padding-top",100*g+"%"),c.removeAttr("height").removeAttr("width")}})})}}(window.jQuery||window.Zepto),function(a,b){"object"==typeof exports&&"undefined"!=typeof module?module.exports=b():"function"==typeof define&&define.amd?define(b):a.CountUp=b()}(this,function(){"use strict";return function(a,b,c,d,e,f){for(var g=0,h=["webkit","moz","ms","o"],i=0;i<h.length&&!window.requestAnimationFrame;++i)window.requestAnimationFrame=window[h[i]+"RequestAnimationFrame"],window.cancelAnimationFrame=window[h[i]+"CancelAnimationFrame"]||window[h[i]+"CancelRequestAnimationFrame"];window.requestAnimationFrame||(window.requestAnimationFrame=function(a,b){var c=(new Date).getTime(),d=Math.max(0,16-(c-g)),e=window.setTimeout(function(){a(c+d)},d);return g=c+d,e}),window.cancelAnimationFrame||(window.cancelAnimationFrame=function(a){clearTimeout(a)}),this.options={useEasing:!0,useGrouping:!0,separator:",",decimal:"."};for(var j in f)f.hasOwnProperty(j)&&(this.options[j]=f[j]);""==this.options.separator&&(this.options.useGrouping=!1),null==this.options.prefix&&(this.options.prefix=""),null==this.options.suffix&&(this.options.suffix="");var k=this;this.d="string"==typeof a?document.getElementById(a):a,this.startVal=Number(b),this.endVal=Number(c),this.countDown=this.startVal>this.endVal,this.startTime=null,this.timestamp=null,this.remaining=null,this.frameVal=this.startVal,this.rAF=null,this.decimals=Math.max(0,d||0),this.dec=Math.pow(10,this.decimals),this.duration=1e3*e||2e3,this.version=function(){return"1.5.0"},this.printValue=function(a){var b=isNaN(a)?"--":k.formatNumber(a);"INPUT"==k.d.tagName?this.d.value=b:"text"==k.d.tagName?this.d.textContent=b:this.d.innerHTML=b},this.easeOutExpo=function(a,b,c,d){return c*(1-Math.pow(2,-10*a/d))*1024/1023+b},this.count=function(a){null===k.startTime&&(k.startTime=a),k.timestamp=a;var b=a-k.startTime;if(k.remaining=k.duration-b,k.options.useEasing)if(k.countDown){var c=k.easeOutExpo(b,0,k.startVal-k.endVal,k.duration);k.frameVal=k.startVal-c}else k.frameVal=k.easeOutExpo(b,k.startVal,k.endVal-k.startVal,k.duration);else if(k.countDown){var c=(k.startVal-k.endVal)*(b/k.duration);k.frameVal=k.startVal-c}else k.frameVal=k.startVal+(k.endVal-k.startVal)*(b/k.duration);k.countDown?k.frameVal=k.frameVal<k.endVal?k.endVal:k.frameVal:k.frameVal=k.frameVal>k.endVal?k.endVal:k.frameVal,k.frameVal=Math.round(k.frameVal*k.dec)/k.dec,k.printValue(k.frameVal),b<k.duration?k.rAF=requestAnimationFrame(k.count):null!=k.callback&&k.callback()},this.start=function(a){return k.callback=a,isNaN(k.endVal)||isNaN(k.startVal)?(console.log("countUp error: startVal or endVal is not a number"),k.printValue()):k.rAF=requestAnimationFrame(k.count),!1},this.pauseResume=function(){k.paused?(k.paused=!1,k.startTime=null,k.duration=k.remaining,k.startVal=k.frameVal,requestAnimationFrame(k.count)):(k.paused=!0,cancelAnimationFrame(k.rAF))},this.stop=function(){cancelAnimationFrame(k.rAF)},this.resume=function(){k.stop(),k.startTime=null,k.duration=k.remaining,k.startVal=k.frameVal,requestAnimationFrame(k.count)},this.reset=function(){k.paused=!1,k.startTime=null,k.startVal=b,cancelAnimationFrame(k.rAF),k.printValue(k.startVal)},this.update=function(a){cancelAnimationFrame(k.rAF),k.paused=!1,k.startTime=null,k.startVal=k.frameVal,k.endVal=Number(a),k.countDown=k.startVal>k.endVal,k.rAF=requestAnimationFrame(k.count)},this.formatNumber=function(a){a=a.toFixed(k.decimals),a+="";var b,c,d,e;if(b=a.split("."),c=b[0],d=b.length>1?k.options.decimal+b[1]:"",e=/(\d+)(\d{3})/,k.options.useGrouping)for(;e.test(c);)c=c.replace(e,"$1"+k.options.separator+"$2");return k.options.prefix+c+d+k.options.suffix},k.printValue(k.startVal)}}),function(a){"function"==typeof define&&define.amd?define(["jquery"],a):"object"==typeof exports?module.exports=a:a(jQuery)}(function(a){function b(b){var g=b||window.event,h=i.call(arguments,1),j=0,l=0,m=0,n=0,o=0,p=0;if(b=a.event.fix(g),b.type="mousewheel","detail"in g&&(m=-1*g.detail),"wheelDelta"in g&&(m=g.wheelDelta),"wheelDeltaY"in g&&(m=g.wheelDeltaY),"wheelDeltaX"in g&&(l=-1*g.wheelDeltaX),"axis"in g&&g.axis===g.HORIZONTAL_AXIS&&(l=-1*m,m=0),j=0===m?l:m,"deltaY"in g&&(m=-1*g.deltaY,j=m),"deltaX"in g&&(l=g.deltaX,0===m&&(j=-1*l)),0!==m||0!==l){if(1===g.deltaMode){var q=a.data(this,"mousewheel-line-height");j*=q,m*=q,l*=q}else if(2===g.deltaMode){var r=a.data(this,"mousewheel-page-height");j*=r,m*=r,l*=r}if(n=Math.max(Math.abs(m),Math.abs(l)),(!f||f>n)&&(f=n,d(g,n)&&(f/=40)),d(g,n)&&(j/=40,l/=40,m/=40),j=Math[j>=1?"floor":"ceil"](j/f),l=Math[l>=1?"floor":"ceil"](l/f),m=Math[m>=1?"floor":"ceil"](m/f),k.settings.normalizeOffset&&this.getBoundingClientRect){var s=this.getBoundingClientRect();o=b.clientX-s.left,p=b.clientY-s.top}return b.deltaX=l,b.deltaY=m,b.deltaFactor=f,b.offsetX=o,b.offsetY=p,b.deltaMode=0,h.unshift(b,j,l,m),e&&clearTimeout(e),e=setTimeout(c,200),(a.event.dispatch||a.event.handle).apply(this,h)}}function c(){f=null}function d(a,b){return k.settings.adjustOldDeltas&&"mousewheel"===a.type&&b%120==0}var e,f,g=["wheel","mousewheel","DOMMouseScroll","MozMousePixelScroll"],h="onwheel"in document||document.documentMode>=9?["wheel"]:["mousewheel","DomMouseScroll","MozMousePixelScroll"],i=Array.prototype.slice;if(a.event.fixHooks)for(var j=g.length;j;)a.event.fixHooks[g[--j]]=a.event.mouseHooks;var k=a.event.special.mousewheel={version:"3.1.12",setup:function(){if(this.addEventListener)for(var c=h.length;c;)this.addEventListener(h[--c],b,!1);else this.onmousewheel=b;a.data(this,"mousewheel-line-height",k.getLineHeight(this)),a.data(this,"mousewheel-page-height",k.getPageHeight(this))},teardown:function(){if(this.removeEventListener)for(var c=h.length;c;)this.removeEventListener(h[--c],b,!1);else this.onmousewheel=null;a.removeData(this,"mousewheel-line-height"),a.removeData(this,"mousewheel-page-height")},getLineHeight:function(b){var c=a(b),d=c["offsetParent"in a.fn?"offsetParent":"parent"]();return d.length||(d=a("body")),parseInt(d.css("fontSize"),10)||parseInt(c.css("fontSize"),10)||16},getPageHeight:function(b){return a(b).height()},settings:{adjustOldDeltas:!0,normalizeOffset:!0}};a.fn.extend({mousewheel:function(a){return a?this.bind("mousewheel",a):this.trigger("mousewheel")},unmousewheel:function(a){return this.unbind("mousewheel",a)}})}),function(a,b,c,d){var e=function(){if(c.documentMode)return c.documentMode;for(var a=7;a>0;a--){var b=c.createElement("div");if(b.innerHTML="\x3c!--[if IE "+a+"]><span></span><![endif]--\x3e",b.getElementsByTagName("span").length)return b=null,a;b=null}return d}(),f=b.console||{log:function(){},time:function(){}},g="blast",h={latinPunctuation:"–—′’'“″„\"(«.…¡¿′’'”″“\")».…!?",latinLetters:"\\u0041-\\u005A\\u0061-\\u007A\\u00C0-\\u017F\\u0100-\\u01FF\\u0180-\\u027F"},i={abbreviations:new RegExp("[^"+h.latinLetters+"](e\\.g\\.)|(i\\.e\\.)|(mr\\.)|(mrs\\.)|(ms\\.)|(dr\\.)|(prof\\.)|(esq\\.)|(sr\\.)|(jr\\.)[^"+h.latinLetters+"]","ig"),innerWordPeriod:new RegExp("["+h.latinLetters+"].["+h.latinLetters+"]","ig"),onlyContainsPunctuation:new RegExp("[^"+h.latinPunctuation+"]"),adjoinedPunctuation:new RegExp("^["+h.latinPunctuation+"]+|["+h.latinPunctuation+"]+$","g"),skippedElements:/(script|style|select|textarea)/i,hasPluginClass:new RegExp("(^| )"+g+"( |$)","gi")};a.fn[g]=function(j){function k(a){return a.replace(i.abbreviations,function(a){return a.replace(/\./g,"{{46}}")}).replace(i.innerWordPeriod,function(a){return a.replace(/\./g,"{{46}}")})}function l(a){return a.replace(/{{(\d{1,3})}}/g,function(a,b){return String.fromCharCode(b)})}function m(a,b){var d=c.createElement(b.tag);if(d.className=g,b.customClass&&(d.className+=" "+b.customClass,b.generateIndexID&&(d.id=b.customClass+"-"+r.blastedIndex)),"all"===b.delimiter&&/\s/.test(a.data)&&(d.style.whiteSpace="pre-line"),!0===b.generateValueClass&&!b.search&&("character"===b.delimiter||"word"===b.delimiter)){var e,f=a.data;"word"===b.delimiter&&i.onlyContainsPunctuation.test(f)&&(f=f.replace(i.adjoinedPunctuation,"")),e=g+"-"+b.delimiter.toLowerCase()+"-"+f.toLowerCase(),d.className+=" "+e}return b.aria&&d.setAttribute("aria-hidden","true"),d.appendChild(a.cloneNode(!1)),d}function n(a,b){var c=-1,d=0;if(3===a.nodeType&&a.data.length){if(r.nodeBeginning&&(a.data=b.search||"sentence"!==b.delimiter?l(a.data):k(a.data),r.nodeBeginning=!1),-1!==(c=a.data.search(p))){var e=a.data.match(p),f=e[0],g=e[1]||!1;""===f?c++:g&&g!==f&&(c+=f.indexOf(g),f=g);var h=a.splitText(c);h.splitText(f.length),d=1,b.search||"sentence"!==b.delimiter||(h.data=l(h.data));var j=m(h,b,r.blastedIndex);h.parentNode.replaceChild(j,h),r.wrappers.push(j),r.blastedIndex++}}else if(1===a.nodeType&&a.hasChildNodes()&&!i.skippedElements.test(a.tagName)&&!i.hasPluginClass.test(a.className))for(var o=0;o<a.childNodes.length;o++)r.nodeBeginning=!0,o+=n(a.childNodes[o],b);return d}function o(c,h){h.debug&&f.time("blast reversal");var i=!1;c.removeClass(g+"-root").removeAttr("aria-label").find("."+g).each(function(){if(a(this).closest("."+g+"-root").length)i=!0;else{var b=this.parentNode;7>=e&&b.firstChild.nodeName,b.replaceChild(this.firstChild,this),b.normalize()}}),b.Zepto?c.data(g,d):c.removeData(g),h.debug&&(f.log(g+": Reversed Blast"+(c.attr("id")?" on #"+c.attr("id")+".":".")+(i?" Skipped reversal on the children of one or more descendant root elements.":"")),f.timeEnd("blast reversal"))}var p,q=a.extend({},a.fn[g].defaults,j),r={};if(q.search.length&&("string"==typeof q.search||/^\d/.test(parseFloat(q.search))))q.delimiter=q.search.toString().replace(/[-[\]{,}(.)*+?|^$\\\/]/g,"\\$&"),p=new RegExp("(?:^|[^-"+h.latinLetters+"])("+q.delimiter+"('s)?)(?![-"+h.latinLetters+"])","i");else switch("string"==typeof q.delimiter&&(q.delimiter=q.delimiter.toLowerCase()),q.delimiter){case"all":p=/(.)/;break;case"letter":case"char":case"character":p=/(\S)/;break;case"word":p=/\s*(\S+)\s*/;break;case"sentence":p=/(?=\S)(([.]{2,})?[^!?]+?([.…!?]+|(?=\s+$)|$)(\s*[′’'”″“")»]+)*)/;break;case"element":p=/(?=\S)([\S\s]*\S)/;break;default:if(!(q.delimiter instanceof RegExp))return f.log(g+": Unrecognized delimiter, empty search string, or invalid custom Regex. Aborting."),!0;p=q.delimiter}if(this.each(function(){var b=a(this),e=b.text();if(!1!==j){r={blastedIndex:0,nodeBeginning:!1,wrappers:r.wrappers||[]},b.data(g)===d||"search"===b.data(g)&&!1!==q.search||(o(b,q),q.debug&&f.log(g+": Removed element's existing Blast call.")),b.data(g,!1!==q.search?"search":q.delimiter),q.aria&&b.attr("aria-label",e),q.stripHTMLTags&&b.html(e);try{c.createElement(q.tag)}catch(h){q.tag="span", q.debug&&f.log(g+": Invalid tag supplied. Defaulting to span.")}b.addClass(g+"-root"),q.debug&&f.time(g),n(this,q),q.debug&&f.timeEnd(g)}else!1===j&&b.data(g)!==d&&o(b,q);q.debug&&a.each(r.wrappers,function(a,b){f.log(g+" ["+q.delimiter+"] "+this.outerHTML),this.style.backgroundColor=a%2?"#f12185":"#075d9a"})}),!1!==j&&!0===q.returnGenerated){var s=a().add(r.wrappers);return s.prevObject=this,s.context=this.context,s}return this},a.fn.blast.defaults={returnGenerated:!0,delimiter:"word",tag:"span",search:!1,customClass:"",generateIndexID:!1,generateValueClass:!1,stripHTMLTags:!1,aria:!0,debug:!1}}(window.jQuery||window.Zepto,window,document),jQuery(document).ready(function(a){({showLogs:!1,round:1e3,init:function(){if(!(a(window).width()<768)){if(this._log("init"),this._inited)return this._log("Already Inited"),void(this._inited=!0);this._requestAnimationFrame=function(){return window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(a,b){window.setTimeout(a,1e3/60)}}(),this._onScroll(!0)}},_inited:!1,_properties:["x","y","z","rotateX","rotateY","rotateZ","scaleX","scaleY","scaleZ","scale"],_requestAnimationFrame:null,_log:function(a){this.showLogs&&console.log("Parallax Scroll / "+a)},_onScroll:function(b){var c=a(document).scrollTop(),d=a(window).height();this._log("onScroll "+c),a("[data-parallax]").each(a.proxy(function(e,f){var g=a(f),h=[],i=!1,j=g.data("style");void 0==j&&(j=g.attr("style")||"",g.data("style",j));var k,l=[g.data("parallax")];for(k=2;g.data("parallax"+k);k++)l.push(g.data("parallax-"+k));var m=l.length;for(k=0;k<m;k++){var n=l[k],o=n["from-scroll"];void 0==o&&(o=Math.max(0,a(f).offset().top-d)),o|=0;var p=n.distance,q=n["to-scroll"];void 0==p&&void 0==q&&(p=d),p=Math.max(0|p,1);var r=n.easing,s=n["easing-return"];if(void 0!=r&&a.easing&&a.easing[r]||(r=null),void 0!=s&&a.easing&&a.easing[s]||(s=r),r){var t=n.duration;void 0==t&&(t=p),t=Math.max(0|t,1);var u=n["duration-return"];void 0==u&&(u=t),p=1;var v=g.data("current-time");void 0==v&&(v=0)}void 0==q&&(q=o+p),q|=0;var w=n.smoothness;void 0==w&&(w=30),w|=0,(b||0==w)&&(w=1),w|=0;var x=c;x=Math.max(x,o),x=Math.min(x,q),r&&(void 0==g.data("sens")&&g.data("sens","back"),x>o&&("back"==g.data("sens")?(v=1,g.data("sens","go")):v++),x<q&&("go"==g.data("sens")?(v=1,g.data("sens","back")):v++),b&&(v=t),g.data("current-time",v)),this._properties.map(a.proxy(function(b){var c=0,d=n[b];if(void 0!=d){"scale"==b||"scaleX"==b||"scaleY"==b||"scaleZ"==b?c=1:d|=0;var e=g.data("_"+b);void 0==e&&(e=c);var f=(x-o)/(q-o)*(d-c)+c,j=e+(f-e)/w;if(r&&v>0&&v<=t){var k=c;"back"==g.data("sens")&&(k=d,d=-d,r=s,t=u),j=a.easing[r](null,v,k,d,t)}j=Math.ceil(j*this.round)/this.round,j==e&&f==d&&(j=d),h[b]||(h[b]=0),h[b]+=j,e!=h[b]&&(g.data("_"+b,h[b]),i=!0)}},this))}if(i){if(void 0!=h.z){var y=n.perspective;void 0==y&&(y=800);var z=g.parent();z.data("style")||z.data("style",z.attr("style")||""),z.attr("style","perspective:"+y+"px; -webkit-perspective:"+y+"px; "+z.data("style"))}void 0==h.scaleX&&(h.scaleX=1),void 0==h.scaleY&&(h.scaleY=1),void 0==h.scaleZ&&(h.scaleZ=1),void 0!=h.scale&&(h.scaleX*=h.scale,h.scaleY*=h.scale,h.scaleZ*=h.scale);var A="translate3d("+(h.x?h.x:0)+"px, "+(h.y?h.y:0)+"px, "+(h.z?h.z:0)+"px)",B="rotateX("+(h.rotateX?h.rotateX:0)+"deg) rotateY("+(h.rotateY?h.rotateY:0)+"deg) rotateZ("+(h.rotateZ?h.rotateZ:0)+"deg)",C="scaleX("+h.scaleX+") scaleY("+h.scaleY+") scaleZ("+h.scaleZ+")",D=A+" "+B+" "+C+";";this._log(D),g.attr("style","transform:"+D+" -webkit-transform:"+D+" "+j)}},this)),window.requestAnimationFrame?window.requestAnimationFrame(a.proxy(this._onScroll,this,!1)):this._requestAnimationFrame(a.proxy(this._onScroll,this,!1))}}).init()}),function(a){"use strict";function b(b,c){this.$target=a(b),this.opts=a.extend({},i,c,this.$target.data()),void 0===this.isOpen&&this._init()}var c,d,e,f,g,h,i={loadingNotice:"Loading image",errorNotice:"The image could not be loaded",errorDuration:2500,linkAttribute:"href",preventClicks:!0,beforeShow:a.noop,beforeHide:a.noop,onShow:a.noop,onHide:a.noop,onMove:a.noop};b.prototype._init=function(){this.$link=this.$target.find("a"),this.$image=this.$target.find("img"),this.$flyout=a('<div class="easyzoom-flyout" />'),this.$notice=a('<div class="easyzoom-notice" />'),this.$target.on({"mousemove.easyzoom touchmove.easyzoom":a.proxy(this._onMove,this),"mouseleave.easyzoom touchend.easyzoom":a.proxy(this._onLeave,this),"mouseenter.easyzoom touchstart.easyzoom":a.proxy(this._onEnter,this)}),this.opts.preventClicks&&this.$target.on("click.easyzoom",function(a){a.preventDefault()})},b.prototype.show=function(a,b){var g,h,i,j,k=this;if(!1!==this.opts.beforeShow.call(this)){if(!this.isReady)return this._loadImage(this.$link.attr(this.opts.linkAttribute),function(){(k.isMouseOver||!b)&&k.show(a)});this.$target.append(this.$flyout),g=this.$target.width(),h=this.$target.height(),i=this.$flyout.width(),j=this.$flyout.height(),c=this.$zoom.width()-i,d=this.$zoom.height()-j,e=c/g,f=d/h,this.isOpen=!0,this.opts.onShow.call(this),a&&this._move(a)}},b.prototype._onEnter=function(a){var b=a.originalEvent.touches;this.isMouseOver=!0,b&&1!=b.length||(a.preventDefault(),this.show(a,!0))},b.prototype._onMove=function(a){this.isOpen&&(a.preventDefault(),this._move(a))},b.prototype._onLeave=function(){this.isMouseOver=!1,this.isOpen&&this.hide()},b.prototype._onLoad=function(a){a.currentTarget.width&&(this.isReady=!0,this.$notice.detach(),this.$flyout.html(this.$zoom),this.$target.removeClass("is-loading").addClass("is-ready"),a.data.call&&a.data())},b.prototype._onError=function(){var a=this;this.$notice.text(this.opts.errorNotice),this.$target.removeClass("is-loading").addClass("is-error"),this.detachNotice=setTimeout(function(){a.$notice.detach(),a.detachNotice=null},this.opts.errorDuration)},b.prototype._loadImage=function(b,c){var d=new Image;this.$target.addClass("is-loading").append(this.$notice.text(this.opts.loadingNotice)),this.$zoom=a(d).on("error",a.proxy(this._onError,this)).on("load",c,a.proxy(this._onLoad,this)),d.style.position="absolute",d.src=b},b.prototype._move=function(a){if(0===a.type.indexOf("touch")){var b=a.touches||a.originalEvent.touches;g=b[0].pageX,h=b[0].pageY}else g=a.pageX||g,h=a.pageY||h;var i=this.$target.offset(),j=h-i.top,k=g-i.left,l=Math.ceil(j*f),m=Math.ceil(k*e);if(0>m||0>l||m>c||l>d)this.hide();else{var n=-1*l,o=-1*m;this.$zoom.css({top:n,left:o}),this.opts.onMove.call(this,n,o)}},b.prototype.hide=function(){this.isOpen&&!1!==this.opts.beforeHide.call(this)&&(this.$flyout.detach(),this.isOpen=!1,this.opts.onHide.call(this))},b.prototype.swap=function(b,c,d){this.hide(),this.isReady=!1,this.detachNotice&&clearTimeout(this.detachNotice),this.$notice.parent().length&&this.$notice.detach(),this.$target.removeClass("is-loading is-ready is-error"),this.$image.attr({src:b,srcset:a.isArray(d)?d.join():d}),this.$link.attr(this.opts.linkAttribute,c)},b.prototype.teardown=function(){this.hide(),this.$target.off(".easyzoom").removeClass("is-loading is-ready is-error"),this.detachNotice&&clearTimeout(this.detachNotice),delete this.$link,delete this.$zoom,delete this.$image,delete this.$notice,delete this.$flyout,delete this.isOpen,delete this.isReady},a.fn.easyZoom=function(c){return this.each(function(){var d=a.data(this,"easyZoom");d?void 0===d.isOpen&&d._init():a.data(this,"easyZoom",new b(this,c))})},"function"==typeof define&&define.amd?define(function(){return b}):"undefined"!=typeof module&&module.exports&&(module.exports=b)}(jQuery);var SHADER_LOADER=SHADER_LOADER||{};SHADER_LOADER.load=function(a,b){var c,d,e,f=function(){i<=0&&b&&b(h)},g=function(a,b){var c=function(a,c){--i,h[e]||(h[e]={vertex:"",fragment:""}),h[e][b]=a.responseText,f()},d=a.src,e=a.name;$.ajax({url:d,dataType:"text",context:{name:e,type:b},complete:c})},h={},i=a.vertexShaders.length+a.fragmentShaders.length;for(d=0,e=a.vertexShaders.length;d<e;++d)c=a.vertexShaders[d],g(c,"vertex");for(d=0,e=a.fragmentShaders.length;d<e;++d)c=a.fragmentShaders[d],g(c,"fragment");f()},function(a,b){"use strict";"function"==typeof define&&"object"==typeof define.amd?define([],function(){return b(a)}):a.SineWaves=b(a)}(this,function(){"use strict";function a(a){if(this.options=i.defaults(this.options,a),this.el=this.options.el,delete this.options.el,!this.el)throw"No Canvas Selected";if(this.ctx=this.el.getContext("2d"),this.waves=this.options.waves,delete this.options.waves,!this.waves||!this.waves.length)throw"No waves specified";this.dpr=window.devicePixelRatio||1,this.updateDimensions(),window.addEventListener("resize",this.updateDimensions.bind(this)),this.setupUserFunctions(),this.easeFn=i.getFn(n,this.options.ease,"linear"),this.rotation=i.degreesToRadians(this.options.rotate),i.isType(this.options.running,"boolean")&&(this.running=this.options.running),this.setupWaveFns(),this.loop()}function b(a,b){return i.isType(a,"number")?a:(a=a.toString(),a.indexOf("%")>-1?(a=parseFloat(a),a>1&&(a/=100),b*a):a.indexOf("px")>-1?parseInt(a,10):void 0)}Function.prototype.bind||(Function.prototype.bind=function(a){if("function"!=typeof this)throw new TypeError("Function.prototype.bind - what is trying to be bound is not callable");var b=Array.prototype.slice.call(arguments,1),c=this,d=function(){},e=function(){return c.apply(this instanceof d&&a?this:a,b.concat(Array.prototype.slice.call(arguments)))};return d.prototype=this.prototype,e.prototype=new d,e});for(var c=["ms","moz","webkit","o"],d=0;d<c.length&&!window.requestAnimationFrame;++d)window.requestAnimationFrame=window[c[d]+"RequestAnimationFrame"],window.cancelAnimationFrame=window[c[d]+"CancelAnimationFrame"]||window[c[d]+"CancelRequestAnimationFrame"];if(!window.requestAnimationFrame){var e=0;window.requestAnimationFrame=function(a){var b=(new Date).getTime(),c=Math.max(0,16-(b-e)),d=window.setTimeout(function(){a(b+c)},c);return e=b+c,d}}window.cancelAnimationFrame||(window.cancelAnimationFrame=function(a){clearTimeout(a)});var f=Math.PI/180,g=2*Math.PI,h=Math.PI/2,i={},j=i.isType=function(a,b){return{}.toString.call(a).toLowerCase()==="[object "+b.toLowerCase()+"]"},k=i.isFunction=function(a){return j(a,"function")},l=i.isString=function(a){return j(a,"string")},m=(i.isNumber=function(a){return j(a,"number")},i.shallowClone=function(a){var b={};for(var c in a)a.hasOwnProperty(c)&&(b[c]=a[c]);return b}),n=(i.defaults=function(a,b){j(b,"object")||(b={});var c=m(a);for(var d in b)b.hasOwnProperty(d)&&(c[d]=b[d]);return c},i.degreesToRadians=function(a){if(!j(a,"number"))throw new TypeError("Degrees is not a number");return a*f},i.getFn=function(a,b,c){return k(b)?b:l(b)&&k(a[b.toLowerCase()])?a[b.toLowerCase()]:a[c]},{});n.linear=function(a,b){return b},n.sinein=function(a,b){return b*(Math.sin(a*Math.PI-h)+1)*.5},n.sineout=function(a,b){return b*(Math.sin(a*Math.PI+h)+1)*.5},n.sineinout=function(a,b){return b*(Math.sin(a*g-h)+1)*.5};var o={};o.sine=function(a){return Math.sin(a)},o.sin=o.sine,o.sign=function(a){return a=+a,0===a||isNaN(a)?a:a>0?1:-1},o.square=function(a){return o.sign(Math.sin(a*g))},o.sawtooth=function(a){return 2*(a-Math.floor(a+.5))},o.triangle=function(a){return Math.abs(o.sawtooth(a))},a.prototype.options={speed:10,rotate:0,ease:"Linear",wavesWidth:"95%"},a.prototype.setupWaveFns=function(){for(var a=-1,b=this.waves.length;++a<b;)this.waves[a].waveFn=i.getFn(o,this.waves[a].type,"sine")},a.prototype.setupUserFunctions=function(){i.isFunction(this.options.resizeEvent)&&(this.options.resizeEvent.call(this),window.addEventListener("resize",this.options.resizeEvent.bind(this))),i.isFunction(this.options.initialize)&&this.options.initialize.call(this)};var p={timeModifier:1,amplitude:50,wavelength:50,segmentLength:10,lineWidth:1,strokeStyle:"rgba(255, 255, 255, 0.2)",type:"Sine"};return a.prototype.getDimension=function(a){return i.isNumber(this.options[a])?this.options[a]:i.isFunction(this.options[a])?this.options[a].call(this,this.el):"width"===a?this.el.clientWidth:"height"===a?this.el.clientHeight:void 0},a.prototype.updateDimensions=function(){var a=this.getDimension("width"),c=this.getDimension("height");this.width=this.el.width=a*this.dpr,this.height=this.el.height=c*this.dpr,this.el.style.width=a+"px",this.el.style.height=c+"px",this.waveWidth=b(this.options.wavesWidth,this.width),this.waveLeft=(this.width-this.waveWidth)/2,this.yAxis=this.height/2},a.prototype.clear=function(){this.ctx.clearRect(0,0,this.width,this.height)},a.prototype.time=0,a.prototype.update=function(a){this.time=this.time-.007,void 0===a&&(a=this.time);var b=-1,c=this.waves.length;for(this.clear(),this.ctx.save(),this.rotation>0&&(this.ctx.translate(this.width/2,this.height/2),this.ctx.rotate(this.rotation),this.ctx.translate(-this.width/2,-this.height/2));++b<c;){var d=this.waves[b].timeModifier||1;this.drawWave(a*d,this.waves[b])}this.ctx.restore(),b=void 0,c=void 0},a.prototype.getPoint=function(a,b,c){var d=a*this.options.speed+(-this.yAxis+b)/c.wavelength,e=c.waveFn.call(this,d,o),f=this.easeFn.call(this,b/this.waveWidth,c.amplitude);return d=b+this.waveLeft,e=f*e+this.yAxis,{x:d,y:e}},a.prototype.drawWave=function(a,b){b=i.defaults(p,b),this.ctx.lineWidth=b.lineWidth*this.dpr,this.ctx.strokeStyle=b.strokeStyle,this.ctx.lineCap="butt",this.ctx.lineJoin="round",this.ctx.beginPath(),this.ctx.moveTo(0,this.yAxis),this.ctx.lineTo(this.waveLeft,this.yAxis);var c,d;for(c=0;c<this.waveWidth;c+=b.segmentLength)d=this.getPoint(a,c,b),this.ctx.lineTo(d.x,d.y),d=void 0;c=void 0,b=void 0,this.ctx.lineTo(this.width,this.yAxis),this.ctx.stroke()},a.prototype.running=!0,a.prototype.loop=function(){!0===this.running&&this.update(),window.requestAnimationFrame(this.loop.bind(this))},a.prototype.Waves=o,a.prototype.Ease=n,a}),function(a){"use strict";function b(c,d){var e=a.proxy(this.process,this);this.$body=a("body"),this.$scrollElement=a(a(c).is("body")?window:c),this.options=a.extend({},b.DEFAULTS,d),this.selector=(this.options.target||"")+" li > a",this.offsets=[],this.targets=[],this.activeTarget=null,this.scrollHeight=0,this.$scrollElement.on("scroll.bs.scrollspy",e),this.refresh(),this.process()}function c(c){return this.each(function(){var d=a(this),e=d.data("bs.scrollspy"),f="object"==typeof c&&c;e||d.data("bs.scrollspy",e=new b(this,f)),"string"==typeof c&&e[c]()})}b.VERSION="3.3.2",b.DEFAULTS={offset:10},b.prototype.getScrollHeight=function(){return this.$scrollElement[0].scrollHeight||Math.max(this.$body[0].scrollHeight,document.documentElement.scrollHeight)},b.prototype.refresh=function(){var b="offset",c=0;a.isWindow(this.$scrollElement[0])||(b="position",c=this.$scrollElement.scrollTop()),this.offsets=[],this.targets=[],this.scrollHeight=this.getScrollHeight();var d=this;this.$body.find(this.selector).map(function(){var d=a(this),e=d.data("target")||d.attr("href"),f=/^#./.test(e)&&a(e);return f&&f.length&&f.is(":visible")&&[[f[b]().top+c,e]]||null}).sort(function(a,b){return a[0]-b[0]}).each(function(){d.offsets.push(this[0]),d.targets.push(this[1])})},b.prototype.process=function(){var a,b=this.$scrollElement.scrollTop()+this.options.offset,c=this.getScrollHeight(),d=this.options.offset+c-this.$scrollElement.height(),e=this.offsets,f=this.targets,g=this.activeTarget;if(this.scrollHeight!=c&&this.refresh(),b>=d)return g!=(a=f[f.length-1])&&this.activate(a);if(g&&b<e[0])return this.activeTarget=null,this.clear();for(a=e.length;a--;)g!=f[a]&&b>=e[a]&&(!e[a+1]||b<=e[a+1])&&this.activate(f[a])},b.prototype.activate=function(b){this.activeTarget=b,this.clear();var c=window.location.href.split("#"),d="/"==c[0].charAt(c[0].length-1)?c[0]:c[0]+"/",e=this.selector+'[data-target="'+b+'"],'+this.selector+'[href="'+b+'"],'+this.selector+'[href="'+d+b+'"]',f=a(e).parents("li").addClass("current-menu-item");f.parent(".sub-menu").length&&(f=f.closest("li.fusion-dropdown-menu").addClass("current-menu-item")),f.trigger("activate.bs.scrollspy")},b.prototype.clear=function(){a(this.selector).parentsUntil(this.options.target,".current-menu-item").removeClass("current-menu-item"),a(this.selector).parentsUntil(this.options.target,".current-menu-parent").removeClass("current-menu-parent")};var d=a.fn.scrollspy;a.fn.scrollspy=c,a.fn.scrollspy.Constructor=b,a.fn.scrollspy.noConflict=function(){return a.fn.scrollspy=d,this}}(jQuery);var Froogaloop=function(){function a(b){return new a.fn.init(b)}function b(a,b,c){if(!c.contentWindow.postMessage)return!1;a=JSON.stringify({method:a,value:b}),c.contentWindow.postMessage(a,g)}function c(a){var b,c;try{b=JSON.parse(a.data),c=b.event||b.method}catch(a){}if("ready"!=c||f||(f=!0),!/^https?:\/\/player.vimeo.com/.test(a.origin))return!1;"*"===g&&(g=a.origin),a=b.value;var d=b.data,h=""===h?null:b.player_id;return b=h?e[h][c]:e[c],c=[],!!b&&(void 0!==a&&c.push(a),d&&c.push(d),h&&c.push(h),0<c.length?b.apply(null,c):b.call())}function d(a,b,c){c?(e[c]||(e[c]={}),e[c][a]=b):e[a]=b}var e={},f=!1,g="*";return a.fn=a.prototype={element:null,init:function(a){return"string"==typeof a&&(a=document.getElementById(a)),this.element=a,this},api:function(a,c){if(!this.element||!a)return!1;var e=this.element,f=""!==e.id?e.id:null,g=c&&c.constructor&&c.call&&c.apply?null:c,h=c&&c.constructor&&c.call&&c.apply?c:null;return h&&d(a,h,f),b(a,g,e),this},addEvent:function(a,c){if(!this.element)return!1;var e=this.element,g=""!==e.id?e.id:null;return d(a,c,g),"ready"!=a?b("addEventListener",a,e):"ready"==a&&f&&c.call(null,g),this},removeEvent:function(a){if(!this.element)return!1;var c=this.element,d=""!==c.id?c.id:null;a:{if(d&&e[d]){if(!e[d][a]){d=!1;break a}e[d][a]=null}else{if(!e[a]){d=!1;break a}e[a]=null}d=!0}"ready"!=a&&d&&b("removeEventListener",a,c)}},a.fn.init.prototype=a.fn,window.addEventListener?window.addEventListener("message",c,!1):window.attachEvent("onmessage",c),window.Froogaloop=window.$f=a}();!function(a){function b(a){var b=a.__resizeTriggers__,c=b.firstElementChild,d=b.lastElementChild,e=c.firstElementChild;d.scrollLeft=d.scrollWidth,d.scrollTop=d.scrollHeight,e.style.width=c.offsetWidth+1+"px",e.style.height=c.offsetHeight+1+"px",c.scrollLeft=c.scrollWidth,c.scrollTop=c.scrollHeight}function c(a){return a.offsetWidth!=a.__resizeLast__.width||a.offsetHeight!=a.__resizeLast__.height}function d(a){var d=this;b(this),this.__resizeRAF__&&j(this.__resizeRAF__),this.__resizeRAF__=i(function(){c(d)&&(d.__resizeLast__.width=d.offsetWidth,d.__resizeLast__.height=d.offsetHeight,d.__resizeListeners__.forEach(function(b){b.call(d,a)}))})}function e(){if(!g){var a=(t||"")+".resize-triggers { "+(u||"")+'visibility: hidden; opacity: 0; } .resize-triggers, .resize-triggers > div, .contract-trigger:before { content: " "; display: block; position: absolute; top: 0; left: 0; height: 100%; width: 100%; overflow: hidden; } .resize-triggers > div { background: #eee; overflow: auto; } .contract-trigger:before { width: 200%; height: 200%; }',b=document.head||document.getElementsByTagName("head")[0],c=document.createElement("style");c.type="text/css",c.styleSheet?c.styleSheet.cssText=a:c.appendChild(document.createTextNode(a)),b.appendChild(c),g=!0}}var f=document.attachEvent,g=!1,h=a.fn.resize;if(a.fn.resize=function(a){return this.each(function(){this==window?h.call(jQuery(this),a):addResizeListener(this,a)})},a.fn.removeResize=function(a){return this.each(function(){removeResizeListener(this,a)})},!f){var i=function(){var a=window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||function(a){return window.setTimeout(a,20)};return function(b){return a(b)}}(),j=function(){var a=window.cancelAnimationFrame||window.mozCancelAnimationFrame||window.webkitCancelAnimationFrame||window.clearTimeout;return function(b){return a(b)}}(),k=!1,l="",m="animationstart",n="Webkit Moz O ms".split(" "),o="webkitAnimationStart animationstart oAnimationStart MSAnimationStart".split(" "),p="",q=document.createElement("fakeelement");if(void 0!==q.style.animationName&&(k=!0),!1===k)for(var r=0;r<n.length;r++)if(void 0!==q.style[n[r]+"AnimationName"]){p=n[r],p+"Animation",l="-"+p.toLowerCase()+"-",m=o[r],k=!0;break}var s="resizeanim",t="@"+l+"keyframes "+s+" { from { opacity: 0; } to { opacity: 0; } } ",u=l+"animation: 1ms "+s+"; "}window.addResizeListener=function(a,c){f?a.attachEvent("onresize",c):(a.__resizeTriggers__||("static"==getComputedStyle(a).position&&(a.style.position="relative"),e(),a.__resizeLast__={},a.__resizeListeners__=[],(a.__resizeTriggers__=document.createElement("div")).className="resize-triggers",a.__resizeTriggers__.innerHTML='<div class="expand-trigger"><div></div></div><div class="contract-trigger"></div>',a.appendChild(a.__resizeTriggers__),b(a),a.addEventListener("scroll",d,!0),m&&a.__resizeTriggers__.addEventListener(m,function(c){c.animationName==s&&b(a)})),a.__resizeListeners__.push(c))},window.removeResizeListener=function(a,b){f?a.detachEvent("onresize",b):(a.__resizeListeners__.splice(a.__resizeListeners__.indexOf(b),1),a.__resizeListeners__.length||(a.removeEventListener("scroll",d),a.__resizeTriggers__=!a.removeChild(a.__resizeTriggers__)))}}(jQuery),function(a){a.easing.jswing=a.easing.swing,a.extend(a.easing,{def:"easeOutQuad",swing:function(b,c,d,e,f){return a.easing[a.easing.def](b,c,d,e,f)},easeInQuad:function(a,b,c,d,e){return d*(b/=e)*b+c},easeOutQuad:function(a,b,c,d,e){return-d*(b/=e)*(b-2)+c},easeInOutQuad:function(a,b,c,d,e){return 1>(b/=e/2)?d/2*b*b+c:-d/2*(--b*(b-2)-1)+c},easeInCubic:function(a,b,c,d,e){return d*(b/=e)*b*b+c},easeOutCubic:function(a,b,c,d,e){return d*((b=b/e-1)*b*b+1)+c},easeInOutCubic:function(a,b,c,d,e){return 1>(b/=e/2)?d/2*b*b*b+c:d/2*((b-=2)*b*b+2)+c},easeInQuart:function(a,b,c,d,e){return d*(b/=e)*b*b*b+c},easeOutQuart:function(a,b,c,d,e){return-d*((b=b/e-1)*b*b*b-1)+c},easeInOutQuart:function(a,b,c,d,e){return 1>(b/=e/2)?d/2*b*b*b*b+c:-d/2*((b-=2)*b*b*b-2)+c},easeInQuint:function(a,b,c,d,e){return d*(b/=e)*b*b*b*b+c},easeOutQuint:function(a,b,c,d,e){return d*((b=b/e-1)*b*b*b*b+1)+c},easeInOutQuint:function(a,b,c,d,e){return 1>(b/=e/2)?d/2*b*b*b*b*b+c:d/2*((b-=2)*b*b*b*b+2)+c},easeInSine:function(a,b,c,d,e){return-d*Math.cos(b/e*(Math.PI/2))+d+c},easeOutSine:function(a,b,c,d,e){return d*Math.sin(b/e*(Math.PI/2))+c},easeInOutSine:function(a,b,c,d,e){return-d/2*(Math.cos(Math.PI*b/e)-1)+c},easeInExpo:function(a,b,c,d,e){return 0==b?c:d*Math.pow(2,10*(b/e-1))+c},easeOutExpo:function(a,b,c,d,e){return b==e?c+d:d*(1-Math.pow(2,-10*b/e))+c},easeInOutExpo:function(a,b,c,d,e){return 0==b?c:b==e?c+d:1>(b/=e/2)?d/2*Math.pow(2,10*(b-1))+c:d/2*(2-Math.pow(2,-10*--b))+c},easeInCirc:function(a,b,c,d,e){return-d*(Math.sqrt(1-(b/=e)*b)-1)+c},easeOutCirc:function(a,b,c,d,e){return d*Math.sqrt(1-(b=b/e-1)*b)+c},easeInOutCirc:function(a,b,c,d,e){return 1>(b/=e/2)?-d/2*(Math.sqrt(1-b*b)-1)+c:d/2*(Math.sqrt(1-(b-=2)*b)+1)+c},easeInElastic:function(a,b,c,d,e){a=1.70158;var f=0,g=d;return 0==b?c:1==(b/=e)?c+d:(f||(f=.3*e),g<Math.abs(d)?(g=d,a=f/4):a=f/(2*Math.PI)*Math.asin(d/g),-g*Math.pow(2,10*--b)*Math.sin(2*(b*e-a)*Math.PI/f)+c)},easeOutElastic:function(a,b,c,d,e){a=1.70158;var f=0,g=d;return 0==b?c:1==(b/=e)?c+d:(f||(f=.3*e),g<Math.abs(d)?(g=d,a=f/4):a=f/(2*Math.PI)*Math.asin(d/g),g*Math.pow(2,-10*b)*Math.sin(2*(b*e-a)*Math.PI/f)+d+c)},easeInOutElastic:function(a,b,c,d,e){a=1.70158;var f=0,g=d;return 0==b?c:2==(b/=e/2)?c+d:(f||(f=.3*e*1.5),g<Math.abs(d)?(g=d,a=f/4):a=f/(2*Math.PI)*Math.asin(d/g),1>b?-.5*g*Math.pow(2,10*--b)*Math.sin(2*(b*e-a)*Math.PI/f)+c:g*Math.pow(2,-10*--b)*Math.sin(2*(b*e-a)*Math.PI/f)*.5+d+c)},easeInBack:function(a,b,c,d,e,f){return void 0==f&&(f=1.70158),d*(b/=e)*b*((f+1)*b-f)+c},easeOutBack:function(a,b,c,d,e,f){return void 0==f&&(f=1.70158),d*((b=b/e-1)*b*((f+1)*b+f)+1)+c},easeInOutBack:function(a,b,c,d,e,f){return void 0==f&&(f=1.70158),1>(b/=e/2)?d/2*b*b*((1+(f*=1.525))*b-f)+c:d/2*((b-=2)*b*((1+(f*=1.525))*b+f)+2)+c},easeInBounce:function(b,c,d,e,f){return e-a.easing.easeOutBounce(b,f-c,0,e,f)+d},easeOutBounce:function(a,b,c,d,e){return(b/=e)<1/2.75?7.5625*d*b*b+c:b<2/2.75?d*(7.5625*(b-=1.5/2.75)*b+.75)+c:b<2.5/2.75?d*(7.5625*(b-=2.25/2.75)*b+.9375)+c:d*(7.5625*(b-=2.625/2.75)*b+.984375)+c},easeInOutBounce:function(b,c,d,e,f){return c<f/2?.5*a.easing.easeInBounce(b,2*c,0,e,f)+d:.5*a.easing.easeOutBounce(b,2*c-f,0,e,f)+.5*e+d}})}(jQuery),function(a){a.extend(a.easing,{easeIn:function(b,c,d,e,f){return a.easing.easeInQuad(b,c,d,e,f)},easeOut:function(b,c,d,e,f){return a.easing.easeOutQuad(b,c,d,e,f)},easeInOut:function(b,c,d,e,f){return a.easing.easeInOutQuad(b,c,d,e,f)},expoin:function(b,c,d,e,f){return a.easing.easeInExpo(b,c,d,e,f)},expoout:function(b,c,d,e,f){return a.easing.easeOutExpo(b,c,d,e,f)},expoinout:function(b,c,d,e,f){return a.easing.easeInOutExpo(b,c,d,e,f)},bouncein:function(b,c,d,e,f){return a.easing.easeInBounce(b,c,d,e,f)},bounceout:function(b,c,d,e,f){return a.easing.easeOutBounce(b,c,d,e,f)},bounceinout:function(b,c,d,e,f){return a.easing.easeInOutBounce(b,c,d,e,f)},elasin:function(b,c,d,e,f){return a.easing.easeInElastic(b,c,d,e,f)},elasout:function(b,c,d,e,f){return a.easing.easeOutElastic(b,c,d,e,f)},elasinout:function(b,c,d,e,f){return a.easing.easeInOutElastic(b,c,d,e,f)},backin:function(b,c,d,e,f){return a.easing.easeInBack(b,c,d,e,f)},backout:function(b,c,d,e,f){return a.easing.easeOutBack(b,c,d,e,f)},backinout:function(b,c,d,e,f){return a.easing.easeInOutBack(b,c,d,e,f)}})}(jQuery),function(a){"use strict";function b(a){var b={path:!0,query:!0,hash:!0};return a?(/^[a-z]+:/.test(a)&&(b.protocol=!0,b.host=!0,/[-a-z0-9]+(\.[-a-z0-9])*:\d+/i.test(a)&&(b.port=!0),/\/\/(.*?)(?::(.*?))?@/.test(a)&&(b.user=!0,b.pass=!0)),b):b}function c(a,c,d){var l,m,n,o=h?"file://"+(process.platform.match(/^win/i)?"/":"")+i("fs").realpathSync("."):document.location.href;c||(c=o),h?l=i("url").parse(c):(l=document.createElement("a"),l.href=c);var p=b(c);n=c.match(/\/\/(.*?)(?::(.*?))?@/)||[];for(m in j)a[m]=p[m]?l[j[m]]||"":"";if(a.protocol=a.protocol.replace(/:$/,""),a.query=a.query.replace(/^\?/,""),a.hash=e(a.hash.replace(/^#/,"")),a.user=e(n[1]||""),a.pass=e(n[2]||""),a.port=k[a.protocol]==a.port||0==a.port?"":a.port,!p.protocol&&/[^\/#?]/.test(c.charAt(0))&&(a.path=c.split("?")[0].split("#")[0]),!p.protocol&&d){var q=new g(o.match(/(.*\/)/)[0]),r=q.path.split("/"),s=a.path.split("/"),t=["protocol","user","pass","host","port"],u=t.length;for(r.pop(),m=0;u>m;m++)a[t[m]]=q[t[m]];for(;".."===s[0];)r.pop(),s.shift();a.path=("/"!==c.charAt(0)?r.join("/"):"")+"/"+s.join("/")}a.path=a.path.replace(/^\/{2,}/,"/"),a.paths(("/"===a.path.charAt(0)?a.path.slice(1):a.path).split("/")),a.query=new f(a.query)}function d(a){return encodeURIComponent(a).replace(/'/g,"%27")}function e(a){return a=a.replace(/\+/g," "),a=a.replace(/%([ef][0-9a-f])%([89ab][0-9a-f])%([89ab][0-9a-f])/gi,function(a,b,c,d){var e=parseInt(b,16)-224,f=parseInt(c,16)-128;if(0===e&&32>f)return a;var g=parseInt(d,16)-128,h=(e<<12)+(f<<6)+g;return h>65535?a:String.fromCharCode(h)}),a=a.replace(/%([cd][0-9a-f])%([89ab][0-9a-f])/gi,function(a,b,c){var d=parseInt(b,16)-192;if(2>d)return a;var e=parseInt(c,16)-128;return String.fromCharCode((d<<6)+e)}),a.replace(/%([0-7][0-9a-f])/gi,function(a,b){return String.fromCharCode(parseInt(b,16))})}function f(a){for(var b,c=/([^=&]+)(=([^&]*))?/g;b=c.exec(a);){var d=decodeURIComponent(b[1].replace(/\+/g," ")),f=b[3]?e(b[3]):"";void 0!==this[d]&&null!==this[d]?(this[d]instanceof Array||(this[d]=[this[d]]),this[d].push(f)):this[d]=f}}function g(a,b){c(this,a,!b)}var h="undefined"==typeof window&&"undefined"!=typeof global&&"function"==typeof require,i=h?a.require:null,j={protocol:"protocol",host:"hostname",port:"port",path:"pathname",query:"search",hash:"hash"},k={ftp:21,gopher:70,http:80,https:443,ws:80,wss:443};f.prototype.toString=function(){var a,b,c="",e=d;for(a in this)if(!(this[a]instanceof Function||null===this[a]))if(this[a]instanceof Array){var f=this[a].length;if(f)for(b=0;f>b;b++)c+=c?"&":"",c+=e(a)+"="+e(this[a][b]);else c+=(c?"&":"")+e(a)+"="}else c+=c?"&":"",c+=e(a)+"="+e(this[a]);return c},g.prototype.clearQuery=function(){for(var a in this.query)this.query[a]instanceof Function||delete this.query[a];return this},g.prototype.queryLength=function(){var a,b=0;for(a in this)this[a]instanceof Function||b++;return b},g.prototype.isEmptyQuery=function(){return 0===this.queryLength()},g.prototype.paths=function(a){var b,c="",f=0;if(a&&a.length&&a+""!==a){for(this.isAbsolute()&&(c="/"),b=a.length;b>f;f++)a[f]=!f&&a[f].match(/^\w:$/)?a[f]:d(a[f]);this.path=c+a.join("/")}for(a=("/"===this.path.charAt(0)?this.path.slice(1):this.path).split("/"),f=0,b=a.length;b>f;f++)a[f]=e(a[f]);return a},g.prototype.encode=d,g.prototype.decode=e,g.prototype.isAbsolute=function(){return this.protocol||"/"===this.path.charAt(0)},g.prototype.toString=function(){return(this.protocol&&this.protocol+"://")+(this.user&&d(this.user)+(this.pass&&":"+d(this.pass))+"@")+(this.host&&this.host)+(this.port&&":"+this.port)+(this.path&&this.path)+(this.query.toString()&&"?"+this.query)+(this.hash&&"#"+d(this.hash))},a[a.exports?"exports":"Url"]=g}("undefined"!=typeof module&&module.exports?module:window);