PageSourceSearch

https://sandpitjs.com/static/js/main.d6114586.js

js sandpitjs.com collected 2026-09-25 22:04:46 UTC 664,668 bytes, 2 lines download raw bytes

1!function(t){function e(i){if(n[i])return n[i].exports;var r=n[i]={i:i,l:!1,exports:{}};return t[i].call(r.exports,r,r.exports,e),r.l=!0,r.exports}var n={};e.m=t,e.c=n,e.d=function(t,n,i){e.o(t,n)||Object.defineProperty(t,n,{configurable:!1,enumerable:!0,get:i})},e.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,"a",n),n},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="/",e(e.s=4)}([function(t,e,n){"use strict";(function(t,i){function r(t,e){return e={exports:{}},t(e,e.exports),e.exports}function o(t){if(null===t||void 0===t)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(t)}function a(t,e){try{return decodeURIComponent(t.join(""))}catch(t){}if(1===t.length)return t;e=e||1;var n=t.slice(0,e),i=t.slice(e);return Array.prototype.concat.call([],a(n),a(i))}function s(t){try{return decodeURIComponent(t)}catch(i){for(var e=t.match(F),n=1;n<e.length;n++)t=a(e,n).join(""),e=t.match(F);return t}}function c(t){for(var e={"%FE%FF":"\ufffd\ufffd","%FF%FE":"\ufffd\ufffd"},n=z.exec(t);n;){try{e[n[0]]=decodeURIComponent(n[0])}catch(t){var i=s(n[0]);i!==n[0]&&(e[n[0]]=i)}n=z.exec(t)}e["%C2"]="\ufffd";for(var r=Object.keys(e),o=0;o<r.length;o++){var a=r[o];t=t.replace(new RegExp(a,"g"),e[a])}return t}function l(t){switch(t.arrayFormat){case"index":return function(e,n,i){return null===n?[u(e,t),"[",i,"]"].join(""):[u(e,t),"[",u(i,t),"]=",u(n,t)].join("")};case"bracket":return function(e,n){return null===n?u(e,t):[u(e,t),"[]=",u(n,t)].join("")};default:return function(e,n){return null===n?u(e,t):[u(e,t),"=",u(n,t)].join("")}}}function h(t){var e;switch(t.arrayFormat){case"index":return function(t,n,i){if(e=/\[(\d*)\]$/.exec(t),t=t.replace(/\[\d*\]$/,""),!e)return void(i[t]=n);void 0===i[t]&&(i[t]={}),i[t][e[1]]=n};case"bracket":return function(t,n,i){return e=/(\[\])$/.exec(t),t=t.replace(/\[\]$/,""),e?void 0===i[t]?void(i[t]=[n]):void(i[t]=[].concat(i[t],n)):void(i[t]=n)};default:return function(t,e,n){if(void 0===n[t])return void(n[t]=e);n[t]=[].concat(n[t],e)}}}function u(t,e){return e.encode?e.strict?O(t):encodeURIComponent(t):t}function d(t){return Array.isArray(t)?t.sort():"object"===("undefined"===typeof t?"undefined":A(t))?d(Object.keys(t)).sort(function(t,e){return Number(t)-Number(e)}).map(function(e){return t[e]}):t}function p(){for(var t={},e=Object.keys(st),n=e.length,i=0;i<n;i++)t[e[i]]={distance:-1,parent:null};return t}function f(t){var e=p(),n=[t];for(e[t].distance=0;n.length;)for(var i=n.pop(),r=Object.keys(st[i]),o=r.length,a=0;a<o;a++){var s=r[a],c=e[s];-1===c.distance&&(c.distance=e[i].distance+1,c.parent=i,n.unshift(s))}return e}function m(t,e){return function(n){return e(t(n))}}function v(t,e){for(var n=[e[t].parent,t],i=st[e[t].parent][t],r=e[t].parent;e[r].parent;)n.unshift(e[r].parent),i=m(st[e[r].parent][r],i),r=e[r].parent;return i.conversion=n,i}function g(t){var e=function(e){return void 0===e||null===e?e:(arguments.length>1&&(e=Array.prototype.slice.call(arguments)),t(e))};return"conversion"in t&&(e.conversion=t.conversion),e}function y(t){var e=function(e){if(void 0===e||null===e)return e;arguments.length>1&&(e=Array.prototype.slice.call(arguments));var n=t(e);if("object"===("undefined"===typeof n?"undefined":A(n)))for(var i=n.length,r=0;r<i;r++)n[r]=Math.round(n[r]);return n};return"conversion"in t&&(e.conversion=t.conversion),e}function _(t,e){if(!(this instanceof _))return new _(t,e);if(e&&e in dt&&(e=null),e&&!(e in ht))throw new Error("Unknown model: "+e);var n,i;if(t)if(t instanceof _)this.model=t.model,this.color=t.color.slice(),this.valpha=t.valpha;else if("string"===typeof t){var r=at.get(t);if(null===r)throw new Error("Unable to parse color from string: "+t);this.model=r.model,i=ht[this.model].channels,this.color=r.value.slice(0,i),this.valpha="number"===typeof r.value[i]?r.value[i]:1}else if(t.length){this.model=e||"rgb",i=ht[this.model].channels;var o=ut.call(t,0,i);this.color=T(o,i),this.valpha="number"===typeof t[i]?t[i]:1}else if("number"===typeof t)t&=16777215,this.model="rgb",this.color=[t>>16&255,t>>8&255,255&t],this.valpha=1;else{this.valpha=1;var a=Object.keys(t);"alpha"in t&&(a.splice(a.indexOf("alpha"),1),this.valpha="number"===typeof t.alpha?t.alpha:0);var s=a.sort().join("");if(!(s in pt))throw new Error("Unable to parse color from object: "+JSON.stringify(t));this.model=pt[s];var c=ht[this.model].labels,l=[];for(n=0;n<c.length;
1n++)l.push(t[c[n]]);this.color=T(l)}else this.model="rgb",this.color=[0,0,0],this.valpha=1;if(ft[this.model])for(i=ht[this.model].channels,n=0;n<i;n++){var h=ft[this.model][n];h&&(this.color[n]=h(this.color[n]))}this.valpha=Math.max(0,Math.min(1,this.valpha)),Object.freeze&&Object.freeze(this)}function b(t,e){return Number(t.toFixed(e))}function x(t){return function(e){return b(e,t)}}function w(t,e,n){return t=Array.isArray(t)?t:[t],t.forEach(function(t){(ft[t]||(ft[t]=[]))[e]=n}),t=t[0],function(i){var r;return arguments.length?(n&&(i=n(i)),r=this[t](),r.color[e]=i,r):(r=this[t]().color[e],n&&(r=n(r)),r)}}function M(t){return function(e){return Math.max(0,Math.min(t,e))}}function E(t){return Array.isArray(t)?t:[t]}function T(t,e){for(var n=0;n<e;n++)"number"!==typeof t[n]&&(t[n]=0);return t}n.d(e,"b",function(){return gt}),n.d(e,"a",function(){return mt}),n.d(e,"c",function(){return _t});var S="undefined"!==typeof window?window:"undefined"!==typeof t?t:"undefined"!==typeof self?self:{},A="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"===typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},L=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},R=function(){function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}}(),C=r(function(t,e){!function(t,n){!function(t){function e(t,e){var n=t.__state.conversionName.toString(),i=Math.round(t.r),r=Math.round(t.g),o=Math.round(t.b),a=t.a,s=Math.round(t.h),c=t.s.toFixed(1),l=t.v.toFixed(1);if(e||"THREE_CHAR_HEX"===n||"SIX_CHAR_HEX"===n){for(var h=t.hex.toString(16);h.length<6;)h="0"+h;return"#"+h}return"CSS_RGB"===n?"rgb("+i+","+r+","+o+")":"CSS_RGBA"===n?"rgba("+i+","+r+","+o+","+a+")":"HEX"===n?"0x"+t.hex.toString(16):"RGB_ARRAY"===n?"["+i+","+r+","+o+"]":"RGBA_ARRAY"===n?"["+i+","+r+","+o+","+a+"]":"RGB_OBJ"===n?"{r:"+i+",g:"+r+",b:"+o+"}":"RGBA_OBJ"===n?"{r:"+i+",g:"+r+",b:"+o+",a:"+a+"}":"HSV_OBJ"===n?"{h:"+s+",s:"+c+",v:"+l+"}":"HSVA_OBJ"===n?"{h:"+s+",s:"+c+",v:"+l+",a:"+a+"}":"unknown format"}function n(t,e,n){Object.defineProperty(t,e,{get:function(){return"RGB"===this.__state.space?this.__state[e]:(G.recalculateRGB(this,e,n),this.__state[e])},set:function(t){"RGB"!==this.__state.space&&(G.recalculateRGB(this,e,n),this.__state.space="RGB"),this.__state[e]=t}})}function i(t,e){Object.defineProperty(t,e,{get:function(){return"HSV"===this.__state.space?this.__state[e]:(G.recalculateHSV(this),this.__state[e])},set:function(t){"HSV"!==this.__state.space&&(G.recalculateHSV(this),this.__state.space="HSV"),this.__state[e]=t}})}function r(t){if("0"===t||R.isUndefined(t))return 0;var e=t.match(X);return R.isNull(e)?0:parseFloat(e[1])}function o(t){var e=t.toString();return e.indexOf(".")>-1?e.length-e.indexOf(".")-1:0}function a(t,e){var n=Math.pow(10,e);return Math.round(t*n)/n}function s(t,e,n,i,r){return i+(t-e)/(n-e)*(r-i)}function c(t,e,n,i){t.style.background="",R.each(nt,function(r){t.style.cssText+="background: "+r+"linear-gradient("+e+", "+n+" 0%, "+i+" 100%); "})}function l(t){t.style.background="",t.style.cssText+="background: -moz-linear-gradient(top,  #ff0000 0%, #ff00ff 17%, #0000ff 34%, #00ffff 50%, #00ff00 67%, #ffff00 84%, #ff0000 100%);",t.style.cssText+="background: -webkit-linear-gradient(top,  #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",t.style.cssText+="background: -o-linear-gradient(top,  #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",t.style.cssText+="background: -ms-linear-gradient(top,  #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",t.style.cssText+="background: linear-gradient(top,  #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);"}function h(t){setTimeout(t,1e3/60)}function u(t,e,n){var i=document.createElement("li");return e&&i.appendChild(e),n?t.__ul.insertBefore(i,n):t.__ul.appendChild(i),t.onResize(),i}function d(t){q.unbind(window,"resize",t.__resizeHandler),t.saveToLocalStorageIfPossible&&q.unbind(window,"unload",t.saveToLocalStorageIfPossible)}function p(t,e){var n=t.__preset_select[t.__preset_select.selectedIndex];n.innerHTML=e?n.value+"*":n.value}function f(t,e,n){if(n.__li=e,n.__gui=t,R.extend(n,{options:function(e){if(arguments.length>1){var i=n.__li.nextElementSibling;return n.remove(),v(t,n.object,n.property,{before:i,factoryArgs:[R.toArray(arguments)]})}if(R.isArray(e)||R.isObject(e)){var r=n.__li.nextElementSibling;return n.remove(),v(t,n.object,n.property,{before:r,factoryArgs:[e]})}},name:function(t){return n.__li.firstElementChild.firstElementChild.innerHTML=t,n},listen:function(){return n.__gui.listen(n),n},remove:function(){return n.__gui.remove(n),n}}),n instanceof $){var i=new K(n.object,n.property,{min:n.__min,max:n.__max,step:n.__step});R.each(["updateDisplay","onChange","onFinishChange","step"],function(t){var e=n[t],r=i[t];n[t]=i[t]=function(){var t=Array.prototype.slice.call(arguments);return r.apply(i,t),e.apply(n,t)}}),q.addClass(e,"has-slider"),n.domElement.insertBefore(i.domElement,n.domElement.firstElementChild)}else if(n instanceof K){var r=function(e){if(R.isNumber(n.__min)&&R.isNumber(n.__max)){var i=n.__li.firstElementChild.firstElementChild.innerHTML,r=n.__gui.__listening.indexOf(n)>-1;n.remove();var o=v(t,n.object,n.property,{before:n.__li.nextElementSibling,factoryArgs:[n.__min,n.__max,n.__step]});return o.name(i),r&&o.listen(),o}return e};
vendor: 5,111 bytes, line 1
1n.min=R.compose(r,n.min),n.max=R.compose(r,n.max)}else n instanceof Y?(q.bind(e,"click",function(){q.fakeEvent(n.__checkbox,"click")}),q.bind(n.__checkbox,"click",function(t){t.stopPropagation()})):n instanceof tt?(q.bind(e,"click",function(){q.fakeEvent(n.__button,"click")}),q.bind(e,"mouseover",function(){q.addClass(n.__button,"hover")}),q.bind(e,"mouseout",function(){q.removeClass(n.__button,"hover")})):n instanceof et&&(q.addClass(e,"color"),n.updateDisplay=R.compose(function(t){return e.style.borderLeftColor=n.__color.toString(),t},n.updateDisplay),n.updateDisplay());n.setValue=R.compose(function(e){return t.getRoot().__preset_select&&n.isModified()&&p(t.getRoot(),!0),e},n.setValue)}function m(t,e){var n=t.getRoot(),i=n.__rememberedObjects.indexOf(e.object);if(-1!==i){var r=n.__rememberedObjectIndecesToControllers[i];if(void 0===r&&(r={},n.__rememberedObjectIndecesToControllers[i]=r),r[e.property]=e,n.load&&n.load.remembered){var o=n.load.remembered,a=void 0;if(o[t.preset])a=o[t.preset];else{if(!o[ct])return;a=o[ct]}if(a[i]&&void 0!==a[i][e.property]){var s=a[i][e.property];e.initialValue=s,e.setValue(s)}}}}function v(t,e,n,i){if(void 0===e[n])throw new Error('Object "'+e+'" has no property "'+n+'"');var r=void 0;if(i.color)r=new et(e,n);else{var o=[e,n].concat(i.factoryArgs);r=rt.apply(t,o)}i.before instanceof H&&(i.before=i.before.__li),m(t,r),q.addClass(r.domElement,"c");var a=document.createElement("span");q.addClass(a,"property-name"),a.innerHTML=r.property;var s=document.createElement("div");s.appendChild(a),s.appendChild(r.domElement);var c=u(t,s,i.before);return q.addClass(c,mt.CLASS_CONTROLLER_ROW),r instanceof et?q.addClass(c,"color"):q.addClass(c,D(r.getValue())),f(t,c,r),t.__controllers.push(r),r}function g(t,e){return document.location.href+"."+e}function y(t,e,n){var i=document.createElement("option");i.innerHTML=e,i.value=e,t.__preset_select.appendChild(i),n&&(t.__preset_select.selectedIndex=t.__preset_select.length-1)}function _(t,e){e.style.display=t.useLocalStorage?"block":"none"}function b(t){var e=t.__save_row=document.createElement("li");q.addClass(t.domElement,"has-save"),t.__ul.insertBefore(e,t.__ul.firstChild),q.addClass(e,"save-row");var n=document.createElement("span");n.innerHTML="&nbsp;",q.addClass(n,"button gears");var i=document.createElement("span");i.innerHTML="Save",q.addClass(i,"button"),q.addClass(i,"save");var r=document.createElement("span");r.innerHTML="New",q.addClass(r,"button"),q.addClass(r,"save-as");var o=document.createElement("span");o.innerHTML="Revert",q.addClass(o,"button"),q.addClass(o,"revert");var a=t.__preset_select=document.createElement("select");if(t.load&&t.load.remembered?R.each(t.load.remembered,function(e,n){y(t,n,n===t.preset)}):y(t,ct,!1),q.bind(a,"change",function(){for(var e=0;e<t.__preset_select.length;e++)t.__preset_select[e].innerHTML=t.__preset_select[e].value;t.preset=this.value}),e.appendChild(a),e.appendChild(n),e.appendChild(i),e.appendChild(r),e.appendChild(o),lt){var s=document.getElementById("dg-local-explain"),c=document.getElementById("dg-local-storage");document.getElementById("dg-save-locally").style.display="block","true"===localStorage.getItem(g(t,"isLocal"))&&c.setAttribute("checked","checked"),_(t,s),q.bind(c,"change",function(){t.useLocalStorage=!t.useLocalStorage,_(t,s)})}var l=document.getElementById("dg-new-constructor");q.bind(l,"keydown",function(t){!t.metaKey||67!==t.which&&67!==t.keyCode||ht.hide()}),q.bind(n,"click",function(){l.innerHTML=JSON.stringify(t.getSaveObject(),void 0,2),ht.show(),l.focus(),l.select()}),q.bind(i,"click",function(){t.save()}),q.bind(r,"click",function(){var e=prompt("Enter a new preset name.");e&&t.saveAs(e)}),q.bind(o,"click",function(){t.revert()})}function x(t){function e(e){return e.preventDefault(),t.width+=r-e.clientX,t.onResize(),r=e.clientX,!1}function n(){q.removeClass(t.__closeButton,mt.CLASS_DRAG),q.unbind(window,"mousemove",e),q.unbind(window,"mouseup",n)}function i(i){return i.preventDefault(),r=i.clientX,q.addClass(t.__closeButton,mt.CLASS_DRAG),q.bind(window,"mousemove",e),q.bind(window,"mouseup",n),!1}var r=void 0;t.__resize_handle=document.createElement("div"),R.extend(t.__resize_handle.style,{width:"6px",marginLeft:"-3px",height:"200px",cursor:"ew-resize",position:"absolute"}),q.bind(t.__resize_handle,"mousedown",i),q.bind(t.__closeButton,"mousedown",i),t.domElement.insertBefore(t.__resize_handle,t.domElement.firstElementChild)}function w(t,e){t.domElement.style.width=e+"px",t.__save_row&&t.autoPlace&&(t.__save_row.style.width=e+"px"),t.__closeButton&&(t.__closeButton.style.width=e+"px")}function M(t,e){var n={};return R.each(t.__rememberedObjects,function(i,r){var o={},a=t.__rememberedObjectIndecesToControllers[r];R.each(a,function(t,n){o[n]=e?t.initialValue:t.getValue()}),n[r]=o}),n}function E(t){for(var e=0;e<t.__preset_select.length;e++)t.__preset_select[e].value===t.preset&&(t.__preset_select.selectedIndex=e)}function T(t){0!==t.length&&ot.call(window,function(){T(t)}),R.each(t,function(t){t.updateDisplay()})}var S=Array.prototype.forEach,L=Array.prototype.slice,R={BREAK:{}
1,extend:function(t){return this.each(L.call(arguments,1),function(e){(this.isObject(e)?Object.keys(e):[]).forEach(function(n){this.isUndefined(e[n])||(t[n]=e[n])}.bind(this))},this),t},defaults:function(t){return this.each(L.call(arguments,1),function(e){(this.isObject(e)?Object.keys(e):[]).forEach(function(n){this.isUndefined(t[n])&&(t[n]=e[n])}.bind(this))},this),t},compose:function(){var t=L.call(arguments);return function(){for(var e=L.call(arguments),n=t.length-1;n>=0;n--)e=[t[n].apply(this,e)];return e[0]}},each:function(t,e,n){if(t)if(S&&t.forEach&&t.forEach===S)t.forEach(e,n);else if(t.length===t.length+0){var i=void 0,r=void 0;for(i=0,r=t.length;i<r;i++)if(i in t&&e.call(n,t[i],i)===this.BREAK)return}else for(var o in t)if(e.call(n,t[o],o)===this.BREAK)return},defer:function(t){setTimeout(t,0)},debounce:function(t,e,n){var i=void 0;return function(){function r(){i=null,n||t.apply(o,a)}var o=this,a=arguments,s=n||!i;clearTimeout(i),i=setTimeout(r,e),s&&t.apply(o,a)}},toArray:function(t){return t.toArray?t.toArray():L.call(t)},isUndefined:function(t){return void 0===t},isNull:function(t){return null===t},isNaN:function(t){function e(e){return t.apply(this,arguments)}return e.toString=function(){return t.toString()},e}(function(t){return isNaN(t)}),isArray:Array.isArray||function(t){return t.constructor===Array},isObject:function(t){return t===Object(t)},isNumber:function(t){return t===t+0},isString:function(t){return t===t+""},isBoolean:function(t){return!1===t||!0===t},isFunction:function(t){return"[object Function]"===Object.prototype.toString.call(t)}},C=[{litmus:R.isString,conversions:{THREE_CHAR_HEX:{read:function(t){var e=t.match(/^#([A-F0-9])([A-F0-9])([A-F0-9])$/i);return null!==e&&{space:"HEX",hex:parseInt("0x"+e[1].toString()+e[1].toString()+e[2].toString()+e[2].toString()+e[3].toString()+e[3].toString(),0)}},write:e},SIX_CHAR_HEX:{read:function(t){var e=t.match(/^#([A-F0-9]{6})$/i);return null!==e&&{space:"HEX",hex:parseInt("0x"+e[1].toString(),0)}},write:e},CSS_RGB:{read:function(t){var e=t.match(/^rgb\(\s*(.+)\s*,\s*(.+)\s*,\s*(.+)\s*\)/);return null!==e&&{space:"RGB",r:parseFloat(e[1]),g:parseFloat(e[2]),b:parseFloat(e[3])}},write:e},CSS_RGBA:{read:function(t){var e=t.match(/^rgba\(\s*(.+)\s*,\s*(.+)\s*,\s*(.+)\s*,\s*(.+)\s*\)/);return null!==e&&{space:"RGB",r:parseFloat(e[1]),g:parseFloat(e[2]),b:parseFloat(e[3]),a:parseFloat(e[4])}},write:e}}},{litmus:R.isNumber,conversions:{HEX:{read:function(t){return{space:"HEX",hex:t,conversionName:"HEX"}},write:function(t){return t.hex}}}},{litmus:R.isArray,conversions:{RGB_ARRAY:{read:function(t){return 3===t.length&&{space:"RGB",r:t[0],g:t[1],b:t[2]}},write:function(t){return[t.r,t.g,t.b]}},RGBA_ARRAY:{read:function(t){return 4===t.length&&{space:"RGB",r:t[0],g:t[1],b:t[2],a:t[3]}},write:function(t){return[t.r,t.g,t.b,t.a]}}}},{litmus:R.isObject,conversions:{RGBA_OBJ:{read:function(t){return!!(R.isNumber(t.r)&&R.isNumber(t.g)&&R.isNumber(t.b)&&R.isNumber(t.a))&&{space:"RGB",r:t.r,g:t.g,b:t.b,a:t.a}},write:function(t){return{r:t.r,g:t.g,b:t.b,a:t.a}}},RGB_OBJ:{read:function(t){return!!(R.isNumber(t.r)&&R.isNumber(t.g)&&R.isNumber(t.b))&&{space:"RGB",r:t.r,g:t.g,b:t.b}},write:function(t){return{r:t.r,g:t.g,b:t.b}}},HSVA_OBJ:{read:function(t){return!!(R.isNumber(t.h)&&R.isNumber(t.s)&&R.isNumber(t.v)&&R.isNumber(t.a))&&{space:"HSV",h:t.h,s:t.s,v:t.v,a:t.a}},write:function(t){return{h:t.h,s:t.s,v:t.v,a:t.a}}},HSV_OBJ:{read:function(t){return!!(R.isNumber(t.h)&&R.isNumber(t.s)&&R.isNumber(t.v))&&{space:"HSV",h:t.h,s:t.s,v:t.v}},write:function(t){return{h:t.h,s:t.s,v:t.v}}}}}],P=void 0,O=void 0,I=function(){O=!1;var t=arguments.length>1?R.toArray(arguments):arguments[0];return R.each(C,function(e){if(e.litmus(t))return R.each(e.conversions,function(e,n){if(P=e.read(t),!1===O&&!1!==P)return O=P,P.conversionName=n,P.conversion=e,R.BREAK}),R.BREAK}),O},U=void 0,N={hsv_to_rgb:function(t,e,n){var i=Math.floor(t/60)%6,r=t/60-Math.floor(t/60),o=n*(1-e),a=n*(1-r*e),s=n*(1-(1-r)*e),c=[[n,s,o],[a,n,o],[o,n,s],[o,a,n],[s,o,n],[n,o,a]][i];return{r:255*c[0],g:255*c[1],b:255*c[2]}},rgb_to_hsv:function(t,e,n){var i=Math.min(t,e,n),r=Math.max(t,e,n),o=r-i,a=void 0,s=void 0;return 0===r?{h:NaN,s:0,v:0}:(s=o/r,a=t===r?(e-n)/o:e===r?2+(n-t)/o:4+(t-e)/o,a/=6,a<0&&(a+=1),{h:360*a,s:s,v:r/255})},rgb_to_hex:function(t,e,n){var i=this.hex_with_component(0,2,t);return i=this.hex_with_component(i,1,e),i=this.hex_with_component(i,0,n)},component_from_hex:function(t,e){return t>>8*e&255},hex_with_component:function(t,e,n){return n<<(U=8*e)|t&~(255<<U)}},D="function"===typeof Symbol&&"symbol"===A(Symbol.iterator)?function(t){return"undefined"===typeof t?"undefined":A(t)}:function(t){return t&&"function"===typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":"undefined"===typeof t?"undefined":A(t)},F=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},z=function(){function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}}(),B=function t(e,n,i){null===e&&(e=Function.prototype);var r=Object.getOwnPropertyDescriptor(e,n);if(void 0===r){var o=Object.getPrototypeOf(e);return null===o?void 0:t(o,n,i)}if("value"in r)return r.value;var a=r.get;if(void 0!==a)return a.call(i)},k=function(t,e){if("function"!==typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+("undefined"===typeof e?"undefined":A(e)));t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)},j=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!==("undefined"===typeof e?"undefined":A(e))&&"function"!==typeof e?t:e},G=function(){function t(){if(F(this,t),this.__state=I.apply(this,arguments),!1===this.__state)throw new Error("Failed to interpret color arguments");this.__state.a=this.__state.a||1}return z(t,[{key:"toString",value:function(){return e(this)}},{key:"toHexString",value:function(){return e(this,!0)}},{key:"toOriginal",value:function(){return this.__state.conversion.write(this)}}]),t}();G.recalculateRGB=function(t,e,n){if("HEX"===t.__state.space)t.__state[e]=N.component_from_hex(t.__state.hex,n);else{if("HSV"!==t.__state.space)throw new Error("Corrupted color state");R.extend(t.__state,N.hsv_to_rgb(t.__state.h,t.__state.s,t.__state.v))}},G.recalculateHSV=function(t){var e=N.rgb_to_hsv(t.r,t.g,t.b);R.extend(t.__state,{s:e.s,v:e.v}),R.isNaN(e.h)?R.isUndefined(t.__state.h)&&(t.__state.h=0):t.__state.h=e.h},G.COMPONENTS=["r","g","b","h","s","v","hex","a"],n(G.prototype,"r",2),n(G.prototype,"g",1),n(G.prototype,"b",0),i(G.prototype,"h"),i(G.prototype,"s"),i(G.prototype,"v"),Object.defineProperty(G.prototype,"a",{get:function(){return this.__state.a},set:function(t){this.__state.a=t}}),Object.defineProperty(G.prototype,"hex",{get:function(){return"HEX"!==!this.__state.space&&(this.__state.hex=N.rgb_to_hex(this.r,this.g,this.b)),this.__state.hex}
vendor: 5,658 bytes, line 1
1,set:function(t){this.__state.space="HEX",this.__state.hex=t}});var H=function(){function t(e,n){F(this,t),this.initialValue=e[n],this.domElement=document.createElement("div"),this.object=e,this.property=n,this.__onChange=void 0,this.__onFinishChange=void 0}return z(t,[{key:"onChange",value:function(t){return this.__onChange=t,this}},{key:"onFinishChange",value:function(t){return this.__onFinishChange=t,this}},{key:"setValue",value:function(t){return this.object[this.property]=t,this.__onChange&&this.__onChange.call(this,t),this.updateDisplay(),this}},{key:"getValue",value:function(){return this.object[this.property]}},{key:"updateDisplay",value:function(){return this}},{key:"isModified",value:function(){return this.initialValue!==this.getValue()}}]),t}(),V={HTMLEvents:["change"],MouseEvents:["click","mousemove","mousedown","mouseup","mouseover"],KeyboardEvents:["keydown"]},W={};R.each(V,function(t,e){R.each(t,function(t){W[t]=e})});var X=/(\d+(\.\d+)?)px/,q={makeSelectable:function(t,e){void 0!==t&&void 0!==t.style&&(t.onselectstart=e?function(){return!1}:function(){},t.style.MozUserSelect=e?"auto":"none",t.style.KhtmlUserSelect=e?"auto":"none",t.unselectable=e?"on":"off")},makeFullscreen:function(t,e,n){var i=n,r=e;R.isUndefined(r)&&(r=!0),R.isUndefined(i)&&(i=!0),t.style.position="absolute",r&&(t.style.left=0,t.style.right=0),i&&(t.style.top=0,t.style.bottom=0)},fakeEvent:function(t,e,n,i){var r=n||{},o=W[e];if(!o)throw new Error("Event type "+e+" not supported.");var a=document.createEvent(o);switch(o){case"MouseEvents":var s=r.x||r.clientX||0,c=r.y||r.clientY||0;a.initMouseEvent(e,r.bubbles||!1,r.cancelable||!0,window,r.clickCount||1,0,0,s,c,!1,!1,!1,!1,0,null);break;case"KeyboardEvents":var l=a.initKeyboardEvent||a.initKeyEvent;R.defaults(r,{cancelable:!0,ctrlKey:!1,altKey:!1,shiftKey:!1,metaKey:!1,keyCode:void 0,charCode:void 0}),l(e,r.bubbles||!1,r.cancelable,window,r.ctrlKey,r.altKey,r.shiftKey,r.metaKey,r.keyCode,r.charCode);break;default:a.initEvent(e,r.bubbles||!1,r.cancelable||!0)}R.defaults(a,i),t.dispatchEvent(a)},bind:function(t,e,n,i){var r=i||!1;return t.addEventListener?t.addEventListener(e,n,r):t.attachEvent&&t.attachEvent("on"+e,n),q},unbind:function(t,e,n,i){var r=i||!1;return t.removeEventListener?t.removeEventListener(e,n,r):t.detachEvent&&t.detachEvent("on"+e,n),q},addClass:function(t,e){if(void 0===t.className)t.className=e;else if(t.className!==e){var n=t.className.split(/ +/);-1===n.indexOf(e)&&(n.push(e),t.className=n.join(" ").replace(/^\s+/,"").replace(/\s+$/,""))}return q},removeClass:function(t,e){if(e)if(t.className===e)t.removeAttribute("class");else{var n=t.className.split(/ +/),i=n.indexOf(e);-1!==i&&(n.splice(i,1),t.className=n.join(" "))}else t.className=void 0;return q},hasClass:function(t,e){return new RegExp("(?:^|\\s+)"+e+"(?:\\s+|$)").test(t.className)||!1},getWidth:function(t){var e=getComputedStyle(t);return r(e["border-left-width"])+r(e["border-right-width"])+r(e["padding-left"])+r(e["padding-right"])+r(e.width)},getHeight:function(t){var e=getComputedStyle(t);return r(e["border-top-width"])+r(e["border-bottom-width"])+r(e["padding-top"])+r(e["padding-bottom"])+r(e.height)},getOffset:function(t){var e=t,n={left:0,top:0};if(e.offsetParent)do{n.left+=e.offsetLeft,n.top+=e.offsetTop,e=e.offsetParent}while(e);return n},isActive:function(t){return t===document.activeElement&&(t.type||t.href)}},Y=function(t){function e(t,n){function i(){o.setValue(!o.__prev)}F(this,e);var r=j(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,n)),o=r;return r.__prev=r.getValue(),r.__checkbox=document.createElement("input"),r.__checkbox.setAttribute("type","checkbox"),q.bind(r.__checkbox,"change",i,!1),r.domElement.appendChild(r.__checkbox),r.updateDisplay(),r}return k(e,t),z(e,[{key:"setValue",value:function(t){var n=B(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"setValue",this).call(this,t);return this.__onFinishChange&&this.__onFinishChange.call(this,this.getValue()),this.__prev=this.getValue(),n}},{key:"updateDisplay",value:function(){return!0===this.getValue()?(this.__checkbox.setAttribute("checked","checked"),this.__checkbox.checked=!0,this.__prev=!0):(this.__checkbox.checked=!1,this.__prev=!1),B(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"updateDisplay",this).call(this)}}]),e}(H),Z=function(t){function e(t,n,i){F(this,e);var r=j(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,n)),o=i,a=r;if(r.__select=document.createElement("select"),R.isArray(o)){var s={};R.each(o,function(t){s[t]=t}),o=s}return R.each(o,function(t,e){var n=document.createElement("option");n.innerHTML=e,n.setAttribute("value",t),a.__select.appendChild(n)}),r.updateDisplay(),q.bind(r.__select,"change",function(){var t=this.options[this.selectedIndex].value;a.setValue(t)}),r.domElement.appendChild(r.__select),r}return k(e,t),z(e,[{key:"setValue",value:function(t){var n=B(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"setValue",this).call(this,t);return this.__onFinishChange&&this.__onFinishChange.call(this,this.getValue()),n}},{key:"updateDisplay",value:function(){return q.isActive(this.__select)?this:(this.__select.value=this.getValue(),B(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"updateDisplay",this).call(this))}}]),e}(H),J=function(t){function e(t,n){function i(){a.setValue(a.__input.value)}function r(){a.__onFinishChange&&a.__onFinishChange.call(a,a.getValue())}F(this,e);var o=j(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,n)),a=o;return o.__input=document.createElement("input"),o.__input.setAttribute("type","text"),q.bind(o.__input,"keyup",i),q.bind(o.__input,"change",i
1),q.bind(o.__input,"blur",r),q.bind(o.__input,"keydown",function(t){13===t.keyCode&&this.blur()}),o.updateDisplay(),o.domElement.appendChild(o.__input),o}return k(e,t),z(e,[{key:"updateDisplay",value:function(){return q.isActive(this.__input)||(this.__input.value=this.getValue()),B(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"updateDisplay",this).call(this)}}]),e}(H),Q=function(t){function e(t,n,i){F(this,e);var r=j(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,n)),a=i||{};return r.__min=a.min,r.__max=a.max,r.__step=a.step,R.isUndefined(r.__step)?0===r.initialValue?r.__impliedStep=1:r.__impliedStep=Math.pow(10,Math.floor(Math.log(Math.abs(r.initialValue))/Math.LN10))/10:r.__impliedStep=r.__step,r.__precision=o(r.__impliedStep),r}return k(e,t),z(e,[{key:"setValue",value:function(t){var n=t;return void 0!==this.__min&&n<this.__min?n=this.__min:void 0!==this.__max&&n>this.__max&&(n=this.__max),void 0!==this.__step&&n%this.__step!==0&&(n=Math.round(n/this.__step)*this.__step),B(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"setValue",this).call(this,n)}},{key:"min",value:function(t){return this.__min=t,this}},{key:"max",value:function(t){return this.__max=t,this}},{key:"step",value:function(t){return this.__step=t,this.__impliedStep=t,this.__precision=o(t),this}}]),e}(H),K=function(t){function e(t,n,i){function r(){var t=parseFloat(u.__input.value);R.isNaN(t)||u.setValue(t)}function o(){u.__onFinishChange&&u.__onFinishChange.call(u,u.getValue())}function a(){o()}function s(t){var e=d-t.clientY;u.setValue(u.getValue()+e*u.__impliedStep),d=t.clientY}function c(){q.unbind(window,"mousemove",s),q.unbind(window,"mouseup",c),o()}function l(t){q.bind(window,"mousemove",s),q.bind(window,"mouseup",c),d=t.clientY}F(this,e);var h=j(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,n,i));h.__truncationSuspended=!1;var u=h,d=void 0;return h.__input=document.createElement("input"),h.__input.setAttribute("type","text"),q.bind(h.__input,"change",r),q.bind(h.__input,"blur",a),q.bind(h.__input,"mousedown",l),q.bind(h.__input,"keydown",function(t){13===t.keyCode&&(u.__truncationSuspended=!0,this.blur(),u.__truncationSuspended=!1,o())}),h.updateDisplay(),h.domElement.appendChild(h.__input),h}return k(e,t),z(e,[{key:"updateDisplay",value:function(){return this.__input.value=this.__truncationSuspended?this.getValue():a(this.getValue(),this.__precision),B(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"updateDisplay",this).call(this)}}]),e}(Q),$=function(t){function e(t,n,i,r,o){function a(t){document.activeElement.blur(),q.bind(window,"mousemove",c),q.bind(window,"mouseup",l),c(t)}function c(t){t.preventDefault();var e=f.__background.getBoundingClientRect();return f.setValue(s(t.clientX,e.left,e.right,f.__min,f.__max)),!1}function l(){q.unbind(window,"mousemove",c),q.unbind(window,"mouseup",l),f.__onFinishChange&&f.__onFinishChange.call(f,f.getValue())}function h(t){1===t.touches.length&&(q.bind(window,"touchmove",u),q.bind(window,"touchend",d),u(t))}function u(t){var e=t.touches[0].clientX,n=f.__background.getBoundingClientRect();f.setValue(s(e,n.left,n.right,f.__min,f.__max))}function d(){q.unbind(window,"touchmove",u),q.unbind(window,"touchend",d),f.__onFinishChange&&f.__onFinishChange.call(f,f.getValue())}F(this,e);var p=j(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,n,{min:i,max:r,step:o})),f=p;return p.__background=document.createElement("div"),p.__foreground=document.createElement("div"),q.bind(p.__background,"mousedown",a),q.bind(p.__background,"touchstart",h),q.addClass(p.__background,"slider"),q.addClass(p.__foreground,"slider-fg"),p.updateDisplay(),p.__background.appendChild(p.__foreground),p.domElement.appendChild(p.__background),p}return k(e,t),z(e,[{key:"updateDisplay",value:function(){var t=(this.getValue()-this.__min)/(this.__max-this.__min);return this.__foreground.style.width=100*t+"%",B(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"updateDisplay",this).call(this)}}]),e}(Q),tt=function(t){function e(t,n,i){F(this,e);var r=j(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,n)),o=r;return r.__button=document.createElement("div"),r.__button.innerHTML=void 0===i?"Fire":i,q.bind(r.__button,"click",function(t){return t.preventDefault(),o.fire(),!1}),q.addClass(r.__button,"button"),r.domElement.appendChild(r.__button),r}return k(e,t),z(e,[{key:"fire",value:function(){this.__onChange&&this.__onChange.call(this),this.getValue().call(this.object),this.__onFinishChange&&this.__onFinishChange.call(this,this.getValue())}}]),e}(H),et=function(t){function e(t,n){function i(t){u(t),q.bind(window,"mousemove",u),q.bind(window,"touchmove",u),q.bind(window,"mouseup",o),q.bind(window,"touchend",o)}function r(t){d(t),q.bind(window,"mousemove",d),q.bind(window,"touchmove",d),q.bind(window,"mouseup",a),q.bind(window,"touchend",a)}function o(){q.unbind(window,"mousemove",u),q.unbind(window,"touchmove",u),q.unbind(window,"mouseup",o),q.unbind(window,"touchend",o),h()}function a(){q.unbind(window,"mousemove",d),q.unbind(window,"touchmove",d),q.unbind(window,"mouseup",a),q.unbind(window,"touchend",a),h()}function s(){var t=I(this.value);
vendor: 11,005 bytes, line 1
1!1!==t?(f.__color.__state=t,f.setValue(f.__color.toOriginal())):this.value=f.__color.toString()}function h(){f.__onFinishChange&&f.__onFinishChange.call(f,f.__color.toOriginal())}function u(t){-1===t.type.indexOf("touch")&&t.preventDefault();var e=f.__saturation_field.getBoundingClientRect(),n=t.touches&&t.touches[0]||t,i=n.clientX,r=n.clientY,o=(i-e.left)/(e.right-e.left),a=1-(r-e.top)/(e.bottom-e.top);return a>1?a=1:a<0&&(a=0),o>1?o=1:o<0&&(o=0),f.__color.v=a,f.__color.s=o,f.setValue(f.__color.toOriginal()),!1}function d(t){-1===t.type.indexOf("touch")&&t.preventDefault();var e=f.__hue_field.getBoundingClientRect(),n=t.touches&&t.touches[0]||t,i=n.clientY,r=1-(i-e.top)/(e.bottom-e.top);return r>1?r=1:r<0&&(r=0),f.__color.h=360*r,f.setValue(f.__color.toOriginal()),!1}F(this,e);var p=j(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,n));p.__color=new G(p.getValue()),p.__temp=new G(0);var f=p;p.domElement=document.createElement("div"),q.makeSelectable(p.domElement,!1),p.__selector=document.createElement("div"),p.__selector.className="selector",p.__saturation_field=document.createElement("div"),p.__saturation_field.className="saturation-field",p.__field_knob=document.createElement("div"),p.__field_knob.className="field-knob",p.__field_knob_border="2px solid ",p.__hue_knob=document.createElement("div"),p.__hue_knob.className="hue-knob",p.__hue_field=document.createElement("div"),p.__hue_field.className="hue-field",p.__input=document.createElement("input"),p.__input.type="text",p.__input_textShadow="0 1px 1px ",q.bind(p.__input,"keydown",function(t){13===t.keyCode&&s.call(this)}),q.bind(p.__input,"blur",s),q.bind(p.__selector,"mousedown",function(){q.addClass(this,"drag").bind(window,"mouseup",function(){q.removeClass(f.__selector,"drag")})}),q.bind(p.__selector,"touchstart",function(){q.addClass(this,"drag").bind(window,"touchend",function(){q.removeClass(f.__selector,"drag")})});var m=document.createElement("div");return R.extend(p.__selector.style,{width:"122px",height:"102px",padding:"3px",backgroundColor:"#222",boxShadow:"0px 1px 3px rgba(0,0,0,0.3)"}),R.extend(p.__field_knob.style,{position:"absolute",width:"12px",height:"12px",border:p.__field_knob_border+(p.__color.v<.5?"#fff":"#000"),boxShadow:"0px 1px 3px rgba(0,0,0,0.5)",borderRadius:"12px",zIndex:1}),R.extend(p.__hue_knob.style,{position:"absolute",width:"15px",height:"2px",borderRight:"4px solid #fff",zIndex:1}),R.extend(p.__saturation_field.style,{width:"100px",height:"100px",border:"1px solid #555",marginRight:"3px",display:"inline-block",cursor:"pointer"}),R.extend(m.style,{width:"100%",height:"100%",background:"none"}),c(m,"top","rgba(0,0,0,0)","#000"),R.extend(p.__hue_field.style,{width:"15px",height:"100px",border:"1px solid #555",cursor:"ns-resize",position:"absolute",top:"3px",right:"3px"}),l(p.__hue_field),R.extend(p.__input.style,{outline:"none",textAlign:"center",color:"#fff",border:0,fontWeight:"bold",textShadow:p.__input_textShadow+"rgba(0,0,0,0.7)"}),q.bind(p.__saturation_field,"mousedown",i),q.bind(p.__saturation_field,"touchstart",i),q.bind(p.__field_knob,"mousedown",i),q.bind(p.__field_knob,"touchstart",i),q.bind(p.__hue_field,"mousedown",r),q.bind(p.__hue_field,"touchstart",r),p.__saturation_field.appendChild(m),p.__selector.appendChild(p.__field_knob),p.__selector.appendChild(p.__saturation_field),p.__selector.appendChild(p.__hue_field),p.__hue_field.appendChild(p.__hue_knob),p.domElement.appendChild(p.__input),p.domElement.appendChild(p.__selector),p.updateDisplay(),p}return k(e,t),z(e,[{key:"updateDisplay",value:function(){var t=I(this.getValue());if(!1!==t){var e=!1;R.each(G.COMPONENTS,function(n){if(!R.isUndefined(t[n])&&!R.isUndefined(this.__color.__state[n])&&t[n]!==this.__color.__state[n])return e=!0,{}},this),e&&R.extend(this.__color.__state,t)}R.extend(this.__temp.__state,this.__color.__state),this.__temp.a=1;var n=this.__color.v<.5||this.__color.s>.5?255:0,i=255-n;R.extend(this.__field_knob.style,{marginLeft:100*this.__color.s-7+"px",marginTop:100*(1-this.__color.v)-7+"px",backgroundColor:this.__temp.toHexString(),border:this.__field_knob_border+"rgb("+n+","+n+","+n+")"}),this.__hue_knob.style.marginTop=100*(1-this.__color.h/360)+"px",this.__temp.s=1,this.__temp.v=1,c(this.__saturation_field,"left","#fff",this.__temp.toHexString()),this.__input.value=this.__color.toString(),R.extend(this.__input.style,{backgroundColor:this.__color.toHexString(),color:"rgb("+n+","+n+","+n+")",textShadow:this.__input_textShadow+"rgba("+i+","+i+","+i+",.7)"})}}]),e}(H),nt=["-moz-","-o-","-webkit-","-ms-",""],it={load:function(t,e){var n=e||document,i=n.createElement("link");i.type="text/css",i.rel="stylesheet",i.href=t,n.getElementsByTagName("head")[0].appendChild(i)},inject:function(t,e){var n=e||document,i=document.createElement("style");i.type="text/css",i.innerHTML=t;var r=n.getElementsByTagName("head")[0];try{r.appendChild(i)}catch(t){}}},rt=function(t,e){var n=t[e];return R.isArray(arguments[2])||R.isObject(arguments[2])?new Z(t,e,arguments[2]):R.isNumber(n)?R.isNumber(arguments[2])&&R.isNumber(arguments[3])?R.isNumber(arguments[4])?new $(t,e,arguments[2],arguments[3],arguments[4]):new $(t,e,arguments[2],arguments[3]):R.isNumber(arguments[4])?new K(t,e,{min:arguments[2],max:arguments[3],step:arguments[4]}):new K(t,e,{min:arguments[2],max:arguments[3]}):R.isString(n)?new J(t,e):R.isFunction(n)?new tt(t,e,""):R.isBoolean(n)?new Y(t,e):null},ot=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||h,at=function(){function t(){F(this,t),this.backgroundElement=document.createElement("div"),R.extend(this.backgroundElement.style,{backgroundColor:"rgba(0,0,0,0.8)",top:0,left:0,display:"none",zIndex:"1000",opacity:0,WebkitTransition:"opacity 0.2s linear",transition:"opacity 0.2s linear"}),q.makeFullscreen(this.backgroundElement),this.backgroundElement.style.position="fixed",this.domElement=document.createElement("div"),R.extend(this.domElement.style,{position:"fixed",display:"none",zIndex:"1001",opacity:0,WebkitTransition:"-webkit-transform 0.2s ease-out, opacity 0.2s linear",transition:"transform 0.2s ease-out, opacity 0.2s linear"}),document.body.appendChild(this.backgroundElement),document.body.appendChild(this.domElement);var e=this;q.bind(this.backgroundElement,"click",function(){e.hide()})}return z(t,[{key:"show",value:function(){var t=this;this.backgroundElement.style.display="block",this.domElement.style.display="block",this.domElement.style.opacity=0,this.domElement.style.webkitTransform="scale(1.1)",this.layout(),R.defer(function(){t.backgroundElement.style.opacity=1,t.domElement.style.opacity=1,t.domElement.style.webkitTransform="scale(1)"})}},{key:"hide",value:function(){var t=this,e=function e(){t.domElement.style.display="none",t.backgroundElement.style.display="none",q.unbind(t.domElement,"webkitTransitionEnd",e),q.unbind(t.domElement,"transitionend",e),q.unbind(t.domElement,"oTransitionEnd",e)};q.bind(this.domElement,"webkitTransitionEnd",e),q.bind(this.domElement,"transitionend",e),q.bind(this.domElement,"oTransitionEnd",e),this.backgroundElement.style.opacity=0,this.domElement.style.opacity=0,this.domElement.style.webkitTransform="scale(1.1)"}},{key:"layout",value:function(){this.domElement.style.left=window.innerWidth/2-q.getWidth(this.domElement)/2+"px",this.domElement.style.top=window.innerHeight/2-q.getHeight(this.domElement)/2+"px"}}]),t}(),st=function(t){if(t&&"undefined"!==typeof window){var e=document.createElement("style");return e.setAttribute("type","text/css"),e.innerHTML=t,document.head.appendChild(e),t}}(".dg ul{list-style:none;margin:0;padding:0;width:100%;clear:both}.dg.ac{position:fixed;top:0;left:0;right:0;height:0;z-index:0}.dg:not(.ac) .main{overflow:hidden}.dg.main{-webkit-transition:opacity .1s linear;-o-transition:opacity .1s linear;-moz-transition:opacity .1s linear;transition:opacity .1s linear}.dg.main.taller-than-window{overflow-y:auto}.dg.main.taller-than-window .close-button{opacity:1;margin-top:-1px;border-top:1px solid #2c2c2c}.dg.main ul.closed .close-button{opacity:1 !important}.dg.main:hover .close-button,.dg.main .close-button.drag{opacity:1}.dg.main .close-button{-webkit-transition:opacity .1s linear;-o-transition:opacity .1s linear;-moz-transition:opacity .1s linear;transition:opacity .1s linear;border:0;line-height:19px;height:20px;cursor:pointer;text-align:center;background-color:#000}.dg.main .close-button.close-top{position:relative}.dg.main .close-button.close-bottom{position:absolute}.dg.main .close-button:hover{background-color:#111}.dg.a{float:right;margin-right:15px;overflow-y:visible}.dg.a.has-save>ul.close-top{margin-top:0}.dg.a.has-save>ul.close-bottom{margin-top:27px}.dg.a.has-save>ul.closed{margin-top:0}.dg.a .save-row{top:0;z-index:1002}.dg.a .save-row.close-top{position:relative}.dg.a .save-row.close-bottom{position:fixed}.dg li{-webkit-transition:height .1s ease-out;-o-transition:height .1s ease-out;-moz-transition:height .1s ease-out;transition:height .1s ease-out;-webkit-transition:overflow .1s linear;-o-transition:overflow .1s linear;-moz-transition:overflow .1s linear;transition:overflow .1s linear}.dg li:not(.folder){cursor:auto;height:27px;line-height:27px;padding:0 4px 0 5px}.dg li.folder{padding:0;border-left:4px solid rgba(0,0,0,0)}.dg li.title{cursor:pointer;margin-left:-4px}.dg .closed li:not(.title),.dg .closed ul li,.dg .closed ul li>*{height:0;overflow:hidden;border:0}.dg .cr{clear:both;padding-left:3px;height:27px;overflow:hidden}.dg .property-name{cursor:default;float:left;clear:left;width:40%;overflow:hidden;text-overflow:ellipsis}.dg .c{float:left;width:60%;position:relative}.dg .c input[type=text]{border:0;margin-top:4px;padding:3px;width:100%;float:right}.dg .has-slider input[type=text]{width:30%;margin-left:0}.dg .slider{float:left;width:66%;margin-left:-5px;margin-right:0;height:19px;margin-top:4px}.dg .slider-fg{height:100%}.dg .c input[type=checkbox]{margin-top:7px}.dg .c select{margin-top:5px}.dg .cr.function,.dg .cr.function .property-name,.dg .cr.function *,.dg .cr.boolean,.dg .cr.boolean *{cursor:pointer}.dg .cr.color{overflow:visible}.dg .selector{display:none;position:absolute;margin-left:-9px;margin-top:23px;z-index:10}.dg .c:hover .selector,.dg .selector.drag{display:block}.dg li.save-row{padding:0}.dg li.save-row .button{display:inline-block;padding:0px 6px}.dg.dialogue{background-color:#222;width:460px;padding:15px;font-size:13px;line-height:15px}#dg-new-constructor{padding:10px;color:#222;font-family:Monaco, monospace;font-size:10px;border:0;resize:none;box-shadow:inset 1px 1px 1px #888;word-wrap:break-word;margin:12px 0;display:block;width:440px;overflow-y:scroll;height:100px;position:relative}#dg-local-explain{display:none;font-size:11px;line-height:17px;border-radius:3px;background-color:#333;padding:8px;margin-top:10px}#dg-local-explain code{font-size:10px}#dat-gui-save-locally{display:none}.dg{color:#eee;
1font:11px 'Lucida Grande', sans-serif;text-shadow:0 -1px 0 #111}.dg.main::-webkit-scrollbar{width:5px;background:#1a1a1a}.dg.main::-webkit-scrollbar-corner{height:0;display:none}.dg.main::-webkit-scrollbar-thumb{border-radius:5px;background:#676767}.dg li:not(.folder){background:#1a1a1a;border-bottom:1px solid #2c2c2c}.dg li.save-row{line-height:25px;background:#dad5cb;border:0}.dg li.save-row select{margin-left:5px;width:108px}.dg li.save-row .button{margin-left:5px;margin-top:1px;border-radius:2px;font-size:9px;line-height:7px;padding:4px 4px 5px 4px;background:#c5bdad;color:#fff;text-shadow:0 1px 0 #b0a58f;box-shadow:0 -1px 0 #b0a58f;cursor:pointer}.dg li.save-row .button.gears{background:#c5bdad url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAsAAAANCAYAAAB/9ZQ7AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAQJJREFUeNpiYKAU/P//PwGIC/ApCABiBSAW+I8AClAcgKxQ4T9hoMAEUrxx2QSGN6+egDX+/vWT4e7N82AMYoPAx/evwWoYoSYbACX2s7KxCxzcsezDh3evFoDEBYTEEqycggWAzA9AuUSQQgeYPa9fPv6/YWm/Acx5IPb7ty/fw+QZblw67vDs8R0YHyQhgObx+yAJkBqmG5dPPDh1aPOGR/eugW0G4vlIoTIfyFcA+QekhhHJhPdQxbiAIguMBTQZrPD7108M6roWYDFQiIAAv6Aow/1bFwXgis+f2LUAynwoIaNcz8XNx3Dl7MEJUDGQpx9gtQ8YCueB+D26OECAAQDadt7e46D42QAAAABJRU5ErkJggg==) 2px 1px no-repeat;height:7px;width:8px}.dg li.save-row .button:hover{background-color:#bab19e;box-shadow:0 -1px 0 #b0a58f}.dg li.folder{border-bottom:0}.dg li.title{padding-left:16px;background:#000 url(data:image/gif;base64,R0lGODlhBQAFAJEAAP////Pz8////////yH5BAEAAAIALAAAAAAFAAUAAAIIlI+hKgFxoCgAOw==) 6px 10px no-repeat;cursor:pointer;border-bottom:1px solid rgba(255,255,255,0.2)}.dg .closed li.title{background-image:url(data:image/gif;base64,R0lGODlhBQAFAJEAAP////Pz8////////yH5BAEAAAIALAAAAAAFAAUAAAIIlGIWqMCbWAEAOw==)}.dg .cr.boolean{border-left:3px solid #806787}.dg .cr.color{border-left:3px solid}.dg .cr.function{border-left:3px solid #e61d5f}.dg .cr.number{border-left:3px solid #2FA1D6}.dg .cr.number input[type=text]{color:#2FA1D6}.dg .cr.string{border-left:3px solid #1ed36f}.dg .cr.string input[type=text]{color:#1ed36f}.dg .cr.function:hover,.dg .cr.boolean:hover{background:#111}.dg .c input[type=text]{background:#303030;outline:none}.dg .c input[type=text]:hover{background:#3c3c3c}.dg .c input[type=text]:focus{background:#494949;color:#fff}.dg .c .slider{background:#303030;cursor:ew-resize}.dg .c .slider-fg{background:#2FA1D6;max-width:100%}.dg .c .slider:hover{background:#3c3c3c}.dg .c .slider:hover .slider-fg{background:#44abda}\n");it.inject(st);var ct="Default",lt=function(){try{return!!window.localStorage}catch(t){return!1}}(),ht=void 0,ut=!0,dt=void 0,pt=!1,ft=[],mt=function t(e){var n=this,i=e||{};this.domElement=document.createElement("div"),this.__ul=document.createElement("ul"),this.domElement.appendChild(this.__ul),q.addClass(this.domElement,"dg"),this.__folders={},this.__controllers=[],this.__rememberedObjects=[],this.__rememberedObjectIndecesToControllers=[],this.__listening=[],i=R.defaults(i,{closeOnTop:!1,autoPlace:!0,width:t.DEFAULT_WIDTH}),i=R.defaults(i,{resizable:i.autoPlace,hideable:i.autoPlace}),R.isUndefined(i.load)?i.load={preset:ct}:i.preset&&(i.load.preset=i.preset),R.isUndefined(i.parent)&&i.hideable&&ft.push(this),i.resizable=R.isUndefined(i.parent)&&i.resizable,i.autoPlace&&R.isUndefined(i.scrollable)&&(i.scrollable=!0);var r=lt&&"true"===localStorage.getItem(g(this,"isLocal")),o=void 0;if(Object.defineProperties(this,{parent:{get:function(){return i.parent}},scrollable:{get:function(){return i.scrollable}},autoPlace:{get:function(){return i.autoPlace}},closeOnTop:{get:function(){return i.closeOnTop}},preset:{get:function(){return n.parent?n.getRoot().preset:i.load.preset},set:function(t){n.parent?n.getRoot().preset=t:i.load.preset=t,E(this),n.revert()}},width:{get:function(){return i.width},set:function(t){i.width=t,w(n,t)}},name:{get:function(){return i.name},set:function(t){i.name=t,titleRowName&&(titleRowName.innerHTML=i.name)}},closed:{get:function(){return i.closed},set:function(e){i.closed=e,i.closed?q.addClass(n.__ul,t.CLASS_CLOSED):q.removeClass(n.__ul,t.CLASS_CLOSED),this.onResize(),n.__closeButton&&(n.__closeButton.innerHTML=e?t.TEXT_OPEN:t.TEXT_CLOSED)}},load:{get:function(){return i.load}},useLocalStorage:{get:function(){return r},set:function(t){lt&&(r=t,t?q.bind(window,"unload",o):q.unbind(window,"unload",o),localStorage.setItem(g(n,"isLocal"),t))}}}),R.isUndefined(i.parent)){if(i.closed=!1,q.addClass(this.domElement,t.CLASS_MAIN),q.makeSelectable(this.domElement,!1),lt&&r){n.useL
vendor: 6,978 bytes, line 1
1ocalStorage=!0;var a=localStorage.getItem(g(this,"gui"));a&&(i.load=JSON.parse(a))}this.__closeButton=document.createElement("div"),this.__closeButton.innerHTML=t.TEXT_CLOSED,q.addClass(this.__closeButton,t.CLASS_CLOSE_BUTTON),i.closeOnTop?(q.addClass(this.__closeButton,t.CLASS_CLOSE_TOP),this.domElement.insertBefore(this.__closeButton,this.domElement.childNodes[0])):(q.addClass(this.__closeButton,t.CLASS_CLOSE_BOTTOM),this.domElement.appendChild(this.__closeButton)),q.bind(this.__closeButton,"click",function(){n.closed=!n.closed})}else{void 0===i.closed&&(i.closed=!0);var s=document.createTextNode(i.name);q.addClass(s,"controller-name");var c=u(n,s),l=function(t){return t.preventDefault(),n.closed=!n.closed,!1};q.addClass(this.__ul,t.CLASS_CLOSED),q.addClass(c,"title"),q.bind(c,"click",l),i.closed||(this.closed=!1)}i.autoPlace&&(R.isUndefined(i.parent)&&(ut&&(dt=document.createElement("div"),q.addClass(dt,"dg"),q.addClass(dt,t.CLASS_AUTO_PLACE_CONTAINER),document.body.appendChild(dt),ut=!1),dt.appendChild(this.domElement),q.addClass(this.domElement,t.CLASS_AUTO_PLACE)),this.parent||w(n,i.width)),this.__resizeHandler=function(){n.onResizeDebounced()},q.bind(window,"resize",this.__resizeHandler),q.bind(this.__ul,"webkitTransitionEnd",this.__resizeHandler),q.bind(this.__ul,"transitionend",this.__resizeHandler),q.bind(this.__ul,"oTransitionEnd",this.__resizeHandler),this.onResize(),i.resizable&&x(this),o=function(){lt&&"true"===localStorage.getItem(g(n,"isLocal"))&&localStorage.setItem(g(n,"gui"),JSON.stringify(n.getSaveObject()))},this.saveToLocalStorageIfPossible=o,i.parent||function(){var t=n.getRoot();t.width+=1,R.defer(function(){t.width-=1})}()};mt.toggleHide=function(){pt=!pt,R.each(ft,function(t){t.domElement.style.display=pt?"none":""})},mt.CLASS_AUTO_PLACE="a",mt.CLASS_AUTO_PLACE_CONTAINER="ac",mt.CLASS_MAIN="main",mt.CLASS_CONTROLLER_ROW="cr",mt.CLASS_TOO_TALL="taller-than-window",mt.CLASS_CLOSED="closed",mt.CLASS_CLOSE_BUTTON="close-button",mt.CLASS_CLOSE_TOP="close-top",mt.CLASS_CLOSE_BOTTOM="close-bottom",mt.CLASS_DRAG="drag",mt.DEFAULT_WIDTH=245,mt.TEXT_CLOSED="Close Controls",mt.TEXT_OPEN="Open Controls",mt._keydownHandler=function(t){"text"===document.activeElement.type||72!==t.which&&72!==t.keyCode||mt.toggleHide()},q.bind(window,"keydown",mt._keydownHandler,!1),R.extend(mt.prototype,{add:function(t,e){return v(this,t,e,{factoryArgs:Array.prototype.slice.call(arguments,2)})},addColor:function(t,e){return v(this,t,e,{color:!0})},remove:function(t){this.__ul.removeChild(t.__li),this.__controllers.splice(this.__controllers.indexOf(t),1);var e=this;R.defer(function(){e.onResize()})},destroy:function(){if(this.parent)throw new Error("Only the root GUI should be removed with .destroy(). For subfolders, use gui.removeFolder(folder) instead.");this.autoPlace&&dt.removeChild(this.domElement);var t=this;R.each(this.__folders,function(e){t.removeFolder(e)}),q.unbind(window,"keydown",mt._keydownHandler,!1),d(this)},addFolder:function(t){if(void 0!==this.__folders[t])throw new Error('You already have a folder in this GUI by the name "'+t+'"');var e={name:t,parent:this};e.autoPlace=this.autoPlace,this.load&&this.load.folders&&this.load.folders[t]&&(e.closed=this.load.folders[t].closed,e.load=this.load.folders[t]);var n=new mt(e);this.__folders[t]=n;var i=u(this,n.domElement);return q.addClass(i,"folder"),n},removeFolder:function(t){this.__ul.removeChild(t.domElement.parentElement),delete this.__folders[t.name],this.load&&this.load.folders&&this.load.folders[t.name]&&delete this.load.folders[t.name],d(t);var e=this;R.each(t.__folders,function(e){t.removeFolder(e)}),R.defer(function(){e.onResize()})},open:function(){this.closed=!1},close:function(){this.closed=!0},onResize:function(){var t=this.getRoot();if(t.scrollable){var e=q.getOffset(t.__ul).top,n=0;R.each(t.__ul.childNodes,function(e){t.autoPlace&&e===t.__save_row||(n+=q.getHeight(e))}),window.innerHeight-e-20<n?(q.addClass(t.domElement,mt.CLASS_TOO_TALL),t.__ul.style.height=window.innerHeight-e-20+"px"):(q.removeClass(t.domElement,mt.CLASS_TOO_TALL),t.__ul.style.height="auto")}t.__resize_handle&&R.defer(function(){t.__resize_handle.style.height=t.__ul.offsetHeight+"px"}),t.__closeButton&&(t.__closeButton.style.width=t.width+"px")},onResizeDebounced:R.debounce(function(){this.onResize()},50),remember:function(){if(R.isUndefined(ht)&&(ht=new at,ht.domElement.innerHTML='<div id="dg-save" class="dg dialogue">\n\n  Here\'s the new load parameter for your <code>GUI</code>\'s constructor:\n\n  <textarea id="dg-new-constructor"></textarea>\n\n  <div id="dg-save-locally">\n\n    <input id="dg-local-storage" type="checkbox"/> Automatically save\n    values to <code>localStorage</code> on exit.\n\n    <div id="dg-local-explain">The values saved to <code>localStorage</code> will\n      override those passed to <code>dat.GUI</code>\'s constructor. This makes it\n      easier to work incrementally, but <code>localStorage</code> is fragile,\n      and your friends may not see the same values you do.\n\n    </div>\n\n  </div>\n\n</div>'),this.parent)throw new Error("You can only call remember on a top level GUI.");var t=this;R.each(Array.prototype.slice.call(arguments),function(e){0===t.__rememberedObjects.length&&b(t),-1===t.__rememberedObjects.indexOf(e)&&t.__rememberedObjects.push(e)}),this.autoPlace&&w(this,this.width)},getRoot:function(){for(var t=this;t.parent;)t=t.parent;return t},getSaveObject:function(){var t=this.load;return t.closed=this.closed,this.__rememberedObjects.length>0&&(t.preset=this.preset,t.remembered||(t.remembered={}),t.remembered[this.preset]=M(this)),t.folders={},R.each(this.__folders,function(e,n){t.folders[n]=e.getSaveObject()}),t},save:function(){this.load.remembered||(this.load.remembered={}),this.load.remembered[this.preset]=M(this),p(this,!1),this.saveToLocalStorageIfPossible()},saveAs:function(t){this.load.remembered||(this.load.remembered={},this.load.remembered[ct]=M(this,!0)),this.load.remembered[t]=M(this),this.preset=t,y(this,t,!0),this.saveToLocalStorageIfPossible()},revert:function(t){R.each(this.__controllers,function(e){this.getRoot().load.remembered?m(t||this.getRoot(),e):e.setValue(e.initialValue),e.__onFinishChange&&e.__onFinishChange.call(e,e.getValue())},this),R.each(this.__folders,function(t){t.revert(t)}),t||p(this.getRoot(),!1)},listen:function(t){var e=0===this.__listening.length;this.__listening.push(t),e&&T(this.__listening)},updateDisplay:function(){R.each(this.__controllers,function(t){t.updateDisplay()}),R.each(this.__folders,function(t){t.updateDisplay()})}});var vt={Color:G,math:N,interpret:I},gt={Controller:H,BooleanController:Y,OptionController:Z,StringController:J,NumberController:Q,NumberControllerBox:K,NumberControllerSlider:$,FunctionController:tt,ColorController:et},yt={dom:q},_t={GUI:mt},bt=mt,xt={color:vt,controllers:gt,dom:yt,gui:_t,GUI:bt};t.color=vt,t.controllers=gt,t.dom=yt,t.gui=_t,t.GUI=bt,t.default=xt,Object.defineProperty(t,"__esMo
1dule",{value:!0})}(e)}()}),P=function(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}(C),O=function(t){return encodeURIComponent(t).replace(/[!'()*]/g,function(t){return"%"+t.charCodeAt(0).toString(16).toUpperCase()})},I=Object.getOwnPropertySymbols,U=Object.prototype.hasOwnProperty,N=Object.prototype.propertyIsEnumerable,D=function(){try{if(!Object.assign)return!1;var t=new String("abc");if(t[5]="de","5"===Object.getOwnPropertyNames(t)[0])return!1;for(var e={},n=0;n<10;n++)e["_"+String.fromCharCode(n)]=n;if("0123456789"!==Object.getOwnPropertyNames(e).map(function(t){return e[t]}).join(""))return!1;var i={};return"abcdefghijklmnopqrst".split("").forEach(function(t){i[t]=t}),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},i)).join("")}catch(t){return!1}}()?Object.assign:function(t,e){for(var n,i,r=o(t),a=1;a<arguments.length;a++){n=Object(arguments[a]);for(var s in n)U.call(n,s)&&(r[s]=n[s]);if(I){i=I(n);for(var c=0;c<i.length;c++)N.call(n,i[c])&&(r[i[c]]=n[i[c]])}}return r},F=new RegExp("%[a-f0-9]{2}","gi"),z=new RegExp("(%[a-f0-9]{2})+","gi"),B=function(t){if("string"!==typeof t)throw new TypeError("Expected `encodedURI` to be of type `string`, got `"+("undefined"===typeof t?"undefined":A(t))+"`");try{return t=t.replace(/\+/g," "),decodeURIComponent(t)}catch(e){return c(t)}},k=function(t){var e=t.indexOf("?");return-1===e?"":t.slice(e+1)},j=function(t,e){e=D({arrayFormat:"none"},e);var n=h(e),i=Object.create(null);return"string"!==typeof t?i:(t=t.trim().replace(/^[?#&]/,""))?(t.split("&").forEach(function(t){var e=t.replace(/\+/g," ").split("="),r=e.shift(),o=e.length>0?e.join("="):void 0;o=void 0===o?null:B(o),n(B(r),o,i)}),Object.keys(i).sort().reduce(function(t,e){var n=i[e];return Boolean(n)&&"object"===("undefined"===typeof n?"undefined":A(n))&&!Array.isArray(n)?t[e]=d(n):t[e]=n,t},Object.create(null))):i},G=function(t,e){e=D({encode:!0,strict:!0,arrayFormat:"none"},e);var n=l(e);return t?Object.keys(t).sort().map(function(i){var r=t[i];if(void 0===r)return"";if(null===r)return u(i,e);if(Array.isArray(r)){var o=[];return r.slice().forEach(function(t){void 0!==t&&o.push(n(i,t,o.length))}),o.join("&")}return u(i,e)+"="+u(r,e)}).filter(function(t){return t.length>0}).join("&"):""},H={extract:k,parse:j,stringify:G},V=function(t,e,n){function i(){var l=Date.now()-s;l<e&&l>=0?r=setTimeout(i,e-l):(r=null,n||(c=t.apply(a,o),a=o=null))}var r,o,a,s,c;null==e&&(e=100);var l=function(){a=this,o=arguments,s=Date.now();var l=n&&!r;return r||(r=setTimeout(i,e)),l&&(c=t.apply(a,o),a=o=null),c};return l.clear=function(){r&&(clearTimeout(r),r=null)},l.flush=function(){r&&(c=t.apply(a,o),a=o=null,clearTimeout(r),r=null)},l},W=r(function(t){!function(t,e,n){function i(t){var e=this,n=a();e.next=function(){var t=2091639*e.s0+2.3283064365386963e-10*e.c;return e.s0=e.s1,e.s1=e.s2,e.s2=t-(e.c=0|t)},e.c=1,e.s0=n(" "),e.s1=n(" "),e.s2=n(" "),e.s0-=n(t),e.s0<0&&(e.s0+=1),e.s1-=n(t),e.s1<0&&(e.s1+=1),e.s2-=n(t),e.s2<0&&(e.s2+=1),n=null}function r(t,e){return e.c=t.c,e.s0=t.s0,e.s1=t.s1,e.s2=t.s2,e}function o(t,e){var n=new i(t),o=e&&e.state,a=n.next;return a.int32=function(){return 4294967296*n.next()|0},a.double=function(){return a()+1.1102230246251565e-16*(2097152*a()|0)},a.quick=a,o&&("object"==("undefined"===typeof o?"undefined":A(o))&&r(o,n),a.state=function(){return r(n,{})}),a}function a(){var t=4022871197;return function(e){e=e.toString();for(var n=0;n<e.length;n++){t+=e.charCodeAt(n);var i=.02519603282416938*t;t=i>>>0,i-=t,i*=t,t=i>>>0,i-=t,t+=4294967296*i}return 2.3283064365386963e-10*(t>>>0)}}e&&e.exports?e.exports=o:n&&n.amd?n(function(){return o}):this.alea=o}(0,t,!1)}),X=r(function(t){!function(t,e,n){function i(t){var e=this,n="";e.x=0,e.y=0,e.z=0,e.w=0,e.next=function(){var t=e.x^e.x<<11;return e.x=e.y,e.y=e.z,e.z=e.w,e.w^=e.w>>>19^t^t>>>8},t===(0|t)?e.x=t:n+=t;for(var i=0;i<n.length+64;
1i++)e.x^=0|n.charCodeAt(i),e.next()}function r(t,e){return e.x=t.x,e.y=t.y,e.z=t.z,e.w=t.w,e}function o(t,e){var n=new i(t),o=e&&e.state,a=function(){return(n.next()>>>0)/4294967296};return a.double=function(){do{var t=n.next()>>>11,e=(n.next()>>>0)/4294967296,i=(t+e)/(1<<21)}while(0===i);return i},a.int32=n.next,a.quick=a,o&&("object"==("undefined"===typeof o?"undefined":A(o))&&r(o,n),a.state=function(){return r(n,{})}),a}e&&e.exports?e.exports=o:n&&n.amd?n(function(){return o}):this.xor128=o}(0,t,!1)}),q=r(function(t){!function(t,e,n){function i(t){var e=this,n="";e.next=function(){var t=e.x^e.x>>>2;return e.x=e.y,e.y=e.z,e.z=e.w,e.w=e.v,(e.d=e.d+362437|0)+(e.v=e.v^e.v<<4^t^t<<1)|0},e.x=0,e.y=0,e.z=0,e.w=0,e.v=0,t===(0|t)?e.x=t:n+=t;for(var i=0;i<n.length+64;i++)e.x^=0|n.charCodeAt(i),i==n.length&&(e.d=e.x<<10^e.x>>>4),e.next()}function r(t,e){return e.x=t.x,e.y=t.y,e.z=t.z,e.w=t.w,e.v=t.v,e.d=t.d,e}function o(t,e){var n=new i(t),o=e&&e.state,a=function(){return(n.next()>>>0)/4294967296};return a.double=function(){do{var t=n.next()>>>11,e=(n.next()>>>0)/4294967296,i=(t+e)/(1<<21)}while(0===i);return i},a.int32=n.next,a.quick=a,o&&("object"==("undefined"===typeof o?"undefined":A(o))&&r(o,n),a.state=function(){return r(n,{})}),a}e&&e.exports?e.exports=o:n&&n.amd?n(function(){return o}):this.xorwow=o}(0,t,!1)}),Y=r(function(t){!function(t,e,n){function i(t){var e=this;e.next=function(){var t,n,i=e.x,r=e.i;return t=i[r],t^=t>>>7,n=t^t<<24,t=i[r+1&7],n^=t^t>>>10,t=i[r+3&7],n^=t^t>>>3,t=i[r+4&7],n^=t^t<<7,t=i[r+7&7],t^=t<<13,n^=t^t<<9,i[r]=n,e.i=r+1&7,n},function(t,e){var n,i=[];if(e===(0|e))i[0]=e;else for(e=""+e,n=0;n<e.length;++n)i[7&n]=i[7&n]<<15^e.charCodeAt(n)+i[n+1&7]<<13;for(;i.length<8;)i.push(0);for(n=0;n<8&&0===i[n];++n);for(8==n?i[7]=-1:i[n],t.x=i,t.i=0,n=256;n>0;--n)t.next()}(e,t)}function r(t,e){return e.x=t.x.slice(),e.i=t.i,e}function o(t,e){null==t&&(t=+new Date);var n=new i(t),o=e&&e.state,a=function(){return(n.next()>>>0)/4294967296};return a.double=function(){do{var t=n.next()>>>11,e=(n.next()>>>0)/4294967296,i=(t+e)/(1<<21)}while(0===i);return i},a.int32=n.next,a.quick=a,o&&(o.x&&r(o,n),a.state=function(){return r(n,{})}),a}e&&e.exports?e.exports=o:n&&n.amd?n(function(){return o}):this.xorshift7=o}(0,t,!1)}),Z=r(function(t){!function(t,e,n){function i(t){var e=this;e.next=function(){var t,n,i=e.w,r=e.X,o=e.i;return e.w=i=i+1640531527|0,n=r[o+34&127],t=r[o=o+1&127],n^=n<<13,t^=t<<17,n^=n>>>15,t^=t>>>12,n=r[o]=n^t,e.i=o,n+(i^i>>>16)|0},function(t,e){var n,i,r,o,a,s=[],c=128;for(e===(0|e)?(i=e,e=null):(e+="\0",i=0,c=Math.max(c,e.length)),r=0,o=-32;o<c;++o)e&&(i^=e.charCodeAt((o+32)%e.length)),0===o&&(a=i),i^=i<<10,i^=i>>>15,i^=i<<4,i^=i>>>13,o>=0&&(a=a+1640531527|0,n=s[127&o]^=i+a,r=0==n?r+1:0);for(r>=128&&(s[127&(e&&e.length||0)]=-1),r=127,o=512;o>0;--o)i=s[r+34&127],n=s[r=r+1&127],i^=i<<13,n^=n<<17,i^=i>>>15,n^=n>>>12,s[r]=i^n;t.w=a,t.X=s,t.i=r}(e,t)}function r(t,e){return e.i=t.i,e.w=t.w,e.X=t.X.slice(),e}function o(t,e){null==t&&(t=+new Date);var n=new i(t),o=e&&e.state,a=function(){return(n.next()>>>0)/4294967296};return a.double=function(){do{var t=n.next()>>>11,e=(n.next()>>>0)/4294967296,i=(t+e)/(1<<21)}while(0===i);return i},a.int32=n.next,a.quick=a,o&&(o.X&&r(o,n),a.state=function(){return r(n,{})}),a}e&&e.exports?e.exports=o:n&&n.amd?n(function(){return o}):this.xor4096=o}(0,t,!1)}),J=r(function(t){!function(t,e,n){function i(t){var e=this,n="";e.next=function(){var t=e.b,n=e.c,i=e.d,r=e.a;return t=t<<25^t>>>7^n,n=n-i|0,i=i<<24^i>>>8^r,r=r-t|0,e.b=t=t<<20^t>>>12^n,e.c=n=n-i|0,e.d=i<<16^n>>>16^r,e.a=r-t|0},e.a=0,e.b=0,e.c=-1640531527,e.d=1367130551,t===Math.floor(t)?(e.a=t/4294967296|0,e.b=0|t):n+=t;for(var i=0;i<n.length+20;i++)e.b^=0|n.charCodeAt(i),e.next()}function r(t,e){return e.a=t.a,e.b=t.b,e.c=t.c,e.d=t.d,e}function o(t,e){var n=new i(t),o=e&&e.state,a=function(){return(n.next()>>>0)/4294967296};return a.double=function(){do{var t=n.next()>>>11,e=(n.next()>>>0)/4294967296,i=(t+e)/(1<<21)}while(0===i);return i},a.int32=n.next,a.quick=a,o&&("object"==("undefined"===typeof o?"undefined":A(o))&&r(o,n),a.state=function(){return r(n,{})}),a}e&&e.exports?e.exports=o:n&&n.amd?n(function(){return o}
1):this.tychei=o}(0,t,!1)}),Q={},K=Object.freeze({default:Q}),$=K&&Q||K,tt=r(function(t){!function(e,n){function i(t,i,h){var u=[];i=1==i?{entropy:!0}:i||{};var y=s(a(i.entropy?[t,l(e)]:null==t?c():t,3),u),_=new r(u),b=function(){for(var t=_.g(p),e=m,n=0;t<v;)t=(t+n)*d,e*=d,n=_.g(1);for(;t>=g;)t/=2,e/=2,n>>>=1;return(t+n)/e};return b.int32=function(){return 0|_.g(4)},b.quick=function(){return _.g(4)/4294967296},b.double=b,s(l(_.S),e),(i.pass||h||function(t,e,i,r){return r&&(r.S&&o(r,_),t.state=function(){return o(_,{})}),i?(n[f]=t,e):t})(b,y,"global"in i?i.global:this==n,i.state)}function r(t){var e,n=t.length,i=this,r=0,o=i.i=i.j=0,a=i.S=[];for(n||(t=[n++]);r<d;)a[r]=r++;for(r=0;r<d;r++)a[r]=a[o=y&o+t[r%n]+(e=a[r])],a[o]=e;(i.g=function(t){for(var e,n=0,r=i.i,o=i.j,a=i.S;t--;)e=a[r=y&r+1],n=n*d+a[y&(a[r]=a[o=y&o+e])+(a[o]=e)];return i.i=r,i.j=o,n})(d)}function o(t,e){return e.i=t.i,e.j=t.j,e.S=t.S.slice(),e}function a(t,e){var n,i=[],r="undefined"===typeof t?"undefined":A(t);if(e&&"object"==r)for(n in t)try{i.push(a(t[n],e-1))}catch(t){}return i.length?i:"string"==r?t:t+"\0"}function s(t,e){for(var n,i=t+"",r=0;r<i.length;)e[y&r]=y&(n^=19*e[y&r])+i.charCodeAt(r++);return l(e)}function c(){try{var t;return h&&(t=h.randomBytes)?t=t(d):(t=new Uint8Array(d),(u.crypto||u.msCrypto).getRandomValues(t)),l(t)}catch(t){var n=u.navigator,i=n&&n.plugins;return[+new Date,u,i,u.screen,l(e)]}}function l(t){return String.fromCharCode.apply(0,t)}var h,u=this,d=256,p=6,f="random",m=n.pow(d,p),v=n.pow(2,52),g=2*v,y=d-1;if(n["seed"+f]=i,s(n.random(),e),t.exports){t.exports=i;try{h=$}catch(t){}}}([],Math)});tt.alea=W,tt.xor128=X,tt.xorwow=q,tt.xorshift7=Y,tt.xor4096=Z,tt.tychei=J;var et=tt,nt={active:!1,log:function(t){nt.print("log",t)},warn:function(t){nt.print("warn",t)},error:function(t){nt.print("error",t)},info:function(t){nt.print("info",t)},print:function(t,e){nt.active&&console[t]("\ud83d\udc49 Sandpit: "+e)}},it={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],ol
1ive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]},rt=function(t){return!(!t||"string"===typeof t)&&(t instanceof Array||Array.isArray(t)||t.length>=0&&(t.splice instanceof Function||Object.getOwnPropertyDescriptor(t,t.length-1)&&"String"!==t.constructor.name))},ot=r(function(t){var e=Array.prototype.concat,n=Array.prototype.slice,i=t.exports=function(t){for(var i=[],r=0,o=t.length;r<o;r++){var a=t[r];rt(a)?i=e.call(i,n.call(a)):i.push(a)}return i};i.wrap=function(t){return function(){return t(i(arguments))}}}),at=r(function(t){function e(t,e,n){return Math.min(Math.max(e,t),n)}function n(t){var e=t.toString(16).toUpperCase();return e.length<2?"0"+e:e}var i={};for(var r in it)it.hasOwnProperty(r)&&(i[it[r]]=r);var o=t.exports={to:{}};o.get=function(t){var e,n,i=t.substring(0,3).toLowerCase();switch(i){case"hsl":e=o.get.hsl(t),n="hsl";break;case"hwb":e=o.get.hwb(t),n="hwb";break;default:e=o.get.rgb(t),n="rgb"}return e?{model:n,value:e}:null},o.get.rgb=function(t){if(!t)return null;var n,i,r,o=/^#([a-f0-9]{3,4})$/i,a=/^#([a-f0-9]{6})([a-f0-9]{2})?$/i,s=/^rgba?\(\s*([+-]?\d+)\s*,\s*([+-]?\d+)\s*,\s*([+-]?\d+)\s*(?:,\s*([+-]?[\d\.]+)\s*)?\)$/,c=/^rgba?\(\s*([+-]?[\d\.]+)\%\s*,\s*([+-]?[\d\.]+)\%\s*,\s*([+-]?[\d\.]+)\%\s*(?:,\s*([+-]?[\d\.]+)\s*)?\)$/,l=/(\D+)/,h=[0,0,0,1];if(n=t.match(a)){for(r=n[2],n=n[1],i=0;i<3;i++){var u=2*i;h[i]=parseInt(n.slice(u,u+2),16)}r&&(h[3]=Math.round(parseInt(r,16)/255*100)/100)}else if(n=t.match(o)){for(n=n[1],r=n[3],i=0;i<3;i++)h[i]=parseInt(n[i]+n[i],16);r&&(h[3]=Math.round(parseInt(r+r,16)/255*100)/100)}else if(n=t.match(s)){for(i=0;i<3;i++)h[i]=parseInt(n[i+1],0);n[4]&&(h[3]=parseFloat(n[4]))}else{if(!(n=t.match(c)))return(n=t.match(l))?"transparent"===n[1]?[0,0,0,0]:(h=it[n[1]])?(h[3]=1,h):null:null;for(i=0;i<3;i++)h[i]=Math.round(2.55*parseFloat(n[i+1]));n[4]&&(h[3]=parseFloat(n[4]))}for(i=0;i<3;i++)h[i]=e(h[i],0,255);return h[3]=e(h[3],0,1),h},o.get.hsl=function(t){if(!t)return null;var n=/^hsla?\(\s*([+-]?\d*[\.]?\d+)(?:deg)?\s*,\s*([+-]?[\d\.]+)%\s*,\s*([+-]?[\d\.]+)%\s*(?:,\s*([+-]?[\d\.]+)\s*)?\)$/,i=t.match(n);if(i){var r=parseFloat(i[4]);return[(parseFloat(i[1])%360+360)%360,e(parseFloat(i[2]),0,100),e(parseFloat(i[3]),0,100),e(isNaN(r)?1:r,0,1)]}return null},o.get.hwb=function(t){if(!t)return null;var n=/^hwb\(\s*([+-]?\d*[\.]?\d+)(?:deg)?\s*,\s*([+-]?[\d\.]+)%\s*,\s*([+-]?[\d\.]+)%\s*(?:,\s*([+-]?[\d\.]+)\s*)?\)$/,i=t.match(n);if(i){var r=parseFloat(i[4]);return[(parseFloat(i[1])%360+360)%360,e(parseFloat(i[2]),0,100),e(parseFloat(i[3]),0,100),e(isNaN(r)?1:r,0,1)]}return null},o.to.hex=function(){var t=ot(arguments);return"#"+n(t[0])+n(t[1])+n(t[2])+(t[3]<1?n(Math.round(255*t[3])):"")},o.to.rgb=function(){var t=ot(arguments);return t.length<4||1===t[3]?"rgb("+Math.round(t[0])+", "+Math.round(t[1])+", "+Math.round(t[2])+")":"rgba("+Math.round(t[0])+", "+Math.round(t[1])+", "+Math.round(t[2])+", "+t[3]+")"},o.to.rgb.percent=function(){var t=ot(arguments),e=Math.round(t[0]/255*100),n=Math.round(t[1]/255*100),i=Math.round(t[2]/255*100);return t.length<4||1===t[3]?"rgb("+e+"%, "+n+"%, "+i+"%)":"rgba("+e+"%, "+n+"%, "+i+"%, "+t[3]+")"},o.to.hsl=function(){var t=ot(arguments);return t.length<4||1===t[3]?"hsl("+t[0]+", "+t[1]+"%, "+t[2]+"%)":"hsla("+t[0]+", "+t[1]+"%, "+t[2]+"%, "+t[3]+")"},o.to.hwb=function(){var t=ot(arguments),e="";return t.length>=4&&1!==t[3]&&(e=", "+t[3]),"hwb("+t[0]+", "+t[1]+"%, "+t[2]+"%"+e+")"},o.to.keyword=function(t){return i[t.slice(0,3)]}}),st=(at.to,r(function(t){function e(t,e){return Math.pow(t[0]-e[0],2)+Math.pow(t[1]-e[1],2)+Math.pow(t[2]-e[2],2)}var n={};for(var i in it)it.hasOwnProperty(i)&&(n[it[i]]=i);var r=t.exports={rgb:{channels:3,labels:"rgb"},hsl:{channels:3,labels:"hsl"},hsv:{channels:3,labels:"hsv"},hwb:{channels:3,labels:"hwb"},cmyk:{channels:4,labels:"cmyk"},xyz:{channels:3,labels:"xyz"},lab:{channels:3,labels:"lab"},lch:{channels:3,labels:"lch"},hex:{channels:1,labels:["hex"]},keyword:{channels:1,labels:["keyword"]},ansi16:{channels:1,labels:["ansi16"]},ansi256:{channels:1,labels:["ansi256"]},hcg:{channels:3,labels:["h","c","g"]},apple:{channels:3,labels:["r16","g16","b16"]},gray:{channels:1,labels:["gray"]}};for(var o in r)if(r.hasOwnProperty(o)){if(!("channels"in r[o]))throw new Error("missing channels property: "+o);if(!("labels"in r[o]))throw new Error("missing channel labels property: "+o);if(r[o].labels.length!==r[o].channels)throw new Error("channel and label counts mismatch: "+o);var a=r[o].channels,s=r[o].labels;delete r[o].channels,delete r[o].labels,Object.defineProperty(r[o],"channels",{value:a}),Object.defineProperty(r[o],"labels",{value:s})}r.rgb.hsl=function(t){var e,n,i,r=t[0]/255,o=t[1]/255,a=t[2]/255,s=Math.min(r,o,a),c=Math.max(r,o,a),l=c-s;return c===s?e=0:r===c?e=(o-a)/l:o===c?e=2+(a-r)/l:a===c&&(e=4+(r-o)/l),e=Math.min(60*e,360),e<0&&(e+=360),i=(s+c)/2,n=c===s?0:i<=.5?l/(c+s):l/(2-c-s),[e,100*n,100*i]},r.rgb.hsv=function(t){var e,n,i,r=t[0],o=t[1],a=t[2],s=Math.min(r,o,a),c=Math.max(r,o,a),l=c-s;return n=0===c?0:l/c*1e3/10,c===s?e=0:r===c?e=(o-a)/l:o===c?e=2+(a-r)/l:a===c&&(e=4+(r-o)/l),e=Math.min(60*e,360),e<0&&(e+=360),i=c/255*1e3/10,[e,n,i]},r.rgb.hwb=function(t){var e=t[0],n=t[1],i=t[2],o=r.rgb.hsl(t)[0],a=1/255*Math.min(e,Math.min(n,i));return i=1-1/255*Math.max(e,Math.max(n,i)),[o,100*a,100*i]},r.rgb.cmyk=function(t){var e,n,i,r,o=t[0]/255,a=t[1]/255,s=t[2]/255;return r=Math.min(1-o,1-a,1-s),e=(1-o-r)/(1-r)||0,n=(1-a-r)/(1-r)||0,i=(1-s-r)/(1-r)||0,[100*e,100*n,100*i,100*r]},r.rgb.keyword=function(t){var i=n[t];if(i)return i;var r,o=1/0;for(var a in it)if(it.hasOwnProperty(a)){var s=it[a],c=e(t,s);c<o&&(o=c,r=a)}return r}
1,r.keyword.rgb=function(t){return it[t]},r.rgb.xyz=function(t){var e=t[0]/255,n=t[1]/255,i=t[2]/255;return e=e>.04045?Math.pow((e+.055)/1.055,2.4):e/12.92,n=n>.04045?Math.pow((n+.055)/1.055,2.4):n/12.92,i=i>.04045?Math.pow((i+.055)/1.055,2.4):i/12.92,[100*(.4124*e+.3576*n+.1805*i),100*(.2126*e+.7152*n+.0722*i),100*(.0193*e+.1192*n+.9505*i)]},r.rgb.lab=function(t){var e,n,i,o=r.rgb.xyz(t),a=o[0],s=o[1],c=o[2];return a/=95.047,s/=100,c/=108.883,a=a>.008856?Math.pow(a,1/3):7.787*a+16/116,s=s>.008856?Math.pow(s,1/3):7.787*s+16/116,c=c>.008856?Math.pow(c,1/3):7.787*c+16/116,e=116*s-16,n=500*(a-s),i=200*(s-c),[e,n,i]},r.hsl.rgb=function(t){var e,n,i,r,o,a=t[0]/360,s=t[1]/100,c=t[2]/100;if(0===s)return o=255*c,[o,o,o];n=c<.5?c*(1+s):c+s-c*s,e=2*c-n,r=[0,0,0];for(var l=0;l<3;l++)i=a+1/3*-(l-1),i<0&&i++,i>1&&i--,o=6*i<1?e+6*(n-e)*i:2*i<1?n:3*i<2?e+(n-e)*(2/3-i)*6:e,r[l]=255*o;return r},r.hsl.hsv=function(t){var e,n,i=t[0],r=t[1]/100,o=t[2]/100,a=r,s=Math.max(o,.01);return o*=2,r*=o<=1?o:2-o,a*=s<=1?s:2-s,n=(o+r)/2,e=0===o?2*a/(s+a):2*r/(o+r),[i,100*e,100*n]},r.hsv.rgb=function(t){var e=t[0]/60,n=t[1]/100,i=t[2]/100,r=Math.floor(e)%6,o=e-Math.floor(e),a=255*i*(1-n),s=255*i*(1-n*o),c=255*i*(1-n*(1-o));switch(i*=255,r){case 0:return[i,c,a];case 1:return[s,i,a];case 2:return[a,i,c];case 3:return[a,s,i];case 4:return[c,a,i];case 5:return[i,a,s]}},r.hsv.hsl=function(t){var e,n,i,r=t[0],o=t[1]/100,a=t[2]/100,s=Math.max(a,.01);return i=(2-o)*a,e=(2-o)*s,n=o*s,n/=e<=1?e:2-e,n=n||0,i/=2,[r,100*n,100*i]},r.hwb.rgb=function(t){var e,n,i,r,o=t[0]/360,a=t[1]/100,s=t[2]/100,c=a+s;c>1&&(a/=c,s/=c),e=Math.floor(6*o),n=1-s,i=6*o-e,0!==(1&e)&&(i=1-i),r=a+i*(n-a);var l,h,u;switch(e){default:case 6:case 0:l=n,h=r,u=a;break;case 1:l=r,h=n,u=a;break;case 2:l=a,h=n,u=r;break;case 3:l=a,h=r,u=n;break;case 4:l=r,h=a,u=n;break;case 5:l=n,h=a,u=r}return[255*l,255*h,255*u]},r.cmyk.rgb=function(t){var e,n,i,r=t[0]/100,o=t[1]/100,a=t[2]/100,s=t[3]/100;return e=1-Math.min(1,r*(1-s)+s),n=1-Math.min(1,o*(1-s)+s),i=1-Math.min(1,a*(1-s)+s),[255*e,255*n,255*i]},r.xyz.rgb=function(t){var e,n,i,r=t[0]/100,o=t[1]/100,a=t[2]/100;return e=3.2406*r+-1.5372*o+-.4986*a,n=-.9689*r+1.8758*o+.0415*a,i=.0557*r+-.204*o+1.057*a,e=e>.0031308?1.055*Math.pow(e,1/2.4)-.055:12.92*e,n=n>.0031308?1.055*Math.pow(n,1/2.4)-.055:12.92*n,i=i>.0031308?1.055*Math.pow(i,1/2.4)-.055:12.92*i,e=Math.min(Math.max(0,e),1),n=Math.min(Math.max(0,n),1),i=Math.min(Math.max(0,i),1),[255*e,255*n,255*i]},r.xyz.lab=function(t){var e,n,i,r=t[0],o=t[1],a=t[2];return r/=95.047,o/=100,a/=108.883,r=r>.008856?Math.pow(r,1/3):7.787*r+16/116,o=o>.008856?Math.pow(o,1/3):7.787*o+16/116,a=a>.008856?Math.pow(a,1/3):7.787*a+16/116,e=116*o-16,n=500*(r-o),i=200*(o-a),[e,n,i]},r.lab.xyz=function(t){var e,n,i,r=t[0],o=t[1],a=t[2];n=(r+16)/116,e=o/500+n,i=n-a/200;var s=Math.pow(n,3),c=Math.pow(e,3),l=Math.pow(i,3);return n=s>.008856?s:(n-16/116)/7.787,e=c>.008856?c:(e-16/116)/7.787,i=l>.008856?l:(i-16/116)/7.787,e*=95.047,n*=100,i*=108.883,[e,n,i]},r.lab.lch=function(t){var e,n,i,r=t[0],o=t[1],a=t[2];return e=Math.atan2(a,o),n=360*e/2/Math.PI,n<0&&(n+=360),i=Math.sqrt(o*o+a*a),[r,i,n]},r.lch.lab=function(t){var e,n,i,r=t[0],o=t[1],a=t[2];return i=a/360*2*Math.PI,e=o*Math.cos(i),n=o*Math.sin(i),[r,e,n]},r.rgb.ansi16=function(t){var e=t[0],n=t[1],i=t[2],o=1 in arguments?arguments[1]:r.rgb.hsv(t)[2];if(0===(o=Math.round(o/50)))return 30;var a=30+(Math.round(i/255)<<2|Math.round(n/255)<<1|Math.round(e/255));return 2===o&&(a+=60),a},r.hsv.ansi16=function(t){return r.rgb.ansi16(r.hsv.rgb(t),t[2])},r.rgb.ansi256=function(t){var e=t[0],n=t[1],i=t[2];return e===n&&n===i?e<8?16:e>248?231:Math.round((e-8)/247*24)+232:16+36*Math.round(e/255*5)+6*Math.round(n/255*5)+Math.round(i/255*5)},r.ansi16.rgb=function(t){var e=t%10;if(0===e||7===e)return t>50&&(e+=3.5),e=e/10.5*255,[e,e,e];var n=.5*(1+~~(t>50));return[(1&e)*n*255,(e>>1&1)*n*255,(e>>2&1)*n*255]},r.ansi256.rgb=function(t){if(t>=232){var e=10*(t-232)+8;return[e,e,e]}t-=16;var n;return[Math.floor(t/36)/5*255,Math.floor((n=t%36)/6)/5*255,n%6/5*255]},r.rgb.hex=function(t){var e=((255&Math.round(t[0]))<<16)+((255&Math.round(t[1]))<<8)+(255&Math.round(t[2])),n=e.toString(16).toUpperCase();return"000000".substring(n.length)+n},r.hex.rgb=function(t){var e=t.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);if(!e)return[0,0,0];var n=e[0];3===e[0].length&&(n=n.split("").map(function(t){return t+t}).join(""));var i=parseInt(n,16);return[i>>16&255,i>>8&255,255&i]},r.rgb.hcg=function(t){var e,n,i=t[0]/255,r=t[1]/255,o=t[2]/255,a=Math.max(Math.max(i,r),o),s=Math.min(Math.min(i,r),o),c=a-s;return e=c<1?s/(1-c):0,n=c<=0?0:a===i?(r-o)/c%6:a===r?2+(o-i)/c:4+(i-r)/c+4,n/=6,n%=1,[360*n,100*c,100*e]},r.hsl.hcg=function(t){var e=t[1]/100,n=t[2]/100,i=1,r=0;return i=n<.5?2*e*n:2*e*(1-n),i<1&&(r=(n-.5*i)/(1-i)),[t[0],100*i,100*r]},r.hsv.hcg=function(t){var e=t[1]/100,n=t[2]/100,i=e*n,r=0;return i<1&&(r=(n-i)/(1-i)),[t[0],100*i,100*r]},r.hcg.rgb=function(t){var e=t[0]/360,n=t[1]/100,i=t[2]/100;if(0===n)return[255*i,255*i,255*i];var r=[0,0,0],o=e%1*6,a=o%1,s=1-a,c=0;switch(Math.floor(o)){case 0:r[0]=1,r[1]=a,r[2]=0;break;case 1:r[0]=s,r[1]=1,r[2]=0;break;case 2:r[0]=0,r[1]=1,r[2]=a;break;case 3:r[0]=0,r[1]=s,r[2]=1;break;case 4:r[0]=a,r[1]=0,r[2]=1;break;default:r[0]=1,r[1]=0,r[2]=s}return c=(1-n)*i,[255*(n*r[0]+c),255*(n*r[1]+c),255*(n*r[2]+c)]},r.hcg.hsv=function(t){var e=t[1]/100,n=t[2]/100,i=e+n*(1-e),r=0;return i>0&&(r=e/i),[t[0],100*r,100*i]},r.hcg.hsl=function(t){var e=t[1]/100,n=t[2]/100,i=n*(1-e)+.5*e,r=0;return i>0&&i<.5?r=e/(2*i):i>=.5&&i<1&&(r=e/(2*(1-i))),[t[0],100*r,100*i]},r.hcg.hwb=function(t){var e=t[1]/100,n=t[2]/100,i=e+n*(1-e);return[t[0],100*(i-e),100*(1-i)]},r.hwb.hcg=function(t){var e=t[1]/100,n=t[2]/100,i=1-n,r=i-e,o=0;return r<1&&(o=(i-r)/(1-r)),[t[0],100*r,100*o]},r.apple.rgb=function(t){return[t[0]/65535*255,t[1]/65535*255,t[2]/65535*255]},r.rgb.apple=function(t){return[t[0]/255*65535,t[1]/255*65535,t[2]/255*65535]},r.gray.rgb=function(t){return[t[0]/100*255,t[0]/100*255,t[0]/100*255]},r.gray.hsl=r.gray.hsv=function(t){return[0,0,t[0]]},r.gray.hwb=function(t){return[0,100,t[0]]},r.gray.cmyk=function(t){return[0,0,0,t[0]]},r.gray.lab=function(t){return[t[0],0,0]},r.gray.hex=function(t){var e=255&Math.round(t[0]/100*255),n=(e<<16)+(e<<8)+e,i=n.toString(16).toUpperCase();return"000000".substring(i.length)+i},r.rgb.gray=function(t){return[(t[0]+t[1]+t[2])/3/255*100]}})),ct=(st.rgb,st.hsl,st.hsv,st.hwb,st.cmyk,st.xyz,st.lab,st.lch,st.hex,st.keyword,st.ansi16,st.ansi256,st.hcg,st.apple,st.gray,function(t){for(var e=f(t),n={},i=Object.keys(e),r=i.length,o=0;o<r;o++){var a=i[o];null!==e[a].parent&&(n[a]=v(a,e))}return n}),lt={};Object.keys(st).forEach(function(t){lt[t]={},Object.defineProperty(lt[t],"channels",{value:st[t].channels}),Object.defineProperty(lt[t],"labels",{value:st[t].labels});var e=ct(t);Object.keys(e).forEach(function(n){var i=e[n];lt[t][n]=y(i),lt[t][n].raw=g(i)})});var ht=lt,ut=[].slice,dt=["keyword","gray","hex"],pt={};Object.keys(ht).forEach(function(t){pt[ut.call(ht[t].labels).sort().join("")]=t});var ft={};_.prototype={toString:function(){return this.string()},toJSON:function(){return this[this.model]()},string:function(t){var e=this.model in at.to?this:this.rgb();e=e.round("number"===typeof t?t:1);var n=1===e.valpha?e.color:e.color.concat(this.valpha);return at.to[e.model](n)}
1,percentString:function(t){var e=this.rgb().round("number"===typeof t?t:1),n=1===e.valpha?e.color:e.color.concat(this.valpha);return at.to.rgb.percent(n)},array:function(){return 1===this.valpha?this.color.slice():this.color.concat(this.valpha)},object:function(){for(var t={},e=ht[this.model].channels,n=ht[this.model].labels,i=0;i<e;i++)t[n[i]]=this.color[i];return 1!==this.valpha&&(t.alpha=this.valpha),t},unitArray:function(){var t=this.rgb().color;return t[0]/=255,t[1]/=255,t[2]/=255,1!==this.valpha&&t.push(this.valpha),t},unitObject:function(){var t=this.rgb().object();return t.r/=255,t.g/=255,t.b/=255,1!==this.valpha&&(t.alpha=this.valpha),t},round:function(t){return t=Math.max(t||0,0),new _(this.color.map(x(t)).concat(this.valpha),this.model)},alpha:function(t){return arguments.length?new _(this.color.concat(Math.max(0,Math.min(1,t))),this.model):this.valpha},red:w("rgb",0,M(255)),green:w("rgb",1,M(255)),blue:w("rgb",2,M(255)),hue:w(["hsl","hsv","hsl","hwb","hcg"],0,function(t){return(t%360+360)%360}),saturationl:w("hsl",1,M(100)),lightness:w("hsl",2,M(100)),saturationv:w("hsv",1,M(100)),value:w("hsv",2,M(100)),chroma:w("hcg",1,M(100)),gray:w("hcg",2,M(100)),white:w("hwb",1,M(100)),wblack:w("hwb",2,M(100)),cyan:w("cmyk",0,M(100)),magenta:w("cmyk",1,M(100)),yellow:w("cmyk",2,M(100)),black:w("cmyk",3,M(100)),x:w("xyz",0,M(100)),y:w("xyz",1,M(100)),z:w("xyz",2,M(100)),l:w("lab",0,M(100)),a:w("lab",1),b:w("lab",2),keyword:function(t){return arguments.length?new _(t):ht[this.model].keyword(this.color)},hex:function(t){return arguments.length?new _(t):at.to.hex(this.rgb().round().color)},rgbNumber:function(){var t=this.rgb().color;return(255&t[0])<<16|(255&t[1])<<8|255&t[2]},luminosity:function(){for(var t=this.rgb().color,e=[],n=0;n<t.length;n++){var i=t[n]/255;e[n]=i<=.03928?i/12.92:Math.pow((i+.055)/1.055,2.4)}return.2126*e[0]+.7152*e[1]+.0722*e[2]},contrast:function(t){var e=this.luminosity(),n=t.luminosity();return e>n?(e+.05)/(n+.05):(n+.05)/(e+.05)},level:function(t){var e=this.contrast(t);return e>=7.1?"AAA":e>=4.5?"AA":""},dark:function(){var t=this.rgb().color;return(299*t[0]+587*t[1]+114*t[2])/1e3<128},light:function(){return!this.dark()},negate:function(){for(var t=this.rgb(),e=0;e<3;e++)t.color[e]=255-t.color[e];return t},lighten:function(t){var e=this.hsl();return e.color[2]+=e.color[2]*t,e},darken:function(t){var e=this.hsl();return e.color[2]-=e.color[2]*t,e},saturate:function(t){var e=this.hsl();return e.color[1]+=e.color[1]*t,e},desaturate:function(t){var e=this.hsl();return e.color[1]-=e.color[1]*t,e},whiten:function(t){var e=this.hwb();return e.color[1]+=e.color[1]*t,e},blacken:function(t){var e=this.hwb();return e.color[2]+=e.color[2]*t,e},grayscale:function(){var t=this.rgb().color,e=.3*t[0]+.59*t[1]+.11*t[2];return _.rgb(e,e,e)},fade:function(t){return this.alpha(this.valpha-this.valpha*t)},opaquer:function(t){return this.alpha(this.valpha+this.valpha*t)},rotate:function(t){var e=this.hsl(),n=e.color[0];return n=(n+t)%360,n=n<0?360+n:n,e.color[0]=n,e},mix:function(t,e){var n=t.rgb(),i=this.rgb(),r=void 0===e?.5:e,o=2*r-1,a=n.alpha()-i.alpha(),s=((o*a===-1?o:(o+a)/(1+o*a))+1)/2,c=1-s;return _.rgb(s*n.red()+c*i.red(),s*n.green()+c*i.green(),s*n.blue()+c*i.blue(),n.alpha()*r+i.alpha()*(1-r))}},Object.keys(ht).forEach(function(t){if(-1===dt.indexOf(t)){var e=ht[t].channels;_.prototype[t]=function(){if(this.model===t)return new _(this);if(arguments.length)return new _(arguments,t);var n="number"===typeof arguments[e]?e:this.valpha;return new _(E(ht[this.model][t].raw(this.color)).concat(n),t)},_[t]=function(n){return"number"===typeof n&&(n=T(ut.call(arguments),e)),new _(n,t)}}});var mt=_,vt=function(){function t(){L(this,t)}return R(t,null,[{key:"element",value:function(t){try{return t instanceof window.HTMLElement}catch(e){return"object"===("undefined"===typeof t?"undefined":A(t))&&1===t.nodeType&&"object"===A(t.style)&&"object"===A(t.ownerDocument)}}},{key:"array",value:function(t){return"[object Array]"===Object.prototype.toString.call(t)}},{key:"object",value:function(t){return"object"===("undefined"===typeof t?"undefined":A(t))&&!this.array(t)}},{key:"canvas",value:function(t){return!!t.getContext}}]),t}
1(),gt=function(){function t(){L(this,t)}return R(t,null,[{key:"randomBetween",value:function(t,e){return t+(arguments.length>2&&void 0!==arguments[2]?arguments[2]:Math.random)()*(e-t)}},{key:"randomFrom",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Math.random;if(vt.array(t))return t[Math.floor(e()*t.length)];if(vt.object(t)){var n={},i=Object.keys(t)[Math.floor(e()*Object.keys(t).length)],r=t[i];return n[i]=r,n}}},{key:"TWO_PI",get:function(){return 2*Math.PI}},{key:"HALF_PI",get:function(){return Math.PI/2}},{key:"QUARTER_PI",get:function(){return Math.PI/4}}]),t}(),yt=r(function(t,e){!function(e,n){t.exports=function(){var t=function t(){function e(t){return r.appendChild(t.dom),t}function n(t){for(var e=0;e<r.children.length;e++)r.children[e].style.display=e===t?"block":"none";i=t}var i=0,r=document.createElement("div");r.style.cssText="position:fixed;top:0;left:0;cursor:pointer;opacity:0.9;z-index:10000",r.addEventListener("click",function(t){t.preventDefault(),n(++i%r.children.length)},!1);var o=(performance||Date).now(),a=o,s=0,c=e(new t.Panel("FPS","#0ff","#002")),l=e(new t.Panel("MS","#0f0","#020"));if(self.performance&&self.performance.memory)var h=e(new t.Panel("MB","#f08","#201"));return n(0),{REVISION:16,dom:r,addPanel:e,showPanel:n,begin:function(){o=(performance||Date).now()},end:function(){s++;var t=(performance||Date).now();if(l.update(t-o,200),t>a+1e3&&(c.update(1e3*s/(t-a),100),a=t,s=0,h)){var e=performance.memory;h.update(e.usedJSHeapSize/1048576,e.jsHeapSizeLimit/1048576)}return t},update:function(){o=this.end()},domElement:r,setMode:n}};return t.Panel=function(t,e,n){var i=1/0,r=0,o=Math.round,a=o(window.devicePixelRatio||1),s=80*a,c=48*a,l=3*a,h=2*a,u=3*a,d=15*a,p=74*a,f=30*a,m=document.createElement("canvas");m.width=s,m.height=c,m.style.cssText="width:80px;height:48px";var v=m.getContext("2d");return v.font="bold "+9*a+"px Helvetica,Arial,sans-serif",v.textBaseline="top",v.fillStyle=n,v.fillRect(0,0,s,c),v.fillStyle=e,v.fillText(t,l,h),v.fillRect(u,d,p,f),v.fillStyle=n,v.globalAlpha=.9,v.fillRect(u,d,p,f),{dom:m,update:function(c,g){i=Math.min(i,c),r=Math.max(r,c),v.fillStyle=n,v.globalAlpha=1,v.fillRect(0,0,s,d),v.fillStyle=e,v.fillText(o(c)+" "+t+" ("+o(i)+"-"+o(r)+")",l,h),v.drawImage(m,u+a,d,p-a,f,u,d,p-a,f),v.fillRect(u+p-a,d,a,f),v.fillStyle=n,v.globalAlpha=.9,v.fillRect(u+p-a,d,a,o((1-c/g)*f))}}},t}()}()}),_t=r(function(t,e){function n(t,e){if(!(this instanceof n))return new n(t,e);this.x=t||0,this.y=e||0}function i(t,e){return Math.floor(Math.random()*(e-t+1)+t)}function r(t){return t*a}function o(t){return t/a}t.exports=n,n.fromArray=function(t){return new n(t[0]||0,t[1]||0)},n.fromObject=function(t){return new n(t.x||0,t.y||0)},n.prototype.addX=function(t){return this.x+=t.x,this},n.prototype.addY=function(t){return this.y+=t.y,this},n.prototype.add=function(t){return this.x+=t.x,this.y+=t.y,this},n.prototype.addScalar=function(t){return this.x+=t,this.y+=t,this},n.prototype.addScalarX=function(t){return this.x+=t,this},n.prototype.addScalarY=function(t){return this.y+=t,this},n.prototype.subtractX=function(t){return this.x-=t.x,this},n.prototype.subtractY=function(t){return this.y-=t.y,this},n.prototype.subtract=function(t){return this.x-=t.x,this.y-=t.y,this},n.prototype.subtractScalar=function(t){return this.x-=t,this.y-=t,this},n.prototype.subtractScalarX=function(t){return this.x-=t,this},n.prototype.subtractScalarY=function(t){return this.y-=t,this},n.prototype.divideX=function(t){return this.x/=t.x,this},n.prototype.divideY=function(t){return this.y/=t.y,this},n.prototype.divide=function(t){return this.x/=t.x,this.y/=t.y,this},n.prototype.divideScalar=function(t){return 0!==t?(this.x/=t,this.y/=t):(this.x=0,this.y=0),this},n.prototype.divideScalarX=function(t){return 0!==t?this.x/=t:this.x=0,this},n.prototype.divideScalarY=function(t){return 0!==t?this.y/=t:this.y=0,this},n.prototype.invertX=function(){return this.x*=-1,this},n.prototype.invertY=function(){return this.y*=-1,this},n.prototype.invert=function(){return this.invertX(),this.invertY(),this},n.prototype.multiplyX=function(t){return this.x*=t.x,this},n.prototype.multiplyY=function(t){return this.y*=t.y,this},n.prototype.multiply=function(t){return this.x*=t.x,this.y*=t.y,this},n.prototype.multiplyScalar=function(t){return this.x*=t,this.y*=t,this},n.prototype.multiplyScalarX=function(t){return this.x*=t,this},n.prototype.multiplyScalarY=function(t){return this.y*=t,this},n.prototype.normalize=function(){var t=this.length();return 0===t?(this.x=1,this.y=0):this.divide(n(t,t)),this},n.prototype.norm=n.prototype.normalize,n.prototype.limit=function(t,e){return Math.abs(this.x)>t&&(this.x*=e),Math.abs(this.y)>t&&(this.y*=e),this},n.prototype.randomize=function(t,e){return this.randomizeX(t,e),this.randomizeY(t,e),this},n.prototype.randomizeX=function(t,e){var n=Math.min(t.x,e.x),r=Math.max(t.x,e.x);return this.x=i(n,r),this},n.prototype.randomizeY=function(t,e){var n=Math.min(t.y,e.y),r=Math.max(t.y,e.y);return this.y=i(n,r),this},n.prototype.randomizeAny=function(t,e){return Math.round(Math.random())?this.randomizeX(t,e):this.randomizeY(t,e),this},n.prototype.unfloat=function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},n.prototype.toFixed=function(t){return"undefined"===typeof t&&(t=8),this.x=this.x.toFixed(t),this.y=this.y.toFixed(t),this},n.prototype.mixX=function(t,e){return"undefined"===typeof e&&(e=.5),this.x=(1-e)*this.x+e*t.x,this},n.prototype.mixY=function(t,e){return"undefined"===typeof e&&(e=.5),this.y=(1-e)*this.y+e*t.y,this},n.prototype.mix=function(t,e){return this.mixX(t,e),this.mixY(t,e),this},n.prototype.clone=function(){return new n(this.x,this.y)},n.prototype.copyX=function(t){return this.x=t.x,this},n.prototype.copyY=function(t){return this.y=t.y,this},n.prototype.copy=function(t){return this.copyX(t),this.copyY(t),this},n.prototype.zero=function(){return this.x=this.y=0,this},n.prototype.dot=function(t){return this.x*t.x+this.y*t.y},n.prototype.cross=function(t){return this.x*t.y-this.y*t.x},n.prototype.projectOnto=function(t){var e=(this.x*t.x+this.y*t.y)/(t.x*t.x+t.y*t.y);return this.x=e*t.x,this.y=e*t.y,this},n.prototype.horizontalAngle=function(){return Math.atan2(this.y,this.x)},n.prototype.horizontalAngleDeg=function(){return r(this.horizontalAngle())},n.prototype.verticalAngle=function(){return Math.atan2(this.x,this.y)},n.prototype.verticalAngleDeg=function(){return r(this.verticalAngle())},n.prototype.angle=n.prototype.horizontalAngle,n.prototype.angleDeg=n.prototype.horizontalAngleDeg,n.prototype.direction=n.prototype.horizontalAngle,n.prototype.rotate=function(t){var e=this.x*Math.cos(t)-this.y*Math.sin(t),n=this.x*Math.sin(t)+this.y*Math.cos(t);return this.x=e,this.y=n,this},n.prototype.rotateDeg=function(t){return t=o(t),this.rotate(t)},n.prototype.rotateTo=function(t){return this.rotate(t-this.angle())},n.prototype.rotateToDeg=function(t){return t=o(t),this.rotateTo(t)},n.prototype.rotateBy=function(t){var e=this.angle()+t;return this.rotate(e)},n.prototype.rotateByDeg=function(t){return t=o(t),this.rotateBy(t)},n.prototype.distanceX=function(t){return this.x-t.x},n.prototype.absDistanceX=function(t){return Math.abs(this.distanceX(t))},n.prototype.distanceY=function(t){return this.y-t.y},n.prototype.absDistanceY=function(t){return Math.abs(this.distanceY(t))},n.prototype.distance=function(t){return Math.sqrt(this.distanceSq(t))},n.prototype.distanceSq=function(t){var e=this.distanceX(t),n=this.distanceY(t);return e*e+n*n},n.prototype.length=function(){return Math.sqrt(this.lengthSq())},n.prototype.lengthSq=function(){return this.x*this.x+this.y*this.y},n.prototype.magnitude=n.prototype.length,n.prototype.isZero=function(){return 0===this.x&&0===this.y},n.prototype.isEqualTo=function(t){return this.x===t.x&&this.y===t.y},n.prototype.toString=function(){return"x:"+this.x+", y:"+this.y},n.prototype.toArray=function(){return[this.x,this.y]},n.prototype.toObject=function(){return{x:this.x,y:this.y}};var a=180/Math.PI});_t.prototype.setLength=function(t){var e=this.length();if(t>=0&&0!==e){var n=this.y/e,i=this.x/e;this.y=n*t,this.x=i*t}return this},_t.prototype.addLength=function(t){return this.setLength(this.length()+t)};var bt=r(function(t){!function(e){function n(){}function r(t,e){return function(){t.apply(e,arguments)}}function o(t){if("object"!==A(this))throw new TypeError("Promises must be constructed via new");if("function"!==typeof t)throw new TypeError("not a function");this._state=0,this._handled=!1,this._value=void 0,this._deferreds=[],u(t,this)}function a(t,e){for(;3===t._state;)t=t._value;if(0===t._state)return void t._deferreds.push(e);t._handled=!0,o._immediateFn(function(){var n=1===t._state?e.onFulfilled:e.onRejected;if(null===n)return void(1===t._state?s:c)(e.promise,t._value);var i;try{i=n(t._value)}catch(t){return void c(e.promise,t)}s(e.promise,i)})}function s(t,e){try{if(e===t)throw new TypeError("A promise cannot be resolved with itself.");if(e&&("object"===("undefined"===typeof e?"undefined":A(e))||"function"===typeof e)){var n=e.then;if(e instanceof o)return t._state=3,t._value=e,void l(t);if("function"===typeof n)return void u(r(n,e),t)}t._state=1,t._value=e,l(t)}catch(e){c(t,e)}}function c(t,e){t._state=2,t._value=e,l(t)}function l(t){2===t._state&&0===t._deferreds.length&&o._immediateFn(function(){t._handled||o._unhandledRejectionFn(t._value)});for(var e=0,n=t._deferreds.length;e<n;e++)a(t,t._deferreds[e]);t._deferreds=null}function h(t,e,n){this.onFulfilled="function"===typeof t?t:null,this.onRejected="function"===typeof e?e:null,this.promise=n}function u(t,e){var n=!1;try{t(function(t){n||(n=!0,s(e,t))},function(t){n||(n=!0,c(e,t))})}catch(t){if(n)return;n=!0,c(e,t)}}var d=setTimeout;o.prototype.catch=function(t){return this.then(null,t)},o.prototype.then=function(t,e){var i=new this.constructor(n);return a(this,new h(t,e,i)),i},o.all=function(t){var e=Array.prototype.slice.call(t);
1return new o(function(t,n){function i(o,a){try{if(a&&("object"===("undefined"===typeof a?"undefined":A(a))||"function"===typeof a)){var s=a.then;if("function"===typeof s)return void s.call(a,function(t){i(o,t)},n)}e[o]=a,0===--r&&t(e)}catch(t){n(t)}}if(0===e.length)return t([]);for(var r=e.length,o=0;o<e.length;o++)i(o,e[o])})},o.resolve=function(t){return t&&"object"===("undefined"===typeof t?"undefined":A(t))&&t.constructor===o?t:new o(function(e){e(t)})},o.reject=function(t){return new o(function(e,n){n(t)})},o.race=function(t){return new o(function(e,n){for(var i=0,r=t.length;i<r;i++)t[i].then(e,n)})},o._immediateFn="function"===typeof i&&function(t){i(t)}||function(t){d(t,0)},o._unhandledRejectionFn=function(t){"undefined"!==typeof console&&console&&console.warn("Possible Unhandled Promise Rejection:",t)},o._setImmediateFn=function(t){o._immediateFn=t},o._setUnhandledRejectionFn=function(t){o._unhandledRejectionFn=t},t.exports?t.exports=o:e.Promise||(e.Promise=o)}(S),function(t){function e(t){return t=+t,0===t||isNaN(t)?t:t>0?1:-1}function n(t){return new Promise(function(e,n){!function i(r){setTimeout(function(){t&&t.data?e():r>=20?n():i(++r)},50)}(0)})}function i(){p=d?(t.screen.orientation.angle||0)*l:(t.orientation||0)*l}function r(t){u.orientation.data=t;for(var e in u.orientation.callbacks)u.orientation.callbacks[e].call(this)}function o(t){u.motion.data=t;for(var e in u.motion.callbacks)u.motion.callbacks[e].call(this)}if(void 0===t.FULLTILT||null===t.FULLTILT){var a=Math.PI,s=a/2,c=2*a,l=a/180,h=180/a,u={orientation:{active:!1,callbacks:[],data:void 0},motion:{active:!1,callbacks:[],data:void 0}},d=!(!t.screen||!t.screen.orientation||void 0===t.screen.orientation.angle||null===t.screen.orientation.angle),p=(d?t.screen.orientation.angle:t.orientation||0)*l,f=s,m=a,v=c/3,g=-s,y={};y.version="0.5.3",y.getDeviceOrientation=function(t){return new Promise(function(e,i){var r=new y.DeviceOrientation(t);r.start(),new n(u.orientation).then(function(){r._alphaAvailable=u.orientation.data.alpha&&null!==u.orientation.data.alpha,r._betaAvailable=u.orientation.data.beta&&null!==u.orientation.data.beta,r._gammaAvailable=u.orientation.data.gamma&&null!==u.orientation.data.gamma,e(r)}).catch(function(){r.stop(),i("DeviceOrientation is not supported")})})},y.getDeviceMotion=function(t){return new Promise(function(e,i){var r=new y.DeviceMotion(t);r.start(),new n(u.motion).then(function(){r._accelerationXAvailable=u.motion.data.acceleration&&u.motion.data.acceleration.x,r._accelerationYAvailable=u.motion.data.acceleration&&u.motion.data.acceleration.y,r._accelerationZAvailable=u.motion.data.acceleration&&u.motion.data.acceleration.z,r._accelerationIncludingGravityXAvailable=u.motion.data.accelerationIncludingGravity&&u.motion.data.accelerationIncludingGravity.x,r._accelerationIncludingGravityYAvailable=u.motion.data.accelerationIncludingGravity&&u.motion.data.accelerationIncludingGravity.y,r._accelerationIncludingGravityZAvailable=u.motion.data.accelerationIncludingGravity&&u.motion.data.accelerationIncludingGravity.z,r._rotationRateAlphaAvailable=u.motion.data.rotationRate&&u.motion.data.rotationRate.alpha,r._rotationRateBetaAvailable=u.motion.data.rotationRate&&u.motion.data.rotationRate.beta,r._rotationRateGammaAvailable=u.motion.data.rotationRate&&u.motion.data.rotationRate.gamma,e(r)}).catch(function(){r.stop(),i("DeviceMotion is not supported")})})},y.Quaternion=function(t,n,i,r){var o;this.set=function(t,e,n,i){this.x=t||0,this.y=e||0,this.z=n||0,this.w=i||1},this.copy=function(t){this.x=t.x,this.y=t.y,this.z=t.z,this.w=t.w},this.setFromEuler=function(){var t,e,n,i,r,o,a,s,c,h,u,d;return function(p){return p=p||{},n=(p.alpha||0)*l,t=(p.beta||0)*l,e=(p.gamma||0)*l,o=n/2,i=t/2,r=e/2,a=Math.cos(i),s=Math.cos(r),c=Math.cos(o),h=Math.sin(i),u=Math.sin(r),d=Math.sin(o),this.set(h*s*c-a*u*d,a*u*c+h*s*d,a*s*d+h*u*c,a*s*c-h*u*d),this.normalize(),this}}(),this.setFromRotationMatrix=function(){var t;return function(n){return t=n.elements,this.set(.5*Math.sqrt(1+t[0]-t[4]-t[8])*e(t[7]-t[5]),.5*Math.sqrt(1-t[0]+t[4]-t[8])*e(t[2]-t[6]),.5*Math.sqrt(1-t[0]-t[4]+t[8])*e(t[3]-t[1]),.5*Math.sqrt(1+t[0]+t[4]+t[8])),this}}(),this.multiply=function(t){return o=y.Quaternion.prototype.multiplyQuaternions(this,t),this.copy(o),this},this.rotateX=function(t){return o=y.Quaternion.prototype.rotateByAxisAngle(this,[1,0,0],t),this.copy(o),this},this.rotateY=function(t){return o=y.Quaternion.prototype.rotateByAxisAngle(this,[0,1,0],t),this.copy(o),this},this.rotateZ=function(t){return o=y.Quaternion.prototype.rotateByAxisAngle(this,[0,0,1],t),this.copy(o),this},this.normalize=function(){return y.Quaternion.prototype.normalize(this)},this.set(t,n,i,r)},y.Quaternion.prototype={constructor:y.Quaternion,multiplyQuaternions:function(){var t=new y.Quaternion;return function(e,n){var i=e.x,r=e.y,o=e.z,a=e.w,s=n.x,c=n.y,l=n.z,h=n.w;return t.set(i*h+a*s+r*l-o*c,r*h+a*c+o*s-i*l,o*h+a*l+i*c-r*s,a*h-i*s-r*c-o*l),t}}(),normalize:function(t){var e=Math.sqrt(t.x*t.x+t.y*t.y+t.z*t.z+t.w*t.w);
1return 0===e?(t.x=0,t.y=0,t.z=0,t.w=1):(e=1/e,t.x*=e,t.y*=e,t.z*=e,t.w*=e),t},rotateByAxisAngle:function(){var t,e,n=new y.Quaternion,i=new y.Quaternion;return function(r,o,a){return t=(a||0)/2,e=Math.sin(t),i.set((o[0]||0)*e,(o[1]||0)*e,(o[2]||0)*e,Math.cos(t)),n=y.Quaternion.prototype.multiplyQuaternions(r,i),y.Quaternion.prototype.normalize(n)}}()},y.RotationMatrix=function(t,e,n,i,r,o,a,s,c){var h;this.elements=new Float32Array(9),this.identity=function(){return this.set(1,0,0,0,1,0,0,0,1),this},this.set=function(t,e,n,i,r,o,a,s,c){this.elements[0]=t||1,this.elements[1]=e||0,this.elements[2]=n||0,this.elements[3]=i||0,this.elements[4]=r||1,this.elements[5]=o||0,this.elements[6]=a||0,this.elements[7]=s||0,this.elements[8]=c||1},this.copy=function(t){this.elements[0]=t.elements[0],this.elements[1]=t.elements[1],this.elements[2]=t.elements[2],this.elements[3]=t.elements[3],this.elements[4]=t.elements[4],this.elements[5]=t.elements[5],this.elements[6]=t.elements[6],this.elements[7]=t.elements[7],this.elements[8]=t.elements[8]},this.setFromEuler=function(){var t,e,n,i,r,o,a,s,c;return function(h){return h=h||{},n=(h.alpha||0)*l,t=(h.beta||0)*l,e=(h.gamma||0)*l,i=Math.cos(t),r=Math.cos(e),o=Math.cos(n),a=Math.sin(t),s=Math.sin(e),c=Math.sin(n),this.set(o*r-c*a*s,-i*c,r*c*a+o*s,r*c+o*a*s,o*i,c*s-o*r*a,-i*s,a,i*r),this.normalize(),this}}(),this.setFromQuaternion=function(){var t,e,n,i;return function(r){return t=r.w*r.w,e=r.x*r.x,n=r.y*r.y,i=r.z*r.z,this.set(t+e-n-i,2*(r.x*r.y-r.w*r.z),2*(r.x*r.z+r.w*r.y),2*(r.x*r.y+r.w*r.z),t-e+n-i,2*(r.y*r.z-r.w*r.x),2*(r.x*r.z-r.w*r.y),2*(r.y*r.z+r.w*r.x),t-e-n+i),this}}(),this.multiply=function(t){return h=y.RotationMatrix.prototype.multiplyMatrices(this,t),this.copy(h),this},this.rotateX=function(t){return h=y.RotationMatrix.prototype.rotateByAxisAngle(this,[1,0,0],t),this.copy(h),this},this.rotateY=function(t){return h=y.RotationMatrix.prototype.rotateByAxisAngle(this,[0,1,0],t),this.copy(h),this},this.rotateZ=function(t){return h=y.RotationMatrix.prototype.rotateByAxisAngle(this,[0,0,1],t),this.copy(h),this},this.normalize=function(){return y.RotationMatrix.prototype.normalize(this)},this.set(t,e,n,i,r,o,a,s,c)},y.RotationMatrix.prototype={constructor:y.RotationMatrix,multiplyMatrices:function(){var t,e,n=new y.RotationMatrix;return function(i,r){return t=i.elements,e=r.elements,n.set(t[0]*e[0]+t[1]*e[3]+t[2]*e[6],t[0]*e[1]+t[1]*e[4]+t[2]*e[7],t[0]*e[2]+t[1]*e[5]+t[2]*e[8],t[3]*e[0]+t[4]*e[3]+t[5]*e[6],t[3]*e[1]+t[4]*e[4]+t[5]*e[7],t[3]*e[2]+t[4]*e[5]+t[5]*e[8],t[6]*e[0]+t[7]*e[3]+t[8]*e[6],t[6]*e[1]+t[7]*e[4]+t[8]*e[7],t[6]*e[2]+t[7]*e[5]+t[8]*e[8]),n}}(),normalize:function(t){var e=t.elements,n=e[0]*e[4]*e[8]-e[0]*e[5]*e[7]-e[1]*e[3]*e[8]+e[1]*e[5]*e[6]+e[2]*e[3]*e[7]-e[2]*e[4]*e[6];return e[0]/=n,e[1]/=n,e[2]/=n,e[3]/=n,e[4]/=n,e[5]/=n,e[6]/=n,e[7]/=n,e[8]/=n,t.elements=e,t},rotateByAxisAngle:function(){var t,e,n=new y.RotationMatrix,i=new y.RotationMatrix,r=!1;return function(o,a,s){return i.identity(),r=!1,t=Math.sin(s),e=Math.cos(s),1===a[0]&&0===a[1]&&0===a[2]?(r=!0,i.elements[4]=e,i.elements[5]=-t,i.elements[7]=t,i.elements[8]=e):1===a[1]&&0===a[0]&&0===a[2]?(r=!0,i.elements[0]=e,i.elements[2]=t,i.elements[6]=-t,i.elements[8]=e):1===a[2]&&0===a[0]&&0===a[1]&&(r=!0,i.elements[0]=e,i.elements[1]=-t,i.elements[3]=t,i.elements[4]=e),r?(n=y.RotationMatrix.prototype.multiplyMatrices(o,i),n=y.RotationMatrix.prototype.normalize(n)):n=o,n}}()},y.Euler=function(t,e,n){this.set=function(t,e,n){this.alpha=t||0,this.beta=e||0,this.gamma=n||0},this.copy=function(t){this.alpha=t.alpha,this.beta=t.beta,this.gamma=t.gamma},this.setFromRotationMatrix=function(){var t,e,n,i;return function(r){t=r.elements,t[8]>0?(e=Math.atan2(-t[1],t[4]),n=Math.asin(t[7]),i=Math.atan2(-t[6],t[8])):t[8]<0?(e=Math.atan2(t[1],-t[4]),n=-Math.asin(t[7]),n+=n>=0?-a:a,i=Math.atan2(t[6],-t[8])):t[6]>0?(e=Math.atan2(-t[1],t[4]),n=Math.asin(t[7]),i=-s):t[6]<0?(e=Math.atan2(t[1],-t[4]),n=-Math.asin(t[7]),n+=n>=0?-a:a,i=-s):(e=Math.atan2(t[3],t[0]),n=t[7]>0?s:-s,i=0),e<0&&(e+=c),e*=h,n*=h,i*=h,this.set(e,n,i)}}(),this.setFromQuaternion=function(){var t,e,n;return function(i){var r=i.w*i.w,o=i.x*i.x,l=i.y*i.y,u=i.z*i.z,d=r+o+l+u,p=i.w*i.x+i.y*i.z;if(p>.499999*d)t=2*Math.atan2(i.y,i.w),e=s,n=0;else if(p<(1e-6-.5)*d)t=-2*Math.atan2(i.y,i.w),e=-s,n=0;else{var f=r-o+l-u,m=2*(i.w*i.z-i.x*i.y),v=r-o-l+u,g=2*(i.w*i.y-i.x*i.z);v>0?(t=Math.atan2(m,f),e=Math.asin(2*p/d),n=Math.atan2(g,v)):(t=Math.atan2(-m,-f),e=-Math.asin(2*p/d),e+=e<0?a:-a,n=Math.atan2(-g,-v))}t<0&&(t+=c),t*=h,e*=h,n*=h,this.set(t,e,n)}}(),this.rotateX=function(t){return y.Euler.prototype.rotateByAxisAngle(this,[1,0,0],t),this},this.rotateY=function(t){return y.Euler.prototype.rotateByAxisAngle(this,[0,1,0],t),this},this.rotateZ=function(t){return y.Euler.prototype.rotateByAxisAngle(this,[0,0,1],t),this},this.set(t,e,n)},y.Euler.prototype={constructor:y.Euler,rotateByAxisAngle:function(){var t=new y.RotationMatrix;return function(e,n,i){return t.setFromEuler(e),t=y.RotationMatrix.prototype.rotateByAxisAngle(t,n,i),e.setFromRotationMatrix(t),e}}()},y.DeviceOrientation=function(e){this.options=e||{};var n=0,i=0;if(this.alphaOffsetScreen=0,this.alphaOffsetDevice=void 0,"game"===this.options.type){var r=function(e){if(null!==e.alpha&&(this.alphaOffsetDevice=new y.Euler(e.alpha,0,0),this.alphaOffsetDevice.rotateZ(-p),++i>=10))return void t.removeEventListener("deviceorientation",r,!1);++n>=200&&t.removeEventListener("deviceorientation",r,!1)}.bind(this);t.addEventListener("deviceorientation",r,!1)}else if("world"===this.options.type){var o=function(e){if(!0!==e.absolute&&void 0!==e.webkitCompassAccuracy&&null!==e.webkitCompassAccuracy&&+e.webkitCompassAccuracy>=0&&+e.webkitCompassAccuracy<50&&(this.alphaOffsetDevice=new y.Euler(e.webkitCompassHeading,0,0),this.alphaOffsetDevice.rotateZ(p),this.alphaOffsetScreen=p,++i>=10))return void t.removeEventListener("deviceorientation",o,!1);++n>=200&&t.removeEventListener("deviceorientation",o,!1)}.bind(this);t.addEventListener("deviceorientation",o,!1)}},y.DeviceOrientation.prototype={constructor:y.DeviceOrientation,start:function(e){e&&"[object Function]"==Object.prototype.toString.call(e)&&u.orientation.callbacks.push(e),d?t.screen.orientation.addEventListener("change",i,!1):t.addEventListener("orientationchange",i,!1),u.orientation.active||(t.addEventListener("deviceorientation",r,!1),u.orientation.active=!0)},stop:function(){u.orientation.active&&(t.removeEventListener("deviceorientation",r,!1),u.orientation.active=!1)},listen:function(t){this.start(t)},getFixedFrameQuaternion:function(){var t=new y.Euler,e=new y.RotationMatrix,n=new y.Quaternion;return function(){var i=u.orientation.data||{alpha:0,beta:0,gamma:0},r=i.alpha;return this.alphaOffsetDevice&&(e.setFromEuler(this.alphaOffsetDevice),e.rotateZ(-this.alphaOffsetScreen),t.setFromRotationMatrix(e),t.alpha<0&&(t.alpha+=360),t.alpha%=360,r-=t.alpha),t.set(r,i.beta,i.gamma),n.setFromEuler(t),n}}(),getScreenAdjustedQuaternion:function(){var t;return function(){return t=this.getFixedFrameQuaternion(),t.rotateZ(-p),t}}(),getFixedFrameMatrix:function(){var t=new y.Euler,e=new y.RotationMatrix;return function(){var n=u.orientation.data||{alpha:0,beta:0,gamma:0},i=n.alpha;return this.alphaOffsetDevice&&(e.setFromEuler(this.alphaOffsetDevice),e.rotateZ(-this.alphaOffsetScreen),t.setFromRotationMatrix(e),t.alpha<0&&(t.alpha+=360),t.alpha%=360,i-=t.alpha),t.set(i,n.beta,n.gamma),e.setFromEuler(t),e}}(),getScreenAdjustedMatrix:function(){var t;return function(){return t=this.getFixedFrameMatrix(),t.rotateZ(-p),t}}(),getFixedFrameEuler:function(){var t,e=new y.Euler;return function(){return t=this.getFixedFrameMatrix(),e.setFromRotationMatrix(t),e}}(),getScreenAdjustedEuler:function(){var t,e=new y.Euler;return function(){return t=this.getScreenAdjustedMatrix(),e.setFromRotationMatrix(t),e}}(),isAbsolute:function(){return!(!u.orientation.data||!0!==u.orientation.data.absolute)},getLastRawEventData:function(){return u.orientation.data||{}}
1,_alphaAvailable:!1,_betaAvailable:!1,_gammaAvailable:!1,isAvailable:function(t){switch(t){case this.ALPHA:return this._alphaAvailable;case this.BETA:return this._betaAvailable;case this.GAMMA:return this._gammaAvailable}},ALPHA:"alpha",BETA:"beta",GAMMA:"gamma"},y.DeviceMotion=function(t){this.options=t||{}},y.DeviceMotion.prototype={constructor:y.DeviceMotion,start:function(e){e&&"[object Function]"==Object.prototype.toString.call(e)&&u.motion.callbacks.push(e),d?t.screen.orientation.addEventListener("change",i,!1):t.addEventListener("orientationchange",i,!1),u.motion.active||(t.addEventListener("devicemotion",o,!1),u.motion.active=!0)},stop:function(){u.motion.active&&(t.removeEventListener("devicemotion",o,!1),u.motion.active=!1)},listen:function(t){this.start(t)},getScreenAdjustedAcceleration:function(){var t=u.motion.data&&u.motion.data.acceleration?u.motion.data.acceleration:{x:0,y:0,z:0},e={};switch(p){case f:e.x=-t.y,e.y=t.x;break;case m:e.x=-t.x,e.y=-t.y;break;case v:case g:e.x=t.y,e.y=-t.x;break;default:e.x=t.x,e.y=t.y}return e.z=t.z,e},getScreenAdjustedAccelerationIncludingGravity:function(){var t=u.motion.data&&u.motion.data.accelerationIncludingGravity?u.motion.data.accelerationIncludingGravity:{x:0,y:0,z:0},e={};switch(p){case f:e.x=-t.y,e.y=t.x;break;case m:e.x=-t.x,e.y=-t.y;break;case v:case g:e.x=t.y,e.y=-t.x;break;default:e.x=t.x,e.y=t.y}return e.z=t.z,e},getScreenAdjustedRotationRate:function(){var t=u.motion.data&&u.motion.data.rotationRate?u.motion.data.rotationRate:{alpha:0,beta:0,gamma:0},e={};switch(p){case f:e.beta=-t.gamma,e.gamma=t.beta;break;case m:e.beta=-t.beta,e.gamma=-t.gamma;break;case v:case g:e.beta=t.gamma,e.gamma=-t.beta;break;default:e.beta=t.beta,e.gamma=t.gamma}return e.alpha=t.alpha,e},getLastRawEventData:function(){return u.motion.data||{}},_accelerationXAvailable:!1,_accelerationYAvailable:!1,_accelerationZAvailable:!1,_accelerationIncludingGravityXAvailable:!1,_accelerationIncludingGravityYAvailable:!1,_accelerationIncludingGravityZAvailable:!1,_rotationRateAlphaAvailable:!1,_rotationRateBetaAvailable:!1,_rotationRateGammaAvailable:!1,isAvailable:function(t){switch(t){case this.ACCELERATION_X:return this._accelerationXAvailable;case this.ACCELERATION_Y:return this._accelerationYAvailable;case this.ACCELERATION_Z:return this._accelerationZAvailable;case this.ACCELERATION_INCLUDING_GRAVITY_X:return this._accelerationIncludingGravityXAvailable;case this.ACCELERATION_INCLUDING_GRAVITY_Y:return this._accelerationIncludingGravityYAvailable;case this.ACCELERATION_INCLUDING_GRAVITY_Z:return this._accelerationIncludingGravityZAvailable;case this.ROTATION_RATE_ALPHA:return this._rotationRateAlphaAvailable;case this.ROTATION_RATE_BETA:return this._rotationRateBetaAvailable;case this.ROTATION_RATE_GAMMA:return this._rotationRateGammaAvailable}},ACCELERATION_X:"accelerationX",ACCELERATION_Y:"accelerationY",ACCELERATION_Z:"accelerationZ",ACCELERATION_INCLUDING_GRAVITY_X:"accelerationIncludingGravityX",ACCELERATION_INCLUDING_GRAVITY_Y:"accelerationIncludingGravityY",ACCELERATION_INCLUDING_GRAVITY_Z:"accelerationIncludingGravityZ",ROTATION_RATE_ALPHA:"rotationRateAlpha",ROTATION_RATE_BETA:"rotationRateBeta",ROTATION_RATE_GAMMA:"rotationRateGamma"},t.FULLTILT=y}}(window),function(e,n){t.exports?t.exports=e.GyroNorm=n():e.GyroNorm=n()}(S,function(){function t(t){return Math.round(t*Math.pow(10,f))/Math.pow(10,f)}function e(){var e={};e=v?l.getScreenAdjustedEuler():l.getFixedFrameEuler();var n=h.getScreenAdjustedAcceleration(),r=h.getScreenAdjustedAccelerationIncludingGravity(),s=h.getScreenAdjustedRotationRate(),c=0;p===i?(c=e.alpha-o,c=c<0?360-Math.abs(c):c):c=e.alpha;var u={do:{alpha:t(c),beta:t(e.beta),gamma:t(e.gamma),absolute:l.isAbsolute()},dm:{x:t(n.x),y:t(n.y),z:t(n.z),gx:t(r.x),gy:t(r.y),gz:t(r.z),alpha:t(s.alpha),beta:t(s.beta),gamma:t(s.gamma)}};return d&&(u.dm.gx*=a,u.dm.gy*=a,u.dm.gz*=a),u}function n(t){m&&("string"==typeof t&&(t={message:t,code:0}),m(t))}var i="game",r=null,o=0,a=0,s=!1,c=!1,l=null,h=null,u=50,d=!0,p=i,f=2,m=null,v=!1,g=function(t){};return g.GAME=i,g.WORLD="world",g.DEVICE_ORIENTATION="deviceorientation",g.ACCELERATION="acceleration",g.ACCELERATION_INCLUDING_GRAVITY="accelerationinludinggravity",g.ROTATION_RATE="rotationrate",g.prototype.init=function(t){t&&t.frequency&&(u=t.frequency),t&&t.gravityNormalized&&(d=t.gravityNormalized),t&&t.orientationBase&&(p=t.orientationBase),t&&"number"===typeof t.decimalCount&&t.decimalCount>=0&&(f=parseInt(t.decimalCount)),t&&t.logger&&(m=t.logger),t&&t.screenAdjusted&&(v=t.screenAdjusted);var e=new FULLTILT.getDeviceOrientation({type:p}).then(function(t){l=t}),n=(new FULLTILT.getDeviceMotion).then(function(t){h=t,a=h.getScreenAdjustedAccelerationIncludingGravity().z>0?-1:1});return Promise.all([e,n]).then(function(){c=!0})},g.prototype.end=function(){try{c=!1,this.stop(),h.stop(),l.stop()}catch(t){n(t)}},g.prototype.start=function(t){if(!c)return void n({message:'GyroNorm is not initialized yet. First call the "init()" function.',code:1});r=setInterval(function(){t(e())},u),s=!0},g.prototype.stop=function(){r&&(clearInterval(r),s=!1)},g.prototype.normalizeGravity=function(t){d=!!t},g.prototype.setHeadDirection=function(){return!v&&"world"!==p&&(o=l.getFixedFrameEuler().alph
1a,!0)},g.prototype.startLogging=function(t){t&&(m=t)},g.prototype.stopLogging=function(){m=null},g.prototype.isAvailable=function(t){var e=l.getScreenAdjustedEuler(),n=h.getScreenAdjustedAcceleration(),i=h.getScreenAdjustedAccelerationIncludingGravity(),r=h.getScreenAdjustedRotationRate();switch(t){case"deviceorientation":return e.alpha&&null!==e.alpha&&e.beta&&null!==e.beta&&e.gamma&&null!==e.gamma;case"acceleration":return n&&n.x&&n.y&&n.z;case"accelerationinludinggravity":return i&&i.x&&i.y&&i.z;case"rotationrate":return r&&r.alpha&&r.beta&&r.gamma;default:return{deviceOrientationAvailable:e.alpha&&null!==e.alpha&&e.beta&&null!==e.beta&&e.gamma&&null!==e.gamma,accelerationAvailable:n&&n.x&&n.y&&n.z,accelerationIncludingGravityAvailable:i&&i.x&&i.y&&i.z,rotationRateAvailable:r&&r.alpha&&r.beta&&r.gamma}}},g.prototype.isRunning=function(){return s},g})});!function(t){function e(t){if("string"!==typeof t&&(t=String(t)),/[^a-z0-9\-#$%&'*+.\^_`|~]/i.test(t))throw new TypeError("Invalid character in header field name");return t.toLowerCase()}function n(t){return"string"!==typeof t&&(t=String(t)),t}function i(t){var e={next:function(){var e=t.shift();return{done:void 0===e,value:e}}};return g.iterable&&(e[Symbol.iterator]=function(){return e}),e}function r(t){this.map={},t instanceof r?t.forEach(function(t,e){this.append(e,t)},this):Array.isArray(t)?t.forEach(function(t){this.append(t[0],t[1])},this):t&&Object.getOwnPropertyNames(t).forEach(function(e){this.append(e,t[e])},this)}function o(t){if(t.bodyUsed)return Promise.reject(new TypeError("Already read"));t.bodyUsed=!0}function a(t){return new Promise(function(e,n){t.onload=function(){e(t.result)},t.onerror=function(){n(t.error)}})}function s(t){var e=new FileReader,n=a(e);return e.readAsArrayBuffer(t),n}function c(t){var e=new FileReader,n=a(e);return e.readAsText(t),n}function l(t){for(var e=new Uint8Array(t),n=new Array(e.length),i=0;i<e.length;i++)n[i]=String.fromCharCode(e[i]);return n.join("")}function h(t){if(t.slice)return t.slice(0);var e=new Uint8Array(t.byteLength);return e.set(new Uint8Array(t)),e.buffer}function u(){return this.bodyUsed=!1,this._initBody=function(t){if(this._bodyInit=t,t)if("string"===typeof t)this._bodyText=t;else if(g.blob&&Blob.prototype.isPrototypeOf(t))this._bodyBlob=t;else if(g.formData&&FormData.prototype.isPrototypeOf(t))this._bodyFormData=t;else if(g.searchParams&&URLSearchParams.prototype.isPrototypeOf(t))this._bodyText=t.toString();else if(g.arrayBuffer&&g.blob&&_(t))this._bodyArrayBuffer=h(t.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer]);else{if(!g.arrayBuffer||!ArrayBuffer.prototype.isPrototypeOf(t)&&!b(t))throw new Error("unsupported BodyInit type");this._bodyArrayBuffer=h(t)}else this._bodyText="";this.headers.get("content-type")||("string"===typeof t?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):g.searchParams&&URLSearchParams.prototype.isPrototypeOf(t)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},g.blob&&(this.blob=function(){var t=o(this);if(t)return t;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?o(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(s)}),this.text=function(){var t=o(this);if(t)return t;if(this._bodyBlob)return c(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(l(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},g.formData&&(this.formData=function(){return this.text().then(f)}),this.json=function(){return this.text().then(JSON.parse)},this}function d(t){var e=t.toUpperCase();return x.indexOf(e)>-1?e:t}function p(t,e){e=e||{};var n=e.body;if(t instanceof p){if(t.bodyUsed)throw new TypeError("Already read");this.url=t.url,this.credentials=t.credentials,e.headers||(this.headers=new r(t.headers)),this.method=t.method,this.mode=t.mode,n||null==t._bodyInit||(n=t._bodyInit,t.bodyUsed=!0)}else this.url=String(t);if(this.credentials=e.credentials||this.credentials||"omit",!e.headers&&this.headers||(this.headers=new r(e.headers)),this.method=d(e.method||this.method||"GET"),this.mode=e.mode||this.mode||null,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&n)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(n)}function f(t){var e=new FormData;return t.trim().split("&").forEach(function(t){if(t){var n=t.split("="),i=n.shift().replace(/\+/g," "),r=n.join("=").replace(/\+/g," ");e.append(decodeURIComponent(i),decodeURIComponent(r))}}),e}function m(t){var e=new r;
1return t.split(/\r?\n/).forEach(function(t){var n=t.split(":"),i=n.shift().trim();if(i){var r=n.join(":").trim();e.append(i,r)}}),e}function v(t,e){e||(e={}),this.type="default",this.status="status"in e?e.status:200,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in e?e.statusText:"OK",this.headers=new r(e.headers),this.url=e.url||"",this._initBody(t)}if(!t.fetch){var g={searchParams:"URLSearchParams"in t,iterable:"Symbol"in t&&"iterator"in Symbol,blob:"FileReader"in t&&"Blob"in t&&function(){try{return new Blob,!0}catch(t){return!1}}(),formData:"FormData"in t,arrayBuffer:"ArrayBuffer"in t};if(g.arrayBuffer)var y=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],_=function(t){return t&&DataView.prototype.isPrototypeOf(t)},b=ArrayBuffer.isView||function(t){return t&&y.indexOf(Object.prototype.toString.call(t))>-1};r.prototype.append=function(t,i){t=e(t),i=n(i);var r=this.map[t];this.map[t]=r?r+","+i:i},r.prototype.delete=function(t){delete this.map[e(t)]},r.prototype.get=function(t){return t=e(t),this.has(t)?this.map[t]:null},r.prototype.has=function(t){return this.map.hasOwnProperty(e(t))},r.prototype.set=function(t,i){this.map[e(t)]=n(i)},r.prototype.forEach=function(t,e){for(var n in this.map)this.map.hasOwnProperty(n)&&t.call(e,this.map[n],n,this)},r.prototype.keys=function(){var t=[];return this.forEach(function(e,n){t.push(n)}),i(t)},r.prototype.values=function(){var t=[];return this.forEach(function(e){t.push(e)}),i(t)},r.prototype.entries=function(){var t=[];return this.forEach(function(e,n){t.push([n,e])}),i(t)},g.iterable&&(r.prototype[Symbol.iterator]=r.prototype.entries);var x=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];p.prototype.clone=function(){return new p(this,{body:this._bodyInit})},u.call(p.prototype),u.call(v.prototype),v.prototype.clone=function(){return new v(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new r(this.headers),url:this.url})},v.error=function(){var t=new v(null,{status:0,statusText:""});return t.type="error",t};var w=[301,302,303,307,308];v.redirect=function(t,e){if(-1===w.indexOf(e))throw new RangeError("Invalid status code");return new v(null,{status:e,headers:{location:t}})},t.Headers=r,t.Request=p,t.Response=v,t.fetch=function(t,e){return new Promise(function(n,i){var r=new p(t,e),o=new XMLHttpRequest;o.onload=function(){var t={status:o.status,statusText:o.statusText,headers:m(o.getAllResponseHeaders()||"")};t.url="responseURL"in o?o.responseURL:t.headers.get("X-Request-URL");var e="response"in o?o.response:o.responseText;n(new v(e,t))},o.onerror=function(){i(new TypeError("Network request failed"))},o.ontimeout=function(){i(new TypeError("Network request failed"))},o.open(r.method,r.url,!0),"include"===r.credentials&&(o.withCredentials=!0),"responseType"in o&&g.blob&&(o.responseType="blob"),r.headers.forEach(function(t,e){o.setRequestHeader(e,t)}),o.send("undefined"===typeof r._bodyInit?null:r._bodyInit)})},t.fetch.polyfill=!0}}("undefined"!==typeof self?self:window);var xt=function(){function t(e,n,i){L(this,t),nt.info("\u26f1 Welcome to Sandpit"),this._queryable=!i||!i.hasOwnProperty("queryable")||i.queryable,this._retina=!i||!i.hasOwnProperty("retina")||i.retina,this._stats=!(!i||!i.hasOwnProperty("stats"))&&i.stats,this._setupContext(e,n,this._retina)}return R(t,null,[{key:"CANVAS",get:function(){return"2d"}},{key:"WEBGL",get:function(){return"webgl"}},{key:"EXPERIMENTAL_WEBGL",get:function(){return"experimental-webgl"}}]),R(t,[{key:"_setupContext",value:function(e,n,i){if("string"!==typeof e&&"object"!==("undefined"===typeof e?"undefined":A(e)))throw new Error('Please provide a string or object reference to the container, like ".container", or document.querySelector(".container")');if("string"!==typeof n||n!==t.CANVAS&&n!==t.WEBGL)throw new Error("Please provide a context type - either `Sandpit.CANVAS` or `Sandpit.WEBGL`");var r=void 0;if("string"===typeof e?r=document.querySelector(e):"object"===("undefined"===typeof e?"undefined":A(e))&&(r=e),!vt.element(r))throw new Error("The container is not a HTMLElement");vt.canvas(r)?this._canvas=r:(this._canvas=document.createElement("canvas"),r.appendChild(this._canvas)),this._canvas.width=this._canvas.clientWidth,this._canvas.height=this._canvas.clientHeight,n===t.CANVAS?this._context=this._canvas.getContext(n):n!==t.WEBGL&&n!==t.EXPERIMENTAL_WEBGL||(this._context=this._canvas.getContext(t.WEBGL)||this._canvas.getContext(t.EXPERIMENTAL_WEBGL)),this._type=n,n===t.CANVAS&&1!==window.devicePixelRatio&&this._retina&&this._handleRetina(),this._stats&&this.setupStats()}},{key:"_handleRetina",value:function(){var t=window.devicePixelRatio;this._canvas.width=this._canvas.clientWidth*t,this._canvas.height=this._canvas.clientHeight*t,this._context.scale(t,t)}},{key:"_setupSettings",value:function(){var t=this;if(this._settings={},this._clearGui=!0,this._resetGui=!0,this._gui&&(this._gui.domElement.removeEventListener("touchmove",this._preventDefault),this._gui.destroy()),this._gui=new P.GUI,this._gui.domElement.addEventListener("touchmove",this._preventDefault,!1),this._queryable&&window.location.search){var e=H.parse(window.location.search);Object.keys(e).forEach(function(n){if(parseFloat(e[n])&&(e[n]=parseFloat(e[n])),t.defaults[n]){var i=e[n];"true"===i&&(i=!0),"false"===i&&(i=!1),"object"!==A(t.defaults[n].value)?t.defaults[n].sticky||(t.defaults[n].value=i):t.defaults[n].sticky?t.defaults[n].selected=t.defaults[n].value[Object.keys(t.defaults[n].value)[0]]:t.defaults[n].selected=i}})}var n=this._gui.addFolder("Settings");
1if(Object.keys(this.defaults).forEach(function(e){var i=!1,r=t.defaults[e].value;if(r||"object"===A(t.defaults[e])){"object"===("undefined"===typeof r?"undefined":A(r))?(i=r,t.defaults[e].selected?t._settings[e]=t.defaults[e].selected:t._settings[e]=vt.array(r)?r[0]:r[Object.keys(r)[0]]):t._settings[e]=t.defaults[e].value;var o=t.defaults[e].color?n.addColor(t._settings,e):n.add(t._settings,e,i);void 0!==t.defaults[e].min&&(o=o.min(t.defaults[e].min)),void 0!==t.defaults[e].max&&(o=o.max(t.defaults[e].max)),void 0!==t.defaults[e].step&&(o=o.step(t.defaults[e].step)),!1===t.defaults[e].editable&&(o.domElement.style.pointerEvents="none",o.domElement.style.opacity=.5),o.onChange(V(function(n){t._change(e,n)}),300)}else switch(e){case"clear":t._clearGui=t.defaults[e];break;case"reset":t._resetGui=t.defaults[e]}}),n.open(),this.width<=767&&this._gui.close(),this._queryable){var i=H.stringify(this._settings);window.history.replaceState({},null,this._getPathFromUrl()+"?"+i),this._clearGui&&this._gui.add({clear:function(){t.clear()}},"clear"),this._resetGui&&this._gui.add({reset:function(){t._reset()}},"reset")}}},{key:"_reset",value:function(){(this._queryable||this.reset)&&(this.reset?this.reset():(window.history.replaceState({},null,this._getPathFromUrl()),window.location.reload()))}},{key:"_change",value:function(t,e){if(nt.info("Update fired on "+t+": "+e),this._queryable){var n=H.stringify(this._settings);window.history.pushState({},null,this._getPathFromUrl()+"?"+n)}this.change&&this.change(t,e)}},{key:"_setupLoop",value:function(){this._time=0,this._loop()}},{key:"_loop",value:function(){this.stats&&this.stats.begin(),this._autoClear&&this.clear(),this.loop&&this.loop(),this._time++,this.stats&&this.stats.end(),this._animationFrame=window.requestAnimationFrame(this._loop.bind(this))}},{key:"_setupEvents",value:function(){var t=this;this._events={},this._setupResize(),this._setupInput(),Object.keys(this._events).forEach(function(e){t._events[e].disable&&t._events[e].disable.addEventListener(e,t._preventDefault,!1),t._events[e].context.addEventListener(e,t._events[e].event.bind(t),!1)})}},{key:"_setupResize",value:function(){this._resizeEvent=this.resize?this.resize:this.resizeCanvas,this._events.resize={event:this._resizeEvent,context:window}}},{key:"_setupMouse",value:function(){this._events.mousemove={event:this._handleMouseMove,context:document},this._events.mousedown={event:this._handleMouseDown,context:document},this._events.mouseenter={event:this._handleMouseEnter,context:document},this._events.mouseleave={event:this._handleMouseLeave,context:document},this._events.mouseup={event:this._handleMouseUp,context:document}}},{key:"_setupTouches",value:function(){var t=document.querySelector("body");this._events.touchmove={event:this._handleTouchMove,disable:document,context:t},this._events.touchstart={event:this._handleTouchStart,disable:document,context:t},this._events.touchend={event:this._handleTouchEnd,disable:document,context:t}}},{key:"_stopPropagation",value:function(t){t.stopPropagation()}},{key:"_preventDefault",value:function(t){t.preventDefault()}},{key:"_setupAccelerometer",value:function(){var t=this;this._gyroscope=new bt,this._gyroscope.init().then(function(){t._gyroscope.start(t._handleAccelerometer.bind(t))}).catch(function(t){nt.warn("Accelerometer is not supported by this device")})}},{key:"_setupInput",value:function(){this.input={},this._setupMouse(),this._setupTouches(),this._setupAccelerometer()}},{key:"_handleMouseMove",value:function(t){t.touches={},t.touches[0]=t,this._handleTouches(t),this.move&&this.move(t)}},{key:"_handleMouseDown",value:function(t){t.touches={},t.touches[0]=t,this._handleTouches(t),this.touch&&this.touch(t)}},{key:"_handleMouseUp",value:function(t){this._handleRelease(),this.release&&this.release(t)}},{key:"_handleMouseEnter",value:function(t){this.input.inFrame=!0}},{key:"_handleMouseLeave",value:function(t){this.input.inFrame=!1}},{key:"_handleTouchMove",value:function(t){t.preventDefault(),this._handleTouches(t),this.move&&this.move(t)}},{key:"_handleTouchStart",value:function(t){this._focusTouchesOnCanvas?t.preventDefault():t.stopPropagation(),this._handleTouches(t),this.touch&&this.touch(t)}},{key:"_handleTouchEnd",value:function(t){this._focusTouchesOnCanvas?t.preventDefault():t.stopPropagation(),this._handleTouches(t),this.release&&this.release(t)}},{key:"_handleAccelerometer",value:function(t){this.input.accelerometer=t,this.input.accelerometer.xAxis=t.do.beta,this.input.accelerometer.yAxis=t.do.gamma,this.input.accelerometer.rotation=t.do.alpha,this.input.accelerometer.gamma=t.do.gamma,this.input.accelerometer.beta=t.do.beta,this.input.accelerometer.alpha=t.do.alpha,this.accelerometer&&this.accelerometer()}},{key:"_handleTouches",value:function(t){var e=this;if(delete t.touches.length,Object.keys(t.touches).length){var n=Object.keys(t.touches).map(function(n,i){0===i&&(e.input.x=t.touches[n].pageX,e.input.y=t.touches[n].pageY);var r={};return e.input.touches&&e.input.touches[n]&&(r.previousX=e.input.touches[n].x,r.previousY=e.input.touches[n].y),r.x=t.touches[n].pageX,r.y=t.touches[n].pageY,t.touches[n].force&&(r.force=t.touches[n].force),r});this.input.touches=n}else this._handleRelease()}},{key:"_handleRelease",value:function(){delete this.input.x,delete this.input.y,delete this.input.touches}},{key:"clear",value:function(){this._type===t.CANVAS?this._context.clearRect(0,0,this.width,this.height):this._type!==t.WEBGL&&this._type!==t.
1EXPERIMENTAL_WEBGL||(this._context.clearColor(0,0,0,0),this._context.clear(this._context.COLOR_BUFFER_BIT|this._context.DEPTH_BUFFER_BIT)),this.change&&this.change()}},{key:"_getPathFromUrl",value:function(){return window.location.toString().split(/[?#]/)[0]}},{key:"clearQueryString",value:function(){window.history.replaceState({},null,this._getPathFromUrl())}},{key:"fill",value:function(e){this._fill=e,this._type===t.CANVAS?(this._context.fillStyle=this._fill,this._context.fillRect(0,0,this.width,this.height)):this._type!==t.WEBGL&&this._type!==t.EXPERIMENTAL_WEBGL||nt.warn("fill() is currently only supported in 2D")}},{key:"get",value:function(t){return new Promise(function(e,n){fetch(t).then(function(t){e(t.text())}).catch(function(t){nt.info("Get fail",t),n()})})}},{key:"random",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"123456";return et(t)}},{key:"resizeCanvas",value:function(){this._type===t.CANVAS&&1!==window.devicePixelRatio&&this._retina?this._handleRetina():(this._canvas.width=this._canvas.clientWidth,this._canvas.height=this._canvas.clientHeight),this._type!==t.WEBGL&&this._type!==t.
1EXPERIMENTAL_WEBGL||this._context.viewport(0,0,this._context.drawingBufferWidth,this._context.drawingBufferHeight),this.change&&this.change()}},{key:"setupStats",value:function(){this.stats||(this.stats=new yt,document.querySelector("body").appendChild(this.stats.dom))}},{key:"start",value:function(){this._setupEvents(),this.setup&&this.setup(),this.loop||nt.warn("Looks like you need to define a loop"),this._setupLoop()}},{key:"stop",value:function(){var t=this;window.cancelAnimationFrame(this._animationFrame),this.canvas&&(this.canvas.outerHTML="",delete this.canvas),this.stats&&(document.querySelector("body").removeChild(this.stats.dom),delete this.stats),this._gui&&(this._gui.domElement.removeEventListener("touchmove",this._preventDefault),this._gui.destroy()),Object.keys(this._events).forEach(function(e){t._events[e].disable&&t._events[e].disable.removeEventListener(e,t._preventDefault),t._events[e].context.removeEventListener(e,t._events[e].event.bind(t))})}},{key:"settings",set:function(t){t&&Object.keys(t).length&&(this.defaults=t,this._setupSettings())},get:function(){return this._settings}},{key:"debug",set:function(t){nt.active=t},get:function(){return nt.active}},{key:"autoClear",set:function(t){this._autoClear=t},get:function(){return this._autoClear}},{key:"focusTouchesOnCanvas",set:function(t){this._focusTouchesOnCanvas=t},get:function(){return this._focusTouchesOnCanvas}},{key:"context",get:function(){return this._context}},{key:"canvas",get:function(){return this._canvas}},{key:"time",get:function(){return this._time}},{key:"width",get:function(){return this._canvas.clientWidth},set:function(t){this._canvas.width=t}},{key:"height",get:function(){return this._canvas.clientHeight},set:function(t){this._canvas.height=t}}]),t}();e.d=xt}).call(e,n(1),n(17).setImmediate)},function(t,e){var n;n=function(){return this}();try{n=n||Function("return this")()||(0,eval)("this")}catch(t){"object"===typeof window&&(n=window)}t.exports=n},function(t,e,n){"use strict";function i(){}function r(t){try{return t.then}catch(t){return g=t,y}}function o(t,e){try{return t(e)}catch(t){return g=t,y}}function a(t,e,n){try{t(e,n)}catch(t){return g=t,y}}function s(t){if("object"!==typeof this)throw new TypeError("Promises must be constructed via new");if("function"!==typeof t)throw new TypeError("Promise constructor's argument is not a function");this._75=0,this._83=0,this._18=null,this._38=null,t!==i&&m(t,this)}function c(t,e,n){return new t.constructor(function(r,o){var a=new s(i);a.then(r,o),l(t,new f(e,n,a))})}function l(t,e){for(;3===t._83;)t=t._18;if(s._47&&s._47(t),0===t._83)return 0===t._75?(t._75=1,void(t._38=e)):1===t._75?(t._75=2,void(t._38=[t._38,e])):void t._38.push(e);h(t,e)}function h(t,e){v(function(){var n=1===t._83?e.onFulfilled:e.onRejected;if(null===n)return void(1===t._83?u(e.promise,t._18):d(e.promise,t._18));var i=o(n,t._18);i===y?d(e.promise,g):u(e.promise,i)})}function u(t,e){if(e===t)return d(t,new TypeError("A promise cannot be resolved with itself."));if(e&&("object"===typeof e||"function"===typeof e)){var n=r(e);if(n===y)return d(t,g);if(n===t.then&&e instanceof s)return t._83=3,t._18=e,void p(t);if("function"===typeof n)return void m(n.bind(e),t)}t._83=1,t._18=e,p(t)}function d(t,e){t._83=2,t._18=e,s._71&&s._71(t,e),p(t)}function p(t){if(1===t._75&&(l(t,t._38),t._38=null),2===t._75){for(var e=0;e<t._38.length;e++)l(t,t._38[e]);t._38=null}}function f(t,e,n){this.onFulfilled="function"===typeof t?t:null,this.onRejected="function"===typeof e?e:null,this.promise=n}function m(t,e){var n=!1,i=a(t,function(t){n||(n=!0,u(e,t))},function(t){n||(n=!0,d(e,t))});n||i!==y||(n=!0,d(e,g))}var v=n(7),g=null,y={};t.exports=s,s._47=null,s._71=null,s._44=i,s.prototype.then=function(t,e){if(this.constructor!==s)return c(this,t,e);var n=new s(i);return l(this,new f(t,e,n)),n}},function(t,e,n){"use strict";function i(t){if(null===t||void 0===t)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(t)}var r=Object.getOwnPropertySymbols,o=Object.prototype.hasOwnProperty,a=Object.prototype.propertyIsEnumerable;t.exports=function(){try{if(!Object.assign)return!1;var t=new String("abc");if(t[5]="de","5"===Object.getOwnPropertyNames(t)[0])return!1;for(var e={},n=0;n<10;n++)e["_"+String.fromCharCode(n)]=n;
1if("0123456789"!==Object.getOwnPropertyNames(e).map(function(t){return e[t]}).join(""))return!1;var i={};return"abcdefghijklmnopqrst".split("").forEach(function(t){i[t]=t}),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},i)).join("")}catch(t){return!1}}()?Object.assign:function(t,e){for(var n,s,c=i(t),l=1;l<arguments.length;l++){n=Object(arguments[l]);for(var h in n)o.call(n,h)&&(c[h]=n[h]);if(r){s=r(n);for(var u=0;u<s.length;u++)a.call(n,s[u])&&(c[s[u]]=n[s[u]])}}return c}},function(t,e,n){n(5),t.exports=n(10)},function(t,e,n){"use strict";"undefined"===typeof Promise&&(n(6).enable(),window.Promise=n(8)),n(9),Object.assign=n(3)},function(t,e,n){"use strict";function i(){l=!1,s._47=null,s._71=null}function r(t){function e(e){(t.allRejections||a(u[e].error,t.whitelist||c))&&(u[e].displayId=h++,t.onUnhandled?(u[e].logged=!0,t.onUnhandled(u[e].displayId,u[e].error)):(u[e].logged=!0,o(u[e].displayId,u[e].error)))}function n(e){u[e].logged&&(t.onHandled?t.onHandled(u[e].displayId,u[e].error):u[e].onUnhandled||(console.warn("Promise Rejection Handled (id: "+u[e].displayId+"):"),console.warn('  This means you can ignore any previous messages of the form "Possible Unhandled Promise Rejection" with id '+u[e].displayId+".")))}t=t||{},l&&i(),l=!0;var r=0,h=0,u={};s._47=function(t){2===t._83&&u[t._56]&&(u[t._56].logged?n(t._56):clearTimeout(u[t._56].timeout),delete u[t._56])},s._71=function(t,n){0===t._75&&(t._56=r++,u[t._56]={displayId:null,error:n,timeout:setTimeout(e.bind(null,t._56),a(n,c)?100:2e3),logged:!1})}}function o(t,e){console.warn("Possible Unhandled Promise Rejection (id: "+t+"):"),((e&&(e.stack||e))+"").split("\n").forEach(function(t){console.warn("  "+t)})}function a(t,e){return e.some(function(e){return t instanceof e})}var s=n(2),c=[ReferenceError,TypeError,RangeError],l=!1;e.disable=i,e.enable=r},function(t,e,n){"use strict";(function(e){function n(t){a.length||(o(),s=!0),a[a.length]=t}function i(){for(;c<a.length;){var t=c;if(c+=1,a[t].call(),c>l){for(var e=0,n=a.length-c;e<n;e++)a[e]=a[e+c];a.length-=c,c=0}}a.length=0,c=0,s=!1}function r(t){return function(){function e(){clearTimeout(n),clearInterval(i),t()}var n=setTimeout(e,0),i=setInterval(e,50)}}t.exports=n;var o,a=[],s=!1,c=0,l=1024,h="undefined"!==typeof e?e:self,u=h.MutationObserver||h.WebKitMutationObserver;o="function"===typeof u?function(t){var e=1,n=new u(t),i=document.createTextNode("");return n.observe(i,{characterData:!0}),function(){e=-e,i.data=e}}(i):r(i),n.requestFlush=o,n.makeRequestCallFromTimer=r}).call(e,n(1))},function(t,e,n){"use strict";function i(t){var e=new r(r._44);return e._83=1,e._18=t,e}var r=n(2);t.exports=r;var o=i(!0),a=i(!1),s=i(null),c=i(void 0),l=i(0),h=i("");r.resolve=function(t){if(t instanceof r)return t;if(null===t)return s;if(void 0===t)return c;if(!0===t)return o;if(!1===t)return a;
1if(0===t)return l;if(""===t)return h;if("object"===typeof t||"function"===typeof t)try{var e=t.then;if("function"===typeof e)return new r(e.bind(t))}catch(t){return new r(function(e,n){n(t)})}return i(t)},r.all=function(t){var e=Array.prototype.slice.call(t);return new r(function(t,n){function i(a,s){if(s&&("object"===typeof s||"function"===typeof s)){if(s instanceof r&&s.then===r.prototype.then){for(;3===s._83;)s=s._18;return 1===s._83?i(a,s._18):(2===s._83&&n(s._18),void s.then(function(t){i(a,t)},n))}var c=s.then;if("function"===typeof c){return void new r(c.bind(s)).then(function(t){i(a,t)},n)}}e[a]=s,0===--o&&t(e)}if(0===e.length)return t([]);for(var o=e.length,a=0;a<e.length;a++)i(a,e[a])})},r.reject=function(t){return new r(function(e,n){n(t)})},r.race=function(t){return new r(function(e,n){t.forEach(function(t){r.resolve(t).then(e,n)})})},r.prototype.catch=function(t){return this.then(null,t)}},function(t,e){!function(t){"use strict";function e(t){if("string"!==typeof t&&(t=String(t)),/[^a-z0-9\-#$%&'*+.\^_`|~]/i.test(t))throw new TypeError("Invalid character in header field name");return t.toLowerCase()}function n(t){return"string"!==typeof t&&(t=String(t)),t}function i(t){var e={next:function(){var e=t.shift();return{done:void 0===e,value:e}}};return g.iterable&&(e[Symbol.iterator]=function(){return e}),e}function r(t){this.map={},t instanceof r?t.forEach(function(t,e){this.append(e,t)},this):Array.isArray(t)?t.forEach(function(t){this.append(t[0],t[1])},this):t&&Object.getOwnPropertyNames(t).forEach(function(e){this.append(e,t[e])},this)}function o(t){if(t.bodyUsed)return Promise.reject(new TypeError("Already read"));t.bodyUsed=!0}function a(t){return new Promise(function(e,n){t.onload=function(){e(t.result)},t.onerror=function(){n(t.error)}})}function s(t){var e=new FileReader,n=a(e);return e.readAsArrayBuffer(t),n}function c(t){var e=new FileReader,n=a(e);return e.readAsText(t),n}function l(t){for(var e=new Uint8Array(t),n=new Array(e.length),i=0;i<e.length;i++)n[i]=String.fromCharCode(e[i]);return n.join("")}function h(t){if(t.slice)return t.slice(0);var e=new Uint8Array(t.byteLength);return e.set(new Uint8Array(t)),e.buffer}function u(){return this.bodyUsed=!1,this._initBody=function(t){if(this._bodyInit=t,t)if("string"===typeof t)this._bodyText=t;else if(g.blob&&Blob.prototype.isPrototypeOf(t))this._bodyBlob=t;else if(g.formData&&FormData.prototype.isPrototypeOf(t))this._bodyFormData=t;else if(g.searchParams&&URLSearchParams.prototype.isPrototypeOf(t))this._bodyText=t.toString();else if(g.arrayBuffer&&g.blob&&_(t))this._bodyArrayBuffer=h(t.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer]);else{if(!g.arrayBuffer||!ArrayBuffer.prototype.isPrototypeOf(t)&&!b(t))throw new Error("unsupported BodyInit type");this._bodyArrayBuffer=h(t)}else this._bodyText="";this.headers.get("content-type")||("string"===typeof t?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):g.searchParams&&URLSearchParams.prototype.isPrototypeOf(t)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},g.blob&&(this.blob=function(){var t=o(this);if(t)return t;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?o(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(s)}),this.text=function(){var t=o(this);if(t)return t;if(this._bodyBlob)return c(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(l(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},g.formData&&(this.formData=function(){return this.text().then(f)}),this.json=function(){return this.text().then(JSON.parse)},this}function d(t){var e=t.toUpperCase();return x.indexOf(e)>-1?e:t}function p(t,e){e=e||{};var n=e.body;if(t instanceof p){if(t.bodyUsed)throw new TypeError("Already read");this.url=t.url,this.credentials=t.credentials,e.headers||(this.headers=new r(t.headers)),this.method=t.method,this.mode=t.mode,n||null==t._bodyInit||(n=t._bodyInit,t.bodyUsed=!0)}else this.url=String(t);if(this.credentials=e.credentials||this.credentials||"omit",!e.headers&&this.headers||(this.headers=new r(e.headers)),this.method=d(e.method||this.method||"GET"),this.mode=e.mode||this.mode||null,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&n)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(n)}function f(t){var e=new FormData;return t.trim().split("&").forEach(function(t){if(t){var n=t.split("="),i=n.shift().replace(/\+/g," "),r=n.join("=").replace(/\+/g," ");e.append(decodeURIComponent(i),decodeURIComponent(r))}}),e}function m(t){var e=new r;
1return t.split(/\r?\n/).forEach(function(t){var n=t.split(":"),i=n.shift().trim();if(i){var r=n.join(":").trim();e.append(i,r)}}),e}function v(t,e){e||(e={}),this.type="default",this.status="status"in e?e.status:200,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in e?e.statusText:"OK",this.headers=new r(e.headers),this.url=e.url||"",this._initBody(t)}if(!t.fetch){var g={searchParams:"URLSearchParams"in t,iterable:"Symbol"in t&&"iterator"in Symbol,blob:"FileReader"in t&&"Blob"in t&&function(){try{return new Blob,!0}catch(t){return!1}}(),formData:"FormData"in t,arrayBuffer:"ArrayBuffer"in t};if(g.arrayBuffer)var y=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],_=function(t){return t&&DataView.prototype.isPrototypeOf(t)},b=ArrayBuffer.isView||function(t){return t&&y.indexOf(Object.prototype.toString.call(t))>-1};r.prototype.append=function(t,i){t=e(t),i=n(i);var r=this.map[t];this.map[t]=r?r+","+i:i},r.prototype.delete=function(t){delete this.map[e(t)]},r.prototype.get=function(t){return t=e(t),this.has(t)?this.map[t]:null},r.prototype.has=function(t){return this.map.hasOwnProperty(e(t))},r.prototype.set=function(t,i){this.map[e(t)]=n(i)},r.prototype.forEach=function(t,e){for(var n in this.map)this.map.hasOwnProperty(n)&&t.call(e,this.map[n],n,this)},r.prototype.keys=function(){var t=[];return this.forEach(function(e,n){t.push(n)}),i(t)},r.prototype.values=function(){var t=[];return this.forEach(function(e){t.push(e)}),i(t)},r.prototype.entries=function(){var t=[];return this.forEach(function(e,n){t.push([n,e])}),i(t)},g.iterable&&(r.prototype[Symbol.iterator]=r.prototype.entries);var x=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];p.prototype.clone=function(){return new p(this,{body:this._bodyInit})},u.call(p.prototype),u.call(v.prototype),v.prototype.clone=function(){return new v(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new r(this.headers),url:this.url})},v.error=function(){var t=new v(null,{status:0,statusText:""});return t.type="error",t};var w=[301,302,303,307,308];v.redirect=function(t,e){if(-1===w.indexOf(e))throw new RangeError("Invalid status code");return new v(null,{status:e,headers:{location:t}})},t.Headers=r,t.Request=p,t.Response=v,t.fetch=function(t,e){return new Promise(function(n,i){var r=new p(t,e),o=new XMLHttpRequest;o.onload=function(){var t={status:o.status,statusText:o.statusText,headers:m(o.getAllResponseHeaders()||"")};t.url="responseURL"in o?o.responseURL:t.headers.get("X-Request-URL");var e="response"in o?o.response:o.responseText;n(new v(e,t))},o.onerror=function(){i(new TypeError("Network request failed"))},o.ontimeout=function(){i(new TypeError("Network request failed"))},o.open(r.method,r.url,!0),"include"===r.credentials&&(o.withCredentials=!0),"responseType"in o&&g.blob&&(o.responseType="blob"),r.headers.forEach(function(t,e){o.setRequestHeader(e,t)}),o.send("undefined"===typeof r._bodyInit?null:r._bodyInit)})},t.fetch.polyfill=!0}}("undefined"!==typeof self?self:this)},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=n(11),r=n.n(i),o=n(14),a=(n.n(o),n(15).default),s=void 0,c=document.createElement("div");c.classList.add("demos"),Object.keys(a).forEach(function(t){var e=document.createElement("a");e.appendChild(document.createTextNode(t)),e.addEventListener("mousedown",function(t){s&&s.sandpit.stop(),s=new a[t.currentTarget.textContent]}),c.appendChild(e)});var l=r.a.parse(window.location.search);s=l.demo?new a[l.demo]:new(a[Object.keys(a)[0]]);var h=document.querySelector(".content");h.appendChild(c),window.innerHeight<h.offsetHeight&&(h.style.height=h.offsetHeight+"px")},function(t,e,n){"use strict";function i(t){switch(t.arrayFormat){case"index":return function(e,n,i){return null===n?[o(e,t),"[",i,"]"].join(""):[o(e,t),"[",o(i,t),"]=",o(n,t)].join("")};case"bracket":return function(e,n){return null===n?o(e,t):[o(e,t),"[]=",o(n,t)].join("")};default:return function(e,n){return null===n?o(e,t):[o(e,t),"=",o(n,t)].join("")}}}function r(t){var e;switch(t.arrayFormat){case"index":return function(t,n,i){if(e=/\[(\d*)\]$/.exec(t),t=t.replace(/\[\d*\]$/,""),!e)return void(i[t]=n);void 0===i[t]&&(i[t]={}),i[t][e[1]]=n};case"bracket":return function(t,n,i){return e=/(\[\])$/.exec(t),t=t.replace(/\[\]$/,""),e?void 0===i[t]?void(i[t]=[n]):void(i[t]=[].concat(i[t],n)):void(i[t]=n)};default:return function(t,e,n){if(void 0===n[t])return void(n[t]=e);n[t]=[].concat(n[t],e)}}}function o(t,e){return e.encode?e.strict?s(t):encodeURIComponent(t):t}function a(t){return Array.isArray(t)?t.sort():"object"===typeof t?a(Object.keys(t)).sort(function(t,e){return Number(t)-Number(e)}).map(function(e){return t[e]}):t}var s=n(12),c=n(3),l=n(13);e.extract=function(t){var e=t.indexOf("?");return-1===e?"":t.slice(e+1)},e.parse=function(t,e){e=c({arrayFormat:"none"},e);var n=r(e),i=Object.create(null);return"string"!==typeof t?i:(t=t.trim().replace(/^[?#&]/,""))?(t.split("&").forEach(function(t){var e=t.replace(/\+/g," ").split("="),r=e.shift(),o=e.length>0?e.join("="):void 0;o=void 0===o?null:l(o),n(l(r),o,i)}),Object.keys(i).sort().reduce(function(t,e){var n=i[e];return Boolean(n)&&"object"===typeof n&&!Array.isArray(n)?t[e]=a(n):t[e]=n,t},Object.create(null))):i},e.stringify=function(t,e){e=c({encode:!0,strict:!0,arrayFormat:"none"},e);var n=i(e);return t?Object.keys(t).sort().map(function(i){var r=t[i];if(void 0===r)return"";if(null===r)return o(i,e);if(Array.isArray(r)){var a=[];
1return r.slice().forEach(function(t){void 0!==t&&a.push(n(i,t,a.length))}),a.join("&")}return o(i,e)+"="+o(r,e)}).filter(function(t){return t.length>0}).join("&"):""}},function(t,e,n){"use strict";t.exports=function(t){return encodeURIComponent(t).replace(/[!'()*]/g,function(t){return"%"+t.charCodeAt(0).toString(16).toUpperCase()})}},function(t,e,n){"use strict";function i(t,e){try{return decodeURIComponent(t.join(""))}catch(t){}if(1===t.length)return t;e=e||1;var n=t.slice(0,e),r=t.slice(e);return Array.prototype.concat.call([],i(n),i(r))}function r(t){try{return decodeURIComponent(t)}catch(r){for(var e=t.match(a),n=1;n<e.length;n++)t=i(e,n).join(""),e=t.match(a);return t}}function o(t){for(var e={"%FE%FF":"\ufffd\ufffd","%FF%FE":"\ufffd\ufffd"},n=s.exec(t);n;){try{e[n[0]]=decodeURIComponent(n[0])}catch(t){var i=r(n[0]);i!==n[0]&&(e[n[0]]=i)}n=s.exec(t)}e["%C2"]="\ufffd";for(var o=Object.keys(e),a=0;a<o.length;a++){var c=o[a];t=t.replace(new RegExp(c,"g"),e[c])}return t}var a=new RegExp("%[a-f0-9]{2}","gi"),s=new RegExp("(%[a-f0-9]{2})+","gi");t.exports=function(t){if("string"!==typeof t)throw new TypeError("Expected `encodedURI` to be of type `string`, got `"+typeof t+"`");try{return t=t.replace(/\+/g," "),decodeURIComponent(t)}catch(e){return o(t)}}},function(t,e){},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=n(16),r=n(20),o=n(21),a=n(23),s=n(24),c=n(25),l=n(26),h=n(27);e.default={particles:i.a,multitouch:r.a,accelerometer:o.a,paint:a.a,webgl:s.a,data:c.a,generative:l.a,dots:h.a}},function(t,e,n){"use strict";var i=n(0),r=void 0,o=function t(){function e(){var t=Math.floor(a()*Object.keys(n).length),e=n[Object.keys(n)[t]],s=Object(i.a)(e).darken(.25).alpha(.5*a()+.5).toString(),l=a()*r.width,h=a()*r.height,u=new i.c(l,h),d=new i.c(0,0),p=new i.c(0,0),f=new i.c(0,0),m=[];this.change=function(t){switch(t){case"strokeWidth":o.lineWidth=t}},this.update=function(){var t=new i.c(Math.cos(a()*Math.PI*2),Math.sin(a()*Math.PI*2));p.add(new i.c(1+.9*a(),1+.9*a()).multiply(t));var e=u.x-r.width/2,n=u.y-r.height/2,l=r.defaults.gravity.max-r.settings.gravity+.1,h=new i.c(e,n).multiplyScalar(-1/(Math.min(r.width,r.height)*l));if(p.add(h),r.settings.follow&&r.input.x&&r.input.y){var v=r.input.x-u.x,g=r.input.y-u.y,y=Math.sqrt(v*v+g*g);f.add(new i.c(v/y,g/y).multiplyScalar(c*(r.settings.gravity/5)))}if(d.add(p),d.add(f),d.limit(10,.9),u.add(d),p.multiply(new i.c(0,0)),f.multiply(new i.c(0,0)),o.beginPath(),o.lineWidth=r.settings.strokeWidth,o.strokeStyle=s,m.length>1){var _=m[0],b=m.slice(1);o.moveTo(_.x,_.y),b.forEach(function(t){return o.lineTo(t.x,t.y)}),o.lineTo(u.x,u.y),m.length>=r.settings.size&&m.shift()}m.length<r.settings.size+1?m.push(u.clone()):m.splice(0,m.length-r.settings.size),o.stroke()}}r=new i.d(document.querySelector("#root"),i.d.CANVAS);var n={white:"hsl(0, 100%, 100%)",aqua:"hsl(175, 100%, 45%)",blue:"hsl(185, 69%, 63%)",orange:"hsl(39, 100%, 54%)",pink:"hsl(333, 100%, 68%)",green:"hsl(84, 100%, 68%)",violet:"hsl(270, 100%, 80%)"};r.settings={demo:{value:"particles",editable:!1,sticky:!0},follow:{value:!0}
1,gravity:{value:3,step:.1,min:.1,max:5},count:{value:50,step:1,min:1,max:500},size:{value:10,step:1,min:1,max:50},strokeWidth:{value:1,min:1,max:10,step:1},background:{value:n},keepDrawing:{value:!1}};var o=r.context,a=r.random("Hello!"),s=[],c=1;r.setup=function(){s=Array(Math.round(r.settings.count)).fill().map(function(t){return new e})},r.change=function(t){r.fill(Object(i.a)(r.settings.background).toString()),s.forEach(function(e){return e.change(t)})},r.loop=function(){r.settings.keepDrawing||r.fill(Object(i.a)(r.settings.background).alpha(.25).toString()),s.length>r.settings.count?s=s.slice(s.length-r.settings.count,r.settings.count):s.length<r.settings.count&&s.push(new e),s.forEach(function(t){return t.update()})},r.touch=function(){c=3},r.release=function(){c=1},r.start(),r.reset=function(){window.history.replaceState({},null,r._getPathFromUrl()+"?demo="+r.settings.demo),window.location.reload()},t.prototype.sandpit=r,document.querySelector(".overlay").style.color="#000",document.querySelector("body").style.background="#fff"};e.a=o},function(t,e,n){function i(t,e){this._id=t,this._clearFn=e}var r=Function.prototype.apply;e.setTimeout=function(){return new i(r.call(setTimeout,window,arguments),clearTimeout)},e.setInterval=function(){return new i(r.call(setInterval,window,arguments),clearInterval)},e.clearTimeout=e.clearInterval=function(t){t&&t.close()},i.prototype.unref=i.prototype.ref=function(){},i.prototype.close=function(){this._clearFn.call(window,this._id)},e.enroll=function(t,e){clearTimeout(t._idleTimeoutId),t._idleTimeout=e},e.unenroll=function(t){clearTimeout(t._idleTimeoutId),t._idleTimeout=-1},e._unrefActive=e.active=function(t){clearTimeout(t._idleTimeoutId);var e=t._idleTimeout;e>=0&&(t._idleTimeoutId=setTimeout(function(){t._onTimeout&&t._onTimeout()},e))},n(18),e.setImmediate=setImmediate,e.clearImmediate=clearImmediate},function(t,e,n){(function(t,e){!function(t,n){"use strict";function i(t){"function"!==typeof t&&(t=new Function(""+t));for(var e=new Array(arguments.length-1),n=0;n<e.length;n++)e[n]=arguments[n+1];var i={callback:t,args:e};return l[c]=i,s(c),c++}function r(t){delete l[t]}function o(t){var e=t.callback,i=t.args;switch(i.length){case 0:e();break;case 1:e(i[0]);break;case 2:e(i[0],i[1]);break;case 3:e(i[0],i[1],i[2]);break;default:e.apply(n,i)}}function a(t){if(h)setTimeout(a,0,t);else{var e=l[t];if(e){h=!0;try{o(e)}finally{r(t),h=!1}}}}if(!t.setImmediate){var s,c=1,l={},h=!1,u=t.document,d=Object.getPrototypeOf&&Object.getPrototypeOf(t);d=d&&d.setTimeout?d:t,"[object process]"==={}.toString.call(t.process)?function(){s=function(t){e.nextTick(function(){a(t)})}}():function(){if(t.postMessage&&!t.importScripts){var e=!0,n=t.onmessage;return t.onmessage=function(){e=!1},t.postMessage("","*"),t.onmessage=n,e}}()?function(){var e="setImmediate$"+Math.random()+"$",n=function(n){n.source===t&&"string"===typeof n.data&&0===n.data.indexOf(e)&&a(+n.data.slice(e.length))};t.addEventListener?t.addEventListener("message",n,!1):t.attachEvent("onmessage",n),s=function(n){t.postMessage(e+n,"*")}}():t.MessageChannel?function(){var t=new MessageChannel;t.port1.onmessage=function(t){a(t.data)},s=function(e){t.port2.postMessage(e)}}():u&&"onreadystatechange"in u.createElement("script")?function(){var t=u.documentElement;s=function(e){var n=u.createElement("script");n.onreadystatechange=function(){a(e),n.onreadystatechange=null,t.removeChild(n),n=null},t.appendChild(n)}}():function(){s=function(t){setTimeout(a,0,t)}}(),d.setImmediate=i,d.clearImmediate=r}}("undefined"===typeof self?"undefined"===typeof t?this:t:self)}).call(e,n(1),n(19))},function(t,e){function n(){throw new Error("setTimeout has not been defined")}function i(){throw new Error("clearTimeout has not been defined")}function r(t){if(h===setTimeout)return setTimeout(t,0);if((h===n||!h)&&setTimeout)return h=setTimeout,setTimeout(t,0);try{return h(t,0)}catch(e){try{return h.call(null,t,0)}catch(e){return h.call(this,t,0)}}}function o(t){if(u===clearTimeout)return clearTimeout(t);if((u===i||!u)&&clearTimeout)return u=clearTimeout,clearTimeout(t);try{return u(t)}catch(e){try{return u.call(null,t)}catch(e){return u.call(this,t)}}}function a(){m&&p&&(m=!1,p.length?f=p.concat(f):v=-1,f.length&&s())}function s(){if(!m){var t=r(a);m=!0;for(var e=f.length;e;){for(p=f,f=[];++v<e;)p&&p[v].run();v=-1,e=f.length}p=null,m=!1,o(t)}}function c(t,e){this.fun=t,this.array=e}function l(){}var h,u,d=t.exports={};!function(){try{h="function"===typeof setTimeout?setTimeout:n}catch(t){h=n}try{u="function"===typeof clearTimeout?clearTimeout:i}catch(t){u=i}}();var p,f=[],m=!1,v=-1;d.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)e[n-1]=arguments[n];f.push(new c(t,e)),1!==f.length||m||r(s)},c.prototype.run=function(){this.fun.apply(null,this.array)},d.title="browser",d.browser=!0,d.env={},d.argv=[],d.version="",d.versions={},d.on=l,d.addListener=l,d.once=l,d.off=l,d.removeListener=l,d.removeAllListeners=l,d.emit=l,d.prependListener=l,d.prependOnceListener=l,d.listeners=function(t){return[]},d.binding=function(t){throw new Error("process.binding is not supported")},d.cwd=function(){return"/"},d.chdir=function(t){throw new Error("process.chdir is not supported")},d.umask=function(){return 0}},function(t,e,n){"use strict";var i=n(0),r=function t(){function e(){var t=this;
1this.init=function(e,n,r){t.alive=!0,t.radius=r||10,t.wander=.15,t.theta=o()*i.b.TWO_PI,t.drag=.92,t.color="#fff",t.x=e||0,t.y=n||0,t.vx=0,t.vy=0},this.move=function(){t.x+=t.vx,t.y+=t.vy,t.vx*=t.drag,t.vy*=t.drag,t.theta+=i.b.randomBetween(-.5,.5)*t.wander,t.vx+=.1*Math.sin(t.theta),t.vy+=.1*Math.cos(t.theta),t.radius*=r.settings.decay,t.alive=t.radius>.5},this.draw=function(){a.beginPath(),a.arc(t.x,t.y,t.radius,0,i.b.TWO_PI),a.fillStyle=t.color,a.fill()}}var n=document.createElement("canvas");document.querySelector("#root").appendChild(n);var r=new i.d(n,i.d.CANVAS,{stats:!0});console.log(r.stats),r.settings={demo:{value:"multitouch",editable:!1,sticky:!0},autoClear:{value:!0},maxSize:{value:50,min:5,max:50,step:1},energy:{value:.9,min:0,max:.9,step:.1},force:{value:2,min:2,max:30,step:1},decay:{value:.92,min:.85,max:.99,step:.01},blend:{value:["darken","multiply","overlay"]}},r.autoClear=r.settings.autoClear;var o=r.random(),a=r.context,s=["hsl(0, 100%, 100%)","hsl(175, 100%, 45%)","hsl(185, 69%, 63%)","hsl(39, 100%, 54%)","hsl(333, 100%, 68%)","hsl(84, 100%, 68%)","hsl(270, 100%, 80%)"],c=[],l=[],h=function(t,n){var a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;c.length>=280&&l.push(c.shift());var h=l.length?l.pop():new e,u=i.b.randomBetween(2,r.settings.maxSize);u*=2*a+1,h.init(t,n,u),h.wander=i.b.randomBetween(.5,2),h.color=i.b.randomFrom(s),h.drag=i.b.randomBetween(r.settings.energy,.99);var d=o()*i.b.TWO_PI,p=i.b.randomBetween(2,r.settings.force);h.vx=Math.sin(d)*p,h.vy=Math.cos(d)*p,c.push(h)};r.setup=function(){for(var t=0;t<100;t++)!function(t){var e=r.width/2+100*Math.sin(t/Math.PI/5),n=r.height/2+100*Math.cos(t/Math.PI/5);window.setTimeout(function(){h(e,n)},10*t)}(t)},r.loop=function(){a.globalCompositeOperation=r.settings.blend,r.autoClear=r.settings.autoClear;for(var t=c.length-1;t>=0;t--){var e=c[t];e.alive?(e.move(),e.draw()):l.push(c.splice(t,1)[0])}},r.change=function(t){"blend"===t&&r.clear()},r.move=function(){for(var t=0;t<r.input.touches.length;t++)for(var e=r.input.touches[t],n=i.b.randomBetween(1,4),o=0;o<n;o++)h(e.x,e.y,e.force)},r.start(),r.reset=function(){window.history.replaceState({},null,r._getPathFromUrl()+"?demo="+r.settings.demo),window.location.reload()},t.prototype.sandpit=r,document.querySelector(".overlay").style.color="#000",document.querySelector("body").style.background="#fff"};e.a=r},function(t,e,n){"use strict";var i=n(0),r=n(22),o=function t(){var e=new i.d(document.querySelector("#root"),i.d.WEBGL);e.settings={demo:{value:"accelerometer",editable:!1,sticky:!0},scale:{value:1,step:.25,min:.25,max:1.5},cube:{value:{white:"hsl(0, 100%, 100%)",aqua:"hsl(175, 100%, 45%)",blue:"hsl(185, 69%, 63%)",orange:"hsl(39, 100%, 54%)",pink:"hsl(333, 100%, 68%)",green:"hsl(84, 100%, 68%)",violet:"hsl(270, 100%, 80%)"}},surface:{value:"#333",color:!0}};var n=new r.h({canvas:e.canvas,antialias:!0});n.setClearColor(0,1),n.shadowMap.type=r.d,n.shadowMap.enabled=!0;var o=new r.e(35,e.width/e.height,1,1e4);o.position.set(0,0,500);var a=new r.f;a.add(o);var s=new r.b(new r.a(100,100,100),new r.c({color:Object(i.a)(e.settings.cube).toString()}));s.castShadow=!0,s.rotation.set(45,45,45),o.lookAt(s),a.add(s);var c=new r.b(new r.a(5e3,5e3,5),new r.c({color:Object(i.a)(e.settings.surface).toString()}));c.position.z=-150,c.receiveShadow=!0,a.add(c);var l=new r.g(16777215);l.position.set(-50,0,250),l.angle=.4,l.penumbra=1,l.intensity=.75,l.shadow.mapSize.width=2048,l.shadow.mapSize.height=2048,l.castShadow=!0,a.add(l),e.change=function(){s.scale.set(e.settings.scale,e.settings.scale,e.settings.scale),s.material.color.set(Object(i.a)(e.settings.cube).toString()),c.material.color.set(Object(i.a)(e.settings.surface).toString())},e.loop=function(){s&&(e.input.accelerometer?(s.rotation.x+=e.input.accelerometer.xAxis/5e3,s.rotation.y+=e.input.accelerometer.yAxis/5e3):(s.rotation.x+=.001,s.rotation.y+=.001,s.rotation.z+=.001)),n.render(a,o)},e.resize=function(){o.aspect=e.width/e.height,o.updateProjectionMatrix()},e.start(),e.change(),e.reset=function(){var t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];window.history.replaceState({},null,e._getPathFromUrl()+"?demo="+e.settings.demo),t&&window.location.reload()},t.prototype.sandpit=e,document.querySelector(".overlay").style.color="#fff",document.querySelector("body").style.background="#000"};e.a=o},function(t,e,n){"use strict";function i(){}function r(t,e){this.x=t||0,this.y=e||0}function o(t,e,n,i,a,s,c,l,h,u){Object.defineProperty(this,"id",{value:fa++}),this.uuid=pa.generateUUID(),this.name="",this.image=void 0!==t?t:o.DEFAULT_IMAGE,this.mipmaps=[],this.mapping=void 0!==e?e:o.DEFAULT_MAPPING,this.wrapS=void 0!==n?n:mo,this.wrapT=void 0!==i?i:mo,this.magFilter=void 0!==a?a:xo,this.minFilter=void 0!==s?s:Mo,this.anisotropy=void 0!==h?h:1,this.format=void 0!==c?c:Bo,this.type=void 0!==l?l:To,this.offset=new r(0,0),this.repeat=new r(1,1),this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.encoding=void 0!==u?u:ra,this.version=0,this.onUpdate=null}function a(t,e,n,i){this.x=t||0,this.y=e||0,this.z=n||0,this.w=void 0!==i?i:1}function s(t,e,n){this.uuid=pa.generateUUID(),this.width=t,this.height=e,this.scissor=new a(0,0,t,e),this.scissorTest=!1,this.viewport=new a(0,0,t,e),n=n||{},void 0===n.minFilter&&(n.minFilter=xo),this.texture=new o(void 0,void 0,n.wrapS,n.wrapT,n.magFilter,n.minFilter,n.format,n.type,n.anisotropy,n.encoding),this.depthBuffer=void 0===n.depthBuffer||n.depthBuffer,this.stencilBuffer=void 0===n.stencilBuffer||n.stencilBuffer,this.depthTexture=void 0!==n.depthTexture?n.depthTexture:null}function c(t,e,n){s.call(this,t,e,n),this.activeCubeFace=0,this.activeMipMapLevel=0}function l(t,e,n,i){this._x=t||0,this._y=e||0,this._z=n||0,this._w=void 0!==i?i:1}function h(t,e,n){this.x=t||0,this.y=e||0,this.z=n||0}function u(){this.elements=new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]),arguments.length>0&&console.error("THREE.Matrix4: the constructor no longer reads arguments. use .set() instead.")}function d(t,e,n,i,r,a,s,c,l,h){t=void 0!==t?t:[],e=void 0!==e?e:oo,o.call(this,t,e,n,i,r,a,s,c,l,h),this.flipY=!1}function p(){this.seq=[],this.map={}}function f(t,e,n){var i=t[0];if(i<=0||i>0)return t;var r=e*n,o=ga[r];if(void 0===o&&(o=new Float32Array(r),ga[r]=o),0!==e){i.toArray(o,0);for(var a=1,s=0;a!==e;++a)s+=n,t[a].toArray(o,s)}return o}function m(t,e){var n=ya[e];void 0===n&&(n=new Int32Array(e),ya[e]=n);for(var i=0;i!==e;++i)n[i]=t.allocTextureUnit();return n}function v(t,e){t.uniform1f(this.addr,e)}function g(t,e){t.uniform1i(this.addr,e)}function y(t,e){void 0===e.x?t.uniform2fv(this.addr,e):t.uniform2f(this.addr,e.x,e.y)}function _(t,e){void 0!==e.x?t.uniform3f(this.addr,e.x,e.y,e.z):void 0!==e.r?t.uniform3f(this.addr,e.r,e.g,e.b):t.uniform3fv(this.addr,e)}function b(t,e){void 0===e.x?t.uniform4fv(this.addr,e):t.uniform4f(this.addr,e.x,e.y,e.z,e.w)}function x(t,e){t.uniformMatrix2fv(this.addr,!1,e.elements||e)}function w(t,e){t.uniformMatrix3fv(this.addr,!1,e.elements||e)}function M(t,e){t.uniformMatrix4fv(this.addr,!1,e.elements||e)}function E(t,e,n){var i=n.allocTextureUnit();t.uniform1i(this.addr,i),n.setTexture2D(e||ma,i)}function T(t,e,n){var i=n.allocTextureUnit();t.uniform1i(this.addr,i),n.setTextureCube(e||va,i)}function S(t,e){t.uniform2iv(this.addr,e)}function A(t,e){t.uniform3iv(this.addr,e)}function L(t,e){t.uniform4iv(this.addr,e)}function R(t){switch(t){case 5126:return v;case 35664:return y;case 35665:return _;case 35666:return b;case 35674:return x;case 35675:return w;case 35676:return M;case 35678:return E;case 35680:return T;case 5124:case 35670:return g;case 35667:case 35671:return S;case 35668:case 35672:return A;case 35669:case 35673:return L}}function C(t,e){t.uniform1fv(this.addr,e)}function P(t,e){t.uniform1iv(this.addr,e)}function O(t,e){t.uniform2fv(this.addr,f(e,this.size,2))}function I(t,e){t.uniform3fv(this.addr,f(e,this.size,3))}function U(t,e){t.uniform4fv(this.addr,f(e,this.size,4))}function N(t,e){t.uniformMatrix2fv(this.addr,!1,f(e,this.size,4))}function D(t,e){t.uniformMatrix3fv(this.addr,!1,f(e,this.size,9))}function F(t,e){t.uniformMatrix4fv(this.addr,!1,f(e,this.size,16))}function z(t,e,n){var i=e.length,r=m(n,i);t.uniform1iv(this.addr,r);for(var o=0;o!==i;++o)n.setTexture2D(e[o]||ma,r[o])}function B(t,e,n){var i=e.length,r=m(n,i);t.uniform1iv(this.addr,r);for(var o=0;o!==i;++o)n.setTextureCube(e[o]||va,r[o])}function k(t){switch(t){case 5126:return C;case 35664:return O;case 35665:return I;case 35666:return U;case 35674:return N;case 35675:return D;case 35676:return F;case 35678:return z;case 35680:return B;case 5124:case 35670:return P;case 35667:case 35671:return S;case 35668:case 35672:return A;case 35669:case 35673:return L}}function j(t,e,n){this.id=t,this.addr=n,this.setValue=R(e.type)}function G(t,e,n){this.id=t,this.addr=n,this.size=e.size,this.setValue=k(e.type)}function H(t){this.id=t,p.call(this)}function V(t,e){t.seq.push(e),t.map[e.id]=e}function W(t,e,n){var i=t.name,r=i.length;for(_a.lastIndex=0;;){var o=_a.exec(i),a=_a.lastIndex,s=o[1],c="]"===o[2],l=o[3];if(c&&(s|=0),void 0===l||"["===l&&a+2===r){V(n,void 0===l?new j(s,t,e):new G(s,t,e));break}var h=n.map,u=h[s];void 0===u&&(u=new H(s),V(n,u)),n=u}}function X(t,e,n){p.call(this),this.renderer=n;for(var i=t.getProgramParameter(e,t.ACTIVE_UNIFORMS),r=0;r!==i;++r){var o=t.getActiveUniform(e,r),a=o.name;W(o,t.getUniformLocation(e,a),this)}}function q(t,e,n){return void 0===e&&void 0===n?this.set(t):this.setRGB(t,e,n)}function Y(t,e,n,i,r,a,s,c,l,h,u,d){o.call(this,null,a,s,c,l,h,i,r,u,d),this.image={data:t,width:e,height:n},this.magFilter=void 0!==l?l:yo,this.minFilter=void 0!==h?h:yo,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}function Z(t,e){this.min=void 0!==t?t:new r(1/0,1/0),this.max=void 0!==e?e:new r(-1/0,-1/0)}function J(t,e){function n(){var t=new Float32Array([-1,-1,0,0,1,-1,1,0,1,1,1,1,-1,1,0,1]),e=new Uint16Array([0,1,2,0,2,3]);o=f.createBuffer(),a=f.createBuffer(),f.bindBuffer(f.ARRAY_BUFFER,o),f.bufferData(f.ARRAY_BUFFER,t,f.STATIC_DRAW),f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,a),f.bufferData(f.ELEMENT_ARRAY_BUFFER,e,f.STATIC_DRAW),d=f.createTexture(),p=f.createTexture(),m.bindTexture(f.TEXTURE_2D,d),f.texImage2D(f.TEXTURE_2D,0,f.RGB,16,16,0,f.RGB,f.UNSIGNED_BYTE,null),f.texParameteri(f.TEXTURE_2D,f.TEXTURE_WRAP_S,f.CLAMP_TO_EDGE),f.texParameteri(f.TEXTURE_2D,f.TEXTURE_WRAP_T,f.CLAMP_TO_EDGE),f.texParameteri(f.TEXTURE_2D,f.TEXTURE_MAG_FILTER,f.NEAREST),f.texParameteri(f.TEXTURE_2D,f.TEXTURE_MIN_FILTER,f.NEAREST),m.bindTexture(f.TEXTURE_2D,p),f.texImage2D(f.TEXTURE_2D,0,f.RGBA,16,16,0,f.RGBA,f.UNSIGNED_BYTE,null),f.texParameteri(f.TEXTURE_2D,f.TEXTURE_WRAP_S,f.CLAMP_TO_EDGE),f.texParameteri(f.TEXTURE_2D,f.TEXTURE_WRAP_T,f.CLAMP_TO_EDGE),f.texParameteri(f.TEXTURE_2D,f.TEXTURE_MAG_FILTER,f.NEAREST),f.texParameteri(f.TEXTURE_2D,f.TEXTURE_MIN_FILTER,f.NEAREST),s={vertexShader:["uniform lowp int renderType;","uniform vec3 screenPosition;","uniform vec2 scale;","uniform float rotation;","uniform sampler2D occlusionMap;","attribute vec2 position;","attribute vec2 uv;","varying vec2 vUV;","varying float vVisibility;","void main() {","vUV = uv;","vec2 pos = position;","if ( renderType == 2 ) {","vec4 visibility = texture2D( occlusionMap, vec2( 0.1, 0.1 ) );","visibility += texture2D( occlusionMap, vec2( 0.5, 0.1 ) );","visibility += texture2D( occlusionMap, vec2( 0.9, 0.1 ) );","visibility += texture2D( occlusionMap, vec2( 0.9, 0.5 ) );","visibility += texture2D( occlusionMap, vec2( 0.9, 0.9 ) );","visibility += texture2D( occlusionMap, vec2( 0.5, 0.9 ) );","visibility += texture2D( occlusionMap, vec2( 0.1, 0.9 ) );","visibility += texture2D( occlusionMap, vec2( 0.1, 0.5 ) );","visibility += texture2D( occlusionMap, vec2( 0.5, 0.5 ) );","vVisibility =        visibility.r / 9.0;","vVisibility *= 1.0 - visibility.g / 9.0;","vVisibility *=       visibility.b / 9.0;","vVisibility *= 1.0 - visibility.a / 9.0;","pos.x = cos( rotation ) * position.x - sin( rotation ) * position.y;","pos.y = sin( rotation ) * position.x + cos( rotation ) * position.y;","}","gl_Position = vec4( ( pos * scale + screenPosition.xy ).xy, screenPosition.z, 1.0 );","}"].join("\n"),fragmentShader:["uniform lowp int renderType;","uniform sampler2D map;","uniform float opacity;","uniform vec3 color;","varying vec2 vUV;","varying float vVisibility;","void main() {","if ( renderType == 0 ) {","gl_FragColor = vec4( 1.0, 0.0, 1.0, 0.0 );","} else if ( renderType == 1 ) {","gl_FragColor = texture2D( map, vUV );","} else {","vec4 texture = texture2D( map, vUV );
1","texture.a *= opacity * vVisibility;","gl_FragColor = texture;","gl_FragColor.rgb *= color;","}","}"].join("\n")},c=i(s),l={vertex:f.getAttribLocation(c,"position"),uv:f.getAttribLocation(c,"uv")},u={renderType:f.getUniformLocation(c,"renderType"),map:f.getUniformLocation(c,"map"),occlusionMap:f.getUniformLocation(c,"occlusionMap"),opacity:f.getUniformLocation(c,"opacity"),color:f.getUniformLocation(c,"color"),scale:f.getUniformLocation(c,"scale"),rotation:f.getUniformLocation(c,"rotation"),screenPosition:f.getUniformLocation(c,"screenPosition")}}function i(e){var n=f.createProgram(),i=f.createShader(f.FRAGMENT_SHADER),r=f.createShader(f.VERTEX_SHADER),o="precision "+t.getPrecision()+" float;\n";return f.shaderSource(i,o+e.fragmentShader),f.shaderSource(r,o+e.vertexShader),f.compileShader(i),f.compileShader(r),f.attachShader(n,i),f.attachShader(n,r),f.linkProgram(n),n}var o,a,s,c,l,u,d,p,f=t.context,m=t.state;this.render=function(i,s,v){if(0!==e.length){var g=new h,y=v.w/v.z,_=.5*v.z,b=.5*v.w,x=16/v.w,w=new r(x*y,x),M=new h(1,1,0),E=new r(1,1),T=new Z;T.min.set(v.x,v.y),T.max.set(v.x+(v.z-16),v.y+(v.w-16)),void 0===c&&n(),f.useProgram(c),m.initAttributes(),m.enableAttribute(l.vertex),m.enableAttribute(l.uv),m.disableUnusedAttributes(),f.uniform1i(u.occlusionMap,0),f.uniform1i(u.map,1),f.bindBuffer(f.ARRAY_BUFFER,o),f.vertexAttribPointer(l.vertex,2,f.FLOAT,!1,16,0),f.vertexAttribPointer(l.uv,2,f.FLOAT,!1,16,8),f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,a),m.disable(f.CULL_FACE),m.setDepthWrite(!1);for(var S=0,A=e.length;S<A;S++){x=16/v.w,w.set(x*y,x);var L=e[S];if(g.set(L.matrixWorld.elements[12],L.matrixWorld.elements[13],L.matrixWorld.elements[14]),g.applyMatrix4(s.matrixWorldInverse),g.applyProjection(s.projectionMatrix),M.copy(g),E.x=v.x+M.x*_+_-8,E.y=v.y+M.y*b+b-8,!0===T.containsPoint(E)){m.activeTexture(f.TEXTURE0),m.bindTexture(f.TEXTURE_2D,null),m.activeTexture(f.TEXTURE1),m.bindTexture(f.TEXTURE_2D,d),f.copyTexImage2D(f.TEXTURE_2D,0,f.RGB,E.x,E.y,16,16,0),f.uniform1i(u.renderType,0),f.uniform2f(u.scale,w.x,w.y),f.uniform3f(u.screenPosition,M.x,M.y,M.z),m.disable(f.BLEND),m.enable(f.DEPTH_TEST),f.drawElements(f.TRIANGLES,6,f.UNSIGNED_SHORT,0),m.activeTexture(f.TEXTURE0),m.bindTexture(f.TEXTURE_2D,p),f.copyTexImage2D(f.TEXTURE_2D,0,f.RGBA,E.x,E.y,16,16,0),f.uniform1i(u.renderType,1),m.disable(f.DEPTH_TEST),m.activeTexture(f.TEXTURE1),m.bindTexture(f.TEXTURE_2D,d),f.drawElements(f.TRIANGLES,6,f.UNSIGNED_SHORT,0),L.positionScreen.copy(M),L.customUpdateCallback?L.customUpdateCallback(L):L.updateLensFlares(),f.uniform1i(u.renderType,2),m.enable(f.BLEND);for(var R=0,C=L.lensFlares.length;R<C;R++){var P=L.lensFlares[R];P.opacity>.001&&P.scale>.001&&(M.x=P.x,M.y=P.y,M.z=P.z,x=P.size*P.scale/v.w,w.x=x*y,w.y=x,f.uniform3f(u.screenPosition,M.x,M.y,M.z),f.uniform2f(u.scale,w.x,w.y),f.uniform1f(u.rotation,P.rotation),f.uniform1f(u.opacity,P.opacity),f.uniform3f(u.color,P.color.r,P.color.g,P.color.b),m.setBlending(P.blending,P.blendEquation,P.blendSrc,P.blendDst),t.setTexture2D(P.texture,1),f.drawElements(f.TRIANGLES,6,f.UNSIGNED_SHORT,0))}}}m.enable(f.CULL_FACE),m.enable(f.DEPTH_TEST),m.setDepthWrite(!0),t.resetGLState()}}}function Q(t,e){function n(){var t=new Float32Array([-.5,-.5,0,0,.5,-.5,1,0,.5,.5,1,1,-.5,.5,0,1]),e=new Uint16Array([0,1,2,0,2,3]);a=f.createBuffer(),s=f.createBuffer(),f.bindBuffer(f.ARRAY_BUFFER,a),f.bufferData(f.ARRAY_BUFFER,t,f.STATIC_DRAW),f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,s),f.bufferData(f.ELEMENT_ARRAY_BUFFER,e,f.STATIC_DRAW),c=i(),u={position:f.getAttribLocation(c,"position"),uv:f.getAttribLocation(c,"uv")},d={uvOffset:f.getUniformLocation(c,"uvOffset"),uvScale:f.getUniformLocation(c,"uvScale"),rotation:f.getUniformLocation(c,"rotation"),scale:f.getUniformLocation(c,"scale"),color:f.getUniformLocation(c,"color"),map:f.getUniformLocation(c,"map"),opacity:f.getUniformLocation(c,"opacity"),modelViewMatrix:f.getUniformLocation(c,"modelViewMatrix"),projectionMatrix:f.getUniformLocation(c,"projectionMatrix"),fogType:f.getUniformLocation(c,"fogType"),fogDensity:f.getUniformLocation(c,"fogDensity"),fogNear:f.getUniformLocation(c,"fogNear"),fogFar:f.getUniformLocation(c,"fogFar"),fogColor:f.getUniformLocation(c,"fogColor"),alphaTest:f.getUniformLocation(c,"alphaTest")};var n=document.createElementNS("http://www.w3.org/1999/xhtml","canvas");n.width=8,n.height=8;var r=n.getContext("2d");r.fillStyle="white",r.fillRect(0,0,8,8),p=new o(n),p.needsUpdate=!0}function i(){var e=f.createProgram(),n=f.createShader(f.VERTEX_SHADER),i=f.createShader(f.FRAGMENT_SHADER);return f.shaderSource(n,["precision "+t.getPrecision()+" float;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform float rotation;","uniform vec2 scale;","uniform vec2 uvOffset;","uniform vec2 uvScale;","attribute vec2 position;","attribute vec2 uv;","varying vec2 vUV;","void main() {","vUV = uvOffset + uv * uvScale;","vec2 alignedPosition = position * scale;","vec2 rotatedPosition;","rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;","rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;","vec4 finalPosition;","finalPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );","finalPosition.xy += rotatedPosition;","finalPosition = projectionMatrix * finalPosition;","gl_Position = finalPosition;","}"].join("\n")),f.shaderSource(i,["precision "+t.getPrecision()+" float;","uniform vec3 color;","uniform sampler2D map;","uniform float opacity;","uniform int fogType;","uniform vec3 fogColor;","uniform float fogDensity;","uniform float fogNear;","uniform float fogFar;","uniform float alphaTest;","varying vec2 vUV;","void main() {","vec4 texture = texture2D( map, vUV );","if ( texture.a < alphaTest ) discard;","gl_FragColor = vec4( color * texture.xyz, texture.a * opacity );","if ( fogType > 0 ) {","float depth = gl_FragCoord.z / gl_FragCoord.w;","float fogFactor = 0.0;","if ( fogType == 1 ) {","fogFactor = smoothstep( fogNear, fogFar, depth );","} else {","const float LOG2 = 1.442695;","fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );","fogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );","}","gl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );","}","}"].join("\n")),f.compileShader(n),f.compileShader(i),f.attachShader(e,n),f.attachShader(e,i),f.linkProgram(e),e}function r(t,e){return t.renderOrder!==e.renderOrder?t.renderOrder-e.renderOrder:t.z!==e.z?e.z-t.z:e.id-t.id}var a,s,c,u,d,p,f=t.context,m=t.state,v=new h,g=new l,y=new h;this.render=function(i,o){if(0!==e.length){void 0===c&&n(),f.useProgram(c),m.initAttributes(),m.enableAttribute(u.position),m.enableAttribute(u.uv),m.disableUnusedAttributes(),m.disable(f.CULL_FACE),m.enable(f.BLEND),f.bindBuffer(f.ARRAY_BUFFER,a),f.vertexAttribPointer(u.position,2,f.FLOAT,!1,16,0),f.vertexAttribPointer(u.uv,2,f.FLOAT,!1,16,8),f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,s),f.uniformMatrix4fv(d.projectionMatrix,!1,o.projectionMatrix.elements),m.activeTexture(f.TEXTURE0),f.uniform1i(d.map,0);var l=0,h=0,_=i.fog;_?(f.uniform3f(d.fogColor,_.color.r,_.color.g,_.color.b),_.isFog?(f.uniform1f(d.fogNear,_.near),f.uniform1f(d.fogFar,_.far),f.uniform1i(d.fogType,1),l=1,h=1):_.isFogExp2&&(f.uniform1f(d.fogDensity,_.density),f.uniform1i(d.fogType,2),l=2,h=2)):(f.uniform1i(d.fogType,0),l=0,h=0);for(var b=0,x=e.length;b<x;b++){var w=e[b];w.modelViewMatrix.multiplyMatrices(o.matrixWorldInverse,w.matrixWorld),w.z=-w.modelViewMatrix.elements[14]}e.sort(r);for(var M=[],b=0,x=e.length;b<x;b++){var w=e[b],E=w.material;if(!1!==E.visible){f.uniform1f(d.alphaTest,E.alphaTest),f.uniformMatrix4fv(d.modelViewMatrix,!1,w.modelViewMatrix.elements),w.matrixWorld.decompose(v,g,y),M[0]=y.x,M[1]=y.y;var T=0;i.fog&&E.fog&&(T=h),l!==T&&(f.uniform1i(d.fogType,T),l=T),null!==E.map?(f.uniform2f(d.uvOffset,E.map.offset.x,E.map.offset.y),f.uniform2f(d.uvScale,E.map.repeat.x,E.map.repeat.y)):(f.uniform2f(d.uvOffset,0,0),f.uniform2f(d.uvScale,1,1)),f.uniform1f(d.opacity,E.opacity),f.uniform3f(d.color,E.color.r,E.color.g,E.color.b),f.uniform1f(d.rotation,E.rotation),f.uniform2fv(d.scale,M),m.setBlending(E.blending,E.blendEquation,E.blendSrc,E.blendDst),m.setDepthTest(E.depthTest),m.setDepthWrite(E.depthWrite),E.map?t.setTexture2D(E.map,0):t.setTexture2D(p,0),f.drawElements(f.TRIANGLES,6,f.UNSIGNED_SHORT,0)}}m.enable(f.CULL_FACE),t.resetGLState()}}}function K(){Object.defineProperty(this,"id",{value:Ta++}),this.uuid=pa.generateUUID(),this.name="",this.type="Material",this.fog=!0,this.lights=!0,this.blending=xr,this.side=dr,this.shading=vr,this.vertexColors=gr,this.opacity=1,this.transparent=!1,this.blendSrc=Dr,this.blendDst=Fr,this.blendEquation=Ar,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.depthFunc=Xr,this.depthTest=!0,this.depthWrite=!0,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.alphaTest=0,this.premultipliedAlpha=!1,this.overdraw=0,this.visible=!0,this._needsUpdate=!0}function $(t){K.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.fog=!1,this.lights=!1,this.clipping=!1,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!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!==t&&(void 0!==t.attributes&&console.error("THREE.ShaderMaterial: attributes should now be defined in THREE.BufferGeometry instead."),this.setValues(t))}function tt(t){K.call(this),this.type="MeshDepthMaterial",this.depthPacking=ua,this.skinning=!1,this.morphTargets=!1,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.setValues(t)}function et(t,e){this.min=void 0!==t?t:new h(1/0,1/0,1/0),this.max=void 0!==e?e:new h(-1/0,-1/0,-1/0)}function nt(t,e){this.center=void 0!==t?t:new h,this.radius=void 0!==e?e:0}function it(){this.elements=new Float32Array([1,0,0,0,1,0,0,0,1]),arguments.length>0&&console.error("THREE.Matrix3: the constructor no longer reads arguments. use .set() instead.")}function rt(t,e){this.normal=void 0!==t?t:new h(1,0,0),this.constant=void 0!==e?e:0}function ot(t,e,n,i,r,o){this.planes=[void 0!==t?t:new rt,void 0!==e?e:new rt,void 0!==n?n:new rt,void 0!==i?i:new rt,void 0!==r?r:new rt,void 0!==o?o:new rt]}function at(t,e,n,i){function o(e,n,i,r){var o=e.geometry,a=null,s=E,c=e.customDepthMaterial;if(i&&(s=T,c=e.customDistanceMaterial),c)a=c;else{var l=!1;n.morphTargets&&(o&&o.isBufferGeometry?l=o.morphAttributes&&o.morphAttributes.position&&o.morphAttributes.position.length>0:o&&o.isGeometry&&(l=o.morphTargets&&o.morphTargets.length>0));var h=e.isSkinnedMesh&&n.skinning,u=0;l&&(u|=x),h&&(u|=w),a=s[u]}if(t.localClippingEnabled&&!0===n.clipShadows&&0!==n.clippingPlanes.length){var d=a.uuid,p=n.uuid,f=S[d];void 0===f&&(f={},S[d]=f);var m=f[p];void 0===m&&(m=a.clone(),f[p]=m),a=m}a.visible=n.visible,a.wireframe=n.wireframe;var v=n.side;return z.renderSingleSided&&v==fr&&(v=dr),z.renderReverseSided&&(v===dr?v=pr:v===pr&&(v=dr)),a.side=v,a.clipShadows=n.clipShadows,a.clippingPlanes=n.clippingPlanes,a.wireframeLinewidth=n.wireframeLinewidth,a.linewidth=n.linewidth,i&&void 0!==a.uniforms.lightPos&&a.uniforms.lightPos.value.copy(r),a}function c(t,e,n){if(!1!==t.visible){if(0!==(t.layers.mask&e.layers.mask)&&(t.isMesh||t.isLine||t.isPoints)&&t.castShadow&&(!1===t.frustumCulled||!0===p.intersectsObject(t))){!0===t.material.visible&&(t.modelViewMatrix.multiplyMatrices(n.matrixWorldInverse,t.matrixWorld),b.push(t))}for(var i=t.children,r=0,o=i.length;r<o;r++)c(i[r],e,n)}}var l=t.context,d=t.state,p=new ot,f=new u,m=e.shadows,v=new r,g=new r(i.maxTextureSize,i.maxTextureSize),y=new h,_=new h,b=[],x=1,w=2,M=1+(x|w),E=new Array(M),T=new Array(M),S={},A=[new h(1,0,0),new h(-1,0,0),new h(0,0,1),new h(0,0,-1),new h(0,1,0),new h(0,-1,0)],L=[new h(0,1,0),new h(0,1,0),new h(0,1,0),new h(0,1,0),new h(0,0,1),new h(0,0,-1)],R=[new a,new a,new a,new a,new a,new a],C=new tt;C.depthPacking=da,C.clipping=!0;for(var P=Ea.distanceRGBA,O=ba.clone(P.uniforms),I=0;I!==M;++I){var U=0!==(I&x),N=0!==(I&w),D=C.clone();D.morphTargets=U,D.skinning=N,E[I]=D;var F=new $({defines:{USE_SHADOWMAP:""},uniforms:O,vertexShader:P.vertexShader,fragmentShader:P.fragmentShader,morphTargets:U,skinning:N,clipping:!0});T[I]=F}var z=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=hr,this.renderReverseSided=!0,this.renderSingleSided=!0,this.render=function(e,i){if(!1!==z.enabled&&(!1!==z.autoUpdate||!1!==z.needsUpdate)&&0!==m.length){d.buffers.color.setClear(1,1,1,1),d.disable(l.BLEND),d.setDepthTest(!0),d.setScissorTest(!1);for(var r,a,h=0,u=m.length;h<u;h++){var x=m[h],w=x.shadow;if(void 0!==w){var M=w.camera;if(v.copy(w.mapSize),v.min(g),x&&x.isPointLight){r=6,a=!0;var E=v.x,T=v.y;R[0].set(2*E,T,E,T),R[1].set(0,T,E,T),R[2].set(3*E,T,E,T),R[3].set(E,T,E,T),R[4].set(3*E,0,E,T),R[5].set(E,0,E,T),v.x*=4,v.y*=2}else r=1,a=!1;if(null===w.map){var S={minFilter:yo,magFilter:yo,format:Bo};w.map=new s(v.x,v.y,S),M.updateProjectionMatrix()}w.isSpotLightShadow&&w.update(x),w&&w.isRectAreaLightShadow&&w.update(x);var C=w.map,P=w.matrix;_.setFromMatrixPosition(x.matrixWorld),M.position.copy(_),t.setRenderTarget(C),t.clear();for(var O=0;O<r;O++){if(a){y.copy(M.position),y.add(A[O]),M.up.copy(L[O]),M.lookAt(y);var I=R[O];d.viewport(I)}else y.setFromMatrixPosition(x.target.matrixWorld),M.lookAt(y);M.updateMatrixWorld(),M.matrixWorldInverse.getInverse(M.matrixWorld),P.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),P.multiply(M.projectionMatrix),P.multiply(M.matrixWorldInverse),f.multiplyMatrices(M.projectionMatrix,M.matrixWorldInverse),p.setFromMatrix(f),b.length=0,c(e,i,M);for(var U=0,N=b.length;U<N;U++){var D=b[U],F=n.update(D),B=D.material;if(B&&B.isMultiMaterial)for(var k=F.groups,j=B.materials,G=0,H=k.length;G<H;G++){var V=k[G],W=j[V.materialIndex];if(!0===W.visible){var X=o(D,W,a,_);t.renderBufferDirect(M,null,F,X,D,V)}}else{var X=o(D,B,a,_);t.renderBufferDirect(M,null,F,X,D,null)}}}}else console.warn("THREE.WebGLShadowMap:",x,"has no shadow.")}var q=t.getClearColor(),Y=t.getClearAlpha();t.setClearColor(q,Y),z.needsUpdate=!1}}}function st(t,e){this.origin=void 0!==t?t:new h,this.direction=void 0!==e?e:new h}function ct(t,e,n,i){this._x=t||0,this._y=e||0,this._z=n||0,this._order=i||ct.DefaultOrder}function lt(){this.mask=1}function ht(){function t(){r.setFromEuler(i,!1)}function e(){i.setFromQuaternion(r,void 0,!1)}Object.defineProperty(this,"id",{value:Sa++}
1),this.uuid=pa.generateUUID(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=ht.DefaultUp.clone();var n=new h,i=new ct,r=new l,o=new h(1,1,1);i.onChange(t),r.onChange(e),Object.defineProperties(this,{position:{enumerable:!0,value:n},rotation:{enumerable:!0,value:i},quaternion:{enumerable:!0,value:r},scale:{enumerable:!0,value:o},modelViewMatrix:{value:new u},normalMatrix:{value:new it}}),this.matrix=new u,this.matrixWorld=new u,this.matrixAutoUpdate=ht.DefaultMatrixAutoUpdate,this.matrixWorldNeedsUpdate=!1,this.layers=new lt,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.userData={},this.onBeforeRender=function(){},this.onAfterRender=function(){}}function ut(t,e){this.start=void 0!==t?t:new h,this.end=void 0!==e?e:new h}function dt(t,e,n){this.a=void 0!==t?t:new h,this.b=void 0!==e?e:new h,this.c=void 0!==n?n:new h}function pt(t,e,n,i,r,o){this.a=t,this.b=e,this.c=n,this.normal=i&&i.isVector3?i:new h,this.vertexNormals=Array.isArray(i)?i:[],this.color=r&&r.isColor?r:new q,this.vertexColors=Array.isArray(r)?r:[],this.materialIndex=void 0!==o?o:0}function ft(t){K.call(this),this.type="MeshBasicMaterial",this.color=new q(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=Qr,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.lights=!1,this.setValues(t)}function mt(t,e,n){if(Array.isArray(t))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.uuid=pa.generateUUID(),this.array=t,this.itemSize=e,this.count=void 0!==t?t.length/e:0,this.normalized=!0===n,this.dynamic=!1,this.updateRange={offset:0,count:-1},this.onUploadCallback=function(){},this.version=0}function vt(t,e){mt.call(this,new Int8Array(t),e)}function gt(t,e){mt.call(this,new Uint8Array(t),e)}function yt(t,e){mt.call(this,new Uint8ClampedArray(t),e)}function _t(t,e){mt.call(this,new Int16Array(t),e)}function bt(t,e){mt.call(this,new Uint16Array(t),e)}function xt(t,e){mt.call(this,new Int32Array(t),e)}function wt(t,e){mt.call(this,new Uint32Array(t),e)}function Mt(t,e){mt.call(this,new Float32Array(t),e)}function Et(t,e){mt.call(this,new Float64Array(t),e)}function Tt(){this.indices=[],this.vertices=[],this.normals=[],this.colors=[],this.uvs=[],this.uvs2=[],this.groups=[],this.morphTargets={},this.skinWeights=[],this.skinIndices=[],this.boundingBox=null,this.boundingSphere=null,this.verticesNeedUpdate=!1,this.normalsNeedUpdate=!1,this.colorsNeedUpdate=!1,this.uvsNeedUpdate=!1,this.groupsNeedUpdate=!1}function St(){Object.defineProperty(this,"id",{value:At()}),this.uuid=pa.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.boundingBox=null,this.boundingSphere=null,this.elementsNeedUpdate=!1,this.verticesNeedUpdate=!1,this.uvsNeedUpdate=!1,this.normalsNeedUpdate=!1,this.colorsNeedUpdate=!1,this.lineDistancesNeedUpdate=!1,this.groupsNeedUpdate=!1}function At(){return Aa++}function Lt(){Object.defineProperty(this,"id",{value:At()}),this.uuid=pa.generateUUID(),this.name="",this.type="BufferGeometry",this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0}}function Rt(t,e){ht.call(this),this.type="Mesh",this.geometry=void 0!==t?t:new Lt,this.material=void 0!==e?e:new ft({color:16777215*Math.random()}),this.drawMode=ea,this.updateMorphTargets()}function Ct(t,e,n,i,r,o){function a(t,e,n,i,r,o,a,c,l,b,x){for(var w=o/l,M=a/b,E=o/2,T=a/2,S=c/2,A=l+1,L=b+1,R=0,C=0,P=new h,O=0;O<L;O++)for(var I=O*M-T,U=0;U<A;U++){var N=U*w-E;P[t]=N*i,P[e]=I*r,P[n]=S,d[m]=P.x,d[m+1]=P.y,d[m+2]=P.z,P[t]=0,P[e]=0,P[n]=c>0?1:-1,p[m]=P.x,p[m+1]=P.y,p[m+2]=P.z,f[v]=U/l,f[v+1]=1-O/b,m+=3,v+=2,R+=1}for(O=0;O<b;O++)for(U=0;U<l;U++){var D=y+U+A*O,F=y+U+A*(O+1),z=y+(U+1)+A*(O+1),B=y+(U+1)+A*O;u[g]=D,u[g+1]=F,u[g+2]=B,u[g+3]=F,u[g+4]=z,u[g+5]=B,g+=6,C+=6}s.addGroup(_,C,x),_+=C,y+=R}Lt.call(this),this.type="BoxBufferGeometry",this.parameters={width:t,height:e,depth:n,widthSegments:i,heightSegments:r,depthSegments:o};var s=this;i=Math.floor(i)||1,r=Math.floor(r)||1,o=Math.floor(o)||1;var c=function(t,e,n){var i=0;return i+=(t+1)*(e+1)*2,i+=(t+1)*(n+1)*2,i+=(n+1)*(e+1)*2}(i,r,o),l=function(t,e,n){var i=0;return i+=t*e*2,i+=t*n*2,6*(i+=n*e*2)}(i,r,o),u=new(l>65535?Uint32Array:Uint16Array)(l),d=new Float32Array(3*c),p=new Float32Array(3*c),f=new Float32Array(2*c),m=0,v=0,g=0,y=0,_=0;a("z","y","x",-1,-1,n,e,t,o,r,0),a("z","y","x",1,-1,n,e,-t,o,r,1),a("x","z","y",1,1,t,n,e,i,o,2),a("x","z","y",1,-1,t,n,-e,i,o,3),a("x","y","z",1,-1,t,e,n,i,r,4),a("x","y","z",-1,-1,t,e,-n,i,r,5),this.setIndex(new mt(u,1)),this.addAttribute("position",new mt(d,3)),this.addAttribute("normal",new mt(p,3)),this.addAttribute("uv",new mt(f,2))}function Pt(t,e,n,i){Lt.call(this),this.type="PlaneBufferGeometry",this.parameters={width:t,height:e,widthSegments:n,heightSegments:i};for(var r=t/2,o=e/2,a=Math.floor(n)||1,s=Math.floor(i)||1,c=a+1,l=s+1,h=t/a,u=e/s,d=new Float32Array(c*l*3),p=new Float32Array(c*l*3),f=new Float32Array(c*l*2),m=0,v=0,g=0;g<l;
1g++)for(var y=g*u-o,_=0;_<c;_++){var b=_*h-r;d[m]=b,d[m+1]=-y,p[m+2]=1,f[v]=_/a,f[v+1]=1-g/s,m+=3,v+=2}m=0;for(var x=new(d.length/3>65535?Uint32Array:Uint16Array)(a*s*6),g=0;g<s;g++)for(var _=0;_<a;_++){var w=_+c*g,M=_+c*(g+1),E=_+1+c*(g+1),T=_+1+c*g;x[m]=w,x[m+1]=M,x[m+2]=T,x[m+3]=M,x[m+4]=E,x[m+5]=T,m+=6}this.setIndex(new mt(x,1)),this.addAttribute("position",new mt(d,3)),this.addAttribute("normal",new mt(p,3)),this.addAttribute("uv",new mt(f,2))}function Ot(){ht.call(this),this.type="Camera",this.matrixWorldInverse=new u,this.projectionMatrix=new u}function It(t,e,n,i){Ot.call(this),this.type="PerspectiveCamera",this.fov=void 0!==t?t:50,this.zoom=1,this.near=void 0!==n?n:.1,this.far=void 0!==i?i:2e3,this.focus=10,this.aspect=void 0!==e?e:1,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}function Ut(t,e,n,i,r,o){Ot.call(this),this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=t,this.right=e,this.top=n,this.bottom=i,this.near=void 0!==r?r:.1,this.far=void 0!==o?o:2e3,this.updateProjectionMatrix()}function Nt(t,e,n){function i(t){s=t}function r(n){n.array instanceof Uint32Array&&e.get("OES_element_index_uint")?(c=t.UNSIGNED_INT,l=4):n.array instanceof Uint16Array?(c=t.UNSIGNED_SHORT,l=2):(c=t.UNSIGNED_BYTE,l=1)}function o(e,i){t.drawElements(s,i,c,e*l),n.calls++,n.vertices+=i,s===t.TRIANGLES&&(n.faces+=i/3)}function a(i,r,o){var a=e.get("ANGLE_instanced_arrays");if(null===a)return void console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");a.drawElementsInstancedANGLE(s,o,c,r*l,i.maxInstancedCount),n.calls++,n.vertices+=o*i.maxInstancedCount,s===t.TRIANGLES&&(n.faces+=i.maxInstancedCount*o/3)}var s,c,l;return{setMode:i,setIndex:r,render:o,renderInstances:a}}function Dt(t,e,n){function i(t){a=t}function r(e,i){t.drawArrays(a,e,i),n.calls++,n.vertices+=i,a===t.TRIANGLES&&(n.faces+=i/3)}function o(i){var r=e.get("ANGLE_instanced_arrays");if(null===r)return void console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");var o=i.attributes.position,s=0;o.isInterleavedBufferAttribute?(s=o.data.count,r.drawArraysInstancedANGLE(a,0,s,i.maxInstancedCount)):(s=o.count,r.drawArraysInstancedANGLE(a,0,s,i.maxInstancedCount)),n.calls++,n.vertices+=s*i.maxInstancedCount,a===t.TRIANGLES&&(n.faces+=i.maxInstancedCount*s/3)}var a;return{setMode:i,render:r,renderInstances:o}}function Ft(){var t={};return{get:function(e){if(void 0!==t[e.id])return t[e.id];var n;switch(e.type){case"DirectionalLight":n={direction:new h,color:new q,shadow:!1,shadowBias:0,shadowRadius:1,shadowMapSize:new r};break;case"SpotLight":n={position:new h,direction:new h,color:new q,distance:0,coneCos:0,penumbraCos:0,decay:0,shadow:!1,shadowBias:0,shadowRadius:1,shadowMapSize:new r};break;case"PointLight":n={position:new h,color:new q,distance:0,decay:0,shadow:!1,shadowBias:0,shadowRadius:1,shadowMapSize:new r};break;case"HemisphereLight":n={direction:new h,skyColor:new q,groundColor:new q};break;case"RectAreaLight":n={color:new q,position:new h,halfWidth:new h,halfHeight:new h}}return t[e.id]=n,n}}}function zt(t){for(var e=t.split("\n"),n=0;n<e.length;n++)e[n]=n+1+": "+e[n];return e.join("\n")}function Bt(t,e,n){var i=t.createShader(e);return t.shaderSource(i,n),t.compileShader(i),!1===t.getShaderParameter(i,t.COMPILE_STATUS)&&console.error("THREE.WebGLShader: Shader couldn't compile."),""!==t.getShaderInfoLog(i)&&console.warn("THREE.WebGLShader: gl.getShaderInfoLog()",e===t.VERTEX_SHADER?"vertex":"fragment",t.getShaderInfoLog(i),zt(n)),i}function kt(t){switch(t){case ra:return["Linear","( value )"];case oa:return["sRGB","( value )"];case sa:return["RGBE","( value )"];case ca:return["RGBM","( value, 7.0 )"];case la:return["RGBM","( value, 16.0 )"];case ha:return["RGBD","( value, 256.0 )"];case aa:return["Gamma","( value, float( GAMMA_FACTOR ) )"];default:throw new Error("unsupported encoding: "+t)}}function jt(t,e){var n=kt(e);return"vec4 "+t+"( vec4 value ) { return "+n[0]+"ToLinear"+n[1]+"; }"}function Gt(t,e){var n=kt(e);return"vec4 "+t+"( vec4 value ) { return LinearTo"+n[0]+n[1]+"; }"}function Ht(t,e){var n;switch(e){case eo:n="Linear";break;case no:n="Reinhard";break;case io:n="Uncharted2";break;case ro:n="OptimizedCineon";break;default:throw new Error("unsupported toneMapping: "+e)}return"vec3 "+t+"( vec3 color ) { return "+n+"ToneMapping( color ); }"}function Vt(t,e,n){return t=t||{},[t.derivatives||e.envMapCubeUV||e.bumpMap||e.normalMap||e.flatShading?"#extension GL_OES_standard_derivatives : enable":"",(t.fragDepth||e.logarithmicDepthBuffer)&&n.get("EXT_frag_depth")?"#extension GL_EXT_frag_depth : enable":"",t.drawBuffers&&n.get("WEBGL_draw_buffers")?"#extension GL_EXT_draw_buffers : require":"",(t.shaderTextureLOD||e.envMap)&&n.get("EXT_shader_texture_lod")?"#extension GL_EXT_shader_texture_lod : enable":""].filter(qt).join("\n")}function Wt(t){var e=[];for(var n in t){var i=t[n];!1!==i&&e.push("#define "+n+" "+i)}return e.join("\n")}function Xt(t,e,n){for(var i={},r=t.getProgramParameter(e,t.ACTIVE_ATTRIBUTES),o=0;o<r;o++){var a=t.getActiveAttrib(e,o),s=a.name;i[s]=t.getAttribLocation(e,s)}return i}function qt(t){return""!==t}function Yt(t,e){return t.replace(/NUM_DIR_LIGHTS/g,e.numDirLights).replace(/NUM_SPOT_L
1IGHTS/g,e.numSpotLights).replace(/NUM_RECT_AREA_LIGHTS/g,e.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,e.numPointLights).replace(/NUM_HEMI_LIGHTS/g,e.numHemiLights)}function Zt(t){function e(t,e){var n=xa[e];if(void 0===n)throw new Error("Can not resolve #include <"+e+">");return Zt(n)}var n=/#include +<([\w\d.]+)>/g;return t.replace(n,e)}function Jt(t){function e(t,e,n,i){for(var r="",o=parseInt(e);o<parseInt(n);o++)r+=i.replace(/\[ i \]/g,"[ "+o+" ]");return r}var n=/for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}/g;return t.replace(n,e)}function Qt(t,e,n,i){var r=t.context,o=n.extensions,a=n.defines,s=n.__webglShader.vertexShader,c=n.__webglShader.fragmentShader,l="SHADOWMAP_TYPE_BASIC";i.shadowMapType===hr?l="SHADOWMAP_TYPE_PCF":i.shadowMapType===ur&&(l="SHADOWMAP_TYPE_PCF_SOFT");var h="ENVMAP_TYPE_CUBE",u="ENVMAP_MODE_REFLECTION",d="ENVMAP_BLENDING_MULTIPLY";if(i.envMap){switch(n.envMap.mapping){case oo:case ao:h="ENVMAP_TYPE_CUBE";break;case ho:case uo:h="ENVMAP_TYPE_CUBE_UV";break;case so:case co:h="ENVMAP_TYPE_EQUIREC";break;case lo:h="ENVMAP_TYPE_SPHERE"}switch(n.envMap.mapping){case ao:case co:u="ENVMAP_MODE_REFRACTION"}switch(n.combine){case Qr:d="ENVMAP_BLENDING_MULTIPLY";break;case Kr:d="ENVMAP_BLENDING_MIX";break;case $r:d="ENVMAP_BLENDING_ADD"}}var p,f,m=t.gammaFactor>0?t.gammaFactor:1,v=Vt(o,i,t.extensions),g=Wt(a),y=r.createProgram();n.isRawShaderMaterial?(p=[g,"\n"].filter(qt).join("\n"),f=[v,g,"\n"].filter(qt).join("\n")):(p=["precision "+i.precision+" float;","precision "+i.precision+" int;","#define SHADER_NAME "+n.__webglShader.name,g,i.supportsVertexTextures?"#define VERTEX_TEXTURES":"","#define GAMMA_FACTOR "+m,"#define MAX_BONES "+i.maxBones,i.map?"#define USE_MAP":"",i.envMap?"#define USE_ENVMAP":"",i.envMap?"#define "+u:"",i.lightMap?"#define USE_LIGHTMAP":"",i.aoMap?"#define USE_AOMAP":"",i.emissiveMap?"#define USE_EMISSIVEMAP":"",i.bumpMap?"#define USE_BUMPMAP":"",i.normalMap?"#define USE_NORMALMAP":"",i.displacementMap&&i.supportsVertexTextures?"#define USE_DISPLACEMENTMAP":"",i.specularMap?"#define USE_SPECULARMAP":"",i.roughnessMap?"#define USE_ROUGHNESSMAP":"",i.metalnessMap?"#define USE_METALNESSMAP":"",i.alphaMap?"#define USE_ALPHAMAP":"",i.vertexColors?"#define USE_COLOR":"",i.flatShading?"#define FLAT_SHADED":"",i.skinning?"#define USE_SKINNING":"",i.useVertexTexture?"#define BONE_TEXTURE":"",i.morphTargets?"#define USE_MORPHTARGETS":"",i.morphNormals&&!1===i.flatShading?"#define USE_MORPHNORMALS":"",i.doubleSided?"#define DOUBLE_SIDED":"",i.flipSided?"#define FLIP_SIDED":"","#define NUM_CLIPPING_PLANES "+i.numClippingPlanes,i.shadowMapEnabled?"#define USE_SHADOWMAP":"",i.shadowMapEnabled?"#define "+l:"",i.sizeAttenuation?"#define USE_SIZEATTENUATION":"",i.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",i.logarithmicDepthBuffer&&t.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(qt).join("\n"),f=[v,"precision "+i.precision+" float;","precision "+i.precision+" int;","#define SHADER_NAME "+n.__webglShader.name,g,i.alphaTest?"#define ALPHATEST "+i.alphaTest:"","#define GAMMA_FACTOR "+m,i.useFog&&i.fog?"#define USE_FOG":"",i.useFog&&i.fogExp?"#define FOG_EXP2":"",i.map?"#define USE_MAP":"",i.envMap?"#define USE_ENVMAP":"",i.envMap?"#define "+h:"",i.envMap?"#define "+u:"",i.envMap?"#define "+d:"",i.lightMap?"#define USE_LIGHTMAP":"",i.aoMap?"#define USE_AOMAP":"",i.emissiveMap?"#define USE_EMISSIVEMAP":"",i.bumpMap?"#define USE_BUMPMAP":"",i.normalMap?"#define USE_NORMALMAP":"",i.specularMap?"#define USE_SPECULARMAP":"",i.roughnessMap?"#define USE_ROUGHNESSMAP":"",i.metalnessMap?"#define USE_METALNESSMAP":"",i.alph
1aMap?"#define USE_ALPHAMAP":"",i.vertexColors?"#define USE_COLOR":"",i.gradientMap?"#define USE_GRADIENTMAP":"",i.flatShading?"#define FLAT_SHADED":"",i.doubleSided?"#define DOUBLE_SIDED":"",i.flipSided?"#define FLIP_SIDED":"","#define NUM_CLIPPING_PLANES "+i.numClippingPlanes,"#define UNION_CLIPPING_PLANES "+(i.numClippingPlanes-i.numClipIntersection),i.shadowMapEnabled?"#define USE_SHADOWMAP":"",i.shadowMapEnabled?"#define "+l:"",i.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",i.physicallyCorrectLights?"#define PHYSICALLY_CORRECT_LIGHTS":"",i.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",i.logarithmicDepthBuffer&&t.extensions.get("EXT_frag_depth")?"#define USE_LOGDEPTHBUF_EXT":"",i.envMap&&t.extensions.get("EXT_shader_texture_lod")?"#define TEXTURE_LOD_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;",i.toneMapping!==to?"#define TONE_MAPPING":"",i.toneMapping!==to?xa.tonemapping_pars_fragment:"",i.toneMapping!==to?Ht("toneMapping",i.toneMapping):"",i.outputEncoding||i.mapEncoding||i.envMapEncoding||i.emissiveMapEncoding?xa.encodings_pars_fragment:"",i.mapEncoding?jt("mapTexelToLinear",i.mapEncoding):"",i.envMapEncoding?jt("envMapTexelToLinear",i.envMapEncoding):"",i.emissiveMapEncoding?jt("emissiveMapTexelToLinear",i.emissiveMapEncoding):"",i.outputEncoding?Gt("linearToOutputTexel",i.outputEncoding):"",i.depthPacking?"#define DEPTH_PACKING "+n.depthPacking:"","\n"].filter(qt).join("\n")),s=Zt(s,i),s=Yt(s,i),c=Zt(c,i),c=Yt(c,i),n.isShaderMaterial||(s=Jt(s),c=Jt(c));var _=p+s,b=f+c,x=Bt(r,r.VERTEX_SHADER,_),w=Bt(r,r.FRAGMENT_SHADER,b);r.attachShader(y,x),r.attachShader(y,w),void 0!==n.index0AttributeName?r.bindAttribLocation(y,0,n.index0AttributeName):!0===i.morphTargets&&r.bindAttribLocation(y,0,"position"),r.linkProgram(y);var M=r.getProgramInfoLog(y),E=r.getShaderInfoLog(x),T=r.getShaderInfoLog(w),S=!0,A=!0;!1===r.getProgramParameter(y,r.LINK_STATUS)?(S=!1,console.error("THREE.WebGLProgram: shader error: ",r.getError(),"gl.VALIDATE_STATUS",r.getProgramParameter(y,r.VALIDATE_STATUS),"gl.getProgramInfoLog",M,E,T)):""!==M?console.warn("THREE.WebGLProgram: gl.getProgramInfoLog()",M):""!==E&&""!==T||(A=!1),A&&(this.diagnostics={runnable:S,material:n,programLog:M,vertexShader:{log:E,prefix:p},fragmentShader:{log:T,prefix:f}}),r.deleteShader(x),r.deleteShader(w);var L;this.getUniforms=function(){return void 0===L&&(L=new X(r,y,t)),L};var R;return this.getAttributes=function(){return void 0===R&&(R=Xt(r,y)),R},this.destroy=function(){r.deleteProgram(y),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=La++,this.code=e,this.usedTimes=1,this.program=y,this.vertexShader=x,this.fragmentShader=w,this}function Kt(t,e){function n(t){if(e.floatVertexTextures&&t&&t.skeleton&&t.skeleton.useVertexTexture)return 1024;var n=e.maxVertexUniforms,i=Math.floor((n-20)/4),r=i;return void 0!==t&&t&&t.isSkinnedMesh&&(r=Math.min(t.skeleton.bones.length,r))<t.skeleton.bones.length&&console.warn("WebGLRenderer: too many bones - "+t.skeleton.bones.length+", this GPU supports just "+r+" (try OpenGL instead of ANGLE)"),r}function i(t,e){var n;return t?t.isTexture?n=t.encoding:t.isWebGLRenderTarget&&(console.warn("THREE.WebGLPrograms.getTextureEncodingFromMap: don't use render targets as textures. Use their .texture property instead."),n=t.texture.encoding):n=ra,n===ra&&e&&(n=aa),n}var r=[],o={MeshDepthMaterial:"depth",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"phong",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points"},a=["precision","supportsVertexTextures","map","mapEncoding","envMap","envMapMode","envMapEncoding","lightMap","aoMap","emissiveMap","emissiveMapEncoding","bumpMap","normalMap","displacementMap","specularMap","roughnessMap","metalnessMap","gradientMap","alphaMap","combine","vertexColors","fog","useFog","fogExp","flatShading","sizeAttenuation","logarithmicDepthBuffer","skinning","maxBones","useVertexTexture","morphTargets","morphNormals","maxMorphTargets","maxMorphNormals","premultipliedAlpha","numDirLights","numPointLights","numSpotLights","numHemiLights","numRectAreaLights","shadowMapEnabled","shadowMapType","toneMapping","physicallyCorrectLights","alphaTest","doubleSided","flipSided","numClippingPlanes","numClipIntersection","depthPacking"];this.getParameters=function(r,a,s,c,l,h){var u=o[r.type],d=n(h),p=t.getPrecision();null!==r.precision&&(p=e.getMaxPrecision(r.precision))!==r.precision&&console.warn("THREE.WebGLProgram.getParameters:",r.precision,"not supported, using",p,"instead.");var f=t.getCurrentRenderTarget();return{shaderID:u,precision:p,supportsVertexTextures:e.vertexTextures,outputEncoding:i(f?f.texture:null,t.gammaOutput),map:!!r.map,mapEncoding:i(r.map,t.gammaInput),envMap:!!r.envMap,envMapMode:r.envMap&&r.envMap.mapping,envMapEncoding:i(r.envMap,t.gammaInput),envMapCubeUV:!!r.envMap&&(r.envMap.mapping===ho||r.envMap.mapping===uo),lightMap:!!r.lightMap,aoMap:!!r.aoMap,emissiveMap:!!r.emissiveMap,emissiveMapEncoding:i(r.emissiveMap,t.gammaInput),bumpMap:!!r.bumpMap,normalMap:!!r.normalMap,displacementMap:!!r.displacementMap,roughnessMap:!!r.roughnessMap,metalnessMap:!!r.metalnessMap,specularMap:!!r.specularMap,alph
1aMap:!!r.alphaMap,gradientMap:!!r.gradientMap,combine:r.combine,vertexColors:r.vertexColors,fog:!!s,useFog:r.fog,fogExp:s&&s.isFogExp2,flatShading:r.shading===mr,sizeAttenuation:r.sizeAttenuation,logarithmicDepthBuffer:e.logarithmicDepthBuffer,skinning:r.skinning,maxBones:d,useVertexTexture:e.floatVertexTextures&&h&&h.skeleton&&h.skeleton.useVertexTexture,morphTargets:r.morphTargets,morphNormals:r.morphNormals,maxMorphTargets:t.maxMorphTargets,maxMorphNormals:t.maxMorphNormals,numDirLights:a.directional.length,numPointLights:a.point.length,numSpotLights:a.spot.length,numRectAreaLights:a.rectArea.length,numHemiLights:a.hemi.length,numClippingPlanes:c,numClipIntersection:l,shadowMapEnabled:t.shadowMap.enabled&&h.receiveShadow&&a.shadows.length>0,shadowMapType:t.shadowMap.type,toneMapping:t.toneMapping,physicallyCorrectLights:t.physicallyCorrectLights,premultipliedAlpha:r.premultipliedAlpha,alphaTest:r.alphaTest,doubleSided:r.side===fr,flipSided:r.side===pr,depthPacking:void 0!==r.depthPacking&&r.depthPacking}},this.getProgramCode=function(t,e){var n=[];if(e.shaderID?n.push(e.shaderID):(n.push(t.fragmentShader),n.push(t.vertexShader)),void 0!==t.defines)for(var i in t.defines)n.push(i),n.push(t.defines[i]);for(var r=0;r<a.length;r++)n.push(e[a[r]]);return n.join()},this.acquireProgram=function(e,n,i){for(var o,a=0,s=r.length;a<s;a++){var c=r[a];if(c.code===i){o=c,++o.usedTimes;break}}return void 0===o&&(o=new Qt(t,i,e,n),r.push(o)),o},this.releaseProgram=function(t){if(0===--t.usedTimes){var e=r.indexOf(t);r[e]=r[r.length-1],r.pop(),t.destroy()}},this.programs=r}function $t(t,e,n){function i(t){var r=t.target,s=c[r.id];null!==s.index&&o(s.index),a(s.attributes),r.removeEventListener("dispose",i),delete c[r.id];var l=e.get(r);l.wireframe&&o(l.wireframe),e.delete(r);var h=e.get(s);h.wireframe&&o(h.wireframe),e.delete(s),n.memory.geometries--}function r(t){return t.isInterleavedBufferAttribute?e.get(t.data).__webglBuffer:e.get(t).__webglBuffer}function o(e){var n=r(e);void 0!==n&&(t.deleteBuffer(n),s(e))}function a(t){for(var e in t)o(t[e])}function s(t){t.isInterleavedBufferAttribute?e.delete(t.data):e.delete(t)}var c={};return{get:function(t){var e=t.geometry;if(void 0!==c[e.id])return c[e.id];e.addEventListener("dispose",i);var r;return e.isBufferGeometry?r=e:e.isGeometry&&(void 0===e._bufferGeometry&&(e._bufferGeometry=(new Lt).setFromObject(t)),r=e._bufferGeometry),c[e.id]=r,n.memory.geometries++,r}}}function te(t,e,n){function i(e){var n=h.get(e);e.geometry.isGeometry&&n.updateFromObject(e);var i=n.index,o=n.attributes;null!==i&&r(i,t.ELEMENT_ARRAY_BUFFER);for(var a in o)r(o[a],t.ARRAY_BUFFER);var s=n.morphAttributes;for(var a in s)for(var c=s[a],l=0,u=c.length;l<u;l++)r(c[l],t.ARRAY_BUFFER);return n}function r(t,n){var i=t.isInterleavedBufferAttribute?t.data:t,r=e.get(i);void 0===r.__webglBuffer?o(r,i,n):r.version!==i.version&&a(r,i,n)}function o(e,n,i){e.__webglBuffer=t.createBuffer(),t.bindBuffer(i,e.__webglBuffer);var r=n.dynamic?t.DYNAMIC_DRAW:t.STATIC_DRAW;t.bufferData(i,n.array,r);var o=t.FLOAT,a=n.array;a instanceof Float32Array?o=t.FLOAT:a instanceof Float64Array?console.warn("Unsupported data buffer format: Float64Array"):a instanceof Uint16Array?o=t.UNSIGNED_SHORT:a instanceof Int16Array?o=t.SHORT:a instanceof Uint32Array?o=t.UNSIGNED_INT:a instanceof Int32Array?o=t.INT:a instanceof Int8Array?o=t.BYTE:a instanceof Uint8Array&&(o=t.UNSIGNED_BYTE),e.bytesPerElement=a.BYTES_PER_ELEMENT,e.type=o,e.version=n.version,n.onUploadCallback()}function a(e,n,i){t.bindBuffer(i,e.__webglBuffer),!1===n.dynamic?t.bufferData(i,n.array,t.STATIC_DRAW):-1===n.updateRange.count?t.bufferSubData(i,0,n.array):0===n.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."):(t.bufferSubData(i,n.updateRange.offset*n.array.BYTES_PER_ELEMENT,n.array.subarray(n.updateRange.offset,n.updateRange.offset+n.updateRange.count)),n.updateRange.count=0),e.version=n.version}function s(t){return t.isInterleavedBufferAttribute?e.get(t.data).__webglBuffer:e.get(t).__webglBuffer}function c(t){return t.isInterleavedBufferAttribute?e.get(t.data):e.get(t)}function l(n){var i=e.get(n);if(void 0!==i.wireframe)return i.wireframe;var o=[],a=n.index,s=n.attributes,c=s.position;if(null!==a)for(var l=a.array,h=0,u=l.length;h<u;h+=3){var d=l[h+0],p=l[h+1],f=l[h+2];o.push(d,p,p,f,f,d)}else for(var l=s.position.array,h=0,u=l.length/3-1;h<u;h+=3){var d=h+0,p=h+1,f=h+2;o.push(d,p,p,f,f,d)}var m=c.count>65535?Uint32Array:Uint16Array,v=new mt(new m(o),1);return r(v,t.ELEMENT_ARRAY_BUFFER),i.wireframe=v,v}var h=new $t(t,e,n);return{getAttributeBuffer:s,getAttributeProperties:c,getWireframeAttribute:l,update:i}}function ee(t,e,n,i,r,o,a){function s(t,e){if(t.width>e||t.height>e){var n=e/Math.max(t.width,t.height),i=document.createElementNS("http://www.w3.org/1999/xhtml","canvas");i.width=Math.floor(t.width*n),i.height=Math.floor(t.height*n);return i.getContext("2d").drawImage(t,0,0,t.width,t.height,0,0,i.width,i.height),console.warn("THREE.WebGLRenderer: image is too big ("+t.width+"x"+t.height+"). Resized to "+i.width+"x"+i.height,t),i}return t}function c(t){return pa.isPowerOfTwo(t.width)&&pa.isPowerOfTwo(t.height)}function l(t){if(t instanceof HTMLImageElement||t instanceof HTMLCanvasElement){var e=document.createElementNS("http://www.w3.org/1999/xhtml","canvas");e.width=pa.nearestPowerOfTwo(t.width),e.height=pa.nearestPowerOfTwo(t.height);return e.getContext("2d").drawImage(t,0,0,e.width,e.height),console.warn("THREE.WebGLRenderer: image is not power of two ("+t.width+"x"+t.height+"). Resized to "+e.width+"x"+e.height,t),e}return t}function h(t){return t.wrapS!==mo||t.wrapT!==mo||t.minFilter!==yo&&t.minFilter!==xo}function u(e){return e===yo||e===_o||e===bo?t.NEAREST:t.LINEAR}function d(t){var e=t.target;e.removeEventListener("dispose",d),f(e),A.textures--}function p(t){var e=t.target;e.removeEventListener("dispose",p),m(e),A.textures--}function f(e){var n=i.get(e);if(e.image&&n.__image__webglTextureCube)t.deleteTexture(n.__image__webglTextureCube);else{if(void 0===n.__webglInit)return;t.deleteTexture(n.__webglTexture)}i.delete(e)}function m(e){var n=i.get(e),r=i.get(e.texture);if(e){if(void 0!==r.__webglTexture&&t.deleteTexture(r.__webglTexture),e.depthTexture&&e.depthTexture.dispose(),e.isWebGLRenderTargetCube)for(var o=0;o<6;o++)t.deleteFramebuffer(n.__webglFramebuffer[o]),n.__webglDepthbuffer&&t.deleteRenderbuffer(n.__webglDepthbuffer[o]);else t.deleteFramebuffer(n.__webglFramebuffer),n.__webglDepthbuffer&&t.deleteRenderbuffer(n.__webglDepthbuffer);i.delete(e.texture),i.delete(e)}}function v(e,r){var o=i.get(e);if(e.version>0&&o.__version!==e.version){var a=e.image;if(void 0===a)console.warn("THREE.WebGLRenderer: Texture marked for update but image is undefined",e);else{if(!1!==a.complete)return void b(o,e,r);console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete",e)}}n.activeTexture(t.TEXTURE0+r),n.bindTexture(t.TEXTURE_2D,o.__webglTexture)}function g(e,a){var l=i.get(e);if(6===e.image.length)if(e.version>0&&l.__version!==e.version){l.__image__webglTextureCube||(e.addEventListener("dispose",d),l.__image__webglTextureCube=t.createTexture(),A.textures++),n.activeTexture(t.TEXTURE0+a),n.bindTexture(t.TEXTURE_CUBE_MAP,l.__image__webglTextureCube),t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,e.flipY);for(var h=e&&e.isCompressedTexture,u=e.image[0]&&e.image[0].isDataTexture,p=[],f=0;f<6;f++)p[f]=h||u?u?e.image[f].image:e.image[f]:s(e.image[f],r.maxCubemapSize);var m=p[0],v=c(m),g=o(e.format),y=o(e.type);_(t.TEXTURE_CUBE_MAP,e,v);for(var f=0;f<6;f++)if(h)for(var b,x=p[f].mipmaps,w=0,M=x.length;w<M;w++)b=x[w],e.format!==Bo&&e.format!==zo?n.getCompressedTextureFormats().indexOf(g)>-1?n.compressedTexImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+f,w,g,b.width,b.height,0,b.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+f,w,g,b.width,b.height,0,g,y,b.data);else u?n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+f,0,g,p[f].width,p[f].height,0,g,y,p[f].data):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+f,0,g,g,y,p[f]);e.generateMipmaps&&v&&t.generateMipmap(t.TEXTURE_CUBE_MAP),l.__version=e.version,e.onUpdate&&e.onUpdate(e)}else n.activeTexture(t.TEXTURE0+a),n.bindTexture(t.TEXTURE_CUBE_MAP,l.__image__webglTextureCube)}function y(e,r){n.activeTexture(t.TEXTURE0+r),n.bindTexture(t.TEXTURE_CUBE_MAP,i.get(e).__webglTexture)}function _(n,a,s){var c;if(s?(t.texParameteri(n,t.TEXTURE_WRAP_S,o(a.wrapS)),t.texParameteri(n,t.TEXTURE_WRAP_T,o(a.wrapT)),t.texParameteri(n,t.TEXTURE_MAG_FILTER,o(a.magFilter)),t.texParameteri(n,t.TEXTURE_MIN_FILTER,o(a.minFilter))):(t.texParameteri(n,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(n,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),a.wrapS===mo&&a.wrapT===mo||console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping.",a),t.texParameteri(n,t.TEXTURE_MAG_FILTER,u(a.magFilter)),t.texParameteri(n,t.TEXTURE_MIN_FILTER,u(a.minFilter)),a.minFilter!==yo&&a.minFilter!==xo&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.",a)),c=e.get("EXT_texture_filter_anisotropic")){if(a.type===Po&&null===e.get("OES_texture_float_linear"))return;if(a.type===Oo&&null===e.get("OES_texture_half_float_linear"))return;(a.anisotropy>1||i.get(a).__currentAnisotropy)&&(t.texParameterf(n,c.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(a.anisotropy,r.getMaxAnisotropy())),i.get(a).__currentAnisotropy=a.anisotropy)}}function b(e,i,a){void 0===e.__webglInit&&(e.__webglInit=!0,i.addEventListener("dispose",d),e.__webglTexture=t.createTexture(),A.textures++),n.activeTexture(t.TEXTURE0+a),n.bindTexture(t.TEXTURE_2D,e.__webglTexture),t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,i.flipY),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,i.premultiplyAlpha),t.pixelStorei(t.UNPACK_ALIGNMENT,i.unpackAlignment);var u=s(i.image,r.maxTextureSize);h(i)&&!1===c(u)&&(u=l(u));var p=c(u),f=o(i.format),m=o(i.type);_(t.TEXTURE_2D,i,p);var v,g=i.mipmaps;if(i.isDepthTexture){var y=t.DEPTH_COMPONENT;if(i.type===Po){if(!L)throw new Error("Float Depth Texture only supported in WebGL2.0");y=t.DEPTH_COMPONENT32F}else L&&(y=t.DEPTH_COMPONENT16);i.format===Go&&y===t.DEPTH_COMPONENT&&i.type!==Lo&&i.type!==Co&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),i.type=Lo,m=o(i.type)),i.format===Ho&&(y=t.DEPTH_STENCIL,i.type!==Do&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),i.type=Do,m=o(i.type))),n.texImage2D(t.TEXTURE_2D,0,y,u.width,u.height,0,f,m,null)}else if(i.isDataTexture)if(g.length>0&&p){for(var b=0,x=g.length;b<x;b++)v=g[b],n.texImage2D(t.TEXTURE_2D,b,f,v.width,v.height,0,f,m,v.data);i.generateMipmaps=!1}else n.texImage2D(t.TEXTURE_2D,0,f,u.width,u.height,0,f,m,u.data);else if(i.isCompressedTexture)for(var b=0,x=g.length;b<x;b++)v=g[b],i.format!==Bo&&i.format!==zo?n.getCompressedTextureFormats().indexOf(f)>-1?n.compressedTexImage2D(t.TEXTURE_2D,b,f,v.width,v.height,0,v.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):n.texImage2D(t.TEXTURE_2D,b,f,v.width,v.height,0,f,m,v.data);else if(g.length>0&&p){for(var b=0,x=g.length;b<x;b++)v=g[b],n.texImage2D(t.TEXTURE_2D,b,f,f,m,v);i.generateMipmaps=!1}else n.texImage2D(t.TEXTURE_2D,0,f,f,m,u);i.generateMipmaps&&p&&t.generateMipmap(t.TEXTURE_2D),e.__version=i.version,i.onUp
1date&&i.onUpdate(i)}function x(e,r,a,s){var c=o(r.texture.format),l=o(r.texture.type);n.texImage2D(s,0,c,r.width,r.height,0,c,l,null),t.bindFramebuffer(t.FRAMEBUFFER,e),t.framebufferTexture2D(t.FRAMEBUFFER,a,s,i.get(r.texture).__webglTexture,0),t.bindFramebuffer(t.FRAMEBUFFER,null)}function w(e,n){t.bindRenderbuffer(t.RENDERBUFFER,e),n.depthBuffer&&!n.stencilBuffer?(t.renderbufferStorage(t.RENDERBUFFER,t.DEPTH_COMPONENT16,n.width,n.height),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.DEPTH_ATTACHMENT,t.RENDERBUFFER,e)):n.depthBuffer&&n.stencilBuffer?(t.renderbufferStorage(t.RENDERBUFFER,t.DEPTH_STENCIL,n.width,n.height),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.DEPTH_STENCIL_ATTACHMENT,t.RENDERBUFFER,e)):t.renderbufferStorage(t.RENDERBUFFER,t.RGBA4,n.width,n.height),t.bindRenderbuffer(t.RENDERBUFFER,null)}function M(e,n){if(n&&n.isWebGLRenderTargetCube)throw new Error("Depth Texture with cube render targets is not supported!");if(t.bindFramebuffer(t.FRAMEBUFFER,e),!n.depthTexture||!n.depthTexture.isDepthTexture)throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");i.get(n.depthTexture).__webglTexture&&n.depthTexture.image.width===n.width&&n.depthTexture.image.height===n.height||(n.depthTexture.image.width=n.width,n.depthTexture.image.height=n.height,n.depthTexture.needsUpdate=!0),v(n.depthTexture,0);var r=i.get(n.depthTexture).__webglTexture;if(n.depthTexture.format===Go)t.framebufferTexture2D(t.FRAMEBUFFER,t.DEPTH_ATTACHMENT,t.TEXTURE_2D,r,0);else{if(n.depthTexture.format!==Ho)throw new Error("Unknown depthTexture format");t.framebufferTexture2D(t.FRAMEBUFFER,t.DEPTH_STENCIL_ATTACHMENT,t.TEXTURE_2D,r,0)}}function E(e){var n=i.get(e),r=!0===e.isWebGLRenderTargetCube;if(e.depthTexture){if(r)throw new Error("target.depthTexture not supported in Cube render targets");M(n.__webglFramebuffer,e)}else if(r){n.__webglDepthbuffer=[];for(var o=0;o<6;o++)t.bindFramebuffer(t.FRAMEBUFFER,n.__webglFramebuffer[o]),n.__webglDepthbuffer[o]=t.createRenderbuffer(),w(n.__webglDepthbuffer[o],e)}else t.bindFramebuffer(t.FRAMEBUFFER,n.__webglFramebuffer),n.__webglDepthbuffer=t.createRenderbuffer(),w(n.__webglDepthbuffer,e);t.bindFramebuffer(t.FRAMEBUFFER,null)}function T(e){var r=i.get(e),o=i.get(e.texture);e.addEventListener("dispose",p),o.__webglTexture=t.createTexture(),A.textures++;var a=!0===e.isWebGLRenderTargetCube,s=c(e);if(a){r.__webglFramebuffer=[];for(var l=0;l<6;l++)r.__webglFramebuffer[l]=t.createFramebuffer()}else r.__webglFramebuffer=t.createFramebuffer();if(a){n.bindTexture(t.TEXTURE_CUBE_MAP,o.__webglTexture),_(t.TEXTURE_CUBE_MAP,e.texture,s);for(var l=0;l<6;l++)x(r.__webglFramebuffer[l],e,t.COLOR_ATTACHMENT0,t.TEXTURE_CUBE_MAP_POSITIVE_X+l);e.texture.generateMipmaps&&s&&t.generateMipmap(t.TEXTURE_CUBE_MAP),n.bindTexture(t.TEXTURE_CUBE_MAP,null)}else n.bindTexture(t.TEXTURE_2D,o.__webglTexture),_(t.TEXTURE_2D,e.texture,s),x(r.__webglFramebuffer,e,t.COLOR_ATTACHMENT0,t.TEXTURE_2D),e.texture.generateMipmaps&&s&&t.generateMipmap(t.TEXTURE_2D),n.bindTexture(t.TEXTURE_2D,null);e.depthBuffer&&E(e)}function S(e){var r=e.texture;if(r.generateMipmaps&&c(e)&&r.minFilter!==yo&&r.minFilter!==xo){var o=e&&e.isWebGLRenderTargetCube?t.TEXTURE_CUBE_MAP:t.TEXTURE_2D,a=i.get(r).__webglTexture;n.bindTexture(o,a),t.generateMipmap(o),n.bindTexture(o,null)}}var A=a.memory,L="undefined"!==typeof WebGL2RenderingContext&&t instanceof WebGL2RenderingContext;this.setTexture2D=v,this.setTextureCube=g,this.setTextureCubeDynamic=y,this.setupRenderTarget=T,this.updateRenderTargetMipmap=S}function ne(){var t={};return{get:function(e){var n=e.uuid,i=t[n];return void 0===i&&(i={},t[n]=i),i},delete:function(e){delete t[e.uuid]},clear:function(){t={}}}}function ie(t,e,n){function i(){var e=!1,n=new a,i=null,r=new a;return{setMask:function(n){i===n||e||(t.colorMask(n,n,n,n),i=n)},setLocked:function(t){e=t},setClear:function(e,i,o,a,s){!0===s&&(e*=a,i*=a,o*=a),n.set(e,i,o,a),!1===r.equals(n)&&(t.clearColor(e,i,o,a),r.copy(n))},reset:function(){e=!1,i=null,r.set(0,0,0,1)}}}function r(){var e=!1,n=null,i=null,r=null;return{setTest:function(e){e?p(t.DEPTH_TEST):f(t.DEPTH_TEST)},setMask:function(i){n===i||e||(t.depthMask(i),n=i)},setFunc:function(e){if(i!==e){if(e)switch(e){case Hr:t.depthFunc(t.NEVER);break;case Vr:t.depthFunc(t.ALWAYS);break;case Wr:t.depthFunc(t.LESS);break;case Xr:t.depthFunc(t.LEQUAL);break;case qr:t.depthFunc(t.EQUAL);break;case Yr:t.depthFunc(t.GEQUAL);break;case Zr:t.depthFunc(t.GREATER);break;case Jr:t.depthFunc(t.NOTEQUAL);break;default:t.depthFunc(t.LEQUAL)}else t.depthFunc(t.LEQUAL);i=e}},setLocked:function(t){e=t},setClear:function(e){r!==e&&(t.clearDepth(e),r=e)},reset:function(){e=!1,n=null,i=null,r=null}}}function o(){var e=!1,n=null,i=null,r=null,o=null,a=null,s=null,c=null,l=null;return{setTest:function(e){e?p(t.STENCIL_TEST):f(t.STENCIL_TEST)},setMask:function(i){n===i||e||(t.stencilMask(i),n=i)},setFunc:function(e,n,a){i===e&&r===n&&o===a||(t.stencilFunc(e,n,a),i=e,r=n,o=a)},setOp:function(e,n,i){a===e&&s===n&&c===i||(t.stencilOp(e,n,i),a=e,s=n,c=i)},setLocked:function(t){e=t},setClear:function(e){l!==e&&(t.clearStencil(e),l=e)},reset:function(){e=!1,n=null,i=null,r=null,o=null,a=null,s=null,c=null,l=null}}}
1function s(e,n,i){var r=new Uint8Array(4),o=t.createTexture();t.bindTexture(e,o),t.texParameteri(e,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(e,t.TEXTURE_MAG_FILTER,t.NEAREST);for(var a=0;a<i;a++)t.texImage2D(n+a,0,t.RGBA,1,1,0,t.RGBA,t.UNSIGNED_BYTE,r);return o}function c(){z.setClear(0,0,0,1),B.setClear(1),k.setClear(0),p(t.DEPTH_TEST),b(Xr),T(!1),S(sr),p(t.CULL_FACE),p(t.BLEND),v(xr)}function l(){for(var t=0,e=G.length;t<e;t++)G[t]=0}function h(n){if(G[n]=1,0===H[n]&&(t.enableVertexAttribArray(n),H[n]=1),0!==V[n]){e.get("ANGLE_instanced_arrays").vertexAttribDivisorANGLE(n,0),V[n]=0}}function u(e,n,i){G[e]=1,0===H[e]&&(t.enableVertexAttribArray(e),H[e]=1),V[e]!==n&&(i.vertexAttribDivisorANGLE(e,n),V[e]=n)}function d(){for(var e=0,n=H.length;e!==n;++e)H[e]!==G[e]&&(t.disableVertexAttribArray(e),H[e]=0)}function p(e){!0!==W[e]&&(t.enable(e),W[e]=!0)}function f(e){!1!==W[e]&&(t.disable(e),W[e]=!1)}function m(){if(null===X&&(X=[],e.get("WEBGL_compressed_texture_pvrtc")||e.get("WEBGL_compressed_texture_s3tc")||e.get("WEBGL_compressed_texture_etc1")))for(var n=t.getParameter(t.COMPRESSED_TEXTURE_FORMATS),i=0;i<n.length;i++)X.push(n[i]);return X}function v(e,i,r,o,a,s,c,l){e!==br?p(t.BLEND):f(t.BLEND),e===q&&l===tt||(e===wr?l?(t.blendEquationSeparate(t.FUNC_ADD,t.FUNC_ADD),t.blendFuncSeparate(t.ONE,t.ONE,t.ONE,t.ONE)):(t.blendEquation(t.FUNC_ADD),t.blendFunc(t.SRC_ALPHA,t.ONE)):e===Mr?l?(t.blendEquationSeparate(t.FUNC_ADD,t.FUNC_ADD),t.blendFuncSeparate(t.ZERO,t.ZERO,t.ONE_MINUS_SRC_COLOR,t.ONE_MINUS_SRC_ALPHA)):(t.blendEquation(t.FUNC_ADD),t.blendFunc(t.ZERO,t.ONE_MINUS_SRC_COLOR)):e===Er?l?(t.blendEquationSeparate(t.FUNC_ADD,t.FUNC_ADD),t.blendFuncSeparate(t.ZERO,t.SRC_COLOR,t.ZERO,t.SRC_ALPHA)):(t.blendEquation(t.FUNC_ADD),t.blendFunc(t.ZERO,t.SRC_COLOR)):l?(t.blendEquationSeparate(t.FUNC_ADD,t.FUNC_ADD),t.blendFuncSeparate(t.ONE,t.ONE_MINUS_SRC_ALPHA,t.ONE,t.ONE_MINUS_SRC_ALPHA)):(t.blendEquationSeparate(t.FUNC_ADD,t.FUNC_ADD),t.blendFuncSeparate(t.SRC_ALPHA,t.ONE_MINUS_SRC_ALPHA,t.ONE,t.ONE_MINUS_SRC_ALPHA)),q=e,tt=l),e===Tr?(a=a||i,s=s||r,c=c||o,i===Y&&a===Q||(t.blendEquationSeparate(n(i),n(a)),Y=i,Q=a),r===Z&&o===J&&s===K&&c===$||(t.blendFuncSeparate(n(r),n(o),n(s),n(c)),Z=r,J=o,K=s,$=c)):(Y=null,Z=null,J=null,Q=null,K=null,$=null)}function g(t){z.setMask(t)}function y(t){B.setTest(t)}function _(t){B.setMask(t)}function b(t){B.setFunc(t)}function x(t){k.setTest(t)}function w(t){k.setMask(t)}function M(t,e,n){k.setFunc(t,e,n)}function E(t,e,n){k.setOp(t,e,n)}function T(e){et!==e&&(e?t.frontFace(t.CW):t.frontFace(t.CCW),et=e)}function S(e){e!==ar?(p(t.CULL_FACE),e!==nt&&(e===sr?t.cullFace(t.BACK):e===cr?t.cullFace(t.FRONT):t.cullFace(t.FRONT_AND_BACK))):f(t.CULL_FACE),nt=e}function A(e){e!==it&&(lt&&t.lineWidth(e),it=e)}function L(e,n,i){e?(p(t.POLYGON_OFFSET_FILL),rt===n&&ot===i||(t.polygonOffset(n,i),rt=n,ot=i)):f(t.POLYGON_OFFSET_FILL)}function R(){return at}function C(e){at=e,e?p(t.SCISSOR_TEST):f(t.SCISSOR_TEST)}function P(e){void 0===e&&(e=t.TEXTURE0+st-1),ht!==e&&(t.activeTexture(e),ht=e)}function O(e,n){null===ht&&P();var i=ut[ht];void 0===i&&(i={type:void 0,texture:void 0},ut[ht]=i),i.type===e&&i.texture===n||(t.bindTexture(e,n||ft[e]),i.type=e,i.texture=n)}function I(){try{t.compressedTexImage2D.apply(t,arguments)}catch(t){console.error(t)}}function U(){try{t.texImage2D.apply(t,arguments)}catch(t){console.error(t)}}function N(e){!1===dt.equals(e)&&(t.scissor(e.x,e.y,e.z,e.w),dt.copy(e))}function D(e){!1===pt.equals(e)&&(t.viewport(e.x,e.y,e.z,e.w),pt.copy(e))}function F(){for(var e=0;e<H.length;e++)1===H[e]&&(t.disableVertexAttribArray(e),H[e]=0);W={},X=null,ht=null,ut={},q=null,et=null,nt=null,z.reset(),B.reset(),k.reset()}var z=new i,B=new r,k=new o,j=t.getParameter(t.MAX_VERTEX_ATTRIBS),G=new Uint8Array(j),H=new Uint8Array(j),V=new Uint8Array(j),W={},X=null,q=null,Y=null,Z=null,J=null,Q=null,K=null,$=null,tt=!1,et=null,nt=null,it=null,rt=null,ot=null,at=null,st=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS),ct=parseFloat(/^WebGL\ ([0-9])/.exec(t.getParameter(t.VERSION))[1]),lt=parseFloat(ct)>=1,ht=null,ut={},dt=new a,pt=new a,ft={};return ft[t.TEXTURE_2D]=s(t.TEXTURE_2D,t.TEXTURE_2D,1),ft[t.TEXTURE_CUBE_MAP]=s(t.TEXTURE_CUBE_MAP,t.TEXTURE_CUBE_MAP_POSITIVE_X,6),{buffers:{color:z,depth:B,stencil:k},init:c,initAttributes:l,enableAttribute:h,enableAttributeAndDivisor:u,disableUnusedAttributes:d,enable:p,disable:f,getCompressedTextureFormats:m,setBlending:v,setColorWrite:g,setDepthTest:y,setDepthWrite:_,setDepthFunc:b,setStencilTest:x,setStencilWrite:w,setStencilFunc:M,setStencilOp:E,setFlipSided:T,setCullFace:S,setLineWidth:A,setPolygonOffset:L,get
1ScissorTest:R,setScissorTest:C,activeTexture:P,bindTexture:O,compressedTexImage2D:I,texImage2D:U,scissor:N,viewport:D,reset:F}}function re(t,e,n){function i(){if(void 0!==o)return o;var n=e.get("EXT_texture_filter_anisotropic");return o=null!==n?t.getParameter(n.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0}function r(e){if("highp"===e){if(t.getShaderPrecisionFormat(t.VERTEX_SHADER,t.HIGH_FLOAT).precision>0&&t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.HIGH_FLOAT).precision>0)return"highp";e="mediump"}return"mediump"===e&&t.getShaderPrecisionFormat(t.VERTEX_SHADER,t.MEDIUM_FLOAT).precision>0&&t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}var o,a=void 0!==n.precision?n.precision:"highp",s=r(a);s!==a&&(console.warn("THREE.WebGLRenderer:",a,"not supported, using",s,"instead."),a=s);var c=!0===n.logarithmicDepthBuffer&&!!e.get("EXT_frag_depth"),l=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS),h=t.getParameter(t.MAX_VERTEX_TEXTURE_IMAGE_UNITS),u=t.getParameter(t.MAX_TEXTURE_SIZE),d=t.getParameter(t.MAX_CUBE_MAP_TEXTURE_SIZE),p=t.getParameter(t.MAX_VERTEX_ATTRIBS),f=t.getParameter(t.MAX_VERTEX_UNIFORM_VECTORS),m=t.getParameter(t.MAX_VARYING_VECTORS),v=t.getParameter(t.MAX_FRAGMENT_UNIFORM_VECTORS),g=h>0,y=!!e.get("OES_texture_float");return{getMaxAnisotropy:i,getMaxPrecision:r,precision:a,logarithmicDepthBuffer:c,maxTextures:l,maxVertexTextures:h,maxTextureSize:u,maxCubemapSize:d,maxAttributes:p,maxVertexUniforms:f,maxVaryings:m,maxFragmentUniforms:v,vertexTextures:g,floatFragmentTextures:y,floatVertexTextures:g&&y}}function oe(t){var e={};return{get:function(n){if(void 0!==e[n])return e[n];var i;switch(n){case"WEBGL_depth_texture":i=t.getExtension("WEBGL_depth_texture")||t.getExtension("MOZ_WEBGL_depth_texture")||t.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":i=t.getExtension("EXT_texture_filter_anisotropic")||t.getExtension("MOZ_EXT_texture_filter_anisotropic")||t.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":i=t.getExtension("WEBGL_compressed_texture_s3tc")||t.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":i=t.getExtension("WEBGL_compressed_texture_pvrtc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;case"WEBGL_compressed_texture_etc1":i=t.getExtension("WEBGL_compressed_texture_etc1");break;default:i=t.getExtension(n)}return null===i&&console.warn("THREE.WebGLRenderer: "+n+" extension not supported."),e[n]=i,i}}}function ae(){function t(){l.value!==i&&(l.value=i,l.needsUpdate=r>0),n.numPlanes=r,n.numIntersection=0}function e(t,e,i,r){var o=null!==t?t.length:0,a=null;if(0!==o){if(a=l.value,!0!==r||null===a){var h=i+4*o,u=e.matrixWorldInverse;c.getNormalMatrix(u),(null===a||a.length<h)&&(a=new Float32Array(h));for(var d=0,p=i;d!==o;++d,p+=4)s.copy(t[d]).applyMatrix4(u,c),s.normal.toArray(a,p),a[p+3]=s.constant}l.value=a,l.needsUpdate=!0}return n.numPlanes=o,a}var n=this,i=null,r=0,o=!1,a=!1,s=new rt,c=new it,l={value:null,needsUpdate:!1};this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(t,n,a){var s=0!==t.length||n||0!==r||o;return o=n,i=e(t,a,0),r=t.length,s},this.beginShadows=function(){a=!0,e(null)},this.endShadows=function(){a=!1,t()},this.setState=function(n,s,c,h,u,d){if(!o||null===n||0===n.length||a&&!c)a?e(null):t();else{var p=a?0:r,f=4*p,m=u.clippingState||null;l.value=m,m=e(n,h,f,d);for(var v=0;v!==f;++v)m[v]=i[v];u.clippingState=m,this.numIntersection=s?this.numPlanes:0,this.numPlanes+=p}}}function se(t){function e(){return null===dt?St:1}function n(){ce.init(),ce.scissor(yt.copy(At).multiplyScalar(St)),ce.viewport(bt.copy(zt).multiplyScalar(St)),ce.buffers.color.setClear(wt.r,wt.g,wt.b,Mt,Y)}function i(){ut=null,gt=null,vt="",mt=-1,ce.reset()}function r(t){t.preventDefault(),i(),n(),le.clear()}function o(t){var e=t.target;e.removeEventListener("dispose",o),s(e)}function s(t){c(t),le.delete(t)}function c(t){var e=le.get(t).program;t.program=void 0,void 0!==e&&de.releaseProgram(e)}function l(t,e,n,i){var r;if(n&&n.isInstancedBufferGeometry&&null===(r=$t.get("ANGLE_instanced_arrays")))return void console.error("THREE.WebGLRenderer.setupVertexAttributes: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_
1instanced_arrays.");void 0===i&&(i=0),ce.initAttributes();var o=n.attributes,a=e.getAttributes(),s=t.defaultAttributeValues;for(var c in a){var l=a[c];if(l>=0){var h=o[c];if(void 0!==h){var u=h.normalized,d=h.itemSize,p=ue.getAttributeProperties(h),f=p.__webglBuffer,m=p.type,v=p.bytesPerElement;if(h.isInterleavedBufferAttribute){var g=h.data,y=g.stride,_=h.offset;g&&g.isInstancedInterleavedBuffer?(ce.enableAttributeAndDivisor(l,g.meshPerAttribute,r),void 0===n.maxInstancedCount&&(n.maxInstancedCount=g.meshPerAttribute*g.count)):ce.enableAttribute(l),Jt.bindBuffer(Jt.ARRAY_BUFFER,f),Jt.vertexAttribPointer(l,d,m,u,y*v,(i*y+_)*v)}else h.isInstancedBufferAttribute?(ce.enableAttributeAndDivisor(l,h.meshPerAttribute,r),void 0===n.maxInstancedCount&&(n.maxInstancedCount=h.meshPerAttribute*h.count)):ce.enableAttribute(l),Jt.bindBuffer(Jt.ARRAY_BUFFER,f),Jt.vertexAttribPointer(l,d,m,u,0,i*d*v)}else if(void 0!==s){var b=s[c];if(void 0!==b)switch(b.length){case 2:Jt.vertexAttrib2fv(l,b);break;case 3:Jt.vertexAttrib3fv(l,b);break;case 4:Jt.vertexAttrib4fv(l,b);break;default:Jt.vertexAttrib1fv(l,b)}}}}ce.disableUnusedAttributes()}function d(t,e){return Math.abs(e[0])-Math.abs(t[0])}function p(t,e){return t.object.renderOrder!==e.object.renderOrder?t.object.renderOrder-e.object.renderOrder:t.material.program&&e.material.program&&t.material.program!==e.material.program?t.material.program.id-e.material.program.id:t.material.id!==e.material.id?t.material.id-e.material.id:t.z!==e.z?t.z-e.z:t.id-e.id}function f(t,e){return t.object.renderOrder!==e.object.renderOrder?t.object.renderOrder-e.object.renderOrder:t.z!==e.z?e.z-t.z:t.id-e.id}function m(t,e,n,i,r){var o,a;n.transparent?(o=it,a=++rt):(o=tt,a=++et);var s=o[a];void 0!==s?(s.id=t.id,s.object=t,s.geometry=e,s.material=n,s.z=Wt.z,s.group=r):(s={id:t.id,object:t,geometry:e,material:n,z:Wt.z,group:r},o.push(s))}function v(t){var e=t.geometry;return null===e.boundingSphere&&e.computeBoundingSphere(),Ht.copy(e.boundingSphere).applyMatrix4(t.matrixWorld),y(Ht)}function g(t){return Ht.center.set(0,0,0),Ht.radius=.7071067811865476,Ht.applyMatrix4(t.matrixWorld),y(Ht)}function y(t){if(!Bt.intersectsSphere(t))return!1;var e=kt.numPlanes;if(0===e)return!0;var n=ht.clippingPlanes,i=t.center,r=-t.radius,o=0;do{if(n[o].distanceToPoint(i)<r)return!1}while(++o!==e);return!0}function _(t,e){if(!1!==t.visible){if(0!==(t.layers.mask&e.layers.mask))if(t.isLight)K.push(t);else if(t.isSprite)!1!==t.frustumCulled&&!0!==g(t)||ct.push(t);else if(t.isLensFlare)lt.push(t);else if(t.isImmediateRenderObject)!0===ht.sortObjects&&(Wt.setFromMatrixPosition(t.matrixWorld),Wt.applyProjection(Vt)),m(t,null,t.material,Wt.z,null);else if((t.isMesh||t.isLine||t.isPoints)&&(t.isSkinnedMesh&&t.skeleton.update(),!1===t.frustumCulled||!0===v(t))){var n=t.material;if(!0===n.visible){!0===ht.sortObjects&&(Wt.setFromMatrixPosition(t.matrixWorld),Wt.applyProjection(Vt));var i=ue.update(t);if(n.isMultiMaterial)for(var r=i.groups,o=n.materials,a=0,s=r.length;a<s;a++){var c=r[a],l=o[c.materialIndex];!0===l.visible&&m(t,i,l,Wt.z,c)}else m(t,i,n,Wt.z,null)}}for(var h=t.children,a=0,s=h.length;a<s;a++)_(h[a],e)}}function b(t,e,n,i){for(var r=0,o=t.length;r<o;r++){var a=t[r],s=a.object,c=a.geometry,l=void 0===i?a.material:i,h=a.group;if(s.modelViewMatrix.multiplyMatrices(n.matrixWorldInverse,s.matrixWorld),s.normalMatrix.getNormalMatrix(s.modelViewMatrix),s.onBeforeRender(ht,e,n,c,l,h),s.isImmediateRenderObject){w(l);var u=M(n,e.fog,l,s);vt="",s.render(function(t){ht.renderBufferImmediate(t,u,l)})}else ht.renderBufferDirect(n,e.fog,c,l,s,h);s.onAfterRender(ht,e,n,c,l,h)}}function x(t,e,n){var i=le.get(t),r=de.getParameters(t,Yt,e,kt.numPlanes,kt.numIntersection,n),a=de.getProgramCode(t,r),s=i.program,l=!0;if(void 0===s)t.addEventListener("dispose",o);else if(s.code!==a)c(t);else{if(void 0!==r.shaderID)return;l=!1}if(l){if(r.shaderID){var h=Ea[r.shaderID];i.__webglShader={name:t.type,uniforms:ba.clone(h.uniforms),vertexShader:h.vertexShader,fragmentShader:h.fragmentShader}}else i.__webglShader={name:t.type,uniforms:t.uniforms,vertexShader:t.vertexShader,fragmentShader:t.fragmentShader};t.__webglShader=i.__webglShader,s=de.acquireProgram(t,r,a),i.program=s,t.program=s}var u=s.getAttributes();if(t.morphTargets){t.numSupportedMorphTargets=0;for(var d=0;
1d<ht.maxMorphTargets;d++)u["morphTarget"+d]>=0&&t.numSupportedMorphTargets++}if(t.morphNormals){t.numSupportedMorphNormals=0;for(var d=0;d<ht.maxMorphNormals;d++)u["morphNormal"+d]>=0&&t.numSupportedMorphNormals++}var p=i.__webglShader.uniforms;(t.isShaderMaterial||t.isRawShaderMaterial)&&!0!==t.clipping||(i.numClippingPlanes=kt.numPlanes,i.numIntersection=kt.numIntersection,p.clippingPlanes=kt.uniform),i.fog=e,i.lightsHash=Yt.hash,t.lights&&(p.ambientLightColor.value=Yt.ambient,p.directionalLights.value=Yt.directional,p.spotLights.value=Yt.spot,p.rectAreaLights.value=Yt.rectArea,p.pointLights.value=Yt.point,p.hemisphereLights.value=Yt.hemi,p.directionalShadowMap.value=Yt.directionalShadowMap,p.directionalShadowMatrix.value=Yt.directionalShadowMatrix,p.spotShadowMap.value=Yt.spotShadowMap,p.spotShadowMatrix.value=Yt.spotShadowMatrix,p.pointShadowMap.value=Yt.pointShadowMap,p.pointShadowMatrix.value=Yt.pointShadowMatrix);var f=i.program.getUniforms(),m=X.seqWithValue(f.seq,p);i.uniformsList=m}function w(t){t.side===fr?ce.disable(Jt.CULL_FACE):ce.enable(Jt.CULL_FACE),ce.setFlipSided(t.side===pr),!0===t.transparent?ce.setBlending(t.blending,t.blendEquation,t.blendSrc,t.blendDst,t.blendEquationAlpha,t.blendSrcAlpha,t.blendDstAlpha,t.premultipliedAlpha):ce.setBlending(br),ce.setDepthFunc(t.depthFunc),ce.setDepthTest(t.depthTest),ce.setDepthWrite(t.depthWrite),ce.setColorWrite(t.colorWrite),ce.setPolygonOffset(t.polygonOffset,t.polygonOffsetFactor,t.polygonOffsetUnits)}function M(t,e,n,i){xt=0;var r=le.get(n);if(jt&&(Gt||t!==gt)){var o=t===gt&&n.id===mt;kt.setState(n.clippingPlanes,n.clipIntersection,n.clipShadows,t,r,o)}!1===n.needsUpdate&&(void 0===r.program?n.needsUpdate=!0:n.fog&&r.fog!==e?n.needsUpdate=!0:n.lights&&r.lightsHash!==Yt.hash?n.needsUpdate=!0:void 0===r.numClippingPlanes||r.numClippingPlanes===kt.numPlanes&&r.numIntersection===kt.numIntersection||(n.needsUpdate=!0)),n.needsUpdate&&(x(n,e,i),n.needsUpdate=!1);var a=!1,s=!1,c=!1,l=r.program,h=l.getUniforms(),u=r.__webglShader.uniforms;if(l.id!==ut&&(Jt.useProgram(l.program),ut=l.id,a=!0,s=!0,c=!0),n.id!==mt&&(mt=n.id,s=!0),a||t!==gt){if(h.set(Jt,t,"projectionMatrix"),se.logarithmicDepthBuffer&&h.setValue(Jt,"logDepthBufFC",2/(Math.log(t.far+1)/Math.LN2)),t!==gt&&(gt=t,s=!0,c=!0),n.isShaderMaterial||n.isMeshPhongMaterial||n.isMeshStandardMaterial||n.envMap){var d=h.map.cameraPosition;void 0!==d&&d.setValue(Jt,Wt.setFromMatrixPosition(t.matrixWorld))}(n.isMeshPhongMaterial||n.isMeshLambertMaterial||n.isMeshBasicMaterial||n.isMeshStandardMaterial||n.isShaderMaterial||n.skinning)&&h.setValue(Jt,"viewMatrix",t.matrixWorldInverse),h.set(Jt,ht,"toneMappingExposure"),h.set(Jt,ht,"toneMappingWhitePoint")}if(n.skinning){h.setOptional(Jt,i,"bindMatrix"),h.setOptional(Jt,i,"bindMatrixInverse");var p=i.skeleton;p&&(se.floatVertexTextures&&p.useVertexTexture?(h.set(Jt,p,"boneTexture"),h.set(Jt,p,"boneTextureWidth"),h.set(Jt,p,"boneTextureHeight")):h.setOptional(Jt,p,"boneMatrices"))}return s&&(n.lights&&N(u,c),e&&n.fog&&L(u,e),(n.isMeshBasicMaterial||n.isMeshLambertMaterial||n.isMeshPhongMaterial||n.isMeshStandardMaterial||n.isMeshNormalMaterial||n.isMeshDepthMaterial)&&E(u,n),n.isLineBasicMaterial?T(u,n):n.isLineDashedMaterial?(T(u,n),S(u,n)):n.isPointsMaterial?A(u,n):n.isMeshLambertMaterial?R(u,n):n.isMeshToonMaterial?P(u,n):n.isMeshPhongMaterial?C(u,n):n.isMeshPhysicalMaterial?I(u,n):n.isMeshStandardMaterial?O(u,n):n.isMeshDepthMaterial?n.displacementMap&&(u.displacementMap.value=n.displacementMap,u.displacementScale.value=n.displacementScale,u.displacementBias.value=n.displacementBias):n.isMeshNormalMaterial&&U(u,n),void 0!==u.ltcMat&&(u.ltcMat.value=THREE.UniformsLib.LTC_MAT_TEXTURE),void 0!==u.ltcMag&&(u.ltcMag.value=THREE.UniformsLib.LTC_MAG_TEXTURE),X.upload(Jt,r.uniformsList,u,ht)),h.set(Jt,i,"modelViewMatrix"),h.set(Jt,i,"normalMatrix"),h.setValue(Jt,"modelMatrix",i.matrixWorld),l}function E(t,e){t.opacity.value=e.opacity,t.diffuse.value=e.color,e.emissive&&t.emissive.value.copy(e.emissive).multiplyScalar(e.emissiveIntensity),t.map.value=e.map,t.specularMap.value=e.specularMap,t.alphaMap.value=e.alphaMap,e.lightMap&&(t.lightMap.value=e.lightMap,t.lightMapIntensity.value=e.lightMapIntensity),e.aoMap&&(t.aoMap.value=e.aoMap,t.aoMapIntensity.value=e.aoMapIntensity);var n;if(e.map?n=e.map:e.specularMap?n=e.specularMap:e.displacementMap?n=e.displacementMap:e.normalMap?n=e.normalMap:e.bumpMap?n=e.bumpMap:e.roughnessMap?n=e.roughnessMap:e.metalnessMap?n=e.metalnessMap:e.alphaMap?n=e.alphaMap:e.emissiveMap&&(n=e.emissiveMap),void 0!==n){n.isWebGLRenderTarget&&(n=n.texture);var i=n.offset,r=n.repeat;t.offsetRepeat.value.set(i.x,i.y,r.x,r.y)}t.envMap.value=e.envMap,t.flipEnvMap.value=e.envMap&&e.envMap.isCubeTexture?-1:1,t.reflectivity.value=e.reflectivity,t.refractionRatio.value=e.refractionRatio}function T(t,e){t.diffuse.value=e.color,t.opacity.value=e.opacity}function S(t,e){t.dashSize.value=e.dashSize,t.totalSize.value=e.dashSize
1+e.gapSize,t.scale.value=e.scale}function A(t,e){if(t.diffuse.value=e.color,t.opacity.value=e.opacity,t.size.value=e.size*St,t.scale.value=.5*Tt,t.map.value=e.map,null!==e.map){var n=e.map.offset,i=e.map.repeat;t.offsetRepeat.value.set(n.x,n.y,i.x,i.y)}}function L(t,e){t.fogColor.value=e.color,e.isFog?(t.fogNear.value=e.near,t.fogFar.value=e.far):e.isFogExp2&&(t.fogDensity.value=e.density)}function R(t,e){e.emissiveMap&&(t.emissiveMap.value=e.emissiveMap)}function C(t,e){t.specular.value=e.specular,t.shininess.value=Math.max(e.shininess,1e-4),e.emissiveMap&&(t.emissiveMap.value=e.emissiveMap),e.bumpMap&&(t.bumpMap.value=e.bumpMap,t.bumpScale.value=e.bumpScale),e.normalMap&&(t.normalMap.value=e.normalMap,t.normalScale.value.copy(e.normalScale)),e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias)}function P(t,e){C(t,e),e.gradientMap&&(t.gradientMap.value=e.gradientMap)}function O(t,e){t.roughness.value=e.roughness,t.metalness.value=e.metalness,e.roughnessMap&&(t.roughnessMap.value=e.roughnessMap),e.metalnessMap&&(t.metalnessMap.value=e.metalnessMap),e.emissiveMap&&(t.emissiveMap.value=e.emissiveMap),e.bumpMap&&(t.bumpMap.value=e.bumpMap,t.bumpScale.value=e.bumpScale),e.normalMap&&(t.normalMap.value=e.normalMap,t.normalScale.value.copy(e.normalScale)),e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias),e.envMap&&(t.envMapIntensity.value=e.envMapIntensity)}function I(t,e){t.clearCoat.value=e.clearCoat,t.clearCoatRoughness.value=e.clearCoatRoughness,O(t,e)}function U(t,e){e.bumpMap&&(t.bumpMap.value=e.bumpMap,t.bumpScale.value=e.bumpScale),e.normalMap&&(t.normalMap.value=e.normalMap,t.normalScale.value.copy(e.normalScale)),e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias)}function N(t,e){t.ambientLightColor.needsUpdate=e,t.directionalLights.needsUpdate=e,t.pointLights.needsUpdate=e,t.spotLights.needsUpdate=e,t.rectAreaLights.needsUpdate=e,t.hemisphereLights.needsUpdate=e}function D(t){for(var e=0,n=0,i=t.length;n<i;n++){var r=t[n];r.castShadow&&(Yt.shadows[e++]=r)}Yt.shadows.length=e}function F(t,e){var n,i,r,o,a,s,c,l=0,h=0,d=0,p=e.matrixWorldInverse,f=0,m=0,v=0,g=0,y=0;for(n=0,i=t.length;n<i;n++)if(r=t[n],o=r.color,a=r.intensity,s=r.distance,c=r.shadow&&r.shadow.map?r.shadow.map.texture:null,r.isAmbientLight)l+=o.r*a,h+=o.g*a,d+=o.b*a;else if(r.isDirectionalLight){var _=pe.get(r);_.color.copy(r.color).multiplyScalar(r.intensity),_.direction.setFromMatrixPosition(r.matrixWorld),Wt.setFromMatrixPosition(r.target.matrixWorld),_.direction.sub(Wt),_.direction.transformDirection(p),_.shadow=r.castShadow,r.castShadow&&(_.shadowBias=r.shadow.bias,_.shadowRadius=r.shadow.radius,_.shadowMapSize=r.shadow.mapSize),Yt.directionalShadowMap[f]=c,Yt.directionalShadowMatrix[f]=r.shadow.matrix,Yt.directional[f++]=_}else if(r.isSpotLight){var _=pe.get(r);_.position.setFromMatrixPosition(r.matrixWorld),_.position.applyMatrix4(p),_.color.copy(o).multiplyScalar(a),_.distance=s,_.direction.setFromMatrixPosition(r.matrixWorld),Wt.setFromMatrixPosition(r.target.matrixWorld),_.direction.sub(Wt),_.direction.transformDirection(p),_.coneCos=Math.cos(r.angle),_.penumbraCos=Math.cos(r.angle*(1-r.penumbra)),_.decay=0===r.distance?0:r.decay,_.shadow=r.castShadow,r.castShadow&&(_.shadowBias=r.shadow.bias,_.shadowRadius=r.shadow.radius,_.shadowMapSize=r.shadow.mapSize),Yt.spotShadowMap[v]=c,Yt.spotShadowMatrix[v]=r.shadow.matrix,Yt.spot[v++]=_}else if(r.isRectAreaLight){var _=pe.get(r);_.color.copy(o).multiplyScalar(a/(r.width*r.height)),_.position.setFromMatrixPosition(r.matrixWorld),_.position.applyMatrix4(p),qt.identity(),Xt.copy(r.matrixWorld),Xt.premultiply(
1p),qt.extractRotation(Xt),_.halfWidth.set(.5*r.width,0,0),_.halfHeight.set(0,.5*r.height,0),_.halfWidth.applyMatrix4(qt),_.halfHeight.applyMatrix4(qt),Yt.rectArea[g++]=_}else if(r.isPointLight){var _=pe.get(r);_.position.setFromMatrixPosition(r.matrixWorld),_.position.applyMatrix4(p),_.color.copy(r.color).multiplyScalar(r.intensity),_.distance=r.distance,_.decay=0===r.distance?0:r.decay,_.shadow=r.castShadow,r.castShadow&&(_.shadowBias=r.shadow.bias,_.shadowRadius=r.shadow.radius,_.shadowMapSize=r.shadow.mapSize),Yt.pointShadowMap[m]=c,void 0===Yt.pointShadowMatrix[m]&&(Yt.pointShadowMatrix[m]=new u),Wt.setFromMatrixPosition(r.matrixWorld).negate(),Yt.pointShadowMatrix[m].identity().setPosition(Wt),Yt.point[m++]=_}else if(r.isHemisphereLight){var _=pe.get(r);_.direction.setFromMatrixPosition(r.matrixWorld),_.direction.transformDirection(p),_.direction.normalize(),_.skyColor.copy(r.color).multiplyScalar(a),_.groundColor.copy(r.groundColor).multiplyScalar(a),Yt.hemi[y++]=_}Yt.ambient[0]=l,Yt.ambient[1]=h,Yt.ambient[2]=d,Yt.directional.length=f,Yt.spot.length=v,Yt.rectArea.length=g,Yt.point.length=m,Yt.hemi.length=y,Yt.hash=f+","+m+","+v+","+g+","+y+","+Yt.shadows.length}function z(){var t=xt;return t>=se.maxTextures&&console.warn("WebGLRenderer: trying to use "+t+" texture units while this GPU supports only "+se.maxTextures),xt+=1,t}function B(t){var e;if(t===fo)return Jt.REPEAT;if(t===mo)return Jt.CLAMP_TO_EDGE;if(t===vo)return Jt.MIRRORED_REPEAT;if(t===yo)return Jt.NEAREST;if(t===_o)return Jt.NEAREST_MIPMAP_NEAREST;if(t===bo)return Jt.NEAREST_MIPMAP_LINEAR;if(t===xo)return Jt.LINEAR;if(t===wo)return Jt.LINEAR_MIPMAP_NEAREST;if(t===Mo)return Jt.LINEAR_MIPMAP_LINEAR;if(t===To)return Jt.UNSIGNED_BYTE;if(t===Io)return Jt.UNSIGNED_SHORT_4_4_4_4;if(t===Uo)return Jt.UNSIGNED_SHORT_5_5_5_1;if(t===No)return Jt.UNSIGNED_SHORT_5_6_5;if(t===So)return Jt.BYTE;if(t===Ao)return Jt.SHORT;if(t===Lo)return Jt.UNSIGNED_SHORT;if(t===Ro)return Jt.INT;if(t===Co)return Jt.UNSIGNED_INT;if(t===Po)return Jt.FLOAT;if(t===Oo&&null!==(e=$t.get("OES_texture_half_float")))return e.HALF_FLOAT_OES;if(t===Fo)return Jt.ALPHA;if(t===zo)return Jt.RGB;if(t===Bo)return Jt.RGBA;if(t===ko)return Jt.LUMINANCE;if(t===jo)return Jt.LUMINANCE_ALPHA;if(t===Go)return Jt.DEPTH_COMPONENT;if(t===Ho)return Jt.DEPTH_STENCIL;if(t===Ar)return Jt.FUNC_ADD;if(t===Lr)return Jt.FUNC_SUBTRACT;if(t===Rr)return Jt.FUNC_REVERSE_SUBTRACT;if(t===Or)return Jt.ZERO;if(t===Ir)return Jt.ONE;if(t===Ur)return Jt.SRC_COLOR;if(t===Nr)return Jt.ONE_MINUS_SRC_COLOR;if(t===Dr)return Jt.SRC_ALPHA;if(t===Fr)return Jt.ONE_MINUS_SRC_ALPHA;if(t===zr)return Jt.DST_ALPHA;if(t===Br)return Jt.ONE_MINUS_DST_ALPHA;if(t===kr)return Jt.DST_COLOR;if(t===jr)return Jt.ONE_MINUS_DST_COLOR;if(t===Gr)return Jt.SRC_ALPHA_SATURATE;if((t===Vo||t===Wo||t===Xo||t===qo)&&null!==(e=$t.get("WEBGL_compressed_texture_s3tc"))){if(t===Vo)return e.COMPRESSED_RGB_S3TC_DXT1_EXT;if(t===Wo)return e.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(t===Xo)return e.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(t===qo)return e.COMPRESSED_RGBA_S3TC_DXT5_EXT}if((t===Yo||t===Zo||t===Jo||t===Qo)&&null!==(e=$t.get("WEBGL_compressed_texture_pvrtc"))){if
1(t===Yo)return e.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(t===Zo)return e.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(t===Jo)return e.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(t===Qo)return e.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(t===Ko&&null!==(e=$t.get("WEBGL_compressed_texture_etc1")))return e.COMPRESSED_RGB_ETC1_WEBGL;if((t===Cr||t===Pr)&&null!==(e=$t.get("EXT_blend_minmax"))){if(t===Cr)return e.MIN_EXT;if(t===Pr)return e.MAX_EXT}return t===Do&&null!==(e=$t.get("WEBGL_depth_texture"))?e.UNSIGNED_INT_24_8_WEBGL:0}console.log("THREE.WebGLRenderer",or),t=t||{};var k=void 0!==t.canvas?t.canvas:document.createElementNS("http://www.w3.org/1999/xhtml","canvas"),j=void 0!==t.context?t.context:null,G=void 0!==t.alpha&&t.alpha,H=void 0===t.depth||t.depth,V=void 0===t.stencil||t.stencil,W=void 0!==t.antialias&&t.antialias,Y=void 0===t.premultipliedAlpha||t.premultipliedAlpha,Z=void 0!==t.preserveDrawingBuffer&&t.preserveDrawingBuffer,K=[],tt=[],et=-1,it=[],rt=-1,st=new Float32Array(8),ct=[],lt=[];this.domElement=k,this.context=null,this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.gammaFactor=2,this.gammaInput=!1,this.gammaOutput=!1,this.physicallyCorrectLights=!1,this.toneMapping=eo,this.toneMappingExposure=1,this.toneMappingWhitePoint=1,this.maxMorphTargets=8,this.maxMorphNormals=4;var ht=this,ut=null,dt=null,pt=null,mt=-1,vt="",gt=null,yt=new a,_t=null,bt=new a,xt=0,wt=new q(0),Mt=0,Et=k.width,Tt=k.height,St=1,At=new a(0,0,Et,Tt),Ot=!1,zt=new a(0,0,Et,Tt),Bt=new ot,kt=new ae,jt=!1,Gt=!1,Ht=new nt,Vt=new u,Wt=new h,Xt=new u,qt=new u,Yt={hash:"",ambient:[0,0,0],directional:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotShadowMap:[],spotShadowMatrix:[],rectArea:[],point:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],shadows:[]},Zt={calls:0,vertices:0,faces:0,points:0};this.info={render:Zt,memory:{geometries:0,textures:0},programs:null};var Jt;try{var Qt={alpha:G,depth:H,stencil:V,antialias:W,premultipliedAlpha:Y,preserveDrawingBuffer:Z};if(null===(Jt=j||k.getContext("webgl",Qt)||k.getContext("experimental-webgl",Qt)))throw null!==k.getContext("webgl")?"Error creating WebGL context with your selected attributes.":"Error creating WebGL context.";void 0===Jt.getShaderPrecisionFormat&&(Jt.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}}),k.addEventListener("webglcontextlost",r,!1)}catch(t){console.error("THREE.WebGLRenderer: "+t)}var $t=new oe(Jt);$t.get("WEBGL_depth_texture"),$t.get("OES_texture_float"),$t.get("OES_texture_float_linear"),$t.get("OES_texture_half_float"),$t.get("OES_texture_half_float_linear"),$t.get("OES_standard_derivatives"),$t.get("ANGLE_instanced_arrays"),$t.get("OES_element_index_uint")&&(Lt.MaxIndex=4294967296);var se=new re(Jt,$t,t),ce=new ie(Jt,$t,B),le=new ne,he=new ee(Jt,$t,ce,le,se,B,this.info),ue=new te(Jt,le,this.info),de=new Kt(this,se),pe=new Ft;this.info.programs=de.programs;var fe=new Dt(Jt,$t,Zt),me=new Nt(Jt,$t,Zt),ve=new Ut(-1,1,1,-1,0,1),ge=new It,ye=new Rt(new Pt(2,2),new ft({depthTest:!1,depthWrite:!1,fog:!1})),_e=Ea.cube,be=new Rt(new Ct(5,5,5),new $({uniforms:_e.uniforms,vertexShader:_e.vertexShader,fragmentShader:_e.fragmentShader,side:pr,depthTest:!1,depthWrite:!1,fog:!1}));n(),this.context=Jt,this.capabilities=se,this.extensions=$t,this.properties=le,this.state=ce;var xe=new at(this,Yt,ue,se);this.shadowMap=xe;var we=new Q(this,ct),Me=new J(this,lt);this.getContext=function(){return Jt},this.getContextAttributes=function(){return Jt.getContextAttributes()},this.forceContextLoss=function(){$t.get("WEBGL_lose_context").loseContext()},this.getMaxAnisotropy=function(){return se.getMaxAnisotropy()},this.getPrecision=function(){return se.precision},this.getPixelRatio=function(){return St},this.setPixelRatio=function(t){void 0!==t&&(St=t,this.setSize(zt.z,zt.w,!1))},this.getSize=function(){return{width:Et,height:Tt}},this.setSize=function(t,e,n){Et=t,Tt=e,k.width=t*St,k.height=e*St,!1!==n&&(k.style.width=t+"px",k.style.height=e+"px"),this.setViewport(0,0,t,e)},this.setViewport=function(t,e,n,i){ce.viewport(zt.set(t,e,n,i))},this.setScissor=function(t,e,n,i){ce.scissor(At.set(t,e,n,i))},this.setScissorTest=function(t){ce.setScissorTest(Ot=t)},this.getClearColor=function(){return wt},this.setClearColor=function(t,e){wt.set(t),Mt=void 0!==e?e:1,ce.buffers.color.setClear(wt.r,wt.g,wt.b,Mt,Y)},this.getClearAlpha=function(){return Mt},this.setClearAlpha=function(t){Mt=t,ce.buffers.color.setClear(wt.r,wt.g,wt.b,Mt,Y)},this.clear=function(t,e,n){var i=0;(void 0===t||t)&&(i|=Jt.COLOR_BUFFER_BIT),(void 0===e||e)&&(i|=Jt.DEPTH_BUFFER_BIT),(void 0===n||n)&&(i|=Jt.STENCIL_BUFFER_BIT),Jt.clear(i)},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(t,e,n,i){this.setRenderTarget(t),this.clear(e,n,i)}
1,this.resetGLState=i,this.dispose=function(){it=[],rt=-1,tt=[],et=-1,k.removeEventListener("webglcontextlost",r,!1)},this.renderBufferImmediate=function(t,e,n){ce.initAttributes();var i=le.get(t);t.hasPositions&&!i.position&&(i.position=Jt.createBuffer()),t.hasNormals&&!i.normal&&(i.normal=Jt.createBuffer()),t.hasUvs&&!i.uv&&(i.uv=Jt.createBuffer()),t.hasColors&&!i.color&&(i.color=Jt.createBuffer());var r=e.getAttributes();if(t.hasPositions&&(Jt.bindBuffer(Jt.ARRAY_BUFFER,i.position),Jt.bufferData(Jt.ARRAY_BUFFER,t.positionArray,Jt.DYNAMIC_DRAW),ce.enableAttribute(r.position),Jt.vertexAttribPointer(r.position,3,Jt.FLOAT,!1,0,0)),t.hasNormals){if(Jt.bindBuffer(Jt.ARRAY_BUFFER,i.normal),!n.isMeshPhongMaterial&&!n.isMeshStandardMaterial&&!n.isMeshNormalMaterial&&n.shading===mr)for(var o=0,a=3*t.count;o<a;o+=9){var s=t.normalArray,c=(s[o+0]+s[o+3]+s[o+6])/3,l=(s[o+1]+s[o+4]+s[o+7])/3,h=(s[o+2]+s[o+5]+s[o+8])/3;s[o+0]=c,s[o+1]=l,s[o+2]=h,s[o+3]=c,s[o+4]=l,s[o+5]=h,s[o+6]=c,s[o+7]=l,s[o+8]=h}Jt.bufferData(Jt.ARRAY_BUFFER,t.normalArray,Jt.DYNAMIC_DRAW),ce.enableAttribute(r.normal),Jt.vertexAttribPointer(r.normal,3,Jt.FLOAT,!1,0,0)}t.hasUvs&&n.map&&(Jt.bindBuffer(Jt.ARRAY_BUFFER,i.uv),Jt.bufferData(Jt.ARRAY_BUFFER,t.uvArray,Jt.DYNAMIC_DRAW),ce.enableAttribute(r.uv),Jt.vertexAttribPointer(r.uv,2,Jt.FLOAT,!1,0,0)),t.hasColors&&n.vertexColors!==gr&&(Jt.bindBuffer(Jt.ARRAY_BUFFER,i.color),Jt.bufferData(Jt.ARRAY_BUFFER,t.colorArray,Jt.DYNAMIC_DRAW),ce.enableAttribute(r.color),Jt.vertexAttribPointer(r.color,3,Jt.FLOAT,!1,0,0)),ce.disableUnusedAttributes(),Jt.drawArrays(Jt.TRIANGLES,0,t.count),t.count=0},this.renderBufferDirect=function(t,n,i,r,o,a){w(r);var s=M(t,n,r,o),c=!1,h=i.id+"_"+s.id+"_"+r.wireframe;h!==vt&&(vt=h,c=!0);var u=o.morphTargetInfluences;if(void 0!==u){for(var p=[],f=0,m=u.length;f<m;f++){var v=u[f];p.push([v,f])}p.sort(d),p.length>8&&(p.length=8);for(var g=i.morphAttributes,f=0,m=p.length;f<m;f++){var v=p[f];if(st[f]=v[0],0!==v[0]){var y=v[1];!0===r.morphTargets&&g.position&&i.addAttribute("morphTarget"+f,g.position[y]),!0===r.morphNormals&&g.normal&&i.addAttribute("morphNormal"+f,g.normal[y])}else!0===r.morphTargets&&i.removeAttribute("morphTarget"+f),!0===r.morphNormals&&i.removeAttribute("morphNormal"+f)}for(var f=p.length,_=st.length;f<_;f++)st[f]=0;s.getUniforms().setValue(Jt,"morphTargetInfluences",st),c=!0}var y=i.index,b=i.attributes.position,x=1;!0===r.wireframe&&(y=ue.getWireframeAttribute(i),x=2);var E;null!==y?(E=me,E.setIndex(y)):E=fe,c&&(l(r,s,i),null!==y&&Jt.bindBuffer(Jt.ELEMENT_ARRAY_BUFFER,ue.getAttributeBuffer(y)));var T=0;null!==y?T=y.count:void 0!==b&&(T=b.count);var S=i.drawRange.start*x,A=i.drawRange.count*x,L=null!==a?a.start*x:0,R=null!==a?a.count*x:1/0,C=Math.max(S,L),P=Math.min(T,S+A,L+R)-1,O=Math.max(0,P-C+1);if(0!==O){if(o.isMesh)if(!0===r.wireframe)ce.setLineWidth(r.wireframeLinewidth*e()),E.setMode(Jt.LINES);else switch(o.drawMode){case ea:E.setMode(Jt.TRIANGLES);break;case na:E.setMode(Jt.TRIANGLE_STRIP);break;case ia:E.setMode(Jt.TRIANGLE_FAN)}else if(o.isLine){var I=r.linewidth;void 0===I&&(I=1),ce.setLineWidth(I*e()),o.isLineSegments?E.setMode(Jt.LINES):E.setMode(Jt.LINE_STRIP)}else o.isPoints&&E.setMode(Jt.POINTS);i&&i.isInstancedBufferGeometry?i.maxInstancedCount>0&&E.renderInstances(i,C,O):E.render(C,O)}},this.render=function(t,e,n,i){if(void 0!==e&&!0!==e.isCamera)return void console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");vt="",mt=-1,gt=null,!0===t.autoUpdate&&t.updateMatrixWorld(),null===e.parent&&e.updateMatrixWorld(),e.matrixWorldInverse.getInverse(e.matrixWorld),Vt.multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse),Bt.setFromMatrix(Vt),K.length=0,et=-1,rt=-1,ct.length=0,lt.length=0,Gt=this.localClippingEnabled,jt=kt.init(this.clippingPlanes,Gt,e),_(t,e),tt.length=et+1,it.length=rt+1,!0===ht.sortObjects&&(tt.sort(p),it.sort(f)),jt&&kt.beginShadows(),D(K),xe.render(t,e),F(K,e),jt&&kt.endShadows(),Zt.calls=0,Zt.vertices=0,Zt.faces=0,Zt.points=0,void 0===n&&(n=null),this.setRenderTarget(n);var r=t.background;if(null===r?ce.buffers.color.setClear(wt.r,wt.g,wt.b,Mt,Y):r&&r.isColor&&(ce.buffers.color.setClear(r.r,r.g,r.b,1,Y),i=!0),(this.autoClear||i)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil),r&&r.isCubeTexture?(ge.projectionMatrix.copy(e.projectionMatrix),ge.matrixWorld.extractRotation(e.matrixWorld),ge.matrixWorldInverse.getInverse(ge.matrixWorld),be.material.uniforms.tCube.value=r,be.modelViewMatrix.multiplyMatrices(ge.matrixWorldInverse,be.matrixWorld),ue.update(be),ht.renderBufferDirect(ge,null,be.geometry,be.material,be,null)):r&&r.isTexture&&(ye.material.map=r,ue.update(ye),ht.renderBufferDirect(ve,null,ye.geometry,ye.material,ye,null)),t.overrideMaterial){var o=t.overrideMaterial;b(tt,t,e,o),b(it,t,e,o)}else ce.setBlending(br),b(tt,t,e),b(it,t,e);we.render(t,e),Me.render(t,e,bt),n&&he.updateRenderTargetMipmap(n),ce.setDepthTest(!0),ce.setDepthWrite(!0),ce.setColorWrite(!0)},this.setFaceCulling=function(t,e){ce.setCullFace(t),ce.setFlipSided(e===lr)},this.allocTextureUnit=z,this.setTexture2D=function(){var t=!1;return function(e,n){e&&e.isWebGLRenderTarget&&(t||(console.warn("THREE.WebGLRenderer.setTexture2D: don't use render targets as textures. Use their .texture property instead."),t=!0),e=e.texture),he.setTexture2D(e,n)}}(),this.setTexture=function(){var t=!1;return function(e,n){t||(console.warn("THREE.WebGLRenderer: .setTexture is deprecated, use setTexture2D instead."),t=!0),he.setTexture2D(e,n)}}(),this.setTextureCube=function(){var t=!1;return function(e,n){e&&e.isWebGLRenderTargetCube&&(t||(console.warn("THREE.WebGLRenderer.setTextureCube: don't use cube render targets as textures. Use their .texture property instead."),t=!0),e=e.texture),e&&e.isCubeTexture||Array.isArray(e.image)&&6===e.image.length?he.setTextureCube(e,n):he.setTextureCubeDynamic(e,n)}}(),this.getCurrentRenderTarget=function(){return dt},this.setRenderTarget=function(t){dt=t,t&&void 0===le.get(t).__webglFramebuffer&&he.setupRenderTarget(t);var e,n=t&&t.isWebGLRenderTargetCube;if(t){var i=le.get(t);e=n?i.__webglFramebuffer[t.activeCubeFace]:i.__webglFramebuffer,yt.copy(t.scissor),_t=t.scissorTest,bt.copy(t.viewport)}else e=null,yt.copy(At).multiplyScalar(St),_t=Ot,bt.copy(zt).multiplyScalar(St);if(pt!==e&&(Jt.bindFramebuffer(Jt.FRAMEBUFFER,e),pt=e),ce.scissor(yt),ce.setScissorTest(_t),ce.viewport(bt),n){var r=le.get(t.texture);Jt.framebufferTexture2D(Jt.FRAMEBUFFER,Jt.COLOR_ATTACHMENT0,Jt.TEXTURE_CUBE_MAP_POSITIVE_X+t.activeCubeFace,r.__webglTexture,t.activeMipMapLevel)}},this.readRenderTargetPixels=function(t,e,n,i,r,o){if(!1===(t&&t.isWebGLRenderTarget))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");var a=le.get(t).__webglFramebuffer;if(a){var s=!1;a!==pt&&(Jt.bindFramebuffer(Jt.FRAMEBUFFER,a),s=!0);try{var c=t.texture,l=c.format,h=c.type;if(l!==Bo&&B(l)!==Jt.getParameter(Jt.IMPLEMENTATION_COLOR_READ_FORMAT))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");if(h!==To&&B(h)!==Jt.getParameter(Jt.IMPLEMENTATION_COLOR_READ_TYPE)&&(h!==Po||!$t.get("OES_texture_float")&&!$t.get("WEBGL_color_buffer_float"))&&(h!==Oo||!$t.get("EXT_color_buffer_half_float")))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");Jt.checkFramebufferStatus(Jt.FRAMEBUFFER)===Jt.FRAMEBUFFER_COMPLETE?e>=0&&e<=t.width-i&&n>=0&&n<=t.height-r&&Jt.readPixels(e,n,i,r,B(l),B(h),o):console.error("THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete.")}finally{s&&Jt.bindFramebuffer(Jt.FRAMEBUFFER,pt)}}}}function ce(t,e){this.name="",this.color=new q(t),this.density=void 0!==e?e:25e-5}function le(t,e,n){this.name="",this.color=new q(t),this.near=void 0!==e?e:1,this.far=void 0!==n?n:1e3}function he(){ht.call(this),this.type="Scene",this.background=null,this.fog=null,this.overrideMaterial=null,this.autoUpdate=!0}function ue(t,e,n,i,r){ht.call(this),this.lensFlares=[],this.positionScreen=new h,this.customUpdateCallback=void 0,void 0!==t&&this.add(t,e,n,i,r)}function de(t){K.call(this),this.type="SpriteMaterial",this.color=new q(16777215),this.map=null,this.rotation=0,this.fog=!1,this.lights=!1,this.setValues(t)}function pe(t){ht.call(this),this.type="Sprite",this.material=void 0!==t?t:new de}function fe(){ht.call(this),this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]}})}function me(t,e,n){if(this.useVertexTexture=void 0===n||n,this.identityMatrix=new u,t=t||[],this.bones=t.slice(0),this.useVertexTexture){var i=Math.sqrt(4*this.bones.length);
1i=pa.nextPowerOfTwo(Math.ceil(i)),i=Math.max(i,4),this.boneTextureWidth=i,this.boneTextureHeight=i,this.boneMatrices=new Float32Array(this.boneTextureWidth*this.boneTextureHeight*4),this.boneTexture=new Y(this.boneMatrices,this.boneTextureWidth,this.boneTextureHeight,Bo,Po)}else this.boneMatrices=new Float32Array(16*this.bones.length);if(void 0===e)this.calculateInverses();else if(this.bones.length===e.length)this.boneInverses=e.slice(0);else{console.warn("THREE.Skeleton bonInverses is the wrong length."),this.boneInverses=[];for(var r=0,o=this.bones.length;r<o;r++)this.boneInverses.push(new u)}}function ve(){ht.call(this),this.type="Bone"}function ge(t,e,n){Rt.call(this,t,e),this.type="SkinnedMesh",this.bindMode="attached",this.bindMatrix=new u,this.bindMatrixInverse=new u;var i=[];if(this.geometry&&void 0!==this.geometry.bones){for(var r,o,a=0,s=this.geometry.bones.length;a<s;++a)o=this.geometry.bones[a],r=new ve,i.push(r),r.name=o.name,r.position.fromArray(o.pos),r.quaternion.fromArray(o.rotq),void 0!==o.scl&&r.scale.fromArray(o.scl);for(var a=0,s=this.geometry.bones.length;a<s;++a)o=this.geometry.bones[a],-1!==o.parent&&null!==o.parent&&void 0!==i[o.parent]?i[o.parent].add(i[a]):this.add(i[a])}this.normalizeSkinWeights(),this.updateMatrixWorld(!0),this.bind(new me(i,void 0,n),this.matrixWorld)}function ye(t){K.call(this),this.type="LineBasicMaterial",this.color=new q(16777215),this.linewidth=1,this.linecap="round",this.linejoin="round",this.lights=!1,this.setValues(t)}function _e(t,e,n){if(1===n)return console.warn("THREE.Line: parameter THREE.LinePieces no longer supported. Created THREE.LineSegments instead."),new be(t,e);ht.call(this),this.type="Line",this.geometry=void 0!==t?t:new Lt,this.material=void 0!==e?e:new ye({color:16777215*Math.random()})}function be(t,e){_e.call(this,t,e),this.type="LineSegments"}function xe(t){K.call(this),this.type="PointsMaterial",this.color=new q(16777215),this.map=null,this.size=1,this.sizeAttenuation=!0,this.lights=!1,this.setValues(t)}function we(t,e){ht.call(this),this.type="Points",this.geometry=void 0!==t?t:new Lt,this.material=void 0!==e?e:new xe({color:16777215*Math.random()})}function Me(){ht.call(this),this.type="Group"}function Ee(t,e,n,i,r,a,s,c,l){function h(){requestAnimationFrame(h),t.readyState>=t.HAVE_CURRENT_DATA&&(u.needsUpdate=!0)}o.call(this,t,e,n,i,r,a,s,c,l),this.generateMipmaps=!1;var u=this;h()}function Te(t,e,n,i,r,a,s,c,l,h,u,d){o.call(this,null,a,s,c,l,h,i,r,u,d),this.image={width:e,height:n},this.mipmaps=t,this.flipY=!1,this.generateMipmaps=!1}function Se(t,e,n,i,r,a,s,c,l){o.call(this,t,e,n,i,r,a,s,c,l),this.needsUpdate=!0}function Ae(t,e,n,i,r,a,s,c,l,h){if((h=void 0!==h?h:Go)!==Go&&h!==Ho)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");void 0===n&&h===Go&&(n=Lo),void 0===n&&h===Ho&&(n=Do),o.call(this,null,i,r,a,s,c,h,n,l),this.image={width:t,height:e},this.magFilter=void 0!==s?s:yo,this.minFilter=void 0!==c?c:yo,this.flipY=!1,this.generateMipmaps=!1}function Le(t){function e(t,e){return t-e}Lt.call(this);var n=[0,0],i={},r=["a","b","c"];if(t&&t.isGeometry){for(var o=t.vertices,a=t.faces,s=0,c=new Uint32Array(6*a.length),l=0,h=a.length;l<h;l++)for(var u=a[l],d=0;d<3;d++){n[0]=u[r[d]],n[1]=u[r[(d+1)%3]],n.sort(e);var p=n.toString();void 0===i[p]&&(c[2*s]=n[0],c[2*s+1]=n[1],i[p]=!0,s++)}for(var f=new Float32Array(2*s*3),l=0,h=s;l<h;l++)for(var d=0;d<2;d++){var m=o[c[2*l+d]],v=6*l+3*d;f[v+0]=m.x,f[v+1]=m.y,f[v+2]=m.z}this.addAttribute("position",new mt(f,3))}else if(t&&t.isBufferGeometry)if(null!==t.index){var g=t.index.array,o=t.attributes.position,y=t.groups,s=0;0===y.length&&t.addGroup(0,g.length);for(var c=new Uint32Array(2*g.length),_=0,b=y.length;_<b;++_)for(var x=y[_],w=x.start,M=x.count,l=w,E=w+M;l<E;l+=3)for(var d=0;d<3;d++){n[0]=g[l+d],n[1]=g[l+(d+1)%3],n.sort(e);var p=n.toString();void 0===i[p]&&(c[2*s]=n[0],c[2*s+1]=n[1],i[p]=!0,s++)}for(var f=new Float32Array(2*s*3),l=0,h=s;l<h;l++)for(var d=0;d<2;d++){var v=6*l+3*d,T=c[2*l+d];f[v+0]=o.getX(T),f[v+1]=o.getY(T),f[v+2]=o.getZ(T)}this.addAttribute("position",new mt(f,3))}else{for(var o=t.attributes.position.array,s=o.length/3,S=s/3,f=new Float32Array(2*s*3),l=0,h=S;l<h;l++)for(var d=0;d<3;d++){var v=18*l+6*d,A=9*l+3*d;f[v+0]=o[A],f[v+1]=o[A+1],f[v+2]=o[A+2];var T=9*l+(d+1)%3*3;f[v+3]=o[T],f[v+4]=o[T+1],f[v+5]=o[T+2]}this.addAttribute("position",new mt(f,3))}}function Re(t,e,n){Lt.call(this),this.type="ParametricBufferGeometry",this.parameters={func:t,slices:e,stacks:n};var i,r,o,a,s,c=[],l=[],h=e+1;for(i=0;i<=n;i++)for(s=i/n,r=0;r<=e;r++)a=r/e,o=t(a,s),c.push(o.x,o.y,o.z),l.push(a,s);var u,d,p,f,m=[];for(i=0;i<n;i++)for(r=0;r<e;r++)u=i*h+r,d=i*h+r+1,p=(i+1)*h+r+1,f=(i+1)*h+r,m.push(u,d,f),m.push(d,p,f);this.setIndex(new(m.length>65535?wt:bt)(m,1)),this.addAttribute("position",new Mt(c,3)),this.addAttribute("uv",new Mt(l,2)),this.computeVertexNormals()}function Ce(t,e,n){St.call(this),this.type="ParametricGeometry",this.parameters={func:t,slices:e,stacks:n},this.fromBufferGeometry(new Re(t,e,n)),this.mergeVertices()}function Pe(t,e,n,i){function o(t,e,n,i){var r,o,a=Math.pow(2,i),c=[];for(r=0;r<=a;r++){c[r]=[];var l=t.clone().lerp(n,r/a),h=e.clone().lerp(n,r/a),u=a-r;for(o=0;o<=u;o++)c[r][o]=0===o&&r===a?l:l.clone().lerp(h,o/u)}for(r=0;r<a;r++)for(o=0;o<2*(a-r)-1;o++){var d=Math.floor(o/2);
1o%2===0?(s(c[r][d+1]),s(c[r+1][d]),s(c[r][d])):(s(c[r][d+1]),s(c[r+1][d+1]),s(c[r+1][d]))}}function a(){for(var t=0;t<m.length;t+=6){var e=m[t+0],n=m[t+2],i=m[t+4],r=Math.max(e,n,i),o=Math.min(e,n,i);r>.9&&o<.1&&(e<.2&&(m[t+0]+=1),n<.2&&(m[t+2]+=1),i<.2&&(m[t+4]+=1))}}function s(t){f.push(t.x,t.y,t.z)}function c(e,n){var i=3*e;n.x=t[i+0],n.y=t[i+1],n.z=t[i+2]}function l(){for(var t=new h,e=new h,n=new h,i=new h,o=new r,a=new r,s=new r,c=0,l=0;c<f.length;c+=9,l+=6){t.set(f[c+0],f[c+1],f[c+2]),e.set(f[c+3],f[c+4],f[c+5]),n.set(f[c+6],f[c+7],f[c+8]),o.set(m[l+0],m[l+1]),a.set(m[l+2],m[l+3]),s.set(m[l+4],m[l+5]),i.copy(t).add(e).add(n).divideScalar(3);var p=d(i);u(o,l+0,t,p),u(a,l+2,e,p),u(s,l+4,n,p)}}function u(t,e,n,i){i<0&&1===t.x&&(m[e]=t.x-1),0===n.x&&0===n.z&&(m[e]=i/2/Math.PI+.5)}function d(t){return Math.atan2(t.z,-t.x)}function p(t){return Math.atan2(-t.y,Math.sqrt(t.x*t.x+t.z*t.z))}Lt.call(this),this.type="PolyhedronBufferGeometry",this.parameters={vertices:t,indices:e,radius:n,detail:i},n=n||1,i=i||0;var f=[],m=[];!function(t){for(var n=new h,i=new h,r=new h,a=0;a<e.length;a+=3)c(e[a+0],n),c(e[a+1],i),c(e[a+2],r),o(n,i,r,t)}(i),function(t){for(var e=new h,n=0;n<f.length;n+=3)e.x=f[n+0],e.y=f[n+1],e.z=f[n+2],e.normalize().multiplyScalar(t),f[n+0]=e.x,f[n+1]=e.y,f[n+2]=e.z}(n),function(){for(var t=new h,e=0;e<f.length;e+=3){t.x=f[e+0],t.y=f[e+1],t.z=f[e+2];var n=d(t)/2/Math.PI+.5,i=p(t)/Math.PI+.5;m.push(n,1-i)}l(),a()}(),this.addAttribute("position",new Mt(f,3)),this.addAttribute("normal",new Mt(f.slice(),3)),this.addAttribute("uv",new Mt(m,2)),this.normalizeNormals(),this.boundingSphere=new nt(new h,n)}function Oe(t,e){var n=[1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],i=[2,1,0,0,3,2,1,3,0,2,3,1];Pe.call(this,n,i,t,e),this.type="TetrahedronBufferGeometry",this.parameters={radius:t,detail:e}}function Ie(t,e){St.call(this),this.type="TetrahedronGeometry",this.parameters={radius:t,detail:e},this.fromBufferGeometry(new Oe(t,e)),this.mergeVertices()}function Ue(t,e){var n=[1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],i=[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2];Pe.call(this,n,i,t,e),this.type="OctahedronBufferGeometry",this.parameters={radius:t,detail:e}}function Ne(t,e){St.call(this),this.type="OctahedronGeometry",this.parameters={radius:t,detail:e},this.fromBufferGeometry(new Ue(t,e)),this.mergeVertices()}function De(t,e){var n=(1+Math.sqrt(5))/2,i=[-1,n,0,1,n,0,-1,-n,0,1,-n,0,0,-1,n,0,1,n,0,-1,-n,0,1,-n,n,0,-1,n,0,1,-n,0,-1,-n,0,1],r=[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];Pe.call(this,i,r,t,e),this.type="IcosahedronBufferGeometry",this.parameters={radius:t,detail:e}}function Fe(t,e){St.call(this),this.type="IcosahedronGeometry",this.parameters={radius:t,detail:e},this.fromBufferGeometry(new De(t,e)),this.mergeVertices()}function ze(t,e){var n=(1+Math.sqrt(5))/2,i=1/n,r=[-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-i,-n,0,-i,n,0,i,-n,0,i,n,-i,-n,0,-i,n,0,i,-n,0,i,n,0,-n,0,-i,n,0,-i,-n,0,i,n,0,i],o=[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1,18,0,18,16,6,10,2,6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,11,19,7,
119,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9];Pe.call(this,r,o,t,e),this.type="DodecahedronBufferGeometry",this.parameters={radius:t,detail:e}}function Be(t,e){St.call(this),this.type="DodecahedronGeometry",this.parameters={radius:t,detail:e},this.fromBufferGeometry(new ze(t,e)),this.mergeVertices()}function ke(t,e,n,i){St.call(this),this.type="PolyhedronGeometry",this.parameters={vertices:t,indices:e,radius:n,detail:i},this.fromBufferGeometry(new Pe(t,e,n,i)),this.mergeVertices()}function je(t,e,n,i,o){function a(r){var o=t.getPointAt(r/e),a=l.normals[r],s=l.binormals[r];for(d=0;d<=i;d++){var c=d/i*Math.PI*2,h=Math.sin(c),u=-Math.cos(c);f.x=u*a.x+h*s.x,f.y=u*a.y+h*s.y,f.z=u*a.z+h*s.z,f.normalize(),g.push(f.x,f.y,f.z),p.x=o.x+n*f.x,p.y=o.y+n*f.y,p.z=o.z+n*f.z,v.push(p.x,p.y,p.z)}}function s(){for(d=1;d<=e;d++)for(u=1;u<=i;u++){var t=(i+1)*(d-1)+(u-1),n=(i+1)*d+(u-1),r=(i+1)*d+u,o=(i+1)*(d-1)+u;_.push(t,n,o),_.push(n,r,o)}}function c(){for(u=0;u<=e;u++)for(d=0;d<=i;d++)m.x=u/e,m.y=d/i,y.push(m.x,m.y)}Lt.call(this),this.type="TubeBufferGeometry",this.parameters={path:t,tubularSegments:e,radius:n,radialSegments:i,closed:o},e=e||64,n=n||1,i=i||8,o=o||!1;var l=t.computeFrenetFrames(e,o);this.tangents=l.tangents,this.normals=l.normals,this.binormals=l.binormals;var u,d,p=new h,f=new h,m=new r,v=[],g=[],y=[],_=[];!function(){for(u=0;u<e;u++)a(u);a(!1===o?e:0),c(),s()}(),this.setIndex(new(_.length>65535?wt:bt)(_,1)),this.addAttribute("position",new Mt(v,3)),this.addAttribute("normal",new Mt(g,3)),this.addAttribute("uv",new Mt(y,2))}function Ge(t,e,n,i,r,o){St.call(this),this.type="TubeGeometry",this.parameters={path:t,tubularSegments:e,radius:n,radialSegments:i,closed:r},void 0!==o&&console.warn("THREE.TubeGeometry: taper has been removed.");var a=new je(t,e,n,i,r);this.tangents=a.tangents,this.normals=a.normals,this.binormals=a.binormals,this.fromBufferGeometry(a),this.mergeVertices()}function He(t,e,n,i,o,a){function s(t,e,n,i,r){var o=Math.cos(t),a=Math.sin(t),s=n/e*t,c=Math.cos(s);r.x=i*(2+c)*.5*o,r.y=i*(2+c)*a*.5,r.z=i*Math.sin(s)*.5}Lt.call(this),this.type="TorusKnotBufferGeometry",this.parameters={radius:t,tube:e,tubularSegments:n,radialSegments:i,p:o,q:a},t=t||100,e=e||40,n=Math.floor(n)||64,i=Math.floor(i)||8,o=o||2,a=a||3;var c,l,u=(i+1)*(n+1),d=i*n*2*3,p=new mt(new(d>65535?Uint32Array:Uint16Array)(d),1),f=new mt(new Float32Array(3*u),3),m=new mt(new Float32Array(3*u),3),v=new mt(new Float32Array(2*u),2),g=0,y=0,_=new h,b=new h,x=new r,w=new h,M=new h,E=new h,T=new h,S=new h;for(c=0;c<=n;++c){var A=c/n*o*Math.PI*2;for(s(A,o,a,t,w),s(A+.01,o,a,t,M),T.subVectors(M,w),S.addVectors(M,w),E.crossVectors(T,S),S.crossVectors(E,T),E.normalize(),S.normalize(),l=0;l<=i;++l){var L=l/i*Math.PI*2,R=-e*Math.cos(L),C=e*Math.sin(L);_.x=w.x+(R*S.x+C*E.x),_.y=w.y+(R*S.y+C*E.y),_.z=w.z+(R*S.z+C*E.z),f.setXYZ(g,_.x,_.y,_.z),b.subVectors(_,w).normalize(),m.setXYZ(g,b.x,b.y,b.z),x.x=c/n,x.y=l/i,v.setXY(g,x.x,x.y),g++}}for(l=1;l<=n;l++)for(c=1;c<=i;c++){var P=(i+1)*(l-1)+(c-1),O=(i+1)*l+(c-1),I=(i+1)*l+c,U=(i+1)*(l-1)+c;p.setX(y,P),y++,p.setX(y,O),y++,p.setX(y,U),y++,p.setX(y,O),y++,p.setX(y,I),y++,p.setX(y,U),y++}this.setIndex(p),this.addAttribute("position",f),this.addAttribute("normal",m),this.addAttribute("uv",v)}function Ve(t,e,n,i,r,o,a){St.call(this),this.type="TorusKnotGeometry",this.parameters={radius:t,tube:e,tubularSegments:n,radialSegments:i,p:r,q:o},void 0!==a&&console.warn("THREE.TorusKnotGeometry: heightScale has been deprecated. Use .scale( x, y, z ) instead."),this.fromBufferGeometry(new He(t,e,n,i,r,o)),this.mergeVertices()}function We(t,e,n,i,r){Lt.call(this),this.type="TorusBufferGeometry",this.parameters={radius:t,tube:e,radialSegments:n,tubularSegments:i,arc:r},t=t||100,e=e||40,n=Math.floor(n)||8,i=Math.floor(i)||6,r=r||2*Math.PI;var o,a,s=(n+1)*(i+1),c=n*i*2*3,l=new(c>65535?Uint32Array:Uint16Array)(c),u=new Float32Array(3*s),d=new Float32Array(3*s),p=new Float32Array(2*s),f=0,m=0,v=0,g=new h,y=new h,_=new h;for(o=0;o<=n;o++)for(a=0;a<=i;a++){var b=a/i*r,x=o/n*Math.PI*2;y.x=(t+e*Math.cos(x))*Math.cos(b),y.y=(t+e*Math.cos(x))*Math.sin(b),y.z=e*Math.sin(x),u[f]=y.x,u[f+1]=y.y,u[f+2]=y.z,g.x=t*Math.cos(b),g.y=t*Math.sin(b),_.subVectors(y,g).normalize(),d[f]=_.x,d[f+1]=_.y,d[f+2]=_.z,p[m]=a/i,p[m+1]=o/n,f+=3,m+=2}for(o=1;o<=n;o++)for(a=1;a<=i;a++){var w=(i+1)*o+a-1,M=(i+1)*(o-1)+a-1,E=(i+1)*(o-1)+a,T=(i+1)*o+a;l[v]=w,l[v+1]=M,l[v+2]=T,l[v+3]=M,l[v+4]=E,l[v+5]=T,v+=6}this.setIndex(new mt(l,1)),this.addAttribute("position",new mt(u,3)),this.addAttribute("normal",new mt(d,3)),this.addAttribute("uv",new mt(p,2))}function Xe(t,e,n,i,r){St.call(this),this.type="TorusGeometry",this.parameters={radiu
1s:t,tube:e,radialSegments:n,tubularSegments:i,arc:r},this.fromBufferGeometry(new We(t,e,n,i,r))}function qe(t,e){if("undefined"===typeof t)return void(t=[]);St.call(this),this.type="ExtrudeGeometry",t=Array.isArray(t)?t:[t],this.addShapeList(t,e),this.computeFaceNormals()}function Ye(t,e){e=e||{};var n=e.font;if(!1===(n&&n.isFont))return console.error("THREE.TextGeometry: font parameter is not an instance of THREE.Font."),new St;var i=n.generateShapes(t,e.size,e.curveSegments);e.amount=void 0!==e.height?e.height:50,void 0===e.bevelThickness&&(e.bevelThickness=10),void 0===e.bevelSize&&(e.bevelSize=8),void 0===e.bevelEnabled&&(e.bevelEnabled=!1),qe.call(this,i,e),this.type="TextGeometry"}function Ze(t,e,n,i,r,o,a){Lt.call(this),this.type="SphereBufferGeometry",this.parameters={radius:t,widthSegments:e,heightSegments:n,phiStart:i,phiLength:r,thetaStart:o,thetaLength:a},t=t||50,e=Math.max(3,Math.floor(e)||8),n=Math.max(2,Math.floor(n)||6),i=void 0!==i?i:0,r=void 0!==r?r:2*Math.PI,o=void 0!==o?o:0,a=void 0!==a?a:Math.PI;for(var s=o+a,c=(e+1)*(n+1),l=new mt(new Float32Array(3*c),3),u=new mt(new Float32Array(3*c),3),d=new mt(new Float32Array(2*c),2),p=0,f=[],m=new h,v=0;v<=n;v++){for(var g=[],y=v/n,_=0;_<=e;_++){var b=_/e,x=-t*Math.cos(i+b*r)*Math.sin(o+y*a),w=t*Math.cos(o+y*a),M=t*Math.sin(i+b*r)*Math.sin(o+y*a);m.set(x,w,M).normalize(),l.setXYZ(p,x,w,M),u.setXYZ(p,m.x,m.y,m.z),d.setXY(p,b,1-y),g.push(p),p++}f.push(g)}for(var E=[],v=0;v<n;v++)for(var _=0;_<e;_++){var T=f[v][_+1],S=f[v][_],A=f[v+1][_],L=f[v+1][_+1];(0!==v||o>0)&&E.push(T,S,L),(v!==n-1||s<Math.PI)&&E.push(S,A,L)}this.setIndex(new(l.count>65535?wt:bt)(E,1)),this.addAttribute("position",l),this.addAttribute("normal",u),this.addAttribute("uv",d),this.boundingSphere=new nt(new h,t)}function Je(t,e,n,i,r,o,a){St.call(this),this.type="SphereGeometry",this.parameters={radius:t,widthSegments:e,heightSegments:n,phiStart:i,phiLength:r,thetaStart:o,thetaLength:a},this.fromBufferGeometry(new Ze(t,e,n,i,r,o,a))}function Qe(t,e,n,i,o,a){Lt.call(this),this.type="RingBufferGeometry",this.parameters={innerRadius:t,outerRadius:e,thetaSegments:n,phiSegments:i,thetaStart:o,thetaLength:a},t=t||20,e=e||50,o=void 0!==o?o:0,a=void 0!==a?a:2*Math.PI,n=void 0!==n?Math.max(3,n):8,i=void 0!==i?Math.max(1,i):1;var s,c,l,u=(n+1)*(i+1),d=n*i*2*3,p=new mt(new(d>65535?Uint32Array:Uint16Array)(d),1),f=new mt(new Float32Array(3*u),3),m=new mt(new Float32Array(3*u),3),v=new mt(new Float32Array(2*u),2),g=0,y=0,_=t,b=(e-t)/i,x=new h,w=new r;for(c=0;c<=i;c++){for(l=0;l<=n;l++)s=o+l/n*a,x.x=_*Math.cos(s),x.y=_*Math.sin(s),f.setXYZ(g,x.x,x.y,x.z),m.setXYZ(g,0,0,1),w.x=(x.x/e+1)/2,w.y=(x.y/e+1)/2,v.setXY(g,w.x,w.y),g++;_+=b}for(c=0;c<i;c++){var M=c*(n+1);for(l=0;l<n;l++){s=l+M;var E=s,T=s+n+1,S=s+n+2,A=s+1;p.setX(y,E),y++,p.setX(y,T),y++,p.setX(y,S),y++,p.setX(y,E),y++,p.setX(y,S),y++,p.setX(y,A),y++}}this.setIndex(p),this.addAttribute("position",f),this.addAttribute("normal",m),this.addAttribute("uv",v)}function Ke(t,e,n,i,r,o){St.call(this),this.type="RingGeometry",this.parameters={innerRadius:t,outerRadius:e,thetaSegments:n,phiSegments:i,thetaStart:r,thetaLength:o},this.fromBufferGeometry(new Qe(t,e,n,i,r,o))}function $e(t,e,n,i){St.call(this),this.type="PlaneGeometry",this.parameters={width:t,height:e,widthSegments:n,heightSegments:i},this.fromBufferGeometry(new Pt(t,e,n,i))}function tn(t,e,n,i){Lt.call(this),this.type="LatheBufferGeometry",this.parameters={points:t,segments:e,phiStart:n,phiLength:i},e=Math.floor(e)||12,n=n||0,i=i||2*Math.PI,i=pa.clamp(i,0,2*Math.PI);var o,a,s,c=(e+1)*t.length,l=e*t.length*2*3,u=new mt(new(l>65535?Uint32Array:Uint16Array)(l),1),d=new mt(new Float32Array(3*c),3),p=new mt(new Float32Array(2*c),2),f=0,m=0,v=1/e,g=new h,y=new r;for(a=0;a<=e;a++){var _=n+a*v*i,b=Math.sin(_),x=Math.cos(_);for(s=0;s<=t.length-1;s++)g.x=t[s].x*b,g.y=t[s].y,g.z=t[s].x*x,d.setXYZ(f,g.x,g.y,g.z),y.x=a/e,y.y=s/(t.length-1),p.setXY(f,y.x,y.y),f++}for(a=0;a<e;a++)for(s=0;s<t.length-1;s++){o=s+a*t.length;var w=o,M=o+t.length,E=o+t.length+1,T=o+1;u.setX(m,w),m++,u.setX(m,M),m++,u.setX(m,T),m++,u.setX(m,M),m++,u.setX(m,E),m++,u.setX(m,T),m++}if(this.setIndex(u),this.addAttribute("position",d),this.addAttribute("uv",p),this.computeVertexNormals(),i===2*Math.PI){var S=this.attributes.normal.array,A=new h,L=new h,R=new h;for(o=e*t.length*3,a=0,s=0;a<t.length;a++,s+=3)A.x=S[s+0],A.y=S[s+1],A.z=S[s+2],L.x=S[o+s+0],L.y=S[o+s+1],L.z=S[o+s+2],R.addVectors(A,L).normalize(),S[s+0]=S[o+s+0]=R.x,S[s+1]=S[o+s+1]=R.y,S[s+2]=S[o+s+2]=R.z}}function en(t,e,n,i){St.call(this),this.type="LatheGeometry",this.parameters={points:t,segments:e,phiStart:n,phiLength:i},this.fromBufferGeometry(new tn(t,e,n,i)),this.mergeVertices()}function nn(t,e){function n(t){var n,s,l,h=i.length/3,u=t.extractPoints(e),d=u.shape,p=u.holes;if(!1===Ra.isClockWise(d))for(d=d.reverse(),n=0,s=p.length;n<s;n++)l=p[n],!0===Ra.isClockWise(l)&&(p[n]=l.reverse());var f=Ra.triangulateShape(d,p);for(n=0,s=p.length;n<s;n++)l=p[n],d=d.concat(l);for(n=0,s=d.length;n<s;n++){var m=d[n];i.push(m.x,m.y,0),r.push(0,0,1),o.push(m.x,m.y)}for(n=0,s=f.length;n<s;n++){var v=f[n],g=v[0]+h,y=v[1]+h,_=v[2]+h;a.push(g,y,_),c+=3}}Lt.call(this),this.type="ShapeBufferGeometry",this.parameters={shapes:t,curveSegments:e},e=e||12;var i=[],r=[],o=[],a=[],s=0,c=0;if(!1===Array.isArray(t))n(t);else for(var l=0;l<t.length;l++)n(t[l]),this.addGroup(s,c,l),s+=c,c=0;this.setIndex(new(a.length>65535?wt:bt)(a,1)),this.addAttribute("position",new Mt(i,3)),this.addAttribute("normal",new Mt(r,3)),this.addAttribute("uv",new Mt(o,2))}function rn(t,e){St.call(this),this.type="ShapeGeometry","object"===typeof e&&(console.warn("THREE.ShapeGeometry: Options parameter has been removed."),e=e.curveSegments),this.parameters={shapes:t,curveSegments:e},this.fromBufferGeometry(new nn(t,e)),this.mergeVertices()}function on(t,e){function n(t,e){return t-e}Lt.call(this),e=void 0!==e?e:1;var i,r=Math.cos(pa.DEG2RAD*e),o=[0,0],a={},s=["a","b","c"];t.isBufferGeometry?(i=new St,i.fromBufferGeometry(t)):i=t.clone(),i.mergeVertices(),i.computeFaceNormals();for(var c=i.vertices,l=i.faces,h=0,u=l.length;h<u;h++)for(var d=l[h],p=0;p<3;p++){o[0]=d[s[p]],o[1]=d[s[(p+1)%3]],o.sort(n);var f=o.toString();void 0===a[f]?a[f]={vert1:o[0],vert2:o[1],face1:h,face2:void 0}:a[f].face2=h}var m=[];for(var f in a){var v=a[f];if(void 0===v.face2||l[v.face1].normal.dot(l[v.face2].normal)<=r){var g=c[v.vert1];m.push(g.x),m.push(g.y),m.push(g.z),g=c[v.vert2],m.push(g.x),m.push(g.y),m.push(g.z)}}this.addAttribute("position",new Mt(m,3))}function an(t,e,n,i,o,a,s,c){function l(n){var o,a,l,d=new r,p=new h,f=0,x=!0===n?t:e,E=!0===n?1:-1;for(a=_,o=1;o<=i;
1o++)v.setXYZ(_,0,w*E,0),g.setXYZ(_,0,E,0),d.x=.5,d.y=.5,y.setXY(_,d.x,d.y),_++;for(l=_,o=0;o<=i;o++){var T=o/i,S=T*c+s,A=Math.cos(S),L=Math.sin(S);p.x=x*L,p.y=w*E,p.z=x*A,v.setXYZ(_,p.x,p.y,p.z),g.setXYZ(_,0,E,0),d.x=.5*A+.5,d.y=.5*L*E+.5,y.setXY(_,d.x,d.y),_++}for(o=0;o<i;o++){var R=a+o,C=l+o;!0===n?(m.setX(b,C),b++,m.setX(b,C+1),b++,m.setX(b,R),b++):(m.setX(b,C+1),b++,m.setX(b,C),b++,m.setX(b,R),b++),f+=3}u.addGroup(M,f,!0===n?1:2),M+=f}Lt.call(this),this.type="CylinderBufferGeometry",this.parameters={radiusTop:t,radiusBottom:e,height:n,radialSegments:i,heightSegments:o,openEnded:a,thetaStart:s,thetaLength:c};var u=this;t=void 0!==t?t:20,e=void 0!==e?e:20,n=void 0!==n?n:100,i=Math.floor(i)||8,o=Math.floor(o)||1,a=void 0!==a&&a,s=void 0!==s?s:0,c=void 0!==c?c:2*Math.PI;var d=0;!1===a&&(t>0&&d++,e>0&&d++);var p=function(){var t=(i+1)*(o+1);return!1===a&&(t+=(i+1)*d+i*d),t}(),f=function(){var t=i*o*2*3;return!1===a&&(t+=i*d*3),t}(),m=new mt(new(f>65535?Uint32Array:Uint16Array)(f),1),v=new mt(new Float32Array(3*p),3),g=new mt(new Float32Array(3*p),3),y=new mt(new Float32Array(2*p),2),_=0,b=0,x=[],w=n/2,M=0;!function(){var r,a,l=new h,d=new h,p=0,f=(e-t)/n;for(a=0;a<=o;a++){var E=[],T=a/o,S=T*(e-t)+t;for(r=0;r<=i;r++){var A=r/i,L=A*c+s,R=Math.sin(L),C=Math.cos(L);d.x=S*R,d.y=-T*n+w,d.z=S*C,v.setXYZ(_,d.x,d.y,d.z),l.set(R,f,C).normalize(),g.setXYZ(_,l.x,l.y,l.z),y.setXY(_,A,1-T),E.push(_),_++}x.push(E)}for(r=0;r<i;r++)for(a=0;a<o;a++){var P=x[a][r],O=x[a+1][r],I=x[a+1][r+1],U=x[a][r+1];m.setX(b,P),b++,m.setX(b,O),b++,m.setX(b,U),b++,m.setX(b,O),b++,m.setX(b,I),b++,m.setX(b,U),b++,p+=6}u.addGroup(M,p,0),M+=p}(),!1===a&&(t>0&&l(!0),e>0&&l(!1)),this.setIndex(m),this.addAttribute("position",v),this.addAttribute("normal",g),this.addAttribute("uv",y)}function sn(t,e,n,i,r,o,a,s){St.call(this),this.type="CylinderGeometry",this.parameters={radiusTop:t,radiusBottom:e,height:n,radialSegments:i,heightSegments:r,openEnded:o,thetaStart:a,thetaLength:s},this.fromBufferGeometry(new an(t,e,n,i,r,o,a,s)),this.mergeVertices()}function cn(t,e,n,i,r,o,a){sn.call(this,0,t,e,n,i,r,o,a),this.type="C
1oneGeometry",this.parameters={radius:t,height:e,radialSegments:n,heightSegments:i,openEnded:r,thetaStart:o,thetaLength:a}}function ln(t,e,n,i,r,o,a){an.call(this,0,t,e,n,i,r,o,a),this.type="ConeBufferGeometry",this.parameters={radius:t,height:e,radialSegments:n,heightSegments:i,openEnded:r,thetaStart:o,thetaLength:a}}function hn(t,e,n,i){Lt.call(this),this.type="CircleBufferGeometry",this.parameters={radius:t,segments:e,thetaStart:n,thetaLength:i},t=t||50,e=void 0!==e?Math.max(3,e):8,n=void 0!==n?n:0,i=void 0!==i?i:2*Math.PI;var r=e+2,o=new Float32Array(3*r),a=new Float32Array(3*r),s=new Float32Array(2*r);a[2]=1,s[0]=.5,s[1]=.5;for(var c=0,l=3,u=2;c<=e;c++,l+=3,u+=2){var d=n+c/e*i;o[l]=t*Math.cos(d),o[l+1]=t*Math.sin(d),a[l+2]=1,s[u]=(o[l]/t+1)/2,s[u+1]=(o[l+1]/t+1)/2}for(var p=[],l=1;l<=e;l++)p.push(l,l+1,0);this.setIndex(new mt(new Uint16Array(p),1)),this.addAttribute("position",new mt(o,3)),this.addAttribute("normal",new mt(a,3)),this.addAttribute("uv",new mt(s,2)),this.boundingSphere=new nt(new h,t)}function un(t,e,n,i){St.call(this),this.type="CircleGeometry",this.parameters={radius:t,segments:e,thetaStart:n,thetaLength:i},this.fromBufferGeometry(new hn(t,e,n,i))}function dn(t,e,n,i,r,o){St.call(this),this.type="BoxGeometry",this.parameters={width:t,height:e,depth:n,widthSegments:i,heightSegments:r,depthSegments:o},this.fromBufferGeometry(new Ct(t,e,n,i,r,o)),this.mergeVertices()}function pn(){$.call(this,{uniforms:ba.merge([Ma.lights,{opacity:{value:1}}]),vertexShader:xa.shadow_vert,fragmentShader:xa.shadow_frag}),this.lights=!0,this.transparent=!0,Object.defineProperties(this,{opacity:{enumerable:!0,get:function(){return this.uniforms.opacity.value},set:function(t){this.uniforms.opacity.value=t}}})}function fn(t){$.call(this,t),this.type="RawShaderMaterial"}function mn(t){this.uuid=pa.generateUUID(),this.type="MultiMaterial",this.materials=Array.isArray(t)?t:[],this.visible=!0}function vn(t){K.call(this),this.defines={STANDARD:""},this.type="MeshStandardMaterial",this.color=new q(16777215),this.roughness=.5,this.metalness=.5,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new q(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalScale=new r(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapIntensity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(t)}function gn(t){vn.call(this),this.defines={PHYSICAL:""},this.type="MeshPhysicalMaterial",this.reflectivity=.5,this.clearCoat=0,this.clearCoatRoughness=0,this.setValues(t)}function yn(t){K.call(this),this.type="MeshPhongMaterial",this.color=new q(16777215),this.specular=new q(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new q(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalScale=new r(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=Qr,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(t)}function _n(t){yn.call(this),this.defines={TOON:""},this.type="MeshToonMaterial",this.gradientMap=null,this.setValues(t)}function bn(t){K.call(this,t),this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalScale=new r(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(t)}function xn(t){K.call(this),this.type="MeshLambertMaterial",this.color=new q(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new q(0),this.emissiveIntensity=1,this.emissiveMap=null,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=Qr,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(t)}
1function wn(t){K.call(this),this.type="LineDashedMaterial",this.color=new q(16777215),this.linewidth=1,this.scale=1,this.dashSize=3,this.gapSize=1,this.lights=!1,this.setValues(t)}function Mn(t,e,n){var i=this,r=!1,o=0,a=0;this.onStart=void 0,this.onLoad=t,this.onProgress=e,this.onError=n,this.itemStart=function(t){a++,!1===r&&void 0!==i.onStart&&i.onStart(t,o,a),r=!0},this.itemEnd=function(t){o++,void 0!==i.onProgress&&i.onProgress(t,o,a),o===a&&(r=!1,void 0!==i.onLoad&&i.onLoad())},this.itemError=function(t){void 0!==i.onError&&i.onError(t)}}function En(t){this.manager=void 0!==t?t:Ia}function Tn(t){this.manager=void 0!==t?t:Ia,this._parser=null}function Sn(t){this.manager=void 0!==t?t:Ia,this._parser=null}function An(t){this.manager=void 0!==t?t:Ia}function Ln(t){this.manager=void 0!==t?t:Ia}function Rn(t){this.manager=void 0!==t?t:Ia}function Cn(t,e){ht.call(this),this.type="Light",this.color=new q(t),this.intensity=void 0!==e?e:1,this.receiveShadow=void 0}function Pn(t,e,n){Cn.call(this,t,n),this.type="HemisphereLight",this.castShadow=void 0,this.position.copy(ht.DefaultUp),this.updateMatrix(),this.groundColor=new q(e)}function On(t){this.camera=t,this.bias=0,this.radius=1,this.mapSize=new r(512,512),this.map=null,this.matrix=new u}function In(){On.call(this,new It(50,1,.5,500))}function Un(t,e,n,i,r,o){Cn.call(this,t,e),this.type="SpotLight",this.position.copy(ht.DefaultUp),this.updateMatrix(),this.target=new ht,Object.defineProperty(this,"power",{get:function(){return this.intensity*Math.PI},set:function(t){this.intensity=t/Math.PI}}),this.distance=void 0!==n?n:0,this.angle=void 0!==i?i:Math.PI/3,this.penumbra=void 0!==r?r:0,this.decay=void 0!==o?o:1,this.shadow=new In}function Nn(t,e,n,i){Cn.call(this,t,e),this.type="PointLight",Object.defineProperty(this,"power",{get:function(){return 4*this.intensity*Math.PI},set:function(t){this.intensity=t/(4*Math.PI)}}),this.distance=void 0!==n?n:0,this.decay=void 0!==i?i:1,this.shadow=new On(new It(90,1,.5,500))}function Dn(t){On.call(this,new Ut(-5,5,5,-5,.5,500))}function Fn(t,e){Cn.call(this,t,e),this.type="DirectionalLight",this.position.copy(ht.DefaultUp),this.updateMatrix(),this.target=new ht,this.shadow=new Dn}function zn(t,e){Cn.call(this,t,e),this.type="AmbientLight",this.castShadow=void 0}function Bn(t,e,n,i){this.parameterPositions=t,this._cachedIndex=0,this.resultBuffer=void 0!==i?i:new e.constructor(n),this.sampleValues=e,this.valueSize=n}function kn(t,e,n,i){Bn.call(this,t,e,n,i),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0}function jn(t,e,n,i){Bn.call(this,t,e,n,i)}function Gn(t,e,n,i){Bn.call(this,t,e,n,i)}function Hn(t,e,n,i){if(void 0===t)throw new Error("track name is undefined");if(void 0===e||0===e.length)throw new Error("no keyframes in track named "+t);this.name=t,this.times=Ua.convertArray(e,this.TimeBufferType),this.values=Ua.convertArray(n,this.ValueBufferType),this.setInterpolation(i||this.DefaultInterpolation),this.validate(),this.optimize()}function Vn(t,e,n,i){Hn.call(this,t,e,n,i)}function Wn(t,e,n,i){Bn.call(this,t,e,n,i)}function Xn(t,e,n,i){Hn.call(this,t,e,n,i)}function qn(t,e,n,i){Hn.call(this,t,e,n,i)}function Yn(t,e,n,i){Hn.call(this,t,e,n,i)}function Zn(t,e,n){Hn.call(this,t,e,n)}function Jn(t,e,n,i){Hn.call(this,t,e,n,i)}function Qn(t,e,n,i){Hn.apply(this,arguments)}function Kn(t,e,n){this.name=t,this.tracks=n,this.duration=void 0!==e?e:-1,this.uuid=pa.generateUUID(),this.duration<0&&this.resetDuration(),this.optimize()}function $n(t){this.manager=void 0!==t?t:Ia,this.textures={}}function ti(t){this.manager=void 0!==t?t:Ia}function ei(){this.onLoadStart=function(){},this.onLoadProgress=function(){},this.onLoadComplete=function(){}}function ni(t){"boolean"===typeof t&&(console.warn("THREE.JSONLoader: showStatus parameter has been removed from constructor."),t=void 0),this.manager=void 0!==t?t:Ia,this.withCredentials=!1}function ii(t){this.manager=void 0!==t?t:Ia,this.texturePath=""}function ri(){}function oi(t,e){this.v1=t,this.v2=e}function ai(){this.curves=[],this.autoClose=!1}function si(t,e,n,i,r,o,a,s){this.aX=t,this.aY=e,this.xRadius=n,this.yRadius=i,this.aStartAngle=r,this.aEndAngle=o,this.aClockwise=a,this.aRotation=s||0}function ci(t){this.points=void 0===t?[]:t}function li(t,e,n,i){this.v0=t,this.v1=e,this.v2=n,this.v3=i}function hi(t,e,n){this.v0=t,this.v1=e,this.v2=n}function ui(){di.apply(this,arguments),this.holes=[]}function di(t){ai.call(this),this.currentPoint=new r,t&&this.fromPoints(t)}function pi(){this.subPaths=[],this.currentPath=null}function fi(t){this.data=t}function mi(t){this.manager=void 0!==t?t:Ia}function vi(t){this.manager=void 0!==t?t:Ia}function gi(t,e,n,i){Cn.call(this,t,e),this.type="RectAreaLight",this.position.set(0,1,0),this.updateMatrix(),this.width=void 0!==n?n:10,this.height=void 0!==i?i:10}function yi(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new It,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new It,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1}function _i(t,e,n){ht.call(this),this.type="CubeCamera";var i=new It(90,1,t,e);i.up.set(0,-1,0),i.lookAt(new h(1,0,0)),this.add(i);var r=new It(90,1,t,e);r.up.set(0,-1,0),r.lookAt(new h(-1,0,0)),this.add(r);var o=new It(90,1,t,e);o.up.set(0,0,1),o.lookAt(new h(0,1,0)),this.add(o);var a=new It(90,1,t,e);a.up.set(0,0,-1),a.lookAt(new h(0,-1,0)),this.add(a);var s=new It(90,1,t,e);s.up.set(0,-1,0),s.lookAt(new h(0,0,1)),this.add(s);var l=new It(90,1,t,e);l.up.set(0,-1,0),l.lookAt(new h(0,0,-1)),this.add(l);var u={format:zo,magFilter:xo,minFilter:xo};this.renderTarget=new c(n,n,u),this.updateCubeMap=function(t,e){null===this.parent&&this.updateMatrixWorld();var n=this.renderTarget,c=n.texture.generateMipmaps;n.texture.generateMipmaps=!1,n.activeCubeFace=0,t.render(e,i,n),n.activeCubeFace=1,t.render(e,r,n),n.activeCubeFace=2,t.render(e,o,n),n.activeCubeFace=3,t.render(e,a,n),n.activeCubeFace=4,t.render(e,s,n),n.texture.generateMipmaps=c,n.activeCubeFace=5,t.render(e,l,n),t.setRenderTarget(null)}}function bi(){ht.call(this),this.type="AudioListener",this.context=Ba.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null}function xi(t){ht.call(this),this.type="Audio",this.context=t.context,this.gain=this.context.createGain(),this.gain.connect(t.getIn
1put()),this.autoplay=!1,this.buffer=null,this.loop=!1,this.startTime=0,this.playbackRate=1,this.isPlaying=!1,this.hasPlaybackControl=!0,this.sourceType="empty",this.filters=[]}function wi(t){xi.call(this,t),this.panner=this.context.createPanner(),this.panner.connect(this.gain)}function Mi(t,e){this.analyser=t.context.createAnalyser(),this.analyser.fftSize=void 0!==e?e:2048,this.data=new Uint8Array(this.analyser.frequencyBinCount),t.getOutput().connect(this.analyser)}function Ei(t,e,n){this.binding=t,this.valueSize=n;var i,r=Float64Array;switch(e){case"quaternion":i=this._slerp;break;case"string":case"bool":r=Array,i=this._select;break;default:i=this._lerp}this.buffer=new r(4*n),this._mixBufferRegion=i,this.cumulativeWeight=0,this.useCount=0,this.referenceCount=0}function Ti(t,e,n){this.path=e,this.parsedPath=n||Ti.parseTrackName(e),this.node=Ti.findNode(t,this.parsedPath.nodeName)||t,this.rootNode=t}function Si(t){this.uuid=pa.generateUUID(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;var e={};this._indicesByUUID=e;for(var n=0,i=arguments.length;n!==i;++n)e[arguments[n].uuid]=n;this._paths=[],this._parsedPaths=[],this._bindings=[],this._bindingsIndicesByPath={};var r=this;this.stats={objects:{get total(){return r._objects.length},get inUse(){return this.total-r.nCachedObjects_}},get bindingsPerObject(){return r._bindings.length}}}function Ai(t,e,n){this._mixer=t,this._clip=e,this._localRoot=n||null;for(var i=e.tracks,r=i.length,o=new Array(r),a={endingStart:ta,endingEnd:ta},s=0;s!==r;++s){var c=i[s].createInterpolant(null);o[s]=c,c.settings=a}this._interpolantSettings=a,this._interpolants=o,this._propertyBindings=new Array(r),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=$o,this._loopCount=-1,this._startTime=null,this.time=0,this.timeScale=1,this._effectiveTimeScale=1,this.weight=1,this._effectiveWeight=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtStart=!0,this.zeroSlopeAtEnd=!0}function Li(t){this._root=t,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}function Ri(t){"string"===typeof t&&(console.warn("THREE.Uniform: Type parameter is no longer needed."),t=arguments[1]),this.value=t}function Ci(){Lt.call(this),this.type="InstancedBufferGeometry",this.maxInstancedCount=void 0}function Pi(t,e,n,i){this.uuid=pa.generateUUID(),this.data=t,this.itemSize=e,this.offset=n,this.normalized=!0===i}function Oi(t,e){this.uuid=pa.generateUUID(),this.array=t,this.stride=e,this.count=void 0!==t?t.length/e:0,this.dynamic=!1,this.updateRange={offset:0,count:-1},this.onUploadCallback=function(){},this.version=0}function Ii(t,e,n){Oi.call(this,t,e),this.meshPerAttribute=n||1}function Ui(t,e,n){mt.call(this,t,e),this.meshPerAttribute=n||1}function Ni(t,e,n,i){this.ray=new st(t,e),this.near=n||0,this.far=i||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 Di(t,e){return t.distance-e.distance}function Fi(t,e,n,i){if(!1!==t.visible&&(t.raycast(e,n),!0===i))for(var r=t.children,o=0,a=r.length;o<a;o++)Fi(r[o],e,n,!0)}function zi(t){this.autoStart=void 0===t||t,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}function Bi(t,e,n){return this.radius=void 0!==t?t:1,this.phi=void 0!==e?e:0,this.theta=void 0!==n?n:0,this}function ki(t,e,n){return this.radius=void 0!==t?t:1,this.theta=void 0!==e?e:0,this.y=void 0!==n?n:0,this}function ji(t,e){Rt.call(this,t,e),this.animationsMap={},this.animationsList=[];var n=this.geometry.morphTargets.length,i=n-1,r=n/1;this.createAnimation("__default",0,i,r),this.setAnimationWeight("__default",1)}function Gi(t){ht.call(this),this.material=t,this.render=function(t){}}function Hi(t,e,n,i){this.object=t,this.size=void 0!==e?e:1;var r=void 0!==n?n:16711680,o=void 0!==i?i:1,a=0,s=this.object.geometry;s&&s.isGeometry?a=3*s.faces.length:s&&s.isBufferGeometry&&(a=s.attributes.normal.count);
1var c=new Lt,l=new Mt(2*a*3,3);c.addAttribute("position",l),be.call(this,c,new ye({color:r,linewidth:o})),this.matrixAutoUpdate=!1,this.update()}function Vi(t){ht.call(this),this.light=t,this.light.updateMatrixWorld(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1;for(var e=new Lt,n=[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],i=0,r=1;i<32;i++,r++){var o=i/32*Math.PI*2,a=r/32*Math.PI*2;n.push(Math.cos(o),Math.sin(o),1,Math.cos(a),Math.sin(a),1)}e.addAttribute("position",new Mt(n,3));var s=new ye({fog:!1});this.cone=new be(e,s),this.add(this.cone),this.update()}function Wi(t){this.bones=this.getBoneList(t);for(var e=new Lt,n=[],i=[],r=new q(0,0,1),o=new q(0,1,0),a=0;a<this.bones.length;a++){var s=this.bones[a];s.parent&&s.parent.isBone&&(n.push(0,0,0),n.push(0,0,0),i.push(r.r,r.g,r.b),i.push(o.r,o.g,o.b))}e.addAttribute("position",new Mt(n,3)),e.addAttribute("color",new Mt(i,3));var c=new ye({vertexColors:_r,depthTest:!1,depthWrite:!1,transparent:!0});be.call(this,e,c),this.root=t,this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.update()}function Xi(t,e){this.light=t,this.light.updateMatrixWorld();var n=new Ze(e,4,2),i=new ft({wireframe:!0,fog:!1});i.color.copy(this.light.color).multiplyScalar(this.light.intensity),Rt.call(this,n,i),this.matrix=this.light.matrixWorld,this.matrixAutoUpdate=!1}function qi(t){ht.call(this),this.light=t,this.light.updateMatrixWorld();var e=new ft({color:t.color,fog:!1}),n=new ft({color:t.color,fog:!1,wireframe:!0}),i=new Lt;i.addAttribute("position",new mt(new Float32Array(18),3)),this.add(new Rt(i,e)),this.add(new Rt(i,n)),this.update()}function Yi(t,e){ht.call(this),this.light=t,this.light.updateMatrixWorld(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1;var n=new Ue(e);n.rotateY(.5*Math.PI);var i=new ft({vertexColors:_r,wireframe:!0}),r=n.getAttribute("position"),o=new Float32Array(3*r.count);n.addAttribute("color",new mt(o,3)),this.add(new Rt(n,i)),this.update()}function Zi(t,e,n,i){t=t||10,e=e||10,n=new q(void 0!==n?n:4473924),i=new q(void 0!==i?i:8947848);for(var r=e/2,o=2*t/e,a=[],s=[],c=0,l=0,h=-t;c<=e;c++,h+=o){a.push(-t,0,h,t,0,h),a.push(h,0,-t,h,0,t);var u=c===r?n:i;u.toArray(s,l),l+=3,u.toArray(s,l),l+=3,u.toArray(s,l),l+=3,u.toArray(s,l),l+=3}var d=new Lt;d.addAttribute("position",new Mt(a,3)),d.addAttribute("color",new Mt(s,3));var p=new ye({vertexColors:_r});be.call(this,d,p)}function Ji(t,e,n,i,r,o){t=t||10,e=e||16,n=n||8,i=i||64,r=new q(void 0!==r?r:4473924),o=new q(void 0!==o?o:8947848);var a,s,c,l,h,u,d,p=[],f=[];for(l=0;l<=e;l++)c=l/e*(2*Math.PI),a=Math.sin(c)*t,s=Math.cos(c)*t,p.push(0,0,0),p.push(a,0,s),d=1&l?r:o,f.push(d.r,d.g,d.b),f.push(d.r,d.g,d.b);for(l=0;l<=n;l++)for(d=1&l?r:o,u=t-t/n*l,h=0;h<i;h++)c=h/i*(2*Math.PI),a=Math.sin(c)*u,s=Math.cos(c)*u,p.push(a,0,s),f.push(d.r,d.g,d.b),c=(h+1)/i*(2*Math.PI),a=Math.sin(c)*u,s=Math.cos(c)*u,p.push(a,0,s),f.push(d.r,d.g,d.b);var m=new Lt;m.addAttribute("position",new Mt(p,3)),m.addAttribute("color",new Mt(f,3));var v=new ye({vertexColors:_r});be.call(this,m,v)}function Qi(t,e,n,i){this.object=t,this.size=void 0!==e?e:1;var r=void 0!==n?n:16776960,o=void 0!==i?i:1,a=0,s=this.object.geometry;s&&s.isGeometry?a=s.faces.length:console.warn("THREE.FaceNormalsHelper: only THREE.Geometry is supported. Use THREE.VertexNormalsHelper, instead.");var c=new Lt,l=new Mt(2*a*3,3);c.addAttribute("position",l),be.call(this,c,new ye({color:r,linewidth:o})),this.matrixAutoUpdate=!1,this.update()}function Ki(t,e){ht.call(this),this.light=t,this.light.updateMatrixWorld(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,void 0===e&&(e=1);var n=new Lt;n.addAttribute("position",new Mt([-e,e,0,e,e,0,e,-e,0,-e,-e,0,-e,e,0],3));var i=new ye({fog:!1});this.add(new _e(n,i)),n=new Lt,n.addAttribute("position",new Mt([0,0,0,0,0,1],3)),this.add(new _e(n,i)),this.update()}function $i(t){function e(t,e,i){n(t,i),n(e,i)}function n(t,e){o.push(0,0,0),a.push(e.r,e.g,e.b),void 0===s[t]&&(s[t]=[]),s[t].push(o.length/3-1)}var i=new Lt,r=new ye({color:16777215,vertexColors:yr}),o=[],a=[],s={},c=new q(16755200),l=new q(16711680),h=new q(43775),u=new q(16777215),d=new q(3355443);e("n1","n2",c),e("n2","n4",c),e("n4","n3",c),e("n3","n1",c),e("f1","f2",c),e("f2","f4",c),e("f4","f3",c),e("f3","f1",c),e("n1","f1",c),e("n2","f2",c),e("n3","f3",c),e("n4","f4",c),e("p","n1",l),e("p","n2",l),e("p","n3",l),e("p","n4",l),e("u1","u2",h),e("u2","u3",h),e("u3","u1",h),e("c","t",u),e("p","c",d),e("cn1","cn2",d),e("cn3","cn4",d),e("cf1","cf2",d),e("cf3","cf4",d),i.addAttribute("position",new Mt(o,3)),i.addAttribute("color",new Mt(a,3)),be.call(this,i,r),this.camera=t,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=s,this.update()}function tr(t,e){void 0===e&&(e=16776960);var n=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]),i=new Float32Array(24),r=new Lt;r.setIndex(new mt(n,1)),r.addAttribute("position",new mt(i,3)),be.call(this,r,new ye({color:e})),void 0!==t&&this.update(t)}function er(t,e,n,i,r,o){ht.call(this),void 0===i&&(i=16776960),void 0===n&&(n=1),void 0===r&&(r=.2*n),void 0===o&&(o=.2*r),this.position.copy(e),this.line=new _e(ka,new ye({color:i})),this.line.matrixAutoUpdate=!1,this.add(this.line),this.cone=new Rt(ja,new ft({color:i})),this.cone.matrixAutoUpdate=!1,this.add(this.cone),this.setDirection(t),this.setLength(n,r,o)}function nr(t){t=t||1;var e=[0,0,0,t,0,0,0,0,0,0,t,0,0,0,0,0,0,t],n=[1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],i=new Lt;i.addAttribute("position",new Mt(e,3)),i.addAttribute("color",new Mt(n,3));var r=new ye({vertexColors:_r});be.call(this,i,r)}function ir(t,e,n,i,r,o){si.call(this,t,e,n,n,i,r,o)}function rr(t){console.warn("THREE.ClosedSplineCurve3 has been deprecated. Use THREE.CatmullRomCurve3 instead."),Ga.call(this,t),this.type="catmullrom",this.closed=!0}n.d(e,"h",function(){return se}),n.d(e,"f",function(){return he}),n.d(e,"b",function(){return Rt}),n.d(e,"g",function(){return Un}),n.d(e,"e",function(){return It}),n.d(e,"a",function(){return dn}),n.d(e,"c",function(){return yn}),n.d(e,"d",function(){return ur}),void 0===Number.EPSILON&&(Number.EPSILON=Math.pow(2,-52)),void 0===Math.sign&&(Math.sign=function(t){return t<0?-1:t>0?1:+t}),void 0===Function.prototype.name&&Object.defineProperty(Function.prototype,"name",{get:function(){return this.toString().match(/^\s*function\s*([^\(\s]*)/)[1]}}),void 0===Object.assign&&function(){Object.assign=function(t){if(void 0===t||null===t)throw new TypeError("Cannot convert undefined or null to object");for(var e=Object(t),n=1;n<arguments.length;n++){var i=arguments[n];if(void 0!==i&&null!==i)for(var r in i)Object.prototype.hasOwnProperty.call(i,r)&&(e[r]=i[r])}return e}}(),Object.assign(i.prototype,{addEventListener:function(t,e){void 0===this._listeners&&(this._listeners={});var n=this._listeners;void 0===n[t]&&(n[t]=[]),-1===n[t].indexOf(e)&&n[t].push(e)},hasEventListener:function(t,e){if(void 0===this._listeners)return!1;var n=this._listeners;return void 0!==n[t]&&-1!==n[t].indexOf(e)},removeEventListener:function(t,e){if(void 0!==this._listeners){var n=this._listeners,i=n[t];if(void 0!==i){var r=i.indexOf(e);-1!==r&&i.splice(r,1)}}},dispatchEvent:function(t){if(void 0!==this._listeners){var e=this._listeners,n=e[t.type];if(void 0!==n){t.target=this;var i=[],r=0,o=n.length;for(r=0;r<o;r++)i[r]=n[r];for(r=0;r<o;r++)i[r].call(this,t)}}}});var or="83",ar=0,sr=1,cr=2,lr=0,hr=1,ur=2,dr=0,pr=1,fr=2,mr=1,vr=2,gr=0,yr=1,_r=2,br=0,xr=1,wr=2,Mr=3,Er=4,Tr=5,Sr={NoBlending:br,NormalBlending:xr,AdditiveBlending:wr,SubtractiveBlending:Mr,MultiplyBlending:Er,CustomBlending:Tr},Ar=100,Lr=101,Rr=102,Cr=103,Pr=104,Or=200,Ir=201,Ur=202,Nr=203,Dr=204,Fr=205,zr=206,Br=207,kr=208,jr=209,Gr=210,Hr=0,Vr=1,Wr=2,Xr=3,qr=4,Yr=5,Zr=6,Jr=7,Qr=0,Kr=1,$r=2,to=0,eo=1,no=2,io=3,ro=4,oo=301,ao=302,so=303,co=304,lo=305,ho=306,uo=307,po={UVMapping:300,CubeReflectionMapping:oo,CubeRefractionMapping:ao,EquirectangularReflectionMapping:so,EquirectangularRefractionMapping:co,SphericalReflectionMapping:lo,CubeUVReflectionMapping:ho,CubeUVRefractionMapping:uo},fo=1e3,mo=1001,vo=1002,go={RepeatWrapping:fo,ClampToEdgeWrapping:mo,MirroredRepeatWrapping:vo},yo=1003,_o=1004,bo=1005,xo=1006,wo=1007,Mo=1008,Eo={NearestFilter:yo,NearestMipMapNearestFilter:_o,NearestMipMapLinearFilter:bo,LinearFilter:xo,LinearMipMapNearestFilter:wo,LinearMipMapLinearFilter:Mo},To=1009,So=1010,Ao=1011,Lo=1012,Ro=1013,Co=1014,Po=1015,Oo=1016,Io=1017,Uo=1018,No=1019,Do=1020,Fo=1021,zo=1022,Bo=1023,ko=1024,jo=1025,Go=1026,Ho=1027,Vo=2001,Wo=2002,Xo=2003,qo=2004,Yo=2100,Zo=2101,Jo=2102,Qo=2103,
1Ko=2151,$o=2201,ta=2400,ea=0,na=1,ia=2,ra=3e3,oa=3001,aa=3007,sa=3002,ca=3004,la=3005,ha=3006,ua=3200,da=3201,pa={DEG2RAD:Math.PI/180,RAD2DEG:180/Math.PI,generateUUID:function(){var t,e="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""),n=new Array(36),i=0;return function(){for(var r=0;r<36;r++)8===r||13===r||18===r||23===r?n[r]="-":14===r?n[r]="4":(i<=2&&(i=33554432+16777216*Math.random()|0),t=15&i,i>>=4,n[r]=e[19===r?3&t|8:t]);return n.join("")}}(),clamp:function(t,e,n){return Math.max(e,Math.min(n,t))},euclideanModulo:function(t,e){return(t%e+e)%e},mapLinear:function(t,e,n,i,r){return i+(t-e)*(r-i)/(n-e)},lerp:function(t,e,n){return(1-n)*t+n*e},smoothstep:function(t,e,n){return t<=e?0:t>=n?1:(t=(t-e)/(n-e))*t*(3-2*t)},smootherstep:function(t,e,n){return t<=e?0:t>=n?1:(t=(t-e)/(n-e))*t*t*(t*(6*t-15)+10)},randInt:function(t,e){return t+Math.floor(Math.random()*(e-t+1))},randFloat:function(t,e){return t+Math.random()*(e-t)},randFloatSpread:function(t){return t*(.5-Math.random())},degToRad:function(t){return t*pa.DEG2RAD},radToDeg:function(t){return t*pa.RAD2DEG},isPowerOfTwo:function(t){return 0===(t&t-1)&&0!==t},nearestPowerOfTwo:function(t){return Math.pow(2,Math.round(Math.log(t)/Math.LN2))},nextPowerOfTwo:function(t){return t--,t|=t>>1,t|=t>>2,t|=t>>4,t|=t>>8,t|=t>>16,++t}};r.prototype={constructor:r,isVector2:!0,get width(){return this.x},set width(t){this.x=t},get height(){return this.y},set height(t){this.y=t},set:function(t,e){return this.x=t,this.y=e,this},setScalar:function(t){return this.x=t,this.y=t,this},setX:function(t){return this.x=t,this},setY:function(t){return this.y=t,this},setComponent:function(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;default:throw new Error("index is out of range: "+t)}return this},getComponent:function(t){switch(t){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+t)}},clone:function(){return new this.constructor(this.x,this.y)},copy:function(t){return this.x=t.x,this.y=t.y,this},add:function(t,e){return void 0!==e?(console.warn("THREE.Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,e)):(this.x+=t.x,this.y+=t.y,this)},addScalar:function(t){return this.x+=t,this.y+=t,this},addVectors:function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this},addScaledVector:function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this},sub:function(t,e){return void 0!==e?(console.warn("THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,e)):(this.x-=t.x,this.y-=t.y,this)},subScalar:function(t){return this.x-=t,this.y-=t,this},subVectors:function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this},multiply:function(t){return this.x*=t.x,this.y*=t.y,this},multiplyScalar:function(t){return isFinite(t)?(this.x*=t,this.y*=t):(this.x=0,this.y=0),this},divide:function(t){return this.x/=t.x,this.y/=t.y,this},divideScalar:function(t){return this.multiplyScalar(1/t)},min:function(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this},max:function(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this},clamp:function(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this},clampScalar:function(){var t,e;return function(n,i){return void 0===t&&(t=new r,e=new r),t.set(n,n),e.set(i,i),this.clamp(t,e)}}(),clampLength:function(t,e){var n=this.length();return this.multiplyScalar(Math.max(t,Math.min(e,n))/n)},floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},roundToZero:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this},negate:function(){return this.x=-this.x,this.y=-this.y,this},dot:function(t){return this.x*t.x+this.y*t.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 t=Math.atan2(this.y,this.x);return t<0&&(t+=2*Math.PI),t},distanceTo:function(t){return Math.sqrt(this.distanceToSquared(t))},distanceToSquared:function(t){var e=this.x-t.x,n=this.y-t.y;return e*e+n*n},distanceToManhattan:function(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)},setLength:function(t){return this.multiplyScalar(t/this.length())},lerp:function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this},lerpVectors:function(t,e,n){return this.subVectors(e,t).multiplyScalar(n).add(t)},equals:function(t){return t.x===this.x&&t.y===this.y},fromArray:function(t,e){return void 0===e&&(e=0),this.x=t[e],this.y=t[e+1],this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this.x,t[e+1]=this.y,t},fromAttribute:function(t,e,n){return void 0!==n&&console.warn("THREE.Vector2: offset has been removed from .fromAttribute()."),this.x=t.getX(e),this.y=t.getY(e),this}
1,rotateAround:function(t,e){var n=Math.cos(e),i=Math.sin(e),r=this.x-t.x,o=this.y-t.y;return this.x=r*n-o*i+t.x,this.y=r*i+o*n+t.y,this}};var fa=0;o.DEFAULT_IMAGE=void 0,o.DEFAULT_MAPPING=300,o.prototype={constructor:o,isTexture:!0,set needsUpdate(t){!0===t&&this.version++},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.image=t.image,this.mipmaps=t.mipmaps.slice(0),this.mapping=t.mapping,this.wrapS=t.wrapS,this.wrapT=t.wrapT,this.magFilter=t.magFilter,this.minFilter=t.minFilter,this.anisotropy=t.anisotropy,this.format=t.format,this.type=t.type,this.offset.copy(t.offset),this.repeat.copy(t.repeat),this.generateMipmaps=t.generateMipmaps,this.premultiplyAlpha=t.premultiplyAlpha,this.flipY=t.flipY,this.unpackAlignment=t.unpackAlignment,this.encoding=t.encoding,this},toJSON:function(t){if(void 0!==t.textures[this.uuid])return t.textures[this.uuid];var e={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 n=this.image;void 0===n.uuid&&(n.uuid=pa.generateUUID()),void 0===t.images[n.uuid]&&(t.images[n.uuid]={uuid:n.uuid,url:function(t){var e;return void 0!==t.toDataURL?e=t:(e=document.createElementNS("http://www.w3.org/1999/xhtml","canvas"),e.width=t.width,e.height=t.height,e.getContext("2d").drawImage(t,0,0,t.width,t.height)),e.width>2048||e.height>2048?e.toDataURL("image/jpeg",.6):e.toDataURL("image/png")}(n)}),e.image=n.uuid}return t.textures[this.uuid]=e,e},dispose:function(){this.dispatchEvent({type:"dispose"})},transformUv:function(t){if(300===this.mapping){if(t.multiply(this.repeat),t.add(this.offset),t.x<0||t.x>1)switch(this.wrapS){case fo:t.x=t.x-Math.floor(t.x);break;case mo:t.x=t.x<0?0:1;break;case vo:1===Math.abs(Math.floor(t.x)%2)?t.x=Math.ceil(t.x)-t.x:t.x=t.x-Math.floor(t.x)}if(t.y<0||t.y>1)switch(this.wrapT){case fo:t.y=t.y-Math.floor(t.y);break;case mo:t.y=t.y<0?0:1;break;case vo:1===Math.abs(Math.floor(t.y)%2)?t.y=Math.ceil(t.y)-t.y:t.y=t.y-Math.floor(t.y)}this.flipY&&(t.y=1-t.y)}}},Object.assign(o.prototype,i.prototype),a.prototype={constructor:a,isVector4:!0,set:function(t,e,n,i){return this.x=t,this.y=e,this.z=n,this.w=i,this},setScalar:function(t){return this.x=t,this.y=t,this.z=t,this.w=t,this},setX:function(t){return this.x=t,this},setY:function(t){return this.y=t,this},setZ:function(t){return this.z=t,this},setW:function(t){return this.w=t,this},setComponent:function(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;case 3:this.w=e;break;default:throw new Error("index is out of range: "+t)}return this},getComponent:function(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+t)}},clone:function(){return new this.constructor(this.x,this.y,this.z,this.w)},copy:function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=void 0!==t.w?t.w:1,this},add:function(t,e){return void 0!==e?(console.warn("THREE.Vector4: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,e)):(this.x+=t.x,this.y+=t.y,this.z+=t.z,this.w+=t.w,this)},addScalar:function(t){return this.x+=t,this.y+=t,this.z+=t,this.w+=t,this},addVectors:function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this.w=t.w+e.w,this},addScaledVector:function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this.w+=t.w*e,this},sub:function(t,e){return void 0!==e?(console.warn("THREE.Vector4: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,e)):(this.x-=t.x,this.y-=t.y,this.z-=t.z,this.w-=t.w,this)},subScalar:function(t){return this.x-=t,this.y-=t,this.z-=t,this.w-=t,this},subVectors:function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this.w=t.w-e.w,this},multiplyScalar:function(t){return isFinite(t)?(this.x*=t,this.y*=t,this.z*=t,this.w*=t):(this.x=0,this.y=0,this.z=0,this.w=0),this},applyMatrix4:function(t){var e=this.x,n=this.y,i=this.z,r=this.w,o=t.elements;
1return this.x=o[0]*e+o[4]*n+o[8]*i+o[12]*r,this.y=o[1]*e+o[5]*n+o[9]*i+o[13]*r,this.z=o[2]*e+o[6]*n+o[10]*i+o[14]*r,this.w=o[3]*e+o[7]*n+o[11]*i+o[15]*r,this},divideScalar:function(t){return this.multiplyScalar(1/t)},setAxisAngleFromQuaternion:function(t){this.w=2*Math.acos(t.w);var e=Math.sqrt(1-t.w*t.w);return e<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=t.x/e,this.y=t.y/e,this.z=t.z/e),this},setAxisAngleFromRotationMatrix:function(t){var e,n,i,r,o=t.elements,a=o[0],s=o[4],c=o[8],l=o[1],h=o[5],u=o[9],d=o[2],p=o[6],f=o[10];if(Math.abs(s-l)<.01&&Math.abs(c-d)<.01&&Math.abs(u-p)<.01){if(Math.abs(s+l)<.1&&Math.abs(c+d)<.1&&Math.abs(u+p)<.1&&Math.abs(a+h+f-3)<.1)return this.set(1,0,0,0),this;e=Math.PI;var m=(a+1)/2,v=(h+1)/2,g=(f+1)/2,y=(s+l)/4,_=(c+d)/4,b=(u+p)/4;return m>v&&m>g?m<.01?(n=0,i=.707106781,r=.707106781):(n=Math.sqrt(m),i=y/n,r=_/n):v>g?v<.01?(n=.707106781,i=0,r=.707106781):(i=Math.sqrt(v),n=y/i,r=b/i):g<.01?(n=.707106781,i=.707106781,r=0):(r=Math.sqrt(g),n=_/r,i=b/r),this.set(n,i,r,e),this}var x=Math.sqrt((p-u)*(p-u)+(c-d)*(c-d)+(l-s)*(l-s));return Math.abs(x)<.001&&(x=1),this.x=(p-u)/x,this.y=(c-d)/x,this.z=(l-s)/x,this.w=Math.acos((a+h+f-1)/2),this},min:function(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this.w=Math.min(this.w,t.w),this},max:function(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this.w=Math.max(this.w,t.w),this},clamp:function(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this.w=Math.max(t.w,Math.min(e.w,this.w)),this},clampScalar:function(){var t,e;return function(n,i){return void 0===t&&(t=new a,e=new a),t.set(n,n,n,n),e.set(i,i,i,i),this.clamp(t,e)}}(),floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this},roundToZero:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this.w=this.w<0?Math.ceil(this.w):Math.floor(this.w),this},negate:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this},dot:function(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.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(t){return this.multiplyScalar(t/this.length())},lerp:function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this.w+=(t.w-this.w)*e,this},lerpVectors:function(t,e,n){return this.subVectors(e,t).multiplyScalar(n).add(t)},equals:function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z&&t.w===this.w},fromArray:function(t,e){return void 0===e&&(e=0),this.x=t[e],this.y=t[e+1],this.z=t[e+2],this.w=t[e+3],this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t[e+3]=this.w,t},fromAttribute:function(t,e,n){return void 0!==n&&console.warn("THREE.Vector4: offset has been removed from .fromAttribute()."),this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this.w=t.getW(e),this}},Object.assign(s.prototype,i.prototype,{isWebGLRenderTarget:!0,setSize:function(t,e){this.width===t&&this.height===e||(this.width=t,this.height=e,this.dispose()),this.viewport.set(0,0,t,e),this.scissor.set(0,0,t,e)},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.width=t.width,this.height=t.height,this.viewport.copy(t.viewport),this.texture=t.texture.clone(),this.depthBuffer=t.depthBuffer,this.stencilBuffer=t.stencilBuffer,this.depthTexture=t.depthTexture,this},dispose:function(){this.dispatchEvent({type:"dispose"})}}),c.prototype=Object.create(s.prototype),c.prototype.constructor=c,c.prototype.isWebGLRenderTargetCube=!0,l.prototype={constructor:l,get x(){return this._x},set x(t){this._x=t,this.onChangeCallback()},get y(){return this._y},set y(t){this._y=t,this.onChangeCallback()},get z(){return this._z},set z(t){this._z=t,this.onChangeCallback()},get w(){return this._w},set w(t){this._w=t,this.onChangeCallback()},set:function(t,e,n,i){return this._x=t,this._y=e,this._z=n,this._w=i,this.onChangeCallback(),this},clone:function(){return new this.constructor(this._x,this._y,this._z,this._w)},copy:function(t){return this._x=t.x,this._y=t.y,this._z=t.z,this._w=t.w,this.onChangeCallback(),this},setFromEuler:function(t,e){if(!1===(t&&t.isEuler))throw new Error("THREE.Quaternion: .setFromEuler() now expects an Euler rotation rather than a Vector3 and order.");var n=Math.cos(t._x/2),i=Math.cos(t._y/2),r=Math.cos(t._z/2),o=Math.sin(t._x/2),a=Math.sin(t._y/2),s=Math.sin(t._z/2),c=t.order;return"XYZ"===c?(this._x=o*i*r+n*a*s,this._y=n*a*r-o*i*s,this._z=n*i*s+o*a*r,this._w=n*i*r-o*a*s):"YXZ"===c?(this._x=o*i*r+n*a*s,this._y=n*a*r-o*i*s,this._z=n*i*s-o*a*r,this._w=n*i*r+o*a*s):"ZXY"===c?(this._x=o*i*r-n*a*s,this._y=n*a*r+o*i*s,this._z=n*i*s+o*a*r,this._w=n*i*r-o*a*s):"ZYX"===c?(this._x=o*i*r-n*a*s,this._y=n*a*r+o*i*s,this._z=n*i*s-o*a*r,this._w=n*i*r+o*a*s):"YZX"===c?(this._x=o*i*r+n*a*s,this._y=n*a*r+o*i*s,this._z=n*i*s-o*a*r,this._w=n*i*r-o*a*s):"XZY"===c&&(this._x=o*i*r-n*a*s,this._y=n*a*r-o*i*s,this._z=n*i*s+o*a*r,this._w=n*i*r+o*a*s),!1!==e&&this.onChangeCallback(),this},setFromAxisAngle:function(t,e){var n=e/2,i=Math.sin(n);return this._x=t.x*i,this._y=t.y*i,this._z=t.z*i,this._w=Math.cos(n),this.onChangeCallback(),this},setFromRotationMatrix:function(t){var e,n=t.elements,i=n[0],r=n[4],o=n[8],a=n[1],s=n[5],c=n[9],l=n[2],h=n[6],u=n[10],d=i+s+u;return d>0?(e=.5/Math.sqrt(d+1),this._w=.25/e,this._x=(h-c)*e,this._y=(o-l)*e,this._z=(a-r)*e):i>s&&i>u?(e=2*Math.sqrt(1+i-s-u),this._w=(h-c)/e,this._x=.25*e,this._y=(r+a)/e,this._z=(o+l)/e):s>u?(e=2*Math.sqrt(1+s-i-u),this._w=(o-l)/e,this._x=(r+a)/e,this._y=.25*e,this._z=(c+h)/e):(e=2*Math.sqrt(1+u-i-s),this._w=(a-r)/e,this._x=(o+l)/e,this._y=(c+h)/e,this._z=.25*e),this.onChangeCallback(),this},setFromUnitVectors:function(){var t,e;return function(n,i){return void 0===t&&(t=new h),e=n.dot(i)+1,e<1e-6?(e=0,Math.abs(n.x)>
1Math.abs(n.z)?t.set(-n.y,n.x,0):t.set(0,-n.z,n.y)):t.crossVectors(n,i),this._x=t.x,this._y=t.y,this._z=t.z,this._w=e,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(t){return this._x*t._x+this._y*t._y+this._z*t._z+this._w*t._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 t=this.length();return 0===t?(this._x=0,this._y=0,this._z=0,this._w=1):(t=1/t,this._x=this._x*t,this._y=this._y*t,this._z=this._z*t,this._w=this._w*t),this.onChangeCallback(),this},multiply:function(t,e){return void 0!==e?(console.warn("THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead."),this.multiplyQuaternions(t,e)):this.multiplyQuaternions(this,t)},premultiply:function(t){return this.multiplyQuaternions(t,this)},multiplyQuaternions:function(t,e){var n=t._x,i=t._y,r=t._z,o=t._w,a=e._x,s=e._y,c=e._z,l=e._w;return this._x=n*l+o*a+i*c-r*s,this._y=i*l+o*s+r*a-n*c,this._z=r*l+o*c+n*s-i*a,this._w=o*l-n*a-i*s-r*c,this.onChangeCallback(),this},slerp:function(t,e){if(0===e)return this;if(1===e)return this.copy(t);var n=this._x,i=this._y,r=this._z,o=this._w,a=o*t._w+n*t._x+i*t._y+r*t._z;if(a<0?(this._w=-t._w,this._x=-t._x,this._y=-t._y,this._z=-t._z,a=-a):this.copy(t),a>=1)return this._w=o,this._x=n,this._y=i,this._z=r,this;var s=Math.sqrt(1-a*a);if(Math.abs(s)<.001)return this._w=.5*(o+this._w),this._x=.5*(n+this._x),this._y=.5*(i+this._y),this._z=.5*(r+this._z),this;var c=Math.atan2(s,a),l=Math.sin((1-e)*c)/s,h=Math.sin(e*c)/s;return this._w=o*l+this._w*h,this._x=n*l+this._x*h,this._y=i*l+this._y*h,this._z=r*l+this._z*h,this.onChangeCallback(),this},equals:function(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._w===this._w},fromArray:function(t,e){return void 0===e&&(e=0),this._x=t[e],this._y=t[e+1],this._z=t[e+2],this._w=t[e+3],this.onChangeCallback(),this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._w,t},onChange:function(t){return this.onChangeCallback=t,this},onChangeCallback:function(){}},Object.assign(l,{slerp:function(t,e,n,i){return n.copy(t).slerp(e,i)},slerpFlat:function(t,e,n,i,r,o,a){var s=n[i+0],c=n[i+1],l=n[i+2],h=n[i+3],u=r[o+0],d=r[o+1],p=r[o+2],f=r[o+3];if(h!==f||s!==u||c!==d||l!==p){var m=1-a,v=s*u+c*d+l*p+h*f,g=v>=0?1:-1,y=1-v*v;if(y>Number.EPSILON){var _=Math.sqrt(y),b=Math.atan2(_,v*g);m=Math.sin(m*b)/_,a=Math.sin(a*b)/_}var x=a*g;if(s=s*m+u*x,c=c*m+d*x,l=l*m+p*x,h=h*m+f*x,m===1-a){var w=1/Math.sqrt(s*s+c*c+l*l+h*h);s*=w,c*=w,l*=w,h*=w}}t[e]=s,t[e+1]=c,t[e+2]=l,t[e+3]=h}}),h.prototype={constructor:h,isVector3:!0,set:function(t,e,n){return this.x=t,this.y=e,this.z=n,this},setScalar:function(t){return this.x=t,this.y=t,this.z=t,this},setX:function(t){return this.x=t,this},setY:function(t){return this.y=t,this},setZ:function(t){return this.z=t,this},setComponent:function(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;default:throw new Error("index is out of range: "+t)}return this},getComponent:function(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+t)}},clone:function(){return new this.constructor(this.x,this.y,this.z)},copy:function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this},add:function(t,e){return void 0!==e?(console.warn("THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,e)):(this.x+=t.x,this.y+=t.y,this.z+=t.z,this)},addScalar:function(t){return this.x+=t,this.y+=t,this.z+=t,this},addVectors:function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this},addScaledVector:function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this},sub:function(t,e){return void 0!==e?(console.warn("THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,e)):(this.x-=t.x,this.y-=t.y,this.z-=t.z,this)},subScalar:function(t){return this.x-=t,this.y-=t,this.z-=t,this},subVectors:function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this},multiply:function(t,e){return void 0!==e?(console.warn("THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead."),this.multiplyVectors(t,e)):(this.x*=t.x,this.y*=t.y,this.z*=t.z,this)},multiplyScalar:function(t){return isFinite(t)?(this.x*=t,this.y*=t,this.z*=t):(this.x=0,this.y=0,this.z=0),this},multiplyVectors:function(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this},applyEuler:function(){var t;return function(e){return!1===(e&&e.isEuler)&&console.error("THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order."),void 0===t&&(t=new l),this.applyQuaternion(t.setFromEuler(e))}}(),applyAxisAngle:function(){var t;return function(e,n){return void 0===t&&(t=new l),this.applyQuaternion(t.setFromAxisAngle(e,n))}}(),applyMatrix3:function(t){var e=this.x,n=this.y,i=this.z,r=t.elements;return this.x=r[0]*e+r[3]*n+r[6]*i,this.y=r[1]*e+r[4]*n+r[7]*i,this.z=r[2]*e+r[5]*n+r[8]*i,this},applyMatrix4:function(t){var e=this.x,n=this.y,i=this.z,r=t.elements;return this.x=r[0]*e+r[4]*n+r[8]*i+r[12],this.y=r[1]*e+r[5]*n+r[9]*i+r[13],this.z=r[2]*e+r[6]*n+r[10]*i+r[14],this},applyProjection:function(t){var e=this.x,n=this.y,i=this.z,r=t.elements,o=1/(r[3]*e+r[7]*n+r[11]*i+r[15]);return this.x=(r[0]*e+r[4]*n+r[8]*i+r[12])*o,this.y=(r[1]*e+r[5]*n+r[9]*i+r[13])*o,this.z=(r[2]*e+r[6]*n+r[10]*i+r[14])*o,this},applyQuaternion:function(t){var e=this.x,n=this.y,i=this.z,r=t.x,o=t.y,a=t.z,s=t.w,c=s*e+o*i-a*n,l=s*n+a*e-r*i,h=s*i+r*n-o*e,u=-r*e-o*n-a*i;return this.x=c*s+u*-r+l*-a-h*-o,this.y=l*s+u*-o+h*-r-c*-a,this.z=h*s+u*-a+c*-o-l*-r,this},project:function(){var t;return function(e){return void 0===t&&(t=new u),t.multiplyMatrices(e.projectionMatrix,t.getInverse(e.matrixWorld)),this.applyProjection(t)}}(),unproject:function(){var t;return function(e){return void 0===t&&(t=new u),t.multiplyMatrices(e.matrixWorld,t.getInverse(e.projectionMatrix)),this.applyProjection(t)}}(),transformDirection:function(t){var e=this.x,n=this.y,i=this.z,r=t.elements;return this.x=r[0]*e+r[4]*n+r[8]*i,this.y=r[1]*e+r[5]*n+r[9]*i,this.z=r[2]*e+r[6]*n+r[10]*i,this.normalize()},divide:function(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this},divideScalar:function(t){return this.multiplyScalar(1/t)},min:function(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this},max:function(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this},clamp:function(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this},clampScalar:function(){var t,e;return function(n,i){return void 0===t&&(t=new h,e=new h),t.set(n,n,n),e.set(i,i,i),this.clamp(t,e)}}(),clampLength:function(t,e){var n=this.length();return this.multiplyScalar(Math.max(t,Math.min(e,n))/n)},floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}
1,round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this},roundToZero:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this},negate:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this},dot:function(t){return this.x*t.x+this.y*t.y+this.z*t.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(t){return this.multiplyScalar(t/this.length())},lerp:function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this},lerpVectors:function(t,e,n){return this.subVectors(e,t).multiplyScalar(n).add(t)},cross:function(t,e){if(void 0!==e)return console.warn("THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead."),this.crossVectors(t,e);var n=this.x,i=this.y,r=this.z;return this.x=i*t.z-r*t.y,this.y=r*t.x-n*t.z,this.z=n*t.y-i*t.x,this},crossVectors:function(t,e){var n=t.x,i=t.y,r=t.z,o=e.x,a=e.y,s=e.z;return this.x=i*s-r*a,this.y=r*o-n*s,this.z=n*a-i*o,this},projectOnVector:function(t){var e=t.dot(this)/t.lengthSq();return this.copy(t).multiplyScalar(e)},projectOnPlane:function(){var t;return function(e){return void 0===t&&(t=new h),t.copy(this).projectOnVector(e),this.sub(t)}}(),reflect:function(){var t;return function(e){return void 0===t&&(t=new h),this.sub(t.copy(e).multiplyScalar(2*this.dot(e)))}}(),angleTo:function(t){var e=this.dot(t)/Math.sqrt(this.lengthSq()*t.lengthSq());return Math.acos(pa.clamp(e,-1,1))},distanceTo:function(t){return Math.sqrt(this.distanceToSquared(t))},distanceToSquared:function(t){var e=this.x-t.x,n=this.y-t.y,i=this.z-t.z;return e*e+n*n+i*i},distanceToManhattan:function(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)+Math.abs(this.z-t.z)},setFromSpherical:function(t){var e=Math.sin(t.phi)*t.radius;return this.x=e*Math.sin(t.theta),this.y=Math.cos(t.phi)*t.radius,this.z=e*Math.cos(t.theta),this},setFromCylindrical:function(t){return this.x=t.radius*Math.sin(t.theta),this.y=t.y,this.z=t.radius*Math.cos(t.theta),this},setFromMatrixPosition:function(t){return this.setFromMatrixColumn(t,3)},setFromMatrixScale:function(t){var e=this.setFromMatrixColumn(t,0).length(),n=this.setFromMatrixColumn(t,1).length(),i=this.setFromMatrixColumn(t,2).length();return this.x=e,this.y=n,this.z=i,this},setFromMatrixColumn:function(t,e){if("number"===typeof t){console.warn("THREE.Vector3: setFromMatrixColumn now expects ( matrix, index ).");var n=t;t=e,e=n}return this.fromArray(t.elements,4*e)},equals:function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z},fromArray:function(t,e){return void 0===e&&(e=0),this.x=t[e],this.y=t[e+1],this.z=t[e+2],this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t},fromAttribute:function(t,e,n){return void 0!==n&&console.warn("THREE.Vector3: offset has been removed from .fromAttribute()."),this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this}},u.prototype={constructor:u,isMatrix4:!0,set:function(t,e,n,i,r,o,a,s,c,l,h,u,d,p,f,m){var v=this.elements;return v[0]=t,v[4]=e,v[8]=n,v[12]=i,v[1]=r,v[5]=o,v[9]=a,v[13]=s,v[2]=c,v[6]=l,v[10]=h,v[14]=u,v[3]=d,v[7]=p,v[11]=f,v[15]=m,this},identity:function(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this},clone:function(){return(new u).fromArray(this.elements)},copy:function(t){return this.elements.set(t.elements),this},copyPosition:function(t){var e=this.elements,n=t.elements;return e[12]=n[12],e[13]=n[13],e[14]=n[14],this},extractBasis:function(t,e,n){return t.setFromMatrixColumn(this,0),e.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this},makeBasis:function(t,e,n){return this.set(t.x,e.x,n.x,0,t.y,e.y,n.y,0,t.z,e.z,n.z,0,0,0,0,1),this},extractRotation:function(){var t;return function(e){void 0===t&&(t=new h);var n=this.elements,i=e.elements,r=1/t.setFromMatrixColumn(e,0).length(),o=1/t.setFromMatrixColumn(e,1).length(),a=1/t.setFromMatrixColumn(e,2).length();return n[0]=i[0]*r,n[1]=i[1]*r,n[2]=i[2]*r,n[4]=i[4]*o,n[5]=i[5]*o,n[6]=i[6]*o,n[8]=i[8]*a,n[9]=i[9]*a,n[10]=i[10]*a,this}}(),makeRotationFromEuler:function(t){!1===(t&&t.isEuler)&&console.error("THREE.Matrix: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.");var e=this.elements,n=t.x,i=t.y,r=t.z,o=Math.cos(n),a=Math.sin(n),s=Math.cos(i),c=Math.sin(i),l=Math.cos(r),h=Math.sin(r);if("XYZ"===t.order){var u=o*l,d=o*h,p=a*l,f=a*h;e[0]=s*l,e[4]=-s*h,e[8]=c,e[1]=d+p*c,e[5]=u-f*c,e[9]=-a*s,e[2]=f-u*c,e[6]=p+d*c,e[10]=o*s}else if("YXZ"===t.order){var m=s*l,v=s*h,g=c*l,y=c*h;e[0]=m+y*a,e[4]=g*a-v,e[8]=o*c,e[1]=o*h,e[5]=o*l,e[9]=-a,e[2]=v*a-g,e[6]=y+m*a,e[10]=o*s}else if("ZXY"===t.order){var m=s*l,v=s*h,g=c*l,y=c*h;e[0]=m-y*a,e[4]=-o*h,e[8]=g+v*a,e[1]=v+g*a,e[5]=o*l,e[9]=y-m*a,e[2]=-o*c,e[6]=a,e[10]=o*s}else if("ZYX"===t.order){var u=o*l,d=o*h,p=a*l,f=a*h;e[0]=s*l,e[4]=p*c-d,e[8]=u*c+f,e[1]=s*h,e[5]=f*c+u,e[9]=d*c-p,e[2]=-c,e[6]=a*s,e[10]=o*s}else if("YZX"===t.order){var _=o*s,b=o*c,x=a*s,w=a*c;e[0]=s*l,e[4]=w-_*h,e[8]=x*h+b,e[1]=h,e[5]=o*l,e[9]=-a*l,e[2]=-c*l,e[6]=b*h+x,e[10]=_-w*h}
1else if("XZY"===t.order){var _=o*s,b=o*c,x=a*s,w=a*c;e[0]=s*l,e[4]=-h,e[8]=c*l,e[1]=_*h+w,e[5]=o*l,e[9]=b*h-x,e[2]=x*h-b,e[6]=a*l,e[10]=w*h+_}return e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this},makeRotationFromQuaternion:function(t){var e=this.elements,n=t.x,i=t.y,r=t.z,o=t.w,a=n+n,s=i+i,c=r+r,l=n*a,h=n*s,u=n*c,d=i*s,p=i*c,f=r*c,m=o*a,v=o*s,g=o*c;return e[0]=1-(d+f),e[4]=h-g,e[8]=u+v,e[1]=h+g,e[5]=1-(l+f),e[9]=p-m,e[2]=u-v,e[6]=p+m,e[10]=1-(l+d),e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this},lookAt:function(){var t,e,n;return function(i,r,o){void 0===t&&(t=new h,e=new h,n=new h);var a=this.elements;return n.subVectors(i,r).normalize(),0===n.lengthSq()&&(n.z=1),t.crossVectors(o,n).normalize(),0===t.lengthSq()&&(n.z+=1e-4,t.crossVectors(o,n).normalize()),e.crossVectors(n,t),a[0]=t.x,a[4]=e.x,a[8]=n.x,a[1]=t.y,a[5]=e.y,a[9]=n.y,a[2]=t.z,a[6]=e.z,a[10]=n.z,this}}(),multiply:function(t,e){return void 0!==e?(console.warn("THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead."),this.multiplyMatrices(t,e)):this.multiplyMatrices(this,t)},premultiply:function(t){return this.multiplyMatrices(t,this)},multiplyMatrices:function(t,e){var n=t.elements,i=e.elements,r=this.elements,o=n[0],a=n[4],s=n[8],c=n[12],l=n[1],h=n[5],u=n[9],d=n[13],p=n[2],f=n[6],m=n[10],v=n[14],g=n[3],y=n[7],_=n[11],b=n[15],x=i[0],w=i[4],M=i[8],E=i[12],T=i[1],S=i[5],A=i[9],L=i[13],R=i[2],C=i[6],P=i[10],O=i[14],I=i[3],U=i[7],N=i[11],D=i[15];return r[0]=o*x+a*T+s*R+c*I,r[4]=o*w+a*S+s*C+c*U,r[8]=o*M+a*A+s*P+c*N,r[12]=o*E+a*L+s*O+c*D,r[1]=l*x+h*T+u*R+d*I,r[5]=l*w+h*S+u*C+d*U,r[9]=l*M+h*A+u*P+d*N,r[13]=l*E+h*L+u*O+d*D,r[2]=p*x+f*T+m*R+v*I,r[6]=p*w+f*S+m*C+v*U,r[10]=p*M+f*A+m*P+v*N,r[14]=p*E+f*L+m*O+v*D,r[3]=g*x+y*T+_*R+b*I,r[7]=g*w+y*S+_*C+b*U,r[11]=g*M+y*A+_*P+b*N,r[15]=g*E+y*L+_*O+b*D,this},multiplyToArray:function(t,e,n){var i=this.elements;return this.multiplyMatrices(t,e),n[0]=i[0],n[1]=i[1],n[2]=i[2],n[3]=i[3],n[4]=i[4],n[5]=i[5],n[6]=i[6],n[7]=i[7],n[8]=i[8],n[9]=i[9],n[10]=i[10],n[11]=i[11],n[12]=i[12],n[13]=i[13],n[14]=i[14],n[15]=i[15],this},multiplyScalar:function(t){var e=this.elements;return e[0]*=t,e[4]*=t,e[8]*=t,e[12]*=t,e[1]*=t,e[5]*=t,e[9]*=t,e[13]*=t,e[2]*=t,e[6]*=t,e[10]*=t,e[14]*=t,e[3]*=t,e[7]*=t,e[11]*=t,e[15]*=t,this},applyToVector3Array:function(){var t;return function(e,n,i){void 0===t&&(t=new h),void 0===n&&(n=0),void 0===i&&(i=e.length);for(var r=0,o=n;r<i;r+=3,o+=3)t.fromArray(e,o),t.applyMatrix4(this),t.toArray(e,o);return e}}(),applyToBufferAttribute:function(){var t;return function(e){void 0===t&&(t=new h);for(var n=0,i=e.count;n<i;n++)t.x=e.getX(n),t.y=e.getY(n),t.z=e.getZ(n),t.applyMatrix4(this),e.setXYZ(n,t.x,t.y,t.z);return e}}(),determinant:function(){var t=this.elements,e=t[0],n=t[4],i=t[8],r=t[12],o=t[1],a=t[5],s=t[9],c=t[13],l=t[2],h=t[6],u=t[10],d=t[14];return t[3]*(+r*s*h-i*c*h-r*a*u+n*c*u+i*a*d-n*s*d)+t[7]*(+e*s*d-e*c*u+r*o*u-i*o*d+i*c*l-r*s*l)+t[11]*(+e*c*h-e*a*d-r*o*h+n*o*d+r*a*l-n*c*l)+t[15]*(-i*a*l-e*s*h+e*a*u+i*o*h-n*o*u+n*s*l)},transpose:function(){var t,e=this.elements;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this},setPosition:function(t){var e=this.elements;return e[12]=t.x,e[13]=t.y,e[14]=t.z,this},getInverse:function(t,e){var n=this.elements,i=t.elements,r=i[0],o=i[1],a=i[2],s=i[3],c=i[4],l=i[5],h=i[6],u=i[7],d=i[8],p=i[9],f=i[10],m=i[11],v=i[12],g=i[13],y=i[14],_=i[15],b=p*y*u-g*f*u+g*h*m-l*y*m-p*h*_+l*f*_,x=v*f*u-d*y*u-v*h*m+c*y*m+d*h*_-c*f*_,w=d*g*u-v*p*u+v*l*m-c*g*m-d*l*_+c*p*_,M=v*p*h-d*g*h-v*l*f+c*g*f+d*l*y-c*p*y,E=r*b+o*x+a*w+s*M;if(0===E){var T="THREE.Matrix4.getInverse(): can't invert matrix, determinant is 0";if(!0===e)throw new Error(T);return console.warn(T),this.identity()}var S=1/E;return n[0]=b*S,n[1]=(g*f*s-p*y*s-g*a*m+o*y*m+p*a*_-o*f*_)*S,n[2]=(l*y*s-g*h*s+g*a*u-o*y*u-l*a*_+o*h*_)*S,n[3]=(p*h*s-l*f*s-p*a*u+o*f*u+l*a*m-o*h*m)*S,n[4]=x*S,n[5]=(d*y*s-v*f*s+v*a*m-r*y*m-d*a*_+r*f*_)*S,n[6]=(v*h*s-c*y*s-v*a*u+r*y*u+c*a*_-r*h*_)*S,n[7]=(c*f*s-d*h*s+d
1*a*u-r*f*u-c*a*m+r*h*m)*S,n[8]=w*S,n[9]=(v*p*s-d*g*s-v*o*m+r*g*m+d*o*_-r*p*_)*S,n[10]=(c*g*s-v*l*s+v*o*u-r*g*u-c*o*_+r*l*_)*S,n[11]=(d*l*s-c*p*s-d*o*u+r*p*u+c*o*m-r*l*m)*S,n[12]=M*S,n[13]=(d*g*a-v*p*a+v*o*f-r*g*f-d*o*y+r*p*y)*S,n[14]=(v*l*a-c*g*a-v*o*h+r*g*h+c*o*y-r*l*y)*S,n[15]=(c*p*a-d*l*a+d*o*h-r*p*h-c*o*f+r*l*f)*S,this},scale:function(t){var e=this.elements,n=t.x,i=t.y,r=t.z;return e[0]*=n,e[4]*=i,e[8]*=r,e[1]*=n,e[5]*=i,e[9]*=r,e[2]*=n,e[6]*=i,e[10]*=r,e[3]*=n,e[7]*=i,e[11]*=r,this},getMaxScaleOnAxis:function(){var t=this.elements,e=t[0]*t[0]+t[1]*t[1]+t[2]*t[2],n=t[4]*t[4]+t[5]*t[5]+t[6]*t[6],i=t[8]*t[8]+t[9]*t[9]+t[10]*t[10];return Math.sqrt(Math.max(e,n,i))},makeTranslation:function(t,e,n){return this.set(1,0,0,t,0,1,0,e,0,0,1,n,0,0,0,1),this},makeRotationX:function(t){var e=Math.cos(t),n=Math.sin(t);return this.set(1,0,0,0,0,e,-n,0,0,n,e,0,0,0,0,1),this},makeRotationY:function(t){var e=Math.cos(t),n=Math.sin(t);return this.set(e,0,n,0,0,1,0,0,-n,0,e,0,0,0,0,1),this},makeRotationZ:function(t){var e=Math.cos(t),n=Math.sin(t);return this.set(e,-n,0,0,n,e,0,0,0,0,1,0,0,0,0,1),this},makeRotationAxis:function(t,e){var n=Math.cos(e),i=Math.sin(e),r=1-n,o=t.x,a=t.y,s=t.z,c=r*o,l=r*a;return this.set(c*o+n,c*a-i*s,c*s+i*a,0,c*a+i*s,l*a+n,l*s-i*o,0,c*s-i*a,l*s+i*o,r*s*s+n,0,0,0,0,1),this},makeScale:function(t,e,n){return this.set(t,0,0,0,0,e,0,0,0,0,n,0,0,0,0,1),this},makeShear:function(t,e,n){return this.set(1,e,n,0,t,1,n,0,t,e,1,0,0,0,0,1),this},compose:function(t,e,n){return this.makeRotationFromQuaternion(e),this.scale(n),this.setPosition(t),this},decompose:function(){var t,e;return function(n,i,r){void 0===t&&(t=new h,e=new u);var o=this.elements,a=t.set(o[0],o[1],o[2]).length(),s=t.set(o[4],o[5],o[6]).length(),c=t.set(o[8],o[9],o[10]).length();this.determinant()<0&&(a=-a),n.x=o[12],n.y=o[13],n.z=o[14],e.elements.set(this.elements);var l=1/a,d=1/s,p=1/c;return e.elements[0]*=l,e.elements[1]*=l,e.elements[2]*=l,e.elements[4]*=d,e.elements[5]*=d,e.elements[6]*=d,e.elements[8]*=p,e.elements[9]*=p,e.elements[10]*=p,i.setFromRotationMatrix(e),r.x=a,r.y=s,r.z=c,this}}(),makeFrustum:function(t,e,n,i,r,o){var a=this.elements,s=2*r/(e-t),c=2*r/(i-n),l=(e+t)/(e-t),h=(i+n)/(i-n),u=-(o+r)/(o-r),d=-2*o*r/(o-r);return a[0]=s,a[4]=0,a[8]=l,a[12]=0,a[1]=0,a[5]=c,a[9]=h,a[13]=0,a[2]=0,a[6]=0,a[10]=u,a[14]=d,a[3]=0,a[7]=0,a[11]=-1,a[15]=0,this},makePerspective:function(t,e,n,i){var r=n*Math.tan(pa.DEG2RAD*t*.5),o=-r,a=o*e,s=r*e;return this.makeFrustum(a,s,o,r,n,i)},makeOrthographic:function(t,e,n,i,r,o){var a=this.elements,s=1/(e-t),c=1/(n-i),l=1/(o-r),h=(e+t)*s,u=(n+i)*c,d=(o+r)*l;return a[0]=2*s,a[4]=0,a[8]=0,a[12]=-h,a[1]=0,a[5]=2*c,a[9]=0,a[13]=-u,a[2]=0,a[6]=0,a[10]=-2*l,a[14]=-d,a[3]=0,a[7]=0,a[11]=0,a[15]=1,this},equals:function(t){for(var e=this.elements,n=t.elements,i=0;i<16;i++)if(e[i]!==n[i])return!1;return!0},fromArray:function(t,e){void 0===e&&(e=0);for(var n=0;n<16;n++)this.elements[n]=t[n+e];return this},toArray:function(t,e){void 0===t&&(t=[]),void 0===e&&(e=0);var n=this.elements;return t[e]=n[0],t[e+1]=n[1],t[e+2]=n[2],t[e+3]=n[3],t[e+4]=n[4],t[e+5]=n[5],t[e+6]=n[6],t[e+7]=n[7],t[e+8]=n[8],t[e+9]=n[9],t[e+10]=n[10],t[e+11]=n[11],t[e+12]=n[12],t[e+13]=n[13],t[e+14]=n[14],t[e+15]=n[15],t}},d.prototype=Object.create(o.prototype),d.prototype.constructor=d,d.prototype.isCubeTexture=!0,Object.defineProperty(d.prototype,"images",{get:function(){return this.image},set:function(t){this.image=t}});var ma=new o,va=new d,ga=[],ya=[];H.prototype.setValue=function(t,e){for(var n=this.seq,i=0,r=n.length;i!==r;++i){var o=n[i];o.setValue(t,e[o.id])}};var _a=/([\w\d_]+)(\])?(\[|\.)?/g;X.prototype.setValue=function(t,e,n){var i=this.map[e];void 0!==i&&i.setValue(t,n,this.renderer)},X.prototype.set=function(t,e,n){var i=this.map[n];void 0!==i&&i.setValue(t,e[n],this.renderer)},X.prototype.setOptional=function(t,e,n){var i=e[n];void 0!==i&&this.setValue(t,n,i)},X.upload=function(t,e,n,i){for(var r=0,o=e.length;r!==o;++r){var a=e[r],s=n[a.id];!1!==s.needsUpdate&&a.setValue(t,s.value,i)}},X.seqWithValue=function(t,e){for(var n=[],i=0,r=t.length;i!==r;++i){var o=t[i];o.id in e&&n.push(o)}return n};var ba={merge:function(t){for(var e={},n=0;n<t.length;n++){var i=this.clone(t[n]);for(var r in i)e[r]=i[r]}return e},clone:function(t){var e={};for(var n in t){e[n]={};for(var i in t[n]){var r=t[n][i];r&&(r.isColor||r.isMatrix3||r.isMatrix4||r.isVector2||r.isVector3||r.isVector4||r.isTexture)?e[n][i]=r.clone():Array.isArray(r)?e[n][i]=r.slice():e[n][i]=r}}return e}},xa={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
1( 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:"float 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 );
1\n\tfloat G = G_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\tfloat D = D_GGX( alpha, dotNH );\n\treturn F * ( G * D );\n}\nvec2 ltcTextureCoords( const in GeometricContext geometry, const in float roughness ) {\n\tconst float LUT_SIZE  = 64.0;\n\tconst float LUT_SCALE = (LUT_SIZE - 1.0)/LUT_SIZE;\n\tconst float LUT_BIAS  = 0.5/LUT_SIZE;\n\tvec3 N = geometry.normal;\n\tvec3 V = geometry.viewDir;\n\tvec3 P = geometry.position;\n\tfloat theta = acos( dot( N, V ) );\n\tvec2 uv = vec2(\n\t\tsqrt( saturate( roughness ) ),\n\t\tsaturate( theta / ( 0.5 * PI ) ) );\n\tuv = uv * LUT_SCALE + LUT_BIAS;\n\treturn uv;\n}\nvoid clipQuadToHorizon( inout vec3 L[5], out int n ) {\n\tint config = 0;\n\tif ( L[0].z > 0.0 ) config += 1;\n\tif ( L[1].z > 0.0 ) config += 2;\n\tif ( L[2].z > 0.0 ) config += 4;\n\tif ( L[3].z > 0.0 ) config += 8;\n\tn = 0;\n\tif ( config == 0 ) {\n\t} else if ( config == 1 ) {\n\t\tn = 3;\n\t\tL[1] = -L[1].z * L[0] + L[0].z * L[1];\n\t\tL[2] = -L[3].z * L[0] + L[0].z * L[3];\n\t} else if ( config == 2 ) {\n\t\tn = 3;\n\t\tL[0] = -L[0].z * L[1] + L[1].z * L[0];\n\t\tL[2] = -L[2].z * L[1] + L[1].z * L[2];\n\t} else if ( config == 3 ) {\n\t\tn = 4;\n\t\tL[2] = -L[2].z * L[1] + L[1].z * L[2];\n\t\tL[3] = -L[3].z * L[0] + L[0].z * L[3];\n\t} else if ( config == 4 ) {\n\t\tn = 3;\n\t\tL[0] = -L[3].z * L[2] + L[2].z * L[3];\n\t\tL[1] = -L[1].z * L[2] + L[2].z * L[1];\n\t} else if ( config == 5 ) {\n\t\tn = 0;\n\t} else if ( config == 6 ) {\n\t\tn = 4;\n\t\tL[0] = -L[0].z * L[1] + L[1].z * L[0];\n\t\tL[3] = -L[3].z * L[2] + L[2].z * L[3];\n\t} else if ( config == 7 ) {\n\t\tn = 5;\n\t\tL[4] = -L[3].z * L[0] + L[0].z * L[3];\n\t\tL[3] = -L[3].z * L[2] + L[2].z * L[3];\n\t} else if ( config == 8 ) {\n\t\tn = 3;\n\t\tL[0] = -L[0].z * L[3] + L[3].z * L[0];\n\t\tL[1] = -L[2].z * L[3] + L[3].z * L[2];\n\t\tL[2] =  L[3];\n\t} else if ( config == 9 ) {\n\t\tn = 4;\n\t\tL[1] = -L[1].z * L[0] + L[0].z * L[1];\n\t\tL[2] = -L[2].z * L[3] + L[3].z * L[2];\n\t} else if ( config == 10 ) {\n\t\tn = 0;\n\t} else if ( config == 11 ) {\n\t\tn = 5;\n\t\tL[4] = L[3];\n\t\tL[3] = -L[2].z * L[3] + L[3].z * L[2];\n\t\tL[2] = -L[2].z * L[1] + L[1].z * L[2];\n\t} else if ( config == 12 ) {\n\t\tn = 4;\n\t\tL[1] = -L[1].z * L[2] + L[2].z * L[1];\n\t\tL[0] = -L[0].z * L[3] + L[3].z * L[0];\n\t} else if ( config == 13 ) {\n\t\tn = 5;\n\t\tL[4] = L[3];\n\t\tL[3] = L[2];\n\t\tL[2] = -L[1].z * L[2] + L[2].z * L[1];\n\t\tL[1] = -L[1].z * L[0] + L[0].z * L[1];\n\t} else if ( config == 14 ) {\n\t\tn = 5;\n\t\tL[4] = -L[0].z * L[3] + L[3].z * L[0];\n\t\tL[0] = -L[0].z * L[1] + L[1].z * L[0];\n\t} else if ( config == 15 ) {\n\t\tn = 4;\n\t}\n\tif ( n == 3 )\n\t\tL[3] = L[0];\n\tif ( n == 4 )\n\t\tL[4] = L[0];\n}\nfloat integrateLtcBrdfOverRectEdge( vec3 v1, vec3 v2 ) {\n\tfloat cosTheta = dot( v1, v2 );\n\tfloat theta = acos( cosTheta );\n\tfloat res = cross( v1, v2 ).z * ( ( theta > 0.001 ) ? theta / sin( theta ) : 1.0 );\n\treturn res;\n}\nvoid initRectPoints( const in vec3 pos, const in vec3 halfWidth, const in vec3 halfHeight, out vec3 rectPoints[4] ) {\n\trectPoints[0] = pos - halfWidth - halfHeight;\n\trectPoints[1] = pos + halfWidth - halfHeight;\n\trectPoints[2] = pos + halfWidth + halfHeight;\n\trectPoints[3] = pos - halfWidth + halfHeight;\n}\nvec3 integrateLtcBrdfOverRect( const in GeometricContext geometry, const in mat3 brdfMat, const in vec3 rectPoints[4] ) {\n\tvec3 N = geometry.normal;\n\tvec3 V = geometry.viewDir;\n\tvec3 P = geometry.position;\n\tvec3 T1, T2;\n\tT1 = normalize(V - N * dot( V, N ));\n\tT2 = - cross( N, T1 );\n\tmat3 brdfWrtSurface = brdfMat * transpose( mat3( T1, T2, N ) );\n\tvec3 clippedRect[5];\n\tclippedRect[0] = brdfWrtSurface * ( rectPoints[0] - P );\n\tclippedRect[1] = brdfWrtSurface * ( rectPoints[1] - P );\n\tclippedRect[2] = brdfWrtSurface * ( rectPoints[2] - P );\n\tclippedRect[3] = brdfWrtSurface * ( rectPoints[3] - P );\n\tint n;\n\tclipQuadToHorizon(clippedRect, n);\n\tif ( n == 0 )\n\t\treturn vec3( 0, 0, 0 );\n\tclippedRect[0] = normalize( clippedRect[0] );\n\tclippedRect[1] = normalize( clippedRect[1] );\n\tclippedRect[2] = normalize( clippedRect[2] );\n\tclippedRect[3] = normalize( clippedRect[3] );\n\tclippedRect[4] = normalize( clippedRect[4] );\n\tfloat sum = 0.0;\n\tsum += integrateLtcBrdfOverRectEdge( clippedRect[0], clippedRect[1] );\n\tsum += integrateLtcBrdfOverRectEdge( clippedRect[1], clippedRect[2] );\n\tsum += integrateLtcBrdfOverRectEdge( clippedRect[2], clippedRect[3] );\n\tif (n >
1= 4)\n\t\tsum += integrateLtcBrdfOverRectEdge( clippedRect[3], clippedRect[4] );\n\tif (n == 5)\n\t\tsum += integrateLtcBrdfOverRectEdge( clippedRect[4], clippedRect[0] );\n\tsum = max( 0.0, sum );\n\tvec3 Lo_i = vec3( sum, sum, sum );\n\treturn Lo_i;\n}\nvec3 Rect_Area_Light_Specular_Reflectance(\n\t\tconst in GeometricContext geometry,\n\t\tconst in vec3 lightPos, const in vec3 lightHalfWidth, const in vec3 lightHalfHeight,\n\t\tconst in float roughness,\n\t\tconst in sampler2D ltcMat, const in sampler2D ltcMag ) {\n\tvec3 rectPoints[4];\n\tinitRectPoints( lightPos, lightHalfWidth, lightHalfHeight, rectPoints );\n\tvec2 uv = ltcTextureCoords( geometry, roughness );\n\tvec4 brdfLtcApproxParams, t;\n\tbrdfLtcApproxParams = texture2D( ltcMat, uv );\n\tt = texture2D( ltcMat, uv );\n\tfloat brdfLtcScalar = texture2D( ltcMag, uv ).a;\n\tmat3 brdfLtcApproxMat = mat3(\n\t\tvec3(   1,   0, t.y ),\n\t\tvec3(   0, t.z,   0 ),\n\t\tvec3( t.w,   0, t.x )\n\t);\n\tvec3 specularReflectance = integrateLtcBrdfOverRect( geometry, brdfLtcApproxMat, rectPoints );\n\tspecularReflectance *= brdfLtcScalar;\n\treturn specularReflectance;\n}\nvec3 Rect_Area_Light_Diffuse_Reflectance(\n\t\tconst in GeometricContext geometry,\n\t\tconst in vec3 lightPos, const in vec3 lightHalfWidth, const in vec3 lightHalfHeight ) {\n\tvec3 rectPoints[4];\n\tinitRectPoints( lightPos, lightHalfWidth, lightHalfHeight, rectPoints );\n\tmat3 diffuseBrdfMat = mat3(1);\n\tvec3 diffuseReflectance = integrateLtcBrdfOverRect( geometry, diffuseBrdfMat, rectPoints );\n\treturn diffuseReflectance;\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 PI_HALF 1.5707963267949\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}\nmat3 transpose( const in mat3 v ) {\n\tmat3 tmp;\n\ttmp[0] = vec3(v[0].x, v[1].x, v[2].x);\n\ttmp[1] = vec3(v[0].y, v[1].y, v[2].y);\n\ttmp[2] = vec3(v[0].z, v[1].z, v[2].z);\n\treturn tmp;\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);
1\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}
1\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 envMapIntensity;\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;
1\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",gradientmap_pars_fragment:"#ifdef TOON\n\tuniform sampler2D gradientMap;\n\tvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n\t\tfloat dotNL = dot( normal, lightDirection );\n\t\tvec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n\t\t#ifdef USE_GRADIENTMAP\n\t\t\treturn texture2D( gradientMap, coord ).rgb;\n\t\t#else\n\t\t\treturn ( coord.x < 0.7 ) ? vec3( 0.7 ) : vec3( 1.0 );\n\t\t#endif\n\t}\n#endif\n",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_RECT_AREA_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\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\tdirectLight.color = pointLight.color;\n\t\tdirectLight.color *= punctualLightIntensityToIrradianceFactor( lightDistance, pointLight.distance, pointLight.decay );\n\t\tdirectLight.visible = ( directLight.color != vec3( 0.0 ) );\n\t}
1\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 ( angleCos > spotLight.coneCos ) {\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_RECT_AREA_LIGHTS > 0\n\tstruct RectAreaLight {\n\t\tvec3 color;\n\t\tvec3 position;\n\t\tvec3 halfWidth;\n\t\tvec3 halfHeight;\n\t};\n\tuniform sampler2D ltcMat;\tuniform sampler2D ltcMag;\n\tuniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\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\tvec3 worldNormal = inverseTransformDirection( geometry.normal, viewMatrix );\n\t\t#ifdef ENVMAP_TYPE_CUBE\n\t\t\tvec3 queryVec = 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 = 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\treflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n\t\tfloat specularMIPLevel = getSpecularMIPLevel( blinnShininessExponent, maxMIPLevel );\n\t\t#ifdef ENVMAP_TYPE_CUBE\n\t\t\tvec3 queryReflectVec = 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 = vec3( flipEnvMap * reflectVec.x, reflectVec.yz );\n\t\t\tvec4 envMapColor = textureCubeUV(queryReflectVec, BlinnExponentToGGXRoughness(blinnShinine
1ssExponent));\n\t\t#elif defined( ENVMAP_TYPE_EQUIREC )\n\t\t\tvec2 sampleUV;\n\t\t\tsampleUV.y = saturate( reflectVec.y * 0.5 + 0.5 );\n\t\t\tsampleUV.x = atan( reflectVec.z, 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 = 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};\n#if NUM_RECT_AREA_LIGHTS > 0\n    void RE_Direct_RectArea_BlinnPhong( const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n        vec3 matDiffColor = material.diffuseColor;\n        vec3 matSpecColor = material.specularColor;\n        vec3 lightColor   = rectAreaLight.color;\n        float roughness = BlinnExponentToGGXRoughness( material.specularShininess );\n        vec3 spec = Rect_Area_Light_Specular_Reflectance(\n                geometry,\n                rectAreaLight.position, rectAreaLight.halfWidth, rectAreaLight.halfHeight,\n                roughness,\n                ltcMat, ltcMag );\n        vec3 diff = Rect_Area_Light_Diffuse_Reflectance(\n                geometry,\n                rectAreaLight.position, rectAreaLight.halfWidth, rectAreaLight.halfHeight );\n        reflectedLight.directSpecular += lightColor * matSpecColor * spec / PI2;\n        reflectedLight.directDiffuse  += lightColor * matDiffColor * diff / PI2;\n    }\n#endif\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\t#ifdef TOON\n\t\tvec3 irradiance = getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color;\n\t#else\n\t\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\t\tvec3 irradiance = dotNL * directLight.color;\n\t#endif\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_Direct_RectArea\t\tRE_Direct_RectArea_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}\n#if NUM_RECT_AREA_LIGHTS > 0\n    void RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n        vec3 matDiffColor = material.diffuseColor;\n        vec3 matSpecColor = material.specularColor;\n        vec3 lightColor   = rectAreaLight.color;\n        float roughness = material.specularRoughness;\n        vec3 spec = Rect_Area_Light_Specular_Reflectance(\n                geometry,\n                rectAreaLight.position, rectAreaLight.halfWidth, rectAreaLight.halfHeight,\n                roughness,\n                ltcMat, ltcMag );\n        vec3 diff = Rect_Area_Light_Diffuse_Reflectance(\n                geometry,\n                rectAreaLight.position, rectAreaLight.halfWidth, rectAreaLight.halfHeight );\n        reflectedLight.directSpecular += lightColor * matSpecColor * spec;\n        reflectedLight.directDiffuse  += lightColor * matDiffColor * diff;\n    }\n#endif\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot
1( 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_Direct_RectArea\t\tRE_Direct_RectArea_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 ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n\tRectAreaLight rectAreaLight;\n\tfor ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n\t\trectAreaLight = rectAreaLights[ i ];\n\t\tRE_Direct_RectArea( rectAreaLight, 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_BlinnShinine
1ssExponent( 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 ];
1\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    #if NUM_RECT_AREA_LIGHTS > 0\n    #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 ];
1\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    #if NUM_RECT_AREA_LIGHTS > 0\n    #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    #if NUM_RECT_AREA_LIGHTS > 0\n    #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#if NUM_RECT_AREA_LIGHTS > 0\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;
1\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;
1\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 <lightmap_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 = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\t#ifdef USE_LIGHTMAP\n\t\treflectedLight.indirectDiffuse += texture2D( lightMap, vUv2 ).xyz * lightMapIntensity;\n\t#else\n\t\treflectedLight.indirectDiffuse += vec3( 1.0 );\n\t#endif\n\t#include <aomap_fragment>\n\treflectedLight.indirectDiffuse *= diffuseColor.rgb;\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 <gradientmap_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\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:"#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHADED  ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <packing>\n#include <uv_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\nvoid main() {\n\t#include <logdepthbuf_fragment>\n\t#include <normal_flip>\n\t#include <normal_fragment>\n\tgl_FragColor = vec4( packNormalToRGB( normal ), opacity );\n\t#include <premultiplied_alpha_fragment>\n\t#include <encodings_fragment>\n}\n",normal_vert:"#define NORMAL\n#if defined( FLAT_SHADED  ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\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>\nvoid main() {\n\t#include <uv_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#if defined( FLAT_SHADED  ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP )\n\tvViewPosition = - mvPosition.xyz;\n#endif\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 / - 
1mvPosition.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(t){return t&&t.isColor?this.copy(t):"number"===typeof t?this.setHex(t):"string"===typeof t&&this.setStyle(t),this},setScalar:function(t){return this.r=t,this.g=t,this.b=t,this},setHex:function(t){return t=Math.floor(t),this.r=(t>>16&255)/255,this.g=(t>>8&255)/255,this.b=(255&t)/255,this},setRGB:function(t,e,n){return this.r=t,this.g=e,this.b=n,this},setHSL:function(){function t(t,e,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?t+6*(e-t)*n:n<.5?e:n<2/3?t+6*(e-t)*(2/3-n):t}return function(e,n,i){if(e=pa.euclideanModulo(e,1),n=pa.clamp(n,0,1),i=pa.clamp(i,0,1),0===n)this.r=this.g=this.b=i;else{var r=i<=.5?i*(1+n):i+n-i*n,o=2*i-r;this.r=t(o,r,e+1/3),this.g=t(o,r,e),this.b=t(o,r,e-1/3)}return this}}(),setStyle:function(t){function e(e){void 0!==e&&parseFloat(e)<1&&console.warn("THREE.Color: Alpha component of "+t+" will be ignored.")}var n;if(n=/^((?:rgb|hsl)a?)\(\s*([^\)]*)\)/.exec(t)){var i,r=n[1],o=n[2];switch(r){case"rgb":case"rgba":if(i=/^(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(o))return this.r=Math.min(255,parseInt(i[1],10))/255,this.g=Math.min(255,parseInt(i[2],10))/255,this.b=Math.min(255,parseInt(i[3],10))/255,e(i[5]),this;if(i=/^(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(o))return this.r=Math.min(100,parseInt(i[1],10))/100,this.g=Math.min(100,parseInt(i[2],10))/100,this.b=Math.min(100,parseInt(i[3],10))/100,e(i[5]),this;break;case"hsl":case"hsla":if(i=/^([0-9]*\.?[0-9]+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(o)){var a=parseFloat(i[1])/360,s=parseInt(i[2],10)/100,c=parseInt(i[3],10)/100;return e(i[5]),this.setHSL(a,s,c)}}}else if(n=/^\#([A-Fa-f0-9]+)$/.exec(t)){var l=n[1],h=l.length;if(3===h)return this.r=parseInt(l.charAt(0)+l.charAt(0),16)/255,this.g=parseInt(l.charAt(1)+l.charAt(1),16)/255,this.b=parseInt(l.charAt(2)+l.charAt(2),16)/255,this;if(6===h)return this.r=parseInt(l.charAt(0)+l.charAt(1),16)/255,this.g=parseInt(l.charAt(2)+l.charAt(3),16)/255,this.b=parseInt(l.charAt(4)+l.charAt(5),16)/255,this}if(t&&t.length>0){var l=wa[t];void 0!==l?this.setHex(l):console.warn("THREE.Color: Unknown color "+t)}return this},clone:function(){return new this.constructor(this.r,this.g,this.b)},copy:function(t){return this.r=t.r,this.g=t.g,this.b=t.b,this},copyGammaToLinear:function(t,e){return void 0===e&&(e=2),this.r=Math.pow(t.r,e),this.g=Math.pow(t.g,e),this.b=Math.pow(t.b,e),this},copyLinearToGamma:function(t,e){void 0===e&&(e=2);var n=e>0?1/e:1;return this.r=Math.pow(t.r,n),this.g=Math.pow(t.g,n),this.b=Math.pow(t.b,n),this},convertGammaToLinear:function(){var t=this.r,e=this.g,n=this.b;return this.r=t*t,this.g=e*e,this.b=n*n,this},convertLinearToGamma:function(){return this.r=Math.sqrt(this.r),this.g=Math.sqrt(this.g),this.b=Math.sqrt(this.b),this},getHex:function(){return 255*this.r<<16^255*this.g<<8^255*this.b<<0},getHexString:function(){return("000000"+this.getHex().toString(16)).slice(-6)},getHSL:function(t){var e,n,i=t||{h:0,s:0,l:0},r=this.r,o=this.g,a=this.b,s=Math.max(r,o,a),c=Math.min(r,o,a),l=(c+s)/2;if(c===s)e=0,n=0;else{var h=s-c;switch(n=l<=.5?h/(s+c):h/(2-s-c),s){case r:e=(o-a)/h+(o<a?6:0);break;case o:e=(a-r)/h+2;break;case a:e=(r-o)/h+4}e/=6}return i.h=e,i.s=n,i.l=l,i},getStyle:function(){return"rgb("+(255*this.r|0)+","+(255*this.g|0)+","+(255*this.b|0)+")"},offsetHSL:function(t,e,n){var i=this.getHSL();return i.h+=t,i.s+=e,i.l+=n,this.setHSL(i.h,i.s,i.l),this},add:function(t){return this.r+=t.r,this.g+=t.g,this.b+=t.b,this},addColors:function(t,e){return this.r=t.r+e.r,this.g=t.g+e.g,this.b=t.b+e.b,this},addScalar:function(t){return this.r+=t,this.g+=t,this.b+=t,this},sub:function(t){return this.r=Math.max(0,this.r-t.r),this.g=Math.max(0,this.g-t.g),this.b=Math.max(0,this.b-t.b),this},multiply:function(t){return this.r*=t.r,this.g*=t.g,this.b*=t.b,this},multiplyScalar:function(t){return this.r*=t,this.g*=t,this.b*=t,this},lerp:function(t,e){return this.r+=(t.r-this.r)*e,this.g+=(t.g-this.g)*e,this.b+=(t.b-this.b)*e,this},equals:function(t){return t.r===this.r&&t.g===this.g&&t.b===this.b},fromArray:function(t,e){return void 0===e&&(e=0),this.r=t[e],this.g=t[e+1],this.b=t[e+2],this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this.r,t[e+1]=this.g,t[e+2]=this.b,t},toJSON:function(){return this.getHex()}};var wa={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};Y.prototype=Object.create(o.prototype),Y.prototype.constructor=Y,Y.prototype.isDataTexture=!0;var Ma={common:{diffuse:{value:new q(15658734)},opacity:{value:1},map:{value:null},offsetRepeat:{value:new a(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 r(1,1)}}
1,displacementmap:{displacementMap:{value:null},displacementScale:{value:1},displacementBias:{value:0}},roughnessmap:{roughnessMap:{value:null}},metalnessmap:{metalnessMap:{value:null}},gradientmap:{gradientMap:{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:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}}},points:{diffuse:{value:new q(15658734)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},offsetRepeat:{value:new a(0,0,1,1)}}},Ea={basic:{uniforms:ba.merge([Ma.common,Ma.aomap,Ma.lightmap,Ma.fog]),vertexShader:xa.meshbasic_vert,fragmentShader:xa.meshbasic_frag},lambert:{uniforms:ba.merge([Ma.common,Ma.aomap,Ma.lightmap,Ma.emissivemap,Ma.fog,Ma.lights,{emissive:{value:new q(0)}}]),vertexShader:xa.meshlambert_vert,fragmentShader:xa.meshlambert_frag},phong:{uniforms:ba.merge([Ma.common,Ma.aomap,Ma.lightmap,Ma.emissivemap,Ma.bumpmap,Ma.normalmap,Ma.displacementmap,Ma.gradientmap,Ma.fog,Ma.lights,{emissive:{value:new q(0)},specular:{value:new q(1118481)},shininess:{value:30}}]),vertexShader:xa.meshphong_vert,fragmentShader:xa.meshphong_frag},standard:{uniforms:ba.merge([Ma.common,Ma.aomap,Ma.lightmap,Ma.emissivemap,Ma.bumpmap,Ma.normalmap,Ma.displacementmap,Ma.roughnessmap,Ma.metalnessmap,Ma.fog,Ma.lights,{emissive:{value:new q(0)},roughness:{value:.5},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:xa.meshphysical_vert,fragmentShader:xa.meshphysical_frag},points:{uniforms:ba.merge([Ma.points,Ma.fog]),vertexShader:xa.points_vert,fragmentShader:xa.points_frag},dashed:{uniforms:ba.merge([Ma.common,Ma.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:xa.linedashed_vert,fragmentShader:xa.linedashed_frag},depth:{uniforms:ba.merge([Ma.common,Ma.displacementmap]),vertexShader:xa.depth_vert,fragmentShader:xa.depth_frag},normal:{uniforms:ba.merge([Ma.common,Ma.bumpmap,Ma.normalmap,Ma.displacementmap,{opacity:{value:1}}]),vertexShader:xa.normal_vert,fragmentShader:xa.normal_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:xa.cube_vert,fragmentShader:xa.cube_frag},equirect:{uniforms:{tEquirect:{value:null},tFlip:{value:-1}},vertexShader:xa.equirect_vert,fragmentShader:xa.equirect_frag},distanceRGBA:{uniforms:{lightPos:{value:new h}},vertexShader:xa.distanceRGBA_vert,fragmentShader:xa.distanceRGBA_frag}};Ea.physical={uniforms:ba.merge([Ea.standard.uniforms,{clearCoat:{value:0},clearCoatRoughness:{value:0}}]),vertexShader:xa.meshphysical_vert,fragmentShader:xa.meshphysical_frag},Z.prototype={constructor:Z,set:function(t,e){return this.min.copy(t),this.max.copy(e),this},setFromPoints:function(t){this.makeEmpty();for(var e=0,n=t.length;e<n;e++)this.expandByPoint(t[e]);return this},setFromCenterAndSize:function(){var t=new r;return function(e,n){var i=t.copy(n).multiplyScalar(.5);return this.min.copy(e).sub(i),this.max.copy(e).add(i),this}}(),clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.min.copy(t.min),this.max.copy(t.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(t){var e=t||new r;return this.isEmpty()?e.set(0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)},getSize:function(t){var e=t||new r;return this.isEmpty()?e.set(0,0):e.subVectors(this.max,this.min)},expandByPoint:function(t){return this.min.min(t),this.max.max(t),this},expandByVector:function(t){return this.min.sub(t),this.max.add(t),this},expandByScalar:function(t){return this.min.addScalar(-t),this.max.addScalar(t),this},containsPoint:function(t){return!(t.x<this.min.x||t.x>this.max.x||t.y<this.min.y||t.y>this.max.y)},containsBox:function(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y},getParameter:function(t,e){return(e||new r).set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y))},intersectsBox:function(t){return!(t.max.x<this.min.x||t.min.x>this.max.x||t.max.y<this.min.y||t.min.y>this.max.y)},clampPoint:function(t,e){return(e||new r).copy(t).clamp(this.min,this.max)},distanceToPoint:function(){var t=new r;return function(e){return t.copy(e).clamp(this.min,this.max).sub(e).length()}}(),intersect:function(t){return this.min.max(t.min),this.max.min(t.max),this},union:function(t){return this.min.min(t.min),this.max.max(t.max),this},translate:function(t){return this.min.add(t),this.max.add(t),this},equals:function(t){return t.min.equals(this.min)&&t.max.equals(this.max)}};var Ta=0;K.prototype={constructor:K,isMaterial:!0,get needsUpdate(){return this._needsUpdate},set needsUpdate(t){!0===t&&this.update(),this._needsUpdate=t},setValues:function(t){if(void 0!==t)for(var e in t){var n=t[e];if(void 0!==n){var i=this[e];void 0!==i?i&&i.isColor?i.set(n):i&&i.isVector3&&n&&n.isVector3?i.copy(n):this[e]="overdraw"===e?Number(n):n:console.warn("THREE."+this.type+": '"+e+"' is not a property of this material.")}else console.warn("THREE.Material: '"+e+"' parameter is undefined.")}},toJSON:function(t){function e(t){var e=[];for(var n in t){var i=t[n];delete i.metadata,e.push(i)}return e}var n=void 0===t;n&&(t={textures:{},images:{}});var i={metadata:{version:4.4,type:"Material",generator:"Material.toJSON"}};
vendor: 5,578 bytes, line 1
1if(i.uuid=this.uuid,i.type=this.type,""!==this.name&&(i.name=this.name),this.color&&this.color.isColor&&(i.color=this.color.getHex()),void 0!==this.roughness&&(i.roughness=this.roughness),void 0!==this.metalness&&(i.metalness=this.metalness),this.emissive&&this.emissive.isColor&&(i.emissive=this.emissive.getHex()),this.specular&&this.specular.isColor&&(i.specular=this.specular.getHex()),void 0!==this.shininess&&(i.shininess=this.shininess),void 0!==this.clearCoat&&(i.clearCoat=this.clearCoat),void 0!==this.clearCoatRoughness&&(i.clearCoatRoughness=this.clearCoatRoughness),this.map&&this.map.isTexture&&(i.map=this.map.toJSON(t).uuid),this.alphaMap&&this.alphaMap.isTexture&&(i.alphaMap=this.alphaMap.toJSON(t).uuid),this.lightMap&&this.lightMap.isTexture&&(i.lightMap=this.lightMap.toJSON(t).uuid),this.bumpMap&&this.bumpMap.isTexture&&(i.bumpMap=this.bumpMap.toJSON(t).uuid,i.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(i.normalMap=this.normalMap.toJSON(t).uuid,i.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(i.displacementMap=this.displacementMap.toJSON(t).uuid,i.displacementScale=this.displacementScale,i.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(i.roughnessMap=this.roughnessMap.toJSON(t).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(i.metalnessMap=this.metalnessMap.toJSON(t).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(i.emissiveMap=this.emissiveMap.toJSON(t).uuid),this.specularMap&&this.specularMap.isTexture&&(i.specularMap=this.specularMap.toJSON(t).uuid),this.envMap&&this.envMap.isTexture&&(i.envMap=this.envMap.toJSON(t).uuid,i.reflectivity=this.reflectivity),this.gradientMap&&this.gradientMap.isTexture&&(i.gradientMap=this.gradientMap.toJSON(t).uuid),void 0!==this.size&&(i.size=this.size),void 0!==this.sizeAttenuation&&(i.sizeAttenuation=this.sizeAttenuation),this.blending!==xr&&(i.blending=this.blending),this.shading!==vr&&(i.shading=this.shading),this.side!==dr&&(i.side=this.side),this.vertexColors!==gr&&(i.vertexColors=this.vertexColors),this.opacity<1&&(i.opacity=this.opacity),!0===this.transparent&&(i.transparent=this.transparent),i.depthFunc=this.depthFunc,i.depthTest=this.depthTest,i.depthWrite=this.depthWrite,this.alphaTest>0&&(i.alphaTest=this.alphaTest),!0===this.premultipliedAlpha&&(i.premultipliedAlpha=this.premultipliedAlpha),!0===this.wireframe&&(i.wireframe=this.wireframe),this.wireframeLinewidth>1&&(i.wireframeLinewidth=this.wireframeLinewidth),"round"!==this.wireframeLinecap&&(i.wireframeLinecap=this.wireframeLinecap),"round"!==this.wireframeLinejoin&&(i.wireframeLinejoin=this.wireframeLinejoin),i.skinning=this.skinning,i.morphTargets=this.morphTargets,n){var r=e(t.textures),o=e(t.images);r.length>0&&(i.textures=r),o.length>0&&(i.images=o)}return i},clone:function(){return(new this.constructor).copy(this)},copy:function(t){this.name=t.name,this.fog=t.fog,this.lights=t.lights,this.blending=t.blending,this.side=t.side,this.shading=t.shading,this.vertexColors=t.vertexColors,this.opacity=t.opacity,this.transparent=t.transparent,this.blendSrc=t.blendSrc,this.blendDst=t.blendDst,this.blendEquation=t.blendEquation,this.blendSrcAlpha=t.blendSrcAlpha,this.blendDstAlpha=t.blendDstAlpha,this.blendEquationAlpha=t.blendEquationAlpha,this.depthFunc=t.depthFunc,this.depthTest=t.depthTest,this.depthWrite=t.depthWrite,this.colorWrite=t.colorWrite,this.precision=t.precision,this.polygonOffset=t.polygonOffset,this.polygonOffsetFactor=t.polygonOffsetFactor,this.polygonOffsetUnits=t.polygonOffsetUnits,this.alphaTest=t.alphaTest,this.premultipliedAlpha=t.premultipliedAlpha,this.overdraw=t.overdraw,this.visible=t.visible,this.clipShadows=t.clipShadows,this.clipIntersection=t.clipIntersection;var e=t.clippingPlanes,n=null;if(null!==e){var i=e.length;n=new Array(i);for(var r=0;r!==i;++r)n[r]=e[r].clone()}return this.clippingPlanes=n,this},update:function(){this.dispatchEvent({type:"update"})},dispose:function(){this.dispatchEvent({type:"dispose"})}},Object.assign(K.prototype,i.prototype),$.prototype=Object.create(K.prototype),$.prototype.constructor=$,$.prototype.isShaderMaterial=!0,$.prototype.copy=function(t){return K.prototype.copy.call(this,t),this.fragmentShader=t.fragmentShader,this.vertexShader=t.vertexShader,this.uniforms=ba.clone(t.uniforms),this.defines=t.defines,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.lights=t.lights,this.clipping=t.clipping,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this.extensions=t.extensions,this},$.prototype.toJSON=function(t){var e=K.prototype.toJSON.call(this,t);return e.uniforms=this.uniforms,e.vertexShader=this.vertexShader,e.fragmentShader=this.fragmentShader,e},tt.prototype=Object.create(K.prototype),tt.prototype.constructor=tt,tt.prototype.isMeshDepthMaterial=!0,tt.prototype.copy=function(t){return K.prototype.copy.call(this,t),this.depthPacking=t.depthPacking,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this},et.prototype={constructor:et,isBox3:!0,set:function(t,e){return this.min.copy(t),this.max.copy(e),this},setFromArray:function(t){for(var e=1/0,n=1/0,i=1/0,r=-1/0,o=-1/0,a=-1/0,s=0,c=t.length;s<c;s+=3){var l=t[s],h=t[s+1],u=t[s+2];l<e&&(e=l),h<n&&(n=h),u<i&&(i=u),l>r&&(r=l),h>
1o&&(o=h),u>a&&(a=u)}this.min.set(e,n,i),this.max.set(r,o,a)},setFromBufferAttribute:function(t){for(var e=1/0,n=1/0,i=1/0,r=-1/0,o=-1/0,a=-1/0,s=0,c=t.count;s<c;s++){var l=t.getX(s),h=t.getY(s),u=t.getZ(s);l<e&&(e=l),h<n&&(n=h),u<i&&(i=u),l>r&&(r=l),h>o&&(o=h),u>a&&(a=u)}this.min.set(e,n,i),this.max.set(r,o,a)},setFromPoints:function(t){this.makeEmpty();for(var e=0,n=t.length;e<n;e++)this.expandByPoint(t[e]);return this},setFromCenterAndSize:function(){var t=new h;return function(e,n){var i=t.copy(n).multiplyScalar(.5);return this.min.copy(e).sub(i),this.max.copy(e).add(i),this}}(),setFromObject:function(){var t=new h;return function(e){var n=this;return e.updateMatrixWorld(!0),this.makeEmpty(),e.traverse(function(e){var i,r,o=e.geometry;if(void 0!==o)if(o.isGeometry){var a=o.vertices;for(i=0,r=a.length;i<r;i++)t.copy(a[i]),t.applyMatrix4(e.matrixWorld),n.expandByPoint(t)}else if(o.isBufferGeometry){var s=o.attributes.position;if(void 0!==s)for(i=0,r=s.count;i<r;i++)t.fromAttribute(s,i).applyMatrix4(e.matrixWorld),n.expandByPoint(t)}}),this}}(),clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.min.copy(t.min),this.max.copy(t.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(t){var e=t||new h;return this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)},getSize:function(t){var e=t||new h;return this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)},expandByPoint:function(t){return this.min.min(t),this.max.max(t),this},expandByVector:function(t){return this.min.sub(t),this.max.add(t),this},expandByScalar:function(t){return this.min.addScalar(-t),this.max.addScalar(t),this},containsPoint:function(t){return!(t.x<this.min.x||t.x>this.max.x||t.y<this.min.y||t.y>this.max.y||t.z<this.min.z||t.z>this.max.z)},containsBox:function(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y&&this.min.z<=t.min.z&&t.max.z<=this.max.z},getParameter:function(t,e){return(e||new h).set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y),(t.z-this.min.z)/(this.max.z-this.min.z))},intersectsBox:function(t){return!(t.max.x<this.min.x||t.min.x>this.max.x||t.max.y<this.min.y||t.min.y>this.max.y||t.max.z<this.min.z||t.min.z>this.max.z)},intersectsSphere:function(){var t;return function(e){return void 0===t&&(t=new h),this.clampPoint(e.center,t),t.distanceToSquared(e.center)<=e.radius*e.radius}}(),intersectsPlane:function(t){var e,n;return t.normal.x>0?(e=t.normal.x*this.min.x,n=t.normal.x*this.max.x):(e=t.normal.x*this.max.x,n=t.normal.x*this.min.x),t.normal.y>0?(e+=t.normal.y*this.min.y,n+=t.normal.y*this.max.y):(e+=t.normal.y*this.max.y,n+=t.normal.y*this.min.y),t.normal.z>0?(e+=t.normal.z*this.min.z,n+=t.normal.z*this.max.z):(e+=t.normal.z*this.max.z,n+=t.normal.z*this.min.z),e<=t.constant&&n>=t.constant},clampPoint:function(t,e){return(e||new h).copy(t).clamp(this.min,this.max)},distanceToPoint:function(){var t=new h;return function(e){return t.copy(e).clamp(this.min,this.max).sub(e).length()}}(),getBoundingSphere:function(){var t=new h;return function(e){var n=e||new nt;return this.getCenter(n.center),n.radius=.5*this.getSize(t).length(),n}}(),intersect:function(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this},union:function(t){return this.min.min(t.min),this.max.max(t.max),this},applyMatrix4:function(){var t=[new h,new h,new h,new h,new h,new h,new h,new h];return function(e){return this.isEmpty()?this:(t[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),t[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),t[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),t[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),t[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),t[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),t[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),t[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(t),this)}}(),translate:function(t){return this.min.add(t),this.max.add(t),this},equals:function(t){return t.min.equals(this.min)&&t.max.equals(this.max)}},nt.prototype={constructor:nt,set:function(t,e){return this.center.copy(t),this.radius=e,this},setFromPoints:function(){var t=new et;return function(e,n){var i=this.center;void 0!==n?i.copy(n):t.setFromPoints(e).getCenter(i);for(var r=0,o=0,a=e.length;o<a;
1o++)r=Math.max(r,i.distanceToSquared(e[o]));return this.radius=Math.sqrt(r),this}}(),clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.center.copy(t.center),this.radius=t.radius,this},empty:function(){return this.radius<=0},containsPoint:function(t){return t.distanceToSquared(this.center)<=this.radius*this.radius},distanceToPoint:function(t){return t.distanceTo(this.center)-this.radius},intersectsSphere:function(t){var e=this.radius+t.radius;return t.center.distanceToSquared(this.center)<=e*e},intersectsBox:function(t){return t.intersectsSphere(this)},intersectsPlane:function(t){return Math.abs(this.center.dot(t.normal)-t.constant)<=this.radius},clampPoint:function(t,e){var n=this.center.distanceToSquared(t),i=e||new h;return i.copy(t),n>this.radius*this.radius&&(i.sub(this.center).normalize(),i.multiplyScalar(this.radius).add(this.center)),i},getBoundingBox:function(t){var e=t||new et;return e.set(this.center,this.center),e.expandByScalar(this.radius),e},applyMatrix4:function(t){return this.center.applyMatrix4(t),this.radius=this.radius*t.getMaxScaleOnAxis(),this},translate:function(t){return this.center.add(t),this},equals:function(t){return t.center.equals(this.center)&&t.radius===this.radius}},it.prototype={constructor:it,isMatrix3:!0,set:function(t,e,n,i,r,o,a,s,c){var l=this.elements;return l[0]=t,l[1]=i,l[2]=a,l[3]=e,l[4]=r,l[5]=s,l[6]=n,l[7]=o,l[8]=c,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(t){var e=t.elements;return this.set(e[0],e[3],e[6],e[1],e[4],e[7],e[2],e[5],e[8]),this},setFromMatrix4:function(t){var e=t.elements;return this.set(e[0],e[4],e[8],e[1],e[5],e[9],e[2],e[6],e[10]),this},applyToVector3Array:function(){var t;return function(e,n,i){void 0===t&&(t=new h),void 0===n&&(n=0),void 0===i&&(i=e.length);for(var r=0,o=n;r<i;r+=3,o+=3)t.fromArray(e,o),t.applyMatrix3(this),t.toArray(e,o);return e}}(),applyToBufferAttribute:function(){var t;return function(e){void 0===t&&(t=new h);for(var n=0,i=e.count;n<i;n++)t.x=e.getX(n),t.y=e.getY(n),t.z=e.getZ(n),t.applyMatrix3(this),e.setXYZ(n,t.x,t.y,t.z);return e}}(),multiplyScalar:function(t){var e=this.elements;return e[0]*=t,e[3]*=t,e[6]*=t,e[1]*=t,e[4]*=t,e[7]*=t,e[2]*=t,e[5]*=t,e[8]*=t,this},determinant:function(){var t=this.elements,e=t[0],n=t[1],i=t[2],r=t[3],o=t[4],a=t[5],s=t[6],c=t[7],l=t[8];return e*o*l-e*a*c-n*r*l+n*a*s+i*r*c-i*o*s},getInverse:function(t,e){t&&t.isMatrix4&&console.error("THREE.Matrix3.getInverse no longer takes a Matrix4 argument.");var n=t.elements,i=this.elements,r=n[0],o=n[1],a=n[2],s=n[3],c=n[4],l=n[5],h=n[6],u=n[7],d=n[8],p=d*c-l*u,f=l*h-d*s,m=u*s-c*h,v=r*p+o*f+a*m;if(0===v){var g="THREE.Matrix3.getInverse(): can't invert matrix, determinant is 0";if(!0===e)throw new Error(g);return console.warn(g),this.identity()}var y=1/v;return i[0]=p*y,i[1]=(a*u-d*o)*y,i[2]=(l*o-a*c)*y,i[3]=f*y,i[4]=(d*r-a*h)*y,i[5]=(a*s-l*r)*y,i[6]=m*y,i[7]=(o*h-u*r)*y,i[8]=(c*r-o*s)*y,this},transpose:function(){var t,e=this.elements;return t=e[1],e[1]=e[3],e[3]=t,t=e[2],e[2]=e[6],e[6]=t,t=e[5],e[5]=e[7],e[7]=t,this},getNormalMatrix:function(t){return this.setFromMatrix4(t).getInverse(this).transpose()},transposeIntoArray:function(t){var e=this.elements;return t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8],this},fromArray:function(t,e){void 0===e&&(e=0);for(var n=0;n<9;n++)this.elements[n]=t[n+e];return this},toArray:function(t,e){void 0===t&&(t=[]),void 0===e&&(e=0);var n=this.elements;return t[e]=n[0],t[e+1]=n[1],t[e+2]=n[2],t[e+3]=n[3],t[e+4]=n[4],t[e+5]=n[5],t[e+6]=n[6],t[e+7]=n[7],t[e+8]=n[8],t}},rt.prototype={constructor:rt,set:function(t,e){return this.normal.copy(t),this.constant=e,this},setComponents:function(t,e,n,i){return this.normal.set(t,e,n),this.constant=i,this},setFromNormalAndCoplanarPoint:function(t,e){return this.normal.copy(t),this.constant=-e.dot(this.normal),this},setFromCoplanarPoints:function(){var t=new h,e=new h;return function(n,i,r){var o=t.subVectors(r,i).cross(e.subVectors(n,i)).normalize();return this.setFromNormalAndCoplanarPoint(o,n),this}}(),clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.normal.copy(t.normal),this.constant=t.constant,this},normalize:function(){var t=1/this.normal.length();return this.normal.multiplyScalar(t),this.constant*=t,this},negate:function(){return this.constant*=-1,this.normal.negate(),this},distanceToPoint:function(t){return this.normal.dot(t)+this.constant},distanceToSphere:function(t){return this.distanceToPoint(t.center)-t.radius},projectPoint:function(t,e){return this.orthoPoint(t,e).sub(t).negate()},orthoPoint:function(t,e){var n=this.distanceToPoint(t);return(e||new h).copy(this.normal).multiplyScalar(n)},intersectLine:function(){var t=new h;return function(e,n){var i=n||new h,r=e.delta(t),o=this.normal.dot(r);
1if(0!==o){var a=-(e.start.dot(this.normal)+this.constant)/o;if(!(a<0||a>1))return i.copy(r).multiplyScalar(a).add(e.start)}else if(0===this.distanceToPoint(e.start))return i.copy(e.start)}}(),intersectsLine:function(t){var e=this.distanceToPoint(t.start),n=this.distanceToPoint(t.end);return e<0&&n>0||n<0&&e>0},intersectsBox:function(t){return t.intersectsPlane(this)},intersectsSphere:function(t){return t.intersectsPlane(this)},coplanarPoint:function(t){return(t||new h).copy(this.normal).multiplyScalar(-this.constant)},applyMatrix4:function(){var t=new h,e=new it;return function(n,i){var r=this.coplanarPoint(t).applyMatrix4(n),o=i||e.getNormalMatrix(n),a=this.normal.applyMatrix3(o).normalize();return this.constant=-r.dot(a),this}}(),translate:function(t){return this.constant=this.constant-t.dot(this.normal),this},equals:function(t){return t.normal.equals(this.normal)&&t.constant===this.constant}},ot.prototype={constructor:ot,set:function(t,e,n,i,r,o){var a=this.planes;return a[0].copy(t),a[1].copy(e),a[2].copy(n),a[3].copy(i),a[4].copy(r),a[5].copy(o),this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){for(var e=this.planes,n=0;n<6;n++)e[n].copy(t.planes[n]);return this},setFromMatrix:function(t){var e=this.planes,n=t.elements,i=n[0],r=n[1],o=n[2],a=n[3],s=n[4],c=n[5],l=n[6],h=n[7],u=n[8],d=n[9],p=n[10],f=n[11],m=n[12],v=n[13],g=n[14],y=n[15];return e[0].setComponents(a-i,h-s,f-u,y-m).normalize(),e[1].setComponents(a+i,h+s,f+u,y+m).normalize(),e[2].setComponents(a+r,h+c,f+d,y+v).normalize(),e[3].setComponents(a-r,h-c,f-d,y-v).normalize(),e[4].setComponents(a-o,h-l,f-p,y-g).normalize(),e[5].setComponents(a+o,h+l,f+p,y+g).normalize(),this},intersectsObject:function(){var t=new nt;return function(e){var n=e.geometry;return null===n.boundingSphere&&n.computeBoundingSphere(),t.copy(n.boundingSphere).applyMatrix4(e.matrixWorld),this.intersectsSphere(t)}}(),intersectsSprite:function(){var t=new nt;return function(e){return t.center.set(0,0,0),t.radius=.7071067811865476,t.applyMatrix4(e.matrixWorld),this.intersectsSphere(t)}}(),intersectsSphere:function(t){for(var e=this.planes,n=t.center,i=-t.radius,r=0;r<6;r++){if(e[r].distanceToPoint(n)<i)return!1}return!0},intersectsBox:function(){var t=new h,e=new h;return function(n){for(var i=this.planes,r=0;r<6;r++){var o=i[r];t.x=o.normal.x>0?n.min.x:n.max.x,e.x=o.normal.x>0?n.max.x:n.min.x,t.y=o.normal.y>0?n.min.y:n.max.y,e.y=o.normal.y>0?n.max.y:n.min.y,t.z=o.normal.z>0?n.min.z:n.max.z,e.z=o.normal.z>0?n.max.z:n.min.z;var a=o.distanceToPoint(t),s=o.distanceToPoint(e);if(a<0&&s<0)return!1}return!0}}(),containsPoint:function(t){for(var e=this.planes,n=0;n<6;n++)if(e[n].distanceToPoint(t)<0)return!1;return!0}},st.prototype={constructor:st,set:function(t,e){return this.origin.copy(t),this.direction.copy(e),this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.origin.copy(t.origin),this.direction.copy(t.direction),this},at:function(t,e){return(e||new h).copy(this.direction).multiplyScalar(t).add(this.origin)},lookAt:function(t){return this.direction.copy(t).sub(this.origin).normalize(),this},recast:function(){var t=new h;return function(e){return this.origin.copy(this.at(e,t)),this}}(),closestPointToPoint:function(t,e){var n=e||new h;n.subVectors(t,this.origin);var i=n.dot(this.direction);return i<0?n.copy(this.origin):n.copy(this.direction).multiplyScalar(i).add(this.origin)},distanceToPoint:function(t){return Math.sqrt(this.distanceSqToPoint(t))},distanceSqToPoint:function(){var t=new h;return function(e){var n=t.subVectors(e,this.origin).dot(this.direction);return n<0?this.origin.distanceToSquared(e):(t.copy(this.direction).multiplyScalar(n).add(this.origin),t.distanceToSquared(e))}}(),distanceSqToSegment:function(){var t=new h,e=new h,n=new h;return function(i,r,o,a){t.copy(i).add(r).multiplyScalar(.5),e.copy(r).sub(i).normalize(),n.copy(this.origin).sub(t);var s,c,l,h,u=.5*i.distanceTo(r),d=-this.direction.dot(e),p=n.dot(this.direction),f=-n.dot(e),m=n.lengthSq(),v=Math.abs(1-d*d);if(v>0)if(s=d*f-p,c=d*p-f,h=u*v,s>=0)if(c>=-h)if(c<=h){var g=1/v;s*=g,c*=g,l=s*(s+d*c+2*p)+c*(d*s+c+2*f)+m}else c=u,s=Math.max(0,-(d*c+p)),l=-s*s+c*(c+2*f)+m;else c=-u,s=Math.max(0,-(d*c+p)),l=-s*s+c*(c+2*f)+m;else c<=-h?(s=Math.max(0,-(-d*u+p)),c=s>0?-u:Math.min(Math.max(-u,-f),u),l=-s*s+c*(c+2*f)+m):c<=h?(s=0,c=Math.min(Math.max(-u,-f),u),l=c*(c+2*f)+m):(s=Math.max(0,-(d*u+p)),c=s>0?u:Math.min(Math.max(-u,-f),u),l=-s*s+c*(c+2*f)+m);else c=d>0?-u:u,s=Math.max(0,-(d*c+p)),l=-s*s+c*(c+2*f)+m;return o&&o.copy(this.direction).multiplyScalar(s).add(this.origin),a&&a.copy(e).multiplyScalar(c).add(t),l}}(),intersectSphere:function(){var t=new h;return function(e,n){t.subVectors(e.center,this.origin);
1var i=t.dot(this.direction),r=t.dot(t)-i*i,o=e.radius*e.radius;if(r>o)return null;var a=Math.sqrt(o-r),s=i-a,c=i+a;return s<0&&c<0?null:s<0?this.at(c,n):this.at(s,n)}}(),intersectsSphere:function(t){return this.distanceToPoint(t.center)<=t.radius},distanceToPlane:function(t){var e=t.normal.dot(this.direction);if(0===e)return 0===t.distanceToPoint(this.origin)?0:null;var n=-(this.origin.dot(t.normal)+t.constant)/e;return n>=0?n:null},intersectPlane:function(t,e){var n=this.distanceToPlane(t);return null===n?null:this.at(n,e)},intersectsPlane:function(t){var e=t.distanceToPoint(this.origin);return 0===e||t.normal.dot(this.direction)*e<0},intersectBox:function(t,e){var n,i,r,o,a,s,c=1/this.direction.x,l=1/this.direction.y,h=1/this.direction.z,u=this.origin;return c>=0?(n=(t.min.x-u.x)*c,i=(t.max.x-u.x)*c):(n=(t.max.x-u.x)*c,i=(t.min.x-u.x)*c),l>=0?(r=(t.min.y-u.y)*l,o=(t.max.y-u.y)*l):(r=(t.max.y-u.y)*l,o=(t.min.y-u.y)*l),n>o||r>i?null:((r>n||n!==n)&&(n=r),(o<i||i!==i)&&(i=o),h>=0?(a=(t.min.z-u.z)*h,s=(t.max.z-u.z)*h):(a=(t.max.z-u.z)*h,s=(t.min.z-u.z)*h),n>s||a>i?null:((a>n||n!==n)&&(n=a),(s<i||i!==i)&&(i=s),i<0?null:this.at(n>=0?n:i,e)))},intersectsBox:function(){var t=new h;return function(e){return null!==this.intersectBox(e,t)}}(),intersectTriangle:function(){var t=new h,e=new h,n=new h,i=new h;return function(r,o,a,s,c){e.subVectors(o,r),n.subVectors(a,r),i.crossVectors(e,n);var l,h=this.direction.dot(i);if(h>0){if(s)return null;l=1}else{if(!(h<0))return null;l=-1,h=-h}t.subVectors(this.origin,r);var u=l*this.direction.dot(n.crossVectors(t,n));if(u<0)return null;var d=l*this.direction.dot(e.cross(t));if(d<0)return null;if(u+d>h)return null;var p=-l*t.dot(i);return p<0?null:this.at(p/h,c)}}(),applyMatrix4:function(t){return this.direction.add(this.origin).applyMatrix4(t),this.origin.applyMatrix4(t),this.direction.sub(this.origin),this.direction.normalize(),this},equals:function(t){return t.origin.equals(this.origin)&&t.direction.equals(this.direction)}},ct.RotationOrders=["XYZ","YZX","ZXY","XZY","YXZ","ZYX"],ct.DefaultOrder="XYZ",ct.prototype={constructor:ct,isEuler:!0,get x(){return this._x},set x(t){this._x=t,this.onChangeCallback()},get y(){return this._y},set y(t){this._y=t,this.onChangeCallback()},get z(){return this._z},set z(t){this._z=t,this.onChangeCallback()},get order(){return this._order},set order(t){this._order=t,this.onChangeCallback()},set:function(t,e,n,i){return this._x=t,this._y=e,this._z=n,this._order=i||this._order,this.onChangeCallback(),this},clone:function(){return new this.constructor(this._x,this._y,this._z,this._order)},copy:function(t){return this._x=t._x,this._y=t._y,this._z=t._z,this._order=t._order,this.onChangeCallback(),this},setFromRotationMatrix:function(t,e,n){var i=pa.clamp,r=t.elements,o=r[0],a=r[4],s=r[8],c=r[1],l=r[5],h=r[9],u=r[2],d=r[6],p=r[10];return e=e||this._order,"XYZ"===e?(this._y=Math.asin(i(s,-1,1)),Math.abs(s)<.99999?(this._x=Math.atan2(-h,p),this._z=Math.atan2(-a,o)):(this._x=Math.atan2(d,l),this._z=0)):"YXZ"===e?(this._x=Math.asin(-i(h,-1,1)),Math.abs(h)<.99999?(this._y=Math.atan2(s,p),this._z=Math.atan2(c,l)):(this._y=Math.atan2(-u,o),this._z=0)):"ZXY"===e?(this._x=Math.asin(i(d,-1,1)),Math.abs(d)<.99999?(this._y=Math.atan2(-u,p),this._z=Math.atan2(-a,l)):(this._y=0,this._z=Math.atan2(c,o))):"ZYX"===e?(this._y=Math.asin(-i(u,-1,1)),Math.abs(u)<.99999?(this._x=Math.atan2(d,p),this._z=Math.atan2(c,o)):(this._x=0,this._z=Math.atan2(-a,l))):"YZX"===e?(this._z=Math.asin(i(c,-1,1)),Math.abs(c)<.99999?(this._x=Math.atan2(-h,l),this._y=Math.atan2(-u,o)):(this._x=0,this._y=Math.atan2(s,p))):"XZY"===e?(this._z=Math.asin(-i(a,-1,1)),Math.abs(a)<.99999?(this._x=Math.atan2(d,l),this._y=Math.atan2(s,o)):(this._x=Math.atan2(-h,p),this._y=0)):console.warn("THREE.Euler: .setFromRotationMatrix() given unsupported order: "+e),this._order=e,!1!==n&&this.onChangeCallback(),this},setFromQuaternion:function(){var t;return function(e,n,i){return void 0===t&&(t=new u),t.makeRotationFromQuaternion(e),this.setFromRotationMatrix(t,n,i)}}(),setFromVector3:function(t,e){return this.set(t.x,t.y,t.z,e||this._order)},reorder:function(){var t=new l;return function(e){return t.setFromEuler(this),this.setFromQuaternion(t,e)}}(),equals:function(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._order===this._order},fromArray:function(t){return this._x=t[0],this._y=t[1],this._z=t[2],void 0!==t[3]&&(this._order=t[3]),this.onChangeCallback(),this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._order,t},toVector3:function(t){return t?t.set(this._x,this._y,this._z):new h(this._x,this._y,this._z)},onChange:function(t){return this.onChangeCallback=t,this},onChangeCallback:function(){}},lt.prototype={constructor:lt,set:function(t){this.mask=1<<t},enable:function(t){this.mask|=1<<t},toggle:function(t){this.mask^=1<<t},disable:function(t){this.mask&=~(1<<t)},test:function(t){return 0!==(this.mask&t.mask)}};var Sa=0;ht.DefaultUp=new h(0,1,0),ht.DefaultMatrixAutoUpdate=!0,Object.assign(ht.prototype,i.prototype,{isObject3D:!0,applyMatrix:function(t){this.matrix.multiplyMatrices(t,this.matrix
1),this.matrix.decompose(this.position,this.quaternion,this.scale)},setRotationFromAxisAngle:function(t,e){this.quaternion.setFromAxisAngle(t,e)},setRotationFromEuler:function(t){this.quaternion.setFromEuler(t,!0)},setRotationFromMatrix:function(t){this.quaternion.setFromRotationMatrix(t)},setRotationFromQuaternion:function(t){this.quaternion.copy(t)},rotateOnAxis:function(){var t=new l;return function(e,n){return t.setFromAxisAngle(e,n),this.quaternion.multiply(t),this}}(),rotateX:function(){var t=new h(1,0,0);return function(e){return this.rotateOnAxis(t,e)}}(),rotateY:function(){var t=new h(0,1,0);return function(e){return this.rotateOnAxis(t,e)}}(),rotateZ:function(){var t=new h(0,0,1);return function(e){return this.rotateOnAxis(t,e)}}(),translateOnAxis:function(){var t=new h;return function(e,n){return t.copy(e).applyQuaternion(this.quaternion),this.position.add(t.multiplyScalar(n)),this}}(),translateX:function(){var t=new h(1,0,0);return function(e){return this.translateOnAxis(t,e)}}(),translateY:function(){var t=new h(0,1,0);return function(e){return this.translateOnAxis(t,e)}}(),translateZ:function(){var t=new h(0,0,1);return function(e){return this.translateOnAxis(t,e)}}(),localToWorld:function(t){return t.applyMatrix4(this.matrixWorld)},worldToLocal:function(){var t=new u;return function(e){return e.applyMatrix4(t.getInverse(this.matrixWorld))}}(),lookAt:function(){var t=new u;return function(e){t.lookAt(e,this.position,this.up),this.quaternion.setFromRotationMatrix(t)}}(),add:function(t){if(arguments.length>1){for(var e=0;e<arguments.length;e++)this.add(arguments[e]);return this}return t===this?(console.error("THREE.Object3D.add: object can't be added as a child of itself.",t),this):(t&&t.isObject3D?(null!==t.parent&&t.parent.remove(t),t.parent=this,t.dispatchEvent({type:"added"}),this.children.push(t)):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",t),this)},remove:function(t){if(arguments.length>1)for(var e=0;e<arguments.length;e++)this.remove(arguments[e]);var n=this.children.indexOf(t);-1!==n&&(t.parent=null,t.dispatchEvent({type:"removed"}),this.children.splice(n,1))},getObjectById:function(t){return this.getObjectByProperty("id",t)},getObjectByName:function(t){return this.getObjectByProperty("name",t)},getObjectByProperty:function(t,e){if(this[t]===e)return this;for(var n=0,i=this.children.length;n<i;n++){var r=this.children[n],o=r.getObjectByProperty(t,e);if(void 0!==o)return o}},getWorldPosition:function(t){var e=t||new h;return this.updateMatrixWorld(!0),e.setFromMatrixPosition(this.matrixWorld)},getWorldQuaternion:function(){var t=new h,e=new h;return function(n){var i=n||new l;return this.updateMatrixWorld(!0),this.matrixWorld.decompose(t,i,e),i}}(),getWorldRotation:function(){var t=new l;return function(e){var n=e||new ct;return this.getWorldQuaternion(t),n.setFromQuaternion(t,this.rotation.order,!1)}}(),getWorldScale:function(){var t=new h,e=new l;return function(n){var i=n||new h;return this.updateMatrixWorld(!0),this.matrixWorld.decompose(t,e,i),i}}(),getWorldDirection:function(){var t=new l;return function(e){var n=e||new h;return this.getWorldQuaternion(t),n.set(0,0,1).applyQuaternion(t)}}(),raycast:function(){},traverse:function(t){t(this);for(var e=this.children,n=0,i=e.length;n<i;n++)e[n].traverse(t)},traverseVisible:function(t){if(!1!==this.visible){t(this);for(var e=this.children,n=0,i=e.length;n<i;n++)e[n].traverseVisible(t)}},traverseAncestors:function(t){var e=this.parent;null!==e&&(t(e),e.traverseAncestors(t))},updateMatrix:function(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0},updateMatrixWorld:function(t){!0===this.matrixAutoUpdate&&this.updateMatrix(),!0!==this.matrixWorldNeedsUpdate&&!0!==t||(null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorldNeedsUpdate=!1,t=!0);for(var e=this.children,n=0,i=e.length;n<i;n++)e[n].updateMatrixWorld(t)},toJSON:function(t){function e(t){var e=[];for(var n in t){var i=t[n];delete i.metadata,e.push(i)}return e}var n=void 0===t||""===t,i={};n&&(t={geometries:{},materials:{},textures:{},images:{}},i.metadata={version:4.4,type:"Object",generator:"Object3D.toJSON"});var r={};
1if(r.uuid=this.uuid,r.type=this.type,""!==this.name&&(r.name=this.name),"{}"!==JSON.stringify(this.userData)&&(r.userData=this.userData),!0===this.castShadow&&(r.castShadow=!0),!0===this.receiveShadow&&(r.receiveShadow=!0),!1===this.visible&&(r.visible=!1),r.matrix=this.matrix.toArray(),void 0!==this.geometry&&(void 0===t.geometries[this.geometry.uuid]&&(t.geometries[this.geometry.uuid]=this.geometry.toJSON(t)),r.geometry=this.geometry.uuid),void 0!==this.material&&(void 0===t.materials[this.material.uuid]&&(t.materials[this.material.uuid]=this.material.toJSON(t)),r.material=this.material.uuid),this.children.length>0){r.children=[];for(var o=0;o<this.children.length;o++)r.children.push(this.children[o].toJSON(t).object)}if(n){var a=e(t.geometries),s=e(t.materials),c=e(t.textures),l=e(t.images);a.length>0&&(i.geometries=a),s.length>0&&(i.materials=s),c.length>0&&(i.textures=c),l.length>0&&(i.images=l)}return i.object=r,i},clone:function(t){return(new this.constructor).copy(this,t)},copy:function(t,e){if(void 0===e&&(e=!0),this.name=t.name,this.up.copy(t.up),this.position.copy(t.position),this.quaternion.copy(t.quaternion),this.scale.copy(t.scale),this.matrix.copy(t.matrix),this.matrixWorld.copy(t.matrixWorld),this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrixWorldNeedsUpdate=t.matrixWorldNeedsUpdate,this.layers.mask=t.layers.mask,this.visible=t.visible,this.castShadow=t.castShadow,this.receiveShadow=t.receiveShadow,this.frustumCulled=t.frustumCulled,this.renderOrder=t.renderOrder,this.userData=JSON.parse(JSON.stringify(t.userData)),!0===e)for(var n=0;n<t.children.length;n++){var i=t.children[n];this.add(i.clone())}return this}}),ut.prototype={constructor:ut,set:function(t,e){return this.start.copy(t),this.end.copy(e),this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.start.copy(t.start),this.end.copy(t.end),this},getCenter:function(t){return(t||new h).addVectors(this.start,this.end).multiplyScalar(.5)},delta:function(t){return(t||new h).subVectors(this.end,this.start)},distanceSq:function(){return this.start.distanceToSquared(this.end)},distance:function(){return this.start.distanceTo(this.end)},at:function(t,e){var n=e||new h;return this.delta(n).multiplyScalar(t).add(this.start)},closestPointToPointParameter:function(){var t=new h,e=new h;return function(n,i){t.subVectors(n,this.start),e.subVectors(this.end,this.start);var r=e.dot(e),o=e.dot(t),a=o/r;return i&&(a=pa.clamp(a,0,1)),a}}(),closestPointToPoint:function(t,e,n){var i=this.closestPointToPointParameter(t,e),r=n||new h;return this.delta(r).multiplyScalar(i).add(this.start)},applyMatrix4:function(t){return this.start.applyMatrix4(t),this.end.applyMatrix4(t),this},equals:function(t){return t.start.equals(this.start)&&t.end.equals(this.end)}},dt.normal=function(){var t=new h;return function(e,n,i,r){var o=r||new h;o.subVectors(i,n),t.subVectors(e,n),o.cross(t);var a=o.lengthSq();return a>0?o.multiplyScalar(1/Math.sqrt(a)):o.set(0,0,0)}}(),dt.barycoordFromPoint=function(){var t=new h,e=new h,n=new h;return function(i,r,o,a,s){t.subVectors(a,r),e.subVectors(o,r),n.subVectors(i,r);var c=t.dot(t),l=t.dot(e),u=t.dot(n),d=e.dot(e),p=e.dot(n),f=c*d-l*l,m=s||new h;if(0===f)return m.set(-2,-1,-1);var v=1/f,g=(d*u-l*p)*v,y=(c*p-l*u)*v;return m.set(1-g-y,y,g)}}(),dt.containsPoint=function(){var t=new h;return function(e,n,i,r){var o=dt.barycoordFromPoint(e,n,i,r,t);return o.x>=0&&o.y>=0&&o.x+o.y<=1}}(),dt.prototype={constructor:dt,set:function(t,e,n){return this.a.copy(t),this.b.copy(e),this.c.copy(n),this},setFromPointsAndIndices:function(t,e,n,i){return this.a.copy(t[e]),this.b.copy(t[n]),this.c.copy(t[i]),this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.a.copy(t.a),this.b.copy(t.b),this.c.copy(t.c),this},area:function(){var t=new h,e=new h;return function(){return t.subVectors(this.c,this.b),e.subVectors(this.a,this.b),.5*t.cross(e).length()}}(),midpoint:function(t){return(t||new h).addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)},normal:function(t){return dt.normal(this.a,this.b,this.c,t)},plane:function(t){return(t||new rt).setFromCoplanarPoints(this.a,this.b,this.c)},barycoordFromPoint:function(t,e){return dt.barycoordFromPoint(t,this.a,this.b,this.c,e)},containsPoint:function(t){return dt.containsPoint(t,this.a,this.b,this.c)},closestPointToPoint:function(){var t,e,n,i;return function(r,o){void 0===t&&(t=new rt,e=[new ut,new ut,new ut],n=new h,i=new h);var a=o||new h,s=1/0;if(t.setFromCoplanarPoints(this.a,this.b,this.c),t.projectPoint(r,n),!0===this.containsPoint(n))a.copy(n);else{e[0].set(this.a,this.b),e[1].set(this.b,this.c),e[2].set(this.c,this.a);for(var c=0;c<e.length;c++){e[c].closestPointToPoint(n,!0,i);var l=n.distanceToSquared(i);l<s&&(s=l,a.copy(i))}}return a}}(),equals:function(t){return t.a.equals(this.a)&&t.b.equals(this.b)&&t.c.equals(this.c)}},pt.prototype={constructor:pt,clone:function(){return(new this.constructor).copy(this)},copy:function(t){this.a=t.a,this.b=t.b,this.c=t.c,this.normal.copy(t.normal),this.color.copy(t.color),this.materialIndex=t.materialIndex;for(var e=0,n=t.vertexNormals.length;e<n;e++)this.vertexNormals[e]=t.vertexNormals[e].clone();for(var e=0,n=t.vertexColors.length;e<n;e++)this.vertexColors[e]=t.vertexColors[e].clone();return this}},ft.prototype=Object.create(K.prototype),ft.prototype.constructor=ft,ft.prototype.isMeshBasicMaterial=!0,ft.prototype.copy=function(t){return K.prototype.copy.call(this,t),this.color.copy(t.color),this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this},mt.prototype={constructor:mt,isBufferAttribute:!0,set needsUpdate(t){!0===t&&this.version++},setArray:function(t){if(Array.isArray(t))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.count=void 0!==t?t.length/this.itemSize:0,this.array=t},setDynamic:function(t){return this.dynamic=t,this},copy:function(t){return this.array=new t.array.constructor(t.array),this.itemSize=t.itemSize,this.count=t.count,this.normalized=t.normalized,this.dynamic=t.dynamic,this},copyAt:function(t,e,n){t*=this.itemSize,n*=e.itemSize;
1for(var i=0,r=this.itemSize;i<r;i++)this.array[t+i]=e.array[n+i];return this},copyArray:function(t){return this.array.set(t),this},copyColorsArray:function(t){for(var e=this.array,n=0,i=0,r=t.length;i<r;i++){var o=t[i];void 0===o&&(console.warn("THREE.BufferAttribute.copyColorsArray(): color is undefined",i),o=new q),e[n++]=o.r,e[n++]=o.g,e[n++]=o.b}return this},copyIndicesArray:function(t){for(var e=this.array,n=0,i=0,r=t.length;i<r;i++){var o=t[i];e[n++]=o.a,e[n++]=o.b,e[n++]=o.c}return this},copyVector2sArray:function(t){for(var e=this.array,n=0,i=0,o=t.length;i<o;i++){var a=t[i];void 0===a&&(console.warn("THREE.BufferAttribute.copyVector2sArray(): vector is undefined",i),a=new r),e[n++]=a.x,e[n++]=a.y}return this},copyVector3sArray:function(t){for(var e=this.array,n=0,i=0,r=t.length;i<r;i++){var o=t[i];void 0===o&&(console.warn("THREE.BufferAttribute.copyVector3sArray(): vector is undefined",i),o=new h),e[n++]=o.x,e[n++]=o.y,e[n++]=o.z}return this},copyVector4sArray:function(t){for(var e=this.array,n=0,i=0,r=t.length;i<r;i++){var o=t[i];void 0===o&&(console.warn("THREE.BufferAttribute.copyVector4sArray(): vector is undefined",i),o=new a),e[n++]=o.x,e[n++]=o.y,e[n++]=o.z,e[n++]=o.w}return this},set:function(t,e){return void 0===e&&(e=0),this.array.set(t,e),this},getX:function(t){return this.array[t*this.itemSize]},setX:function(t,e){return this.array[t*this.itemSize]=e,this},getY:function(t){return this.array[t*this.itemSize+1]},setY:function(t,e){return this.array[t*this.itemSize+1]=e,this},getZ:function(t){return this.array[t*this.itemSize+2]},setZ:function(t,e){return this.array[t*this.itemSize+2]=e,this},getW:function(t){return this.array[t*this.itemSize+3]},setW:function(t,e){return this.array[t*this.itemSize+3]=e,this},setXY:function(t,e,n){return t*=this.itemSize,this.array[t+0]=e,this.array[t+1]=n,this},setXYZ:function(t,e,n,i){return t*=this.itemSize,this.array[t+0]=e,this.array[t+1]=n,this.array[t+2]=i,this},setXYZW:function(t,e,n,i,r){return t*=this.itemSize,this.array[t+0]=e,this.array[t+1]=n,this.array[t+2]=i,this.array[t+3]=r,this},onUpload:function(t){return this.onUploadCallback=t,this},clone:function(){return(new this.constructor).copy(this)}},vt.prototype=Object.create(mt.prototype),vt.prototype.constructor=vt,gt.prototype=Object.create(mt.prototype),gt.prototype.constructor=gt,yt.prototype=Object.create(mt.prototype),yt.prototype.constructor=yt,_t.prototype=Object.create(mt.prototype),_t.prototype.constructor=_t,bt.prototype=Object.create(mt.prototype),bt.prototype.constructor=bt,xt.prototype=Object.create(mt.prototype),xt.prototype.constructor=xt,wt.prototype=Object.create(mt.prototype),wt.prototype.constructor=wt,Mt.prototype=Object.create(mt.prototype),Mt.prototype.constructor=Mt,Et.prototype=Object.create(mt.prototype),Et.prototype.constructor=Et,Object.assign(Tt.prototype,{computeGroups:function(t){for(var e,n=[],i=void 0,r=t.faces,o=0;o<r.length;o++){var a=r[o];a.materialIndex!==i&&(i=a.materialIndex,void 0!==e&&(e.count=3*o-e.start,n.push(e)),e={start:3*o,materialIndex:i})}void 0!==e&&(e.count=3*o-e.start,n.push(e)),this.groups=n},fromGeometry:function(t){var e,n=t.faces,i=t.vertices,o=t.faceVertexUvs,a=o[0]&&o[0].length>0,s=o[1]&&o[1].length>0,c=t.morphTargets,l=c.length;if(l>0){e=[];for(var h=0;h<l;h++)e[h]=[];this.morphTargets.position=e}var u,d=t.morphNormals,p=d.length;if(p>0){u=[];for(var h=0;h<p;h++)u[h]=[];this.morphTargets.normal=u}for(var f=t.skinIndices,m=t.skinWeights,v=f.length===i.length,g=m.length===i.length,h=0;h<n.length;h++){var y=n[h];this.vertices.push(i[y.a],i[y.b],i[y.c]);var _=y.vertexNormals;if(3===_.length)this.normals.push(_[0],_[1],_[2]);else{var b=y.normal;this.normals.push(b,b,b)}var x=y.vertexColors;if(3===x.length)this.colors.push(x[0],x[1],x[2]);else{var w=y.color;this.colors.push(w,w,w)}if(!0===a){var M=o[0][h];void 0!==M?this.uvs.push(M[0],M[1],M[2]):(console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv ",h),this.uvs.push(new r,new r,new r))}if(!0===s){var M=o[1][h];void 0!==M?this.uvs2.push(M[0],M[1],M[2]):(console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv2 ",h),this.uvs2.push(new r,new r,new r))}for(var E=0;E<l;E++){var T=c[E].vertices;e[E].push(T[y.a],T[y.b],T[y.c])}for(var E=0;E<p;E++){var S=d[E].vertexNormals[h];u[E].push(S.a,S.b,S.c)}v&&this.skinIndices.push(f[y.a],f[y.b],f[y.c]),g&&this.skinWeights.push(m[y.a],m[y.b],m[y.c])}return this.computeGroups(t),this.verticesNeedUpdate=t.verticesNeedUpdate,this.normalsNeedUpdate=t.normalsNeedUpdate,this.colorsNeedUpdate=t.colorsNeedUpdate,this.uvsNeedUpdate=t.uvsNeedUpdate,this.groupsNeedUpdate=t.groupsNeedUpdate,this}}),Object.assign(St.prototype,i.prototype,{isGeometry:!0,applyMatrix:function(t){for(var e=(new it).getNormalMatrix(t),n=0,i=this.vertices.length;n<i;n++){this.vertices[n].applyMatrix4(t)}for(var n=0,i=this.faces.length;n<i;n++){var r=this.faces[n];
1r.normal.applyMatrix3(e).normalize();for(var o=0,a=r.vertexNormals.length;o<a;o++)r.vertexNormals[o].applyMatrix3(e).normalize()}return null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this.verticesNeedUpdate=!0,this.normalsNeedUpdate=!0,this},rotateX:function(){var t;return function(e){return void 0===t&&(t=new u),t.makeRotationX(e),this.applyMatrix(t),this}}(),rotateY:function(){var t;return function(e){return void 0===t&&(t=new u),t.makeRotationY(e),this.applyMatrix(t),this}}(),rotateZ:function(){var t;return function(e){return void 0===t&&(t=new u),t.makeRotationZ(e),this.applyMatrix(t),this}}(),translate:function(){var t;return function(e,n,i){return void 0===t&&(t=new u),t.makeTranslation(e,n,i),this.applyMatrix(t),this}}(),scale:function(){var t;return function(e,n,i){return void 0===t&&(t=new u),t.makeScale(e,n,i),this.applyMatrix(t),this}}(),lookAt:function(){var t;return function(e){void 0===t&&(t=new ht),t.lookAt(e),t.updateMatrix(),this.applyMatrix(t.matrix)}}(),fromBufferGeometry:function(t){function e(t,e,i,r){var o=void 0!==s?[d[t].clone(),d[e].clone(),d[i].clone()]:[],a=void 0!==c?[n.colors[t].clone(),n.colors[e].clone(),n.colors[i].clone()]:[],h=new pt(t,e,i,o,a,r);n.faces.push(h),void 0!==l&&n.faceVertexUvs[0].push([p[t].clone(),p[e].clone(),p[i].clone()]),void 0!==u&&n.faceVertexUvs[1].push([f[t].clone(),f[e].clone(),f[i].clone()])}var n=this,i=null!==t.index?t.index.array:void 0,o=t.attributes,a=o.position.array,s=void 0!==o.normal?o.normal.array:void 0,c=void 0!==o.color?o.color.array:void 0,l=void 0!==o.uv?o.uv.array:void 0,u=void 0!==o.uv2?o.uv2.array:void 0;void 0!==u&&(this.faceVertexUvs[1]=[]);for(var d=[],p=[],f=[],m=0,v=0;m<a.length;m+=3,v+=2)n.vertices.push(new h(a[m],a[m+1],a[m+2])),void 0!==s&&d.push(new h(s[m],s[m+1],s[m+2])),void 0!==c&&n.colors.push(new q(c[m],c[m+1],c[m+2])),void 0!==l&&p.push(new r(l[v],l[v+1])),void 0!==u&&f.push(new r(u[v],u[v+1]));if(void 0!==i){var g=t.groups;if(g.length>0)for(var m=0;m<g.length;m++)for(var y=g[m],_=y.start,b=y.count,v=_,x=_+b;v<x;v+=3)e(i[v],i[v+1],i[v+2],y.materialIndex);else for(var m=0;m<i.length;m+=3)e(i[m],i[m+1],i[m+2])}else for(var m=0;m<a.length/3;m+=3)e(m,m+1,m+2);return this.computeFaceNormals(),null!==t.boundingBox&&(this.boundingBox=t.boundingBox.clone()),null!==t.boundingSphere&&(this.boundingSphere=t.boundingSphere.clone()),this},center:function(){this.computeBoundingBox();var t=this.boundingBox.getCenter().negate();return this.translate(t.x,t.y,t.z),t},normalize:function(){this.computeBoundingSphere();var t=this.boundingSphere.center,e=this.boundingSphere.radius,n=0===e?1:1/e,i=new u;return i.set(n,0,0,-n*t.x,0,n,0,-n*t.y,0,0,n,-n*t.z,0,0,0,1),this.applyMatrix(i),this},computeFaceNormals:function(){for(var t=new h,e=new h,n=0,i=this.faces.length;n<i;n++){var r=this.faces[n],o=this.vertices[r.a],a=this.vertices[r.b],s=this.vertices[r.c];t.subVectors(s,a),e.subVectors(o,a),t.cross(e),t.normalize(),r.normal.copy(t)}},computeVertexNormals:function(t){void 0===t&&(t=!0);var e,n,i,r,o,a;for(a=new Array(this.vertices.length),e=0,n=this.vertices.length;e<n;e++)a[e]=new h;if(t){var s,c,l,u=new h,d=new h;for(i=0,r=this.faces.length;i<r;i++)o=this.faces[i],s=this.vertices[o.a],c=this.vertices[o.b],l=this.vertices[o.c],u.subVectors(l,c),d.subVectors(s,c),u.cross(d),a[o.a].add(u),a[o.b].add(u),a[o.c].add(u)}else for(this.computeFaceNormals(),i=0,r=this.faces.length;i<r;i++)o=this.faces[i],a[o.a].add(o.normal),a[o.b].add(o.normal),a[o.c].add(o.normal);for(e=0,n=this.vertices.length;e<n;e++)a[e].normalize();for(i=0,r=this.faces.length;i<r;i++){o=this.faces[i];var p=o.vertexNormals;3===p.length?(p[0].copy(a[o.a]),p[1].copy(a[o.b]),p[2].copy(a[o.c])):(p[0]=a[o.a].clone(),p[1]=a[o.b].clone(),p[2]=a[o.c].clone())}this.faces.length>0&&(this.normalsNeedUpdate=!0)},computeFlatVertexNormals:function(){var t,e,n;for(this.computeFaceNormals(),t=0,e=this.faces.length;t<e;t++){n=this.faces[t];var i=n.vertexNormals;3===i.length?(i[0].copy(n.normal),i[1].copy(n.normal),i[2].copy(n.normal)):(i[0]=n.normal.clone(),i[1]=n.normal.clone(),i[2]=n.normal.clone())}this.faces.length>0&&(this.normalsNeedUpdate=!0)},computeMorphNormals:function(){var t,e,n,i,r;for(n=0,i=this.faces.length;n<i;
vendor: 1,083 bytes, line 1
1n++)for(r=this.faces[n],r.__originalFaceNormal?r.__originalFaceNormal.copy(r.normal):r.__originalFaceNormal=r.normal.clone(),r.__originalVertexNormals||(r.__originalVertexNormals=[]),t=0,e=r.vertexNormals.length;t<e;t++)r.__originalVertexNormals[t]?r.__originalVertexNormals[t].copy(r.vertexNormals[t]):r.__originalVertexNormals[t]=r.vertexNormals[t].clone();var o=new St;for(o.faces=this.faces,t=0,e=this.morphTargets.length;t<e;t++){if(!this.morphNormals[t]){this.morphNormals[t]={},this.morphNormals[t].faceNormals=[],this.morphNormals[t].vertexNormals=[];var a,s,c=this.morphNormals[t].faceNormals,l=this.morphNormals[t].vertexNormals;for(n=0,i=this.faces.length;n<i;n++)a=new h,s={a:new h,b:new h,c:new h},c.push(a),l.push(s)}var u=this.morphNormals[t];o.vertices=this.morphTargets[t].vertices,o.computeFaceNormals(),o.computeVertexNormals();var a,s;for(n=0,i=this.faces.length;n<i;n++)r=this.faces[n],a=u.faceNormals[n],s=u.vertexNormals[n],a.copy(r.normal),s.a.copy(r.vertexNormals[0]),s.b.copy(r.vertexNormals[1]),s.c.copy(r.vertexNormals[2])}for(n=0,i=this.faces.length;n<i;
1n++)r=this.faces[n],r.normal=r.__originalFaceNormal,r.vertexNormals=r.__originalVertexNormals},computeLineDistances:function(){for(var t=0,e=this.vertices,n=0,i=e.length;n<i;n++)n>0&&(t+=e[n].distanceTo(e[n-1])),this.lineDistances[n]=t},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new et),this.boundingBox.setFromPoints(this.vertices)},computeBoundingSphere:function(){null===this.boundingSphere&&(this.boundingSphere=new nt),this.boundingSphere.setFromPoints(this.vertices)},merge:function(t,e,n){if(!1===(t&&t.isGeometry))return void console.error("THREE.Geometry.merge(): geometry not an instance of THREE.Geometry.",t);var i,r=this.vertices.length,o=this.vertices,a=t.vertices,s=this.faces,c=t.faces,l=this.faceVertexUvs[0],h=t.faceVertexUvs[0],u=this.colors,d=t.colors;void 0===n&&(n=0),void 0!==e&&(i=(new it).getNormalMatrix(e));for(var p=0,f=a.length;p<f;p++){var m=a[p],v=m.clone();void 0!==e&&v.applyMatrix4(e),o.push(v)}for(var p=0,f=d.length;p<f;p++)u.push(d[p].clone());for(p=0,f=c.length;p<f;p++){var g,y,_,b=c[p],x=b.vertexNormals,w=b.vertexColors;g=new pt(b.a+r,b.b+r,b.c+r),g.normal.copy(b.normal),void 0!==i&&g.normal.applyMatrix3(i).normalize();for(var M=0,E=x.length;M<E;M++)y=x[M].clone(),void 0!==i&&y.applyMatrix3(i).normalize(),g.vertexNormals.push(y);g.color.copy(b.color);for(var M=0,E=w.length;M<E;M++)_=w[M],g.vertexColors.push(_.clone());g.materialIndex=b.materialIndex+n,s.push(g)}for(p=0,f=h.length;p<f;p++){var T=h[p],S=[];if(void 0!==T){for(var M=0,E=T.length;M<E;M++)S.push(T[M].clone());l.push(S)}}},mergeMesh:function(t){if(!1===(t&&t.isMesh))return void console.error("THREE.Geometry.mergeMesh(): mesh not an instance of THREE.Mesh.",t);t.matrixAutoUpdate&&t.updateMatrix(),this.merge(t.geometry,t.matrix)},mergeVertices:function(){var t,e,n,i,r,o,a,s,c={},l=[],h=[],u=Math.pow(10,4);for(n=0,i=this.vertices.length;n<i;n++)t=this.vertices[n],e=Math.round(t.x*u)+"_"+Math.round(t.y*u)+"_"+Math.round(t.z*u),void 0===c[e]?(c[e]=n,l.push(this.vertices[n]),h[n]=l.length-1):h[n]=h[c[e]];var d=[];for(n=0,i=this.faces.length;n<i;n++){r=this.faces[n],r.a=h[r.a],r.b=h[r.b],r.c=h[r.c],o=[r.a,r.b,r.c];for(var p=0;p<3;p++)if(o[p]===o[(p+1)%3]){p,d.push(n);break}}for(n=d.length-1;n>=0;n--){var f=d[n];for(this.faces.splice(f,1),a=0,s=this.faceVertexUvs.length;a<s;a++)this.faceVertexUvs[a].splice(f,1)}var m=this.vertices.length-l.length;return this.vertices=l,m},sortFacesByMaterialIndex:function(){function t(t,e){return t.materialIndex-e.materialIndex}for(var e=this.faces,n=e.length,i=0;i<n;i++)e[i]._id=i;e.sort(t);var r,o,a=this.faceVertexUvs[0],s=this.faceVertexUvs[1];a&&a.length===n&&(r=[]),s&&s.length===n&&(o=[]);for(var i=0;i<n;i++){var c=e[i]._id;r&&r.push(a[c]),o&&o.push(s[c])}r&&(this.faceVertexUvs[0]=r),o&&(this.faceVertexUvs[1]=o)},toJSON:function(){function t(t,e,n){return n?t|1<<e:t&~(1<<e)}function e(t){var e=t.x.toString()+t.y.toString()+t.z.toString();return void 0!==d[e]?d[e]:(d[e]=u.length/3,u.push(t.x,t.y,t.z),d[e])}function n(t){var e=t.r.toString()+t.g.toString()+t.b.toString();return void 0!==f[e]?f[e]:(f[e]=p.length,p.push(t.getHex()),f[e])}function i(t){var e=t.x.toString()+t.y.toString();return void 0!==v[e]?v[e]:(v[e]=m.length/2,m.push(t.x,t.y),v[e])}var r={metadata:{version:4.4,type:"Geometry",generator:"Geometry.toJSON"}};if(r.uuid=this.uuid,r.type=this.type,""!==this.name&&(r.name=this.name),void 0!==this.parameters){var o=this.parameters;for(var a in o)void 0!==o[a]&&(r[a]=o[a]);return r}for(var s=[],c=0;c<this.vertices.length;c++){var l=this.vertices[c];s.push(l.x,l.y,l.z)}for(var h=[],u=[],d={},p=[],f={},m=[],v={},c=0;c<this.faces.length;c++){var g=this.faces[c],y=void 0!==this.faceVertexUvs[0][c],_=g.normal.length()>0,b=g.vertexNormals.length>0,x=1!==g.color.r||1!==g.color.g||1!==g.color.b,w=g.vertexColors.length>0,M=0;if(M=t(M,0,0),M=t(M,1,!0),M=t(M,2,!1),M=t(M,3,y),M=t(M,4,_),M=t(M,5,b),M=t(M,6,x),M=t(M,7,w),h.push(M),h.push(g.a,g.b,g.c),h.push(g.materialIndex),y){var E=this.faceVertexUvs[0][c];h.push(i(E[0]),i(E[1]),i(E[2]))}if(_&&h.push(e(g.normal)),b){var T=g.vertexNormals;h.push(e(T[0]),e(T[1]),e(T[2]))}if(x&&h.push(n(g.color)),w){var S=g.vertexColors;h.push(n(S[0]),n(S[1]),n(S[2]))}}return r.data={},r.data.vertices=s,r.data.normals=u,p.length>0&&(r.data.colors=p),m.length>0&&(r.data.uvs=[m]),r.data.faces=h,r},clone:function(){return(new St).copy(this)},copy:function(t){this.vertices=[],this.faces=[],this.faceVertexUvs=[[]],this.colors=[];for(var e=t.vertices,n=0,i=e.length;n<i;n++)this.vertices.push(e[n].clone());for(var r=t.colors,n=0,i=r.length;n<i;n++)this.colors.push(r[n].clone());for(var o=t.faces,n=0,i=o.length;n<i;n++)this.faces.push(o[n].clone());for(var n=0,i=t.faceVertexUvs.length;n<i;n++){var a=t.faceVertexUvs[n];void 0===this.faceVertexUvs[n]&&(this.faceVertexUvs[n]=[]);for(var s=0,c=a.length;s<c;s++){for(var l=a[s],h=[],u=0,d=l.length;u<d;u++){var p=l[u];h.push(p.clone())}this.faceVertexUvs[n].push(h)}}return this},dispose:function(){this.dispatchEvent({type:"dispose"})}});var Aa=0;Object.assign(Lt.prototype,i.prototype,{isBufferGeometry:!0,getIndex:function(){return this.index},setIndex:function(t){this.index=t},addAttribute:function(t,e){return!1===(e&&e.isBufferAttribute)&&!1===(e&&e.isInterleavedBufferAttribute)?(console.warn("THREE.BufferGeometry: .addAttribute() now expects ( name, attribute )."),void this.addAttribute(t,new mt(arguments[1],arguments[2]))):"index"===t?(console.warn("THREE.BufferGeometry.addAttribute: Use .setIndex() for index attribute."),void this.setIndex(e)):(this.attributes[t]=e,this)},getAttribute:function(t){return this.attributes[t]},removeAttribute:function(t){return delete this.attributes[t],this},addGroup:function(t,e,n){this.groups.push({start:t,count:e,materialIndex:void 0!==n?n:0})},clearGroups:function(){this.groups=[]},setDrawRange:function(t,e){this.drawRange.start=t,this.drawRange.count=e},applyMatrix:function(t){var e=this.attributes.position;void 0!==e&&(t.applyToVector3Array(e.array),e.needsUpdate=!0);var n=this.attributes.normal;if(void 0!==n){(new it).getNormalMatrix(t).applyToVector3Array(n.array),n.needsUpdate=!0}return null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this},rotateX:function(){var t;return function(e){return void 0===t&&(t=new u),t.makeRotationX(e),this.applyMatrix(t),this}}(),rotateY:function(){var t;return function(e){return void 0===t&&(t=new u),t.makeRotationY(e),this.applyMatrix(t),this}}(),rotateZ:function(){var t;return function(e){return void 0===t&&(t=new u),t.makeRotationZ(e),this.applyMatrix(t),this}}(),translate:function(){var t;return function(e,n,i){return void 0===t&&(t=new u),t.makeTranslation(e,n,i),this.applyMatrix(t),this}}(),scale:function(){var t;return function(e,n,i){return void 0===t&&(t=new u),t.makeScale(e,n,i),this.applyMatrix(t),this}}(),lookAt:function(){var t;return function(e){void 0===t&&(t=new ht),t.lookAt(e),t.updateMatrix(),this.applyMatrix(t.matrix)}}(),center:function(){this.computeBoundingBox();var t=this.boundingBox.getCenter().negate();return this.translate(t.x,t.y,t.z),t},setFromObject:function(t){var e=t.geometry;if(t.isPoints||t.isLine){var n=new Mt(3*e.vertices.length,3),i=new Mt(3*e.colors.length,3);if(this.addAttribute("position",n.copyVector3sArray(e.vertices)),this.addAttribute("color",i.copyColorsArray(e.colors)),e.lineDistances&&e.lineDistances.length===e.vertices.length){var r=new Mt(e.lineDistances.length,1);this.addAttribute("lineDistance",r.copyArray(e.lineDistances))}null!==e.boundingSphere&&(this.boundingSphere=e.boundingSphere.clone()),null!==e.boundingBox&&
1(this.boundingBox=e.boundingBox.clone())}else t.isMesh&&e&&e.isGeometry&&this.fromGeometry(e);return this},updateFromObject:function(t){var e=t.geometry;if(t.isMesh){var n=e.__directGeometry;if(!0===e.elementsNeedUpdate&&(n=void 0,e.elementsNeedUpdate=!1),void 0===n)return this.fromGeometry(e);n.verticesNeedUpdate=e.verticesNeedUpdate,n.normalsNeedUpdate=e.normalsNeedUpdate,n.colorsNeedUpdate=e.colorsNeedUpdate,n.uvsNeedUpdate=e.uvsNeedUpdate,n.groupsNeedUpdate=e.groupsNeedUpdate,e.verticesNeedUpdate=!1,e.normalsNeedUpdate=!1,e.colorsNeedUpdate=!1,e.uvsNeedUpdate=!1,e.groupsNeedUpdate=!1,e=n}var i;return!0===e.verticesNeedUpdate&&(i=this.attributes.position,void 0!==i&&(i.copyVector3sArray(e.vertices),i.needsUpdate=!0),e.verticesNeedUpdate=!1),!0===e.normalsNeedUpdate&&(i=this.attributes.normal,void 0!==i&&(i.copyVector3sArray(e.normals),i.needsUpdate=!0),e.normalsNeedUpdate=!1),!0===e.colorsNeedUpdate&&(i=this.attributes.color,void 0!==i&&(i.copyColorsArray(e.colors),i.needsUpdate=!0),e.colorsNeedUpdate=!1),e.uvsNeedUpdate&&(i=this.attributes.uv,void 0!==i&&(i.copyVector2sArray(e.uvs),i.needsUpdate=!0),e.uvsNeedUpdate=!1),e.lineDistancesNeedUpdate&&(i=this.attributes.lineDistance,void 0!==i&&(i.copyArray(e.lineDistances),i.needsUpdate=!0),e.lineDistancesNeedUpdate=!1),e.groupsNeedUpdate&&(e.computeGroups(t.geometry),this.groups=e.groups,e.groupsNeedUpdate=!1),this},fromGeometry:function(t){return t.__directGeometry=(new Tt).fromGeometry(t),this.fromDirectGeometry(t.__directGeometry)},fromDirectGeometry:function(t){var e=new Float32Array(3*t.vertices.length);if(this.addAttribute("position",new mt(e,3).copyVector3sArray(t.vertices)),t.normals.length>0){var n=new Float32Array(3*t.normals.length);this.addAttribute("normal",new mt(n,3).copyVector3sArray(t.normals))}if(t.colors.length>0){var i=new Float32Array(3*t.colors.length);this.addAttribute("color",new mt(i,3).copyColorsArray(t.colors))}if(t.uvs.length>0){var r=new Float32Array(2*t.uvs.length);this.addAttribute("uv",new mt(r,2).copyVector2sArray(t.uvs))}if(t.uvs2.length>0){var o=new Float32Array(2*t.uvs2.length);this.addAttribute("uv2",new mt(o,2).copyVector2sArray(t.uvs2))}if(t.indices.length>0){var a=t.vertices.length>65535?Uint32Array:Uint16Array,s=new a(3*t.indices.length);this.setIndex(new mt(s,1).copyIndicesArray(t.indices))}this.groups=t.groups;for(var c in t.morphTargets){for(var l=[],h=t.morphTargets[c],u=0,d=h.length;u<d;u++){var p=h[u],f=new Mt(3*p.length,3);l.push(f.copyVector3sArray(p))}this.morphAttributes[c]=l}if(t.skinIndices.length>0){var m=new Mt(4*t.skinIndices.length,4);this.addAttribute("skinIndex",m.copyVector4sArray(t.skinIndices))}if(t.skinWeights.length>0){var v=new Mt(4*t.skinWeights.length,4);this.addAttribute("skinWeight",v.copyVector4sArray(t.skinWeights))}return null!==t.boundingSphere&&(this.boundingSphere=t.boundingSphere.clone()),null!==t.boundingBox&&(this.boundingBox=t.boundingBox.clone()),this},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new et);var t=this.attributes.position;void 0!==t?this.boundingBox.setFromBufferAttribute(t):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 t=new et,e=new h;return function(){null===this.boundingSphere&&(this.boundingSphere=new nt);var n=this.attributes.position;if(n){var i=this.boundingSphere.center;t.setFromBufferAttribute(n),t.getCenter(i);for(var r=0,o=0,a=n.count;o<a;o++)e.x=n.getX(o),e.y=n.getY(o),e.z=n.getZ(o),r=Math.max(r,i.distanceToSquared(e));this.boundingSphere.radius=Math.sqrt(r),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 t=this.index,e=this.attributes,n=this.groups;if(e.position){var i=e.position.array;if(void 0===e.normal)this.addAttribute("normal",new mt(new Float32Array(i.length),3));else for(var r=e.normal.array,o=0,a=r.length;o<a;o++)r[o]=0;var s,c,l,u=e.normal.array,d=new h,p=new h,f=new h,m=new h,v=new h;if(t){var g=t.array;0===n.length&&this.addGroup(0,g.length);for(var y=0,_=n.length;y<_;++y)for(var b=n[y],x=b.start,w=b.count,o=x,a=x+w;o<a;o+=3)s=3*g[o+0],c=3*g[o+1],l=3*g[o+2],d.fromArray(i,s),p.fromArray(i,c),f.fromArray(i,l),m.subVectors(f,p),v.subVectors(d,p),m.cross(v),u[s]+=m.x,u[s+1]+=m.y,u[s+2]+=m.z,u[c]+=m.x,u[c+1]+=m.y,u[c+2]+=m.z,u[l]+=m.x,u[l+1]+=m.y,u[l+2]+=m.z}else for(var o=0,a=i.length;o<a;o+=9)d.fromArray(i,o),p.fromArray(i,o+3),f.fromArray(i,o+6),m.subVectors(f,p),v.subVectors(d,p),m.cross(v),u[o]=m.x,u[o+1]=m.y,u[o+2]=m.z,u[o+3]=m.x,u[o+4]=m.y,u[o+5]=m.z,u[o+6]=m.x,u[o+7]=m.y,u[o+8]=m.z;this.normalizeNormals(),e.normal.needsUpdate=!0}},merge:function(t,e){if(!1===(t&&t.isBufferGeometry))return void console.error("THREE.BufferGeometry.merge(): geometry not an instance of THREE.BufferGeometry.",t);void 0===e&&(e=0);var n=this.attributes;for(var i in n)if(void 0!==t.attributes[i])for(var r=n[i],o=r.array,a=t.attributes[i],s=a.array,c=a.itemSize,l=0,h=c*e;l<s.length;l++,h++)o[h]=s[l];return this},normalizeNormals:function(){for(var t,e,n,i,r=this.attributes.normal.array,o=0,a=r.length;o<a;o+=3)t=r[o],e=r[o+1],n=r[o+2],i=1/Math.sqrt(t*t+e*e+n*n),r[o]*=i,r[o+1]*=i,r[o+2]*=i},toNonIndexed:function(){if(null===this.index)return console.warn("THREE.BufferGeometry.toNonIndexed(): Geometry is already non-indexed."),this;var t=new Lt,e=this.index.array,n=this.attributes;for(var i in n){for(var r=n[i],o=r.array,a=r.itemSize,s=new o.constructor(e.length*a),c=0,l=0,h=0,u=e.length;h<u;h++){c=e[h]*a;for(var d=0;d<a;d++)s[l++]=o[c++]}t.addAttribute(i,new mt(s,a))}return t},toJSON:function(){var t={metadata:{version:4.4,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};
1if(t.uuid=this.uuid,t.type=this.type,""!==this.name&&(t.name=this.name),void 0!==this.parameters){var e=this.parameters;for(var n in e)void 0!==e[n]&&(t[n]=e[n]);return t}t.data={attributes:{}};var i=this.index;if(null!==i){var r=Array.prototype.slice.call(i.array);t.data.index={type:i.array.constructor.name,array:r}}var o=this.attributes;for(var n in o){var a=o[n],r=Array.prototype.slice.call(a.array);t.data.attributes[n]={itemSize:a.itemSize,type:a.array.constructor.name,array:r,normalized:a.normalized}}var s=this.groups;s.length>0&&(t.data.groups=JSON.parse(JSON.stringify(s)));var c=this.boundingSphere;return null!==c&&(t.data.boundingSphere={center:c.center.toArray(),radius:c.radius}),t},clone:function(){return(new Lt).copy(this)},copy:function(t){var e=t.index;null!==e&&this.setIndex(e.clone());var n=t.attributes;for(var i in n){var r=n[i];this.addAttribute(i,r.clone())}for(var o=t.groups,a=0,s=o.length;a<s;a++){var c=o[a];this.addGroup(c.start,c.count,c.materialIndex)}return this},dispose:function(){this.dispatchEvent({type:"dispose"})}}),Lt.MaxIndex=65535,Rt.prototype=Object.assign(Object.create(ht.prototype),{constructor:Rt,isMesh:!0,setDrawMode:function(t){this.drawMode=t},copy:function(t){return ht.prototype.copy.call(this,t),this.drawMode=t.drawMode,this},updateMorphTargets:function(){var t=this.geometry.morphTargets;if(void 0!==t&&t.length>0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(var e=0,n=t.length;e<n;e++)this.morphTargetInfluences.push(0),this.morphTargetDictionary[t[e].name]=e}},raycast:function(){function t(t,e,n,i,r,o,a){return dt.barycoordFromPoint(t,e,n,i,y),r.multiplyScalar(y.x),o.multiplyScalar(y.y),a.multiplyScalar(y.z),r.add(o).add(a),r.clone()}function e(t,e,n,i,r,o,a){var s=t.material;if(null===(s.side===pr?n.intersectTriangle(o,r,i,!0,a):n.intersectTriangle(i,r,o,s.side!==fr,a)))return null;
1b.copy(a),b.applyMatrix4(t.matrixWorld);var c=e.ray.origin.distanceTo(b);return c<e.near||c>e.far?null:{distance:c,point:b.clone(),object:t}}function n(n,i,r,o,a,h,u,d){s.fromArray(o,3*h),c.fromArray(o,3*u),l.fromArray(o,3*d);var p=e(n,i,r,s,c,l,_);return p&&(a&&(m.fromArray(a,2*h),v.fromArray(a,2*u),g.fromArray(a,2*d),p.uv=t(_,s,c,l,m,v,g)),p.face=new pt(h,u,d,dt.normal(s,c,l)),p.faceIndex=h),p}var i=new u,o=new st,a=new nt,s=new h,c=new h,l=new h,d=new h,p=new h,f=new h,m=new r,v=new r,g=new r,y=new h,_=new h,b=new h;return function(r,h){var u=this.geometry,y=this.material,b=this.matrixWorld;if(void 0!==y&&(null===u.boundingSphere&&u.computeBoundingSphere(),a.copy(u.boundingSphere),a.applyMatrix4(b),!1!==r.ray.intersectsSphere(a)&&(i.getInverse(b),o.copy(r.ray).applyMatrix4(i),null===u.boundingBox||!1!==o.intersectsBox(u.boundingBox)))){var x,w;if(u.isBufferGeometry){var M,E,T,S=u.index,A=u.attributes,L=A.position.array;if(void 0!==A.uv&&(x=A.uv.array),null!==S)for(var R=S.array,C=0,P=R.length;C<P;C+=3)M=R[C],E=R[C+1],T=R[C+2],(w=n(this,r,o,L,x,M,E,T))&&(w.faceIndex=Math.floor(C/3),h.push(w));else for(var C=0,P=L.length;C<P;C+=9)M=C/3,E=M+1,T=M+2,(w=n(this,r,o,L,x,M,E,T))&&(w.index=M,h.push(w))}else if(u.isGeometry){var O,I,U,N=y&&y.isMultiMaterial,D=!0===N?y.materials:null,F=u.vertices,z=u.faces,B=u.faceVertexUvs[0];B.length>0&&(x=B);for(var k=0,j=z.length;k<j;k++){var G=z[k],H=!0===N?D[G.materialIndex]:y;if(void 0!==H){if(O=F[G.a],I=F[G.b],U=F[G.c],!0===H.morphTargets){var V=u.morphTargets,W=this.morphTargetInfluences;s.set(0,0,0),c.set(0,0,0),l.set(0,0,0);for(var X=0,q=V.length;X<q;X++){var Y=W[X];if(0!==Y){var Z=V[X].vertices;s.addScaledVector(d.subVectors(Z[G.a],O),Y),c.addScaledVector(p.subVectors(Z[G.b],I),Y),l.addScaledVector(f.subVectors(Z[G.c],U),Y)}}s.add(O),c.add(I),l.add(U),O=s,I=c,U=l}if(w=e(this,r,o,O,I,U,_)){if(x){var J=x[k];m.copy(J[0]),v.copy(J[1]),g.copy(J[2]),w.uv=t(_,O,I,U,m,v,g)}w.face=G,w.faceIndex=k,h.push(w)}}}}}}}(),clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}}),Ct.prototype=Object.create(Lt.prototype),Ct.prototype.constructor=Ct,Pt.prototype=Object.create(Lt.prototype),Pt.prototype.constructor=Pt,Ot.prototype=Object.create(ht.prototype),Ot.prototype.constructor=Ot,Ot.prototype.isCamera=!0,Ot.prototype.getWorldDirection=function(){var t=new l;return function(e){var n=e||new h;return this.getWorldQuaternion(t),n.set(0,0,-1).applyQuaternion(t)}}(),Ot.prototype.lookAt=function(){var t=new u;return function(e){t.lookAt(this.position,e,this.up),this.quaternion.setFromRotationMatrix(t)}}(),Ot.prototype.clone=function(){return(new this.constructor).copy(this)},Ot.prototype.copy=function(t){return ht.prototype.copy.call(this,t),this.matrixWorldInverse.copy(t.matrixWorldInverse),this.projectionMatrix.copy(t.projectionMatrix),this},It.prototype=Object.assign(Object.create(Ot.prototype),{constructor:It,isPerspectiveCamera:!0,copy:function(t){return Ot.prototype.copy.call(this,t),this.fov=t.fov,this.zoom=t.zoom,this.near=t.near,this.far=t.far,this.focus=t.focus,this.aspect=t.aspect,this.view=null===t.view?null:Object.assign({},t.view),this.filmGauge=t.filmGauge,this.filmOffset=t.filmOffset,this},setFocalLength:function(t){var e=.5*this.getFilmHeight()/t;this.fov=2*pa.RAD2DEG*Math.atan(e),this.updateProjectionMatrix()},getFocalLength:function(){var t=Math.tan(.5*pa.DEG2RAD*this.fov);return.5*this.getFilmHeight()/t},getEffectiveFOV:function(){return 2*pa.RAD2DEG*Math.atan(Math.tan(.5*pa.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)}
1,setViewOffset:function(t,e,n,i,r,o){this.aspect=t/e,this.view={fullWidth:t,fullHeight:e,offsetX:n,offsetY:i,width:r,height:o},this.updateProjectionMatrix()},clearViewOffset:function(){this.view=null,this.updateProjectionMatrix()},updateProjectionMatrix:function(){var t=this.near,e=t*Math.tan(.5*pa.DEG2RAD*this.fov)/this.zoom,n=2*e,i=this.aspect*n,r=-.5*i,o=this.view;if(null!==o){var a=o.fullWidth,s=o.fullHeight;r+=o.offsetX*i/a,e-=o.offsetY*n/s,i*=o.width/a,n*=o.height/s}var c=this.filmOffset;0!==c&&(r+=t*c/this.getFilmWidth()),this.projectionMatrix.makeFrustum(r,r+i,e-n,e,t,this.far)},toJSON:function(t){var e=ht.prototype.toJSON.call(this,t);return e.object.fov=this.fov,e.object.zoom=this.zoom,e.object.near=this.near,e.object.far=this.far,e.object.focus=this.focus,e.object.aspect=this.aspect,null!==this.view&&(e.object.view=Object.assign({},this.view)),e.object.filmGauge=this.filmGauge,e.object.filmOffset=this.filmOffset,e}}),Ut.prototype=Object.assign(Object.create(Ot.prototype),{constructor:Ut,isOrthographicCamera:!0,copy:function(t){return Ot.prototype.copy.call(this,t),this.left=t.left,this.right=t.right,this.top=t.top,this.bottom=t.bottom,this.near=t.near,this.far=t.far,this.zoom=t.zoom,this.view=null===t.view?null:Object.assign({},t.view),this},setViewOffset:function(t,e,n,i,r,o){this.view={fullWidth:t,fullHeight:e,offsetX:n,offsetY:i,width:r,height:o},this.updateProjectionMatrix()},clearViewOffset:function(){this.view=null,this.updateProjectionMatrix()},updateProjectionMatrix:function(){var t=(this.right-this.left)/(2*this.zoom),e=(this.top-this.bottom)/(2*this.zoom),n=(this.right+this.left)/2,i=(this.top+this.bottom)/2,r=n-t,o=n+t,a=i+e,s=i-e;if(null!==this.view){var c=this.zoom/(this.view.width/this.view.fullWidth),l=this.zoom/(this.view.height/this.view.fullHeight),h=(this.right-this.left)/this.view.width,u=(this.top-this.bottom)/this.view.height;r+=h*(this.view.offsetX/c),o=r+h*(this.view.width/c),a-=u*(this.view.offsetY/l),s=a-u*(this.view.height/l)}this.projectionMatrix.makeOrthographic(r,o,a,s,this.near,this.far)},toJSON:function(t){var e=ht.prototype.toJSON.call(this,t);return e.object.zoom=this.zoom,e.object.left=this.left,e.object.right=this.right,e.object.top=this.top,e.object.bottom=this.bottom,e.object.near=this.near,e.object.far=this.far,null!==this.view&&(e.object.view=Object.assign({},this.view)),e}});var La=0;ce.prototype.isFogExp2=!0,ce.prototype.clone=function(){return new ce(this.color.getHex(),this.density)},ce.prototype.toJSON=function(t){return{type:"FogExp2",color:this.color.getHex(),density:this.density}},le.prototype.isFog=!0,le.prototype.clone=function(){return new le(this.color.getHex(),this.near,this.far)},le.prototype.toJSON=function(t){return{type:"Fog",color:this.color.getHex(),near:this.near,far:this.far}},he.prototype=Object.create(ht.prototype),he.prototype.constructor=he,he.prototype.copy=function(t,e){return ht.prototype.copy.call(this,t,e),null!==t.background&&(this.background=t.background.clone()),null!==t.fog&&(this.fog=t.fog.clone()),null!==t.overrideMaterial&&(this.overrideMaterial=t.overrideMaterial.clone()),this.autoUpdate=t.autoUpdate,this.matrixAutoUpdate=t.matrixAutoUpdate,this},he.prototype.toJSON=function(t){var e=ht.prototype.toJSON.call(this,t);return null!==this.background&&(e.object.background=this.background.toJSON(t)),null!==this.fog&&(e.object.fog=this.fog.toJSON()),e},ue.prototype=Object.assign(Object.create(ht.prototype),{constructor:ue,isLensFlare:!0,copy:function(t){ht.prototype.copy.call(this,t),this.positionScreen.copy(t.positionScreen),this.customUpdateCallback=t.customUpdateCallback;for(var e=0,n=t.lensFlares.length;e<n;e++)this.lensFlares.push(t.lensFlares[e]);return this},add:function(t,e,n,i,r,o){void 0===e&&(e=-1),void 0===n&&(n=0),void 0===o&&(o=1),void 0===r&&(r=new q(16777215)),void 0===i&&(i=xr),n=Math.min(n,Math.max(0,n)),this.lensFlares.push({texture:t,size:e,distance:n,x:0,y:0,z:0,scale:1,rotation:0,opacity:o,color:r,blending:i})},updateLensFlares:function(){var t,e,n=this.lensFlares.length,i=2*-this.positionScreen.x,r=2*-this.positionScreen.y;for(t=0;t<n;t++)e=this.lensFlares[t],e.x=this.positionScreen.x+i*e.distance,e.y=this.positionScreen.y+r*e.distance,e.wantedRotation=e.x*Math.PI*.25,e.rotation+=.25*(e.wantedRotation-e.rotation)}}),de.prototype=Object.create(K.prototype),de.prototype.constructor=de,de.prototype.copy=function(t){return K.prototype.copy.call(this,t),this.color.copy(t.color),this.map=t.map,this.rotation=t.rotation,this},pe.prototype=Object.assign(Object.create(ht.prototype),{constructor:pe,isSprite:!0,raycast:function(){var t=new h;return function(e,n){t.setFromMatrixPosition(this.matrixWorld);var i=e.ray.distanceSqToPoint(t);i>this.scale.x*this.scale.y/4||n.push({distance:Math.sqrt(i),point:this.position,face:null,object:this})}}(),clone:function(){return new this.constructor(this.material).copy(this)}}),fe.prototype=Object.assign(Object.create(ht.prototype),{constructor:fe,copy:function(t){ht.prototype.copy.call(this,t,!1);for(var e=t.levels,n=0,i=e.length;n<i;n++){var r=e[n];this.addLevel(r.object.clone(),r.distance)}return this},addLevel:function(t,e){void 0===e&&(e=0),e=Math.abs(e);for(var n=this.levels,i=0;i<n.length&&!(e<n[i].distance);i++);n.splice(i,0,{distance:e,object:t}),this.add(t)},getObjectForDistance:function(t){for(var e=this.levels,n=1,i=e.length;n<i&&!(t<e[n].distance);n++);return e[n-1].object},raycast:function(){var t=new h;return function(e,n){t.setFromMatrixPosition(this.matrixWorld);var i=e.ray.origin.distanceTo(t);this.getObjectForDistance(i).raycast(e,n)}}(),update:function(){var t=new h,e=new h;return function(n){var i=this.levels;if(i.length>1){t.setFromMatrixPosition(n.matrixWorld),e.setFromMatrixPosition(this.matrixWorld);var r=t.distanceTo(e);i[0].object.visible=!0;for(var o=1,a=i.length;o<a&&r>=i[o].distance;o++)i[o-1].object.visible=!1,i[o].object.visible=!0;for(;o<a;o++)i[o].object.visible=!1}}}(),toJSON:function(t){var e=ht.prototype.toJSON.call(this,t);e.object.levels=[];for(var n=this.levels,i=0,r=n.length;i<r;i++){var o=n[i];e.object.levels.push({object:o.object.uuid,distance:o.distance})}return e}}),Object.assign(me.prototype,{calculateInverses:function(){this.boneInverses=[];for(var t=0,e=this.bones.length;t<e;t++){var n=new u;this.bones[t]&&n.getInverse(this.bones[t].matrixWorld),this.boneInverses.push(n)}},pose:function(){for(var t,e=0,n=this.bones.length;e<n;e++)(t=this.bones[e])&&t.matrixWorld.getInverse(this.boneInverses[e]);for(var e=0,n=this.bones.length;e<n;e++)(t=this.bones[e])&&(t.parent&&t.parent.isBone?(t.matrix.getInverse(t.parent.matrixWorld),t.matrix.multiply(t.matrixWorld)):t.matrix.copy(t.matrixWorld),t.matrix.decompose(t.position,t.quaternion,t.scale))},update:function(){var t=new u;return function(){for(var e=0,n=this.bones.length;e<n;e++){var i=this.bones[e]?this.bones[e].matrixWorld:this.identityMatrix;t.multiplyMatrices(i,this.boneInverses[e]),t.toArray(this.boneMatrices,16*e)}this.useVertexTexture&&(this.boneTexture.needsUpdate=!0)}}(),clone:function(){return new me(this.bones,this.boneInverses,this.useVertexTexture)}}),ve.prototype=Object.assign(Object.create(ht.prototype),{constructor:ve,isBone:!0}),ge.prototype=Object.assign(Object.create(Rt.prototype),{constructor:ge,isSkinnedMesh:!0,bind:function(t,e){this.skeleton=t,void 0===e&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),e=this.matrixWorld),this.bindMatrix.copy(e),this.bindMatrixInverse.getInverse(e)},pose:function(){this.skeleton.pose()},normalizeSkinWeights:function(){if(this.geometry&&this.geometry.isGeometry)for(var t=0;t<this.geometry.skinWeights.length;t++){var e=this.geometry.skinWeights[t],n=1/e.lengthManhattan();n!==1/0?e.multiplyScalar(n):e.set(1,0,0,0)}else if(this.geometry&&this.geometry.isBufferGeometry)for(var i=new a,r=this.geometry.attributes.skinWeight,t=0;t<r.count;t++){i.x=r.getX(t),i.y=r.getY(t),i.z=r.getZ(t),i.w=r.getW(t);var n=1/i.lengthManhattan();n!==1/0?i.multiplyScalar(n):i.set(1,0,0,0),r.setXYZW(t,i.x,i.y,i.z,i.w)}},updateMatrixWorld:function(t){Rt.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)}}),ye.prototype=Object.create(K.prototype),ye.prototype.constructor=ye,ye.prototype.isLineBasicMaterial=!0,ye.prototype.copy=function(t){return K.prototype.copy.call(this,t),this.color.copy(t.color),this.linewidth=t.linewidth,this.linecap=t.linecap,this.linejoin=t.linejoin,this},_e.prototype=Object.assign(Object.create(ht.prototype),{constructor:_e,isLine:!0,raycast:function(){var t=new u,e=ne
1w st,n=new nt;return function(i,r){var o=i.linePrecision,a=o*o,s=this.geometry,c=this.matrixWorld;if(null===s.boundingSphere&&s.computeBoundingSphere(),n.copy(s.boundingSphere),n.applyMatrix4(c),!1!==i.ray.intersectsSphere(n)){t.getInverse(c),e.copy(i.ray).applyMatrix4(t);var l=new h,u=new h,d=new h,p=new h,f=this&&this.isLineSegments?2:1;if(s.isBufferGeometry){var m=s.index,v=s.attributes,g=v.position.array;if(null!==m)for(var y=m.array,_=0,b=y.length-1;_<b;_+=f){var x=y[_],w=y[_+1];l.fromArray(g,3*x),u.fromArray(g,3*w);var M=e.distanceSqToSegment(l,u,p,d);if(!(M>a)){p.applyMatrix4(this.matrixWorld);var E=i.ray.origin.distanceTo(p);E<i.near||E>i.far||r.push({distance:E,point:d.clone().applyMatrix4(this.matrixWorld),index:_,face:null,faceIndex:null,object:this})}}else for(var _=0,b=g.length/3-1;_<b;_+=f){l.fromArray(g,3*_),u.fromArray(g,3*_+3);var M=e.distanceSqToSegment(l,u,p,d);if(!(M>a)){p.applyMatrix4(this.matrixWorld);var E=i.ray.origin.distanceTo(p);E<i.near||E>i.far||r.push({distance:E,point:d.clone().applyMatrix4(this.matrixWorld),index:_,face:null,faceIndex:null,object:this})}}}else if(s.isGeometry)for(var T=s.vertices,S=T.length,_=0;_<S-1;_+=f){var M=e.distanceSqToSegment(T[_],T[_+1],p,d);if(!(M>a)){p.applyMatrix4(this.matrixWorld);var E=i.ray.origin.distanceTo(p);E<i.near||E>i.far||r.push({distance:E,point:d.clone().applyMatrix4(this.matrixWorld),index:_,face:null,faceIndex:null,object:this})}}}}}(),clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}}),be.prototype=Object.assign(Object.create(_e.prototype),{constructor:be,isLineSegments:!0}),xe.prototype=Object.create(K.prototype),xe.prototype.constructor=xe,xe.prototype.isPointsMaterial=!0,xe.prototype.copy=function(t){return K.prototype.copy.call(this,t),this.color.copy(t.color),this.map=t.map,this.size=t.size,this.sizeAttenuation=t.sizeAttenuation,this},we.prototype=Object.assign(Object.create(ht.prototype),{constructor:we,isPoints:!0,raycast:function(){var t=new u,e=new st,n=new nt;return function(i,r){function o(t,n){var o=e.distanceSqToPoint(t);if(o<d){var s=e.closestPointToPoint(t);s.applyMatrix4(c);var l=i.ray.origin.distanceTo(s);if(l<i.near||l>i.far)return;r.push({distance:l,distanceToRay:Math.sqrt(o),point:s.clone(),index:n,face:null,object:a})}}var a=this,s=this.geometry,c=this.matrixWorld,l=i.params.Points.threshold;if(null===s.boundingSphere&&s.computeBoundingSphere(),n.copy(s.boundingSphere),n.applyMatrix4(c),!1!==i.ray.intersectsSphere(n)){t.getInverse(c),e.copy(i.ray).applyMatrix4(t);var u=l/((this.scale.x+this.scale.y+this.scale.z)/3),d=u*u,p=new h;if(s.isBufferGeometry){var f=s.index,m=s.attributes,v=m.position.array;if(null!==f)for(var g=f.array,y=0,_=g.length;y<_;y++){var b=g[y];p.fromArray(v,3*b),o(p,b)}else for(var y=0,x=v.length/3;y<x;y++)p.fromArray(v,3*y),o(p,y)}else for(var w=s.vertices,y=0,x=w.length;y<x;y++)o(w[y],y)}}}(),clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}}),Me.prototype=Object.assign(Object.create(ht.prototype),{constructor:Me}),Ee.prototype=Object.create(o.prototype),Ee.prototype.constructor=Ee,Te.prototype=Object.create(o.prototype),Te.prototype.constructor=Te,Te.prototype.isCompressedTexture=!0,Se.prototype=Object.create(o.prototype),Se.prototype.constructor=Se,Ae.prototype=Object.create(o.prototype),Ae.prototype.constructor=Ae,Ae.prototype.isDepthTexture=!0,Le.prototype=Object.create(Lt.prototype),Le.prototype.constructor=Le,Re.prototype=Object.create(Lt.prototype),Re.prototype.constructor=Re,Ce.prototype=Object.create(St.prototype),Ce.prototype.constructor=Ce,Pe.prototype=Object.create(Lt.prototype),Pe.prototype.constructor=Pe,Oe.prototype=Object.create(Pe.prototype),Oe.prototype.constructor=Oe,Ie.prototype=Object.create(St.prototype),Ie.prototype.constructor=Ie,Ue.prototype=Object.create(Pe.prototype),Ue.prototype.constructor=Ue,Ne.prototype=Object.create(St.prototype),Ne.prototype.constructor=Ne,De.prototype=Object.create(Pe.prototype),De.prototype.constructor=De,Fe.prototype=Object.create(St.prototype),Fe.prototype.constructor=Fe,ze.prototype=Object.create(Pe.prototype),ze.prototype.constructor=ze,Be.prototype=Object.create(St.prototype),Be.prototype.constructor=Be,ke.prototype=Object.create(St.prototype),ke.prototype.constructor=ke,je.prototype=Object.create(Lt.prototype),je.prototype.constructor=je,Ge.prototype=Object.create(St.prototype),Ge.prototype.constructor=Ge,He.prototype=Object.create(Lt.prototype),He.prototype.constructor=He,Ve.prototype=Object.create(St.prototype),Ve.prototype.constructor=Ve,We.prototype=Object.create(Lt.prototype),We.prototype.constructor=We,Xe.prototype=Object.create(St.prototype),Xe.prototype.constructor=Xe;var Ra={area:function(t){for(var e=t.length,n=0,i=e-1,r=0;r<e;i=r++)n+=t[i].x*t[r].y-t[r].x*t[i].y;return.5*n},triangulate:function(){function t(t,e,n,i,r,o){var a,s,c,l,h,u,d,p,f;if(s=t[o[e]].x,c=t[o[e]].y,l=t[o[n]].x,h=t[o[n]].y,u=t[o[i]].x,d=t[o[i]].y,(l-s)*(d-c)-(h-c)*(u-s)<=0)return!1;var m,v,g,y,_,b,x,w,M,E,T,S,A,L,R;for(m=u-l,v=d-h,g=s-u,y=c-d,_=l-s,b=h-c,a=0;a<r;a++)if(p=t[o[a]].x,f=t[o[a]].y,!(p===s&&f===c||p===l&&f===h||p===u&&f===d)&&(x=p-s,w=f-c,M=p-l,E=f-h,T=p-u,S=f-d,R=m*E-v*M,A=_*w-b*x,L=g*S-y*T,R>=-Number.EPSILON&&L>=-Number.EPSILON&&A>=-Number.EPSILON))return!1;return!0}return function(e,n){var i=e.length;if(i<3)return null;var r,o,a,s=[],c=[],l=[];
1if(Ra.area(e)>0)for(o=0;o<i;o++)c[o]=o;else for(o=0;o<i;o++)c[o]=i-1-o;var h=i,u=2*h;for(o=h-1;h>2;){if(u--<=0)return console.warn("THREE.ShapeUtils: Unable to triangulate polygon! in triangulate()"),n?l:s;if(r=o,h<=r&&(r=0),o=r+1,h<=o&&(o=0),a=o+1,h<=a&&(a=0),t(e,r,o,a,h,c)){var d,p,f,m,v;for(d=c[r],p=c[o],f=c[a],s.push([e[d],e[p],e[f]]),l.push([c[r],c[o],c[a]]),m=o,v=o+1;v<h;m++,v++)c[m]=c[v];h--,u=2*h}}return n?l:s}}(),triangulateShape:function(t,e){function n(t){var e=t.length;e>2&&t[e-1].equals(t[0])&&t.pop()}function i(t,e,n){return t.x!==e.x?t.x<e.x?t.x<=n.x&&n.x<=e.x:e.x<=n.x&&n.x<=t.x:t.y<e.y?t.y<=n.y&&n.y<=e.y:e.y<=n.y&&n.y<=t.y}function r(t,e,n,r,o){var a=e.x-t.x,s=e.y-t.y,c=r.x-n.x,l=r.y-n.y,h=t.x-n.x,u=t.y-n.y,d=s*c-a*l,p=s*h-a*u;if(Math.abs(d)>Number.EPSILON){var f;if(d>0){if(p<0||p>d)return[];if((f=l*h-c*u)<0||f>d)return[]}else{if(p>0||p<d)return[];if((f=l*h-c*u)>0||f<d)return[]}if(0===f)return!o||0!==p&&p!==d?[t]:[];if(f===d)return!o||0!==p&&p!==d?[e]:[];if(0===p)return[n];if(p===d)return[r];var m=f/d;return[{x:t.x+m*a,y:t.y+m*s}]}if(0!==p||l*h!==c*u)return[];var v=0===a&&0===s,g=0===c&&0===l;if(v&&g)return t.x!==n.x||t.y!==n.y?[]:[t];if(v)return i(n,r,t)?[t]:[];if(g)return i(t,e,n)?[n]:[];var y,_,b,x,w,M,E,T;return 0!==a?(t.x<e.x?(y=t,b=t.x,_=e,x=e.x):(y=e,b=e.x,_=t,x=t.x),n.x<r.x?(w=n,E=n.x,M=r,T=r.x):(w=r,E=r.x,M=n,T=n.x)):(t.y<e.y?(y=t,b=t.y,_=e,x=e.y):(y=e,b=e.y,_=t,x=t.y),n.y<r.y?(w=n,E=n.y,M=r,T=r.y):(w=r,E=r.y,M=n,T=n.y)),b<=E?x<E?[]:x===E?o?[]:[w]:x<=T?[w,_]:[w,M]:b>T?[]:b===T?o?[]:[y]:x<=T?[y,_]:[y,M]}function o(t,e,n,i){var r=e.x-t.x,o=e.y-t.y,a=n.x-t.x,s=n.y-t.y,c=i.x-t.x,l=i.y-t.y,h=r*s-o*a,u=r*l-o*c;if(Math.abs(h)>Number.EPSILON){var d=c*s-l*a;return h>0?u>=0&&d>=0:u>=0||d>=0}return u>0}n(t),e.forEach(n);for(var a,s,c,l,h,u,d={},p=t.concat(),f=0,m=e.length;f<m;f++)Array.prototype.push.apply(p,e[f]);for(a=0,s=p.length;a<s;a++)h=p[a].x+":"+p[a].y,void 0!==d[h]&&console.warn("THREE.ShapeUtils: Duplicate point",h,a),d[h]=a;var v=function(t,e){for(var n,i,a,s,c,l,h,u,d,p,f,m=t.concat(),v=[],g=[],y=0,_=e.length;y<_;y++)v.push(y);for(var b=0,x=2*v.length;v.length>0;){if(--x<0){console.log("Infinite Loop! Holes left:"+v.length+", Probably Hole outside Shape!");break}for(a=b;a<m.length;a++){s=m[a],i=-1;for(var y=0;y<v.length;y++)if(l=v[y],h=s.x+":"+s.y+":"+l,void 0===g[h]){n=e[l];for(var w=0;w<n.length;w++)if(c=n[w],function(t,e){var i=m.length-1,r=t-1;r<0&&(r=i);var a=t+1;a>i&&(a=0);var s=o(m[t],m[r],m[a],n[e]);if(!s)return!1;var c=n.length-1,l=e-1;l<0&&(l=c);var h=e+1;return h>c&&(h=0),!!(s=o(n[e],n[l],n[h],m[t]))}(a,w)&&!function(t,e){var n,i,o;for(n=0;n<m.length;n++)if(i=n+1,i%=m.length,o=r(t,e,m[n],m[i],!0),o.length>0)return!0;return!1}(s,c)&&!function(t,n){var i,o,a,s,c;for(i=0;i<v.length;i++)for(o=e[v[i]],a=0;a<o.length;a++)if(s=a+1,s%=o.length,c=r(t,n,o[a],o[s],!0),c.length>0)return!0;return!1}(s,c)){i=w,v.splice(y,1),u=m.slice(0,a+1),d=m.slice(a),p=n.slice(i),f=n.slice(0,i+1),m=u.concat(p).concat(f).concat(d),b=a;break}if(i>=0)break;g[h]=!0}if(i>=0)break}}return m}(t,e),g=Ra.triangulate(v,!1);for(a=0,s=g.length;a<s;a++)for(l=g[a],c=0;c<3;c++)h=l[c].x+":"+l[c].y,void 0!==(u=d[h])&&(l[c]=u);return g.concat()},isClockWise:function(t){return Ra.area(t)<0},b2:function(){function t(t,e){var n=1-t;return n*n*e}function e(t,e){return 2*(1-t)*t*e}function n(t,e){return t*t*e}return function(i,r,o,a){return t(i,r)+e(i,o)+n(i,a)}}(),b3:function(){function t(t,e){var n=1-t;return n*n*n*e}function e(t,e){var n=1-t;return 3*n*n*t*e}function n(t,e){return 3*(1-t)*t*t*e}function i(t,e){return t*t*t*e}return function(r,o,a,s,c){return t(r,o)+e(r,a)+n(r,s)+i(r,c)}}()};qe.prototype=Object.create(St.prototype),qe.prototype.constructor=qe,qe.prototype.addShapeList=function(t,e){for(var n=t.length,i=0;i<n;i++){var r=t[i];this.addShape(r,e)}},qe.prototype.addShape=function(t,e){function n(t,e,n){return e||console.error("THREE.ExtrudeGeometry: vec does not exist"),e.clone().multiplyScalar(n).add(t)}function i(t,e,n){var i,o,a=1,s=t.x-e.x,c=t.y-e.y,l=n.x-t.x,h=n.y-t.y,u=s*s+c*c,d=s*h-c*l;if(Math.abs(d)>Number.EPSILON){var p=Math.sqrt(u),f=Math.sqrt(l*l+h*h),m=e.x-c/p,v=e.y+s/p,g=n.x-h/f,y=n.y+l/f,_=((g-m)*h-(y-v)*l)/(s*h-c*l);i=m+s*_-t.x,o=v+c*_-t.y;var b=i*i+o*o;if(b<=2)return new r(i,o);a=Math.sqrt(b/2)}else{var x=!1;s>Number.EPSILON?l>Number.EPSILON&&(x=!0):s<-Number.EPSILON?l<-Number.EPSILON&&(x=!0):Math.sign(c)===Math.sign(h)&&(x=!0),x?(i=-c,o=s,a=Math.sqrt(u)):(i=s,o=c,a=Math.sqrt(u/2))}return new r(i/a,o/a)}function o(t,e){var n,i;for(W=t.length;--W>=0;){n=W,i=W-1,i<0&&(i=t.length-1);var r=0,o=x+2*y;for(r=0;r<o;r++){var a=G*r,s=G*(r+1);c(e+n+a,e+i+a,e+i+s,e+n+s,t,r,o,n,i)}}}
1function a(t,e,n){L.vertices.push(new h(t,e,n))}function s(t,e,n){t+=R,e+=R,n+=R,L.faces.push(new pt(t,e,n,null,null,0));var i=E.generateTopUV(L,t,e,n);L.faceVertexUvs[0].push(i)}function c(t,e,n,i,r,o,a,s,c){t+=R,e+=R,n+=R,i+=R,L.faces.push(new pt(t,e,i,null,null,1)),L.faces.push(new pt(e,n,i,null,null,1));var l=E.generateSideWallUV(L,t,e,n,i);L.faceVertexUvs[0].push([l[0],l[1],l[3]]),L.faceVertexUvs[0].push([l[1],l[2],l[3]])}var l,u,d,p,f,m=void 0!==e.amount?e.amount:100,v=void 0!==e.bevelThickness?e.bevelThickness:6,g=void 0!==e.bevelSize?e.bevelSize:v-2,y=void 0!==e.bevelSegments?e.bevelSegments:3,_=void 0===e.bevelEnabled||e.bevelEnabled,b=void 0!==e.curveSegments?e.curveSegments:12,x=void 0!==e.steps?e.steps:1,w=e.extrudePath,M=!1,E=void 0!==e.UVGenerator?e.UVGenerator:qe.WorldUVGenerator;w&&(l=w.getSpacedPoints(x),M=!0,_=!1,u=void 0!==e.frames?e.frames:w.computeFrenetFrames(x,!1),d=new h,p=new h,f=new h),_||(y=0,v=0,g=0);var T,S,A,L=this,R=this.vertices.length,C=t.extractPoints(b),P=C.shape,O=C.holes,I=!Ra.isClockWise(P);if(I){for(P=P.reverse(),S=0,A=O.length;S<A;S++)T=O[S],Ra.isClockWise(T)&&(O[S]=T.reverse());I=!1}var U=Ra.triangulateShape(P,O),N=P;for(S=0,A=O.length;S<A;S++)T=O[S],P=P.concat(T);for(var D,F,z,B,k,j,G=P.length,H=U.length,V=[],W=0,X=N.length,q=X-1,Y=W+1;W<X;W++,q++,Y++)q===X&&(q=0),Y===X&&(Y=0),V[W]=i(N[W],N[q],N[Y]);var Z,J=[],Q=V.concat();for(S=0,A=O.length;S<A;S++){for(T=O[S],Z=[],W=0,X=T.length,q=X-1,Y=W+1;W<X;W++,q++,Y++)q===X&&(q=0),Y===X&&(Y=0),Z[W]=i(T[W],T[q],T[Y]);J.push(Z),Q=Q.concat(Z)}for(D=0;D<y;D++){for(z=D/y,B=v*Math.cos(z*Math.PI/2),F=g*Math.sin(z*Math.PI/2),W=0,X=N.length;W<X;W++)k=n(N[W],V[W],F),a(k.x,k.y,-B);for(S=0,A=O.length;S<A;S++)for(T=O[S],Z=J[S],W=0,X=T.length;W<X;W++)k=n(T[W],Z[W],F),a(k.x,k.y,-B)}for(F=g,W=0;W<G;W++)k=_?n(P[W],Q[W],F):P[W],M?(p.copy(u.normals[0]).multiplyScalar(k.x),d.copy(u.binormals[0]).multiplyScalar(k.y),f.copy(l[0]).add(p).add(d),a(f.x,f.y,f.z)):a(k.x,k.y,0);var K;for(K=1;K<=x;K++)for(W=0;W<G;W++)k=_?n(P[W],Q[W],F):P[W],M?(p.copy(u.normals[K]).multiplyScalar(k.x),d.copy(u.binormals[K]).multiplyScalar(k.y),f.copy(l[K]).add(p).add(d),a(f.x,f.y,f.z)):a(k.x,k.y,m/x*K);for(D=y-1;D>=0;D--){for(z=D/y,B=v*Math.cos(z*Math.PI/2),F=g*Math.sin(z*Math.PI/2),W=0,X=N.length;W<X;W++)k=n(N[W],V[W],F),a(k.x,k.y,m+B);for(S=0,A=O.length;S<A;S++)for(T=O[S],Z=J[S],W=0,X=T.length;W<X;W++)k=n(T[W],Z[W],F),M?a(k.x,k.y+l[x-1].y,l[x-1].x+B):a(k.x,k.y,m+B)}!function(){if(_){var t=0,e=G*t;for(W=0;W<H;W++)j=U[W],s(j[2]+e,j[1]+e,j[0]+e);for(t=x+2*y,e=G*t,W=0;W<H;W++)j=U[W],s(j[0]+e,j[1]+e,j[2]+e)}else{for(W=0;W<H;W++)j=U[W],s(j[2],j[1],j[0]);for(W=0;W<H;W++)j=U[W],s(j[0]+G*x,j[1]+G*x,j[2]+G*x)}}(),function(){var t=0;for(o(N,t),t+=N.length,S=0,A=O.length;S<A;S++)T=O[S],o(T,t),t+=T.length}()},qe.WorldUVGenerator={generateTopUV:function(t,e,n,i){var o=t.vertices,a=o[e],s=o[n],c=o[i];return[new r(a.x,a.y),new r(s.x,s.y),new r(c.x,c.y)]},generateSideWallUV:function(t,e,n,i,o){var a=t.vertices,s=a[e],c=a[n],l=a[i],h=a[o];return Math.abs(s.y-c.y)<.01?[new r(s.x,1-s.z),new r(c.x,1-c.z),new r(l.x,1-l.z),new r(h.x,1-h.z)]:[new r(s.y,1-s.z),new r(c.y,1-c.z),new r(l.y,1-l.z),new r(h.y,1-h.z)]}},Ye.prototype=Object.create(qe.prototype),Ye.prototype.constructor=Ye,Ze.prototype=Object.create(Lt.prototype),Ze.prototype.constructor=Ze,Je.prototype=Object.create(St.prototype),Je.prototype.constructor=Je,Qe.prototype=Object.create(Lt.prototype),Qe.prototype.constructor=Qe,Ke.prototype=Object.create(St.prototype),Ke.prototype.constructor=Ke,$e.prototype=Object.create(St.prototype),$e.prototype.constructor=$e,tn.prototype=Object.create(Lt.prototype),tn.prototype.constructor=tn,en.prototype=Object.create(St.prototype),en.prototype.constructor=en,nn.prototype=Object.create(Lt.prototype),nn.prototype.constructor=nn,rn.prototype=Object.create(St.prototype),rn.prototype.constructor=rn,on.prototype=Object.create(Lt.prototype),on.prototype.constructor=on,an.prototype=Object.create(Lt.prototype),an.prototype.constructor=an,sn.prototype=Object.create(St.prototype),sn.prototype.constructor=sn,cn.prototype=Object.create(sn.prototype),cn.prototype.constructor=cn,ln.prototype=Object.create(an.prototype),ln.prototype.constructor=ln,hn.prototype=Object.create(Lt.prototype),hn.prototype.constructor=hn,un.prototype=Object.create(St.prototype),un.prototype.constructor=un,dn.prototype=Object.create(St.prototype),dn.prototype.constructor=dn;var Ca=Object.freeze({WireframeGeometry:Le,ParametricGeometry:Ce,ParametricBufferGeometry:Re,TetrahedronGeometry:Ie,TetrahedronBufferGeometry:Oe,OctahedronGeometry:Ne,OctahedronBufferGeometry:Ue,IcosahedronGeometry:Fe,IcosahedronBufferGeometry:De,DodecahedronGeometry:Be,DodecahedronBufferGeometry:ze,PolyhedronGeometry:ke,PolyhedronBufferGeometry:Pe,TubeGeometry:Ge,TubeBufferGeometry:je,TorusKnotGeometry:Ve,TorusKnotBufferGeometry:He,TorusGeometry:Xe,TorusBufferGeometry:We,TextGeometry:Ye,SphereBufferGeometry:Ze,SphereGeometry:Je,RingGeometry:Ke,RingBufferGeometry:Qe,PlaneBufferGeometry:Pt,PlaneGeometry:$e,LatheGeometry:en,LatheBufferGeometry:tn,ShapeGeometry:rn,ShapeBufferGeometry:nn,ExtrudeGeometry:qe,EdgesGeometry:on,ConeGeometry:cn,ConeBufferGeometry:ln,CylinderGeometry:sn,CylinderBufferGeometry:an,CircleBufferGeometry:hn,CircleGeometry:un,BoxBufferGeometry:Ct,BoxGeometry:dn});pn.prototype=Object.create($.prototype),pn.prototype.constructor=pn,pn.prototype.isShadowMaterial=!0,fn.prototype=Object.create($.prototype),fn.prototype.constructor=fn,fn.prototype.isRawShaderMaterial=!0,mn.prototype={constructor:mn,isMultiMaterial:!0,toJSON:function(t){for(var e={metadata:{version:4.2,type:"material",generator:"MaterialExporter"}
1,uuid:this.uuid,type:this.type,materials:[]},n=this.materials,i=0,r=n.length;i<r;i++){var o=n[i].toJSON(t);delete o.metadata,e.materials.push(o)}return e.visible=this.visible,e},clone:function(){for(var t=new this.constructor,e=0;e<this.materials.length;e++)t.materials.push(this.materials[e].clone());return t.visible=this.visible,t}},vn.prototype=Object.create(K.prototype),vn.prototype.constructor=vn,vn.prototype.isMeshStandardMaterial=!0,vn.prototype.copy=function(t){return K.prototype.copy.call(this,t),this.defines={STANDARD:""},this.color.copy(t.color),this.roughness=t.roughness,this.metalness=t.metalness,this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.roughnessMap=t.roughnessMap,this.metalnessMap=t.metalnessMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.envMapIntensity=t.envMapIntensity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this},gn.prototype=Object.create(vn.prototype),gn.prototype.constructor=gn,gn.prototype.isMeshPhysicalMaterial=!0,gn.prototype.copy=function(t){return vn.prototype.copy.call(this,t),this.defines={PHYSICAL:""},this.reflectivity=t.reflectivity,this.clearCoat=t.clearCoat,this.clearCoatRoughness=t.clearCoatRoughness,this},yn.prototype=Object.create(K.prototype),yn.prototype.constructor=yn,yn.prototype.isMeshPhongMaterial=!0,yn.prototype.copy=function(t){return K.prototype.copy.call(this,t),this.color.copy(t.color),this.specular.copy(t.specular),this.shininess=t.shininess,this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this},_n.prototype=Object.create(yn.prototype),_n.prototype.constructor=_n,_n.prototype.isMeshToonMaterial=!0,_n.prototype.copy=function(t){return yn.prototype.copy.call(this,t),this.gradientMap=t.gradientMap,this},bn.prototype=Object.create(K.prototype),bn.prototype.constructor=bn,bn.prototype.isMeshNormalMaterial=!0,bn.prototype.copy=function(t){return K.prototype.copy.call(this,t),this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this},xn.prototype=Object.create(K.prototype),xn.prototype.constructor=xn,xn.prototype.isMeshLambertMaterial=!0,xn.prototype.copy=function(t){return K.prototype.copy.call(this,t),this.color.copy(t.color),this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this},wn.prototype=Object.create(K.prototype),wn.prototype.constructor=wn,wn.prototype.isLineDashedMaterial=!0,wn.prototype.copy=function(t){return K.prototype.copy.call(this,t),this.color.copy(t.color),this.linewidth=t.linewidth,this.scale=t.scale,this.dashSize=t.dashSize,this.gapSize=t.gapSize,this};var Pa=Object.freeze({ShadowMaterial:pn,SpriteMaterial:de,RawShaderMaterial:fn,ShaderMaterial:$,PointsMaterial:xe,MultiMaterial:mn,MeshPhysicalMaterial:gn,MeshStandardMaterial:vn,MeshPhongMaterial:yn,MeshToonMaterial:_n,MeshNormalMaterial:bn,MeshLambertMaterial:xn,MeshDepthMaterial:tt,MeshBasicMaterial:ft,LineDashedMaterial:wn,LineBasicMaterial:ye,Material:K}),Oa={enabled:!1,files:{},add:function(t,e){!1!==this.enabled&&(this.files[t]=e)},get:function(t){if(!1!==this.enabled)return this.files[t]},remove:function(t){delete this.files[t]},clear:function(){this.files={}}},Ia=new Mn;Object.assign(En.prototype,{load:function(t,e,n,i){void 0===t&&(t=""),void 0!==this.path&&(t=this.path+t);var r=this,o=Oa.get(t);if(void 0!==o)return r.manager.itemStart(t),setTimeout(function(){e&&e(o),r.manager.itemEnd(t)},0),o;var a=/^data:(.*?)(;base64)?,(.*)$/,s=t.match(a);if(s){var c=s[1],l=!!s[2],h=s[3];h=window.decodeURIComponent(h),l&&(h=window.atob(h));try{var u,d=(this.responseType||"").toLowerCase();switch(d){case"arraybuffer":case"blob":u=new ArrayBuffer(h.length);for(var p=new Uint8Array(u),f=0;f<h.length;
1f++)p[f]=h.charCodeAt(f);"blob"===d&&(u=new Blob([u],{type:c}));break;case"document":var m=new DOMParser;u=m.parseFromString(h,c);break;case"json":u=JSON.parse(h);break;default:u=h}window.setTimeout(function(){e&&e(u),r.manager.itemEnd(t)},0)}catch(e){window.setTimeout(function(){i&&i(e),r.manager.itemError(t)},0)}}else{var v=new XMLHttpRequest;v.open("GET",t,!0),v.addEventListener("load",function(n){var o=n.target.response;Oa.add(t,o),200===this.status?(e&&e(o),r.manager.itemEnd(t)):0===this.status?(console.warn("THREE.FileLoader: HTTP Status 0 received."),e&&e(o),r.manager.itemEnd(t)):(i&&i(n),r.manager.itemError(t))},!1),void 0!==n&&v.addEventListener("progress",function(t){n(t)},!1),v.addEventListener("error",function(e){i&&i(e),r.manager.itemError(t)},!1),void 0!==this.responseType&&(v.responseType=this.responseType),void 0!==this.withCredentials&&(v.withCredentials=this.withCredentials),v.overrideMimeType&&v.overrideMimeType(void 0!==this.mimeType?this.mimeType:"text/plain"),v.send(null)}return r.manager.itemStart(t),v},setPath:function(t){return this.path=t,this},setResponseType:function(t){return this.responseType=t,this},setWithCredentials:function(t){return this.withCredentials=t,this},setMimeType:function(t){return this.mimeType=t,this}}),Object.assign(Tn.prototype,{load:function(t,e,n,i){var r=this,o=[],a=new Te;a.image=o;var s=new En(this.manager);if(s.setPath(this.path),s.setResponseType("arraybuffer"),Array.isArray(t))for(var c=0,l=0,h=t.length;l<h;++l)!function(l){s.load(t[l],function(t){var n=r._parser(t,!0);o[l]={width:n.width,height:n.height,format:n.format,mipmaps:n.mipmaps},6===(c+=1)&&(1===n.mipmapCount&&(a.minFilter=xo),a.format=n.format,a.needsUpdate=!0,e&&e(a))},n,i)}(l);else s.load(t,function(t){var n=r._parser(t,!0);if(n.isCubemap)for(var i=n.mipmaps.length/n.mipmapCount,s=0;s<i;s++){o[s]={mipmaps:[]};for(var c=0;c<n.mipmapCount;c++)o[s].mipmaps.push(n.mipmaps[s*n.mipmapCount+c]),o[s].format=n.format,o[s].width=n.width,o[s].height=n.height}else a.image.width=n.width,a.image.height=n.height,a.mipmaps=n.mipmaps;1===n.mipmapCount&&(a.minFilter=xo),a.format=n.format,a.needsUpdate=!0,e&&e(a)},n,i);return a},setPath:function(t){return this.path=t,this}});Object.assign(Sn.prototype,{load:function(t,e,n,i){var r=this,o=new Y,a=new En(this.manager);return a.setResponseType("arraybuffer"),a.load(t,function(t){var n=r._parser(t);n&&(void 0!==n.image?o.image=n.image:void 0!==n.data&&(o.image.width=n.width,o.image.height=n.height,o.image.data=n.data),o.wrapS=void 0!==n.wrapS?n.wrapS:mo,o.wrapT=void 0!==n.wrapT?n.wrapT:mo,o.magFilter=void 0!==n.magFilter?n.magFilter:xo,o.minFilter=void 0!==n.minFilter?n.minFilter:Mo,o.anisotropy=void 0!==n.anisotropy?n.anisotropy:1,void 0!==n.format&&(o.format=n.format),void 0!==n.type&&(o.type=n.type),void 0!==n.mipmaps&&(o.mipmaps=n.mipmaps),1===n.mipmapCount&&(o.minFilter=xo),o.needsUpdate=!0,e&&e(o,n))},n,i),o}}),Object.assign(An.prototype,{load:function(t,e,n,i){var r=this,o=document.createElementNS("http://www.w3.org/1999/xhtml","img");if(o.onload=function(){o.onload=null,URL.revokeObjectURL(o.src),e&&e(o),r.manager.itemEnd(t)},o.onerror=i,0===t.indexOf("data:"))o.src=t;else if(void 0!==this.crossOrigin)o.crossOrigin=this.crossOrigin,o.src=t;else{var a=new En;a.setPath(this.path),a.setResponseType("blob"),a.setWithCredentials(this.withCredentials),a.load(t,function(t){o.src=URL.createObjectURL(t)},n,i)}return r.manager.itemStart(t),o},setCrossOrigin:function(t){return this.crossOrigin=t,this},setWithCredentials:function(t){return this.withCredentials=t,this},setPath:function(t){return this.path=t,this}}),Object.assign(Ln.prototype,{load:function(t,e,n,i){var r=new d,o=new An(this.manager);o.setCrossOrigin(this.crossOrigin),o.setPath(this.path);for(var a=0,s=0;s<t.length;++s)!function(n){o.load(t[n],function(t){r.images[n]=t,6===++a&&(r.needsUpdate=!0,e&&e(r))},void 0,i)}(s);return r},setCrossOrigin:function(t){return this.crossOrigin=t,this},setPath:function(t){return this.path=t,this}}),Object.assign(Rn.prototype,{load:function(t,e,n,i){var r=new o,a=new An(this.manager);return a.setCrossOrigin(this.crossOrigin),a.setWithCredentials(this.withCredentials),a.setPath(this.path),a.load(t,function(n){var i=t.search(/\.(jpg|jpeg)$/)>0||0===t.search(/^data\:image\/jpeg/);r.format=i?zo:Bo,r.image=n,r.needsUpdate=!0,void 0!==e&&e(r)},n,i),r},setCrossOrigin:function(t){return this.crossOrigin=t,this},setWithCredentials:function(t){return this.withCredentials=t,this},setPath:function(t){return this.path=t,this}}),Cn.prototype=Object.assign(Object.create(ht.prototype),{constructor:Cn,isLight:!0,copy:function(t){return ht.prototype.copy.call(this,t),this.color.copy(t.color),this.intensity=t.intensity,this},toJSON:function(t){var e=ht.prototype.toJSON.call(this,t);return e.object.color=this.color.getHex(),e.object.intensity=this.intensity,void 0!==this.groundColor&&(e.object.groundColor=this.groundColor.getHex()),void 0!==this.distance&&(e.object.distance=this.distance),void 0!==this.angle&&(e.object.angle=this.angle),void 0!==this.decay&&(e.object.decay=this.decay),void 0!==this.penumbra&&(e.object.penumbra=this.penumbra),void 0!==this.shadow&&(e.object.shadow=this.shadow.toJSON()),e}}),Pn.prototype=Object.assign(Object.create(Cn.prototype),{constructor:Pn,isHemisphereLight:!0,copy:function(t){return Cn.prototype.copy.call(this,t),this.groundColor.copy(t.groundColor),this}}),Object.assign(On.prototype,{copy:function(t){return this.camera=t.camera.clone(),this.bias=t.bias,this.radius=t.radius,this.mapSize.copy(t.mapSize),this},clone:function(){return(new this.constructor).copy(this)},toJSON:function(){var t={};return 0!==this.bias&&(t.bias=this.bias),1!==this.radius&&(t.radius=this.radius),512===this.mapSize.x&&512===this.mapSize.y||(t.mapSize=this.mapSize.toArray()),t.camera=this.camera.toJSON(!1).object,delete t.camera.matrix,t}}),In.prototype=Object.assign(Object.create(On.prototype),{constructor:In,isSpotLightShadow:!0,update:function(t){var e=2*pa.RAD2DEG*t.angle,n=this.mapSize.width/this.mapSize.height,i=t.distance||500,r=this.camera;e===r.fov&&n===r.aspect&&i===r.far||(r.fov=e,r.aspect=n,r.far=i,r.updateProjectionMatrix())}}),Un.prototype=Object.assign(Object.create(Cn.prototype),{constructor:Un,isSpotLight:!0,copy:function(t){return Cn.prototype.copy.call(this,t),this.distance=t.distance,this.angle=t.angle,this.penumbra=t.penumbra,this.decay=t.decay,this.target=t.target.clone(),this.shadow=t.shadow.clone(),this}}),Nn.prototype=Object.assign(Object.create(Cn.prototype),{constructor:Nn,isPointLight:!0,copy:function(t){return Cn.prototype.copy.call(this,t),this.distance=t.distance,this.decay=t.decay,this.shadow=t.shadow.clone(),this}}),Dn.prototype=Object.assign(Object.create(On.prototype),{constructor:Dn}),Fn.prototype=Object.assign(Object.create(Cn.prototype),{constructor:Fn,isDirectionalLight:!0,copy:function(t){return Cn.prototype.copy.call(this,t),this.target=t.target.clone(),this.shadow=t.shadow.clone(),this}}),zn.prototype=Object.assign(Object.create(Cn.prototype),{constructor:zn,isAmbientLight:!0});var Ua={arraySlice:function(t,e,n){return Ua.isTypedArray(t)?new t.constructor(t.subarray(e,n)):t.slice(e,n)},convertArray:function(t,e,n){return!t||!n&&t.constructor===e?t:"number"===typeof e.BYTES_PER_ELEMENT?new e(t):Array.prototype.slice.call(t)},isTypedArray:function(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)},getKeyframeOrder:function(t){function e(e,n){return t[e]-t[n]}for(var n=t.length,i=new Array(n),r=0;r!==n;++r)i[r]=r;return i.sort(e),i},sortedArray:function(t,e,n){for(var i=t.length,r=new t.constructor(i),o=0,a=0;a!==i;++o)for(var s=n[o]*e,c=0;c!==e;++c)r[a++]=t[s+c];return r},flattenJSON:function(t,e,n,i){for(var r=1,o=t[0];void 0!==o&&void 0===o[i];)o=t[r++];if(void 0!==o){var a=o[i];if(void 0!==a)if(Array.isArray(a))do{a=o[i],void 0!==a&&(e.push(o.time),n.push.apply(n,a)),o=t[r++]}while(void 0!==o);else if(void 0!==a.toArray)do{a=o[i],void 0!==a&&(e.push(o.time),a.toArray(n,n.length)),o=t[r++]}while(void 0!==o);else do{a=o[i],void 0!==a&&(e.push(o.time),n.push(a)),o=t[r++]}while(void 0!==o)}}};Bn.prototype={constructor:Bn,evaluate:function(t){var e=this.parameterPositions,n=this._cachedIndex,i=e[n],r=e[n-1];t:{e:{var o;n:{i:if(!(t<i)){for(var a=n+2;;){if(void 0===i){if(t<r)break i;
1return n=e.length,this._cachedIndex=n,this.afterEnd_(n-1,t,r)}if(n===a)break;if(r=i,i=e[++n],t<i)break e}o=e.length;break n}{if(t>=r)break t;var s=e[1];t<s&&(n=2,r=s);for(var a=n-2;;){if(void 0===r)return this._cachedIndex=0,this.beforeStart_(0,t,i);if(n===a)break;if(i=r,r=e[--n-1],t>=r)break e}o=n,n=0}}for(;n<o;){var c=n+o>>>1;t<e[c]?o=c:n=c+1}if(i=e[n],void 0===(r=e[n-1]))return this._cachedIndex=0,this.beforeStart_(0,t,i);if(void 0===i)return n=e.length,this._cachedIndex=n,this.afterEnd_(n-1,r,t)}this._cachedIndex=n,this.intervalChanged_(n,r,i)}return this.interpolate_(n,r,t,i)},settings:null,DefaultSettings_:{},getSettings_:function(){return this.settings||this.DefaultSettings_},copySampleValue_:function(t){for(var e=this.resultBuffer,n=this.sampleValues,i=this.valueSize,r=t*i,o=0;o!==i;++o)e[o]=n[r+o];return e},interpolate_:function(t,e,n,i){throw new Error("call to abstract method")},intervalChanged_:function(t,e,n){}},Object.assign(Bn.prototype,{beforeStart_:Bn.prototype.copySampleValue_,afterEnd_:Bn.prototype.copySampleValue_}),kn.prototype=Object.assign(Object.create(Bn.prototype),{constructor:kn,DefaultSettings_:{endingStart:ta,endingEnd:ta},intervalChanged_:function(t,e,n){var i=this.parameterPositions,r=t-2,o=t+1,a=i[r],s=i[o];if(void 0===a)switch(this.getSettings_().endingStart){case 2401:r=t,a=2*e-n;break;case 2402:r=i.length-2,a=e+i[r]-i[r+1];break;default:r=t,a=n}if(void 0===s)switch(this.getSettings_().endingEnd){case 2401:o=t,s=2*n-e;break;case 2402:o=1,s=n+i[1]-i[0];break;default:o=t-1,s=e}var c=.5*(n-e),l=this.valueSize;this._weightPrev=c/(e-a),this._weightNext=c/(s-n),this._offsetPrev=r*l,this._offsetNext=o*l},interpolate_:function(t,e,n,i){for(var r=this.resultBuffer,o=this.sampleValues,a=this.valueSize,s=t*a,c=s-a,l=this._offsetPrev,h=this._offsetNext,u=this._weightPrev,d=this._weightNext,p=(n-e)/(i-e),f=p*p,m=f*p,v=-u*m+2*u*f-u*p,g=(1+u)*m+(-1.5-2*u)*f+(-.5+u)*p+1,y=(-1-d)*m+(1.5+d)*f+.5*p,_=d*m-d*f,b=0;b!==a;++b)r[b]=v*o[l+b]+g*o[c+b]+y*o[s+b]+_*o[h+b];return r}}),jn.prototype=Object.assign(Object.create(Bn.prototype),{constructor:jn,interpolate_:function(t,e,n,i){for(var r=this.resultBuffer,o=this.sampleValues,a=this.valueSize,s=t*a,c=s-a,l=(n-e)/(i-e),h=1-l,u=0;u!==a;++u)r[u]=o[c+u]*h+o[s+u]*l;return r}}),Gn.prototype=Object.assign(Object.create(Bn.prototype),{constructor:Gn,interpolate_:function(t,e,n,i){return this.copySampleValue_(t-1)}});var Na;Na={TimeBufferType:Float32Array,ValueBufferType:Float32Array,DefaultInterpolation:2301,InterpolantFactoryMethodDiscrete:function(t){return new Gn(this.times,this.values,this.getValueSize(),t)},InterpolantFactoryMethodLinear:function(t){return new jn(this.times,this.values,this.getValueSize(),t)},InterpolantFactoryMethodSmooth:function(t){return new kn(this.times,this.values,this.getValueSize(),t)},setInterpolation:function(t){var e;switch(t){case 2300:e=this.InterpolantFactoryMethodDiscrete;break;case 2301:e=this.InterpolantFactoryMethodLinear;break;case 2302:e=this.InterpolantFactoryMethodSmooth}if(void 0===e){var n="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(void 0===this.createInterpolant){if(t===this.DefaultInterpolation)throw new Error(n);this.setInterpolation(this.DefaultInterpolation)}return void console.warn(n)}this.createInterpolant=e},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(t){if(0!==t)for(var e=this.times,n=0,i=e.length;n!==i;++n)e[n]+=t;return this},scale:function(t){if(1!==t)for(var e=this.times,n=0,i=e.length;n!==i;++n)e[n]*=t;return this},trim:function(t,e){for(var n=this.times,i=n.length,r=0,o=i-1;r!==i&&n[r]<t;)++r;for(;-1!==o&&n[o]>e;)--o;if(++o,0!==r||o!==i){r>=o&&(o=Math.max(o,1),r=o-1);var a=this.getValueSize();this.times=Ua.arraySlice(n,r,o),this.values=Ua.arraySlice(this.values,r*a,o*a)}return this},validate:function(){var t=!0,e=this.getValueSize();e-Math.floor(e)!==0&&(console.error("invalid value size in track",this),t=!1);var n=this.times,i=this.values,r=n.length;0===r&&(console.error("track is empty",this),t=!1);for(var o=null,a=0;a!==r;a++){var s=n[a];if("number"===typeof s&&isNaN(s)){console.error("time is not a valid number",this,a,s),t=!1;break}if(null!==o&&o>s){console.error("out of order keys",this,a,s,o),t=!1;break}o=s}if(void 0!==i&&Ua.isTypedArray(i))for(var a=0,c=i.length;a!==c;++a){var l=i[a];if(isNaN(l)){console.error("value is not a valid number",this,a,l),t=!1;break}}return t},optimize:function(){for(var t=this.times,e=this.values,n=this.getValueSize(),i=2302===this.getInterpolation(),r=1,o=t.length-1,a=1;a<o;++a){var s=!1,c=t[a];if(c!==t[a+1]&&(1!==a||c!==c[0]))if(i)s=!0;else for(var l=a*n,h=l-n,u=l+n,d=0;d!==n;++d){var p=e[l+d];if(p!==e[h+d]||p!==e[u+d]){s=!0;break}}if(s){if(a!==r){t[r]=t[a];for(var f=a*n,m=r*n,d=0;d!==n;++d)e[m+d]=e[f+d]}++r}}if(o>0){t[r]=t[o];for(var f=o*n,m=r*n,d=0;d!==n;++d)e[m+d]=e[f+d];++r}return r!==t.length&&(this.times=Ua.arraySlice(t,0,r),this.values=Ua.arraySlice(e,0,r*n)),this}},Vn.prototype=Object.assign(Object.create(Na),{constructor:Vn,ValueTypeName:"vector"}),Wn.prototype=Object.assign(Object.create(Bn.prototype),{constructor:Wn,interpolate_:function(t,e,n,i){for(var r=this.resultBuffer,o=this.sampleValues,a=this.valueSize,s=t*a,c=(n-e)/(i-e),h=s+a;s!==h;
vendor: 7,125 bytes, line 1
1s+=4)l.slerpFlat(r,0,o,s-a,o,s,c);return r}}),Xn.prototype=Object.assign(Object.create(Na),{constructor:Xn,ValueTypeName:"quaternion",DefaultInterpolation:2301,InterpolantFactoryMethodLinear:function(t){return new Wn(this.times,this.values,this.getValueSize(),t)},InterpolantFactoryMethodSmooth:void 0}),qn.prototype=Object.assign(Object.create(Na),{constructor:qn,ValueTypeName:"number"}),Yn.prototype=Object.assign(Object.create(Na),{constructor:Yn,ValueTypeName:"string",ValueBufferType:Array,DefaultInterpolation:2300,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0}),Zn.prototype=Object.assign(Object.create(Na),{constructor:Zn,ValueTypeName:"bool",ValueBufferType:Array,DefaultInterpolation:2300,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0}),Jn.prototype=Object.assign(Object.create(Na),{constructor:Jn,ValueTypeName:"color"}),Qn.prototype=Na,Na.constructor=Qn,Object.assign(Qn,{parse:function(t){if(void 0===t.type)throw new Error("track type undefined, can not parse");var e=Qn._getTrackTypeForValueTypeName(t.type);if(void 0===t.times){var n=[],i=[];Ua.flattenJSON(t.keys,n,i,"value"),t.times=n,t.values=i}return void 0!==e.parse?e.parse(t):new e(t.name,t.times,t.values,t.interpolation)},toJSON:function(t){var e,n=t.constructor;if(void 0!==n.toJSON)e=n.toJSON(t);else{e={name:t.name,times:Ua.convertArray(t.times,Array),values:Ua.convertArray(t.values,Array)};var i=t.getInterpolation();i!==t.DefaultInterpolation&&(e.interpolation=i)}return e.type=t.ValueTypeName,e},_getTrackTypeForValueTypeName:function(t){switch(t.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return qn;case"vector":case"vector2":case"vector3":case"vector4":return Vn;case"color":return Jn;case"quaternion":return Xn;case"bool":case"boolean":return Zn;case"string":return Yn}throw new Error("Unsupported typeName: "+t)}}),Kn.prototype={constructor:Kn,resetDuration:function(){for(var t=this.tracks,e=0,n=0,i=t.length;n!==i;++n){var r=this.tracks[n];e=Math.max(e,r.times[r.times.length-1])}this.duration=e},trim:function(){for(var t=0;t<this.tracks.length;t++)this.tracks[t].trim(0,this.duration);return this},optimize:function(){for(var t=0;t<this.tracks.length;t++)this.tracks[t].optimize();return this}},Object.assign(Kn,{parse:function(t){for(var e=[],n=t.tracks,i=1/(t.fps||1),r=0,o=n.length;r!==o;++r)e.push(Qn.parse(n[r]).scale(i));return new Kn(t.name,t.duration,e)},toJSON:function(t){for(var e=[],n=t.tracks,i={name:t.name,duration:t.duration,tracks:e},r=0,o=n.length;r!==o;++r)e.push(Qn.toJSON(n[r]));return i},CreateFromMorphTargetSequence:function(t,e,n,i){for(var r=e.length,o=[],a=0;a<r;a++){var s=[],c=[];s.push((a+r-1)%r,a,(a+1)%r),c.push(0,1,0);var l=Ua.getKeyframeOrder(s);s=Ua.sortedArray(s,1,l),c=Ua.sortedArray(c,1,l),i||0!==s[0]||(s.push(r),c.push(c[0])),o.push(new qn(".morphTargetInfluences["+e[a].name+"]",s,c).scale(1/n))}return new Kn(t,-1,o)},findByName:function(t,e){var n=t;if(!Array.isArray(t)){var i=t;n=i.geometry&&i.geometry.animations||i.animations}for(var r=0;r<n.length;r++)if(n[r].name===e)return n[r];return null},CreateClipsFromMorphTargetSequences:function(t,e,n){for(var i={},r=/^([\w-]*?)([\d]+)$/,o=0,a=t.length;o<a;o++){var s=t[o],c=s.name.match(r);if(c&&c.length>1){var l=c[1],h=i[l];h||(i[l]=h=[]),h.push(s)}}var u=[];for(var l in i)u.push(Kn.CreateFromMorphTargetSequence(l,i[l],e,n));return u},parseAnimation:function(t,e){if(!t)return console.error("  no animation in JSONLoader data"),null;for(var n=function(t,e,n,i,r){if(0!==n.length){var o=[],a=[];Ua.flattenJSON(n,o,a,i),0!==o.length&&r.push(new t(e,o,a))}},i=[],r=t.name||"default",o=t.length||-1,a=t.fps||30,s=t.hierarchy||[],c=0;c<s.length;c++){var l=s[c].keys;if(l&&0!==l.length)if(l[0].morphTargets){for(var h={},u=0;u<l.length;u++)if(l[u].morphTargets)for(var d=0;d<l[u].morphTargets.length;d++)h[l[u].morphTargets[d]]=-1;for(var p in h){for(var f=[],m=[],d=0;d!==l[u].morphTargets.length;++d){var v=l[u];f.push(v.time),m.push(v.morphTarget===p?1:0)}i.push(new qn(".morphTargetInfluence["+p+"]",f,m))}o=h.length*(a||1)}else{var g=".bones["+e[c].name+"]";n(Vn,g+".position",l,"pos",i),n(Xn,g+".quaternion",l,"rot",i),n(Vn,g+".scale",l,"scl",i)}}return 0===i.length?null:new Kn(r,o,i)}}),Object.assign($n.prototype,{load:function(t,e,n,i){var r=this;new En(r.manager).load(t,function(t){e(r.parse(JSON.parse(t)))},n,i)},setTextures:function(t){this.textures=t},parse:function(t){function e(t){return void 0===n[t]&&console.warn("THREE.MaterialLoader: Undefined texture",t),n[t]}var n=this.textures,i=new Pa[t.type];if(void 0!==t.uuid&&(i.uuid=t.uuid),void 0!==t.name&&(i.name=t.name),void 0!==t.color&&i.color.setHex(t.color),void 0!==t.roughness&&(i.roughness=t.roughness),void 0!==t.metalness&&(i.metalness=t.metalness),void 0!==t.emissive&&i.emissive.setHex(t.emissive),void 0!==t.specular&&i.specular.setHex(t.specular),void 0!==t.shininess&&(i.shininess=t.shininess),void 0!==t.clearCoat&&(i.clearCoat=t.clearCoat),void 0!==t.clearCoatRoughness&&(i.clearCoatRoughness=t.clearCoatRoughness),void 0!==t.uniforms&&(i.uniforms=t.uniforms),void 0!==t.vertexShader&&(i.vertexShader=t.vertexShader),void 0!==t.fragmentShader&&(i.fragmentShader=t.fragmentShader),void 0!==t.vertexColors&&(i.vertexColors=t.vertexColors),void 0!==t.fog&&(i.fog=t.fog),void 0!==t.shading&&(i.shading=t.shading),void 0!==t.blending&&(i.blending=t.blending),void 0!==t.side&&(i.side=t.side),void 0!==t.opacity&&(i.opacity=t.opacity),void 0!==t.transparent&&(i.transparent=t.transparent),void 0!==t.alphaTest&&(i.alphaTest=t.alphaTest),void 0!==t.depthTest&&(i.depthTest=t.depthTest),void 0!==t.depthWrite&&(i.depthWrite=t.depthWrite),void 0!==t.colorWrite&&(i.colorWrite=t.colorWrite),void 0!==t.wireframe&&(i.wireframe=t.wireframe),void 0!==t.wireframeLinewidth&&(i.wireframeLinewidth=t.wireframeLinewidth),void 0!==t.wireframeLinecap&&(i.wireframeLinecap=t.wireframeLinecap),void 0!==t.wireframeLinejoin&&(i.wireframeLinejoin=t.wireframeLinejoin),void 0!==t.skinning&&(i.skinning=t.skinning),void 0!==t.morphTargets&&(i.morphTargets=t.morphTargets),void 0!==t.size&&(i.size=t.size),void 0!==t.sizeAttenuation&&(i.sizeAttenuation=t.sizeAttenuation),void 0!==t.map&&(i.map=e(t.map)),void 0!==t.alphaMap&&(i.alphaMap=e(t.alphaMap),i.transparent=!0),void 0!==t.bumpMap&&(i.bumpMap=e(t.bumpMap)),void 0!==t.bumpScale&&(i.bumpScale=t.bumpScale),void 0!==t.normalMap&&(i.normalMap=e(t.normalMap)),void 0!==t.normalScale){var o=t.normalScale;!1===Array.isArray(o)&&(o=[o,o]),i.normalScale=(new r).fromArray(o)}if(void 0!==t.displacementMap&&(i.displacementMap=e(t.displacementMap)),void 0!==t.displacementScale&&(i.displacementScale=t.displacementScale),void 0!==t.displacementBias&&(i.displacementBias=t.displacementBias),void 0!==t.roughnessMap&&(i.roughnessMap=e(t.roughnessMap)),void 0!==t.metalnessMap&&(i.metalnessMap=e(t.metalnessMap)),void 0!==t.emissiveMap&&(i.emissiveMap=e(t.emissiveMap)),void 0!==t.emissiveIntensity&&(i.emissiveIntensity=t.emissiveIntensity),void 0!==t.specularMap&&(i.specularMap=e(t.specularMap)),void 0!==t.envMap&&(i.envMap=e(t.envMap)
1),void 0!==t.reflectivity&&(i.reflectivity=t.reflectivity),void 0!==t.lightMap&&(i.lightMap=e(t.lightMap)),void 0!==t.lightMapIntensity&&(i.lightMapIntensity=t.lightMapIntensity),void 0!==t.aoMap&&(i.aoMap=e(t.aoMap)),void 0!==t.aoMapIntensity&&(i.aoMapIntensity=t.aoMapIntensity),void 0!==t.gradientMap&&(i.gradientMap=e(t.gradientMap)),void 0!==t.materials)for(var a=0,s=t.materials.length;a<s;a++)i.materials.push(this.parse(t.materials[a]));return i}}),Object.assign(ti.prototype,{load:function(t,e,n,i){var r=this;new En(r.manager).load(t,function(t){e(r.parse(JSON.parse(t)))},n,i)},parse:function(t){var e=new Lt,n=t.data.index,i={Int8Array:Int8Array,Uint8Array:Uint8Array,Uint8ClampedArray:Uint8ClampedArray,Int16Array:Int16Array,Uint16Array:Uint16Array,Int32Array:Int32Array,Uint32Array:Uint32Array,Float32Array:Float32Array,Float64Array:Float64Array};if(void 0!==n){var r=new i[n.type](n.array);e.setIndex(new mt(r,1))}var o=t.data.attributes;for(var a in o){var s=o[a],r=new i[s.type](s.array);e.addAttribute(a,new mt(r,s.itemSize,s.normalized))}var c=t.data.groups||t.data.drawcalls||t.data.offsets;if(void 0!==c)for(var l=0,u=c.length;l!==u;++l){var d=c[l];e.addGroup(d.start,d.count,d.materialIndex)}var p=t.data.boundingSphere;if(void 0!==p){var f=new h;void 0!==p.center&&f.fromArray(p.center),e.boundingSphere=new nt(f,p.radius)}return e}}),ei.prototype={constructor:ei,crossOrigin:void 0,extractUrlBase:function(t){var e=t.split("/");return 1===e.length?"./":(e.pop(),e.join("/")+"/")},initMaterials:function(t,e,n){for(var i=[],r=0;r<t.length;++r)i[r]=this.createMaterial(t[r],e,n);return i},createMaterial:function(){var t,e,n;return function(i,r,o){function a(t,n,i,a,c){var l,h=r+t,u=ei.Handlers.get(h);null!==u?l=u.load(h):(e.setCrossOrigin(o),l=e.load(h)),void 0!==n&&(l.repeat.fromArray(n),1!==n[0]&&(l.wrapS=fo),1!==n[1]&&(l.wrapT=fo)),void 0!==i&&l.offset.fromArray(i),void 0!==a&&("repeat"===a[0]&&(l.wrapS=fo),"mirror"===a[0]&&(l.wrapS=vo),"repeat"===a[1]&&(l.wrapT=fo),"mirror"===a[1]&&(l.wrapT=vo)),void 0!==c&&(l.anisotropy=c);var d=pa.generateUUID();return s[d]=l,d}void 0===t&&(t=new q),void 0===e&&(e=new Rn),void 0===n&&(n=new $n);var s={},c={uuid:pa.generateUUID(),type:"MeshLambertMaterial"};for(var l in i){var h=i[l];switch(l){case"DbgColor":case"DbgIndex":case"opticalDensity":case"illumination":break;case"DbgName":c.name=h;break;case"blending":c.blending=Sr[h];break;case"colorAmbient":case"mapAmbient":console.warn("THREE.Loader.createMaterial:",l,"is no longer supported.");break;case"colorDiffuse":c.color=t.fromArray(h).getHex();break;case"colorSpecular":c.specular=t.fromArray(h).getHex();break;case"colorEmissive":c.emissive=t.fromArray(h).getHex();break;case"specularCoef":c.shininess=h;break;case"shading":"basic"===h.toLowerCase()&&(c.type="MeshBasicMaterial"),"phong"===h.toLowerCase()&&(c.type="MeshPhongMaterial"),"standard"===h.toLowerCase()&&(c.type="MeshStandardMaterial");break;case"mapDiffuse":c.map=a(h,i.mapDiffuseRepeat,i.mapDiffuseOffset,i.mapDiffuseWrap,i.mapDiffuseAnisotropy);break;case"mapDiffuseRepeat":case"mapDiffuseOffset":case"mapDiffuseWrap":case"mapDiffuseAnisotropy":break;case"mapEmissive":c.emissiveMap=a(h,i.mapEmissiveRepeat,i.mapEmissiveOffset,i.mapEmissiveWrap,i.mapEmissiveAnisotropy);break;case"mapEmissiveRepeat":case"mapEmissiveOffset":case"mapEmissiveWrap":case"mapEmissiveAnisotropy":break;case"mapLight":c.lightMap=a(h,i.mapLightRepeat,i.mapLightOffset,i.mapLightWrap,i.mapLightAnisotropy);break;case"mapLightRepeat":case"mapLightOffset":case"mapLightWrap":case"mapLightAnisotropy":break;case"mapAO":c.aoMap=a(h,i.mapAORepeat,i.mapAOOffset,i.mapAOWrap,i.mapAOAnisotropy);break;case"mapAORepeat":case"mapAOOffset":case"mapAOWrap":case"mapAOAnisotropy":break;case"mapBump":c.bumpMap=a(h,i.mapBumpRepeat,i.mapBumpOffset,i.mapBumpWrap,i.mapBumpAnisotropy);break;case"mapBumpScale":c.bumpScale=h;break;case"mapBumpRepeat":case"mapBumpOffset":case"mapBumpWrap":case"mapBumpAnisotropy":break;case"mapNormal":c.normalMap=a(h,i.mapNormalRepeat,i.mapNormalOffset,i.mapNormalWrap,i.mapNormalAnisotropy);break;case"mapNormalFactor":c.normalScale=[h,h];break;case"mapNormalRepeat":case"mapNormalOffset":case"mapNormalWrap":case"mapNormalAnisotropy":break;case"mapSpecular":c.specularMap=a(h,i.mapSpecularRepeat,i.mapSpecularOffset,i.mapSpecularWrap,i.mapSpecularAnisotropy);break;case"mapSpecularRepeat":case"mapSpecularOffset":case"mapSpecularWrap":case"mapSpecularAnisotropy":break;case"mapMetalness":c.metalnessMap=a(h,i.mapMetalnessRepeat,i.mapMetalnessOffset,i.mapMetalnessWrap,i.mapMetalnessAnisotropy);break;case"mapMetalnessRepeat":case"mapMetalnessOffset":case"mapMetalnessWrap":case"mapMetalnessAnisotropy":break;case"mapRoughness":c.roughnessMap=a(h,i.mapRoughnessRepeat,i.mapRoughnessOffset,i.mapRoughnessWrap,i.mapRoughnessAnisotropy);break;case"mapRoughnessRepeat":case"mapRoughnessOffset":case"mapRoughnessWrap":case"mapRoughnessAnisotropy":break;
1case"mapAlpha":c.alphaMap=a(h,i.mapAlphaRepeat,i.mapAlphaOffset,i.mapAlphaWrap,i.mapAlphaAnisotropy);break;case"mapAlphaRepeat":case"mapAlphaOffset":case"mapAlphaWrap":case"mapAlphaAnisotropy":break;case"flipSided":c.side=pr;break;case"doubleSided":c.side=fr;break;case"transparency":console.warn("THREE.Loader.createMaterial: transparency has been renamed to opacity"),c.opacity=h;break;case"depthTest":case"depthWrite":case"colorWrite":case"opacity":case"reflectivity":case"transparent":case"visible":case"wireframe":c[l]=h;break;case"vertexColors":!0===h&&(c.vertexColors=_r),"face"===h&&(c.vertexColors=yr);break;default:console.error("THREE.Loader.createMaterial: Unsupported",l,h)}}return"MeshBasicMaterial"===c.type&&delete c.emissive,"MeshPhongMaterial"!==c.type&&delete c.specular,c.opacity<1&&(c.transparent=!0),n.setTextures(s),n.parse(c)}}()},ei.Handlers={handlers:[],add:function(t,e){this.handlers.push(t,e)},get:function(t){for(var e=this.handlers,n=0,i=e.length;n<i;n+=2){var r=e[n],o=e[n+1];if(r.test(t))return o}return null}},Object.assign(ni.prototype,{load:function(t,e,n,i){var r=this,o=this.texturePath&&"string"===typeof this.texturePath?this.texturePath:ei.prototype.extractUrlBase(t),a=new En(this.manager);a.setWithCredentials(this.withCredentials),a.load(t,function(n){var i=JSON.parse(n),a=i.metadata;if(void 0!==a){var s=a.type;if(void 0!==s){if("object"===s.toLowerCase())return void console.error("THREE.JSONLoader: "+t+" should be loaded with THREE.ObjectLoader instead.");if("scene"===s.toLowerCase())return void console.error("THREE.JSONLoader: "+t+" should be loaded with THREE.SceneLoader instead.")}}var c=r.parse(i,o);e(c.geometry,c.materials)},n,i)},setTexturePath:function(t){this.texturePath=t},parse:function(t,e){var n=new St,i=void 0!==t.scale?1/t.scale:1;if(function(e){function i(t,e){return t&1<<e}var o,a,s,c,l,u,d,p,f,m,v,g,y,_,b,x,w,M,E,T,S,A,L,R,C,P,O,I=t.faces,U=t.vertices,N=t.normals,D=t.colors,F=0;if(void 0!==t.uvs){for(o=0;o<t.uvs.length;o++)t.uvs[o].length&&F++;for(o=0;o<F;o++)n.faceVertexUvs[o]=[]}for(c=0,l=U.length;c<l;)M=new h,M.x=U[c++]*e,M.y=U[c++]*e,M.z=U[c++]*e,n.vertices.push(M);for(c=0,l=I.length;c<l;)if(m=I[c++],v=i(m,0),g=i(m,1),y=i(m,3),_=i(m,4),b=i(m,5),x=i(m,6),w=i(m,7),v){if(T=new pt,T.a=I[c],T.b=I[c+1],T.c=I[c+3],S=new pt,S.a=I[c+1],S.b=I[c+2],S.c=I[c+3],c+=4,g&&(f=I[c++],T.materialIndex=f,S.materialIndex=f),s=n.faces.length,y)for(o=0;o<F;o++)for(R=t.uvs[o],n.faceVertexUvs[o][s]=[],n.faceVertexUvs[o][s+1]=[],a=0;a<4;a++)p=I[c++],P=R[2*p],O=R[2*p+1],C=new r(P,O),2!==a&&n.faceVertexUvs[o][s].push(C),0!==a&&n.faceVertexUvs[o][s+1].push(C);if(_&&(d=3*I[c++],T.normal.set(N[d++],N[d++],N[d]),S.normal.copy(T.normal)),b)for(o=0;o<4;o++)d=3*I[c++],L=new h(N[d++],N[d++],N[d]),2!==o&&T.vertexNormals.push(L),0!==o&&S.vertexNormals.push(L);if(x&&(u=I[c++],A=D[u],T.color.setHex(A),S.color.setHex(A)),w)for(o=0;o<4;o++)u=I[c++],A=D[u],2!==o&&T.vertexColors.push(new q(A)),0!==o&&S.vertexColors.push(new q(A));n.faces.push(T),n.faces.push(S)}else{if(E=new pt,E.a=I[c++],E.b=I[c++],E.c=I[c++],g&&(f=I[c++],E.materialIndex=f),s=n.faces.length,y)for(o=0;o<F;o++)for(R=t.uvs[o],n.faceVertexUvs[o][s]=[],a=0;a<3;a++)p=I[c++],P=R[2*p],O=R[2*p+1],C=new r(P,O),n.faceVertexUvs[o][s].push(C);if(_&&(d=3*I[c++],E.normal.set(N[d++],N[d++],N[d])),b)for(o=0;o<3;o++)d=3*I[c++],L=new h(N[d++],N[d++],N[d]),E.vertexNormals.push(L);if(x&&(u=I[c++],E.color.setHex(D[u])),w)for(o=0;o<3;o++)u=I[c++],E.vertexColors.push(new q(D[u]));n.faces.push(E)}}(i),function(){var e=void 0!==t.influencesPerVertex?t.influencesPerVertex:2;if(t.skinWeights)for(var i=0,r=t.skinWeights.length;i<r;i+=e){var o=t.skinWeights[i],s=e>1?t.skinWeights[i+1]:0,c=e>2?t.skinWeights[i+2]:0,l=e>3?t.skinWeights[i+3]:0;n.skinWeights.push(new a(o,s,c,l))}if(t.skinIndices)for(var i=0,r=t.skinIndices.length;i<r;i+=e){var h=t.skinIndices[i],u=e>1?t.skinIndices[i+1]:0,d=e>2?t.skinIndices[i+2]:0,p=e>3?t.skinIndices[i+3]:0;n.skinIndices.push(new a(h,u,d,p))}n.bones=t.bones,n.bones&&n.bones.length>0&&(n.skinWeights.length!==n.skinIndices.length||n.skinIndices.length!==n.vertices.length)&&console.warn("When skinning, number of vertices ("+n.vertices.length+"), skinIndices ("+n.skinIndices.length+"), and skinWeights ("+n.skinWeights.length+") should match.")}(),function(e){if(void 0!==t.morphTargets)for(var i=0,r=t.morphTargets.length;i<r;i++){n.morphTargets[i]={},n.morphTargets[i].name=t.morphTargets[i].name,n.morphTargets[i].vertices=[];for(var o=n.morphTargets[i].vertices,a=t.morphTargets[i].vertices,s=0,c=a.length;s<c;s+=3){var l=new h;l.x=a[s]*e,l.y=a[s+1]*e,l.z=a[s+2]*e,o.push(l)}}if(void 0!==t.morphColors&&t.morphColors.length>0){console.warn('THREE.JSONLoader: "morphColors" no longer supported. Using them as face colors.');for(var u=n.faces,d=t.morphColors[0].colors,i=0,r=u.length;i<r;i++)u[i].color.fromArray(d,3*i)}}(i),function(){var e=[],i=[];void 0!==t.animation&&i.push(t.animation),void 0!==t.animations&&(t.animations.length?i=i.concat(t.animations):i.push(t.animations));for(var r=0;r<i.length;r++){var o=Kn.parseAnimation(i[r],n.bones);o&&e.push(o)}if(n.morphTargets){var a=Kn.CreateClipsFromMorphTargetSequences(n.morphTargets,10);e=e.concat(a)}e.length>0&&(n.animations=e)}(),n.computeFaceNormals(),n.computeBoundingSphere(),void 0===t.materials||0===t.materials.length)return{geometry:n};var o=ei.prototype.initMaterials(t.materials,e,this.crossOrigin);return{geometry:n,materials:o}}}),Object.assign(ii.prototype,{load:function(t,e,n,i){""===this.texturePath&&(this.texturePath=t.substring(0,t.lastIndexOf("/")+1));var r=this;new En(r.manager).load(t,function(n){var i=null;try{i=JSON.parse(n)}catch(e){return void console.error("THREE:ObjectLoader: Can't parse "+t+".",e.message)}var o=i.metadata;if(void 0===o||void 0===o.type||"geometry"===o.type.toLowerCase())return void console.error("THREE.ObjectLoader: Can't load "+t+". Use THREE.JSONLoader instead.");r.parse(i,e)},n,i)},setTexturePath:function(t){this.texturePath=t},setCrossOrigin:function(t){this.crossOrigin=t},parse:function(t,e){var n=this.parseGeometries(t.geometries),i=this.parseImages(t.images,function(){void 0!==e&&e(a)}),r=this.parseTextures(t.textures,i),o=this.parseMaterials(t.materials,r),a=this.parseObject(t.object,n,o);return t.animations&&(a.animations=this.parseAnimations(t.animations)),void 0!==t.images&&0!==t.images.length||void 0!==e&&e(a),a},parseGeometries:function(t){var e={};if(void 0!==t)for(var n=new ni,i=new ti,r=0,o=t.length;r<o;r++){var a,s=t[r];switch(s.type){case"PlaneGeometry":case"PlaneBufferGeometry":a=new Ca[s.type](s.width,s.height,s.widthSegments,s.heightSegments);break;case"BoxGeometry":case"BoxBufferGeometry":case"CubeGeometry":a=new Ca[s.type](s.width,s.height,s.depth,s.widthSegments,s.heightSegments,s.depthSegments);break;
1case"CircleGeometry":case"CircleBufferGeometry":a=new Ca[s.type](s.radius,s.segments,s.thetaStart,s.thetaLength);break;case"CylinderGeometry":case"CylinderBufferGeometry":a=new Ca[s.type](s.radiusTop,s.radiusBottom,s.height,s.radialSegments,s.heightSegments,s.openEnded,s.thetaStart,s.thetaLength);break;case"ConeGeometry":case"ConeBufferGeometry":a=new Ca[s.type](s.radius,s.height,s.radialSegments,s.heightSegments,s.openEnded,s.thetaStart,s.thetaLength);break;case"SphereGeometry":case"SphereBufferGeometry":a=new Ca[s.type](s.radius,s.widthSegments,s.heightSegments,s.phiStart,s.phiLength,s.thetaStart,s.thetaLength);break;case"DodecahedronGeometry":case"IcosahedronGeometry":case"OctahedronGeometry":case"TetrahedronGeometry":a=new Ca[s.type](s.radius,s.detail);break;case"RingGeometry":case"RingBufferGeometry":a=new Ca[s.type](s.innerRadius,s.outerRadius,s.thetaSegments,s.phiSegments,s.thetaStart,s.thetaLength);break;case"TorusGeometry":case"TorusBufferGeometry":a=new Ca[s.type](s.radius,s.tube,s.radialSegments,s.tubularSegments,s.arc);break;case"TorusKnotGeometry":case"TorusKnotBufferGeometry":a=new Ca[s.type](s.radius,s.tube,s.tubularSegments,s.radialSegments,s.p,s.q);break;case"LatheGeometry":case"LatheBufferGeometry":a=new Ca[s.type](s.points,s.segments,s.phiStart,s.phiLength);break;case"BufferGeometry":a=i.parse(s);break;case"Geometry":a=n.parse(s.data,this.texturePath).geometry;break;default:console.warn('THREE.ObjectLoader: Unsupported geometry type "'+s.type+'"');continue}a.uuid=s.uuid,void 0!==s.name&&(a.name=s.name),e[s.uuid]=a}return e},parseMaterials:function(t,e){var n={};if(void 0!==t){var i=new $n;i.setTextures(e);for(var r=0,o=t.length;r<o;r++){var a=i.parse(t[r]);n[a.uuid]=a}}return n},parseAnimations:function(t){for(var e=[],n=0;n<t.length;n++){var i=Kn.parse(t[n]);e.push(i)}return e},parseImages:function(t,e){var n=this,i={};if(void 0!==t&&t.length>0){var r=new Mn(e),o=new An(r);o.setCrossOrigin(this.crossOrigin);for(var a=0,s=t.length;a<s;a++){var c=t[a],l=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(c.url)?c.url:n.texturePath+c.url;i[c.uuid]=function(t){return n.manager.itemStart(t),o.load(t,function(){n.manager.itemEnd(t)},void 0,function(){n.manager.itemError(t)})}(l)}}return i},parseTextures:function(t,e){function n(t,e){return"number"===typeof t?t:(console.warn("THREE.ObjectLoader.parseTexture: Constant should be in numeric form.",t),e[t])}var i={};if(void 0!==t)for(var r=0,a=t.length;r<a;r++){var s=t[r];void 0===s.image&&console.warn('THREE.ObjectLoader: No "image" specified for',s.uuid),void 0===e[s.image]&&console.warn("THREE.ObjectLoader: Undefined image",s.image);var c=new o(e[s.image]);c.needsUpdate=!0,c.uuid=s.uuid,void 0!==s.name&&(c.name=s.name),void 0!==s.mapping&&(c.mapping=n(s.mapping,po)),void 0!==s.offset&&c.offset.fromArray(s.offset),void 0!==s.repeat&&c.repeat.fromArray(s.repeat),void 0!==s.wrap&&(c.wrapS=n(s.wrap[0],go),c.wrapT=n(s.wrap[1],go)),void 0!==s.minFilter&&(c.minFilter=n(s.minFilter,Eo)),void 0!==s.magFilter&&(c.magFilter=n(s.magFilter,Eo)),void 0!==s.anisotropy&&(c.anisotropy=s.anisotropy),void 0!==s.flipY&&(c.flipY=s.flipY),i[s.uuid]=c}return i},parseObject:function(){var t=new u;return function(e,n,i){function r(t){return void 0===n[t]&&console.warn("THREE.ObjectLoader: Undefined geometry",t),n[t]}function o(t){if(void 0!==t)return void 0===i[t]&&console.warn("THREE.ObjectLoader: Undefined material",t),i[t]}var a;switch(e.type){case"Scene":a=new he,void 0!==e.background&&Number.isInteger(e.background)&&(a.background=new q(e.background)),void 0!==e.fog&&("Fog"===e.fog.type?a.fog=new le(e.fog.color,e.fog.near,e.fog.far):"FogExp2"===e.fog.type&&(a.fog=new ce(e.fog.color,e.fog.density)));break;case"PerspectiveCamera":a=new It(e.fov,e.aspect,e.near,e.far),void 0!==e.focus&&(a.focus=e.focus),void 0!==e.zoom&&(a.zoom=e.zoom),void 0!==e.filmGauge&&(a.filmGauge=e.filmGauge),void 0!==e.filmOffset&&(a.filmOffset=e.filmOffset),void 0!==e.view&&(a.view=Object.assign({},e.view));break;case"OrthographicCamera":a=new Ut(e.left,e.right,e.top,e.bottom,e.near,e.far);break;case"AmbientLight":a=new zn(e.color,e.intensity);break;case"DirectionalLight":a=new Fn(e.color,e.intensity);break;case"PointLight":a=new Nn(e.color,e.intensity,e.distance,e.decay);break;case"SpotLight":a=new Un(e.color,e.intensity,e.distance,e.angle,e.penumbra,e.decay);break;case"HemisphereLight":a=new Pn(e.color,e.groundColor,e.intensity);break;case"Mesh":var s=r(e.geometry),c=o(e.material);a=s.bones&&s.bones.length>0?new ge(s,c):new Rt(s,c);break;case"LOD":a=new fe;break;case"Line":a=new _e(r(e.geometry),o(e.material),e.mode);break;case"LineSegments":a=new be(r(e.geometry),o(e.material));break;case"PointCloud":case"Points":a=new we(r(e.geometry),o(e.material));break;case"Sprite":a=new pe(o(e.material));break;case"Group":a=new Me;break;case"SkinnedMesh":console.warn("THREE.ObjectLoader.parseObject() does not support SkinnedMesh type. Instantiates Object3D instead.");default:a=new ht}if(a.uuid=e.uuid,void 0!==e.name&&(a.name=e.name),void 0!==e.matrix?(t.fromArray(e.matrix),t.decompose(a.position,a.quaternion,a.scale)):(void 0!==e.position&&a.position.fromArray(e.position),void 0!==e.rotation&&a.rotation.fromArray(e.rotation),void 0!==e.quaternion&&a.quaternion.fromArray(e.quaternion),void 0!==e.scale&&a.scale.fromArray(e.scale)),void 0!==e.castShadow&&(a.castShadow=e.castShadow),void 0!==e.receiveShadow&&(a.receiveShadow=e.receiveShadow),e.shadow&&(void 0!==e.shadow.bias&&(a.shadow.bias=e.shadow.bias),void 0!==e.shadow.radius&&(a.shadow.radius=e.shadow.radius),void 0!==e.shadow.mapSize&&a.shadow.mapSize.fromArray(e.shadow.mapSize),void 0!==e.shadow.camera&&(a.shadow.camera=this.parseObject(e.shadow.camera))),void 0!==e.visible&&(a.visible=e.visible),void 0!==e.userData&&(a.userData=e.userData),void 0!==e.children)for(var l in e.children)a.add(this.parseObject(e.children[l],n,i));if("LOD"===e.type)for(var h=e.levels,u=0;u<h.length;u++){var d=h[u],l=a.getObjectByProperty("uuid",d.object);void 0!==l&&a.addLevel(l,d.distance)}return a}}()}),ri.prototype={constructor:ri,getPoint:function(t){return console.warn("THREE.Curve: Warning, getPoint() not implemented!"),null},getPointAt:function(t){var e=this.getUtoTmapping(t);return this.getPoint(e)},getPoints:function(t){t||(t=5);for(var e=[],n=0;n<=t;n++)e.push(this.getPoint(n/t));return e},getSpacedPoints:function(t){t||(t=5);for(var e=[],n=0;n<=t;n++)e.push(this.getPointAt(n/t));return e},getLength:function(){var t=this.getLengths();return t[t.length-1]},getLengths:function(t){if(t||(t=this.__arcLengthDivisions?this.__arcLengthDivisions:200),this.cacheArcLengths&&this.cacheArcLengths.length===t+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;var e,n,i=[],r=this.getPoint(0),o=0;for(i.push(0),n=1;n<=t;n++)e=this.getPoint(n/t),o+=e.distanceTo(r),i.push(o),r=e;return this.cacheArcLengths=i,i},updateArcLengths:function(){this.needsUpdate=!0,this.getLengths()},getUtoTmapping:function(t,e){var n,i=this.getLengths(),r=0,o=i.length;n=e||t*i[o-1];for(var a,s=0,c=o-1;s<=c;
1)if(r=Math.floor(s+(c-s)/2),(a=i[r]-n)<0)s=r+1;else{if(!(a>0)){c=r;break}c=r-1}if(r=c,i[r]===n){var l=r/(o-1);return l}var h=i[r],u=i[r+1],d=u-h,p=(n-h)/d,l=(r+p)/(o-1);return l},getTangent:function(t){var e=t-1e-4,n=t+1e-4;e<0&&(e=0),n>1&&(n=1);var i=this.getPoint(e);return this.getPoint(n).clone().sub(i).normalize()},getTangentAt:function(t){var e=this.getUtoTmapping(t);return this.getTangent(e)},computeFrenetFrames:function(t,e){var n,i,r,o=new h,a=[],s=[],c=[],l=new h,d=new u;for(n=0;n<=t;n++)i=n/t,a[n]=this.getTangentAt(i),a[n].normalize();s[0]=new h,c[0]=new h;var p=Number.MAX_VALUE,f=Math.abs(a[0].x),m=Math.abs(a[0].y),v=Math.abs(a[0].z);for(f<=p&&(p=f,o.set(1,0,0)),m<=p&&(p=m,o.set(0,1,0)),v<=p&&o.set(0,0,1),l.crossVectors(a[0],o).normalize(),s[0].crossVectors(a[0],l),c[0].crossVectors(a[0],s[0]),n=1;n<=t;n++)s[n]=s[n-1].clone(),c[n]=c[n-1].clone(),l.crossVectors(a[n-1],a[n]),l.length()>Number.EPSILON&&(l.normalize(),r=Math.acos(pa.clamp(a[n-1].dot(a[n]),-1,1)),s[n].applyMatrix4(d.makeRotationAxis(l,r))),c[n].crossVectors(a[n],s[n]);if(!0===e)for(r=Math.acos(pa.clamp(s[0].dot(s[t]),-1,1)),r/=t,a[0].dot(l.crossVectors(s[0],s[t]))>0&&(r=-r),n=1;n<=t;n++)s[n].applyMatrix4(d.makeRotationAxis(a[n],r*n)),c[n].crossVectors(a[n],s[n]);return{tangents:a,normals:s,binormals:c}}},ri.create=function(t,e){return t.prototype=Object.create(ri.prototype),t.prototype.constructor=t,t.prototype.getPoint=e,t},oi.prototype=Object.create(ri.prototype),oi.prototype.constructor=oi,oi.prototype.isLineCurve=!0,oi.prototype.getPoint=function(t){if(1===t)return this.v2.clone();var e=this.v2.clone().sub(this.v1);return e.multiplyScalar(t).add(this.v1),e},oi.prototype.getPointAt=function(t){return this.getPoint(t)},oi.prototype.getTangent=function(t){return this.v2.clone().sub(this.v1).normalize()},ai.prototype=Object.assign(Object.create(ri.prototype),{constructor:ai,add:function(t){this.curves.push(t)},closePath:function(){var t=this.curves[0].getPoint(0),e=this.curves[this.curves.length-1].getPoint(1);t.equals(e)||this.curves.push(new oi(e,t))},getPoint:function(t){for(var e=t*this.getLength(),n=this.getCurveLengths(),i=0;i<n.length;){if(n[i]>=e){var r=n[i]-e,o=this.curves[i],a=o.getLength(),s=0===a?0:1-r/a;return o.getPointAt(s)}i++}return null},getLength:function(){var t=this.getCurveLengths();return t[t.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 t=[],e=0,n=0,i=this.curves.length;n<i;n++)e+=this.curves[n].getLength(),t.push(e);return this.cacheLengths=t,t},getSpacedPoints:function(t){t||(t=40);for(var e=[],n=0;n<=t;n++)e.push(this.getPoint(n/t));return this.autoClose&&e.push(e[0]),e},getPoints:function(t){t=t||12;for(var e,n=[],i=0,r=this.curves;i<r.length;i++)for(var o=r[i],a=o&&o.isEllipseCurve?2*t:o&&o.isLineCurve?1:o&&o.isSplineCurve?t*o.points.length:t,s=o.getPoints(a),c=0;c<s.length;c++){var l=s[c];e&&e.equals(l)||(n.push(l),e=l)}return this.autoClose&&n.length>1&&!n[n.length-1].equals(n[0])&&n.push(n[0]),n},createPointsGeometry:function(t){var e=this.getPoints(t);return this.createGeometry(e)},createSpacedPointsGeometry:function(t){var e=this.getSpacedPoints(t);return this.createGeometry(e)},createGeometry:function(t){for(var e=new St,n=0,i=t.length;n<i;n++){var r=t[n];e.vertices.push(new h(r.x,r.y,r.z||0))}return e}}),si.prototype=Object.create(ri.prototype),si.prototype.constructor=si,si.prototype.isEllipseCurve=!0,si.prototype.getPoint=function(t){for(var e=2*Math.PI,n=this.aEndAngle-this.aStartAngle,i=Math.abs(n)<Number.EPSILON;n<0;)n+=e;for(;n>e;)n-=e;n<Number.EPSILON&&(n=i?0:e),!0!==this.aClockwise||i||(n===e?n=-e:n-=e);var o=this.aStartAngle+t*n,a=this.aX+this.xRadius*Math.cos(o),s=this.aY+this.yRadius*Math.sin(o);if(0!==this.aRotation){var c=Math.cos(this.aRotation),l=Math.sin(this.aRotation),h=a-this.aX,u=s-this.aY;a=h*c-u*l+this.aX,s=h*l+u*c+this.aY}return new r(a,s)};var Da={tangentQuadraticBezier:function(t,e,n,i){return 2*(1-t)*(n-e)+2*t*(i-n)},tangentCubicBezier:function(t,e,n,i,r){return-3*e*(1-t)*(1-t)+3*n*(1-t)*(1-t)-6*t*n*(1-t)+6*t*i*(1-t)-3*t*t*i+3*t*t*r},tangentSpline:function(t,e,n,i,r){return 6*t*t-6*t+(3*t*t-4*t+1)+(-6*t*t+6*t)+(3*t*t-2*t)},interpolate:function(t,e,n,i,r){var o=.5*(n-t),a=.5*(i-e),s=r*r;return(2*e-2*n+o+a)*(r*s)+(-3*e+3*n-2*o-a)*s+o*r+e}};ci.prototype=Object.create(ri.prototype),ci.prototype.constructor=ci,ci.prototype.isSplineCurve=!0,ci.prototype.getPoint=function(t){var e=this.points,n=(e.length-1)*t,i=Math.floor(n),o=n-i,a=e[0===i?i:i-1],s=e[i],c=e[i>e.length-2?e.length-1:i+1],l=e[i>e.length-3?e.length-1:i+2],h=Da.interpolate;return new r(h(a.x,s.x,c.x,l.x,o),h(a.y,s.y,c.y,l.y,o))},li.prototype=Object.create(ri.prototype),li.prototype.constructor=li,li.prototype.getPoint=function(t){var e=Ra.b3;return new r(e(t,this.v0.x,this.v1.x,this.v2.x,this.v3.x),e(t,this.v0.y,this.v1.y,this.v2.y,this.v3.y))},li.prototype.getTangent=function(t){var e=Da.tangentCubicBezier;return new r(e(t,this.v0.x,this.v1.x,this.v2.x,this.v3.x),e(t,this.v0.y,this.v1.y,this.v2.y,this.v3.y)).normalize()},hi.prototype=Object.create(ri.prototype),hi.prototype.constructor=hi,hi.prototype.getPoint=function(t){var e=Ra.b2;return new r(e(t,this.v0.x,this.v1.x,this.v2.x),e(t,this.v0.y,this.v1.y,this.v2.y))},hi.prototype.getTangent=function(t){var e=Da.tangentQuadraticBezier;return new r(e(t,this.v0.x,this.v1.x,this.v2.x),e(t,this.v0.y,this.v1.y,this.v2.y)).normalize()};var Fa=Object.assign(Object.create(ai.prototype),{fromPoints:function(t){this.moveTo(t[0].x,t[0].y);for(var e=1,n=t.length;e<n;e++)this.lineTo(t[e].x,t[e].y)},moveTo:function(t,e){this.currentPoint.set(t,e)},lineTo:function(t,e){var n=new oi(this.currentPoint.clone(),new r(t,e));this.curves.push(n),this.currentPoint.set(t,e)},quadraticCurveTo:function(t,e,n,i){var o=new hi(this.currentPoint.clone(),new r(t,e),new r(n,i));this.curves.push(o),this.currentPoint.set(n,i)},bezierCurveTo:function(t,e,n,i,o,a){var s=new li(this.currentPoint.clone(),new r(t,e),new r(n,i),new r(o,a));this.curves.push(s),this.currentPoint.set(o,a)},splineThru:function(t){var e=[this.currentPoint.clone()].concat(t),n=new ci(e);this.curves.push(n),this.currentPoint.copy(t[t.length-1])},arc:function(t,e,n,i,r,o){var a=this.currentPoint.x,s=this.currentPoint.y;this.absarc(t+a,e+s,n,i,r,o)},absarc:function(t,e,n,i,r,o){this.absellipse(t,e,n,n,i,r,o)},ellipse:function(t,e,n,i,r,o,a,s){var c=this.currentPoint.x,l=this.currentPoint.y;this.absellipse(t+c,e+l,n,i,r,o,a,s)},absellipse:function(t,e,n,i,r,o,a,s){var c=new si(t,e,n,i,r,o,a,s);if(this.curves.length>0){var l=c.getPoint(0);l.equals(this.currentPoint)||this.lineTo(l.x,l.y)}this.curves.push(c);var h=c.getPoint(1);this.currentPoint.copy(h)}});ui.prototype=Object.assign(Object.create(Fa),{constructor:ui,getPointsHoles:function(t){for(var e=[],n=0,i=this.holes.length;n<i;n++)e[n]=this.holes[n].getPoints(t);return e},extractAllPoints:function(t){return{shape:this.getPoints(t),holes:this.getPointsHoles(t)}},extractPoints:function(t){return this.extractAllPoints(t)}}),di.prototype=Fa,Fa.constructor=di,pi.prototype={moveTo:function(t,e){this.currentPath=new di,this.subPaths.push(this.currentPath),this.currentPath.moveTo(t,e)},lineTo:function(t,e){this.currentPath.lineTo(t,e)},quadraticCurveTo:function(t,e,n,i){this.currentPath.quadraticCurveTo(t,e,n,i)},bezierCurveTo:function(t,e,n,i,r,o){this.currentPath.bezierCurveTo(t,e,n,i,r,o)},splineThru:function(t){this.currentPath.splineThru(t)},toShapes:function(t,e){function n(t){for(var e=[],n=0,i=t.length;n<i;n++){var r=t[n],o=new ui;o.curves=r.curves,e.push(o)}return e}var i=Ra.isClockWise,r=this.subPaths;if(0===r.length)return[];if(!0===e)return n(r);var o,a,s,c=[];if(1===r.length)return a=r[0],s=new ui,s.curves=a.curves,c.push(s),c;var l=!i(r[0].getPoints());l=t?!l:l;var h,u=[],d=[],p=[],f=0;d[f]=void 0,p[f]=[];for(var m=0,v=r.length;m<v;m++)a=r[m],h=a.getPoints(),o=i(h),o=t?!o:o,o?(!l&&d[f]&&f++,d[f]={s:new ui,p:h},d[f].s.curves=a.curves,l&&f++,p[f]=[]):p[f].push({h:a,p:h[0]});if(!d[0])return n(r);if(d.length>1){for(var g=!1,y=[],_=0,b=d.length;_<b;_++)u[_]=[];for(var _=0,b=d.length;_<b;_++)for(var x=p[_],w=0;w<x.length;w++){for(var M=x[w],E=!0,T=0;T<d.length;T++)(function(t,e){for(var n=e.length,i=!1,r=n-1,o=0;o<n;r=o++){var a=e[r],s=e[o],c=s.x-a.x,l=s.y-a.y;if(Math.abs(l)>Number.EPSILON){if(l<0&&(a=e[o],c=-c,s=e[r],l=-l),t.y<a.y||t.y>s.y)continue;
1if(t.y===a.y){if(t.x===a.x)return!0}else{var h=l*(t.x-a.x)-c*(t.y-a.y);if(0===h)return!0;if(h<0)continue;i=!i}}else{if(t.y!==a.y)continue;if(s.x<=t.x&&t.x<=a.x||a.x<=t.x&&t.x<=s.x)return!0}}return i})(M.p,d[T].p)&&(_!==T&&y.push({froms:_,tos:T,hole:w}),E?(E=!1,u[T].push(M)):g=!0);E&&u[_].push(M)}y.length>0&&(g||(p=u))}for(var S,m=0,A=d.length;m<A;m++){s=d[m].s,c.push(s),S=p[m];for(var L=0,R=S.length;L<R;L++)s.holes.push(S[L].h)}return c}},Object.assign(fi.prototype,{isFont:!0,generateShapes:function(t,e,n){function i(t,e,i){var o=r.glyphs[t]||r.glyphs["?"];if(o){var a,s,c,l,h,u,d,p,f,m,v,g=new pi,y=[],_=Ra.b2,b=Ra.b3;if(o.o)for(var x=o._cachedOutline||(o._cachedOutline=o.o.split(" ")),w=0,M=x.length;w<M;){var E=x[w++];switch(E){case"m":a=x[w++]*e+i,s=x[w++]*e,g.moveTo(a,s);break;case"l":a=x[w++]*e+i,s=x[w++]*e,g.lineTo(a,s);break;case"q":if(c=x[w++]*e+i,l=x[w++]*e,d=x[w++]*e+i,p=x[w++]*e,g.quadraticCurveTo(d,p,c,l),v=y[y.length-1]){h=v.x,u=v.y;for(var T=1;T<=n;T++){var S=T/n;_(S,h,d,c),_(S,u,p,l)}}break;case"b":if(c=x[w++]*e+i,l=x[w++]*e,d=x[w++]*e+i,p=x[w++]*e,f=x[w++]*e+i,m=x[w++]*e,g.bezierCurveTo(d,p,f,m,c,l),v=y[y.length-1]){h=v.x,u=v.y;for(var T=1;T<=n;T++){var S=T/n;b(S,h,d,f,c),b(S,u,p,m,l)}}}}return{offset:o.ha*e,path:g}}}void 0===e&&(e=100),void 0===n&&(n=4);for(var r=this.data,o=function(t){for(var n=String(t).split(""),o=e/r.resolution,a=0,s=[],c=0;c<n.length;c++){var l=i(n[c],o,a);a+=l.offset,s.push(l.path)}return s}(t),a=[],s=0,c=o.length;s<c;s++)Array.prototype.push.apply(a,o[s].toShapes());return a}}),Object.assign(mi.prototype,{load:function(t,e,n,i){var r=this;new En(this.manager).load(t,function(t){var n;try{n=JSON.parse(t)}catch(e){console.warn("THREE.FontLoader: typeface.js support is being deprecated. Use typeface.json instead."),n=JSON.parse(t.substring(65,t.length-2))}var i=r.parse(n);e&&e(i)},n,i)},parse:function(t){return new fi(t)}});var za,Ba={getContext:function(){return void 0===za&&(za=new(window.AudioContext||window.webkitAudioContext)),za},setContext:function(t){za=t}};Object.assign(vi.prototype,{load:function(t,e,n,i){var r=new En(this.manager);r.setResponseType("arraybuffer"),r.load(t,function(t){Ba.getContext().decodeAudioData(t,function(t){e(t)})},n,i)}}),gi.prototype=Object.assign(Object.create(Cn.prototype),{constructor:gi,isRectAreaLight:!0,copy:function(t){return Cn.prototype.copy.call(this,t),this.width=t.width,this.height=t.height,this}}),Object.assign(yi.prototype,{update:function(){var t,e,n,i,r,o,a,s=new u,c=new u;return function(l){if(t!==this||e!==l.focus||n!==l.fov||i!==l.aspect*this.aspect||r!==l.near||o!==l.far||a!==l.zoom){t=this,e=l.focus,n=l.fov,i=l.aspect*this.aspect,r=l.near,o=l.far,a=l.zoom;var h,u,d=l.projectionMatrix.clone(),p=this.eyeSep/2,f=p*r/e,m=r*Math.tan(pa.DEG2RAD*n*.5)/a;c.elements[12]=-p,s.elements[12]=p,h=-m*i+f,u=m*i+f,d.elements[0]=2*r/(u-h),d.elements[8]=(u+h)/(u-h),this.cameraL.projectionMatrix.copy(d),h=-m*i-f,u=m*i-f,d.elements[0]=2*r/(u-h),d.elements[8]=(u+h)/(u-h),this.cameraR.projectionMatrix.copy(d)}this.cameraL.matrixWorld.copy(l.matrixWorld).multiply(c),this.cameraR.matrixWorld.copy(l.matrixWorld).multiply(s)}}()}),_i.prototype=Object.create(ht.prototype),_i.prototype.constructor=_i,bi.prototype=Object.assign(Object.create(ht.prototype),{constructor:bi,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(t){null!==this.filter?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination),this.filter=t,this.gain.connect(this.filter),this.filter.connect(this.context.destination)},getMasterVolume:function(){return this.gain.gain.value},setMasterVolume:function(t){this.gain.gain.value=t},updateMatrixWorld:function(){var t=new h,e=new l,n=new h,i=new h;return function(r){ht.prototype.updateMatrixWorld.call(this,r);var o=this.context.listener,a=this.up;this.matrixWorld.decompose(t,e,n),i.set(0,0,-1).applyQuaternion(e),o.positionX?(o.positionX.setValueAtTime(t.x,this.context.currentTime),o.positionY.setValueAtTime(t.y,this.context.currentTime),o.positionZ.setValueAtTime(t.z,this.context.currentTime),o.forwardX.setValueAtTime(i.x,this.context.currentTime),o.forwardY.setValueAtTime(i.y,this.context.currentTime),o.forwardZ.setValueAtTime(i.z,this.context.currentTime),o.upX.setValueAtTime(a.x,this.context.currentTime),o.upY.setValueAtTime(a.y,this.context.currentTime),o.upZ.setValueAtTime(a.z,this.context.currentTime)):(o.setPosition(t.x,t.y,t.z),o.setOrientation(i.x,i.y,i.z,a.x,a.y,a.z))}}()}),xi.prototype=Object.assign(Object.create(ht.prototype),{constructor:xi,getOutput:function(){return this.gain}
1,setNodeSource:function(t){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=t,this.connect(),this},setBuffer:function(t){return this.buffer=t,this.sourceType="buffer",this.autoplay&&this.play(),this},play:function(){if(!0===this.isPlaying)return void console.warn("THREE.Audio: Audio is already playing.");if(!1===this.hasPlaybackControl)return void console.warn("THREE.Audio: this Audio has no playback control.");var t=this.context.createBufferSource();return t.buffer=this.buffer,t.loop=this.loop,t.onended=this.onEnded.bind(this),t.playbackRate.setValueAtTime(this.playbackRate,this.startTime),t.start(0,this.startTime),this.isPlaying=!0,this.source=t,this.connect()},pause:function(){return!1===this.hasPlaybackControl?void console.warn("THREE.Audio: this Audio has no playback control."):(this.source.stop(),this.startTime=this.context.currentTime,this.isPlaying=!1,this)},stop:function(){return!1===this.hasPlaybackControl?void console.warn("THREE.Audio: this Audio has no playback control."):(this.source.stop(),this.startTime=0,this.isPlaying=!1,this)},connect:function(){if(this.filters.length>0){this.source.connect(this.filters[0]);for(var t=1,e=this.filters.length;t<e;t++)this.filters[t-1].connect(this.filters[t]);this.filters[this.filters.length-1].connect(this.getOutput())}else this.source.connect(this.getOutput());return this},disconnect:function(){if(this.filters.length>0){this.source.disconnect(this.filters[0]);for(var t=1,e=this.filters.length;t<e;t++)this.filters[t-1].disconnect(this.filters[t]);this.filters[this.filters.length-1].disconnect(this.getOutput())}else this.source.disconnect(this.getOutput());return this},getFilters:function(){return this.filters},setFilters:function(t){return t||(t=[]),!0===this.isPlaying?(this.disconnect(),this.filters=t,this.connect()):this.filters=t,this},getFilter:function(){return this.getFilters()[0]},setFilter:function(t){return this.setFilters(t?[t]:[])},setPlaybackRate:function(t){return!1===this.hasPlaybackControl?void console.warn("THREE.Audio: this Audio has no playback control."):(this.playbackRate=t,!0===this.isPlaying&&this.source.playbackRate.setValueAtTime(this.playbackRate,this.context.currentTime),this)},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.loop},setLoop:function(t){return!1===this.hasPlaybackControl?void console.warn("THREE.Audio: this Audio has no playback control."):(this.loop=t,!0===this.isPlaying&&(this.source.loop=this.loop),this)},getVolume:function(){return this.gain.gain.value},setVolume:function(t){return this.gain.gain.value=t,this}}),wi.prototype=Object.assign(Object.create(xi.prototype),{constructor:wi,getOutput:function(){return this.panner},getRefDistance:function(){return this.panner.refDistance},setRefDistance:function(t){this.panner.refDistance=t},getRolloffFactor:function(){return this.panner.rolloffFactor},setRolloffFactor:function(t){this.panner.rolloffFactor=t},getDistanceModel:function(){return this.panner.distanceModel},setDistanceModel:function(t){this.panner.distanceModel=t},getMaxDistance:function(){return this.panner.maxDistance},setMaxDistance:function(t){this.panner.maxDistance=t},updateMatrixWorld:function(){var t=new h;return function(e){ht.prototype.updateMatrixWorld.call(this,e),t.setFromMatrixPosition(this.matrixWorld),this.panner.setPosition(t.x,t.y,t.z)}}()}),Object.assign(Mi.prototype,{getFrequencyData:function(){return this.analyser.getByteFrequencyData(this.data),this.data},getAverageFrequency:function(){for(var t=0,e=this.getFrequencyData(),n=0;n<e.length;n++)t+=e[n];return t/e.length}}),Ei.prototype={constructor:Ei,accumulate:function(t,e){var n=this.buffer,i=this.valueSize,r=t*i+i,o=this.cumulativeWeight;if(0===o){for(var a=0;a!==i;++a)n[r+a]=n[a];o=e}else{o+=e;var s=e/o;this._mixBufferRegion(n,r,0,s,i)}this.cumulativeWeight=o},apply:function(t){var e=this.valueSize,n=this.buffer,i=t*e+e,r=this.cumulativeWeight,o=this.binding;if(this.cumulativeWeight=0,r<1){var a=3*e;this._mixBufferRegion(n,i,a,1-r,e)}for(var s=e,c=e+e;s!==c;++s)if(n[s]!==n[s+e]){o.setValue(n,i);break}},saveOriginalState:function(){var t=this.binding,e=this.buffer,n=this.valueSize,i=3*n;t.getValue(e,i);for(var r=n,o=i;r!==o;++r)e[r]=e[i+r%n];this.cumulativeWeight=0},restoreOriginalState:function(){var t=3*this.valueSize;this.binding.setValue(this.buffer,t)},_select:function(t,e,n,i,r){if(i>=.5)for(var o=0;o!==r;++o)t[e+o]=t[n+o]},_slerp:function(t,e,n,i,r){l.slerpFlat(t,e,t,e,t,n,i)},_lerp:function(t,e,n,i,r){for(var o=1-i,a=0;a!==r;++a){var s=e+a;t[s]=t[s]*o+t[n+a]*i}}},Ti.prototype={constructor:Ti,getValue:function(t,e){this.bind(),this.getValue(t,e)},setValue:function(t,e){this.bind(),this.setValue(t,e)},bind:function(){var t=this.node,e=this.parsedPath,n=e.objectName,i=e.propertyName,r=e.propertyIndex;if(t||(t=Ti.findNode(this.rootNode,e.nodeName)||this.rootNode,this.node=t),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!t)return void console.error("  trying to update node for track: "+this.path+" but it wasn't found.");if(n){var o=e.objectIndex;switch(n){case"materials":if(!t.material)return void console.error("  can not bind to material as no
1de does not have a material",this);if(!t.material.materials)return void console.error("  can not bind to material.materials as node.material does not have a materials array",this);t=t.material.materials;break;case"bones":if(!t.skeleton)return void console.error("  can not bind to bones as node does not have a skeleton",this);t=t.skeleton.bones;for(var a=0;a<t.length;a++)if(t[a].name===o){o=a;break}break;default:if(void 0===t[n])return void console.error("  can not bind to objectName of node, undefined",this);t=t[n]}if(void 0!==o){if(void 0===t[o])return void console.error("  trying to bind to objectIndex of objectName, but is undefined:",this,t);t=t[o]}}var s=t[i];if(void 0===s){var c=e.nodeName;return void console.error("  trying to update property for track: "+c+"."+i+" but it wasn't found.",t)}var l=this.Versioning.None;void 0!==t.needsUpdate?(l=this.Versioning.NeedsUpdate,this.targetObject=t):void 0!==t.matrixWorldNeedsUpdate&&(l=this.Versioning.MatrixWorldNeedsUpdate,this.targetObject=t);var h=this.BindingType.Direct;if(void 0!==r){if("morphTargetInfluences"===i){if(!t.geometry)return void console.error("  can not bind to morphTargetInfluences becasuse node does not have a geometry",this);if(!t.geometry.morphTargets)return void console.error("  can not bind to morphTargetInfluences becasuse node does not have a geometry.morphTargets",this);for(var a=0;a<this.node.geometry.morphTargets.length;a++)if(t.geometry.morphTargets[a].name===r){r=a;break}}h=this.BindingType.ArrayElement,this.resolvedProperty=s,this.propertyIndex=r}else void 0!==s.fromArray&&void 0!==s.toArray?(h=this.BindingType.HasFromToArray,this.resolvedProperty=s):void 0!==s.length?(h=this.BindingType.EntireArray,this.resolvedProperty=s):this.propertyName=i;this.getValue=this.GetterByBindingType[h],this.setValue=this.SetterByBindingTypeAndVersioning[h][l]},unbind:function(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}},Object.assign(Ti.prototype,{_getValue_unavailable:function(){},_setValue_unavailable:function(){},_getValue_unbound:Ti.prototype.getValue,_setValue_unbound:Ti.prototype.setValue,BindingType:{Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3},Versioning:{None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2},GetterByBindingType:[function(t,e){t[e]=this.node[this.propertyName]},function(t,e){for(var n=this.resolvedProperty,i=0,r=n.length;i!==r;++i)t[e++]=n[i]},function(t,e){t[e]=this.resolvedProperty[this.propertyIndex]},function(t,e){this.resolvedProperty.toArray(t,e)}],SetterByBindingTypeAndVersioning:[[function(t,e){this.node[this.propertyName]=t[e]},function(t,e){this.node[this.propertyName]=t[e],this.targetObject.needsUpdate=!0},function(t,e){this.node[this.propertyName]=t[e],this.targetObject.matrixWorldNeedsUpdate=!0}],[function(t,e){for(var n=this.resolvedProperty,i=0,r=n.length;i!==r;++i)n[i]=t[e++]},function(t,e){for(var n=this.resolvedProperty,i=0,r=n.length;i!==r;++i)n[i]=t[e++];this.targetObject.needsUpdate=!0},function(t,e){for(var n=this.resolvedProperty,i=0,r=n.length;i!==r;++i)n[i]=t[e++];this.targetObject.matrixWorldNeedsUpdate=!0}],[function(t,e){this.resolvedProperty[this.propertyIndex]=t[e]},function(t,e){this.resolvedProperty[this.propertyIndex]=t[e],this.targetObject.needsUpdate=!0},function(t,e){this.resolvedProperty[this.propertyIndex]=t[e],this.targetObject.matrixWorldNeedsUpdate=!0}],[function(t,e){this.resolvedProperty.fromArray(t,e)},function(t,e){this.resolvedProperty.fromArray(t,e),this.targetObject.needsUpdate=!0},function(t,e){this.resolvedProperty.fromArray(t,e),this.targetObject.matrixWorldNeedsUpdate=!0}]]}),Ti.Composite=function(t,e,n){var i=n||Ti.parseTrackName(e);this._targetGroup=t,this._bindings=t.subscribe_(e,i)},Ti.Composite.prototype={constructor:Ti.Composite,getValue:function(t,e){this.bind();var n=this._targetGroup.nCachedObjects_,i=this._bindings[n];void 0!==i&&i.getValue(t,e)},setValue:function(t,e){for(var n=this._bindings,i=this._targetGroup.nCachedObjects_,r=n.length;i!==r;++i)n[i].setValue(t,e)},bind:function(){for(var t=this._bindings,e=this._targetGroup.nCachedObjects_,n=t.length;e!==n;++e)t[e].bind()},unbind:function(){for(var t=this._bindings,e=this._targetGroup.nCachedObjects_,n=t.length;e!==n;++e)t[e].unbind()}},Ti.create=function(t,e,n){return t&&t.isAnimationObjectGroup?new Ti.Composite(t,e,n):new Ti(t,e,n)},Ti.parseTrackName=function(t){var e=/^((?:[\w-]+[\/:])*)([\w-]+)?(?:\.([\w-]+)(?:\[(.+)\])?)?\.([\w-]+)(?:\[(.+)\])?$/,n=e.exec(t);if(!n)throw new Error("cannot parse trackName at all: "+t);var i={nodeName:n[2],objectName:n[3],objectIndex:n[4],propertyName:n[5],propertyIndex:n[6]};if(null===i.propertyName||0===i.propertyName.length)throw new Error("can not parse propertyName from trackName: "+t);return i},Ti.findNode=function(t,e){if(!e||""===e||"root"===e||"."===e||-1===e||e===t.name||e===t.uuid)return t;if(t.skeleton){var n=function(t){for(var n=0;n<t.bones.length;n++){var i=t.bones[n];if(i.name===e)return i}return null}(t.skeleton);if(n)return n}if(t.children){var i=function(t){for(var n=0;n<t.length;n++){var r=t[n];if(r.name===e||r.uuid===e)return r;var o=i(r.children);if(o)return o}return null},r=i(t.children);if(r)return r}return null},Si.prototype={constructor:Si,isAnimationObjectGroup:!0,add:function(t){for(var e=this._objects,n=e.length,i=this.nCachedObjects_,r=this._indicesByUUID,o=this._paths,a=this._parsedPaths,s=this._bindings,c=s.length,l=0,h=arguments.length;l!==h;++l){var u=arguments[l],d=u.uuid,p=r[d],f=void 0;if(void 0===p){p=n++,r[d]=p,e.push(u);for(var m=0,v=c;m!==v;++m)s[m].push(new Ti(u,o[m],a[m]))}else if(p<i){f=e[p];var g=--i,y=e[g];r[y.uuid]=p,e[p]=y,r[d]=g,e[g]=u;for(var m=0,v=c;m!==v;++m){var _=s[m],b=_[g],x=_[p];_[p]=b,void 0===x&&(x=new Ti(u,o[m],a[m])),_[g]=x}}else e[p]!==f&&console.error("Different objects with the same UUID detected. Clean the caches or recreate your infrastru
1cture when reloading scenes...")}this.nCachedObjects_=i},remove:function(t){for(var e=this._objects,n=this.nCachedObjects_,i=this._indicesByUUID,r=this._bindings,o=r.length,a=0,s=arguments.length;a!==s;++a){var c=arguments[a],l=c.uuid,h=i[l];if(void 0!==h&&h>=n){var u=n++,d=e[u];i[d.uuid]=h,e[h]=d,i[l]=u,e[u]=c;for(var p=0,f=o;p!==f;++p){var m=r[p],v=m[u],g=m[h];m[h]=v,m[u]=g}}}this.nCachedObjects_=n},uncache:function(t){for(var e=this._objects,n=e.length,i=this.nCachedObjects_,r=this._indicesByUUID,o=this._bindings,a=o.length,s=0,c=arguments.length;s!==c;++s){var l=arguments[s],h=l.uuid,u=r[h];if(void 0!==u)if(delete r[h],u<i){var d=--i,p=e[d],f=--n,m=e[f];r[p.uuid]=u,e[u]=p,r[m.uuid]=d,e[d]=m,e.pop();for(var v=0,g=a;v!==g;++v){var y=o[v],_=y[d],b=y[f];y[u]=_,y[d]=b,y.pop()}}else{var f=--n,m=e[f];r[m.uuid]=u,e[u]=m,e.pop();for(var v=0,g=a;v!==g;++v){var y=o[v];y[u]=y[f],y.pop()}}}this.nCachedObjects_=i},subscribe_:function(t,e){var n=this._bindingsIndicesByPath,i=n[t],r=this._bindings;if(void 0!==i)return r[i];var o=this._paths,a=this._parsedPaths,s=this._objects,c=s.length,l=this.nCachedObjects_,h=new Array(c);i=r.length,n[t]=i,o.push(t),a.push(e),r.push(h);for(var u=l,d=s.length;u!==d;++u){var p=s[u];h[u]=new Ti(p,t,e)}return h},unsubscribe_:function(t){var e=this._bindingsIndicesByPath,n=e[t];if(void 0!==n){var i=this._paths,r=this._parsedPaths,o=this._bindings,a=o.length-1,s=o[a];e[t[a]]=n,o[n]=s,o.pop(),r[n]=r[a],r.pop(),i[n]=i[a],i.pop()}}},Ai.prototype={constructor:Ai,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(t){return this._startTime=t,this},setLoop:function(t,e){return this.loop=t,this.repetitions=e,this},setEffectiveWeight:function(t){return this.weight=t,this._effectiveWeight=this.enabled?t:0,this.stopFading()},getEffectiveWeight:function(){return this._effectiveWeight},fadeIn:function(t){return this._scheduleFading(t,0,1)},fadeOut:function(t){return this._scheduleFading(t,1,0)},crossFadeFrom:function(t,e,n){if(t.fadeOut(e),this.fadeIn(e),n){var i=this._clip.duration,r=t._clip.duration,o=r/i,a=i/r;t.warp(1,o,e),this.warp(a,1,e)}return this},crossFadeTo:function(t,e,n){return t.crossFadeFrom(this,e,n)},stopFading:function(){var t=this._weightInterpolant;return null!==t&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(t)),this},setEffectiveTimeScale:function(t){return this.timeScale=t,this._effectiveTimeScale=this.paused?0:t,this.stopWarping()},getEffectiveTimeScale:function(){return this._effectiveTimeScale},setDuration:function(t){return this.timeScale=this._clip.duration/t,this.stopWarping()},syncWith:function(t){return this.time=t.time,this.timeScale=t.timeScale,this.stopWarping()},halt:function(t){return this.warp(this._effectiveTimeScale,0,t)},warp:function(t,e,n){var i=this._mixer,r=i.time,o=this._timeScaleInterpolant,a=this.timeScale;null===o&&(o=i._lendControlInterpolant(),this._timeScaleInterpolant=o);var s=o.parameterPositions,c=o.sampleValues;return s[0]=r,s[1]=r+n,c[0]=t/a,c[1]=e/a,this},stopWarping:function(){var t=this._timeScaleInterpolant;return null!==t&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(t)),this},getMixer:function(){return this._mixer},getClip:function(){return this._clip},getRoot:function(){return this._localRoot||this._mixer._root},_update:function(t,e,n,i){var r=this._startTime;if(null!==r){var o=(t-r)*n;if(o<0||0===n)return;this._startTime=null,e=n*o}e*=this._updateTimeScale(t);var a=this._updateTime(e),s=this._updateWeight(t);if(s>0)for(var c=this._interpolants,l=this._propertyBindings,h=0,u=c.length;h!==u;++h)c[h].evaluate(a),l[h].accumulate(i,s)},_updateWeight:function(t){var e=0;if(this.enabled){e=this.weight;var n=this._weightInterpolant;if(null!==n){var i=n.evaluate(t)[0];e*=i,t>n.parameterPositions[1]&&(this.stopFading(),0===i&&(this.enabled=!1))}}return this._effectiveWeight=e,e},_updateTimeScale:function(t){var e=0;if(!this.paused){e=this.timeScale;var n=this._timeScaleInterpolant;if(null!==n){e*=n.evaluate(t)[0],t>n.parameterPositions[1]&&(this.stopWarping(),0===e?this.paused=!0:this.timeScale=e)}}return this._effectiveTimeScale=e,e},_updateTime:function(t){var e=this.time+t;if(0===t)return e;var n=this._clip.duration,i=this.loop,r=this._loopCount;if(2200===i){-1===r&&(this._loopCount=0,this._setEndings(!0,!0,!1));t:{if(e>=n)e=n;else{if(!(e<0))break t;e=0}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this._mixer.dispatchEvent({type:"finished",action:this,direction:t<0?-1:1})}}else{var o=2202===i;if(-1===r&&(t>=0?(r=0,this._setEndings(!0,0===this.repetitions,o)):this._setEndings(0===this.repetitions,!0,o)),e>=n||e<0){var a=Math.floor(e/n);e-=n*a,r+=Math.abs(a);var s=this.repetitions-r;if(s<0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,e=t>0?n:0,this._mixer.dispatchEvent({type:"finished",action:this,direction:t>0?1:-1});else{if(0===s){var c=t<0;this._setEndings(c,!c,o)}else this._setEndings(!1,!1,o);this._loopCount=r,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:a})}}if(o&&1===(1&r))return this.time=e,n-e}return this.time=e,e},_setEndings:function(t,e,n){var i=this._interpolantSettings;n?(i.endingStart=2401,i.endingEnd=2401):(i.endingStart=t?this.zeroSlopeAtStart?2401:ta:2402,i.endingEnd=e?this.zeroSlopeAtEnd?2401:ta:2402)},_scheduleFading:function(t,e,n){var i=this._mixer,r=i.time,o=this._weightInterpolant;null===o&&(o=i._lendControlInterpolant(),this._weightInterpolant=o);var a=o.parameterPositions,s=o.sampleValues;return a[0]=r,s[0]=e,a[1]=r+t,s[1]=n,this}}
1,Object.assign(Li.prototype,i.prototype,{clipAction:function(t,e){var n=e||this._root,i=n.uuid,r="string"===typeof t?Kn.findByName(n,t):t,o=null!==r?r.uuid:t,a=this._actionsByClip[o],s=null;if(void 0!==a){var c=a.actionByRoot[i];if(void 0!==c)return c;s=a.knownActions[0],null===r&&(r=s._clip)}if(null===r)return null;var l=new Ai(this,r,e);return this._bindAction(l,s),this._addInactiveAction(l,o,i),l},existingAction:function(t,e){var n=e||this._root,i=n.uuid,r="string"===typeof t?Kn.findByName(n,t):t,o=r?r.uuid:t,a=this._actionsByClip[o];return void 0!==a?a.actionByRoot[i]||null:null},stopAllAction:function(){var t=this._actions,e=this._nActiveActions,n=this._bindings,i=this._nActiveBindings;this._nActiveActions=0,this._nActiveBindings=0;for(var r=0;r!==e;++r)t[r].reset();for(var r=0;r!==i;++r)n[r].useCount=0;return this},update:function(t){t*=this.timeScale;for(var e=this._actions,n=this._nActiveActions,i=this.time+=t,r=Math.sign(t),o=this._accuIndex^=1,a=0;a!==n;++a){var s=e[a];s.enabled&&s._update(i,t,r,o)}for(var c=this._bindings,l=this._nActiveBindings,a=0;a!==l;++a)c[a].apply(o);return this},getRoot:function(){return this._root},uncacheClip:function(t){var e=this._actions,n=t.uuid,i=this._actionsByClip,r=i[n];if(void 0!==r){for(var o=r.knownActions,a=0,s=o.length;a!==s;++a){var c=o[a];this._deactivateAction(c);var l=c._cacheIndex,h=e[e.length-1];c._cacheIndex=null,c._byClipCacheIndex=null,h._cacheIndex=l,e[l]=h,e.pop(),this._removeInactiveBindingsForAction(c)}delete i[n]}},uncacheRoot:function(t){var e=t.uuid,n=this._actionsByClip;for(var i in n){var r=n[i].actionByRoot,o=r[e];void 0!==o&&(this._deactivateAction(o),this._removeInactiveAction(o))}var a=this._bindingsByRootAndName,s=a[e];if(void 0!==s)for(var c in s){var l=s[c];l.restoreOriginalState(),this._removeInactiveBinding(l)}},uncacheAction:function(t,e){var n=this.existingAction(t,e);null!==n&&(this._deactivateAction(n),this._removeInactiveAction(n))}}),Object.assign(Li.prototype,{_bindAction:function(t,e){var n=t._localRoot||this._root,i=t._clip.tracks,r=i.length,o=t._propertyBindings,a=t._interpolants,s=n.uuid,c=this._bindingsByRootAndName,l=c[s];void 0===l&&(l={},c[s]=l);for(var h=0;h!==r;++h){var u=i[h],d=u.name,p=l[d];if(void 0!==p)o[h]=p;else{if(void 0!==(p=o[h])){null===p._cacheIndex&&(++p.referenceCount,this._addInactiveBinding(p,s,d));continue}var f=e&&e._propertyBindings[h].binding.parsedPath;p=new Ei(Ti.create(n,d,f),u.ValueTypeName,u.getValueSize()),++p.referenceCount,this._addInactiveBinding(p,s,d),o[h]=p}a[h].resultBuffer=p.buffer}},_activateAction:function(t){if(!this._isActiveAction(t)){if(null===t._cacheIndex){var e=(t._localRoot||this._root).uuid,n=t._clip.uuid,i=this._actionsByClip[n];this._bindAction(t,i&&i.knownActions[0]),this._addInactiveAction(t,n,e)}for(var r=t._propertyBindings,o=0,a=r.length;o!==a;++o){var s=r[o];0===s.useCount++&&(this._lendBinding(s),s.saveOriginalState())}this._lendAction(t)}},_deactivateAction:function(t){if(this._isActiveAction(t)){for(var e=t._propertyBindings,n=0,i=e.length;n!==i;++n){var r=e[n];0===--r.useCount&&(r.restoreOriginalState(),this._takeBackBinding(r))}this._takeBackAction(t)}},_initMemoryManager:function(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;var t=this;this.stats={actions:{get total(){return t._actions.length},get inUse(){return t._nActiveActions}},bindings:{get total(){return t._bindings.length},get inUse(){return t._nActiveBindings}},controlInterpolants:{get total(){return t._controlInterpolants.length},get inUse(){return t._nActiveControlInterpolants}}}},_isActiveAction:function(t){var e=t._cacheIndex;return null!==e&&e<this._nActiveActions},_addInactiveAction:function(t,e,n){var i=this._actions,r=this._actionsByClip,o=r[e];if(void 0===o)o={knownActions:[t],actionByRoot:{}},t._byClipCacheIndex=0,r[e]=o;else{var a=o.knownActions;t._byClipCacheIndex=a.length,a.push(t)}t._cacheIndex=i.length,i.push(t),o.actionByRoot[n]=t},_removeInactiveAction:function(t){var e=this._actions,n=e[e.length-1],i=t._cacheIndex;n._cacheIndex=i,e[i]=n,e.pop(),t._cacheIndex=null;var r=t._clip.uuid,o=this._actionsByClip,a=o[r],s=a.knownActions,c=s[s.length-1],l=t._byClipCacheIndex;c._byClipCacheIndex=l,s[l]=c,s.pop(),t._byClipCacheIndex=null,delete a.actionByRoot[(e._localRoot||this._root).uuid],0===s.length&&delete o[r],this._removeInactiveBindingsForAction(t)},_removeInactiveBindingsForAction:function(t){for(var e=t._propertyBindings,n=0,i=e.length;n!==i;++n){var r=e[n];0===--r.referenceCount&&this._removeInactiveBinding(r)}},_lendAction:function(t){var e=this._actions,n=t._cacheIndex,i=this._nActiveActions++,r=e[i];t._cacheIndex=i,e[i]=t,r._cacheIndex=n,e[n]=r},_takeBackAction:function(t){var e=this._actions,n=t._cacheIndex,i=--this._nActiveActions,r=e[i];t._cacheIndex=i,e[i]=t,r._cacheIndex=n,e[n]=r},_addInactiveBinding:function(t,e,n){var i=this._bindingsByRootAndName,r=i[e],o=this._bindings;void 0===r&&(r={},i[e]=r),r[n]=t,t._cacheIndex=o.length,o.push(t)},_removeInactiveBinding:function(t){var e=this._bindings,n=t.binding,i=n.rootNode.uuid,r=n.path,o=this._bindingsByRootAndName,a=o[i],s=e[e.length-1],c=t._cacheIndex;s._cacheIndex=c,e[c]=s,e.pop(),delete a[r];t:{for(var l in a)break t;delete o[i]}},_lendBinding:function(t){var e=this._bindings,n=t._cacheIndex,i=this._nActiveBindings++,r=e[i];t._cacheIndex=i,e[i]=t,r._cacheIndex=n,e[n]=r},_takeBackBinding:function(t){var e=this._bindings,n=t._cacheIndex,i=--this._nActiveBindings,r=e[i];t._cacheIndex=i,e[i]=t,r._cacheIndex=n,e[n]=r},_lendControlInterpolant:function(){var t=this._controlInterpolants,e=this._nActiveControlInterpolants++,n=t[e];return void 0===n&&(n=new jn(new Float32Array(2),new Float32Array(2),1,this._controlInterpolantsResultBuffer),n.__cacheIndex=e,t[e]=n),n},_takeBackControlInterpolant:function(t){var e=this._controlInterpolants,n=t.__cacheIndex,i=--this._nActiveControlInterpolants,r=e[i];t.__cacheIndex=i,e[i]=t,r.__cacheIndex=n,e[n]=r},_controlInterpolantsResultBuffer:new Float32Array(1)}),Ri.prototype.clone=function(){return new Ri(void 0===this.value.clone?this.value:this.value.clone())},Ci.prototype=Object.create(Lt.prototype),Ci.prototype.constructor=Ci,Ci.prototype.isInstancedBufferGeometry=!0,Ci.prototype.addGroup=function(t,e,n){this.groups.push({start:t,count:e,materialIndex:n})},Ci.prototype.copy=function(t){var e=t.index;null!==e&&this.setIndex(e.clone());var n=t.attributes;for(var i in n){var r=n[i];this.addAttribute(i,r.clone())}for(var o=t.groups,a=0,s=o.length;a<s;a++){var c=o[a];this.addGroup(c.start,c.count,c.materialIndex)}return this},Pi.prototype={constructor:Pi,isInterleavedBufferAttribute:!0,get count(){return this.data.count},get array(){return this.data.array},setX:function(t,e){return this.data.array[t*this.data.stride+this.offset]=e,this},setY:function(t,e){return this.data.array[t*this.data.stride+this.offset+1]=e,this},setZ:function(t,e){return this.data.array[t*this.data.stride+this.offset+2]=e,this},setW:function(t,e){return this.data.array[t*this.data.stride+this.offset+3]=e,this},getX:function(t){return this.data.array[t*this.data.stride+this.offset]},getY:function(t){return this.data.array[t*this.data.stride+this.offset+1]},getZ:function(t){return this.data.array[t*this.data.stride+this.offset+2]},getW:function(t){return this.data.array[t*this.data.stride+this.offset+3]},setXY:function(t,e,n){return t=t*this.data.stride+this.offset,this.data.array[t+0]=e,this.data.array[t+1]=n,this},setXYZ:function(t,e,n,i){return t=t*this.data.stride+this.offset,this.data.array[t+0]=e,this.data.array[t+1]=n,this.data.array[t+2]=i,this},setXYZW:function(t,e,n,i,r){return t=t*this.data.stride+this.offset,this.data.array[t+0]=e,this.data.array[t+1]=n,this.data.array[t+2]=i,this.data.array[t+3]=r,this}},Oi.prototype={constructor:Oi,isInterleavedBuffer:!0,set needsUpdate(t){!0===t&&this.version++},setArray:function(t){if(Array.isArray(t))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.count=void 0!==t?t.length/this.stride:0,this.array=t},setDynamic:function(t){return this.dynamic=t,this},copy:function(t){return this.array=new t.array.constructor(t.array),this.count=t.count,this.stride=t.stride,this.dynamic=t.dynamic,this},copyAt:function(t,e,n){t*=this.stride,n*=e.stride;for(var i=0,r=this.stride;i<r;i++)this.array[t+i]=e.array[n+i];return this},set:function(t,e){return void 0===e&&(e=0),this.array.set(t,e),this},clone:function(){return(new this.constructor).copy(this)},onUpload:function(t){return this.onUploadCallback=t,this}},Ii.prototype=Object.create(Oi.prototype),Ii.prototype.constructor=Ii,Ii.prototype.isInstancedInterleavedBuffer=!0,Ii.prototype.copy=function(t){return Oi.prototype.copy.call(this,t),this.meshPerAttribute=t.meshPerAttribute,this},Ui.prototype=Object.create(mt.prototype),Ui.prototype.constructor=Ui,Ui.prototype.isInstancedBufferAttribute=!0,Ui.prototype.copy=function(t){return mt.prototype.copy.call(this,t),this.meshPerAttribute=t.meshPerAttribute,this},Ni.prototype={constructor:Ni,linePrecision:1,set:function(t,e){this.ray.set(t,e)},setFromCamera:function(t,e){e&&e.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(e.matrixWorld),this.ray.direction.set(t.x,t.y,.5).unproject(e).sub(this.ray.origin).normalize()):e&&e.isOrthographicCamera?(this.ray.origin.set(t.x,t.y,(e.near+e.far)/(e.near-e.far)).unproject(e),this.ray.direction.set(0,0,-1).transformDirection(e.matrixWorld)):console.error("THREE.Raycaster: 
1Unsupported camera type.")},intersectObject:function(t,e){var n=[];return Fi(t,this,n,e),n.sort(Di),n},intersectObjects:function(t,e){var n=[];if(!1===Array.isArray(t))return console.warn("THREE.Raycaster.intersectObjects: objects is not an Array."),n;for(var i=0,r=t.length;i<r;i++)Fi(t[i],this,n,e);return n.sort(Di),n}},zi.prototype={constructor:zi,start:function(){this.startTime=(performance||Date).now(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0},stop:function(){this.getElapsedTime(),this.running=!1},getElapsedTime:function(){return this.getDelta(),this.elapsedTime},getDelta:function(){var t=0;if(this.autoStart&&!this.running&&this.start(),this.running){var e=(performance||Date).now();t=(e-this.oldTime)/1e3,this.oldTime=e,this.elapsedTime+=t}return t}},Bi.prototype={constructor:Bi,set:function(t,e,n){return this.radius=t,this.phi=e,this.theta=n,this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.radius=t.radius,this.phi=t.phi,this.theta=t.theta,this},makeSafe:function(){return this.phi=Math.max(1e-6,Math.min(Math.PI-1e-6,this.phi)),this},setFromVector3:function(t){return this.radius=t.length(),0===this.radius?(this.theta=0,this.phi=0):(this.theta=Math.atan2(t.x,t.z),this.phi=Math.acos(pa.clamp(t.y/this.radius,-1,1))),this}},ki.prototype={constructor:ki,set:function(t,e,n){return this.radius=t,this.theta=e,this.y=n,this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.radius=t.radius,this.theta=t.theta,this.y=t.y,this},setFromVector3:function(t){return this.radius=Math.sqrt(t.x*t.x+t.z*t.z),this.theta=Math.atan2(t.x,t.z),this.y=t.y,this}},ji.prototype=Object.create(Rt.prototype),ji.prototype.constructor=ji,ji.prototype.createAnimation=function(t,e,n,i){var r={start:e,end:n,length:n-e+1,fps:i,duration:(n-e)/i,lastFrame:0,currentFrame:0,active:!1,time:0,direction:1,weight:1,directionBackwards:!1,mirroredLoop:!1};this.animationsMap[t]=r,this.animationsList.push(r)},ji.prototype.autoCreateAnimations=function(t){for(var e,n=/([a-z]+)_?(\d+)/i,i={},r=this.geometry,o=0,a=r.morphTargets.length;o<a;o++){var s=r.morphTargets[o],c=s.name.match(n);if(c&&c.length>1){var l=c[1];i[l]||(i[l]={start:1/0,end:-1/0});var h=i[l];o<h.start&&(h.start=o),o>h.end&&(h.end=o),e||(e=l)}}for(var l in i){var h=i[l];this.createAnimation(l,h.start,h.end,t)}this.firstAnimation=e},ji.prototype.setAnimationDirectionForward=function(t){var e=this.animationsMap[t];e&&(e.direction=1,e.directionBackwards=!1)},ji.prototype.setAnimationDirectionBackward=function(t){var e=this.animationsMap[t];e&&(e.direction=-1,e.directionBackwards=!0)},ji.prototype.setAnimationFPS=function(t,e){var n=this.animationsMap[t];n&&(n.fps=e,n.duration=(n.end-n.start)/n.fps)},ji.prototype.setAnimationDuration=function(t,e){var n=this.animationsMap[t];n&&(n.duration=e,n.fps=(n.end-n.start)/n.duration)},ji.prototype.setAnimationWeight=function(t,e){var n=this.animationsMap[t];n&&(n.weight=e)},ji.prototype.setAnimationTime=function(t,e){var n=this.animationsMap[t];n&&(n.time=e)},ji.prototype.getAnimationTime=function(t){var e=0,n=this.animationsMap[t];return n&&(e=n.time),e},ji.prototype.getAnimationDuration=function(t){var e=-1,n=this.animationsMap[t];return n&&(e=n.duration),e},ji.prototype.playAnimation=function(t){var e=this.animationsMap[t];e?(e.time=0,e.active=!0):console.warn("THREE.MorphBlendMesh: animation["+t+"] undefined in .playAnimation()")},ji.prototype.stopAnimation=function(t){var e=this.animationsMap[t];e&&(e.active=!1)},ji.prototype.update=function(t){for(var e=0,n=this.animationsList.length;e<n;e++){var i=this.animationsList[e];if(i.active){var r=i.duration/i.length;i.time+=i.direction*t,i.mirroredLoop?(i.time>i.duration||i.time<0)&&(i.direction*=-1,i.time>i.duration&&(i.time=i.duration,i.directionBackwards=!0),i.time<0&&(i.time=0,i.directionBackwards=!1)):(i.time=i.time%i.duration,i.time<0&&(i.time+=i.duration));var o=i.start+pa.clamp(Math.floor(i.time/r),0,i.length-1),a=i.weight;o!==i.currentFrame&&(this.morphTargetInfluences[i.lastFrame]=0,this.morphTargetInfluences[i.currentFrame]=1*a,this.morphTargetInfluences[o]=0,i.lastFrame=i.currentFrame,i.currentFrame=o);var s=i.time%r/r;i.directionBackwards&&(s=1-s),i.currentFrame!==i.lastFrame?(this.morphTargetInfluences[i.currentFrame]=s*a,this.morphTargetInfluences[i.lastFrame]=(1-s)*a):this.morphTargetInfluences[i.currentFrame]=a}}},Gi.prototype=Object.create(ht.prototype),Gi.prototype.constructor=Gi,Gi.prototype.isImmediateRenderObject=!0,Hi.prototype=Object.create(be.prototype),Hi.prototype.constructor=Hi,Hi.prototype.update=function(){var t=new h,e=new h,n=new it;return function(){var i=["a","b","c"];this.object.updateMatrixWorld(!0),n.getNormalMatrix(this.object.matrixWorld);var r=this.object.matrixWorld,o=this.geometry.attributes.position,a=this.object.geometry;if(a&&a.isGeometry)for(var s=a.vertices,c=a.faces,l=0,h=0,u=c.length;h<u;h++)for(var d=c[h],p=0,f=d.vertexNormals.length;p<f;p++){var m=s[d[i[p]]],v=d.vertexNormals[p];t.copy(m).applyMatrix4(r),e.copy(v).applyMatrix3(n).normalize().multiplyScalar(this.size).add(t),o.setXYZ(l,t.x,t.y,t.z),l+=1,o.setXYZ(l,e.x,e.y,e.z),l+=1}else if(a&&a.isBufferGeometry)for(var g=a.attributes.position,y=a.attributes.normal,l=0,p=0,f=g.count;p<f;
1p++)t.set(g.getX(p),g.getY(p),g.getZ(p)).applyMatrix4(r),e.set(y.getX(p),y.getY(p),y.getZ(p)),e.applyMatrix3(n).normalize().multiplyScalar(this.size).add(t),o.setXYZ(l,t.x,t.y,t.z),l+=1,o.setXYZ(l,e.x,e.y,e.z),l+=1;return o.needsUpdate=!0,this}}(),Vi.prototype=Object.create(ht.prototype),Vi.prototype.constructor=Vi,Vi.prototype.dispose=function(){this.cone.geometry.dispose(),this.cone.material.dispose()},Vi.prototype.update=function(){var t=new h,e=new h;return function(){var n=this.light.distance?this.light.distance:1e3,i=n*Math.tan(this.light.angle);this.cone.scale.set(i,i,n),t.setFromMatrixPosition(this.light.matrixWorld),e.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(e.sub(t)),this.cone.material.color.copy(this.light.color).multiplyScalar(this.light.intensity)}}(),Wi.prototype=Object.create(be.prototype),Wi.prototype.constructor=Wi,Wi.prototype.getBoneList=function(t){var e=[];t&&t.isBone&&e.push(t);for(var n=0;n<t.children.length;n++)e.push.apply(e,this.getBoneList(t.children[n]));return e},Wi.prototype.update=function(){var t=new h,e=new u,n=new u;return function(){var i=this.geometry,r=i.getAttribute("position");n.getInverse(this.root.matrixWorld);for(var o=0,a=0;o<this.bones.length;o++){var s=this.bones[o];s.parent&&s.parent.isBone&&(e.multiplyMatrices(n,s.matrixWorld),t.setFromMatrixPosition(e),r.setXYZ(a,t.x,t.y,t.z),e.multiplyMatrices(n,s.parent.matrixWorld),t.setFromMatrixPosition(e),r.setXYZ(a+1,t.x,t.y,t.z),a+=2)}i.getAttribute("position").needsUpdate=!0}}(),Xi.prototype=Object.create(Rt.prototype),Xi.prototype.constructor=Xi,Xi.prototype.dispose=function(){this.geometry.dispose(),this.material.dispose()},Xi.prototype.update=function(){this.material.color.copy(this.light.color).multiplyScalar(this.light.intensity)},qi.prototype=Object.create(ht.prototype),qi.prototype.constructor=qi,qi.prototype.dispose=function(){this.children[0].geometry.dispose(),this.children[0].material.dispose(),this.children[1].geometry.dispose(),this.children[1].material.dispose()},qi.prototype.update=function(){var t=new h,e=new h;return function(){var n=this.children[0],i=this.children[1];if(this.light.target){t.setFromMatrixPosition(this.light.matrixWorld),e.setFromMatrixPosition(this.light.target.matrixWorld);var r=e.clone().sub(t);n.lookAt(r),i.lookAt(r)}n.material.color.copy(this.light.color).multiplyScalar(this.light.intensity),i.material.color.copy(this.light.color).multiplyScalar(this.light.intensity);var o=.5*this.light.width,a=.5*this.light.height,s=n.geometry.getAttribute("position"),c=s.array;c[0]=o,c[1]=-a,c[2]=0,c[3]=o,c[4]=a,c[5]=0,c[6]=-o,c[7]=a,c[8]=0,c[9]=-o,c[10]=a,c[11]=0,c[12]=-o,c[13]=-a,c[14]=0,c[15]=o,c[16]=-a,c[17]=0,s.needsUpdate=!0}}(),Yi.prototype=Object.create(ht.prototype),Yi.prototype.constructor=Yi,Yi.prototype.dispose=function(){this.children[0].geometry.dispose(),this.children[0].material.dispose()},Yi.prototype.update=function(){var t=new h,e=new q,n=new q;return function(){var i=this.children[0],r=i.geometry.getAttribute("color");e.copy(this.light.color).multiplyScalar(this.light.intensity),n.copy(this.light.groundColor).multiplyScalar(this.light.intensity);for(var o=0,a=r.count;o<a;o++){var s=o<a/2?e:n;r.setXYZ(o,s.r,s.g,s.b)}i.lookAt(t.setFromMatrixPosition(this.light.matrixWorld).negate()),r.needsUpdate=!0}}(),Zi.prototype=Object.create(be.prototype),Zi.prototype.constructor=Zi,Ji.prototype=Object.create(be.prototype),Ji.prototype.constructor=Ji,Qi.prototype=Object.create(be.prototype),Qi.prototype.constructor=Qi,Qi.prototype.update=function(){var t=new h,e=new h,n=new it;return function(){this.object.updateMatrixWorld(!0),n.getNormalMatrix(this.object.matrixWorld);for(var i=this.object.matrixWorld,r=this.geometry.attributes.position,o=this.object.geometry,a=o.vertices,s=o.faces,c=0,l=0,h=s.length;l<h;l++){var u=s[l],d=u.normal;t.copy(a[u.a]).add(a[u.b]).add(a[u.c]).divideScalar(3).applyMatrix4(i),e.copy(d).applyMatrix3(n).normalize().multiplyScalar(this.size).add(t),r.setXYZ(c,t.x,t.y,t.z),c+=1,r.setXYZ(c,e.x,e.y,e.z),c+=1}return r.needsUpdate=!0,this}}(),Ki.prototype=Object.create(ht.prototype),Ki.prototype.constructor=Ki,Ki.prototype.dispose=function(){var t=this.children[0],e=this.children[1];t.geometry.dispose(),t.material.dispose(),e.geometry.dispose(),e.material.dispose()},Ki.prototype.update=function(){var t=new h,e=new h,n=new h;return function(){t.setFromMatrixPosition(this.light.matrixWorld),e.setFromMatrixPosition(this.light.target.matrixWorld),n.subVectors(e,t);var i=this.children[0],r=this.children[1];i.lookAt(n),i.material.color.copy(this.light.color).multiplyScalar(this.light.intensity),r.lookAt(n),r.scale.z
1=n.length()}}(),$i.prototype=Object.create(be.prototype),$i.prototype.constructor=$i,$i.prototype.update=function(){function t(t,o,a,s){i.set(o,a,s).unproject(r);var c=n[t];if(void 0!==c)for(var l=e.getAttribute("position"),h=0,u=c.length;h<u;h++)l.setXYZ(c[h],i.x,i.y,i.z)}var e,n,i=new h,r=new Ot;return function(){e=this.geometry,n=this.pointMap;r.projectionMatrix.copy(this.camera.projectionMatrix),t("c",0,0,-1),t("t",0,0,1),t("n1",-1,-1,-1),t("n2",1,-1,-1),t("n3",-1,1,-1),t("n4",1,1,-1),t("f1",-1,-1,1),t("f2",1,-1,1),t("f3",-1,1,1),t("f4",1,1,1),t("u1",.7,1.1,-1),t("u2",-.7,1.1,-1),t("u3",0,2,-1),t("cf1",-1,0,1),t("cf2",1,0,1),t("cf3",0,-1,1),t("cf4",0,1,1),t("cn1",-1,0,-1),t("cn2",1,0,-1),t("cn3",0,-1,-1),t("cn4",0,1,-1),e.getAttribute("position").needsUpdate=!0}}(),tr.prototype=Object.create(be.prototype),tr.prototype.constructor=tr,tr.prototype.update=function(){var t=new et;return function(e){if(e&&e.isBox3?t.copy(e):t.setFromObject(e),!t.isEmpty()){var n=t.min,i=t.max,r=this.geometry.attributes.position,o=r.array;o[0]=i.x,o[1]=i.y,o[2]=i.z,o[3]=n.x,o[4]=i.y,o[5]=i.z,o[6]=n.x,o[7]=n.y,o[8]=i.z,o[9]=i.x,o[10]=n.y,o[11]=i.z,o[12]=i.x,o[13]=i.y,o[14]=n.z,o[15]=n.x,o[16]=i.y,o[17]=n.z,o[18]=n.x,o[19]=n.y,o[20]=n.z,o[21]=i.x,o[22]=n.y,o[23]=n.z,r.needsUpdate=!0,this.geometry.computeBoundingSphere()}}}();var ka=new Lt;ka.addAttribute("position",new Mt([0,0,0,0,1,0],3));var ja=new an(0,.5,1,5,1);ja.translate(0,-.5,0),er.prototype=Object.create(ht.prototype),er.prototype.constructor=er,er.prototype.setDirection=function(){var t,e=new h;return function(n){n.y>.99999?this.quaternion.set(0,0,0,1):n.y<-.99999?this.quaternion.set(1,0,0,0):(e.set(n.z,0,-n.x).normalize(),t=Math.acos(n.y),this.quaternion.setFromAxisAngle(e,t))}}(),er.prototype.setLength=function(t,e,n){void 0===e&&(e=.2*t),void 0===n&&(n=.2*e),this.line.scale.set(1,Math.max(0,t-e),1),this.line.updateMatrix(),this.cone.scale.set(n,e,n),this.cone.position.y=t,this.cone.updateMatrix()},er.prototype.setColor=function(t){this.line.material.color.copy(t),this.cone.material.color.copy(t)},nr.prototype=Object.create(be.prototype),nr.prototype.constructor=nr;var Ga=function(){function t(){}var e=new h,n=new t,i=new t,r=new t;return t.prototype.init=function(t,e,n,i){this.c0=t,this.c1=n,this.c2=-3*t+3*e-2*n-i,this.c3=2*t-2*e+n+i},t.prototype.initNonuniformCatmullRom=function(t,e,n,i,r,o,a){var s=(e-t)/r-(n-t)/(r+o)+(n-e)/o,c=(n-e)/o-(i-e)/(o+a)+(i-n)/a;s*=o,c*=o,this.init(e,n,s,c)},t.prototype.initCatmullRom=function(t,e,n,i,r){this.init(e,n,r*(n-t),r*(i-e))},t.prototype.calc=function(t){var e=t*t,n=e*t;return this.c0+this.c1*t+this.c2*e+this.c3*n},ri.create(function(t){this.points=t||[],this.closed=!1},function(t){var o,a,s,c,l=this.points;c=l.length,c<2&&console.log("duh, you need at least 2 points"),o=(c-(this.closed?0:1))*t,a=Math.floor(o),s=o-a,this.closed?a+=a>0?0:(Math.floor(Math.abs(a)/l.length)+1)*l.length:0===s&&a===c-1&&(a=c-2,s=1);var u,d,p,f;if(this.closed||a>0?u=l[(a-1)%c]:(e.subVectors(l[0],l[1]).add(l[0]),u=e),d=l[a%c],p=l[(a+1)%c],this.closed||a+2<c?f=l[(a+2)%c]:(e.subVectors(l[c-1],l[c-2]).add(l[c-1]),f=e),void 0===this.type||"centripetal"===this.type||"chordal"===this.type){var m="chordal"===this.type?.5:.25,v=Math.pow(u.distanceToSquared(d),m),g=Math.pow(d.distanceToSquared(p),m),y=Math.pow(p.distanceToSquared(f),m);g<1e-4&&(g=1),v<1e-4&&(v=g),y<1e-4&&(y=g),n.initNonuniformCatmullRom(u.x,d.x,p.x,f.x,v,g,y),i.initNonuniformCatmullRom(u.y,d.y,p.y,f.y,v,g,y),r.initNonuniformCatmullRom(u.z,d.z,p.z,f.z,v,g,y)}else if("catmullrom"===this.type){var _=void 0!==this.tension?this.tension:.5;n.initCatmullRom(u.x,d.x,p.x,f.x,_),i.initCatmullRom(u.y,d.y,p.y,f.y,_),r.initCatmullRom(u.z,d.z,p.z,f.z,_)}return new h(n.calc(s),i.calc(s),r.calc(s))})}();ri.create(function(t){console.warn("THREE.SplineCurve3 will be deprecated. Please use THREE.CatmullRomCurve3"),this.points=void 0===t?[]:t},function(t){var e=this.points,n=(e.length-1)*t,i=Math.floor(n),r=n-i,o=e[0==i?i:i-1],a=e[i],s=e[i>e.length-2?e.length-1:i+1],c=e[i>e.length-3?e.length-1:i+2],l=Da.interpolate;return new h(l(o.x,a.x,s.x,c.x,r),l(o.y,a.y,s.y,c.y,r),l(o.z,a.z,s.z,c.z,r))}),ri.create(function(t,e,n,i){this.v0=t,this.v1=e,this.v2=n,this.v3=i},function(t){var e=Ra.b3;return new h(e(t,this.v0.x,this.v1.x,this.v2.x,this.v3.x),e(t,this.v0.y,this.v1.y,this.v2.y,this.v3.y),e(t,this.v0.z,this.v1.z,this.v2.z,this.v3.z))}),ri.create(function(t,e,n){this.v0=t,this.v1=e,this.v2=n},function(t){var e=Ra.b2;return new h(e(t,this.v0.x,this.v1.x,this.v2.x),e(t,this.v0.y,this.v1.y,this.v2.y),e(t,this.v0.z,this.v1.z,this.v2.z))}),ri.create(function(t,e){this.v1=t,this.v2=e},function(t){if(1===t)return this.v2.clone();var e=new h;return e.subVectors(this.v2,this.v1),e.multiplyScalar(t),e.add(this.v1),e});ir.prototype=Object.create(si.prototype),ir.prototype.constructor=ir;rr.prototype=Object.create(Ga.prototype),Zi.prototype.setColors=function(){console.error("THREE.GridHelper: setColors() has been deprecated, pass them in the constructor instead.")},Object.assign(Z.prototype,{center:function(t){return console.warn("THREE.Box2: .center() has been renamed to .getCenter()."),this.getCenter(t)},empty:function(){return console.warn("THREE.Box2: .empty() has been renamed to .isEmpty()."),this.isEmpty()},isIntersectionBox:function(t){return console.warn("THREE.Box2: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(t)},size:function(t){return console.warn("THREE.Box2: .size() has been renamed to .getSize()."),this.get
1Size(t)}}),Object.assign(et.prototype,{center:function(t){return console.warn("THREE.Box3: .center() has been renamed to .getCenter()."),this.getCenter(t)},empty:function(){return console.warn("THREE.Box3: .empty() has been renamed to .isEmpty()."),this.isEmpty()},isIntersectionBox:function(t){return console.warn("THREE.Box3: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(t)},isIntersectionSphere:function(t){return console.warn("THREE.Box3: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(t)},size:function(t){return console.warn("THREE.Box3: .size() has been renamed to .getSize()."),this.getSize(t)}}),ut.prototype.center=function(t){return console.warn("THREE.Line3: .center() has been renamed to .getCenter()."),this.getCenter(t)},pa.random16=function(){return console.warn("THREE.Math.random16() has been deprecated. Use Math.random() instead."),Math.random()},Object.assign(it.prototype,{flattenToArrayOffset:function(t,e){return console.warn("THREE.Matrix3: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(t,e)},multiplyVector3:function(t){return console.warn("THREE.Matrix3: .multiplyVector3(
1) has been removed. Use vector.applyMatrix3( matrix ) instead."),t.applyMatrix3(this)},multiplyVector3Array:function(t){return console.warn("THREE.Matrix3: .multiplyVector3Array() has been renamed. Use matrix.applyToVector3Array( array ) instead."),this.applyToVector3Array(t)},applyToBuffer:function(t,e,n){return console.warn("THREE.Matrix3: .applyToBuffer() has been removed. Use matrix.applyToBufferAttribute( attribute ) instead."),this.applyToBufferAttribute(t)}}),Object.assign(u.prototype,{extractPosition:function(t){return console.warn("THREE.Matrix4: .extractPosition() has been renamed to .copyPosition()."),this.copyPosition(t)},flattenToArrayOffset:function(t,e){return console.warn("THREE.Matrix4: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(t,e)},getPosition:function(){var t;return function(){return void 0===t&&(t=new h),console.warn("THREE.Matrix4: .getPosition() has been removed. Use Vector3.setFromMatrixPosition( matrix ) instead."),t.setFromMatrixColumn(this,3)}}(),setRotationFromQuaternion:function(t){return console.warn("THREE.Matrix4: .setRotationFromQuaternion() has been renamed to .makeRotationFromQuaternion()."),this.makeRotationFromQuaternion(t)},multiplyVector3:function(t){return console.warn("THREE.Matrix4: .multiplyVector3(
1) has been removed. Use vector.applyMatrix4( matrix ) or vector.applyProjection( matrix ) instead."),t.applyProjection(this)},multiplyVector4:function(t){return console.warn("THREE.Matrix4: .multiplyVector4() has been removed. Use vector.applyMatrix4( matrix ) instead."),t.applyMatrix4(this)},multiplyVector3Array:function(t){return console.warn("THREE.Matrix4: .multiplyVector3Array() has been renamed. Use matrix.applyToVector3Array( array ) instead."),this.applyToVector3Array(t)},rotateAxis:function(t){console.warn("THREE.Matrix4: .rotateAxis() has been removed. Use Vector3.transformDirection( matrix ) instead."),t.transformDirection(this)},crossVector:function(t){return console.warn("THREE.Matrix4: .crossVector() has been removed. Use vector.applyMatrix4( matrix ) instead."),t.applyMatrix4(this)},translate:function(){console.error("THREE.Matrix4: .translate() has been removed.")},rotateX:function(){console.error("THREE.Matrix4: .rotateX() has been removed.")},rotateY:function(){console.error("THREE.Matrix4: .rotateY() has been removed.")},rotateZ:function(){console.error("THREE.Matrix4: .rotateZ() has been removed.")},rotateByAxis:function(){console.error("THREE.Matrix4: .rotateByAxis() has been removed.")},applyToBuffer:function(t,e,n){return console.warn("THREE.Matrix4: .applyToBuffer() has been removed. Use matrix.applyToBufferAttribute( attribute ) instead."),this.applyToBufferAttribute(t)}}),rt.prototype.isIntersectionLine=function(t){return console.warn("THREE.Plane: .isIntersectionLine() has been renamed to .intersectsLine()."),this.intersectsLine(t)},l.prototype.multiplyVector3=function(t){return console.warn("THREE.Quaternion: .multiplyVector3(
1) has been removed. Use is now vector.applyQuaternion( quaternion ) instead."),t.applyQuaternion(this)},Object.assign(st.prototype,{isIntersectionBox:function(t){return console.warn("THREE.Ray: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(t)},isIntersectionPlane:function(t){return console.warn("THREE.Ray: .isIntersectionPlane() has been renamed to .intersectsPlane()."),this.intersectsPlane(t)},isIntersectionSphere:function(t){return console.warn("THREE.Ray: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(t)}}),Object.assign(ui.prototype,{extrude:function(t){return console.warn("THREE.Shape: .extrude() has been removed. Use ExtrudeGeometry() instead."),new qe(this,t)},makeGeometry:function(t){return console.warn("THREE.Shape: .makeGeometry() has been removed. Use ShapeGeometry() instead."),new rn(this,t)}}),Object.assign(h.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(t){return console.warn("THREE.Vector3: .getPositionFromMatrix() has been renamed to .setFromMatrixPosition()."),this.setFromMatrixPosition(t)},getScaleFromMatrix:function(t){return console.warn("THREE.Vector3: .getScaleFromMatrix() has been renamed to .setFromMatrixScale()."),this.setFromMatrixScale(t)},getColumnFromMatrix:function(t,e){return console.warn("THREE.Vector3: .getColumnFromMatrix() has been renamed to .setFromMatrixColumn()."),this.setFromMatrixColumn(e,t)}}),St.prototype.computeTangents=function(){console.warn("THREE.Geometry: .computeTangents() has been removed.")},Object.assign(ht.prototype,{getChildByName:function(t){return console.warn("THREE.Object3D: .getChildByName() has been renamed to .getObjectByName()."),this.getObjectByName(t)},renderDepth:function(){console.warn("THREE.Object3D: .renderDepth has been removed. Use .renderOrder, instead.")},translate:function(t,e){return console.warn("THREE.Object3D: .translate() has been removed. Use .translateOnAxis( axis, distance ) instead."),this.translateOnAxis(e,t)}}),Object.defineProperties(ht.prototype,{eulerOrder:{get:function(){return console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order},set:function(t){console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order=t}},useQuaternion:{get:function(){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")},set:function(){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")}}}),Object.defineProperties(fe.prototype,{objects:{get:function(){return console.warn("THREE.LOD: .objects has been renamed to .levels."),this.levels}}}),It.prototype.setLens=function(t,e){console.warn("THREE.PerspectiveCamera.setLens is deprecated. Use .setFocalLength and .filmGauge for a photographic setup."),void 0!==e&&(this.filmGauge=e),this.setFocalLength(t)},Object.defineProperties(Cn.prototype,{onlyShadow:{set:function(){console.warn("THREE.Light: .onlyShadow has been removed.")}},shadowCameraFov:{set:function(t){console.warn("THREE.Light: .shadowCameraFov is now .shadow.camera.fov."),this.shadow.camera.fov=t}},shadowCameraLeft:{set:function(t){console.warn("THREE.Light: .shadowCameraLeft is now .shadow.camera.left."),this.shadow.camera.left=t}},shadowCameraRight:{set:function(t){console.warn("THREE.Light: .shadowCameraRight is now .shadow.camera.right."),this.shadow.camera.right=t}},shadowCameraTop:{set:function(t){console.warn("THREE.Light: .shadowCameraTop is now .shadow.camera.top."),this.shadow.camera.top=t}},shadowCameraBottom:{set:function(t){console.warn("THREE.Light: .shadowCameraBottom is now .shadow.camera.bottom."),this.shadow.camera.bottom=t}},shadowCameraNear:{set:function(t){console.warn("THREE.Light: .shadowCameraNear is now .shadow.camera.near."),this.shadow.camera.near=t}},shadowCameraFar:{set:function(t){console.warn("THREE.Light: .shadowCameraFar is now .shadow.camera.far."),this.shadow.camera.far=t}},shadowCameraVisible:{set:function(){console.warn("THREE.Light: .shadowCameraVisible has been removed. Use new THREE.C
1ameraHelper( light.shadow.camera ) instead.")}},shadowBias:{set:function(t){console.warn("THREE.Light: .shadowBias is now .shadow.bias."),this.shadow.bias=t}},shadowDarkness:{set:function(){console.warn("THREE.Light: .shadowDarkness has been removed.")}},shadowMapWidth:{set:function(t){console.warn("THREE.Light: .shadowMapWidth is now .shadow.mapSize.width."),this.shadow.mapSize.width=t}},shadowMapHeight:{set:function(t){console.warn("THREE.Light: .shadowMapHeight is now .shadow.mapSize.height."),this.shadow.mapSize.height=t}}}),Object.defineProperties(mt.prototype,{length:{get:function(){return console.warn("THREE.BufferAttribute: .length has been deprecated. Use .count instead."),this.array.length}}}),Object.assign(Lt.prototype,{addIndex:function(t){console.warn("THREE.BufferGeometry: .addIndex() has been renamed to .setIndex()."),this.setIndex(t)},addDrawCall:function(t,e,n){void 0!==n&&console.warn("THREE.BufferGeometry: .addDrawCall() no longer supports indexOffset."),console.warn("THREE.BufferGeometry: .addDrawCall() is now .addGroup()."),this.addGroup(t,e)},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(Lt.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(Ri.prototype,{dynamic:{set:function(){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.defineProperties(K.prototype,{wrapAround:{get:function(){console.warn("THREE."+this.type+": .wrapAround has been removed.")}
1,set:function(){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(yn.prototype,{metal:{get:function(){return console.warn("THREE.MeshPhongMaterial: .metal has been removed. Use THREE.MeshStandardMaterial instead."),!1},set:function(){console.warn("THREE.MeshPhongMaterial: .metal has been removed. Use THREE.MeshStandardMaterial instead")}}}),Object.defineProperties($.prototype,{derivatives:{get:function(){return console.warn("THREE.ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives},set:function(t){console.warn("THREE. ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives=t}}}),i.prototype=Object.assign(Object.create({constructor:i,apply:function(t){console.warn("THREE.EventDispatcher: .apply is deprecated, just inherit or Object.assign the prototype to mix-in."),Object.assign(t,this)}}),i.prototype),Object.assign(se.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 console.warn("THREE.WebGLRenderer: .supportsVertexTextures() is now .capabilities.vertexTextures."),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(t){console.warn("THREE.WebGLRenderer: .enableScissorTest() is now .setScissorTest()."),this.setScissorTest(t)},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(se.prototype,{shadowMapEnabled:{get:function(){return this.shadowMap.enabled},set:function(t){console.warn("THREE.WebGLRenderer: .shadowMapEnabled is now .shadowMap.enabled."),this.shadowMap.enabled=t}},shadowMapType:{get:function(){return this.shadowMap.type},set:function(t){console.warn("THREE.WebGLRenderer: .shadowMapType is now .shadowMap.type."),this.shadowMap.type=t}},shadowMapCullFace:{get:function(){return this.shadowMap.cullFace},set:function(t){console.warn("THREE.WebGLRenderer: .shadowMapCullFace is now .shadowMap.cullFace."),this.shadowMap.cullFace=t}}}),Object.defineProperties(at.prototype,{cullFace:{get:function(){return this.renderReverseSided?cr:sr},set:function(t){var e=t!==sr;console.warn("WebGLRenderer: .shadowMap.cullFace is deprecated. Set .shadowMap.renderReverseSided to "+e+"."),this.renderReverseSided=e}}}),Object.defineProperties(s.prototype,{wrapS:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS},set:function(t){console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS=t}},wrapT:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT},set:function(t){console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT=t}},magFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter},set:function(t){console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter=t}},minFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter},set:function(t){console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter=t}},anisotropy:{get:function(){return console.warn("THREE.WebGLRenderTarget: .anisotropy 
1is now .texture.anisotropy."),this.texture.anisotropy},set:function(t){console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy=t}},offset:{get:function(){return console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset},set:function(t){console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset=t}},repeat:{get:function(){return console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat},set:function(t){console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat=t}},format:{get:function(){return console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format},set:function(t){console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format=t}},type:{get:function(){return console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type},set:function(t){console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type=t}},generateMipmaps:{get:function(){return console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps},set:function(t){console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps=t}}}),xi.prototype.load=function(t){console.warn("THREE.Audio: .load has been deprecated. Use THREE.AudioLoader instead.");var e=this;return(new vi).load(t,function(t){e.setBuffer(t)}),this},Mi.prototype.getData=function(){return console.warn("THREE.AudioAnalyser: .getData() is now .getFrequencyData()."),this.getFrequencyData()}},function(t,e,n){"use strict";var i=n(0),r=function t(){var e=new i.d(document.querySelector("#root"),i.d.CANVAS);e.autoClear=!1,e.settings={demo:{value:"paint",editable:!1,sticky:!0}};var n=e.context,r=["hsl(175, 100%, 45%)","hsl(185, 69%, 63%)","hsl(39, 100%, 54%)","hsl(333, 100%, 68%)","hsl(84, 100%, 68%)","hsl(270, 100%, 80%)"],o=0;e.loop=function(){o=2+Math.abs(20*Math.sin(.05*e.time))},e.move=function(){e.input.touches.forEach(function(t,e){n.lineCap="round",n.lineJoin="round",n.fillStyle=n.strokeStyle=r[e%r.length],n.lineWidth=t.force?50*t.force:o,n.beginPath(),t.previousX&&t.previousY&&n.moveTo(t.previousX,t.previousY),n.lineTo(t.x,t.y),n.stroke()})},e.start(),e.reset=function(){window.history.replaceState({},null,e._getPathFromUrl()+"?demo="+e.settings.demo),window.location.reload()},t.prototype.sandpit=e,document.querySelector(".overlay").style.color="#000",document.querySelector("body").style.background="#fff"};e.a=r},function(t,e,n){"use strict";var i=n(0),r=function t(){var e=new i.d(document.querySelector("#root"),i.d.WEBGL),n=e.canvas,r=e.context;e.autoClear=!1,e.settings={demo:{value:"webgl",editable:!1,sticky:!0}};var o=r.createShader(r.VERTEX_SHADER);r.shaderSource(o,"\n    attribute vec2 aVertexPosition;\n\n    void main() {\n      gl_Position = vec4(aVertexPosition, 0.0, 1.0);\n    }\n  "),r.compileShader(o);var a=r.createShader(r.FRAGMENT_SHADER);r.shaderSource(a,"\n    #ifdef GL_ES\n      precision highp float;\n    #endif\n\n    uniform vec4 uColor;\n\n    void main() {\n      gl_FragColor = uColor;\n    }\n  "),r.compileShader(a);var s=r.createProgram();r.attachShader(s,o),r.attachShader(s,a),r.linkProgram(s);var c=r.createBuffer();r.bindBuffer(r.ARRAY_BUFFER,c),r.useProgram(s),e.setup=function(){var t=["hsl(175, 100%, 45%)","hsl(185, 69%, 63%)","hsl(39, 100%, 54%)","hsl(333, 100%, 68%)","hsl(84, 100%, 68%)","hsl(270, 100%, 80%)"],e=Object(i.a)(i.b.randomFrom(t)).rgb().object();r.clearColor(e.r/255,e.g/255,e.b/255,1),r.enable(r.DEPTH_TEST),r.depthFunc(r.LEQUAL)},e.loop=function(){r.clear(r.COLOR_BUFFER_BIT|r.DEPTH_BUFFER_BIT);var t=n.width/n.height,e=new window.Float32Array([-.25,.5*t,.5,.5*t,.5,-.5*t,-.25,.5*t,.5,-.5*t,-.5,-.5*t]);r.bufferData(r.ARRAY_BUFFER,e,r.STATIC_DRAW),s.uColor=r.getUniformLocation(s,"uColor"),r.uniform4fv(s.uColor,[1,1,1,1]),s.aVertexPosition=r.getAttribLocation(s,"aVertexPosition"),r.enableVertexAttribArray(s.aVertexPosition),r.vertexAttribPointer(s.aVertexPosition,2,r.FLOAT,!1,0,0),r.drawArrays(r.TRIANGLES,0,e.length/2)},e.start(),e.reset=function(){window.history.replaceState({},null,e._getPathFromUrl()+"?demo="+e.settings.demo),window.location.reload()},t.prototype.sandpit=e,document.querySelector(".overlay").style.color="#000",document.querySelector("body").style.background="#fff"};e.a=r},function(t,e,n){"use strict";var i=n(0),r=function t(){var e=new i.d(document.querySelector("#root"),i.d.CANVAS),n={white:"hsl(0, 100%, 100%)",aqua:"hsl(175, 100%, 45%)",blue:"hsl(185, 69%, 63%)",orange:"hsl(39, 100%, 54%)",pink:"hsl(333, 100%, 68%)",green:"hsl(84, 100%, 68%)",violet:"hsl(270, 100%, 80%)"},r=Math.floor(Math.random()*Object.keys(n).length),o=n[Object.keys(n)[r]],a=!0;e.autoClear=!1,e.settings={demo:{value:"data",editable:!1,sticky:!0},clear:!1,reset:!1};var s=e.context;e.setup=function(){e.get("https://randomuser.me/api/").then(function(t){a=!1,t=JSON.parse(t).results[0];var n=[t.name.first,t.name.last].map(function(t){return t.charAt(0).toUpperCase()+t.slice(1)}).join(" ");e.fill(o),s.fillStyle="#000",s.textAlign="center",s.font="48px sans-serif",s.fillText(n,e.width/2,e.height/2+50),s.font="16px sans-serif",s.fillText("RANDOM NAME GENERATOR".split("").join(String.fromCharCode(8202)),e.width/2,e.height/2)})},e.loop=function(){a&&(s.beginPath(),s.arc(e.width/2+15*Math.sin(e.time/Math.PI)-1,e.height/2+25+15*Math.cos(e.time/Math.PI)-1,2,0,2*Math.PI),s.fillStyle="#000",s.fill(),s.fillStyle=Object(i.a)(o).alph
1a(.25).toString(),s.fillRect(0,0,e.width,e.height))},e.start(),e.reset=function(){window.history.replaceState({},null,e._getPathFromUrl()+"?demo="+e.settings.demo),window.location.reload()},t.prototype.sandpit=e,document.querySelector(".overlay").style.color="#000",document.querySelector("body").style.background="#fff"};e.a=r},function(t,e,n){"use strict";var i=n(0),r=function t(){var e=new i.d(document.querySelector("#root"),i.d.CANVAS);e.settings={demo:{value:"generative",editable:!1,sticky:!0}};var n=e.context;n.shadowBlur=5,n.shadowColor="rgba(255, 0, 0, 0.5)",n.strokeStyle="rgba(255, 0, 0, 0.1)";var r=Math.random()*e.width,o=Math.random()*e.height,a=i.b.randomFrom([[0,0],[e.width,0],[e.width,e.height],[0,e.height]]);e.loop=function(){var t=e.height/500;Array.from({length:t}).forEach(function(i,s){n.beginPath(),n.moveTo(a[0],a[1]),n.quadraticCurveTo(r,o-e.time,e.width-e.time,e.height/t*s+5e3*Math.sin((e.time+5*s)/1e3)),n.bezierCurveTo(0,0,e.width-e.time,e.height/2,a[0],a[1]-e.time),n.stroke()})},e.start(),e.reset=function(){window.history.replaceState({},null,e._getPathFromUrl()+"?demo="+e.settings.demo),window.location.reload()},t.prototype.sandpit=e,document.querySelector(".overlay").style.color="#000",document.querySelector("body").style.background="#fff"};e.a=r},function(t,e,n){"use strict";var i=n(0),r=function t(){function e(t,e){var r={x:t,y:e},o=[],a=i.b.TWO_PI/5;this.initializeCircles=function(){for(var t=0;t<5;t++)o.push(new n(r.x,r.y+Math.random(),100,t*a))},this.update=function(){for(var t=0;t<5;t++)o[t].update()},this.render=function(){for(var t=0;t<5;t++)o[t].render()}}function n(t,e,n,o){var s={x:t,y:e},c={x:t,y:e},l=10,h=t+e;this.update=function(){c.x=s.x+Math.cos(o)*(Math.sin(h+o)*n+r.settings.baseRadius),c.y=s.y+Math.sin(o)*(Math.sin(h+o)*r.settings.baseRadius),l=8*Math.cos(h)+10,h+=.01},this.render=function(){a.fillStyle="hsl("+100*Math.sin(s.x)+", 100%, "+4*l+"%)",a.beginPath(),a.arc(c.x,c.y,l,0,i.b.TWO_PI),a.fill()}}var r=new i.d(document.querySelector("#root"),i.d.CANVAS);r.settings={baseRadius:{value:5,min:5,max:100,step:5},demo:{value:"dots",editable:!1,sticky:!0}};var o=[],a=r.context,s=function(){for(var t=0;t<r.width;t+=100)for(var n=0;n<r.height;n+=r.height/10){var i=new e(t,n);i.initializeCircles(),o.push(i)}},c=function(){for(var t=0;t<o.length;t++)o[t].update()},l=function(){r.clear();for(var t=0;t<o.length;t++)o[t].render()};r.resize=function(){r.resizeCanvas(),o=[],s()},r.loop=function(){c(),l()},s(),r.start(),r.reset=function(){window.history.replaceState({},null,r._getPathFromUrl()+"?demo="+r.settings.demo),window.location.reload()},t.prototype.sandpit=r,document.querySelector(".overlay").style.color="#fff",document.querySelector("body").style.background="#000"};e.a=r}]);
2//# sourceMappingURL=main.d6114586.js.map

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.