@anov/3d 0.0.2 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/core/scene.d.ts +2 -2
- package/dist/core/scene.js +6 -6
- package/dist/export.d.ts +2 -3
- package/dist/export.js +2 -3
- package/lib/3d.min.js +1 -1
- package/package.json +1 -1
package/lib/3d.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var n=t();for(var r in n)("object"==typeof exports?exports:e)[r]=n[r]}}(self,(function(){return function(){var e={847:function(e){e.exports=function(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r},e.exports.__esModule=!0,e.exports.default=e.exports},580:function(e){e.exports=function(e){if(Array.isArray(e))return e},e.exports.__esModule=!0,e.exports.default=e.exports},917:function(e,t,n){var r=n(847);e.exports=function(e){if(Array.isArray(e))return r(e)},e.exports.__esModule=!0,e.exports.default=e.exports},808:function(e){e.exports=function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e},e.exports.__esModule=!0,e.exports.default=e.exports},955:function(e){function t(e,t,n,r,i,a,o){try{var s=e[a](o),u=s.value}catch(e){return void n(e)}s.done?t(u):Promise.resolve(u).then(r,i)}e.exports=function(e){return function(){var n=this,r=arguments;return new Promise((function(i,a){var o=e.apply(n,r);function s(e){t(o,i,a,s,u,"next",e)}function u(e){t(o,i,a,s,u,"throw",e)}s(void 0)}))}},e.exports.__esModule=!0,e.exports.default=e.exports},571:function(e){e.exports=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},e.exports.__esModule=!0,e.exports.default=e.exports},629:function(e,t,n){var r=n(175),i=n(663);function a(t,n,o){return i()?(e.exports=a=Reflect.construct.bind(),e.exports.__esModule=!0,e.exports.default=e.exports):(e.exports=a=function(e,t,n){var i=[null];i.push.apply(i,t);var a=new(Function.bind.apply(e,i));return n&&r(a,n.prototype),a},e.exports.__esModule=!0,e.exports.default=e.exports),a.apply(null,arguments)}e.exports=a,e.exports.__esModule=!0,e.exports.default=e.exports},159:function(e,t,n){var r=n(718);function i(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,r(i.key),i)}}e.exports=function(e,t,n){return t&&i(e.prototype,t),n&&i(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e},e.exports.__esModule=!0,e.exports.default=e.exports},66:function(e,t,n){var r=n(455);e.exports=function(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=r(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var i=0,a=function(){};return{s:a,n:function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}},e:function(e){throw e},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,s=!0,u=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return s=e.done,e},e:function(e){u=!0,o=e},f:function(){try{s||null==n.return||n.return()}finally{if(u)throw o}}}},e.exports.__esModule=!0,e.exports.default=e.exports},230:function(e,t,n){var r=n(641),i=n(663),a=n(675);e.exports=function(e){var t=i();return function(){var n,i=r(e);if(t){var o=r(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return a(this,n)}},e.exports.__esModule=!0,e.exports.default=e.exports},739:function(e,t,n){var r=n(718);e.exports=function(e,t,n){return(t=r(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e},e.exports.__esModule=!0,e.exports.default=e.exports},266:function(e,t,n){var r=n(683);function i(){return"undefined"!=typeof Reflect&&Reflect.get?(e.exports=i=Reflect.get.bind(),e.exports.__esModule=!0,e.exports.default=e.exports):(e.exports=i=function(e,t,n){var i=r(e,t);if(i){var a=Object.getOwnPropertyDescriptor(i,t);return a.get?a.get.call(arguments.length<3?e:n):a.value}},e.exports.__esModule=!0,e.exports.default=e.exports),i.apply(this,arguments)}e.exports=i,e.exports.__esModule=!0,e.exports.default=e.exports},641:function(e){function t(n){return e.exports=t=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},e.exports.__esModule=!0,e.exports.default=e.exports,t(n)}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports},977:function(e,t,n){var r=n(175);e.exports=function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&r(e,t)},e.exports.__esModule=!0,e.exports.default=e.exports},417:function(e){e.exports=function(e){return-1!==Function.toString.call(e).indexOf("[native code]")},e.exports.__esModule=!0,e.exports.default=e.exports},663:function(e){e.exports=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}},e.exports.__esModule=!0,e.exports.default=e.exports},44:function(e){e.exports=function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)},e.exports.__esModule=!0,e.exports.default=e.exports},343:function(e){e.exports=function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,a,o,s=[],u=!0,l=!1;try{if(a=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;u=!1}else for(;!(u=(r=a.call(n)).done)&&(s.push(r.value),s.length!==t);u=!0);}catch(e){l=!0,i=e}finally{try{if(!u&&null!=n.return&&(o=n.return(),Object(o)!==o))return}finally{if(l)throw i}}return s}},e.exports.__esModule=!0,e.exports.default=e.exports},300:function(e){e.exports=function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")},e.exports.__esModule=!0,e.exports.default=e.exports},155:function(e){e.exports=function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")},e.exports.__esModule=!0,e.exports.default=e.exports},675:function(e,t,n){var r=n(444).default,i=n(808);e.exports=function(e,t){if(t&&("object"===r(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return i(e)},e.exports.__esModule=!0,e.exports.default=e.exports},391:function(e,t,n){var r=n(444).default;function i(){"use strict";e.exports=i=function(){return t},e.exports.__esModule=!0,e.exports.default=e.exports;var t={},n=Object.prototype,a=n.hasOwnProperty,o=Object.defineProperty||function(e,t,n){e[t]=n.value},s="function"==typeof Symbol?Symbol:{},u=s.iterator||"@@iterator",l=s.asyncIterator||"@@asyncIterator",c=s.toStringTag||"@@toStringTag";function h(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{h({},"")}catch(e){h=function(e,t,n){return e[t]=n}}function d(e,t,n,r){var i=t&&t.prototype instanceof v?t:v,a=Object.create(i.prototype),s=new R(r||[]);return o(a,"_invoke",{value:w(e,n,s)}),a}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=d;var p={};function v(){}function m(){}function g(){}var y={};h(y,u,(function(){return this}));var _=Object.getPrototypeOf,x=_&&_(_(k([])));x&&x!==n&&a.call(x,u)&&(y=x);var M=g.prototype=v.prototype=Object.create(y);function S(e){["next","throw","return"].forEach((function(t){h(e,t,(function(e){return this._invoke(t,e)}))}))}function b(e,t){function n(i,o,s,u){var l=f(e[i],e,o);if("throw"!==l.type){var c=l.arg,h=c.value;return h&&"object"==r(h)&&a.call(h,"__await")?t.resolve(h.__await).then((function(e){n("next",e,s,u)}),(function(e){n("throw",e,s,u)})):t.resolve(h).then((function(e){c.value=e,s(c)}),(function(e){return n("throw",e,s,u)}))}u(l.arg)}var i;o(this,"_invoke",{value:function(e,r){function a(){return new t((function(t,i){n(e,r,t,i)}))}return i=i?i.then(a,a):a()}})}function w(e,t,n){var r="suspendedStart";return function(i,a){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===i)throw a;return C()}for(n.method=i,n.arg=a;;){var o=n.delegate;if(o){var s=T(o,n);if(s){if(s===p)continue;return s}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===r)throw r="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r="executing";var u=f(e,t,n);if("normal"===u.type){if(r=n.done?"completed":"suspendedYield",u.arg===p)continue;return{value:u.arg,done:n.done}}"throw"===u.type&&(r="completed",n.method="throw",n.arg=u.arg)}}}function T(e,t){var n=t.method,r=e.iterator[n];if(void 0===r)return t.delegate=null,"throw"===n&&e.iterator.return&&(t.method="return",t.arg=void 0,T(e,t),"throw"===t.method)||"return"!==n&&(t.method="throw",t.arg=new TypeError("The iterator does not provide a '"+n+"' method")),p;var i=f(r,e.iterator,t.arg);if("throw"===i.type)return t.method="throw",t.arg=i.arg,t.delegate=null,p;var a=i.arg;return a?a.done?(t[e.resultName]=a.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,p):a:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,p)}function E(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function A(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function R(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(E,this),this.reset(!0)}function k(e){if(e){var t=e[u];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,r=function t(){for(;++n<e.length;)if(a.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=void 0,t.done=!0,t};return r.next=r}}return{next:C}}function C(){return{value:void 0,done:!0}}return m.prototype=g,o(M,"constructor",{value:g,configurable:!0}),o(g,"constructor",{value:m,configurable:!0}),m.displayName=h(g,c,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===m||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,g):(e.__proto__=g,h(e,c,"GeneratorFunction")),e.prototype=Object.create(M),e},t.awrap=function(e){return{__await:e}},S(b.prototype),h(b.prototype,l,(function(){return this})),t.AsyncIterator=b,t.async=function(e,n,r,i,a){void 0===a&&(a=Promise);var o=new b(d(e,n,r,i),a);return t.isGeneratorFunction(n)?o:o.next().then((function(e){return e.done?e.value:o.next()}))},S(M),h(M,c,"Generator"),h(M,u,(function(){return this})),h(M,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=k,R.prototype={constructor:R,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(A),!e)for(var t in this)"t"===t.charAt(0)&&a.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function n(n,r){return o.type="throw",o.arg=e,t.next=n,r&&(t.method="next",t.arg=void 0),!!r}for(var r=this.tryEntries.length-1;r>=0;--r){var i=this.tryEntries[r],o=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var s=a.call(i,"catchLoc"),u=a.call(i,"finallyLoc");if(s&&u){if(this.prev<i.catchLoc)return n(i.catchLoc,!0);if(this.prev<i.finallyLoc)return n(i.finallyLoc)}else if(s){if(this.prev<i.catchLoc)return n(i.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return n(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var r=this.tryEntries[n];if(r.tryLoc<=this.prev&&a.call(r,"finallyLoc")&&this.prev<r.finallyLoc){var i=r;break}}i&&("break"===e||"continue"===e)&&i.tryLoc<=t&&t<=i.finallyLoc&&(i=null);var o=i?i.completion:{};return o.type=e,o.arg=t,i?(this.method="next",this.next=i.finallyLoc,p):this.complete(o)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),p},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),A(n),p}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var i=r.arg;A(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:k(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=void 0),p}},t}e.exports=i,e.exports.__esModule=!0,e.exports.default=e.exports},175:function(e){function t(n,r){return e.exports=t=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},e.exports.__esModule=!0,e.exports.default=e.exports,t(n,r)}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports},143:function(e,t,n){var r=n(580),i=n(343),a=n(455),o=n(300);e.exports=function(e,t){return r(e)||i(e,t)||a(e,t)||o()},e.exports.__esModule=!0,e.exports.default=e.exports},683:function(e,t,n){var r=n(641);e.exports=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=r(e)););return e},e.exports.__esModule=!0,e.exports.default=e.exports},587:function(e,t,n){var r=n(917),i=n(44),a=n(455),o=n(155);e.exports=function(e){return r(e)||i(e)||a(e)||o()},e.exports.__esModule=!0,e.exports.default=e.exports},386:function(e,t,n){var r=n(444).default;e.exports=function(e,t){if("object"!==r(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var i=n.call(e,t||"default");if("object"!==r(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)},e.exports.__esModule=!0,e.exports.default=e.exports},718:function(e,t,n){var r=n(444).default,i=n(386);e.exports=function(e){var t=i(e,"string");return"symbol"===r(t)?t:String(t)},e.exports.__esModule=!0,e.exports.default=e.exports},444:function(e){function t(n){return e.exports=t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e.exports.__esModule=!0,e.exports.default=e.exports,t(n)}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports},455:function(e,t,n){var r=n(847);e.exports=function(e,t){if(e){if("string"==typeof e)return r(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?r(e,t):void 0}},e.exports.__esModule=!0,e.exports.default=e.exports},836:function(e,t,n){var r=n(641),i=n(175),a=n(417),o=n(629);function s(t){var n="function"==typeof Map?new Map:void 0;return e.exports=s=function(e){if(null===e||!a(e))return e;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==n){if(n.has(e))return n.get(e);n.set(e,t)}function t(){return o(e,arguments,r(this).constructor)}return t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),i(t,e)},e.exports.__esModule=!0,e.exports.default=e.exports,s(t)}e.exports=s,e.exports.__esModule=!0,e.exports.default=e.exports}},t={};function n(r){var i=t[r];if(void 0!==i)return i.exports;var a=t[r]={exports:{}};return e[r](a,a.exports,n),a.exports}n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,{a:t}),t},n.d=function(e,t){for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var r={};return function(){"use strict";n.r(r),n.d(r,{ACESFilmicToneMapping:function(){return Ae},ANOV:function(){return e},AddEquation:function(){return K},AddOperation:function(){return Se},AdditiveAnimationBlendMode:function(){return nn},AdditiveBlending:function(){return X},AlphaFormat:function(){return at},AlwaysCompare:function(){return zn},AlwaysDepth:function(){return fe},AlwaysStencilFunc:function(){return Pn},AmbientLight:function(){return af},AmbientLightProbe:function(){return Mf},AnimationAction:function(){return Kf},AnimationClip:function(){return Ad},AnimationLoader:function(){return Nd},AnimationMixer:function(){return Qf},AnimationObjectGroup:function(){return Zf},AnimationUtils:function(){return pd},ArcCurve:function(){return Cc},ArrayCamera:function(){return Qu},ArrowHelper:function(){return Vp},Audio:function(){return If},AudioAnalyser:function(){return Bf},AudioContext:function(){return yf},AudioListener:function(){return Pf},AudioLoader:function(){return _f},AxesHelper:function(){return Wp},BackSide:function(){return H},BasicDepthPacking:function(){return ln},BasicShadowMap:function(){return O},Bone:function(){return Wl},BooleanKeyframeTrack:function(){return xd},Box2:function(){return cp},Box3:function(){return Jr},Box3Helper:function(){return zp},BoxGeometry:function(){return uo},BoxHelper:function(){return Bp},BufferAttribute:function(){return wa},BufferGeometry:function(){return Ga},BufferGeometryLoader:function(){return df},ByteType:function(){return Ze},CSS2DRenderer:function(){return Tv},CSS3DRenderer:function(){return Lv},Cache:function(){return kd},Camera:function(){return vo},CameraHelper:function(){return Dp},CanvasTexture:function(){return Ac},CapsuleGeometry:function(){return Jc},CatmullRomCurve3:function(){return Oc},CineonToneMapping:function(){return Ee},CircleGeometry:function(){return Qc},ClampToEdgeWrapping:function(){return Oe},Clock:function(){return Ef},Color:function(){return pa},ColorKeyframeTrack:function(){return Md},ColorManagement:function(){return Pr},CompressedArrayTexture:function(){return Tc},CompressedCubeTexture:function(){return Ec},CompressedTexture:function(){return wc},CompressedTextureLoader:function(){return Fd},ConeGeometry:function(){return eh},CubeCamera:function(){return yo},CubeReflectionMapping:function(){return Ce},CubeRefractionMapping:function(){return Le},CubeTexture:function(){return _o},CubeTextureLoader:function(){return zd},CubeUVReflectionMapping:function(){return De},CubicBezierCurve:function(){return zc},CubicBezierCurve3:function(){return Hc},CubicInterpolant:function(){return md},CullFaceBack:function(){return I},CullFaceFront:function(){return D},CullFaceFrontBack:function(){return U},CullFaceNone:function(){return P},Curve:function(){return Rc},CurvePath:function(){return Yc},CustomBlending:function(){return Z},CustomToneMapping:function(){return Re},CylinderGeometry:function(){return $c},Cylindrical:function(){return up},DRACOLoader:function(){return Vv},Data3DTexture:function(){return Wr},DataArrayTexture:function(){return Gr},DataTexture:function(){return jl},DataTextureLoader:function(){return Hd},DataUtils:function(){return Ma},DecrementStencilOp:function(){return Mn},DecrementWrapStencilOp:function(){return bn},DefaultLoadingManager:function(){return Ld},DepthFormat:function(){return lt},DepthStencilFormat:function(){return ct},DepthTexture:function(){return nl},Direction:function(){return hv},DirectionalLight:function(){return rf},DirectionalLightHelper:function(){return Lp},DiscreteInterpolant:function(){return yd},DisplayP3ColorSpace:function(){return mn},DodecahedronGeometry:function(){return nh},DoubleSide:function(){return G},DstAlphaFactor:function(){return se},DstColorFactor:function(){return le},DynamicCopyUsage:function(){return Yn},DynamicDrawUsage:function(){return Gn},DynamicReadUsage:function(){return jn},EdgesGeometry:function(){return sh},EllipseCurve:function(){return kc},EqualCompare:function(){return Un},EqualDepth:function(){return me},EqualStencilFunc:function(){return An},EquirectangularReflectionMapping:function(){return Pe},EquirectangularRefractionMapping:function(){return Ie},Euler:function(){return Di},EventDispatcher:function(){return tr},ExtrudeGeometry:function(){return Fh},FileLoader:function(){return Od},Float16BufferAttribute:function(){return Pa},Float32BufferAttribute:function(){return Ia},Float64BufferAttribute:function(){return Da},FloatType:function(){return et},Fog:function(){return hl},FogExp2:function(){return cl},FramebufferTexture:function(){return bc},FrontSide:function(){return z},Frustum:function(){return Ao},GLBufferAttribute:function(){return rp},GLSL1:function(){return Kn},GLSL3:function(){return Jn},GLTFLoader:function(){return Xv},GreaterCompare:function(){return Nn},GreaterDepth:function(){return ye},GreaterEqualCompare:function(){return Bn},GreaterEqualDepth:function(){return ge},GreaterEqualStencilFunc:function(){return Ln},GreaterStencilFunc:function(){return kn},GridHelper:function(){return Ep},Group:function(){return Hv},HalfFloatType:function(){return tt},HemisphereLight:function(){return Wd},HemisphereLightHelper:function(){return Tp},HemisphereLightProbe:function(){return xf},IcosahedronGeometry:function(){return zh},ImageBitmapLoader:function(){return gf},ImageLoader:function(){return Bd},ImageUtils:function(){return Ir},IncrementStencilOp:function(){return xn},IncrementWrapStencilOp:function(){return Sn},InstancedBufferAttribute:function(){return Zl},InstancedBufferGeometry:function(){return hf},InstancedInterleavedBuffer:function(){return np},InstancedMesh:function(){return rc},Int16BufferAttribute:function(){return Ra},Int32BufferAttribute:function(){return Ca},Int8BufferAttribute:function(){return Ta},IntType:function(){return Qe},InterleavedBuffer:function(){return fl},InterleavedBufferAttribute:function(){return vl},Interpolant:function(){return vd},InterpolateDiscrete:function(){return Zt},InterpolateLinear:function(){return Kt},InterpolateSmooth:function(){return Jt},InvertStencilOp:function(){return wn},KeepStencilOp:function(){return yn},KeyframeTrack:function(){return _d},LOD:function(){return Il},LatheGeometry:function(){return Kc},Layers:function(){return Ui},LessCompare:function(){return Dn},LessDepth:function(){return pe},LessEqualCompare:function(){return On},LessEqualDepth:function(){return ve},LessEqualStencilFunc:function(){return Rn},LessStencilFunc:function(){return En},Light:function(){return Vd},LightProbe:function(){return uf},Line:function(){return cc},Line2:function(){return l_},Line3:function(){return fp},LineBasicMaterial:function(){return ic},LineCurve:function(){return Gc},LineCurve3:function(){return Vc},LineDashedMaterial:function(){return sd},LineGeometry:function(){return jy},LineLoop:function(){return pc},LineMaterial:function(){return Yy},LineSegments:function(){return fc},LinearEncoding:function(){return sn},LinearFilter:function(){return Ve},LinearInterpolant:function(){return gd},LinearMipMapLinearFilter:function(){return qe},LinearMipMapNearestFilter:function(){return je},LinearMipmapLinearFilter:function(){return Xe},LinearMipmapNearestFilter:function(){return We},LinearSRGBColorSpace:function(){return vn},LinearToneMapping:function(){return we},Loader:function(){return Pd},LoaderUtils:function(){return cf},LoadingManager:function(){return Cd},LoopOnce:function(){return Xt},LoopPingPong:function(){return Yt},LoopRepeat:function(){return qt},LuminanceAlphaFormat:function(){return ut},LuminanceFormat:function(){return st},MOUSE:function(){return C},Material:function(){return la},MaterialLoader:function(){return lf},MathUtils:function(){return vr},Matrix3:function(){return gr},Matrix4:function(){return wi},MaxEquation:function(){return ee},Mesh:function(){return yv},MeshBasicMaterial:function(){return ma},MeshDepthMaterial:function(){return Xu},MeshDistanceMaterial:function(){return qu},MeshLambertMaterial:function(){return ad},MeshMatcapMaterial:function(){return od},MeshNormalMaterial:function(){return id},MeshPhongMaterial:function(){return nd},MeshPhysicalMaterial:function(){return td},MeshStandardMaterial:function(){return ed},MeshToonMaterial:function(){return rd},MinEquation:function(){return $},MirroredRepeatWrapping:function(){return Ne},MixOperation:function(){return Me},ModelLoader:function(){return qg},ModelType:function(){return Xg},MultiplyBlending:function(){return Y},MultiplyOperation:function(){return xe},NearestFilter:function(){return Fe},NearestMipMapLinearFilter:function(){return Ge},NearestMipMapNearestFilter:function(){return ze},NearestMipmapLinearFilter:function(){return He},NearestMipmapNearestFilter:function(){return Be},NeverCompare:function(){return In},NeverDepth:function(){return de},NeverStencilFunc:function(){return Tn},NoBlending:function(){return W},NoColorSpace:function(){return fn},NoToneMapping:function(){return be},NormalAnimationBlendMode:function(){return tn},NormalBlending:function(){return j},NotEqualCompare:function(){return Fn},NotEqualDepth:function(){return _e},NotEqualStencilFunc:function(){return Cn},NumberKeyframeTrack:function(){return Sd},Object3D:function(){return Zi},ObjectLoader:function(){return ff},ObjectSpaceNormalMap:function(){return dn},OctahedronGeometry:function(){return Hh},OneFactor:function(){return ne},OneMinusDstAlphaFactor:function(){return ue},OneMinusDstColorFactor:function(){return ce},OneMinusSrcAlphaFactor:function(){return oe},OneMinusSrcColorFactor:function(){return ie},OrbitControls:function(){return Qp},OrthographicCamera:function(){return Ho},PCFShadowMap:function(){return N},PCFSoftShadowMap:function(){return F},PMREMGenerator:function(){return Ko},Path:function(){return Zc},PerspectiveCamera:function(){return Nv},Plane:function(){return wo},PlaneGeometry:function(){return Co},PlaneHelper:function(){return Hp},PointLight:function(){return tf},PointLightHelper:function(){return Mp},Points:function(){return xc},PointsMaterial:function(){return vc},PolarGridHelper:function(){return Ap},PolyhedronGeometry:function(){return th},PositionalAudio:function(){return Ff},PropertyBinding:function(){return Yf},PropertyMixer:function(){return zf},QuadraticBezierCurve:function(){return Wc},QuadraticBezierCurve3:function(){return jc},Quaternion:function(){return qr},QuaternionKeyframeTrack:function(){return wd},QuaternionLinearInterpolant:function(){return bd},RED_GREEN_RGTC2_Format:function(){return Wt},RED_RGTC1_Format:function(){return Gt},REVISION:function(){return k},RGBADepthPacking:function(){return cn},RGBAFormat:function(){return ot},RGBAIntegerFormat:function(){return vt},RGBA_ASTC_10x10_Format:function(){return Ft},RGBA_ASTC_10x5_Format:function(){return Ut},RGBA_ASTC_10x6_Format:function(){return Ot},RGBA_ASTC_10x8_Format:function(){return Nt},RGBA_ASTC_12x10_Format:function(){return Bt},RGBA_ASTC_12x12_Format:function(){return zt},RGBA_ASTC_4x4_Format:function(){return At},RGBA_ASTC_5x4_Format:function(){return Rt},RGBA_ASTC_5x5_Format:function(){return kt},RGBA_ASTC_6x5_Format:function(){return Ct},RGBA_ASTC_6x6_Format:function(){return Lt},RGBA_ASTC_8x5_Format:function(){return Pt},RGBA_ASTC_8x6_Format:function(){return It},RGBA_ASTC_8x8_Format:function(){return Dt},RGBA_BPTC_Format:function(){return Ht},RGBA_ETC2_EAC_Format:function(){return Et},RGBA_PVRTC_2BPPV1_Format:function(){return bt},RGBA_PVRTC_4BPPV1_Format:function(){return St},RGBA_S3TC_DXT1_Format:function(){return gt},RGBA_S3TC_DXT3_Format:function(){return yt},RGBA_S3TC_DXT5_Format:function(){return _t},RGB_ETC1_Format:function(){return wt},RGB_ETC2_Format:function(){return Tt},RGB_PVRTC_2BPPV1_Format:function(){return Mt},RGB_PVRTC_4BPPV1_Format:function(){return xt},RGB_S3TC_DXT1_Format:function(){return mt},RGFormat:function(){return ft},RGIntegerFormat:function(){return pt},RawShaderMaterial:function(){return $h},Ray:function(){return bi},Raycaster:function(){return ip},RectAreaLight:function(){return of},RedFormat:function(){return ht},RedIntegerFormat:function(){return dt},ReinhardToneMapping:function(){return Te},RenderTarget:function(){return zr},RepeatWrapping:function(){return Ue},ReplaceStencilOp:function(){return _n},ReverseSubtractEquation:function(){return Q},RingGeometry:function(){return Gh},SIGNED_RED_GREEN_RGTC2_Format:function(){return jt},SIGNED_RED_RGTC1_Format:function(){return Vt},SRGBColorSpace:function(){return pn},Scene:function(){return Bv},ShaderChunk:function(){return Lo},ShaderLib:function(){return Io},ShaderMaterial:function(){return po},ShadowMaterial:function(){return Qh},Shape:function(){return uh},ShapeGeometry:function(){return Vh},ShapePath:function(){return jp},ShapeUtils:function(){return Uh},ShortType:function(){return Ke},Skeleton:function(){return Yl},SkeletonHelper:function(){return _p},SkinnedMesh:function(){return Vl},Source:function(){return Ur},Sphere:function(){return vi},SphereGeometry:function(){return Wh},Spherical:function(){return sp},SphericalHarmonics3:function(){return sf},SplineCurve:function(){return Xc},SpotLight:function(){return Kd},SpotLightHelper:function(){return vp},Sprite:function(){return kl},SpriteMaterial:function(){return ml},SrcAlphaFactor:function(){return ae},SrcAlphaSaturateFactor:function(){return he},SrcColorFactor:function(){return re},StaticCopyUsage:function(){return qn},StaticDrawUsage:function(){return Hn},StaticReadUsage:function(){return Wn},StereoCamera:function(){return Tf},StreamCopyUsage:function(){return Zn},StreamDrawUsage:function(){return Vn},StreamReadUsage:function(){return Xn},StringKeyframeTrack:function(){return Td},SubtractEquation:function(){return J},SubtractiveBlending:function(){return q},TOUCH:function(){return L},TScene:function(){return dl},TangentSpaceNormalMap:function(){return hn},TetrahedronGeometry:function(){return jh},Texture:function(){return Fr},TextureLoader:function(){return Gd},TorusGeometry:function(){return Xh},TorusKnotGeometry:function(){return qh},TransformControls:function(){return Cy},Triangle:function(){return sa},TriangleFanDrawMode:function(){return on},TriangleStripDrawMode:function(){return an},TrianglesDrawMode:function(){return rn},TubeGeometry:function(){return Yh},TwoPassDoubleSide:function(){return V},UVMapping:function(){return ke},Uint16BufferAttribute:function(){return ka},Uint32BufferAttribute:function(){return La},Uint8BufferAttribute:function(){return Ea},Uint8ClampedBufferAttribute:function(){return Aa},Uniform:function(){return $f},UniformsGroup:function(){return tp},UniformsLib:function(){return Po},UniformsUtils:function(){return fo},UnsignedByteType:function(){return Ye},UnsignedInt248Type:function(){return it},UnsignedIntType:function(){return $e},UnsignedShort4444Type:function(){return nt},UnsignedShort5551Type:function(){return rt},UnsignedShortType:function(){return Je},VSMShadowMap:function(){return B},Vector2:function(){return mr},Vector3:function(){return Yr},Vector4:function(){return Br},VectorKeyframeTrack:function(){return Ed},VideoTexture:function(){return Sc},WebGL1Renderer:function(){return ul},WebGL3DRenderTarget:function(){return jr},WebGLArrayRenderTarget:function(){return Vr},WebGLCoordinateSystem:function(){return $n},WebGLCubeRenderTarget:function(){return xo},WebGLMultipleRenderTargets:function(){return Xr},WebGLRenderTarget:function(){return Hr},WebGLRenderer:function(){return sl},WebGLUtils:function(){return Ju},WebGPUCoordinateSystem:function(){return er},WireframeGeometry:function(){return Zh},WrapAroundEnding:function(){return en},ZeroCurvatureEnding:function(){return Qt},ZeroFactor:function(){return te},ZeroSlopeEnding:function(){return $t},ZeroStencilOp:function(){return gn},_SRGBAFormat:function(){return Qn},createControlLine:function(){return Jg},createLabel:function(){return Yg},createTransformControls:function(){return Py},dom:function(){return h_},globalObjectManage:function(){return mv},sRGBEncoding:function(){return un},use:function(){return d_},utils:function(){return c_}});var e={};n.r(e),n.d(e,{ACESFilmicToneMapping:function(){return Ae},AddEquation:function(){return K},AddOperation:function(){return Se},AdditiveAnimationBlendMode:function(){return nn},AdditiveBlending:function(){return X},AlphaFormat:function(){return at},AlwaysCompare:function(){return zn},AlwaysDepth:function(){return fe},AlwaysStencilFunc:function(){return Pn},AmbientLight:function(){return af},AmbientLightProbe:function(){return Mf},AnimationAction:function(){return Kf},AnimationClip:function(){return Ad},AnimationLoader:function(){return Nd},AnimationMixer:function(){return Qf},AnimationObjectGroup:function(){return Zf},AnimationUtils:function(){return pd},ArcCurve:function(){return Cc},ArrayCamera:function(){return Qu},ArrowHelper:function(){return Vp},Audio:function(){return If},AudioAnalyser:function(){return Bf},AudioContext:function(){return yf},AudioListener:function(){return Pf},AudioLoader:function(){return _f},AxesHelper:function(){return Wp},BackSide:function(){return H},BasicDepthPacking:function(){return ln},BasicShadowMap:function(){return O},Bone:function(){return Wl},BooleanKeyframeTrack:function(){return xd},Box2:function(){return cp},Box3:function(){return Jr},Box3Helper:function(){return zp},BoxGeometry:function(){return uo},BoxHelper:function(){return Bp},BufferAttribute:function(){return wa},BufferGeometry:function(){return Ga},BufferGeometryLoader:function(){return df},ByteType:function(){return Ze},CSS2DRenderer:function(){return Tv},CSS3DRenderer:function(){return Lv},Cache:function(){return kd},Camera:function(){return vo},CameraHelper:function(){return Dp},CanvasTexture:function(){return Ac},CapsuleGeometry:function(){return Jc},CatmullRomCurve3:function(){return Oc},CineonToneMapping:function(){return Ee},CircleGeometry:function(){return Qc},ClampToEdgeWrapping:function(){return Oe},Clock:function(){return Ef},Color:function(){return pa},ColorKeyframeTrack:function(){return Md},ColorManagement:function(){return Pr},CompressedArrayTexture:function(){return Tc},CompressedCubeTexture:function(){return Ec},CompressedTexture:function(){return wc},CompressedTextureLoader:function(){return Fd},ConeGeometry:function(){return eh},CubeCamera:function(){return yo},CubeReflectionMapping:function(){return Ce},CubeRefractionMapping:function(){return Le},CubeTexture:function(){return _o},CubeTextureLoader:function(){return zd},CubeUVReflectionMapping:function(){return De},CubicBezierCurve:function(){return zc},CubicBezierCurve3:function(){return Hc},CubicInterpolant:function(){return md},CullFaceBack:function(){return I},CullFaceFront:function(){return D},CullFaceFrontBack:function(){return U},CullFaceNone:function(){return P},Curve:function(){return Rc},CurvePath:function(){return Yc},CustomBlending:function(){return Z},CustomToneMapping:function(){return Re},CylinderGeometry:function(){return $c},Cylindrical:function(){return up},DRACOLoader:function(){return Vv},Data3DTexture:function(){return Wr},DataArrayTexture:function(){return Gr},DataTexture:function(){return jl},DataTextureLoader:function(){return Hd},DataUtils:function(){return Ma},DecrementStencilOp:function(){return Mn},DecrementWrapStencilOp:function(){return bn},DefaultLoadingManager:function(){return Ld},DepthFormat:function(){return lt},DepthStencilFormat:function(){return ct},DepthTexture:function(){return nl},Direction:function(){return hv},DirectionalLight:function(){return rf},DirectionalLightHelper:function(){return Lp},DiscreteInterpolant:function(){return yd},DisplayP3ColorSpace:function(){return mn},DodecahedronGeometry:function(){return nh},DoubleSide:function(){return G},DstAlphaFactor:function(){return se},DstColorFactor:function(){return le},DynamicCopyUsage:function(){return Yn},DynamicDrawUsage:function(){return Gn},DynamicReadUsage:function(){return jn},EdgesGeometry:function(){return sh},EllipseCurve:function(){return kc},EqualCompare:function(){return Un},EqualDepth:function(){return me},EqualStencilFunc:function(){return An},EquirectangularReflectionMapping:function(){return Pe},EquirectangularRefractionMapping:function(){return Ie},Euler:function(){return Di},EventDispatcher:function(){return tr},ExtrudeGeometry:function(){return Fh},FileLoader:function(){return Od},Float16BufferAttribute:function(){return Pa},Float32BufferAttribute:function(){return Ia},Float64BufferAttribute:function(){return Da},FloatType:function(){return et},Fog:function(){return hl},FogExp2:function(){return cl},FramebufferTexture:function(){return bc},FrontSide:function(){return z},Frustum:function(){return Ao},GLBufferAttribute:function(){return rp},GLSL1:function(){return Kn},GLSL3:function(){return Jn},GLTFLoader:function(){return Xv},GreaterCompare:function(){return Nn},GreaterDepth:function(){return ye},GreaterEqualCompare:function(){return Bn},GreaterEqualDepth:function(){return ge},GreaterEqualStencilFunc:function(){return Ln},GreaterStencilFunc:function(){return kn},GridHelper:function(){return Ep},Group:function(){return Hv},HalfFloatType:function(){return tt},HemisphereLight:function(){return Wd},HemisphereLightHelper:function(){return Tp},HemisphereLightProbe:function(){return xf},IcosahedronGeometry:function(){return zh},ImageBitmapLoader:function(){return gf},ImageLoader:function(){return Bd},ImageUtils:function(){return Ir},IncrementStencilOp:function(){return xn},IncrementWrapStencilOp:function(){return Sn},InstancedBufferAttribute:function(){return Zl},InstancedBufferGeometry:function(){return hf},InstancedInterleavedBuffer:function(){return np},InstancedMesh:function(){return rc},Int16BufferAttribute:function(){return Ra},Int32BufferAttribute:function(){return Ca},Int8BufferAttribute:function(){return Ta},IntType:function(){return Qe},InterleavedBuffer:function(){return fl},InterleavedBufferAttribute:function(){return vl},Interpolant:function(){return vd},InterpolateDiscrete:function(){return Zt},InterpolateLinear:function(){return Kt},InterpolateSmooth:function(){return Jt},InvertStencilOp:function(){return wn},KeepStencilOp:function(){return yn},KeyframeTrack:function(){return _d},LOD:function(){return Il},LatheGeometry:function(){return Kc},Layers:function(){return Ui},LessCompare:function(){return Dn},LessDepth:function(){return pe},LessEqualCompare:function(){return On},LessEqualDepth:function(){return ve},LessEqualStencilFunc:function(){return Rn},LessStencilFunc:function(){return En},Light:function(){return Vd},LightProbe:function(){return uf},Line:function(){return cc},Line2:function(){return l_},Line3:function(){return fp},LineBasicMaterial:function(){return ic},LineCurve:function(){return Gc},LineCurve3:function(){return Vc},LineDashedMaterial:function(){return sd},LineGeometry:function(){return jy},LineLoop:function(){return pc},LineMaterial:function(){return Yy},LineSegments:function(){return fc},LinearEncoding:function(){return sn},LinearFilter:function(){return Ve},LinearInterpolant:function(){return gd},LinearMipMapLinearFilter:function(){return qe},LinearMipMapNearestFilter:function(){return je},LinearMipmapLinearFilter:function(){return Xe},LinearMipmapNearestFilter:function(){return We},LinearSRGBColorSpace:function(){return vn},LinearToneMapping:function(){return we},Loader:function(){return Pd},LoaderUtils:function(){return cf},LoadingManager:function(){return Cd},LoopOnce:function(){return Xt},LoopPingPong:function(){return Yt},LoopRepeat:function(){return qt},LuminanceAlphaFormat:function(){return ut},LuminanceFormat:function(){return st},MOUSE:function(){return C},Material:function(){return la},MaterialLoader:function(){return lf},MathUtils:function(){return vr},Matrix3:function(){return gr},Matrix4:function(){return wi},MaxEquation:function(){return ee},Mesh:function(){return yv},MeshBasicMaterial:function(){return ma},MeshDepthMaterial:function(){return Xu},MeshDistanceMaterial:function(){return qu},MeshLambertMaterial:function(){return ad},MeshMatcapMaterial:function(){return od},MeshNormalMaterial:function(){return id},MeshPhongMaterial:function(){return nd},MeshPhysicalMaterial:function(){return td},MeshStandardMaterial:function(){return ed},MeshToonMaterial:function(){return rd},MinEquation:function(){return $},MirroredRepeatWrapping:function(){return Ne},MixOperation:function(){return Me},ModelLoader:function(){return qg},ModelType:function(){return Xg},MultiplyBlending:function(){return Y},MultiplyOperation:function(){return xe},NearestFilter:function(){return Fe},NearestMipMapLinearFilter:function(){return Ge},NearestMipMapNearestFilter:function(){return ze},NearestMipmapLinearFilter:function(){return He},NearestMipmapNearestFilter:function(){return Be},NeverCompare:function(){return In},NeverDepth:function(){return de},NeverStencilFunc:function(){return Tn},NoBlending:function(){return W},NoColorSpace:function(){return fn},NoToneMapping:function(){return be},NormalAnimationBlendMode:function(){return tn},NormalBlending:function(){return j},NotEqualCompare:function(){return Fn},NotEqualDepth:function(){return _e},NotEqualStencilFunc:function(){return Cn},NumberKeyframeTrack:function(){return Sd},Object3D:function(){return Zi},ObjectLoader:function(){return ff},ObjectSpaceNormalMap:function(){return dn},OctahedronGeometry:function(){return Hh},OneFactor:function(){return ne},OneMinusDstAlphaFactor:function(){return ue},OneMinusDstColorFactor:function(){return ce},OneMinusSrcAlphaFactor:function(){return oe},OneMinusSrcColorFactor:function(){return ie},OrbitControls:function(){return Qp},OrthographicCamera:function(){return Ho},PCFShadowMap:function(){return N},PCFSoftShadowMap:function(){return F},PMREMGenerator:function(){return Ko},Path:function(){return Zc},PerspectiveCamera:function(){return Nv},Plane:function(){return wo},PlaneGeometry:function(){return Co},PlaneHelper:function(){return Hp},PointLight:function(){return tf},PointLightHelper:function(){return Mp},Points:function(){return xc},PointsMaterial:function(){return vc},PolarGridHelper:function(){return Ap},PolyhedronGeometry:function(){return th},PositionalAudio:function(){return Ff},PropertyBinding:function(){return Yf},PropertyMixer:function(){return zf},QuadraticBezierCurve:function(){return Wc},QuadraticBezierCurve3:function(){return jc},Quaternion:function(){return qr},QuaternionKeyframeTrack:function(){return wd},QuaternionLinearInterpolant:function(){return bd},RED_GREEN_RGTC2_Format:function(){return Wt},RED_RGTC1_Format:function(){return Gt},REVISION:function(){return k},RGBADepthPacking:function(){return cn},RGBAFormat:function(){return ot},RGBAIntegerFormat:function(){return vt},RGBA_ASTC_10x10_Format:function(){return Ft},RGBA_ASTC_10x5_Format:function(){return Ut},RGBA_ASTC_10x6_Format:function(){return Ot},RGBA_ASTC_10x8_Format:function(){return Nt},RGBA_ASTC_12x10_Format:function(){return Bt},RGBA_ASTC_12x12_Format:function(){return zt},RGBA_ASTC_4x4_Format:function(){return At},RGBA_ASTC_5x4_Format:function(){return Rt},RGBA_ASTC_5x5_Format:function(){return kt},RGBA_ASTC_6x5_Format:function(){return Ct},RGBA_ASTC_6x6_Format:function(){return Lt},RGBA_ASTC_8x5_Format:function(){return Pt},RGBA_ASTC_8x6_Format:function(){return It},RGBA_ASTC_8x8_Format:function(){return Dt},RGBA_BPTC_Format:function(){return Ht},RGBA_ETC2_EAC_Format:function(){return Et},RGBA_PVRTC_2BPPV1_Format:function(){return bt},RGBA_PVRTC_4BPPV1_Format:function(){return St},RGBA_S3TC_DXT1_Format:function(){return gt},RGBA_S3TC_DXT3_Format:function(){return yt},RGBA_S3TC_DXT5_Format:function(){return _t},RGB_ETC1_Format:function(){return wt},RGB_ETC2_Format:function(){return Tt},RGB_PVRTC_2BPPV1_Format:function(){return Mt},RGB_PVRTC_4BPPV1_Format:function(){return xt},RGB_S3TC_DXT1_Format:function(){return mt},RGFormat:function(){return ft},RGIntegerFormat:function(){return pt},RawShaderMaterial:function(){return $h},Ray:function(){return bi},Raycaster:function(){return ip},RectAreaLight:function(){return of},RedFormat:function(){return ht},RedIntegerFormat:function(){return dt},ReinhardToneMapping:function(){return Te},RenderTarget:function(){return zr},RepeatWrapping:function(){return Ue},ReplaceStencilOp:function(){return _n},ReverseSubtractEquation:function(){return Q},RingGeometry:function(){return Gh},SIGNED_RED_GREEN_RGTC2_Format:function(){return jt},SIGNED_RED_RGTC1_Format:function(){return Vt},SRGBColorSpace:function(){return pn},Scene:function(){return Bv},ShaderChunk:function(){return Lo},ShaderLib:function(){return Io},ShaderMaterial:function(){return po},ShadowMaterial:function(){return Qh},Shape:function(){return uh},ShapeGeometry:function(){return Vh},ShapePath:function(){return jp},ShapeUtils:function(){return Uh},ShortType:function(){return Ke},Skeleton:function(){return Yl},SkeletonHelper:function(){return _p},SkinnedMesh:function(){return Vl},Source:function(){return Ur},Sphere:function(){return vi},SphereGeometry:function(){return Wh},Spherical:function(){return sp},SphericalHarmonics3:function(){return sf},SplineCurve:function(){return Xc},SpotLight:function(){return Kd},SpotLightHelper:function(){return vp},Sprite:function(){return kl},SpriteMaterial:function(){return ml},SrcAlphaFactor:function(){return ae},SrcAlphaSaturateFactor:function(){return he},SrcColorFactor:function(){return re},StaticCopyUsage:function(){return qn},StaticDrawUsage:function(){return Hn},StaticReadUsage:function(){return Wn},StereoCamera:function(){return Tf},StreamCopyUsage:function(){return Zn},StreamDrawUsage:function(){return Vn},StreamReadUsage:function(){return Xn},StringKeyframeTrack:function(){return Td},SubtractEquation:function(){return J},SubtractiveBlending:function(){return q},TOUCH:function(){return L},TScene:function(){return dl},TangentSpaceNormalMap:function(){return hn},TetrahedronGeometry:function(){return jh},Texture:function(){return Fr},TextureLoader:function(){return Gd},TorusGeometry:function(){return Xh},TorusKnotGeometry:function(){return qh},TransformControls:function(){return Cy},Triangle:function(){return sa},TriangleFanDrawMode:function(){return on},TriangleStripDrawMode:function(){return an},TrianglesDrawMode:function(){return rn},TubeGeometry:function(){return Yh},TwoPassDoubleSide:function(){return V},UVMapping:function(){return ke},Uint16BufferAttribute:function(){return ka},Uint32BufferAttribute:function(){return La},Uint8BufferAttribute:function(){return Ea},Uint8ClampedBufferAttribute:function(){return Aa},Uniform:function(){return $f},UniformsGroup:function(){return tp},UniformsLib:function(){return Po},UniformsUtils:function(){return fo},UnsignedByteType:function(){return Ye},UnsignedInt248Type:function(){return it},UnsignedIntType:function(){return $e},UnsignedShort4444Type:function(){return nt},UnsignedShort5551Type:function(){return rt},UnsignedShortType:function(){return Je},VSMShadowMap:function(){return B},Vector2:function(){return mr},Vector3:function(){return Yr},Vector4:function(){return Br},VectorKeyframeTrack:function(){return Ed},VideoTexture:function(){return Sc},WebGL1Renderer:function(){return ul},WebGL3DRenderTarget:function(){return jr},WebGLArrayRenderTarget:function(){return Vr},WebGLCoordinateSystem:function(){return $n},WebGLCubeRenderTarget:function(){return xo},WebGLMultipleRenderTargets:function(){return Xr},WebGLRenderTarget:function(){return Hr},WebGLRenderer:function(){return sl},WebGLUtils:function(){return Ju},WebGPUCoordinateSystem:function(){return er},WireframeGeometry:function(){return Zh},WrapAroundEnding:function(){return en},ZeroCurvatureEnding:function(){return Qt},ZeroFactor:function(){return te},ZeroSlopeEnding:function(){return $t},ZeroStencilOp:function(){return gn},_SRGBAFormat:function(){return Qn},createControlLine:function(){return Jg},createLabel:function(){return Yg},createTransformControls:function(){return Py},dom:function(){return h_},globalObjectManage:function(){return mv},sRGBEncoding:function(){return un},use:function(){return d_},utils:function(){return c_}});var t,i,a=n(571),o=n.n(a),s=n(159),u=n.n(s),l=n(739),c=n.n(l),h=n(836),d=n(587),f=n.n(d),p=n(955),v=n(66),m=n(143),g=n.n(m),y=n(266),_=n.n(y),x=n(641),M=n.n(x),S=n(808),b=n.n(S),w=n(977),T=n.n(w),E=n(230),A=n.n(E),R=n(391),k="155",C={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},L={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},P=0,I=1,D=2,U=3,O=0,N=1,F=2,B=3,z=0,H=1,G=2,V=2,W=0,j=1,X=2,q=3,Y=4,Z=5,K=100,J=101,Q=102,$=103,ee=104,te=200,ne=201,re=202,ie=203,ae=204,oe=205,se=206,ue=207,le=208,ce=209,he=210,de=0,fe=1,pe=2,ve=3,me=4,ge=5,ye=6,_e=7,xe=0,Me=1,Se=2,be=0,we=1,Te=2,Ee=3,Ae=4,Re=5,ke=300,Ce=301,Le=302,Pe=303,Ie=304,De=306,Ue=1e3,Oe=1001,Ne=1002,Fe=1003,Be=1004,ze=1004,He=1005,Ge=1005,Ve=1006,We=1007,je=1007,Xe=1008,qe=1008,Ye=1009,Ze=1010,Ke=1011,Je=1012,Qe=1013,$e=1014,et=1015,tt=1016,nt=1017,rt=1018,it=1020,at=1021,ot=1023,st=1024,ut=1025,lt=1026,ct=1027,ht=1028,dt=1029,ft=1030,pt=1031,vt=1033,mt=33776,gt=33777,yt=33778,_t=33779,xt=35840,Mt=35841,St=35842,bt=35843,wt=36196,Tt=37492,Et=37496,At=37808,Rt=37809,kt=37810,Ct=37811,Lt=37812,Pt=37813,It=37814,Dt=37815,Ut=37816,Ot=37817,Nt=37818,Ft=37819,Bt=37820,zt=37821,Ht=36492,Gt=36283,Vt=36284,Wt=36285,jt=36286,Xt=2200,qt=2201,Yt=2202,Zt=2300,Kt=2301,Jt=2302,Qt=2400,$t=2401,en=2402,tn=2500,nn=2501,rn=0,an=1,on=2,sn=3e3,un=3001,ln=3200,cn=3201,hn=0,dn=1,fn="",pn="srgb",vn="srgb-linear",mn="display-p3",gn=0,yn=7680,_n=7681,xn=7682,Mn=7683,Sn=34055,bn=34056,wn=5386,Tn=512,En=513,An=514,Rn=515,kn=516,Cn=517,Ln=518,Pn=519,In=512,Dn=513,Un=514,On=515,Nn=516,Fn=517,Bn=518,zn=519,Hn=35044,Gn=35048,Vn=35040,Wn=35045,jn=35049,Xn=35041,qn=35046,Yn=35050,Zn=35042,Kn="100",Jn="300 es",Qn=1035,$n=2e3,er=2001,tr=function(){function e(){a(this,e)}return s(e,[{key:"addEventListener",value:function(e,t){void 0===this._listeners&&(this._listeners={});var n=this._listeners;void 0===n[e]&&(n[e]=[]),-1===n[e].indexOf(t)&&n[e].push(t)}},{key:"hasEventListener",value:function(e,t){if(void 0===this._listeners)return!1;var n=this._listeners;return void 0!==n[e]&&-1!==n[e].indexOf(t)}},{key:"removeEventListener",value:function(e,t){if(void 0!==this._listeners){var n=this._listeners[e];if(void 0!==n){var r=n.indexOf(t);-1!==r&&n.splice(r,1)}}}},{key:"dispatchEvent",value:function(e){if(void 0!==this._listeners){var t=this._listeners[e.type];if(void 0!==t){e.target=this;for(var n=t.slice(0),r=0,i=n.length;r<i;r++)n[r].call(this,e);e.target=null}}}}]),e}(),nr=["00","01","02","03","04","05","06","07","08","09","0a","0b","0c","0d","0e","0f","10","11","12","13","14","15","16","17","18","19","1a","1b","1c","1d","1e","1f","20","21","22","23","24","25","26","27","28","29","2a","2b","2c","2d","2e","2f","30","31","32","33","34","35","36","37","38","39","3a","3b","3c","3d","3e","3f","40","41","42","43","44","45","46","47","48","49","4a","4b","4c","4d","4e","4f","50","51","52","53","54","55","56","57","58","59","5a","5b","5c","5d","5e","5f","60","61","62","63","64","65","66","67","68","69","6a","6b","6c","6d","6e","6f","70","71","72","73","74","75","76","77","78","79","7a","7b","7c","7d","7e","7f","80","81","82","83","84","85","86","87","88","89","8a","8b","8c","8d","8e","8f","90","91","92","93","94","95","96","97","98","99","9a","9b","9c","9d","9e","9f","a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","aa","ab","ac","ad","ae","af","b0","b1","b2","b3","b4","b5","b6","b7","b8","b9","ba","bb","bc","bd","be","bf","c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","ca","cb","cc","cd","ce","cf","d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","da","db","dc","dd","de","df","e0","e1","e2","e3","e4","e5","e6","e7","e8","e9","ea","eb","ec","ed","ee","ef","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff"],rr=1234567,ir=Math.PI/180,ar=180/Math.PI;function or(){var e=4294967295*Math.random()|0,t=4294967295*Math.random()|0,n=4294967295*Math.random()|0,r=4294967295*Math.random()|0;return(nr[255&e]+nr[e>>8&255]+nr[e>>16&255]+nr[e>>24&255]+"-"+nr[255&t]+nr[t>>8&255]+"-"+nr[t>>16&15|64]+nr[t>>24&255]+"-"+nr[63&n|128]+nr[n>>8&255]+"-"+nr[n>>16&255]+nr[n>>24&255]+nr[255&r]+nr[r>>8&255]+nr[r>>16&255]+nr[r>>24&255]).toLowerCase()}function sr(e,t,n){return Math.max(t,Math.min(n,e))}function ur(e,t){return(e%t+t)%t}function lr(e,t,n){return(1-n)*e+n*t}function cr(e){return 0==(e&e-1)&&0!==e}function hr(e){return Math.pow(2,Math.ceil(Math.log(e)/Math.LN2))}function dr(e){return Math.pow(2,Math.floor(Math.log(e)/Math.LN2))}function fr(e,t){switch(t.constructor){case Float32Array:return e;case Uint32Array:return e/4294967295;case Uint16Array:return e/65535;case Uint8Array:return e/255;case Int32Array:return Math.max(e/2147483647,-1);case Int16Array:return Math.max(e/32767,-1);case Int8Array:return Math.max(e/127,-1);default:throw new Error("Invalid component type.")}}function pr(e,t){switch(t.constructor){case Float32Array:return e;case Uint32Array:return Math.round(4294967295*e);case Uint16Array:return Math.round(65535*e);case Uint8Array:return Math.round(255*e);case Int32Array:return Math.round(2147483647*e);case Int16Array:return Math.round(32767*e);case Int8Array:return Math.round(127*e);default:throw new Error("Invalid component type.")}}var vr={DEG2RAD:ir,RAD2DEG:ar,generateUUID:or,clamp:sr,euclideanModulo:ur,mapLinear:function(e,t,n,r,i){return r+(e-t)*(i-r)/(n-t)},inverseLerp:function(e,t,n){return e!==t?(n-e)/(t-e):0},lerp:lr,damp:function(e,t,n,r){return lr(e,t,1-Math.exp(-n*r))},pingpong:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return t-Math.abs(ur(e,2*t)-t)},smoothstep:function(e,t,n){return e<=t?0:e>=n?1:(e=(e-t)/(n-t))*e*(3-2*e)},smootherstep:function(e,t,n){return e<=t?0:e>=n?1:(e=(e-t)/(n-t))*e*e*(e*(6*e-15)+10)},randInt:function(e,t){return e+Math.floor(Math.random()*(t-e+1))},randFloat:function(e,t){return e+Math.random()*(t-e)},randFloatSpread:function(e){return e*(.5-Math.random())},seededRandom:function(e){void 0!==e&&(rr=e);var t=rr+=1831565813;return t=Math.imul(t^t>>>15,1|t),(((t^=t+Math.imul(t^t>>>7,61|t))^t>>>14)>>>0)/4294967296},degToRad:function(e){return e*ir},radToDeg:function(e){return e*ar},isPowerOfTwo:cr,ceilPowerOfTwo:hr,floorPowerOfTwo:dr,setQuaternionFromProperEuler:function(e,t,n,r,i){var a=Math.cos,o=Math.sin,s=a(n/2),u=o(n/2),l=a((t+r)/2),c=o((t+r)/2),h=a((t-r)/2),d=o((t-r)/2),f=a((r-t)/2),p=o((r-t)/2);switch(i){case"XYX":e.set(s*c,u*h,u*d,s*l);break;case"YZY":e.set(u*d,s*c,u*h,s*l);break;case"ZXZ":e.set(u*h,u*d,s*c,s*l);break;case"XZX":e.set(s*c,u*p,u*f,s*l);break;case"YXY":e.set(u*f,s*c,u*p,s*l);break;case"ZYZ":e.set(u*p,u*f,s*c,s*l);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+i)}},normalize:pr,denormalize:fr},mr=function(e){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;a(this,t),t.prototype.isVector2=!0,this.x=e,this.y=n}return s(t,[{key:"width",get:function(){return this.x},set:function(e){this.x=e}},{key:"height",get:function(){return this.y},set:function(e){this.y=e}},{key:"set",value:function(e,t){return this.x=e,this.y=t,this}},{key:"setScalar",value:function(e){return this.x=e,this.y=e,this}},{key:"setX",value:function(e){return this.x=e,this}},{key:"setY",value:function(e){return this.y=e,this}},{key:"setComponent",value:function(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("index is out of range: "+e)}return this}},{key:"getComponent",value:function(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}}},{key:"clone",value:function(){return new this.constructor(this.x,this.y)}},{key:"copy",value:function(e){return this.x=e.x,this.y=e.y,this}},{key:"add",value:function(e){return this.x+=e.x,this.y+=e.y,this}},{key:"addScalar",value:function(e){return this.x+=e,this.y+=e,this}},{key:"addVectors",value:function(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}},{key:"addScaledVector",value:function(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}},{key:"sub",value:function(e){return this.x-=e.x,this.y-=e.y,this}},{key:"subScalar",value:function(e){return this.x-=e,this.y-=e,this}},{key:"subVectors",value:function(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}},{key:"multiply",value:function(e){return this.x*=e.x,this.y*=e.y,this}},{key:"multiplyScalar",value:function(e){return this.x*=e,this.y*=e,this}},{key:"divide",value:function(e){return this.x/=e.x,this.y/=e.y,this}},{key:"divideScalar",value:function(e){return this.multiplyScalar(1/e)}},{key:"applyMatrix3",value:function(e){var t=this.x,n=this.y,r=e.elements;return this.x=r[0]*t+r[3]*n+r[6],this.y=r[1]*t+r[4]*n+r[7],this}},{key:"min",value:function(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}},{key:"max",value:function(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}},{key:"clamp",value:function(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this}},{key:"clampScalar",value:function(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this}},{key:"clampLength",value:function(e,t){var n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))}},{key:"floor",value:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}},{key:"ceil",value:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}},{key:"round",value:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},{key:"roundToZero",value: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}},{key:"negate",value:function(){return this.x=-this.x,this.y=-this.y,this}},{key:"dot",value:function(e){return this.x*e.x+this.y*e.y}},{key:"cross",value:function(e){return this.x*e.y-this.y*e.x}},{key:"lengthSq",value:function(){return this.x*this.x+this.y*this.y}},{key:"length",value:function(){return Math.sqrt(this.x*this.x+this.y*this.y)}},{key:"manhattanLength",value:function(){return Math.abs(this.x)+Math.abs(this.y)}},{key:"normalize",value:function(){return this.divideScalar(this.length()||1)}},{key:"angle",value:function(){var e=Math.atan2(-this.y,-this.x)+Math.PI;return e}},{key:"angleTo",value:function(e){var t=Math.sqrt(this.lengthSq()*e.lengthSq());if(0===t)return Math.PI/2;var n=this.dot(e)/t;return Math.acos(sr(n,-1,1))}},{key:"distanceTo",value:function(e){return Math.sqrt(this.distanceToSquared(e))}},{key:"distanceToSquared",value:function(e){var t=this.x-e.x,n=this.y-e.y;return t*t+n*n}},{key:"manhattanDistanceTo",value:function(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}},{key:"setLength",value:function(e){return this.normalize().multiplyScalar(e)}},{key:"lerp",value:function(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}},{key:"lerpVectors",value:function(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this}},{key:"equals",value:function(e){return e.x===this.x&&e.y===this.y}},{key:"fromArray",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.x=e[t],this.y=e[t+1],this}},{key:"toArray",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return e[t]=this.x,e[t+1]=this.y,e}},{key:"fromBufferAttribute",value:function(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}},{key:"rotateAround",value:function(e,t){var n=Math.cos(t),r=Math.sin(t),i=this.x-e.x,a=this.y-e.y;return this.x=i*n-a*r+e.x,this.y=i*r+a*n+e.y,this}},{key:"random",value:function(){return this.x=Math.random(),this.y=Math.random(),this}},{key:e,value:R().mark((function e(){return R().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.x;case 2:return e.next=4,this.y;case 4:case"end":return e.stop()}}),e,this)}))}]),t}(Symbol.iterator),gr=function(){function e(t,n,r,i,o,s,u,l,c){a(this,e),e.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],void 0!==t&&this.set(t,n,r,i,o,s,u,l,c)}return s(e,[{key:"set",value:function(e,t,n,r,i,a,o,s,u){var l=this.elements;return l[0]=e,l[1]=r,l[2]=o,l[3]=t,l[4]=i,l[5]=s,l[6]=n,l[7]=a,l[8]=u,this}},{key:"identity",value:function(){return this.set(1,0,0,0,1,0,0,0,1),this}},{key:"copy",value:function(e){var t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],this}},{key:"extractBasis",value:function(e,t,n){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}},{key:"setFromMatrix4",value:function(e){var t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}},{key:"multiply",value:function(e){return this.multiplyMatrices(this,e)}},{key:"premultiply",value:function(e){return this.multiplyMatrices(e,this)}},{key:"multiplyMatrices",value:function(e,t){var n=e.elements,r=t.elements,i=this.elements,a=n[0],o=n[3],s=n[6],u=n[1],l=n[4],c=n[7],h=n[2],d=n[5],f=n[8],p=r[0],v=r[3],m=r[6],g=r[1],y=r[4],_=r[7],x=r[2],M=r[5],S=r[8];return i[0]=a*p+o*g+s*x,i[3]=a*v+o*y+s*M,i[6]=a*m+o*_+s*S,i[1]=u*p+l*g+c*x,i[4]=u*v+l*y+c*M,i[7]=u*m+l*_+c*S,i[2]=h*p+d*g+f*x,i[5]=h*v+d*y+f*M,i[8]=h*m+d*_+f*S,this}},{key:"multiplyScalar",value:function(e){var t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}},{key:"determinant",value:function(){var e=this.elements,t=e[0],n=e[1],r=e[2],i=e[3],a=e[4],o=e[5],s=e[6],u=e[7],l=e[8];return t*a*l-t*o*u-n*i*l+n*o*s+r*i*u-r*a*s}},{key:"invert",value:function(){var e=this.elements,t=e[0],n=e[1],r=e[2],i=e[3],a=e[4],o=e[5],s=e[6],u=e[7],l=e[8],c=l*a-o*u,h=o*s-l*i,d=u*i-a*s,f=t*c+n*h+r*d;if(0===f)return this.set(0,0,0,0,0,0,0,0,0);var p=1/f;return e[0]=c*p,e[1]=(r*u-l*n)*p,e[2]=(o*n-r*a)*p,e[3]=h*p,e[4]=(l*t-r*s)*p,e[5]=(r*i-o*t)*p,e[6]=d*p,e[7]=(n*s-u*t)*p,e[8]=(a*t-n*i)*p,this}},{key:"transpose",value:function(){var e,t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}},{key:"getNormalMatrix",value:function(e){return this.setFromMatrix4(e).invert().transpose()}},{key:"transposeIntoArray",value:function(e){var t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}},{key:"setUvTransform",value:function(e,t,n,r,i,a,o){var s=Math.cos(i),u=Math.sin(i);return this.set(n*s,n*u,-n*(s*a+u*o)+a+e,-r*u,r*s,-r*(-u*a+s*o)+o+t,0,0,1),this}},{key:"scale",value:function(e,t){return this.premultiply(yr.makeScale(e,t)),this}},{key:"rotate",value:function(e){return this.premultiply(yr.makeRotation(-e)),this}},{key:"translate",value:function(e,t){return this.premultiply(yr.makeTranslation(e,t)),this}},{key:"makeTranslation",value:function(e,t){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,t,0,0,1),this}},{key:"makeRotation",value:function(e){var t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,n,t,0,0,0,1),this}},{key:"makeScale",value:function(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}},{key:"equals",value:function(e){for(var t=this.elements,n=e.elements,r=0;r<9;r++)if(t[r]!==n[r])return!1;return!0}},{key:"fromArray",value:function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=0;n<9;n++)this.elements[n]=e[n+t];return this}},{key:"toArray",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e}},{key:"clone",value:function(){return(new this.constructor).fromArray(this.elements)}}]),e}(),yr=new gr;function _r(e){for(var t=e.length-1;t>=0;--t)if(e[t]>=65535)return!0;return!1}var xr={Int8Array:Int8Array,Uint8Array:Uint8Array,Uint8ClampedArray:Uint8ClampedArray,Int16Array:Int16Array,Uint16Array:Uint16Array,Int32Array:Int32Array,Uint32Array:Uint32Array,Float32Array:Float32Array,Float64Array:Float64Array};function Mr(e,t){return new xr[e](t)}function Sr(e){return document.createElementNS("http://www.w3.org/1999/xhtml",e)}var br={};function wr(e){e in br||(br[e]=!0,console.warn(e))}function Tr(e){return e<.04045?.0773993808*e:Math.pow(.9478672986*e+.0521327014,2.4)}function Er(e){return e<.0031308?12.92*e:1.055*Math.pow(e,.41666)-.055}var Ar=(new gr).fromArray([.8224621,.0331941,.0170827,.177538,.9668058,.0723974,-1e-7,1e-7,.9105199]),Rr=(new gr).fromArray([1.2249401,-.0420569,-.0196376,-.2249404,1.0420571,-.0786361,1e-7,0,1.0982735]);var kr,Cr=(l(t={},vn,(function(e){return e})),l(t,pn,(function(e){return e.convertSRGBToLinear()})),l(t,mn,(function(e){return e.convertSRGBToLinear().applyMatrix3(Rr)})),t),Lr=(l(i={},vn,(function(e){return e})),l(i,pn,(function(e){return e.convertLinearToSRGB()})),l(i,mn,(function(e){return e.applyMatrix3(Ar).convertLinearToSRGB()})),i),Pr={enabled:!0,get legacyMode(){return console.warn("THREE.ColorManagement: .legacyMode=false renamed to .enabled=true in r150."),!this.enabled},set legacyMode(e){console.warn("THREE.ColorManagement: .legacyMode=false renamed to .enabled=true in r150."),this.enabled=!e},get workingColorSpace(){return vn},set workingColorSpace(e){console.warn("THREE.ColorManagement: .workingColorSpace is readonly.")},convert:function(e,t,n){if(!1===this.enabled||t===n||!t||!n)return e;var r=Cr[t],i=Lr[n];if(void 0===r||void 0===i)throw new Error('Unsupported color space conversion, "'.concat(t,'" to "').concat(n,'".'));return i(r(e))},fromWorkingColorSpace:function(e,t){return this.convert(e,this.workingColorSpace,t)},toWorkingColorSpace:function(e,t){return this.convert(e,t,this.workingColorSpace)}},Ir=function(){function e(){a(this,e)}return s(e,null,[{key:"getDataURL",value:function(e){if(/^data:/i.test(e.src))return e.src;if("undefined"==typeof HTMLCanvasElement)return e.src;var t;if(e instanceof HTMLCanvasElement)t=e;else{void 0===kr&&(kr=Sr("canvas")),kr.width=e.width,kr.height=e.height;var n=kr.getContext("2d");e instanceof ImageData?n.putImageData(e,0,0):n.drawImage(e,0,0,e.width,e.height),t=kr}return t.width>2048||t.height>2048?(console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons",e),t.toDataURL("image/jpeg",.6)):t.toDataURL("image/png")}},{key:"sRGBToLinear",value:function(e){if("undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap){var t=Sr("canvas");t.width=e.width,t.height=e.height;var n=t.getContext("2d");n.drawImage(e,0,0,e.width,e.height);for(var r=n.getImageData(0,0,e.width,e.height),i=r.data,a=0;a<i.length;a++)i[a]=255*Tr(i[a]/255);return n.putImageData(r,0,0),t}if(e.data){for(var o=e.data.slice(0),s=0;s<o.length;s++)o instanceof Uint8Array||o instanceof Uint8ClampedArray?o[s]=Math.floor(255*Tr(o[s]/255)):o[s]=Tr(o[s]);return{data:o,width:e.width,height:e.height}}return console.warn("THREE.ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e}}]),e}(),Dr=0,Ur=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;a(this,e),this.isSource=!0,Object.defineProperty(this,"id",{value:Dr++}),this.uuid=or(),this.data=t,this.version=0}return s(e,[{key:"needsUpdate",set:function(e){!0===e&&this.version++}},{key:"toJSON",value:function(e){var t=void 0===e||"string"==typeof e;if(!t&&void 0!==e.images[this.uuid])return e.images[this.uuid];var n={uuid:this.uuid,url:""},r=this.data;if(null!==r){var i;if(Array.isArray(r)){i=[];for(var a=0,o=r.length;a<o;a++)r[a].isDataTexture?i.push(Or(r[a].image)):i.push(Or(r[a]))}else i=Or(r);n.url=i}return t||(e.images[this.uuid]=n),n}}]),e}();function Or(e){return"undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap?Ir.getDataURL(e):e.data?{data:Array.from(e.data),width:e.width,height:e.height,type:e.data.constructor.name}:(console.warn("THREE.Texture: Unable to serialize Texture."),{})}var Nr=0,Fr=function(e){w(n,e);var t=E(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:n.DEFAULT_IMAGE,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:n.DEFAULT_MAPPING,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Oe,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:Oe,u=arguments.length>4&&void 0!==arguments[4]?arguments[4]:Ve,l=arguments.length>5&&void 0!==arguments[5]?arguments[5]:Xe,c=arguments.length>6&&void 0!==arguments[6]?arguments[6]:ot,h=arguments.length>7&&void 0!==arguments[7]?arguments[7]:Ye,d=arguments.length>8&&void 0!==arguments[8]?arguments[8]:n.DEFAULT_ANISOTROPY,f=arguments.length>9&&void 0!==arguments[9]?arguments[9]:fn;return a(this,n),(e=t.call(this)).isTexture=!0,Object.defineProperty(S(e),"id",{value:Nr++}),e.uuid=or(),e.name="",e.source=new Ur(r),e.mipmaps=[],e.mapping=i,e.channel=0,e.wrapS=o,e.wrapT=s,e.magFilter=u,e.minFilter=l,e.anisotropy=d,e.format=c,e.internalFormat=null,e.type=h,e.offset=new mr(0,0),e.repeat=new mr(1,1),e.center=new mr(0,0),e.rotation=0,e.matrixAutoUpdate=!0,e.matrix=new gr,e.generateMipmaps=!0,e.premultiplyAlpha=!1,e.flipY=!0,e.unpackAlignment=4,"string"==typeof f?e.colorSpace=f:(wr("THREE.Texture: Property .encoding has been replaced by .colorSpace."),e.colorSpace=f===un?pn:fn),e.userData={},e.version=0,e.onUpdate=null,e.isRenderTargetTexture=!1,e.needsPMREMUpdate=!1,e}return s(n,[{key:"image",get:function(){return this.source.data},set:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;this.source.data=e}},{key:"updateMatrix",value:function(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}},{key:"clone",value:function(){return(new this.constructor).copy(this)}},{key:"copy",value:function(e){return this.name=e.name,this.source=e.source,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.channel=e.channel,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.colorSpace=e.colorSpace,this.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}},{key:"toJSON",value:function(e){var t=void 0===e||"string"==typeof e;if(!t&&void 0!==e.textures[this.uuid])return e.textures[this.uuid];var n={metadata:{version:4.6,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(e).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(n.userData=this.userData),t||(e.textures[this.uuid]=n),n}},{key:"dispose",value:function(){this.dispatchEvent({type:"dispose"})}},{key:"transformUv",value:function(e){if(this.mapping!==ke)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case Ue:e.x=e.x-Math.floor(e.x);break;case Oe:e.x=e.x<0?0:1;break;case Ne:1===Math.abs(Math.floor(e.x)%2)?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x)}if(e.y<0||e.y>1)switch(this.wrapT){case Ue:e.y=e.y-Math.floor(e.y);break;case Oe:e.y=e.y<0?0:1;break;case Ne:1===Math.abs(Math.floor(e.y)%2)?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y)}return this.flipY&&(e.y=1-e.y),e}},{key:"needsUpdate",set:function(e){!0===e&&(this.version++,this.source.needsUpdate=!0)}},{key:"encoding",get:function(){return wr("THREE.Texture: Property .encoding has been replaced by .colorSpace."),this.colorSpace===pn?un:sn},set:function(e){wr("THREE.Texture: Property .encoding has been replaced by .colorSpace."),this.colorSpace=e===un?pn:fn}}]),n}(tr);Fr.DEFAULT_IMAGE=null,Fr.DEFAULT_MAPPING=ke,Fr.DEFAULT_ANISOTROPY=1;var Br=function(e){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1;a(this,t),t.prototype.isVector4=!0,this.x=e,this.y=n,this.z=r,this.w=i}return s(t,[{key:"width",get:function(){return this.z},set:function(e){this.z=e}},{key:"height",get:function(){return this.w},set:function(e){this.w=e}},{key:"set",value:function(e,t,n,r){return this.x=e,this.y=t,this.z=n,this.w=r,this}},{key:"setScalar",value:function(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}},{key:"setX",value:function(e){return this.x=e,this}},{key:"setY",value:function(e){return this.y=e,this}},{key:"setZ",value:function(e){return this.z=e,this}},{key:"setW",value:function(e){return this.w=e,this}},{key:"setComponent",value:function(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("index is out of range: "+e)}return this}},{key:"getComponent",value:function(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+e)}}},{key:"clone",value:function(){return new this.constructor(this.x,this.y,this.z,this.w)}},{key:"copy",value:function(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=void 0!==e.w?e.w:1,this}},{key:"add",value:function(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}},{key:"addScalar",value:function(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}},{key:"addVectors",value:function(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}},{key:"addScaledVector",value:function(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}},{key:"sub",value:function(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}},{key:"subScalar",value:function(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}},{key:"subVectors",value:function(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}},{key:"multiply",value:function(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}},{key:"multiplyScalar",value:function(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}},{key:"applyMatrix4",value:function(e){var t=this.x,n=this.y,r=this.z,i=this.w,a=e.elements;return this.x=a[0]*t+a[4]*n+a[8]*r+a[12]*i,this.y=a[1]*t+a[5]*n+a[9]*r+a[13]*i,this.z=a[2]*t+a[6]*n+a[10]*r+a[14]*i,this.w=a[3]*t+a[7]*n+a[11]*r+a[15]*i,this}},{key:"divideScalar",value:function(e){return this.multiplyScalar(1/e)}},{key:"setAxisAngleFromQuaternion",value:function(e){this.w=2*Math.acos(e.w);var t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}},{key:"setAxisAngleFromRotationMatrix",value:function(e){var t,n,r,i,a=.01,o=.1,s=e.elements,u=s[0],l=s[4],c=s[8],h=s[1],d=s[5],f=s[9],p=s[2],v=s[6],m=s[10];if(Math.abs(l-h)<a&&Math.abs(c-p)<a&&Math.abs(f-v)<a){if(Math.abs(l+h)<o&&Math.abs(c+p)<o&&Math.abs(f+v)<o&&Math.abs(u+d+m-3)<o)return this.set(1,0,0,0),this;t=Math.PI;var g=(u+1)/2,y=(d+1)/2,_=(m+1)/2,x=(l+h)/4,M=(c+p)/4,S=(f+v)/4;return g>y&&g>_?g<a?(n=0,r=.707106781,i=.707106781):(r=x/(n=Math.sqrt(g)),i=M/n):y>_?y<a?(n=.707106781,r=0,i=.707106781):(n=x/(r=Math.sqrt(y)),i=S/r):_<a?(n=.707106781,r=.707106781,i=0):(n=M/(i=Math.sqrt(_)),r=S/i),this.set(n,r,i,t),this}var b=Math.sqrt((v-f)*(v-f)+(c-p)*(c-p)+(h-l)*(h-l));return Math.abs(b)<.001&&(b=1),this.x=(v-f)/b,this.y=(c-p)/b,this.z=(h-l)/b,this.w=Math.acos((u+d+m-1)/2),this}},{key:"min",value:function(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}},{key:"max",value:function(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}},{key:"clamp",value:function(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this.w=Math.max(e.w,Math.min(t.w,this.w)),this}},{key:"clampScalar",value:function(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this.w=Math.max(e,Math.min(t,this.w)),this}},{key:"clampLength",value:function(e,t){var n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))}},{key:"floor",value: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}},{key:"ceil",value: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}},{key:"round",value: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}},{key:"roundToZero",value: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}},{key:"negate",value:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}},{key:"dot",value:function(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}},{key:"lengthSq",value:function(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}},{key:"length",value:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}},{key:"manhattanLength",value:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}},{key:"normalize",value:function(){return this.divideScalar(this.length()||1)}},{key:"setLength",value:function(e){return this.normalize().multiplyScalar(e)}},{key:"lerp",value:function(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this}},{key:"lerpVectors",value:function(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this.w=e.w+(t.w-e.w)*n,this}},{key:"equals",value:function(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}},{key:"fromArray",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}},{key:"toArray",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}},{key:"fromBufferAttribute",value:function(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}},{key:"random",value:function(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}},{key:e,value:R().mark((function e(){return R().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.x;case 2:return e.next=4,this.y;case 4:return e.next=6,this.z;case 6:return e.next=8,this.w;case 8:case"end":return e.stop()}}),e,this)}))}]),t}(Symbol.iterator),zr=function(e){w(n,e);var t=E(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};a(this,n),(e=t.call(this)).isRenderTarget=!0,e.width=r,e.height=i,e.depth=1,e.scissor=new Br(0,0,r,i),e.scissorTest=!1,e.viewport=new Br(0,0,r,i);var s={width:r,height:i,depth:1};return void 0!==o.encoding&&(wr("THREE.WebGLRenderTarget: option.encoding has been replaced by option.colorSpace."),o.colorSpace=o.encoding===un?pn:fn),e.texture=new Fr(s,o.mapping,o.wrapS,o.wrapT,o.magFilter,o.minFilter,o.format,o.type,o.anisotropy,o.colorSpace),e.texture.isRenderTargetTexture=!0,e.texture.flipY=!1,e.texture.generateMipmaps=void 0!==o.generateMipmaps&&o.generateMipmaps,e.texture.internalFormat=void 0!==o.internalFormat?o.internalFormat:null,e.texture.minFilter=void 0!==o.minFilter?o.minFilter:Ve,e.depthBuffer=void 0===o.depthBuffer||o.depthBuffer,e.stencilBuffer=void 0!==o.stencilBuffer&&o.stencilBuffer,e.depthTexture=void 0!==o.depthTexture?o.depthTexture:null,e.samples=void 0!==o.samples?o.samples:0,e}return s(n,[{key:"setSize",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;this.width===e&&this.height===t&&this.depth===n||(this.width=e,this.height=t,this.depth=n,this.texture.image.width=e,this.texture.image.height=t,this.texture.image.depth=n,this.dispose()),this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}},{key:"clone",value:function(){return(new this.constructor).copy(this)}},{key:"copy",value:function(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.scissor.copy(e.scissor),this.scissorTest=e.scissorTest,this.viewport.copy(e.viewport),this.texture=e.texture.clone(),this.texture.isRenderTargetTexture=!0;var t=Object.assign({},e.texture.image);return this.texture.source=new Ur(t),this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,null!==e.depthTexture&&(this.depthTexture=e.depthTexture.clone()),this.samples=e.samples,this}},{key:"dispose",value:function(){this.dispatchEvent({type:"dispose"})}}]),n}(tr),Hr=function(e){w(n,e);var t=E(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return a(this,n),(e=t.call(this,r,i,o)).isWebGLRenderTarget=!0,e}return s(n)}(zr),Gr=function(e){w(n,e);var t=E(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1;return a(this,n),(e=t.call(this,null)).isDataArrayTexture=!0,e.image={data:r,width:i,height:o,depth:s},e.magFilter=Fe,e.minFilter=Fe,e.wrapR=Oe,e.generateMipmaps=!1,e.flipY=!1,e.unpackAlignment=1,e}return s(n)}(Fr),Vr=function(e){w(n,e);var t=E(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;return a(this,n),(e=t.call(this,r,i)).isWebGLArrayRenderTarget=!0,e.depth=o,e.texture=new Gr(null,r,i,o),e.texture.isRenderTargetTexture=!0,e}return s(n)}(Hr),Wr=function(e){w(n,e);var t=E(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1;return a(this,n),(e=t.call(this,null)).isData3DTexture=!0,e.image={data:r,width:i,height:o,depth:s},e.magFilter=Fe,e.minFilter=Fe,e.wrapR=Oe,e.generateMipmaps=!1,e.flipY=!1,e.unpackAlignment=1,e}return s(n)}(Fr),jr=function(e){w(n,e);var t=E(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;return a(this,n),(e=t.call(this,r,i)).isWebGL3DRenderTarget=!0,e.depth=o,e.texture=new Wr(null,r,i,o),e.texture.isRenderTargetTexture=!0,e}return s(n)}(Hr),Xr=function(e){w(n,e);var t=E(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};a(this,n),(e=t.call(this,r,i,s)).isWebGLMultipleRenderTargets=!0;var u=e.texture;e.texture=[];for(var l=0;l<o;l++)e.texture[l]=u.clone(),e.texture[l].isRenderTargetTexture=!0;return e}return s(n,[{key:"setSize",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;if(this.width!==e||this.height!==t||this.depth!==n){this.width=e,this.height=t,this.depth=n;for(var r=0,i=this.texture.length;r<i;r++)this.texture[r].image.width=e,this.texture[r].image.height=t,this.texture[r].image.depth=n;this.dispose()}this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}},{key:"copy",value:function(e){this.dispose(),this.width=e.width,this.height=e.height,this.depth=e.depth,this.scissor.copy(e.scissor),this.scissorTest=e.scissorTest,this.viewport.copy(e.viewport),this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,null!==e.depthTexture&&(this.depthTexture=e.depthTexture.clone()),this.texture.length=0;for(var t=0,n=e.texture.length;t<n;t++)this.texture[t]=e.texture[t].clone(),this.texture[t].isRenderTargetTexture=!0;return this}}]),n}(Hr),qr=function(e){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1;a(this,t),this.isQuaternion=!0,this._x=e,this._y=n,this._z=r,this._w=i}return s(t,[{key:"x",get:function(){return this._x},set:function(e){this._x=e,this._onChangeCallback()}},{key:"y",get:function(){return this._y},set:function(e){this._y=e,this._onChangeCallback()}},{key:"z",get:function(){return this._z},set:function(e){this._z=e,this._onChangeCallback()}},{key:"w",get:function(){return this._w},set:function(e){this._w=e,this._onChangeCallback()}},{key:"set",value:function(e,t,n,r){return this._x=e,this._y=t,this._z=n,this._w=r,this._onChangeCallback(),this}},{key:"clone",value:function(){return new this.constructor(this._x,this._y,this._z,this._w)}},{key:"copy",value:function(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}},{key:"setFromEuler",value:function(e,t){var n=e._x,r=e._y,i=e._z,a=e._order,o=Math.cos,s=Math.sin,u=o(n/2),l=o(r/2),c=o(i/2),h=s(n/2),d=s(r/2),f=s(i/2);switch(a){case"XYZ":this._x=h*l*c+u*d*f,this._y=u*d*c-h*l*f,this._z=u*l*f+h*d*c,this._w=u*l*c-h*d*f;break;case"YXZ":this._x=h*l*c+u*d*f,this._y=u*d*c-h*l*f,this._z=u*l*f-h*d*c,this._w=u*l*c+h*d*f;break;case"ZXY":this._x=h*l*c-u*d*f,this._y=u*d*c+h*l*f,this._z=u*l*f+h*d*c,this._w=u*l*c-h*d*f;break;case"ZYX":this._x=h*l*c-u*d*f,this._y=u*d*c+h*l*f,this._z=u*l*f-h*d*c,this._w=u*l*c+h*d*f;break;case"YZX":this._x=h*l*c+u*d*f,this._y=u*d*c+h*l*f,this._z=u*l*f-h*d*c,this._w=u*l*c-h*d*f;break;case"XZY":this._x=h*l*c-u*d*f,this._y=u*d*c-h*l*f,this._z=u*l*f+h*d*c,this._w=u*l*c+h*d*f;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+a)}return!1!==t&&this._onChangeCallback(),this}},{key:"setFromAxisAngle",value:function(e,t){var n=t/2,r=Math.sin(n);return this._x=e.x*r,this._y=e.y*r,this._z=e.z*r,this._w=Math.cos(n),this._onChangeCallback(),this}},{key:"setFromRotationMatrix",value:function(e){var t=e.elements,n=t[0],r=t[4],i=t[8],a=t[1],o=t[5],s=t[9],u=t[2],l=t[6],c=t[10],h=n+o+c;if(h>0){var d=.5/Math.sqrt(h+1);this._w=.25/d,this._x=(l-s)*d,this._y=(i-u)*d,this._z=(a-r)*d}else if(n>o&&n>c){var f=2*Math.sqrt(1+n-o-c);this._w=(l-s)/f,this._x=.25*f,this._y=(r+a)/f,this._z=(i+u)/f}else if(o>c){var p=2*Math.sqrt(1+o-n-c);this._w=(i-u)/p,this._x=(r+a)/p,this._y=.25*p,this._z=(s+l)/p}else{var v=2*Math.sqrt(1+c-n-o);this._w=(a-r)/v,this._x=(i+u)/v,this._y=(s+l)/v,this._z=.25*v}return this._onChangeCallback(),this}},{key:"setFromUnitVectors",value:function(e,t){var n=e.dot(t)+1;return n<Number.EPSILON?(n=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=n):(this._x=0,this._y=-e.z,this._z=e.y,this._w=n)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=n),this.normalize()}},{key:"angleTo",value:function(e){return 2*Math.acos(Math.abs(sr(this.dot(e),-1,1)))}},{key:"rotateTowards",value:function(e,t){var n=this.angleTo(e);if(0===n)return this;var r=Math.min(1,t/n);return this.slerp(e,r),this}},{key:"identity",value:function(){return this.set(0,0,0,1)}},{key:"invert",value:function(){return this.conjugate()}},{key:"conjugate",value:function(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}},{key:"dot",value:function(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}},{key:"lengthSq",value:function(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}},{key:"length",value:function(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}},{key:"normalize",value:function(){var e=this.length();return 0===e?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}},{key:"multiply",value:function(e){return this.multiplyQuaternions(this,e)}},{key:"premultiply",value:function(e){return this.multiplyQuaternions(e,this)}},{key:"multiplyQuaternions",value:function(e,t){var n=e._x,r=e._y,i=e._z,a=e._w,o=t._x,s=t._y,u=t._z,l=t._w;return this._x=n*l+a*o+r*u-i*s,this._y=r*l+a*s+i*o-n*u,this._z=i*l+a*u+n*s-r*o,this._w=a*l-n*o-r*s-i*u,this._onChangeCallback(),this}},{key:"slerp",value:function(e,t){if(0===t)return this;if(1===t)return this.copy(e);var n=this._x,r=this._y,i=this._z,a=this._w,o=a*e._w+n*e._x+r*e._y+i*e._z;if(o<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,o=-o):this.copy(e),o>=1)return this._w=a,this._x=n,this._y=r,this._z=i,this;var s=1-o*o;if(s<=Number.EPSILON){var u=1-t;return this._w=u*a+t*this._w,this._x=u*n+t*this._x,this._y=u*r+t*this._y,this._z=u*i+t*this._z,this.normalize(),this._onChangeCallback(),this}var l=Math.sqrt(s),c=Math.atan2(l,o),h=Math.sin((1-t)*c)/l,d=Math.sin(t*c)/l;return this._w=a*h+this._w*d,this._x=n*h+this._x*d,this._y=r*h+this._y*d,this._z=i*h+this._z*d,this._onChangeCallback(),this}},{key:"slerpQuaternions",value:function(e,t,n){return this.copy(e).slerp(t,n)}},{key:"random",value:function(){var e=Math.random(),t=Math.sqrt(1-e),n=Math.sqrt(e),r=2*Math.PI*Math.random(),i=2*Math.PI*Math.random();return this.set(t*Math.cos(r),n*Math.sin(i),n*Math.cos(i),t*Math.sin(r))}},{key:"equals",value:function(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}},{key:"fromArray",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}},{key:"toArray",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}},{key:"fromBufferAttribute",value:function(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this}},{key:"toJSON",value:function(){return this.toArray()}},{key:"_onChange",value:function(e){return this._onChangeCallback=e,this}},{key:"_onChangeCallback",value:function(){}},{key:e,value:R().mark((function e(){return R().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._x;case 2:return e.next=4,this._y;case 4:return e.next=6,this._z;case 6:return e.next=8,this._w;case 8:case"end":return e.stop()}}),e,this)}))}],[{key:"slerpFlat",value:function(e,t,n,r,i,a,o){var s=n[r+0],u=n[r+1],l=n[r+2],c=n[r+3],h=i[a+0],d=i[a+1],f=i[a+2],p=i[a+3];if(0===o)return e[t+0]=s,e[t+1]=u,e[t+2]=l,void(e[t+3]=c);if(1===o)return e[t+0]=h,e[t+1]=d,e[t+2]=f,void(e[t+3]=p);if(c!==p||s!==h||u!==d||l!==f){var v=1-o,m=s*h+u*d+l*f+c*p,g=m>=0?1:-1,y=1-m*m;if(y>Number.EPSILON){var _=Math.sqrt(y),x=Math.atan2(_,m*g);v=Math.sin(v*x)/_,o=Math.sin(o*x)/_}var M=o*g;if(s=s*v+h*M,u=u*v+d*M,l=l*v+f*M,c=c*v+p*M,v===1-o){var S=1/Math.sqrt(s*s+u*u+l*l+c*c);s*=S,u*=S,l*=S,c*=S}}e[t]=s,e[t+1]=u,e[t+2]=l,e[t+3]=c}},{key:"multiplyQuaternionsFlat",value:function(e,t,n,r,i,a){var o=n[r],s=n[r+1],u=n[r+2],l=n[r+3],c=i[a],h=i[a+1],d=i[a+2],f=i[a+3];return e[t]=o*f+l*c+s*d-u*h,e[t+1]=s*f+l*h+u*c-o*d,e[t+2]=u*f+l*d+o*h-s*c,e[t+3]=l*f-o*c-s*h-u*d,e}}]),t}(Symbol.iterator),Yr=function(e){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;a(this,t),t.prototype.isVector3=!0,this.x=e,this.y=n,this.z=r}return s(t,[{key:"set",value:function(e,t,n){return void 0===n&&(n=this.z),this.x=e,this.y=t,this.z=n,this}},{key:"setScalar",value:function(e){return this.x=e,this.y=e,this.z=e,this}},{key:"setX",value:function(e){return this.x=e,this}},{key:"setY",value:function(e){return this.y=e,this}},{key:"setZ",value:function(e){return this.z=e,this}},{key:"setComponent",value:function(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("index is out of range: "+e)}return this}},{key:"getComponent",value:function(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}}},{key:"clone",value:function(){return new this.constructor(this.x,this.y,this.z)}},{key:"copy",value:function(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}},{key:"add",value:function(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}},{key:"addScalar",value:function(e){return this.x+=e,this.y+=e,this.z+=e,this}},{key:"addVectors",value:function(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}},{key:"addScaledVector",value:function(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}},{key:"sub",value:function(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}},{key:"subScalar",value:function(e){return this.x-=e,this.y-=e,this.z-=e,this}},{key:"subVectors",value:function(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}},{key:"multiply",value:function(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}},{key:"multiplyScalar",value:function(e){return this.x*=e,this.y*=e,this.z*=e,this}},{key:"multiplyVectors",value:function(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}},{key:"applyEuler",value:function(e){return this.applyQuaternion(Kr.setFromEuler(e))}},{key:"applyAxisAngle",value:function(e,t){return this.applyQuaternion(Kr.setFromAxisAngle(e,t))}},{key:"applyMatrix3",value:function(e){var t=this.x,n=this.y,r=this.z,i=e.elements;return this.x=i[0]*t+i[3]*n+i[6]*r,this.y=i[1]*t+i[4]*n+i[7]*r,this.z=i[2]*t+i[5]*n+i[8]*r,this}},{key:"applyNormalMatrix",value:function(e){return this.applyMatrix3(e).normalize()}},{key:"applyMatrix4",value:function(e){var t=this.x,n=this.y,r=this.z,i=e.elements,a=1/(i[3]*t+i[7]*n+i[11]*r+i[15]);return this.x=(i[0]*t+i[4]*n+i[8]*r+i[12])*a,this.y=(i[1]*t+i[5]*n+i[9]*r+i[13])*a,this.z=(i[2]*t+i[6]*n+i[10]*r+i[14])*a,this}},{key:"applyQuaternion",value:function(e){var t=this.x,n=this.y,r=this.z,i=e.x,a=e.y,o=e.z,s=e.w,u=s*t+a*r-o*n,l=s*n+o*t-i*r,c=s*r+i*n-a*t,h=-i*t-a*n-o*r;return this.x=u*s+h*-i+l*-o-c*-a,this.y=l*s+h*-a+c*-i-u*-o,this.z=c*s+h*-o+u*-a-l*-i,this}},{key:"project",value:function(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}},{key:"unproject",value:function(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}},{key:"transformDirection",value:function(e){var t=this.x,n=this.y,r=this.z,i=e.elements;return this.x=i[0]*t+i[4]*n+i[8]*r,this.y=i[1]*t+i[5]*n+i[9]*r,this.z=i[2]*t+i[6]*n+i[10]*r,this.normalize()}},{key:"divide",value:function(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}},{key:"divideScalar",value:function(e){return this.multiplyScalar(1/e)}},{key:"min",value:function(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}},{key:"max",value:function(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}},{key:"clamp",value:function(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this}},{key:"clampScalar",value:function(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this}},{key:"clampLength",value:function(e,t){var n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))}},{key:"floor",value:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}},{key:"ceil",value:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}},{key:"round",value:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}},{key:"roundToZero",value: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}},{key:"negate",value:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}},{key:"dot",value:function(e){return this.x*e.x+this.y*e.y+this.z*e.z}},{key:"lengthSq",value:function(){return this.x*this.x+this.y*this.y+this.z*this.z}},{key:"length",value:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}},{key:"manhattanLength",value:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}},{key:"normalize",value:function(){return this.divideScalar(this.length()||1)}},{key:"setLength",value:function(e){return this.normalize().multiplyScalar(e)}},{key:"lerp",value:function(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}},{key:"lerpVectors",value:function(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this}},{key:"cross",value:function(e){return this.crossVectors(this,e)}},{key:"crossVectors",value:function(e,t){var n=e.x,r=e.y,i=e.z,a=t.x,o=t.y,s=t.z;return this.x=r*s-i*o,this.y=i*a-n*s,this.z=n*o-r*a,this}},{key:"projectOnVector",value:function(e){var t=e.lengthSq();if(0===t)return this.set(0,0,0);var n=e.dot(this)/t;return this.copy(e).multiplyScalar(n)}},{key:"projectOnPlane",value:function(e){return Zr.copy(this).projectOnVector(e),this.sub(Zr)}},{key:"reflect",value:function(e){return this.sub(Zr.copy(e).multiplyScalar(2*this.dot(e)))}},{key:"angleTo",value:function(e){var t=Math.sqrt(this.lengthSq()*e.lengthSq());if(0===t)return Math.PI/2;var n=this.dot(e)/t;return Math.acos(sr(n,-1,1))}},{key:"distanceTo",value:function(e){return Math.sqrt(this.distanceToSquared(e))}},{key:"distanceToSquared",value:function(e){var t=this.x-e.x,n=this.y-e.y,r=this.z-e.z;return t*t+n*n+r*r}},{key:"manhattanDistanceTo",value:function(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}},{key:"setFromSpherical",value:function(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}},{key:"setFromSphericalCoords",value:function(e,t,n){var r=Math.sin(t)*e;return this.x=r*Math.sin(n),this.y=Math.cos(t)*e,this.z=r*Math.cos(n),this}},{key:"setFromCylindrical",value:function(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}},{key:"setFromCylindricalCoords",value:function(e,t,n){return this.x=e*Math.sin(t),this.y=n,this.z=e*Math.cos(t),this}},{key:"setFromMatrixPosition",value:function(e){var t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}},{key:"setFromMatrixScale",value:function(e){var t=this.setFromMatrixColumn(e,0).length(),n=this.setFromMatrixColumn(e,1).length(),r=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=r,this}},{key:"setFromMatrixColumn",value:function(e,t){return this.fromArray(e.elements,4*t)}},{key:"setFromMatrix3Column",value:function(e,t){return this.fromArray(e.elements,3*t)}},{key:"setFromEuler",value:function(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}},{key:"setFromColor",value:function(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}},{key:"equals",value:function(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}},{key:"fromArray",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}},{key:"toArray",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}},{key:"fromBufferAttribute",value:function(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}},{key:"random",value:function(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}},{key:"randomDirection",value:function(){var e=2*(Math.random()-.5),t=Math.random()*Math.PI*2,n=Math.sqrt(1-Math.pow(e,2));return this.x=n*Math.cos(t),this.y=n*Math.sin(t),this.z=e,this}},{key:e,value:R().mark((function e(){return R().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.x;case 2:return e.next=4,this.y;case 4:return e.next=6,this.z;case 6:case"end":return e.stop()}}),e,this)}))}]),t}(Symbol.iterator),Zr=new Yr,Kr=new qr,Jr=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Yr(1/0,1/0,1/0),n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Yr(-1/0,-1/0,-1/0);a(this,e),this.isBox3=!0,this.min=t,this.max=n}return s(e,[{key:"set",value:function(e,t){return this.min.copy(e),this.max.copy(t),this}},{key:"setFromArray",value:function(e){this.makeEmpty();for(var t=0,n=e.length;t<n;t+=3)this.expandByPoint($r.fromArray(e,t));return this}},{key:"setFromBufferAttribute",value:function(e){this.makeEmpty();for(var t=0,n=e.count;t<n;t++)this.expandByPoint($r.fromBufferAttribute(e,t));return this}},{key:"setFromPoints",value:function(e){this.makeEmpty();for(var t=0,n=e.length;t<n;t++)this.expandByPoint(e[t]);return this}},{key:"setFromCenterAndSize",value:function(e,t){var n=$r.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this}},{key:"setFromObject",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this.makeEmpty(),this.expandByObject(e,t)}},{key:"clone",value:function(){return(new this.constructor).copy(this)}},{key:"copy",value:function(e){return this.min.copy(e.min),this.max.copy(e.max),this}},{key:"makeEmpty",value: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}},{key:"isEmpty",value:function(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}},{key:"getCenter",value:function(e){return this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}},{key:"getSize",value:function(e){return this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)}},{key:"expandByPoint",value:function(e){return this.min.min(e),this.max.max(e),this}},{key:"expandByVector",value:function(e){return this.min.sub(e),this.max.add(e),this}},{key:"expandByScalar",value:function(e){return this.min.addScalar(-e),this.max.addScalar(e),this}},{key:"expandByObject",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(e.updateWorldMatrix(!1,!1),void 0!==e.boundingBox)null===e.boundingBox&&e.computeBoundingBox(),ei.copy(e.boundingBox),ei.applyMatrix4(e.matrixWorld),this.union(ei);else{var n=e.geometry;if(void 0!==n)if(t&&void 0!==n.attributes&&void 0!==n.attributes.position)for(var r=n.attributes.position,i=0,a=r.count;i<a;i++)$r.fromBufferAttribute(r,i).applyMatrix4(e.matrixWorld),this.expandByPoint($r);else null===n.boundingBox&&n.computeBoundingBox(),ei.copy(n.boundingBox),ei.applyMatrix4(e.matrixWorld),this.union(ei)}for(var o=e.children,s=0,u=o.length;s<u;s++)this.expandByObject(o[s],t);return this}},{key:"containsPoint",value:function(e){return!(e.x<this.min.x||e.x>this.max.x||e.y<this.min.y||e.y>this.max.y||e.z<this.min.z||e.z>this.max.z)}},{key:"containsBox",value:function(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}},{key:"getParameter",value:function(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}},{key:"intersectsBox",value:function(e){return!(e.max.x<this.min.x||e.min.x>this.max.x||e.max.y<this.min.y||e.min.y>this.max.y||e.max.z<this.min.z||e.min.z>this.max.z)}},{key:"intersectsSphere",value:function(e){return this.clampPoint(e.center,$r),$r.distanceToSquared(e.center)<=e.radius*e.radius}},{key:"intersectsPlane",value:function(e){var t,n;return e.normal.x>0?(t=e.normal.x*this.min.x,n=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,n=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,n+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,n+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,n+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,n+=e.normal.z*this.min.z),t<=-e.constant&&n>=-e.constant}},{key:"intersectsTriangle",value:function(e){if(this.isEmpty())return!1;this.getCenter(si),ui.subVectors(this.max,si),ti.subVectors(e.a,si),ni.subVectors(e.b,si),ri.subVectors(e.c,si),ii.subVectors(ni,ti),ai.subVectors(ri,ni),oi.subVectors(ti,ri);var t=[0,-ii.z,ii.y,0,-ai.z,ai.y,0,-oi.z,oi.y,ii.z,0,-ii.x,ai.z,0,-ai.x,oi.z,0,-oi.x,-ii.y,ii.x,0,-ai.y,ai.x,0,-oi.y,oi.x,0];return!!hi(t,ti,ni,ri,ui)&&(!!hi(t=[1,0,0,0,1,0,0,0,1],ti,ni,ri,ui)&&(li.crossVectors(ii,ai),hi(t=[li.x,li.y,li.z],ti,ni,ri,ui)))}},{key:"clampPoint",value:function(e,t){return t.copy(e).clamp(this.min,this.max)}},{key:"distanceToPoint",value:function(e){return this.clampPoint(e,$r).distanceTo(e)}},{key:"getBoundingSphere",value:function(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=.5*this.getSize($r).length()),e}},{key:"intersect",value:function(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}},{key:"union",value:function(e){return this.min.min(e.min),this.max.max(e.max),this}},{key:"applyMatrix4",value:function(e){return this.isEmpty()||(Qr[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),Qr[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),Qr[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),Qr[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),Qr[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),Qr[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),Qr[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),Qr[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(Qr)),this}},{key:"translate",value:function(e){return this.min.add(e),this.max.add(e),this}},{key:"equals",value:function(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}]),e}(),Qr=[new Yr,new Yr,new Yr,new Yr,new Yr,new Yr,new Yr,new Yr],$r=new Yr,ei=new Jr,ti=new Yr,ni=new Yr,ri=new Yr,ii=new Yr,ai=new Yr,oi=new Yr,si=new Yr,ui=new Yr,li=new Yr,ci=new Yr;function hi(e,t,n,r,i){for(var a=0,o=e.length-3;a<=o;a+=3){ci.fromArray(e,a);var s=i.x*Math.abs(ci.x)+i.y*Math.abs(ci.y)+i.z*Math.abs(ci.z),u=t.dot(ci),l=n.dot(ci),c=r.dot(ci);if(Math.max(-Math.max(u,l,c),Math.min(u,l,c))>s)return!1}return!0}var di=new Jr,fi=new Yr,pi=new Yr,vi=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Yr,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1;a(this,e),this.center=t,this.radius=n}return s(e,[{key:"set",value:function(e,t){return this.center.copy(e),this.radius=t,this}},{key:"setFromPoints",value:function(e,t){var n=this.center;void 0!==t?n.copy(t):di.setFromPoints(e).getCenter(n);for(var r=0,i=0,a=e.length;i<a;i++)r=Math.max(r,n.distanceToSquared(e[i]));return this.radius=Math.sqrt(r),this}},{key:"copy",value:function(e){return this.center.copy(e.center),this.radius=e.radius,this}},{key:"isEmpty",value:function(){return this.radius<0}},{key:"makeEmpty",value:function(){return this.center.set(0,0,0),this.radius=-1,this}},{key:"containsPoint",value:function(e){return e.distanceToSquared(this.center)<=this.radius*this.radius}},{key:"distanceToPoint",value:function(e){return e.distanceTo(this.center)-this.radius}},{key:"intersectsSphere",value:function(e){var t=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=t*t}},{key:"intersectsBox",value:function(e){return e.intersectsSphere(this)}},{key:"intersectsPlane",value:function(e){return Math.abs(e.distanceToPoint(this.center))<=this.radius}},{key:"clampPoint",value:function(e,t){var n=this.center.distanceToSquared(e);return t.copy(e),n>this.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}},{key:"getBoundingBox",value:function(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}},{key:"applyMatrix4",value:function(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}},{key:"translate",value:function(e){return this.center.add(e),this}},{key:"expandByPoint",value:function(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;fi.subVectors(e,this.center);var t=fi.lengthSq();if(t>this.radius*this.radius){var n=Math.sqrt(t),r=.5*(n-this.radius);this.center.addScaledVector(fi,r/n),this.radius+=r}return this}},{key:"union",value:function(e){return e.isEmpty()?this:this.isEmpty()?(this.copy(e),this):(!0===this.center.equals(e.center)?this.radius=Math.max(this.radius,e.radius):(pi.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(fi.copy(e.center).add(pi)),this.expandByPoint(fi.copy(e.center).sub(pi))),this)}},{key:"equals",value:function(e){return e.center.equals(this.center)&&e.radius===this.radius}},{key:"clone",value:function(){return(new this.constructor).copy(this)}}]),e}(),mi=new Yr,gi=new Yr,yi=new Yr,_i=new Yr,xi=new Yr,Mi=new Yr,Si=new Yr,bi=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Yr,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Yr(0,0,-1);a(this,e),this.origin=t,this.direction=n}return s(e,[{key:"set",value:function(e,t){return this.origin.copy(e),this.direction.copy(t),this}},{key:"copy",value:function(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}},{key:"at",value:function(e,t){return t.copy(this.origin).addScaledVector(this.direction,e)}},{key:"lookAt",value:function(e){return this.direction.copy(e).sub(this.origin).normalize(),this}},{key:"recast",value:function(e){return this.origin.copy(this.at(e,mi)),this}},{key:"closestPointToPoint",value:function(e,t){t.subVectors(e,this.origin);var n=t.dot(this.direction);return n<0?t.copy(this.origin):t.copy(this.origin).addScaledVector(this.direction,n)}},{key:"distanceToPoint",value:function(e){return Math.sqrt(this.distanceSqToPoint(e))}},{key:"distanceSqToPoint",value:function(e){var t=mi.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(mi.copy(this.origin).addScaledVector(this.direction,t),mi.distanceToSquared(e))}},{key:"distanceSqToSegment",value:function(e,t,n,r){gi.copy(e).add(t).multiplyScalar(.5),yi.copy(t).sub(e).normalize(),_i.copy(this.origin).sub(gi);var i,a,o,s,u=.5*e.distanceTo(t),l=-this.direction.dot(yi),c=_i.dot(this.direction),h=-_i.dot(yi),d=_i.lengthSq(),f=Math.abs(1-l*l);if(f>0)if(a=l*c-h,s=u*f,(i=l*h-c)>=0)if(a>=-s)if(a<=s){var p=1/f;o=(i*=p)*(i+l*(a*=p)+2*c)+a*(l*i+a+2*h)+d}else a=u,o=-(i=Math.max(0,-(l*a+c)))*i+a*(a+2*h)+d;else a=-u,o=-(i=Math.max(0,-(l*a+c)))*i+a*(a+2*h)+d;else a<=-s?o=-(i=Math.max(0,-(-l*u+c)))*i+(a=i>0?-u:Math.min(Math.max(-u,-h),u))*(a+2*h)+d:a<=s?(i=0,o=(a=Math.min(Math.max(-u,-h),u))*(a+2*h)+d):o=-(i=Math.max(0,-(l*u+c)))*i+(a=i>0?u:Math.min(Math.max(-u,-h),u))*(a+2*h)+d;else a=l>0?-u:u,o=-(i=Math.max(0,-(l*a+c)))*i+a*(a+2*h)+d;return n&&n.copy(this.origin).addScaledVector(this.direction,i),r&&r.copy(gi).addScaledVector(yi,a),o}},{key:"intersectSphere",value:function(e,t){mi.subVectors(e.center,this.origin);var n=mi.dot(this.direction),r=mi.dot(mi)-n*n,i=e.radius*e.radius;if(r>i)return null;var a=Math.sqrt(i-r),o=n-a,s=n+a;return s<0?null:o<0?this.at(s,t):this.at(o,t)}},{key:"intersectsSphere",value:function(e){return this.distanceSqToPoint(e.center)<=e.radius*e.radius}},{key:"distanceToPlane",value:function(e){var t=e.normal.dot(this.direction);if(0===t)return 0===e.distanceToPoint(this.origin)?0:null;var n=-(this.origin.dot(e.normal)+e.constant)/t;return n>=0?n:null}},{key:"intersectPlane",value:function(e,t){var n=this.distanceToPlane(e);return null===n?null:this.at(n,t)}},{key:"intersectsPlane",value:function(e){var t=e.distanceToPoint(this.origin);return 0===t||e.normal.dot(this.direction)*t<0}},{key:"intersectBox",value:function(e,t){var n,r,i,a,o,s,u=1/this.direction.x,l=1/this.direction.y,c=1/this.direction.z,h=this.origin;return u>=0?(n=(e.min.x-h.x)*u,r=(e.max.x-h.x)*u):(n=(e.max.x-h.x)*u,r=(e.min.x-h.x)*u),l>=0?(i=(e.min.y-h.y)*l,a=(e.max.y-h.y)*l):(i=(e.max.y-h.y)*l,a=(e.min.y-h.y)*l),n>a||i>r?null:((i>n||isNaN(n))&&(n=i),(a<r||isNaN(r))&&(r=a),c>=0?(o=(e.min.z-h.z)*c,s=(e.max.z-h.z)*c):(o=(e.max.z-h.z)*c,s=(e.min.z-h.z)*c),n>s||o>r?null:((o>n||n!=n)&&(n=o),(s<r||r!=r)&&(r=s),r<0?null:this.at(n>=0?n:r,t)))}},{key:"intersectsBox",value:function(e){return null!==this.intersectBox(e,mi)}},{key:"intersectTriangle",value:function(e,t,n,r,i){xi.subVectors(t,e),Mi.subVectors(n,e),Si.crossVectors(xi,Mi);var a,o=this.direction.dot(Si);if(o>0){if(r)return null;a=1}else{if(!(o<0))return null;a=-1,o=-o}_i.subVectors(this.origin,e);var s=a*this.direction.dot(Mi.crossVectors(_i,Mi));if(s<0)return null;var u=a*this.direction.dot(xi.cross(_i));if(u<0)return null;if(s+u>o)return null;var l=-a*_i.dot(Si);return l<0?null:this.at(l/o,i)}},{key:"applyMatrix4",value:function(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}},{key:"equals",value:function(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}},{key:"clone",value:function(){return(new this.constructor).copy(this)}}]),e}(),wi=function(){function e(t,n,r,i,o,s,u,l,c,h,d,f,p,v,m,g){a(this,e),e.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],void 0!==t&&this.set(t,n,r,i,o,s,u,l,c,h,d,f,p,v,m,g)}return s(e,[{key:"set",value:function(e,t,n,r,i,a,o,s,u,l,c,h,d,f,p,v){var m=this.elements;return m[0]=e,m[4]=t,m[8]=n,m[12]=r,m[1]=i,m[5]=a,m[9]=o,m[13]=s,m[2]=u,m[6]=l,m[10]=c,m[14]=h,m[3]=d,m[7]=f,m[11]=p,m[15]=v,this}},{key:"identity",value:function(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}},{key:"clone",value:function(){return(new e).fromArray(this.elements)}},{key:"copy",value:function(e){var t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],t[9]=n[9],t[10]=n[10],t[11]=n[11],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15],this}},{key:"copyPosition",value:function(e){var t=this.elements,n=e.elements;return t[12]=n[12],t[13]=n[13],t[14]=n[14],this}},{key:"setFromMatrix3",value:function(e){var t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}},{key:"extractBasis",value:function(e,t,n){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this}},{key:"makeBasis",value:function(e,t,n){return this.set(e.x,t.x,n.x,0,e.y,t.y,n.y,0,e.z,t.z,n.z,0,0,0,0,1),this}},{key:"extractRotation",value:function(e){var t=this.elements,n=e.elements,r=1/Ti.setFromMatrixColumn(e,0).length(),i=1/Ti.setFromMatrixColumn(e,1).length(),a=1/Ti.setFromMatrixColumn(e,2).length();return t[0]=n[0]*r,t[1]=n[1]*r,t[2]=n[2]*r,t[3]=0,t[4]=n[4]*i,t[5]=n[5]*i,t[6]=n[6]*i,t[7]=0,t[8]=n[8]*a,t[9]=n[9]*a,t[10]=n[10]*a,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}},{key:"makeRotationFromEuler",value:function(e){var t=this.elements,n=e.x,r=e.y,i=e.z,a=Math.cos(n),o=Math.sin(n),s=Math.cos(r),u=Math.sin(r),l=Math.cos(i),c=Math.sin(i);if("XYZ"===e.order){var h=a*l,d=a*c,f=o*l,p=o*c;t[0]=s*l,t[4]=-s*c,t[8]=u,t[1]=d+f*u,t[5]=h-p*u,t[9]=-o*s,t[2]=p-h*u,t[6]=f+d*u,t[10]=a*s}else if("YXZ"===e.order){var v=s*l,m=s*c,g=u*l,y=u*c;t[0]=v+y*o,t[4]=g*o-m,t[8]=a*u,t[1]=a*c,t[5]=a*l,t[9]=-o,t[2]=m*o-g,t[6]=y+v*o,t[10]=a*s}else if("ZXY"===e.order){var _=s*l,x=s*c,M=u*l,S=u*c;t[0]=_-S*o,t[4]=-a*c,t[8]=M+x*o,t[1]=x+M*o,t[5]=a*l,t[9]=S-_*o,t[2]=-a*u,t[6]=o,t[10]=a*s}else if("ZYX"===e.order){var b=a*l,w=a*c,T=o*l,E=o*c;t[0]=s*l,t[4]=T*u-w,t[8]=b*u+E,t[1]=s*c,t[5]=E*u+b,t[9]=w*u-T,t[2]=-u,t[6]=o*s,t[10]=a*s}else if("YZX"===e.order){var A=a*s,R=a*u,k=o*s,C=o*u;t[0]=s*l,t[4]=C-A*c,t[8]=k*c+R,t[1]=c,t[5]=a*l,t[9]=-o*l,t[2]=-u*l,t[6]=R*c+k,t[10]=A-C*c}else if("XZY"===e.order){var L=a*s,P=a*u,I=o*s,D=o*u;t[0]=s*l,t[4]=-c,t[8]=u*l,t[1]=L*c+D,t[5]=a*l,t[9]=P*c-I,t[2]=I*c-P,t[6]=o*l,t[10]=D*c+L}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}},{key:"makeRotationFromQuaternion",value:function(e){return this.compose(Ai,e,Ri)}},{key:"lookAt",value:function(e,t,n){var r=this.elements;return Li.subVectors(e,t),0===Li.lengthSq()&&(Li.z=1),Li.normalize(),ki.crossVectors(n,Li),0===ki.lengthSq()&&(1===Math.abs(n.z)?Li.x+=1e-4:Li.z+=1e-4,Li.normalize(),ki.crossVectors(n,Li)),ki.normalize(),Ci.crossVectors(Li,ki),r[0]=ki.x,r[4]=Ci.x,r[8]=Li.x,r[1]=ki.y,r[5]=Ci.y,r[9]=Li.y,r[2]=ki.z,r[6]=Ci.z,r[10]=Li.z,this}},{key:"multiply",value:function(e){return this.multiplyMatrices(this,e)}},{key:"premultiply",value:function(e){return this.multiplyMatrices(e,this)}},{key:"multiplyMatrices",value:function(e,t){var n=e.elements,r=t.elements,i=this.elements,a=n[0],o=n[4],s=n[8],u=n[12],l=n[1],c=n[5],h=n[9],d=n[13],f=n[2],p=n[6],v=n[10],m=n[14],g=n[3],y=n[7],_=n[11],x=n[15],M=r[0],S=r[4],b=r[8],w=r[12],T=r[1],E=r[5],A=r[9],R=r[13],k=r[2],C=r[6],L=r[10],P=r[14],I=r[3],D=r[7],U=r[11],O=r[15];return i[0]=a*M+o*T+s*k+u*I,i[4]=a*S+o*E+s*C+u*D,i[8]=a*b+o*A+s*L+u*U,i[12]=a*w+o*R+s*P+u*O,i[1]=l*M+c*T+h*k+d*I,i[5]=l*S+c*E+h*C+d*D,i[9]=l*b+c*A+h*L+d*U,i[13]=l*w+c*R+h*P+d*O,i[2]=f*M+p*T+v*k+m*I,i[6]=f*S+p*E+v*C+m*D,i[10]=f*b+p*A+v*L+m*U,i[14]=f*w+p*R+v*P+m*O,i[3]=g*M+y*T+_*k+x*I,i[7]=g*S+y*E+_*C+x*D,i[11]=g*b+y*A+_*L+x*U,i[15]=g*w+y*R+_*P+x*O,this}},{key:"multiplyScalar",value:function(e){var t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}},{key:"determinant",value:function(){var e=this.elements,t=e[0],n=e[4],r=e[8],i=e[12],a=e[1],o=e[5],s=e[9],u=e[13],l=e[2],c=e[6],h=e[10],d=e[14];return e[3]*(+i*s*c-r*u*c-i*o*h+n*u*h+r*o*d-n*s*d)+e[7]*(+t*s*d-t*u*h+i*a*h-r*a*d+r*u*l-i*s*l)+e[11]*(+t*u*c-t*o*d-i*a*c+n*a*d+i*o*l-n*u*l)+e[15]*(-r*o*l-t*s*c+t*o*h+r*a*c-n*a*h+n*s*l)}},{key:"transpose",value:function(){var e,t=this.elements;return e=t[1],t[1]=t[4],t[4]=e,e=t[2],t[2]=t[8],t[8]=e,e=t[6],t[6]=t[9],t[9]=e,e=t[3],t[3]=t[12],t[12]=e,e=t[7],t[7]=t[13],t[13]=e,e=t[11],t[11]=t[14],t[14]=e,this}},{key:"setPosition",value:function(e,t,n){var r=this.elements;return e.isVector3?(r[12]=e.x,r[13]=e.y,r[14]=e.z):(r[12]=e,r[13]=t,r[14]=n),this}},{key:"invert",value:function(){var e=this.elements,t=e[0],n=e[1],r=e[2],i=e[3],a=e[4],o=e[5],s=e[6],u=e[7],l=e[8],c=e[9],h=e[10],d=e[11],f=e[12],p=e[13],v=e[14],m=e[15],g=c*v*u-p*h*u+p*s*d-o*v*d-c*s*m+o*h*m,y=f*h*u-l*v*u-f*s*d+a*v*d+l*s*m-a*h*m,_=l*p*u-f*c*u+f*o*d-a*p*d-l*o*m+a*c*m,x=f*c*s-l*p*s-f*o*h+a*p*h+l*o*v-a*c*v,M=t*g+n*y+r*_+i*x;if(0===M)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);var S=1/M;return e[0]=g*S,e[1]=(p*h*i-c*v*i-p*r*d+n*v*d+c*r*m-n*h*m)*S,e[2]=(o*v*i-p*s*i+p*r*u-n*v*u-o*r*m+n*s*m)*S,e[3]=(c*s*i-o*h*i-c*r*u+n*h*u+o*r*d-n*s*d)*S,e[4]=y*S,e[5]=(l*v*i-f*h*i+f*r*d-t*v*d-l*r*m+t*h*m)*S,e[6]=(f*s*i-a*v*i-f*r*u+t*v*u+a*r*m-t*s*m)*S,e[7]=(a*h*i-l*s*i+l*r*u-t*h*u-a*r*d+t*s*d)*S,e[8]=_*S,e[9]=(f*c*i-l*p*i-f*n*d+t*p*d+l*n*m-t*c*m)*S,e[10]=(a*p*i-f*o*i+f*n*u-t*p*u-a*n*m+t*o*m)*S,e[11]=(l*o*i-a*c*i-l*n*u+t*c*u+a*n*d-t*o*d)*S,e[12]=x*S,e[13]=(l*p*r-f*c*r+f*n*h-t*p*h-l*n*v+t*c*v)*S,e[14]=(f*o*r-a*p*r-f*n*s+t*p*s+a*n*v-t*o*v)*S,e[15]=(a*c*r-l*o*r+l*n*s-t*c*s-a*n*h+t*o*h)*S,this}},{key:"scale",value:function(e){var t=this.elements,n=e.x,r=e.y,i=e.z;return t[0]*=n,t[4]*=r,t[8]*=i,t[1]*=n,t[5]*=r,t[9]*=i,t[2]*=n,t[6]*=r,t[10]*=i,t[3]*=n,t[7]*=r,t[11]*=i,this}},{key:"getMaxScaleOnAxis",value:function(){var e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],n=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],r=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,n,r))}},{key:"makeTranslation",value:function(e,t,n){return e.isVector3?this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1):this.set(1,0,0,e,0,1,0,t,0,0,1,n,0,0,0,1),this}},{key:"makeRotationX",value:function(e){var t=Math.cos(e),n=Math.sin(e);return this.set(1,0,0,0,0,t,-n,0,0,n,t,0,0,0,0,1),this}},{key:"makeRotationY",value:function(e){var t=Math.cos(e),n=Math.sin(e);return this.set(t,0,n,0,0,1,0,0,-n,0,t,0,0,0,0,1),this}},{key:"makeRotationZ",value:function(e){var t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,0,n,t,0,0,0,0,1,0,0,0,0,1),this}},{key:"makeRotationAxis",value:function(e,t){var n=Math.cos(t),r=Math.sin(t),i=1-n,a=e.x,o=e.y,s=e.z,u=i*a,l=i*o;return this.set(u*a+n,u*o-r*s,u*s+r*o,0,u*o+r*s,l*o+n,l*s-r*a,0,u*s-r*o,l*s+r*a,i*s*s+n,0,0,0,0,1),this}},{key:"makeScale",value:function(e,t,n){return this.set(e,0,0,0,0,t,0,0,0,0,n,0,0,0,0,1),this}},{key:"makeShear",value:function(e,t,n,r,i,a){return this.set(1,n,i,0,e,1,a,0,t,r,1,0,0,0,0,1),this}},{key:"compose",value:function(e,t,n){var r=this.elements,i=t._x,a=t._y,o=t._z,s=t._w,u=i+i,l=a+a,c=o+o,h=i*u,d=i*l,f=i*c,p=a*l,v=a*c,m=o*c,g=s*u,y=s*l,_=s*c,x=n.x,M=n.y,S=n.z;return r[0]=(1-(p+m))*x,r[1]=(d+_)*x,r[2]=(f-y)*x,r[3]=0,r[4]=(d-_)*M,r[5]=(1-(h+m))*M,r[6]=(v+g)*M,r[7]=0,r[8]=(f+y)*S,r[9]=(v-g)*S,r[10]=(1-(h+p))*S,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,this}},{key:"decompose",value:function(e,t,n){var r=this.elements,i=Ti.set(r[0],r[1],r[2]).length(),a=Ti.set(r[4],r[5],r[6]).length(),o=Ti.set(r[8],r[9],r[10]).length();this.determinant()<0&&(i=-i),e.x=r[12],e.y=r[13],e.z=r[14],Ei.copy(this);var s=1/i,u=1/a,l=1/o;return Ei.elements[0]*=s,Ei.elements[1]*=s,Ei.elements[2]*=s,Ei.elements[4]*=u,Ei.elements[5]*=u,Ei.elements[6]*=u,Ei.elements[8]*=l,Ei.elements[9]*=l,Ei.elements[10]*=l,t.setFromRotationMatrix(Ei),n.x=i,n.y=a,n.z=o,this}},{key:"makePerspective",value:function(e,t,n,r,i,a){var o,s,u=arguments.length>6&&void 0!==arguments[6]?arguments[6]:$n,l=this.elements,c=2*i/(t-e),h=2*i/(n-r),d=(t+e)/(t-e),f=(n+r)/(n-r);if(u===$n)o=-(a+i)/(a-i),s=-2*a*i/(a-i);else{if(u!==er)throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+u);o=-a/(a-i),s=-a*i/(a-i)}return l[0]=c,l[4]=0,l[8]=d,l[12]=0,l[1]=0,l[5]=h,l[9]=f,l[13]=0,l[2]=0,l[6]=0,l[10]=o,l[14]=s,l[3]=0,l[7]=0,l[11]=-1,l[15]=0,this}},{key:"makeOrthographic",value:function(e,t,n,r,i,a){var o,s,u=arguments.length>6&&void 0!==arguments[6]?arguments[6]:$n,l=this.elements,c=1/(t-e),h=1/(n-r),d=1/(a-i),f=(t+e)*c,p=(n+r)*h;if(u===$n)o=(a+i)*d,s=-2*d;else{if(u!==er)throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+u);o=i*d,s=-1*d}return l[0]=2*c,l[4]=0,l[8]=0,l[12]=-f,l[1]=0,l[5]=2*h,l[9]=0,l[13]=-p,l[2]=0,l[6]=0,l[10]=s,l[14]=-o,l[3]=0,l[7]=0,l[11]=0,l[15]=1,this}},{key:"equals",value:function(e){for(var t=this.elements,n=e.elements,r=0;r<16;r++)if(t[r]!==n[r])return!1;return!0}},{key:"fromArray",value:function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=0;n<16;n++)this.elements[n]=e[n+t];return this}},{key:"toArray",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e[t+9]=n[9],e[t+10]=n[10],e[t+11]=n[11],e[t+12]=n[12],e[t+13]=n[13],e[t+14]=n[14],e[t+15]=n[15],e}}]),e}(),Ti=new Yr,Ei=new wi,Ai=new Yr(0,0,0),Ri=new Yr(1,1,1),ki=new Yr,Ci=new Yr,Li=new Yr,Pi=new wi,Ii=new qr,Di=function(e){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:t.DEFAULT_ORDER;a(this,t),this.isEuler=!0,this._x=e,this._y=n,this._z=r,this._order=i}return s(t,[{key:"x",get:function(){return this._x},set:function(e){this._x=e,this._onChangeCallback()}},{key:"y",get:function(){return this._y},set:function(e){this._y=e,this._onChangeCallback()}},{key:"z",get:function(){return this._z},set:function(e){this._z=e,this._onChangeCallback()}},{key:"order",get:function(){return this._order},set:function(e){this._order=e,this._onChangeCallback()}},{key:"set",value:function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:this._order;return this._x=e,this._y=t,this._z=n,this._order=r,this._onChangeCallback(),this}},{key:"clone",value:function(){return new this.constructor(this._x,this._y,this._z,this._order)}},{key:"copy",value:function(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}},{key:"setFromRotationMatrix",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this._order,n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],r=e.elements,i=r[0],a=r[4],o=r[8],s=r[1],u=r[5],l=r[9],c=r[2],h=r[6],d=r[10];switch(t){case"XYZ":this._y=Math.asin(sr(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-l,d),this._z=Math.atan2(-a,i)):(this._x=Math.atan2(h,u),this._z=0);break;case"YXZ":this._x=Math.asin(-sr(l,-1,1)),Math.abs(l)<.9999999?(this._y=Math.atan2(o,d),this._z=Math.atan2(s,u)):(this._y=Math.atan2(-c,i),this._z=0);break;case"ZXY":this._x=Math.asin(sr(h,-1,1)),Math.abs(h)<.9999999?(this._y=Math.atan2(-c,d),this._z=Math.atan2(-a,u)):(this._y=0,this._z=Math.atan2(s,i));break;case"ZYX":this._y=Math.asin(-sr(c,-1,1)),Math.abs(c)<.9999999?(this._x=Math.atan2(h,d),this._z=Math.atan2(s,i)):(this._x=0,this._z=Math.atan2(-a,u));break;case"YZX":this._z=Math.asin(sr(s,-1,1)),Math.abs(s)<.9999999?(this._x=Math.atan2(-l,u),this._y=Math.atan2(-c,i)):(this._x=0,this._y=Math.atan2(o,d));break;case"XZY":this._z=Math.asin(-sr(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(h,u),this._y=Math.atan2(o,i)):(this._x=Math.atan2(-l,d),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,!0===n&&this._onChangeCallback(),this}},{key:"setFromQuaternion",value:function(e,t,n){return Pi.makeRotationFromQuaternion(e),this.setFromRotationMatrix(Pi,t,n)}},{key:"setFromVector3",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this._order;return this.set(e.x,e.y,e.z,t)}},{key:"reorder",value:function(e){return Ii.setFromEuler(this),this.setFromQuaternion(Ii,e)}},{key:"equals",value:function(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}},{key:"fromArray",value:function(e){return this._x=e[0],this._y=e[1],this._z=e[2],void 0!==e[3]&&(this._order=e[3]),this._onChangeCallback(),this}},{key:"toArray",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e}},{key:"_onChange",value:function(e){return this._onChangeCallback=e,this}},{key:"_onChangeCallback",value:function(){}},{key:e,value:R().mark((function e(){return R().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._x;case 2:return e.next=4,this._y;case 4:return e.next=6,this._z;case 6:return e.next=8,this._order;case 8:case"end":return e.stop()}}),e,this)}))}]),t}(Symbol.iterator);Di.DEFAULT_ORDER="XYZ";var Ui=function(){function e(){a(this,e),this.mask=1}return s(e,[{key:"set",value:function(e){this.mask=(1<<e|0)>>>0}},{key:"enable",value:function(e){this.mask|=1<<e|0}},{key:"enableAll",value:function(){this.mask=-1}},{key:"toggle",value:function(e){this.mask^=1<<e|0}},{key:"disable",value:function(e){this.mask&=~(1<<e|0)}},{key:"disableAll",value:function(){this.mask=0}},{key:"test",value:function(e){return 0!=(this.mask&e.mask)}},{key:"isEnabled",value:function(e){return 0!=(this.mask&(1<<e|0))}}]),e}(),Oi=0,Ni=new Yr,Fi=new qr,Bi=new wi,zi=new Yr,Hi=new Yr,Gi=new Yr,Vi=new qr,Wi=new Yr(1,0,0),ji=new Yr(0,1,0),Xi=new Yr(0,0,1),qi={type:"added"},Yi={type:"removed"},Zi=function(e){w(n,e);var t=E(n);function n(){var e;a(this,n),(e=t.call(this)).isObject3D=!0,Object.defineProperty(S(e),"id",{value:Oi++}),e.uuid=or(),e.name="",e.type="Object3D",e.parent=null,e.children=[],e.up=n.DEFAULT_UP.clone();var r=new Yr,i=new Di,o=new qr,s=new Yr(1,1,1);return i._onChange((function(){o.setFromEuler(i,!1)})),o._onChange((function(){i.setFromQuaternion(o,void 0,!1)})),Object.defineProperties(S(e),{position:{configurable:!0,enumerable:!0,value:r},rotation:{configurable:!0,enumerable:!0,value:i},quaternion:{configurable:!0,enumerable:!0,value:o},scale:{configurable:!0,enumerable:!0,value:s},modelViewMatrix:{value:new wi},normalMatrix:{value:new gr}}),e.matrix=new wi,e.matrixWorld=new wi,e.matrixAutoUpdate=n.DEFAULT_MATRIX_AUTO_UPDATE,e.matrixWorldNeedsUpdate=!1,e.matrixWorldAutoUpdate=n.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,e.layers=new Ui,e.visible=!0,e.castShadow=!1,e.receiveShadow=!1,e.frustumCulled=!0,e.renderOrder=0,e.animations=[],e.userData={},e}return s(n,[{key:"onBeforeRender",value:function(){}},{key:"onAfterRender",value:function(){}},{key:"applyMatrix4",value:function(e){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(e),this.matrix.decompose(this.position,this.quaternion,this.scale)}},{key:"applyQuaternion",value:function(e){return this.quaternion.premultiply(e),this}},{key:"setRotationFromAxisAngle",value:function(e,t){this.quaternion.setFromAxisAngle(e,t)}},{key:"setRotationFromEuler",value:function(e){this.quaternion.setFromEuler(e,!0)}},{key:"setRotationFromMatrix",value:function(e){this.quaternion.setFromRotationMatrix(e)}},{key:"setRotationFromQuaternion",value:function(e){this.quaternion.copy(e)}},{key:"rotateOnAxis",value:function(e,t){return Fi.setFromAxisAngle(e,t),this.quaternion.multiply(Fi),this}},{key:"rotateOnWorldAxis",value:function(e,t){return Fi.setFromAxisAngle(e,t),this.quaternion.premultiply(Fi),this}},{key:"rotateX",value:function(e){return this.rotateOnAxis(Wi,e)}},{key:"rotateY",value:function(e){return this.rotateOnAxis(ji,e)}},{key:"rotateZ",value:function(e){return this.rotateOnAxis(Xi,e)}},{key:"translateOnAxis",value:function(e,t){return Ni.copy(e).applyQuaternion(this.quaternion),this.position.add(Ni.multiplyScalar(t)),this}},{key:"translateX",value:function(e){return this.translateOnAxis(Wi,e)}},{key:"translateY",value:function(e){return this.translateOnAxis(ji,e)}},{key:"translateZ",value:function(e){return this.translateOnAxis(Xi,e)}},{key:"localToWorld",value:function(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}},{key:"worldToLocal",value:function(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(Bi.copy(this.matrixWorld).invert())}},{key:"lookAt",value:function(e,t,n){e.isVector3?zi.copy(e):zi.set(e,t,n);var r=this.parent;this.updateWorldMatrix(!0,!1),Hi.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?Bi.lookAt(Hi,zi,this.up):Bi.lookAt(zi,Hi,this.up),this.quaternion.setFromRotationMatrix(Bi),r&&(Bi.extractRotation(r.matrixWorld),Fi.setFromRotationMatrix(Bi),this.quaternion.premultiply(Fi.invert()))}},{key:"add",value:function(e){if(arguments.length>1){for(var t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return e===this?(console.error("THREE.Object3D.add: object can't be added as a child of itself.",e),this):(e&&e.isObject3D?(null!==e.parent&&e.parent.remove(e),e.parent=this,this.children.push(e),e.dispatchEvent(qi)):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",e),this)}},{key:"remove",value:function(e){if(arguments.length>1){for(var t=0;t<arguments.length;t++)this.remove(arguments[t]);return this}var n=this.children.indexOf(e);return-1!==n&&(e.parent=null,this.children.splice(n,1),e.dispatchEvent(Yi)),this}},{key:"removeFromParent",value:function(){var e=this.parent;return null!==e&&e.remove(this),this}},{key:"clear",value:function(){for(var e=0;e<this.children.length;e++){var t=this.children[e];t.parent=null,t.dispatchEvent(Yi)}return this.children.length=0,this}},{key:"attach",value:function(e){return this.updateWorldMatrix(!0,!1),Bi.copy(this.matrixWorld).invert(),null!==e.parent&&(e.parent.updateWorldMatrix(!0,!1),Bi.multiply(e.parent.matrixWorld)),e.applyMatrix4(Bi),this.add(e),e.updateWorldMatrix(!1,!0),this}},{key:"getObjectById",value:function(e){return this.getObjectByProperty("id",e)}},{key:"getObjectByName",value:function(e){return this.getObjectByProperty("name",e)}},{key:"getObjectByProperty",value:function(e,t){if(this[e]===t)return this;for(var n=0,r=this.children.length;n<r;n++){var i=this.children[n].getObjectByProperty(e,t);if(void 0!==i)return i}}},{key:"getObjectsByProperty",value:function(e,t){var n=[];this[e]===t&&n.push(this);for(var r=0,i=this.children.length;r<i;r++){var a=this.children[r].getObjectsByProperty(e,t);a.length>0&&(n=n.concat(a))}return n}},{key:"getWorldPosition",value:function(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}},{key:"getWorldQuaternion",value:function(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Hi,e,Gi),e}},{key:"getWorldScale",value:function(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Hi,Vi,e),e}},{key:"getWorldDirection",value:function(e){this.updateWorldMatrix(!0,!1);var t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()}},{key:"raycast",value:function(){}},{key:"traverse",value:function(e){e(this);for(var t=this.children,n=0,r=t.length;n<r;n++)t[n].traverse(e)}},{key:"traverseVisible",value:function(e){if(!1!==this.visible){e(this);for(var t=this.children,n=0,r=t.length;n<r;n++)t[n].traverseVisible(e)}}},{key:"traverseAncestors",value:function(e){var t=this.parent;null!==t&&(e(t),t.traverseAncestors(e))}},{key:"updateMatrix",value:function(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0}},{key:"updateMatrixWorld",value:function(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorldNeedsUpdate=!1,e=!0);for(var t=this.children,n=0,r=t.length;n<r;n++){var i=t[n];!0!==i.matrixWorldAutoUpdate&&!0!==e||i.updateMatrixWorld(e)}}},{key:"updateWorldMatrix",value:function(e,t){var n=this.parent;if(!0===e&&null!==n&&!0===n.matrixWorldAutoUpdate&&n.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),!0===t)for(var r=this.children,i=0,a=r.length;i<a;i++){var o=r[i];!0===o.matrixWorldAutoUpdate&&o.updateWorldMatrix(!1,!0)}}},{key:"toJSON",value:function(e){var t=void 0===e||"string"==typeof e,n={};t&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},n.metadata={version:4.6,type:"Object",generator:"Object3D.toJSON"});var r={};function i(t,n){return void 0===t[n.uuid]&&(t[n.uuid]=n.toJSON(e)),n.uuid}if(r.uuid=this.uuid,r.type=this.type,""!==this.name&&(r.name=this.name),!0===this.castShadow&&(r.castShadow=!0),!0===this.receiveShadow&&(r.receiveShadow=!0),!1===this.visible&&(r.visible=!1),!1===this.frustumCulled&&(r.frustumCulled=!1),0!==this.renderOrder&&(r.renderOrder=this.renderOrder),Object.keys(this.userData).length>0&&(r.userData=this.userData),r.layers=this.layers.mask,r.matrix=this.matrix.toArray(),r.up=this.up.toArray(),!1===this.matrixAutoUpdate&&(r.matrixAutoUpdate=!1),this.isInstancedMesh&&(r.type="InstancedMesh",r.count=this.count,r.instanceMatrix=this.instanceMatrix.toJSON(),null!==this.instanceColor&&(r.instanceColor=this.instanceColor.toJSON())),this.isScene)this.background&&(this.background.isColor?r.background=this.background.toJSON():this.background.isTexture&&(r.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&!0!==this.environment.isRenderTargetTexture&&(r.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){r.geometry=i(e.geometries,this.geometry);var a=this.geometry.parameters;if(void 0!==a&&void 0!==a.shapes){var o=a.shapes;if(Array.isArray(o))for(var s=0,u=o.length;s<u;s++){var l=o[s];i(e.shapes,l)}else i(e.shapes,o)}}if(this.isSkinnedMesh&&(r.bindMode=this.bindMode,r.bindMatrix=this.bindMatrix.toArray(),void 0!==this.skeleton&&(i(e.skeletons,this.skeleton),r.skeleton=this.skeleton.uuid)),void 0!==this.material)if(Array.isArray(this.material)){for(var c=[],h=0,d=this.material.length;h<d;h++)c.push(i(e.materials,this.material[h]));r.material=c}else r.material=i(e.materials,this.material);if(this.children.length>0){r.children=[];for(var f=0;f<this.children.length;f++)r.children.push(this.children[f].toJSON(e).object)}if(this.animations.length>0){r.animations=[];for(var p=0;p<this.animations.length;p++){var v=this.animations[p];r.animations.push(i(e.animations,v))}}if(t){var m=w(e.geometries),g=w(e.materials),y=w(e.textures),_=w(e.images),x=w(e.shapes),M=w(e.skeletons),S=w(e.animations),b=w(e.nodes);m.length>0&&(n.geometries=m),g.length>0&&(n.materials=g),y.length>0&&(n.textures=y),_.length>0&&(n.images=_),x.length>0&&(n.shapes=x),M.length>0&&(n.skeletons=M),S.length>0&&(n.animations=S),b.length>0&&(n.nodes=b)}return n.object=r,n;function w(e){var t=[];for(var n in e){var r=e[n];delete r.metadata,t.push(r)}return t}}},{key:"clone",value:function(e){return(new this.constructor).copy(this,e)}},{key:"copy",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),!0===t)for(var n=0;n<e.children.length;n++){var r=e.children[n];this.add(r.clone())}return this}}]),n}(tr);Zi.DEFAULT_UP=new Yr(0,1,0),Zi.DEFAULT_MATRIX_AUTO_UPDATE=!0,Zi.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;var Ki=new Yr,Ji=new Yr,Qi=new Yr,$i=new Yr,ea=new Yr,ta=new Yr,na=new Yr,ra=new Yr,ia=new Yr,aa=new Yr,oa=!1,sa=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Yr,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Yr,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:new Yr;a(this,e),this.a=t,this.b=n,this.c=r}return s(e,[{key:"set",value:function(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this}},{key:"setFromPointsAndIndices",value:function(e,t,n,r){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[r]),this}},{key:"setFromAttributeAndIndices",value:function(e,t,n,r){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,n),this.c.fromBufferAttribute(e,r),this}},{key:"clone",value:function(){return(new this.constructor).copy(this)}},{key:"copy",value:function(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}},{key:"getArea",value:function(){return Ki.subVectors(this.c,this.b),Ji.subVectors(this.a,this.b),.5*Ki.cross(Ji).length()}},{key:"getMidpoint",value:function(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}},{key:"getNormal",value:function(t){return e.getNormal(this.a,this.b,this.c,t)}},{key:"getPlane",value:function(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}},{key:"getBarycoord",value:function(t,n){return e.getBarycoord(t,this.a,this.b,this.c,n)}},{key:"getUV",value:function(t,n,r,i,a){return!1===oa&&(console.warn("THREE.Triangle.getUV() has been renamed to THREE.Triangle.getInterpolation()."),oa=!0),e.getInterpolation(t,this.a,this.b,this.c,n,r,i,a)}},{key:"getInterpolation",value:function(t,n,r,i,a){return e.getInterpolation(t,this.a,this.b,this.c,n,r,i,a)}},{key:"containsPoint",value:function(t){return e.containsPoint(t,this.a,this.b,this.c)}},{key:"isFrontFacing",value:function(t){return e.isFrontFacing(this.a,this.b,this.c,t)}},{key:"intersectsBox",value:function(e){return e.intersectsTriangle(this)}},{key:"closestPointToPoint",value:function(e,t){var n,r,i=this.a,a=this.b,o=this.c;ea.subVectors(a,i),ta.subVectors(o,i),ra.subVectors(e,i);var s=ea.dot(ra),u=ta.dot(ra);if(s<=0&&u<=0)return t.copy(i);ia.subVectors(e,a);var l=ea.dot(ia),c=ta.dot(ia);if(l>=0&&c<=l)return t.copy(a);var h=s*c-l*u;if(h<=0&&s>=0&&l<=0)return n=s/(s-l),t.copy(i).addScaledVector(ea,n);aa.subVectors(e,o);var d=ea.dot(aa),f=ta.dot(aa);if(f>=0&&d<=f)return t.copy(o);var p=d*u-s*f;if(p<=0&&u>=0&&f<=0)return r=u/(u-f),t.copy(i).addScaledVector(ta,r);var v=l*f-d*c;if(v<=0&&c-l>=0&&d-f>=0)return na.subVectors(o,a),r=(c-l)/(c-l+(d-f)),t.copy(a).addScaledVector(na,r);var m=1/(v+p+h);return n=p*m,r=h*m,t.copy(i).addScaledVector(ea,n).addScaledVector(ta,r)}},{key:"equals",value:function(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}],[{key:"getNormal",value:function(e,t,n,r){r.subVectors(n,t),Ki.subVectors(e,t),r.cross(Ki);var i=r.lengthSq();return i>0?r.multiplyScalar(1/Math.sqrt(i)):r.set(0,0,0)}},{key:"getBarycoord",value:function(e,t,n,r,i){Ki.subVectors(r,t),Ji.subVectors(n,t),Qi.subVectors(e,t);var a=Ki.dot(Ki),o=Ki.dot(Ji),s=Ki.dot(Qi),u=Ji.dot(Ji),l=Ji.dot(Qi),c=a*u-o*o;if(0===c)return i.set(-2,-1,-1);var h=1/c,d=(u*s-o*l)*h,f=(a*l-o*s)*h;return i.set(1-d-f,f,d)}},{key:"containsPoint",value:function(e,t,n,r){return this.getBarycoord(e,t,n,r,$i),$i.x>=0&&$i.y>=0&&$i.x+$i.y<=1}},{key:"getUV",value:function(e,t,n,r,i,a,o,s){return!1===oa&&(console.warn("THREE.Triangle.getUV() has been renamed to THREE.Triangle.getInterpolation()."),oa=!0),this.getInterpolation(e,t,n,r,i,a,o,s)}},{key:"getInterpolation",value:function(e,t,n,r,i,a,o,s){return this.getBarycoord(e,t,n,r,$i),s.setScalar(0),s.addScaledVector(i,$i.x),s.addScaledVector(a,$i.y),s.addScaledVector(o,$i.z),s}},{key:"isFrontFacing",value:function(e,t,n,r){return Ki.subVectors(n,t),Ji.subVectors(e,t),Ki.cross(Ji).dot(r)<0}}]),e}(),ua=0,la=function(e){w(n,e);var t=E(n);function n(){var e;return a(this,n),(e=t.call(this)).isMaterial=!0,Object.defineProperty(S(e),"id",{value:ua++}),e.uuid=or(),e.name="",e.type="Material",e.blending=j,e.side=z,e.vertexColors=!1,e.opacity=1,e.transparent=!1,e.alphaHash=!1,e.blendSrc=ae,e.blendDst=oe,e.blendEquation=K,e.blendSrcAlpha=null,e.blendDstAlpha=null,e.blendEquationAlpha=null,e.depthFunc=ve,e.depthTest=!0,e.depthWrite=!0,e.stencilWriteMask=255,e.stencilFunc=Pn,e.stencilRef=0,e.stencilFuncMask=255,e.stencilFail=yn,e.stencilZFail=yn,e.stencilZPass=yn,e.stencilWrite=!1,e.clippingPlanes=null,e.clipIntersection=!1,e.clipShadows=!1,e.shadowSide=null,e.colorWrite=!0,e.precision=null,e.polygonOffset=!1,e.polygonOffsetFactor=0,e.polygonOffsetUnits=0,e.dithering=!1,e.alphaToCoverage=!1,e.premultipliedAlpha=!1,e.forceSinglePass=!1,e.visible=!0,e.toneMapped=!0,e.userData={},e.version=0,e._alphaTest=0,e}return s(n,[{key:"alphaTest",get:function(){return this._alphaTest},set:function(e){this._alphaTest>0!=e>0&&this.version++,this._alphaTest=e}},{key:"onBuild",value:function(){}},{key:"onBeforeRender",value:function(){}},{key:"onBeforeCompile",value:function(){}},{key:"customProgramCacheKey",value:function(){return this.onBeforeCompile.toString()}},{key:"setValues",value:function(e){if(void 0!==e)for(var t in e){var n=e[t];if(void 0!==n){var r=this[t];void 0!==r?r&&r.isColor?r.set(n):r&&r.isVector3&&n&&n.isVector3?r.copy(n):this[t]=n:console.warn("THREE.Material: '".concat(t,"' is not a property of THREE.").concat(this.type,"."))}else console.warn("THREE.Material: parameter '".concat(t,"' has value of undefined."))}}},{key:"toJSON",value:function(e){var t=void 0===e||"string"==typeof e;t&&(e={textures:{},images:{}});var n={metadata:{version:4.6,type:"Material",generator:"Material.toJSON"}};function r(e){var t=[];for(var n in e){var r=e[n];delete r.metadata,t.push(r)}return t}if(n.uuid=this.uuid,n.type=this.type,""!==this.name&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),void 0!==this.roughness&&(n.roughness=this.roughness),void 0!==this.metalness&&(n.metalness=this.metalness),void 0!==this.sheen&&(n.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(n.sheenColor=this.sheenColor.getHex()),void 0!==this.sheenRoughness&&(n.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.emissiveIntensity&&1!==this.emissiveIntensity&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),void 0!==this.specularIntensity&&(n.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(n.specularColor=this.specularColor.getHex()),void 0!==this.shininess&&(n.shininess=this.shininess),void 0!==this.clearcoat&&(n.clearcoat=this.clearcoat),void 0!==this.clearcoatRoughness&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),void 0!==this.iridescence&&(n.iridescence=this.iridescence),void 0!==this.iridescenceIOR&&(n.iridescenceIOR=this.iridescenceIOR),void 0!==this.iridescenceThicknessRange&&(n.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(n.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(n.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),void 0!==this.anisotropy&&(n.anisotropy=this.anisotropy),void 0!==this.anisotropyRotation&&(n.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(n.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(e).uuid,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(e).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(e).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(e).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(e).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(n.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(n.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(e).uuid,void 0!==this.combine&&(n.combine=this.combine)),void 0!==this.envMapIntensity&&(n.envMapIntensity=this.envMapIntensity),void 0!==this.reflectivity&&(n.reflectivity=this.reflectivity),void 0!==this.refractionRatio&&(n.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(e).uuid),void 0!==this.transmission&&(n.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(n.transmissionMap=this.transmissionMap.toJSON(e).uuid),void 0!==this.thickness&&(n.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(n.thicknessMap=this.thicknessMap.toJSON(e).uuid),void 0!==this.attenuationDistance&&this.attenuationDistance!==1/0&&(n.attenuationDistance=this.attenuationDistance),void 0!==this.attenuationColor&&(n.attenuationColor=this.attenuationColor.getHex()),void 0!==this.size&&(n.size=this.size),null!==this.shadowSide&&(n.shadowSide=this.shadowSide),void 0!==this.sizeAttenuation&&(n.sizeAttenuation=this.sizeAttenuation),this.blending!==j&&(n.blending=this.blending),this.side!==z&&(n.side=this.side),this.vertexColors&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),!0===this.transparent&&(n.transparent=this.transparent),n.depthFunc=this.depthFunc,n.depthTest=this.depthTest,n.depthWrite=this.depthWrite,n.colorWrite=this.colorWrite,n.stencilWrite=this.stencilWrite,n.stencilWriteMask=this.stencilWriteMask,n.stencilFunc=this.stencilFunc,n.stencilRef=this.stencilRef,n.stencilFuncMask=this.stencilFuncMask,n.stencilFail=this.stencilFail,n.stencilZFail=this.stencilZFail,n.stencilZPass=this.stencilZPass,void 0!==this.rotation&&0!==this.rotation&&(n.rotation=this.rotation),!0===this.polygonOffset&&(n.polygonOffset=!0),0!==this.polygonOffsetFactor&&(n.polygonOffsetFactor=this.polygonOffsetFactor),0!==this.polygonOffsetUnits&&(n.polygonOffsetUnits=this.polygonOffsetUnits),void 0!==this.linewidth&&1!==this.linewidth&&(n.linewidth=this.linewidth),void 0!==this.dashSize&&(n.dashSize=this.dashSize),void 0!==this.gapSize&&(n.gapSize=this.gapSize),void 0!==this.scale&&(n.scale=this.scale),!0===this.dithering&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),!0===this.alphaHash&&(n.alphaHash=this.alphaHash),!0===this.alphaToCoverage&&(n.alphaToCoverage=this.alphaToCoverage),!0===this.premultipliedAlpha&&(n.premultipliedAlpha=this.premultipliedAlpha),!0===this.forceSinglePass&&(n.forceSinglePass=this.forceSinglePass),!0===this.wireframe&&(n.wireframe=this.wireframe),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),"round"!==this.wireframeLinecap&&(n.wireframeLinecap=this.wireframeLinecap),"round"!==this.wireframeLinejoin&&(n.wireframeLinejoin=this.wireframeLinejoin),!0===this.flatShading&&(n.flatShading=this.flatShading),!1===this.visible&&(n.visible=!1),!1===this.toneMapped&&(n.toneMapped=!1),!1===this.fog&&(n.fog=!1),Object.keys(this.userData).length>0&&(n.userData=this.userData),t){var i=r(e.textures),a=r(e.images);i.length>0&&(n.textures=i),a.length>0&&(n.images=a)}return n}},{key:"clone",value:function(){return(new this.constructor).copy(this)}},{key:"copy",value:function(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;var t=e.clippingPlanes,n=null;if(null!==t){var r=t.length;n=new Array(r);for(var i=0;i!==r;++i)n[i]=t[i].clone()}return this.clippingPlanes=n,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}},{key:"dispose",value:function(){this.dispatchEvent({type:"dispose"})}},{key:"needsUpdate",set:function(e){!0===e&&this.version++}}]),n}(tr),ca={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,rebeccapurple:6697881,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},ha={h:0,s:0,l:0},da={h:0,s:0,l:0};function fa(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+6*(t-e)*n:n<.5?t:n<2/3?e+6*(t-e)*(2/3-n):e}var pa=function(e){function t(e,n,r){return a(this,t),this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,n,r)}return s(t,[{key:"set",value:function(e,t,n){if(void 0===t&&void 0===n){var r=e;r&&r.isColor?this.copy(r):"number"==typeof r?this.setHex(r):"string"==typeof r&&this.setStyle(r)}else this.setRGB(e,t,n);return this}},{key:"setScalar",value:function(e){return this.r=e,this.g=e,this.b=e,this}},{key:"setHex",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:pn;return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(255&e)/255,Pr.toWorkingColorSpace(this,t),this}},{key:"setRGB",value:function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:Pr.workingColorSpace;return this.r=e,this.g=t,this.b=n,Pr.toWorkingColorSpace(this,r),this}},{key:"setHSL",value:function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:Pr.workingColorSpace;if(e=ur(e,1),t=sr(t,0,1),n=sr(n,0,1),0===t)this.r=this.g=this.b=n;else{var i=n<=.5?n*(1+t):n+t-n*t,a=2*n-i;this.r=fa(a,i,e+1/3),this.g=fa(a,i,e),this.b=fa(a,i,e-1/3)}return Pr.toWorkingColorSpace(this,r),this}},{key:"setStyle",value:function(e){var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:pn;function r(t){void 0!==t&&parseFloat(t)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}if(t=/^(\w+)\(([^\)]*)\)/.exec(e)){var i,a=t[1],o=t[2];switch(a){case"rgb":case"rgba":if(i=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return r(i[4]),this.setRGB(Math.min(255,parseInt(i[1],10))/255,Math.min(255,parseInt(i[2],10))/255,Math.min(255,parseInt(i[3],10))/255,n);if(i=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return r(i[4]),this.setRGB(Math.min(100,parseInt(i[1],10))/100,Math.min(100,parseInt(i[2],10))/100,Math.min(100,parseInt(i[3],10))/100,n);break;case"hsl":case"hsla":if(i=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return r(i[4]),this.setHSL(parseFloat(i[1])/360,parseFloat(i[2])/100,parseFloat(i[3])/100,n);break;default:console.warn("THREE.Color: Unknown color model "+e)}}else if(t=/^\#([A-Fa-f\d]+)$/.exec(e)){var s=t[1],u=s.length;if(3===u)return this.setRGB(parseInt(s.charAt(0),16)/15,parseInt(s.charAt(1),16)/15,parseInt(s.charAt(2),16)/15,n);if(6===u)return this.setHex(parseInt(s,16),n);console.warn("THREE.Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,n);return this}},{key:"setColorName",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:pn,n=ca[e.toLowerCase()];return void 0!==n?this.setHex(n,t):console.warn("THREE.Color: Unknown color "+e),this}},{key:"clone",value:function(){return new this.constructor(this.r,this.g,this.b)}},{key:"copy",value:function(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}},{key:"copySRGBToLinear",value:function(e){return this.r=Tr(e.r),this.g=Tr(e.g),this.b=Tr(e.b),this}},{key:"copyLinearToSRGB",value:function(e){return this.r=Er(e.r),this.g=Er(e.g),this.b=Er(e.b),this}},{key:"convertSRGBToLinear",value:function(){return this.copySRGBToLinear(this),this}},{key:"convertLinearToSRGB",value:function(){return this.copyLinearToSRGB(this),this}},{key:"getHex",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:pn;return Pr.fromWorkingColorSpace(va.copy(this),e),65536*Math.round(sr(255*va.r,0,255))+256*Math.round(sr(255*va.g,0,255))+Math.round(sr(255*va.b,0,255))}},{key:"getHexString",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:pn;return("000000"+this.getHex(e).toString(16)).slice(-6)}},{key:"getHSL",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Pr.workingColorSpace;Pr.fromWorkingColorSpace(va.copy(this),t);var n,r,i=va.r,a=va.g,o=va.b,s=Math.max(i,a,o),u=Math.min(i,a,o),l=(u+s)/2;if(u===s)n=0,r=0;else{var c=s-u;switch(r=l<=.5?c/(s+u):c/(2-s-u),s){case i:n=(a-o)/c+(a<o?6:0);break;case a:n=(o-i)/c+2;break;case o:n=(i-a)/c+4}n/=6}return e.h=n,e.s=r,e.l=l,e}},{key:"getRGB",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Pr.workingColorSpace;return Pr.fromWorkingColorSpace(va.copy(this),t),e.r=va.r,e.g=va.g,e.b=va.b,e}},{key:"getStyle",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:pn;Pr.fromWorkingColorSpace(va.copy(this),e);var t=va.r,n=va.g,r=va.b;return e!==pn?"color(".concat(e," ").concat(t.toFixed(3)," ").concat(n.toFixed(3)," ").concat(r.toFixed(3),")"):"rgb(".concat(Math.round(255*t),",").concat(Math.round(255*n),",").concat(Math.round(255*r),")")}},{key:"offsetHSL",value:function(e,t,n){return this.getHSL(ha),ha.h+=e,ha.s+=t,ha.l+=n,this.setHSL(ha.h,ha.s,ha.l),this}},{key:"add",value:function(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}},{key:"addColors",value:function(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this}},{key:"addScalar",value:function(e){return this.r+=e,this.g+=e,this.b+=e,this}},{key:"sub",value:function(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this}},{key:"multiply",value:function(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this}},{key:"multiplyScalar",value:function(e){return this.r*=e,this.g*=e,this.b*=e,this}},{key:"lerp",value:function(e,t){return this.r+=(e.r-this.r)*t,this.g+=(e.g-this.g)*t,this.b+=(e.b-this.b)*t,this}},{key:"lerpColors",value:function(e,t,n){return this.r=e.r+(t.r-e.r)*n,this.g=e.g+(t.g-e.g)*n,this.b=e.b+(t.b-e.b)*n,this}},{key:"lerpHSL",value:function(e,t){this.getHSL(ha),e.getHSL(da);var n=lr(ha.h,da.h,t),r=lr(ha.s,da.s,t),i=lr(ha.l,da.l,t);return this.setHSL(n,r,i),this}},{key:"setFromVector3",value:function(e){return this.r=e.x,this.g=e.y,this.b=e.z,this}},{key:"applyMatrix3",value:function(e){var t=this.r,n=this.g,r=this.b,i=e.elements;return this.r=i[0]*t+i[3]*n+i[6]*r,this.g=i[1]*t+i[4]*n+i[7]*r,this.b=i[2]*t+i[5]*n+i[8]*r,this}},{key:"equals",value:function(e){return e.r===this.r&&e.g===this.g&&e.b===this.b}},{key:"fromArray",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.r=e[t],this.g=e[t+1],this.b=e[t+2],this}},{key:"toArray",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e}},{key:"fromBufferAttribute",value:function(e,t){return this.r=e.getX(t),this.g=e.getY(t),this.b=e.getZ(t),this}},{key:"toJSON",value:function(){return this.getHex()}},{key:e,value:R().mark((function e(){return R().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.r;case 2:return e.next=4,this.g;case 4:return e.next=6,this.b;case 6:case"end":return e.stop()}}),e,this)}))}]),t}(Symbol.iterator),va=new pa;pa.NAMES=ca;var ma=function(e){w(n,e);var t=E(n);function n(e){var r;return a(this,n),(r=t.call(this)).isMeshBasicMaterial=!0,r.type="MeshBasicMaterial",r.color=new pa(16777215),r.map=null,r.lightMap=null,r.lightMapIntensity=1,r.aoMap=null,r.aoMapIntensity=1,r.specularMap=null,r.alphaMap=null,r.envMap=null,r.combine=xe,r.reflectivity=1,r.refractionRatio=.98,r.wireframe=!1,r.wireframeLinewidth=1,r.wireframeLinecap="round",r.wireframeLinejoin="round",r.fog=!0,r.setValues(e),r}return s(n,[{key:"copy",value:function(e){return y(x(n.prototype),"copy",this).call(this,e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}]),n}(la),ga=ya();function ya(){for(var e=new ArrayBuffer(4),t=new Float32Array(e),n=new Uint32Array(e),r=new Uint32Array(512),i=new Uint32Array(512),a=0;a<256;++a){var o=a-127;o<-27?(r[a]=0,r[256|a]=32768,i[a]=24,i[256|a]=24):o<-14?(r[a]=1024>>-o-14,r[256|a]=1024>>-o-14|32768,i[a]=-o-1,i[256|a]=-o-1):o<=15?(r[a]=o+15<<10,r[256|a]=o+15<<10|32768,i[a]=13,i[256|a]=13):o<128?(r[a]=31744,r[256|a]=64512,i[a]=24,i[256|a]=24):(r[a]=31744,r[256|a]=64512,i[a]=13,i[256|a]=13)}for(var s=new Uint32Array(2048),u=new Uint32Array(64),l=new Uint32Array(64),c=1;c<1024;++c){for(var h=c<<13,d=0;0==(8388608&h);)h<<=1,d-=8388608;h&=-8388609,d+=947912704,s[c]=h|d}for(var f=1024;f<2048;++f)s[f]=939524096+(f-1024<<13);for(var p=1;p<31;++p)u[p]=p<<23;u[31]=1199570944,u[32]=2147483648;for(var v=33;v<63;++v)u[v]=2147483648+(v-32<<23);u[63]=3347054592;for(var m=1;m<64;++m)32!==m&&(l[m]=1024);return{floatView:t,uint32View:n,baseTable:r,shiftTable:i,mantissaTable:s,exponentTable:u,offsetTable:l}}function _a(e){Math.abs(e)>65504&&console.warn("THREE.DataUtils.toHalfFloat(): Value out of range."),e=sr(e,-65504,65504),ga.floatView[0]=e;var t=ga.uint32View[0],n=t>>23&511;return ga.baseTable[n]+((8388607&t)>>ga.shiftTable[n])}function xa(e){var t=e>>10;return ga.uint32View[0]=ga.mantissaTable[ga.offsetTable[t]+(1023&e)]+ga.exponentTable[t],ga.floatView[0]}var Ma={toHalfFloat:_a,fromHalfFloat:xa},Sa=new Yr,ba=new mr,wa=function(){function e(t,n){var r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(a(this,e),Array.isArray(t))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,this.name="",this.array=t,this.itemSize=n,this.count=void 0!==t?t.length/n:0,this.normalized=r,this.usage=Hn,this.updateRange={offset:0,count:-1},this.gpuType=et,this.version=0}return s(e,[{key:"onUploadCallback",value:function(){}},{key:"needsUpdate",set:function(e){!0===e&&this.version++}},{key:"setUsage",value:function(e){return this.usage=e,this}},{key:"copy",value:function(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this.gpuType=e.gpuType,this}},{key:"copyAt",value:function(e,t,n){e*=this.itemSize,n*=t.itemSize;for(var r=0,i=this.itemSize;r<i;r++)this.array[e+r]=t.array[n+r];return this}},{key:"copyArray",value:function(e){return this.array.set(e),this}},{key:"applyMatrix3",value:function(e){if(2===this.itemSize)for(var t=0,n=this.count;t<n;t++)ba.fromBufferAttribute(this,t),ba.applyMatrix3(e),this.setXY(t,ba.x,ba.y);else if(3===this.itemSize)for(var r=0,i=this.count;r<i;r++)Sa.fromBufferAttribute(this,r),Sa.applyMatrix3(e),this.setXYZ(r,Sa.x,Sa.y,Sa.z);return this}},{key:"applyMatrix4",value:function(e){for(var t=0,n=this.count;t<n;t++)Sa.fromBufferAttribute(this,t),Sa.applyMatrix4(e),this.setXYZ(t,Sa.x,Sa.y,Sa.z);return this}},{key:"applyNormalMatrix",value:function(e){for(var t=0,n=this.count;t<n;t++)Sa.fromBufferAttribute(this,t),Sa.applyNormalMatrix(e),this.setXYZ(t,Sa.x,Sa.y,Sa.z);return this}},{key:"transformDirection",value:function(e){for(var t=0,n=this.count;t<n;t++)Sa.fromBufferAttribute(this,t),Sa.transformDirection(e),this.setXYZ(t,Sa.x,Sa.y,Sa.z);return this}},{key:"set",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.array.set(e,t),this}},{key:"getComponent",value:function(e,t){var n=this.array[e*this.itemSize+t];return this.normalized&&(n=fr(n,this.array)),n}},{key:"setComponent",value:function(e,t,n){return this.normalized&&(n=pr(n,this.array)),this.array[e*this.itemSize+t]=n,this}},{key:"getX",value:function(e){var t=this.array[e*this.itemSize];return this.normalized&&(t=fr(t,this.array)),t}},{key:"setX",value:function(e,t){return this.normalized&&(t=pr(t,this.array)),this.array[e*this.itemSize]=t,this}},{key:"getY",value:function(e){var t=this.array[e*this.itemSize+1];return this.normalized&&(t=fr(t,this.array)),t}},{key:"setY",value:function(e,t){return this.normalized&&(t=pr(t,this.array)),this.array[e*this.itemSize+1]=t,this}},{key:"getZ",value:function(e){var t=this.array[e*this.itemSize+2];return this.normalized&&(t=fr(t,this.array)),t}},{key:"setZ",value:function(e,t){return this.normalized&&(t=pr(t,this.array)),this.array[e*this.itemSize+2]=t,this}},{key:"getW",value:function(e){var t=this.array[e*this.itemSize+3];return this.normalized&&(t=fr(t,this.array)),t}},{key:"setW",value:function(e,t){return this.normalized&&(t=pr(t,this.array)),this.array[e*this.itemSize+3]=t,this}},{key:"setXY",value:function(e,t,n){return e*=this.itemSize,this.normalized&&(t=pr(t,this.array),n=pr(n,this.array)),this.array[e+0]=t,this.array[e+1]=n,this}},{key:"setXYZ",value:function(e,t,n,r){return e*=this.itemSize,this.normalized&&(t=pr(t,this.array),n=pr(n,this.array),r=pr(r,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=r,this}},{key:"setXYZW",value:function(e,t,n,r,i){return e*=this.itemSize,this.normalized&&(t=pr(t,this.array),n=pr(n,this.array),r=pr(r,this.array),i=pr(i,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=r,this.array[e+3]=i,this}},{key:"onUpload",value:function(e){return this.onUploadCallback=e,this}},{key:"clone",value:function(){return new this.constructor(this.array,this.itemSize).copy(this)}},{key:"toJSON",value:function(){var e={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return""!==this.name&&(e.name=this.name),this.usage!==Hn&&(e.usage=this.usage),0===this.updateRange.offset&&-1===this.updateRange.count||(e.updateRange=this.updateRange),e}}]),e}(),Ta=function(e){w(n,e);var t=E(n);function n(e,r,i){return a(this,n),t.call(this,new Int8Array(e),r,i)}return s(n)}(wa),Ea=function(e){w(n,e);var t=E(n);function n(e,r,i){return a(this,n),t.call(this,new Uint8Array(e),r,i)}return s(n)}(wa),Aa=function(e){w(n,e);var t=E(n);function n(e,r,i){return a(this,n),t.call(this,new Uint8ClampedArray(e),r,i)}return s(n)}(wa),Ra=function(e){w(n,e);var t=E(n);function n(e,r,i){return a(this,n),t.call(this,new Int16Array(e),r,i)}return s(n)}(wa),ka=function(e){w(n,e);var t=E(n);function n(e,r,i){return a(this,n),t.call(this,new Uint16Array(e),r,i)}return s(n)}(wa),Ca=function(e){w(n,e);var t=E(n);function n(e,r,i){return a(this,n),t.call(this,new Int32Array(e),r,i)}return s(n)}(wa),La=function(e){w(n,e);var t=E(n);function n(e,r,i){return a(this,n),t.call(this,new Uint32Array(e),r,i)}return s(n)}(wa),Pa=function(e){w(n,e);var t=E(n);function n(e,r,i){var o;return a(this,n),(o=t.call(this,new Uint16Array(e),r,i)).isFloat16BufferAttribute=!0,o}return s(n,[{key:"getX",value:function(e){var t=xa(this.array[e*this.itemSize]);return this.normalized&&(t=fr(t,this.array)),t}},{key:"setX",value:function(e,t){return this.normalized&&(t=pr(t,this.array)),this.array[e*this.itemSize]=_a(t),this}},{key:"getY",value:function(e){var t=xa(this.array[e*this.itemSize+1]);return this.normalized&&(t=fr(t,this.array)),t}},{key:"setY",value:function(e,t){return this.normalized&&(t=pr(t,this.array)),this.array[e*this.itemSize+1]=_a(t),this}},{key:"getZ",value:function(e){var t=xa(this.array[e*this.itemSize+2]);return this.normalized&&(t=fr(t,this.array)),t}},{key:"setZ",value:function(e,t){return this.normalized&&(t=pr(t,this.array)),this.array[e*this.itemSize+2]=_a(t),this}},{key:"getW",value:function(e){var t=xa(this.array[e*this.itemSize+3]);return this.normalized&&(t=fr(t,this.array)),t}},{key:"setW",value:function(e,t){return this.normalized&&(t=pr(t,this.array)),this.array[e*this.itemSize+3]=_a(t),this}},{key:"setXY",value:function(e,t,n){return e*=this.itemSize,this.normalized&&(t=pr(t,this.array),n=pr(n,this.array)),this.array[e+0]=_a(t),this.array[e+1]=_a(n),this}},{key:"setXYZ",value:function(e,t,n,r){return e*=this.itemSize,this.normalized&&(t=pr(t,this.array),n=pr(n,this.array),r=pr(r,this.array)),this.array[e+0]=_a(t),this.array[e+1]=_a(n),this.array[e+2]=_a(r),this}},{key:"setXYZW",value:function(e,t,n,r,i){return e*=this.itemSize,this.normalized&&(t=pr(t,this.array),n=pr(n,this.array),r=pr(r,this.array),i=pr(i,this.array)),this.array[e+0]=_a(t),this.array[e+1]=_a(n),this.array[e+2]=_a(r),this.array[e+3]=_a(i),this}}]),n}(wa),Ia=function(e){w(n,e);var t=E(n);function n(e,r,i){return a(this,n),t.call(this,new Float32Array(e),r,i)}return s(n)}(wa),Da=function(e){w(n,e);var t=E(n);function n(e,r,i){return a(this,n),t.call(this,new Float64Array(e),r,i)}return s(n)}(wa),Ua=0,Oa=new wi,Na=new Zi,Fa=new Yr,Ba=new Jr,za=new Jr,Ha=new Yr,Ga=function(e){w(n,e);var t=E(n);function n(){var e;return a(this,n),(e=t.call(this)).isBufferGeometry=!0,Object.defineProperty(S(e),"id",{value:Ua++}),e.uuid=or(),e.name="",e.type="BufferGeometry",e.index=null,e.attributes={},e.morphAttributes={},e.morphTargetsRelative=!1,e.groups=[],e.boundingBox=null,e.boundingSphere=null,e.drawRange={start:0,count:1/0},e.userData={},e}return s(n,[{key:"getIndex",value:function(){return this.index}},{key:"setIndex",value:function(e){return Array.isArray(e)?this.index=new(_r(e)?La:ka)(e,1):this.index=e,this}},{key:"getAttribute",value:function(e){return this.attributes[e]}},{key:"setAttribute",value:function(e,t){return this.attributes[e]=t,this}},{key:"deleteAttribute",value:function(e){return delete this.attributes[e],this}},{key:"hasAttribute",value:function(e){return void 0!==this.attributes[e]}},{key:"addGroup",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;this.groups.push({start:e,count:t,materialIndex:n})}},{key:"clearGroups",value:function(){this.groups=[]}},{key:"setDrawRange",value:function(e,t){this.drawRange.start=e,this.drawRange.count=t}},{key:"applyMatrix4",value:function(e){var t=this.attributes.position;void 0!==t&&(t.applyMatrix4(e),t.needsUpdate=!0);var n=this.attributes.normal;if(void 0!==n){var r=(new gr).getNormalMatrix(e);n.applyNormalMatrix(r),n.needsUpdate=!0}var i=this.attributes.tangent;return void 0!==i&&(i.transformDirection(e),i.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this}},{key:"applyQuaternion",value:function(e){return Oa.makeRotationFromQuaternion(e),this.applyMatrix4(Oa),this}},{key:"rotateX",value:function(e){return Oa.makeRotationX(e),this.applyMatrix4(Oa),this}},{key:"rotateY",value:function(e){return Oa.makeRotationY(e),this.applyMatrix4(Oa),this}},{key:"rotateZ",value:function(e){return Oa.makeRotationZ(e),this.applyMatrix4(Oa),this}},{key:"translate",value:function(e,t,n){return Oa.makeTranslation(e,t,n),this.applyMatrix4(Oa),this}},{key:"scale",value:function(e,t,n){return Oa.makeScale(e,t,n),this.applyMatrix4(Oa),this}},{key:"lookAt",value:function(e){return Na.lookAt(e),Na.updateMatrix(),this.applyMatrix4(Na.matrix),this}},{key:"center",value:function(){return this.computeBoundingBox(),this.boundingBox.getCenter(Fa).negate(),this.translate(Fa.x,Fa.y,Fa.z),this}},{key:"setFromPoints",value:function(e){for(var t=[],n=0,r=e.length;n<r;n++){var i=e[n];t.push(i.x,i.y,i.z||0)}return this.setAttribute("position",new Ia(t,3)),this}},{key:"computeBoundingBox",value:function(){null===this.boundingBox&&(this.boundingBox=new Jr);var e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute)return console.error('THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box. Alternatively set "mesh.frustumCulled" to "false".',this),void this.boundingBox.set(new Yr(-1/0,-1/0,-1/0),new Yr(1/0,1/0,1/0));if(void 0!==e){if(this.boundingBox.setFromBufferAttribute(e),t)for(var n=0,r=t.length;n<r;n++){var i=t[n];Ba.setFromBufferAttribute(i),this.morphTargetsRelative?(Ha.addVectors(this.boundingBox.min,Ba.min),this.boundingBox.expandByPoint(Ha),Ha.addVectors(this.boundingBox.max,Ba.max),this.boundingBox.expandByPoint(Ha)):(this.boundingBox.expandByPoint(Ba.min),this.boundingBox.expandByPoint(Ba.max))}}else 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)}},{key:"computeBoundingSphere",value:function(){null===this.boundingSphere&&(this.boundingSphere=new vi);var e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute)return console.error('THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere. Alternatively set "mesh.frustumCulled" to "false".',this),void this.boundingSphere.set(new Yr,1/0);if(e){var n=this.boundingSphere.center;if(Ba.setFromBufferAttribute(e),t)for(var r=0,i=t.length;r<i;r++){var a=t[r];za.setFromBufferAttribute(a),this.morphTargetsRelative?(Ha.addVectors(Ba.min,za.min),Ba.expandByPoint(Ha),Ha.addVectors(Ba.max,za.max),Ba.expandByPoint(Ha)):(Ba.expandByPoint(za.min),Ba.expandByPoint(za.max))}Ba.getCenter(n);for(var o=0,s=0,u=e.count;s<u;s++)Ha.fromBufferAttribute(e,s),o=Math.max(o,n.distanceToSquared(Ha));if(t)for(var l=0,c=t.length;l<c;l++)for(var h=t[l],d=this.morphTargetsRelative,f=0,p=h.count;f<p;f++)Ha.fromBufferAttribute(h,f),d&&(Fa.fromBufferAttribute(e,f),Ha.add(Fa)),o=Math.max(o,n.distanceToSquared(Ha));this.boundingSphere.radius=Math.sqrt(o),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}},{key:"computeTangents",value:function(){var e=this.index,t=this.attributes;if(null!==e&&void 0!==t.position&&void 0!==t.normal&&void 0!==t.uv){var n=e.array,r=t.position.array,i=t.normal.array,a=t.uv.array,o=r.length/3;!1===this.hasAttribute("tangent")&&this.setAttribute("tangent",new wa(new Float32Array(4*o),4));for(var s=this.getAttribute("tangent").array,u=[],l=[],c=0;c<o;c++)u[c]=new Yr,l[c]=new Yr;var h=new Yr,d=new Yr,f=new Yr,p=new mr,v=new mr,m=new mr,g=new Yr,y=new Yr,_=this.groups;0===_.length&&(_=[{start:0,count:n.length}]);for(var x=0,M=_.length;x<M;++x)for(var S=_[x],b=S.start,w=b,T=b+S.count;w<T;w+=3)O(n[w+0],n[w+1],n[w+2]);for(var E=new Yr,A=new Yr,R=new Yr,k=new Yr,C=0,L=_.length;C<L;++C)for(var P=_[C],I=P.start,D=I,U=I+P.count;D<U;D+=3)N(n[D+0]),N(n[D+1]),N(n[D+2])}else console.error("THREE.BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");function O(e,t,n){h.fromArray(r,3*e),d.fromArray(r,3*t),f.fromArray(r,3*n),p.fromArray(a,2*e),v.fromArray(a,2*t),m.fromArray(a,2*n),d.sub(h),f.sub(h),v.sub(p),m.sub(p);var i=1/(v.x*m.y-m.x*v.y);isFinite(i)&&(g.copy(d).multiplyScalar(m.y).addScaledVector(f,-v.y).multiplyScalar(i),y.copy(f).multiplyScalar(v.x).addScaledVector(d,-m.x).multiplyScalar(i),u[e].add(g),u[t].add(g),u[n].add(g),l[e].add(y),l[t].add(y),l[n].add(y))}function N(e){R.fromArray(i,3*e),k.copy(R);var t=u[e];E.copy(t),E.sub(R.multiplyScalar(R.dot(t))).normalize(),A.crossVectors(k,t);var n=A.dot(l[e])<0?-1:1;s[4*e]=E.x,s[4*e+1]=E.y,s[4*e+2]=E.z,s[4*e+3]=n}}},{key:"computeVertexNormals",value:function(){var e=this.index,t=this.getAttribute("position");if(void 0!==t){var n=this.getAttribute("normal");if(void 0===n)n=new wa(new Float32Array(3*t.count),3),this.setAttribute("normal",n);else for(var r=0,i=n.count;r<i;r++)n.setXYZ(r,0,0,0);var a=new Yr,o=new Yr,s=new Yr,u=new Yr,l=new Yr,c=new Yr,h=new Yr,d=new Yr;if(e)for(var f=0,p=e.count;f<p;f+=3){var v=e.getX(f+0),m=e.getX(f+1),g=e.getX(f+2);a.fromBufferAttribute(t,v),o.fromBufferAttribute(t,m),s.fromBufferAttribute(t,g),h.subVectors(s,o),d.subVectors(a,o),h.cross(d),u.fromBufferAttribute(n,v),l.fromBufferAttribute(n,m),c.fromBufferAttribute(n,g),u.add(h),l.add(h),c.add(h),n.setXYZ(v,u.x,u.y,u.z),n.setXYZ(m,l.x,l.y,l.z),n.setXYZ(g,c.x,c.y,c.z)}else for(var y=0,_=t.count;y<_;y+=3)a.fromBufferAttribute(t,y+0),o.fromBufferAttribute(t,y+1),s.fromBufferAttribute(t,y+2),h.subVectors(s,o),d.subVectors(a,o),h.cross(d),n.setXYZ(y+0,h.x,h.y,h.z),n.setXYZ(y+1,h.x,h.y,h.z),n.setXYZ(y+2,h.x,h.y,h.z);this.normalizeNormals(),n.needsUpdate=!0}}},{key:"normalizeNormals",value:function(){for(var e=this.attributes.normal,t=0,n=e.count;t<n;t++)Ha.fromBufferAttribute(e,t),Ha.normalize(),e.setXYZ(t,Ha.x,Ha.y,Ha.z)}},{key:"toNonIndexed",value:function(){function e(e,t){for(var n=e.array,r=e.itemSize,i=e.normalized,a=new n.constructor(t.length*r),o=0,s=0,u=0,l=t.length;u<l;u++){o=e.isInterleavedBufferAttribute?t[u]*e.data.stride+e.offset:t[u]*r;for(var c=0;c<r;c++)a[s++]=n[o++]}return new wa(a,r,i)}if(null===this.index)return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;var t=new n,r=this.index.array,i=this.attributes;for(var a in i){var o=e(i[a],r);t.setAttribute(a,o)}var s=this.morphAttributes;for(var u in s){for(var l=[],c=s[u],h=0,d=c.length;h<d;h++){var f=e(c[h],r);l.push(f)}t.morphAttributes[u]=l}t.morphTargetsRelative=this.morphTargetsRelative;for(var p=this.groups,v=0,m=p.length;v<m;v++){var g=p[v];t.addGroup(g.start,g.count,g.materialIndex)}return t}},{key:"toJSON",value:function(){var e={metadata:{version:4.6,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.type,""!==this.name&&(e.name=this.name),Object.keys(this.userData).length>0&&(e.userData=this.userData),void 0!==this.parameters){var t=this.parameters;for(var n in t)void 0!==t[n]&&(e[n]=t[n]);return e}e.data={attributes:{}};var r=this.index;null!==r&&(e.data.index={type:r.array.constructor.name,array:Array.prototype.slice.call(r.array)});var i=this.attributes;for(var a in i){var o=i[a];e.data.attributes[a]=o.toJSON(e.data)}var s={},u=!1;for(var l in this.morphAttributes){for(var c=this.morphAttributes[l],h=[],d=0,f=c.length;d<f;d++){var p=c[d];h.push(p.toJSON(e.data))}h.length>0&&(s[l]=h,u=!0)}u&&(e.data.morphAttributes=s,e.data.morphTargetsRelative=this.morphTargetsRelative);var v=this.groups;v.length>0&&(e.data.groups=JSON.parse(JSON.stringify(v)));var m=this.boundingSphere;return null!==m&&(e.data.boundingSphere={center:m.center.toArray(),radius:m.radius}),e}},{key:"clone",value:function(){return(new this.constructor).copy(this)}},{key:"copy",value:function(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;var t={};this.name=e.name;var n=e.index;null!==n&&this.setIndex(n.clone(t));var r=e.attributes;for(var i in r){var a=r[i];this.setAttribute(i,a.clone(t))}var o=e.morphAttributes;for(var s in o){for(var u=[],l=o[s],c=0,h=l.length;c<h;c++)u.push(l[c].clone(t));this.morphAttributes[s]=u}this.morphTargetsRelative=e.morphTargetsRelative;for(var d=e.groups,f=0,p=d.length;f<p;f++){var v=d[f];this.addGroup(v.start,v.count,v.materialIndex)}var m=e.boundingBox;null!==m&&(this.boundingBox=m.clone());var g=e.boundingSphere;return null!==g&&(this.boundingSphere=g.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,this}},{key:"dispose",value:function(){this.dispatchEvent({type:"dispose"})}}]),n}(tr),Va=new wi,Wa=new bi,ja=new vi,Xa=new Yr,qa=new Yr,Ya=new Yr,Za=new Yr,Ka=new Yr,Ja=new Yr,Qa=new mr,$a=new mr,eo=new mr,to=new Yr,no=new Yr,ro=new Yr,io=new Yr,ao=new Yr,oo=function(e){w(n,e);var t=E(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Ga,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new ma;return a(this,n),(e=t.call(this)).isMesh=!0,e.type="Mesh",e.geometry=r,e.material=i,e.updateMorphTargets(),e}return s(n,[{key:"copy",value:function(e,t){return y(x(n.prototype),"copy",this).call(this,e,t),void 0!==e.morphTargetInfluences&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),void 0!==e.morphTargetDictionary&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this.material=e.material,this.geometry=e.geometry,this}},{key:"updateMorphTargets",value:function(){var e=this.geometry.morphAttributes,t=Object.keys(e);if(t.length>0){var n=e[t[0]];if(void 0!==n){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(var r=0,i=n.length;r<i;r++){var a=n[r].name||String(r);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=r}}}}},{key:"getVertexPosition",value:function(e,t){var n=this.geometry,r=n.attributes.position,i=n.morphAttributes.position,a=n.morphTargetsRelative;t.fromBufferAttribute(r,e);var o=this.morphTargetInfluences;if(i&&o){Ja.set(0,0,0);for(var s=0,u=i.length;s<u;s++){var l=o[s],c=i[s];0!==l&&(Ka.fromBufferAttribute(c,e),a?Ja.addScaledVector(Ka,l):Ja.addScaledVector(Ka.sub(t),l))}t.add(Ja)}return t}},{key:"raycast",value:function(e,t){var n=this.geometry,r=this.material,i=this.matrixWorld;if(void 0!==r){if(null===n.boundingSphere&&n.computeBoundingSphere(),ja.copy(n.boundingSphere),ja.applyMatrix4(i),Wa.copy(e.ray).recast(e.near),!1===ja.containsPoint(Wa.origin)){if(null===Wa.intersectSphere(ja,Xa))return;if(Wa.origin.distanceToSquared(Xa)>Math.pow(e.far-e.near,2))return}Va.copy(i).invert(),Wa.copy(e.ray).applyMatrix4(Va),null!==n.boundingBox&&!1===Wa.intersectsBox(n.boundingBox)||this._computeIntersections(e,t,Wa)}}},{key:"_computeIntersections",value:function(e,t,n){var r,i=this.geometry,a=this.material,o=i.index,s=i.attributes.position,u=i.attributes.uv,l=i.attributes.uv1,c=i.attributes.normal,h=i.groups,d=i.drawRange;if(null!==o)if(Array.isArray(a))for(var f=0,p=h.length;f<p;f++)for(var v=h[f],m=a[v.materialIndex],g=Math.max(v.start,d.start),y=Math.min(o.count,Math.min(v.start+v.count,d.start+d.count));g<y;g+=3){(r=so(this,m,e,n,u,l,c,o.getX(g),o.getX(g+1),o.getX(g+2)))&&(r.faceIndex=Math.floor(g/3),r.face.materialIndex=v.materialIndex,t.push(r))}else for(var _=Math.max(0,d.start),x=Math.min(o.count,d.start+d.count);_<x;_+=3){(r=so(this,a,e,n,u,l,c,o.getX(_),o.getX(_+1),o.getX(_+2)))&&(r.faceIndex=Math.floor(_/3),t.push(r))}else if(void 0!==s)if(Array.isArray(a))for(var M=0,S=h.length;M<S;M++)for(var b=h[M],w=a[b.materialIndex],T=Math.max(b.start,d.start),E=Math.min(s.count,Math.min(b.start+b.count,d.start+d.count));T<E;T+=3){(r=so(this,w,e,n,u,l,c,T,T+1,T+2))&&(r.faceIndex=Math.floor(T/3),r.face.materialIndex=b.materialIndex,t.push(r))}else for(var A=Math.max(0,d.start),R=Math.min(s.count,d.start+d.count);A<R;A+=3){(r=so(this,a,e,n,u,l,c,A,A+1,A+2))&&(r.faceIndex=Math.floor(A/3),t.push(r))}}}]),n}(Zi);function so(e,t,n,r,i,a,o,s,u,l){e.getVertexPosition(s,qa),e.getVertexPosition(u,Ya),e.getVertexPosition(l,Za);var c=function(e,t,n,r,i,a,o,s){if(null===(t.side===H?r.intersectTriangle(o,a,i,!0,s):r.intersectTriangle(i,a,o,t.side===z,s)))return null;ao.copy(s),ao.applyMatrix4(e.matrixWorld);var u=n.ray.origin.distanceTo(ao);return u<n.near||u>n.far?null:{distance:u,point:ao.clone(),object:e}}(e,t,n,r,qa,Ya,Za,io);if(c){i&&(Qa.fromBufferAttribute(i,s),$a.fromBufferAttribute(i,u),eo.fromBufferAttribute(i,l),c.uv=sa.getInterpolation(io,qa,Ya,Za,Qa,$a,eo,new mr)),a&&(Qa.fromBufferAttribute(a,s),$a.fromBufferAttribute(a,u),eo.fromBufferAttribute(a,l),c.uv1=sa.getInterpolation(io,qa,Ya,Za,Qa,$a,eo,new mr),c.uv2=c.uv1),o&&(to.fromBufferAttribute(o,s),no.fromBufferAttribute(o,u),ro.fromBufferAttribute(o,l),c.normal=sa.getInterpolation(io,qa,Ya,Za,to,no,ro,new Yr),c.normal.dot(r.direction)>0&&c.normal.multiplyScalar(-1));var h={a:s,b:u,c:l,normal:new Yr,materialIndex:0};sa.getNormal(qa,Ya,Za,h.normal),c.face=h}return c}var uo=function(e){w(n,e);var t=E(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,u=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1,l=arguments.length>5&&void 0!==arguments[5]?arguments[5]:1;a(this,n),(e=t.call(this)).type="BoxGeometry",e.parameters={width:r,height:i,depth:o,widthSegments:s,heightSegments:u,depthSegments:l};var c=S(e);s=Math.floor(s),u=Math.floor(u),l=Math.floor(l);var h=[],d=[],f=[],p=[],v=0,m=0;function g(e,t,n,r,i,a,o,s,u,l,g){for(var y=a/u,_=o/l,x=a/2,M=o/2,S=s/2,b=u+1,w=l+1,T=0,E=0,A=new Yr,R=0;R<w;R++)for(var k=R*_-M,C=0;C<b;C++){var L=C*y-x;A[e]=L*r,A[t]=k*i,A[n]=S,d.push(A.x,A.y,A.z),A[e]=0,A[t]=0,A[n]=s>0?1:-1,f.push(A.x,A.y,A.z),p.push(C/u),p.push(1-R/l),T+=1}for(var P=0;P<l;P++)for(var I=0;I<u;I++){var D=v+I+b*P,U=v+I+b*(P+1),O=v+(I+1)+b*(P+1),N=v+(I+1)+b*P;h.push(D,U,N),h.push(U,O,N),E+=6}c.addGroup(m,E,g),m+=E,v+=T}return g("z","y","x",-1,-1,o,i,r,l,u,0),g("z","y","x",1,-1,o,i,-r,l,u,1),g("x","z","y",1,1,r,o,i,s,l,2),g("x","z","y",1,-1,r,o,-i,s,l,3),g("x","y","z",1,-1,r,i,o,s,u,4),g("x","y","z",-1,-1,r,i,-o,s,u,5),e.setIndex(h),e.setAttribute("position",new Ia(d,3)),e.setAttribute("normal",new Ia(f,3)),e.setAttribute("uv",new Ia(p,2)),e}return s(n,[{key:"copy",value:function(e){return y(x(n.prototype),"copy",this).call(this,e),this.parameters=Object.assign({},e.parameters),this}}],[{key:"fromJSON",value:function(e){return new n(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}}]),n}(Ga);function lo(e){var t={};for(var n in e)for(var r in t[n]={},e[n]){var i=e[n][r];i&&(i.isColor||i.isMatrix3||i.isMatrix4||i.isVector2||i.isVector3||i.isVector4||i.isTexture||i.isQuaternion)?i.isRenderTargetTexture?(console.warn("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),t[n][r]=null):t[n][r]=i.clone():Array.isArray(i)?t[n][r]=i.slice():t[n][r]=i}return t}function co(e){for(var t={},n=0;n<e.length;n++){var r=lo(e[n]);for(var i in r)t[i]=r[i]}return t}function ho(e){return null===e.getRenderTarget()?e.outputColorSpace:vn}var fo={clone:lo,merge:co},po=function(e){w(n,e);var t=E(n);function n(e){var r;return a(this,n),(r=t.call(this)).isShaderMaterial=!0,r.type="ShaderMaterial",r.defines={},r.uniforms={},r.uniformsGroups=[],r.vertexShader="void main() {\n\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",r.fragmentShader="void main() {\n\tgl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );\n}",r.linewidth=1,r.wireframe=!1,r.wireframeLinewidth=1,r.fog=!1,r.lights=!1,r.clipping=!1,r.forceSinglePass=!0,r.extensions={derivatives:!1,fragDepth:!1,drawBuffers:!1,shaderTextureLOD:!1},r.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv1:[0,0]},r.index0AttributeName=void 0,r.uniformsNeedUpdate=!1,r.glslVersion=null,void 0!==e&&r.setValues(e),r}return s(n,[{key:"copy",value:function(e){return y(x(n.prototype),"copy",this).call(this,e),this.fragmentShader=e.fragmentShader,this.vertexShader=e.vertexShader,this.uniforms=lo(e.uniforms),this.uniformsGroups=function(e){for(var t=[],n=0;n<e.length;n++)t.push(e[n].clone());return t}(e.uniformsGroups),this.defines=Object.assign({},e.defines),this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.fog=e.fog,this.lights=e.lights,this.clipping=e.clipping,this.extensions=Object.assign({},e.extensions),this.glslVersion=e.glslVersion,this}},{key:"toJSON",value:function(e){var t=y(x(n.prototype),"toJSON",this).call(this,e);for(var r in t.glslVersion=this.glslVersion,t.uniforms={},this.uniforms){var i=this.uniforms[r].value;i&&i.isTexture?t.uniforms[r]={type:"t",value:i.toJSON(e).uuid}:i&&i.isColor?t.uniforms[r]={type:"c",value:i.getHex()}:i&&i.isVector2?t.uniforms[r]={type:"v2",value:i.toArray()}:i&&i.isVector3?t.uniforms[r]={type:"v3",value:i.toArray()}:i&&i.isVector4?t.uniforms[r]={type:"v4",value:i.toArray()}:i&&i.isMatrix3?t.uniforms[r]={type:"m3",value:i.toArray()}:i&&i.isMatrix4?t.uniforms[r]={type:"m4",value:i.toArray()}:t.uniforms[r]={value:i}}Object.keys(this.defines).length>0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader,t.lights=this.lights,t.clipping=this.clipping;var a={};for(var o in this.extensions)!0===this.extensions[o]&&(a[o]=!0);return Object.keys(a).length>0&&(t.extensions=a),t}}]),n}(la),vo=function(e){w(n,e);var t=E(n);function n(){var e;return a(this,n),(e=t.call(this)).isCamera=!0,e.type="Camera",e.matrixWorldInverse=new wi,e.projectionMatrix=new wi,e.projectionMatrixInverse=new wi,e.coordinateSystem=$n,e}return s(n,[{key:"copy",value:function(e,t){return y(x(n.prototype),"copy",this).call(this,e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this.coordinateSystem=e.coordinateSystem,this}},{key:"getWorldDirection",value:function(e){this.updateWorldMatrix(!0,!1);var t=this.matrixWorld.elements;return e.set(-t[8],-t[9],-t[10]).normalize()}},{key:"updateMatrixWorld",value:function(e){y(x(n.prototype),"updateMatrixWorld",this).call(this,e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}},{key:"updateWorldMatrix",value:function(e,t){y(x(n.prototype),"updateWorldMatrix",this).call(this,e,t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}},{key:"clone",value:function(){return(new this.constructor).copy(this)}}]),n}(Zi),mo=function(e){w(n,e);var t=E(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:50,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:.1,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:2e3;return a(this,n),(e=t.call(this)).isPerspectiveCamera=!0,e.type="PerspectiveCamera",e.fov=r,e.zoom=1,e.near=o,e.far=s,e.focus=10,e.aspect=i,e.view=null,e.filmGauge=35,e.filmOffset=0,e.updateProjectionMatrix(),e}return s(n,[{key:"copy",value:function(e,t){return y(x(n.prototype),"copy",this).call(this,e,t),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=null===e.view?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this}},{key:"setFocalLength",value:function(e){var t=.5*this.getFilmHeight()/e;this.fov=2*ar*Math.atan(t),this.updateProjectionMatrix()}},{key:"getFocalLength",value:function(){var e=Math.tan(.5*ir*this.fov);return.5*this.getFilmHeight()/e}},{key:"getEffectiveFOV",value:function(){return 2*ar*Math.atan(Math.tan(.5*ir*this.fov)/this.zoom)}},{key:"getFilmWidth",value:function(){return this.filmGauge*Math.min(this.aspect,1)}},{key:"getFilmHeight",value:function(){return this.filmGauge/Math.max(this.aspect,1)}},{key:"setViewOffset",value:function(e,t,n,r,i,a){this.aspect=e/t,null===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=r,this.view.width=i,this.view.height=a,this.updateProjectionMatrix()}},{key:"clearViewOffset",value:function(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}},{key:"updateProjectionMatrix",value:function(){var e=this.near,t=e*Math.tan(.5*ir*this.fov)/this.zoom,n=2*t,r=this.aspect*n,i=-.5*r,a=this.view;if(null!==this.view&&this.view.enabled){var o=a.fullWidth,s=a.fullHeight;i+=a.offsetX*r/o,t-=a.offsetY*n/s,r*=a.width/o,n*=a.height/s}var u=this.filmOffset;0!==u&&(i+=e*u/this.getFilmWidth()),this.projectionMatrix.makePerspective(i,i+r,t,t-n,e,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}},{key:"toJSON",value:function(e){var t=y(x(n.prototype),"toJSON",this).call(this,e);return t.object.fov=this.fov,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.aspect=this.aspect,null!==this.view&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}}]),n}(vo),go=-90,yo=function(e){w(n,e);var t=E(n);function n(e,r,i){var o;a(this,n),(o=t.call(this)).type="CubeCamera",o.renderTarget=i,o.coordinateSystem=null;var s=new mo(go,1,e,r);s.layers=o.layers,o.add(s);var u=new mo(go,1,e,r);u.layers=o.layers,o.add(u);var l=new mo(go,1,e,r);l.layers=o.layers,o.add(l);var c=new mo(go,1,e,r);c.layers=o.layers,o.add(c);var h=new mo(go,1,e,r);h.layers=o.layers,o.add(h);var d=new mo(go,1,e,r);return d.layers=o.layers,o.add(d),o}return s(n,[{key:"updateCoordinateSystem",value:function(){var e,t=this.coordinateSystem,n=this.children.concat(),r=m(n,6),i=r[0],a=r[1],o=r[2],s=r[3],u=r[4],l=r[5],c=v(n);try{for(c.s();!(e=c.n()).done;){var h=e.value;this.remove(h)}}catch(e){c.e(e)}finally{c.f()}if(t===$n)i.up.set(0,1,0),i.lookAt(1,0,0),a.up.set(0,1,0),a.lookAt(-1,0,0),o.up.set(0,0,-1),o.lookAt(0,1,0),s.up.set(0,0,1),s.lookAt(0,-1,0),u.up.set(0,1,0),u.lookAt(0,0,1),l.up.set(0,1,0),l.lookAt(0,0,-1);else{if(t!==er)throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+t);i.up.set(0,-1,0),i.lookAt(-1,0,0),a.up.set(0,-1,0),a.lookAt(1,0,0),o.up.set(0,0,1),o.lookAt(0,1,0),s.up.set(0,0,-1),s.lookAt(0,-1,0),u.up.set(0,-1,0),u.lookAt(0,0,1),l.up.set(0,-1,0),l.lookAt(0,0,-1)}var d,f=v(n);try{for(f.s();!(d=f.n()).done;){var p=d.value;this.add(p),p.updateMatrixWorld()}}catch(e){f.e(e)}finally{f.f()}}},{key:"update",value:function(e,t){null===this.parent&&this.updateMatrixWorld();var n=this.renderTarget;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());var r=m(this.children,6),i=r[0],a=r[1],o=r[2],s=r[3],u=r[4],l=r[5],c=e.getRenderTarget(),h=e.xr.enabled;e.xr.enabled=!1;var d=n.texture.generateMipmaps;n.texture.generateMipmaps=!1,e.setRenderTarget(n,0),e.render(t,i),e.setRenderTarget(n,1),e.render(t,a),e.setRenderTarget(n,2),e.render(t,o),e.setRenderTarget(n,3),e.render(t,s),e.setRenderTarget(n,4),e.render(t,u),n.texture.generateMipmaps=d,e.setRenderTarget(n,5),e.render(t,l),e.setRenderTarget(c),e.xr.enabled=h,n.texture.needsPMREMUpdate=!0}}]),n}(Zi),_o=function(e){w(n,e);var t=E(n);function n(e,r,i,o,s,u,l,c,h,d){var f;return a(this,n),e=void 0!==e?e:[],r=void 0!==r?r:Ce,(f=t.call(this,e,r,i,o,s,u,l,c,h,d)).isCubeTexture=!0,f.flipY=!1,f}return s(n,[{key:"images",get:function(){return this.image},set:function(e){this.image=e}}]),n}(Fr),xo=function(e){w(n,e);var t=E(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};a(this,n),(e=t.call(this,r,r,i)).isWebGLCubeRenderTarget=!0;var o={width:r,height:r,depth:1},s=[o,o,o,o,o,o];return void 0!==i.encoding&&(wr("THREE.WebGLCubeRenderTarget: option.encoding has been replaced by option.colorSpace."),i.colorSpace=i.encoding===un?pn:fn),e.texture=new _o(s,i.mapping,i.wrapS,i.wrapT,i.magFilter,i.minFilter,i.format,i.type,i.anisotropy,i.colorSpace),e.texture.isRenderTargetTexture=!0,e.texture.generateMipmaps=void 0!==i.generateMipmaps&&i.generateMipmaps,e.texture.minFilter=void 0!==i.minFilter?i.minFilter:Ve,e}return s(n,[{key:"fromEquirectangularTexture",value:function(e,t){this.texture.type=t.type,this.texture.colorSpace=t.colorSpace,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;var n={tEquirect:{value:null}},r="\n\n\t\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t\tvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\n\t\t\t\t\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n\n\t\t\t\t}\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvWorldDirection = transformDirection( position, modelMatrix );\n\n\t\t\t\t\t#include <begin_vertex>\n\t\t\t\t\t#include <project_vertex>\n\n\t\t\t\t}\n\t\t\t",i="\n\n\t\t\t\tuniform sampler2D tEquirect;\n\n\t\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t\t#include <common>\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvec3 direction = normalize( vWorldDirection );\n\n\t\t\t\t\tvec2 sampleUV = equirectUv( direction );\n\n\t\t\t\t\tgl_FragColor = texture2D( tEquirect, sampleUV );\n\n\t\t\t\t}\n\t\t\t",a=new uo(5,5,5),o=new po({name:"CubemapFromEquirect",uniforms:lo(n),vertexShader:r,fragmentShader:i,side:H,blending:W});o.uniforms.tEquirect.value=t;var s=new oo(a,o),u=t.minFilter;return t.minFilter===Xe&&(t.minFilter=Ve),new yo(1,10,this).update(e,s),t.minFilter=u,s.geometry.dispose(),s.material.dispose(),this}},{key:"clear",value:function(e,t,n,r){for(var i=e.getRenderTarget(),a=0;a<6;a++)e.setRenderTarget(this,a),e.clear(t,n,r);e.setRenderTarget(i)}}]),n}(Hr),Mo=new Yr,So=new Yr,bo=new gr,wo=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Yr(1,0,0),n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;a(this,e),this.isPlane=!0,this.normal=t,this.constant=n}return s(e,[{key:"set",value:function(e,t){return this.normal.copy(e),this.constant=t,this}},{key:"setComponents",value:function(e,t,n,r){return this.normal.set(e,t,n),this.constant=r,this}},{key:"setFromNormalAndCoplanarPoint",value:function(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}},{key:"setFromCoplanarPoints",value:function(e,t,n){var r=Mo.subVectors(n,t).cross(So.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(r,e),this}},{key:"copy",value:function(e){return this.normal.copy(e.normal),this.constant=e.constant,this}},{key:"normalize",value:function(){var e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this}},{key:"negate",value:function(){return this.constant*=-1,this.normal.negate(),this}},{key:"distanceToPoint",value:function(e){return this.normal.dot(e)+this.constant}},{key:"distanceToSphere",value:function(e){return this.distanceToPoint(e.center)-e.radius}},{key:"projectPoint",value:function(e,t){return t.copy(e).addScaledVector(this.normal,-this.distanceToPoint(e))}},{key:"intersectLine",value:function(e,t){var n=e.delta(Mo),r=this.normal.dot(n);if(0===r)return 0===this.distanceToPoint(e.start)?t.copy(e.start):null;var i=-(e.start.dot(this.normal)+this.constant)/r;return i<0||i>1?null:t.copy(e.start).addScaledVector(n,i)}},{key:"intersectsLine",value:function(e){var t=this.distanceToPoint(e.start),n=this.distanceToPoint(e.end);return t<0&&n>0||n<0&&t>0}},{key:"intersectsBox",value:function(e){return e.intersectsPlane(this)}},{key:"intersectsSphere",value:function(e){return e.intersectsPlane(this)}},{key:"coplanarPoint",value:function(e){return e.copy(this.normal).multiplyScalar(-this.constant)}},{key:"applyMatrix4",value:function(e,t){var n=t||bo.getNormalMatrix(e),r=this.coplanarPoint(Mo).applyMatrix4(e),i=this.normal.applyMatrix3(n).normalize();return this.constant=-r.dot(i),this}},{key:"translate",value:function(e){return this.constant-=e.dot(this.normal),this}},{key:"equals",value:function(e){return e.normal.equals(this.normal)&&e.constant===this.constant}},{key:"clone",value:function(){return(new this.constructor).copy(this)}}]),e}(),To=new vi,Eo=new Yr,Ao=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new wo,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new wo,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:new wo,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:new wo,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:new wo,s=arguments.length>5&&void 0!==arguments[5]?arguments[5]:new wo;a(this,e),this.planes=[t,n,r,i,o,s]}return s(e,[{key:"set",value:function(e,t,n,r,i,a){var o=this.planes;return o[0].copy(e),o[1].copy(t),o[2].copy(n),o[3].copy(r),o[4].copy(i),o[5].copy(a),this}},{key:"copy",value:function(e){for(var t=this.planes,n=0;n<6;n++)t[n].copy(e.planes[n]);return this}},{key:"setFromProjectionMatrix",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:$n,n=this.planes,r=e.elements,i=r[0],a=r[1],o=r[2],s=r[3],u=r[4],l=r[5],c=r[6],h=r[7],d=r[8],f=r[9],p=r[10],v=r[11],m=r[12],g=r[13],y=r[14],_=r[15];if(n[0].setComponents(s-i,h-u,v-d,_-m).normalize(),n[1].setComponents(s+i,h+u,v+d,_+m).normalize(),n[2].setComponents(s+a,h+l,v+f,_+g).normalize(),n[3].setComponents(s-a,h-l,v-f,_-g).normalize(),n[4].setComponents(s-o,h-c,v-p,_-y).normalize(),t===$n)n[5].setComponents(s+o,h+c,v+p,_+y).normalize();else{if(t!==er)throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+t);n[5].setComponents(o,c,p,y).normalize()}return this}},{key:"intersectsObject",value:function(e){if(void 0!==e.boundingSphere)null===e.boundingSphere&&e.computeBoundingSphere(),To.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{var t=e.geometry;null===t.boundingSphere&&t.computeBoundingSphere(),To.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(To)}},{key:"intersectsSprite",value:function(e){return To.center.set(0,0,0),To.radius=.7071067811865476,To.applyMatrix4(e.matrixWorld),this.intersectsSphere(To)}},{key:"intersectsSphere",value:function(e){for(var t=this.planes,n=e.center,r=-e.radius,i=0;i<6;i++){if(t[i].distanceToPoint(n)<r)return!1}return!0}},{key:"intersectsBox",value:function(e){for(var t=this.planes,n=0;n<6;n++){var r=t[n];if(Eo.x=r.normal.x>0?e.max.x:e.min.x,Eo.y=r.normal.y>0?e.max.y:e.min.y,Eo.z=r.normal.z>0?e.max.z:e.min.z,r.distanceToPoint(Eo)<0)return!1}return!0}},{key:"containsPoint",value:function(e){for(var t=this.planes,n=0;n<6;n++)if(t[n].distanceToPoint(e)<0)return!1;return!0}},{key:"clone",value:function(){return(new this.constructor).copy(this)}}]),e}();function Ro(){var e=null,t=!1,n=null,r=null;function i(t,a){n(t,a),r=e.requestAnimationFrame(i)}return{start:function(){!0!==t&&null!==n&&(r=e.requestAnimationFrame(i),t=!0)},stop:function(){e.cancelAnimationFrame(r),t=!1},setAnimationLoop:function(e){n=e},setContext:function(t){e=t}}}function ko(e,t){var n=t.isWebGL2,r=new WeakMap;return{get:function(e){return e.isInterleavedBufferAttribute&&(e=e.data),r.get(e)},remove:function(t){t.isInterleavedBufferAttribute&&(t=t.data);var n=r.get(t);n&&(e.deleteBuffer(n.buffer),r.delete(t))},update:function(t,i){if(t.isGLBufferAttribute){var a=r.get(t);(!a||a.version<t.version)&&r.set(t,{buffer:t.buffer,type:t.type,bytesPerElement:t.elementSize,version:t.version})}else{t.isInterleavedBufferAttribute&&(t=t.data);var o=r.get(t);void 0===o?r.set(t,function(t,r){var i,a=t.array,o=t.usage,s=e.createBuffer();if(e.bindBuffer(r,s),e.bufferData(r,a,o),t.onUploadCallback(),a instanceof Float32Array)i=e.FLOAT;else if(a instanceof Uint16Array)if(t.isFloat16BufferAttribute){if(!n)throw new Error("THREE.WebGLAttributes: Usage of Float16BufferAttribute requires WebGL2.");i=e.HALF_FLOAT}else i=e.UNSIGNED_SHORT;else if(a instanceof Int16Array)i=e.SHORT;else if(a instanceof Uint32Array)i=e.UNSIGNED_INT;else if(a instanceof Int32Array)i=e.INT;else if(a instanceof Int8Array)i=e.BYTE;else if(a instanceof Uint8Array)i=e.UNSIGNED_BYTE;else{if(!(a instanceof Uint8ClampedArray))throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+a);i=e.UNSIGNED_BYTE}return{buffer:s,type:i,bytesPerElement:a.BYTES_PER_ELEMENT,version:t.version}}(t,i)):o.version<t.version&&(!function(t,r,i){var a=r.array,o=r.updateRange;e.bindBuffer(i,t),-1===o.count?e.bufferSubData(i,0,a):(n?e.bufferSubData(i,o.offset*a.BYTES_PER_ELEMENT,a,o.offset,o.count):e.bufferSubData(i,o.offset*a.BYTES_PER_ELEMENT,a.subarray(o.offset,o.offset+o.count)),o.count=-1),r.onUploadCallback()}(o.buffer,t,i),o.version=t.version)}}}}var Co=function(e){w(n,e);var t=E(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1;a(this,n),(e=t.call(this)).type="PlaneGeometry",e.parameters={width:r,height:i,widthSegments:o,heightSegments:s};for(var u=r/2,l=i/2,c=Math.floor(o),h=Math.floor(s),d=c+1,f=h+1,p=r/c,v=i/h,m=[],g=[],y=[],_=[],x=0;x<f;x++)for(var M=x*v-l,S=0;S<d;S++){var b=S*p-u;g.push(b,-M,0),y.push(0,0,1),_.push(S/c),_.push(1-x/h)}for(var w=0;w<h;w++)for(var T=0;T<c;T++){var E=T+d*w,A=T+d*(w+1),R=T+1+d*(w+1),k=T+1+d*w;m.push(E,A,k),m.push(A,R,k)}return e.setIndex(m),e.setAttribute("position",new Ia(g,3)),e.setAttribute("normal",new Ia(y,3)),e.setAttribute("uv",new Ia(_,2)),e}return s(n,[{key:"copy",value:function(e){return y(x(n.prototype),"copy",this).call(this,e),this.parameters=Object.assign({},e.parameters),this}}],[{key:"fromJSON",value:function(e){return new n(e.width,e.height,e.widthSegments,e.heightSegments)}}]),n}(Ga),Lo={alphahash_fragment:"#ifdef USE_ALPHAHASH\n\tif ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;\n#endif",alphahash_pars_fragment:"#ifdef USE_ALPHAHASH\n\tconst float ALPHA_HASH_SCALE = 0.05;\n\tfloat hash2D( vec2 value ) {\n\t\treturn fract( 1.0e4 * sin( 17.0 * value.x + 0.1 * value.y ) * ( 0.1 + abs( sin( 13.0 * value.y + value.x ) ) ) );\n\t}\n\tfloat hash3D( vec3 value ) {\n\t\treturn hash2D( vec2( hash2D( value.xy ), value.z ) );\n\t}\n\tfloat getAlphaHashThreshold( vec3 position ) {\n\t\tfloat maxDeriv = max(\n\t\t\tlength( dFdx( position.xyz ) ),\n\t\t\tlength( dFdy( position.xyz ) )\n\t\t);\n\t\tfloat pixScale = 1.0 / ( ALPHA_HASH_SCALE * maxDeriv );\n\t\tvec2 pixScales = vec2(\n\t\t\texp2( floor( log2( pixScale ) ) ),\n\t\t\texp2( ceil( log2( pixScale ) ) )\n\t\t);\n\t\tvec2 alpha = vec2(\n\t\t\thash3D( floor( pixScales.x * position.xyz ) ),\n\t\t\thash3D( floor( pixScales.y * position.xyz ) )\n\t\t);\n\t\tfloat lerpFactor = fract( log2( pixScale ) );\n\t\tfloat x = ( 1.0 - lerpFactor ) * alpha.x + lerpFactor * alpha.y;\n\t\tfloat a = min( lerpFactor, 1.0 - lerpFactor );\n\t\tvec3 cases = vec3(\n\t\t\tx * x / ( 2.0 * a * ( 1.0 - a ) ),\n\t\t\t( x - 0.5 * a ) / ( 1.0 - a ),\n\t\t\t1.0 - ( ( 1.0 - x ) * ( 1.0 - x ) / ( 2.0 * a * ( 1.0 - a ) ) )\n\t\t);\n\t\tfloat threshold = ( x < ( 1.0 - a ) )\n\t\t\t? ( ( x < a ) ? cases.x : cases.y )\n\t\t\t: cases.z;\n\t\treturn clamp( threshold , 1.0e-6, 1.0 );\n\t}\n#endif",alphamap_fragment:"#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;\n#endif",alphamap_pars_fragment:"#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif",alphatest_fragment:"#ifdef USE_ALPHATEST\n\tif ( diffuseColor.a < alphaTest ) discard;\n#endif",alphatest_pars_fragment:"#ifdef USE_ALPHATEST\n\tuniform float alphaTest;\n#endif",aomap_fragment:"#ifdef USE_AOMAP\n\tfloat ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0;\n\treflectedLight.indirectDiffuse *= ambientOcclusion;\n\t#if defined( USE_ENVMAP ) && defined( STANDARD )\n\t\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\t\treflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );\n\t#endif\n#endif",aomap_pars_fragment:"#ifdef USE_AOMAP\n\tuniform sampler2D aoMap;\n\tuniform float aoMapIntensity;\n#endif",begin_vertex:"vec3 transformed = vec3( position );\n#ifdef USE_ALPHAHASH\n\tvPosition = vec3( position );\n#endif",beginnormal_vertex:"vec3 objectNormal = vec3( normal );\n#ifdef USE_TANGENT\n\tvec3 objectTangent = vec3( tangent.xyz );\n#endif",bsdfs:"float 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_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) {\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, 1.0, dotVH );\n\tfloat G = G_BlinnPhong_Implicit( );\n\tfloat D = D_BlinnPhong( shininess, dotNH );\n\treturn F * ( G * D );\n} // validated",iridescence_fragment:"#ifdef USE_IRIDESCENCE\n\tconst mat3 XYZ_TO_REC709 = mat3(\n\t\t 3.2404542, -0.9692660, 0.0556434,\n\t\t-1.5371385, 1.8760108, -0.2040259,\n\t\t-0.4985314, 0.0415560, 1.0572252\n\t);\n\tvec3 Fresnel0ToIor( vec3 fresnel0 ) {\n\t\tvec3 sqrtF0 = sqrt( fresnel0 );\n\t\treturn ( vec3( 1.0 ) + sqrtF0 ) / ( vec3( 1.0 ) - sqrtF0 );\n\t}\n\tvec3 IorToFresnel0( vec3 transmittedIor, float incidentIor ) {\n\t\treturn pow2( ( transmittedIor - vec3( incidentIor ) ) / ( transmittedIor + vec3( incidentIor ) ) );\n\t}\n\tfloat IorToFresnel0( float transmittedIor, float incidentIor ) {\n\t\treturn pow2( ( transmittedIor - incidentIor ) / ( transmittedIor + incidentIor ));\n\t}\n\tvec3 evalSensitivity( float OPD, vec3 shift ) {\n\t\tfloat phase = 2.0 * PI * OPD * 1.0e-9;\n\t\tvec3 val = vec3( 5.4856e-13, 4.4201e-13, 5.2481e-13 );\n\t\tvec3 pos = vec3( 1.6810e+06, 1.7953e+06, 2.2084e+06 );\n\t\tvec3 var = vec3( 4.3278e+09, 9.3046e+09, 6.6121e+09 );\n\t\tvec3 xyz = val * sqrt( 2.0 * PI * var ) * cos( pos * phase + shift ) * exp( - pow2( phase ) * var );\n\t\txyz.x += 9.7470e-14 * sqrt( 2.0 * PI * 4.5282e+09 ) * cos( 2.2399e+06 * phase + shift[ 0 ] ) * exp( - 4.5282e+09 * pow2( phase ) );\n\t\txyz /= 1.0685e-7;\n\t\tvec3 rgb = XYZ_TO_REC709 * xyz;\n\t\treturn rgb;\n\t}\n\tvec3 evalIridescence( float outsideIOR, float eta2, float cosTheta1, float thinFilmThickness, vec3 baseF0 ) {\n\t\tvec3 I;\n\t\tfloat iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) );\n\t\tfloat sinTheta2Sq = pow2( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2( cosTheta1 ) );\n\t\tfloat cosTheta2Sq = 1.0 - sinTheta2Sq;\n\t\tif ( cosTheta2Sq < 0.0 ) {\n\t\t\treturn vec3( 1.0 );\n\t\t}\n\t\tfloat cosTheta2 = sqrt( cosTheta2Sq );\n\t\tfloat R0 = IorToFresnel0( iridescenceIOR, outsideIOR );\n\t\tfloat R12 = F_Schlick( R0, 1.0, cosTheta1 );\n\t\tfloat T121 = 1.0 - R12;\n\t\tfloat phi12 = 0.0;\n\t\tif ( iridescenceIOR < outsideIOR ) phi12 = PI;\n\t\tfloat phi21 = PI - phi12;\n\t\tvec3 baseIOR = Fresnel0ToIor( clamp( baseF0, 0.0, 0.9999 ) );\t\tvec3 R1 = IorToFresnel0( baseIOR, iridescenceIOR );\n\t\tvec3 R23 = F_Schlick( R1, 1.0, cosTheta2 );\n\t\tvec3 phi23 = vec3( 0.0 );\n\t\tif ( baseIOR[ 0 ] < iridescenceIOR ) phi23[ 0 ] = PI;\n\t\tif ( baseIOR[ 1 ] < iridescenceIOR ) phi23[ 1 ] = PI;\n\t\tif ( baseIOR[ 2 ] < iridescenceIOR ) phi23[ 2 ] = PI;\n\t\tfloat OPD = 2.0 * iridescenceIOR * thinFilmThickness * cosTheta2;\n\t\tvec3 phi = vec3( phi21 ) + phi23;\n\t\tvec3 R123 = clamp( R12 * R23, 1e-5, 0.9999 );\n\t\tvec3 r123 = sqrt( R123 );\n\t\tvec3 Rs = pow2( T121 ) * R23 / ( vec3( 1.0 ) - R123 );\n\t\tvec3 C0 = R12 + Rs;\n\t\tI = C0;\n\t\tvec3 Cm = Rs - T121;\n\t\tfor ( int m = 1; m <= 2; ++ m ) {\n\t\t\tCm *= r123;\n\t\t\tvec3 Sm = 2.0 * evalSensitivity( float( m ) * OPD, float( m ) * phi );\n\t\t\tI += Cm * Sm;\n\t\t}\n\t\treturn max( I, vec3( 0.0 ) );\n\t}\n#endif",bumpmap_pars_fragment:"#ifdef USE_BUMPMAP\n\tuniform sampler2D bumpMap;\n\tuniform float bumpScale;\n\tvec2 dHdxy_fwd() {\n\t\tvec2 dSTdx = dFdx( vBumpMapUv );\n\t\tvec2 dSTdy = dFdy( vBumpMapUv );\n\t\tfloat Hll = bumpScale * texture2D( bumpMap, vBumpMapUv ).x;\n\t\tfloat dBx = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdx ).x - Hll;\n\t\tfloat dBy = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdy ).x - Hll;\n\t\treturn vec2( dBx, dBy );\n\t}\n\tvec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {\n\t\tvec3 vSigmaX = dFdx( surf_pos.xyz );\n\t\tvec3 vSigmaY = dFdy( surf_pos.xyz );\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 ) * faceDirection;\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",clipping_planes_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tvec4 plane;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n\t\tplane = clippingPlanes[ i ];\n\t\tif ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;\n\t}\n\t#pragma unroll_loop_end\n\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\tbool clipped = true;\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n\t\t\tplane = clippingPlanes[ i ];\n\t\t\tclipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t\tif ( clipped ) discard;\n\t#endif\n#endif",clipping_planes_pars_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n\tuniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif",clipping_planes_pars_vertex:"#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n#endif",clipping_planes_vertex:"#if NUM_CLIPPING_PLANES > 0\n\tvClipPosition = - mvPosition.xyz;\n#endif",color_fragment:"#if defined( USE_COLOR_ALPHA )\n\tdiffuseColor *= vColor;\n#elif defined( USE_COLOR )\n\tdiffuseColor.rgb *= vColor;\n#endif",color_pars_fragment:"#if defined( USE_COLOR_ALPHA )\n\tvarying vec4 vColor;\n#elif defined( USE_COLOR )\n\tvarying vec3 vColor;\n#endif",color_pars_vertex:"#if defined( USE_COLOR_ALPHA )\n\tvarying vec4 vColor;\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )\n\tvarying vec3 vColor;\n#endif",color_vertex:"#if defined( USE_COLOR_ALPHA )\n\tvColor = vec4( 1.0 );\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )\n\tvColor = vec3( 1.0 );\n#endif\n#ifdef USE_COLOR\n\tvColor *= color;\n#endif\n#ifdef USE_INSTANCING_COLOR\n\tvColor.xyz *= instanceColor.xyz;\n#endif",common:"#define PI 3.141592653589793\n#define PI2 6.283185307179586\n#define PI_HALF 1.5707963267948966\n#define RECIPROCAL_PI 0.3183098861837907\n#define RECIPROCAL_PI2 0.15915494309189535\n#define EPSILON 1e-6\n#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\n#define whiteComplement( a ) ( 1.0 - saturate( a ) )\nfloat pow2( const in float x ) { return x*x; }\nvec3 pow2( const in vec3 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 max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }\nfloat average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); }\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}\n#ifdef HIGH_PRECISION\n\tfloat precisionSafeLength( vec3 v ) { return length( v ); }\n#else\n\tfloat precisionSafeLength( vec3 v ) {\n\t\tfloat maxComponent = max3( abs( v ) );\n\t\treturn length( v / maxComponent ) * maxComponent;\n\t}\n#endif\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#ifdef USE_CLEARCOAT\n\tvec3 clearcoatNormal;\n#endif\n};\n#ifdef USE_ALPHAHASH\n\tvarying vec3 vPosition;\n#endif\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}\nmat3 transposeMat3( const in mat3 m ) {\n\tmat3 tmp;\n\ttmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );\n\ttmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );\n\ttmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );\n\treturn tmp;\n}\nfloat luminance( const in vec3 rgb ) {\n\tconst vec3 weights = vec3( 0.2126729, 0.7151522, 0.0721750 );\n\treturn dot( weights, rgb );\n}\nbool isPerspectiveMatrix( mat4 m ) {\n\treturn m[ 2 ][ 3 ] == - 1.0;\n}\nvec2 equirectUv( in vec3 dir ) {\n\tfloat u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;\n\tfloat v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\treturn vec2( u, v );\n}\nvec3 BRDF_Lambert( const in vec3 diffuseColor ) {\n\treturn RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {\n\tfloat fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n\treturn f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n}\nfloat F_Schlick( const in float f0, const in float f90, const in float dotVH ) {\n\tfloat fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n\treturn f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n} // validated",cube_uv_reflection_fragment:"#ifdef ENVMAP_TYPE_CUBE_UV\n\t#define cubeUV_minMipLevel 4.0\n\t#define cubeUV_minTileSize 16.0\n\tfloat getFace( vec3 direction ) {\n\t\tvec3 absDirection = abs( direction );\n\t\tfloat face = - 1.0;\n\t\tif ( absDirection.x > absDirection.z ) {\n\t\t\tif ( absDirection.x > absDirection.y )\n\t\t\t\tface = direction.x > 0.0 ? 0.0 : 3.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t} else {\n\t\t\tif ( absDirection.z > absDirection.y )\n\t\t\t\tface = direction.z > 0.0 ? 2.0 : 5.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t}\n\t\treturn face;\n\t}\n\tvec2 getUV( vec3 direction, float face ) {\n\t\tvec2 uv;\n\t\tif ( face == 0.0 ) {\n\t\t\tuv = vec2( direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 1.0 ) {\n\t\t\tuv = vec2( - direction.x, - direction.z ) / abs( direction.y );\n\t\t} else if ( face == 2.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.y ) / abs( direction.z );\n\t\t} else if ( face == 3.0 ) {\n\t\t\tuv = vec2( - direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 4.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.z ) / abs( direction.y );\n\t\t} else {\n\t\t\tuv = vec2( direction.x, direction.y ) / abs( direction.z );\n\t\t}\n\t\treturn 0.5 * ( uv + 1.0 );\n\t}\n\tvec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {\n\t\tfloat face = getFace( direction );\n\t\tfloat filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );\n\t\tmipInt = max( mipInt, cubeUV_minMipLevel );\n\t\tfloat faceSize = exp2( mipInt );\n\t\thighp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0;\n\t\tif ( face > 2.0 ) {\n\t\t\tuv.y += faceSize;\n\t\t\tface -= 3.0;\n\t\t}\n\t\tuv.x += face * faceSize;\n\t\tuv.x += filterInt * 3.0 * cubeUV_minTileSize;\n\t\tuv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize );\n\t\tuv.x *= CUBEUV_TEXEL_WIDTH;\n\t\tuv.y *= CUBEUV_TEXEL_HEIGHT;\n\t\t#ifdef texture2DGradEXT\n\t\t\treturn texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb;\n\t\t#else\n\t\t\treturn texture2D( envMap, uv ).rgb;\n\t\t#endif\n\t}\n\t#define cubeUV_r0 1.0\n\t#define cubeUV_v0 0.339\n\t#define cubeUV_m0 - 2.0\n\t#define cubeUV_r1 0.8\n\t#define cubeUV_v1 0.276\n\t#define cubeUV_m1 - 1.0\n\t#define cubeUV_r4 0.4\n\t#define cubeUV_v4 0.046\n\t#define cubeUV_m4 2.0\n\t#define cubeUV_r5 0.305\n\t#define cubeUV_v5 0.016\n\t#define cubeUV_m5 3.0\n\t#define cubeUV_r6 0.21\n\t#define cubeUV_v6 0.0038\n\t#define cubeUV_m6 4.0\n\tfloat roughnessToMip( float roughness ) {\n\t\tfloat mip = 0.0;\n\t\tif ( roughness >= cubeUV_r1 ) {\n\t\t\tmip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0;\n\t\t} else if ( roughness >= cubeUV_r4 ) {\n\t\t\tmip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1;\n\t\t} else if ( roughness >= cubeUV_r5 ) {\n\t\t\tmip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4;\n\t\t} else if ( roughness >= cubeUV_r6 ) {\n\t\t\tmip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5;\n\t\t} else {\n\t\t\tmip = - 2.0 * log2( 1.16 * roughness );\t\t}\n\t\treturn mip;\n\t}\n\tvec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {\n\t\tfloat mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP );\n\t\tfloat mipF = fract( mip );\n\t\tfloat mipInt = floor( mip );\n\t\tvec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );\n\t\tif ( mipF == 0.0 ) {\n\t\t\treturn vec4( color0, 1.0 );\n\t\t} else {\n\t\t\tvec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );\n\t\t\treturn vec4( mix( color0, color1, mipF ), 1.0 );\n\t\t}\n\t}\n#endif",defaultnormal_vertex:"vec3 transformedNormal = objectNormal;\n#ifdef USE_INSTANCING\n\tmat3 m = mat3( instanceMatrix );\n\ttransformedNormal /= vec3( dot( m[ 0 ], m[ 0 ] ), dot( m[ 1 ], m[ 1 ] ), dot( m[ 2 ], m[ 2 ] ) );\n\ttransformedNormal = m * transformedNormal;\n#endif\ntransformedNormal = normalMatrix * transformedNormal;\n#ifdef FLIP_SIDED\n\ttransformedNormal = - transformedNormal;\n#endif\n#ifdef USE_TANGENT\n\tvec3 transformedTangent = ( modelViewMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n\t#ifdef FLIP_SIDED\n\t\ttransformedTangent = - transformedTangent;\n\t#endif\n#endif",displacementmap_pars_vertex:"#ifdef USE_DISPLACEMENTMAP\n\tuniform sampler2D displacementMap;\n\tuniform float displacementScale;\n\tuniform float displacementBias;\n#endif",displacementmap_vertex:"#ifdef USE_DISPLACEMENTMAP\n\ttransformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias );\n#endif",emissivemap_fragment:"#ifdef USE_EMISSIVEMAP\n\tvec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );\n\ttotalEmissiveRadiance *= emissiveColor.rgb;\n#endif",emissivemap_pars_fragment:"#ifdef USE_EMISSIVEMAP\n\tuniform sampler2D emissiveMap;\n#endif",colorspace_fragment:"gl_FragColor = linearToOutputTexel( gl_FragColor );",colorspace_pars_fragment:"vec4 LinearToLinear( in vec4 value ) {\n\treturn value;\n}\nvec4 LinearTosRGB( in vec4 value ) {\n\treturn 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.a );\n}",envmap_fragment:"#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvec3 cameraToFrag;\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToFrag = normalize( vWorldPosition - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( cameraToFrag, worldNormal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( cameraToFrag, 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, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n\t#else\n\t\tvec4 envColor = vec4( 0.0 );\n\t#endif\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",envmap_common_pars_fragment:"#ifdef USE_ENVMAP\n\tuniform float envMapIntensity;\n\tuniform float flipEnvMap;\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tuniform samplerCube envMap;\n\t#else\n\t\tuniform sampler2D envMap;\n\t#endif\n\t\n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\n\tuniform float reflectivity;\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\tvarying vec3 vWorldPosition;\n\t\tuniform float refractionRatio;\n\t#else\n\t\tvarying vec3 vReflect;\n\t#endif\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\t\n\t\tvarying vec3 vWorldPosition;\n\t#else\n\t\tvarying vec3 vReflect;\n\t\tuniform float refractionRatio;\n\t#endif\n#endif",envmap_physical_pars_fragment:"#ifdef USE_ENVMAP\n\tvec3 getIBLIrradiance( const in vec3 normal ) {\n\t\t#ifdef ENVMAP_TYPE_CUBE_UV\n\t\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, worldNormal, 1.0 );\n\t\t\treturn PI * envMapColor.rgb * envMapIntensity;\n\t\t#else\n\t\t\treturn vec3( 0.0 );\n\t\t#endif\n\t}\n\tvec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {\n\t\t#ifdef ENVMAP_TYPE_CUBE_UV\n\t\t\tvec3 reflectVec = reflect( - viewDir, normal );\n\t\t\treflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );\n\t\t\treflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, reflectVec, roughness );\n\t\t\treturn envMapColor.rgb * envMapIntensity;\n\t\t#else\n\t\t\treturn vec3( 0.0 );\n\t\t#endif\n\t}\n\t#ifdef USE_ANISOTROPY\n\t\tvec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) {\n\t\t\t#ifdef ENVMAP_TYPE_CUBE_UV\n\t\t\t\tvec3 bentNormal = cross( bitangent, viewDir );\n\t\t\t\tbentNormal = normalize( cross( bentNormal, bitangent ) );\n\t\t\t\tbentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) );\n\t\t\t\treturn getIBLRadiance( viewDir, bentNormal, roughness );\n\t\t\t#else\n\t\t\t\treturn vec3( 0.0 );\n\t\t\t#endif\n\t\t}\n\t#endif\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvWorldPosition = worldPosition.xyz;\n\t#else\n\t\tvec3 cameraToVertex;\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n\t\t}\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",fog_vertex:"#ifdef USE_FOG\n\tvFogDepth = - mvPosition.z;\n#endif",fog_pars_vertex:"#ifdef USE_FOG\n\tvarying float vFogDepth;\n#endif",fog_fragment:"#ifdef USE_FOG\n\t#ifdef FOG_EXP2\n\t\tfloat fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );\n\t#else\n\t\tfloat fogFactor = smoothstep( fogNear, fogFar, vFogDepth );\n\t#endif\n\tgl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n#endif",fog_pars_fragment:"#ifdef USE_FOG\n\tuniform vec3 fogColor;\n\tvarying float vFogDepth;\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 USE_GRADIENTMAP\n\tuniform sampler2D gradientMap;\n#endif\nvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n\tfloat dotNL = dot( normal, lightDirection );\n\tvec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n\t#ifdef USE_GRADIENTMAP\n\t\treturn vec3( texture2D( gradientMap, coord ).r );\n\t#else\n\t\tvec2 fw = fwidth( coord ) * 0.5;\n\t\treturn mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) );\n\t#endif\n}",lightmap_fragment:"#ifdef USE_LIGHTMAP\n\tvec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n\tvec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;\n\treflectedLight.indirectDiffuse += lightMapIrradiance;\n#endif",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\n\tuniform sampler2D lightMap;\n\tuniform float lightMapIntensity;\n#endif",lights_lambert_fragment:"LambertMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularStrength = specularStrength;",lights_lambert_pars_fragment:"varying vec3 vViewPosition;\nstruct LambertMaterial {\n\tvec3 diffuseColor;\n\tfloat specularStrength;\n};\nvoid RE_Direct_Lambert( const in IncidentLight directLight, const in GeometricContext geometry, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in GeometricContext geometry, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_Lambert\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Lambert",lights_pars_begin:"uniform bool receiveShadow;\nuniform vec3 ambientLightColor;\nuniform vec3 lightProbe[ 9 ];\nvec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {\n\tfloat x = normal.x, y = normal.y, z = normal.z;\n\tvec3 result = shCoefficients[ 0 ] * 0.886227;\n\tresult += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;\n\tresult += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;\n\tresult += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;\n\tresult += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;\n\tresult += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;\n\tresult += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );\n\tresult += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;\n\tresult += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );\n\treturn result;\n}\nvec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {\n\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\tvec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );\n\treturn irradiance;\n}\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n\tvec3 irradiance = ambientLightColor;\n\treturn irradiance;\n}\nfloat getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n\t#if defined ( LEGACY_LIGHTS )\n\t\tif ( cutoffDistance > 0.0 && decayExponent > 0.0 ) {\n\t\t\treturn pow( saturate( - lightDistance / cutoffDistance + 1.0 ), decayExponent );\n\t\t}\n\t\treturn 1.0;\n\t#else\n\t\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n\t\tif ( cutoffDistance > 0.0 ) {\n\t\t\tdistanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\t\t}\n\t\treturn distanceFalloff;\n\t#endif\n}\nfloat getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {\n\treturn smoothstep( coneCosine, penumbraCosine, angleCosine );\n}\n#if NUM_DIR_LIGHTS > 0\n\tstruct DirectionalLight {\n\t\tvec3 direction;\n\t\tvec3 color;\n\t};\n\tuniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n\tvoid getDirectionalLightInfo( const in DirectionalLight directionalLight, const in GeometricContext geometry, out IncidentLight light ) {\n\t\tlight.color = directionalLight.color;\n\t\tlight.direction = directionalLight.direction;\n\t\tlight.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};\n\tuniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n\tvoid getPointLightInfo( const in PointLight pointLight, const in GeometricContext geometry, out IncidentLight light ) {\n\t\tvec3 lVector = pointLight.position - geometry.position;\n\t\tlight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tlight.color = pointLight.color;\n\t\tlight.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );\n\t\tlight.visible = ( light.color != vec3( 0.0 ) );\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\tstruct SpotLight {\n\t\tvec3 position;\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tfloat coneCos;\n\t\tfloat penumbraCos;\n\t};\n\tuniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n\tvoid getSpotLightInfo( const in SpotLight spotLight, const in GeometricContext geometry, out IncidentLight light ) {\n\t\tvec3 lVector = spotLight.position - geometry.position;\n\t\tlight.direction = normalize( lVector );\n\t\tfloat angleCos = dot( light.direction, spotLight.direction );\n\t\tfloat spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n\t\tif ( spotAttenuation > 0.0 ) {\n\t\t\tfloat lightDistance = length( lVector );\n\t\t\tlight.color = spotLight.color * spotAttenuation;\n\t\t\tlight.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );\n\t\t\tlight.visible = ( light.color != vec3( 0.0 ) );\n\t\t} else {\n\t\t\tlight.color = vec3( 0.0 );\n\t\t\tlight.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 ltc_1;\tuniform sampler2D ltc_2;\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 vec3 normal ) {\n\t\tfloat dotNL = dot( normal, hemiLight.direction );\n\t\tfloat hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n\t\tvec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n\t\treturn irradiance;\n\t}\n#endif",lights_toon_fragment:"ToonMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;",lights_toon_pars_fragment:"varying vec3 vViewPosition;\nstruct ToonMaterial {\n\tvec3 diffuseColor;\n};\nvoid RE_Direct_Toon( const in IncidentLight directLight, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\tvec3 irradiance = getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_Toon\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Toon",lights_phong_fragment:"BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;",lights_phong_pars_fragment:"varying vec3 vViewPosition;\nstruct BlinnPhongMaterial {\n\tvec3 diffuseColor;\n\tvec3 specularColor;\n\tfloat specularShininess;\n\tfloat specularStrength;\n};\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n\treflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometry.viewDir, geometry.normal, 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_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_BlinnPhong\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_BlinnPhong",lights_physical_fragment:"PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nvec3 dxy = max( abs( dFdx( geometryNormal ) ), abs( dFdy( geometryNormal ) ) );\nfloat geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );\nmaterial.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness;\nmaterial.roughness = min( material.roughness, 1.0 );\n#ifdef IOR\n\tmaterial.ior = ior;\n\t#ifdef USE_SPECULAR\n\t\tfloat specularIntensityFactor = specularIntensity;\n\t\tvec3 specularColorFactor = specularColor;\n\t\t#ifdef USE_SPECULAR_COLORMAP\n\t\t\tspecularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb;\n\t\t#endif\n\t\t#ifdef USE_SPECULAR_INTENSITYMAP\n\t\t\tspecularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a;\n\t\t#endif\n\t\tmaterial.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );\n\t#else\n\t\tfloat specularIntensityFactor = 1.0;\n\t\tvec3 specularColorFactor = vec3( 1.0 );\n\t\tmaterial.specularF90 = 1.0;\n\t#endif\n\tmaterial.specularColor = mix( min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor );\n#else\n\tmaterial.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor );\n\tmaterial.specularF90 = 1.0;\n#endif\n#ifdef USE_CLEARCOAT\n\tmaterial.clearcoat = clearcoat;\n\tmaterial.clearcoatRoughness = clearcoatRoughness;\n\tmaterial.clearcoatF0 = vec3( 0.04 );\n\tmaterial.clearcoatF90 = 1.0;\n\t#ifdef USE_CLEARCOATMAP\n\t\tmaterial.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x;\n\t#endif\n\t#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\t\tmaterial.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y;\n\t#endif\n\tmaterial.clearcoat = saturate( material.clearcoat );\tmaterial.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );\n\tmaterial.clearcoatRoughness += geometryRoughness;\n\tmaterial.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );\n#endif\n#ifdef USE_IRIDESCENCE\n\tmaterial.iridescence = iridescence;\n\tmaterial.iridescenceIOR = iridescenceIOR;\n\t#ifdef USE_IRIDESCENCEMAP\n\t\tmaterial.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r;\n\t#endif\n\t#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\t\tmaterial.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum;\n\t#else\n\t\tmaterial.iridescenceThickness = iridescenceThicknessMaximum;\n\t#endif\n#endif\n#ifdef USE_SHEEN\n\tmaterial.sheenColor = sheenColor;\n\t#ifdef USE_SHEEN_COLORMAP\n\t\tmaterial.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb;\n\t#endif\n\tmaterial.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 );\n\t#ifdef USE_SHEEN_ROUGHNESSMAP\n\t\tmaterial.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a;\n\t#endif\n#endif\n#ifdef USE_ANISOTROPY\n\t#ifdef USE_ANISOTROPYMAP\n\t\tmat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x );\n\t\tvec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb;\n\t\tvec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b;\n\t#else\n\t\tvec2 anisotropyV = anisotropyVector;\n\t#endif\n\tmaterial.anisotropy = length( anisotropyV );\n\tanisotropyV /= material.anisotropy;\n\tmaterial.anisotropy = saturate( material.anisotropy );\n\tmaterial.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );\n\tmaterial.anisotropyT = tbn[ 0 ] * anisotropyV.x - tbn[ 1 ] * anisotropyV.y;\n\tmaterial.anisotropyB = tbn[ 1 ] * anisotropyV.x + tbn[ 0 ] * anisotropyV.y;\n#endif",lights_physical_pars_fragment:"struct PhysicalMaterial {\n\tvec3 diffuseColor;\n\tfloat roughness;\n\tvec3 specularColor;\n\tfloat specularF90;\n\t#ifdef USE_CLEARCOAT\n\t\tfloat clearcoat;\n\t\tfloat clearcoatRoughness;\n\t\tvec3 clearcoatF0;\n\t\tfloat clearcoatF90;\n\t#endif\n\t#ifdef USE_IRIDESCENCE\n\t\tfloat iridescence;\n\t\tfloat iridescenceIOR;\n\t\tfloat iridescenceThickness;\n\t\tvec3 iridescenceFresnel;\n\t\tvec3 iridescenceF0;\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tvec3 sheenColor;\n\t\tfloat sheenRoughness;\n\t#endif\n\t#ifdef IOR\n\t\tfloat ior;\n\t#endif\n\t#ifdef USE_TRANSMISSION\n\t\tfloat transmission;\n\t\tfloat transmissionAlpha;\n\t\tfloat thickness;\n\t\tfloat attenuationDistance;\n\t\tvec3 attenuationColor;\n\t#endif\n\t#ifdef USE_ANISOTROPY\n\t\tfloat anisotropy;\n\t\tfloat alphaT;\n\t\tvec3 anisotropyT;\n\t\tvec3 anisotropyB;\n\t#endif\n};\nvec3 clearcoatSpecular = vec3( 0.0 );\nvec3 sheenSpecular = vec3( 0.0 );\nvec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) {\n float x = clamp( 1.0 - dotVH, 0.0, 1.0 );\n float x2 = x * x;\n float x5 = clamp( x * x2 * x2, 0.0, 0.9999 );\n return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 );\n}\nfloat V_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}\n#ifdef USE_ANISOTROPY\n\tfloat V_GGX_SmithCorrelated_Anisotropic( const in float alphaT, const in float alphaB, const in float dotTV, const in float dotBV, const in float dotTL, const in float dotBL, const in float dotNV, const in float dotNL ) {\n\t\tfloat gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) );\n\t\tfloat gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) );\n\t\tfloat v = 0.5 / ( gv + gl );\n\t\treturn saturate(v);\n\t}\n\tfloat D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) {\n\t\tfloat a2 = alphaT * alphaB;\n\t\thighp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH );\n\t\thighp float v2 = dot( v, v );\n\t\tfloat w2 = a2 / v2;\n\t\treturn RECIPROCAL_PI * a2 * pow2 ( w2 );\n\t}\n#endif\n#ifdef USE_CLEARCOAT\n\tvec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) {\n\t\tvec3 f0 = material.clearcoatF0;\n\t\tfloat f90 = material.clearcoatF90;\n\t\tfloat roughness = material.clearcoatRoughness;\n\t\tfloat alpha = pow2( roughness );\n\t\tvec3 halfDir = normalize( lightDir + viewDir );\n\t\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\t\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\t\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\t\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\t\tvec3 F = F_Schlick( f0, f90, dotVH );\n\t\tfloat V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\t\tfloat D = D_GGX( alpha, dotNH );\n\t\treturn F * ( V * D );\n\t}\n#endif\nvec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {\n\tvec3 f0 = material.specularColor;\n\tfloat f90 = material.specularF90;\n\tfloat roughness = material.roughness;\n\tfloat alpha = pow2( roughness );\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\tvec3 F = F_Schlick( f0, f90, dotVH );\n\t#ifdef USE_IRIDESCENCE\n\t\tF = mix( F, material.iridescenceFresnel, material.iridescence );\n\t#endif\n\t#ifdef USE_ANISOTROPY\n\t\tfloat dotTL = dot( material.anisotropyT, lightDir );\n\t\tfloat dotTV = dot( material.anisotropyT, viewDir );\n\t\tfloat dotTH = dot( material.anisotropyT, halfDir );\n\t\tfloat dotBL = dot( material.anisotropyB, lightDir );\n\t\tfloat dotBV = dot( material.anisotropyB, viewDir );\n\t\tfloat dotBH = dot( material.anisotropyB, halfDir );\n\t\tfloat V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL );\n\t\tfloat D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH );\n\t#else\n\t\tfloat V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\t\tfloat D = D_GGX( alpha, dotNH );\n\t#endif\n\treturn F * ( V * D );\n}\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, 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\tfloat dotNV = saturate( dot( N, V ) );\n\tvec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\n\tuv = uv * LUT_SCALE + LUT_BIAS;\n\treturn uv;\n}\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n\tfloat l = length( f );\n\treturn max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n}\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n\tfloat x = dot( v1, v2 );\n\tfloat y = abs( x );\n\tfloat a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\n\tfloat b = 3.4175940 + ( 4.1616724 + y ) * y;\n\tfloat v = a / b;\n\tfloat theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\n\treturn cross( v1, v2 ) * theta_sintheta;\n}\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\n\tvec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n\tvec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n\tvec3 lightNormal = cross( v1, v2 );\n\tif( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n\tvec3 T1, T2;\n\tT1 = normalize( V - N * dot( V, N ) );\n\tT2 = - cross( N, T1 );\n\tmat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );\n\tvec3 coords[ 4 ];\n\tcoords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n\tcoords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n\tcoords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n\tcoords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n\tcoords[ 0 ] = normalize( coords[ 0 ] );\n\tcoords[ 1 ] = normalize( coords[ 1 ] );\n\tcoords[ 2 ] = normalize( coords[ 2 ] );\n\tcoords[ 3 ] = normalize( coords[ 3 ] );\n\tvec3 vectorFormFactor = vec3( 0.0 );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n\tfloat result = LTC_ClippedSphereFormFactor( vectorFormFactor );\n\treturn vec3( result );\n}\n#if defined( USE_SHEEN )\nfloat D_Charlie( float roughness, float dotNH ) {\n\tfloat alpha = pow2( roughness );\n\tfloat invAlpha = 1.0 / alpha;\n\tfloat cos2h = dotNH * dotNH;\n\tfloat sin2h = max( 1.0 - cos2h, 0.0078125 );\n\treturn ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );\n}\nfloat V_Neubelt( float dotNV, float dotNL ) {\n\treturn saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );\n}\nvec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat D = D_Charlie( sheenRoughness, dotNH );\n\tfloat V = V_Neubelt( dotNV, dotNL );\n\treturn sheenColor * ( D * V );\n}\n#endif\nfloat IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat r2 = roughness * roughness;\n\tfloat a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95;\n\tfloat b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72;\n\tfloat DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) );\n\treturn saturate( DG * RECIPROCAL_PI );\n}\nvec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, 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 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw;\n\treturn fab;\n}\nvec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {\n\tvec2 fab = DFGApprox( normal, viewDir, roughness );\n\treturn specularColor * fab.x + specularF90 * fab.y;\n}\n#ifdef USE_IRIDESCENCE\nvoid computeMultiscatteringIridescence( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float iridescence, const in vec3 iridescenceF0, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n#else\nvoid computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n#endif\n\tvec2 fab = DFGApprox( normal, viewDir, roughness );\n\t#ifdef USE_IRIDESCENCE\n\t\tvec3 Fr = mix( specularColor, iridescenceF0, iridescence );\n\t#else\n\t\tvec3 Fr = specularColor;\n\t#endif\n\tvec3 FssEss = Fr * fab.x + specularF90 * fab.y;\n\tfloat Ess = fab.x + fab.y;\n\tfloat Ems = 1.0 - Ess;\n\tvec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619;\tvec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );\n\tsingleScatter += FssEss;\n\tmultiScatter += Fms * Ems;\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n\tvoid RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t\tvec3 normal = geometry.normal;\n\t\tvec3 viewDir = geometry.viewDir;\n\t\tvec3 position = geometry.position;\n\t\tvec3 lightPos = rectAreaLight.position;\n\t\tvec3 halfWidth = rectAreaLight.halfWidth;\n\t\tvec3 halfHeight = rectAreaLight.halfHeight;\n\t\tvec3 lightColor = rectAreaLight.color;\n\t\tfloat roughness = material.roughness;\n\t\tvec3 rectCoords[ 4 ];\n\t\trectCoords[ 0 ] = lightPos + halfWidth - halfHeight;\t\trectCoords[ 1 ] = lightPos - halfWidth - halfHeight;\n\t\trectCoords[ 2 ] = lightPos - halfWidth + halfHeight;\n\t\trectCoords[ 3 ] = lightPos + halfWidth + halfHeight;\n\t\tvec2 uv = LTC_Uv( normal, viewDir, roughness );\n\t\tvec4 t1 = texture2D( ltc_1, uv );\n\t\tvec4 t2 = texture2D( ltc_2, uv );\n\t\tmat3 mInv = mat3(\n\t\t\tvec3( t1.x, 0, t1.y ),\n\t\t\tvec3( 0, 1, 0 ),\n\t\t\tvec3( t1.z, 0, t1.w )\n\t\t);\n\t\tvec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );\n\t\treflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n\t\treflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\n\t}\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( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifdef USE_CLEARCOAT\n\t\tfloat dotNLcc = saturate( dot( geometry.clearcoatNormal, directLight.direction ) );\n\t\tvec3 ccIrradiance = dotNLcc * directLight.color;\n\t\tclearcoatSpecular += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometry.viewDir, geometry.clearcoatNormal, material );\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tsheenSpecular += irradiance * BRDF_Sheen( directLight.direction, geometry.viewDir, geometry.normal, material.sheenColor, material.sheenRoughness );\n\t#endif\n\treflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometry.viewDir, geometry.normal, material );\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\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_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n\t#ifdef USE_CLEARCOAT\n\t\tclearcoatSpecular += clearcoatRadiance * EnvironmentBRDF( geometry.clearcoatNormal, geometry.viewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tsheenSpecular += irradiance * material.sheenColor * IBLSheenBRDF( geometry.normal, geometry.viewDir, material.sheenRoughness );\n\t#endif\n\tvec3 singleScattering = vec3( 0.0 );\n\tvec3 multiScattering = vec3( 0.0 );\n\tvec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n\t#ifdef USE_IRIDESCENCE\n\t\tcomputeMultiscatteringIridescence( geometry.normal, geometry.viewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering );\n\t#else\n\t\tcomputeMultiscattering( geometry.normal, geometry.viewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering );\n\t#endif\n\tvec3 totalScattering = singleScattering + multiScattering;\n\tvec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) );\n\treflectedLight.indirectSpecular += radiance * singleScattering;\n\treflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;\n\treflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;\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\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}",lights_fragment_begin:"\nGeometricContext geometry;\ngeometry.position = - vViewPosition;\ngeometry.normal = normal;\ngeometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\n#ifdef USE_CLEARCOAT\n\tgeometry.clearcoatNormal = clearcoatNormal;\n#endif\n#ifdef USE_IRIDESCENCE\n\tfloat dotNVi = saturate( dot( normal, geometry.viewDir ) );\n\tif ( material.iridescenceThickness == 0.0 ) {\n\t\tmaterial.iridescence = 0.0;\n\t} else {\n\t\tmaterial.iridescence = saturate( material.iridescence );\n\t}\n\tif ( material.iridescence > 0.0 ) {\n\t\tmaterial.iridescenceFresnel = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );\n\t\tmaterial.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi );\n\t}\n#endif\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n\tPointLight pointLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tgetPointLightInfo( pointLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )\n\t\tpointLightShadow = pointLightShadows[ i ];\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n\tSpotLight spotLight;\n\tvec4 spotColor;\n\tvec3 spotLightCoord;\n\tbool inSpotLightMap;\n\t#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tgetSpotLightInfo( spotLight, geometry, directLight );\n\t\t#if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n\t\t#define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX\n\t\t#elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\t#define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS\n\t\t#else\n\t\t#define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n\t\t#endif\n\t\t#if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS )\n\t\t\tspotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w;\n\t\t\tinSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) );\n\t\t\tspotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy );\n\t\t\tdirectLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color;\n\t\t#endif\n\t\t#undef SPOT_LIGHT_MAP_INDEX\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\tspotLightShadow = spotLightShadows[ i ];\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n\tDirectionalLight directionalLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tgetDirectionalLightInfo( directionalLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n\t\tdirectionalLightShadow = directionalLightShadows[ i ];\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n\tRectAreaLight rectAreaLight;\n\t#pragma unroll_loop_start\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\t#pragma unroll_loop_end\n#endif\n#if defined( RE_IndirectDiffuse )\n\tvec3 iblIrradiance = vec3( 0.0 );\n\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n\tirradiance += getLightProbeIrradiance( lightProbe, geometry.normal );\n\t#if ( NUM_HEMI_LIGHTS > 0 )\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\t\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry.normal );\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n#endif\n#if defined( RE_IndirectSpecular )\n\tvec3 radiance = vec3( 0.0 );\n\tvec3 clearcoatRadiance = vec3( 0.0 );\n#endif",lights_fragment_maps:"#if defined( RE_IndirectDiffuse )\n\t#ifdef USE_LIGHTMAP\n\t\tvec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n\t\tvec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;\n\t\tirradiance += lightMapIrradiance;\n\t#endif\n\t#if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )\n\t\tiblIrradiance += getIBLIrradiance( geometry.normal );\n\t#endif\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\t#ifdef USE_ANISOTROPY\n\t\tradiance += getIBLAnisotropyRadiance( geometry.viewDir, geometry.normal, material.roughness, material.anisotropyB, material.anisotropy );\n\t#else\n\t\tradiance += getIBLRadiance( geometry.viewDir, geometry.normal, material.roughness );\n\t#endif\n\t#ifdef USE_CLEARCOAT\n\t\tclearcoatRadiance += getIBLRadiance( geometry.viewDir, geometry.clearcoatNormal, material.clearcoatRoughness );\n\t#endif\n#endif",lights_fragment_end:"#if defined( RE_IndirectDiffuse )\n\tRE_IndirectDiffuse( irradiance, geometry, material, reflectedLight );\n#endif\n#if defined( RE_IndirectSpecular )\n\tRE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometry, material, reflectedLight );\n#endif",logdepthbuf_fragment:"#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\tgl_FragDepthEXT = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\n#endif",logdepthbuf_pars_fragment:"#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\tuniform float logDepthBufFC;\n\tvarying float vFragDepth;\n\tvarying float vIsPerspective;\n#endif",logdepthbuf_pars_vertex:"#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvarying float vFragDepth;\n\t\tvarying float vIsPerspective;\n\t#else\n\t\tuniform float logDepthBufFC;\n\t#endif\n#endif",logdepthbuf_vertex:"#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvFragDepth = 1.0 + gl_Position.w;\n\t\tvIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );\n\t#else\n\t\tif ( isPerspectiveMatrix( projectionMatrix ) ) {\n\t\t\tgl_Position.z = log2( max( EPSILON, gl_Position.w + 1.0 ) ) * logDepthBufFC - 1.0;\n\t\t\tgl_Position.z *= gl_Position.w;\n\t\t}\n\t#endif\n#endif",map_fragment:"#ifdef USE_MAP\n\tdiffuseColor *= texture2D( map, vMapUv );\n#endif",map_pars_fragment:"#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif",map_particle_fragment:"#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\t#if defined( USE_POINTS_UV )\n\t\tvec2 uv = vUv;\n\t#else\n\t\tvec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;\n\t#endif\n#endif\n#ifdef USE_MAP\n\tdiffuseColor *= texture2D( map, uv );\n#endif\n#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, uv ).g;\n#endif",map_particle_pars_fragment:"#if defined( USE_POINTS_UV )\n\tvarying vec2 vUv;\n#else\n\t#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\t\tuniform mat3 uvTransform;\n\t#endif\n#endif\n#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif\n#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif",metalnessmap_fragment:"float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n\tvec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );\n\tmetalnessFactor *= texelMetalness.b;\n#endif",metalnessmap_pars_fragment:"#ifdef USE_METALNESSMAP\n\tuniform sampler2D metalnessMap;\n#endif",morphcolor_vertex:"#if defined( USE_MORPHCOLORS ) && defined( MORPHTARGETS_TEXTURE )\n\tvColor *= morphTargetBaseInfluence;\n\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\t#if defined( USE_COLOR_ALPHA )\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ];\n\t\t#elif defined( USE_COLOR )\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];\n\t\t#endif\n\t}\n#endif",morphnormal_vertex:"#ifdef USE_MORPHNORMALS\n\tobjectNormal *= morphTargetBaseInfluence;\n\t#ifdef MORPHTARGETS_TEXTURE\n\t\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];\n\t\t}\n\t#else\n\t\tobjectNormal += morphNormal0 * morphTargetInfluences[ 0 ];\n\t\tobjectNormal += morphNormal1 * morphTargetInfluences[ 1 ];\n\t\tobjectNormal += morphNormal2 * morphTargetInfluences[ 2 ];\n\t\tobjectNormal += morphNormal3 * morphTargetInfluences[ 3 ];\n\t#endif\n#endif",morphtarget_pars_vertex:"#ifdef USE_MORPHTARGETS\n\tuniform float morphTargetBaseInfluence;\n\t#ifdef MORPHTARGETS_TEXTURE\n\t\tuniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];\n\t\tuniform sampler2DArray morphTargetsTexture;\n\t\tuniform ivec2 morphTargetsTextureSize;\n\t\tvec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) {\n\t\t\tint texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset;\n\t\t\tint y = texelIndex / morphTargetsTextureSize.x;\n\t\t\tint x = texelIndex - y * morphTargetsTextureSize.x;\n\t\t\tivec3 morphUV = ivec3( x, y, morphTargetIndex );\n\t\t\treturn texelFetch( morphTargetsTexture, morphUV, 0 );\n\t\t}\n\t#else\n\t\t#ifndef USE_MORPHNORMALS\n\t\t\tuniform float morphTargetInfluences[ 8 ];\n\t\t#else\n\t\t\tuniform float morphTargetInfluences[ 4 ];\n\t\t#endif\n\t#endif\n#endif",morphtarget_vertex:"#ifdef USE_MORPHTARGETS\n\ttransformed *= morphTargetBaseInfluence;\n\t#ifdef MORPHTARGETS_TEXTURE\n\t\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];\n\t\t}\n\t#else\n\t\ttransformed += morphTarget0 * morphTargetInfluences[ 0 ];\n\t\ttransformed += morphTarget1 * morphTargetInfluences[ 1 ];\n\t\ttransformed += morphTarget2 * morphTargetInfluences[ 2 ];\n\t\ttransformed += morphTarget3 * morphTargetInfluences[ 3 ];\n\t\t#ifndef USE_MORPHNORMALS\n\t\t\ttransformed += morphTarget4 * morphTargetInfluences[ 4 ];\n\t\t\ttransformed += morphTarget5 * morphTargetInfluences[ 5 ];\n\t\t\ttransformed += morphTarget6 * morphTargetInfluences[ 6 ];\n\t\t\ttransformed += morphTarget7 * morphTargetInfluences[ 7 ];\n\t\t#endif\n\t#endif\n#endif",normal_fragment_begin:"float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;\n#ifdef FLAT_SHADED\n\tvec3 fdx = dFdx( vViewPosition );\n\tvec3 fdy = dFdy( vViewPosition );\n\tvec3 normal = normalize( cross( fdx, fdy ) );\n#else\n\tvec3 normal = normalize( vNormal );\n\t#ifdef DOUBLE_SIDED\n\t\tnormal *= faceDirection;\n\t#endif\n#endif\n#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY )\n\t#ifdef USE_TANGENT\n\t\tmat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\n\t#else\n\t\tmat3 tbn = getTangentFrame( - vViewPosition, normal,\n\t\t#if defined( USE_NORMALMAP )\n\t\t\tvNormalMapUv\n\t\t#elif defined( USE_CLEARCOAT_NORMALMAP )\n\t\t\tvClearcoatNormalMapUv\n\t\t#else\n\t\t\tvUv\n\t\t#endif\n\t\t);\n\t#endif\n\t#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )\n\t\ttbn[0] *= faceDirection;\n\t\ttbn[1] *= faceDirection;\n\t#endif\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\t#ifdef USE_TANGENT\n\t\tmat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\n\t#else\n\t\tmat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv );\n\t#endif\n\t#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )\n\t\ttbn2[0] *= faceDirection;\n\t\ttbn2[1] *= faceDirection;\n\t#endif\n#endif\nvec3 geometryNormal = normal;",normal_fragment_maps:"#ifdef USE_NORMALMAP_OBJECTSPACE\n\tnormal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;\n\t#ifdef FLIP_SIDED\n\t\tnormal = - normal;\n\t#endif\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * faceDirection;\n\t#endif\n\tnormal = normalize( normalMatrix * normal );\n#elif defined( USE_NORMALMAP_TANGENTSPACE )\n\tvec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;\n\tmapN.xy *= normalScale;\n\tnormal = normalize( tbn * mapN );\n#elif defined( USE_BUMPMAP )\n\tnormal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );\n#endif",normal_pars_fragment:"#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif",normal_pars_vertex:"#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif",normal_vertex:"#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n\t#ifdef USE_TANGENT\n\t\tvTangent = normalize( transformedTangent );\n\t\tvBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\n\t#endif\n#endif",normalmap_pars_fragment:"#ifdef USE_NORMALMAP\n\tuniform sampler2D normalMap;\n\tuniform vec2 normalScale;\n#endif\n#ifdef USE_NORMALMAP_OBJECTSPACE\n\tuniform mat3 normalMatrix;\n#endif\n#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) )\n\tmat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) {\n\t\tvec3 q0 = dFdx( eye_pos.xyz );\n\t\tvec3 q1 = dFdy( eye_pos.xyz );\n\t\tvec2 st0 = dFdx( uv.st );\n\t\tvec2 st1 = dFdy( uv.st );\n\t\tvec3 N = surf_norm;\n\t\tvec3 q1perp = cross( q1, N );\n\t\tvec3 q0perp = cross( N, q0 );\n\t\tvec3 T = q1perp * st0.x + q0perp * st1.x;\n\t\tvec3 B = q1perp * st0.y + q0perp * st1.y;\n\t\tfloat det = max( dot( T, T ), dot( B, B ) );\n\t\tfloat scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det );\n\t\treturn mat3( T * scale, B * scale, N );\n\t}\n#endif",clearcoat_normal_fragment_begin:"#ifdef USE_CLEARCOAT\n\tvec3 clearcoatNormal = geometryNormal;\n#endif",clearcoat_normal_fragment_maps:"#ifdef USE_CLEARCOAT_NORMALMAP\n\tvec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;\n\tclearcoatMapN.xy *= clearcoatNormalScale;\n\tclearcoatNormal = normalize( tbn2 * clearcoatMapN );\n#endif",clearcoat_pars_fragment:"#ifdef USE_CLEARCOATMAP\n\tuniform sampler2D clearcoatMap;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tuniform sampler2D clearcoatNormalMap;\n\tuniform vec2 clearcoatNormalScale;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tuniform sampler2D clearcoatRoughnessMap;\n#endif",iridescence_pars_fragment:"#ifdef USE_IRIDESCENCEMAP\n\tuniform sampler2D iridescenceMap;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tuniform sampler2D iridescenceThicknessMap;\n#endif",opaque_fragment:"#ifdef OPAQUE\ndiffuseColor.a = 1.0;\n#endif\n#ifdef USE_TRANSMISSION\ndiffuseColor.a *= material.transmissionAlpha;\n#endif\ngl_FragColor = vec4( outgoingLight, diffuseColor.a );",packing:"vec3 packNormalToRGB( const in vec3 normal ) {\n\treturn normalize( normal ) * 0.5 + 0.5;\n}\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\n\treturn 2.0 * rgb.xyz - 1.0;\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}\nvec2 packDepthToRG( in highp float v ) {\n\treturn packDepthToRGBA( v ).yx;\n}\nfloat unpackRGToDepth( const in highp vec2 v ) {\n\treturn unpackRGBAToDepth( vec4( v.xy, 0.0, 0.0 ) );\n}\nvec4 pack2HalfToRGBA( vec2 v ) {\n\tvec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) );\n\treturn vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w );\n}\nvec2 unpackRGBATo2Half( vec4 v ) {\n\treturn vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );\n}\nfloat viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( viewZ + near ) / ( near - far );\n}\nfloat orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) {\n\treturn depth * ( near - far ) - near;\n}\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ );\n}\nfloat perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) {\n\treturn ( near * far ) / ( ( far - near ) * depth - far );\n}",premultiplied_alpha_fragment:"#ifdef PREMULTIPLIED_ALPHA\n\tgl_FragColor.rgb *= gl_FragColor.a;\n#endif",project_vertex:"vec4 mvPosition = vec4( transformed, 1.0 );\n#ifdef USE_INSTANCING\n\tmvPosition = instanceMatrix * mvPosition;\n#endif\nmvPosition = modelViewMatrix * mvPosition;\ngl_Position = projectionMatrix * mvPosition;",dithering_fragment:"#ifdef DITHERING\n\tgl_FragColor.rgb = dithering( gl_FragColor.rgb );\n#endif",dithering_pars_fragment:"#ifdef DITHERING\n\tvec3 dithering( vec3 color ) {\n\t\tfloat grid_position = rand( gl_FragCoord.xy );\n\t\tvec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );\n\t\tdither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );\n\t\treturn color + dither_shift_RGB;\n\t}\n#endif",roughnessmap_fragment:"float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n\tvec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );\n\troughnessFactor *= texelRoughness.g;\n#endif",roughnessmap_pars_fragment:"#ifdef USE_ROUGHNESSMAP\n\tuniform sampler2D roughnessMap;\n#endif",shadowmap_pars_fragment:"#if NUM_SPOT_LIGHT_COORDS > 0\n\tvarying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#if NUM_SPOT_LIGHT_MAPS > 0\n\tuniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ];\n#endif\n#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n\tfloat texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n\t\treturn step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\n\t}\n\tvec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {\n\t\treturn unpackRGBATo2Half( texture2D( shadow, uv ) );\n\t}\n\tfloat VSMShadow (sampler2D shadow, vec2 uv, float compare ){\n\t\tfloat occlusion = 1.0;\n\t\tvec2 distribution = texture2DDistribution( shadow, uv );\n\t\tfloat hard_shadow = step( compare , distribution.x );\n\t\tif (hard_shadow != 1.0 ) {\n\t\t\tfloat distance = compare - distribution.x ;\n\t\t\tfloat variance = max( 0.00000, distribution.y * distribution.y );\n\t\t\tfloat softness_probability = variance / (variance + distance * distance );\t\t\tsoftness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 );\t\t\tocclusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 );\n\t\t}\n\t\treturn occlusion;\n\t}\n\tfloat getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\t\tfloat shadow = 1.0;\n\t\tshadowCoord.xyz /= shadowCoord.w;\n\t\tshadowCoord.z += shadowBias;\n\t\tbool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;\n\t\tbool frustumTest = inFrustum && shadowCoord.z <= 1.0;\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\tfloat dx2 = dx0 / 2.0;\n\t\t\tfloat dy2 = dy0 / 2.0;\n\t\t\tfloat dx3 = dx1 / 2.0;\n\t\t\tfloat dy3 = dy1 / 2.0;\n\t\t\tshadow = (\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( dx2, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), 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( dx2, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), 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 / 17.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx = texelSize.x;\n\t\t\tfloat dy = texelSize.y;\n\t\t\tvec2 uv = shadowCoord.xy;\n\t\t\tvec2 f = fract( uv * shadowMapSize + 0.5 );\n\t\t\tuv -= f * texelSize;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, uv, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t\t f.x ),\n\t\t\t\t\t mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t\t f.x ),\n\t\t\t\t\t f.y )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_VSM )\n\t\t\tshadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#else\n\t\t\tshadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#endif\n\t\t}\n\t\treturn shadow;\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, float shadowCameraNear, float shadowCameraFar ) {\n\t\tvec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\n\t\tvec3 lightToPosition = shadowCoord.xyz;\n\t\tfloat dp = ( length( lightToPosition ) - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear );\t\tdp += shadowBias;\n\t\tvec3 bd3D = normalize( lightToPosition );\n\t\t#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )\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",shadowmap_pars_vertex:"#if NUM_SPOT_LIGHT_COORDS > 0\n\tuniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];\n\tvarying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n#endif",shadowmap_vertex:"#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )\n\tvec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\tvec4 shadowWorldPosition;\n#endif\n#if defined( USE_SHADOWMAP )\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );\n\t\t\tvDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );\n\t\t\tvPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n#endif\n#if NUM_SPOT_LIGHT_COORDS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) {\n\t\tshadowWorldPosition = worldPosition;\n\t\t#if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\t\tshadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias;\n\t\t#endif\n\t\tvSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;\n\t}\n\t#pragma unroll_loop_end\n#endif",shadowmask_pars_fragment:"float getShadowMask() {\n\tfloat shadow = 1.0;\n\t#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\tdirectionalLight = directionalLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n\t\tspotLight = spotLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\tpointLight = pointLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#endif\n\treturn shadow;\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\tuniform highp sampler2D boneTexture;\n\tuniform int boneTextureSize;\n\tmat4 getBoneMatrix( const in float i ) {\n\t\tfloat j = i * 4.0;\n\t\tfloat x = mod( j, float( boneTextureSize ) );\n\t\tfloat y = floor( j / float( boneTextureSize ) );\n\t\tfloat dx = 1.0 / float( boneTextureSize );\n\t\tfloat dy = 1.0 / float( boneTextureSize );\n\t\ty = dy * ( y + 0.5 );\n\t\tvec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );\n\t\tvec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );\n\t\tvec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );\n\t\tvec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );\n\t\tmat4 bone = mat4( v1, v2, v3, v4 );\n\t\treturn bone;\n\t}\n#endif",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\ttransformed = ( bindMatrixInverse * skinned ).xyz;\n#endif",skinnormal_vertex:"#ifdef USE_SKINNING\n\tmat4 skinMatrix = mat4( 0.0 );\n\tskinMatrix += skinWeight.x * boneMatX;\n\tskinMatrix += skinWeight.y * boneMatY;\n\tskinMatrix += skinWeight.z * boneMatZ;\n\tskinMatrix += skinWeight.w * boneMatW;\n\tskinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;\n\tobjectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n\t#ifdef USE_TANGENT\n\t\tobjectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n\t#endif\n#endif",specularmap_fragment:"float specularStrength;\n#ifdef USE_SPECULARMAP\n\tvec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );\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\tgl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif",tonemapping_pars_fragment:"#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\nuniform float toneMappingExposure;\nvec3 LinearToneMapping( vec3 color ) {\n\treturn saturate( toneMappingExposure * color );\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( color / ( vec3( 1.0 ) + color ) );\n}\nvec3 OptimizedCineonToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\tcolor = max( vec3( 0.0 ), color - 0.004 );\n\treturn pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\nvec3 RRTAndODTFit( vec3 v ) {\n\tvec3 a = v * ( v + 0.0245786 ) - 0.000090537;\n\tvec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;\n\treturn a / b;\n}\nvec3 ACESFilmicToneMapping( vec3 color ) {\n\tconst mat3 ACESInputMat = mat3(\n\t\tvec3( 0.59719, 0.07600, 0.02840 ),\t\tvec3( 0.35458, 0.90834, 0.13383 ),\n\t\tvec3( 0.04823, 0.01566, 0.83777 )\n\t);\n\tconst mat3 ACESOutputMat = mat3(\n\t\tvec3( 1.60475, -0.10208, -0.00327 ),\t\tvec3( -0.53108, 1.10813, -0.07276 ),\n\t\tvec3( -0.07367, -0.00605, 1.07602 )\n\t);\n\tcolor *= toneMappingExposure / 0.6;\n\tcolor = ACESInputMat * color;\n\tcolor = RRTAndODTFit( color );\n\tcolor = ACESOutputMat * color;\n\treturn saturate( color );\n}\nvec3 CustomToneMapping( vec3 color ) { return color; }",transmission_fragment:"#ifdef USE_TRANSMISSION\n\tmaterial.transmission = transmission;\n\tmaterial.transmissionAlpha = 1.0;\n\tmaterial.thickness = thickness;\n\tmaterial.attenuationDistance = attenuationDistance;\n\tmaterial.attenuationColor = attenuationColor;\n\t#ifdef USE_TRANSMISSIONMAP\n\t\tmaterial.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r;\n\t#endif\n\t#ifdef USE_THICKNESSMAP\n\t\tmaterial.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g;\n\t#endif\n\tvec3 pos = vWorldPosition;\n\tvec3 v = normalize( cameraPosition - pos );\n\tvec3 n = inverseTransformDirection( normal, viewMatrix );\n\tvec4 transmitted = getIBLVolumeRefraction(\n\t\tn, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90,\n\t\tpos, modelMatrix, viewMatrix, projectionMatrix, material.ior, material.thickness,\n\t\tmaterial.attenuationColor, material.attenuationDistance );\n\tmaterial.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission );\n\ttotalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission );\n#endif",transmission_pars_fragment:"#ifdef USE_TRANSMISSION\n\tuniform float transmission;\n\tuniform float thickness;\n\tuniform float attenuationDistance;\n\tuniform vec3 attenuationColor;\n\t#ifdef USE_TRANSMISSIONMAP\n\t\tuniform sampler2D transmissionMap;\n\t#endif\n\t#ifdef USE_THICKNESSMAP\n\t\tuniform sampler2D thicknessMap;\n\t#endif\n\tuniform vec2 transmissionSamplerSize;\n\tuniform sampler2D transmissionSamplerMap;\n\tuniform mat4 modelMatrix;\n\tuniform mat4 projectionMatrix;\n\tvarying vec3 vWorldPosition;\n\tfloat w0( float a ) {\n\t\treturn ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 );\n\t}\n\tfloat w1( float a ) {\n\t\treturn ( 1.0 / 6.0 ) * ( a * a * ( 3.0 * a - 6.0 ) + 4.0 );\n\t}\n\tfloat w2( float a ){\n\t\treturn ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 );\n\t}\n\tfloat w3( float a ) {\n\t\treturn ( 1.0 / 6.0 ) * ( a * a * a );\n\t}\n\tfloat g0( float a ) {\n\t\treturn w0( a ) + w1( a );\n\t}\n\tfloat g1( float a ) {\n\t\treturn w2( a ) + w3( a );\n\t}\n\tfloat h0( float a ) {\n\t\treturn - 1.0 + w1( a ) / ( w0( a ) + w1( a ) );\n\t}\n\tfloat h1( float a ) {\n\t\treturn 1.0 + w3( a ) / ( w2( a ) + w3( a ) );\n\t}\n\tvec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) {\n\t\tuv = uv * texelSize.zw + 0.5;\n\t\tvec2 iuv = floor( uv );\n\t\tvec2 fuv = fract( uv );\n\t\tfloat g0x = g0( fuv.x );\n\t\tfloat g1x = g1( fuv.x );\n\t\tfloat h0x = h0( fuv.x );\n\t\tfloat h1x = h1( fuv.x );\n\t\tfloat h0y = h0( fuv.y );\n\t\tfloat h1y = h1( fuv.y );\n\t\tvec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\n\t\tvec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\n\t\tvec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\n\t\tvec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\n\t\treturn g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) +\n\t\t\tg1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) );\n\t}\n\tvec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) {\n\t\tvec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) );\n\t\tvec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) );\n\t\tvec2 fLodSizeInv = 1.0 / fLodSize;\n\t\tvec2 cLodSizeInv = 1.0 / cLodSize;\n\t\tvec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) );\n\t\tvec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) );\n\t\treturn mix( fSample, cSample, fract( lod ) );\n\t}\n\tvec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {\n\t\tvec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );\n\t\tvec3 modelScale;\n\t\tmodelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );\n\t\tmodelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );\n\t\tmodelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );\n\t\treturn normalize( refractionVector ) * thickness * modelScale;\n\t}\n\tfloat applyIorToRoughness( const in float roughness, const in float ior ) {\n\t\treturn roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );\n\t}\n\tvec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {\n\t\tfloat lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );\n\t\treturn textureBicubic( transmissionSamplerMap, fragCoord.xy, lod );\n\t}\n\tvec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {\n\t\tif ( isinf( attenuationDistance ) ) {\n\t\t\treturn vec3( 1.0 );\n\t\t} else {\n\t\t\tvec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;\n\t\t\tvec3 transmittance = exp( - attenuationCoefficient * transmissionDistance );\t\t\treturn transmittance;\n\t\t}\n\t}\n\tvec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,\n\t\tconst in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,\n\t\tconst in mat4 viewMatrix, const in mat4 projMatrix, const in float ior, const in float thickness,\n\t\tconst in vec3 attenuationColor, const in float attenuationDistance ) {\n\t\tvec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );\n\t\tvec3 refractedRayExit = position + transmissionRay;\n\t\tvec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\n\t\tvec2 refractionCoords = ndcPos.xy / ndcPos.w;\n\t\trefractionCoords += 1.0;\n\t\trefractionCoords /= 2.0;\n\t\tvec4 transmittedLight = getTransmissionSample( refractionCoords, roughness, ior );\n\t\tvec3 transmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance );\n\t\tvec3 attenuatedColor = transmittance * transmittedLight.rgb;\n\t\tvec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );\n\t\tfloat transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0;\n\t\treturn vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor );\n\t}\n#endif",uv_pars_fragment:"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n\tvarying vec2 vUv;\n#endif\n#ifdef USE_MAP\n\tvarying vec2 vMapUv;\n#endif\n#ifdef USE_ALPHAMAP\n\tvarying vec2 vAlphaMapUv;\n#endif\n#ifdef USE_LIGHTMAP\n\tvarying vec2 vLightMapUv;\n#endif\n#ifdef USE_AOMAP\n\tvarying vec2 vAoMapUv;\n#endif\n#ifdef USE_BUMPMAP\n\tvarying vec2 vBumpMapUv;\n#endif\n#ifdef USE_NORMALMAP\n\tvarying vec2 vNormalMapUv;\n#endif\n#ifdef USE_EMISSIVEMAP\n\tvarying vec2 vEmissiveMapUv;\n#endif\n#ifdef USE_METALNESSMAP\n\tvarying vec2 vMetalnessMapUv;\n#endif\n#ifdef USE_ROUGHNESSMAP\n\tvarying vec2 vRoughnessMapUv;\n#endif\n#ifdef USE_ANISOTROPYMAP\n\tvarying vec2 vAnisotropyMapUv;\n#endif\n#ifdef USE_CLEARCOATMAP\n\tvarying vec2 vClearcoatMapUv;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tvarying vec2 vClearcoatNormalMapUv;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tvarying vec2 vClearcoatRoughnessMapUv;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n\tvarying vec2 vIridescenceMapUv;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tvarying vec2 vIridescenceThicknessMapUv;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n\tvarying vec2 vSheenColorMapUv;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n\tvarying vec2 vSheenRoughnessMapUv;\n#endif\n#ifdef USE_SPECULARMAP\n\tvarying vec2 vSpecularMapUv;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n\tvarying vec2 vSpecularColorMapUv;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n\tvarying vec2 vSpecularIntensityMapUv;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n\tuniform mat3 transmissionMapTransform;\n\tvarying vec2 vTransmissionMapUv;\n#endif\n#ifdef USE_THICKNESSMAP\n\tuniform mat3 thicknessMapTransform;\n\tvarying vec2 vThicknessMapUv;\n#endif",uv_pars_vertex:"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n\tvarying vec2 vUv;\n#endif\n#ifdef USE_MAP\n\tuniform mat3 mapTransform;\n\tvarying vec2 vMapUv;\n#endif\n#ifdef USE_ALPHAMAP\n\tuniform mat3 alphaMapTransform;\n\tvarying vec2 vAlphaMapUv;\n#endif\n#ifdef USE_LIGHTMAP\n\tuniform mat3 lightMapTransform;\n\tvarying vec2 vLightMapUv;\n#endif\n#ifdef USE_AOMAP\n\tuniform mat3 aoMapTransform;\n\tvarying vec2 vAoMapUv;\n#endif\n#ifdef USE_BUMPMAP\n\tuniform mat3 bumpMapTransform;\n\tvarying vec2 vBumpMapUv;\n#endif\n#ifdef USE_NORMALMAP\n\tuniform mat3 normalMapTransform;\n\tvarying vec2 vNormalMapUv;\n#endif\n#ifdef USE_DISPLACEMENTMAP\n\tuniform mat3 displacementMapTransform;\n\tvarying vec2 vDisplacementMapUv;\n#endif\n#ifdef USE_EMISSIVEMAP\n\tuniform mat3 emissiveMapTransform;\n\tvarying vec2 vEmissiveMapUv;\n#endif\n#ifdef USE_METALNESSMAP\n\tuniform mat3 metalnessMapTransform;\n\tvarying vec2 vMetalnessMapUv;\n#endif\n#ifdef USE_ROUGHNESSMAP\n\tuniform mat3 roughnessMapTransform;\n\tvarying vec2 vRoughnessMapUv;\n#endif\n#ifdef USE_ANISOTROPYMAP\n\tuniform mat3 anisotropyMapTransform;\n\tvarying vec2 vAnisotropyMapUv;\n#endif\n#ifdef USE_CLEARCOATMAP\n\tuniform mat3 clearcoatMapTransform;\n\tvarying vec2 vClearcoatMapUv;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tuniform mat3 clearcoatNormalMapTransform;\n\tvarying vec2 vClearcoatNormalMapUv;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tuniform mat3 clearcoatRoughnessMapTransform;\n\tvarying vec2 vClearcoatRoughnessMapUv;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n\tuniform mat3 sheenColorMapTransform;\n\tvarying vec2 vSheenColorMapUv;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n\tuniform mat3 sheenRoughnessMapTransform;\n\tvarying vec2 vSheenRoughnessMapUv;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n\tuniform mat3 iridescenceMapTransform;\n\tvarying vec2 vIridescenceMapUv;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tuniform mat3 iridescenceThicknessMapTransform;\n\tvarying vec2 vIridescenceThicknessMapUv;\n#endif\n#ifdef USE_SPECULARMAP\n\tuniform mat3 specularMapTransform;\n\tvarying vec2 vSpecularMapUv;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n\tuniform mat3 specularColorMapTransform;\n\tvarying vec2 vSpecularColorMapUv;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n\tuniform mat3 specularIntensityMapTransform;\n\tvarying vec2 vSpecularIntensityMapUv;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n\tuniform mat3 transmissionMapTransform;\n\tvarying vec2 vTransmissionMapUv;\n#endif\n#ifdef USE_THICKNESSMAP\n\tuniform mat3 thicknessMapTransform;\n\tvarying vec2 vThicknessMapUv;\n#endif",uv_vertex:"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n\tvUv = vec3( uv, 1 ).xy;\n#endif\n#ifdef USE_MAP\n\tvMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ALPHAMAP\n\tvAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_LIGHTMAP\n\tvLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_AOMAP\n\tvAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_BUMPMAP\n\tvBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_NORMALMAP\n\tvNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_DISPLACEMENTMAP\n\tvDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_EMISSIVEMAP\n\tvEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_METALNESSMAP\n\tvMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ROUGHNESSMAP\n\tvRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ANISOTROPYMAP\n\tvAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOATMAP\n\tvClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tvClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tvClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n\tvIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tvIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n\tvSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n\tvSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULARMAP\n\tvSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n\tvSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n\tvSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n\tvTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_THICKNESSMAP\n\tvThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy;\n#endif",worldpos_vertex:"#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0\n\tvec4 worldPosition = vec4( transformed, 1.0 );\n\t#ifdef USE_INSTANCING\n\t\tworldPosition = instanceMatrix * worldPosition;\n\t#endif\n\tworldPosition = modelMatrix * worldPosition;\n#endif",background_vert:"varying vec2 vUv;\nuniform mat3 uvTransform;\nvoid main() {\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n\tgl_Position = vec4( position.xy, 1.0, 1.0 );\n}",background_frag:"uniform sampler2D t2D;\nuniform float backgroundIntensity;\nvarying vec2 vUv;\nvoid main() {\n\tvec4 texColor = texture2D( t2D, vUv );\n\ttexColor.rgb *= backgroundIntensity;\n\tgl_FragColor = texColor;\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n}",backgroundCube_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\tgl_Position.z = gl_Position.w;\n}",backgroundCube_frag:"#ifdef ENVMAP_TYPE_CUBE\n\tuniform samplerCube envMap;\n#elif defined( ENVMAP_TYPE_CUBE_UV )\n\tuniform sampler2D envMap;\n#endif\nuniform float flipEnvMap;\nuniform float backgroundBlurriness;\nuniform float backgroundIntensity;\nvarying vec3 vWorldDirection;\n#include <cube_uv_reflection_fragment>\nvoid main() {\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 texColor = textureCube( envMap, vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) );\n\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\tvec4 texColor = textureCubeUV( envMap, vWorldDirection, backgroundBlurriness );\n\t#else\n\t\tvec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\t#endif\n\ttexColor.rgb *= backgroundIntensity;\n\tgl_FragColor = texColor;\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n}",cube_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\tgl_Position.z = gl_Position.w;\n}",cube_frag:"uniform samplerCube tCube;\nuniform float tFlip;\nuniform float opacity;\nvarying vec3 vWorldDirection;\nvoid main() {\n\tvec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) );\n\tgl_FragColor = texColor;\n\tgl_FragColor.a *= opacity;\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\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>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\t#include <uv_vertex>\n\t#include <skinbase_vertex>\n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvHighPrecisionZW = gl_Position.zw;\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 <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvarying vec2 vHighPrecisionZW;\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 <alphahash_fragment>\n\t#include <logdepthbuf_fragment>\n\tfloat fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;\n\t#if DEPTH_PACKING == 3200\n\t\tgl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );\n\t#elif DEPTH_PACKING == 3201\n\t\tgl_FragColor = packDepthToRGBA( fragCoordZ );\n\t#endif\n}",distanceRGBA_vert:"#define DISTANCE\nvarying vec3 vWorldPosition;\n#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <skinbase_vertex>\n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <worldpos_vertex>\n\t#include <clipping_planes_vertex>\n\tvWorldPosition = worldPosition.xyz;\n}",distanceRGBA_frag:"#define DISTANCE\nuniform vec3 referencePosition;\nuniform float nearDistance;\nuniform float farDistance;\nvarying vec3 vWorldPosition;\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main () {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\tfloat dist = length( vWorldPosition - referencePosition );\n\tdist = ( dist - nearDistance ) / ( farDistance - nearDistance );\n\tdist = saturate( dist );\n\tgl_FragColor = packDepthToRGBA( dist );\n}",equirect_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n}",equirect_frag:"uniform sampler2D tEquirect;\nvarying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvec3 direction = normalize( vWorldDirection );\n\tvec2 sampleUV = equirectUv( direction );\n\tgl_FragColor = texture2D( tEquirect, sampleUV );\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n}",linedashed_vert:"uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include <common>\n#include <uv_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\tvLineDistance = scale * lineDistance;\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphcolor_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\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 <uv_pars_fragment>\n#include <map_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 <map_fragment>\n\t#include <color_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n}",meshbasic_vert:"#include <common>\n#include <uv_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_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 <color_vertex>\n\t#include <morphcolor_vertex>\n\t#if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinbase_vertex>\n\t\t#include <skinnormal_vertex>\n\t\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 <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <fog_vertex>\n}",meshbasic_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <envmap_common_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 <alphahash_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\tvec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n\t\treflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI;\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 <envmap_fragment>\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshlambert_vert:"#define LAMBERT\nvarying vec3 vViewPosition;\n#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_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 <color_vertex>\n\t#include <morphcolor_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 <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_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\t#include <fog_vertex>\n}",meshlambert_frag:"#define LAMBERT\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_lambert_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 <alphahash_fragment>\n\t#include <specularmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_lambert_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include <envmap_fragment>\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshmatcap_vert:"#define MATCAP\nvarying vec3 vViewPosition;\n#include <common>\n#include <uv_pars_vertex>\n#include <color_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_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 <color_vertex>\n\t#include <morphcolor_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 <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n\tvViewPosition = - mvPosition.xyz;\n}",meshmatcap_frag:"#define MATCAP\nuniform vec3 diffuse;\nuniform float opacity;\nuniform sampler2D matcap;\nvarying vec3 vViewPosition;\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <fog_pars_fragment>\n#include <normal_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_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 <alphahash_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\tvec3 viewDir = normalize( vViewPosition );\n\tvec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );\n\tvec3 y = cross( viewDir, x );\n\tvec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;\n\t#ifdef USE_MATCAP\n\t\tvec4 matcapColor = texture2D( matcap, uv );\n\t#else\n\t\tvec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 );\n\t#endif\n\tvec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshnormal_vert:"#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n\tvarying vec3 vViewPosition;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <normal_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 <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 <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n}",meshnormal_frag:"#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n\tvarying vec3 vViewPosition;\n#endif\n#include <packing>\n#include <uv_pars_fragment>\n#include <normal_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\t#include <logdepthbuf_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\tgl_FragColor = vec4( packNormalToRGB( normal ), opacity );\n\t#ifdef OPAQUE\n\t\tgl_FragColor.a = 1.0;\n\t#endif\n}",meshphong_vert:"#define PHONG\nvarying vec3 vViewPosition;\n#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_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 <color_vertex>\n\t#include <morphcolor_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 <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_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\t#include <fog_vertex>\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 <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\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 <alphahash_fragment>\n\t#include <specularmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_phong_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\t#include <envmap_fragment>\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshphysical_vert:"#define STANDARD\nvarying vec3 vViewPosition;\n#ifdef USE_TRANSMISSION\n\tvarying vec3 vWorldPosition;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_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 <color_vertex>\n\t#include <morphcolor_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 <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_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\t#include <fog_vertex>\n#ifdef USE_TRANSMISSION\n\tvWorldPosition = worldPosition.xyz;\n#endif\n}",meshphysical_frag:"#define STANDARD\n#ifdef PHYSICAL\n\t#define IOR\n\t#define USE_SPECULAR\n#endif\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifdef IOR\n\tuniform float ior;\n#endif\n#ifdef USE_SPECULAR\n\tuniform float specularIntensity;\n\tuniform vec3 specularColor;\n\t#ifdef USE_SPECULAR_COLORMAP\n\t\tuniform sampler2D specularColorMap;\n\t#endif\n\t#ifdef USE_SPECULAR_INTENSITYMAP\n\t\tuniform sampler2D specularIntensityMap;\n\t#endif\n#endif\n#ifdef USE_CLEARCOAT\n\tuniform float clearcoat;\n\tuniform float clearcoatRoughness;\n#endif\n#ifdef USE_IRIDESCENCE\n\tuniform float iridescence;\n\tuniform float iridescenceIOR;\n\tuniform float iridescenceThicknessMinimum;\n\tuniform float iridescenceThicknessMaximum;\n#endif\n#ifdef USE_SHEEN\n\tuniform vec3 sheenColor;\n\tuniform float sheenRoughness;\n\t#ifdef USE_SHEEN_COLORMAP\n\t\tuniform sampler2D sheenColorMap;\n\t#endif\n\t#ifdef USE_SHEEN_ROUGHNESSMAP\n\t\tuniform sampler2D sheenRoughnessMap;\n\t#endif\n#endif\n#ifdef USE_ANISOTROPY\n\tuniform vec2 anisotropyVector;\n\t#ifdef USE_ANISOTROPYMAP\n\t\tuniform sampler2D anisotropyMap;\n\t#endif\n#endif\nvarying vec3 vViewPosition;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <iridescence_fragment>\n#include <cube_uv_reflection_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_physical_pars_fragment>\n#include <fog_pars_fragment>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_physical_pars_fragment>\n#include <transmission_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <clearcoat_pars_fragment>\n#include <iridescence_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 <alphahash_fragment>\n\t#include <roughnessmap_fragment>\n\t#include <metalnessmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <clearcoat_normal_fragment_begin>\n\t#include <clearcoat_normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_physical_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;\n\tvec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;\n\t#include <transmission_fragment>\n\tvec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;\n\t#ifdef USE_SHEEN\n\t\tfloat sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor );\n\t\toutgoingLight = outgoingLight * sheenEnergyComp + sheenSpecular;\n\t#endif\n\t#ifdef USE_CLEARCOAT\n\t\tfloat dotNVcc = saturate( dot( geometry.clearcoatNormal, geometry.viewDir ) );\n\t\tvec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );\n\t\toutgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + clearcoatSpecular * material.clearcoat;\n\t#endif\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshtoon_vert:"#define TOON\nvarying vec3 vViewPosition;\n#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_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 <color_vertex>\n\t#include <morphcolor_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 <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_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\t#include <fog_vertex>\n}",meshtoon_frag:"#define TOON\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <gradientmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_toon_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_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 <alphahash_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_toon_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",points_vert:"uniform float size;\nuniform float scale;\n#include <common>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\n#ifdef USE_POINTS_UV\n\tvarying vec2 vUv;\n\tuniform mat3 uvTransform;\n#endif\nvoid main() {\n\t#ifdef USE_POINTS_UV\n\t\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n\t#endif\n\t#include <color_vertex>\n\t#include <morphcolor_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <project_vertex>\n\tgl_PointSize = size;\n\t#ifdef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );\n\t#endif\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <fog_vertex>\n}",points_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <color_pars_fragment>\n#include <map_particle_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_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\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\t#include <alphahash_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n}",shadow_vert:"#include <common>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <shadowmap_pars_vertex>\nvoid main() {\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 <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",shadow_frag:"uniform vec3 color;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <logdepthbuf_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\nvoid main() {\n\t#include <logdepthbuf_fragment>\n\tgl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n}",sprite_vert:"uniform float rotation;\nuniform vec2 center;\n#include <common>\n#include <uv_pars_vertex>\n#include <fog_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\tvec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\n\tvec2 scale;\n\tscale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) );\n\tscale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) );\n\t#ifndef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) scale *= - mvPosition.z;\n\t#endif\n\tvec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;\n\tvec2 rotatedPosition;\n\trotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\n\trotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\n\tmvPosition.xy += rotatedPosition;\n\tgl_Position = projectionMatrix * mvPosition;\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n}",sprite_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_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\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n}"},Po={common:{diffuse:{value:new pa(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new gr},alphaMap:{value:null},alphaMapTransform:{value:new gr},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new gr}},envmap:{envMap:{value:null},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new gr}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new gr}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new gr},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new gr},normalScale:{value:new mr(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new gr},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new gr}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new gr}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new gr}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new pa(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new pa(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new gr},alphaTest:{value:0},uvTransform:{value:new gr}},sprite:{diffuse:{value:new pa(16777215)},opacity:{value:1},center:{value:new mr(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new gr},alphaMap:{value:null},alphaMapTransform:{value:new gr},alphaTest:{value:0}}},Io={basic:{uniforms:co([Po.common,Po.specularmap,Po.envmap,Po.aomap,Po.lightmap,Po.fog]),vertexShader:Lo.meshbasic_vert,fragmentShader:Lo.meshbasic_frag},lambert:{uniforms:co([Po.common,Po.specularmap,Po.envmap,Po.aomap,Po.lightmap,Po.emissivemap,Po.bumpmap,Po.normalmap,Po.displacementmap,Po.fog,Po.lights,{emissive:{value:new pa(0)}}]),vertexShader:Lo.meshlambert_vert,fragmentShader:Lo.meshlambert_frag},phong:{uniforms:co([Po.common,Po.specularmap,Po.envmap,Po.aomap,Po.lightmap,Po.emissivemap,Po.bumpmap,Po.normalmap,Po.displacementmap,Po.fog,Po.lights,{emissive:{value:new pa(0)},specular:{value:new pa(1118481)},shininess:{value:30}}]),vertexShader:Lo.meshphong_vert,fragmentShader:Lo.meshphong_frag},standard:{uniforms:co([Po.common,Po.envmap,Po.aomap,Po.lightmap,Po.emissivemap,Po.bumpmap,Po.normalmap,Po.displacementmap,Po.roughnessmap,Po.metalnessmap,Po.fog,Po.lights,{emissive:{value:new pa(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Lo.meshphysical_vert,fragmentShader:Lo.meshphysical_frag},toon:{uniforms:co([Po.common,Po.aomap,Po.lightmap,Po.emissivemap,Po.bumpmap,Po.normalmap,Po.displacementmap,Po.gradientmap,Po.fog,Po.lights,{emissive:{value:new pa(0)}}]),vertexShader:Lo.meshtoon_vert,fragmentShader:Lo.meshtoon_frag},matcap:{uniforms:co([Po.common,Po.bumpmap,Po.normalmap,Po.displacementmap,Po.fog,{matcap:{value:null}}]),vertexShader:Lo.meshmatcap_vert,fragmentShader:Lo.meshmatcap_frag},points:{uniforms:co([Po.points,Po.fog]),vertexShader:Lo.points_vert,fragmentShader:Lo.points_frag},dashed:{uniforms:co([Po.common,Po.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Lo.linedashed_vert,fragmentShader:Lo.linedashed_frag},depth:{uniforms:co([Po.common,Po.displacementmap]),vertexShader:Lo.depth_vert,fragmentShader:Lo.depth_frag},normal:{uniforms:co([Po.common,Po.bumpmap,Po.normalmap,Po.displacementmap,{opacity:{value:1}}]),vertexShader:Lo.meshnormal_vert,fragmentShader:Lo.meshnormal_frag},sprite:{uniforms:co([Po.sprite,Po.fog]),vertexShader:Lo.sprite_vert,fragmentShader:Lo.sprite_frag},background:{uniforms:{uvTransform:{value:new gr},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:Lo.background_vert,fragmentShader:Lo.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1}},vertexShader:Lo.backgroundCube_vert,fragmentShader:Lo.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:Lo.cube_vert,fragmentShader:Lo.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Lo.equirect_vert,fragmentShader:Lo.equirect_frag},distanceRGBA:{uniforms:co([Po.common,Po.displacementmap,{referencePosition:{value:new Yr},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Lo.distanceRGBA_vert,fragmentShader:Lo.distanceRGBA_frag},shadow:{uniforms:co([Po.lights,Po.fog,{color:{value:new pa(0)},opacity:{value:1}}]),vertexShader:Lo.shadow_vert,fragmentShader:Lo.shadow_frag}};Io.physical={uniforms:co([Io.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new gr},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new gr},clearcoatNormalScale:{value:new mr(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new gr},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new gr},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new gr},sheen:{value:0},sheenColor:{value:new pa(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new gr},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new gr},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new gr},transmissionSamplerSize:{value:new mr},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new gr},attenuationDistance:{value:0},attenuationColor:{value:new pa(0)},specularColor:{value:new pa(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new gr},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new gr},anisotropyVector:{value:new mr},anisotropyMap:{value:null},anisotropyMapTransform:{value:new gr}}]),vertexShader:Lo.meshphysical_vert,fragmentShader:Lo.meshphysical_frag};var Do={r:0,b:0,g:0};function Uo(e,t,n,r,i,a,o){var s,u,l=new pa(0),c=!0===a?0:1,h=null,d=0,f=null;function p(t,n){t.getRGB(Do,ho(e)),r.buffers.color.setClear(Do.r,Do.g,Do.b,n,o)}return{getClearColor:function(){return l},setClearColor:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;l.set(e),p(l,c=t)},getClearAlpha:function(){return c},setClearAlpha:function(e){p(l,c=e)},render:function(a,v){var m=!1,g=!0===v.isScene?v.background:null;switch(g&&g.isTexture&&(g=(v.backgroundBlurriness>0?n:t).get(g)),null===g?p(l,c):g&&g.isColor&&(p(g,1),m=!0),e.xr.getEnvironmentBlendMode()){case"opaque":m=!0;break;case"additive":r.buffers.color.setClear(0,0,0,1,o),m=!0;break;case"alpha-blend":r.buffers.color.setClear(0,0,0,0,o),m=!0}(e.autoClear||m)&&e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil),g&&(g.isCubeTexture||g.mapping===De)?(void 0===u&&((u=new oo(new uo(1,1,1),new po({name:"BackgroundCubeMaterial",uniforms:lo(Io.backgroundCube.uniforms),vertexShader:Io.backgroundCube.vertexShader,fragmentShader:Io.backgroundCube.fragmentShader,side:H,depthTest:!1,depthWrite:!1,fog:!1}))).geometry.deleteAttribute("normal"),u.geometry.deleteAttribute("uv"),u.onBeforeRender=function(e,t,n){this.matrixWorld.copyPosition(n.matrixWorld)},Object.defineProperty(u.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),i.update(u)),u.material.uniforms.envMap.value=g,u.material.uniforms.flipEnvMap.value=g.isCubeTexture&&!1===g.isRenderTargetTexture?-1:1,u.material.uniforms.backgroundBlurriness.value=v.backgroundBlurriness,u.material.uniforms.backgroundIntensity.value=v.backgroundIntensity,u.material.toneMapped=g.colorSpace!==pn,h===g&&d===g.version&&f===e.toneMapping||(u.material.needsUpdate=!0,h=g,d=g.version,f=e.toneMapping),u.layers.enableAll(),a.unshift(u,u.geometry,u.material,0,0,null)):g&&g.isTexture&&(void 0===s&&((s=new oo(new Co(2,2),new po({name:"BackgroundMaterial",uniforms:lo(Io.background.uniforms),vertexShader:Io.background.vertexShader,fragmentShader:Io.background.fragmentShader,side:z,depthTest:!1,depthWrite:!1,fog:!1}))).geometry.deleteAttribute("normal"),Object.defineProperty(s.material,"map",{get:function(){return this.uniforms.t2D.value}}),i.update(s)),s.material.uniforms.t2D.value=g,s.material.uniforms.backgroundIntensity.value=v.backgroundIntensity,s.material.toneMapped=g.colorSpace!==pn,!0===g.matrixAutoUpdate&&g.updateMatrix(),s.material.uniforms.uvTransform.value.copy(g.matrix),h===g&&d===g.version&&f===e.toneMapping||(s.material.needsUpdate=!0,h=g,d=g.version,f=e.toneMapping),s.layers.enableAll(),a.unshift(s,s.geometry,s.material,0,0,null))}}}function Oo(e,t,n,r){var i=e.getParameter(e.MAX_VERTEX_ATTRIBS),a=r.isWebGL2?null:t.get("OES_vertex_array_object"),o=r.isWebGL2||null!==a,s={},u=f(null),l=u,c=!1;function h(t){return r.isWebGL2?e.bindVertexArray(t):a.bindVertexArrayOES(t)}function d(t){return r.isWebGL2?e.deleteVertexArray(t):a.deleteVertexArrayOES(t)}function f(e){for(var t=[],n=[],r=[],a=0;a<i;a++)t[a]=0,n[a]=0,r[a]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:t,enabledAttributes:n,attributeDivisors:r,object:e,attributes:{},index:null}}function p(){for(var e=l.newAttributes,t=0,n=e.length;t<n;t++)e[t]=0}function v(e){m(e,0)}function m(n,i){var a=l.newAttributes,o=l.enabledAttributes,s=l.attributeDivisors;(a[n]=1,0===o[n]&&(e.enableVertexAttribArray(n),o[n]=1),s[n]!==i)&&((r.isWebGL2?e:t.get("ANGLE_instanced_arrays"))[r.isWebGL2?"vertexAttribDivisor":"vertexAttribDivisorANGLE"](n,i),s[n]=i)}function g(){for(var t=l.newAttributes,n=l.enabledAttributes,r=0,i=n.length;r<i;r++)n[r]!==t[r]&&(e.disableVertexAttribArray(r),n[r]=0)}function y(t,n,r,i,a,o,s){!0===s?e.vertexAttribIPointer(t,n,r,a,o):e.vertexAttribPointer(t,n,r,i,a,o)}function _(){x(),c=!0,l!==u&&h((l=u).object)}function x(){u.geometry=null,u.program=null,u.wireframe=!1}return{setup:function(i,u,d,_,x){var M=!1;if(o){var S=function(t,n,i){var o=!0===i.wireframe,u=s[t.id];void 0===u&&(u={},s[t.id]=u);var l=u[n.id];void 0===l&&(l={},u[n.id]=l);var c=l[o];void 0===c&&(c=f(r.isWebGL2?e.createVertexArray():a.createVertexArrayOES()),l[o]=c);return c}(_,d,u);l!==S&&h((l=S).object),M=function(e,t,n,r){var i=l.attributes,a=t.attributes,o=0,s=n.getAttributes();for(var u in s){if(s[u].location>=0){var c=i[u],h=a[u];if(void 0===h&&("instanceMatrix"===u&&e.instanceMatrix&&(h=e.instanceMatrix),"instanceColor"===u&&e.instanceColor&&(h=e.instanceColor)),void 0===c)return!0;if(c.attribute!==h)return!0;if(h&&c.data!==h.data)return!0;o++}}return l.attributesNum!==o||l.index!==r}(i,_,d,x),M&&function(e,t,n,r){var i={},a=t.attributes,o=0,s=n.getAttributes();for(var u in s){if(s[u].location>=0){var c=a[u];void 0===c&&("instanceMatrix"===u&&e.instanceMatrix&&(c=e.instanceMatrix),"instanceColor"===u&&e.instanceColor&&(c=e.instanceColor));var h={};h.attribute=c,c&&c.data&&(h.data=c.data),i[u]=h,o++}}l.attributes=i,l.attributesNum=o,l.index=r}(i,_,d,x)}else{var b=!0===u.wireframe;l.geometry===_.id&&l.program===d.id&&l.wireframe===b||(l.geometry=_.id,l.program=d.id,l.wireframe=b,M=!0)}null!==x&&n.update(x,e.ELEMENT_ARRAY_BUFFER),(M||c)&&(c=!1,function(i,a,o,s){if(!1===r.isWebGL2&&(i.isInstancedMesh||s.isInstancedBufferGeometry)&&null===t.get("ANGLE_instanced_arrays"))return;p();var u=s.attributes,l=o.getAttributes(),c=a.defaultAttributeValues;for(var h in l){var d=l[h];if(d.location>=0){var f=u[h];if(void 0===f&&("instanceMatrix"===h&&i.instanceMatrix&&(f=i.instanceMatrix),"instanceColor"===h&&i.instanceColor&&(f=i.instanceColor)),void 0!==f){var _=f.normalized,x=f.itemSize,M=n.get(f);if(void 0===M)continue;var S=M.buffer,b=M.type,w=M.bytesPerElement,T=!0===r.isWebGL2&&(b===e.INT||b===e.UNSIGNED_INT||f.gpuType===Qe);if(f.isInterleavedBufferAttribute){var E=f.data,A=E.stride,R=f.offset;if(E.isInstancedInterleavedBuffer){for(var k=0;k<d.locationSize;k++)m(d.location+k,E.meshPerAttribute);!0!==i.isInstancedMesh&&void 0===s._maxInstanceCount&&(s._maxInstanceCount=E.meshPerAttribute*E.count)}else for(var C=0;C<d.locationSize;C++)v(d.location+C);e.bindBuffer(e.ARRAY_BUFFER,S);for(var L=0;L<d.locationSize;L++)y(d.location+L,x/d.locationSize,b,_,A*w,(R+x/d.locationSize*L)*w,T)}else{if(f.isInstancedBufferAttribute){for(var P=0;P<d.locationSize;P++)m(d.location+P,f.meshPerAttribute);!0!==i.isInstancedMesh&&void 0===s._maxInstanceCount&&(s._maxInstanceCount=f.meshPerAttribute*f.count)}else for(var I=0;I<d.locationSize;I++)v(d.location+I);e.bindBuffer(e.ARRAY_BUFFER,S);for(var D=0;D<d.locationSize;D++)y(d.location+D,x/d.locationSize,b,_,x*w,x/d.locationSize*D*w,T)}}else if(void 0!==c){var U=c[h];if(void 0!==U)switch(U.length){case 2:e.vertexAttrib2fv(d.location,U);break;case 3:e.vertexAttrib3fv(d.location,U);break;case 4:e.vertexAttrib4fv(d.location,U);break;default:e.vertexAttrib1fv(d.location,U)}}}}g()}(i,u,d,_),null!==x&&e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,n.get(x).buffer))},reset:_,resetDefaultState:x,dispose:function(){for(var e in _(),s){var t=s[e];for(var n in t){var r=t[n];for(var i in r)d(r[i].object),delete r[i];delete t[n]}delete s[e]}},releaseStatesOfGeometry:function(e){if(void 0!==s[e.id]){var t=s[e.id];for(var n in t){var r=t[n];for(var i in r)d(r[i].object),delete r[i];delete t[n]}delete s[e.id]}},releaseStatesOfProgram:function(e){for(var t in s){var n=s[t];if(void 0!==n[e.id]){var r=n[e.id];for(var i in r)d(r[i].object),delete r[i];delete n[e.id]}}},initAttributes:p,enableAttribute:v,disableUnusedAttributes:g}}function No(e,t,n,r){var i,a=r.isWebGL2;this.setMode=function(e){i=e},this.render=function(t,r){e.drawArrays(i,t,r),n.update(r,i,1)},this.renderInstances=function(r,o,s){if(0!==s){var u,l;if(a)u=e,l="drawArraysInstanced";else if(l="drawArraysInstancedANGLE",null===(u=t.get("ANGLE_instanced_arrays")))return void console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");u[l](i,r,o,s),n.update(o,i,s)}}}function Fo(e,t,n){var r;function i(t){if("highp"===t){if(e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.HIGH_FLOAT).precision>0&&e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.HIGH_FLOAT).precision>0)return"highp";t="mediump"}return"mediump"===t&&e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.MEDIUM_FLOAT).precision>0&&e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}var a="undefined"!=typeof WebGL2RenderingContext&&"WebGL2RenderingContext"===e.constructor.name,o=void 0!==n.precision?n.precision:"highp",s=i(o);s!==o&&(console.warn("THREE.WebGLRenderer:",o,"not supported, using",s,"instead."),o=s);var u=a||t.has("WEBGL_draw_buffers"),l=!0===n.logarithmicDepthBuffer,c=e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS),h=e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS),d=e.getParameter(e.MAX_TEXTURE_SIZE),f=e.getParameter(e.MAX_CUBE_MAP_TEXTURE_SIZE),p=e.getParameter(e.MAX_VERTEX_ATTRIBS),v=e.getParameter(e.MAX_VERTEX_UNIFORM_VECTORS),m=e.getParameter(e.MAX_VARYING_VECTORS),g=e.getParameter(e.MAX_FRAGMENT_UNIFORM_VECTORS),y=h>0,_=a||t.has("OES_texture_float");return{isWebGL2:a,drawBuffers:u,getMaxAnisotropy:function(){if(void 0!==r)return r;if(!0===t.has("EXT_texture_filter_anisotropic")){var n=t.get("EXT_texture_filter_anisotropic");r=e.getParameter(n.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else r=0;return r},getMaxPrecision:i,precision:o,logarithmicDepthBuffer:l,maxTextures:c,maxVertexTextures:h,maxTextureSize:d,maxCubemapSize:f,maxAttributes:p,maxVertexUniforms:v,maxVaryings:m,maxFragmentUniforms:g,vertexTextures:y,floatFragmentTextures:_,floatVertexTextures:y&&_,maxSamples:a?e.getParameter(e.MAX_SAMPLES):0}}function Bo(e){var t=this,n=null,r=0,i=!1,a=!1,o=new wo,s=new gr,u={value:null,needsUpdate:!1};function l(e,n,r,i){var a=null!==e?e.length:0,l=null;if(0!==a){if(l=u.value,!0!==i||null===l){var c=r+4*a,h=n.matrixWorldInverse;s.getNormalMatrix(h),(null===l||l.length<c)&&(l=new Float32Array(c));for(var d=0,f=r;d!==a;++d,f+=4)o.copy(e[d]).applyMatrix4(h,s),o.normal.toArray(l,f),l[f+3]=o.constant}u.value=l,u.needsUpdate=!0}return t.numPlanes=a,t.numIntersection=0,l}this.uniform=u,this.numPlanes=0,this.numIntersection=0,this.init=function(e,t){var n=0!==e.length||t||0!==r||i;return i=t,r=e.length,n},this.beginShadows=function(){a=!0,l(null)},this.endShadows=function(){a=!1},this.setGlobalState=function(e,t){n=l(e,t,0)},this.setState=function(o,s,c){var h=o.clippingPlanes,d=o.clipIntersection,f=o.clipShadows,p=e.get(o);if(!i||null===h||0===h.length||a&&!f)a?l(null):function(){u.value!==n&&(u.value=n,u.needsUpdate=r>0);t.numPlanes=r,t.numIntersection=0}();else{var v=a?0:r,m=4*v,g=p.clippingState||null;u.value=g,g=l(h,s,m,c);for(var y=0;y!==m;++y)g[y]=n[y];p.clippingState=g,this.numIntersection=d?this.numPlanes:0,this.numPlanes+=v}}}function zo(e){var t=new WeakMap;function n(e,t){return t===Pe?e.mapping=Ce:t===Ie&&(e.mapping=Le),e}function r(e){var n=e.target;n.removeEventListener("dispose",r);var i=t.get(n);void 0!==i&&(t.delete(n),i.dispose())}return{get:function(i){if(i&&i.isTexture&&!1===i.isRenderTargetTexture){var a=i.mapping;if(a===Pe||a===Ie){if(t.has(i))return n(t.get(i).texture,i.mapping);var o=i.image;if(o&&o.height>0){var s=new xo(o.height/2);return s.fromEquirectangularTexture(e,i),t.set(i,s),i.addEventListener("dispose",r),n(s.texture,i.mapping)}return null}}return i},dispose:function(){t=new WeakMap}}}var Ho=function(e){w(n,e);var t=E(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:-1,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:-1,u=arguments.length>4&&void 0!==arguments[4]?arguments[4]:.1,l=arguments.length>5&&void 0!==arguments[5]?arguments[5]:2e3;return a(this,n),(e=t.call(this)).isOrthographicCamera=!0,e.type="OrthographicCamera",e.zoom=1,e.view=null,e.left=r,e.right=i,e.top=o,e.bottom=s,e.near=u,e.far=l,e.updateProjectionMatrix(),e}return s(n,[{key:"copy",value:function(e,t){return y(x(n.prototype),"copy",this).call(this,e,t),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=null===e.view?null:Object.assign({},e.view),this}},{key:"setViewOffset",value:function(e,t,n,r,i,a){null===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=r,this.view.width=i,this.view.height=a,this.updateProjectionMatrix()}},{key:"clearViewOffset",value:function(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}},{key:"updateProjectionMatrix",value:function(){var e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),n=(this.right+this.left)/2,r=(this.top+this.bottom)/2,i=n-e,a=n+e,o=r+t,s=r-t;if(null!==this.view&&this.view.enabled){var u=(this.right-this.left)/this.view.fullWidth/this.zoom,l=(this.top-this.bottom)/this.view.fullHeight/this.zoom;a=(i+=u*this.view.offsetX)+u*this.view.width,s=(o-=l*this.view.offsetY)-l*this.view.height}this.projectionMatrix.makeOrthographic(i,a,o,s,this.near,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}},{key:"toJSON",value:function(e){var t=y(x(n.prototype),"toJSON",this).call(this,e);return t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,null!==this.view&&(t.object.view=Object.assign({},this.view)),t}}]),n}(vo),Go=[.125,.215,.35,.446,.526,.582],Vo=20,Wo=new Ho,jo=new pa,Xo=null,qo=(1+Math.sqrt(5))/2,Yo=1/qo,Zo=[new Yr(1,1,1),new Yr(-1,1,1),new Yr(1,1,-1),new Yr(-1,1,-1),new Yr(0,qo,Yo),new Yr(0,qo,-Yo),new Yr(Yo,0,qo),new Yr(-Yo,0,qo),new Yr(qo,Yo,0),new Yr(-qo,Yo,0)],Ko=function(){function e(t){a(this,e),this._renderer=t,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._lodPlanes=[],this._sizeLods=[],this._sigmas=[],this._blurMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._compileMaterial(this._blurMaterial)}return s(e,[{key:"fromScene",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:.1,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:100;Xo=this._renderer.getRenderTarget(),this._setSize(256);var i=this._allocateTargets();return i.depthBuffer=!0,this._sceneToCubeUV(e,n,r,i),t>0&&this._blur(i,0,0,t),this._applyPMREM(i),this._cleanup(i),i}},{key:"fromEquirectangular",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return this._fromTexture(e,t)}},{key:"fromCubemap",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return this._fromTexture(e,t)}},{key:"compileCubemapShader",value:function(){null===this._cubemapMaterial&&(this._cubemapMaterial=es(),this._compileMaterial(this._cubemapMaterial))}},{key:"compileEquirectangularShader",value:function(){null===this._equirectMaterial&&(this._equirectMaterial=$o(),this._compileMaterial(this._equirectMaterial))}},{key:"dispose",value:function(){this._dispose(),null!==this._cubemapMaterial&&this._cubemapMaterial.dispose(),null!==this._equirectMaterial&&this._equirectMaterial.dispose()}},{key:"_setSize",value:function(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}},{key:"_dispose",value:function(){null!==this._blurMaterial&&this._blurMaterial.dispose(),null!==this._pingPongRenderTarget&&this._pingPongRenderTarget.dispose();for(var e=0;e<this._lodPlanes.length;e++)this._lodPlanes[e].dispose()}},{key:"_cleanup",value:function(e){this._renderer.setRenderTarget(Xo),e.scissorTest=!1,Qo(e,0,0,e.width,e.height)}},{key:"_fromTexture",value:function(e,t){e.mapping===Ce||e.mapping===Le?this._setSize(0===e.image.length?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4),Xo=this._renderer.getRenderTarget();var n=t||this._allocateTargets();return this._textureToCubeUV(e,n),this._applyPMREM(n),this._cleanup(n),n}},{key:"_allocateTargets",value:function(){var e=3*Math.max(this._cubeSize,112),t=4*this._cubeSize,n={magFilter:Ve,minFilter:Ve,generateMipmaps:!1,type:tt,format:ot,colorSpace:vn,depthBuffer:!1},r=Jo(e,t,n);if(null===this._pingPongRenderTarget||this._pingPongRenderTarget.width!==e||this._pingPongRenderTarget.height!==t){null!==this._pingPongRenderTarget&&this._dispose(),this._pingPongRenderTarget=Jo(e,t,n);var i=this._lodMax,a=function(e){for(var t=[],n=[],r=[],i=e,a=e-4+1+Go.length,o=0;o<a;o++){var s=Math.pow(2,i);n.push(s);var u=1/s;o>e-4?u=Go[o-e+4-1]:0===o&&(u=0),r.push(u);for(var l=1/(s-2),c=-l,h=1+l,d=[c,c,h,c,h,h,c,c,h,h,c,h],f=6,p=6,v=3,m=2,g=1,y=new Float32Array(v*p*f),_=new Float32Array(m*p*f),x=new Float32Array(g*p*f),M=0;M<f;M++){var S=M%3*2/3-1,b=M>2?0:-1,w=[S,b,0,S+2/3,b,0,S+2/3,b+1,0,S,b,0,S+2/3,b+1,0,S,b+1,0];y.set(w,v*p*M),_.set(d,m*p*M);var T=[M,M,M,M,M,M];x.set(T,g*p*M)}var E=new Ga;E.setAttribute("position",new wa(y,v)),E.setAttribute("uv",new wa(_,m)),E.setAttribute("faceIndex",new wa(x,g)),t.push(E),i>4&&i--}return{lodPlanes:t,sizeLods:n,sigmas:r}}(i);this._sizeLods=a.sizeLods,this._lodPlanes=a.lodPlanes,this._sigmas=a.sigmas,this._blurMaterial=function(e,t,n){var r=new Float32Array(Vo),i=new Yr(0,1,0),a=new po({name:"SphericalGaussianBlur",defines:{n:Vo,CUBEUV_TEXEL_WIDTH:1/t,CUBEUV_TEXEL_HEIGHT:1/n,CUBEUV_MAX_MIP:"".concat(e,".0")},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:r},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:i}},vertexShader:"\n\n\t\tprecision mediump float;\n\t\tprecision mediump int;\n\n\t\tattribute float faceIndex;\n\n\t\tvarying vec3 vOutputDirection;\n\n\t\t// RH coordinate system; PMREM face-indexing convention\n\t\tvec3 getDirection( vec2 uv, float face ) {\n\n\t\t\tuv = 2.0 * uv - 1.0;\n\n\t\t\tvec3 direction = vec3( uv, 1.0 );\n\n\t\t\tif ( face == 0.0 ) {\n\n\t\t\t\tdirection = direction.zyx; // ( 1, v, u ) pos x\n\n\t\t\t} else if ( face == 1.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xz *= -1.0; // ( -u, 1, -v ) pos y\n\n\t\t\t} else if ( face == 2.0 ) {\n\n\t\t\t\tdirection.x *= -1.0; // ( -u, v, 1 ) pos z\n\n\t\t\t} else if ( face == 3.0 ) {\n\n\t\t\t\tdirection = direction.zyx;\n\t\t\t\tdirection.xz *= -1.0; // ( -1, v, -u ) neg x\n\n\t\t\t} else if ( face == 4.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xy *= -1.0; // ( -u, -1, v ) neg y\n\n\t\t\t} else if ( face == 5.0 ) {\n\n\t\t\t\tdirection.z *= -1.0; // ( u, v, -1 ) neg z\n\n\t\t\t}\n\n\t\t\treturn direction;\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvOutputDirection = getDirection( uv, faceIndex );\n\t\t\tgl_Position = vec4( position, 1.0 );\n\n\t\t}\n\t",fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform sampler2D envMap;\n\t\t\tuniform int samples;\n\t\t\tuniform float weights[ n ];\n\t\t\tuniform bool latitudinal;\n\t\t\tuniform float dTheta;\n\t\t\tuniform float mipInt;\n\t\t\tuniform vec3 poleAxis;\n\n\t\t\t#define ENVMAP_TYPE_CUBE_UV\n\t\t\t#include <cube_uv_reflection_fragment>\n\n\t\t\tvec3 getSample( float theta, vec3 axis ) {\n\n\t\t\t\tfloat cosTheta = cos( theta );\n\t\t\t\t// Rodrigues' axis-angle rotation\n\t\t\t\tvec3 sampleDirection = vOutputDirection * cosTheta\n\t\t\t\t\t+ cross( axis, vOutputDirection ) * sin( theta )\n\t\t\t\t\t+ axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );\n\n\t\t\t\treturn bilinearCubeUV( envMap, sampleDirection, mipInt );\n\n\t\t\t}\n\n\t\t\tvoid main() {\n\n\t\t\t\tvec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );\n\n\t\t\t\tif ( all( equal( axis, vec3( 0.0 ) ) ) ) {\n\n\t\t\t\t\taxis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );\n\n\t\t\t\t}\n\n\t\t\t\taxis = normalize( axis );\n\n\t\t\t\tgl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\t\t\t\tgl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );\n\n\t\t\t\tfor ( int i = 1; i < n; i++ ) {\n\n\t\t\t\t\tif ( i >= samples ) {\n\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tfloat theta = dTheta * float( i );\n\t\t\t\t\tgl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );\n\t\t\t\t\tgl_FragColor.rgb += weights[ i ] * getSample( theta, axis );\n\n\t\t\t\t}\n\n\t\t\t}\n\t\t",blending:W,depthTest:!1,depthWrite:!1});return a}(i,e,t)}return r}},{key:"_compileMaterial",value:function(e){var t=new oo(this._lodPlanes[0],e);this._renderer.compile(t,Wo)}},{key:"_sceneToCubeUV",value:function(e,t,n,r){var i=new mo(90,1,t,n),a=[1,-1,1,1,1,1],o=[1,1,1,-1,-1,-1],s=this._renderer,u=s.autoClear,l=s.toneMapping;s.getClearColor(jo),s.toneMapping=be,s.autoClear=!1;var c=new ma({name:"PMREM.Background",side:H,depthWrite:!1,depthTest:!1}),h=new oo(new uo,c),d=!1,f=e.background;f?f.isColor&&(c.color.copy(f),e.background=null,d=!0):(c.color.copy(jo),d=!0);for(var p=0;p<6;p++){var v=p%3;0===v?(i.up.set(0,a[p],0),i.lookAt(o[p],0,0)):1===v?(i.up.set(0,0,a[p]),i.lookAt(0,o[p],0)):(i.up.set(0,a[p],0),i.lookAt(0,0,o[p]));var m=this._cubeSize;Qo(r,v*m,p>2?m:0,m,m),s.setRenderTarget(r),d&&s.render(h,i),s.render(e,i)}h.geometry.dispose(),h.material.dispose(),s.toneMapping=l,s.autoClear=u,e.background=f}},{key:"_textureToCubeUV",value:function(e,t){var n=this._renderer,r=e.mapping===Ce||e.mapping===Le;r?(null===this._cubemapMaterial&&(this._cubemapMaterial=es()),this._cubemapMaterial.uniforms.flipEnvMap.value=!1===e.isRenderTargetTexture?-1:1):null===this._equirectMaterial&&(this._equirectMaterial=$o());var i=r?this._cubemapMaterial:this._equirectMaterial,a=new oo(this._lodPlanes[0],i);i.uniforms.envMap.value=e;var o=this._cubeSize;Qo(t,0,0,3*o,2*o),n.setRenderTarget(t),n.render(a,Wo)}},{key:"_applyPMREM",value:function(e){var t=this._renderer,n=t.autoClear;t.autoClear=!1;for(var r=1;r<this._lodPlanes.length;r++){var i=Math.sqrt(this._sigmas[r]*this._sigmas[r]-this._sigmas[r-1]*this._sigmas[r-1]),a=Zo[(r-1)%Zo.length];this._blur(e,r-1,r,i,a)}t.autoClear=n}},{key:"_blur",value:function(e,t,n,r,i){var a=this._pingPongRenderTarget;this._halfBlur(e,a,t,n,r,"latitudinal",i),this._halfBlur(a,e,n,n,r,"longitudinal",i)}},{key:"_halfBlur",value:function(e,t,n,r,i,a,o){var s=this._renderer,u=this._blurMaterial;"latitudinal"!==a&&"longitudinal"!==a&&console.error("blur direction must be either latitudinal or longitudinal!");var l=new oo(this._lodPlanes[r],u),c=u.uniforms,h=this._sizeLods[n]-1,d=isFinite(i)?Math.PI/(2*h):2*Math.PI/39,f=i/d,p=isFinite(i)?1+Math.floor(3*f):Vo;p>Vo&&console.warn("sigmaRadians, ".concat(i,", is too large and will clip, as it requested ").concat(p," samples when the maximum is set to ").concat(Vo));for(var v=[],m=0,g=0;g<Vo;++g){var y=g/f,_=Math.exp(-y*y/2);v.push(_),0===g?m+=_:g<p&&(m+=2*_)}for(var x=0;x<v.length;x++)v[x]=v[x]/m;c.envMap.value=e.texture,c.samples.value=p,c.weights.value=v,c.latitudinal.value="latitudinal"===a,o&&(c.poleAxis.value=o);var M=this._lodMax;c.dTheta.value=d,c.mipInt.value=M-n;var S=this._sizeLods[r];Qo(t,3*S*(r>M-4?r-M+4:0),4*(this._cubeSize-S),3*S,2*S),s.setRenderTarget(t),s.render(l,Wo)}}]),e}();function Jo(e,t,n){var r=new Hr(e,t,n);return r.texture.mapping=De,r.texture.name="PMREM.cubeUv",r.scissorTest=!0,r}function Qo(e,t,n,r,i){e.viewport.set(t,n,r,i),e.scissor.set(t,n,r,i)}function $o(){return new po({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:"\n\n\t\tprecision mediump float;\n\t\tprecision mediump int;\n\n\t\tattribute float faceIndex;\n\n\t\tvarying vec3 vOutputDirection;\n\n\t\t// RH coordinate system; PMREM face-indexing convention\n\t\tvec3 getDirection( vec2 uv, float face ) {\n\n\t\t\tuv = 2.0 * uv - 1.0;\n\n\t\t\tvec3 direction = vec3( uv, 1.0 );\n\n\t\t\tif ( face == 0.0 ) {\n\n\t\t\t\tdirection = direction.zyx; // ( 1, v, u ) pos x\n\n\t\t\t} else if ( face == 1.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xz *= -1.0; // ( -u, 1, -v ) pos y\n\n\t\t\t} else if ( face == 2.0 ) {\n\n\t\t\t\tdirection.x *= -1.0; // ( -u, v, 1 ) pos z\n\n\t\t\t} else if ( face == 3.0 ) {\n\n\t\t\t\tdirection = direction.zyx;\n\t\t\t\tdirection.xz *= -1.0; // ( -1, v, -u ) neg x\n\n\t\t\t} else if ( face == 4.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xy *= -1.0; // ( -u, -1, v ) neg y\n\n\t\t\t} else if ( face == 5.0 ) {\n\n\t\t\t\tdirection.z *= -1.0; // ( u, v, -1 ) neg z\n\n\t\t\t}\n\n\t\t\treturn direction;\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvOutputDirection = getDirection( uv, faceIndex );\n\t\t\tgl_Position = vec4( position, 1.0 );\n\n\t\t}\n\t",fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform sampler2D envMap;\n\n\t\t\t#include <common>\n\n\t\t\tvoid main() {\n\n\t\t\t\tvec3 outputDirection = normalize( vOutputDirection );\n\t\t\t\tvec2 uv = equirectUv( outputDirection );\n\n\t\t\t\tgl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 );\n\n\t\t\t}\n\t\t",blending:W,depthTest:!1,depthWrite:!1})}function es(){return new po({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:"\n\n\t\tprecision mediump float;\n\t\tprecision mediump int;\n\n\t\tattribute float faceIndex;\n\n\t\tvarying vec3 vOutputDirection;\n\n\t\t// RH coordinate system; PMREM face-indexing convention\n\t\tvec3 getDirection( vec2 uv, float face ) {\n\n\t\t\tuv = 2.0 * uv - 1.0;\n\n\t\t\tvec3 direction = vec3( uv, 1.0 );\n\n\t\t\tif ( face == 0.0 ) {\n\n\t\t\t\tdirection = direction.zyx; // ( 1, v, u ) pos x\n\n\t\t\t} else if ( face == 1.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xz *= -1.0; // ( -u, 1, -v ) pos y\n\n\t\t\t} else if ( face == 2.0 ) {\n\n\t\t\t\tdirection.x *= -1.0; // ( -u, v, 1 ) pos z\n\n\t\t\t} else if ( face == 3.0 ) {\n\n\t\t\t\tdirection = direction.zyx;\n\t\t\t\tdirection.xz *= -1.0; // ( -1, v, -u ) neg x\n\n\t\t\t} else if ( face == 4.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xy *= -1.0; // ( -u, -1, v ) neg y\n\n\t\t\t} else if ( face == 5.0 ) {\n\n\t\t\t\tdirection.z *= -1.0; // ( u, v, -1 ) neg z\n\n\t\t\t}\n\n\t\t\treturn direction;\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvOutputDirection = getDirection( uv, faceIndex );\n\t\t\tgl_Position = vec4( position, 1.0 );\n\n\t\t}\n\t",fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tuniform float flipEnvMap;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform samplerCube envMap;\n\n\t\t\tvoid main() {\n\n\t\t\t\tgl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) );\n\n\t\t\t}\n\t\t",blending:W,depthTest:!1,depthWrite:!1})}function ts(e){var t=new WeakMap,n=null;function r(e){var n=e.target;n.removeEventListener("dispose",r);var i=t.get(n);void 0!==i&&(t.delete(n),i.dispose())}return{get:function(i){if(i&&i.isTexture){var a=i.mapping,o=a===Pe||a===Ie,s=a===Ce||a===Le;if(o||s){if(i.isRenderTargetTexture&&!0===i.needsPMREMUpdate){i.needsPMREMUpdate=!1;var u=t.get(i);return null===n&&(n=new Ko(e)),u=o?n.fromEquirectangular(i,u):n.fromCubemap(i,u),t.set(i,u),u.texture}if(t.has(i))return t.get(i).texture;var l=i.image;if(o&&l&&l.height>0||s&&l&&function(e){for(var t=0,n=6,r=0;r<n;r++)void 0!==e[r]&&t++;return t===n}(l)){null===n&&(n=new Ko(e));var c=o?n.fromEquirectangular(i):n.fromCubemap(i);return t.set(i,c),i.addEventListener("dispose",r),c.texture}return null}}return i},dispose:function(){t=new WeakMap,null!==n&&(n.dispose(),n=null)}}}function ns(e){var t={};function n(n){if(void 0!==t[n])return t[n];var r;switch(n){case"WEBGL_depth_texture":r=e.getExtension("WEBGL_depth_texture")||e.getExtension("MOZ_WEBGL_depth_texture")||e.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":r=e.getExtension("EXT_texture_filter_anisotropic")||e.getExtension("MOZ_EXT_texture_filter_anisotropic")||e.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":r=e.getExtension("WEBGL_compressed_texture_s3tc")||e.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||e.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":r=e.getExtension("WEBGL_compressed_texture_pvrtc")||e.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:r=e.getExtension(n)}return t[n]=r,r}return{has:function(e){return null!==n(e)},init:function(e){e.isWebGL2?n("EXT_color_buffer_float"):(n("WEBGL_depth_texture"),n("OES_texture_float"),n("OES_texture_half_float"),n("OES_texture_half_float_linear"),n("OES_standard_derivatives"),n("OES_element_index_uint"),n("OES_vertex_array_object"),n("ANGLE_instanced_arrays")),n("OES_texture_float_linear"),n("EXT_color_buffer_half_float"),n("WEBGL_multisampled_render_to_texture")},get:function(e){var t=n(e);return null===t&&console.warn("THREE.WebGLRenderer: "+e+" extension not supported."),t}}}function rs(e,t,n,r){var i={},a=new WeakMap;function o(e){var s=e.target;for(var u in null!==s.index&&t.remove(s.index),s.attributes)t.remove(s.attributes[u]);for(var l in s.morphAttributes)for(var c=s.morphAttributes[l],h=0,d=c.length;h<d;h++)t.remove(c[h]);s.removeEventListener("dispose",o),delete i[s.id];var f=a.get(s);f&&(t.remove(f),a.delete(s)),r.releaseStatesOfGeometry(s),!0===s.isInstancedBufferGeometry&&delete s._maxInstanceCount,n.memory.geometries--}function s(e){var n=[],r=e.index,i=e.attributes.position,o=0;if(null!==r){var s=r.array;o=r.version;for(var u=0,l=s.length;u<l;u+=3){var c=s[u+0],h=s[u+1],d=s[u+2];n.push(c,h,h,d,d,c)}}else{if(void 0===i)return;var f=i.array;o=i.version;for(var p=0,v=f.length/3-1;p<v;p+=3){var m=p+0,g=p+1,y=p+2;n.push(m,g,g,y,y,m)}}var _=new(_r(n)?La:ka)(n,1);_.version=o;var x=a.get(e);x&&t.remove(x),a.set(e,_)}return{get:function(e,t){return!0===i[t.id]||(t.addEventListener("dispose",o),i[t.id]=!0,n.memory.geometries++),t},update:function(n){var r=n.attributes;for(var i in r)t.update(r[i],e.ARRAY_BUFFER);var a=n.morphAttributes;for(var o in a)for(var s=a[o],u=0,l=s.length;u<l;u++)t.update(s[u],e.ARRAY_BUFFER)},getWireframeAttribute:function(e){var t=a.get(e);if(t){var n=e.index;null!==n&&t.version<n.version&&s(e)}else s(e);return a.get(e)}}}function is(e,t,n,r){var i,a,o,s=r.isWebGL2;this.setMode=function(e){i=e},this.setIndex=function(e){a=e.type,o=e.bytesPerElement},this.render=function(t,r){e.drawElements(i,r,a,t*o),n.update(r,i,1)},this.renderInstances=function(r,u,l){if(0!==l){var c,h;if(s)c=e,h="drawElementsInstanced";else if(h="drawElementsInstancedANGLE",null===(c=t.get("ANGLE_instanced_arrays")))return void console.error("THREE.WebGLIndexedBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");c[h](i,u,a,r*o,l),n.update(u,i,l)}}}function as(e){var t={frame:0,calls:0,triangles:0,points:0,lines:0};return{memory:{geometries:0,textures:0},render:t,programs:null,autoReset:!0,reset:function(){t.calls=0,t.triangles=0,t.points=0,t.lines=0},update:function(n,r,i){switch(t.calls++,r){case e.TRIANGLES:t.triangles+=i*(n/3);break;case e.LINES:t.lines+=i*(n/2);break;case e.LINE_STRIP:t.lines+=i*(n-1);break;case e.LINE_LOOP:t.lines+=i*n;break;case e.POINTS:t.points+=i*n;break;default:console.error("THREE.WebGLInfo: Unknown draw mode:",r)}}}}function os(e,t){return e[0]-t[0]}function ss(e,t){return Math.abs(t[1])-Math.abs(e[1])}function us(e,t,n){for(var r={},i=new Float32Array(8),a=new WeakMap,o=new Br,s=[],u=0;u<8;u++)s[u]=[u,0];return{update:function(u,l,c){var h=u.morphTargetInfluences;if(!0===t.isWebGL2){var d=l.morphAttributes.position||l.morphAttributes.normal||l.morphAttributes.color,f=void 0!==d?d.length:0,p=a.get(l);if(void 0===p||p.count!==f){void 0!==p&&p.texture.dispose();var v=void 0!==l.morphAttributes.position,m=void 0!==l.morphAttributes.normal,g=void 0!==l.morphAttributes.color,y=l.morphAttributes.position||[],_=l.morphAttributes.normal||[],x=l.morphAttributes.color||[],M=0;!0===v&&(M=1),!0===m&&(M=2),!0===g&&(M=3);var S=l.attributes.position.count*M,b=1;S>t.maxTextureSize&&(b=Math.ceil(S/t.maxTextureSize),S=t.maxTextureSize);var w=new Float32Array(S*b*4*f),T=new Gr(w,S,b,f);T.type=et,T.needsUpdate=!0;for(var E=4*M,A=0;A<f;A++)for(var R=y[A],k=_[A],C=x[A],L=S*b*4*A,P=0;P<R.count;P++){var I=P*E;!0===v&&(o.fromBufferAttribute(R,P),w[L+I+0]=o.x,w[L+I+1]=o.y,w[L+I+2]=o.z,w[L+I+3]=0),!0===m&&(o.fromBufferAttribute(k,P),w[L+I+4]=o.x,w[L+I+5]=o.y,w[L+I+6]=o.z,w[L+I+7]=0),!0===g&&(o.fromBufferAttribute(C,P),w[L+I+8]=o.x,w[L+I+9]=o.y,w[L+I+10]=o.z,w[L+I+11]=4===C.itemSize?o.w:1)}function J(){T.dispose(),a.delete(l),l.removeEventListener("dispose",J)}p={count:f,texture:T,size:new mr(S,b)},a.set(l,p),l.addEventListener("dispose",J)}for(var D=0,U=0;U<h.length;U++)D+=h[U];var O=l.morphTargetsRelative?1:1-D;c.getUniforms().setValue(e,"morphTargetBaseInfluence",O),c.getUniforms().setValue(e,"morphTargetInfluences",h),c.getUniforms().setValue(e,"morphTargetsTexture",p.texture,n),c.getUniforms().setValue(e,"morphTargetsTextureSize",p.size)}else{var N=void 0===h?0:h.length,F=r[l.id];if(void 0===F||F.length!==N){F=[];for(var B=0;B<N;B++)F[B]=[B,0];r[l.id]=F}for(var z=0;z<N;z++){var H=F[z];H[0]=z,H[1]=h[z]}F.sort(ss);for(var G=0;G<8;G++)G<N&&F[G][1]?(s[G][0]=F[G][0],s[G][1]=F[G][1]):(s[G][0]=Number.MAX_SAFE_INTEGER,s[G][1]=0);s.sort(os);for(var V=l.morphAttributes.position,W=l.morphAttributes.normal,j=0,X=0;X<8;X++){var q=s[X],Y=q[0],Z=q[1];Y!==Number.MAX_SAFE_INTEGER&&Z?(V&&l.getAttribute("morphTarget"+X)!==V[Y]&&l.setAttribute("morphTarget"+X,V[Y]),W&&l.getAttribute("morphNormal"+X)!==W[Y]&&l.setAttribute("morphNormal"+X,W[Y]),i[X]=Z,j+=Z):(V&&!0===l.hasAttribute("morphTarget"+X)&&l.deleteAttribute("morphTarget"+X),W&&!0===l.hasAttribute("morphNormal"+X)&&l.deleteAttribute("morphNormal"+X),i[X]=0)}var K=l.morphTargetsRelative?1:1-j;c.getUniforms().setValue(e,"morphTargetBaseInfluence",K),c.getUniforms().setValue(e,"morphTargetInfluences",i)}}}}function ls(e,t,n,r){var i=new WeakMap;function a(e){var t=e.target;t.removeEventListener("dispose",a),n.remove(t.instanceMatrix),null!==t.instanceColor&&n.remove(t.instanceColor)}return{update:function(o){var s=r.render.frame,u=o.geometry,l=t.get(o,u);if(i.get(l)!==s&&(t.update(l),i.set(l,s)),o.isInstancedMesh&&(!1===o.hasEventListener("dispose",a)&&o.addEventListener("dispose",a),i.get(o)!==s&&(n.update(o.instanceMatrix,e.ARRAY_BUFFER),null!==o.instanceColor&&n.update(o.instanceColor,e.ARRAY_BUFFER),i.set(o,s))),o.isSkinnedMesh){var c=o.skeleton;i.get(c)!==s&&(c.update(),i.set(c,s))}return l},dispose:function(){i=new WeakMap}}}var cs=new Fr,hs=new Gr,ds=new Wr,fs=new _o,ps=[],vs=[],ms=new Float32Array(16),gs=new Float32Array(9),ys=new Float32Array(4);function _s(e,t,n){var r=e[0];if(r<=0||r>0)return e;var i=t*n,a=ps[i];if(void 0===a&&(a=new Float32Array(i),ps[i]=a),0!==t){r.toArray(a,0);for(var o=1,s=0;o!==t;++o)s+=n,e[o].toArray(a,s)}return a}function xs(e,t){if(e.length!==t.length)return!1;for(var n=0,r=e.length;n<r;n++)if(e[n]!==t[n])return!1;return!0}function Ms(e,t){for(var n=0,r=t.length;n<r;n++)e[n]=t[n]}function Ss(e,t){var n=vs[t];void 0===n&&(n=new Int32Array(t),vs[t]=n);for(var r=0;r!==t;++r)n[r]=e.allocateTextureUnit();return n}function bs(e,t){var n=this.cache;n[0]!==t&&(e.uniform1f(this.addr,t),n[0]=t)}function ws(e,t){var n=this.cache;if(void 0!==t.x)n[0]===t.x&&n[1]===t.y||(e.uniform2f(this.addr,t.x,t.y),n[0]=t.x,n[1]=t.y);else{if(xs(n,t))return;e.uniform2fv(this.addr,t),Ms(n,t)}}function Ts(e,t){var n=this.cache;if(void 0!==t.x)n[0]===t.x&&n[1]===t.y&&n[2]===t.z||(e.uniform3f(this.addr,t.x,t.y,t.z),n[0]=t.x,n[1]=t.y,n[2]=t.z);else if(void 0!==t.r)n[0]===t.r&&n[1]===t.g&&n[2]===t.b||(e.uniform3f(this.addr,t.r,t.g,t.b),n[0]=t.r,n[1]=t.g,n[2]=t.b);else{if(xs(n,t))return;e.uniform3fv(this.addr,t),Ms(n,t)}}function Es(e,t){var n=this.cache;if(void 0!==t.x)n[0]===t.x&&n[1]===t.y&&n[2]===t.z&&n[3]===t.w||(e.uniform4f(this.addr,t.x,t.y,t.z,t.w),n[0]=t.x,n[1]=t.y,n[2]=t.z,n[3]=t.w);else{if(xs(n,t))return;e.uniform4fv(this.addr,t),Ms(n,t)}}function As(e,t){var n=this.cache,r=t.elements;if(void 0===r){if(xs(n,t))return;e.uniformMatrix2fv(this.addr,!1,t),Ms(n,t)}else{if(xs(n,r))return;ys.set(r),e.uniformMatrix2fv(this.addr,!1,ys),Ms(n,r)}}function Rs(e,t){var n=this.cache,r=t.elements;if(void 0===r){if(xs(n,t))return;e.uniformMatrix3fv(this.addr,!1,t),Ms(n,t)}else{if(xs(n,r))return;gs.set(r),e.uniformMatrix3fv(this.addr,!1,gs),Ms(n,r)}}function ks(e,t){var n=this.cache,r=t.elements;if(void 0===r){if(xs(n,t))return;e.uniformMatrix4fv(this.addr,!1,t),Ms(n,t)}else{if(xs(n,r))return;ms.set(r),e.uniformMatrix4fv(this.addr,!1,ms),Ms(n,r)}}function Cs(e,t){var n=this.cache;n[0]!==t&&(e.uniform1i(this.addr,t),n[0]=t)}function Ls(e,t){var n=this.cache;if(void 0!==t.x)n[0]===t.x&&n[1]===t.y||(e.uniform2i(this.addr,t.x,t.y),n[0]=t.x,n[1]=t.y);else{if(xs(n,t))return;e.uniform2iv(this.addr,t),Ms(n,t)}}function Ps(e,t){var n=this.cache;if(void 0!==t.x)n[0]===t.x&&n[1]===t.y&&n[2]===t.z||(e.uniform3i(this.addr,t.x,t.y,t.z),n[0]=t.x,n[1]=t.y,n[2]=t.z);else{if(xs(n,t))return;e.uniform3iv(this.addr,t),Ms(n,t)}}function Is(e,t){var n=this.cache;if(void 0!==t.x)n[0]===t.x&&n[1]===t.y&&n[2]===t.z&&n[3]===t.w||(e.uniform4i(this.addr,t.x,t.y,t.z,t.w),n[0]=t.x,n[1]=t.y,n[2]=t.z,n[3]=t.w);else{if(xs(n,t))return;e.uniform4iv(this.addr,t),Ms(n,t)}}function Ds(e,t){var n=this.cache;n[0]!==t&&(e.uniform1ui(this.addr,t),n[0]=t)}function Us(e,t){var n=this.cache;if(void 0!==t.x)n[0]===t.x&&n[1]===t.y||(e.uniform2ui(this.addr,t.x,t.y),n[0]=t.x,n[1]=t.y);else{if(xs(n,t))return;e.uniform2uiv(this.addr,t),Ms(n,t)}}function Os(e,t){var n=this.cache;if(void 0!==t.x)n[0]===t.x&&n[1]===t.y&&n[2]===t.z||(e.uniform3ui(this.addr,t.x,t.y,t.z),n[0]=t.x,n[1]=t.y,n[2]=t.z);else{if(xs(n,t))return;e.uniform3uiv(this.addr,t),Ms(n,t)}}function Ns(e,t){var n=this.cache;if(void 0!==t.x)n[0]===t.x&&n[1]===t.y&&n[2]===t.z&&n[3]===t.w||(e.uniform4ui(this.addr,t.x,t.y,t.z,t.w),n[0]=t.x,n[1]=t.y,n[2]=t.z,n[3]=t.w);else{if(xs(n,t))return;e.uniform4uiv(this.addr,t),Ms(n,t)}}function Fs(e,t,n){var r=this.cache,i=n.allocateTextureUnit();r[0]!==i&&(e.uniform1i(this.addr,i),r[0]=i),n.setTexture2D(t||cs,i)}function Bs(e,t,n){var r=this.cache,i=n.allocateTextureUnit();r[0]!==i&&(e.uniform1i(this.addr,i),r[0]=i),n.setTexture3D(t||ds,i)}function zs(e,t,n){var r=this.cache,i=n.allocateTextureUnit();r[0]!==i&&(e.uniform1i(this.addr,i),r[0]=i),n.setTextureCube(t||fs,i)}function Hs(e,t,n){var r=this.cache,i=n.allocateTextureUnit();r[0]!==i&&(e.uniform1i(this.addr,i),r[0]=i),n.setTexture2DArray(t||hs,i)}function Gs(e,t){e.uniform1fv(this.addr,t)}function Vs(e,t){var n=_s(t,this.size,2);e.uniform2fv(this.addr,n)}function Ws(e,t){var n=_s(t,this.size,3);e.uniform3fv(this.addr,n)}function js(e,t){var n=_s(t,this.size,4);e.uniform4fv(this.addr,n)}function Xs(e,t){var n=_s(t,this.size,4);e.uniformMatrix2fv(this.addr,!1,n)}function qs(e,t){var n=_s(t,this.size,9);e.uniformMatrix3fv(this.addr,!1,n)}function Ys(e,t){var n=_s(t,this.size,16);e.uniformMatrix4fv(this.addr,!1,n)}function Zs(e,t){e.uniform1iv(this.addr,t)}function Ks(e,t){e.uniform2iv(this.addr,t)}function Js(e,t){e.uniform3iv(this.addr,t)}function Qs(e,t){e.uniform4iv(this.addr,t)}function $s(e,t){e.uniform1uiv(this.addr,t)}function eu(e,t){e.uniform2uiv(this.addr,t)}function tu(e,t){e.uniform3uiv(this.addr,t)}function nu(e,t){e.uniform4uiv(this.addr,t)}function ru(e,t,n){var r=this.cache,i=t.length,a=Ss(n,i);xs(r,a)||(e.uniform1iv(this.addr,a),Ms(r,a));for(var o=0;o!==i;++o)n.setTexture2D(t[o]||cs,a[o])}function iu(e,t,n){var r=this.cache,i=t.length,a=Ss(n,i);xs(r,a)||(e.uniform1iv(this.addr,a),Ms(r,a));for(var o=0;o!==i;++o)n.setTexture3D(t[o]||ds,a[o])}function au(e,t,n){var r=this.cache,i=t.length,a=Ss(n,i);xs(r,a)||(e.uniform1iv(this.addr,a),Ms(r,a));for(var o=0;o!==i;++o)n.setTextureCube(t[o]||fs,a[o])}function ou(e,t,n){var r=this.cache,i=t.length,a=Ss(n,i);xs(r,a)||(e.uniform1iv(this.addr,a),Ms(r,a));for(var o=0;o!==i;++o)n.setTexture2DArray(t[o]||hs,a[o])}var su=s((function e(t,n,r){a(this,e),this.id=t,this.addr=r,this.cache=[],this.setValue=function(e){switch(e){case 5126:return bs;case 35664:return ws;case 35665:return Ts;case 35666:return Es;case 35674:return As;case 35675:return Rs;case 35676:return ks;case 5124:case 35670:return Cs;case 35667:case 35671:return Ls;case 35668:case 35672:return Ps;case 35669:case 35673:return Is;case 5125:return Ds;case 36294:return Us;case 36295:return Os;case 36296:return Ns;case 35678:case 36198:case 36298:case 36306:case 35682:return Fs;case 35679:case 36299:case 36307:return Bs;case 35680:case 36300:case 36308:case 36293:return zs;case 36289:case 36303:case 36311:case 36292:return Hs}}(n.type)})),uu=s((function e(t,n,r){a(this,e),this.id=t,this.addr=r,this.cache=[],this.size=n.size,this.setValue=function(e){switch(e){case 5126:return Gs;case 35664:return Vs;case 35665:return Ws;case 35666:return js;case 35674:return Xs;case 35675:return qs;case 35676:return Ys;case 5124:case 35670:return Zs;case 35667:case 35671:return Ks;case 35668:case 35672:return Js;case 35669:case 35673:return Qs;case 5125:return $s;case 36294:return eu;case 36295:return tu;case 36296:return nu;case 35678:case 36198:case 36298:case 36306:case 35682:return ru;case 35679:case 36299:case 36307:return iu;case 35680:case 36300:case 36308:case 36293:return au;case 36289:case 36303:case 36311:case 36292:return ou}}(n.type)})),lu=function(){function e(t){a(this,e),this.id=t,this.seq=[],this.map={}}return s(e,[{key:"setValue",value:function(e,t,n){for(var r=this.seq,i=0,a=r.length;i!==a;++i){var o=r[i];o.setValue(e,t[o.id],n)}}}]),e}(),cu=/(\w+)(\])?(\[|\.)?/g;function hu(e,t){e.seq.push(t),e.map[t.id]=t}function du(e,t,n){var r=e.name,i=r.length;for(cu.lastIndex=0;;){var a=cu.exec(r),o=cu.lastIndex,s=a[1],u="]"===a[2],l=a[3];if(u&&(s|=0),void 0===l||"["===l&&o+2===i){hu(n,void 0===l?new su(s,e,t):new uu(s,e,t));break}var c=n.map[s];void 0===c&&hu(n,c=new lu(s)),n=c}}var fu=function(){function e(t,n){a(this,e),this.seq=[],this.map={};for(var r=t.getProgramParameter(n,t.ACTIVE_UNIFORMS),i=0;i<r;++i){var o=t.getActiveUniform(n,i);du(o,t.getUniformLocation(n,o.name),this)}}return s(e,[{key:"setValue",value:function(e,t,n,r){var i=this.map[t];void 0!==i&&i.setValue(e,n,r)}},{key:"setOptional",value:function(e,t,n){var r=t[n];void 0!==r&&this.setValue(e,n,r)}}],[{key:"upload",value:function(e,t,n,r){for(var i=0,a=t.length;i!==a;++i){var o=t[i],s=n[o.id];!1!==s.needsUpdate&&o.setValue(e,s.value,r)}}},{key:"seqWithValue",value:function(e,t){for(var n=[],r=0,i=e.length;r!==i;++r){var a=e[r];a.id in t&&n.push(a)}return n}}]),e}();function pu(e,t,n){var r=e.createShader(t);return e.shaderSource(r,n),e.compileShader(r),r}var vu=0;function mu(e,t,n){var r=e.getShaderParameter(t,e.COMPILE_STATUS),i=e.getShaderInfoLog(t).trim();if(r&&""===i)return"";var a=/ERROR: 0:(\d+)/.exec(i);if(a){var o=parseInt(a[1]);return n.toUpperCase()+"\n\n"+i+"\n\n"+function(e,t){for(var n=e.split("\n"),r=[],i=Math.max(t-6,0),a=Math.min(t+6,n.length),o=i;o<a;o++){var s=o+1;r.push("".concat(s===t?">":" "," ").concat(s,": ").concat(n[o]))}return r.join("\n")}(e.getShaderSource(t),o)}return i}function gu(e,t){var n=function(e){switch(e){case vn:return["Linear","( value )"];case pn:return["sRGB","( value )"];default:return console.warn("THREE.WebGLProgram: Unsupported color space:",e),["Linear","( value )"]}}(t);return"vec4 "+e+"( vec4 value ) { return LinearTo"+n[0]+n[1]+"; }"}function yu(e,t){var n;switch(t){case we:n="Linear";break;case Te:n="Reinhard";break;case Ee:n="OptimizedCineon";break;case Ae:n="ACESFilmic";break;case Re:n="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",t),n="Linear"}return"vec3 "+e+"( vec3 color ) { return "+n+"ToneMapping( color ); }"}function _u(e){return""!==e}function xu(e,t){var n=t.numSpotLightShadows+t.numSpotLightMaps-t.numSpotLightShadowsWithMaps;return e.replace(/NUM_DIR_LIGHTS/g,t.numDirLights).replace(/NUM_SPOT_LIGHTS/g,t.numSpotLights).replace(/NUM_SPOT_LIGHT_MAPS/g,t.numSpotLightMaps).replace(/NUM_SPOT_LIGHT_COORDS/g,n).replace(/NUM_RECT_AREA_LIGHTS/g,t.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,t.numPointLights).replace(/NUM_HEMI_LIGHTS/g,t.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,t.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS/g,t.numSpotLightShadowsWithMaps).replace(/NUM_SPOT_LIGHT_SHADOWS/g,t.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,t.numPointLightShadows)}function Mu(e,t){return e.replace(/NUM_CLIPPING_PLANES/g,t.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,t.numClippingPlanes-t.numClipIntersection)}var Su=/^[ \t]*#include +<([\w\d./]+)>/gm;function bu(e){return e.replace(Su,Tu)}var wu=new Map([["encodings_fragment","colorspace_fragment"],["encodings_pars_fragment","colorspace_pars_fragment"],["output_fragment","opaque_fragment"]]);function Tu(e,t){var n=Lo[t];if(void 0===n){var r=wu.get(t);if(void 0===r)throw new Error("Can not resolve #include <"+t+">");n=Lo[r],console.warn('THREE.WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',t,r)}return bu(n)}var Eu=/#pragma unroll_loop_start\s+for\s*\(\s*int\s+i\s*=\s*(\d+)\s*;\s*i\s*<\s*(\d+)\s*;\s*i\s*\+\+\s*\)\s*{([\s\S]+?)}\s+#pragma unroll_loop_end/g;function Au(e){return e.replace(Eu,Ru)}function Ru(e,t,n,r){for(var i="",a=parseInt(t);a<parseInt(n);a++)i+=r.replace(/\[\s*i\s*\]/g,"[ "+a+" ]").replace(/UNROLLED_LOOP_INDEX/g,a);return i}function ku(e){var t="precision "+e.precision+" float;\nprecision "+e.precision+" int;";return"highp"===e.precision?t+="\n#define HIGH_PRECISION":"mediump"===e.precision?t+="\n#define MEDIUM_PRECISION":"lowp"===e.precision&&(t+="\n#define LOW_PRECISION"),t}function Cu(e,t,n,r){var i,a,o=e.getContext(),s=n.defines,u=n.vertexShader,l=n.fragmentShader,c=function(e){var t="SHADOWMAP_TYPE_BASIC";return e.shadowMapType===N?t="SHADOWMAP_TYPE_PCF":e.shadowMapType===F?t="SHADOWMAP_TYPE_PCF_SOFT":e.shadowMapType===B&&(t="SHADOWMAP_TYPE_VSM"),t}(n),h=function(e){var t="ENVMAP_TYPE_CUBE";if(e.envMap)switch(e.envMapMode){case Ce:case Le:t="ENVMAP_TYPE_CUBE";break;case De:t="ENVMAP_TYPE_CUBE_UV"}return t}(n),d=function(e){var t="ENVMAP_MODE_REFLECTION";e.envMap&&e.envMapMode===Le&&(t="ENVMAP_MODE_REFRACTION");return t}(n),f=function(e){var t="ENVMAP_BLENDING_NONE";if(e.envMap)switch(e.combine){case xe:t="ENVMAP_BLENDING_MULTIPLY";break;case Me:t="ENVMAP_BLENDING_MIX";break;case Se:t="ENVMAP_BLENDING_ADD"}return t}(n),p=function(e){var t=e.envMapCubeUVHeight;if(null===t)return null;var n=Math.log2(t)-2,r=1/t;return{texelWidth:1/(3*Math.max(Math.pow(2,n),112)),texelHeight:r,maxMip:n}}(n),v=n.isWebGL2?"":function(e){return[e.extensionDerivatives||e.envMapCubeUVHeight||e.bumpMap||e.normalMapTangentSpace||e.clearcoatNormalMap||e.flatShading||"physical"===e.shaderID?"#extension GL_OES_standard_derivatives : enable":"",(e.extensionFragDepth||e.logarithmicDepthBuffer)&&e.rendererExtensionFragDepth?"#extension GL_EXT_frag_depth : enable":"",e.extensionDrawBuffers&&e.rendererExtensionDrawBuffers?"#extension GL_EXT_draw_buffers : require":"",(e.extensionShaderTextureLOD||e.envMap||e.transmission)&&e.rendererExtensionShaderTextureLod?"#extension GL_EXT_shader_texture_lod : enable":""].filter(_u).join("\n")}(n),m=function(e){var t=[];for(var n in e){var r=e[n];!1!==r&&t.push("#define "+n+" "+r)}return t.join("\n")}(s),g=o.createProgram(),y=n.glslVersion?"#version "+n.glslVersion+"\n":"";n.isRawShaderMaterial?((i=["#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,m].filter(_u).join("\n")).length>0&&(i+="\n"),(a=[v,"#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,m].filter(_u).join("\n")).length>0&&(a+="\n")):(i=[ku(n),"#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,m,n.instancing?"#define USE_INSTANCING":"",n.instancingColor?"#define USE_INSTANCING_COLOR":"",n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.map?"#define USE_MAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+d:"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",n.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",n.displacementMap?"#define USE_DISPLACEMENTMAP":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.anisotropyMap?"#define USE_ANISOTROPYMAP":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",n.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",n.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.alphaHash?"#define USE_ALPHAHASH":"",n.transmission?"#define USE_TRANSMISSION":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.thicknessMap?"#define USE_THICKNESSMAP":"",n.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",n.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",n.mapUv?"#define MAP_UV "+n.mapUv:"",n.alphaMapUv?"#define ALPHAMAP_UV "+n.alphaMapUv:"",n.lightMapUv?"#define LIGHTMAP_UV "+n.lightMapUv:"",n.aoMapUv?"#define AOMAP_UV "+n.aoMapUv:"",n.emissiveMapUv?"#define EMISSIVEMAP_UV "+n.emissiveMapUv:"",n.bumpMapUv?"#define BUMPMAP_UV "+n.bumpMapUv:"",n.normalMapUv?"#define NORMALMAP_UV "+n.normalMapUv:"",n.displacementMapUv?"#define DISPLACEMENTMAP_UV "+n.displacementMapUv:"",n.metalnessMapUv?"#define METALNESSMAP_UV "+n.metalnessMapUv:"",n.roughnessMapUv?"#define ROUGHNESSMAP_UV "+n.roughnessMapUv:"",n.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+n.anisotropyMapUv:"",n.clearcoatMapUv?"#define CLEARCOATMAP_UV "+n.clearcoatMapUv:"",n.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+n.clearcoatNormalMapUv:"",n.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+n.clearcoatRoughnessMapUv:"",n.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+n.iridescenceMapUv:"",n.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+n.iridescenceThicknessMapUv:"",n.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+n.sheenColorMapUv:"",n.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+n.sheenRoughnessMapUv:"",n.specularMapUv?"#define SPECULARMAP_UV "+n.specularMapUv:"",n.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+n.specularColorMapUv:"",n.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+n.specularIntensityMapUv:"",n.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+n.transmissionMapUv:"",n.thicknessMapUv?"#define THICKNESSMAP_UV "+n.thicknessMapUv:"",n.vertexTangents&&!1===n.flatShading?"#define USE_TANGENT":"",n.vertexColors?"#define USE_COLOR":"",n.vertexAlphas?"#define USE_COLOR_ALPHA":"",n.vertexUv1s?"#define USE_UV1":"",n.vertexUv2s?"#define USE_UV2":"",n.vertexUv3s?"#define USE_UV3":"",n.pointsUvs?"#define USE_POINTS_UV":"",n.flatShading?"#define FLAT_SHADED":"",n.skinning?"#define USE_SKINNING":"",n.morphTargets?"#define USE_MORPHTARGETS":"",n.morphNormals&&!1===n.flatShading?"#define USE_MORPHNORMALS":"",n.morphColors&&n.isWebGL2?"#define USE_MORPHCOLORS":"",n.morphTargetsCount>0&&n.isWebGL2?"#define MORPHTARGETS_TEXTURE":"",n.morphTargetsCount>0&&n.isWebGL2?"#define MORPHTARGETS_TEXTURE_STRIDE "+n.morphTextureStride:"",n.morphTargetsCount>0&&n.isWebGL2?"#define MORPHTARGETS_COUNT "+n.morphTargetsCount:"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+c:"",n.sizeAttenuation?"#define USE_SIZEATTENUATION":"",n.useLegacyLights?"#define LEGACY_LIGHTS":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",n.logarithmicDepthBuffer&&n.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING","\tattribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR","\tattribute vec3 instanceColor;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_UV1","\tattribute vec2 uv1;","#endif","#ifdef USE_UV2","\tattribute vec2 uv2;","#endif","#ifdef USE_UV3","\tattribute vec2 uv3;","#endif","#ifdef USE_TANGENT","\tattribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )","\tattribute vec4 color;","#elif defined( USE_COLOR )","\tattribute vec3 color;","#endif","#if ( defined( USE_MORPHTARGETS ) && ! defined( MORPHTARGETS_TEXTURE ) )","\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(_u).join("\n"),a=[v,ku(n),"#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,m,n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.map?"#define USE_MAP":"",n.matcap?"#define USE_MATCAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+h:"",n.envMap?"#define "+d:"",n.envMap?"#define "+f:"",p?"#define CUBEUV_TEXEL_WIDTH "+p.texelWidth:"",p?"#define CUBEUV_TEXEL_HEIGHT "+p.texelHeight:"",p?"#define CUBEUV_MAX_MIP "+p.maxMip+".0":"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",n.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.anisotropy?"#define USE_ANISOTROPY":"",n.anisotropyMap?"#define USE_ANISOTROPYMAP":"",n.clearcoat?"#define USE_CLEARCOAT":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.iridescence?"#define USE_IRIDESCENCE":"",n.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",n.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",n.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.alphaTest?"#define USE_ALPHATEST":"",n.alphaHash?"#define USE_ALPHAHASH":"",n.sheen?"#define USE_SHEEN":"",n.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",n.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",n.transmission?"#define USE_TRANSMISSION":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.thicknessMap?"#define USE_THICKNESSMAP":"",n.vertexTangents&&!1===n.flatShading?"#define USE_TANGENT":"",n.vertexColors||n.instancingColor?"#define USE_COLOR":"",n.vertexAlphas?"#define USE_COLOR_ALPHA":"",n.vertexUv1s?"#define USE_UV1":"",n.vertexUv2s?"#define USE_UV2":"",n.vertexUv3s?"#define USE_UV3":"",n.pointsUvs?"#define USE_POINTS_UV":"",n.gradientMap?"#define USE_GRADIENTMAP":"",n.flatShading?"#define FLAT_SHADED":"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+c:"",n.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",n.useLegacyLights?"#define LEGACY_LIGHTS":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",n.logarithmicDepthBuffer&&n.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",n.toneMapping!==be?"#define TONE_MAPPING":"",n.toneMapping!==be?Lo.tonemapping_pars_fragment:"",n.toneMapping!==be?yu("toneMapping",n.toneMapping):"",n.dithering?"#define DITHERING":"",n.opaque?"#define OPAQUE":"",Lo.colorspace_pars_fragment,gu("linearToOutputTexel",n.outputColorSpace),n.useDepthPacking?"#define DEPTH_PACKING "+n.depthPacking:"","\n"].filter(_u).join("\n")),u=Mu(u=xu(u=bu(u),n),n),l=Mu(l=xu(l=bu(l),n),n),u=Au(u),l=Au(l),n.isWebGL2&&!0!==n.isRawShaderMaterial&&(y="#version 300 es\n",i=["precision mediump sampler2DArray;","#define attribute in","#define varying out","#define texture2D texture"].join("\n")+"\n"+i,a=["#define varying in",n.glslVersion===Jn?"":"layout(location = 0) out highp vec4 pc_fragColor;",n.glslVersion===Jn?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth","#define texture2D texture","#define textureCube texture","#define texture2DProj textureProj","#define texture2DLodEXT textureLod","#define texture2DProjLodEXT textureProjLod","#define textureCubeLodEXT textureLod","#define texture2DGradEXT textureGrad","#define texture2DProjGradEXT textureProjGrad","#define textureCubeGradEXT textureGrad"].join("\n")+"\n"+a);var _,x,M=y+i+u,S=y+a+l,b=pu(o,o.VERTEX_SHADER,M),w=pu(o,o.FRAGMENT_SHADER,S);if(o.attachShader(g,b),o.attachShader(g,w),void 0!==n.index0AttributeName?o.bindAttribLocation(g,0,n.index0AttributeName):!0===n.morphTargets&&o.bindAttribLocation(g,0,"position"),o.linkProgram(g),e.debug.checkShaderErrors){var T=o.getProgramInfoLog(g).trim(),E=o.getShaderInfoLog(b).trim(),A=o.getShaderInfoLog(w).trim(),R=!0,k=!0;if(!1===o.getProgramParameter(g,o.LINK_STATUS))if(R=!1,"function"==typeof e.debug.onShaderError)e.debug.onShaderError(o,g,b,w);else{var C=mu(o,b,"vertex"),L=mu(o,w,"fragment");console.error("THREE.WebGLProgram: Shader Error "+o.getError()+" - VALIDATE_STATUS "+o.getProgramParameter(g,o.VALIDATE_STATUS)+"\n\nProgram Info Log: "+T+"\n"+C+"\n"+L)}else""!==T?console.warn("THREE.WebGLProgram: Program Info Log:",T):""!==E&&""!==A||(k=!1);k&&(this.diagnostics={runnable:R,programLog:T,vertexShader:{log:E,prefix:i},fragmentShader:{log:A,prefix:a}})}return o.deleteShader(b),o.deleteShader(w),this.getUniforms=function(){return void 0===_&&(_=new fu(o,g)),_},this.getAttributes=function(){return void 0===x&&(x=function(e,t){for(var n={},r=e.getProgramParameter(t,e.ACTIVE_ATTRIBUTES),i=0;i<r;i++){var a=e.getActiveAttrib(t,i),o=a.name,s=1;a.type===e.FLOAT_MAT2&&(s=2),a.type===e.FLOAT_MAT3&&(s=3),a.type===e.FLOAT_MAT4&&(s=4),n[o]={type:a.type,location:e.getAttribLocation(t,o),locationSize:s}}return n}(o,g)),x},this.destroy=function(){r.releaseStatesOfProgram(this),o.deleteProgram(g),this.program=void 0},this.type=n.shaderType,this.name=n.shaderName,this.id=vu++,this.cacheKey=t,this.usedTimes=1,this.program=g,this.vertexShader=b,this.fragmentShader=w,this}var Lu=0,Pu=function(){function e(){a(this,e),this.shaderCache=new Map,this.materialCache=new Map}return s(e,[{key:"update",value:function(e){var t=e.vertexShader,n=e.fragmentShader,r=this._getShaderStage(t),i=this._getShaderStage(n),a=this._getShaderCacheForMaterial(e);return!1===a.has(r)&&(a.add(r),r.usedTimes++),!1===a.has(i)&&(a.add(i),i.usedTimes++),this}},{key:"remove",value:function(e){var t,n=this.materialCache.get(e),r=v(n);try{for(r.s();!(t=r.n()).done;){var i=t.value;i.usedTimes--,0===i.usedTimes&&this.shaderCache.delete(i.code)}}catch(e){r.e(e)}finally{r.f()}return this.materialCache.delete(e),this}},{key:"getVertexShaderID",value:function(e){return this._getShaderStage(e.vertexShader).id}},{key:"getFragmentShaderID",value:function(e){return this._getShaderStage(e.fragmentShader).id}},{key:"dispose",value:function(){this.shaderCache.clear(),this.materialCache.clear()}},{key:"_getShaderCacheForMaterial",value:function(e){var t=this.materialCache,n=t.get(e);return void 0===n&&(n=new Set,t.set(e,n)),n}},{key:"_getShaderStage",value:function(e){var t=this.shaderCache,n=t.get(e);return void 0===n&&(n=new Iu(e),t.set(e,n)),n}}]),e}(),Iu=s((function e(t){a(this,e),this.id=Lu++,this.code=t,this.usedTimes=0}));function Du(e,t,n,r,i,a,o){var s=new Ui,u=new Pu,l=[],c=i.isWebGL2,h=i.logarithmicDepthBuffer,d=i.vertexTextures,f=i.precision,p={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function v(e){return 0===e?"uv":"uv".concat(e)}return{getParameters:function(a,s,l,m,g){var y=m.fog,_=g.geometry,x=a.isMeshStandardMaterial?m.environment:null,M=(a.isMeshStandardMaterial?n:t).get(a.envMap||x),S=M&&M.mapping===De?M.image.height:null,b=p[a.type];null!==a.precision&&(f=i.getMaxPrecision(a.precision))!==a.precision&&console.warn("THREE.WebGLProgram.getParameters:",a.precision,"not supported, using",f,"instead.");var w,T,E,A,R=_.morphAttributes.position||_.morphAttributes.normal||_.morphAttributes.color,k=void 0!==R?R.length:0,C=0;if(void 0!==_.morphAttributes.position&&(C=1),void 0!==_.morphAttributes.normal&&(C=2),void 0!==_.morphAttributes.color&&(C=3),b){var L=Io[b];w=L.vertexShader,T=L.fragmentShader}else w=a.vertexShader,T=a.fragmentShader,u.update(a),E=u.getVertexShaderID(a),A=u.getFragmentShaderID(a);var P=e.getRenderTarget(),I=!0===g.isInstancedMesh,D=!!a.map,U=!!a.matcap,O=!!M,N=!!a.aoMap,F=!!a.lightMap,B=!!a.bumpMap,z=!!a.normalMap,V=!!a.displacementMap,W=!!a.emissiveMap,X=!!a.metalnessMap,q=!!a.roughnessMap,Y=a.anisotropy>0,Z=a.clearcoat>0,K=a.iridescence>0,J=a.sheen>0,Q=a.transmission>0,$=Y&&!!a.anisotropyMap,ee=Z&&!!a.clearcoatMap,te=Z&&!!a.clearcoatNormalMap,ne=Z&&!!a.clearcoatRoughnessMap,re=K&&!!a.iridescenceMap,ie=K&&!!a.iridescenceThicknessMap,ae=J&&!!a.sheenColorMap,oe=J&&!!a.sheenRoughnessMap,se=!!a.specularMap,ue=!!a.specularColorMap,le=!!a.specularIntensityMap,ce=Q&&!!a.transmissionMap,he=Q&&!!a.thicknessMap,de=!!a.gradientMap,fe=!!a.alphaMap,pe=a.alphaTest>0,ve=!!a.alphaHash,me=!!a.extensions,ge=!!_.attributes.uv1,ye=!!_.attributes.uv2,_e=!!_.attributes.uv3,xe=be;return a.toneMapped&&(null!==P&&!0!==P.isXRRenderTarget||(xe=e.toneMapping)),{isWebGL2:c,shaderID:b,shaderType:a.type,shaderName:a.name,vertexShader:w,fragmentShader:T,defines:a.defines,customVertexShaderID:E,customFragmentShaderID:A,isRawShaderMaterial:!0===a.isRawShaderMaterial,glslVersion:a.glslVersion,precision:f,instancing:I,instancingColor:I&&null!==g.instanceColor,supportsVertexTextures:d,outputColorSpace:null===P?e.outputColorSpace:!0===P.isXRRenderTarget?P.texture.colorSpace:vn,map:D,matcap:U,envMap:O,envMapMode:O&&M.mapping,envMapCubeUVHeight:S,aoMap:N,lightMap:F,bumpMap:B,normalMap:z,displacementMap:d&&V,emissiveMap:W,normalMapObjectSpace:z&&a.normalMapType===dn,normalMapTangentSpace:z&&a.normalMapType===hn,metalnessMap:X,roughnessMap:q,anisotropy:Y,anisotropyMap:$,clearcoat:Z,clearcoatMap:ee,clearcoatNormalMap:te,clearcoatRoughnessMap:ne,iridescence:K,iridescenceMap:re,iridescenceThicknessMap:ie,sheen:J,sheenColorMap:ae,sheenRoughnessMap:oe,specularMap:se,specularColorMap:ue,specularIntensityMap:le,transmission:Q,transmissionMap:ce,thicknessMap:he,gradientMap:de,opaque:!1===a.transparent&&a.blending===j,alphaMap:fe,alphaTest:pe,alphaHash:ve,combine:a.combine,mapUv:D&&v(a.map.channel),aoMapUv:N&&v(a.aoMap.channel),lightMapUv:F&&v(a.lightMap.channel),bumpMapUv:B&&v(a.bumpMap.channel),normalMapUv:z&&v(a.normalMap.channel),displacementMapUv:V&&v(a.displacementMap.channel),emissiveMapUv:W&&v(a.emissiveMap.channel),metalnessMapUv:X&&v(a.metalnessMap.channel),roughnessMapUv:q&&v(a.roughnessMap.channel),anisotropyMapUv:$&&v(a.anisotropyMap.channel),clearcoatMapUv:ee&&v(a.clearcoatMap.channel),clearcoatNormalMapUv:te&&v(a.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:ne&&v(a.clearcoatRoughnessMap.channel),iridescenceMapUv:re&&v(a.iridescenceMap.channel),iridescenceThicknessMapUv:ie&&v(a.iridescenceThicknessMap.channel),sheenColorMapUv:ae&&v(a.sheenColorMap.channel),sheenRoughnessMapUv:oe&&v(a.sheenRoughnessMap.channel),specularMapUv:se&&v(a.specularMap.channel),specularColorMapUv:ue&&v(a.specularColorMap.channel),specularIntensityMapUv:le&&v(a.specularIntensityMap.channel),transmissionMapUv:ce&&v(a.transmissionMap.channel),thicknessMapUv:he&&v(a.thicknessMap.channel),alphaMapUv:fe&&v(a.alphaMap.channel),vertexTangents:!!_.attributes.tangent&&(z||Y),vertexColors:a.vertexColors,vertexAlphas:!0===a.vertexColors&&!!_.attributes.color&&4===_.attributes.color.itemSize,vertexUv1s:ge,vertexUv2s:ye,vertexUv3s:_e,pointsUvs:!0===g.isPoints&&!!_.attributes.uv&&(D||fe),fog:!!y,useFog:!0===a.fog,fogExp2:y&&y.isFogExp2,flatShading:!0===a.flatShading,sizeAttenuation:!0===a.sizeAttenuation,logarithmicDepthBuffer:h,skinning:!0===g.isSkinnedMesh,morphTargets:void 0!==_.morphAttributes.position,morphNormals:void 0!==_.morphAttributes.normal,morphColors:void 0!==_.morphAttributes.color,morphTargetsCount:k,morphTextureStride:C,numDirLights:s.directional.length,numPointLights:s.point.length,numSpotLights:s.spot.length,numSpotLightMaps:s.spotLightMap.length,numRectAreaLights:s.rectArea.length,numHemiLights:s.hemi.length,numDirLightShadows:s.directionalShadowMap.length,numPointLightShadows:s.pointShadowMap.length,numSpotLightShadows:s.spotShadowMap.length,numSpotLightShadowsWithMaps:s.numSpotLightShadowsWithMaps,numClippingPlanes:o.numPlanes,numClipIntersection:o.numIntersection,dithering:a.dithering,shadowMapEnabled:e.shadowMap.enabled&&l.length>0,shadowMapType:e.shadowMap.type,toneMapping:xe,useLegacyLights:e._useLegacyLights,premultipliedAlpha:a.premultipliedAlpha,doubleSided:a.side===G,flipSided:a.side===H,useDepthPacking:a.depthPacking>=0,depthPacking:a.depthPacking||0,index0AttributeName:a.index0AttributeName,extensionDerivatives:me&&!0===a.extensions.derivatives,extensionFragDepth:me&&!0===a.extensions.fragDepth,extensionDrawBuffers:me&&!0===a.extensions.drawBuffers,extensionShaderTextureLOD:me&&!0===a.extensions.shaderTextureLOD,rendererExtensionFragDepth:c||r.has("EXT_frag_depth"),rendererExtensionDrawBuffers:c||r.has("WEBGL_draw_buffers"),rendererExtensionShaderTextureLod:c||r.has("EXT_shader_texture_lod"),customProgramCacheKey:a.customProgramCacheKey()}},getProgramCacheKey:function(t){var n=[];if(t.shaderID?n.push(t.shaderID):(n.push(t.customVertexShaderID),n.push(t.customFragmentShaderID)),void 0!==t.defines)for(var r in t.defines)n.push(r),n.push(t.defines[r]);return!1===t.isRawShaderMaterial&&(!function(e,t){e.push(t.precision),e.push(t.outputColorSpace),e.push(t.envMapMode),e.push(t.envMapCubeUVHeight),e.push(t.mapUv),e.push(t.alphaMapUv),e.push(t.lightMapUv),e.push(t.aoMapUv),e.push(t.bumpMapUv),e.push(t.normalMapUv),e.push(t.displacementMapUv),e.push(t.emissiveMapUv),e.push(t.metalnessMapUv),e.push(t.roughnessMapUv),e.push(t.anisotropyMapUv),e.push(t.clearcoatMapUv),e.push(t.clearcoatNormalMapUv),e.push(t.clearcoatRoughnessMapUv),e.push(t.iridescenceMapUv),e.push(t.iridescenceThicknessMapUv),e.push(t.sheenColorMapUv),e.push(t.sheenRoughnessMapUv),e.push(t.specularMapUv),e.push(t.specularColorMapUv),e.push(t.specularIntensityMapUv),e.push(t.transmissionMapUv),e.push(t.thicknessMapUv),e.push(t.combine),e.push(t.fogExp2),e.push(t.sizeAttenuation),e.push(t.morphTargetsCount),e.push(t.morphAttributeCount),e.push(t.numDirLights),e.push(t.numPointLights),e.push(t.numSpotLights),e.push(t.numSpotLightMaps),e.push(t.numHemiLights),e.push(t.numRectAreaLights),e.push(t.numDirLightShadows),e.push(t.numPointLightShadows),e.push(t.numSpotLightShadows),e.push(t.numSpotLightShadowsWithMaps),e.push(t.shadowMapType),e.push(t.toneMapping),e.push(t.numClippingPlanes),e.push(t.numClipIntersection),e.push(t.depthPacking)}(n,t),function(e,t){s.disableAll(),t.isWebGL2&&s.enable(0);t.supportsVertexTextures&&s.enable(1);t.instancing&&s.enable(2);t.instancingColor&&s.enable(3);t.matcap&&s.enable(4);t.envMap&&s.enable(5);t.normalMapObjectSpace&&s.enable(6);t.normalMapTangentSpace&&s.enable(7);t.clearcoat&&s.enable(8);t.iridescence&&s.enable(9);t.alphaTest&&s.enable(10);t.vertexColors&&s.enable(11);t.vertexAlphas&&s.enable(12);t.vertexUv1s&&s.enable(13);t.vertexUv2s&&s.enable(14);t.vertexUv3s&&s.enable(15);t.vertexTangents&&s.enable(16);t.anisotropy&&s.enable(17);e.push(s.mask),s.disableAll(),t.fog&&s.enable(0);t.useFog&&s.enable(1);t.flatShading&&s.enable(2);t.logarithmicDepthBuffer&&s.enable(3);t.skinning&&s.enable(4);t.morphTargets&&s.enable(5);t.morphNormals&&s.enable(6);t.morphColors&&s.enable(7);t.premultipliedAlpha&&s.enable(8);t.shadowMapEnabled&&s.enable(9);t.useLegacyLights&&s.enable(10);t.doubleSided&&s.enable(11);t.flipSided&&s.enable(12);t.useDepthPacking&&s.enable(13);t.dithering&&s.enable(14);t.transmission&&s.enable(15);t.sheen&&s.enable(16);t.opaque&&s.enable(17);t.pointsUvs&&s.enable(18);e.push(s.mask)}(n,t),n.push(e.outputColorSpace)),n.push(t.customProgramCacheKey),n.join()},getUniforms:function(e){var t,n=p[e.type];if(n){var r=Io[n];t=fo.clone(r.uniforms)}else t=e.uniforms;return t},acquireProgram:function(t,n){for(var r,i=0,o=l.length;i<o;i++){var s=l[i];if(s.cacheKey===n){++(r=s).usedTimes;break}}return void 0===r&&(r=new Cu(e,n,t,a),l.push(r)),r},releaseProgram:function(e){if(0==--e.usedTimes){var t=l.indexOf(e);l[t]=l[l.length-1],l.pop(),e.destroy()}},releaseShaderCache:function(e){u.remove(e)},programs:l,dispose:function(){u.dispose()}}}function Uu(){var e=new WeakMap;return{get:function(t){var n=e.get(t);return void 0===n&&(n={},e.set(t,n)),n},remove:function(t){e.delete(t)},update:function(t,n,r){e.get(t)[n]=r},dispose:function(){e=new WeakMap}}}function Ou(e,t){return e.groupOrder!==t.groupOrder?e.groupOrder-t.groupOrder:e.renderOrder!==t.renderOrder?e.renderOrder-t.renderOrder:e.material.id!==t.material.id?e.material.id-t.material.id:e.z!==t.z?e.z-t.z:e.id-t.id}function Nu(e,t){return e.groupOrder!==t.groupOrder?e.groupOrder-t.groupOrder:e.renderOrder!==t.renderOrder?e.renderOrder-t.renderOrder:e.z!==t.z?t.z-e.z:e.id-t.id}function Fu(){var e=[],t=0,n=[],r=[],i=[];function a(n,r,i,a,o,s){var u=e[t];return void 0===u?(u={id:n.id,object:n,geometry:r,material:i,groupOrder:a,renderOrder:n.renderOrder,z:o,group:s},e[t]=u):(u.id=n.id,u.object=n,u.geometry=r,u.material=i,u.groupOrder=a,u.renderOrder=n.renderOrder,u.z=o,u.group=s),t++,u}return{opaque:n,transmissive:r,transparent:i,init:function(){t=0,n.length=0,r.length=0,i.length=0},push:function(e,t,o,s,u,l){var c=a(e,t,o,s,u,l);o.transmission>0?r.push(c):!0===o.transparent?i.push(c):n.push(c)},unshift:function(e,t,o,s,u,l){var c=a(e,t,o,s,u,l);o.transmission>0?r.unshift(c):!0===o.transparent?i.unshift(c):n.unshift(c)},finish:function(){for(var n=t,r=e.length;n<r;n++){var i=e[n];if(null===i.id)break;i.id=null,i.object=null,i.geometry=null,i.material=null,i.group=null}},sort:function(e,t){n.length>1&&n.sort(e||Ou),r.length>1&&r.sort(t||Nu),i.length>1&&i.sort(t||Nu)}}}function Bu(){var e=new WeakMap;return{get:function(t,n){var r,i=e.get(t);return void 0===i?(r=new Fu,e.set(t,[r])):n>=i.length?(r=new Fu,i.push(r)):r=i[n],r},dispose:function(){e=new WeakMap}}}function zu(){var e={};return{get:function(t){if(void 0!==e[t.id])return e[t.id];var n;switch(t.type){case"DirectionalLight":n={direction:new Yr,color:new pa};break;case"SpotLight":n={position:new Yr,direction:new Yr,color:new pa,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":n={position:new Yr,color:new pa,distance:0,decay:0};break;case"HemisphereLight":n={direction:new Yr,skyColor:new pa,groundColor:new pa};break;case"RectAreaLight":n={color:new pa,position:new Yr,halfWidth:new Yr,halfHeight:new Yr}}return e[t.id]=n,n}}}var Hu=0;function Gu(e,t){return(t.castShadow?2:0)-(e.castShadow?2:0)+(t.map?1:0)-(e.map?1:0)}function Vu(e,t){for(var n,r=new zu,i=(n={},{get:function(e){if(void 0!==n[e.id])return n[e.id];var t;switch(e.type){case"DirectionalLight":case"SpotLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new mr};break;case"PointLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new mr,shadowCameraNear:1,shadowCameraFar:1e3}}return n[e.id]=t,t}}),a={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0},o=0;o<9;o++)a.probe.push(new Yr);var s=new Yr,u=new wi,l=new wi;return{setup:function(n,o){for(var s=0,u=0,l=0,c=0;c<9;c++)a.probe[c].set(0,0,0);var h=0,d=0,f=0,p=0,v=0,m=0,g=0,y=0,_=0,x=0;n.sort(Gu);for(var M=!0===o?Math.PI:1,S=0,b=n.length;S<b;S++){var w=n[S],T=w.color,E=w.intensity,A=w.distance,R=w.shadow&&w.shadow.map?w.shadow.map.texture:null;if(w.isAmbientLight)s+=T.r*E*M,u+=T.g*E*M,l+=T.b*E*M;else if(w.isLightProbe)for(var k=0;k<9;k++)a.probe[k].addScaledVector(w.sh.coefficients[k],E);else if(w.isDirectionalLight){var C=r.get(w);if(C.color.copy(w.color).multiplyScalar(w.intensity*M),w.castShadow){var L=w.shadow,P=i.get(w);P.shadowBias=L.bias,P.shadowNormalBias=L.normalBias,P.shadowRadius=L.radius,P.shadowMapSize=L.mapSize,a.directionalShadow[h]=P,a.directionalShadowMap[h]=R,a.directionalShadowMatrix[h]=w.shadow.matrix,m++}a.directional[h]=C,h++}else if(w.isSpotLight){var I=r.get(w);I.position.setFromMatrixPosition(w.matrixWorld),I.color.copy(T).multiplyScalar(E*M),I.distance=A,I.coneCos=Math.cos(w.angle),I.penumbraCos=Math.cos(w.angle*(1-w.penumbra)),I.decay=w.decay,a.spot[f]=I;var D=w.shadow;if(w.map&&(a.spotLightMap[_]=w.map,_++,D.updateMatrices(w),w.castShadow&&x++),a.spotLightMatrix[f]=D.matrix,w.castShadow){var U=i.get(w);U.shadowBias=D.bias,U.shadowNormalBias=D.normalBias,U.shadowRadius=D.radius,U.shadowMapSize=D.mapSize,a.spotShadow[f]=U,a.spotShadowMap[f]=R,y++}f++}else if(w.isRectAreaLight){var O=r.get(w);O.color.copy(T).multiplyScalar(E),O.halfWidth.set(.5*w.width,0,0),O.halfHeight.set(0,.5*w.height,0),a.rectArea[p]=O,p++}else if(w.isPointLight){var N=r.get(w);if(N.color.copy(w.color).multiplyScalar(w.intensity*M),N.distance=w.distance,N.decay=w.decay,w.castShadow){var F=w.shadow,B=i.get(w);B.shadowBias=F.bias,B.shadowNormalBias=F.normalBias,B.shadowRadius=F.radius,B.shadowMapSize=F.mapSize,B.shadowCameraNear=F.camera.near,B.shadowCameraFar=F.camera.far,a.pointShadow[d]=B,a.pointShadowMap[d]=R,a.pointShadowMatrix[d]=w.shadow.matrix,g++}a.point[d]=N,d++}else if(w.isHemisphereLight){var z=r.get(w);z.skyColor.copy(w.color).multiplyScalar(E*M),z.groundColor.copy(w.groundColor).multiplyScalar(E*M),a.hemi[v]=z,v++}}p>0&&(t.isWebGL2||!0===e.has("OES_texture_float_linear")?(a.rectAreaLTC1=Po.LTC_FLOAT_1,a.rectAreaLTC2=Po.LTC_FLOAT_2):!0===e.has("OES_texture_half_float_linear")?(a.rectAreaLTC1=Po.LTC_HALF_1,a.rectAreaLTC2=Po.LTC_HALF_2):console.error("THREE.WebGLRenderer: Unable to use RectAreaLight. Missing WebGL extensions.")),a.ambient[0]=s,a.ambient[1]=u,a.ambient[2]=l;var H=a.hash;H.directionalLength===h&&H.pointLength===d&&H.spotLength===f&&H.rectAreaLength===p&&H.hemiLength===v&&H.numDirectionalShadows===m&&H.numPointShadows===g&&H.numSpotShadows===y&&H.numSpotMaps===_||(a.directional.length=h,a.spot.length=f,a.rectArea.length=p,a.point.length=d,a.hemi.length=v,a.directionalShadow.length=m,a.directionalShadowMap.length=m,a.pointShadow.length=g,a.pointShadowMap.length=g,a.spotShadow.length=y,a.spotShadowMap.length=y,a.directionalShadowMatrix.length=m,a.pointShadowMatrix.length=g,a.spotLightMatrix.length=y+_-x,a.spotLightMap.length=_,a.numSpotLightShadowsWithMaps=x,H.directionalLength=h,H.pointLength=d,H.spotLength=f,H.rectAreaLength=p,H.hemiLength=v,H.numDirectionalShadows=m,H.numPointShadows=g,H.numSpotShadows=y,H.numSpotMaps=_,a.version=Hu++)},setupView:function(e,t){for(var n=0,r=0,i=0,o=0,c=0,h=t.matrixWorldInverse,d=0,f=e.length;d<f;d++){var p=e[d];if(p.isDirectionalLight){var v=a.directional[n];v.direction.setFromMatrixPosition(p.matrixWorld),s.setFromMatrixPosition(p.target.matrixWorld),v.direction.sub(s),v.direction.transformDirection(h),n++}else if(p.isSpotLight){var m=a.spot[i];m.position.setFromMatrixPosition(p.matrixWorld),m.position.applyMatrix4(h),m.direction.setFromMatrixPosition(p.matrixWorld),s.setFromMatrixPosition(p.target.matrixWorld),m.direction.sub(s),m.direction.transformDirection(h),i++}else if(p.isRectAreaLight){var g=a.rectArea[o];g.position.setFromMatrixPosition(p.matrixWorld),g.position.applyMatrix4(h),l.identity(),u.copy(p.matrixWorld),u.premultiply(h),l.extractRotation(u),g.halfWidth.set(.5*p.width,0,0),g.halfHeight.set(0,.5*p.height,0),g.halfWidth.applyMatrix4(l),g.halfHeight.applyMatrix4(l),o++}else if(p.isPointLight){var y=a.point[r];y.position.setFromMatrixPosition(p.matrixWorld),y.position.applyMatrix4(h),r++}else if(p.isHemisphereLight){var _=a.hemi[c];_.direction.setFromMatrixPosition(p.matrixWorld),_.direction.transformDirection(h),c++}}},state:a}}function Wu(e,t){var n=new Vu(e,t),r=[],i=[];return{init:function(){r.length=0,i.length=0},state:{lightsArray:r,shadowsArray:i,lights:n},setupLights:function(e){n.setup(r,e)},setupLightsView:function(e){n.setupView(r,e)},pushLight:function(e){r.push(e)},pushShadow:function(e){i.push(e)}}}function ju(e,t){var n=new WeakMap;return{get:function(r){var i,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,o=n.get(r);return void 0===o?(i=new Wu(e,t),n.set(r,[i])):a>=o.length?(i=new Wu(e,t),o.push(i)):i=o[a],i},dispose:function(){n=new WeakMap}}}var Xu=function(e){w(n,e);var t=E(n);function n(e){var r;return a(this,n),(r=t.call(this)).isMeshDepthMaterial=!0,r.type="MeshDepthMaterial",r.depthPacking=ln,r.map=null,r.alphaMap=null,r.displacementMap=null,r.displacementScale=1,r.displacementBias=0,r.wireframe=!1,r.wireframeLinewidth=1,r.setValues(e),r}return s(n,[{key:"copy",value:function(e){return y(x(n.prototype),"copy",this).call(this,e),this.depthPacking=e.depthPacking,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this}}]),n}(la),qu=function(e){w(n,e);var t=E(n);function n(e){var r;return a(this,n),(r=t.call(this)).isMeshDistanceMaterial=!0,r.type="MeshDistanceMaterial",r.map=null,r.alphaMap=null,r.displacementMap=null,r.displacementScale=1,r.displacementBias=0,r.setValues(e),r}return s(n,[{key:"copy",value:function(e){return y(x(n.prototype),"copy",this).call(this,e),this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}}]),n}(la);function Yu(e,t,n){var r,i=new Ao,a=new mr,o=new mr,s=new Br,u=new Xu({depthPacking:cn}),c=new qu,h={},d=n.maxTextureSize,f=(l(r={},z,H),l(r,H,z),l(r,G,G),r),p=new po({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new mr},radius:{value:4}},vertexShader:"void main() {\n\tgl_Position = vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D shadow_pass;\nuniform vec2 resolution;\nuniform float radius;\n#include <packing>\nvoid main() {\n\tconst float samples = float( VSM_SAMPLES );\n\tfloat mean = 0.0;\n\tfloat squared_mean = 0.0;\n\tfloat uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 );\n\tfloat uvStart = samples <= 1.0 ? 0.0 : - 1.0;\n\tfor ( float i = 0.0; i < samples; i ++ ) {\n\t\tfloat uvOffset = uvStart + i * uvStride;\n\t\t#ifdef HORIZONTAL_PASS\n\t\t\tvec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ) );\n\t\t\tmean += distribution.x;\n\t\t\tsquared_mean += distribution.y * distribution.y + distribution.x * distribution.x;\n\t\t#else\n\t\t\tfloat depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ) );\n\t\t\tmean += depth;\n\t\t\tsquared_mean += depth * depth;\n\t\t#endif\n\t}\n\tmean = mean / samples;\n\tsquared_mean = squared_mean / samples;\n\tfloat std_dev = sqrt( squared_mean - mean * mean );\n\tgl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );\n}"}),v=p.clone();v.defines.HORIZONTAL_PASS=1;var m=new Ga;m.setAttribute("position",new wa(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));var g=new oo(m,p),y=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=N;var _=this.type;function x(n,r){var i=t.update(g);p.defines.VSM_SAMPLES!==n.blurSamples&&(p.defines.VSM_SAMPLES=n.blurSamples,v.defines.VSM_SAMPLES=n.blurSamples,p.needsUpdate=!0,v.needsUpdate=!0),null===n.mapPass&&(n.mapPass=new Hr(a.x,a.y)),p.uniforms.shadow_pass.value=n.map.texture,p.uniforms.resolution.value=n.mapSize,p.uniforms.radius.value=n.radius,e.setRenderTarget(n.mapPass),e.clear(),e.renderBufferDirect(r,null,i,p,g,null),v.uniforms.shadow_pass.value=n.mapPass.texture,v.uniforms.resolution.value=n.mapSize,v.uniforms.radius.value=n.radius,e.setRenderTarget(n.map),e.clear(),e.renderBufferDirect(r,null,i,v,g,null)}function M(t,n,r,i){var a=null,o=!0===r.isPointLight?t.customDistanceMaterial:t.customDepthMaterial;if(void 0!==o)a=o;else if(a=!0===r.isPointLight?c:u,e.localClippingEnabled&&!0===n.clipShadows&&Array.isArray(n.clippingPlanes)&&0!==n.clippingPlanes.length||n.displacementMap&&0!==n.displacementScale||n.alphaMap&&n.alphaTest>0||n.map&&n.alphaTest>0){var s=a.uuid,l=n.uuid,d=h[s];void 0===d&&(d={},h[s]=d);var p=d[l];void 0===p&&(p=a.clone(),d[l]=p),a=p}(a.visible=n.visible,a.wireframe=n.wireframe,a.side=i===B?null!==n.shadowSide?n.shadowSide:n.side:null!==n.shadowSide?n.shadowSide:f[n.side],a.alphaMap=n.alphaMap,a.alphaTest=n.alphaTest,a.map=n.map,a.clipShadows=n.clipShadows,a.clippingPlanes=n.clippingPlanes,a.clipIntersection=n.clipIntersection,a.displacementMap=n.displacementMap,a.displacementScale=n.displacementScale,a.displacementBias=n.displacementBias,a.wireframeLinewidth=n.wireframeLinewidth,a.linewidth=n.linewidth,!0===r.isPointLight&&!0===a.isMeshDistanceMaterial)&&(e.properties.get(a).light=r);return a}function S(n,r,a,o,s){if(!1!==n.visible){if(n.layers.test(r.layers)&&(n.isMesh||n.isLine||n.isPoints)&&(n.castShadow||n.receiveShadow&&s===B)&&(!n.frustumCulled||i.intersectsObject(n))){n.modelViewMatrix.multiplyMatrices(a.matrixWorldInverse,n.matrixWorld);var u=t.update(n),l=n.material;if(Array.isArray(l))for(var c=u.groups,h=0,d=c.length;h<d;h++){var f=c[h],p=l[f.materialIndex];if(p&&p.visible){var v=M(n,p,o,s);e.renderBufferDirect(a,null,u,v,n,f)}}else if(l.visible){var m=M(n,l,o,s);e.renderBufferDirect(a,null,u,m,n,null)}}for(var g=n.children,y=0,_=g.length;y<_;y++)S(g[y],r,a,o,s)}}this.render=function(t,n,r){if(!1!==y.enabled&&(!1!==y.autoUpdate||!1!==y.needsUpdate)&&0!==t.length){var u=e.getRenderTarget(),l=e.getActiveCubeFace(),c=e.getActiveMipmapLevel(),h=e.state;h.setBlending(W),h.buffers.color.setClear(1,1,1,1),h.buffers.depth.setTest(!0),h.setScissorTest(!1);for(var f=_!==B&&this.type===B,p=_===B&&this.type!==B,v=0,m=t.length;v<m;v++){var g=t[v],M=g.shadow;if(void 0!==M){if(!1!==M.autoUpdate||!1!==M.needsUpdate){a.copy(M.mapSize);var b=M.getFrameExtents();if(a.multiply(b),o.copy(M.mapSize),(a.x>d||a.y>d)&&(a.x>d&&(o.x=Math.floor(d/b.x),a.x=o.x*b.x,M.mapSize.x=o.x),a.y>d&&(o.y=Math.floor(d/b.y),a.y=o.y*b.y,M.mapSize.y=o.y)),null===M.map||!0===f||!0===p){var w=this.type!==B?{minFilter:Fe,magFilter:Fe}:{};null!==M.map&&M.map.dispose(),M.map=new Hr(a.x,a.y,w),M.map.texture.name=g.name+".shadowMap",M.camera.updateProjectionMatrix()}e.setRenderTarget(M.map),e.clear();for(var T=M.getViewportCount(),E=0;E<T;E++){var A=M.getViewport(E);s.set(o.x*A.x,o.y*A.y,o.x*A.z,o.y*A.w),h.viewport(s),M.updateMatrices(g,E),i=M.getFrustum(),S(n,r,M.camera,g,this.type)}!0!==M.isPointLightShadow&&this.type===B&&x(M,r),M.needsUpdate=!1}}else console.warn("THREE.WebGLShadowMap:",g,"has no shadow.")}_=this.type,y.needsUpdate=!1,e.setRenderTarget(u,l,c)}}}function Zu(e,t,n){var r,i,a=n.isWebGL2;var o=new function(){var t=!1,n=new Br,r=null,i=new Br(0,0,0,0);return{setMask:function(n){r===n||t||(e.colorMask(n,n,n,n),r=n)},setLocked:function(e){t=e},setClear:function(t,r,a,o,s){!0===s&&(t*=o,r*=o,a*=o),n.set(t,r,a,o),!1===i.equals(n)&&(e.clearColor(t,r,a,o),i.copy(n))},reset:function(){t=!1,r=null,i.set(-1,0,0,0)}}},s=new function(){var t=!1,n=null,r=null,i=null;return{setTest:function(t){t?we(e.DEPTH_TEST):Te(e.DEPTH_TEST)},setMask:function(r){n===r||t||(e.depthMask(r),n=r)},setFunc:function(t){if(r!==t){switch(t){case de:e.depthFunc(e.NEVER);break;case fe:e.depthFunc(e.ALWAYS);break;case pe:e.depthFunc(e.LESS);break;case ve:e.depthFunc(e.LEQUAL);break;case me:e.depthFunc(e.EQUAL);break;case ge:e.depthFunc(e.GEQUAL);break;case ye:e.depthFunc(e.GREATER);break;case _e:e.depthFunc(e.NOTEQUAL);break;default:e.depthFunc(e.LEQUAL)}r=t}},setLocked:function(e){t=e},setClear:function(t){i!==t&&(e.clearDepth(t),i=t)},reset:function(){t=!1,n=null,r=null,i=null}}},u=new function(){var t=!1,n=null,r=null,i=null,a=null,o=null,s=null,u=null,l=null;return{setTest:function(n){t||(n?we(e.STENCIL_TEST):Te(e.STENCIL_TEST))},setMask:function(r){n===r||t||(e.stencilMask(r),n=r)},setFunc:function(t,n,o){r===t&&i===n&&a===o||(e.stencilFunc(t,n,o),r=t,i=n,a=o)},setOp:function(t,n,r){o===t&&s===n&&u===r||(e.stencilOp(t,n,r),o=t,s=n,u=r)},setLocked:function(e){t=e},setClear:function(t){l!==t&&(e.clearStencil(t),l=t)},reset:function(){t=!1,n=null,r=null,i=null,a=null,o=null,s=null,u=null,l=null}}},c=new WeakMap,h=new WeakMap,d={},f={},p=new WeakMap,v=[],m=null,g=!1,y=null,_=null,x=null,M=null,S=null,b=null,w=null,T=!1,E=null,A=null,R=null,k=null,C=null,L=e.getParameter(e.MAX_COMBINED_TEXTURE_IMAGE_UNITS),U=!1,O=0,N=e.getParameter(e.VERSION);-1!==N.indexOf("WebGL")?(O=parseFloat(/^WebGL (\d)/.exec(N)[1]),U=O>=1):-1!==N.indexOf("OpenGL ES")&&(O=parseFloat(/^OpenGL ES (\d)/.exec(N)[1]),U=O>=2);var F=null,B={},z=e.getParameter(e.SCISSOR_BOX),V=e.getParameter(e.VIEWPORT),xe=(new Br).fromArray(z),Me=(new Br).fromArray(V);function Se(t,n,r,i){var o=new Uint8Array(4),s=e.createTexture();e.bindTexture(t,s),e.texParameteri(t,e.TEXTURE_MIN_FILTER,e.NEAREST),e.texParameteri(t,e.TEXTURE_MAG_FILTER,e.NEAREST);for(var u=0;u<r;u++)!a||t!==e.TEXTURE_3D&&t!==e.TEXTURE_2D_ARRAY?e.texImage2D(n+u,0,e.RGBA,1,1,0,e.RGBA,e.UNSIGNED_BYTE,o):e.texImage3D(n,0,e.RGBA,1,1,i,0,e.RGBA,e.UNSIGNED_BYTE,o);return s}var be={};function we(t){!0!==d[t]&&(e.enable(t),d[t]=!0)}function Te(t){!1!==d[t]&&(e.disable(t),d[t]=!1)}be[e.TEXTURE_2D]=Se(e.TEXTURE_2D,e.TEXTURE_2D,1),be[e.TEXTURE_CUBE_MAP]=Se(e.TEXTURE_CUBE_MAP,e.TEXTURE_CUBE_MAP_POSITIVE_X,6),a&&(be[e.TEXTURE_2D_ARRAY]=Se(e.TEXTURE_2D_ARRAY,e.TEXTURE_2D_ARRAY,1,1),be[e.TEXTURE_3D]=Se(e.TEXTURE_3D,e.TEXTURE_3D,1,1)),o.setClear(0,0,0,1),s.setClear(1),u.setClear(0),we(e.DEPTH_TEST),s.setFunc(ve),Ce(!1),Le(I),we(e.CULL_FACE),ke(W);var Ee=(l(r={},K,e.FUNC_ADD),l(r,J,e.FUNC_SUBTRACT),l(r,Q,e.FUNC_REVERSE_SUBTRACT),r);if(a)Ee[$]=e.MIN,Ee[ee]=e.MAX;else{var Ae=t.get("EXT_blend_minmax");null!==Ae&&(Ee[$]=Ae.MIN_EXT,Ee[ee]=Ae.MAX_EXT)}var Re=(l(i={},te,e.ZERO),l(i,ne,e.ONE),l(i,re,e.SRC_COLOR),l(i,ae,e.SRC_ALPHA),l(i,he,e.SRC_ALPHA_SATURATE),l(i,le,e.DST_COLOR),l(i,se,e.DST_ALPHA),l(i,ie,e.ONE_MINUS_SRC_COLOR),l(i,oe,e.ONE_MINUS_SRC_ALPHA),l(i,ce,e.ONE_MINUS_DST_COLOR),l(i,ue,e.ONE_MINUS_DST_ALPHA),i);function ke(t,n,r,i,a,o,s,u){if(t!==W){if(!1===g&&(we(e.BLEND),g=!0),t===Z)a=a||n,o=o||r,s=s||i,n===_&&a===S||(e.blendEquationSeparate(Ee[n],Ee[a]),_=n,S=a),r===x&&i===M&&o===b&&s===w||(e.blendFuncSeparate(Re[r],Re[i],Re[o],Re[s]),x=r,M=i,b=o,w=s),y=t,T=!1;else if(t!==y||u!==T){if(_===K&&S===K||(e.blendEquation(e.FUNC_ADD),_=K,S=K),u)switch(t){case j:e.blendFuncSeparate(e.ONE,e.ONE_MINUS_SRC_ALPHA,e.ONE,e.ONE_MINUS_SRC_ALPHA);break;case X:e.blendFunc(e.ONE,e.ONE);break;case q:e.blendFuncSeparate(e.ZERO,e.ONE_MINUS_SRC_COLOR,e.ZERO,e.ONE);break;case Y:e.blendFuncSeparate(e.ZERO,e.SRC_COLOR,e.ZERO,e.SRC_ALPHA);break;default:console.error("THREE.WebGLState: Invalid blending: ",t)}else switch(t){case j:e.blendFuncSeparate(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA,e.ONE,e.ONE_MINUS_SRC_ALPHA);break;case X:e.blendFunc(e.SRC_ALPHA,e.ONE);break;case q:e.blendFuncSeparate(e.ZERO,e.ONE_MINUS_SRC_COLOR,e.ZERO,e.ONE);break;case Y:e.blendFunc(e.ZERO,e.SRC_COLOR);break;default:console.error("THREE.WebGLState: Invalid blending: ",t)}x=null,M=null,b=null,w=null,y=t,T=u}}else!0===g&&(Te(e.BLEND),g=!1)}function Ce(t){E!==t&&(t?e.frontFace(e.CW):e.frontFace(e.CCW),E=t)}function Le(t){t!==P?(we(e.CULL_FACE),t!==A&&(t===I?e.cullFace(e.BACK):t===D?e.cullFace(e.FRONT):e.cullFace(e.FRONT_AND_BACK))):Te(e.CULL_FACE),A=t}function Pe(t,n,r){t?(we(e.POLYGON_OFFSET_FILL),k===n&&C===r||(e.polygonOffset(n,r),k=n,C=r)):Te(e.POLYGON_OFFSET_FILL)}return{buffers:{color:o,depth:s,stencil:u},enable:we,disable:Te,bindFramebuffer:function(t,n){return f[t]!==n&&(e.bindFramebuffer(t,n),f[t]=n,a&&(t===e.DRAW_FRAMEBUFFER&&(f[e.FRAMEBUFFER]=n),t===e.FRAMEBUFFER&&(f[e.DRAW_FRAMEBUFFER]=n)),!0)},drawBuffers:function(r,i){var a=v,o=!1;if(r)if(void 0===(a=p.get(i))&&(a=[],p.set(i,a)),r.isWebGLMultipleRenderTargets){var s=r.texture;if(a.length!==s.length||a[0]!==e.COLOR_ATTACHMENT0){for(var u=0,l=s.length;u<l;u++)a[u]=e.COLOR_ATTACHMENT0+u;a.length=s.length,o=!0}}else a[0]!==e.COLOR_ATTACHMENT0&&(a[0]=e.COLOR_ATTACHMENT0,o=!0);else a[0]!==e.BACK&&(a[0]=e.BACK,o=!0);o&&(n.isWebGL2?e.drawBuffers(a):t.get("WEBGL_draw_buffers").drawBuffersWEBGL(a))},useProgram:function(t){return m!==t&&(e.useProgram(t),m=t,!0)},setBlending:ke,setMaterial:function(t,n){t.side===G?Te(e.CULL_FACE):we(e.CULL_FACE);var r=t.side===H;n&&(r=!r),Ce(r),t.blending===j&&!1===t.transparent?ke(W):ke(t.blending,t.blendEquation,t.blendSrc,t.blendDst,t.blendEquationAlpha,t.blendSrcAlpha,t.blendDstAlpha,t.premultipliedAlpha),s.setFunc(t.depthFunc),s.setTest(t.depthTest),s.setMask(t.depthWrite),o.setMask(t.colorWrite);var i=t.stencilWrite;u.setTest(i),i&&(u.setMask(t.stencilWriteMask),u.setFunc(t.stencilFunc,t.stencilRef,t.stencilFuncMask),u.setOp(t.stencilFail,t.stencilZFail,t.stencilZPass)),Pe(t.polygonOffset,t.polygonOffsetFactor,t.polygonOffsetUnits),!0===t.alphaToCoverage?we(e.SAMPLE_ALPHA_TO_COVERAGE):Te(e.SAMPLE_ALPHA_TO_COVERAGE)},setFlipSided:Ce,setCullFace:Le,setLineWidth:function(t){t!==R&&(U&&e.lineWidth(t),R=t)},setPolygonOffset:Pe,setScissorTest:function(t){t?we(e.SCISSOR_TEST):Te(e.SCISSOR_TEST)},activeTexture:function(t){void 0===t&&(t=e.TEXTURE0+L-1),F!==t&&(e.activeTexture(t),F=t)},bindTexture:function(t,n,r){void 0===r&&(r=null===F?e.TEXTURE0+L-1:F);var i=B[r];void 0===i&&(i={type:void 0,texture:void 0},B[r]=i),i.type===t&&i.texture===n||(F!==r&&(e.activeTexture(r),F=r),e.bindTexture(t,n||be[t]),i.type=t,i.texture=n)},unbindTexture:function(){var t=B[F];void 0!==t&&void 0!==t.type&&(e.bindTexture(t.type,null),t.type=void 0,t.texture=void 0)},compressedTexImage2D:function(){try{e.compressedTexImage2D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},compressedTexImage3D:function(){try{e.compressedTexImage3D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},texImage2D:function(){try{e.texImage2D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},texImage3D:function(){try{e.texImage3D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},updateUBOMapping:function(t,n){var r=h.get(n);void 0===r&&(r=new WeakMap,h.set(n,r));var i=r.get(t);void 0===i&&(i=e.getUniformBlockIndex(n,t.name),r.set(t,i))},uniformBlockBinding:function(t,n){var r=h.get(n).get(t);c.get(n)!==r&&(e.uniformBlockBinding(n,r,t.__bindingPointIndex),c.set(n,r))},texStorage2D:function(){try{e.texStorage2D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},texStorage3D:function(){try{e.texStorage3D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},texSubImage2D:function(){try{e.texSubImage2D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},texSubImage3D:function(){try{e.texSubImage3D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},compressedTexSubImage2D:function(){try{e.compressedTexSubImage2D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},compressedTexSubImage3D:function(){try{e.compressedTexSubImage3D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},scissor:function(t){!1===xe.equals(t)&&(e.scissor(t.x,t.y,t.z,t.w),xe.copy(t))},viewport:function(t){!1===Me.equals(t)&&(e.viewport(t.x,t.y,t.z,t.w),Me.copy(t))},reset:function(){e.disable(e.BLEND),e.disable(e.CULL_FACE),e.disable(e.DEPTH_TEST),e.disable(e.POLYGON_OFFSET_FILL),e.disable(e.SCISSOR_TEST),e.disable(e.STENCIL_TEST),e.disable(e.SAMPLE_ALPHA_TO_COVERAGE),e.blendEquation(e.FUNC_ADD),e.blendFunc(e.ONE,e.ZERO),e.blendFuncSeparate(e.ONE,e.ZERO,e.ONE,e.ZERO),e.colorMask(!0,!0,!0,!0),e.clearColor(0,0,0,0),e.depthMask(!0),e.depthFunc(e.LESS),e.clearDepth(1),e.stencilMask(4294967295),e.stencilFunc(e.ALWAYS,0,4294967295),e.stencilOp(e.KEEP,e.KEEP,e.KEEP),e.clearStencil(0),e.cullFace(e.BACK),e.frontFace(e.CCW),e.polygonOffset(0,0),e.activeTexture(e.TEXTURE0),e.bindFramebuffer(e.FRAMEBUFFER,null),!0===a&&(e.bindFramebuffer(e.DRAW_FRAMEBUFFER,null),e.bindFramebuffer(e.READ_FRAMEBUFFER,null)),e.useProgram(null),e.lineWidth(1),e.scissor(0,0,e.canvas.width,e.canvas.height),e.viewport(0,0,e.canvas.width,e.canvas.height),d={},F=null,B={},f={},p=new WeakMap,v=[],m=null,g=!1,y=null,_=null,x=null,M=null,S=null,b=null,w=null,T=!1,E=null,A=null,R=null,k=null,C=null,xe.set(0,0,e.canvas.width,e.canvas.height),Me.set(0,0,e.canvas.width,e.canvas.height),o.reset(),s.reset(),u.reset()}}}function Ku(e,t,n,r,i,a,o){var s,u,c,h,d=i.isWebGL2,f=i.maxTextures,p=i.maxCubemapSize,v=i.maxTextureSize,m=i.maxSamples,g=t.has("WEBGL_multisampled_render_to_texture")?t.get("WEBGL_multisampled_render_to_texture"):null,y="undefined"!=typeof navigator&&/OculusBrowser/g.test(navigator.userAgent),_=new WeakMap,x=new WeakMap,M=!1;try{M="undefined"!=typeof OffscreenCanvas&&null!==new OffscreenCanvas(1,1).getContext("2d")}catch(e){}function S(e,t){return M?new OffscreenCanvas(e,t):Sr("canvas")}function b(e,t,n,r){var i=1;if((e.width>r||e.height>r)&&(i=r/Math.max(e.width,e.height)),i<1||!0===t){if("undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap){var a=t?dr:Math.floor,o=a(i*e.width),s=a(i*e.height);void 0===h&&(h=S(o,s));var u=n?S(o,s):h;return u.width=o,u.height=s,u.getContext("2d").drawImage(e,0,0,o,s),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+e.width+"x"+e.height+") to ("+o+"x"+s+")."),u}return"data"in e&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+e.width+"x"+e.height+")."),e}return e}function w(e){return cr(e.width)&&cr(e.height)}function T(e,t){return e.generateMipmaps&&t&&e.minFilter!==Fe&&e.minFilter!==Ve}function E(t){e.generateMipmap(t)}function A(n,r,i,a){var o=arguments.length>4&&void 0!==arguments[4]&&arguments[4];if(!1===d)return r;if(null!==n){if(void 0!==e[n])return e[n];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+n+"'")}var s=r;return r===e.RED&&(i===e.FLOAT&&(s=e.R32F),i===e.HALF_FLOAT&&(s=e.R16F),i===e.UNSIGNED_BYTE&&(s=e.R8)),r===e.RED_INTEGER&&(i===e.UNSIGNED_BYTE&&(s=e.R8UI),i===e.UNSIGNED_SHORT&&(s=e.R16UI),i===e.UNSIGNED_INT&&(s=e.R32UI),i===e.BYTE&&(s=e.R8I),i===e.SHORT&&(s=e.R16I),i===e.INT&&(s=e.R32I)),r===e.RG&&(i===e.FLOAT&&(s=e.RG32F),i===e.HALF_FLOAT&&(s=e.RG16F),i===e.UNSIGNED_BYTE&&(s=e.RG8)),r===e.RGBA&&(i===e.FLOAT&&(s=e.RGBA32F),i===e.HALF_FLOAT&&(s=e.RGBA16F),i===e.UNSIGNED_BYTE&&(s=a===pn&&!1===o?e.SRGB8_ALPHA8:e.RGBA8),i===e.UNSIGNED_SHORT_4_4_4_4&&(s=e.RGBA4),i===e.UNSIGNED_SHORT_5_5_5_1&&(s=e.RGB5_A1)),s!==e.R16F&&s!==e.R32F&&s!==e.RG16F&&s!==e.RG32F&&s!==e.RGBA16F&&s!==e.RGBA32F||t.get("EXT_color_buffer_float"),s}function R(e,t,n){return!0===T(e,n)||e.isFramebufferTexture&&e.minFilter!==Fe&&e.minFilter!==Ve?Math.log2(Math.max(t.width,t.height))+1:void 0!==e.mipmaps&&e.mipmaps.length>0?e.mipmaps.length:e.isCompressedTexture&&Array.isArray(e.image)?t.mipmaps.length:1}function k(t){return t===Fe||t===Be||t===He?e.NEAREST:e.LINEAR}function C(e){var t=e.target;t.removeEventListener("dispose",C),function(e){var t=r.get(e);if(void 0===t.__webglInit)return;var n=e.source,i=x.get(n);if(i){var a=i[t.__cacheKey];a.usedTimes--,0===a.usedTimes&&P(e),0===Object.keys(i).length&&x.delete(n)}r.remove(e)}(t),t.isVideoTexture&&_.delete(t)}function L(t){var n=t.target;n.removeEventListener("dispose",L),function(t){var n=t.texture,i=r.get(t),a=r.get(n);void 0!==a.__webglTexture&&(e.deleteTexture(a.__webglTexture),o.memory.textures--);t.depthTexture&&t.depthTexture.dispose();if(t.isWebGLCubeRenderTarget)for(var s=0;s<6;s++){if(Array.isArray(i.__webglFramebuffer[s]))for(var u=0;u<i.__webglFramebuffer[s].length;u++)e.deleteFramebuffer(i.__webglFramebuffer[s][u]);else e.deleteFramebuffer(i.__webglFramebuffer[s]);i.__webglDepthbuffer&&e.deleteRenderbuffer(i.__webglDepthbuffer[s])}else{if(Array.isArray(i.__webglFramebuffer))for(var l=0;l<i.__webglFramebuffer.length;l++)e.deleteFramebuffer(i.__webglFramebuffer[l]);else e.deleteFramebuffer(i.__webglFramebuffer);if(i.__webglDepthbuffer&&e.deleteRenderbuffer(i.__webglDepthbuffer),i.__webglMultisampledFramebuffer&&e.deleteFramebuffer(i.__webglMultisampledFramebuffer),i.__webglColorRenderbuffer)for(var c=0;c<i.__webglColorRenderbuffer.length;c++)i.__webglColorRenderbuffer[c]&&e.deleteRenderbuffer(i.__webglColorRenderbuffer[c]);i.__webglDepthRenderbuffer&&e.deleteRenderbuffer(i.__webglDepthRenderbuffer)}if(t.isWebGLMultipleRenderTargets)for(var h=0,d=n.length;h<d;h++){var f=r.get(n[h]);f.__webglTexture&&(e.deleteTexture(f.__webglTexture),o.memory.textures--),r.remove(n[h])}r.remove(n),r.remove(t)}(n)}function P(t){var n=r.get(t);e.deleteTexture(n.__webglTexture);var i=t.source;delete x.get(i)[n.__cacheKey],o.memory.textures--}var I=0;function D(t,i){var a=r.get(t);if(t.isVideoTexture&&function(e){var t=o.render.frame;_.get(e)!==t&&(_.set(e,t),e.update())}(t),!1===t.isRenderTargetTexture&&t.version>0&&a.__version!==t.version){var s=t.image;if(null===s)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else{if(!1!==s.complete)return void z(a,t,i);console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete")}}n.bindTexture(e.TEXTURE_2D,a.__webglTexture,e.TEXTURE0+i)}var U=(l(s={},Ue,e.REPEAT),l(s,Oe,e.CLAMP_TO_EDGE),l(s,Ne,e.MIRRORED_REPEAT),s),O=(l(u={},Fe,e.NEAREST),l(u,Be,e.NEAREST_MIPMAP_NEAREST),l(u,He,e.NEAREST_MIPMAP_LINEAR),l(u,Ve,e.LINEAR),l(u,We,e.LINEAR_MIPMAP_NEAREST),l(u,Xe,e.LINEAR_MIPMAP_LINEAR),u),N=(l(c={},In,e.NEVER),l(c,zn,e.ALWAYS),l(c,Dn,e.LESS),l(c,On,e.LEQUAL),l(c,Un,e.EQUAL),l(c,Bn,e.GEQUAL),l(c,Nn,e.GREATER),l(c,Fn,e.NOTEQUAL),c);function F(n,a,o){if(o?(e.texParameteri(n,e.TEXTURE_WRAP_S,U[a.wrapS]),e.texParameteri(n,e.TEXTURE_WRAP_T,U[a.wrapT]),n!==e.TEXTURE_3D&&n!==e.TEXTURE_2D_ARRAY||e.texParameteri(n,e.TEXTURE_WRAP_R,U[a.wrapR]),e.texParameteri(n,e.TEXTURE_MAG_FILTER,O[a.magFilter]),e.texParameteri(n,e.TEXTURE_MIN_FILTER,O[a.minFilter])):(e.texParameteri(n,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(n,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),n!==e.TEXTURE_3D&&n!==e.TEXTURE_2D_ARRAY||e.texParameteri(n,e.TEXTURE_WRAP_R,e.CLAMP_TO_EDGE),a.wrapS===Oe&&a.wrapT===Oe||console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),e.texParameteri(n,e.TEXTURE_MAG_FILTER,k(a.magFilter)),e.texParameteri(n,e.TEXTURE_MIN_FILTER,k(a.minFilter)),a.minFilter!==Fe&&a.minFilter!==Ve&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.")),a.compareFunction&&(e.texParameteri(n,e.TEXTURE_COMPARE_MODE,e.COMPARE_REF_TO_TEXTURE),e.texParameteri(n,e.TEXTURE_COMPARE_FUNC,N[a.compareFunction])),!0===t.has("EXT_texture_filter_anisotropic")){var s=t.get("EXT_texture_filter_anisotropic");if(a.magFilter===Fe)return;if(a.minFilter!==He&&a.minFilter!==Xe)return;if(a.type===et&&!1===t.has("OES_texture_float_linear"))return;if(!1===d&&a.type===tt&&!1===t.has("OES_texture_half_float_linear"))return;(a.anisotropy>1||r.get(a).__currentAnisotropy)&&(e.texParameterf(n,s.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(a.anisotropy,i.getMaxAnisotropy())),r.get(a).__currentAnisotropy=a.anisotropy)}}function B(t,n){var r=!1;void 0===t.__webglInit&&(t.__webglInit=!0,n.addEventListener("dispose",C));var i=n.source,a=x.get(i);void 0===a&&(a={},x.set(i,a));var s=function(e){var t=[];return t.push(e.wrapS),t.push(e.wrapT),t.push(e.wrapR||0),t.push(e.magFilter),t.push(e.minFilter),t.push(e.anisotropy),t.push(e.internalFormat),t.push(e.format),t.push(e.type),t.push(e.generateMipmaps),t.push(e.premultiplyAlpha),t.push(e.flipY),t.push(e.unpackAlignment),t.push(e.colorSpace),t.join()}(n);if(s!==t.__cacheKey){void 0===a[s]&&(a[s]={texture:e.createTexture(),usedTimes:0},o.memory.textures++,r=!0),a[s].usedTimes++;var u=a[t.__cacheKey];void 0!==u&&(a[t.__cacheKey].usedTimes--,0===u.usedTimes&&P(n)),t.__cacheKey=s,t.__webglTexture=a[s].texture}return r}function z(t,i,o){var s=e.TEXTURE_2D;(i.isDataArrayTexture||i.isCompressedArrayTexture)&&(s=e.TEXTURE_2D_ARRAY),i.isData3DTexture&&(s=e.TEXTURE_3D);var u=B(t,i),l=i.source;n.bindTexture(s,t.__webglTexture,e.TEXTURE0+o);var c=r.get(l);if(l.version!==c.__version||!0===u){n.activeTexture(e.TEXTURE0+o),e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,i.flipY),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,i.premultiplyAlpha),e.pixelStorei(e.UNPACK_ALIGNMENT,i.unpackAlignment),e.pixelStorei(e.UNPACK_COLORSPACE_CONVERSION_WEBGL,e.NONE);var h,f=function(e){return!d&&(e.wrapS!==Oe||e.wrapT!==Oe||e.minFilter!==Fe&&e.minFilter!==Ve)}(i)&&!1===w(i.image),p=b(i.image,f,!1,v),m=w(p=X(i,p))||d,g=a.convert(i.format,i.colorSpace),y=a.convert(i.type),_=A(i.internalFormat,g,y,i.colorSpace);F(s,i,m);var x=i.mipmaps,M=d&&!0!==i.isVideoTexture,S=void 0===c.__version||!0===u,k=R(i,p,m);if(i.isDepthTexture)_=e.DEPTH_COMPONENT,d?_=i.type===et?e.DEPTH_COMPONENT32F:i.type===$e?e.DEPTH_COMPONENT24:i.type===it?e.DEPTH24_STENCIL8:e.DEPTH_COMPONENT16:i.type===et&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),i.format===lt&&_===e.DEPTH_COMPONENT&&i.type!==Je&&i.type!==$e&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),i.type=$e,y=a.convert(i.type)),i.format===ct&&_===e.DEPTH_COMPONENT&&(_=e.DEPTH_STENCIL,i.type!==it&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),i.type=it,y=a.convert(i.type))),S&&(M?n.texStorage2D(e.TEXTURE_2D,1,_,p.width,p.height):n.texImage2D(e.TEXTURE_2D,0,_,p.width,p.height,0,g,y,null));else if(i.isDataTexture)if(x.length>0&&m){M&&S&&n.texStorage2D(e.TEXTURE_2D,k,_,x[0].width,x[0].height);for(var C=0,L=x.length;C<L;C++)h=x[C],M?n.texSubImage2D(e.TEXTURE_2D,C,0,0,h.width,h.height,g,y,h.data):n.texImage2D(e.TEXTURE_2D,C,_,h.width,h.height,0,g,y,h.data);i.generateMipmaps=!1}else M?(S&&n.texStorage2D(e.TEXTURE_2D,k,_,p.width,p.height),n.texSubImage2D(e.TEXTURE_2D,0,0,0,p.width,p.height,g,y,p.data)):n.texImage2D(e.TEXTURE_2D,0,_,p.width,p.height,0,g,y,p.data);else if(i.isCompressedTexture)if(i.isCompressedArrayTexture){M&&S&&n.texStorage3D(e.TEXTURE_2D_ARRAY,k,_,x[0].width,x[0].height,p.depth);for(var P=0,I=x.length;P<I;P++)h=x[P],i.format!==ot?null!==g?M?n.compressedTexSubImage3D(e.TEXTURE_2D_ARRAY,P,0,0,0,h.width,h.height,p.depth,g,h.data,0,0):n.compressedTexImage3D(e.TEXTURE_2D_ARRAY,P,_,h.width,h.height,p.depth,0,h.data,0,0):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):M?n.texSubImage3D(e.TEXTURE_2D_ARRAY,P,0,0,0,h.width,h.height,p.depth,g,y,h.data):n.texImage3D(e.TEXTURE_2D_ARRAY,P,_,h.width,h.height,p.depth,0,g,y,h.data)}else{M&&S&&n.texStorage2D(e.TEXTURE_2D,k,_,x[0].width,x[0].height);for(var D=0,U=x.length;D<U;D++)h=x[D],i.format!==ot?null!==g?M?n.compressedTexSubImage2D(e.TEXTURE_2D,D,0,0,h.width,h.height,g,h.data):n.compressedTexImage2D(e.TEXTURE_2D,D,_,h.width,h.height,0,h.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):M?n.texSubImage2D(e.TEXTURE_2D,D,0,0,h.width,h.height,g,y,h.data):n.texImage2D(e.TEXTURE_2D,D,_,h.width,h.height,0,g,y,h.data)}else if(i.isDataArrayTexture)M?(S&&n.texStorage3D(e.TEXTURE_2D_ARRAY,k,_,p.width,p.height,p.depth),n.texSubImage3D(e.TEXTURE_2D_ARRAY,0,0,0,0,p.width,p.height,p.depth,g,y,p.data)):n.texImage3D(e.TEXTURE_2D_ARRAY,0,_,p.width,p.height,p.depth,0,g,y,p.data);else if(i.isData3DTexture)M?(S&&n.texStorage3D(e.TEXTURE_3D,k,_,p.width,p.height,p.depth),n.texSubImage3D(e.TEXTURE_3D,0,0,0,0,p.width,p.height,p.depth,g,y,p.data)):n.texImage3D(e.TEXTURE_3D,0,_,p.width,p.height,p.depth,0,g,y,p.data);else if(i.isFramebufferTexture){if(S)if(M)n.texStorage2D(e.TEXTURE_2D,k,_,p.width,p.height);else for(var O=p.width,N=p.height,z=0;z<k;z++)n.texImage2D(e.TEXTURE_2D,z,_,O,N,0,g,y,null),O>>=1,N>>=1}else if(x.length>0&&m){M&&S&&n.texStorage2D(e.TEXTURE_2D,k,_,x[0].width,x[0].height);for(var H=0,G=x.length;H<G;H++)h=x[H],M?n.texSubImage2D(e.TEXTURE_2D,H,0,0,g,y,h):n.texImage2D(e.TEXTURE_2D,H,_,g,y,h);i.generateMipmaps=!1}else M?(S&&n.texStorage2D(e.TEXTURE_2D,k,_,p.width,p.height),n.texSubImage2D(e.TEXTURE_2D,0,0,0,g,y,p)):n.texImage2D(e.TEXTURE_2D,0,_,g,y,p);T(i,m)&&E(s),c.__version=l.version,i.onUpdate&&i.onUpdate(i)}t.__version=i.version}function H(t,i,o,s,u,l){var c=a.convert(o.format,o.colorSpace),h=a.convert(o.type),d=A(o.internalFormat,c,h,o.colorSpace);if(!r.get(i).__hasExternalTextures){var f=Math.max(1,i.width>>l),p=Math.max(1,i.height>>l);u===e.TEXTURE_3D||u===e.TEXTURE_2D_ARRAY?n.texImage3D(u,l,d,f,p,i.depth,0,c,h,null):n.texImage2D(u,l,d,f,p,0,c,h,null)}n.bindFramebuffer(e.FRAMEBUFFER,t),j(i)?g.framebufferTexture2DMultisampleEXT(e.FRAMEBUFFER,s,u,r.get(o).__webglTexture,0,W(i)):(u===e.TEXTURE_2D||u>=e.TEXTURE_CUBE_MAP_POSITIVE_X&&u<=e.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&e.framebufferTexture2D(e.FRAMEBUFFER,s,u,r.get(o).__webglTexture,l),n.bindFramebuffer(e.FRAMEBUFFER,null)}function G(t,n,r){if(e.bindRenderbuffer(e.RENDERBUFFER,t),n.depthBuffer&&!n.stencilBuffer){var i=e.DEPTH_COMPONENT16;if(r||j(n)){var o=n.depthTexture;o&&o.isDepthTexture&&(o.type===et?i=e.DEPTH_COMPONENT32F:o.type===$e&&(i=e.DEPTH_COMPONENT24));var s=W(n);j(n)?g.renderbufferStorageMultisampleEXT(e.RENDERBUFFER,s,i,n.width,n.height):e.renderbufferStorageMultisample(e.RENDERBUFFER,s,i,n.width,n.height)}else e.renderbufferStorage(e.RENDERBUFFER,i,n.width,n.height);e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.RENDERBUFFER,t)}else if(n.depthBuffer&&n.stencilBuffer){var u=W(n);r&&!1===j(n)?e.renderbufferStorageMultisample(e.RENDERBUFFER,u,e.DEPTH24_STENCIL8,n.width,n.height):j(n)?g.renderbufferStorageMultisampleEXT(e.RENDERBUFFER,u,e.DEPTH24_STENCIL8,n.width,n.height):e.renderbufferStorage(e.RENDERBUFFER,e.DEPTH_STENCIL,n.width,n.height),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_STENCIL_ATTACHMENT,e.RENDERBUFFER,t)}else for(var l=!0===n.isWebGLMultipleRenderTargets?n.texture:[n.texture],c=0;c<l.length;c++){var h=l[c],d=a.convert(h.format,h.colorSpace),f=a.convert(h.type),p=A(h.internalFormat,d,f,h.colorSpace),v=W(n);r&&!1===j(n)?e.renderbufferStorageMultisample(e.RENDERBUFFER,v,p,n.width,n.height):j(n)?g.renderbufferStorageMultisampleEXT(e.RENDERBUFFER,v,p,n.width,n.height):e.renderbufferStorage(e.RENDERBUFFER,p,n.width,n.height)}e.bindRenderbuffer(e.RENDERBUFFER,null)}function V(t){var i=r.get(t),a=!0===t.isWebGLCubeRenderTarget;if(t.depthTexture&&!i.__autoAllocateDepthBuffer){if(a)throw new Error("target.depthTexture not supported in Cube render targets");!function(t,i){if(i&&i.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(n.bindFramebuffer(e.FRAMEBUFFER,t),!i.depthTexture||!i.depthTexture.isDepthTexture)throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");r.get(i.depthTexture).__webglTexture&&i.depthTexture.image.width===i.width&&i.depthTexture.image.height===i.height||(i.depthTexture.image.width=i.width,i.depthTexture.image.height=i.height,i.depthTexture.needsUpdate=!0),D(i.depthTexture,0);var a=r.get(i.depthTexture).__webglTexture,o=W(i);if(i.depthTexture.format===lt)j(i)?g.framebufferTexture2DMultisampleEXT(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.TEXTURE_2D,a,0,o):e.framebufferTexture2D(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.TEXTURE_2D,a,0);else{if(i.depthTexture.format!==ct)throw new Error("Unknown depthTexture format");j(i)?g.framebufferTexture2DMultisampleEXT(e.FRAMEBUFFER,e.DEPTH_STENCIL_ATTACHMENT,e.TEXTURE_2D,a,0,o):e.framebufferTexture2D(e.FRAMEBUFFER,e.DEPTH_STENCIL_ATTACHMENT,e.TEXTURE_2D,a,0)}}(i.__webglFramebuffer,t)}else if(a){i.__webglDepthbuffer=[];for(var o=0;o<6;o++)n.bindFramebuffer(e.FRAMEBUFFER,i.__webglFramebuffer[o]),i.__webglDepthbuffer[o]=e.createRenderbuffer(),G(i.__webglDepthbuffer[o],t,!1)}else n.bindFramebuffer(e.FRAMEBUFFER,i.__webglFramebuffer),i.__webglDepthbuffer=e.createRenderbuffer(),G(i.__webglDepthbuffer,t,!1);n.bindFramebuffer(e.FRAMEBUFFER,null)}function W(e){return Math.min(m,e.samples)}function j(e){var n=r.get(e);return d&&e.samples>0&&!0===t.has("WEBGL_multisampled_render_to_texture")&&!1!==n.__useRenderToTexture}function X(e,n){var r=e.colorSpace,i=e.format,a=e.type;return!0===e.isCompressedTexture||e.format===Qn||r!==vn&&r!==fn&&(r===pn?!1===d?!0===t.has("EXT_sRGB")&&i===ot?(e.format=Qn,e.minFilter=Ve,e.generateMipmaps=!1):n=Ir.sRGBToLinear(n):i===ot&&a===Ye||console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",r)),n}this.allocateTextureUnit=function(){var e=I;return e>=f&&console.warn("THREE.WebGLTextures: Trying to use "+e+" texture units while this GPU supports only "+f),I+=1,e},this.resetTextureUnits=function(){I=0},this.setTexture2D=D,this.setTexture2DArray=function(t,i){var a=r.get(t);t.version>0&&a.__version!==t.version?z(a,t,i):n.bindTexture(e.TEXTURE_2D_ARRAY,a.__webglTexture,e.TEXTURE0+i)},this.setTexture3D=function(t,i){var a=r.get(t);t.version>0&&a.__version!==t.version?z(a,t,i):n.bindTexture(e.TEXTURE_3D,a.__webglTexture,e.TEXTURE0+i)},this.setTextureCube=function(t,i){var o=r.get(t);t.version>0&&o.__version!==t.version?function(t,i,o){if(6!==i.image.length)return;var s=B(t,i),u=i.source;n.bindTexture(e.TEXTURE_CUBE_MAP,t.__webglTexture,e.TEXTURE0+o);var l=r.get(u);if(u.version!==l.__version||!0===s){n.activeTexture(e.TEXTURE0+o),e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,i.flipY),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,i.premultiplyAlpha),e.pixelStorei(e.UNPACK_ALIGNMENT,i.unpackAlignment),e.pixelStorei(e.UNPACK_COLORSPACE_CONVERSION_WEBGL,e.NONE);for(var c=i.isCompressedTexture||i.image[0].isCompressedTexture,h=i.image[0]&&i.image[0].isDataTexture,f=[],v=0;v<6;v++)f[v]=c||h?h?i.image[v].image:i.image[v]:b(i.image[v],!1,!0,p),f[v]=X(i,f[v]);var m,g=f[0],y=w(g)||d,_=a.convert(i.format,i.colorSpace),x=a.convert(i.type),M=A(i.internalFormat,_,x,i.colorSpace),S=d&&!0!==i.isVideoTexture,k=void 0===l.__version||!0===s,C=R(i,g,y);if(F(e.TEXTURE_CUBE_MAP,i,y),c){S&&k&&n.texStorage2D(e.TEXTURE_CUBE_MAP,C,M,g.width,g.height);for(var L=0;L<6;L++){m=f[L].mipmaps;for(var P=0;P<m.length;P++){var I=m[P];i.format!==ot?null!==_?S?n.compressedTexSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+L,P,0,0,I.width,I.height,_,I.data):n.compressedTexImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+L,P,M,I.width,I.height,0,I.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):S?n.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+L,P,0,0,I.width,I.height,_,x,I.data):n.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+L,P,M,I.width,I.height,0,_,x,I.data)}}}else{m=i.mipmaps,S&&k&&(m.length>0&&C++,n.texStorage2D(e.TEXTURE_CUBE_MAP,C,M,f[0].width,f[0].height));for(var D=0;D<6;D++)if(h){S?n.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+D,0,0,0,f[D].width,f[D].height,_,x,f[D].data):n.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+D,0,M,f[D].width,f[D].height,0,_,x,f[D].data);for(var U=0;U<m.length;U++){var O=m[U].image[D].image;S?n.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+D,U+1,0,0,O.width,O.height,_,x,O.data):n.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+D,U+1,M,O.width,O.height,0,_,x,O.data)}}else{S?n.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+D,0,0,0,_,x,f[D]):n.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+D,0,M,_,x,f[D]);for(var N=0;N<m.length;N++){var z=m[N];S?n.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+D,N+1,0,0,_,x,z.image[D]):n.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+D,N+1,M,_,x,z.image[D])}}}T(i,y)&&E(e.TEXTURE_CUBE_MAP),l.__version=u.version,i.onUpdate&&i.onUpdate(i)}t.__version=i.version}(o,t,i):n.bindTexture(e.TEXTURE_CUBE_MAP,o.__webglTexture,e.TEXTURE0+i)},this.rebindTextures=function(t,n,i){var a=r.get(t);void 0!==n&&H(a.__webglFramebuffer,t,t.texture,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,0),void 0!==i&&V(t)},this.setupRenderTarget=function(t){var s=t.texture,u=r.get(t),l=r.get(s);t.addEventListener("dispose",L),!0!==t.isWebGLMultipleRenderTargets&&(void 0===l.__webglTexture&&(l.__webglTexture=e.createTexture()),l.__version=s.version,o.memory.textures++);var c=!0===t.isWebGLCubeRenderTarget,h=!0===t.isWebGLMultipleRenderTargets,f=w(t)||d;if(c){u.__webglFramebuffer=[];for(var p=0;p<6;p++)if(d&&s.mipmaps&&s.mipmaps.length>0){u.__webglFramebuffer[p]=[];for(var v=0;v<s.mipmaps.length;v++)u.__webglFramebuffer[p][v]=e.createFramebuffer()}else u.__webglFramebuffer[p]=e.createFramebuffer()}else{if(d&&s.mipmaps&&s.mipmaps.length>0){u.__webglFramebuffer=[];for(var m=0;m<s.mipmaps.length;m++)u.__webglFramebuffer[m]=e.createFramebuffer()}else u.__webglFramebuffer=e.createFramebuffer();if(h)if(i.drawBuffers)for(var g=t.texture,y=0,_=g.length;y<_;y++){var x=r.get(g[y]);void 0===x.__webglTexture&&(x.__webglTexture=e.createTexture(),o.memory.textures++)}else console.warn("THREE.WebGLRenderer: WebGLMultipleRenderTargets can only be used with WebGL2 or WEBGL_draw_buffers extension.");if(d&&t.samples>0&&!1===j(t)){var M=h?s:[s];u.__webglMultisampledFramebuffer=e.createFramebuffer(),u.__webglColorRenderbuffer=[],n.bindFramebuffer(e.FRAMEBUFFER,u.__webglMultisampledFramebuffer);for(var S=0;S<M.length;S++){var b=M[S];u.__webglColorRenderbuffer[S]=e.createRenderbuffer(),e.bindRenderbuffer(e.RENDERBUFFER,u.__webglColorRenderbuffer[S]);var R=a.convert(b.format,b.colorSpace),k=a.convert(b.type),C=A(b.internalFormat,R,k,b.colorSpace,!0===t.isXRRenderTarget),P=W(t);e.renderbufferStorageMultisample(e.RENDERBUFFER,P,C,t.width,t.height),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0+S,e.RENDERBUFFER,u.__webglColorRenderbuffer[S])}e.bindRenderbuffer(e.RENDERBUFFER,null),t.depthBuffer&&(u.__webglDepthRenderbuffer=e.createRenderbuffer(),G(u.__webglDepthRenderbuffer,t,!0)),n.bindFramebuffer(e.FRAMEBUFFER,null)}}if(c){n.bindTexture(e.TEXTURE_CUBE_MAP,l.__webglTexture),F(e.TEXTURE_CUBE_MAP,s,f);for(var I=0;I<6;I++)if(d&&s.mipmaps&&s.mipmaps.length>0)for(var D=0;D<s.mipmaps.length;D++)H(u.__webglFramebuffer[I][D],t,s,e.COLOR_ATTACHMENT0,e.TEXTURE_CUBE_MAP_POSITIVE_X+I,D);else H(u.__webglFramebuffer[I],t,s,e.COLOR_ATTACHMENT0,e.TEXTURE_CUBE_MAP_POSITIVE_X+I,0);T(s,f)&&E(e.TEXTURE_CUBE_MAP),n.unbindTexture()}else if(h){for(var U=t.texture,O=0,N=U.length;O<N;O++){var B=U[O],z=r.get(B);n.bindTexture(e.TEXTURE_2D,z.__webglTexture),F(e.TEXTURE_2D,B,f),H(u.__webglFramebuffer,t,B,e.COLOR_ATTACHMENT0+O,e.TEXTURE_2D,0),T(B,f)&&E(e.TEXTURE_2D)}n.unbindTexture()}else{var X=e.TEXTURE_2D;if((t.isWebGL3DRenderTarget||t.isWebGLArrayRenderTarget)&&(d?X=t.isWebGL3DRenderTarget?e.TEXTURE_3D:e.TEXTURE_2D_ARRAY:console.error("THREE.WebGLTextures: THREE.Data3DTexture and THREE.DataArrayTexture only supported with WebGL2.")),n.bindTexture(X,l.__webglTexture),F(X,s,f),d&&s.mipmaps&&s.mipmaps.length>0)for(var q=0;q<s.mipmaps.length;q++)H(u.__webglFramebuffer[q],t,s,e.COLOR_ATTACHMENT0,X,q);else H(u.__webglFramebuffer,t,s,e.COLOR_ATTACHMENT0,X,0);T(s,f)&&E(X),n.unbindTexture()}t.depthBuffer&&V(t)},this.updateRenderTargetMipmap=function(t){for(var i=w(t)||d,a=!0===t.isWebGLMultipleRenderTargets?t.texture:[t.texture],o=0,s=a.length;o<s;o++){var u=a[o];if(T(u,i)){var l=t.isWebGLCubeRenderTarget?e.TEXTURE_CUBE_MAP:e.TEXTURE_2D,c=r.get(u).__webglTexture;n.bindTexture(l,c),E(l),n.unbindTexture()}}},this.updateMultisampleRenderTarget=function(t){if(d&&t.samples>0&&!1===j(t)){var i=t.isWebGLMultipleRenderTargets?t.texture:[t.texture],a=t.width,o=t.height,s=e.COLOR_BUFFER_BIT,u=[],l=t.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,c=r.get(t),h=!0===t.isWebGLMultipleRenderTargets;if(h)for(var f=0;f<i.length;f++)n.bindFramebuffer(e.FRAMEBUFFER,c.__webglMultisampledFramebuffer),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0+f,e.RENDERBUFFER,null),n.bindFramebuffer(e.FRAMEBUFFER,c.__webglFramebuffer),e.framebufferTexture2D(e.DRAW_FRAMEBUFFER,e.COLOR_ATTACHMENT0+f,e.TEXTURE_2D,null,0);n.bindFramebuffer(e.READ_FRAMEBUFFER,c.__webglMultisampledFramebuffer),n.bindFramebuffer(e.DRAW_FRAMEBUFFER,c.__webglFramebuffer);for(var p=0;p<i.length;p++){u.push(e.COLOR_ATTACHMENT0+p),t.depthBuffer&&u.push(l);var v=void 0!==c.__ignoreDepthValues&&c.__ignoreDepthValues;if(!1===v&&(t.depthBuffer&&(s|=e.DEPTH_BUFFER_BIT),t.stencilBuffer&&(s|=e.STENCIL_BUFFER_BIT)),h&&e.framebufferRenderbuffer(e.READ_FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.RENDERBUFFER,c.__webglColorRenderbuffer[p]),!0===v&&(e.invalidateFramebuffer(e.READ_FRAMEBUFFER,[l]),e.invalidateFramebuffer(e.DRAW_FRAMEBUFFER,[l])),h){var m=r.get(i[p]).__webglTexture;e.framebufferTexture2D(e.DRAW_FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,m,0)}e.blitFramebuffer(0,0,a,o,0,0,a,o,s,e.NEAREST),y&&e.invalidateFramebuffer(e.READ_FRAMEBUFFER,u)}if(n.bindFramebuffer(e.READ_FRAMEBUFFER,null),n.bindFramebuffer(e.DRAW_FRAMEBUFFER,null),h)for(var g=0;g<i.length;g++){n.bindFramebuffer(e.FRAMEBUFFER,c.__webglMultisampledFramebuffer),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0+g,e.RENDERBUFFER,c.__webglColorRenderbuffer[g]);var _=r.get(i[g]).__webglTexture;n.bindFramebuffer(e.FRAMEBUFFER,c.__webglFramebuffer),e.framebufferTexture2D(e.DRAW_FRAMEBUFFER,e.COLOR_ATTACHMENT0+g,e.TEXTURE_2D,_,0)}n.bindFramebuffer(e.DRAW_FRAMEBUFFER,c.__webglMultisampledFramebuffer)}},this.setupDepthRenderbuffer=V,this.setupFrameBufferTexture=H,this.useMultisampledRTT=j}function Ju(e,t,n){var r=n.isWebGL2;return{convert:function(n){var i,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:fn;if(n===Ye)return e.UNSIGNED_BYTE;if(n===nt)return e.UNSIGNED_SHORT_4_4_4_4;if(n===rt)return e.UNSIGNED_SHORT_5_5_5_1;if(n===Ze)return e.BYTE;if(n===Ke)return e.SHORT;if(n===Je)return e.UNSIGNED_SHORT;if(n===Qe)return e.INT;if(n===$e)return e.UNSIGNED_INT;if(n===et)return e.FLOAT;if(n===tt)return r?e.HALF_FLOAT:null!==(i=t.get("OES_texture_half_float"))?i.HALF_FLOAT_OES:null;if(n===at)return e.ALPHA;if(n===ot)return e.RGBA;if(n===st)return e.LUMINANCE;if(n===ut)return e.LUMINANCE_ALPHA;if(n===lt)return e.DEPTH_COMPONENT;if(n===ct)return e.DEPTH_STENCIL;if(n===Qn)return null!==(i=t.get("EXT_sRGB"))?i.SRGB_ALPHA_EXT:null;if(n===ht)return e.RED;if(n===dt)return e.RED_INTEGER;if(n===ft)return e.RG;if(n===pt)return e.RG_INTEGER;if(n===vt)return e.RGBA_INTEGER;if(n===mt||n===gt||n===yt||n===_t)if(a===pn){if(null===(i=t.get("WEBGL_compressed_texture_s3tc_srgb")))return null;if(n===mt)return i.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(n===gt)return i.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(n===yt)return i.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(n===_t)return i.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else{if(null===(i=t.get("WEBGL_compressed_texture_s3tc")))return null;if(n===mt)return i.COMPRESSED_RGB_S3TC_DXT1_EXT;if(n===gt)return i.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(n===yt)return i.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(n===_t)return i.COMPRESSED_RGBA_S3TC_DXT5_EXT}if(n===xt||n===Mt||n===St||n===bt){if(null===(i=t.get("WEBGL_compressed_texture_pvrtc")))return null;if(n===xt)return i.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(n===Mt)return i.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(n===St)return i.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(n===bt)return i.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(n===wt)return null!==(i=t.get("WEBGL_compressed_texture_etc1"))?i.COMPRESSED_RGB_ETC1_WEBGL:null;if(n===Tt||n===Et){if(null===(i=t.get("WEBGL_compressed_texture_etc")))return null;if(n===Tt)return a===pn?i.COMPRESSED_SRGB8_ETC2:i.COMPRESSED_RGB8_ETC2;if(n===Et)return a===pn?i.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:i.COMPRESSED_RGBA8_ETC2_EAC}if(n===At||n===Rt||n===kt||n===Ct||n===Lt||n===Pt||n===It||n===Dt||n===Ut||n===Ot||n===Nt||n===Ft||n===Bt||n===zt){if(null===(i=t.get("WEBGL_compressed_texture_astc")))return null;if(n===At)return a===pn?i.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:i.COMPRESSED_RGBA_ASTC_4x4_KHR;if(n===Rt)return a===pn?i.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:i.COMPRESSED_RGBA_ASTC_5x4_KHR;if(n===kt)return a===pn?i.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:i.COMPRESSED_RGBA_ASTC_5x5_KHR;if(n===Ct)return a===pn?i.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:i.COMPRESSED_RGBA_ASTC_6x5_KHR;if(n===Lt)return a===pn?i.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:i.COMPRESSED_RGBA_ASTC_6x6_KHR;if(n===Pt)return a===pn?i.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:i.COMPRESSED_RGBA_ASTC_8x5_KHR;if(n===It)return a===pn?i.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:i.COMPRESSED_RGBA_ASTC_8x6_KHR;if(n===Dt)return a===pn?i.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:i.COMPRESSED_RGBA_ASTC_8x8_KHR;if(n===Ut)return a===pn?i.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:i.COMPRESSED_RGBA_ASTC_10x5_KHR;if(n===Ot)return a===pn?i.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:i.COMPRESSED_RGBA_ASTC_10x6_KHR;if(n===Nt)return a===pn?i.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:i.COMPRESSED_RGBA_ASTC_10x8_KHR;if(n===Ft)return a===pn?i.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:i.COMPRESSED_RGBA_ASTC_10x10_KHR;if(n===Bt)return a===pn?i.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:i.COMPRESSED_RGBA_ASTC_12x10_KHR;if(n===zt)return a===pn?i.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:i.COMPRESSED_RGBA_ASTC_12x12_KHR}if(n===Ht){if(null===(i=t.get("EXT_texture_compression_bptc")))return null;if(n===Ht)return a===pn?i.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:i.COMPRESSED_RGBA_BPTC_UNORM_EXT}if(n===Gt||n===Vt||n===Wt||n===jt){if(null===(i=t.get("EXT_texture_compression_rgtc")))return null;if(n===Ht)return i.COMPRESSED_RED_RGTC1_EXT;if(n===Vt)return i.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(n===Wt)return i.COMPRESSED_RED_GREEN_RGTC2_EXT;if(n===jt)return i.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}return n===it?r?e.UNSIGNED_INT_24_8:null!==(i=t.get("WEBGL_depth_texture"))?i.UNSIGNED_INT_24_8_WEBGL:null:void 0!==e[n]?e[n]:null}}}var Qu=function(e){w(n,e);var t=E(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return a(this,n),(e=t.call(this)).isArrayCamera=!0,e.cameras=r,e}return s(n)}(mo),$u=function(e){w(n,e);var t=E(n);function n(){var e;return a(this,n),(e=t.call(this)).isGroup=!0,e.type="Group",e}return s(n)}(Zi),el={type:"move"},tl=function(){function e(){a(this,e),this._targetRay=null,this._grip=null,this._hand=null}return s(e,[{key:"getHandSpace",value:function(){return null===this._hand&&(this._hand=new $u,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}},{key:"getTargetRaySpace",value:function(){return null===this._targetRay&&(this._targetRay=new $u,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new Yr,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new Yr),this._targetRay}},{key:"getGripSpace",value:function(){return null===this._grip&&(this._grip=new $u,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new Yr,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new Yr),this._grip}},{key:"dispatchEvent",value:function(e){return null!==this._targetRay&&this._targetRay.dispatchEvent(e),null!==this._grip&&this._grip.dispatchEvent(e),null!==this._hand&&this._hand.dispatchEvent(e),this}},{key:"connect",value:function(e){if(e&&e.hand){var t=this._hand;if(t){var n,r=v(e.hand.values());try{for(r.s();!(n=r.n()).done;){var i=n.value;this._getHandJoint(t,i)}}catch(e){r.e(e)}finally{r.f()}}}return this.dispatchEvent({type:"connected",data:e}),this}},{key:"disconnect",value:function(e){return this.dispatchEvent({type:"disconnected",data:e}),null!==this._targetRay&&(this._targetRay.visible=!1),null!==this._grip&&(this._grip.visible=!1),null!==this._hand&&(this._hand.visible=!1),this}},{key:"update",value:function(e,t,n){var r=null,i=null,a=null,o=this._targetRay,s=this._grip,u=this._hand;if(e&&"visible-blurred"!==t.session.visibilityState){if(u&&e.hand){a=!0;var l,c=v(e.hand.values());try{for(c.s();!(l=c.n()).done;){var h=l.value,d=t.getJointPose(h,n),f=this._getHandJoint(u,h);null!==d&&(f.matrix.fromArray(d.transform.matrix),f.matrix.decompose(f.position,f.rotation,f.scale),f.matrixWorldNeedsUpdate=!0,f.jointRadius=d.radius),f.visible=null!==d}}catch(e){c.e(e)}finally{c.f()}var p=u.joints["index-finger-tip"],m=u.joints["thumb-tip"],g=p.position.distanceTo(m.position);u.inputState.pinching&&g>.025?(u.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!u.inputState.pinching&&g<=.015&&(u.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else null!==s&&e.gripSpace&&null!==(i=t.getPose(e.gripSpace,n))&&(s.matrix.fromArray(i.transform.matrix),s.matrix.decompose(s.position,s.rotation,s.scale),s.matrixWorldNeedsUpdate=!0,i.linearVelocity?(s.hasLinearVelocity=!0,s.linearVelocity.copy(i.linearVelocity)):s.hasLinearVelocity=!1,i.angularVelocity?(s.hasAngularVelocity=!0,s.angularVelocity.copy(i.angularVelocity)):s.hasAngularVelocity=!1);null!==o&&(null===(r=t.getPose(e.targetRaySpace,n))&&null!==i&&(r=i),null!==r&&(o.matrix.fromArray(r.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),o.matrixWorldNeedsUpdate=!0,r.linearVelocity?(o.hasLinearVelocity=!0,o.linearVelocity.copy(r.linearVelocity)):o.hasLinearVelocity=!1,r.angularVelocity?(o.hasAngularVelocity=!0,o.angularVelocity.copy(r.angularVelocity)):o.hasAngularVelocity=!1,this.dispatchEvent(el)))}return null!==o&&(o.visible=null!==r),null!==s&&(s.visible=null!==i),null!==u&&(u.visible=null!==a),this}},{key:"_getHandJoint",value:function(e,t){if(void 0===e.joints[t.jointName]){var n=new $u;n.matrixAutoUpdate=!1,n.visible=!1,e.joints[t.jointName]=n,e.add(n)}return e.joints[t.jointName]}}]),e}(),nl=function(e){w(n,e);var t=E(n);function n(e,r,i,o,s,u,l,c,h,d){var f;if(a(this,n),(d=void 0!==d?d:lt)!==lt&&d!==ct)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");return void 0===i&&d===lt&&(i=$e),void 0===i&&d===ct&&(i=it),(f=t.call(this,null,o,s,u,l,c,d,i,h)).isDepthTexture=!0,f.image={width:e,height:r},f.magFilter=void 0!==l?l:Fe,f.minFilter=void 0!==c?c:Fe,f.flipY=!1,f.generateMipmaps=!1,f.compareFunction=null,f}return s(n,[{key:"copy",value:function(e){return y(x(n.prototype),"copy",this).call(this,e),this.compareFunction=e.compareFunction,this}},{key:"toJSON",value:function(e){var t=y(x(n.prototype),"toJSON",this).call(this,e);return null!==this.compareFunction&&(t.compareFunction=this.compareFunction),t}}]),n}(Fr),rl=function(e){w(n,e);var t=E(n);function n(e,r){var i;a(this,n),i=t.call(this);var o=S(i),s=null,u=1,l=null,c="local-floor",h=1,d=null,f=null,v=null,m=null,g=null,y=null,_=r.getContextAttributes(),x=null,M=null,b=[],w=[],T=new mo;T.layers.enable(1),T.viewport=new Br;var E=new mo;E.layers.enable(2),E.viewport=new Br;var A=[T,E],k=new Qu;k.layers.enable(1),k.layers.enable(2);var C=null,L=null;function P(e){var t=w.indexOf(e.inputSource);if(-1!==t){var n=b[t];void 0!==n&&(n.update(e.inputSource,e.frame,d||l),n.dispatchEvent({type:e.type,data:e.inputSource}))}}function I(){s.removeEventListener("select",P),s.removeEventListener("selectstart",P),s.removeEventListener("selectend",P),s.removeEventListener("squeeze",P),s.removeEventListener("squeezestart",P),s.removeEventListener("squeezeend",P),s.removeEventListener("end",I),s.removeEventListener("inputsourceschange",D);for(var t=0;t<b.length;t++){var n=w[t];null!==n&&(w[t]=null,b[t].disconnect(n))}C=null,L=null,e.setRenderTarget(x),g=null,m=null,v=null,s=null,M=null,B.stop(),o.isPresenting=!1,o.dispatchEvent({type:"sessionend"})}function D(e){for(var t=0;t<e.removed.length;t++){var n=e.removed[t],r=w.indexOf(n);r>=0&&(w[r]=null,b[r].disconnect(n))}for(var i=0;i<e.added.length;i++){var a=e.added[i],o=w.indexOf(a);if(-1===o){for(var s=0;s<b.length;s++){if(s>=w.length){w.push(a),o=s;break}if(null===w[s]){w[s]=a,o=s;break}}if(-1===o)break}var u=b[o];u&&u.connect(a)}}i.cameraAutoUpdate=!0,i.enabled=!1,i.isPresenting=!1,i.getController=function(e){var t=b[e];return void 0===t&&(t=new tl,b[e]=t),t.getTargetRaySpace()},i.getControllerGrip=function(e){var t=b[e];return void 0===t&&(t=new tl,b[e]=t),t.getGripSpace()},i.getHand=function(e){var t=b[e];return void 0===t&&(t=new tl,b[e]=t),t.getHandSpace()},i.setFramebufferScaleFactor=function(e){u=e,!0===o.isPresenting&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},i.setReferenceSpaceType=function(e){c=e,!0===o.isPresenting&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},i.getReferenceSpace=function(){return d||l},i.setReferenceSpace=function(e){d=e},i.getBaseLayer=function(){return null!==m?m:g},i.getBinding=function(){return v},i.getFrame=function(){return y},i.getSession=function(){return s},i.setSession=function(){var t=p(R().mark((function t(n){var i,a,f,p,y;return R().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(null===(s=n)){t.next=25;break}if(x=e.getRenderTarget(),s.addEventListener("select",P),s.addEventListener("selectstart",P),s.addEventListener("selectend",P),s.addEventListener("squeeze",P),s.addEventListener("squeezestart",P),s.addEventListener("squeezeend",P),s.addEventListener("end",I),s.addEventListener("inputsourceschange",D),!0===_.xrCompatible){t.next=14;break}return t.next=14,r.makeXRCompatible();case 14:return void 0===s.renderState.layers||!1===e.capabilities.isWebGL2?(i={antialias:void 0!==s.renderState.layers||_.antialias,alpha:!0,depth:_.depth,stencil:_.stencil,framebufferScaleFactor:u},g=new XRWebGLLayer(s,r,i),s.updateRenderState({baseLayer:g}),M=new Hr(g.framebufferWidth,g.framebufferHeight,{format:ot,type:Ye,colorSpace:e.outputColorSpace,stencilBuffer:_.stencil})):(a=null,f=null,p=null,_.depth&&(p=_.stencil?r.DEPTH24_STENCIL8:r.DEPTH_COMPONENT24,a=_.stencil?ct:lt,f=_.stencil?it:$e),y={colorFormat:r.RGBA8,depthFormat:p,scaleFactor:u},v=new XRWebGLBinding(s,r),m=v.createProjectionLayer(y),s.updateRenderState({layers:[m]}),M=new Hr(m.textureWidth,m.textureHeight,{format:ot,type:Ye,depthTexture:new nl(m.textureWidth,m.textureHeight,f,void 0,void 0,void 0,void 0,void 0,void 0,a),stencilBuffer:_.stencil,colorSpace:e.outputColorSpace,samples:_.antialias?4:0}),e.properties.get(M).__ignoreDepthValues=m.ignoreDepthValues),M.isXRRenderTarget=!0,this.setFoveation(h),d=null,t.next=20,s.requestReferenceSpace(c);case 20:l=t.sent,B.setContext(s),B.start(),o.isPresenting=!0,o.dispatchEvent({type:"sessionstart"});case 25:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),i.getEnvironmentBlendMode=function(){if(null!==s)return s.environmentBlendMode};var U=new Yr,O=new Yr;function N(e,t){null===t?e.matrixWorld.copy(e.matrix):e.matrixWorld.multiplyMatrices(t.matrixWorld,e.matrix),e.matrixWorldInverse.copy(e.matrixWorld).invert()}i.updateCamera=function(e){if(null!==s){k.near=E.near=T.near=e.near,k.far=E.far=T.far=e.far,C===k.near&&L===k.far||(s.updateRenderState({depthNear:k.near,depthFar:k.far}),C=k.near,L=k.far);var t=e.parent,n=k.cameras;N(k,t);for(var r=0;r<n.length;r++)N(n[r],t);2===n.length?function(e,t,n){U.setFromMatrixPosition(t.matrixWorld),O.setFromMatrixPosition(n.matrixWorld);var r=U.distanceTo(O),i=t.projectionMatrix.elements,a=n.projectionMatrix.elements,o=i[14]/(i[10]-1),s=i[14]/(i[10]+1),u=(i[9]+1)/i[5],l=(i[9]-1)/i[5],c=(i[8]-1)/i[0],h=(a[8]+1)/a[0],d=o*c,f=o*h,p=r/(-c+h),v=p*-c;t.matrixWorld.decompose(e.position,e.quaternion,e.scale),e.translateX(v),e.translateZ(p),e.matrixWorld.compose(e.position,e.quaternion,e.scale),e.matrixWorldInverse.copy(e.matrixWorld).invert();var m=o+p,g=s+p,y=d-v,_=f+(r-v),x=u*s/g*m,M=l*s/g*m;e.projectionMatrix.makePerspective(y,_,x,M,m,g),e.projectionMatrixInverse.copy(e.projectionMatrix).invert()}(k,T,E):k.projectionMatrix.copy(T.projectionMatrix),function(e,t,n){null===n?e.matrix.copy(t.matrixWorld):(e.matrix.copy(n.matrixWorld),e.matrix.invert(),e.matrix.multiply(t.matrixWorld));e.matrix.decompose(e.position,e.quaternion,e.scale),e.updateMatrixWorld(!0);for(var r=e.children,i=0,a=r.length;i<a;i++)r[i].updateMatrixWorld(!0);e.projectionMatrix.copy(t.projectionMatrix),e.projectionMatrixInverse.copy(t.projectionMatrixInverse),e.isPerspectiveCamera&&(e.fov=2*ar*Math.atan(1/e.projectionMatrix.elements[5]),e.zoom=1)}(e,k,t)}},i.getCamera=function(){return k},i.getFoveation=function(){if(null!==m||null!==g)return h},i.setFoveation=function(e){h=e,null!==m&&(m.fixedFoveation=e),null!==g&&void 0!==g.fixedFoveation&&(g.fixedFoveation=e)};var F=null;var B=new Ro;return B.setAnimationLoop((function(t,n){if(f=n.getViewerPose(d||l),y=n,null!==f){var r=f.views;null!==g&&(e.setRenderTargetFramebuffer(M,g.framebuffer),e.setRenderTarget(M));var i=!1;r.length!==k.cameras.length&&(k.cameras.length=0,i=!0);for(var a=0;a<r.length;a++){var s=r[a],u=null;if(null!==g)u=g.getViewport(s);else{var c=v.getViewSubImage(m,s);u=c.viewport,0===a&&(e.setRenderTargetTextures(M,c.colorTexture,m.ignoreDepthValues?void 0:c.depthStencilTexture),e.setRenderTarget(M))}var h=A[a];void 0===h&&((h=new mo).layers.enable(a),h.viewport=new Br,A[a]=h),h.matrix.fromArray(s.transform.matrix),h.matrix.decompose(h.position,h.quaternion,h.scale),h.projectionMatrix.fromArray(s.projectionMatrix),h.projectionMatrixInverse.copy(h.projectionMatrix).invert(),h.viewport.set(u.x,u.y,u.width,u.height),0===a&&(k.matrix.copy(h.matrix),k.matrix.decompose(k.position,k.quaternion,k.scale)),!0===i&&k.cameras.push(h)}}for(var p=0;p<b.length;p++){var _=w[p],x=b[p];null!==_&&void 0!==x&&x.update(_,n,d||l)}F&&F(t,n),n.detectedPlanes&&o.dispatchEvent({type:"planesdetected",data:n}),y=null})),i.setAnimationLoop=function(e){F=e},i.dispose=function(){},i}return s(n)}(tr);function il(e,t){function n(e,t){!0===e.matrixAutoUpdate&&e.updateMatrix(),t.value.copy(e.matrix)}function r(r,i){r.opacity.value=i.opacity,i.color&&r.diffuse.value.copy(i.color),i.emissive&&r.emissive.value.copy(i.emissive).multiplyScalar(i.emissiveIntensity),i.map&&(r.map.value=i.map,n(i.map,r.mapTransform)),i.alphaMap&&(r.alphaMap.value=i.alphaMap,n(i.alphaMap,r.alphaMapTransform)),i.bumpMap&&(r.bumpMap.value=i.bumpMap,n(i.bumpMap,r.bumpMapTransform),r.bumpScale.value=i.bumpScale,i.side===H&&(r.bumpScale.value*=-1)),i.normalMap&&(r.normalMap.value=i.normalMap,n(i.normalMap,r.normalMapTransform),r.normalScale.value.copy(i.normalScale),i.side===H&&r.normalScale.value.negate()),i.displacementMap&&(r.displacementMap.value=i.displacementMap,n(i.displacementMap,r.displacementMapTransform),r.displacementScale.value=i.displacementScale,r.displacementBias.value=i.displacementBias),i.emissiveMap&&(r.emissiveMap.value=i.emissiveMap,n(i.emissiveMap,r.emissiveMapTransform)),i.specularMap&&(r.specularMap.value=i.specularMap,n(i.specularMap,r.specularMapTransform)),i.alphaTest>0&&(r.alphaTest.value=i.alphaTest);var a=t.get(i).envMap;if(a&&(r.envMap.value=a,r.flipEnvMap.value=a.isCubeTexture&&!1===a.isRenderTargetTexture?-1:1,r.reflectivity.value=i.reflectivity,r.ior.value=i.ior,r.refractionRatio.value=i.refractionRatio),i.lightMap){r.lightMap.value=i.lightMap;var o=!0===e._useLegacyLights?Math.PI:1;r.lightMapIntensity.value=i.lightMapIntensity*o,n(i.lightMap,r.lightMapTransform)}i.aoMap&&(r.aoMap.value=i.aoMap,r.aoMapIntensity.value=i.aoMapIntensity,n(i.aoMap,r.aoMapTransform))}return{refreshFogUniforms:function(t,n){n.color.getRGB(t.fogColor.value,ho(e)),n.isFog?(t.fogNear.value=n.near,t.fogFar.value=n.far):n.isFogExp2&&(t.fogDensity.value=n.density)},refreshMaterialUniforms:function(e,i,a,o,s){i.isMeshBasicMaterial||i.isMeshLambertMaterial?r(e,i):i.isMeshToonMaterial?(r(e,i),function(e,t){t.gradientMap&&(e.gradientMap.value=t.gradientMap)}(e,i)):i.isMeshPhongMaterial?(r(e,i),function(e,t){e.specular.value.copy(t.specular),e.shininess.value=Math.max(t.shininess,1e-4)}(e,i)):i.isMeshStandardMaterial?(r(e,i),function(e,r){e.metalness.value=r.metalness,r.metalnessMap&&(e.metalnessMap.value=r.metalnessMap,n(r.metalnessMap,e.metalnessMapTransform));e.roughness.value=r.roughness,r.roughnessMap&&(e.roughnessMap.value=r.roughnessMap,n(r.roughnessMap,e.roughnessMapTransform));var i=t.get(r).envMap;i&&(e.envMapIntensity.value=r.envMapIntensity)}(e,i),i.isMeshPhysicalMaterial&&function(e,t,r){e.ior.value=t.ior,t.sheen>0&&(e.sheenColor.value.copy(t.sheenColor).multiplyScalar(t.sheen),e.sheenRoughness.value=t.sheenRoughness,t.sheenColorMap&&(e.sheenColorMap.value=t.sheenColorMap,n(t.sheenColorMap,e.sheenColorMapTransform)),t.sheenRoughnessMap&&(e.sheenRoughnessMap.value=t.sheenRoughnessMap,n(t.sheenRoughnessMap,e.sheenRoughnessMapTransform)));t.clearcoat>0&&(e.clearcoat.value=t.clearcoat,e.clearcoatRoughness.value=t.clearcoatRoughness,t.clearcoatMap&&(e.clearcoatMap.value=t.clearcoatMap,n(t.clearcoatMap,e.clearcoatMapTransform)),t.clearcoatRoughnessMap&&(e.clearcoatRoughnessMap.value=t.clearcoatRoughnessMap,n(t.clearcoatRoughnessMap,e.clearcoatRoughnessMapTransform)),t.clearcoatNormalMap&&(e.clearcoatNormalMap.value=t.clearcoatNormalMap,n(t.clearcoatNormalMap,e.clearcoatNormalMapTransform),e.clearcoatNormalScale.value.copy(t.clearcoatNormalScale),t.side===H&&e.clearcoatNormalScale.value.negate()));t.iridescence>0&&(e.iridescence.value=t.iridescence,e.iridescenceIOR.value=t.iridescenceIOR,e.iridescenceThicknessMinimum.value=t.iridescenceThicknessRange[0],e.iridescenceThicknessMaximum.value=t.iridescenceThicknessRange[1],t.iridescenceMap&&(e.iridescenceMap.value=t.iridescenceMap,n(t.iridescenceMap,e.iridescenceMapTransform)),t.iridescenceThicknessMap&&(e.iridescenceThicknessMap.value=t.iridescenceThicknessMap,n(t.iridescenceThicknessMap,e.iridescenceThicknessMapTransform)));t.transmission>0&&(e.transmission.value=t.transmission,e.transmissionSamplerMap.value=r.texture,e.transmissionSamplerSize.value.set(r.width,r.height),t.transmissionMap&&(e.transmissionMap.value=t.transmissionMap,n(t.transmissionMap,e.transmissionMapTransform)),e.thickness.value=t.thickness,t.thicknessMap&&(e.thicknessMap.value=t.thicknessMap,n(t.thicknessMap,e.thicknessMapTransform)),e.attenuationDistance.value=t.attenuationDistance,e.attenuationColor.value.copy(t.attenuationColor));t.anisotropy>0&&(e.anisotropyVector.value.set(t.anisotropy*Math.cos(t.anisotropyRotation),t.anisotropy*Math.sin(t.anisotropyRotation)),t.anisotropyMap&&(e.anisotropyMap.value=t.anisotropyMap,n(t.anisotropyMap,e.anisotropyMapTransform)));e.specularIntensity.value=t.specularIntensity,e.specularColor.value.copy(t.specularColor),t.specularColorMap&&(e.specularColorMap.value=t.specularColorMap,n(t.specularColorMap,e.specularColorMapTransform));t.specularIntensityMap&&(e.specularIntensityMap.value=t.specularIntensityMap,n(t.specularIntensityMap,e.specularIntensityMapTransform))}(e,i,s)):i.isMeshMatcapMaterial?(r(e,i),function(e,t){t.matcap&&(e.matcap.value=t.matcap)}(e,i)):i.isMeshDepthMaterial?r(e,i):i.isMeshDistanceMaterial?(r(e,i),function(e,n){var r=t.get(n).light;e.referencePosition.value.setFromMatrixPosition(r.matrixWorld),e.nearDistance.value=r.shadow.camera.near,e.farDistance.value=r.shadow.camera.far}(e,i)):i.isMeshNormalMaterial?r(e,i):i.isLineBasicMaterial?(function(e,t){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity,t.map&&(e.map.value=t.map,n(t.map,e.mapTransform))}(e,i),i.isLineDashedMaterial&&function(e,t){e.dashSize.value=t.dashSize,e.totalSize.value=t.dashSize+t.gapSize,e.scale.value=t.scale}(e,i)):i.isPointsMaterial?function(e,t,r,i){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity,e.size.value=t.size*r,e.scale.value=.5*i,t.map&&(e.map.value=t.map,n(t.map,e.uvTransform));t.alphaMap&&(e.alphaMap.value=t.alphaMap,n(t.alphaMap,e.alphaMapTransform));t.alphaTest>0&&(e.alphaTest.value=t.alphaTest)}(e,i,a,o):i.isSpriteMaterial?function(e,t){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity,e.rotation.value=t.rotation,t.map&&(e.map.value=t.map,n(t.map,e.mapTransform));t.alphaMap&&(e.alphaMap.value=t.alphaMap,n(t.alphaMap,e.alphaMapTransform));t.alphaTest>0&&(e.alphaTest.value=t.alphaTest)}(e,i):i.isShadowMaterial?(e.color.value.copy(i.color),e.opacity.value=i.opacity):i.isShaderMaterial&&(i.uniformsNeedUpdate=!1)}}}function al(e,t,n,r){var i={},a={},o=[],s=n.isWebGL2?e.getParameter(e.MAX_UNIFORM_BUFFER_BINDINGS):0;function u(e,t,n){var r=e.value;if(void 0===n[t]){if("number"==typeof r)n[t]=r;else{for(var i=Array.isArray(r)?r:[r],a=[],o=0;o<i.length;o++)a.push(i[o].clone());n[t]=a}return!0}if("number"==typeof r){if(n[t]!==r)return n[t]=r,!0}else for(var s=Array.isArray(n[t])?n[t]:[n[t]],u=Array.isArray(r)?r:[r],l=0;l<s.length;l++){var c=s[l];if(!1===c.equals(u[l]))return c.copy(u[l]),!0}return!1}function l(e){var t={boundary:0,storage:0};return"number"==typeof e?(t.boundary=4,t.storage=4):e.isVector2?(t.boundary=8,t.storage=8):e.isVector3||e.isColor?(t.boundary=16,t.storage=12):e.isVector4?(t.boundary=16,t.storage=16):e.isMatrix3?(t.boundary=48,t.storage=48):e.isMatrix4?(t.boundary=64,t.storage=64):e.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",e),t}function c(t){var n=t.target;n.removeEventListener("dispose",c);var r=o.indexOf(n.__bindingPointIndex);o.splice(r,1),e.deleteBuffer(i[n.id]),delete i[n.id],delete a[n.id]}return{bind:function(e,t){var n=t.program;r.uniformBlockBinding(e,n)},update:function(n,h){var d=i[n.id];void 0===d&&(!function(e){for(var t=e.uniforms,n=0,r=16,i=0,a=0,o=t.length;a<o;a++){for(var s=t[a],u={boundary:0,storage:0},c=Array.isArray(s.value)?s.value:[s.value],h=0,d=c.length;h<d;h++){var f=l(c[h]);u.boundary+=f.boundary,u.storage+=f.storage}if(s.__data=new Float32Array(u.storage/Float32Array.BYTES_PER_ELEMENT),s.__offset=n,a>0)0!==(i=n%r)&&r-i-u.boundary<0&&(n+=r-i,s.__offset=n);n+=u.storage}(i=n%r)>0&&(n+=r-i);e.__size=n,e.__cache={}}(n),d=function(t){var n=function(){for(var e=0;e<s;e++)if(-1===o.indexOf(e))return o.push(e),e;return console.error("THREE.WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}();t.__bindingPointIndex=n;var r=e.createBuffer(),i=t.__size,a=t.usage;return e.bindBuffer(e.UNIFORM_BUFFER,r),e.bufferData(e.UNIFORM_BUFFER,i,a),e.bindBuffer(e.UNIFORM_BUFFER,null),e.bindBufferBase(e.UNIFORM_BUFFER,n,r),r}(n),i[n.id]=d,n.addEventListener("dispose",c));var f=h.program;r.updateUBOMapping(n,f);var p=t.render.frame;a[n.id]!==p&&(!function(t){var n=i[t.id],r=t.uniforms,a=t.__cache;e.bindBuffer(e.UNIFORM_BUFFER,n);for(var o=0,s=r.length;o<s;o++){var c=r[o];if(!0===u(c,o,a)){for(var h=c.__offset,d=Array.isArray(c.value)?c.value:[c.value],f=0,p=0;p<d.length;p++){var v=d[p],m=l(v);"number"==typeof v?(c.__data[0]=v,e.bufferSubData(e.UNIFORM_BUFFER,h+f,c.__data)):v.isMatrix3?(c.__data[0]=v.elements[0],c.__data[1]=v.elements[1],c.__data[2]=v.elements[2],c.__data[3]=v.elements[0],c.__data[4]=v.elements[3],c.__data[5]=v.elements[4],c.__data[6]=v.elements[5],c.__data[7]=v.elements[0],c.__data[8]=v.elements[6],c.__data[9]=v.elements[7],c.__data[10]=v.elements[8],c.__data[11]=v.elements[0]):(v.toArray(c.__data,f),f+=m.storage/Float32Array.BYTES_PER_ELEMENT)}e.bufferSubData(e.UNIFORM_BUFFER,h,c.__data)}}e.bindBuffer(e.UNIFORM_BUFFER,null)}(n),a[n.id]=p)},dispose:function(){for(var t in i)e.deleteBuffer(i[t]);o=[],i={},a={}}}}function ol(){var e=Sr("canvas");return e.style.display="block",e}var sl=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};a(this,e);var n,r=t.canvas,i=void 0===r?ol():r,o=t.context,s=void 0===o?null:o,u=t.depth,l=void 0===u||u,c=t.stencil,h=void 0===c||c,d=t.alpha,f=void 0!==d&&d,p=t.antialias,v=void 0!==p&&p,m=t.premultipliedAlpha,g=void 0===m||m,y=t.preserveDrawingBuffer,_=void 0!==y&&y,x=t.powerPreference,M=void 0===x?"default":x,S=t.failIfMajorPerformanceCaveat,b=void 0!==S&&S;this.isWebGLRenderer=!0,n=null!==s?s.getContextAttributes().alpha:f;var w=new Uint32Array(4),T=new Int32Array(4),E=null,A=null,R=[],C=[];this.domElement=i,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.outputColorSpace=pn,this._useLegacyLights=!1,this.toneMapping=be,this.toneMappingExposure=1;var L=this,P=!1,I=0,D=0,U=null,O=-1,N=null,F=new Br,B=new Br,V=null,W=new pa(0),j=0,X=i.width,q=i.height,Y=1,Z=null,K=null,J=new Br(0,0,X,q),Q=new Br(0,0,X,q),$=!1,ee=new Ao,te=!1,ne=!1,re=null,ie=new wi,ae=new mr,oe=new Yr,se={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function ue(){return null===U?Y:1}var le,ce,he,de,fe,pe,ve,me,ge,ye,_e,xe,Me,Se,we,Te,Ee,Ae,Re,ke,Ce,Le,Pe,Ie,De=s;function Ue(e,t){for(var n=0;n<e.length;n++){var r=e[n],a=i.getContext(r,t);if(null!==a)return a}return null}try{var Oe={alpha:!0,depth:l,stencil:h,antialias:v,premultipliedAlpha:g,preserveDrawingBuffer:_,powerPreference:M,failIfMajorPerformanceCaveat:b};if("setAttribute"in i&&i.setAttribute("data-engine","three.js r".concat(k)),i.addEventListener("webglcontextlost",ze,!1),i.addEventListener("webglcontextrestored",He,!1),i.addEventListener("webglcontextcreationerror",Ge,!1),null===De){var Ne=["webgl2","webgl","experimental-webgl"];if(!0===L.isWebGL1Renderer&&Ne.shift(),null===(De=Ue(Ne,Oe)))throw Ue(Ne)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}"undefined"!=typeof WebGLRenderingContext&&De instanceof WebGLRenderingContext&&console.warn("THREE.WebGLRenderer: WebGL 1 support was deprecated in r153 and will be removed in r163."),void 0===De.getShaderPrecisionFormat&&(De.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}})}catch(e){throw console.error("THREE.WebGLRenderer: "+e.message),e}function Fe(){le=new ns(De),ce=new Fo(De,le,t),le.init(ce),Le=new Ju(De,le,ce),he=new Zu(De,le,ce),de=new as(De),fe=new Uu,pe=new Ku(De,le,he,fe,ce,Le,de),ve=new zo(L),me=new ts(L),ge=new ko(De,ce),Pe=new Oo(De,le,ge,ce),ye=new rs(De,ge,de,Pe),_e=new ls(De,ye,ge,de),Re=new us(De,ce,pe),Te=new Bo(fe),xe=new Du(L,ve,me,le,ce,Pe,Te),Me=new il(L,fe),Se=new Bu,we=new ju(le,ce),Ae=new Uo(L,ve,me,he,_e,n,g),Ee=new Yu(L,_e,ce),Ie=new al(De,de,ce,he),ke=new No(De,le,de,ce),Ce=new is(De,le,de,ce),de.programs=xe.programs,L.capabilities=ce,L.extensions=le,L.properties=fe,L.renderLists=Se,L.shadowMap=Ee,L.state=he,L.info=de}Fe();var Be=new rl(L,De);function ze(e){e.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),P=!0}function He(){console.log("THREE.WebGLRenderer: Context Restored."),P=!1;var e=de.autoReset,t=Ee.enabled,n=Ee.autoUpdate,r=Ee.needsUpdate,i=Ee.type;Fe(),de.autoReset=e,Ee.enabled=t,Ee.autoUpdate=n,Ee.needsUpdate=r,Ee.type=i}function Ge(e){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",e.statusMessage)}function Ve(e){var t=e.target;t.removeEventListener("dispose",Ve),We(t)}function We(e){je(e),fe.remove(e)}function je(e){var t=fe.get(e).programs;void 0!==t&&(t.forEach((function(e){xe.releaseProgram(e)})),e.isShaderMaterial&&xe.releaseShaderCache(e))}this.xr=Be,this.getContext=function(){return De},this.getContextAttributes=function(){return De.getContextAttributes()},this.forceContextLoss=function(){var e=le.get("WEBGL_lose_context");e&&e.loseContext()},this.forceContextRestore=function(){var e=le.get("WEBGL_lose_context");e&&e.restoreContext()},this.getPixelRatio=function(){return Y},this.setPixelRatio=function(e){void 0!==e&&(Y=e,this.setSize(X,q,!1))},this.getSize=function(e){return e.set(X,q)},this.setSize=function(e,t){var n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];Be.isPresenting?console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting."):(X=e,q=t,i.width=Math.floor(e*Y),i.height=Math.floor(t*Y),!0===n&&(i.style.width=e+"px",i.style.height=t+"px"),this.setViewport(0,0,e,t))},this.getDrawingBufferSize=function(e){return e.set(X*Y,q*Y).floor()},this.setDrawingBufferSize=function(e,t,n){X=e,q=t,Y=n,i.width=Math.floor(e*n),i.height=Math.floor(t*n),this.setViewport(0,0,e,t)},this.getCurrentViewport=function(e){return e.copy(F)},this.getViewport=function(e){return e.copy(J)},this.setViewport=function(e,t,n,r){e.isVector4?J.set(e.x,e.y,e.z,e.w):J.set(e,t,n,r),he.viewport(F.copy(J).multiplyScalar(Y).floor())},this.getScissor=function(e){return e.copy(Q)},this.setScissor=function(e,t,n,r){e.isVector4?Q.set(e.x,e.y,e.z,e.w):Q.set(e,t,n,r),he.scissor(B.copy(Q).multiplyScalar(Y).floor())},this.getScissorTest=function(){return $},this.setScissorTest=function(e){he.setScissorTest($=e)},this.setOpaqueSort=function(e){Z=e},this.setTransparentSort=function(e){K=e},this.getClearColor=function(e){return e.copy(Ae.getClearColor())},this.setClearColor=function(){Ae.setClearColor.apply(Ae,arguments)},this.getClearAlpha=function(){return Ae.getClearAlpha()},this.setClearAlpha=function(){Ae.setClearAlpha.apply(Ae,arguments)},this.clear=function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],r=0;if(e){var i=!1;if(null!==U){var a=U.texture.format;i=a===vt||a===pt||a===dt}if(i){var o=U.texture.type,s=o===Ye||o===$e||o===Je||o===it||o===nt||o===rt,u=Ae.getClearColor(),l=Ae.getClearAlpha(),c=u.r,h=u.g,d=u.b;s?(w[0]=c,w[1]=h,w[2]=d,w[3]=l,De.clearBufferuiv(De.COLOR,0,w)):(T[0]=c,T[1]=h,T[2]=d,T[3]=l,De.clearBufferiv(De.COLOR,0,T))}else r|=De.COLOR_BUFFER_BIT}t&&(r|=De.DEPTH_BUFFER_BIT),n&&(r|=De.STENCIL_BUFFER_BIT),De.clear(r)},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.dispose=function(){i.removeEventListener("webglcontextlost",ze,!1),i.removeEventListener("webglcontextrestored",He,!1),i.removeEventListener("webglcontextcreationerror",Ge,!1),Se.dispose(),we.dispose(),fe.dispose(),ve.dispose(),me.dispose(),_e.dispose(),Pe.dispose(),Ie.dispose(),xe.dispose(),Be.dispose(),Be.removeEventListener("sessionstart",Ke),Be.removeEventListener("sessionend",Qe),re&&(re.dispose(),re=null),at.stop()},this.renderBufferDirect=function(e,t,n,r,i,a){null===t&&(t=se);var o=i.isMesh&&i.matrixWorld.determinant()<0,s=gt(e,t,n,r,i);he.setMaterial(r,o);var u=n.index,l=1;if(!0===r.wireframe){if(void 0===(u=ye.getWireframeAttribute(n)))return;l=2}var c=n.drawRange,h=n.attributes.position,d=c.start*l,f=(c.start+c.count)*l;null!==a&&(d=Math.max(d,a.start*l),f=Math.min(f,(a.start+a.count)*l)),null!==u?(d=Math.max(d,0),f=Math.min(f,u.count)):null!=h&&(d=Math.max(d,0),f=Math.min(f,h.count));var p=f-d;if(!(p<0||p===1/0)){var v;Pe.setup(i,r,s,n,u);var m=ke;if(null!==u&&(v=ge.get(u),(m=Ce).setIndex(v)),i.isMesh)!0===r.wireframe?(he.setLineWidth(r.wireframeLinewidth*ue()),m.setMode(De.LINES)):m.setMode(De.TRIANGLES);else if(i.isLine){var g=r.linewidth;void 0===g&&(g=1),he.setLineWidth(g*ue()),i.isLineSegments?m.setMode(De.LINES):i.isLineLoop?m.setMode(De.LINE_LOOP):m.setMode(De.LINE_STRIP)}else i.isPoints?m.setMode(De.POINTS):i.isSprite&&m.setMode(De.TRIANGLES);if(i.isInstancedMesh)m.renderInstances(d,p,i.count);else if(n.isInstancedBufferGeometry){var y=void 0!==n._maxInstanceCount?n._maxInstanceCount:1/0,_=Math.min(n.instanceCount,y);m.renderInstances(d,p,_)}else m.render(d,p)}},this.compile=function(e,t){function n(e,t,n){!0===e.transparent&&e.side===G&&!1===e.forceSinglePass?(e.side=H,e.needsUpdate=!0,ft(e,t,n),e.side=z,e.needsUpdate=!0,ft(e,t,n),e.side=G):ft(e,t,n)}(A=we.get(e)).init(),C.push(A),e.traverseVisible((function(e){e.isLight&&e.layers.test(t.layers)&&(A.pushLight(e),e.castShadow&&A.pushShadow(e))})),A.setupLights(L._useLegacyLights),e.traverse((function(t){var r=t.material;if(r)if(Array.isArray(r))for(var i=0;i<r.length;i++){n(r[i],e,t)}else n(r,e,t)})),C.pop(),A=null};var qe=null;function Ze(e){qe&&qe(e)}function Ke(){at.stop()}function Qe(){at.start()}var at=new Ro;function st(e,t,n,r){if(!1!==e.visible){if(e.layers.test(t.layers))if(e.isGroup)n=e.renderOrder;else if(e.isLOD)!0===e.autoUpdate&&e.update(t);else if(e.isLight)A.pushLight(e),e.castShadow&&A.pushShadow(e);else if(e.isSprite){if(!e.frustumCulled||ee.intersectsSprite(e)){r&&oe.setFromMatrixPosition(e.matrixWorld).applyMatrix4(ie);var i=_e.update(e),a=e.material;a.visible&&E.push(e,i,a,n,oe.z,null)}}else if((e.isMesh||e.isLine||e.isPoints)&&(!e.frustumCulled||ee.intersectsObject(e))){var o=_e.update(e),s=e.material;if(r&&(void 0!==e.boundingSphere?(null===e.boundingSphere&&e.computeBoundingSphere(),oe.copy(e.boundingSphere.center)):(null===o.boundingSphere&&o.computeBoundingSphere(),oe.copy(o.boundingSphere.center)),oe.applyMatrix4(e.matrixWorld).applyMatrix4(ie)),Array.isArray(s))for(var u=o.groups,l=0,c=u.length;l<c;l++){var h=u[l],d=s[h.materialIndex];d&&d.visible&&E.push(e,o,d,n,oe.z,h)}else s.visible&&E.push(e,o,s,n,oe.z,null)}for(var f=e.children,p=0,v=f.length;p<v;p++)st(f[p],t,n,r)}}function ut(e,t,n,r){var i=e.opaque,a=e.transmissive,o=e.transparent;A.setupLightsView(n),!0===te&&Te.setGlobalState(L.clippingPlanes,n),a.length>0&<(i,a,t,n),r&&he.viewport(F.copy(r)),i.length>0&&ct(i,t,n),a.length>0&&ct(a,t,n),o.length>0&&ct(o,t,n),he.buffers.depth.setTest(!0),he.buffers.depth.setMask(!0),he.buffers.color.setMask(!0),he.setPolygonOffset(!1)}function lt(e,t,n,r){var i=ce.isWebGL2;null===re&&(re=new Hr(1,1,{generateMipmaps:!0,type:le.has("EXT_color_buffer_half_float")?tt:Ye,minFilter:Xe,samples:i?4:0})),L.getDrawingBufferSize(ae),i?re.setSize(ae.x,ae.y):re.setSize(dr(ae.x),dr(ae.y));var a=L.getRenderTarget();L.setRenderTarget(re),L.getClearColor(W),(j=L.getClearAlpha())<1&&L.setClearColor(16777215,.5),L.clear();var o=L.toneMapping;L.toneMapping=be,ct(e,n,r),pe.updateMultisampleRenderTarget(re),pe.updateRenderTargetMipmap(re);for(var s=!1,u=0,l=t.length;u<l;u++){var c=t[u],h=c.object,d=c.geometry,f=c.material,p=c.group;if(f.side===G&&h.layers.test(r.layers)){var v=f.side;f.side=H,f.needsUpdate=!0,ht(h,n,r,d,f,p),f.side=v,f.needsUpdate=!0,s=!0}}!0===s&&(pe.updateMultisampleRenderTarget(re),pe.updateRenderTargetMipmap(re)),L.setRenderTarget(a),L.setClearColor(W,j),L.toneMapping=o}function ct(e,t,n){for(var r=!0===t.isScene?t.overrideMaterial:null,i=0,a=e.length;i<a;i++){var o=e[i],s=o.object,u=o.geometry,l=null===r?o.material:r,c=o.group;s.layers.test(n.layers)&&ht(s,t,n,u,l,c)}}function ht(e,t,n,r,i,a){e.onBeforeRender(L,t,n,r,i,a),e.modelViewMatrix.multiplyMatrices(n.matrixWorldInverse,e.matrixWorld),e.normalMatrix.getNormalMatrix(e.modelViewMatrix),i.onBeforeRender(L,t,n,r,e,a),!0===i.transparent&&i.side===G&&!1===i.forceSinglePass?(i.side=H,i.needsUpdate=!0,L.renderBufferDirect(n,t,r,i,e,a),i.side=z,i.needsUpdate=!0,L.renderBufferDirect(n,t,r,i,e,a),i.side=G):L.renderBufferDirect(n,t,r,i,e,a),e.onAfterRender(L,t,n,r,i,a)}function ft(e,t,n){!0!==t.isScene&&(t=se);var r=fe.get(e),i=A.state.lights,a=A.state.shadowsArray,o=i.state.version,s=xe.getParameters(e,i.state,a,t,n),u=xe.getProgramCacheKey(s),l=r.programs;r.environment=e.isMeshStandardMaterial?t.environment:null,r.fog=t.fog,r.envMap=(e.isMeshStandardMaterial?me:ve).get(e.envMap||r.environment),void 0===l&&(e.addEventListener("dispose",Ve),l=new Map,r.programs=l);var c=l.get(u);if(void 0!==c){if(r.currentProgram===c&&r.lightsStateVersion===o)return mt(e,s),c}else s.uniforms=xe.getUniforms(e),e.onBuild(n,s,L),e.onBeforeCompile(s,L),c=xe.acquireProgram(s,u),l.set(u,c),r.uniforms=s.uniforms;var h=r.uniforms;(e.isShaderMaterial||e.isRawShaderMaterial)&&!0!==e.clipping||(h.clippingPlanes=Te.uniform),mt(e,s),r.needsLights=_t(e),r.lightsStateVersion=o,r.needsLights&&(h.ambientLightColor.value=i.state.ambient,h.lightProbe.value=i.state.probe,h.directionalLights.value=i.state.directional,h.directionalLightShadows.value=i.state.directionalShadow,h.spotLights.value=i.state.spot,h.spotLightShadows.value=i.state.spotShadow,h.rectAreaLights.value=i.state.rectArea,h.ltc_1.value=i.state.rectAreaLTC1,h.ltc_2.value=i.state.rectAreaLTC2,h.pointLights.value=i.state.point,h.pointLightShadows.value=i.state.pointShadow,h.hemisphereLights.value=i.state.hemi,h.directionalShadowMap.value=i.state.directionalShadowMap,h.directionalShadowMatrix.value=i.state.directionalShadowMatrix,h.spotShadowMap.value=i.state.spotShadowMap,h.spotLightMatrix.value=i.state.spotLightMatrix,h.spotLightMap.value=i.state.spotLightMap,h.pointShadowMap.value=i.state.pointShadowMap,h.pointShadowMatrix.value=i.state.pointShadowMatrix);var d=c.getUniforms(),f=fu.seqWithValue(d.seq,h);return r.currentProgram=c,r.uniformsList=f,c}function mt(e,t){var n=fe.get(e);n.outputColorSpace=t.outputColorSpace,n.instancing=t.instancing,n.instancingColor=t.instancingColor,n.skinning=t.skinning,n.morphTargets=t.morphTargets,n.morphNormals=t.morphNormals,n.morphColors=t.morphColors,n.morphTargetsCount=t.morphTargetsCount,n.numClippingPlanes=t.numClippingPlanes,n.numIntersection=t.numClipIntersection,n.vertexAlphas=t.vertexAlphas,n.vertexTangents=t.vertexTangents,n.toneMapping=t.toneMapping}function gt(e,t,n,r,i){!0!==t.isScene&&(t=se),pe.resetTextureUnits();var a=t.fog,o=r.isMeshStandardMaterial?t.environment:null,s=null===U?L.outputColorSpace:!0===U.isXRRenderTarget?U.texture.colorSpace:vn,u=(r.isMeshStandardMaterial?me:ve).get(r.envMap||o),l=!0===r.vertexColors&&!!n.attributes.color&&4===n.attributes.color.itemSize,c=!!n.attributes.tangent&&(!!r.normalMap||r.anisotropy>0),h=!!n.morphAttributes.position,d=!!n.morphAttributes.normal,f=!!n.morphAttributes.color,p=be;r.toneMapped&&(null!==U&&!0!==U.isXRRenderTarget||(p=L.toneMapping));var v=n.morphAttributes.position||n.morphAttributes.normal||n.morphAttributes.color,m=void 0!==v?v.length:0,g=fe.get(r),y=A.state.lights;if(!0===te&&(!0===ne||e!==N)){var _=e===N&&r.id===O;Te.setState(r,e,_)}var x=!1;r.version===g.__version?g.needsLights&&g.lightsStateVersion!==y.state.version||g.outputColorSpace!==s||i.isInstancedMesh&&!1===g.instancing?x=!0:i.isInstancedMesh||!0!==g.instancing?i.isSkinnedMesh&&!1===g.skinning?x=!0:i.isSkinnedMesh||!0!==g.skinning?i.isInstancedMesh&&!0===g.instancingColor&&null===i.instanceColor||i.isInstancedMesh&&!1===g.instancingColor&&null!==i.instanceColor||g.envMap!==u||!0===r.fog&&g.fog!==a?x=!0:void 0===g.numClippingPlanes||g.numClippingPlanes===Te.numPlanes&&g.numIntersection===Te.numIntersection?(g.vertexAlphas!==l||g.vertexTangents!==c||g.morphTargets!==h||g.morphNormals!==d||g.morphColors!==f||g.toneMapping!==p||!0===ce.isWebGL2&&g.morphTargetsCount!==m)&&(x=!0):x=!0:x=!0:x=!0:(x=!0,g.__version=r.version);var M=g.currentProgram;!0===x&&(M=ft(r,t,i));var S=!1,b=!1,w=!1,T=M.getUniforms(),E=g.uniforms;if(he.useProgram(M.program)&&(S=!0,b=!0,w=!0),r.id!==O&&(O=r.id,b=!0),S||N!==e){if(T.setValue(De,"projectionMatrix",e.projectionMatrix),ce.logarithmicDepthBuffer&&T.setValue(De,"logDepthBufFC",2/(Math.log(e.far+1)/Math.LN2)),N!==e&&(N=e,b=!0,w=!0),r.isShaderMaterial||r.isMeshPhongMaterial||r.isMeshToonMaterial||r.isMeshStandardMaterial||r.envMap){var R=T.map.cameraPosition;void 0!==R&&R.setValue(De,oe.setFromMatrixPosition(e.matrixWorld))}(r.isMeshPhongMaterial||r.isMeshToonMaterial||r.isMeshLambertMaterial||r.isMeshBasicMaterial||r.isMeshStandardMaterial||r.isShaderMaterial)&&T.setValue(De,"isOrthographic",!0===e.isOrthographicCamera),(r.isMeshPhongMaterial||r.isMeshToonMaterial||r.isMeshLambertMaterial||r.isMeshBasicMaterial||r.isMeshStandardMaterial||r.isShaderMaterial||r.isShadowMaterial||i.isSkinnedMesh)&&T.setValue(De,"viewMatrix",e.matrixWorldInverse)}if(i.isSkinnedMesh){T.setOptional(De,i,"bindMatrix"),T.setOptional(De,i,"bindMatrixInverse");var k=i.skeleton;k&&(ce.floatVertexTextures?(null===k.boneTexture&&k.computeBoneTexture(),T.setValue(De,"boneTexture",k.boneTexture,pe),T.setValue(De,"boneTextureSize",k.boneTextureSize)):console.warn("THREE.WebGLRenderer: SkinnedMesh can only be used with WebGL 2. With WebGL 1 OES_texture_float and vertex textures support is required."))}var C=n.morphAttributes;if((void 0!==C.position||void 0!==C.normal||void 0!==C.color&&!0===ce.isWebGL2)&&Re.update(i,n,M),(b||g.receiveShadow!==i.receiveShadow)&&(g.receiveShadow=i.receiveShadow,T.setValue(De,"receiveShadow",i.receiveShadow)),r.isMeshGouraudMaterial&&null!==r.envMap&&(E.envMap.value=u,E.flipEnvMap.value=u.isCubeTexture&&!1===u.isRenderTargetTexture?-1:1),b&&(T.setValue(De,"toneMappingExposure",L.toneMappingExposure),g.needsLights&&yt(E,w),a&&!0===r.fog&&Me.refreshFogUniforms(E,a),Me.refreshMaterialUniforms(E,r,Y,q,re),fu.upload(De,g.uniformsList,E,pe)),r.isShaderMaterial&&!0===r.uniformsNeedUpdate&&(fu.upload(De,g.uniformsList,E,pe),r.uniformsNeedUpdate=!1),r.isSpriteMaterial&&T.setValue(De,"center",i.center),T.setValue(De,"modelViewMatrix",i.modelViewMatrix),T.setValue(De,"normalMatrix",i.normalMatrix),T.setValue(De,"modelMatrix",i.matrixWorld),r.isShaderMaterial||r.isRawShaderMaterial)for(var P=r.uniformsGroups,I=0,D=P.length;I<D;I++)if(ce.isWebGL2){var F=P[I];Ie.update(F,M),Ie.bind(F,M)}else console.warn("THREE.WebGLRenderer: Uniform Buffer Objects can only be used with WebGL 2.");return M}function yt(e,t){e.ambientLightColor.needsUpdate=t,e.lightProbe.needsUpdate=t,e.directionalLights.needsUpdate=t,e.directionalLightShadows.needsUpdate=t,e.pointLights.needsUpdate=t,e.pointLightShadows.needsUpdate=t,e.spotLights.needsUpdate=t,e.spotLightShadows.needsUpdate=t,e.rectAreaLights.needsUpdate=t,e.hemisphereLights.needsUpdate=t}function _t(e){return e.isMeshLambertMaterial||e.isMeshToonMaterial||e.isMeshPhongMaterial||e.isMeshStandardMaterial||e.isShadowMaterial||e.isShaderMaterial&&!0===e.lights}at.setAnimationLoop(Ze),"undefined"!=typeof self&&at.setContext(self),this.setAnimationLoop=function(e){qe=e,Be.setAnimationLoop(e),null===e?at.stop():at.start()},Be.addEventListener("sessionstart",Ke),Be.addEventListener("sessionend",Qe),this.render=function(e,t){if(void 0===t||!0===t.isCamera){if(!0!==P){!0===e.matrixWorldAutoUpdate&&e.updateMatrixWorld(),null===t.parent&&!0===t.matrixWorldAutoUpdate&&t.updateMatrixWorld(),!0===Be.enabled&&!0===Be.isPresenting&&(!0===Be.cameraAutoUpdate&&Be.updateCamera(t),t=Be.getCamera()),!0===e.isScene&&e.onBeforeRender(L,e,t,U),(A=we.get(e,C.length)).init(),C.push(A),ie.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),ee.setFromProjectionMatrix(ie),ne=this.localClippingEnabled,te=Te.init(this.clippingPlanes,ne),(E=Se.get(e,R.length)).init(),R.push(E),st(e,t,0,L.sortObjects),E.finish(),!0===L.sortObjects&&E.sort(Z,K),this.info.render.frame++,!0===te&&Te.beginShadows();var n=A.state.shadowsArray;if(Ee.render(n,e,t),!0===te&&Te.endShadows(),!0===this.info.autoReset&&this.info.reset(),Ae.render(E,e),A.setupLights(L._useLegacyLights),t.isArrayCamera)for(var r=t.cameras,i=0,a=r.length;i<a;i++){var o=r[i];ut(E,e,o,o.viewport)}else ut(E,e,t);null!==U&&(pe.updateMultisampleRenderTarget(U),pe.updateRenderTargetMipmap(U)),!0===e.isScene&&e.onAfterRender(L,e,t),Pe.resetDefaultState(),O=-1,N=null,C.pop(),A=C.length>0?C[C.length-1]:null,R.pop(),E=R.length>0?R[R.length-1]:null}}else console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.")},this.getActiveCubeFace=function(){return I},this.getActiveMipmapLevel=function(){return D},this.getRenderTarget=function(){return U},this.setRenderTargetTextures=function(e,t,n){fe.get(e.texture).__webglTexture=t,fe.get(e.depthTexture).__webglTexture=n;var r=fe.get(e);r.__hasExternalTextures=!0,r.__hasExternalTextures&&(r.__autoAllocateDepthBuffer=void 0===n,r.__autoAllocateDepthBuffer||!0===le.has("WEBGL_multisampled_render_to_texture")&&(console.warn("THREE.WebGLRenderer: Render-to-texture extension was disabled because an external texture was provided"),r.__useRenderToTexture=!1))},this.setRenderTargetFramebuffer=function(e,t){var n=fe.get(e);n.__webglFramebuffer=t,n.__useDefaultFramebuffer=void 0===t},this.setRenderTarget=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;U=e,I=t,D=n;var r=!0,i=null,a=!1,o=!1;if(e){var s=fe.get(e);void 0!==s.__useDefaultFramebuffer?(he.bindFramebuffer(De.FRAMEBUFFER,null),r=!1):void 0===s.__webglFramebuffer?pe.setupRenderTarget(e):s.__hasExternalTextures&&pe.rebindTextures(e,fe.get(e.texture).__webglTexture,fe.get(e.depthTexture).__webglTexture);var u=e.texture;(u.isData3DTexture||u.isDataArrayTexture||u.isCompressedArrayTexture)&&(o=!0);var l=fe.get(e).__webglFramebuffer;e.isWebGLCubeRenderTarget?(i=Array.isArray(l[t])?l[t][n]:l[t],a=!0):i=ce.isWebGL2&&e.samples>0&&!1===pe.useMultisampledRTT(e)?fe.get(e).__webglMultisampledFramebuffer:Array.isArray(l)?l[n]:l,F.copy(e.viewport),B.copy(e.scissor),V=e.scissorTest}else F.copy(J).multiplyScalar(Y).floor(),B.copy(Q).multiplyScalar(Y).floor(),V=$;var c=he.bindFramebuffer(De.FRAMEBUFFER,i);if(c&&ce.drawBuffers&&r&&he.drawBuffers(e,i),he.viewport(F),he.scissor(B),he.setScissorTest(V),a){var h=fe.get(e.texture);De.framebufferTexture2D(De.FRAMEBUFFER,De.COLOR_ATTACHMENT0,De.TEXTURE_CUBE_MAP_POSITIVE_X+t,h.__webglTexture,n)}else if(o){var d=fe.get(e.texture),f=t||0;De.framebufferTextureLayer(De.FRAMEBUFFER,De.COLOR_ATTACHMENT0,d.__webglTexture,n||0,f)}O=-1},this.readRenderTargetPixels=function(e,t,n,r,i,a,o){if(e&&e.isWebGLRenderTarget){var s=fe.get(e).__webglFramebuffer;if(e.isWebGLCubeRenderTarget&&void 0!==o&&(s=s[o]),s){he.bindFramebuffer(De.FRAMEBUFFER,s);try{var u=e.texture,l=u.format,c=u.type;if(l!==ot&&Le.convert(l)!==De.getParameter(De.IMPLEMENTATION_COLOR_READ_FORMAT))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");var h=c===tt&&(le.has("EXT_color_buffer_half_float")||ce.isWebGL2&&le.has("EXT_color_buffer_float"));if(!(c===Ye||Le.convert(c)===De.getParameter(De.IMPLEMENTATION_COLOR_READ_TYPE)||c===et&&(ce.isWebGL2||le.has("OES_texture_float")||le.has("WEBGL_color_buffer_float"))||h))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");t>=0&&t<=e.width-r&&n>=0&&n<=e.height-i&&De.readPixels(t,n,r,i,Le.convert(l),Le.convert(c),a)}finally{var d=null!==U?fe.get(U).__webglFramebuffer:null;he.bindFramebuffer(De.FRAMEBUFFER,d)}}}else console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.")},this.copyFramebufferToTexture=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=Math.pow(2,-n),i=Math.floor(t.image.width*r),a=Math.floor(t.image.height*r);pe.setTexture2D(t,0),De.copyTexSubImage2D(De.TEXTURE_2D,n,0,0,e.x,e.y,i,a),he.unbindTexture()},this.copyTextureToTexture=function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,i=t.image.width,a=t.image.height,o=Le.convert(n.format),s=Le.convert(n.type);pe.setTexture2D(n,0),De.pixelStorei(De.UNPACK_FLIP_Y_WEBGL,n.flipY),De.pixelStorei(De.UNPACK_PREMULTIPLY_ALPHA_WEBGL,n.premultiplyAlpha),De.pixelStorei(De.UNPACK_ALIGNMENT,n.unpackAlignment),t.isDataTexture?De.texSubImage2D(De.TEXTURE_2D,r,e.x,e.y,i,a,o,s,t.image.data):t.isCompressedTexture?De.compressedTexSubImage2D(De.TEXTURE_2D,r,e.x,e.y,t.mipmaps[0].width,t.mipmaps[0].height,o,t.mipmaps[0].data):De.texSubImage2D(De.TEXTURE_2D,r,e.x,e.y,o,s,t.image),0===r&&n.generateMipmaps&&De.generateMipmap(De.TEXTURE_2D),he.unbindTexture()},this.copyTextureToTexture3D=function(e,t,n,r){var i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;if(L.isWebGL1Renderer)console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");else{var a,o=e.max.x-e.min.x+1,s=e.max.y-e.min.y+1,u=e.max.z-e.min.z+1,l=Le.convert(r.format),c=Le.convert(r.type);if(r.isData3DTexture)pe.setTexture3D(r,0),a=De.TEXTURE_3D;else{if(!r.isDataArrayTexture)return void console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");pe.setTexture2DArray(r,0),a=De.TEXTURE_2D_ARRAY}De.pixelStorei(De.UNPACK_FLIP_Y_WEBGL,r.flipY),De.pixelStorei(De.UNPACK_PREMULTIPLY_ALPHA_WEBGL,r.premultiplyAlpha),De.pixelStorei(De.UNPACK_ALIGNMENT,r.unpackAlignment);var h=De.getParameter(De.UNPACK_ROW_LENGTH),d=De.getParameter(De.UNPACK_IMAGE_HEIGHT),f=De.getParameter(De.UNPACK_SKIP_PIXELS),p=De.getParameter(De.UNPACK_SKIP_ROWS),v=De.getParameter(De.UNPACK_SKIP_IMAGES),m=n.isCompressedTexture?n.mipmaps[0]:n.image;De.pixelStorei(De.UNPACK_ROW_LENGTH,m.width),De.pixelStorei(De.UNPACK_IMAGE_HEIGHT,m.height),De.pixelStorei(De.UNPACK_SKIP_PIXELS,e.min.x),De.pixelStorei(De.UNPACK_SKIP_ROWS,e.min.y),De.pixelStorei(De.UNPACK_SKIP_IMAGES,e.min.z),n.isDataTexture||n.isData3DTexture?De.texSubImage3D(a,i,t.x,t.y,t.z,o,s,u,l,c,m.data):n.isCompressedArrayTexture?(console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: untested support for compressed srcTexture."),De.compressedTexSubImage3D(a,i,t.x,t.y,t.z,o,s,u,l,m.data)):De.texSubImage3D(a,i,t.x,t.y,t.z,o,s,u,l,c,m),De.pixelStorei(De.UNPACK_ROW_LENGTH,h),De.pixelStorei(De.UNPACK_IMAGE_HEIGHT,d),De.pixelStorei(De.UNPACK_SKIP_PIXELS,f),De.pixelStorei(De.UNPACK_SKIP_ROWS,p),De.pixelStorei(De.UNPACK_SKIP_IMAGES,v),0===i&&r.generateMipmaps&&De.generateMipmap(a),he.unbindTexture()}},this.initTexture=function(e){e.isCubeTexture?pe.setTextureCube(e,0):e.isData3DTexture?pe.setTexture3D(e,0):e.isDataArrayTexture||e.isCompressedArrayTexture?pe.setTexture2DArray(e,0):pe.setTexture2D(e,0),he.unbindTexture()},this.resetState=function(){I=0,D=0,U=null,he.reset(),Pe.reset()},"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}return s(e,[{key:"coordinateSystem",get:function(){return $n}},{key:"physicallyCorrectLights",get:function(){return console.warn("THREE.WebGLRenderer: The property .physicallyCorrectLights has been removed. Set renderer.useLegacyLights instead."),!this.useLegacyLights},set:function(e){console.warn("THREE.WebGLRenderer: The property .physicallyCorrectLights has been removed. Set renderer.useLegacyLights instead."),this.useLegacyLights=!e}},{key:"outputEncoding",get:function(){return console.warn("THREE.WebGLRenderer: Property .outputEncoding has been removed. Use .outputColorSpace instead."),this.outputColorSpace===pn?un:sn},set:function(e){console.warn("THREE.WebGLRenderer: Property .outputEncoding has been removed. Use .outputColorSpace instead."),this.outputColorSpace=e===un?pn:vn}},{key:"useLegacyLights",get:function(){return console.warn("THREE.WebGLRenderer: The property .useLegacyLights has been deprecated. Migrate your lighting according to the following guide: https://discourse.threejs.org/t/updates-to-lighting-in-three-js-r155/53733."),this._useLegacyLights},set:function(e){console.warn("THREE.WebGLRenderer: The property .useLegacyLights has been deprecated. Migrate your lighting according to the following guide: https://discourse.threejs.org/t/updates-to-lighting-in-three-js-r155/53733."),this._useLegacyLights=e}}]),e}(),ul=function(e){w(n,e);var t=E(n);function n(){return a(this,n),t.apply(this,arguments)}return s(n)}(sl);ul.prototype.isWebGL1Renderer=!0;var ll,cl=function(){function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:25e-5;a(this,e),this.isFogExp2=!0,this.name="",this.color=new pa(t),this.density=n}return s(e,[{key:"clone",value:function(){return new e(this.color,this.density)}},{key:"toJSON",value:function(){return{type:"FogExp2",color:this.color.getHex(),density:this.density}}}]),e}(),hl=function(){function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1e3;a(this,e),this.isFog=!0,this.name="",this.color=new pa(t),this.near=n,this.far=r}return s(e,[{key:"clone",value:function(){return new e(this.color,this.near,this.far)}},{key:"toJSON",value:function(){return{type:"Fog",color:this.color.getHex(),near:this.near,far:this.far}}}]),e}(),dl=function(e){w(n,e);var t=E(n);function n(){var e;return a(this,n),(e=t.call(this)).isScene=!0,e.type="Scene",e.background=null,e.environment=null,e.fog=null,e.backgroundBlurriness=0,e.backgroundIntensity=1,e.overrideMaterial=null,"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:S(e)})),e}return s(n,[{key:"copy",value:function(e,t){return y(x(n.prototype),"copy",this).call(this,e,t),null!==e.background&&(this.background=e.background.clone()),null!==e.environment&&(this.environment=e.environment.clone()),null!==e.fog&&(this.fog=e.fog.clone()),this.backgroundBlurriness=e.backgroundBlurriness,this.backgroundIntensity=e.backgroundIntensity,null!==e.overrideMaterial&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}},{key:"toJSON",value:function(e){var t=y(x(n.prototype),"toJSON",this).call(this,e);return null!==this.fog&&(t.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(t.object.backgroundBlurriness=this.backgroundBlurriness),1!==this.backgroundIntensity&&(t.object.backgroundIntensity=this.backgroundIntensity),t}}]),n}(Zi),fl=function(){function e(t,n){a(this,e),this.isInterleavedBuffer=!0,this.array=t,this.stride=n,this.count=void 0!==t?t.length/n:0,this.usage=Hn,this.updateRange={offset:0,count:-1},this.version=0,this.uuid=or()}return s(e,[{key:"onUploadCallback",value:function(){}},{key:"needsUpdate",set:function(e){!0===e&&this.version++}},{key:"setUsage",value:function(e){return this.usage=e,this}},{key:"copy",value:function(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this}},{key:"copyAt",value:function(e,t,n){e*=this.stride,n*=t.stride;for(var r=0,i=this.stride;r<i;r++)this.array[e+r]=t.array[n+r];return this}},{key:"set",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.array.set(e,t),this}},{key:"clone",value:function(e){void 0===e.arrayBuffers&&(e.arrayBuffers={}),void 0===this.array.buffer._uuid&&(this.array.buffer._uuid=or()),void 0===e.arrayBuffers[this.array.buffer._uuid]&&(e.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);var t=new this.array.constructor(e.arrayBuffers[this.array.buffer._uuid]),n=new this.constructor(t,this.stride);return n.setUsage(this.usage),n}},{key:"onUpload",value:function(e){return this.onUploadCallback=e,this}},{key:"toJSON",value:function(e){return void 0===e.arrayBuffers&&(e.arrayBuffers={}),void 0===this.array.buffer._uuid&&(this.array.buffer._uuid=or()),void 0===e.arrayBuffers[this.array.buffer._uuid]&&(e.arrayBuffers[this.array.buffer._uuid]=Array.from(new Uint32Array(this.array.buffer))),{uuid:this.uuid,buffer:this.array.buffer._uuid,type:this.array.constructor.name,stride:this.stride}}}]),e}(),pl=new Yr,vl=function(){function e(t,n,r){var i=arguments.length>3&&void 0!==arguments[3]&&arguments[3];a(this,e),this.isInterleavedBufferAttribute=!0,this.name="",this.data=t,this.itemSize=n,this.offset=r,this.normalized=i}return s(e,[{key:"count",get:function(){return this.data.count}},{key:"array",get:function(){return this.data.array}},{key:"needsUpdate",set:function(e){this.data.needsUpdate=e}},{key:"applyMatrix4",value:function(e){for(var t=0,n=this.data.count;t<n;t++)pl.fromBufferAttribute(this,t),pl.applyMatrix4(e),this.setXYZ(t,pl.x,pl.y,pl.z);return this}},{key:"applyNormalMatrix",value:function(e){for(var t=0,n=this.count;t<n;t++)pl.fromBufferAttribute(this,t),pl.applyNormalMatrix(e),this.setXYZ(t,pl.x,pl.y,pl.z);return this}},{key:"transformDirection",value:function(e){for(var t=0,n=this.count;t<n;t++)pl.fromBufferAttribute(this,t),pl.transformDirection(e),this.setXYZ(t,pl.x,pl.y,pl.z);return this}},{key:"setX",value:function(e,t){return this.normalized&&(t=pr(t,this.array)),this.data.array[e*this.data.stride+this.offset]=t,this}},{key:"setY",value:function(e,t){return this.normalized&&(t=pr(t,this.array)),this.data.array[e*this.data.stride+this.offset+1]=t,this}},{key:"setZ",value:function(e,t){return this.normalized&&(t=pr(t,this.array)),this.data.array[e*this.data.stride+this.offset+2]=t,this}},{key:"setW",value:function(e,t){return this.normalized&&(t=pr(t,this.array)),this.data.array[e*this.data.stride+this.offset+3]=t,this}},{key:"getX",value:function(e){var t=this.data.array[e*this.data.stride+this.offset];return this.normalized&&(t=fr(t,this.array)),t}},{key:"getY",value:function(e){var t=this.data.array[e*this.data.stride+this.offset+1];return this.normalized&&(t=fr(t,this.array)),t}},{key:"getZ",value:function(e){var t=this.data.array[e*this.data.stride+this.offset+2];return this.normalized&&(t=fr(t,this.array)),t}},{key:"getW",value:function(e){var t=this.data.array[e*this.data.stride+this.offset+3];return this.normalized&&(t=fr(t,this.array)),t}},{key:"setXY",value:function(e,t,n){return e=e*this.data.stride+this.offset,this.normalized&&(t=pr(t,this.array),n=pr(n,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this}},{key:"setXYZ",value:function(e,t,n,r){return e=e*this.data.stride+this.offset,this.normalized&&(t=pr(t,this.array),n=pr(n,this.array),r=pr(r,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=r,this}},{key:"setXYZW",value:function(e,t,n,r,i){return e=e*this.data.stride+this.offset,this.normalized&&(t=pr(t,this.array),n=pr(n,this.array),r=pr(r,this.array),i=pr(i,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=r,this.data.array[e+3]=i,this}},{key:"clone",value:function(t){if(void 0===t){console.log("THREE.InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will de-interleave buffer data.");for(var n=[],r=0;r<this.count;r++)for(var i=r*this.data.stride+this.offset,a=0;a<this.itemSize;a++)n.push(this.data.array[i+a]);return new wa(new this.array.constructor(n),this.itemSize,this.normalized)}return void 0===t.interleavedBuffers&&(t.interleavedBuffers={}),void 0===t.interleavedBuffers[this.data.uuid]&&(t.interleavedBuffers[this.data.uuid]=this.data.clone(t)),new e(t.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}},{key:"toJSON",value:function(e){if(void 0===e){console.log("THREE.InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will de-interleave buffer data.");for(var t=[],n=0;n<this.count;n++)for(var r=n*this.data.stride+this.offset,i=0;i<this.itemSize;i++)t.push(this.data.array[r+i]);return{itemSize:this.itemSize,type:this.array.constructor.name,array:t,normalized:this.normalized}}return void 0===e.interleavedBuffers&&(e.interleavedBuffers={}),void 0===e.interleavedBuffers[this.data.uuid]&&(e.interleavedBuffers[this.data.uuid]=this.data.toJSON(e)),{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized}}}]),e}(),ml=function(e){w(n,e);var t=E(n);function n(e){var r;return a(this,n),(r=t.call(this)).isSpriteMaterial=!0,r.type="SpriteMaterial",r.color=new pa(16777215),r.map=null,r.alphaMap=null,r.rotation=0,r.sizeAttenuation=!0,r.transparent=!0,r.fog=!0,r.setValues(e),r}return s(n,[{key:"copy",value:function(e){return y(x(n.prototype),"copy",this).call(this,e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.rotation=e.rotation,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}}]),n}(la),gl=new Yr,yl=new Yr,_l=new Yr,xl=new mr,Ml=new mr,Sl=new wi,bl=new Yr,wl=new Yr,Tl=new Yr,El=new mr,Al=new mr,Rl=new mr,kl=function(e){w(n,e);var t=E(n);function n(e){var r;if(a(this,n),(r=t.call(this)).isSprite=!0,r.type="Sprite",void 0===ll){ll=new Ga;var i=new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),o=new fl(i,5);ll.setIndex([0,1,2,0,2,3]),ll.setAttribute("position",new vl(o,3,0,!1)),ll.setAttribute("uv",new vl(o,2,3,!1))}return r.geometry=ll,r.material=void 0!==e?e:new ml,r.center=new mr(.5,.5),r}return s(n,[{key:"raycast",value:function(e,t){null===e.camera&&console.error('THREE.Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),yl.setFromMatrixScale(this.matrixWorld),Sl.copy(e.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(e.camera.matrixWorldInverse,this.matrixWorld),_l.setFromMatrixPosition(this.modelViewMatrix),e.camera.isPerspectiveCamera&&!1===this.material.sizeAttenuation&&yl.multiplyScalar(-_l.z);var n,r,i=this.material.rotation;0!==i&&(r=Math.cos(i),n=Math.sin(i));var a=this.center;Cl(bl.set(-.5,-.5,0),_l,a,yl,n,r),Cl(wl.set(.5,-.5,0),_l,a,yl,n,r),Cl(Tl.set(.5,.5,0),_l,a,yl,n,r),El.set(0,0),Al.set(1,0),Rl.set(1,1);var o=e.ray.intersectTriangle(bl,wl,Tl,!1,gl);if(null!==o||(Cl(wl.set(-.5,.5,0),_l,a,yl,n,r),Al.set(0,1),null!==(o=e.ray.intersectTriangle(bl,Tl,wl,!1,gl)))){var s=e.ray.origin.distanceTo(gl);s<e.near||s>e.far||t.push({distance:s,point:gl.clone(),uv:sa.getInterpolation(gl,bl,wl,Tl,El,Al,Rl,new mr),face:null,object:this})}}},{key:"copy",value:function(e,t){return y(x(n.prototype),"copy",this).call(this,e,t),void 0!==e.center&&this.center.copy(e.center),this.material=e.material,this}}]),n}(Zi);function Cl(e,t,n,r,i,a){xl.subVectors(e,n).addScalar(.5).multiply(r),void 0!==i?(Ml.x=a*xl.x-i*xl.y,Ml.y=i*xl.x+a*xl.y):Ml.copy(xl),e.copy(t),e.x+=Ml.x,e.y+=Ml.y,e.applyMatrix4(Sl)}var Ll=new Yr,Pl=new Yr,Il=function(e){w(n,e);var t=E(n);function n(){var e;return a(this,n),(e=t.call(this))._currentLevel=0,e.type="LOD",Object.defineProperties(S(e),{levels:{enumerable:!0,value:[]},isLOD:{value:!0}}),e.autoUpdate=!0,e}return s(n,[{key:"copy",value:function(e){y(x(n.prototype),"copy",this).call(this,e,!1);for(var t=e.levels,r=0,i=t.length;r<i;r++){var a=t[r];this.addLevel(a.object.clone(),a.distance,a.hysteresis)}return this.autoUpdate=e.autoUpdate,this}},{key:"addLevel",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;t=Math.abs(t);var r,i=this.levels;for(r=0;r<i.length&&!(t<i[r].distance);r++);return i.splice(r,0,{distance:t,hysteresis:n,object:e}),this.add(e),this}},{key:"getCurrentLevel",value:function(){return this._currentLevel}},{key:"getObjectForDistance",value:function(e){var t=this.levels;if(t.length>0){var n,r;for(n=1,r=t.length;n<r;n++){var i=t[n].distance;if(t[n].object.visible&&(i-=i*t[n].hysteresis),e<i)break}return t[n-1].object}return null}},{key:"raycast",value:function(e,t){if(this.levels.length>0){Ll.setFromMatrixPosition(this.matrixWorld);var n=e.ray.origin.distanceTo(Ll);this.getObjectForDistance(n).raycast(e,t)}}},{key:"update",value:function(e){var t=this.levels;if(t.length>1){Ll.setFromMatrixPosition(e.matrixWorld),Pl.setFromMatrixPosition(this.matrixWorld);var n,r,i=Ll.distanceTo(Pl)/e.zoom;for(t[0].object.visible=!0,n=1,r=t.length;n<r;n++){var a=t[n].distance;if(t[n].object.visible&&(a-=a*t[n].hysteresis),!(i>=a))break;t[n-1].object.visible=!1,t[n].object.visible=!0}for(this._currentLevel=n-1;n<r;n++)t[n].object.visible=!1}}},{key:"toJSON",value:function(e){var t=y(x(n.prototype),"toJSON",this).call(this,e);!1===this.autoUpdate&&(t.object.autoUpdate=!1),t.object.levels=[];for(var r=this.levels,i=0,a=r.length;i<a;i++){var o=r[i];t.object.levels.push({object:o.object.uuid,distance:o.distance,hysteresis:o.hysteresis})}return t}}]),n}(Zi),Dl=new Yr,Ul=new Br,Ol=new Br,Nl=new Yr,Fl=new wi,Bl=new Yr,zl=new vi,Hl=new wi,Gl=new bi,Vl=function(e){w(n,e);var t=E(n);function n(e,r){var i;return a(this,n),(i=t.call(this,e,r)).isSkinnedMesh=!0,i.type="SkinnedMesh",i.bindMode="attached",i.bindMatrix=new wi,i.bindMatrixInverse=new wi,i.boundingBox=null,i.boundingSphere=null,i}return s(n,[{key:"computeBoundingBox",value:function(){var e=this.geometry;null===this.boundingBox&&(this.boundingBox=new Jr),this.boundingBox.makeEmpty();for(var t=e.getAttribute("position"),n=0;n<t.count;n++)Bl.fromBufferAttribute(t,n),this.applyBoneTransform(n,Bl),this.boundingBox.expandByPoint(Bl)}},{key:"computeBoundingSphere",value:function(){var e=this.geometry;null===this.boundingSphere&&(this.boundingSphere=new vi),this.boundingSphere.makeEmpty();for(var t=e.getAttribute("position"),n=0;n<t.count;n++)Bl.fromBufferAttribute(t,n),this.applyBoneTransform(n,Bl),this.boundingSphere.expandByPoint(Bl)}},{key:"copy",value:function(e,t){return y(x(n.prototype),"copy",this).call(this,e,t),this.bindMode=e.bindMode,this.bindMatrix.copy(e.bindMatrix),this.bindMatrixInverse.copy(e.bindMatrixInverse),this.skeleton=e.skeleton,null!==e.boundingBox&&(this.boundingBox=e.boundingBox.clone()),null!==e.boundingSphere&&(this.boundingSphere=e.boundingSphere.clone()),this}},{key:"raycast",value:function(e,t){var n=this.material,r=this.matrixWorld;void 0!==n&&(null===this.boundingSphere&&this.computeBoundingSphere(),zl.copy(this.boundingSphere),zl.applyMatrix4(r),!1!==e.ray.intersectsSphere(zl)&&(Hl.copy(r).invert(),Gl.copy(e.ray).applyMatrix4(Hl),null!==this.boundingBox&&!1===Gl.intersectsBox(this.boundingBox)||this._computeIntersections(e,t,Gl)))}},{key:"getVertexPosition",value:function(e,t){return y(x(n.prototype),"getVertexPosition",this).call(this,e,t),this.applyBoneTransform(e,t),t}},{key:"bind",value:function(e,t){this.skeleton=e,void 0===t&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),t=this.matrixWorld),this.bindMatrix.copy(t),this.bindMatrixInverse.copy(t).invert()}},{key:"pose",value:function(){this.skeleton.pose()}},{key:"normalizeSkinWeights",value:function(){for(var e=new Br,t=this.geometry.attributes.skinWeight,n=0,r=t.count;n<r;n++){e.fromBufferAttribute(t,n);var i=1/e.manhattanLength();i!==1/0?e.multiplyScalar(i):e.set(1,0,0,0),t.setXYZW(n,e.x,e.y,e.z,e.w)}}},{key:"updateMatrixWorld",value:function(e){y(x(n.prototype),"updateMatrixWorld",this).call(this,e),"attached"===this.bindMode?this.bindMatrixInverse.copy(this.matrixWorld).invert():"detached"===this.bindMode?this.bindMatrixInverse.copy(this.bindMatrix).invert():console.warn("THREE.SkinnedMesh: Unrecognized bindMode: "+this.bindMode)}},{key:"applyBoneTransform",value:function(e,t){var n=this.skeleton,r=this.geometry;Ul.fromBufferAttribute(r.attributes.skinIndex,e),Ol.fromBufferAttribute(r.attributes.skinWeight,e),Dl.copy(t).applyMatrix4(this.bindMatrix),t.set(0,0,0);for(var i=0;i<4;i++){var a=Ol.getComponent(i);if(0!==a){var o=Ul.getComponent(i);Fl.multiplyMatrices(n.bones[o].matrixWorld,n.boneInverses[o]),t.addScaledVector(Nl.copy(Dl).applyMatrix4(Fl),a)}}return t.applyMatrix4(this.bindMatrixInverse)}},{key:"boneTransform",value:function(e,t){return console.warn("THREE.SkinnedMesh: .boneTransform() was renamed to .applyBoneTransform() in r151."),this.applyBoneTransform(e,t)}}]),n}(oo),Wl=function(e){w(n,e);var t=E(n);function n(){var e;return a(this,n),(e=t.call(this)).isBone=!0,e.type="Bone",e}return s(n)}(Zi),jl=function(e){w(n,e);var t=E(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,s=arguments.length>3?arguments[3]:void 0,u=arguments.length>4?arguments[4]:void 0,l=arguments.length>5?arguments[5]:void 0,c=arguments.length>6?arguments[6]:void 0,h=arguments.length>7?arguments[7]:void 0,d=arguments.length>8&&void 0!==arguments[8]?arguments[8]:Fe,f=arguments.length>9&&void 0!==arguments[9]?arguments[9]:Fe,p=arguments.length>10?arguments[10]:void 0,v=arguments.length>11?arguments[11]:void 0;return a(this,n),(e=t.call(this,null,l,c,h,d,f,s,u,p,v)).isDataTexture=!0,e.image={data:r,width:i,height:o},e.generateMipmaps=!1,e.flipY=!1,e.unpackAlignment=1,e}return s(n)}(Fr),Xl=new wi,ql=new wi,Yl=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];a(this,e),this.uuid=or(),this.bones=t.slice(0),this.boneInverses=n,this.boneMatrices=null,this.boneTexture=null,this.boneTextureSize=0,this.init()}return s(e,[{key:"init",value:function(){var e=this.bones,t=this.boneInverses;if(this.boneMatrices=new Float32Array(16*e.length),0===t.length)this.calculateInverses();else if(e.length!==t.length){console.warn("THREE.Skeleton: Number of inverse bone matrices does not match amount of bones."),this.boneInverses=[];for(var n=0,r=this.bones.length;n<r;n++)this.boneInverses.push(new wi)}}},{key:"calculateInverses",value:function(){this.boneInverses.length=0;for(var e=0,t=this.bones.length;e<t;e++){var n=new wi;this.bones[e]&&n.copy(this.bones[e].matrixWorld).invert(),this.boneInverses.push(n)}}},{key:"pose",value:function(){for(var e=0,t=this.bones.length;e<t;e++){var n=this.bones[e];n&&n.matrixWorld.copy(this.boneInverses[e]).invert()}for(var r=0,i=this.bones.length;r<i;r++){var a=this.bones[r];a&&(a.parent&&a.parent.isBone?(a.matrix.copy(a.parent.matrixWorld).invert(),a.matrix.multiply(a.matrixWorld)):a.matrix.copy(a.matrixWorld),a.matrix.decompose(a.position,a.quaternion,a.scale))}}},{key:"update",value:function(){for(var e=this.bones,t=this.boneInverses,n=this.boneMatrices,r=this.boneTexture,i=0,a=e.length;i<a;i++){var o=e[i]?e[i].matrixWorld:ql;Xl.multiplyMatrices(o,t[i]),Xl.toArray(n,16*i)}null!==r&&(r.needsUpdate=!0)}},{key:"clone",value:function(){return new e(this.bones,this.boneInverses)}},{key:"computeBoneTexture",value:function(){var e=Math.sqrt(4*this.bones.length);e=hr(e),e=Math.max(e,4);var t=new Float32Array(e*e*4);t.set(this.boneMatrices);var n=new jl(t,e,e,ot,et);return n.needsUpdate=!0,this.boneMatrices=t,this.boneTexture=n,this.boneTextureSize=e,this}},{key:"getBoneByName",value:function(e){for(var t=0,n=this.bones.length;t<n;t++){var r=this.bones[t];if(r.name===e)return r}}},{key:"dispose",value:function(){null!==this.boneTexture&&(this.boneTexture.dispose(),this.boneTexture=null)}},{key:"fromJSON",value:function(e,t){this.uuid=e.uuid;for(var n=0,r=e.bones.length;n<r;n++){var i=e.bones[n],a=t[i];void 0===a&&(console.warn("THREE.Skeleton: No bone found with UUID:",i),a=new Wl),this.bones.push(a),this.boneInverses.push((new wi).fromArray(e.boneInverses[n]))}return this.init(),this}},{key:"toJSON",value:function(){var e={metadata:{version:4.6,type:"Skeleton",generator:"Skeleton.toJSON"},bones:[],boneInverses:[]};e.uuid=this.uuid;for(var t=this.bones,n=this.boneInverses,r=0,i=t.length;r<i;r++){var a=t[r];e.bones.push(a.uuid);var o=n[r];e.boneInverses.push(o.toArray())}return e}}]),e}(),Zl=function(e){w(n,e);var t=E(n);function n(e,r,i){var o,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1;return a(this,n),(o=t.call(this,e,r,i)).isInstancedBufferAttribute=!0,o.meshPerAttribute=s,o}return s(n,[{key:"copy",value:function(e){return y(x(n.prototype),"copy",this).call(this,e),this.meshPerAttribute=e.meshPerAttribute,this}},{key:"toJSON",value:function(){var e=y(x(n.prototype),"toJSON",this).call(this);return e.meshPerAttribute=this.meshPerAttribute,e.isInstancedBufferAttribute=!0,e}}]),n}(wa),Kl=new wi,Jl=new wi,Ql=[],$l=new Jr,ec=new wi,tc=new oo,nc=new vi,rc=function(e){w(n,e);var t=E(n);function n(e,r,i){var o;a(this,n),(o=t.call(this,e,r)).isInstancedMesh=!0,o.instanceMatrix=new Zl(new Float32Array(16*i),16),o.instanceColor=null,o.count=i,o.boundingBox=null,o.boundingSphere=null;for(var s=0;s<i;s++)o.setMatrixAt(s,ec);return o}return s(n,[{key:"computeBoundingBox",value:function(){var e=this.geometry,t=this.count;null===this.boundingBox&&(this.boundingBox=new Jr),null===e.boundingBox&&e.computeBoundingBox(),this.boundingBox.makeEmpty();for(var n=0;n<t;n++)this.getMatrixAt(n,Kl),$l.copy(e.boundingBox).applyMatrix4(Kl),this.boundingBox.union($l)}},{key:"computeBoundingSphere",value:function(){var e=this.geometry,t=this.count;null===this.boundingSphere&&(this.boundingSphere=new vi),null===e.boundingSphere&&e.computeBoundingSphere(),this.boundingSphere.makeEmpty();for(var n=0;n<t;n++)this.getMatrixAt(n,Kl),nc.copy(e.boundingSphere).applyMatrix4(Kl),this.boundingSphere.union(nc)}},{key:"copy",value:function(e,t){return y(x(n.prototype),"copy",this).call(this,e,t),this.instanceMatrix.copy(e.instanceMatrix),null!==e.instanceColor&&(this.instanceColor=e.instanceColor.clone()),this.count=e.count,null!==e.boundingBox&&(this.boundingBox=e.boundingBox.clone()),null!==e.boundingSphere&&(this.boundingSphere=e.boundingSphere.clone()),this}},{key:"getColorAt",value:function(e,t){t.fromArray(this.instanceColor.array,3*e)}},{key:"getMatrixAt",value:function(e,t){t.fromArray(this.instanceMatrix.array,16*e)}},{key:"raycast",value:function(e,t){var n=this.matrixWorld,r=this.count;if(tc.geometry=this.geometry,tc.material=this.material,void 0!==tc.material&&(null===this.boundingSphere&&this.computeBoundingSphere(),nc.copy(this.boundingSphere),nc.applyMatrix4(n),!1!==e.ray.intersectsSphere(nc)))for(var i=0;i<r;i++){this.getMatrixAt(i,Kl),Jl.multiplyMatrices(n,Kl),tc.matrixWorld=Jl,tc.raycast(e,Ql);for(var a=0,o=Ql.length;a<o;a++){var s=Ql[a];s.instanceId=i,s.object=this,t.push(s)}Ql.length=0}}},{key:"setColorAt",value:function(e,t){null===this.instanceColor&&(this.instanceColor=new Zl(new Float32Array(3*this.instanceMatrix.count),3)),t.toArray(this.instanceColor.array,3*e)}},{key:"setMatrixAt",value:function(e,t){t.toArray(this.instanceMatrix.array,16*e)}},{key:"updateMorphTargets",value:function(){}},{key:"dispose",value:function(){this.dispatchEvent({type:"dispose"})}}]),n}(oo),ic=function(e){w(n,e);var t=E(n);function n(e){var r;return a(this,n),(r=t.call(this)).isLineBasicMaterial=!0,r.type="LineBasicMaterial",r.color=new pa(16777215),r.map=null,r.linewidth=1,r.linecap="round",r.linejoin="round",r.fog=!0,r.setValues(e),r}return s(n,[{key:"copy",value:function(e){return y(x(n.prototype),"copy",this).call(this,e),this.color.copy(e.color),this.map=e.map,this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this.fog=e.fog,this}}]),n}(la),ac=new Yr,oc=new Yr,sc=new wi,uc=new bi,lc=new vi,cc=function(e){w(n,e);var t=E(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Ga,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new ic;return a(this,n),(e=t.call(this)).isLine=!0,e.type="Line",e.geometry=r,e.material=i,e.updateMorphTargets(),e}return s(n,[{key:"copy",value:function(e,t){return y(x(n.prototype),"copy",this).call(this,e,t),this.material=e.material,this.geometry=e.geometry,this}},{key:"computeLineDistances",value:function(){var e=this.geometry;if(null===e.index){for(var t=e.attributes.position,n=[0],r=1,i=t.count;r<i;r++)ac.fromBufferAttribute(t,r-1),oc.fromBufferAttribute(t,r),n[r]=n[r-1],n[r]+=ac.distanceTo(oc);e.setAttribute("lineDistance",new Ia(n,1))}else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}},{key:"raycast",value:function(e,t){var n=this.geometry,r=this.matrixWorld,i=e.params.Line.threshold,a=n.drawRange;if(null===n.boundingSphere&&n.computeBoundingSphere(),lc.copy(n.boundingSphere),lc.applyMatrix4(r),lc.radius+=i,!1!==e.ray.intersectsSphere(lc)){sc.copy(r).invert(),uc.copy(e.ray).applyMatrix4(sc);var o=i/((this.scale.x+this.scale.y+this.scale.z)/3),s=o*o,u=new Yr,l=new Yr,c=new Yr,h=new Yr,d=this.isLineSegments?2:1,f=n.index,p=n.attributes.position;if(null!==f)for(var v=Math.max(0,a.start),m=Math.min(f.count,a.start+a.count)-1;v<m;v+=d){var g=f.getX(v),y=f.getX(v+1);if(u.fromBufferAttribute(p,g),l.fromBufferAttribute(p,y),!(uc.distanceSqToSegment(u,l,h,c)>s)){h.applyMatrix4(this.matrixWorld);var _=e.ray.origin.distanceTo(h);_<e.near||_>e.far||t.push({distance:_,point:c.clone().applyMatrix4(this.matrixWorld),index:v,face:null,faceIndex:null,object:this})}}else for(var x=Math.max(0,a.start),M=Math.min(p.count,a.start+a.count)-1;x<M;x+=d){if(u.fromBufferAttribute(p,x),l.fromBufferAttribute(p,x+1),!(uc.distanceSqToSegment(u,l,h,c)>s)){h.applyMatrix4(this.matrixWorld);var S=e.ray.origin.distanceTo(h);S<e.near||S>e.far||t.push({distance:S,point:c.clone().applyMatrix4(this.matrixWorld),index:x,face:null,faceIndex:null,object:this})}}}}},{key:"updateMorphTargets",value:function(){var e=this.geometry.morphAttributes,t=Object.keys(e);if(t.length>0){var n=e[t[0]];if(void 0!==n){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(var r=0,i=n.length;r<i;r++){var a=n[r].name||String(r);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=r}}}}}]),n}(Zi),hc=new Yr,dc=new Yr,fc=function(e){w(n,e);var t=E(n);function n(e,r){var i;return a(this,n),(i=t.call(this,e,r)).isLineSegments=!0,i.type="LineSegments",i}return s(n,[{key:"computeLineDistances",value:function(){var e=this.geometry;if(null===e.index){for(var t=e.attributes.position,n=[],r=0,i=t.count;r<i;r+=2)hc.fromBufferAttribute(t,r),dc.fromBufferAttribute(t,r+1),n[r]=0===r?0:n[r-1],n[r+1]=n[r]+hc.distanceTo(dc);e.setAttribute("lineDistance",new Ia(n,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}}]),n}(cc),pc=function(e){w(n,e);var t=E(n);function n(e,r){var i;return a(this,n),(i=t.call(this,e,r)).isLineLoop=!0,i.type="LineLoop",i}return s(n)}(cc),vc=function(e){w(n,e);var t=E(n);function n(e){var r;return a(this,n),(r=t.call(this)).isPointsMaterial=!0,r.type="PointsMaterial",r.color=new pa(16777215),r.map=null,r.alphaMap=null,r.size=1,r.sizeAttenuation=!0,r.fog=!0,r.setValues(e),r}return s(n,[{key:"copy",value:function(e){return y(x(n.prototype),"copy",this).call(this,e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.size=e.size,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}}]),n}(la),mc=new wi,gc=new bi,yc=new vi,_c=new Yr,xc=function(e){w(n,e);var t=E(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Ga,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new vc;return a(this,n),(e=t.call(this)).isPoints=!0,e.type="Points",e.geometry=r,e.material=i,e.updateMorphTargets(),e}return s(n,[{key:"copy",value:function(e,t){return y(x(n.prototype),"copy",this).call(this,e,t),this.material=e.material,this.geometry=e.geometry,this}},{key:"raycast",value:function(e,t){var n=this.geometry,r=this.matrixWorld,i=e.params.Points.threshold,a=n.drawRange;if(null===n.boundingSphere&&n.computeBoundingSphere(),yc.copy(n.boundingSphere),yc.applyMatrix4(r),yc.radius+=i,!1!==e.ray.intersectsSphere(yc)){mc.copy(r).invert(),gc.copy(e.ray).applyMatrix4(mc);var o=i/((this.scale.x+this.scale.y+this.scale.z)/3),s=o*o,u=n.index,l=n.attributes.position;if(null!==u)for(var c=Math.max(0,a.start),h=Math.min(u.count,a.start+a.count);c<h;c++){var d=u.getX(c);_c.fromBufferAttribute(l,d),Mc(_c,d,s,r,e,t,this)}else for(var f=Math.max(0,a.start),p=Math.min(l.count,a.start+a.count);f<p;f++)_c.fromBufferAttribute(l,f),Mc(_c,f,s,r,e,t,this)}}},{key:"updateMorphTargets",value:function(){var e=this.geometry.morphAttributes,t=Object.keys(e);if(t.length>0){var n=e[t[0]];if(void 0!==n){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(var r=0,i=n.length;r<i;r++){var a=n[r].name||String(r);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=r}}}}}]),n}(Zi);function Mc(e,t,n,r,i,a,o){var s=gc.distanceSqToPoint(e);if(s<n){var u=new Yr;gc.closestPointToPoint(e,u),u.applyMatrix4(r);var l=i.ray.origin.distanceTo(u);if(l<i.near||l>i.far)return;a.push({distance:l,distanceToRay:Math.sqrt(s),point:u,index:t,face:null,object:o})}}var Sc=function(e){w(n,e);var t=E(n);function n(e,r,i,o,s,u,l,c,h){var d;a(this,n),(d=t.call(this,e,r,i,o,s,u,l,c,h)).isVideoTexture=!0,d.minFilter=void 0!==u?u:Ve,d.magFilter=void 0!==s?s:Ve,d.generateMipmaps=!1;var f=S(d);return"requestVideoFrameCallback"in e&&e.requestVideoFrameCallback((function t(){f.needsUpdate=!0,e.requestVideoFrameCallback(t)})),d}return s(n,[{key:"clone",value:function(){return new this.constructor(this.image).copy(this)}},{key:"update",value:function(){var e=this.image;!1==="requestVideoFrameCallback"in e&&e.readyState>=e.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}}]),n}(Fr),bc=function(e){w(n,e);var t=E(n);function n(e,r){var i;return a(this,n),(i=t.call(this,{width:e,height:r})).isFramebufferTexture=!0,i.magFilter=Fe,i.minFilter=Fe,i.generateMipmaps=!1,i.needsUpdate=!0,i}return s(n)}(Fr),wc=function(e){w(n,e);var t=E(n);function n(e,r,i,o,s,u,l,c,h,d,f,p){var v;return a(this,n),(v=t.call(this,null,u,l,c,h,d,o,s,f,p)).isCompressedTexture=!0,v.image={width:r,height:i},v.mipmaps=e,v.flipY=!1,v.generateMipmaps=!1,v}return s(n)}(Fr),Tc=function(e){w(n,e);var t=E(n);function n(e,r,i,o,s,u){var l;return a(this,n),(l=t.call(this,e,r,i,s,u)).isCompressedArrayTexture=!0,l.image.depth=o,l.wrapR=Oe,l}return s(n)}(wc),Ec=function(e){w(n,e);var t=E(n);function n(e,r,i){var o;return a(this,n),(o=t.call(this,void 0,e[0].width,e[0].height,r,i,Ce)).isCompressedCubeTexture=!0,o.isCubeTexture=!0,o.image=e,o}return s(n)}(wc),Ac=function(e){w(n,e);var t=E(n);function n(e,r,i,o,s,u,l,c,h){var d;return a(this,n),(d=t.call(this,e,r,i,o,s,u,l,c,h)).isCanvasTexture=!0,d.needsUpdate=!0,d}return s(n)}(Fr),Rc=function(){function e(){a(this,e),this.type="Curve",this.arcLengthDivisions=200}return s(e,[{key:"getPoint",value:function(){return console.warn("THREE.Curve: .getPoint() not implemented."),null}},{key:"getPointAt",value:function(e,t){var n=this.getUtoTmapping(e);return this.getPoint(n,t)}},{key:"getPoints",value:function(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:5,t=[],n=0;n<=e;n++)t.push(this.getPoint(n/e));return t}},{key:"getSpacedPoints",value:function(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:5,t=[],n=0;n<=e;n++)t.push(this.getPointAt(n/e));return t}},{key:"getLength",value:function(){var e=this.getLengths();return e[e.length-1]}},{key:"getLengths",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.arcLengthDivisions;if(this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;var t,n=[],r=this.getPoint(0),i=0;n.push(0);for(var a=1;a<=e;a++)i+=(t=this.getPoint(a/e)).distanceTo(r),n.push(i),r=t;return this.cacheArcLengths=n,n}},{key:"updateArcLengths",value:function(){this.needsUpdate=!0,this.getLengths()}},{key:"getUtoTmapping",value:function(e,t){var n,r=this.getLengths(),i=0,a=r.length;n=t||e*r[a-1];for(var o,s=0,u=a-1;s<=u;)if((o=r[i=Math.floor(s+(u-s)/2)]-n)<0)s=i+1;else{if(!(o>0)){u=i;break}u=i-1}if(r[i=u]===n)return i/(a-1);var l=r[i];return(i+(n-l)/(r[i+1]-l))/(a-1)}},{key:"getTangent",value:function(e,t){var n=1e-4,r=e-n,i=e+n;r<0&&(r=0),i>1&&(i=1);var a=this.getPoint(r),o=this.getPoint(i),s=t||(a.isVector2?new mr:new Yr);return s.copy(o).sub(a).normalize(),s}},{key:"getTangentAt",value:function(e,t){var n=this.getUtoTmapping(e);return this.getTangent(n,t)}},{key:"computeFrenetFrames",value:function(e,t){for(var n=new Yr,r=[],i=[],a=[],o=new Yr,s=new wi,u=0;u<=e;u++){var l=u/e;r[u]=this.getTangentAt(l,new Yr)}i[0]=new Yr,a[0]=new Yr;var c=Number.MAX_VALUE,h=Math.abs(r[0].x),d=Math.abs(r[0].y),f=Math.abs(r[0].z);h<=c&&(c=h,n.set(1,0,0)),d<=c&&(c=d,n.set(0,1,0)),f<=c&&n.set(0,0,1),o.crossVectors(r[0],n).normalize(),i[0].crossVectors(r[0],o),a[0].crossVectors(r[0],i[0]);for(var p=1;p<=e;p++){if(i[p]=i[p-1].clone(),a[p]=a[p-1].clone(),o.crossVectors(r[p-1],r[p]),o.length()>Number.EPSILON){o.normalize();var v=Math.acos(sr(r[p-1].dot(r[p]),-1,1));i[p].applyMatrix4(s.makeRotationAxis(o,v))}a[p].crossVectors(r[p],i[p])}if(!0===t){var m=Math.acos(sr(i[0].dot(i[e]),-1,1));m/=e,r[0].dot(o.crossVectors(i[0],i[e]))>0&&(m=-m);for(var g=1;g<=e;g++)i[g].applyMatrix4(s.makeRotationAxis(r[g],m*g)),a[g].crossVectors(r[g],i[g])}return{tangents:r,normals:i,binormals:a}}},{key:"clone",value:function(){return(new this.constructor).copy(this)}},{key:"copy",value:function(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}},{key:"toJSON",value:function(){var e={metadata:{version:4.6,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e}},{key:"fromJSON",value:function(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}}]),e}(),kc=function(e){w(n,e);var t=E(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,u=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,l=arguments.length>5&&void 0!==arguments[5]?arguments[5]:2*Math.PI,c=arguments.length>6&&void 0!==arguments[6]&&arguments[6],h=arguments.length>7&&void 0!==arguments[7]?arguments[7]:0;return a(this,n),(e=t.call(this)).isEllipseCurve=!0,e.type="EllipseCurve",e.aX=r,e.aY=i,e.xRadius=o,e.yRadius=s,e.aStartAngle=u,e.aEndAngle=l,e.aClockwise=c,e.aRotation=h,e}return s(n,[{key:"getPoint",value:function(e,t){for(var n=t||new mr,r=2*Math.PI,i=this.aEndAngle-this.aStartAngle,a=Math.abs(i)<Number.EPSILON;i<0;)i+=r;for(;i>r;)i-=r;i<Number.EPSILON&&(i=a?0:r),!0!==this.aClockwise||a||(i===r?i=-r:i-=r);var o=this.aStartAngle+e*i,s=this.aX+this.xRadius*Math.cos(o),u=this.aY+this.yRadius*Math.sin(o);if(0!==this.aRotation){var l=Math.cos(this.aRotation),c=Math.sin(this.aRotation),h=s-this.aX,d=u-this.aY;s=h*l-d*c+this.aX,u=h*c+d*l+this.aY}return n.set(s,u)}},{key:"copy",value:function(e){return y(x(n.prototype),"copy",this).call(this,e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}},{key:"toJSON",value:function(){var e=y(x(n.prototype),"toJSON",this).call(this);return e.aX=this.aX,e.aY=this.aY,e.xRadius=this.xRadius,e.yRadius=this.yRadius,e.aStartAngle=this.aStartAngle,e.aEndAngle=this.aEndAngle,e.aClockwise=this.aClockwise,e.aRotation=this.aRotation,e}},{key:"fromJSON",value:function(e){return y(x(n.prototype),"fromJSON",this).call(this,e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}}]),n}(Rc),Cc=function(e){w(n,e);var t=E(n);function n(e,r,i,o,s,u){var l;return a(this,n),(l=t.call(this,e,r,i,i,o,s,u)).isArcCurve=!0,l.type="ArcCurve",l}return s(n)}(kc);function Lc(){var e=0,t=0,n=0,r=0;function i(i,a,o,s){e=i,t=o,n=-3*i+3*a-2*o-s,r=2*i-2*a+o+s}return{initCatmullRom:function(e,t,n,r,a){i(t,n,a*(n-e),a*(r-t))},initNonuniformCatmullRom:function(e,t,n,r,a,o,s){var u=(t-e)/a-(n-e)/(a+o)+(n-t)/o,l=(n-t)/o-(r-t)/(o+s)+(r-n)/s;i(t,n,u*=o,l*=o)},calc:function(i){var a=i*i;return e+t*i+n*a+r*(a*i)}}}var Pc=new Yr,Ic=new Lc,Dc=new Lc,Uc=new Lc,Oc=function(e){w(n,e);var t=E(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],i=arguments.length>1&&void 0!==arguments[1]&&arguments[1],o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"centripetal",s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:.5;return a(this,n),(e=t.call(this)).isCatmullRomCurve3=!0,e.type="CatmullRomCurve3",e.points=r,e.closed=i,e.curveType=o,e.tension=s,e}return s(n,[{key:"getPoint",value:function(e){var t,n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Yr,i=r,a=this.points,o=a.length,s=(o-(this.closed?0:1))*e,u=Math.floor(s),l=s-u;this.closed?u+=u>0?0:(Math.floor(Math.abs(u)/o)+1)*o:0===l&&u===o-1&&(u=o-2,l=1),this.closed||u>0?t=a[(u-1)%o]:(Pc.subVectors(a[0],a[1]).add(a[0]),t=Pc);var c=a[u%o],h=a[(u+1)%o];if(this.closed||u+2<o?n=a[(u+2)%o]:(Pc.subVectors(a[o-1],a[o-2]).add(a[o-1]),n=Pc),"centripetal"===this.curveType||"chordal"===this.curveType){var d="chordal"===this.curveType?.5:.25,f=Math.pow(t.distanceToSquared(c),d),p=Math.pow(c.distanceToSquared(h),d),v=Math.pow(h.distanceToSquared(n),d);p<1e-4&&(p=1),f<1e-4&&(f=p),v<1e-4&&(v=p),Ic.initNonuniformCatmullRom(t.x,c.x,h.x,n.x,f,p,v),Dc.initNonuniformCatmullRom(t.y,c.y,h.y,n.y,f,p,v),Uc.initNonuniformCatmullRom(t.z,c.z,h.z,n.z,f,p,v)}else"catmullrom"===this.curveType&&(Ic.initCatmullRom(t.x,c.x,h.x,n.x,this.tension),Dc.initCatmullRom(t.y,c.y,h.y,n.y,this.tension),Uc.initCatmullRom(t.z,c.z,h.z,n.z,this.tension));return i.set(Ic.calc(l),Dc.calc(l),Uc.calc(l)),i}},{key:"copy",value:function(e){y(x(n.prototype),"copy",this).call(this,e),this.points=[];for(var t=0,r=e.points.length;t<r;t++){var i=e.points[t];this.points.push(i.clone())}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}},{key:"toJSON",value:function(){var e=y(x(n.prototype),"toJSON",this).call(this);e.points=[];for(var t=0,r=this.points.length;t<r;t++){var i=this.points[t];e.points.push(i.toArray())}return e.closed=this.closed,e.curveType=this.curveType,e.tension=this.tension,e}},{key:"fromJSON",value:function(e){y(x(n.prototype),"fromJSON",this).call(this,e),this.points=[];for(var t=0,r=e.points.length;t<r;t++){var i=e.points[t];this.points.push((new Yr).fromArray(i))}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}}]),n}(Rc);function Nc(e,t,n,r,i){var a=.5*(r-t),o=.5*(i-n),s=e*e;return(2*n-2*r+a+o)*(e*s)+(-3*n+3*r-2*a-o)*s+a*e+n}function Fc(e,t,n,r){return function(e,t){var n=1-e;return n*n*t}(e,t)+function(e,t){return 2*(1-e)*e*t}(e,n)+function(e,t){return e*e*t}(e,r)}function Bc(e,t,n,r,i){return function(e,t){var n=1-e;return n*n*n*t}(e,t)+function(e,t){var n=1-e;return 3*n*n*e*t}(e,n)+function(e,t){return 3*(1-e)*e*e*t}(e,r)+function(e,t){return e*e*e*t}(e,i)}var zc=function(e){w(n,e);var t=E(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new mr,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new mr,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:new mr,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:new mr;return a(this,n),(e=t.call(this)).isCubicBezierCurve=!0,e.type="CubicBezierCurve",e.v0=r,e.v1=i,e.v2=o,e.v3=s,e}return s(n,[{key:"getPoint",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new mr,n=t,r=this.v0,i=this.v1,a=this.v2,o=this.v3;return n.set(Bc(e,r.x,i.x,a.x,o.x),Bc(e,r.y,i.y,a.y,o.y)),n}},{key:"copy",value:function(e){return y(x(n.prototype),"copy",this).call(this,e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}},{key:"toJSON",value:function(){var e=y(x(n.prototype),"toJSON",this).call(this);return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}},{key:"fromJSON",value:function(e){return y(x(n.prototype),"fromJSON",this).call(this,e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}}]),n}(Rc),Hc=function(e){w(n,e);var t=E(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Yr,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Yr,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:new Yr,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:new Yr;return a(this,n),(e=t.call(this)).isCubicBezierCurve3=!0,e.type="CubicBezierCurve3",e.v0=r,e.v1=i,e.v2=o,e.v3=s,e}return s(n,[{key:"getPoint",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Yr,n=t,r=this.v0,i=this.v1,a=this.v2,o=this.v3;return n.set(Bc(e,r.x,i.x,a.x,o.x),Bc(e,r.y,i.y,a.y,o.y),Bc(e,r.z,i.z,a.z,o.z)),n}},{key:"copy",value:function(e){return y(x(n.prototype),"copy",this).call(this,e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}},{key:"toJSON",value:function(){var e=y(x(n.prototype),"toJSON",this).call(this);return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}},{key:"fromJSON",value:function(e){return y(x(n.prototype),"fromJSON",this).call(this,e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}}]),n}(Rc),Gc=function(e){w(n,e);var t=E(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new mr,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new mr;return a(this,n),(e=t.call(this)).isLineCurve=!0,e.type="LineCurve",e.v1=r,e.v2=i,e}return s(n,[{key:"getPoint",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new mr,n=t;return 1===e?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(e).add(this.v1)),n}},{key:"getPointAt",value:function(e,t){return this.getPoint(e,t)}},{key:"getTangent",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new mr;return t.subVectors(this.v2,this.v1).normalize()}},{key:"getTangentAt",value:function(e,t){return this.getTangent(e,t)}},{key:"copy",value:function(e){return y(x(n.prototype),"copy",this).call(this,e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}},{key:"toJSON",value:function(){var e=y(x(n.prototype),"toJSON",this).call(this);return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}},{key:"fromJSON",value:function(e){return y(x(n.prototype),"fromJSON",this).call(this,e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}]),n}(Rc),Vc=function(e){w(n,e);var t=E(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Yr,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Yr;return a(this,n),(e=t.call(this)).isLineCurve3=!0,e.type="LineCurve3",e.v1=r,e.v2=i,e}return s(n,[{key:"getPoint",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Yr,n=t;return 1===e?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(e).add(this.v1)),n}},{key:"getPointAt",value:function(e,t){return this.getPoint(e,t)}},{key:"getTangent",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Yr;return t.subVectors(this.v2,this.v1).normalize()}},{key:"getTangentAt",value:function(e,t){return this.getTangent(e,t)}},{key:"copy",value:function(e){return y(x(n.prototype),"copy",this).call(this,e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}},{key:"toJSON",value:function(){var e=y(x(n.prototype),"toJSON",this).call(this);return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}},{key:"fromJSON",value:function(e){return y(x(n.prototype),"fromJSON",this).call(this,e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}]),n}(Rc),Wc=function(e){w(n,e);var t=E(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new mr,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new mr,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:new mr;return a(this,n),(e=t.call(this)).isQuadraticBezierCurve=!0,e.type="QuadraticBezierCurve",e.v0=r,e.v1=i,e.v2=o,e}return s(n,[{key:"getPoint",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new mr,n=t,r=this.v0,i=this.v1,a=this.v2;return n.set(Fc(e,r.x,i.x,a.x),Fc(e,r.y,i.y,a.y)),n}},{key:"copy",value:function(e){return y(x(n.prototype),"copy",this).call(this,e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}},{key:"toJSON",value:function(){var e=y(x(n.prototype),"toJSON",this).call(this);return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}},{key:"fromJSON",value:function(e){return y(x(n.prototype),"fromJSON",this).call(this,e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}]),n}(Rc),jc=function(e){w(n,e);var t=E(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Yr,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Yr,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:new Yr;return a(this,n),(e=t.call(this)).isQuadraticBezierCurve3=!0,e.type="QuadraticBezierCurve3",e.v0=r,e.v1=i,e.v2=o,e}return s(n,[{key:"getPoint",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Yr,n=t,r=this.v0,i=this.v1,a=this.v2;return n.set(Fc(e,r.x,i.x,a.x),Fc(e,r.y,i.y,a.y),Fc(e,r.z,i.z,a.z)),n}},{key:"copy",value:function(e){return y(x(n.prototype),"copy",this).call(this,e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}},{key:"toJSON",value:function(){var e=y(x(n.prototype),"toJSON",this).call(this);return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}},{key:"fromJSON",value:function(e){return y(x(n.prototype),"fromJSON",this).call(this,e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}]),n}(Rc),Xc=function(e){w(n,e);var t=E(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return a(this,n),(e=t.call(this)).isSplineCurve=!0,e.type="SplineCurve",e.points=r,e}return s(n,[{key:"getPoint",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new mr,n=t,r=this.points,i=(r.length-1)*e,a=Math.floor(i),o=i-a,s=r[0===a?a:a-1],u=r[a],l=r[a>r.length-2?r.length-1:a+1],c=r[a>r.length-3?r.length-1:a+2];return n.set(Nc(o,s.x,u.x,l.x,c.x),Nc(o,s.y,u.y,l.y,c.y)),n}},{key:"copy",value:function(e){y(x(n.prototype),"copy",this).call(this,e),this.points=[];for(var t=0,r=e.points.length;t<r;t++){var i=e.points[t];this.points.push(i.clone())}return this}},{key:"toJSON",value:function(){var e=y(x(n.prototype),"toJSON",this).call(this);e.points=[];for(var t=0,r=this.points.length;t<r;t++){var i=this.points[t];e.points.push(i.toArray())}return e}},{key:"fromJSON",value:function(e){y(x(n.prototype),"fromJSON",this).call(this,e),this.points=[];for(var t=0,r=e.points.length;t<r;t++){var i=e.points[t];this.points.push((new mr).fromArray(i))}return this}}]),n}(Rc),qc=Object.freeze({__proto__:null,ArcCurve:Cc,CatmullRomCurve3:Oc,CubicBezierCurve:zc,CubicBezierCurve3:Hc,EllipseCurve:kc,LineCurve:Gc,LineCurve3:Vc,QuadraticBezierCurve:Wc,QuadraticBezierCurve3:jc,SplineCurve:Xc}),Yc=function(e){w(n,e);var t=E(n);function n(){var e;return a(this,n),(e=t.call(this)).type="CurvePath",e.curves=[],e.autoClose=!1,e}return s(n,[{key:"add",value:function(e){this.curves.push(e)}},{key:"closePath",value:function(){var e=this.curves[0].getPoint(0),t=this.curves[this.curves.length-1].getPoint(1);e.equals(t)||this.curves.push(new Gc(t,e))}},{key:"getPoint",value:function(e,t){for(var n=e*this.getLength(),r=this.getCurveLengths(),i=0;i<r.length;){if(r[i]>=n){var a=r[i]-n,o=this.curves[i],s=o.getLength(),u=0===s?0:1-a/s;return o.getPointAt(u,t)}i++}return null}},{key:"getLength",value:function(){var e=this.getCurveLengths();return e[e.length-1]}},{key:"updateArcLengths",value:function(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}},{key:"getCurveLengths",value:function(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;for(var e=[],t=0,n=0,r=this.curves.length;n<r;n++)t+=this.curves[n].getLength(),e.push(t);return this.cacheLengths=e,e}},{key:"getSpacedPoints",value:function(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:40,t=[],n=0;n<=e;n++)t.push(this.getPoint(n/e));return this.autoClose&&t.push(t[0]),t}},{key:"getPoints",value:function(){for(var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:12,n=[],r=0,i=this.curves;r<i.length;r++)for(var a=i[r],o=a.isEllipseCurve?2*t:a.isLineCurve||a.isLineCurve3?1:a.isSplineCurve?t*a.points.length:t,s=a.getPoints(o),u=0;u<s.length;u++){var l=s[u];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}},{key:"copy",value:function(e){y(x(n.prototype),"copy",this).call(this,e),this.curves=[];for(var t=0,r=e.curves.length;t<r;t++){var i=e.curves[t];this.curves.push(i.clone())}return this.autoClose=e.autoClose,this}},{key:"toJSON",value:function(){var e=y(x(n.prototype),"toJSON",this).call(this);e.autoClose=this.autoClose,e.curves=[];for(var t=0,r=this.curves.length;t<r;t++){var i=this.curves[t];e.curves.push(i.toJSON())}return e}},{key:"fromJSON",value:function(e){y(x(n.prototype),"fromJSON",this).call(this,e),this.autoClose=e.autoClose,this.curves=[];for(var t=0,r=e.curves.length;t<r;t++){var i=e.curves[t];this.curves.push((new qc[i.type]).fromJSON(i))}return this}}]),n}(Rc),Zc=function(e){w(n,e);var t=E(n);function n(e){var r;return a(this,n),(r=t.call(this)).type="Path",r.currentPoint=new mr,e&&r.setFromPoints(e),r}return s(n,[{key:"setFromPoints",value:function(e){this.moveTo(e[0].x,e[0].y);for(var t=1,n=e.length;t<n;t++)this.lineTo(e[t].x,e[t].y);return this}},{key:"moveTo",value:function(e,t){return this.currentPoint.set(e,t),this}},{key:"lineTo",value:function(e,t){var n=new Gc(this.currentPoint.clone(),new mr(e,t));return this.curves.push(n),this.currentPoint.set(e,t),this}},{key:"quadraticCurveTo",value:function(e,t,n,r){var i=new Wc(this.currentPoint.clone(),new mr(e,t),new mr(n,r));return this.curves.push(i),this.currentPoint.set(n,r),this}},{key:"bezierCurveTo",value:function(e,t,n,r,i,a){var o=new zc(this.currentPoint.clone(),new mr(e,t),new mr(n,r),new mr(i,a));return this.curves.push(o),this.currentPoint.set(i,a),this}},{key:"splineThru",value:function(e){var t=[this.currentPoint.clone()].concat(e),n=new Xc(t);return this.curves.push(n),this.currentPoint.copy(e[e.length-1]),this}},{key:"arc",value:function(e,t,n,r,i,a){var o=this.currentPoint.x,s=this.currentPoint.y;return this.absarc(e+o,t+s,n,r,i,a),this}},{key:"absarc",value:function(e,t,n,r,i,a){return this.absellipse(e,t,n,n,r,i,a),this}},{key:"ellipse",value:function(e,t,n,r,i,a,o,s){var u=this.currentPoint.x,l=this.currentPoint.y;return this.absellipse(e+u,t+l,n,r,i,a,o,s),this}},{key:"absellipse",value:function(e,t,n,r,i,a,o,s){var u=new kc(e,t,n,r,i,a,o,s);if(this.curves.length>0){var l=u.getPoint(0);l.equals(this.currentPoint)||this.lineTo(l.x,l.y)}this.curves.push(u);var c=u.getPoint(1);return this.currentPoint.copy(c),this}},{key:"copy",value:function(e){return y(x(n.prototype),"copy",this).call(this,e),this.currentPoint.copy(e.currentPoint),this}},{key:"toJSON",value:function(){var e=y(x(n.prototype),"toJSON",this).call(this);return e.currentPoint=this.currentPoint.toArray(),e}},{key:"fromJSON",value:function(e){return y(x(n.prototype),"fromJSON",this).call(this,e),this.currentPoint.fromArray(e.currentPoint),this}}]),n}(Yc),Kc=function(e){w(n,e);var t=E(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[new mr(0,-.5),new mr(.5,0),new mr(0,.5)],i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:12,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:2*Math.PI;a(this,n),(e=t.call(this)).type="LatheGeometry",e.parameters={points:r,segments:i,phiStart:o,phiLength:s},i=Math.floor(i),s=sr(s,0,2*Math.PI);for(var u=[],l=[],c=[],h=[],d=[],f=1/i,p=new Yr,v=new mr,m=new Yr,g=new Yr,y=new Yr,_=0,x=0,M=0;M<=r.length-1;M++)switch(M){case 0:_=r[M+1].x-r[M].x,x=r[M+1].y-r[M].y,m.x=1*x,m.y=-_,m.z=0*x,y.copy(m),m.normalize(),h.push(m.x,m.y,m.z);break;case r.length-1:h.push(y.x,y.y,y.z);break;default:_=r[M+1].x-r[M].x,x=r[M+1].y-r[M].y,m.x=1*x,m.y=-_,m.z=0*x,g.copy(m),m.x+=y.x,m.y+=y.y,m.z+=y.z,m.normalize(),h.push(m.x,m.y,m.z),y.copy(g)}for(var S=0;S<=i;S++)for(var b=o+S*f*s,w=Math.sin(b),T=Math.cos(b),E=0;E<=r.length-1;E++){p.x=r[E].x*w,p.y=r[E].y,p.z=r[E].x*T,l.push(p.x,p.y,p.z),v.x=S/i,v.y=E/(r.length-1),c.push(v.x,v.y);var A=h[3*E+0]*w,R=h[3*E+1],k=h[3*E+0]*T;d.push(A,R,k)}for(var C=0;C<i;C++)for(var L=0;L<r.length-1;L++){var P=L+C*r.length,I=P,D=P+r.length,U=P+r.length+1,O=P+1;u.push(I,D,O),u.push(U,O,D)}return e.setIndex(u),e.setAttribute("position",new Ia(l,3)),e.setAttribute("uv",new Ia(c,2)),e.setAttribute("normal",new Ia(d,3)),e}return s(n,[{key:"copy",value:function(e){return y(x(n.prototype),"copy",this).call(this,e),this.parameters=Object.assign({},e.parameters),this}}],[{key:"fromJSON",value:function(e){return new n(e.points,e.segments,e.phiStart,e.phiLength)}}]),n}(Ga),Jc=function(e){w(n,e);var t=E(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:4,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:8;a(this,n);var u=new Zc;return u.absarc(0,-i/2,r,1.5*Math.PI,0),u.absarc(0,i/2,r,0,.5*Math.PI),(e=t.call(this,u.getPoints(o),s)).type="CapsuleGeometry",e.parameters={radius:r,length:i,capSegments:o,radialSegments:s},e}return s(n,null,[{key:"fromJSON",value:function(e){return new n(e.radius,e.length,e.capSegments,e.radialSegments)}}]),n}(Kc),Qc=function(e){w(n,e);var t=E(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:32,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:2*Math.PI;a(this,n),(e=t.call(this)).type="CircleGeometry",e.parameters={radius:r,segments:i,thetaStart:o,thetaLength:s},i=Math.max(3,i);var u=[],l=[],c=[],h=[],d=new Yr,f=new mr;l.push(0,0,0),c.push(0,0,1),h.push(.5,.5);for(var p=0,v=3;p<=i;p++,v+=3){var m=o+p/i*s;d.x=r*Math.cos(m),d.y=r*Math.sin(m),l.push(d.x,d.y,d.z),c.push(0,0,1),f.x=(l[v]/r+1)/2,f.y=(l[v+1]/r+1)/2,h.push(f.x,f.y)}for(var g=1;g<=i;g++)u.push(g,g+1,0);return e.setIndex(u),e.setAttribute("position",new Ia(l,3)),e.setAttribute("normal",new Ia(c,3)),e.setAttribute("uv",new Ia(h,2)),e}return s(n,[{key:"copy",value:function(e){return y(x(n.prototype),"copy",this).call(this,e),this.parameters=Object.assign({},e.parameters),this}}],[{key:"fromJSON",value:function(e){return new n(e.radius,e.segments,e.thetaStart,e.thetaLength)}}]),n}(Ga),$c=function(e){w(n,e);var t=E(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:32,u=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1,l=arguments.length>5&&void 0!==arguments[5]&&arguments[5],c=arguments.length>6&&void 0!==arguments[6]?arguments[6]:0,h=arguments.length>7&&void 0!==arguments[7]?arguments[7]:2*Math.PI;a(this,n),(e=t.call(this)).type="CylinderGeometry",e.parameters={radiusTop:r,radiusBottom:i,height:o,radialSegments:s,heightSegments:u,openEnded:l,thetaStart:c,thetaLength:h};var d=S(e);s=Math.floor(s),u=Math.floor(u);var f=[],p=[],v=[],m=[],g=0,y=[],_=o/2,x=0;function M(){for(var e=new Yr,t=new Yr,n=0,a=(i-r)/o,l=0;l<=u;l++){for(var M=[],S=l/u,b=S*(i-r)+r,w=0;w<=s;w++){var T=w/s,E=T*h+c,A=Math.sin(E),R=Math.cos(E);t.x=b*A,t.y=-S*o+_,t.z=b*R,p.push(t.x,t.y,t.z),e.set(A,a,R).normalize(),v.push(e.x,e.y,e.z),m.push(T,1-S),M.push(g++)}y.push(M)}for(var k=0;k<s;k++)for(var C=0;C<u;C++){var L=y[C][k],P=y[C+1][k],I=y[C+1][k+1],D=y[C][k+1];f.push(L,P,D),f.push(P,I,D),n+=6}d.addGroup(x,n,0),x+=n}function b(e){for(var t=g,n=new mr,a=new Yr,o=0,u=!0===e?r:i,l=!0===e?1:-1,y=1;y<=s;y++)p.push(0,_*l,0),v.push(0,l,0),m.push(.5,.5),g++;for(var M=g,S=0;S<=s;S++){var b=S/s*h+c,w=Math.cos(b),T=Math.sin(b);a.x=u*T,a.y=_*l,a.z=u*w,p.push(a.x,a.y,a.z),v.push(0,l,0),n.x=.5*w+.5,n.y=.5*T*l+.5,m.push(n.x,n.y),g++}for(var E=0;E<s;E++){var A=t+E,R=M+E;!0===e?f.push(R,R+1,A):f.push(R+1,R,A),o+=3}d.addGroup(x,o,!0===e?1:2),x+=o}return M(),!1===l&&(r>0&&b(!0),i>0&&b(!1)),e.setIndex(f),e.setAttribute("position",new Ia(p,3)),e.setAttribute("normal",new Ia(v,3)),e.setAttribute("uv",new Ia(m,2)),e}return s(n,[{key:"copy",value:function(e){return y(x(n.prototype),"copy",this).call(this,e),this.parameters=Object.assign({},e.parameters),this}}],[{key:"fromJSON",value:function(e){return new n(e.radiusTop,e.radiusBottom,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}]),n}(Ga),eh=function(e){w(n,e);var t=E(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:32,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,u=arguments.length>4&&void 0!==arguments[4]&&arguments[4],l=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,c=arguments.length>6&&void 0!==arguments[6]?arguments[6]:2*Math.PI;return a(this,n),(e=t.call(this,0,r,i,o,s,u,l,c)).type="ConeGeometry",e.parameters={radius:r,height:i,radialSegments:o,heightSegments:s,openEnded:u,thetaStart:l,thetaLength:c},e}return s(n,null,[{key:"fromJSON",value:function(e){return new n(e.radius,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}]),n}($c),th=function(e){w(n,e);var t=E(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;a(this,n),(e=t.call(this)).type="PolyhedronGeometry",e.parameters={vertices:r,indices:i,radius:o,detail:s};var u=[],l=[];function c(e){for(var t=new Yr,n=new Yr,r=new Yr,a=0;a<i.length;a+=3)m(i[a+0],t),m(i[a+1],n),m(i[a+2],r),h(t,n,r,e)}function h(e,t,n,r){for(var i=r+1,a=[],o=0;o<=i;o++){a[o]=[];for(var s=e.clone().lerp(n,o/i),u=t.clone().lerp(n,o/i),l=i-o,c=0;c<=l;c++)a[o][c]=0===c&&o===i?s:s.clone().lerp(u,c/l)}for(var h=0;h<i;h++)for(var d=0;d<2*(i-h)-1;d++){var f=Math.floor(d/2);d%2==0?(v(a[h][f+1]),v(a[h+1][f]),v(a[h][f])):(v(a[h][f+1]),v(a[h+1][f+1]),v(a[h+1][f]))}}function d(e){for(var t=new Yr,n=0;n<u.length;n+=3)t.x=u[n+0],t.y=u[n+1],t.z=u[n+2],t.normalize().multiplyScalar(e),u[n+0]=t.x,u[n+1]=t.y,u[n+2]=t.z}function f(){for(var e=new Yr,t=0;t<u.length;t+=3){e.x=u[t+0],e.y=u[t+1],e.z=u[t+2];var n=_(e)/2/Math.PI+.5,r=x(e)/Math.PI+.5;l.push(n,1-r)}g(),p()}function p(){for(var e=0;e<l.length;e+=6){var t=l[e+0],n=l[e+2],r=l[e+4],i=Math.max(t,n,r),a=Math.min(t,n,r);i>.9&&a<.1&&(t<.2&&(l[e+0]+=1),n<.2&&(l[e+2]+=1),r<.2&&(l[e+4]+=1))}}function v(e){u.push(e.x,e.y,e.z)}function m(e,t){var n=3*e;t.x=r[n+0],t.y=r[n+1],t.z=r[n+2]}function g(){for(var e=new Yr,t=new Yr,n=new Yr,r=new Yr,i=new mr,a=new mr,o=new mr,s=0,c=0;s<u.length;s+=9,c+=6){e.set(u[s+0],u[s+1],u[s+2]),t.set(u[s+3],u[s+4],u[s+5]),n.set(u[s+6],u[s+7],u[s+8]),i.set(l[c+0],l[c+1]),a.set(l[c+2],l[c+3]),o.set(l[c+4],l[c+5]),r.copy(e).add(t).add(n).divideScalar(3);var h=_(r);y(i,c+0,e,h),y(a,c+2,t,h),y(o,c+4,n,h)}}function y(e,t,n,r){r<0&&1===e.x&&(l[t]=e.x-1),0===n.x&&0===n.z&&(l[t]=r/2/Math.PI+.5)}function _(e){return Math.atan2(e.z,-e.x)}function x(e){return Math.atan2(-e.y,Math.sqrt(e.x*e.x+e.z*e.z))}return c(s),d(o),f(),e.setAttribute("position",new Ia(u,3)),e.setAttribute("normal",new Ia(u.slice(),3)),e.setAttribute("uv",new Ia(l,2)),0===s?e.computeVertexNormals():e.normalizeNormals(),e}return s(n,[{key:"copy",value:function(e){return y(x(n.prototype),"copy",this).call(this,e),this.parameters=Object.assign({},e.parameters),this}}],[{key:"fromJSON",value:function(e){return new n(e.vertices,e.indices,e.radius,e.details)}}]),n}(Ga),nh=function(e){w(n,e);var t=E(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;a(this,n);var o=(1+Math.sqrt(5))/2,s=1/o,u=[-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,-s,-o,0,-s,o,0,s,-o,0,s,o,-s,-o,0,-s,o,0,s,-o,0,s,o,0,-o,0,-s,o,0,-s,-o,0,s,o,0,s],l=[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1,18,0,18,16,6,10,2,6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,11,19,7,19,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9];return(e=t.call(this,u,l,r,i)).type="DodecahedronGeometry",e.parameters={radius:r,detail:i},e}return s(n,null,[{key:"fromJSON",value:function(e){return new n(e.radius,e.detail)}}]),n}(th),rh=new Yr,ih=new Yr,ah=new Yr,oh=new sa,sh=function(e){w(n,e);var t=E(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;if(a(this,n),(e=t.call(this)).type="EdgesGeometry",e.parameters={geometry:r,thresholdAngle:i},null!==r){for(var o=4,s=Math.pow(10,o),u=Math.cos(ir*i),l=r.getIndex(),c=r.getAttribute("position"),h=l?l.count:c.count,d=[0,0,0],f=["a","b","c"],p=new Array(3),v={},m=[],g=0;g<h;g+=3){l?(d[0]=l.getX(g),d[1]=l.getX(g+1),d[2]=l.getX(g+2)):(d[0]=g,d[1]=g+1,d[2]=g+2);var y=oh.a,_=oh.b,x=oh.c;if(y.fromBufferAttribute(c,d[0]),_.fromBufferAttribute(c,d[1]),x.fromBufferAttribute(c,d[2]),oh.getNormal(ah),p[0]="".concat(Math.round(y.x*s),",").concat(Math.round(y.y*s),",").concat(Math.round(y.z*s)),p[1]="".concat(Math.round(_.x*s),",").concat(Math.round(_.y*s),",").concat(Math.round(_.z*s)),p[2]="".concat(Math.round(x.x*s),",").concat(Math.round(x.y*s),",").concat(Math.round(x.z*s)),p[0]!==p[1]&&p[1]!==p[2]&&p[2]!==p[0])for(var M=0;M<3;M++){var S=(M+1)%3,b=p[M],w=p[S],T=oh[f[M]],E=oh[f[S]],A="".concat(b,"_").concat(w),R="".concat(w,"_").concat(b);R in v&&v[R]?(ah.dot(v[R].normal)<=u&&(m.push(T.x,T.y,T.z),m.push(E.x,E.y,E.z)),v[R]=null):A in v||(v[A]={index0:d[M],index1:d[S],normal:ah.clone()})}}for(var k in v)if(v[k]){var C=v[k],L=C.index0,P=C.index1;rh.fromBufferAttribute(c,L),ih.fromBufferAttribute(c,P),m.push(rh.x,rh.y,rh.z),m.push(ih.x,ih.y,ih.z)}e.setAttribute("position",new Ia(m,3))}return e}return s(n,[{key:"copy",value:function(e){return y(x(n.prototype),"copy",this).call(this,e),this.parameters=Object.assign({},e.parameters),this}}]),n}(Ga),uh=function(e){w(n,e);var t=E(n);function n(e){var r;return a(this,n),(r=t.call(this,e)).uuid=or(),r.type="Shape",r.holes=[],r}return s(n,[{key:"getPointsHoles",value:function(e){for(var t=[],n=0,r=this.holes.length;n<r;n++)t[n]=this.holes[n].getPoints(e);return t}},{key:"extractPoints",value:function(e){return{shape:this.getPoints(e),holes:this.getPointsHoles(e)}}},{key:"copy",value:function(e){y(x(n.prototype),"copy",this).call(this,e),this.holes=[];for(var t=0,r=e.holes.length;t<r;t++){var i=e.holes[t];this.holes.push(i.clone())}return this}},{key:"toJSON",value:function(){var e=y(x(n.prototype),"toJSON",this).call(this);e.uuid=this.uuid,e.holes=[];for(var t=0,r=this.holes.length;t<r;t++){var i=this.holes[t];e.holes.push(i.toJSON())}return e}},{key:"fromJSON",value:function(e){y(x(n.prototype),"fromJSON",this).call(this,e),this.uuid=e.uuid,this.holes=[];for(var t=0,r=e.holes.length;t<r;t++){var i=e.holes[t];this.holes.push((new Zc).fromJSON(i))}return this}}]),n}(Zc),lh=function(e,t){var n,r,i,a,o,s,u,l=arguments.length>2&&void 0!==arguments[2]?arguments[2]:2,c=t&&t.length,h=c?t[0]*l:e.length,d=ch(e,0,h,l,!0),f=[];if(!d||d.next===d.prev)return f;if(c&&(d=gh(e,t,d,l)),e.length>80*l){n=i=e[0],r=a=e[1];for(var p=l;p<h;p+=l)(o=e[p])<n&&(n=o),(s=e[p+1])<r&&(r=s),o>i&&(i=o),s>a&&(a=s);u=0!==(u=Math.max(i-n,a-r))?32767/u:0}return dh(d,f,l,n,r,u,0),f};function ch(e,t,n,r,i){var a,o;if(i===function(e,t,n,r){for(var i=0,a=t,o=n-r;a<n;a+=r)i+=(e[o]-e[a])*(e[a+1]+e[o+1]),o=a;return i}(e,t,n,r)>0)for(a=t;a<n;a+=r)o=Ph(a,e[a],e[a+1],o);else for(a=n-r;a>=t;a-=r)o=Ph(a,e[a],e[a+1],o);return o&&Eh(o,o.next)&&(Ih(o),o=o.next),o}function hh(e,t){if(!e)return e;t||(t=e);var n,r=e;do{if(n=!1,r.steiner||!Eh(r,r.next)&&0!==Th(r.prev,r,r.next))r=r.next;else{if(Ih(r),(r=t=r.prev)===r.next)break;n=!0}}while(n||r!==t);return t}function dh(e,t,n,r,i,a,o){if(e){!o&&a&&function(e,t,n,r){var i=e;do{0===i.z&&(i.z=Mh(i.x,i.y,t,n,r)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next}while(i!==e);i.prevZ.nextZ=null,i.prevZ=null,function(e){var t,n,r,i,a,o,s,u,l=1;do{for(n=e,e=null,a=null,o=0;n;){for(o++,r=n,s=0,t=0;t<l&&(s++,r=r.nextZ);t++);for(u=l;s>0||u>0&&r;)0!==s&&(0===u||!r||n.z<=r.z)?(i=n,n=n.nextZ,s--):(i=r,r=r.nextZ,u--),a?a.nextZ=i:e=i,i.prevZ=a,a=i;n=r}a.nextZ=null,l*=2}while(o>1)}(i)}(e,r,i,a);for(var s,u,l=e;e.prev!==e.next;)if(s=e.prev,u=e.next,a?ph(e,r,i,a):fh(e))t.push(s.i/n|0),t.push(e.i/n|0),t.push(u.i/n|0),Ih(e),e=u.next,l=u.next;else if((e=u)===l){o?1===o?dh(e=vh(hh(e),t,n),t,n,r,i,a,2):2===o&&mh(e,t,n,r,i,a):dh(hh(e),t,n,r,i,a,1);break}}}function fh(e){var t=e.prev,n=e,r=e.next;if(Th(t,n,r)>=0)return!1;for(var i=t.x,a=n.x,o=r.x,s=t.y,u=n.y,l=r.y,c=i<a?i<o?i:o:a<o?a:o,h=s<u?s<l?s:l:u<l?u:l,d=i>a?i>o?i:o:a>o?a:o,f=s>u?s>l?s:l:u>l?u:l,p=r.next;p!==t;){if(p.x>=c&&p.x<=d&&p.y>=h&&p.y<=f&&bh(i,s,a,u,o,l,p.x,p.y)&&Th(p.prev,p,p.next)>=0)return!1;p=p.next}return!0}function ph(e,t,n,r){var i=e.prev,a=e,o=e.next;if(Th(i,a,o)>=0)return!1;for(var s=i.x,u=a.x,l=o.x,c=i.y,h=a.y,d=o.y,f=s<u?s<l?s:l:u<l?u:l,p=c<h?c<d?c:d:h<d?h:d,v=s>u?s>l?s:l:u>l?u:l,m=c>h?c>d?c:d:h>d?h:d,g=Mh(f,p,t,n,r),y=Mh(v,m,t,n,r),_=e.prevZ,x=e.nextZ;_&&_.z>=g&&x&&x.z<=y;){if(_.x>=f&&_.x<=v&&_.y>=p&&_.y<=m&&_!==i&&_!==o&&bh(s,c,u,h,l,d,_.x,_.y)&&Th(_.prev,_,_.next)>=0)return!1;if(_=_.prevZ,x.x>=f&&x.x<=v&&x.y>=p&&x.y<=m&&x!==i&&x!==o&&bh(s,c,u,h,l,d,x.x,x.y)&&Th(x.prev,x,x.next)>=0)return!1;x=x.nextZ}for(;_&&_.z>=g;){if(_.x>=f&&_.x<=v&&_.y>=p&&_.y<=m&&_!==i&&_!==o&&bh(s,c,u,h,l,d,_.x,_.y)&&Th(_.prev,_,_.next)>=0)return!1;_=_.prevZ}for(;x&&x.z<=y;){if(x.x>=f&&x.x<=v&&x.y>=p&&x.y<=m&&x!==i&&x!==o&&bh(s,c,u,h,l,d,x.x,x.y)&&Th(x.prev,x,x.next)>=0)return!1;x=x.nextZ}return!0}function vh(e,t,n){var r=e;do{var i=r.prev,a=r.next.next;!Eh(i,a)&&Ah(i,r,r.next,a)&&Ch(i,a)&&Ch(a,i)&&(t.push(i.i/n|0),t.push(r.i/n|0),t.push(a.i/n|0),Ih(r),Ih(r.next),r=e=a),r=r.next}while(r!==e);return hh(r)}function mh(e,t,n,r,i,a){var o=e;do{for(var s=o.next.next;s!==o.prev;){if(o.i!==s.i&&wh(o,s)){var u=Lh(o,s);return o=hh(o,o.next),u=hh(u,u.next),dh(o,t,n,r,i,a,0),void dh(u,t,n,r,i,a,0)}s=s.next}o=o.next}while(o!==e)}function gh(e,t,n,r){var i,a,o,s=[];for(i=0,a=t.length;i<a;i++)(o=ch(e,t[i]*r,i<a-1?t[i+1]*r:e.length,r,!1))===o.next&&(o.steiner=!0),s.push(Sh(o));for(s.sort(yh),i=0;i<s.length;i++)n=_h(s[i],n);return n}function yh(e,t){return e.x-t.x}function _h(e,t){var n=function(e,t){var n,r=t,i=-1/0,a=e.x,o=e.y;do{if(o<=r.y&&o>=r.next.y&&r.next.y!==r.y){var s=r.x+(o-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(s<=a&&s>i&&(i=s,n=r.x<r.next.x?r:r.next,s===a))return n}r=r.next}while(r!==t);if(!n)return null;var u,l=n,c=n.x,h=n.y,d=1/0;r=n;do{a>=r.x&&r.x>=c&&a!==r.x&&bh(o<h?a:i,o,c,h,o<h?i:a,o,r.x,r.y)&&(u=Math.abs(o-r.y)/(a-r.x),Ch(r,e)&&(u<d||u===d&&(r.x>n.x||r.x===n.x&&xh(n,r)))&&(n=r,d=u)),r=r.next}while(r!==l);return n}(e,t);if(!n)return t;var r=Lh(n,e);return hh(r,r.next),hh(n,n.next)}function xh(e,t){return Th(e.prev,e,t.prev)<0&&Th(t.next,e,e.next)<0}function Mh(e,t,n,r,i){return(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-n)*i|0)|e<<8))|e<<4))|e<<2))|e<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-r)*i|0)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function Sh(e){var t=e,n=e;do{(t.x<n.x||t.x===n.x&&t.y<n.y)&&(n=t),t=t.next}while(t!==e);return n}function bh(e,t,n,r,i,a,o,s){return(i-o)*(t-s)>=(e-o)*(a-s)&&(e-o)*(r-s)>=(n-o)*(t-s)&&(n-o)*(a-s)>=(i-o)*(r-s)}function wh(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!function(e,t){var n=e;do{if(n.i!==e.i&&n.next.i!==e.i&&n.i!==t.i&&n.next.i!==t.i&&Ah(n,n.next,e,t))return!0;n=n.next}while(n!==e);return!1}(e,t)&&(Ch(e,t)&&Ch(t,e)&&function(e,t){var n=e,r=!1,i=(e.x+t.x)/2,a=(e.y+t.y)/2;do{n.y>a!=n.next.y>a&&n.next.y!==n.y&&i<(n.next.x-n.x)*(a-n.y)/(n.next.y-n.y)+n.x&&(r=!r),n=n.next}while(n!==e);return r}(e,t)&&(Th(e.prev,e,t.prev)||Th(e,t.prev,t))||Eh(e,t)&&Th(e.prev,e,e.next)>0&&Th(t.prev,t,t.next)>0)}function Th(e,t,n){return(t.y-e.y)*(n.x-t.x)-(t.x-e.x)*(n.y-t.y)}function Eh(e,t){return e.x===t.x&&e.y===t.y}function Ah(e,t,n,r){var i=kh(Th(e,t,n)),a=kh(Th(e,t,r)),o=kh(Th(n,r,e)),s=kh(Th(n,r,t));return i!==a&&o!==s||(!(0!==i||!Rh(e,n,t))||(!(0!==a||!Rh(e,r,t))||(!(0!==o||!Rh(n,e,r))||!(0!==s||!Rh(n,t,r)))))}function Rh(e,t,n){return t.x<=Math.max(e.x,n.x)&&t.x>=Math.min(e.x,n.x)&&t.y<=Math.max(e.y,n.y)&&t.y>=Math.min(e.y,n.y)}function kh(e){return e>0?1:e<0?-1:0}function Ch(e,t){return Th(e.prev,e,e.next)<0?Th(e,t,e.next)>=0&&Th(e,e.prev,t)>=0:Th(e,t,e.prev)<0||Th(e,e.next,t)<0}function Lh(e,t){var n=new Dh(e.i,e.x,e.y),r=new Dh(t.i,t.x,t.y),i=e.next,a=t.prev;return e.next=t,t.prev=e,n.next=i,i.prev=n,r.next=n,n.prev=r,a.next=r,r.prev=a,r}function Ph(e,t,n,r){var i=new Dh(e,t,n);return r?(i.next=r.next,i.prev=r,r.next.prev=i,r.next=i):(i.prev=i,i.next=i),i}function Ih(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}function Dh(e,t,n){this.i=e,this.x=t,this.y=n,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}var Uh=function(){function e(){a(this,e)}return s(e,null,[{key:"area",value:function(e){for(var t=e.length,n=0,r=t-1,i=0;i<t;r=i++)n+=e[r].x*e[i].y-e[i].x*e[r].y;return.5*n}},{key:"isClockWise",value:function(t){return e.area(t)<0}},{key:"triangulateShape",value:function(e,t){var n=[],r=[],i=[];Oh(e),Nh(n,e);var a=e.length;t.forEach(Oh);for(var o=0;o<t.length;o++)r.push(a),a+=t[o].length,Nh(n,t[o]);for(var s=lh(n,r),u=0;u<s.length;u+=3)i.push(s.slice(u,u+3));return i}}]),e}();function Oh(e){var t=e.length;t>2&&e[t-1].equals(e[0])&&e.pop()}function Nh(e,t){for(var n=0;n<t.length;n++)e.push(t[n].x),e.push(t[n].y)}var Fh=function(e){w(n,e);var t=E(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new uh([new mr(.5,.5),new mr(-.5,.5),new mr(-.5,-.5),new mr(.5,-.5)]),i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};a(this,n),(e=t.call(this)).type="ExtrudeGeometry",e.parameters={shapes:r,options:i},r=Array.isArray(r)?r:[r];for(var o=S(e),s=[],u=[],l=0,c=r.length;l<c;l++){var h=r[l];d(h)}function d(e){var t,n,r,a,l,c=[],h=void 0!==i.curveSegments?i.curveSegments:12,d=void 0!==i.steps?i.steps:1,f=void 0!==i.depth?i.depth:1,p=void 0===i.bevelEnabled||i.bevelEnabled,v=void 0!==i.bevelThickness?i.bevelThickness:.2,m=void 0!==i.bevelSize?i.bevelSize:v-.1,g=void 0!==i.bevelOffset?i.bevelOffset:0,y=void 0!==i.bevelSegments?i.bevelSegments:3,_=i.extrudePath,x=void 0!==i.UVGenerator?i.UVGenerator:Bh,M=!1;_&&(t=_.getSpacedPoints(d),M=!0,p=!1,n=_.computeFrenetFrames(d,!1),r=new Yr,a=new Yr,l=new Yr),p||(y=0,v=0,m=0,g=0);var S=e.extractPoints(h),b=S.shape,w=S.holes;if(!Uh.isClockWise(b)){b=b.reverse();for(var T=0,E=w.length;T<E;T++){var A=w[T];Uh.isClockWise(A)&&(w[T]=A.reverse())}}for(var R=Uh.triangulateShape(b,w),k=b,C=0,L=w.length;C<L;C++){var P=w[C];b=b.concat(P)}function I(e,t,n){return t||console.error("THREE.ExtrudeGeometry: vec does not exist"),e.clone().addScaledVector(t,n)}var D=b.length,U=R.length;function O(e,t,n){var r,i,a,o=e.x-t.x,s=e.y-t.y,u=n.x-e.x,l=n.y-e.y,c=o*o+s*s,h=o*l-s*u;if(Math.abs(h)>Number.EPSILON){var d=Math.sqrt(c),f=Math.sqrt(u*u+l*l),p=t.x-s/d,v=t.y+o/d,m=((n.x-l/f-p)*l-(n.y+u/f-v)*u)/(o*l-s*u),g=(r=p+o*m-e.x)*r+(i=v+s*m-e.y)*i;if(g<=2)return new mr(r,i);a=Math.sqrt(g/2)}else{var y=!1;o>Number.EPSILON?u>Number.EPSILON&&(y=!0):o<-Number.EPSILON?u<-Number.EPSILON&&(y=!0):Math.sign(s)===Math.sign(l)&&(y=!0),y?(r=-s,i=o,a=Math.sqrt(c)):(r=o,i=s,a=Math.sqrt(c/2))}return new mr(r/a,i/a)}for(var N=[],F=0,B=k.length,z=B-1,H=F+1;F<B;F++,z++,H++)z===B&&(z=0),H===B&&(H=0),N[F]=O(k[F],k[z],k[H]);for(var G,V=[],W=N.concat(),j=0,X=w.length;j<X;j++){var q=w[j];G=[];for(var Y=0,Z=q.length,K=Z-1,J=Y+1;Y<Z;Y++,K++,J++)K===Z&&(K=0),J===Z&&(J=0),G[Y]=O(q[Y],q[K],q[J]);V.push(G),W=W.concat(G)}for(var Q=0;Q<y;Q++){for(var $=Q/y,ee=v*Math.cos($*Math.PI/2),te=m*Math.sin($*Math.PI/2)+g,ne=0,re=k.length;ne<re;ne++){var ie=I(k[ne],N[ne],te);Le(ie.x,ie.y,-ee)}for(var ae=0,oe=w.length;ae<oe;ae++){var se=w[ae];G=V[ae];for(var ue=0,le=se.length;ue<le;ue++){var ce=I(se[ue],G[ue],te);Le(ce.x,ce.y,-ee)}}}for(var he=m+g,de=0;de<D;de++){var fe=p?I(b[de],W[de],he):b[de];M?(a.copy(n.normals[0]).multiplyScalar(fe.x),r.copy(n.binormals[0]).multiplyScalar(fe.y),l.copy(t[0]).add(a).add(r),Le(l.x,l.y,l.z)):Le(fe.x,fe.y,0)}for(var pe=1;pe<=d;pe++)for(var ve=0;ve<D;ve++){var me=p?I(b[ve],W[ve],he):b[ve];M?(a.copy(n.normals[pe]).multiplyScalar(me.x),r.copy(n.binormals[pe]).multiplyScalar(me.y),l.copy(t[pe]).add(a).add(r),Le(l.x,l.y,l.z)):Le(me.x,me.y,f/d*pe)}for(var ge=y-1;ge>=0;ge--){for(var ye=ge/y,_e=v*Math.cos(ye*Math.PI/2),xe=m*Math.sin(ye*Math.PI/2)+g,Me=0,Se=k.length;Me<Se;Me++){var be=I(k[Me],N[Me],xe);Le(be.x,be.y,f+_e)}for(var we=0,Te=w.length;we<Te;we++){var Ee=w[we];G=V[we];for(var Ae=0,Re=Ee.length;Ae<Re;Ae++){var ke=I(Ee[Ae],G[Ae],xe);M?Le(ke.x,ke.y+t[d-1].y,t[d-1].x+_e):Le(ke.x,ke.y,f+_e)}}}function Ce(e,t){for(var n=e.length;--n>=0;){var r=n,i=n-1;i<0&&(i=e.length-1);for(var a=0,o=d+2*y;a<o;a++){var s=D*a,u=D*(a+1);Ie(t+r+s,t+i+s,t+i+u,t+r+u)}}}function Le(e,t,n){c.push(e),c.push(t),c.push(n)}function Pe(e,t,n){De(e),De(t),De(n);var r=s.length/3,i=x.generateTopUV(o,s,r-3,r-2,r-1);Ue(i[0]),Ue(i[1]),Ue(i[2])}function Ie(e,t,n,r){De(e),De(t),De(r),De(t),De(n),De(r);var i=s.length/3,a=x.generateSideWallUV(o,s,i-6,i-3,i-2,i-1);Ue(a[0]),Ue(a[1]),Ue(a[3]),Ue(a[1]),Ue(a[2]),Ue(a[3])}function De(e){s.push(c[3*e+0]),s.push(c[3*e+1]),s.push(c[3*e+2])}function Ue(e){u.push(e.x),u.push(e.y)}!function(){var e=s.length/3;if(p){for(var t=0,n=D*t,r=0;r<U;r++){var i=R[r];Pe(i[2]+n,i[1]+n,i[0]+n)}n=D*(t=d+2*y);for(var a=0;a<U;a++){var u=R[a];Pe(u[0]+n,u[1]+n,u[2]+n)}}else{for(var l=0;l<U;l++){var c=R[l];Pe(c[2],c[1],c[0])}for(var h=0;h<U;h++){var f=R[h];Pe(f[0]+D*d,f[1]+D*d,f[2]+D*d)}}o.addGroup(e,s.length/3-e,0)}(),function(){var e=s.length/3,t=0;Ce(k,t),t+=k.length;for(var n=0,r=w.length;n<r;n++){var i=w[n];Ce(i,t),t+=i.length}o.addGroup(e,s.length/3-e,1)}()}return e.setAttribute("position",new Ia(s,3)),e.setAttribute("uv",new Ia(u,2)),e.computeVertexNormals(),e}return s(n,[{key:"copy",value:function(e){return y(x(n.prototype),"copy",this).call(this,e),this.parameters=Object.assign({},e.parameters),this}},{key:"toJSON",value:function(){var e=y(x(n.prototype),"toJSON",this).call(this);return function(e,t,n){if(n.shapes=[],Array.isArray(e))for(var r=0,i=e.length;r<i;r++){var a=e[r];n.shapes.push(a.uuid)}else n.shapes.push(e.uuid);n.options=Object.assign({},t),void 0!==t.extrudePath&&(n.options.extrudePath=t.extrudePath.toJSON());return n}(this.parameters.shapes,this.parameters.options,e)}}],[{key:"fromJSON",value:function(e,t){for(var r=[],i=0,a=e.shapes.length;i<a;i++){var o=t[e.shapes[i]];r.push(o)}var s=e.options.extrudePath;return void 0!==s&&(e.options.extrudePath=(new qc[s.type]).fromJSON(s)),new n(r,e.options)}}]),n}(Ga),Bh={generateTopUV:function(e,t,n,r,i){var a=t[3*n],o=t[3*n+1],s=t[3*r],u=t[3*r+1],l=t[3*i],c=t[3*i+1];return[new mr(a,o),new mr(s,u),new mr(l,c)]},generateSideWallUV:function(e,t,n,r,i,a){var o=t[3*n],s=t[3*n+1],u=t[3*n+2],l=t[3*r],c=t[3*r+1],h=t[3*r+2],d=t[3*i],f=t[3*i+1],p=t[3*i+2],v=t[3*a],m=t[3*a+1],g=t[3*a+2];return Math.abs(s-c)<Math.abs(o-l)?[new mr(o,1-u),new mr(l,1-h),new mr(d,1-p),new mr(v,1-g)]:[new mr(s,1-u),new mr(c,1-h),new mr(f,1-p),new mr(m,1-g)]}};var zh=function(e){w(n,e);var t=E(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;a(this,n);var o=(1+Math.sqrt(5))/2,s=[-1,o,0,1,o,0,-1,-o,0,1,-o,0,0,-1,o,0,1,o,0,-1,-o,0,1,-o,o,0,-1,o,0,1,-o,0,-1,-o,0,1],u=[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];return(e=t.call(this,s,u,r,i)).type="IcosahedronGeometry",e.parameters={radius:r,detail:i},e}return s(n,null,[{key:"fromJSON",value:function(e){return new n(e.radius,e.detail)}}]),n}(th),Hh=function(e){w(n,e);var t=E(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;a(this,n);var o=[1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],s=[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2];return(e=t.call(this,o,s,r,i)).type="OctahedronGeometry",e.parameters={radius:r,detail:i},e}return s(n,null,[{key:"fromJSON",value:function(e){return new n(e.radius,e.detail)}}]),n}(th),Gh=function(e){w(n,e);var t=E(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:.5,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:32,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,u=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,l=arguments.length>5&&void 0!==arguments[5]?arguments[5]:2*Math.PI;a(this,n),(e=t.call(this)).type="RingGeometry",e.parameters={innerRadius:r,outerRadius:i,thetaSegments:o,phiSegments:s,thetaStart:u,thetaLength:l},o=Math.max(3,o);for(var c=[],h=[],d=[],f=[],p=r,v=(i-r)/(s=Math.max(1,s)),m=new Yr,g=new mr,y=0;y<=s;y++){for(var _=0;_<=o;_++){var x=u+_/o*l;m.x=p*Math.cos(x),m.y=p*Math.sin(x),h.push(m.x,m.y,m.z),d.push(0,0,1),g.x=(m.x/i+1)/2,g.y=(m.y/i+1)/2,f.push(g.x,g.y)}p+=v}for(var M=0;M<s;M++)for(var S=M*(o+1),b=0;b<o;b++){var w=b+S,T=w,E=w+o+1,A=w+o+2,R=w+1;c.push(T,E,R),c.push(E,A,R)}return e.setIndex(c),e.setAttribute("position",new Ia(h,3)),e.setAttribute("normal",new Ia(d,3)),e.setAttribute("uv",new Ia(f,2)),e}return s(n,[{key:"copy",value:function(e){return y(x(n.prototype),"copy",this).call(this,e),this.parameters=Object.assign({},e.parameters),this}}],[{key:"fromJSON",value:function(e){return new n(e.innerRadius,e.outerRadius,e.thetaSegments,e.phiSegments,e.thetaStart,e.thetaLength)}}]),n}(Ga),Vh=function(e){w(n,e);var t=E(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new uh([new mr(0,.5),new mr(-.5,-.5),new mr(.5,-.5)]),i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:12;a(this,n),(e=t.call(this)).type="ShapeGeometry",e.parameters={shapes:r,curveSegments:i};var o=[],s=[],u=[],l=[],c=0,h=0;if(!1===Array.isArray(r))f(r);else for(var d=0;d<r.length;d++)f(r[d]),e.addGroup(c,h,d),c+=h,h=0;function f(e){var t=s.length/3,n=e.extractPoints(i),r=n.shape,a=n.holes;!1===Uh.isClockWise(r)&&(r=r.reverse());for(var c=0,d=a.length;c<d;c++){var f=a[c];!0===Uh.isClockWise(f)&&(a[c]=f.reverse())}for(var p=Uh.triangulateShape(r,a),v=0,m=a.length;v<m;v++){var g=a[v];r=r.concat(g)}for(var y=0,_=r.length;y<_;y++){var x=r[y];s.push(x.x,x.y,0),u.push(0,0,1),l.push(x.x,x.y)}for(var M=0,S=p.length;M<S;M++){var b=p[M],w=b[0]+t,T=b[1]+t,E=b[2]+t;o.push(w,T,E),h+=3}}return e.setIndex(o),e.setAttribute("position",new Ia(s,3)),e.setAttribute("normal",new Ia(u,3)),e.setAttribute("uv",new Ia(l,2)),e}return s(n,[{key:"copy",value:function(e){return y(x(n.prototype),"copy",this).call(this,e),this.parameters=Object.assign({},e.parameters),this}},{key:"toJSON",value:function(){var e=y(x(n.prototype),"toJSON",this).call(this);return function(e,t){if(t.shapes=[],Array.isArray(e))for(var n=0,r=e.length;n<r;n++){var i=e[n];t.shapes.push(i.uuid)}else t.shapes.push(e.uuid);return t}(this.parameters.shapes,e)}}],[{key:"fromJSON",value:function(e,t){for(var r=[],i=0,a=e.shapes.length;i<a;i++){var o=t[e.shapes[i]];r.push(o)}return new n(r,e.curveSegments)}}]),n}(Ga);var Wh=function(e){w(n,e);var t=E(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:32,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:16,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,u=arguments.length>4&&void 0!==arguments[4]?arguments[4]:2*Math.PI,l=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,c=arguments.length>6&&void 0!==arguments[6]?arguments[6]:Math.PI;a(this,n),(e=t.call(this)).type="SphereGeometry",e.parameters={radius:r,widthSegments:i,heightSegments:o,phiStart:s,phiLength:u,thetaStart:l,thetaLength:c},i=Math.max(3,Math.floor(i)),o=Math.max(2,Math.floor(o));for(var h=Math.min(l+c,Math.PI),d=0,f=[],p=new Yr,v=new Yr,m=[],g=[],y=[],_=[],x=0;x<=o;x++){var M=[],S=x/o,b=0;0===x&&0===l?b=.5/i:x===o&&h===Math.PI&&(b=-.5/i);for(var w=0;w<=i;w++){var T=w/i;p.x=-r*Math.cos(s+T*u)*Math.sin(l+S*c),p.y=r*Math.cos(l+S*c),p.z=r*Math.sin(s+T*u)*Math.sin(l+S*c),g.push(p.x,p.y,p.z),v.copy(p).normalize(),y.push(v.x,v.y,v.z),_.push(T+b,1-S),M.push(d++)}f.push(M)}for(var E=0;E<o;E++)for(var A=0;A<i;A++){var R=f[E][A+1],k=f[E][A],C=f[E+1][A],L=f[E+1][A+1];(0!==E||l>0)&&m.push(R,k,L),(E!==o-1||h<Math.PI)&&m.push(k,C,L)}return e.setIndex(m),e.setAttribute("position",new Ia(g,3)),e.setAttribute("normal",new Ia(y,3)),e.setAttribute("uv",new Ia(_,2)),e}return s(n,[{key:"copy",value:function(e){return y(x(n.prototype),"copy",this).call(this,e),this.parameters=Object.assign({},e.parameters),this}}],[{key:"fromJSON",value:function(e){return new n(e.radius,e.widthSegments,e.heightSegments,e.phiStart,e.phiLength,e.thetaStart,e.thetaLength)}}]),n}(Ga),jh=function(e){w(n,e);var t=E(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;a(this,n);var o=[1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],s=[2,1,0,0,3,2,1,3,0,2,3,1];return(e=t.call(this,o,s,r,i)).type="TetrahedronGeometry",e.parameters={radius:r,detail:i},e}return s(n,null,[{key:"fromJSON",value:function(e){return new n(e.radius,e.detail)}}]),n}(th),Xh=function(e){w(n,e);var t=E(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.4,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:12,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:48,u=arguments.length>4&&void 0!==arguments[4]?arguments[4]:2*Math.PI;a(this,n),(e=t.call(this)).type="TorusGeometry",e.parameters={radius:r,tube:i,radialSegments:o,tubularSegments:s,arc:u},o=Math.floor(o),s=Math.floor(s);for(var l=[],c=[],h=[],d=[],f=new Yr,p=new Yr,v=new Yr,m=0;m<=o;m++)for(var g=0;g<=s;g++){var y=g/s*u,_=m/o*Math.PI*2;p.x=(r+i*Math.cos(_))*Math.cos(y),p.y=(r+i*Math.cos(_))*Math.sin(y),p.z=i*Math.sin(_),c.push(p.x,p.y,p.z),f.x=r*Math.cos(y),f.y=r*Math.sin(y),v.subVectors(p,f).normalize(),h.push(v.x,v.y,v.z),d.push(g/s),d.push(m/o)}for(var x=1;x<=o;x++)for(var M=1;M<=s;M++){var S=(s+1)*x+M-1,b=(s+1)*(x-1)+M-1,w=(s+1)*(x-1)+M,T=(s+1)*x+M;l.push(S,b,T),l.push(b,w,T)}return e.setIndex(l),e.setAttribute("position",new Ia(c,3)),e.setAttribute("normal",new Ia(h,3)),e.setAttribute("uv",new Ia(d,2)),e}return s(n,[{key:"copy",value:function(e){return y(x(n.prototype),"copy",this).call(this,e),this.parameters=Object.assign({},e.parameters),this}}],[{key:"fromJSON",value:function(e){return new n(e.radius,e.tube,e.radialSegments,e.tubularSegments,e.arc)}}]),n}(Ga),qh=function(e){w(n,e);var t=E(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.4,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:64,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:8,u=arguments.length>4&&void 0!==arguments[4]?arguments[4]:2,l=arguments.length>5&&void 0!==arguments[5]?arguments[5]:3;a(this,n),(e=t.call(this)).type="TorusKnotGeometry",e.parameters={radius:r,tube:i,tubularSegments:o,radialSegments:s,p:u,q:l},o=Math.floor(o),s=Math.floor(s);for(var c=[],h=[],d=[],f=[],p=new Yr,v=new Yr,m=new Yr,g=new Yr,y=new Yr,_=new Yr,x=new Yr,M=0;M<=o;++M){var S=M/o*u*Math.PI*2;I(S,u,l,r,m),I(S+.01,u,l,r,g),_.subVectors(g,m),x.addVectors(g,m),y.crossVectors(_,x),x.crossVectors(y,_),y.normalize(),x.normalize();for(var b=0;b<=s;++b){var w=b/s*Math.PI*2,T=-i*Math.cos(w),E=i*Math.sin(w);p.x=m.x+(T*x.x+E*y.x),p.y=m.y+(T*x.y+E*y.y),p.z=m.z+(T*x.z+E*y.z),h.push(p.x,p.y,p.z),v.subVectors(p,m).normalize(),d.push(v.x,v.y,v.z),f.push(M/o),f.push(b/s)}}for(var A=1;A<=o;A++)for(var R=1;R<=s;R++){var k=(s+1)*(A-1)+(R-1),C=(s+1)*A+(R-1),L=(s+1)*A+R,P=(s+1)*(A-1)+R;c.push(k,C,P),c.push(C,L,P)}function I(e,t,n,r,i){var a=Math.cos(e),o=Math.sin(e),s=n/t*e,u=Math.cos(s);i.x=r*(2+u)*.5*a,i.y=r*(2+u)*o*.5,i.z=r*Math.sin(s)*.5}return e.setIndex(c),e.setAttribute("position",new Ia(h,3)),e.setAttribute("normal",new Ia(d,3)),e.setAttribute("uv",new Ia(f,2)),e}return s(n,[{key:"copy",value:function(e){return y(x(n.prototype),"copy",this).call(this,e),this.parameters=Object.assign({},e.parameters),this}}],[{key:"fromJSON",value:function(e){return new n(e.radius,e.tube,e.tubularSegments,e.radialSegments,e.p,e.q)}}]),n}(Ga),Yh=function(e){w(n,e);var t=E(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new jc(new Yr(-1,-1,0),new Yr(-1,1,0),new Yr(1,1,0)),i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:64,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:8,u=arguments.length>4&&void 0!==arguments[4]&&arguments[4];a(this,n),(e=t.call(this)).type="TubeGeometry",e.parameters={path:r,tubularSegments:i,radius:o,radialSegments:s,closed:u};var l=r.computeFrenetFrames(i,u);e.tangents=l.tangents,e.normals=l.normals,e.binormals=l.binormals;var c=new Yr,h=new Yr,d=new mr,f=new Yr,p=[],v=[],m=[],g=[];function y(){for(var e=0;e<i;e++)_(e);_(!1===u?i:0),M(),x()}function _(e){f=r.getPointAt(e/i,f);for(var t=l.normals[e],n=l.binormals[e],a=0;a<=s;a++){var u=a/s*Math.PI*2,d=Math.sin(u),m=-Math.cos(u);h.x=m*t.x+d*n.x,h.y=m*t.y+d*n.y,h.z=m*t.z+d*n.z,h.normalize(),v.push(h.x,h.y,h.z),c.x=f.x+o*h.x,c.y=f.y+o*h.y,c.z=f.z+o*h.z,p.push(c.x,c.y,c.z)}}function x(){for(var e=1;e<=i;e++)for(var t=1;t<=s;t++){var n=(s+1)*(e-1)+(t-1),r=(s+1)*e+(t-1),a=(s+1)*e+t,o=(s+1)*(e-1)+t;g.push(n,r,o),g.push(r,a,o)}}function M(){for(var e=0;e<=i;e++)for(var t=0;t<=s;t++)d.x=e/i,d.y=t/s,m.push(d.x,d.y)}return y(),e.setIndex(g),e.setAttribute("position",new Ia(p,3)),e.setAttribute("normal",new Ia(v,3)),e.setAttribute("uv",new Ia(m,2)),e}return s(n,[{key:"copy",value:function(e){return y(x(n.prototype),"copy",this).call(this,e),this.parameters=Object.assign({},e.parameters),this}},{key:"toJSON",value:function(){var e=y(x(n.prototype),"toJSON",this).call(this);return e.path=this.parameters.path.toJSON(),e}}],[{key:"fromJSON",value:function(e){return new n((new qc[e.path.type]).fromJSON(e.path),e.tubularSegments,e.radius,e.radialSegments,e.closed)}}]),n}(Ga),Zh=function(e){w(n,e);var t=E(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;if(a(this,n),(e=t.call(this)).type="WireframeGeometry",e.parameters={geometry:r},null!==r){var i=[],o=new Set,s=new Yr,u=new Yr;if(null!==r.index){var l=r.attributes.position,c=r.index,h=r.groups;0===h.length&&(h=[{start:0,count:c.count,materialIndex:0}]);for(var d=0,f=h.length;d<f;++d)for(var p=h[d],v=p.start,m=p.count,g=v,y=v+m;g<y;g+=3)for(var _=0;_<3;_++){var x=c.getX(g+_),M=c.getX(g+(_+1)%3);s.fromBufferAttribute(l,x),u.fromBufferAttribute(l,M),!0===Kh(s,u,o)&&(i.push(s.x,s.y,s.z),i.push(u.x,u.y,u.z))}}else for(var S=r.attributes.position,b=0,w=S.count/3;b<w;b++)for(var T=0;T<3;T++){var E=3*b+T,A=3*b+(T+1)%3;s.fromBufferAttribute(S,E),u.fromBufferAttribute(S,A),!0===Kh(s,u,o)&&(i.push(s.x,s.y,s.z),i.push(u.x,u.y,u.z))}e.setAttribute("position",new Ia(i,3))}return e}return s(n,[{key:"copy",value:function(e){return y(x(n.prototype),"copy",this).call(this,e),this.parameters=Object.assign({},e.parameters),this}}]),n}(Ga);function Kh(e,t,n){var r="".concat(e.x,",").concat(e.y,",").concat(e.z,"-").concat(t.x,",").concat(t.y,",").concat(t.z),i="".concat(t.x,",").concat(t.y,",").concat(t.z,"-").concat(e.x,",").concat(e.y,",").concat(e.z);return!0!==n.has(r)&&!0!==n.has(i)&&(n.add(r),n.add(i),!0)}var Jh=Object.freeze({__proto__:null,BoxGeometry:uo,CapsuleGeometry:Jc,CircleGeometry:Qc,ConeGeometry:eh,CylinderGeometry:$c,DodecahedronGeometry:nh,EdgesGeometry:sh,ExtrudeGeometry:Fh,IcosahedronGeometry:zh,LatheGeometry:Kc,OctahedronGeometry:Hh,PlaneGeometry:Co,PolyhedronGeometry:th,RingGeometry:Gh,ShapeGeometry:Vh,SphereGeometry:Wh,TetrahedronGeometry:jh,TorusGeometry:Xh,TorusKnotGeometry:qh,TubeGeometry:Yh,WireframeGeometry:Zh}),Qh=function(e){w(n,e);var t=E(n);function n(e){var r;return a(this,n),(r=t.call(this)).isShadowMaterial=!0,r.type="ShadowMaterial",r.color=new pa(0),r.transparent=!0,r.fog=!0,r.setValues(e),r}return s(n,[{key:"copy",value:function(e){return y(x(n.prototype),"copy",this).call(this,e),this.color.copy(e.color),this.fog=e.fog,this}}]),n}(la),$h=function(e){w(n,e);var t=E(n);function n(e){var r;return a(this,n),(r=t.call(this,e)).isRawShaderMaterial=!0,r.type="RawShaderMaterial",r}return s(n)}(po),ed=function(e){w(n,e);var t=E(n);function n(e){var r;return a(this,n),(r=t.call(this)).isMeshStandardMaterial=!0,r.defines={STANDARD:""},r.type="MeshStandardMaterial",r.color=new pa(16777215),r.roughness=1,r.metalness=0,r.map=null,r.lightMap=null,r.lightMapIntensity=1,r.aoMap=null,r.aoMapIntensity=1,r.emissive=new pa(0),r.emissiveIntensity=1,r.emissiveMap=null,r.bumpMap=null,r.bumpScale=1,r.normalMap=null,r.normalMapType=hn,r.normalScale=new mr(1,1),r.displacementMap=null,r.displacementScale=1,r.displacementBias=0,r.roughnessMap=null,r.metalnessMap=null,r.alphaMap=null,r.envMap=null,r.envMapIntensity=1,r.wireframe=!1,r.wireframeLinewidth=1,r.wireframeLinecap="round",r.wireframeLinejoin="round",r.flatShading=!1,r.fog=!0,r.setValues(e),r}return s(n,[{key:"copy",value:function(e){return y(x(n.prototype),"copy",this).call(this,e),this.defines={STANDARD:""},this.color.copy(e.color),this.roughness=e.roughness,this.metalness=e.metalness,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.roughnessMap=e.roughnessMap,this.metalnessMap=e.metalnessMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapIntensity=e.envMapIntensity,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}]),n}(la),td=function(e){w(n,e);var t=E(n);function n(e){var r;return a(this,n),(r=t.call(this)).isMeshPhysicalMaterial=!0,r.defines={STANDARD:"",PHYSICAL:""},r.type="MeshPhysicalMaterial",r.anisotropyRotation=0,r.anisotropyMap=null,r.clearcoatMap=null,r.clearcoatRoughness=0,r.clearcoatRoughnessMap=null,r.clearcoatNormalScale=new mr(1,1),r.clearcoatNormalMap=null,r.ior=1.5,Object.defineProperty(S(r),"reflectivity",{get:function(){return sr(2.5*(this.ior-1)/(this.ior+1),0,1)},set:function(e){this.ior=(1+.4*e)/(1-.4*e)}}),r.iridescenceMap=null,r.iridescenceIOR=1.3,r.iridescenceThicknessRange=[100,400],r.iridescenceThicknessMap=null,r.sheenColor=new pa(0),r.sheenColorMap=null,r.sheenRoughness=1,r.sheenRoughnessMap=null,r.transmissionMap=null,r.thickness=0,r.thicknessMap=null,r.attenuationDistance=1/0,r.attenuationColor=new pa(1,1,1),r.specularIntensity=1,r.specularIntensityMap=null,r.specularColor=new pa(1,1,1),r.specularColorMap=null,r._anisotropy=0,r._clearcoat=0,r._iridescence=0,r._sheen=0,r._transmission=0,r.setValues(e),r}return s(n,[{key:"anisotropy",get:function(){return this._anisotropy},set:function(e){this._anisotropy>0!=e>0&&this.version++,this._anisotropy=e}},{key:"clearcoat",get:function(){return this._clearcoat},set:function(e){this._clearcoat>0!=e>0&&this.version++,this._clearcoat=e}},{key:"iridescence",get:function(){return this._iridescence},set:function(e){this._iridescence>0!=e>0&&this.version++,this._iridescence=e}},{key:"sheen",get:function(){return this._sheen},set:function(e){this._sheen>0!=e>0&&this.version++,this._sheen=e}},{key:"transmission",get:function(){return this._transmission},set:function(e){this._transmission>0!=e>0&&this.version++,this._transmission=e}},{key:"copy",value:function(e){return y(x(n.prototype),"copy",this).call(this,e),this.defines={STANDARD:"",PHYSICAL:""},this.anisotropy=e.anisotropy,this.anisotropyRotation=e.anisotropyRotation,this.anisotropyMap=e.anisotropyMap,this.clearcoat=e.clearcoat,this.clearcoatMap=e.clearcoatMap,this.clearcoatRoughness=e.clearcoatRoughness,this.clearcoatRoughnessMap=e.clearcoatRoughnessMap,this.clearcoatNormalMap=e.clearcoatNormalMap,this.clearcoatNormalScale.copy(e.clearcoatNormalScale),this.ior=e.ior,this.iridescence=e.iridescence,this.iridescenceMap=e.iridescenceMap,this.iridescenceIOR=e.iridescenceIOR,this.iridescenceThicknessRange=d(e.iridescenceThicknessRange),this.iridescenceThicknessMap=e.iridescenceThicknessMap,this.sheen=e.sheen,this.sheenColor.copy(e.sheenColor),this.sheenColorMap=e.sheenColorMap,this.sheenRoughness=e.sheenRoughness,this.sheenRoughnessMap=e.sheenRoughnessMap,this.transmission=e.transmission,this.transmissionMap=e.transmissionMap,this.thickness=e.thickness,this.thicknessMap=e.thicknessMap,this.attenuationDistance=e.attenuationDistance,this.attenuationColor.copy(e.attenuationColor),this.specularIntensity=e.specularIntensity,this.specularIntensityMap=e.specularIntensityMap,this.specularColor.copy(e.specularColor),this.specularColorMap=e.specularColorMap,this}}]),n}(ed),nd=function(e){w(n,e);var t=E(n);function n(e){var r;return a(this,n),(r=t.call(this)).isMeshPhongMaterial=!0,r.type="MeshPhongMaterial",r.color=new pa(16777215),r.specular=new pa(1118481),r.shininess=30,r.map=null,r.lightMap=null,r.lightMapIntensity=1,r.aoMap=null,r.aoMapIntensity=1,r.emissive=new pa(0),r.emissiveIntensity=1,r.emissiveMap=null,r.bumpMap=null,r.bumpScale=1,r.normalMap=null,r.normalMapType=hn,r.normalScale=new mr(1,1),r.displacementMap=null,r.displacementScale=1,r.displacementBias=0,r.specularMap=null,r.alphaMap=null,r.envMap=null,r.combine=xe,r.reflectivity=1,r.refractionRatio=.98,r.wireframe=!1,r.wireframeLinewidth=1,r.wireframeLinecap="round",r.wireframeLinejoin="round",r.flatShading=!1,r.fog=!0,r.setValues(e),r}return s(n,[{key:"copy",value:function(e){return y(x(n.prototype),"copy",this).call(this,e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}]),n}(la),rd=function(e){w(n,e);var t=E(n);function n(e){var r;return a(this,n),(r=t.call(this)).isMeshToonMaterial=!0,r.defines={TOON:""},r.type="MeshToonMaterial",r.color=new pa(16777215),r.map=null,r.gradientMap=null,r.lightMap=null,r.lightMapIntensity=1,r.aoMap=null,r.aoMapIntensity=1,r.emissive=new pa(0),r.emissiveIntensity=1,r.emissiveMap=null,r.bumpMap=null,r.bumpScale=1,r.normalMap=null,r.normalMapType=hn,r.normalScale=new mr(1,1),r.displacementMap=null,r.displacementScale=1,r.displacementBias=0,r.alphaMap=null,r.wireframe=!1,r.wireframeLinewidth=1,r.wireframeLinecap="round",r.wireframeLinejoin="round",r.fog=!0,r.setValues(e),r}return s(n,[{key:"copy",value:function(e){return y(x(n.prototype),"copy",this).call(this,e),this.color.copy(e.color),this.map=e.map,this.gradientMap=e.gradientMap,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}]),n}(la),id=function(e){w(n,e);var t=E(n);function n(e){var r;return a(this,n),(r=t.call(this)).isMeshNormalMaterial=!0,r.type="MeshNormalMaterial",r.bumpMap=null,r.bumpScale=1,r.normalMap=null,r.normalMapType=hn,r.normalScale=new mr(1,1),r.displacementMap=null,r.displacementScale=1,r.displacementBias=0,r.wireframe=!1,r.wireframeLinewidth=1,r.flatShading=!1,r.setValues(e),r}return s(n,[{key:"copy",value:function(e){return y(x(n.prototype),"copy",this).call(this,e),this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.flatShading=e.flatShading,this}}]),n}(la),ad=function(e){w(n,e);var t=E(n);function n(e){var r;return a(this,n),(r=t.call(this)).isMeshLambertMaterial=!0,r.type="MeshLambertMaterial",r.color=new pa(16777215),r.map=null,r.lightMap=null,r.lightMapIntensity=1,r.aoMap=null,r.aoMapIntensity=1,r.emissive=new pa(0),r.emissiveIntensity=1,r.emissiveMap=null,r.bumpMap=null,r.bumpScale=1,r.normalMap=null,r.normalMapType=hn,r.normalScale=new mr(1,1),r.displacementMap=null,r.displacementScale=1,r.displacementBias=0,r.specularMap=null,r.alphaMap=null,r.envMap=null,r.combine=xe,r.reflectivity=1,r.refractionRatio=.98,r.wireframe=!1,r.wireframeLinewidth=1,r.wireframeLinecap="round",r.wireframeLinejoin="round",r.flatShading=!1,r.fog=!0,r.setValues(e),r}return s(n,[{key:"copy",value:function(e){return y(x(n.prototype),"copy",this).call(this,e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}]),n}(la),od=function(e){w(n,e);var t=E(n);function n(e){var r;return a(this,n),(r=t.call(this)).isMeshMatcapMaterial=!0,r.defines={MATCAP:""},r.type="MeshMatcapMaterial",r.color=new pa(16777215),r.matcap=null,r.map=null,r.bumpMap=null,r.bumpScale=1,r.normalMap=null,r.normalMapType=hn,r.normalScale=new mr(1,1),r.displacementMap=null,r.displacementScale=1,r.displacementBias=0,r.alphaMap=null,r.flatShading=!1,r.fog=!0,r.setValues(e),r}return s(n,[{key:"copy",value:function(e){return y(x(n.prototype),"copy",this).call(this,e),this.defines={MATCAP:""},this.color.copy(e.color),this.matcap=e.matcap,this.map=e.map,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.flatShading=e.flatShading,this.fog=e.fog,this}}]),n}(la),sd=function(e){w(n,e);var t=E(n);function n(e){var r;return a(this,n),(r=t.call(this)).isLineDashedMaterial=!0,r.type="LineDashedMaterial",r.scale=1,r.dashSize=3,r.gapSize=1,r.setValues(e),r}return s(n,[{key:"copy",value:function(e){return y(x(n.prototype),"copy",this).call(this,e),this.scale=e.scale,this.dashSize=e.dashSize,this.gapSize=e.gapSize,this}}]),n}(ic);function ud(e,t,n){return cd(e)?new e.constructor(e.subarray(t,void 0!==n?n:e.length)):e.slice(t,n)}function ld(e,t,n){return!e||!n&&e.constructor===t?e:"number"==typeof t.BYTES_PER_ELEMENT?new t(e):Array.prototype.slice.call(e)}function cd(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function hd(e){for(var t=e.length,n=new Array(t),r=0;r!==t;++r)n[r]=r;return n.sort((function(t,n){return e[t]-e[n]})),n}function dd(e,t,n){for(var r=e.length,i=new e.constructor(r),a=0,o=0;o!==r;++a)for(var s=n[a]*t,u=0;u!==t;++u)i[o++]=e[s+u];return i}function fd(e,t,n,r){for(var i=1,a=e[0];void 0!==a&&void 0===a[r];)a=e[i++];if(void 0!==a){var o=a[r];if(void 0!==o)if(Array.isArray(o))do{void 0!==(o=a[r])&&(t.push(a.time),n.push.apply(n,o)),a=e[i++]}while(void 0!==a);else if(void 0!==o.toArray)do{void 0!==(o=a[r])&&(t.push(a.time),o.toArray(n,n.length)),a=e[i++]}while(void 0!==a);else do{void 0!==(o=a[r])&&(t.push(a.time),n.push(o)),a=e[i++]}while(void 0!==a)}}var pd={arraySlice:ud,convertArray:ld,isTypedArray:cd,getKeyframeOrder:hd,sortedArray:dd,flattenJSON:fd,subclip:function(e,t,n,r){var i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:30,a=e.clone();a.name=t;for(var o=[],s=0;s<a.tracks.length;++s){for(var u=a.tracks[s],l=u.getValueSize(),c=[],h=[],d=0;d<u.times.length;++d){var f=u.times[d]*i;if(!(f<n||f>=r)){c.push(u.times[d]);for(var p=0;p<l;++p)h.push(u.values[d*l+p])}}0!==c.length&&(u.times=ld(c,u.times.constructor),u.values=ld(h,u.values.constructor),o.push(u))}a.tracks=o;for(var v=1/0,m=0;m<a.tracks.length;++m)v>a.tracks[m].times[0]&&(v=a.tracks[m].times[0]);for(var g=0;g<a.tracks.length;++g)a.tracks[g].shift(-1*v);return a.resetDuration(),a},makeClipAdditive:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:30;r<=0&&(r=30);for(var i=n.tracks.length,a=t/r,o=function(){var t=n.tracks[s],r=t.ValueTypeName;if("bool"===r||"string"===r)return"continue";var i=e.tracks.find((function(e){return e.name===t.name&&e.ValueTypeName===r}));if(void 0===i)return"continue";var o=0,u=t.getValueSize();t.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(o=u/3);var l=0,c=i.getValueSize();i.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(l=c/3);var h,d=t.times.length-1;if(a<=t.times[0]){var f=o,p=u-o;h=ud(t.values,f,p)}else if(a>=t.times[d]){var v=d*u+o,m=v+u-o;h=ud(t.values,v,m)}else{var g=t.createInterpolant(),y=o,_=u-o;g.evaluate(a),h=ud(g.resultBuffer,y,_)}"quaternion"===r&&(new qr).fromArray(h).normalize().conjugate().toArray(h);for(var x=i.times.length,M=0;M<x;++M){var S=M*c+l;if("quaternion"===r)qr.multiplyQuaternionsFlat(i.values,S,h,0,i.values,S);else for(var b=c-2*l,w=0;w<b;++w)i.values[S+w]-=h[w]}},s=0;s<i;++s)o();return e.blendMode=nn,e}},vd=function(){function e(t,n,r,i){a(this,e),this.parameterPositions=t,this._cachedIndex=0,this.resultBuffer=void 0!==i?i:new n.constructor(r),this.sampleValues=n,this.valueSize=r,this.settings=null,this.DefaultSettings_={}}return s(e,[{key:"evaluate",value:function(e){var t=this.parameterPositions,n=this._cachedIndex,r=t[n],i=t[n-1];e:{t:{var a;n:{r:if(!(e<r)){for(var o=n+2;;){if(void 0===r){if(e<i)break r;return n=t.length,this._cachedIndex=n,this.copySampleValue_(n-1)}if(n===o)break;if(i=r,e<(r=t[++n]))break t}a=t.length;break n}if(e>=i)break e;var s=t[1];e<s&&(n=2,i=s);for(var u=n-2;;){if(void 0===i)return this._cachedIndex=0,this.copySampleValue_(0);if(n===u)break;if(r=i,e>=(i=t[--n-1]))break t}a=n,n=0}for(;n<a;){var l=n+a>>>1;e<t[l]?a=l:n=l+1}if(r=t[n],void 0===(i=t[n-1]))return this._cachedIndex=0,this.copySampleValue_(0);if(void 0===r)return n=t.length,this._cachedIndex=n,this.copySampleValue_(n-1)}this._cachedIndex=n,this.intervalChanged_(n,i,r)}return this.interpolate_(n,i,e,r)}},{key:"getSettings_",value:function(){return this.settings||this.DefaultSettings_}},{key:"copySampleValue_",value:function(e){for(var t=this.resultBuffer,n=this.sampleValues,r=this.valueSize,i=e*r,a=0;a!==r;++a)t[a]=n[i+a];return t}},{key:"interpolate_",value:function(){throw new Error("call to abstract method")}},{key:"intervalChanged_",value:function(){}}]),e}(),md=function(e){w(n,e);var t=E(n);function n(e,r,i,o){var s;return a(this,n),(s=t.call(this,e,r,i,o))._weightPrev=-0,s._offsetPrev=-0,s._weightNext=-0,s._offsetNext=-0,s.DefaultSettings_={endingStart:Qt,endingEnd:Qt},s}return s(n,[{key:"intervalChanged_",value:function(e,t,n){var r=this.parameterPositions,i=e-2,a=e+1,o=r[i],s=r[a];if(void 0===o)switch(this.getSettings_().endingStart){case $t:i=e,o=2*t-n;break;case en:o=t+r[i=r.length-2]-r[i+1];break;default:i=e,o=n}if(void 0===s)switch(this.getSettings_().endingEnd){case $t:a=e,s=2*n-t;break;case en:a=1,s=n+r[1]-r[0];break;default:a=e-1,s=t}var u=.5*(n-t),l=this.valueSize;this._weightPrev=u/(t-o),this._weightNext=u/(s-n),this._offsetPrev=i*l,this._offsetNext=a*l}},{key:"interpolate_",value:function(e,t,n,r){for(var i=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=e*o,u=s-o,l=this._offsetPrev,c=this._offsetNext,h=this._weightPrev,d=this._weightNext,f=(n-t)/(r-t),p=f*f,v=p*f,m=-h*v+2*h*p-h*f,g=(1+h)*v+(-1.5-2*h)*p+(-.5+h)*f+1,y=(-1-d)*v+(1.5+d)*p+.5*f,_=d*v-d*p,x=0;x!==o;++x)i[x]=m*a[l+x]+g*a[u+x]+y*a[s+x]+_*a[c+x];return i}}]),n}(vd),gd=function(e){w(n,e);var t=E(n);function n(e,r,i,o){return a(this,n),t.call(this,e,r,i,o)}return s(n,[{key:"interpolate_",value:function(e,t,n,r){for(var i=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=e*o,u=s-o,l=(n-t)/(r-t),c=1-l,h=0;h!==o;++h)i[h]=a[u+h]*c+a[s+h]*l;return i}}]),n}(vd),yd=function(e){w(n,e);var t=E(n);function n(e,r,i,o){return a(this,n),t.call(this,e,r,i,o)}return s(n,[{key:"interpolate_",value:function(e){return this.copySampleValue_(e-1)}}]),n}(vd),_d=function(){function e(t,n,r,i){if(a(this,e),void 0===t)throw new Error("THREE.KeyframeTrack: track name is undefined");if(void 0===n||0===n.length)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+t);this.name=t,this.times=ld(n,this.TimeBufferType),this.values=ld(r,this.ValueBufferType),this.setInterpolation(i||this.DefaultInterpolation)}return s(e,[{key:"InterpolantFactoryMethodDiscrete",value:function(e){return new yd(this.times,this.values,this.getValueSize(),e)}},{key:"InterpolantFactoryMethodLinear",value:function(e){return new gd(this.times,this.values,this.getValueSize(),e)}},{key:"InterpolantFactoryMethodSmooth",value:function(e){return new md(this.times,this.values,this.getValueSize(),e)}},{key:"setInterpolation",value:function(e){var t;switch(e){case Zt:t=this.InterpolantFactoryMethodDiscrete;break;case Kt:t=this.InterpolantFactoryMethodLinear;break;case Jt:t=this.InterpolantFactoryMethodSmooth}if(void 0===t){var n="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(void 0===this.createInterpolant){if(e===this.DefaultInterpolation)throw new Error(n);this.setInterpolation(this.DefaultInterpolation)}return console.warn("THREE.KeyframeTrack:",n),this}return this.createInterpolant=t,this}},{key:"getInterpolation",value:function(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return Zt;case this.InterpolantFactoryMethodLinear:return Kt;case this.InterpolantFactoryMethodSmooth:return Jt}}},{key:"getValueSize",value:function(){return this.values.length/this.times.length}},{key:"shift",value:function(e){if(0!==e)for(var t=this.times,n=0,r=t.length;n!==r;++n)t[n]+=e;return this}},{key:"scale",value:function(e){if(1!==e)for(var t=this.times,n=0,r=t.length;n!==r;++n)t[n]*=e;return this}},{key:"trim",value:function(e,t){for(var n=this.times,r=n.length,i=0,a=r-1;i!==r&&n[i]<e;)++i;for(;-1!==a&&n[a]>t;)--a;if(++a,0!==i||a!==r){i>=a&&(i=(a=Math.max(a,1))-1);var o=this.getValueSize();this.times=ud(n,i,a),this.values=ud(this.values,i*o,a*o)}return this}},{key:"validate",value:function(){var e=!0,t=this.getValueSize();t-Math.floor(t)!=0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),e=!1);var n=this.times,r=this.values,i=n.length;0===i&&(console.error("THREE.KeyframeTrack: Track is empty.",this),e=!1);for(var a=null,o=0;o!==i;o++){var s=n[o];if("number"==typeof s&&isNaN(s)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,o,s),e=!1;break}if(null!==a&&a>s){console.error("THREE.KeyframeTrack: Out of order keys.",this,o,s,a),e=!1;break}a=s}if(void 0!==r&&cd(r))for(var u=0,l=r.length;u!==l;++u){var c=r[u];if(isNaN(c)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,u,c),e=!1;break}}return e}},{key:"optimize",value:function(){for(var e=ud(this.times),t=ud(this.values),n=this.getValueSize(),r=this.getInterpolation()===Jt,i=e.length-1,a=1,o=1;o<i;++o){var s=!1,u=e[o];if(u!==e[o+1]&&(1!==o||u!==e[0]))if(r)s=!0;else for(var l=o*n,c=l-n,h=l+n,d=0;d!==n;++d){var f=t[l+d];if(f!==t[c+d]||f!==t[h+d]){s=!0;break}}if(s){if(o!==a){e[a]=e[o];for(var p=o*n,v=a*n,m=0;m!==n;++m)t[v+m]=t[p+m]}++a}}if(i>0){e[a]=e[i];for(var g=i*n,y=a*n,_=0;_!==n;++_)t[y+_]=t[g+_];++a}return a!==e.length?(this.times=ud(e,0,a),this.values=ud(t,0,a*n)):(this.times=e,this.values=t),this}},{key:"clone",value:function(){var e=ud(this.times,0),t=ud(this.values,0),n=new(0,this.constructor)(this.name,e,t);return n.createInterpolant=this.createInterpolant,n}}],[{key:"toJSON",value:function(e){var t,n=e.constructor;if(n.toJSON!==this.toJSON)t=n.toJSON(e);else{t={name:e.name,times:ld(e.times,Array),values:ld(e.values,Array)};var r=e.getInterpolation();r!==e.DefaultInterpolation&&(t.interpolation=r)}return t.type=e.ValueTypeName,t}}]),e}();_d.prototype.TimeBufferType=Float32Array,_d.prototype.ValueBufferType=Float32Array,_d.prototype.DefaultInterpolation=Kt;var xd=function(e){w(n,e);var t=E(n);function n(){return a(this,n),t.apply(this,arguments)}return s(n)}(_d);xd.prototype.ValueTypeName="bool",xd.prototype.ValueBufferType=Array,xd.prototype.DefaultInterpolation=Zt,xd.prototype.InterpolantFactoryMethodLinear=void 0,xd.prototype.InterpolantFactoryMethodSmooth=void 0;var Md=function(e){w(n,e);var t=E(n);function n(){return a(this,n),t.apply(this,arguments)}return s(n)}(_d);Md.prototype.ValueTypeName="color";var Sd=function(e){w(n,e);var t=E(n);function n(){return a(this,n),t.apply(this,arguments)}return s(n)}(_d);Sd.prototype.ValueTypeName="number";var bd=function(e){w(n,e);var t=E(n);function n(e,r,i,o){return a(this,n),t.call(this,e,r,i,o)}return s(n,[{key:"interpolate_",value:function(e,t,n,r){for(var i=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=(n-t)/(r-t),u=e*o,l=u+o;u!==l;u+=4)qr.slerpFlat(i,0,a,u-o,a,u,s);return i}}]),n}(vd),wd=function(e){w(n,e);var t=E(n);function n(){return a(this,n),t.apply(this,arguments)}return s(n,[{key:"InterpolantFactoryMethodLinear",value:function(e){return new bd(this.times,this.values,this.getValueSize(),e)}}]),n}(_d);wd.prototype.ValueTypeName="quaternion",wd.prototype.DefaultInterpolation=Kt,wd.prototype.InterpolantFactoryMethodSmooth=void 0;var Td=function(e){w(n,e);var t=E(n);function n(){return a(this,n),t.apply(this,arguments)}return s(n)}(_d);Td.prototype.ValueTypeName="string",Td.prototype.ValueBufferType=Array,Td.prototype.DefaultInterpolation=Zt,Td.prototype.InterpolantFactoryMethodLinear=void 0,Td.prototype.InterpolantFactoryMethodSmooth=void 0;var Ed=function(e){w(n,e);var t=E(n);function n(){return a(this,n),t.apply(this,arguments)}return s(n)}(_d);Ed.prototype.ValueTypeName="vector";var Ad=function(){function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1,r=arguments.length>2?arguments[2]:void 0,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:tn;a(this,e),this.name=t,this.tracks=r,this.duration=n,this.blendMode=i,this.uuid=or(),this.duration<0&&this.resetDuration()}return s(e,[{key:"resetDuration",value:function(){for(var e=0,t=0,n=this.tracks.length;t!==n;++t){var r=this.tracks[t];e=Math.max(e,r.times[r.times.length-1])}return this.duration=e,this}},{key:"trim",value:function(){for(var e=0;e<this.tracks.length;e++)this.tracks[e].trim(0,this.duration);return this}},{key:"validate",value:function(){for(var e=!0,t=0;t<this.tracks.length;t++)e=e&&this.tracks[t].validate();return e}},{key:"optimize",value:function(){for(var e=0;e<this.tracks.length;e++)this.tracks[e].optimize();return this}},{key:"clone",value:function(){for(var e=[],t=0;t<this.tracks.length;t++)e.push(this.tracks[t].clone());return new this.constructor(this.name,this.duration,e,this.blendMode)}},{key:"toJSON",value:function(){return this.constructor.toJSON(this)}}],[{key:"parse",value:function(e){for(var t=[],n=e.tracks,r=1/(e.fps||1),i=0,a=n.length;i!==a;++i)t.push(Rd(n[i]).scale(r));var o=new this(e.name,e.duration,t,e.blendMode);return o.uuid=e.uuid,o}},{key:"toJSON",value:function(e){for(var t=[],n=e.tracks,r={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode},i=0,a=n.length;i!==a;++i)t.push(_d.toJSON(n[i]));return r}},{key:"CreateFromMorphTargetSequence",value:function(e,t,n,r){for(var i=t.length,a=[],o=0;o<i;o++){var s=[],u=[];s.push((o+i-1)%i,o,(o+1)%i),u.push(0,1,0);var l=hd(s);s=dd(s,1,l),u=dd(u,1,l),r||0!==s[0]||(s.push(i),u.push(u[0])),a.push(new Sd(".morphTargetInfluences["+t[o].name+"]",s,u).scale(1/n))}return new this(e,-1,a)}},{key:"findByName",value:function(e,t){var n=e;if(!Array.isArray(e)){var r=e;n=r.geometry&&r.geometry.animations||r.animations}for(var i=0;i<n.length;i++)if(n[i].name===t)return n[i];return null}},{key:"CreateClipsFromMorphTargetSequences",value:function(e,t,n){for(var r={},i=/^([\w-]*?)([\d]+)$/,a=0,o=e.length;a<o;a++){var s=e[a],u=s.name.match(i);if(u&&u.length>1){var l=u[1],c=r[l];c||(r[l]=c=[]),c.push(s)}}var h=[];for(var d in r)h.push(this.CreateFromMorphTargetSequence(d,r[d],t,n));return h}},{key:"parseAnimation",value:function(e,t){if(!e)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;for(var n=function(e,t,n,r,i){if(0!==n.length){var a=[],o=[];fd(n,a,o,r),0!==a.length&&i.push(new e(t,a,o))}},r=[],i=e.name||"default",a=e.fps||30,o=e.blendMode,s=e.length||-1,u=e.hierarchy||[],l=0;l<u.length;l++){var c=u[l].keys;if(c&&0!==c.length)if(c[0].morphTargets){var h={},d=void 0;for(d=0;d<c.length;d++)if(c[d].morphTargets)for(var f=0;f<c[d].morphTargets.length;f++)h[c[d].morphTargets[f]]=-1;for(var p in h){for(var v=[],m=[],g=0;g!==c[d].morphTargets.length;++g){var y=c[d];v.push(y.time),m.push(y.morphTarget===p?1:0)}r.push(new Sd(".morphTargetInfluence["+p+"]",v,m))}s=h.length*a}else{var _=".bones["+t[l].name+"]";n(Ed,_+".position",c,"pos",r),n(wd,_+".quaternion",c,"rot",r),n(Ed,_+".scale",c,"scl",r)}}return 0===r.length?null:new this(i,s,r,o)}}]),e}();function Rd(e){if(void 0===e.type)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");var t=function(e){switch(e.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return Sd;case"vector":case"vector2":case"vector3":case"vector4":return Ed;case"color":return Md;case"quaternion":return wd;case"bool":case"boolean":return xd;case"string":return Td}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+e)}(e.type);if(void 0===e.times){var n=[],r=[];fd(e.keys,n,r,"value"),e.times=n,e.values=r}return void 0!==t.parse?t.parse(e):new t(e.name,e.times,e.values,e.interpolation)}var kd={enabled:!1,files:{},add:function(e,t){!1!==this.enabled&&(this.files[e]=t)},get:function(e){if(!1!==this.enabled)return this.files[e]},remove:function(e){delete this.files[e]},clear:function(){this.files={}}},Cd=s((function e(t,n,r){a(this,e);var i=this,o=!1,s=0,u=0,l=void 0,c=[];this.onStart=void 0,this.onLoad=t,this.onProgress=n,this.onError=r,this.itemStart=function(e){u++,!1===o&&void 0!==i.onStart&&i.onStart(e,s,u),o=!0},this.itemEnd=function(e){s++,void 0!==i.onProgress&&i.onProgress(e,s,u),s===u&&(o=!1,void 0!==i.onLoad&&i.onLoad())},this.itemError=function(e){void 0!==i.onError&&i.onError(e)},this.resolveURL=function(e){return l?l(e):e},this.setURLModifier=function(e){return l=e,this},this.addHandler=function(e,t){return c.push(e,t),this},this.removeHandler=function(e){var t=c.indexOf(e);return-1!==t&&c.splice(t,2),this},this.getHandler=function(e){for(var t=0,n=c.length;t<n;t+=2){var r=c[t],i=c[t+1];if(r.global&&(r.lastIndex=0),r.test(e))return i}return null}})),Ld=new Cd,Pd=function(){function e(t){a(this,e),this.manager=void 0!==t?t:Ld,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}return s(e,[{key:"load",value:function(){}},{key:"loadAsync",value:function(e,t){var n=this;return new Promise((function(r,i){n.load(e,r,t,i)}))}},{key:"parse",value:function(){}},{key:"setCrossOrigin",value:function(e){return this.crossOrigin=e,this}},{key:"setWithCredentials",value:function(e){return this.withCredentials=e,this}},{key:"setPath",value:function(e){return this.path=e,this}},{key:"setResourcePath",value:function(e){return this.resourcePath=e,this}},{key:"setRequestHeader",value:function(e){return this.requestHeader=e,this}}]),e}();Pd.DEFAULT_MATERIAL_NAME="__DEFAULT";var Id,Dd={},Ud=function(e){w(n,e);var t=E(n);function n(e,r){var i;return a(this,n),(i=t.call(this,e)).response=r,i}return s(n)}(h(Error)),Od=function(e){w(n,e);var t=E(n);function n(e){return a(this,n),t.call(this,e)}return s(n,[{key:"load",value:function(e,t,n,r){var i=this;void 0===e&&(e=""),void 0!==this.path&&(e=this.path+e),e=this.manager.resolveURL(e);var a=kd.get(e);if(void 0!==a)return this.manager.itemStart(e),setTimeout((function(){t&&t(a),i.manager.itemEnd(e)}),0),a;if(void 0===Dd[e]){Dd[e]=[],Dd[e].push({onLoad:t,onProgress:n,onError:r});var o=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"}),s=this.mimeType,u=this.responseType;fetch(o).then((function(t){if(200===t.status||0===t.status){if(0===t.status&&console.warn("THREE.FileLoader: HTTP Status 0 received."),"undefined"==typeof ReadableStream||void 0===t.body||void 0===t.body.getReader)return t;var n=Dd[e],r=t.body.getReader(),i=t.headers.get("Content-Length")||t.headers.get("X-File-Size"),a=i?parseInt(i):0,o=0!==a,s=0,u=new ReadableStream({start:function(e){!function t(){r.read().then((function(r){var i=r.done,u=r.value;if(i)e.close();else{s+=u.byteLength;for(var l=new ProgressEvent("progress",{lengthComputable:o,loaded:s,total:a}),c=0,h=n.length;c<h;c++){var d=n[c];d.onProgress&&d.onProgress(l)}e.enqueue(u),t()}}))}()}});return new Response(u)}throw new Ud('fetch for "'.concat(t.url,'" responded with ').concat(t.status,": ").concat(t.statusText),t)})).then((function(e){switch(u){case"arraybuffer":return e.arrayBuffer();case"blob":return e.blob();case"document":return e.text().then((function(e){return(new DOMParser).parseFromString(e,s)}));case"json":return e.json();default:if(void 0===s)return e.text();var t=/charset="?([^;"\s]*)"?/i.exec(s),n=t&&t[1]?t[1].toLowerCase():void 0,r=new TextDecoder(n);return e.arrayBuffer().then((function(e){return r.decode(e)}))}})).then((function(t){kd.add(e,t);var n=Dd[e];delete Dd[e];for(var r=0,i=n.length;r<i;r++){var a=n[r];a.onLoad&&a.onLoad(t)}})).catch((function(t){var n=Dd[e];if(void 0===n)throw i.manager.itemError(e),t;delete Dd[e];for(var r=0,a=n.length;r<a;r++){var o=n[r];o.onError&&o.onError(t)}i.manager.itemError(e)})).finally((function(){i.manager.itemEnd(e)})),this.manager.itemStart(e)}else Dd[e].push({onLoad:t,onProgress:n,onError:r})}},{key:"setResponseType",value:function(e){return this.responseType=e,this}},{key:"setMimeType",value:function(e){return this.mimeType=e,this}}]),n}(Pd),Nd=function(e){w(n,e);var t=E(n);function n(e){return a(this,n),t.call(this,e)}return s(n,[{key:"load",value:function(e,t,n,r){var i=this,a=new Od(this.manager);a.setPath(this.path),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(e,(function(n){try{t(i.parse(JSON.parse(n)))}catch(t){r?r(t):console.error(t),i.manager.itemError(e)}}),n,r)}},{key:"parse",value:function(e){for(var t=[],n=0;n<e.length;n++){var r=Ad.parse(e[n]);t.push(r)}return t}}]),n}(Pd),Fd=function(e){w(n,e);var t=E(n);function n(e){return a(this,n),t.call(this,e)}return s(n,[{key:"load",value:function(e,t,n,r){var i=this,a=[],o=new wc,s=new Od(this.manager);s.setPath(this.path),s.setResponseType("arraybuffer"),s.setRequestHeader(this.requestHeader),s.setWithCredentials(i.withCredentials);var u=0;function l(l){s.load(e[l],(function(e){var n=i.parse(e,!0);a[l]={width:n.width,height:n.height,format:n.format,mipmaps:n.mipmaps},6===(u+=1)&&(1===n.mipmapCount&&(o.minFilter=Ve),o.image=a,o.format=n.format,o.needsUpdate=!0,t&&t(o))}),n,r)}if(Array.isArray(e))for(var c=0,h=e.length;c<h;++c)l(c);else s.load(e,(function(e){var n=i.parse(e,!0);if(n.isCubemap){for(var r=n.mipmaps.length/n.mipmapCount,s=0;s<r;s++){a[s]={mipmaps:[]};for(var u=0;u<n.mipmapCount;u++)a[s].mipmaps.push(n.mipmaps[s*n.mipmapCount+u]),a[s].format=n.format,a[s].width=n.width,a[s].height=n.height}o.image=a}else o.image.width=n.width,o.image.height=n.height,o.mipmaps=n.mipmaps;1===n.mipmapCount&&(o.minFilter=Ve),o.format=n.format,o.needsUpdate=!0,t&&t(o)}),n,r);return o}}]),n}(Pd),Bd=function(e){w(n,e);var t=E(n);function n(e){return a(this,n),t.call(this,e)}return s(n,[{key:"load",value:function(e,t,n,r){void 0!==this.path&&(e=this.path+e),e=this.manager.resolveURL(e);var i=this,a=kd.get(e);if(void 0!==a)return i.manager.itemStart(e),setTimeout((function(){t&&t(a),i.manager.itemEnd(e)}),0),a;var o=Sr("img");function s(){l(),kd.add(e,this),t&&t(this),i.manager.itemEnd(e)}function u(t){l(),r&&r(t),i.manager.itemError(e),i.manager.itemEnd(e)}function l(){o.removeEventListener("load",s,!1),o.removeEventListener("error",u,!1)}return o.addEventListener("load",s,!1),o.addEventListener("error",u,!1),"data:"!==e.slice(0,5)&&void 0!==this.crossOrigin&&(o.crossOrigin=this.crossOrigin),i.manager.itemStart(e),o.src=e,o}}]),n}(Pd),zd=function(e){w(n,e);var t=E(n);function n(e){return a(this,n),t.call(this,e)}return s(n,[{key:"load",value:function(e,t,n,r){var i=new _o;i.colorSpace=pn;var a=new Bd(this.manager);a.setCrossOrigin(this.crossOrigin),a.setPath(this.path);var o=0;function s(n){a.load(e[n],(function(e){i.images[n]=e,6===++o&&(i.needsUpdate=!0,t&&t(i))}),void 0,r)}for(var u=0;u<e.length;++u)s(u);return i}}]),n}(Pd),Hd=function(e){w(n,e);var t=E(n);function n(e){return a(this,n),t.call(this,e)}return s(n,[{key:"load",value:function(e,t,n,r){var i=this,a=new jl,o=new Od(this.manager);return o.setResponseType("arraybuffer"),o.setRequestHeader(this.requestHeader),o.setPath(this.path),o.setWithCredentials(i.withCredentials),o.load(e,(function(e){var n;try{n=i.parse(e)}catch(e){if(void 0===r)return void console.error(e);r(e)}if(!n)return r();void 0!==n.image?a.image=n.image:void 0!==n.data&&(a.image.width=n.width,a.image.height=n.height,a.image.data=n.data),a.wrapS=void 0!==n.wrapS?n.wrapS:Oe,a.wrapT=void 0!==n.wrapT?n.wrapT:Oe,a.magFilter=void 0!==n.magFilter?n.magFilter:Ve,a.minFilter=void 0!==n.minFilter?n.minFilter:Ve,a.anisotropy=void 0!==n.anisotropy?n.anisotropy:1,void 0!==n.colorSpace?a.colorSpace=n.colorSpace:void 0!==n.encoding&&(a.encoding=n.encoding),void 0!==n.flipY&&(a.flipY=n.flipY),void 0!==n.format&&(a.format=n.format),void 0!==n.type&&(a.type=n.type),void 0!==n.mipmaps&&(a.mipmaps=n.mipmaps,a.minFilter=Xe),1===n.mipmapCount&&(a.minFilter=Ve),void 0!==n.generateMipmaps&&(a.generateMipmaps=n.generateMipmaps),a.needsUpdate=!0,t&&t(a,n)}),n,r),a}}]),n}(Pd),Gd=function(e){w(n,e);var t=E(n);function n(e){return a(this,n),t.call(this,e)}return s(n,[{key:"load",value:function(e,t,n,r){var i=new Fr,a=new Bd(this.manager);return a.setCrossOrigin(this.crossOrigin),a.setPath(this.path),a.load(e,(function(e){i.image=e,i.needsUpdate=!0,void 0!==t&&t(i)}),n,r),i}}]),n}(Pd),Vd=function(e){w(n,e);var t=E(n);function n(e){var r,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return a(this,n),(r=t.call(this)).isLight=!0,r.type="Light",r.color=new pa(e),r.intensity=i,r}return s(n,[{key:"dispose",value:function(){}},{key:"copy",value:function(e,t){return y(x(n.prototype),"copy",this).call(this,e,t),this.color.copy(e.color),this.intensity=e.intensity,this}},{key:"toJSON",value:function(e){var t=y(x(n.prototype),"toJSON",this).call(this,e);return t.object.color=this.color.getHex(),t.object.intensity=this.intensity,void 0!==this.groundColor&&(t.object.groundColor=this.groundColor.getHex()),void 0!==this.distance&&(t.object.distance=this.distance),void 0!==this.angle&&(t.object.angle=this.angle),void 0!==this.decay&&(t.object.decay=this.decay),void 0!==this.penumbra&&(t.object.penumbra=this.penumbra),void 0!==this.shadow&&(t.object.shadow=this.shadow.toJSON()),t}}]),n}(Zi),Wd=function(e){w(n,e);var t=E(n);function n(e,r,i){var o;return a(this,n),(o=t.call(this,e,i)).isHemisphereLight=!0,o.type="HemisphereLight",o.position.copy(Zi.DEFAULT_UP),o.updateMatrix(),o.groundColor=new pa(r),o}return s(n,[{key:"copy",value:function(e,t){return y(x(n.prototype),"copy",this).call(this,e,t),this.groundColor.copy(e.groundColor),this}}]),n}(Vd),jd=new wi,Xd=new Yr,qd=new Yr,Yd=function(){function e(t){a(this,e),this.camera=t,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new mr(512,512),this.map=null,this.mapPass=null,this.matrix=new wi,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new Ao,this._frameExtents=new mr(1,1),this._viewportCount=1,this._viewports=[new Br(0,0,1,1)]}return s(e,[{key:"getViewportCount",value:function(){return this._viewportCount}},{key:"getFrustum",value:function(){return this._frustum}},{key:"updateMatrices",value:function(e){var t=this.camera,n=this.matrix;Xd.setFromMatrixPosition(e.matrixWorld),t.position.copy(Xd),qd.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(qd),t.updateMatrixWorld(),jd.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(jd),n.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),n.multiply(jd)}},{key:"getViewport",value:function(e){return this._viewports[e]}},{key:"getFrameExtents",value:function(){return this._frameExtents}},{key:"dispose",value:function(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}},{key:"copy",value:function(e){return this.camera=e.camera.clone(),this.bias=e.bias,this.radius=e.radius,this.mapSize.copy(e.mapSize),this}},{key:"clone",value:function(){return(new this.constructor).copy(this)}},{key:"toJSON",value:function(){var e={};return 0!==this.bias&&(e.bias=this.bias),0!==this.normalBias&&(e.normalBias=this.normalBias),1!==this.radius&&(e.radius=this.radius),512===this.mapSize.x&&512===this.mapSize.y||(e.mapSize=this.mapSize.toArray()),e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}}]),e}(),Zd=function(e){w(n,e);var t=E(n);function n(){var e;return a(this,n),(e=t.call(this,new mo(50,1,.5,500))).isSpotLightShadow=!0,e.focus=1,e}return s(n,[{key:"updateMatrices",value:function(e){var t=this.camera,r=2*ar*e.angle*this.focus,i=this.mapSize.width/this.mapSize.height,a=e.distance||t.far;r===t.fov&&i===t.aspect&&a===t.far||(t.fov=r,t.aspect=i,t.far=a,t.updateProjectionMatrix()),y(x(n.prototype),"updateMatrices",this).call(this,e)}},{key:"copy",value:function(e){return y(x(n.prototype),"copy",this).call(this,e),this.focus=e.focus,this}}]),n}(Yd),Kd=function(e){w(n,e);var t=E(n);function n(e,r){var i,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:Math.PI/3,u=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,l=arguments.length>5&&void 0!==arguments[5]?arguments[5]:2;return a(this,n),(i=t.call(this,e,r)).isSpotLight=!0,i.type="SpotLight",i.position.copy(Zi.DEFAULT_UP),i.updateMatrix(),i.target=new Zi,i.distance=o,i.angle=s,i.penumbra=u,i.decay=l,i.map=null,i.shadow=new Zd,i}return s(n,[{key:"power",get:function(){return this.intensity*Math.PI},set:function(e){this.intensity=e/Math.PI}},{key:"dispose",value:function(){this.shadow.dispose()}},{key:"copy",value:function(e,t){return y(x(n.prototype),"copy",this).call(this,e,t),this.distance=e.distance,this.angle=e.angle,this.penumbra=e.penumbra,this.decay=e.decay,this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}]),n}(Vd),Jd=new wi,Qd=new Yr,$d=new Yr,ef=function(e){w(n,e);var t=E(n);function n(){var e;return a(this,n),(e=t.call(this,new mo(90,1,.5,500))).isPointLightShadow=!0,e._frameExtents=new mr(4,2),e._viewportCount=6,e._viewports=[new Br(2,1,1,1),new Br(0,1,1,1),new Br(3,1,1,1),new Br(1,1,1,1),new Br(3,0,1,1),new Br(1,0,1,1)],e._cubeDirections=[new Yr(1,0,0),new Yr(-1,0,0),new Yr(0,0,1),new Yr(0,0,-1),new Yr(0,1,0),new Yr(0,-1,0)],e._cubeUps=[new Yr(0,1,0),new Yr(0,1,0),new Yr(0,1,0),new Yr(0,1,0),new Yr(0,0,1),new Yr(0,0,-1)],e}return s(n,[{key:"updateMatrices",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this.camera,r=this.matrix,i=e.distance||n.far;i!==n.far&&(n.far=i,n.updateProjectionMatrix()),Qd.setFromMatrixPosition(e.matrixWorld),n.position.copy(Qd),$d.copy(n.position),$d.add(this._cubeDirections[t]),n.up.copy(this._cubeUps[t]),n.lookAt($d),n.updateMatrixWorld(),r.makeTranslation(-Qd.x,-Qd.y,-Qd.z),Jd.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse),this._frustum.setFromProjectionMatrix(Jd)}}]),n}(Yd),tf=function(e){w(n,e);var t=E(n);function n(e,r){var i,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:2;return a(this,n),(i=t.call(this,e,r)).isPointLight=!0,i.type="PointLight",i.distance=o,i.decay=s,i.shadow=new ef,i}return s(n,[{key:"power",get:function(){return 4*this.intensity*Math.PI},set:function(e){this.intensity=e/(4*Math.PI)}},{key:"dispose",value:function(){this.shadow.dispose()}},{key:"copy",value:function(e,t){return y(x(n.prototype),"copy",this).call(this,e,t),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}}]),n}(Vd),nf=function(e){w(n,e);var t=E(n);function n(){var e;return a(this,n),(e=t.call(this,new Ho(-5,5,5,-5,.5,500))).isDirectionalLightShadow=!0,e}return s(n)}(Yd),rf=function(e){w(n,e);var t=E(n);function n(e,r){var i;return a(this,n),(i=t.call(this,e,r)).isDirectionalLight=!0,i.type="DirectionalLight",i.position.copy(Zi.DEFAULT_UP),i.updateMatrix(),i.target=new Zi,i.shadow=new nf,i}return s(n,[{key:"dispose",value:function(){this.shadow.dispose()}},{key:"copy",value:function(e){return y(x(n.prototype),"copy",this).call(this,e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}]),n}(Vd),af=function(e){w(n,e);var t=E(n);function n(e,r){var i;return a(this,n),(i=t.call(this,e,r)).isAmbientLight=!0,i.type="AmbientLight",i}return s(n)}(Vd),of=function(e){w(n,e);var t=E(n);function n(e,r){var i,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:10,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:10;return a(this,n),(i=t.call(this,e,r)).isRectAreaLight=!0,i.type="RectAreaLight",i.width=o,i.height=s,i}return s(n,[{key:"power",get:function(){return this.intensity*this.width*this.height*Math.PI},set:function(e){this.intensity=e/(this.width*this.height*Math.PI)}},{key:"copy",value:function(e){return y(x(n.prototype),"copy",this).call(this,e),this.width=e.width,this.height=e.height,this}},{key:"toJSON",value:function(e){var t=y(x(n.prototype),"toJSON",this).call(this,e);return t.object.width=this.width,t.object.height=this.height,t}}]),n}(Vd),sf=function(){function e(){a(this,e),this.isSphericalHarmonics3=!0,this.coefficients=[];for(var t=0;t<9;t++)this.coefficients.push(new Yr)}return s(e,[{key:"set",value:function(e){for(var t=0;t<9;t++)this.coefficients[t].copy(e[t]);return this}},{key:"zero",value:function(){for(var e=0;e<9;e++)this.coefficients[e].set(0,0,0);return this}},{key:"getAt",value:function(e,t){var n=e.x,r=e.y,i=e.z,a=this.coefficients;return t.copy(a[0]).multiplyScalar(.282095),t.addScaledVector(a[1],.488603*r),t.addScaledVector(a[2],.488603*i),t.addScaledVector(a[3],.488603*n),t.addScaledVector(a[4],n*r*1.092548),t.addScaledVector(a[5],r*i*1.092548),t.addScaledVector(a[6],.315392*(3*i*i-1)),t.addScaledVector(a[7],n*i*1.092548),t.addScaledVector(a[8],.546274*(n*n-r*r)),t}},{key:"getIrradianceAt",value:function(e,t){var n=e.x,r=e.y,i=e.z,a=this.coefficients;return t.copy(a[0]).multiplyScalar(.886227),t.addScaledVector(a[1],1.023328*r),t.addScaledVector(a[2],1.023328*i),t.addScaledVector(a[3],1.023328*n),t.addScaledVector(a[4],.858086*n*r),t.addScaledVector(a[5],.858086*r*i),t.addScaledVector(a[6],.743125*i*i-.247708),t.addScaledVector(a[7],.858086*n*i),t.addScaledVector(a[8],.429043*(n*n-r*r)),t}},{key:"add",value:function(e){for(var t=0;t<9;t++)this.coefficients[t].add(e.coefficients[t]);return this}},{key:"addScaledSH",value:function(e,t){for(var n=0;n<9;n++)this.coefficients[n].addScaledVector(e.coefficients[n],t);return this}},{key:"scale",value:function(e){for(var t=0;t<9;t++)this.coefficients[t].multiplyScalar(e);return this}},{key:"lerp",value:function(e,t){for(var n=0;n<9;n++)this.coefficients[n].lerp(e.coefficients[n],t);return this}},{key:"equals",value:function(e){for(var t=0;t<9;t++)if(!this.coefficients[t].equals(e.coefficients[t]))return!1;return!0}},{key:"copy",value:function(e){return this.set(e.coefficients)}},{key:"clone",value:function(){return(new this.constructor).copy(this)}},{key:"fromArray",value:function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this.coefficients,r=0;r<9;r++)n[r].fromArray(e,t+3*r);return this}},{key:"toArray",value:function(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this.coefficients,r=0;r<9;r++)n[r].toArray(e,t+3*r);return e}}],[{key:"getBasisAt",value:function(e,t){var n=e.x,r=e.y,i=e.z;t[0]=.282095,t[1]=.488603*r,t[2]=.488603*i,t[3]=.488603*n,t[4]=1.092548*n*r,t[5]=1.092548*r*i,t[6]=.315392*(3*i*i-1),t[7]=1.092548*n*i,t[8]=.546274*(n*n-r*r)}}]),e}(),uf=function(e){w(n,e);var t=E(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new sf,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return a(this,n),(e=t.call(this,void 0,i)).isLightProbe=!0,e.sh=r,e}return s(n,[{key:"copy",value:function(e){return y(x(n.prototype),"copy",this).call(this,e),this.sh.copy(e.sh),this}},{key:"fromJSON",value:function(e){return this.intensity=e.intensity,this.sh.fromArray(e.sh),this}},{key:"toJSON",value:function(e){var t=y(x(n.prototype),"toJSON",this).call(this,e);return t.object.sh=this.sh.toArray(),t}}]),n}(Vd),lf=function(e){w(n,e);var t=E(n);function n(e){var r;return a(this,n),(r=t.call(this,e)).textures={},r}return s(n,[{key:"load",value:function(e,t,n,r){var i=this,a=new Od(i.manager);a.setPath(i.path),a.setRequestHeader(i.requestHeader),a.setWithCredentials(i.withCredentials),a.load(e,(function(n){try{t(i.parse(JSON.parse(n)))}catch(t){r?r(t):console.error(t),i.manager.itemError(e)}}),n,r)}},{key:"parse",value:function(e){var t=this.textures;function r(e){return void 0===t[e]&&console.warn("THREE.MaterialLoader: Undefined texture",e),t[e]}var i=n.createMaterialFromType(e.type);if(void 0!==e.uuid&&(i.uuid=e.uuid),void 0!==e.name&&(i.name=e.name),void 0!==e.color&&void 0!==i.color&&i.color.setHex(e.color),void 0!==e.roughness&&(i.roughness=e.roughness),void 0!==e.metalness&&(i.metalness=e.metalness),void 0!==e.sheen&&(i.sheen=e.sheen),void 0!==e.sheenColor&&(i.sheenColor=(new pa).setHex(e.sheenColor)),void 0!==e.sheenRoughness&&(i.sheenRoughness=e.sheenRoughness),void 0!==e.emissive&&void 0!==i.emissive&&i.emissive.setHex(e.emissive),void 0!==e.specular&&void 0!==i.specular&&i.specular.setHex(e.specular),void 0!==e.specularIntensity&&(i.specularIntensity=e.specularIntensity),void 0!==e.specularColor&&void 0!==i.specularColor&&i.specularColor.setHex(e.specularColor),void 0!==e.shininess&&(i.shininess=e.shininess),void 0!==e.clearcoat&&(i.clearcoat=e.clearcoat),void 0!==e.clearcoatRoughness&&(i.clearcoatRoughness=e.clearcoatRoughness),void 0!==e.iridescence&&(i.iridescence=e.iridescence),void 0!==e.iridescenceIOR&&(i.iridescenceIOR=e.iridescenceIOR),void 0!==e.iridescenceThicknessRange&&(i.iridescenceThicknessRange=e.iridescenceThicknessRange),void 0!==e.transmission&&(i.transmission=e.transmission),void 0!==e.thickness&&(i.thickness=e.thickness),void 0!==e.attenuationDistance&&(i.attenuationDistance=e.attenuationDistance),void 0!==e.attenuationColor&&void 0!==i.attenuationColor&&i.attenuationColor.setHex(e.attenuationColor),void 0!==e.anisotropy&&(i.anisotropy=e.anisotropy),void 0!==e.anisotropyRotation&&(i.anisotropyRotation=e.anisotropyRotation),void 0!==e.fog&&(i.fog=e.fog),void 0!==e.flatShading&&(i.flatShading=e.flatShading),void 0!==e.blending&&(i.blending=e.blending),void 0!==e.combine&&(i.combine=e.combine),void 0!==e.side&&(i.side=e.side),void 0!==e.shadowSide&&(i.shadowSide=e.shadowSide),void 0!==e.opacity&&(i.opacity=e.opacity),void 0!==e.transparent&&(i.transparent=e.transparent),void 0!==e.alphaTest&&(i.alphaTest=e.alphaTest),void 0!==e.alphaHash&&(i.alphaHash=e.alphaHash),void 0!==e.depthTest&&(i.depthTest=e.depthTest),void 0!==e.depthWrite&&(i.depthWrite=e.depthWrite),void 0!==e.colorWrite&&(i.colorWrite=e.colorWrite),void 0!==e.stencilWrite&&(i.stencilWrite=e.stencilWrite),void 0!==e.stencilWriteMask&&(i.stencilWriteMask=e.stencilWriteMask),void 0!==e.stencilFunc&&(i.stencilFunc=e.stencilFunc),void 0!==e.stencilRef&&(i.stencilRef=e.stencilRef),void 0!==e.stencilFuncMask&&(i.stencilFuncMask=e.stencilFuncMask),void 0!==e.stencilFail&&(i.stencilFail=e.stencilFail),void 0!==e.stencilZFail&&(i.stencilZFail=e.stencilZFail),void 0!==e.stencilZPass&&(i.stencilZPass=e.stencilZPass),void 0!==e.wireframe&&(i.wireframe=e.wireframe),void 0!==e.wireframeLinewidth&&(i.wireframeLinewidth=e.wireframeLinewidth),void 0!==e.wireframeLinecap&&(i.wireframeLinecap=e.wireframeLinecap),void 0!==e.wireframeLinejoin&&(i.wireframeLinejoin=e.wireframeLinejoin),void 0!==e.rotation&&(i.rotation=e.rotation),1!==e.linewidth&&(i.linewidth=e.linewidth),void 0!==e.dashSize&&(i.dashSize=e.dashSize),void 0!==e.gapSize&&(i.gapSize=e.gapSize),void 0!==e.scale&&(i.scale=e.scale),void 0!==e.polygonOffset&&(i.polygonOffset=e.polygonOffset),void 0!==e.polygonOffsetFactor&&(i.polygonOffsetFactor=e.polygonOffsetFactor),void 0!==e.polygonOffsetUnits&&(i.polygonOffsetUnits=e.polygonOffsetUnits),void 0!==e.dithering&&(i.dithering=e.dithering),void 0!==e.alphaToCoverage&&(i.alphaToCoverage=e.alphaToCoverage),void 0!==e.premultipliedAlpha&&(i.premultipliedAlpha=e.premultipliedAlpha),void 0!==e.forceSinglePass&&(i.forceSinglePass=e.forceSinglePass),void 0!==e.visible&&(i.visible=e.visible),void 0!==e.toneMapped&&(i.toneMapped=e.toneMapped),void 0!==e.userData&&(i.userData=e.userData),void 0!==e.vertexColors&&("number"==typeof e.vertexColors?i.vertexColors=e.vertexColors>0:i.vertexColors=e.vertexColors),void 0!==e.uniforms)for(var a in e.uniforms){var o=e.uniforms[a];switch(i.uniforms[a]={},o.type){case"t":i.uniforms[a].value=r(o.value);break;case"c":i.uniforms[a].value=(new pa).setHex(o.value);break;case"v2":i.uniforms[a].value=(new mr).fromArray(o.value);break;case"v3":i.uniforms[a].value=(new Yr).fromArray(o.value);break;case"v4":i.uniforms[a].value=(new Br).fromArray(o.value);break;case"m3":i.uniforms[a].value=(new gr).fromArray(o.value);break;case"m4":i.uniforms[a].value=(new wi).fromArray(o.value);break;default:i.uniforms[a].value=o.value}}if(void 0!==e.defines&&(i.defines=e.defines),void 0!==e.vertexShader&&(i.vertexShader=e.vertexShader),void 0!==e.fragmentShader&&(i.fragmentShader=e.fragmentShader),void 0!==e.glslVersion&&(i.glslVersion=e.glslVersion),void 0!==e.extensions)for(var s in e.extensions)i.extensions[s]=e.extensions[s];if(void 0!==e.lights&&(i.lights=e.lights),void 0!==e.clipping&&(i.clipping=e.clipping),void 0!==e.size&&(i.size=e.size),void 0!==e.sizeAttenuation&&(i.sizeAttenuation=e.sizeAttenuation),void 0!==e.map&&(i.map=r(e.map)),void 0!==e.matcap&&(i.matcap=r(e.matcap)),void 0!==e.alphaMap&&(i.alphaMap=r(e.alphaMap)),void 0!==e.bumpMap&&(i.bumpMap=r(e.bumpMap)),void 0!==e.bumpScale&&(i.bumpScale=e.bumpScale),void 0!==e.normalMap&&(i.normalMap=r(e.normalMap)),void 0!==e.normalMapType&&(i.normalMapType=e.normalMapType),void 0!==e.normalScale){var u=e.normalScale;!1===Array.isArray(u)&&(u=[u,u]),i.normalScale=(new mr).fromArray(u)}return void 0!==e.displacementMap&&(i.displacementMap=r(e.displacementMap)),void 0!==e.displacementScale&&(i.displacementScale=e.displacementScale),void 0!==e.displacementBias&&(i.displacementBias=e.displacementBias),void 0!==e.roughnessMap&&(i.roughnessMap=r(e.roughnessMap)),void 0!==e.metalnessMap&&(i.metalnessMap=r(e.metalnessMap)),void 0!==e.emissiveMap&&(i.emissiveMap=r(e.emissiveMap)),void 0!==e.emissiveIntensity&&(i.emissiveIntensity=e.emissiveIntensity),void 0!==e.specularMap&&(i.specularMap=r(e.specularMap)),void 0!==e.specularIntensityMap&&(i.specularIntensityMap=r(e.specularIntensityMap)),void 0!==e.specularColorMap&&(i.specularColorMap=r(e.specularColorMap)),void 0!==e.envMap&&(i.envMap=r(e.envMap)),void 0!==e.envMapIntensity&&(i.envMapIntensity=e.envMapIntensity),void 0!==e.reflectivity&&(i.reflectivity=e.reflectivity),void 0!==e.refractionRatio&&(i.refractionRatio=e.refractionRatio),void 0!==e.lightMap&&(i.lightMap=r(e.lightMap)),void 0!==e.lightMapIntensity&&(i.lightMapIntensity=e.lightMapIntensity),void 0!==e.aoMap&&(i.aoMap=r(e.aoMap)),void 0!==e.aoMapIntensity&&(i.aoMapIntensity=e.aoMapIntensity),void 0!==e.gradientMap&&(i.gradientMap=r(e.gradientMap)),void 0!==e.clearcoatMap&&(i.clearcoatMap=r(e.clearcoatMap)),void 0!==e.clearcoatRoughnessMap&&(i.clearcoatRoughnessMap=r(e.clearcoatRoughnessMap)),void 0!==e.clearcoatNormalMap&&(i.clearcoatNormalMap=r(e.clearcoatNormalMap)),void 0!==e.clearcoatNormalScale&&(i.clearcoatNormalScale=(new mr).fromArray(e.clearcoatNormalScale)),void 0!==e.iridescenceMap&&(i.iridescenceMap=r(e.iridescenceMap)),void 0!==e.iridescenceThicknessMap&&(i.iridescenceThicknessMap=r(e.iridescenceThicknessMap)),void 0!==e.transmissionMap&&(i.transmissionMap=r(e.transmissionMap)),void 0!==e.thicknessMap&&(i.thicknessMap=r(e.thicknessMap)),void 0!==e.anisotropyMap&&(i.anisotropyMap=r(e.anisotropyMap)),void 0!==e.sheenColorMap&&(i.sheenColorMap=r(e.sheenColorMap)),void 0!==e.sheenRoughnessMap&&(i.sheenRoughnessMap=r(e.sheenRoughnessMap)),i}},{key:"setTextures",value:function(e){return this.textures=e,this}}],[{key:"createMaterialFromType",value:function(e){return new{ShadowMaterial:Qh,SpriteMaterial:ml,RawShaderMaterial:$h,ShaderMaterial:po,PointsMaterial:vc,MeshPhysicalMaterial:td,MeshStandardMaterial:ed,MeshPhongMaterial:nd,MeshToonMaterial:rd,MeshNormalMaterial:id,MeshLambertMaterial:ad,MeshDepthMaterial:Xu,MeshDistanceMaterial:qu,MeshBasicMaterial:ma,MeshMatcapMaterial:od,LineDashedMaterial:sd,LineBasicMaterial:ic,Material:la}[e]}}]),n}(Pd),cf=function(){function e(){a(this,e)}return s(e,null,[{key:"decodeText",value:function(e){if("undefined"!=typeof TextDecoder)return(new TextDecoder).decode(e);for(var t="",n=0,r=e.length;n<r;n++)t+=String.fromCharCode(e[n]);try{return decodeURIComponent(escape(t))}catch(e){return t}}},{key:"extractUrlBase",value:function(e){var t=e.lastIndexOf("/");return-1===t?"./":e.slice(0,t+1)}},{key:"resolveURL",value:function(e,t){return"string"!=typeof e||""===e?"":(/^https?:\/\//i.test(t)&&/^\//.test(e)&&(t=t.replace(/(^https?:\/\/[^\/]+).*/i,"$1")),/^(https?:)?\/\//i.test(e)||/^data:.*,.*$/i.test(e)||/^blob:.*$/i.test(e)?e:t+e)}}]),e}(),hf=function(e){w(n,e);var t=E(n);function n(){var e;return a(this,n),(e=t.call(this)).isInstancedBufferGeometry=!0,e.type="InstancedBufferGeometry",e.instanceCount=1/0,e}return s(n,[{key:"copy",value:function(e){return y(x(n.prototype),"copy",this).call(this,e),this.instanceCount=e.instanceCount,this}},{key:"toJSON",value:function(){var e=y(x(n.prototype),"toJSON",this).call(this);return e.instanceCount=this.instanceCount,e.isInstancedBufferGeometry=!0,e}}]),n}(Ga),df=function(e){w(n,e);var t=E(n);function n(e){return a(this,n),t.call(this,e)}return s(n,[{key:"load",value:function(e,t,n,r){var i=this,a=new Od(i.manager);a.setPath(i.path),a.setRequestHeader(i.requestHeader),a.setWithCredentials(i.withCredentials),a.load(e,(function(n){try{t(i.parse(JSON.parse(n)))}catch(t){r?r(t):console.error(t),i.manager.itemError(e)}}),n,r)}},{key:"parse",value:function(e){var t={},n={};function r(e,r){if(void 0!==t[r])return t[r];var i=e.interleavedBuffers[r],a=function(e,t){if(void 0!==n[t])return n[t];var r=e.arrayBuffers,i=r[t],a=new Uint32Array(i).buffer;return n[t]=a,a}(e,i.buffer),o=Mr(i.type,a),s=new fl(o,i.stride);return s.uuid=i.uuid,t[r]=s,s}var i=e.isInstancedBufferGeometry?new hf:new Ga,a=e.data.index;if(void 0!==a){var o=Mr(a.type,a.array);i.setIndex(new wa(o,1))}var s=e.data.attributes;for(var u in s){var l=s[u],c=void 0;if(l.isInterleavedBufferAttribute){var h=r(e.data,l.data);c=new vl(h,l.itemSize,l.offset,l.normalized)}else{var d=Mr(l.type,l.array);c=new(l.isInstancedBufferAttribute?Zl:wa)(d,l.itemSize,l.normalized)}void 0!==l.name&&(c.name=l.name),void 0!==l.usage&&c.setUsage(l.usage),void 0!==l.updateRange&&(c.updateRange.offset=l.updateRange.offset,c.updateRange.count=l.updateRange.count),i.setAttribute(u,c)}var f=e.data.morphAttributes;if(f)for(var p in f){for(var v=f[p],m=[],g=0,y=v.length;g<y;g++){var _=v[g],x=void 0;if(_.isInterleavedBufferAttribute){var M=r(e.data,_.data);x=new vl(M,_.itemSize,_.offset,_.normalized)}else{var S=Mr(_.type,_.array);x=new wa(S,_.itemSize,_.normalized)}void 0!==_.name&&(x.name=_.name),m.push(x)}i.morphAttributes[p]=m}e.data.morphTargetsRelative&&(i.morphTargetsRelative=!0);var b=e.data.groups||e.data.drawcalls||e.data.offsets;if(void 0!==b)for(var w=0,T=b.length;w!==T;++w){var E=b[w];i.addGroup(E.start,E.count,E.materialIndex)}var A=e.data.boundingSphere;if(void 0!==A){var R=new Yr;void 0!==A.center&&R.fromArray(A.center),i.boundingSphere=new vi(R,A.radius)}return e.name&&(i.name=e.name),e.userData&&(i.userData=e.userData),i}}]),n}(Pd),ff=function(e){w(o,e);var t,n,r,i=E(o);function o(e){return a(this,o),i.call(this,e)}return s(o,[{key:"load",value:function(e,t,n,r){var i=this,a=""===this.path?cf.extractUrlBase(e):this.path;this.resourcePath=this.resourcePath||a;var o=new Od(this.manager);o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(e,(function(n){var a=null;try{a=JSON.parse(n)}catch(t){return void 0!==r&&r(t),void console.error("THREE:ObjectLoader: Can't parse "+e+".",t.message)}var o=a.metadata;if(void 0===o||void 0===o.type||"geometry"===o.type.toLowerCase())return void 0!==r&&r(new Error("THREE.ObjectLoader: Can't load "+e)),void console.error("THREE.ObjectLoader: Can't load "+e);i.parse(a,t)}),n,r)}},{key:"loadAsync",value:(r=p(R().mark((function e(t,n){var r,i,a,o,s,u;return R().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=this,i=""===this.path?cf.extractUrlBase(t):this.path,this.resourcePath=this.resourcePath||i,(a=new Od(this.manager)).setPath(this.path),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),e.next=9,a.loadAsync(t,n);case 9:if(o=e.sent,s=JSON.parse(o),void 0!==(u=s.metadata)&&void 0!==u.type&&"geometry"!==u.type.toLowerCase()){e.next=14;break}throw new Error("THREE.ObjectLoader: Can't load "+t);case 14:return e.next=16,r.parseAsync(s);case 16:return e.abrupt("return",e.sent);case 17:case"end":return e.stop()}}),e,this)}))),function(e,t){return r.apply(this,arguments)})},{key:"parse",value:function(e,t){var n=this.parseAnimations(e.animations),r=this.parseShapes(e.shapes),i=this.parseGeometries(e.geometries,r),a=this.parseImages(e.images,(function(){void 0!==t&&t(u)})),o=this.parseTextures(e.textures,a),s=this.parseMaterials(e.materials,o),u=this.parseObject(e.object,i,s,o,n),l=this.parseSkeletons(e.skeletons,u);if(this.bindSkeletons(u,l),void 0!==t){var c=!1;for(var h in a)if(a[h].data instanceof HTMLImageElement){c=!0;break}!1===c&&t(u)}return u}},{key:"parseAsync",value:(n=p(R().mark((function e(t){var n,r,i,a,o,s,u,l;return R().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=this.parseAnimations(t.animations),r=this.parseShapes(t.shapes),i=this.parseGeometries(t.geometries,r),e.next=5,this.parseImagesAsync(t.images);case 5:return a=e.sent,o=this.parseTextures(t.textures,a),s=this.parseMaterials(t.materials,o),u=this.parseObject(t.object,i,s,o,n),l=this.parseSkeletons(t.skeletons,u),this.bindSkeletons(u,l),e.abrupt("return",u);case 12:case"end":return e.stop()}}),e,this)}))),function(e){return n.apply(this,arguments)})},{key:"parseShapes",value:function(e){var t={};if(void 0!==e)for(var n=0,r=e.length;n<r;n++){var i=(new uh).fromJSON(e[n]);t[i.uuid]=i}return t}},{key:"parseSkeletons",value:function(e,t){var n={},r={};if(t.traverse((function(e){e.isBone&&(r[e.uuid]=e)})),void 0!==e)for(var i=0,a=e.length;i<a;i++){var o=(new Yl).fromJSON(e[i],r);n[o.uuid]=o}return n}},{key:"parseGeometries",value:function(e,t){var n={};if(void 0!==e)for(var r=new df,i=0,a=e.length;i<a;i++){var o=void 0,s=e[i];switch(s.type){case"BufferGeometry":case"InstancedBufferGeometry":o=r.parse(s);break;default:s.type in Jh?o=Jh[s.type].fromJSON(s,t):console.warn('THREE.ObjectLoader: Unsupported geometry type "'.concat(s.type,'"'))}o.uuid=s.uuid,void 0!==s.name&&(o.name=s.name),void 0!==s.userData&&(o.userData=s.userData),n[s.uuid]=o}return n}},{key:"parseMaterials",value:function(e,t){var n={},r={};if(void 0!==e){var i=new lf;i.setTextures(t);for(var a=0,o=e.length;a<o;a++){var s=e[a];void 0===n[s.uuid]&&(n[s.uuid]=i.parse(s)),r[s.uuid]=n[s.uuid]}}return r}},{key:"parseAnimations",value:function(e){var t={};if(void 0!==e)for(var n=0;n<e.length;n++){var r=e[n],i=Ad.parse(r);t[i.uuid]=i}return t}},{key:"parseImages",value:function(e,t){var n,r=this,i={};function a(e){if("string"==typeof e){var t=e;return function(e){return r.manager.itemStart(e),n.load(e,(function(){r.manager.itemEnd(e)}),void 0,(function(){r.manager.itemError(e),r.manager.itemEnd(e)}))}(/^(\/\/)|([a-z]+:(\/\/)?)/i.test(t)?t:r.resourcePath+t)}return e.data?{data:Mr(e.type,e.data),width:e.width,height:e.height}:null}if(void 0!==e&&e.length>0){var o=new Cd(t);(n=new Bd(o)).setCrossOrigin(this.crossOrigin);for(var s=0,u=e.length;s<u;s++){var l=e[s],c=l.url;if(Array.isArray(c)){for(var h=[],d=0,f=c.length;d<f;d++){var p=a(c[d]);null!==p&&(p instanceof HTMLImageElement?h.push(p):h.push(new jl(p.data,p.width,p.height)))}i[l.uuid]=new Ur(h)}else{var v=a(l.url);i[l.uuid]=new Ur(v)}}}return i}},{key:"parseImagesAsync",value:(t=p(R().mark((function e(t){var n,r,i,a,o,s,u,l,c,h,d,f,v,m,g;return R().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(o=function(){return o=p(R().mark((function e(t){var r,a;return R().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if("string"!=typeof t){e.next=8;break}return a=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(r=t)?r:n.resourcePath+r,e.next=5,i.loadAsync(a);case 5:return e.abrupt("return",e.sent);case 8:if(!t.data){e.next=12;break}return e.abrupt("return",{data:Mr(t.type,t.data),width:t.width,height:t.height});case 12:return e.abrupt("return",null);case 13:case"end":return e.stop()}}),e)}))),o.apply(this,arguments)},a=function(e){return o.apply(this,arguments)},n=this,r={},!(void 0!==t&&t.length>0)){e.next=33;break}(i=new Bd(this.manager)).setCrossOrigin(this.crossOrigin),s=0,u=t.length;case 8:if(!(s<u)){e.next=33;break}if(l=t[s],c=l.url,!Array.isArray(c)){e.next=26;break}h=[],d=0,f=c.length;case 14:if(!(d<f)){e.next=23;break}return v=c[d],e.next=18,a(v);case 18:null!==(m=e.sent)&&(m instanceof HTMLImageElement?h.push(m):h.push(new jl(m.data,m.width,m.height)));case 20:d++,e.next=14;break;case 23:r[l.uuid]=new Ur(h),e.next=30;break;case 26:return e.next=28,a(l.url);case 28:g=e.sent,r[l.uuid]=new Ur(g);case 30:s++,e.next=8;break;case 33:return e.abrupt("return",r);case 34:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})},{key:"parseTextures",value:function(e,t){function n(e,t){return"number"==typeof e?e:(console.warn("THREE.ObjectLoader.parseTexture: Constant should be in numeric form.",e),t[e])}var r={};if(void 0!==e)for(var i=0,a=e.length;i<a;i++){var o=e[i];void 0===o.image&&console.warn('THREE.ObjectLoader: No "image" specified for',o.uuid),void 0===t[o.image]&&console.warn("THREE.ObjectLoader: Undefined image",o.image);var s=t[o.image],u=s.data,l=void 0;Array.isArray(u)?(l=new _o,6===u.length&&(l.needsUpdate=!0)):(l=u&&u.data?new jl:new Fr,u&&(l.needsUpdate=!0)),l.source=s,l.uuid=o.uuid,void 0!==o.name&&(l.name=o.name),void 0!==o.mapping&&(l.mapping=n(o.mapping,pf)),void 0!==o.channel&&(l.channel=o.channel),void 0!==o.offset&&l.offset.fromArray(o.offset),void 0!==o.repeat&&l.repeat.fromArray(o.repeat),void 0!==o.center&&l.center.fromArray(o.center),void 0!==o.rotation&&(l.rotation=o.rotation),void 0!==o.wrap&&(l.wrapS=n(o.wrap[0],vf),l.wrapT=n(o.wrap[1],vf)),void 0!==o.format&&(l.format=o.format),void 0!==o.internalFormat&&(l.internalFormat=o.internalFormat),void 0!==o.type&&(l.type=o.type),void 0!==o.colorSpace&&(l.colorSpace=o.colorSpace),void 0!==o.encoding&&(l.encoding=o.encoding),void 0!==o.minFilter&&(l.minFilter=n(o.minFilter,mf)),void 0!==o.magFilter&&(l.magFilter=n(o.magFilter,mf)),void 0!==o.anisotropy&&(l.anisotropy=o.anisotropy),void 0!==o.flipY&&(l.flipY=o.flipY),void 0!==o.generateMipmaps&&(l.generateMipmaps=o.generateMipmaps),void 0!==o.premultiplyAlpha&&(l.premultiplyAlpha=o.premultiplyAlpha),void 0!==o.unpackAlignment&&(l.unpackAlignment=o.unpackAlignment),void 0!==o.compareFunction&&(l.compareFunction=o.compareFunction),void 0!==o.userData&&(l.userData=o.userData),r[o.uuid]=l}return r}},{key:"parseObject",value:function(e,t,n,r,i){var a,o,s;function u(e){return void 0===t[e]&&console.warn("THREE.ObjectLoader: Undefined geometry",e),t[e]}function l(e){if(void 0!==e){if(Array.isArray(e)){for(var t=[],r=0,i=e.length;r<i;r++){var a=e[r];void 0===n[a]&&console.warn("THREE.ObjectLoader: Undefined material",a),t.push(n[a])}return t}return void 0===n[e]&&console.warn("THREE.ObjectLoader: Undefined material",e),n[e]}}function c(e){return void 0===r[e]&&console.warn("THREE.ObjectLoader: Undefined texture",e),r[e]}switch(e.type){case"Scene":a=new dl,void 0!==e.background&&(Number.isInteger(e.background)?a.background=new pa(e.background):a.background=c(e.background)),void 0!==e.environment&&(a.environment=c(e.environment)),void 0!==e.fog&&("Fog"===e.fog.type?a.fog=new hl(e.fog.color,e.fog.near,e.fog.far):"FogExp2"===e.fog.type&&(a.fog=new cl(e.fog.color,e.fog.density))),void 0!==e.backgroundBlurriness&&(a.backgroundBlurriness=e.backgroundBlurriness),void 0!==e.backgroundIntensity&&(a.backgroundIntensity=e.backgroundIntensity);break;case"PerspectiveCamera":a=new mo(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 Ho(e.left,e.right,e.top,e.bottom,e.near,e.far),void 0!==e.zoom&&(a.zoom=e.zoom),void 0!==e.view&&(a.view=Object.assign({},e.view));break;case"AmbientLight":a=new af(e.color,e.intensity);break;case"DirectionalLight":a=new rf(e.color,e.intensity);break;case"PointLight":a=new tf(e.color,e.intensity,e.distance,e.decay);break;case"RectAreaLight":a=new of(e.color,e.intensity,e.width,e.height);break;case"SpotLight":a=new Kd(e.color,e.intensity,e.distance,e.angle,e.penumbra,e.decay);break;case"HemisphereLight":a=new Wd(e.color,e.groundColor,e.intensity);break;case"LightProbe":a=(new uf).fromJSON(e);break;case"SkinnedMesh":o=u(e.geometry),s=l(e.material),a=new Vl(o,s),void 0!==e.bindMode&&(a.bindMode=e.bindMode),void 0!==e.bindMatrix&&a.bindMatrix.fromArray(e.bindMatrix),void 0!==e.skeleton&&(a.skeleton=e.skeleton);break;case"Mesh":o=u(e.geometry),s=l(e.material),a=new oo(o,s);break;case"InstancedMesh":o=u(e.geometry),s=l(e.material);var h=e.count,d=e.instanceMatrix,f=e.instanceColor;(a=new rc(o,s,h)).instanceMatrix=new Zl(new Float32Array(d.array),16),void 0!==f&&(a.instanceColor=new Zl(new Float32Array(f.array),f.itemSize));break;case"LOD":a=new Il;break;case"Line":a=new cc(u(e.geometry),l(e.material));break;case"LineLoop":a=new pc(u(e.geometry),l(e.material));break;case"LineSegments":a=new fc(u(e.geometry),l(e.material));break;case"PointCloud":case"Points":a=new xc(u(e.geometry),l(e.material));break;case"Sprite":a=new kl(l(e.material));break;case"Group":a=new $u;break;case"Bone":a=new Wl;break;default:a=new Zi}if(a.uuid=e.uuid,void 0!==e.name&&(a.name=e.name),void 0!==e.matrix?(a.matrix.fromArray(e.matrix),void 0!==e.matrixAutoUpdate&&(a.matrixAutoUpdate=e.matrixAutoUpdate),a.matrixAutoUpdate&&a.matrix.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.up&&a.up.fromArray(e.up),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.normalBias&&(a.shadow.normalBias=e.shadow.normalBias),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.frustumCulled&&(a.frustumCulled=e.frustumCulled),void 0!==e.renderOrder&&(a.renderOrder=e.renderOrder),void 0!==e.userData&&(a.userData=e.userData),void 0!==e.layers&&(a.layers.mask=e.layers),void 0!==e.children)for(var p=e.children,v=0;v<p.length;v++)a.add(this.parseObject(p[v],t,n,r,i));if(void 0!==e.animations)for(var m=e.animations,g=0;g<m.length;g++){var y=m[g];a.animations.push(i[y])}if("LOD"===e.type){void 0!==e.autoUpdate&&(a.autoUpdate=e.autoUpdate);for(var _=e.levels,x=0;x<_.length;x++){var M=_[x],S=a.getObjectByProperty("uuid",M.object);void 0!==S&&a.addLevel(S,M.distance,M.hysteresis)}}return a}},{key:"bindSkeletons",value:function(e,t){0!==Object.keys(t).length&&e.traverse((function(e){if(!0===e.isSkinnedMesh&&void 0!==e.skeleton){var n=t[e.skeleton];void 0===n?console.warn("THREE.ObjectLoader: No skeleton found with UUID:",e.skeleton):e.bind(n,e.bindMatrix)}}))}}]),o}(Pd),pf={UVMapping:ke,CubeReflectionMapping:Ce,CubeRefractionMapping:Le,EquirectangularReflectionMapping:Pe,EquirectangularRefractionMapping:Ie,CubeUVReflectionMapping:De},vf={RepeatWrapping:Ue,ClampToEdgeWrapping:Oe,MirroredRepeatWrapping:Ne},mf={NearestFilter:Fe,NearestMipmapNearestFilter:Be,NearestMipmapLinearFilter:He,LinearFilter:Ve,LinearMipmapNearestFilter:We,LinearMipmapLinearFilter:Xe},gf=function(e){w(n,e);var t=E(n);function n(e){var r;return a(this,n),(r=t.call(this,e)).isImageBitmapLoader=!0,"undefined"==typeof createImageBitmap&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."),"undefined"==typeof fetch&&console.warn("THREE.ImageBitmapLoader: fetch() not supported."),r.options={premultiplyAlpha:"none"},r}return s(n,[{key:"setOptions",value:function(e){return this.options=e,this}},{key:"load",value:function(e,t,n,r){void 0===e&&(e=""),void 0!==this.path&&(e=this.path+e),e=this.manager.resolveURL(e);var i=this,a=kd.get(e);if(void 0!==a)return i.manager.itemStart(e),setTimeout((function(){t&&t(a),i.manager.itemEnd(e)}),0),a;var o={};o.credentials="anonymous"===this.crossOrigin?"same-origin":"include",o.headers=this.requestHeader,fetch(e,o).then((function(e){return e.blob()})).then((function(e){return createImageBitmap(e,Object.assign(i.options,{colorSpaceConversion:"none"}))})).then((function(n){kd.add(e,n),t&&t(n),i.manager.itemEnd(e)})).catch((function(t){r&&r(t),i.manager.itemError(e),i.manager.itemEnd(e)})),i.manager.itemStart(e)}}]),n}(Pd),yf=function(){function e(){a(this,e)}return s(e,null,[{key:"getContext",value:function(){return void 0===Id&&(Id=new(window.AudioContext||window.webkitAudioContext)),Id}},{key:"setContext",value:function(e){Id=e}}]),e}(),_f=function(e){w(n,e);var t=E(n);function n(e){return a(this,n),t.call(this,e)}return s(n,[{key:"load",value:function(e,t,n,r){var i=this,a=new Od(this.manager);function o(t){r?r(t):console.error(t),i.manager.itemError(e)}a.setResponseType("arraybuffer"),a.setPath(this.path),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(e,(function(e){try{var n=e.slice(0);yf.getContext().decodeAudioData(n,(function(e){t(e)}),o)}catch(e){o(e)}}),n,r)}}]),n}(Pd),xf=function(e){w(n,e);var t=E(n);function n(e,r){var i,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;a(this,n),(i=t.call(this,void 0,o)).isHemisphereLightProbe=!0;var s=(new pa).set(e),u=(new pa).set(r),l=new Yr(s.r,s.g,s.b),c=new Yr(u.r,u.g,u.b),h=Math.sqrt(Math.PI),d=h*Math.sqrt(.75);return i.sh.coefficients[0].copy(l).add(c).multiplyScalar(h),i.sh.coefficients[1].copy(l).sub(c).multiplyScalar(d),i}return s(n)}(uf),Mf=function(e){w(n,e);var t=E(n);function n(e){var r,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;a(this,n),(r=t.call(this,void 0,i)).isAmbientLightProbe=!0;var o=(new pa).set(e);return r.sh.coefficients[0].set(o.r,o.g,o.b).multiplyScalar(2*Math.sqrt(Math.PI)),r}return s(n)}(uf),Sf=new wi,bf=new wi,wf=new wi,Tf=function(){function e(){a(this,e),this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new mo,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new mo,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1,this._cache={focus:null,fov:null,aspect:null,near:null,far:null,zoom:null,eyeSep:null}}return s(e,[{key:"update",value:function(e){var t=this._cache;if(t.focus!==e.focus||t.fov!==e.fov||t.aspect!==e.aspect*this.aspect||t.near!==e.near||t.far!==e.far||t.zoom!==e.zoom||t.eyeSep!==this.eyeSep){t.focus=e.focus,t.fov=e.fov,t.aspect=e.aspect*this.aspect,t.near=e.near,t.far=e.far,t.zoom=e.zoom,t.eyeSep=this.eyeSep,wf.copy(e.projectionMatrix);var n,r,i=t.eyeSep/2,a=i*t.near/t.focus,o=t.near*Math.tan(ir*t.fov*.5)/t.zoom;bf.elements[12]=-i,Sf.elements[12]=i,n=-o*t.aspect+a,r=o*t.aspect+a,wf.elements[0]=2*t.near/(r-n),wf.elements[8]=(r+n)/(r-n),this.cameraL.projectionMatrix.copy(wf),n=-o*t.aspect-a,r=o*t.aspect-a,wf.elements[0]=2*t.near/(r-n),wf.elements[8]=(r+n)/(r-n),this.cameraR.projectionMatrix.copy(wf)}this.cameraL.matrixWorld.copy(e.matrixWorld).multiply(bf),this.cameraR.matrixWorld.copy(e.matrixWorld).multiply(Sf)}}]),e}(),Ef=function(){function e(){var t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];a(this,e),this.autoStart=t,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}return s(e,[{key:"start",value:function(){this.startTime=Af(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0}},{key:"stop",value:function(){this.getElapsedTime(),this.running=!1,this.autoStart=!1}},{key:"getElapsedTime",value:function(){return this.getDelta(),this.elapsedTime}},{key:"getDelta",value:function(){var e=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){var t=Af();e=(t-this.oldTime)/1e3,this.oldTime=t,this.elapsedTime+=e}return e}}]),e}();function Af(){return("undefined"==typeof performance?Date:performance).now()}var Rf=new Yr,kf=new qr,Cf=new Yr,Lf=new Yr,Pf=function(e){w(n,e);var t=E(n);function n(){var e;return a(this,n),(e=t.call(this)).type="AudioListener",e.context=yf.getContext(),e.gain=e.context.createGain(),e.gain.connect(e.context.destination),e.filter=null,e.timeDelta=0,e._clock=new Ef,e}return s(n,[{key:"getInput",value:function(){return this.gain}},{key:"removeFilter",value:function(){return null!==this.filter&&(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination),this.gain.connect(this.context.destination),this.filter=null),this}},{key:"getFilter",value:function(){return this.filter}},{key:"setFilter",value:function(e){return null!==this.filter?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination),this.filter=e,this.gain.connect(this.filter),this.filter.connect(this.context.destination),this}},{key:"getMasterVolume",value:function(){return this.gain.gain.value}},{key:"setMasterVolume",value:function(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this}},{key:"updateMatrixWorld",value:function(e){y(x(n.prototype),"updateMatrixWorld",this).call(this,e);var t=this.context.listener,r=this.up;if(this.timeDelta=this._clock.getDelta(),this.matrixWorld.decompose(Rf,kf,Cf),Lf.set(0,0,-1).applyQuaternion(kf),t.positionX){var i=this.context.currentTime+this.timeDelta;t.positionX.linearRampToValueAtTime(Rf.x,i),t.positionY.linearRampToValueAtTime(Rf.y,i),t.positionZ.linearRampToValueAtTime(Rf.z,i),t.forwardX.linearRampToValueAtTime(Lf.x,i),t.forwardY.linearRampToValueAtTime(Lf.y,i),t.forwardZ.linearRampToValueAtTime(Lf.z,i),t.upX.linearRampToValueAtTime(r.x,i),t.upY.linearRampToValueAtTime(r.y,i),t.upZ.linearRampToValueAtTime(r.z,i)}else t.setPosition(Rf.x,Rf.y,Rf.z),t.setOrientation(Lf.x,Lf.y,Lf.z,r.x,r.y,r.z)}}]),n}(Zi),If=function(e){w(n,e);var t=E(n);function n(e){var r;return a(this,n),(r=t.call(this)).type="Audio",r.listener=e,r.context=e.context,r.gain=r.context.createGain(),r.gain.connect(e.getInput()),r.autoplay=!1,r.buffer=null,r.detune=0,r.loop=!1,r.loopStart=0,r.loopEnd=0,r.offset=0,r.duration=void 0,r.playbackRate=1,r.isPlaying=!1,r.hasPlaybackControl=!0,r.source=null,r.sourceType="empty",r._startedAt=0,r._progress=0,r._connected=!1,r.filters=[],r}return s(n,[{key:"getOutput",value:function(){return this.gain}},{key:"setNodeSource",value:function(e){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=e,this.connect(),this}},{key:"setMediaElementSource",value:function(e){return this.hasPlaybackControl=!1,this.sourceType="mediaNode",this.source=this.context.createMediaElementSource(e),this.connect(),this}},{key:"setMediaStreamSource",value:function(e){return this.hasPlaybackControl=!1,this.sourceType="mediaStreamNode",this.source=this.context.createMediaStreamSource(e),this.connect(),this}},{key:"setBuffer",value:function(e){return this.buffer=e,this.sourceType="buffer",this.autoplay&&this.play(),this}},{key:"play",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;if(!0!==this.isPlaying){if(!1!==this.hasPlaybackControl){this._startedAt=this.context.currentTime+e;var t=this.context.createBufferSource();return t.buffer=this.buffer,t.loop=this.loop,t.loopStart=this.loopStart,t.loopEnd=this.loopEnd,t.onended=this.onEnded.bind(this),t.start(this._startedAt,this._progress+this.offset,this.duration),this.isPlaying=!0,this.source=t,this.setDetune(this.detune),this.setPlaybackRate(this.playbackRate),this.connect()}console.warn("THREE.Audio: this Audio has no playback control.")}else console.warn("THREE.Audio: Audio is already playing.")}},{key:"pause",value:function(){if(!1!==this.hasPlaybackControl)return!0===this.isPlaying&&(this._progress+=Math.max(this.context.currentTime-this._startedAt,0)*this.playbackRate,!0===this.loop&&(this._progress=this._progress%(this.duration||this.buffer.duration)),this.source.stop(),this.source.onended=null,this.isPlaying=!1),this;console.warn("THREE.Audio: this Audio has no playback control.")}},{key:"stop",value:function(){if(!1!==this.hasPlaybackControl)return this._progress=0,null!==this.source&&(this.source.stop(),this.source.onended=null),this.isPlaying=!1,this;console.warn("THREE.Audio: this Audio has no playback control.")}},{key:"connect",value:function(){if(this.filters.length>0){this.source.connect(this.filters[0]);for(var e=1,t=this.filters.length;e<t;e++)this.filters[e-1].connect(this.filters[e]);this.filters[this.filters.length-1].connect(this.getOutput())}else this.source.connect(this.getOutput());return this._connected=!0,this}},{key:"disconnect",value:function(){if(this.filters.length>0){this.source.disconnect(this.filters[0]);for(var e=1,t=this.filters.length;e<t;e++)this.filters[e-1].disconnect(this.filters[e]);this.filters[this.filters.length-1].disconnect(this.getOutput())}else this.source.disconnect(this.getOutput());return this._connected=!1,this}},{key:"getFilters",value:function(){return this.filters}},{key:"setFilters",value:function(e){return e||(e=[]),!0===this._connected?(this.disconnect(),this.filters=e.slice(),this.connect()):this.filters=e.slice(),this}},{key:"setDetune",value:function(e){if(this.detune=e,void 0!==this.source.detune)return!0===this.isPlaying&&this.source.detune.setTargetAtTime(this.detune,this.context.currentTime,.01),this}},{key:"getDetune",value:function(){return this.detune}},{key:"getFilter",value:function(){return this.getFilters()[0]}},{key:"setFilter",value:function(e){return this.setFilters(e?[e]:[])}},{key:"setPlaybackRate",value:function(e){if(!1!==this.hasPlaybackControl)return this.playbackRate=e,!0===this.isPlaying&&this.source.playbackRate.setTargetAtTime(this.playbackRate,this.context.currentTime,.01),this;console.warn("THREE.Audio: this Audio has no playback control.")}},{key:"getPlaybackRate",value:function(){return this.playbackRate}},{key:"onEnded",value:function(){this.isPlaying=!1}},{key:"getLoop",value:function(){return!1===this.hasPlaybackControl?(console.warn("THREE.Audio: this Audio has no playback control."),!1):this.loop}},{key:"setLoop",value:function(e){if(!1!==this.hasPlaybackControl)return this.loop=e,!0===this.isPlaying&&(this.source.loop=this.loop),this;console.warn("THREE.Audio: this Audio has no playback control.")}},{key:"setLoopStart",value:function(e){return this.loopStart=e,this}},{key:"setLoopEnd",value:function(e){return this.loopEnd=e,this}},{key:"getVolume",value:function(){return this.gain.gain.value}},{key:"setVolume",value:function(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this}}]),n}(Zi),Df=new Yr,Uf=new qr,Of=new Yr,Nf=new Yr,Ff=function(e){w(n,e);var t=E(n);function n(e){var r;return a(this,n),(r=t.call(this,e)).panner=r.context.createPanner(),r.panner.panningModel="HRTF",r.panner.connect(r.gain),r}return s(n,[{key:"connect",value:function(){y(x(n.prototype),"connect",this).call(this),this.panner.connect(this.gain)}},{key:"disconnect",value:function(){y(x(n.prototype),"disconnect",this).call(this),this.panner.disconnect(this.gain)}},{key:"getOutput",value:function(){return this.panner}},{key:"getRefDistance",value:function(){return this.panner.refDistance}},{key:"setRefDistance",value:function(e){return this.panner.refDistance=e,this}},{key:"getRolloffFactor",value:function(){return this.panner.rolloffFactor}},{key:"setRolloffFactor",value:function(e){return this.panner.rolloffFactor=e,this}},{key:"getDistanceModel",value:function(){return this.panner.distanceModel}},{key:"setDistanceModel",value:function(e){return this.panner.distanceModel=e,this}},{key:"getMaxDistance",value:function(){return this.panner.maxDistance}},{key:"setMaxDistance",value:function(e){return this.panner.maxDistance=e,this}},{key:"setDirectionalCone",value:function(e,t,n){return this.panner.coneInnerAngle=e,this.panner.coneOuterAngle=t,this.panner.coneOuterGain=n,this}},{key:"updateMatrixWorld",value:function(e){if(y(x(n.prototype),"updateMatrixWorld",this).call(this,e),!0!==this.hasPlaybackControl||!1!==this.isPlaying){this.matrixWorld.decompose(Df,Uf,Of),Nf.set(0,0,1).applyQuaternion(Uf);var t=this.panner;if(t.positionX){var r=this.context.currentTime+this.listener.timeDelta;t.positionX.linearRampToValueAtTime(Df.x,r),t.positionY.linearRampToValueAtTime(Df.y,r),t.positionZ.linearRampToValueAtTime(Df.z,r),t.orientationX.linearRampToValueAtTime(Nf.x,r),t.orientationY.linearRampToValueAtTime(Nf.y,r),t.orientationZ.linearRampToValueAtTime(Nf.z,r)}else t.setPosition(Df.x,Df.y,Df.z),t.setOrientation(Nf.x,Nf.y,Nf.z)}}}]),n}(If),Bf=function(){function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2048;a(this,e),this.analyser=t.context.createAnalyser(),this.analyser.fftSize=n,this.data=new Uint8Array(this.analyser.frequencyBinCount),t.getOutput().connect(this.analyser)}return s(e,[{key:"getFrequencyData",value:function(){return this.analyser.getByteFrequencyData(this.data),this.data}},{key:"getAverageFrequency",value:function(){for(var e=0,t=this.getFrequencyData(),n=0;n<t.length;n++)e+=t[n];return e/t.length}}]),e}(),zf=function(){function e(t,n,r){var i,o,s;switch(a(this,e),this.binding=t,this.valueSize=r,n){case"quaternion":i=this._slerp,o=this._slerpAdditive,s=this._setAdditiveIdentityQuaternion,this.buffer=new Float64Array(6*r),this._workIndex=5;break;case"string":case"bool":i=this._select,o=this._select,s=this._setAdditiveIdentityOther,this.buffer=new Array(5*r);break;default:i=this._lerp,o=this._lerpAdditive,s=this._setAdditiveIdentityNumeric,this.buffer=new Float64Array(5*r)}this._mixBufferRegion=i,this._mixBufferRegionAdditive=o,this._setIdentity=s,this._origIndex=3,this._addIndex=4,this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,this.useCount=0,this.referenceCount=0}return s(e,[{key:"accumulate",value:function(e,t){var n=this.buffer,r=this.valueSize,i=e*r+r,a=this.cumulativeWeight;if(0===a){for(var o=0;o!==r;++o)n[i+o]=n[o];a=t}else{var s=t/(a+=t);this._mixBufferRegion(n,i,0,s,r)}this.cumulativeWeight=a}},{key:"accumulateAdditive",value:function(e){var t=this.buffer,n=this.valueSize,r=n*this._addIndex;0===this.cumulativeWeightAdditive&&this._setIdentity(),this._mixBufferRegionAdditive(t,r,0,e,n),this.cumulativeWeightAdditive+=e}},{key:"apply",value:function(e){var t=this.valueSize,n=this.buffer,r=e*t+t,i=this.cumulativeWeight,a=this.cumulativeWeightAdditive,o=this.binding;if(this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,i<1){var s=t*this._origIndex;this._mixBufferRegion(n,r,s,1-i,t)}a>0&&this._mixBufferRegionAdditive(n,r,this._addIndex*t,1,t);for(var u=t,l=t+t;u!==l;++u)if(n[u]!==n[u+t]){o.setValue(n,r);break}}},{key:"saveOriginalState",value:function(){var e=this.binding,t=this.buffer,n=this.valueSize,r=n*this._origIndex;e.getValue(t,r);for(var i=n,a=r;i!==a;++i)t[i]=t[r+i%n];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}},{key:"restoreOriginalState",value:function(){var e=3*this.valueSize;this.binding.setValue(this.buffer,e)}},{key:"_setAdditiveIdentityNumeric",value:function(){for(var e=this._addIndex*this.valueSize,t=e+this.valueSize,n=e;n<t;n++)this.buffer[n]=0}},{key:"_setAdditiveIdentityQuaternion",value:function(){this._setAdditiveIdentityNumeric(),this.buffer[this._addIndex*this.valueSize+3]=1}},{key:"_setAdditiveIdentityOther",value:function(){for(var e=this._origIndex*this.valueSize,t=this._addIndex*this.valueSize,n=0;n<this.valueSize;n++)this.buffer[t+n]=this.buffer[e+n]}},{key:"_select",value:function(e,t,n,r,i){if(r>=.5)for(var a=0;a!==i;++a)e[t+a]=e[n+a]}},{key:"_slerp",value:function(e,t,n,r){qr.slerpFlat(e,t,e,t,e,n,r)}},{key:"_slerpAdditive",value:function(e,t,n,r,i){var a=this._workIndex*i;qr.multiplyQuaternionsFlat(e,a,e,t,e,n),qr.slerpFlat(e,t,e,t,e,a,r)}},{key:"_lerp",value:function(e,t,n,r,i){for(var a=1-r,o=0;o!==i;++o){var s=t+o;e[s]=e[s]*a+e[n+o]*r}}},{key:"_lerpAdditive",value:function(e,t,n,r,i){for(var a=0;a!==i;++a){var o=t+a;e[o]=e[o]+e[n+a]*r}}}]),e}(),Hf="\\[\\]\\.:\\/",Gf=new RegExp("["+Hf+"]","g"),Vf="[^"+Hf+"]",Wf="[^"+Hf.replace("\\.","")+"]",jf=new RegExp("^"+/((?:WC+[\/:])*)/.source.replace("WC",Vf)+/(WCOD+)?/.source.replace("WCOD",Wf)+/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",Vf)+/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",Vf)+"$"),Xf=["material","materials","bones","map"],qf=function(){function e(t,n,r){a(this,e);var i=r||Yf.parseTrackName(n);this._targetGroup=t,this._bindings=t.subscribe_(n,i)}return s(e,[{key:"getValue",value:function(e,t){this.bind();var n=this._targetGroup.nCachedObjects_,r=this._bindings[n];void 0!==r&&r.getValue(e,t)}},{key:"setValue",value:function(e,t){for(var n=this._bindings,r=this._targetGroup.nCachedObjects_,i=n.length;r!==i;++r)n[r].setValue(e,t)}},{key:"bind",value:function(){for(var e=this._bindings,t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].bind()}},{key:"unbind",value:function(){for(var e=this._bindings,t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].unbind()}}]),e}(),Yf=function(){function e(t,n,r){a(this,e),this.path=n,this.parsedPath=r||e.parseTrackName(n),this.node=e.findNode(t,this.parsedPath.nodeName),this.rootNode=t,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}return s(e,[{key:"_getValue_unavailable",value:function(){}},{key:"_setValue_unavailable",value:function(){}},{key:"_getValue_direct",value:function(e,t){e[t]=this.targetObject[this.propertyName]}},{key:"_getValue_array",value:function(e,t){for(var n=this.resolvedProperty,r=0,i=n.length;r!==i;++r)e[t++]=n[r]}},{key:"_getValue_arrayElement",value:function(e,t){e[t]=this.resolvedProperty[this.propertyIndex]}},{key:"_getValue_toArray",value:function(e,t){this.resolvedProperty.toArray(e,t)}},{key:"_setValue_direct",value:function(e,t){this.targetObject[this.propertyName]=e[t]}},{key:"_setValue_direct_setNeedsUpdate",value:function(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.needsUpdate=!0}},{key:"_setValue_direct_setMatrixWorldNeedsUpdate",value:function(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}},{key:"_setValue_array",value:function(e,t){for(var n=this.resolvedProperty,r=0,i=n.length;r!==i;++r)n[r]=e[t++]}},{key:"_setValue_array_setNeedsUpdate",value:function(e,t){for(var n=this.resolvedProperty,r=0,i=n.length;r!==i;++r)n[r]=e[t++];this.targetObject.needsUpdate=!0}},{key:"_setValue_array_setMatrixWorldNeedsUpdate",value:function(e,t){for(var n=this.resolvedProperty,r=0,i=n.length;r!==i;++r)n[r]=e[t++];this.targetObject.matrixWorldNeedsUpdate=!0}},{key:"_setValue_arrayElement",value:function(e,t){this.resolvedProperty[this.propertyIndex]=e[t]}},{key:"_setValue_arrayElement_setNeedsUpdate",value:function(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.needsUpdate=!0}},{key:"_setValue_arrayElement_setMatrixWorldNeedsUpdate",value:function(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}},{key:"_setValue_fromArray",value:function(e,t){this.resolvedProperty.fromArray(e,t)}},{key:"_setValue_fromArray_setNeedsUpdate",value:function(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.needsUpdate=!0}},{key:"_setValue_fromArray_setMatrixWorldNeedsUpdate",value:function(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.matrixWorldNeedsUpdate=!0}},{key:"_getValue_unbound",value:function(e,t){this.bind(),this.getValue(e,t)}},{key:"_setValue_unbound",value:function(e,t){this.bind(),this.setValue(e,t)}},{key:"bind",value:function(){var t=this.node,n=this.parsedPath,r=n.objectName,i=n.propertyName,a=n.propertyIndex;if(t||(t=e.findNode(this.rootNode,n.nodeName),this.node=t),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,t){if(r){var o=n.objectIndex;switch(r){case"materials":if(!t.material)return void console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);if(!t.material.materials)return void console.error("THREE.PropertyBinding: 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("THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);t=t.skeleton.bones;for(var s=0;s<t.length;s++)if(t[s].name===o){o=s;break}break;case"map":if("map"in t){t=t.map;break}if(!t.material)return void console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);if(!t.material.map)return void console.error("THREE.PropertyBinding: Can not bind to material.map as node.material does not have a map.",this);t=t.material.map;break;default:if(void 0===t[r])return void console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.",this);t=t[r]}if(void 0!==o){if(void 0===t[o])return void console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,t);t=t[o]}}var u=t[i];if(void 0!==u){var l=this.Versioning.None;this.targetObject=t,void 0!==t.needsUpdate?l=this.Versioning.NeedsUpdate:void 0!==t.matrixWorldNeedsUpdate&&(l=this.Versioning.MatrixWorldNeedsUpdate);var c=this.BindingType.Direct;if(void 0!==a){if("morphTargetInfluences"===i){if(!t.geometry)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);if(!t.geometry.morphAttributes)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);void 0!==t.morphTargetDictionary[a]&&(a=t.morphTargetDictionary[a])}c=this.BindingType.ArrayElement,this.resolvedProperty=u,this.propertyIndex=a}else void 0!==u.fromArray&&void 0!==u.toArray?(c=this.BindingType.HasFromToArray,this.resolvedProperty=u):Array.isArray(u)?(c=this.BindingType.EntireArray,this.resolvedProperty=u):this.propertyName=i;this.getValue=this.GetterByBindingType[c],this.setValue=this.SetterByBindingTypeAndVersioning[c][l]}else{var h=n.nodeName;console.error("THREE.PropertyBinding: Trying to update property for track: "+h+"."+i+" but it wasn't found.",t)}}else console.warn("THREE.PropertyBinding: No target node found for track: "+this.path+".")}},{key:"unbind",value:function(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}],[{key:"create",value:function(t,n,r){return t&&t.isAnimationObjectGroup?new e.Composite(t,n,r):new e(t,n,r)}},{key:"sanitizeNodeName",value:function(e){return e.replace(/\s/g,"_").replace(Gf,"")}},{key:"parseTrackName",value:function(e){var t=jf.exec(e);if(null===t)throw new Error("PropertyBinding: Cannot parse trackName: "+e);var n={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},r=n.nodeName&&n.nodeName.lastIndexOf(".");if(void 0!==r&&-1!==r){var i=n.nodeName.substring(r+1);-1!==Xf.indexOf(i)&&(n.nodeName=n.nodeName.substring(0,r),n.objectName=i)}if(null===n.propertyName||0===n.propertyName.length)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+e);return n}},{key:"findNode",value:function(e,t){if(void 0===t||""===t||"."===t||-1===t||t===e.name||t===e.uuid)return e;if(e.skeleton){var n=e.skeleton.getBoneByName(t);if(void 0!==n)return n}if(e.children){var r=function e(n){for(var r=0;r<n.length;r++){var i=n[r];if(i.name===t||i.uuid===t)return i;var a=e(i.children);if(a)return a}return null}(e.children);if(r)return r}return null}}]),e}();Yf.Composite=qf,Yf.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3},Yf.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2},Yf.prototype.GetterByBindingType=[Yf.prototype._getValue_direct,Yf.prototype._getValue_array,Yf.prototype._getValue_arrayElement,Yf.prototype._getValue_toArray],Yf.prototype.SetterByBindingTypeAndVersioning=[[Yf.prototype._setValue_direct,Yf.prototype._setValue_direct_setNeedsUpdate,Yf.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[Yf.prototype._setValue_array,Yf.prototype._setValue_array_setNeedsUpdate,Yf.prototype._setValue_array_setMatrixWorldNeedsUpdate],[Yf.prototype._setValue_arrayElement,Yf.prototype._setValue_arrayElement_setNeedsUpdate,Yf.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[Yf.prototype._setValue_fromArray,Yf.prototype._setValue_fromArray_setNeedsUpdate,Yf.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];var Zf=function(){function e(){a(this,e),this.isAnimationObjectGroup=!0,this.uuid=or(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;var t={};this._indicesByUUID=t;for(var n=0,r=arguments.length;n!==r;++n)t[arguments[n].uuid]=n;this._paths=[],this._parsedPaths=[],this._bindings=[],this._bindingsIndicesByPath={};var i=this;this.stats={objects:{get total(){return i._objects.length},get inUse(){return this.total-i.nCachedObjects_}},get bindingsPerObject(){return i._bindings.length}}}return s(e,[{key:"add",value:function(){for(var e=this._objects,t=this._indicesByUUID,n=this._paths,r=this._parsedPaths,i=this._bindings,a=i.length,o=void 0,s=e.length,u=this.nCachedObjects_,l=0,c=arguments.length;l!==c;++l){var h=arguments[l],d=h.uuid,f=t[d];if(void 0===f){f=s++,t[d]=f,e.push(h);for(var p=0,v=a;p!==v;++p)i[p].push(new Yf(h,n[p],r[p]))}else if(f<u){o=e[f];var m=--u,g=e[m];t[g.uuid]=f,e[f]=g,t[d]=m,e[m]=h;for(var y=0,_=a;y!==_;++y){var x=i[y],M=x[m],S=x[f];x[f]=M,void 0===S&&(S=new Yf(h,n[y],r[y])),x[m]=S}}else e[f]!==o&&console.error("THREE.AnimationObjectGroup: Different objects with the same UUID detected. Clean the caches or recreate your infrastructure when reloading scenes.")}this.nCachedObjects_=u}},{key:"remove",value:function(){for(var e=this._objects,t=this._indicesByUUID,n=this._bindings,r=n.length,i=this.nCachedObjects_,a=0,o=arguments.length;a!==o;++a){var s=arguments[a],u=s.uuid,l=t[u];if(void 0!==l&&l>=i){var c=i++,h=e[c];t[h.uuid]=l,e[l]=h,t[u]=c,e[c]=s;for(var d=0,f=r;d!==f;++d){var p=n[d],v=p[c],m=p[l];p[l]=v,p[c]=m}}}this.nCachedObjects_=i}},{key:"uncache",value:function(){for(var e=this._objects,t=this._indicesByUUID,n=this._bindings,r=n.length,i=this.nCachedObjects_,a=e.length,o=0,s=arguments.length;o!==s;++o){var u=arguments[o],l=u.uuid,c=t[l];if(void 0!==c)if(delete t[l],c<i){var h=--i,d=e[h],f=--a,p=e[f];t[d.uuid]=c,e[c]=d,t[p.uuid]=h,e[h]=p,e.pop();for(var v=0,m=r;v!==m;++v){var g=n[v],y=g[h],_=g[f];g[c]=y,g[h]=_,g.pop()}}else{var x=--a,M=e[x];x>0&&(t[M.uuid]=c),e[c]=M,e.pop();for(var S=0,b=r;S!==b;++S){var w=n[S];w[c]=w[x],w.pop()}}}this.nCachedObjects_=i}},{key:"subscribe_",value:function(e,t){var n=this._bindingsIndicesByPath,r=n[e],i=this._bindings;if(void 0!==r)return i[r];var a=this._paths,o=this._parsedPaths,s=this._objects,u=s.length,l=this.nCachedObjects_,c=new Array(u);r=i.length,n[e]=r,a.push(e),o.push(t),i.push(c);for(var h=l,d=s.length;h!==d;++h){var f=s[h];c[h]=new Yf(f,e,t)}return c}},{key:"unsubscribe_",value:function(e){var t=this._bindingsIndicesByPath,n=t[e];if(void 0!==n){var r=this._paths,i=this._parsedPaths,a=this._bindings,o=a.length-1,s=a[o];t[e[o]]=n,a[n]=s,a.pop(),i[n]=i[o],i.pop(),r[n]=r[o],r.pop()}}}]),e}(),Kf=function(){function e(t,n){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:n.blendMode;a(this,e),this._mixer=t,this._clip=n,this._localRoot=r,this.blendMode=i;for(var o=n.tracks,s=o.length,u=new Array(s),l={endingStart:Qt,endingEnd:Qt},c=0;c!==s;++c){var h=o[c].createInterpolant(null);u[c]=h,h.settings=l}this._interpolantSettings=l,this._interpolants=u,this._propertyBindings=new Array(s),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=qt,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}return s(e,[{key:"play",value:function(){return this._mixer._activateAction(this),this}},{key:"stop",value:function(){return this._mixer._deactivateAction(this),this.reset()}},{key:"reset",value:function(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()}},{key:"isRunning",value:function(){return this.enabled&&!this.paused&&0!==this.timeScale&&null===this._startTime&&this._mixer._isActiveAction(this)}},{key:"isScheduled",value:function(){return this._mixer._isActiveAction(this)}},{key:"startAt",value:function(e){return this._startTime=e,this}},{key:"setLoop",value:function(e,t){return this.loop=e,this.repetitions=t,this}},{key:"setEffectiveWeight",value:function(e){return this.weight=e,this._effectiveWeight=this.enabled?e:0,this.stopFading()}},{key:"getEffectiveWeight",value:function(){return this._effectiveWeight}},{key:"fadeIn",value:function(e){return this._scheduleFading(e,0,1)}},{key:"fadeOut",value:function(e){return this._scheduleFading(e,1,0)}},{key:"crossFadeFrom",value:function(e,t,n){if(e.fadeOut(t),this.fadeIn(t),n){var r=this._clip.duration,i=e._clip.duration,a=i/r,o=r/i;e.warp(1,a,t),this.warp(o,1,t)}return this}},{key:"crossFadeTo",value:function(e,t,n){return e.crossFadeFrom(this,t,n)}},{key:"stopFading",value:function(){var e=this._weightInterpolant;return null!==e&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}},{key:"setEffectiveTimeScale",value:function(e){return this.timeScale=e,this._effectiveTimeScale=this.paused?0:e,this.stopWarping()}},{key:"getEffectiveTimeScale",value:function(){return this._effectiveTimeScale}},{key:"setDuration",value:function(e){return this.timeScale=this._clip.duration/e,this.stopWarping()}},{key:"syncWith",value:function(e){return this.time=e.time,this.timeScale=e.timeScale,this.stopWarping()}},{key:"halt",value:function(e){return this.warp(this._effectiveTimeScale,0,e)}},{key:"warp",value:function(e,t,n){var r=this._mixer,i=r.time,a=this.timeScale,o=this._timeScaleInterpolant;null===o&&(o=r._lendControlInterpolant(),this._timeScaleInterpolant=o);var s=o.parameterPositions,u=o.sampleValues;return s[0]=i,s[1]=i+n,u[0]=e/a,u[1]=t/a,this}},{key:"stopWarping",value:function(){var e=this._timeScaleInterpolant;return null!==e&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}},{key:"getMixer",value:function(){return this._mixer}},{key:"getClip",value:function(){return this._clip}},{key:"getRoot",value:function(){return this._localRoot||this._mixer._root}},{key:"_update",value:function(e,t,n,r){if(this.enabled){var i=this._startTime;if(null!==i){var a=(e-i)*n;a<0||0===n?t=0:(this._startTime=null,t=n*a)}t*=this._updateTimeScale(e);var o=this._updateTime(t),s=this._updateWeight(e);if(s>0){var u=this._interpolants,l=this._propertyBindings;if(this.blendMode===nn)for(var c=0,h=u.length;c!==h;++c)u[c].evaluate(o),l[c].accumulateAdditive(s);else for(var d=0,f=u.length;d!==f;++d)u[d].evaluate(o),l[d].accumulate(r,s)}}else this._updateWeight(e)}},{key:"_updateWeight",value:function(e){var t=0;if(this.enabled){t=this.weight;var n=this._weightInterpolant;if(null!==n){var r=n.evaluate(e)[0];t*=r,e>n.parameterPositions[1]&&(this.stopFading(),0===r&&(this.enabled=!1))}}return this._effectiveWeight=t,t}},{key:"_updateTimeScale",value:function(e){var t=0;if(!this.paused){t=this.timeScale;var n=this._timeScaleInterpolant;if(null!==n)t*=n.evaluate(e)[0],e>n.parameterPositions[1]&&(this.stopWarping(),0===t?this.paused=!0:this.timeScale=t)}return this._effectiveTimeScale=t,t}},{key:"_updateTime",value:function(e){var t=this._clip.duration,n=this.loop,r=this.time+e,i=this._loopCount,a=n===Yt;if(0===e)return-1===i?r:a&&1==(1&i)?t-r:r;if(n===Xt){-1===i&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(r>=t)r=t;else{if(!(r<0)){this.time=r;break e}r=0}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=r,this._mixer.dispatchEvent({type:"finished",action:this,direction:e<0?-1:1})}}else{if(-1===i&&(e>=0?(i=0,this._setEndings(!0,0===this.repetitions,a)):this._setEndings(0===this.repetitions,!0,a)),r>=t||r<0){var o=Math.floor(r/t);r-=t*o,i+=Math.abs(o);var s=this.repetitions-i;if(s<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,r=e>0?t:0,this.time=r,this._mixer.dispatchEvent({type:"finished",action:this,direction:e>0?1:-1});else{if(1===s){var u=e<0;this._setEndings(u,!u,a)}else this._setEndings(!1,!1,a);this._loopCount=i,this.time=r,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:o})}}else this.time=r;if(a&&1==(1&i))return t-r}return r}},{key:"_setEndings",value:function(e,t,n){var r=this._interpolantSettings;n?(r.endingStart=$t,r.endingEnd=$t):(r.endingStart=e?this.zeroSlopeAtStart?$t:Qt:en,r.endingEnd=t?this.zeroSlopeAtEnd?$t:Qt:en)}},{key:"_scheduleFading",value:function(e,t,n){var r=this._mixer,i=r.time,a=this._weightInterpolant;null===a&&(a=r._lendControlInterpolant(),this._weightInterpolant=a);var o=a.parameterPositions,s=a.sampleValues;return o[0]=i,s[0]=t,o[1]=i+e,s[1]=n,this}}]),e}(),Jf=new Float32Array(1),Qf=function(e){w(n,e);var t=E(n);function n(e){var r;return a(this,n),(r=t.call(this))._root=e,r._initMemoryManager(),r._accuIndex=0,r.time=0,r.timeScale=1,r}return s(n,[{key:"_bindAction",value:function(e,t){var n=e._localRoot||this._root,r=e._clip.tracks,i=r.length,a=e._propertyBindings,o=e._interpolants,s=n.uuid,u=this._bindingsByRootAndName,l=u[s];void 0===l&&(l={},u[s]=l);for(var c=0;c!==i;++c){var h=r[c],d=h.name,f=l[d];if(void 0!==f)++f.referenceCount,a[c]=f;else{if(void 0!==(f=a[c])){null===f._cacheIndex&&(++f.referenceCount,this._addInactiveBinding(f,s,d));continue}var p=t&&t._propertyBindings[c].binding.parsedPath;++(f=new zf(Yf.create(n,d,p),h.ValueTypeName,h.getValueSize())).referenceCount,this._addInactiveBinding(f,s,d),a[c]=f}o[c].resultBuffer=f.buffer}}},{key:"_activateAction",value:function(e){if(!this._isActiveAction(e)){if(null===e._cacheIndex){var t=(e._localRoot||this._root).uuid,n=e._clip.uuid,r=this._actionsByClip[n];this._bindAction(e,r&&r.knownActions[0]),this._addInactiveAction(e,n,t)}for(var i=e._propertyBindings,a=0,o=i.length;a!==o;++a){var s=i[a];0==s.useCount++&&(this._lendBinding(s),s.saveOriginalState())}this._lendAction(e)}}},{key:"_deactivateAction",value:function(e){if(this._isActiveAction(e)){for(var t=e._propertyBindings,n=0,r=t.length;n!==r;++n){var i=t[n];0==--i.useCount&&(i.restoreOriginalState(),this._takeBackBinding(i))}this._takeBackAction(e)}}},{key:"_initMemoryManager",value:function(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;var e=this;this.stats={actions:{get total(){return e._actions.length},get inUse(){return e._nActiveActions}},bindings:{get total(){return e._bindings.length},get inUse(){return e._nActiveBindings}},controlInterpolants:{get total(){return e._controlInterpolants.length},get inUse(){return e._nActiveControlInterpolants}}}}},{key:"_isActiveAction",value:function(e){var t=e._cacheIndex;return null!==t&&t<this._nActiveActions}},{key:"_addInactiveAction",value:function(e,t,n){var r=this._actions,i=this._actionsByClip,a=i[t];if(void 0===a)a={knownActions:[e],actionByRoot:{}},e._byClipCacheIndex=0,i[t]=a;else{var o=a.knownActions;e._byClipCacheIndex=o.length,o.push(e)}e._cacheIndex=r.length,r.push(e),a.actionByRoot[n]=e}},{key:"_removeInactiveAction",value:function(e){var t=this._actions,n=t[t.length-1],r=e._cacheIndex;n._cacheIndex=r,t[r]=n,t.pop(),e._cacheIndex=null;var i=e._clip.uuid,a=this._actionsByClip,o=a[i],s=o.knownActions,u=s[s.length-1],l=e._byClipCacheIndex;u._byClipCacheIndex=l,s[l]=u,s.pop(),e._byClipCacheIndex=null,delete o.actionByRoot[(e._localRoot||this._root).uuid],0===s.length&&delete a[i],this._removeInactiveBindingsForAction(e)}},{key:"_removeInactiveBindingsForAction",value:function(e){for(var t=e._propertyBindings,n=0,r=t.length;n!==r;++n){var i=t[n];0==--i.referenceCount&&this._removeInactiveBinding(i)}}},{key:"_lendAction",value:function(e){var t=this._actions,n=e._cacheIndex,r=this._nActiveActions++,i=t[r];e._cacheIndex=r,t[r]=e,i._cacheIndex=n,t[n]=i}},{key:"_takeBackAction",value:function(e){var t=this._actions,n=e._cacheIndex,r=--this._nActiveActions,i=t[r];e._cacheIndex=r,t[r]=e,i._cacheIndex=n,t[n]=i}},{key:"_addInactiveBinding",value:function(e,t,n){var r=this._bindingsByRootAndName,i=this._bindings,a=r[t];void 0===a&&(a={},r[t]=a),a[n]=e,e._cacheIndex=i.length,i.push(e)}},{key:"_removeInactiveBinding",value:function(e){var t=this._bindings,n=e.binding,r=n.rootNode.uuid,i=n.path,a=this._bindingsByRootAndName,o=a[r],s=t[t.length-1],u=e._cacheIndex;s._cacheIndex=u,t[u]=s,t.pop(),delete o[i],0===Object.keys(o).length&&delete a[r]}},{key:"_lendBinding",value:function(e){var t=this._bindings,n=e._cacheIndex,r=this._nActiveBindings++,i=t[r];e._cacheIndex=r,t[r]=e,i._cacheIndex=n,t[n]=i}},{key:"_takeBackBinding",value:function(e){var t=this._bindings,n=e._cacheIndex,r=--this._nActiveBindings,i=t[r];e._cacheIndex=r,t[r]=e,i._cacheIndex=n,t[n]=i}},{key:"_lendControlInterpolant",value:function(){var e=this._controlInterpolants,t=this._nActiveControlInterpolants++,n=e[t];return void 0===n&&((n=new gd(new Float32Array(2),new Float32Array(2),1,Jf)).__cacheIndex=t,e[t]=n),n}},{key:"_takeBackControlInterpolant",value:function(e){var t=this._controlInterpolants,n=e.__cacheIndex,r=--this._nActiveControlInterpolants,i=t[r];e.__cacheIndex=r,t[r]=e,i.__cacheIndex=n,t[n]=i}},{key:"clipAction",value:function(e,t,n){var r=t||this._root,i=r.uuid,a="string"==typeof e?Ad.findByName(r,e):e,o=null!==a?a.uuid:e,s=this._actionsByClip[o],u=null;if(void 0===n&&(n=null!==a?a.blendMode:tn),void 0!==s){var l=s.actionByRoot[i];if(void 0!==l&&l.blendMode===n)return l;u=s.knownActions[0],null===a&&(a=u._clip)}if(null===a)return null;var c=new Kf(this,a,t,n);return this._bindAction(c,u),this._addInactiveAction(c,o,i),c}},{key:"existingAction",value:function(e,t){var n=t||this._root,r=n.uuid,i="string"==typeof e?Ad.findByName(n,e):e,a=i?i.uuid:e,o=this._actionsByClip[a];return void 0!==o&&o.actionByRoot[r]||null}},{key:"stopAllAction",value:function(){for(var e=this._actions,t=this._nActiveActions-1;t>=0;--t)e[t].stop();return this}},{key:"update",value:function(e){e*=this.timeScale;for(var t=this._actions,n=this._nActiveActions,r=this.time+=e,i=Math.sign(e),a=this._accuIndex^=1,o=0;o!==n;++o){t[o]._update(r,e,i,a)}for(var s=this._bindings,u=this._nActiveBindings,l=0;l!==u;++l)s[l].apply(a);return this}},{key:"setTime",value:function(e){this.time=0;for(var t=0;t<this._actions.length;t++)this._actions[t].time=0;return this.update(e)}},{key:"getRoot",value:function(){return this._root}},{key:"uncacheClip",value:function(e){var t=this._actions,n=e.uuid,r=this._actionsByClip,i=r[n];if(void 0!==i){for(var a=i.knownActions,o=0,s=a.length;o!==s;++o){var u=a[o];this._deactivateAction(u);var l=u._cacheIndex,c=t[t.length-1];u._cacheIndex=null,u._byClipCacheIndex=null,c._cacheIndex=l,t[l]=c,t.pop(),this._removeInactiveBindingsForAction(u)}delete r[n]}}},{key:"uncacheRoot",value:function(e){var t=e.uuid,n=this._actionsByClip;for(var r in n){var i=n[r].actionByRoot[t];void 0!==i&&(this._deactivateAction(i),this._removeInactiveAction(i))}var a=this._bindingsByRootAndName[t];if(void 0!==a)for(var o in a){var s=a[o];s.restoreOriginalState(),this._removeInactiveBinding(s)}}},{key:"uncacheAction",value:function(e,t){var n=this.existingAction(e,t);null!==n&&(this._deactivateAction(n),this._removeInactiveAction(n))}}]),n}(tr),$f=function(){function e(t){a(this,e),this.value=t}return s(e,[{key:"clone",value:function(){return new e(void 0===this.value.clone?this.value:this.value.clone())}}]),e}(),ep=0,tp=function(e){w(n,e);var t=E(n);function n(){var e;return a(this,n),(e=t.call(this)).isUniformsGroup=!0,Object.defineProperty(S(e),"id",{value:ep++}),e.name="",e.usage=Hn,e.uniforms=[],e}return s(n,[{key:"add",value:function(e){return this.uniforms.push(e),this}},{key:"remove",value:function(e){var t=this.uniforms.indexOf(e);return-1!==t&&this.uniforms.splice(t,1),this}},{key:"setName",value:function(e){return this.name=e,this}},{key:"setUsage",value:function(e){return this.usage=e,this}},{key:"dispose",value:function(){return this.dispatchEvent({type:"dispose"}),this}},{key:"copy",value:function(e){this.name=e.name,this.usage=e.usage;var t=e.uniforms;this.uniforms.length=0;for(var n=0,r=t.length;n<r;n++)this.uniforms.push(t[n].clone());return this}},{key:"clone",value:function(){return(new this.constructor).copy(this)}}]),n}(tr),np=function(e){w(n,e);var t=E(n);function n(e,r){var i,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;return a(this,n),(i=t.call(this,e,r)).isInstancedInterleavedBuffer=!0,i.meshPerAttribute=o,i}return s(n,[{key:"copy",value:function(e){return y(x(n.prototype),"copy",this).call(this,e),this.meshPerAttribute=e.meshPerAttribute,this}},{key:"clone",value:function(e){var t=y(x(n.prototype),"clone",this).call(this,e);return t.meshPerAttribute=this.meshPerAttribute,t}},{key:"toJSON",value:function(e){var t=y(x(n.prototype),"toJSON",this).call(this,e);return t.isInstancedInterleavedBuffer=!0,t.meshPerAttribute=this.meshPerAttribute,t}}]),n}(fl),rp=function(){function e(t,n,r,i,o){a(this,e),this.isGLBufferAttribute=!0,this.name="",this.buffer=t,this.type=n,this.itemSize=r,this.elementSize=i,this.count=o,this.version=0}return s(e,[{key:"needsUpdate",set:function(e){!0===e&&this.version++}},{key:"setBuffer",value:function(e){return this.buffer=e,this}},{key:"setType",value:function(e,t){return this.type=e,this.elementSize=t,this}},{key:"setItemSize",value:function(e){return this.itemSize=e,this}},{key:"setCount",value:function(e){return this.count=e,this}}]),e}(),ip=function(){function e(t,n){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1/0;a(this,e),this.ray=new bi(t,n),this.near=r,this.far=i,this.camera=null,this.layers=new Ui,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}}}return s(e,[{key:"set",value:function(e,t){this.ray.set(e,t)}},{key:"setFromCamera",value:function(e,t){t.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(t.matrixWorld),this.ray.direction.set(e.x,e.y,.5).unproject(t).sub(this.ray.origin).normalize(),this.camera=t):t.isOrthographicCamera?(this.ray.origin.set(e.x,e.y,(t.near+t.far)/(t.near-t.far)).unproject(t),this.ray.direction.set(0,0,-1).transformDirection(t.matrixWorld),this.camera=t):console.error("THREE.Raycaster: Unsupported camera type: "+t.type)}},{key:"intersectObject",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];return op(e,this,n,t),n.sort(ap),n}},{key:"intersectObjects",value:function(e){for(var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],r=0,i=e.length;r<i;r++)op(e[r],this,n,t);return n.sort(ap),n}}]),e}();function ap(e,t){return e.distance-t.distance}function op(e,t,n,r){if(e.layers.test(t.layers)&&e.raycast(t,n),!0===r)for(var i=e.children,a=0,o=i.length;a<o;a++)op(i[a],t,n,!0)}var sp=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return a(this,e),this.radius=t,this.phi=n,this.theta=r,this}return s(e,[{key:"set",value:function(e,t,n){return this.radius=e,this.phi=t,this.theta=n,this}},{key:"copy",value:function(e){return this.radius=e.radius,this.phi=e.phi,this.theta=e.theta,this}},{key:"makeSafe",value:function(){var e=1e-6;return this.phi=Math.max(e,Math.min(Math.PI-e,this.phi)),this}},{key:"setFromVector3",value:function(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}},{key:"setFromCartesianCoords",value:function(e,t,n){return this.radius=Math.sqrt(e*e+t*t+n*n),0===this.radius?(this.theta=0,this.phi=0):(this.theta=Math.atan2(e,n),this.phi=Math.acos(sr(t/this.radius,-1,1))),this}},{key:"clone",value:function(){return(new this.constructor).copy(this)}}]),e}(),up=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return a(this,e),this.radius=t,this.theta=n,this.y=r,this}return s(e,[{key:"set",value:function(e,t,n){return this.radius=e,this.theta=t,this.y=n,this}},{key:"copy",value:function(e){return this.radius=e.radius,this.theta=e.theta,this.y=e.y,this}},{key:"setFromVector3",value:function(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}},{key:"setFromCartesianCoords",value:function(e,t,n){return this.radius=Math.sqrt(e*e+n*n),this.theta=Math.atan2(e,n),this.y=t,this}},{key:"clone",value:function(){return(new this.constructor).copy(this)}}]),e}(),lp=new mr,cp=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new mr(1/0,1/0),n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new mr(-1/0,-1/0);a(this,e),this.isBox2=!0,this.min=t,this.max=n}return s(e,[{key:"set",value:function(e,t){return this.min.copy(e),this.max.copy(t),this}},{key:"setFromPoints",value:function(e){this.makeEmpty();for(var t=0,n=e.length;t<n;t++)this.expandByPoint(e[t]);return this}},{key:"setFromCenterAndSize",value:function(e,t){var n=lp.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this}},{key:"clone",value:function(){return(new this.constructor).copy(this)}},{key:"copy",value:function(e){return this.min.copy(e.min),this.max.copy(e.max),this}},{key:"makeEmpty",value:function(){return this.min.x=this.min.y=1/0,this.max.x=this.max.y=-1/0,this}},{key:"isEmpty",value:function(){return this.max.x<this.min.x||this.max.y<this.min.y}},{key:"getCenter",value:function(e){return this.isEmpty()?e.set(0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}},{key:"getSize",value:function(e){return this.isEmpty()?e.set(0,0):e.subVectors(this.max,this.min)}},{key:"expandByPoint",value:function(e){return this.min.min(e),this.max.max(e),this}},{key:"expandByVector",value:function(e){return this.min.sub(e),this.max.add(e),this}},{key:"expandByScalar",value:function(e){return this.min.addScalar(-e),this.max.addScalar(e),this}},{key:"containsPoint",value:function(e){return!(e.x<this.min.x||e.x>this.max.x||e.y<this.min.y||e.y>this.max.y)}},{key:"containsBox",value:function(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y}},{key:"getParameter",value:function(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y))}},{key:"intersectsBox",value:function(e){return!(e.max.x<this.min.x||e.min.x>this.max.x||e.max.y<this.min.y||e.min.y>this.max.y)}},{key:"clampPoint",value:function(e,t){return t.copy(e).clamp(this.min,this.max)}},{key:"distanceToPoint",value:function(e){return this.clampPoint(e,lp).distanceTo(e)}},{key:"intersect",value:function(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}},{key:"union",value:function(e){return this.min.min(e.min),this.max.max(e.max),this}},{key:"translate",value:function(e){return this.min.add(e),this.max.add(e),this}},{key:"equals",value:function(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}]),e}(),hp=new Yr,dp=new Yr,fp=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Yr,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Yr;a(this,e),this.start=t,this.end=n}return s(e,[{key:"set",value:function(e,t){return this.start.copy(e),this.end.copy(t),this}},{key:"copy",value:function(e){return this.start.copy(e.start),this.end.copy(e.end),this}},{key:"getCenter",value:function(e){return e.addVectors(this.start,this.end).multiplyScalar(.5)}},{key:"delta",value:function(e){return e.subVectors(this.end,this.start)}},{key:"distanceSq",value:function(){return this.start.distanceToSquared(this.end)}},{key:"distance",value:function(){return this.start.distanceTo(this.end)}},{key:"at",value:function(e,t){return this.delta(t).multiplyScalar(e).add(this.start)}},{key:"closestPointToPointParameter",value:function(e,t){hp.subVectors(e,this.start),dp.subVectors(this.end,this.start);var n=dp.dot(dp),r=dp.dot(hp)/n;return t&&(r=sr(r,0,1)),r}},{key:"closestPointToPoint",value:function(e,t,n){var r=this.closestPointToPointParameter(e,t);return this.delta(n).multiplyScalar(r).add(this.start)}},{key:"applyMatrix4",value:function(e){return this.start.applyMatrix4(e),this.end.applyMatrix4(e),this}},{key:"equals",value:function(e){return e.start.equals(this.start)&&e.end.equals(this.end)}},{key:"clone",value:function(){return(new this.constructor).copy(this)}}]),e}(),pp=new Yr,vp=function(e){w(n,e);var t=E(n);function n(e,r){var i;a(this,n),(i=t.call(this)).light=e,i.matrix=e.matrixWorld,i.matrixAutoUpdate=!1,i.color=r,i.type="SpotLightHelper";for(var o=new Ga,s=[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],u=0,l=1;u<32;u++,l++){var c=u/32*Math.PI*2,h=l/32*Math.PI*2;s.push(Math.cos(c),Math.sin(c),1,Math.cos(h),Math.sin(h),1)}o.setAttribute("position",new Ia(s,3));var d=new ic({fog:!1,toneMapped:!1});return i.cone=new fc(o,d),i.add(i.cone),i.update(),i}return s(n,[{key:"dispose",value:function(){this.cone.geometry.dispose(),this.cone.material.dispose()}},{key:"update",value:function(){this.light.updateWorldMatrix(!0,!1),this.light.target.updateWorldMatrix(!0,!1);var e=this.light.distance?this.light.distance:1e3,t=e*Math.tan(this.light.angle);this.cone.scale.set(t,t,e),pp.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(pp),void 0!==this.color?this.cone.material.color.set(this.color):this.cone.material.color.copy(this.light.color)}}]),n}(Zi),mp=new Yr,gp=new wi,yp=new wi,_p=function(e){w(n,e);var t=E(n);function n(e){var r;a(this,n);for(var i=xp(e),o=new Ga,s=[],u=[],l=new pa(0,0,1),c=new pa(0,1,0),h=0;h<i.length;h++){var d=i[h];d.parent&&d.parent.isBone&&(s.push(0,0,0),s.push(0,0,0),u.push(l.r,l.g,l.b),u.push(c.r,c.g,c.b))}o.setAttribute("position",new Ia(s,3)),o.setAttribute("color",new Ia(u,3));var f=new ic({vertexColors:!0,depthTest:!1,depthWrite:!1,toneMapped:!1,transparent:!0});return(r=t.call(this,o,f)).isSkeletonHelper=!0,r.type="SkeletonHelper",r.root=e,r.bones=i,r.matrix=e.matrixWorld,r.matrixAutoUpdate=!1,r}return s(n,[{key:"updateMatrixWorld",value:function(e){var t=this.bones,r=this.geometry,i=r.getAttribute("position");yp.copy(this.root.matrixWorld).invert();for(var a=0,o=0;a<t.length;a++){var s=t[a];s.parent&&s.parent.isBone&&(gp.multiplyMatrices(yp,s.matrixWorld),mp.setFromMatrixPosition(gp),i.setXYZ(o,mp.x,mp.y,mp.z),gp.multiplyMatrices(yp,s.parent.matrixWorld),mp.setFromMatrixPosition(gp),i.setXYZ(o+1,mp.x,mp.y,mp.z),o+=2)}r.getAttribute("position").needsUpdate=!0,y(x(n.prototype),"updateMatrixWorld",this).call(this,e)}},{key:"dispose",value:function(){this.geometry.dispose(),this.material.dispose()}}]),n}(fc);function xp(e){var t=[];!0===e.isBone&&t.push(e);for(var n=0;n<e.children.length;n++)t.push.apply(t,xp(e.children[n]));return t}var Mp=function(e){w(n,e);var t=E(n);function n(e,r,i){var o;a(this,n);var s=new Wh(r,4,2),u=new ma({wireframe:!0,fog:!1,toneMapped:!1});return(o=t.call(this,s,u)).light=e,o.color=i,o.type="PointLightHelper",o.matrix=o.light.matrixWorld,o.matrixAutoUpdate=!1,o.update(),o}return s(n,[{key:"dispose",value:function(){this.geometry.dispose(),this.material.dispose()}},{key:"update",value:function(){this.light.updateWorldMatrix(!0,!1),void 0!==this.color?this.material.color.set(this.color):this.material.color.copy(this.light.color)}}]),n}(oo),Sp=new Yr,bp=new pa,wp=new pa,Tp=function(e){w(n,e);var t=E(n);function n(e,r,i){var o;a(this,n),(o=t.call(this)).light=e,o.matrix=e.matrixWorld,o.matrixAutoUpdate=!1,o.color=i,o.type="HemisphereLightHelper";var s=new Hh(r);s.rotateY(.5*Math.PI),o.material=new ma({wireframe:!0,fog:!1,toneMapped:!1}),void 0===o.color&&(o.material.vertexColors=!0);var u=s.getAttribute("position"),l=new Float32Array(3*u.count);return s.setAttribute("color",new wa(l,3)),o.add(new oo(s,o.material)),o.update(),o}return s(n,[{key:"dispose",value:function(){this.children[0].geometry.dispose(),this.children[0].material.dispose()}},{key:"update",value:function(){var e=this.children[0];if(void 0!==this.color)this.material.color.set(this.color);else{var t=e.geometry.getAttribute("color");bp.copy(this.light.color),wp.copy(this.light.groundColor);for(var n=0,r=t.count;n<r;n++){var i=n<r/2?bp:wp;t.setXYZ(n,i.r,i.g,i.b)}t.needsUpdate=!0}this.light.updateWorldMatrix(!0,!1),e.lookAt(Sp.setFromMatrixPosition(this.light.matrixWorld).negate())}}]),n}(Zi),Ep=function(e){w(n,e);var t=E(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:4473924,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:8947848;a(this,n),o=new pa(o),s=new pa(s);for(var u=i/2,l=r/i,c=r/2,h=[],d=[],f=0,p=0,v=-c;f<=i;f++,v+=l){h.push(-c,0,v,c,0,v),h.push(v,0,-c,v,0,c);var m=f===u?o:s;m.toArray(d,p),p+=3,m.toArray(d,p),p+=3,m.toArray(d,p),p+=3,m.toArray(d,p),p+=3}var g=new Ga;g.setAttribute("position",new Ia(h,3)),g.setAttribute("color",new Ia(d,3));var y=new ic({vertexColors:!0,toneMapped:!1});return(e=t.call(this,g,y)).type="GridHelper",e}return s(n,[{key:"dispose",value:function(){this.geometry.dispose(),this.material.dispose()}}]),n}(fc),Ap=function(e){w(n,e);var t=E(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:16,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:8,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:64,u=arguments.length>4&&void 0!==arguments[4]?arguments[4]:4473924,l=arguments.length>5&&void 0!==arguments[5]?arguments[5]:8947848;a(this,n),u=new pa(u),l=new pa(l);var c=[],h=[];if(i>1)for(var d=0;d<i;d++){var f=d/i*(2*Math.PI),p=Math.sin(f)*r,v=Math.cos(f)*r;c.push(0,0,0),c.push(p,0,v);var m=1&d?u:l;h.push(m.r,m.g,m.b),h.push(m.r,m.g,m.b)}for(var g=0;g<o;g++)for(var y=1&g?u:l,_=r-r/o*g,x=0;x<s;x++){var M=x/s*(2*Math.PI),S=Math.sin(M)*_,b=Math.cos(M)*_;c.push(S,0,b),h.push(y.r,y.g,y.b),M=(x+1)/s*(2*Math.PI),S=Math.sin(M)*_,b=Math.cos(M)*_,c.push(S,0,b),h.push(y.r,y.g,y.b)}var w=new Ga;w.setAttribute("position",new Ia(c,3)),w.setAttribute("color",new Ia(h,3));var T=new ic({vertexColors:!0,toneMapped:!1});return(e=t.call(this,w,T)).type="PolarGridHelper",e}return s(n,[{key:"dispose",value:function(){this.geometry.dispose(),this.material.dispose()}}]),n}(fc),Rp=new Yr,kp=new Yr,Cp=new Yr,Lp=function(e){w(n,e);var t=E(n);function n(e,r,i){var o;a(this,n),(o=t.call(this)).light=e,o.matrix=e.matrixWorld,o.matrixAutoUpdate=!1,o.color=i,o.type="DirectionalLightHelper",void 0===r&&(r=1);var s=new Ga;s.setAttribute("position",new Ia([-r,r,0,r,r,0,r,-r,0,-r,-r,0,-r,r,0],3));var u=new ic({fog:!1,toneMapped:!1});return o.lightPlane=new cc(s,u),o.add(o.lightPlane),(s=new Ga).setAttribute("position",new Ia([0,0,0,0,0,1],3)),o.targetLine=new cc(s,u),o.add(o.targetLine),o.update(),o}return s(n,[{key:"dispose",value:function(){this.lightPlane.geometry.dispose(),this.lightPlane.material.dispose(),this.targetLine.geometry.dispose(),this.targetLine.material.dispose()}},{key:"update",value:function(){this.light.updateWorldMatrix(!0,!1),this.light.target.updateWorldMatrix(!0,!1),Rp.setFromMatrixPosition(this.light.matrixWorld),kp.setFromMatrixPosition(this.light.target.matrixWorld),Cp.subVectors(kp,Rp),this.lightPlane.lookAt(kp),void 0!==this.color?(this.lightPlane.material.color.set(this.color),this.targetLine.material.color.set(this.color)):(this.lightPlane.material.color.copy(this.light.color),this.targetLine.material.color.copy(this.light.color)),this.targetLine.lookAt(kp),this.targetLine.scale.z=Cp.length()}}]),n}(Zi),Pp=new Yr,Ip=new vo,Dp=function(e){w(n,e);var t=E(n);function n(e){var r;a(this,n);var i=new Ga,o=new ic({color:16777215,vertexColors:!0,toneMapped:!1}),s=[],u=[],l={};function c(e,t){h(e),h(t)}function h(e){s.push(0,0,0),u.push(0,0,0),void 0===l[e]&&(l[e]=[]),l[e].push(s.length/3-1)}c("n1","n2"),c("n2","n4"),c("n4","n3"),c("n3","n1"),c("f1","f2"),c("f2","f4"),c("f4","f3"),c("f3","f1"),c("n1","f1"),c("n2","f2"),c("n3","f3"),c("n4","f4"),c("p","n1"),c("p","n2"),c("p","n3"),c("p","n4"),c("u1","u2"),c("u2","u3"),c("u3","u1"),c("c","t"),c("p","c"),c("cn1","cn2"),c("cn3","cn4"),c("cf1","cf2"),c("cf3","cf4"),i.setAttribute("position",new Ia(s,3)),i.setAttribute("color",new Ia(u,3)),(r=t.call(this,i,o)).type="CameraHelper",r.camera=e,r.camera.updateProjectionMatrix&&r.camera.updateProjectionMatrix(),r.matrix=e.matrixWorld,r.matrixAutoUpdate=!1,r.pointMap=l,r.update();var d=new pa(16755200),f=new pa(16711680),p=new pa(43775),v=new pa(16777215),m=new pa(3355443);return r.setColors(d,f,p,v,m),r}return s(n,[{key:"setColors",value:function(e,t,n,r,i){var a=this.geometry.getAttribute("color");a.setXYZ(0,e.r,e.g,e.b),a.setXYZ(1,e.r,e.g,e.b),a.setXYZ(2,e.r,e.g,e.b),a.setXYZ(3,e.r,e.g,e.b),a.setXYZ(4,e.r,e.g,e.b),a.setXYZ(5,e.r,e.g,e.b),a.setXYZ(6,e.r,e.g,e.b),a.setXYZ(7,e.r,e.g,e.b),a.setXYZ(8,e.r,e.g,e.b),a.setXYZ(9,e.r,e.g,e.b),a.setXYZ(10,e.r,e.g,e.b),a.setXYZ(11,e.r,e.g,e.b),a.setXYZ(12,e.r,e.g,e.b),a.setXYZ(13,e.r,e.g,e.b),a.setXYZ(14,e.r,e.g,e.b),a.setXYZ(15,e.r,e.g,e.b),a.setXYZ(16,e.r,e.g,e.b),a.setXYZ(17,e.r,e.g,e.b),a.setXYZ(18,e.r,e.g,e.b),a.setXYZ(19,e.r,e.g,e.b),a.setXYZ(20,e.r,e.g,e.b),a.setXYZ(21,e.r,e.g,e.b),a.setXYZ(22,e.r,e.g,e.b),a.setXYZ(23,e.r,e.g,e.b),a.setXYZ(24,t.r,t.g,t.b),a.setXYZ(25,t.r,t.g,t.b),a.setXYZ(26,t.r,t.g,t.b),a.setXYZ(27,t.r,t.g,t.b),a.setXYZ(28,t.r,t.g,t.b),a.setXYZ(29,t.r,t.g,t.b),a.setXYZ(30,t.r,t.g,t.b),a.setXYZ(31,t.r,t.g,t.b),a.setXYZ(32,n.r,n.g,n.b),a.setXYZ(33,n.r,n.g,n.b),a.setXYZ(34,n.r,n.g,n.b),a.setXYZ(35,n.r,n.g,n.b),a.setXYZ(36,n.r,n.g,n.b),a.setXYZ(37,n.r,n.g,n.b),a.setXYZ(38,r.r,r.g,r.b),a.setXYZ(39,r.r,r.g,r.b),a.setXYZ(40,i.r,i.g,i.b),a.setXYZ(41,i.r,i.g,i.b),a.setXYZ(42,i.r,i.g,i.b),a.setXYZ(43,i.r,i.g,i.b),a.setXYZ(44,i.r,i.g,i.b),a.setXYZ(45,i.r,i.g,i.b),a.setXYZ(46,i.r,i.g,i.b),a.setXYZ(47,i.r,i.g,i.b),a.setXYZ(48,i.r,i.g,i.b),a.setXYZ(49,i.r,i.g,i.b),a.needsUpdate=!0}},{key:"update",value:function(){var e=this.geometry,t=this.pointMap;Ip.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse),Up("c",t,e,Ip,0,0,-1),Up("t",t,e,Ip,0,0,1),Up("n1",t,e,Ip,-1,-1,-1),Up("n2",t,e,Ip,1,-1,-1),Up("n3",t,e,Ip,-1,1,-1),Up("n4",t,e,Ip,1,1,-1),Up("f1",t,e,Ip,-1,-1,1),Up("f2",t,e,Ip,1,-1,1),Up("f3",t,e,Ip,-1,1,1),Up("f4",t,e,Ip,1,1,1),Up("u1",t,e,Ip,.7,1.1,-1),Up("u2",t,e,Ip,-.7,1.1,-1),Up("u3",t,e,Ip,0,2,-1),Up("cf1",t,e,Ip,-1,0,1),Up("cf2",t,e,Ip,1,0,1),Up("cf3",t,e,Ip,0,-1,1),Up("cf4",t,e,Ip,0,1,1),Up("cn1",t,e,Ip,-1,0,-1),Up("cn2",t,e,Ip,1,0,-1),Up("cn3",t,e,Ip,0,-1,-1),Up("cn4",t,e,Ip,0,1,-1),e.getAttribute("position").needsUpdate=!0}},{key:"dispose",value:function(){this.geometry.dispose(),this.material.dispose()}}]),n}(fc);function Up(e,t,n,r,i,a,o){Pp.set(i,a,o).unproject(r);var s=t[e];if(void 0!==s)for(var u=n.getAttribute("position"),l=0,c=s.length;l<c;l++)u.setXYZ(s[l],Pp.x,Pp.y,Pp.z)}var Op,Np,Fp=new Jr,Bp=function(e){w(n,e);var t=E(n);function n(e){var r,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:16776960;a(this,n);var o=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]),s=new Float32Array(24),u=new Ga;return u.setIndex(new wa(o,1)),u.setAttribute("position",new wa(s,3)),(r=t.call(this,u,new ic({color:i,toneMapped:!1}))).object=e,r.type="BoxHelper",r.matrixAutoUpdate=!1,r.update(),r}return s(n,[{key:"update",value:function(e){if(void 0!==e&&console.warn("THREE.BoxHelper: .update() has no longer arguments."),void 0!==this.object&&Fp.setFromObject(this.object),!Fp.isEmpty()){var t=Fp.min,n=Fp.max,r=this.geometry.attributes.position,i=r.array;i[0]=n.x,i[1]=n.y,i[2]=n.z,i[3]=t.x,i[4]=n.y,i[5]=n.z,i[6]=t.x,i[7]=t.y,i[8]=n.z,i[9]=n.x,i[10]=t.y,i[11]=n.z,i[12]=n.x,i[13]=n.y,i[14]=t.z,i[15]=t.x,i[16]=n.y,i[17]=t.z,i[18]=t.x,i[19]=t.y,i[20]=t.z,i[21]=n.x,i[22]=t.y,i[23]=t.z,r.needsUpdate=!0,this.geometry.computeBoundingSphere()}}},{key:"setFromObject",value:function(e){return this.object=e,this.update(),this}},{key:"copy",value:function(e,t){return y(x(n.prototype),"copy",this).call(this,e,t),this.object=e.object,this}},{key:"dispose",value:function(){this.geometry.dispose(),this.material.dispose()}}]),n}(fc),zp=function(e){w(n,e);var t=E(n);function n(e){var r,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:16776960;a(this,n);var o=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]),s=[1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,-1,-1,1,-1,-1,-1,-1,1,-1,-1],u=new Ga;return u.setIndex(new wa(o,1)),u.setAttribute("position",new Ia(s,3)),(r=t.call(this,u,new ic({color:i,toneMapped:!1}))).box=e,r.type="Box3Helper",r.geometry.computeBoundingSphere(),r}return s(n,[{key:"updateMatrixWorld",value:function(e){var t=this.box;t.isEmpty()||(t.getCenter(this.position),t.getSize(this.scale),this.scale.multiplyScalar(.5),y(x(n.prototype),"updateMatrixWorld",this).call(this,e))}},{key:"dispose",value:function(){this.geometry.dispose(),this.material.dispose()}}]),n}(fc),Hp=function(e){w(n,e);var t=E(n);function n(e){var r,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:16776960;a(this,n);var s=o,u=[1,-1,0,-1,1,0,-1,-1,0,1,1,0,-1,1,0,-1,-1,0,1,-1,0,1,1,0],l=new Ga;l.setAttribute("position",new Ia(u,3)),l.computeBoundingSphere(),(r=t.call(this,l,new ic({color:s,toneMapped:!1}))).type="PlaneHelper",r.plane=e,r.size=i;var c=[1,1,0,-1,1,0,-1,-1,0,1,1,0,-1,-1,0,1,-1,0],h=new Ga;return h.setAttribute("position",new Ia(c,3)),h.computeBoundingSphere(),r.add(new oo(h,new ma({color:s,opacity:.2,transparent:!0,depthWrite:!1,toneMapped:!1}))),r}return s(n,[{key:"updateMatrixWorld",value:function(e){this.position.set(0,0,0),this.scale.set(.5*this.size,.5*this.size,1),this.lookAt(this.plane.normal),this.translateZ(-this.plane.constant),y(x(n.prototype),"updateMatrixWorld",this).call(this,e)}},{key:"dispose",value:function(){this.geometry.dispose(),this.material.dispose(),this.children[0].geometry.dispose(),this.children[0].material.dispose()}}]),n}(cc),Gp=new Yr,Vp=function(e){w(n,e);var t=E(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Yr(0,0,1),i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Yr(0,0,0),o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:16776960,u=arguments.length>4&&void 0!==arguments[4]?arguments[4]:.2*o,l=arguments.length>5&&void 0!==arguments[5]?arguments[5]:.2*u;return a(this,n),(e=t.call(this)).type="ArrowHelper",void 0===Op&&((Op=new Ga).setAttribute("position",new Ia([0,0,0,0,1,0],3)),(Np=new $c(0,.5,1,5,1)).translate(0,-.5,0)),e.position.copy(i),e.line=new cc(Op,new ic({color:s,toneMapped:!1})),e.line.matrixAutoUpdate=!1,e.add(e.line),e.cone=new oo(Np,new ma({color:s,toneMapped:!1})),e.cone.matrixAutoUpdate=!1,e.add(e.cone),e.setDirection(r),e.setLength(o,u,l),e}return s(n,[{key:"setDirection",value:function(e){if(e.y>.99999)this.quaternion.set(0,0,0,1);else if(e.y<-.99999)this.quaternion.set(1,0,0,0);else{Gp.set(e.z,0,-e.x).normalize();var t=Math.acos(e.y);this.quaternion.setFromAxisAngle(Gp,t)}}},{key:"setLength",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.2*e,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:.2*t;this.line.scale.set(1,Math.max(1e-4,e-t),1),this.line.updateMatrix(),this.cone.scale.set(n,t,n),this.cone.position.y=e,this.cone.updateMatrix()}},{key:"setColor",value:function(e){this.line.material.color.set(e),this.cone.material.color.set(e)}},{key:"copy",value:function(e){return y(x(n.prototype),"copy",this).call(this,e,!1),this.line.copy(e.line),this.cone.copy(e.cone),this}},{key:"dispose",value:function(){this.line.geometry.dispose(),this.line.material.dispose(),this.cone.geometry.dispose(),this.cone.material.dispose()}}]),n}(Zi),Wp=function(e){w(n,e);var t=E(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;a(this,n);var i=[0,0,0,r,0,0,0,0,0,0,r,0,0,0,0,0,0,r],o=[1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],s=new Ga;s.setAttribute("position",new Ia(i,3)),s.setAttribute("color",new Ia(o,3));var u=new ic({vertexColors:!0,toneMapped:!1});return(e=t.call(this,s,u)).type="AxesHelper",e}return s(n,[{key:"setColors",value:function(e,t,n){var r=new pa,i=this.geometry.attributes.color.array;return r.set(e),r.toArray(i,0),r.toArray(i,3),r.set(t),r.toArray(i,6),r.toArray(i,9),r.set(n),r.toArray(i,12),r.toArray(i,15),this.geometry.attributes.color.needsUpdate=!0,this}},{key:"dispose",value:function(){this.geometry.dispose(),this.material.dispose()}}]),n}(fc),jp=function(){function e(){a(this,e),this.type="ShapePath",this.color=new pa,this.subPaths=[],this.currentPath=null}return s(e,[{key:"moveTo",value:function(e,t){return this.currentPath=new Zc,this.subPaths.push(this.currentPath),this.currentPath.moveTo(e,t),this}},{key:"lineTo",value:function(e,t){return this.currentPath.lineTo(e,t),this}},{key:"quadraticCurveTo",value:function(e,t,n,r){return this.currentPath.quadraticCurveTo(e,t,n,r),this}},{key:"bezierCurveTo",value:function(e,t,n,r,i,a){return this.currentPath.bezierCurveTo(e,t,n,r,i,a),this}},{key:"splineThru",value:function(e){return this.currentPath.splineThru(e),this}},{key:"toShapes",value:function(e){function t(e,t){for(var n=t.length,r=!1,i=n-1,a=0;a<n;i=a++){var o=t[i],s=t[a],u=s.x-o.x,l=s.y-o.y;if(Math.abs(l)>Number.EPSILON){if(l<0&&(o=t[a],u=-u,s=t[i],l=-l),e.y<o.y||e.y>s.y)continue;if(e.y===o.y){if(e.x===o.x)return!0}else{var c=l*(e.x-o.x)-u*(e.y-o.y);if(0===c)return!0;if(c<0)continue;r=!r}}else{if(e.y!==o.y)continue;if(s.x<=e.x&&e.x<=o.x||o.x<=e.x&&e.x<=s.x)return!0}}return r}var n,r,i,a=Uh.isClockWise,o=this.subPaths;if(0===o.length)return[];var s=[];if(1===o.length)return r=o[0],(i=new uh).curves=r.curves,s.push(i),s;var u=!a(o[0].getPoints());u=e?!u:u;var l,c,h=[],d=[],f=[],p=0;d[p]=void 0,f[p]=[];for(var v=0,m=o.length;v<m;v++)n=a(l=(r=o[v]).getPoints()),(n=e?!n:n)?(!u&&d[p]&&p++,d[p]={s:new uh,p:l},d[p].s.curves=r.curves,u&&p++,f[p]=[]):f[p].push({h:r,p:l[0]});if(!d[0])return function(e){for(var t=[],n=0,r=e.length;n<r;n++){var i=e[n],a=new uh;a.curves=i.curves,t.push(a)}return t}(o);if(d.length>1){for(var g=!1,y=0,_=0,x=d.length;_<x;_++)h[_]=[];for(var M=0,S=d.length;M<S;M++)for(var b=f[M],w=0;w<b.length;w++){for(var T=b[w],E=!0,A=0;A<d.length;A++)t(T.p,d[A].p)&&(M!==A&&y++,E?(E=!1,h[A].push(T)):g=!0);E&&h[M].push(T)}y>0&&!1===g&&(f=h)}for(var R=0,k=d.length;R<k;R++){i=d[R].s,s.push(i);for(var C=0,L=(c=f[R]).length;C<L;C++)i.holes.push(c[C].h)}return s}}]),e}();"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:k}})),"undefined"!=typeof window&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=k);var Xp={type:"change"},qp={type:"start"},Yp={type:"end"},Zp=new bi,Kp=new wo,Jp=Math.cos(70*vr.DEG2RAD),Qp=function(e){w(n,e);var t=E(n);function n(e,r){var i,o,s,u,l,c,h,d;a(this,n),(i=t.call(this)).object=e,i.domElement=r,i.domElement.style.touchAction="none",i.enabled=!0,i.target=new Yr,i.minDistance=0,i.maxDistance=1/0,i.minZoom=0,i.maxZoom=1/0,i.minPolarAngle=0,i.maxPolarAngle=Math.PI,i.minAzimuthAngle=-1/0,i.maxAzimuthAngle=1/0,i.enableDamping=!1,i.dampingFactor=.05,i.enableZoom=!0,i.zoomSpeed=1,i.enableRotate=!0,i.rotateSpeed=1,i.enablePan=!0,i.panSpeed=1,i.screenSpacePanning=!0,i.keyPanSpeed=7,i.zoomToCursor=!1,i.autoRotate=!1,i.autoRotateSpeed=2,i.keys={LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"},i.mouseButtons={LEFT:C.ROTATE,MIDDLE:C.DOLLY,RIGHT:C.PAN},i.touches={ONE:L.ROTATE,TWO:L.DOLLY_PAN},i.target0=i.target.clone(),i.position0=i.object.position.clone(),i.zoom0=i.object.zoom,i._domElementKeyEvents=null,i.getPolarAngle=function(){return g.phi},i.getAzimuthalAngle=function(){return g.theta},i.getDistance=function(){return this.object.position.distanceTo(this.target)},i.listenToKeyEvents=function(e){e.addEventListener("keydown",se),this._domElementKeyEvents=e},i.stopListenToKeyEvents=function(){this._domElementKeyEvents.removeEventListener("keydown",se),this._domElementKeyEvents=null},i.saveState=function(){f.target0.copy(f.target),f.position0.copy(f.object.position),f.zoom0=f.object.zoom},i.reset=function(){f.target.copy(f.target0),f.object.position.copy(f.position0),f.object.zoom=f.zoom0,f.object.updateProjectionMatrix(),f.dispatchEvent(Xp),f.update(),v=p.NONE},i.update=(o=new Yr,s=(new qr).setFromUnitVectors(e.up,new Yr(0,1,0)),u=s.clone().invert(),l=new Yr,c=new qr,h=new Yr,d=2*Math.PI,function(){var t=f.object.position;o.copy(t).sub(f.target),o.applyQuaternion(s),g.setFromVector3(o),f.autoRotate&&v===p.NONE&&B(2*Math.PI/60/60*f.autoRotateSpeed),f.enableDamping?(g.theta+=y.theta*f.dampingFactor,g.phi+=y.phi*f.dampingFactor):(g.theta+=y.theta,g.phi+=y.phi);var n=f.minAzimuthAngle,r=f.maxAzimuthAngle;isFinite(n)&&isFinite(r)&&(n<-Math.PI?n+=d:n>Math.PI&&(n-=d),r<-Math.PI?r+=d:r>Math.PI&&(r-=d),g.theta=n<=r?Math.max(n,Math.min(r,g.theta)):g.theta>(n+r)/2?Math.max(n,g.theta):Math.min(r,g.theta)),g.phi=Math.max(f.minPolarAngle,Math.min(f.maxPolarAngle,g.phi)),g.makeSafe(),!0===f.enableDamping?f.target.addScaledVector(x,f.dampingFactor):f.target.add(x),f.zoomToCursor&&U||f.object.isOrthographicCamera?g.radius=Y(g.radius):g.radius=Y(g.radius*_),o.setFromSpherical(g),o.applyQuaternion(u),t.copy(f.target).add(o),f.object.lookAt(f.target),!0===f.enableDamping?(y.theta*=1-f.dampingFactor,y.phi*=1-f.dampingFactor,x.multiplyScalar(1-f.dampingFactor)):(y.set(0,0,0),x.set(0,0,0));var i=!1;if(f.zoomToCursor&&U){var a=null;if(f.object.isPerspectiveCamera){var M=o.length(),S=M-(a=Y(M*_));f.object.position.addScaledVector(I,S),f.object.updateMatrixWorld()}else if(f.object.isOrthographicCamera){var b=new Yr(D.x,D.y,0);b.unproject(f.object),f.object.zoom=Math.max(f.minZoom,Math.min(f.maxZoom,f.object.zoom/_)),f.object.updateProjectionMatrix(),i=!0;var w=new Yr(D.x,D.y,0);w.unproject(f.object),f.object.position.sub(w).add(b),f.object.updateMatrixWorld(),a=o.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),f.zoomToCursor=!1;null!==a&&(this.screenSpacePanning?f.target.set(0,0,-1).transformDirection(f.object.matrix).multiplyScalar(a).add(f.object.position):(Zp.origin.copy(f.object.position),Zp.direction.set(0,0,-1).transformDirection(f.object.matrix),Math.abs(f.object.up.dot(Zp.direction))<Jp?e.lookAt(f.target):(Kp.setFromNormalAndCoplanarPoint(f.object.up,f.target),Zp.intersectPlane(Kp,f.target))))}else f.object.isOrthographicCamera&&(f.object.zoom=Math.max(f.minZoom,Math.min(f.maxZoom,f.object.zoom/_)),f.object.updateProjectionMatrix(),i=!0);return _=1,U=!1,!!(i||l.distanceToSquared(f.object.position)>m||8*(1-c.dot(f.object.quaternion))>m||h.distanceToSquared(f.target)>0)&&(f.dispatchEvent(Xp),l.copy(f.object.position),c.copy(f.object.quaternion),h.copy(f.target),i=!1,!0)}),i.dispose=function(){f.domElement.removeEventListener("contextmenu",ue),f.domElement.removeEventListener("pointerdown",re),f.domElement.removeEventListener("pointercancel",ae),f.domElement.removeEventListener("wheel",oe),f.domElement.removeEventListener("pointermove",ie),f.domElement.removeEventListener("pointerup",ae),null!==f._domElementKeyEvents&&(f._domElementKeyEvents.removeEventListener("keydown",se),f._domElementKeyEvents=null)};var f=S(i),p={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6},v=p.NONE,m=1e-6,g=new sp,y=new sp,_=1,x=new Yr,M=new mr,b=new mr,w=new mr,T=new mr,E=new mr,A=new mr,R=new mr,k=new mr,P=new mr,I=new Yr,D=new mr,U=!1,O=[],N={};function F(){return Math.pow(.95,f.zoomSpeed)}function B(e){y.theta-=e}function z(e){y.phi-=e}var H,G=(H=new Yr,function(e,t){H.setFromMatrixColumn(t,0),H.multiplyScalar(-e),x.add(H)}),V=function(){var e=new Yr;return function(t,n){!0===f.screenSpacePanning?e.setFromMatrixColumn(n,1):(e.setFromMatrixColumn(n,0),e.crossVectors(f.object.up,e)),e.multiplyScalar(t),x.add(e)}}(),W=function(){var e=new Yr;return function(t,n){var r=f.domElement;if(f.object.isPerspectiveCamera){var i=f.object.position;e.copy(i).sub(f.target);var a=e.length();a*=Math.tan(f.object.fov/2*Math.PI/180),G(2*t*a/r.clientHeight,f.object.matrix),V(2*n*a/r.clientHeight,f.object.matrix)}else f.object.isOrthographicCamera?(G(t*(f.object.right-f.object.left)/f.object.zoom/r.clientWidth,f.object.matrix),V(n*(f.object.top-f.object.bottom)/f.object.zoom/r.clientHeight,f.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),f.enablePan=!1)}}();function j(e){f.object.isPerspectiveCamera||f.object.isOrthographicCamera?_/=e:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),f.enableZoom=!1)}function X(e){f.object.isPerspectiveCamera||f.object.isOrthographicCamera?_*=e:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),f.enableZoom=!1)}function q(t){if(f.zoomToCursor){U=!0;var n=f.domElement.getBoundingClientRect(),r=t.clientX-n.left,i=t.clientY-n.top,a=n.width,o=n.height;D.x=r/a*2-1,D.y=-i/o*2+1,I.set(D.x,D.y,1).unproject(e).sub(e.position).normalize()}}function Y(e){return Math.max(f.minDistance,Math.min(f.maxDistance,e))}function Z(e){M.set(e.clientX,e.clientY)}function K(e){T.set(e.clientX,e.clientY)}function J(){if(1===O.length)M.set(O[0].pageX,O[0].pageY);else{var e=.5*(O[0].pageX+O[1].pageX),t=.5*(O[0].pageY+O[1].pageY);M.set(e,t)}}function Q(){if(1===O.length)T.set(O[0].pageX,O[0].pageY);else{var e=.5*(O[0].pageX+O[1].pageX),t=.5*(O[0].pageY+O[1].pageY);T.set(e,t)}}function $(){var e=O[0].pageX-O[1].pageX,t=O[0].pageY-O[1].pageY,n=Math.sqrt(e*e+t*t);R.set(0,n)}function ee(e){if(1==O.length)b.set(e.pageX,e.pageY);else{var t=ce(e),n=.5*(e.pageX+t.x),r=.5*(e.pageY+t.y);b.set(n,r)}w.subVectors(b,M).multiplyScalar(f.rotateSpeed);var i=f.domElement;B(2*Math.PI*w.x/i.clientHeight),z(2*Math.PI*w.y/i.clientHeight),M.copy(b)}function te(e){if(1===O.length)E.set(e.pageX,e.pageY);else{var t=ce(e),n=.5*(e.pageX+t.x),r=.5*(e.pageY+t.y);E.set(n,r)}A.subVectors(E,T).multiplyScalar(f.panSpeed),W(A.x,A.y),T.copy(E)}function ne(e){var t=ce(e),n=e.pageX-t.x,r=e.pageY-t.y,i=Math.sqrt(n*n+r*r);k.set(0,i),P.set(0,Math.pow(k.y/R.y,f.zoomSpeed)),j(P.y),R.copy(k)}function re(e){!1!==f.enabled&&(0===O.length&&(f.domElement.setPointerCapture(e.pointerId),f.domElement.addEventListener("pointermove",ie),f.domElement.addEventListener("pointerup",ae)),function(e){O.push(e)}(e),"touch"===e.pointerType?function(e){switch(le(e),O.length){case 1:switch(f.touches.ONE){case L.ROTATE:if(!1===f.enableRotate)return;J(),v=p.TOUCH_ROTATE;break;case L.PAN:if(!1===f.enablePan)return;Q(),v=p.TOUCH_PAN;break;default:v=p.NONE}break;case 2:switch(f.touches.TWO){case L.DOLLY_PAN:if(!1===f.enableZoom&&!1===f.enablePan)return;f.enableZoom&&$(),f.enablePan&&Q(),v=p.TOUCH_DOLLY_PAN;break;case L.DOLLY_ROTATE:if(!1===f.enableZoom&&!1===f.enableRotate)return;f.enableZoom&&$(),f.enableRotate&&J(),v=p.TOUCH_DOLLY_ROTATE;break;default:v=p.NONE}break;default:v=p.NONE}v!==p.NONE&&f.dispatchEvent(qp)}(e):function(e){var t;switch(e.button){case 0:t=f.mouseButtons.LEFT;break;case 1:t=f.mouseButtons.MIDDLE;break;case 2:t=f.mouseButtons.RIGHT;break;default:t=-1}switch(t){case C.DOLLY:if(!1===f.enableZoom)return;!function(e){q(e),R.set(e.clientX,e.clientY)}(e),v=p.DOLLY;break;case C.ROTATE:if(e.ctrlKey||e.metaKey||e.shiftKey){if(!1===f.enablePan)return;K(e),v=p.PAN}else{if(!1===f.enableRotate)return;Z(e),v=p.ROTATE}break;case C.PAN:if(e.ctrlKey||e.metaKey||e.shiftKey){if(!1===f.enableRotate)return;Z(e),v=p.ROTATE}else{if(!1===f.enablePan)return;K(e),v=p.PAN}break;default:v=p.NONE}v!==p.NONE&&f.dispatchEvent(qp)}(e))}function ie(e){!1!==f.enabled&&("touch"===e.pointerType?function(e){switch(le(e),v){case p.TOUCH_ROTATE:if(!1===f.enableRotate)return;ee(e),f.update();break;case p.TOUCH_PAN:if(!1===f.enablePan)return;te(e),f.update();break;case p.TOUCH_DOLLY_PAN:if(!1===f.enableZoom&&!1===f.enablePan)return;!function(e){f.enableZoom&&ne(e),f.enablePan&&te(e)}(e),f.update();break;case p.TOUCH_DOLLY_ROTATE:if(!1===f.enableZoom&&!1===f.enableRotate)return;!function(e){f.enableZoom&&ne(e),f.enableRotate&&ee(e)}(e),f.update();break;default:v=p.NONE}}(e):function(e){switch(v){case p.ROTATE:if(!1===f.enableRotate)return;!function(e){b.set(e.clientX,e.clientY),w.subVectors(b,M).multiplyScalar(f.rotateSpeed);var t=f.domElement;B(2*Math.PI*w.x/t.clientHeight),z(2*Math.PI*w.y/t.clientHeight),M.copy(b),f.update()}(e);break;case p.DOLLY:if(!1===f.enableZoom)return;!function(e){k.set(e.clientX,e.clientY),P.subVectors(k,R),P.y>0?j(F()):P.y<0&&X(F()),R.copy(k),f.update()}(e);break;case p.PAN:if(!1===f.enablePan)return;!function(e){E.set(e.clientX,e.clientY),A.subVectors(E,T).multiplyScalar(f.panSpeed),W(A.x,A.y),T.copy(E),f.update()}(e)}}(e))}function ae(e){!function(e){delete N[e.pointerId];for(var t=0;t<O.length;t++)if(O[t].pointerId==e.pointerId)return void O.splice(t,1)}(e),0===O.length&&(f.domElement.releasePointerCapture(e.pointerId),f.domElement.removeEventListener("pointermove",ie),f.domElement.removeEventListener("pointerup",ae)),f.dispatchEvent(Yp),v=p.NONE}function oe(e){!1!==f.enabled&&!1!==f.enableZoom&&v===p.NONE&&(e.preventDefault(),f.dispatchEvent(qp),function(e){q(e),e.deltaY<0?X(F()):e.deltaY>0&&j(F()),f.update()}(e),f.dispatchEvent(Yp))}function se(e){!1!==f.enabled&&!1!==f.enablePan&&function(e){var t=!1;switch(e.code){case f.keys.UP:e.ctrlKey||e.metaKey||e.shiftKey?z(2*Math.PI*f.rotateSpeed/f.domElement.clientHeight):W(0,f.keyPanSpeed),t=!0;break;case f.keys.BOTTOM:e.ctrlKey||e.metaKey||e.shiftKey?z(-2*Math.PI*f.rotateSpeed/f.domElement.clientHeight):W(0,-f.keyPanSpeed),t=!0;break;case f.keys.LEFT:e.ctrlKey||e.metaKey||e.shiftKey?B(2*Math.PI*f.rotateSpeed/f.domElement.clientHeight):W(f.keyPanSpeed,0),t=!0;break;case f.keys.RIGHT:e.ctrlKey||e.metaKey||e.shiftKey?B(-2*Math.PI*f.rotateSpeed/f.domElement.clientHeight):W(-f.keyPanSpeed,0),t=!0}t&&(e.preventDefault(),f.update())}(e)}function ue(e){!1!==f.enabled&&e.preventDefault()}function le(e){var t=N[e.pointerId];void 0===t&&(t=new mr,N[e.pointerId]=t),t.set(e.pageX,e.pageY)}function ce(e){var t=e.pointerId===O[0].pointerId?O[1]:O[0];return N[t.pointerId]}return f.domElement.addEventListener("contextmenu",ue),f.domElement.addEventListener("pointerdown",re),f.domElement.addEventListener("pointercancel",ae),f.domElement.addEventListener("wheel",oe,{passive:!1}),i.update(),i}return s(n)}(tr),$p=n(444),ev=Object.freeze({Linear:Object.freeze({None:function(e){return e},In:function(e){return this.None(e)},Out:function(e){return this.None(e)},InOut:function(e){return this.None(e)}}),Quadratic:Object.freeze({In:function(e){return e*e},Out:function(e){return e*(2-e)},InOut:function(e){return(e*=2)<1?.5*e*e:-.5*(--e*(e-2)-1)}}),Cubic:Object.freeze({In:function(e){return e*e*e},Out:function(e){return--e*e*e+1},InOut:function(e){return(e*=2)<1?.5*e*e*e:.5*((e-=2)*e*e+2)}}),Quartic:Object.freeze({In:function(e){return e*e*e*e},Out:function(e){return 1- --e*e*e*e},InOut:function(e){return(e*=2)<1?.5*e*e*e*e:-.5*((e-=2)*e*e*e-2)}}),Quintic:Object.freeze({In:function(e){return e*e*e*e*e},Out:function(e){return--e*e*e*e*e+1},InOut:function(e){return(e*=2)<1?.5*e*e*e*e*e:.5*((e-=2)*e*e*e*e+2)}}),Sinusoidal:Object.freeze({In:function(e){return 1-Math.sin((1-e)*Math.PI/2)},Out:function(e){return Math.sin(e*Math.PI/2)},InOut:function(e){return.5*(1-Math.sin(Math.PI*(.5-e)))}}),Exponential:Object.freeze({In:function(e){return 0===e?0:Math.pow(1024,e-1)},Out:function(e){return 1===e?1:1-Math.pow(2,-10*e)},InOut:function(e){return 0===e?0:1===e?1:(e*=2)<1?.5*Math.pow(1024,e-1):.5*(2-Math.pow(2,-10*(e-1)))}}),Circular:Object.freeze({In:function(e){return 1-Math.sqrt(1-e*e)},Out:function(e){return Math.sqrt(1- --e*e)},InOut:function(e){return(e*=2)<1?-.5*(Math.sqrt(1-e*e)-1):.5*(Math.sqrt(1-(e-=2)*e)+1)}}),Elastic:Object.freeze({In:function(e){return 0===e?0:1===e?1:-Math.pow(2,10*(e-1))*Math.sin(5*(e-1.1)*Math.PI)},Out:function(e){return 0===e?0:1===e?1:Math.pow(2,-10*e)*Math.sin(5*(e-.1)*Math.PI)+1},InOut:function(e){return 0===e?0:1===e?1:(e*=2)<1?-.5*Math.pow(2,10*(e-1))*Math.sin(5*(e-1.1)*Math.PI):.5*Math.pow(2,-10*(e-1))*Math.sin(5*(e-1.1)*Math.PI)+1}}),Back:Object.freeze({In:function(e){var t=1.70158;return 1===e?1:e*e*((t+1)*e-t)},Out:function(e){var t=1.70158;return 0===e?0:--e*e*((t+1)*e+t)+1},InOut:function(e){var t=2.5949095;return(e*=2)<1?e*e*((t+1)*e-t)*.5:.5*((e-=2)*e*((t+1)*e+t)+2)}}),Bounce:Object.freeze({In:function(e){return 1-ev.Bounce.Out(1-e)},Out:function(e){return e<1/2.75?7.5625*e*e:e<2/2.75?7.5625*(e-=1.5/2.75)*e+.75:e<2.5/2.75?7.5625*(e-=2.25/2.75)*e+.9375:7.5625*(e-=2.625/2.75)*e+.984375},InOut:function(e){return e<.5?.5*ev.Bounce.In(2*e):.5*ev.Bounce.Out(2*e-1)+.5}}),generatePow:function(e){return void 0===e&&(e=4),e=(e=e<Number.EPSILON?Number.EPSILON:e)>1e4?1e4:e,{In:function(t){return Math.pow(t,e)},Out:function(t){return 1-Math.pow(1-t,e)},InOut:function(t){return t<.5?Math.pow(2*t,e)/2:(1-Math.pow(2-2*t,e))/2+.5}}}}),tv=function(){return performance.now()},nv=function(){function e(){this._tweens={},this._tweensAddedDuringUpdate={}}return e.prototype.getAll=function(){var e=this;return Object.keys(this._tweens).map((function(t){return e._tweens[t]}))},e.prototype.removeAll=function(){this._tweens={}},e.prototype.add=function(e){this._tweens[e.getId()]=e,this._tweensAddedDuringUpdate[e.getId()]=e},e.prototype.remove=function(e){delete this._tweens[e.getId()],delete this._tweensAddedDuringUpdate[e.getId()]},e.prototype.update=function(e,t){void 0===e&&(e=tv()),void 0===t&&(t=!1);var n=Object.keys(this._tweens);if(0===n.length)return!1;for(;n.length>0;){this._tweensAddedDuringUpdate={};for(var r=0;r<n.length;r++){var i=this._tweens[n[r]],a=!t;i&&!1===i.update(e,a)&&!t&&delete this._tweens[n[r]]}n=Object.keys(this._tweensAddedDuringUpdate)}return!0},e}(),rv={Linear:function(e,t){var n=e.length-1,r=n*t,i=Math.floor(r),a=rv.Utils.Linear;return t<0?a(e[0],e[1],r):t>1?a(e[n],e[n-1],n-r):a(e[i],e[i+1>n?n:i+1],r-i)},Bezier:function(e,t){for(var n=0,r=e.length-1,i=Math.pow,a=rv.Utils.Bernstein,o=0;o<=r;o++)n+=i(1-t,r-o)*i(t,o)*e[o]*a(r,o);return n},CatmullRom:function(e,t){var n=e.length-1,r=n*t,i=Math.floor(r),a=rv.Utils.CatmullRom;return e[0]===e[n]?(t<0&&(i=Math.floor(r=n*(1+t))),a(e[(i-1+n)%n],e[i],e[(i+1)%n],e[(i+2)%n],r-i)):t<0?e[0]-(a(e[0],e[0],e[1],e[1],-r)-e[0]):t>1?e[n]-(a(e[n],e[n],e[n-1],e[n-1],r-n)-e[n]):a(e[i?i-1:0],e[i],e[n<i+1?n:i+1],e[n<i+2?n:i+2],r-i)},Utils:{Linear:function(e,t,n){return(t-e)*n+e},Bernstein:function(e,t){var n=rv.Utils.Factorial;return n(e)/n(t)/n(e-t)},Factorial:function(){var e=[1];return function(t){var n=1;if(e[t])return e[t];for(var r=t;r>1;r--)n*=r;return e[t]=n,n}}(),CatmullRom:function(e,t,n,r,i){var a=.5*(n-e),o=.5*(r-t),s=i*i;return(2*t-2*n+a+o)*(i*s)+(-3*t+3*n-2*a-o)*s+a*i+t}}},iv=function(){function e(){}return e.nextId=function(){return e._nextId++},e._nextId=0,e}(),av=new nv,ov=function(){function e(e,t){void 0===t&&(t=av),this._object=e,this._group=t,this._isPaused=!1,this._pauseStart=0,this._valuesStart={},this._valuesEnd={},this._valuesStartRepeat={},this._duration=1e3,this._isDynamic=!1,this._initialRepeat=0,this._repeat=0,this._yoyo=!1,this._isPlaying=!1,this._reversed=!1,this._delayTime=0,this._startTime=0,this._easingFunction=ev.Linear.None,this._interpolationFunction=rv.Linear,this._chainedTweens=[],this._onStartCallbackFired=!1,this._onEveryStartCallbackFired=!1,this._id=iv.nextId(),this._isChainStopped=!1,this._propertiesAreSetUp=!1,this._goToEnd=!1}return e.prototype.getId=function(){return this._id},e.prototype.isPlaying=function(){return this._isPlaying},e.prototype.isPaused=function(){return this._isPaused},e.prototype.to=function(e,t){if(void 0===t&&(t=1e3),this._isPlaying)throw new Error("Can not call Tween.to() while Tween is already started or paused. Stop the Tween first.");return this._valuesEnd=e,this._propertiesAreSetUp=!1,this._duration=t,this},e.prototype.duration=function(e){return void 0===e&&(e=1e3),this._duration=e,this},e.prototype.dynamic=function(e){return void 0===e&&(e=!1),this._isDynamic=e,this},e.prototype.start=function(e,t){if(void 0===e&&(e=tv()),void 0===t&&(t=!1),this._isPlaying)return this;if(this._group&&this._group.add(this),this._repeat=this._initialRepeat,this._reversed)for(var n in this._reversed=!1,this._valuesStartRepeat)this._swapEndStartRepeatValues(n),this._valuesStart[n]=this._valuesStartRepeat[n];if(this._isPlaying=!0,this._isPaused=!1,this._onStartCallbackFired=!1,this._onEveryStartCallbackFired=!1,this._isChainStopped=!1,this._startTime=e,this._startTime+=this._delayTime,!this._propertiesAreSetUp||t){if(this._propertiesAreSetUp=!0,!this._isDynamic){var r={};for(var i in this._valuesEnd)r[i]=this._valuesEnd[i];this._valuesEnd=r}this._setupProperties(this._object,this._valuesStart,this._valuesEnd,this._valuesStartRepeat,t)}return this},e.prototype.startFromCurrentValues=function(e){return this.start(e,!0)},e.prototype._setupProperties=function(e,t,n,r,i){for(var a in n){var o=e[a],s=Array.isArray(o),u=s?"array":$p(o),l=!s&&Array.isArray(n[a]);if("undefined"!==u&&"function"!==u){if(l){if(0===(m=n[a]).length)continue;for(var c=[o],h=0,d=m.length;h<d;h+=1){var f=this._handleRelativeValue(o,m[h]);if(isNaN(f)){l=!1,console.warn("Found invalid interpolation list. Skipping.");break}c.push(f)}l&&(n[a]=c)}if("object"!==u&&!s||!o||l)(void 0===t[a]||i)&&(t[a]=o),s||(t[a]*=1),r[a]=l?n[a].slice().reverse():t[a]||0;else{t[a]=s?[]:{};var p=o;for(var v in p)t[a][v]=p[v];r[a]=s?[]:{};var m=n[a];if(!this._isDynamic){var g={};for(var v in m)g[v]=m[v];n[a]=m=g}this._setupProperties(p,t[a],m,r[a],i)}}}},e.prototype.stop=function(){return this._isChainStopped||(this._isChainStopped=!0,this.stopChainedTweens()),this._isPlaying?(this._group&&this._group.remove(this),this._isPlaying=!1,this._isPaused=!1,this._onStopCallback&&this._onStopCallback(this._object),this):this},e.prototype.end=function(){return this._goToEnd=!0,this.update(1/0),this},e.prototype.pause=function(e){return void 0===e&&(e=tv()),this._isPaused||!this._isPlaying||(this._isPaused=!0,this._pauseStart=e,this._group&&this._group.remove(this)),this},e.prototype.resume=function(e){return void 0===e&&(e=tv()),this._isPaused&&this._isPlaying?(this._isPaused=!1,this._startTime+=e-this._pauseStart,this._pauseStart=0,this._group&&this._group.add(this),this):this},e.prototype.stopChainedTweens=function(){for(var e=0,t=this._chainedTweens.length;e<t;e++)this._chainedTweens[e].stop();return this},e.prototype.group=function(e){return void 0===e&&(e=av),this._group=e,this},e.prototype.delay=function(e){return void 0===e&&(e=0),this._delayTime=e,this},e.prototype.repeat=function(e){return void 0===e&&(e=0),this._initialRepeat=e,this._repeat=e,this},e.prototype.repeatDelay=function(e){return this._repeatDelayTime=e,this},e.prototype.yoyo=function(e){return void 0===e&&(e=!1),this._yoyo=e,this},e.prototype.easing=function(e){return void 0===e&&(e=ev.Linear.None),this._easingFunction=e,this},e.prototype.interpolation=function(e){return void 0===e&&(e=rv.Linear),this._interpolationFunction=e,this},e.prototype.chain=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return this._chainedTweens=e,this},e.prototype.onStart=function(e){return this._onStartCallback=e,this},e.prototype.onEveryStart=function(e){return this._onEveryStartCallback=e,this},e.prototype.onUpdate=function(e){return this._onUpdateCallback=e,this},e.prototype.onRepeat=function(e){return this._onRepeatCallback=e,this},e.prototype.onComplete=function(e){return this._onCompleteCallback=e,this},e.prototype.onStop=function(e){return this._onStopCallback=e,this},e.prototype.update=function(e,t){if(void 0===e&&(e=tv()),void 0===t&&(t=!0),this._isPaused)return!0;var n,r,i=this._startTime+this._duration;if(!this._goToEnd&&!this._isPlaying){if(e>i)return!1;t&&this.start(e,!0)}if(this._goToEnd=!1,e<this._startTime)return!0;!1===this._onStartCallbackFired&&(this._onStartCallback&&this._onStartCallback(this._object),this._onStartCallbackFired=!0),!1===this._onEveryStartCallbackFired&&(this._onEveryStartCallback&&this._onEveryStartCallback(this._object),this._onEveryStartCallbackFired=!0),r=(e-this._startTime)/this._duration,r=0===this._duration||r>1?1:r;var a=this._easingFunction(r);if(this._updateProperties(this._object,this._valuesStart,this._valuesEnd,a),this._onUpdateCallback&&this._onUpdateCallback(this._object,r),1===r){if(this._repeat>0){for(n in isFinite(this._repeat)&&this._repeat--,this._valuesStartRepeat)this._yoyo||"string"!=typeof this._valuesEnd[n]||(this._valuesStartRepeat[n]=this._valuesStartRepeat[n]+parseFloat(this._valuesEnd[n])),this._yoyo&&this._swapEndStartRepeatValues(n),this._valuesStart[n]=this._valuesStartRepeat[n];return this._yoyo&&(this._reversed=!this._reversed),void 0!==this._repeatDelayTime?this._startTime=e+this._repeatDelayTime:this._startTime=e+this._delayTime,this._onRepeatCallback&&this._onRepeatCallback(this._object),this._onEveryStartCallbackFired=!1,!0}this._onCompleteCallback&&this._onCompleteCallback(this._object);for(var o=0,s=this._chainedTweens.length;o<s;o++)this._chainedTweens[o].start(this._startTime+this._duration,!1);return this._isPlaying=!1,!1}return!0},e.prototype._updateProperties=function(e,t,n,r){for(var i in n)if(void 0!==t[i]){var a=t[i]||0,o=n[i],s=Array.isArray(e[i]),u=Array.isArray(o);!s&&u?e[i]=this._interpolationFunction(o,r):"object"===$p(o)&&o?this._updateProperties(e[i],a,o,r):"number"==typeof(o=this._handleRelativeValue(a,o))&&(e[i]=a+(o-a)*r)}},e.prototype._handleRelativeValue=function(e,t){return"string"!=typeof t?t:"+"===t.charAt(0)||"-"===t.charAt(0)?e+parseFloat(t):parseFloat(t)},e.prototype._swapEndStartRepeatValues=function(e){var t=this._valuesStartRepeat[e],n=this._valuesEnd[e];this._valuesStartRepeat[e]="string"==typeof n?this._valuesStartRepeat[e]+parseFloat(n):this._valuesEnd[e],this._valuesEnd[e]=t},e}(),sv=(iv.nextId,av),uv=(sv.getAll.bind(sv),sv.removeAll.bind(sv),sv.add.bind(sv),sv.remove.bind(sv),sv.update.bind(sv));var lv,cv,hv,dv={all:lv=lv||new Map,on:function(e,t){var n=lv.get(e);n?n.push(t):lv.set(e,[t])},off:function(e,t){var n=lv.get(e);n&&(t?n.splice(n.indexOf(t)>>>0,1):lv.set(e,[]))},emit:function(e,t){var n=lv.get(e);n&&n.slice().map((function(e){e(t)})),(n=lv.get("*"))&&n.slice().map((function(n){n(e,t)}))}},fv={on:dv.on,off:dv.off,emit:dv.emit,all:dv.all},pv=function(e){for(var t="",n=0;n<e.length;n++){var r=e[n];r===r.toUpperCase()?t+="-".concat(r.toLowerCase()):t+=r}return t&&"-"===t[0]&&(t=t.slice(1)),t},vv=function(){function e(){o()(this,e),c()(this,"scene",null),c()(this,"triggerClick",!1),c()(this,"camera",null),c()(this,"domElement",null),c()(this,"orbitControls",null),c()(this,"transformControls",[]),c()(this,"frameCallbacks",new Set),c()(this,"groupCatch",[])}return u()(e,[{key:"addScene",value:function(e){this.scene=e}},{key:"setCamera",value:function(e){this.camera=e}},{key:"setDomElement",value:function(e){this.domElement=e}},{key:"setOrbitControls",value:function(e){this.orbitControls=e}},{key:"setTransformControls",value:function(e){this.transformControls.push(e)}},{key:"setTriggerClickState",value:function(e){this.triggerClick=e}},{key:"addFrameCallback",value:function(e){this.frameCallbacks.add(e)}},{key:"removeFrameCallback",value:function(e){this.frameCallbacks.delete(e)}},{key:"addCatch",value:function(e){this.groupCatch.push(e)}}]),e}(),mv=new vv,gv=function(e){T()(n,e);var t=A()(n);function n(e,r){var i;return o()(this,n),i=t.call(this,e,r),c()(b()(i),"natureEventMap",new Map),c()(b()(i),"entered",!1),i}return u()(n,[{key:"addNatureEventListener",value:function(e,t){this.natureEventMap.has(e)||this.natureEventMap.set(e,[]),this.natureEventMap.get(e).push(t)}},{key:"removeNatureEventListener",value:function(e,t){if(this.natureEventMap.has(e)){var n=this.natureEventMap.get(e),r=n.findIndex((function(e){return e===t}));r>-1&&n.splice(r,1)}}},{key:"removeAllNatureEventListener",value:function(){this.natureEventMap.clear()}},{key:"handleClick",value:function(e,t){var n=this;mv.triggerClick&&e.forEach((function(e){e(n,t)}))}},{key:"handlePointerMove",value:function(e,t){var n=this;e.forEach((function(e){e(n,t)}))}},{key:"handlePointerleave",value:function(){var e=this,t=this.natureEventMap.get("pointerleave");t&&t.length>0&&t.forEach((function(t){t(e)}))}},{key:"raycast",value:function(e,t){if(0!==this.natureEventMap.size){_()(M()(n.prototype),"raycast",this).call(this,e,t);var r=this.natureEventMap.get("click"),i=this.natureEventMap.get("pointerup"),a=this.natureEventMap.get("pointerdown"),o=this.natureEventMap.get("pointermove"),s=t[0];(s&&s.object)===this?(this.entered=!0,r&&r.length>0&&this.handleClick(r,s),i&&i.length>0&&this.handleClick(i,s),a&&a.length>0&&this.handleClick(a,s),o&&o.length>0&&this.handlePointerMove(o,s)):this.entered&&(this.handlePointerleave(),this.entered=!1)}}}]),n}(oo),yv=gv,_v=function(e){w(n,e);var t=E(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:document.createElement("div");return a(this,n),(e=t.call(this)).isCSS2DObject=!0,e.element=r,e.element.style.position="absolute",e.element.style.userSelect="none",e.element.setAttribute("draggable",!1),e.center=new mr(.5,.5),e.addEventListener("removed",(function(){this.traverse((function(e){e.element instanceof Element&&null!==e.element.parentNode&&e.element.parentNode.removeChild(e.element)}))})),e}return s(n,[{key:"copy",value:function(e,t){return y(x(n.prototype),"copy",this).call(this,e,t),this.element=e.element.cloneNode(!0),this.center=e.center,this}}]),n}(Zi),xv=new Yr,Mv=new wi,Sv=new wi,bv=new Yr,wv=new Yr,Tv=s((function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};a(this,e);var n,r,i,o,s=this,u={objects:new WeakMap},l=void 0!==t.element?t.element:document.createElement("div");function c(e,t,n){if(e.isCSS2DObject){xv.setFromMatrixPosition(e.matrixWorld),xv.applyMatrix4(Sv);var r=!0===e.visible&&xv.z>=-1&&xv.z<=1&&!0===e.layers.test(n.layers);if(e.element.style.display=!0===r?"":"none",!0===r){e.onBeforeRender(s,t,n);var a=e.element;a.style.transform="translate("+-100*e.center.x+"%,"+-100*e.center.y+"%)translate("+(xv.x*i+i)+"px,"+(-xv.y*o+o)+"px)",a.parentNode!==l&&l.appendChild(a),e.onAfterRender(s,t,n)}var d={distanceToCameraSquared:h(n,e)};u.objects.set(e,d)}for(var f=0,p=e.children.length;f<p;f++)c(e.children[f],t,n)}function h(e,t){return bv.setFromMatrixPosition(e.matrixWorld),wv.setFromMatrixPosition(t.matrixWorld),bv.distanceToSquared(wv)}function d(e){var t=[];return e.traverse((function(e){e.isCSS2DObject&&t.push(e)})),t}function f(e){for(var t=d(e).sort((function(e,t){return e.renderOrder!==t.renderOrder?t.renderOrder-e.renderOrder:u.objects.get(e).distanceToCameraSquared-u.objects.get(t).distanceToCameraSquared})),n=t.length,r=0,i=t.length;r<i;r++)t[r].element.style.zIndex=n-r}l.style.overflow="hidden",this.domElement=l,this.getSize=function(){return{width:n,height:r}},this.render=function(e,t){!0===e.matrixWorldAutoUpdate&&e.updateMatrixWorld(),null===t.parent&&!0===t.matrixWorldAutoUpdate&&t.updateMatrixWorld(),Mv.copy(t.matrixWorldInverse),Sv.multiplyMatrices(t.projectionMatrix,Mv),c(e,e,t),f(e)},this.setSize=function(e,t){i=(n=e)/2,o=(r=t)/2,l.style.width=e+"px",l.style.height=t+"px"}})),Ev=new Yr,Av=new qr,Rv=new Yr,kv=new wi,Cv=new wi,Lv=s((function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};a(this,e);var n,r,i,o,s=this,u={camera:{fov:0,style:""},objects:new WeakMap},l=void 0!==t.element?t.element:document.createElement("div");l.style.overflow="hidden",this.domElement=l;var c=document.createElement("div");c.style.transformOrigin="0 0",c.style.pointerEvents="none",l.appendChild(c);var h=document.createElement("div");function d(e){return Math.abs(e)<1e-10?0:e}function f(e){var t=e.elements;return"matrix3d("+d(t[0])+","+d(-t[1])+","+d(t[2])+","+d(t[3])+","+d(t[4])+","+d(-t[5])+","+d(t[6])+","+d(t[7])+","+d(t[8])+","+d(-t[9])+","+d(t[10])+","+d(t[11])+","+d(t[12])+","+d(-t[13])+","+d(t[14])+","+d(t[15])+")"}function p(e){var t=e.elements;return"translate(-50%,-50%)"+("matrix3d("+d(t[0])+","+d(t[1])+","+d(t[2])+","+d(t[3])+","+d(-t[4])+","+d(-t[5])+","+d(-t[6])+","+d(-t[7])+","+d(t[8])+","+d(t[9])+","+d(t[10])+","+d(t[11])+","+d(t[12])+","+d(t[13])+","+d(t[14])+","+d(t[15])+")")}function v(e,t,n,r){if(e.isCSS3DObject){var i=!0===e.visible&&!0===e.layers.test(n.layers);if(e.element.style.display=!0===i?"":"none",!0===i){var a;e.onBeforeRender(s,t,n),e.isCSS3DSprite?(kv.copy(n.matrixWorldInverse),kv.transpose(),0!==e.rotation2D&&kv.multiply(Cv.makeRotationZ(e.rotation2D)),e.matrixWorld.decompose(Ev,Av,Rv),kv.setPosition(Ev),kv.scale(Rv),kv.elements[3]=0,kv.elements[7]=0,kv.elements[11]=0,kv.elements[15]=1,a=p(kv)):a=p(e.matrixWorld);var o=e.element,l=u.objects.get(e);if(void 0===l||l.style!==a){o.style.transform=a;var c={style:a};u.objects.set(e,c)}o.parentNode!==h&&h.appendChild(o),e.onAfterRender(s,t,n)}}for(var d=0,f=e.children.length;d<f;d++)v(e.children[d],t,n,r)}h.style.transformStyle="preserve-3d",c.appendChild(h),this.getSize=function(){return{width:n,height:r}},this.render=function(e,t){var a,s,l=t.projectionMatrix.elements[5]*o;u.camera.fov!==l&&(c.style.perspective=t.isPerspectiveCamera?l+"px":"",u.camera.fov=l),t.view&&t.view.enabled?(c.style.transform="translate( ".concat(-t.view.offsetX*(n/t.view.width),"px, ").concat(-t.view.offsetY*(r/t.view.height),"px )"),c.style.transform+="scale( ".concat(t.view.fullWidth/t.view.width,", ").concat(t.view.fullHeight/t.view.height," )")):c.style.transform="",!0===e.matrixWorldAutoUpdate&&e.updateMatrixWorld(),null===t.parent&&!0===t.matrixWorldAutoUpdate&&t.updateMatrixWorld(),t.isOrthographicCamera&&(a=-(t.right+t.left)/2,s=(t.top+t.bottom)/2);var p=t.view&&t.view.enabled?t.view.height/t.view.fullHeight:1,m=t.isOrthographicCamera?"scale( ".concat(p," )")+"scale("+l+")translate("+d(a)+"px,"+d(s)+"px)"+f(t.matrixWorldInverse):"scale( ".concat(p," )")+"translateZ("+l+"px)"+f(t.matrixWorldInverse),g=m+"translate("+i+"px,"+o+"px)";u.camera.style!==g&&(h.style.transform=g,u.camera.style=g),v(e,e,t,m)},this.setSize=function(e,t){i=(n=e)/2,o=(r=t)/2,l.style.width=e+"px",l.style.height=t+"px",c.style.width=e+"px",c.style.height=t+"px",h.style.width=e+"px",h.style.height=t+"px"}})),Pv=function(){function e(t){o()(this,e),c()(this,"baseCssRenderer",new Tv),c()(this,"normalCssRenderer",new Lv),c()(this,"cssRenderer",void 0),this.cssRenderer="base"===t?this.baseCssRenderer:this.normalCssRenderer}return u()(e,[{key:"getSize",value:function(){return this.cssRenderer.getSize()}},{key:"setSize",value:function(e,t){this.cssRenderer.setSize(e,t)}},{key:"render",value:function(e,t){this.cssRenderer.render(e,t)}}]),e}(),Iv=Pv,Dv=new(function(){function e(){o()(this,e),c()(this,"callback",{}),c()(this,"task",new Map)}return u()(e,[{key:"update",value:function(){this.task.size>0&&f()(this.task.keys()).forEach((function(e){e()}))}},{key:"add",value:function(e,t){this.callback.cb=e,this.callback.duration=t||1e3}},{key:"remove",value:function(e){this.task.get(e)&&(clearTimeout(this.task.get(e)),this.task.delete(e))}},{key:"start",value:function(){if(!this.task.get(this.callback.cb)){var e=this.timerControl();this.task.set(this.callback.cb,e)}}},{key:"timerControl",value:function(){var e=this;return setTimeout((function(){e.task.delete(e.callback.cb)}),this.callback.duration)}}]),e}());cv||(cv={}),function(e){e.plus="plus",e.minus="minus"}(hv||(hv={}));var Uv=function(e,t,n,r,i,a){var o=t.position,s=e.position,u=o.clone().sub(s).normalize();r===hv.minus&&(u=u.negate());var l=s.clone().add(u.multiplyScalar(n)),c=s.distanceTo(o),h=s.distanceTo(l),d=l.clone();r===hv.plus&&h>c&&(d=o);var f=new ov(s);return f.to(d,i||1e3),f.start(),e instanceof Nv&&(Dv.add((function(){e.lookAt(o)}),1.01*(i||1e3)),Dv.start()),f},Ov=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:500,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{x:0,y:0,z:0},i=arguments.length>4?arguments[4]:void 0,a=t.getPoints(n),o=a.length,s=0,u=1,l=function(e){return e>o?e-o-1:e},c=function(){s>=o&&(s=l(s));var t=a[l(s)%o];e.position.set(t.x+r.x||0,t.y+r.y||0,t.z+r.z||0),i?e.lookAt(i):e.lookAt(a[l(s+1)%o]),s+=u};return Dv.add(c,1e5),Dv.start(),{remove:function(){return Dv.remove(c)},increaseSpeed:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;u=e+u},recoverSpeed:function(){u=1}}},Nv=function(e){T()(n,e);var t=A()(n);function n(e,r,i,a){var s;return o()(this,n),s=t.call(this,e,r,i,a),c()(b()(s),"demote",(function(e,t,n,r){return Uv(b()(s),e,t,hv.minus,n)})),c()(b()(s),"surround",(function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:5,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:500,r=arguments.length>4?arguments[4]:void 0,i=new Oc(f()(e),!0),a=(new Ga).setFromPoints(i.getPoints(t)),o=new ic({color:"#fff"}),u=new cc(a,o);return mv.scene.add(u),Ov(b()(s),i,n,r)})),s}return u()(n,[{key:"promote",value:function(e,t,n,r){return Uv(this,e,t,hv.plus,n)}}]),n}(mo),Fv=function(){function e(t){o()(this,e),c()(this,"opts",{}),c()(this,"pointer",new mr),c()(this,"scene",null),c()(this,"raycaster",null),c()(this,"ambientLight",null),c()(this,"camera",null),c()(this,"renderer",null),c()(this,"cssRenderer",null),c()(this,"controls",null),c()(this,"domElement",null),c()(this,"cutoutCamera",null),c()(this,"cutoutBackground",null),c()(this,"cutoutBackgroundAlpha",1),c()(this,"cutoutArea",{x:0,y:0,width:0,height:0}),this.opts=null!=t?t:{},this.scene=new dl,this.raycaster=new ip,mv.addScene(this.scene),this.defaultInit()}return u()(e,[{key:"defaultInit",value:function(){var e,t,n=this.initDefaultPerspectiveCamera();if(this.camera=n,mv.setCamera(n),this.scene.add(n),this.opts.css2DRenderer){var r=this.initCssRenderer();this.cssRenderer=r}if(this.opts.ambientLight){var i=this.initAmbientLight();this.ambientLight=i,this.scene.add(i)}null!==(e=this.opts.background)&&void 0!==e&&e.imgs&&this.initSkyBox(null===(t=this.opts.background)||void 0===t?void 0:t.imgs)}},{key:"resetScene",value:function(e,t){e.aspect=window.innerWidth/window.innerHeight,e.updateProjectionMatrix(),t.setSize(window.innerWidth,window.innerHeight),t.setPixelRatio(window.devicePixelRatio)}},{key:"initRenderer",value:function(){var e,t,n,r,i,a,o=this.opts.rendererOps||{},s=new sl({antialias:null===(e=o.antialias)||void 0===e||e,logarithmicDepthBuffer:null===(t=o.logarithmicDepthBuffer)||void 0===t||t,alpha:null!==(n=o.alpha)&&void 0!==n&&n});return this.cutMain(s),s.shadowMap.enabled=null===(r=o.shadowMap)||void 0===r||r,s.toneMapping=null!==(i=o.toneMapping)&&void 0!==i?i:Ae,s.toneMappingExposure=null!==(a=o.toneMappingExposure)&&void 0!==a?a:.3,s.setPixelRatio(window.devicePixelRatio),s}},{key:"cutMain",value:function(e){var t,n,r,i,a,o,s=this.opts.rendererOps||{},u=null!==(t=null===(n=s.size)||void 0===n?void 0:n.width)&&void 0!==t?t:window.innerWidth,l=null!==(r=null===(i=s.size)||void 0===i?void 0:i.height)&&void 0!==r?r:window.innerHeight;e.setClearColor((null===(a=this.opts.background)||void 0===a?void 0:a.color)||0,(null===(o=this.opts.background)||void 0===o?void 0:o.alpha)||1),e.setSize(u,l),e.setScissor(0,0,u,l),e.render(this.scene,this.camera)}},{key:"cutSub",value:function(e){var t,n,r,i=null!==(t=null===(n=(this.opts.rendererOps||{}).size)||void 0===n?void 0:n.width)&&void 0!==t?t:window.innerWidth;e.setClearColor(null!==(r=this.cutoutBackground)&&void 0!==r?r:0,this.cutoutBackgroundAlpha),e.setScissor(i-this.cutoutArea.width,0,this.cutoutArea.width,this.cutoutArea.height),e.setViewport(i-this.cutoutArea.width,0,this.cutoutArea.width,this.cutoutArea.height),e.render(this.scene,this.cutoutCamera)}},{key:"initCssRenderer",value:function(){var e,t,n,r,i=this.opts.rendererOps||{},a=null!==(e=null===(t=i.size)||void 0===t?void 0:t.width)&&void 0!==e?e:window.innerWidth,o=null!==(n=null===(r=i.size)||void 0===r?void 0:r.height)&&void 0!==n?n:window.innerHeight,s=new Iv("base");return s.setSize(a,o),s}},{key:"initSkyBox",value:function(e){var t=this;(new zd).load([e[0],e[1],e[2],e[3],e[4],e[5]],(function(e){t.scene.background=e}))}},{key:"initDefaultPerspectiveCamera",value:function(){var e=this.opts.defCameraOps||{},t=e.aspect||window.innerWidth/window.innerHeight,n=new Nv(e.fov||90,t,e.near||.1,e.far||5e3),r=e.position||new Yr(0,10,10);return n.position.set(r.x,r.y,r.z),n}},{key:"initAmbientLight",value:function(){var e=this.opts.defAmbientLightOps||{},t=e.position||new Yr(0,3,10),n=new af(e.color||16777215,e.intensity||1);return n.position.set(t.x,t.y,t.z),n}},{key:"startFrameAnimate",value:function(e){var t=this;if(!this.renderer||!this.scene||!this.camera)throw new Error("scene or camera or renderer is not init");e&&e(this.renderer),mv.frameCallbacks.size>0&&mv.frameCallbacks.forEach((function(e){e()})),Dv.update(),uv(),this.opts.cutout?this.updateRenderForCut():this.renderer.render(this.scene,this.camera),this.cssRenderer&&this.cssRenderer.render(this.scene,this.camera),this.controls&&this.controls.update(),requestAnimationFrame((function(){return t.startFrameAnimate(e)}))}},{key:"add",value:function(e){this.scene.add(e)}},{key:"updateRaycaster",value:function(){var e,t=this.opts.defRaycasterOps||{};this.raycaster.setFromCamera(this.pointer,this.camera);var n=this.scene.children.filter((function(e){return e instanceof yv}));this.raycaster.intersectObjects(n,null!==(e=t.recursive)&&void 0!==e&&e)}},{key:"getPointerPosition",value:function(e){var t=this.domElement;this.pointer.setX((e.clientX-t.getBoundingClientRect().left)/t.getBoundingClientRect().width*2-1),this.pointer.setY(-(e.clientY-t.getBoundingClientRect().top)/t.getBoundingClientRect().height*2+1)}},{key:"onPointerPointerup",value:function(e){mv.setTriggerClickState(!1);var t=mv.transformControls;t.length>0&&t.forEach((function(e){e.detach()})),this.getPointerPosition(e),this.updateRaycaster()}},{key:"onPointerDown",value:function(e){mv.setTriggerClickState(!0),this.getPointerPosition(e),this.updateRaycaster()}},{key:"onPointerMove",value:function(e){this.getPointerPosition(e),this.updateRaycaster()}},{key:"onPointerLeave",value:function(e){this.getPointerPosition(e),this.updateRaycaster()}},{key:"registerEvent",value:function(e){var t=this;e.addEventListener("pointerup",(function(e){return t.onPointerPointerup(e)})),e.addEventListener("pointerdown",(function(e){return t.onPointerDown(e)})),e.addEventListener("pointermove",(function(e){return t.onPointerMove(e)})),e.addEventListener("pointerleave",(function(e){return t.onPointerLeave(e)}))}},{key:"render",value:function(e){var t=this;fv.emit("before-render");var n=this.initRenderer();this.renderer=n;var r=null,i=this.renderer.domElement;this.domElement=i,this.cssRenderer&&(r=this.cssRenderer.cssRenderer.domElement,e.appendChild(r),r.style.position="absolute",r.style.top="0"),this.opts.orbitControls&&(this.controls=new Qp(this.camera,r||i),mv.setOrbitControls(this.controls)),mv.setDomElement(r||i),e.appendChild(i),this.registerEvent(r||i),e.addEventListener("resize",(function(){return t.resetScene(t.camera,t.renderer)})),fv.emit("after-render")}},{key:"updateRenderForCut",value:function(){this.renderer.setScissorTest(!0),this.cutMain(this.renderer),this.cutSub(this.renderer)}},{key:"destroy",value:function(){var e=this;window.removeEventListener("resize",(function(){return e.resetScene(e.camera,e.renderer)}))}}]),e}(),Bv=Fv,zv=function(e){T()(n,e);var t=A()(n);function n(){var e;return o()(this,n),e=t.call(this),c()(b()(e),"natureEventMap",new Map),c()(b()(e),"object3d",[]),mv.addCatch(b()(e)),e}return u()(n,[{key:"addModel",value:function(e){_()(M()(n.prototype),"add",this).call(this,e),this.object3d.push(e)}},{key:"addNatureEventListener",value:function(e,t){this.natureEventMap.has(e)||this.natureEventMap.set(e,[]),this.natureEventMap.get(e).push(t)}},{key:"removeNatureEventListener",value:function(e,t){if(this.natureEventMap.has(e)){var n=this.natureEventMap.get(e),r=n.findIndex((function(e){return e===t}));r>-1&&n.splice(r,1)}}},{key:"removeAllNatureEventListener",value:function(){this.natureEventMap.clear()}},{key:"handleClick",value:function(e){mv.triggerClick&&e.forEach((function(e){}))}},{key:"handlePointerMove",value:function(e){e.forEach((function(e){}))}},{key:"handlePointerleave",value:function(){var e=this.natureEventMap.get("pointerleave");e&&e.length>0&&e.forEach((function(e){}))}},{key:"raycastGroup",value:function(e){console.log("raycastGroup",e)}}]),n}($u),Hv=zv,Gv=new WeakMap,Vv=function(e){w(n,e);var t=E(n);function n(e){var r;return a(this,n),(r=t.call(this,e)).decoderPath="",r.decoderConfig={},r.decoderBinary=null,r.decoderPending=null,r.workerLimit=4,r.workerPool=[],r.workerNextTaskID=1,r.workerSourceURL="",r.defaultAttributeIDs={position:"POSITION",normal:"NORMAL",color:"COLOR",uv:"TEX_COORD"},r.defaultAttributeTypes={position:"Float32Array",normal:"Float32Array",color:"Float32Array",uv:"Float32Array"},r}return s(n,[{key:"setDecoderPath",value:function(e){return this.decoderPath=e,this}},{key:"setDecoderConfig",value:function(e){return this.decoderConfig=e,this}},{key:"setWorkerLimit",value:function(e){return this.workerLimit=e,this}},{key:"load",value:function(e,t,n,r){var i=this,a=new Od(this.manager);a.setPath(this.path),a.setResponseType("arraybuffer"),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(e,(function(e){i.parse(e,t,r)}),n,r)}},{key:"parse",value:function(e,t,n){this.decodeDracoFile(e,t,null,null,pn).catch(n)}},{key:"decodeDracoFile",value:function(e,t,n,r){var i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:vn,a={attributeIDs:n||this.defaultAttributeIDs,attributeTypes:r||this.defaultAttributeTypes,useUniqueIDs:!!n,vertexColorSpace:i};return this.decodeGeometry(e,a).then(t)}},{key:"decodeGeometry",value:function(e,t){var n,r=this,i=JSON.stringify(t);if(Gv.has(e)){var a=Gv.get(e);if(a.key===i)return a.promise;if(0===e.byteLength)throw new Error("THREE.DRACOLoader: Unable to re-decode a buffer with different settings. Buffer has already been transferred.")}var o=this.workerNextTaskID++,s=e.byteLength,u=this._getWorker(o,s).then((function(r){return n=r,new Promise((function(r,i){n._callbacks[o]={resolve:r,reject:i},n.postMessage({type:"decode",id:o,taskConfig:t,buffer:e},[e])}))})).then((function(e){return r._createGeometry(e.geometry)}));return u.catch((function(){return!0})).then((function(){n&&o&&r._releaseTask(n,o)})),Gv.set(e,{key:i,promise:u}),u}},{key:"_createGeometry",value:function(e){var t=new Ga;e.index&&t.setIndex(new wa(e.index.array,1));for(var n=0;n<e.attributes.length;n++){var r=e.attributes[n],i=r.name,a=r.array,o=r.itemSize,s=new wa(a,o);"color"===i&&(this._assignVertexColorSpace(s,r.vertexColorSpace),s.normalized=a instanceof Float32Array==!1),t.setAttribute(i,s)}return t}},{key:"_assignVertexColorSpace",value:function(e,t){if(t===pn)for(var n=new pa,r=0,i=e.count;r<i;r++)n.fromBufferAttribute(e,r).convertSRGBToLinear(),e.setXYZ(r,n.r,n.g,n.b)}},{key:"_loadLibrary",value:function(e,t){var n=new Od(this.manager);return n.setPath(this.decoderPath),n.setResponseType(t),n.setWithCredentials(this.withCredentials),new Promise((function(t,r){n.load(e,t,void 0,r)}))}},{key:"preload",value:function(){return this._initDecoder(),this}},{key:"_initDecoder",value:function(){var e=this;if(this.decoderPending)return this.decoderPending;var t="object"!==("undefined"==typeof WebAssembly?"undefined":$p(WebAssembly))||"js"===this.decoderConfig.type,n=[];return t?n.push(this._loadLibrary("draco_decoder.js","text")):(n.push(this._loadLibrary("draco_wasm_wrapper.js","text")),n.push(this._loadLibrary("draco_decoder.wasm","arraybuffer"))),this.decoderPending=Promise.all(n).then((function(n){var r=n[0];t||(e.decoderConfig.wasmBinary=n[1]);var i=Wv.toString(),a=["/* draco decoder */",r,"","/* worker */",i.substring(i.indexOf("{")+1,i.lastIndexOf("}"))].join("\n");e.workerSourceURL=URL.createObjectURL(new Blob([a]))})),this.decoderPending}},{key:"_getWorker",value:function(e,t){var n=this;return this._initDecoder().then((function(){if(n.workerPool.length<n.workerLimit){var r=new Worker(n.workerSourceURL);r._callbacks={},r._taskCosts={},r._taskLoad=0,r.postMessage({type:"init",decoderConfig:n.decoderConfig}),r.onmessage=function(e){var t=e.data;switch(t.type){case"decode":r._callbacks[t.id].resolve(t);break;case"error":r._callbacks[t.id].reject(t);break;default:console.error('THREE.DRACOLoader: Unexpected message, "'+t.type+'"')}},n.workerPool.push(r)}else n.workerPool.sort((function(e,t){return e._taskLoad>t._taskLoad?-1:1}));var i=n.workerPool[n.workerPool.length-1];return i._taskCosts[e]=t,i._taskLoad+=t,i}))}},{key:"_releaseTask",value:function(e,t){e._taskLoad-=e._taskCosts[t],delete e._callbacks[t],delete e._taskCosts[t]}},{key:"debug",value:function(){console.log("Task load: ",this.workerPool.map((function(e){return e._taskLoad})))}},{key:"dispose",value:function(){for(var e=0;e<this.workerPool.length;++e)this.workerPool[e].terminate();return this.workerPool.length=0,""!==this.workerSourceURL&&URL.revokeObjectURL(this.workerSourceURL),this}}]),n}(Pd);function Wv(){var e,t;function n(e,t,n,r,i,a){var o=a.num_components(),s=n.num_points()*o,u=s*i.BYTES_PER_ELEMENT,l=function(e,t){switch(t){case Float32Array:return e.DT_FLOAT32;case Int8Array:return e.DT_INT8;case Int16Array:return e.DT_INT16;case Int32Array:return e.DT_INT32;case Uint8Array:return e.DT_UINT8;case Uint16Array:return e.DT_UINT16;case Uint32Array:return e.DT_UINT32}}(e,i),c=e._malloc(u);t.GetAttributeDataArrayForAllPoints(n,a,l,u,c);var h=new i(e.HEAPF32.buffer,c,s).slice();return e._free(c),{name:r,array:h,itemSize:o}}onmessage=function(r){var i=r.data;switch(i.type){case"init":e=i.decoderConfig,t=new Promise((function(t){e.onModuleLoaded=function(e){t({draco:e})},DracoDecoderModule(e)}));break;case"decode":var a=i.buffer,o=i.taskConfig;t.then((function(e){var t=e.draco,r=new t.Decoder;try{var s=function(e,t,r,i){var a,o,s=i.attributeIDs,u=i.attributeTypes,l=t.GetEncodedGeometryType(r);if(l===e.TRIANGULAR_MESH)a=new e.Mesh,o=t.DecodeArrayToMesh(r,r.byteLength,a);else{if(l!==e.POINT_CLOUD)throw new Error("THREE.DRACOLoader: Unexpected geometry type.");a=new e.PointCloud,o=t.DecodeArrayToPointCloud(r,r.byteLength,a)}if(!o.ok()||0===a.ptr)throw new Error("THREE.DRACOLoader: Decoding failed: "+o.error_msg());var c={index:null,attributes:[]};for(var h in s){var d=self[u[h]],f=void 0,p=void 0;if(i.useUniqueIDs)p=s[h],f=t.GetAttributeByUniqueId(a,p);else{if(-1===(p=t.GetAttributeId(a,e[s[h]])))continue;f=t.GetAttribute(a,p)}var v=n(e,t,a,h,d,f);"color"===h&&(v.vertexColorSpace=i.vertexColorSpace),c.attributes.push(v)}l===e.TRIANGULAR_MESH&&(c.index=function(e,t,n){var r=n.num_faces(),i=3*r,a=4*i,o=e._malloc(a);t.GetTrianglesUInt32Array(n,a,o);var s=new Uint32Array(e.HEAPF32.buffer,o,i).slice();return e._free(o),{array:s,itemSize:1}}(e,t,a));return e.destroy(a),c}(t,r,new Int8Array(a),o),u=s.attributes.map((function(e){return e.array.buffer}));s.index&&u.push(s.index.array.buffer),self.postMessage({type:"decode",id:i.id,geometry:s},u)}catch(e){console.error(e),self.postMessage({type:"error",id:i.id,error:e.message})}finally{t.destroy(r)}}))}}}function jv(e,t){if(t===rn)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),e;if(t===on||t===an){var n=e.getIndex();if(null===n){var r=[],i=e.getAttribute("position");if(void 0===i)return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),e;for(var a=0;a<i.count;a++)r.push(a);e.setIndex(r),n=e.getIndex()}var o=n.count-2,s=[];if(t===on)for(var u=1;u<=o;u++)s.push(n.getX(0)),s.push(n.getX(u)),s.push(n.getX(u+1));else for(var l=0;l<o;l++)l%2==0?(s.push(n.getX(l)),s.push(n.getX(l+1)),s.push(n.getX(l+2))):(s.push(n.getX(l+2)),s.push(n.getX(l+1)),s.push(n.getX(l)));s.length/3!==o&&console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");var c=e.clone();return c.setIndex(s),c.clearGroups(),c}return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:",t),e}var Xv=function(e){w(n,e);var t=E(n);function n(e){var r;return a(this,n),(r=t.call(this,e)).dracoLoader=null,r.ktx2Loader=null,r.meshoptDecoder=null,r.pluginCallbacks=[],r.register((function(e){return new Qv(e)})),r.register((function(e){return new om(e)})),r.register((function(e){return new sm(e)})),r.register((function(e){return new um(e)})),r.register((function(e){return new em(e)})),r.register((function(e){return new tm(e)})),r.register((function(e){return new nm(e)})),r.register((function(e){return new rm(e)})),r.register((function(e){return new Jv(e)})),r.register((function(e){return new im(e)})),r.register((function(e){return new $v(e)})),r.register((function(e){return new am(e)})),r.register((function(e){return new Zv(e)})),r.register((function(e){return new lm(e)})),r.register((function(e){return new cm(e)})),r}return s(n,[{key:"load",value:function(e,t,n,r){var i,a=this;i=""!==this.resourcePath?this.resourcePath:""!==this.path?this.path:cf.extractUrlBase(e),this.manager.itemStart(e);var o=function(t){r?r(t):console.error(t),a.manager.itemError(e),a.manager.itemEnd(e)},s=new Od(this.manager);s.setPath(this.path),s.setResponseType("arraybuffer"),s.setRequestHeader(this.requestHeader),s.setWithCredentials(this.withCredentials),s.load(e,(function(n){try{a.parse(n,i,(function(n){t(n),a.manager.itemEnd(e)}),o)}catch(e){o(e)}}),n,o)}},{key:"setDRACOLoader",value:function(e){return this.dracoLoader=e,this}},{key:"setDDSLoader",value:function(){throw new Error('THREE.GLTFLoader: "MSFT_texture_dds" no longer supported. Please update to "KHR_texture_basisu".')}},{key:"setKTX2Loader",value:function(e){return this.ktx2Loader=e,this}},{key:"setMeshoptDecoder",value:function(e){return this.meshoptDecoder=e,this}},{key:"register",value:function(e){return-1===this.pluginCallbacks.indexOf(e)&&this.pluginCallbacks.push(e),this}},{key:"unregister",value:function(e){return-1!==this.pluginCallbacks.indexOf(e)&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(e),1),this}},{key:"parse",value:function(e,t,n,r){var i,a={},o={},s=new TextDecoder;if("string"==typeof e)i=JSON.parse(e);else if(e instanceof ArrayBuffer){if(s.decode(new Uint8Array(e,0,4))===hm){try{a[Yv.KHR_BINARY_GLTF]=new pm(e)}catch(e){return void(r&&r(e))}i=JSON.parse(a[Yv.KHR_BINARY_GLTF].content)}else i=JSON.parse(s.decode(e))}else i=e;if(void 0===i.asset||i.asset.version[0]<2)r&&r(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));else{var u=new Bm(i,{path:t||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});u.fileLoader.setRequestHeader(this.requestHeader);for(var l=0;l<this.pluginCallbacks.length;l++){var c=this.pluginCallbacks[l](u);o[c.name]=c,a[c.name]=!0}if(i.extensionsUsed)for(var h=0;h<i.extensionsUsed.length;++h){var d=i.extensionsUsed[h],f=i.extensionsRequired||[];switch(d){case Yv.KHR_MATERIALS_UNLIT:a[d]=new Kv;break;case Yv.KHR_DRACO_MESH_COMPRESSION:a[d]=new vm(i,this.dracoLoader);break;case Yv.KHR_TEXTURE_TRANSFORM:a[d]=new mm;break;case Yv.KHR_MESH_QUANTIZATION:a[d]=new gm;break;default:f.indexOf(d)>=0&&void 0===o[d]&&console.warn('THREE.GLTFLoader: Unknown extension "'+d+'".')}}u.setExtensions(a),u.setPlugins(o),u.parse(n,r)}}},{key:"parseAsync",value:function(e,t){var n=this;return new Promise((function(r,i){n.parse(e,t,r,i)}))}}]),n}(Pd);function qv(){var e={};return{get:function(t){return e[t]},add:function(t,n){e[t]=n},remove:function(t){delete e[t]},removeAll:function(){e={}}}}var Yv={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS_PUNCTUAL:"KHR_lights_punctual",KHR_MATERIALS_CLEARCOAT:"KHR_materials_clearcoat",KHR_MATERIALS_IOR:"KHR_materials_ior",KHR_MATERIALS_SHEEN:"KHR_materials_sheen",KHR_MATERIALS_SPECULAR:"KHR_materials_specular",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",KHR_MATERIALS_IRIDESCENCE:"KHR_materials_iridescence",KHR_MATERIALS_ANISOTROPY:"KHR_materials_anisotropy",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_MATERIALS_VOLUME:"KHR_materials_volume",KHR_TEXTURE_BASISU:"KHR_texture_basisu",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",KHR_MATERIALS_EMISSIVE_STRENGTH:"KHR_materials_emissive_strength",EXT_TEXTURE_WEBP:"EXT_texture_webp",EXT_TEXTURE_AVIF:"EXT_texture_avif",EXT_MESHOPT_COMPRESSION:"EXT_meshopt_compression",EXT_MESH_GPU_INSTANCING:"EXT_mesh_gpu_instancing"},Zv=function(){function e(t){a(this,e),this.parser=t,this.name=Yv.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}return s(e,[{key:"_markDefs",value:function(){for(var e=this.parser,t=this.parser.json.nodes||[],n=0,r=t.length;n<r;n++){var i=t[n];i.extensions&&i.extensions[this.name]&&void 0!==i.extensions[this.name].light&&e._addNodeRef(this.cache,i.extensions[this.name].light)}}},{key:"_loadLight",value:function(e){var t=this.parser,n="light:"+e,r=t.cache.get(n);if(r)return r;var i,a=t.json,o=((a.extensions&&a.extensions[this.name]||{}).lights||[])[e],s=new pa(16777215);void 0!==o.color&&s.fromArray(o.color);var u=void 0!==o.range?o.range:0;switch(o.type){case"directional":(i=new rf(s)).target.position.set(0,0,-1),i.add(i.target);break;case"point":(i=new tf(s)).distance=u;break;case"spot":(i=new Kd(s)).distance=u,o.spot=o.spot||{},o.spot.innerConeAngle=void 0!==o.spot.innerConeAngle?o.spot.innerConeAngle:0,o.spot.outerConeAngle=void 0!==o.spot.outerConeAngle?o.spot.outerConeAngle:Math.PI/4,i.angle=o.spot.outerConeAngle,i.penumbra=1-o.spot.innerConeAngle/o.spot.outerConeAngle,i.target.position.set(0,0,-1),i.add(i.target);break;default:throw new Error("THREE.GLTFLoader: Unexpected light type: "+o.type)}return i.position.set(0,0,0),i.decay=2,Im(i,o),void 0!==o.intensity&&(i.intensity=o.intensity),i.name=t.createUniqueName(o.name||"light_"+e),r=Promise.resolve(i),t.cache.add(n,r),r}},{key:"getDependency",value:function(e,t){if("light"===e)return this._loadLight(t)}},{key:"createNodeAttachment",value:function(e){var t=this,n=this.parser,r=n.json.nodes[e],i=(r.extensions&&r.extensions[this.name]||{}).light;return void 0===i?null:this._loadLight(i).then((function(e){return n._getNodeRef(t.cache,i,e)}))}}]),e}(),Kv=function(){function e(){a(this,e),this.name=Yv.KHR_MATERIALS_UNLIT}return s(e,[{key:"getMaterialType",value:function(){return ma}},{key:"extendParams",value:function(e,t,n){var r=[];e.color=new pa(1,1,1),e.opacity=1;var i=t.pbrMetallicRoughness;if(i){if(Array.isArray(i.baseColorFactor)){var a=i.baseColorFactor;e.color.fromArray(a),e.opacity=a[3]}void 0!==i.baseColorTexture&&r.push(n.assignTexture(e,"map",i.baseColorTexture,pn))}return Promise.all(r)}}]),e}(),Jv=function(){function e(t){a(this,e),this.parser=t,this.name=Yv.KHR_MATERIALS_EMISSIVE_STRENGTH}return s(e,[{key:"extendMaterialParams",value:function(e,t){var n=this.parser.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();var r=n.extensions[this.name].emissiveStrength;return void 0!==r&&(t.emissiveIntensity=r),Promise.resolve()}}]),e}(),Qv=function(){function e(t){a(this,e),this.parser=t,this.name=Yv.KHR_MATERIALS_CLEARCOAT}return s(e,[{key:"getMaterialType",value:function(e){var t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?td:null}},{key:"extendMaterialParams",value:function(e,t){var n=this.parser,r=n.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();var i=[],a=r.extensions[this.name];if(void 0!==a.clearcoatFactor&&(t.clearcoat=a.clearcoatFactor),void 0!==a.clearcoatTexture&&i.push(n.assignTexture(t,"clearcoatMap",a.clearcoatTexture)),void 0!==a.clearcoatRoughnessFactor&&(t.clearcoatRoughness=a.clearcoatRoughnessFactor),void 0!==a.clearcoatRoughnessTexture&&i.push(n.assignTexture(t,"clearcoatRoughnessMap",a.clearcoatRoughnessTexture)),void 0!==a.clearcoatNormalTexture&&(i.push(n.assignTexture(t,"clearcoatNormalMap",a.clearcoatNormalTexture)),void 0!==a.clearcoatNormalTexture.scale)){var o=a.clearcoatNormalTexture.scale;t.clearcoatNormalScale=new mr(o,o)}return Promise.all(i)}}]),e}(),$v=function(){function e(t){a(this,e),this.parser=t,this.name=Yv.KHR_MATERIALS_IRIDESCENCE}return s(e,[{key:"getMaterialType",value:function(e){var t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?td:null}},{key:"extendMaterialParams",value:function(e,t){var n=this.parser,r=n.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();var i=[],a=r.extensions[this.name];return void 0!==a.iridescenceFactor&&(t.iridescence=a.iridescenceFactor),void 0!==a.iridescenceTexture&&i.push(n.assignTexture(t,"iridescenceMap",a.iridescenceTexture)),void 0!==a.iridescenceIor&&(t.iridescenceIOR=a.iridescenceIor),void 0===t.iridescenceThicknessRange&&(t.iridescenceThicknessRange=[100,400]),void 0!==a.iridescenceThicknessMinimum&&(t.iridescenceThicknessRange[0]=a.iridescenceThicknessMinimum),void 0!==a.iridescenceThicknessMaximum&&(t.iridescenceThicknessRange[1]=a.iridescenceThicknessMaximum),void 0!==a.iridescenceThicknessTexture&&i.push(n.assignTexture(t,"iridescenceThicknessMap",a.iridescenceThicknessTexture)),Promise.all(i)}}]),e}(),em=function(){function e(t){a(this,e),this.parser=t,this.name=Yv.KHR_MATERIALS_SHEEN}return s(e,[{key:"getMaterialType",value:function(e){var t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?td:null}},{key:"extendMaterialParams",value:function(e,t){var n=this.parser,r=n.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();var i=[];t.sheenColor=new pa(0,0,0),t.sheenRoughness=0,t.sheen=1;var a=r.extensions[this.name];return void 0!==a.sheenColorFactor&&t.sheenColor.fromArray(a.sheenColorFactor),void 0!==a.sheenRoughnessFactor&&(t.sheenRoughness=a.sheenRoughnessFactor),void 0!==a.sheenColorTexture&&i.push(n.assignTexture(t,"sheenColorMap",a.sheenColorTexture,pn)),void 0!==a.sheenRoughnessTexture&&i.push(n.assignTexture(t,"sheenRoughnessMap",a.sheenRoughnessTexture)),Promise.all(i)}}]),e}(),tm=function(){function e(t){a(this,e),this.parser=t,this.name=Yv.KHR_MATERIALS_TRANSMISSION}return s(e,[{key:"getMaterialType",value:function(e){var t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?td:null}},{key:"extendMaterialParams",value:function(e,t){var n=this.parser,r=n.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();var i=[],a=r.extensions[this.name];return void 0!==a.transmissionFactor&&(t.transmission=a.transmissionFactor),void 0!==a.transmissionTexture&&i.push(n.assignTexture(t,"transmissionMap",a.transmissionTexture)),Promise.all(i)}}]),e}(),nm=function(){function e(t){a(this,e),this.parser=t,this.name=Yv.KHR_MATERIALS_VOLUME}return s(e,[{key:"getMaterialType",value:function(e){var t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?td:null}},{key:"extendMaterialParams",value:function(e,t){var n=this.parser,r=n.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();var i=[],a=r.extensions[this.name];t.thickness=void 0!==a.thicknessFactor?a.thicknessFactor:0,void 0!==a.thicknessTexture&&i.push(n.assignTexture(t,"thicknessMap",a.thicknessTexture)),t.attenuationDistance=a.attenuationDistance||1/0;var o=a.attenuationColor||[1,1,1];return t.attenuationColor=new pa(o[0],o[1],o[2]),Promise.all(i)}}]),e}(),rm=function(){function e(t){a(this,e),this.parser=t,this.name=Yv.KHR_MATERIALS_IOR}return s(e,[{key:"getMaterialType",value:function(e){var t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?td:null}},{key:"extendMaterialParams",value:function(e,t){var n=this.parser.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();var r=n.extensions[this.name];return t.ior=void 0!==r.ior?r.ior:1.5,Promise.resolve()}}]),e}(),im=function(){function e(t){a(this,e),this.parser=t,this.name=Yv.KHR_MATERIALS_SPECULAR}return s(e,[{key:"getMaterialType",value:function(e){var t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?td:null}},{key:"extendMaterialParams",value:function(e,t){var n=this.parser,r=n.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();var i=[],a=r.extensions[this.name];t.specularIntensity=void 0!==a.specularFactor?a.specularFactor:1,void 0!==a.specularTexture&&i.push(n.assignTexture(t,"specularIntensityMap",a.specularTexture));var o=a.specularColorFactor||[1,1,1];return t.specularColor=new pa(o[0],o[1],o[2]),void 0!==a.specularColorTexture&&i.push(n.assignTexture(t,"specularColorMap",a.specularColorTexture,pn)),Promise.all(i)}}]),e}(),am=function(){function e(t){a(this,e),this.parser=t,this.name=Yv.KHR_MATERIALS_ANISOTROPY}return s(e,[{key:"getMaterialType",value:function(e){var t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?td:null}},{key:"extendMaterialParams",value:function(e,t){var n=this.parser,r=n.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();var i=[],a=r.extensions[this.name];return void 0!==a.anisotropyStrength&&(t.anisotropy=a.anisotropyStrength),void 0!==a.anisotropyRotation&&(t.anisotropyRotation=a.anisotropyRotation),void 0!==a.anisotropyTexture&&i.push(n.assignTexture(t,"anisotropyMap",a.anisotropyTexture)),Promise.all(i)}}]),e}(),om=function(){function e(t){a(this,e),this.parser=t,this.name=Yv.KHR_TEXTURE_BASISU}return s(e,[{key:"loadTexture",value:function(e){var t=this.parser,n=t.json,r=n.textures[e];if(!r.extensions||!r.extensions[this.name])return null;var i=r.extensions[this.name],a=t.options.ktx2Loader;if(!a){if(n.extensionsRequired&&n.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}return t.loadTextureImage(e,i.source,a)}}]),e}(),sm=function(){function e(t){a(this,e),this.parser=t,this.name=Yv.EXT_TEXTURE_WEBP,this.isSupported=null}return s(e,[{key:"loadTexture",value:function(e){var t=this.name,n=this.parser,r=n.json,i=r.textures[e];if(!i.extensions||!i.extensions[t])return null;var a=i.extensions[t],o=r.images[a.source],s=n.textureLoader;if(o.uri){var u=n.options.manager.getHandler(o.uri);null!==u&&(s=u)}return this.detectSupport().then((function(i){if(i)return n.loadTextureImage(e,a.source,s);if(r.extensionsRequired&&r.extensionsRequired.indexOf(t)>=0)throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported.");return n.loadTexture(e)}))}},{key:"detectSupport",value:function(){return this.isSupported||(this.isSupported=new Promise((function(e){var t=new Image;t.src="data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA",t.onload=t.onerror=function(){e(1===t.height)}}))),this.isSupported}}]),e}(),um=function(){function e(t){a(this,e),this.parser=t,this.name=Yv.EXT_TEXTURE_AVIF,this.isSupported=null}return s(e,[{key:"loadTexture",value:function(e){var t=this.name,n=this.parser,r=n.json,i=r.textures[e];if(!i.extensions||!i.extensions[t])return null;var a=i.extensions[t],o=r.images[a.source],s=n.textureLoader;if(o.uri){var u=n.options.manager.getHandler(o.uri);null!==u&&(s=u)}return this.detectSupport().then((function(i){if(i)return n.loadTextureImage(e,a.source,s);if(r.extensionsRequired&&r.extensionsRequired.indexOf(t)>=0)throw new Error("THREE.GLTFLoader: AVIF required by asset but unsupported.");return n.loadTexture(e)}))}},{key:"detectSupport",value:function(){return this.isSupported||(this.isSupported=new Promise((function(e){var t=new Image;t.src="data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAABcAAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAEAAAABAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQAMAAAAABNjb2xybmNseAACAAIABoAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAAB9tZGF0EgAKCBgABogQEDQgMgkQAAAAB8dSLfI=",t.onload=t.onerror=function(){e(1===t.height)}}))),this.isSupported}}]),e}(),lm=function(){function e(t){a(this,e),this.name=Yv.EXT_MESHOPT_COMPRESSION,this.parser=t}return s(e,[{key:"loadBufferView",value:function(e){var t=this.parser.json,n=t.bufferViews[e];if(n.extensions&&n.extensions[this.name]){var r=n.extensions[this.name],i=this.parser.getDependency("buffer",r.buffer),a=this.parser.options.meshoptDecoder;if(!a||!a.supported){if(t.extensionsRequired&&t.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return null}return i.then((function(e){var t=r.byteOffset||0,n=r.byteLength||0,i=r.count,o=r.byteStride,s=new Uint8Array(e,t,n);return a.decodeGltfBufferAsync?a.decodeGltfBufferAsync(i,o,s,r.mode,r.filter).then((function(e){return e.buffer})):a.ready.then((function(){var e=new ArrayBuffer(i*o);return a.decodeGltfBuffer(new Uint8Array(e),i,o,s,r.mode,r.filter),e}))}))}return null}}]),e}(),cm=function(){function e(t){a(this,e),this.name=Yv.EXT_MESH_GPU_INSTANCING,this.parser=t}return s(e,[{key:"createNodeMesh",value:function(e){var t=this,n=this.parser.json,r=n.nodes[e];if(!r.extensions||!r.extensions[this.name]||void 0===r.mesh)return null;var i,a=n.meshes[r.mesh],o=v(a.primitives);try{for(o.s();!(i=o.n()).done;){var s=i.value;if(s.mode!==Mm.TRIANGLES&&s.mode!==Mm.TRIANGLE_STRIP&&s.mode!==Mm.TRIANGLE_FAN&&void 0!==s.mode)return null}}catch(e){o.e(e)}finally{o.f()}var u=r.extensions[this.name].attributes,l=[],c={},h=function(e){l.push(t.parser.getDependency("accessor",u[e]).then((function(t){return c[e]=t,c[e]})))};for(var d in u)h(d);return l.length<1?null:(l.push(this.parser.createNodeMesh(e)),Promise.all(l).then((function(e){var n,r=e.pop(),i=r.isGroup?r.children:[r],a=e[0].count,o=[],s=v(i);try{for(s.s();!(n=s.n()).done;){for(var u=n.value,l=new wi,h=new Yr,d=new qr,f=new Yr(1,1,1),p=new rc(u.geometry,u.material,a),m=0;m<a;m++)c.TRANSLATION&&h.fromBufferAttribute(c.TRANSLATION,m),c.ROTATION&&d.fromBufferAttribute(c.ROTATION,m),c.SCALE&&f.fromBufferAttribute(c.SCALE,m),p.setMatrixAt(m,l.compose(h,d,f));for(var g in c)"TRANSLATION"!==g&&"ROTATION"!==g&&"SCALE"!==g&&u.geometry.setAttribute(g,c[g]);Zi.prototype.copy.call(p,u),t.parser.assignFinalMaterial(p),o.push(p)}}catch(e){s.e(e)}finally{s.f()}return r.isGroup?(r.clear(),r.add.apply(r,o),r):o[0]})))}}]),e}(),hm="glTF",dm=1313821514,fm=5130562,pm=s((function e(t){a(this,e),this.name=Yv.KHR_BINARY_GLTF,this.content=null,this.body=null;var n=new DataView(t,0,12),r=new TextDecoder;if(this.header={magic:r.decode(new Uint8Array(t.slice(0,4))),version:n.getUint32(4,!0),length:n.getUint32(8,!0)},this.header.magic!==hm)throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");if(this.header.version<2)throw new Error("THREE.GLTFLoader: Legacy binary file detected.");for(var i=this.header.length-12,o=new DataView(t,12),s=0;s<i;){var u=o.getUint32(s,!0);s+=4;var l=o.getUint32(s,!0);if(s+=4,l===dm){var c=new Uint8Array(t,12+s,u);this.content=r.decode(c)}else if(l===fm){var h=12+s;this.body=t.slice(h,h+u)}s+=u}if(null===this.content)throw new Error("THREE.GLTFLoader: JSON content not found.")})),vm=function(){function e(t,n){if(a(this,e),!n)throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=Yv.KHR_DRACO_MESH_COMPRESSION,this.json=t,this.dracoLoader=n,this.dracoLoader.preload()}return s(e,[{key:"decodePrimitive",value:function(e,t){var n=this.json,r=this.dracoLoader,i=e.extensions[this.name].bufferView,a=e.extensions[this.name].attributes,o={},s={},u={};for(var l in a){var c=Em[l]||l.toLowerCase();o[c]=a[l]}for(var h in e.attributes){var d=Em[h]||h.toLowerCase();if(void 0!==a[h]){var f=n.accessors[e.attributes[h]],p=Sm[f.componentType];u[d]=p.name,s[d]=!0===f.normalized}}return t.getDependency("bufferView",i).then((function(e){return new Promise((function(t){r.decodeDracoFile(e,(function(e){for(var n in e.attributes){var r=e.attributes[n],i=s[n];void 0!==i&&(r.normalized=i)}t(e)}),o,u)}))}))}}]),e}(),mm=function(){function e(){a(this,e),this.name=Yv.KHR_TEXTURE_TRANSFORM}return s(e,[{key:"extendTexture",value:function(e,t){return void 0!==t.texCoord&&t.texCoord!==e.channel||void 0!==t.offset||void 0!==t.rotation||void 0!==t.scale?(e=e.clone(),void 0!==t.texCoord&&(e.channel=t.texCoord),void 0!==t.offset&&e.offset.fromArray(t.offset),void 0!==t.rotation&&(e.rotation=t.rotation),void 0!==t.scale&&e.repeat.fromArray(t.scale),e.needsUpdate=!0,e):e}}]),e}(),gm=s((function e(){a(this,e),this.name=Yv.KHR_MESH_QUANTIZATION})),ym=function(e){w(n,e);var t=E(n);function n(e,r,i,o){return a(this,n),t.call(this,e,r,i,o)}return s(n,[{key:"copySampleValue_",value:function(e){for(var t=this.resultBuffer,n=this.sampleValues,r=this.valueSize,i=e*r*3+r,a=0;a!==r;a++)t[a]=n[i+a];return t}},{key:"interpolate_",value:function(e,t,n,r){for(var i=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=2*o,u=3*o,l=r-t,c=(n-t)/l,h=c*c,d=h*c,f=e*u,p=f-u,v=-2*d+3*h,m=d-h,g=1-v,y=m-h+c,_=0;_!==o;_++){var x=a[p+_+o],M=a[p+_+s]*l,S=a[f+_+o],b=a[f+_]*l;i[_]=g*x+y*M+v*S+m*b}return i}}]),n}(vd),_m=new qr,xm=function(e){w(n,e);var t=E(n);function n(){return a(this,n),t.apply(this,arguments)}return s(n,[{key:"interpolate_",value:function(e,t,r,i){var a=y(x(n.prototype),"interpolate_",this).call(this,e,t,r,i);return _m.fromArray(a).normalize().toArray(a),a}}]),n}(ym),Mm={FLOAT:5126,FLOAT_MAT3:35675,FLOAT_MAT4:35676,FLOAT_VEC2:35664,FLOAT_VEC3:35665,FLOAT_VEC4:35666,LINEAR:9729,REPEAT:10497,SAMPLER_2D:35678,POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6,UNSIGNED_BYTE:5121,UNSIGNED_SHORT:5123},Sm={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},bm={9728:Fe,9729:Ve,9984:Be,9985:We,9986:He,9987:Xe},wm={33071:Oe,33648:Ne,10497:Ue},Tm={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},Em={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",TEXCOORD_0:"uv",TEXCOORD_1:"uv1",TEXCOORD_2:"uv2",TEXCOORD_3:"uv3",COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},Am={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},Rm={CUBICSPLINE:void 0,LINEAR:Kt,STEP:Zt},km="OPAQUE",Cm="MASK",Lm="BLEND";function Pm(e,t,n){for(var r in n.extensions)void 0===e[r]&&(t.userData.gltfExtensions=t.userData.gltfExtensions||{},t.userData.gltfExtensions[r]=n.extensions[r])}function Im(e,t){void 0!==t.extras&&("object"===$p(t.extras)?Object.assign(e.userData,t.extras):console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+t.extras))}function Dm(e,t){if(e.updateMorphTargets(),void 0!==t.weights)for(var n=0,r=t.weights.length;n<r;n++)e.morphTargetInfluences[n]=t.weights[n];if(t.extras&&Array.isArray(t.extras.targetNames)){var i=t.extras.targetNames;if(e.morphTargetInfluences.length===i.length){e.morphTargetDictionary={};for(var a=0,o=i.length;a<o;a++)e.morphTargetDictionary[i[a]]=a}else console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.")}}function Um(e){var t,n=e.extensions&&e.extensions[Yv.KHR_DRACO_MESH_COMPRESSION];if(t=n?"draco:"+n.bufferView+":"+n.indices+":"+Om(n.attributes):e.indices+":"+Om(e.attributes)+":"+e.mode,void 0!==e.targets)for(var r=0,i=e.targets.length;r<i;r++)t+=":"+Om(e.targets[r]);return t}function Om(e){for(var t="",n=Object.keys(e).sort(),r=0,i=n.length;r<i;r++)t+=n[r]+":"+e[n[r]]+";";return t}function Nm(e){switch(e){case Int8Array:return 1/127;case Uint8Array:return 1/255;case Int16Array:return 1/32767;case Uint16Array:return 1/65535;default:throw new Error("THREE.GLTFLoader: Unsupported normalized accessor component type.")}}var Fm=new wi,Bm=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};a(this,e),this.json=t,this.extensions={},this.plugins={},this.options=n,this.cache=new qv,this.associations=new Map,this.primitiveCache={},this.nodeCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.sourceCache={},this.textureCache={},this.nodeNamesUsed={};var r=!1,i=!1,o=-1;"undefined"!=typeof navigator&&(r=!0===/^((?!chrome|android).)*safari/i.test(navigator.userAgent),o=(i=navigator.userAgent.indexOf("Firefox")>-1)?navigator.userAgent.match(/Firefox\/([0-9]+)\./)[1]:-1),"undefined"==typeof createImageBitmap||r||i&&o<98?this.textureLoader=new Gd(this.options.manager):this.textureLoader=new gf(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new Od(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),"use-credentials"===this.options.crossOrigin&&this.fileLoader.setWithCredentials(!0)}return s(e,[{key:"setExtensions",value:function(e){this.extensions=e}},{key:"setPlugins",value:function(e){this.plugins=e}},{key:"parse",value:function(e,t){var n=this,r=this.json,i=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll((function(e){return e._markDefs&&e._markDefs()})),Promise.all(this._invokeAll((function(e){return e.beforeRoot&&e.beforeRoot()}))).then((function(){return Promise.all([n.getDependencies("scene"),n.getDependencies("animation"),n.getDependencies("camera")])})).then((function(t){var a={scene:t[0][r.scene||0],scenes:t[0],animations:t[1],cameras:t[2],asset:r.asset,parser:n,userData:{}};Pm(i,a,r),Im(a,r),Promise.all(n._invokeAll((function(e){return e.afterRoot&&e.afterRoot(a)}))).then((function(){e(a)}))})).catch(t)}},{key:"_markDefs",value:function(){for(var e=this.json.nodes||[],t=this.json.skins||[],n=this.json.meshes||[],r=0,i=t.length;r<i;r++)for(var a=t[r].joints,o=0,s=a.length;o<s;o++)e[a[o]].isBone=!0;for(var u=0,l=e.length;u<l;u++){var c=e[u];void 0!==c.mesh&&(this._addNodeRef(this.meshCache,c.mesh),void 0!==c.skin&&(n[c.mesh].isSkinnedMesh=!0)),void 0!==c.camera&&this._addNodeRef(this.cameraCache,c.camera)}}},{key:"_addNodeRef",value:function(e,t){void 0!==t&&(void 0===e.refs[t]&&(e.refs[t]=e.uses[t]=0),e.refs[t]++)}},{key:"_getNodeRef",value:function(e,t,n){var r=this;if(e.refs[t]<=1)return n;var i=n.clone();return function e(t,n){var i=r.associations.get(t);null!=i&&r.associations.set(n,i);var a,o=v(t.children.entries());try{for(o.s();!(a=o.n()).done;){var s=m(a.value,2),u=s[0];e(s[1],n.children[u])}}catch(e){o.e(e)}finally{o.f()}}(n,i),i.name+="_instance_"+e.uses[t]++,i}},{key:"_invokeOne",value:function(e){var t=Object.values(this.plugins);t.push(this);for(var n=0;n<t.length;n++){var r=e(t[n]);if(r)return r}return null}},{key:"_invokeAll",value:function(e){var t=Object.values(this.plugins);t.unshift(this);for(var n=[],r=0;r<t.length;r++){var i=e(t[r]);i&&n.push(i)}return n}},{key:"getDependency",value:function(e,t){var n=e+":"+t,r=this.cache.get(n);if(!r){switch(e){case"scene":r=this.loadScene(t);break;case"node":r=this._invokeOne((function(e){return e.loadNode&&e.loadNode(t)}));break;case"mesh":r=this._invokeOne((function(e){return e.loadMesh&&e.loadMesh(t)}));break;case"accessor":r=this.loadAccessor(t);break;case"bufferView":r=this._invokeOne((function(e){return e.loadBufferView&&e.loadBufferView(t)}));break;case"buffer":r=this.loadBuffer(t);break;case"material":r=this._invokeOne((function(e){return e.loadMaterial&&e.loadMaterial(t)}));break;case"texture":r=this._invokeOne((function(e){return e.loadTexture&&e.loadTexture(t)}));break;case"skin":r=this.loadSkin(t);break;case"animation":r=this._invokeOne((function(e){return e.loadAnimation&&e.loadAnimation(t)}));break;case"camera":r=this.loadCamera(t);break;default:if(!(r=this._invokeOne((function(n){return n!=this&&n.getDependency&&n.getDependency(e,t)}))))throw new Error("Unknown type: "+e)}this.cache.add(n,r)}return r}},{key:"getDependencies",value:function(e){var t=this.cache.get(e);if(!t){var n=this,r=this.json[e+("mesh"===e?"es":"s")]||[];t=Promise.all(r.map((function(t,r){return n.getDependency(e,r)}))),this.cache.add(e,t)}return t}},{key:"loadBuffer",value:function(e){var t=this.json.buffers[e],n=this.fileLoader;if(t.type&&"arraybuffer"!==t.type)throw new Error("THREE.GLTFLoader: "+t.type+" buffer type is not supported.");if(void 0===t.uri&&0===e)return Promise.resolve(this.extensions[Yv.KHR_BINARY_GLTF].body);var r=this.options;return new Promise((function(e,i){n.load(cf.resolveURL(t.uri,r.path),e,void 0,(function(){i(new Error('THREE.GLTFLoader: Failed to load buffer "'+t.uri+'".'))}))}))}},{key:"loadBufferView",value:function(e){var t=this.json.bufferViews[e];return this.getDependency("buffer",t.buffer).then((function(e){var n=t.byteLength||0,r=t.byteOffset||0;return e.slice(r,r+n)}))}},{key:"loadAccessor",value:function(e){var t=this,n=this.json,r=this.json.accessors[e];if(void 0===r.bufferView&&void 0===r.sparse){var i=Tm[r.type],a=Sm[r.componentType],o=!0===r.normalized,s=new a(r.count*i);return Promise.resolve(new wa(s,i,o))}var u=[];return void 0!==r.bufferView?u.push(this.getDependency("bufferView",r.bufferView)):u.push(null),void 0!==r.sparse&&(u.push(this.getDependency("bufferView",r.sparse.indices.bufferView)),u.push(this.getDependency("bufferView",r.sparse.values.bufferView))),Promise.all(u).then((function(e){var i,a,o=e[0],s=Tm[r.type],u=Sm[r.componentType],l=u.BYTES_PER_ELEMENT,c=l*s,h=r.byteOffset||0,d=void 0!==r.bufferView?n.bufferViews[r.bufferView].byteStride:void 0,f=!0===r.normalized;if(d&&d!==c){var p=Math.floor(h/d),v="InterleavedBuffer:"+r.bufferView+":"+r.componentType+":"+p+":"+r.count,m=t.cache.get(v);m||(i=new u(o,p*d,r.count*d/l),m=new fl(i,d/l),t.cache.add(v,m)),a=new vl(m,s,h%d/l,f)}else i=null===o?new u(r.count*s):new u(o,h,r.count*s),a=new wa(i,s,f);if(void 0!==r.sparse){var g=Tm.SCALAR,y=Sm[r.sparse.indices.componentType],_=r.sparse.indices.byteOffset||0,x=r.sparse.values.byteOffset||0,M=new y(e[1],_,r.sparse.count*g),S=new u(e[2],x,r.sparse.count*s);null!==o&&(a=new wa(a.array.slice(),a.itemSize,a.normalized));for(var b=0,w=M.length;b<w;b++){var T=M[b];if(a.setX(T,S[b*s]),s>=2&&a.setY(T,S[b*s+1]),s>=3&&a.setZ(T,S[b*s+2]),s>=4&&a.setW(T,S[b*s+3]),s>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}}return a}))}},{key:"loadTexture",value:function(e){var t=this.json,n=this.options,r=t.textures[e].source,i=t.images[r],a=this.textureLoader;if(i.uri){var o=n.manager.getHandler(i.uri);null!==o&&(a=o)}return this.loadTextureImage(e,r,a)}},{key:"loadTextureImage",value:function(e,t,n){var r=this,i=this.json,a=i.textures[e],o=i.images[t],s=(o.uri||o.bufferView)+":"+a.sampler;if(this.textureCache[s])return this.textureCache[s];var u=this.loadImageSource(t,n).then((function(t){t.flipY=!1,t.name=a.name||o.name||"",""===t.name&&"string"==typeof o.uri&&!1===o.uri.startsWith("data:image/")&&(t.name=o.uri);var n=(i.samplers||{})[a.sampler]||{};return t.magFilter=bm[n.magFilter]||Ve,t.minFilter=bm[n.minFilter]||Xe,t.wrapS=wm[n.wrapS]||Ue,t.wrapT=wm[n.wrapT]||Ue,r.associations.set(t,{textures:e}),t})).catch((function(){return null}));return this.textureCache[s]=u,u}},{key:"loadImageSource",value:function(e,t){var n=this.json,r=this.options;if(void 0!==this.sourceCache[e])return this.sourceCache[e].then((function(e){return e.clone()}));var i=n.images[e],a=self.URL||self.webkitURL,o=i.uri||"",s=!1;if(void 0!==i.bufferView)o=this.getDependency("bufferView",i.bufferView).then((function(e){s=!0;var t=new Blob([e],{type:i.mimeType});return o=a.createObjectURL(t)}));else if(void 0===i.uri)throw new Error("THREE.GLTFLoader: Image "+e+" is missing URI and bufferView");var u=Promise.resolve(o).then((function(e){return new Promise((function(n,i){var a=n;!0===t.isImageBitmapLoader&&(a=function(e){var t=new Fr(e);t.needsUpdate=!0,n(t)}),t.load(cf.resolveURL(e,r.path),a,void 0,i)}))})).then((function(e){var t;return!0===s&&a.revokeObjectURL(o),e.userData.mimeType=i.mimeType||((t=i.uri).search(/\.jpe?g($|\?)/i)>0||0===t.search(/^data\:image\/jpeg/)?"image/jpeg":t.search(/\.webp($|\?)/i)>0||0===t.search(/^data\:image\/webp/)?"image/webp":"image/png"),e})).catch((function(e){throw console.error("THREE.GLTFLoader: Couldn't load texture",o),e}));return this.sourceCache[e]=u,u}},{key:"assignTexture",value:function(e,t,n,r){var i=this;return this.getDependency("texture",n.index).then((function(a){if(!a)return null;if(void 0!==n.texCoord&&n.texCoord>0&&((a=a.clone()).channel=n.texCoord),i.extensions[Yv.KHR_TEXTURE_TRANSFORM]){var o=void 0!==n.extensions?n.extensions[Yv.KHR_TEXTURE_TRANSFORM]:void 0;if(o){var s=i.associations.get(a);a=i.extensions[Yv.KHR_TEXTURE_TRANSFORM].extendTexture(a,o),i.associations.set(a,s)}}return void 0!==r&&(a.colorSpace=r),e[t]=a,a}))}},{key:"assignFinalMaterial",value:function(e){var t=e.geometry,n=e.material,r=void 0===t.attributes.tangent,i=void 0!==t.attributes.color,a=void 0===t.attributes.normal;if(e.isPoints){var o="PointsMaterial:"+n.uuid,s=this.cache.get(o);s||(s=new vc,la.prototype.copy.call(s,n),s.color.copy(n.color),s.map=n.map,s.sizeAttenuation=!1,this.cache.add(o,s)),n=s}else if(e.isLine){var u="LineBasicMaterial:"+n.uuid,l=this.cache.get(u);l||(l=new ic,la.prototype.copy.call(l,n),l.color.copy(n.color),l.map=n.map,this.cache.add(u,l)),n=l}if(r||i||a){var c="ClonedMaterial:"+n.uuid+":";r&&(c+="derivative-tangents:"),i&&(c+="vertex-colors:"),a&&(c+="flat-shading:");var h=this.cache.get(c);h||(h=n.clone(),i&&(h.vertexColors=!0),a&&(h.flatShading=!0),r&&(h.normalScale&&(h.normalScale.y*=-1),h.clearcoatNormalScale&&(h.clearcoatNormalScale.y*=-1)),this.cache.add(c,h),this.associations.set(h,this.associations.get(n))),n=h}e.material=n}},{key:"getMaterialType",value:function(){return ed}},{key:"loadMaterial",value:function(e){var t,n=this,r=this.json,i=this.extensions,a=r.materials[e],o={},s=[];if((a.extensions||{})[Yv.KHR_MATERIALS_UNLIT]){var u=i[Yv.KHR_MATERIALS_UNLIT];t=u.getMaterialType(),s.push(u.extendParams(o,a,n))}else{var l=a.pbrMetallicRoughness||{};if(o.color=new pa(1,1,1),o.opacity=1,Array.isArray(l.baseColorFactor)){var c=l.baseColorFactor;o.color.fromArray(c),o.opacity=c[3]}void 0!==l.baseColorTexture&&s.push(n.assignTexture(o,"map",l.baseColorTexture,pn)),o.metalness=void 0!==l.metallicFactor?l.metallicFactor:1,o.roughness=void 0!==l.roughnessFactor?l.roughnessFactor:1,void 0!==l.metallicRoughnessTexture&&(s.push(n.assignTexture(o,"metalnessMap",l.metallicRoughnessTexture)),s.push(n.assignTexture(o,"roughnessMap",l.metallicRoughnessTexture))),t=this._invokeOne((function(t){return t.getMaterialType&&t.getMaterialType(e)})),s.push(Promise.all(this._invokeAll((function(t){return t.extendMaterialParams&&t.extendMaterialParams(e,o)}))))}!0===a.doubleSided&&(o.side=G);var h=a.alphaMode||km;if(h===Lm?(o.transparent=!0,o.depthWrite=!1):(o.transparent=!1,h===Cm&&(o.alphaTest=void 0!==a.alphaCutoff?a.alphaCutoff:.5)),void 0!==a.normalTexture&&t!==ma&&(s.push(n.assignTexture(o,"normalMap",a.normalTexture)),o.normalScale=new mr(1,1),void 0!==a.normalTexture.scale)){var d=a.normalTexture.scale;o.normalScale.set(d,d)}return void 0!==a.occlusionTexture&&t!==ma&&(s.push(n.assignTexture(o,"aoMap",a.occlusionTexture)),void 0!==a.occlusionTexture.strength&&(o.aoMapIntensity=a.occlusionTexture.strength)),void 0!==a.emissiveFactor&&t!==ma&&(o.emissive=(new pa).fromArray(a.emissiveFactor)),void 0!==a.emissiveTexture&&t!==ma&&s.push(n.assignTexture(o,"emissiveMap",a.emissiveTexture,pn)),Promise.all(s).then((function(){var r=new t(o);return a.name&&(r.name=a.name),Im(r,a),n.associations.set(r,{materials:e}),a.extensions&&Pm(i,r,a),r}))}},{key:"createUniqueName",value:function(e){var t=Yf.sanitizeNodeName(e||"");return t in this.nodeNamesUsed?t+"_"+ ++this.nodeNamesUsed[t]:(this.nodeNamesUsed[t]=0,t)}},{key:"loadGeometries",value:function(e){var t=this,n=this.extensions,r=this.primitiveCache;function i(e){return n[Yv.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(e,t).then((function(n){return zm(n,e,t)}))}for(var a=[],o=0,s=e.length;o<s;o++){var u=e[o],l=Um(u),c=r[l];if(c)a.push(c.promise);else{var h=void 0;h=u.extensions&&u.extensions[Yv.KHR_DRACO_MESH_COMPRESSION]?i(u):zm(new Ga,u,t),r[l]={primitive:u,promise:h},a.push(h)}}return Promise.all(a)}},{key:"loadMesh",value:function(e){for(var t,n=this,r=this.json,i=this.extensions,a=r.meshes[e],o=a.primitives,s=[],u=0,l=o.length;u<l;u++){var c=void 0===o[u].material?(void 0===(t=this.cache).DefaultMaterial&&(t.DefaultMaterial=new ed({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:z})),t.DefaultMaterial):this.getDependency("material",o[u].material);s.push(c)}return s.push(n.loadGeometries(o)),Promise.all(s).then((function(t){for(var r=t.slice(0,t.length-1),s=t[t.length-1],u=[],l=0,c=s.length;l<c;l++){var h=s[l],d=o[l],f=void 0,p=r[l];if(d.mode===Mm.TRIANGLES||d.mode===Mm.TRIANGLE_STRIP||d.mode===Mm.TRIANGLE_FAN||void 0===d.mode)!0===(f=!0===a.isSkinnedMesh?new Vl(h,p):new oo(h,p)).isSkinnedMesh&&f.normalizeSkinWeights(),d.mode===Mm.TRIANGLE_STRIP?f.geometry=jv(f.geometry,an):d.mode===Mm.TRIANGLE_FAN&&(f.geometry=jv(f.geometry,on));else if(d.mode===Mm.LINES)f=new fc(h,p);else if(d.mode===Mm.LINE_STRIP)f=new cc(h,p);else if(d.mode===Mm.LINE_LOOP)f=new pc(h,p);else{if(d.mode!==Mm.POINTS)throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+d.mode);f=new xc(h,p)}Object.keys(f.geometry.morphAttributes).length>0&&Dm(f,a),f.name=n.createUniqueName(a.name||"mesh_"+e),Im(f,a),d.extensions&&Pm(i,f,d),n.assignFinalMaterial(f),u.push(f)}for(var v=0,m=u.length;v<m;v++)n.associations.set(u[v],{meshes:e,primitives:v});if(1===u.length)return a.extensions&&Pm(i,u[0],a),u[0];var g=new $u;a.extensions&&Pm(i,g,a),n.associations.set(g,{meshes:e});for(var y=0,_=u.length;y<_;y++)g.add(u[y]);return g}))}},{key:"loadCamera",value:function(e){var t,n=this.json.cameras[e],r=n[n.type];if(r)return"perspective"===n.type?t=new mo(vr.radToDeg(r.yfov),r.aspectRatio||1,r.znear||1,r.zfar||2e6):"orthographic"===n.type&&(t=new Ho(-r.xmag,r.xmag,r.ymag,-r.ymag,r.znear,r.zfar)),n.name&&(t.name=this.createUniqueName(n.name)),Im(t,n),Promise.resolve(t);console.warn("THREE.GLTFLoader: Missing camera parameters.")}},{key:"loadSkin",value:function(e){for(var t=this.json.skins[e],n=[],r=0,i=t.joints.length;r<i;r++)n.push(this._loadNodeShallow(t.joints[r]));return void 0!==t.inverseBindMatrices?n.push(this.getDependency("accessor",t.inverseBindMatrices)):n.push(null),Promise.all(n).then((function(e){for(var n=e.pop(),r=e,i=[],a=[],o=0,s=r.length;o<s;o++){var u=r[o];if(u){i.push(u);var l=new wi;null!==n&&l.fromArray(n.array,16*o),a.push(l)}else console.warn('THREE.GLTFLoader: Joint "%s" could not be found.',t.joints[o])}return new Yl(i,a)}))}},{key:"loadAnimation",value:function(e){for(var t=this.json,n=this,r=t.animations[e],i=r.name?r.name:"animation_"+e,a=[],o=[],s=[],u=[],l=[],c=0,h=r.channels.length;c<h;c++){var d=r.channels[c],f=r.samplers[d.sampler],p=d.target,v=p.node,m=void 0!==r.parameters?r.parameters[f.input]:f.input,g=void 0!==r.parameters?r.parameters[f.output]:f.output;void 0!==p.node&&(a.push(this.getDependency("node",v)),o.push(this.getDependency("accessor",m)),s.push(this.getDependency("accessor",g)),u.push(f),l.push(p))}return Promise.all([Promise.all(a),Promise.all(o),Promise.all(s),Promise.all(u),Promise.all(l)]).then((function(e){for(var t=e[0],r=e[1],a=e[2],o=e[3],s=e[4],u=[],l=0,c=t.length;l<c;l++){var h=t[l],d=r[l],f=a[l],p=o[l],v=s[l];if(void 0!==h){h.updateMatrix&&h.updateMatrix();var m=n._createAnimationTracks(h,d,f,p,v);if(m)for(var g=0;g<m.length;g++)u.push(m[g])}}return new Ad(i,void 0,u)}))}},{key:"createNodeMesh",value:function(e){var t=this.json,n=this,r=t.nodes[e];return void 0===r.mesh?null:n.getDependency("mesh",r.mesh).then((function(e){var t=n._getNodeRef(n.meshCache,r.mesh,e);return void 0!==r.weights&&t.traverse((function(e){if(e.isMesh)for(var t=0,n=r.weights.length;t<n;t++)e.morphTargetInfluences[t]=r.weights[t]})),t}))}},{key:"loadNode",value:function(e){for(var t=this,n=this.json.nodes[e],r=t._loadNodeShallow(e),i=[],a=n.children||[],o=0,s=a.length;o<s;o++)i.push(t.getDependency("node",a[o]));var u=void 0===n.skin?Promise.resolve(null):t.getDependency("skin",n.skin);return Promise.all([r,Promise.all(i),u]).then((function(e){var t=e[0],n=e[1],r=e[2];null!==r&&t.traverse((function(e){e.isSkinnedMesh&&e.bind(r,Fm)}));for(var i=0,a=n.length;i<a;i++)t.add(n[i]);return t}))}},{key:"_loadNodeShallow",value:function(e){var t=this.json,n=this.extensions,r=this;if(void 0!==this.nodeCache[e])return this.nodeCache[e];var i=t.nodes[e],a=i.name?r.createUniqueName(i.name):"",o=[],s=r._invokeOne((function(t){return t.createNodeMesh&&t.createNodeMesh(e)}));return s&&o.push(s),void 0!==i.camera&&o.push(r.getDependency("camera",i.camera).then((function(e){return r._getNodeRef(r.cameraCache,i.camera,e)}))),r._invokeAll((function(t){return t.createNodeAttachment&&t.createNodeAttachment(e)})).forEach((function(e){o.push(e)})),this.nodeCache[e]=Promise.all(o).then((function(t){var o;if((o=!0===i.isBone?new Wl:t.length>1?new $u:1===t.length?t[0]:new Zi)!==t[0])for(var s=0,u=t.length;s<u;s++)o.add(t[s]);if(i.name&&(o.userData.name=i.name,o.name=a),Im(o,i),i.extensions&&Pm(n,o,i),void 0!==i.matrix){var l=new wi;l.fromArray(i.matrix),o.applyMatrix4(l)}else void 0!==i.translation&&o.position.fromArray(i.translation),void 0!==i.rotation&&o.quaternion.fromArray(i.rotation),void 0!==i.scale&&o.scale.fromArray(i.scale);return r.associations.has(o)||r.associations.set(o,{}),r.associations.get(o).nodes=e,o})),this.nodeCache[e]}},{key:"loadScene",value:function(e){var t=this.extensions,n=this.json.scenes[e],r=this,i=new $u;n.name&&(i.name=r.createUniqueName(n.name)),Im(i,n),n.extensions&&Pm(t,i,n);for(var a=n.nodes||[],o=[],s=0,u=a.length;s<u;s++)o.push(r.getDependency("node",a[s]));return Promise.all(o).then((function(e){for(var t=0,n=e.length;t<n;t++)i.add(e[t]);return r.associations=function(e){var t,n=new Map,i=v(r.associations);try{for(i.s();!(t=i.n()).done;){var a=m(t.value,2),o=a[0],s=a[1];(o instanceof la||o instanceof Fr)&&n.set(o,s)}}catch(e){i.e(e)}finally{i.f()}return e.traverse((function(e){var t=r.associations.get(e);null!=t&&n.set(e,t)})),n}(i),i}))}},{key:"_createAnimationTracks",value:function(e,t,n,r,i){var a,o=[],s=e.name?e.name:e.uuid,u=[];switch(Am[i.path]===Am.weights?e.traverse((function(e){e.morphTargetInfluences&&u.push(e.name?e.name:e.uuid)})):u.push(s),Am[i.path]){case Am.weights:a=Sd;break;case Am.rotation:a=wd;break;case Am.position:case Am.scale:a=Ed;break;default:if(1===n.itemSize)a=Sd;else a=Ed}for(var l=void 0!==r.interpolation?Rm[r.interpolation]:Kt,c=this._getArrayFromAccessor(n),h=0,d=u.length;h<d;h++){var f=new a(u[h]+"."+Am[i.path],t.array,c,l);"CUBICSPLINE"===r.interpolation&&this._createCubicSplineTrackInterpolant(f),o.push(f)}return o}},{key:"_getArrayFromAccessor",value:function(e){var t=e.array;if(e.normalized){for(var n=Nm(t.constructor),r=new Float32Array(t.length),i=0,a=t.length;i<a;i++)r[i]=t[i]*n;t=r}return t}},{key:"_createCubicSplineTrackInterpolant",value:function(e){e.createInterpolant=function(e){return new(this instanceof wd?xm:ym)(this.times,this.values,this.getValueSize()/3,e)},e.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0}}]),e}();function zm(e,t,n){var r=t.attributes,i=[];function a(t,r){return n.getDependency("accessor",t).then((function(t){e.setAttribute(r,t)}))}for(var o in r){var s=Em[o]||o.toLowerCase();s in e.attributes||i.push(a(r[o],s))}if(void 0!==t.indices&&!e.index){var u=n.getDependency("accessor",t.indices).then((function(t){e.setIndex(t)}));i.push(u)}return Im(e,t),function(e,t,n){var r=t.attributes,i=new Jr;if(void 0!==r.POSITION){var a=n.json.accessors[r.POSITION],o=a.min,s=a.max;if(void 0!==o&&void 0!==s){if(i.set(new Yr(o[0],o[1],o[2]),new Yr(s[0],s[1],s[2])),a.normalized){var u=Nm(Sm[a.componentType]);i.min.multiplyScalar(u),i.max.multiplyScalar(u)}var l=t.targets;if(void 0!==l){for(var c=new Yr,h=new Yr,d=0,f=l.length;d<f;d++){var p=l[d];if(void 0!==p.POSITION){var v=n.json.accessors[p.POSITION],m=v.min,g=v.max;if(void 0!==m&&void 0!==g){if(h.setX(Math.max(Math.abs(m[0]),Math.abs(g[0]))),h.setY(Math.max(Math.abs(m[1]),Math.abs(g[1]))),h.setZ(Math.max(Math.abs(m[2]),Math.abs(g[2]))),v.normalized){var y=Nm(Sm[v.componentType]);h.multiplyScalar(y)}c.max(h)}else console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}i.expandByVector(c)}e.boundingBox=i;var _=new vi;i.getCenter(_.center),_.radius=i.min.distanceTo(i.max)/2,e.boundingSphere=_}else console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}(e,t,n),Promise.all(i).then((function(){return void 0!==t.targets?function(e,t,n){for(var r=!1,i=!1,a=!1,o=0,s=t.length;o<s;o++){var u=t[o];if(void 0!==u.POSITION&&(r=!0),void 0!==u.NORMAL&&(i=!0),void 0!==u.COLOR_0&&(a=!0),r&&i&&a)break}if(!r&&!i&&!a)return Promise.resolve(e);for(var l=[],c=[],h=[],d=0,f=t.length;d<f;d++){var p=t[d];if(r){var v=void 0!==p.POSITION?n.getDependency("accessor",p.POSITION):e.attributes.position;l.push(v)}if(i){var m=void 0!==p.NORMAL?n.getDependency("accessor",p.NORMAL):e.attributes.normal;c.push(m)}if(a){var g=void 0!==p.COLOR_0?n.getDependency("accessor",p.COLOR_0):e.attributes.color;h.push(g)}}return Promise.all([Promise.all(l),Promise.all(c),Promise.all(h)]).then((function(t){var n=t[0],o=t[1],s=t[2];return r&&(e.morphAttributes.position=n),i&&(e.morphAttributes.normal=o),a&&(e.morphAttributes.color=s),e.morphTargetsRelative=!0,e}))}(e,t.targets,n):e}))}var Hm=function(e){return URL.createObjectURL(new Blob([e],{type:"text/javascript"}))};try{URL.revokeObjectURL(Hm(""))}catch(e){Hm=function(e){return"data:application/javascript;charset=UTF-8,"+encodeURI(e)},function(e){return new Worker(e,{type:"module"})}}var Gm=Uint8Array,Vm=Uint16Array,Wm=Uint32Array,jm=new Gm([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),Xm=new Gm([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),qm=new Gm([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Ym=function(e,t){for(var n=new Vm(31),r=0;r<31;++r)n[r]=t+=1<<e[r-1];var i=new Wm(n[30]);for(r=1;r<30;++r)for(var a=n[r];a<n[r+1];++a)i[a]=a-n[r]<<5|r;return[n,i]},Zm=Ym(jm,2),Km=Zm[0],Jm=Zm[1];Km[28]=258,Jm[258]=28;for(var Qm=Ym(Xm,0),$m=Qm[0],eg=(Qm[1],new Vm(32768)),tg=0;tg<32768;++tg){var ng=(43690&tg)>>>1|(21845&tg)<<1;ng=(61680&(ng=(52428&ng)>>>2|(13107&ng)<<2))>>>4|(3855&ng)<<4,eg[tg]=((65280&ng)>>>8|(255&ng)<<8)>>>1}var rg=function(e,t,n){for(var r=e.length,i=0,a=new Vm(t);i<r;++i)++a[e[i]-1];var o,s=new Vm(t);for(i=0;i<t;++i)s[i]=s[i-1]+a[i-1]<<1;if(n){o=new Vm(1<<t);var u=15-t;for(i=0;i<r;++i)if(e[i])for(var l=i<<4|e[i],c=t-e[i],h=s[e[i]-1]++<<c,d=h|(1<<c)-1;h<=d;++h)o[eg[h]>>>u]=l}else for(o=new Vm(r),i=0;i<r;++i)e[i]&&(o[i]=eg[s[e[i]-1]++]>>>15-e[i]);return o},ig=new Gm(288);for(tg=0;tg<144;++tg)ig[tg]=8;for(tg=144;tg<256;++tg)ig[tg]=9;for(tg=256;tg<280;++tg)ig[tg]=7;for(tg=280;tg<288;++tg)ig[tg]=8;var ag=new Gm(32);for(tg=0;tg<32;++tg)ag[tg]=5;var og=rg(ig,9,1),sg=rg(ag,5,1),ug=function(e){for(var t=e[0],n=1;n<e.length;++n)e[n]>t&&(t=e[n]);return t},lg=function(e,t,n){var r=t/8|0;return(e[r]|e[r+1]<<8)>>(7&t)&n},cg=function(e,t){var n=t/8|0;return(e[n]|e[n+1]<<8|e[n+2]<<16)>>(7&t)},hg=function(e){return(e/8|0)+(7&e&&1)},dg=function(e,t,n){(null==t||t<0)&&(t=0),(null==n||n>e.length)&&(n=e.length);var r=new(e instanceof Vm?Vm:e instanceof Wm?Wm:Gm)(n-t);return r.set(e.subarray(t,n)),r},fg=function(e,t,n){var r=e.length;if(!r||n&&!n.l&&r<5)return t||new Gm(0);var i=!t||n,a=!n||n.i;n||(n={}),t||(t=new Gm(3*r));var o=function(e){var n=t.length;if(e>n){var r=new Gm(Math.max(2*n,e));r.set(t),t=r}},s=n.f||0,u=n.p||0,l=n.b||0,c=n.l,h=n.d,d=n.m,f=n.n,p=8*r;do{if(!c){n.f=s=lg(e,u,1);var v=lg(e,u+1,3);if(u+=3,!v){var m=e[(A=hg(u)+4)-4]|e[A-3]<<8,g=A+m;if(g>r){if(a)throw"unexpected EOF";break}i&&o(l+m),t.set(e.subarray(A,g),l),n.b=l+=m,n.p=u=8*g;continue}if(1==v)c=og,h=sg,d=9,f=5;else{if(2!=v)throw"invalid block type";var y=lg(e,u,31)+257,_=lg(e,u+10,15)+4,x=y+lg(e,u+5,31)+1;u+=14;for(var M=new Gm(x),S=new Gm(19),b=0;b<_;++b)S[qm[b]]=lg(e,u+3*b,7);u+=3*_;var w=ug(S),T=(1<<w)-1,E=rg(S,w,1);for(b=0;b<x;){var A,R=E[lg(e,u,T)];if(u+=15&R,(A=R>>>4)<16)M[b++]=A;else{var k=0,C=0;for(16==A?(C=3+lg(e,u,3),u+=2,k=M[b-1]):17==A?(C=3+lg(e,u,7),u+=3):18==A&&(C=11+lg(e,u,127),u+=7);C--;)M[b++]=k}}var L=M.subarray(0,y),P=M.subarray(y);d=ug(L),f=ug(P),c=rg(L,d,1),h=rg(P,f,1)}if(u>p){if(a)throw"unexpected EOF";break}}i&&o(l+131072);for(var I=(1<<d)-1,D=(1<<f)-1,U=u;;U=u){var O=(k=c[cg(e,u)&I])>>>4;if((u+=15&k)>p){if(a)throw"unexpected EOF";break}if(!k)throw"invalid length/literal";if(O<256)t[l++]=O;else{if(256==O){U=u,c=null;break}var N=O-254;if(O>264){var F=jm[b=O-257];N=lg(e,u,(1<<F)-1)+Km[b],u+=F}var B=h[cg(e,u)&D],z=B>>>4;if(!B)throw"invalid distance";u+=15&B;P=$m[z];if(z>3){F=Xm[z];P+=cg(e,u)&(1<<F)-1,u+=F}if(u>p){if(a)throw"unexpected EOF";break}i&&o(l+131072);for(var H=l+N;l<H;l+=4)t[l]=t[l-P],t[l+1]=t[l+1-P],t[l+2]=t[l+2-P],t[l+3]=t[l+3-P];l=H}}n.l=c,n.p=U,n.b=l,c&&(s=1,n.m=d,n.d=h,n.n=f)}while(!s);return l==t.length?t:dg(t,0,l)},pg=new Gm(0),vg=function(e){if(8!=(15&e[0])||e[0]>>>4>7||(e[0]<<8|e[1])%31)throw"invalid zlib data";if(32&e[1])throw"invalid zlib data: preset dictionaries not supported"};function mg(e,t){return fg((vg(e),e.subarray(2,-4)),t)}var gg="undefined"!=typeof TextDecoder&&new TextDecoder;try{gg.decode(pg,{stream:!0}),1}catch(e){}function yg(e,t,n){var r=n.length-e-1;if(t>=n[r])return r-1;if(t<=n[e])return e;for(var i=e,a=r,o=Math.floor((i+a)/2);t<n[o]||t>=n[o+1];)t<n[o]?a=o:i=o,o=Math.floor((i+a)/2);return o}function _g(e,t,n,r){var i=[],a=[],o=[];i[0]=1;for(var s=1;s<=n;++s){a[s]=t-r[e+1-s],o[s]=r[e+s]-t;for(var u=0,l=0;l<s;++l){var c=o[l+1],h=a[s-l],d=i[l]/(c+h);i[l]=u+c*d,u=h*d}i[s]=u}return i}function xg(e,t,n,r){for(var i=yg(e,r,t),a=_g(i,r,e,t),o=new Br(0,0,0,0),s=0;s<=e;++s){var u=n[i-e+s],l=a[s],c=u.w*l;o.x+=u.x*c,o.y+=u.y*c,o.z+=u.z*c,o.w+=u.w*l}return o}function Mg(e,t){for(var n=1,r=2;r<=e;++r)n*=r;for(var i=1,a=2;a<=t;++a)i*=a;for(var o=2;o<=e-t;++o)i*=o;return n/i}function Sg(e,t,n,r,i){var a=function(e,t,n,r,i){for(var a=i<e?i:e,o=[],s=yg(e,r,t),u=function(e,t,n,r,i){for(var a=[],o=0;o<=n;++o)a[o]=0;for(var s=[],u=0;u<=r;++u)s[u]=a.slice(0);for(var l=[],c=0;c<=n;++c)l[c]=a.slice(0);l[0][0]=1;for(var h=a.slice(0),d=a.slice(0),f=1;f<=n;++f){h[f]=t-i[e+1-f],d[f]=i[e+f]-t;for(var p=0,v=0;v<f;++v){var m=d[v+1],g=h[f-v];l[f][v]=m+g;var y=l[v][f-1]/l[f][v];l[v][f]=p+m*y,p=g*y}l[f][f]=p}for(var _=0;_<=n;++_)s[0][_]=l[_][n];for(var x=0;x<=n;++x){for(var M=0,S=1,b=[],w=0;w<=n;++w)b[w]=a.slice(0);b[0][0]=1;for(var T=1;T<=r;++T){var E=0,A=x-T,R=n-T;x>=T&&(b[S][0]=b[M][0]/l[R+1][A],E=b[S][0]*l[A][R]);for(var k=x-1<=R?T-1:n-x,C=A>=-1?1:-A;C<=k;++C)b[S][C]=(b[M][C]-b[M][C-1])/l[R+1][A+C],E+=b[S][C]*l[A+C][R];x<=R&&(b[S][T]=-b[M][T-1]/l[R+1][x],E+=b[S][T]*l[x][R]),s[T][x]=E;var L=M;M=S,S=L}}for(var P=n,I=1;I<=r;++I){for(var D=0;D<=n;++D)s[I][D]*=P;P*=n-I}return s}(s,r,e,a,t),l=[],c=0;c<n.length;++c){var h=n[c].clone(),d=h.w;h.x*=d,h.y*=d,h.z*=d,l[c]=h}for(var f=0;f<=a;++f){for(var p=l[s-e].clone().multiplyScalar(u[f][0]),v=1;v<=e;++v)p.add(l[s-e+v].clone().multiplyScalar(u[f][v]));o[f]=p}for(var m=a+1;m<=i+1;++m)o[m]=new Br(0,0,0);return o}(e,t,n,r,i);return function(e){for(var t=e.length,n=[],r=[],i=0;i<t;++i){var a=e[i];n[i]=new Yr(a.x,a.y,a.z),r[i]=a.w}for(var o=[],s=0;s<t;++s){for(var u=n[s].clone(),l=1;l<=s;++l)u.sub(o[s-l].clone().multiplyScalar(Mg(s,l)*r[l]));o[s]=u.divideScalar(r[0])}return o}(a)}var bg,wg,Tg,Eg=function(e){w(n,e);var t=E(n);function n(e,r,i,o,s){var u;a(this,n),(u=t.call(this)).degree=e,u.knots=r,u.controlPoints=[],u.startKnot=o||0,u.endKnot=s||u.knots.length-1;for(var l=0;l<i.length;++l){var c=i[l];u.controlPoints[l]=new Br(c.x,c.y,c.z,c.w)}return u}return s(n,[{key:"getPoint",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Yr,n=t,r=this.knots[this.startKnot]+e*(this.knots[this.endKnot]-this.knots[this.startKnot]),i=xg(this.degree,this.knots,this.controlPoints,r);return 1!==i.w&&i.divideScalar(i.w),n.set(i.x,i.y,i.z)}},{key:"getTangent",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Yr,n=t,r=this.knots[0]+e*(this.knots[this.knots.length-1]-this.knots[0]),i=Sg(this.degree,this.knots,this.controlPoints,r,1);return n.copy(i[1]).normalize(),n}}]),n}(Rc),Ag=function(e){w(n,e);var t=E(n);function n(e){return a(this,n),t.call(this,e)}return s(n,[{key:"load",value:function(e,t,n,r){var i=this,a=""===i.path?cf.extractUrlBase(e):i.path,o=new Od(this.manager);o.setPath(i.path),o.setResponseType("arraybuffer"),o.setRequestHeader(i.requestHeader),o.setWithCredentials(i.withCredentials),o.load(e,(function(n){try{t(i.parse(n,a))}catch(t){r?r(t):console.error(t),i.manager.itemError(e)}}),n,r)}},{key:"parse",value:function(e,t){if(i="Kaydara FBX Binary \0",(r=e).byteLength>=i.length&&i===Wg(r,0,i.length))bg=(new Pg).parse(e);else{var n=Wg(e);if(!function(e){var t=["K","a","y","d","a","r","a","\\","F","B","X","\\","B","i","n","a","r","y","\\","\\"],n=0;function r(t){var r=e[t-1];return e=e.slice(n+t),n++,r}for(var i=0;i<t.length;++i){if(r(1)===t[i])return!1}return!0}(n))throw new Error("THREE.FBXLoader: Unknown format.");if(Ug(n)<7e3)throw new Error("THREE.FBXLoader: FBX version not supported, FileVersion: "+Ug(n));bg=(new Lg).parse(n)}var r,i,a=new Gd(this.manager).setPath(this.resourcePath||t).setCrossOrigin(this.crossOrigin);return new Rg(a,this.manager).parse(bg)}}]),n}(Pd),Rg=function(){function e(t,n){a(this,e),this.textureLoader=t,this.manager=n}return s(e,[{key:"parse",value:function(){wg=this.parseConnections();var e=this.parseImages(),t=this.parseTextures(e),n=this.parseMaterials(t),r=this.parseDeformers(),i=(new kg).parse(r);return this.parseScene(r,i,n),Tg}},{key:"parseConnections",value:function(){var e=new Map;"Connections"in bg&&bg.Connections.connections.forEach((function(t){var n=t[0],r=t[1],i=t[2];e.has(n)||e.set(n,{parents:[],children:[]});var a={ID:r,relationship:i};e.get(n).parents.push(a),e.has(r)||e.set(r,{parents:[],children:[]});var o={ID:n,relationship:i};e.get(r).children.push(o)}));return e}},{key:"parseImages",value:function(){var e={},t={};if("Video"in bg.Objects){var n=bg.Objects.Video;for(var r in n){var i=n[r];if(e[parseInt(r)]=i.RelativeFilename||i.Filename,"Content"in i){var a=i.Content instanceof ArrayBuffer&&i.Content.byteLength>0,o="string"==typeof i.Content&&""!==i.Content;if(a||o){var s=this.parseImage(n[r]);t[i.RelativeFilename||i.Filename]=s}}}}for(var u in e){var l=e[u];void 0!==t[l]?e[u]=t[l]:e[u]=e[u].split("\\").pop()}return e}},{key:"parseImage",value:function(e){var t,n=e.Content,r=e.RelativeFilename||e.Filename,i=r.slice(r.lastIndexOf(".")+1).toLowerCase();switch(i){case"bmp":t="image/bmp";break;case"jpg":case"jpeg":t="image/jpeg";break;case"png":t="image/png";break;case"tif":t="image/tiff";break;case"tga":null===this.manager.getHandler(".tga")&&console.warn("FBXLoader: TGA loader not found, skipping ",r),t="image/tga";break;default:return void console.warn('FBXLoader: Image type "'+i+'" is not supported.')}if("string"==typeof n)return"data:"+t+";base64,"+n;var a=new Uint8Array(n);return window.URL.createObjectURL(new Blob([a],{type:t}))}},{key:"parseTextures",value:function(e){var t=new Map;if("Texture"in bg.Objects){var n=bg.Objects.Texture;for(var r in n){var i=this.parseTexture(n[r],e);t.set(parseInt(r),i)}}return t}},{key:"parseTexture",value:function(e,t){var n=this.loadTexture(e,t);n.ID=e.id,n.name=e.attrName;var r=e.WrapModeU,i=e.WrapModeV,a=void 0!==r?r.value:0,o=void 0!==i?i.value:0;if(n.wrapS=0===a?Ue:Oe,n.wrapT=0===o?Ue:Oe,"Scaling"in e){var s=e.Scaling.value;n.repeat.x=s[0],n.repeat.y=s[1]}if("Translation"in e){var u=e.Translation.value;n.offset.x=u[0],n.offset.y=u[1]}return n}},{key:"loadTexture",value:function(e,t){var n,r,i=this.textureLoader.path,a=wg.get(e.id).children;void 0!==a&&a.length>0&&void 0!==t[a[0].ID]&&(0!==(n=t[a[0].ID]).indexOf("blob:")&&0!==n.indexOf("data:")||this.textureLoader.setPath(void 0));var o=e.FileName.slice(-3).toLowerCase();if("tga"===o){var s=this.manager.getHandler(".tga");null===s?(console.warn("FBXLoader: TGA loader not found, creating placeholder texture for",e.RelativeFilename),r=new Fr):(s.setPath(this.textureLoader.path),r=s.load(n))}else"psd"===o?(console.warn("FBXLoader: PSD textures are not supported, creating placeholder texture for",e.RelativeFilename),r=new Fr):r=this.textureLoader.load(n);return this.textureLoader.setPath(i),r}},{key:"parseMaterials",value:function(e){var t=new Map;if("Material"in bg.Objects){var n=bg.Objects.Material;for(var r in n){var i=this.parseMaterial(n[r],e);null!==i&&t.set(parseInt(r),i)}}return t}},{key:"parseMaterial",value:function(e,t){var n=e.id,r=e.attrName,i=e.ShadingModel;if("object"===$p(i)&&(i=i.value),!wg.has(n))return null;var a,o=this.parseParameters(e,t,n);switch(i.toLowerCase()){case"phong":a=new nd;break;case"lambert":a=new ad;break;default:console.warn('THREE.FBXLoader: unknown material type "%s". Defaulting to MeshPhongMaterial.',i),a=new nd}return a.setValues(o),a.name=r,a}},{key:"parseParameters",value:function(e,t,n){var r={};e.BumpFactor&&(r.bumpScale=e.BumpFactor.value),e.Diffuse?r.color=(new pa).fromArray(e.Diffuse.value).convertSRGBToLinear():!e.DiffuseColor||"Color"!==e.DiffuseColor.type&&"ColorRGB"!==e.DiffuseColor.type||(r.color=(new pa).fromArray(e.DiffuseColor.value).convertSRGBToLinear()),e.DisplacementFactor&&(r.displacementScale=e.DisplacementFactor.value),e.Emissive?r.emissive=(new pa).fromArray(e.Emissive.value).convertSRGBToLinear():!e.EmissiveColor||"Color"!==e.EmissiveColor.type&&"ColorRGB"!==e.EmissiveColor.type||(r.emissive=(new pa).fromArray(e.EmissiveColor.value).convertSRGBToLinear()),e.EmissiveFactor&&(r.emissiveIntensity=parseFloat(e.EmissiveFactor.value)),e.Opacity&&(r.opacity=parseFloat(e.Opacity.value)),r.opacity<1&&(r.transparent=!0),e.ReflectionFactor&&(r.reflectivity=e.ReflectionFactor.value),e.Shininess&&(r.shininess=e.Shininess.value),e.Specular?r.specular=(new pa).fromArray(e.Specular.value).convertSRGBToLinear():e.SpecularColor&&"Color"===e.SpecularColor.type&&(r.specular=(new pa).fromArray(e.SpecularColor.value).convertSRGBToLinear());var i=this;return wg.get(n).children.forEach((function(e){var n=e.relationship;switch(n){case"Bump":r.bumpMap=i.getTexture(t,e.ID);break;case"Maya|TEX_ao_map":r.aoMap=i.getTexture(t,e.ID);break;case"DiffuseColor":case"Maya|TEX_color_map":r.map=i.getTexture(t,e.ID),void 0!==r.map&&(r.map.colorSpace=pn);break;case"DisplacementColor":r.displacementMap=i.getTexture(t,e.ID);break;case"EmissiveColor":r.emissiveMap=i.getTexture(t,e.ID),void 0!==r.emissiveMap&&(r.emissiveMap.colorSpace=pn);break;case"NormalMap":case"Maya|TEX_normal_map":r.normalMap=i.getTexture(t,e.ID);break;case"ReflectionColor":r.envMap=i.getTexture(t,e.ID),void 0!==r.envMap&&(r.envMap.mapping=Pe,r.envMap.colorSpace=pn);break;case"SpecularColor":r.specularMap=i.getTexture(t,e.ID),void 0!==r.specularMap&&(r.specularMap.colorSpace=pn);break;case"TransparentColor":case"TransparencyFactor":r.alphaMap=i.getTexture(t,e.ID),r.transparent=!0;break;default:console.warn("THREE.FBXLoader: %s map is not supported in three.js, skipping texture.",n)}})),r}},{key:"getTexture",value:function(e,t){return"LayeredTexture"in bg.Objects&&t in bg.Objects.LayeredTexture&&(console.warn("THREE.FBXLoader: layered textures are not supported in three.js. Discarding all but first layer."),t=wg.get(t).children[0].ID),e.get(t)}},{key:"parseDeformers",value:function(){var e={},t={};if("Deformer"in bg.Objects){var n=bg.Objects.Deformer;for(var r in n){var i=n[r],a=wg.get(parseInt(r));if("Skin"===i.attrType){var o=this.parseSkeleton(a,n);o.ID=r,a.parents.length>1&&console.warn("THREE.FBXLoader: skeleton attached to more than one geometry is not supported."),o.geometryID=a.parents[0].ID,e[r]=o}else if("BlendShape"===i.attrType){var s={id:r};s.rawTargets=this.parseMorphTargets(a,n),s.id=r,a.parents.length>1&&console.warn("THREE.FBXLoader: morph target attached to more than one geometry is not supported."),t[r]=s}}}return{skeletons:e,morphTargets:t}}},{key:"parseSkeleton",value:function(e,t){var n=[];return e.children.forEach((function(e){var r=t[e.ID];if("Cluster"===r.attrType){var i={ID:e.ID,indices:[],weights:[],transformLink:(new wi).fromArray(r.TransformLink.a)};"Indexes"in r&&(i.indices=r.Indexes.a,i.weights=r.Weights.a),n.push(i)}})),{rawBones:n,bones:[]}}},{key:"parseMorphTargets",value:function(e,t){for(var n=[],r=0;r<e.children.length;r++){var i=e.children[r],a=t[i.ID],o={name:a.attrName,initialWeight:a.DeformPercent,id:a.id,fullWeights:a.FullWeights.a};if("BlendShapeChannel"!==a.attrType)return;o.geoID=wg.get(parseInt(i.ID)).children.filter((function(e){return void 0===e.relationship}))[0].ID,n.push(o)}return n}},{key:"parseScene",value:function(e,t,n){Tg=new $u;var r=this.parseModels(e.skeletons,t,n),i=bg.Objects.Model,a=this;r.forEach((function(e){var t=i[e.ID];a.setLookAtProperties(e,t),wg.get(e.ID).parents.forEach((function(t){var n=r.get(t.ID);void 0!==n&&n.add(e)})),null===e.parent&&Tg.add(e)})),this.bindSkeleton(e.skeletons,t,r),this.createAmbientLight(),Tg.traverse((function(e){if(e.userData.transformData){e.parent&&(e.userData.transformData.parentMatrix=e.parent.matrix,e.userData.transformData.parentMatrixWorld=e.parent.matrixWorld);var t=Hg(e.userData.transformData);e.applyMatrix4(t),e.updateWorldMatrix()}}));var o=(new Cg).parse();1===Tg.children.length&&Tg.children[0].isGroup&&(Tg.children[0].animations=o,Tg=Tg.children[0]),Tg.animations=o}},{key:"parseModels",value:function(e,t,n){var r=new Map,i=bg.Objects.Model;for(var a in i){var o=parseInt(a),s=i[a],u=wg.get(o),l=this.buildSkeleton(u,e,o,s.attrName);if(!l){switch(s.attrType){case"Camera":l=this.createCamera(u);break;case"Light":l=this.createLight(u);break;case"Mesh":l=this.createMesh(u,t,n);break;case"NurbsCurve":l=this.createCurve(u,t);break;case"LimbNode":case"Root":l=new Wl;break;default:l=new $u}l.name=s.attrName?Yf.sanitizeNodeName(s.attrName):"",l.ID=o}this.getTransformData(l,s),r.set(o,l)}return r}},{key:"buildSkeleton",value:function(e,t,n,r){var i=null;return e.parents.forEach((function(e){var a=function(){var a=t[o];a.rawBones.forEach((function(t,o){if(t.ID===e.ID){var s=i;(i=new Wl).matrixWorld.copy(t.transformLink),i.name=r?Yf.sanitizeNodeName(r):"",i.ID=n,a.bones[o]=i,null!==s&&i.add(s)}}))};for(var o in t)a()})),i}},{key:"createCamera",value:function(e){var t,n;if(e.children.forEach((function(e){var t=bg.Objects.NodeAttribute[e.ID];void 0!==t&&(n=t)})),void 0===n)t=new Zi;else{var r=0;void 0!==n.CameraProjectionType&&1===n.CameraProjectionType.value&&(r=1);var i=1;void 0!==n.NearPlane&&(i=n.NearPlane.value/1e3);var a=1e3;void 0!==n.FarPlane&&(a=n.FarPlane.value/1e3);var o=window.innerWidth,s=window.innerHeight;void 0!==n.AspectWidth&&void 0!==n.AspectHeight&&(o=n.AspectWidth.value,s=n.AspectHeight.value);var u=o/s,l=45;void 0!==n.FieldOfView&&(l=n.FieldOfView.value);var c=n.FocalLength?n.FocalLength.value:null;switch(r){case 0:t=new mo(l,u,i,a),null!==c&&t.setFocalLength(c);break;case 1:t=new Ho(-o/2,o/2,s/2,-s/2,i,a);break;default:console.warn("THREE.FBXLoader: Unknown camera type "+r+"."),t=new Zi}}return t}},{key:"createLight",value:function(e){var t,n;if(e.children.forEach((function(e){var t=bg.Objects.NodeAttribute[e.ID];void 0!==t&&(n=t)})),void 0===n)t=new Zi;else{var r;r=void 0===n.LightType?0:n.LightType.value;var i=16777215;void 0!==n.Color&&(i=(new pa).fromArray(n.Color.value).convertSRGBToLinear());var a=void 0===n.Intensity?1:n.Intensity.value/100;void 0!==n.CastLightOnObject&&0===n.CastLightOnObject.value&&(a=0);var o=0;void 0!==n.FarAttenuationEnd&&(o=void 0!==n.EnableFarAttenuation&&0===n.EnableFarAttenuation.value?0:n.FarAttenuationEnd.value);switch(r){case 0:t=new tf(i,a,o,1);break;case 1:t=new rf(i,a);break;case 2:var s=Math.PI/3;void 0!==n.InnerAngle&&(s=vr.degToRad(n.InnerAngle.value));var u=0;void 0!==n.OuterAngle&&(u=vr.degToRad(n.OuterAngle.value),u=Math.max(u,1)),t=new Kd(i,a,o,s,u,1);break;default:console.warn("THREE.FBXLoader: Unknown light type "+n.LightType.value+", defaulting to a PointLight."),t=new tf(i,a)}void 0!==n.CastShadows&&1===n.CastShadows.value&&(t.castShadow=!0)}return t}},{key:"createMesh",value:function(e,t,n){var r,i=null,a=null,o=[];return e.children.forEach((function(e){t.has(e.ID)&&(i=t.get(e.ID)),n.has(e.ID)&&o.push(n.get(e.ID))})),o.length>1?a=o:o.length>0?a=o[0]:(a=new nd({name:Pd.DEFAULT_MATERIAL_NAME,color:13421772}),o.push(a)),"color"in i.attributes&&o.forEach((function(e){e.vertexColors=!0})),i.FBX_Deformer?(r=new Vl(i,a)).normalizeSkinWeights():r=new oo(i,a),r}},{key:"createCurve",value:function(e,t){var n=e.children.reduce((function(e,n){return t.has(n.ID)&&(e=t.get(n.ID)),e}),null),r=new ic({name:Pd.DEFAULT_MATERIAL_NAME,color:3342591,linewidth:1});return new cc(n,r)}},{key:"getTransformData",value:function(e,t){var n={};"InheritType"in t&&(n.inheritType=parseInt(t.InheritType.value)),n.eulerOrder="RotationOrder"in t?Gg(t.RotationOrder.value):"ZYX","Lcl_Translation"in t&&(n.translation=t.Lcl_Translation.value),"PreRotation"in t&&(n.preRotation=t.PreRotation.value),"Lcl_Rotation"in t&&(n.rotation=t.Lcl_Rotation.value),"PostRotation"in t&&(n.postRotation=t.PostRotation.value),"Lcl_Scaling"in t&&(n.scale=t.Lcl_Scaling.value),"ScalingOffset"in t&&(n.scalingOffset=t.ScalingOffset.value),"ScalingPivot"in t&&(n.scalingPivot=t.ScalingPivot.value),"RotationOffset"in t&&(n.rotationOffset=t.RotationOffset.value),"RotationPivot"in t&&(n.rotationPivot=t.RotationPivot.value),e.userData.transformData=n}},{key:"setLookAtProperties",value:function(e,t){"LookAtProperty"in t&&wg.get(e.ID).children.forEach((function(t){if("LookAtProperty"===t.relationship){var n=bg.Objects.Model[t.ID];if("Lcl_Translation"in n){var r=n.Lcl_Translation.value;void 0!==e.target?(e.target.position.fromArray(r),Tg.add(e.target)):e.lookAt((new Yr).fromArray(r))}}}))}},{key:"bindSkeleton",value:function(e,t,n){var r=this.parsePoseNodes(),i=function(){var i=e[a];wg.get(parseInt(i.ID)).parents.forEach((function(e){if(t.has(e.ID)){var a=e.ID;wg.get(a).parents.forEach((function(e){n.has(e.ID)&&n.get(e.ID).bind(new Yl(i.bones),r[e.ID])}))}}))};for(var a in e)i()}},{key:"parsePoseNodes",value:function(){var e={};if("Pose"in bg.Objects){var t=bg.Objects.Pose;for(var n in t)if("BindPose"===t[n].attrType&&t[n].NbPoseNodes>0){var r=t[n].PoseNode;Array.isArray(r)?r.forEach((function(t){e[t.Node]=(new wi).fromArray(t.Matrix.a)})):e[r.Node]=(new wi).fromArray(r.Matrix.a)}}return e}},{key:"createAmbientLight",value:function(){if("GlobalSettings"in bg&&"AmbientColor"in bg.GlobalSettings){var e=bg.GlobalSettings.AmbientColor.value,t=e[0],n=e[1],r=e[2];if(0!==t||0!==n||0!==r){var i=new pa(t,n,r).convertSRGBToLinear();Tg.add(new af(i,1))}}}}]),e}(),kg=function(){function e(){a(this,e),this.negativeMaterialIndices=!1}return s(e,[{key:"parse",value:function(e){var t=new Map;if("Geometry"in bg.Objects){var n=bg.Objects.Geometry;for(var r in n){var i=wg.get(parseInt(r)),a=this.parseGeometry(i,n[r],e);t.set(parseInt(r),a)}}return!0===this.negativeMaterialIndices&&console.warn("THREE.FBXLoader: The FBX file contains invalid (negative) material indices. The asset might not render as expected."),t}},{key:"parseGeometry",value:function(e,t,n){switch(t.attrType){case"Mesh":return this.parseMeshGeometry(e,t,n);case"NurbsCurve":return this.parseNurbsGeometry(t)}}},{key:"parseMeshGeometry",value:function(e,t,n){var r=n.skeletons,i=[],a=e.parents.map((function(e){return bg.Objects.Model[e.ID]}));if(0!==a.length){var o=e.children.reduce((function(e,t){return void 0!==r[t.ID]&&(e=r[t.ID]),e}),null);e.children.forEach((function(e){void 0!==n.morphTargets[e.ID]&&i.push(n.morphTargets[e.ID])}));var s=a[0],u={};"RotationOrder"in s&&(u.eulerOrder=Gg(s.RotationOrder.value)),"InheritType"in s&&(u.inheritType=parseInt(s.InheritType.value)),"GeometricTranslation"in s&&(u.translation=s.GeometricTranslation.value),"GeometricRotation"in s&&(u.rotation=s.GeometricRotation.value),"GeometricScaling"in s&&(u.scale=s.GeometricScaling.value);var l=Hg(u);return this.genGeometry(t,o,i,l)}}},{key:"genGeometry",value:function(e,t,n,r){var i=new Ga;e.attrName&&(i.name=e.attrName);var a=this.parseGeoNode(e,t),o=this.genBuffers(a),s=new Ia(o.vertex,3);if(s.applyMatrix4(r),i.setAttribute("position",s),o.colors.length>0&&i.setAttribute("color",new Ia(o.colors,3)),t&&(i.setAttribute("skinIndex",new ka(o.weightsIndices,4)),i.setAttribute("skinWeight",new Ia(o.vertexWeights,4)),i.FBX_Deformer=t),o.normal.length>0){var u=(new gr).getNormalMatrix(r),l=new Ia(o.normal,3);l.applyNormalMatrix(u),i.setAttribute("normal",l)}if(o.uvs.forEach((function(e,t){var n=0===t?"uv":"uv".concat(t);i.setAttribute(n,new Ia(o.uvs[t],2))})),a.material&&"AllSame"!==a.material.mappingType){var c=o.materialIndex[0],h=0;if(o.materialIndex.forEach((function(e,t){e!==c&&(i.addGroup(h,t-h,c),c=e,h=t)})),i.groups.length>0){var d=i.groups[i.groups.length-1],f=d.start+d.count;f!==o.materialIndex.length&&i.addGroup(f,o.materialIndex.length-f,c)}0===i.groups.length&&i.addGroup(0,o.materialIndex.length,o.materialIndex[0])}return this.addMorphTargets(i,e,n,r),i}},{key:"parseGeoNode",value:function(e,t){var n={};if(n.vertexPositions=void 0!==e.Vertices?e.Vertices.a:[],n.vertexIndices=void 0!==e.PolygonVertexIndex?e.PolygonVertexIndex.a:[],e.LayerElementColor&&(n.color=this.parseVertexColors(e.LayerElementColor[0])),e.LayerElementMaterial&&(n.material=this.parseMaterialIndices(e.LayerElementMaterial[0])),e.LayerElementNormal&&(n.normal=this.parseNormals(e.LayerElementNormal[0])),e.LayerElementUV){n.uv=[];for(var r=0;e.LayerElementUV[r];)e.LayerElementUV[r].UV&&n.uv.push(this.parseUVs(e.LayerElementUV[r])),r++}return n.weightTable={},null!==t&&(n.skeleton=t,t.rawBones.forEach((function(e,t){e.indices.forEach((function(r,i){void 0===n.weightTable[r]&&(n.weightTable[r]=[]),n.weightTable[r].push({id:t,weight:e.weights[i]})}))}))),n}},{key:"genBuffers",value:function(e){var t={vertex:[],normal:[],colors:[],uvs:[],materialIndex:[],vertexWeights:[],weightsIndices:[]},n=0,r=0,i=!1,a=[],o=[],s=[],u=[],l=[],c=[],h=this;return e.vertexIndices.forEach((function(d,f){var p,v=!1;d<0&&(d^=-1,v=!0);var m=[],g=[];if(a.push(3*d,3*d+1,3*d+2),e.color){var y=Fg(f,n,d,e.color);s.push(y[0],y[1],y[2])}if(e.skeleton){if(void 0!==e.weightTable[d]&&e.weightTable[d].forEach((function(e){g.push(e.weight),m.push(e.id)})),g.length>4){i||(console.warn("THREE.FBXLoader: Vertex has more than 4 skinning weights assigned to vertex. Deleting additional weights."),i=!0);var _=[0,0,0,0],x=[0,0,0,0];g.forEach((function(e,t){var n=e,r=m[t];x.forEach((function(e,t,i){if(n>e){i[t]=n,n=e;var a=_[t];_[t]=r,r=a}}))})),m=_,g=x}for(;g.length<4;)g.push(0),m.push(0);for(var M=0;M<4;++M)l.push(g[M]),c.push(m[M])}if(e.normal){var S=Fg(f,n,d,e.normal);o.push(S[0],S[1],S[2])}e.material&&"AllSame"!==e.material.mappingType&&(p=Fg(f,n,d,e.material)[0])<0&&(h.negativeMaterialIndices=!0,p=0),e.uv&&e.uv.forEach((function(e,t){var r=Fg(f,n,d,e);void 0===u[t]&&(u[t]=[]),u[t].push(r[0]),u[t].push(r[1])})),r++,v&&(r>4&&console.warn("THREE.FBXLoader: Polygons with more than four sides are not supported. Make sure to triangulate the geometry during export."),h.genFace(t,e,a,p,o,s,u,l,c,r),n++,r=0,a=[],o=[],s=[],u=[],l=[],c=[])})),t}},{key:"genFace",value:function(e,t,n,r,i,a,o,s,u,l){for(var c=function(l){e.vertex.push(t.vertexPositions[n[0]]),e.vertex.push(t.vertexPositions[n[1]]),e.vertex.push(t.vertexPositions[n[2]]),e.vertex.push(t.vertexPositions[n[3*(l-1)]]),e.vertex.push(t.vertexPositions[n[3*(l-1)+1]]),e.vertex.push(t.vertexPositions[n[3*(l-1)+2]]),e.vertex.push(t.vertexPositions[n[3*l]]),e.vertex.push(t.vertexPositions[n[3*l+1]]),e.vertex.push(t.vertexPositions[n[3*l+2]]),t.skeleton&&(e.vertexWeights.push(s[0]),e.vertexWeights.push(s[1]),e.vertexWeights.push(s[2]),e.vertexWeights.push(s[3]),e.vertexWeights.push(s[4*(l-1)]),e.vertexWeights.push(s[4*(l-1)+1]),e.vertexWeights.push(s[4*(l-1)+2]),e.vertexWeights.push(s[4*(l-1)+3]),e.vertexWeights.push(s[4*l]),e.vertexWeights.push(s[4*l+1]),e.vertexWeights.push(s[4*l+2]),e.vertexWeights.push(s[4*l+3]),e.weightsIndices.push(u[0]),e.weightsIndices.push(u[1]),e.weightsIndices.push(u[2]),e.weightsIndices.push(u[3]),e.weightsIndices.push(u[4*(l-1)]),e.weightsIndices.push(u[4*(l-1)+1]),e.weightsIndices.push(u[4*(l-1)+2]),e.weightsIndices.push(u[4*(l-1)+3]),e.weightsIndices.push(u[4*l]),e.weightsIndices.push(u[4*l+1]),e.weightsIndices.push(u[4*l+2]),e.weightsIndices.push(u[4*l+3])),t.color&&(e.colors.push(a[0]),e.colors.push(a[1]),e.colors.push(a[2]),e.colors.push(a[3*(l-1)]),e.colors.push(a[3*(l-1)+1]),e.colors.push(a[3*(l-1)+2]),e.colors.push(a[3*l]),e.colors.push(a[3*l+1]),e.colors.push(a[3*l+2])),t.material&&"AllSame"!==t.material.mappingType&&(e.materialIndex.push(r),e.materialIndex.push(r),e.materialIndex.push(r)),t.normal&&(e.normal.push(i[0]),e.normal.push(i[1]),e.normal.push(i[2]),e.normal.push(i[3*(l-1)]),e.normal.push(i[3*(l-1)+1]),e.normal.push(i[3*(l-1)+2]),e.normal.push(i[3*l]),e.normal.push(i[3*l+1]),e.normal.push(i[3*l+2])),t.uv&&t.uv.forEach((function(t,n){void 0===e.uvs[n]&&(e.uvs[n]=[]),e.uvs[n].push(o[n][0]),e.uvs[n].push(o[n][1]),e.uvs[n].push(o[n][2*(l-1)]),e.uvs[n].push(o[n][2*(l-1)+1]),e.uvs[n].push(o[n][2*l]),e.uvs[n].push(o[n][2*l+1])}))},h=2;h<l;h++)c(h)}},{key:"addMorphTargets",value:function(e,t,n,r){if(0!==n.length){e.morphTargetsRelative=!0,e.morphAttributes.position=[];var i=this;n.forEach((function(n){n.rawTargets.forEach((function(n){var a=bg.Objects.Geometry[n.geoID];void 0!==a&&i.genMorphGeometry(e,t,a,r,n.name)}))}))}}},{key:"genMorphGeometry",value:function(e,t,n,r,i){for(var a=void 0!==t.PolygonVertexIndex?t.PolygonVertexIndex.a:[],o=void 0!==n.Vertices?n.Vertices.a:[],s=void 0!==n.Indexes?n.Indexes.a:[],u=3*e.attributes.position.count,l=new Float32Array(u),c=0;c<s.length;c++){var h=3*s[c];l[h]=o[3*c],l[h+1]=o[3*c+1],l[h+2]=o[3*c+2]}var d={vertexIndices:a,vertexPositions:l},f=this.genBuffers(d),p=new Ia(f.vertex,3);p.name=i||n.attrName,p.applyMatrix4(r),e.morphAttributes.position.push(p)}},{key:"parseNormals",value:function(e){var t=e.MappingInformationType,n=e.ReferenceInformationType,r=e.Normals.a,i=[];return"IndexToDirect"===n&&("NormalIndex"in e?i=e.NormalIndex.a:"NormalsIndex"in e&&(i=e.NormalsIndex.a)),{dataSize:3,buffer:r,indices:i,mappingType:t,referenceType:n}}},{key:"parseUVs",value:function(e){var t=e.MappingInformationType,n=e.ReferenceInformationType,r=e.UV.a,i=[];return"IndexToDirect"===n&&(i=e.UVIndex.a),{dataSize:2,buffer:r,indices:i,mappingType:t,referenceType:n}}},{key:"parseVertexColors",value:function(e){var t=e.MappingInformationType,n=e.ReferenceInformationType,r=e.Colors.a,i=[];"IndexToDirect"===n&&(i=e.ColorIndex.a);for(var a=0,o=new pa;a<r.length;a+=4)o.fromArray(r,a).convertSRGBToLinear().toArray(r,a);return{dataSize:4,buffer:r,indices:i,mappingType:t,referenceType:n}}},{key:"parseMaterialIndices",value:function(e){var t=e.MappingInformationType,n=e.ReferenceInformationType;if("NoMappingInformation"===t)return{dataSize:1,buffer:[0],indices:[0],mappingType:"AllSame",referenceType:n};for(var r=e.Materials.a,i=[],a=0;a<r.length;++a)i.push(a);return{dataSize:1,buffer:r,indices:i,mappingType:t,referenceType:n}}},{key:"parseNurbsGeometry",value:function(e){var t=parseInt(e.Order);if(isNaN(t))return console.error("THREE.FBXLoader: Invalid Order %s given for geometry ID: %s",e.Order,e.id),new Ga;for(var n,r,i=t-1,a=e.KnotVector.a,o=[],s=e.Points.a,u=0,l=s.length;u<l;u+=4)o.push((new Br).fromArray(s,u));if("Closed"===e.Form)o.push(o[0]);else if("Periodic"===e.Form){n=i,r=a.length-1-n;for(var c=0;c<i;++c)o.push(o[c])}var h=new Eg(i,a,o,n,r).getPoints(12*o.length);return(new Ga).setFromPoints(h)}}]),e}(),Cg=function(){function e(){a(this,e)}return s(e,[{key:"parse",value:function(){var e=[],t=this.parseClips();if(void 0!==t)for(var n in t){var r=t[n],i=this.addClip(r);e.push(i)}return e}},{key:"parseClips",value:function(){if(void 0!==bg.Objects.AnimationCurve){var e=this.parseAnimationCurveNodes();this.parseAnimationCurves(e);var t=this.parseAnimationLayers(e);return this.parseAnimStacks(t)}}},{key:"parseAnimationCurveNodes",value:function(){var e=bg.Objects.AnimationCurveNode,t=new Map;for(var n in e){var r=e[n];if(null!==r.attrName.match(/S|R|T|DeformPercent/)){var i={id:r.id,attr:r.attrName,curves:{}};t.set(i.id,i)}}return t}},{key:"parseAnimationCurves",value:function(e){var t=bg.Objects.AnimationCurve;for(var n in t){var r={id:t[n].id,times:t[n].KeyTime.a.map(Og),values:t[n].KeyValueFloat.a},i=wg.get(r.id);if(void 0!==i){var a=i.parents[0].ID,o=i.parents[0].relationship;o.match(/X/)?e.get(a).curves.x=r:o.match(/Y/)?e.get(a).curves.y=r:o.match(/Z/)?e.get(a).curves.z=r:o.match(/DeformPercent/)&&e.has(a)&&(e.get(a).curves.morph=r)}}}},{key:"parseAnimationLayers",value:function(e){var t=bg.Objects.AnimationLayer,n=new Map,r=function(){var t=[],r=wg.get(parseInt(i));void 0!==r&&(r.children.forEach((function(n,r){if(e.has(n.ID)){var i=e.get(n.ID);if(void 0!==i.curves.x||void 0!==i.curves.y||void 0!==i.curves.z){if(void 0===t[r]){var a=wg.get(n.ID).parents.filter((function(e){return void 0!==e.relationship}))[0].ID;if(void 0!==a){var o=bg.Objects.Model[a.toString()];if(void 0===o)return void console.warn("THREE.FBXLoader: Encountered a unused curve.",n);var s={modelName:o.attrName?Yf.sanitizeNodeName(o.attrName):"",ID:o.id,initialPosition:[0,0,0],initialRotation:[0,0,0],initialScale:[1,1,1]};Tg.traverse((function(e){e.ID===o.id&&(s.transform=e.matrix,e.userData.transformData&&(s.eulerOrder=e.userData.transformData.eulerOrder))})),s.transform||(s.transform=new wi),"PreRotation"in o&&(s.preRotation=o.PreRotation.value),"PostRotation"in o&&(s.postRotation=o.PostRotation.value),t[r]=s}}t[r]&&(t[r][i.attr]=i)}else if(void 0!==i.curves.morph){if(void 0===t[r]){var u=wg.get(n.ID).parents.filter((function(e){return void 0!==e.relationship}))[0].ID,l=wg.get(u).parents[0].ID,c=wg.get(l).parents[0].ID,h=wg.get(c).parents[0].ID,d=bg.Objects.Model[h],f={modelName:d.attrName?Yf.sanitizeNodeName(d.attrName):"",morphName:bg.Objects.Deformer[u].attrName};t[r]=f}t[r][i.attr]=i}}})),n.set(parseInt(i),t))};for(var i in t)r();return n}},{key:"parseAnimStacks",value:function(e){var t=bg.Objects.AnimationStack,n={};for(var r in t){var i=wg.get(parseInt(r)).children;i.length>1&&console.warn("THREE.FBXLoader: Encountered an animation stack with multiple layers, this is currently not supported. Ignoring subsequent layers.");var a=e.get(i[0].ID);n[r]={name:t[r].attrName,layer:a}}return n}},{key:"addClip",value:function(e){var t=[],n=this;return e.layer.forEach((function(e){t=t.concat(n.generateTracks(e))})),new Ad(e.name,-1,t)}},{key:"generateTracks",value:function(e){var t=[],n=new Yr,r=new qr,i=new Yr;if(e.transform&&e.transform.decompose(n,r,i),n=n.toArray(),r=(new Di).setFromQuaternion(r,e.eulerOrder).toArray(),i=i.toArray(),void 0!==e.T&&Object.keys(e.T.curves).length>0){var a=this.generateVectorTrack(e.modelName,e.T.curves,n,"position");void 0!==a&&t.push(a)}if(void 0!==e.R&&Object.keys(e.R.curves).length>0){var o=this.generateRotationTrack(e.modelName,e.R.curves,r,e.preRotation,e.postRotation,e.eulerOrder);void 0!==o&&t.push(o)}if(void 0!==e.S&&Object.keys(e.S.curves).length>0){var s=this.generateVectorTrack(e.modelName,e.S.curves,i,"scale");void 0!==s&&t.push(s)}if(void 0!==e.DeformPercent){var u=this.generateMorphTrack(e);void 0!==u&&t.push(u)}return t}},{key:"generateVectorTrack",value:function(e,t,n,r){var i=this.getTimesForAllAxes(t),a=this.getKeyframeTrackValues(i,t,n);return new Ed(e+"."+r,i,a)}},{key:"generateRotationTrack",value:function(e,t,n,r,i,a){void 0!==t.x&&(this.interpolateRotations(t.x),t.x.values=t.x.values.map(vr.degToRad)),void 0!==t.y&&(this.interpolateRotations(t.y),t.y.values=t.y.values.map(vr.degToRad)),void 0!==t.z&&(this.interpolateRotations(t.z),t.z.values=t.z.values.map(vr.degToRad));var o=this.getTimesForAllAxes(t),s=this.getKeyframeTrackValues(o,t,n);void 0!==r&&((r=r.map(vr.degToRad)).push(a),r=(new Di).fromArray(r),r=(new qr).setFromEuler(r)),void 0!==i&&((i=i.map(vr.degToRad)).push(a),i=(new Di).fromArray(i),i=(new qr).setFromEuler(i).invert());for(var u=new qr,l=new Di,c=[],h=0;h<s.length;h+=3)l.set(s[h],s[h+1],s[h+2],a),u.setFromEuler(l),void 0!==r&&u.premultiply(r),void 0!==i&&u.multiply(i),u.toArray(c,h/3*4);return new wd(e+".quaternion",o,c)}},{key:"generateMorphTrack",value:function(e){var t=e.DeformPercent.curves.morph,n=t.values.map((function(e){return e/100})),r=Tg.getObjectByName(e.modelName).morphTargetDictionary[e.morphName];return new Sd(e.modelName+".morphTargetInfluences["+r+"]",t.times,n)}},{key:"getTimesForAllAxes",value:function(e){var t=[];if(void 0!==e.x&&(t=t.concat(e.x.times)),void 0!==e.y&&(t=t.concat(e.y.times)),void 0!==e.z&&(t=t.concat(e.z.times)),t=t.sort((function(e,t){return e-t})),t.length>1){for(var n=1,r=t[0],i=1;i<t.length;i++){var a=t[i];a!==r&&(t[n]=a,r=a,n++)}t=t.slice(0,n)}return t}},{key:"getKeyframeTrackValues",value:function(e,t,n){var r=n,i=[],a=-1,o=-1,s=-1;return e.forEach((function(e){if(t.x&&(a=t.x.times.indexOf(e)),t.y&&(o=t.y.times.indexOf(e)),t.z&&(s=t.z.times.indexOf(e)),-1!==a){var n=t.x.values[a];i.push(n),r[0]=n}else i.push(r[0]);if(-1!==o){var u=t.y.values[o];i.push(u),r[1]=u}else i.push(r[1]);if(-1!==s){var l=t.z.values[s];i.push(l),r[2]=l}else i.push(r[2])})),i}},{key:"interpolateRotations",value:function(e){for(var t=1;t<e.values.length;t++){var n=e.values[t-1],r=e.values[t]-n,i=Math.abs(r);if(i>=180){for(var a=i/180,o=r/a,s=n+o,u=e.times[t-1],l=(e.times[t]-u)/a,c=u+l,h=[],d=[];c<e.times[t];)h.push(c),c+=l,d.push(s),s+=o;e.times=jg(e.times,t,h),e.values=jg(e.values,t,d)}}}}]),e}(),Lg=function(){function e(){a(this,e)}return s(e,[{key:"getPrevNode",value:function(){return this.nodeStack[this.currentIndent-2]}},{key:"getCurrentNode",value:function(){return this.nodeStack[this.currentIndent-1]}},{key:"getCurrentProp",value:function(){return this.currentProp}},{key:"pushStack",value:function(e){this.nodeStack.push(e),this.currentIndent+=1}},{key:"popStack",value:function(){this.nodeStack.pop(),this.currentIndent-=1}},{key:"setCurrentProp",value:function(e,t){this.currentProp=e,this.currentPropName=t}},{key:"parse",value:function(e){this.currentIndent=0,this.allNodes=new Dg,this.nodeStack=[],this.currentProp=[],this.currentPropName="";var t=this,n=e.split(/[\r\n]+/);return n.forEach((function(e,r){var i=e.match(/^[\s\t]*;/),a=e.match(/^[\s\t]*$/);if(!i&&!a){var o=e.match("^\\t{"+t.currentIndent+"}(\\w+):(.*){",""),s=e.match("^\\t{"+t.currentIndent+"}(\\w+):[\\s\\t\\r\\n](.*)"),u=e.match("^\\t{"+(t.currentIndent-1)+"}}");o?t.parseNodeBegin(e,o):s?t.parseNodeProperty(e,s,n[++r]):u?t.popStack():e.match(/^[^\s\t}]/)&&t.parseNodePropertyContinued(e)}})),this.allNodes}},{key:"parseNodeBegin",value:function(e,t){var n=t[1].trim().replace(/^"/,"").replace(/"$/,""),r=t[2].split(",").map((function(e){return e.trim().replace(/^"/,"").replace(/"$/,"")})),i={name:n},a=this.parseNodeAttr(r),o=this.getCurrentNode();0===this.currentIndent?this.allNodes.add(n,i):n in o?("PoseNode"===n?o.PoseNode.push(i):void 0!==o[n].id&&(o[n]={},o[n][o[n].id]=o[n]),""!==a.id&&(o[n][a.id]=i)):"number"==typeof a.id?(o[n]={},o[n][a.id]=i):"Properties70"!==n&&(o[n]="PoseNode"===n?[i]:i),"number"==typeof a.id&&(i.id=a.id),""!==a.name&&(i.attrName=a.name),""!==a.type&&(i.attrType=a.type),this.pushStack(i)}},{key:"parseNodeAttr",value:function(e){var t=e[0];""!==e[0]&&(t=parseInt(e[0]),isNaN(t)&&(t=e[0]));var n="",r="";return e.length>1&&(n=e[1].replace(/^(\w+)::/,""),r=e[2]),{id:t,name:n,type:r}}},{key:"parseNodeProperty",value:function(e,t,n){var r=t[1].replace(/^"/,"").replace(/"$/,"").trim(),i=t[2].replace(/^"/,"").replace(/"$/,"").trim();"Content"===r&&","===i&&(i=n.replace(/"/g,"").replace(/,$/,"").trim());var a=this.getCurrentNode();if("Properties70"!==a.name){if("C"===r){var o=i.split(",").slice(1),s=parseInt(o[0]),u=parseInt(o[1]),l=i.split(",").slice(3);r="connections",function(e,t){for(var n=0,r=e.length,i=t.length;n<i;n++,r++)e[r]=t[n]}(i=[s,u],l=l.map((function(e){return e.trim().replace(/^"/,"")}))),void 0===a[r]&&(a[r]=[])}"Node"===r&&(a.id=i),r in a&&Array.isArray(a[r])?a[r].push(i):"a"!==r?a[r]=i:a.a=i,this.setCurrentProp(a,r),"a"===r&&","!==i.slice(-1)&&(a.a=Vg(i))}else this.parseNodeSpecialProperty(e,r,i)}},{key:"parseNodePropertyContinued",value:function(e){var t=this.getCurrentNode();t.a+=e,","!==e.slice(-1)&&(t.a=Vg(t.a))}},{key:"parseNodeSpecialProperty",value:function(e,t,n){var r=n.split('",').map((function(e){return e.trim().replace(/^\"/,"").replace(/\s/,"_")})),i=r[0],a=r[1],o=r[2],s=r[3],u=r[4];switch(a){case"int":case"enum":case"bool":case"ULongLong":case"double":case"Number":case"FieldOfView":u=parseFloat(u);break;case"Color":case"ColorRGB":case"Vector3D":case"Lcl_Translation":case"Lcl_Rotation":case"Lcl_Scaling":u=Vg(u)}this.getPrevNode()[i]={type:a,type2:o,flag:s,value:u},this.setCurrentProp(this.getPrevNode(),i)}}]),e}(),Pg=function(){function e(){a(this,e)}return s(e,[{key:"parse",value:function(e){var t=new Ig(e);t.skip(23);var n=t.getUint32();if(n<6400)throw new Error("THREE.FBXLoader: FBX version not supported, FileVersion: "+n);for(var r=new Dg;!this.endOfContent(t);){var i=this.parseNode(t,n);null!==i&&r.add(i.name,i)}return r}},{key:"endOfContent",value:function(e){return e.size()%16==0?(e.getOffset()+160+16&-16)>=e.size():e.getOffset()+160+16>=e.size()}},{key:"parseNode",value:function(e,t){var n={},r=t>=7500?e.getUint64():e.getUint32(),i=t>=7500?e.getUint64():e.getUint32();t>=7500?e.getUint64():e.getUint32();var a=e.getUint8(),o=e.getString(a);if(0===r)return null;for(var s=[],u=0;u<i;u++)s.push(this.parseProperty(e));var l=s.length>0?s[0]:"",c=s.length>1?s[1]:"",h=s.length>2?s[2]:"";for(n.singleProperty=1===i&&e.getOffset()===r;r>e.getOffset();){var d=this.parseNode(e,t);null!==d&&this.parseSubNode(o,n,d)}return n.propertyList=s,"number"==typeof l&&(n.id=l),""!==c&&(n.attrName=c),""!==h&&(n.attrType=h),""!==o&&(n.name=o),n}},{key:"parseSubNode",value:function(e,t,n){if(!0===n.singleProperty){var r=n.propertyList[0];Array.isArray(r)?(t[n.name]=n,n.a=r):t[n.name]=r}else if("Connections"===e&&"C"===n.name){var i=[];n.propertyList.forEach((function(e,t){0!==t&&i.push(e)})),void 0===t.connections&&(t.connections=[]),t.connections.push(i)}else if("Properties70"===n.name){Object.keys(n).forEach((function(e){t[e]=n[e]}))}else if("Properties70"===e&&"P"===n.name){var a,o=n.propertyList[0],s=n.propertyList[1],u=n.propertyList[2],l=n.propertyList[3];0===o.indexOf("Lcl ")&&(o=o.replace("Lcl ","Lcl_")),0===s.indexOf("Lcl ")&&(s=s.replace("Lcl ","Lcl_")),a="Color"===s||"ColorRGB"===s||"Vector"===s||"Vector3D"===s||0===s.indexOf("Lcl_")?[n.propertyList[4],n.propertyList[5],n.propertyList[6]]:n.propertyList[4],t[o]={type:s,type2:u,flag:l,value:a}}else void 0===t[n.name]?"number"==typeof n.id?(t[n.name]={},t[n.name][n.id]=n):t[n.name]=n:"PoseNode"===n.name?(Array.isArray(t[n.name])||(t[n.name]=[t[n.name]]),t[n.name].push(n)):void 0===t[n.name][n.id]&&(t[n.name][n.id]=n)}},{key:"parseProperty",value:function(e){var t,n=e.getString(1);switch(n){case"C":return e.getBoolean();case"D":return e.getFloat64();case"F":return e.getFloat32();case"I":return e.getInt32();case"L":return e.getInt64();case"R":return t=e.getUint32(),e.getArrayBuffer(t);case"S":return t=e.getUint32(),e.getString(t);case"Y":return e.getInt16();case"b":case"c":case"d":case"f":case"i":case"l":var r=e.getUint32(),i=e.getUint32(),a=e.getUint32();if(0===i)switch(n){case"b":case"c":return e.getBooleanArray(r);case"d":return e.getFloat64Array(r);case"f":return e.getFloat32Array(r);case"i":return e.getInt32Array(r);case"l":return e.getInt64Array(r)}var o=mg(new Uint8Array(e.getArrayBuffer(a))),s=new Ig(o.buffer);switch(n){case"b":case"c":return s.getBooleanArray(r);case"d":return s.getFloat64Array(r);case"f":return s.getFloat32Array(r);case"i":return s.getInt32Array(r);case"l":return s.getInt64Array(r)}break;default:throw new Error("THREE.FBXLoader: Unknown property type "+n)}}}]),e}(),Ig=function(){function e(t,n){a(this,e),this.dv=new DataView(t),this.offset=0,this.littleEndian=void 0===n||n,this._textDecoder=new TextDecoder}return s(e,[{key:"getOffset",value:function(){return this.offset}},{key:"size",value:function(){return this.dv.buffer.byteLength}},{key:"skip",value:function(e){this.offset+=e}},{key:"getBoolean",value:function(){return 1==(1&this.getUint8())}},{key:"getBooleanArray",value:function(e){for(var t=[],n=0;n<e;n++)t.push(this.getBoolean());return t}},{key:"getUint8",value:function(){var e=this.dv.getUint8(this.offset);return this.offset+=1,e}},{key:"getInt16",value:function(){var e=this.dv.getInt16(this.offset,this.littleEndian);return this.offset+=2,e}},{key:"getInt32",value:function(){var e=this.dv.getInt32(this.offset,this.littleEndian);return this.offset+=4,e}},{key:"getInt32Array",value:function(e){for(var t=[],n=0;n<e;n++)t.push(this.getInt32());return t}},{key:"getUint32",value:function(){var e=this.dv.getUint32(this.offset,this.littleEndian);return this.offset+=4,e}},{key:"getInt64",value:function(){var e,t;return this.littleEndian?(e=this.getUint32(),t=this.getUint32()):(t=this.getUint32(),e=this.getUint32()),2147483648&t?(t=4294967295&~t,4294967295===(e=4294967295&~e)&&(t=t+1&4294967295),-(4294967296*t+(e=e+1&4294967295))):4294967296*t+e}},{key:"getInt64Array",value:function(e){for(var t=[],n=0;n<e;n++)t.push(this.getInt64());return t}},{key:"getUint64",value:function(){var e,t;return this.littleEndian?(e=this.getUint32(),t=this.getUint32()):(t=this.getUint32(),e=this.getUint32()),4294967296*t+e}},{key:"getFloat32",value:function(){var e=this.dv.getFloat32(this.offset,this.littleEndian);return this.offset+=4,e}},{key:"getFloat32Array",value:function(e){for(var t=[],n=0;n<e;n++)t.push(this.getFloat32());return t}},{key:"getFloat64",value:function(){var e=this.dv.getFloat64(this.offset,this.littleEndian);return this.offset+=8,e}},{key:"getFloat64Array",value:function(e){for(var t=[],n=0;n<e;n++)t.push(this.getFloat64());return t}},{key:"getArrayBuffer",value:function(e){var t=this.dv.buffer.slice(this.offset,this.offset+e);return this.offset+=e,t}},{key:"getString",value:function(e){var t=this.offset,n=new Uint8Array(this.dv.buffer,t,e);this.skip(e);var r=n.indexOf(0);return r>=0&&(n=new Uint8Array(this.dv.buffer,t,r)),this._textDecoder.decode(n)}}]),e}(),Dg=function(){function e(){a(this,e)}return s(e,[{key:"add",value:function(e,t){this[e]=t}}]),e}();function Ug(e){var t=e.match(/FBXVersion: (\d+)/);if(t)return parseInt(t[1]);throw new Error("THREE.FBXLoader: Cannot find the version number for the file given.")}function Og(e){return e/46186158e3}var Ng=[];function Fg(e,t,n,r){var i;switch(r.mappingType){case"ByPolygonVertex":i=e;break;case"ByPolygon":i=t;break;case"ByVertice":i=n;break;case"AllSame":i=r.indices[0];break;default:console.warn("THREE.FBXLoader: unknown attribute mapping type "+r.mappingType)}"IndexToDirect"===r.referenceType&&(i=r.indices[i]);var a=i*r.dataSize,o=a+r.dataSize;return function(e,t,n,r){for(var i=n,a=0;i<r;i++,a++)e[a]=t[i];return e}(Ng,r.buffer,a,o)}var Bg=new Di,zg=new Yr;function Hg(e){var t=new wi,n=new wi,r=new wi,i=new wi,a=new wi,o=new wi,s=new wi,u=new wi,l=new wi,c=new wi,h=new wi,d=new wi,f=e.inheritType?e.inheritType:0;if(e.translation&&t.setPosition(zg.fromArray(e.translation)),e.preRotation){var p=e.preRotation.map(vr.degToRad);p.push(e.eulerOrder||Di.DEFAULT_ORDER),n.makeRotationFromEuler(Bg.fromArray(p))}if(e.rotation){var v=e.rotation.map(vr.degToRad);v.push(e.eulerOrder||Di.DEFAULT_ORDER),r.makeRotationFromEuler(Bg.fromArray(v))}if(e.postRotation){var m=e.postRotation.map(vr.degToRad);m.push(e.eulerOrder||Di.DEFAULT_ORDER),i.makeRotationFromEuler(Bg.fromArray(m)),i.invert()}e.scale&&a.scale(zg.fromArray(e.scale)),e.scalingOffset&&s.setPosition(zg.fromArray(e.scalingOffset)),e.scalingPivot&&o.setPosition(zg.fromArray(e.scalingPivot)),e.rotationOffset&&u.setPosition(zg.fromArray(e.rotationOffset)),e.rotationPivot&&l.setPosition(zg.fromArray(e.rotationPivot)),e.parentMatrixWorld&&(h.copy(e.parentMatrix),c.copy(e.parentMatrixWorld));var g=n.clone().multiply(r).multiply(i),y=new wi;y.extractRotation(c);var _=new wi;_.copyPosition(c);var x=_.clone().invert().multiply(c),M=y.clone().invert().multiply(x),S=a,b=new wi;if(0===f)b.copy(y).multiply(g).multiply(M).multiply(S);else if(1===f)b.copy(y).multiply(M).multiply(g).multiply(S);else{var w=(new wi).scale((new Yr).setFromMatrixScale(h)).clone().invert(),T=M.clone().multiply(w);b.copy(y).multiply(g).multiply(T).multiply(S)}var E=l.clone().invert(),A=o.clone().invert(),R=t.clone().multiply(u).multiply(l).multiply(n).multiply(r).multiply(i).multiply(E).multiply(s).multiply(o).multiply(a).multiply(A),k=(new wi).copyPosition(R),C=c.clone().multiply(k);return d.copyPosition(C),(R=d.clone().multiply(b)).premultiply(c.invert()),R}function Gg(e){var t=["ZYX","YZX","XZY","ZXY","YXZ","XYZ"];return 6===(e=e||0)?(console.warn("THREE.FBXLoader: unsupported Euler Order: Spherical XYZ. Animations and rotations may be incorrect."),t[0]):t[e]}function Vg(e){return e.split(",").map((function(e){return parseFloat(e)}))}function Wg(e,t,n){return void 0===t&&(t=0),void 0===n&&(n=e.byteLength),(new TextDecoder).decode(new Uint8Array(e,t,n))}function jg(e,t,n){return e.slice(0,t).concat(n).concat(e.slice(t))}var Xg,qg=function(){function e(){o()(this,e)}return u()(e,[{key:"loadGLTF",value:function(e,t,n,r){var i=new Xv,a=new Vv;return a.setDecoderPath("./draco/"),a.setDecoderConfig({type:"js"}),a.preload(),i.setDRACOLoader(a),new Promise((function(a,o){i.load(e,(function(e){a(t?t(e):e)}),(function(e){n&&n(e)}),(function(e){r&&r(e),o(e)}))}))}},{key:"loadFbx",value:function(e,t,n,r){var i=new Ag;return new Promise((function(a,o){i.load(e,(function(e){a(t?t(e):e)}),(function(e){n&&n(e)}),(function(e){r&&r(e),o(e)}))}))}},{key:"parseFbxBuffer",value:function(e,t){return(new Ag).parse(e,t)}}]),e}();!function(e){e.GLTF="gltf",e.GLB="glb",e.FBX="fbx"}(Xg||(Xg={}));var Yg=function(e){return new _v(e)},Zg=new Yr(0,0,0),Kg=function(e){for(var t=e.mesh.geometry.attributes.position,n=0;n<200;n++){var r=n/199;e.getPoint(r,Zg),t.setXYZ(n,Zg.x,Zg.y,Zg.z)}t.needsUpdate=!0},Jg=function(e,t){var n=[];e.forEach((function(e){n.push(function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1,a=new uo(n,r,i),o=new ma({color:16777215*Math.random()}),s=new yv(a,o);return s.addNatureEventListener("pointermove",(function(e){t.attach(e)})),s.position.copy(e),mv.scene.add(s),s}(e,t))}));var r=function(e){var t=new Ga,n=new wa(new Float32Array(600),3);t.setAttribute("position",n);var r=new Oc(e);return r.mesh=new cc(t.clone(),new ic({color:"red",opacity:1})),r}(e);return Kg(r),t.addEventListener("objectChange",(function(){Kg(r)})),r},Qg=new ip,$g=new Yr,ey=new Yr,ty=new qr,ny={X:new Yr(1,0,0),Y:new Yr(0,1,0),Z:new Yr(0,0,1)},ry={type:"change"},iy={type:"mouseDown"},ay={type:"mouseUp",mode:null},oy={type:"objectChange"},sy=function(e){w(n,e);var t=E(n);function n(e,r){var i;a(this,n),i=t.call(this),void 0===r&&(console.warn('THREE.TransformControls: The second parameter "domElement" is now mandatory.'),r=document),i.isTransformControls=!0,i.visible=!1,i.domElement=r,i.domElement.style.touchAction="none";var o=new Ry;i._gizmo=o,i.add(o);var s=new ky;i._plane=s,i.add(s);var u=S(i);function l(e,t){var n=t;Object.defineProperty(u,e,{get:function(){return void 0!==n?n:t},set:function(t){n!==t&&(n=t,s[e]=t,o[e]=t,u.dispatchEvent({type:e+"-changed",value:t}),u.dispatchEvent(ry))}}),u[e]=t,s[e]=t,o[e]=t}l("camera",e),l("object",void 0),l("enabled",!0),l("axis",null),l("mode","translate"),l("translationSnap",null),l("rotationSnap",null),l("scaleSnap",null),l("space","world"),l("size",1),l("dragging",!1),l("showX",!0),l("showY",!0),l("showZ",!0);var c=new Yr,h=new Yr,d=new qr,f=new qr,p=new Yr,v=new qr,m=new Yr,g=new Yr,y=new Yr,_=new Yr;return l("worldPosition",c),l("worldPositionStart",h),l("worldQuaternion",d),l("worldQuaternionStart",f),l("cameraPosition",p),l("cameraQuaternion",v),l("pointStart",m),l("pointEnd",g),l("rotationAxis",y),l("rotationAngle",0),l("eye",_),i._offset=new Yr,i._startNorm=new Yr,i._endNorm=new Yr,i._cameraScale=new Yr,i._parentPosition=new Yr,i._parentQuaternion=new qr,i._parentQuaternionInv=new qr,i._parentScale=new Yr,i._worldScaleStart=new Yr,i._worldQuaternionInv=new qr,i._worldScale=new Yr,i._positionStart=new Yr,i._quaternionStart=new qr,i._scaleStart=new Yr,i._getPointer=uy.bind(S(i)),i._onPointerDown=cy.bind(S(i)),i._onPointerHover=ly.bind(S(i)),i._onPointerMove=hy.bind(S(i)),i._onPointerUp=dy.bind(S(i)),i.domElement.addEventListener("pointerdown",i._onPointerDown),i.domElement.addEventListener("pointermove",i._onPointerHover),i.domElement.addEventListener("pointerup",i._onPointerUp),i}return s(n,[{key:"updateMatrixWorld",value:function(){void 0!==this.object&&(this.object.updateMatrixWorld(),null===this.object.parent?console.error("TransformControls: The attached 3D object must be a part of the scene graph."):this.object.parent.matrixWorld.decompose(this._parentPosition,this._parentQuaternion,this._parentScale),this.object.matrixWorld.decompose(this.worldPosition,this.worldQuaternion,this._worldScale),this._parentQuaternionInv.copy(this._parentQuaternion).invert(),this._worldQuaternionInv.copy(this.worldQuaternion).invert()),this.camera.updateMatrixWorld(),this.camera.matrixWorld.decompose(this.cameraPosition,this.cameraQuaternion,this._cameraScale),this.camera.isOrthographicCamera?this.camera.getWorldDirection(this.eye).negate():this.eye.copy(this.cameraPosition).sub(this.worldPosition).normalize(),y(x(n.prototype),"updateMatrixWorld",this).call(this,this)}},{key:"pointerHover",value:function(e){if(void 0!==this.object&&!0!==this.dragging){Qg.setFromCamera(e,this.camera);var t=fy(this._gizmo.picker[this.mode],Qg);this.axis=t?t.object.name:null}}},{key:"pointerDown",value:function(e){if(void 0!==this.object&&!0!==this.dragging&&0===e.button&&null!==this.axis){Qg.setFromCamera(e,this.camera);var t=fy(this._plane,Qg,!0);t&&(this.object.updateMatrixWorld(),this.object.parent.updateMatrixWorld(),this._positionStart.copy(this.object.position),this._quaternionStart.copy(this.object.quaternion),this._scaleStart.copy(this.object.scale),this.object.matrixWorld.decompose(this.worldPositionStart,this.worldQuaternionStart,this._worldScaleStart),this.pointStart.copy(t.point).sub(this.worldPositionStart)),this.dragging=!0,iy.mode=this.mode,this.dispatchEvent(iy)}}},{key:"pointerMove",value:function(e){var t=this.axis,n=this.mode,r=this.object,i=this.space;if("scale"===n?i="local":"E"!==t&&"XYZE"!==t&&"XYZ"!==t||(i="world"),void 0!==r&&null!==t&&!1!==this.dragging&&-1===e.button){Qg.setFromCamera(e,this.camera);var a=fy(this._plane,Qg,!0);if(a){if(this.pointEnd.copy(a.point).sub(this.worldPositionStart),"translate"===n)this._offset.copy(this.pointEnd).sub(this.pointStart),"local"===i&&"XYZ"!==t&&this._offset.applyQuaternion(this._worldQuaternionInv),-1===t.indexOf("X")&&(this._offset.x=0),-1===t.indexOf("Y")&&(this._offset.y=0),-1===t.indexOf("Z")&&(this._offset.z=0),"local"===i&&"XYZ"!==t?this._offset.applyQuaternion(this._quaternionStart).divide(this._parentScale):this._offset.applyQuaternion(this._parentQuaternionInv).divide(this._parentScale),r.position.copy(this._offset).add(this._positionStart),this.translationSnap&&("local"===i&&(r.position.applyQuaternion(ty.copy(this._quaternionStart).invert()),-1!==t.search("X")&&(r.position.x=Math.round(r.position.x/this.translationSnap)*this.translationSnap),-1!==t.search("Y")&&(r.position.y=Math.round(r.position.y/this.translationSnap)*this.translationSnap),-1!==t.search("Z")&&(r.position.z=Math.round(r.position.z/this.translationSnap)*this.translationSnap),r.position.applyQuaternion(this._quaternionStart)),"world"===i&&(r.parent&&r.position.add($g.setFromMatrixPosition(r.parent.matrixWorld)),-1!==t.search("X")&&(r.position.x=Math.round(r.position.x/this.translationSnap)*this.translationSnap),-1!==t.search("Y")&&(r.position.y=Math.round(r.position.y/this.translationSnap)*this.translationSnap),-1!==t.search("Z")&&(r.position.z=Math.round(r.position.z/this.translationSnap)*this.translationSnap),r.parent&&r.position.sub($g.setFromMatrixPosition(r.parent.matrixWorld))));else if("scale"===n){if(-1!==t.search("XYZ")){var o=this.pointEnd.length()/this.pointStart.length();this.pointEnd.dot(this.pointStart)<0&&(o*=-1),ey.set(o,o,o)}else $g.copy(this.pointStart),ey.copy(this.pointEnd),$g.applyQuaternion(this._worldQuaternionInv),ey.applyQuaternion(this._worldQuaternionInv),ey.divide($g),-1===t.search("X")&&(ey.x=1),-1===t.search("Y")&&(ey.y=1),-1===t.search("Z")&&(ey.z=1);r.scale.copy(this._scaleStart).multiply(ey),this.scaleSnap&&(-1!==t.search("X")&&(r.scale.x=Math.round(r.scale.x/this.scaleSnap)*this.scaleSnap||this.scaleSnap),-1!==t.search("Y")&&(r.scale.y=Math.round(r.scale.y/this.scaleSnap)*this.scaleSnap||this.scaleSnap),-1!==t.search("Z")&&(r.scale.z=Math.round(r.scale.z/this.scaleSnap)*this.scaleSnap||this.scaleSnap))}else if("rotate"===n){this._offset.copy(this.pointEnd).sub(this.pointStart);var s=20/this.worldPosition.distanceTo($g.setFromMatrixPosition(this.camera.matrixWorld));"E"===t?(this.rotationAxis.copy(this.eye),this.rotationAngle=this.pointEnd.angleTo(this.pointStart),this._startNorm.copy(this.pointStart).normalize(),this._endNorm.copy(this.pointEnd).normalize(),this.rotationAngle*=this._endNorm.cross(this._startNorm).dot(this.eye)<0?1:-1):"XYZE"===t?(this.rotationAxis.copy(this._offset).cross(this.eye).normalize(),this.rotationAngle=this._offset.dot($g.copy(this.rotationAxis).cross(this.eye))*s):"X"!==t&&"Y"!==t&&"Z"!==t||(this.rotationAxis.copy(ny[t]),$g.copy(ny[t]),"local"===i&&$g.applyQuaternion(this.worldQuaternion),this.rotationAngle=this._offset.dot($g.cross(this.eye).normalize())*s),this.rotationSnap&&(this.rotationAngle=Math.round(this.rotationAngle/this.rotationSnap)*this.rotationSnap),"local"===i&&"E"!==t&&"XYZE"!==t?(r.quaternion.copy(this._quaternionStart),r.quaternion.multiply(ty.setFromAxisAngle(this.rotationAxis,this.rotationAngle)).normalize()):(this.rotationAxis.applyQuaternion(this._parentQuaternionInv),r.quaternion.copy(ty.setFromAxisAngle(this.rotationAxis,this.rotationAngle)),r.quaternion.multiply(this._quaternionStart).normalize())}this.dispatchEvent(ry),this.dispatchEvent(oy)}}}},{key:"pointerUp",value:function(e){0===e.button&&(this.dragging&&null!==this.axis&&(ay.mode=this.mode,this.dispatchEvent(ay)),this.dragging=!1,this.axis=null)}},{key:"dispose",value:function(){this.domElement.removeEventListener("pointerdown",this._onPointerDown),this.domElement.removeEventListener("pointermove",this._onPointerHover),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.domElement.removeEventListener("pointerup",this._onPointerUp),this.traverse((function(e){e.geometry&&e.geometry.dispose(),e.material&&e.material.dispose()}))}},{key:"attach",value:function(e){return this.object=e,this.visible=!0,this}},{key:"detach",value:function(){return this.object=void 0,this.visible=!1,this.axis=null,this}},{key:"reset",value:function(){this.enabled&&this.dragging&&(this.object.position.copy(this._positionStart),this.object.quaternion.copy(this._quaternionStart),this.object.scale.copy(this._scaleStart),this.dispatchEvent(ry),this.dispatchEvent(oy),this.pointStart.copy(this.pointEnd))}},{key:"getRaycaster",value:function(){return Qg}},{key:"getMode",value:function(){return this.mode}},{key:"setMode",value:function(e){this.mode=e}},{key:"setTranslationSnap",value:function(e){this.translationSnap=e}},{key:"setRotationSnap",value:function(e){this.rotationSnap=e}},{key:"setScaleSnap",value:function(e){this.scaleSnap=e}},{key:"setSize",value:function(e){this.size=e}},{key:"setSpace",value:function(e){this.space=e}}]),n}(Zi);function uy(e){if(this.domElement.ownerDocument.pointerLockElement)return{x:0,y:0,button:e.button};var t=this.domElement.getBoundingClientRect();return{x:(e.clientX-t.left)/t.width*2-1,y:-(e.clientY-t.top)/t.height*2+1,button:e.button}}function ly(e){if(this.enabled)switch(e.pointerType){case"mouse":case"pen":this.pointerHover(this._getPointer(e))}}function cy(e){this.enabled&&(document.pointerLockElement||this.domElement.setPointerCapture(e.pointerId),this.domElement.addEventListener("pointermove",this._onPointerMove),this.pointerHover(this._getPointer(e)),this.pointerDown(this._getPointer(e)))}function hy(e){this.enabled&&this.pointerMove(this._getPointer(e))}function dy(e){this.enabled&&(this.domElement.releasePointerCapture(e.pointerId),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.pointerUp(this._getPointer(e)))}function fy(e,t,n){for(var r=t.intersectObject(e,!0),i=0;i<r.length;i++)if(r[i].object.visible||n)return r[i];return!1}var py=new Di,vy=new Yr(0,1,0),my=new Yr(0,0,0),gy=new wi,yy=new qr,_y=new qr,xy=new Yr,My=new wi,Sy=new Yr(1,0,0),by=new Yr(0,1,0),wy=new Yr(0,0,1),Ty=new Yr,Ey=new Yr,Ay=new Yr,Ry=function(e){w(n,e);var t=E(n);function n(){var e;a(this,n),(e=t.call(this)).isTransformControlsGizmo=!0,e.type="TransformControlsGizmo";var r=new ma({depthTest:!1,depthWrite:!1,fog:!1,toneMapped:!1,transparent:!0}),i=new ic({depthTest:!1,depthWrite:!1,fog:!1,toneMapped:!1,transparent:!0}),o=r.clone();o.opacity=.15;var s=i.clone();s.opacity=.5;var u=r.clone();u.color.setHex(16711680);var l=r.clone();l.color.setHex(65280);var c=r.clone();c.color.setHex(255);var h=r.clone();h.color.setHex(16711680),h.opacity=.5;var d=r.clone();d.color.setHex(65280),d.opacity=.5;var f=r.clone();f.color.setHex(255),f.opacity=.5;var p=r.clone();p.opacity=.25;var v=r.clone();v.color.setHex(16776960),v.opacity=.25,r.clone().color.setHex(16776960);var m=r.clone();m.color.setHex(7895160);var g=new $c(0,.04,.1,12);g.translate(0,.05,0);var y=new uo(.08,.08,.08);y.translate(0,.04,0);var _=new Ga;_.setAttribute("position",new Ia([0,0,0,1,0,0],3));var x=new $c(.0075,.0075,.5,3);function M(e,t){var n=new Xh(e,.0075,3,64,t*Math.PI*2);return n.rotateY(Math.PI/2),n.rotateX(Math.PI/2),n}x.translate(0,.25,0);var S,b={X:[[new oo(g,u),[.5,0,0],[0,0,-Math.PI/2]],[new oo(g,u),[-.5,0,0],[0,0,Math.PI/2]],[new oo(x,u),[0,0,0],[0,0,-Math.PI/2]]],Y:[[new oo(g,l),[0,.5,0]],[new oo(g,l),[0,-.5,0],[Math.PI,0,0]],[new oo(x,l)]],Z:[[new oo(g,c),[0,0,.5],[Math.PI/2,0,0]],[new oo(g,c),[0,0,-.5],[-Math.PI/2,0,0]],[new oo(x,c),null,[Math.PI/2,0,0]]],XYZ:[[new oo(new Hh(.1,0),p.clone()),[0,0,0]]],XY:[[new oo(new uo(.15,.15,.01),f.clone()),[.15,.15,0]]],YZ:[[new oo(new uo(.15,.15,.01),h.clone()),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new oo(new uo(.15,.15,.01),d.clone()),[.15,0,.15],[-Math.PI/2,0,0]]]},w={X:[[new oo(new $c(.2,0,.6,4),o),[.3,0,0],[0,0,-Math.PI/2]],[new oo(new $c(.2,0,.6,4),o),[-.3,0,0],[0,0,Math.PI/2]]],Y:[[new oo(new $c(.2,0,.6,4),o),[0,.3,0]],[new oo(new $c(.2,0,.6,4),o),[0,-.3,0],[0,0,Math.PI]]],Z:[[new oo(new $c(.2,0,.6,4),o),[0,0,.3],[Math.PI/2,0,0]],[new oo(new $c(.2,0,.6,4),o),[0,0,-.3],[-Math.PI/2,0,0]]],XYZ:[[new oo(new Hh(.2,0),o)]],XY:[[new oo(new uo(.2,.2,.01),o),[.15,.15,0]]],YZ:[[new oo(new uo(.2,.2,.01),o),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new oo(new uo(.2,.2,.01),o),[.15,0,.15],[-Math.PI/2,0,0]]]},T={START:[[new oo(new Hh(.01,2),s),null,null,null,"helper"]],END:[[new oo(new Hh(.01,2),s),null,null,null,"helper"]],DELTA:[[new cc((S=new Ga,S.setAttribute("position",new Ia([0,0,0,1,1,1],3)),S),s),null,null,null,"helper"]],X:[[new cc(_,s.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]],Y:[[new cc(_,s.clone()),[0,-1e3,0],[0,0,Math.PI/2],[1e6,1,1],"helper"]],Z:[[new cc(_,s.clone()),[0,0,-1e3],[0,-Math.PI/2,0],[1e6,1,1],"helper"]]},E={XYZE:[[new oo(M(.5,1),m),null,[0,Math.PI/2,0]]],X:[[new oo(M(.5,.5),u)]],Y:[[new oo(M(.5,.5),l),null,[0,0,-Math.PI/2]]],Z:[[new oo(M(.5,.5),c),null,[0,Math.PI/2,0]]],E:[[new oo(M(.75,1),v),null,[0,Math.PI/2,0]]]},A={AXIS:[[new cc(_,s.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]]},R={XYZE:[[new oo(new Wh(.25,10,8),o)]],X:[[new oo(new Xh(.5,.1,4,24),o),[0,0,0],[0,-Math.PI/2,-Math.PI/2]]],Y:[[new oo(new Xh(.5,.1,4,24),o),[0,0,0],[Math.PI/2,0,0]]],Z:[[new oo(new Xh(.5,.1,4,24),o),[0,0,0],[0,0,-Math.PI/2]]],E:[[new oo(new Xh(.75,.1,2,24),o)]]},k={X:[[new oo(y,u),[.5,0,0],[0,0,-Math.PI/2]],[new oo(x,u),[0,0,0],[0,0,-Math.PI/2]],[new oo(y,u),[-.5,0,0],[0,0,Math.PI/2]]],Y:[[new oo(y,l),[0,.5,0]],[new oo(x,l)],[new oo(y,l),[0,-.5,0],[0,0,Math.PI]]],Z:[[new oo(y,c),[0,0,.5],[Math.PI/2,0,0]],[new oo(x,c),[0,0,0],[Math.PI/2,0,0]],[new oo(y,c),[0,0,-.5],[-Math.PI/2,0,0]]],XY:[[new oo(new uo(.15,.15,.01),f),[.15,.15,0]]],YZ:[[new oo(new uo(.15,.15,.01),h),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new oo(new uo(.15,.15,.01),d),[.15,0,.15],[-Math.PI/2,0,0]]],XYZ:[[new oo(new uo(.1,.1,.1),p.clone())]]},C={X:[[new oo(new $c(.2,0,.6,4),o),[.3,0,0],[0,0,-Math.PI/2]],[new oo(new $c(.2,0,.6,4),o),[-.3,0,0],[0,0,Math.PI/2]]],Y:[[new oo(new $c(.2,0,.6,4),o),[0,.3,0]],[new oo(new $c(.2,0,.6,4),o),[0,-.3,0],[0,0,Math.PI]]],Z:[[new oo(new $c(.2,0,.6,4),o),[0,0,.3],[Math.PI/2,0,0]],[new oo(new $c(.2,0,.6,4),o),[0,0,-.3],[-Math.PI/2,0,0]]],XY:[[new oo(new uo(.2,.2,.01),o),[.15,.15,0]]],YZ:[[new oo(new uo(.2,.2,.01),o),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new oo(new uo(.2,.2,.01),o),[.15,0,.15],[-Math.PI/2,0,0]]],XYZ:[[new oo(new uo(.2,.2,.2),o),[0,0,0]]]},L={X:[[new cc(_,s.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]],Y:[[new cc(_,s.clone()),[0,-1e3,0],[0,0,Math.PI/2],[1e6,1,1],"helper"]],Z:[[new cc(_,s.clone()),[0,0,-1e3],[0,-Math.PI/2,0],[1e6,1,1],"helper"]]};function P(e){var t=new Zi;for(var n in e)for(var r=e[n].length;r--;){var i=e[n][r][0].clone(),a=e[n][r][1],o=e[n][r][2],s=e[n][r][3],u=e[n][r][4];i.name=n,i.tag=u,a&&i.position.set(a[0],a[1],a[2]),o&&i.rotation.set(o[0],o[1],o[2]),s&&i.scale.set(s[0],s[1],s[2]),i.updateMatrix();var l=i.geometry.clone();l.applyMatrix4(i.matrix),i.geometry=l,i.renderOrder=1/0,i.position.set(0,0,0),i.rotation.set(0,0,0),i.scale.set(1,1,1),t.add(i)}return t}return e.gizmo={},e.picker={},e.helper={},e.add(e.gizmo.translate=P(b)),e.add(e.gizmo.rotate=P(E)),e.add(e.gizmo.scale=P(k)),e.add(e.picker.translate=P(w)),e.add(e.picker.rotate=P(R)),e.add(e.picker.scale=P(C)),e.add(e.helper.translate=P(T)),e.add(e.helper.rotate=P(A)),e.add(e.helper.scale=P(L)),e.picker.translate.visible=!1,e.picker.rotate.visible=!1,e.picker.scale.visible=!1,e}return s(n,[{key:"updateMatrixWorld",value:function(e){var t=this,r="local"===("scale"===this.mode?"local":this.space)?this.worldQuaternion:_y;this.gizmo.translate.visible="translate"===this.mode,this.gizmo.rotate.visible="rotate"===this.mode,this.gizmo.scale.visible="scale"===this.mode,this.helper.translate.visible="translate"===this.mode,this.helper.rotate.visible="rotate"===this.mode,this.helper.scale.visible="scale"===this.mode;var i=[];i=(i=(i=i.concat(this.picker[this.mode].children)).concat(this.gizmo[this.mode].children)).concat(this.helper[this.mode].children);for(var a=function(){var e,n=i[o];if(n.visible=!0,n.rotation.set(0,0,0),n.position.copy(t.worldPosition),e=t.camera.isOrthographicCamera?(t.camera.top-t.camera.bottom)/t.camera.zoom:t.worldPosition.distanceTo(t.cameraPosition)*Math.min(1.9*Math.tan(Math.PI*t.camera.fov/360)/t.camera.zoom,7),n.scale.set(1,1,1).multiplyScalar(e*t.size/4),"helper"===n.tag)return n.visible=!1,"AXIS"===n.name?(n.visible=!!t.axis,"X"===t.axis&&(ty.setFromEuler(py.set(0,0,0)),n.quaternion.copy(r).multiply(ty),Math.abs(vy.copy(Sy).applyQuaternion(r).dot(t.eye))>.9&&(n.visible=!1)),"Y"===t.axis&&(ty.setFromEuler(py.set(0,0,Math.PI/2)),n.quaternion.copy(r).multiply(ty),Math.abs(vy.copy(by).applyQuaternion(r).dot(t.eye))>.9&&(n.visible=!1)),"Z"===t.axis&&(ty.setFromEuler(py.set(0,Math.PI/2,0)),n.quaternion.copy(r).multiply(ty),Math.abs(vy.copy(wy).applyQuaternion(r).dot(t.eye))>.9&&(n.visible=!1)),"XYZE"===t.axis&&(ty.setFromEuler(py.set(0,Math.PI/2,0)),vy.copy(t.rotationAxis),n.quaternion.setFromRotationMatrix(gy.lookAt(my,vy,by)),n.quaternion.multiply(ty),n.visible=t.dragging),"E"===t.axis&&(n.visible=!1)):"START"===n.name?(n.position.copy(t.worldPositionStart),n.visible=t.dragging):"END"===n.name?(n.position.copy(t.worldPosition),n.visible=t.dragging):"DELTA"===n.name?(n.position.copy(t.worldPositionStart),n.quaternion.copy(t.worldQuaternionStart),$g.set(1e-10,1e-10,1e-10).add(t.worldPositionStart).sub(t.worldPosition).multiplyScalar(-1),$g.applyQuaternion(t.worldQuaternionStart.clone().invert()),n.scale.copy($g),n.visible=t.dragging):(n.quaternion.copy(r),t.dragging?n.position.copy(t.worldPositionStart):n.position.copy(t.worldPosition),t.axis&&(n.visible=-1!==t.axis.search(n.name))),"continue";if(n.quaternion.copy(r),"translate"===t.mode||"scale"===t.mode){var a=.99;"X"===n.name&&Math.abs(vy.copy(Sy).applyQuaternion(r).dot(t.eye))>a&&(n.scale.set(1e-10,1e-10,1e-10),n.visible=!1),"Y"===n.name&&Math.abs(vy.copy(by).applyQuaternion(r).dot(t.eye))>a&&(n.scale.set(1e-10,1e-10,1e-10),n.visible=!1),"Z"===n.name&&Math.abs(vy.copy(wy).applyQuaternion(r).dot(t.eye))>a&&(n.scale.set(1e-10,1e-10,1e-10),n.visible=!1),"XY"===n.name&&Math.abs(vy.copy(wy).applyQuaternion(r).dot(t.eye))<.2&&(n.scale.set(1e-10,1e-10,1e-10),n.visible=!1),"YZ"===n.name&&Math.abs(vy.copy(Sy).applyQuaternion(r).dot(t.eye))<.2&&(n.scale.set(1e-10,1e-10,1e-10),n.visible=!1),"XZ"===n.name&&Math.abs(vy.copy(by).applyQuaternion(r).dot(t.eye))<.2&&(n.scale.set(1e-10,1e-10,1e-10),n.visible=!1)}else"rotate"===t.mode&&(yy.copy(r),vy.copy(t.eye).applyQuaternion(ty.copy(r).invert()),-1!==n.name.search("E")&&n.quaternion.setFromRotationMatrix(gy.lookAt(t.eye,my,by)),"X"===n.name&&(ty.setFromAxisAngle(Sy,Math.atan2(-vy.y,vy.z)),ty.multiplyQuaternions(yy,ty),n.quaternion.copy(ty)),"Y"===n.name&&(ty.setFromAxisAngle(by,Math.atan2(vy.x,vy.z)),ty.multiplyQuaternions(yy,ty),n.quaternion.copy(ty)),"Z"===n.name&&(ty.setFromAxisAngle(wy,Math.atan2(vy.y,vy.x)),ty.multiplyQuaternions(yy,ty),n.quaternion.copy(ty)));n.visible=n.visible&&(-1===n.name.indexOf("X")||t.showX),n.visible=n.visible&&(-1===n.name.indexOf("Y")||t.showY),n.visible=n.visible&&(-1===n.name.indexOf("Z")||t.showZ),n.visible=n.visible&&(-1===n.name.indexOf("E")||t.showX&&t.showY&&t.showZ),n.material._color=n.material._color||n.material.color.clone(),n.material._opacity=n.material._opacity||n.material.opacity,n.material.color.copy(n.material._color),n.material.opacity=n.material._opacity,t.enabled&&t.axis&&(n.name===t.axis||t.axis.split("").some((function(e){return n.name===e})))&&(n.material.color.setHex(16776960),n.material.opacity=1)},o=0;o<i.length;o++)a();y(x(n.prototype),"updateMatrixWorld",this).call(this,e)}}]),n}(Zi),ky=function(e){w(n,e);var t=E(n);function n(){var e;return a(this,n),(e=t.call(this,new Co(1e5,1e5,2,2),new ma({visible:!1,wireframe:!0,side:G,transparent:!0,opacity:.1,toneMapped:!1}))).isTransformControlsPlane=!0,e.type="TransformControlsPlane",e}return s(n,[{key:"updateMatrixWorld",value:function(e){var t=this.space;switch(this.position.copy(this.worldPosition),"scale"===this.mode&&(t="local"),Ty.copy(Sy).applyQuaternion("local"===t?this.worldQuaternion:_y),Ey.copy(by).applyQuaternion("local"===t?this.worldQuaternion:_y),Ay.copy(wy).applyQuaternion("local"===t?this.worldQuaternion:_y),vy.copy(Ey),this.mode){case"translate":case"scale":switch(this.axis){case"X":vy.copy(this.eye).cross(Ty),xy.copy(Ty).cross(vy);break;case"Y":vy.copy(this.eye).cross(Ey),xy.copy(Ey).cross(vy);break;case"Z":vy.copy(this.eye).cross(Ay),xy.copy(Ay).cross(vy);break;case"XY":xy.copy(Ay);break;case"YZ":xy.copy(Ty);break;case"XZ":vy.copy(Ay),xy.copy(Ey);break;case"XYZ":case"E":xy.set(0,0,0)}break;default:xy.set(0,0,0)}0===xy.length()?this.quaternion.copy(this.cameraQuaternion):(My.lookAt($g.set(0,0,0),xy,vy),this.quaternion.setFromRotationMatrix(My)),y(x(n.prototype),"updateMatrixWorld",this).call(this,e)}}]),n}(oo),Cy=function(e){T()(n,e);var t=A()(n);function n(e,r){return o()(this,n),t.call(this,e,r)}return u()(n,[{key:"dispose",value:function(){var e=this;_()(M()(n.prototype),"dispose",this).call(this);var t=mv.transformControls.findIndex((function(t){return t===e}));t>-1&&mv.transformControls.splice(t,1)}}]),n}(sy),Ly=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:.5,t=new Cy(mv.camera,mv.domElement);return t.size=e,t.addEventListener("change",(function(){})),t.addEventListener("dragging-changed",(function(e){var t=mv.orbitControls;t&&(t.enabled=!e.value)})),mv.setTransformControls(t),mv.scene.add(t),t},Py=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:.5,t=new Promise((function(t){mv.camera&&mv.domElement?t(Ly(e)):fv.on("after-render",(function(){t(Ly(e))}))}));return t},Iy=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Object.keys(t).forEach((function(n){t[n]&&e.setAttribute(n,t[n])}))},Dy=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=Object.keys(t).reduce((function(e,n){return"".concat(e," ").concat(pv(n),":").concat(t[n],";")}),"");e.setAttribute("style",n)},Uy=function(e,t){t.forEach((function(t){return e.classList.add(t)}))},Oy=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Object.keys(t).forEach((function(n){var r=t[n];e.addEventListener(n,r)}))},Ny=function(e,t){t.forEach((function(t){return e.appendChild(t)}))},Fy=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],r=document.createElement(e),i=document.createElement("div");return i.appendChild(r),t.textContent&&(r.textContent=t.textContent),t.innerHTML&&(r.innerHTML=t.innerHTML),t.id&&(r.id=t.id),t.class&&(r.className=t.class),Iy(r,t.attrs),Uy(r,t.classList||[]),Oy(r,t.events),Dy(r,t.style||{}),Ny(r,n),i},By=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return t.map((function(e){return function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return Fy(e,t,n)}}))},zy=(By("a")[0],By("article")[0],By("aside")[0],By("b")[0],By("br")[0],By("button")[0],By("canvas")[0],By("div")[0],By("fieldset")[0],By("footer")[0],By("form")[0],By("h1")[0],By("h2")[0],By("h3")[0],By("h4")[0],By("h5")[0],By("h6")[0],By("header")[0],By("hr")[0],By("i")[0],By("iframe")[0],By("img")[0],By("input")[0],By("label")[0],By("li")[0],By("link")[0],By("main")[0],By("meta")[0],By("nav")[0],By("ol")[0],By("option")[0],By("p")[0],By("progress")[0],By("script")[0],By("section")[0],By("select")[0],By("span")[0],By("style")[0],By("sub")[0],By("sup")[0],By("svg")[0],By("table")[0],By("tbody")[0],By("td")[0],By("textarea")[0],By("th")[0],By("tr")[0],By("ul")[0],By("video")[0],function(e){return mv.addFrameCallback(e),mv.removeFrameCallback.bind(mv,e)}),Hy=function(){return{scene:mv.scene,domElement:mv.domElement,orbitControls:mv.orbitControls}},Gy=new Jr,Vy=new Yr,Wy=function(e){w(n,e);var t=E(n);function n(){var e;a(this,n),(e=t.call(this)).isLineSegmentsGeometry=!0,e.type="LineSegmentsGeometry";return e.setIndex([0,2,1,2,3,1,2,4,3,4,5,3,4,6,5,6,7,5]),e.setAttribute("position",new Ia([-1,2,0,1,2,0,-1,1,0,1,1,0,-1,0,0,1,0,0,-1,-1,0,1,-1,0],3)),e.setAttribute("uv",new Ia([-1,2,1,2,-1,1,1,1,-1,-1,1,-1,-1,-2,1,-2],2)),e}return s(n,[{key:"applyMatrix4",value:function(e){var t=this.attributes.instanceStart,n=this.attributes.instanceEnd;return void 0!==t&&(t.applyMatrix4(e),n.applyMatrix4(e),t.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this}},{key:"setPositions",value:function(e){var t;e instanceof Float32Array?t=e:Array.isArray(e)&&(t=new Float32Array(e));var n=new np(t,6,1);return this.setAttribute("instanceStart",new vl(n,3,0)),this.setAttribute("instanceEnd",new vl(n,3,3)),this.computeBoundingBox(),this.computeBoundingSphere(),this}},{key:"setColors",value:function(e){var t;e instanceof Float32Array?t=e:Array.isArray(e)&&(t=new Float32Array(e));var n=new np(t,6,1);return this.setAttribute("instanceColorStart",new vl(n,3,0)),this.setAttribute("instanceColorEnd",new vl(n,3,3)),this}},{key:"fromWireframeGeometry",value:function(e){return this.setPositions(e.attributes.position.array),this}},{key:"fromEdgesGeometry",value:function(e){return this.setPositions(e.attributes.position.array),this}},{key:"fromMesh",value:function(e){return this.fromWireframeGeometry(new Zh(e.geometry)),this}},{key:"fromLineSegments",value:function(e){var t=e.geometry;return this.setPositions(t.attributes.position.array),this}},{key:"computeBoundingBox",value:function(){null===this.boundingBox&&(this.boundingBox=new Jr);var e=this.attributes.instanceStart,t=this.attributes.instanceEnd;void 0!==e&&void 0!==t&&(this.boundingBox.setFromBufferAttribute(e),Gy.setFromBufferAttribute(t),this.boundingBox.union(Gy))}},{key:"computeBoundingSphere",value:function(){null===this.boundingSphere&&(this.boundingSphere=new vi),null===this.boundingBox&&this.computeBoundingBox();var e=this.attributes.instanceStart,t=this.attributes.instanceEnd;if(void 0!==e&&void 0!==t){var n=this.boundingSphere.center;this.boundingBox.getCenter(n);for(var r=0,i=0,a=e.count;i<a;i++)Vy.fromBufferAttribute(e,i),r=Math.max(r,n.distanceToSquared(Vy)),Vy.fromBufferAttribute(t,i),r=Math.max(r,n.distanceToSquared(Vy));this.boundingSphere.radius=Math.sqrt(r),isNaN(this.boundingSphere.radius)&&console.error("THREE.LineSegmentsGeometry.computeBoundingSphere(): Computed radius is NaN. The instanced position data is likely to have NaN values.",this)}}},{key:"toJSON",value:function(){}},{key:"applyMatrix",value:function(e){return console.warn("THREE.LineSegmentsGeometry: applyMatrix() has been renamed to applyMatrix4()."),this.applyMatrix4(e)}}]),n}(hf),jy=function(e){w(n,e);var t=E(n);function n(){var e;return a(this,n),(e=t.call(this)).isLineGeometry=!0,e.type="LineGeometry",e}return s(n,[{key:"setPositions",value:function(e){for(var t=e.length-3,r=new Float32Array(2*t),i=0;i<t;i+=3)r[2*i]=e[i],r[2*i+1]=e[i+1],r[2*i+2]=e[i+2],r[2*i+3]=e[i+3],r[2*i+4]=e[i+4],r[2*i+5]=e[i+5];return y(x(n.prototype),"setPositions",this).call(this,r),this}},{key:"setColors",value:function(e){for(var t=e.length-3,r=new Float32Array(2*t),i=0;i<t;i+=3)r[2*i]=e[i],r[2*i+1]=e[i+1],r[2*i+2]=e[i+2],r[2*i+3]=e[i+3],r[2*i+4]=e[i+4],r[2*i+5]=e[i+5];return y(x(n.prototype),"setColors",this).call(this,r),this}},{key:"fromLine",value:function(e){var t=e.geometry;return this.setPositions(t.attributes.position.array),this}}]),n}(Wy);Po.line={worldUnits:{value:1},linewidth:{value:1},resolution:{value:new mr(1,1)},dashOffset:{value:0},dashScale:{value:1},dashSize:{value:1},gapSize:{value:1}},Io.line={uniforms:fo.merge([Po.common,Po.fog,Po.line]),vertexShader:"\n\t\t#include <common>\n\t\t#include <color_pars_vertex>\n\t\t#include <fog_pars_vertex>\n\t\t#include <logdepthbuf_pars_vertex>\n\t\t#include <clipping_planes_pars_vertex>\n\n\t\tuniform float linewidth;\n\t\tuniform vec2 resolution;\n\n\t\tattribute vec3 instanceStart;\n\t\tattribute vec3 instanceEnd;\n\n\t\tattribute vec3 instanceColorStart;\n\t\tattribute vec3 instanceColorEnd;\n\n\t\t#ifdef WORLD_UNITS\n\n\t\t\tvarying vec4 worldPos;\n\t\t\tvarying vec3 worldStart;\n\t\t\tvarying vec3 worldEnd;\n\n\t\t\t#ifdef USE_DASH\n\n\t\t\t\tvarying vec2 vUv;\n\n\t\t\t#endif\n\n\t\t#else\n\n\t\t\tvarying vec2 vUv;\n\n\t\t#endif\n\n\t\t#ifdef USE_DASH\n\n\t\t\tuniform float dashScale;\n\t\t\tattribute float instanceDistanceStart;\n\t\t\tattribute float instanceDistanceEnd;\n\t\t\tvarying float vLineDistance;\n\n\t\t#endif\n\n\t\tvoid trimSegment( const in vec4 start, inout vec4 end ) {\n\n\t\t\t// trim end segment so it terminates between the camera plane and the near plane\n\n\t\t\t// conservative estimate of the near plane\n\t\t\tfloat a = projectionMatrix[ 2 ][ 2 ]; // 3nd entry in 3th column\n\t\t\tfloat b = projectionMatrix[ 3 ][ 2 ]; // 3nd entry in 4th column\n\t\t\tfloat nearEstimate = - 0.5 * b / a;\n\n\t\t\tfloat alpha = ( nearEstimate - start.z ) / ( end.z - start.z );\n\n\t\t\tend.xyz = mix( start.xyz, end.xyz, alpha );\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\t#ifdef USE_COLOR\n\n\t\t\t\tvColor.xyz = ( position.y < 0.5 ) ? instanceColorStart : instanceColorEnd;\n\n\t\t\t#endif\n\n\t\t\t#ifdef USE_DASH\n\n\t\t\t\tvLineDistance = ( position.y < 0.5 ) ? dashScale * instanceDistanceStart : dashScale * instanceDistanceEnd;\n\t\t\t\tvUv = uv;\n\n\t\t\t#endif\n\n\t\t\tfloat aspect = resolution.x / resolution.y;\n\n\t\t\t// camera space\n\t\t\tvec4 start = modelViewMatrix * vec4( instanceStart, 1.0 );\n\t\t\tvec4 end = modelViewMatrix * vec4( instanceEnd, 1.0 );\n\n\t\t\t#ifdef WORLD_UNITS\n\n\t\t\t\tworldStart = start.xyz;\n\t\t\t\tworldEnd = end.xyz;\n\n\t\t\t#else\n\n\t\t\t\tvUv = uv;\n\n\t\t\t#endif\n\n\t\t\t// special case for perspective projection, and segments that terminate either in, or behind, the camera plane\n\t\t\t// clearly the gpu firmware has a way of addressing this issue when projecting into ndc space\n\t\t\t// but we need to perform ndc-space calculations in the shader, so we must address this issue directly\n\t\t\t// perhaps there is a more elegant solution -- WestLangley\n\n\t\t\tbool perspective = ( projectionMatrix[ 2 ][ 3 ] == - 1.0 ); // 4th entry in the 3rd column\n\n\t\t\tif ( perspective ) {\n\n\t\t\t\tif ( start.z < 0.0 && end.z >= 0.0 ) {\n\n\t\t\t\t\ttrimSegment( start, end );\n\n\t\t\t\t} else if ( end.z < 0.0 && start.z >= 0.0 ) {\n\n\t\t\t\t\ttrimSegment( end, start );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t// clip space\n\t\t\tvec4 clipStart = projectionMatrix * start;\n\t\t\tvec4 clipEnd = projectionMatrix * end;\n\n\t\t\t// ndc space\n\t\t\tvec3 ndcStart = clipStart.xyz / clipStart.w;\n\t\t\tvec3 ndcEnd = clipEnd.xyz / clipEnd.w;\n\n\t\t\t// direction\n\t\t\tvec2 dir = ndcEnd.xy - ndcStart.xy;\n\n\t\t\t// account for clip-space aspect ratio\n\t\t\tdir.x *= aspect;\n\t\t\tdir = normalize( dir );\n\n\t\t\t#ifdef WORLD_UNITS\n\n\t\t\t\t// get the offset direction as perpendicular to the view vector\n\t\t\t\tvec3 worldDir = normalize( end.xyz - start.xyz );\n\t\t\t\tvec3 offset;\n\t\t\t\tif ( position.y < 0.5 ) {\n\n\t\t\t\t\toffset = normalize( cross( start.xyz, worldDir ) );\n\n\t\t\t\t} else {\n\n\t\t\t\t\toffset = normalize( cross( end.xyz, worldDir ) );\n\n\t\t\t\t}\n\n\t\t\t\t// sign flip\n\t\t\t\tif ( position.x < 0.0 ) offset *= - 1.0;\n\n\t\t\t\tfloat forwardOffset = dot( worldDir, vec3( 0.0, 0.0, 1.0 ) );\n\n\t\t\t\t// don't extend the line if we're rendering dashes because we\n\t\t\t\t// won't be rendering the endcaps\n\t\t\t\t#ifndef USE_DASH\n\n\t\t\t\t\t// extend the line bounds to encompass endcaps\n\t\t\t\t\tstart.xyz += - worldDir * linewidth * 0.5;\n\t\t\t\t\tend.xyz += worldDir * linewidth * 0.5;\n\n\t\t\t\t\t// shift the position of the quad so it hugs the forward edge of the line\n\t\t\t\t\toffset.xy -= dir * forwardOffset;\n\t\t\t\t\toffset.z += 0.5;\n\n\t\t\t\t#endif\n\n\t\t\t\t// endcaps\n\t\t\t\tif ( position.y > 1.0 || position.y < 0.0 ) {\n\n\t\t\t\t\toffset.xy += dir * 2.0 * forwardOffset;\n\n\t\t\t\t}\n\n\t\t\t\t// adjust for linewidth\n\t\t\t\toffset *= linewidth * 0.5;\n\n\t\t\t\t// set the world position\n\t\t\t\tworldPos = ( position.y < 0.5 ) ? start : end;\n\t\t\t\tworldPos.xyz += offset;\n\n\t\t\t\t// project the worldpos\n\t\t\t\tvec4 clip = projectionMatrix * worldPos;\n\n\t\t\t\t// shift the depth of the projected points so the line\n\t\t\t\t// segments overlap neatly\n\t\t\t\tvec3 clipPose = ( position.y < 0.5 ) ? ndcStart : ndcEnd;\n\t\t\t\tclip.z = clipPose.z * clip.w;\n\n\t\t\t#else\n\n\t\t\t\tvec2 offset = vec2( dir.y, - dir.x );\n\t\t\t\t// undo aspect ratio adjustment\n\t\t\t\tdir.x /= aspect;\n\t\t\t\toffset.x /= aspect;\n\n\t\t\t\t// sign flip\n\t\t\t\tif ( position.x < 0.0 ) offset *= - 1.0;\n\n\t\t\t\t// endcaps\n\t\t\t\tif ( position.y < 0.0 ) {\n\n\t\t\t\t\toffset += - dir;\n\n\t\t\t\t} else if ( position.y > 1.0 ) {\n\n\t\t\t\t\toffset += dir;\n\n\t\t\t\t}\n\n\t\t\t\t// adjust for linewidth\n\t\t\t\toffset *= linewidth;\n\n\t\t\t\t// adjust for clip-space to screen-space conversion // maybe resolution should be based on viewport ...\n\t\t\t\toffset /= resolution.y;\n\n\t\t\t\t// select end\n\t\t\t\tvec4 clip = ( position.y < 0.5 ) ? clipStart : clipEnd;\n\n\t\t\t\t// back to clip space\n\t\t\t\toffset *= clip.w;\n\n\t\t\t\tclip.xy += offset;\n\n\t\t\t#endif\n\n\t\t\tgl_Position = clip;\n\n\t\t\tvec4 mvPosition = ( position.y < 0.5 ) ? start : end; // this is an approximation\n\n\t\t\t#include <logdepthbuf_vertex>\n\t\t\t#include <clipping_planes_vertex>\n\t\t\t#include <fog_vertex>\n\n\t\t}\n\t\t",fragmentShader:"\n\t\tuniform vec3 diffuse;\n\t\tuniform float opacity;\n\t\tuniform float linewidth;\n\n\t\t#ifdef USE_DASH\n\n\t\t\tuniform float dashOffset;\n\t\t\tuniform float dashSize;\n\t\t\tuniform float gapSize;\n\n\t\t#endif\n\n\t\tvarying float vLineDistance;\n\n\t\t#ifdef WORLD_UNITS\n\n\t\t\tvarying vec4 worldPos;\n\t\t\tvarying vec3 worldStart;\n\t\t\tvarying vec3 worldEnd;\n\n\t\t\t#ifdef USE_DASH\n\n\t\t\t\tvarying vec2 vUv;\n\n\t\t\t#endif\n\n\t\t#else\n\n\t\t\tvarying vec2 vUv;\n\n\t\t#endif\n\n\t\t#include <common>\n\t\t#include <color_pars_fragment>\n\t\t#include <fog_pars_fragment>\n\t\t#include <logdepthbuf_pars_fragment>\n\t\t#include <clipping_planes_pars_fragment>\n\n\t\tvec2 closestLineToLine(vec3 p1, vec3 p2, vec3 p3, vec3 p4) {\n\n\t\t\tfloat mua;\n\t\t\tfloat mub;\n\n\t\t\tvec3 p13 = p1 - p3;\n\t\t\tvec3 p43 = p4 - p3;\n\n\t\t\tvec3 p21 = p2 - p1;\n\n\t\t\tfloat d1343 = dot( p13, p43 );\n\t\t\tfloat d4321 = dot( p43, p21 );\n\t\t\tfloat d1321 = dot( p13, p21 );\n\t\t\tfloat d4343 = dot( p43, p43 );\n\t\t\tfloat d2121 = dot( p21, p21 );\n\n\t\t\tfloat denom = d2121 * d4343 - d4321 * d4321;\n\n\t\t\tfloat numer = d1343 * d4321 - d1321 * d4343;\n\n\t\t\tmua = numer / denom;\n\t\t\tmua = clamp( mua, 0.0, 1.0 );\n\t\t\tmub = ( d1343 + d4321 * ( mua ) ) / d4343;\n\t\t\tmub = clamp( mub, 0.0, 1.0 );\n\n\t\t\treturn vec2( mua, mub );\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\t#include <clipping_planes_fragment>\n\n\t\t\t#ifdef USE_DASH\n\n\t\t\t\tif ( vUv.y < - 1.0 || vUv.y > 1.0 ) discard; // discard endcaps\n\n\t\t\t\tif ( mod( vLineDistance + dashOffset, dashSize + gapSize ) > dashSize ) discard; // todo - FIX\n\n\t\t\t#endif\n\n\t\t\tfloat alpha = opacity;\n\n\t\t\t#ifdef WORLD_UNITS\n\n\t\t\t\t// Find the closest points on the view ray and the line segment\n\t\t\t\tvec3 rayEnd = normalize( worldPos.xyz ) * 1e5;\n\t\t\t\tvec3 lineDir = worldEnd - worldStart;\n\t\t\t\tvec2 params = closestLineToLine( worldStart, worldEnd, vec3( 0.0, 0.0, 0.0 ), rayEnd );\n\n\t\t\t\tvec3 p1 = worldStart + lineDir * params.x;\n\t\t\t\tvec3 p2 = rayEnd * params.y;\n\t\t\t\tvec3 delta = p1 - p2;\n\t\t\t\tfloat len = length( delta );\n\t\t\t\tfloat norm = len / linewidth;\n\n\t\t\t\t#ifndef USE_DASH\n\n\t\t\t\t\t#ifdef USE_ALPHA_TO_COVERAGE\n\n\t\t\t\t\t\tfloat dnorm = fwidth( norm );\n\t\t\t\t\t\talpha = 1.0 - smoothstep( 0.5 - dnorm, 0.5 + dnorm, norm );\n\n\t\t\t\t\t#else\n\n\t\t\t\t\t\tif ( norm > 0.5 ) {\n\n\t\t\t\t\t\t\tdiscard;\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t#endif\n\n\t\t\t\t#endif\n\n\t\t\t#else\n\n\t\t\t\t#ifdef USE_ALPHA_TO_COVERAGE\n\n\t\t\t\t\t// artifacts appear on some hardware if a derivative is taken within a conditional\n\t\t\t\t\tfloat a = vUv.x;\n\t\t\t\t\tfloat b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0;\n\t\t\t\t\tfloat len2 = a * a + b * b;\n\t\t\t\t\tfloat dlen = fwidth( len2 );\n\n\t\t\t\t\tif ( abs( vUv.y ) > 1.0 ) {\n\n\t\t\t\t\t\talpha = 1.0 - smoothstep( 1.0 - dlen, 1.0 + dlen, len2 );\n\n\t\t\t\t\t}\n\n\t\t\t\t#else\n\n\t\t\t\t\tif ( abs( vUv.y ) > 1.0 ) {\n\n\t\t\t\t\t\tfloat a = vUv.x;\n\t\t\t\t\t\tfloat b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0;\n\t\t\t\t\t\tfloat len2 = a * a + b * b;\n\n\t\t\t\t\t\tif ( len2 > 1.0 ) discard;\n\n\t\t\t\t\t}\n\n\t\t\t\t#endif\n\n\t\t\t#endif\n\n\t\t\tvec4 diffuseColor = vec4( diffuse, alpha );\n\n\t\t\t#include <logdepthbuf_fragment>\n\t\t\t#include <color_fragment>\n\n\t\t\tgl_FragColor = vec4( diffuseColor.rgb, alpha );\n\n\t\t\t#include <tonemapping_fragment>\n\t\t\t#include <colorspace_fragment>\n\t\t\t#include <fog_fragment>\n\t\t\t#include <premultiplied_alpha_fragment>\n\n\t\t}\n\t\t"};var Xy,qy,Yy=function(e){w(n,e);var t=E(n);function n(e){var r;return a(this,n),(r=t.call(this,{type:"LineMaterial",uniforms:fo.clone(Io.line.uniforms),vertexShader:Io.line.vertexShader,fragmentShader:Io.line.fragmentShader,clipping:!0})).isLineMaterial=!0,Object.defineProperties(S(r),{color:{enumerable:!0,get:function(){return this.uniforms.diffuse.value},set:function(e){this.uniforms.diffuse.value=e}},worldUnits:{enumerable:!0,get:function(){return"WORLD_UNITS"in this.defines},set:function(e){!0===e?this.defines.WORLD_UNITS="":delete this.defines.WORLD_UNITS}},linewidth:{enumerable:!0,get:function(){return this.uniforms.linewidth.value},set:function(e){this.uniforms.linewidth.value=e}},dashed:{enumerable:!0,get:function(){return Boolean("USE_DASH"in this.defines)},set:function(e){Boolean(e)!==Boolean("USE_DASH"in this.defines)&&(this.needsUpdate=!0),!0===e?this.defines.USE_DASH="":delete this.defines.USE_DASH}},dashScale:{enumerable:!0,get:function(){return this.uniforms.dashScale.value},set:function(e){this.uniforms.dashScale.value=e}},dashSize:{enumerable:!0,get:function(){return this.uniforms.dashSize.value},set:function(e){this.uniforms.dashSize.value=e}},dashOffset:{enumerable:!0,get:function(){return this.uniforms.dashOffset.value},set:function(e){this.uniforms.dashOffset.value=e}},gapSize:{enumerable:!0,get:function(){return this.uniforms.gapSize.value},set:function(e){this.uniforms.gapSize.value=e}},opacity:{enumerable:!0,get:function(){return this.uniforms.opacity.value},set:function(e){this.uniforms.opacity.value=e}},resolution:{enumerable:!0,get:function(){return this.uniforms.resolution.value},set:function(e){this.uniforms.resolution.value.copy(e)}},alphaToCoverage:{enumerable:!0,get:function(){return Boolean("USE_ALPHA_TO_COVERAGE"in this.defines)},set:function(e){Boolean(e)!==Boolean("USE_ALPHA_TO_COVERAGE"in this.defines)&&(this.needsUpdate=!0),!0===e?(this.defines.USE_ALPHA_TO_COVERAGE="",this.extensions.derivatives=!0):(delete this.defines.USE_ALPHA_TO_COVERAGE,this.extensions.derivatives=!1)}}}),r.setValues(e),r}return s(n)}(po),Zy=new Yr,Ky=new Yr,Jy=new Br,Qy=new Br,$y=new Br,e_=new Yr,t_=new wi,n_=new fp,r_=new Yr,i_=new Jr,a_=new vi,o_=new Br;function s_(e,t,n){return o_.set(0,0,-t,1).applyMatrix4(e.projectionMatrix),o_.multiplyScalar(1/o_.w),o_.x=qy/n.width,o_.y=qy/n.height,o_.applyMatrix4(e.projectionMatrixInverse),o_.multiplyScalar(1/o_.w),Math.abs(Math.max(o_.x,o_.y))}var u_=function(e){w(n,e);var t=E(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Wy,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Yy({color:16777215*Math.random()});return a(this,n),(e=t.call(this,r,i)).isLineSegments2=!0,e.type="LineSegments2",e}return s(n,[{key:"computeLineDistances",value:function(){for(var e=this.geometry,t=e.attributes.instanceStart,n=e.attributes.instanceEnd,r=new Float32Array(2*t.count),i=0,a=0,o=t.count;i<o;i++,a+=2)Zy.fromBufferAttribute(t,i),Ky.fromBufferAttribute(n,i),r[a]=0===a?0:r[a-1],r[a+1]=r[a]+Zy.distanceTo(Ky);var s=new np(r,2,1);return e.setAttribute("instanceDistanceStart",new vl(s,1,0)),e.setAttribute("instanceDistanceEnd",new vl(s,1,1)),this}},{key:"raycast",value:function(e,t){var n=this.material.worldUnits,r=e.camera;null!==r||n||console.error('LineSegments2: "Raycaster.camera" needs to be set in order to raycast against LineSegments2 while worldUnits is set to false.');var i=void 0!==e.params.Line2&&e.params.Line2.threshold||0;Xy=e.ray;var a,o=this.matrixWorld,s=this.geometry,u=this.material;(qy=u.linewidth+i,null===s.boundingSphere&&s.computeBoundingSphere(),a_.copy(s.boundingSphere).applyMatrix4(o),n)?a=.5*qy:a=s_(r,Math.max(r.near,a_.distanceToPoint(Xy.origin)),u.resolution);if(a_.radius+=a,!1!==Xy.intersectsSphere(a_)){var l;if(null===s.boundingBox&&s.computeBoundingBox(),i_.copy(s.boundingBox).applyMatrix4(o),n)l=.5*qy;else l=s_(r,Math.max(r.near,i_.distanceToPoint(Xy.origin)),u.resolution);i_.expandByScalar(l),!1!==Xy.intersectsBox(i_)&&(n?function(e,t){for(var n=e.matrixWorld,r=e.geometry,i=r.attributes.instanceStart,a=r.attributes.instanceEnd,o=0,s=Math.min(r.instanceCount,i.count);o<s;o++){n_.start.fromBufferAttribute(i,o),n_.end.fromBufferAttribute(a,o),n_.applyMatrix4(n);var u=new Yr,l=new Yr;Xy.distanceSqToSegment(n_.start,n_.end,l,u),l.distanceTo(u)<.5*qy&&t.push({point:l,pointOnLine:u,distance:Xy.origin.distanceTo(l),object:e,face:null,faceIndex:o,uv:null,uv1:null})}}(this,t):function(e,t,n){var r=t.projectionMatrix,i=e.material.resolution,a=e.matrixWorld,o=e.geometry,s=o.attributes.instanceStart,u=o.attributes.instanceEnd,l=Math.min(o.instanceCount,s.count),c=-t.near;Xy.at(1,$y),$y.w=1,$y.applyMatrix4(t.matrixWorldInverse),$y.applyMatrix4(r),$y.multiplyScalar(1/$y.w),$y.x*=i.x/2,$y.y*=i.y/2,$y.z=0,e_.copy($y),t_.multiplyMatrices(t.matrixWorldInverse,a);for(var h=0,d=l;h<d;h++)if(Jy.fromBufferAttribute(s,h),Qy.fromBufferAttribute(u,h),Jy.w=1,Qy.w=1,Jy.applyMatrix4(t_),Qy.applyMatrix4(t_),!(Jy.z>c&&Qy.z>c)){if(Jy.z>c){var f=Jy.z-Qy.z,p=(Jy.z-c)/f;Jy.lerp(Qy,p)}else if(Qy.z>c){var v=Qy.z-Jy.z,m=(Qy.z-c)/v;Qy.lerp(Jy,m)}Jy.applyMatrix4(r),Qy.applyMatrix4(r),Jy.multiplyScalar(1/Jy.w),Qy.multiplyScalar(1/Qy.w),Jy.x*=i.x/2,Jy.y*=i.y/2,Qy.x*=i.x/2,Qy.y*=i.y/2,n_.start.copy(Jy),n_.start.z=0,n_.end.copy(Qy),n_.end.z=0;var g=n_.closestPointToPointParameter(e_,!0);n_.at(g,r_);var y=vr.lerp(Jy.z,Qy.z,g),_=y>=-1&&y<=1,x=e_.distanceTo(r_)<.5*qy;if(_&&x){n_.start.fromBufferAttribute(s,h),n_.end.fromBufferAttribute(u,h),n_.start.applyMatrix4(a),n_.end.applyMatrix4(a);var M=new Yr,S=new Yr;Xy.distanceSqToSegment(n_.start,n_.end,S,M),n.push({point:S,pointOnLine:M,distance:Xy.origin.distanceTo(S),object:e,face:null,faceIndex:h,uv:null,uv1:null})}}}(this,r,t))}}}]),n}(oo),l_=function(e){w(n,e);var t=E(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new jy,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Yy({color:16777215*Math.random()});return a(this,n),(e=t.call(this,r,i)).isLine2=!0,e.type="Line2",e}return s(n)}(u_),c_={moveTo:Uv,moveLine:function(e,t){var n=function(e){var t=new Oc(f()(e)),n=t.getPoints(50),r=(new Ga).setFromPoints(n),i=new ic({opacity:1});return[new cc(r,i),t]}([e.position,t.position]),r=g()(n,2),i=r[0];r[1];mv.scene.add(i)},moveWithRound:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.1,n=arguments.length>2?arguments[2]:void 0,r=0,i=0,a=0,o=function(){r+=t,i=4*Math.sin(r),a=4*Math.cos(r),e.position.set(i,0,a)};Dv.add(o,n),Dv.start()},moveWithLine:Ov},h_={appendChildren:Ny,create:By,createElement:Fy,setAttributes:Iy,setClassList:Uy,setEventListeners:Oy},d_={useframe:zy,useScene:Hy}}(),r}()}));
|
|
1
|
+
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var n=t();for(var r in n)("object"==typeof exports?exports:e)[r]=n[r]}}(self,(function(){return function(){var e={693:function(e){e.exports=function(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r},e.exports.__esModule=!0,e.exports.default=e.exports},814:function(e){e.exports=function(e){if(Array.isArray(e))return e},e.exports.__esModule=!0,e.exports.default=e.exports},876:function(e,t,n){var r=n(693);e.exports=function(e){if(Array.isArray(e))return r(e)},e.exports.__esModule=!0,e.exports.default=e.exports},477:function(e){e.exports=function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e},e.exports.__esModule=!0,e.exports.default=e.exports},835:function(e){function t(e,t,n,r,i,a,o){try{var s=e[a](o),u=s.value}catch(e){return void n(e)}s.done?t(u):Promise.resolve(u).then(r,i)}e.exports=function(e){return function(){var n=this,r=arguments;return new Promise((function(i,a){var o=e.apply(n,r);function s(e){t(o,i,a,s,u,"next",e)}function u(e){t(o,i,a,s,u,"throw",e)}s(void 0)}))}},e.exports.__esModule=!0,e.exports.default=e.exports},576:function(e){e.exports=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},e.exports.__esModule=!0,e.exports.default=e.exports},360:function(e,t,n){var r=n(825),i=n(455);function a(t,n,o){return i()?(e.exports=a=Reflect.construct.bind(),e.exports.__esModule=!0,e.exports.default=e.exports):(e.exports=a=function(e,t,n){var i=[null];i.push.apply(i,t);var a=new(Function.bind.apply(e,i));return n&&r(a,n.prototype),a},e.exports.__esModule=!0,e.exports.default=e.exports),a.apply(null,arguments)}e.exports=a,e.exports.__esModule=!0,e.exports.default=e.exports},672:function(e,t,n){var r=n(233);function i(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,r(i.key),i)}}e.exports=function(e,t,n){return t&&i(e.prototype,t),n&&i(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e},e.exports.__esModule=!0,e.exports.default=e.exports},313:function(e,t,n){var r=n(35);e.exports=function(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=r(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var i=0,a=function(){};return{s:a,n:function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}},e:function(e){throw e},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,s=!0,u=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return s=e.done,e},e:function(e){u=!0,o=e},f:function(){try{s||null==n.return||n.return()}finally{if(u)throw o}}}},e.exports.__esModule=!0,e.exports.default=e.exports},859:function(e,t,n){var r=n(456),i=n(455),a=n(210);e.exports=function(e){var t=i();return function(){var n,i=r(e);if(t){var o=r(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return a(this,n)}},e.exports.__esModule=!0,e.exports.default=e.exports},67:function(e,t,n){var r=n(233);e.exports=function(e,t,n){return(t=r(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e},e.exports.__esModule=!0,e.exports.default=e.exports},408:function(e,t,n){var r=n(375);function i(){return"undefined"!=typeof Reflect&&Reflect.get?(e.exports=i=Reflect.get.bind(),e.exports.__esModule=!0,e.exports.default=e.exports):(e.exports=i=function(e,t,n){var i=r(e,t);if(i){var a=Object.getOwnPropertyDescriptor(i,t);return a.get?a.get.call(arguments.length<3?e:n):a.value}},e.exports.__esModule=!0,e.exports.default=e.exports),i.apply(this,arguments)}e.exports=i,e.exports.__esModule=!0,e.exports.default=e.exports},456:function(e){function t(n){return e.exports=t=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},e.exports.__esModule=!0,e.exports.default=e.exports,t(n)}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports},680:function(e,t,n){var r=n(825);e.exports=function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&r(e,t)},e.exports.__esModule=!0,e.exports.default=e.exports},510:function(e){e.exports=function(e){return-1!==Function.toString.call(e).indexOf("[native code]")},e.exports.__esModule=!0,e.exports.default=e.exports},455:function(e){e.exports=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}},e.exports.__esModule=!0,e.exports.default=e.exports},178:function(e){e.exports=function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)},e.exports.__esModule=!0,e.exports.default=e.exports},439:function(e){e.exports=function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,a,o,s=[],u=!0,l=!1;try{if(a=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;u=!1}else for(;!(u=(r=a.call(n)).done)&&(s.push(r.value),s.length!==t);u=!0);}catch(e){l=!0,i=e}finally{try{if(!u&&null!=n.return&&(o=n.return(),Object(o)!==o))return}finally{if(l)throw i}}return s}},e.exports.__esModule=!0,e.exports.default=e.exports},74:function(e){e.exports=function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")},e.exports.__esModule=!0,e.exports.default=e.exports},451:function(e){e.exports=function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")},e.exports.__esModule=!0,e.exports.default=e.exports},210:function(e,t,n){var r=n(64).default,i=n(477);e.exports=function(e,t){if(t&&("object"===r(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return i(e)},e.exports.__esModule=!0,e.exports.default=e.exports},898:function(e,t,n){var r=n(64).default;function i(){"use strict";e.exports=i=function(){return t},e.exports.__esModule=!0,e.exports.default=e.exports;var t={},n=Object.prototype,a=n.hasOwnProperty,o=Object.defineProperty||function(e,t,n){e[t]=n.value},s="function"==typeof Symbol?Symbol:{},u=s.iterator||"@@iterator",l=s.asyncIterator||"@@asyncIterator",c=s.toStringTag||"@@toStringTag";function h(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{h({},"")}catch(e){h=function(e,t,n){return e[t]=n}}function d(e,t,n,r){var i=t&&t.prototype instanceof v?t:v,a=Object.create(i.prototype),s=new R(r||[]);return o(a,"_invoke",{value:w(e,n,s)}),a}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=d;var p={};function v(){}function m(){}function g(){}var y={};h(y,u,(function(){return this}));var _=Object.getPrototypeOf,x=_&&_(_(k([])));x&&x!==n&&a.call(x,u)&&(y=x);var M=g.prototype=v.prototype=Object.create(y);function S(e){["next","throw","return"].forEach((function(t){h(e,t,(function(e){return this._invoke(t,e)}))}))}function b(e,t){function n(i,o,s,u){var l=f(e[i],e,o);if("throw"!==l.type){var c=l.arg,h=c.value;return h&&"object"==r(h)&&a.call(h,"__await")?t.resolve(h.__await).then((function(e){n("next",e,s,u)}),(function(e){n("throw",e,s,u)})):t.resolve(h).then((function(e){c.value=e,s(c)}),(function(e){return n("throw",e,s,u)}))}u(l.arg)}var i;o(this,"_invoke",{value:function(e,r){function a(){return new t((function(t,i){n(e,r,t,i)}))}return i=i?i.then(a,a):a()}})}function w(e,t,n){var r="suspendedStart";return function(i,a){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===i)throw a;return C()}for(n.method=i,n.arg=a;;){var o=n.delegate;if(o){var s=T(o,n);if(s){if(s===p)continue;return s}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===r)throw r="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r="executing";var u=f(e,t,n);if("normal"===u.type){if(r=n.done?"completed":"suspendedYield",u.arg===p)continue;return{value:u.arg,done:n.done}}"throw"===u.type&&(r="completed",n.method="throw",n.arg=u.arg)}}}function T(e,t){var n=t.method,r=e.iterator[n];if(void 0===r)return t.delegate=null,"throw"===n&&e.iterator.return&&(t.method="return",t.arg=void 0,T(e,t),"throw"===t.method)||"return"!==n&&(t.method="throw",t.arg=new TypeError("The iterator does not provide a '"+n+"' method")),p;var i=f(r,e.iterator,t.arg);if("throw"===i.type)return t.method="throw",t.arg=i.arg,t.delegate=null,p;var a=i.arg;return a?a.done?(t[e.resultName]=a.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,p):a:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,p)}function E(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function A(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function R(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(E,this),this.reset(!0)}function k(e){if(e){var t=e[u];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,r=function t(){for(;++n<e.length;)if(a.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=void 0,t.done=!0,t};return r.next=r}}return{next:C}}function C(){return{value:void 0,done:!0}}return m.prototype=g,o(M,"constructor",{value:g,configurable:!0}),o(g,"constructor",{value:m,configurable:!0}),m.displayName=h(g,c,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===m||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,g):(e.__proto__=g,h(e,c,"GeneratorFunction")),e.prototype=Object.create(M),e},t.awrap=function(e){return{__await:e}},S(b.prototype),h(b.prototype,l,(function(){return this})),t.AsyncIterator=b,t.async=function(e,n,r,i,a){void 0===a&&(a=Promise);var o=new b(d(e,n,r,i),a);return t.isGeneratorFunction(n)?o:o.next().then((function(e){return e.done?e.value:o.next()}))},S(M),h(M,c,"Generator"),h(M,u,(function(){return this})),h(M,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=k,R.prototype={constructor:R,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(A),!e)for(var t in this)"t"===t.charAt(0)&&a.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function n(n,r){return o.type="throw",o.arg=e,t.next=n,r&&(t.method="next",t.arg=void 0),!!r}for(var r=this.tryEntries.length-1;r>=0;--r){var i=this.tryEntries[r],o=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var s=a.call(i,"catchLoc"),u=a.call(i,"finallyLoc");if(s&&u){if(this.prev<i.catchLoc)return n(i.catchLoc,!0);if(this.prev<i.finallyLoc)return n(i.finallyLoc)}else if(s){if(this.prev<i.catchLoc)return n(i.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return n(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var r=this.tryEntries[n];if(r.tryLoc<=this.prev&&a.call(r,"finallyLoc")&&this.prev<r.finallyLoc){var i=r;break}}i&&("break"===e||"continue"===e)&&i.tryLoc<=t&&t<=i.finallyLoc&&(i=null);var o=i?i.completion:{};return o.type=e,o.arg=t,i?(this.method="next",this.next=i.finallyLoc,p):this.complete(o)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),p},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),A(n),p}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var i=r.arg;A(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:k(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=void 0),p}},t}e.exports=i,e.exports.__esModule=!0,e.exports.default=e.exports},825:function(e){function t(n,r){return e.exports=t=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},e.exports.__esModule=!0,e.exports.default=e.exports,t(n,r)}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports},737:function(e,t,n){var r=n(814),i=n(439),a=n(35),o=n(74);e.exports=function(e,t){return r(e)||i(e,t)||a(e,t)||o()},e.exports.__esModule=!0,e.exports.default=e.exports},375:function(e,t,n){var r=n(456);e.exports=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=r(e)););return e},e.exports.__esModule=!0,e.exports.default=e.exports},539:function(e,t,n){var r=n(876),i=n(178),a=n(35),o=n(451);e.exports=function(e){return r(e)||i(e)||a(e)||o()},e.exports.__esModule=!0,e.exports.default=e.exports},327:function(e,t,n){var r=n(64).default;e.exports=function(e,t){if("object"!==r(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var i=n.call(e,t||"default");if("object"!==r(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)},e.exports.__esModule=!0,e.exports.default=e.exports},233:function(e,t,n){var r=n(64).default,i=n(327);e.exports=function(e){var t=i(e,"string");return"symbol"===r(t)?t:String(t)},e.exports.__esModule=!0,e.exports.default=e.exports},64:function(e){function t(n){return e.exports=t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e.exports.__esModule=!0,e.exports.default=e.exports,t(n)}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports},35:function(e,t,n){var r=n(693);e.exports=function(e,t){if(e){if("string"==typeof e)return r(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?r(e,t):void 0}},e.exports.__esModule=!0,e.exports.default=e.exports},261:function(e,t,n){var r=n(456),i=n(825),a=n(510),o=n(360);function s(t){var n="function"==typeof Map?new Map:void 0;return e.exports=s=function(e){if(null===e||!a(e))return e;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==n){if(n.has(e))return n.get(e);n.set(e,t)}function t(){return o(e,arguments,r(this).constructor)}return t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),i(t,e)},e.exports.__esModule=!0,e.exports.default=e.exports,s(t)}e.exports=s,e.exports.__esModule=!0,e.exports.default=e.exports}},t={};function n(r){var i=t[r];if(void 0!==i)return i.exports;var a=t[r]={exports:{}};return e[r](a,a.exports,n),a.exports}n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,{a:t}),t},n.d=function(e,t){for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var r={};return function(){"use strict";n.r(r),n.d(r,{ACESFilmicToneMapping:function(){return Ae},ANOV:function(){return e},AddEquation:function(){return K},AddOperation:function(){return Se},AdditiveAnimationBlendMode:function(){return nn},AdditiveBlending:function(){return X},AlphaFormat:function(){return at},AlwaysCompare:function(){return zn},AlwaysDepth:function(){return fe},AlwaysStencilFunc:function(){return Pn},AmbientLight:function(){return af},AmbientLightProbe:function(){return Mf},AnimationAction:function(){return Kf},AnimationClip:function(){return Ad},AnimationLoader:function(){return Nd},AnimationMixer:function(){return Qf},AnimationObjectGroup:function(){return Zf},AnimationUtils:function(){return pd},ArcCurve:function(){return Cc},ArrayCamera:function(){return Qu},ArrowHelper:function(){return Vp},Audio:function(){return If},AudioAnalyser:function(){return Bf},AudioContext:function(){return yf},AudioListener:function(){return Pf},AudioLoader:function(){return _f},AxesHelper:function(){return Wp},BackSide:function(){return H},BasicDepthPacking:function(){return ln},BasicShadowMap:function(){return O},Bone:function(){return Wl},BooleanKeyframeTrack:function(){return xd},Box2:function(){return cp},Box3:function(){return Jr},Box3Helper:function(){return zp},BoxGeometry:function(){return uo},BoxHelper:function(){return Bp},BufferAttribute:function(){return wa},BufferGeometry:function(){return Ga},BufferGeometryLoader:function(){return df},ByteType:function(){return Ze},CSS2DRenderer:function(){return Tv},CSS3DRenderer:function(){return Lv},Cache:function(){return kd},Camera:function(){return vo},CameraHelper:function(){return Dp},CanvasTexture:function(){return Ac},CapsuleGeometry:function(){return Jc},CatmullRomCurve3:function(){return Oc},CineonToneMapping:function(){return Ee},CircleGeometry:function(){return Qc},ClampToEdgeWrapping:function(){return Oe},Clock:function(){return Ef},Color:function(){return pa},ColorKeyframeTrack:function(){return Md},ColorManagement:function(){return Pr},CompressedArrayTexture:function(){return Tc},CompressedCubeTexture:function(){return Ec},CompressedTexture:function(){return wc},CompressedTextureLoader:function(){return Fd},ConeGeometry:function(){return eh},CubeCamera:function(){return yo},CubeReflectionMapping:function(){return Ce},CubeRefractionMapping:function(){return Le},CubeTexture:function(){return _o},CubeTextureLoader:function(){return zd},CubeUVReflectionMapping:function(){return De},CubicBezierCurve:function(){return zc},CubicBezierCurve3:function(){return Hc},CubicInterpolant:function(){return md},CullFaceBack:function(){return I},CullFaceFront:function(){return D},CullFaceFrontBack:function(){return U},CullFaceNone:function(){return P},Curve:function(){return Rc},CurvePath:function(){return Yc},CustomBlending:function(){return Z},CustomToneMapping:function(){return Re},CylinderGeometry:function(){return $c},Cylindrical:function(){return up},DRACOLoader:function(){return Vv},Data3DTexture:function(){return Wr},DataArrayTexture:function(){return Gr},DataTexture:function(){return jl},DataTextureLoader:function(){return Hd},DataUtils:function(){return Ma},DecrementStencilOp:function(){return Mn},DecrementWrapStencilOp:function(){return bn},DefaultLoadingManager:function(){return Ld},DepthFormat:function(){return lt},DepthStencilFormat:function(){return ct},DepthTexture:function(){return nl},Direction:function(){return hv},DirectionalLight:function(){return rf},DirectionalLightHelper:function(){return Lp},DiscreteInterpolant:function(){return yd},DisplayP3ColorSpace:function(){return mn},DodecahedronGeometry:function(){return nh},DoubleSide:function(){return G},DstAlphaFactor:function(){return se},DstColorFactor:function(){return le},DynamicCopyUsage:function(){return Yn},DynamicDrawUsage:function(){return Gn},DynamicReadUsage:function(){return jn},EdgesGeometry:function(){return sh},EllipseCurve:function(){return kc},EqualCompare:function(){return Un},EqualDepth:function(){return me},EqualStencilFunc:function(){return An},EquirectangularReflectionMapping:function(){return Pe},EquirectangularRefractionMapping:function(){return Ie},Euler:function(){return Di},EventDispatcher:function(){return tr},ExtrudeGeometry:function(){return Fh},FileLoader:function(){return Od},Float16BufferAttribute:function(){return Pa},Float32BufferAttribute:function(){return Ia},Float64BufferAttribute:function(){return Da},FloatType:function(){return et},Fog:function(){return hl},FogExp2:function(){return cl},FramebufferTexture:function(){return bc},FrontSide:function(){return z},Frustum:function(){return Ao},GLBufferAttribute:function(){return rp},GLSL1:function(){return Kn},GLSL3:function(){return Jn},GLTFLoader:function(){return Xv},GreaterCompare:function(){return Nn},GreaterDepth:function(){return ye},GreaterEqualCompare:function(){return Bn},GreaterEqualDepth:function(){return ge},GreaterEqualStencilFunc:function(){return Ln},GreaterStencilFunc:function(){return kn},GridHelper:function(){return Ep},Group:function(){return Hv},HalfFloatType:function(){return tt},HemisphereLight:function(){return Wd},HemisphereLightHelper:function(){return Tp},HemisphereLightProbe:function(){return xf},IcosahedronGeometry:function(){return zh},ImageBitmapLoader:function(){return gf},ImageLoader:function(){return Bd},ImageUtils:function(){return Ir},IncrementStencilOp:function(){return xn},IncrementWrapStencilOp:function(){return Sn},InstancedBufferAttribute:function(){return Zl},InstancedBufferGeometry:function(){return hf},InstancedInterleavedBuffer:function(){return np},InstancedMesh:function(){return rc},Int16BufferAttribute:function(){return Ra},Int32BufferAttribute:function(){return Ca},Int8BufferAttribute:function(){return Ta},IntType:function(){return Qe},InterleavedBuffer:function(){return fl},InterleavedBufferAttribute:function(){return vl},Interpolant:function(){return vd},InterpolateDiscrete:function(){return Zt},InterpolateLinear:function(){return Kt},InterpolateSmooth:function(){return Jt},InvertStencilOp:function(){return wn},KeepStencilOp:function(){return yn},KeyframeTrack:function(){return _d},LOD:function(){return Il},LatheGeometry:function(){return Kc},Layers:function(){return Ui},LessCompare:function(){return Dn},LessDepth:function(){return pe},LessEqualCompare:function(){return On},LessEqualDepth:function(){return ve},LessEqualStencilFunc:function(){return Rn},LessStencilFunc:function(){return En},Light:function(){return Vd},LightProbe:function(){return uf},Line:function(){return cc},Line2:function(){return l_},Line3:function(){return fp},LineBasicMaterial:function(){return ic},LineCurve:function(){return Gc},LineCurve3:function(){return Vc},LineDashedMaterial:function(){return sd},LineGeometry:function(){return jy},LineLoop:function(){return pc},LineMaterial:function(){return Yy},LineSegments:function(){return fc},LinearEncoding:function(){return sn},LinearFilter:function(){return Ve},LinearInterpolant:function(){return gd},LinearMipMapLinearFilter:function(){return qe},LinearMipMapNearestFilter:function(){return je},LinearMipmapLinearFilter:function(){return Xe},LinearMipmapNearestFilter:function(){return We},LinearSRGBColorSpace:function(){return vn},LinearToneMapping:function(){return we},Loader:function(){return Pd},LoaderUtils:function(){return cf},LoadingManager:function(){return Cd},LoopOnce:function(){return Xt},LoopPingPong:function(){return Yt},LoopRepeat:function(){return qt},LuminanceAlphaFormat:function(){return ut},LuminanceFormat:function(){return st},MOUSE:function(){return C},Material:function(){return la},MaterialLoader:function(){return lf},MathUtils:function(){return vr},Matrix3:function(){return gr},Matrix4:function(){return wi},MaxEquation:function(){return ee},Mesh:function(){return yv},MeshBasicMaterial:function(){return ma},MeshDepthMaterial:function(){return Xu},MeshDistanceMaterial:function(){return qu},MeshLambertMaterial:function(){return ad},MeshMatcapMaterial:function(){return od},MeshNormalMaterial:function(){return id},MeshPhongMaterial:function(){return nd},MeshPhysicalMaterial:function(){return td},MeshStandardMaterial:function(){return ed},MeshToonMaterial:function(){return rd},MinEquation:function(){return $},MirroredRepeatWrapping:function(){return Ne},MixOperation:function(){return Me},ModelLoader:function(){return qg},ModelType:function(){return Xg},MultiplyBlending:function(){return Y},MultiplyOperation:function(){return xe},NearestFilter:function(){return Fe},NearestMipMapLinearFilter:function(){return Ge},NearestMipMapNearestFilter:function(){return ze},NearestMipmapLinearFilter:function(){return He},NearestMipmapNearestFilter:function(){return Be},NeverCompare:function(){return In},NeverDepth:function(){return de},NeverStencilFunc:function(){return Tn},NoBlending:function(){return W},NoColorSpace:function(){return fn},NoToneMapping:function(){return be},NormalAnimationBlendMode:function(){return tn},NormalBlending:function(){return j},NotEqualCompare:function(){return Fn},NotEqualDepth:function(){return _e},NotEqualStencilFunc:function(){return Cn},NumberKeyframeTrack:function(){return Sd},Object3D:function(){return Zi},ObjectLoader:function(){return ff},ObjectSpaceNormalMap:function(){return dn},OctahedronGeometry:function(){return Hh},OneFactor:function(){return ne},OneMinusDstAlphaFactor:function(){return ue},OneMinusDstColorFactor:function(){return ce},OneMinusSrcAlphaFactor:function(){return oe},OneMinusSrcColorFactor:function(){return ie},OrbitControls:function(){return Qp},OrthographicCamera:function(){return Ho},PCFShadowMap:function(){return N},PCFSoftShadowMap:function(){return F},PMREMGenerator:function(){return Ko},Path:function(){return Zc},PerspectiveCamera:function(){return Nv},Plane:function(){return wo},PlaneGeometry:function(){return Co},PlaneHelper:function(){return Hp},PointLight:function(){return tf},PointLightHelper:function(){return Mp},Points:function(){return xc},PointsMaterial:function(){return vc},PolarGridHelper:function(){return Ap},PolyhedronGeometry:function(){return th},PositionalAudio:function(){return Ff},PropertyBinding:function(){return Yf},PropertyMixer:function(){return zf},QuadraticBezierCurve:function(){return Wc},QuadraticBezierCurve3:function(){return jc},Quaternion:function(){return qr},QuaternionKeyframeTrack:function(){return wd},QuaternionLinearInterpolant:function(){return bd},RED_GREEN_RGTC2_Format:function(){return Wt},RED_RGTC1_Format:function(){return Gt},REVISION:function(){return k},RGBADepthPacking:function(){return cn},RGBAFormat:function(){return ot},RGBAIntegerFormat:function(){return vt},RGBA_ASTC_10x10_Format:function(){return Ft},RGBA_ASTC_10x5_Format:function(){return Ut},RGBA_ASTC_10x6_Format:function(){return Ot},RGBA_ASTC_10x8_Format:function(){return Nt},RGBA_ASTC_12x10_Format:function(){return Bt},RGBA_ASTC_12x12_Format:function(){return zt},RGBA_ASTC_4x4_Format:function(){return At},RGBA_ASTC_5x4_Format:function(){return Rt},RGBA_ASTC_5x5_Format:function(){return kt},RGBA_ASTC_6x5_Format:function(){return Ct},RGBA_ASTC_6x6_Format:function(){return Lt},RGBA_ASTC_8x5_Format:function(){return Pt},RGBA_ASTC_8x6_Format:function(){return It},RGBA_ASTC_8x8_Format:function(){return Dt},RGBA_BPTC_Format:function(){return Ht},RGBA_ETC2_EAC_Format:function(){return Et},RGBA_PVRTC_2BPPV1_Format:function(){return bt},RGBA_PVRTC_4BPPV1_Format:function(){return St},RGBA_S3TC_DXT1_Format:function(){return gt},RGBA_S3TC_DXT3_Format:function(){return yt},RGBA_S3TC_DXT5_Format:function(){return _t},RGB_ETC1_Format:function(){return wt},RGB_ETC2_Format:function(){return Tt},RGB_PVRTC_2BPPV1_Format:function(){return Mt},RGB_PVRTC_4BPPV1_Format:function(){return xt},RGB_S3TC_DXT1_Format:function(){return mt},RGFormat:function(){return ft},RGIntegerFormat:function(){return pt},RawShaderMaterial:function(){return $h},Ray:function(){return bi},Raycaster:function(){return ip},RectAreaLight:function(){return of},RedFormat:function(){return ht},RedIntegerFormat:function(){return dt},ReinhardToneMapping:function(){return Te},RenderTarget:function(){return zr},RepeatWrapping:function(){return Ue},ReplaceStencilOp:function(){return _n},ReverseSubtractEquation:function(){return Q},RingGeometry:function(){return Gh},SIGNED_RED_GREEN_RGTC2_Format:function(){return jt},SIGNED_RED_RGTC1_Format:function(){return Vt},SRGBColorSpace:function(){return pn},Scene:function(){return dl},SceneControl:function(){return Bv},ShaderChunk:function(){return Lo},ShaderLib:function(){return Io},ShaderMaterial:function(){return po},ShadowMaterial:function(){return Qh},Shape:function(){return uh},ShapeGeometry:function(){return Vh},ShapePath:function(){return jp},ShapeUtils:function(){return Uh},ShortType:function(){return Ke},Skeleton:function(){return Yl},SkeletonHelper:function(){return _p},SkinnedMesh:function(){return Vl},Source:function(){return Ur},Sphere:function(){return vi},SphereGeometry:function(){return Wh},Spherical:function(){return sp},SphericalHarmonics3:function(){return sf},SplineCurve:function(){return Xc},SpotLight:function(){return Kd},SpotLightHelper:function(){return vp},Sprite:function(){return kl},SpriteMaterial:function(){return ml},SrcAlphaFactor:function(){return ae},SrcAlphaSaturateFactor:function(){return he},SrcColorFactor:function(){return re},StaticCopyUsage:function(){return qn},StaticDrawUsage:function(){return Hn},StaticReadUsage:function(){return Wn},StereoCamera:function(){return Tf},StreamCopyUsage:function(){return Zn},StreamDrawUsage:function(){return Vn},StreamReadUsage:function(){return Xn},StringKeyframeTrack:function(){return Td},SubtractEquation:function(){return J},SubtractiveBlending:function(){return q},TOUCH:function(){return L},TangentSpaceNormalMap:function(){return hn},TetrahedronGeometry:function(){return jh},Texture:function(){return Fr},TextureLoader:function(){return Gd},TorusGeometry:function(){return Xh},TorusKnotGeometry:function(){return qh},TransformControls:function(){return Cy},Triangle:function(){return sa},TriangleFanDrawMode:function(){return on},TriangleStripDrawMode:function(){return an},TrianglesDrawMode:function(){return rn},TubeGeometry:function(){return Yh},TwoPassDoubleSide:function(){return V},UVMapping:function(){return ke},Uint16BufferAttribute:function(){return ka},Uint32BufferAttribute:function(){return La},Uint8BufferAttribute:function(){return Ea},Uint8ClampedBufferAttribute:function(){return Aa},Uniform:function(){return $f},UniformsGroup:function(){return tp},UniformsLib:function(){return Po},UniformsUtils:function(){return fo},UnsignedByteType:function(){return Ye},UnsignedInt248Type:function(){return it},UnsignedIntType:function(){return $e},UnsignedShort4444Type:function(){return nt},UnsignedShort5551Type:function(){return rt},UnsignedShortType:function(){return Je},VSMShadowMap:function(){return B},Vector2:function(){return mr},Vector3:function(){return Yr},Vector4:function(){return Br},VectorKeyframeTrack:function(){return Ed},VideoTexture:function(){return Sc},WebGL1Renderer:function(){return ul},WebGL3DRenderTarget:function(){return jr},WebGLArrayRenderTarget:function(){return Vr},WebGLCoordinateSystem:function(){return $n},WebGLCubeRenderTarget:function(){return xo},WebGLMultipleRenderTargets:function(){return Xr},WebGLRenderTarget:function(){return Hr},WebGLRenderer:function(){return sl},WebGLUtils:function(){return Ju},WebGPUCoordinateSystem:function(){return er},WireframeGeometry:function(){return Zh},WrapAroundEnding:function(){return en},ZeroCurvatureEnding:function(){return Qt},ZeroFactor:function(){return te},ZeroSlopeEnding:function(){return $t},ZeroStencilOp:function(){return gn},_SRGBAFormat:function(){return Qn},createControlLine:function(){return Jg},createLabel:function(){return Yg},createTransformControls:function(){return Py},dom:function(){return h_},globalObjectManage:function(){return mv},sRGBEncoding:function(){return un},use:function(){return d_},utils:function(){return c_}});var e={};n.r(e),n.d(e,{ACESFilmicToneMapping:function(){return Ae},AddEquation:function(){return K},AddOperation:function(){return Se},AdditiveAnimationBlendMode:function(){return nn},AdditiveBlending:function(){return X},AlphaFormat:function(){return at},AlwaysCompare:function(){return zn},AlwaysDepth:function(){return fe},AlwaysStencilFunc:function(){return Pn},AmbientLight:function(){return af},AmbientLightProbe:function(){return Mf},AnimationAction:function(){return Kf},AnimationClip:function(){return Ad},AnimationLoader:function(){return Nd},AnimationMixer:function(){return Qf},AnimationObjectGroup:function(){return Zf},AnimationUtils:function(){return pd},ArcCurve:function(){return Cc},ArrayCamera:function(){return Qu},ArrowHelper:function(){return Vp},Audio:function(){return If},AudioAnalyser:function(){return Bf},AudioContext:function(){return yf},AudioListener:function(){return Pf},AudioLoader:function(){return _f},AxesHelper:function(){return Wp},BackSide:function(){return H},BasicDepthPacking:function(){return ln},BasicShadowMap:function(){return O},Bone:function(){return Wl},BooleanKeyframeTrack:function(){return xd},Box2:function(){return cp},Box3:function(){return Jr},Box3Helper:function(){return zp},BoxGeometry:function(){return uo},BoxHelper:function(){return Bp},BufferAttribute:function(){return wa},BufferGeometry:function(){return Ga},BufferGeometryLoader:function(){return df},ByteType:function(){return Ze},CSS2DRenderer:function(){return Tv},CSS3DRenderer:function(){return Lv},Cache:function(){return kd},Camera:function(){return vo},CameraHelper:function(){return Dp},CanvasTexture:function(){return Ac},CapsuleGeometry:function(){return Jc},CatmullRomCurve3:function(){return Oc},CineonToneMapping:function(){return Ee},CircleGeometry:function(){return Qc},ClampToEdgeWrapping:function(){return Oe},Clock:function(){return Ef},Color:function(){return pa},ColorKeyframeTrack:function(){return Md},ColorManagement:function(){return Pr},CompressedArrayTexture:function(){return Tc},CompressedCubeTexture:function(){return Ec},CompressedTexture:function(){return wc},CompressedTextureLoader:function(){return Fd},ConeGeometry:function(){return eh},CubeCamera:function(){return yo},CubeReflectionMapping:function(){return Ce},CubeRefractionMapping:function(){return Le},CubeTexture:function(){return _o},CubeTextureLoader:function(){return zd},CubeUVReflectionMapping:function(){return De},CubicBezierCurve:function(){return zc},CubicBezierCurve3:function(){return Hc},CubicInterpolant:function(){return md},CullFaceBack:function(){return I},CullFaceFront:function(){return D},CullFaceFrontBack:function(){return U},CullFaceNone:function(){return P},Curve:function(){return Rc},CurvePath:function(){return Yc},CustomBlending:function(){return Z},CustomToneMapping:function(){return Re},CylinderGeometry:function(){return $c},Cylindrical:function(){return up},DRACOLoader:function(){return Vv},Data3DTexture:function(){return Wr},DataArrayTexture:function(){return Gr},DataTexture:function(){return jl},DataTextureLoader:function(){return Hd},DataUtils:function(){return Ma},DecrementStencilOp:function(){return Mn},DecrementWrapStencilOp:function(){return bn},DefaultLoadingManager:function(){return Ld},DepthFormat:function(){return lt},DepthStencilFormat:function(){return ct},DepthTexture:function(){return nl},Direction:function(){return hv},DirectionalLight:function(){return rf},DirectionalLightHelper:function(){return Lp},DiscreteInterpolant:function(){return yd},DisplayP3ColorSpace:function(){return mn},DodecahedronGeometry:function(){return nh},DoubleSide:function(){return G},DstAlphaFactor:function(){return se},DstColorFactor:function(){return le},DynamicCopyUsage:function(){return Yn},DynamicDrawUsage:function(){return Gn},DynamicReadUsage:function(){return jn},EdgesGeometry:function(){return sh},EllipseCurve:function(){return kc},EqualCompare:function(){return Un},EqualDepth:function(){return me},EqualStencilFunc:function(){return An},EquirectangularReflectionMapping:function(){return Pe},EquirectangularRefractionMapping:function(){return Ie},Euler:function(){return Di},EventDispatcher:function(){return tr},ExtrudeGeometry:function(){return Fh},FileLoader:function(){return Od},Float16BufferAttribute:function(){return Pa},Float32BufferAttribute:function(){return Ia},Float64BufferAttribute:function(){return Da},FloatType:function(){return et},Fog:function(){return hl},FogExp2:function(){return cl},FramebufferTexture:function(){return bc},FrontSide:function(){return z},Frustum:function(){return Ao},GLBufferAttribute:function(){return rp},GLSL1:function(){return Kn},GLSL3:function(){return Jn},GLTFLoader:function(){return Xv},GreaterCompare:function(){return Nn},GreaterDepth:function(){return ye},GreaterEqualCompare:function(){return Bn},GreaterEqualDepth:function(){return ge},GreaterEqualStencilFunc:function(){return Ln},GreaterStencilFunc:function(){return kn},GridHelper:function(){return Ep},Group:function(){return Hv},HalfFloatType:function(){return tt},HemisphereLight:function(){return Wd},HemisphereLightHelper:function(){return Tp},HemisphereLightProbe:function(){return xf},IcosahedronGeometry:function(){return zh},ImageBitmapLoader:function(){return gf},ImageLoader:function(){return Bd},ImageUtils:function(){return Ir},IncrementStencilOp:function(){return xn},IncrementWrapStencilOp:function(){return Sn},InstancedBufferAttribute:function(){return Zl},InstancedBufferGeometry:function(){return hf},InstancedInterleavedBuffer:function(){return np},InstancedMesh:function(){return rc},Int16BufferAttribute:function(){return Ra},Int32BufferAttribute:function(){return Ca},Int8BufferAttribute:function(){return Ta},IntType:function(){return Qe},InterleavedBuffer:function(){return fl},InterleavedBufferAttribute:function(){return vl},Interpolant:function(){return vd},InterpolateDiscrete:function(){return Zt},InterpolateLinear:function(){return Kt},InterpolateSmooth:function(){return Jt},InvertStencilOp:function(){return wn},KeepStencilOp:function(){return yn},KeyframeTrack:function(){return _d},LOD:function(){return Il},LatheGeometry:function(){return Kc},Layers:function(){return Ui},LessCompare:function(){return Dn},LessDepth:function(){return pe},LessEqualCompare:function(){return On},LessEqualDepth:function(){return ve},LessEqualStencilFunc:function(){return Rn},LessStencilFunc:function(){return En},Light:function(){return Vd},LightProbe:function(){return uf},Line:function(){return cc},Line2:function(){return l_},Line3:function(){return fp},LineBasicMaterial:function(){return ic},LineCurve:function(){return Gc},LineCurve3:function(){return Vc},LineDashedMaterial:function(){return sd},LineGeometry:function(){return jy},LineLoop:function(){return pc},LineMaterial:function(){return Yy},LineSegments:function(){return fc},LinearEncoding:function(){return sn},LinearFilter:function(){return Ve},LinearInterpolant:function(){return gd},LinearMipMapLinearFilter:function(){return qe},LinearMipMapNearestFilter:function(){return je},LinearMipmapLinearFilter:function(){return Xe},LinearMipmapNearestFilter:function(){return We},LinearSRGBColorSpace:function(){return vn},LinearToneMapping:function(){return we},Loader:function(){return Pd},LoaderUtils:function(){return cf},LoadingManager:function(){return Cd},LoopOnce:function(){return Xt},LoopPingPong:function(){return Yt},LoopRepeat:function(){return qt},LuminanceAlphaFormat:function(){return ut},LuminanceFormat:function(){return st},MOUSE:function(){return C},Material:function(){return la},MaterialLoader:function(){return lf},MathUtils:function(){return vr},Matrix3:function(){return gr},Matrix4:function(){return wi},MaxEquation:function(){return ee},Mesh:function(){return yv},MeshBasicMaterial:function(){return ma},MeshDepthMaterial:function(){return Xu},MeshDistanceMaterial:function(){return qu},MeshLambertMaterial:function(){return ad},MeshMatcapMaterial:function(){return od},MeshNormalMaterial:function(){return id},MeshPhongMaterial:function(){return nd},MeshPhysicalMaterial:function(){return td},MeshStandardMaterial:function(){return ed},MeshToonMaterial:function(){return rd},MinEquation:function(){return $},MirroredRepeatWrapping:function(){return Ne},MixOperation:function(){return Me},ModelLoader:function(){return qg},ModelType:function(){return Xg},MultiplyBlending:function(){return Y},MultiplyOperation:function(){return xe},NearestFilter:function(){return Fe},NearestMipMapLinearFilter:function(){return Ge},NearestMipMapNearestFilter:function(){return ze},NearestMipmapLinearFilter:function(){return He},NearestMipmapNearestFilter:function(){return Be},NeverCompare:function(){return In},NeverDepth:function(){return de},NeverStencilFunc:function(){return Tn},NoBlending:function(){return W},NoColorSpace:function(){return fn},NoToneMapping:function(){return be},NormalAnimationBlendMode:function(){return tn},NormalBlending:function(){return j},NotEqualCompare:function(){return Fn},NotEqualDepth:function(){return _e},NotEqualStencilFunc:function(){return Cn},NumberKeyframeTrack:function(){return Sd},Object3D:function(){return Zi},ObjectLoader:function(){return ff},ObjectSpaceNormalMap:function(){return dn},OctahedronGeometry:function(){return Hh},OneFactor:function(){return ne},OneMinusDstAlphaFactor:function(){return ue},OneMinusDstColorFactor:function(){return ce},OneMinusSrcAlphaFactor:function(){return oe},OneMinusSrcColorFactor:function(){return ie},OrbitControls:function(){return Qp},OrthographicCamera:function(){return Ho},PCFShadowMap:function(){return N},PCFSoftShadowMap:function(){return F},PMREMGenerator:function(){return Ko},Path:function(){return Zc},PerspectiveCamera:function(){return Nv},Plane:function(){return wo},PlaneGeometry:function(){return Co},PlaneHelper:function(){return Hp},PointLight:function(){return tf},PointLightHelper:function(){return Mp},Points:function(){return xc},PointsMaterial:function(){return vc},PolarGridHelper:function(){return Ap},PolyhedronGeometry:function(){return th},PositionalAudio:function(){return Ff},PropertyBinding:function(){return Yf},PropertyMixer:function(){return zf},QuadraticBezierCurve:function(){return Wc},QuadraticBezierCurve3:function(){return jc},Quaternion:function(){return qr},QuaternionKeyframeTrack:function(){return wd},QuaternionLinearInterpolant:function(){return bd},RED_GREEN_RGTC2_Format:function(){return Wt},RED_RGTC1_Format:function(){return Gt},REVISION:function(){return k},RGBADepthPacking:function(){return cn},RGBAFormat:function(){return ot},RGBAIntegerFormat:function(){return vt},RGBA_ASTC_10x10_Format:function(){return Ft},RGBA_ASTC_10x5_Format:function(){return Ut},RGBA_ASTC_10x6_Format:function(){return Ot},RGBA_ASTC_10x8_Format:function(){return Nt},RGBA_ASTC_12x10_Format:function(){return Bt},RGBA_ASTC_12x12_Format:function(){return zt},RGBA_ASTC_4x4_Format:function(){return At},RGBA_ASTC_5x4_Format:function(){return Rt},RGBA_ASTC_5x5_Format:function(){return kt},RGBA_ASTC_6x5_Format:function(){return Ct},RGBA_ASTC_6x6_Format:function(){return Lt},RGBA_ASTC_8x5_Format:function(){return Pt},RGBA_ASTC_8x6_Format:function(){return It},RGBA_ASTC_8x8_Format:function(){return Dt},RGBA_BPTC_Format:function(){return Ht},RGBA_ETC2_EAC_Format:function(){return Et},RGBA_PVRTC_2BPPV1_Format:function(){return bt},RGBA_PVRTC_4BPPV1_Format:function(){return St},RGBA_S3TC_DXT1_Format:function(){return gt},RGBA_S3TC_DXT3_Format:function(){return yt},RGBA_S3TC_DXT5_Format:function(){return _t},RGB_ETC1_Format:function(){return wt},RGB_ETC2_Format:function(){return Tt},RGB_PVRTC_2BPPV1_Format:function(){return Mt},RGB_PVRTC_4BPPV1_Format:function(){return xt},RGB_S3TC_DXT1_Format:function(){return mt},RGFormat:function(){return ft},RGIntegerFormat:function(){return pt},RawShaderMaterial:function(){return $h},Ray:function(){return bi},Raycaster:function(){return ip},RectAreaLight:function(){return of},RedFormat:function(){return ht},RedIntegerFormat:function(){return dt},ReinhardToneMapping:function(){return Te},RenderTarget:function(){return zr},RepeatWrapping:function(){return Ue},ReplaceStencilOp:function(){return _n},ReverseSubtractEquation:function(){return Q},RingGeometry:function(){return Gh},SIGNED_RED_GREEN_RGTC2_Format:function(){return jt},SIGNED_RED_RGTC1_Format:function(){return Vt},SRGBColorSpace:function(){return pn},Scene:function(){return dl},SceneControl:function(){return Bv},ShaderChunk:function(){return Lo},ShaderLib:function(){return Io},ShaderMaterial:function(){return po},ShadowMaterial:function(){return Qh},Shape:function(){return uh},ShapeGeometry:function(){return Vh},ShapePath:function(){return jp},ShapeUtils:function(){return Uh},ShortType:function(){return Ke},Skeleton:function(){return Yl},SkeletonHelper:function(){return _p},SkinnedMesh:function(){return Vl},Source:function(){return Ur},Sphere:function(){return vi},SphereGeometry:function(){return Wh},Spherical:function(){return sp},SphericalHarmonics3:function(){return sf},SplineCurve:function(){return Xc},SpotLight:function(){return Kd},SpotLightHelper:function(){return vp},Sprite:function(){return kl},SpriteMaterial:function(){return ml},SrcAlphaFactor:function(){return ae},SrcAlphaSaturateFactor:function(){return he},SrcColorFactor:function(){return re},StaticCopyUsage:function(){return qn},StaticDrawUsage:function(){return Hn},StaticReadUsage:function(){return Wn},StereoCamera:function(){return Tf},StreamCopyUsage:function(){return Zn},StreamDrawUsage:function(){return Vn},StreamReadUsage:function(){return Xn},StringKeyframeTrack:function(){return Td},SubtractEquation:function(){return J},SubtractiveBlending:function(){return q},TOUCH:function(){return L},TangentSpaceNormalMap:function(){return hn},TetrahedronGeometry:function(){return jh},Texture:function(){return Fr},TextureLoader:function(){return Gd},TorusGeometry:function(){return Xh},TorusKnotGeometry:function(){return qh},TransformControls:function(){return Cy},Triangle:function(){return sa},TriangleFanDrawMode:function(){return on},TriangleStripDrawMode:function(){return an},TrianglesDrawMode:function(){return rn},TubeGeometry:function(){return Yh},TwoPassDoubleSide:function(){return V},UVMapping:function(){return ke},Uint16BufferAttribute:function(){return ka},Uint32BufferAttribute:function(){return La},Uint8BufferAttribute:function(){return Ea},Uint8ClampedBufferAttribute:function(){return Aa},Uniform:function(){return $f},UniformsGroup:function(){return tp},UniformsLib:function(){return Po},UniformsUtils:function(){return fo},UnsignedByteType:function(){return Ye},UnsignedInt248Type:function(){return it},UnsignedIntType:function(){return $e},UnsignedShort4444Type:function(){return nt},UnsignedShort5551Type:function(){return rt},UnsignedShortType:function(){return Je},VSMShadowMap:function(){return B},Vector2:function(){return mr},Vector3:function(){return Yr},Vector4:function(){return Br},VectorKeyframeTrack:function(){return Ed},VideoTexture:function(){return Sc},WebGL1Renderer:function(){return ul},WebGL3DRenderTarget:function(){return jr},WebGLArrayRenderTarget:function(){return Vr},WebGLCoordinateSystem:function(){return $n},WebGLCubeRenderTarget:function(){return xo},WebGLMultipleRenderTargets:function(){return Xr},WebGLRenderTarget:function(){return Hr},WebGLRenderer:function(){return sl},WebGLUtils:function(){return Ju},WebGPUCoordinateSystem:function(){return er},WireframeGeometry:function(){return Zh},WrapAroundEnding:function(){return en},ZeroCurvatureEnding:function(){return Qt},ZeroFactor:function(){return te},ZeroSlopeEnding:function(){return $t},ZeroStencilOp:function(){return gn},_SRGBAFormat:function(){return Qn},createControlLine:function(){return Jg},createLabel:function(){return Yg},createTransformControls:function(){return Py},dom:function(){return h_},globalObjectManage:function(){return mv},sRGBEncoding:function(){return un},use:function(){return d_},utils:function(){return c_}});var t,i,a=n(576),o=n.n(a),s=n(672),u=n.n(s),l=n(67),c=n.n(l),h=n(261),d=n(539),f=n.n(d),p=n(835),v=n(313),m=n(737),g=n.n(m),y=n(408),_=n.n(y),x=n(456),M=n.n(x),S=n(477),b=n.n(S),w=n(680),T=n.n(w),E=n(859),A=n.n(E),R=n(898),k="155",C={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},L={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},P=0,I=1,D=2,U=3,O=0,N=1,F=2,B=3,z=0,H=1,G=2,V=2,W=0,j=1,X=2,q=3,Y=4,Z=5,K=100,J=101,Q=102,$=103,ee=104,te=200,ne=201,re=202,ie=203,ae=204,oe=205,se=206,ue=207,le=208,ce=209,he=210,de=0,fe=1,pe=2,ve=3,me=4,ge=5,ye=6,_e=7,xe=0,Me=1,Se=2,be=0,we=1,Te=2,Ee=3,Ae=4,Re=5,ke=300,Ce=301,Le=302,Pe=303,Ie=304,De=306,Ue=1e3,Oe=1001,Ne=1002,Fe=1003,Be=1004,ze=1004,He=1005,Ge=1005,Ve=1006,We=1007,je=1007,Xe=1008,qe=1008,Ye=1009,Ze=1010,Ke=1011,Je=1012,Qe=1013,$e=1014,et=1015,tt=1016,nt=1017,rt=1018,it=1020,at=1021,ot=1023,st=1024,ut=1025,lt=1026,ct=1027,ht=1028,dt=1029,ft=1030,pt=1031,vt=1033,mt=33776,gt=33777,yt=33778,_t=33779,xt=35840,Mt=35841,St=35842,bt=35843,wt=36196,Tt=37492,Et=37496,At=37808,Rt=37809,kt=37810,Ct=37811,Lt=37812,Pt=37813,It=37814,Dt=37815,Ut=37816,Ot=37817,Nt=37818,Ft=37819,Bt=37820,zt=37821,Ht=36492,Gt=36283,Vt=36284,Wt=36285,jt=36286,Xt=2200,qt=2201,Yt=2202,Zt=2300,Kt=2301,Jt=2302,Qt=2400,$t=2401,en=2402,tn=2500,nn=2501,rn=0,an=1,on=2,sn=3e3,un=3001,ln=3200,cn=3201,hn=0,dn=1,fn="",pn="srgb",vn="srgb-linear",mn="display-p3",gn=0,yn=7680,_n=7681,xn=7682,Mn=7683,Sn=34055,bn=34056,wn=5386,Tn=512,En=513,An=514,Rn=515,kn=516,Cn=517,Ln=518,Pn=519,In=512,Dn=513,Un=514,On=515,Nn=516,Fn=517,Bn=518,zn=519,Hn=35044,Gn=35048,Vn=35040,Wn=35045,jn=35049,Xn=35041,qn=35046,Yn=35050,Zn=35042,Kn="100",Jn="300 es",Qn=1035,$n=2e3,er=2001,tr=function(){function e(){a(this,e)}return s(e,[{key:"addEventListener",value:function(e,t){void 0===this._listeners&&(this._listeners={});var n=this._listeners;void 0===n[e]&&(n[e]=[]),-1===n[e].indexOf(t)&&n[e].push(t)}},{key:"hasEventListener",value:function(e,t){if(void 0===this._listeners)return!1;var n=this._listeners;return void 0!==n[e]&&-1!==n[e].indexOf(t)}},{key:"removeEventListener",value:function(e,t){if(void 0!==this._listeners){var n=this._listeners[e];if(void 0!==n){var r=n.indexOf(t);-1!==r&&n.splice(r,1)}}}},{key:"dispatchEvent",value:function(e){if(void 0!==this._listeners){var t=this._listeners[e.type];if(void 0!==t){e.target=this;for(var n=t.slice(0),r=0,i=n.length;r<i;r++)n[r].call(this,e);e.target=null}}}}]),e}(),nr=["00","01","02","03","04","05","06","07","08","09","0a","0b","0c","0d","0e","0f","10","11","12","13","14","15","16","17","18","19","1a","1b","1c","1d","1e","1f","20","21","22","23","24","25","26","27","28","29","2a","2b","2c","2d","2e","2f","30","31","32","33","34","35","36","37","38","39","3a","3b","3c","3d","3e","3f","40","41","42","43","44","45","46","47","48","49","4a","4b","4c","4d","4e","4f","50","51","52","53","54","55","56","57","58","59","5a","5b","5c","5d","5e","5f","60","61","62","63","64","65","66","67","68","69","6a","6b","6c","6d","6e","6f","70","71","72","73","74","75","76","77","78","79","7a","7b","7c","7d","7e","7f","80","81","82","83","84","85","86","87","88","89","8a","8b","8c","8d","8e","8f","90","91","92","93","94","95","96","97","98","99","9a","9b","9c","9d","9e","9f","a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","aa","ab","ac","ad","ae","af","b0","b1","b2","b3","b4","b5","b6","b7","b8","b9","ba","bb","bc","bd","be","bf","c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","ca","cb","cc","cd","ce","cf","d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","da","db","dc","dd","de","df","e0","e1","e2","e3","e4","e5","e6","e7","e8","e9","ea","eb","ec","ed","ee","ef","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff"],rr=1234567,ir=Math.PI/180,ar=180/Math.PI;function or(){var e=4294967295*Math.random()|0,t=4294967295*Math.random()|0,n=4294967295*Math.random()|0,r=4294967295*Math.random()|0;return(nr[255&e]+nr[e>>8&255]+nr[e>>16&255]+nr[e>>24&255]+"-"+nr[255&t]+nr[t>>8&255]+"-"+nr[t>>16&15|64]+nr[t>>24&255]+"-"+nr[63&n|128]+nr[n>>8&255]+"-"+nr[n>>16&255]+nr[n>>24&255]+nr[255&r]+nr[r>>8&255]+nr[r>>16&255]+nr[r>>24&255]).toLowerCase()}function sr(e,t,n){return Math.max(t,Math.min(n,e))}function ur(e,t){return(e%t+t)%t}function lr(e,t,n){return(1-n)*e+n*t}function cr(e){return 0==(e&e-1)&&0!==e}function hr(e){return Math.pow(2,Math.ceil(Math.log(e)/Math.LN2))}function dr(e){return Math.pow(2,Math.floor(Math.log(e)/Math.LN2))}function fr(e,t){switch(t.constructor){case Float32Array:return e;case Uint32Array:return e/4294967295;case Uint16Array:return e/65535;case Uint8Array:return e/255;case Int32Array:return Math.max(e/2147483647,-1);case Int16Array:return Math.max(e/32767,-1);case Int8Array:return Math.max(e/127,-1);default:throw new Error("Invalid component type.")}}function pr(e,t){switch(t.constructor){case Float32Array:return e;case Uint32Array:return Math.round(4294967295*e);case Uint16Array:return Math.round(65535*e);case Uint8Array:return Math.round(255*e);case Int32Array:return Math.round(2147483647*e);case Int16Array:return Math.round(32767*e);case Int8Array:return Math.round(127*e);default:throw new Error("Invalid component type.")}}var vr={DEG2RAD:ir,RAD2DEG:ar,generateUUID:or,clamp:sr,euclideanModulo:ur,mapLinear:function(e,t,n,r,i){return r+(e-t)*(i-r)/(n-t)},inverseLerp:function(e,t,n){return e!==t?(n-e)/(t-e):0},lerp:lr,damp:function(e,t,n,r){return lr(e,t,1-Math.exp(-n*r))},pingpong:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return t-Math.abs(ur(e,2*t)-t)},smoothstep:function(e,t,n){return e<=t?0:e>=n?1:(e=(e-t)/(n-t))*e*(3-2*e)},smootherstep:function(e,t,n){return e<=t?0:e>=n?1:(e=(e-t)/(n-t))*e*e*(e*(6*e-15)+10)},randInt:function(e,t){return e+Math.floor(Math.random()*(t-e+1))},randFloat:function(e,t){return e+Math.random()*(t-e)},randFloatSpread:function(e){return e*(.5-Math.random())},seededRandom:function(e){void 0!==e&&(rr=e);var t=rr+=1831565813;return t=Math.imul(t^t>>>15,1|t),(((t^=t+Math.imul(t^t>>>7,61|t))^t>>>14)>>>0)/4294967296},degToRad:function(e){return e*ir},radToDeg:function(e){return e*ar},isPowerOfTwo:cr,ceilPowerOfTwo:hr,floorPowerOfTwo:dr,setQuaternionFromProperEuler:function(e,t,n,r,i){var a=Math.cos,o=Math.sin,s=a(n/2),u=o(n/2),l=a((t+r)/2),c=o((t+r)/2),h=a((t-r)/2),d=o((t-r)/2),f=a((r-t)/2),p=o((r-t)/2);switch(i){case"XYX":e.set(s*c,u*h,u*d,s*l);break;case"YZY":e.set(u*d,s*c,u*h,s*l);break;case"ZXZ":e.set(u*h,u*d,s*c,s*l);break;case"XZX":e.set(s*c,u*p,u*f,s*l);break;case"YXY":e.set(u*f,s*c,u*p,s*l);break;case"ZYZ":e.set(u*p,u*f,s*c,s*l);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+i)}},normalize:pr,denormalize:fr},mr=function(e){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;a(this,t),t.prototype.isVector2=!0,this.x=e,this.y=n}return s(t,[{key:"width",get:function(){return this.x},set:function(e){this.x=e}},{key:"height",get:function(){return this.y},set:function(e){this.y=e}},{key:"set",value:function(e,t){return this.x=e,this.y=t,this}},{key:"setScalar",value:function(e){return this.x=e,this.y=e,this}},{key:"setX",value:function(e){return this.x=e,this}},{key:"setY",value:function(e){return this.y=e,this}},{key:"setComponent",value:function(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("index is out of range: "+e)}return this}},{key:"getComponent",value:function(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}}},{key:"clone",value:function(){return new this.constructor(this.x,this.y)}},{key:"copy",value:function(e){return this.x=e.x,this.y=e.y,this}},{key:"add",value:function(e){return this.x+=e.x,this.y+=e.y,this}},{key:"addScalar",value:function(e){return this.x+=e,this.y+=e,this}},{key:"addVectors",value:function(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}},{key:"addScaledVector",value:function(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}},{key:"sub",value:function(e){return this.x-=e.x,this.y-=e.y,this}},{key:"subScalar",value:function(e){return this.x-=e,this.y-=e,this}},{key:"subVectors",value:function(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}},{key:"multiply",value:function(e){return this.x*=e.x,this.y*=e.y,this}},{key:"multiplyScalar",value:function(e){return this.x*=e,this.y*=e,this}},{key:"divide",value:function(e){return this.x/=e.x,this.y/=e.y,this}},{key:"divideScalar",value:function(e){return this.multiplyScalar(1/e)}},{key:"applyMatrix3",value:function(e){var t=this.x,n=this.y,r=e.elements;return this.x=r[0]*t+r[3]*n+r[6],this.y=r[1]*t+r[4]*n+r[7],this}},{key:"min",value:function(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}},{key:"max",value:function(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}},{key:"clamp",value:function(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this}},{key:"clampScalar",value:function(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this}},{key:"clampLength",value:function(e,t){var n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))}},{key:"floor",value:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}},{key:"ceil",value:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}},{key:"round",value:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},{key:"roundToZero",value: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}},{key:"negate",value:function(){return this.x=-this.x,this.y=-this.y,this}},{key:"dot",value:function(e){return this.x*e.x+this.y*e.y}},{key:"cross",value:function(e){return this.x*e.y-this.y*e.x}},{key:"lengthSq",value:function(){return this.x*this.x+this.y*this.y}},{key:"length",value:function(){return Math.sqrt(this.x*this.x+this.y*this.y)}},{key:"manhattanLength",value:function(){return Math.abs(this.x)+Math.abs(this.y)}},{key:"normalize",value:function(){return this.divideScalar(this.length()||1)}},{key:"angle",value:function(){var e=Math.atan2(-this.y,-this.x)+Math.PI;return e}},{key:"angleTo",value:function(e){var t=Math.sqrt(this.lengthSq()*e.lengthSq());if(0===t)return Math.PI/2;var n=this.dot(e)/t;return Math.acos(sr(n,-1,1))}},{key:"distanceTo",value:function(e){return Math.sqrt(this.distanceToSquared(e))}},{key:"distanceToSquared",value:function(e){var t=this.x-e.x,n=this.y-e.y;return t*t+n*n}},{key:"manhattanDistanceTo",value:function(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}},{key:"setLength",value:function(e){return this.normalize().multiplyScalar(e)}},{key:"lerp",value:function(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}},{key:"lerpVectors",value:function(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this}},{key:"equals",value:function(e){return e.x===this.x&&e.y===this.y}},{key:"fromArray",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.x=e[t],this.y=e[t+1],this}},{key:"toArray",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return e[t]=this.x,e[t+1]=this.y,e}},{key:"fromBufferAttribute",value:function(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}},{key:"rotateAround",value:function(e,t){var n=Math.cos(t),r=Math.sin(t),i=this.x-e.x,a=this.y-e.y;return this.x=i*n-a*r+e.x,this.y=i*r+a*n+e.y,this}},{key:"random",value:function(){return this.x=Math.random(),this.y=Math.random(),this}},{key:e,value:R().mark((function e(){return R().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.x;case 2:return e.next=4,this.y;case 4:case"end":return e.stop()}}),e,this)}))}]),t}(Symbol.iterator),gr=function(){function e(t,n,r,i,o,s,u,l,c){a(this,e),e.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],void 0!==t&&this.set(t,n,r,i,o,s,u,l,c)}return s(e,[{key:"set",value:function(e,t,n,r,i,a,o,s,u){var l=this.elements;return l[0]=e,l[1]=r,l[2]=o,l[3]=t,l[4]=i,l[5]=s,l[6]=n,l[7]=a,l[8]=u,this}},{key:"identity",value:function(){return this.set(1,0,0,0,1,0,0,0,1),this}},{key:"copy",value:function(e){var t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],this}},{key:"extractBasis",value:function(e,t,n){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}},{key:"setFromMatrix4",value:function(e){var t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}},{key:"multiply",value:function(e){return this.multiplyMatrices(this,e)}},{key:"premultiply",value:function(e){return this.multiplyMatrices(e,this)}},{key:"multiplyMatrices",value:function(e,t){var n=e.elements,r=t.elements,i=this.elements,a=n[0],o=n[3],s=n[6],u=n[1],l=n[4],c=n[7],h=n[2],d=n[5],f=n[8],p=r[0],v=r[3],m=r[6],g=r[1],y=r[4],_=r[7],x=r[2],M=r[5],S=r[8];return i[0]=a*p+o*g+s*x,i[3]=a*v+o*y+s*M,i[6]=a*m+o*_+s*S,i[1]=u*p+l*g+c*x,i[4]=u*v+l*y+c*M,i[7]=u*m+l*_+c*S,i[2]=h*p+d*g+f*x,i[5]=h*v+d*y+f*M,i[8]=h*m+d*_+f*S,this}},{key:"multiplyScalar",value:function(e){var t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}},{key:"determinant",value:function(){var e=this.elements,t=e[0],n=e[1],r=e[2],i=e[3],a=e[4],o=e[5],s=e[6],u=e[7],l=e[8];return t*a*l-t*o*u-n*i*l+n*o*s+r*i*u-r*a*s}},{key:"invert",value:function(){var e=this.elements,t=e[0],n=e[1],r=e[2],i=e[3],a=e[4],o=e[5],s=e[6],u=e[7],l=e[8],c=l*a-o*u,h=o*s-l*i,d=u*i-a*s,f=t*c+n*h+r*d;if(0===f)return this.set(0,0,0,0,0,0,0,0,0);var p=1/f;return e[0]=c*p,e[1]=(r*u-l*n)*p,e[2]=(o*n-r*a)*p,e[3]=h*p,e[4]=(l*t-r*s)*p,e[5]=(r*i-o*t)*p,e[6]=d*p,e[7]=(n*s-u*t)*p,e[8]=(a*t-n*i)*p,this}},{key:"transpose",value:function(){var e,t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}},{key:"getNormalMatrix",value:function(e){return this.setFromMatrix4(e).invert().transpose()}},{key:"transposeIntoArray",value:function(e){var t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}},{key:"setUvTransform",value:function(e,t,n,r,i,a,o){var s=Math.cos(i),u=Math.sin(i);return this.set(n*s,n*u,-n*(s*a+u*o)+a+e,-r*u,r*s,-r*(-u*a+s*o)+o+t,0,0,1),this}},{key:"scale",value:function(e,t){return this.premultiply(yr.makeScale(e,t)),this}},{key:"rotate",value:function(e){return this.premultiply(yr.makeRotation(-e)),this}},{key:"translate",value:function(e,t){return this.premultiply(yr.makeTranslation(e,t)),this}},{key:"makeTranslation",value:function(e,t){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,t,0,0,1),this}},{key:"makeRotation",value:function(e){var t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,n,t,0,0,0,1),this}},{key:"makeScale",value:function(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}},{key:"equals",value:function(e){for(var t=this.elements,n=e.elements,r=0;r<9;r++)if(t[r]!==n[r])return!1;return!0}},{key:"fromArray",value:function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=0;n<9;n++)this.elements[n]=e[n+t];return this}},{key:"toArray",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e}},{key:"clone",value:function(){return(new this.constructor).fromArray(this.elements)}}]),e}(),yr=new gr;function _r(e){for(var t=e.length-1;t>=0;--t)if(e[t]>=65535)return!0;return!1}var xr={Int8Array:Int8Array,Uint8Array:Uint8Array,Uint8ClampedArray:Uint8ClampedArray,Int16Array:Int16Array,Uint16Array:Uint16Array,Int32Array:Int32Array,Uint32Array:Uint32Array,Float32Array:Float32Array,Float64Array:Float64Array};function Mr(e,t){return new xr[e](t)}function Sr(e){return document.createElementNS("http://www.w3.org/1999/xhtml",e)}var br={};function wr(e){e in br||(br[e]=!0,console.warn(e))}function Tr(e){return e<.04045?.0773993808*e:Math.pow(.9478672986*e+.0521327014,2.4)}function Er(e){return e<.0031308?12.92*e:1.055*Math.pow(e,.41666)-.055}var Ar=(new gr).fromArray([.8224621,.0331941,.0170827,.177538,.9668058,.0723974,-1e-7,1e-7,.9105199]),Rr=(new gr).fromArray([1.2249401,-.0420569,-.0196376,-.2249404,1.0420571,-.0786361,1e-7,0,1.0982735]);var kr,Cr=(l(t={},vn,(function(e){return e})),l(t,pn,(function(e){return e.convertSRGBToLinear()})),l(t,mn,(function(e){return e.convertSRGBToLinear().applyMatrix3(Rr)})),t),Lr=(l(i={},vn,(function(e){return e})),l(i,pn,(function(e){return e.convertLinearToSRGB()})),l(i,mn,(function(e){return e.applyMatrix3(Ar).convertLinearToSRGB()})),i),Pr={enabled:!0,get legacyMode(){return console.warn("THREE.ColorManagement: .legacyMode=false renamed to .enabled=true in r150."),!this.enabled},set legacyMode(e){console.warn("THREE.ColorManagement: .legacyMode=false renamed to .enabled=true in r150."),this.enabled=!e},get workingColorSpace(){return vn},set workingColorSpace(e){console.warn("THREE.ColorManagement: .workingColorSpace is readonly.")},convert:function(e,t,n){if(!1===this.enabled||t===n||!t||!n)return e;var r=Cr[t],i=Lr[n];if(void 0===r||void 0===i)throw new Error('Unsupported color space conversion, "'.concat(t,'" to "').concat(n,'".'));return i(r(e))},fromWorkingColorSpace:function(e,t){return this.convert(e,this.workingColorSpace,t)},toWorkingColorSpace:function(e,t){return this.convert(e,t,this.workingColorSpace)}},Ir=function(){function e(){a(this,e)}return s(e,null,[{key:"getDataURL",value:function(e){if(/^data:/i.test(e.src))return e.src;if("undefined"==typeof HTMLCanvasElement)return e.src;var t;if(e instanceof HTMLCanvasElement)t=e;else{void 0===kr&&(kr=Sr("canvas")),kr.width=e.width,kr.height=e.height;var n=kr.getContext("2d");e instanceof ImageData?n.putImageData(e,0,0):n.drawImage(e,0,0,e.width,e.height),t=kr}return t.width>2048||t.height>2048?(console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons",e),t.toDataURL("image/jpeg",.6)):t.toDataURL("image/png")}},{key:"sRGBToLinear",value:function(e){if("undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap){var t=Sr("canvas");t.width=e.width,t.height=e.height;var n=t.getContext("2d");n.drawImage(e,0,0,e.width,e.height);for(var r=n.getImageData(0,0,e.width,e.height),i=r.data,a=0;a<i.length;a++)i[a]=255*Tr(i[a]/255);return n.putImageData(r,0,0),t}if(e.data){for(var o=e.data.slice(0),s=0;s<o.length;s++)o instanceof Uint8Array||o instanceof Uint8ClampedArray?o[s]=Math.floor(255*Tr(o[s]/255)):o[s]=Tr(o[s]);return{data:o,width:e.width,height:e.height}}return console.warn("THREE.ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e}}]),e}(),Dr=0,Ur=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;a(this,e),this.isSource=!0,Object.defineProperty(this,"id",{value:Dr++}),this.uuid=or(),this.data=t,this.version=0}return s(e,[{key:"needsUpdate",set:function(e){!0===e&&this.version++}},{key:"toJSON",value:function(e){var t=void 0===e||"string"==typeof e;if(!t&&void 0!==e.images[this.uuid])return e.images[this.uuid];var n={uuid:this.uuid,url:""},r=this.data;if(null!==r){var i;if(Array.isArray(r)){i=[];for(var a=0,o=r.length;a<o;a++)r[a].isDataTexture?i.push(Or(r[a].image)):i.push(Or(r[a]))}else i=Or(r);n.url=i}return t||(e.images[this.uuid]=n),n}}]),e}();function Or(e){return"undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap?Ir.getDataURL(e):e.data?{data:Array.from(e.data),width:e.width,height:e.height,type:e.data.constructor.name}:(console.warn("THREE.Texture: Unable to serialize Texture."),{})}var Nr=0,Fr=function(e){w(n,e);var t=E(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:n.DEFAULT_IMAGE,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:n.DEFAULT_MAPPING,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Oe,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:Oe,u=arguments.length>4&&void 0!==arguments[4]?arguments[4]:Ve,l=arguments.length>5&&void 0!==arguments[5]?arguments[5]:Xe,c=arguments.length>6&&void 0!==arguments[6]?arguments[6]:ot,h=arguments.length>7&&void 0!==arguments[7]?arguments[7]:Ye,d=arguments.length>8&&void 0!==arguments[8]?arguments[8]:n.DEFAULT_ANISOTROPY,f=arguments.length>9&&void 0!==arguments[9]?arguments[9]:fn;return a(this,n),(e=t.call(this)).isTexture=!0,Object.defineProperty(S(e),"id",{value:Nr++}),e.uuid=or(),e.name="",e.source=new Ur(r),e.mipmaps=[],e.mapping=i,e.channel=0,e.wrapS=o,e.wrapT=s,e.magFilter=u,e.minFilter=l,e.anisotropy=d,e.format=c,e.internalFormat=null,e.type=h,e.offset=new mr(0,0),e.repeat=new mr(1,1),e.center=new mr(0,0),e.rotation=0,e.matrixAutoUpdate=!0,e.matrix=new gr,e.generateMipmaps=!0,e.premultiplyAlpha=!1,e.flipY=!0,e.unpackAlignment=4,"string"==typeof f?e.colorSpace=f:(wr("THREE.Texture: Property .encoding has been replaced by .colorSpace."),e.colorSpace=f===un?pn:fn),e.userData={},e.version=0,e.onUpdate=null,e.isRenderTargetTexture=!1,e.needsPMREMUpdate=!1,e}return s(n,[{key:"image",get:function(){return this.source.data},set:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;this.source.data=e}},{key:"updateMatrix",value:function(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}},{key:"clone",value:function(){return(new this.constructor).copy(this)}},{key:"copy",value:function(e){return this.name=e.name,this.source=e.source,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.channel=e.channel,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.colorSpace=e.colorSpace,this.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}},{key:"toJSON",value:function(e){var t=void 0===e||"string"==typeof e;if(!t&&void 0!==e.textures[this.uuid])return e.textures[this.uuid];var n={metadata:{version:4.6,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(e).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(n.userData=this.userData),t||(e.textures[this.uuid]=n),n}},{key:"dispose",value:function(){this.dispatchEvent({type:"dispose"})}},{key:"transformUv",value:function(e){if(this.mapping!==ke)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case Ue:e.x=e.x-Math.floor(e.x);break;case Oe:e.x=e.x<0?0:1;break;case Ne:1===Math.abs(Math.floor(e.x)%2)?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x)}if(e.y<0||e.y>1)switch(this.wrapT){case Ue:e.y=e.y-Math.floor(e.y);break;case Oe:e.y=e.y<0?0:1;break;case Ne:1===Math.abs(Math.floor(e.y)%2)?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y)}return this.flipY&&(e.y=1-e.y),e}},{key:"needsUpdate",set:function(e){!0===e&&(this.version++,this.source.needsUpdate=!0)}},{key:"encoding",get:function(){return wr("THREE.Texture: Property .encoding has been replaced by .colorSpace."),this.colorSpace===pn?un:sn},set:function(e){wr("THREE.Texture: Property .encoding has been replaced by .colorSpace."),this.colorSpace=e===un?pn:fn}}]),n}(tr);Fr.DEFAULT_IMAGE=null,Fr.DEFAULT_MAPPING=ke,Fr.DEFAULT_ANISOTROPY=1;var Br=function(e){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1;a(this,t),t.prototype.isVector4=!0,this.x=e,this.y=n,this.z=r,this.w=i}return s(t,[{key:"width",get:function(){return this.z},set:function(e){this.z=e}},{key:"height",get:function(){return this.w},set:function(e){this.w=e}},{key:"set",value:function(e,t,n,r){return this.x=e,this.y=t,this.z=n,this.w=r,this}},{key:"setScalar",value:function(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}},{key:"setX",value:function(e){return this.x=e,this}},{key:"setY",value:function(e){return this.y=e,this}},{key:"setZ",value:function(e){return this.z=e,this}},{key:"setW",value:function(e){return this.w=e,this}},{key:"setComponent",value:function(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("index is out of range: "+e)}return this}},{key:"getComponent",value:function(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+e)}}},{key:"clone",value:function(){return new this.constructor(this.x,this.y,this.z,this.w)}},{key:"copy",value:function(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=void 0!==e.w?e.w:1,this}},{key:"add",value:function(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}},{key:"addScalar",value:function(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}},{key:"addVectors",value:function(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}},{key:"addScaledVector",value:function(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}},{key:"sub",value:function(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}},{key:"subScalar",value:function(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}},{key:"subVectors",value:function(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}},{key:"multiply",value:function(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}},{key:"multiplyScalar",value:function(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}},{key:"applyMatrix4",value:function(e){var t=this.x,n=this.y,r=this.z,i=this.w,a=e.elements;return this.x=a[0]*t+a[4]*n+a[8]*r+a[12]*i,this.y=a[1]*t+a[5]*n+a[9]*r+a[13]*i,this.z=a[2]*t+a[6]*n+a[10]*r+a[14]*i,this.w=a[3]*t+a[7]*n+a[11]*r+a[15]*i,this}},{key:"divideScalar",value:function(e){return this.multiplyScalar(1/e)}},{key:"setAxisAngleFromQuaternion",value:function(e){this.w=2*Math.acos(e.w);var t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}},{key:"setAxisAngleFromRotationMatrix",value:function(e){var t,n,r,i,a=.01,o=.1,s=e.elements,u=s[0],l=s[4],c=s[8],h=s[1],d=s[5],f=s[9],p=s[2],v=s[6],m=s[10];if(Math.abs(l-h)<a&&Math.abs(c-p)<a&&Math.abs(f-v)<a){if(Math.abs(l+h)<o&&Math.abs(c+p)<o&&Math.abs(f+v)<o&&Math.abs(u+d+m-3)<o)return this.set(1,0,0,0),this;t=Math.PI;var g=(u+1)/2,y=(d+1)/2,_=(m+1)/2,x=(l+h)/4,M=(c+p)/4,S=(f+v)/4;return g>y&&g>_?g<a?(n=0,r=.707106781,i=.707106781):(r=x/(n=Math.sqrt(g)),i=M/n):y>_?y<a?(n=.707106781,r=0,i=.707106781):(n=x/(r=Math.sqrt(y)),i=S/r):_<a?(n=.707106781,r=.707106781,i=0):(n=M/(i=Math.sqrt(_)),r=S/i),this.set(n,r,i,t),this}var b=Math.sqrt((v-f)*(v-f)+(c-p)*(c-p)+(h-l)*(h-l));return Math.abs(b)<.001&&(b=1),this.x=(v-f)/b,this.y=(c-p)/b,this.z=(h-l)/b,this.w=Math.acos((u+d+m-1)/2),this}},{key:"min",value:function(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}},{key:"max",value:function(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}},{key:"clamp",value:function(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this.w=Math.max(e.w,Math.min(t.w,this.w)),this}},{key:"clampScalar",value:function(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this.w=Math.max(e,Math.min(t,this.w)),this}},{key:"clampLength",value:function(e,t){var n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))}},{key:"floor",value: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}},{key:"ceil",value: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}},{key:"round",value: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}},{key:"roundToZero",value: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}},{key:"negate",value:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}},{key:"dot",value:function(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}},{key:"lengthSq",value:function(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}},{key:"length",value:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}},{key:"manhattanLength",value:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}},{key:"normalize",value:function(){return this.divideScalar(this.length()||1)}},{key:"setLength",value:function(e){return this.normalize().multiplyScalar(e)}},{key:"lerp",value:function(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this}},{key:"lerpVectors",value:function(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this.w=e.w+(t.w-e.w)*n,this}},{key:"equals",value:function(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}},{key:"fromArray",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}},{key:"toArray",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}},{key:"fromBufferAttribute",value:function(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}},{key:"random",value:function(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}},{key:e,value:R().mark((function e(){return R().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.x;case 2:return e.next=4,this.y;case 4:return e.next=6,this.z;case 6:return e.next=8,this.w;case 8:case"end":return e.stop()}}),e,this)}))}]),t}(Symbol.iterator),zr=function(e){w(n,e);var t=E(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};a(this,n),(e=t.call(this)).isRenderTarget=!0,e.width=r,e.height=i,e.depth=1,e.scissor=new Br(0,0,r,i),e.scissorTest=!1,e.viewport=new Br(0,0,r,i);var s={width:r,height:i,depth:1};return void 0!==o.encoding&&(wr("THREE.WebGLRenderTarget: option.encoding has been replaced by option.colorSpace."),o.colorSpace=o.encoding===un?pn:fn),e.texture=new Fr(s,o.mapping,o.wrapS,o.wrapT,o.magFilter,o.minFilter,o.format,o.type,o.anisotropy,o.colorSpace),e.texture.isRenderTargetTexture=!0,e.texture.flipY=!1,e.texture.generateMipmaps=void 0!==o.generateMipmaps&&o.generateMipmaps,e.texture.internalFormat=void 0!==o.internalFormat?o.internalFormat:null,e.texture.minFilter=void 0!==o.minFilter?o.minFilter:Ve,e.depthBuffer=void 0===o.depthBuffer||o.depthBuffer,e.stencilBuffer=void 0!==o.stencilBuffer&&o.stencilBuffer,e.depthTexture=void 0!==o.depthTexture?o.depthTexture:null,e.samples=void 0!==o.samples?o.samples:0,e}return s(n,[{key:"setSize",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;this.width===e&&this.height===t&&this.depth===n||(this.width=e,this.height=t,this.depth=n,this.texture.image.width=e,this.texture.image.height=t,this.texture.image.depth=n,this.dispose()),this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}},{key:"clone",value:function(){return(new this.constructor).copy(this)}},{key:"copy",value:function(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.scissor.copy(e.scissor),this.scissorTest=e.scissorTest,this.viewport.copy(e.viewport),this.texture=e.texture.clone(),this.texture.isRenderTargetTexture=!0;var t=Object.assign({},e.texture.image);return this.texture.source=new Ur(t),this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,null!==e.depthTexture&&(this.depthTexture=e.depthTexture.clone()),this.samples=e.samples,this}},{key:"dispose",value:function(){this.dispatchEvent({type:"dispose"})}}]),n}(tr),Hr=function(e){w(n,e);var t=E(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return a(this,n),(e=t.call(this,r,i,o)).isWebGLRenderTarget=!0,e}return s(n)}(zr),Gr=function(e){w(n,e);var t=E(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1;return a(this,n),(e=t.call(this,null)).isDataArrayTexture=!0,e.image={data:r,width:i,height:o,depth:s},e.magFilter=Fe,e.minFilter=Fe,e.wrapR=Oe,e.generateMipmaps=!1,e.flipY=!1,e.unpackAlignment=1,e}return s(n)}(Fr),Vr=function(e){w(n,e);var t=E(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;return a(this,n),(e=t.call(this,r,i)).isWebGLArrayRenderTarget=!0,e.depth=o,e.texture=new Gr(null,r,i,o),e.texture.isRenderTargetTexture=!0,e}return s(n)}(Hr),Wr=function(e){w(n,e);var t=E(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1;return a(this,n),(e=t.call(this,null)).isData3DTexture=!0,e.image={data:r,width:i,height:o,depth:s},e.magFilter=Fe,e.minFilter=Fe,e.wrapR=Oe,e.generateMipmaps=!1,e.flipY=!1,e.unpackAlignment=1,e}return s(n)}(Fr),jr=function(e){w(n,e);var t=E(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;return a(this,n),(e=t.call(this,r,i)).isWebGL3DRenderTarget=!0,e.depth=o,e.texture=new Wr(null,r,i,o),e.texture.isRenderTargetTexture=!0,e}return s(n)}(Hr),Xr=function(e){w(n,e);var t=E(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};a(this,n),(e=t.call(this,r,i,s)).isWebGLMultipleRenderTargets=!0;var u=e.texture;e.texture=[];for(var l=0;l<o;l++)e.texture[l]=u.clone(),e.texture[l].isRenderTargetTexture=!0;return e}return s(n,[{key:"setSize",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;if(this.width!==e||this.height!==t||this.depth!==n){this.width=e,this.height=t,this.depth=n;for(var r=0,i=this.texture.length;r<i;r++)this.texture[r].image.width=e,this.texture[r].image.height=t,this.texture[r].image.depth=n;this.dispose()}this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}},{key:"copy",value:function(e){this.dispose(),this.width=e.width,this.height=e.height,this.depth=e.depth,this.scissor.copy(e.scissor),this.scissorTest=e.scissorTest,this.viewport.copy(e.viewport),this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,null!==e.depthTexture&&(this.depthTexture=e.depthTexture.clone()),this.texture.length=0;for(var t=0,n=e.texture.length;t<n;t++)this.texture[t]=e.texture[t].clone(),this.texture[t].isRenderTargetTexture=!0;return this}}]),n}(Hr),qr=function(e){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1;a(this,t),this.isQuaternion=!0,this._x=e,this._y=n,this._z=r,this._w=i}return s(t,[{key:"x",get:function(){return this._x},set:function(e){this._x=e,this._onChangeCallback()}},{key:"y",get:function(){return this._y},set:function(e){this._y=e,this._onChangeCallback()}},{key:"z",get:function(){return this._z},set:function(e){this._z=e,this._onChangeCallback()}},{key:"w",get:function(){return this._w},set:function(e){this._w=e,this._onChangeCallback()}},{key:"set",value:function(e,t,n,r){return this._x=e,this._y=t,this._z=n,this._w=r,this._onChangeCallback(),this}},{key:"clone",value:function(){return new this.constructor(this._x,this._y,this._z,this._w)}},{key:"copy",value:function(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}},{key:"setFromEuler",value:function(e,t){var n=e._x,r=e._y,i=e._z,a=e._order,o=Math.cos,s=Math.sin,u=o(n/2),l=o(r/2),c=o(i/2),h=s(n/2),d=s(r/2),f=s(i/2);switch(a){case"XYZ":this._x=h*l*c+u*d*f,this._y=u*d*c-h*l*f,this._z=u*l*f+h*d*c,this._w=u*l*c-h*d*f;break;case"YXZ":this._x=h*l*c+u*d*f,this._y=u*d*c-h*l*f,this._z=u*l*f-h*d*c,this._w=u*l*c+h*d*f;break;case"ZXY":this._x=h*l*c-u*d*f,this._y=u*d*c+h*l*f,this._z=u*l*f+h*d*c,this._w=u*l*c-h*d*f;break;case"ZYX":this._x=h*l*c-u*d*f,this._y=u*d*c+h*l*f,this._z=u*l*f-h*d*c,this._w=u*l*c+h*d*f;break;case"YZX":this._x=h*l*c+u*d*f,this._y=u*d*c+h*l*f,this._z=u*l*f-h*d*c,this._w=u*l*c-h*d*f;break;case"XZY":this._x=h*l*c-u*d*f,this._y=u*d*c-h*l*f,this._z=u*l*f+h*d*c,this._w=u*l*c+h*d*f;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+a)}return!1!==t&&this._onChangeCallback(),this}},{key:"setFromAxisAngle",value:function(e,t){var n=t/2,r=Math.sin(n);return this._x=e.x*r,this._y=e.y*r,this._z=e.z*r,this._w=Math.cos(n),this._onChangeCallback(),this}},{key:"setFromRotationMatrix",value:function(e){var t=e.elements,n=t[0],r=t[4],i=t[8],a=t[1],o=t[5],s=t[9],u=t[2],l=t[6],c=t[10],h=n+o+c;if(h>0){var d=.5/Math.sqrt(h+1);this._w=.25/d,this._x=(l-s)*d,this._y=(i-u)*d,this._z=(a-r)*d}else if(n>o&&n>c){var f=2*Math.sqrt(1+n-o-c);this._w=(l-s)/f,this._x=.25*f,this._y=(r+a)/f,this._z=(i+u)/f}else if(o>c){var p=2*Math.sqrt(1+o-n-c);this._w=(i-u)/p,this._x=(r+a)/p,this._y=.25*p,this._z=(s+l)/p}else{var v=2*Math.sqrt(1+c-n-o);this._w=(a-r)/v,this._x=(i+u)/v,this._y=(s+l)/v,this._z=.25*v}return this._onChangeCallback(),this}},{key:"setFromUnitVectors",value:function(e,t){var n=e.dot(t)+1;return n<Number.EPSILON?(n=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=n):(this._x=0,this._y=-e.z,this._z=e.y,this._w=n)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=n),this.normalize()}},{key:"angleTo",value:function(e){return 2*Math.acos(Math.abs(sr(this.dot(e),-1,1)))}},{key:"rotateTowards",value:function(e,t){var n=this.angleTo(e);if(0===n)return this;var r=Math.min(1,t/n);return this.slerp(e,r),this}},{key:"identity",value:function(){return this.set(0,0,0,1)}},{key:"invert",value:function(){return this.conjugate()}},{key:"conjugate",value:function(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}},{key:"dot",value:function(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}},{key:"lengthSq",value:function(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}},{key:"length",value:function(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}},{key:"normalize",value:function(){var e=this.length();return 0===e?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}},{key:"multiply",value:function(e){return this.multiplyQuaternions(this,e)}},{key:"premultiply",value:function(e){return this.multiplyQuaternions(e,this)}},{key:"multiplyQuaternions",value:function(e,t){var n=e._x,r=e._y,i=e._z,a=e._w,o=t._x,s=t._y,u=t._z,l=t._w;return this._x=n*l+a*o+r*u-i*s,this._y=r*l+a*s+i*o-n*u,this._z=i*l+a*u+n*s-r*o,this._w=a*l-n*o-r*s-i*u,this._onChangeCallback(),this}},{key:"slerp",value:function(e,t){if(0===t)return this;if(1===t)return this.copy(e);var n=this._x,r=this._y,i=this._z,a=this._w,o=a*e._w+n*e._x+r*e._y+i*e._z;if(o<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,o=-o):this.copy(e),o>=1)return this._w=a,this._x=n,this._y=r,this._z=i,this;var s=1-o*o;if(s<=Number.EPSILON){var u=1-t;return this._w=u*a+t*this._w,this._x=u*n+t*this._x,this._y=u*r+t*this._y,this._z=u*i+t*this._z,this.normalize(),this._onChangeCallback(),this}var l=Math.sqrt(s),c=Math.atan2(l,o),h=Math.sin((1-t)*c)/l,d=Math.sin(t*c)/l;return this._w=a*h+this._w*d,this._x=n*h+this._x*d,this._y=r*h+this._y*d,this._z=i*h+this._z*d,this._onChangeCallback(),this}},{key:"slerpQuaternions",value:function(e,t,n){return this.copy(e).slerp(t,n)}},{key:"random",value:function(){var e=Math.random(),t=Math.sqrt(1-e),n=Math.sqrt(e),r=2*Math.PI*Math.random(),i=2*Math.PI*Math.random();return this.set(t*Math.cos(r),n*Math.sin(i),n*Math.cos(i),t*Math.sin(r))}},{key:"equals",value:function(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}},{key:"fromArray",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}},{key:"toArray",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}},{key:"fromBufferAttribute",value:function(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this}},{key:"toJSON",value:function(){return this.toArray()}},{key:"_onChange",value:function(e){return this._onChangeCallback=e,this}},{key:"_onChangeCallback",value:function(){}},{key:e,value:R().mark((function e(){return R().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._x;case 2:return e.next=4,this._y;case 4:return e.next=6,this._z;case 6:return e.next=8,this._w;case 8:case"end":return e.stop()}}),e,this)}))}],[{key:"slerpFlat",value:function(e,t,n,r,i,a,o){var s=n[r+0],u=n[r+1],l=n[r+2],c=n[r+3],h=i[a+0],d=i[a+1],f=i[a+2],p=i[a+3];if(0===o)return e[t+0]=s,e[t+1]=u,e[t+2]=l,void(e[t+3]=c);if(1===o)return e[t+0]=h,e[t+1]=d,e[t+2]=f,void(e[t+3]=p);if(c!==p||s!==h||u!==d||l!==f){var v=1-o,m=s*h+u*d+l*f+c*p,g=m>=0?1:-1,y=1-m*m;if(y>Number.EPSILON){var _=Math.sqrt(y),x=Math.atan2(_,m*g);v=Math.sin(v*x)/_,o=Math.sin(o*x)/_}var M=o*g;if(s=s*v+h*M,u=u*v+d*M,l=l*v+f*M,c=c*v+p*M,v===1-o){var S=1/Math.sqrt(s*s+u*u+l*l+c*c);s*=S,u*=S,l*=S,c*=S}}e[t]=s,e[t+1]=u,e[t+2]=l,e[t+3]=c}},{key:"multiplyQuaternionsFlat",value:function(e,t,n,r,i,a){var o=n[r],s=n[r+1],u=n[r+2],l=n[r+3],c=i[a],h=i[a+1],d=i[a+2],f=i[a+3];return e[t]=o*f+l*c+s*d-u*h,e[t+1]=s*f+l*h+u*c-o*d,e[t+2]=u*f+l*d+o*h-s*c,e[t+3]=l*f-o*c-s*h-u*d,e}}]),t}(Symbol.iterator),Yr=function(e){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;a(this,t),t.prototype.isVector3=!0,this.x=e,this.y=n,this.z=r}return s(t,[{key:"set",value:function(e,t,n){return void 0===n&&(n=this.z),this.x=e,this.y=t,this.z=n,this}},{key:"setScalar",value:function(e){return this.x=e,this.y=e,this.z=e,this}},{key:"setX",value:function(e){return this.x=e,this}},{key:"setY",value:function(e){return this.y=e,this}},{key:"setZ",value:function(e){return this.z=e,this}},{key:"setComponent",value:function(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("index is out of range: "+e)}return this}},{key:"getComponent",value:function(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}}},{key:"clone",value:function(){return new this.constructor(this.x,this.y,this.z)}},{key:"copy",value:function(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}},{key:"add",value:function(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}},{key:"addScalar",value:function(e){return this.x+=e,this.y+=e,this.z+=e,this}},{key:"addVectors",value:function(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}},{key:"addScaledVector",value:function(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}},{key:"sub",value:function(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}},{key:"subScalar",value:function(e){return this.x-=e,this.y-=e,this.z-=e,this}},{key:"subVectors",value:function(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}},{key:"multiply",value:function(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}},{key:"multiplyScalar",value:function(e){return this.x*=e,this.y*=e,this.z*=e,this}},{key:"multiplyVectors",value:function(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}},{key:"applyEuler",value:function(e){return this.applyQuaternion(Kr.setFromEuler(e))}},{key:"applyAxisAngle",value:function(e,t){return this.applyQuaternion(Kr.setFromAxisAngle(e,t))}},{key:"applyMatrix3",value:function(e){var t=this.x,n=this.y,r=this.z,i=e.elements;return this.x=i[0]*t+i[3]*n+i[6]*r,this.y=i[1]*t+i[4]*n+i[7]*r,this.z=i[2]*t+i[5]*n+i[8]*r,this}},{key:"applyNormalMatrix",value:function(e){return this.applyMatrix3(e).normalize()}},{key:"applyMatrix4",value:function(e){var t=this.x,n=this.y,r=this.z,i=e.elements,a=1/(i[3]*t+i[7]*n+i[11]*r+i[15]);return this.x=(i[0]*t+i[4]*n+i[8]*r+i[12])*a,this.y=(i[1]*t+i[5]*n+i[9]*r+i[13])*a,this.z=(i[2]*t+i[6]*n+i[10]*r+i[14])*a,this}},{key:"applyQuaternion",value:function(e){var t=this.x,n=this.y,r=this.z,i=e.x,a=e.y,o=e.z,s=e.w,u=s*t+a*r-o*n,l=s*n+o*t-i*r,c=s*r+i*n-a*t,h=-i*t-a*n-o*r;return this.x=u*s+h*-i+l*-o-c*-a,this.y=l*s+h*-a+c*-i-u*-o,this.z=c*s+h*-o+u*-a-l*-i,this}},{key:"project",value:function(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}},{key:"unproject",value:function(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}},{key:"transformDirection",value:function(e){var t=this.x,n=this.y,r=this.z,i=e.elements;return this.x=i[0]*t+i[4]*n+i[8]*r,this.y=i[1]*t+i[5]*n+i[9]*r,this.z=i[2]*t+i[6]*n+i[10]*r,this.normalize()}},{key:"divide",value:function(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}},{key:"divideScalar",value:function(e){return this.multiplyScalar(1/e)}},{key:"min",value:function(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}},{key:"max",value:function(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}},{key:"clamp",value:function(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this}},{key:"clampScalar",value:function(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this}},{key:"clampLength",value:function(e,t){var n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))}},{key:"floor",value:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}},{key:"ceil",value:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}},{key:"round",value:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}},{key:"roundToZero",value: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}},{key:"negate",value:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}},{key:"dot",value:function(e){return this.x*e.x+this.y*e.y+this.z*e.z}},{key:"lengthSq",value:function(){return this.x*this.x+this.y*this.y+this.z*this.z}},{key:"length",value:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}},{key:"manhattanLength",value:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}},{key:"normalize",value:function(){return this.divideScalar(this.length()||1)}},{key:"setLength",value:function(e){return this.normalize().multiplyScalar(e)}},{key:"lerp",value:function(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}},{key:"lerpVectors",value:function(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this}},{key:"cross",value:function(e){return this.crossVectors(this,e)}},{key:"crossVectors",value:function(e,t){var n=e.x,r=e.y,i=e.z,a=t.x,o=t.y,s=t.z;return this.x=r*s-i*o,this.y=i*a-n*s,this.z=n*o-r*a,this}},{key:"projectOnVector",value:function(e){var t=e.lengthSq();if(0===t)return this.set(0,0,0);var n=e.dot(this)/t;return this.copy(e).multiplyScalar(n)}},{key:"projectOnPlane",value:function(e){return Zr.copy(this).projectOnVector(e),this.sub(Zr)}},{key:"reflect",value:function(e){return this.sub(Zr.copy(e).multiplyScalar(2*this.dot(e)))}},{key:"angleTo",value:function(e){var t=Math.sqrt(this.lengthSq()*e.lengthSq());if(0===t)return Math.PI/2;var n=this.dot(e)/t;return Math.acos(sr(n,-1,1))}},{key:"distanceTo",value:function(e){return Math.sqrt(this.distanceToSquared(e))}},{key:"distanceToSquared",value:function(e){var t=this.x-e.x,n=this.y-e.y,r=this.z-e.z;return t*t+n*n+r*r}},{key:"manhattanDistanceTo",value:function(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}},{key:"setFromSpherical",value:function(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}},{key:"setFromSphericalCoords",value:function(e,t,n){var r=Math.sin(t)*e;return this.x=r*Math.sin(n),this.y=Math.cos(t)*e,this.z=r*Math.cos(n),this}},{key:"setFromCylindrical",value:function(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}},{key:"setFromCylindricalCoords",value:function(e,t,n){return this.x=e*Math.sin(t),this.y=n,this.z=e*Math.cos(t),this}},{key:"setFromMatrixPosition",value:function(e){var t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}},{key:"setFromMatrixScale",value:function(e){var t=this.setFromMatrixColumn(e,0).length(),n=this.setFromMatrixColumn(e,1).length(),r=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=r,this}},{key:"setFromMatrixColumn",value:function(e,t){return this.fromArray(e.elements,4*t)}},{key:"setFromMatrix3Column",value:function(e,t){return this.fromArray(e.elements,3*t)}},{key:"setFromEuler",value:function(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}},{key:"setFromColor",value:function(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}},{key:"equals",value:function(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}},{key:"fromArray",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}},{key:"toArray",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}},{key:"fromBufferAttribute",value:function(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}},{key:"random",value:function(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}},{key:"randomDirection",value:function(){var e=2*(Math.random()-.5),t=Math.random()*Math.PI*2,n=Math.sqrt(1-Math.pow(e,2));return this.x=n*Math.cos(t),this.y=n*Math.sin(t),this.z=e,this}},{key:e,value:R().mark((function e(){return R().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.x;case 2:return e.next=4,this.y;case 4:return e.next=6,this.z;case 6:case"end":return e.stop()}}),e,this)}))}]),t}(Symbol.iterator),Zr=new Yr,Kr=new qr,Jr=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Yr(1/0,1/0,1/0),n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Yr(-1/0,-1/0,-1/0);a(this,e),this.isBox3=!0,this.min=t,this.max=n}return s(e,[{key:"set",value:function(e,t){return this.min.copy(e),this.max.copy(t),this}},{key:"setFromArray",value:function(e){this.makeEmpty();for(var t=0,n=e.length;t<n;t+=3)this.expandByPoint($r.fromArray(e,t));return this}},{key:"setFromBufferAttribute",value:function(e){this.makeEmpty();for(var t=0,n=e.count;t<n;t++)this.expandByPoint($r.fromBufferAttribute(e,t));return this}},{key:"setFromPoints",value:function(e){this.makeEmpty();for(var t=0,n=e.length;t<n;t++)this.expandByPoint(e[t]);return this}},{key:"setFromCenterAndSize",value:function(e,t){var n=$r.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this}},{key:"setFromObject",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this.makeEmpty(),this.expandByObject(e,t)}},{key:"clone",value:function(){return(new this.constructor).copy(this)}},{key:"copy",value:function(e){return this.min.copy(e.min),this.max.copy(e.max),this}},{key:"makeEmpty",value: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}},{key:"isEmpty",value:function(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}},{key:"getCenter",value:function(e){return this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}},{key:"getSize",value:function(e){return this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)}},{key:"expandByPoint",value:function(e){return this.min.min(e),this.max.max(e),this}},{key:"expandByVector",value:function(e){return this.min.sub(e),this.max.add(e),this}},{key:"expandByScalar",value:function(e){return this.min.addScalar(-e),this.max.addScalar(e),this}},{key:"expandByObject",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(e.updateWorldMatrix(!1,!1),void 0!==e.boundingBox)null===e.boundingBox&&e.computeBoundingBox(),ei.copy(e.boundingBox),ei.applyMatrix4(e.matrixWorld),this.union(ei);else{var n=e.geometry;if(void 0!==n)if(t&&void 0!==n.attributes&&void 0!==n.attributes.position)for(var r=n.attributes.position,i=0,a=r.count;i<a;i++)$r.fromBufferAttribute(r,i).applyMatrix4(e.matrixWorld),this.expandByPoint($r);else null===n.boundingBox&&n.computeBoundingBox(),ei.copy(n.boundingBox),ei.applyMatrix4(e.matrixWorld),this.union(ei)}for(var o=e.children,s=0,u=o.length;s<u;s++)this.expandByObject(o[s],t);return this}},{key:"containsPoint",value:function(e){return!(e.x<this.min.x||e.x>this.max.x||e.y<this.min.y||e.y>this.max.y||e.z<this.min.z||e.z>this.max.z)}},{key:"containsBox",value:function(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}},{key:"getParameter",value:function(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}},{key:"intersectsBox",value:function(e){return!(e.max.x<this.min.x||e.min.x>this.max.x||e.max.y<this.min.y||e.min.y>this.max.y||e.max.z<this.min.z||e.min.z>this.max.z)}},{key:"intersectsSphere",value:function(e){return this.clampPoint(e.center,$r),$r.distanceToSquared(e.center)<=e.radius*e.radius}},{key:"intersectsPlane",value:function(e){var t,n;return e.normal.x>0?(t=e.normal.x*this.min.x,n=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,n=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,n+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,n+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,n+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,n+=e.normal.z*this.min.z),t<=-e.constant&&n>=-e.constant}},{key:"intersectsTriangle",value:function(e){if(this.isEmpty())return!1;this.getCenter(si),ui.subVectors(this.max,si),ti.subVectors(e.a,si),ni.subVectors(e.b,si),ri.subVectors(e.c,si),ii.subVectors(ni,ti),ai.subVectors(ri,ni),oi.subVectors(ti,ri);var t=[0,-ii.z,ii.y,0,-ai.z,ai.y,0,-oi.z,oi.y,ii.z,0,-ii.x,ai.z,0,-ai.x,oi.z,0,-oi.x,-ii.y,ii.x,0,-ai.y,ai.x,0,-oi.y,oi.x,0];return!!hi(t,ti,ni,ri,ui)&&(!!hi(t=[1,0,0,0,1,0,0,0,1],ti,ni,ri,ui)&&(li.crossVectors(ii,ai),hi(t=[li.x,li.y,li.z],ti,ni,ri,ui)))}},{key:"clampPoint",value:function(e,t){return t.copy(e).clamp(this.min,this.max)}},{key:"distanceToPoint",value:function(e){return this.clampPoint(e,$r).distanceTo(e)}},{key:"getBoundingSphere",value:function(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=.5*this.getSize($r).length()),e}},{key:"intersect",value:function(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}},{key:"union",value:function(e){return this.min.min(e.min),this.max.max(e.max),this}},{key:"applyMatrix4",value:function(e){return this.isEmpty()||(Qr[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),Qr[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),Qr[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),Qr[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),Qr[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),Qr[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),Qr[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),Qr[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(Qr)),this}},{key:"translate",value:function(e){return this.min.add(e),this.max.add(e),this}},{key:"equals",value:function(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}]),e}(),Qr=[new Yr,new Yr,new Yr,new Yr,new Yr,new Yr,new Yr,new Yr],$r=new Yr,ei=new Jr,ti=new Yr,ni=new Yr,ri=new Yr,ii=new Yr,ai=new Yr,oi=new Yr,si=new Yr,ui=new Yr,li=new Yr,ci=new Yr;function hi(e,t,n,r,i){for(var a=0,o=e.length-3;a<=o;a+=3){ci.fromArray(e,a);var s=i.x*Math.abs(ci.x)+i.y*Math.abs(ci.y)+i.z*Math.abs(ci.z),u=t.dot(ci),l=n.dot(ci),c=r.dot(ci);if(Math.max(-Math.max(u,l,c),Math.min(u,l,c))>s)return!1}return!0}var di=new Jr,fi=new Yr,pi=new Yr,vi=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Yr,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1;a(this,e),this.center=t,this.radius=n}return s(e,[{key:"set",value:function(e,t){return this.center.copy(e),this.radius=t,this}},{key:"setFromPoints",value:function(e,t){var n=this.center;void 0!==t?n.copy(t):di.setFromPoints(e).getCenter(n);for(var r=0,i=0,a=e.length;i<a;i++)r=Math.max(r,n.distanceToSquared(e[i]));return this.radius=Math.sqrt(r),this}},{key:"copy",value:function(e){return this.center.copy(e.center),this.radius=e.radius,this}},{key:"isEmpty",value:function(){return this.radius<0}},{key:"makeEmpty",value:function(){return this.center.set(0,0,0),this.radius=-1,this}},{key:"containsPoint",value:function(e){return e.distanceToSquared(this.center)<=this.radius*this.radius}},{key:"distanceToPoint",value:function(e){return e.distanceTo(this.center)-this.radius}},{key:"intersectsSphere",value:function(e){var t=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=t*t}},{key:"intersectsBox",value:function(e){return e.intersectsSphere(this)}},{key:"intersectsPlane",value:function(e){return Math.abs(e.distanceToPoint(this.center))<=this.radius}},{key:"clampPoint",value:function(e,t){var n=this.center.distanceToSquared(e);return t.copy(e),n>this.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}},{key:"getBoundingBox",value:function(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}},{key:"applyMatrix4",value:function(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}},{key:"translate",value:function(e){return this.center.add(e),this}},{key:"expandByPoint",value:function(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;fi.subVectors(e,this.center);var t=fi.lengthSq();if(t>this.radius*this.radius){var n=Math.sqrt(t),r=.5*(n-this.radius);this.center.addScaledVector(fi,r/n),this.radius+=r}return this}},{key:"union",value:function(e){return e.isEmpty()?this:this.isEmpty()?(this.copy(e),this):(!0===this.center.equals(e.center)?this.radius=Math.max(this.radius,e.radius):(pi.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(fi.copy(e.center).add(pi)),this.expandByPoint(fi.copy(e.center).sub(pi))),this)}},{key:"equals",value:function(e){return e.center.equals(this.center)&&e.radius===this.radius}},{key:"clone",value:function(){return(new this.constructor).copy(this)}}]),e}(),mi=new Yr,gi=new Yr,yi=new Yr,_i=new Yr,xi=new Yr,Mi=new Yr,Si=new Yr,bi=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Yr,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Yr(0,0,-1);a(this,e),this.origin=t,this.direction=n}return s(e,[{key:"set",value:function(e,t){return this.origin.copy(e),this.direction.copy(t),this}},{key:"copy",value:function(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}},{key:"at",value:function(e,t){return t.copy(this.origin).addScaledVector(this.direction,e)}},{key:"lookAt",value:function(e){return this.direction.copy(e).sub(this.origin).normalize(),this}},{key:"recast",value:function(e){return this.origin.copy(this.at(e,mi)),this}},{key:"closestPointToPoint",value:function(e,t){t.subVectors(e,this.origin);var n=t.dot(this.direction);return n<0?t.copy(this.origin):t.copy(this.origin).addScaledVector(this.direction,n)}},{key:"distanceToPoint",value:function(e){return Math.sqrt(this.distanceSqToPoint(e))}},{key:"distanceSqToPoint",value:function(e){var t=mi.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(mi.copy(this.origin).addScaledVector(this.direction,t),mi.distanceToSquared(e))}},{key:"distanceSqToSegment",value:function(e,t,n,r){gi.copy(e).add(t).multiplyScalar(.5),yi.copy(t).sub(e).normalize(),_i.copy(this.origin).sub(gi);var i,a,o,s,u=.5*e.distanceTo(t),l=-this.direction.dot(yi),c=_i.dot(this.direction),h=-_i.dot(yi),d=_i.lengthSq(),f=Math.abs(1-l*l);if(f>0)if(a=l*c-h,s=u*f,(i=l*h-c)>=0)if(a>=-s)if(a<=s){var p=1/f;o=(i*=p)*(i+l*(a*=p)+2*c)+a*(l*i+a+2*h)+d}else a=u,o=-(i=Math.max(0,-(l*a+c)))*i+a*(a+2*h)+d;else a=-u,o=-(i=Math.max(0,-(l*a+c)))*i+a*(a+2*h)+d;else a<=-s?o=-(i=Math.max(0,-(-l*u+c)))*i+(a=i>0?-u:Math.min(Math.max(-u,-h),u))*(a+2*h)+d:a<=s?(i=0,o=(a=Math.min(Math.max(-u,-h),u))*(a+2*h)+d):o=-(i=Math.max(0,-(l*u+c)))*i+(a=i>0?u:Math.min(Math.max(-u,-h),u))*(a+2*h)+d;else a=l>0?-u:u,o=-(i=Math.max(0,-(l*a+c)))*i+a*(a+2*h)+d;return n&&n.copy(this.origin).addScaledVector(this.direction,i),r&&r.copy(gi).addScaledVector(yi,a),o}},{key:"intersectSphere",value:function(e,t){mi.subVectors(e.center,this.origin);var n=mi.dot(this.direction),r=mi.dot(mi)-n*n,i=e.radius*e.radius;if(r>i)return null;var a=Math.sqrt(i-r),o=n-a,s=n+a;return s<0?null:o<0?this.at(s,t):this.at(o,t)}},{key:"intersectsSphere",value:function(e){return this.distanceSqToPoint(e.center)<=e.radius*e.radius}},{key:"distanceToPlane",value:function(e){var t=e.normal.dot(this.direction);if(0===t)return 0===e.distanceToPoint(this.origin)?0:null;var n=-(this.origin.dot(e.normal)+e.constant)/t;return n>=0?n:null}},{key:"intersectPlane",value:function(e,t){var n=this.distanceToPlane(e);return null===n?null:this.at(n,t)}},{key:"intersectsPlane",value:function(e){var t=e.distanceToPoint(this.origin);return 0===t||e.normal.dot(this.direction)*t<0}},{key:"intersectBox",value:function(e,t){var n,r,i,a,o,s,u=1/this.direction.x,l=1/this.direction.y,c=1/this.direction.z,h=this.origin;return u>=0?(n=(e.min.x-h.x)*u,r=(e.max.x-h.x)*u):(n=(e.max.x-h.x)*u,r=(e.min.x-h.x)*u),l>=0?(i=(e.min.y-h.y)*l,a=(e.max.y-h.y)*l):(i=(e.max.y-h.y)*l,a=(e.min.y-h.y)*l),n>a||i>r?null:((i>n||isNaN(n))&&(n=i),(a<r||isNaN(r))&&(r=a),c>=0?(o=(e.min.z-h.z)*c,s=(e.max.z-h.z)*c):(o=(e.max.z-h.z)*c,s=(e.min.z-h.z)*c),n>s||o>r?null:((o>n||n!=n)&&(n=o),(s<r||r!=r)&&(r=s),r<0?null:this.at(n>=0?n:r,t)))}},{key:"intersectsBox",value:function(e){return null!==this.intersectBox(e,mi)}},{key:"intersectTriangle",value:function(e,t,n,r,i){xi.subVectors(t,e),Mi.subVectors(n,e),Si.crossVectors(xi,Mi);var a,o=this.direction.dot(Si);if(o>0){if(r)return null;a=1}else{if(!(o<0))return null;a=-1,o=-o}_i.subVectors(this.origin,e);var s=a*this.direction.dot(Mi.crossVectors(_i,Mi));if(s<0)return null;var u=a*this.direction.dot(xi.cross(_i));if(u<0)return null;if(s+u>o)return null;var l=-a*_i.dot(Si);return l<0?null:this.at(l/o,i)}},{key:"applyMatrix4",value:function(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}},{key:"equals",value:function(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}},{key:"clone",value:function(){return(new this.constructor).copy(this)}}]),e}(),wi=function(){function e(t,n,r,i,o,s,u,l,c,h,d,f,p,v,m,g){a(this,e),e.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],void 0!==t&&this.set(t,n,r,i,o,s,u,l,c,h,d,f,p,v,m,g)}return s(e,[{key:"set",value:function(e,t,n,r,i,a,o,s,u,l,c,h,d,f,p,v){var m=this.elements;return m[0]=e,m[4]=t,m[8]=n,m[12]=r,m[1]=i,m[5]=a,m[9]=o,m[13]=s,m[2]=u,m[6]=l,m[10]=c,m[14]=h,m[3]=d,m[7]=f,m[11]=p,m[15]=v,this}},{key:"identity",value:function(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}},{key:"clone",value:function(){return(new e).fromArray(this.elements)}},{key:"copy",value:function(e){var t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],t[9]=n[9],t[10]=n[10],t[11]=n[11],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15],this}},{key:"copyPosition",value:function(e){var t=this.elements,n=e.elements;return t[12]=n[12],t[13]=n[13],t[14]=n[14],this}},{key:"setFromMatrix3",value:function(e){var t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}},{key:"extractBasis",value:function(e,t,n){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this}},{key:"makeBasis",value:function(e,t,n){return this.set(e.x,t.x,n.x,0,e.y,t.y,n.y,0,e.z,t.z,n.z,0,0,0,0,1),this}},{key:"extractRotation",value:function(e){var t=this.elements,n=e.elements,r=1/Ti.setFromMatrixColumn(e,0).length(),i=1/Ti.setFromMatrixColumn(e,1).length(),a=1/Ti.setFromMatrixColumn(e,2).length();return t[0]=n[0]*r,t[1]=n[1]*r,t[2]=n[2]*r,t[3]=0,t[4]=n[4]*i,t[5]=n[5]*i,t[6]=n[6]*i,t[7]=0,t[8]=n[8]*a,t[9]=n[9]*a,t[10]=n[10]*a,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}},{key:"makeRotationFromEuler",value:function(e){var t=this.elements,n=e.x,r=e.y,i=e.z,a=Math.cos(n),o=Math.sin(n),s=Math.cos(r),u=Math.sin(r),l=Math.cos(i),c=Math.sin(i);if("XYZ"===e.order){var h=a*l,d=a*c,f=o*l,p=o*c;t[0]=s*l,t[4]=-s*c,t[8]=u,t[1]=d+f*u,t[5]=h-p*u,t[9]=-o*s,t[2]=p-h*u,t[6]=f+d*u,t[10]=a*s}else if("YXZ"===e.order){var v=s*l,m=s*c,g=u*l,y=u*c;t[0]=v+y*o,t[4]=g*o-m,t[8]=a*u,t[1]=a*c,t[5]=a*l,t[9]=-o,t[2]=m*o-g,t[6]=y+v*o,t[10]=a*s}else if("ZXY"===e.order){var _=s*l,x=s*c,M=u*l,S=u*c;t[0]=_-S*o,t[4]=-a*c,t[8]=M+x*o,t[1]=x+M*o,t[5]=a*l,t[9]=S-_*o,t[2]=-a*u,t[6]=o,t[10]=a*s}else if("ZYX"===e.order){var b=a*l,w=a*c,T=o*l,E=o*c;t[0]=s*l,t[4]=T*u-w,t[8]=b*u+E,t[1]=s*c,t[5]=E*u+b,t[9]=w*u-T,t[2]=-u,t[6]=o*s,t[10]=a*s}else if("YZX"===e.order){var A=a*s,R=a*u,k=o*s,C=o*u;t[0]=s*l,t[4]=C-A*c,t[8]=k*c+R,t[1]=c,t[5]=a*l,t[9]=-o*l,t[2]=-u*l,t[6]=R*c+k,t[10]=A-C*c}else if("XZY"===e.order){var L=a*s,P=a*u,I=o*s,D=o*u;t[0]=s*l,t[4]=-c,t[8]=u*l,t[1]=L*c+D,t[5]=a*l,t[9]=P*c-I,t[2]=I*c-P,t[6]=o*l,t[10]=D*c+L}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}},{key:"makeRotationFromQuaternion",value:function(e){return this.compose(Ai,e,Ri)}},{key:"lookAt",value:function(e,t,n){var r=this.elements;return Li.subVectors(e,t),0===Li.lengthSq()&&(Li.z=1),Li.normalize(),ki.crossVectors(n,Li),0===ki.lengthSq()&&(1===Math.abs(n.z)?Li.x+=1e-4:Li.z+=1e-4,Li.normalize(),ki.crossVectors(n,Li)),ki.normalize(),Ci.crossVectors(Li,ki),r[0]=ki.x,r[4]=Ci.x,r[8]=Li.x,r[1]=ki.y,r[5]=Ci.y,r[9]=Li.y,r[2]=ki.z,r[6]=Ci.z,r[10]=Li.z,this}},{key:"multiply",value:function(e){return this.multiplyMatrices(this,e)}},{key:"premultiply",value:function(e){return this.multiplyMatrices(e,this)}},{key:"multiplyMatrices",value:function(e,t){var n=e.elements,r=t.elements,i=this.elements,a=n[0],o=n[4],s=n[8],u=n[12],l=n[1],c=n[5],h=n[9],d=n[13],f=n[2],p=n[6],v=n[10],m=n[14],g=n[3],y=n[7],_=n[11],x=n[15],M=r[0],S=r[4],b=r[8],w=r[12],T=r[1],E=r[5],A=r[9],R=r[13],k=r[2],C=r[6],L=r[10],P=r[14],I=r[3],D=r[7],U=r[11],O=r[15];return i[0]=a*M+o*T+s*k+u*I,i[4]=a*S+o*E+s*C+u*D,i[8]=a*b+o*A+s*L+u*U,i[12]=a*w+o*R+s*P+u*O,i[1]=l*M+c*T+h*k+d*I,i[5]=l*S+c*E+h*C+d*D,i[9]=l*b+c*A+h*L+d*U,i[13]=l*w+c*R+h*P+d*O,i[2]=f*M+p*T+v*k+m*I,i[6]=f*S+p*E+v*C+m*D,i[10]=f*b+p*A+v*L+m*U,i[14]=f*w+p*R+v*P+m*O,i[3]=g*M+y*T+_*k+x*I,i[7]=g*S+y*E+_*C+x*D,i[11]=g*b+y*A+_*L+x*U,i[15]=g*w+y*R+_*P+x*O,this}},{key:"multiplyScalar",value:function(e){var t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}},{key:"determinant",value:function(){var e=this.elements,t=e[0],n=e[4],r=e[8],i=e[12],a=e[1],o=e[5],s=e[9],u=e[13],l=e[2],c=e[6],h=e[10],d=e[14];return e[3]*(+i*s*c-r*u*c-i*o*h+n*u*h+r*o*d-n*s*d)+e[7]*(+t*s*d-t*u*h+i*a*h-r*a*d+r*u*l-i*s*l)+e[11]*(+t*u*c-t*o*d-i*a*c+n*a*d+i*o*l-n*u*l)+e[15]*(-r*o*l-t*s*c+t*o*h+r*a*c-n*a*h+n*s*l)}},{key:"transpose",value:function(){var e,t=this.elements;return e=t[1],t[1]=t[4],t[4]=e,e=t[2],t[2]=t[8],t[8]=e,e=t[6],t[6]=t[9],t[9]=e,e=t[3],t[3]=t[12],t[12]=e,e=t[7],t[7]=t[13],t[13]=e,e=t[11],t[11]=t[14],t[14]=e,this}},{key:"setPosition",value:function(e,t,n){var r=this.elements;return e.isVector3?(r[12]=e.x,r[13]=e.y,r[14]=e.z):(r[12]=e,r[13]=t,r[14]=n),this}},{key:"invert",value:function(){var e=this.elements,t=e[0],n=e[1],r=e[2],i=e[3],a=e[4],o=e[5],s=e[6],u=e[7],l=e[8],c=e[9],h=e[10],d=e[11],f=e[12],p=e[13],v=e[14],m=e[15],g=c*v*u-p*h*u+p*s*d-o*v*d-c*s*m+o*h*m,y=f*h*u-l*v*u-f*s*d+a*v*d+l*s*m-a*h*m,_=l*p*u-f*c*u+f*o*d-a*p*d-l*o*m+a*c*m,x=f*c*s-l*p*s-f*o*h+a*p*h+l*o*v-a*c*v,M=t*g+n*y+r*_+i*x;if(0===M)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);var S=1/M;return e[0]=g*S,e[1]=(p*h*i-c*v*i-p*r*d+n*v*d+c*r*m-n*h*m)*S,e[2]=(o*v*i-p*s*i+p*r*u-n*v*u-o*r*m+n*s*m)*S,e[3]=(c*s*i-o*h*i-c*r*u+n*h*u+o*r*d-n*s*d)*S,e[4]=y*S,e[5]=(l*v*i-f*h*i+f*r*d-t*v*d-l*r*m+t*h*m)*S,e[6]=(f*s*i-a*v*i-f*r*u+t*v*u+a*r*m-t*s*m)*S,e[7]=(a*h*i-l*s*i+l*r*u-t*h*u-a*r*d+t*s*d)*S,e[8]=_*S,e[9]=(f*c*i-l*p*i-f*n*d+t*p*d+l*n*m-t*c*m)*S,e[10]=(a*p*i-f*o*i+f*n*u-t*p*u-a*n*m+t*o*m)*S,e[11]=(l*o*i-a*c*i-l*n*u+t*c*u+a*n*d-t*o*d)*S,e[12]=x*S,e[13]=(l*p*r-f*c*r+f*n*h-t*p*h-l*n*v+t*c*v)*S,e[14]=(f*o*r-a*p*r-f*n*s+t*p*s+a*n*v-t*o*v)*S,e[15]=(a*c*r-l*o*r+l*n*s-t*c*s-a*n*h+t*o*h)*S,this}},{key:"scale",value:function(e){var t=this.elements,n=e.x,r=e.y,i=e.z;return t[0]*=n,t[4]*=r,t[8]*=i,t[1]*=n,t[5]*=r,t[9]*=i,t[2]*=n,t[6]*=r,t[10]*=i,t[3]*=n,t[7]*=r,t[11]*=i,this}},{key:"getMaxScaleOnAxis",value:function(){var e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],n=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],r=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,n,r))}},{key:"makeTranslation",value:function(e,t,n){return e.isVector3?this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1):this.set(1,0,0,e,0,1,0,t,0,0,1,n,0,0,0,1),this}},{key:"makeRotationX",value:function(e){var t=Math.cos(e),n=Math.sin(e);return this.set(1,0,0,0,0,t,-n,0,0,n,t,0,0,0,0,1),this}},{key:"makeRotationY",value:function(e){var t=Math.cos(e),n=Math.sin(e);return this.set(t,0,n,0,0,1,0,0,-n,0,t,0,0,0,0,1),this}},{key:"makeRotationZ",value:function(e){var t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,0,n,t,0,0,0,0,1,0,0,0,0,1),this}},{key:"makeRotationAxis",value:function(e,t){var n=Math.cos(t),r=Math.sin(t),i=1-n,a=e.x,o=e.y,s=e.z,u=i*a,l=i*o;return this.set(u*a+n,u*o-r*s,u*s+r*o,0,u*o+r*s,l*o+n,l*s-r*a,0,u*s-r*o,l*s+r*a,i*s*s+n,0,0,0,0,1),this}},{key:"makeScale",value:function(e,t,n){return this.set(e,0,0,0,0,t,0,0,0,0,n,0,0,0,0,1),this}},{key:"makeShear",value:function(e,t,n,r,i,a){return this.set(1,n,i,0,e,1,a,0,t,r,1,0,0,0,0,1),this}},{key:"compose",value:function(e,t,n){var r=this.elements,i=t._x,a=t._y,o=t._z,s=t._w,u=i+i,l=a+a,c=o+o,h=i*u,d=i*l,f=i*c,p=a*l,v=a*c,m=o*c,g=s*u,y=s*l,_=s*c,x=n.x,M=n.y,S=n.z;return r[0]=(1-(p+m))*x,r[1]=(d+_)*x,r[2]=(f-y)*x,r[3]=0,r[4]=(d-_)*M,r[5]=(1-(h+m))*M,r[6]=(v+g)*M,r[7]=0,r[8]=(f+y)*S,r[9]=(v-g)*S,r[10]=(1-(h+p))*S,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,this}},{key:"decompose",value:function(e,t,n){var r=this.elements,i=Ti.set(r[0],r[1],r[2]).length(),a=Ti.set(r[4],r[5],r[6]).length(),o=Ti.set(r[8],r[9],r[10]).length();this.determinant()<0&&(i=-i),e.x=r[12],e.y=r[13],e.z=r[14],Ei.copy(this);var s=1/i,u=1/a,l=1/o;return Ei.elements[0]*=s,Ei.elements[1]*=s,Ei.elements[2]*=s,Ei.elements[4]*=u,Ei.elements[5]*=u,Ei.elements[6]*=u,Ei.elements[8]*=l,Ei.elements[9]*=l,Ei.elements[10]*=l,t.setFromRotationMatrix(Ei),n.x=i,n.y=a,n.z=o,this}},{key:"makePerspective",value:function(e,t,n,r,i,a){var o,s,u=arguments.length>6&&void 0!==arguments[6]?arguments[6]:$n,l=this.elements,c=2*i/(t-e),h=2*i/(n-r),d=(t+e)/(t-e),f=(n+r)/(n-r);if(u===$n)o=-(a+i)/(a-i),s=-2*a*i/(a-i);else{if(u!==er)throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+u);o=-a/(a-i),s=-a*i/(a-i)}return l[0]=c,l[4]=0,l[8]=d,l[12]=0,l[1]=0,l[5]=h,l[9]=f,l[13]=0,l[2]=0,l[6]=0,l[10]=o,l[14]=s,l[3]=0,l[7]=0,l[11]=-1,l[15]=0,this}},{key:"makeOrthographic",value:function(e,t,n,r,i,a){var o,s,u=arguments.length>6&&void 0!==arguments[6]?arguments[6]:$n,l=this.elements,c=1/(t-e),h=1/(n-r),d=1/(a-i),f=(t+e)*c,p=(n+r)*h;if(u===$n)o=(a+i)*d,s=-2*d;else{if(u!==er)throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+u);o=i*d,s=-1*d}return l[0]=2*c,l[4]=0,l[8]=0,l[12]=-f,l[1]=0,l[5]=2*h,l[9]=0,l[13]=-p,l[2]=0,l[6]=0,l[10]=s,l[14]=-o,l[3]=0,l[7]=0,l[11]=0,l[15]=1,this}},{key:"equals",value:function(e){for(var t=this.elements,n=e.elements,r=0;r<16;r++)if(t[r]!==n[r])return!1;return!0}},{key:"fromArray",value:function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=0;n<16;n++)this.elements[n]=e[n+t];return this}},{key:"toArray",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e[t+9]=n[9],e[t+10]=n[10],e[t+11]=n[11],e[t+12]=n[12],e[t+13]=n[13],e[t+14]=n[14],e[t+15]=n[15],e}}]),e}(),Ti=new Yr,Ei=new wi,Ai=new Yr(0,0,0),Ri=new Yr(1,1,1),ki=new Yr,Ci=new Yr,Li=new Yr,Pi=new wi,Ii=new qr,Di=function(e){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:t.DEFAULT_ORDER;a(this,t),this.isEuler=!0,this._x=e,this._y=n,this._z=r,this._order=i}return s(t,[{key:"x",get:function(){return this._x},set:function(e){this._x=e,this._onChangeCallback()}},{key:"y",get:function(){return this._y},set:function(e){this._y=e,this._onChangeCallback()}},{key:"z",get:function(){return this._z},set:function(e){this._z=e,this._onChangeCallback()}},{key:"order",get:function(){return this._order},set:function(e){this._order=e,this._onChangeCallback()}},{key:"set",value:function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:this._order;return this._x=e,this._y=t,this._z=n,this._order=r,this._onChangeCallback(),this}},{key:"clone",value:function(){return new this.constructor(this._x,this._y,this._z,this._order)}},{key:"copy",value:function(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}},{key:"setFromRotationMatrix",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this._order,n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],r=e.elements,i=r[0],a=r[4],o=r[8],s=r[1],u=r[5],l=r[9],c=r[2],h=r[6],d=r[10];switch(t){case"XYZ":this._y=Math.asin(sr(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-l,d),this._z=Math.atan2(-a,i)):(this._x=Math.atan2(h,u),this._z=0);break;case"YXZ":this._x=Math.asin(-sr(l,-1,1)),Math.abs(l)<.9999999?(this._y=Math.atan2(o,d),this._z=Math.atan2(s,u)):(this._y=Math.atan2(-c,i),this._z=0);break;case"ZXY":this._x=Math.asin(sr(h,-1,1)),Math.abs(h)<.9999999?(this._y=Math.atan2(-c,d),this._z=Math.atan2(-a,u)):(this._y=0,this._z=Math.atan2(s,i));break;case"ZYX":this._y=Math.asin(-sr(c,-1,1)),Math.abs(c)<.9999999?(this._x=Math.atan2(h,d),this._z=Math.atan2(s,i)):(this._x=0,this._z=Math.atan2(-a,u));break;case"YZX":this._z=Math.asin(sr(s,-1,1)),Math.abs(s)<.9999999?(this._x=Math.atan2(-l,u),this._y=Math.atan2(-c,i)):(this._x=0,this._y=Math.atan2(o,d));break;case"XZY":this._z=Math.asin(-sr(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(h,u),this._y=Math.atan2(o,i)):(this._x=Math.atan2(-l,d),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,!0===n&&this._onChangeCallback(),this}},{key:"setFromQuaternion",value:function(e,t,n){return Pi.makeRotationFromQuaternion(e),this.setFromRotationMatrix(Pi,t,n)}},{key:"setFromVector3",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this._order;return this.set(e.x,e.y,e.z,t)}},{key:"reorder",value:function(e){return Ii.setFromEuler(this),this.setFromQuaternion(Ii,e)}},{key:"equals",value:function(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}},{key:"fromArray",value:function(e){return this._x=e[0],this._y=e[1],this._z=e[2],void 0!==e[3]&&(this._order=e[3]),this._onChangeCallback(),this}},{key:"toArray",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e}},{key:"_onChange",value:function(e){return this._onChangeCallback=e,this}},{key:"_onChangeCallback",value:function(){}},{key:e,value:R().mark((function e(){return R().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._x;case 2:return e.next=4,this._y;case 4:return e.next=6,this._z;case 6:return e.next=8,this._order;case 8:case"end":return e.stop()}}),e,this)}))}]),t}(Symbol.iterator);Di.DEFAULT_ORDER="XYZ";var Ui=function(){function e(){a(this,e),this.mask=1}return s(e,[{key:"set",value:function(e){this.mask=(1<<e|0)>>>0}},{key:"enable",value:function(e){this.mask|=1<<e|0}},{key:"enableAll",value:function(){this.mask=-1}},{key:"toggle",value:function(e){this.mask^=1<<e|0}},{key:"disable",value:function(e){this.mask&=~(1<<e|0)}},{key:"disableAll",value:function(){this.mask=0}},{key:"test",value:function(e){return 0!=(this.mask&e.mask)}},{key:"isEnabled",value:function(e){return 0!=(this.mask&(1<<e|0))}}]),e}(),Oi=0,Ni=new Yr,Fi=new qr,Bi=new wi,zi=new Yr,Hi=new Yr,Gi=new Yr,Vi=new qr,Wi=new Yr(1,0,0),ji=new Yr(0,1,0),Xi=new Yr(0,0,1),qi={type:"added"},Yi={type:"removed"},Zi=function(e){w(n,e);var t=E(n);function n(){var e;a(this,n),(e=t.call(this)).isObject3D=!0,Object.defineProperty(S(e),"id",{value:Oi++}),e.uuid=or(),e.name="",e.type="Object3D",e.parent=null,e.children=[],e.up=n.DEFAULT_UP.clone();var r=new Yr,i=new Di,o=new qr,s=new Yr(1,1,1);return i._onChange((function(){o.setFromEuler(i,!1)})),o._onChange((function(){i.setFromQuaternion(o,void 0,!1)})),Object.defineProperties(S(e),{position:{configurable:!0,enumerable:!0,value:r},rotation:{configurable:!0,enumerable:!0,value:i},quaternion:{configurable:!0,enumerable:!0,value:o},scale:{configurable:!0,enumerable:!0,value:s},modelViewMatrix:{value:new wi},normalMatrix:{value:new gr}}),e.matrix=new wi,e.matrixWorld=new wi,e.matrixAutoUpdate=n.DEFAULT_MATRIX_AUTO_UPDATE,e.matrixWorldNeedsUpdate=!1,e.matrixWorldAutoUpdate=n.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,e.layers=new Ui,e.visible=!0,e.castShadow=!1,e.receiveShadow=!1,e.frustumCulled=!0,e.renderOrder=0,e.animations=[],e.userData={},e}return s(n,[{key:"onBeforeRender",value:function(){}},{key:"onAfterRender",value:function(){}},{key:"applyMatrix4",value:function(e){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(e),this.matrix.decompose(this.position,this.quaternion,this.scale)}},{key:"applyQuaternion",value:function(e){return this.quaternion.premultiply(e),this}},{key:"setRotationFromAxisAngle",value:function(e,t){this.quaternion.setFromAxisAngle(e,t)}},{key:"setRotationFromEuler",value:function(e){this.quaternion.setFromEuler(e,!0)}},{key:"setRotationFromMatrix",value:function(e){this.quaternion.setFromRotationMatrix(e)}},{key:"setRotationFromQuaternion",value:function(e){this.quaternion.copy(e)}},{key:"rotateOnAxis",value:function(e,t){return Fi.setFromAxisAngle(e,t),this.quaternion.multiply(Fi),this}},{key:"rotateOnWorldAxis",value:function(e,t){return Fi.setFromAxisAngle(e,t),this.quaternion.premultiply(Fi),this}},{key:"rotateX",value:function(e){return this.rotateOnAxis(Wi,e)}},{key:"rotateY",value:function(e){return this.rotateOnAxis(ji,e)}},{key:"rotateZ",value:function(e){return this.rotateOnAxis(Xi,e)}},{key:"translateOnAxis",value:function(e,t){return Ni.copy(e).applyQuaternion(this.quaternion),this.position.add(Ni.multiplyScalar(t)),this}},{key:"translateX",value:function(e){return this.translateOnAxis(Wi,e)}},{key:"translateY",value:function(e){return this.translateOnAxis(ji,e)}},{key:"translateZ",value:function(e){return this.translateOnAxis(Xi,e)}},{key:"localToWorld",value:function(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}},{key:"worldToLocal",value:function(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(Bi.copy(this.matrixWorld).invert())}},{key:"lookAt",value:function(e,t,n){e.isVector3?zi.copy(e):zi.set(e,t,n);var r=this.parent;this.updateWorldMatrix(!0,!1),Hi.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?Bi.lookAt(Hi,zi,this.up):Bi.lookAt(zi,Hi,this.up),this.quaternion.setFromRotationMatrix(Bi),r&&(Bi.extractRotation(r.matrixWorld),Fi.setFromRotationMatrix(Bi),this.quaternion.premultiply(Fi.invert()))}},{key:"add",value:function(e){if(arguments.length>1){for(var t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return e===this?(console.error("THREE.Object3D.add: object can't be added as a child of itself.",e),this):(e&&e.isObject3D?(null!==e.parent&&e.parent.remove(e),e.parent=this,this.children.push(e),e.dispatchEvent(qi)):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",e),this)}},{key:"remove",value:function(e){if(arguments.length>1){for(var t=0;t<arguments.length;t++)this.remove(arguments[t]);return this}var n=this.children.indexOf(e);return-1!==n&&(e.parent=null,this.children.splice(n,1),e.dispatchEvent(Yi)),this}},{key:"removeFromParent",value:function(){var e=this.parent;return null!==e&&e.remove(this),this}},{key:"clear",value:function(){for(var e=0;e<this.children.length;e++){var t=this.children[e];t.parent=null,t.dispatchEvent(Yi)}return this.children.length=0,this}},{key:"attach",value:function(e){return this.updateWorldMatrix(!0,!1),Bi.copy(this.matrixWorld).invert(),null!==e.parent&&(e.parent.updateWorldMatrix(!0,!1),Bi.multiply(e.parent.matrixWorld)),e.applyMatrix4(Bi),this.add(e),e.updateWorldMatrix(!1,!0),this}},{key:"getObjectById",value:function(e){return this.getObjectByProperty("id",e)}},{key:"getObjectByName",value:function(e){return this.getObjectByProperty("name",e)}},{key:"getObjectByProperty",value:function(e,t){if(this[e]===t)return this;for(var n=0,r=this.children.length;n<r;n++){var i=this.children[n].getObjectByProperty(e,t);if(void 0!==i)return i}}},{key:"getObjectsByProperty",value:function(e,t){var n=[];this[e]===t&&n.push(this);for(var r=0,i=this.children.length;r<i;r++){var a=this.children[r].getObjectsByProperty(e,t);a.length>0&&(n=n.concat(a))}return n}},{key:"getWorldPosition",value:function(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}},{key:"getWorldQuaternion",value:function(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Hi,e,Gi),e}},{key:"getWorldScale",value:function(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Hi,Vi,e),e}},{key:"getWorldDirection",value:function(e){this.updateWorldMatrix(!0,!1);var t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()}},{key:"raycast",value:function(){}},{key:"traverse",value:function(e){e(this);for(var t=this.children,n=0,r=t.length;n<r;n++)t[n].traverse(e)}},{key:"traverseVisible",value:function(e){if(!1!==this.visible){e(this);for(var t=this.children,n=0,r=t.length;n<r;n++)t[n].traverseVisible(e)}}},{key:"traverseAncestors",value:function(e){var t=this.parent;null!==t&&(e(t),t.traverseAncestors(e))}},{key:"updateMatrix",value:function(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0}},{key:"updateMatrixWorld",value:function(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorldNeedsUpdate=!1,e=!0);for(var t=this.children,n=0,r=t.length;n<r;n++){var i=t[n];!0!==i.matrixWorldAutoUpdate&&!0!==e||i.updateMatrixWorld(e)}}},{key:"updateWorldMatrix",value:function(e,t){var n=this.parent;if(!0===e&&null!==n&&!0===n.matrixWorldAutoUpdate&&n.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),!0===t)for(var r=this.children,i=0,a=r.length;i<a;i++){var o=r[i];!0===o.matrixWorldAutoUpdate&&o.updateWorldMatrix(!1,!0)}}},{key:"toJSON",value:function(e){var t=void 0===e||"string"==typeof e,n={};t&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},n.metadata={version:4.6,type:"Object",generator:"Object3D.toJSON"});var r={};function i(t,n){return void 0===t[n.uuid]&&(t[n.uuid]=n.toJSON(e)),n.uuid}if(r.uuid=this.uuid,r.type=this.type,""!==this.name&&(r.name=this.name),!0===this.castShadow&&(r.castShadow=!0),!0===this.receiveShadow&&(r.receiveShadow=!0),!1===this.visible&&(r.visible=!1),!1===this.frustumCulled&&(r.frustumCulled=!1),0!==this.renderOrder&&(r.renderOrder=this.renderOrder),Object.keys(this.userData).length>0&&(r.userData=this.userData),r.layers=this.layers.mask,r.matrix=this.matrix.toArray(),r.up=this.up.toArray(),!1===this.matrixAutoUpdate&&(r.matrixAutoUpdate=!1),this.isInstancedMesh&&(r.type="InstancedMesh",r.count=this.count,r.instanceMatrix=this.instanceMatrix.toJSON(),null!==this.instanceColor&&(r.instanceColor=this.instanceColor.toJSON())),this.isScene)this.background&&(this.background.isColor?r.background=this.background.toJSON():this.background.isTexture&&(r.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&!0!==this.environment.isRenderTargetTexture&&(r.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){r.geometry=i(e.geometries,this.geometry);var a=this.geometry.parameters;if(void 0!==a&&void 0!==a.shapes){var o=a.shapes;if(Array.isArray(o))for(var s=0,u=o.length;s<u;s++){var l=o[s];i(e.shapes,l)}else i(e.shapes,o)}}if(this.isSkinnedMesh&&(r.bindMode=this.bindMode,r.bindMatrix=this.bindMatrix.toArray(),void 0!==this.skeleton&&(i(e.skeletons,this.skeleton),r.skeleton=this.skeleton.uuid)),void 0!==this.material)if(Array.isArray(this.material)){for(var c=[],h=0,d=this.material.length;h<d;h++)c.push(i(e.materials,this.material[h]));r.material=c}else r.material=i(e.materials,this.material);if(this.children.length>0){r.children=[];for(var f=0;f<this.children.length;f++)r.children.push(this.children[f].toJSON(e).object)}if(this.animations.length>0){r.animations=[];for(var p=0;p<this.animations.length;p++){var v=this.animations[p];r.animations.push(i(e.animations,v))}}if(t){var m=w(e.geometries),g=w(e.materials),y=w(e.textures),_=w(e.images),x=w(e.shapes),M=w(e.skeletons),S=w(e.animations),b=w(e.nodes);m.length>0&&(n.geometries=m),g.length>0&&(n.materials=g),y.length>0&&(n.textures=y),_.length>0&&(n.images=_),x.length>0&&(n.shapes=x),M.length>0&&(n.skeletons=M),S.length>0&&(n.animations=S),b.length>0&&(n.nodes=b)}return n.object=r,n;function w(e){var t=[];for(var n in e){var r=e[n];delete r.metadata,t.push(r)}return t}}},{key:"clone",value:function(e){return(new this.constructor).copy(this,e)}},{key:"copy",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),!0===t)for(var n=0;n<e.children.length;n++){var r=e.children[n];this.add(r.clone())}return this}}]),n}(tr);Zi.DEFAULT_UP=new Yr(0,1,0),Zi.DEFAULT_MATRIX_AUTO_UPDATE=!0,Zi.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;var Ki=new Yr,Ji=new Yr,Qi=new Yr,$i=new Yr,ea=new Yr,ta=new Yr,na=new Yr,ra=new Yr,ia=new Yr,aa=new Yr,oa=!1,sa=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Yr,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Yr,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:new Yr;a(this,e),this.a=t,this.b=n,this.c=r}return s(e,[{key:"set",value:function(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this}},{key:"setFromPointsAndIndices",value:function(e,t,n,r){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[r]),this}},{key:"setFromAttributeAndIndices",value:function(e,t,n,r){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,n),this.c.fromBufferAttribute(e,r),this}},{key:"clone",value:function(){return(new this.constructor).copy(this)}},{key:"copy",value:function(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}},{key:"getArea",value:function(){return Ki.subVectors(this.c,this.b),Ji.subVectors(this.a,this.b),.5*Ki.cross(Ji).length()}},{key:"getMidpoint",value:function(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}},{key:"getNormal",value:function(t){return e.getNormal(this.a,this.b,this.c,t)}},{key:"getPlane",value:function(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}},{key:"getBarycoord",value:function(t,n){return e.getBarycoord(t,this.a,this.b,this.c,n)}},{key:"getUV",value:function(t,n,r,i,a){return!1===oa&&(console.warn("THREE.Triangle.getUV() has been renamed to THREE.Triangle.getInterpolation()."),oa=!0),e.getInterpolation(t,this.a,this.b,this.c,n,r,i,a)}},{key:"getInterpolation",value:function(t,n,r,i,a){return e.getInterpolation(t,this.a,this.b,this.c,n,r,i,a)}},{key:"containsPoint",value:function(t){return e.containsPoint(t,this.a,this.b,this.c)}},{key:"isFrontFacing",value:function(t){return e.isFrontFacing(this.a,this.b,this.c,t)}},{key:"intersectsBox",value:function(e){return e.intersectsTriangle(this)}},{key:"closestPointToPoint",value:function(e,t){var n,r,i=this.a,a=this.b,o=this.c;ea.subVectors(a,i),ta.subVectors(o,i),ra.subVectors(e,i);var s=ea.dot(ra),u=ta.dot(ra);if(s<=0&&u<=0)return t.copy(i);ia.subVectors(e,a);var l=ea.dot(ia),c=ta.dot(ia);if(l>=0&&c<=l)return t.copy(a);var h=s*c-l*u;if(h<=0&&s>=0&&l<=0)return n=s/(s-l),t.copy(i).addScaledVector(ea,n);aa.subVectors(e,o);var d=ea.dot(aa),f=ta.dot(aa);if(f>=0&&d<=f)return t.copy(o);var p=d*u-s*f;if(p<=0&&u>=0&&f<=0)return r=u/(u-f),t.copy(i).addScaledVector(ta,r);var v=l*f-d*c;if(v<=0&&c-l>=0&&d-f>=0)return na.subVectors(o,a),r=(c-l)/(c-l+(d-f)),t.copy(a).addScaledVector(na,r);var m=1/(v+p+h);return n=p*m,r=h*m,t.copy(i).addScaledVector(ea,n).addScaledVector(ta,r)}},{key:"equals",value:function(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}],[{key:"getNormal",value:function(e,t,n,r){r.subVectors(n,t),Ki.subVectors(e,t),r.cross(Ki);var i=r.lengthSq();return i>0?r.multiplyScalar(1/Math.sqrt(i)):r.set(0,0,0)}},{key:"getBarycoord",value:function(e,t,n,r,i){Ki.subVectors(r,t),Ji.subVectors(n,t),Qi.subVectors(e,t);var a=Ki.dot(Ki),o=Ki.dot(Ji),s=Ki.dot(Qi),u=Ji.dot(Ji),l=Ji.dot(Qi),c=a*u-o*o;if(0===c)return i.set(-2,-1,-1);var h=1/c,d=(u*s-o*l)*h,f=(a*l-o*s)*h;return i.set(1-d-f,f,d)}},{key:"containsPoint",value:function(e,t,n,r){return this.getBarycoord(e,t,n,r,$i),$i.x>=0&&$i.y>=0&&$i.x+$i.y<=1}},{key:"getUV",value:function(e,t,n,r,i,a,o,s){return!1===oa&&(console.warn("THREE.Triangle.getUV() has been renamed to THREE.Triangle.getInterpolation()."),oa=!0),this.getInterpolation(e,t,n,r,i,a,o,s)}},{key:"getInterpolation",value:function(e,t,n,r,i,a,o,s){return this.getBarycoord(e,t,n,r,$i),s.setScalar(0),s.addScaledVector(i,$i.x),s.addScaledVector(a,$i.y),s.addScaledVector(o,$i.z),s}},{key:"isFrontFacing",value:function(e,t,n,r){return Ki.subVectors(n,t),Ji.subVectors(e,t),Ki.cross(Ji).dot(r)<0}}]),e}(),ua=0,la=function(e){w(n,e);var t=E(n);function n(){var e;return a(this,n),(e=t.call(this)).isMaterial=!0,Object.defineProperty(S(e),"id",{value:ua++}),e.uuid=or(),e.name="",e.type="Material",e.blending=j,e.side=z,e.vertexColors=!1,e.opacity=1,e.transparent=!1,e.alphaHash=!1,e.blendSrc=ae,e.blendDst=oe,e.blendEquation=K,e.blendSrcAlpha=null,e.blendDstAlpha=null,e.blendEquationAlpha=null,e.depthFunc=ve,e.depthTest=!0,e.depthWrite=!0,e.stencilWriteMask=255,e.stencilFunc=Pn,e.stencilRef=0,e.stencilFuncMask=255,e.stencilFail=yn,e.stencilZFail=yn,e.stencilZPass=yn,e.stencilWrite=!1,e.clippingPlanes=null,e.clipIntersection=!1,e.clipShadows=!1,e.shadowSide=null,e.colorWrite=!0,e.precision=null,e.polygonOffset=!1,e.polygonOffsetFactor=0,e.polygonOffsetUnits=0,e.dithering=!1,e.alphaToCoverage=!1,e.premultipliedAlpha=!1,e.forceSinglePass=!1,e.visible=!0,e.toneMapped=!0,e.userData={},e.version=0,e._alphaTest=0,e}return s(n,[{key:"alphaTest",get:function(){return this._alphaTest},set:function(e){this._alphaTest>0!=e>0&&this.version++,this._alphaTest=e}},{key:"onBuild",value:function(){}},{key:"onBeforeRender",value:function(){}},{key:"onBeforeCompile",value:function(){}},{key:"customProgramCacheKey",value:function(){return this.onBeforeCompile.toString()}},{key:"setValues",value:function(e){if(void 0!==e)for(var t in e){var n=e[t];if(void 0!==n){var r=this[t];void 0!==r?r&&r.isColor?r.set(n):r&&r.isVector3&&n&&n.isVector3?r.copy(n):this[t]=n:console.warn("THREE.Material: '".concat(t,"' is not a property of THREE.").concat(this.type,"."))}else console.warn("THREE.Material: parameter '".concat(t,"' has value of undefined."))}}},{key:"toJSON",value:function(e){var t=void 0===e||"string"==typeof e;t&&(e={textures:{},images:{}});var n={metadata:{version:4.6,type:"Material",generator:"Material.toJSON"}};function r(e){var t=[];for(var n in e){var r=e[n];delete r.metadata,t.push(r)}return t}if(n.uuid=this.uuid,n.type=this.type,""!==this.name&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),void 0!==this.roughness&&(n.roughness=this.roughness),void 0!==this.metalness&&(n.metalness=this.metalness),void 0!==this.sheen&&(n.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(n.sheenColor=this.sheenColor.getHex()),void 0!==this.sheenRoughness&&(n.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.emissiveIntensity&&1!==this.emissiveIntensity&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),void 0!==this.specularIntensity&&(n.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(n.specularColor=this.specularColor.getHex()),void 0!==this.shininess&&(n.shininess=this.shininess),void 0!==this.clearcoat&&(n.clearcoat=this.clearcoat),void 0!==this.clearcoatRoughness&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),void 0!==this.iridescence&&(n.iridescence=this.iridescence),void 0!==this.iridescenceIOR&&(n.iridescenceIOR=this.iridescenceIOR),void 0!==this.iridescenceThicknessRange&&(n.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(n.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(n.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),void 0!==this.anisotropy&&(n.anisotropy=this.anisotropy),void 0!==this.anisotropyRotation&&(n.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(n.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(e).uuid,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(e).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(e).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(e).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(e).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(n.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(n.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(e).uuid,void 0!==this.combine&&(n.combine=this.combine)),void 0!==this.envMapIntensity&&(n.envMapIntensity=this.envMapIntensity),void 0!==this.reflectivity&&(n.reflectivity=this.reflectivity),void 0!==this.refractionRatio&&(n.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(e).uuid),void 0!==this.transmission&&(n.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(n.transmissionMap=this.transmissionMap.toJSON(e).uuid),void 0!==this.thickness&&(n.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(n.thicknessMap=this.thicknessMap.toJSON(e).uuid),void 0!==this.attenuationDistance&&this.attenuationDistance!==1/0&&(n.attenuationDistance=this.attenuationDistance),void 0!==this.attenuationColor&&(n.attenuationColor=this.attenuationColor.getHex()),void 0!==this.size&&(n.size=this.size),null!==this.shadowSide&&(n.shadowSide=this.shadowSide),void 0!==this.sizeAttenuation&&(n.sizeAttenuation=this.sizeAttenuation),this.blending!==j&&(n.blending=this.blending),this.side!==z&&(n.side=this.side),this.vertexColors&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),!0===this.transparent&&(n.transparent=this.transparent),n.depthFunc=this.depthFunc,n.depthTest=this.depthTest,n.depthWrite=this.depthWrite,n.colorWrite=this.colorWrite,n.stencilWrite=this.stencilWrite,n.stencilWriteMask=this.stencilWriteMask,n.stencilFunc=this.stencilFunc,n.stencilRef=this.stencilRef,n.stencilFuncMask=this.stencilFuncMask,n.stencilFail=this.stencilFail,n.stencilZFail=this.stencilZFail,n.stencilZPass=this.stencilZPass,void 0!==this.rotation&&0!==this.rotation&&(n.rotation=this.rotation),!0===this.polygonOffset&&(n.polygonOffset=!0),0!==this.polygonOffsetFactor&&(n.polygonOffsetFactor=this.polygonOffsetFactor),0!==this.polygonOffsetUnits&&(n.polygonOffsetUnits=this.polygonOffsetUnits),void 0!==this.linewidth&&1!==this.linewidth&&(n.linewidth=this.linewidth),void 0!==this.dashSize&&(n.dashSize=this.dashSize),void 0!==this.gapSize&&(n.gapSize=this.gapSize),void 0!==this.scale&&(n.scale=this.scale),!0===this.dithering&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),!0===this.alphaHash&&(n.alphaHash=this.alphaHash),!0===this.alphaToCoverage&&(n.alphaToCoverage=this.alphaToCoverage),!0===this.premultipliedAlpha&&(n.premultipliedAlpha=this.premultipliedAlpha),!0===this.forceSinglePass&&(n.forceSinglePass=this.forceSinglePass),!0===this.wireframe&&(n.wireframe=this.wireframe),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),"round"!==this.wireframeLinecap&&(n.wireframeLinecap=this.wireframeLinecap),"round"!==this.wireframeLinejoin&&(n.wireframeLinejoin=this.wireframeLinejoin),!0===this.flatShading&&(n.flatShading=this.flatShading),!1===this.visible&&(n.visible=!1),!1===this.toneMapped&&(n.toneMapped=!1),!1===this.fog&&(n.fog=!1),Object.keys(this.userData).length>0&&(n.userData=this.userData),t){var i=r(e.textures),a=r(e.images);i.length>0&&(n.textures=i),a.length>0&&(n.images=a)}return n}},{key:"clone",value:function(){return(new this.constructor).copy(this)}},{key:"copy",value:function(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;var t=e.clippingPlanes,n=null;if(null!==t){var r=t.length;n=new Array(r);for(var i=0;i!==r;++i)n[i]=t[i].clone()}return this.clippingPlanes=n,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}},{key:"dispose",value:function(){this.dispatchEvent({type:"dispose"})}},{key:"needsUpdate",set:function(e){!0===e&&this.version++}}]),n}(tr),ca={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,rebeccapurple:6697881,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},ha={h:0,s:0,l:0},da={h:0,s:0,l:0};function fa(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+6*(t-e)*n:n<.5?t:n<2/3?e+6*(t-e)*(2/3-n):e}var pa=function(e){function t(e,n,r){return a(this,t),this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,n,r)}return s(t,[{key:"set",value:function(e,t,n){if(void 0===t&&void 0===n){var r=e;r&&r.isColor?this.copy(r):"number"==typeof r?this.setHex(r):"string"==typeof r&&this.setStyle(r)}else this.setRGB(e,t,n);return this}},{key:"setScalar",value:function(e){return this.r=e,this.g=e,this.b=e,this}},{key:"setHex",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:pn;return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(255&e)/255,Pr.toWorkingColorSpace(this,t),this}},{key:"setRGB",value:function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:Pr.workingColorSpace;return this.r=e,this.g=t,this.b=n,Pr.toWorkingColorSpace(this,r),this}},{key:"setHSL",value:function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:Pr.workingColorSpace;if(e=ur(e,1),t=sr(t,0,1),n=sr(n,0,1),0===t)this.r=this.g=this.b=n;else{var i=n<=.5?n*(1+t):n+t-n*t,a=2*n-i;this.r=fa(a,i,e+1/3),this.g=fa(a,i,e),this.b=fa(a,i,e-1/3)}return Pr.toWorkingColorSpace(this,r),this}},{key:"setStyle",value:function(e){var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:pn;function r(t){void 0!==t&&parseFloat(t)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}if(t=/^(\w+)\(([^\)]*)\)/.exec(e)){var i,a=t[1],o=t[2];switch(a){case"rgb":case"rgba":if(i=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return r(i[4]),this.setRGB(Math.min(255,parseInt(i[1],10))/255,Math.min(255,parseInt(i[2],10))/255,Math.min(255,parseInt(i[3],10))/255,n);if(i=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return r(i[4]),this.setRGB(Math.min(100,parseInt(i[1],10))/100,Math.min(100,parseInt(i[2],10))/100,Math.min(100,parseInt(i[3],10))/100,n);break;case"hsl":case"hsla":if(i=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return r(i[4]),this.setHSL(parseFloat(i[1])/360,parseFloat(i[2])/100,parseFloat(i[3])/100,n);break;default:console.warn("THREE.Color: Unknown color model "+e)}}else if(t=/^\#([A-Fa-f\d]+)$/.exec(e)){var s=t[1],u=s.length;if(3===u)return this.setRGB(parseInt(s.charAt(0),16)/15,parseInt(s.charAt(1),16)/15,parseInt(s.charAt(2),16)/15,n);if(6===u)return this.setHex(parseInt(s,16),n);console.warn("THREE.Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,n);return this}},{key:"setColorName",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:pn,n=ca[e.toLowerCase()];return void 0!==n?this.setHex(n,t):console.warn("THREE.Color: Unknown color "+e),this}},{key:"clone",value:function(){return new this.constructor(this.r,this.g,this.b)}},{key:"copy",value:function(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}},{key:"copySRGBToLinear",value:function(e){return this.r=Tr(e.r),this.g=Tr(e.g),this.b=Tr(e.b),this}},{key:"copyLinearToSRGB",value:function(e){return this.r=Er(e.r),this.g=Er(e.g),this.b=Er(e.b),this}},{key:"convertSRGBToLinear",value:function(){return this.copySRGBToLinear(this),this}},{key:"convertLinearToSRGB",value:function(){return this.copyLinearToSRGB(this),this}},{key:"getHex",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:pn;return Pr.fromWorkingColorSpace(va.copy(this),e),65536*Math.round(sr(255*va.r,0,255))+256*Math.round(sr(255*va.g,0,255))+Math.round(sr(255*va.b,0,255))}},{key:"getHexString",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:pn;return("000000"+this.getHex(e).toString(16)).slice(-6)}},{key:"getHSL",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Pr.workingColorSpace;Pr.fromWorkingColorSpace(va.copy(this),t);var n,r,i=va.r,a=va.g,o=va.b,s=Math.max(i,a,o),u=Math.min(i,a,o),l=(u+s)/2;if(u===s)n=0,r=0;else{var c=s-u;switch(r=l<=.5?c/(s+u):c/(2-s-u),s){case i:n=(a-o)/c+(a<o?6:0);break;case a:n=(o-i)/c+2;break;case o:n=(i-a)/c+4}n/=6}return e.h=n,e.s=r,e.l=l,e}},{key:"getRGB",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Pr.workingColorSpace;return Pr.fromWorkingColorSpace(va.copy(this),t),e.r=va.r,e.g=va.g,e.b=va.b,e}},{key:"getStyle",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:pn;Pr.fromWorkingColorSpace(va.copy(this),e);var t=va.r,n=va.g,r=va.b;return e!==pn?"color(".concat(e," ").concat(t.toFixed(3)," ").concat(n.toFixed(3)," ").concat(r.toFixed(3),")"):"rgb(".concat(Math.round(255*t),",").concat(Math.round(255*n),",").concat(Math.round(255*r),")")}},{key:"offsetHSL",value:function(e,t,n){return this.getHSL(ha),ha.h+=e,ha.s+=t,ha.l+=n,this.setHSL(ha.h,ha.s,ha.l),this}},{key:"add",value:function(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}},{key:"addColors",value:function(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this}},{key:"addScalar",value:function(e){return this.r+=e,this.g+=e,this.b+=e,this}},{key:"sub",value:function(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this}},{key:"multiply",value:function(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this}},{key:"multiplyScalar",value:function(e){return this.r*=e,this.g*=e,this.b*=e,this}},{key:"lerp",value:function(e,t){return this.r+=(e.r-this.r)*t,this.g+=(e.g-this.g)*t,this.b+=(e.b-this.b)*t,this}},{key:"lerpColors",value:function(e,t,n){return this.r=e.r+(t.r-e.r)*n,this.g=e.g+(t.g-e.g)*n,this.b=e.b+(t.b-e.b)*n,this}},{key:"lerpHSL",value:function(e,t){this.getHSL(ha),e.getHSL(da);var n=lr(ha.h,da.h,t),r=lr(ha.s,da.s,t),i=lr(ha.l,da.l,t);return this.setHSL(n,r,i),this}},{key:"setFromVector3",value:function(e){return this.r=e.x,this.g=e.y,this.b=e.z,this}},{key:"applyMatrix3",value:function(e){var t=this.r,n=this.g,r=this.b,i=e.elements;return this.r=i[0]*t+i[3]*n+i[6]*r,this.g=i[1]*t+i[4]*n+i[7]*r,this.b=i[2]*t+i[5]*n+i[8]*r,this}},{key:"equals",value:function(e){return e.r===this.r&&e.g===this.g&&e.b===this.b}},{key:"fromArray",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.r=e[t],this.g=e[t+1],this.b=e[t+2],this}},{key:"toArray",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e}},{key:"fromBufferAttribute",value:function(e,t){return this.r=e.getX(t),this.g=e.getY(t),this.b=e.getZ(t),this}},{key:"toJSON",value:function(){return this.getHex()}},{key:e,value:R().mark((function e(){return R().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.r;case 2:return e.next=4,this.g;case 4:return e.next=6,this.b;case 6:case"end":return e.stop()}}),e,this)}))}]),t}(Symbol.iterator),va=new pa;pa.NAMES=ca;var ma=function(e){w(n,e);var t=E(n);function n(e){var r;return a(this,n),(r=t.call(this)).isMeshBasicMaterial=!0,r.type="MeshBasicMaterial",r.color=new pa(16777215),r.map=null,r.lightMap=null,r.lightMapIntensity=1,r.aoMap=null,r.aoMapIntensity=1,r.specularMap=null,r.alphaMap=null,r.envMap=null,r.combine=xe,r.reflectivity=1,r.refractionRatio=.98,r.wireframe=!1,r.wireframeLinewidth=1,r.wireframeLinecap="round",r.wireframeLinejoin="round",r.fog=!0,r.setValues(e),r}return s(n,[{key:"copy",value:function(e){return y(x(n.prototype),"copy",this).call(this,e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}]),n}(la),ga=ya();function ya(){for(var e=new ArrayBuffer(4),t=new Float32Array(e),n=new Uint32Array(e),r=new Uint32Array(512),i=new Uint32Array(512),a=0;a<256;++a){var o=a-127;o<-27?(r[a]=0,r[256|a]=32768,i[a]=24,i[256|a]=24):o<-14?(r[a]=1024>>-o-14,r[256|a]=1024>>-o-14|32768,i[a]=-o-1,i[256|a]=-o-1):o<=15?(r[a]=o+15<<10,r[256|a]=o+15<<10|32768,i[a]=13,i[256|a]=13):o<128?(r[a]=31744,r[256|a]=64512,i[a]=24,i[256|a]=24):(r[a]=31744,r[256|a]=64512,i[a]=13,i[256|a]=13)}for(var s=new Uint32Array(2048),u=new Uint32Array(64),l=new Uint32Array(64),c=1;c<1024;++c){for(var h=c<<13,d=0;0==(8388608&h);)h<<=1,d-=8388608;h&=-8388609,d+=947912704,s[c]=h|d}for(var f=1024;f<2048;++f)s[f]=939524096+(f-1024<<13);for(var p=1;p<31;++p)u[p]=p<<23;u[31]=1199570944,u[32]=2147483648;for(var v=33;v<63;++v)u[v]=2147483648+(v-32<<23);u[63]=3347054592;for(var m=1;m<64;++m)32!==m&&(l[m]=1024);return{floatView:t,uint32View:n,baseTable:r,shiftTable:i,mantissaTable:s,exponentTable:u,offsetTable:l}}function _a(e){Math.abs(e)>65504&&console.warn("THREE.DataUtils.toHalfFloat(): Value out of range."),e=sr(e,-65504,65504),ga.floatView[0]=e;var t=ga.uint32View[0],n=t>>23&511;return ga.baseTable[n]+((8388607&t)>>ga.shiftTable[n])}function xa(e){var t=e>>10;return ga.uint32View[0]=ga.mantissaTable[ga.offsetTable[t]+(1023&e)]+ga.exponentTable[t],ga.floatView[0]}var Ma={toHalfFloat:_a,fromHalfFloat:xa},Sa=new Yr,ba=new mr,wa=function(){function e(t,n){var r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(a(this,e),Array.isArray(t))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,this.name="",this.array=t,this.itemSize=n,this.count=void 0!==t?t.length/n:0,this.normalized=r,this.usage=Hn,this.updateRange={offset:0,count:-1},this.gpuType=et,this.version=0}return s(e,[{key:"onUploadCallback",value:function(){}},{key:"needsUpdate",set:function(e){!0===e&&this.version++}},{key:"setUsage",value:function(e){return this.usage=e,this}},{key:"copy",value:function(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this.gpuType=e.gpuType,this}},{key:"copyAt",value:function(e,t,n){e*=this.itemSize,n*=t.itemSize;for(var r=0,i=this.itemSize;r<i;r++)this.array[e+r]=t.array[n+r];return this}},{key:"copyArray",value:function(e){return this.array.set(e),this}},{key:"applyMatrix3",value:function(e){if(2===this.itemSize)for(var t=0,n=this.count;t<n;t++)ba.fromBufferAttribute(this,t),ba.applyMatrix3(e),this.setXY(t,ba.x,ba.y);else if(3===this.itemSize)for(var r=0,i=this.count;r<i;r++)Sa.fromBufferAttribute(this,r),Sa.applyMatrix3(e),this.setXYZ(r,Sa.x,Sa.y,Sa.z);return this}},{key:"applyMatrix4",value:function(e){for(var t=0,n=this.count;t<n;t++)Sa.fromBufferAttribute(this,t),Sa.applyMatrix4(e),this.setXYZ(t,Sa.x,Sa.y,Sa.z);return this}},{key:"applyNormalMatrix",value:function(e){for(var t=0,n=this.count;t<n;t++)Sa.fromBufferAttribute(this,t),Sa.applyNormalMatrix(e),this.setXYZ(t,Sa.x,Sa.y,Sa.z);return this}},{key:"transformDirection",value:function(e){for(var t=0,n=this.count;t<n;t++)Sa.fromBufferAttribute(this,t),Sa.transformDirection(e),this.setXYZ(t,Sa.x,Sa.y,Sa.z);return this}},{key:"set",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.array.set(e,t),this}},{key:"getComponent",value:function(e,t){var n=this.array[e*this.itemSize+t];return this.normalized&&(n=fr(n,this.array)),n}},{key:"setComponent",value:function(e,t,n){return this.normalized&&(n=pr(n,this.array)),this.array[e*this.itemSize+t]=n,this}},{key:"getX",value:function(e){var t=this.array[e*this.itemSize];return this.normalized&&(t=fr(t,this.array)),t}},{key:"setX",value:function(e,t){return this.normalized&&(t=pr(t,this.array)),this.array[e*this.itemSize]=t,this}},{key:"getY",value:function(e){var t=this.array[e*this.itemSize+1];return this.normalized&&(t=fr(t,this.array)),t}},{key:"setY",value:function(e,t){return this.normalized&&(t=pr(t,this.array)),this.array[e*this.itemSize+1]=t,this}},{key:"getZ",value:function(e){var t=this.array[e*this.itemSize+2];return this.normalized&&(t=fr(t,this.array)),t}},{key:"setZ",value:function(e,t){return this.normalized&&(t=pr(t,this.array)),this.array[e*this.itemSize+2]=t,this}},{key:"getW",value:function(e){var t=this.array[e*this.itemSize+3];return this.normalized&&(t=fr(t,this.array)),t}},{key:"setW",value:function(e,t){return this.normalized&&(t=pr(t,this.array)),this.array[e*this.itemSize+3]=t,this}},{key:"setXY",value:function(e,t,n){return e*=this.itemSize,this.normalized&&(t=pr(t,this.array),n=pr(n,this.array)),this.array[e+0]=t,this.array[e+1]=n,this}},{key:"setXYZ",value:function(e,t,n,r){return e*=this.itemSize,this.normalized&&(t=pr(t,this.array),n=pr(n,this.array),r=pr(r,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=r,this}},{key:"setXYZW",value:function(e,t,n,r,i){return e*=this.itemSize,this.normalized&&(t=pr(t,this.array),n=pr(n,this.array),r=pr(r,this.array),i=pr(i,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=r,this.array[e+3]=i,this}},{key:"onUpload",value:function(e){return this.onUploadCallback=e,this}},{key:"clone",value:function(){return new this.constructor(this.array,this.itemSize).copy(this)}},{key:"toJSON",value:function(){var e={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return""!==this.name&&(e.name=this.name),this.usage!==Hn&&(e.usage=this.usage),0===this.updateRange.offset&&-1===this.updateRange.count||(e.updateRange=this.updateRange),e}}]),e}(),Ta=function(e){w(n,e);var t=E(n);function n(e,r,i){return a(this,n),t.call(this,new Int8Array(e),r,i)}return s(n)}(wa),Ea=function(e){w(n,e);var t=E(n);function n(e,r,i){return a(this,n),t.call(this,new Uint8Array(e),r,i)}return s(n)}(wa),Aa=function(e){w(n,e);var t=E(n);function n(e,r,i){return a(this,n),t.call(this,new Uint8ClampedArray(e),r,i)}return s(n)}(wa),Ra=function(e){w(n,e);var t=E(n);function n(e,r,i){return a(this,n),t.call(this,new Int16Array(e),r,i)}return s(n)}(wa),ka=function(e){w(n,e);var t=E(n);function n(e,r,i){return a(this,n),t.call(this,new Uint16Array(e),r,i)}return s(n)}(wa),Ca=function(e){w(n,e);var t=E(n);function n(e,r,i){return a(this,n),t.call(this,new Int32Array(e),r,i)}return s(n)}(wa),La=function(e){w(n,e);var t=E(n);function n(e,r,i){return a(this,n),t.call(this,new Uint32Array(e),r,i)}return s(n)}(wa),Pa=function(e){w(n,e);var t=E(n);function n(e,r,i){var o;return a(this,n),(o=t.call(this,new Uint16Array(e),r,i)).isFloat16BufferAttribute=!0,o}return s(n,[{key:"getX",value:function(e){var t=xa(this.array[e*this.itemSize]);return this.normalized&&(t=fr(t,this.array)),t}},{key:"setX",value:function(e,t){return this.normalized&&(t=pr(t,this.array)),this.array[e*this.itemSize]=_a(t),this}},{key:"getY",value:function(e){var t=xa(this.array[e*this.itemSize+1]);return this.normalized&&(t=fr(t,this.array)),t}},{key:"setY",value:function(e,t){return this.normalized&&(t=pr(t,this.array)),this.array[e*this.itemSize+1]=_a(t),this}},{key:"getZ",value:function(e){var t=xa(this.array[e*this.itemSize+2]);return this.normalized&&(t=fr(t,this.array)),t}},{key:"setZ",value:function(e,t){return this.normalized&&(t=pr(t,this.array)),this.array[e*this.itemSize+2]=_a(t),this}},{key:"getW",value:function(e){var t=xa(this.array[e*this.itemSize+3]);return this.normalized&&(t=fr(t,this.array)),t}},{key:"setW",value:function(e,t){return this.normalized&&(t=pr(t,this.array)),this.array[e*this.itemSize+3]=_a(t),this}},{key:"setXY",value:function(e,t,n){return e*=this.itemSize,this.normalized&&(t=pr(t,this.array),n=pr(n,this.array)),this.array[e+0]=_a(t),this.array[e+1]=_a(n),this}},{key:"setXYZ",value:function(e,t,n,r){return e*=this.itemSize,this.normalized&&(t=pr(t,this.array),n=pr(n,this.array),r=pr(r,this.array)),this.array[e+0]=_a(t),this.array[e+1]=_a(n),this.array[e+2]=_a(r),this}},{key:"setXYZW",value:function(e,t,n,r,i){return e*=this.itemSize,this.normalized&&(t=pr(t,this.array),n=pr(n,this.array),r=pr(r,this.array),i=pr(i,this.array)),this.array[e+0]=_a(t),this.array[e+1]=_a(n),this.array[e+2]=_a(r),this.array[e+3]=_a(i),this}}]),n}(wa),Ia=function(e){w(n,e);var t=E(n);function n(e,r,i){return a(this,n),t.call(this,new Float32Array(e),r,i)}return s(n)}(wa),Da=function(e){w(n,e);var t=E(n);function n(e,r,i){return a(this,n),t.call(this,new Float64Array(e),r,i)}return s(n)}(wa),Ua=0,Oa=new wi,Na=new Zi,Fa=new Yr,Ba=new Jr,za=new Jr,Ha=new Yr,Ga=function(e){w(n,e);var t=E(n);function n(){var e;return a(this,n),(e=t.call(this)).isBufferGeometry=!0,Object.defineProperty(S(e),"id",{value:Ua++}),e.uuid=or(),e.name="",e.type="BufferGeometry",e.index=null,e.attributes={},e.morphAttributes={},e.morphTargetsRelative=!1,e.groups=[],e.boundingBox=null,e.boundingSphere=null,e.drawRange={start:0,count:1/0},e.userData={},e}return s(n,[{key:"getIndex",value:function(){return this.index}},{key:"setIndex",value:function(e){return Array.isArray(e)?this.index=new(_r(e)?La:ka)(e,1):this.index=e,this}},{key:"getAttribute",value:function(e){return this.attributes[e]}},{key:"setAttribute",value:function(e,t){return this.attributes[e]=t,this}},{key:"deleteAttribute",value:function(e){return delete this.attributes[e],this}},{key:"hasAttribute",value:function(e){return void 0!==this.attributes[e]}},{key:"addGroup",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;this.groups.push({start:e,count:t,materialIndex:n})}},{key:"clearGroups",value:function(){this.groups=[]}},{key:"setDrawRange",value:function(e,t){this.drawRange.start=e,this.drawRange.count=t}},{key:"applyMatrix4",value:function(e){var t=this.attributes.position;void 0!==t&&(t.applyMatrix4(e),t.needsUpdate=!0);var n=this.attributes.normal;if(void 0!==n){var r=(new gr).getNormalMatrix(e);n.applyNormalMatrix(r),n.needsUpdate=!0}var i=this.attributes.tangent;return void 0!==i&&(i.transformDirection(e),i.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this}},{key:"applyQuaternion",value:function(e){return Oa.makeRotationFromQuaternion(e),this.applyMatrix4(Oa),this}},{key:"rotateX",value:function(e){return Oa.makeRotationX(e),this.applyMatrix4(Oa),this}},{key:"rotateY",value:function(e){return Oa.makeRotationY(e),this.applyMatrix4(Oa),this}},{key:"rotateZ",value:function(e){return Oa.makeRotationZ(e),this.applyMatrix4(Oa),this}},{key:"translate",value:function(e,t,n){return Oa.makeTranslation(e,t,n),this.applyMatrix4(Oa),this}},{key:"scale",value:function(e,t,n){return Oa.makeScale(e,t,n),this.applyMatrix4(Oa),this}},{key:"lookAt",value:function(e){return Na.lookAt(e),Na.updateMatrix(),this.applyMatrix4(Na.matrix),this}},{key:"center",value:function(){return this.computeBoundingBox(),this.boundingBox.getCenter(Fa).negate(),this.translate(Fa.x,Fa.y,Fa.z),this}},{key:"setFromPoints",value:function(e){for(var t=[],n=0,r=e.length;n<r;n++){var i=e[n];t.push(i.x,i.y,i.z||0)}return this.setAttribute("position",new Ia(t,3)),this}},{key:"computeBoundingBox",value:function(){null===this.boundingBox&&(this.boundingBox=new Jr);var e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute)return console.error('THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box. Alternatively set "mesh.frustumCulled" to "false".',this),void this.boundingBox.set(new Yr(-1/0,-1/0,-1/0),new Yr(1/0,1/0,1/0));if(void 0!==e){if(this.boundingBox.setFromBufferAttribute(e),t)for(var n=0,r=t.length;n<r;n++){var i=t[n];Ba.setFromBufferAttribute(i),this.morphTargetsRelative?(Ha.addVectors(this.boundingBox.min,Ba.min),this.boundingBox.expandByPoint(Ha),Ha.addVectors(this.boundingBox.max,Ba.max),this.boundingBox.expandByPoint(Ha)):(this.boundingBox.expandByPoint(Ba.min),this.boundingBox.expandByPoint(Ba.max))}}else 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)}},{key:"computeBoundingSphere",value:function(){null===this.boundingSphere&&(this.boundingSphere=new vi);var e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute)return console.error('THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere. Alternatively set "mesh.frustumCulled" to "false".',this),void this.boundingSphere.set(new Yr,1/0);if(e){var n=this.boundingSphere.center;if(Ba.setFromBufferAttribute(e),t)for(var r=0,i=t.length;r<i;r++){var a=t[r];za.setFromBufferAttribute(a),this.morphTargetsRelative?(Ha.addVectors(Ba.min,za.min),Ba.expandByPoint(Ha),Ha.addVectors(Ba.max,za.max),Ba.expandByPoint(Ha)):(Ba.expandByPoint(za.min),Ba.expandByPoint(za.max))}Ba.getCenter(n);for(var o=0,s=0,u=e.count;s<u;s++)Ha.fromBufferAttribute(e,s),o=Math.max(o,n.distanceToSquared(Ha));if(t)for(var l=0,c=t.length;l<c;l++)for(var h=t[l],d=this.morphTargetsRelative,f=0,p=h.count;f<p;f++)Ha.fromBufferAttribute(h,f),d&&(Fa.fromBufferAttribute(e,f),Ha.add(Fa)),o=Math.max(o,n.distanceToSquared(Ha));this.boundingSphere.radius=Math.sqrt(o),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}},{key:"computeTangents",value:function(){var e=this.index,t=this.attributes;if(null!==e&&void 0!==t.position&&void 0!==t.normal&&void 0!==t.uv){var n=e.array,r=t.position.array,i=t.normal.array,a=t.uv.array,o=r.length/3;!1===this.hasAttribute("tangent")&&this.setAttribute("tangent",new wa(new Float32Array(4*o),4));for(var s=this.getAttribute("tangent").array,u=[],l=[],c=0;c<o;c++)u[c]=new Yr,l[c]=new Yr;var h=new Yr,d=new Yr,f=new Yr,p=new mr,v=new mr,m=new mr,g=new Yr,y=new Yr,_=this.groups;0===_.length&&(_=[{start:0,count:n.length}]);for(var x=0,M=_.length;x<M;++x)for(var S=_[x],b=S.start,w=b,T=b+S.count;w<T;w+=3)O(n[w+0],n[w+1],n[w+2]);for(var E=new Yr,A=new Yr,R=new Yr,k=new Yr,C=0,L=_.length;C<L;++C)for(var P=_[C],I=P.start,D=I,U=I+P.count;D<U;D+=3)N(n[D+0]),N(n[D+1]),N(n[D+2])}else console.error("THREE.BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");function O(e,t,n){h.fromArray(r,3*e),d.fromArray(r,3*t),f.fromArray(r,3*n),p.fromArray(a,2*e),v.fromArray(a,2*t),m.fromArray(a,2*n),d.sub(h),f.sub(h),v.sub(p),m.sub(p);var i=1/(v.x*m.y-m.x*v.y);isFinite(i)&&(g.copy(d).multiplyScalar(m.y).addScaledVector(f,-v.y).multiplyScalar(i),y.copy(f).multiplyScalar(v.x).addScaledVector(d,-m.x).multiplyScalar(i),u[e].add(g),u[t].add(g),u[n].add(g),l[e].add(y),l[t].add(y),l[n].add(y))}function N(e){R.fromArray(i,3*e),k.copy(R);var t=u[e];E.copy(t),E.sub(R.multiplyScalar(R.dot(t))).normalize(),A.crossVectors(k,t);var n=A.dot(l[e])<0?-1:1;s[4*e]=E.x,s[4*e+1]=E.y,s[4*e+2]=E.z,s[4*e+3]=n}}},{key:"computeVertexNormals",value:function(){var e=this.index,t=this.getAttribute("position");if(void 0!==t){var n=this.getAttribute("normal");if(void 0===n)n=new wa(new Float32Array(3*t.count),3),this.setAttribute("normal",n);else for(var r=0,i=n.count;r<i;r++)n.setXYZ(r,0,0,0);var a=new Yr,o=new Yr,s=new Yr,u=new Yr,l=new Yr,c=new Yr,h=new Yr,d=new Yr;if(e)for(var f=0,p=e.count;f<p;f+=3){var v=e.getX(f+0),m=e.getX(f+1),g=e.getX(f+2);a.fromBufferAttribute(t,v),o.fromBufferAttribute(t,m),s.fromBufferAttribute(t,g),h.subVectors(s,o),d.subVectors(a,o),h.cross(d),u.fromBufferAttribute(n,v),l.fromBufferAttribute(n,m),c.fromBufferAttribute(n,g),u.add(h),l.add(h),c.add(h),n.setXYZ(v,u.x,u.y,u.z),n.setXYZ(m,l.x,l.y,l.z),n.setXYZ(g,c.x,c.y,c.z)}else for(var y=0,_=t.count;y<_;y+=3)a.fromBufferAttribute(t,y+0),o.fromBufferAttribute(t,y+1),s.fromBufferAttribute(t,y+2),h.subVectors(s,o),d.subVectors(a,o),h.cross(d),n.setXYZ(y+0,h.x,h.y,h.z),n.setXYZ(y+1,h.x,h.y,h.z),n.setXYZ(y+2,h.x,h.y,h.z);this.normalizeNormals(),n.needsUpdate=!0}}},{key:"normalizeNormals",value:function(){for(var e=this.attributes.normal,t=0,n=e.count;t<n;t++)Ha.fromBufferAttribute(e,t),Ha.normalize(),e.setXYZ(t,Ha.x,Ha.y,Ha.z)}},{key:"toNonIndexed",value:function(){function e(e,t){for(var n=e.array,r=e.itemSize,i=e.normalized,a=new n.constructor(t.length*r),o=0,s=0,u=0,l=t.length;u<l;u++){o=e.isInterleavedBufferAttribute?t[u]*e.data.stride+e.offset:t[u]*r;for(var c=0;c<r;c++)a[s++]=n[o++]}return new wa(a,r,i)}if(null===this.index)return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;var t=new n,r=this.index.array,i=this.attributes;for(var a in i){var o=e(i[a],r);t.setAttribute(a,o)}var s=this.morphAttributes;for(var u in s){for(var l=[],c=s[u],h=0,d=c.length;h<d;h++){var f=e(c[h],r);l.push(f)}t.morphAttributes[u]=l}t.morphTargetsRelative=this.morphTargetsRelative;for(var p=this.groups,v=0,m=p.length;v<m;v++){var g=p[v];t.addGroup(g.start,g.count,g.materialIndex)}return t}},{key:"toJSON",value:function(){var e={metadata:{version:4.6,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.type,""!==this.name&&(e.name=this.name),Object.keys(this.userData).length>0&&(e.userData=this.userData),void 0!==this.parameters){var t=this.parameters;for(var n in t)void 0!==t[n]&&(e[n]=t[n]);return e}e.data={attributes:{}};var r=this.index;null!==r&&(e.data.index={type:r.array.constructor.name,array:Array.prototype.slice.call(r.array)});var i=this.attributes;for(var a in i){var o=i[a];e.data.attributes[a]=o.toJSON(e.data)}var s={},u=!1;for(var l in this.morphAttributes){for(var c=this.morphAttributes[l],h=[],d=0,f=c.length;d<f;d++){var p=c[d];h.push(p.toJSON(e.data))}h.length>0&&(s[l]=h,u=!0)}u&&(e.data.morphAttributes=s,e.data.morphTargetsRelative=this.morphTargetsRelative);var v=this.groups;v.length>0&&(e.data.groups=JSON.parse(JSON.stringify(v)));var m=this.boundingSphere;return null!==m&&(e.data.boundingSphere={center:m.center.toArray(),radius:m.radius}),e}},{key:"clone",value:function(){return(new this.constructor).copy(this)}},{key:"copy",value:function(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;var t={};this.name=e.name;var n=e.index;null!==n&&this.setIndex(n.clone(t));var r=e.attributes;for(var i in r){var a=r[i];this.setAttribute(i,a.clone(t))}var o=e.morphAttributes;for(var s in o){for(var u=[],l=o[s],c=0,h=l.length;c<h;c++)u.push(l[c].clone(t));this.morphAttributes[s]=u}this.morphTargetsRelative=e.morphTargetsRelative;for(var d=e.groups,f=0,p=d.length;f<p;f++){var v=d[f];this.addGroup(v.start,v.count,v.materialIndex)}var m=e.boundingBox;null!==m&&(this.boundingBox=m.clone());var g=e.boundingSphere;return null!==g&&(this.boundingSphere=g.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,this}},{key:"dispose",value:function(){this.dispatchEvent({type:"dispose"})}}]),n}(tr),Va=new wi,Wa=new bi,ja=new vi,Xa=new Yr,qa=new Yr,Ya=new Yr,Za=new Yr,Ka=new Yr,Ja=new Yr,Qa=new mr,$a=new mr,eo=new mr,to=new Yr,no=new Yr,ro=new Yr,io=new Yr,ao=new Yr,oo=function(e){w(n,e);var t=E(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Ga,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new ma;return a(this,n),(e=t.call(this)).isMesh=!0,e.type="Mesh",e.geometry=r,e.material=i,e.updateMorphTargets(),e}return s(n,[{key:"copy",value:function(e,t){return y(x(n.prototype),"copy",this).call(this,e,t),void 0!==e.morphTargetInfluences&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),void 0!==e.morphTargetDictionary&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this.material=e.material,this.geometry=e.geometry,this}},{key:"updateMorphTargets",value:function(){var e=this.geometry.morphAttributes,t=Object.keys(e);if(t.length>0){var n=e[t[0]];if(void 0!==n){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(var r=0,i=n.length;r<i;r++){var a=n[r].name||String(r);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=r}}}}},{key:"getVertexPosition",value:function(e,t){var n=this.geometry,r=n.attributes.position,i=n.morphAttributes.position,a=n.morphTargetsRelative;t.fromBufferAttribute(r,e);var o=this.morphTargetInfluences;if(i&&o){Ja.set(0,0,0);for(var s=0,u=i.length;s<u;s++){var l=o[s],c=i[s];0!==l&&(Ka.fromBufferAttribute(c,e),a?Ja.addScaledVector(Ka,l):Ja.addScaledVector(Ka.sub(t),l))}t.add(Ja)}return t}},{key:"raycast",value:function(e,t){var n=this.geometry,r=this.material,i=this.matrixWorld;if(void 0!==r){if(null===n.boundingSphere&&n.computeBoundingSphere(),ja.copy(n.boundingSphere),ja.applyMatrix4(i),Wa.copy(e.ray).recast(e.near),!1===ja.containsPoint(Wa.origin)){if(null===Wa.intersectSphere(ja,Xa))return;if(Wa.origin.distanceToSquared(Xa)>Math.pow(e.far-e.near,2))return}Va.copy(i).invert(),Wa.copy(e.ray).applyMatrix4(Va),null!==n.boundingBox&&!1===Wa.intersectsBox(n.boundingBox)||this._computeIntersections(e,t,Wa)}}},{key:"_computeIntersections",value:function(e,t,n){var r,i=this.geometry,a=this.material,o=i.index,s=i.attributes.position,u=i.attributes.uv,l=i.attributes.uv1,c=i.attributes.normal,h=i.groups,d=i.drawRange;if(null!==o)if(Array.isArray(a))for(var f=0,p=h.length;f<p;f++)for(var v=h[f],m=a[v.materialIndex],g=Math.max(v.start,d.start),y=Math.min(o.count,Math.min(v.start+v.count,d.start+d.count));g<y;g+=3){(r=so(this,m,e,n,u,l,c,o.getX(g),o.getX(g+1),o.getX(g+2)))&&(r.faceIndex=Math.floor(g/3),r.face.materialIndex=v.materialIndex,t.push(r))}else for(var _=Math.max(0,d.start),x=Math.min(o.count,d.start+d.count);_<x;_+=3){(r=so(this,a,e,n,u,l,c,o.getX(_),o.getX(_+1),o.getX(_+2)))&&(r.faceIndex=Math.floor(_/3),t.push(r))}else if(void 0!==s)if(Array.isArray(a))for(var M=0,S=h.length;M<S;M++)for(var b=h[M],w=a[b.materialIndex],T=Math.max(b.start,d.start),E=Math.min(s.count,Math.min(b.start+b.count,d.start+d.count));T<E;T+=3){(r=so(this,w,e,n,u,l,c,T,T+1,T+2))&&(r.faceIndex=Math.floor(T/3),r.face.materialIndex=b.materialIndex,t.push(r))}else for(var A=Math.max(0,d.start),R=Math.min(s.count,d.start+d.count);A<R;A+=3){(r=so(this,a,e,n,u,l,c,A,A+1,A+2))&&(r.faceIndex=Math.floor(A/3),t.push(r))}}}]),n}(Zi);function so(e,t,n,r,i,a,o,s,u,l){e.getVertexPosition(s,qa),e.getVertexPosition(u,Ya),e.getVertexPosition(l,Za);var c=function(e,t,n,r,i,a,o,s){if(null===(t.side===H?r.intersectTriangle(o,a,i,!0,s):r.intersectTriangle(i,a,o,t.side===z,s)))return null;ao.copy(s),ao.applyMatrix4(e.matrixWorld);var u=n.ray.origin.distanceTo(ao);return u<n.near||u>n.far?null:{distance:u,point:ao.clone(),object:e}}(e,t,n,r,qa,Ya,Za,io);if(c){i&&(Qa.fromBufferAttribute(i,s),$a.fromBufferAttribute(i,u),eo.fromBufferAttribute(i,l),c.uv=sa.getInterpolation(io,qa,Ya,Za,Qa,$a,eo,new mr)),a&&(Qa.fromBufferAttribute(a,s),$a.fromBufferAttribute(a,u),eo.fromBufferAttribute(a,l),c.uv1=sa.getInterpolation(io,qa,Ya,Za,Qa,$a,eo,new mr),c.uv2=c.uv1),o&&(to.fromBufferAttribute(o,s),no.fromBufferAttribute(o,u),ro.fromBufferAttribute(o,l),c.normal=sa.getInterpolation(io,qa,Ya,Za,to,no,ro,new Yr),c.normal.dot(r.direction)>0&&c.normal.multiplyScalar(-1));var h={a:s,b:u,c:l,normal:new Yr,materialIndex:0};sa.getNormal(qa,Ya,Za,h.normal),c.face=h}return c}var uo=function(e){w(n,e);var t=E(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,u=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1,l=arguments.length>5&&void 0!==arguments[5]?arguments[5]:1;a(this,n),(e=t.call(this)).type="BoxGeometry",e.parameters={width:r,height:i,depth:o,widthSegments:s,heightSegments:u,depthSegments:l};var c=S(e);s=Math.floor(s),u=Math.floor(u),l=Math.floor(l);var h=[],d=[],f=[],p=[],v=0,m=0;function g(e,t,n,r,i,a,o,s,u,l,g){for(var y=a/u,_=o/l,x=a/2,M=o/2,S=s/2,b=u+1,w=l+1,T=0,E=0,A=new Yr,R=0;R<w;R++)for(var k=R*_-M,C=0;C<b;C++){var L=C*y-x;A[e]=L*r,A[t]=k*i,A[n]=S,d.push(A.x,A.y,A.z),A[e]=0,A[t]=0,A[n]=s>0?1:-1,f.push(A.x,A.y,A.z),p.push(C/u),p.push(1-R/l),T+=1}for(var P=0;P<l;P++)for(var I=0;I<u;I++){var D=v+I+b*P,U=v+I+b*(P+1),O=v+(I+1)+b*(P+1),N=v+(I+1)+b*P;h.push(D,U,N),h.push(U,O,N),E+=6}c.addGroup(m,E,g),m+=E,v+=T}return g("z","y","x",-1,-1,o,i,r,l,u,0),g("z","y","x",1,-1,o,i,-r,l,u,1),g("x","z","y",1,1,r,o,i,s,l,2),g("x","z","y",1,-1,r,o,-i,s,l,3),g("x","y","z",1,-1,r,i,o,s,u,4),g("x","y","z",-1,-1,r,i,-o,s,u,5),e.setIndex(h),e.setAttribute("position",new Ia(d,3)),e.setAttribute("normal",new Ia(f,3)),e.setAttribute("uv",new Ia(p,2)),e}return s(n,[{key:"copy",value:function(e){return y(x(n.prototype),"copy",this).call(this,e),this.parameters=Object.assign({},e.parameters),this}}],[{key:"fromJSON",value:function(e){return new n(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}}]),n}(Ga);function lo(e){var t={};for(var n in e)for(var r in t[n]={},e[n]){var i=e[n][r];i&&(i.isColor||i.isMatrix3||i.isMatrix4||i.isVector2||i.isVector3||i.isVector4||i.isTexture||i.isQuaternion)?i.isRenderTargetTexture?(console.warn("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),t[n][r]=null):t[n][r]=i.clone():Array.isArray(i)?t[n][r]=i.slice():t[n][r]=i}return t}function co(e){for(var t={},n=0;n<e.length;n++){var r=lo(e[n]);for(var i in r)t[i]=r[i]}return t}function ho(e){return null===e.getRenderTarget()?e.outputColorSpace:vn}var fo={clone:lo,merge:co},po=function(e){w(n,e);var t=E(n);function n(e){var r;return a(this,n),(r=t.call(this)).isShaderMaterial=!0,r.type="ShaderMaterial",r.defines={},r.uniforms={},r.uniformsGroups=[],r.vertexShader="void main() {\n\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",r.fragmentShader="void main() {\n\tgl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );\n}",r.linewidth=1,r.wireframe=!1,r.wireframeLinewidth=1,r.fog=!1,r.lights=!1,r.clipping=!1,r.forceSinglePass=!0,r.extensions={derivatives:!1,fragDepth:!1,drawBuffers:!1,shaderTextureLOD:!1},r.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv1:[0,0]},r.index0AttributeName=void 0,r.uniformsNeedUpdate=!1,r.glslVersion=null,void 0!==e&&r.setValues(e),r}return s(n,[{key:"copy",value:function(e){return y(x(n.prototype),"copy",this).call(this,e),this.fragmentShader=e.fragmentShader,this.vertexShader=e.vertexShader,this.uniforms=lo(e.uniforms),this.uniformsGroups=function(e){for(var t=[],n=0;n<e.length;n++)t.push(e[n].clone());return t}(e.uniformsGroups),this.defines=Object.assign({},e.defines),this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.fog=e.fog,this.lights=e.lights,this.clipping=e.clipping,this.extensions=Object.assign({},e.extensions),this.glslVersion=e.glslVersion,this}},{key:"toJSON",value:function(e){var t=y(x(n.prototype),"toJSON",this).call(this,e);for(var r in t.glslVersion=this.glslVersion,t.uniforms={},this.uniforms){var i=this.uniforms[r].value;i&&i.isTexture?t.uniforms[r]={type:"t",value:i.toJSON(e).uuid}:i&&i.isColor?t.uniforms[r]={type:"c",value:i.getHex()}:i&&i.isVector2?t.uniforms[r]={type:"v2",value:i.toArray()}:i&&i.isVector3?t.uniforms[r]={type:"v3",value:i.toArray()}:i&&i.isVector4?t.uniforms[r]={type:"v4",value:i.toArray()}:i&&i.isMatrix3?t.uniforms[r]={type:"m3",value:i.toArray()}:i&&i.isMatrix4?t.uniforms[r]={type:"m4",value:i.toArray()}:t.uniforms[r]={value:i}}Object.keys(this.defines).length>0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader,t.lights=this.lights,t.clipping=this.clipping;var a={};for(var o in this.extensions)!0===this.extensions[o]&&(a[o]=!0);return Object.keys(a).length>0&&(t.extensions=a),t}}]),n}(la),vo=function(e){w(n,e);var t=E(n);function n(){var e;return a(this,n),(e=t.call(this)).isCamera=!0,e.type="Camera",e.matrixWorldInverse=new wi,e.projectionMatrix=new wi,e.projectionMatrixInverse=new wi,e.coordinateSystem=$n,e}return s(n,[{key:"copy",value:function(e,t){return y(x(n.prototype),"copy",this).call(this,e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this.coordinateSystem=e.coordinateSystem,this}},{key:"getWorldDirection",value:function(e){this.updateWorldMatrix(!0,!1);var t=this.matrixWorld.elements;return e.set(-t[8],-t[9],-t[10]).normalize()}},{key:"updateMatrixWorld",value:function(e){y(x(n.prototype),"updateMatrixWorld",this).call(this,e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}},{key:"updateWorldMatrix",value:function(e,t){y(x(n.prototype),"updateWorldMatrix",this).call(this,e,t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}},{key:"clone",value:function(){return(new this.constructor).copy(this)}}]),n}(Zi),mo=function(e){w(n,e);var t=E(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:50,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:.1,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:2e3;return a(this,n),(e=t.call(this)).isPerspectiveCamera=!0,e.type="PerspectiveCamera",e.fov=r,e.zoom=1,e.near=o,e.far=s,e.focus=10,e.aspect=i,e.view=null,e.filmGauge=35,e.filmOffset=0,e.updateProjectionMatrix(),e}return s(n,[{key:"copy",value:function(e,t){return y(x(n.prototype),"copy",this).call(this,e,t),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=null===e.view?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this}},{key:"setFocalLength",value:function(e){var t=.5*this.getFilmHeight()/e;this.fov=2*ar*Math.atan(t),this.updateProjectionMatrix()}},{key:"getFocalLength",value:function(){var e=Math.tan(.5*ir*this.fov);return.5*this.getFilmHeight()/e}},{key:"getEffectiveFOV",value:function(){return 2*ar*Math.atan(Math.tan(.5*ir*this.fov)/this.zoom)}},{key:"getFilmWidth",value:function(){return this.filmGauge*Math.min(this.aspect,1)}},{key:"getFilmHeight",value:function(){return this.filmGauge/Math.max(this.aspect,1)}},{key:"setViewOffset",value:function(e,t,n,r,i,a){this.aspect=e/t,null===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=r,this.view.width=i,this.view.height=a,this.updateProjectionMatrix()}},{key:"clearViewOffset",value:function(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}},{key:"updateProjectionMatrix",value:function(){var e=this.near,t=e*Math.tan(.5*ir*this.fov)/this.zoom,n=2*t,r=this.aspect*n,i=-.5*r,a=this.view;if(null!==this.view&&this.view.enabled){var o=a.fullWidth,s=a.fullHeight;i+=a.offsetX*r/o,t-=a.offsetY*n/s,r*=a.width/o,n*=a.height/s}var u=this.filmOffset;0!==u&&(i+=e*u/this.getFilmWidth()),this.projectionMatrix.makePerspective(i,i+r,t,t-n,e,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}},{key:"toJSON",value:function(e){var t=y(x(n.prototype),"toJSON",this).call(this,e);return t.object.fov=this.fov,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.aspect=this.aspect,null!==this.view&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}}]),n}(vo),go=-90,yo=function(e){w(n,e);var t=E(n);function n(e,r,i){var o;a(this,n),(o=t.call(this)).type="CubeCamera",o.renderTarget=i,o.coordinateSystem=null;var s=new mo(go,1,e,r);s.layers=o.layers,o.add(s);var u=new mo(go,1,e,r);u.layers=o.layers,o.add(u);var l=new mo(go,1,e,r);l.layers=o.layers,o.add(l);var c=new mo(go,1,e,r);c.layers=o.layers,o.add(c);var h=new mo(go,1,e,r);h.layers=o.layers,o.add(h);var d=new mo(go,1,e,r);return d.layers=o.layers,o.add(d),o}return s(n,[{key:"updateCoordinateSystem",value:function(){var e,t=this.coordinateSystem,n=this.children.concat(),r=m(n,6),i=r[0],a=r[1],o=r[2],s=r[3],u=r[4],l=r[5],c=v(n);try{for(c.s();!(e=c.n()).done;){var h=e.value;this.remove(h)}}catch(e){c.e(e)}finally{c.f()}if(t===$n)i.up.set(0,1,0),i.lookAt(1,0,0),a.up.set(0,1,0),a.lookAt(-1,0,0),o.up.set(0,0,-1),o.lookAt(0,1,0),s.up.set(0,0,1),s.lookAt(0,-1,0),u.up.set(0,1,0),u.lookAt(0,0,1),l.up.set(0,1,0),l.lookAt(0,0,-1);else{if(t!==er)throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+t);i.up.set(0,-1,0),i.lookAt(-1,0,0),a.up.set(0,-1,0),a.lookAt(1,0,0),o.up.set(0,0,1),o.lookAt(0,1,0),s.up.set(0,0,-1),s.lookAt(0,-1,0),u.up.set(0,-1,0),u.lookAt(0,0,1),l.up.set(0,-1,0),l.lookAt(0,0,-1)}var d,f=v(n);try{for(f.s();!(d=f.n()).done;){var p=d.value;this.add(p),p.updateMatrixWorld()}}catch(e){f.e(e)}finally{f.f()}}},{key:"update",value:function(e,t){null===this.parent&&this.updateMatrixWorld();var n=this.renderTarget;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());var r=m(this.children,6),i=r[0],a=r[1],o=r[2],s=r[3],u=r[4],l=r[5],c=e.getRenderTarget(),h=e.xr.enabled;e.xr.enabled=!1;var d=n.texture.generateMipmaps;n.texture.generateMipmaps=!1,e.setRenderTarget(n,0),e.render(t,i),e.setRenderTarget(n,1),e.render(t,a),e.setRenderTarget(n,2),e.render(t,o),e.setRenderTarget(n,3),e.render(t,s),e.setRenderTarget(n,4),e.render(t,u),n.texture.generateMipmaps=d,e.setRenderTarget(n,5),e.render(t,l),e.setRenderTarget(c),e.xr.enabled=h,n.texture.needsPMREMUpdate=!0}}]),n}(Zi),_o=function(e){w(n,e);var t=E(n);function n(e,r,i,o,s,u,l,c,h,d){var f;return a(this,n),e=void 0!==e?e:[],r=void 0!==r?r:Ce,(f=t.call(this,e,r,i,o,s,u,l,c,h,d)).isCubeTexture=!0,f.flipY=!1,f}return s(n,[{key:"images",get:function(){return this.image},set:function(e){this.image=e}}]),n}(Fr),xo=function(e){w(n,e);var t=E(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};a(this,n),(e=t.call(this,r,r,i)).isWebGLCubeRenderTarget=!0;var o={width:r,height:r,depth:1},s=[o,o,o,o,o,o];return void 0!==i.encoding&&(wr("THREE.WebGLCubeRenderTarget: option.encoding has been replaced by option.colorSpace."),i.colorSpace=i.encoding===un?pn:fn),e.texture=new _o(s,i.mapping,i.wrapS,i.wrapT,i.magFilter,i.minFilter,i.format,i.type,i.anisotropy,i.colorSpace),e.texture.isRenderTargetTexture=!0,e.texture.generateMipmaps=void 0!==i.generateMipmaps&&i.generateMipmaps,e.texture.minFilter=void 0!==i.minFilter?i.minFilter:Ve,e}return s(n,[{key:"fromEquirectangularTexture",value:function(e,t){this.texture.type=t.type,this.texture.colorSpace=t.colorSpace,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;var n={tEquirect:{value:null}},r="\n\n\t\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t\tvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\n\t\t\t\t\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n\n\t\t\t\t}\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvWorldDirection = transformDirection( position, modelMatrix );\n\n\t\t\t\t\t#include <begin_vertex>\n\t\t\t\t\t#include <project_vertex>\n\n\t\t\t\t}\n\t\t\t",i="\n\n\t\t\t\tuniform sampler2D tEquirect;\n\n\t\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t\t#include <common>\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvec3 direction = normalize( vWorldDirection );\n\n\t\t\t\t\tvec2 sampleUV = equirectUv( direction );\n\n\t\t\t\t\tgl_FragColor = texture2D( tEquirect, sampleUV );\n\n\t\t\t\t}\n\t\t\t",a=new uo(5,5,5),o=new po({name:"CubemapFromEquirect",uniforms:lo(n),vertexShader:r,fragmentShader:i,side:H,blending:W});o.uniforms.tEquirect.value=t;var s=new oo(a,o),u=t.minFilter;return t.minFilter===Xe&&(t.minFilter=Ve),new yo(1,10,this).update(e,s),t.minFilter=u,s.geometry.dispose(),s.material.dispose(),this}},{key:"clear",value:function(e,t,n,r){for(var i=e.getRenderTarget(),a=0;a<6;a++)e.setRenderTarget(this,a),e.clear(t,n,r);e.setRenderTarget(i)}}]),n}(Hr),Mo=new Yr,So=new Yr,bo=new gr,wo=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Yr(1,0,0),n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;a(this,e),this.isPlane=!0,this.normal=t,this.constant=n}return s(e,[{key:"set",value:function(e,t){return this.normal.copy(e),this.constant=t,this}},{key:"setComponents",value:function(e,t,n,r){return this.normal.set(e,t,n),this.constant=r,this}},{key:"setFromNormalAndCoplanarPoint",value:function(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}},{key:"setFromCoplanarPoints",value:function(e,t,n){var r=Mo.subVectors(n,t).cross(So.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(r,e),this}},{key:"copy",value:function(e){return this.normal.copy(e.normal),this.constant=e.constant,this}},{key:"normalize",value:function(){var e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this}},{key:"negate",value:function(){return this.constant*=-1,this.normal.negate(),this}},{key:"distanceToPoint",value:function(e){return this.normal.dot(e)+this.constant}},{key:"distanceToSphere",value:function(e){return this.distanceToPoint(e.center)-e.radius}},{key:"projectPoint",value:function(e,t){return t.copy(e).addScaledVector(this.normal,-this.distanceToPoint(e))}},{key:"intersectLine",value:function(e,t){var n=e.delta(Mo),r=this.normal.dot(n);if(0===r)return 0===this.distanceToPoint(e.start)?t.copy(e.start):null;var i=-(e.start.dot(this.normal)+this.constant)/r;return i<0||i>1?null:t.copy(e.start).addScaledVector(n,i)}},{key:"intersectsLine",value:function(e){var t=this.distanceToPoint(e.start),n=this.distanceToPoint(e.end);return t<0&&n>0||n<0&&t>0}},{key:"intersectsBox",value:function(e){return e.intersectsPlane(this)}},{key:"intersectsSphere",value:function(e){return e.intersectsPlane(this)}},{key:"coplanarPoint",value:function(e){return e.copy(this.normal).multiplyScalar(-this.constant)}},{key:"applyMatrix4",value:function(e,t){var n=t||bo.getNormalMatrix(e),r=this.coplanarPoint(Mo).applyMatrix4(e),i=this.normal.applyMatrix3(n).normalize();return this.constant=-r.dot(i),this}},{key:"translate",value:function(e){return this.constant-=e.dot(this.normal),this}},{key:"equals",value:function(e){return e.normal.equals(this.normal)&&e.constant===this.constant}},{key:"clone",value:function(){return(new this.constructor).copy(this)}}]),e}(),To=new vi,Eo=new Yr,Ao=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new wo,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new wo,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:new wo,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:new wo,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:new wo,s=arguments.length>5&&void 0!==arguments[5]?arguments[5]:new wo;a(this,e),this.planes=[t,n,r,i,o,s]}return s(e,[{key:"set",value:function(e,t,n,r,i,a){var o=this.planes;return o[0].copy(e),o[1].copy(t),o[2].copy(n),o[3].copy(r),o[4].copy(i),o[5].copy(a),this}},{key:"copy",value:function(e){for(var t=this.planes,n=0;n<6;n++)t[n].copy(e.planes[n]);return this}},{key:"setFromProjectionMatrix",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:$n,n=this.planes,r=e.elements,i=r[0],a=r[1],o=r[2],s=r[3],u=r[4],l=r[5],c=r[6],h=r[7],d=r[8],f=r[9],p=r[10],v=r[11],m=r[12],g=r[13],y=r[14],_=r[15];if(n[0].setComponents(s-i,h-u,v-d,_-m).normalize(),n[1].setComponents(s+i,h+u,v+d,_+m).normalize(),n[2].setComponents(s+a,h+l,v+f,_+g).normalize(),n[3].setComponents(s-a,h-l,v-f,_-g).normalize(),n[4].setComponents(s-o,h-c,v-p,_-y).normalize(),t===$n)n[5].setComponents(s+o,h+c,v+p,_+y).normalize();else{if(t!==er)throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+t);n[5].setComponents(o,c,p,y).normalize()}return this}},{key:"intersectsObject",value:function(e){if(void 0!==e.boundingSphere)null===e.boundingSphere&&e.computeBoundingSphere(),To.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{var t=e.geometry;null===t.boundingSphere&&t.computeBoundingSphere(),To.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(To)}},{key:"intersectsSprite",value:function(e){return To.center.set(0,0,0),To.radius=.7071067811865476,To.applyMatrix4(e.matrixWorld),this.intersectsSphere(To)}},{key:"intersectsSphere",value:function(e){for(var t=this.planes,n=e.center,r=-e.radius,i=0;i<6;i++){if(t[i].distanceToPoint(n)<r)return!1}return!0}},{key:"intersectsBox",value:function(e){for(var t=this.planes,n=0;n<6;n++){var r=t[n];if(Eo.x=r.normal.x>0?e.max.x:e.min.x,Eo.y=r.normal.y>0?e.max.y:e.min.y,Eo.z=r.normal.z>0?e.max.z:e.min.z,r.distanceToPoint(Eo)<0)return!1}return!0}},{key:"containsPoint",value:function(e){for(var t=this.planes,n=0;n<6;n++)if(t[n].distanceToPoint(e)<0)return!1;return!0}},{key:"clone",value:function(){return(new this.constructor).copy(this)}}]),e}();function Ro(){var e=null,t=!1,n=null,r=null;function i(t,a){n(t,a),r=e.requestAnimationFrame(i)}return{start:function(){!0!==t&&null!==n&&(r=e.requestAnimationFrame(i),t=!0)},stop:function(){e.cancelAnimationFrame(r),t=!1},setAnimationLoop:function(e){n=e},setContext:function(t){e=t}}}function ko(e,t){var n=t.isWebGL2,r=new WeakMap;return{get:function(e){return e.isInterleavedBufferAttribute&&(e=e.data),r.get(e)},remove:function(t){t.isInterleavedBufferAttribute&&(t=t.data);var n=r.get(t);n&&(e.deleteBuffer(n.buffer),r.delete(t))},update:function(t,i){if(t.isGLBufferAttribute){var a=r.get(t);(!a||a.version<t.version)&&r.set(t,{buffer:t.buffer,type:t.type,bytesPerElement:t.elementSize,version:t.version})}else{t.isInterleavedBufferAttribute&&(t=t.data);var o=r.get(t);void 0===o?r.set(t,function(t,r){var i,a=t.array,o=t.usage,s=e.createBuffer();if(e.bindBuffer(r,s),e.bufferData(r,a,o),t.onUploadCallback(),a instanceof Float32Array)i=e.FLOAT;else if(a instanceof Uint16Array)if(t.isFloat16BufferAttribute){if(!n)throw new Error("THREE.WebGLAttributes: Usage of Float16BufferAttribute requires WebGL2.");i=e.HALF_FLOAT}else i=e.UNSIGNED_SHORT;else if(a instanceof Int16Array)i=e.SHORT;else if(a instanceof Uint32Array)i=e.UNSIGNED_INT;else if(a instanceof Int32Array)i=e.INT;else if(a instanceof Int8Array)i=e.BYTE;else if(a instanceof Uint8Array)i=e.UNSIGNED_BYTE;else{if(!(a instanceof Uint8ClampedArray))throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+a);i=e.UNSIGNED_BYTE}return{buffer:s,type:i,bytesPerElement:a.BYTES_PER_ELEMENT,version:t.version}}(t,i)):o.version<t.version&&(!function(t,r,i){var a=r.array,o=r.updateRange;e.bindBuffer(i,t),-1===o.count?e.bufferSubData(i,0,a):(n?e.bufferSubData(i,o.offset*a.BYTES_PER_ELEMENT,a,o.offset,o.count):e.bufferSubData(i,o.offset*a.BYTES_PER_ELEMENT,a.subarray(o.offset,o.offset+o.count)),o.count=-1),r.onUploadCallback()}(o.buffer,t,i),o.version=t.version)}}}}var Co=function(e){w(n,e);var t=E(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1;a(this,n),(e=t.call(this)).type="PlaneGeometry",e.parameters={width:r,height:i,widthSegments:o,heightSegments:s};for(var u=r/2,l=i/2,c=Math.floor(o),h=Math.floor(s),d=c+1,f=h+1,p=r/c,v=i/h,m=[],g=[],y=[],_=[],x=0;x<f;x++)for(var M=x*v-l,S=0;S<d;S++){var b=S*p-u;g.push(b,-M,0),y.push(0,0,1),_.push(S/c),_.push(1-x/h)}for(var w=0;w<h;w++)for(var T=0;T<c;T++){var E=T+d*w,A=T+d*(w+1),R=T+1+d*(w+1),k=T+1+d*w;m.push(E,A,k),m.push(A,R,k)}return e.setIndex(m),e.setAttribute("position",new Ia(g,3)),e.setAttribute("normal",new Ia(y,3)),e.setAttribute("uv",new Ia(_,2)),e}return s(n,[{key:"copy",value:function(e){return y(x(n.prototype),"copy",this).call(this,e),this.parameters=Object.assign({},e.parameters),this}}],[{key:"fromJSON",value:function(e){return new n(e.width,e.height,e.widthSegments,e.heightSegments)}}]),n}(Ga),Lo={alphahash_fragment:"#ifdef USE_ALPHAHASH\n\tif ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;\n#endif",alphahash_pars_fragment:"#ifdef USE_ALPHAHASH\n\tconst float ALPHA_HASH_SCALE = 0.05;\n\tfloat hash2D( vec2 value ) {\n\t\treturn fract( 1.0e4 * sin( 17.0 * value.x + 0.1 * value.y ) * ( 0.1 + abs( sin( 13.0 * value.y + value.x ) ) ) );\n\t}\n\tfloat hash3D( vec3 value ) {\n\t\treturn hash2D( vec2( hash2D( value.xy ), value.z ) );\n\t}\n\tfloat getAlphaHashThreshold( vec3 position ) {\n\t\tfloat maxDeriv = max(\n\t\t\tlength( dFdx( position.xyz ) ),\n\t\t\tlength( dFdy( position.xyz ) )\n\t\t);\n\t\tfloat pixScale = 1.0 / ( ALPHA_HASH_SCALE * maxDeriv );\n\t\tvec2 pixScales = vec2(\n\t\t\texp2( floor( log2( pixScale ) ) ),\n\t\t\texp2( ceil( log2( pixScale ) ) )\n\t\t);\n\t\tvec2 alpha = vec2(\n\t\t\thash3D( floor( pixScales.x * position.xyz ) ),\n\t\t\thash3D( floor( pixScales.y * position.xyz ) )\n\t\t);\n\t\tfloat lerpFactor = fract( log2( pixScale ) );\n\t\tfloat x = ( 1.0 - lerpFactor ) * alpha.x + lerpFactor * alpha.y;\n\t\tfloat a = min( lerpFactor, 1.0 - lerpFactor );\n\t\tvec3 cases = vec3(\n\t\t\tx * x / ( 2.0 * a * ( 1.0 - a ) ),\n\t\t\t( x - 0.5 * a ) / ( 1.0 - a ),\n\t\t\t1.0 - ( ( 1.0 - x ) * ( 1.0 - x ) / ( 2.0 * a * ( 1.0 - a ) ) )\n\t\t);\n\t\tfloat threshold = ( x < ( 1.0 - a ) )\n\t\t\t? ( ( x < a ) ? cases.x : cases.y )\n\t\t\t: cases.z;\n\t\treturn clamp( threshold , 1.0e-6, 1.0 );\n\t}\n#endif",alphamap_fragment:"#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;\n#endif",alphamap_pars_fragment:"#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif",alphatest_fragment:"#ifdef USE_ALPHATEST\n\tif ( diffuseColor.a < alphaTest ) discard;\n#endif",alphatest_pars_fragment:"#ifdef USE_ALPHATEST\n\tuniform float alphaTest;\n#endif",aomap_fragment:"#ifdef USE_AOMAP\n\tfloat ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0;\n\treflectedLight.indirectDiffuse *= ambientOcclusion;\n\t#if defined( USE_ENVMAP ) && defined( STANDARD )\n\t\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\t\treflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );\n\t#endif\n#endif",aomap_pars_fragment:"#ifdef USE_AOMAP\n\tuniform sampler2D aoMap;\n\tuniform float aoMapIntensity;\n#endif",begin_vertex:"vec3 transformed = vec3( position );\n#ifdef USE_ALPHAHASH\n\tvPosition = vec3( position );\n#endif",beginnormal_vertex:"vec3 objectNormal = vec3( normal );\n#ifdef USE_TANGENT\n\tvec3 objectTangent = vec3( tangent.xyz );\n#endif",bsdfs:"float 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_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) {\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, 1.0, dotVH );\n\tfloat G = G_BlinnPhong_Implicit( );\n\tfloat D = D_BlinnPhong( shininess, dotNH );\n\treturn F * ( G * D );\n} // validated",iridescence_fragment:"#ifdef USE_IRIDESCENCE\n\tconst mat3 XYZ_TO_REC709 = mat3(\n\t\t 3.2404542, -0.9692660, 0.0556434,\n\t\t-1.5371385, 1.8760108, -0.2040259,\n\t\t-0.4985314, 0.0415560, 1.0572252\n\t);\n\tvec3 Fresnel0ToIor( vec3 fresnel0 ) {\n\t\tvec3 sqrtF0 = sqrt( fresnel0 );\n\t\treturn ( vec3( 1.0 ) + sqrtF0 ) / ( vec3( 1.0 ) - sqrtF0 );\n\t}\n\tvec3 IorToFresnel0( vec3 transmittedIor, float incidentIor ) {\n\t\treturn pow2( ( transmittedIor - vec3( incidentIor ) ) / ( transmittedIor + vec3( incidentIor ) ) );\n\t}\n\tfloat IorToFresnel0( float transmittedIor, float incidentIor ) {\n\t\treturn pow2( ( transmittedIor - incidentIor ) / ( transmittedIor + incidentIor ));\n\t}\n\tvec3 evalSensitivity( float OPD, vec3 shift ) {\n\t\tfloat phase = 2.0 * PI * OPD * 1.0e-9;\n\t\tvec3 val = vec3( 5.4856e-13, 4.4201e-13, 5.2481e-13 );\n\t\tvec3 pos = vec3( 1.6810e+06, 1.7953e+06, 2.2084e+06 );\n\t\tvec3 var = vec3( 4.3278e+09, 9.3046e+09, 6.6121e+09 );\n\t\tvec3 xyz = val * sqrt( 2.0 * PI * var ) * cos( pos * phase + shift ) * exp( - pow2( phase ) * var );\n\t\txyz.x += 9.7470e-14 * sqrt( 2.0 * PI * 4.5282e+09 ) * cos( 2.2399e+06 * phase + shift[ 0 ] ) * exp( - 4.5282e+09 * pow2( phase ) );\n\t\txyz /= 1.0685e-7;\n\t\tvec3 rgb = XYZ_TO_REC709 * xyz;\n\t\treturn rgb;\n\t}\n\tvec3 evalIridescence( float outsideIOR, float eta2, float cosTheta1, float thinFilmThickness, vec3 baseF0 ) {\n\t\tvec3 I;\n\t\tfloat iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) );\n\t\tfloat sinTheta2Sq = pow2( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2( cosTheta1 ) );\n\t\tfloat cosTheta2Sq = 1.0 - sinTheta2Sq;\n\t\tif ( cosTheta2Sq < 0.0 ) {\n\t\t\treturn vec3( 1.0 );\n\t\t}\n\t\tfloat cosTheta2 = sqrt( cosTheta2Sq );\n\t\tfloat R0 = IorToFresnel0( iridescenceIOR, outsideIOR );\n\t\tfloat R12 = F_Schlick( R0, 1.0, cosTheta1 );\n\t\tfloat T121 = 1.0 - R12;\n\t\tfloat phi12 = 0.0;\n\t\tif ( iridescenceIOR < outsideIOR ) phi12 = PI;\n\t\tfloat phi21 = PI - phi12;\n\t\tvec3 baseIOR = Fresnel0ToIor( clamp( baseF0, 0.0, 0.9999 ) );\t\tvec3 R1 = IorToFresnel0( baseIOR, iridescenceIOR );\n\t\tvec3 R23 = F_Schlick( R1, 1.0, cosTheta2 );\n\t\tvec3 phi23 = vec3( 0.0 );\n\t\tif ( baseIOR[ 0 ] < iridescenceIOR ) phi23[ 0 ] = PI;\n\t\tif ( baseIOR[ 1 ] < iridescenceIOR ) phi23[ 1 ] = PI;\n\t\tif ( baseIOR[ 2 ] < iridescenceIOR ) phi23[ 2 ] = PI;\n\t\tfloat OPD = 2.0 * iridescenceIOR * thinFilmThickness * cosTheta2;\n\t\tvec3 phi = vec3( phi21 ) + phi23;\n\t\tvec3 R123 = clamp( R12 * R23, 1e-5, 0.9999 );\n\t\tvec3 r123 = sqrt( R123 );\n\t\tvec3 Rs = pow2( T121 ) * R23 / ( vec3( 1.0 ) - R123 );\n\t\tvec3 C0 = R12 + Rs;\n\t\tI = C0;\n\t\tvec3 Cm = Rs - T121;\n\t\tfor ( int m = 1; m <= 2; ++ m ) {\n\t\t\tCm *= r123;\n\t\t\tvec3 Sm = 2.0 * evalSensitivity( float( m ) * OPD, float( m ) * phi );\n\t\t\tI += Cm * Sm;\n\t\t}\n\t\treturn max( I, vec3( 0.0 ) );\n\t}\n#endif",bumpmap_pars_fragment:"#ifdef USE_BUMPMAP\n\tuniform sampler2D bumpMap;\n\tuniform float bumpScale;\n\tvec2 dHdxy_fwd() {\n\t\tvec2 dSTdx = dFdx( vBumpMapUv );\n\t\tvec2 dSTdy = dFdy( vBumpMapUv );\n\t\tfloat Hll = bumpScale * texture2D( bumpMap, vBumpMapUv ).x;\n\t\tfloat dBx = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdx ).x - Hll;\n\t\tfloat dBy = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdy ).x - Hll;\n\t\treturn vec2( dBx, dBy );\n\t}\n\tvec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {\n\t\tvec3 vSigmaX = dFdx( surf_pos.xyz );\n\t\tvec3 vSigmaY = dFdy( surf_pos.xyz );\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 ) * faceDirection;\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",clipping_planes_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tvec4 plane;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n\t\tplane = clippingPlanes[ i ];\n\t\tif ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;\n\t}\n\t#pragma unroll_loop_end\n\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\tbool clipped = true;\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n\t\t\tplane = clippingPlanes[ i ];\n\t\t\tclipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t\tif ( clipped ) discard;\n\t#endif\n#endif",clipping_planes_pars_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n\tuniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif",clipping_planes_pars_vertex:"#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n#endif",clipping_planes_vertex:"#if NUM_CLIPPING_PLANES > 0\n\tvClipPosition = - mvPosition.xyz;\n#endif",color_fragment:"#if defined( USE_COLOR_ALPHA )\n\tdiffuseColor *= vColor;\n#elif defined( USE_COLOR )\n\tdiffuseColor.rgb *= vColor;\n#endif",color_pars_fragment:"#if defined( USE_COLOR_ALPHA )\n\tvarying vec4 vColor;\n#elif defined( USE_COLOR )\n\tvarying vec3 vColor;\n#endif",color_pars_vertex:"#if defined( USE_COLOR_ALPHA )\n\tvarying vec4 vColor;\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )\n\tvarying vec3 vColor;\n#endif",color_vertex:"#if defined( USE_COLOR_ALPHA )\n\tvColor = vec4( 1.0 );\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )\n\tvColor = vec3( 1.0 );\n#endif\n#ifdef USE_COLOR\n\tvColor *= color;\n#endif\n#ifdef USE_INSTANCING_COLOR\n\tvColor.xyz *= instanceColor.xyz;\n#endif",common:"#define PI 3.141592653589793\n#define PI2 6.283185307179586\n#define PI_HALF 1.5707963267948966\n#define RECIPROCAL_PI 0.3183098861837907\n#define RECIPROCAL_PI2 0.15915494309189535\n#define EPSILON 1e-6\n#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\n#define whiteComplement( a ) ( 1.0 - saturate( a ) )\nfloat pow2( const in float x ) { return x*x; }\nvec3 pow2( const in vec3 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 max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }\nfloat average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); }\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}\n#ifdef HIGH_PRECISION\n\tfloat precisionSafeLength( vec3 v ) { return length( v ); }\n#else\n\tfloat precisionSafeLength( vec3 v ) {\n\t\tfloat maxComponent = max3( abs( v ) );\n\t\treturn length( v / maxComponent ) * maxComponent;\n\t}\n#endif\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#ifdef USE_CLEARCOAT\n\tvec3 clearcoatNormal;\n#endif\n};\n#ifdef USE_ALPHAHASH\n\tvarying vec3 vPosition;\n#endif\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}\nmat3 transposeMat3( const in mat3 m ) {\n\tmat3 tmp;\n\ttmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );\n\ttmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );\n\ttmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );\n\treturn tmp;\n}\nfloat luminance( const in vec3 rgb ) {\n\tconst vec3 weights = vec3( 0.2126729, 0.7151522, 0.0721750 );\n\treturn dot( weights, rgb );\n}\nbool isPerspectiveMatrix( mat4 m ) {\n\treturn m[ 2 ][ 3 ] == - 1.0;\n}\nvec2 equirectUv( in vec3 dir ) {\n\tfloat u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;\n\tfloat v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\treturn vec2( u, v );\n}\nvec3 BRDF_Lambert( const in vec3 diffuseColor ) {\n\treturn RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {\n\tfloat fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n\treturn f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n}\nfloat F_Schlick( const in float f0, const in float f90, const in float dotVH ) {\n\tfloat fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n\treturn f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n} // validated",cube_uv_reflection_fragment:"#ifdef ENVMAP_TYPE_CUBE_UV\n\t#define cubeUV_minMipLevel 4.0\n\t#define cubeUV_minTileSize 16.0\n\tfloat getFace( vec3 direction ) {\n\t\tvec3 absDirection = abs( direction );\n\t\tfloat face = - 1.0;\n\t\tif ( absDirection.x > absDirection.z ) {\n\t\t\tif ( absDirection.x > absDirection.y )\n\t\t\t\tface = direction.x > 0.0 ? 0.0 : 3.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t} else {\n\t\t\tif ( absDirection.z > absDirection.y )\n\t\t\t\tface = direction.z > 0.0 ? 2.0 : 5.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t}\n\t\treturn face;\n\t}\n\tvec2 getUV( vec3 direction, float face ) {\n\t\tvec2 uv;\n\t\tif ( face == 0.0 ) {\n\t\t\tuv = vec2( direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 1.0 ) {\n\t\t\tuv = vec2( - direction.x, - direction.z ) / abs( direction.y );\n\t\t} else if ( face == 2.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.y ) / abs( direction.z );\n\t\t} else if ( face == 3.0 ) {\n\t\t\tuv = vec2( - direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 4.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.z ) / abs( direction.y );\n\t\t} else {\n\t\t\tuv = vec2( direction.x, direction.y ) / abs( direction.z );\n\t\t}\n\t\treturn 0.5 * ( uv + 1.0 );\n\t}\n\tvec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {\n\t\tfloat face = getFace( direction );\n\t\tfloat filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );\n\t\tmipInt = max( mipInt, cubeUV_minMipLevel );\n\t\tfloat faceSize = exp2( mipInt );\n\t\thighp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0;\n\t\tif ( face > 2.0 ) {\n\t\t\tuv.y += faceSize;\n\t\t\tface -= 3.0;\n\t\t}\n\t\tuv.x += face * faceSize;\n\t\tuv.x += filterInt * 3.0 * cubeUV_minTileSize;\n\t\tuv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize );\n\t\tuv.x *= CUBEUV_TEXEL_WIDTH;\n\t\tuv.y *= CUBEUV_TEXEL_HEIGHT;\n\t\t#ifdef texture2DGradEXT\n\t\t\treturn texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb;\n\t\t#else\n\t\t\treturn texture2D( envMap, uv ).rgb;\n\t\t#endif\n\t}\n\t#define cubeUV_r0 1.0\n\t#define cubeUV_v0 0.339\n\t#define cubeUV_m0 - 2.0\n\t#define cubeUV_r1 0.8\n\t#define cubeUV_v1 0.276\n\t#define cubeUV_m1 - 1.0\n\t#define cubeUV_r4 0.4\n\t#define cubeUV_v4 0.046\n\t#define cubeUV_m4 2.0\n\t#define cubeUV_r5 0.305\n\t#define cubeUV_v5 0.016\n\t#define cubeUV_m5 3.0\n\t#define cubeUV_r6 0.21\n\t#define cubeUV_v6 0.0038\n\t#define cubeUV_m6 4.0\n\tfloat roughnessToMip( float roughness ) {\n\t\tfloat mip = 0.0;\n\t\tif ( roughness >= cubeUV_r1 ) {\n\t\t\tmip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0;\n\t\t} else if ( roughness >= cubeUV_r4 ) {\n\t\t\tmip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1;\n\t\t} else if ( roughness >= cubeUV_r5 ) {\n\t\t\tmip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4;\n\t\t} else if ( roughness >= cubeUV_r6 ) {\n\t\t\tmip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5;\n\t\t} else {\n\t\t\tmip = - 2.0 * log2( 1.16 * roughness );\t\t}\n\t\treturn mip;\n\t}\n\tvec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {\n\t\tfloat mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP );\n\t\tfloat mipF = fract( mip );\n\t\tfloat mipInt = floor( mip );\n\t\tvec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );\n\t\tif ( mipF == 0.0 ) {\n\t\t\treturn vec4( color0, 1.0 );\n\t\t} else {\n\t\t\tvec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );\n\t\t\treturn vec4( mix( color0, color1, mipF ), 1.0 );\n\t\t}\n\t}\n#endif",defaultnormal_vertex:"vec3 transformedNormal = objectNormal;\n#ifdef USE_INSTANCING\n\tmat3 m = mat3( instanceMatrix );\n\ttransformedNormal /= vec3( dot( m[ 0 ], m[ 0 ] ), dot( m[ 1 ], m[ 1 ] ), dot( m[ 2 ], m[ 2 ] ) );\n\ttransformedNormal = m * transformedNormal;\n#endif\ntransformedNormal = normalMatrix * transformedNormal;\n#ifdef FLIP_SIDED\n\ttransformedNormal = - transformedNormal;\n#endif\n#ifdef USE_TANGENT\n\tvec3 transformedTangent = ( modelViewMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n\t#ifdef FLIP_SIDED\n\t\ttransformedTangent = - transformedTangent;\n\t#endif\n#endif",displacementmap_pars_vertex:"#ifdef USE_DISPLACEMENTMAP\n\tuniform sampler2D displacementMap;\n\tuniform float displacementScale;\n\tuniform float displacementBias;\n#endif",displacementmap_vertex:"#ifdef USE_DISPLACEMENTMAP\n\ttransformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias );\n#endif",emissivemap_fragment:"#ifdef USE_EMISSIVEMAP\n\tvec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );\n\ttotalEmissiveRadiance *= emissiveColor.rgb;\n#endif",emissivemap_pars_fragment:"#ifdef USE_EMISSIVEMAP\n\tuniform sampler2D emissiveMap;\n#endif",colorspace_fragment:"gl_FragColor = linearToOutputTexel( gl_FragColor );",colorspace_pars_fragment:"vec4 LinearToLinear( in vec4 value ) {\n\treturn value;\n}\nvec4 LinearTosRGB( in vec4 value ) {\n\treturn 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.a );\n}",envmap_fragment:"#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvec3 cameraToFrag;\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToFrag = normalize( vWorldPosition - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( cameraToFrag, worldNormal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( cameraToFrag, 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, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n\t#else\n\t\tvec4 envColor = vec4( 0.0 );\n\t#endif\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",envmap_common_pars_fragment:"#ifdef USE_ENVMAP\n\tuniform float envMapIntensity;\n\tuniform float flipEnvMap;\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tuniform samplerCube envMap;\n\t#else\n\t\tuniform sampler2D envMap;\n\t#endif\n\t\n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\n\tuniform float reflectivity;\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\tvarying vec3 vWorldPosition;\n\t\tuniform float refractionRatio;\n\t#else\n\t\tvarying vec3 vReflect;\n\t#endif\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\t\n\t\tvarying vec3 vWorldPosition;\n\t#else\n\t\tvarying vec3 vReflect;\n\t\tuniform float refractionRatio;\n\t#endif\n#endif",envmap_physical_pars_fragment:"#ifdef USE_ENVMAP\n\tvec3 getIBLIrradiance( const in vec3 normal ) {\n\t\t#ifdef ENVMAP_TYPE_CUBE_UV\n\t\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, worldNormal, 1.0 );\n\t\t\treturn PI * envMapColor.rgb * envMapIntensity;\n\t\t#else\n\t\t\treturn vec3( 0.0 );\n\t\t#endif\n\t}\n\tvec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {\n\t\t#ifdef ENVMAP_TYPE_CUBE_UV\n\t\t\tvec3 reflectVec = reflect( - viewDir, normal );\n\t\t\treflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );\n\t\t\treflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, reflectVec, roughness );\n\t\t\treturn envMapColor.rgb * envMapIntensity;\n\t\t#else\n\t\t\treturn vec3( 0.0 );\n\t\t#endif\n\t}\n\t#ifdef USE_ANISOTROPY\n\t\tvec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) {\n\t\t\t#ifdef ENVMAP_TYPE_CUBE_UV\n\t\t\t\tvec3 bentNormal = cross( bitangent, viewDir );\n\t\t\t\tbentNormal = normalize( cross( bentNormal, bitangent ) );\n\t\t\t\tbentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) );\n\t\t\t\treturn getIBLRadiance( viewDir, bentNormal, roughness );\n\t\t\t#else\n\t\t\t\treturn vec3( 0.0 );\n\t\t\t#endif\n\t\t}\n\t#endif\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvWorldPosition = worldPosition.xyz;\n\t#else\n\t\tvec3 cameraToVertex;\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n\t\t}\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",fog_vertex:"#ifdef USE_FOG\n\tvFogDepth = - mvPosition.z;\n#endif",fog_pars_vertex:"#ifdef USE_FOG\n\tvarying float vFogDepth;\n#endif",fog_fragment:"#ifdef USE_FOG\n\t#ifdef FOG_EXP2\n\t\tfloat fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );\n\t#else\n\t\tfloat fogFactor = smoothstep( fogNear, fogFar, vFogDepth );\n\t#endif\n\tgl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n#endif",fog_pars_fragment:"#ifdef USE_FOG\n\tuniform vec3 fogColor;\n\tvarying float vFogDepth;\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 USE_GRADIENTMAP\n\tuniform sampler2D gradientMap;\n#endif\nvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n\tfloat dotNL = dot( normal, lightDirection );\n\tvec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n\t#ifdef USE_GRADIENTMAP\n\t\treturn vec3( texture2D( gradientMap, coord ).r );\n\t#else\n\t\tvec2 fw = fwidth( coord ) * 0.5;\n\t\treturn mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) );\n\t#endif\n}",lightmap_fragment:"#ifdef USE_LIGHTMAP\n\tvec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n\tvec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;\n\treflectedLight.indirectDiffuse += lightMapIrradiance;\n#endif",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\n\tuniform sampler2D lightMap;\n\tuniform float lightMapIntensity;\n#endif",lights_lambert_fragment:"LambertMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularStrength = specularStrength;",lights_lambert_pars_fragment:"varying vec3 vViewPosition;\nstruct LambertMaterial {\n\tvec3 diffuseColor;\n\tfloat specularStrength;\n};\nvoid RE_Direct_Lambert( const in IncidentLight directLight, const in GeometricContext geometry, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in GeometricContext geometry, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_Lambert\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Lambert",lights_pars_begin:"uniform bool receiveShadow;\nuniform vec3 ambientLightColor;\nuniform vec3 lightProbe[ 9 ];\nvec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {\n\tfloat x = normal.x, y = normal.y, z = normal.z;\n\tvec3 result = shCoefficients[ 0 ] * 0.886227;\n\tresult += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;\n\tresult += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;\n\tresult += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;\n\tresult += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;\n\tresult += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;\n\tresult += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );\n\tresult += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;\n\tresult += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );\n\treturn result;\n}\nvec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {\n\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\tvec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );\n\treturn irradiance;\n}\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n\tvec3 irradiance = ambientLightColor;\n\treturn irradiance;\n}\nfloat getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n\t#if defined ( LEGACY_LIGHTS )\n\t\tif ( cutoffDistance > 0.0 && decayExponent > 0.0 ) {\n\t\t\treturn pow( saturate( - lightDistance / cutoffDistance + 1.0 ), decayExponent );\n\t\t}\n\t\treturn 1.0;\n\t#else\n\t\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n\t\tif ( cutoffDistance > 0.0 ) {\n\t\t\tdistanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\t\t}\n\t\treturn distanceFalloff;\n\t#endif\n}\nfloat getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {\n\treturn smoothstep( coneCosine, penumbraCosine, angleCosine );\n}\n#if NUM_DIR_LIGHTS > 0\n\tstruct DirectionalLight {\n\t\tvec3 direction;\n\t\tvec3 color;\n\t};\n\tuniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n\tvoid getDirectionalLightInfo( const in DirectionalLight directionalLight, const in GeometricContext geometry, out IncidentLight light ) {\n\t\tlight.color = directionalLight.color;\n\t\tlight.direction = directionalLight.direction;\n\t\tlight.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};\n\tuniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n\tvoid getPointLightInfo( const in PointLight pointLight, const in GeometricContext geometry, out IncidentLight light ) {\n\t\tvec3 lVector = pointLight.position - geometry.position;\n\t\tlight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tlight.color = pointLight.color;\n\t\tlight.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );\n\t\tlight.visible = ( light.color != vec3( 0.0 ) );\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\tstruct SpotLight {\n\t\tvec3 position;\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tfloat coneCos;\n\t\tfloat penumbraCos;\n\t};\n\tuniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n\tvoid getSpotLightInfo( const in SpotLight spotLight, const in GeometricContext geometry, out IncidentLight light ) {\n\t\tvec3 lVector = spotLight.position - geometry.position;\n\t\tlight.direction = normalize( lVector );\n\t\tfloat angleCos = dot( light.direction, spotLight.direction );\n\t\tfloat spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n\t\tif ( spotAttenuation > 0.0 ) {\n\t\t\tfloat lightDistance = length( lVector );\n\t\t\tlight.color = spotLight.color * spotAttenuation;\n\t\t\tlight.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );\n\t\t\tlight.visible = ( light.color != vec3( 0.0 ) );\n\t\t} else {\n\t\t\tlight.color = vec3( 0.0 );\n\t\t\tlight.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 ltc_1;\tuniform sampler2D ltc_2;\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 vec3 normal ) {\n\t\tfloat dotNL = dot( normal, hemiLight.direction );\n\t\tfloat hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n\t\tvec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n\t\treturn irradiance;\n\t}\n#endif",lights_toon_fragment:"ToonMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;",lights_toon_pars_fragment:"varying vec3 vViewPosition;\nstruct ToonMaterial {\n\tvec3 diffuseColor;\n};\nvoid RE_Direct_Toon( const in IncidentLight directLight, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\tvec3 irradiance = getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_Toon\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Toon",lights_phong_fragment:"BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;",lights_phong_pars_fragment:"varying vec3 vViewPosition;\nstruct BlinnPhongMaterial {\n\tvec3 diffuseColor;\n\tvec3 specularColor;\n\tfloat specularShininess;\n\tfloat specularStrength;\n};\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n\treflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometry.viewDir, geometry.normal, 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_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_BlinnPhong\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_BlinnPhong",lights_physical_fragment:"PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nvec3 dxy = max( abs( dFdx( geometryNormal ) ), abs( dFdy( geometryNormal ) ) );\nfloat geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );\nmaterial.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness;\nmaterial.roughness = min( material.roughness, 1.0 );\n#ifdef IOR\n\tmaterial.ior = ior;\n\t#ifdef USE_SPECULAR\n\t\tfloat specularIntensityFactor = specularIntensity;\n\t\tvec3 specularColorFactor = specularColor;\n\t\t#ifdef USE_SPECULAR_COLORMAP\n\t\t\tspecularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb;\n\t\t#endif\n\t\t#ifdef USE_SPECULAR_INTENSITYMAP\n\t\t\tspecularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a;\n\t\t#endif\n\t\tmaterial.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );\n\t#else\n\t\tfloat specularIntensityFactor = 1.0;\n\t\tvec3 specularColorFactor = vec3( 1.0 );\n\t\tmaterial.specularF90 = 1.0;\n\t#endif\n\tmaterial.specularColor = mix( min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor );\n#else\n\tmaterial.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor );\n\tmaterial.specularF90 = 1.0;\n#endif\n#ifdef USE_CLEARCOAT\n\tmaterial.clearcoat = clearcoat;\n\tmaterial.clearcoatRoughness = clearcoatRoughness;\n\tmaterial.clearcoatF0 = vec3( 0.04 );\n\tmaterial.clearcoatF90 = 1.0;\n\t#ifdef USE_CLEARCOATMAP\n\t\tmaterial.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x;\n\t#endif\n\t#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\t\tmaterial.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y;\n\t#endif\n\tmaterial.clearcoat = saturate( material.clearcoat );\tmaterial.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );\n\tmaterial.clearcoatRoughness += geometryRoughness;\n\tmaterial.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );\n#endif\n#ifdef USE_IRIDESCENCE\n\tmaterial.iridescence = iridescence;\n\tmaterial.iridescenceIOR = iridescenceIOR;\n\t#ifdef USE_IRIDESCENCEMAP\n\t\tmaterial.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r;\n\t#endif\n\t#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\t\tmaterial.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum;\n\t#else\n\t\tmaterial.iridescenceThickness = iridescenceThicknessMaximum;\n\t#endif\n#endif\n#ifdef USE_SHEEN\n\tmaterial.sheenColor = sheenColor;\n\t#ifdef USE_SHEEN_COLORMAP\n\t\tmaterial.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb;\n\t#endif\n\tmaterial.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 );\n\t#ifdef USE_SHEEN_ROUGHNESSMAP\n\t\tmaterial.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a;\n\t#endif\n#endif\n#ifdef USE_ANISOTROPY\n\t#ifdef USE_ANISOTROPYMAP\n\t\tmat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x );\n\t\tvec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb;\n\t\tvec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b;\n\t#else\n\t\tvec2 anisotropyV = anisotropyVector;\n\t#endif\n\tmaterial.anisotropy = length( anisotropyV );\n\tanisotropyV /= material.anisotropy;\n\tmaterial.anisotropy = saturate( material.anisotropy );\n\tmaterial.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );\n\tmaterial.anisotropyT = tbn[ 0 ] * anisotropyV.x - tbn[ 1 ] * anisotropyV.y;\n\tmaterial.anisotropyB = tbn[ 1 ] * anisotropyV.x + tbn[ 0 ] * anisotropyV.y;\n#endif",lights_physical_pars_fragment:"struct PhysicalMaterial {\n\tvec3 diffuseColor;\n\tfloat roughness;\n\tvec3 specularColor;\n\tfloat specularF90;\n\t#ifdef USE_CLEARCOAT\n\t\tfloat clearcoat;\n\t\tfloat clearcoatRoughness;\n\t\tvec3 clearcoatF0;\n\t\tfloat clearcoatF90;\n\t#endif\n\t#ifdef USE_IRIDESCENCE\n\t\tfloat iridescence;\n\t\tfloat iridescenceIOR;\n\t\tfloat iridescenceThickness;\n\t\tvec3 iridescenceFresnel;\n\t\tvec3 iridescenceF0;\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tvec3 sheenColor;\n\t\tfloat sheenRoughness;\n\t#endif\n\t#ifdef IOR\n\t\tfloat ior;\n\t#endif\n\t#ifdef USE_TRANSMISSION\n\t\tfloat transmission;\n\t\tfloat transmissionAlpha;\n\t\tfloat thickness;\n\t\tfloat attenuationDistance;\n\t\tvec3 attenuationColor;\n\t#endif\n\t#ifdef USE_ANISOTROPY\n\t\tfloat anisotropy;\n\t\tfloat alphaT;\n\t\tvec3 anisotropyT;\n\t\tvec3 anisotropyB;\n\t#endif\n};\nvec3 clearcoatSpecular = vec3( 0.0 );\nvec3 sheenSpecular = vec3( 0.0 );\nvec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) {\n float x = clamp( 1.0 - dotVH, 0.0, 1.0 );\n float x2 = x * x;\n float x5 = clamp( x * x2 * x2, 0.0, 0.9999 );\n return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 );\n}\nfloat V_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}\n#ifdef USE_ANISOTROPY\n\tfloat V_GGX_SmithCorrelated_Anisotropic( const in float alphaT, const in float alphaB, const in float dotTV, const in float dotBV, const in float dotTL, const in float dotBL, const in float dotNV, const in float dotNL ) {\n\t\tfloat gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) );\n\t\tfloat gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) );\n\t\tfloat v = 0.5 / ( gv + gl );\n\t\treturn saturate(v);\n\t}\n\tfloat D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) {\n\t\tfloat a2 = alphaT * alphaB;\n\t\thighp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH );\n\t\thighp float v2 = dot( v, v );\n\t\tfloat w2 = a2 / v2;\n\t\treturn RECIPROCAL_PI * a2 * pow2 ( w2 );\n\t}\n#endif\n#ifdef USE_CLEARCOAT\n\tvec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) {\n\t\tvec3 f0 = material.clearcoatF0;\n\t\tfloat f90 = material.clearcoatF90;\n\t\tfloat roughness = material.clearcoatRoughness;\n\t\tfloat alpha = pow2( roughness );\n\t\tvec3 halfDir = normalize( lightDir + viewDir );\n\t\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\t\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\t\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\t\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\t\tvec3 F = F_Schlick( f0, f90, dotVH );\n\t\tfloat V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\t\tfloat D = D_GGX( alpha, dotNH );\n\t\treturn F * ( V * D );\n\t}\n#endif\nvec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {\n\tvec3 f0 = material.specularColor;\n\tfloat f90 = material.specularF90;\n\tfloat roughness = material.roughness;\n\tfloat alpha = pow2( roughness );\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\tvec3 F = F_Schlick( f0, f90, dotVH );\n\t#ifdef USE_IRIDESCENCE\n\t\tF = mix( F, material.iridescenceFresnel, material.iridescence );\n\t#endif\n\t#ifdef USE_ANISOTROPY\n\t\tfloat dotTL = dot( material.anisotropyT, lightDir );\n\t\tfloat dotTV = dot( material.anisotropyT, viewDir );\n\t\tfloat dotTH = dot( material.anisotropyT, halfDir );\n\t\tfloat dotBL = dot( material.anisotropyB, lightDir );\n\t\tfloat dotBV = dot( material.anisotropyB, viewDir );\n\t\tfloat dotBH = dot( material.anisotropyB, halfDir );\n\t\tfloat V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL );\n\t\tfloat D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH );\n\t#else\n\t\tfloat V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\t\tfloat D = D_GGX( alpha, dotNH );\n\t#endif\n\treturn F * ( V * D );\n}\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, 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\tfloat dotNV = saturate( dot( N, V ) );\n\tvec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\n\tuv = uv * LUT_SCALE + LUT_BIAS;\n\treturn uv;\n}\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n\tfloat l = length( f );\n\treturn max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n}\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n\tfloat x = dot( v1, v2 );\n\tfloat y = abs( x );\n\tfloat a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\n\tfloat b = 3.4175940 + ( 4.1616724 + y ) * y;\n\tfloat v = a / b;\n\tfloat theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\n\treturn cross( v1, v2 ) * theta_sintheta;\n}\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\n\tvec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n\tvec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n\tvec3 lightNormal = cross( v1, v2 );\n\tif( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n\tvec3 T1, T2;\n\tT1 = normalize( V - N * dot( V, N ) );\n\tT2 = - cross( N, T1 );\n\tmat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );\n\tvec3 coords[ 4 ];\n\tcoords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n\tcoords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n\tcoords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n\tcoords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n\tcoords[ 0 ] = normalize( coords[ 0 ] );\n\tcoords[ 1 ] = normalize( coords[ 1 ] );\n\tcoords[ 2 ] = normalize( coords[ 2 ] );\n\tcoords[ 3 ] = normalize( coords[ 3 ] );\n\tvec3 vectorFormFactor = vec3( 0.0 );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n\tfloat result = LTC_ClippedSphereFormFactor( vectorFormFactor );\n\treturn vec3( result );\n}\n#if defined( USE_SHEEN )\nfloat D_Charlie( float roughness, float dotNH ) {\n\tfloat alpha = pow2( roughness );\n\tfloat invAlpha = 1.0 / alpha;\n\tfloat cos2h = dotNH * dotNH;\n\tfloat sin2h = max( 1.0 - cos2h, 0.0078125 );\n\treturn ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );\n}\nfloat V_Neubelt( float dotNV, float dotNL ) {\n\treturn saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );\n}\nvec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat D = D_Charlie( sheenRoughness, dotNH );\n\tfloat V = V_Neubelt( dotNV, dotNL );\n\treturn sheenColor * ( D * V );\n}\n#endif\nfloat IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat r2 = roughness * roughness;\n\tfloat a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95;\n\tfloat b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72;\n\tfloat DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) );\n\treturn saturate( DG * RECIPROCAL_PI );\n}\nvec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, 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 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw;\n\treturn fab;\n}\nvec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {\n\tvec2 fab = DFGApprox( normal, viewDir, roughness );\n\treturn specularColor * fab.x + specularF90 * fab.y;\n}\n#ifdef USE_IRIDESCENCE\nvoid computeMultiscatteringIridescence( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float iridescence, const in vec3 iridescenceF0, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n#else\nvoid computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n#endif\n\tvec2 fab = DFGApprox( normal, viewDir, roughness );\n\t#ifdef USE_IRIDESCENCE\n\t\tvec3 Fr = mix( specularColor, iridescenceF0, iridescence );\n\t#else\n\t\tvec3 Fr = specularColor;\n\t#endif\n\tvec3 FssEss = Fr * fab.x + specularF90 * fab.y;\n\tfloat Ess = fab.x + fab.y;\n\tfloat Ems = 1.0 - Ess;\n\tvec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619;\tvec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );\n\tsingleScatter += FssEss;\n\tmultiScatter += Fms * Ems;\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n\tvoid RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t\tvec3 normal = geometry.normal;\n\t\tvec3 viewDir = geometry.viewDir;\n\t\tvec3 position = geometry.position;\n\t\tvec3 lightPos = rectAreaLight.position;\n\t\tvec3 halfWidth = rectAreaLight.halfWidth;\n\t\tvec3 halfHeight = rectAreaLight.halfHeight;\n\t\tvec3 lightColor = rectAreaLight.color;\n\t\tfloat roughness = material.roughness;\n\t\tvec3 rectCoords[ 4 ];\n\t\trectCoords[ 0 ] = lightPos + halfWidth - halfHeight;\t\trectCoords[ 1 ] = lightPos - halfWidth - halfHeight;\n\t\trectCoords[ 2 ] = lightPos - halfWidth + halfHeight;\n\t\trectCoords[ 3 ] = lightPos + halfWidth + halfHeight;\n\t\tvec2 uv = LTC_Uv( normal, viewDir, roughness );\n\t\tvec4 t1 = texture2D( ltc_1, uv );\n\t\tvec4 t2 = texture2D( ltc_2, uv );\n\t\tmat3 mInv = mat3(\n\t\t\tvec3( t1.x, 0, t1.y ),\n\t\t\tvec3( 0, 1, 0 ),\n\t\t\tvec3( t1.z, 0, t1.w )\n\t\t);\n\t\tvec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );\n\t\treflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n\t\treflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\n\t}\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( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifdef USE_CLEARCOAT\n\t\tfloat dotNLcc = saturate( dot( geometry.clearcoatNormal, directLight.direction ) );\n\t\tvec3 ccIrradiance = dotNLcc * directLight.color;\n\t\tclearcoatSpecular += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometry.viewDir, geometry.clearcoatNormal, material );\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tsheenSpecular += irradiance * BRDF_Sheen( directLight.direction, geometry.viewDir, geometry.normal, material.sheenColor, material.sheenRoughness );\n\t#endif\n\treflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometry.viewDir, geometry.normal, material );\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\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_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n\t#ifdef USE_CLEARCOAT\n\t\tclearcoatSpecular += clearcoatRadiance * EnvironmentBRDF( geometry.clearcoatNormal, geometry.viewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tsheenSpecular += irradiance * material.sheenColor * IBLSheenBRDF( geometry.normal, geometry.viewDir, material.sheenRoughness );\n\t#endif\n\tvec3 singleScattering = vec3( 0.0 );\n\tvec3 multiScattering = vec3( 0.0 );\n\tvec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n\t#ifdef USE_IRIDESCENCE\n\t\tcomputeMultiscatteringIridescence( geometry.normal, geometry.viewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering );\n\t#else\n\t\tcomputeMultiscattering( geometry.normal, geometry.viewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering );\n\t#endif\n\tvec3 totalScattering = singleScattering + multiScattering;\n\tvec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) );\n\treflectedLight.indirectSpecular += radiance * singleScattering;\n\treflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;\n\treflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;\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\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}",lights_fragment_begin:"\nGeometricContext geometry;\ngeometry.position = - vViewPosition;\ngeometry.normal = normal;\ngeometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\n#ifdef USE_CLEARCOAT\n\tgeometry.clearcoatNormal = clearcoatNormal;\n#endif\n#ifdef USE_IRIDESCENCE\n\tfloat dotNVi = saturate( dot( normal, geometry.viewDir ) );\n\tif ( material.iridescenceThickness == 0.0 ) {\n\t\tmaterial.iridescence = 0.0;\n\t} else {\n\t\tmaterial.iridescence = saturate( material.iridescence );\n\t}\n\tif ( material.iridescence > 0.0 ) {\n\t\tmaterial.iridescenceFresnel = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );\n\t\tmaterial.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi );\n\t}\n#endif\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n\tPointLight pointLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tgetPointLightInfo( pointLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )\n\t\tpointLightShadow = pointLightShadows[ i ];\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n\tSpotLight spotLight;\n\tvec4 spotColor;\n\tvec3 spotLightCoord;\n\tbool inSpotLightMap;\n\t#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tgetSpotLightInfo( spotLight, geometry, directLight );\n\t\t#if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n\t\t#define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX\n\t\t#elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\t#define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS\n\t\t#else\n\t\t#define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n\t\t#endif\n\t\t#if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS )\n\t\t\tspotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w;\n\t\t\tinSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) );\n\t\t\tspotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy );\n\t\t\tdirectLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color;\n\t\t#endif\n\t\t#undef SPOT_LIGHT_MAP_INDEX\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\tspotLightShadow = spotLightShadows[ i ];\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n\tDirectionalLight directionalLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tgetDirectionalLightInfo( directionalLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n\t\tdirectionalLightShadow = directionalLightShadows[ i ];\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n\tRectAreaLight rectAreaLight;\n\t#pragma unroll_loop_start\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\t#pragma unroll_loop_end\n#endif\n#if defined( RE_IndirectDiffuse )\n\tvec3 iblIrradiance = vec3( 0.0 );\n\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n\tirradiance += getLightProbeIrradiance( lightProbe, geometry.normal );\n\t#if ( NUM_HEMI_LIGHTS > 0 )\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\t\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry.normal );\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n#endif\n#if defined( RE_IndirectSpecular )\n\tvec3 radiance = vec3( 0.0 );\n\tvec3 clearcoatRadiance = vec3( 0.0 );\n#endif",lights_fragment_maps:"#if defined( RE_IndirectDiffuse )\n\t#ifdef USE_LIGHTMAP\n\t\tvec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n\t\tvec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;\n\t\tirradiance += lightMapIrradiance;\n\t#endif\n\t#if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )\n\t\tiblIrradiance += getIBLIrradiance( geometry.normal );\n\t#endif\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\t#ifdef USE_ANISOTROPY\n\t\tradiance += getIBLAnisotropyRadiance( geometry.viewDir, geometry.normal, material.roughness, material.anisotropyB, material.anisotropy );\n\t#else\n\t\tradiance += getIBLRadiance( geometry.viewDir, geometry.normal, material.roughness );\n\t#endif\n\t#ifdef USE_CLEARCOAT\n\t\tclearcoatRadiance += getIBLRadiance( geometry.viewDir, geometry.clearcoatNormal, material.clearcoatRoughness );\n\t#endif\n#endif",lights_fragment_end:"#if defined( RE_IndirectDiffuse )\n\tRE_IndirectDiffuse( irradiance, geometry, material, reflectedLight );\n#endif\n#if defined( RE_IndirectSpecular )\n\tRE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometry, material, reflectedLight );\n#endif",logdepthbuf_fragment:"#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\tgl_FragDepthEXT = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\n#endif",logdepthbuf_pars_fragment:"#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\tuniform float logDepthBufFC;\n\tvarying float vFragDepth;\n\tvarying float vIsPerspective;\n#endif",logdepthbuf_pars_vertex:"#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvarying float vFragDepth;\n\t\tvarying float vIsPerspective;\n\t#else\n\t\tuniform float logDepthBufFC;\n\t#endif\n#endif",logdepthbuf_vertex:"#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvFragDepth = 1.0 + gl_Position.w;\n\t\tvIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );\n\t#else\n\t\tif ( isPerspectiveMatrix( projectionMatrix ) ) {\n\t\t\tgl_Position.z = log2( max( EPSILON, gl_Position.w + 1.0 ) ) * logDepthBufFC - 1.0;\n\t\t\tgl_Position.z *= gl_Position.w;\n\t\t}\n\t#endif\n#endif",map_fragment:"#ifdef USE_MAP\n\tdiffuseColor *= texture2D( map, vMapUv );\n#endif",map_pars_fragment:"#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif",map_particle_fragment:"#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\t#if defined( USE_POINTS_UV )\n\t\tvec2 uv = vUv;\n\t#else\n\t\tvec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;\n\t#endif\n#endif\n#ifdef USE_MAP\n\tdiffuseColor *= texture2D( map, uv );\n#endif\n#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, uv ).g;\n#endif",map_particle_pars_fragment:"#if defined( USE_POINTS_UV )\n\tvarying vec2 vUv;\n#else\n\t#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\t\tuniform mat3 uvTransform;\n\t#endif\n#endif\n#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif\n#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif",metalnessmap_fragment:"float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n\tvec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );\n\tmetalnessFactor *= texelMetalness.b;\n#endif",metalnessmap_pars_fragment:"#ifdef USE_METALNESSMAP\n\tuniform sampler2D metalnessMap;\n#endif",morphcolor_vertex:"#if defined( USE_MORPHCOLORS ) && defined( MORPHTARGETS_TEXTURE )\n\tvColor *= morphTargetBaseInfluence;\n\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\t#if defined( USE_COLOR_ALPHA )\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ];\n\t\t#elif defined( USE_COLOR )\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];\n\t\t#endif\n\t}\n#endif",morphnormal_vertex:"#ifdef USE_MORPHNORMALS\n\tobjectNormal *= morphTargetBaseInfluence;\n\t#ifdef MORPHTARGETS_TEXTURE\n\t\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];\n\t\t}\n\t#else\n\t\tobjectNormal += morphNormal0 * morphTargetInfluences[ 0 ];\n\t\tobjectNormal += morphNormal1 * morphTargetInfluences[ 1 ];\n\t\tobjectNormal += morphNormal2 * morphTargetInfluences[ 2 ];\n\t\tobjectNormal += morphNormal3 * morphTargetInfluences[ 3 ];\n\t#endif\n#endif",morphtarget_pars_vertex:"#ifdef USE_MORPHTARGETS\n\tuniform float morphTargetBaseInfluence;\n\t#ifdef MORPHTARGETS_TEXTURE\n\t\tuniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];\n\t\tuniform sampler2DArray morphTargetsTexture;\n\t\tuniform ivec2 morphTargetsTextureSize;\n\t\tvec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) {\n\t\t\tint texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset;\n\t\t\tint y = texelIndex / morphTargetsTextureSize.x;\n\t\t\tint x = texelIndex - y * morphTargetsTextureSize.x;\n\t\t\tivec3 morphUV = ivec3( x, y, morphTargetIndex );\n\t\t\treturn texelFetch( morphTargetsTexture, morphUV, 0 );\n\t\t}\n\t#else\n\t\t#ifndef USE_MORPHNORMALS\n\t\t\tuniform float morphTargetInfluences[ 8 ];\n\t\t#else\n\t\t\tuniform float morphTargetInfluences[ 4 ];\n\t\t#endif\n\t#endif\n#endif",morphtarget_vertex:"#ifdef USE_MORPHTARGETS\n\ttransformed *= morphTargetBaseInfluence;\n\t#ifdef MORPHTARGETS_TEXTURE\n\t\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];\n\t\t}\n\t#else\n\t\ttransformed += morphTarget0 * morphTargetInfluences[ 0 ];\n\t\ttransformed += morphTarget1 * morphTargetInfluences[ 1 ];\n\t\ttransformed += morphTarget2 * morphTargetInfluences[ 2 ];\n\t\ttransformed += morphTarget3 * morphTargetInfluences[ 3 ];\n\t\t#ifndef USE_MORPHNORMALS\n\t\t\ttransformed += morphTarget4 * morphTargetInfluences[ 4 ];\n\t\t\ttransformed += morphTarget5 * morphTargetInfluences[ 5 ];\n\t\t\ttransformed += morphTarget6 * morphTargetInfluences[ 6 ];\n\t\t\ttransformed += morphTarget7 * morphTargetInfluences[ 7 ];\n\t\t#endif\n\t#endif\n#endif",normal_fragment_begin:"float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;\n#ifdef FLAT_SHADED\n\tvec3 fdx = dFdx( vViewPosition );\n\tvec3 fdy = dFdy( vViewPosition );\n\tvec3 normal = normalize( cross( fdx, fdy ) );\n#else\n\tvec3 normal = normalize( vNormal );\n\t#ifdef DOUBLE_SIDED\n\t\tnormal *= faceDirection;\n\t#endif\n#endif\n#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY )\n\t#ifdef USE_TANGENT\n\t\tmat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\n\t#else\n\t\tmat3 tbn = getTangentFrame( - vViewPosition, normal,\n\t\t#if defined( USE_NORMALMAP )\n\t\t\tvNormalMapUv\n\t\t#elif defined( USE_CLEARCOAT_NORMALMAP )\n\t\t\tvClearcoatNormalMapUv\n\t\t#else\n\t\t\tvUv\n\t\t#endif\n\t\t);\n\t#endif\n\t#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )\n\t\ttbn[0] *= faceDirection;\n\t\ttbn[1] *= faceDirection;\n\t#endif\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\t#ifdef USE_TANGENT\n\t\tmat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\n\t#else\n\t\tmat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv );\n\t#endif\n\t#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )\n\t\ttbn2[0] *= faceDirection;\n\t\ttbn2[1] *= faceDirection;\n\t#endif\n#endif\nvec3 geometryNormal = normal;",normal_fragment_maps:"#ifdef USE_NORMALMAP_OBJECTSPACE\n\tnormal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;\n\t#ifdef FLIP_SIDED\n\t\tnormal = - normal;\n\t#endif\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * faceDirection;\n\t#endif\n\tnormal = normalize( normalMatrix * normal );\n#elif defined( USE_NORMALMAP_TANGENTSPACE )\n\tvec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;\n\tmapN.xy *= normalScale;\n\tnormal = normalize( tbn * mapN );\n#elif defined( USE_BUMPMAP )\n\tnormal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );\n#endif",normal_pars_fragment:"#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif",normal_pars_vertex:"#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif",normal_vertex:"#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n\t#ifdef USE_TANGENT\n\t\tvTangent = normalize( transformedTangent );\n\t\tvBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\n\t#endif\n#endif",normalmap_pars_fragment:"#ifdef USE_NORMALMAP\n\tuniform sampler2D normalMap;\n\tuniform vec2 normalScale;\n#endif\n#ifdef USE_NORMALMAP_OBJECTSPACE\n\tuniform mat3 normalMatrix;\n#endif\n#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) )\n\tmat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) {\n\t\tvec3 q0 = dFdx( eye_pos.xyz );\n\t\tvec3 q1 = dFdy( eye_pos.xyz );\n\t\tvec2 st0 = dFdx( uv.st );\n\t\tvec2 st1 = dFdy( uv.st );\n\t\tvec3 N = surf_norm;\n\t\tvec3 q1perp = cross( q1, N );\n\t\tvec3 q0perp = cross( N, q0 );\n\t\tvec3 T = q1perp * st0.x + q0perp * st1.x;\n\t\tvec3 B = q1perp * st0.y + q0perp * st1.y;\n\t\tfloat det = max( dot( T, T ), dot( B, B ) );\n\t\tfloat scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det );\n\t\treturn mat3( T * scale, B * scale, N );\n\t}\n#endif",clearcoat_normal_fragment_begin:"#ifdef USE_CLEARCOAT\n\tvec3 clearcoatNormal = geometryNormal;\n#endif",clearcoat_normal_fragment_maps:"#ifdef USE_CLEARCOAT_NORMALMAP\n\tvec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;\n\tclearcoatMapN.xy *= clearcoatNormalScale;\n\tclearcoatNormal = normalize( tbn2 * clearcoatMapN );\n#endif",clearcoat_pars_fragment:"#ifdef USE_CLEARCOATMAP\n\tuniform sampler2D clearcoatMap;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tuniform sampler2D clearcoatNormalMap;\n\tuniform vec2 clearcoatNormalScale;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tuniform sampler2D clearcoatRoughnessMap;\n#endif",iridescence_pars_fragment:"#ifdef USE_IRIDESCENCEMAP\n\tuniform sampler2D iridescenceMap;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tuniform sampler2D iridescenceThicknessMap;\n#endif",opaque_fragment:"#ifdef OPAQUE\ndiffuseColor.a = 1.0;\n#endif\n#ifdef USE_TRANSMISSION\ndiffuseColor.a *= material.transmissionAlpha;\n#endif\ngl_FragColor = vec4( outgoingLight, diffuseColor.a );",packing:"vec3 packNormalToRGB( const in vec3 normal ) {\n\treturn normalize( normal ) * 0.5 + 0.5;\n}\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\n\treturn 2.0 * rgb.xyz - 1.0;\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}\nvec2 packDepthToRG( in highp float v ) {\n\treturn packDepthToRGBA( v ).yx;\n}\nfloat unpackRGToDepth( const in highp vec2 v ) {\n\treturn unpackRGBAToDepth( vec4( v.xy, 0.0, 0.0 ) );\n}\nvec4 pack2HalfToRGBA( vec2 v ) {\n\tvec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) );\n\treturn vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w );\n}\nvec2 unpackRGBATo2Half( vec4 v ) {\n\treturn vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );\n}\nfloat viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( viewZ + near ) / ( near - far );\n}\nfloat orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) {\n\treturn depth * ( near - far ) - near;\n}\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ );\n}\nfloat perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) {\n\treturn ( near * far ) / ( ( far - near ) * depth - far );\n}",premultiplied_alpha_fragment:"#ifdef PREMULTIPLIED_ALPHA\n\tgl_FragColor.rgb *= gl_FragColor.a;\n#endif",project_vertex:"vec4 mvPosition = vec4( transformed, 1.0 );\n#ifdef USE_INSTANCING\n\tmvPosition = instanceMatrix * mvPosition;\n#endif\nmvPosition = modelViewMatrix * mvPosition;\ngl_Position = projectionMatrix * mvPosition;",dithering_fragment:"#ifdef DITHERING\n\tgl_FragColor.rgb = dithering( gl_FragColor.rgb );\n#endif",dithering_pars_fragment:"#ifdef DITHERING\n\tvec3 dithering( vec3 color ) {\n\t\tfloat grid_position = rand( gl_FragCoord.xy );\n\t\tvec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );\n\t\tdither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );\n\t\treturn color + dither_shift_RGB;\n\t}\n#endif",roughnessmap_fragment:"float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n\tvec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );\n\troughnessFactor *= texelRoughness.g;\n#endif",roughnessmap_pars_fragment:"#ifdef USE_ROUGHNESSMAP\n\tuniform sampler2D roughnessMap;\n#endif",shadowmap_pars_fragment:"#if NUM_SPOT_LIGHT_COORDS > 0\n\tvarying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#if NUM_SPOT_LIGHT_MAPS > 0\n\tuniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ];\n#endif\n#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n\tfloat texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n\t\treturn step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\n\t}\n\tvec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {\n\t\treturn unpackRGBATo2Half( texture2D( shadow, uv ) );\n\t}\n\tfloat VSMShadow (sampler2D shadow, vec2 uv, float compare ){\n\t\tfloat occlusion = 1.0;\n\t\tvec2 distribution = texture2DDistribution( shadow, uv );\n\t\tfloat hard_shadow = step( compare , distribution.x );\n\t\tif (hard_shadow != 1.0 ) {\n\t\t\tfloat distance = compare - distribution.x ;\n\t\t\tfloat variance = max( 0.00000, distribution.y * distribution.y );\n\t\t\tfloat softness_probability = variance / (variance + distance * distance );\t\t\tsoftness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 );\t\t\tocclusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 );\n\t\t}\n\t\treturn occlusion;\n\t}\n\tfloat getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\t\tfloat shadow = 1.0;\n\t\tshadowCoord.xyz /= shadowCoord.w;\n\t\tshadowCoord.z += shadowBias;\n\t\tbool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;\n\t\tbool frustumTest = inFrustum && shadowCoord.z <= 1.0;\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\tfloat dx2 = dx0 / 2.0;\n\t\t\tfloat dy2 = dy0 / 2.0;\n\t\t\tfloat dx3 = dx1 / 2.0;\n\t\t\tfloat dy3 = dy1 / 2.0;\n\t\t\tshadow = (\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( dx2, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), 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( dx2, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), 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 / 17.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx = texelSize.x;\n\t\t\tfloat dy = texelSize.y;\n\t\t\tvec2 uv = shadowCoord.xy;\n\t\t\tvec2 f = fract( uv * shadowMapSize + 0.5 );\n\t\t\tuv -= f * texelSize;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, uv, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t\t f.x ),\n\t\t\t\t\t mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t\t f.x ),\n\t\t\t\t\t f.y )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_VSM )\n\t\t\tshadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#else\n\t\t\tshadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#endif\n\t\t}\n\t\treturn shadow;\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, float shadowCameraNear, float shadowCameraFar ) {\n\t\tvec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\n\t\tvec3 lightToPosition = shadowCoord.xyz;\n\t\tfloat dp = ( length( lightToPosition ) - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear );\t\tdp += shadowBias;\n\t\tvec3 bd3D = normalize( lightToPosition );\n\t\t#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )\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",shadowmap_pars_vertex:"#if NUM_SPOT_LIGHT_COORDS > 0\n\tuniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];\n\tvarying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n#endif",shadowmap_vertex:"#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )\n\tvec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\tvec4 shadowWorldPosition;\n#endif\n#if defined( USE_SHADOWMAP )\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );\n\t\t\tvDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );\n\t\t\tvPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n#endif\n#if NUM_SPOT_LIGHT_COORDS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) {\n\t\tshadowWorldPosition = worldPosition;\n\t\t#if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\t\tshadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias;\n\t\t#endif\n\t\tvSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;\n\t}\n\t#pragma unroll_loop_end\n#endif",shadowmask_pars_fragment:"float getShadowMask() {\n\tfloat shadow = 1.0;\n\t#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\tdirectionalLight = directionalLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n\t\tspotLight = spotLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\tpointLight = pointLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#endif\n\treturn shadow;\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\tuniform highp sampler2D boneTexture;\n\tuniform int boneTextureSize;\n\tmat4 getBoneMatrix( const in float i ) {\n\t\tfloat j = i * 4.0;\n\t\tfloat x = mod( j, float( boneTextureSize ) );\n\t\tfloat y = floor( j / float( boneTextureSize ) );\n\t\tfloat dx = 1.0 / float( boneTextureSize );\n\t\tfloat dy = 1.0 / float( boneTextureSize );\n\t\ty = dy * ( y + 0.5 );\n\t\tvec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );\n\t\tvec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );\n\t\tvec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );\n\t\tvec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );\n\t\tmat4 bone = mat4( v1, v2, v3, v4 );\n\t\treturn bone;\n\t}\n#endif",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\ttransformed = ( bindMatrixInverse * skinned ).xyz;\n#endif",skinnormal_vertex:"#ifdef USE_SKINNING\n\tmat4 skinMatrix = mat4( 0.0 );\n\tskinMatrix += skinWeight.x * boneMatX;\n\tskinMatrix += skinWeight.y * boneMatY;\n\tskinMatrix += skinWeight.z * boneMatZ;\n\tskinMatrix += skinWeight.w * boneMatW;\n\tskinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;\n\tobjectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n\t#ifdef USE_TANGENT\n\t\tobjectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n\t#endif\n#endif",specularmap_fragment:"float specularStrength;\n#ifdef USE_SPECULARMAP\n\tvec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );\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\tgl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif",tonemapping_pars_fragment:"#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\nuniform float toneMappingExposure;\nvec3 LinearToneMapping( vec3 color ) {\n\treturn saturate( toneMappingExposure * color );\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( color / ( vec3( 1.0 ) + color ) );\n}\nvec3 OptimizedCineonToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\tcolor = max( vec3( 0.0 ), color - 0.004 );\n\treturn pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\nvec3 RRTAndODTFit( vec3 v ) {\n\tvec3 a = v * ( v + 0.0245786 ) - 0.000090537;\n\tvec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;\n\treturn a / b;\n}\nvec3 ACESFilmicToneMapping( vec3 color ) {\n\tconst mat3 ACESInputMat = mat3(\n\t\tvec3( 0.59719, 0.07600, 0.02840 ),\t\tvec3( 0.35458, 0.90834, 0.13383 ),\n\t\tvec3( 0.04823, 0.01566, 0.83777 )\n\t);\n\tconst mat3 ACESOutputMat = mat3(\n\t\tvec3( 1.60475, -0.10208, -0.00327 ),\t\tvec3( -0.53108, 1.10813, -0.07276 ),\n\t\tvec3( -0.07367, -0.00605, 1.07602 )\n\t);\n\tcolor *= toneMappingExposure / 0.6;\n\tcolor = ACESInputMat * color;\n\tcolor = RRTAndODTFit( color );\n\tcolor = ACESOutputMat * color;\n\treturn saturate( color );\n}\nvec3 CustomToneMapping( vec3 color ) { return color; }",transmission_fragment:"#ifdef USE_TRANSMISSION\n\tmaterial.transmission = transmission;\n\tmaterial.transmissionAlpha = 1.0;\n\tmaterial.thickness = thickness;\n\tmaterial.attenuationDistance = attenuationDistance;\n\tmaterial.attenuationColor = attenuationColor;\n\t#ifdef USE_TRANSMISSIONMAP\n\t\tmaterial.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r;\n\t#endif\n\t#ifdef USE_THICKNESSMAP\n\t\tmaterial.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g;\n\t#endif\n\tvec3 pos = vWorldPosition;\n\tvec3 v = normalize( cameraPosition - pos );\n\tvec3 n = inverseTransformDirection( normal, viewMatrix );\n\tvec4 transmitted = getIBLVolumeRefraction(\n\t\tn, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90,\n\t\tpos, modelMatrix, viewMatrix, projectionMatrix, material.ior, material.thickness,\n\t\tmaterial.attenuationColor, material.attenuationDistance );\n\tmaterial.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission );\n\ttotalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission );\n#endif",transmission_pars_fragment:"#ifdef USE_TRANSMISSION\n\tuniform float transmission;\n\tuniform float thickness;\n\tuniform float attenuationDistance;\n\tuniform vec3 attenuationColor;\n\t#ifdef USE_TRANSMISSIONMAP\n\t\tuniform sampler2D transmissionMap;\n\t#endif\n\t#ifdef USE_THICKNESSMAP\n\t\tuniform sampler2D thicknessMap;\n\t#endif\n\tuniform vec2 transmissionSamplerSize;\n\tuniform sampler2D transmissionSamplerMap;\n\tuniform mat4 modelMatrix;\n\tuniform mat4 projectionMatrix;\n\tvarying vec3 vWorldPosition;\n\tfloat w0( float a ) {\n\t\treturn ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 );\n\t}\n\tfloat w1( float a ) {\n\t\treturn ( 1.0 / 6.0 ) * ( a * a * ( 3.0 * a - 6.0 ) + 4.0 );\n\t}\n\tfloat w2( float a ){\n\t\treturn ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 );\n\t}\n\tfloat w3( float a ) {\n\t\treturn ( 1.0 / 6.0 ) * ( a * a * a );\n\t}\n\tfloat g0( float a ) {\n\t\treturn w0( a ) + w1( a );\n\t}\n\tfloat g1( float a ) {\n\t\treturn w2( a ) + w3( a );\n\t}\n\tfloat h0( float a ) {\n\t\treturn - 1.0 + w1( a ) / ( w0( a ) + w1( a ) );\n\t}\n\tfloat h1( float a ) {\n\t\treturn 1.0 + w3( a ) / ( w2( a ) + w3( a ) );\n\t}\n\tvec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) {\n\t\tuv = uv * texelSize.zw + 0.5;\n\t\tvec2 iuv = floor( uv );\n\t\tvec2 fuv = fract( uv );\n\t\tfloat g0x = g0( fuv.x );\n\t\tfloat g1x = g1( fuv.x );\n\t\tfloat h0x = h0( fuv.x );\n\t\tfloat h1x = h1( fuv.x );\n\t\tfloat h0y = h0( fuv.y );\n\t\tfloat h1y = h1( fuv.y );\n\t\tvec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\n\t\tvec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\n\t\tvec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\n\t\tvec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\n\t\treturn g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) +\n\t\t\tg1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) );\n\t}\n\tvec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) {\n\t\tvec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) );\n\t\tvec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) );\n\t\tvec2 fLodSizeInv = 1.0 / fLodSize;\n\t\tvec2 cLodSizeInv = 1.0 / cLodSize;\n\t\tvec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) );\n\t\tvec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) );\n\t\treturn mix( fSample, cSample, fract( lod ) );\n\t}\n\tvec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {\n\t\tvec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );\n\t\tvec3 modelScale;\n\t\tmodelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );\n\t\tmodelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );\n\t\tmodelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );\n\t\treturn normalize( refractionVector ) * thickness * modelScale;\n\t}\n\tfloat applyIorToRoughness( const in float roughness, const in float ior ) {\n\t\treturn roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );\n\t}\n\tvec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {\n\t\tfloat lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );\n\t\treturn textureBicubic( transmissionSamplerMap, fragCoord.xy, lod );\n\t}\n\tvec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {\n\t\tif ( isinf( attenuationDistance ) ) {\n\t\t\treturn vec3( 1.0 );\n\t\t} else {\n\t\t\tvec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;\n\t\t\tvec3 transmittance = exp( - attenuationCoefficient * transmissionDistance );\t\t\treturn transmittance;\n\t\t}\n\t}\n\tvec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,\n\t\tconst in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,\n\t\tconst in mat4 viewMatrix, const in mat4 projMatrix, const in float ior, const in float thickness,\n\t\tconst in vec3 attenuationColor, const in float attenuationDistance ) {\n\t\tvec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );\n\t\tvec3 refractedRayExit = position + transmissionRay;\n\t\tvec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\n\t\tvec2 refractionCoords = ndcPos.xy / ndcPos.w;\n\t\trefractionCoords += 1.0;\n\t\trefractionCoords /= 2.0;\n\t\tvec4 transmittedLight = getTransmissionSample( refractionCoords, roughness, ior );\n\t\tvec3 transmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance );\n\t\tvec3 attenuatedColor = transmittance * transmittedLight.rgb;\n\t\tvec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );\n\t\tfloat transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0;\n\t\treturn vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor );\n\t}\n#endif",uv_pars_fragment:"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n\tvarying vec2 vUv;\n#endif\n#ifdef USE_MAP\n\tvarying vec2 vMapUv;\n#endif\n#ifdef USE_ALPHAMAP\n\tvarying vec2 vAlphaMapUv;\n#endif\n#ifdef USE_LIGHTMAP\n\tvarying vec2 vLightMapUv;\n#endif\n#ifdef USE_AOMAP\n\tvarying vec2 vAoMapUv;\n#endif\n#ifdef USE_BUMPMAP\n\tvarying vec2 vBumpMapUv;\n#endif\n#ifdef USE_NORMALMAP\n\tvarying vec2 vNormalMapUv;\n#endif\n#ifdef USE_EMISSIVEMAP\n\tvarying vec2 vEmissiveMapUv;\n#endif\n#ifdef USE_METALNESSMAP\n\tvarying vec2 vMetalnessMapUv;\n#endif\n#ifdef USE_ROUGHNESSMAP\n\tvarying vec2 vRoughnessMapUv;\n#endif\n#ifdef USE_ANISOTROPYMAP\n\tvarying vec2 vAnisotropyMapUv;\n#endif\n#ifdef USE_CLEARCOATMAP\n\tvarying vec2 vClearcoatMapUv;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tvarying vec2 vClearcoatNormalMapUv;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tvarying vec2 vClearcoatRoughnessMapUv;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n\tvarying vec2 vIridescenceMapUv;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tvarying vec2 vIridescenceThicknessMapUv;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n\tvarying vec2 vSheenColorMapUv;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n\tvarying vec2 vSheenRoughnessMapUv;\n#endif\n#ifdef USE_SPECULARMAP\n\tvarying vec2 vSpecularMapUv;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n\tvarying vec2 vSpecularColorMapUv;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n\tvarying vec2 vSpecularIntensityMapUv;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n\tuniform mat3 transmissionMapTransform;\n\tvarying vec2 vTransmissionMapUv;\n#endif\n#ifdef USE_THICKNESSMAP\n\tuniform mat3 thicknessMapTransform;\n\tvarying vec2 vThicknessMapUv;\n#endif",uv_pars_vertex:"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n\tvarying vec2 vUv;\n#endif\n#ifdef USE_MAP\n\tuniform mat3 mapTransform;\n\tvarying vec2 vMapUv;\n#endif\n#ifdef USE_ALPHAMAP\n\tuniform mat3 alphaMapTransform;\n\tvarying vec2 vAlphaMapUv;\n#endif\n#ifdef USE_LIGHTMAP\n\tuniform mat3 lightMapTransform;\n\tvarying vec2 vLightMapUv;\n#endif\n#ifdef USE_AOMAP\n\tuniform mat3 aoMapTransform;\n\tvarying vec2 vAoMapUv;\n#endif\n#ifdef USE_BUMPMAP\n\tuniform mat3 bumpMapTransform;\n\tvarying vec2 vBumpMapUv;\n#endif\n#ifdef USE_NORMALMAP\n\tuniform mat3 normalMapTransform;\n\tvarying vec2 vNormalMapUv;\n#endif\n#ifdef USE_DISPLACEMENTMAP\n\tuniform mat3 displacementMapTransform;\n\tvarying vec2 vDisplacementMapUv;\n#endif\n#ifdef USE_EMISSIVEMAP\n\tuniform mat3 emissiveMapTransform;\n\tvarying vec2 vEmissiveMapUv;\n#endif\n#ifdef USE_METALNESSMAP\n\tuniform mat3 metalnessMapTransform;\n\tvarying vec2 vMetalnessMapUv;\n#endif\n#ifdef USE_ROUGHNESSMAP\n\tuniform mat3 roughnessMapTransform;\n\tvarying vec2 vRoughnessMapUv;\n#endif\n#ifdef USE_ANISOTROPYMAP\n\tuniform mat3 anisotropyMapTransform;\n\tvarying vec2 vAnisotropyMapUv;\n#endif\n#ifdef USE_CLEARCOATMAP\n\tuniform mat3 clearcoatMapTransform;\n\tvarying vec2 vClearcoatMapUv;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tuniform mat3 clearcoatNormalMapTransform;\n\tvarying vec2 vClearcoatNormalMapUv;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tuniform mat3 clearcoatRoughnessMapTransform;\n\tvarying vec2 vClearcoatRoughnessMapUv;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n\tuniform mat3 sheenColorMapTransform;\n\tvarying vec2 vSheenColorMapUv;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n\tuniform mat3 sheenRoughnessMapTransform;\n\tvarying vec2 vSheenRoughnessMapUv;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n\tuniform mat3 iridescenceMapTransform;\n\tvarying vec2 vIridescenceMapUv;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tuniform mat3 iridescenceThicknessMapTransform;\n\tvarying vec2 vIridescenceThicknessMapUv;\n#endif\n#ifdef USE_SPECULARMAP\n\tuniform mat3 specularMapTransform;\n\tvarying vec2 vSpecularMapUv;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n\tuniform mat3 specularColorMapTransform;\n\tvarying vec2 vSpecularColorMapUv;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n\tuniform mat3 specularIntensityMapTransform;\n\tvarying vec2 vSpecularIntensityMapUv;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n\tuniform mat3 transmissionMapTransform;\n\tvarying vec2 vTransmissionMapUv;\n#endif\n#ifdef USE_THICKNESSMAP\n\tuniform mat3 thicknessMapTransform;\n\tvarying vec2 vThicknessMapUv;\n#endif",uv_vertex:"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n\tvUv = vec3( uv, 1 ).xy;\n#endif\n#ifdef USE_MAP\n\tvMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ALPHAMAP\n\tvAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_LIGHTMAP\n\tvLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_AOMAP\n\tvAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_BUMPMAP\n\tvBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_NORMALMAP\n\tvNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_DISPLACEMENTMAP\n\tvDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_EMISSIVEMAP\n\tvEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_METALNESSMAP\n\tvMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ROUGHNESSMAP\n\tvRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ANISOTROPYMAP\n\tvAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOATMAP\n\tvClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tvClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tvClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n\tvIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tvIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n\tvSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n\tvSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULARMAP\n\tvSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n\tvSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n\tvSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n\tvTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_THICKNESSMAP\n\tvThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy;\n#endif",worldpos_vertex:"#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0\n\tvec4 worldPosition = vec4( transformed, 1.0 );\n\t#ifdef USE_INSTANCING\n\t\tworldPosition = instanceMatrix * worldPosition;\n\t#endif\n\tworldPosition = modelMatrix * worldPosition;\n#endif",background_vert:"varying vec2 vUv;\nuniform mat3 uvTransform;\nvoid main() {\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n\tgl_Position = vec4( position.xy, 1.0, 1.0 );\n}",background_frag:"uniform sampler2D t2D;\nuniform float backgroundIntensity;\nvarying vec2 vUv;\nvoid main() {\n\tvec4 texColor = texture2D( t2D, vUv );\n\ttexColor.rgb *= backgroundIntensity;\n\tgl_FragColor = texColor;\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n}",backgroundCube_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\tgl_Position.z = gl_Position.w;\n}",backgroundCube_frag:"#ifdef ENVMAP_TYPE_CUBE\n\tuniform samplerCube envMap;\n#elif defined( ENVMAP_TYPE_CUBE_UV )\n\tuniform sampler2D envMap;\n#endif\nuniform float flipEnvMap;\nuniform float backgroundBlurriness;\nuniform float backgroundIntensity;\nvarying vec3 vWorldDirection;\n#include <cube_uv_reflection_fragment>\nvoid main() {\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 texColor = textureCube( envMap, vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) );\n\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\tvec4 texColor = textureCubeUV( envMap, vWorldDirection, backgroundBlurriness );\n\t#else\n\t\tvec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\t#endif\n\ttexColor.rgb *= backgroundIntensity;\n\tgl_FragColor = texColor;\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n}",cube_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\tgl_Position.z = gl_Position.w;\n}",cube_frag:"uniform samplerCube tCube;\nuniform float tFlip;\nuniform float opacity;\nvarying vec3 vWorldDirection;\nvoid main() {\n\tvec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) );\n\tgl_FragColor = texColor;\n\tgl_FragColor.a *= opacity;\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\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>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\t#include <uv_vertex>\n\t#include <skinbase_vertex>\n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvHighPrecisionZW = gl_Position.zw;\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 <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvarying vec2 vHighPrecisionZW;\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 <alphahash_fragment>\n\t#include <logdepthbuf_fragment>\n\tfloat fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;\n\t#if DEPTH_PACKING == 3200\n\t\tgl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );\n\t#elif DEPTH_PACKING == 3201\n\t\tgl_FragColor = packDepthToRGBA( fragCoordZ );\n\t#endif\n}",distanceRGBA_vert:"#define DISTANCE\nvarying vec3 vWorldPosition;\n#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <skinbase_vertex>\n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <worldpos_vertex>\n\t#include <clipping_planes_vertex>\n\tvWorldPosition = worldPosition.xyz;\n}",distanceRGBA_frag:"#define DISTANCE\nuniform vec3 referencePosition;\nuniform float nearDistance;\nuniform float farDistance;\nvarying vec3 vWorldPosition;\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main () {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\tfloat dist = length( vWorldPosition - referencePosition );\n\tdist = ( dist - nearDistance ) / ( farDistance - nearDistance );\n\tdist = saturate( dist );\n\tgl_FragColor = packDepthToRGBA( dist );\n}",equirect_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n}",equirect_frag:"uniform sampler2D tEquirect;\nvarying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvec3 direction = normalize( vWorldDirection );\n\tvec2 sampleUV = equirectUv( direction );\n\tgl_FragColor = texture2D( tEquirect, sampleUV );\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n}",linedashed_vert:"uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include <common>\n#include <uv_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\tvLineDistance = scale * lineDistance;\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphcolor_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\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 <uv_pars_fragment>\n#include <map_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 <map_fragment>\n\t#include <color_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n}",meshbasic_vert:"#include <common>\n#include <uv_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_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 <color_vertex>\n\t#include <morphcolor_vertex>\n\t#if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinbase_vertex>\n\t\t#include <skinnormal_vertex>\n\t\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 <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <fog_vertex>\n}",meshbasic_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <envmap_common_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 <alphahash_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\tvec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n\t\treflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI;\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 <envmap_fragment>\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshlambert_vert:"#define LAMBERT\nvarying vec3 vViewPosition;\n#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_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 <color_vertex>\n\t#include <morphcolor_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 <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_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\t#include <fog_vertex>\n}",meshlambert_frag:"#define LAMBERT\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_lambert_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 <alphahash_fragment>\n\t#include <specularmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_lambert_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include <envmap_fragment>\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshmatcap_vert:"#define MATCAP\nvarying vec3 vViewPosition;\n#include <common>\n#include <uv_pars_vertex>\n#include <color_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_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 <color_vertex>\n\t#include <morphcolor_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 <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n\tvViewPosition = - mvPosition.xyz;\n}",meshmatcap_frag:"#define MATCAP\nuniform vec3 diffuse;\nuniform float opacity;\nuniform sampler2D matcap;\nvarying vec3 vViewPosition;\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <fog_pars_fragment>\n#include <normal_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_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 <alphahash_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\tvec3 viewDir = normalize( vViewPosition );\n\tvec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );\n\tvec3 y = cross( viewDir, x );\n\tvec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;\n\t#ifdef USE_MATCAP\n\t\tvec4 matcapColor = texture2D( matcap, uv );\n\t#else\n\t\tvec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 );\n\t#endif\n\tvec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshnormal_vert:"#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n\tvarying vec3 vViewPosition;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <normal_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 <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 <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n}",meshnormal_frag:"#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n\tvarying vec3 vViewPosition;\n#endif\n#include <packing>\n#include <uv_pars_fragment>\n#include <normal_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\t#include <logdepthbuf_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\tgl_FragColor = vec4( packNormalToRGB( normal ), opacity );\n\t#ifdef OPAQUE\n\t\tgl_FragColor.a = 1.0;\n\t#endif\n}",meshphong_vert:"#define PHONG\nvarying vec3 vViewPosition;\n#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_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 <color_vertex>\n\t#include <morphcolor_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 <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_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\t#include <fog_vertex>\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 <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\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 <alphahash_fragment>\n\t#include <specularmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_phong_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\t#include <envmap_fragment>\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshphysical_vert:"#define STANDARD\nvarying vec3 vViewPosition;\n#ifdef USE_TRANSMISSION\n\tvarying vec3 vWorldPosition;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_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 <color_vertex>\n\t#include <morphcolor_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 <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_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\t#include <fog_vertex>\n#ifdef USE_TRANSMISSION\n\tvWorldPosition = worldPosition.xyz;\n#endif\n}",meshphysical_frag:"#define STANDARD\n#ifdef PHYSICAL\n\t#define IOR\n\t#define USE_SPECULAR\n#endif\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifdef IOR\n\tuniform float ior;\n#endif\n#ifdef USE_SPECULAR\n\tuniform float specularIntensity;\n\tuniform vec3 specularColor;\n\t#ifdef USE_SPECULAR_COLORMAP\n\t\tuniform sampler2D specularColorMap;\n\t#endif\n\t#ifdef USE_SPECULAR_INTENSITYMAP\n\t\tuniform sampler2D specularIntensityMap;\n\t#endif\n#endif\n#ifdef USE_CLEARCOAT\n\tuniform float clearcoat;\n\tuniform float clearcoatRoughness;\n#endif\n#ifdef USE_IRIDESCENCE\n\tuniform float iridescence;\n\tuniform float iridescenceIOR;\n\tuniform float iridescenceThicknessMinimum;\n\tuniform float iridescenceThicknessMaximum;\n#endif\n#ifdef USE_SHEEN\n\tuniform vec3 sheenColor;\n\tuniform float sheenRoughness;\n\t#ifdef USE_SHEEN_COLORMAP\n\t\tuniform sampler2D sheenColorMap;\n\t#endif\n\t#ifdef USE_SHEEN_ROUGHNESSMAP\n\t\tuniform sampler2D sheenRoughnessMap;\n\t#endif\n#endif\n#ifdef USE_ANISOTROPY\n\tuniform vec2 anisotropyVector;\n\t#ifdef USE_ANISOTROPYMAP\n\t\tuniform sampler2D anisotropyMap;\n\t#endif\n#endif\nvarying vec3 vViewPosition;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <iridescence_fragment>\n#include <cube_uv_reflection_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_physical_pars_fragment>\n#include <fog_pars_fragment>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_physical_pars_fragment>\n#include <transmission_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <clearcoat_pars_fragment>\n#include <iridescence_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 <alphahash_fragment>\n\t#include <roughnessmap_fragment>\n\t#include <metalnessmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <clearcoat_normal_fragment_begin>\n\t#include <clearcoat_normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_physical_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;\n\tvec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;\n\t#include <transmission_fragment>\n\tvec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;\n\t#ifdef USE_SHEEN\n\t\tfloat sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor );\n\t\toutgoingLight = outgoingLight * sheenEnergyComp + sheenSpecular;\n\t#endif\n\t#ifdef USE_CLEARCOAT\n\t\tfloat dotNVcc = saturate( dot( geometry.clearcoatNormal, geometry.viewDir ) );\n\t\tvec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );\n\t\toutgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + clearcoatSpecular * material.clearcoat;\n\t#endif\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshtoon_vert:"#define TOON\nvarying vec3 vViewPosition;\n#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_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 <color_vertex>\n\t#include <morphcolor_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 <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_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\t#include <fog_vertex>\n}",meshtoon_frag:"#define TOON\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <gradientmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_toon_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_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 <alphahash_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_toon_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",points_vert:"uniform float size;\nuniform float scale;\n#include <common>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\n#ifdef USE_POINTS_UV\n\tvarying vec2 vUv;\n\tuniform mat3 uvTransform;\n#endif\nvoid main() {\n\t#ifdef USE_POINTS_UV\n\t\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n\t#endif\n\t#include <color_vertex>\n\t#include <morphcolor_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <project_vertex>\n\tgl_PointSize = size;\n\t#ifdef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );\n\t#endif\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <fog_vertex>\n}",points_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <color_pars_fragment>\n#include <map_particle_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_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\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\t#include <alphahash_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n}",shadow_vert:"#include <common>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <shadowmap_pars_vertex>\nvoid main() {\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 <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",shadow_frag:"uniform vec3 color;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <logdepthbuf_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\nvoid main() {\n\t#include <logdepthbuf_fragment>\n\tgl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n}",sprite_vert:"uniform float rotation;\nuniform vec2 center;\n#include <common>\n#include <uv_pars_vertex>\n#include <fog_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\tvec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\n\tvec2 scale;\n\tscale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) );\n\tscale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) );\n\t#ifndef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) scale *= - mvPosition.z;\n\t#endif\n\tvec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;\n\tvec2 rotatedPosition;\n\trotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\n\trotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\n\tmvPosition.xy += rotatedPosition;\n\tgl_Position = projectionMatrix * mvPosition;\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n}",sprite_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_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\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n}"},Po={common:{diffuse:{value:new pa(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new gr},alphaMap:{value:null},alphaMapTransform:{value:new gr},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new gr}},envmap:{envMap:{value:null},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new gr}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new gr}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new gr},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new gr},normalScale:{value:new mr(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new gr},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new gr}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new gr}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new gr}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new pa(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new pa(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new gr},alphaTest:{value:0},uvTransform:{value:new gr}},sprite:{diffuse:{value:new pa(16777215)},opacity:{value:1},center:{value:new mr(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new gr},alphaMap:{value:null},alphaMapTransform:{value:new gr},alphaTest:{value:0}}},Io={basic:{uniforms:co([Po.common,Po.specularmap,Po.envmap,Po.aomap,Po.lightmap,Po.fog]),vertexShader:Lo.meshbasic_vert,fragmentShader:Lo.meshbasic_frag},lambert:{uniforms:co([Po.common,Po.specularmap,Po.envmap,Po.aomap,Po.lightmap,Po.emissivemap,Po.bumpmap,Po.normalmap,Po.displacementmap,Po.fog,Po.lights,{emissive:{value:new pa(0)}}]),vertexShader:Lo.meshlambert_vert,fragmentShader:Lo.meshlambert_frag},phong:{uniforms:co([Po.common,Po.specularmap,Po.envmap,Po.aomap,Po.lightmap,Po.emissivemap,Po.bumpmap,Po.normalmap,Po.displacementmap,Po.fog,Po.lights,{emissive:{value:new pa(0)},specular:{value:new pa(1118481)},shininess:{value:30}}]),vertexShader:Lo.meshphong_vert,fragmentShader:Lo.meshphong_frag},standard:{uniforms:co([Po.common,Po.envmap,Po.aomap,Po.lightmap,Po.emissivemap,Po.bumpmap,Po.normalmap,Po.displacementmap,Po.roughnessmap,Po.metalnessmap,Po.fog,Po.lights,{emissive:{value:new pa(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Lo.meshphysical_vert,fragmentShader:Lo.meshphysical_frag},toon:{uniforms:co([Po.common,Po.aomap,Po.lightmap,Po.emissivemap,Po.bumpmap,Po.normalmap,Po.displacementmap,Po.gradientmap,Po.fog,Po.lights,{emissive:{value:new pa(0)}}]),vertexShader:Lo.meshtoon_vert,fragmentShader:Lo.meshtoon_frag},matcap:{uniforms:co([Po.common,Po.bumpmap,Po.normalmap,Po.displacementmap,Po.fog,{matcap:{value:null}}]),vertexShader:Lo.meshmatcap_vert,fragmentShader:Lo.meshmatcap_frag},points:{uniforms:co([Po.points,Po.fog]),vertexShader:Lo.points_vert,fragmentShader:Lo.points_frag},dashed:{uniforms:co([Po.common,Po.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Lo.linedashed_vert,fragmentShader:Lo.linedashed_frag},depth:{uniforms:co([Po.common,Po.displacementmap]),vertexShader:Lo.depth_vert,fragmentShader:Lo.depth_frag},normal:{uniforms:co([Po.common,Po.bumpmap,Po.normalmap,Po.displacementmap,{opacity:{value:1}}]),vertexShader:Lo.meshnormal_vert,fragmentShader:Lo.meshnormal_frag},sprite:{uniforms:co([Po.sprite,Po.fog]),vertexShader:Lo.sprite_vert,fragmentShader:Lo.sprite_frag},background:{uniforms:{uvTransform:{value:new gr},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:Lo.background_vert,fragmentShader:Lo.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1}},vertexShader:Lo.backgroundCube_vert,fragmentShader:Lo.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:Lo.cube_vert,fragmentShader:Lo.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Lo.equirect_vert,fragmentShader:Lo.equirect_frag},distanceRGBA:{uniforms:co([Po.common,Po.displacementmap,{referencePosition:{value:new Yr},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Lo.distanceRGBA_vert,fragmentShader:Lo.distanceRGBA_frag},shadow:{uniforms:co([Po.lights,Po.fog,{color:{value:new pa(0)},opacity:{value:1}}]),vertexShader:Lo.shadow_vert,fragmentShader:Lo.shadow_frag}};Io.physical={uniforms:co([Io.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new gr},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new gr},clearcoatNormalScale:{value:new mr(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new gr},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new gr},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new gr},sheen:{value:0},sheenColor:{value:new pa(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new gr},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new gr},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new gr},transmissionSamplerSize:{value:new mr},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new gr},attenuationDistance:{value:0},attenuationColor:{value:new pa(0)},specularColor:{value:new pa(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new gr},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new gr},anisotropyVector:{value:new mr},anisotropyMap:{value:null},anisotropyMapTransform:{value:new gr}}]),vertexShader:Lo.meshphysical_vert,fragmentShader:Lo.meshphysical_frag};var Do={r:0,b:0,g:0};function Uo(e,t,n,r,i,a,o){var s,u,l=new pa(0),c=!0===a?0:1,h=null,d=0,f=null;function p(t,n){t.getRGB(Do,ho(e)),r.buffers.color.setClear(Do.r,Do.g,Do.b,n,o)}return{getClearColor:function(){return l},setClearColor:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;l.set(e),p(l,c=t)},getClearAlpha:function(){return c},setClearAlpha:function(e){p(l,c=e)},render:function(a,v){var m=!1,g=!0===v.isScene?v.background:null;switch(g&&g.isTexture&&(g=(v.backgroundBlurriness>0?n:t).get(g)),null===g?p(l,c):g&&g.isColor&&(p(g,1),m=!0),e.xr.getEnvironmentBlendMode()){case"opaque":m=!0;break;case"additive":r.buffers.color.setClear(0,0,0,1,o),m=!0;break;case"alpha-blend":r.buffers.color.setClear(0,0,0,0,o),m=!0}(e.autoClear||m)&&e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil),g&&(g.isCubeTexture||g.mapping===De)?(void 0===u&&((u=new oo(new uo(1,1,1),new po({name:"BackgroundCubeMaterial",uniforms:lo(Io.backgroundCube.uniforms),vertexShader:Io.backgroundCube.vertexShader,fragmentShader:Io.backgroundCube.fragmentShader,side:H,depthTest:!1,depthWrite:!1,fog:!1}))).geometry.deleteAttribute("normal"),u.geometry.deleteAttribute("uv"),u.onBeforeRender=function(e,t,n){this.matrixWorld.copyPosition(n.matrixWorld)},Object.defineProperty(u.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),i.update(u)),u.material.uniforms.envMap.value=g,u.material.uniforms.flipEnvMap.value=g.isCubeTexture&&!1===g.isRenderTargetTexture?-1:1,u.material.uniforms.backgroundBlurriness.value=v.backgroundBlurriness,u.material.uniforms.backgroundIntensity.value=v.backgroundIntensity,u.material.toneMapped=g.colorSpace!==pn,h===g&&d===g.version&&f===e.toneMapping||(u.material.needsUpdate=!0,h=g,d=g.version,f=e.toneMapping),u.layers.enableAll(),a.unshift(u,u.geometry,u.material,0,0,null)):g&&g.isTexture&&(void 0===s&&((s=new oo(new Co(2,2),new po({name:"BackgroundMaterial",uniforms:lo(Io.background.uniforms),vertexShader:Io.background.vertexShader,fragmentShader:Io.background.fragmentShader,side:z,depthTest:!1,depthWrite:!1,fog:!1}))).geometry.deleteAttribute("normal"),Object.defineProperty(s.material,"map",{get:function(){return this.uniforms.t2D.value}}),i.update(s)),s.material.uniforms.t2D.value=g,s.material.uniforms.backgroundIntensity.value=v.backgroundIntensity,s.material.toneMapped=g.colorSpace!==pn,!0===g.matrixAutoUpdate&&g.updateMatrix(),s.material.uniforms.uvTransform.value.copy(g.matrix),h===g&&d===g.version&&f===e.toneMapping||(s.material.needsUpdate=!0,h=g,d=g.version,f=e.toneMapping),s.layers.enableAll(),a.unshift(s,s.geometry,s.material,0,0,null))}}}function Oo(e,t,n,r){var i=e.getParameter(e.MAX_VERTEX_ATTRIBS),a=r.isWebGL2?null:t.get("OES_vertex_array_object"),o=r.isWebGL2||null!==a,s={},u=f(null),l=u,c=!1;function h(t){return r.isWebGL2?e.bindVertexArray(t):a.bindVertexArrayOES(t)}function d(t){return r.isWebGL2?e.deleteVertexArray(t):a.deleteVertexArrayOES(t)}function f(e){for(var t=[],n=[],r=[],a=0;a<i;a++)t[a]=0,n[a]=0,r[a]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:t,enabledAttributes:n,attributeDivisors:r,object:e,attributes:{},index:null}}function p(){for(var e=l.newAttributes,t=0,n=e.length;t<n;t++)e[t]=0}function v(e){m(e,0)}function m(n,i){var a=l.newAttributes,o=l.enabledAttributes,s=l.attributeDivisors;(a[n]=1,0===o[n]&&(e.enableVertexAttribArray(n),o[n]=1),s[n]!==i)&&((r.isWebGL2?e:t.get("ANGLE_instanced_arrays"))[r.isWebGL2?"vertexAttribDivisor":"vertexAttribDivisorANGLE"](n,i),s[n]=i)}function g(){for(var t=l.newAttributes,n=l.enabledAttributes,r=0,i=n.length;r<i;r++)n[r]!==t[r]&&(e.disableVertexAttribArray(r),n[r]=0)}function y(t,n,r,i,a,o,s){!0===s?e.vertexAttribIPointer(t,n,r,a,o):e.vertexAttribPointer(t,n,r,i,a,o)}function _(){x(),c=!0,l!==u&&h((l=u).object)}function x(){u.geometry=null,u.program=null,u.wireframe=!1}return{setup:function(i,u,d,_,x){var M=!1;if(o){var S=function(t,n,i){var o=!0===i.wireframe,u=s[t.id];void 0===u&&(u={},s[t.id]=u);var l=u[n.id];void 0===l&&(l={},u[n.id]=l);var c=l[o];void 0===c&&(c=f(r.isWebGL2?e.createVertexArray():a.createVertexArrayOES()),l[o]=c);return c}(_,d,u);l!==S&&h((l=S).object),M=function(e,t,n,r){var i=l.attributes,a=t.attributes,o=0,s=n.getAttributes();for(var u in s){if(s[u].location>=0){var c=i[u],h=a[u];if(void 0===h&&("instanceMatrix"===u&&e.instanceMatrix&&(h=e.instanceMatrix),"instanceColor"===u&&e.instanceColor&&(h=e.instanceColor)),void 0===c)return!0;if(c.attribute!==h)return!0;if(h&&c.data!==h.data)return!0;o++}}return l.attributesNum!==o||l.index!==r}(i,_,d,x),M&&function(e,t,n,r){var i={},a=t.attributes,o=0,s=n.getAttributes();for(var u in s){if(s[u].location>=0){var c=a[u];void 0===c&&("instanceMatrix"===u&&e.instanceMatrix&&(c=e.instanceMatrix),"instanceColor"===u&&e.instanceColor&&(c=e.instanceColor));var h={};h.attribute=c,c&&c.data&&(h.data=c.data),i[u]=h,o++}}l.attributes=i,l.attributesNum=o,l.index=r}(i,_,d,x)}else{var b=!0===u.wireframe;l.geometry===_.id&&l.program===d.id&&l.wireframe===b||(l.geometry=_.id,l.program=d.id,l.wireframe=b,M=!0)}null!==x&&n.update(x,e.ELEMENT_ARRAY_BUFFER),(M||c)&&(c=!1,function(i,a,o,s){if(!1===r.isWebGL2&&(i.isInstancedMesh||s.isInstancedBufferGeometry)&&null===t.get("ANGLE_instanced_arrays"))return;p();var u=s.attributes,l=o.getAttributes(),c=a.defaultAttributeValues;for(var h in l){var d=l[h];if(d.location>=0){var f=u[h];if(void 0===f&&("instanceMatrix"===h&&i.instanceMatrix&&(f=i.instanceMatrix),"instanceColor"===h&&i.instanceColor&&(f=i.instanceColor)),void 0!==f){var _=f.normalized,x=f.itemSize,M=n.get(f);if(void 0===M)continue;var S=M.buffer,b=M.type,w=M.bytesPerElement,T=!0===r.isWebGL2&&(b===e.INT||b===e.UNSIGNED_INT||f.gpuType===Qe);if(f.isInterleavedBufferAttribute){var E=f.data,A=E.stride,R=f.offset;if(E.isInstancedInterleavedBuffer){for(var k=0;k<d.locationSize;k++)m(d.location+k,E.meshPerAttribute);!0!==i.isInstancedMesh&&void 0===s._maxInstanceCount&&(s._maxInstanceCount=E.meshPerAttribute*E.count)}else for(var C=0;C<d.locationSize;C++)v(d.location+C);e.bindBuffer(e.ARRAY_BUFFER,S);for(var L=0;L<d.locationSize;L++)y(d.location+L,x/d.locationSize,b,_,A*w,(R+x/d.locationSize*L)*w,T)}else{if(f.isInstancedBufferAttribute){for(var P=0;P<d.locationSize;P++)m(d.location+P,f.meshPerAttribute);!0!==i.isInstancedMesh&&void 0===s._maxInstanceCount&&(s._maxInstanceCount=f.meshPerAttribute*f.count)}else for(var I=0;I<d.locationSize;I++)v(d.location+I);e.bindBuffer(e.ARRAY_BUFFER,S);for(var D=0;D<d.locationSize;D++)y(d.location+D,x/d.locationSize,b,_,x*w,x/d.locationSize*D*w,T)}}else if(void 0!==c){var U=c[h];if(void 0!==U)switch(U.length){case 2:e.vertexAttrib2fv(d.location,U);break;case 3:e.vertexAttrib3fv(d.location,U);break;case 4:e.vertexAttrib4fv(d.location,U);break;default:e.vertexAttrib1fv(d.location,U)}}}}g()}(i,u,d,_),null!==x&&e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,n.get(x).buffer))},reset:_,resetDefaultState:x,dispose:function(){for(var e in _(),s){var t=s[e];for(var n in t){var r=t[n];for(var i in r)d(r[i].object),delete r[i];delete t[n]}delete s[e]}},releaseStatesOfGeometry:function(e){if(void 0!==s[e.id]){var t=s[e.id];for(var n in t){var r=t[n];for(var i in r)d(r[i].object),delete r[i];delete t[n]}delete s[e.id]}},releaseStatesOfProgram:function(e){for(var t in s){var n=s[t];if(void 0!==n[e.id]){var r=n[e.id];for(var i in r)d(r[i].object),delete r[i];delete n[e.id]}}},initAttributes:p,enableAttribute:v,disableUnusedAttributes:g}}function No(e,t,n,r){var i,a=r.isWebGL2;this.setMode=function(e){i=e},this.render=function(t,r){e.drawArrays(i,t,r),n.update(r,i,1)},this.renderInstances=function(r,o,s){if(0!==s){var u,l;if(a)u=e,l="drawArraysInstanced";else if(l="drawArraysInstancedANGLE",null===(u=t.get("ANGLE_instanced_arrays")))return void console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");u[l](i,r,o,s),n.update(o,i,s)}}}function Fo(e,t,n){var r;function i(t){if("highp"===t){if(e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.HIGH_FLOAT).precision>0&&e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.HIGH_FLOAT).precision>0)return"highp";t="mediump"}return"mediump"===t&&e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.MEDIUM_FLOAT).precision>0&&e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}var a="undefined"!=typeof WebGL2RenderingContext&&"WebGL2RenderingContext"===e.constructor.name,o=void 0!==n.precision?n.precision:"highp",s=i(o);s!==o&&(console.warn("THREE.WebGLRenderer:",o,"not supported, using",s,"instead."),o=s);var u=a||t.has("WEBGL_draw_buffers"),l=!0===n.logarithmicDepthBuffer,c=e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS),h=e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS),d=e.getParameter(e.MAX_TEXTURE_SIZE),f=e.getParameter(e.MAX_CUBE_MAP_TEXTURE_SIZE),p=e.getParameter(e.MAX_VERTEX_ATTRIBS),v=e.getParameter(e.MAX_VERTEX_UNIFORM_VECTORS),m=e.getParameter(e.MAX_VARYING_VECTORS),g=e.getParameter(e.MAX_FRAGMENT_UNIFORM_VECTORS),y=h>0,_=a||t.has("OES_texture_float");return{isWebGL2:a,drawBuffers:u,getMaxAnisotropy:function(){if(void 0!==r)return r;if(!0===t.has("EXT_texture_filter_anisotropic")){var n=t.get("EXT_texture_filter_anisotropic");r=e.getParameter(n.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else r=0;return r},getMaxPrecision:i,precision:o,logarithmicDepthBuffer:l,maxTextures:c,maxVertexTextures:h,maxTextureSize:d,maxCubemapSize:f,maxAttributes:p,maxVertexUniforms:v,maxVaryings:m,maxFragmentUniforms:g,vertexTextures:y,floatFragmentTextures:_,floatVertexTextures:y&&_,maxSamples:a?e.getParameter(e.MAX_SAMPLES):0}}function Bo(e){var t=this,n=null,r=0,i=!1,a=!1,o=new wo,s=new gr,u={value:null,needsUpdate:!1};function l(e,n,r,i){var a=null!==e?e.length:0,l=null;if(0!==a){if(l=u.value,!0!==i||null===l){var c=r+4*a,h=n.matrixWorldInverse;s.getNormalMatrix(h),(null===l||l.length<c)&&(l=new Float32Array(c));for(var d=0,f=r;d!==a;++d,f+=4)o.copy(e[d]).applyMatrix4(h,s),o.normal.toArray(l,f),l[f+3]=o.constant}u.value=l,u.needsUpdate=!0}return t.numPlanes=a,t.numIntersection=0,l}this.uniform=u,this.numPlanes=0,this.numIntersection=0,this.init=function(e,t){var n=0!==e.length||t||0!==r||i;return i=t,r=e.length,n},this.beginShadows=function(){a=!0,l(null)},this.endShadows=function(){a=!1},this.setGlobalState=function(e,t){n=l(e,t,0)},this.setState=function(o,s,c){var h=o.clippingPlanes,d=o.clipIntersection,f=o.clipShadows,p=e.get(o);if(!i||null===h||0===h.length||a&&!f)a?l(null):function(){u.value!==n&&(u.value=n,u.needsUpdate=r>0);t.numPlanes=r,t.numIntersection=0}();else{var v=a?0:r,m=4*v,g=p.clippingState||null;u.value=g,g=l(h,s,m,c);for(var y=0;y!==m;++y)g[y]=n[y];p.clippingState=g,this.numIntersection=d?this.numPlanes:0,this.numPlanes+=v}}}function zo(e){var t=new WeakMap;function n(e,t){return t===Pe?e.mapping=Ce:t===Ie&&(e.mapping=Le),e}function r(e){var n=e.target;n.removeEventListener("dispose",r);var i=t.get(n);void 0!==i&&(t.delete(n),i.dispose())}return{get:function(i){if(i&&i.isTexture&&!1===i.isRenderTargetTexture){var a=i.mapping;if(a===Pe||a===Ie){if(t.has(i))return n(t.get(i).texture,i.mapping);var o=i.image;if(o&&o.height>0){var s=new xo(o.height/2);return s.fromEquirectangularTexture(e,i),t.set(i,s),i.addEventListener("dispose",r),n(s.texture,i.mapping)}return null}}return i},dispose:function(){t=new WeakMap}}}var Ho=function(e){w(n,e);var t=E(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:-1,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:-1,u=arguments.length>4&&void 0!==arguments[4]?arguments[4]:.1,l=arguments.length>5&&void 0!==arguments[5]?arguments[5]:2e3;return a(this,n),(e=t.call(this)).isOrthographicCamera=!0,e.type="OrthographicCamera",e.zoom=1,e.view=null,e.left=r,e.right=i,e.top=o,e.bottom=s,e.near=u,e.far=l,e.updateProjectionMatrix(),e}return s(n,[{key:"copy",value:function(e,t){return y(x(n.prototype),"copy",this).call(this,e,t),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=null===e.view?null:Object.assign({},e.view),this}},{key:"setViewOffset",value:function(e,t,n,r,i,a){null===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=r,this.view.width=i,this.view.height=a,this.updateProjectionMatrix()}},{key:"clearViewOffset",value:function(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}},{key:"updateProjectionMatrix",value:function(){var e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),n=(this.right+this.left)/2,r=(this.top+this.bottom)/2,i=n-e,a=n+e,o=r+t,s=r-t;if(null!==this.view&&this.view.enabled){var u=(this.right-this.left)/this.view.fullWidth/this.zoom,l=(this.top-this.bottom)/this.view.fullHeight/this.zoom;a=(i+=u*this.view.offsetX)+u*this.view.width,s=(o-=l*this.view.offsetY)-l*this.view.height}this.projectionMatrix.makeOrthographic(i,a,o,s,this.near,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}},{key:"toJSON",value:function(e){var t=y(x(n.prototype),"toJSON",this).call(this,e);return t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,null!==this.view&&(t.object.view=Object.assign({},this.view)),t}}]),n}(vo),Go=[.125,.215,.35,.446,.526,.582],Vo=20,Wo=new Ho,jo=new pa,Xo=null,qo=(1+Math.sqrt(5))/2,Yo=1/qo,Zo=[new Yr(1,1,1),new Yr(-1,1,1),new Yr(1,1,-1),new Yr(-1,1,-1),new Yr(0,qo,Yo),new Yr(0,qo,-Yo),new Yr(Yo,0,qo),new Yr(-Yo,0,qo),new Yr(qo,Yo,0),new Yr(-qo,Yo,0)],Ko=function(){function e(t){a(this,e),this._renderer=t,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._lodPlanes=[],this._sizeLods=[],this._sigmas=[],this._blurMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._compileMaterial(this._blurMaterial)}return s(e,[{key:"fromScene",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:.1,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:100;Xo=this._renderer.getRenderTarget(),this._setSize(256);var i=this._allocateTargets();return i.depthBuffer=!0,this._sceneToCubeUV(e,n,r,i),t>0&&this._blur(i,0,0,t),this._applyPMREM(i),this._cleanup(i),i}},{key:"fromEquirectangular",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return this._fromTexture(e,t)}},{key:"fromCubemap",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return this._fromTexture(e,t)}},{key:"compileCubemapShader",value:function(){null===this._cubemapMaterial&&(this._cubemapMaterial=es(),this._compileMaterial(this._cubemapMaterial))}},{key:"compileEquirectangularShader",value:function(){null===this._equirectMaterial&&(this._equirectMaterial=$o(),this._compileMaterial(this._equirectMaterial))}},{key:"dispose",value:function(){this._dispose(),null!==this._cubemapMaterial&&this._cubemapMaterial.dispose(),null!==this._equirectMaterial&&this._equirectMaterial.dispose()}},{key:"_setSize",value:function(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}},{key:"_dispose",value:function(){null!==this._blurMaterial&&this._blurMaterial.dispose(),null!==this._pingPongRenderTarget&&this._pingPongRenderTarget.dispose();for(var e=0;e<this._lodPlanes.length;e++)this._lodPlanes[e].dispose()}},{key:"_cleanup",value:function(e){this._renderer.setRenderTarget(Xo),e.scissorTest=!1,Qo(e,0,0,e.width,e.height)}},{key:"_fromTexture",value:function(e,t){e.mapping===Ce||e.mapping===Le?this._setSize(0===e.image.length?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4),Xo=this._renderer.getRenderTarget();var n=t||this._allocateTargets();return this._textureToCubeUV(e,n),this._applyPMREM(n),this._cleanup(n),n}},{key:"_allocateTargets",value:function(){var e=3*Math.max(this._cubeSize,112),t=4*this._cubeSize,n={magFilter:Ve,minFilter:Ve,generateMipmaps:!1,type:tt,format:ot,colorSpace:vn,depthBuffer:!1},r=Jo(e,t,n);if(null===this._pingPongRenderTarget||this._pingPongRenderTarget.width!==e||this._pingPongRenderTarget.height!==t){null!==this._pingPongRenderTarget&&this._dispose(),this._pingPongRenderTarget=Jo(e,t,n);var i=this._lodMax,a=function(e){for(var t=[],n=[],r=[],i=e,a=e-4+1+Go.length,o=0;o<a;o++){var s=Math.pow(2,i);n.push(s);var u=1/s;o>e-4?u=Go[o-e+4-1]:0===o&&(u=0),r.push(u);for(var l=1/(s-2),c=-l,h=1+l,d=[c,c,h,c,h,h,c,c,h,h,c,h],f=6,p=6,v=3,m=2,g=1,y=new Float32Array(v*p*f),_=new Float32Array(m*p*f),x=new Float32Array(g*p*f),M=0;M<f;M++){var S=M%3*2/3-1,b=M>2?0:-1,w=[S,b,0,S+2/3,b,0,S+2/3,b+1,0,S,b,0,S+2/3,b+1,0,S,b+1,0];y.set(w,v*p*M),_.set(d,m*p*M);var T=[M,M,M,M,M,M];x.set(T,g*p*M)}var E=new Ga;E.setAttribute("position",new wa(y,v)),E.setAttribute("uv",new wa(_,m)),E.setAttribute("faceIndex",new wa(x,g)),t.push(E),i>4&&i--}return{lodPlanes:t,sizeLods:n,sigmas:r}}(i);this._sizeLods=a.sizeLods,this._lodPlanes=a.lodPlanes,this._sigmas=a.sigmas,this._blurMaterial=function(e,t,n){var r=new Float32Array(Vo),i=new Yr(0,1,0),a=new po({name:"SphericalGaussianBlur",defines:{n:Vo,CUBEUV_TEXEL_WIDTH:1/t,CUBEUV_TEXEL_HEIGHT:1/n,CUBEUV_MAX_MIP:"".concat(e,".0")},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:r},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:i}},vertexShader:"\n\n\t\tprecision mediump float;\n\t\tprecision mediump int;\n\n\t\tattribute float faceIndex;\n\n\t\tvarying vec3 vOutputDirection;\n\n\t\t// RH coordinate system; PMREM face-indexing convention\n\t\tvec3 getDirection( vec2 uv, float face ) {\n\n\t\t\tuv = 2.0 * uv - 1.0;\n\n\t\t\tvec3 direction = vec3( uv, 1.0 );\n\n\t\t\tif ( face == 0.0 ) {\n\n\t\t\t\tdirection = direction.zyx; // ( 1, v, u ) pos x\n\n\t\t\t} else if ( face == 1.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xz *= -1.0; // ( -u, 1, -v ) pos y\n\n\t\t\t} else if ( face == 2.0 ) {\n\n\t\t\t\tdirection.x *= -1.0; // ( -u, v, 1 ) pos z\n\n\t\t\t} else if ( face == 3.0 ) {\n\n\t\t\t\tdirection = direction.zyx;\n\t\t\t\tdirection.xz *= -1.0; // ( -1, v, -u ) neg x\n\n\t\t\t} else if ( face == 4.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xy *= -1.0; // ( -u, -1, v ) neg y\n\n\t\t\t} else if ( face == 5.0 ) {\n\n\t\t\t\tdirection.z *= -1.0; // ( u, v, -1 ) neg z\n\n\t\t\t}\n\n\t\t\treturn direction;\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvOutputDirection = getDirection( uv, faceIndex );\n\t\t\tgl_Position = vec4( position, 1.0 );\n\n\t\t}\n\t",fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform sampler2D envMap;\n\t\t\tuniform int samples;\n\t\t\tuniform float weights[ n ];\n\t\t\tuniform bool latitudinal;\n\t\t\tuniform float dTheta;\n\t\t\tuniform float mipInt;\n\t\t\tuniform vec3 poleAxis;\n\n\t\t\t#define ENVMAP_TYPE_CUBE_UV\n\t\t\t#include <cube_uv_reflection_fragment>\n\n\t\t\tvec3 getSample( float theta, vec3 axis ) {\n\n\t\t\t\tfloat cosTheta = cos( theta );\n\t\t\t\t// Rodrigues' axis-angle rotation\n\t\t\t\tvec3 sampleDirection = vOutputDirection * cosTheta\n\t\t\t\t\t+ cross( axis, vOutputDirection ) * sin( theta )\n\t\t\t\t\t+ axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );\n\n\t\t\t\treturn bilinearCubeUV( envMap, sampleDirection, mipInt );\n\n\t\t\t}\n\n\t\t\tvoid main() {\n\n\t\t\t\tvec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );\n\n\t\t\t\tif ( all( equal( axis, vec3( 0.0 ) ) ) ) {\n\n\t\t\t\t\taxis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );\n\n\t\t\t\t}\n\n\t\t\t\taxis = normalize( axis );\n\n\t\t\t\tgl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\t\t\t\tgl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );\n\n\t\t\t\tfor ( int i = 1; i < n; i++ ) {\n\n\t\t\t\t\tif ( i >= samples ) {\n\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tfloat theta = dTheta * float( i );\n\t\t\t\t\tgl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );\n\t\t\t\t\tgl_FragColor.rgb += weights[ i ] * getSample( theta, axis );\n\n\t\t\t\t}\n\n\t\t\t}\n\t\t",blending:W,depthTest:!1,depthWrite:!1});return a}(i,e,t)}return r}},{key:"_compileMaterial",value:function(e){var t=new oo(this._lodPlanes[0],e);this._renderer.compile(t,Wo)}},{key:"_sceneToCubeUV",value:function(e,t,n,r){var i=new mo(90,1,t,n),a=[1,-1,1,1,1,1],o=[1,1,1,-1,-1,-1],s=this._renderer,u=s.autoClear,l=s.toneMapping;s.getClearColor(jo),s.toneMapping=be,s.autoClear=!1;var c=new ma({name:"PMREM.Background",side:H,depthWrite:!1,depthTest:!1}),h=new oo(new uo,c),d=!1,f=e.background;f?f.isColor&&(c.color.copy(f),e.background=null,d=!0):(c.color.copy(jo),d=!0);for(var p=0;p<6;p++){var v=p%3;0===v?(i.up.set(0,a[p],0),i.lookAt(o[p],0,0)):1===v?(i.up.set(0,0,a[p]),i.lookAt(0,o[p],0)):(i.up.set(0,a[p],0),i.lookAt(0,0,o[p]));var m=this._cubeSize;Qo(r,v*m,p>2?m:0,m,m),s.setRenderTarget(r),d&&s.render(h,i),s.render(e,i)}h.geometry.dispose(),h.material.dispose(),s.toneMapping=l,s.autoClear=u,e.background=f}},{key:"_textureToCubeUV",value:function(e,t){var n=this._renderer,r=e.mapping===Ce||e.mapping===Le;r?(null===this._cubemapMaterial&&(this._cubemapMaterial=es()),this._cubemapMaterial.uniforms.flipEnvMap.value=!1===e.isRenderTargetTexture?-1:1):null===this._equirectMaterial&&(this._equirectMaterial=$o());var i=r?this._cubemapMaterial:this._equirectMaterial,a=new oo(this._lodPlanes[0],i);i.uniforms.envMap.value=e;var o=this._cubeSize;Qo(t,0,0,3*o,2*o),n.setRenderTarget(t),n.render(a,Wo)}},{key:"_applyPMREM",value:function(e){var t=this._renderer,n=t.autoClear;t.autoClear=!1;for(var r=1;r<this._lodPlanes.length;r++){var i=Math.sqrt(this._sigmas[r]*this._sigmas[r]-this._sigmas[r-1]*this._sigmas[r-1]),a=Zo[(r-1)%Zo.length];this._blur(e,r-1,r,i,a)}t.autoClear=n}},{key:"_blur",value:function(e,t,n,r,i){var a=this._pingPongRenderTarget;this._halfBlur(e,a,t,n,r,"latitudinal",i),this._halfBlur(a,e,n,n,r,"longitudinal",i)}},{key:"_halfBlur",value:function(e,t,n,r,i,a,o){var s=this._renderer,u=this._blurMaterial;"latitudinal"!==a&&"longitudinal"!==a&&console.error("blur direction must be either latitudinal or longitudinal!");var l=new oo(this._lodPlanes[r],u),c=u.uniforms,h=this._sizeLods[n]-1,d=isFinite(i)?Math.PI/(2*h):2*Math.PI/39,f=i/d,p=isFinite(i)?1+Math.floor(3*f):Vo;p>Vo&&console.warn("sigmaRadians, ".concat(i,", is too large and will clip, as it requested ").concat(p," samples when the maximum is set to ").concat(Vo));for(var v=[],m=0,g=0;g<Vo;++g){var y=g/f,_=Math.exp(-y*y/2);v.push(_),0===g?m+=_:g<p&&(m+=2*_)}for(var x=0;x<v.length;x++)v[x]=v[x]/m;c.envMap.value=e.texture,c.samples.value=p,c.weights.value=v,c.latitudinal.value="latitudinal"===a,o&&(c.poleAxis.value=o);var M=this._lodMax;c.dTheta.value=d,c.mipInt.value=M-n;var S=this._sizeLods[r];Qo(t,3*S*(r>M-4?r-M+4:0),4*(this._cubeSize-S),3*S,2*S),s.setRenderTarget(t),s.render(l,Wo)}}]),e}();function Jo(e,t,n){var r=new Hr(e,t,n);return r.texture.mapping=De,r.texture.name="PMREM.cubeUv",r.scissorTest=!0,r}function Qo(e,t,n,r,i){e.viewport.set(t,n,r,i),e.scissor.set(t,n,r,i)}function $o(){return new po({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:"\n\n\t\tprecision mediump float;\n\t\tprecision mediump int;\n\n\t\tattribute float faceIndex;\n\n\t\tvarying vec3 vOutputDirection;\n\n\t\t// RH coordinate system; PMREM face-indexing convention\n\t\tvec3 getDirection( vec2 uv, float face ) {\n\n\t\t\tuv = 2.0 * uv - 1.0;\n\n\t\t\tvec3 direction = vec3( uv, 1.0 );\n\n\t\t\tif ( face == 0.0 ) {\n\n\t\t\t\tdirection = direction.zyx; // ( 1, v, u ) pos x\n\n\t\t\t} else if ( face == 1.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xz *= -1.0; // ( -u, 1, -v ) pos y\n\n\t\t\t} else if ( face == 2.0 ) {\n\n\t\t\t\tdirection.x *= -1.0; // ( -u, v, 1 ) pos z\n\n\t\t\t} else if ( face == 3.0 ) {\n\n\t\t\t\tdirection = direction.zyx;\n\t\t\t\tdirection.xz *= -1.0; // ( -1, v, -u ) neg x\n\n\t\t\t} else if ( face == 4.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xy *= -1.0; // ( -u, -1, v ) neg y\n\n\t\t\t} else if ( face == 5.0 ) {\n\n\t\t\t\tdirection.z *= -1.0; // ( u, v, -1 ) neg z\n\n\t\t\t}\n\n\t\t\treturn direction;\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvOutputDirection = getDirection( uv, faceIndex );\n\t\t\tgl_Position = vec4( position, 1.0 );\n\n\t\t}\n\t",fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform sampler2D envMap;\n\n\t\t\t#include <common>\n\n\t\t\tvoid main() {\n\n\t\t\t\tvec3 outputDirection = normalize( vOutputDirection );\n\t\t\t\tvec2 uv = equirectUv( outputDirection );\n\n\t\t\t\tgl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 );\n\n\t\t\t}\n\t\t",blending:W,depthTest:!1,depthWrite:!1})}function es(){return new po({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:"\n\n\t\tprecision mediump float;\n\t\tprecision mediump int;\n\n\t\tattribute float faceIndex;\n\n\t\tvarying vec3 vOutputDirection;\n\n\t\t// RH coordinate system; PMREM face-indexing convention\n\t\tvec3 getDirection( vec2 uv, float face ) {\n\n\t\t\tuv = 2.0 * uv - 1.0;\n\n\t\t\tvec3 direction = vec3( uv, 1.0 );\n\n\t\t\tif ( face == 0.0 ) {\n\n\t\t\t\tdirection = direction.zyx; // ( 1, v, u ) pos x\n\n\t\t\t} else if ( face == 1.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xz *= -1.0; // ( -u, 1, -v ) pos y\n\n\t\t\t} else if ( face == 2.0 ) {\n\n\t\t\t\tdirection.x *= -1.0; // ( -u, v, 1 ) pos z\n\n\t\t\t} else if ( face == 3.0 ) {\n\n\t\t\t\tdirection = direction.zyx;\n\t\t\t\tdirection.xz *= -1.0; // ( -1, v, -u ) neg x\n\n\t\t\t} else if ( face == 4.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xy *= -1.0; // ( -u, -1, v ) neg y\n\n\t\t\t} else if ( face == 5.0 ) {\n\n\t\t\t\tdirection.z *= -1.0; // ( u, v, -1 ) neg z\n\n\t\t\t}\n\n\t\t\treturn direction;\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvOutputDirection = getDirection( uv, faceIndex );\n\t\t\tgl_Position = vec4( position, 1.0 );\n\n\t\t}\n\t",fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tuniform float flipEnvMap;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform samplerCube envMap;\n\n\t\t\tvoid main() {\n\n\t\t\t\tgl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) );\n\n\t\t\t}\n\t\t",blending:W,depthTest:!1,depthWrite:!1})}function ts(e){var t=new WeakMap,n=null;function r(e){var n=e.target;n.removeEventListener("dispose",r);var i=t.get(n);void 0!==i&&(t.delete(n),i.dispose())}return{get:function(i){if(i&&i.isTexture){var a=i.mapping,o=a===Pe||a===Ie,s=a===Ce||a===Le;if(o||s){if(i.isRenderTargetTexture&&!0===i.needsPMREMUpdate){i.needsPMREMUpdate=!1;var u=t.get(i);return null===n&&(n=new Ko(e)),u=o?n.fromEquirectangular(i,u):n.fromCubemap(i,u),t.set(i,u),u.texture}if(t.has(i))return t.get(i).texture;var l=i.image;if(o&&l&&l.height>0||s&&l&&function(e){for(var t=0,n=6,r=0;r<n;r++)void 0!==e[r]&&t++;return t===n}(l)){null===n&&(n=new Ko(e));var c=o?n.fromEquirectangular(i):n.fromCubemap(i);return t.set(i,c),i.addEventListener("dispose",r),c.texture}return null}}return i},dispose:function(){t=new WeakMap,null!==n&&(n.dispose(),n=null)}}}function ns(e){var t={};function n(n){if(void 0!==t[n])return t[n];var r;switch(n){case"WEBGL_depth_texture":r=e.getExtension("WEBGL_depth_texture")||e.getExtension("MOZ_WEBGL_depth_texture")||e.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":r=e.getExtension("EXT_texture_filter_anisotropic")||e.getExtension("MOZ_EXT_texture_filter_anisotropic")||e.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":r=e.getExtension("WEBGL_compressed_texture_s3tc")||e.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||e.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":r=e.getExtension("WEBGL_compressed_texture_pvrtc")||e.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:r=e.getExtension(n)}return t[n]=r,r}return{has:function(e){return null!==n(e)},init:function(e){e.isWebGL2?n("EXT_color_buffer_float"):(n("WEBGL_depth_texture"),n("OES_texture_float"),n("OES_texture_half_float"),n("OES_texture_half_float_linear"),n("OES_standard_derivatives"),n("OES_element_index_uint"),n("OES_vertex_array_object"),n("ANGLE_instanced_arrays")),n("OES_texture_float_linear"),n("EXT_color_buffer_half_float"),n("WEBGL_multisampled_render_to_texture")},get:function(e){var t=n(e);return null===t&&console.warn("THREE.WebGLRenderer: "+e+" extension not supported."),t}}}function rs(e,t,n,r){var i={},a=new WeakMap;function o(e){var s=e.target;for(var u in null!==s.index&&t.remove(s.index),s.attributes)t.remove(s.attributes[u]);for(var l in s.morphAttributes)for(var c=s.morphAttributes[l],h=0,d=c.length;h<d;h++)t.remove(c[h]);s.removeEventListener("dispose",o),delete i[s.id];var f=a.get(s);f&&(t.remove(f),a.delete(s)),r.releaseStatesOfGeometry(s),!0===s.isInstancedBufferGeometry&&delete s._maxInstanceCount,n.memory.geometries--}function s(e){var n=[],r=e.index,i=e.attributes.position,o=0;if(null!==r){var s=r.array;o=r.version;for(var u=0,l=s.length;u<l;u+=3){var c=s[u+0],h=s[u+1],d=s[u+2];n.push(c,h,h,d,d,c)}}else{if(void 0===i)return;var f=i.array;o=i.version;for(var p=0,v=f.length/3-1;p<v;p+=3){var m=p+0,g=p+1,y=p+2;n.push(m,g,g,y,y,m)}}var _=new(_r(n)?La:ka)(n,1);_.version=o;var x=a.get(e);x&&t.remove(x),a.set(e,_)}return{get:function(e,t){return!0===i[t.id]||(t.addEventListener("dispose",o),i[t.id]=!0,n.memory.geometries++),t},update:function(n){var r=n.attributes;for(var i in r)t.update(r[i],e.ARRAY_BUFFER);var a=n.morphAttributes;for(var o in a)for(var s=a[o],u=0,l=s.length;u<l;u++)t.update(s[u],e.ARRAY_BUFFER)},getWireframeAttribute:function(e){var t=a.get(e);if(t){var n=e.index;null!==n&&t.version<n.version&&s(e)}else s(e);return a.get(e)}}}function is(e,t,n,r){var i,a,o,s=r.isWebGL2;this.setMode=function(e){i=e},this.setIndex=function(e){a=e.type,o=e.bytesPerElement},this.render=function(t,r){e.drawElements(i,r,a,t*o),n.update(r,i,1)},this.renderInstances=function(r,u,l){if(0!==l){var c,h;if(s)c=e,h="drawElementsInstanced";else if(h="drawElementsInstancedANGLE",null===(c=t.get("ANGLE_instanced_arrays")))return void console.error("THREE.WebGLIndexedBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");c[h](i,u,a,r*o,l),n.update(u,i,l)}}}function as(e){var t={frame:0,calls:0,triangles:0,points:0,lines:0};return{memory:{geometries:0,textures:0},render:t,programs:null,autoReset:!0,reset:function(){t.calls=0,t.triangles=0,t.points=0,t.lines=0},update:function(n,r,i){switch(t.calls++,r){case e.TRIANGLES:t.triangles+=i*(n/3);break;case e.LINES:t.lines+=i*(n/2);break;case e.LINE_STRIP:t.lines+=i*(n-1);break;case e.LINE_LOOP:t.lines+=i*n;break;case e.POINTS:t.points+=i*n;break;default:console.error("THREE.WebGLInfo: Unknown draw mode:",r)}}}}function os(e,t){return e[0]-t[0]}function ss(e,t){return Math.abs(t[1])-Math.abs(e[1])}function us(e,t,n){for(var r={},i=new Float32Array(8),a=new WeakMap,o=new Br,s=[],u=0;u<8;u++)s[u]=[u,0];return{update:function(u,l,c){var h=u.morphTargetInfluences;if(!0===t.isWebGL2){var d=l.morphAttributes.position||l.morphAttributes.normal||l.morphAttributes.color,f=void 0!==d?d.length:0,p=a.get(l);if(void 0===p||p.count!==f){void 0!==p&&p.texture.dispose();var v=void 0!==l.morphAttributes.position,m=void 0!==l.morphAttributes.normal,g=void 0!==l.morphAttributes.color,y=l.morphAttributes.position||[],_=l.morphAttributes.normal||[],x=l.morphAttributes.color||[],M=0;!0===v&&(M=1),!0===m&&(M=2),!0===g&&(M=3);var S=l.attributes.position.count*M,b=1;S>t.maxTextureSize&&(b=Math.ceil(S/t.maxTextureSize),S=t.maxTextureSize);var w=new Float32Array(S*b*4*f),T=new Gr(w,S,b,f);T.type=et,T.needsUpdate=!0;for(var E=4*M,A=0;A<f;A++)for(var R=y[A],k=_[A],C=x[A],L=S*b*4*A,P=0;P<R.count;P++){var I=P*E;!0===v&&(o.fromBufferAttribute(R,P),w[L+I+0]=o.x,w[L+I+1]=o.y,w[L+I+2]=o.z,w[L+I+3]=0),!0===m&&(o.fromBufferAttribute(k,P),w[L+I+4]=o.x,w[L+I+5]=o.y,w[L+I+6]=o.z,w[L+I+7]=0),!0===g&&(o.fromBufferAttribute(C,P),w[L+I+8]=o.x,w[L+I+9]=o.y,w[L+I+10]=o.z,w[L+I+11]=4===C.itemSize?o.w:1)}function J(){T.dispose(),a.delete(l),l.removeEventListener("dispose",J)}p={count:f,texture:T,size:new mr(S,b)},a.set(l,p),l.addEventListener("dispose",J)}for(var D=0,U=0;U<h.length;U++)D+=h[U];var O=l.morphTargetsRelative?1:1-D;c.getUniforms().setValue(e,"morphTargetBaseInfluence",O),c.getUniforms().setValue(e,"morphTargetInfluences",h),c.getUniforms().setValue(e,"morphTargetsTexture",p.texture,n),c.getUniforms().setValue(e,"morphTargetsTextureSize",p.size)}else{var N=void 0===h?0:h.length,F=r[l.id];if(void 0===F||F.length!==N){F=[];for(var B=0;B<N;B++)F[B]=[B,0];r[l.id]=F}for(var z=0;z<N;z++){var H=F[z];H[0]=z,H[1]=h[z]}F.sort(ss);for(var G=0;G<8;G++)G<N&&F[G][1]?(s[G][0]=F[G][0],s[G][1]=F[G][1]):(s[G][0]=Number.MAX_SAFE_INTEGER,s[G][1]=0);s.sort(os);for(var V=l.morphAttributes.position,W=l.morphAttributes.normal,j=0,X=0;X<8;X++){var q=s[X],Y=q[0],Z=q[1];Y!==Number.MAX_SAFE_INTEGER&&Z?(V&&l.getAttribute("morphTarget"+X)!==V[Y]&&l.setAttribute("morphTarget"+X,V[Y]),W&&l.getAttribute("morphNormal"+X)!==W[Y]&&l.setAttribute("morphNormal"+X,W[Y]),i[X]=Z,j+=Z):(V&&!0===l.hasAttribute("morphTarget"+X)&&l.deleteAttribute("morphTarget"+X),W&&!0===l.hasAttribute("morphNormal"+X)&&l.deleteAttribute("morphNormal"+X),i[X]=0)}var K=l.morphTargetsRelative?1:1-j;c.getUniforms().setValue(e,"morphTargetBaseInfluence",K),c.getUniforms().setValue(e,"morphTargetInfluences",i)}}}}function ls(e,t,n,r){var i=new WeakMap;function a(e){var t=e.target;t.removeEventListener("dispose",a),n.remove(t.instanceMatrix),null!==t.instanceColor&&n.remove(t.instanceColor)}return{update:function(o){var s=r.render.frame,u=o.geometry,l=t.get(o,u);if(i.get(l)!==s&&(t.update(l),i.set(l,s)),o.isInstancedMesh&&(!1===o.hasEventListener("dispose",a)&&o.addEventListener("dispose",a),i.get(o)!==s&&(n.update(o.instanceMatrix,e.ARRAY_BUFFER),null!==o.instanceColor&&n.update(o.instanceColor,e.ARRAY_BUFFER),i.set(o,s))),o.isSkinnedMesh){var c=o.skeleton;i.get(c)!==s&&(c.update(),i.set(c,s))}return l},dispose:function(){i=new WeakMap}}}var cs=new Fr,hs=new Gr,ds=new Wr,fs=new _o,ps=[],vs=[],ms=new Float32Array(16),gs=new Float32Array(9),ys=new Float32Array(4);function _s(e,t,n){var r=e[0];if(r<=0||r>0)return e;var i=t*n,a=ps[i];if(void 0===a&&(a=new Float32Array(i),ps[i]=a),0!==t){r.toArray(a,0);for(var o=1,s=0;o!==t;++o)s+=n,e[o].toArray(a,s)}return a}function xs(e,t){if(e.length!==t.length)return!1;for(var n=0,r=e.length;n<r;n++)if(e[n]!==t[n])return!1;return!0}function Ms(e,t){for(var n=0,r=t.length;n<r;n++)e[n]=t[n]}function Ss(e,t){var n=vs[t];void 0===n&&(n=new Int32Array(t),vs[t]=n);for(var r=0;r!==t;++r)n[r]=e.allocateTextureUnit();return n}function bs(e,t){var n=this.cache;n[0]!==t&&(e.uniform1f(this.addr,t),n[0]=t)}function ws(e,t){var n=this.cache;if(void 0!==t.x)n[0]===t.x&&n[1]===t.y||(e.uniform2f(this.addr,t.x,t.y),n[0]=t.x,n[1]=t.y);else{if(xs(n,t))return;e.uniform2fv(this.addr,t),Ms(n,t)}}function Ts(e,t){var n=this.cache;if(void 0!==t.x)n[0]===t.x&&n[1]===t.y&&n[2]===t.z||(e.uniform3f(this.addr,t.x,t.y,t.z),n[0]=t.x,n[1]=t.y,n[2]=t.z);else if(void 0!==t.r)n[0]===t.r&&n[1]===t.g&&n[2]===t.b||(e.uniform3f(this.addr,t.r,t.g,t.b),n[0]=t.r,n[1]=t.g,n[2]=t.b);else{if(xs(n,t))return;e.uniform3fv(this.addr,t),Ms(n,t)}}function Es(e,t){var n=this.cache;if(void 0!==t.x)n[0]===t.x&&n[1]===t.y&&n[2]===t.z&&n[3]===t.w||(e.uniform4f(this.addr,t.x,t.y,t.z,t.w),n[0]=t.x,n[1]=t.y,n[2]=t.z,n[3]=t.w);else{if(xs(n,t))return;e.uniform4fv(this.addr,t),Ms(n,t)}}function As(e,t){var n=this.cache,r=t.elements;if(void 0===r){if(xs(n,t))return;e.uniformMatrix2fv(this.addr,!1,t),Ms(n,t)}else{if(xs(n,r))return;ys.set(r),e.uniformMatrix2fv(this.addr,!1,ys),Ms(n,r)}}function Rs(e,t){var n=this.cache,r=t.elements;if(void 0===r){if(xs(n,t))return;e.uniformMatrix3fv(this.addr,!1,t),Ms(n,t)}else{if(xs(n,r))return;gs.set(r),e.uniformMatrix3fv(this.addr,!1,gs),Ms(n,r)}}function ks(e,t){var n=this.cache,r=t.elements;if(void 0===r){if(xs(n,t))return;e.uniformMatrix4fv(this.addr,!1,t),Ms(n,t)}else{if(xs(n,r))return;ms.set(r),e.uniformMatrix4fv(this.addr,!1,ms),Ms(n,r)}}function Cs(e,t){var n=this.cache;n[0]!==t&&(e.uniform1i(this.addr,t),n[0]=t)}function Ls(e,t){var n=this.cache;if(void 0!==t.x)n[0]===t.x&&n[1]===t.y||(e.uniform2i(this.addr,t.x,t.y),n[0]=t.x,n[1]=t.y);else{if(xs(n,t))return;e.uniform2iv(this.addr,t),Ms(n,t)}}function Ps(e,t){var n=this.cache;if(void 0!==t.x)n[0]===t.x&&n[1]===t.y&&n[2]===t.z||(e.uniform3i(this.addr,t.x,t.y,t.z),n[0]=t.x,n[1]=t.y,n[2]=t.z);else{if(xs(n,t))return;e.uniform3iv(this.addr,t),Ms(n,t)}}function Is(e,t){var n=this.cache;if(void 0!==t.x)n[0]===t.x&&n[1]===t.y&&n[2]===t.z&&n[3]===t.w||(e.uniform4i(this.addr,t.x,t.y,t.z,t.w),n[0]=t.x,n[1]=t.y,n[2]=t.z,n[3]=t.w);else{if(xs(n,t))return;e.uniform4iv(this.addr,t),Ms(n,t)}}function Ds(e,t){var n=this.cache;n[0]!==t&&(e.uniform1ui(this.addr,t),n[0]=t)}function Us(e,t){var n=this.cache;if(void 0!==t.x)n[0]===t.x&&n[1]===t.y||(e.uniform2ui(this.addr,t.x,t.y),n[0]=t.x,n[1]=t.y);else{if(xs(n,t))return;e.uniform2uiv(this.addr,t),Ms(n,t)}}function Os(e,t){var n=this.cache;if(void 0!==t.x)n[0]===t.x&&n[1]===t.y&&n[2]===t.z||(e.uniform3ui(this.addr,t.x,t.y,t.z),n[0]=t.x,n[1]=t.y,n[2]=t.z);else{if(xs(n,t))return;e.uniform3uiv(this.addr,t),Ms(n,t)}}function Ns(e,t){var n=this.cache;if(void 0!==t.x)n[0]===t.x&&n[1]===t.y&&n[2]===t.z&&n[3]===t.w||(e.uniform4ui(this.addr,t.x,t.y,t.z,t.w),n[0]=t.x,n[1]=t.y,n[2]=t.z,n[3]=t.w);else{if(xs(n,t))return;e.uniform4uiv(this.addr,t),Ms(n,t)}}function Fs(e,t,n){var r=this.cache,i=n.allocateTextureUnit();r[0]!==i&&(e.uniform1i(this.addr,i),r[0]=i),n.setTexture2D(t||cs,i)}function Bs(e,t,n){var r=this.cache,i=n.allocateTextureUnit();r[0]!==i&&(e.uniform1i(this.addr,i),r[0]=i),n.setTexture3D(t||ds,i)}function zs(e,t,n){var r=this.cache,i=n.allocateTextureUnit();r[0]!==i&&(e.uniform1i(this.addr,i),r[0]=i),n.setTextureCube(t||fs,i)}function Hs(e,t,n){var r=this.cache,i=n.allocateTextureUnit();r[0]!==i&&(e.uniform1i(this.addr,i),r[0]=i),n.setTexture2DArray(t||hs,i)}function Gs(e,t){e.uniform1fv(this.addr,t)}function Vs(e,t){var n=_s(t,this.size,2);e.uniform2fv(this.addr,n)}function Ws(e,t){var n=_s(t,this.size,3);e.uniform3fv(this.addr,n)}function js(e,t){var n=_s(t,this.size,4);e.uniform4fv(this.addr,n)}function Xs(e,t){var n=_s(t,this.size,4);e.uniformMatrix2fv(this.addr,!1,n)}function qs(e,t){var n=_s(t,this.size,9);e.uniformMatrix3fv(this.addr,!1,n)}function Ys(e,t){var n=_s(t,this.size,16);e.uniformMatrix4fv(this.addr,!1,n)}function Zs(e,t){e.uniform1iv(this.addr,t)}function Ks(e,t){e.uniform2iv(this.addr,t)}function Js(e,t){e.uniform3iv(this.addr,t)}function Qs(e,t){e.uniform4iv(this.addr,t)}function $s(e,t){e.uniform1uiv(this.addr,t)}function eu(e,t){e.uniform2uiv(this.addr,t)}function tu(e,t){e.uniform3uiv(this.addr,t)}function nu(e,t){e.uniform4uiv(this.addr,t)}function ru(e,t,n){var r=this.cache,i=t.length,a=Ss(n,i);xs(r,a)||(e.uniform1iv(this.addr,a),Ms(r,a));for(var o=0;o!==i;++o)n.setTexture2D(t[o]||cs,a[o])}function iu(e,t,n){var r=this.cache,i=t.length,a=Ss(n,i);xs(r,a)||(e.uniform1iv(this.addr,a),Ms(r,a));for(var o=0;o!==i;++o)n.setTexture3D(t[o]||ds,a[o])}function au(e,t,n){var r=this.cache,i=t.length,a=Ss(n,i);xs(r,a)||(e.uniform1iv(this.addr,a),Ms(r,a));for(var o=0;o!==i;++o)n.setTextureCube(t[o]||fs,a[o])}function ou(e,t,n){var r=this.cache,i=t.length,a=Ss(n,i);xs(r,a)||(e.uniform1iv(this.addr,a),Ms(r,a));for(var o=0;o!==i;++o)n.setTexture2DArray(t[o]||hs,a[o])}var su=s((function e(t,n,r){a(this,e),this.id=t,this.addr=r,this.cache=[],this.setValue=function(e){switch(e){case 5126:return bs;case 35664:return ws;case 35665:return Ts;case 35666:return Es;case 35674:return As;case 35675:return Rs;case 35676:return ks;case 5124:case 35670:return Cs;case 35667:case 35671:return Ls;case 35668:case 35672:return Ps;case 35669:case 35673:return Is;case 5125:return Ds;case 36294:return Us;case 36295:return Os;case 36296:return Ns;case 35678:case 36198:case 36298:case 36306:case 35682:return Fs;case 35679:case 36299:case 36307:return Bs;case 35680:case 36300:case 36308:case 36293:return zs;case 36289:case 36303:case 36311:case 36292:return Hs}}(n.type)})),uu=s((function e(t,n,r){a(this,e),this.id=t,this.addr=r,this.cache=[],this.size=n.size,this.setValue=function(e){switch(e){case 5126:return Gs;case 35664:return Vs;case 35665:return Ws;case 35666:return js;case 35674:return Xs;case 35675:return qs;case 35676:return Ys;case 5124:case 35670:return Zs;case 35667:case 35671:return Ks;case 35668:case 35672:return Js;case 35669:case 35673:return Qs;case 5125:return $s;case 36294:return eu;case 36295:return tu;case 36296:return nu;case 35678:case 36198:case 36298:case 36306:case 35682:return ru;case 35679:case 36299:case 36307:return iu;case 35680:case 36300:case 36308:case 36293:return au;case 36289:case 36303:case 36311:case 36292:return ou}}(n.type)})),lu=function(){function e(t){a(this,e),this.id=t,this.seq=[],this.map={}}return s(e,[{key:"setValue",value:function(e,t,n){for(var r=this.seq,i=0,a=r.length;i!==a;++i){var o=r[i];o.setValue(e,t[o.id],n)}}}]),e}(),cu=/(\w+)(\])?(\[|\.)?/g;function hu(e,t){e.seq.push(t),e.map[t.id]=t}function du(e,t,n){var r=e.name,i=r.length;for(cu.lastIndex=0;;){var a=cu.exec(r),o=cu.lastIndex,s=a[1],u="]"===a[2],l=a[3];if(u&&(s|=0),void 0===l||"["===l&&o+2===i){hu(n,void 0===l?new su(s,e,t):new uu(s,e,t));break}var c=n.map[s];void 0===c&&hu(n,c=new lu(s)),n=c}}var fu=function(){function e(t,n){a(this,e),this.seq=[],this.map={};for(var r=t.getProgramParameter(n,t.ACTIVE_UNIFORMS),i=0;i<r;++i){var o=t.getActiveUniform(n,i);du(o,t.getUniformLocation(n,o.name),this)}}return s(e,[{key:"setValue",value:function(e,t,n,r){var i=this.map[t];void 0!==i&&i.setValue(e,n,r)}},{key:"setOptional",value:function(e,t,n){var r=t[n];void 0!==r&&this.setValue(e,n,r)}}],[{key:"upload",value:function(e,t,n,r){for(var i=0,a=t.length;i!==a;++i){var o=t[i],s=n[o.id];!1!==s.needsUpdate&&o.setValue(e,s.value,r)}}},{key:"seqWithValue",value:function(e,t){for(var n=[],r=0,i=e.length;r!==i;++r){var a=e[r];a.id in t&&n.push(a)}return n}}]),e}();function pu(e,t,n){var r=e.createShader(t);return e.shaderSource(r,n),e.compileShader(r),r}var vu=0;function mu(e,t,n){var r=e.getShaderParameter(t,e.COMPILE_STATUS),i=e.getShaderInfoLog(t).trim();if(r&&""===i)return"";var a=/ERROR: 0:(\d+)/.exec(i);if(a){var o=parseInt(a[1]);return n.toUpperCase()+"\n\n"+i+"\n\n"+function(e,t){for(var n=e.split("\n"),r=[],i=Math.max(t-6,0),a=Math.min(t+6,n.length),o=i;o<a;o++){var s=o+1;r.push("".concat(s===t?">":" "," ").concat(s,": ").concat(n[o]))}return r.join("\n")}(e.getShaderSource(t),o)}return i}function gu(e,t){var n=function(e){switch(e){case vn:return["Linear","( value )"];case pn:return["sRGB","( value )"];default:return console.warn("THREE.WebGLProgram: Unsupported color space:",e),["Linear","( value )"]}}(t);return"vec4 "+e+"( vec4 value ) { return LinearTo"+n[0]+n[1]+"; }"}function yu(e,t){var n;switch(t){case we:n="Linear";break;case Te:n="Reinhard";break;case Ee:n="OptimizedCineon";break;case Ae:n="ACESFilmic";break;case Re:n="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",t),n="Linear"}return"vec3 "+e+"( vec3 color ) { return "+n+"ToneMapping( color ); }"}function _u(e){return""!==e}function xu(e,t){var n=t.numSpotLightShadows+t.numSpotLightMaps-t.numSpotLightShadowsWithMaps;return e.replace(/NUM_DIR_LIGHTS/g,t.numDirLights).replace(/NUM_SPOT_LIGHTS/g,t.numSpotLights).replace(/NUM_SPOT_LIGHT_MAPS/g,t.numSpotLightMaps).replace(/NUM_SPOT_LIGHT_COORDS/g,n).replace(/NUM_RECT_AREA_LIGHTS/g,t.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,t.numPointLights).replace(/NUM_HEMI_LIGHTS/g,t.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,t.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS/g,t.numSpotLightShadowsWithMaps).replace(/NUM_SPOT_LIGHT_SHADOWS/g,t.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,t.numPointLightShadows)}function Mu(e,t){return e.replace(/NUM_CLIPPING_PLANES/g,t.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,t.numClippingPlanes-t.numClipIntersection)}var Su=/^[ \t]*#include +<([\w\d./]+)>/gm;function bu(e){return e.replace(Su,Tu)}var wu=new Map([["encodings_fragment","colorspace_fragment"],["encodings_pars_fragment","colorspace_pars_fragment"],["output_fragment","opaque_fragment"]]);function Tu(e,t){var n=Lo[t];if(void 0===n){var r=wu.get(t);if(void 0===r)throw new Error("Can not resolve #include <"+t+">");n=Lo[r],console.warn('THREE.WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',t,r)}return bu(n)}var Eu=/#pragma unroll_loop_start\s+for\s*\(\s*int\s+i\s*=\s*(\d+)\s*;\s*i\s*<\s*(\d+)\s*;\s*i\s*\+\+\s*\)\s*{([\s\S]+?)}\s+#pragma unroll_loop_end/g;function Au(e){return e.replace(Eu,Ru)}function Ru(e,t,n,r){for(var i="",a=parseInt(t);a<parseInt(n);a++)i+=r.replace(/\[\s*i\s*\]/g,"[ "+a+" ]").replace(/UNROLLED_LOOP_INDEX/g,a);return i}function ku(e){var t="precision "+e.precision+" float;\nprecision "+e.precision+" int;";return"highp"===e.precision?t+="\n#define HIGH_PRECISION":"mediump"===e.precision?t+="\n#define MEDIUM_PRECISION":"lowp"===e.precision&&(t+="\n#define LOW_PRECISION"),t}function Cu(e,t,n,r){var i,a,o=e.getContext(),s=n.defines,u=n.vertexShader,l=n.fragmentShader,c=function(e){var t="SHADOWMAP_TYPE_BASIC";return e.shadowMapType===N?t="SHADOWMAP_TYPE_PCF":e.shadowMapType===F?t="SHADOWMAP_TYPE_PCF_SOFT":e.shadowMapType===B&&(t="SHADOWMAP_TYPE_VSM"),t}(n),h=function(e){var t="ENVMAP_TYPE_CUBE";if(e.envMap)switch(e.envMapMode){case Ce:case Le:t="ENVMAP_TYPE_CUBE";break;case De:t="ENVMAP_TYPE_CUBE_UV"}return t}(n),d=function(e){var t="ENVMAP_MODE_REFLECTION";e.envMap&&e.envMapMode===Le&&(t="ENVMAP_MODE_REFRACTION");return t}(n),f=function(e){var t="ENVMAP_BLENDING_NONE";if(e.envMap)switch(e.combine){case xe:t="ENVMAP_BLENDING_MULTIPLY";break;case Me:t="ENVMAP_BLENDING_MIX";break;case Se:t="ENVMAP_BLENDING_ADD"}return t}(n),p=function(e){var t=e.envMapCubeUVHeight;if(null===t)return null;var n=Math.log2(t)-2,r=1/t;return{texelWidth:1/(3*Math.max(Math.pow(2,n),112)),texelHeight:r,maxMip:n}}(n),v=n.isWebGL2?"":function(e){return[e.extensionDerivatives||e.envMapCubeUVHeight||e.bumpMap||e.normalMapTangentSpace||e.clearcoatNormalMap||e.flatShading||"physical"===e.shaderID?"#extension GL_OES_standard_derivatives : enable":"",(e.extensionFragDepth||e.logarithmicDepthBuffer)&&e.rendererExtensionFragDepth?"#extension GL_EXT_frag_depth : enable":"",e.extensionDrawBuffers&&e.rendererExtensionDrawBuffers?"#extension GL_EXT_draw_buffers : require":"",(e.extensionShaderTextureLOD||e.envMap||e.transmission)&&e.rendererExtensionShaderTextureLod?"#extension GL_EXT_shader_texture_lod : enable":""].filter(_u).join("\n")}(n),m=function(e){var t=[];for(var n in e){var r=e[n];!1!==r&&t.push("#define "+n+" "+r)}return t.join("\n")}(s),g=o.createProgram(),y=n.glslVersion?"#version "+n.glslVersion+"\n":"";n.isRawShaderMaterial?((i=["#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,m].filter(_u).join("\n")).length>0&&(i+="\n"),(a=[v,"#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,m].filter(_u).join("\n")).length>0&&(a+="\n")):(i=[ku(n),"#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,m,n.instancing?"#define USE_INSTANCING":"",n.instancingColor?"#define USE_INSTANCING_COLOR":"",n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.map?"#define USE_MAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+d:"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",n.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",n.displacementMap?"#define USE_DISPLACEMENTMAP":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.anisotropyMap?"#define USE_ANISOTROPYMAP":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",n.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",n.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.alphaHash?"#define USE_ALPHAHASH":"",n.transmission?"#define USE_TRANSMISSION":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.thicknessMap?"#define USE_THICKNESSMAP":"",n.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",n.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",n.mapUv?"#define MAP_UV "+n.mapUv:"",n.alphaMapUv?"#define ALPHAMAP_UV "+n.alphaMapUv:"",n.lightMapUv?"#define LIGHTMAP_UV "+n.lightMapUv:"",n.aoMapUv?"#define AOMAP_UV "+n.aoMapUv:"",n.emissiveMapUv?"#define EMISSIVEMAP_UV "+n.emissiveMapUv:"",n.bumpMapUv?"#define BUMPMAP_UV "+n.bumpMapUv:"",n.normalMapUv?"#define NORMALMAP_UV "+n.normalMapUv:"",n.displacementMapUv?"#define DISPLACEMENTMAP_UV "+n.displacementMapUv:"",n.metalnessMapUv?"#define METALNESSMAP_UV "+n.metalnessMapUv:"",n.roughnessMapUv?"#define ROUGHNESSMAP_UV "+n.roughnessMapUv:"",n.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+n.anisotropyMapUv:"",n.clearcoatMapUv?"#define CLEARCOATMAP_UV "+n.clearcoatMapUv:"",n.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+n.clearcoatNormalMapUv:"",n.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+n.clearcoatRoughnessMapUv:"",n.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+n.iridescenceMapUv:"",n.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+n.iridescenceThicknessMapUv:"",n.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+n.sheenColorMapUv:"",n.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+n.sheenRoughnessMapUv:"",n.specularMapUv?"#define SPECULARMAP_UV "+n.specularMapUv:"",n.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+n.specularColorMapUv:"",n.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+n.specularIntensityMapUv:"",n.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+n.transmissionMapUv:"",n.thicknessMapUv?"#define THICKNESSMAP_UV "+n.thicknessMapUv:"",n.vertexTangents&&!1===n.flatShading?"#define USE_TANGENT":"",n.vertexColors?"#define USE_COLOR":"",n.vertexAlphas?"#define USE_COLOR_ALPHA":"",n.vertexUv1s?"#define USE_UV1":"",n.vertexUv2s?"#define USE_UV2":"",n.vertexUv3s?"#define USE_UV3":"",n.pointsUvs?"#define USE_POINTS_UV":"",n.flatShading?"#define FLAT_SHADED":"",n.skinning?"#define USE_SKINNING":"",n.morphTargets?"#define USE_MORPHTARGETS":"",n.morphNormals&&!1===n.flatShading?"#define USE_MORPHNORMALS":"",n.morphColors&&n.isWebGL2?"#define USE_MORPHCOLORS":"",n.morphTargetsCount>0&&n.isWebGL2?"#define MORPHTARGETS_TEXTURE":"",n.morphTargetsCount>0&&n.isWebGL2?"#define MORPHTARGETS_TEXTURE_STRIDE "+n.morphTextureStride:"",n.morphTargetsCount>0&&n.isWebGL2?"#define MORPHTARGETS_COUNT "+n.morphTargetsCount:"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+c:"",n.sizeAttenuation?"#define USE_SIZEATTENUATION":"",n.useLegacyLights?"#define LEGACY_LIGHTS":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",n.logarithmicDepthBuffer&&n.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING","\tattribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR","\tattribute vec3 instanceColor;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_UV1","\tattribute vec2 uv1;","#endif","#ifdef USE_UV2","\tattribute vec2 uv2;","#endif","#ifdef USE_UV3","\tattribute vec2 uv3;","#endif","#ifdef USE_TANGENT","\tattribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )","\tattribute vec4 color;","#elif defined( USE_COLOR )","\tattribute vec3 color;","#endif","#if ( defined( USE_MORPHTARGETS ) && ! defined( MORPHTARGETS_TEXTURE ) )","\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(_u).join("\n"),a=[v,ku(n),"#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,m,n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.map?"#define USE_MAP":"",n.matcap?"#define USE_MATCAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+h:"",n.envMap?"#define "+d:"",n.envMap?"#define "+f:"",p?"#define CUBEUV_TEXEL_WIDTH "+p.texelWidth:"",p?"#define CUBEUV_TEXEL_HEIGHT "+p.texelHeight:"",p?"#define CUBEUV_MAX_MIP "+p.maxMip+".0":"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",n.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.anisotropy?"#define USE_ANISOTROPY":"",n.anisotropyMap?"#define USE_ANISOTROPYMAP":"",n.clearcoat?"#define USE_CLEARCOAT":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.iridescence?"#define USE_IRIDESCENCE":"",n.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",n.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",n.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.alphaTest?"#define USE_ALPHATEST":"",n.alphaHash?"#define USE_ALPHAHASH":"",n.sheen?"#define USE_SHEEN":"",n.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",n.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",n.transmission?"#define USE_TRANSMISSION":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.thicknessMap?"#define USE_THICKNESSMAP":"",n.vertexTangents&&!1===n.flatShading?"#define USE_TANGENT":"",n.vertexColors||n.instancingColor?"#define USE_COLOR":"",n.vertexAlphas?"#define USE_COLOR_ALPHA":"",n.vertexUv1s?"#define USE_UV1":"",n.vertexUv2s?"#define USE_UV2":"",n.vertexUv3s?"#define USE_UV3":"",n.pointsUvs?"#define USE_POINTS_UV":"",n.gradientMap?"#define USE_GRADIENTMAP":"",n.flatShading?"#define FLAT_SHADED":"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+c:"",n.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",n.useLegacyLights?"#define LEGACY_LIGHTS":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",n.logarithmicDepthBuffer&&n.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",n.toneMapping!==be?"#define TONE_MAPPING":"",n.toneMapping!==be?Lo.tonemapping_pars_fragment:"",n.toneMapping!==be?yu("toneMapping",n.toneMapping):"",n.dithering?"#define DITHERING":"",n.opaque?"#define OPAQUE":"",Lo.colorspace_pars_fragment,gu("linearToOutputTexel",n.outputColorSpace),n.useDepthPacking?"#define DEPTH_PACKING "+n.depthPacking:"","\n"].filter(_u).join("\n")),u=Mu(u=xu(u=bu(u),n),n),l=Mu(l=xu(l=bu(l),n),n),u=Au(u),l=Au(l),n.isWebGL2&&!0!==n.isRawShaderMaterial&&(y="#version 300 es\n",i=["precision mediump sampler2DArray;","#define attribute in","#define varying out","#define texture2D texture"].join("\n")+"\n"+i,a=["#define varying in",n.glslVersion===Jn?"":"layout(location = 0) out highp vec4 pc_fragColor;",n.glslVersion===Jn?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth","#define texture2D texture","#define textureCube texture","#define texture2DProj textureProj","#define texture2DLodEXT textureLod","#define texture2DProjLodEXT textureProjLod","#define textureCubeLodEXT textureLod","#define texture2DGradEXT textureGrad","#define texture2DProjGradEXT textureProjGrad","#define textureCubeGradEXT textureGrad"].join("\n")+"\n"+a);var _,x,M=y+i+u,S=y+a+l,b=pu(o,o.VERTEX_SHADER,M),w=pu(o,o.FRAGMENT_SHADER,S);if(o.attachShader(g,b),o.attachShader(g,w),void 0!==n.index0AttributeName?o.bindAttribLocation(g,0,n.index0AttributeName):!0===n.morphTargets&&o.bindAttribLocation(g,0,"position"),o.linkProgram(g),e.debug.checkShaderErrors){var T=o.getProgramInfoLog(g).trim(),E=o.getShaderInfoLog(b).trim(),A=o.getShaderInfoLog(w).trim(),R=!0,k=!0;if(!1===o.getProgramParameter(g,o.LINK_STATUS))if(R=!1,"function"==typeof e.debug.onShaderError)e.debug.onShaderError(o,g,b,w);else{var C=mu(o,b,"vertex"),L=mu(o,w,"fragment");console.error("THREE.WebGLProgram: Shader Error "+o.getError()+" - VALIDATE_STATUS "+o.getProgramParameter(g,o.VALIDATE_STATUS)+"\n\nProgram Info Log: "+T+"\n"+C+"\n"+L)}else""!==T?console.warn("THREE.WebGLProgram: Program Info Log:",T):""!==E&&""!==A||(k=!1);k&&(this.diagnostics={runnable:R,programLog:T,vertexShader:{log:E,prefix:i},fragmentShader:{log:A,prefix:a}})}return o.deleteShader(b),o.deleteShader(w),this.getUniforms=function(){return void 0===_&&(_=new fu(o,g)),_},this.getAttributes=function(){return void 0===x&&(x=function(e,t){for(var n={},r=e.getProgramParameter(t,e.ACTIVE_ATTRIBUTES),i=0;i<r;i++){var a=e.getActiveAttrib(t,i),o=a.name,s=1;a.type===e.FLOAT_MAT2&&(s=2),a.type===e.FLOAT_MAT3&&(s=3),a.type===e.FLOAT_MAT4&&(s=4),n[o]={type:a.type,location:e.getAttribLocation(t,o),locationSize:s}}return n}(o,g)),x},this.destroy=function(){r.releaseStatesOfProgram(this),o.deleteProgram(g),this.program=void 0},this.type=n.shaderType,this.name=n.shaderName,this.id=vu++,this.cacheKey=t,this.usedTimes=1,this.program=g,this.vertexShader=b,this.fragmentShader=w,this}var Lu=0,Pu=function(){function e(){a(this,e),this.shaderCache=new Map,this.materialCache=new Map}return s(e,[{key:"update",value:function(e){var t=e.vertexShader,n=e.fragmentShader,r=this._getShaderStage(t),i=this._getShaderStage(n),a=this._getShaderCacheForMaterial(e);return!1===a.has(r)&&(a.add(r),r.usedTimes++),!1===a.has(i)&&(a.add(i),i.usedTimes++),this}},{key:"remove",value:function(e){var t,n=this.materialCache.get(e),r=v(n);try{for(r.s();!(t=r.n()).done;){var i=t.value;i.usedTimes--,0===i.usedTimes&&this.shaderCache.delete(i.code)}}catch(e){r.e(e)}finally{r.f()}return this.materialCache.delete(e),this}},{key:"getVertexShaderID",value:function(e){return this._getShaderStage(e.vertexShader).id}},{key:"getFragmentShaderID",value:function(e){return this._getShaderStage(e.fragmentShader).id}},{key:"dispose",value:function(){this.shaderCache.clear(),this.materialCache.clear()}},{key:"_getShaderCacheForMaterial",value:function(e){var t=this.materialCache,n=t.get(e);return void 0===n&&(n=new Set,t.set(e,n)),n}},{key:"_getShaderStage",value:function(e){var t=this.shaderCache,n=t.get(e);return void 0===n&&(n=new Iu(e),t.set(e,n)),n}}]),e}(),Iu=s((function e(t){a(this,e),this.id=Lu++,this.code=t,this.usedTimes=0}));function Du(e,t,n,r,i,a,o){var s=new Ui,u=new Pu,l=[],c=i.isWebGL2,h=i.logarithmicDepthBuffer,d=i.vertexTextures,f=i.precision,p={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function v(e){return 0===e?"uv":"uv".concat(e)}return{getParameters:function(a,s,l,m,g){var y=m.fog,_=g.geometry,x=a.isMeshStandardMaterial?m.environment:null,M=(a.isMeshStandardMaterial?n:t).get(a.envMap||x),S=M&&M.mapping===De?M.image.height:null,b=p[a.type];null!==a.precision&&(f=i.getMaxPrecision(a.precision))!==a.precision&&console.warn("THREE.WebGLProgram.getParameters:",a.precision,"not supported, using",f,"instead.");var w,T,E,A,R=_.morphAttributes.position||_.morphAttributes.normal||_.morphAttributes.color,k=void 0!==R?R.length:0,C=0;if(void 0!==_.morphAttributes.position&&(C=1),void 0!==_.morphAttributes.normal&&(C=2),void 0!==_.morphAttributes.color&&(C=3),b){var L=Io[b];w=L.vertexShader,T=L.fragmentShader}else w=a.vertexShader,T=a.fragmentShader,u.update(a),E=u.getVertexShaderID(a),A=u.getFragmentShaderID(a);var P=e.getRenderTarget(),I=!0===g.isInstancedMesh,D=!!a.map,U=!!a.matcap,O=!!M,N=!!a.aoMap,F=!!a.lightMap,B=!!a.bumpMap,z=!!a.normalMap,V=!!a.displacementMap,W=!!a.emissiveMap,X=!!a.metalnessMap,q=!!a.roughnessMap,Y=a.anisotropy>0,Z=a.clearcoat>0,K=a.iridescence>0,J=a.sheen>0,Q=a.transmission>0,$=Y&&!!a.anisotropyMap,ee=Z&&!!a.clearcoatMap,te=Z&&!!a.clearcoatNormalMap,ne=Z&&!!a.clearcoatRoughnessMap,re=K&&!!a.iridescenceMap,ie=K&&!!a.iridescenceThicknessMap,ae=J&&!!a.sheenColorMap,oe=J&&!!a.sheenRoughnessMap,se=!!a.specularMap,ue=!!a.specularColorMap,le=!!a.specularIntensityMap,ce=Q&&!!a.transmissionMap,he=Q&&!!a.thicknessMap,de=!!a.gradientMap,fe=!!a.alphaMap,pe=a.alphaTest>0,ve=!!a.alphaHash,me=!!a.extensions,ge=!!_.attributes.uv1,ye=!!_.attributes.uv2,_e=!!_.attributes.uv3,xe=be;return a.toneMapped&&(null!==P&&!0!==P.isXRRenderTarget||(xe=e.toneMapping)),{isWebGL2:c,shaderID:b,shaderType:a.type,shaderName:a.name,vertexShader:w,fragmentShader:T,defines:a.defines,customVertexShaderID:E,customFragmentShaderID:A,isRawShaderMaterial:!0===a.isRawShaderMaterial,glslVersion:a.glslVersion,precision:f,instancing:I,instancingColor:I&&null!==g.instanceColor,supportsVertexTextures:d,outputColorSpace:null===P?e.outputColorSpace:!0===P.isXRRenderTarget?P.texture.colorSpace:vn,map:D,matcap:U,envMap:O,envMapMode:O&&M.mapping,envMapCubeUVHeight:S,aoMap:N,lightMap:F,bumpMap:B,normalMap:z,displacementMap:d&&V,emissiveMap:W,normalMapObjectSpace:z&&a.normalMapType===dn,normalMapTangentSpace:z&&a.normalMapType===hn,metalnessMap:X,roughnessMap:q,anisotropy:Y,anisotropyMap:$,clearcoat:Z,clearcoatMap:ee,clearcoatNormalMap:te,clearcoatRoughnessMap:ne,iridescence:K,iridescenceMap:re,iridescenceThicknessMap:ie,sheen:J,sheenColorMap:ae,sheenRoughnessMap:oe,specularMap:se,specularColorMap:ue,specularIntensityMap:le,transmission:Q,transmissionMap:ce,thicknessMap:he,gradientMap:de,opaque:!1===a.transparent&&a.blending===j,alphaMap:fe,alphaTest:pe,alphaHash:ve,combine:a.combine,mapUv:D&&v(a.map.channel),aoMapUv:N&&v(a.aoMap.channel),lightMapUv:F&&v(a.lightMap.channel),bumpMapUv:B&&v(a.bumpMap.channel),normalMapUv:z&&v(a.normalMap.channel),displacementMapUv:V&&v(a.displacementMap.channel),emissiveMapUv:W&&v(a.emissiveMap.channel),metalnessMapUv:X&&v(a.metalnessMap.channel),roughnessMapUv:q&&v(a.roughnessMap.channel),anisotropyMapUv:$&&v(a.anisotropyMap.channel),clearcoatMapUv:ee&&v(a.clearcoatMap.channel),clearcoatNormalMapUv:te&&v(a.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:ne&&v(a.clearcoatRoughnessMap.channel),iridescenceMapUv:re&&v(a.iridescenceMap.channel),iridescenceThicknessMapUv:ie&&v(a.iridescenceThicknessMap.channel),sheenColorMapUv:ae&&v(a.sheenColorMap.channel),sheenRoughnessMapUv:oe&&v(a.sheenRoughnessMap.channel),specularMapUv:se&&v(a.specularMap.channel),specularColorMapUv:ue&&v(a.specularColorMap.channel),specularIntensityMapUv:le&&v(a.specularIntensityMap.channel),transmissionMapUv:ce&&v(a.transmissionMap.channel),thicknessMapUv:he&&v(a.thicknessMap.channel),alphaMapUv:fe&&v(a.alphaMap.channel),vertexTangents:!!_.attributes.tangent&&(z||Y),vertexColors:a.vertexColors,vertexAlphas:!0===a.vertexColors&&!!_.attributes.color&&4===_.attributes.color.itemSize,vertexUv1s:ge,vertexUv2s:ye,vertexUv3s:_e,pointsUvs:!0===g.isPoints&&!!_.attributes.uv&&(D||fe),fog:!!y,useFog:!0===a.fog,fogExp2:y&&y.isFogExp2,flatShading:!0===a.flatShading,sizeAttenuation:!0===a.sizeAttenuation,logarithmicDepthBuffer:h,skinning:!0===g.isSkinnedMesh,morphTargets:void 0!==_.morphAttributes.position,morphNormals:void 0!==_.morphAttributes.normal,morphColors:void 0!==_.morphAttributes.color,morphTargetsCount:k,morphTextureStride:C,numDirLights:s.directional.length,numPointLights:s.point.length,numSpotLights:s.spot.length,numSpotLightMaps:s.spotLightMap.length,numRectAreaLights:s.rectArea.length,numHemiLights:s.hemi.length,numDirLightShadows:s.directionalShadowMap.length,numPointLightShadows:s.pointShadowMap.length,numSpotLightShadows:s.spotShadowMap.length,numSpotLightShadowsWithMaps:s.numSpotLightShadowsWithMaps,numClippingPlanes:o.numPlanes,numClipIntersection:o.numIntersection,dithering:a.dithering,shadowMapEnabled:e.shadowMap.enabled&&l.length>0,shadowMapType:e.shadowMap.type,toneMapping:xe,useLegacyLights:e._useLegacyLights,premultipliedAlpha:a.premultipliedAlpha,doubleSided:a.side===G,flipSided:a.side===H,useDepthPacking:a.depthPacking>=0,depthPacking:a.depthPacking||0,index0AttributeName:a.index0AttributeName,extensionDerivatives:me&&!0===a.extensions.derivatives,extensionFragDepth:me&&!0===a.extensions.fragDepth,extensionDrawBuffers:me&&!0===a.extensions.drawBuffers,extensionShaderTextureLOD:me&&!0===a.extensions.shaderTextureLOD,rendererExtensionFragDepth:c||r.has("EXT_frag_depth"),rendererExtensionDrawBuffers:c||r.has("WEBGL_draw_buffers"),rendererExtensionShaderTextureLod:c||r.has("EXT_shader_texture_lod"),customProgramCacheKey:a.customProgramCacheKey()}},getProgramCacheKey:function(t){var n=[];if(t.shaderID?n.push(t.shaderID):(n.push(t.customVertexShaderID),n.push(t.customFragmentShaderID)),void 0!==t.defines)for(var r in t.defines)n.push(r),n.push(t.defines[r]);return!1===t.isRawShaderMaterial&&(!function(e,t){e.push(t.precision),e.push(t.outputColorSpace),e.push(t.envMapMode),e.push(t.envMapCubeUVHeight),e.push(t.mapUv),e.push(t.alphaMapUv),e.push(t.lightMapUv),e.push(t.aoMapUv),e.push(t.bumpMapUv),e.push(t.normalMapUv),e.push(t.displacementMapUv),e.push(t.emissiveMapUv),e.push(t.metalnessMapUv),e.push(t.roughnessMapUv),e.push(t.anisotropyMapUv),e.push(t.clearcoatMapUv),e.push(t.clearcoatNormalMapUv),e.push(t.clearcoatRoughnessMapUv),e.push(t.iridescenceMapUv),e.push(t.iridescenceThicknessMapUv),e.push(t.sheenColorMapUv),e.push(t.sheenRoughnessMapUv),e.push(t.specularMapUv),e.push(t.specularColorMapUv),e.push(t.specularIntensityMapUv),e.push(t.transmissionMapUv),e.push(t.thicknessMapUv),e.push(t.combine),e.push(t.fogExp2),e.push(t.sizeAttenuation),e.push(t.morphTargetsCount),e.push(t.morphAttributeCount),e.push(t.numDirLights),e.push(t.numPointLights),e.push(t.numSpotLights),e.push(t.numSpotLightMaps),e.push(t.numHemiLights),e.push(t.numRectAreaLights),e.push(t.numDirLightShadows),e.push(t.numPointLightShadows),e.push(t.numSpotLightShadows),e.push(t.numSpotLightShadowsWithMaps),e.push(t.shadowMapType),e.push(t.toneMapping),e.push(t.numClippingPlanes),e.push(t.numClipIntersection),e.push(t.depthPacking)}(n,t),function(e,t){s.disableAll(),t.isWebGL2&&s.enable(0);t.supportsVertexTextures&&s.enable(1);t.instancing&&s.enable(2);t.instancingColor&&s.enable(3);t.matcap&&s.enable(4);t.envMap&&s.enable(5);t.normalMapObjectSpace&&s.enable(6);t.normalMapTangentSpace&&s.enable(7);t.clearcoat&&s.enable(8);t.iridescence&&s.enable(9);t.alphaTest&&s.enable(10);t.vertexColors&&s.enable(11);t.vertexAlphas&&s.enable(12);t.vertexUv1s&&s.enable(13);t.vertexUv2s&&s.enable(14);t.vertexUv3s&&s.enable(15);t.vertexTangents&&s.enable(16);t.anisotropy&&s.enable(17);e.push(s.mask),s.disableAll(),t.fog&&s.enable(0);t.useFog&&s.enable(1);t.flatShading&&s.enable(2);t.logarithmicDepthBuffer&&s.enable(3);t.skinning&&s.enable(4);t.morphTargets&&s.enable(5);t.morphNormals&&s.enable(6);t.morphColors&&s.enable(7);t.premultipliedAlpha&&s.enable(8);t.shadowMapEnabled&&s.enable(9);t.useLegacyLights&&s.enable(10);t.doubleSided&&s.enable(11);t.flipSided&&s.enable(12);t.useDepthPacking&&s.enable(13);t.dithering&&s.enable(14);t.transmission&&s.enable(15);t.sheen&&s.enable(16);t.opaque&&s.enable(17);t.pointsUvs&&s.enable(18);e.push(s.mask)}(n,t),n.push(e.outputColorSpace)),n.push(t.customProgramCacheKey),n.join()},getUniforms:function(e){var t,n=p[e.type];if(n){var r=Io[n];t=fo.clone(r.uniforms)}else t=e.uniforms;return t},acquireProgram:function(t,n){for(var r,i=0,o=l.length;i<o;i++){var s=l[i];if(s.cacheKey===n){++(r=s).usedTimes;break}}return void 0===r&&(r=new Cu(e,n,t,a),l.push(r)),r},releaseProgram:function(e){if(0==--e.usedTimes){var t=l.indexOf(e);l[t]=l[l.length-1],l.pop(),e.destroy()}},releaseShaderCache:function(e){u.remove(e)},programs:l,dispose:function(){u.dispose()}}}function Uu(){var e=new WeakMap;return{get:function(t){var n=e.get(t);return void 0===n&&(n={},e.set(t,n)),n},remove:function(t){e.delete(t)},update:function(t,n,r){e.get(t)[n]=r},dispose:function(){e=new WeakMap}}}function Ou(e,t){return e.groupOrder!==t.groupOrder?e.groupOrder-t.groupOrder:e.renderOrder!==t.renderOrder?e.renderOrder-t.renderOrder:e.material.id!==t.material.id?e.material.id-t.material.id:e.z!==t.z?e.z-t.z:e.id-t.id}function Nu(e,t){return e.groupOrder!==t.groupOrder?e.groupOrder-t.groupOrder:e.renderOrder!==t.renderOrder?e.renderOrder-t.renderOrder:e.z!==t.z?t.z-e.z:e.id-t.id}function Fu(){var e=[],t=0,n=[],r=[],i=[];function a(n,r,i,a,o,s){var u=e[t];return void 0===u?(u={id:n.id,object:n,geometry:r,material:i,groupOrder:a,renderOrder:n.renderOrder,z:o,group:s},e[t]=u):(u.id=n.id,u.object=n,u.geometry=r,u.material=i,u.groupOrder=a,u.renderOrder=n.renderOrder,u.z=o,u.group=s),t++,u}return{opaque:n,transmissive:r,transparent:i,init:function(){t=0,n.length=0,r.length=0,i.length=0},push:function(e,t,o,s,u,l){var c=a(e,t,o,s,u,l);o.transmission>0?r.push(c):!0===o.transparent?i.push(c):n.push(c)},unshift:function(e,t,o,s,u,l){var c=a(e,t,o,s,u,l);o.transmission>0?r.unshift(c):!0===o.transparent?i.unshift(c):n.unshift(c)},finish:function(){for(var n=t,r=e.length;n<r;n++){var i=e[n];if(null===i.id)break;i.id=null,i.object=null,i.geometry=null,i.material=null,i.group=null}},sort:function(e,t){n.length>1&&n.sort(e||Ou),r.length>1&&r.sort(t||Nu),i.length>1&&i.sort(t||Nu)}}}function Bu(){var e=new WeakMap;return{get:function(t,n){var r,i=e.get(t);return void 0===i?(r=new Fu,e.set(t,[r])):n>=i.length?(r=new Fu,i.push(r)):r=i[n],r},dispose:function(){e=new WeakMap}}}function zu(){var e={};return{get:function(t){if(void 0!==e[t.id])return e[t.id];var n;switch(t.type){case"DirectionalLight":n={direction:new Yr,color:new pa};break;case"SpotLight":n={position:new Yr,direction:new Yr,color:new pa,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":n={position:new Yr,color:new pa,distance:0,decay:0};break;case"HemisphereLight":n={direction:new Yr,skyColor:new pa,groundColor:new pa};break;case"RectAreaLight":n={color:new pa,position:new Yr,halfWidth:new Yr,halfHeight:new Yr}}return e[t.id]=n,n}}}var Hu=0;function Gu(e,t){return(t.castShadow?2:0)-(e.castShadow?2:0)+(t.map?1:0)-(e.map?1:0)}function Vu(e,t){for(var n,r=new zu,i=(n={},{get:function(e){if(void 0!==n[e.id])return n[e.id];var t;switch(e.type){case"DirectionalLight":case"SpotLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new mr};break;case"PointLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new mr,shadowCameraNear:1,shadowCameraFar:1e3}}return n[e.id]=t,t}}),a={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0},o=0;o<9;o++)a.probe.push(new Yr);var s=new Yr,u=new wi,l=new wi;return{setup:function(n,o){for(var s=0,u=0,l=0,c=0;c<9;c++)a.probe[c].set(0,0,0);var h=0,d=0,f=0,p=0,v=0,m=0,g=0,y=0,_=0,x=0;n.sort(Gu);for(var M=!0===o?Math.PI:1,S=0,b=n.length;S<b;S++){var w=n[S],T=w.color,E=w.intensity,A=w.distance,R=w.shadow&&w.shadow.map?w.shadow.map.texture:null;if(w.isAmbientLight)s+=T.r*E*M,u+=T.g*E*M,l+=T.b*E*M;else if(w.isLightProbe)for(var k=0;k<9;k++)a.probe[k].addScaledVector(w.sh.coefficients[k],E);else if(w.isDirectionalLight){var C=r.get(w);if(C.color.copy(w.color).multiplyScalar(w.intensity*M),w.castShadow){var L=w.shadow,P=i.get(w);P.shadowBias=L.bias,P.shadowNormalBias=L.normalBias,P.shadowRadius=L.radius,P.shadowMapSize=L.mapSize,a.directionalShadow[h]=P,a.directionalShadowMap[h]=R,a.directionalShadowMatrix[h]=w.shadow.matrix,m++}a.directional[h]=C,h++}else if(w.isSpotLight){var I=r.get(w);I.position.setFromMatrixPosition(w.matrixWorld),I.color.copy(T).multiplyScalar(E*M),I.distance=A,I.coneCos=Math.cos(w.angle),I.penumbraCos=Math.cos(w.angle*(1-w.penumbra)),I.decay=w.decay,a.spot[f]=I;var D=w.shadow;if(w.map&&(a.spotLightMap[_]=w.map,_++,D.updateMatrices(w),w.castShadow&&x++),a.spotLightMatrix[f]=D.matrix,w.castShadow){var U=i.get(w);U.shadowBias=D.bias,U.shadowNormalBias=D.normalBias,U.shadowRadius=D.radius,U.shadowMapSize=D.mapSize,a.spotShadow[f]=U,a.spotShadowMap[f]=R,y++}f++}else if(w.isRectAreaLight){var O=r.get(w);O.color.copy(T).multiplyScalar(E),O.halfWidth.set(.5*w.width,0,0),O.halfHeight.set(0,.5*w.height,0),a.rectArea[p]=O,p++}else if(w.isPointLight){var N=r.get(w);if(N.color.copy(w.color).multiplyScalar(w.intensity*M),N.distance=w.distance,N.decay=w.decay,w.castShadow){var F=w.shadow,B=i.get(w);B.shadowBias=F.bias,B.shadowNormalBias=F.normalBias,B.shadowRadius=F.radius,B.shadowMapSize=F.mapSize,B.shadowCameraNear=F.camera.near,B.shadowCameraFar=F.camera.far,a.pointShadow[d]=B,a.pointShadowMap[d]=R,a.pointShadowMatrix[d]=w.shadow.matrix,g++}a.point[d]=N,d++}else if(w.isHemisphereLight){var z=r.get(w);z.skyColor.copy(w.color).multiplyScalar(E*M),z.groundColor.copy(w.groundColor).multiplyScalar(E*M),a.hemi[v]=z,v++}}p>0&&(t.isWebGL2||!0===e.has("OES_texture_float_linear")?(a.rectAreaLTC1=Po.LTC_FLOAT_1,a.rectAreaLTC2=Po.LTC_FLOAT_2):!0===e.has("OES_texture_half_float_linear")?(a.rectAreaLTC1=Po.LTC_HALF_1,a.rectAreaLTC2=Po.LTC_HALF_2):console.error("THREE.WebGLRenderer: Unable to use RectAreaLight. Missing WebGL extensions.")),a.ambient[0]=s,a.ambient[1]=u,a.ambient[2]=l;var H=a.hash;H.directionalLength===h&&H.pointLength===d&&H.spotLength===f&&H.rectAreaLength===p&&H.hemiLength===v&&H.numDirectionalShadows===m&&H.numPointShadows===g&&H.numSpotShadows===y&&H.numSpotMaps===_||(a.directional.length=h,a.spot.length=f,a.rectArea.length=p,a.point.length=d,a.hemi.length=v,a.directionalShadow.length=m,a.directionalShadowMap.length=m,a.pointShadow.length=g,a.pointShadowMap.length=g,a.spotShadow.length=y,a.spotShadowMap.length=y,a.directionalShadowMatrix.length=m,a.pointShadowMatrix.length=g,a.spotLightMatrix.length=y+_-x,a.spotLightMap.length=_,a.numSpotLightShadowsWithMaps=x,H.directionalLength=h,H.pointLength=d,H.spotLength=f,H.rectAreaLength=p,H.hemiLength=v,H.numDirectionalShadows=m,H.numPointShadows=g,H.numSpotShadows=y,H.numSpotMaps=_,a.version=Hu++)},setupView:function(e,t){for(var n=0,r=0,i=0,o=0,c=0,h=t.matrixWorldInverse,d=0,f=e.length;d<f;d++){var p=e[d];if(p.isDirectionalLight){var v=a.directional[n];v.direction.setFromMatrixPosition(p.matrixWorld),s.setFromMatrixPosition(p.target.matrixWorld),v.direction.sub(s),v.direction.transformDirection(h),n++}else if(p.isSpotLight){var m=a.spot[i];m.position.setFromMatrixPosition(p.matrixWorld),m.position.applyMatrix4(h),m.direction.setFromMatrixPosition(p.matrixWorld),s.setFromMatrixPosition(p.target.matrixWorld),m.direction.sub(s),m.direction.transformDirection(h),i++}else if(p.isRectAreaLight){var g=a.rectArea[o];g.position.setFromMatrixPosition(p.matrixWorld),g.position.applyMatrix4(h),l.identity(),u.copy(p.matrixWorld),u.premultiply(h),l.extractRotation(u),g.halfWidth.set(.5*p.width,0,0),g.halfHeight.set(0,.5*p.height,0),g.halfWidth.applyMatrix4(l),g.halfHeight.applyMatrix4(l),o++}else if(p.isPointLight){var y=a.point[r];y.position.setFromMatrixPosition(p.matrixWorld),y.position.applyMatrix4(h),r++}else if(p.isHemisphereLight){var _=a.hemi[c];_.direction.setFromMatrixPosition(p.matrixWorld),_.direction.transformDirection(h),c++}}},state:a}}function Wu(e,t){var n=new Vu(e,t),r=[],i=[];return{init:function(){r.length=0,i.length=0},state:{lightsArray:r,shadowsArray:i,lights:n},setupLights:function(e){n.setup(r,e)},setupLightsView:function(e){n.setupView(r,e)},pushLight:function(e){r.push(e)},pushShadow:function(e){i.push(e)}}}function ju(e,t){var n=new WeakMap;return{get:function(r){var i,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,o=n.get(r);return void 0===o?(i=new Wu(e,t),n.set(r,[i])):a>=o.length?(i=new Wu(e,t),o.push(i)):i=o[a],i},dispose:function(){n=new WeakMap}}}var Xu=function(e){w(n,e);var t=E(n);function n(e){var r;return a(this,n),(r=t.call(this)).isMeshDepthMaterial=!0,r.type="MeshDepthMaterial",r.depthPacking=ln,r.map=null,r.alphaMap=null,r.displacementMap=null,r.displacementScale=1,r.displacementBias=0,r.wireframe=!1,r.wireframeLinewidth=1,r.setValues(e),r}return s(n,[{key:"copy",value:function(e){return y(x(n.prototype),"copy",this).call(this,e),this.depthPacking=e.depthPacking,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this}}]),n}(la),qu=function(e){w(n,e);var t=E(n);function n(e){var r;return a(this,n),(r=t.call(this)).isMeshDistanceMaterial=!0,r.type="MeshDistanceMaterial",r.map=null,r.alphaMap=null,r.displacementMap=null,r.displacementScale=1,r.displacementBias=0,r.setValues(e),r}return s(n,[{key:"copy",value:function(e){return y(x(n.prototype),"copy",this).call(this,e),this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}}]),n}(la);function Yu(e,t,n){var r,i=new Ao,a=new mr,o=new mr,s=new Br,u=new Xu({depthPacking:cn}),c=new qu,h={},d=n.maxTextureSize,f=(l(r={},z,H),l(r,H,z),l(r,G,G),r),p=new po({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new mr},radius:{value:4}},vertexShader:"void main() {\n\tgl_Position = vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D shadow_pass;\nuniform vec2 resolution;\nuniform float radius;\n#include <packing>\nvoid main() {\n\tconst float samples = float( VSM_SAMPLES );\n\tfloat mean = 0.0;\n\tfloat squared_mean = 0.0;\n\tfloat uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 );\n\tfloat uvStart = samples <= 1.0 ? 0.0 : - 1.0;\n\tfor ( float i = 0.0; i < samples; i ++ ) {\n\t\tfloat uvOffset = uvStart + i * uvStride;\n\t\t#ifdef HORIZONTAL_PASS\n\t\t\tvec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ) );\n\t\t\tmean += distribution.x;\n\t\t\tsquared_mean += distribution.y * distribution.y + distribution.x * distribution.x;\n\t\t#else\n\t\t\tfloat depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ) );\n\t\t\tmean += depth;\n\t\t\tsquared_mean += depth * depth;\n\t\t#endif\n\t}\n\tmean = mean / samples;\n\tsquared_mean = squared_mean / samples;\n\tfloat std_dev = sqrt( squared_mean - mean * mean );\n\tgl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );\n}"}),v=p.clone();v.defines.HORIZONTAL_PASS=1;var m=new Ga;m.setAttribute("position",new wa(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));var g=new oo(m,p),y=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=N;var _=this.type;function x(n,r){var i=t.update(g);p.defines.VSM_SAMPLES!==n.blurSamples&&(p.defines.VSM_SAMPLES=n.blurSamples,v.defines.VSM_SAMPLES=n.blurSamples,p.needsUpdate=!0,v.needsUpdate=!0),null===n.mapPass&&(n.mapPass=new Hr(a.x,a.y)),p.uniforms.shadow_pass.value=n.map.texture,p.uniforms.resolution.value=n.mapSize,p.uniforms.radius.value=n.radius,e.setRenderTarget(n.mapPass),e.clear(),e.renderBufferDirect(r,null,i,p,g,null),v.uniforms.shadow_pass.value=n.mapPass.texture,v.uniforms.resolution.value=n.mapSize,v.uniforms.radius.value=n.radius,e.setRenderTarget(n.map),e.clear(),e.renderBufferDirect(r,null,i,v,g,null)}function M(t,n,r,i){var a=null,o=!0===r.isPointLight?t.customDistanceMaterial:t.customDepthMaterial;if(void 0!==o)a=o;else if(a=!0===r.isPointLight?c:u,e.localClippingEnabled&&!0===n.clipShadows&&Array.isArray(n.clippingPlanes)&&0!==n.clippingPlanes.length||n.displacementMap&&0!==n.displacementScale||n.alphaMap&&n.alphaTest>0||n.map&&n.alphaTest>0){var s=a.uuid,l=n.uuid,d=h[s];void 0===d&&(d={},h[s]=d);var p=d[l];void 0===p&&(p=a.clone(),d[l]=p),a=p}(a.visible=n.visible,a.wireframe=n.wireframe,a.side=i===B?null!==n.shadowSide?n.shadowSide:n.side:null!==n.shadowSide?n.shadowSide:f[n.side],a.alphaMap=n.alphaMap,a.alphaTest=n.alphaTest,a.map=n.map,a.clipShadows=n.clipShadows,a.clippingPlanes=n.clippingPlanes,a.clipIntersection=n.clipIntersection,a.displacementMap=n.displacementMap,a.displacementScale=n.displacementScale,a.displacementBias=n.displacementBias,a.wireframeLinewidth=n.wireframeLinewidth,a.linewidth=n.linewidth,!0===r.isPointLight&&!0===a.isMeshDistanceMaterial)&&(e.properties.get(a).light=r);return a}function S(n,r,a,o,s){if(!1!==n.visible){if(n.layers.test(r.layers)&&(n.isMesh||n.isLine||n.isPoints)&&(n.castShadow||n.receiveShadow&&s===B)&&(!n.frustumCulled||i.intersectsObject(n))){n.modelViewMatrix.multiplyMatrices(a.matrixWorldInverse,n.matrixWorld);var u=t.update(n),l=n.material;if(Array.isArray(l))for(var c=u.groups,h=0,d=c.length;h<d;h++){var f=c[h],p=l[f.materialIndex];if(p&&p.visible){var v=M(n,p,o,s);e.renderBufferDirect(a,null,u,v,n,f)}}else if(l.visible){var m=M(n,l,o,s);e.renderBufferDirect(a,null,u,m,n,null)}}for(var g=n.children,y=0,_=g.length;y<_;y++)S(g[y],r,a,o,s)}}this.render=function(t,n,r){if(!1!==y.enabled&&(!1!==y.autoUpdate||!1!==y.needsUpdate)&&0!==t.length){var u=e.getRenderTarget(),l=e.getActiveCubeFace(),c=e.getActiveMipmapLevel(),h=e.state;h.setBlending(W),h.buffers.color.setClear(1,1,1,1),h.buffers.depth.setTest(!0),h.setScissorTest(!1);for(var f=_!==B&&this.type===B,p=_===B&&this.type!==B,v=0,m=t.length;v<m;v++){var g=t[v],M=g.shadow;if(void 0!==M){if(!1!==M.autoUpdate||!1!==M.needsUpdate){a.copy(M.mapSize);var b=M.getFrameExtents();if(a.multiply(b),o.copy(M.mapSize),(a.x>d||a.y>d)&&(a.x>d&&(o.x=Math.floor(d/b.x),a.x=o.x*b.x,M.mapSize.x=o.x),a.y>d&&(o.y=Math.floor(d/b.y),a.y=o.y*b.y,M.mapSize.y=o.y)),null===M.map||!0===f||!0===p){var w=this.type!==B?{minFilter:Fe,magFilter:Fe}:{};null!==M.map&&M.map.dispose(),M.map=new Hr(a.x,a.y,w),M.map.texture.name=g.name+".shadowMap",M.camera.updateProjectionMatrix()}e.setRenderTarget(M.map),e.clear();for(var T=M.getViewportCount(),E=0;E<T;E++){var A=M.getViewport(E);s.set(o.x*A.x,o.y*A.y,o.x*A.z,o.y*A.w),h.viewport(s),M.updateMatrices(g,E),i=M.getFrustum(),S(n,r,M.camera,g,this.type)}!0!==M.isPointLightShadow&&this.type===B&&x(M,r),M.needsUpdate=!1}}else console.warn("THREE.WebGLShadowMap:",g,"has no shadow.")}_=this.type,y.needsUpdate=!1,e.setRenderTarget(u,l,c)}}}function Zu(e,t,n){var r,i,a=n.isWebGL2;var o=new function(){var t=!1,n=new Br,r=null,i=new Br(0,0,0,0);return{setMask:function(n){r===n||t||(e.colorMask(n,n,n,n),r=n)},setLocked:function(e){t=e},setClear:function(t,r,a,o,s){!0===s&&(t*=o,r*=o,a*=o),n.set(t,r,a,o),!1===i.equals(n)&&(e.clearColor(t,r,a,o),i.copy(n))},reset:function(){t=!1,r=null,i.set(-1,0,0,0)}}},s=new function(){var t=!1,n=null,r=null,i=null;return{setTest:function(t){t?we(e.DEPTH_TEST):Te(e.DEPTH_TEST)},setMask:function(r){n===r||t||(e.depthMask(r),n=r)},setFunc:function(t){if(r!==t){switch(t){case de:e.depthFunc(e.NEVER);break;case fe:e.depthFunc(e.ALWAYS);break;case pe:e.depthFunc(e.LESS);break;case ve:e.depthFunc(e.LEQUAL);break;case me:e.depthFunc(e.EQUAL);break;case ge:e.depthFunc(e.GEQUAL);break;case ye:e.depthFunc(e.GREATER);break;case _e:e.depthFunc(e.NOTEQUAL);break;default:e.depthFunc(e.LEQUAL)}r=t}},setLocked:function(e){t=e},setClear:function(t){i!==t&&(e.clearDepth(t),i=t)},reset:function(){t=!1,n=null,r=null,i=null}}},u=new function(){var t=!1,n=null,r=null,i=null,a=null,o=null,s=null,u=null,l=null;return{setTest:function(n){t||(n?we(e.STENCIL_TEST):Te(e.STENCIL_TEST))},setMask:function(r){n===r||t||(e.stencilMask(r),n=r)},setFunc:function(t,n,o){r===t&&i===n&&a===o||(e.stencilFunc(t,n,o),r=t,i=n,a=o)},setOp:function(t,n,r){o===t&&s===n&&u===r||(e.stencilOp(t,n,r),o=t,s=n,u=r)},setLocked:function(e){t=e},setClear:function(t){l!==t&&(e.clearStencil(t),l=t)},reset:function(){t=!1,n=null,r=null,i=null,a=null,o=null,s=null,u=null,l=null}}},c=new WeakMap,h=new WeakMap,d={},f={},p=new WeakMap,v=[],m=null,g=!1,y=null,_=null,x=null,M=null,S=null,b=null,w=null,T=!1,E=null,A=null,R=null,k=null,C=null,L=e.getParameter(e.MAX_COMBINED_TEXTURE_IMAGE_UNITS),U=!1,O=0,N=e.getParameter(e.VERSION);-1!==N.indexOf("WebGL")?(O=parseFloat(/^WebGL (\d)/.exec(N)[1]),U=O>=1):-1!==N.indexOf("OpenGL ES")&&(O=parseFloat(/^OpenGL ES (\d)/.exec(N)[1]),U=O>=2);var F=null,B={},z=e.getParameter(e.SCISSOR_BOX),V=e.getParameter(e.VIEWPORT),xe=(new Br).fromArray(z),Me=(new Br).fromArray(V);function Se(t,n,r,i){var o=new Uint8Array(4),s=e.createTexture();e.bindTexture(t,s),e.texParameteri(t,e.TEXTURE_MIN_FILTER,e.NEAREST),e.texParameteri(t,e.TEXTURE_MAG_FILTER,e.NEAREST);for(var u=0;u<r;u++)!a||t!==e.TEXTURE_3D&&t!==e.TEXTURE_2D_ARRAY?e.texImage2D(n+u,0,e.RGBA,1,1,0,e.RGBA,e.UNSIGNED_BYTE,o):e.texImage3D(n,0,e.RGBA,1,1,i,0,e.RGBA,e.UNSIGNED_BYTE,o);return s}var be={};function we(t){!0!==d[t]&&(e.enable(t),d[t]=!0)}function Te(t){!1!==d[t]&&(e.disable(t),d[t]=!1)}be[e.TEXTURE_2D]=Se(e.TEXTURE_2D,e.TEXTURE_2D,1),be[e.TEXTURE_CUBE_MAP]=Se(e.TEXTURE_CUBE_MAP,e.TEXTURE_CUBE_MAP_POSITIVE_X,6),a&&(be[e.TEXTURE_2D_ARRAY]=Se(e.TEXTURE_2D_ARRAY,e.TEXTURE_2D_ARRAY,1,1),be[e.TEXTURE_3D]=Se(e.TEXTURE_3D,e.TEXTURE_3D,1,1)),o.setClear(0,0,0,1),s.setClear(1),u.setClear(0),we(e.DEPTH_TEST),s.setFunc(ve),Ce(!1),Le(I),we(e.CULL_FACE),ke(W);var Ee=(l(r={},K,e.FUNC_ADD),l(r,J,e.FUNC_SUBTRACT),l(r,Q,e.FUNC_REVERSE_SUBTRACT),r);if(a)Ee[$]=e.MIN,Ee[ee]=e.MAX;else{var Ae=t.get("EXT_blend_minmax");null!==Ae&&(Ee[$]=Ae.MIN_EXT,Ee[ee]=Ae.MAX_EXT)}var Re=(l(i={},te,e.ZERO),l(i,ne,e.ONE),l(i,re,e.SRC_COLOR),l(i,ae,e.SRC_ALPHA),l(i,he,e.SRC_ALPHA_SATURATE),l(i,le,e.DST_COLOR),l(i,se,e.DST_ALPHA),l(i,ie,e.ONE_MINUS_SRC_COLOR),l(i,oe,e.ONE_MINUS_SRC_ALPHA),l(i,ce,e.ONE_MINUS_DST_COLOR),l(i,ue,e.ONE_MINUS_DST_ALPHA),i);function ke(t,n,r,i,a,o,s,u){if(t!==W){if(!1===g&&(we(e.BLEND),g=!0),t===Z)a=a||n,o=o||r,s=s||i,n===_&&a===S||(e.blendEquationSeparate(Ee[n],Ee[a]),_=n,S=a),r===x&&i===M&&o===b&&s===w||(e.blendFuncSeparate(Re[r],Re[i],Re[o],Re[s]),x=r,M=i,b=o,w=s),y=t,T=!1;else if(t!==y||u!==T){if(_===K&&S===K||(e.blendEquation(e.FUNC_ADD),_=K,S=K),u)switch(t){case j:e.blendFuncSeparate(e.ONE,e.ONE_MINUS_SRC_ALPHA,e.ONE,e.ONE_MINUS_SRC_ALPHA);break;case X:e.blendFunc(e.ONE,e.ONE);break;case q:e.blendFuncSeparate(e.ZERO,e.ONE_MINUS_SRC_COLOR,e.ZERO,e.ONE);break;case Y:e.blendFuncSeparate(e.ZERO,e.SRC_COLOR,e.ZERO,e.SRC_ALPHA);break;default:console.error("THREE.WebGLState: Invalid blending: ",t)}else switch(t){case j:e.blendFuncSeparate(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA,e.ONE,e.ONE_MINUS_SRC_ALPHA);break;case X:e.blendFunc(e.SRC_ALPHA,e.ONE);break;case q:e.blendFuncSeparate(e.ZERO,e.ONE_MINUS_SRC_COLOR,e.ZERO,e.ONE);break;case Y:e.blendFunc(e.ZERO,e.SRC_COLOR);break;default:console.error("THREE.WebGLState: Invalid blending: ",t)}x=null,M=null,b=null,w=null,y=t,T=u}}else!0===g&&(Te(e.BLEND),g=!1)}function Ce(t){E!==t&&(t?e.frontFace(e.CW):e.frontFace(e.CCW),E=t)}function Le(t){t!==P?(we(e.CULL_FACE),t!==A&&(t===I?e.cullFace(e.BACK):t===D?e.cullFace(e.FRONT):e.cullFace(e.FRONT_AND_BACK))):Te(e.CULL_FACE),A=t}function Pe(t,n,r){t?(we(e.POLYGON_OFFSET_FILL),k===n&&C===r||(e.polygonOffset(n,r),k=n,C=r)):Te(e.POLYGON_OFFSET_FILL)}return{buffers:{color:o,depth:s,stencil:u},enable:we,disable:Te,bindFramebuffer:function(t,n){return f[t]!==n&&(e.bindFramebuffer(t,n),f[t]=n,a&&(t===e.DRAW_FRAMEBUFFER&&(f[e.FRAMEBUFFER]=n),t===e.FRAMEBUFFER&&(f[e.DRAW_FRAMEBUFFER]=n)),!0)},drawBuffers:function(r,i){var a=v,o=!1;if(r)if(void 0===(a=p.get(i))&&(a=[],p.set(i,a)),r.isWebGLMultipleRenderTargets){var s=r.texture;if(a.length!==s.length||a[0]!==e.COLOR_ATTACHMENT0){for(var u=0,l=s.length;u<l;u++)a[u]=e.COLOR_ATTACHMENT0+u;a.length=s.length,o=!0}}else a[0]!==e.COLOR_ATTACHMENT0&&(a[0]=e.COLOR_ATTACHMENT0,o=!0);else a[0]!==e.BACK&&(a[0]=e.BACK,o=!0);o&&(n.isWebGL2?e.drawBuffers(a):t.get("WEBGL_draw_buffers").drawBuffersWEBGL(a))},useProgram:function(t){return m!==t&&(e.useProgram(t),m=t,!0)},setBlending:ke,setMaterial:function(t,n){t.side===G?Te(e.CULL_FACE):we(e.CULL_FACE);var r=t.side===H;n&&(r=!r),Ce(r),t.blending===j&&!1===t.transparent?ke(W):ke(t.blending,t.blendEquation,t.blendSrc,t.blendDst,t.blendEquationAlpha,t.blendSrcAlpha,t.blendDstAlpha,t.premultipliedAlpha),s.setFunc(t.depthFunc),s.setTest(t.depthTest),s.setMask(t.depthWrite),o.setMask(t.colorWrite);var i=t.stencilWrite;u.setTest(i),i&&(u.setMask(t.stencilWriteMask),u.setFunc(t.stencilFunc,t.stencilRef,t.stencilFuncMask),u.setOp(t.stencilFail,t.stencilZFail,t.stencilZPass)),Pe(t.polygonOffset,t.polygonOffsetFactor,t.polygonOffsetUnits),!0===t.alphaToCoverage?we(e.SAMPLE_ALPHA_TO_COVERAGE):Te(e.SAMPLE_ALPHA_TO_COVERAGE)},setFlipSided:Ce,setCullFace:Le,setLineWidth:function(t){t!==R&&(U&&e.lineWidth(t),R=t)},setPolygonOffset:Pe,setScissorTest:function(t){t?we(e.SCISSOR_TEST):Te(e.SCISSOR_TEST)},activeTexture:function(t){void 0===t&&(t=e.TEXTURE0+L-1),F!==t&&(e.activeTexture(t),F=t)},bindTexture:function(t,n,r){void 0===r&&(r=null===F?e.TEXTURE0+L-1:F);var i=B[r];void 0===i&&(i={type:void 0,texture:void 0},B[r]=i),i.type===t&&i.texture===n||(F!==r&&(e.activeTexture(r),F=r),e.bindTexture(t,n||be[t]),i.type=t,i.texture=n)},unbindTexture:function(){var t=B[F];void 0!==t&&void 0!==t.type&&(e.bindTexture(t.type,null),t.type=void 0,t.texture=void 0)},compressedTexImage2D:function(){try{e.compressedTexImage2D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},compressedTexImage3D:function(){try{e.compressedTexImage3D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},texImage2D:function(){try{e.texImage2D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},texImage3D:function(){try{e.texImage3D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},updateUBOMapping:function(t,n){var r=h.get(n);void 0===r&&(r=new WeakMap,h.set(n,r));var i=r.get(t);void 0===i&&(i=e.getUniformBlockIndex(n,t.name),r.set(t,i))},uniformBlockBinding:function(t,n){var r=h.get(n).get(t);c.get(n)!==r&&(e.uniformBlockBinding(n,r,t.__bindingPointIndex),c.set(n,r))},texStorage2D:function(){try{e.texStorage2D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},texStorage3D:function(){try{e.texStorage3D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},texSubImage2D:function(){try{e.texSubImage2D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},texSubImage3D:function(){try{e.texSubImage3D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},compressedTexSubImage2D:function(){try{e.compressedTexSubImage2D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},compressedTexSubImage3D:function(){try{e.compressedTexSubImage3D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},scissor:function(t){!1===xe.equals(t)&&(e.scissor(t.x,t.y,t.z,t.w),xe.copy(t))},viewport:function(t){!1===Me.equals(t)&&(e.viewport(t.x,t.y,t.z,t.w),Me.copy(t))},reset:function(){e.disable(e.BLEND),e.disable(e.CULL_FACE),e.disable(e.DEPTH_TEST),e.disable(e.POLYGON_OFFSET_FILL),e.disable(e.SCISSOR_TEST),e.disable(e.STENCIL_TEST),e.disable(e.SAMPLE_ALPHA_TO_COVERAGE),e.blendEquation(e.FUNC_ADD),e.blendFunc(e.ONE,e.ZERO),e.blendFuncSeparate(e.ONE,e.ZERO,e.ONE,e.ZERO),e.colorMask(!0,!0,!0,!0),e.clearColor(0,0,0,0),e.depthMask(!0),e.depthFunc(e.LESS),e.clearDepth(1),e.stencilMask(4294967295),e.stencilFunc(e.ALWAYS,0,4294967295),e.stencilOp(e.KEEP,e.KEEP,e.KEEP),e.clearStencil(0),e.cullFace(e.BACK),e.frontFace(e.CCW),e.polygonOffset(0,0),e.activeTexture(e.TEXTURE0),e.bindFramebuffer(e.FRAMEBUFFER,null),!0===a&&(e.bindFramebuffer(e.DRAW_FRAMEBUFFER,null),e.bindFramebuffer(e.READ_FRAMEBUFFER,null)),e.useProgram(null),e.lineWidth(1),e.scissor(0,0,e.canvas.width,e.canvas.height),e.viewport(0,0,e.canvas.width,e.canvas.height),d={},F=null,B={},f={},p=new WeakMap,v=[],m=null,g=!1,y=null,_=null,x=null,M=null,S=null,b=null,w=null,T=!1,E=null,A=null,R=null,k=null,C=null,xe.set(0,0,e.canvas.width,e.canvas.height),Me.set(0,0,e.canvas.width,e.canvas.height),o.reset(),s.reset(),u.reset()}}}function Ku(e,t,n,r,i,a,o){var s,u,c,h,d=i.isWebGL2,f=i.maxTextures,p=i.maxCubemapSize,v=i.maxTextureSize,m=i.maxSamples,g=t.has("WEBGL_multisampled_render_to_texture")?t.get("WEBGL_multisampled_render_to_texture"):null,y="undefined"!=typeof navigator&&/OculusBrowser/g.test(navigator.userAgent),_=new WeakMap,x=new WeakMap,M=!1;try{M="undefined"!=typeof OffscreenCanvas&&null!==new OffscreenCanvas(1,1).getContext("2d")}catch(e){}function S(e,t){return M?new OffscreenCanvas(e,t):Sr("canvas")}function b(e,t,n,r){var i=1;if((e.width>r||e.height>r)&&(i=r/Math.max(e.width,e.height)),i<1||!0===t){if("undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap){var a=t?dr:Math.floor,o=a(i*e.width),s=a(i*e.height);void 0===h&&(h=S(o,s));var u=n?S(o,s):h;return u.width=o,u.height=s,u.getContext("2d").drawImage(e,0,0,o,s),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+e.width+"x"+e.height+") to ("+o+"x"+s+")."),u}return"data"in e&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+e.width+"x"+e.height+")."),e}return e}function w(e){return cr(e.width)&&cr(e.height)}function T(e,t){return e.generateMipmaps&&t&&e.minFilter!==Fe&&e.minFilter!==Ve}function E(t){e.generateMipmap(t)}function A(n,r,i,a){var o=arguments.length>4&&void 0!==arguments[4]&&arguments[4];if(!1===d)return r;if(null!==n){if(void 0!==e[n])return e[n];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+n+"'")}var s=r;return r===e.RED&&(i===e.FLOAT&&(s=e.R32F),i===e.HALF_FLOAT&&(s=e.R16F),i===e.UNSIGNED_BYTE&&(s=e.R8)),r===e.RED_INTEGER&&(i===e.UNSIGNED_BYTE&&(s=e.R8UI),i===e.UNSIGNED_SHORT&&(s=e.R16UI),i===e.UNSIGNED_INT&&(s=e.R32UI),i===e.BYTE&&(s=e.R8I),i===e.SHORT&&(s=e.R16I),i===e.INT&&(s=e.R32I)),r===e.RG&&(i===e.FLOAT&&(s=e.RG32F),i===e.HALF_FLOAT&&(s=e.RG16F),i===e.UNSIGNED_BYTE&&(s=e.RG8)),r===e.RGBA&&(i===e.FLOAT&&(s=e.RGBA32F),i===e.HALF_FLOAT&&(s=e.RGBA16F),i===e.UNSIGNED_BYTE&&(s=a===pn&&!1===o?e.SRGB8_ALPHA8:e.RGBA8),i===e.UNSIGNED_SHORT_4_4_4_4&&(s=e.RGBA4),i===e.UNSIGNED_SHORT_5_5_5_1&&(s=e.RGB5_A1)),s!==e.R16F&&s!==e.R32F&&s!==e.RG16F&&s!==e.RG32F&&s!==e.RGBA16F&&s!==e.RGBA32F||t.get("EXT_color_buffer_float"),s}function R(e,t,n){return!0===T(e,n)||e.isFramebufferTexture&&e.minFilter!==Fe&&e.minFilter!==Ve?Math.log2(Math.max(t.width,t.height))+1:void 0!==e.mipmaps&&e.mipmaps.length>0?e.mipmaps.length:e.isCompressedTexture&&Array.isArray(e.image)?t.mipmaps.length:1}function k(t){return t===Fe||t===Be||t===He?e.NEAREST:e.LINEAR}function C(e){var t=e.target;t.removeEventListener("dispose",C),function(e){var t=r.get(e);if(void 0===t.__webglInit)return;var n=e.source,i=x.get(n);if(i){var a=i[t.__cacheKey];a.usedTimes--,0===a.usedTimes&&P(e),0===Object.keys(i).length&&x.delete(n)}r.remove(e)}(t),t.isVideoTexture&&_.delete(t)}function L(t){var n=t.target;n.removeEventListener("dispose",L),function(t){var n=t.texture,i=r.get(t),a=r.get(n);void 0!==a.__webglTexture&&(e.deleteTexture(a.__webglTexture),o.memory.textures--);t.depthTexture&&t.depthTexture.dispose();if(t.isWebGLCubeRenderTarget)for(var s=0;s<6;s++){if(Array.isArray(i.__webglFramebuffer[s]))for(var u=0;u<i.__webglFramebuffer[s].length;u++)e.deleteFramebuffer(i.__webglFramebuffer[s][u]);else e.deleteFramebuffer(i.__webglFramebuffer[s]);i.__webglDepthbuffer&&e.deleteRenderbuffer(i.__webglDepthbuffer[s])}else{if(Array.isArray(i.__webglFramebuffer))for(var l=0;l<i.__webglFramebuffer.length;l++)e.deleteFramebuffer(i.__webglFramebuffer[l]);else e.deleteFramebuffer(i.__webglFramebuffer);if(i.__webglDepthbuffer&&e.deleteRenderbuffer(i.__webglDepthbuffer),i.__webglMultisampledFramebuffer&&e.deleteFramebuffer(i.__webglMultisampledFramebuffer),i.__webglColorRenderbuffer)for(var c=0;c<i.__webglColorRenderbuffer.length;c++)i.__webglColorRenderbuffer[c]&&e.deleteRenderbuffer(i.__webglColorRenderbuffer[c]);i.__webglDepthRenderbuffer&&e.deleteRenderbuffer(i.__webglDepthRenderbuffer)}if(t.isWebGLMultipleRenderTargets)for(var h=0,d=n.length;h<d;h++){var f=r.get(n[h]);f.__webglTexture&&(e.deleteTexture(f.__webglTexture),o.memory.textures--),r.remove(n[h])}r.remove(n),r.remove(t)}(n)}function P(t){var n=r.get(t);e.deleteTexture(n.__webglTexture);var i=t.source;delete x.get(i)[n.__cacheKey],o.memory.textures--}var I=0;function D(t,i){var a=r.get(t);if(t.isVideoTexture&&function(e){var t=o.render.frame;_.get(e)!==t&&(_.set(e,t),e.update())}(t),!1===t.isRenderTargetTexture&&t.version>0&&a.__version!==t.version){var s=t.image;if(null===s)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else{if(!1!==s.complete)return void z(a,t,i);console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete")}}n.bindTexture(e.TEXTURE_2D,a.__webglTexture,e.TEXTURE0+i)}var U=(l(s={},Ue,e.REPEAT),l(s,Oe,e.CLAMP_TO_EDGE),l(s,Ne,e.MIRRORED_REPEAT),s),O=(l(u={},Fe,e.NEAREST),l(u,Be,e.NEAREST_MIPMAP_NEAREST),l(u,He,e.NEAREST_MIPMAP_LINEAR),l(u,Ve,e.LINEAR),l(u,We,e.LINEAR_MIPMAP_NEAREST),l(u,Xe,e.LINEAR_MIPMAP_LINEAR),u),N=(l(c={},In,e.NEVER),l(c,zn,e.ALWAYS),l(c,Dn,e.LESS),l(c,On,e.LEQUAL),l(c,Un,e.EQUAL),l(c,Bn,e.GEQUAL),l(c,Nn,e.GREATER),l(c,Fn,e.NOTEQUAL),c);function F(n,a,o){if(o?(e.texParameteri(n,e.TEXTURE_WRAP_S,U[a.wrapS]),e.texParameteri(n,e.TEXTURE_WRAP_T,U[a.wrapT]),n!==e.TEXTURE_3D&&n!==e.TEXTURE_2D_ARRAY||e.texParameteri(n,e.TEXTURE_WRAP_R,U[a.wrapR]),e.texParameteri(n,e.TEXTURE_MAG_FILTER,O[a.magFilter]),e.texParameteri(n,e.TEXTURE_MIN_FILTER,O[a.minFilter])):(e.texParameteri(n,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(n,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),n!==e.TEXTURE_3D&&n!==e.TEXTURE_2D_ARRAY||e.texParameteri(n,e.TEXTURE_WRAP_R,e.CLAMP_TO_EDGE),a.wrapS===Oe&&a.wrapT===Oe||console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),e.texParameteri(n,e.TEXTURE_MAG_FILTER,k(a.magFilter)),e.texParameteri(n,e.TEXTURE_MIN_FILTER,k(a.minFilter)),a.minFilter!==Fe&&a.minFilter!==Ve&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.")),a.compareFunction&&(e.texParameteri(n,e.TEXTURE_COMPARE_MODE,e.COMPARE_REF_TO_TEXTURE),e.texParameteri(n,e.TEXTURE_COMPARE_FUNC,N[a.compareFunction])),!0===t.has("EXT_texture_filter_anisotropic")){var s=t.get("EXT_texture_filter_anisotropic");if(a.magFilter===Fe)return;if(a.minFilter!==He&&a.minFilter!==Xe)return;if(a.type===et&&!1===t.has("OES_texture_float_linear"))return;if(!1===d&&a.type===tt&&!1===t.has("OES_texture_half_float_linear"))return;(a.anisotropy>1||r.get(a).__currentAnisotropy)&&(e.texParameterf(n,s.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(a.anisotropy,i.getMaxAnisotropy())),r.get(a).__currentAnisotropy=a.anisotropy)}}function B(t,n){var r=!1;void 0===t.__webglInit&&(t.__webglInit=!0,n.addEventListener("dispose",C));var i=n.source,a=x.get(i);void 0===a&&(a={},x.set(i,a));var s=function(e){var t=[];return t.push(e.wrapS),t.push(e.wrapT),t.push(e.wrapR||0),t.push(e.magFilter),t.push(e.minFilter),t.push(e.anisotropy),t.push(e.internalFormat),t.push(e.format),t.push(e.type),t.push(e.generateMipmaps),t.push(e.premultiplyAlpha),t.push(e.flipY),t.push(e.unpackAlignment),t.push(e.colorSpace),t.join()}(n);if(s!==t.__cacheKey){void 0===a[s]&&(a[s]={texture:e.createTexture(),usedTimes:0},o.memory.textures++,r=!0),a[s].usedTimes++;var u=a[t.__cacheKey];void 0!==u&&(a[t.__cacheKey].usedTimes--,0===u.usedTimes&&P(n)),t.__cacheKey=s,t.__webglTexture=a[s].texture}return r}function z(t,i,o){var s=e.TEXTURE_2D;(i.isDataArrayTexture||i.isCompressedArrayTexture)&&(s=e.TEXTURE_2D_ARRAY),i.isData3DTexture&&(s=e.TEXTURE_3D);var u=B(t,i),l=i.source;n.bindTexture(s,t.__webglTexture,e.TEXTURE0+o);var c=r.get(l);if(l.version!==c.__version||!0===u){n.activeTexture(e.TEXTURE0+o),e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,i.flipY),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,i.premultiplyAlpha),e.pixelStorei(e.UNPACK_ALIGNMENT,i.unpackAlignment),e.pixelStorei(e.UNPACK_COLORSPACE_CONVERSION_WEBGL,e.NONE);var h,f=function(e){return!d&&(e.wrapS!==Oe||e.wrapT!==Oe||e.minFilter!==Fe&&e.minFilter!==Ve)}(i)&&!1===w(i.image),p=b(i.image,f,!1,v),m=w(p=X(i,p))||d,g=a.convert(i.format,i.colorSpace),y=a.convert(i.type),_=A(i.internalFormat,g,y,i.colorSpace);F(s,i,m);var x=i.mipmaps,M=d&&!0!==i.isVideoTexture,S=void 0===c.__version||!0===u,k=R(i,p,m);if(i.isDepthTexture)_=e.DEPTH_COMPONENT,d?_=i.type===et?e.DEPTH_COMPONENT32F:i.type===$e?e.DEPTH_COMPONENT24:i.type===it?e.DEPTH24_STENCIL8:e.DEPTH_COMPONENT16:i.type===et&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),i.format===lt&&_===e.DEPTH_COMPONENT&&i.type!==Je&&i.type!==$e&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),i.type=$e,y=a.convert(i.type)),i.format===ct&&_===e.DEPTH_COMPONENT&&(_=e.DEPTH_STENCIL,i.type!==it&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),i.type=it,y=a.convert(i.type))),S&&(M?n.texStorage2D(e.TEXTURE_2D,1,_,p.width,p.height):n.texImage2D(e.TEXTURE_2D,0,_,p.width,p.height,0,g,y,null));else if(i.isDataTexture)if(x.length>0&&m){M&&S&&n.texStorage2D(e.TEXTURE_2D,k,_,x[0].width,x[0].height);for(var C=0,L=x.length;C<L;C++)h=x[C],M?n.texSubImage2D(e.TEXTURE_2D,C,0,0,h.width,h.height,g,y,h.data):n.texImage2D(e.TEXTURE_2D,C,_,h.width,h.height,0,g,y,h.data);i.generateMipmaps=!1}else M?(S&&n.texStorage2D(e.TEXTURE_2D,k,_,p.width,p.height),n.texSubImage2D(e.TEXTURE_2D,0,0,0,p.width,p.height,g,y,p.data)):n.texImage2D(e.TEXTURE_2D,0,_,p.width,p.height,0,g,y,p.data);else if(i.isCompressedTexture)if(i.isCompressedArrayTexture){M&&S&&n.texStorage3D(e.TEXTURE_2D_ARRAY,k,_,x[0].width,x[0].height,p.depth);for(var P=0,I=x.length;P<I;P++)h=x[P],i.format!==ot?null!==g?M?n.compressedTexSubImage3D(e.TEXTURE_2D_ARRAY,P,0,0,0,h.width,h.height,p.depth,g,h.data,0,0):n.compressedTexImage3D(e.TEXTURE_2D_ARRAY,P,_,h.width,h.height,p.depth,0,h.data,0,0):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):M?n.texSubImage3D(e.TEXTURE_2D_ARRAY,P,0,0,0,h.width,h.height,p.depth,g,y,h.data):n.texImage3D(e.TEXTURE_2D_ARRAY,P,_,h.width,h.height,p.depth,0,g,y,h.data)}else{M&&S&&n.texStorage2D(e.TEXTURE_2D,k,_,x[0].width,x[0].height);for(var D=0,U=x.length;D<U;D++)h=x[D],i.format!==ot?null!==g?M?n.compressedTexSubImage2D(e.TEXTURE_2D,D,0,0,h.width,h.height,g,h.data):n.compressedTexImage2D(e.TEXTURE_2D,D,_,h.width,h.height,0,h.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):M?n.texSubImage2D(e.TEXTURE_2D,D,0,0,h.width,h.height,g,y,h.data):n.texImage2D(e.TEXTURE_2D,D,_,h.width,h.height,0,g,y,h.data)}else if(i.isDataArrayTexture)M?(S&&n.texStorage3D(e.TEXTURE_2D_ARRAY,k,_,p.width,p.height,p.depth),n.texSubImage3D(e.TEXTURE_2D_ARRAY,0,0,0,0,p.width,p.height,p.depth,g,y,p.data)):n.texImage3D(e.TEXTURE_2D_ARRAY,0,_,p.width,p.height,p.depth,0,g,y,p.data);else if(i.isData3DTexture)M?(S&&n.texStorage3D(e.TEXTURE_3D,k,_,p.width,p.height,p.depth),n.texSubImage3D(e.TEXTURE_3D,0,0,0,0,p.width,p.height,p.depth,g,y,p.data)):n.texImage3D(e.TEXTURE_3D,0,_,p.width,p.height,p.depth,0,g,y,p.data);else if(i.isFramebufferTexture){if(S)if(M)n.texStorage2D(e.TEXTURE_2D,k,_,p.width,p.height);else for(var O=p.width,N=p.height,z=0;z<k;z++)n.texImage2D(e.TEXTURE_2D,z,_,O,N,0,g,y,null),O>>=1,N>>=1}else if(x.length>0&&m){M&&S&&n.texStorage2D(e.TEXTURE_2D,k,_,x[0].width,x[0].height);for(var H=0,G=x.length;H<G;H++)h=x[H],M?n.texSubImage2D(e.TEXTURE_2D,H,0,0,g,y,h):n.texImage2D(e.TEXTURE_2D,H,_,g,y,h);i.generateMipmaps=!1}else M?(S&&n.texStorage2D(e.TEXTURE_2D,k,_,p.width,p.height),n.texSubImage2D(e.TEXTURE_2D,0,0,0,g,y,p)):n.texImage2D(e.TEXTURE_2D,0,_,g,y,p);T(i,m)&&E(s),c.__version=l.version,i.onUpdate&&i.onUpdate(i)}t.__version=i.version}function H(t,i,o,s,u,l){var c=a.convert(o.format,o.colorSpace),h=a.convert(o.type),d=A(o.internalFormat,c,h,o.colorSpace);if(!r.get(i).__hasExternalTextures){var f=Math.max(1,i.width>>l),p=Math.max(1,i.height>>l);u===e.TEXTURE_3D||u===e.TEXTURE_2D_ARRAY?n.texImage3D(u,l,d,f,p,i.depth,0,c,h,null):n.texImage2D(u,l,d,f,p,0,c,h,null)}n.bindFramebuffer(e.FRAMEBUFFER,t),j(i)?g.framebufferTexture2DMultisampleEXT(e.FRAMEBUFFER,s,u,r.get(o).__webglTexture,0,W(i)):(u===e.TEXTURE_2D||u>=e.TEXTURE_CUBE_MAP_POSITIVE_X&&u<=e.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&e.framebufferTexture2D(e.FRAMEBUFFER,s,u,r.get(o).__webglTexture,l),n.bindFramebuffer(e.FRAMEBUFFER,null)}function G(t,n,r){if(e.bindRenderbuffer(e.RENDERBUFFER,t),n.depthBuffer&&!n.stencilBuffer){var i=e.DEPTH_COMPONENT16;if(r||j(n)){var o=n.depthTexture;o&&o.isDepthTexture&&(o.type===et?i=e.DEPTH_COMPONENT32F:o.type===$e&&(i=e.DEPTH_COMPONENT24));var s=W(n);j(n)?g.renderbufferStorageMultisampleEXT(e.RENDERBUFFER,s,i,n.width,n.height):e.renderbufferStorageMultisample(e.RENDERBUFFER,s,i,n.width,n.height)}else e.renderbufferStorage(e.RENDERBUFFER,i,n.width,n.height);e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.RENDERBUFFER,t)}else if(n.depthBuffer&&n.stencilBuffer){var u=W(n);r&&!1===j(n)?e.renderbufferStorageMultisample(e.RENDERBUFFER,u,e.DEPTH24_STENCIL8,n.width,n.height):j(n)?g.renderbufferStorageMultisampleEXT(e.RENDERBUFFER,u,e.DEPTH24_STENCIL8,n.width,n.height):e.renderbufferStorage(e.RENDERBUFFER,e.DEPTH_STENCIL,n.width,n.height),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_STENCIL_ATTACHMENT,e.RENDERBUFFER,t)}else for(var l=!0===n.isWebGLMultipleRenderTargets?n.texture:[n.texture],c=0;c<l.length;c++){var h=l[c],d=a.convert(h.format,h.colorSpace),f=a.convert(h.type),p=A(h.internalFormat,d,f,h.colorSpace),v=W(n);r&&!1===j(n)?e.renderbufferStorageMultisample(e.RENDERBUFFER,v,p,n.width,n.height):j(n)?g.renderbufferStorageMultisampleEXT(e.RENDERBUFFER,v,p,n.width,n.height):e.renderbufferStorage(e.RENDERBUFFER,p,n.width,n.height)}e.bindRenderbuffer(e.RENDERBUFFER,null)}function V(t){var i=r.get(t),a=!0===t.isWebGLCubeRenderTarget;if(t.depthTexture&&!i.__autoAllocateDepthBuffer){if(a)throw new Error("target.depthTexture not supported in Cube render targets");!function(t,i){if(i&&i.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(n.bindFramebuffer(e.FRAMEBUFFER,t),!i.depthTexture||!i.depthTexture.isDepthTexture)throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");r.get(i.depthTexture).__webglTexture&&i.depthTexture.image.width===i.width&&i.depthTexture.image.height===i.height||(i.depthTexture.image.width=i.width,i.depthTexture.image.height=i.height,i.depthTexture.needsUpdate=!0),D(i.depthTexture,0);var a=r.get(i.depthTexture).__webglTexture,o=W(i);if(i.depthTexture.format===lt)j(i)?g.framebufferTexture2DMultisampleEXT(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.TEXTURE_2D,a,0,o):e.framebufferTexture2D(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.TEXTURE_2D,a,0);else{if(i.depthTexture.format!==ct)throw new Error("Unknown depthTexture format");j(i)?g.framebufferTexture2DMultisampleEXT(e.FRAMEBUFFER,e.DEPTH_STENCIL_ATTACHMENT,e.TEXTURE_2D,a,0,o):e.framebufferTexture2D(e.FRAMEBUFFER,e.DEPTH_STENCIL_ATTACHMENT,e.TEXTURE_2D,a,0)}}(i.__webglFramebuffer,t)}else if(a){i.__webglDepthbuffer=[];for(var o=0;o<6;o++)n.bindFramebuffer(e.FRAMEBUFFER,i.__webglFramebuffer[o]),i.__webglDepthbuffer[o]=e.createRenderbuffer(),G(i.__webglDepthbuffer[o],t,!1)}else n.bindFramebuffer(e.FRAMEBUFFER,i.__webglFramebuffer),i.__webglDepthbuffer=e.createRenderbuffer(),G(i.__webglDepthbuffer,t,!1);n.bindFramebuffer(e.FRAMEBUFFER,null)}function W(e){return Math.min(m,e.samples)}function j(e){var n=r.get(e);return d&&e.samples>0&&!0===t.has("WEBGL_multisampled_render_to_texture")&&!1!==n.__useRenderToTexture}function X(e,n){var r=e.colorSpace,i=e.format,a=e.type;return!0===e.isCompressedTexture||e.format===Qn||r!==vn&&r!==fn&&(r===pn?!1===d?!0===t.has("EXT_sRGB")&&i===ot?(e.format=Qn,e.minFilter=Ve,e.generateMipmaps=!1):n=Ir.sRGBToLinear(n):i===ot&&a===Ye||console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",r)),n}this.allocateTextureUnit=function(){var e=I;return e>=f&&console.warn("THREE.WebGLTextures: Trying to use "+e+" texture units while this GPU supports only "+f),I+=1,e},this.resetTextureUnits=function(){I=0},this.setTexture2D=D,this.setTexture2DArray=function(t,i){var a=r.get(t);t.version>0&&a.__version!==t.version?z(a,t,i):n.bindTexture(e.TEXTURE_2D_ARRAY,a.__webglTexture,e.TEXTURE0+i)},this.setTexture3D=function(t,i){var a=r.get(t);t.version>0&&a.__version!==t.version?z(a,t,i):n.bindTexture(e.TEXTURE_3D,a.__webglTexture,e.TEXTURE0+i)},this.setTextureCube=function(t,i){var o=r.get(t);t.version>0&&o.__version!==t.version?function(t,i,o){if(6!==i.image.length)return;var s=B(t,i),u=i.source;n.bindTexture(e.TEXTURE_CUBE_MAP,t.__webglTexture,e.TEXTURE0+o);var l=r.get(u);if(u.version!==l.__version||!0===s){n.activeTexture(e.TEXTURE0+o),e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,i.flipY),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,i.premultiplyAlpha),e.pixelStorei(e.UNPACK_ALIGNMENT,i.unpackAlignment),e.pixelStorei(e.UNPACK_COLORSPACE_CONVERSION_WEBGL,e.NONE);for(var c=i.isCompressedTexture||i.image[0].isCompressedTexture,h=i.image[0]&&i.image[0].isDataTexture,f=[],v=0;v<6;v++)f[v]=c||h?h?i.image[v].image:i.image[v]:b(i.image[v],!1,!0,p),f[v]=X(i,f[v]);var m,g=f[0],y=w(g)||d,_=a.convert(i.format,i.colorSpace),x=a.convert(i.type),M=A(i.internalFormat,_,x,i.colorSpace),S=d&&!0!==i.isVideoTexture,k=void 0===l.__version||!0===s,C=R(i,g,y);if(F(e.TEXTURE_CUBE_MAP,i,y),c){S&&k&&n.texStorage2D(e.TEXTURE_CUBE_MAP,C,M,g.width,g.height);for(var L=0;L<6;L++){m=f[L].mipmaps;for(var P=0;P<m.length;P++){var I=m[P];i.format!==ot?null!==_?S?n.compressedTexSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+L,P,0,0,I.width,I.height,_,I.data):n.compressedTexImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+L,P,M,I.width,I.height,0,I.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):S?n.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+L,P,0,0,I.width,I.height,_,x,I.data):n.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+L,P,M,I.width,I.height,0,_,x,I.data)}}}else{m=i.mipmaps,S&&k&&(m.length>0&&C++,n.texStorage2D(e.TEXTURE_CUBE_MAP,C,M,f[0].width,f[0].height));for(var D=0;D<6;D++)if(h){S?n.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+D,0,0,0,f[D].width,f[D].height,_,x,f[D].data):n.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+D,0,M,f[D].width,f[D].height,0,_,x,f[D].data);for(var U=0;U<m.length;U++){var O=m[U].image[D].image;S?n.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+D,U+1,0,0,O.width,O.height,_,x,O.data):n.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+D,U+1,M,O.width,O.height,0,_,x,O.data)}}else{S?n.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+D,0,0,0,_,x,f[D]):n.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+D,0,M,_,x,f[D]);for(var N=0;N<m.length;N++){var z=m[N];S?n.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+D,N+1,0,0,_,x,z.image[D]):n.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+D,N+1,M,_,x,z.image[D])}}}T(i,y)&&E(e.TEXTURE_CUBE_MAP),l.__version=u.version,i.onUpdate&&i.onUpdate(i)}t.__version=i.version}(o,t,i):n.bindTexture(e.TEXTURE_CUBE_MAP,o.__webglTexture,e.TEXTURE0+i)},this.rebindTextures=function(t,n,i){var a=r.get(t);void 0!==n&&H(a.__webglFramebuffer,t,t.texture,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,0),void 0!==i&&V(t)},this.setupRenderTarget=function(t){var s=t.texture,u=r.get(t),l=r.get(s);t.addEventListener("dispose",L),!0!==t.isWebGLMultipleRenderTargets&&(void 0===l.__webglTexture&&(l.__webglTexture=e.createTexture()),l.__version=s.version,o.memory.textures++);var c=!0===t.isWebGLCubeRenderTarget,h=!0===t.isWebGLMultipleRenderTargets,f=w(t)||d;if(c){u.__webglFramebuffer=[];for(var p=0;p<6;p++)if(d&&s.mipmaps&&s.mipmaps.length>0){u.__webglFramebuffer[p]=[];for(var v=0;v<s.mipmaps.length;v++)u.__webglFramebuffer[p][v]=e.createFramebuffer()}else u.__webglFramebuffer[p]=e.createFramebuffer()}else{if(d&&s.mipmaps&&s.mipmaps.length>0){u.__webglFramebuffer=[];for(var m=0;m<s.mipmaps.length;m++)u.__webglFramebuffer[m]=e.createFramebuffer()}else u.__webglFramebuffer=e.createFramebuffer();if(h)if(i.drawBuffers)for(var g=t.texture,y=0,_=g.length;y<_;y++){var x=r.get(g[y]);void 0===x.__webglTexture&&(x.__webglTexture=e.createTexture(),o.memory.textures++)}else console.warn("THREE.WebGLRenderer: WebGLMultipleRenderTargets can only be used with WebGL2 or WEBGL_draw_buffers extension.");if(d&&t.samples>0&&!1===j(t)){var M=h?s:[s];u.__webglMultisampledFramebuffer=e.createFramebuffer(),u.__webglColorRenderbuffer=[],n.bindFramebuffer(e.FRAMEBUFFER,u.__webglMultisampledFramebuffer);for(var S=0;S<M.length;S++){var b=M[S];u.__webglColorRenderbuffer[S]=e.createRenderbuffer(),e.bindRenderbuffer(e.RENDERBUFFER,u.__webglColorRenderbuffer[S]);var R=a.convert(b.format,b.colorSpace),k=a.convert(b.type),C=A(b.internalFormat,R,k,b.colorSpace,!0===t.isXRRenderTarget),P=W(t);e.renderbufferStorageMultisample(e.RENDERBUFFER,P,C,t.width,t.height),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0+S,e.RENDERBUFFER,u.__webglColorRenderbuffer[S])}e.bindRenderbuffer(e.RENDERBUFFER,null),t.depthBuffer&&(u.__webglDepthRenderbuffer=e.createRenderbuffer(),G(u.__webglDepthRenderbuffer,t,!0)),n.bindFramebuffer(e.FRAMEBUFFER,null)}}if(c){n.bindTexture(e.TEXTURE_CUBE_MAP,l.__webglTexture),F(e.TEXTURE_CUBE_MAP,s,f);for(var I=0;I<6;I++)if(d&&s.mipmaps&&s.mipmaps.length>0)for(var D=0;D<s.mipmaps.length;D++)H(u.__webglFramebuffer[I][D],t,s,e.COLOR_ATTACHMENT0,e.TEXTURE_CUBE_MAP_POSITIVE_X+I,D);else H(u.__webglFramebuffer[I],t,s,e.COLOR_ATTACHMENT0,e.TEXTURE_CUBE_MAP_POSITIVE_X+I,0);T(s,f)&&E(e.TEXTURE_CUBE_MAP),n.unbindTexture()}else if(h){for(var U=t.texture,O=0,N=U.length;O<N;O++){var B=U[O],z=r.get(B);n.bindTexture(e.TEXTURE_2D,z.__webglTexture),F(e.TEXTURE_2D,B,f),H(u.__webglFramebuffer,t,B,e.COLOR_ATTACHMENT0+O,e.TEXTURE_2D,0),T(B,f)&&E(e.TEXTURE_2D)}n.unbindTexture()}else{var X=e.TEXTURE_2D;if((t.isWebGL3DRenderTarget||t.isWebGLArrayRenderTarget)&&(d?X=t.isWebGL3DRenderTarget?e.TEXTURE_3D:e.TEXTURE_2D_ARRAY:console.error("THREE.WebGLTextures: THREE.Data3DTexture and THREE.DataArrayTexture only supported with WebGL2.")),n.bindTexture(X,l.__webglTexture),F(X,s,f),d&&s.mipmaps&&s.mipmaps.length>0)for(var q=0;q<s.mipmaps.length;q++)H(u.__webglFramebuffer[q],t,s,e.COLOR_ATTACHMENT0,X,q);else H(u.__webglFramebuffer,t,s,e.COLOR_ATTACHMENT0,X,0);T(s,f)&&E(X),n.unbindTexture()}t.depthBuffer&&V(t)},this.updateRenderTargetMipmap=function(t){for(var i=w(t)||d,a=!0===t.isWebGLMultipleRenderTargets?t.texture:[t.texture],o=0,s=a.length;o<s;o++){var u=a[o];if(T(u,i)){var l=t.isWebGLCubeRenderTarget?e.TEXTURE_CUBE_MAP:e.TEXTURE_2D,c=r.get(u).__webglTexture;n.bindTexture(l,c),E(l),n.unbindTexture()}}},this.updateMultisampleRenderTarget=function(t){if(d&&t.samples>0&&!1===j(t)){var i=t.isWebGLMultipleRenderTargets?t.texture:[t.texture],a=t.width,o=t.height,s=e.COLOR_BUFFER_BIT,u=[],l=t.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,c=r.get(t),h=!0===t.isWebGLMultipleRenderTargets;if(h)for(var f=0;f<i.length;f++)n.bindFramebuffer(e.FRAMEBUFFER,c.__webglMultisampledFramebuffer),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0+f,e.RENDERBUFFER,null),n.bindFramebuffer(e.FRAMEBUFFER,c.__webglFramebuffer),e.framebufferTexture2D(e.DRAW_FRAMEBUFFER,e.COLOR_ATTACHMENT0+f,e.TEXTURE_2D,null,0);n.bindFramebuffer(e.READ_FRAMEBUFFER,c.__webglMultisampledFramebuffer),n.bindFramebuffer(e.DRAW_FRAMEBUFFER,c.__webglFramebuffer);for(var p=0;p<i.length;p++){u.push(e.COLOR_ATTACHMENT0+p),t.depthBuffer&&u.push(l);var v=void 0!==c.__ignoreDepthValues&&c.__ignoreDepthValues;if(!1===v&&(t.depthBuffer&&(s|=e.DEPTH_BUFFER_BIT),t.stencilBuffer&&(s|=e.STENCIL_BUFFER_BIT)),h&&e.framebufferRenderbuffer(e.READ_FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.RENDERBUFFER,c.__webglColorRenderbuffer[p]),!0===v&&(e.invalidateFramebuffer(e.READ_FRAMEBUFFER,[l]),e.invalidateFramebuffer(e.DRAW_FRAMEBUFFER,[l])),h){var m=r.get(i[p]).__webglTexture;e.framebufferTexture2D(e.DRAW_FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,m,0)}e.blitFramebuffer(0,0,a,o,0,0,a,o,s,e.NEAREST),y&&e.invalidateFramebuffer(e.READ_FRAMEBUFFER,u)}if(n.bindFramebuffer(e.READ_FRAMEBUFFER,null),n.bindFramebuffer(e.DRAW_FRAMEBUFFER,null),h)for(var g=0;g<i.length;g++){n.bindFramebuffer(e.FRAMEBUFFER,c.__webglMultisampledFramebuffer),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0+g,e.RENDERBUFFER,c.__webglColorRenderbuffer[g]);var _=r.get(i[g]).__webglTexture;n.bindFramebuffer(e.FRAMEBUFFER,c.__webglFramebuffer),e.framebufferTexture2D(e.DRAW_FRAMEBUFFER,e.COLOR_ATTACHMENT0+g,e.TEXTURE_2D,_,0)}n.bindFramebuffer(e.DRAW_FRAMEBUFFER,c.__webglMultisampledFramebuffer)}},this.setupDepthRenderbuffer=V,this.setupFrameBufferTexture=H,this.useMultisampledRTT=j}function Ju(e,t,n){var r=n.isWebGL2;return{convert:function(n){var i,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:fn;if(n===Ye)return e.UNSIGNED_BYTE;if(n===nt)return e.UNSIGNED_SHORT_4_4_4_4;if(n===rt)return e.UNSIGNED_SHORT_5_5_5_1;if(n===Ze)return e.BYTE;if(n===Ke)return e.SHORT;if(n===Je)return e.UNSIGNED_SHORT;if(n===Qe)return e.INT;if(n===$e)return e.UNSIGNED_INT;if(n===et)return e.FLOAT;if(n===tt)return r?e.HALF_FLOAT:null!==(i=t.get("OES_texture_half_float"))?i.HALF_FLOAT_OES:null;if(n===at)return e.ALPHA;if(n===ot)return e.RGBA;if(n===st)return e.LUMINANCE;if(n===ut)return e.LUMINANCE_ALPHA;if(n===lt)return e.DEPTH_COMPONENT;if(n===ct)return e.DEPTH_STENCIL;if(n===Qn)return null!==(i=t.get("EXT_sRGB"))?i.SRGB_ALPHA_EXT:null;if(n===ht)return e.RED;if(n===dt)return e.RED_INTEGER;if(n===ft)return e.RG;if(n===pt)return e.RG_INTEGER;if(n===vt)return e.RGBA_INTEGER;if(n===mt||n===gt||n===yt||n===_t)if(a===pn){if(null===(i=t.get("WEBGL_compressed_texture_s3tc_srgb")))return null;if(n===mt)return i.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(n===gt)return i.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(n===yt)return i.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(n===_t)return i.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else{if(null===(i=t.get("WEBGL_compressed_texture_s3tc")))return null;if(n===mt)return i.COMPRESSED_RGB_S3TC_DXT1_EXT;if(n===gt)return i.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(n===yt)return i.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(n===_t)return i.COMPRESSED_RGBA_S3TC_DXT5_EXT}if(n===xt||n===Mt||n===St||n===bt){if(null===(i=t.get("WEBGL_compressed_texture_pvrtc")))return null;if(n===xt)return i.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(n===Mt)return i.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(n===St)return i.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(n===bt)return i.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(n===wt)return null!==(i=t.get("WEBGL_compressed_texture_etc1"))?i.COMPRESSED_RGB_ETC1_WEBGL:null;if(n===Tt||n===Et){if(null===(i=t.get("WEBGL_compressed_texture_etc")))return null;if(n===Tt)return a===pn?i.COMPRESSED_SRGB8_ETC2:i.COMPRESSED_RGB8_ETC2;if(n===Et)return a===pn?i.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:i.COMPRESSED_RGBA8_ETC2_EAC}if(n===At||n===Rt||n===kt||n===Ct||n===Lt||n===Pt||n===It||n===Dt||n===Ut||n===Ot||n===Nt||n===Ft||n===Bt||n===zt){if(null===(i=t.get("WEBGL_compressed_texture_astc")))return null;if(n===At)return a===pn?i.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:i.COMPRESSED_RGBA_ASTC_4x4_KHR;if(n===Rt)return a===pn?i.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:i.COMPRESSED_RGBA_ASTC_5x4_KHR;if(n===kt)return a===pn?i.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:i.COMPRESSED_RGBA_ASTC_5x5_KHR;if(n===Ct)return a===pn?i.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:i.COMPRESSED_RGBA_ASTC_6x5_KHR;if(n===Lt)return a===pn?i.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:i.COMPRESSED_RGBA_ASTC_6x6_KHR;if(n===Pt)return a===pn?i.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:i.COMPRESSED_RGBA_ASTC_8x5_KHR;if(n===It)return a===pn?i.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:i.COMPRESSED_RGBA_ASTC_8x6_KHR;if(n===Dt)return a===pn?i.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:i.COMPRESSED_RGBA_ASTC_8x8_KHR;if(n===Ut)return a===pn?i.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:i.COMPRESSED_RGBA_ASTC_10x5_KHR;if(n===Ot)return a===pn?i.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:i.COMPRESSED_RGBA_ASTC_10x6_KHR;if(n===Nt)return a===pn?i.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:i.COMPRESSED_RGBA_ASTC_10x8_KHR;if(n===Ft)return a===pn?i.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:i.COMPRESSED_RGBA_ASTC_10x10_KHR;if(n===Bt)return a===pn?i.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:i.COMPRESSED_RGBA_ASTC_12x10_KHR;if(n===zt)return a===pn?i.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:i.COMPRESSED_RGBA_ASTC_12x12_KHR}if(n===Ht){if(null===(i=t.get("EXT_texture_compression_bptc")))return null;if(n===Ht)return a===pn?i.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:i.COMPRESSED_RGBA_BPTC_UNORM_EXT}if(n===Gt||n===Vt||n===Wt||n===jt){if(null===(i=t.get("EXT_texture_compression_rgtc")))return null;if(n===Ht)return i.COMPRESSED_RED_RGTC1_EXT;if(n===Vt)return i.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(n===Wt)return i.COMPRESSED_RED_GREEN_RGTC2_EXT;if(n===jt)return i.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}return n===it?r?e.UNSIGNED_INT_24_8:null!==(i=t.get("WEBGL_depth_texture"))?i.UNSIGNED_INT_24_8_WEBGL:null:void 0!==e[n]?e[n]:null}}}var Qu=function(e){w(n,e);var t=E(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return a(this,n),(e=t.call(this)).isArrayCamera=!0,e.cameras=r,e}return s(n)}(mo),$u=function(e){w(n,e);var t=E(n);function n(){var e;return a(this,n),(e=t.call(this)).isGroup=!0,e.type="Group",e}return s(n)}(Zi),el={type:"move"},tl=function(){function e(){a(this,e),this._targetRay=null,this._grip=null,this._hand=null}return s(e,[{key:"getHandSpace",value:function(){return null===this._hand&&(this._hand=new $u,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}},{key:"getTargetRaySpace",value:function(){return null===this._targetRay&&(this._targetRay=new $u,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new Yr,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new Yr),this._targetRay}},{key:"getGripSpace",value:function(){return null===this._grip&&(this._grip=new $u,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new Yr,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new Yr),this._grip}},{key:"dispatchEvent",value:function(e){return null!==this._targetRay&&this._targetRay.dispatchEvent(e),null!==this._grip&&this._grip.dispatchEvent(e),null!==this._hand&&this._hand.dispatchEvent(e),this}},{key:"connect",value:function(e){if(e&&e.hand){var t=this._hand;if(t){var n,r=v(e.hand.values());try{for(r.s();!(n=r.n()).done;){var i=n.value;this._getHandJoint(t,i)}}catch(e){r.e(e)}finally{r.f()}}}return this.dispatchEvent({type:"connected",data:e}),this}},{key:"disconnect",value:function(e){return this.dispatchEvent({type:"disconnected",data:e}),null!==this._targetRay&&(this._targetRay.visible=!1),null!==this._grip&&(this._grip.visible=!1),null!==this._hand&&(this._hand.visible=!1),this}},{key:"update",value:function(e,t,n){var r=null,i=null,a=null,o=this._targetRay,s=this._grip,u=this._hand;if(e&&"visible-blurred"!==t.session.visibilityState){if(u&&e.hand){a=!0;var l,c=v(e.hand.values());try{for(c.s();!(l=c.n()).done;){var h=l.value,d=t.getJointPose(h,n),f=this._getHandJoint(u,h);null!==d&&(f.matrix.fromArray(d.transform.matrix),f.matrix.decompose(f.position,f.rotation,f.scale),f.matrixWorldNeedsUpdate=!0,f.jointRadius=d.radius),f.visible=null!==d}}catch(e){c.e(e)}finally{c.f()}var p=u.joints["index-finger-tip"],m=u.joints["thumb-tip"],g=p.position.distanceTo(m.position);u.inputState.pinching&&g>.025?(u.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!u.inputState.pinching&&g<=.015&&(u.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else null!==s&&e.gripSpace&&null!==(i=t.getPose(e.gripSpace,n))&&(s.matrix.fromArray(i.transform.matrix),s.matrix.decompose(s.position,s.rotation,s.scale),s.matrixWorldNeedsUpdate=!0,i.linearVelocity?(s.hasLinearVelocity=!0,s.linearVelocity.copy(i.linearVelocity)):s.hasLinearVelocity=!1,i.angularVelocity?(s.hasAngularVelocity=!0,s.angularVelocity.copy(i.angularVelocity)):s.hasAngularVelocity=!1);null!==o&&(null===(r=t.getPose(e.targetRaySpace,n))&&null!==i&&(r=i),null!==r&&(o.matrix.fromArray(r.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),o.matrixWorldNeedsUpdate=!0,r.linearVelocity?(o.hasLinearVelocity=!0,o.linearVelocity.copy(r.linearVelocity)):o.hasLinearVelocity=!1,r.angularVelocity?(o.hasAngularVelocity=!0,o.angularVelocity.copy(r.angularVelocity)):o.hasAngularVelocity=!1,this.dispatchEvent(el)))}return null!==o&&(o.visible=null!==r),null!==s&&(s.visible=null!==i),null!==u&&(u.visible=null!==a),this}},{key:"_getHandJoint",value:function(e,t){if(void 0===e.joints[t.jointName]){var n=new $u;n.matrixAutoUpdate=!1,n.visible=!1,e.joints[t.jointName]=n,e.add(n)}return e.joints[t.jointName]}}]),e}(),nl=function(e){w(n,e);var t=E(n);function n(e,r,i,o,s,u,l,c,h,d){var f;if(a(this,n),(d=void 0!==d?d:lt)!==lt&&d!==ct)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");return void 0===i&&d===lt&&(i=$e),void 0===i&&d===ct&&(i=it),(f=t.call(this,null,o,s,u,l,c,d,i,h)).isDepthTexture=!0,f.image={width:e,height:r},f.magFilter=void 0!==l?l:Fe,f.minFilter=void 0!==c?c:Fe,f.flipY=!1,f.generateMipmaps=!1,f.compareFunction=null,f}return s(n,[{key:"copy",value:function(e){return y(x(n.prototype),"copy",this).call(this,e),this.compareFunction=e.compareFunction,this}},{key:"toJSON",value:function(e){var t=y(x(n.prototype),"toJSON",this).call(this,e);return null!==this.compareFunction&&(t.compareFunction=this.compareFunction),t}}]),n}(Fr),rl=function(e){w(n,e);var t=E(n);function n(e,r){var i;a(this,n),i=t.call(this);var o=S(i),s=null,u=1,l=null,c="local-floor",h=1,d=null,f=null,v=null,m=null,g=null,y=null,_=r.getContextAttributes(),x=null,M=null,b=[],w=[],T=new mo;T.layers.enable(1),T.viewport=new Br;var E=new mo;E.layers.enable(2),E.viewport=new Br;var A=[T,E],k=new Qu;k.layers.enable(1),k.layers.enable(2);var C=null,L=null;function P(e){var t=w.indexOf(e.inputSource);if(-1!==t){var n=b[t];void 0!==n&&(n.update(e.inputSource,e.frame,d||l),n.dispatchEvent({type:e.type,data:e.inputSource}))}}function I(){s.removeEventListener("select",P),s.removeEventListener("selectstart",P),s.removeEventListener("selectend",P),s.removeEventListener("squeeze",P),s.removeEventListener("squeezestart",P),s.removeEventListener("squeezeend",P),s.removeEventListener("end",I),s.removeEventListener("inputsourceschange",D);for(var t=0;t<b.length;t++){var n=w[t];null!==n&&(w[t]=null,b[t].disconnect(n))}C=null,L=null,e.setRenderTarget(x),g=null,m=null,v=null,s=null,M=null,B.stop(),o.isPresenting=!1,o.dispatchEvent({type:"sessionend"})}function D(e){for(var t=0;t<e.removed.length;t++){var n=e.removed[t],r=w.indexOf(n);r>=0&&(w[r]=null,b[r].disconnect(n))}for(var i=0;i<e.added.length;i++){var a=e.added[i],o=w.indexOf(a);if(-1===o){for(var s=0;s<b.length;s++){if(s>=w.length){w.push(a),o=s;break}if(null===w[s]){w[s]=a,o=s;break}}if(-1===o)break}var u=b[o];u&&u.connect(a)}}i.cameraAutoUpdate=!0,i.enabled=!1,i.isPresenting=!1,i.getController=function(e){var t=b[e];return void 0===t&&(t=new tl,b[e]=t),t.getTargetRaySpace()},i.getControllerGrip=function(e){var t=b[e];return void 0===t&&(t=new tl,b[e]=t),t.getGripSpace()},i.getHand=function(e){var t=b[e];return void 0===t&&(t=new tl,b[e]=t),t.getHandSpace()},i.setFramebufferScaleFactor=function(e){u=e,!0===o.isPresenting&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},i.setReferenceSpaceType=function(e){c=e,!0===o.isPresenting&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},i.getReferenceSpace=function(){return d||l},i.setReferenceSpace=function(e){d=e},i.getBaseLayer=function(){return null!==m?m:g},i.getBinding=function(){return v},i.getFrame=function(){return y},i.getSession=function(){return s},i.setSession=function(){var t=p(R().mark((function t(n){var i,a,f,p,y;return R().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(null===(s=n)){t.next=25;break}if(x=e.getRenderTarget(),s.addEventListener("select",P),s.addEventListener("selectstart",P),s.addEventListener("selectend",P),s.addEventListener("squeeze",P),s.addEventListener("squeezestart",P),s.addEventListener("squeezeend",P),s.addEventListener("end",I),s.addEventListener("inputsourceschange",D),!0===_.xrCompatible){t.next=14;break}return t.next=14,r.makeXRCompatible();case 14:return void 0===s.renderState.layers||!1===e.capabilities.isWebGL2?(i={antialias:void 0!==s.renderState.layers||_.antialias,alpha:!0,depth:_.depth,stencil:_.stencil,framebufferScaleFactor:u},g=new XRWebGLLayer(s,r,i),s.updateRenderState({baseLayer:g}),M=new Hr(g.framebufferWidth,g.framebufferHeight,{format:ot,type:Ye,colorSpace:e.outputColorSpace,stencilBuffer:_.stencil})):(a=null,f=null,p=null,_.depth&&(p=_.stencil?r.DEPTH24_STENCIL8:r.DEPTH_COMPONENT24,a=_.stencil?ct:lt,f=_.stencil?it:$e),y={colorFormat:r.RGBA8,depthFormat:p,scaleFactor:u},v=new XRWebGLBinding(s,r),m=v.createProjectionLayer(y),s.updateRenderState({layers:[m]}),M=new Hr(m.textureWidth,m.textureHeight,{format:ot,type:Ye,depthTexture:new nl(m.textureWidth,m.textureHeight,f,void 0,void 0,void 0,void 0,void 0,void 0,a),stencilBuffer:_.stencil,colorSpace:e.outputColorSpace,samples:_.antialias?4:0}),e.properties.get(M).__ignoreDepthValues=m.ignoreDepthValues),M.isXRRenderTarget=!0,this.setFoveation(h),d=null,t.next=20,s.requestReferenceSpace(c);case 20:l=t.sent,B.setContext(s),B.start(),o.isPresenting=!0,o.dispatchEvent({type:"sessionstart"});case 25:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),i.getEnvironmentBlendMode=function(){if(null!==s)return s.environmentBlendMode};var U=new Yr,O=new Yr;function N(e,t){null===t?e.matrixWorld.copy(e.matrix):e.matrixWorld.multiplyMatrices(t.matrixWorld,e.matrix),e.matrixWorldInverse.copy(e.matrixWorld).invert()}i.updateCamera=function(e){if(null!==s){k.near=E.near=T.near=e.near,k.far=E.far=T.far=e.far,C===k.near&&L===k.far||(s.updateRenderState({depthNear:k.near,depthFar:k.far}),C=k.near,L=k.far);var t=e.parent,n=k.cameras;N(k,t);for(var r=0;r<n.length;r++)N(n[r],t);2===n.length?function(e,t,n){U.setFromMatrixPosition(t.matrixWorld),O.setFromMatrixPosition(n.matrixWorld);var r=U.distanceTo(O),i=t.projectionMatrix.elements,a=n.projectionMatrix.elements,o=i[14]/(i[10]-1),s=i[14]/(i[10]+1),u=(i[9]+1)/i[5],l=(i[9]-1)/i[5],c=(i[8]-1)/i[0],h=(a[8]+1)/a[0],d=o*c,f=o*h,p=r/(-c+h),v=p*-c;t.matrixWorld.decompose(e.position,e.quaternion,e.scale),e.translateX(v),e.translateZ(p),e.matrixWorld.compose(e.position,e.quaternion,e.scale),e.matrixWorldInverse.copy(e.matrixWorld).invert();var m=o+p,g=s+p,y=d-v,_=f+(r-v),x=u*s/g*m,M=l*s/g*m;e.projectionMatrix.makePerspective(y,_,x,M,m,g),e.projectionMatrixInverse.copy(e.projectionMatrix).invert()}(k,T,E):k.projectionMatrix.copy(T.projectionMatrix),function(e,t,n){null===n?e.matrix.copy(t.matrixWorld):(e.matrix.copy(n.matrixWorld),e.matrix.invert(),e.matrix.multiply(t.matrixWorld));e.matrix.decompose(e.position,e.quaternion,e.scale),e.updateMatrixWorld(!0);for(var r=e.children,i=0,a=r.length;i<a;i++)r[i].updateMatrixWorld(!0);e.projectionMatrix.copy(t.projectionMatrix),e.projectionMatrixInverse.copy(t.projectionMatrixInverse),e.isPerspectiveCamera&&(e.fov=2*ar*Math.atan(1/e.projectionMatrix.elements[5]),e.zoom=1)}(e,k,t)}},i.getCamera=function(){return k},i.getFoveation=function(){if(null!==m||null!==g)return h},i.setFoveation=function(e){h=e,null!==m&&(m.fixedFoveation=e),null!==g&&void 0!==g.fixedFoveation&&(g.fixedFoveation=e)};var F=null;var B=new Ro;return B.setAnimationLoop((function(t,n){if(f=n.getViewerPose(d||l),y=n,null!==f){var r=f.views;null!==g&&(e.setRenderTargetFramebuffer(M,g.framebuffer),e.setRenderTarget(M));var i=!1;r.length!==k.cameras.length&&(k.cameras.length=0,i=!0);for(var a=0;a<r.length;a++){var s=r[a],u=null;if(null!==g)u=g.getViewport(s);else{var c=v.getViewSubImage(m,s);u=c.viewport,0===a&&(e.setRenderTargetTextures(M,c.colorTexture,m.ignoreDepthValues?void 0:c.depthStencilTexture),e.setRenderTarget(M))}var h=A[a];void 0===h&&((h=new mo).layers.enable(a),h.viewport=new Br,A[a]=h),h.matrix.fromArray(s.transform.matrix),h.matrix.decompose(h.position,h.quaternion,h.scale),h.projectionMatrix.fromArray(s.projectionMatrix),h.projectionMatrixInverse.copy(h.projectionMatrix).invert(),h.viewport.set(u.x,u.y,u.width,u.height),0===a&&(k.matrix.copy(h.matrix),k.matrix.decompose(k.position,k.quaternion,k.scale)),!0===i&&k.cameras.push(h)}}for(var p=0;p<b.length;p++){var _=w[p],x=b[p];null!==_&&void 0!==x&&x.update(_,n,d||l)}F&&F(t,n),n.detectedPlanes&&o.dispatchEvent({type:"planesdetected",data:n}),y=null})),i.setAnimationLoop=function(e){F=e},i.dispose=function(){},i}return s(n)}(tr);function il(e,t){function n(e,t){!0===e.matrixAutoUpdate&&e.updateMatrix(),t.value.copy(e.matrix)}function r(r,i){r.opacity.value=i.opacity,i.color&&r.diffuse.value.copy(i.color),i.emissive&&r.emissive.value.copy(i.emissive).multiplyScalar(i.emissiveIntensity),i.map&&(r.map.value=i.map,n(i.map,r.mapTransform)),i.alphaMap&&(r.alphaMap.value=i.alphaMap,n(i.alphaMap,r.alphaMapTransform)),i.bumpMap&&(r.bumpMap.value=i.bumpMap,n(i.bumpMap,r.bumpMapTransform),r.bumpScale.value=i.bumpScale,i.side===H&&(r.bumpScale.value*=-1)),i.normalMap&&(r.normalMap.value=i.normalMap,n(i.normalMap,r.normalMapTransform),r.normalScale.value.copy(i.normalScale),i.side===H&&r.normalScale.value.negate()),i.displacementMap&&(r.displacementMap.value=i.displacementMap,n(i.displacementMap,r.displacementMapTransform),r.displacementScale.value=i.displacementScale,r.displacementBias.value=i.displacementBias),i.emissiveMap&&(r.emissiveMap.value=i.emissiveMap,n(i.emissiveMap,r.emissiveMapTransform)),i.specularMap&&(r.specularMap.value=i.specularMap,n(i.specularMap,r.specularMapTransform)),i.alphaTest>0&&(r.alphaTest.value=i.alphaTest);var a=t.get(i).envMap;if(a&&(r.envMap.value=a,r.flipEnvMap.value=a.isCubeTexture&&!1===a.isRenderTargetTexture?-1:1,r.reflectivity.value=i.reflectivity,r.ior.value=i.ior,r.refractionRatio.value=i.refractionRatio),i.lightMap){r.lightMap.value=i.lightMap;var o=!0===e._useLegacyLights?Math.PI:1;r.lightMapIntensity.value=i.lightMapIntensity*o,n(i.lightMap,r.lightMapTransform)}i.aoMap&&(r.aoMap.value=i.aoMap,r.aoMapIntensity.value=i.aoMapIntensity,n(i.aoMap,r.aoMapTransform))}return{refreshFogUniforms:function(t,n){n.color.getRGB(t.fogColor.value,ho(e)),n.isFog?(t.fogNear.value=n.near,t.fogFar.value=n.far):n.isFogExp2&&(t.fogDensity.value=n.density)},refreshMaterialUniforms:function(e,i,a,o,s){i.isMeshBasicMaterial||i.isMeshLambertMaterial?r(e,i):i.isMeshToonMaterial?(r(e,i),function(e,t){t.gradientMap&&(e.gradientMap.value=t.gradientMap)}(e,i)):i.isMeshPhongMaterial?(r(e,i),function(e,t){e.specular.value.copy(t.specular),e.shininess.value=Math.max(t.shininess,1e-4)}(e,i)):i.isMeshStandardMaterial?(r(e,i),function(e,r){e.metalness.value=r.metalness,r.metalnessMap&&(e.metalnessMap.value=r.metalnessMap,n(r.metalnessMap,e.metalnessMapTransform));e.roughness.value=r.roughness,r.roughnessMap&&(e.roughnessMap.value=r.roughnessMap,n(r.roughnessMap,e.roughnessMapTransform));var i=t.get(r).envMap;i&&(e.envMapIntensity.value=r.envMapIntensity)}(e,i),i.isMeshPhysicalMaterial&&function(e,t,r){e.ior.value=t.ior,t.sheen>0&&(e.sheenColor.value.copy(t.sheenColor).multiplyScalar(t.sheen),e.sheenRoughness.value=t.sheenRoughness,t.sheenColorMap&&(e.sheenColorMap.value=t.sheenColorMap,n(t.sheenColorMap,e.sheenColorMapTransform)),t.sheenRoughnessMap&&(e.sheenRoughnessMap.value=t.sheenRoughnessMap,n(t.sheenRoughnessMap,e.sheenRoughnessMapTransform)));t.clearcoat>0&&(e.clearcoat.value=t.clearcoat,e.clearcoatRoughness.value=t.clearcoatRoughness,t.clearcoatMap&&(e.clearcoatMap.value=t.clearcoatMap,n(t.clearcoatMap,e.clearcoatMapTransform)),t.clearcoatRoughnessMap&&(e.clearcoatRoughnessMap.value=t.clearcoatRoughnessMap,n(t.clearcoatRoughnessMap,e.clearcoatRoughnessMapTransform)),t.clearcoatNormalMap&&(e.clearcoatNormalMap.value=t.clearcoatNormalMap,n(t.clearcoatNormalMap,e.clearcoatNormalMapTransform),e.clearcoatNormalScale.value.copy(t.clearcoatNormalScale),t.side===H&&e.clearcoatNormalScale.value.negate()));t.iridescence>0&&(e.iridescence.value=t.iridescence,e.iridescenceIOR.value=t.iridescenceIOR,e.iridescenceThicknessMinimum.value=t.iridescenceThicknessRange[0],e.iridescenceThicknessMaximum.value=t.iridescenceThicknessRange[1],t.iridescenceMap&&(e.iridescenceMap.value=t.iridescenceMap,n(t.iridescenceMap,e.iridescenceMapTransform)),t.iridescenceThicknessMap&&(e.iridescenceThicknessMap.value=t.iridescenceThicknessMap,n(t.iridescenceThicknessMap,e.iridescenceThicknessMapTransform)));t.transmission>0&&(e.transmission.value=t.transmission,e.transmissionSamplerMap.value=r.texture,e.transmissionSamplerSize.value.set(r.width,r.height),t.transmissionMap&&(e.transmissionMap.value=t.transmissionMap,n(t.transmissionMap,e.transmissionMapTransform)),e.thickness.value=t.thickness,t.thicknessMap&&(e.thicknessMap.value=t.thicknessMap,n(t.thicknessMap,e.thicknessMapTransform)),e.attenuationDistance.value=t.attenuationDistance,e.attenuationColor.value.copy(t.attenuationColor));t.anisotropy>0&&(e.anisotropyVector.value.set(t.anisotropy*Math.cos(t.anisotropyRotation),t.anisotropy*Math.sin(t.anisotropyRotation)),t.anisotropyMap&&(e.anisotropyMap.value=t.anisotropyMap,n(t.anisotropyMap,e.anisotropyMapTransform)));e.specularIntensity.value=t.specularIntensity,e.specularColor.value.copy(t.specularColor),t.specularColorMap&&(e.specularColorMap.value=t.specularColorMap,n(t.specularColorMap,e.specularColorMapTransform));t.specularIntensityMap&&(e.specularIntensityMap.value=t.specularIntensityMap,n(t.specularIntensityMap,e.specularIntensityMapTransform))}(e,i,s)):i.isMeshMatcapMaterial?(r(e,i),function(e,t){t.matcap&&(e.matcap.value=t.matcap)}(e,i)):i.isMeshDepthMaterial?r(e,i):i.isMeshDistanceMaterial?(r(e,i),function(e,n){var r=t.get(n).light;e.referencePosition.value.setFromMatrixPosition(r.matrixWorld),e.nearDistance.value=r.shadow.camera.near,e.farDistance.value=r.shadow.camera.far}(e,i)):i.isMeshNormalMaterial?r(e,i):i.isLineBasicMaterial?(function(e,t){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity,t.map&&(e.map.value=t.map,n(t.map,e.mapTransform))}(e,i),i.isLineDashedMaterial&&function(e,t){e.dashSize.value=t.dashSize,e.totalSize.value=t.dashSize+t.gapSize,e.scale.value=t.scale}(e,i)):i.isPointsMaterial?function(e,t,r,i){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity,e.size.value=t.size*r,e.scale.value=.5*i,t.map&&(e.map.value=t.map,n(t.map,e.uvTransform));t.alphaMap&&(e.alphaMap.value=t.alphaMap,n(t.alphaMap,e.alphaMapTransform));t.alphaTest>0&&(e.alphaTest.value=t.alphaTest)}(e,i,a,o):i.isSpriteMaterial?function(e,t){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity,e.rotation.value=t.rotation,t.map&&(e.map.value=t.map,n(t.map,e.mapTransform));t.alphaMap&&(e.alphaMap.value=t.alphaMap,n(t.alphaMap,e.alphaMapTransform));t.alphaTest>0&&(e.alphaTest.value=t.alphaTest)}(e,i):i.isShadowMaterial?(e.color.value.copy(i.color),e.opacity.value=i.opacity):i.isShaderMaterial&&(i.uniformsNeedUpdate=!1)}}}function al(e,t,n,r){var i={},a={},o=[],s=n.isWebGL2?e.getParameter(e.MAX_UNIFORM_BUFFER_BINDINGS):0;function u(e,t,n){var r=e.value;if(void 0===n[t]){if("number"==typeof r)n[t]=r;else{for(var i=Array.isArray(r)?r:[r],a=[],o=0;o<i.length;o++)a.push(i[o].clone());n[t]=a}return!0}if("number"==typeof r){if(n[t]!==r)return n[t]=r,!0}else for(var s=Array.isArray(n[t])?n[t]:[n[t]],u=Array.isArray(r)?r:[r],l=0;l<s.length;l++){var c=s[l];if(!1===c.equals(u[l]))return c.copy(u[l]),!0}return!1}function l(e){var t={boundary:0,storage:0};return"number"==typeof e?(t.boundary=4,t.storage=4):e.isVector2?(t.boundary=8,t.storage=8):e.isVector3||e.isColor?(t.boundary=16,t.storage=12):e.isVector4?(t.boundary=16,t.storage=16):e.isMatrix3?(t.boundary=48,t.storage=48):e.isMatrix4?(t.boundary=64,t.storage=64):e.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",e),t}function c(t){var n=t.target;n.removeEventListener("dispose",c);var r=o.indexOf(n.__bindingPointIndex);o.splice(r,1),e.deleteBuffer(i[n.id]),delete i[n.id],delete a[n.id]}return{bind:function(e,t){var n=t.program;r.uniformBlockBinding(e,n)},update:function(n,h){var d=i[n.id];void 0===d&&(!function(e){for(var t=e.uniforms,n=0,r=16,i=0,a=0,o=t.length;a<o;a++){for(var s=t[a],u={boundary:0,storage:0},c=Array.isArray(s.value)?s.value:[s.value],h=0,d=c.length;h<d;h++){var f=l(c[h]);u.boundary+=f.boundary,u.storage+=f.storage}if(s.__data=new Float32Array(u.storage/Float32Array.BYTES_PER_ELEMENT),s.__offset=n,a>0)0!==(i=n%r)&&r-i-u.boundary<0&&(n+=r-i,s.__offset=n);n+=u.storage}(i=n%r)>0&&(n+=r-i);e.__size=n,e.__cache={}}(n),d=function(t){var n=function(){for(var e=0;e<s;e++)if(-1===o.indexOf(e))return o.push(e),e;return console.error("THREE.WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}();t.__bindingPointIndex=n;var r=e.createBuffer(),i=t.__size,a=t.usage;return e.bindBuffer(e.UNIFORM_BUFFER,r),e.bufferData(e.UNIFORM_BUFFER,i,a),e.bindBuffer(e.UNIFORM_BUFFER,null),e.bindBufferBase(e.UNIFORM_BUFFER,n,r),r}(n),i[n.id]=d,n.addEventListener("dispose",c));var f=h.program;r.updateUBOMapping(n,f);var p=t.render.frame;a[n.id]!==p&&(!function(t){var n=i[t.id],r=t.uniforms,a=t.__cache;e.bindBuffer(e.UNIFORM_BUFFER,n);for(var o=0,s=r.length;o<s;o++){var c=r[o];if(!0===u(c,o,a)){for(var h=c.__offset,d=Array.isArray(c.value)?c.value:[c.value],f=0,p=0;p<d.length;p++){var v=d[p],m=l(v);"number"==typeof v?(c.__data[0]=v,e.bufferSubData(e.UNIFORM_BUFFER,h+f,c.__data)):v.isMatrix3?(c.__data[0]=v.elements[0],c.__data[1]=v.elements[1],c.__data[2]=v.elements[2],c.__data[3]=v.elements[0],c.__data[4]=v.elements[3],c.__data[5]=v.elements[4],c.__data[6]=v.elements[5],c.__data[7]=v.elements[0],c.__data[8]=v.elements[6],c.__data[9]=v.elements[7],c.__data[10]=v.elements[8],c.__data[11]=v.elements[0]):(v.toArray(c.__data,f),f+=m.storage/Float32Array.BYTES_PER_ELEMENT)}e.bufferSubData(e.UNIFORM_BUFFER,h,c.__data)}}e.bindBuffer(e.UNIFORM_BUFFER,null)}(n),a[n.id]=p)},dispose:function(){for(var t in i)e.deleteBuffer(i[t]);o=[],i={},a={}}}}function ol(){var e=Sr("canvas");return e.style.display="block",e}var sl=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};a(this,e);var n,r=t.canvas,i=void 0===r?ol():r,o=t.context,s=void 0===o?null:o,u=t.depth,l=void 0===u||u,c=t.stencil,h=void 0===c||c,d=t.alpha,f=void 0!==d&&d,p=t.antialias,v=void 0!==p&&p,m=t.premultipliedAlpha,g=void 0===m||m,y=t.preserveDrawingBuffer,_=void 0!==y&&y,x=t.powerPreference,M=void 0===x?"default":x,S=t.failIfMajorPerformanceCaveat,b=void 0!==S&&S;this.isWebGLRenderer=!0,n=null!==s?s.getContextAttributes().alpha:f;var w=new Uint32Array(4),T=new Int32Array(4),E=null,A=null,R=[],C=[];this.domElement=i,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.outputColorSpace=pn,this._useLegacyLights=!1,this.toneMapping=be,this.toneMappingExposure=1;var L=this,P=!1,I=0,D=0,U=null,O=-1,N=null,F=new Br,B=new Br,V=null,W=new pa(0),j=0,X=i.width,q=i.height,Y=1,Z=null,K=null,J=new Br(0,0,X,q),Q=new Br(0,0,X,q),$=!1,ee=new Ao,te=!1,ne=!1,re=null,ie=new wi,ae=new mr,oe=new Yr,se={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function ue(){return null===U?Y:1}var le,ce,he,de,fe,pe,ve,me,ge,ye,_e,xe,Me,Se,we,Te,Ee,Ae,Re,ke,Ce,Le,Pe,Ie,De=s;function Ue(e,t){for(var n=0;n<e.length;n++){var r=e[n],a=i.getContext(r,t);if(null!==a)return a}return null}try{var Oe={alpha:!0,depth:l,stencil:h,antialias:v,premultipliedAlpha:g,preserveDrawingBuffer:_,powerPreference:M,failIfMajorPerformanceCaveat:b};if("setAttribute"in i&&i.setAttribute("data-engine","three.js r".concat(k)),i.addEventListener("webglcontextlost",ze,!1),i.addEventListener("webglcontextrestored",He,!1),i.addEventListener("webglcontextcreationerror",Ge,!1),null===De){var Ne=["webgl2","webgl","experimental-webgl"];if(!0===L.isWebGL1Renderer&&Ne.shift(),null===(De=Ue(Ne,Oe)))throw Ue(Ne)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}"undefined"!=typeof WebGLRenderingContext&&De instanceof WebGLRenderingContext&&console.warn("THREE.WebGLRenderer: WebGL 1 support was deprecated in r153 and will be removed in r163."),void 0===De.getShaderPrecisionFormat&&(De.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}})}catch(e){throw console.error("THREE.WebGLRenderer: "+e.message),e}function Fe(){le=new ns(De),ce=new Fo(De,le,t),le.init(ce),Le=new Ju(De,le,ce),he=new Zu(De,le,ce),de=new as(De),fe=new Uu,pe=new Ku(De,le,he,fe,ce,Le,de),ve=new zo(L),me=new ts(L),ge=new ko(De,ce),Pe=new Oo(De,le,ge,ce),ye=new rs(De,ge,de,Pe),_e=new ls(De,ye,ge,de),Re=new us(De,ce,pe),Te=new Bo(fe),xe=new Du(L,ve,me,le,ce,Pe,Te),Me=new il(L,fe),Se=new Bu,we=new ju(le,ce),Ae=new Uo(L,ve,me,he,_e,n,g),Ee=new Yu(L,_e,ce),Ie=new al(De,de,ce,he),ke=new No(De,le,de,ce),Ce=new is(De,le,de,ce),de.programs=xe.programs,L.capabilities=ce,L.extensions=le,L.properties=fe,L.renderLists=Se,L.shadowMap=Ee,L.state=he,L.info=de}Fe();var Be=new rl(L,De);function ze(e){e.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),P=!0}function He(){console.log("THREE.WebGLRenderer: Context Restored."),P=!1;var e=de.autoReset,t=Ee.enabled,n=Ee.autoUpdate,r=Ee.needsUpdate,i=Ee.type;Fe(),de.autoReset=e,Ee.enabled=t,Ee.autoUpdate=n,Ee.needsUpdate=r,Ee.type=i}function Ge(e){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",e.statusMessage)}function Ve(e){var t=e.target;t.removeEventListener("dispose",Ve),We(t)}function We(e){je(e),fe.remove(e)}function je(e){var t=fe.get(e).programs;void 0!==t&&(t.forEach((function(e){xe.releaseProgram(e)})),e.isShaderMaterial&&xe.releaseShaderCache(e))}this.xr=Be,this.getContext=function(){return De},this.getContextAttributes=function(){return De.getContextAttributes()},this.forceContextLoss=function(){var e=le.get("WEBGL_lose_context");e&&e.loseContext()},this.forceContextRestore=function(){var e=le.get("WEBGL_lose_context");e&&e.restoreContext()},this.getPixelRatio=function(){return Y},this.setPixelRatio=function(e){void 0!==e&&(Y=e,this.setSize(X,q,!1))},this.getSize=function(e){return e.set(X,q)},this.setSize=function(e,t){var n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];Be.isPresenting?console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting."):(X=e,q=t,i.width=Math.floor(e*Y),i.height=Math.floor(t*Y),!0===n&&(i.style.width=e+"px",i.style.height=t+"px"),this.setViewport(0,0,e,t))},this.getDrawingBufferSize=function(e){return e.set(X*Y,q*Y).floor()},this.setDrawingBufferSize=function(e,t,n){X=e,q=t,Y=n,i.width=Math.floor(e*n),i.height=Math.floor(t*n),this.setViewport(0,0,e,t)},this.getCurrentViewport=function(e){return e.copy(F)},this.getViewport=function(e){return e.copy(J)},this.setViewport=function(e,t,n,r){e.isVector4?J.set(e.x,e.y,e.z,e.w):J.set(e,t,n,r),he.viewport(F.copy(J).multiplyScalar(Y).floor())},this.getScissor=function(e){return e.copy(Q)},this.setScissor=function(e,t,n,r){e.isVector4?Q.set(e.x,e.y,e.z,e.w):Q.set(e,t,n,r),he.scissor(B.copy(Q).multiplyScalar(Y).floor())},this.getScissorTest=function(){return $},this.setScissorTest=function(e){he.setScissorTest($=e)},this.setOpaqueSort=function(e){Z=e},this.setTransparentSort=function(e){K=e},this.getClearColor=function(e){return e.copy(Ae.getClearColor())},this.setClearColor=function(){Ae.setClearColor.apply(Ae,arguments)},this.getClearAlpha=function(){return Ae.getClearAlpha()},this.setClearAlpha=function(){Ae.setClearAlpha.apply(Ae,arguments)},this.clear=function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],r=0;if(e){var i=!1;if(null!==U){var a=U.texture.format;i=a===vt||a===pt||a===dt}if(i){var o=U.texture.type,s=o===Ye||o===$e||o===Je||o===it||o===nt||o===rt,u=Ae.getClearColor(),l=Ae.getClearAlpha(),c=u.r,h=u.g,d=u.b;s?(w[0]=c,w[1]=h,w[2]=d,w[3]=l,De.clearBufferuiv(De.COLOR,0,w)):(T[0]=c,T[1]=h,T[2]=d,T[3]=l,De.clearBufferiv(De.COLOR,0,T))}else r|=De.COLOR_BUFFER_BIT}t&&(r|=De.DEPTH_BUFFER_BIT),n&&(r|=De.STENCIL_BUFFER_BIT),De.clear(r)},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.dispose=function(){i.removeEventListener("webglcontextlost",ze,!1),i.removeEventListener("webglcontextrestored",He,!1),i.removeEventListener("webglcontextcreationerror",Ge,!1),Se.dispose(),we.dispose(),fe.dispose(),ve.dispose(),me.dispose(),_e.dispose(),Pe.dispose(),Ie.dispose(),xe.dispose(),Be.dispose(),Be.removeEventListener("sessionstart",Ke),Be.removeEventListener("sessionend",Qe),re&&(re.dispose(),re=null),at.stop()},this.renderBufferDirect=function(e,t,n,r,i,a){null===t&&(t=se);var o=i.isMesh&&i.matrixWorld.determinant()<0,s=gt(e,t,n,r,i);he.setMaterial(r,o);var u=n.index,l=1;if(!0===r.wireframe){if(void 0===(u=ye.getWireframeAttribute(n)))return;l=2}var c=n.drawRange,h=n.attributes.position,d=c.start*l,f=(c.start+c.count)*l;null!==a&&(d=Math.max(d,a.start*l),f=Math.min(f,(a.start+a.count)*l)),null!==u?(d=Math.max(d,0),f=Math.min(f,u.count)):null!=h&&(d=Math.max(d,0),f=Math.min(f,h.count));var p=f-d;if(!(p<0||p===1/0)){var v;Pe.setup(i,r,s,n,u);var m=ke;if(null!==u&&(v=ge.get(u),(m=Ce).setIndex(v)),i.isMesh)!0===r.wireframe?(he.setLineWidth(r.wireframeLinewidth*ue()),m.setMode(De.LINES)):m.setMode(De.TRIANGLES);else if(i.isLine){var g=r.linewidth;void 0===g&&(g=1),he.setLineWidth(g*ue()),i.isLineSegments?m.setMode(De.LINES):i.isLineLoop?m.setMode(De.LINE_LOOP):m.setMode(De.LINE_STRIP)}else i.isPoints?m.setMode(De.POINTS):i.isSprite&&m.setMode(De.TRIANGLES);if(i.isInstancedMesh)m.renderInstances(d,p,i.count);else if(n.isInstancedBufferGeometry){var y=void 0!==n._maxInstanceCount?n._maxInstanceCount:1/0,_=Math.min(n.instanceCount,y);m.renderInstances(d,p,_)}else m.render(d,p)}},this.compile=function(e,t){function n(e,t,n){!0===e.transparent&&e.side===G&&!1===e.forceSinglePass?(e.side=H,e.needsUpdate=!0,ft(e,t,n),e.side=z,e.needsUpdate=!0,ft(e,t,n),e.side=G):ft(e,t,n)}(A=we.get(e)).init(),C.push(A),e.traverseVisible((function(e){e.isLight&&e.layers.test(t.layers)&&(A.pushLight(e),e.castShadow&&A.pushShadow(e))})),A.setupLights(L._useLegacyLights),e.traverse((function(t){var r=t.material;if(r)if(Array.isArray(r))for(var i=0;i<r.length;i++){n(r[i],e,t)}else n(r,e,t)})),C.pop(),A=null};var qe=null;function Ze(e){qe&&qe(e)}function Ke(){at.stop()}function Qe(){at.start()}var at=new Ro;function st(e,t,n,r){if(!1!==e.visible){if(e.layers.test(t.layers))if(e.isGroup)n=e.renderOrder;else if(e.isLOD)!0===e.autoUpdate&&e.update(t);else if(e.isLight)A.pushLight(e),e.castShadow&&A.pushShadow(e);else if(e.isSprite){if(!e.frustumCulled||ee.intersectsSprite(e)){r&&oe.setFromMatrixPosition(e.matrixWorld).applyMatrix4(ie);var i=_e.update(e),a=e.material;a.visible&&E.push(e,i,a,n,oe.z,null)}}else if((e.isMesh||e.isLine||e.isPoints)&&(!e.frustumCulled||ee.intersectsObject(e))){var o=_e.update(e),s=e.material;if(r&&(void 0!==e.boundingSphere?(null===e.boundingSphere&&e.computeBoundingSphere(),oe.copy(e.boundingSphere.center)):(null===o.boundingSphere&&o.computeBoundingSphere(),oe.copy(o.boundingSphere.center)),oe.applyMatrix4(e.matrixWorld).applyMatrix4(ie)),Array.isArray(s))for(var u=o.groups,l=0,c=u.length;l<c;l++){var h=u[l],d=s[h.materialIndex];d&&d.visible&&E.push(e,o,d,n,oe.z,h)}else s.visible&&E.push(e,o,s,n,oe.z,null)}for(var f=e.children,p=0,v=f.length;p<v;p++)st(f[p],t,n,r)}}function ut(e,t,n,r){var i=e.opaque,a=e.transmissive,o=e.transparent;A.setupLightsView(n),!0===te&&Te.setGlobalState(L.clippingPlanes,n),a.length>0&<(i,a,t,n),r&&he.viewport(F.copy(r)),i.length>0&&ct(i,t,n),a.length>0&&ct(a,t,n),o.length>0&&ct(o,t,n),he.buffers.depth.setTest(!0),he.buffers.depth.setMask(!0),he.buffers.color.setMask(!0),he.setPolygonOffset(!1)}function lt(e,t,n,r){var i=ce.isWebGL2;null===re&&(re=new Hr(1,1,{generateMipmaps:!0,type:le.has("EXT_color_buffer_half_float")?tt:Ye,minFilter:Xe,samples:i?4:0})),L.getDrawingBufferSize(ae),i?re.setSize(ae.x,ae.y):re.setSize(dr(ae.x),dr(ae.y));var a=L.getRenderTarget();L.setRenderTarget(re),L.getClearColor(W),(j=L.getClearAlpha())<1&&L.setClearColor(16777215,.5),L.clear();var o=L.toneMapping;L.toneMapping=be,ct(e,n,r),pe.updateMultisampleRenderTarget(re),pe.updateRenderTargetMipmap(re);for(var s=!1,u=0,l=t.length;u<l;u++){var c=t[u],h=c.object,d=c.geometry,f=c.material,p=c.group;if(f.side===G&&h.layers.test(r.layers)){var v=f.side;f.side=H,f.needsUpdate=!0,ht(h,n,r,d,f,p),f.side=v,f.needsUpdate=!0,s=!0}}!0===s&&(pe.updateMultisampleRenderTarget(re),pe.updateRenderTargetMipmap(re)),L.setRenderTarget(a),L.setClearColor(W,j),L.toneMapping=o}function ct(e,t,n){for(var r=!0===t.isScene?t.overrideMaterial:null,i=0,a=e.length;i<a;i++){var o=e[i],s=o.object,u=o.geometry,l=null===r?o.material:r,c=o.group;s.layers.test(n.layers)&&ht(s,t,n,u,l,c)}}function ht(e,t,n,r,i,a){e.onBeforeRender(L,t,n,r,i,a),e.modelViewMatrix.multiplyMatrices(n.matrixWorldInverse,e.matrixWorld),e.normalMatrix.getNormalMatrix(e.modelViewMatrix),i.onBeforeRender(L,t,n,r,e,a),!0===i.transparent&&i.side===G&&!1===i.forceSinglePass?(i.side=H,i.needsUpdate=!0,L.renderBufferDirect(n,t,r,i,e,a),i.side=z,i.needsUpdate=!0,L.renderBufferDirect(n,t,r,i,e,a),i.side=G):L.renderBufferDirect(n,t,r,i,e,a),e.onAfterRender(L,t,n,r,i,a)}function ft(e,t,n){!0!==t.isScene&&(t=se);var r=fe.get(e),i=A.state.lights,a=A.state.shadowsArray,o=i.state.version,s=xe.getParameters(e,i.state,a,t,n),u=xe.getProgramCacheKey(s),l=r.programs;r.environment=e.isMeshStandardMaterial?t.environment:null,r.fog=t.fog,r.envMap=(e.isMeshStandardMaterial?me:ve).get(e.envMap||r.environment),void 0===l&&(e.addEventListener("dispose",Ve),l=new Map,r.programs=l);var c=l.get(u);if(void 0!==c){if(r.currentProgram===c&&r.lightsStateVersion===o)return mt(e,s),c}else s.uniforms=xe.getUniforms(e),e.onBuild(n,s,L),e.onBeforeCompile(s,L),c=xe.acquireProgram(s,u),l.set(u,c),r.uniforms=s.uniforms;var h=r.uniforms;(e.isShaderMaterial||e.isRawShaderMaterial)&&!0!==e.clipping||(h.clippingPlanes=Te.uniform),mt(e,s),r.needsLights=_t(e),r.lightsStateVersion=o,r.needsLights&&(h.ambientLightColor.value=i.state.ambient,h.lightProbe.value=i.state.probe,h.directionalLights.value=i.state.directional,h.directionalLightShadows.value=i.state.directionalShadow,h.spotLights.value=i.state.spot,h.spotLightShadows.value=i.state.spotShadow,h.rectAreaLights.value=i.state.rectArea,h.ltc_1.value=i.state.rectAreaLTC1,h.ltc_2.value=i.state.rectAreaLTC2,h.pointLights.value=i.state.point,h.pointLightShadows.value=i.state.pointShadow,h.hemisphereLights.value=i.state.hemi,h.directionalShadowMap.value=i.state.directionalShadowMap,h.directionalShadowMatrix.value=i.state.directionalShadowMatrix,h.spotShadowMap.value=i.state.spotShadowMap,h.spotLightMatrix.value=i.state.spotLightMatrix,h.spotLightMap.value=i.state.spotLightMap,h.pointShadowMap.value=i.state.pointShadowMap,h.pointShadowMatrix.value=i.state.pointShadowMatrix);var d=c.getUniforms(),f=fu.seqWithValue(d.seq,h);return r.currentProgram=c,r.uniformsList=f,c}function mt(e,t){var n=fe.get(e);n.outputColorSpace=t.outputColorSpace,n.instancing=t.instancing,n.instancingColor=t.instancingColor,n.skinning=t.skinning,n.morphTargets=t.morphTargets,n.morphNormals=t.morphNormals,n.morphColors=t.morphColors,n.morphTargetsCount=t.morphTargetsCount,n.numClippingPlanes=t.numClippingPlanes,n.numIntersection=t.numClipIntersection,n.vertexAlphas=t.vertexAlphas,n.vertexTangents=t.vertexTangents,n.toneMapping=t.toneMapping}function gt(e,t,n,r,i){!0!==t.isScene&&(t=se),pe.resetTextureUnits();var a=t.fog,o=r.isMeshStandardMaterial?t.environment:null,s=null===U?L.outputColorSpace:!0===U.isXRRenderTarget?U.texture.colorSpace:vn,u=(r.isMeshStandardMaterial?me:ve).get(r.envMap||o),l=!0===r.vertexColors&&!!n.attributes.color&&4===n.attributes.color.itemSize,c=!!n.attributes.tangent&&(!!r.normalMap||r.anisotropy>0),h=!!n.morphAttributes.position,d=!!n.morphAttributes.normal,f=!!n.morphAttributes.color,p=be;r.toneMapped&&(null!==U&&!0!==U.isXRRenderTarget||(p=L.toneMapping));var v=n.morphAttributes.position||n.morphAttributes.normal||n.morphAttributes.color,m=void 0!==v?v.length:0,g=fe.get(r),y=A.state.lights;if(!0===te&&(!0===ne||e!==N)){var _=e===N&&r.id===O;Te.setState(r,e,_)}var x=!1;r.version===g.__version?g.needsLights&&g.lightsStateVersion!==y.state.version||g.outputColorSpace!==s||i.isInstancedMesh&&!1===g.instancing?x=!0:i.isInstancedMesh||!0!==g.instancing?i.isSkinnedMesh&&!1===g.skinning?x=!0:i.isSkinnedMesh||!0!==g.skinning?i.isInstancedMesh&&!0===g.instancingColor&&null===i.instanceColor||i.isInstancedMesh&&!1===g.instancingColor&&null!==i.instanceColor||g.envMap!==u||!0===r.fog&&g.fog!==a?x=!0:void 0===g.numClippingPlanes||g.numClippingPlanes===Te.numPlanes&&g.numIntersection===Te.numIntersection?(g.vertexAlphas!==l||g.vertexTangents!==c||g.morphTargets!==h||g.morphNormals!==d||g.morphColors!==f||g.toneMapping!==p||!0===ce.isWebGL2&&g.morphTargetsCount!==m)&&(x=!0):x=!0:x=!0:x=!0:(x=!0,g.__version=r.version);var M=g.currentProgram;!0===x&&(M=ft(r,t,i));var S=!1,b=!1,w=!1,T=M.getUniforms(),E=g.uniforms;if(he.useProgram(M.program)&&(S=!0,b=!0,w=!0),r.id!==O&&(O=r.id,b=!0),S||N!==e){if(T.setValue(De,"projectionMatrix",e.projectionMatrix),ce.logarithmicDepthBuffer&&T.setValue(De,"logDepthBufFC",2/(Math.log(e.far+1)/Math.LN2)),N!==e&&(N=e,b=!0,w=!0),r.isShaderMaterial||r.isMeshPhongMaterial||r.isMeshToonMaterial||r.isMeshStandardMaterial||r.envMap){var R=T.map.cameraPosition;void 0!==R&&R.setValue(De,oe.setFromMatrixPosition(e.matrixWorld))}(r.isMeshPhongMaterial||r.isMeshToonMaterial||r.isMeshLambertMaterial||r.isMeshBasicMaterial||r.isMeshStandardMaterial||r.isShaderMaterial)&&T.setValue(De,"isOrthographic",!0===e.isOrthographicCamera),(r.isMeshPhongMaterial||r.isMeshToonMaterial||r.isMeshLambertMaterial||r.isMeshBasicMaterial||r.isMeshStandardMaterial||r.isShaderMaterial||r.isShadowMaterial||i.isSkinnedMesh)&&T.setValue(De,"viewMatrix",e.matrixWorldInverse)}if(i.isSkinnedMesh){T.setOptional(De,i,"bindMatrix"),T.setOptional(De,i,"bindMatrixInverse");var k=i.skeleton;k&&(ce.floatVertexTextures?(null===k.boneTexture&&k.computeBoneTexture(),T.setValue(De,"boneTexture",k.boneTexture,pe),T.setValue(De,"boneTextureSize",k.boneTextureSize)):console.warn("THREE.WebGLRenderer: SkinnedMesh can only be used with WebGL 2. With WebGL 1 OES_texture_float and vertex textures support is required."))}var C=n.morphAttributes;if((void 0!==C.position||void 0!==C.normal||void 0!==C.color&&!0===ce.isWebGL2)&&Re.update(i,n,M),(b||g.receiveShadow!==i.receiveShadow)&&(g.receiveShadow=i.receiveShadow,T.setValue(De,"receiveShadow",i.receiveShadow)),r.isMeshGouraudMaterial&&null!==r.envMap&&(E.envMap.value=u,E.flipEnvMap.value=u.isCubeTexture&&!1===u.isRenderTargetTexture?-1:1),b&&(T.setValue(De,"toneMappingExposure",L.toneMappingExposure),g.needsLights&&yt(E,w),a&&!0===r.fog&&Me.refreshFogUniforms(E,a),Me.refreshMaterialUniforms(E,r,Y,q,re),fu.upload(De,g.uniformsList,E,pe)),r.isShaderMaterial&&!0===r.uniformsNeedUpdate&&(fu.upload(De,g.uniformsList,E,pe),r.uniformsNeedUpdate=!1),r.isSpriteMaterial&&T.setValue(De,"center",i.center),T.setValue(De,"modelViewMatrix",i.modelViewMatrix),T.setValue(De,"normalMatrix",i.normalMatrix),T.setValue(De,"modelMatrix",i.matrixWorld),r.isShaderMaterial||r.isRawShaderMaterial)for(var P=r.uniformsGroups,I=0,D=P.length;I<D;I++)if(ce.isWebGL2){var F=P[I];Ie.update(F,M),Ie.bind(F,M)}else console.warn("THREE.WebGLRenderer: Uniform Buffer Objects can only be used with WebGL 2.");return M}function yt(e,t){e.ambientLightColor.needsUpdate=t,e.lightProbe.needsUpdate=t,e.directionalLights.needsUpdate=t,e.directionalLightShadows.needsUpdate=t,e.pointLights.needsUpdate=t,e.pointLightShadows.needsUpdate=t,e.spotLights.needsUpdate=t,e.spotLightShadows.needsUpdate=t,e.rectAreaLights.needsUpdate=t,e.hemisphereLights.needsUpdate=t}function _t(e){return e.isMeshLambertMaterial||e.isMeshToonMaterial||e.isMeshPhongMaterial||e.isMeshStandardMaterial||e.isShadowMaterial||e.isShaderMaterial&&!0===e.lights}at.setAnimationLoop(Ze),"undefined"!=typeof self&&at.setContext(self),this.setAnimationLoop=function(e){qe=e,Be.setAnimationLoop(e),null===e?at.stop():at.start()},Be.addEventListener("sessionstart",Ke),Be.addEventListener("sessionend",Qe),this.render=function(e,t){if(void 0===t||!0===t.isCamera){if(!0!==P){!0===e.matrixWorldAutoUpdate&&e.updateMatrixWorld(),null===t.parent&&!0===t.matrixWorldAutoUpdate&&t.updateMatrixWorld(),!0===Be.enabled&&!0===Be.isPresenting&&(!0===Be.cameraAutoUpdate&&Be.updateCamera(t),t=Be.getCamera()),!0===e.isScene&&e.onBeforeRender(L,e,t,U),(A=we.get(e,C.length)).init(),C.push(A),ie.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),ee.setFromProjectionMatrix(ie),ne=this.localClippingEnabled,te=Te.init(this.clippingPlanes,ne),(E=Se.get(e,R.length)).init(),R.push(E),st(e,t,0,L.sortObjects),E.finish(),!0===L.sortObjects&&E.sort(Z,K),this.info.render.frame++,!0===te&&Te.beginShadows();var n=A.state.shadowsArray;if(Ee.render(n,e,t),!0===te&&Te.endShadows(),!0===this.info.autoReset&&this.info.reset(),Ae.render(E,e),A.setupLights(L._useLegacyLights),t.isArrayCamera)for(var r=t.cameras,i=0,a=r.length;i<a;i++){var o=r[i];ut(E,e,o,o.viewport)}else ut(E,e,t);null!==U&&(pe.updateMultisampleRenderTarget(U),pe.updateRenderTargetMipmap(U)),!0===e.isScene&&e.onAfterRender(L,e,t),Pe.resetDefaultState(),O=-1,N=null,C.pop(),A=C.length>0?C[C.length-1]:null,R.pop(),E=R.length>0?R[R.length-1]:null}}else console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.")},this.getActiveCubeFace=function(){return I},this.getActiveMipmapLevel=function(){return D},this.getRenderTarget=function(){return U},this.setRenderTargetTextures=function(e,t,n){fe.get(e.texture).__webglTexture=t,fe.get(e.depthTexture).__webglTexture=n;var r=fe.get(e);r.__hasExternalTextures=!0,r.__hasExternalTextures&&(r.__autoAllocateDepthBuffer=void 0===n,r.__autoAllocateDepthBuffer||!0===le.has("WEBGL_multisampled_render_to_texture")&&(console.warn("THREE.WebGLRenderer: Render-to-texture extension was disabled because an external texture was provided"),r.__useRenderToTexture=!1))},this.setRenderTargetFramebuffer=function(e,t){var n=fe.get(e);n.__webglFramebuffer=t,n.__useDefaultFramebuffer=void 0===t},this.setRenderTarget=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;U=e,I=t,D=n;var r=!0,i=null,a=!1,o=!1;if(e){var s=fe.get(e);void 0!==s.__useDefaultFramebuffer?(he.bindFramebuffer(De.FRAMEBUFFER,null),r=!1):void 0===s.__webglFramebuffer?pe.setupRenderTarget(e):s.__hasExternalTextures&&pe.rebindTextures(e,fe.get(e.texture).__webglTexture,fe.get(e.depthTexture).__webglTexture);var u=e.texture;(u.isData3DTexture||u.isDataArrayTexture||u.isCompressedArrayTexture)&&(o=!0);var l=fe.get(e).__webglFramebuffer;e.isWebGLCubeRenderTarget?(i=Array.isArray(l[t])?l[t][n]:l[t],a=!0):i=ce.isWebGL2&&e.samples>0&&!1===pe.useMultisampledRTT(e)?fe.get(e).__webglMultisampledFramebuffer:Array.isArray(l)?l[n]:l,F.copy(e.viewport),B.copy(e.scissor),V=e.scissorTest}else F.copy(J).multiplyScalar(Y).floor(),B.copy(Q).multiplyScalar(Y).floor(),V=$;var c=he.bindFramebuffer(De.FRAMEBUFFER,i);if(c&&ce.drawBuffers&&r&&he.drawBuffers(e,i),he.viewport(F),he.scissor(B),he.setScissorTest(V),a){var h=fe.get(e.texture);De.framebufferTexture2D(De.FRAMEBUFFER,De.COLOR_ATTACHMENT0,De.TEXTURE_CUBE_MAP_POSITIVE_X+t,h.__webglTexture,n)}else if(o){var d=fe.get(e.texture),f=t||0;De.framebufferTextureLayer(De.FRAMEBUFFER,De.COLOR_ATTACHMENT0,d.__webglTexture,n||0,f)}O=-1},this.readRenderTargetPixels=function(e,t,n,r,i,a,o){if(e&&e.isWebGLRenderTarget){var s=fe.get(e).__webglFramebuffer;if(e.isWebGLCubeRenderTarget&&void 0!==o&&(s=s[o]),s){he.bindFramebuffer(De.FRAMEBUFFER,s);try{var u=e.texture,l=u.format,c=u.type;if(l!==ot&&Le.convert(l)!==De.getParameter(De.IMPLEMENTATION_COLOR_READ_FORMAT))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");var h=c===tt&&(le.has("EXT_color_buffer_half_float")||ce.isWebGL2&&le.has("EXT_color_buffer_float"));if(!(c===Ye||Le.convert(c)===De.getParameter(De.IMPLEMENTATION_COLOR_READ_TYPE)||c===et&&(ce.isWebGL2||le.has("OES_texture_float")||le.has("WEBGL_color_buffer_float"))||h))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");t>=0&&t<=e.width-r&&n>=0&&n<=e.height-i&&De.readPixels(t,n,r,i,Le.convert(l),Le.convert(c),a)}finally{var d=null!==U?fe.get(U).__webglFramebuffer:null;he.bindFramebuffer(De.FRAMEBUFFER,d)}}}else console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.")},this.copyFramebufferToTexture=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=Math.pow(2,-n),i=Math.floor(t.image.width*r),a=Math.floor(t.image.height*r);pe.setTexture2D(t,0),De.copyTexSubImage2D(De.TEXTURE_2D,n,0,0,e.x,e.y,i,a),he.unbindTexture()},this.copyTextureToTexture=function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,i=t.image.width,a=t.image.height,o=Le.convert(n.format),s=Le.convert(n.type);pe.setTexture2D(n,0),De.pixelStorei(De.UNPACK_FLIP_Y_WEBGL,n.flipY),De.pixelStorei(De.UNPACK_PREMULTIPLY_ALPHA_WEBGL,n.premultiplyAlpha),De.pixelStorei(De.UNPACK_ALIGNMENT,n.unpackAlignment),t.isDataTexture?De.texSubImage2D(De.TEXTURE_2D,r,e.x,e.y,i,a,o,s,t.image.data):t.isCompressedTexture?De.compressedTexSubImage2D(De.TEXTURE_2D,r,e.x,e.y,t.mipmaps[0].width,t.mipmaps[0].height,o,t.mipmaps[0].data):De.texSubImage2D(De.TEXTURE_2D,r,e.x,e.y,o,s,t.image),0===r&&n.generateMipmaps&&De.generateMipmap(De.TEXTURE_2D),he.unbindTexture()},this.copyTextureToTexture3D=function(e,t,n,r){var i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;if(L.isWebGL1Renderer)console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");else{var a,o=e.max.x-e.min.x+1,s=e.max.y-e.min.y+1,u=e.max.z-e.min.z+1,l=Le.convert(r.format),c=Le.convert(r.type);if(r.isData3DTexture)pe.setTexture3D(r,0),a=De.TEXTURE_3D;else{if(!r.isDataArrayTexture)return void console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");pe.setTexture2DArray(r,0),a=De.TEXTURE_2D_ARRAY}De.pixelStorei(De.UNPACK_FLIP_Y_WEBGL,r.flipY),De.pixelStorei(De.UNPACK_PREMULTIPLY_ALPHA_WEBGL,r.premultiplyAlpha),De.pixelStorei(De.UNPACK_ALIGNMENT,r.unpackAlignment);var h=De.getParameter(De.UNPACK_ROW_LENGTH),d=De.getParameter(De.UNPACK_IMAGE_HEIGHT),f=De.getParameter(De.UNPACK_SKIP_PIXELS),p=De.getParameter(De.UNPACK_SKIP_ROWS),v=De.getParameter(De.UNPACK_SKIP_IMAGES),m=n.isCompressedTexture?n.mipmaps[0]:n.image;De.pixelStorei(De.UNPACK_ROW_LENGTH,m.width),De.pixelStorei(De.UNPACK_IMAGE_HEIGHT,m.height),De.pixelStorei(De.UNPACK_SKIP_PIXELS,e.min.x),De.pixelStorei(De.UNPACK_SKIP_ROWS,e.min.y),De.pixelStorei(De.UNPACK_SKIP_IMAGES,e.min.z),n.isDataTexture||n.isData3DTexture?De.texSubImage3D(a,i,t.x,t.y,t.z,o,s,u,l,c,m.data):n.isCompressedArrayTexture?(console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: untested support for compressed srcTexture."),De.compressedTexSubImage3D(a,i,t.x,t.y,t.z,o,s,u,l,m.data)):De.texSubImage3D(a,i,t.x,t.y,t.z,o,s,u,l,c,m),De.pixelStorei(De.UNPACK_ROW_LENGTH,h),De.pixelStorei(De.UNPACK_IMAGE_HEIGHT,d),De.pixelStorei(De.UNPACK_SKIP_PIXELS,f),De.pixelStorei(De.UNPACK_SKIP_ROWS,p),De.pixelStorei(De.UNPACK_SKIP_IMAGES,v),0===i&&r.generateMipmaps&&De.generateMipmap(a),he.unbindTexture()}},this.initTexture=function(e){e.isCubeTexture?pe.setTextureCube(e,0):e.isData3DTexture?pe.setTexture3D(e,0):e.isDataArrayTexture||e.isCompressedArrayTexture?pe.setTexture2DArray(e,0):pe.setTexture2D(e,0),he.unbindTexture()},this.resetState=function(){I=0,D=0,U=null,he.reset(),Pe.reset()},"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}return s(e,[{key:"coordinateSystem",get:function(){return $n}},{key:"physicallyCorrectLights",get:function(){return console.warn("THREE.WebGLRenderer: The property .physicallyCorrectLights has been removed. Set renderer.useLegacyLights instead."),!this.useLegacyLights},set:function(e){console.warn("THREE.WebGLRenderer: The property .physicallyCorrectLights has been removed. Set renderer.useLegacyLights instead."),this.useLegacyLights=!e}},{key:"outputEncoding",get:function(){return console.warn("THREE.WebGLRenderer: Property .outputEncoding has been removed. Use .outputColorSpace instead."),this.outputColorSpace===pn?un:sn},set:function(e){console.warn("THREE.WebGLRenderer: Property .outputEncoding has been removed. Use .outputColorSpace instead."),this.outputColorSpace=e===un?pn:vn}},{key:"useLegacyLights",get:function(){return console.warn("THREE.WebGLRenderer: The property .useLegacyLights has been deprecated. Migrate your lighting according to the following guide: https://discourse.threejs.org/t/updates-to-lighting-in-three-js-r155/53733."),this._useLegacyLights},set:function(e){console.warn("THREE.WebGLRenderer: The property .useLegacyLights has been deprecated. Migrate your lighting according to the following guide: https://discourse.threejs.org/t/updates-to-lighting-in-three-js-r155/53733."),this._useLegacyLights=e}}]),e}(),ul=function(e){w(n,e);var t=E(n);function n(){return a(this,n),t.apply(this,arguments)}return s(n)}(sl);ul.prototype.isWebGL1Renderer=!0;var ll,cl=function(){function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:25e-5;a(this,e),this.isFogExp2=!0,this.name="",this.color=new pa(t),this.density=n}return s(e,[{key:"clone",value:function(){return new e(this.color,this.density)}},{key:"toJSON",value:function(){return{type:"FogExp2",color:this.color.getHex(),density:this.density}}}]),e}(),hl=function(){function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1e3;a(this,e),this.isFog=!0,this.name="",this.color=new pa(t),this.near=n,this.far=r}return s(e,[{key:"clone",value:function(){return new e(this.color,this.near,this.far)}},{key:"toJSON",value:function(){return{type:"Fog",color:this.color.getHex(),near:this.near,far:this.far}}}]),e}(),dl=function(e){w(n,e);var t=E(n);function n(){var e;return a(this,n),(e=t.call(this)).isScene=!0,e.type="Scene",e.background=null,e.environment=null,e.fog=null,e.backgroundBlurriness=0,e.backgroundIntensity=1,e.overrideMaterial=null,"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:S(e)})),e}return s(n,[{key:"copy",value:function(e,t){return y(x(n.prototype),"copy",this).call(this,e,t),null!==e.background&&(this.background=e.background.clone()),null!==e.environment&&(this.environment=e.environment.clone()),null!==e.fog&&(this.fog=e.fog.clone()),this.backgroundBlurriness=e.backgroundBlurriness,this.backgroundIntensity=e.backgroundIntensity,null!==e.overrideMaterial&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}},{key:"toJSON",value:function(e){var t=y(x(n.prototype),"toJSON",this).call(this,e);return null!==this.fog&&(t.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(t.object.backgroundBlurriness=this.backgroundBlurriness),1!==this.backgroundIntensity&&(t.object.backgroundIntensity=this.backgroundIntensity),t}}]),n}(Zi),fl=function(){function e(t,n){a(this,e),this.isInterleavedBuffer=!0,this.array=t,this.stride=n,this.count=void 0!==t?t.length/n:0,this.usage=Hn,this.updateRange={offset:0,count:-1},this.version=0,this.uuid=or()}return s(e,[{key:"onUploadCallback",value:function(){}},{key:"needsUpdate",set:function(e){!0===e&&this.version++}},{key:"setUsage",value:function(e){return this.usage=e,this}},{key:"copy",value:function(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this}},{key:"copyAt",value:function(e,t,n){e*=this.stride,n*=t.stride;for(var r=0,i=this.stride;r<i;r++)this.array[e+r]=t.array[n+r];return this}},{key:"set",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.array.set(e,t),this}},{key:"clone",value:function(e){void 0===e.arrayBuffers&&(e.arrayBuffers={}),void 0===this.array.buffer._uuid&&(this.array.buffer._uuid=or()),void 0===e.arrayBuffers[this.array.buffer._uuid]&&(e.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);var t=new this.array.constructor(e.arrayBuffers[this.array.buffer._uuid]),n=new this.constructor(t,this.stride);return n.setUsage(this.usage),n}},{key:"onUpload",value:function(e){return this.onUploadCallback=e,this}},{key:"toJSON",value:function(e){return void 0===e.arrayBuffers&&(e.arrayBuffers={}),void 0===this.array.buffer._uuid&&(this.array.buffer._uuid=or()),void 0===e.arrayBuffers[this.array.buffer._uuid]&&(e.arrayBuffers[this.array.buffer._uuid]=Array.from(new Uint32Array(this.array.buffer))),{uuid:this.uuid,buffer:this.array.buffer._uuid,type:this.array.constructor.name,stride:this.stride}}}]),e}(),pl=new Yr,vl=function(){function e(t,n,r){var i=arguments.length>3&&void 0!==arguments[3]&&arguments[3];a(this,e),this.isInterleavedBufferAttribute=!0,this.name="",this.data=t,this.itemSize=n,this.offset=r,this.normalized=i}return s(e,[{key:"count",get:function(){return this.data.count}},{key:"array",get:function(){return this.data.array}},{key:"needsUpdate",set:function(e){this.data.needsUpdate=e}},{key:"applyMatrix4",value:function(e){for(var t=0,n=this.data.count;t<n;t++)pl.fromBufferAttribute(this,t),pl.applyMatrix4(e),this.setXYZ(t,pl.x,pl.y,pl.z);return this}},{key:"applyNormalMatrix",value:function(e){for(var t=0,n=this.count;t<n;t++)pl.fromBufferAttribute(this,t),pl.applyNormalMatrix(e),this.setXYZ(t,pl.x,pl.y,pl.z);return this}},{key:"transformDirection",value:function(e){for(var t=0,n=this.count;t<n;t++)pl.fromBufferAttribute(this,t),pl.transformDirection(e),this.setXYZ(t,pl.x,pl.y,pl.z);return this}},{key:"setX",value:function(e,t){return this.normalized&&(t=pr(t,this.array)),this.data.array[e*this.data.stride+this.offset]=t,this}},{key:"setY",value:function(e,t){return this.normalized&&(t=pr(t,this.array)),this.data.array[e*this.data.stride+this.offset+1]=t,this}},{key:"setZ",value:function(e,t){return this.normalized&&(t=pr(t,this.array)),this.data.array[e*this.data.stride+this.offset+2]=t,this}},{key:"setW",value:function(e,t){return this.normalized&&(t=pr(t,this.array)),this.data.array[e*this.data.stride+this.offset+3]=t,this}},{key:"getX",value:function(e){var t=this.data.array[e*this.data.stride+this.offset];return this.normalized&&(t=fr(t,this.array)),t}},{key:"getY",value:function(e){var t=this.data.array[e*this.data.stride+this.offset+1];return this.normalized&&(t=fr(t,this.array)),t}},{key:"getZ",value:function(e){var t=this.data.array[e*this.data.stride+this.offset+2];return this.normalized&&(t=fr(t,this.array)),t}},{key:"getW",value:function(e){var t=this.data.array[e*this.data.stride+this.offset+3];return this.normalized&&(t=fr(t,this.array)),t}},{key:"setXY",value:function(e,t,n){return e=e*this.data.stride+this.offset,this.normalized&&(t=pr(t,this.array),n=pr(n,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this}},{key:"setXYZ",value:function(e,t,n,r){return e=e*this.data.stride+this.offset,this.normalized&&(t=pr(t,this.array),n=pr(n,this.array),r=pr(r,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=r,this}},{key:"setXYZW",value:function(e,t,n,r,i){return e=e*this.data.stride+this.offset,this.normalized&&(t=pr(t,this.array),n=pr(n,this.array),r=pr(r,this.array),i=pr(i,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=r,this.data.array[e+3]=i,this}},{key:"clone",value:function(t){if(void 0===t){console.log("THREE.InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will de-interleave buffer data.");for(var n=[],r=0;r<this.count;r++)for(var i=r*this.data.stride+this.offset,a=0;a<this.itemSize;a++)n.push(this.data.array[i+a]);return new wa(new this.array.constructor(n),this.itemSize,this.normalized)}return void 0===t.interleavedBuffers&&(t.interleavedBuffers={}),void 0===t.interleavedBuffers[this.data.uuid]&&(t.interleavedBuffers[this.data.uuid]=this.data.clone(t)),new e(t.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}},{key:"toJSON",value:function(e){if(void 0===e){console.log("THREE.InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will de-interleave buffer data.");for(var t=[],n=0;n<this.count;n++)for(var r=n*this.data.stride+this.offset,i=0;i<this.itemSize;i++)t.push(this.data.array[r+i]);return{itemSize:this.itemSize,type:this.array.constructor.name,array:t,normalized:this.normalized}}return void 0===e.interleavedBuffers&&(e.interleavedBuffers={}),void 0===e.interleavedBuffers[this.data.uuid]&&(e.interleavedBuffers[this.data.uuid]=this.data.toJSON(e)),{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized}}}]),e}(),ml=function(e){w(n,e);var t=E(n);function n(e){var r;return a(this,n),(r=t.call(this)).isSpriteMaterial=!0,r.type="SpriteMaterial",r.color=new pa(16777215),r.map=null,r.alphaMap=null,r.rotation=0,r.sizeAttenuation=!0,r.transparent=!0,r.fog=!0,r.setValues(e),r}return s(n,[{key:"copy",value:function(e){return y(x(n.prototype),"copy",this).call(this,e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.rotation=e.rotation,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}}]),n}(la),gl=new Yr,yl=new Yr,_l=new Yr,xl=new mr,Ml=new mr,Sl=new wi,bl=new Yr,wl=new Yr,Tl=new Yr,El=new mr,Al=new mr,Rl=new mr,kl=function(e){w(n,e);var t=E(n);function n(e){var r;if(a(this,n),(r=t.call(this)).isSprite=!0,r.type="Sprite",void 0===ll){ll=new Ga;var i=new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),o=new fl(i,5);ll.setIndex([0,1,2,0,2,3]),ll.setAttribute("position",new vl(o,3,0,!1)),ll.setAttribute("uv",new vl(o,2,3,!1))}return r.geometry=ll,r.material=void 0!==e?e:new ml,r.center=new mr(.5,.5),r}return s(n,[{key:"raycast",value:function(e,t){null===e.camera&&console.error('THREE.Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),yl.setFromMatrixScale(this.matrixWorld),Sl.copy(e.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(e.camera.matrixWorldInverse,this.matrixWorld),_l.setFromMatrixPosition(this.modelViewMatrix),e.camera.isPerspectiveCamera&&!1===this.material.sizeAttenuation&&yl.multiplyScalar(-_l.z);var n,r,i=this.material.rotation;0!==i&&(r=Math.cos(i),n=Math.sin(i));var a=this.center;Cl(bl.set(-.5,-.5,0),_l,a,yl,n,r),Cl(wl.set(.5,-.5,0),_l,a,yl,n,r),Cl(Tl.set(.5,.5,0),_l,a,yl,n,r),El.set(0,0),Al.set(1,0),Rl.set(1,1);var o=e.ray.intersectTriangle(bl,wl,Tl,!1,gl);if(null!==o||(Cl(wl.set(-.5,.5,0),_l,a,yl,n,r),Al.set(0,1),null!==(o=e.ray.intersectTriangle(bl,Tl,wl,!1,gl)))){var s=e.ray.origin.distanceTo(gl);s<e.near||s>e.far||t.push({distance:s,point:gl.clone(),uv:sa.getInterpolation(gl,bl,wl,Tl,El,Al,Rl,new mr),face:null,object:this})}}},{key:"copy",value:function(e,t){return y(x(n.prototype),"copy",this).call(this,e,t),void 0!==e.center&&this.center.copy(e.center),this.material=e.material,this}}]),n}(Zi);function Cl(e,t,n,r,i,a){xl.subVectors(e,n).addScalar(.5).multiply(r),void 0!==i?(Ml.x=a*xl.x-i*xl.y,Ml.y=i*xl.x+a*xl.y):Ml.copy(xl),e.copy(t),e.x+=Ml.x,e.y+=Ml.y,e.applyMatrix4(Sl)}var Ll=new Yr,Pl=new Yr,Il=function(e){w(n,e);var t=E(n);function n(){var e;return a(this,n),(e=t.call(this))._currentLevel=0,e.type="LOD",Object.defineProperties(S(e),{levels:{enumerable:!0,value:[]},isLOD:{value:!0}}),e.autoUpdate=!0,e}return s(n,[{key:"copy",value:function(e){y(x(n.prototype),"copy",this).call(this,e,!1);for(var t=e.levels,r=0,i=t.length;r<i;r++){var a=t[r];this.addLevel(a.object.clone(),a.distance,a.hysteresis)}return this.autoUpdate=e.autoUpdate,this}},{key:"addLevel",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;t=Math.abs(t);var r,i=this.levels;for(r=0;r<i.length&&!(t<i[r].distance);r++);return i.splice(r,0,{distance:t,hysteresis:n,object:e}),this.add(e),this}},{key:"getCurrentLevel",value:function(){return this._currentLevel}},{key:"getObjectForDistance",value:function(e){var t=this.levels;if(t.length>0){var n,r;for(n=1,r=t.length;n<r;n++){var i=t[n].distance;if(t[n].object.visible&&(i-=i*t[n].hysteresis),e<i)break}return t[n-1].object}return null}},{key:"raycast",value:function(e,t){if(this.levels.length>0){Ll.setFromMatrixPosition(this.matrixWorld);var n=e.ray.origin.distanceTo(Ll);this.getObjectForDistance(n).raycast(e,t)}}},{key:"update",value:function(e){var t=this.levels;if(t.length>1){Ll.setFromMatrixPosition(e.matrixWorld),Pl.setFromMatrixPosition(this.matrixWorld);var n,r,i=Ll.distanceTo(Pl)/e.zoom;for(t[0].object.visible=!0,n=1,r=t.length;n<r;n++){var a=t[n].distance;if(t[n].object.visible&&(a-=a*t[n].hysteresis),!(i>=a))break;t[n-1].object.visible=!1,t[n].object.visible=!0}for(this._currentLevel=n-1;n<r;n++)t[n].object.visible=!1}}},{key:"toJSON",value:function(e){var t=y(x(n.prototype),"toJSON",this).call(this,e);!1===this.autoUpdate&&(t.object.autoUpdate=!1),t.object.levels=[];for(var r=this.levels,i=0,a=r.length;i<a;i++){var o=r[i];t.object.levels.push({object:o.object.uuid,distance:o.distance,hysteresis:o.hysteresis})}return t}}]),n}(Zi),Dl=new Yr,Ul=new Br,Ol=new Br,Nl=new Yr,Fl=new wi,Bl=new Yr,zl=new vi,Hl=new wi,Gl=new bi,Vl=function(e){w(n,e);var t=E(n);function n(e,r){var i;return a(this,n),(i=t.call(this,e,r)).isSkinnedMesh=!0,i.type="SkinnedMesh",i.bindMode="attached",i.bindMatrix=new wi,i.bindMatrixInverse=new wi,i.boundingBox=null,i.boundingSphere=null,i}return s(n,[{key:"computeBoundingBox",value:function(){var e=this.geometry;null===this.boundingBox&&(this.boundingBox=new Jr),this.boundingBox.makeEmpty();for(var t=e.getAttribute("position"),n=0;n<t.count;n++)Bl.fromBufferAttribute(t,n),this.applyBoneTransform(n,Bl),this.boundingBox.expandByPoint(Bl)}},{key:"computeBoundingSphere",value:function(){var e=this.geometry;null===this.boundingSphere&&(this.boundingSphere=new vi),this.boundingSphere.makeEmpty();for(var t=e.getAttribute("position"),n=0;n<t.count;n++)Bl.fromBufferAttribute(t,n),this.applyBoneTransform(n,Bl),this.boundingSphere.expandByPoint(Bl)}},{key:"copy",value:function(e,t){return y(x(n.prototype),"copy",this).call(this,e,t),this.bindMode=e.bindMode,this.bindMatrix.copy(e.bindMatrix),this.bindMatrixInverse.copy(e.bindMatrixInverse),this.skeleton=e.skeleton,null!==e.boundingBox&&(this.boundingBox=e.boundingBox.clone()),null!==e.boundingSphere&&(this.boundingSphere=e.boundingSphere.clone()),this}},{key:"raycast",value:function(e,t){var n=this.material,r=this.matrixWorld;void 0!==n&&(null===this.boundingSphere&&this.computeBoundingSphere(),zl.copy(this.boundingSphere),zl.applyMatrix4(r),!1!==e.ray.intersectsSphere(zl)&&(Hl.copy(r).invert(),Gl.copy(e.ray).applyMatrix4(Hl),null!==this.boundingBox&&!1===Gl.intersectsBox(this.boundingBox)||this._computeIntersections(e,t,Gl)))}},{key:"getVertexPosition",value:function(e,t){return y(x(n.prototype),"getVertexPosition",this).call(this,e,t),this.applyBoneTransform(e,t),t}},{key:"bind",value:function(e,t){this.skeleton=e,void 0===t&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),t=this.matrixWorld),this.bindMatrix.copy(t),this.bindMatrixInverse.copy(t).invert()}},{key:"pose",value:function(){this.skeleton.pose()}},{key:"normalizeSkinWeights",value:function(){for(var e=new Br,t=this.geometry.attributes.skinWeight,n=0,r=t.count;n<r;n++){e.fromBufferAttribute(t,n);var i=1/e.manhattanLength();i!==1/0?e.multiplyScalar(i):e.set(1,0,0,0),t.setXYZW(n,e.x,e.y,e.z,e.w)}}},{key:"updateMatrixWorld",value:function(e){y(x(n.prototype),"updateMatrixWorld",this).call(this,e),"attached"===this.bindMode?this.bindMatrixInverse.copy(this.matrixWorld).invert():"detached"===this.bindMode?this.bindMatrixInverse.copy(this.bindMatrix).invert():console.warn("THREE.SkinnedMesh: Unrecognized bindMode: "+this.bindMode)}},{key:"applyBoneTransform",value:function(e,t){var n=this.skeleton,r=this.geometry;Ul.fromBufferAttribute(r.attributes.skinIndex,e),Ol.fromBufferAttribute(r.attributes.skinWeight,e),Dl.copy(t).applyMatrix4(this.bindMatrix),t.set(0,0,0);for(var i=0;i<4;i++){var a=Ol.getComponent(i);if(0!==a){var o=Ul.getComponent(i);Fl.multiplyMatrices(n.bones[o].matrixWorld,n.boneInverses[o]),t.addScaledVector(Nl.copy(Dl).applyMatrix4(Fl),a)}}return t.applyMatrix4(this.bindMatrixInverse)}},{key:"boneTransform",value:function(e,t){return console.warn("THREE.SkinnedMesh: .boneTransform() was renamed to .applyBoneTransform() in r151."),this.applyBoneTransform(e,t)}}]),n}(oo),Wl=function(e){w(n,e);var t=E(n);function n(){var e;return a(this,n),(e=t.call(this)).isBone=!0,e.type="Bone",e}return s(n)}(Zi),jl=function(e){w(n,e);var t=E(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,s=arguments.length>3?arguments[3]:void 0,u=arguments.length>4?arguments[4]:void 0,l=arguments.length>5?arguments[5]:void 0,c=arguments.length>6?arguments[6]:void 0,h=arguments.length>7?arguments[7]:void 0,d=arguments.length>8&&void 0!==arguments[8]?arguments[8]:Fe,f=arguments.length>9&&void 0!==arguments[9]?arguments[9]:Fe,p=arguments.length>10?arguments[10]:void 0,v=arguments.length>11?arguments[11]:void 0;return a(this,n),(e=t.call(this,null,l,c,h,d,f,s,u,p,v)).isDataTexture=!0,e.image={data:r,width:i,height:o},e.generateMipmaps=!1,e.flipY=!1,e.unpackAlignment=1,e}return s(n)}(Fr),Xl=new wi,ql=new wi,Yl=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];a(this,e),this.uuid=or(),this.bones=t.slice(0),this.boneInverses=n,this.boneMatrices=null,this.boneTexture=null,this.boneTextureSize=0,this.init()}return s(e,[{key:"init",value:function(){var e=this.bones,t=this.boneInverses;if(this.boneMatrices=new Float32Array(16*e.length),0===t.length)this.calculateInverses();else if(e.length!==t.length){console.warn("THREE.Skeleton: Number of inverse bone matrices does not match amount of bones."),this.boneInverses=[];for(var n=0,r=this.bones.length;n<r;n++)this.boneInverses.push(new wi)}}},{key:"calculateInverses",value:function(){this.boneInverses.length=0;for(var e=0,t=this.bones.length;e<t;e++){var n=new wi;this.bones[e]&&n.copy(this.bones[e].matrixWorld).invert(),this.boneInverses.push(n)}}},{key:"pose",value:function(){for(var e=0,t=this.bones.length;e<t;e++){var n=this.bones[e];n&&n.matrixWorld.copy(this.boneInverses[e]).invert()}for(var r=0,i=this.bones.length;r<i;r++){var a=this.bones[r];a&&(a.parent&&a.parent.isBone?(a.matrix.copy(a.parent.matrixWorld).invert(),a.matrix.multiply(a.matrixWorld)):a.matrix.copy(a.matrixWorld),a.matrix.decompose(a.position,a.quaternion,a.scale))}}},{key:"update",value:function(){for(var e=this.bones,t=this.boneInverses,n=this.boneMatrices,r=this.boneTexture,i=0,a=e.length;i<a;i++){var o=e[i]?e[i].matrixWorld:ql;Xl.multiplyMatrices(o,t[i]),Xl.toArray(n,16*i)}null!==r&&(r.needsUpdate=!0)}},{key:"clone",value:function(){return new e(this.bones,this.boneInverses)}},{key:"computeBoneTexture",value:function(){var e=Math.sqrt(4*this.bones.length);e=hr(e),e=Math.max(e,4);var t=new Float32Array(e*e*4);t.set(this.boneMatrices);var n=new jl(t,e,e,ot,et);return n.needsUpdate=!0,this.boneMatrices=t,this.boneTexture=n,this.boneTextureSize=e,this}},{key:"getBoneByName",value:function(e){for(var t=0,n=this.bones.length;t<n;t++){var r=this.bones[t];if(r.name===e)return r}}},{key:"dispose",value:function(){null!==this.boneTexture&&(this.boneTexture.dispose(),this.boneTexture=null)}},{key:"fromJSON",value:function(e,t){this.uuid=e.uuid;for(var n=0,r=e.bones.length;n<r;n++){var i=e.bones[n],a=t[i];void 0===a&&(console.warn("THREE.Skeleton: No bone found with UUID:",i),a=new Wl),this.bones.push(a),this.boneInverses.push((new wi).fromArray(e.boneInverses[n]))}return this.init(),this}},{key:"toJSON",value:function(){var e={metadata:{version:4.6,type:"Skeleton",generator:"Skeleton.toJSON"},bones:[],boneInverses:[]};e.uuid=this.uuid;for(var t=this.bones,n=this.boneInverses,r=0,i=t.length;r<i;r++){var a=t[r];e.bones.push(a.uuid);var o=n[r];e.boneInverses.push(o.toArray())}return e}}]),e}(),Zl=function(e){w(n,e);var t=E(n);function n(e,r,i){var o,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1;return a(this,n),(o=t.call(this,e,r,i)).isInstancedBufferAttribute=!0,o.meshPerAttribute=s,o}return s(n,[{key:"copy",value:function(e){return y(x(n.prototype),"copy",this).call(this,e),this.meshPerAttribute=e.meshPerAttribute,this}},{key:"toJSON",value:function(){var e=y(x(n.prototype),"toJSON",this).call(this);return e.meshPerAttribute=this.meshPerAttribute,e.isInstancedBufferAttribute=!0,e}}]),n}(wa),Kl=new wi,Jl=new wi,Ql=[],$l=new Jr,ec=new wi,tc=new oo,nc=new vi,rc=function(e){w(n,e);var t=E(n);function n(e,r,i){var o;a(this,n),(o=t.call(this,e,r)).isInstancedMesh=!0,o.instanceMatrix=new Zl(new Float32Array(16*i),16),o.instanceColor=null,o.count=i,o.boundingBox=null,o.boundingSphere=null;for(var s=0;s<i;s++)o.setMatrixAt(s,ec);return o}return s(n,[{key:"computeBoundingBox",value:function(){var e=this.geometry,t=this.count;null===this.boundingBox&&(this.boundingBox=new Jr),null===e.boundingBox&&e.computeBoundingBox(),this.boundingBox.makeEmpty();for(var n=0;n<t;n++)this.getMatrixAt(n,Kl),$l.copy(e.boundingBox).applyMatrix4(Kl),this.boundingBox.union($l)}},{key:"computeBoundingSphere",value:function(){var e=this.geometry,t=this.count;null===this.boundingSphere&&(this.boundingSphere=new vi),null===e.boundingSphere&&e.computeBoundingSphere(),this.boundingSphere.makeEmpty();for(var n=0;n<t;n++)this.getMatrixAt(n,Kl),nc.copy(e.boundingSphere).applyMatrix4(Kl),this.boundingSphere.union(nc)}},{key:"copy",value:function(e,t){return y(x(n.prototype),"copy",this).call(this,e,t),this.instanceMatrix.copy(e.instanceMatrix),null!==e.instanceColor&&(this.instanceColor=e.instanceColor.clone()),this.count=e.count,null!==e.boundingBox&&(this.boundingBox=e.boundingBox.clone()),null!==e.boundingSphere&&(this.boundingSphere=e.boundingSphere.clone()),this}},{key:"getColorAt",value:function(e,t){t.fromArray(this.instanceColor.array,3*e)}},{key:"getMatrixAt",value:function(e,t){t.fromArray(this.instanceMatrix.array,16*e)}},{key:"raycast",value:function(e,t){var n=this.matrixWorld,r=this.count;if(tc.geometry=this.geometry,tc.material=this.material,void 0!==tc.material&&(null===this.boundingSphere&&this.computeBoundingSphere(),nc.copy(this.boundingSphere),nc.applyMatrix4(n),!1!==e.ray.intersectsSphere(nc)))for(var i=0;i<r;i++){this.getMatrixAt(i,Kl),Jl.multiplyMatrices(n,Kl),tc.matrixWorld=Jl,tc.raycast(e,Ql);for(var a=0,o=Ql.length;a<o;a++){var s=Ql[a];s.instanceId=i,s.object=this,t.push(s)}Ql.length=0}}},{key:"setColorAt",value:function(e,t){null===this.instanceColor&&(this.instanceColor=new Zl(new Float32Array(3*this.instanceMatrix.count),3)),t.toArray(this.instanceColor.array,3*e)}},{key:"setMatrixAt",value:function(e,t){t.toArray(this.instanceMatrix.array,16*e)}},{key:"updateMorphTargets",value:function(){}},{key:"dispose",value:function(){this.dispatchEvent({type:"dispose"})}}]),n}(oo),ic=function(e){w(n,e);var t=E(n);function n(e){var r;return a(this,n),(r=t.call(this)).isLineBasicMaterial=!0,r.type="LineBasicMaterial",r.color=new pa(16777215),r.map=null,r.linewidth=1,r.linecap="round",r.linejoin="round",r.fog=!0,r.setValues(e),r}return s(n,[{key:"copy",value:function(e){return y(x(n.prototype),"copy",this).call(this,e),this.color.copy(e.color),this.map=e.map,this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this.fog=e.fog,this}}]),n}(la),ac=new Yr,oc=new Yr,sc=new wi,uc=new bi,lc=new vi,cc=function(e){w(n,e);var t=E(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Ga,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new ic;return a(this,n),(e=t.call(this)).isLine=!0,e.type="Line",e.geometry=r,e.material=i,e.updateMorphTargets(),e}return s(n,[{key:"copy",value:function(e,t){return y(x(n.prototype),"copy",this).call(this,e,t),this.material=e.material,this.geometry=e.geometry,this}},{key:"computeLineDistances",value:function(){var e=this.geometry;if(null===e.index){for(var t=e.attributes.position,n=[0],r=1,i=t.count;r<i;r++)ac.fromBufferAttribute(t,r-1),oc.fromBufferAttribute(t,r),n[r]=n[r-1],n[r]+=ac.distanceTo(oc);e.setAttribute("lineDistance",new Ia(n,1))}else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}},{key:"raycast",value:function(e,t){var n=this.geometry,r=this.matrixWorld,i=e.params.Line.threshold,a=n.drawRange;if(null===n.boundingSphere&&n.computeBoundingSphere(),lc.copy(n.boundingSphere),lc.applyMatrix4(r),lc.radius+=i,!1!==e.ray.intersectsSphere(lc)){sc.copy(r).invert(),uc.copy(e.ray).applyMatrix4(sc);var o=i/((this.scale.x+this.scale.y+this.scale.z)/3),s=o*o,u=new Yr,l=new Yr,c=new Yr,h=new Yr,d=this.isLineSegments?2:1,f=n.index,p=n.attributes.position;if(null!==f)for(var v=Math.max(0,a.start),m=Math.min(f.count,a.start+a.count)-1;v<m;v+=d){var g=f.getX(v),y=f.getX(v+1);if(u.fromBufferAttribute(p,g),l.fromBufferAttribute(p,y),!(uc.distanceSqToSegment(u,l,h,c)>s)){h.applyMatrix4(this.matrixWorld);var _=e.ray.origin.distanceTo(h);_<e.near||_>e.far||t.push({distance:_,point:c.clone().applyMatrix4(this.matrixWorld),index:v,face:null,faceIndex:null,object:this})}}else for(var x=Math.max(0,a.start),M=Math.min(p.count,a.start+a.count)-1;x<M;x+=d){if(u.fromBufferAttribute(p,x),l.fromBufferAttribute(p,x+1),!(uc.distanceSqToSegment(u,l,h,c)>s)){h.applyMatrix4(this.matrixWorld);var S=e.ray.origin.distanceTo(h);S<e.near||S>e.far||t.push({distance:S,point:c.clone().applyMatrix4(this.matrixWorld),index:x,face:null,faceIndex:null,object:this})}}}}},{key:"updateMorphTargets",value:function(){var e=this.geometry.morphAttributes,t=Object.keys(e);if(t.length>0){var n=e[t[0]];if(void 0!==n){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(var r=0,i=n.length;r<i;r++){var a=n[r].name||String(r);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=r}}}}}]),n}(Zi),hc=new Yr,dc=new Yr,fc=function(e){w(n,e);var t=E(n);function n(e,r){var i;return a(this,n),(i=t.call(this,e,r)).isLineSegments=!0,i.type="LineSegments",i}return s(n,[{key:"computeLineDistances",value:function(){var e=this.geometry;if(null===e.index){for(var t=e.attributes.position,n=[],r=0,i=t.count;r<i;r+=2)hc.fromBufferAttribute(t,r),dc.fromBufferAttribute(t,r+1),n[r]=0===r?0:n[r-1],n[r+1]=n[r]+hc.distanceTo(dc);e.setAttribute("lineDistance",new Ia(n,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}}]),n}(cc),pc=function(e){w(n,e);var t=E(n);function n(e,r){var i;return a(this,n),(i=t.call(this,e,r)).isLineLoop=!0,i.type="LineLoop",i}return s(n)}(cc),vc=function(e){w(n,e);var t=E(n);function n(e){var r;return a(this,n),(r=t.call(this)).isPointsMaterial=!0,r.type="PointsMaterial",r.color=new pa(16777215),r.map=null,r.alphaMap=null,r.size=1,r.sizeAttenuation=!0,r.fog=!0,r.setValues(e),r}return s(n,[{key:"copy",value:function(e){return y(x(n.prototype),"copy",this).call(this,e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.size=e.size,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}}]),n}(la),mc=new wi,gc=new bi,yc=new vi,_c=new Yr,xc=function(e){w(n,e);var t=E(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Ga,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new vc;return a(this,n),(e=t.call(this)).isPoints=!0,e.type="Points",e.geometry=r,e.material=i,e.updateMorphTargets(),e}return s(n,[{key:"copy",value:function(e,t){return y(x(n.prototype),"copy",this).call(this,e,t),this.material=e.material,this.geometry=e.geometry,this}},{key:"raycast",value:function(e,t){var n=this.geometry,r=this.matrixWorld,i=e.params.Points.threshold,a=n.drawRange;if(null===n.boundingSphere&&n.computeBoundingSphere(),yc.copy(n.boundingSphere),yc.applyMatrix4(r),yc.radius+=i,!1!==e.ray.intersectsSphere(yc)){mc.copy(r).invert(),gc.copy(e.ray).applyMatrix4(mc);var o=i/((this.scale.x+this.scale.y+this.scale.z)/3),s=o*o,u=n.index,l=n.attributes.position;if(null!==u)for(var c=Math.max(0,a.start),h=Math.min(u.count,a.start+a.count);c<h;c++){var d=u.getX(c);_c.fromBufferAttribute(l,d),Mc(_c,d,s,r,e,t,this)}else for(var f=Math.max(0,a.start),p=Math.min(l.count,a.start+a.count);f<p;f++)_c.fromBufferAttribute(l,f),Mc(_c,f,s,r,e,t,this)}}},{key:"updateMorphTargets",value:function(){var e=this.geometry.morphAttributes,t=Object.keys(e);if(t.length>0){var n=e[t[0]];if(void 0!==n){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(var r=0,i=n.length;r<i;r++){var a=n[r].name||String(r);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=r}}}}}]),n}(Zi);function Mc(e,t,n,r,i,a,o){var s=gc.distanceSqToPoint(e);if(s<n){var u=new Yr;gc.closestPointToPoint(e,u),u.applyMatrix4(r);var l=i.ray.origin.distanceTo(u);if(l<i.near||l>i.far)return;a.push({distance:l,distanceToRay:Math.sqrt(s),point:u,index:t,face:null,object:o})}}var Sc=function(e){w(n,e);var t=E(n);function n(e,r,i,o,s,u,l,c,h){var d;a(this,n),(d=t.call(this,e,r,i,o,s,u,l,c,h)).isVideoTexture=!0,d.minFilter=void 0!==u?u:Ve,d.magFilter=void 0!==s?s:Ve,d.generateMipmaps=!1;var f=S(d);return"requestVideoFrameCallback"in e&&e.requestVideoFrameCallback((function t(){f.needsUpdate=!0,e.requestVideoFrameCallback(t)})),d}return s(n,[{key:"clone",value:function(){return new this.constructor(this.image).copy(this)}},{key:"update",value:function(){var e=this.image;!1==="requestVideoFrameCallback"in e&&e.readyState>=e.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}}]),n}(Fr),bc=function(e){w(n,e);var t=E(n);function n(e,r){var i;return a(this,n),(i=t.call(this,{width:e,height:r})).isFramebufferTexture=!0,i.magFilter=Fe,i.minFilter=Fe,i.generateMipmaps=!1,i.needsUpdate=!0,i}return s(n)}(Fr),wc=function(e){w(n,e);var t=E(n);function n(e,r,i,o,s,u,l,c,h,d,f,p){var v;return a(this,n),(v=t.call(this,null,u,l,c,h,d,o,s,f,p)).isCompressedTexture=!0,v.image={width:r,height:i},v.mipmaps=e,v.flipY=!1,v.generateMipmaps=!1,v}return s(n)}(Fr),Tc=function(e){w(n,e);var t=E(n);function n(e,r,i,o,s,u){var l;return a(this,n),(l=t.call(this,e,r,i,s,u)).isCompressedArrayTexture=!0,l.image.depth=o,l.wrapR=Oe,l}return s(n)}(wc),Ec=function(e){w(n,e);var t=E(n);function n(e,r,i){var o;return a(this,n),(o=t.call(this,void 0,e[0].width,e[0].height,r,i,Ce)).isCompressedCubeTexture=!0,o.isCubeTexture=!0,o.image=e,o}return s(n)}(wc),Ac=function(e){w(n,e);var t=E(n);function n(e,r,i,o,s,u,l,c,h){var d;return a(this,n),(d=t.call(this,e,r,i,o,s,u,l,c,h)).isCanvasTexture=!0,d.needsUpdate=!0,d}return s(n)}(Fr),Rc=function(){function e(){a(this,e),this.type="Curve",this.arcLengthDivisions=200}return s(e,[{key:"getPoint",value:function(){return console.warn("THREE.Curve: .getPoint() not implemented."),null}},{key:"getPointAt",value:function(e,t){var n=this.getUtoTmapping(e);return this.getPoint(n,t)}},{key:"getPoints",value:function(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:5,t=[],n=0;n<=e;n++)t.push(this.getPoint(n/e));return t}},{key:"getSpacedPoints",value:function(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:5,t=[],n=0;n<=e;n++)t.push(this.getPointAt(n/e));return t}},{key:"getLength",value:function(){var e=this.getLengths();return e[e.length-1]}},{key:"getLengths",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.arcLengthDivisions;if(this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;var t,n=[],r=this.getPoint(0),i=0;n.push(0);for(var a=1;a<=e;a++)i+=(t=this.getPoint(a/e)).distanceTo(r),n.push(i),r=t;return this.cacheArcLengths=n,n}},{key:"updateArcLengths",value:function(){this.needsUpdate=!0,this.getLengths()}},{key:"getUtoTmapping",value:function(e,t){var n,r=this.getLengths(),i=0,a=r.length;n=t||e*r[a-1];for(var o,s=0,u=a-1;s<=u;)if((o=r[i=Math.floor(s+(u-s)/2)]-n)<0)s=i+1;else{if(!(o>0)){u=i;break}u=i-1}if(r[i=u]===n)return i/(a-1);var l=r[i];return(i+(n-l)/(r[i+1]-l))/(a-1)}},{key:"getTangent",value:function(e,t){var n=1e-4,r=e-n,i=e+n;r<0&&(r=0),i>1&&(i=1);var a=this.getPoint(r),o=this.getPoint(i),s=t||(a.isVector2?new mr:new Yr);return s.copy(o).sub(a).normalize(),s}},{key:"getTangentAt",value:function(e,t){var n=this.getUtoTmapping(e);return this.getTangent(n,t)}},{key:"computeFrenetFrames",value:function(e,t){for(var n=new Yr,r=[],i=[],a=[],o=new Yr,s=new wi,u=0;u<=e;u++){var l=u/e;r[u]=this.getTangentAt(l,new Yr)}i[0]=new Yr,a[0]=new Yr;var c=Number.MAX_VALUE,h=Math.abs(r[0].x),d=Math.abs(r[0].y),f=Math.abs(r[0].z);h<=c&&(c=h,n.set(1,0,0)),d<=c&&(c=d,n.set(0,1,0)),f<=c&&n.set(0,0,1),o.crossVectors(r[0],n).normalize(),i[0].crossVectors(r[0],o),a[0].crossVectors(r[0],i[0]);for(var p=1;p<=e;p++){if(i[p]=i[p-1].clone(),a[p]=a[p-1].clone(),o.crossVectors(r[p-1],r[p]),o.length()>Number.EPSILON){o.normalize();var v=Math.acos(sr(r[p-1].dot(r[p]),-1,1));i[p].applyMatrix4(s.makeRotationAxis(o,v))}a[p].crossVectors(r[p],i[p])}if(!0===t){var m=Math.acos(sr(i[0].dot(i[e]),-1,1));m/=e,r[0].dot(o.crossVectors(i[0],i[e]))>0&&(m=-m);for(var g=1;g<=e;g++)i[g].applyMatrix4(s.makeRotationAxis(r[g],m*g)),a[g].crossVectors(r[g],i[g])}return{tangents:r,normals:i,binormals:a}}},{key:"clone",value:function(){return(new this.constructor).copy(this)}},{key:"copy",value:function(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}},{key:"toJSON",value:function(){var e={metadata:{version:4.6,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e}},{key:"fromJSON",value:function(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}}]),e}(),kc=function(e){w(n,e);var t=E(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,u=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,l=arguments.length>5&&void 0!==arguments[5]?arguments[5]:2*Math.PI,c=arguments.length>6&&void 0!==arguments[6]&&arguments[6],h=arguments.length>7&&void 0!==arguments[7]?arguments[7]:0;return a(this,n),(e=t.call(this)).isEllipseCurve=!0,e.type="EllipseCurve",e.aX=r,e.aY=i,e.xRadius=o,e.yRadius=s,e.aStartAngle=u,e.aEndAngle=l,e.aClockwise=c,e.aRotation=h,e}return s(n,[{key:"getPoint",value:function(e,t){for(var n=t||new mr,r=2*Math.PI,i=this.aEndAngle-this.aStartAngle,a=Math.abs(i)<Number.EPSILON;i<0;)i+=r;for(;i>r;)i-=r;i<Number.EPSILON&&(i=a?0:r),!0!==this.aClockwise||a||(i===r?i=-r:i-=r);var o=this.aStartAngle+e*i,s=this.aX+this.xRadius*Math.cos(o),u=this.aY+this.yRadius*Math.sin(o);if(0!==this.aRotation){var l=Math.cos(this.aRotation),c=Math.sin(this.aRotation),h=s-this.aX,d=u-this.aY;s=h*l-d*c+this.aX,u=h*c+d*l+this.aY}return n.set(s,u)}},{key:"copy",value:function(e){return y(x(n.prototype),"copy",this).call(this,e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}},{key:"toJSON",value:function(){var e=y(x(n.prototype),"toJSON",this).call(this);return e.aX=this.aX,e.aY=this.aY,e.xRadius=this.xRadius,e.yRadius=this.yRadius,e.aStartAngle=this.aStartAngle,e.aEndAngle=this.aEndAngle,e.aClockwise=this.aClockwise,e.aRotation=this.aRotation,e}},{key:"fromJSON",value:function(e){return y(x(n.prototype),"fromJSON",this).call(this,e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}}]),n}(Rc),Cc=function(e){w(n,e);var t=E(n);function n(e,r,i,o,s,u){var l;return a(this,n),(l=t.call(this,e,r,i,i,o,s,u)).isArcCurve=!0,l.type="ArcCurve",l}return s(n)}(kc);function Lc(){var e=0,t=0,n=0,r=0;function i(i,a,o,s){e=i,t=o,n=-3*i+3*a-2*o-s,r=2*i-2*a+o+s}return{initCatmullRom:function(e,t,n,r,a){i(t,n,a*(n-e),a*(r-t))},initNonuniformCatmullRom:function(e,t,n,r,a,o,s){var u=(t-e)/a-(n-e)/(a+o)+(n-t)/o,l=(n-t)/o-(r-t)/(o+s)+(r-n)/s;i(t,n,u*=o,l*=o)},calc:function(i){var a=i*i;return e+t*i+n*a+r*(a*i)}}}var Pc=new Yr,Ic=new Lc,Dc=new Lc,Uc=new Lc,Oc=function(e){w(n,e);var t=E(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],i=arguments.length>1&&void 0!==arguments[1]&&arguments[1],o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"centripetal",s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:.5;return a(this,n),(e=t.call(this)).isCatmullRomCurve3=!0,e.type="CatmullRomCurve3",e.points=r,e.closed=i,e.curveType=o,e.tension=s,e}return s(n,[{key:"getPoint",value:function(e){var t,n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Yr,i=r,a=this.points,o=a.length,s=(o-(this.closed?0:1))*e,u=Math.floor(s),l=s-u;this.closed?u+=u>0?0:(Math.floor(Math.abs(u)/o)+1)*o:0===l&&u===o-1&&(u=o-2,l=1),this.closed||u>0?t=a[(u-1)%o]:(Pc.subVectors(a[0],a[1]).add(a[0]),t=Pc);var c=a[u%o],h=a[(u+1)%o];if(this.closed||u+2<o?n=a[(u+2)%o]:(Pc.subVectors(a[o-1],a[o-2]).add(a[o-1]),n=Pc),"centripetal"===this.curveType||"chordal"===this.curveType){var d="chordal"===this.curveType?.5:.25,f=Math.pow(t.distanceToSquared(c),d),p=Math.pow(c.distanceToSquared(h),d),v=Math.pow(h.distanceToSquared(n),d);p<1e-4&&(p=1),f<1e-4&&(f=p),v<1e-4&&(v=p),Ic.initNonuniformCatmullRom(t.x,c.x,h.x,n.x,f,p,v),Dc.initNonuniformCatmullRom(t.y,c.y,h.y,n.y,f,p,v),Uc.initNonuniformCatmullRom(t.z,c.z,h.z,n.z,f,p,v)}else"catmullrom"===this.curveType&&(Ic.initCatmullRom(t.x,c.x,h.x,n.x,this.tension),Dc.initCatmullRom(t.y,c.y,h.y,n.y,this.tension),Uc.initCatmullRom(t.z,c.z,h.z,n.z,this.tension));return i.set(Ic.calc(l),Dc.calc(l),Uc.calc(l)),i}},{key:"copy",value:function(e){y(x(n.prototype),"copy",this).call(this,e),this.points=[];for(var t=0,r=e.points.length;t<r;t++){var i=e.points[t];this.points.push(i.clone())}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}},{key:"toJSON",value:function(){var e=y(x(n.prototype),"toJSON",this).call(this);e.points=[];for(var t=0,r=this.points.length;t<r;t++){var i=this.points[t];e.points.push(i.toArray())}return e.closed=this.closed,e.curveType=this.curveType,e.tension=this.tension,e}},{key:"fromJSON",value:function(e){y(x(n.prototype),"fromJSON",this).call(this,e),this.points=[];for(var t=0,r=e.points.length;t<r;t++){var i=e.points[t];this.points.push((new Yr).fromArray(i))}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}}]),n}(Rc);function Nc(e,t,n,r,i){var a=.5*(r-t),o=.5*(i-n),s=e*e;return(2*n-2*r+a+o)*(e*s)+(-3*n+3*r-2*a-o)*s+a*e+n}function Fc(e,t,n,r){return function(e,t){var n=1-e;return n*n*t}(e,t)+function(e,t){return 2*(1-e)*e*t}(e,n)+function(e,t){return e*e*t}(e,r)}function Bc(e,t,n,r,i){return function(e,t){var n=1-e;return n*n*n*t}(e,t)+function(e,t){var n=1-e;return 3*n*n*e*t}(e,n)+function(e,t){return 3*(1-e)*e*e*t}(e,r)+function(e,t){return e*e*e*t}(e,i)}var zc=function(e){w(n,e);var t=E(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new mr,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new mr,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:new mr,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:new mr;return a(this,n),(e=t.call(this)).isCubicBezierCurve=!0,e.type="CubicBezierCurve",e.v0=r,e.v1=i,e.v2=o,e.v3=s,e}return s(n,[{key:"getPoint",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new mr,n=t,r=this.v0,i=this.v1,a=this.v2,o=this.v3;return n.set(Bc(e,r.x,i.x,a.x,o.x),Bc(e,r.y,i.y,a.y,o.y)),n}},{key:"copy",value:function(e){return y(x(n.prototype),"copy",this).call(this,e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}},{key:"toJSON",value:function(){var e=y(x(n.prototype),"toJSON",this).call(this);return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}},{key:"fromJSON",value:function(e){return y(x(n.prototype),"fromJSON",this).call(this,e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}}]),n}(Rc),Hc=function(e){w(n,e);var t=E(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Yr,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Yr,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:new Yr,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:new Yr;return a(this,n),(e=t.call(this)).isCubicBezierCurve3=!0,e.type="CubicBezierCurve3",e.v0=r,e.v1=i,e.v2=o,e.v3=s,e}return s(n,[{key:"getPoint",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Yr,n=t,r=this.v0,i=this.v1,a=this.v2,o=this.v3;return n.set(Bc(e,r.x,i.x,a.x,o.x),Bc(e,r.y,i.y,a.y,o.y),Bc(e,r.z,i.z,a.z,o.z)),n}},{key:"copy",value:function(e){return y(x(n.prototype),"copy",this).call(this,e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}},{key:"toJSON",value:function(){var e=y(x(n.prototype),"toJSON",this).call(this);return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}},{key:"fromJSON",value:function(e){return y(x(n.prototype),"fromJSON",this).call(this,e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}}]),n}(Rc),Gc=function(e){w(n,e);var t=E(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new mr,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new mr;return a(this,n),(e=t.call(this)).isLineCurve=!0,e.type="LineCurve",e.v1=r,e.v2=i,e}return s(n,[{key:"getPoint",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new mr,n=t;return 1===e?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(e).add(this.v1)),n}},{key:"getPointAt",value:function(e,t){return this.getPoint(e,t)}},{key:"getTangent",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new mr;return t.subVectors(this.v2,this.v1).normalize()}},{key:"getTangentAt",value:function(e,t){return this.getTangent(e,t)}},{key:"copy",value:function(e){return y(x(n.prototype),"copy",this).call(this,e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}},{key:"toJSON",value:function(){var e=y(x(n.prototype),"toJSON",this).call(this);return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}},{key:"fromJSON",value:function(e){return y(x(n.prototype),"fromJSON",this).call(this,e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}]),n}(Rc),Vc=function(e){w(n,e);var t=E(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Yr,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Yr;return a(this,n),(e=t.call(this)).isLineCurve3=!0,e.type="LineCurve3",e.v1=r,e.v2=i,e}return s(n,[{key:"getPoint",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Yr,n=t;return 1===e?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(e).add(this.v1)),n}},{key:"getPointAt",value:function(e,t){return this.getPoint(e,t)}},{key:"getTangent",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Yr;return t.subVectors(this.v2,this.v1).normalize()}},{key:"getTangentAt",value:function(e,t){return this.getTangent(e,t)}},{key:"copy",value:function(e){return y(x(n.prototype),"copy",this).call(this,e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}},{key:"toJSON",value:function(){var e=y(x(n.prototype),"toJSON",this).call(this);return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}},{key:"fromJSON",value:function(e){return y(x(n.prototype),"fromJSON",this).call(this,e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}]),n}(Rc),Wc=function(e){w(n,e);var t=E(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new mr,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new mr,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:new mr;return a(this,n),(e=t.call(this)).isQuadraticBezierCurve=!0,e.type="QuadraticBezierCurve",e.v0=r,e.v1=i,e.v2=o,e}return s(n,[{key:"getPoint",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new mr,n=t,r=this.v0,i=this.v1,a=this.v2;return n.set(Fc(e,r.x,i.x,a.x),Fc(e,r.y,i.y,a.y)),n}},{key:"copy",value:function(e){return y(x(n.prototype),"copy",this).call(this,e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}},{key:"toJSON",value:function(){var e=y(x(n.prototype),"toJSON",this).call(this);return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}},{key:"fromJSON",value:function(e){return y(x(n.prototype),"fromJSON",this).call(this,e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}]),n}(Rc),jc=function(e){w(n,e);var t=E(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Yr,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Yr,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:new Yr;return a(this,n),(e=t.call(this)).isQuadraticBezierCurve3=!0,e.type="QuadraticBezierCurve3",e.v0=r,e.v1=i,e.v2=o,e}return s(n,[{key:"getPoint",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Yr,n=t,r=this.v0,i=this.v1,a=this.v2;return n.set(Fc(e,r.x,i.x,a.x),Fc(e,r.y,i.y,a.y),Fc(e,r.z,i.z,a.z)),n}},{key:"copy",value:function(e){return y(x(n.prototype),"copy",this).call(this,e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}},{key:"toJSON",value:function(){var e=y(x(n.prototype),"toJSON",this).call(this);return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}},{key:"fromJSON",value:function(e){return y(x(n.prototype),"fromJSON",this).call(this,e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}]),n}(Rc),Xc=function(e){w(n,e);var t=E(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return a(this,n),(e=t.call(this)).isSplineCurve=!0,e.type="SplineCurve",e.points=r,e}return s(n,[{key:"getPoint",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new mr,n=t,r=this.points,i=(r.length-1)*e,a=Math.floor(i),o=i-a,s=r[0===a?a:a-1],u=r[a],l=r[a>r.length-2?r.length-1:a+1],c=r[a>r.length-3?r.length-1:a+2];return n.set(Nc(o,s.x,u.x,l.x,c.x),Nc(o,s.y,u.y,l.y,c.y)),n}},{key:"copy",value:function(e){y(x(n.prototype),"copy",this).call(this,e),this.points=[];for(var t=0,r=e.points.length;t<r;t++){var i=e.points[t];this.points.push(i.clone())}return this}},{key:"toJSON",value:function(){var e=y(x(n.prototype),"toJSON",this).call(this);e.points=[];for(var t=0,r=this.points.length;t<r;t++){var i=this.points[t];e.points.push(i.toArray())}return e}},{key:"fromJSON",value:function(e){y(x(n.prototype),"fromJSON",this).call(this,e),this.points=[];for(var t=0,r=e.points.length;t<r;t++){var i=e.points[t];this.points.push((new mr).fromArray(i))}return this}}]),n}(Rc),qc=Object.freeze({__proto__:null,ArcCurve:Cc,CatmullRomCurve3:Oc,CubicBezierCurve:zc,CubicBezierCurve3:Hc,EllipseCurve:kc,LineCurve:Gc,LineCurve3:Vc,QuadraticBezierCurve:Wc,QuadraticBezierCurve3:jc,SplineCurve:Xc}),Yc=function(e){w(n,e);var t=E(n);function n(){var e;return a(this,n),(e=t.call(this)).type="CurvePath",e.curves=[],e.autoClose=!1,e}return s(n,[{key:"add",value:function(e){this.curves.push(e)}},{key:"closePath",value:function(){var e=this.curves[0].getPoint(0),t=this.curves[this.curves.length-1].getPoint(1);e.equals(t)||this.curves.push(new Gc(t,e))}},{key:"getPoint",value:function(e,t){for(var n=e*this.getLength(),r=this.getCurveLengths(),i=0;i<r.length;){if(r[i]>=n){var a=r[i]-n,o=this.curves[i],s=o.getLength(),u=0===s?0:1-a/s;return o.getPointAt(u,t)}i++}return null}},{key:"getLength",value:function(){var e=this.getCurveLengths();return e[e.length-1]}},{key:"updateArcLengths",value:function(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}},{key:"getCurveLengths",value:function(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;for(var e=[],t=0,n=0,r=this.curves.length;n<r;n++)t+=this.curves[n].getLength(),e.push(t);return this.cacheLengths=e,e}},{key:"getSpacedPoints",value:function(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:40,t=[],n=0;n<=e;n++)t.push(this.getPoint(n/e));return this.autoClose&&t.push(t[0]),t}},{key:"getPoints",value:function(){for(var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:12,n=[],r=0,i=this.curves;r<i.length;r++)for(var a=i[r],o=a.isEllipseCurve?2*t:a.isLineCurve||a.isLineCurve3?1:a.isSplineCurve?t*a.points.length:t,s=a.getPoints(o),u=0;u<s.length;u++){var l=s[u];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}},{key:"copy",value:function(e){y(x(n.prototype),"copy",this).call(this,e),this.curves=[];for(var t=0,r=e.curves.length;t<r;t++){var i=e.curves[t];this.curves.push(i.clone())}return this.autoClose=e.autoClose,this}},{key:"toJSON",value:function(){var e=y(x(n.prototype),"toJSON",this).call(this);e.autoClose=this.autoClose,e.curves=[];for(var t=0,r=this.curves.length;t<r;t++){var i=this.curves[t];e.curves.push(i.toJSON())}return e}},{key:"fromJSON",value:function(e){y(x(n.prototype),"fromJSON",this).call(this,e),this.autoClose=e.autoClose,this.curves=[];for(var t=0,r=e.curves.length;t<r;t++){var i=e.curves[t];this.curves.push((new qc[i.type]).fromJSON(i))}return this}}]),n}(Rc),Zc=function(e){w(n,e);var t=E(n);function n(e){var r;return a(this,n),(r=t.call(this)).type="Path",r.currentPoint=new mr,e&&r.setFromPoints(e),r}return s(n,[{key:"setFromPoints",value:function(e){this.moveTo(e[0].x,e[0].y);for(var t=1,n=e.length;t<n;t++)this.lineTo(e[t].x,e[t].y);return this}},{key:"moveTo",value:function(e,t){return this.currentPoint.set(e,t),this}},{key:"lineTo",value:function(e,t){var n=new Gc(this.currentPoint.clone(),new mr(e,t));return this.curves.push(n),this.currentPoint.set(e,t),this}},{key:"quadraticCurveTo",value:function(e,t,n,r){var i=new Wc(this.currentPoint.clone(),new mr(e,t),new mr(n,r));return this.curves.push(i),this.currentPoint.set(n,r),this}},{key:"bezierCurveTo",value:function(e,t,n,r,i,a){var o=new zc(this.currentPoint.clone(),new mr(e,t),new mr(n,r),new mr(i,a));return this.curves.push(o),this.currentPoint.set(i,a),this}},{key:"splineThru",value:function(e){var t=[this.currentPoint.clone()].concat(e),n=new Xc(t);return this.curves.push(n),this.currentPoint.copy(e[e.length-1]),this}},{key:"arc",value:function(e,t,n,r,i,a){var o=this.currentPoint.x,s=this.currentPoint.y;return this.absarc(e+o,t+s,n,r,i,a),this}},{key:"absarc",value:function(e,t,n,r,i,a){return this.absellipse(e,t,n,n,r,i,a),this}},{key:"ellipse",value:function(e,t,n,r,i,a,o,s){var u=this.currentPoint.x,l=this.currentPoint.y;return this.absellipse(e+u,t+l,n,r,i,a,o,s),this}},{key:"absellipse",value:function(e,t,n,r,i,a,o,s){var u=new kc(e,t,n,r,i,a,o,s);if(this.curves.length>0){var l=u.getPoint(0);l.equals(this.currentPoint)||this.lineTo(l.x,l.y)}this.curves.push(u);var c=u.getPoint(1);return this.currentPoint.copy(c),this}},{key:"copy",value:function(e){return y(x(n.prototype),"copy",this).call(this,e),this.currentPoint.copy(e.currentPoint),this}},{key:"toJSON",value:function(){var e=y(x(n.prototype),"toJSON",this).call(this);return e.currentPoint=this.currentPoint.toArray(),e}},{key:"fromJSON",value:function(e){return y(x(n.prototype),"fromJSON",this).call(this,e),this.currentPoint.fromArray(e.currentPoint),this}}]),n}(Yc),Kc=function(e){w(n,e);var t=E(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[new mr(0,-.5),new mr(.5,0),new mr(0,.5)],i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:12,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:2*Math.PI;a(this,n),(e=t.call(this)).type="LatheGeometry",e.parameters={points:r,segments:i,phiStart:o,phiLength:s},i=Math.floor(i),s=sr(s,0,2*Math.PI);for(var u=[],l=[],c=[],h=[],d=[],f=1/i,p=new Yr,v=new mr,m=new Yr,g=new Yr,y=new Yr,_=0,x=0,M=0;M<=r.length-1;M++)switch(M){case 0:_=r[M+1].x-r[M].x,x=r[M+1].y-r[M].y,m.x=1*x,m.y=-_,m.z=0*x,y.copy(m),m.normalize(),h.push(m.x,m.y,m.z);break;case r.length-1:h.push(y.x,y.y,y.z);break;default:_=r[M+1].x-r[M].x,x=r[M+1].y-r[M].y,m.x=1*x,m.y=-_,m.z=0*x,g.copy(m),m.x+=y.x,m.y+=y.y,m.z+=y.z,m.normalize(),h.push(m.x,m.y,m.z),y.copy(g)}for(var S=0;S<=i;S++)for(var b=o+S*f*s,w=Math.sin(b),T=Math.cos(b),E=0;E<=r.length-1;E++){p.x=r[E].x*w,p.y=r[E].y,p.z=r[E].x*T,l.push(p.x,p.y,p.z),v.x=S/i,v.y=E/(r.length-1),c.push(v.x,v.y);var A=h[3*E+0]*w,R=h[3*E+1],k=h[3*E+0]*T;d.push(A,R,k)}for(var C=0;C<i;C++)for(var L=0;L<r.length-1;L++){var P=L+C*r.length,I=P,D=P+r.length,U=P+r.length+1,O=P+1;u.push(I,D,O),u.push(U,O,D)}return e.setIndex(u),e.setAttribute("position",new Ia(l,3)),e.setAttribute("uv",new Ia(c,2)),e.setAttribute("normal",new Ia(d,3)),e}return s(n,[{key:"copy",value:function(e){return y(x(n.prototype),"copy",this).call(this,e),this.parameters=Object.assign({},e.parameters),this}}],[{key:"fromJSON",value:function(e){return new n(e.points,e.segments,e.phiStart,e.phiLength)}}]),n}(Ga),Jc=function(e){w(n,e);var t=E(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:4,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:8;a(this,n);var u=new Zc;return u.absarc(0,-i/2,r,1.5*Math.PI,0),u.absarc(0,i/2,r,0,.5*Math.PI),(e=t.call(this,u.getPoints(o),s)).type="CapsuleGeometry",e.parameters={radius:r,length:i,capSegments:o,radialSegments:s},e}return s(n,null,[{key:"fromJSON",value:function(e){return new n(e.radius,e.length,e.capSegments,e.radialSegments)}}]),n}(Kc),Qc=function(e){w(n,e);var t=E(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:32,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:2*Math.PI;a(this,n),(e=t.call(this)).type="CircleGeometry",e.parameters={radius:r,segments:i,thetaStart:o,thetaLength:s},i=Math.max(3,i);var u=[],l=[],c=[],h=[],d=new Yr,f=new mr;l.push(0,0,0),c.push(0,0,1),h.push(.5,.5);for(var p=0,v=3;p<=i;p++,v+=3){var m=o+p/i*s;d.x=r*Math.cos(m),d.y=r*Math.sin(m),l.push(d.x,d.y,d.z),c.push(0,0,1),f.x=(l[v]/r+1)/2,f.y=(l[v+1]/r+1)/2,h.push(f.x,f.y)}for(var g=1;g<=i;g++)u.push(g,g+1,0);return e.setIndex(u),e.setAttribute("position",new Ia(l,3)),e.setAttribute("normal",new Ia(c,3)),e.setAttribute("uv",new Ia(h,2)),e}return s(n,[{key:"copy",value:function(e){return y(x(n.prototype),"copy",this).call(this,e),this.parameters=Object.assign({},e.parameters),this}}],[{key:"fromJSON",value:function(e){return new n(e.radius,e.segments,e.thetaStart,e.thetaLength)}}]),n}(Ga),$c=function(e){w(n,e);var t=E(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:32,u=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1,l=arguments.length>5&&void 0!==arguments[5]&&arguments[5],c=arguments.length>6&&void 0!==arguments[6]?arguments[6]:0,h=arguments.length>7&&void 0!==arguments[7]?arguments[7]:2*Math.PI;a(this,n),(e=t.call(this)).type="CylinderGeometry",e.parameters={radiusTop:r,radiusBottom:i,height:o,radialSegments:s,heightSegments:u,openEnded:l,thetaStart:c,thetaLength:h};var d=S(e);s=Math.floor(s),u=Math.floor(u);var f=[],p=[],v=[],m=[],g=0,y=[],_=o/2,x=0;function M(){for(var e=new Yr,t=new Yr,n=0,a=(i-r)/o,l=0;l<=u;l++){for(var M=[],S=l/u,b=S*(i-r)+r,w=0;w<=s;w++){var T=w/s,E=T*h+c,A=Math.sin(E),R=Math.cos(E);t.x=b*A,t.y=-S*o+_,t.z=b*R,p.push(t.x,t.y,t.z),e.set(A,a,R).normalize(),v.push(e.x,e.y,e.z),m.push(T,1-S),M.push(g++)}y.push(M)}for(var k=0;k<s;k++)for(var C=0;C<u;C++){var L=y[C][k],P=y[C+1][k],I=y[C+1][k+1],D=y[C][k+1];f.push(L,P,D),f.push(P,I,D),n+=6}d.addGroup(x,n,0),x+=n}function b(e){for(var t=g,n=new mr,a=new Yr,o=0,u=!0===e?r:i,l=!0===e?1:-1,y=1;y<=s;y++)p.push(0,_*l,0),v.push(0,l,0),m.push(.5,.5),g++;for(var M=g,S=0;S<=s;S++){var b=S/s*h+c,w=Math.cos(b),T=Math.sin(b);a.x=u*T,a.y=_*l,a.z=u*w,p.push(a.x,a.y,a.z),v.push(0,l,0),n.x=.5*w+.5,n.y=.5*T*l+.5,m.push(n.x,n.y),g++}for(var E=0;E<s;E++){var A=t+E,R=M+E;!0===e?f.push(R,R+1,A):f.push(R+1,R,A),o+=3}d.addGroup(x,o,!0===e?1:2),x+=o}return M(),!1===l&&(r>0&&b(!0),i>0&&b(!1)),e.setIndex(f),e.setAttribute("position",new Ia(p,3)),e.setAttribute("normal",new Ia(v,3)),e.setAttribute("uv",new Ia(m,2)),e}return s(n,[{key:"copy",value:function(e){return y(x(n.prototype),"copy",this).call(this,e),this.parameters=Object.assign({},e.parameters),this}}],[{key:"fromJSON",value:function(e){return new n(e.radiusTop,e.radiusBottom,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}]),n}(Ga),eh=function(e){w(n,e);var t=E(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:32,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,u=arguments.length>4&&void 0!==arguments[4]&&arguments[4],l=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,c=arguments.length>6&&void 0!==arguments[6]?arguments[6]:2*Math.PI;return a(this,n),(e=t.call(this,0,r,i,o,s,u,l,c)).type="ConeGeometry",e.parameters={radius:r,height:i,radialSegments:o,heightSegments:s,openEnded:u,thetaStart:l,thetaLength:c},e}return s(n,null,[{key:"fromJSON",value:function(e){return new n(e.radius,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}]),n}($c),th=function(e){w(n,e);var t=E(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;a(this,n),(e=t.call(this)).type="PolyhedronGeometry",e.parameters={vertices:r,indices:i,radius:o,detail:s};var u=[],l=[];function c(e){for(var t=new Yr,n=new Yr,r=new Yr,a=0;a<i.length;a+=3)m(i[a+0],t),m(i[a+1],n),m(i[a+2],r),h(t,n,r,e)}function h(e,t,n,r){for(var i=r+1,a=[],o=0;o<=i;o++){a[o]=[];for(var s=e.clone().lerp(n,o/i),u=t.clone().lerp(n,o/i),l=i-o,c=0;c<=l;c++)a[o][c]=0===c&&o===i?s:s.clone().lerp(u,c/l)}for(var h=0;h<i;h++)for(var d=0;d<2*(i-h)-1;d++){var f=Math.floor(d/2);d%2==0?(v(a[h][f+1]),v(a[h+1][f]),v(a[h][f])):(v(a[h][f+1]),v(a[h+1][f+1]),v(a[h+1][f]))}}function d(e){for(var t=new Yr,n=0;n<u.length;n+=3)t.x=u[n+0],t.y=u[n+1],t.z=u[n+2],t.normalize().multiplyScalar(e),u[n+0]=t.x,u[n+1]=t.y,u[n+2]=t.z}function f(){for(var e=new Yr,t=0;t<u.length;t+=3){e.x=u[t+0],e.y=u[t+1],e.z=u[t+2];var n=_(e)/2/Math.PI+.5,r=x(e)/Math.PI+.5;l.push(n,1-r)}g(),p()}function p(){for(var e=0;e<l.length;e+=6){var t=l[e+0],n=l[e+2],r=l[e+4],i=Math.max(t,n,r),a=Math.min(t,n,r);i>.9&&a<.1&&(t<.2&&(l[e+0]+=1),n<.2&&(l[e+2]+=1),r<.2&&(l[e+4]+=1))}}function v(e){u.push(e.x,e.y,e.z)}function m(e,t){var n=3*e;t.x=r[n+0],t.y=r[n+1],t.z=r[n+2]}function g(){for(var e=new Yr,t=new Yr,n=new Yr,r=new Yr,i=new mr,a=new mr,o=new mr,s=0,c=0;s<u.length;s+=9,c+=6){e.set(u[s+0],u[s+1],u[s+2]),t.set(u[s+3],u[s+4],u[s+5]),n.set(u[s+6],u[s+7],u[s+8]),i.set(l[c+0],l[c+1]),a.set(l[c+2],l[c+3]),o.set(l[c+4],l[c+5]),r.copy(e).add(t).add(n).divideScalar(3);var h=_(r);y(i,c+0,e,h),y(a,c+2,t,h),y(o,c+4,n,h)}}function y(e,t,n,r){r<0&&1===e.x&&(l[t]=e.x-1),0===n.x&&0===n.z&&(l[t]=r/2/Math.PI+.5)}function _(e){return Math.atan2(e.z,-e.x)}function x(e){return Math.atan2(-e.y,Math.sqrt(e.x*e.x+e.z*e.z))}return c(s),d(o),f(),e.setAttribute("position",new Ia(u,3)),e.setAttribute("normal",new Ia(u.slice(),3)),e.setAttribute("uv",new Ia(l,2)),0===s?e.computeVertexNormals():e.normalizeNormals(),e}return s(n,[{key:"copy",value:function(e){return y(x(n.prototype),"copy",this).call(this,e),this.parameters=Object.assign({},e.parameters),this}}],[{key:"fromJSON",value:function(e){return new n(e.vertices,e.indices,e.radius,e.details)}}]),n}(Ga),nh=function(e){w(n,e);var t=E(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;a(this,n);var o=(1+Math.sqrt(5))/2,s=1/o,u=[-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,-s,-o,0,-s,o,0,s,-o,0,s,o,-s,-o,0,-s,o,0,s,-o,0,s,o,0,-o,0,-s,o,0,-s,-o,0,s,o,0,s],l=[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1,18,0,18,16,6,10,2,6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,11,19,7,19,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9];return(e=t.call(this,u,l,r,i)).type="DodecahedronGeometry",e.parameters={radius:r,detail:i},e}return s(n,null,[{key:"fromJSON",value:function(e){return new n(e.radius,e.detail)}}]),n}(th),rh=new Yr,ih=new Yr,ah=new Yr,oh=new sa,sh=function(e){w(n,e);var t=E(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;if(a(this,n),(e=t.call(this)).type="EdgesGeometry",e.parameters={geometry:r,thresholdAngle:i},null!==r){for(var o=4,s=Math.pow(10,o),u=Math.cos(ir*i),l=r.getIndex(),c=r.getAttribute("position"),h=l?l.count:c.count,d=[0,0,0],f=["a","b","c"],p=new Array(3),v={},m=[],g=0;g<h;g+=3){l?(d[0]=l.getX(g),d[1]=l.getX(g+1),d[2]=l.getX(g+2)):(d[0]=g,d[1]=g+1,d[2]=g+2);var y=oh.a,_=oh.b,x=oh.c;if(y.fromBufferAttribute(c,d[0]),_.fromBufferAttribute(c,d[1]),x.fromBufferAttribute(c,d[2]),oh.getNormal(ah),p[0]="".concat(Math.round(y.x*s),",").concat(Math.round(y.y*s),",").concat(Math.round(y.z*s)),p[1]="".concat(Math.round(_.x*s),",").concat(Math.round(_.y*s),",").concat(Math.round(_.z*s)),p[2]="".concat(Math.round(x.x*s),",").concat(Math.round(x.y*s),",").concat(Math.round(x.z*s)),p[0]!==p[1]&&p[1]!==p[2]&&p[2]!==p[0])for(var M=0;M<3;M++){var S=(M+1)%3,b=p[M],w=p[S],T=oh[f[M]],E=oh[f[S]],A="".concat(b,"_").concat(w),R="".concat(w,"_").concat(b);R in v&&v[R]?(ah.dot(v[R].normal)<=u&&(m.push(T.x,T.y,T.z),m.push(E.x,E.y,E.z)),v[R]=null):A in v||(v[A]={index0:d[M],index1:d[S],normal:ah.clone()})}}for(var k in v)if(v[k]){var C=v[k],L=C.index0,P=C.index1;rh.fromBufferAttribute(c,L),ih.fromBufferAttribute(c,P),m.push(rh.x,rh.y,rh.z),m.push(ih.x,ih.y,ih.z)}e.setAttribute("position",new Ia(m,3))}return e}return s(n,[{key:"copy",value:function(e){return y(x(n.prototype),"copy",this).call(this,e),this.parameters=Object.assign({},e.parameters),this}}]),n}(Ga),uh=function(e){w(n,e);var t=E(n);function n(e){var r;return a(this,n),(r=t.call(this,e)).uuid=or(),r.type="Shape",r.holes=[],r}return s(n,[{key:"getPointsHoles",value:function(e){for(var t=[],n=0,r=this.holes.length;n<r;n++)t[n]=this.holes[n].getPoints(e);return t}},{key:"extractPoints",value:function(e){return{shape:this.getPoints(e),holes:this.getPointsHoles(e)}}},{key:"copy",value:function(e){y(x(n.prototype),"copy",this).call(this,e),this.holes=[];for(var t=0,r=e.holes.length;t<r;t++){var i=e.holes[t];this.holes.push(i.clone())}return this}},{key:"toJSON",value:function(){var e=y(x(n.prototype),"toJSON",this).call(this);e.uuid=this.uuid,e.holes=[];for(var t=0,r=this.holes.length;t<r;t++){var i=this.holes[t];e.holes.push(i.toJSON())}return e}},{key:"fromJSON",value:function(e){y(x(n.prototype),"fromJSON",this).call(this,e),this.uuid=e.uuid,this.holes=[];for(var t=0,r=e.holes.length;t<r;t++){var i=e.holes[t];this.holes.push((new Zc).fromJSON(i))}return this}}]),n}(Zc),lh=function(e,t){var n,r,i,a,o,s,u,l=arguments.length>2&&void 0!==arguments[2]?arguments[2]:2,c=t&&t.length,h=c?t[0]*l:e.length,d=ch(e,0,h,l,!0),f=[];if(!d||d.next===d.prev)return f;if(c&&(d=gh(e,t,d,l)),e.length>80*l){n=i=e[0],r=a=e[1];for(var p=l;p<h;p+=l)(o=e[p])<n&&(n=o),(s=e[p+1])<r&&(r=s),o>i&&(i=o),s>a&&(a=s);u=0!==(u=Math.max(i-n,a-r))?32767/u:0}return dh(d,f,l,n,r,u,0),f};function ch(e,t,n,r,i){var a,o;if(i===function(e,t,n,r){for(var i=0,a=t,o=n-r;a<n;a+=r)i+=(e[o]-e[a])*(e[a+1]+e[o+1]),o=a;return i}(e,t,n,r)>0)for(a=t;a<n;a+=r)o=Ph(a,e[a],e[a+1],o);else for(a=n-r;a>=t;a-=r)o=Ph(a,e[a],e[a+1],o);return o&&Eh(o,o.next)&&(Ih(o),o=o.next),o}function hh(e,t){if(!e)return e;t||(t=e);var n,r=e;do{if(n=!1,r.steiner||!Eh(r,r.next)&&0!==Th(r.prev,r,r.next))r=r.next;else{if(Ih(r),(r=t=r.prev)===r.next)break;n=!0}}while(n||r!==t);return t}function dh(e,t,n,r,i,a,o){if(e){!o&&a&&function(e,t,n,r){var i=e;do{0===i.z&&(i.z=Mh(i.x,i.y,t,n,r)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next}while(i!==e);i.prevZ.nextZ=null,i.prevZ=null,function(e){var t,n,r,i,a,o,s,u,l=1;do{for(n=e,e=null,a=null,o=0;n;){for(o++,r=n,s=0,t=0;t<l&&(s++,r=r.nextZ);t++);for(u=l;s>0||u>0&&r;)0!==s&&(0===u||!r||n.z<=r.z)?(i=n,n=n.nextZ,s--):(i=r,r=r.nextZ,u--),a?a.nextZ=i:e=i,i.prevZ=a,a=i;n=r}a.nextZ=null,l*=2}while(o>1)}(i)}(e,r,i,a);for(var s,u,l=e;e.prev!==e.next;)if(s=e.prev,u=e.next,a?ph(e,r,i,a):fh(e))t.push(s.i/n|0),t.push(e.i/n|0),t.push(u.i/n|0),Ih(e),e=u.next,l=u.next;else if((e=u)===l){o?1===o?dh(e=vh(hh(e),t,n),t,n,r,i,a,2):2===o&&mh(e,t,n,r,i,a):dh(hh(e),t,n,r,i,a,1);break}}}function fh(e){var t=e.prev,n=e,r=e.next;if(Th(t,n,r)>=0)return!1;for(var i=t.x,a=n.x,o=r.x,s=t.y,u=n.y,l=r.y,c=i<a?i<o?i:o:a<o?a:o,h=s<u?s<l?s:l:u<l?u:l,d=i>a?i>o?i:o:a>o?a:o,f=s>u?s>l?s:l:u>l?u:l,p=r.next;p!==t;){if(p.x>=c&&p.x<=d&&p.y>=h&&p.y<=f&&bh(i,s,a,u,o,l,p.x,p.y)&&Th(p.prev,p,p.next)>=0)return!1;p=p.next}return!0}function ph(e,t,n,r){var i=e.prev,a=e,o=e.next;if(Th(i,a,o)>=0)return!1;for(var s=i.x,u=a.x,l=o.x,c=i.y,h=a.y,d=o.y,f=s<u?s<l?s:l:u<l?u:l,p=c<h?c<d?c:d:h<d?h:d,v=s>u?s>l?s:l:u>l?u:l,m=c>h?c>d?c:d:h>d?h:d,g=Mh(f,p,t,n,r),y=Mh(v,m,t,n,r),_=e.prevZ,x=e.nextZ;_&&_.z>=g&&x&&x.z<=y;){if(_.x>=f&&_.x<=v&&_.y>=p&&_.y<=m&&_!==i&&_!==o&&bh(s,c,u,h,l,d,_.x,_.y)&&Th(_.prev,_,_.next)>=0)return!1;if(_=_.prevZ,x.x>=f&&x.x<=v&&x.y>=p&&x.y<=m&&x!==i&&x!==o&&bh(s,c,u,h,l,d,x.x,x.y)&&Th(x.prev,x,x.next)>=0)return!1;x=x.nextZ}for(;_&&_.z>=g;){if(_.x>=f&&_.x<=v&&_.y>=p&&_.y<=m&&_!==i&&_!==o&&bh(s,c,u,h,l,d,_.x,_.y)&&Th(_.prev,_,_.next)>=0)return!1;_=_.prevZ}for(;x&&x.z<=y;){if(x.x>=f&&x.x<=v&&x.y>=p&&x.y<=m&&x!==i&&x!==o&&bh(s,c,u,h,l,d,x.x,x.y)&&Th(x.prev,x,x.next)>=0)return!1;x=x.nextZ}return!0}function vh(e,t,n){var r=e;do{var i=r.prev,a=r.next.next;!Eh(i,a)&&Ah(i,r,r.next,a)&&Ch(i,a)&&Ch(a,i)&&(t.push(i.i/n|0),t.push(r.i/n|0),t.push(a.i/n|0),Ih(r),Ih(r.next),r=e=a),r=r.next}while(r!==e);return hh(r)}function mh(e,t,n,r,i,a){var o=e;do{for(var s=o.next.next;s!==o.prev;){if(o.i!==s.i&&wh(o,s)){var u=Lh(o,s);return o=hh(o,o.next),u=hh(u,u.next),dh(o,t,n,r,i,a,0),void dh(u,t,n,r,i,a,0)}s=s.next}o=o.next}while(o!==e)}function gh(e,t,n,r){var i,a,o,s=[];for(i=0,a=t.length;i<a;i++)(o=ch(e,t[i]*r,i<a-1?t[i+1]*r:e.length,r,!1))===o.next&&(o.steiner=!0),s.push(Sh(o));for(s.sort(yh),i=0;i<s.length;i++)n=_h(s[i],n);return n}function yh(e,t){return e.x-t.x}function _h(e,t){var n=function(e,t){var n,r=t,i=-1/0,a=e.x,o=e.y;do{if(o<=r.y&&o>=r.next.y&&r.next.y!==r.y){var s=r.x+(o-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(s<=a&&s>i&&(i=s,n=r.x<r.next.x?r:r.next,s===a))return n}r=r.next}while(r!==t);if(!n)return null;var u,l=n,c=n.x,h=n.y,d=1/0;r=n;do{a>=r.x&&r.x>=c&&a!==r.x&&bh(o<h?a:i,o,c,h,o<h?i:a,o,r.x,r.y)&&(u=Math.abs(o-r.y)/(a-r.x),Ch(r,e)&&(u<d||u===d&&(r.x>n.x||r.x===n.x&&xh(n,r)))&&(n=r,d=u)),r=r.next}while(r!==l);return n}(e,t);if(!n)return t;var r=Lh(n,e);return hh(r,r.next),hh(n,n.next)}function xh(e,t){return Th(e.prev,e,t.prev)<0&&Th(t.next,e,e.next)<0}function Mh(e,t,n,r,i){return(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-n)*i|0)|e<<8))|e<<4))|e<<2))|e<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-r)*i|0)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function Sh(e){var t=e,n=e;do{(t.x<n.x||t.x===n.x&&t.y<n.y)&&(n=t),t=t.next}while(t!==e);return n}function bh(e,t,n,r,i,a,o,s){return(i-o)*(t-s)>=(e-o)*(a-s)&&(e-o)*(r-s)>=(n-o)*(t-s)&&(n-o)*(a-s)>=(i-o)*(r-s)}function wh(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!function(e,t){var n=e;do{if(n.i!==e.i&&n.next.i!==e.i&&n.i!==t.i&&n.next.i!==t.i&&Ah(n,n.next,e,t))return!0;n=n.next}while(n!==e);return!1}(e,t)&&(Ch(e,t)&&Ch(t,e)&&function(e,t){var n=e,r=!1,i=(e.x+t.x)/2,a=(e.y+t.y)/2;do{n.y>a!=n.next.y>a&&n.next.y!==n.y&&i<(n.next.x-n.x)*(a-n.y)/(n.next.y-n.y)+n.x&&(r=!r),n=n.next}while(n!==e);return r}(e,t)&&(Th(e.prev,e,t.prev)||Th(e,t.prev,t))||Eh(e,t)&&Th(e.prev,e,e.next)>0&&Th(t.prev,t,t.next)>0)}function Th(e,t,n){return(t.y-e.y)*(n.x-t.x)-(t.x-e.x)*(n.y-t.y)}function Eh(e,t){return e.x===t.x&&e.y===t.y}function Ah(e,t,n,r){var i=kh(Th(e,t,n)),a=kh(Th(e,t,r)),o=kh(Th(n,r,e)),s=kh(Th(n,r,t));return i!==a&&o!==s||(!(0!==i||!Rh(e,n,t))||(!(0!==a||!Rh(e,r,t))||(!(0!==o||!Rh(n,e,r))||!(0!==s||!Rh(n,t,r)))))}function Rh(e,t,n){return t.x<=Math.max(e.x,n.x)&&t.x>=Math.min(e.x,n.x)&&t.y<=Math.max(e.y,n.y)&&t.y>=Math.min(e.y,n.y)}function kh(e){return e>0?1:e<0?-1:0}function Ch(e,t){return Th(e.prev,e,e.next)<0?Th(e,t,e.next)>=0&&Th(e,e.prev,t)>=0:Th(e,t,e.prev)<0||Th(e,e.next,t)<0}function Lh(e,t){var n=new Dh(e.i,e.x,e.y),r=new Dh(t.i,t.x,t.y),i=e.next,a=t.prev;return e.next=t,t.prev=e,n.next=i,i.prev=n,r.next=n,n.prev=r,a.next=r,r.prev=a,r}function Ph(e,t,n,r){var i=new Dh(e,t,n);return r?(i.next=r.next,i.prev=r,r.next.prev=i,r.next=i):(i.prev=i,i.next=i),i}function Ih(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}function Dh(e,t,n){this.i=e,this.x=t,this.y=n,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}var Uh=function(){function e(){a(this,e)}return s(e,null,[{key:"area",value:function(e){for(var t=e.length,n=0,r=t-1,i=0;i<t;r=i++)n+=e[r].x*e[i].y-e[i].x*e[r].y;return.5*n}},{key:"isClockWise",value:function(t){return e.area(t)<0}},{key:"triangulateShape",value:function(e,t){var n=[],r=[],i=[];Oh(e),Nh(n,e);var a=e.length;t.forEach(Oh);for(var o=0;o<t.length;o++)r.push(a),a+=t[o].length,Nh(n,t[o]);for(var s=lh(n,r),u=0;u<s.length;u+=3)i.push(s.slice(u,u+3));return i}}]),e}();function Oh(e){var t=e.length;t>2&&e[t-1].equals(e[0])&&e.pop()}function Nh(e,t){for(var n=0;n<t.length;n++)e.push(t[n].x),e.push(t[n].y)}var Fh=function(e){w(n,e);var t=E(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new uh([new mr(.5,.5),new mr(-.5,.5),new mr(-.5,-.5),new mr(.5,-.5)]),i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};a(this,n),(e=t.call(this)).type="ExtrudeGeometry",e.parameters={shapes:r,options:i},r=Array.isArray(r)?r:[r];for(var o=S(e),s=[],u=[],l=0,c=r.length;l<c;l++){var h=r[l];d(h)}function d(e){var t,n,r,a,l,c=[],h=void 0!==i.curveSegments?i.curveSegments:12,d=void 0!==i.steps?i.steps:1,f=void 0!==i.depth?i.depth:1,p=void 0===i.bevelEnabled||i.bevelEnabled,v=void 0!==i.bevelThickness?i.bevelThickness:.2,m=void 0!==i.bevelSize?i.bevelSize:v-.1,g=void 0!==i.bevelOffset?i.bevelOffset:0,y=void 0!==i.bevelSegments?i.bevelSegments:3,_=i.extrudePath,x=void 0!==i.UVGenerator?i.UVGenerator:Bh,M=!1;_&&(t=_.getSpacedPoints(d),M=!0,p=!1,n=_.computeFrenetFrames(d,!1),r=new Yr,a=new Yr,l=new Yr),p||(y=0,v=0,m=0,g=0);var S=e.extractPoints(h),b=S.shape,w=S.holes;if(!Uh.isClockWise(b)){b=b.reverse();for(var T=0,E=w.length;T<E;T++){var A=w[T];Uh.isClockWise(A)&&(w[T]=A.reverse())}}for(var R=Uh.triangulateShape(b,w),k=b,C=0,L=w.length;C<L;C++){var P=w[C];b=b.concat(P)}function I(e,t,n){return t||console.error("THREE.ExtrudeGeometry: vec does not exist"),e.clone().addScaledVector(t,n)}var D=b.length,U=R.length;function O(e,t,n){var r,i,a,o=e.x-t.x,s=e.y-t.y,u=n.x-e.x,l=n.y-e.y,c=o*o+s*s,h=o*l-s*u;if(Math.abs(h)>Number.EPSILON){var d=Math.sqrt(c),f=Math.sqrt(u*u+l*l),p=t.x-s/d,v=t.y+o/d,m=((n.x-l/f-p)*l-(n.y+u/f-v)*u)/(o*l-s*u),g=(r=p+o*m-e.x)*r+(i=v+s*m-e.y)*i;if(g<=2)return new mr(r,i);a=Math.sqrt(g/2)}else{var y=!1;o>Number.EPSILON?u>Number.EPSILON&&(y=!0):o<-Number.EPSILON?u<-Number.EPSILON&&(y=!0):Math.sign(s)===Math.sign(l)&&(y=!0),y?(r=-s,i=o,a=Math.sqrt(c)):(r=o,i=s,a=Math.sqrt(c/2))}return new mr(r/a,i/a)}for(var N=[],F=0,B=k.length,z=B-1,H=F+1;F<B;F++,z++,H++)z===B&&(z=0),H===B&&(H=0),N[F]=O(k[F],k[z],k[H]);for(var G,V=[],W=N.concat(),j=0,X=w.length;j<X;j++){var q=w[j];G=[];for(var Y=0,Z=q.length,K=Z-1,J=Y+1;Y<Z;Y++,K++,J++)K===Z&&(K=0),J===Z&&(J=0),G[Y]=O(q[Y],q[K],q[J]);V.push(G),W=W.concat(G)}for(var Q=0;Q<y;Q++){for(var $=Q/y,ee=v*Math.cos($*Math.PI/2),te=m*Math.sin($*Math.PI/2)+g,ne=0,re=k.length;ne<re;ne++){var ie=I(k[ne],N[ne],te);Le(ie.x,ie.y,-ee)}for(var ae=0,oe=w.length;ae<oe;ae++){var se=w[ae];G=V[ae];for(var ue=0,le=se.length;ue<le;ue++){var ce=I(se[ue],G[ue],te);Le(ce.x,ce.y,-ee)}}}for(var he=m+g,de=0;de<D;de++){var fe=p?I(b[de],W[de],he):b[de];M?(a.copy(n.normals[0]).multiplyScalar(fe.x),r.copy(n.binormals[0]).multiplyScalar(fe.y),l.copy(t[0]).add(a).add(r),Le(l.x,l.y,l.z)):Le(fe.x,fe.y,0)}for(var pe=1;pe<=d;pe++)for(var ve=0;ve<D;ve++){var me=p?I(b[ve],W[ve],he):b[ve];M?(a.copy(n.normals[pe]).multiplyScalar(me.x),r.copy(n.binormals[pe]).multiplyScalar(me.y),l.copy(t[pe]).add(a).add(r),Le(l.x,l.y,l.z)):Le(me.x,me.y,f/d*pe)}for(var ge=y-1;ge>=0;ge--){for(var ye=ge/y,_e=v*Math.cos(ye*Math.PI/2),xe=m*Math.sin(ye*Math.PI/2)+g,Me=0,Se=k.length;Me<Se;Me++){var be=I(k[Me],N[Me],xe);Le(be.x,be.y,f+_e)}for(var we=0,Te=w.length;we<Te;we++){var Ee=w[we];G=V[we];for(var Ae=0,Re=Ee.length;Ae<Re;Ae++){var ke=I(Ee[Ae],G[Ae],xe);M?Le(ke.x,ke.y+t[d-1].y,t[d-1].x+_e):Le(ke.x,ke.y,f+_e)}}}function Ce(e,t){for(var n=e.length;--n>=0;){var r=n,i=n-1;i<0&&(i=e.length-1);for(var a=0,o=d+2*y;a<o;a++){var s=D*a,u=D*(a+1);Ie(t+r+s,t+i+s,t+i+u,t+r+u)}}}function Le(e,t,n){c.push(e),c.push(t),c.push(n)}function Pe(e,t,n){De(e),De(t),De(n);var r=s.length/3,i=x.generateTopUV(o,s,r-3,r-2,r-1);Ue(i[0]),Ue(i[1]),Ue(i[2])}function Ie(e,t,n,r){De(e),De(t),De(r),De(t),De(n),De(r);var i=s.length/3,a=x.generateSideWallUV(o,s,i-6,i-3,i-2,i-1);Ue(a[0]),Ue(a[1]),Ue(a[3]),Ue(a[1]),Ue(a[2]),Ue(a[3])}function De(e){s.push(c[3*e+0]),s.push(c[3*e+1]),s.push(c[3*e+2])}function Ue(e){u.push(e.x),u.push(e.y)}!function(){var e=s.length/3;if(p){for(var t=0,n=D*t,r=0;r<U;r++){var i=R[r];Pe(i[2]+n,i[1]+n,i[0]+n)}n=D*(t=d+2*y);for(var a=0;a<U;a++){var u=R[a];Pe(u[0]+n,u[1]+n,u[2]+n)}}else{for(var l=0;l<U;l++){var c=R[l];Pe(c[2],c[1],c[0])}for(var h=0;h<U;h++){var f=R[h];Pe(f[0]+D*d,f[1]+D*d,f[2]+D*d)}}o.addGroup(e,s.length/3-e,0)}(),function(){var e=s.length/3,t=0;Ce(k,t),t+=k.length;for(var n=0,r=w.length;n<r;n++){var i=w[n];Ce(i,t),t+=i.length}o.addGroup(e,s.length/3-e,1)}()}return e.setAttribute("position",new Ia(s,3)),e.setAttribute("uv",new Ia(u,2)),e.computeVertexNormals(),e}return s(n,[{key:"copy",value:function(e){return y(x(n.prototype),"copy",this).call(this,e),this.parameters=Object.assign({},e.parameters),this}},{key:"toJSON",value:function(){var e=y(x(n.prototype),"toJSON",this).call(this);return function(e,t,n){if(n.shapes=[],Array.isArray(e))for(var r=0,i=e.length;r<i;r++){var a=e[r];n.shapes.push(a.uuid)}else n.shapes.push(e.uuid);n.options=Object.assign({},t),void 0!==t.extrudePath&&(n.options.extrudePath=t.extrudePath.toJSON());return n}(this.parameters.shapes,this.parameters.options,e)}}],[{key:"fromJSON",value:function(e,t){for(var r=[],i=0,a=e.shapes.length;i<a;i++){var o=t[e.shapes[i]];r.push(o)}var s=e.options.extrudePath;return void 0!==s&&(e.options.extrudePath=(new qc[s.type]).fromJSON(s)),new n(r,e.options)}}]),n}(Ga),Bh={generateTopUV:function(e,t,n,r,i){var a=t[3*n],o=t[3*n+1],s=t[3*r],u=t[3*r+1],l=t[3*i],c=t[3*i+1];return[new mr(a,o),new mr(s,u),new mr(l,c)]},generateSideWallUV:function(e,t,n,r,i,a){var o=t[3*n],s=t[3*n+1],u=t[3*n+2],l=t[3*r],c=t[3*r+1],h=t[3*r+2],d=t[3*i],f=t[3*i+1],p=t[3*i+2],v=t[3*a],m=t[3*a+1],g=t[3*a+2];return Math.abs(s-c)<Math.abs(o-l)?[new mr(o,1-u),new mr(l,1-h),new mr(d,1-p),new mr(v,1-g)]:[new mr(s,1-u),new mr(c,1-h),new mr(f,1-p),new mr(m,1-g)]}};var zh=function(e){w(n,e);var t=E(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;a(this,n);var o=(1+Math.sqrt(5))/2,s=[-1,o,0,1,o,0,-1,-o,0,1,-o,0,0,-1,o,0,1,o,0,-1,-o,0,1,-o,o,0,-1,o,0,1,-o,0,-1,-o,0,1],u=[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];return(e=t.call(this,s,u,r,i)).type="IcosahedronGeometry",e.parameters={radius:r,detail:i},e}return s(n,null,[{key:"fromJSON",value:function(e){return new n(e.radius,e.detail)}}]),n}(th),Hh=function(e){w(n,e);var t=E(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;a(this,n);var o=[1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],s=[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2];return(e=t.call(this,o,s,r,i)).type="OctahedronGeometry",e.parameters={radius:r,detail:i},e}return s(n,null,[{key:"fromJSON",value:function(e){return new n(e.radius,e.detail)}}]),n}(th),Gh=function(e){w(n,e);var t=E(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:.5,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:32,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,u=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,l=arguments.length>5&&void 0!==arguments[5]?arguments[5]:2*Math.PI;a(this,n),(e=t.call(this)).type="RingGeometry",e.parameters={innerRadius:r,outerRadius:i,thetaSegments:o,phiSegments:s,thetaStart:u,thetaLength:l},o=Math.max(3,o);for(var c=[],h=[],d=[],f=[],p=r,v=(i-r)/(s=Math.max(1,s)),m=new Yr,g=new mr,y=0;y<=s;y++){for(var _=0;_<=o;_++){var x=u+_/o*l;m.x=p*Math.cos(x),m.y=p*Math.sin(x),h.push(m.x,m.y,m.z),d.push(0,0,1),g.x=(m.x/i+1)/2,g.y=(m.y/i+1)/2,f.push(g.x,g.y)}p+=v}for(var M=0;M<s;M++)for(var S=M*(o+1),b=0;b<o;b++){var w=b+S,T=w,E=w+o+1,A=w+o+2,R=w+1;c.push(T,E,R),c.push(E,A,R)}return e.setIndex(c),e.setAttribute("position",new Ia(h,3)),e.setAttribute("normal",new Ia(d,3)),e.setAttribute("uv",new Ia(f,2)),e}return s(n,[{key:"copy",value:function(e){return y(x(n.prototype),"copy",this).call(this,e),this.parameters=Object.assign({},e.parameters),this}}],[{key:"fromJSON",value:function(e){return new n(e.innerRadius,e.outerRadius,e.thetaSegments,e.phiSegments,e.thetaStart,e.thetaLength)}}]),n}(Ga),Vh=function(e){w(n,e);var t=E(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new uh([new mr(0,.5),new mr(-.5,-.5),new mr(.5,-.5)]),i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:12;a(this,n),(e=t.call(this)).type="ShapeGeometry",e.parameters={shapes:r,curveSegments:i};var o=[],s=[],u=[],l=[],c=0,h=0;if(!1===Array.isArray(r))f(r);else for(var d=0;d<r.length;d++)f(r[d]),e.addGroup(c,h,d),c+=h,h=0;function f(e){var t=s.length/3,n=e.extractPoints(i),r=n.shape,a=n.holes;!1===Uh.isClockWise(r)&&(r=r.reverse());for(var c=0,d=a.length;c<d;c++){var f=a[c];!0===Uh.isClockWise(f)&&(a[c]=f.reverse())}for(var p=Uh.triangulateShape(r,a),v=0,m=a.length;v<m;v++){var g=a[v];r=r.concat(g)}for(var y=0,_=r.length;y<_;y++){var x=r[y];s.push(x.x,x.y,0),u.push(0,0,1),l.push(x.x,x.y)}for(var M=0,S=p.length;M<S;M++){var b=p[M],w=b[0]+t,T=b[1]+t,E=b[2]+t;o.push(w,T,E),h+=3}}return e.setIndex(o),e.setAttribute("position",new Ia(s,3)),e.setAttribute("normal",new Ia(u,3)),e.setAttribute("uv",new Ia(l,2)),e}return s(n,[{key:"copy",value:function(e){return y(x(n.prototype),"copy",this).call(this,e),this.parameters=Object.assign({},e.parameters),this}},{key:"toJSON",value:function(){var e=y(x(n.prototype),"toJSON",this).call(this);return function(e,t){if(t.shapes=[],Array.isArray(e))for(var n=0,r=e.length;n<r;n++){var i=e[n];t.shapes.push(i.uuid)}else t.shapes.push(e.uuid);return t}(this.parameters.shapes,e)}}],[{key:"fromJSON",value:function(e,t){for(var r=[],i=0,a=e.shapes.length;i<a;i++){var o=t[e.shapes[i]];r.push(o)}return new n(r,e.curveSegments)}}]),n}(Ga);var Wh=function(e){w(n,e);var t=E(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:32,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:16,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,u=arguments.length>4&&void 0!==arguments[4]?arguments[4]:2*Math.PI,l=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,c=arguments.length>6&&void 0!==arguments[6]?arguments[6]:Math.PI;a(this,n),(e=t.call(this)).type="SphereGeometry",e.parameters={radius:r,widthSegments:i,heightSegments:o,phiStart:s,phiLength:u,thetaStart:l,thetaLength:c},i=Math.max(3,Math.floor(i)),o=Math.max(2,Math.floor(o));for(var h=Math.min(l+c,Math.PI),d=0,f=[],p=new Yr,v=new Yr,m=[],g=[],y=[],_=[],x=0;x<=o;x++){var M=[],S=x/o,b=0;0===x&&0===l?b=.5/i:x===o&&h===Math.PI&&(b=-.5/i);for(var w=0;w<=i;w++){var T=w/i;p.x=-r*Math.cos(s+T*u)*Math.sin(l+S*c),p.y=r*Math.cos(l+S*c),p.z=r*Math.sin(s+T*u)*Math.sin(l+S*c),g.push(p.x,p.y,p.z),v.copy(p).normalize(),y.push(v.x,v.y,v.z),_.push(T+b,1-S),M.push(d++)}f.push(M)}for(var E=0;E<o;E++)for(var A=0;A<i;A++){var R=f[E][A+1],k=f[E][A],C=f[E+1][A],L=f[E+1][A+1];(0!==E||l>0)&&m.push(R,k,L),(E!==o-1||h<Math.PI)&&m.push(k,C,L)}return e.setIndex(m),e.setAttribute("position",new Ia(g,3)),e.setAttribute("normal",new Ia(y,3)),e.setAttribute("uv",new Ia(_,2)),e}return s(n,[{key:"copy",value:function(e){return y(x(n.prototype),"copy",this).call(this,e),this.parameters=Object.assign({},e.parameters),this}}],[{key:"fromJSON",value:function(e){return new n(e.radius,e.widthSegments,e.heightSegments,e.phiStart,e.phiLength,e.thetaStart,e.thetaLength)}}]),n}(Ga),jh=function(e){w(n,e);var t=E(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;a(this,n);var o=[1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],s=[2,1,0,0,3,2,1,3,0,2,3,1];return(e=t.call(this,o,s,r,i)).type="TetrahedronGeometry",e.parameters={radius:r,detail:i},e}return s(n,null,[{key:"fromJSON",value:function(e){return new n(e.radius,e.detail)}}]),n}(th),Xh=function(e){w(n,e);var t=E(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.4,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:12,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:48,u=arguments.length>4&&void 0!==arguments[4]?arguments[4]:2*Math.PI;a(this,n),(e=t.call(this)).type="TorusGeometry",e.parameters={radius:r,tube:i,radialSegments:o,tubularSegments:s,arc:u},o=Math.floor(o),s=Math.floor(s);for(var l=[],c=[],h=[],d=[],f=new Yr,p=new Yr,v=new Yr,m=0;m<=o;m++)for(var g=0;g<=s;g++){var y=g/s*u,_=m/o*Math.PI*2;p.x=(r+i*Math.cos(_))*Math.cos(y),p.y=(r+i*Math.cos(_))*Math.sin(y),p.z=i*Math.sin(_),c.push(p.x,p.y,p.z),f.x=r*Math.cos(y),f.y=r*Math.sin(y),v.subVectors(p,f).normalize(),h.push(v.x,v.y,v.z),d.push(g/s),d.push(m/o)}for(var x=1;x<=o;x++)for(var M=1;M<=s;M++){var S=(s+1)*x+M-1,b=(s+1)*(x-1)+M-1,w=(s+1)*(x-1)+M,T=(s+1)*x+M;l.push(S,b,T),l.push(b,w,T)}return e.setIndex(l),e.setAttribute("position",new Ia(c,3)),e.setAttribute("normal",new Ia(h,3)),e.setAttribute("uv",new Ia(d,2)),e}return s(n,[{key:"copy",value:function(e){return y(x(n.prototype),"copy",this).call(this,e),this.parameters=Object.assign({},e.parameters),this}}],[{key:"fromJSON",value:function(e){return new n(e.radius,e.tube,e.radialSegments,e.tubularSegments,e.arc)}}]),n}(Ga),qh=function(e){w(n,e);var t=E(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.4,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:64,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:8,u=arguments.length>4&&void 0!==arguments[4]?arguments[4]:2,l=arguments.length>5&&void 0!==arguments[5]?arguments[5]:3;a(this,n),(e=t.call(this)).type="TorusKnotGeometry",e.parameters={radius:r,tube:i,tubularSegments:o,radialSegments:s,p:u,q:l},o=Math.floor(o),s=Math.floor(s);for(var c=[],h=[],d=[],f=[],p=new Yr,v=new Yr,m=new Yr,g=new Yr,y=new Yr,_=new Yr,x=new Yr,M=0;M<=o;++M){var S=M/o*u*Math.PI*2;I(S,u,l,r,m),I(S+.01,u,l,r,g),_.subVectors(g,m),x.addVectors(g,m),y.crossVectors(_,x),x.crossVectors(y,_),y.normalize(),x.normalize();for(var b=0;b<=s;++b){var w=b/s*Math.PI*2,T=-i*Math.cos(w),E=i*Math.sin(w);p.x=m.x+(T*x.x+E*y.x),p.y=m.y+(T*x.y+E*y.y),p.z=m.z+(T*x.z+E*y.z),h.push(p.x,p.y,p.z),v.subVectors(p,m).normalize(),d.push(v.x,v.y,v.z),f.push(M/o),f.push(b/s)}}for(var A=1;A<=o;A++)for(var R=1;R<=s;R++){var k=(s+1)*(A-1)+(R-1),C=(s+1)*A+(R-1),L=(s+1)*A+R,P=(s+1)*(A-1)+R;c.push(k,C,P),c.push(C,L,P)}function I(e,t,n,r,i){var a=Math.cos(e),o=Math.sin(e),s=n/t*e,u=Math.cos(s);i.x=r*(2+u)*.5*a,i.y=r*(2+u)*o*.5,i.z=r*Math.sin(s)*.5}return e.setIndex(c),e.setAttribute("position",new Ia(h,3)),e.setAttribute("normal",new Ia(d,3)),e.setAttribute("uv",new Ia(f,2)),e}return s(n,[{key:"copy",value:function(e){return y(x(n.prototype),"copy",this).call(this,e),this.parameters=Object.assign({},e.parameters),this}}],[{key:"fromJSON",value:function(e){return new n(e.radius,e.tube,e.tubularSegments,e.radialSegments,e.p,e.q)}}]),n}(Ga),Yh=function(e){w(n,e);var t=E(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new jc(new Yr(-1,-1,0),new Yr(-1,1,0),new Yr(1,1,0)),i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:64,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:8,u=arguments.length>4&&void 0!==arguments[4]&&arguments[4];a(this,n),(e=t.call(this)).type="TubeGeometry",e.parameters={path:r,tubularSegments:i,radius:o,radialSegments:s,closed:u};var l=r.computeFrenetFrames(i,u);e.tangents=l.tangents,e.normals=l.normals,e.binormals=l.binormals;var c=new Yr,h=new Yr,d=new mr,f=new Yr,p=[],v=[],m=[],g=[];function y(){for(var e=0;e<i;e++)_(e);_(!1===u?i:0),M(),x()}function _(e){f=r.getPointAt(e/i,f);for(var t=l.normals[e],n=l.binormals[e],a=0;a<=s;a++){var u=a/s*Math.PI*2,d=Math.sin(u),m=-Math.cos(u);h.x=m*t.x+d*n.x,h.y=m*t.y+d*n.y,h.z=m*t.z+d*n.z,h.normalize(),v.push(h.x,h.y,h.z),c.x=f.x+o*h.x,c.y=f.y+o*h.y,c.z=f.z+o*h.z,p.push(c.x,c.y,c.z)}}function x(){for(var e=1;e<=i;e++)for(var t=1;t<=s;t++){var n=(s+1)*(e-1)+(t-1),r=(s+1)*e+(t-1),a=(s+1)*e+t,o=(s+1)*(e-1)+t;g.push(n,r,o),g.push(r,a,o)}}function M(){for(var e=0;e<=i;e++)for(var t=0;t<=s;t++)d.x=e/i,d.y=t/s,m.push(d.x,d.y)}return y(),e.setIndex(g),e.setAttribute("position",new Ia(p,3)),e.setAttribute("normal",new Ia(v,3)),e.setAttribute("uv",new Ia(m,2)),e}return s(n,[{key:"copy",value:function(e){return y(x(n.prototype),"copy",this).call(this,e),this.parameters=Object.assign({},e.parameters),this}},{key:"toJSON",value:function(){var e=y(x(n.prototype),"toJSON",this).call(this);return e.path=this.parameters.path.toJSON(),e}}],[{key:"fromJSON",value:function(e){return new n((new qc[e.path.type]).fromJSON(e.path),e.tubularSegments,e.radius,e.radialSegments,e.closed)}}]),n}(Ga),Zh=function(e){w(n,e);var t=E(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;if(a(this,n),(e=t.call(this)).type="WireframeGeometry",e.parameters={geometry:r},null!==r){var i=[],o=new Set,s=new Yr,u=new Yr;if(null!==r.index){var l=r.attributes.position,c=r.index,h=r.groups;0===h.length&&(h=[{start:0,count:c.count,materialIndex:0}]);for(var d=0,f=h.length;d<f;++d)for(var p=h[d],v=p.start,m=p.count,g=v,y=v+m;g<y;g+=3)for(var _=0;_<3;_++){var x=c.getX(g+_),M=c.getX(g+(_+1)%3);s.fromBufferAttribute(l,x),u.fromBufferAttribute(l,M),!0===Kh(s,u,o)&&(i.push(s.x,s.y,s.z),i.push(u.x,u.y,u.z))}}else for(var S=r.attributes.position,b=0,w=S.count/3;b<w;b++)for(var T=0;T<3;T++){var E=3*b+T,A=3*b+(T+1)%3;s.fromBufferAttribute(S,E),u.fromBufferAttribute(S,A),!0===Kh(s,u,o)&&(i.push(s.x,s.y,s.z),i.push(u.x,u.y,u.z))}e.setAttribute("position",new Ia(i,3))}return e}return s(n,[{key:"copy",value:function(e){return y(x(n.prototype),"copy",this).call(this,e),this.parameters=Object.assign({},e.parameters),this}}]),n}(Ga);function Kh(e,t,n){var r="".concat(e.x,",").concat(e.y,",").concat(e.z,"-").concat(t.x,",").concat(t.y,",").concat(t.z),i="".concat(t.x,",").concat(t.y,",").concat(t.z,"-").concat(e.x,",").concat(e.y,",").concat(e.z);return!0!==n.has(r)&&!0!==n.has(i)&&(n.add(r),n.add(i),!0)}var Jh=Object.freeze({__proto__:null,BoxGeometry:uo,CapsuleGeometry:Jc,CircleGeometry:Qc,ConeGeometry:eh,CylinderGeometry:$c,DodecahedronGeometry:nh,EdgesGeometry:sh,ExtrudeGeometry:Fh,IcosahedronGeometry:zh,LatheGeometry:Kc,OctahedronGeometry:Hh,PlaneGeometry:Co,PolyhedronGeometry:th,RingGeometry:Gh,ShapeGeometry:Vh,SphereGeometry:Wh,TetrahedronGeometry:jh,TorusGeometry:Xh,TorusKnotGeometry:qh,TubeGeometry:Yh,WireframeGeometry:Zh}),Qh=function(e){w(n,e);var t=E(n);function n(e){var r;return a(this,n),(r=t.call(this)).isShadowMaterial=!0,r.type="ShadowMaterial",r.color=new pa(0),r.transparent=!0,r.fog=!0,r.setValues(e),r}return s(n,[{key:"copy",value:function(e){return y(x(n.prototype),"copy",this).call(this,e),this.color.copy(e.color),this.fog=e.fog,this}}]),n}(la),$h=function(e){w(n,e);var t=E(n);function n(e){var r;return a(this,n),(r=t.call(this,e)).isRawShaderMaterial=!0,r.type="RawShaderMaterial",r}return s(n)}(po),ed=function(e){w(n,e);var t=E(n);function n(e){var r;return a(this,n),(r=t.call(this)).isMeshStandardMaterial=!0,r.defines={STANDARD:""},r.type="MeshStandardMaterial",r.color=new pa(16777215),r.roughness=1,r.metalness=0,r.map=null,r.lightMap=null,r.lightMapIntensity=1,r.aoMap=null,r.aoMapIntensity=1,r.emissive=new pa(0),r.emissiveIntensity=1,r.emissiveMap=null,r.bumpMap=null,r.bumpScale=1,r.normalMap=null,r.normalMapType=hn,r.normalScale=new mr(1,1),r.displacementMap=null,r.displacementScale=1,r.displacementBias=0,r.roughnessMap=null,r.metalnessMap=null,r.alphaMap=null,r.envMap=null,r.envMapIntensity=1,r.wireframe=!1,r.wireframeLinewidth=1,r.wireframeLinecap="round",r.wireframeLinejoin="round",r.flatShading=!1,r.fog=!0,r.setValues(e),r}return s(n,[{key:"copy",value:function(e){return y(x(n.prototype),"copy",this).call(this,e),this.defines={STANDARD:""},this.color.copy(e.color),this.roughness=e.roughness,this.metalness=e.metalness,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.roughnessMap=e.roughnessMap,this.metalnessMap=e.metalnessMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapIntensity=e.envMapIntensity,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}]),n}(la),td=function(e){w(n,e);var t=E(n);function n(e){var r;return a(this,n),(r=t.call(this)).isMeshPhysicalMaterial=!0,r.defines={STANDARD:"",PHYSICAL:""},r.type="MeshPhysicalMaterial",r.anisotropyRotation=0,r.anisotropyMap=null,r.clearcoatMap=null,r.clearcoatRoughness=0,r.clearcoatRoughnessMap=null,r.clearcoatNormalScale=new mr(1,1),r.clearcoatNormalMap=null,r.ior=1.5,Object.defineProperty(S(r),"reflectivity",{get:function(){return sr(2.5*(this.ior-1)/(this.ior+1),0,1)},set:function(e){this.ior=(1+.4*e)/(1-.4*e)}}),r.iridescenceMap=null,r.iridescenceIOR=1.3,r.iridescenceThicknessRange=[100,400],r.iridescenceThicknessMap=null,r.sheenColor=new pa(0),r.sheenColorMap=null,r.sheenRoughness=1,r.sheenRoughnessMap=null,r.transmissionMap=null,r.thickness=0,r.thicknessMap=null,r.attenuationDistance=1/0,r.attenuationColor=new pa(1,1,1),r.specularIntensity=1,r.specularIntensityMap=null,r.specularColor=new pa(1,1,1),r.specularColorMap=null,r._anisotropy=0,r._clearcoat=0,r._iridescence=0,r._sheen=0,r._transmission=0,r.setValues(e),r}return s(n,[{key:"anisotropy",get:function(){return this._anisotropy},set:function(e){this._anisotropy>0!=e>0&&this.version++,this._anisotropy=e}},{key:"clearcoat",get:function(){return this._clearcoat},set:function(e){this._clearcoat>0!=e>0&&this.version++,this._clearcoat=e}},{key:"iridescence",get:function(){return this._iridescence},set:function(e){this._iridescence>0!=e>0&&this.version++,this._iridescence=e}},{key:"sheen",get:function(){return this._sheen},set:function(e){this._sheen>0!=e>0&&this.version++,this._sheen=e}},{key:"transmission",get:function(){return this._transmission},set:function(e){this._transmission>0!=e>0&&this.version++,this._transmission=e}},{key:"copy",value:function(e){return y(x(n.prototype),"copy",this).call(this,e),this.defines={STANDARD:"",PHYSICAL:""},this.anisotropy=e.anisotropy,this.anisotropyRotation=e.anisotropyRotation,this.anisotropyMap=e.anisotropyMap,this.clearcoat=e.clearcoat,this.clearcoatMap=e.clearcoatMap,this.clearcoatRoughness=e.clearcoatRoughness,this.clearcoatRoughnessMap=e.clearcoatRoughnessMap,this.clearcoatNormalMap=e.clearcoatNormalMap,this.clearcoatNormalScale.copy(e.clearcoatNormalScale),this.ior=e.ior,this.iridescence=e.iridescence,this.iridescenceMap=e.iridescenceMap,this.iridescenceIOR=e.iridescenceIOR,this.iridescenceThicknessRange=d(e.iridescenceThicknessRange),this.iridescenceThicknessMap=e.iridescenceThicknessMap,this.sheen=e.sheen,this.sheenColor.copy(e.sheenColor),this.sheenColorMap=e.sheenColorMap,this.sheenRoughness=e.sheenRoughness,this.sheenRoughnessMap=e.sheenRoughnessMap,this.transmission=e.transmission,this.transmissionMap=e.transmissionMap,this.thickness=e.thickness,this.thicknessMap=e.thicknessMap,this.attenuationDistance=e.attenuationDistance,this.attenuationColor.copy(e.attenuationColor),this.specularIntensity=e.specularIntensity,this.specularIntensityMap=e.specularIntensityMap,this.specularColor.copy(e.specularColor),this.specularColorMap=e.specularColorMap,this}}]),n}(ed),nd=function(e){w(n,e);var t=E(n);function n(e){var r;return a(this,n),(r=t.call(this)).isMeshPhongMaterial=!0,r.type="MeshPhongMaterial",r.color=new pa(16777215),r.specular=new pa(1118481),r.shininess=30,r.map=null,r.lightMap=null,r.lightMapIntensity=1,r.aoMap=null,r.aoMapIntensity=1,r.emissive=new pa(0),r.emissiveIntensity=1,r.emissiveMap=null,r.bumpMap=null,r.bumpScale=1,r.normalMap=null,r.normalMapType=hn,r.normalScale=new mr(1,1),r.displacementMap=null,r.displacementScale=1,r.displacementBias=0,r.specularMap=null,r.alphaMap=null,r.envMap=null,r.combine=xe,r.reflectivity=1,r.refractionRatio=.98,r.wireframe=!1,r.wireframeLinewidth=1,r.wireframeLinecap="round",r.wireframeLinejoin="round",r.flatShading=!1,r.fog=!0,r.setValues(e),r}return s(n,[{key:"copy",value:function(e){return y(x(n.prototype),"copy",this).call(this,e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}]),n}(la),rd=function(e){w(n,e);var t=E(n);function n(e){var r;return a(this,n),(r=t.call(this)).isMeshToonMaterial=!0,r.defines={TOON:""},r.type="MeshToonMaterial",r.color=new pa(16777215),r.map=null,r.gradientMap=null,r.lightMap=null,r.lightMapIntensity=1,r.aoMap=null,r.aoMapIntensity=1,r.emissive=new pa(0),r.emissiveIntensity=1,r.emissiveMap=null,r.bumpMap=null,r.bumpScale=1,r.normalMap=null,r.normalMapType=hn,r.normalScale=new mr(1,1),r.displacementMap=null,r.displacementScale=1,r.displacementBias=0,r.alphaMap=null,r.wireframe=!1,r.wireframeLinewidth=1,r.wireframeLinecap="round",r.wireframeLinejoin="round",r.fog=!0,r.setValues(e),r}return s(n,[{key:"copy",value:function(e){return y(x(n.prototype),"copy",this).call(this,e),this.color.copy(e.color),this.map=e.map,this.gradientMap=e.gradientMap,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}]),n}(la),id=function(e){w(n,e);var t=E(n);function n(e){var r;return a(this,n),(r=t.call(this)).isMeshNormalMaterial=!0,r.type="MeshNormalMaterial",r.bumpMap=null,r.bumpScale=1,r.normalMap=null,r.normalMapType=hn,r.normalScale=new mr(1,1),r.displacementMap=null,r.displacementScale=1,r.displacementBias=0,r.wireframe=!1,r.wireframeLinewidth=1,r.flatShading=!1,r.setValues(e),r}return s(n,[{key:"copy",value:function(e){return y(x(n.prototype),"copy",this).call(this,e),this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.flatShading=e.flatShading,this}}]),n}(la),ad=function(e){w(n,e);var t=E(n);function n(e){var r;return a(this,n),(r=t.call(this)).isMeshLambertMaterial=!0,r.type="MeshLambertMaterial",r.color=new pa(16777215),r.map=null,r.lightMap=null,r.lightMapIntensity=1,r.aoMap=null,r.aoMapIntensity=1,r.emissive=new pa(0),r.emissiveIntensity=1,r.emissiveMap=null,r.bumpMap=null,r.bumpScale=1,r.normalMap=null,r.normalMapType=hn,r.normalScale=new mr(1,1),r.displacementMap=null,r.displacementScale=1,r.displacementBias=0,r.specularMap=null,r.alphaMap=null,r.envMap=null,r.combine=xe,r.reflectivity=1,r.refractionRatio=.98,r.wireframe=!1,r.wireframeLinewidth=1,r.wireframeLinecap="round",r.wireframeLinejoin="round",r.flatShading=!1,r.fog=!0,r.setValues(e),r}return s(n,[{key:"copy",value:function(e){return y(x(n.prototype),"copy",this).call(this,e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}]),n}(la),od=function(e){w(n,e);var t=E(n);function n(e){var r;return a(this,n),(r=t.call(this)).isMeshMatcapMaterial=!0,r.defines={MATCAP:""},r.type="MeshMatcapMaterial",r.color=new pa(16777215),r.matcap=null,r.map=null,r.bumpMap=null,r.bumpScale=1,r.normalMap=null,r.normalMapType=hn,r.normalScale=new mr(1,1),r.displacementMap=null,r.displacementScale=1,r.displacementBias=0,r.alphaMap=null,r.flatShading=!1,r.fog=!0,r.setValues(e),r}return s(n,[{key:"copy",value:function(e){return y(x(n.prototype),"copy",this).call(this,e),this.defines={MATCAP:""},this.color.copy(e.color),this.matcap=e.matcap,this.map=e.map,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.flatShading=e.flatShading,this.fog=e.fog,this}}]),n}(la),sd=function(e){w(n,e);var t=E(n);function n(e){var r;return a(this,n),(r=t.call(this)).isLineDashedMaterial=!0,r.type="LineDashedMaterial",r.scale=1,r.dashSize=3,r.gapSize=1,r.setValues(e),r}return s(n,[{key:"copy",value:function(e){return y(x(n.prototype),"copy",this).call(this,e),this.scale=e.scale,this.dashSize=e.dashSize,this.gapSize=e.gapSize,this}}]),n}(ic);function ud(e,t,n){return cd(e)?new e.constructor(e.subarray(t,void 0!==n?n:e.length)):e.slice(t,n)}function ld(e,t,n){return!e||!n&&e.constructor===t?e:"number"==typeof t.BYTES_PER_ELEMENT?new t(e):Array.prototype.slice.call(e)}function cd(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function hd(e){for(var t=e.length,n=new Array(t),r=0;r!==t;++r)n[r]=r;return n.sort((function(t,n){return e[t]-e[n]})),n}function dd(e,t,n){for(var r=e.length,i=new e.constructor(r),a=0,o=0;o!==r;++a)for(var s=n[a]*t,u=0;u!==t;++u)i[o++]=e[s+u];return i}function fd(e,t,n,r){for(var i=1,a=e[0];void 0!==a&&void 0===a[r];)a=e[i++];if(void 0!==a){var o=a[r];if(void 0!==o)if(Array.isArray(o))do{void 0!==(o=a[r])&&(t.push(a.time),n.push.apply(n,o)),a=e[i++]}while(void 0!==a);else if(void 0!==o.toArray)do{void 0!==(o=a[r])&&(t.push(a.time),o.toArray(n,n.length)),a=e[i++]}while(void 0!==a);else do{void 0!==(o=a[r])&&(t.push(a.time),n.push(o)),a=e[i++]}while(void 0!==a)}}var pd={arraySlice:ud,convertArray:ld,isTypedArray:cd,getKeyframeOrder:hd,sortedArray:dd,flattenJSON:fd,subclip:function(e,t,n,r){var i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:30,a=e.clone();a.name=t;for(var o=[],s=0;s<a.tracks.length;++s){for(var u=a.tracks[s],l=u.getValueSize(),c=[],h=[],d=0;d<u.times.length;++d){var f=u.times[d]*i;if(!(f<n||f>=r)){c.push(u.times[d]);for(var p=0;p<l;++p)h.push(u.values[d*l+p])}}0!==c.length&&(u.times=ld(c,u.times.constructor),u.values=ld(h,u.values.constructor),o.push(u))}a.tracks=o;for(var v=1/0,m=0;m<a.tracks.length;++m)v>a.tracks[m].times[0]&&(v=a.tracks[m].times[0]);for(var g=0;g<a.tracks.length;++g)a.tracks[g].shift(-1*v);return a.resetDuration(),a},makeClipAdditive:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:30;r<=0&&(r=30);for(var i=n.tracks.length,a=t/r,o=function(){var t=n.tracks[s],r=t.ValueTypeName;if("bool"===r||"string"===r)return"continue";var i=e.tracks.find((function(e){return e.name===t.name&&e.ValueTypeName===r}));if(void 0===i)return"continue";var o=0,u=t.getValueSize();t.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(o=u/3);var l=0,c=i.getValueSize();i.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(l=c/3);var h,d=t.times.length-1;if(a<=t.times[0]){var f=o,p=u-o;h=ud(t.values,f,p)}else if(a>=t.times[d]){var v=d*u+o,m=v+u-o;h=ud(t.values,v,m)}else{var g=t.createInterpolant(),y=o,_=u-o;g.evaluate(a),h=ud(g.resultBuffer,y,_)}"quaternion"===r&&(new qr).fromArray(h).normalize().conjugate().toArray(h);for(var x=i.times.length,M=0;M<x;++M){var S=M*c+l;if("quaternion"===r)qr.multiplyQuaternionsFlat(i.values,S,h,0,i.values,S);else for(var b=c-2*l,w=0;w<b;++w)i.values[S+w]-=h[w]}},s=0;s<i;++s)o();return e.blendMode=nn,e}},vd=function(){function e(t,n,r,i){a(this,e),this.parameterPositions=t,this._cachedIndex=0,this.resultBuffer=void 0!==i?i:new n.constructor(r),this.sampleValues=n,this.valueSize=r,this.settings=null,this.DefaultSettings_={}}return s(e,[{key:"evaluate",value:function(e){var t=this.parameterPositions,n=this._cachedIndex,r=t[n],i=t[n-1];e:{t:{var a;n:{r:if(!(e<r)){for(var o=n+2;;){if(void 0===r){if(e<i)break r;return n=t.length,this._cachedIndex=n,this.copySampleValue_(n-1)}if(n===o)break;if(i=r,e<(r=t[++n]))break t}a=t.length;break n}if(e>=i)break e;var s=t[1];e<s&&(n=2,i=s);for(var u=n-2;;){if(void 0===i)return this._cachedIndex=0,this.copySampleValue_(0);if(n===u)break;if(r=i,e>=(i=t[--n-1]))break t}a=n,n=0}for(;n<a;){var l=n+a>>>1;e<t[l]?a=l:n=l+1}if(r=t[n],void 0===(i=t[n-1]))return this._cachedIndex=0,this.copySampleValue_(0);if(void 0===r)return n=t.length,this._cachedIndex=n,this.copySampleValue_(n-1)}this._cachedIndex=n,this.intervalChanged_(n,i,r)}return this.interpolate_(n,i,e,r)}},{key:"getSettings_",value:function(){return this.settings||this.DefaultSettings_}},{key:"copySampleValue_",value:function(e){for(var t=this.resultBuffer,n=this.sampleValues,r=this.valueSize,i=e*r,a=0;a!==r;++a)t[a]=n[i+a];return t}},{key:"interpolate_",value:function(){throw new Error("call to abstract method")}},{key:"intervalChanged_",value:function(){}}]),e}(),md=function(e){w(n,e);var t=E(n);function n(e,r,i,o){var s;return a(this,n),(s=t.call(this,e,r,i,o))._weightPrev=-0,s._offsetPrev=-0,s._weightNext=-0,s._offsetNext=-0,s.DefaultSettings_={endingStart:Qt,endingEnd:Qt},s}return s(n,[{key:"intervalChanged_",value:function(e,t,n){var r=this.parameterPositions,i=e-2,a=e+1,o=r[i],s=r[a];if(void 0===o)switch(this.getSettings_().endingStart){case $t:i=e,o=2*t-n;break;case en:o=t+r[i=r.length-2]-r[i+1];break;default:i=e,o=n}if(void 0===s)switch(this.getSettings_().endingEnd){case $t:a=e,s=2*n-t;break;case en:a=1,s=n+r[1]-r[0];break;default:a=e-1,s=t}var u=.5*(n-t),l=this.valueSize;this._weightPrev=u/(t-o),this._weightNext=u/(s-n),this._offsetPrev=i*l,this._offsetNext=a*l}},{key:"interpolate_",value:function(e,t,n,r){for(var i=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=e*o,u=s-o,l=this._offsetPrev,c=this._offsetNext,h=this._weightPrev,d=this._weightNext,f=(n-t)/(r-t),p=f*f,v=p*f,m=-h*v+2*h*p-h*f,g=(1+h)*v+(-1.5-2*h)*p+(-.5+h)*f+1,y=(-1-d)*v+(1.5+d)*p+.5*f,_=d*v-d*p,x=0;x!==o;++x)i[x]=m*a[l+x]+g*a[u+x]+y*a[s+x]+_*a[c+x];return i}}]),n}(vd),gd=function(e){w(n,e);var t=E(n);function n(e,r,i,o){return a(this,n),t.call(this,e,r,i,o)}return s(n,[{key:"interpolate_",value:function(e,t,n,r){for(var i=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=e*o,u=s-o,l=(n-t)/(r-t),c=1-l,h=0;h!==o;++h)i[h]=a[u+h]*c+a[s+h]*l;return i}}]),n}(vd),yd=function(e){w(n,e);var t=E(n);function n(e,r,i,o){return a(this,n),t.call(this,e,r,i,o)}return s(n,[{key:"interpolate_",value:function(e){return this.copySampleValue_(e-1)}}]),n}(vd),_d=function(){function e(t,n,r,i){if(a(this,e),void 0===t)throw new Error("THREE.KeyframeTrack: track name is undefined");if(void 0===n||0===n.length)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+t);this.name=t,this.times=ld(n,this.TimeBufferType),this.values=ld(r,this.ValueBufferType),this.setInterpolation(i||this.DefaultInterpolation)}return s(e,[{key:"InterpolantFactoryMethodDiscrete",value:function(e){return new yd(this.times,this.values,this.getValueSize(),e)}},{key:"InterpolantFactoryMethodLinear",value:function(e){return new gd(this.times,this.values,this.getValueSize(),e)}},{key:"InterpolantFactoryMethodSmooth",value:function(e){return new md(this.times,this.values,this.getValueSize(),e)}},{key:"setInterpolation",value:function(e){var t;switch(e){case Zt:t=this.InterpolantFactoryMethodDiscrete;break;case Kt:t=this.InterpolantFactoryMethodLinear;break;case Jt:t=this.InterpolantFactoryMethodSmooth}if(void 0===t){var n="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(void 0===this.createInterpolant){if(e===this.DefaultInterpolation)throw new Error(n);this.setInterpolation(this.DefaultInterpolation)}return console.warn("THREE.KeyframeTrack:",n),this}return this.createInterpolant=t,this}},{key:"getInterpolation",value:function(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return Zt;case this.InterpolantFactoryMethodLinear:return Kt;case this.InterpolantFactoryMethodSmooth:return Jt}}},{key:"getValueSize",value:function(){return this.values.length/this.times.length}},{key:"shift",value:function(e){if(0!==e)for(var t=this.times,n=0,r=t.length;n!==r;++n)t[n]+=e;return this}},{key:"scale",value:function(e){if(1!==e)for(var t=this.times,n=0,r=t.length;n!==r;++n)t[n]*=e;return this}},{key:"trim",value:function(e,t){for(var n=this.times,r=n.length,i=0,a=r-1;i!==r&&n[i]<e;)++i;for(;-1!==a&&n[a]>t;)--a;if(++a,0!==i||a!==r){i>=a&&(i=(a=Math.max(a,1))-1);var o=this.getValueSize();this.times=ud(n,i,a),this.values=ud(this.values,i*o,a*o)}return this}},{key:"validate",value:function(){var e=!0,t=this.getValueSize();t-Math.floor(t)!=0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),e=!1);var n=this.times,r=this.values,i=n.length;0===i&&(console.error("THREE.KeyframeTrack: Track is empty.",this),e=!1);for(var a=null,o=0;o!==i;o++){var s=n[o];if("number"==typeof s&&isNaN(s)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,o,s),e=!1;break}if(null!==a&&a>s){console.error("THREE.KeyframeTrack: Out of order keys.",this,o,s,a),e=!1;break}a=s}if(void 0!==r&&cd(r))for(var u=0,l=r.length;u!==l;++u){var c=r[u];if(isNaN(c)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,u,c),e=!1;break}}return e}},{key:"optimize",value:function(){for(var e=ud(this.times),t=ud(this.values),n=this.getValueSize(),r=this.getInterpolation()===Jt,i=e.length-1,a=1,o=1;o<i;++o){var s=!1,u=e[o];if(u!==e[o+1]&&(1!==o||u!==e[0]))if(r)s=!0;else for(var l=o*n,c=l-n,h=l+n,d=0;d!==n;++d){var f=t[l+d];if(f!==t[c+d]||f!==t[h+d]){s=!0;break}}if(s){if(o!==a){e[a]=e[o];for(var p=o*n,v=a*n,m=0;m!==n;++m)t[v+m]=t[p+m]}++a}}if(i>0){e[a]=e[i];for(var g=i*n,y=a*n,_=0;_!==n;++_)t[y+_]=t[g+_];++a}return a!==e.length?(this.times=ud(e,0,a),this.values=ud(t,0,a*n)):(this.times=e,this.values=t),this}},{key:"clone",value:function(){var e=ud(this.times,0),t=ud(this.values,0),n=new(0,this.constructor)(this.name,e,t);return n.createInterpolant=this.createInterpolant,n}}],[{key:"toJSON",value:function(e){var t,n=e.constructor;if(n.toJSON!==this.toJSON)t=n.toJSON(e);else{t={name:e.name,times:ld(e.times,Array),values:ld(e.values,Array)};var r=e.getInterpolation();r!==e.DefaultInterpolation&&(t.interpolation=r)}return t.type=e.ValueTypeName,t}}]),e}();_d.prototype.TimeBufferType=Float32Array,_d.prototype.ValueBufferType=Float32Array,_d.prototype.DefaultInterpolation=Kt;var xd=function(e){w(n,e);var t=E(n);function n(){return a(this,n),t.apply(this,arguments)}return s(n)}(_d);xd.prototype.ValueTypeName="bool",xd.prototype.ValueBufferType=Array,xd.prototype.DefaultInterpolation=Zt,xd.prototype.InterpolantFactoryMethodLinear=void 0,xd.prototype.InterpolantFactoryMethodSmooth=void 0;var Md=function(e){w(n,e);var t=E(n);function n(){return a(this,n),t.apply(this,arguments)}return s(n)}(_d);Md.prototype.ValueTypeName="color";var Sd=function(e){w(n,e);var t=E(n);function n(){return a(this,n),t.apply(this,arguments)}return s(n)}(_d);Sd.prototype.ValueTypeName="number";var bd=function(e){w(n,e);var t=E(n);function n(e,r,i,o){return a(this,n),t.call(this,e,r,i,o)}return s(n,[{key:"interpolate_",value:function(e,t,n,r){for(var i=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=(n-t)/(r-t),u=e*o,l=u+o;u!==l;u+=4)qr.slerpFlat(i,0,a,u-o,a,u,s);return i}}]),n}(vd),wd=function(e){w(n,e);var t=E(n);function n(){return a(this,n),t.apply(this,arguments)}return s(n,[{key:"InterpolantFactoryMethodLinear",value:function(e){return new bd(this.times,this.values,this.getValueSize(),e)}}]),n}(_d);wd.prototype.ValueTypeName="quaternion",wd.prototype.DefaultInterpolation=Kt,wd.prototype.InterpolantFactoryMethodSmooth=void 0;var Td=function(e){w(n,e);var t=E(n);function n(){return a(this,n),t.apply(this,arguments)}return s(n)}(_d);Td.prototype.ValueTypeName="string",Td.prototype.ValueBufferType=Array,Td.prototype.DefaultInterpolation=Zt,Td.prototype.InterpolantFactoryMethodLinear=void 0,Td.prototype.InterpolantFactoryMethodSmooth=void 0;var Ed=function(e){w(n,e);var t=E(n);function n(){return a(this,n),t.apply(this,arguments)}return s(n)}(_d);Ed.prototype.ValueTypeName="vector";var Ad=function(){function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1,r=arguments.length>2?arguments[2]:void 0,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:tn;a(this,e),this.name=t,this.tracks=r,this.duration=n,this.blendMode=i,this.uuid=or(),this.duration<0&&this.resetDuration()}return s(e,[{key:"resetDuration",value:function(){for(var e=0,t=0,n=this.tracks.length;t!==n;++t){var r=this.tracks[t];e=Math.max(e,r.times[r.times.length-1])}return this.duration=e,this}},{key:"trim",value:function(){for(var e=0;e<this.tracks.length;e++)this.tracks[e].trim(0,this.duration);return this}},{key:"validate",value:function(){for(var e=!0,t=0;t<this.tracks.length;t++)e=e&&this.tracks[t].validate();return e}},{key:"optimize",value:function(){for(var e=0;e<this.tracks.length;e++)this.tracks[e].optimize();return this}},{key:"clone",value:function(){for(var e=[],t=0;t<this.tracks.length;t++)e.push(this.tracks[t].clone());return new this.constructor(this.name,this.duration,e,this.blendMode)}},{key:"toJSON",value:function(){return this.constructor.toJSON(this)}}],[{key:"parse",value:function(e){for(var t=[],n=e.tracks,r=1/(e.fps||1),i=0,a=n.length;i!==a;++i)t.push(Rd(n[i]).scale(r));var o=new this(e.name,e.duration,t,e.blendMode);return o.uuid=e.uuid,o}},{key:"toJSON",value:function(e){for(var t=[],n=e.tracks,r={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode},i=0,a=n.length;i!==a;++i)t.push(_d.toJSON(n[i]));return r}},{key:"CreateFromMorphTargetSequence",value:function(e,t,n,r){for(var i=t.length,a=[],o=0;o<i;o++){var s=[],u=[];s.push((o+i-1)%i,o,(o+1)%i),u.push(0,1,0);var l=hd(s);s=dd(s,1,l),u=dd(u,1,l),r||0!==s[0]||(s.push(i),u.push(u[0])),a.push(new Sd(".morphTargetInfluences["+t[o].name+"]",s,u).scale(1/n))}return new this(e,-1,a)}},{key:"findByName",value:function(e,t){var n=e;if(!Array.isArray(e)){var r=e;n=r.geometry&&r.geometry.animations||r.animations}for(var i=0;i<n.length;i++)if(n[i].name===t)return n[i];return null}},{key:"CreateClipsFromMorphTargetSequences",value:function(e,t,n){for(var r={},i=/^([\w-]*?)([\d]+)$/,a=0,o=e.length;a<o;a++){var s=e[a],u=s.name.match(i);if(u&&u.length>1){var l=u[1],c=r[l];c||(r[l]=c=[]),c.push(s)}}var h=[];for(var d in r)h.push(this.CreateFromMorphTargetSequence(d,r[d],t,n));return h}},{key:"parseAnimation",value:function(e,t){if(!e)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;for(var n=function(e,t,n,r,i){if(0!==n.length){var a=[],o=[];fd(n,a,o,r),0!==a.length&&i.push(new e(t,a,o))}},r=[],i=e.name||"default",a=e.fps||30,o=e.blendMode,s=e.length||-1,u=e.hierarchy||[],l=0;l<u.length;l++){var c=u[l].keys;if(c&&0!==c.length)if(c[0].morphTargets){var h={},d=void 0;for(d=0;d<c.length;d++)if(c[d].morphTargets)for(var f=0;f<c[d].morphTargets.length;f++)h[c[d].morphTargets[f]]=-1;for(var p in h){for(var v=[],m=[],g=0;g!==c[d].morphTargets.length;++g){var y=c[d];v.push(y.time),m.push(y.morphTarget===p?1:0)}r.push(new Sd(".morphTargetInfluence["+p+"]",v,m))}s=h.length*a}else{var _=".bones["+t[l].name+"]";n(Ed,_+".position",c,"pos",r),n(wd,_+".quaternion",c,"rot",r),n(Ed,_+".scale",c,"scl",r)}}return 0===r.length?null:new this(i,s,r,o)}}]),e}();function Rd(e){if(void 0===e.type)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");var t=function(e){switch(e.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return Sd;case"vector":case"vector2":case"vector3":case"vector4":return Ed;case"color":return Md;case"quaternion":return wd;case"bool":case"boolean":return xd;case"string":return Td}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+e)}(e.type);if(void 0===e.times){var n=[],r=[];fd(e.keys,n,r,"value"),e.times=n,e.values=r}return void 0!==t.parse?t.parse(e):new t(e.name,e.times,e.values,e.interpolation)}var kd={enabled:!1,files:{},add:function(e,t){!1!==this.enabled&&(this.files[e]=t)},get:function(e){if(!1!==this.enabled)return this.files[e]},remove:function(e){delete this.files[e]},clear:function(){this.files={}}},Cd=s((function e(t,n,r){a(this,e);var i=this,o=!1,s=0,u=0,l=void 0,c=[];this.onStart=void 0,this.onLoad=t,this.onProgress=n,this.onError=r,this.itemStart=function(e){u++,!1===o&&void 0!==i.onStart&&i.onStart(e,s,u),o=!0},this.itemEnd=function(e){s++,void 0!==i.onProgress&&i.onProgress(e,s,u),s===u&&(o=!1,void 0!==i.onLoad&&i.onLoad())},this.itemError=function(e){void 0!==i.onError&&i.onError(e)},this.resolveURL=function(e){return l?l(e):e},this.setURLModifier=function(e){return l=e,this},this.addHandler=function(e,t){return c.push(e,t),this},this.removeHandler=function(e){var t=c.indexOf(e);return-1!==t&&c.splice(t,2),this},this.getHandler=function(e){for(var t=0,n=c.length;t<n;t+=2){var r=c[t],i=c[t+1];if(r.global&&(r.lastIndex=0),r.test(e))return i}return null}})),Ld=new Cd,Pd=function(){function e(t){a(this,e),this.manager=void 0!==t?t:Ld,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}return s(e,[{key:"load",value:function(){}},{key:"loadAsync",value:function(e,t){var n=this;return new Promise((function(r,i){n.load(e,r,t,i)}))}},{key:"parse",value:function(){}},{key:"setCrossOrigin",value:function(e){return this.crossOrigin=e,this}},{key:"setWithCredentials",value:function(e){return this.withCredentials=e,this}},{key:"setPath",value:function(e){return this.path=e,this}},{key:"setResourcePath",value:function(e){return this.resourcePath=e,this}},{key:"setRequestHeader",value:function(e){return this.requestHeader=e,this}}]),e}();Pd.DEFAULT_MATERIAL_NAME="__DEFAULT";var Id,Dd={},Ud=function(e){w(n,e);var t=E(n);function n(e,r){var i;return a(this,n),(i=t.call(this,e)).response=r,i}return s(n)}(h(Error)),Od=function(e){w(n,e);var t=E(n);function n(e){return a(this,n),t.call(this,e)}return s(n,[{key:"load",value:function(e,t,n,r){var i=this;void 0===e&&(e=""),void 0!==this.path&&(e=this.path+e),e=this.manager.resolveURL(e);var a=kd.get(e);if(void 0!==a)return this.manager.itemStart(e),setTimeout((function(){t&&t(a),i.manager.itemEnd(e)}),0),a;if(void 0===Dd[e]){Dd[e]=[],Dd[e].push({onLoad:t,onProgress:n,onError:r});var o=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"}),s=this.mimeType,u=this.responseType;fetch(o).then((function(t){if(200===t.status||0===t.status){if(0===t.status&&console.warn("THREE.FileLoader: HTTP Status 0 received."),"undefined"==typeof ReadableStream||void 0===t.body||void 0===t.body.getReader)return t;var n=Dd[e],r=t.body.getReader(),i=t.headers.get("Content-Length")||t.headers.get("X-File-Size"),a=i?parseInt(i):0,o=0!==a,s=0,u=new ReadableStream({start:function(e){!function t(){r.read().then((function(r){var i=r.done,u=r.value;if(i)e.close();else{s+=u.byteLength;for(var l=new ProgressEvent("progress",{lengthComputable:o,loaded:s,total:a}),c=0,h=n.length;c<h;c++){var d=n[c];d.onProgress&&d.onProgress(l)}e.enqueue(u),t()}}))}()}});return new Response(u)}throw new Ud('fetch for "'.concat(t.url,'" responded with ').concat(t.status,": ").concat(t.statusText),t)})).then((function(e){switch(u){case"arraybuffer":return e.arrayBuffer();case"blob":return e.blob();case"document":return e.text().then((function(e){return(new DOMParser).parseFromString(e,s)}));case"json":return e.json();default:if(void 0===s)return e.text();var t=/charset="?([^;"\s]*)"?/i.exec(s),n=t&&t[1]?t[1].toLowerCase():void 0,r=new TextDecoder(n);return e.arrayBuffer().then((function(e){return r.decode(e)}))}})).then((function(t){kd.add(e,t);var n=Dd[e];delete Dd[e];for(var r=0,i=n.length;r<i;r++){var a=n[r];a.onLoad&&a.onLoad(t)}})).catch((function(t){var n=Dd[e];if(void 0===n)throw i.manager.itemError(e),t;delete Dd[e];for(var r=0,a=n.length;r<a;r++){var o=n[r];o.onError&&o.onError(t)}i.manager.itemError(e)})).finally((function(){i.manager.itemEnd(e)})),this.manager.itemStart(e)}else Dd[e].push({onLoad:t,onProgress:n,onError:r})}},{key:"setResponseType",value:function(e){return this.responseType=e,this}},{key:"setMimeType",value:function(e){return this.mimeType=e,this}}]),n}(Pd),Nd=function(e){w(n,e);var t=E(n);function n(e){return a(this,n),t.call(this,e)}return s(n,[{key:"load",value:function(e,t,n,r){var i=this,a=new Od(this.manager);a.setPath(this.path),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(e,(function(n){try{t(i.parse(JSON.parse(n)))}catch(t){r?r(t):console.error(t),i.manager.itemError(e)}}),n,r)}},{key:"parse",value:function(e){for(var t=[],n=0;n<e.length;n++){var r=Ad.parse(e[n]);t.push(r)}return t}}]),n}(Pd),Fd=function(e){w(n,e);var t=E(n);function n(e){return a(this,n),t.call(this,e)}return s(n,[{key:"load",value:function(e,t,n,r){var i=this,a=[],o=new wc,s=new Od(this.manager);s.setPath(this.path),s.setResponseType("arraybuffer"),s.setRequestHeader(this.requestHeader),s.setWithCredentials(i.withCredentials);var u=0;function l(l){s.load(e[l],(function(e){var n=i.parse(e,!0);a[l]={width:n.width,height:n.height,format:n.format,mipmaps:n.mipmaps},6===(u+=1)&&(1===n.mipmapCount&&(o.minFilter=Ve),o.image=a,o.format=n.format,o.needsUpdate=!0,t&&t(o))}),n,r)}if(Array.isArray(e))for(var c=0,h=e.length;c<h;++c)l(c);else s.load(e,(function(e){var n=i.parse(e,!0);if(n.isCubemap){for(var r=n.mipmaps.length/n.mipmapCount,s=0;s<r;s++){a[s]={mipmaps:[]};for(var u=0;u<n.mipmapCount;u++)a[s].mipmaps.push(n.mipmaps[s*n.mipmapCount+u]),a[s].format=n.format,a[s].width=n.width,a[s].height=n.height}o.image=a}else o.image.width=n.width,o.image.height=n.height,o.mipmaps=n.mipmaps;1===n.mipmapCount&&(o.minFilter=Ve),o.format=n.format,o.needsUpdate=!0,t&&t(o)}),n,r);return o}}]),n}(Pd),Bd=function(e){w(n,e);var t=E(n);function n(e){return a(this,n),t.call(this,e)}return s(n,[{key:"load",value:function(e,t,n,r){void 0!==this.path&&(e=this.path+e),e=this.manager.resolveURL(e);var i=this,a=kd.get(e);if(void 0!==a)return i.manager.itemStart(e),setTimeout((function(){t&&t(a),i.manager.itemEnd(e)}),0),a;var o=Sr("img");function s(){l(),kd.add(e,this),t&&t(this),i.manager.itemEnd(e)}function u(t){l(),r&&r(t),i.manager.itemError(e),i.manager.itemEnd(e)}function l(){o.removeEventListener("load",s,!1),o.removeEventListener("error",u,!1)}return o.addEventListener("load",s,!1),o.addEventListener("error",u,!1),"data:"!==e.slice(0,5)&&void 0!==this.crossOrigin&&(o.crossOrigin=this.crossOrigin),i.manager.itemStart(e),o.src=e,o}}]),n}(Pd),zd=function(e){w(n,e);var t=E(n);function n(e){return a(this,n),t.call(this,e)}return s(n,[{key:"load",value:function(e,t,n,r){var i=new _o;i.colorSpace=pn;var a=new Bd(this.manager);a.setCrossOrigin(this.crossOrigin),a.setPath(this.path);var o=0;function s(n){a.load(e[n],(function(e){i.images[n]=e,6===++o&&(i.needsUpdate=!0,t&&t(i))}),void 0,r)}for(var u=0;u<e.length;++u)s(u);return i}}]),n}(Pd),Hd=function(e){w(n,e);var t=E(n);function n(e){return a(this,n),t.call(this,e)}return s(n,[{key:"load",value:function(e,t,n,r){var i=this,a=new jl,o=new Od(this.manager);return o.setResponseType("arraybuffer"),o.setRequestHeader(this.requestHeader),o.setPath(this.path),o.setWithCredentials(i.withCredentials),o.load(e,(function(e){var n;try{n=i.parse(e)}catch(e){if(void 0===r)return void console.error(e);r(e)}if(!n)return r();void 0!==n.image?a.image=n.image:void 0!==n.data&&(a.image.width=n.width,a.image.height=n.height,a.image.data=n.data),a.wrapS=void 0!==n.wrapS?n.wrapS:Oe,a.wrapT=void 0!==n.wrapT?n.wrapT:Oe,a.magFilter=void 0!==n.magFilter?n.magFilter:Ve,a.minFilter=void 0!==n.minFilter?n.minFilter:Ve,a.anisotropy=void 0!==n.anisotropy?n.anisotropy:1,void 0!==n.colorSpace?a.colorSpace=n.colorSpace:void 0!==n.encoding&&(a.encoding=n.encoding),void 0!==n.flipY&&(a.flipY=n.flipY),void 0!==n.format&&(a.format=n.format),void 0!==n.type&&(a.type=n.type),void 0!==n.mipmaps&&(a.mipmaps=n.mipmaps,a.minFilter=Xe),1===n.mipmapCount&&(a.minFilter=Ve),void 0!==n.generateMipmaps&&(a.generateMipmaps=n.generateMipmaps),a.needsUpdate=!0,t&&t(a,n)}),n,r),a}}]),n}(Pd),Gd=function(e){w(n,e);var t=E(n);function n(e){return a(this,n),t.call(this,e)}return s(n,[{key:"load",value:function(e,t,n,r){var i=new Fr,a=new Bd(this.manager);return a.setCrossOrigin(this.crossOrigin),a.setPath(this.path),a.load(e,(function(e){i.image=e,i.needsUpdate=!0,void 0!==t&&t(i)}),n,r),i}}]),n}(Pd),Vd=function(e){w(n,e);var t=E(n);function n(e){var r,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return a(this,n),(r=t.call(this)).isLight=!0,r.type="Light",r.color=new pa(e),r.intensity=i,r}return s(n,[{key:"dispose",value:function(){}},{key:"copy",value:function(e,t){return y(x(n.prototype),"copy",this).call(this,e,t),this.color.copy(e.color),this.intensity=e.intensity,this}},{key:"toJSON",value:function(e){var t=y(x(n.prototype),"toJSON",this).call(this,e);return t.object.color=this.color.getHex(),t.object.intensity=this.intensity,void 0!==this.groundColor&&(t.object.groundColor=this.groundColor.getHex()),void 0!==this.distance&&(t.object.distance=this.distance),void 0!==this.angle&&(t.object.angle=this.angle),void 0!==this.decay&&(t.object.decay=this.decay),void 0!==this.penumbra&&(t.object.penumbra=this.penumbra),void 0!==this.shadow&&(t.object.shadow=this.shadow.toJSON()),t}}]),n}(Zi),Wd=function(e){w(n,e);var t=E(n);function n(e,r,i){var o;return a(this,n),(o=t.call(this,e,i)).isHemisphereLight=!0,o.type="HemisphereLight",o.position.copy(Zi.DEFAULT_UP),o.updateMatrix(),o.groundColor=new pa(r),o}return s(n,[{key:"copy",value:function(e,t){return y(x(n.prototype),"copy",this).call(this,e,t),this.groundColor.copy(e.groundColor),this}}]),n}(Vd),jd=new wi,Xd=new Yr,qd=new Yr,Yd=function(){function e(t){a(this,e),this.camera=t,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new mr(512,512),this.map=null,this.mapPass=null,this.matrix=new wi,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new Ao,this._frameExtents=new mr(1,1),this._viewportCount=1,this._viewports=[new Br(0,0,1,1)]}return s(e,[{key:"getViewportCount",value:function(){return this._viewportCount}},{key:"getFrustum",value:function(){return this._frustum}},{key:"updateMatrices",value:function(e){var t=this.camera,n=this.matrix;Xd.setFromMatrixPosition(e.matrixWorld),t.position.copy(Xd),qd.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(qd),t.updateMatrixWorld(),jd.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(jd),n.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),n.multiply(jd)}},{key:"getViewport",value:function(e){return this._viewports[e]}},{key:"getFrameExtents",value:function(){return this._frameExtents}},{key:"dispose",value:function(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}},{key:"copy",value:function(e){return this.camera=e.camera.clone(),this.bias=e.bias,this.radius=e.radius,this.mapSize.copy(e.mapSize),this}},{key:"clone",value:function(){return(new this.constructor).copy(this)}},{key:"toJSON",value:function(){var e={};return 0!==this.bias&&(e.bias=this.bias),0!==this.normalBias&&(e.normalBias=this.normalBias),1!==this.radius&&(e.radius=this.radius),512===this.mapSize.x&&512===this.mapSize.y||(e.mapSize=this.mapSize.toArray()),e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}}]),e}(),Zd=function(e){w(n,e);var t=E(n);function n(){var e;return a(this,n),(e=t.call(this,new mo(50,1,.5,500))).isSpotLightShadow=!0,e.focus=1,e}return s(n,[{key:"updateMatrices",value:function(e){var t=this.camera,r=2*ar*e.angle*this.focus,i=this.mapSize.width/this.mapSize.height,a=e.distance||t.far;r===t.fov&&i===t.aspect&&a===t.far||(t.fov=r,t.aspect=i,t.far=a,t.updateProjectionMatrix()),y(x(n.prototype),"updateMatrices",this).call(this,e)}},{key:"copy",value:function(e){return y(x(n.prototype),"copy",this).call(this,e),this.focus=e.focus,this}}]),n}(Yd),Kd=function(e){w(n,e);var t=E(n);function n(e,r){var i,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:Math.PI/3,u=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,l=arguments.length>5&&void 0!==arguments[5]?arguments[5]:2;return a(this,n),(i=t.call(this,e,r)).isSpotLight=!0,i.type="SpotLight",i.position.copy(Zi.DEFAULT_UP),i.updateMatrix(),i.target=new Zi,i.distance=o,i.angle=s,i.penumbra=u,i.decay=l,i.map=null,i.shadow=new Zd,i}return s(n,[{key:"power",get:function(){return this.intensity*Math.PI},set:function(e){this.intensity=e/Math.PI}},{key:"dispose",value:function(){this.shadow.dispose()}},{key:"copy",value:function(e,t){return y(x(n.prototype),"copy",this).call(this,e,t),this.distance=e.distance,this.angle=e.angle,this.penumbra=e.penumbra,this.decay=e.decay,this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}]),n}(Vd),Jd=new wi,Qd=new Yr,$d=new Yr,ef=function(e){w(n,e);var t=E(n);function n(){var e;return a(this,n),(e=t.call(this,new mo(90,1,.5,500))).isPointLightShadow=!0,e._frameExtents=new mr(4,2),e._viewportCount=6,e._viewports=[new Br(2,1,1,1),new Br(0,1,1,1),new Br(3,1,1,1),new Br(1,1,1,1),new Br(3,0,1,1),new Br(1,0,1,1)],e._cubeDirections=[new Yr(1,0,0),new Yr(-1,0,0),new Yr(0,0,1),new Yr(0,0,-1),new Yr(0,1,0),new Yr(0,-1,0)],e._cubeUps=[new Yr(0,1,0),new Yr(0,1,0),new Yr(0,1,0),new Yr(0,1,0),new Yr(0,0,1),new Yr(0,0,-1)],e}return s(n,[{key:"updateMatrices",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this.camera,r=this.matrix,i=e.distance||n.far;i!==n.far&&(n.far=i,n.updateProjectionMatrix()),Qd.setFromMatrixPosition(e.matrixWorld),n.position.copy(Qd),$d.copy(n.position),$d.add(this._cubeDirections[t]),n.up.copy(this._cubeUps[t]),n.lookAt($d),n.updateMatrixWorld(),r.makeTranslation(-Qd.x,-Qd.y,-Qd.z),Jd.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse),this._frustum.setFromProjectionMatrix(Jd)}}]),n}(Yd),tf=function(e){w(n,e);var t=E(n);function n(e,r){var i,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:2;return a(this,n),(i=t.call(this,e,r)).isPointLight=!0,i.type="PointLight",i.distance=o,i.decay=s,i.shadow=new ef,i}return s(n,[{key:"power",get:function(){return 4*this.intensity*Math.PI},set:function(e){this.intensity=e/(4*Math.PI)}},{key:"dispose",value:function(){this.shadow.dispose()}},{key:"copy",value:function(e,t){return y(x(n.prototype),"copy",this).call(this,e,t),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}}]),n}(Vd),nf=function(e){w(n,e);var t=E(n);function n(){var e;return a(this,n),(e=t.call(this,new Ho(-5,5,5,-5,.5,500))).isDirectionalLightShadow=!0,e}return s(n)}(Yd),rf=function(e){w(n,e);var t=E(n);function n(e,r){var i;return a(this,n),(i=t.call(this,e,r)).isDirectionalLight=!0,i.type="DirectionalLight",i.position.copy(Zi.DEFAULT_UP),i.updateMatrix(),i.target=new Zi,i.shadow=new nf,i}return s(n,[{key:"dispose",value:function(){this.shadow.dispose()}},{key:"copy",value:function(e){return y(x(n.prototype),"copy",this).call(this,e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}]),n}(Vd),af=function(e){w(n,e);var t=E(n);function n(e,r){var i;return a(this,n),(i=t.call(this,e,r)).isAmbientLight=!0,i.type="AmbientLight",i}return s(n)}(Vd),of=function(e){w(n,e);var t=E(n);function n(e,r){var i,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:10,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:10;return a(this,n),(i=t.call(this,e,r)).isRectAreaLight=!0,i.type="RectAreaLight",i.width=o,i.height=s,i}return s(n,[{key:"power",get:function(){return this.intensity*this.width*this.height*Math.PI},set:function(e){this.intensity=e/(this.width*this.height*Math.PI)}},{key:"copy",value:function(e){return y(x(n.prototype),"copy",this).call(this,e),this.width=e.width,this.height=e.height,this}},{key:"toJSON",value:function(e){var t=y(x(n.prototype),"toJSON",this).call(this,e);return t.object.width=this.width,t.object.height=this.height,t}}]),n}(Vd),sf=function(){function e(){a(this,e),this.isSphericalHarmonics3=!0,this.coefficients=[];for(var t=0;t<9;t++)this.coefficients.push(new Yr)}return s(e,[{key:"set",value:function(e){for(var t=0;t<9;t++)this.coefficients[t].copy(e[t]);return this}},{key:"zero",value:function(){for(var e=0;e<9;e++)this.coefficients[e].set(0,0,0);return this}},{key:"getAt",value:function(e,t){var n=e.x,r=e.y,i=e.z,a=this.coefficients;return t.copy(a[0]).multiplyScalar(.282095),t.addScaledVector(a[1],.488603*r),t.addScaledVector(a[2],.488603*i),t.addScaledVector(a[3],.488603*n),t.addScaledVector(a[4],n*r*1.092548),t.addScaledVector(a[5],r*i*1.092548),t.addScaledVector(a[6],.315392*(3*i*i-1)),t.addScaledVector(a[7],n*i*1.092548),t.addScaledVector(a[8],.546274*(n*n-r*r)),t}},{key:"getIrradianceAt",value:function(e,t){var n=e.x,r=e.y,i=e.z,a=this.coefficients;return t.copy(a[0]).multiplyScalar(.886227),t.addScaledVector(a[1],1.023328*r),t.addScaledVector(a[2],1.023328*i),t.addScaledVector(a[3],1.023328*n),t.addScaledVector(a[4],.858086*n*r),t.addScaledVector(a[5],.858086*r*i),t.addScaledVector(a[6],.743125*i*i-.247708),t.addScaledVector(a[7],.858086*n*i),t.addScaledVector(a[8],.429043*(n*n-r*r)),t}},{key:"add",value:function(e){for(var t=0;t<9;t++)this.coefficients[t].add(e.coefficients[t]);return this}},{key:"addScaledSH",value:function(e,t){for(var n=0;n<9;n++)this.coefficients[n].addScaledVector(e.coefficients[n],t);return this}},{key:"scale",value:function(e){for(var t=0;t<9;t++)this.coefficients[t].multiplyScalar(e);return this}},{key:"lerp",value:function(e,t){for(var n=0;n<9;n++)this.coefficients[n].lerp(e.coefficients[n],t);return this}},{key:"equals",value:function(e){for(var t=0;t<9;t++)if(!this.coefficients[t].equals(e.coefficients[t]))return!1;return!0}},{key:"copy",value:function(e){return this.set(e.coefficients)}},{key:"clone",value:function(){return(new this.constructor).copy(this)}},{key:"fromArray",value:function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this.coefficients,r=0;r<9;r++)n[r].fromArray(e,t+3*r);return this}},{key:"toArray",value:function(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this.coefficients,r=0;r<9;r++)n[r].toArray(e,t+3*r);return e}}],[{key:"getBasisAt",value:function(e,t){var n=e.x,r=e.y,i=e.z;t[0]=.282095,t[1]=.488603*r,t[2]=.488603*i,t[3]=.488603*n,t[4]=1.092548*n*r,t[5]=1.092548*r*i,t[6]=.315392*(3*i*i-1),t[7]=1.092548*n*i,t[8]=.546274*(n*n-r*r)}}]),e}(),uf=function(e){w(n,e);var t=E(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new sf,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return a(this,n),(e=t.call(this,void 0,i)).isLightProbe=!0,e.sh=r,e}return s(n,[{key:"copy",value:function(e){return y(x(n.prototype),"copy",this).call(this,e),this.sh.copy(e.sh),this}},{key:"fromJSON",value:function(e){return this.intensity=e.intensity,this.sh.fromArray(e.sh),this}},{key:"toJSON",value:function(e){var t=y(x(n.prototype),"toJSON",this).call(this,e);return t.object.sh=this.sh.toArray(),t}}]),n}(Vd),lf=function(e){w(n,e);var t=E(n);function n(e){var r;return a(this,n),(r=t.call(this,e)).textures={},r}return s(n,[{key:"load",value:function(e,t,n,r){var i=this,a=new Od(i.manager);a.setPath(i.path),a.setRequestHeader(i.requestHeader),a.setWithCredentials(i.withCredentials),a.load(e,(function(n){try{t(i.parse(JSON.parse(n)))}catch(t){r?r(t):console.error(t),i.manager.itemError(e)}}),n,r)}},{key:"parse",value:function(e){var t=this.textures;function r(e){return void 0===t[e]&&console.warn("THREE.MaterialLoader: Undefined texture",e),t[e]}var i=n.createMaterialFromType(e.type);if(void 0!==e.uuid&&(i.uuid=e.uuid),void 0!==e.name&&(i.name=e.name),void 0!==e.color&&void 0!==i.color&&i.color.setHex(e.color),void 0!==e.roughness&&(i.roughness=e.roughness),void 0!==e.metalness&&(i.metalness=e.metalness),void 0!==e.sheen&&(i.sheen=e.sheen),void 0!==e.sheenColor&&(i.sheenColor=(new pa).setHex(e.sheenColor)),void 0!==e.sheenRoughness&&(i.sheenRoughness=e.sheenRoughness),void 0!==e.emissive&&void 0!==i.emissive&&i.emissive.setHex(e.emissive),void 0!==e.specular&&void 0!==i.specular&&i.specular.setHex(e.specular),void 0!==e.specularIntensity&&(i.specularIntensity=e.specularIntensity),void 0!==e.specularColor&&void 0!==i.specularColor&&i.specularColor.setHex(e.specularColor),void 0!==e.shininess&&(i.shininess=e.shininess),void 0!==e.clearcoat&&(i.clearcoat=e.clearcoat),void 0!==e.clearcoatRoughness&&(i.clearcoatRoughness=e.clearcoatRoughness),void 0!==e.iridescence&&(i.iridescence=e.iridescence),void 0!==e.iridescenceIOR&&(i.iridescenceIOR=e.iridescenceIOR),void 0!==e.iridescenceThicknessRange&&(i.iridescenceThicknessRange=e.iridescenceThicknessRange),void 0!==e.transmission&&(i.transmission=e.transmission),void 0!==e.thickness&&(i.thickness=e.thickness),void 0!==e.attenuationDistance&&(i.attenuationDistance=e.attenuationDistance),void 0!==e.attenuationColor&&void 0!==i.attenuationColor&&i.attenuationColor.setHex(e.attenuationColor),void 0!==e.anisotropy&&(i.anisotropy=e.anisotropy),void 0!==e.anisotropyRotation&&(i.anisotropyRotation=e.anisotropyRotation),void 0!==e.fog&&(i.fog=e.fog),void 0!==e.flatShading&&(i.flatShading=e.flatShading),void 0!==e.blending&&(i.blending=e.blending),void 0!==e.combine&&(i.combine=e.combine),void 0!==e.side&&(i.side=e.side),void 0!==e.shadowSide&&(i.shadowSide=e.shadowSide),void 0!==e.opacity&&(i.opacity=e.opacity),void 0!==e.transparent&&(i.transparent=e.transparent),void 0!==e.alphaTest&&(i.alphaTest=e.alphaTest),void 0!==e.alphaHash&&(i.alphaHash=e.alphaHash),void 0!==e.depthTest&&(i.depthTest=e.depthTest),void 0!==e.depthWrite&&(i.depthWrite=e.depthWrite),void 0!==e.colorWrite&&(i.colorWrite=e.colorWrite),void 0!==e.stencilWrite&&(i.stencilWrite=e.stencilWrite),void 0!==e.stencilWriteMask&&(i.stencilWriteMask=e.stencilWriteMask),void 0!==e.stencilFunc&&(i.stencilFunc=e.stencilFunc),void 0!==e.stencilRef&&(i.stencilRef=e.stencilRef),void 0!==e.stencilFuncMask&&(i.stencilFuncMask=e.stencilFuncMask),void 0!==e.stencilFail&&(i.stencilFail=e.stencilFail),void 0!==e.stencilZFail&&(i.stencilZFail=e.stencilZFail),void 0!==e.stencilZPass&&(i.stencilZPass=e.stencilZPass),void 0!==e.wireframe&&(i.wireframe=e.wireframe),void 0!==e.wireframeLinewidth&&(i.wireframeLinewidth=e.wireframeLinewidth),void 0!==e.wireframeLinecap&&(i.wireframeLinecap=e.wireframeLinecap),void 0!==e.wireframeLinejoin&&(i.wireframeLinejoin=e.wireframeLinejoin),void 0!==e.rotation&&(i.rotation=e.rotation),1!==e.linewidth&&(i.linewidth=e.linewidth),void 0!==e.dashSize&&(i.dashSize=e.dashSize),void 0!==e.gapSize&&(i.gapSize=e.gapSize),void 0!==e.scale&&(i.scale=e.scale),void 0!==e.polygonOffset&&(i.polygonOffset=e.polygonOffset),void 0!==e.polygonOffsetFactor&&(i.polygonOffsetFactor=e.polygonOffsetFactor),void 0!==e.polygonOffsetUnits&&(i.polygonOffsetUnits=e.polygonOffsetUnits),void 0!==e.dithering&&(i.dithering=e.dithering),void 0!==e.alphaToCoverage&&(i.alphaToCoverage=e.alphaToCoverage),void 0!==e.premultipliedAlpha&&(i.premultipliedAlpha=e.premultipliedAlpha),void 0!==e.forceSinglePass&&(i.forceSinglePass=e.forceSinglePass),void 0!==e.visible&&(i.visible=e.visible),void 0!==e.toneMapped&&(i.toneMapped=e.toneMapped),void 0!==e.userData&&(i.userData=e.userData),void 0!==e.vertexColors&&("number"==typeof e.vertexColors?i.vertexColors=e.vertexColors>0:i.vertexColors=e.vertexColors),void 0!==e.uniforms)for(var a in e.uniforms){var o=e.uniforms[a];switch(i.uniforms[a]={},o.type){case"t":i.uniforms[a].value=r(o.value);break;case"c":i.uniforms[a].value=(new pa).setHex(o.value);break;case"v2":i.uniforms[a].value=(new mr).fromArray(o.value);break;case"v3":i.uniforms[a].value=(new Yr).fromArray(o.value);break;case"v4":i.uniforms[a].value=(new Br).fromArray(o.value);break;case"m3":i.uniforms[a].value=(new gr).fromArray(o.value);break;case"m4":i.uniforms[a].value=(new wi).fromArray(o.value);break;default:i.uniforms[a].value=o.value}}if(void 0!==e.defines&&(i.defines=e.defines),void 0!==e.vertexShader&&(i.vertexShader=e.vertexShader),void 0!==e.fragmentShader&&(i.fragmentShader=e.fragmentShader),void 0!==e.glslVersion&&(i.glslVersion=e.glslVersion),void 0!==e.extensions)for(var s in e.extensions)i.extensions[s]=e.extensions[s];if(void 0!==e.lights&&(i.lights=e.lights),void 0!==e.clipping&&(i.clipping=e.clipping),void 0!==e.size&&(i.size=e.size),void 0!==e.sizeAttenuation&&(i.sizeAttenuation=e.sizeAttenuation),void 0!==e.map&&(i.map=r(e.map)),void 0!==e.matcap&&(i.matcap=r(e.matcap)),void 0!==e.alphaMap&&(i.alphaMap=r(e.alphaMap)),void 0!==e.bumpMap&&(i.bumpMap=r(e.bumpMap)),void 0!==e.bumpScale&&(i.bumpScale=e.bumpScale),void 0!==e.normalMap&&(i.normalMap=r(e.normalMap)),void 0!==e.normalMapType&&(i.normalMapType=e.normalMapType),void 0!==e.normalScale){var u=e.normalScale;!1===Array.isArray(u)&&(u=[u,u]),i.normalScale=(new mr).fromArray(u)}return void 0!==e.displacementMap&&(i.displacementMap=r(e.displacementMap)),void 0!==e.displacementScale&&(i.displacementScale=e.displacementScale),void 0!==e.displacementBias&&(i.displacementBias=e.displacementBias),void 0!==e.roughnessMap&&(i.roughnessMap=r(e.roughnessMap)),void 0!==e.metalnessMap&&(i.metalnessMap=r(e.metalnessMap)),void 0!==e.emissiveMap&&(i.emissiveMap=r(e.emissiveMap)),void 0!==e.emissiveIntensity&&(i.emissiveIntensity=e.emissiveIntensity),void 0!==e.specularMap&&(i.specularMap=r(e.specularMap)),void 0!==e.specularIntensityMap&&(i.specularIntensityMap=r(e.specularIntensityMap)),void 0!==e.specularColorMap&&(i.specularColorMap=r(e.specularColorMap)),void 0!==e.envMap&&(i.envMap=r(e.envMap)),void 0!==e.envMapIntensity&&(i.envMapIntensity=e.envMapIntensity),void 0!==e.reflectivity&&(i.reflectivity=e.reflectivity),void 0!==e.refractionRatio&&(i.refractionRatio=e.refractionRatio),void 0!==e.lightMap&&(i.lightMap=r(e.lightMap)),void 0!==e.lightMapIntensity&&(i.lightMapIntensity=e.lightMapIntensity),void 0!==e.aoMap&&(i.aoMap=r(e.aoMap)),void 0!==e.aoMapIntensity&&(i.aoMapIntensity=e.aoMapIntensity),void 0!==e.gradientMap&&(i.gradientMap=r(e.gradientMap)),void 0!==e.clearcoatMap&&(i.clearcoatMap=r(e.clearcoatMap)),void 0!==e.clearcoatRoughnessMap&&(i.clearcoatRoughnessMap=r(e.clearcoatRoughnessMap)),void 0!==e.clearcoatNormalMap&&(i.clearcoatNormalMap=r(e.clearcoatNormalMap)),void 0!==e.clearcoatNormalScale&&(i.clearcoatNormalScale=(new mr).fromArray(e.clearcoatNormalScale)),void 0!==e.iridescenceMap&&(i.iridescenceMap=r(e.iridescenceMap)),void 0!==e.iridescenceThicknessMap&&(i.iridescenceThicknessMap=r(e.iridescenceThicknessMap)),void 0!==e.transmissionMap&&(i.transmissionMap=r(e.transmissionMap)),void 0!==e.thicknessMap&&(i.thicknessMap=r(e.thicknessMap)),void 0!==e.anisotropyMap&&(i.anisotropyMap=r(e.anisotropyMap)),void 0!==e.sheenColorMap&&(i.sheenColorMap=r(e.sheenColorMap)),void 0!==e.sheenRoughnessMap&&(i.sheenRoughnessMap=r(e.sheenRoughnessMap)),i}},{key:"setTextures",value:function(e){return this.textures=e,this}}],[{key:"createMaterialFromType",value:function(e){return new{ShadowMaterial:Qh,SpriteMaterial:ml,RawShaderMaterial:$h,ShaderMaterial:po,PointsMaterial:vc,MeshPhysicalMaterial:td,MeshStandardMaterial:ed,MeshPhongMaterial:nd,MeshToonMaterial:rd,MeshNormalMaterial:id,MeshLambertMaterial:ad,MeshDepthMaterial:Xu,MeshDistanceMaterial:qu,MeshBasicMaterial:ma,MeshMatcapMaterial:od,LineDashedMaterial:sd,LineBasicMaterial:ic,Material:la}[e]}}]),n}(Pd),cf=function(){function e(){a(this,e)}return s(e,null,[{key:"decodeText",value:function(e){if("undefined"!=typeof TextDecoder)return(new TextDecoder).decode(e);for(var t="",n=0,r=e.length;n<r;n++)t+=String.fromCharCode(e[n]);try{return decodeURIComponent(escape(t))}catch(e){return t}}},{key:"extractUrlBase",value:function(e){var t=e.lastIndexOf("/");return-1===t?"./":e.slice(0,t+1)}},{key:"resolveURL",value:function(e,t){return"string"!=typeof e||""===e?"":(/^https?:\/\//i.test(t)&&/^\//.test(e)&&(t=t.replace(/(^https?:\/\/[^\/]+).*/i,"$1")),/^(https?:)?\/\//i.test(e)||/^data:.*,.*$/i.test(e)||/^blob:.*$/i.test(e)?e:t+e)}}]),e}(),hf=function(e){w(n,e);var t=E(n);function n(){var e;return a(this,n),(e=t.call(this)).isInstancedBufferGeometry=!0,e.type="InstancedBufferGeometry",e.instanceCount=1/0,e}return s(n,[{key:"copy",value:function(e){return y(x(n.prototype),"copy",this).call(this,e),this.instanceCount=e.instanceCount,this}},{key:"toJSON",value:function(){var e=y(x(n.prototype),"toJSON",this).call(this);return e.instanceCount=this.instanceCount,e.isInstancedBufferGeometry=!0,e}}]),n}(Ga),df=function(e){w(n,e);var t=E(n);function n(e){return a(this,n),t.call(this,e)}return s(n,[{key:"load",value:function(e,t,n,r){var i=this,a=new Od(i.manager);a.setPath(i.path),a.setRequestHeader(i.requestHeader),a.setWithCredentials(i.withCredentials),a.load(e,(function(n){try{t(i.parse(JSON.parse(n)))}catch(t){r?r(t):console.error(t),i.manager.itemError(e)}}),n,r)}},{key:"parse",value:function(e){var t={},n={};function r(e,r){if(void 0!==t[r])return t[r];var i=e.interleavedBuffers[r],a=function(e,t){if(void 0!==n[t])return n[t];var r=e.arrayBuffers,i=r[t],a=new Uint32Array(i).buffer;return n[t]=a,a}(e,i.buffer),o=Mr(i.type,a),s=new fl(o,i.stride);return s.uuid=i.uuid,t[r]=s,s}var i=e.isInstancedBufferGeometry?new hf:new Ga,a=e.data.index;if(void 0!==a){var o=Mr(a.type,a.array);i.setIndex(new wa(o,1))}var s=e.data.attributes;for(var u in s){var l=s[u],c=void 0;if(l.isInterleavedBufferAttribute){var h=r(e.data,l.data);c=new vl(h,l.itemSize,l.offset,l.normalized)}else{var d=Mr(l.type,l.array);c=new(l.isInstancedBufferAttribute?Zl:wa)(d,l.itemSize,l.normalized)}void 0!==l.name&&(c.name=l.name),void 0!==l.usage&&c.setUsage(l.usage),void 0!==l.updateRange&&(c.updateRange.offset=l.updateRange.offset,c.updateRange.count=l.updateRange.count),i.setAttribute(u,c)}var f=e.data.morphAttributes;if(f)for(var p in f){for(var v=f[p],m=[],g=0,y=v.length;g<y;g++){var _=v[g],x=void 0;if(_.isInterleavedBufferAttribute){var M=r(e.data,_.data);x=new vl(M,_.itemSize,_.offset,_.normalized)}else{var S=Mr(_.type,_.array);x=new wa(S,_.itemSize,_.normalized)}void 0!==_.name&&(x.name=_.name),m.push(x)}i.morphAttributes[p]=m}e.data.morphTargetsRelative&&(i.morphTargetsRelative=!0);var b=e.data.groups||e.data.drawcalls||e.data.offsets;if(void 0!==b)for(var w=0,T=b.length;w!==T;++w){var E=b[w];i.addGroup(E.start,E.count,E.materialIndex)}var A=e.data.boundingSphere;if(void 0!==A){var R=new Yr;void 0!==A.center&&R.fromArray(A.center),i.boundingSphere=new vi(R,A.radius)}return e.name&&(i.name=e.name),e.userData&&(i.userData=e.userData),i}}]),n}(Pd),ff=function(e){w(o,e);var t,n,r,i=E(o);function o(e){return a(this,o),i.call(this,e)}return s(o,[{key:"load",value:function(e,t,n,r){var i=this,a=""===this.path?cf.extractUrlBase(e):this.path;this.resourcePath=this.resourcePath||a;var o=new Od(this.manager);o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(e,(function(n){var a=null;try{a=JSON.parse(n)}catch(t){return void 0!==r&&r(t),void console.error("THREE:ObjectLoader: Can't parse "+e+".",t.message)}var o=a.metadata;if(void 0===o||void 0===o.type||"geometry"===o.type.toLowerCase())return void 0!==r&&r(new Error("THREE.ObjectLoader: Can't load "+e)),void console.error("THREE.ObjectLoader: Can't load "+e);i.parse(a,t)}),n,r)}},{key:"loadAsync",value:(r=p(R().mark((function e(t,n){var r,i,a,o,s,u;return R().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=this,i=""===this.path?cf.extractUrlBase(t):this.path,this.resourcePath=this.resourcePath||i,(a=new Od(this.manager)).setPath(this.path),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),e.next=9,a.loadAsync(t,n);case 9:if(o=e.sent,s=JSON.parse(o),void 0!==(u=s.metadata)&&void 0!==u.type&&"geometry"!==u.type.toLowerCase()){e.next=14;break}throw new Error("THREE.ObjectLoader: Can't load "+t);case 14:return e.next=16,r.parseAsync(s);case 16:return e.abrupt("return",e.sent);case 17:case"end":return e.stop()}}),e,this)}))),function(e,t){return r.apply(this,arguments)})},{key:"parse",value:function(e,t){var n=this.parseAnimations(e.animations),r=this.parseShapes(e.shapes),i=this.parseGeometries(e.geometries,r),a=this.parseImages(e.images,(function(){void 0!==t&&t(u)})),o=this.parseTextures(e.textures,a),s=this.parseMaterials(e.materials,o),u=this.parseObject(e.object,i,s,o,n),l=this.parseSkeletons(e.skeletons,u);if(this.bindSkeletons(u,l),void 0!==t){var c=!1;for(var h in a)if(a[h].data instanceof HTMLImageElement){c=!0;break}!1===c&&t(u)}return u}},{key:"parseAsync",value:(n=p(R().mark((function e(t){var n,r,i,a,o,s,u,l;return R().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=this.parseAnimations(t.animations),r=this.parseShapes(t.shapes),i=this.parseGeometries(t.geometries,r),e.next=5,this.parseImagesAsync(t.images);case 5:return a=e.sent,o=this.parseTextures(t.textures,a),s=this.parseMaterials(t.materials,o),u=this.parseObject(t.object,i,s,o,n),l=this.parseSkeletons(t.skeletons,u),this.bindSkeletons(u,l),e.abrupt("return",u);case 12:case"end":return e.stop()}}),e,this)}))),function(e){return n.apply(this,arguments)})},{key:"parseShapes",value:function(e){var t={};if(void 0!==e)for(var n=0,r=e.length;n<r;n++){var i=(new uh).fromJSON(e[n]);t[i.uuid]=i}return t}},{key:"parseSkeletons",value:function(e,t){var n={},r={};if(t.traverse((function(e){e.isBone&&(r[e.uuid]=e)})),void 0!==e)for(var i=0,a=e.length;i<a;i++){var o=(new Yl).fromJSON(e[i],r);n[o.uuid]=o}return n}},{key:"parseGeometries",value:function(e,t){var n={};if(void 0!==e)for(var r=new df,i=0,a=e.length;i<a;i++){var o=void 0,s=e[i];switch(s.type){case"BufferGeometry":case"InstancedBufferGeometry":o=r.parse(s);break;default:s.type in Jh?o=Jh[s.type].fromJSON(s,t):console.warn('THREE.ObjectLoader: Unsupported geometry type "'.concat(s.type,'"'))}o.uuid=s.uuid,void 0!==s.name&&(o.name=s.name),void 0!==s.userData&&(o.userData=s.userData),n[s.uuid]=o}return n}},{key:"parseMaterials",value:function(e,t){var n={},r={};if(void 0!==e){var i=new lf;i.setTextures(t);for(var a=0,o=e.length;a<o;a++){var s=e[a];void 0===n[s.uuid]&&(n[s.uuid]=i.parse(s)),r[s.uuid]=n[s.uuid]}}return r}},{key:"parseAnimations",value:function(e){var t={};if(void 0!==e)for(var n=0;n<e.length;n++){var r=e[n],i=Ad.parse(r);t[i.uuid]=i}return t}},{key:"parseImages",value:function(e,t){var n,r=this,i={};function a(e){if("string"==typeof e){var t=e;return function(e){return r.manager.itemStart(e),n.load(e,(function(){r.manager.itemEnd(e)}),void 0,(function(){r.manager.itemError(e),r.manager.itemEnd(e)}))}(/^(\/\/)|([a-z]+:(\/\/)?)/i.test(t)?t:r.resourcePath+t)}return e.data?{data:Mr(e.type,e.data),width:e.width,height:e.height}:null}if(void 0!==e&&e.length>0){var o=new Cd(t);(n=new Bd(o)).setCrossOrigin(this.crossOrigin);for(var s=0,u=e.length;s<u;s++){var l=e[s],c=l.url;if(Array.isArray(c)){for(var h=[],d=0,f=c.length;d<f;d++){var p=a(c[d]);null!==p&&(p instanceof HTMLImageElement?h.push(p):h.push(new jl(p.data,p.width,p.height)))}i[l.uuid]=new Ur(h)}else{var v=a(l.url);i[l.uuid]=new Ur(v)}}}return i}},{key:"parseImagesAsync",value:(t=p(R().mark((function e(t){var n,r,i,a,o,s,u,l,c,h,d,f,v,m,g;return R().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(o=function(){return o=p(R().mark((function e(t){var r,a;return R().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if("string"!=typeof t){e.next=8;break}return a=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(r=t)?r:n.resourcePath+r,e.next=5,i.loadAsync(a);case 5:return e.abrupt("return",e.sent);case 8:if(!t.data){e.next=12;break}return e.abrupt("return",{data:Mr(t.type,t.data),width:t.width,height:t.height});case 12:return e.abrupt("return",null);case 13:case"end":return e.stop()}}),e)}))),o.apply(this,arguments)},a=function(e){return o.apply(this,arguments)},n=this,r={},!(void 0!==t&&t.length>0)){e.next=33;break}(i=new Bd(this.manager)).setCrossOrigin(this.crossOrigin),s=0,u=t.length;case 8:if(!(s<u)){e.next=33;break}if(l=t[s],c=l.url,!Array.isArray(c)){e.next=26;break}h=[],d=0,f=c.length;case 14:if(!(d<f)){e.next=23;break}return v=c[d],e.next=18,a(v);case 18:null!==(m=e.sent)&&(m instanceof HTMLImageElement?h.push(m):h.push(new jl(m.data,m.width,m.height)));case 20:d++,e.next=14;break;case 23:r[l.uuid]=new Ur(h),e.next=30;break;case 26:return e.next=28,a(l.url);case 28:g=e.sent,r[l.uuid]=new Ur(g);case 30:s++,e.next=8;break;case 33:return e.abrupt("return",r);case 34:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})},{key:"parseTextures",value:function(e,t){function n(e,t){return"number"==typeof e?e:(console.warn("THREE.ObjectLoader.parseTexture: Constant should be in numeric form.",e),t[e])}var r={};if(void 0!==e)for(var i=0,a=e.length;i<a;i++){var o=e[i];void 0===o.image&&console.warn('THREE.ObjectLoader: No "image" specified for',o.uuid),void 0===t[o.image]&&console.warn("THREE.ObjectLoader: Undefined image",o.image);var s=t[o.image],u=s.data,l=void 0;Array.isArray(u)?(l=new _o,6===u.length&&(l.needsUpdate=!0)):(l=u&&u.data?new jl:new Fr,u&&(l.needsUpdate=!0)),l.source=s,l.uuid=o.uuid,void 0!==o.name&&(l.name=o.name),void 0!==o.mapping&&(l.mapping=n(o.mapping,pf)),void 0!==o.channel&&(l.channel=o.channel),void 0!==o.offset&&l.offset.fromArray(o.offset),void 0!==o.repeat&&l.repeat.fromArray(o.repeat),void 0!==o.center&&l.center.fromArray(o.center),void 0!==o.rotation&&(l.rotation=o.rotation),void 0!==o.wrap&&(l.wrapS=n(o.wrap[0],vf),l.wrapT=n(o.wrap[1],vf)),void 0!==o.format&&(l.format=o.format),void 0!==o.internalFormat&&(l.internalFormat=o.internalFormat),void 0!==o.type&&(l.type=o.type),void 0!==o.colorSpace&&(l.colorSpace=o.colorSpace),void 0!==o.encoding&&(l.encoding=o.encoding),void 0!==o.minFilter&&(l.minFilter=n(o.minFilter,mf)),void 0!==o.magFilter&&(l.magFilter=n(o.magFilter,mf)),void 0!==o.anisotropy&&(l.anisotropy=o.anisotropy),void 0!==o.flipY&&(l.flipY=o.flipY),void 0!==o.generateMipmaps&&(l.generateMipmaps=o.generateMipmaps),void 0!==o.premultiplyAlpha&&(l.premultiplyAlpha=o.premultiplyAlpha),void 0!==o.unpackAlignment&&(l.unpackAlignment=o.unpackAlignment),void 0!==o.compareFunction&&(l.compareFunction=o.compareFunction),void 0!==o.userData&&(l.userData=o.userData),r[o.uuid]=l}return r}},{key:"parseObject",value:function(e,t,n,r,i){var a,o,s;function u(e){return void 0===t[e]&&console.warn("THREE.ObjectLoader: Undefined geometry",e),t[e]}function l(e){if(void 0!==e){if(Array.isArray(e)){for(var t=[],r=0,i=e.length;r<i;r++){var a=e[r];void 0===n[a]&&console.warn("THREE.ObjectLoader: Undefined material",a),t.push(n[a])}return t}return void 0===n[e]&&console.warn("THREE.ObjectLoader: Undefined material",e),n[e]}}function c(e){return void 0===r[e]&&console.warn("THREE.ObjectLoader: Undefined texture",e),r[e]}switch(e.type){case"Scene":a=new dl,void 0!==e.background&&(Number.isInteger(e.background)?a.background=new pa(e.background):a.background=c(e.background)),void 0!==e.environment&&(a.environment=c(e.environment)),void 0!==e.fog&&("Fog"===e.fog.type?a.fog=new hl(e.fog.color,e.fog.near,e.fog.far):"FogExp2"===e.fog.type&&(a.fog=new cl(e.fog.color,e.fog.density))),void 0!==e.backgroundBlurriness&&(a.backgroundBlurriness=e.backgroundBlurriness),void 0!==e.backgroundIntensity&&(a.backgroundIntensity=e.backgroundIntensity);break;case"PerspectiveCamera":a=new mo(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 Ho(e.left,e.right,e.top,e.bottom,e.near,e.far),void 0!==e.zoom&&(a.zoom=e.zoom),void 0!==e.view&&(a.view=Object.assign({},e.view));break;case"AmbientLight":a=new af(e.color,e.intensity);break;case"DirectionalLight":a=new rf(e.color,e.intensity);break;case"PointLight":a=new tf(e.color,e.intensity,e.distance,e.decay);break;case"RectAreaLight":a=new of(e.color,e.intensity,e.width,e.height);break;case"SpotLight":a=new Kd(e.color,e.intensity,e.distance,e.angle,e.penumbra,e.decay);break;case"HemisphereLight":a=new Wd(e.color,e.groundColor,e.intensity);break;case"LightProbe":a=(new uf).fromJSON(e);break;case"SkinnedMesh":o=u(e.geometry),s=l(e.material),a=new Vl(o,s),void 0!==e.bindMode&&(a.bindMode=e.bindMode),void 0!==e.bindMatrix&&a.bindMatrix.fromArray(e.bindMatrix),void 0!==e.skeleton&&(a.skeleton=e.skeleton);break;case"Mesh":o=u(e.geometry),s=l(e.material),a=new oo(o,s);break;case"InstancedMesh":o=u(e.geometry),s=l(e.material);var h=e.count,d=e.instanceMatrix,f=e.instanceColor;(a=new rc(o,s,h)).instanceMatrix=new Zl(new Float32Array(d.array),16),void 0!==f&&(a.instanceColor=new Zl(new Float32Array(f.array),f.itemSize));break;case"LOD":a=new Il;break;case"Line":a=new cc(u(e.geometry),l(e.material));break;case"LineLoop":a=new pc(u(e.geometry),l(e.material));break;case"LineSegments":a=new fc(u(e.geometry),l(e.material));break;case"PointCloud":case"Points":a=new xc(u(e.geometry),l(e.material));break;case"Sprite":a=new kl(l(e.material));break;case"Group":a=new $u;break;case"Bone":a=new Wl;break;default:a=new Zi}if(a.uuid=e.uuid,void 0!==e.name&&(a.name=e.name),void 0!==e.matrix?(a.matrix.fromArray(e.matrix),void 0!==e.matrixAutoUpdate&&(a.matrixAutoUpdate=e.matrixAutoUpdate),a.matrixAutoUpdate&&a.matrix.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.up&&a.up.fromArray(e.up),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.normalBias&&(a.shadow.normalBias=e.shadow.normalBias),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.frustumCulled&&(a.frustumCulled=e.frustumCulled),void 0!==e.renderOrder&&(a.renderOrder=e.renderOrder),void 0!==e.userData&&(a.userData=e.userData),void 0!==e.layers&&(a.layers.mask=e.layers),void 0!==e.children)for(var p=e.children,v=0;v<p.length;v++)a.add(this.parseObject(p[v],t,n,r,i));if(void 0!==e.animations)for(var m=e.animations,g=0;g<m.length;g++){var y=m[g];a.animations.push(i[y])}if("LOD"===e.type){void 0!==e.autoUpdate&&(a.autoUpdate=e.autoUpdate);for(var _=e.levels,x=0;x<_.length;x++){var M=_[x],S=a.getObjectByProperty("uuid",M.object);void 0!==S&&a.addLevel(S,M.distance,M.hysteresis)}}return a}},{key:"bindSkeletons",value:function(e,t){0!==Object.keys(t).length&&e.traverse((function(e){if(!0===e.isSkinnedMesh&&void 0!==e.skeleton){var n=t[e.skeleton];void 0===n?console.warn("THREE.ObjectLoader: No skeleton found with UUID:",e.skeleton):e.bind(n,e.bindMatrix)}}))}}]),o}(Pd),pf={UVMapping:ke,CubeReflectionMapping:Ce,CubeRefractionMapping:Le,EquirectangularReflectionMapping:Pe,EquirectangularRefractionMapping:Ie,CubeUVReflectionMapping:De},vf={RepeatWrapping:Ue,ClampToEdgeWrapping:Oe,MirroredRepeatWrapping:Ne},mf={NearestFilter:Fe,NearestMipmapNearestFilter:Be,NearestMipmapLinearFilter:He,LinearFilter:Ve,LinearMipmapNearestFilter:We,LinearMipmapLinearFilter:Xe},gf=function(e){w(n,e);var t=E(n);function n(e){var r;return a(this,n),(r=t.call(this,e)).isImageBitmapLoader=!0,"undefined"==typeof createImageBitmap&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."),"undefined"==typeof fetch&&console.warn("THREE.ImageBitmapLoader: fetch() not supported."),r.options={premultiplyAlpha:"none"},r}return s(n,[{key:"setOptions",value:function(e){return this.options=e,this}},{key:"load",value:function(e,t,n,r){void 0===e&&(e=""),void 0!==this.path&&(e=this.path+e),e=this.manager.resolveURL(e);var i=this,a=kd.get(e);if(void 0!==a)return i.manager.itemStart(e),setTimeout((function(){t&&t(a),i.manager.itemEnd(e)}),0),a;var o={};o.credentials="anonymous"===this.crossOrigin?"same-origin":"include",o.headers=this.requestHeader,fetch(e,o).then((function(e){return e.blob()})).then((function(e){return createImageBitmap(e,Object.assign(i.options,{colorSpaceConversion:"none"}))})).then((function(n){kd.add(e,n),t&&t(n),i.manager.itemEnd(e)})).catch((function(t){r&&r(t),i.manager.itemError(e),i.manager.itemEnd(e)})),i.manager.itemStart(e)}}]),n}(Pd),yf=function(){function e(){a(this,e)}return s(e,null,[{key:"getContext",value:function(){return void 0===Id&&(Id=new(window.AudioContext||window.webkitAudioContext)),Id}},{key:"setContext",value:function(e){Id=e}}]),e}(),_f=function(e){w(n,e);var t=E(n);function n(e){return a(this,n),t.call(this,e)}return s(n,[{key:"load",value:function(e,t,n,r){var i=this,a=new Od(this.manager);function o(t){r?r(t):console.error(t),i.manager.itemError(e)}a.setResponseType("arraybuffer"),a.setPath(this.path),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(e,(function(e){try{var n=e.slice(0);yf.getContext().decodeAudioData(n,(function(e){t(e)}),o)}catch(e){o(e)}}),n,r)}}]),n}(Pd),xf=function(e){w(n,e);var t=E(n);function n(e,r){var i,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;a(this,n),(i=t.call(this,void 0,o)).isHemisphereLightProbe=!0;var s=(new pa).set(e),u=(new pa).set(r),l=new Yr(s.r,s.g,s.b),c=new Yr(u.r,u.g,u.b),h=Math.sqrt(Math.PI),d=h*Math.sqrt(.75);return i.sh.coefficients[0].copy(l).add(c).multiplyScalar(h),i.sh.coefficients[1].copy(l).sub(c).multiplyScalar(d),i}return s(n)}(uf),Mf=function(e){w(n,e);var t=E(n);function n(e){var r,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;a(this,n),(r=t.call(this,void 0,i)).isAmbientLightProbe=!0;var o=(new pa).set(e);return r.sh.coefficients[0].set(o.r,o.g,o.b).multiplyScalar(2*Math.sqrt(Math.PI)),r}return s(n)}(uf),Sf=new wi,bf=new wi,wf=new wi,Tf=function(){function e(){a(this,e),this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new mo,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new mo,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1,this._cache={focus:null,fov:null,aspect:null,near:null,far:null,zoom:null,eyeSep:null}}return s(e,[{key:"update",value:function(e){var t=this._cache;if(t.focus!==e.focus||t.fov!==e.fov||t.aspect!==e.aspect*this.aspect||t.near!==e.near||t.far!==e.far||t.zoom!==e.zoom||t.eyeSep!==this.eyeSep){t.focus=e.focus,t.fov=e.fov,t.aspect=e.aspect*this.aspect,t.near=e.near,t.far=e.far,t.zoom=e.zoom,t.eyeSep=this.eyeSep,wf.copy(e.projectionMatrix);var n,r,i=t.eyeSep/2,a=i*t.near/t.focus,o=t.near*Math.tan(ir*t.fov*.5)/t.zoom;bf.elements[12]=-i,Sf.elements[12]=i,n=-o*t.aspect+a,r=o*t.aspect+a,wf.elements[0]=2*t.near/(r-n),wf.elements[8]=(r+n)/(r-n),this.cameraL.projectionMatrix.copy(wf),n=-o*t.aspect-a,r=o*t.aspect-a,wf.elements[0]=2*t.near/(r-n),wf.elements[8]=(r+n)/(r-n),this.cameraR.projectionMatrix.copy(wf)}this.cameraL.matrixWorld.copy(e.matrixWorld).multiply(bf),this.cameraR.matrixWorld.copy(e.matrixWorld).multiply(Sf)}}]),e}(),Ef=function(){function e(){var t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];a(this,e),this.autoStart=t,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}return s(e,[{key:"start",value:function(){this.startTime=Af(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0}},{key:"stop",value:function(){this.getElapsedTime(),this.running=!1,this.autoStart=!1}},{key:"getElapsedTime",value:function(){return this.getDelta(),this.elapsedTime}},{key:"getDelta",value:function(){var e=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){var t=Af();e=(t-this.oldTime)/1e3,this.oldTime=t,this.elapsedTime+=e}return e}}]),e}();function Af(){return("undefined"==typeof performance?Date:performance).now()}var Rf=new Yr,kf=new qr,Cf=new Yr,Lf=new Yr,Pf=function(e){w(n,e);var t=E(n);function n(){var e;return a(this,n),(e=t.call(this)).type="AudioListener",e.context=yf.getContext(),e.gain=e.context.createGain(),e.gain.connect(e.context.destination),e.filter=null,e.timeDelta=0,e._clock=new Ef,e}return s(n,[{key:"getInput",value:function(){return this.gain}},{key:"removeFilter",value:function(){return null!==this.filter&&(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination),this.gain.connect(this.context.destination),this.filter=null),this}},{key:"getFilter",value:function(){return this.filter}},{key:"setFilter",value:function(e){return null!==this.filter?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination),this.filter=e,this.gain.connect(this.filter),this.filter.connect(this.context.destination),this}},{key:"getMasterVolume",value:function(){return this.gain.gain.value}},{key:"setMasterVolume",value:function(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this}},{key:"updateMatrixWorld",value:function(e){y(x(n.prototype),"updateMatrixWorld",this).call(this,e);var t=this.context.listener,r=this.up;if(this.timeDelta=this._clock.getDelta(),this.matrixWorld.decompose(Rf,kf,Cf),Lf.set(0,0,-1).applyQuaternion(kf),t.positionX){var i=this.context.currentTime+this.timeDelta;t.positionX.linearRampToValueAtTime(Rf.x,i),t.positionY.linearRampToValueAtTime(Rf.y,i),t.positionZ.linearRampToValueAtTime(Rf.z,i),t.forwardX.linearRampToValueAtTime(Lf.x,i),t.forwardY.linearRampToValueAtTime(Lf.y,i),t.forwardZ.linearRampToValueAtTime(Lf.z,i),t.upX.linearRampToValueAtTime(r.x,i),t.upY.linearRampToValueAtTime(r.y,i),t.upZ.linearRampToValueAtTime(r.z,i)}else t.setPosition(Rf.x,Rf.y,Rf.z),t.setOrientation(Lf.x,Lf.y,Lf.z,r.x,r.y,r.z)}}]),n}(Zi),If=function(e){w(n,e);var t=E(n);function n(e){var r;return a(this,n),(r=t.call(this)).type="Audio",r.listener=e,r.context=e.context,r.gain=r.context.createGain(),r.gain.connect(e.getInput()),r.autoplay=!1,r.buffer=null,r.detune=0,r.loop=!1,r.loopStart=0,r.loopEnd=0,r.offset=0,r.duration=void 0,r.playbackRate=1,r.isPlaying=!1,r.hasPlaybackControl=!0,r.source=null,r.sourceType="empty",r._startedAt=0,r._progress=0,r._connected=!1,r.filters=[],r}return s(n,[{key:"getOutput",value:function(){return this.gain}},{key:"setNodeSource",value:function(e){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=e,this.connect(),this}},{key:"setMediaElementSource",value:function(e){return this.hasPlaybackControl=!1,this.sourceType="mediaNode",this.source=this.context.createMediaElementSource(e),this.connect(),this}},{key:"setMediaStreamSource",value:function(e){return this.hasPlaybackControl=!1,this.sourceType="mediaStreamNode",this.source=this.context.createMediaStreamSource(e),this.connect(),this}},{key:"setBuffer",value:function(e){return this.buffer=e,this.sourceType="buffer",this.autoplay&&this.play(),this}},{key:"play",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;if(!0!==this.isPlaying){if(!1!==this.hasPlaybackControl){this._startedAt=this.context.currentTime+e;var t=this.context.createBufferSource();return t.buffer=this.buffer,t.loop=this.loop,t.loopStart=this.loopStart,t.loopEnd=this.loopEnd,t.onended=this.onEnded.bind(this),t.start(this._startedAt,this._progress+this.offset,this.duration),this.isPlaying=!0,this.source=t,this.setDetune(this.detune),this.setPlaybackRate(this.playbackRate),this.connect()}console.warn("THREE.Audio: this Audio has no playback control.")}else console.warn("THREE.Audio: Audio is already playing.")}},{key:"pause",value:function(){if(!1!==this.hasPlaybackControl)return!0===this.isPlaying&&(this._progress+=Math.max(this.context.currentTime-this._startedAt,0)*this.playbackRate,!0===this.loop&&(this._progress=this._progress%(this.duration||this.buffer.duration)),this.source.stop(),this.source.onended=null,this.isPlaying=!1),this;console.warn("THREE.Audio: this Audio has no playback control.")}},{key:"stop",value:function(){if(!1!==this.hasPlaybackControl)return this._progress=0,null!==this.source&&(this.source.stop(),this.source.onended=null),this.isPlaying=!1,this;console.warn("THREE.Audio: this Audio has no playback control.")}},{key:"connect",value:function(){if(this.filters.length>0){this.source.connect(this.filters[0]);for(var e=1,t=this.filters.length;e<t;e++)this.filters[e-1].connect(this.filters[e]);this.filters[this.filters.length-1].connect(this.getOutput())}else this.source.connect(this.getOutput());return this._connected=!0,this}},{key:"disconnect",value:function(){if(this.filters.length>0){this.source.disconnect(this.filters[0]);for(var e=1,t=this.filters.length;e<t;e++)this.filters[e-1].disconnect(this.filters[e]);this.filters[this.filters.length-1].disconnect(this.getOutput())}else this.source.disconnect(this.getOutput());return this._connected=!1,this}},{key:"getFilters",value:function(){return this.filters}},{key:"setFilters",value:function(e){return e||(e=[]),!0===this._connected?(this.disconnect(),this.filters=e.slice(),this.connect()):this.filters=e.slice(),this}},{key:"setDetune",value:function(e){if(this.detune=e,void 0!==this.source.detune)return!0===this.isPlaying&&this.source.detune.setTargetAtTime(this.detune,this.context.currentTime,.01),this}},{key:"getDetune",value:function(){return this.detune}},{key:"getFilter",value:function(){return this.getFilters()[0]}},{key:"setFilter",value:function(e){return this.setFilters(e?[e]:[])}},{key:"setPlaybackRate",value:function(e){if(!1!==this.hasPlaybackControl)return this.playbackRate=e,!0===this.isPlaying&&this.source.playbackRate.setTargetAtTime(this.playbackRate,this.context.currentTime,.01),this;console.warn("THREE.Audio: this Audio has no playback control.")}},{key:"getPlaybackRate",value:function(){return this.playbackRate}},{key:"onEnded",value:function(){this.isPlaying=!1}},{key:"getLoop",value:function(){return!1===this.hasPlaybackControl?(console.warn("THREE.Audio: this Audio has no playback control."),!1):this.loop}},{key:"setLoop",value:function(e){if(!1!==this.hasPlaybackControl)return this.loop=e,!0===this.isPlaying&&(this.source.loop=this.loop),this;console.warn("THREE.Audio: this Audio has no playback control.")}},{key:"setLoopStart",value:function(e){return this.loopStart=e,this}},{key:"setLoopEnd",value:function(e){return this.loopEnd=e,this}},{key:"getVolume",value:function(){return this.gain.gain.value}},{key:"setVolume",value:function(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this}}]),n}(Zi),Df=new Yr,Uf=new qr,Of=new Yr,Nf=new Yr,Ff=function(e){w(n,e);var t=E(n);function n(e){var r;return a(this,n),(r=t.call(this,e)).panner=r.context.createPanner(),r.panner.panningModel="HRTF",r.panner.connect(r.gain),r}return s(n,[{key:"connect",value:function(){y(x(n.prototype),"connect",this).call(this),this.panner.connect(this.gain)}},{key:"disconnect",value:function(){y(x(n.prototype),"disconnect",this).call(this),this.panner.disconnect(this.gain)}},{key:"getOutput",value:function(){return this.panner}},{key:"getRefDistance",value:function(){return this.panner.refDistance}},{key:"setRefDistance",value:function(e){return this.panner.refDistance=e,this}},{key:"getRolloffFactor",value:function(){return this.panner.rolloffFactor}},{key:"setRolloffFactor",value:function(e){return this.panner.rolloffFactor=e,this}},{key:"getDistanceModel",value:function(){return this.panner.distanceModel}},{key:"setDistanceModel",value:function(e){return this.panner.distanceModel=e,this}},{key:"getMaxDistance",value:function(){return this.panner.maxDistance}},{key:"setMaxDistance",value:function(e){return this.panner.maxDistance=e,this}},{key:"setDirectionalCone",value:function(e,t,n){return this.panner.coneInnerAngle=e,this.panner.coneOuterAngle=t,this.panner.coneOuterGain=n,this}},{key:"updateMatrixWorld",value:function(e){if(y(x(n.prototype),"updateMatrixWorld",this).call(this,e),!0!==this.hasPlaybackControl||!1!==this.isPlaying){this.matrixWorld.decompose(Df,Uf,Of),Nf.set(0,0,1).applyQuaternion(Uf);var t=this.panner;if(t.positionX){var r=this.context.currentTime+this.listener.timeDelta;t.positionX.linearRampToValueAtTime(Df.x,r),t.positionY.linearRampToValueAtTime(Df.y,r),t.positionZ.linearRampToValueAtTime(Df.z,r),t.orientationX.linearRampToValueAtTime(Nf.x,r),t.orientationY.linearRampToValueAtTime(Nf.y,r),t.orientationZ.linearRampToValueAtTime(Nf.z,r)}else t.setPosition(Df.x,Df.y,Df.z),t.setOrientation(Nf.x,Nf.y,Nf.z)}}}]),n}(If),Bf=function(){function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2048;a(this,e),this.analyser=t.context.createAnalyser(),this.analyser.fftSize=n,this.data=new Uint8Array(this.analyser.frequencyBinCount),t.getOutput().connect(this.analyser)}return s(e,[{key:"getFrequencyData",value:function(){return this.analyser.getByteFrequencyData(this.data),this.data}},{key:"getAverageFrequency",value:function(){for(var e=0,t=this.getFrequencyData(),n=0;n<t.length;n++)e+=t[n];return e/t.length}}]),e}(),zf=function(){function e(t,n,r){var i,o,s;switch(a(this,e),this.binding=t,this.valueSize=r,n){case"quaternion":i=this._slerp,o=this._slerpAdditive,s=this._setAdditiveIdentityQuaternion,this.buffer=new Float64Array(6*r),this._workIndex=5;break;case"string":case"bool":i=this._select,o=this._select,s=this._setAdditiveIdentityOther,this.buffer=new Array(5*r);break;default:i=this._lerp,o=this._lerpAdditive,s=this._setAdditiveIdentityNumeric,this.buffer=new Float64Array(5*r)}this._mixBufferRegion=i,this._mixBufferRegionAdditive=o,this._setIdentity=s,this._origIndex=3,this._addIndex=4,this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,this.useCount=0,this.referenceCount=0}return s(e,[{key:"accumulate",value:function(e,t){var n=this.buffer,r=this.valueSize,i=e*r+r,a=this.cumulativeWeight;if(0===a){for(var o=0;o!==r;++o)n[i+o]=n[o];a=t}else{var s=t/(a+=t);this._mixBufferRegion(n,i,0,s,r)}this.cumulativeWeight=a}},{key:"accumulateAdditive",value:function(e){var t=this.buffer,n=this.valueSize,r=n*this._addIndex;0===this.cumulativeWeightAdditive&&this._setIdentity(),this._mixBufferRegionAdditive(t,r,0,e,n),this.cumulativeWeightAdditive+=e}},{key:"apply",value:function(e){var t=this.valueSize,n=this.buffer,r=e*t+t,i=this.cumulativeWeight,a=this.cumulativeWeightAdditive,o=this.binding;if(this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,i<1){var s=t*this._origIndex;this._mixBufferRegion(n,r,s,1-i,t)}a>0&&this._mixBufferRegionAdditive(n,r,this._addIndex*t,1,t);for(var u=t,l=t+t;u!==l;++u)if(n[u]!==n[u+t]){o.setValue(n,r);break}}},{key:"saveOriginalState",value:function(){var e=this.binding,t=this.buffer,n=this.valueSize,r=n*this._origIndex;e.getValue(t,r);for(var i=n,a=r;i!==a;++i)t[i]=t[r+i%n];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}},{key:"restoreOriginalState",value:function(){var e=3*this.valueSize;this.binding.setValue(this.buffer,e)}},{key:"_setAdditiveIdentityNumeric",value:function(){for(var e=this._addIndex*this.valueSize,t=e+this.valueSize,n=e;n<t;n++)this.buffer[n]=0}},{key:"_setAdditiveIdentityQuaternion",value:function(){this._setAdditiveIdentityNumeric(),this.buffer[this._addIndex*this.valueSize+3]=1}},{key:"_setAdditiveIdentityOther",value:function(){for(var e=this._origIndex*this.valueSize,t=this._addIndex*this.valueSize,n=0;n<this.valueSize;n++)this.buffer[t+n]=this.buffer[e+n]}},{key:"_select",value:function(e,t,n,r,i){if(r>=.5)for(var a=0;a!==i;++a)e[t+a]=e[n+a]}},{key:"_slerp",value:function(e,t,n,r){qr.slerpFlat(e,t,e,t,e,n,r)}},{key:"_slerpAdditive",value:function(e,t,n,r,i){var a=this._workIndex*i;qr.multiplyQuaternionsFlat(e,a,e,t,e,n),qr.slerpFlat(e,t,e,t,e,a,r)}},{key:"_lerp",value:function(e,t,n,r,i){for(var a=1-r,o=0;o!==i;++o){var s=t+o;e[s]=e[s]*a+e[n+o]*r}}},{key:"_lerpAdditive",value:function(e,t,n,r,i){for(var a=0;a!==i;++a){var o=t+a;e[o]=e[o]+e[n+a]*r}}}]),e}(),Hf="\\[\\]\\.:\\/",Gf=new RegExp("["+Hf+"]","g"),Vf="[^"+Hf+"]",Wf="[^"+Hf.replace("\\.","")+"]",jf=new RegExp("^"+/((?:WC+[\/:])*)/.source.replace("WC",Vf)+/(WCOD+)?/.source.replace("WCOD",Wf)+/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",Vf)+/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",Vf)+"$"),Xf=["material","materials","bones","map"],qf=function(){function e(t,n,r){a(this,e);var i=r||Yf.parseTrackName(n);this._targetGroup=t,this._bindings=t.subscribe_(n,i)}return s(e,[{key:"getValue",value:function(e,t){this.bind();var n=this._targetGroup.nCachedObjects_,r=this._bindings[n];void 0!==r&&r.getValue(e,t)}},{key:"setValue",value:function(e,t){for(var n=this._bindings,r=this._targetGroup.nCachedObjects_,i=n.length;r!==i;++r)n[r].setValue(e,t)}},{key:"bind",value:function(){for(var e=this._bindings,t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].bind()}},{key:"unbind",value:function(){for(var e=this._bindings,t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].unbind()}}]),e}(),Yf=function(){function e(t,n,r){a(this,e),this.path=n,this.parsedPath=r||e.parseTrackName(n),this.node=e.findNode(t,this.parsedPath.nodeName),this.rootNode=t,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}return s(e,[{key:"_getValue_unavailable",value:function(){}},{key:"_setValue_unavailable",value:function(){}},{key:"_getValue_direct",value:function(e,t){e[t]=this.targetObject[this.propertyName]}},{key:"_getValue_array",value:function(e,t){for(var n=this.resolvedProperty,r=0,i=n.length;r!==i;++r)e[t++]=n[r]}},{key:"_getValue_arrayElement",value:function(e,t){e[t]=this.resolvedProperty[this.propertyIndex]}},{key:"_getValue_toArray",value:function(e,t){this.resolvedProperty.toArray(e,t)}},{key:"_setValue_direct",value:function(e,t){this.targetObject[this.propertyName]=e[t]}},{key:"_setValue_direct_setNeedsUpdate",value:function(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.needsUpdate=!0}},{key:"_setValue_direct_setMatrixWorldNeedsUpdate",value:function(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}},{key:"_setValue_array",value:function(e,t){for(var n=this.resolvedProperty,r=0,i=n.length;r!==i;++r)n[r]=e[t++]}},{key:"_setValue_array_setNeedsUpdate",value:function(e,t){for(var n=this.resolvedProperty,r=0,i=n.length;r!==i;++r)n[r]=e[t++];this.targetObject.needsUpdate=!0}},{key:"_setValue_array_setMatrixWorldNeedsUpdate",value:function(e,t){for(var n=this.resolvedProperty,r=0,i=n.length;r!==i;++r)n[r]=e[t++];this.targetObject.matrixWorldNeedsUpdate=!0}},{key:"_setValue_arrayElement",value:function(e,t){this.resolvedProperty[this.propertyIndex]=e[t]}},{key:"_setValue_arrayElement_setNeedsUpdate",value:function(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.needsUpdate=!0}},{key:"_setValue_arrayElement_setMatrixWorldNeedsUpdate",value:function(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}},{key:"_setValue_fromArray",value:function(e,t){this.resolvedProperty.fromArray(e,t)}},{key:"_setValue_fromArray_setNeedsUpdate",value:function(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.needsUpdate=!0}},{key:"_setValue_fromArray_setMatrixWorldNeedsUpdate",value:function(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.matrixWorldNeedsUpdate=!0}},{key:"_getValue_unbound",value:function(e,t){this.bind(),this.getValue(e,t)}},{key:"_setValue_unbound",value:function(e,t){this.bind(),this.setValue(e,t)}},{key:"bind",value:function(){var t=this.node,n=this.parsedPath,r=n.objectName,i=n.propertyName,a=n.propertyIndex;if(t||(t=e.findNode(this.rootNode,n.nodeName),this.node=t),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,t){if(r){var o=n.objectIndex;switch(r){case"materials":if(!t.material)return void console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);if(!t.material.materials)return void console.error("THREE.PropertyBinding: 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("THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);t=t.skeleton.bones;for(var s=0;s<t.length;s++)if(t[s].name===o){o=s;break}break;case"map":if("map"in t){t=t.map;break}if(!t.material)return void console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);if(!t.material.map)return void console.error("THREE.PropertyBinding: Can not bind to material.map as node.material does not have a map.",this);t=t.material.map;break;default:if(void 0===t[r])return void console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.",this);t=t[r]}if(void 0!==o){if(void 0===t[o])return void console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,t);t=t[o]}}var u=t[i];if(void 0!==u){var l=this.Versioning.None;this.targetObject=t,void 0!==t.needsUpdate?l=this.Versioning.NeedsUpdate:void 0!==t.matrixWorldNeedsUpdate&&(l=this.Versioning.MatrixWorldNeedsUpdate);var c=this.BindingType.Direct;if(void 0!==a){if("morphTargetInfluences"===i){if(!t.geometry)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);if(!t.geometry.morphAttributes)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);void 0!==t.morphTargetDictionary[a]&&(a=t.morphTargetDictionary[a])}c=this.BindingType.ArrayElement,this.resolvedProperty=u,this.propertyIndex=a}else void 0!==u.fromArray&&void 0!==u.toArray?(c=this.BindingType.HasFromToArray,this.resolvedProperty=u):Array.isArray(u)?(c=this.BindingType.EntireArray,this.resolvedProperty=u):this.propertyName=i;this.getValue=this.GetterByBindingType[c],this.setValue=this.SetterByBindingTypeAndVersioning[c][l]}else{var h=n.nodeName;console.error("THREE.PropertyBinding: Trying to update property for track: "+h+"."+i+" but it wasn't found.",t)}}else console.warn("THREE.PropertyBinding: No target node found for track: "+this.path+".")}},{key:"unbind",value:function(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}],[{key:"create",value:function(t,n,r){return t&&t.isAnimationObjectGroup?new e.Composite(t,n,r):new e(t,n,r)}},{key:"sanitizeNodeName",value:function(e){return e.replace(/\s/g,"_").replace(Gf,"")}},{key:"parseTrackName",value:function(e){var t=jf.exec(e);if(null===t)throw new Error("PropertyBinding: Cannot parse trackName: "+e);var n={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},r=n.nodeName&&n.nodeName.lastIndexOf(".");if(void 0!==r&&-1!==r){var i=n.nodeName.substring(r+1);-1!==Xf.indexOf(i)&&(n.nodeName=n.nodeName.substring(0,r),n.objectName=i)}if(null===n.propertyName||0===n.propertyName.length)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+e);return n}},{key:"findNode",value:function(e,t){if(void 0===t||""===t||"."===t||-1===t||t===e.name||t===e.uuid)return e;if(e.skeleton){var n=e.skeleton.getBoneByName(t);if(void 0!==n)return n}if(e.children){var r=function e(n){for(var r=0;r<n.length;r++){var i=n[r];if(i.name===t||i.uuid===t)return i;var a=e(i.children);if(a)return a}return null}(e.children);if(r)return r}return null}}]),e}();Yf.Composite=qf,Yf.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3},Yf.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2},Yf.prototype.GetterByBindingType=[Yf.prototype._getValue_direct,Yf.prototype._getValue_array,Yf.prototype._getValue_arrayElement,Yf.prototype._getValue_toArray],Yf.prototype.SetterByBindingTypeAndVersioning=[[Yf.prototype._setValue_direct,Yf.prototype._setValue_direct_setNeedsUpdate,Yf.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[Yf.prototype._setValue_array,Yf.prototype._setValue_array_setNeedsUpdate,Yf.prototype._setValue_array_setMatrixWorldNeedsUpdate],[Yf.prototype._setValue_arrayElement,Yf.prototype._setValue_arrayElement_setNeedsUpdate,Yf.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[Yf.prototype._setValue_fromArray,Yf.prototype._setValue_fromArray_setNeedsUpdate,Yf.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];var Zf=function(){function e(){a(this,e),this.isAnimationObjectGroup=!0,this.uuid=or(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;var t={};this._indicesByUUID=t;for(var n=0,r=arguments.length;n!==r;++n)t[arguments[n].uuid]=n;this._paths=[],this._parsedPaths=[],this._bindings=[],this._bindingsIndicesByPath={};var i=this;this.stats={objects:{get total(){return i._objects.length},get inUse(){return this.total-i.nCachedObjects_}},get bindingsPerObject(){return i._bindings.length}}}return s(e,[{key:"add",value:function(){for(var e=this._objects,t=this._indicesByUUID,n=this._paths,r=this._parsedPaths,i=this._bindings,a=i.length,o=void 0,s=e.length,u=this.nCachedObjects_,l=0,c=arguments.length;l!==c;++l){var h=arguments[l],d=h.uuid,f=t[d];if(void 0===f){f=s++,t[d]=f,e.push(h);for(var p=0,v=a;p!==v;++p)i[p].push(new Yf(h,n[p],r[p]))}else if(f<u){o=e[f];var m=--u,g=e[m];t[g.uuid]=f,e[f]=g,t[d]=m,e[m]=h;for(var y=0,_=a;y!==_;++y){var x=i[y],M=x[m],S=x[f];x[f]=M,void 0===S&&(S=new Yf(h,n[y],r[y])),x[m]=S}}else e[f]!==o&&console.error("THREE.AnimationObjectGroup: Different objects with the same UUID detected. Clean the caches or recreate your infrastructure when reloading scenes.")}this.nCachedObjects_=u}},{key:"remove",value:function(){for(var e=this._objects,t=this._indicesByUUID,n=this._bindings,r=n.length,i=this.nCachedObjects_,a=0,o=arguments.length;a!==o;++a){var s=arguments[a],u=s.uuid,l=t[u];if(void 0!==l&&l>=i){var c=i++,h=e[c];t[h.uuid]=l,e[l]=h,t[u]=c,e[c]=s;for(var d=0,f=r;d!==f;++d){var p=n[d],v=p[c],m=p[l];p[l]=v,p[c]=m}}}this.nCachedObjects_=i}},{key:"uncache",value:function(){for(var e=this._objects,t=this._indicesByUUID,n=this._bindings,r=n.length,i=this.nCachedObjects_,a=e.length,o=0,s=arguments.length;o!==s;++o){var u=arguments[o],l=u.uuid,c=t[l];if(void 0!==c)if(delete t[l],c<i){var h=--i,d=e[h],f=--a,p=e[f];t[d.uuid]=c,e[c]=d,t[p.uuid]=h,e[h]=p,e.pop();for(var v=0,m=r;v!==m;++v){var g=n[v],y=g[h],_=g[f];g[c]=y,g[h]=_,g.pop()}}else{var x=--a,M=e[x];x>0&&(t[M.uuid]=c),e[c]=M,e.pop();for(var S=0,b=r;S!==b;++S){var w=n[S];w[c]=w[x],w.pop()}}}this.nCachedObjects_=i}},{key:"subscribe_",value:function(e,t){var n=this._bindingsIndicesByPath,r=n[e],i=this._bindings;if(void 0!==r)return i[r];var a=this._paths,o=this._parsedPaths,s=this._objects,u=s.length,l=this.nCachedObjects_,c=new Array(u);r=i.length,n[e]=r,a.push(e),o.push(t),i.push(c);for(var h=l,d=s.length;h!==d;++h){var f=s[h];c[h]=new Yf(f,e,t)}return c}},{key:"unsubscribe_",value:function(e){var t=this._bindingsIndicesByPath,n=t[e];if(void 0!==n){var r=this._paths,i=this._parsedPaths,a=this._bindings,o=a.length-1,s=a[o];t[e[o]]=n,a[n]=s,a.pop(),i[n]=i[o],i.pop(),r[n]=r[o],r.pop()}}}]),e}(),Kf=function(){function e(t,n){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:n.blendMode;a(this,e),this._mixer=t,this._clip=n,this._localRoot=r,this.blendMode=i;for(var o=n.tracks,s=o.length,u=new Array(s),l={endingStart:Qt,endingEnd:Qt},c=0;c!==s;++c){var h=o[c].createInterpolant(null);u[c]=h,h.settings=l}this._interpolantSettings=l,this._interpolants=u,this._propertyBindings=new Array(s),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=qt,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}return s(e,[{key:"play",value:function(){return this._mixer._activateAction(this),this}},{key:"stop",value:function(){return this._mixer._deactivateAction(this),this.reset()}},{key:"reset",value:function(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()}},{key:"isRunning",value:function(){return this.enabled&&!this.paused&&0!==this.timeScale&&null===this._startTime&&this._mixer._isActiveAction(this)}},{key:"isScheduled",value:function(){return this._mixer._isActiveAction(this)}},{key:"startAt",value:function(e){return this._startTime=e,this}},{key:"setLoop",value:function(e,t){return this.loop=e,this.repetitions=t,this}},{key:"setEffectiveWeight",value:function(e){return this.weight=e,this._effectiveWeight=this.enabled?e:0,this.stopFading()}},{key:"getEffectiveWeight",value:function(){return this._effectiveWeight}},{key:"fadeIn",value:function(e){return this._scheduleFading(e,0,1)}},{key:"fadeOut",value:function(e){return this._scheduleFading(e,1,0)}},{key:"crossFadeFrom",value:function(e,t,n){if(e.fadeOut(t),this.fadeIn(t),n){var r=this._clip.duration,i=e._clip.duration,a=i/r,o=r/i;e.warp(1,a,t),this.warp(o,1,t)}return this}},{key:"crossFadeTo",value:function(e,t,n){return e.crossFadeFrom(this,t,n)}},{key:"stopFading",value:function(){var e=this._weightInterpolant;return null!==e&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}},{key:"setEffectiveTimeScale",value:function(e){return this.timeScale=e,this._effectiveTimeScale=this.paused?0:e,this.stopWarping()}},{key:"getEffectiveTimeScale",value:function(){return this._effectiveTimeScale}},{key:"setDuration",value:function(e){return this.timeScale=this._clip.duration/e,this.stopWarping()}},{key:"syncWith",value:function(e){return this.time=e.time,this.timeScale=e.timeScale,this.stopWarping()}},{key:"halt",value:function(e){return this.warp(this._effectiveTimeScale,0,e)}},{key:"warp",value:function(e,t,n){var r=this._mixer,i=r.time,a=this.timeScale,o=this._timeScaleInterpolant;null===o&&(o=r._lendControlInterpolant(),this._timeScaleInterpolant=o);var s=o.parameterPositions,u=o.sampleValues;return s[0]=i,s[1]=i+n,u[0]=e/a,u[1]=t/a,this}},{key:"stopWarping",value:function(){var e=this._timeScaleInterpolant;return null!==e&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}},{key:"getMixer",value:function(){return this._mixer}},{key:"getClip",value:function(){return this._clip}},{key:"getRoot",value:function(){return this._localRoot||this._mixer._root}},{key:"_update",value:function(e,t,n,r){if(this.enabled){var i=this._startTime;if(null!==i){var a=(e-i)*n;a<0||0===n?t=0:(this._startTime=null,t=n*a)}t*=this._updateTimeScale(e);var o=this._updateTime(t),s=this._updateWeight(e);if(s>0){var u=this._interpolants,l=this._propertyBindings;if(this.blendMode===nn)for(var c=0,h=u.length;c!==h;++c)u[c].evaluate(o),l[c].accumulateAdditive(s);else for(var d=0,f=u.length;d!==f;++d)u[d].evaluate(o),l[d].accumulate(r,s)}}else this._updateWeight(e)}},{key:"_updateWeight",value:function(e){var t=0;if(this.enabled){t=this.weight;var n=this._weightInterpolant;if(null!==n){var r=n.evaluate(e)[0];t*=r,e>n.parameterPositions[1]&&(this.stopFading(),0===r&&(this.enabled=!1))}}return this._effectiveWeight=t,t}},{key:"_updateTimeScale",value:function(e){var t=0;if(!this.paused){t=this.timeScale;var n=this._timeScaleInterpolant;if(null!==n)t*=n.evaluate(e)[0],e>n.parameterPositions[1]&&(this.stopWarping(),0===t?this.paused=!0:this.timeScale=t)}return this._effectiveTimeScale=t,t}},{key:"_updateTime",value:function(e){var t=this._clip.duration,n=this.loop,r=this.time+e,i=this._loopCount,a=n===Yt;if(0===e)return-1===i?r:a&&1==(1&i)?t-r:r;if(n===Xt){-1===i&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(r>=t)r=t;else{if(!(r<0)){this.time=r;break e}r=0}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=r,this._mixer.dispatchEvent({type:"finished",action:this,direction:e<0?-1:1})}}else{if(-1===i&&(e>=0?(i=0,this._setEndings(!0,0===this.repetitions,a)):this._setEndings(0===this.repetitions,!0,a)),r>=t||r<0){var o=Math.floor(r/t);r-=t*o,i+=Math.abs(o);var s=this.repetitions-i;if(s<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,r=e>0?t:0,this.time=r,this._mixer.dispatchEvent({type:"finished",action:this,direction:e>0?1:-1});else{if(1===s){var u=e<0;this._setEndings(u,!u,a)}else this._setEndings(!1,!1,a);this._loopCount=i,this.time=r,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:o})}}else this.time=r;if(a&&1==(1&i))return t-r}return r}},{key:"_setEndings",value:function(e,t,n){var r=this._interpolantSettings;n?(r.endingStart=$t,r.endingEnd=$t):(r.endingStart=e?this.zeroSlopeAtStart?$t:Qt:en,r.endingEnd=t?this.zeroSlopeAtEnd?$t:Qt:en)}},{key:"_scheduleFading",value:function(e,t,n){var r=this._mixer,i=r.time,a=this._weightInterpolant;null===a&&(a=r._lendControlInterpolant(),this._weightInterpolant=a);var o=a.parameterPositions,s=a.sampleValues;return o[0]=i,s[0]=t,o[1]=i+e,s[1]=n,this}}]),e}(),Jf=new Float32Array(1),Qf=function(e){w(n,e);var t=E(n);function n(e){var r;return a(this,n),(r=t.call(this))._root=e,r._initMemoryManager(),r._accuIndex=0,r.time=0,r.timeScale=1,r}return s(n,[{key:"_bindAction",value:function(e,t){var n=e._localRoot||this._root,r=e._clip.tracks,i=r.length,a=e._propertyBindings,o=e._interpolants,s=n.uuid,u=this._bindingsByRootAndName,l=u[s];void 0===l&&(l={},u[s]=l);for(var c=0;c!==i;++c){var h=r[c],d=h.name,f=l[d];if(void 0!==f)++f.referenceCount,a[c]=f;else{if(void 0!==(f=a[c])){null===f._cacheIndex&&(++f.referenceCount,this._addInactiveBinding(f,s,d));continue}var p=t&&t._propertyBindings[c].binding.parsedPath;++(f=new zf(Yf.create(n,d,p),h.ValueTypeName,h.getValueSize())).referenceCount,this._addInactiveBinding(f,s,d),a[c]=f}o[c].resultBuffer=f.buffer}}},{key:"_activateAction",value:function(e){if(!this._isActiveAction(e)){if(null===e._cacheIndex){var t=(e._localRoot||this._root).uuid,n=e._clip.uuid,r=this._actionsByClip[n];this._bindAction(e,r&&r.knownActions[0]),this._addInactiveAction(e,n,t)}for(var i=e._propertyBindings,a=0,o=i.length;a!==o;++a){var s=i[a];0==s.useCount++&&(this._lendBinding(s),s.saveOriginalState())}this._lendAction(e)}}},{key:"_deactivateAction",value:function(e){if(this._isActiveAction(e)){for(var t=e._propertyBindings,n=0,r=t.length;n!==r;++n){var i=t[n];0==--i.useCount&&(i.restoreOriginalState(),this._takeBackBinding(i))}this._takeBackAction(e)}}},{key:"_initMemoryManager",value:function(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;var e=this;this.stats={actions:{get total(){return e._actions.length},get inUse(){return e._nActiveActions}},bindings:{get total(){return e._bindings.length},get inUse(){return e._nActiveBindings}},controlInterpolants:{get total(){return e._controlInterpolants.length},get inUse(){return e._nActiveControlInterpolants}}}}},{key:"_isActiveAction",value:function(e){var t=e._cacheIndex;return null!==t&&t<this._nActiveActions}},{key:"_addInactiveAction",value:function(e,t,n){var r=this._actions,i=this._actionsByClip,a=i[t];if(void 0===a)a={knownActions:[e],actionByRoot:{}},e._byClipCacheIndex=0,i[t]=a;else{var o=a.knownActions;e._byClipCacheIndex=o.length,o.push(e)}e._cacheIndex=r.length,r.push(e),a.actionByRoot[n]=e}},{key:"_removeInactiveAction",value:function(e){var t=this._actions,n=t[t.length-1],r=e._cacheIndex;n._cacheIndex=r,t[r]=n,t.pop(),e._cacheIndex=null;var i=e._clip.uuid,a=this._actionsByClip,o=a[i],s=o.knownActions,u=s[s.length-1],l=e._byClipCacheIndex;u._byClipCacheIndex=l,s[l]=u,s.pop(),e._byClipCacheIndex=null,delete o.actionByRoot[(e._localRoot||this._root).uuid],0===s.length&&delete a[i],this._removeInactiveBindingsForAction(e)}},{key:"_removeInactiveBindingsForAction",value:function(e){for(var t=e._propertyBindings,n=0,r=t.length;n!==r;++n){var i=t[n];0==--i.referenceCount&&this._removeInactiveBinding(i)}}},{key:"_lendAction",value:function(e){var t=this._actions,n=e._cacheIndex,r=this._nActiveActions++,i=t[r];e._cacheIndex=r,t[r]=e,i._cacheIndex=n,t[n]=i}},{key:"_takeBackAction",value:function(e){var t=this._actions,n=e._cacheIndex,r=--this._nActiveActions,i=t[r];e._cacheIndex=r,t[r]=e,i._cacheIndex=n,t[n]=i}},{key:"_addInactiveBinding",value:function(e,t,n){var r=this._bindingsByRootAndName,i=this._bindings,a=r[t];void 0===a&&(a={},r[t]=a),a[n]=e,e._cacheIndex=i.length,i.push(e)}},{key:"_removeInactiveBinding",value:function(e){var t=this._bindings,n=e.binding,r=n.rootNode.uuid,i=n.path,a=this._bindingsByRootAndName,o=a[r],s=t[t.length-1],u=e._cacheIndex;s._cacheIndex=u,t[u]=s,t.pop(),delete o[i],0===Object.keys(o).length&&delete a[r]}},{key:"_lendBinding",value:function(e){var t=this._bindings,n=e._cacheIndex,r=this._nActiveBindings++,i=t[r];e._cacheIndex=r,t[r]=e,i._cacheIndex=n,t[n]=i}},{key:"_takeBackBinding",value:function(e){var t=this._bindings,n=e._cacheIndex,r=--this._nActiveBindings,i=t[r];e._cacheIndex=r,t[r]=e,i._cacheIndex=n,t[n]=i}},{key:"_lendControlInterpolant",value:function(){var e=this._controlInterpolants,t=this._nActiveControlInterpolants++,n=e[t];return void 0===n&&((n=new gd(new Float32Array(2),new Float32Array(2),1,Jf)).__cacheIndex=t,e[t]=n),n}},{key:"_takeBackControlInterpolant",value:function(e){var t=this._controlInterpolants,n=e.__cacheIndex,r=--this._nActiveControlInterpolants,i=t[r];e.__cacheIndex=r,t[r]=e,i.__cacheIndex=n,t[n]=i}},{key:"clipAction",value:function(e,t,n){var r=t||this._root,i=r.uuid,a="string"==typeof e?Ad.findByName(r,e):e,o=null!==a?a.uuid:e,s=this._actionsByClip[o],u=null;if(void 0===n&&(n=null!==a?a.blendMode:tn),void 0!==s){var l=s.actionByRoot[i];if(void 0!==l&&l.blendMode===n)return l;u=s.knownActions[0],null===a&&(a=u._clip)}if(null===a)return null;var c=new Kf(this,a,t,n);return this._bindAction(c,u),this._addInactiveAction(c,o,i),c}},{key:"existingAction",value:function(e,t){var n=t||this._root,r=n.uuid,i="string"==typeof e?Ad.findByName(n,e):e,a=i?i.uuid:e,o=this._actionsByClip[a];return void 0!==o&&o.actionByRoot[r]||null}},{key:"stopAllAction",value:function(){for(var e=this._actions,t=this._nActiveActions-1;t>=0;--t)e[t].stop();return this}},{key:"update",value:function(e){e*=this.timeScale;for(var t=this._actions,n=this._nActiveActions,r=this.time+=e,i=Math.sign(e),a=this._accuIndex^=1,o=0;o!==n;++o){t[o]._update(r,e,i,a)}for(var s=this._bindings,u=this._nActiveBindings,l=0;l!==u;++l)s[l].apply(a);return this}},{key:"setTime",value:function(e){this.time=0;for(var t=0;t<this._actions.length;t++)this._actions[t].time=0;return this.update(e)}},{key:"getRoot",value:function(){return this._root}},{key:"uncacheClip",value:function(e){var t=this._actions,n=e.uuid,r=this._actionsByClip,i=r[n];if(void 0!==i){for(var a=i.knownActions,o=0,s=a.length;o!==s;++o){var u=a[o];this._deactivateAction(u);var l=u._cacheIndex,c=t[t.length-1];u._cacheIndex=null,u._byClipCacheIndex=null,c._cacheIndex=l,t[l]=c,t.pop(),this._removeInactiveBindingsForAction(u)}delete r[n]}}},{key:"uncacheRoot",value:function(e){var t=e.uuid,n=this._actionsByClip;for(var r in n){var i=n[r].actionByRoot[t];void 0!==i&&(this._deactivateAction(i),this._removeInactiveAction(i))}var a=this._bindingsByRootAndName[t];if(void 0!==a)for(var o in a){var s=a[o];s.restoreOriginalState(),this._removeInactiveBinding(s)}}},{key:"uncacheAction",value:function(e,t){var n=this.existingAction(e,t);null!==n&&(this._deactivateAction(n),this._removeInactiveAction(n))}}]),n}(tr),$f=function(){function e(t){a(this,e),this.value=t}return s(e,[{key:"clone",value:function(){return new e(void 0===this.value.clone?this.value:this.value.clone())}}]),e}(),ep=0,tp=function(e){w(n,e);var t=E(n);function n(){var e;return a(this,n),(e=t.call(this)).isUniformsGroup=!0,Object.defineProperty(S(e),"id",{value:ep++}),e.name="",e.usage=Hn,e.uniforms=[],e}return s(n,[{key:"add",value:function(e){return this.uniforms.push(e),this}},{key:"remove",value:function(e){var t=this.uniforms.indexOf(e);return-1!==t&&this.uniforms.splice(t,1),this}},{key:"setName",value:function(e){return this.name=e,this}},{key:"setUsage",value:function(e){return this.usage=e,this}},{key:"dispose",value:function(){return this.dispatchEvent({type:"dispose"}),this}},{key:"copy",value:function(e){this.name=e.name,this.usage=e.usage;var t=e.uniforms;this.uniforms.length=0;for(var n=0,r=t.length;n<r;n++)this.uniforms.push(t[n].clone());return this}},{key:"clone",value:function(){return(new this.constructor).copy(this)}}]),n}(tr),np=function(e){w(n,e);var t=E(n);function n(e,r){var i,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;return a(this,n),(i=t.call(this,e,r)).isInstancedInterleavedBuffer=!0,i.meshPerAttribute=o,i}return s(n,[{key:"copy",value:function(e){return y(x(n.prototype),"copy",this).call(this,e),this.meshPerAttribute=e.meshPerAttribute,this}},{key:"clone",value:function(e){var t=y(x(n.prototype),"clone",this).call(this,e);return t.meshPerAttribute=this.meshPerAttribute,t}},{key:"toJSON",value:function(e){var t=y(x(n.prototype),"toJSON",this).call(this,e);return t.isInstancedInterleavedBuffer=!0,t.meshPerAttribute=this.meshPerAttribute,t}}]),n}(fl),rp=function(){function e(t,n,r,i,o){a(this,e),this.isGLBufferAttribute=!0,this.name="",this.buffer=t,this.type=n,this.itemSize=r,this.elementSize=i,this.count=o,this.version=0}return s(e,[{key:"needsUpdate",set:function(e){!0===e&&this.version++}},{key:"setBuffer",value:function(e){return this.buffer=e,this}},{key:"setType",value:function(e,t){return this.type=e,this.elementSize=t,this}},{key:"setItemSize",value:function(e){return this.itemSize=e,this}},{key:"setCount",value:function(e){return this.count=e,this}}]),e}(),ip=function(){function e(t,n){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1/0;a(this,e),this.ray=new bi(t,n),this.near=r,this.far=i,this.camera=null,this.layers=new Ui,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}}}return s(e,[{key:"set",value:function(e,t){this.ray.set(e,t)}},{key:"setFromCamera",value:function(e,t){t.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(t.matrixWorld),this.ray.direction.set(e.x,e.y,.5).unproject(t).sub(this.ray.origin).normalize(),this.camera=t):t.isOrthographicCamera?(this.ray.origin.set(e.x,e.y,(t.near+t.far)/(t.near-t.far)).unproject(t),this.ray.direction.set(0,0,-1).transformDirection(t.matrixWorld),this.camera=t):console.error("THREE.Raycaster: Unsupported camera type: "+t.type)}},{key:"intersectObject",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];return op(e,this,n,t),n.sort(ap),n}},{key:"intersectObjects",value:function(e){for(var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],r=0,i=e.length;r<i;r++)op(e[r],this,n,t);return n.sort(ap),n}}]),e}();function ap(e,t){return e.distance-t.distance}function op(e,t,n,r){if(e.layers.test(t.layers)&&e.raycast(t,n),!0===r)for(var i=e.children,a=0,o=i.length;a<o;a++)op(i[a],t,n,!0)}var sp=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return a(this,e),this.radius=t,this.phi=n,this.theta=r,this}return s(e,[{key:"set",value:function(e,t,n){return this.radius=e,this.phi=t,this.theta=n,this}},{key:"copy",value:function(e){return this.radius=e.radius,this.phi=e.phi,this.theta=e.theta,this}},{key:"makeSafe",value:function(){var e=1e-6;return this.phi=Math.max(e,Math.min(Math.PI-e,this.phi)),this}},{key:"setFromVector3",value:function(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}},{key:"setFromCartesianCoords",value:function(e,t,n){return this.radius=Math.sqrt(e*e+t*t+n*n),0===this.radius?(this.theta=0,this.phi=0):(this.theta=Math.atan2(e,n),this.phi=Math.acos(sr(t/this.radius,-1,1))),this}},{key:"clone",value:function(){return(new this.constructor).copy(this)}}]),e}(),up=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return a(this,e),this.radius=t,this.theta=n,this.y=r,this}return s(e,[{key:"set",value:function(e,t,n){return this.radius=e,this.theta=t,this.y=n,this}},{key:"copy",value:function(e){return this.radius=e.radius,this.theta=e.theta,this.y=e.y,this}},{key:"setFromVector3",value:function(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}},{key:"setFromCartesianCoords",value:function(e,t,n){return this.radius=Math.sqrt(e*e+n*n),this.theta=Math.atan2(e,n),this.y=t,this}},{key:"clone",value:function(){return(new this.constructor).copy(this)}}]),e}(),lp=new mr,cp=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new mr(1/0,1/0),n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new mr(-1/0,-1/0);a(this,e),this.isBox2=!0,this.min=t,this.max=n}return s(e,[{key:"set",value:function(e,t){return this.min.copy(e),this.max.copy(t),this}},{key:"setFromPoints",value:function(e){this.makeEmpty();for(var t=0,n=e.length;t<n;t++)this.expandByPoint(e[t]);return this}},{key:"setFromCenterAndSize",value:function(e,t){var n=lp.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this}},{key:"clone",value:function(){return(new this.constructor).copy(this)}},{key:"copy",value:function(e){return this.min.copy(e.min),this.max.copy(e.max),this}},{key:"makeEmpty",value:function(){return this.min.x=this.min.y=1/0,this.max.x=this.max.y=-1/0,this}},{key:"isEmpty",value:function(){return this.max.x<this.min.x||this.max.y<this.min.y}},{key:"getCenter",value:function(e){return this.isEmpty()?e.set(0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}},{key:"getSize",value:function(e){return this.isEmpty()?e.set(0,0):e.subVectors(this.max,this.min)}},{key:"expandByPoint",value:function(e){return this.min.min(e),this.max.max(e),this}},{key:"expandByVector",value:function(e){return this.min.sub(e),this.max.add(e),this}},{key:"expandByScalar",value:function(e){return this.min.addScalar(-e),this.max.addScalar(e),this}},{key:"containsPoint",value:function(e){return!(e.x<this.min.x||e.x>this.max.x||e.y<this.min.y||e.y>this.max.y)}},{key:"containsBox",value:function(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y}},{key:"getParameter",value:function(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y))}},{key:"intersectsBox",value:function(e){return!(e.max.x<this.min.x||e.min.x>this.max.x||e.max.y<this.min.y||e.min.y>this.max.y)}},{key:"clampPoint",value:function(e,t){return t.copy(e).clamp(this.min,this.max)}},{key:"distanceToPoint",value:function(e){return this.clampPoint(e,lp).distanceTo(e)}},{key:"intersect",value:function(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}},{key:"union",value:function(e){return this.min.min(e.min),this.max.max(e.max),this}},{key:"translate",value:function(e){return this.min.add(e),this.max.add(e),this}},{key:"equals",value:function(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}]),e}(),hp=new Yr,dp=new Yr,fp=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Yr,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Yr;a(this,e),this.start=t,this.end=n}return s(e,[{key:"set",value:function(e,t){return this.start.copy(e),this.end.copy(t),this}},{key:"copy",value:function(e){return this.start.copy(e.start),this.end.copy(e.end),this}},{key:"getCenter",value:function(e){return e.addVectors(this.start,this.end).multiplyScalar(.5)}},{key:"delta",value:function(e){return e.subVectors(this.end,this.start)}},{key:"distanceSq",value:function(){return this.start.distanceToSquared(this.end)}},{key:"distance",value:function(){return this.start.distanceTo(this.end)}},{key:"at",value:function(e,t){return this.delta(t).multiplyScalar(e).add(this.start)}},{key:"closestPointToPointParameter",value:function(e,t){hp.subVectors(e,this.start),dp.subVectors(this.end,this.start);var n=dp.dot(dp),r=dp.dot(hp)/n;return t&&(r=sr(r,0,1)),r}},{key:"closestPointToPoint",value:function(e,t,n){var r=this.closestPointToPointParameter(e,t);return this.delta(n).multiplyScalar(r).add(this.start)}},{key:"applyMatrix4",value:function(e){return this.start.applyMatrix4(e),this.end.applyMatrix4(e),this}},{key:"equals",value:function(e){return e.start.equals(this.start)&&e.end.equals(this.end)}},{key:"clone",value:function(){return(new this.constructor).copy(this)}}]),e}(),pp=new Yr,vp=function(e){w(n,e);var t=E(n);function n(e,r){var i;a(this,n),(i=t.call(this)).light=e,i.matrix=e.matrixWorld,i.matrixAutoUpdate=!1,i.color=r,i.type="SpotLightHelper";for(var o=new Ga,s=[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],u=0,l=1;u<32;u++,l++){var c=u/32*Math.PI*2,h=l/32*Math.PI*2;s.push(Math.cos(c),Math.sin(c),1,Math.cos(h),Math.sin(h),1)}o.setAttribute("position",new Ia(s,3));var d=new ic({fog:!1,toneMapped:!1});return i.cone=new fc(o,d),i.add(i.cone),i.update(),i}return s(n,[{key:"dispose",value:function(){this.cone.geometry.dispose(),this.cone.material.dispose()}},{key:"update",value:function(){this.light.updateWorldMatrix(!0,!1),this.light.target.updateWorldMatrix(!0,!1);var e=this.light.distance?this.light.distance:1e3,t=e*Math.tan(this.light.angle);this.cone.scale.set(t,t,e),pp.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(pp),void 0!==this.color?this.cone.material.color.set(this.color):this.cone.material.color.copy(this.light.color)}}]),n}(Zi),mp=new Yr,gp=new wi,yp=new wi,_p=function(e){w(n,e);var t=E(n);function n(e){var r;a(this,n);for(var i=xp(e),o=new Ga,s=[],u=[],l=new pa(0,0,1),c=new pa(0,1,0),h=0;h<i.length;h++){var d=i[h];d.parent&&d.parent.isBone&&(s.push(0,0,0),s.push(0,0,0),u.push(l.r,l.g,l.b),u.push(c.r,c.g,c.b))}o.setAttribute("position",new Ia(s,3)),o.setAttribute("color",new Ia(u,3));var f=new ic({vertexColors:!0,depthTest:!1,depthWrite:!1,toneMapped:!1,transparent:!0});return(r=t.call(this,o,f)).isSkeletonHelper=!0,r.type="SkeletonHelper",r.root=e,r.bones=i,r.matrix=e.matrixWorld,r.matrixAutoUpdate=!1,r}return s(n,[{key:"updateMatrixWorld",value:function(e){var t=this.bones,r=this.geometry,i=r.getAttribute("position");yp.copy(this.root.matrixWorld).invert();for(var a=0,o=0;a<t.length;a++){var s=t[a];s.parent&&s.parent.isBone&&(gp.multiplyMatrices(yp,s.matrixWorld),mp.setFromMatrixPosition(gp),i.setXYZ(o,mp.x,mp.y,mp.z),gp.multiplyMatrices(yp,s.parent.matrixWorld),mp.setFromMatrixPosition(gp),i.setXYZ(o+1,mp.x,mp.y,mp.z),o+=2)}r.getAttribute("position").needsUpdate=!0,y(x(n.prototype),"updateMatrixWorld",this).call(this,e)}},{key:"dispose",value:function(){this.geometry.dispose(),this.material.dispose()}}]),n}(fc);function xp(e){var t=[];!0===e.isBone&&t.push(e);for(var n=0;n<e.children.length;n++)t.push.apply(t,xp(e.children[n]));return t}var Mp=function(e){w(n,e);var t=E(n);function n(e,r,i){var o;a(this,n);var s=new Wh(r,4,2),u=new ma({wireframe:!0,fog:!1,toneMapped:!1});return(o=t.call(this,s,u)).light=e,o.color=i,o.type="PointLightHelper",o.matrix=o.light.matrixWorld,o.matrixAutoUpdate=!1,o.update(),o}return s(n,[{key:"dispose",value:function(){this.geometry.dispose(),this.material.dispose()}},{key:"update",value:function(){this.light.updateWorldMatrix(!0,!1),void 0!==this.color?this.material.color.set(this.color):this.material.color.copy(this.light.color)}}]),n}(oo),Sp=new Yr,bp=new pa,wp=new pa,Tp=function(e){w(n,e);var t=E(n);function n(e,r,i){var o;a(this,n),(o=t.call(this)).light=e,o.matrix=e.matrixWorld,o.matrixAutoUpdate=!1,o.color=i,o.type="HemisphereLightHelper";var s=new Hh(r);s.rotateY(.5*Math.PI),o.material=new ma({wireframe:!0,fog:!1,toneMapped:!1}),void 0===o.color&&(o.material.vertexColors=!0);var u=s.getAttribute("position"),l=new Float32Array(3*u.count);return s.setAttribute("color",new wa(l,3)),o.add(new oo(s,o.material)),o.update(),o}return s(n,[{key:"dispose",value:function(){this.children[0].geometry.dispose(),this.children[0].material.dispose()}},{key:"update",value:function(){var e=this.children[0];if(void 0!==this.color)this.material.color.set(this.color);else{var t=e.geometry.getAttribute("color");bp.copy(this.light.color),wp.copy(this.light.groundColor);for(var n=0,r=t.count;n<r;n++){var i=n<r/2?bp:wp;t.setXYZ(n,i.r,i.g,i.b)}t.needsUpdate=!0}this.light.updateWorldMatrix(!0,!1),e.lookAt(Sp.setFromMatrixPosition(this.light.matrixWorld).negate())}}]),n}(Zi),Ep=function(e){w(n,e);var t=E(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:4473924,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:8947848;a(this,n),o=new pa(o),s=new pa(s);for(var u=i/2,l=r/i,c=r/2,h=[],d=[],f=0,p=0,v=-c;f<=i;f++,v+=l){h.push(-c,0,v,c,0,v),h.push(v,0,-c,v,0,c);var m=f===u?o:s;m.toArray(d,p),p+=3,m.toArray(d,p),p+=3,m.toArray(d,p),p+=3,m.toArray(d,p),p+=3}var g=new Ga;g.setAttribute("position",new Ia(h,3)),g.setAttribute("color",new Ia(d,3));var y=new ic({vertexColors:!0,toneMapped:!1});return(e=t.call(this,g,y)).type="GridHelper",e}return s(n,[{key:"dispose",value:function(){this.geometry.dispose(),this.material.dispose()}}]),n}(fc),Ap=function(e){w(n,e);var t=E(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:16,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:8,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:64,u=arguments.length>4&&void 0!==arguments[4]?arguments[4]:4473924,l=arguments.length>5&&void 0!==arguments[5]?arguments[5]:8947848;a(this,n),u=new pa(u),l=new pa(l);var c=[],h=[];if(i>1)for(var d=0;d<i;d++){var f=d/i*(2*Math.PI),p=Math.sin(f)*r,v=Math.cos(f)*r;c.push(0,0,0),c.push(p,0,v);var m=1&d?u:l;h.push(m.r,m.g,m.b),h.push(m.r,m.g,m.b)}for(var g=0;g<o;g++)for(var y=1&g?u:l,_=r-r/o*g,x=0;x<s;x++){var M=x/s*(2*Math.PI),S=Math.sin(M)*_,b=Math.cos(M)*_;c.push(S,0,b),h.push(y.r,y.g,y.b),M=(x+1)/s*(2*Math.PI),S=Math.sin(M)*_,b=Math.cos(M)*_,c.push(S,0,b),h.push(y.r,y.g,y.b)}var w=new Ga;w.setAttribute("position",new Ia(c,3)),w.setAttribute("color",new Ia(h,3));var T=new ic({vertexColors:!0,toneMapped:!1});return(e=t.call(this,w,T)).type="PolarGridHelper",e}return s(n,[{key:"dispose",value:function(){this.geometry.dispose(),this.material.dispose()}}]),n}(fc),Rp=new Yr,kp=new Yr,Cp=new Yr,Lp=function(e){w(n,e);var t=E(n);function n(e,r,i){var o;a(this,n),(o=t.call(this)).light=e,o.matrix=e.matrixWorld,o.matrixAutoUpdate=!1,o.color=i,o.type="DirectionalLightHelper",void 0===r&&(r=1);var s=new Ga;s.setAttribute("position",new Ia([-r,r,0,r,r,0,r,-r,0,-r,-r,0,-r,r,0],3));var u=new ic({fog:!1,toneMapped:!1});return o.lightPlane=new cc(s,u),o.add(o.lightPlane),(s=new Ga).setAttribute("position",new Ia([0,0,0,0,0,1],3)),o.targetLine=new cc(s,u),o.add(o.targetLine),o.update(),o}return s(n,[{key:"dispose",value:function(){this.lightPlane.geometry.dispose(),this.lightPlane.material.dispose(),this.targetLine.geometry.dispose(),this.targetLine.material.dispose()}},{key:"update",value:function(){this.light.updateWorldMatrix(!0,!1),this.light.target.updateWorldMatrix(!0,!1),Rp.setFromMatrixPosition(this.light.matrixWorld),kp.setFromMatrixPosition(this.light.target.matrixWorld),Cp.subVectors(kp,Rp),this.lightPlane.lookAt(kp),void 0!==this.color?(this.lightPlane.material.color.set(this.color),this.targetLine.material.color.set(this.color)):(this.lightPlane.material.color.copy(this.light.color),this.targetLine.material.color.copy(this.light.color)),this.targetLine.lookAt(kp),this.targetLine.scale.z=Cp.length()}}]),n}(Zi),Pp=new Yr,Ip=new vo,Dp=function(e){w(n,e);var t=E(n);function n(e){var r;a(this,n);var i=new Ga,o=new ic({color:16777215,vertexColors:!0,toneMapped:!1}),s=[],u=[],l={};function c(e,t){h(e),h(t)}function h(e){s.push(0,0,0),u.push(0,0,0),void 0===l[e]&&(l[e]=[]),l[e].push(s.length/3-1)}c("n1","n2"),c("n2","n4"),c("n4","n3"),c("n3","n1"),c("f1","f2"),c("f2","f4"),c("f4","f3"),c("f3","f1"),c("n1","f1"),c("n2","f2"),c("n3","f3"),c("n4","f4"),c("p","n1"),c("p","n2"),c("p","n3"),c("p","n4"),c("u1","u2"),c("u2","u3"),c("u3","u1"),c("c","t"),c("p","c"),c("cn1","cn2"),c("cn3","cn4"),c("cf1","cf2"),c("cf3","cf4"),i.setAttribute("position",new Ia(s,3)),i.setAttribute("color",new Ia(u,3)),(r=t.call(this,i,o)).type="CameraHelper",r.camera=e,r.camera.updateProjectionMatrix&&r.camera.updateProjectionMatrix(),r.matrix=e.matrixWorld,r.matrixAutoUpdate=!1,r.pointMap=l,r.update();var d=new pa(16755200),f=new pa(16711680),p=new pa(43775),v=new pa(16777215),m=new pa(3355443);return r.setColors(d,f,p,v,m),r}return s(n,[{key:"setColors",value:function(e,t,n,r,i){var a=this.geometry.getAttribute("color");a.setXYZ(0,e.r,e.g,e.b),a.setXYZ(1,e.r,e.g,e.b),a.setXYZ(2,e.r,e.g,e.b),a.setXYZ(3,e.r,e.g,e.b),a.setXYZ(4,e.r,e.g,e.b),a.setXYZ(5,e.r,e.g,e.b),a.setXYZ(6,e.r,e.g,e.b),a.setXYZ(7,e.r,e.g,e.b),a.setXYZ(8,e.r,e.g,e.b),a.setXYZ(9,e.r,e.g,e.b),a.setXYZ(10,e.r,e.g,e.b),a.setXYZ(11,e.r,e.g,e.b),a.setXYZ(12,e.r,e.g,e.b),a.setXYZ(13,e.r,e.g,e.b),a.setXYZ(14,e.r,e.g,e.b),a.setXYZ(15,e.r,e.g,e.b),a.setXYZ(16,e.r,e.g,e.b),a.setXYZ(17,e.r,e.g,e.b),a.setXYZ(18,e.r,e.g,e.b),a.setXYZ(19,e.r,e.g,e.b),a.setXYZ(20,e.r,e.g,e.b),a.setXYZ(21,e.r,e.g,e.b),a.setXYZ(22,e.r,e.g,e.b),a.setXYZ(23,e.r,e.g,e.b),a.setXYZ(24,t.r,t.g,t.b),a.setXYZ(25,t.r,t.g,t.b),a.setXYZ(26,t.r,t.g,t.b),a.setXYZ(27,t.r,t.g,t.b),a.setXYZ(28,t.r,t.g,t.b),a.setXYZ(29,t.r,t.g,t.b),a.setXYZ(30,t.r,t.g,t.b),a.setXYZ(31,t.r,t.g,t.b),a.setXYZ(32,n.r,n.g,n.b),a.setXYZ(33,n.r,n.g,n.b),a.setXYZ(34,n.r,n.g,n.b),a.setXYZ(35,n.r,n.g,n.b),a.setXYZ(36,n.r,n.g,n.b),a.setXYZ(37,n.r,n.g,n.b),a.setXYZ(38,r.r,r.g,r.b),a.setXYZ(39,r.r,r.g,r.b),a.setXYZ(40,i.r,i.g,i.b),a.setXYZ(41,i.r,i.g,i.b),a.setXYZ(42,i.r,i.g,i.b),a.setXYZ(43,i.r,i.g,i.b),a.setXYZ(44,i.r,i.g,i.b),a.setXYZ(45,i.r,i.g,i.b),a.setXYZ(46,i.r,i.g,i.b),a.setXYZ(47,i.r,i.g,i.b),a.setXYZ(48,i.r,i.g,i.b),a.setXYZ(49,i.r,i.g,i.b),a.needsUpdate=!0}},{key:"update",value:function(){var e=this.geometry,t=this.pointMap;Ip.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse),Up("c",t,e,Ip,0,0,-1),Up("t",t,e,Ip,0,0,1),Up("n1",t,e,Ip,-1,-1,-1),Up("n2",t,e,Ip,1,-1,-1),Up("n3",t,e,Ip,-1,1,-1),Up("n4",t,e,Ip,1,1,-1),Up("f1",t,e,Ip,-1,-1,1),Up("f2",t,e,Ip,1,-1,1),Up("f3",t,e,Ip,-1,1,1),Up("f4",t,e,Ip,1,1,1),Up("u1",t,e,Ip,.7,1.1,-1),Up("u2",t,e,Ip,-.7,1.1,-1),Up("u3",t,e,Ip,0,2,-1),Up("cf1",t,e,Ip,-1,0,1),Up("cf2",t,e,Ip,1,0,1),Up("cf3",t,e,Ip,0,-1,1),Up("cf4",t,e,Ip,0,1,1),Up("cn1",t,e,Ip,-1,0,-1),Up("cn2",t,e,Ip,1,0,-1),Up("cn3",t,e,Ip,0,-1,-1),Up("cn4",t,e,Ip,0,1,-1),e.getAttribute("position").needsUpdate=!0}},{key:"dispose",value:function(){this.geometry.dispose(),this.material.dispose()}}]),n}(fc);function Up(e,t,n,r,i,a,o){Pp.set(i,a,o).unproject(r);var s=t[e];if(void 0!==s)for(var u=n.getAttribute("position"),l=0,c=s.length;l<c;l++)u.setXYZ(s[l],Pp.x,Pp.y,Pp.z)}var Op,Np,Fp=new Jr,Bp=function(e){w(n,e);var t=E(n);function n(e){var r,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:16776960;a(this,n);var o=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]),s=new Float32Array(24),u=new Ga;return u.setIndex(new wa(o,1)),u.setAttribute("position",new wa(s,3)),(r=t.call(this,u,new ic({color:i,toneMapped:!1}))).object=e,r.type="BoxHelper",r.matrixAutoUpdate=!1,r.update(),r}return s(n,[{key:"update",value:function(e){if(void 0!==e&&console.warn("THREE.BoxHelper: .update() has no longer arguments."),void 0!==this.object&&Fp.setFromObject(this.object),!Fp.isEmpty()){var t=Fp.min,n=Fp.max,r=this.geometry.attributes.position,i=r.array;i[0]=n.x,i[1]=n.y,i[2]=n.z,i[3]=t.x,i[4]=n.y,i[5]=n.z,i[6]=t.x,i[7]=t.y,i[8]=n.z,i[9]=n.x,i[10]=t.y,i[11]=n.z,i[12]=n.x,i[13]=n.y,i[14]=t.z,i[15]=t.x,i[16]=n.y,i[17]=t.z,i[18]=t.x,i[19]=t.y,i[20]=t.z,i[21]=n.x,i[22]=t.y,i[23]=t.z,r.needsUpdate=!0,this.geometry.computeBoundingSphere()}}},{key:"setFromObject",value:function(e){return this.object=e,this.update(),this}},{key:"copy",value:function(e,t){return y(x(n.prototype),"copy",this).call(this,e,t),this.object=e.object,this}},{key:"dispose",value:function(){this.geometry.dispose(),this.material.dispose()}}]),n}(fc),zp=function(e){w(n,e);var t=E(n);function n(e){var r,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:16776960;a(this,n);var o=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]),s=[1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,-1,-1,1,-1,-1,-1,-1,1,-1,-1],u=new Ga;return u.setIndex(new wa(o,1)),u.setAttribute("position",new Ia(s,3)),(r=t.call(this,u,new ic({color:i,toneMapped:!1}))).box=e,r.type="Box3Helper",r.geometry.computeBoundingSphere(),r}return s(n,[{key:"updateMatrixWorld",value:function(e){var t=this.box;t.isEmpty()||(t.getCenter(this.position),t.getSize(this.scale),this.scale.multiplyScalar(.5),y(x(n.prototype),"updateMatrixWorld",this).call(this,e))}},{key:"dispose",value:function(){this.geometry.dispose(),this.material.dispose()}}]),n}(fc),Hp=function(e){w(n,e);var t=E(n);function n(e){var r,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:16776960;a(this,n);var s=o,u=[1,-1,0,-1,1,0,-1,-1,0,1,1,0,-1,1,0,-1,-1,0,1,-1,0,1,1,0],l=new Ga;l.setAttribute("position",new Ia(u,3)),l.computeBoundingSphere(),(r=t.call(this,l,new ic({color:s,toneMapped:!1}))).type="PlaneHelper",r.plane=e,r.size=i;var c=[1,1,0,-1,1,0,-1,-1,0,1,1,0,-1,-1,0,1,-1,0],h=new Ga;return h.setAttribute("position",new Ia(c,3)),h.computeBoundingSphere(),r.add(new oo(h,new ma({color:s,opacity:.2,transparent:!0,depthWrite:!1,toneMapped:!1}))),r}return s(n,[{key:"updateMatrixWorld",value:function(e){this.position.set(0,0,0),this.scale.set(.5*this.size,.5*this.size,1),this.lookAt(this.plane.normal),this.translateZ(-this.plane.constant),y(x(n.prototype),"updateMatrixWorld",this).call(this,e)}},{key:"dispose",value:function(){this.geometry.dispose(),this.material.dispose(),this.children[0].geometry.dispose(),this.children[0].material.dispose()}}]),n}(cc),Gp=new Yr,Vp=function(e){w(n,e);var t=E(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Yr(0,0,1),i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Yr(0,0,0),o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:16776960,u=arguments.length>4&&void 0!==arguments[4]?arguments[4]:.2*o,l=arguments.length>5&&void 0!==arguments[5]?arguments[5]:.2*u;return a(this,n),(e=t.call(this)).type="ArrowHelper",void 0===Op&&((Op=new Ga).setAttribute("position",new Ia([0,0,0,0,1,0],3)),(Np=new $c(0,.5,1,5,1)).translate(0,-.5,0)),e.position.copy(i),e.line=new cc(Op,new ic({color:s,toneMapped:!1})),e.line.matrixAutoUpdate=!1,e.add(e.line),e.cone=new oo(Np,new ma({color:s,toneMapped:!1})),e.cone.matrixAutoUpdate=!1,e.add(e.cone),e.setDirection(r),e.setLength(o,u,l),e}return s(n,[{key:"setDirection",value:function(e){if(e.y>.99999)this.quaternion.set(0,0,0,1);else if(e.y<-.99999)this.quaternion.set(1,0,0,0);else{Gp.set(e.z,0,-e.x).normalize();var t=Math.acos(e.y);this.quaternion.setFromAxisAngle(Gp,t)}}},{key:"setLength",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.2*e,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:.2*t;this.line.scale.set(1,Math.max(1e-4,e-t),1),this.line.updateMatrix(),this.cone.scale.set(n,t,n),this.cone.position.y=e,this.cone.updateMatrix()}},{key:"setColor",value:function(e){this.line.material.color.set(e),this.cone.material.color.set(e)}},{key:"copy",value:function(e){return y(x(n.prototype),"copy",this).call(this,e,!1),this.line.copy(e.line),this.cone.copy(e.cone),this}},{key:"dispose",value:function(){this.line.geometry.dispose(),this.line.material.dispose(),this.cone.geometry.dispose(),this.cone.material.dispose()}}]),n}(Zi),Wp=function(e){w(n,e);var t=E(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;a(this,n);var i=[0,0,0,r,0,0,0,0,0,0,r,0,0,0,0,0,0,r],o=[1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],s=new Ga;s.setAttribute("position",new Ia(i,3)),s.setAttribute("color",new Ia(o,3));var u=new ic({vertexColors:!0,toneMapped:!1});return(e=t.call(this,s,u)).type="AxesHelper",e}return s(n,[{key:"setColors",value:function(e,t,n){var r=new pa,i=this.geometry.attributes.color.array;return r.set(e),r.toArray(i,0),r.toArray(i,3),r.set(t),r.toArray(i,6),r.toArray(i,9),r.set(n),r.toArray(i,12),r.toArray(i,15),this.geometry.attributes.color.needsUpdate=!0,this}},{key:"dispose",value:function(){this.geometry.dispose(),this.material.dispose()}}]),n}(fc),jp=function(){function e(){a(this,e),this.type="ShapePath",this.color=new pa,this.subPaths=[],this.currentPath=null}return s(e,[{key:"moveTo",value:function(e,t){return this.currentPath=new Zc,this.subPaths.push(this.currentPath),this.currentPath.moveTo(e,t),this}},{key:"lineTo",value:function(e,t){return this.currentPath.lineTo(e,t),this}},{key:"quadraticCurveTo",value:function(e,t,n,r){return this.currentPath.quadraticCurveTo(e,t,n,r),this}},{key:"bezierCurveTo",value:function(e,t,n,r,i,a){return this.currentPath.bezierCurveTo(e,t,n,r,i,a),this}},{key:"splineThru",value:function(e){return this.currentPath.splineThru(e),this}},{key:"toShapes",value:function(e){function t(e,t){for(var n=t.length,r=!1,i=n-1,a=0;a<n;i=a++){var o=t[i],s=t[a],u=s.x-o.x,l=s.y-o.y;if(Math.abs(l)>Number.EPSILON){if(l<0&&(o=t[a],u=-u,s=t[i],l=-l),e.y<o.y||e.y>s.y)continue;if(e.y===o.y){if(e.x===o.x)return!0}else{var c=l*(e.x-o.x)-u*(e.y-o.y);if(0===c)return!0;if(c<0)continue;r=!r}}else{if(e.y!==o.y)continue;if(s.x<=e.x&&e.x<=o.x||o.x<=e.x&&e.x<=s.x)return!0}}return r}var n,r,i,a=Uh.isClockWise,o=this.subPaths;if(0===o.length)return[];var s=[];if(1===o.length)return r=o[0],(i=new uh).curves=r.curves,s.push(i),s;var u=!a(o[0].getPoints());u=e?!u:u;var l,c,h=[],d=[],f=[],p=0;d[p]=void 0,f[p]=[];for(var v=0,m=o.length;v<m;v++)n=a(l=(r=o[v]).getPoints()),(n=e?!n:n)?(!u&&d[p]&&p++,d[p]={s:new uh,p:l},d[p].s.curves=r.curves,u&&p++,f[p]=[]):f[p].push({h:r,p:l[0]});if(!d[0])return function(e){for(var t=[],n=0,r=e.length;n<r;n++){var i=e[n],a=new uh;a.curves=i.curves,t.push(a)}return t}(o);if(d.length>1){for(var g=!1,y=0,_=0,x=d.length;_<x;_++)h[_]=[];for(var M=0,S=d.length;M<S;M++)for(var b=f[M],w=0;w<b.length;w++){for(var T=b[w],E=!0,A=0;A<d.length;A++)t(T.p,d[A].p)&&(M!==A&&y++,E?(E=!1,h[A].push(T)):g=!0);E&&h[M].push(T)}y>0&&!1===g&&(f=h)}for(var R=0,k=d.length;R<k;R++){i=d[R].s,s.push(i);for(var C=0,L=(c=f[R]).length;C<L;C++)i.holes.push(c[C].h)}return s}}]),e}();"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:k}})),"undefined"!=typeof window&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=k);var Xp={type:"change"},qp={type:"start"},Yp={type:"end"},Zp=new bi,Kp=new wo,Jp=Math.cos(70*vr.DEG2RAD),Qp=function(e){w(n,e);var t=E(n);function n(e,r){var i,o,s,u,l,c,h,d;a(this,n),(i=t.call(this)).object=e,i.domElement=r,i.domElement.style.touchAction="none",i.enabled=!0,i.target=new Yr,i.minDistance=0,i.maxDistance=1/0,i.minZoom=0,i.maxZoom=1/0,i.minPolarAngle=0,i.maxPolarAngle=Math.PI,i.minAzimuthAngle=-1/0,i.maxAzimuthAngle=1/0,i.enableDamping=!1,i.dampingFactor=.05,i.enableZoom=!0,i.zoomSpeed=1,i.enableRotate=!0,i.rotateSpeed=1,i.enablePan=!0,i.panSpeed=1,i.screenSpacePanning=!0,i.keyPanSpeed=7,i.zoomToCursor=!1,i.autoRotate=!1,i.autoRotateSpeed=2,i.keys={LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"},i.mouseButtons={LEFT:C.ROTATE,MIDDLE:C.DOLLY,RIGHT:C.PAN},i.touches={ONE:L.ROTATE,TWO:L.DOLLY_PAN},i.target0=i.target.clone(),i.position0=i.object.position.clone(),i.zoom0=i.object.zoom,i._domElementKeyEvents=null,i.getPolarAngle=function(){return g.phi},i.getAzimuthalAngle=function(){return g.theta},i.getDistance=function(){return this.object.position.distanceTo(this.target)},i.listenToKeyEvents=function(e){e.addEventListener("keydown",se),this._domElementKeyEvents=e},i.stopListenToKeyEvents=function(){this._domElementKeyEvents.removeEventListener("keydown",se),this._domElementKeyEvents=null},i.saveState=function(){f.target0.copy(f.target),f.position0.copy(f.object.position),f.zoom0=f.object.zoom},i.reset=function(){f.target.copy(f.target0),f.object.position.copy(f.position0),f.object.zoom=f.zoom0,f.object.updateProjectionMatrix(),f.dispatchEvent(Xp),f.update(),v=p.NONE},i.update=(o=new Yr,s=(new qr).setFromUnitVectors(e.up,new Yr(0,1,0)),u=s.clone().invert(),l=new Yr,c=new qr,h=new Yr,d=2*Math.PI,function(){var t=f.object.position;o.copy(t).sub(f.target),o.applyQuaternion(s),g.setFromVector3(o),f.autoRotate&&v===p.NONE&&B(2*Math.PI/60/60*f.autoRotateSpeed),f.enableDamping?(g.theta+=y.theta*f.dampingFactor,g.phi+=y.phi*f.dampingFactor):(g.theta+=y.theta,g.phi+=y.phi);var n=f.minAzimuthAngle,r=f.maxAzimuthAngle;isFinite(n)&&isFinite(r)&&(n<-Math.PI?n+=d:n>Math.PI&&(n-=d),r<-Math.PI?r+=d:r>Math.PI&&(r-=d),g.theta=n<=r?Math.max(n,Math.min(r,g.theta)):g.theta>(n+r)/2?Math.max(n,g.theta):Math.min(r,g.theta)),g.phi=Math.max(f.minPolarAngle,Math.min(f.maxPolarAngle,g.phi)),g.makeSafe(),!0===f.enableDamping?f.target.addScaledVector(x,f.dampingFactor):f.target.add(x),f.zoomToCursor&&U||f.object.isOrthographicCamera?g.radius=Y(g.radius):g.radius=Y(g.radius*_),o.setFromSpherical(g),o.applyQuaternion(u),t.copy(f.target).add(o),f.object.lookAt(f.target),!0===f.enableDamping?(y.theta*=1-f.dampingFactor,y.phi*=1-f.dampingFactor,x.multiplyScalar(1-f.dampingFactor)):(y.set(0,0,0),x.set(0,0,0));var i=!1;if(f.zoomToCursor&&U){var a=null;if(f.object.isPerspectiveCamera){var M=o.length(),S=M-(a=Y(M*_));f.object.position.addScaledVector(I,S),f.object.updateMatrixWorld()}else if(f.object.isOrthographicCamera){var b=new Yr(D.x,D.y,0);b.unproject(f.object),f.object.zoom=Math.max(f.minZoom,Math.min(f.maxZoom,f.object.zoom/_)),f.object.updateProjectionMatrix(),i=!0;var w=new Yr(D.x,D.y,0);w.unproject(f.object),f.object.position.sub(w).add(b),f.object.updateMatrixWorld(),a=o.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),f.zoomToCursor=!1;null!==a&&(this.screenSpacePanning?f.target.set(0,0,-1).transformDirection(f.object.matrix).multiplyScalar(a).add(f.object.position):(Zp.origin.copy(f.object.position),Zp.direction.set(0,0,-1).transformDirection(f.object.matrix),Math.abs(f.object.up.dot(Zp.direction))<Jp?e.lookAt(f.target):(Kp.setFromNormalAndCoplanarPoint(f.object.up,f.target),Zp.intersectPlane(Kp,f.target))))}else f.object.isOrthographicCamera&&(f.object.zoom=Math.max(f.minZoom,Math.min(f.maxZoom,f.object.zoom/_)),f.object.updateProjectionMatrix(),i=!0);return _=1,U=!1,!!(i||l.distanceToSquared(f.object.position)>m||8*(1-c.dot(f.object.quaternion))>m||h.distanceToSquared(f.target)>0)&&(f.dispatchEvent(Xp),l.copy(f.object.position),c.copy(f.object.quaternion),h.copy(f.target),i=!1,!0)}),i.dispose=function(){f.domElement.removeEventListener("contextmenu",ue),f.domElement.removeEventListener("pointerdown",re),f.domElement.removeEventListener("pointercancel",ae),f.domElement.removeEventListener("wheel",oe),f.domElement.removeEventListener("pointermove",ie),f.domElement.removeEventListener("pointerup",ae),null!==f._domElementKeyEvents&&(f._domElementKeyEvents.removeEventListener("keydown",se),f._domElementKeyEvents=null)};var f=S(i),p={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6},v=p.NONE,m=1e-6,g=new sp,y=new sp,_=1,x=new Yr,M=new mr,b=new mr,w=new mr,T=new mr,E=new mr,A=new mr,R=new mr,k=new mr,P=new mr,I=new Yr,D=new mr,U=!1,O=[],N={};function F(){return Math.pow(.95,f.zoomSpeed)}function B(e){y.theta-=e}function z(e){y.phi-=e}var H,G=(H=new Yr,function(e,t){H.setFromMatrixColumn(t,0),H.multiplyScalar(-e),x.add(H)}),V=function(){var e=new Yr;return function(t,n){!0===f.screenSpacePanning?e.setFromMatrixColumn(n,1):(e.setFromMatrixColumn(n,0),e.crossVectors(f.object.up,e)),e.multiplyScalar(t),x.add(e)}}(),W=function(){var e=new Yr;return function(t,n){var r=f.domElement;if(f.object.isPerspectiveCamera){var i=f.object.position;e.copy(i).sub(f.target);var a=e.length();a*=Math.tan(f.object.fov/2*Math.PI/180),G(2*t*a/r.clientHeight,f.object.matrix),V(2*n*a/r.clientHeight,f.object.matrix)}else f.object.isOrthographicCamera?(G(t*(f.object.right-f.object.left)/f.object.zoom/r.clientWidth,f.object.matrix),V(n*(f.object.top-f.object.bottom)/f.object.zoom/r.clientHeight,f.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),f.enablePan=!1)}}();function j(e){f.object.isPerspectiveCamera||f.object.isOrthographicCamera?_/=e:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),f.enableZoom=!1)}function X(e){f.object.isPerspectiveCamera||f.object.isOrthographicCamera?_*=e:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),f.enableZoom=!1)}function q(t){if(f.zoomToCursor){U=!0;var n=f.domElement.getBoundingClientRect(),r=t.clientX-n.left,i=t.clientY-n.top,a=n.width,o=n.height;D.x=r/a*2-1,D.y=-i/o*2+1,I.set(D.x,D.y,1).unproject(e).sub(e.position).normalize()}}function Y(e){return Math.max(f.minDistance,Math.min(f.maxDistance,e))}function Z(e){M.set(e.clientX,e.clientY)}function K(e){T.set(e.clientX,e.clientY)}function J(){if(1===O.length)M.set(O[0].pageX,O[0].pageY);else{var e=.5*(O[0].pageX+O[1].pageX),t=.5*(O[0].pageY+O[1].pageY);M.set(e,t)}}function Q(){if(1===O.length)T.set(O[0].pageX,O[0].pageY);else{var e=.5*(O[0].pageX+O[1].pageX),t=.5*(O[0].pageY+O[1].pageY);T.set(e,t)}}function $(){var e=O[0].pageX-O[1].pageX,t=O[0].pageY-O[1].pageY,n=Math.sqrt(e*e+t*t);R.set(0,n)}function ee(e){if(1==O.length)b.set(e.pageX,e.pageY);else{var t=ce(e),n=.5*(e.pageX+t.x),r=.5*(e.pageY+t.y);b.set(n,r)}w.subVectors(b,M).multiplyScalar(f.rotateSpeed);var i=f.domElement;B(2*Math.PI*w.x/i.clientHeight),z(2*Math.PI*w.y/i.clientHeight),M.copy(b)}function te(e){if(1===O.length)E.set(e.pageX,e.pageY);else{var t=ce(e),n=.5*(e.pageX+t.x),r=.5*(e.pageY+t.y);E.set(n,r)}A.subVectors(E,T).multiplyScalar(f.panSpeed),W(A.x,A.y),T.copy(E)}function ne(e){var t=ce(e),n=e.pageX-t.x,r=e.pageY-t.y,i=Math.sqrt(n*n+r*r);k.set(0,i),P.set(0,Math.pow(k.y/R.y,f.zoomSpeed)),j(P.y),R.copy(k)}function re(e){!1!==f.enabled&&(0===O.length&&(f.domElement.setPointerCapture(e.pointerId),f.domElement.addEventListener("pointermove",ie),f.domElement.addEventListener("pointerup",ae)),function(e){O.push(e)}(e),"touch"===e.pointerType?function(e){switch(le(e),O.length){case 1:switch(f.touches.ONE){case L.ROTATE:if(!1===f.enableRotate)return;J(),v=p.TOUCH_ROTATE;break;case L.PAN:if(!1===f.enablePan)return;Q(),v=p.TOUCH_PAN;break;default:v=p.NONE}break;case 2:switch(f.touches.TWO){case L.DOLLY_PAN:if(!1===f.enableZoom&&!1===f.enablePan)return;f.enableZoom&&$(),f.enablePan&&Q(),v=p.TOUCH_DOLLY_PAN;break;case L.DOLLY_ROTATE:if(!1===f.enableZoom&&!1===f.enableRotate)return;f.enableZoom&&$(),f.enableRotate&&J(),v=p.TOUCH_DOLLY_ROTATE;break;default:v=p.NONE}break;default:v=p.NONE}v!==p.NONE&&f.dispatchEvent(qp)}(e):function(e){var t;switch(e.button){case 0:t=f.mouseButtons.LEFT;break;case 1:t=f.mouseButtons.MIDDLE;break;case 2:t=f.mouseButtons.RIGHT;break;default:t=-1}switch(t){case C.DOLLY:if(!1===f.enableZoom)return;!function(e){q(e),R.set(e.clientX,e.clientY)}(e),v=p.DOLLY;break;case C.ROTATE:if(e.ctrlKey||e.metaKey||e.shiftKey){if(!1===f.enablePan)return;K(e),v=p.PAN}else{if(!1===f.enableRotate)return;Z(e),v=p.ROTATE}break;case C.PAN:if(e.ctrlKey||e.metaKey||e.shiftKey){if(!1===f.enableRotate)return;Z(e),v=p.ROTATE}else{if(!1===f.enablePan)return;K(e),v=p.PAN}break;default:v=p.NONE}v!==p.NONE&&f.dispatchEvent(qp)}(e))}function ie(e){!1!==f.enabled&&("touch"===e.pointerType?function(e){switch(le(e),v){case p.TOUCH_ROTATE:if(!1===f.enableRotate)return;ee(e),f.update();break;case p.TOUCH_PAN:if(!1===f.enablePan)return;te(e),f.update();break;case p.TOUCH_DOLLY_PAN:if(!1===f.enableZoom&&!1===f.enablePan)return;!function(e){f.enableZoom&&ne(e),f.enablePan&&te(e)}(e),f.update();break;case p.TOUCH_DOLLY_ROTATE:if(!1===f.enableZoom&&!1===f.enableRotate)return;!function(e){f.enableZoom&&ne(e),f.enableRotate&&ee(e)}(e),f.update();break;default:v=p.NONE}}(e):function(e){switch(v){case p.ROTATE:if(!1===f.enableRotate)return;!function(e){b.set(e.clientX,e.clientY),w.subVectors(b,M).multiplyScalar(f.rotateSpeed);var t=f.domElement;B(2*Math.PI*w.x/t.clientHeight),z(2*Math.PI*w.y/t.clientHeight),M.copy(b),f.update()}(e);break;case p.DOLLY:if(!1===f.enableZoom)return;!function(e){k.set(e.clientX,e.clientY),P.subVectors(k,R),P.y>0?j(F()):P.y<0&&X(F()),R.copy(k),f.update()}(e);break;case p.PAN:if(!1===f.enablePan)return;!function(e){E.set(e.clientX,e.clientY),A.subVectors(E,T).multiplyScalar(f.panSpeed),W(A.x,A.y),T.copy(E),f.update()}(e)}}(e))}function ae(e){!function(e){delete N[e.pointerId];for(var t=0;t<O.length;t++)if(O[t].pointerId==e.pointerId)return void O.splice(t,1)}(e),0===O.length&&(f.domElement.releasePointerCapture(e.pointerId),f.domElement.removeEventListener("pointermove",ie),f.domElement.removeEventListener("pointerup",ae)),f.dispatchEvent(Yp),v=p.NONE}function oe(e){!1!==f.enabled&&!1!==f.enableZoom&&v===p.NONE&&(e.preventDefault(),f.dispatchEvent(qp),function(e){q(e),e.deltaY<0?X(F()):e.deltaY>0&&j(F()),f.update()}(e),f.dispatchEvent(Yp))}function se(e){!1!==f.enabled&&!1!==f.enablePan&&function(e){var t=!1;switch(e.code){case f.keys.UP:e.ctrlKey||e.metaKey||e.shiftKey?z(2*Math.PI*f.rotateSpeed/f.domElement.clientHeight):W(0,f.keyPanSpeed),t=!0;break;case f.keys.BOTTOM:e.ctrlKey||e.metaKey||e.shiftKey?z(-2*Math.PI*f.rotateSpeed/f.domElement.clientHeight):W(0,-f.keyPanSpeed),t=!0;break;case f.keys.LEFT:e.ctrlKey||e.metaKey||e.shiftKey?B(2*Math.PI*f.rotateSpeed/f.domElement.clientHeight):W(f.keyPanSpeed,0),t=!0;break;case f.keys.RIGHT:e.ctrlKey||e.metaKey||e.shiftKey?B(-2*Math.PI*f.rotateSpeed/f.domElement.clientHeight):W(-f.keyPanSpeed,0),t=!0}t&&(e.preventDefault(),f.update())}(e)}function ue(e){!1!==f.enabled&&e.preventDefault()}function le(e){var t=N[e.pointerId];void 0===t&&(t=new mr,N[e.pointerId]=t),t.set(e.pageX,e.pageY)}function ce(e){var t=e.pointerId===O[0].pointerId?O[1]:O[0];return N[t.pointerId]}return f.domElement.addEventListener("contextmenu",ue),f.domElement.addEventListener("pointerdown",re),f.domElement.addEventListener("pointercancel",ae),f.domElement.addEventListener("wheel",oe,{passive:!1}),i.update(),i}return s(n)}(tr),$p=n(64),ev=Object.freeze({Linear:Object.freeze({None:function(e){return e},In:function(e){return this.None(e)},Out:function(e){return this.None(e)},InOut:function(e){return this.None(e)}}),Quadratic:Object.freeze({In:function(e){return e*e},Out:function(e){return e*(2-e)},InOut:function(e){return(e*=2)<1?.5*e*e:-.5*(--e*(e-2)-1)}}),Cubic:Object.freeze({In:function(e){return e*e*e},Out:function(e){return--e*e*e+1},InOut:function(e){return(e*=2)<1?.5*e*e*e:.5*((e-=2)*e*e+2)}}),Quartic:Object.freeze({In:function(e){return e*e*e*e},Out:function(e){return 1- --e*e*e*e},InOut:function(e){return(e*=2)<1?.5*e*e*e*e:-.5*((e-=2)*e*e*e-2)}}),Quintic:Object.freeze({In:function(e){return e*e*e*e*e},Out:function(e){return--e*e*e*e*e+1},InOut:function(e){return(e*=2)<1?.5*e*e*e*e*e:.5*((e-=2)*e*e*e*e+2)}}),Sinusoidal:Object.freeze({In:function(e){return 1-Math.sin((1-e)*Math.PI/2)},Out:function(e){return Math.sin(e*Math.PI/2)},InOut:function(e){return.5*(1-Math.sin(Math.PI*(.5-e)))}}),Exponential:Object.freeze({In:function(e){return 0===e?0:Math.pow(1024,e-1)},Out:function(e){return 1===e?1:1-Math.pow(2,-10*e)},InOut:function(e){return 0===e?0:1===e?1:(e*=2)<1?.5*Math.pow(1024,e-1):.5*(2-Math.pow(2,-10*(e-1)))}}),Circular:Object.freeze({In:function(e){return 1-Math.sqrt(1-e*e)},Out:function(e){return Math.sqrt(1- --e*e)},InOut:function(e){return(e*=2)<1?-.5*(Math.sqrt(1-e*e)-1):.5*(Math.sqrt(1-(e-=2)*e)+1)}}),Elastic:Object.freeze({In:function(e){return 0===e?0:1===e?1:-Math.pow(2,10*(e-1))*Math.sin(5*(e-1.1)*Math.PI)},Out:function(e){return 0===e?0:1===e?1:Math.pow(2,-10*e)*Math.sin(5*(e-.1)*Math.PI)+1},InOut:function(e){return 0===e?0:1===e?1:(e*=2)<1?-.5*Math.pow(2,10*(e-1))*Math.sin(5*(e-1.1)*Math.PI):.5*Math.pow(2,-10*(e-1))*Math.sin(5*(e-1.1)*Math.PI)+1}}),Back:Object.freeze({In:function(e){var t=1.70158;return 1===e?1:e*e*((t+1)*e-t)},Out:function(e){var t=1.70158;return 0===e?0:--e*e*((t+1)*e+t)+1},InOut:function(e){var t=2.5949095;return(e*=2)<1?e*e*((t+1)*e-t)*.5:.5*((e-=2)*e*((t+1)*e+t)+2)}}),Bounce:Object.freeze({In:function(e){return 1-ev.Bounce.Out(1-e)},Out:function(e){return e<1/2.75?7.5625*e*e:e<2/2.75?7.5625*(e-=1.5/2.75)*e+.75:e<2.5/2.75?7.5625*(e-=2.25/2.75)*e+.9375:7.5625*(e-=2.625/2.75)*e+.984375},InOut:function(e){return e<.5?.5*ev.Bounce.In(2*e):.5*ev.Bounce.Out(2*e-1)+.5}}),generatePow:function(e){return void 0===e&&(e=4),e=(e=e<Number.EPSILON?Number.EPSILON:e)>1e4?1e4:e,{In:function(t){return Math.pow(t,e)},Out:function(t){return 1-Math.pow(1-t,e)},InOut:function(t){return t<.5?Math.pow(2*t,e)/2:(1-Math.pow(2-2*t,e))/2+.5}}}}),tv=function(){return performance.now()},nv=function(){function e(){this._tweens={},this._tweensAddedDuringUpdate={}}return e.prototype.getAll=function(){var e=this;return Object.keys(this._tweens).map((function(t){return e._tweens[t]}))},e.prototype.removeAll=function(){this._tweens={}},e.prototype.add=function(e){this._tweens[e.getId()]=e,this._tweensAddedDuringUpdate[e.getId()]=e},e.prototype.remove=function(e){delete this._tweens[e.getId()],delete this._tweensAddedDuringUpdate[e.getId()]},e.prototype.update=function(e,t){void 0===e&&(e=tv()),void 0===t&&(t=!1);var n=Object.keys(this._tweens);if(0===n.length)return!1;for(;n.length>0;){this._tweensAddedDuringUpdate={};for(var r=0;r<n.length;r++){var i=this._tweens[n[r]],a=!t;i&&!1===i.update(e,a)&&!t&&delete this._tweens[n[r]]}n=Object.keys(this._tweensAddedDuringUpdate)}return!0},e}(),rv={Linear:function(e,t){var n=e.length-1,r=n*t,i=Math.floor(r),a=rv.Utils.Linear;return t<0?a(e[0],e[1],r):t>1?a(e[n],e[n-1],n-r):a(e[i],e[i+1>n?n:i+1],r-i)},Bezier:function(e,t){for(var n=0,r=e.length-1,i=Math.pow,a=rv.Utils.Bernstein,o=0;o<=r;o++)n+=i(1-t,r-o)*i(t,o)*e[o]*a(r,o);return n},CatmullRom:function(e,t){var n=e.length-1,r=n*t,i=Math.floor(r),a=rv.Utils.CatmullRom;return e[0]===e[n]?(t<0&&(i=Math.floor(r=n*(1+t))),a(e[(i-1+n)%n],e[i],e[(i+1)%n],e[(i+2)%n],r-i)):t<0?e[0]-(a(e[0],e[0],e[1],e[1],-r)-e[0]):t>1?e[n]-(a(e[n],e[n],e[n-1],e[n-1],r-n)-e[n]):a(e[i?i-1:0],e[i],e[n<i+1?n:i+1],e[n<i+2?n:i+2],r-i)},Utils:{Linear:function(e,t,n){return(t-e)*n+e},Bernstein:function(e,t){var n=rv.Utils.Factorial;return n(e)/n(t)/n(e-t)},Factorial:function(){var e=[1];return function(t){var n=1;if(e[t])return e[t];for(var r=t;r>1;r--)n*=r;return e[t]=n,n}}(),CatmullRom:function(e,t,n,r,i){var a=.5*(n-e),o=.5*(r-t),s=i*i;return(2*t-2*n+a+o)*(i*s)+(-3*t+3*n-2*a-o)*s+a*i+t}}},iv=function(){function e(){}return e.nextId=function(){return e._nextId++},e._nextId=0,e}(),av=new nv,ov=function(){function e(e,t){void 0===t&&(t=av),this._object=e,this._group=t,this._isPaused=!1,this._pauseStart=0,this._valuesStart={},this._valuesEnd={},this._valuesStartRepeat={},this._duration=1e3,this._isDynamic=!1,this._initialRepeat=0,this._repeat=0,this._yoyo=!1,this._isPlaying=!1,this._reversed=!1,this._delayTime=0,this._startTime=0,this._easingFunction=ev.Linear.None,this._interpolationFunction=rv.Linear,this._chainedTweens=[],this._onStartCallbackFired=!1,this._onEveryStartCallbackFired=!1,this._id=iv.nextId(),this._isChainStopped=!1,this._propertiesAreSetUp=!1,this._goToEnd=!1}return e.prototype.getId=function(){return this._id},e.prototype.isPlaying=function(){return this._isPlaying},e.prototype.isPaused=function(){return this._isPaused},e.prototype.to=function(e,t){if(void 0===t&&(t=1e3),this._isPlaying)throw new Error("Can not call Tween.to() while Tween is already started or paused. Stop the Tween first.");return this._valuesEnd=e,this._propertiesAreSetUp=!1,this._duration=t,this},e.prototype.duration=function(e){return void 0===e&&(e=1e3),this._duration=e,this},e.prototype.dynamic=function(e){return void 0===e&&(e=!1),this._isDynamic=e,this},e.prototype.start=function(e,t){if(void 0===e&&(e=tv()),void 0===t&&(t=!1),this._isPlaying)return this;if(this._group&&this._group.add(this),this._repeat=this._initialRepeat,this._reversed)for(var n in this._reversed=!1,this._valuesStartRepeat)this._swapEndStartRepeatValues(n),this._valuesStart[n]=this._valuesStartRepeat[n];if(this._isPlaying=!0,this._isPaused=!1,this._onStartCallbackFired=!1,this._onEveryStartCallbackFired=!1,this._isChainStopped=!1,this._startTime=e,this._startTime+=this._delayTime,!this._propertiesAreSetUp||t){if(this._propertiesAreSetUp=!0,!this._isDynamic){var r={};for(var i in this._valuesEnd)r[i]=this._valuesEnd[i];this._valuesEnd=r}this._setupProperties(this._object,this._valuesStart,this._valuesEnd,this._valuesStartRepeat,t)}return this},e.prototype.startFromCurrentValues=function(e){return this.start(e,!0)},e.prototype._setupProperties=function(e,t,n,r,i){for(var a in n){var o=e[a],s=Array.isArray(o),u=s?"array":$p(o),l=!s&&Array.isArray(n[a]);if("undefined"!==u&&"function"!==u){if(l){if(0===(m=n[a]).length)continue;for(var c=[o],h=0,d=m.length;h<d;h+=1){var f=this._handleRelativeValue(o,m[h]);if(isNaN(f)){l=!1,console.warn("Found invalid interpolation list. Skipping.");break}c.push(f)}l&&(n[a]=c)}if("object"!==u&&!s||!o||l)(void 0===t[a]||i)&&(t[a]=o),s||(t[a]*=1),r[a]=l?n[a].slice().reverse():t[a]||0;else{t[a]=s?[]:{};var p=o;for(var v in p)t[a][v]=p[v];r[a]=s?[]:{};var m=n[a];if(!this._isDynamic){var g={};for(var v in m)g[v]=m[v];n[a]=m=g}this._setupProperties(p,t[a],m,r[a],i)}}}},e.prototype.stop=function(){return this._isChainStopped||(this._isChainStopped=!0,this.stopChainedTweens()),this._isPlaying?(this._group&&this._group.remove(this),this._isPlaying=!1,this._isPaused=!1,this._onStopCallback&&this._onStopCallback(this._object),this):this},e.prototype.end=function(){return this._goToEnd=!0,this.update(1/0),this},e.prototype.pause=function(e){return void 0===e&&(e=tv()),this._isPaused||!this._isPlaying||(this._isPaused=!0,this._pauseStart=e,this._group&&this._group.remove(this)),this},e.prototype.resume=function(e){return void 0===e&&(e=tv()),this._isPaused&&this._isPlaying?(this._isPaused=!1,this._startTime+=e-this._pauseStart,this._pauseStart=0,this._group&&this._group.add(this),this):this},e.prototype.stopChainedTweens=function(){for(var e=0,t=this._chainedTweens.length;e<t;e++)this._chainedTweens[e].stop();return this},e.prototype.group=function(e){return void 0===e&&(e=av),this._group=e,this},e.prototype.delay=function(e){return void 0===e&&(e=0),this._delayTime=e,this},e.prototype.repeat=function(e){return void 0===e&&(e=0),this._initialRepeat=e,this._repeat=e,this},e.prototype.repeatDelay=function(e){return this._repeatDelayTime=e,this},e.prototype.yoyo=function(e){return void 0===e&&(e=!1),this._yoyo=e,this},e.prototype.easing=function(e){return void 0===e&&(e=ev.Linear.None),this._easingFunction=e,this},e.prototype.interpolation=function(e){return void 0===e&&(e=rv.Linear),this._interpolationFunction=e,this},e.prototype.chain=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return this._chainedTweens=e,this},e.prototype.onStart=function(e){return this._onStartCallback=e,this},e.prototype.onEveryStart=function(e){return this._onEveryStartCallback=e,this},e.prototype.onUpdate=function(e){return this._onUpdateCallback=e,this},e.prototype.onRepeat=function(e){return this._onRepeatCallback=e,this},e.prototype.onComplete=function(e){return this._onCompleteCallback=e,this},e.prototype.onStop=function(e){return this._onStopCallback=e,this},e.prototype.update=function(e,t){if(void 0===e&&(e=tv()),void 0===t&&(t=!0),this._isPaused)return!0;var n,r,i=this._startTime+this._duration;if(!this._goToEnd&&!this._isPlaying){if(e>i)return!1;t&&this.start(e,!0)}if(this._goToEnd=!1,e<this._startTime)return!0;!1===this._onStartCallbackFired&&(this._onStartCallback&&this._onStartCallback(this._object),this._onStartCallbackFired=!0),!1===this._onEveryStartCallbackFired&&(this._onEveryStartCallback&&this._onEveryStartCallback(this._object),this._onEveryStartCallbackFired=!0),r=(e-this._startTime)/this._duration,r=0===this._duration||r>1?1:r;var a=this._easingFunction(r);if(this._updateProperties(this._object,this._valuesStart,this._valuesEnd,a),this._onUpdateCallback&&this._onUpdateCallback(this._object,r),1===r){if(this._repeat>0){for(n in isFinite(this._repeat)&&this._repeat--,this._valuesStartRepeat)this._yoyo||"string"!=typeof this._valuesEnd[n]||(this._valuesStartRepeat[n]=this._valuesStartRepeat[n]+parseFloat(this._valuesEnd[n])),this._yoyo&&this._swapEndStartRepeatValues(n),this._valuesStart[n]=this._valuesStartRepeat[n];return this._yoyo&&(this._reversed=!this._reversed),void 0!==this._repeatDelayTime?this._startTime=e+this._repeatDelayTime:this._startTime=e+this._delayTime,this._onRepeatCallback&&this._onRepeatCallback(this._object),this._onEveryStartCallbackFired=!1,!0}this._onCompleteCallback&&this._onCompleteCallback(this._object);for(var o=0,s=this._chainedTweens.length;o<s;o++)this._chainedTweens[o].start(this._startTime+this._duration,!1);return this._isPlaying=!1,!1}return!0},e.prototype._updateProperties=function(e,t,n,r){for(var i in n)if(void 0!==t[i]){var a=t[i]||0,o=n[i],s=Array.isArray(e[i]),u=Array.isArray(o);!s&&u?e[i]=this._interpolationFunction(o,r):"object"===$p(o)&&o?this._updateProperties(e[i],a,o,r):"number"==typeof(o=this._handleRelativeValue(a,o))&&(e[i]=a+(o-a)*r)}},e.prototype._handleRelativeValue=function(e,t){return"string"!=typeof t?t:"+"===t.charAt(0)||"-"===t.charAt(0)?e+parseFloat(t):parseFloat(t)},e.prototype._swapEndStartRepeatValues=function(e){var t=this._valuesStartRepeat[e],n=this._valuesEnd[e];this._valuesStartRepeat[e]="string"==typeof n?this._valuesStartRepeat[e]+parseFloat(n):this._valuesEnd[e],this._valuesEnd[e]=t},e}(),sv=(iv.nextId,av),uv=(sv.getAll.bind(sv),sv.removeAll.bind(sv),sv.add.bind(sv),sv.remove.bind(sv),sv.update.bind(sv));var lv,cv,hv,dv={all:lv=lv||new Map,on:function(e,t){var n=lv.get(e);n?n.push(t):lv.set(e,[t])},off:function(e,t){var n=lv.get(e);n&&(t?n.splice(n.indexOf(t)>>>0,1):lv.set(e,[]))},emit:function(e,t){var n=lv.get(e);n&&n.slice().map((function(e){e(t)})),(n=lv.get("*"))&&n.slice().map((function(n){n(e,t)}))}},fv={on:dv.on,off:dv.off,emit:dv.emit,all:dv.all},pv=function(e){for(var t="",n=0;n<e.length;n++){var r=e[n];r===r.toUpperCase()?t+="-".concat(r.toLowerCase()):t+=r}return t&&"-"===t[0]&&(t=t.slice(1)),t},vv=function(){function e(){o()(this,e),c()(this,"scene",null),c()(this,"triggerClick",!1),c()(this,"camera",null),c()(this,"domElement",null),c()(this,"orbitControls",null),c()(this,"transformControls",[]),c()(this,"frameCallbacks",new Set),c()(this,"groupCatch",[])}return u()(e,[{key:"addScene",value:function(e){this.scene=e}},{key:"setCamera",value:function(e){this.camera=e}},{key:"setDomElement",value:function(e){this.domElement=e}},{key:"setOrbitControls",value:function(e){this.orbitControls=e}},{key:"setTransformControls",value:function(e){this.transformControls.push(e)}},{key:"setTriggerClickState",value:function(e){this.triggerClick=e}},{key:"addFrameCallback",value:function(e){this.frameCallbacks.add(e)}},{key:"removeFrameCallback",value:function(e){this.frameCallbacks.delete(e)}},{key:"addCatch",value:function(e){this.groupCatch.push(e)}}]),e}(),mv=new vv,gv=function(e){T()(n,e);var t=A()(n);function n(e,r){var i;return o()(this,n),i=t.call(this,e,r),c()(b()(i),"natureEventMap",new Map),c()(b()(i),"entered",!1),i}return u()(n,[{key:"addNatureEventListener",value:function(e,t){this.natureEventMap.has(e)||this.natureEventMap.set(e,[]),this.natureEventMap.get(e).push(t)}},{key:"removeNatureEventListener",value:function(e,t){if(this.natureEventMap.has(e)){var n=this.natureEventMap.get(e),r=n.findIndex((function(e){return e===t}));r>-1&&n.splice(r,1)}}},{key:"removeAllNatureEventListener",value:function(){this.natureEventMap.clear()}},{key:"handleClick",value:function(e,t){var n=this;mv.triggerClick&&e.forEach((function(e){e(n,t)}))}},{key:"handlePointerMove",value:function(e,t){var n=this;e.forEach((function(e){e(n,t)}))}},{key:"handlePointerleave",value:function(){var e=this,t=this.natureEventMap.get("pointerleave");t&&t.length>0&&t.forEach((function(t){t(e)}))}},{key:"raycast",value:function(e,t){if(0!==this.natureEventMap.size){_()(M()(n.prototype),"raycast",this).call(this,e,t);var r=this.natureEventMap.get("click"),i=this.natureEventMap.get("pointerup"),a=this.natureEventMap.get("pointerdown"),o=this.natureEventMap.get("pointermove"),s=t[0];(s&&s.object)===this?(this.entered=!0,r&&r.length>0&&this.handleClick(r,s),i&&i.length>0&&this.handleClick(i,s),a&&a.length>0&&this.handleClick(a,s),o&&o.length>0&&this.handlePointerMove(o,s)):this.entered&&(this.handlePointerleave(),this.entered=!1)}}}]),n}(oo),yv=gv,_v=function(e){w(n,e);var t=E(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:document.createElement("div");return a(this,n),(e=t.call(this)).isCSS2DObject=!0,e.element=r,e.element.style.position="absolute",e.element.style.userSelect="none",e.element.setAttribute("draggable",!1),e.center=new mr(.5,.5),e.addEventListener("removed",(function(){this.traverse((function(e){e.element instanceof Element&&null!==e.element.parentNode&&e.element.parentNode.removeChild(e.element)}))})),e}return s(n,[{key:"copy",value:function(e,t){return y(x(n.prototype),"copy",this).call(this,e,t),this.element=e.element.cloneNode(!0),this.center=e.center,this}}]),n}(Zi),xv=new Yr,Mv=new wi,Sv=new wi,bv=new Yr,wv=new Yr,Tv=s((function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};a(this,e);var n,r,i,o,s=this,u={objects:new WeakMap},l=void 0!==t.element?t.element:document.createElement("div");function c(e,t,n){if(e.isCSS2DObject){xv.setFromMatrixPosition(e.matrixWorld),xv.applyMatrix4(Sv);var r=!0===e.visible&&xv.z>=-1&&xv.z<=1&&!0===e.layers.test(n.layers);if(e.element.style.display=!0===r?"":"none",!0===r){e.onBeforeRender(s,t,n);var a=e.element;a.style.transform="translate("+-100*e.center.x+"%,"+-100*e.center.y+"%)translate("+(xv.x*i+i)+"px,"+(-xv.y*o+o)+"px)",a.parentNode!==l&&l.appendChild(a),e.onAfterRender(s,t,n)}var d={distanceToCameraSquared:h(n,e)};u.objects.set(e,d)}for(var f=0,p=e.children.length;f<p;f++)c(e.children[f],t,n)}function h(e,t){return bv.setFromMatrixPosition(e.matrixWorld),wv.setFromMatrixPosition(t.matrixWorld),bv.distanceToSquared(wv)}function d(e){var t=[];return e.traverse((function(e){e.isCSS2DObject&&t.push(e)})),t}function f(e){for(var t=d(e).sort((function(e,t){return e.renderOrder!==t.renderOrder?t.renderOrder-e.renderOrder:u.objects.get(e).distanceToCameraSquared-u.objects.get(t).distanceToCameraSquared})),n=t.length,r=0,i=t.length;r<i;r++)t[r].element.style.zIndex=n-r}l.style.overflow="hidden",this.domElement=l,this.getSize=function(){return{width:n,height:r}},this.render=function(e,t){!0===e.matrixWorldAutoUpdate&&e.updateMatrixWorld(),null===t.parent&&!0===t.matrixWorldAutoUpdate&&t.updateMatrixWorld(),Mv.copy(t.matrixWorldInverse),Sv.multiplyMatrices(t.projectionMatrix,Mv),c(e,e,t),f(e)},this.setSize=function(e,t){i=(n=e)/2,o=(r=t)/2,l.style.width=e+"px",l.style.height=t+"px"}})),Ev=new Yr,Av=new qr,Rv=new Yr,kv=new wi,Cv=new wi,Lv=s((function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};a(this,e);var n,r,i,o,s=this,u={camera:{fov:0,style:""},objects:new WeakMap},l=void 0!==t.element?t.element:document.createElement("div");l.style.overflow="hidden",this.domElement=l;var c=document.createElement("div");c.style.transformOrigin="0 0",c.style.pointerEvents="none",l.appendChild(c);var h=document.createElement("div");function d(e){return Math.abs(e)<1e-10?0:e}function f(e){var t=e.elements;return"matrix3d("+d(t[0])+","+d(-t[1])+","+d(t[2])+","+d(t[3])+","+d(t[4])+","+d(-t[5])+","+d(t[6])+","+d(t[7])+","+d(t[8])+","+d(-t[9])+","+d(t[10])+","+d(t[11])+","+d(t[12])+","+d(-t[13])+","+d(t[14])+","+d(t[15])+")"}function p(e){var t=e.elements;return"translate(-50%,-50%)"+("matrix3d("+d(t[0])+","+d(t[1])+","+d(t[2])+","+d(t[3])+","+d(-t[4])+","+d(-t[5])+","+d(-t[6])+","+d(-t[7])+","+d(t[8])+","+d(t[9])+","+d(t[10])+","+d(t[11])+","+d(t[12])+","+d(t[13])+","+d(t[14])+","+d(t[15])+")")}function v(e,t,n,r){if(e.isCSS3DObject){var i=!0===e.visible&&!0===e.layers.test(n.layers);if(e.element.style.display=!0===i?"":"none",!0===i){var a;e.onBeforeRender(s,t,n),e.isCSS3DSprite?(kv.copy(n.matrixWorldInverse),kv.transpose(),0!==e.rotation2D&&kv.multiply(Cv.makeRotationZ(e.rotation2D)),e.matrixWorld.decompose(Ev,Av,Rv),kv.setPosition(Ev),kv.scale(Rv),kv.elements[3]=0,kv.elements[7]=0,kv.elements[11]=0,kv.elements[15]=1,a=p(kv)):a=p(e.matrixWorld);var o=e.element,l=u.objects.get(e);if(void 0===l||l.style!==a){o.style.transform=a;var c={style:a};u.objects.set(e,c)}o.parentNode!==h&&h.appendChild(o),e.onAfterRender(s,t,n)}}for(var d=0,f=e.children.length;d<f;d++)v(e.children[d],t,n,r)}h.style.transformStyle="preserve-3d",c.appendChild(h),this.getSize=function(){return{width:n,height:r}},this.render=function(e,t){var a,s,l=t.projectionMatrix.elements[5]*o;u.camera.fov!==l&&(c.style.perspective=t.isPerspectiveCamera?l+"px":"",u.camera.fov=l),t.view&&t.view.enabled?(c.style.transform="translate( ".concat(-t.view.offsetX*(n/t.view.width),"px, ").concat(-t.view.offsetY*(r/t.view.height),"px )"),c.style.transform+="scale( ".concat(t.view.fullWidth/t.view.width,", ").concat(t.view.fullHeight/t.view.height," )")):c.style.transform="",!0===e.matrixWorldAutoUpdate&&e.updateMatrixWorld(),null===t.parent&&!0===t.matrixWorldAutoUpdate&&t.updateMatrixWorld(),t.isOrthographicCamera&&(a=-(t.right+t.left)/2,s=(t.top+t.bottom)/2);var p=t.view&&t.view.enabled?t.view.height/t.view.fullHeight:1,m=t.isOrthographicCamera?"scale( ".concat(p," )")+"scale("+l+")translate("+d(a)+"px,"+d(s)+"px)"+f(t.matrixWorldInverse):"scale( ".concat(p," )")+"translateZ("+l+"px)"+f(t.matrixWorldInverse),g=m+"translate("+i+"px,"+o+"px)";u.camera.style!==g&&(h.style.transform=g,u.camera.style=g),v(e,e,t,m)},this.setSize=function(e,t){i=(n=e)/2,o=(r=t)/2,l.style.width=e+"px",l.style.height=t+"px",c.style.width=e+"px",c.style.height=t+"px",h.style.width=e+"px",h.style.height=t+"px"}})),Pv=function(){function e(t){o()(this,e),c()(this,"baseCssRenderer",new Tv),c()(this,"normalCssRenderer",new Lv),c()(this,"cssRenderer",void 0),this.cssRenderer="base"===t?this.baseCssRenderer:this.normalCssRenderer}return u()(e,[{key:"getSize",value:function(){return this.cssRenderer.getSize()}},{key:"setSize",value:function(e,t){this.cssRenderer.setSize(e,t)}},{key:"render",value:function(e,t){this.cssRenderer.render(e,t)}}]),e}(),Iv=Pv,Dv=new(function(){function e(){o()(this,e),c()(this,"callback",{}),c()(this,"task",new Map)}return u()(e,[{key:"update",value:function(){this.task.size>0&&f()(this.task.keys()).forEach((function(e){e()}))}},{key:"add",value:function(e,t){this.callback.cb=e,this.callback.duration=t||1e3}},{key:"remove",value:function(e){this.task.get(e)&&(clearTimeout(this.task.get(e)),this.task.delete(e))}},{key:"start",value:function(){if(!this.task.get(this.callback.cb)){var e=this.timerControl();this.task.set(this.callback.cb,e)}}},{key:"timerControl",value:function(){var e=this;return setTimeout((function(){e.task.delete(e.callback.cb)}),this.callback.duration)}}]),e}());cv||(cv={}),function(e){e.plus="plus",e.minus="minus"}(hv||(hv={}));var Uv=function(e,t,n,r,i,a){var o=t.position,s=e.position,u=o.clone().sub(s).normalize();r===hv.minus&&(u=u.negate());var l=s.clone().add(u.multiplyScalar(n)),c=s.distanceTo(o),h=s.distanceTo(l),d=l.clone();r===hv.plus&&h>c&&(d=o);var f=new ov(s);return f.to(d,i||1e3),f.start(),e instanceof Nv&&(Dv.add((function(){e.lookAt(o)}),1.01*(i||1e3)),Dv.start()),f},Ov=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:500,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{x:0,y:0,z:0},i=arguments.length>4?arguments[4]:void 0,a=t.getPoints(n),o=a.length,s=0,u=1,l=function(e){return e>o?e-o-1:e},c=function(){s>=o&&(s=l(s));var t=a[l(s)%o];e.position.set(t.x+r.x||0,t.y+r.y||0,t.z+r.z||0),i?e.lookAt(i):e.lookAt(a[l(s+1)%o]),s+=u};return Dv.add(c,1e5),Dv.start(),{remove:function(){return Dv.remove(c)},increaseSpeed:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;u=e+u},recoverSpeed:function(){u=1}}},Nv=function(e){T()(n,e);var t=A()(n);function n(e,r,i,a){var s;return o()(this,n),s=t.call(this,e,r,i,a),c()(b()(s),"demote",(function(e,t,n,r){return Uv(b()(s),e,t,hv.minus,n)})),c()(b()(s),"surround",(function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:5,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:500,r=arguments.length>4?arguments[4]:void 0,i=new Oc(f()(e),!0),a=(new Ga).setFromPoints(i.getPoints(t)),o=new ic({color:"#fff"}),u=new cc(a,o);return mv.scene.add(u),Ov(b()(s),i,n,r)})),s}return u()(n,[{key:"promote",value:function(e,t,n,r){return Uv(this,e,t,hv.plus,n)}}]),n}(mo),Fv=function(){function e(t){o()(this,e),c()(this,"opts",{}),c()(this,"pointer",new mr),c()(this,"scene",null),c()(this,"raycaster",null),c()(this,"ambientLight",null),c()(this,"camera",null),c()(this,"renderer",null),c()(this,"cssRenderer",null),c()(this,"controls",null),c()(this,"domElement",null),c()(this,"cutoutCamera",null),c()(this,"cutoutBackground",null),c()(this,"cutoutBackgroundAlpha",1),c()(this,"cutoutArea",{x:0,y:0,width:0,height:0}),this.opts=null!=t?t:{},this.scene=new dl,this.raycaster=new ip,mv.addScene(this.scene),this.defaultInit()}return u()(e,[{key:"defaultInit",value:function(){var e,t,n=this.initDefaultPerspectiveCamera();if(this.camera=n,mv.setCamera(n),this.scene.add(n),this.opts.css2DRenderer){var r=this.initCssRenderer();this.cssRenderer=r}if(this.opts.ambientLight){var i=this.initAmbientLight();this.ambientLight=i,this.scene.add(i)}null!==(e=this.opts.background)&&void 0!==e&&e.imgs&&this.initSkyBox(null===(t=this.opts.background)||void 0===t?void 0:t.imgs)}},{key:"resetScene",value:function(e,t){e.aspect=window.innerWidth/window.innerHeight,e.updateProjectionMatrix(),t.setSize(window.innerWidth,window.innerHeight),t.setPixelRatio(window.devicePixelRatio)}},{key:"initRenderer",value:function(){var e,t,n,r,i,a,o=this.opts.rendererOps||{},s=new sl({antialias:null===(e=o.antialias)||void 0===e||e,logarithmicDepthBuffer:null===(t=o.logarithmicDepthBuffer)||void 0===t||t,alpha:null!==(n=o.alpha)&&void 0!==n&&n});return this.cutMain(s),s.shadowMap.enabled=null===(r=o.shadowMap)||void 0===r||r,s.toneMapping=null!==(i=o.toneMapping)&&void 0!==i?i:Ae,s.toneMappingExposure=null!==(a=o.toneMappingExposure)&&void 0!==a?a:.3,s.setPixelRatio(window.devicePixelRatio),s}},{key:"cutMain",value:function(e){var t,n,r,i,a,o,s=this.opts.rendererOps||{},u=null!==(t=null===(n=s.size)||void 0===n?void 0:n.width)&&void 0!==t?t:window.innerWidth,l=null!==(r=null===(i=s.size)||void 0===i?void 0:i.height)&&void 0!==r?r:window.innerHeight;e.setClearColor((null===(a=this.opts.background)||void 0===a?void 0:a.color)||0,(null===(o=this.opts.background)||void 0===o?void 0:o.alpha)||1),e.setSize(u,l),e.setScissor(0,0,u,l),e.render(this.scene,this.camera)}},{key:"cutSub",value:function(e){var t,n,r,i=null!==(t=null===(n=(this.opts.rendererOps||{}).size)||void 0===n?void 0:n.width)&&void 0!==t?t:window.innerWidth;e.setClearColor(null!==(r=this.cutoutBackground)&&void 0!==r?r:0,this.cutoutBackgroundAlpha),e.setScissor(i-this.cutoutArea.width,0,this.cutoutArea.width,this.cutoutArea.height),e.setViewport(i-this.cutoutArea.width,0,this.cutoutArea.width,this.cutoutArea.height),e.render(this.scene,this.cutoutCamera)}},{key:"initCssRenderer",value:function(){var e,t,n,r,i=this.opts.rendererOps||{},a=null!==(e=null===(t=i.size)||void 0===t?void 0:t.width)&&void 0!==e?e:window.innerWidth,o=null!==(n=null===(r=i.size)||void 0===r?void 0:r.height)&&void 0!==n?n:window.innerHeight,s=new Iv("base");return s.setSize(a,o),s}},{key:"initSkyBox",value:function(e){var t=this;(new zd).load([e[0],e[1],e[2],e[3],e[4],e[5]],(function(e){t.scene.background=e}))}},{key:"initDefaultPerspectiveCamera",value:function(){var e=this.opts.defCameraOps||{},t=e.aspect||window.innerWidth/window.innerHeight,n=new Nv(e.fov||90,t,e.near||.1,e.far||5e3),r=e.position||new Yr(0,10,10);return n.position.set(r.x,r.y,r.z),n}},{key:"initAmbientLight",value:function(){var e=this.opts.defAmbientLightOps||{},t=e.position||new Yr(0,3,10),n=new af(e.color||16777215,e.intensity||1);return n.position.set(t.x,t.y,t.z),n}},{key:"startFrameAnimate",value:function(e){var t=this;if(!this.renderer||!this.scene||!this.camera)throw new Error("scene or camera or renderer is not init");e&&e(this.renderer),mv.frameCallbacks.size>0&&mv.frameCallbacks.forEach((function(e){e()})),Dv.update(),uv(),this.opts.cutout?this.updateRenderForCut():this.renderer.render(this.scene,this.camera),this.cssRenderer&&this.cssRenderer.render(this.scene,this.camera),this.controls&&this.controls.update(),requestAnimationFrame((function(){return t.startFrameAnimate(e)}))}},{key:"add",value:function(e){this.scene.add(e)}},{key:"updateRaycaster",value:function(){var e,t=this.opts.defRaycasterOps||{};this.raycaster.setFromCamera(this.pointer,this.camera);var n=this.scene.children.filter((function(e){return e instanceof yv}));this.raycaster.intersectObjects(n,null!==(e=t.recursive)&&void 0!==e&&e)}},{key:"getPointerPosition",value:function(e){var t=this.domElement;this.pointer.setX((e.clientX-t.getBoundingClientRect().left)/t.getBoundingClientRect().width*2-1),this.pointer.setY(-(e.clientY-t.getBoundingClientRect().top)/t.getBoundingClientRect().height*2+1)}},{key:"onPointerPointerup",value:function(e){mv.setTriggerClickState(!1);var t=mv.transformControls;t.length>0&&t.forEach((function(e){e.detach()})),this.getPointerPosition(e),this.updateRaycaster()}},{key:"onPointerDown",value:function(e){mv.setTriggerClickState(!0),this.getPointerPosition(e),this.updateRaycaster()}},{key:"onPointerMove",value:function(e){this.getPointerPosition(e),this.updateRaycaster()}},{key:"onPointerLeave",value:function(e){this.getPointerPosition(e),this.updateRaycaster()}},{key:"registerEvent",value:function(e){var t=this;e.addEventListener("pointerup",(function(e){return t.onPointerPointerup(e)})),e.addEventListener("pointerdown",(function(e){return t.onPointerDown(e)})),e.addEventListener("pointermove",(function(e){return t.onPointerMove(e)})),e.addEventListener("pointerleave",(function(e){return t.onPointerLeave(e)}))}},{key:"render",value:function(e){var t=this;fv.emit("before-render");var n=this.initRenderer();this.renderer=n;var r=null,i=this.renderer.domElement;this.domElement=i,this.cssRenderer&&(r=this.cssRenderer.cssRenderer.domElement,e.appendChild(r),r.style.position="absolute",r.style.top="0"),this.opts.orbitControls&&(this.controls=new Qp(this.camera,r||i),mv.setOrbitControls(this.controls)),mv.setDomElement(r||i),e.appendChild(i),this.registerEvent(r||i),e.addEventListener("resize",(function(){return t.resetScene(t.camera,t.renderer)})),fv.emit("after-render")}},{key:"updateRenderForCut",value:function(){this.renderer.setScissorTest(!0),this.cutMain(this.renderer),this.cutSub(this.renderer)}},{key:"destroy",value:function(){var e=this;window.removeEventListener("resize",(function(){return e.resetScene(e.camera,e.renderer)}))}}]),e}(),Bv=Fv,zv=function(e){T()(n,e);var t=A()(n);function n(){var e;return o()(this,n),e=t.call(this),c()(b()(e),"natureEventMap",new Map),c()(b()(e),"object3d",[]),mv.addCatch(b()(e)),e}return u()(n,[{key:"addModel",value:function(e){_()(M()(n.prototype),"add",this).call(this,e),this.object3d.push(e)}},{key:"addNatureEventListener",value:function(e,t){this.natureEventMap.has(e)||this.natureEventMap.set(e,[]),this.natureEventMap.get(e).push(t)}},{key:"removeNatureEventListener",value:function(e,t){if(this.natureEventMap.has(e)){var n=this.natureEventMap.get(e),r=n.findIndex((function(e){return e===t}));r>-1&&n.splice(r,1)}}},{key:"removeAllNatureEventListener",value:function(){this.natureEventMap.clear()}},{key:"handleClick",value:function(e){mv.triggerClick&&e.forEach((function(e){}))}},{key:"handlePointerMove",value:function(e){e.forEach((function(e){}))}},{key:"handlePointerleave",value:function(){var e=this.natureEventMap.get("pointerleave");e&&e.length>0&&e.forEach((function(e){}))}},{key:"raycastGroup",value:function(e){console.log("raycastGroup",e)}}]),n}($u),Hv=zv,Gv=new WeakMap,Vv=function(e){w(n,e);var t=E(n);function n(e){var r;return a(this,n),(r=t.call(this,e)).decoderPath="",r.decoderConfig={},r.decoderBinary=null,r.decoderPending=null,r.workerLimit=4,r.workerPool=[],r.workerNextTaskID=1,r.workerSourceURL="",r.defaultAttributeIDs={position:"POSITION",normal:"NORMAL",color:"COLOR",uv:"TEX_COORD"},r.defaultAttributeTypes={position:"Float32Array",normal:"Float32Array",color:"Float32Array",uv:"Float32Array"},r}return s(n,[{key:"setDecoderPath",value:function(e){return this.decoderPath=e,this}},{key:"setDecoderConfig",value:function(e){return this.decoderConfig=e,this}},{key:"setWorkerLimit",value:function(e){return this.workerLimit=e,this}},{key:"load",value:function(e,t,n,r){var i=this,a=new Od(this.manager);a.setPath(this.path),a.setResponseType("arraybuffer"),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(e,(function(e){i.parse(e,t,r)}),n,r)}},{key:"parse",value:function(e,t,n){this.decodeDracoFile(e,t,null,null,pn).catch(n)}},{key:"decodeDracoFile",value:function(e,t,n,r){var i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:vn,a={attributeIDs:n||this.defaultAttributeIDs,attributeTypes:r||this.defaultAttributeTypes,useUniqueIDs:!!n,vertexColorSpace:i};return this.decodeGeometry(e,a).then(t)}},{key:"decodeGeometry",value:function(e,t){var n,r=this,i=JSON.stringify(t);if(Gv.has(e)){var a=Gv.get(e);if(a.key===i)return a.promise;if(0===e.byteLength)throw new Error("THREE.DRACOLoader: Unable to re-decode a buffer with different settings. Buffer has already been transferred.")}var o=this.workerNextTaskID++,s=e.byteLength,u=this._getWorker(o,s).then((function(r){return n=r,new Promise((function(r,i){n._callbacks[o]={resolve:r,reject:i},n.postMessage({type:"decode",id:o,taskConfig:t,buffer:e},[e])}))})).then((function(e){return r._createGeometry(e.geometry)}));return u.catch((function(){return!0})).then((function(){n&&o&&r._releaseTask(n,o)})),Gv.set(e,{key:i,promise:u}),u}},{key:"_createGeometry",value:function(e){var t=new Ga;e.index&&t.setIndex(new wa(e.index.array,1));for(var n=0;n<e.attributes.length;n++){var r=e.attributes[n],i=r.name,a=r.array,o=r.itemSize,s=new wa(a,o);"color"===i&&(this._assignVertexColorSpace(s,r.vertexColorSpace),s.normalized=a instanceof Float32Array==!1),t.setAttribute(i,s)}return t}},{key:"_assignVertexColorSpace",value:function(e,t){if(t===pn)for(var n=new pa,r=0,i=e.count;r<i;r++)n.fromBufferAttribute(e,r).convertSRGBToLinear(),e.setXYZ(r,n.r,n.g,n.b)}},{key:"_loadLibrary",value:function(e,t){var n=new Od(this.manager);return n.setPath(this.decoderPath),n.setResponseType(t),n.setWithCredentials(this.withCredentials),new Promise((function(t,r){n.load(e,t,void 0,r)}))}},{key:"preload",value:function(){return this._initDecoder(),this}},{key:"_initDecoder",value:function(){var e=this;if(this.decoderPending)return this.decoderPending;var t="object"!==("undefined"==typeof WebAssembly?"undefined":$p(WebAssembly))||"js"===this.decoderConfig.type,n=[];return t?n.push(this._loadLibrary("draco_decoder.js","text")):(n.push(this._loadLibrary("draco_wasm_wrapper.js","text")),n.push(this._loadLibrary("draco_decoder.wasm","arraybuffer"))),this.decoderPending=Promise.all(n).then((function(n){var r=n[0];t||(e.decoderConfig.wasmBinary=n[1]);var i=Wv.toString(),a=["/* draco decoder */",r,"","/* worker */",i.substring(i.indexOf("{")+1,i.lastIndexOf("}"))].join("\n");e.workerSourceURL=URL.createObjectURL(new Blob([a]))})),this.decoderPending}},{key:"_getWorker",value:function(e,t){var n=this;return this._initDecoder().then((function(){if(n.workerPool.length<n.workerLimit){var r=new Worker(n.workerSourceURL);r._callbacks={},r._taskCosts={},r._taskLoad=0,r.postMessage({type:"init",decoderConfig:n.decoderConfig}),r.onmessage=function(e){var t=e.data;switch(t.type){case"decode":r._callbacks[t.id].resolve(t);break;case"error":r._callbacks[t.id].reject(t);break;default:console.error('THREE.DRACOLoader: Unexpected message, "'+t.type+'"')}},n.workerPool.push(r)}else n.workerPool.sort((function(e,t){return e._taskLoad>t._taskLoad?-1:1}));var i=n.workerPool[n.workerPool.length-1];return i._taskCosts[e]=t,i._taskLoad+=t,i}))}},{key:"_releaseTask",value:function(e,t){e._taskLoad-=e._taskCosts[t],delete e._callbacks[t],delete e._taskCosts[t]}},{key:"debug",value:function(){console.log("Task load: ",this.workerPool.map((function(e){return e._taskLoad})))}},{key:"dispose",value:function(){for(var e=0;e<this.workerPool.length;++e)this.workerPool[e].terminate();return this.workerPool.length=0,""!==this.workerSourceURL&&URL.revokeObjectURL(this.workerSourceURL),this}}]),n}(Pd);function Wv(){var e,t;function n(e,t,n,r,i,a){var o=a.num_components(),s=n.num_points()*o,u=s*i.BYTES_PER_ELEMENT,l=function(e,t){switch(t){case Float32Array:return e.DT_FLOAT32;case Int8Array:return e.DT_INT8;case Int16Array:return e.DT_INT16;case Int32Array:return e.DT_INT32;case Uint8Array:return e.DT_UINT8;case Uint16Array:return e.DT_UINT16;case Uint32Array:return e.DT_UINT32}}(e,i),c=e._malloc(u);t.GetAttributeDataArrayForAllPoints(n,a,l,u,c);var h=new i(e.HEAPF32.buffer,c,s).slice();return e._free(c),{name:r,array:h,itemSize:o}}onmessage=function(r){var i=r.data;switch(i.type){case"init":e=i.decoderConfig,t=new Promise((function(t){e.onModuleLoaded=function(e){t({draco:e})},DracoDecoderModule(e)}));break;case"decode":var a=i.buffer,o=i.taskConfig;t.then((function(e){var t=e.draco,r=new t.Decoder;try{var s=function(e,t,r,i){var a,o,s=i.attributeIDs,u=i.attributeTypes,l=t.GetEncodedGeometryType(r);if(l===e.TRIANGULAR_MESH)a=new e.Mesh,o=t.DecodeArrayToMesh(r,r.byteLength,a);else{if(l!==e.POINT_CLOUD)throw new Error("THREE.DRACOLoader: Unexpected geometry type.");a=new e.PointCloud,o=t.DecodeArrayToPointCloud(r,r.byteLength,a)}if(!o.ok()||0===a.ptr)throw new Error("THREE.DRACOLoader: Decoding failed: "+o.error_msg());var c={index:null,attributes:[]};for(var h in s){var d=self[u[h]],f=void 0,p=void 0;if(i.useUniqueIDs)p=s[h],f=t.GetAttributeByUniqueId(a,p);else{if(-1===(p=t.GetAttributeId(a,e[s[h]])))continue;f=t.GetAttribute(a,p)}var v=n(e,t,a,h,d,f);"color"===h&&(v.vertexColorSpace=i.vertexColorSpace),c.attributes.push(v)}l===e.TRIANGULAR_MESH&&(c.index=function(e,t,n){var r=n.num_faces(),i=3*r,a=4*i,o=e._malloc(a);t.GetTrianglesUInt32Array(n,a,o);var s=new Uint32Array(e.HEAPF32.buffer,o,i).slice();return e._free(o),{array:s,itemSize:1}}(e,t,a));return e.destroy(a),c}(t,r,new Int8Array(a),o),u=s.attributes.map((function(e){return e.array.buffer}));s.index&&u.push(s.index.array.buffer),self.postMessage({type:"decode",id:i.id,geometry:s},u)}catch(e){console.error(e),self.postMessage({type:"error",id:i.id,error:e.message})}finally{t.destroy(r)}}))}}}function jv(e,t){if(t===rn)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),e;if(t===on||t===an){var n=e.getIndex();if(null===n){var r=[],i=e.getAttribute("position");if(void 0===i)return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),e;for(var a=0;a<i.count;a++)r.push(a);e.setIndex(r),n=e.getIndex()}var o=n.count-2,s=[];if(t===on)for(var u=1;u<=o;u++)s.push(n.getX(0)),s.push(n.getX(u)),s.push(n.getX(u+1));else for(var l=0;l<o;l++)l%2==0?(s.push(n.getX(l)),s.push(n.getX(l+1)),s.push(n.getX(l+2))):(s.push(n.getX(l+2)),s.push(n.getX(l+1)),s.push(n.getX(l)));s.length/3!==o&&console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");var c=e.clone();return c.setIndex(s),c.clearGroups(),c}return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:",t),e}var Xv=function(e){w(n,e);var t=E(n);function n(e){var r;return a(this,n),(r=t.call(this,e)).dracoLoader=null,r.ktx2Loader=null,r.meshoptDecoder=null,r.pluginCallbacks=[],r.register((function(e){return new Qv(e)})),r.register((function(e){return new om(e)})),r.register((function(e){return new sm(e)})),r.register((function(e){return new um(e)})),r.register((function(e){return new em(e)})),r.register((function(e){return new tm(e)})),r.register((function(e){return new nm(e)})),r.register((function(e){return new rm(e)})),r.register((function(e){return new Jv(e)})),r.register((function(e){return new im(e)})),r.register((function(e){return new $v(e)})),r.register((function(e){return new am(e)})),r.register((function(e){return new Zv(e)})),r.register((function(e){return new lm(e)})),r.register((function(e){return new cm(e)})),r}return s(n,[{key:"load",value:function(e,t,n,r){var i,a=this;i=""!==this.resourcePath?this.resourcePath:""!==this.path?this.path:cf.extractUrlBase(e),this.manager.itemStart(e);var o=function(t){r?r(t):console.error(t),a.manager.itemError(e),a.manager.itemEnd(e)},s=new Od(this.manager);s.setPath(this.path),s.setResponseType("arraybuffer"),s.setRequestHeader(this.requestHeader),s.setWithCredentials(this.withCredentials),s.load(e,(function(n){try{a.parse(n,i,(function(n){t(n),a.manager.itemEnd(e)}),o)}catch(e){o(e)}}),n,o)}},{key:"setDRACOLoader",value:function(e){return this.dracoLoader=e,this}},{key:"setDDSLoader",value:function(){throw new Error('THREE.GLTFLoader: "MSFT_texture_dds" no longer supported. Please update to "KHR_texture_basisu".')}},{key:"setKTX2Loader",value:function(e){return this.ktx2Loader=e,this}},{key:"setMeshoptDecoder",value:function(e){return this.meshoptDecoder=e,this}},{key:"register",value:function(e){return-1===this.pluginCallbacks.indexOf(e)&&this.pluginCallbacks.push(e),this}},{key:"unregister",value:function(e){return-1!==this.pluginCallbacks.indexOf(e)&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(e),1),this}},{key:"parse",value:function(e,t,n,r){var i,a={},o={},s=new TextDecoder;if("string"==typeof e)i=JSON.parse(e);else if(e instanceof ArrayBuffer){if(s.decode(new Uint8Array(e,0,4))===hm){try{a[Yv.KHR_BINARY_GLTF]=new pm(e)}catch(e){return void(r&&r(e))}i=JSON.parse(a[Yv.KHR_BINARY_GLTF].content)}else i=JSON.parse(s.decode(e))}else i=e;if(void 0===i.asset||i.asset.version[0]<2)r&&r(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));else{var u=new Bm(i,{path:t||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});u.fileLoader.setRequestHeader(this.requestHeader);for(var l=0;l<this.pluginCallbacks.length;l++){var c=this.pluginCallbacks[l](u);o[c.name]=c,a[c.name]=!0}if(i.extensionsUsed)for(var h=0;h<i.extensionsUsed.length;++h){var d=i.extensionsUsed[h],f=i.extensionsRequired||[];switch(d){case Yv.KHR_MATERIALS_UNLIT:a[d]=new Kv;break;case Yv.KHR_DRACO_MESH_COMPRESSION:a[d]=new vm(i,this.dracoLoader);break;case Yv.KHR_TEXTURE_TRANSFORM:a[d]=new mm;break;case Yv.KHR_MESH_QUANTIZATION:a[d]=new gm;break;default:f.indexOf(d)>=0&&void 0===o[d]&&console.warn('THREE.GLTFLoader: Unknown extension "'+d+'".')}}u.setExtensions(a),u.setPlugins(o),u.parse(n,r)}}},{key:"parseAsync",value:function(e,t){var n=this;return new Promise((function(r,i){n.parse(e,t,r,i)}))}}]),n}(Pd);function qv(){var e={};return{get:function(t){return e[t]},add:function(t,n){e[t]=n},remove:function(t){delete e[t]},removeAll:function(){e={}}}}var Yv={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS_PUNCTUAL:"KHR_lights_punctual",KHR_MATERIALS_CLEARCOAT:"KHR_materials_clearcoat",KHR_MATERIALS_IOR:"KHR_materials_ior",KHR_MATERIALS_SHEEN:"KHR_materials_sheen",KHR_MATERIALS_SPECULAR:"KHR_materials_specular",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",KHR_MATERIALS_IRIDESCENCE:"KHR_materials_iridescence",KHR_MATERIALS_ANISOTROPY:"KHR_materials_anisotropy",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_MATERIALS_VOLUME:"KHR_materials_volume",KHR_TEXTURE_BASISU:"KHR_texture_basisu",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",KHR_MATERIALS_EMISSIVE_STRENGTH:"KHR_materials_emissive_strength",EXT_TEXTURE_WEBP:"EXT_texture_webp",EXT_TEXTURE_AVIF:"EXT_texture_avif",EXT_MESHOPT_COMPRESSION:"EXT_meshopt_compression",EXT_MESH_GPU_INSTANCING:"EXT_mesh_gpu_instancing"},Zv=function(){function e(t){a(this,e),this.parser=t,this.name=Yv.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}return s(e,[{key:"_markDefs",value:function(){for(var e=this.parser,t=this.parser.json.nodes||[],n=0,r=t.length;n<r;n++){var i=t[n];i.extensions&&i.extensions[this.name]&&void 0!==i.extensions[this.name].light&&e._addNodeRef(this.cache,i.extensions[this.name].light)}}},{key:"_loadLight",value:function(e){var t=this.parser,n="light:"+e,r=t.cache.get(n);if(r)return r;var i,a=t.json,o=((a.extensions&&a.extensions[this.name]||{}).lights||[])[e],s=new pa(16777215);void 0!==o.color&&s.fromArray(o.color);var u=void 0!==o.range?o.range:0;switch(o.type){case"directional":(i=new rf(s)).target.position.set(0,0,-1),i.add(i.target);break;case"point":(i=new tf(s)).distance=u;break;case"spot":(i=new Kd(s)).distance=u,o.spot=o.spot||{},o.spot.innerConeAngle=void 0!==o.spot.innerConeAngle?o.spot.innerConeAngle:0,o.spot.outerConeAngle=void 0!==o.spot.outerConeAngle?o.spot.outerConeAngle:Math.PI/4,i.angle=o.spot.outerConeAngle,i.penumbra=1-o.spot.innerConeAngle/o.spot.outerConeAngle,i.target.position.set(0,0,-1),i.add(i.target);break;default:throw new Error("THREE.GLTFLoader: Unexpected light type: "+o.type)}return i.position.set(0,0,0),i.decay=2,Im(i,o),void 0!==o.intensity&&(i.intensity=o.intensity),i.name=t.createUniqueName(o.name||"light_"+e),r=Promise.resolve(i),t.cache.add(n,r),r}},{key:"getDependency",value:function(e,t){if("light"===e)return this._loadLight(t)}},{key:"createNodeAttachment",value:function(e){var t=this,n=this.parser,r=n.json.nodes[e],i=(r.extensions&&r.extensions[this.name]||{}).light;return void 0===i?null:this._loadLight(i).then((function(e){return n._getNodeRef(t.cache,i,e)}))}}]),e}(),Kv=function(){function e(){a(this,e),this.name=Yv.KHR_MATERIALS_UNLIT}return s(e,[{key:"getMaterialType",value:function(){return ma}},{key:"extendParams",value:function(e,t,n){var r=[];e.color=new pa(1,1,1),e.opacity=1;var i=t.pbrMetallicRoughness;if(i){if(Array.isArray(i.baseColorFactor)){var a=i.baseColorFactor;e.color.fromArray(a),e.opacity=a[3]}void 0!==i.baseColorTexture&&r.push(n.assignTexture(e,"map",i.baseColorTexture,pn))}return Promise.all(r)}}]),e}(),Jv=function(){function e(t){a(this,e),this.parser=t,this.name=Yv.KHR_MATERIALS_EMISSIVE_STRENGTH}return s(e,[{key:"extendMaterialParams",value:function(e,t){var n=this.parser.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();var r=n.extensions[this.name].emissiveStrength;return void 0!==r&&(t.emissiveIntensity=r),Promise.resolve()}}]),e}(),Qv=function(){function e(t){a(this,e),this.parser=t,this.name=Yv.KHR_MATERIALS_CLEARCOAT}return s(e,[{key:"getMaterialType",value:function(e){var t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?td:null}},{key:"extendMaterialParams",value:function(e,t){var n=this.parser,r=n.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();var i=[],a=r.extensions[this.name];if(void 0!==a.clearcoatFactor&&(t.clearcoat=a.clearcoatFactor),void 0!==a.clearcoatTexture&&i.push(n.assignTexture(t,"clearcoatMap",a.clearcoatTexture)),void 0!==a.clearcoatRoughnessFactor&&(t.clearcoatRoughness=a.clearcoatRoughnessFactor),void 0!==a.clearcoatRoughnessTexture&&i.push(n.assignTexture(t,"clearcoatRoughnessMap",a.clearcoatRoughnessTexture)),void 0!==a.clearcoatNormalTexture&&(i.push(n.assignTexture(t,"clearcoatNormalMap",a.clearcoatNormalTexture)),void 0!==a.clearcoatNormalTexture.scale)){var o=a.clearcoatNormalTexture.scale;t.clearcoatNormalScale=new mr(o,o)}return Promise.all(i)}}]),e}(),$v=function(){function e(t){a(this,e),this.parser=t,this.name=Yv.KHR_MATERIALS_IRIDESCENCE}return s(e,[{key:"getMaterialType",value:function(e){var t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?td:null}},{key:"extendMaterialParams",value:function(e,t){var n=this.parser,r=n.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();var i=[],a=r.extensions[this.name];return void 0!==a.iridescenceFactor&&(t.iridescence=a.iridescenceFactor),void 0!==a.iridescenceTexture&&i.push(n.assignTexture(t,"iridescenceMap",a.iridescenceTexture)),void 0!==a.iridescenceIor&&(t.iridescenceIOR=a.iridescenceIor),void 0===t.iridescenceThicknessRange&&(t.iridescenceThicknessRange=[100,400]),void 0!==a.iridescenceThicknessMinimum&&(t.iridescenceThicknessRange[0]=a.iridescenceThicknessMinimum),void 0!==a.iridescenceThicknessMaximum&&(t.iridescenceThicknessRange[1]=a.iridescenceThicknessMaximum),void 0!==a.iridescenceThicknessTexture&&i.push(n.assignTexture(t,"iridescenceThicknessMap",a.iridescenceThicknessTexture)),Promise.all(i)}}]),e}(),em=function(){function e(t){a(this,e),this.parser=t,this.name=Yv.KHR_MATERIALS_SHEEN}return s(e,[{key:"getMaterialType",value:function(e){var t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?td:null}},{key:"extendMaterialParams",value:function(e,t){var n=this.parser,r=n.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();var i=[];t.sheenColor=new pa(0,0,0),t.sheenRoughness=0,t.sheen=1;var a=r.extensions[this.name];return void 0!==a.sheenColorFactor&&t.sheenColor.fromArray(a.sheenColorFactor),void 0!==a.sheenRoughnessFactor&&(t.sheenRoughness=a.sheenRoughnessFactor),void 0!==a.sheenColorTexture&&i.push(n.assignTexture(t,"sheenColorMap",a.sheenColorTexture,pn)),void 0!==a.sheenRoughnessTexture&&i.push(n.assignTexture(t,"sheenRoughnessMap",a.sheenRoughnessTexture)),Promise.all(i)}}]),e}(),tm=function(){function e(t){a(this,e),this.parser=t,this.name=Yv.KHR_MATERIALS_TRANSMISSION}return s(e,[{key:"getMaterialType",value:function(e){var t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?td:null}},{key:"extendMaterialParams",value:function(e,t){var n=this.parser,r=n.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();var i=[],a=r.extensions[this.name];return void 0!==a.transmissionFactor&&(t.transmission=a.transmissionFactor),void 0!==a.transmissionTexture&&i.push(n.assignTexture(t,"transmissionMap",a.transmissionTexture)),Promise.all(i)}}]),e}(),nm=function(){function e(t){a(this,e),this.parser=t,this.name=Yv.KHR_MATERIALS_VOLUME}return s(e,[{key:"getMaterialType",value:function(e){var t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?td:null}},{key:"extendMaterialParams",value:function(e,t){var n=this.parser,r=n.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();var i=[],a=r.extensions[this.name];t.thickness=void 0!==a.thicknessFactor?a.thicknessFactor:0,void 0!==a.thicknessTexture&&i.push(n.assignTexture(t,"thicknessMap",a.thicknessTexture)),t.attenuationDistance=a.attenuationDistance||1/0;var o=a.attenuationColor||[1,1,1];return t.attenuationColor=new pa(o[0],o[1],o[2]),Promise.all(i)}}]),e}(),rm=function(){function e(t){a(this,e),this.parser=t,this.name=Yv.KHR_MATERIALS_IOR}return s(e,[{key:"getMaterialType",value:function(e){var t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?td:null}},{key:"extendMaterialParams",value:function(e,t){var n=this.parser.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();var r=n.extensions[this.name];return t.ior=void 0!==r.ior?r.ior:1.5,Promise.resolve()}}]),e}(),im=function(){function e(t){a(this,e),this.parser=t,this.name=Yv.KHR_MATERIALS_SPECULAR}return s(e,[{key:"getMaterialType",value:function(e){var t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?td:null}},{key:"extendMaterialParams",value:function(e,t){var n=this.parser,r=n.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();var i=[],a=r.extensions[this.name];t.specularIntensity=void 0!==a.specularFactor?a.specularFactor:1,void 0!==a.specularTexture&&i.push(n.assignTexture(t,"specularIntensityMap",a.specularTexture));var o=a.specularColorFactor||[1,1,1];return t.specularColor=new pa(o[0],o[1],o[2]),void 0!==a.specularColorTexture&&i.push(n.assignTexture(t,"specularColorMap",a.specularColorTexture,pn)),Promise.all(i)}}]),e}(),am=function(){function e(t){a(this,e),this.parser=t,this.name=Yv.KHR_MATERIALS_ANISOTROPY}return s(e,[{key:"getMaterialType",value:function(e){var t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?td:null}},{key:"extendMaterialParams",value:function(e,t){var n=this.parser,r=n.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();var i=[],a=r.extensions[this.name];return void 0!==a.anisotropyStrength&&(t.anisotropy=a.anisotropyStrength),void 0!==a.anisotropyRotation&&(t.anisotropyRotation=a.anisotropyRotation),void 0!==a.anisotropyTexture&&i.push(n.assignTexture(t,"anisotropyMap",a.anisotropyTexture)),Promise.all(i)}}]),e}(),om=function(){function e(t){a(this,e),this.parser=t,this.name=Yv.KHR_TEXTURE_BASISU}return s(e,[{key:"loadTexture",value:function(e){var t=this.parser,n=t.json,r=n.textures[e];if(!r.extensions||!r.extensions[this.name])return null;var i=r.extensions[this.name],a=t.options.ktx2Loader;if(!a){if(n.extensionsRequired&&n.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}return t.loadTextureImage(e,i.source,a)}}]),e}(),sm=function(){function e(t){a(this,e),this.parser=t,this.name=Yv.EXT_TEXTURE_WEBP,this.isSupported=null}return s(e,[{key:"loadTexture",value:function(e){var t=this.name,n=this.parser,r=n.json,i=r.textures[e];if(!i.extensions||!i.extensions[t])return null;var a=i.extensions[t],o=r.images[a.source],s=n.textureLoader;if(o.uri){var u=n.options.manager.getHandler(o.uri);null!==u&&(s=u)}return this.detectSupport().then((function(i){if(i)return n.loadTextureImage(e,a.source,s);if(r.extensionsRequired&&r.extensionsRequired.indexOf(t)>=0)throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported.");return n.loadTexture(e)}))}},{key:"detectSupport",value:function(){return this.isSupported||(this.isSupported=new Promise((function(e){var t=new Image;t.src="data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA",t.onload=t.onerror=function(){e(1===t.height)}}))),this.isSupported}}]),e}(),um=function(){function e(t){a(this,e),this.parser=t,this.name=Yv.EXT_TEXTURE_AVIF,this.isSupported=null}return s(e,[{key:"loadTexture",value:function(e){var t=this.name,n=this.parser,r=n.json,i=r.textures[e];if(!i.extensions||!i.extensions[t])return null;var a=i.extensions[t],o=r.images[a.source],s=n.textureLoader;if(o.uri){var u=n.options.manager.getHandler(o.uri);null!==u&&(s=u)}return this.detectSupport().then((function(i){if(i)return n.loadTextureImage(e,a.source,s);if(r.extensionsRequired&&r.extensionsRequired.indexOf(t)>=0)throw new Error("THREE.GLTFLoader: AVIF required by asset but unsupported.");return n.loadTexture(e)}))}},{key:"detectSupport",value:function(){return this.isSupported||(this.isSupported=new Promise((function(e){var t=new Image;t.src="data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAABcAAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAEAAAABAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQAMAAAAABNjb2xybmNseAACAAIABoAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAAB9tZGF0EgAKCBgABogQEDQgMgkQAAAAB8dSLfI=",t.onload=t.onerror=function(){e(1===t.height)}}))),this.isSupported}}]),e}(),lm=function(){function e(t){a(this,e),this.name=Yv.EXT_MESHOPT_COMPRESSION,this.parser=t}return s(e,[{key:"loadBufferView",value:function(e){var t=this.parser.json,n=t.bufferViews[e];if(n.extensions&&n.extensions[this.name]){var r=n.extensions[this.name],i=this.parser.getDependency("buffer",r.buffer),a=this.parser.options.meshoptDecoder;if(!a||!a.supported){if(t.extensionsRequired&&t.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return null}return i.then((function(e){var t=r.byteOffset||0,n=r.byteLength||0,i=r.count,o=r.byteStride,s=new Uint8Array(e,t,n);return a.decodeGltfBufferAsync?a.decodeGltfBufferAsync(i,o,s,r.mode,r.filter).then((function(e){return e.buffer})):a.ready.then((function(){var e=new ArrayBuffer(i*o);return a.decodeGltfBuffer(new Uint8Array(e),i,o,s,r.mode,r.filter),e}))}))}return null}}]),e}(),cm=function(){function e(t){a(this,e),this.name=Yv.EXT_MESH_GPU_INSTANCING,this.parser=t}return s(e,[{key:"createNodeMesh",value:function(e){var t=this,n=this.parser.json,r=n.nodes[e];if(!r.extensions||!r.extensions[this.name]||void 0===r.mesh)return null;var i,a=n.meshes[r.mesh],o=v(a.primitives);try{for(o.s();!(i=o.n()).done;){var s=i.value;if(s.mode!==Mm.TRIANGLES&&s.mode!==Mm.TRIANGLE_STRIP&&s.mode!==Mm.TRIANGLE_FAN&&void 0!==s.mode)return null}}catch(e){o.e(e)}finally{o.f()}var u=r.extensions[this.name].attributes,l=[],c={},h=function(e){l.push(t.parser.getDependency("accessor",u[e]).then((function(t){return c[e]=t,c[e]})))};for(var d in u)h(d);return l.length<1?null:(l.push(this.parser.createNodeMesh(e)),Promise.all(l).then((function(e){var n,r=e.pop(),i=r.isGroup?r.children:[r],a=e[0].count,o=[],s=v(i);try{for(s.s();!(n=s.n()).done;){for(var u=n.value,l=new wi,h=new Yr,d=new qr,f=new Yr(1,1,1),p=new rc(u.geometry,u.material,a),m=0;m<a;m++)c.TRANSLATION&&h.fromBufferAttribute(c.TRANSLATION,m),c.ROTATION&&d.fromBufferAttribute(c.ROTATION,m),c.SCALE&&f.fromBufferAttribute(c.SCALE,m),p.setMatrixAt(m,l.compose(h,d,f));for(var g in c)"TRANSLATION"!==g&&"ROTATION"!==g&&"SCALE"!==g&&u.geometry.setAttribute(g,c[g]);Zi.prototype.copy.call(p,u),t.parser.assignFinalMaterial(p),o.push(p)}}catch(e){s.e(e)}finally{s.f()}return r.isGroup?(r.clear(),r.add.apply(r,o),r):o[0]})))}}]),e}(),hm="glTF",dm=1313821514,fm=5130562,pm=s((function e(t){a(this,e),this.name=Yv.KHR_BINARY_GLTF,this.content=null,this.body=null;var n=new DataView(t,0,12),r=new TextDecoder;if(this.header={magic:r.decode(new Uint8Array(t.slice(0,4))),version:n.getUint32(4,!0),length:n.getUint32(8,!0)},this.header.magic!==hm)throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");if(this.header.version<2)throw new Error("THREE.GLTFLoader: Legacy binary file detected.");for(var i=this.header.length-12,o=new DataView(t,12),s=0;s<i;){var u=o.getUint32(s,!0);s+=4;var l=o.getUint32(s,!0);if(s+=4,l===dm){var c=new Uint8Array(t,12+s,u);this.content=r.decode(c)}else if(l===fm){var h=12+s;this.body=t.slice(h,h+u)}s+=u}if(null===this.content)throw new Error("THREE.GLTFLoader: JSON content not found.")})),vm=function(){function e(t,n){if(a(this,e),!n)throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=Yv.KHR_DRACO_MESH_COMPRESSION,this.json=t,this.dracoLoader=n,this.dracoLoader.preload()}return s(e,[{key:"decodePrimitive",value:function(e,t){var n=this.json,r=this.dracoLoader,i=e.extensions[this.name].bufferView,a=e.extensions[this.name].attributes,o={},s={},u={};for(var l in a){var c=Em[l]||l.toLowerCase();o[c]=a[l]}for(var h in e.attributes){var d=Em[h]||h.toLowerCase();if(void 0!==a[h]){var f=n.accessors[e.attributes[h]],p=Sm[f.componentType];u[d]=p.name,s[d]=!0===f.normalized}}return t.getDependency("bufferView",i).then((function(e){return new Promise((function(t){r.decodeDracoFile(e,(function(e){for(var n in e.attributes){var r=e.attributes[n],i=s[n];void 0!==i&&(r.normalized=i)}t(e)}),o,u)}))}))}}]),e}(),mm=function(){function e(){a(this,e),this.name=Yv.KHR_TEXTURE_TRANSFORM}return s(e,[{key:"extendTexture",value:function(e,t){return void 0!==t.texCoord&&t.texCoord!==e.channel||void 0!==t.offset||void 0!==t.rotation||void 0!==t.scale?(e=e.clone(),void 0!==t.texCoord&&(e.channel=t.texCoord),void 0!==t.offset&&e.offset.fromArray(t.offset),void 0!==t.rotation&&(e.rotation=t.rotation),void 0!==t.scale&&e.repeat.fromArray(t.scale),e.needsUpdate=!0,e):e}}]),e}(),gm=s((function e(){a(this,e),this.name=Yv.KHR_MESH_QUANTIZATION})),ym=function(e){w(n,e);var t=E(n);function n(e,r,i,o){return a(this,n),t.call(this,e,r,i,o)}return s(n,[{key:"copySampleValue_",value:function(e){for(var t=this.resultBuffer,n=this.sampleValues,r=this.valueSize,i=e*r*3+r,a=0;a!==r;a++)t[a]=n[i+a];return t}},{key:"interpolate_",value:function(e,t,n,r){for(var i=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=2*o,u=3*o,l=r-t,c=(n-t)/l,h=c*c,d=h*c,f=e*u,p=f-u,v=-2*d+3*h,m=d-h,g=1-v,y=m-h+c,_=0;_!==o;_++){var x=a[p+_+o],M=a[p+_+s]*l,S=a[f+_+o],b=a[f+_]*l;i[_]=g*x+y*M+v*S+m*b}return i}}]),n}(vd),_m=new qr,xm=function(e){w(n,e);var t=E(n);function n(){return a(this,n),t.apply(this,arguments)}return s(n,[{key:"interpolate_",value:function(e,t,r,i){var a=y(x(n.prototype),"interpolate_",this).call(this,e,t,r,i);return _m.fromArray(a).normalize().toArray(a),a}}]),n}(ym),Mm={FLOAT:5126,FLOAT_MAT3:35675,FLOAT_MAT4:35676,FLOAT_VEC2:35664,FLOAT_VEC3:35665,FLOAT_VEC4:35666,LINEAR:9729,REPEAT:10497,SAMPLER_2D:35678,POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6,UNSIGNED_BYTE:5121,UNSIGNED_SHORT:5123},Sm={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},bm={9728:Fe,9729:Ve,9984:Be,9985:We,9986:He,9987:Xe},wm={33071:Oe,33648:Ne,10497:Ue},Tm={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},Em={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",TEXCOORD_0:"uv",TEXCOORD_1:"uv1",TEXCOORD_2:"uv2",TEXCOORD_3:"uv3",COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},Am={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},Rm={CUBICSPLINE:void 0,LINEAR:Kt,STEP:Zt},km="OPAQUE",Cm="MASK",Lm="BLEND";function Pm(e,t,n){for(var r in n.extensions)void 0===e[r]&&(t.userData.gltfExtensions=t.userData.gltfExtensions||{},t.userData.gltfExtensions[r]=n.extensions[r])}function Im(e,t){void 0!==t.extras&&("object"===$p(t.extras)?Object.assign(e.userData,t.extras):console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+t.extras))}function Dm(e,t){if(e.updateMorphTargets(),void 0!==t.weights)for(var n=0,r=t.weights.length;n<r;n++)e.morphTargetInfluences[n]=t.weights[n];if(t.extras&&Array.isArray(t.extras.targetNames)){var i=t.extras.targetNames;if(e.morphTargetInfluences.length===i.length){e.morphTargetDictionary={};for(var a=0,o=i.length;a<o;a++)e.morphTargetDictionary[i[a]]=a}else console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.")}}function Um(e){var t,n=e.extensions&&e.extensions[Yv.KHR_DRACO_MESH_COMPRESSION];if(t=n?"draco:"+n.bufferView+":"+n.indices+":"+Om(n.attributes):e.indices+":"+Om(e.attributes)+":"+e.mode,void 0!==e.targets)for(var r=0,i=e.targets.length;r<i;r++)t+=":"+Om(e.targets[r]);return t}function Om(e){for(var t="",n=Object.keys(e).sort(),r=0,i=n.length;r<i;r++)t+=n[r]+":"+e[n[r]]+";";return t}function Nm(e){switch(e){case Int8Array:return 1/127;case Uint8Array:return 1/255;case Int16Array:return 1/32767;case Uint16Array:return 1/65535;default:throw new Error("THREE.GLTFLoader: Unsupported normalized accessor component type.")}}var Fm=new wi,Bm=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};a(this,e),this.json=t,this.extensions={},this.plugins={},this.options=n,this.cache=new qv,this.associations=new Map,this.primitiveCache={},this.nodeCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.sourceCache={},this.textureCache={},this.nodeNamesUsed={};var r=!1,i=!1,o=-1;"undefined"!=typeof navigator&&(r=!0===/^((?!chrome|android).)*safari/i.test(navigator.userAgent),o=(i=navigator.userAgent.indexOf("Firefox")>-1)?navigator.userAgent.match(/Firefox\/([0-9]+)\./)[1]:-1),"undefined"==typeof createImageBitmap||r||i&&o<98?this.textureLoader=new Gd(this.options.manager):this.textureLoader=new gf(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new Od(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),"use-credentials"===this.options.crossOrigin&&this.fileLoader.setWithCredentials(!0)}return s(e,[{key:"setExtensions",value:function(e){this.extensions=e}},{key:"setPlugins",value:function(e){this.plugins=e}},{key:"parse",value:function(e,t){var n=this,r=this.json,i=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll((function(e){return e._markDefs&&e._markDefs()})),Promise.all(this._invokeAll((function(e){return e.beforeRoot&&e.beforeRoot()}))).then((function(){return Promise.all([n.getDependencies("scene"),n.getDependencies("animation"),n.getDependencies("camera")])})).then((function(t){var a={scene:t[0][r.scene||0],scenes:t[0],animations:t[1],cameras:t[2],asset:r.asset,parser:n,userData:{}};Pm(i,a,r),Im(a,r),Promise.all(n._invokeAll((function(e){return e.afterRoot&&e.afterRoot(a)}))).then((function(){e(a)}))})).catch(t)}},{key:"_markDefs",value:function(){for(var e=this.json.nodes||[],t=this.json.skins||[],n=this.json.meshes||[],r=0,i=t.length;r<i;r++)for(var a=t[r].joints,o=0,s=a.length;o<s;o++)e[a[o]].isBone=!0;for(var u=0,l=e.length;u<l;u++){var c=e[u];void 0!==c.mesh&&(this._addNodeRef(this.meshCache,c.mesh),void 0!==c.skin&&(n[c.mesh].isSkinnedMesh=!0)),void 0!==c.camera&&this._addNodeRef(this.cameraCache,c.camera)}}},{key:"_addNodeRef",value:function(e,t){void 0!==t&&(void 0===e.refs[t]&&(e.refs[t]=e.uses[t]=0),e.refs[t]++)}},{key:"_getNodeRef",value:function(e,t,n){var r=this;if(e.refs[t]<=1)return n;var i=n.clone();return function e(t,n){var i=r.associations.get(t);null!=i&&r.associations.set(n,i);var a,o=v(t.children.entries());try{for(o.s();!(a=o.n()).done;){var s=m(a.value,2),u=s[0];e(s[1],n.children[u])}}catch(e){o.e(e)}finally{o.f()}}(n,i),i.name+="_instance_"+e.uses[t]++,i}},{key:"_invokeOne",value:function(e){var t=Object.values(this.plugins);t.push(this);for(var n=0;n<t.length;n++){var r=e(t[n]);if(r)return r}return null}},{key:"_invokeAll",value:function(e){var t=Object.values(this.plugins);t.unshift(this);for(var n=[],r=0;r<t.length;r++){var i=e(t[r]);i&&n.push(i)}return n}},{key:"getDependency",value:function(e,t){var n=e+":"+t,r=this.cache.get(n);if(!r){switch(e){case"scene":r=this.loadScene(t);break;case"node":r=this._invokeOne((function(e){return e.loadNode&&e.loadNode(t)}));break;case"mesh":r=this._invokeOne((function(e){return e.loadMesh&&e.loadMesh(t)}));break;case"accessor":r=this.loadAccessor(t);break;case"bufferView":r=this._invokeOne((function(e){return e.loadBufferView&&e.loadBufferView(t)}));break;case"buffer":r=this.loadBuffer(t);break;case"material":r=this._invokeOne((function(e){return e.loadMaterial&&e.loadMaterial(t)}));break;case"texture":r=this._invokeOne((function(e){return e.loadTexture&&e.loadTexture(t)}));break;case"skin":r=this.loadSkin(t);break;case"animation":r=this._invokeOne((function(e){return e.loadAnimation&&e.loadAnimation(t)}));break;case"camera":r=this.loadCamera(t);break;default:if(!(r=this._invokeOne((function(n){return n!=this&&n.getDependency&&n.getDependency(e,t)}))))throw new Error("Unknown type: "+e)}this.cache.add(n,r)}return r}},{key:"getDependencies",value:function(e){var t=this.cache.get(e);if(!t){var n=this,r=this.json[e+("mesh"===e?"es":"s")]||[];t=Promise.all(r.map((function(t,r){return n.getDependency(e,r)}))),this.cache.add(e,t)}return t}},{key:"loadBuffer",value:function(e){var t=this.json.buffers[e],n=this.fileLoader;if(t.type&&"arraybuffer"!==t.type)throw new Error("THREE.GLTFLoader: "+t.type+" buffer type is not supported.");if(void 0===t.uri&&0===e)return Promise.resolve(this.extensions[Yv.KHR_BINARY_GLTF].body);var r=this.options;return new Promise((function(e,i){n.load(cf.resolveURL(t.uri,r.path),e,void 0,(function(){i(new Error('THREE.GLTFLoader: Failed to load buffer "'+t.uri+'".'))}))}))}},{key:"loadBufferView",value:function(e){var t=this.json.bufferViews[e];return this.getDependency("buffer",t.buffer).then((function(e){var n=t.byteLength||0,r=t.byteOffset||0;return e.slice(r,r+n)}))}},{key:"loadAccessor",value:function(e){var t=this,n=this.json,r=this.json.accessors[e];if(void 0===r.bufferView&&void 0===r.sparse){var i=Tm[r.type],a=Sm[r.componentType],o=!0===r.normalized,s=new a(r.count*i);return Promise.resolve(new wa(s,i,o))}var u=[];return void 0!==r.bufferView?u.push(this.getDependency("bufferView",r.bufferView)):u.push(null),void 0!==r.sparse&&(u.push(this.getDependency("bufferView",r.sparse.indices.bufferView)),u.push(this.getDependency("bufferView",r.sparse.values.bufferView))),Promise.all(u).then((function(e){var i,a,o=e[0],s=Tm[r.type],u=Sm[r.componentType],l=u.BYTES_PER_ELEMENT,c=l*s,h=r.byteOffset||0,d=void 0!==r.bufferView?n.bufferViews[r.bufferView].byteStride:void 0,f=!0===r.normalized;if(d&&d!==c){var p=Math.floor(h/d),v="InterleavedBuffer:"+r.bufferView+":"+r.componentType+":"+p+":"+r.count,m=t.cache.get(v);m||(i=new u(o,p*d,r.count*d/l),m=new fl(i,d/l),t.cache.add(v,m)),a=new vl(m,s,h%d/l,f)}else i=null===o?new u(r.count*s):new u(o,h,r.count*s),a=new wa(i,s,f);if(void 0!==r.sparse){var g=Tm.SCALAR,y=Sm[r.sparse.indices.componentType],_=r.sparse.indices.byteOffset||0,x=r.sparse.values.byteOffset||0,M=new y(e[1],_,r.sparse.count*g),S=new u(e[2],x,r.sparse.count*s);null!==o&&(a=new wa(a.array.slice(),a.itemSize,a.normalized));for(var b=0,w=M.length;b<w;b++){var T=M[b];if(a.setX(T,S[b*s]),s>=2&&a.setY(T,S[b*s+1]),s>=3&&a.setZ(T,S[b*s+2]),s>=4&&a.setW(T,S[b*s+3]),s>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}}return a}))}},{key:"loadTexture",value:function(e){var t=this.json,n=this.options,r=t.textures[e].source,i=t.images[r],a=this.textureLoader;if(i.uri){var o=n.manager.getHandler(i.uri);null!==o&&(a=o)}return this.loadTextureImage(e,r,a)}},{key:"loadTextureImage",value:function(e,t,n){var r=this,i=this.json,a=i.textures[e],o=i.images[t],s=(o.uri||o.bufferView)+":"+a.sampler;if(this.textureCache[s])return this.textureCache[s];var u=this.loadImageSource(t,n).then((function(t){t.flipY=!1,t.name=a.name||o.name||"",""===t.name&&"string"==typeof o.uri&&!1===o.uri.startsWith("data:image/")&&(t.name=o.uri);var n=(i.samplers||{})[a.sampler]||{};return t.magFilter=bm[n.magFilter]||Ve,t.minFilter=bm[n.minFilter]||Xe,t.wrapS=wm[n.wrapS]||Ue,t.wrapT=wm[n.wrapT]||Ue,r.associations.set(t,{textures:e}),t})).catch((function(){return null}));return this.textureCache[s]=u,u}},{key:"loadImageSource",value:function(e,t){var n=this.json,r=this.options;if(void 0!==this.sourceCache[e])return this.sourceCache[e].then((function(e){return e.clone()}));var i=n.images[e],a=self.URL||self.webkitURL,o=i.uri||"",s=!1;if(void 0!==i.bufferView)o=this.getDependency("bufferView",i.bufferView).then((function(e){s=!0;var t=new Blob([e],{type:i.mimeType});return o=a.createObjectURL(t)}));else if(void 0===i.uri)throw new Error("THREE.GLTFLoader: Image "+e+" is missing URI and bufferView");var u=Promise.resolve(o).then((function(e){return new Promise((function(n,i){var a=n;!0===t.isImageBitmapLoader&&(a=function(e){var t=new Fr(e);t.needsUpdate=!0,n(t)}),t.load(cf.resolveURL(e,r.path),a,void 0,i)}))})).then((function(e){var t;return!0===s&&a.revokeObjectURL(o),e.userData.mimeType=i.mimeType||((t=i.uri).search(/\.jpe?g($|\?)/i)>0||0===t.search(/^data\:image\/jpeg/)?"image/jpeg":t.search(/\.webp($|\?)/i)>0||0===t.search(/^data\:image\/webp/)?"image/webp":"image/png"),e})).catch((function(e){throw console.error("THREE.GLTFLoader: Couldn't load texture",o),e}));return this.sourceCache[e]=u,u}},{key:"assignTexture",value:function(e,t,n,r){var i=this;return this.getDependency("texture",n.index).then((function(a){if(!a)return null;if(void 0!==n.texCoord&&n.texCoord>0&&((a=a.clone()).channel=n.texCoord),i.extensions[Yv.KHR_TEXTURE_TRANSFORM]){var o=void 0!==n.extensions?n.extensions[Yv.KHR_TEXTURE_TRANSFORM]:void 0;if(o){var s=i.associations.get(a);a=i.extensions[Yv.KHR_TEXTURE_TRANSFORM].extendTexture(a,o),i.associations.set(a,s)}}return void 0!==r&&(a.colorSpace=r),e[t]=a,a}))}},{key:"assignFinalMaterial",value:function(e){var t=e.geometry,n=e.material,r=void 0===t.attributes.tangent,i=void 0!==t.attributes.color,a=void 0===t.attributes.normal;if(e.isPoints){var o="PointsMaterial:"+n.uuid,s=this.cache.get(o);s||(s=new vc,la.prototype.copy.call(s,n),s.color.copy(n.color),s.map=n.map,s.sizeAttenuation=!1,this.cache.add(o,s)),n=s}else if(e.isLine){var u="LineBasicMaterial:"+n.uuid,l=this.cache.get(u);l||(l=new ic,la.prototype.copy.call(l,n),l.color.copy(n.color),l.map=n.map,this.cache.add(u,l)),n=l}if(r||i||a){var c="ClonedMaterial:"+n.uuid+":";r&&(c+="derivative-tangents:"),i&&(c+="vertex-colors:"),a&&(c+="flat-shading:");var h=this.cache.get(c);h||(h=n.clone(),i&&(h.vertexColors=!0),a&&(h.flatShading=!0),r&&(h.normalScale&&(h.normalScale.y*=-1),h.clearcoatNormalScale&&(h.clearcoatNormalScale.y*=-1)),this.cache.add(c,h),this.associations.set(h,this.associations.get(n))),n=h}e.material=n}},{key:"getMaterialType",value:function(){return ed}},{key:"loadMaterial",value:function(e){var t,n=this,r=this.json,i=this.extensions,a=r.materials[e],o={},s=[];if((a.extensions||{})[Yv.KHR_MATERIALS_UNLIT]){var u=i[Yv.KHR_MATERIALS_UNLIT];t=u.getMaterialType(),s.push(u.extendParams(o,a,n))}else{var l=a.pbrMetallicRoughness||{};if(o.color=new pa(1,1,1),o.opacity=1,Array.isArray(l.baseColorFactor)){var c=l.baseColorFactor;o.color.fromArray(c),o.opacity=c[3]}void 0!==l.baseColorTexture&&s.push(n.assignTexture(o,"map",l.baseColorTexture,pn)),o.metalness=void 0!==l.metallicFactor?l.metallicFactor:1,o.roughness=void 0!==l.roughnessFactor?l.roughnessFactor:1,void 0!==l.metallicRoughnessTexture&&(s.push(n.assignTexture(o,"metalnessMap",l.metallicRoughnessTexture)),s.push(n.assignTexture(o,"roughnessMap",l.metallicRoughnessTexture))),t=this._invokeOne((function(t){return t.getMaterialType&&t.getMaterialType(e)})),s.push(Promise.all(this._invokeAll((function(t){return t.extendMaterialParams&&t.extendMaterialParams(e,o)}))))}!0===a.doubleSided&&(o.side=G);var h=a.alphaMode||km;if(h===Lm?(o.transparent=!0,o.depthWrite=!1):(o.transparent=!1,h===Cm&&(o.alphaTest=void 0!==a.alphaCutoff?a.alphaCutoff:.5)),void 0!==a.normalTexture&&t!==ma&&(s.push(n.assignTexture(o,"normalMap",a.normalTexture)),o.normalScale=new mr(1,1),void 0!==a.normalTexture.scale)){var d=a.normalTexture.scale;o.normalScale.set(d,d)}return void 0!==a.occlusionTexture&&t!==ma&&(s.push(n.assignTexture(o,"aoMap",a.occlusionTexture)),void 0!==a.occlusionTexture.strength&&(o.aoMapIntensity=a.occlusionTexture.strength)),void 0!==a.emissiveFactor&&t!==ma&&(o.emissive=(new pa).fromArray(a.emissiveFactor)),void 0!==a.emissiveTexture&&t!==ma&&s.push(n.assignTexture(o,"emissiveMap",a.emissiveTexture,pn)),Promise.all(s).then((function(){var r=new t(o);return a.name&&(r.name=a.name),Im(r,a),n.associations.set(r,{materials:e}),a.extensions&&Pm(i,r,a),r}))}},{key:"createUniqueName",value:function(e){var t=Yf.sanitizeNodeName(e||"");return t in this.nodeNamesUsed?t+"_"+ ++this.nodeNamesUsed[t]:(this.nodeNamesUsed[t]=0,t)}},{key:"loadGeometries",value:function(e){var t=this,n=this.extensions,r=this.primitiveCache;function i(e){return n[Yv.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(e,t).then((function(n){return zm(n,e,t)}))}for(var a=[],o=0,s=e.length;o<s;o++){var u=e[o],l=Um(u),c=r[l];if(c)a.push(c.promise);else{var h=void 0;h=u.extensions&&u.extensions[Yv.KHR_DRACO_MESH_COMPRESSION]?i(u):zm(new Ga,u,t),r[l]={primitive:u,promise:h},a.push(h)}}return Promise.all(a)}},{key:"loadMesh",value:function(e){for(var t,n=this,r=this.json,i=this.extensions,a=r.meshes[e],o=a.primitives,s=[],u=0,l=o.length;u<l;u++){var c=void 0===o[u].material?(void 0===(t=this.cache).DefaultMaterial&&(t.DefaultMaterial=new ed({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:z})),t.DefaultMaterial):this.getDependency("material",o[u].material);s.push(c)}return s.push(n.loadGeometries(o)),Promise.all(s).then((function(t){for(var r=t.slice(0,t.length-1),s=t[t.length-1],u=[],l=0,c=s.length;l<c;l++){var h=s[l],d=o[l],f=void 0,p=r[l];if(d.mode===Mm.TRIANGLES||d.mode===Mm.TRIANGLE_STRIP||d.mode===Mm.TRIANGLE_FAN||void 0===d.mode)!0===(f=!0===a.isSkinnedMesh?new Vl(h,p):new oo(h,p)).isSkinnedMesh&&f.normalizeSkinWeights(),d.mode===Mm.TRIANGLE_STRIP?f.geometry=jv(f.geometry,an):d.mode===Mm.TRIANGLE_FAN&&(f.geometry=jv(f.geometry,on));else if(d.mode===Mm.LINES)f=new fc(h,p);else if(d.mode===Mm.LINE_STRIP)f=new cc(h,p);else if(d.mode===Mm.LINE_LOOP)f=new pc(h,p);else{if(d.mode!==Mm.POINTS)throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+d.mode);f=new xc(h,p)}Object.keys(f.geometry.morphAttributes).length>0&&Dm(f,a),f.name=n.createUniqueName(a.name||"mesh_"+e),Im(f,a),d.extensions&&Pm(i,f,d),n.assignFinalMaterial(f),u.push(f)}for(var v=0,m=u.length;v<m;v++)n.associations.set(u[v],{meshes:e,primitives:v});if(1===u.length)return a.extensions&&Pm(i,u[0],a),u[0];var g=new $u;a.extensions&&Pm(i,g,a),n.associations.set(g,{meshes:e});for(var y=0,_=u.length;y<_;y++)g.add(u[y]);return g}))}},{key:"loadCamera",value:function(e){var t,n=this.json.cameras[e],r=n[n.type];if(r)return"perspective"===n.type?t=new mo(vr.radToDeg(r.yfov),r.aspectRatio||1,r.znear||1,r.zfar||2e6):"orthographic"===n.type&&(t=new Ho(-r.xmag,r.xmag,r.ymag,-r.ymag,r.znear,r.zfar)),n.name&&(t.name=this.createUniqueName(n.name)),Im(t,n),Promise.resolve(t);console.warn("THREE.GLTFLoader: Missing camera parameters.")}},{key:"loadSkin",value:function(e){for(var t=this.json.skins[e],n=[],r=0,i=t.joints.length;r<i;r++)n.push(this._loadNodeShallow(t.joints[r]));return void 0!==t.inverseBindMatrices?n.push(this.getDependency("accessor",t.inverseBindMatrices)):n.push(null),Promise.all(n).then((function(e){for(var n=e.pop(),r=e,i=[],a=[],o=0,s=r.length;o<s;o++){var u=r[o];if(u){i.push(u);var l=new wi;null!==n&&l.fromArray(n.array,16*o),a.push(l)}else console.warn('THREE.GLTFLoader: Joint "%s" could not be found.',t.joints[o])}return new Yl(i,a)}))}},{key:"loadAnimation",value:function(e){for(var t=this.json,n=this,r=t.animations[e],i=r.name?r.name:"animation_"+e,a=[],o=[],s=[],u=[],l=[],c=0,h=r.channels.length;c<h;c++){var d=r.channels[c],f=r.samplers[d.sampler],p=d.target,v=p.node,m=void 0!==r.parameters?r.parameters[f.input]:f.input,g=void 0!==r.parameters?r.parameters[f.output]:f.output;void 0!==p.node&&(a.push(this.getDependency("node",v)),o.push(this.getDependency("accessor",m)),s.push(this.getDependency("accessor",g)),u.push(f),l.push(p))}return Promise.all([Promise.all(a),Promise.all(o),Promise.all(s),Promise.all(u),Promise.all(l)]).then((function(e){for(var t=e[0],r=e[1],a=e[2],o=e[3],s=e[4],u=[],l=0,c=t.length;l<c;l++){var h=t[l],d=r[l],f=a[l],p=o[l],v=s[l];if(void 0!==h){h.updateMatrix&&h.updateMatrix();var m=n._createAnimationTracks(h,d,f,p,v);if(m)for(var g=0;g<m.length;g++)u.push(m[g])}}return new Ad(i,void 0,u)}))}},{key:"createNodeMesh",value:function(e){var t=this.json,n=this,r=t.nodes[e];return void 0===r.mesh?null:n.getDependency("mesh",r.mesh).then((function(e){var t=n._getNodeRef(n.meshCache,r.mesh,e);return void 0!==r.weights&&t.traverse((function(e){if(e.isMesh)for(var t=0,n=r.weights.length;t<n;t++)e.morphTargetInfluences[t]=r.weights[t]})),t}))}},{key:"loadNode",value:function(e){for(var t=this,n=this.json.nodes[e],r=t._loadNodeShallow(e),i=[],a=n.children||[],o=0,s=a.length;o<s;o++)i.push(t.getDependency("node",a[o]));var u=void 0===n.skin?Promise.resolve(null):t.getDependency("skin",n.skin);return Promise.all([r,Promise.all(i),u]).then((function(e){var t=e[0],n=e[1],r=e[2];null!==r&&t.traverse((function(e){e.isSkinnedMesh&&e.bind(r,Fm)}));for(var i=0,a=n.length;i<a;i++)t.add(n[i]);return t}))}},{key:"_loadNodeShallow",value:function(e){var t=this.json,n=this.extensions,r=this;if(void 0!==this.nodeCache[e])return this.nodeCache[e];var i=t.nodes[e],a=i.name?r.createUniqueName(i.name):"",o=[],s=r._invokeOne((function(t){return t.createNodeMesh&&t.createNodeMesh(e)}));return s&&o.push(s),void 0!==i.camera&&o.push(r.getDependency("camera",i.camera).then((function(e){return r._getNodeRef(r.cameraCache,i.camera,e)}))),r._invokeAll((function(t){return t.createNodeAttachment&&t.createNodeAttachment(e)})).forEach((function(e){o.push(e)})),this.nodeCache[e]=Promise.all(o).then((function(t){var o;if((o=!0===i.isBone?new Wl:t.length>1?new $u:1===t.length?t[0]:new Zi)!==t[0])for(var s=0,u=t.length;s<u;s++)o.add(t[s]);if(i.name&&(o.userData.name=i.name,o.name=a),Im(o,i),i.extensions&&Pm(n,o,i),void 0!==i.matrix){var l=new wi;l.fromArray(i.matrix),o.applyMatrix4(l)}else void 0!==i.translation&&o.position.fromArray(i.translation),void 0!==i.rotation&&o.quaternion.fromArray(i.rotation),void 0!==i.scale&&o.scale.fromArray(i.scale);return r.associations.has(o)||r.associations.set(o,{}),r.associations.get(o).nodes=e,o})),this.nodeCache[e]}},{key:"loadScene",value:function(e){var t=this.extensions,n=this.json.scenes[e],r=this,i=new $u;n.name&&(i.name=r.createUniqueName(n.name)),Im(i,n),n.extensions&&Pm(t,i,n);for(var a=n.nodes||[],o=[],s=0,u=a.length;s<u;s++)o.push(r.getDependency("node",a[s]));return Promise.all(o).then((function(e){for(var t=0,n=e.length;t<n;t++)i.add(e[t]);return r.associations=function(e){var t,n=new Map,i=v(r.associations);try{for(i.s();!(t=i.n()).done;){var a=m(t.value,2),o=a[0],s=a[1];(o instanceof la||o instanceof Fr)&&n.set(o,s)}}catch(e){i.e(e)}finally{i.f()}return e.traverse((function(e){var t=r.associations.get(e);null!=t&&n.set(e,t)})),n}(i),i}))}},{key:"_createAnimationTracks",value:function(e,t,n,r,i){var a,o=[],s=e.name?e.name:e.uuid,u=[];switch(Am[i.path]===Am.weights?e.traverse((function(e){e.morphTargetInfluences&&u.push(e.name?e.name:e.uuid)})):u.push(s),Am[i.path]){case Am.weights:a=Sd;break;case Am.rotation:a=wd;break;case Am.position:case Am.scale:a=Ed;break;default:if(1===n.itemSize)a=Sd;else a=Ed}for(var l=void 0!==r.interpolation?Rm[r.interpolation]:Kt,c=this._getArrayFromAccessor(n),h=0,d=u.length;h<d;h++){var f=new a(u[h]+"."+Am[i.path],t.array,c,l);"CUBICSPLINE"===r.interpolation&&this._createCubicSplineTrackInterpolant(f),o.push(f)}return o}},{key:"_getArrayFromAccessor",value:function(e){var t=e.array;if(e.normalized){for(var n=Nm(t.constructor),r=new Float32Array(t.length),i=0,a=t.length;i<a;i++)r[i]=t[i]*n;t=r}return t}},{key:"_createCubicSplineTrackInterpolant",value:function(e){e.createInterpolant=function(e){return new(this instanceof wd?xm:ym)(this.times,this.values,this.getValueSize()/3,e)},e.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0}}]),e}();function zm(e,t,n){var r=t.attributes,i=[];function a(t,r){return n.getDependency("accessor",t).then((function(t){e.setAttribute(r,t)}))}for(var o in r){var s=Em[o]||o.toLowerCase();s in e.attributes||i.push(a(r[o],s))}if(void 0!==t.indices&&!e.index){var u=n.getDependency("accessor",t.indices).then((function(t){e.setIndex(t)}));i.push(u)}return Im(e,t),function(e,t,n){var r=t.attributes,i=new Jr;if(void 0!==r.POSITION){var a=n.json.accessors[r.POSITION],o=a.min,s=a.max;if(void 0!==o&&void 0!==s){if(i.set(new Yr(o[0],o[1],o[2]),new Yr(s[0],s[1],s[2])),a.normalized){var u=Nm(Sm[a.componentType]);i.min.multiplyScalar(u),i.max.multiplyScalar(u)}var l=t.targets;if(void 0!==l){for(var c=new Yr,h=new Yr,d=0,f=l.length;d<f;d++){var p=l[d];if(void 0!==p.POSITION){var v=n.json.accessors[p.POSITION],m=v.min,g=v.max;if(void 0!==m&&void 0!==g){if(h.setX(Math.max(Math.abs(m[0]),Math.abs(g[0]))),h.setY(Math.max(Math.abs(m[1]),Math.abs(g[1]))),h.setZ(Math.max(Math.abs(m[2]),Math.abs(g[2]))),v.normalized){var y=Nm(Sm[v.componentType]);h.multiplyScalar(y)}c.max(h)}else console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}i.expandByVector(c)}e.boundingBox=i;var _=new vi;i.getCenter(_.center),_.radius=i.min.distanceTo(i.max)/2,e.boundingSphere=_}else console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}(e,t,n),Promise.all(i).then((function(){return void 0!==t.targets?function(e,t,n){for(var r=!1,i=!1,a=!1,o=0,s=t.length;o<s;o++){var u=t[o];if(void 0!==u.POSITION&&(r=!0),void 0!==u.NORMAL&&(i=!0),void 0!==u.COLOR_0&&(a=!0),r&&i&&a)break}if(!r&&!i&&!a)return Promise.resolve(e);for(var l=[],c=[],h=[],d=0,f=t.length;d<f;d++){var p=t[d];if(r){var v=void 0!==p.POSITION?n.getDependency("accessor",p.POSITION):e.attributes.position;l.push(v)}if(i){var m=void 0!==p.NORMAL?n.getDependency("accessor",p.NORMAL):e.attributes.normal;c.push(m)}if(a){var g=void 0!==p.COLOR_0?n.getDependency("accessor",p.COLOR_0):e.attributes.color;h.push(g)}}return Promise.all([Promise.all(l),Promise.all(c),Promise.all(h)]).then((function(t){var n=t[0],o=t[1],s=t[2];return r&&(e.morphAttributes.position=n),i&&(e.morphAttributes.normal=o),a&&(e.morphAttributes.color=s),e.morphTargetsRelative=!0,e}))}(e,t.targets,n):e}))}var Hm=function(e){return URL.createObjectURL(new Blob([e],{type:"text/javascript"}))};try{URL.revokeObjectURL(Hm(""))}catch(e){Hm=function(e){return"data:application/javascript;charset=UTF-8,"+encodeURI(e)},function(e){return new Worker(e,{type:"module"})}}var Gm=Uint8Array,Vm=Uint16Array,Wm=Uint32Array,jm=new Gm([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),Xm=new Gm([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),qm=new Gm([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Ym=function(e,t){for(var n=new Vm(31),r=0;r<31;++r)n[r]=t+=1<<e[r-1];var i=new Wm(n[30]);for(r=1;r<30;++r)for(var a=n[r];a<n[r+1];++a)i[a]=a-n[r]<<5|r;return[n,i]},Zm=Ym(jm,2),Km=Zm[0],Jm=Zm[1];Km[28]=258,Jm[258]=28;for(var Qm=Ym(Xm,0),$m=Qm[0],eg=(Qm[1],new Vm(32768)),tg=0;tg<32768;++tg){var ng=(43690&tg)>>>1|(21845&tg)<<1;ng=(61680&(ng=(52428&ng)>>>2|(13107&ng)<<2))>>>4|(3855&ng)<<4,eg[tg]=((65280&ng)>>>8|(255&ng)<<8)>>>1}var rg=function(e,t,n){for(var r=e.length,i=0,a=new Vm(t);i<r;++i)++a[e[i]-1];var o,s=new Vm(t);for(i=0;i<t;++i)s[i]=s[i-1]+a[i-1]<<1;if(n){o=new Vm(1<<t);var u=15-t;for(i=0;i<r;++i)if(e[i])for(var l=i<<4|e[i],c=t-e[i],h=s[e[i]-1]++<<c,d=h|(1<<c)-1;h<=d;++h)o[eg[h]>>>u]=l}else for(o=new Vm(r),i=0;i<r;++i)e[i]&&(o[i]=eg[s[e[i]-1]++]>>>15-e[i]);return o},ig=new Gm(288);for(tg=0;tg<144;++tg)ig[tg]=8;for(tg=144;tg<256;++tg)ig[tg]=9;for(tg=256;tg<280;++tg)ig[tg]=7;for(tg=280;tg<288;++tg)ig[tg]=8;var ag=new Gm(32);for(tg=0;tg<32;++tg)ag[tg]=5;var og=rg(ig,9,1),sg=rg(ag,5,1),ug=function(e){for(var t=e[0],n=1;n<e.length;++n)e[n]>t&&(t=e[n]);return t},lg=function(e,t,n){var r=t/8|0;return(e[r]|e[r+1]<<8)>>(7&t)&n},cg=function(e,t){var n=t/8|0;return(e[n]|e[n+1]<<8|e[n+2]<<16)>>(7&t)},hg=function(e){return(e/8|0)+(7&e&&1)},dg=function(e,t,n){(null==t||t<0)&&(t=0),(null==n||n>e.length)&&(n=e.length);var r=new(e instanceof Vm?Vm:e instanceof Wm?Wm:Gm)(n-t);return r.set(e.subarray(t,n)),r},fg=function(e,t,n){var r=e.length;if(!r||n&&!n.l&&r<5)return t||new Gm(0);var i=!t||n,a=!n||n.i;n||(n={}),t||(t=new Gm(3*r));var o=function(e){var n=t.length;if(e>n){var r=new Gm(Math.max(2*n,e));r.set(t),t=r}},s=n.f||0,u=n.p||0,l=n.b||0,c=n.l,h=n.d,d=n.m,f=n.n,p=8*r;do{if(!c){n.f=s=lg(e,u,1);var v=lg(e,u+1,3);if(u+=3,!v){var m=e[(A=hg(u)+4)-4]|e[A-3]<<8,g=A+m;if(g>r){if(a)throw"unexpected EOF";break}i&&o(l+m),t.set(e.subarray(A,g),l),n.b=l+=m,n.p=u=8*g;continue}if(1==v)c=og,h=sg,d=9,f=5;else{if(2!=v)throw"invalid block type";var y=lg(e,u,31)+257,_=lg(e,u+10,15)+4,x=y+lg(e,u+5,31)+1;u+=14;for(var M=new Gm(x),S=new Gm(19),b=0;b<_;++b)S[qm[b]]=lg(e,u+3*b,7);u+=3*_;var w=ug(S),T=(1<<w)-1,E=rg(S,w,1);for(b=0;b<x;){var A,R=E[lg(e,u,T)];if(u+=15&R,(A=R>>>4)<16)M[b++]=A;else{var k=0,C=0;for(16==A?(C=3+lg(e,u,3),u+=2,k=M[b-1]):17==A?(C=3+lg(e,u,7),u+=3):18==A&&(C=11+lg(e,u,127),u+=7);C--;)M[b++]=k}}var L=M.subarray(0,y),P=M.subarray(y);d=ug(L),f=ug(P),c=rg(L,d,1),h=rg(P,f,1)}if(u>p){if(a)throw"unexpected EOF";break}}i&&o(l+131072);for(var I=(1<<d)-1,D=(1<<f)-1,U=u;;U=u){var O=(k=c[cg(e,u)&I])>>>4;if((u+=15&k)>p){if(a)throw"unexpected EOF";break}if(!k)throw"invalid length/literal";if(O<256)t[l++]=O;else{if(256==O){U=u,c=null;break}var N=O-254;if(O>264){var F=jm[b=O-257];N=lg(e,u,(1<<F)-1)+Km[b],u+=F}var B=h[cg(e,u)&D],z=B>>>4;if(!B)throw"invalid distance";u+=15&B;P=$m[z];if(z>3){F=Xm[z];P+=cg(e,u)&(1<<F)-1,u+=F}if(u>p){if(a)throw"unexpected EOF";break}i&&o(l+131072);for(var H=l+N;l<H;l+=4)t[l]=t[l-P],t[l+1]=t[l+1-P],t[l+2]=t[l+2-P],t[l+3]=t[l+3-P];l=H}}n.l=c,n.p=U,n.b=l,c&&(s=1,n.m=d,n.d=h,n.n=f)}while(!s);return l==t.length?t:dg(t,0,l)},pg=new Gm(0),vg=function(e){if(8!=(15&e[0])||e[0]>>>4>7||(e[0]<<8|e[1])%31)throw"invalid zlib data";if(32&e[1])throw"invalid zlib data: preset dictionaries not supported"};function mg(e,t){return fg((vg(e),e.subarray(2,-4)),t)}var gg="undefined"!=typeof TextDecoder&&new TextDecoder;try{gg.decode(pg,{stream:!0}),1}catch(e){}function yg(e,t,n){var r=n.length-e-1;if(t>=n[r])return r-1;if(t<=n[e])return e;for(var i=e,a=r,o=Math.floor((i+a)/2);t<n[o]||t>=n[o+1];)t<n[o]?a=o:i=o,o=Math.floor((i+a)/2);return o}function _g(e,t,n,r){var i=[],a=[],o=[];i[0]=1;for(var s=1;s<=n;++s){a[s]=t-r[e+1-s],o[s]=r[e+s]-t;for(var u=0,l=0;l<s;++l){var c=o[l+1],h=a[s-l],d=i[l]/(c+h);i[l]=u+c*d,u=h*d}i[s]=u}return i}function xg(e,t,n,r){for(var i=yg(e,r,t),a=_g(i,r,e,t),o=new Br(0,0,0,0),s=0;s<=e;++s){var u=n[i-e+s],l=a[s],c=u.w*l;o.x+=u.x*c,o.y+=u.y*c,o.z+=u.z*c,o.w+=u.w*l}return o}function Mg(e,t){for(var n=1,r=2;r<=e;++r)n*=r;for(var i=1,a=2;a<=t;++a)i*=a;for(var o=2;o<=e-t;++o)i*=o;return n/i}function Sg(e,t,n,r,i){var a=function(e,t,n,r,i){for(var a=i<e?i:e,o=[],s=yg(e,r,t),u=function(e,t,n,r,i){for(var a=[],o=0;o<=n;++o)a[o]=0;for(var s=[],u=0;u<=r;++u)s[u]=a.slice(0);for(var l=[],c=0;c<=n;++c)l[c]=a.slice(0);l[0][0]=1;for(var h=a.slice(0),d=a.slice(0),f=1;f<=n;++f){h[f]=t-i[e+1-f],d[f]=i[e+f]-t;for(var p=0,v=0;v<f;++v){var m=d[v+1],g=h[f-v];l[f][v]=m+g;var y=l[v][f-1]/l[f][v];l[v][f]=p+m*y,p=g*y}l[f][f]=p}for(var _=0;_<=n;++_)s[0][_]=l[_][n];for(var x=0;x<=n;++x){for(var M=0,S=1,b=[],w=0;w<=n;++w)b[w]=a.slice(0);b[0][0]=1;for(var T=1;T<=r;++T){var E=0,A=x-T,R=n-T;x>=T&&(b[S][0]=b[M][0]/l[R+1][A],E=b[S][0]*l[A][R]);for(var k=x-1<=R?T-1:n-x,C=A>=-1?1:-A;C<=k;++C)b[S][C]=(b[M][C]-b[M][C-1])/l[R+1][A+C],E+=b[S][C]*l[A+C][R];x<=R&&(b[S][T]=-b[M][T-1]/l[R+1][x],E+=b[S][T]*l[x][R]),s[T][x]=E;var L=M;M=S,S=L}}for(var P=n,I=1;I<=r;++I){for(var D=0;D<=n;++D)s[I][D]*=P;P*=n-I}return s}(s,r,e,a,t),l=[],c=0;c<n.length;++c){var h=n[c].clone(),d=h.w;h.x*=d,h.y*=d,h.z*=d,l[c]=h}for(var f=0;f<=a;++f){for(var p=l[s-e].clone().multiplyScalar(u[f][0]),v=1;v<=e;++v)p.add(l[s-e+v].clone().multiplyScalar(u[f][v]));o[f]=p}for(var m=a+1;m<=i+1;++m)o[m]=new Br(0,0,0);return o}(e,t,n,r,i);return function(e){for(var t=e.length,n=[],r=[],i=0;i<t;++i){var a=e[i];n[i]=new Yr(a.x,a.y,a.z),r[i]=a.w}for(var o=[],s=0;s<t;++s){for(var u=n[s].clone(),l=1;l<=s;++l)u.sub(o[s-l].clone().multiplyScalar(Mg(s,l)*r[l]));o[s]=u.divideScalar(r[0])}return o}(a)}var bg,wg,Tg,Eg=function(e){w(n,e);var t=E(n);function n(e,r,i,o,s){var u;a(this,n),(u=t.call(this)).degree=e,u.knots=r,u.controlPoints=[],u.startKnot=o||0,u.endKnot=s||u.knots.length-1;for(var l=0;l<i.length;++l){var c=i[l];u.controlPoints[l]=new Br(c.x,c.y,c.z,c.w)}return u}return s(n,[{key:"getPoint",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Yr,n=t,r=this.knots[this.startKnot]+e*(this.knots[this.endKnot]-this.knots[this.startKnot]),i=xg(this.degree,this.knots,this.controlPoints,r);return 1!==i.w&&i.divideScalar(i.w),n.set(i.x,i.y,i.z)}},{key:"getTangent",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Yr,n=t,r=this.knots[0]+e*(this.knots[this.knots.length-1]-this.knots[0]),i=Sg(this.degree,this.knots,this.controlPoints,r,1);return n.copy(i[1]).normalize(),n}}]),n}(Rc),Ag=function(e){w(n,e);var t=E(n);function n(e){return a(this,n),t.call(this,e)}return s(n,[{key:"load",value:function(e,t,n,r){var i=this,a=""===i.path?cf.extractUrlBase(e):i.path,o=new Od(this.manager);o.setPath(i.path),o.setResponseType("arraybuffer"),o.setRequestHeader(i.requestHeader),o.setWithCredentials(i.withCredentials),o.load(e,(function(n){try{t(i.parse(n,a))}catch(t){r?r(t):console.error(t),i.manager.itemError(e)}}),n,r)}},{key:"parse",value:function(e,t){if(i="Kaydara FBX Binary \0",(r=e).byteLength>=i.length&&i===Wg(r,0,i.length))bg=(new Pg).parse(e);else{var n=Wg(e);if(!function(e){var t=["K","a","y","d","a","r","a","\\","F","B","X","\\","B","i","n","a","r","y","\\","\\"],n=0;function r(t){var r=e[t-1];return e=e.slice(n+t),n++,r}for(var i=0;i<t.length;++i){if(r(1)===t[i])return!1}return!0}(n))throw new Error("THREE.FBXLoader: Unknown format.");if(Ug(n)<7e3)throw new Error("THREE.FBXLoader: FBX version not supported, FileVersion: "+Ug(n));bg=(new Lg).parse(n)}var r,i,a=new Gd(this.manager).setPath(this.resourcePath||t).setCrossOrigin(this.crossOrigin);return new Rg(a,this.manager).parse(bg)}}]),n}(Pd),Rg=function(){function e(t,n){a(this,e),this.textureLoader=t,this.manager=n}return s(e,[{key:"parse",value:function(){wg=this.parseConnections();var e=this.parseImages(),t=this.parseTextures(e),n=this.parseMaterials(t),r=this.parseDeformers(),i=(new kg).parse(r);return this.parseScene(r,i,n),Tg}},{key:"parseConnections",value:function(){var e=new Map;"Connections"in bg&&bg.Connections.connections.forEach((function(t){var n=t[0],r=t[1],i=t[2];e.has(n)||e.set(n,{parents:[],children:[]});var a={ID:r,relationship:i};e.get(n).parents.push(a),e.has(r)||e.set(r,{parents:[],children:[]});var o={ID:n,relationship:i};e.get(r).children.push(o)}));return e}},{key:"parseImages",value:function(){var e={},t={};if("Video"in bg.Objects){var n=bg.Objects.Video;for(var r in n){var i=n[r];if(e[parseInt(r)]=i.RelativeFilename||i.Filename,"Content"in i){var a=i.Content instanceof ArrayBuffer&&i.Content.byteLength>0,o="string"==typeof i.Content&&""!==i.Content;if(a||o){var s=this.parseImage(n[r]);t[i.RelativeFilename||i.Filename]=s}}}}for(var u in e){var l=e[u];void 0!==t[l]?e[u]=t[l]:e[u]=e[u].split("\\").pop()}return e}},{key:"parseImage",value:function(e){var t,n=e.Content,r=e.RelativeFilename||e.Filename,i=r.slice(r.lastIndexOf(".")+1).toLowerCase();switch(i){case"bmp":t="image/bmp";break;case"jpg":case"jpeg":t="image/jpeg";break;case"png":t="image/png";break;case"tif":t="image/tiff";break;case"tga":null===this.manager.getHandler(".tga")&&console.warn("FBXLoader: TGA loader not found, skipping ",r),t="image/tga";break;default:return void console.warn('FBXLoader: Image type "'+i+'" is not supported.')}if("string"==typeof n)return"data:"+t+";base64,"+n;var a=new Uint8Array(n);return window.URL.createObjectURL(new Blob([a],{type:t}))}},{key:"parseTextures",value:function(e){var t=new Map;if("Texture"in bg.Objects){var n=bg.Objects.Texture;for(var r in n){var i=this.parseTexture(n[r],e);t.set(parseInt(r),i)}}return t}},{key:"parseTexture",value:function(e,t){var n=this.loadTexture(e,t);n.ID=e.id,n.name=e.attrName;var r=e.WrapModeU,i=e.WrapModeV,a=void 0!==r?r.value:0,o=void 0!==i?i.value:0;if(n.wrapS=0===a?Ue:Oe,n.wrapT=0===o?Ue:Oe,"Scaling"in e){var s=e.Scaling.value;n.repeat.x=s[0],n.repeat.y=s[1]}if("Translation"in e){var u=e.Translation.value;n.offset.x=u[0],n.offset.y=u[1]}return n}},{key:"loadTexture",value:function(e,t){var n,r,i=this.textureLoader.path,a=wg.get(e.id).children;void 0!==a&&a.length>0&&void 0!==t[a[0].ID]&&(0!==(n=t[a[0].ID]).indexOf("blob:")&&0!==n.indexOf("data:")||this.textureLoader.setPath(void 0));var o=e.FileName.slice(-3).toLowerCase();if("tga"===o){var s=this.manager.getHandler(".tga");null===s?(console.warn("FBXLoader: TGA loader not found, creating placeholder texture for",e.RelativeFilename),r=new Fr):(s.setPath(this.textureLoader.path),r=s.load(n))}else"psd"===o?(console.warn("FBXLoader: PSD textures are not supported, creating placeholder texture for",e.RelativeFilename),r=new Fr):r=this.textureLoader.load(n);return this.textureLoader.setPath(i),r}},{key:"parseMaterials",value:function(e){var t=new Map;if("Material"in bg.Objects){var n=bg.Objects.Material;for(var r in n){var i=this.parseMaterial(n[r],e);null!==i&&t.set(parseInt(r),i)}}return t}},{key:"parseMaterial",value:function(e,t){var n=e.id,r=e.attrName,i=e.ShadingModel;if("object"===$p(i)&&(i=i.value),!wg.has(n))return null;var a,o=this.parseParameters(e,t,n);switch(i.toLowerCase()){case"phong":a=new nd;break;case"lambert":a=new ad;break;default:console.warn('THREE.FBXLoader: unknown material type "%s". Defaulting to MeshPhongMaterial.',i),a=new nd}return a.setValues(o),a.name=r,a}},{key:"parseParameters",value:function(e,t,n){var r={};e.BumpFactor&&(r.bumpScale=e.BumpFactor.value),e.Diffuse?r.color=(new pa).fromArray(e.Diffuse.value).convertSRGBToLinear():!e.DiffuseColor||"Color"!==e.DiffuseColor.type&&"ColorRGB"!==e.DiffuseColor.type||(r.color=(new pa).fromArray(e.DiffuseColor.value).convertSRGBToLinear()),e.DisplacementFactor&&(r.displacementScale=e.DisplacementFactor.value),e.Emissive?r.emissive=(new pa).fromArray(e.Emissive.value).convertSRGBToLinear():!e.EmissiveColor||"Color"!==e.EmissiveColor.type&&"ColorRGB"!==e.EmissiveColor.type||(r.emissive=(new pa).fromArray(e.EmissiveColor.value).convertSRGBToLinear()),e.EmissiveFactor&&(r.emissiveIntensity=parseFloat(e.EmissiveFactor.value)),e.Opacity&&(r.opacity=parseFloat(e.Opacity.value)),r.opacity<1&&(r.transparent=!0),e.ReflectionFactor&&(r.reflectivity=e.ReflectionFactor.value),e.Shininess&&(r.shininess=e.Shininess.value),e.Specular?r.specular=(new pa).fromArray(e.Specular.value).convertSRGBToLinear():e.SpecularColor&&"Color"===e.SpecularColor.type&&(r.specular=(new pa).fromArray(e.SpecularColor.value).convertSRGBToLinear());var i=this;return wg.get(n).children.forEach((function(e){var n=e.relationship;switch(n){case"Bump":r.bumpMap=i.getTexture(t,e.ID);break;case"Maya|TEX_ao_map":r.aoMap=i.getTexture(t,e.ID);break;case"DiffuseColor":case"Maya|TEX_color_map":r.map=i.getTexture(t,e.ID),void 0!==r.map&&(r.map.colorSpace=pn);break;case"DisplacementColor":r.displacementMap=i.getTexture(t,e.ID);break;case"EmissiveColor":r.emissiveMap=i.getTexture(t,e.ID),void 0!==r.emissiveMap&&(r.emissiveMap.colorSpace=pn);break;case"NormalMap":case"Maya|TEX_normal_map":r.normalMap=i.getTexture(t,e.ID);break;case"ReflectionColor":r.envMap=i.getTexture(t,e.ID),void 0!==r.envMap&&(r.envMap.mapping=Pe,r.envMap.colorSpace=pn);break;case"SpecularColor":r.specularMap=i.getTexture(t,e.ID),void 0!==r.specularMap&&(r.specularMap.colorSpace=pn);break;case"TransparentColor":case"TransparencyFactor":r.alphaMap=i.getTexture(t,e.ID),r.transparent=!0;break;default:console.warn("THREE.FBXLoader: %s map is not supported in three.js, skipping texture.",n)}})),r}},{key:"getTexture",value:function(e,t){return"LayeredTexture"in bg.Objects&&t in bg.Objects.LayeredTexture&&(console.warn("THREE.FBXLoader: layered textures are not supported in three.js. Discarding all but first layer."),t=wg.get(t).children[0].ID),e.get(t)}},{key:"parseDeformers",value:function(){var e={},t={};if("Deformer"in bg.Objects){var n=bg.Objects.Deformer;for(var r in n){var i=n[r],a=wg.get(parseInt(r));if("Skin"===i.attrType){var o=this.parseSkeleton(a,n);o.ID=r,a.parents.length>1&&console.warn("THREE.FBXLoader: skeleton attached to more than one geometry is not supported."),o.geometryID=a.parents[0].ID,e[r]=o}else if("BlendShape"===i.attrType){var s={id:r};s.rawTargets=this.parseMorphTargets(a,n),s.id=r,a.parents.length>1&&console.warn("THREE.FBXLoader: morph target attached to more than one geometry is not supported."),t[r]=s}}}return{skeletons:e,morphTargets:t}}},{key:"parseSkeleton",value:function(e,t){var n=[];return e.children.forEach((function(e){var r=t[e.ID];if("Cluster"===r.attrType){var i={ID:e.ID,indices:[],weights:[],transformLink:(new wi).fromArray(r.TransformLink.a)};"Indexes"in r&&(i.indices=r.Indexes.a,i.weights=r.Weights.a),n.push(i)}})),{rawBones:n,bones:[]}}},{key:"parseMorphTargets",value:function(e,t){for(var n=[],r=0;r<e.children.length;r++){var i=e.children[r],a=t[i.ID],o={name:a.attrName,initialWeight:a.DeformPercent,id:a.id,fullWeights:a.FullWeights.a};if("BlendShapeChannel"!==a.attrType)return;o.geoID=wg.get(parseInt(i.ID)).children.filter((function(e){return void 0===e.relationship}))[0].ID,n.push(o)}return n}},{key:"parseScene",value:function(e,t,n){Tg=new $u;var r=this.parseModels(e.skeletons,t,n),i=bg.Objects.Model,a=this;r.forEach((function(e){var t=i[e.ID];a.setLookAtProperties(e,t),wg.get(e.ID).parents.forEach((function(t){var n=r.get(t.ID);void 0!==n&&n.add(e)})),null===e.parent&&Tg.add(e)})),this.bindSkeleton(e.skeletons,t,r),this.createAmbientLight(),Tg.traverse((function(e){if(e.userData.transformData){e.parent&&(e.userData.transformData.parentMatrix=e.parent.matrix,e.userData.transformData.parentMatrixWorld=e.parent.matrixWorld);var t=Hg(e.userData.transformData);e.applyMatrix4(t),e.updateWorldMatrix()}}));var o=(new Cg).parse();1===Tg.children.length&&Tg.children[0].isGroup&&(Tg.children[0].animations=o,Tg=Tg.children[0]),Tg.animations=o}},{key:"parseModels",value:function(e,t,n){var r=new Map,i=bg.Objects.Model;for(var a in i){var o=parseInt(a),s=i[a],u=wg.get(o),l=this.buildSkeleton(u,e,o,s.attrName);if(!l){switch(s.attrType){case"Camera":l=this.createCamera(u);break;case"Light":l=this.createLight(u);break;case"Mesh":l=this.createMesh(u,t,n);break;case"NurbsCurve":l=this.createCurve(u,t);break;case"LimbNode":case"Root":l=new Wl;break;default:l=new $u}l.name=s.attrName?Yf.sanitizeNodeName(s.attrName):"",l.ID=o}this.getTransformData(l,s),r.set(o,l)}return r}},{key:"buildSkeleton",value:function(e,t,n,r){var i=null;return e.parents.forEach((function(e){var a=function(){var a=t[o];a.rawBones.forEach((function(t,o){if(t.ID===e.ID){var s=i;(i=new Wl).matrixWorld.copy(t.transformLink),i.name=r?Yf.sanitizeNodeName(r):"",i.ID=n,a.bones[o]=i,null!==s&&i.add(s)}}))};for(var o in t)a()})),i}},{key:"createCamera",value:function(e){var t,n;if(e.children.forEach((function(e){var t=bg.Objects.NodeAttribute[e.ID];void 0!==t&&(n=t)})),void 0===n)t=new Zi;else{var r=0;void 0!==n.CameraProjectionType&&1===n.CameraProjectionType.value&&(r=1);var i=1;void 0!==n.NearPlane&&(i=n.NearPlane.value/1e3);var a=1e3;void 0!==n.FarPlane&&(a=n.FarPlane.value/1e3);var o=window.innerWidth,s=window.innerHeight;void 0!==n.AspectWidth&&void 0!==n.AspectHeight&&(o=n.AspectWidth.value,s=n.AspectHeight.value);var u=o/s,l=45;void 0!==n.FieldOfView&&(l=n.FieldOfView.value);var c=n.FocalLength?n.FocalLength.value:null;switch(r){case 0:t=new mo(l,u,i,a),null!==c&&t.setFocalLength(c);break;case 1:t=new Ho(-o/2,o/2,s/2,-s/2,i,a);break;default:console.warn("THREE.FBXLoader: Unknown camera type "+r+"."),t=new Zi}}return t}},{key:"createLight",value:function(e){var t,n;if(e.children.forEach((function(e){var t=bg.Objects.NodeAttribute[e.ID];void 0!==t&&(n=t)})),void 0===n)t=new Zi;else{var r;r=void 0===n.LightType?0:n.LightType.value;var i=16777215;void 0!==n.Color&&(i=(new pa).fromArray(n.Color.value).convertSRGBToLinear());var a=void 0===n.Intensity?1:n.Intensity.value/100;void 0!==n.CastLightOnObject&&0===n.CastLightOnObject.value&&(a=0);var o=0;void 0!==n.FarAttenuationEnd&&(o=void 0!==n.EnableFarAttenuation&&0===n.EnableFarAttenuation.value?0:n.FarAttenuationEnd.value);switch(r){case 0:t=new tf(i,a,o,1);break;case 1:t=new rf(i,a);break;case 2:var s=Math.PI/3;void 0!==n.InnerAngle&&(s=vr.degToRad(n.InnerAngle.value));var u=0;void 0!==n.OuterAngle&&(u=vr.degToRad(n.OuterAngle.value),u=Math.max(u,1)),t=new Kd(i,a,o,s,u,1);break;default:console.warn("THREE.FBXLoader: Unknown light type "+n.LightType.value+", defaulting to a PointLight."),t=new tf(i,a)}void 0!==n.CastShadows&&1===n.CastShadows.value&&(t.castShadow=!0)}return t}},{key:"createMesh",value:function(e,t,n){var r,i=null,a=null,o=[];return e.children.forEach((function(e){t.has(e.ID)&&(i=t.get(e.ID)),n.has(e.ID)&&o.push(n.get(e.ID))})),o.length>1?a=o:o.length>0?a=o[0]:(a=new nd({name:Pd.DEFAULT_MATERIAL_NAME,color:13421772}),o.push(a)),"color"in i.attributes&&o.forEach((function(e){e.vertexColors=!0})),i.FBX_Deformer?(r=new Vl(i,a)).normalizeSkinWeights():r=new oo(i,a),r}},{key:"createCurve",value:function(e,t){var n=e.children.reduce((function(e,n){return t.has(n.ID)&&(e=t.get(n.ID)),e}),null),r=new ic({name:Pd.DEFAULT_MATERIAL_NAME,color:3342591,linewidth:1});return new cc(n,r)}},{key:"getTransformData",value:function(e,t){var n={};"InheritType"in t&&(n.inheritType=parseInt(t.InheritType.value)),n.eulerOrder="RotationOrder"in t?Gg(t.RotationOrder.value):"ZYX","Lcl_Translation"in t&&(n.translation=t.Lcl_Translation.value),"PreRotation"in t&&(n.preRotation=t.PreRotation.value),"Lcl_Rotation"in t&&(n.rotation=t.Lcl_Rotation.value),"PostRotation"in t&&(n.postRotation=t.PostRotation.value),"Lcl_Scaling"in t&&(n.scale=t.Lcl_Scaling.value),"ScalingOffset"in t&&(n.scalingOffset=t.ScalingOffset.value),"ScalingPivot"in t&&(n.scalingPivot=t.ScalingPivot.value),"RotationOffset"in t&&(n.rotationOffset=t.RotationOffset.value),"RotationPivot"in t&&(n.rotationPivot=t.RotationPivot.value),e.userData.transformData=n}},{key:"setLookAtProperties",value:function(e,t){"LookAtProperty"in t&&wg.get(e.ID).children.forEach((function(t){if("LookAtProperty"===t.relationship){var n=bg.Objects.Model[t.ID];if("Lcl_Translation"in n){var r=n.Lcl_Translation.value;void 0!==e.target?(e.target.position.fromArray(r),Tg.add(e.target)):e.lookAt((new Yr).fromArray(r))}}}))}},{key:"bindSkeleton",value:function(e,t,n){var r=this.parsePoseNodes(),i=function(){var i=e[a];wg.get(parseInt(i.ID)).parents.forEach((function(e){if(t.has(e.ID)){var a=e.ID;wg.get(a).parents.forEach((function(e){n.has(e.ID)&&n.get(e.ID).bind(new Yl(i.bones),r[e.ID])}))}}))};for(var a in e)i()}},{key:"parsePoseNodes",value:function(){var e={};if("Pose"in bg.Objects){var t=bg.Objects.Pose;for(var n in t)if("BindPose"===t[n].attrType&&t[n].NbPoseNodes>0){var r=t[n].PoseNode;Array.isArray(r)?r.forEach((function(t){e[t.Node]=(new wi).fromArray(t.Matrix.a)})):e[r.Node]=(new wi).fromArray(r.Matrix.a)}}return e}},{key:"createAmbientLight",value:function(){if("GlobalSettings"in bg&&"AmbientColor"in bg.GlobalSettings){var e=bg.GlobalSettings.AmbientColor.value,t=e[0],n=e[1],r=e[2];if(0!==t||0!==n||0!==r){var i=new pa(t,n,r).convertSRGBToLinear();Tg.add(new af(i,1))}}}}]),e}(),kg=function(){function e(){a(this,e),this.negativeMaterialIndices=!1}return s(e,[{key:"parse",value:function(e){var t=new Map;if("Geometry"in bg.Objects){var n=bg.Objects.Geometry;for(var r in n){var i=wg.get(parseInt(r)),a=this.parseGeometry(i,n[r],e);t.set(parseInt(r),a)}}return!0===this.negativeMaterialIndices&&console.warn("THREE.FBXLoader: The FBX file contains invalid (negative) material indices. The asset might not render as expected."),t}},{key:"parseGeometry",value:function(e,t,n){switch(t.attrType){case"Mesh":return this.parseMeshGeometry(e,t,n);case"NurbsCurve":return this.parseNurbsGeometry(t)}}},{key:"parseMeshGeometry",value:function(e,t,n){var r=n.skeletons,i=[],a=e.parents.map((function(e){return bg.Objects.Model[e.ID]}));if(0!==a.length){var o=e.children.reduce((function(e,t){return void 0!==r[t.ID]&&(e=r[t.ID]),e}),null);e.children.forEach((function(e){void 0!==n.morphTargets[e.ID]&&i.push(n.morphTargets[e.ID])}));var s=a[0],u={};"RotationOrder"in s&&(u.eulerOrder=Gg(s.RotationOrder.value)),"InheritType"in s&&(u.inheritType=parseInt(s.InheritType.value)),"GeometricTranslation"in s&&(u.translation=s.GeometricTranslation.value),"GeometricRotation"in s&&(u.rotation=s.GeometricRotation.value),"GeometricScaling"in s&&(u.scale=s.GeometricScaling.value);var l=Hg(u);return this.genGeometry(t,o,i,l)}}},{key:"genGeometry",value:function(e,t,n,r){var i=new Ga;e.attrName&&(i.name=e.attrName);var a=this.parseGeoNode(e,t),o=this.genBuffers(a),s=new Ia(o.vertex,3);if(s.applyMatrix4(r),i.setAttribute("position",s),o.colors.length>0&&i.setAttribute("color",new Ia(o.colors,3)),t&&(i.setAttribute("skinIndex",new ka(o.weightsIndices,4)),i.setAttribute("skinWeight",new Ia(o.vertexWeights,4)),i.FBX_Deformer=t),o.normal.length>0){var u=(new gr).getNormalMatrix(r),l=new Ia(o.normal,3);l.applyNormalMatrix(u),i.setAttribute("normal",l)}if(o.uvs.forEach((function(e,t){var n=0===t?"uv":"uv".concat(t);i.setAttribute(n,new Ia(o.uvs[t],2))})),a.material&&"AllSame"!==a.material.mappingType){var c=o.materialIndex[0],h=0;if(o.materialIndex.forEach((function(e,t){e!==c&&(i.addGroup(h,t-h,c),c=e,h=t)})),i.groups.length>0){var d=i.groups[i.groups.length-1],f=d.start+d.count;f!==o.materialIndex.length&&i.addGroup(f,o.materialIndex.length-f,c)}0===i.groups.length&&i.addGroup(0,o.materialIndex.length,o.materialIndex[0])}return this.addMorphTargets(i,e,n,r),i}},{key:"parseGeoNode",value:function(e,t){var n={};if(n.vertexPositions=void 0!==e.Vertices?e.Vertices.a:[],n.vertexIndices=void 0!==e.PolygonVertexIndex?e.PolygonVertexIndex.a:[],e.LayerElementColor&&(n.color=this.parseVertexColors(e.LayerElementColor[0])),e.LayerElementMaterial&&(n.material=this.parseMaterialIndices(e.LayerElementMaterial[0])),e.LayerElementNormal&&(n.normal=this.parseNormals(e.LayerElementNormal[0])),e.LayerElementUV){n.uv=[];for(var r=0;e.LayerElementUV[r];)e.LayerElementUV[r].UV&&n.uv.push(this.parseUVs(e.LayerElementUV[r])),r++}return n.weightTable={},null!==t&&(n.skeleton=t,t.rawBones.forEach((function(e,t){e.indices.forEach((function(r,i){void 0===n.weightTable[r]&&(n.weightTable[r]=[]),n.weightTable[r].push({id:t,weight:e.weights[i]})}))}))),n}},{key:"genBuffers",value:function(e){var t={vertex:[],normal:[],colors:[],uvs:[],materialIndex:[],vertexWeights:[],weightsIndices:[]},n=0,r=0,i=!1,a=[],o=[],s=[],u=[],l=[],c=[],h=this;return e.vertexIndices.forEach((function(d,f){var p,v=!1;d<0&&(d^=-1,v=!0);var m=[],g=[];if(a.push(3*d,3*d+1,3*d+2),e.color){var y=Fg(f,n,d,e.color);s.push(y[0],y[1],y[2])}if(e.skeleton){if(void 0!==e.weightTable[d]&&e.weightTable[d].forEach((function(e){g.push(e.weight),m.push(e.id)})),g.length>4){i||(console.warn("THREE.FBXLoader: Vertex has more than 4 skinning weights assigned to vertex. Deleting additional weights."),i=!0);var _=[0,0,0,0],x=[0,0,0,0];g.forEach((function(e,t){var n=e,r=m[t];x.forEach((function(e,t,i){if(n>e){i[t]=n,n=e;var a=_[t];_[t]=r,r=a}}))})),m=_,g=x}for(;g.length<4;)g.push(0),m.push(0);for(var M=0;M<4;++M)l.push(g[M]),c.push(m[M])}if(e.normal){var S=Fg(f,n,d,e.normal);o.push(S[0],S[1],S[2])}e.material&&"AllSame"!==e.material.mappingType&&(p=Fg(f,n,d,e.material)[0])<0&&(h.negativeMaterialIndices=!0,p=0),e.uv&&e.uv.forEach((function(e,t){var r=Fg(f,n,d,e);void 0===u[t]&&(u[t]=[]),u[t].push(r[0]),u[t].push(r[1])})),r++,v&&(r>4&&console.warn("THREE.FBXLoader: Polygons with more than four sides are not supported. Make sure to triangulate the geometry during export."),h.genFace(t,e,a,p,o,s,u,l,c,r),n++,r=0,a=[],o=[],s=[],u=[],l=[],c=[])})),t}},{key:"genFace",value:function(e,t,n,r,i,a,o,s,u,l){for(var c=function(l){e.vertex.push(t.vertexPositions[n[0]]),e.vertex.push(t.vertexPositions[n[1]]),e.vertex.push(t.vertexPositions[n[2]]),e.vertex.push(t.vertexPositions[n[3*(l-1)]]),e.vertex.push(t.vertexPositions[n[3*(l-1)+1]]),e.vertex.push(t.vertexPositions[n[3*(l-1)+2]]),e.vertex.push(t.vertexPositions[n[3*l]]),e.vertex.push(t.vertexPositions[n[3*l+1]]),e.vertex.push(t.vertexPositions[n[3*l+2]]),t.skeleton&&(e.vertexWeights.push(s[0]),e.vertexWeights.push(s[1]),e.vertexWeights.push(s[2]),e.vertexWeights.push(s[3]),e.vertexWeights.push(s[4*(l-1)]),e.vertexWeights.push(s[4*(l-1)+1]),e.vertexWeights.push(s[4*(l-1)+2]),e.vertexWeights.push(s[4*(l-1)+3]),e.vertexWeights.push(s[4*l]),e.vertexWeights.push(s[4*l+1]),e.vertexWeights.push(s[4*l+2]),e.vertexWeights.push(s[4*l+3]),e.weightsIndices.push(u[0]),e.weightsIndices.push(u[1]),e.weightsIndices.push(u[2]),e.weightsIndices.push(u[3]),e.weightsIndices.push(u[4*(l-1)]),e.weightsIndices.push(u[4*(l-1)+1]),e.weightsIndices.push(u[4*(l-1)+2]),e.weightsIndices.push(u[4*(l-1)+3]),e.weightsIndices.push(u[4*l]),e.weightsIndices.push(u[4*l+1]),e.weightsIndices.push(u[4*l+2]),e.weightsIndices.push(u[4*l+3])),t.color&&(e.colors.push(a[0]),e.colors.push(a[1]),e.colors.push(a[2]),e.colors.push(a[3*(l-1)]),e.colors.push(a[3*(l-1)+1]),e.colors.push(a[3*(l-1)+2]),e.colors.push(a[3*l]),e.colors.push(a[3*l+1]),e.colors.push(a[3*l+2])),t.material&&"AllSame"!==t.material.mappingType&&(e.materialIndex.push(r),e.materialIndex.push(r),e.materialIndex.push(r)),t.normal&&(e.normal.push(i[0]),e.normal.push(i[1]),e.normal.push(i[2]),e.normal.push(i[3*(l-1)]),e.normal.push(i[3*(l-1)+1]),e.normal.push(i[3*(l-1)+2]),e.normal.push(i[3*l]),e.normal.push(i[3*l+1]),e.normal.push(i[3*l+2])),t.uv&&t.uv.forEach((function(t,n){void 0===e.uvs[n]&&(e.uvs[n]=[]),e.uvs[n].push(o[n][0]),e.uvs[n].push(o[n][1]),e.uvs[n].push(o[n][2*(l-1)]),e.uvs[n].push(o[n][2*(l-1)+1]),e.uvs[n].push(o[n][2*l]),e.uvs[n].push(o[n][2*l+1])}))},h=2;h<l;h++)c(h)}},{key:"addMorphTargets",value:function(e,t,n,r){if(0!==n.length){e.morphTargetsRelative=!0,e.morphAttributes.position=[];var i=this;n.forEach((function(n){n.rawTargets.forEach((function(n){var a=bg.Objects.Geometry[n.geoID];void 0!==a&&i.genMorphGeometry(e,t,a,r,n.name)}))}))}}},{key:"genMorphGeometry",value:function(e,t,n,r,i){for(var a=void 0!==t.PolygonVertexIndex?t.PolygonVertexIndex.a:[],o=void 0!==n.Vertices?n.Vertices.a:[],s=void 0!==n.Indexes?n.Indexes.a:[],u=3*e.attributes.position.count,l=new Float32Array(u),c=0;c<s.length;c++){var h=3*s[c];l[h]=o[3*c],l[h+1]=o[3*c+1],l[h+2]=o[3*c+2]}var d={vertexIndices:a,vertexPositions:l},f=this.genBuffers(d),p=new Ia(f.vertex,3);p.name=i||n.attrName,p.applyMatrix4(r),e.morphAttributes.position.push(p)}},{key:"parseNormals",value:function(e){var t=e.MappingInformationType,n=e.ReferenceInformationType,r=e.Normals.a,i=[];return"IndexToDirect"===n&&("NormalIndex"in e?i=e.NormalIndex.a:"NormalsIndex"in e&&(i=e.NormalsIndex.a)),{dataSize:3,buffer:r,indices:i,mappingType:t,referenceType:n}}},{key:"parseUVs",value:function(e){var t=e.MappingInformationType,n=e.ReferenceInformationType,r=e.UV.a,i=[];return"IndexToDirect"===n&&(i=e.UVIndex.a),{dataSize:2,buffer:r,indices:i,mappingType:t,referenceType:n}}},{key:"parseVertexColors",value:function(e){var t=e.MappingInformationType,n=e.ReferenceInformationType,r=e.Colors.a,i=[];"IndexToDirect"===n&&(i=e.ColorIndex.a);for(var a=0,o=new pa;a<r.length;a+=4)o.fromArray(r,a).convertSRGBToLinear().toArray(r,a);return{dataSize:4,buffer:r,indices:i,mappingType:t,referenceType:n}}},{key:"parseMaterialIndices",value:function(e){var t=e.MappingInformationType,n=e.ReferenceInformationType;if("NoMappingInformation"===t)return{dataSize:1,buffer:[0],indices:[0],mappingType:"AllSame",referenceType:n};for(var r=e.Materials.a,i=[],a=0;a<r.length;++a)i.push(a);return{dataSize:1,buffer:r,indices:i,mappingType:t,referenceType:n}}},{key:"parseNurbsGeometry",value:function(e){var t=parseInt(e.Order);if(isNaN(t))return console.error("THREE.FBXLoader: Invalid Order %s given for geometry ID: %s",e.Order,e.id),new Ga;for(var n,r,i=t-1,a=e.KnotVector.a,o=[],s=e.Points.a,u=0,l=s.length;u<l;u+=4)o.push((new Br).fromArray(s,u));if("Closed"===e.Form)o.push(o[0]);else if("Periodic"===e.Form){n=i,r=a.length-1-n;for(var c=0;c<i;++c)o.push(o[c])}var h=new Eg(i,a,o,n,r).getPoints(12*o.length);return(new Ga).setFromPoints(h)}}]),e}(),Cg=function(){function e(){a(this,e)}return s(e,[{key:"parse",value:function(){var e=[],t=this.parseClips();if(void 0!==t)for(var n in t){var r=t[n],i=this.addClip(r);e.push(i)}return e}},{key:"parseClips",value:function(){if(void 0!==bg.Objects.AnimationCurve){var e=this.parseAnimationCurveNodes();this.parseAnimationCurves(e);var t=this.parseAnimationLayers(e);return this.parseAnimStacks(t)}}},{key:"parseAnimationCurveNodes",value:function(){var e=bg.Objects.AnimationCurveNode,t=new Map;for(var n in e){var r=e[n];if(null!==r.attrName.match(/S|R|T|DeformPercent/)){var i={id:r.id,attr:r.attrName,curves:{}};t.set(i.id,i)}}return t}},{key:"parseAnimationCurves",value:function(e){var t=bg.Objects.AnimationCurve;for(var n in t){var r={id:t[n].id,times:t[n].KeyTime.a.map(Og),values:t[n].KeyValueFloat.a},i=wg.get(r.id);if(void 0!==i){var a=i.parents[0].ID,o=i.parents[0].relationship;o.match(/X/)?e.get(a).curves.x=r:o.match(/Y/)?e.get(a).curves.y=r:o.match(/Z/)?e.get(a).curves.z=r:o.match(/DeformPercent/)&&e.has(a)&&(e.get(a).curves.morph=r)}}}},{key:"parseAnimationLayers",value:function(e){var t=bg.Objects.AnimationLayer,n=new Map,r=function(){var t=[],r=wg.get(parseInt(i));void 0!==r&&(r.children.forEach((function(n,r){if(e.has(n.ID)){var i=e.get(n.ID);if(void 0!==i.curves.x||void 0!==i.curves.y||void 0!==i.curves.z){if(void 0===t[r]){var a=wg.get(n.ID).parents.filter((function(e){return void 0!==e.relationship}))[0].ID;if(void 0!==a){var o=bg.Objects.Model[a.toString()];if(void 0===o)return void console.warn("THREE.FBXLoader: Encountered a unused curve.",n);var s={modelName:o.attrName?Yf.sanitizeNodeName(o.attrName):"",ID:o.id,initialPosition:[0,0,0],initialRotation:[0,0,0],initialScale:[1,1,1]};Tg.traverse((function(e){e.ID===o.id&&(s.transform=e.matrix,e.userData.transformData&&(s.eulerOrder=e.userData.transformData.eulerOrder))})),s.transform||(s.transform=new wi),"PreRotation"in o&&(s.preRotation=o.PreRotation.value),"PostRotation"in o&&(s.postRotation=o.PostRotation.value),t[r]=s}}t[r]&&(t[r][i.attr]=i)}else if(void 0!==i.curves.morph){if(void 0===t[r]){var u=wg.get(n.ID).parents.filter((function(e){return void 0!==e.relationship}))[0].ID,l=wg.get(u).parents[0].ID,c=wg.get(l).parents[0].ID,h=wg.get(c).parents[0].ID,d=bg.Objects.Model[h],f={modelName:d.attrName?Yf.sanitizeNodeName(d.attrName):"",morphName:bg.Objects.Deformer[u].attrName};t[r]=f}t[r][i.attr]=i}}})),n.set(parseInt(i),t))};for(var i in t)r();return n}},{key:"parseAnimStacks",value:function(e){var t=bg.Objects.AnimationStack,n={};for(var r in t){var i=wg.get(parseInt(r)).children;i.length>1&&console.warn("THREE.FBXLoader: Encountered an animation stack with multiple layers, this is currently not supported. Ignoring subsequent layers.");var a=e.get(i[0].ID);n[r]={name:t[r].attrName,layer:a}}return n}},{key:"addClip",value:function(e){var t=[],n=this;return e.layer.forEach((function(e){t=t.concat(n.generateTracks(e))})),new Ad(e.name,-1,t)}},{key:"generateTracks",value:function(e){var t=[],n=new Yr,r=new qr,i=new Yr;if(e.transform&&e.transform.decompose(n,r,i),n=n.toArray(),r=(new Di).setFromQuaternion(r,e.eulerOrder).toArray(),i=i.toArray(),void 0!==e.T&&Object.keys(e.T.curves).length>0){var a=this.generateVectorTrack(e.modelName,e.T.curves,n,"position");void 0!==a&&t.push(a)}if(void 0!==e.R&&Object.keys(e.R.curves).length>0){var o=this.generateRotationTrack(e.modelName,e.R.curves,r,e.preRotation,e.postRotation,e.eulerOrder);void 0!==o&&t.push(o)}if(void 0!==e.S&&Object.keys(e.S.curves).length>0){var s=this.generateVectorTrack(e.modelName,e.S.curves,i,"scale");void 0!==s&&t.push(s)}if(void 0!==e.DeformPercent){var u=this.generateMorphTrack(e);void 0!==u&&t.push(u)}return t}},{key:"generateVectorTrack",value:function(e,t,n,r){var i=this.getTimesForAllAxes(t),a=this.getKeyframeTrackValues(i,t,n);return new Ed(e+"."+r,i,a)}},{key:"generateRotationTrack",value:function(e,t,n,r,i,a){void 0!==t.x&&(this.interpolateRotations(t.x),t.x.values=t.x.values.map(vr.degToRad)),void 0!==t.y&&(this.interpolateRotations(t.y),t.y.values=t.y.values.map(vr.degToRad)),void 0!==t.z&&(this.interpolateRotations(t.z),t.z.values=t.z.values.map(vr.degToRad));var o=this.getTimesForAllAxes(t),s=this.getKeyframeTrackValues(o,t,n);void 0!==r&&((r=r.map(vr.degToRad)).push(a),r=(new Di).fromArray(r),r=(new qr).setFromEuler(r)),void 0!==i&&((i=i.map(vr.degToRad)).push(a),i=(new Di).fromArray(i),i=(new qr).setFromEuler(i).invert());for(var u=new qr,l=new Di,c=[],h=0;h<s.length;h+=3)l.set(s[h],s[h+1],s[h+2],a),u.setFromEuler(l),void 0!==r&&u.premultiply(r),void 0!==i&&u.multiply(i),u.toArray(c,h/3*4);return new wd(e+".quaternion",o,c)}},{key:"generateMorphTrack",value:function(e){var t=e.DeformPercent.curves.morph,n=t.values.map((function(e){return e/100})),r=Tg.getObjectByName(e.modelName).morphTargetDictionary[e.morphName];return new Sd(e.modelName+".morphTargetInfluences["+r+"]",t.times,n)}},{key:"getTimesForAllAxes",value:function(e){var t=[];if(void 0!==e.x&&(t=t.concat(e.x.times)),void 0!==e.y&&(t=t.concat(e.y.times)),void 0!==e.z&&(t=t.concat(e.z.times)),t=t.sort((function(e,t){return e-t})),t.length>1){for(var n=1,r=t[0],i=1;i<t.length;i++){var a=t[i];a!==r&&(t[n]=a,r=a,n++)}t=t.slice(0,n)}return t}},{key:"getKeyframeTrackValues",value:function(e,t,n){var r=n,i=[],a=-1,o=-1,s=-1;return e.forEach((function(e){if(t.x&&(a=t.x.times.indexOf(e)),t.y&&(o=t.y.times.indexOf(e)),t.z&&(s=t.z.times.indexOf(e)),-1!==a){var n=t.x.values[a];i.push(n),r[0]=n}else i.push(r[0]);if(-1!==o){var u=t.y.values[o];i.push(u),r[1]=u}else i.push(r[1]);if(-1!==s){var l=t.z.values[s];i.push(l),r[2]=l}else i.push(r[2])})),i}},{key:"interpolateRotations",value:function(e){for(var t=1;t<e.values.length;t++){var n=e.values[t-1],r=e.values[t]-n,i=Math.abs(r);if(i>=180){for(var a=i/180,o=r/a,s=n+o,u=e.times[t-1],l=(e.times[t]-u)/a,c=u+l,h=[],d=[];c<e.times[t];)h.push(c),c+=l,d.push(s),s+=o;e.times=jg(e.times,t,h),e.values=jg(e.values,t,d)}}}}]),e}(),Lg=function(){function e(){a(this,e)}return s(e,[{key:"getPrevNode",value:function(){return this.nodeStack[this.currentIndent-2]}},{key:"getCurrentNode",value:function(){return this.nodeStack[this.currentIndent-1]}},{key:"getCurrentProp",value:function(){return this.currentProp}},{key:"pushStack",value:function(e){this.nodeStack.push(e),this.currentIndent+=1}},{key:"popStack",value:function(){this.nodeStack.pop(),this.currentIndent-=1}},{key:"setCurrentProp",value:function(e,t){this.currentProp=e,this.currentPropName=t}},{key:"parse",value:function(e){this.currentIndent=0,this.allNodes=new Dg,this.nodeStack=[],this.currentProp=[],this.currentPropName="";var t=this,n=e.split(/[\r\n]+/);return n.forEach((function(e,r){var i=e.match(/^[\s\t]*;/),a=e.match(/^[\s\t]*$/);if(!i&&!a){var o=e.match("^\\t{"+t.currentIndent+"}(\\w+):(.*){",""),s=e.match("^\\t{"+t.currentIndent+"}(\\w+):[\\s\\t\\r\\n](.*)"),u=e.match("^\\t{"+(t.currentIndent-1)+"}}");o?t.parseNodeBegin(e,o):s?t.parseNodeProperty(e,s,n[++r]):u?t.popStack():e.match(/^[^\s\t}]/)&&t.parseNodePropertyContinued(e)}})),this.allNodes}},{key:"parseNodeBegin",value:function(e,t){var n=t[1].trim().replace(/^"/,"").replace(/"$/,""),r=t[2].split(",").map((function(e){return e.trim().replace(/^"/,"").replace(/"$/,"")})),i={name:n},a=this.parseNodeAttr(r),o=this.getCurrentNode();0===this.currentIndent?this.allNodes.add(n,i):n in o?("PoseNode"===n?o.PoseNode.push(i):void 0!==o[n].id&&(o[n]={},o[n][o[n].id]=o[n]),""!==a.id&&(o[n][a.id]=i)):"number"==typeof a.id?(o[n]={},o[n][a.id]=i):"Properties70"!==n&&(o[n]="PoseNode"===n?[i]:i),"number"==typeof a.id&&(i.id=a.id),""!==a.name&&(i.attrName=a.name),""!==a.type&&(i.attrType=a.type),this.pushStack(i)}},{key:"parseNodeAttr",value:function(e){var t=e[0];""!==e[0]&&(t=parseInt(e[0]),isNaN(t)&&(t=e[0]));var n="",r="";return e.length>1&&(n=e[1].replace(/^(\w+)::/,""),r=e[2]),{id:t,name:n,type:r}}},{key:"parseNodeProperty",value:function(e,t,n){var r=t[1].replace(/^"/,"").replace(/"$/,"").trim(),i=t[2].replace(/^"/,"").replace(/"$/,"").trim();"Content"===r&&","===i&&(i=n.replace(/"/g,"").replace(/,$/,"").trim());var a=this.getCurrentNode();if("Properties70"!==a.name){if("C"===r){var o=i.split(",").slice(1),s=parseInt(o[0]),u=parseInt(o[1]),l=i.split(",").slice(3);r="connections",function(e,t){for(var n=0,r=e.length,i=t.length;n<i;n++,r++)e[r]=t[n]}(i=[s,u],l=l.map((function(e){return e.trim().replace(/^"/,"")}))),void 0===a[r]&&(a[r]=[])}"Node"===r&&(a.id=i),r in a&&Array.isArray(a[r])?a[r].push(i):"a"!==r?a[r]=i:a.a=i,this.setCurrentProp(a,r),"a"===r&&","!==i.slice(-1)&&(a.a=Vg(i))}else this.parseNodeSpecialProperty(e,r,i)}},{key:"parseNodePropertyContinued",value:function(e){var t=this.getCurrentNode();t.a+=e,","!==e.slice(-1)&&(t.a=Vg(t.a))}},{key:"parseNodeSpecialProperty",value:function(e,t,n){var r=n.split('",').map((function(e){return e.trim().replace(/^\"/,"").replace(/\s/,"_")})),i=r[0],a=r[1],o=r[2],s=r[3],u=r[4];switch(a){case"int":case"enum":case"bool":case"ULongLong":case"double":case"Number":case"FieldOfView":u=parseFloat(u);break;case"Color":case"ColorRGB":case"Vector3D":case"Lcl_Translation":case"Lcl_Rotation":case"Lcl_Scaling":u=Vg(u)}this.getPrevNode()[i]={type:a,type2:o,flag:s,value:u},this.setCurrentProp(this.getPrevNode(),i)}}]),e}(),Pg=function(){function e(){a(this,e)}return s(e,[{key:"parse",value:function(e){var t=new Ig(e);t.skip(23);var n=t.getUint32();if(n<6400)throw new Error("THREE.FBXLoader: FBX version not supported, FileVersion: "+n);for(var r=new Dg;!this.endOfContent(t);){var i=this.parseNode(t,n);null!==i&&r.add(i.name,i)}return r}},{key:"endOfContent",value:function(e){return e.size()%16==0?(e.getOffset()+160+16&-16)>=e.size():e.getOffset()+160+16>=e.size()}},{key:"parseNode",value:function(e,t){var n={},r=t>=7500?e.getUint64():e.getUint32(),i=t>=7500?e.getUint64():e.getUint32();t>=7500?e.getUint64():e.getUint32();var a=e.getUint8(),o=e.getString(a);if(0===r)return null;for(var s=[],u=0;u<i;u++)s.push(this.parseProperty(e));var l=s.length>0?s[0]:"",c=s.length>1?s[1]:"",h=s.length>2?s[2]:"";for(n.singleProperty=1===i&&e.getOffset()===r;r>e.getOffset();){var d=this.parseNode(e,t);null!==d&&this.parseSubNode(o,n,d)}return n.propertyList=s,"number"==typeof l&&(n.id=l),""!==c&&(n.attrName=c),""!==h&&(n.attrType=h),""!==o&&(n.name=o),n}},{key:"parseSubNode",value:function(e,t,n){if(!0===n.singleProperty){var r=n.propertyList[0];Array.isArray(r)?(t[n.name]=n,n.a=r):t[n.name]=r}else if("Connections"===e&&"C"===n.name){var i=[];n.propertyList.forEach((function(e,t){0!==t&&i.push(e)})),void 0===t.connections&&(t.connections=[]),t.connections.push(i)}else if("Properties70"===n.name){Object.keys(n).forEach((function(e){t[e]=n[e]}))}else if("Properties70"===e&&"P"===n.name){var a,o=n.propertyList[0],s=n.propertyList[1],u=n.propertyList[2],l=n.propertyList[3];0===o.indexOf("Lcl ")&&(o=o.replace("Lcl ","Lcl_")),0===s.indexOf("Lcl ")&&(s=s.replace("Lcl ","Lcl_")),a="Color"===s||"ColorRGB"===s||"Vector"===s||"Vector3D"===s||0===s.indexOf("Lcl_")?[n.propertyList[4],n.propertyList[5],n.propertyList[6]]:n.propertyList[4],t[o]={type:s,type2:u,flag:l,value:a}}else void 0===t[n.name]?"number"==typeof n.id?(t[n.name]={},t[n.name][n.id]=n):t[n.name]=n:"PoseNode"===n.name?(Array.isArray(t[n.name])||(t[n.name]=[t[n.name]]),t[n.name].push(n)):void 0===t[n.name][n.id]&&(t[n.name][n.id]=n)}},{key:"parseProperty",value:function(e){var t,n=e.getString(1);switch(n){case"C":return e.getBoolean();case"D":return e.getFloat64();case"F":return e.getFloat32();case"I":return e.getInt32();case"L":return e.getInt64();case"R":return t=e.getUint32(),e.getArrayBuffer(t);case"S":return t=e.getUint32(),e.getString(t);case"Y":return e.getInt16();case"b":case"c":case"d":case"f":case"i":case"l":var r=e.getUint32(),i=e.getUint32(),a=e.getUint32();if(0===i)switch(n){case"b":case"c":return e.getBooleanArray(r);case"d":return e.getFloat64Array(r);case"f":return e.getFloat32Array(r);case"i":return e.getInt32Array(r);case"l":return e.getInt64Array(r)}var o=mg(new Uint8Array(e.getArrayBuffer(a))),s=new Ig(o.buffer);switch(n){case"b":case"c":return s.getBooleanArray(r);case"d":return s.getFloat64Array(r);case"f":return s.getFloat32Array(r);case"i":return s.getInt32Array(r);case"l":return s.getInt64Array(r)}break;default:throw new Error("THREE.FBXLoader: Unknown property type "+n)}}}]),e}(),Ig=function(){function e(t,n){a(this,e),this.dv=new DataView(t),this.offset=0,this.littleEndian=void 0===n||n,this._textDecoder=new TextDecoder}return s(e,[{key:"getOffset",value:function(){return this.offset}},{key:"size",value:function(){return this.dv.buffer.byteLength}},{key:"skip",value:function(e){this.offset+=e}},{key:"getBoolean",value:function(){return 1==(1&this.getUint8())}},{key:"getBooleanArray",value:function(e){for(var t=[],n=0;n<e;n++)t.push(this.getBoolean());return t}},{key:"getUint8",value:function(){var e=this.dv.getUint8(this.offset);return this.offset+=1,e}},{key:"getInt16",value:function(){var e=this.dv.getInt16(this.offset,this.littleEndian);return this.offset+=2,e}},{key:"getInt32",value:function(){var e=this.dv.getInt32(this.offset,this.littleEndian);return this.offset+=4,e}},{key:"getInt32Array",value:function(e){for(var t=[],n=0;n<e;n++)t.push(this.getInt32());return t}},{key:"getUint32",value:function(){var e=this.dv.getUint32(this.offset,this.littleEndian);return this.offset+=4,e}},{key:"getInt64",value:function(){var e,t;return this.littleEndian?(e=this.getUint32(),t=this.getUint32()):(t=this.getUint32(),e=this.getUint32()),2147483648&t?(t=4294967295&~t,4294967295===(e=4294967295&~e)&&(t=t+1&4294967295),-(4294967296*t+(e=e+1&4294967295))):4294967296*t+e}},{key:"getInt64Array",value:function(e){for(var t=[],n=0;n<e;n++)t.push(this.getInt64());return t}},{key:"getUint64",value:function(){var e,t;return this.littleEndian?(e=this.getUint32(),t=this.getUint32()):(t=this.getUint32(),e=this.getUint32()),4294967296*t+e}},{key:"getFloat32",value:function(){var e=this.dv.getFloat32(this.offset,this.littleEndian);return this.offset+=4,e}},{key:"getFloat32Array",value:function(e){for(var t=[],n=0;n<e;n++)t.push(this.getFloat32());return t}},{key:"getFloat64",value:function(){var e=this.dv.getFloat64(this.offset,this.littleEndian);return this.offset+=8,e}},{key:"getFloat64Array",value:function(e){for(var t=[],n=0;n<e;n++)t.push(this.getFloat64());return t}},{key:"getArrayBuffer",value:function(e){var t=this.dv.buffer.slice(this.offset,this.offset+e);return this.offset+=e,t}},{key:"getString",value:function(e){var t=this.offset,n=new Uint8Array(this.dv.buffer,t,e);this.skip(e);var r=n.indexOf(0);return r>=0&&(n=new Uint8Array(this.dv.buffer,t,r)),this._textDecoder.decode(n)}}]),e}(),Dg=function(){function e(){a(this,e)}return s(e,[{key:"add",value:function(e,t){this[e]=t}}]),e}();function Ug(e){var t=e.match(/FBXVersion: (\d+)/);if(t)return parseInt(t[1]);throw new Error("THREE.FBXLoader: Cannot find the version number for the file given.")}function Og(e){return e/46186158e3}var Ng=[];function Fg(e,t,n,r){var i;switch(r.mappingType){case"ByPolygonVertex":i=e;break;case"ByPolygon":i=t;break;case"ByVertice":i=n;break;case"AllSame":i=r.indices[0];break;default:console.warn("THREE.FBXLoader: unknown attribute mapping type "+r.mappingType)}"IndexToDirect"===r.referenceType&&(i=r.indices[i]);var a=i*r.dataSize,o=a+r.dataSize;return function(e,t,n,r){for(var i=n,a=0;i<r;i++,a++)e[a]=t[i];return e}(Ng,r.buffer,a,o)}var Bg=new Di,zg=new Yr;function Hg(e){var t=new wi,n=new wi,r=new wi,i=new wi,a=new wi,o=new wi,s=new wi,u=new wi,l=new wi,c=new wi,h=new wi,d=new wi,f=e.inheritType?e.inheritType:0;if(e.translation&&t.setPosition(zg.fromArray(e.translation)),e.preRotation){var p=e.preRotation.map(vr.degToRad);p.push(e.eulerOrder||Di.DEFAULT_ORDER),n.makeRotationFromEuler(Bg.fromArray(p))}if(e.rotation){var v=e.rotation.map(vr.degToRad);v.push(e.eulerOrder||Di.DEFAULT_ORDER),r.makeRotationFromEuler(Bg.fromArray(v))}if(e.postRotation){var m=e.postRotation.map(vr.degToRad);m.push(e.eulerOrder||Di.DEFAULT_ORDER),i.makeRotationFromEuler(Bg.fromArray(m)),i.invert()}e.scale&&a.scale(zg.fromArray(e.scale)),e.scalingOffset&&s.setPosition(zg.fromArray(e.scalingOffset)),e.scalingPivot&&o.setPosition(zg.fromArray(e.scalingPivot)),e.rotationOffset&&u.setPosition(zg.fromArray(e.rotationOffset)),e.rotationPivot&&l.setPosition(zg.fromArray(e.rotationPivot)),e.parentMatrixWorld&&(h.copy(e.parentMatrix),c.copy(e.parentMatrixWorld));var g=n.clone().multiply(r).multiply(i),y=new wi;y.extractRotation(c);var _=new wi;_.copyPosition(c);var x=_.clone().invert().multiply(c),M=y.clone().invert().multiply(x),S=a,b=new wi;if(0===f)b.copy(y).multiply(g).multiply(M).multiply(S);else if(1===f)b.copy(y).multiply(M).multiply(g).multiply(S);else{var w=(new wi).scale((new Yr).setFromMatrixScale(h)).clone().invert(),T=M.clone().multiply(w);b.copy(y).multiply(g).multiply(T).multiply(S)}var E=l.clone().invert(),A=o.clone().invert(),R=t.clone().multiply(u).multiply(l).multiply(n).multiply(r).multiply(i).multiply(E).multiply(s).multiply(o).multiply(a).multiply(A),k=(new wi).copyPosition(R),C=c.clone().multiply(k);return d.copyPosition(C),(R=d.clone().multiply(b)).premultiply(c.invert()),R}function Gg(e){var t=["ZYX","YZX","XZY","ZXY","YXZ","XYZ"];return 6===(e=e||0)?(console.warn("THREE.FBXLoader: unsupported Euler Order: Spherical XYZ. Animations and rotations may be incorrect."),t[0]):t[e]}function Vg(e){return e.split(",").map((function(e){return parseFloat(e)}))}function Wg(e,t,n){return void 0===t&&(t=0),void 0===n&&(n=e.byteLength),(new TextDecoder).decode(new Uint8Array(e,t,n))}function jg(e,t,n){return e.slice(0,t).concat(n).concat(e.slice(t))}var Xg,qg=function(){function e(){o()(this,e)}return u()(e,[{key:"loadGLTF",value:function(e,t,n,r){var i=new Xv,a=new Vv;return a.setDecoderPath("./draco/"),a.setDecoderConfig({type:"js"}),a.preload(),i.setDRACOLoader(a),new Promise((function(a,o){i.load(e,(function(e){a(t?t(e):e)}),(function(e){n&&n(e)}),(function(e){r&&r(e),o(e)}))}))}},{key:"loadFbx",value:function(e,t,n,r){var i=new Ag;return new Promise((function(a,o){i.load(e,(function(e){a(t?t(e):e)}),(function(e){n&&n(e)}),(function(e){r&&r(e),o(e)}))}))}},{key:"parseFbxBuffer",value:function(e,t){return(new Ag).parse(e,t)}}]),e}();!function(e){e.GLTF="gltf",e.GLB="glb",e.FBX="fbx"}(Xg||(Xg={}));var Yg=function(e){return new _v(e)},Zg=new Yr(0,0,0),Kg=function(e){for(var t=e.mesh.geometry.attributes.position,n=0;n<200;n++){var r=n/199;e.getPoint(r,Zg),t.setXYZ(n,Zg.x,Zg.y,Zg.z)}t.needsUpdate=!0},Jg=function(e,t){var n=[];e.forEach((function(e){n.push(function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1,a=new uo(n,r,i),o=new ma({color:16777215*Math.random()}),s=new yv(a,o);return s.addNatureEventListener("pointermove",(function(e){t.attach(e)})),s.position.copy(e),mv.scene.add(s),s}(e,t))}));var r=function(e){var t=new Ga,n=new wa(new Float32Array(600),3);t.setAttribute("position",n);var r=new Oc(e);return r.mesh=new cc(t.clone(),new ic({color:"red",opacity:1})),r}(e);return Kg(r),t.addEventListener("objectChange",(function(){Kg(r)})),r},Qg=new ip,$g=new Yr,ey=new Yr,ty=new qr,ny={X:new Yr(1,0,0),Y:new Yr(0,1,0),Z:new Yr(0,0,1)},ry={type:"change"},iy={type:"mouseDown"},ay={type:"mouseUp",mode:null},oy={type:"objectChange"},sy=function(e){w(n,e);var t=E(n);function n(e,r){var i;a(this,n),i=t.call(this),void 0===r&&(console.warn('THREE.TransformControls: The second parameter "domElement" is now mandatory.'),r=document),i.isTransformControls=!0,i.visible=!1,i.domElement=r,i.domElement.style.touchAction="none";var o=new Ry;i._gizmo=o,i.add(o);var s=new ky;i._plane=s,i.add(s);var u=S(i);function l(e,t){var n=t;Object.defineProperty(u,e,{get:function(){return void 0!==n?n:t},set:function(t){n!==t&&(n=t,s[e]=t,o[e]=t,u.dispatchEvent({type:e+"-changed",value:t}),u.dispatchEvent(ry))}}),u[e]=t,s[e]=t,o[e]=t}l("camera",e),l("object",void 0),l("enabled",!0),l("axis",null),l("mode","translate"),l("translationSnap",null),l("rotationSnap",null),l("scaleSnap",null),l("space","world"),l("size",1),l("dragging",!1),l("showX",!0),l("showY",!0),l("showZ",!0);var c=new Yr,h=new Yr,d=new qr,f=new qr,p=new Yr,v=new qr,m=new Yr,g=new Yr,y=new Yr,_=new Yr;return l("worldPosition",c),l("worldPositionStart",h),l("worldQuaternion",d),l("worldQuaternionStart",f),l("cameraPosition",p),l("cameraQuaternion",v),l("pointStart",m),l("pointEnd",g),l("rotationAxis",y),l("rotationAngle",0),l("eye",_),i._offset=new Yr,i._startNorm=new Yr,i._endNorm=new Yr,i._cameraScale=new Yr,i._parentPosition=new Yr,i._parentQuaternion=new qr,i._parentQuaternionInv=new qr,i._parentScale=new Yr,i._worldScaleStart=new Yr,i._worldQuaternionInv=new qr,i._worldScale=new Yr,i._positionStart=new Yr,i._quaternionStart=new qr,i._scaleStart=new Yr,i._getPointer=uy.bind(S(i)),i._onPointerDown=cy.bind(S(i)),i._onPointerHover=ly.bind(S(i)),i._onPointerMove=hy.bind(S(i)),i._onPointerUp=dy.bind(S(i)),i.domElement.addEventListener("pointerdown",i._onPointerDown),i.domElement.addEventListener("pointermove",i._onPointerHover),i.domElement.addEventListener("pointerup",i._onPointerUp),i}return s(n,[{key:"updateMatrixWorld",value:function(){void 0!==this.object&&(this.object.updateMatrixWorld(),null===this.object.parent?console.error("TransformControls: The attached 3D object must be a part of the scene graph."):this.object.parent.matrixWorld.decompose(this._parentPosition,this._parentQuaternion,this._parentScale),this.object.matrixWorld.decompose(this.worldPosition,this.worldQuaternion,this._worldScale),this._parentQuaternionInv.copy(this._parentQuaternion).invert(),this._worldQuaternionInv.copy(this.worldQuaternion).invert()),this.camera.updateMatrixWorld(),this.camera.matrixWorld.decompose(this.cameraPosition,this.cameraQuaternion,this._cameraScale),this.camera.isOrthographicCamera?this.camera.getWorldDirection(this.eye).negate():this.eye.copy(this.cameraPosition).sub(this.worldPosition).normalize(),y(x(n.prototype),"updateMatrixWorld",this).call(this,this)}},{key:"pointerHover",value:function(e){if(void 0!==this.object&&!0!==this.dragging){Qg.setFromCamera(e,this.camera);var t=fy(this._gizmo.picker[this.mode],Qg);this.axis=t?t.object.name:null}}},{key:"pointerDown",value:function(e){if(void 0!==this.object&&!0!==this.dragging&&0===e.button&&null!==this.axis){Qg.setFromCamera(e,this.camera);var t=fy(this._plane,Qg,!0);t&&(this.object.updateMatrixWorld(),this.object.parent.updateMatrixWorld(),this._positionStart.copy(this.object.position),this._quaternionStart.copy(this.object.quaternion),this._scaleStart.copy(this.object.scale),this.object.matrixWorld.decompose(this.worldPositionStart,this.worldQuaternionStart,this._worldScaleStart),this.pointStart.copy(t.point).sub(this.worldPositionStart)),this.dragging=!0,iy.mode=this.mode,this.dispatchEvent(iy)}}},{key:"pointerMove",value:function(e){var t=this.axis,n=this.mode,r=this.object,i=this.space;if("scale"===n?i="local":"E"!==t&&"XYZE"!==t&&"XYZ"!==t||(i="world"),void 0!==r&&null!==t&&!1!==this.dragging&&-1===e.button){Qg.setFromCamera(e,this.camera);var a=fy(this._plane,Qg,!0);if(a){if(this.pointEnd.copy(a.point).sub(this.worldPositionStart),"translate"===n)this._offset.copy(this.pointEnd).sub(this.pointStart),"local"===i&&"XYZ"!==t&&this._offset.applyQuaternion(this._worldQuaternionInv),-1===t.indexOf("X")&&(this._offset.x=0),-1===t.indexOf("Y")&&(this._offset.y=0),-1===t.indexOf("Z")&&(this._offset.z=0),"local"===i&&"XYZ"!==t?this._offset.applyQuaternion(this._quaternionStart).divide(this._parentScale):this._offset.applyQuaternion(this._parentQuaternionInv).divide(this._parentScale),r.position.copy(this._offset).add(this._positionStart),this.translationSnap&&("local"===i&&(r.position.applyQuaternion(ty.copy(this._quaternionStart).invert()),-1!==t.search("X")&&(r.position.x=Math.round(r.position.x/this.translationSnap)*this.translationSnap),-1!==t.search("Y")&&(r.position.y=Math.round(r.position.y/this.translationSnap)*this.translationSnap),-1!==t.search("Z")&&(r.position.z=Math.round(r.position.z/this.translationSnap)*this.translationSnap),r.position.applyQuaternion(this._quaternionStart)),"world"===i&&(r.parent&&r.position.add($g.setFromMatrixPosition(r.parent.matrixWorld)),-1!==t.search("X")&&(r.position.x=Math.round(r.position.x/this.translationSnap)*this.translationSnap),-1!==t.search("Y")&&(r.position.y=Math.round(r.position.y/this.translationSnap)*this.translationSnap),-1!==t.search("Z")&&(r.position.z=Math.round(r.position.z/this.translationSnap)*this.translationSnap),r.parent&&r.position.sub($g.setFromMatrixPosition(r.parent.matrixWorld))));else if("scale"===n){if(-1!==t.search("XYZ")){var o=this.pointEnd.length()/this.pointStart.length();this.pointEnd.dot(this.pointStart)<0&&(o*=-1),ey.set(o,o,o)}else $g.copy(this.pointStart),ey.copy(this.pointEnd),$g.applyQuaternion(this._worldQuaternionInv),ey.applyQuaternion(this._worldQuaternionInv),ey.divide($g),-1===t.search("X")&&(ey.x=1),-1===t.search("Y")&&(ey.y=1),-1===t.search("Z")&&(ey.z=1);r.scale.copy(this._scaleStart).multiply(ey),this.scaleSnap&&(-1!==t.search("X")&&(r.scale.x=Math.round(r.scale.x/this.scaleSnap)*this.scaleSnap||this.scaleSnap),-1!==t.search("Y")&&(r.scale.y=Math.round(r.scale.y/this.scaleSnap)*this.scaleSnap||this.scaleSnap),-1!==t.search("Z")&&(r.scale.z=Math.round(r.scale.z/this.scaleSnap)*this.scaleSnap||this.scaleSnap))}else if("rotate"===n){this._offset.copy(this.pointEnd).sub(this.pointStart);var s=20/this.worldPosition.distanceTo($g.setFromMatrixPosition(this.camera.matrixWorld));"E"===t?(this.rotationAxis.copy(this.eye),this.rotationAngle=this.pointEnd.angleTo(this.pointStart),this._startNorm.copy(this.pointStart).normalize(),this._endNorm.copy(this.pointEnd).normalize(),this.rotationAngle*=this._endNorm.cross(this._startNorm).dot(this.eye)<0?1:-1):"XYZE"===t?(this.rotationAxis.copy(this._offset).cross(this.eye).normalize(),this.rotationAngle=this._offset.dot($g.copy(this.rotationAxis).cross(this.eye))*s):"X"!==t&&"Y"!==t&&"Z"!==t||(this.rotationAxis.copy(ny[t]),$g.copy(ny[t]),"local"===i&&$g.applyQuaternion(this.worldQuaternion),this.rotationAngle=this._offset.dot($g.cross(this.eye).normalize())*s),this.rotationSnap&&(this.rotationAngle=Math.round(this.rotationAngle/this.rotationSnap)*this.rotationSnap),"local"===i&&"E"!==t&&"XYZE"!==t?(r.quaternion.copy(this._quaternionStart),r.quaternion.multiply(ty.setFromAxisAngle(this.rotationAxis,this.rotationAngle)).normalize()):(this.rotationAxis.applyQuaternion(this._parentQuaternionInv),r.quaternion.copy(ty.setFromAxisAngle(this.rotationAxis,this.rotationAngle)),r.quaternion.multiply(this._quaternionStart).normalize())}this.dispatchEvent(ry),this.dispatchEvent(oy)}}}},{key:"pointerUp",value:function(e){0===e.button&&(this.dragging&&null!==this.axis&&(ay.mode=this.mode,this.dispatchEvent(ay)),this.dragging=!1,this.axis=null)}},{key:"dispose",value:function(){this.domElement.removeEventListener("pointerdown",this._onPointerDown),this.domElement.removeEventListener("pointermove",this._onPointerHover),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.domElement.removeEventListener("pointerup",this._onPointerUp),this.traverse((function(e){e.geometry&&e.geometry.dispose(),e.material&&e.material.dispose()}))}},{key:"attach",value:function(e){return this.object=e,this.visible=!0,this}},{key:"detach",value:function(){return this.object=void 0,this.visible=!1,this.axis=null,this}},{key:"reset",value:function(){this.enabled&&this.dragging&&(this.object.position.copy(this._positionStart),this.object.quaternion.copy(this._quaternionStart),this.object.scale.copy(this._scaleStart),this.dispatchEvent(ry),this.dispatchEvent(oy),this.pointStart.copy(this.pointEnd))}},{key:"getRaycaster",value:function(){return Qg}},{key:"getMode",value:function(){return this.mode}},{key:"setMode",value:function(e){this.mode=e}},{key:"setTranslationSnap",value:function(e){this.translationSnap=e}},{key:"setRotationSnap",value:function(e){this.rotationSnap=e}},{key:"setScaleSnap",value:function(e){this.scaleSnap=e}},{key:"setSize",value:function(e){this.size=e}},{key:"setSpace",value:function(e){this.space=e}}]),n}(Zi);function uy(e){if(this.domElement.ownerDocument.pointerLockElement)return{x:0,y:0,button:e.button};var t=this.domElement.getBoundingClientRect();return{x:(e.clientX-t.left)/t.width*2-1,y:-(e.clientY-t.top)/t.height*2+1,button:e.button}}function ly(e){if(this.enabled)switch(e.pointerType){case"mouse":case"pen":this.pointerHover(this._getPointer(e))}}function cy(e){this.enabled&&(document.pointerLockElement||this.domElement.setPointerCapture(e.pointerId),this.domElement.addEventListener("pointermove",this._onPointerMove),this.pointerHover(this._getPointer(e)),this.pointerDown(this._getPointer(e)))}function hy(e){this.enabled&&this.pointerMove(this._getPointer(e))}function dy(e){this.enabled&&(this.domElement.releasePointerCapture(e.pointerId),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.pointerUp(this._getPointer(e)))}function fy(e,t,n){for(var r=t.intersectObject(e,!0),i=0;i<r.length;i++)if(r[i].object.visible||n)return r[i];return!1}var py=new Di,vy=new Yr(0,1,0),my=new Yr(0,0,0),gy=new wi,yy=new qr,_y=new qr,xy=new Yr,My=new wi,Sy=new Yr(1,0,0),by=new Yr(0,1,0),wy=new Yr(0,0,1),Ty=new Yr,Ey=new Yr,Ay=new Yr,Ry=function(e){w(n,e);var t=E(n);function n(){var e;a(this,n),(e=t.call(this)).isTransformControlsGizmo=!0,e.type="TransformControlsGizmo";var r=new ma({depthTest:!1,depthWrite:!1,fog:!1,toneMapped:!1,transparent:!0}),i=new ic({depthTest:!1,depthWrite:!1,fog:!1,toneMapped:!1,transparent:!0}),o=r.clone();o.opacity=.15;var s=i.clone();s.opacity=.5;var u=r.clone();u.color.setHex(16711680);var l=r.clone();l.color.setHex(65280);var c=r.clone();c.color.setHex(255);var h=r.clone();h.color.setHex(16711680),h.opacity=.5;var d=r.clone();d.color.setHex(65280),d.opacity=.5;var f=r.clone();f.color.setHex(255),f.opacity=.5;var p=r.clone();p.opacity=.25;var v=r.clone();v.color.setHex(16776960),v.opacity=.25,r.clone().color.setHex(16776960);var m=r.clone();m.color.setHex(7895160);var g=new $c(0,.04,.1,12);g.translate(0,.05,0);var y=new uo(.08,.08,.08);y.translate(0,.04,0);var _=new Ga;_.setAttribute("position",new Ia([0,0,0,1,0,0],3));var x=new $c(.0075,.0075,.5,3);function M(e,t){var n=new Xh(e,.0075,3,64,t*Math.PI*2);return n.rotateY(Math.PI/2),n.rotateX(Math.PI/2),n}x.translate(0,.25,0);var S,b={X:[[new oo(g,u),[.5,0,0],[0,0,-Math.PI/2]],[new oo(g,u),[-.5,0,0],[0,0,Math.PI/2]],[new oo(x,u),[0,0,0],[0,0,-Math.PI/2]]],Y:[[new oo(g,l),[0,.5,0]],[new oo(g,l),[0,-.5,0],[Math.PI,0,0]],[new oo(x,l)]],Z:[[new oo(g,c),[0,0,.5],[Math.PI/2,0,0]],[new oo(g,c),[0,0,-.5],[-Math.PI/2,0,0]],[new oo(x,c),null,[Math.PI/2,0,0]]],XYZ:[[new oo(new Hh(.1,0),p.clone()),[0,0,0]]],XY:[[new oo(new uo(.15,.15,.01),f.clone()),[.15,.15,0]]],YZ:[[new oo(new uo(.15,.15,.01),h.clone()),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new oo(new uo(.15,.15,.01),d.clone()),[.15,0,.15],[-Math.PI/2,0,0]]]},w={X:[[new oo(new $c(.2,0,.6,4),o),[.3,0,0],[0,0,-Math.PI/2]],[new oo(new $c(.2,0,.6,4),o),[-.3,0,0],[0,0,Math.PI/2]]],Y:[[new oo(new $c(.2,0,.6,4),o),[0,.3,0]],[new oo(new $c(.2,0,.6,4),o),[0,-.3,0],[0,0,Math.PI]]],Z:[[new oo(new $c(.2,0,.6,4),o),[0,0,.3],[Math.PI/2,0,0]],[new oo(new $c(.2,0,.6,4),o),[0,0,-.3],[-Math.PI/2,0,0]]],XYZ:[[new oo(new Hh(.2,0),o)]],XY:[[new oo(new uo(.2,.2,.01),o),[.15,.15,0]]],YZ:[[new oo(new uo(.2,.2,.01),o),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new oo(new uo(.2,.2,.01),o),[.15,0,.15],[-Math.PI/2,0,0]]]},T={START:[[new oo(new Hh(.01,2),s),null,null,null,"helper"]],END:[[new oo(new Hh(.01,2),s),null,null,null,"helper"]],DELTA:[[new cc((S=new Ga,S.setAttribute("position",new Ia([0,0,0,1,1,1],3)),S),s),null,null,null,"helper"]],X:[[new cc(_,s.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]],Y:[[new cc(_,s.clone()),[0,-1e3,0],[0,0,Math.PI/2],[1e6,1,1],"helper"]],Z:[[new cc(_,s.clone()),[0,0,-1e3],[0,-Math.PI/2,0],[1e6,1,1],"helper"]]},E={XYZE:[[new oo(M(.5,1),m),null,[0,Math.PI/2,0]]],X:[[new oo(M(.5,.5),u)]],Y:[[new oo(M(.5,.5),l),null,[0,0,-Math.PI/2]]],Z:[[new oo(M(.5,.5),c),null,[0,Math.PI/2,0]]],E:[[new oo(M(.75,1),v),null,[0,Math.PI/2,0]]]},A={AXIS:[[new cc(_,s.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]]},R={XYZE:[[new oo(new Wh(.25,10,8),o)]],X:[[new oo(new Xh(.5,.1,4,24),o),[0,0,0],[0,-Math.PI/2,-Math.PI/2]]],Y:[[new oo(new Xh(.5,.1,4,24),o),[0,0,0],[Math.PI/2,0,0]]],Z:[[new oo(new Xh(.5,.1,4,24),o),[0,0,0],[0,0,-Math.PI/2]]],E:[[new oo(new Xh(.75,.1,2,24),o)]]},k={X:[[new oo(y,u),[.5,0,0],[0,0,-Math.PI/2]],[new oo(x,u),[0,0,0],[0,0,-Math.PI/2]],[new oo(y,u),[-.5,0,0],[0,0,Math.PI/2]]],Y:[[new oo(y,l),[0,.5,0]],[new oo(x,l)],[new oo(y,l),[0,-.5,0],[0,0,Math.PI]]],Z:[[new oo(y,c),[0,0,.5],[Math.PI/2,0,0]],[new oo(x,c),[0,0,0],[Math.PI/2,0,0]],[new oo(y,c),[0,0,-.5],[-Math.PI/2,0,0]]],XY:[[new oo(new uo(.15,.15,.01),f),[.15,.15,0]]],YZ:[[new oo(new uo(.15,.15,.01),h),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new oo(new uo(.15,.15,.01),d),[.15,0,.15],[-Math.PI/2,0,0]]],XYZ:[[new oo(new uo(.1,.1,.1),p.clone())]]},C={X:[[new oo(new $c(.2,0,.6,4),o),[.3,0,0],[0,0,-Math.PI/2]],[new oo(new $c(.2,0,.6,4),o),[-.3,0,0],[0,0,Math.PI/2]]],Y:[[new oo(new $c(.2,0,.6,4),o),[0,.3,0]],[new oo(new $c(.2,0,.6,4),o),[0,-.3,0],[0,0,Math.PI]]],Z:[[new oo(new $c(.2,0,.6,4),o),[0,0,.3],[Math.PI/2,0,0]],[new oo(new $c(.2,0,.6,4),o),[0,0,-.3],[-Math.PI/2,0,0]]],XY:[[new oo(new uo(.2,.2,.01),o),[.15,.15,0]]],YZ:[[new oo(new uo(.2,.2,.01),o),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new oo(new uo(.2,.2,.01),o),[.15,0,.15],[-Math.PI/2,0,0]]],XYZ:[[new oo(new uo(.2,.2,.2),o),[0,0,0]]]},L={X:[[new cc(_,s.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]],Y:[[new cc(_,s.clone()),[0,-1e3,0],[0,0,Math.PI/2],[1e6,1,1],"helper"]],Z:[[new cc(_,s.clone()),[0,0,-1e3],[0,-Math.PI/2,0],[1e6,1,1],"helper"]]};function P(e){var t=new Zi;for(var n in e)for(var r=e[n].length;r--;){var i=e[n][r][0].clone(),a=e[n][r][1],o=e[n][r][2],s=e[n][r][3],u=e[n][r][4];i.name=n,i.tag=u,a&&i.position.set(a[0],a[1],a[2]),o&&i.rotation.set(o[0],o[1],o[2]),s&&i.scale.set(s[0],s[1],s[2]),i.updateMatrix();var l=i.geometry.clone();l.applyMatrix4(i.matrix),i.geometry=l,i.renderOrder=1/0,i.position.set(0,0,0),i.rotation.set(0,0,0),i.scale.set(1,1,1),t.add(i)}return t}return e.gizmo={},e.picker={},e.helper={},e.add(e.gizmo.translate=P(b)),e.add(e.gizmo.rotate=P(E)),e.add(e.gizmo.scale=P(k)),e.add(e.picker.translate=P(w)),e.add(e.picker.rotate=P(R)),e.add(e.picker.scale=P(C)),e.add(e.helper.translate=P(T)),e.add(e.helper.rotate=P(A)),e.add(e.helper.scale=P(L)),e.picker.translate.visible=!1,e.picker.rotate.visible=!1,e.picker.scale.visible=!1,e}return s(n,[{key:"updateMatrixWorld",value:function(e){var t=this,r="local"===("scale"===this.mode?"local":this.space)?this.worldQuaternion:_y;this.gizmo.translate.visible="translate"===this.mode,this.gizmo.rotate.visible="rotate"===this.mode,this.gizmo.scale.visible="scale"===this.mode,this.helper.translate.visible="translate"===this.mode,this.helper.rotate.visible="rotate"===this.mode,this.helper.scale.visible="scale"===this.mode;var i=[];i=(i=(i=i.concat(this.picker[this.mode].children)).concat(this.gizmo[this.mode].children)).concat(this.helper[this.mode].children);for(var a=function(){var e,n=i[o];if(n.visible=!0,n.rotation.set(0,0,0),n.position.copy(t.worldPosition),e=t.camera.isOrthographicCamera?(t.camera.top-t.camera.bottom)/t.camera.zoom:t.worldPosition.distanceTo(t.cameraPosition)*Math.min(1.9*Math.tan(Math.PI*t.camera.fov/360)/t.camera.zoom,7),n.scale.set(1,1,1).multiplyScalar(e*t.size/4),"helper"===n.tag)return n.visible=!1,"AXIS"===n.name?(n.visible=!!t.axis,"X"===t.axis&&(ty.setFromEuler(py.set(0,0,0)),n.quaternion.copy(r).multiply(ty),Math.abs(vy.copy(Sy).applyQuaternion(r).dot(t.eye))>.9&&(n.visible=!1)),"Y"===t.axis&&(ty.setFromEuler(py.set(0,0,Math.PI/2)),n.quaternion.copy(r).multiply(ty),Math.abs(vy.copy(by).applyQuaternion(r).dot(t.eye))>.9&&(n.visible=!1)),"Z"===t.axis&&(ty.setFromEuler(py.set(0,Math.PI/2,0)),n.quaternion.copy(r).multiply(ty),Math.abs(vy.copy(wy).applyQuaternion(r).dot(t.eye))>.9&&(n.visible=!1)),"XYZE"===t.axis&&(ty.setFromEuler(py.set(0,Math.PI/2,0)),vy.copy(t.rotationAxis),n.quaternion.setFromRotationMatrix(gy.lookAt(my,vy,by)),n.quaternion.multiply(ty),n.visible=t.dragging),"E"===t.axis&&(n.visible=!1)):"START"===n.name?(n.position.copy(t.worldPositionStart),n.visible=t.dragging):"END"===n.name?(n.position.copy(t.worldPosition),n.visible=t.dragging):"DELTA"===n.name?(n.position.copy(t.worldPositionStart),n.quaternion.copy(t.worldQuaternionStart),$g.set(1e-10,1e-10,1e-10).add(t.worldPositionStart).sub(t.worldPosition).multiplyScalar(-1),$g.applyQuaternion(t.worldQuaternionStart.clone().invert()),n.scale.copy($g),n.visible=t.dragging):(n.quaternion.copy(r),t.dragging?n.position.copy(t.worldPositionStart):n.position.copy(t.worldPosition),t.axis&&(n.visible=-1!==t.axis.search(n.name))),"continue";if(n.quaternion.copy(r),"translate"===t.mode||"scale"===t.mode){var a=.99;"X"===n.name&&Math.abs(vy.copy(Sy).applyQuaternion(r).dot(t.eye))>a&&(n.scale.set(1e-10,1e-10,1e-10),n.visible=!1),"Y"===n.name&&Math.abs(vy.copy(by).applyQuaternion(r).dot(t.eye))>a&&(n.scale.set(1e-10,1e-10,1e-10),n.visible=!1),"Z"===n.name&&Math.abs(vy.copy(wy).applyQuaternion(r).dot(t.eye))>a&&(n.scale.set(1e-10,1e-10,1e-10),n.visible=!1),"XY"===n.name&&Math.abs(vy.copy(wy).applyQuaternion(r).dot(t.eye))<.2&&(n.scale.set(1e-10,1e-10,1e-10),n.visible=!1),"YZ"===n.name&&Math.abs(vy.copy(Sy).applyQuaternion(r).dot(t.eye))<.2&&(n.scale.set(1e-10,1e-10,1e-10),n.visible=!1),"XZ"===n.name&&Math.abs(vy.copy(by).applyQuaternion(r).dot(t.eye))<.2&&(n.scale.set(1e-10,1e-10,1e-10),n.visible=!1)}else"rotate"===t.mode&&(yy.copy(r),vy.copy(t.eye).applyQuaternion(ty.copy(r).invert()),-1!==n.name.search("E")&&n.quaternion.setFromRotationMatrix(gy.lookAt(t.eye,my,by)),"X"===n.name&&(ty.setFromAxisAngle(Sy,Math.atan2(-vy.y,vy.z)),ty.multiplyQuaternions(yy,ty),n.quaternion.copy(ty)),"Y"===n.name&&(ty.setFromAxisAngle(by,Math.atan2(vy.x,vy.z)),ty.multiplyQuaternions(yy,ty),n.quaternion.copy(ty)),"Z"===n.name&&(ty.setFromAxisAngle(wy,Math.atan2(vy.y,vy.x)),ty.multiplyQuaternions(yy,ty),n.quaternion.copy(ty)));n.visible=n.visible&&(-1===n.name.indexOf("X")||t.showX),n.visible=n.visible&&(-1===n.name.indexOf("Y")||t.showY),n.visible=n.visible&&(-1===n.name.indexOf("Z")||t.showZ),n.visible=n.visible&&(-1===n.name.indexOf("E")||t.showX&&t.showY&&t.showZ),n.material._color=n.material._color||n.material.color.clone(),n.material._opacity=n.material._opacity||n.material.opacity,n.material.color.copy(n.material._color),n.material.opacity=n.material._opacity,t.enabled&&t.axis&&(n.name===t.axis||t.axis.split("").some((function(e){return n.name===e})))&&(n.material.color.setHex(16776960),n.material.opacity=1)},o=0;o<i.length;o++)a();y(x(n.prototype),"updateMatrixWorld",this).call(this,e)}}]),n}(Zi),ky=function(e){w(n,e);var t=E(n);function n(){var e;return a(this,n),(e=t.call(this,new Co(1e5,1e5,2,2),new ma({visible:!1,wireframe:!0,side:G,transparent:!0,opacity:.1,toneMapped:!1}))).isTransformControlsPlane=!0,e.type="TransformControlsPlane",e}return s(n,[{key:"updateMatrixWorld",value:function(e){var t=this.space;switch(this.position.copy(this.worldPosition),"scale"===this.mode&&(t="local"),Ty.copy(Sy).applyQuaternion("local"===t?this.worldQuaternion:_y),Ey.copy(by).applyQuaternion("local"===t?this.worldQuaternion:_y),Ay.copy(wy).applyQuaternion("local"===t?this.worldQuaternion:_y),vy.copy(Ey),this.mode){case"translate":case"scale":switch(this.axis){case"X":vy.copy(this.eye).cross(Ty),xy.copy(Ty).cross(vy);break;case"Y":vy.copy(this.eye).cross(Ey),xy.copy(Ey).cross(vy);break;case"Z":vy.copy(this.eye).cross(Ay),xy.copy(Ay).cross(vy);break;case"XY":xy.copy(Ay);break;case"YZ":xy.copy(Ty);break;case"XZ":vy.copy(Ay),xy.copy(Ey);break;case"XYZ":case"E":xy.set(0,0,0)}break;default:xy.set(0,0,0)}0===xy.length()?this.quaternion.copy(this.cameraQuaternion):(My.lookAt($g.set(0,0,0),xy,vy),this.quaternion.setFromRotationMatrix(My)),y(x(n.prototype),"updateMatrixWorld",this).call(this,e)}}]),n}(oo),Cy=function(e){T()(n,e);var t=A()(n);function n(e,r){return o()(this,n),t.call(this,e,r)}return u()(n,[{key:"dispose",value:function(){var e=this;_()(M()(n.prototype),"dispose",this).call(this);var t=mv.transformControls.findIndex((function(t){return t===e}));t>-1&&mv.transformControls.splice(t,1)}}]),n}(sy),Ly=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:.5,t=new Cy(mv.camera,mv.domElement);return t.size=e,t.addEventListener("change",(function(){})),t.addEventListener("dragging-changed",(function(e){var t=mv.orbitControls;t&&(t.enabled=!e.value)})),mv.setTransformControls(t),mv.scene.add(t),t},Py=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:.5,t=new Promise((function(t){mv.camera&&mv.domElement?t(Ly(e)):fv.on("after-render",(function(){t(Ly(e))}))}));return t},Iy=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Object.keys(t).forEach((function(n){t[n]&&e.setAttribute(n,t[n])}))},Dy=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=Object.keys(t).reduce((function(e,n){return"".concat(e," ").concat(pv(n),":").concat(t[n],";")}),"");e.setAttribute("style",n)},Uy=function(e,t){t.forEach((function(t){return e.classList.add(t)}))},Oy=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Object.keys(t).forEach((function(n){var r=t[n];e.addEventListener(n,r)}))},Ny=function(e,t){t.forEach((function(t){return e.appendChild(t)}))},Fy=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],r=document.createElement(e),i=document.createElement("div");return i.appendChild(r),t.textContent&&(r.textContent=t.textContent),t.innerHTML&&(r.innerHTML=t.innerHTML),t.id&&(r.id=t.id),t.class&&(r.className=t.class),Iy(r,t.attrs),Uy(r,t.classList||[]),Oy(r,t.events),Dy(r,t.style||{}),Ny(r,n),i},By=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return t.map((function(e){return function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return Fy(e,t,n)}}))},zy=(By("a")[0],By("article")[0],By("aside")[0],By("b")[0],By("br")[0],By("button")[0],By("canvas")[0],By("div")[0],By("fieldset")[0],By("footer")[0],By("form")[0],By("h1")[0],By("h2")[0],By("h3")[0],By("h4")[0],By("h5")[0],By("h6")[0],By("header")[0],By("hr")[0],By("i")[0],By("iframe")[0],By("img")[0],By("input")[0],By("label")[0],By("li")[0],By("link")[0],By("main")[0],By("meta")[0],By("nav")[0],By("ol")[0],By("option")[0],By("p")[0],By("progress")[0],By("script")[0],By("section")[0],By("select")[0],By("span")[0],By("style")[0],By("sub")[0],By("sup")[0],By("svg")[0],By("table")[0],By("tbody")[0],By("td")[0],By("textarea")[0],By("th")[0],By("tr")[0],By("ul")[0],By("video")[0],function(e){return mv.addFrameCallback(e),mv.removeFrameCallback.bind(mv,e)}),Hy=function(){return{scene:mv.scene,domElement:mv.domElement,orbitControls:mv.orbitControls}},Gy=new Jr,Vy=new Yr,Wy=function(e){w(n,e);var t=E(n);function n(){var e;a(this,n),(e=t.call(this)).isLineSegmentsGeometry=!0,e.type="LineSegmentsGeometry";return e.setIndex([0,2,1,2,3,1,2,4,3,4,5,3,4,6,5,6,7,5]),e.setAttribute("position",new Ia([-1,2,0,1,2,0,-1,1,0,1,1,0,-1,0,0,1,0,0,-1,-1,0,1,-1,0],3)),e.setAttribute("uv",new Ia([-1,2,1,2,-1,1,1,1,-1,-1,1,-1,-1,-2,1,-2],2)),e}return s(n,[{key:"applyMatrix4",value:function(e){var t=this.attributes.instanceStart,n=this.attributes.instanceEnd;return void 0!==t&&(t.applyMatrix4(e),n.applyMatrix4(e),t.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this}},{key:"setPositions",value:function(e){var t;e instanceof Float32Array?t=e:Array.isArray(e)&&(t=new Float32Array(e));var n=new np(t,6,1);return this.setAttribute("instanceStart",new vl(n,3,0)),this.setAttribute("instanceEnd",new vl(n,3,3)),this.computeBoundingBox(),this.computeBoundingSphere(),this}},{key:"setColors",value:function(e){var t;e instanceof Float32Array?t=e:Array.isArray(e)&&(t=new Float32Array(e));var n=new np(t,6,1);return this.setAttribute("instanceColorStart",new vl(n,3,0)),this.setAttribute("instanceColorEnd",new vl(n,3,3)),this}},{key:"fromWireframeGeometry",value:function(e){return this.setPositions(e.attributes.position.array),this}},{key:"fromEdgesGeometry",value:function(e){return this.setPositions(e.attributes.position.array),this}},{key:"fromMesh",value:function(e){return this.fromWireframeGeometry(new Zh(e.geometry)),this}},{key:"fromLineSegments",value:function(e){var t=e.geometry;return this.setPositions(t.attributes.position.array),this}},{key:"computeBoundingBox",value:function(){null===this.boundingBox&&(this.boundingBox=new Jr);var e=this.attributes.instanceStart,t=this.attributes.instanceEnd;void 0!==e&&void 0!==t&&(this.boundingBox.setFromBufferAttribute(e),Gy.setFromBufferAttribute(t),this.boundingBox.union(Gy))}},{key:"computeBoundingSphere",value:function(){null===this.boundingSphere&&(this.boundingSphere=new vi),null===this.boundingBox&&this.computeBoundingBox();var e=this.attributes.instanceStart,t=this.attributes.instanceEnd;if(void 0!==e&&void 0!==t){var n=this.boundingSphere.center;this.boundingBox.getCenter(n);for(var r=0,i=0,a=e.count;i<a;i++)Vy.fromBufferAttribute(e,i),r=Math.max(r,n.distanceToSquared(Vy)),Vy.fromBufferAttribute(t,i),r=Math.max(r,n.distanceToSquared(Vy));this.boundingSphere.radius=Math.sqrt(r),isNaN(this.boundingSphere.radius)&&console.error("THREE.LineSegmentsGeometry.computeBoundingSphere(): Computed radius is NaN. The instanced position data is likely to have NaN values.",this)}}},{key:"toJSON",value:function(){}},{key:"applyMatrix",value:function(e){return console.warn("THREE.LineSegmentsGeometry: applyMatrix() has been renamed to applyMatrix4()."),this.applyMatrix4(e)}}]),n}(hf),jy=function(e){w(n,e);var t=E(n);function n(){var e;return a(this,n),(e=t.call(this)).isLineGeometry=!0,e.type="LineGeometry",e}return s(n,[{key:"setPositions",value:function(e){for(var t=e.length-3,r=new Float32Array(2*t),i=0;i<t;i+=3)r[2*i]=e[i],r[2*i+1]=e[i+1],r[2*i+2]=e[i+2],r[2*i+3]=e[i+3],r[2*i+4]=e[i+4],r[2*i+5]=e[i+5];return y(x(n.prototype),"setPositions",this).call(this,r),this}},{key:"setColors",value:function(e){for(var t=e.length-3,r=new Float32Array(2*t),i=0;i<t;i+=3)r[2*i]=e[i],r[2*i+1]=e[i+1],r[2*i+2]=e[i+2],r[2*i+3]=e[i+3],r[2*i+4]=e[i+4],r[2*i+5]=e[i+5];return y(x(n.prototype),"setColors",this).call(this,r),this}},{key:"fromLine",value:function(e){var t=e.geometry;return this.setPositions(t.attributes.position.array),this}}]),n}(Wy);Po.line={worldUnits:{value:1},linewidth:{value:1},resolution:{value:new mr(1,1)},dashOffset:{value:0},dashScale:{value:1},dashSize:{value:1},gapSize:{value:1}},Io.line={uniforms:fo.merge([Po.common,Po.fog,Po.line]),vertexShader:"\n\t\t#include <common>\n\t\t#include <color_pars_vertex>\n\t\t#include <fog_pars_vertex>\n\t\t#include <logdepthbuf_pars_vertex>\n\t\t#include <clipping_planes_pars_vertex>\n\n\t\tuniform float linewidth;\n\t\tuniform vec2 resolution;\n\n\t\tattribute vec3 instanceStart;\n\t\tattribute vec3 instanceEnd;\n\n\t\tattribute vec3 instanceColorStart;\n\t\tattribute vec3 instanceColorEnd;\n\n\t\t#ifdef WORLD_UNITS\n\n\t\t\tvarying vec4 worldPos;\n\t\t\tvarying vec3 worldStart;\n\t\t\tvarying vec3 worldEnd;\n\n\t\t\t#ifdef USE_DASH\n\n\t\t\t\tvarying vec2 vUv;\n\n\t\t\t#endif\n\n\t\t#else\n\n\t\t\tvarying vec2 vUv;\n\n\t\t#endif\n\n\t\t#ifdef USE_DASH\n\n\t\t\tuniform float dashScale;\n\t\t\tattribute float instanceDistanceStart;\n\t\t\tattribute float instanceDistanceEnd;\n\t\t\tvarying float vLineDistance;\n\n\t\t#endif\n\n\t\tvoid trimSegment( const in vec4 start, inout vec4 end ) {\n\n\t\t\t// trim end segment so it terminates between the camera plane and the near plane\n\n\t\t\t// conservative estimate of the near plane\n\t\t\tfloat a = projectionMatrix[ 2 ][ 2 ]; // 3nd entry in 3th column\n\t\t\tfloat b = projectionMatrix[ 3 ][ 2 ]; // 3nd entry in 4th column\n\t\t\tfloat nearEstimate = - 0.5 * b / a;\n\n\t\t\tfloat alpha = ( nearEstimate - start.z ) / ( end.z - start.z );\n\n\t\t\tend.xyz = mix( start.xyz, end.xyz, alpha );\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\t#ifdef USE_COLOR\n\n\t\t\t\tvColor.xyz = ( position.y < 0.5 ) ? instanceColorStart : instanceColorEnd;\n\n\t\t\t#endif\n\n\t\t\t#ifdef USE_DASH\n\n\t\t\t\tvLineDistance = ( position.y < 0.5 ) ? dashScale * instanceDistanceStart : dashScale * instanceDistanceEnd;\n\t\t\t\tvUv = uv;\n\n\t\t\t#endif\n\n\t\t\tfloat aspect = resolution.x / resolution.y;\n\n\t\t\t// camera space\n\t\t\tvec4 start = modelViewMatrix * vec4( instanceStart, 1.0 );\n\t\t\tvec4 end = modelViewMatrix * vec4( instanceEnd, 1.0 );\n\n\t\t\t#ifdef WORLD_UNITS\n\n\t\t\t\tworldStart = start.xyz;\n\t\t\t\tworldEnd = end.xyz;\n\n\t\t\t#else\n\n\t\t\t\tvUv = uv;\n\n\t\t\t#endif\n\n\t\t\t// special case for perspective projection, and segments that terminate either in, or behind, the camera plane\n\t\t\t// clearly the gpu firmware has a way of addressing this issue when projecting into ndc space\n\t\t\t// but we need to perform ndc-space calculations in the shader, so we must address this issue directly\n\t\t\t// perhaps there is a more elegant solution -- WestLangley\n\n\t\t\tbool perspective = ( projectionMatrix[ 2 ][ 3 ] == - 1.0 ); // 4th entry in the 3rd column\n\n\t\t\tif ( perspective ) {\n\n\t\t\t\tif ( start.z < 0.0 && end.z >= 0.0 ) {\n\n\t\t\t\t\ttrimSegment( start, end );\n\n\t\t\t\t} else if ( end.z < 0.0 && start.z >= 0.0 ) {\n\n\t\t\t\t\ttrimSegment( end, start );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t// clip space\n\t\t\tvec4 clipStart = projectionMatrix * start;\n\t\t\tvec4 clipEnd = projectionMatrix * end;\n\n\t\t\t// ndc space\n\t\t\tvec3 ndcStart = clipStart.xyz / clipStart.w;\n\t\t\tvec3 ndcEnd = clipEnd.xyz / clipEnd.w;\n\n\t\t\t// direction\n\t\t\tvec2 dir = ndcEnd.xy - ndcStart.xy;\n\n\t\t\t// account for clip-space aspect ratio\n\t\t\tdir.x *= aspect;\n\t\t\tdir = normalize( dir );\n\n\t\t\t#ifdef WORLD_UNITS\n\n\t\t\t\t// get the offset direction as perpendicular to the view vector\n\t\t\t\tvec3 worldDir = normalize( end.xyz - start.xyz );\n\t\t\t\tvec3 offset;\n\t\t\t\tif ( position.y < 0.5 ) {\n\n\t\t\t\t\toffset = normalize( cross( start.xyz, worldDir ) );\n\n\t\t\t\t} else {\n\n\t\t\t\t\toffset = normalize( cross( end.xyz, worldDir ) );\n\n\t\t\t\t}\n\n\t\t\t\t// sign flip\n\t\t\t\tif ( position.x < 0.0 ) offset *= - 1.0;\n\n\t\t\t\tfloat forwardOffset = dot( worldDir, vec3( 0.0, 0.0, 1.0 ) );\n\n\t\t\t\t// don't extend the line if we're rendering dashes because we\n\t\t\t\t// won't be rendering the endcaps\n\t\t\t\t#ifndef USE_DASH\n\n\t\t\t\t\t// extend the line bounds to encompass endcaps\n\t\t\t\t\tstart.xyz += - worldDir * linewidth * 0.5;\n\t\t\t\t\tend.xyz += worldDir * linewidth * 0.5;\n\n\t\t\t\t\t// shift the position of the quad so it hugs the forward edge of the line\n\t\t\t\t\toffset.xy -= dir * forwardOffset;\n\t\t\t\t\toffset.z += 0.5;\n\n\t\t\t\t#endif\n\n\t\t\t\t// endcaps\n\t\t\t\tif ( position.y > 1.0 || position.y < 0.0 ) {\n\n\t\t\t\t\toffset.xy += dir * 2.0 * forwardOffset;\n\n\t\t\t\t}\n\n\t\t\t\t// adjust for linewidth\n\t\t\t\toffset *= linewidth * 0.5;\n\n\t\t\t\t// set the world position\n\t\t\t\tworldPos = ( position.y < 0.5 ) ? start : end;\n\t\t\t\tworldPos.xyz += offset;\n\n\t\t\t\t// project the worldpos\n\t\t\t\tvec4 clip = projectionMatrix * worldPos;\n\n\t\t\t\t// shift the depth of the projected points so the line\n\t\t\t\t// segments overlap neatly\n\t\t\t\tvec3 clipPose = ( position.y < 0.5 ) ? ndcStart : ndcEnd;\n\t\t\t\tclip.z = clipPose.z * clip.w;\n\n\t\t\t#else\n\n\t\t\t\tvec2 offset = vec2( dir.y, - dir.x );\n\t\t\t\t// undo aspect ratio adjustment\n\t\t\t\tdir.x /= aspect;\n\t\t\t\toffset.x /= aspect;\n\n\t\t\t\t// sign flip\n\t\t\t\tif ( position.x < 0.0 ) offset *= - 1.0;\n\n\t\t\t\t// endcaps\n\t\t\t\tif ( position.y < 0.0 ) {\n\n\t\t\t\t\toffset += - dir;\n\n\t\t\t\t} else if ( position.y > 1.0 ) {\n\n\t\t\t\t\toffset += dir;\n\n\t\t\t\t}\n\n\t\t\t\t// adjust for linewidth\n\t\t\t\toffset *= linewidth;\n\n\t\t\t\t// adjust for clip-space to screen-space conversion // maybe resolution should be based on viewport ...\n\t\t\t\toffset /= resolution.y;\n\n\t\t\t\t// select end\n\t\t\t\tvec4 clip = ( position.y < 0.5 ) ? clipStart : clipEnd;\n\n\t\t\t\t// back to clip space\n\t\t\t\toffset *= clip.w;\n\n\t\t\t\tclip.xy += offset;\n\n\t\t\t#endif\n\n\t\t\tgl_Position = clip;\n\n\t\t\tvec4 mvPosition = ( position.y < 0.5 ) ? start : end; // this is an approximation\n\n\t\t\t#include <logdepthbuf_vertex>\n\t\t\t#include <clipping_planes_vertex>\n\t\t\t#include <fog_vertex>\n\n\t\t}\n\t\t",fragmentShader:"\n\t\tuniform vec3 diffuse;\n\t\tuniform float opacity;\n\t\tuniform float linewidth;\n\n\t\t#ifdef USE_DASH\n\n\t\t\tuniform float dashOffset;\n\t\t\tuniform float dashSize;\n\t\t\tuniform float gapSize;\n\n\t\t#endif\n\n\t\tvarying float vLineDistance;\n\n\t\t#ifdef WORLD_UNITS\n\n\t\t\tvarying vec4 worldPos;\n\t\t\tvarying vec3 worldStart;\n\t\t\tvarying vec3 worldEnd;\n\n\t\t\t#ifdef USE_DASH\n\n\t\t\t\tvarying vec2 vUv;\n\n\t\t\t#endif\n\n\t\t#else\n\n\t\t\tvarying vec2 vUv;\n\n\t\t#endif\n\n\t\t#include <common>\n\t\t#include <color_pars_fragment>\n\t\t#include <fog_pars_fragment>\n\t\t#include <logdepthbuf_pars_fragment>\n\t\t#include <clipping_planes_pars_fragment>\n\n\t\tvec2 closestLineToLine(vec3 p1, vec3 p2, vec3 p3, vec3 p4) {\n\n\t\t\tfloat mua;\n\t\t\tfloat mub;\n\n\t\t\tvec3 p13 = p1 - p3;\n\t\t\tvec3 p43 = p4 - p3;\n\n\t\t\tvec3 p21 = p2 - p1;\n\n\t\t\tfloat d1343 = dot( p13, p43 );\n\t\t\tfloat d4321 = dot( p43, p21 );\n\t\t\tfloat d1321 = dot( p13, p21 );\n\t\t\tfloat d4343 = dot( p43, p43 );\n\t\t\tfloat d2121 = dot( p21, p21 );\n\n\t\t\tfloat denom = d2121 * d4343 - d4321 * d4321;\n\n\t\t\tfloat numer = d1343 * d4321 - d1321 * d4343;\n\n\t\t\tmua = numer / denom;\n\t\t\tmua = clamp( mua, 0.0, 1.0 );\n\t\t\tmub = ( d1343 + d4321 * ( mua ) ) / d4343;\n\t\t\tmub = clamp( mub, 0.0, 1.0 );\n\n\t\t\treturn vec2( mua, mub );\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\t#include <clipping_planes_fragment>\n\n\t\t\t#ifdef USE_DASH\n\n\t\t\t\tif ( vUv.y < - 1.0 || vUv.y > 1.0 ) discard; // discard endcaps\n\n\t\t\t\tif ( mod( vLineDistance + dashOffset, dashSize + gapSize ) > dashSize ) discard; // todo - FIX\n\n\t\t\t#endif\n\n\t\t\tfloat alpha = opacity;\n\n\t\t\t#ifdef WORLD_UNITS\n\n\t\t\t\t// Find the closest points on the view ray and the line segment\n\t\t\t\tvec3 rayEnd = normalize( worldPos.xyz ) * 1e5;\n\t\t\t\tvec3 lineDir = worldEnd - worldStart;\n\t\t\t\tvec2 params = closestLineToLine( worldStart, worldEnd, vec3( 0.0, 0.0, 0.0 ), rayEnd );\n\n\t\t\t\tvec3 p1 = worldStart + lineDir * params.x;\n\t\t\t\tvec3 p2 = rayEnd * params.y;\n\t\t\t\tvec3 delta = p1 - p2;\n\t\t\t\tfloat len = length( delta );\n\t\t\t\tfloat norm = len / linewidth;\n\n\t\t\t\t#ifndef USE_DASH\n\n\t\t\t\t\t#ifdef USE_ALPHA_TO_COVERAGE\n\n\t\t\t\t\t\tfloat dnorm = fwidth( norm );\n\t\t\t\t\t\talpha = 1.0 - smoothstep( 0.5 - dnorm, 0.5 + dnorm, norm );\n\n\t\t\t\t\t#else\n\n\t\t\t\t\t\tif ( norm > 0.5 ) {\n\n\t\t\t\t\t\t\tdiscard;\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t#endif\n\n\t\t\t\t#endif\n\n\t\t\t#else\n\n\t\t\t\t#ifdef USE_ALPHA_TO_COVERAGE\n\n\t\t\t\t\t// artifacts appear on some hardware if a derivative is taken within a conditional\n\t\t\t\t\tfloat a = vUv.x;\n\t\t\t\t\tfloat b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0;\n\t\t\t\t\tfloat len2 = a * a + b * b;\n\t\t\t\t\tfloat dlen = fwidth( len2 );\n\n\t\t\t\t\tif ( abs( vUv.y ) > 1.0 ) {\n\n\t\t\t\t\t\talpha = 1.0 - smoothstep( 1.0 - dlen, 1.0 + dlen, len2 );\n\n\t\t\t\t\t}\n\n\t\t\t\t#else\n\n\t\t\t\t\tif ( abs( vUv.y ) > 1.0 ) {\n\n\t\t\t\t\t\tfloat a = vUv.x;\n\t\t\t\t\t\tfloat b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0;\n\t\t\t\t\t\tfloat len2 = a * a + b * b;\n\n\t\t\t\t\t\tif ( len2 > 1.0 ) discard;\n\n\t\t\t\t\t}\n\n\t\t\t\t#endif\n\n\t\t\t#endif\n\n\t\t\tvec4 diffuseColor = vec4( diffuse, alpha );\n\n\t\t\t#include <logdepthbuf_fragment>\n\t\t\t#include <color_fragment>\n\n\t\t\tgl_FragColor = vec4( diffuseColor.rgb, alpha );\n\n\t\t\t#include <tonemapping_fragment>\n\t\t\t#include <colorspace_fragment>\n\t\t\t#include <fog_fragment>\n\t\t\t#include <premultiplied_alpha_fragment>\n\n\t\t}\n\t\t"};var Xy,qy,Yy=function(e){w(n,e);var t=E(n);function n(e){var r;return a(this,n),(r=t.call(this,{type:"LineMaterial",uniforms:fo.clone(Io.line.uniforms),vertexShader:Io.line.vertexShader,fragmentShader:Io.line.fragmentShader,clipping:!0})).isLineMaterial=!0,Object.defineProperties(S(r),{color:{enumerable:!0,get:function(){return this.uniforms.diffuse.value},set:function(e){this.uniforms.diffuse.value=e}},worldUnits:{enumerable:!0,get:function(){return"WORLD_UNITS"in this.defines},set:function(e){!0===e?this.defines.WORLD_UNITS="":delete this.defines.WORLD_UNITS}},linewidth:{enumerable:!0,get:function(){return this.uniforms.linewidth.value},set:function(e){this.uniforms.linewidth.value=e}},dashed:{enumerable:!0,get:function(){return Boolean("USE_DASH"in this.defines)},set:function(e){Boolean(e)!==Boolean("USE_DASH"in this.defines)&&(this.needsUpdate=!0),!0===e?this.defines.USE_DASH="":delete this.defines.USE_DASH}},dashScale:{enumerable:!0,get:function(){return this.uniforms.dashScale.value},set:function(e){this.uniforms.dashScale.value=e}},dashSize:{enumerable:!0,get:function(){return this.uniforms.dashSize.value},set:function(e){this.uniforms.dashSize.value=e}},dashOffset:{enumerable:!0,get:function(){return this.uniforms.dashOffset.value},set:function(e){this.uniforms.dashOffset.value=e}},gapSize:{enumerable:!0,get:function(){return this.uniforms.gapSize.value},set:function(e){this.uniforms.gapSize.value=e}},opacity:{enumerable:!0,get:function(){return this.uniforms.opacity.value},set:function(e){this.uniforms.opacity.value=e}},resolution:{enumerable:!0,get:function(){return this.uniforms.resolution.value},set:function(e){this.uniforms.resolution.value.copy(e)}},alphaToCoverage:{enumerable:!0,get:function(){return Boolean("USE_ALPHA_TO_COVERAGE"in this.defines)},set:function(e){Boolean(e)!==Boolean("USE_ALPHA_TO_COVERAGE"in this.defines)&&(this.needsUpdate=!0),!0===e?(this.defines.USE_ALPHA_TO_COVERAGE="",this.extensions.derivatives=!0):(delete this.defines.USE_ALPHA_TO_COVERAGE,this.extensions.derivatives=!1)}}}),r.setValues(e),r}return s(n)}(po),Zy=new Yr,Ky=new Yr,Jy=new Br,Qy=new Br,$y=new Br,e_=new Yr,t_=new wi,n_=new fp,r_=new Yr,i_=new Jr,a_=new vi,o_=new Br;function s_(e,t,n){return o_.set(0,0,-t,1).applyMatrix4(e.projectionMatrix),o_.multiplyScalar(1/o_.w),o_.x=qy/n.width,o_.y=qy/n.height,o_.applyMatrix4(e.projectionMatrixInverse),o_.multiplyScalar(1/o_.w),Math.abs(Math.max(o_.x,o_.y))}var u_=function(e){w(n,e);var t=E(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Wy,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Yy({color:16777215*Math.random()});return a(this,n),(e=t.call(this,r,i)).isLineSegments2=!0,e.type="LineSegments2",e}return s(n,[{key:"computeLineDistances",value:function(){for(var e=this.geometry,t=e.attributes.instanceStart,n=e.attributes.instanceEnd,r=new Float32Array(2*t.count),i=0,a=0,o=t.count;i<o;i++,a+=2)Zy.fromBufferAttribute(t,i),Ky.fromBufferAttribute(n,i),r[a]=0===a?0:r[a-1],r[a+1]=r[a]+Zy.distanceTo(Ky);var s=new np(r,2,1);return e.setAttribute("instanceDistanceStart",new vl(s,1,0)),e.setAttribute("instanceDistanceEnd",new vl(s,1,1)),this}},{key:"raycast",value:function(e,t){var n=this.material.worldUnits,r=e.camera;null!==r||n||console.error('LineSegments2: "Raycaster.camera" needs to be set in order to raycast against LineSegments2 while worldUnits is set to false.');var i=void 0!==e.params.Line2&&e.params.Line2.threshold||0;Xy=e.ray;var a,o=this.matrixWorld,s=this.geometry,u=this.material;(qy=u.linewidth+i,null===s.boundingSphere&&s.computeBoundingSphere(),a_.copy(s.boundingSphere).applyMatrix4(o),n)?a=.5*qy:a=s_(r,Math.max(r.near,a_.distanceToPoint(Xy.origin)),u.resolution);if(a_.radius+=a,!1!==Xy.intersectsSphere(a_)){var l;if(null===s.boundingBox&&s.computeBoundingBox(),i_.copy(s.boundingBox).applyMatrix4(o),n)l=.5*qy;else l=s_(r,Math.max(r.near,i_.distanceToPoint(Xy.origin)),u.resolution);i_.expandByScalar(l),!1!==Xy.intersectsBox(i_)&&(n?function(e,t){for(var n=e.matrixWorld,r=e.geometry,i=r.attributes.instanceStart,a=r.attributes.instanceEnd,o=0,s=Math.min(r.instanceCount,i.count);o<s;o++){n_.start.fromBufferAttribute(i,o),n_.end.fromBufferAttribute(a,o),n_.applyMatrix4(n);var u=new Yr,l=new Yr;Xy.distanceSqToSegment(n_.start,n_.end,l,u),l.distanceTo(u)<.5*qy&&t.push({point:l,pointOnLine:u,distance:Xy.origin.distanceTo(l),object:e,face:null,faceIndex:o,uv:null,uv1:null})}}(this,t):function(e,t,n){var r=t.projectionMatrix,i=e.material.resolution,a=e.matrixWorld,o=e.geometry,s=o.attributes.instanceStart,u=o.attributes.instanceEnd,l=Math.min(o.instanceCount,s.count),c=-t.near;Xy.at(1,$y),$y.w=1,$y.applyMatrix4(t.matrixWorldInverse),$y.applyMatrix4(r),$y.multiplyScalar(1/$y.w),$y.x*=i.x/2,$y.y*=i.y/2,$y.z=0,e_.copy($y),t_.multiplyMatrices(t.matrixWorldInverse,a);for(var h=0,d=l;h<d;h++)if(Jy.fromBufferAttribute(s,h),Qy.fromBufferAttribute(u,h),Jy.w=1,Qy.w=1,Jy.applyMatrix4(t_),Qy.applyMatrix4(t_),!(Jy.z>c&&Qy.z>c)){if(Jy.z>c){var f=Jy.z-Qy.z,p=(Jy.z-c)/f;Jy.lerp(Qy,p)}else if(Qy.z>c){var v=Qy.z-Jy.z,m=(Qy.z-c)/v;Qy.lerp(Jy,m)}Jy.applyMatrix4(r),Qy.applyMatrix4(r),Jy.multiplyScalar(1/Jy.w),Qy.multiplyScalar(1/Qy.w),Jy.x*=i.x/2,Jy.y*=i.y/2,Qy.x*=i.x/2,Qy.y*=i.y/2,n_.start.copy(Jy),n_.start.z=0,n_.end.copy(Qy),n_.end.z=0;var g=n_.closestPointToPointParameter(e_,!0);n_.at(g,r_);var y=vr.lerp(Jy.z,Qy.z,g),_=y>=-1&&y<=1,x=e_.distanceTo(r_)<.5*qy;if(_&&x){n_.start.fromBufferAttribute(s,h),n_.end.fromBufferAttribute(u,h),n_.start.applyMatrix4(a),n_.end.applyMatrix4(a);var M=new Yr,S=new Yr;Xy.distanceSqToSegment(n_.start,n_.end,S,M),n.push({point:S,pointOnLine:M,distance:Xy.origin.distanceTo(S),object:e,face:null,faceIndex:h,uv:null,uv1:null})}}}(this,r,t))}}}]),n}(oo),l_=function(e){w(n,e);var t=E(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new jy,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Yy({color:16777215*Math.random()});return a(this,n),(e=t.call(this,r,i)).isLine2=!0,e.type="Line2",e}return s(n)}(u_),c_={moveTo:Uv,moveLine:function(e,t){var n=function(e){var t=new Oc(f()(e)),n=t.getPoints(50),r=(new Ga).setFromPoints(n),i=new ic({opacity:1});return[new cc(r,i),t]}([e.position,t.position]),r=g()(n,2),i=r[0];r[1];mv.scene.add(i)},moveWithRound:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.1,n=arguments.length>2?arguments[2]:void 0,r=0,i=0,a=0,o=function(){r+=t,i=4*Math.sin(r),a=4*Math.cos(r),e.position.set(i,0,a)};Dv.add(o,n),Dv.start()},moveWithLine:Ov},h_={appendChildren:Ny,create:By,createElement:Fy,setAttributes:Iy,setClassList:Uy,setEventListeners:Oy},d_={useframe:zy,useScene:Hy}}(),r}()}));
|