{"id":172,"date":"2022-10-11T15:01:28","date_gmt":"2022-10-11T15:01:28","guid":{"rendered":"https:\/\/hayhurst2.hulldesign.co.uk\/?page_id=172"},"modified":"2022-10-11T15:20:35","modified_gmt":"2022-10-11T15:20:35","slug":"scripts-playground","status":"publish","type":"page","link":"https:\/\/hayhurst2.hulldesign.co.uk\/index.php\/scripts-playground\/","title":{"rendered":"Scripts Playground"},"content":{"rendered":"\t\t<div data-elementor-type=\"wp-page\" data-elementor-id=\"172\" class=\"elementor elementor-172\">\n\t\t\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-ea8db71 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"ea8db71\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-f48f757\" data-id=\"f48f757\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-2b61579 elementor-widget elementor-widget-heading\" data-id=\"2b61579\" data-element_type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<h2 class=\"elementor-heading-title elementor-size-default\">Graphics and Audio on Web<\/h2>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-484797c elementor-widget elementor-widget-html\" data-id=\"484797c\" data-element_type=\"widget\" data-widget_type=\"html.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<!DOCTYPE html><html><head>\n\n<script>\nparcelRequire=function(e,r,t,n){var i,o=\"function\"==typeof parcelRequire&&parcelRequire,u=\"function\"==typeof require&&require;function f(t,n){if(!r[t]){if(!e[t]){var i=\"function\"==typeof parcelRequire&&parcelRequire;if(!n&&i)return i(t,!0);if(o)return o(t,!0);if(u&&\"string\"==typeof t)return u(t);var c=new Error(\"Cannot find module '\"+t+\"'\");throw c.code=\"MODULE_NOT_FOUND\",c}p.resolve=function(r){return e[t][1][r]||r},p.cache={};var l=r[t]=new f.Module(t);e[t][0].call(l.exports,p,l,l.exports,this)}return r[t].exports;function p(e){return f(p.resolve(e))}}f.isParcelRequire=!0,f.Module=function(e){this.id=e,this.bundle=f,this.exports={}},f.modules=e,f.cache=r,f.parent=o,f.register=function(r,t){e[r]=[function(e,r){r.exports=t},{}]};for(var c=0;c<t.length;c++)try{f(t[c])}catch(e){i||(i=e)}if(t.length){var l=f(t[t.length-1]);\"object\"==typeof exports&&\"undefined\"!=typeof module?module.exports=l:\"function\"==typeof define&&define.amd?define(function(){return l}):n&&(this[n]=l)}if(parcelRequire=f,i)throw i;return f}({\"uHGM\":[function(require,module,exports) {\n\"use strict\";Object.defineProperty(exports,\"__esModule\",{value:!0}),exports.isRetina=function(){if(window.matchMedia){var e=window.matchMedia(\"only screen and (min--moz-device-pixel-ratio: 1.3), only screen and (-o-min-device-pixel-ratio: 2.6\/2), only screen and (-webkit-min-device-pixel-ratio: 1.3), only screen  and (min-device-pixel-ratio: 1.3), only screen and (min-resolution: 1.3dppx)\");return e&&e.matches||window.devicePixelRatio>1}return!1},exports.isMobile=function(){var e,t=!1;return e=navigator.userAgent||navigator.vendor,(\/(android|bbd+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up.(browser|link)|vodafone|wap|windows ce|xda|xiino|android|ipad|playbook|silk\/i.test(e)||\/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw-(n|u)|c55\/|capi|ccwa|cdm-|cell|chtm|cldc|cmd-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc-s|devi|dica|dmob|do(c|p)o|ds(12|-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(-|_)|g1 u|g560|gene|gf-5|g-mo|go(.w|od)|gr(ad|un)|haie|hcit|hd-(m|p|t)|hei-|hi(pt|ta)|hp( i|ip)|hs-c|ht(c(-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i-(20|go|ma)|i230|iac( |-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|-[a-w])|libw|lynx|m1-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|-([1-8]|c))|phil|pire|pl(ay|uc)|pn-2|po(ck|rt|se)|prox|psio|pt-g|qa-a|qc(07|12|21|32|60|-[2-7]|i-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h-|oo|p-)|sdk\/|se(c(-|0|1)|47|mc|nd|ri)|sgh-|shar|sie(-|m)|sk-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h-|v-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl-|tdg-|tel(i|m)|tim-|t-mo|to(pl|sh)|ts(70|m-|m3|m5)|tx-9|up(.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas-|your|zeto|zte-\/i.test(e.substr(0,4)))&&(t=!0),t},exports.getNearestPowerOfTwo=function(e){return Math.pow(2,Math.round(Math.log(e)*Math.LOG2E))},exports.getSmallerOrEqualPowerOfTwo=function(e){return Math.pow(2,Math.floor(Math.log(e)*Math.LOG2E))},exports.getLargerOrEqualPowerOfTwo=function(e){return Math.pow(2,Math.ceil(Math.log(e)*Math.LOG2E))},exports.getVideoStream=function(e,t,o){var i={audio:!1,video:{width:e,height:t}},n=document.createElement(\"video\");navigator.mediaDevices.getUserMedia(i).then(function(e){n.srcObject=e,n.onloadedmetadata=function(){n.play(),o&&o(n)}}).catch(function(e){return console.error(e.name+\": \"+e.message)})},exports.getMicStream=function(e,t){navigator.mediaDevices.getUserMedia({audio:!0,video:!1}).then(e).catch(function(e){console.log(\"getUserMedia failed\",e),void 0!==t&&t()})};var e=[];exports.getFPS=function(){for(var t=performance.now();e.length>0&&e[0]<=t-1e3;)e.shift();return e.push(t),e.length},exports.customAlert=function(e,t){var o=document.createElement(\"div\");o.setAttribute(\"style\",\"n        position: fixed;n        top: 50%;n        left: 50%;n        transform: translate(-50%, -50%);n        width: 100vw;n        height: auto;n        padding: 20px;n        background-color: black;n        color: white;n        z-index: 9999999;n        text-transform: uppercase;n        cursor: pointer;n    \"),o.onclick=function(){return o.style.display=\"none\"},o.innerHTML=\"<strong>\"+e+\"<\/strong> \"+t,document.body.appendChild(o)};\n},{}],\"I1Xo\":[function(require,module,exports) {\n\"use strict\";Object.defineProperty(exports,\"__esModule\",{value:!0});var t=require(\".\/Utils\"),i=function(){function i(i){this.gainValue=1,this.isInit=!1,this.isPulse=!1,this.debugCanvas=null,this.debugCanvasCtx=null,this.FFT_SIZE=256,this._bass=0,this._mid=0,this._high=0,this._level=0,this._history=0,this.cutout=.5,this.frame=0,this.gainValue=i,t.getMicStream(this.init.bind(this),this.initWithoutStream.bind(this))}return Object.defineProperty(i.prototype,\"gain\",{get:function(){return this._gain?this._gain.gain.value:1},set:function(t){this._gain&&(this._gain.gain.value=t)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,\"bass\",{get:function(){return null==this._bass?0:this._bass},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,\"mid\",{get:function(){return null==this._mid?0:this._mid},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,\"high\",{get:function(){return null==this._high?0:this._high},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,\"level\",{get:function(){return null==this._level?0:this._level},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,\"history\",{get:function(){return null==this._history?0:this._history},enumerable:!0,configurable:!0}),i.prototype.init=function(t){var i=new(window.AudioContext||window.webkitAudioContext||!1),e=i.createMediaStreamSource(t);this._gain=i.createGain(),this._gain.gain.value=this.gainValue||70;var s=i.createBiquadFilter();s.type=\"lowpass\",s.frequency.value=1e3;var n=i.createBiquadFilter();n.type=\"highpass\",n.frequency.value=2e4,this.analyzer=i.createAnalyser(),this.analyzer.fftSize=this.FFT_SIZE,e.connect(this._gain),this._gain.connect(s),this._gain.connect(n),s.connect(this.analyzer),n.connect(this.analyzer),this.reset(),this.audioBuffer=new Uint8Array(this.analyzer.frequencyBinCount),this.isInit=!0},i.prototype.initWithoutStream=function(){t.customAlert(\"microphone is not detected.\",\"Pulsing random value will be mimicing mic input.\"),this.reset(),this.isInit=!0,this.isPulse=!0},i.prototype.update=function(){if(this.isInit){this._history>9999&&this.reset();var t=0,i=0,e=0;if(this.isPulse)this.frame%40==Math.floor(40*Math.random())&&(t=Math.random(),i=Math.random(),e=Math.random()),this.frame++;else{if(!this.analyzer||!this.audioBuffer)return;this.analyzer.getByteFrequencyData(this.audioBuffer);for(var s=this.analyzer.frequencyBinCount\/3,n=0;n<this.analyzer.frequencyBinCount;n++){var h=this.audioBuffer[n]\/255;h===1\/0||h<this.cutout||(n<s?t+=h:n<2*s?i+=h:n<=3*s&&(e+=h))}t\/=s,i\/=s,e\/=s}this._bass=this._bass>t?.96*this._bass:t,this._mid=this._mid>i?.96*this._mid:i,this._high=this._high>e?.96*this._high:e,this._level=(this._bass+this._mid+this._high)\/3,this._history+=.01*this._level+.005}},i.prototype.reset=function(){this._history=0},i.prototype.trigger_pulse=function(t){this.isPulse=t},i.prototype.debug=function(t){void 0===t&&(t=null);var i=t||this.debugCanvas;null===i&&(this.debugCanvas=document.createElement(\"canvas\"),this.debugCanvas.className=\"audioDebug\",document.body.appendChild(this.debugCanvas),i=this.debugCanvas),null===this.debugCanvasCtx&&(this.debugCanvasCtx=i.getContext(\"2d\"));var e,s=i.width\/4,n=0,h=\"rgb(0, 0, 0)\",a=\"rgb(255, 255, 255)\";this.debugCanvasCtx.fillStyle=a,this.debugCanvasCtx.fillRect(0,0,i.width,i.height),this.debugCanvasCtx.font=\"10px Verdana\",e=this._bass*i.height,this.debugCanvasCtx.fillStyle=h,this.debugCanvasCtx.fillRect(n,i.height-e,s-1,e),this.debugCanvasCtx.fillStyle=a,this.debugCanvasCtx.fillText(this._bass.toFixed(2).toString(),n,i.height),n+=s,e=this._mid*i.height,this.debugCanvasCtx.fillStyle=h,this.debugCanvasCtx.fillRect(n,i.height-e,s-1,e),this.debugCanvasCtx.fillStyle=a,this.debugCanvasCtx.fillText(this._mid.toFixed(2).toString(),n,i.height),n+=s,e=this._high*i.height,this.debugCanvasCtx.fillStyle=h,this.debugCanvasCtx.fillRect(n,i.height-e,s-1,e),this.debugCanvasCtx.fillStyle=a,this.debugCanvasCtx.fillText(this._high.toFixed(2).toString(),n,i.height),n+=s,e=this._level*i.height,this.debugCanvasCtx.fillStyle=h,this.debugCanvasCtx.fillRect(n,i.height-e,s,e),this.debugCanvasCtx.fillStyle=a,this.debugCanvasCtx.fillText(this._level.toFixed(2).toString(),n,i.height)},i}();exports.default=i;\n},{\".\/Utils\":\"uHGM\"}],\"dKqR\":[function(require,module,exports) {\n\"use strict\";Object.defineProperty(exports,\"__esModule\",{value:!0}),exports.AlwaysStencilFunc=exports.AlwaysDepth=exports.AlphaFormat=exports.AdditiveBlending=exports.AddOperation=exports.AddEquation=exports.ACESFilmicToneMapping=void 0,exports.AmbientLight=of,exports.AmbientLightProbe=Cf,exports.AnimationClip=id,exports.AnimationLoader=dd,exports.AnimationMixer=cm,exports.AnimationObjectGroup=om,exports.AnimationUtils=void 0,exports.ArcCurve=bd,exports.ArrayCamera=ch,exports.ArrowHelper=Qm,exports.Audio=zf,exports.AudioAnalyser=qf,exports.AudioContext=void 0,exports.AudioListener=Gf,exports.AudioLoader=Ef,exports.AxesHelper=Km,exports.AxisHelper=hg,exports.BasicShadowMap=exports.BasicDepthPacking=exports.BackSide=void 0,exports.BinaryTextureLoader=mg,exports.Bone=zh,exports.BooleanKeyframeTrack=Qp,exports.BoundingBoxHelper=ug,exports.Box2=gm,exports.Box3=Nn,exports.Box3Helper=qm,exports.BoxGeometry=exports.BoxBufferGeometry=void 0,exports.BoxHelper=Wm,exports.BufferAttribute=_i,exports.BufferGeometry=Gi,exports.BufferGeometryLoader=pf,exports.Cache=exports.ByteType=void 0,exports.Camera=xa,exports.CameraHelper=Vm,exports.CanvasRenderer=yg,exports.CanvasTexture=pu,exports.CatmullRomCurve3=Ad,exports.CineonToneMapping=void 0,exports.CircleBufferGeometry=Op,exports.CircleGeometry=Pp,exports.ClampToEdgeWrapping=void 0,exports.Clock=If,exports.ClosedSplineCurve3=sg,exports.Color=ui,exports.ColorKeyframeTrack=Kp,exports.CompressedTexture=uu,exports.CompressedTextureLoader=fd,exports.ConeBufferGeometry=Cp,exports.ConeGeometry=Rp,exports.CubeCamera=Ma,exports.CubeRefractionMapping=exports.CubeReflectionMapping=exports.CubeGeometry=void 0,exports.CubeTexture=dc,exports.CubeTextureLoader=gd,exports.CubeUVRefractionMapping=exports.CubeUVReflectionMapping=void 0,exports.CubicBezierCurve=Ud,exports.CubicBezierCurve3=Gd,exports.CubicInterpolant=Xp,exports.CullFaceNone=exports.CullFaceFrontBack=exports.CullFaceFront=exports.CullFaceBack=void 0,exports.Curve=xd,exports.CurvePath=qd,exports.CustomBlending=void 0,exports.CylinderBufferGeometry=Lp,exports.CylinderGeometry=Ap,exports.Cylindrical=mm,exports.DataTexture=Ta,exports.DataTexture2DArray=fc,exports.DataTexture3D=mc,exports.DataTextureLoader=md,exports.DepthStencilFormat=exports.DepthFormat=exports.DefaultLoadingManager=exports.DecrementWrapStencilOp=exports.DecrementStencilOp=void 0,exports.DepthTexture=du,exports.DirectionalLight=af,exports.DirectionalLightHelper=Gm,exports.DirectionalLightShadow=nf,exports.DiscreteInterpolant=Zp,exports.DodecahedronBufferGeometry=Eu,exports.DodecahedronGeometry=Tu,exports.DstColorFactor=exports.DstAlphaFactor=exports.DoubleSide=void 0,exports.DynamicBufferAttribute=Qv,exports.DynamicReadUsage=exports.DynamicDrawUsage=exports.DynamicCopyUsage=void 0,exports.EdgesGeometry=Ep,exports.EdgesHelper=pg,exports.EllipseCurve=_d,exports.EquirectangularRefractionMapping=exports.EquirectangularReflectionMapping=exports.EqualStencilFunc=exports.EqualDepth=void 0,exports.Euler=an,exports.EventDispatcher=Pr,exports.ExtrudeBufferGeometry=pp,exports.ExtrudeGeometry=up,exports.Face3=mi,exports.Face4=Bv,exports.FaceColors=void 0,exports.FileLoader=pd,exports.FlatShading=void 0,exports.Float32Attribute=ag,exports.Float32BufferAttribute=Li,exports.Float64Attribute=og,exports.Float64BufferAttribute=Ri,exports.FloatType=void 0,exports.Fog=dh,exports.FogExp2=ph,exports.Font=bf,exports.FontLoader=Sf,exports.FrontSide=exports.FrontFaceDirectionCW=exports.FrontFaceDirectionCCW=void 0,exports.Frustum=La,exports.GammaEncoding=void 0,exports.Geometry=ha,exports.GreaterStencilFunc=exports.GreaterEqualStencilFunc=exports.GreaterEqualDepth=exports.GreaterDepth=exports.GeometryUtils=void 0,exports.GridHelper=Im,exports.Group=lh,exports.HalfFloatType=void 0,exports.HemisphereLight=Jd,exports.HemisphereLightHelper=Dm,exports.HemisphereLightProbe=Rf,exports.IcosahedronBufferGeometry=Su,exports.IcosahedronGeometry=Mu,exports.ImageBitmapLoader=xf,exports.ImageLoader=vd,exports.ImageUtils=void 0,exports.ImmediateRenderObject=bm,exports.IncrementWrapStencilOp=exports.IncrementStencilOp=void 0,exports.InstancedBufferAttribute=uf,exports.InstancedBufferGeometry=hf,exports.InstancedInterleavedBuffer=hm,exports.InstancedMesh=Wh,exports.Int16Attribute=tg,exports.Int16BufferAttribute=Si,exports.Int32Attribute=ng,exports.Int32BufferAttribute=Ei,exports.Int8Attribute=Kv,exports.Int8BufferAttribute=bi,exports.IntType=void 0,exports.InterleavedBuffer=fh,exports.InterleavedBufferAttribute=gh,exports.Interpolant=qp,exports.InvertStencilOp=exports.InterpolateSmooth=exports.InterpolateLinear=exports.InterpolateDiscrete=void 0,exports.JSONLoader=xg,exports.KeepStencilOp=void 0,exports.KeyframeTrack=Jp,exports.LOD=Nh,exports.LatheBufferGeometry=wp,exports.LatheGeometry=bp,exports.Layers=on,exports.LensFlare=bg,exports.LessStencilFunc=exports.LessEqualStencilFunc=exports.LessEqualDepth=exports.LessDepth=void 0,exports.Light=Zd,exports.LightProbe=Lf,exports.LightShadow=Qd,exports.Line=Kh,exports.Line3=_m,exports.LineBasicMaterial=qh,exports.LineCurve=zd,exports.LineCurve3=Hd,exports.LineDashedMaterial=kp,exports.LineLoop=ru,exports.LinePieces=void 0,exports.LineSegments=tu,exports.LinearFilter=exports.LinearEncoding=exports.LineStrip=void 0,exports.LinearInterpolant=Yp,exports.LinearMipMapLinearFilter=void 0,exports.LinearToneMapping=exports.LinearMipmapNearestFilter=exports.LinearMipmapLinearFilter=exports.LinearMipMapNearestFilter=void 0,exports.Loader=hd,exports.LoaderUtils=void 0,exports.LoadingManager=cd,exports.MOUSE=exports.LuminanceFormat=exports.LuminanceAlphaFormat=exports.LoopRepeat=exports.LoopPingPong=exports.LoopOnce=exports.LogLuvEncoding=void 0,exports.Material=gi,exports.MaterialLoader=cf,exports.MathUtils=exports.Math=void 0,exports.Matrix3=Fr,exports.Matrix4=tn,exports.MaxEquation=void 0,exports.Mesh=na,exports.MeshBasicMaterial=yi,exports.MeshDepthMaterial=eh,exports.MeshDistanceMaterial=th,exports.MeshFaceMaterial=Vv,exports.MeshLambertMaterial=Hp,exports.MeshMatcapMaterial=Vp,exports.MeshNormalMaterial=zp,exports.MeshPhongMaterial=Up,exports.MeshPhysicalMaterial=Fp,exports.MeshStandardMaterial=Bp,exports.MeshToonMaterial=Gp,exports.MixOperation=exports.MirroredRepeatWrapping=exports.MinEquation=void 0,exports.MultiMaterial=kv,exports.NotEqualStencilFunc=exports.NotEqualDepth=exports.NormalBlending=exports.NoToneMapping=exports.NoColors=exports.NoBlending=exports.NeverStencilFunc=exports.NeverDepth=exports.NearestMipmapNearestFilter=exports.NearestMipmapLinearFilter=exports.NearestMipMapNearestFilter=exports.NearestMipMapLinearFilter=exports.NearestFilter=exports.MultiplyOperation=exports.MultiplyBlending=void 0,exports.NumberKeyframeTrack=$p,exports.Object3D=_n,exports.ObjectLoader=ff,exports.ObjectSpaceNormalMap=void 0,exports.OctahedronBufferGeometry=wu,exports.OctahedronGeometry=bu,exports.OneMinusSrcColorFactor=exports.OneMinusSrcAlphaFactor=exports.OneMinusDstColorFactor=exports.OneMinusDstAlphaFactor=exports.OneFactor=void 0,exports.OrthographicCamera=rf,exports.PCFSoftShadowMap=exports.PCFShadowMap=void 0,exports.PMREMGenerator=xv,exports.ParametricBufferGeometry=vu,exports.ParametricGeometry=mu,exports.Particle=Wv,exports.ParticleBasicMaterial=Yv,exports.ParticleSystem=qv,exports.ParticleSystemMaterial=Zv,exports.Path=Xd,exports.PerspectiveCamera=_a,exports.Plane=Jn,exports.PlaneBufferGeometry=Da,exports.PlaneGeometry=Oa,exports.PlaneHelper=Xm,exports.PointCloud=jv,exports.PointCloudMaterial=Xv,exports.PointLight=tf,exports.PointLightHelper=Rm,exports.Points=cu,exports.PointsMaterial=nu,exports.PolarGridHelper=Nm,exports.PolyhedronBufferGeometry=yu,exports.PolyhedronGeometry=gu,exports.PositionalAudio=Wf,exports.PropertyBinding=am,exports.PropertyMixer=Xf,exports.QuadraticBezierCurve=Vd,exports.QuadraticBezierCurve3=kd,exports.Quaternion=jr,exports.QuaternionKeyframeTrack=td,exports.QuaternionLinearInterpolant=ed,exports.RGBAIntegerFormat=exports.RGBAFormat=exports.RGBADepthPacking=exports.REVISION=void 0,exports.RGIntegerFormat=exports.RGFormat=exports.RGB_S3TC_DXT1_Format=exports.RGB_PVRTC_4BPPV1_Format=exports.RGB_PVRTC_2BPPV1_Format=exports.RGB_ETC2_Format=exports.RGB_ETC1_Format=exports.RGBM7Encoding=exports.RGBM16Encoding=exports.RGBIntegerFormat=exports.RGBFormat=exports.RGBEFormat=exports.RGBEEncoding=exports.RGBDEncoding=exports.RGBA_S3TC_DXT5_Format=exports.RGBA_S3TC_DXT3_Format=exports.RGBA_S3TC_DXT1_Format=exports.RGBA_PVRTC_4BPPV1_Format=exports.RGBA_PVRTC_2BPPV1_Format=exports.RGBA_ETC2_EAC_Format=exports.RGBA_BPTC_Format=exports.RGBA_ASTC_8x8_Format=exports.RGBA_ASTC_8x6_Format=exports.RGBA_ASTC_8x5_Format=exports.RGBA_ASTC_6x6_Format=exports.RGBA_ASTC_6x5_Format=exports.RGBA_ASTC_5x5_Format=exports.RGBA_ASTC_5x4_Format=exports.RGBA_ASTC_4x4_Format=exports.RGBA_ASTC_12x12_Format=exports.RGBA_ASTC_12x10_Format=exports.RGBA_ASTC_10x8_Format=exports.RGBA_ASTC_10x6_Format=exports.RGBA_ASTC_10x5_Format=exports.RGBA_ASTC_10x10_Format=void 0,exports.RawShaderMaterial=Np,exports.Ray=qn,exports.Raycaster=um,exports.RectAreaLight=sf,exports.ReverseSubtractEquation=exports.ReplaceStencilOp=exports.RepeatWrapping=exports.ReinhardToneMapping=exports.RedIntegerFormat=exports.RedFormat=void 0,exports.RingBufferGeometry=_p,exports.RingGeometry=xp,exports.SRGB8_ALPHA8_ASTC_8x8_Format=exports.SRGB8_ALPHA8_ASTC_8x6_Format=exports.SRGB8_ALPHA8_ASTC_8x5_Format=exports.SRGB8_ALPHA8_ASTC_6x6_Format=exports.SRGB8_ALPHA8_ASTC_6x5_Format=exports.SRGB8_ALPHA8_ASTC_5x5_Format=exports.SRGB8_ALPHA8_ASTC_5x4_Format=exports.SRGB8_ALPHA8_ASTC_4x4_Format=exports.SRGB8_ALPHA8_ASTC_12x12_Format=exports.SRGB8_ALPHA8_ASTC_12x10_Format=exports.SRGB8_ALPHA8_ASTC_10x8_Format=exports.SRGB8_ALPHA8_ASTC_10x6_Format=exports.SRGB8_ALPHA8_ASTC_10x5_Format=exports.SRGB8_ALPHA8_ASTC_10x10_Format=void 0,exports.Scene=bn,exports.ShaderLib=exports.ShaderChunk=exports.SceneUtils=void 0,exports.ShaderMaterial=ya,exports.ShadowMaterial=Ip,exports.Shape=Yd,exports.ShapeBufferGeometry=Sp,exports.ShapeGeometry=Mp,exports.ShapePath=_f,exports.ShortType=exports.ShapeUtils=void 0,exports.Skeleton=Gh,exports.SkeletonHelper=Lm,exports.SkinnedMesh=Bh,exports.SmoothShading=void 0,exports.Sphere=Un,exports.SphereBufferGeometry=yp,exports.SphereGeometry=gp,exports.Spherical=fm,exports.SphericalHarmonics3=Af,exports.SphericalReflectionMapping=void 0,exports.Spline=lg,exports.SplineCurve=jd,exports.SplineCurve3=cg,exports.SpotLight=$d,exports.SpotLightHelper=Mm,exports.SpotLightShadow=Kd,exports.Sprite=Ph,exports.SpriteMaterial=yh,exports.StaticReadUsage=exports.StaticDrawUsage=exports.StaticCopyUsage=exports.SrcColorFactor=exports.SrcAlphaSaturateFactor=exports.SrcAlphaFactor=void 0,exports.StereoCamera=Df,exports.StreamDrawUsage=exports.StreamCopyUsage=void 0,exports.StreamReadUsage=void 0,exports.StringKeyframeTrack=rd,exports.TangentSpaceNormalMap=exports.TOUCH=exports.SubtractiveBlending=exports.SubtractEquation=void 0,exports.TetrahedronBufferGeometry=_u,exports.TetrahedronGeometry=xu,exports.TextBufferGeometry=vp,exports.TextGeometry=mp,exports.Texture=zr,exports.TextureLoader=yd,exports.TorusBufferGeometry=Ou,exports.TorusGeometry=Pu,exports.TorusKnotBufferGeometry=Cu,exports.TorusKnotGeometry=Ru,exports.Triangle=si,exports.TrianglesDrawMode=exports.TriangleStripDrawMode=exports.TriangleFanDrawMode=void 0,exports.TubeBufferGeometry=Lu,exports.TubeGeometry=Au,exports.UVMapping=void 0,exports.Uint16Attribute=rg,exports.Uint16BufferAttribute=Ti,exports.Uint32Attribute=ig,exports.Uint32BufferAttribute=Ai,exports.Uint8Attribute=$v,exports.Uint8BufferAttribute=wi,exports.Uint8ClampedAttribute=eg,exports.Uint8ClampedBufferAttribute=Mi,exports.Uncharted2ToneMapping=void 0,exports.Uniform=lm,exports.VSMShadowMap=exports.UnsignedShortType=exports.UnsignedShort565Type=exports.UnsignedShort5551Type=exports.UnsignedShort4444Type=exports.UnsignedIntType=exports.UnsignedInt248Type=exports.UnsignedByteType=exports.UniformsUtils=exports.UniformsLib=void 0,exports.Vector2=Br,exports.Vector3=Xr,exports.Vector4=Hr,exports.VectorKeyframeTrack=nd,exports.Vertex=Jv,exports.VertexColors=void 0,exports.VideoTexture=hu,exports.WebGLCubeRenderTarget=Sa,exports.WebGLMultisampleRenderTarget=kr,exports.WebGLRenderTarget=Vr,exports.WebGLRenderTargetCube=vg,exports.WebGLRenderer=uh,exports.WebGLUtils=sh,exports.WireframeGeometry=fu,exports.WireframeHelper=dg,exports.WrapAroundEnding=void 0,exports.XHRLoader=fg,exports.sRGBEncoding=exports.ZeroStencilOp=exports.ZeroSlopeEnding=exports.ZeroFactor=exports.ZeroCurvatureEnding=void 0,void 0===Number.EPSILON&&(Number.EPSILON=Math.pow(2,-52)),void 0===Number.isInteger&&(Number.isInteger=function(e){return\"number\"==typeof e&&isFinite(e)&&Math.floor(e)===e}),void 0===Math.sign&&(Math.sign=function(e){return e<0?-1:e>0?1:+e}),\"name\"in Function.prototype==!1&&Object.defineProperty(Function.prototype,\"name\",{get:function(){return this.toString().match(\/^s*functions*([^(s]*)\/)[1]}}),void 0===Object.assign&&(Object.assign=function(e){if(null==e)throw new TypeError(\"Cannot convert undefined or null to object\");for(var t=Object(e),r=1;r<arguments.length;r++){var n=arguments[r];if(null!=n)for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t});var e=\"115\";exports.REVISION=e;var t={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2};exports.MOUSE=t;var r={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3};exports.TOUCH=r;var n=0;exports.CullFaceNone=n;var i=1;exports.CullFaceBack=i;var a=2;exports.CullFaceFront=a;var o=3;exports.CullFaceFrontBack=o;var s=0;exports.FrontFaceDirectionCW=s;var c=1;exports.FrontFaceDirectionCCW=c;var l=0;exports.BasicShadowMap=l;var h=1;exports.PCFShadowMap=h;var u=2;exports.PCFSoftShadowMap=u;var p=3;exports.VSMShadowMap=p;var d=0;exports.FrontSide=d;var f=1;exports.BackSide=f;var m=2;exports.DoubleSide=m;var v=1;exports.FlatShading=v;var g=2;exports.SmoothShading=g;var y=0;exports.NoBlending=y;var x=1;exports.NormalBlending=x;var _=2;exports.AdditiveBlending=_;var b=3;exports.SubtractiveBlending=b;var w=4;exports.MultiplyBlending=w;var M=5;exports.CustomBlending=M;var S=100;exports.AddEquation=S;var T=101;exports.SubtractEquation=T;var E=102;exports.ReverseSubtractEquation=E;var A=103;exports.MinEquation=A;var L=104;exports.MaxEquation=L;var R=200;exports.ZeroFactor=R;var C=201;exports.OneFactor=C;var P=202;exports.SrcColorFactor=P;var O=203;exports.OneMinusSrcColorFactor=O;var D=204;exports.SrcAlphaFactor=D;var I=205;exports.OneMinusSrcAlphaFactor=I;var N=206;exports.DstAlphaFactor=N;var B=207;exports.OneMinusDstAlphaFactor=B;var F=208;exports.DstColorFactor=F;var U=209;exports.OneMinusDstColorFactor=U;var G=210;exports.SrcAlphaSaturateFactor=G;var z=0;exports.NeverDepth=z;var H=1;exports.AlwaysDepth=H;var V=2;exports.LessDepth=V;var k=3;exports.LessEqualDepth=k;var j=4;exports.EqualDepth=j;var W=5;exports.GreaterEqualDepth=W;var q=6;exports.GreaterDepth=q;var X=7;exports.NotEqualDepth=X;var Y=0;exports.MultiplyOperation=Y;var Z=1;exports.MixOperation=Z;var J=2;exports.AddOperation=J;var Q=0;exports.NoToneMapping=Q;var K=1;exports.LinearToneMapping=K;var $=2;exports.ReinhardToneMapping=$;var ee=3;exports.Uncharted2ToneMapping=ee;var te=4;exports.CineonToneMapping=te;var re=5;exports.ACESFilmicToneMapping=re;var ne=300;exports.UVMapping=ne;var ie=301;exports.CubeReflectionMapping=ie;var ae=302;exports.CubeRefractionMapping=ae;var oe=303;exports.EquirectangularReflectionMapping=oe;var se=304;exports.EquirectangularRefractionMapping=se;var ce=305;exports.SphericalReflectionMapping=ce;var le=306;exports.CubeUVReflectionMapping=le;var he=307;exports.CubeUVRefractionMapping=he;var ue=1e3;exports.RepeatWrapping=ue;var pe=1001;exports.ClampToEdgeWrapping=pe;var de=1002;exports.MirroredRepeatWrapping=de;var fe=1003;exports.NearestFilter=fe;var me=1004;exports.NearestMipmapNearestFilter=me;var ve=1004;exports.NearestMipMapNearestFilter=ve;var ge=1005;exports.NearestMipmapLinearFilter=ge;var ye=1005;exports.NearestMipMapLinearFilter=ye;var xe=1006;exports.LinearFilter=xe;var _e=1007;exports.LinearMipmapNearestFilter=_e;var be=1007;exports.LinearMipMapNearestFilter=be;var we=1008;exports.LinearMipmapLinearFilter=we;var Me=1008;exports.LinearMipMapLinearFilter=Me;var Se=1009;exports.UnsignedByteType=Se;var Te=1010;exports.ByteType=Te;var Ee=1011;exports.ShortType=Ee;var Ae=1012;exports.UnsignedShortType=Ae;var Le=1013;exports.IntType=Le;var Re=1014;exports.UnsignedIntType=Re;var Ce=1015;exports.FloatType=Ce;var Pe=1016;exports.HalfFloatType=Pe;var Oe=1017;exports.UnsignedShort4444Type=Oe;var De=1018;exports.UnsignedShort5551Type=De;var Ie=1019;exports.UnsignedShort565Type=Ie;var Ne=1020;exports.UnsignedInt248Type=Ne;var Be=1021;exports.AlphaFormat=Be;var Fe=1022;exports.RGBFormat=Fe;var Ue=1023;exports.RGBAFormat=Ue;var Ge=1024;exports.LuminanceFormat=Ge;var ze=1025;exports.LuminanceAlphaFormat=ze;var He=Ue;exports.RGBEFormat=He;var Ve=1026;exports.DepthFormat=Ve;var ke=1027;exports.DepthStencilFormat=ke;var je=1028;exports.RedFormat=je;var We=1029;exports.RedIntegerFormat=We;var qe=1030;exports.RGFormat=qe;var Xe=1031;exports.RGIntegerFormat=Xe;var Ye=1032;exports.RGBIntegerFormat=Ye;var Ze=1033;exports.RGBAIntegerFormat=Ze;var Je=33776;exports.RGB_S3TC_DXT1_Format=Je;var Qe=33777;exports.RGBA_S3TC_DXT1_Format=Qe;var Ke=33778;exports.RGBA_S3TC_DXT3_Format=Ke;var $e=33779;exports.RGBA_S3TC_DXT5_Format=$e;var et=35840;exports.RGB_PVRTC_4BPPV1_Format=et;var tt=35841;exports.RGB_PVRTC_2BPPV1_Format=tt;var rt=35842;exports.RGBA_PVRTC_4BPPV1_Format=rt;var nt=35843;exports.RGBA_PVRTC_2BPPV1_Format=nt;var it=36196;exports.RGB_ETC1_Format=it;var at=37492;exports.RGB_ETC2_Format=at;var ot=37496;exports.RGBA_ETC2_EAC_Format=ot;var st=37808;exports.RGBA_ASTC_4x4_Format=st;var ct=37809;exports.RGBA_ASTC_5x4_Format=ct;var lt=37810;exports.RGBA_ASTC_5x5_Format=lt;var ht=37811;exports.RGBA_ASTC_6x5_Format=ht;var ut=37812;exports.RGBA_ASTC_6x6_Format=ut;var pt=37813;exports.RGBA_ASTC_8x5_Format=pt;var dt=37814;exports.RGBA_ASTC_8x6_Format=dt;var ft=37815;exports.RGBA_ASTC_8x8_Format=ft;var mt=37816;exports.RGBA_ASTC_10x5_Format=mt;var vt=37817;exports.RGBA_ASTC_10x6_Format=vt;var gt=37818;exports.RGBA_ASTC_10x8_Format=gt;var yt=37819;exports.RGBA_ASTC_10x10_Format=yt;var xt=37820;exports.RGBA_ASTC_12x10_Format=xt;var _t=37821;exports.RGBA_ASTC_12x12_Format=_t;var bt=36492;exports.RGBA_BPTC_Format=bt;var wt=37840;exports.SRGB8_ALPHA8_ASTC_4x4_Format=wt;var Mt=37841;exports.SRGB8_ALPHA8_ASTC_5x4_Format=Mt;var St=37842;exports.SRGB8_ALPHA8_ASTC_5x5_Format=St;var Tt=37843;exports.SRGB8_ALPHA8_ASTC_6x5_Format=Tt;var Et=37844;exports.SRGB8_ALPHA8_ASTC_6x6_Format=Et;var At=37845;exports.SRGB8_ALPHA8_ASTC_8x5_Format=At;var Lt=37846;exports.SRGB8_ALPHA8_ASTC_8x6_Format=Lt;var Rt=37847;exports.SRGB8_ALPHA8_ASTC_8x8_Format=Rt;var Ct=37848;exports.SRGB8_ALPHA8_ASTC_10x5_Format=Ct;var Pt=37849;exports.SRGB8_ALPHA8_ASTC_10x6_Format=Pt;var Ot=37850;exports.SRGB8_ALPHA8_ASTC_10x8_Format=Ot;var Dt=37851;exports.SRGB8_ALPHA8_ASTC_10x10_Format=Dt;var It=37852;exports.SRGB8_ALPHA8_ASTC_12x10_Format=It;var Nt=37853;exports.SRGB8_ALPHA8_ASTC_12x12_Format=Nt;var Bt=2200;exports.LoopOnce=Bt;var Ft=2201;exports.LoopRepeat=Ft;var Ut=2202;exports.LoopPingPong=Ut;var Gt=2300;exports.InterpolateDiscrete=Gt;var zt=2301;exports.InterpolateLinear=zt;var Ht=2302;exports.InterpolateSmooth=Ht;var Vt=2400;exports.ZeroCurvatureEnding=Vt;var kt=2401;exports.ZeroSlopeEnding=kt;var jt=2402;exports.WrapAroundEnding=jt;var Wt=0;exports.TrianglesDrawMode=Wt;var qt=1;exports.TriangleStripDrawMode=qt;var Xt=2;exports.TriangleFanDrawMode=Xt;var Yt=3e3;exports.LinearEncoding=Yt;var Zt=3001;exports.sRGBEncoding=Zt;var Jt=3007;exports.GammaEncoding=Jt;var Qt=3002;exports.RGBEEncoding=Qt;var Kt=3003;exports.LogLuvEncoding=Kt;var $t=3004;exports.RGBM7Encoding=$t;var er=3005;exports.RGBM16Encoding=er;var tr=3006;exports.RGBDEncoding=tr;var rr=3200;exports.BasicDepthPacking=rr;var nr=3201;exports.RGBADepthPacking=nr;var ir=0;exports.TangentSpaceNormalMap=ir;var ar=1;exports.ObjectSpaceNormalMap=ar;var or=0;exports.ZeroStencilOp=or;var sr=7680;exports.KeepStencilOp=sr;var cr=7681;exports.ReplaceStencilOp=cr;var lr=7682;exports.IncrementStencilOp=lr;var hr=7683;exports.DecrementStencilOp=hr;var ur=34055;exports.IncrementWrapStencilOp=ur;var pr=34056;exports.DecrementWrapStencilOp=pr;var dr=5386;exports.InvertStencilOp=dr;var fr=512;exports.NeverStencilFunc=fr;var mr=513;exports.LessStencilFunc=mr;var vr=514;exports.EqualStencilFunc=vr;var gr=515;exports.LessEqualStencilFunc=gr;var yr=516;exports.GreaterStencilFunc=yr;var xr=517;exports.NotEqualStencilFunc=xr;var _r=518;exports.GreaterEqualStencilFunc=_r;var br=519;exports.AlwaysStencilFunc=br;var wr=35044;exports.StaticDrawUsage=wr;var Mr=35048;exports.DynamicDrawUsage=Mr;var Sr=35040;exports.StreamDrawUsage=Sr;var Tr=35045;exports.StaticReadUsage=Tr;var Er=35049;exports.DynamicReadUsage=Er;var Ar=35041;exports.StreamReadUsage=Ar;var Lr=35046;exports.StaticCopyUsage=Lr;var Rr=35050;exports.DynamicCopyUsage=Rr;var Cr=35042;function Pr(){}exports.StreamCopyUsage=Cr,Object.assign(Pr.prototype,{addEventListener:function(e,t){void 0===this._listeners&&(this._listeners={});var r=this._listeners;void 0===r[e]&&(r[e]=[]),-1===r[e].indexOf(t)&&r[e].push(t)},hasEventListener:function(e,t){if(void 0===this._listeners)return!1;var r=this._listeners;return void 0!==r[e]&&-1!==r[e].indexOf(t)},removeEventListener:function(e,t){if(void 0!==this._listeners){var r=this._listeners[e];if(void 0!==r){var n=r.indexOf(t);-1!==n&&r.splice(n,1)}}},dispatchEvent:function(e){if(void 0!==this._listeners){var t=this._listeners[e.type];if(void 0!==t){e.target=this;for(var r=t.slice(0),n=0,i=r.length;n<i;n++)r[n].call(this,e)}}}});for(var Or=[],Dr=0;Dr<256;Dr++)Or[Dr]=(Dr<16?\"0\":\"\")+Dr.toString(16);var Ir,Nr={DEG2RAD:Math.PI\/180,RAD2DEG:180\/Math.PI,generateUUID:function(){var e=4294967295*Math.random()|0,t=4294967295*Math.random()|0,r=4294967295*Math.random()|0,n=4294967295*Math.random()|0;return(Or[255&e]+Or[e>>8&255]+Or[e>>16&255]+Or[e>>24&255]+\"-\"+Or[255&t]+Or[t>>8&255]+\"-\"+Or[t>>16&15|64]+Or[t>>24&255]+\"-\"+Or[63&r|128]+Or[r>>8&255]+\"-\"+Or[r>>16&255]+Or[r>>24&255]+Or[255&n]+Or[n>>8&255]+Or[n>>16&255]+Or[n>>24&255]).toUpperCase()},clamp:function(e,t,r){return Math.max(t,Math.min(r,e))},euclideanModulo:function(e,t){return(e%t+t)%t},mapLinear:function(e,t,r,n,i){return n+(e-t)*(i-n)\/(r-t)},lerp:function(e,t,r){return(1-r)*e+r*t},smoothstep:function(e,t,r){return e<=t?0:e>=r?1:(e=(e-t)\/(r-t))*e*(3-2*e)},smootherstep:function(e,t,r){return e<=t?0:e>=r?1:(e=(e-t)\/(r-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())},degToRad:function(e){return e*Nr.DEG2RAD},radToDeg:function(e){return e*Nr.RAD2DEG},isPowerOfTwo:function(e){return 0==(e&e-1)&&0!==e},ceilPowerOfTwo:function(e){return Math.pow(2,Math.ceil(Math.log(e)\/Math.LN2))},floorPowerOfTwo:function(e){return Math.pow(2,Math.floor(Math.log(e)\/Math.LN2))},setQuaternionFromProperEuler:function(e,t,r,n,i){var a=Math.cos,o=Math.sin,s=a(r\/2),c=o(r\/2),l=a((t+n)\/2),h=o((t+n)\/2),u=a((t-n)\/2),p=o((t-n)\/2),d=a((n-t)\/2),f=o((n-t)\/2);\"XYX\"===i?e.set(s*h,c*u,c*p,s*l):\"YZY\"===i?e.set(c*p,s*h,c*u,s*l):\"ZXZ\"===i?e.set(c*u,c*p,s*h,s*l):\"XZX\"===i?e.set(s*h,c*f,c*d,s*l):\"YXY\"===i?e.set(c*d,s*h,c*f,s*l):\"ZYZ\"===i?e.set(c*f,c*d,s*h,s*l):console.warn(\"THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order.\")}};function Br(e,t){this.x=e||0,this.y=t||0}function Fr(){this.elements=[1,0,0,0,1,0,0,0,1],arguments.length>0&&console.error(\"THREE.Matrix3: the constructor no longer reads arguments. use .set() instead.\")}exports.MathUtils=exports.Math=Nr,Object.defineProperties(Br.prototype,{width:{get:function(){return this.x},set:function(e){this.x=e}},height:{get:function(){return this.y},set:function(e){this.y=e}}}),Object.assign(Br.prototype,{isVector2:!0,set:function(e,t){return this.x=e,this.y=t,this},setScalar:function(e){return this.x=e,this.y=e,this},setX:function(e){return this.x=e,this},setY:function(e){return this.y=e,this},setComponent: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},getComponent:function(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error(\"index is out of range: \"+e)}},clone:function(){return new this.constructor(this.x,this.y)},copy:function(e){return this.x=e.x,this.y=e.y,this},add:function(e,t){return void 0!==t?(console.warn(\"THREE.Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead.\"),this.addVectors(e,t)):(this.x+=e.x,this.y+=e.y,this)},addScalar:function(e){return this.x+=e,this.y+=e,this},addVectors:function(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this},addScaledVector:function(e,t){return this.x+=e.x*t,this.y+=e.y*t,this},sub:function(e,t){return void 0!==t?(console.warn(\"THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead.\"),this.subVectors(e,t)):(this.x-=e.x,this.y-=e.y,this)},subScalar:function(e){return this.x-=e,this.y-=e,this},subVectors:function(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this},multiply:function(e){return this.x*=e.x,this.y*=e.y,this},multiplyScalar:function(e){return this.x*=e,this.y*=e,this},divide:function(e){return this.x\/=e.x,this.y\/=e.y,this},divideScalar:function(e){return this.multiplyScalar(1\/e)},applyMatrix3:function(e){var t=this.x,r=this.y,n=e.elements;return this.x=n[0]*t+n[3]*r+n[6],this.y=n[1]*t+n[4]*r+n[7],this},min:function(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this},max:function(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this},clamp: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},clampScalar: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},clampLength:function(e,t){var r=this.length();return this.divideScalar(r||1).multiplyScalar(Math.max(e,Math.min(t,r)))},floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},roundToZero:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this},negate:function(){return this.x=-this.x,this.y=-this.y,this},dot:function(e){return this.x*e.x+this.y*e.y},cross:function(e){return this.x*e.y-this.y*e.x},lengthSq:function(){return this.x*this.x+this.y*this.y},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},manhattanLength:function(){return Math.abs(this.x)+Math.abs(this.y)},normalize:function(){return this.divideScalar(this.length()||1)},angle:function(){return Math.atan2(-this.y,-this.x)+Math.PI},distanceTo:function(e){return Math.sqrt(this.distanceToSquared(e))},distanceToSquared:function(e){var t=this.x-e.x,r=this.y-e.y;return t*t+r*r},manhattanDistanceTo:function(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)},setLength:function(e){return this.normalize().multiplyScalar(e)},lerp:function(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this},lerpVectors:function(e,t,r){return this.subVectors(t,e).multiplyScalar(r).add(e)},equals:function(e){return e.x===this.x&&e.y===this.y},fromArray:function(e,t){return void 0===t&&(t=0),this.x=e[t],this.y=e[t+1],this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this.x,e[t+1]=this.y,e},fromBufferAttribute:function(e,t,r){return void 0!==r&&console.warn(\"THREE.Vector2: offset has been removed from .fromBufferAttribute().\"),this.x=e.getX(t),this.y=e.getY(t),this},rotateAround:function(e,t){var r=Math.cos(t),n=Math.sin(t),i=this.x-e.x,a=this.y-e.y;return this.x=i*r-a*n+e.x,this.y=i*n+a*r+e.y,this}}),Object.assign(Fr.prototype,{isMatrix3:!0,set:function(e,t,r,n,i,a,o,s,c){var l=this.elements;return l[0]=e,l[1]=n,l[2]=o,l[3]=t,l[4]=i,l[5]=s,l[6]=r,l[7]=a,l[8]=c,this},identity:function(){return this.set(1,0,0,0,1,0,0,0,1),this},clone:function(){return(new this.constructor).fromArray(this.elements)},copy:function(e){var t=this.elements,r=e.elements;return t[0]=r[0],t[1]=r[1],t[2]=r[2],t[3]=r[3],t[4]=r[4],t[5]=r[5],t[6]=r[6],t[7]=r[7],t[8]=r[8],this},extractBasis:function(e,t,r){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),r.setFromMatrix3Column(this,2),this},setFromMatrix4: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},multiply:function(e){return this.multiplyMatrices(this,e)},premultiply:function(e){return this.multiplyMatrices(e,this)},multiplyMatrices:function(e,t){var r=e.elements,n=t.elements,i=this.elements,a=r[0],o=r[3],s=r[6],c=r[1],l=r[4],h=r[7],u=r[2],p=r[5],d=r[8],f=n[0],m=n[3],v=n[6],g=n[1],y=n[4],x=n[7],_=n[2],b=n[5],w=n[8];return i[0]=a*f+o*g+s*_,i[3]=a*m+o*y+s*b,i[6]=a*v+o*x+s*w,i[1]=c*f+l*g+h*_,i[4]=c*m+l*y+h*b,i[7]=c*v+l*x+h*w,i[2]=u*f+p*g+d*_,i[5]=u*m+p*y+d*b,i[8]=u*v+p*x+d*w,this},multiplyScalar: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},determinant:function(){var e=this.elements,t=e[0],r=e[1],n=e[2],i=e[3],a=e[4],o=e[5],s=e[6],c=e[7],l=e[8];return t*a*l-t*o*c-r*i*l+r*o*s+n*i*c-n*a*s},getInverse:function(e,t){void 0!==t&&console.warn(\"THREE.Matrix3: .getInverse() can no longer be configured to throw on degenerate.\");var r=e.elements,n=this.elements,i=r[0],a=r[1],o=r[2],s=r[3],c=r[4],l=r[5],h=r[6],u=r[7],p=r[8],d=p*c-l*u,f=l*h-p*s,m=u*s-c*h,v=i*d+a*f+o*m;if(0===v)return this.set(0,0,0,0,0,0,0,0,0);var g=1\/v;return n[0]=d*g,n[1]=(o*u-p*a)*g,n[2]=(l*a-o*c)*g,n[3]=f*g,n[4]=(p*i-o*h)*g,n[5]=(o*s-l*i)*g,n[6]=m*g,n[7]=(a*h-u*i)*g,n[8]=(c*i-a*s)*g,this},transpose:function(){var e,t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this},getNormalMatrix:function(e){return this.setFromMatrix4(e).getInverse(this).transpose()},transposeIntoArray:function(e){var t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this},setUvTransform:function(e,t,r,n,i,a,o){var s=Math.cos(i),c=Math.sin(i);this.set(r*s,r*c,-r*(s*a+c*o)+a+e,-n*c,n*s,-n*(-c*a+s*o)+o+t,0,0,1)},scale:function(e,t){var r=this.elements;return r[0]*=e,r[3]*=e,r[6]*=e,r[1]*=t,r[4]*=t,r[7]*=t,this},rotate:function(e){var t=Math.cos(e),r=Math.sin(e),n=this.elements,i=n[0],a=n[3],o=n[6],s=n[1],c=n[4],l=n[7];return n[0]=t*i+r*s,n[3]=t*a+r*c,n[6]=t*o+r*l,n[1]=-r*i+t*s,n[4]=-r*a+t*c,n[7]=-r*o+t*l,this},translate:function(e,t){var r=this.elements;return r[0]+=e*r[2],r[3]+=e*r[5],r[6]+=e*r[8],r[1]+=t*r[2],r[4]+=t*r[5],r[7]+=t*r[8],this},equals:function(e){for(var t=this.elements,r=e.elements,n=0;n<9;n++)if(t[n]!==r[n])return!1;return!0},fromArray:function(e,t){void 0===t&&(t=0);for(var r=0;r<9;r++)this.elements[r]=e[r+t];return this},toArray:function(e,t){void 0===e&&(e=[]),void 0===t&&(t=0);var r=this.elements;return e[t]=r[0],e[t+1]=r[1],e[t+2]=r[2],e[t+3]=r[3],e[t+4]=r[4],e[t+5]=r[5],e[t+6]=r[6],e[t+7]=r[7],e[t+8]=r[8],e}});var Ur={getDataURL:function(e){var t;if(\"undefined\"==typeof HTMLCanvasElement)return e.src;if(e instanceof HTMLCanvasElement)t=e;else{void 0===Ir&&(Ir=document.createElementNS(\"http:\/\/www.w3.org\/1999\/xhtml\",\"canvas\")),Ir.width=e.width,Ir.height=e.height;var r=Ir.getContext(\"2d\");e instanceof ImageData?r.putImageData(e,0,0):r.drawImage(e,0,0,e.width,e.height),t=Ir}return t.width>2048||t.height>2048?t.toDataURL(\"image\/jpeg\",.6):t.toDataURL(\"image\/png\")}};exports.ImageUtils=Ur;var Gr=0;function zr(e,t,r,n,i,a,o,s,c,l){Object.defineProperty(this,\"id\",{value:Gr++}),this.uuid=Nr.generateUUID(),this.name=\"\",this.image=void 0!==e?e:zr.DEFAULT_IMAGE,this.mipmaps=[],this.mapping=void 0!==t?t:zr.DEFAULT_MAPPING,this.wrapS=void 0!==r?r:pe,this.wrapT=void 0!==n?n:pe,this.magFilter=void 0!==i?i:xe,this.minFilter=void 0!==a?a:we,this.anisotropy=void 0!==c?c:1,this.format=void 0!==o?o:Ue,this.internalFormat=null,this.type=void 0!==s?s:Se,this.offset=new Br(0,0),this.repeat=new Br(1,1),this.center=new Br(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new Fr,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.encoding=void 0!==l?l:Yt,this.version=0,this.onUpdate=null}function Hr(e,t,r,n){this.x=e||0,this.y=t||0,this.z=r||0,this.w=void 0!==n?n:1}function Vr(e,t,r){this.width=e,this.height=t,this.scissor=new Hr(0,0,e,t),this.scissorTest=!1,this.viewport=new Hr(0,0,e,t),r=r||{},this.texture=new zr(void 0,r.mapping,r.wrapS,r.wrapT,r.magFilter,r.minFilter,r.format,r.type,r.anisotropy,r.encoding),this.texture.image={},this.texture.image.width=e,this.texture.image.height=t,this.texture.generateMipmaps=void 0!==r.generateMipmaps&&r.generateMipmaps,this.texture.minFilter=void 0!==r.minFilter?r.minFilter:xe,this.depthBuffer=void 0===r.depthBuffer||r.depthBuffer,this.stencilBuffer=void 0===r.stencilBuffer||r.stencilBuffer,this.depthTexture=void 0!==r.depthTexture?r.depthTexture:null}function kr(e,t,r){Vr.call(this,e,t,r),this.samples=4}function jr(e,t,r,n){this._x=e||0,this._y=t||0,this._z=r||0,this._w=void 0!==n?n:1}zr.DEFAULT_IMAGE=void 0,zr.DEFAULT_MAPPING=ne,zr.prototype=Object.assign(Object.create(Pr.prototype),{constructor:zr,isTexture:!0,updateMatrix:function(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.name=e.name,this.image=e.image,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,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.encoding=e.encoding,this},toJSON:function(e){var t=void 0===e||\"string\"==typeof e;if(!t&&void 0!==e.textures[this.uuid])return e.textures[this.uuid];var r={metadata:{version:4.5,type:\"Texture\",generator:\"Texture.toJSON\"},uuid:this.uuid,name:this.name,mapping:this.mapping,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,type:this.type,encoding:this.encoding,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};if(void 0!==this.image){var n=this.image;if(void 0===n.uuid&&(n.uuid=Nr.generateUUID()),!t&&void 0===e.images[n.uuid]){var i;if(Array.isArray(n)){i=[];for(var a=0,o=n.length;a<o;a++)i.push(Ur.getDataURL(n[a]))}else i=Ur.getDataURL(n);e.images[n.uuid]={uuid:n.uuid,url:i}}r.image=n.uuid}return t||(e.textures[this.uuid]=r),r},dispose:function(){this.dispatchEvent({type:\"dispose\"})},transformUv:function(e){if(this.mapping!==ne)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 pe:e.x=e.x<0?0:1;break;case de: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 pe:e.y=e.y<0?0:1;break;case de: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}}),Object.defineProperty(zr.prototype,\"needsUpdate\",{set:function(e){!0===e&&this.version++}}),Object.defineProperties(Hr.prototype,{width:{get:function(){return this.z},set:function(e){this.z=e}},height:{get:function(){return this.w},set:function(e){this.w=e}}}),Object.assign(Hr.prototype,{isVector4:!0,set:function(e,t,r,n){return this.x=e,this.y=t,this.z=r,this.w=n,this},setScalar:function(e){return this.x=e,this.y=e,this.z=e,this.w=e,this},setX:function(e){return this.x=e,this},setY:function(e){return this.y=e,this},setZ:function(e){return this.z=e,this},setW:function(e){return this.w=e,this},setComponent: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},getComponent: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)}},clone:function(){return new this.constructor(this.x,this.y,this.z,this.w)},copy: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},add:function(e,t){return void 0!==t?(console.warn(\"THREE.Vector4: .add() now only accepts one argument. Use .addVectors( a, b ) instead.\"),this.addVectors(e,t)):(this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this)},addScalar:function(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this},addVectors: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},addScaledVector: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},sub:function(e,t){return void 0!==t?(console.warn(\"THREE.Vector4: .sub() now only accepts one argument. Use .subVectors( a, b ) instead.\"),this.subVectors(e,t)):(this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this)},subScalar:function(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this},subVectors: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},multiplyScalar:function(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this},applyMatrix4:function(e){var t=this.x,r=this.y,n=this.z,i=this.w,a=e.elements;return this.x=a[0]*t+a[4]*r+a[8]*n+a[12]*i,this.y=a[1]*t+a[5]*r+a[9]*n+a[13]*i,this.z=a[2]*t+a[6]*r+a[10]*n+a[14]*i,this.w=a[3]*t+a[7]*r+a[11]*n+a[15]*i,this},divideScalar:function(e){return this.multiplyScalar(1\/e)},setAxisAngleFromQuaternion:function(e){this.w=2*Math.acos(e.w);var t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x\/t,this.y=e.y\/t,this.z=e.z\/t),this},setAxisAngleFromRotationMatrix:function(e){var t,r,n,i,a=e.elements,o=a[0],s=a[4],c=a[8],l=a[1],h=a[5],u=a[9],p=a[2],d=a[6],f=a[10];if(Math.abs(s-l)<.01&&Math.abs(c-p)<.01&&Math.abs(u-d)<.01){if(Math.abs(s+l)<.1&&Math.abs(c+p)<.1&&Math.abs(u+d)<.1&&Math.abs(o+h+f-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;var m=(o+1)\/2,v=(h+1)\/2,g=(f+1)\/2,y=(s+l)\/4,x=(c+p)\/4,_=(u+d)\/4;return m>v&&m>g?m<.01?(r=0,n=.707106781,i=.707106781):(n=y\/(r=Math.sqrt(m)),i=x\/r):v>g?v<.01?(r=.707106781,n=0,i=.707106781):(r=y\/(n=Math.sqrt(v)),i=_\/n):g<.01?(r=.707106781,n=.707106781,i=0):(r=x\/(i=Math.sqrt(g)),n=_\/i),this.set(r,n,i,t),this}var b=Math.sqrt((d-u)*(d-u)+(c-p)*(c-p)+(l-s)*(l-s));return Math.abs(b)<.001&&(b=1),this.x=(d-u)\/b,this.y=(c-p)\/b,this.z=(l-s)\/b,this.w=Math.acos((o+h+f-1)\/2),this},min: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},max: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},clamp: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},clampScalar: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},clampLength:function(e,t){var r=this.length();return this.divideScalar(r||1).multiplyScalar(Math.max(e,Math.min(t,r)))},floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this},roundToZero:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this.w=this.w<0?Math.ceil(this.w):Math.floor(this.w),this},negate:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this},dot:function(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},manhattanLength:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)},normalize:function(){return this.divideScalar(this.length()||1)},setLength:function(e){return this.normalize().multiplyScalar(e)},lerp: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},lerpVectors:function(e,t,r){return this.subVectors(t,e).multiplyScalar(r).add(e)},equals:function(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w},fromArray:function(e,t){return void 0===t&&(t=0),this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e},fromBufferAttribute:function(e,t,r){return void 0!==r&&console.warn(\"THREE.Vector4: offset has been removed from .fromBufferAttribute().\"),this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}}),Vr.prototype=Object.assign(Object.create(Pr.prototype),{constructor:Vr,isWebGLRenderTarget:!0,setSize:function(e,t){this.width===e&&this.height===t||(this.width=e,this.height=t,this.texture.image.width=e,this.texture.image.height=t,this.dispose()),this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.width=e.width,this.height=e.height,this.viewport.copy(e.viewport),this.texture=e.texture.clone(),this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this.depthTexture=e.depthTexture,this},dispose:function(){this.dispatchEvent({type:\"dispose\"})}}),kr.prototype=Object.assign(Object.create(Vr.prototype),{constructor:kr,isWebGLMultisampleRenderTarget:!0,copy:function(e){return Vr.prototype.copy.call(this,e),this.samples=e.samples,this}}),Object.assign(jr,{slerp:function(e,t,r,n){return r.copy(e).slerp(t,n)},slerpFlat:function(e,t,r,n,i,a,o){var s=r[n+0],c=r[n+1],l=r[n+2],h=r[n+3],u=i[a+0],p=i[a+1],d=i[a+2],f=i[a+3];if(h!==f||s!==u||c!==p||l!==d){var m=1-o,v=s*u+c*p+l*d+h*f,g=v>=0?1:-1,y=1-v*v;if(y>Number.EPSILON){var x=Math.sqrt(y),_=Math.atan2(x,v*g);m=Math.sin(m*_)\/x,o=Math.sin(o*_)\/x}var b=o*g;if(s=s*m+u*b,c=c*m+p*b,l=l*m+d*b,h=h*m+f*b,m===1-o){var w=1\/Math.sqrt(s*s+c*c+l*l+h*h);s*=w,c*=w,l*=w,h*=w}}e[t]=s,e[t+1]=c,e[t+2]=l,e[t+3]=h}}),Object.defineProperties(jr.prototype,{x:{get:function(){return this._x},set:function(e){this._x=e,this._onChangeCallback()}},y:{get:function(){return this._y},set:function(e){this._y=e,this._onChangeCallback()}},z:{get:function(){return this._z},set:function(e){this._z=e,this._onChangeCallback()}},w:{get:function(){return this._w},set:function(e){this._w=e,this._onChangeCallback()}}}),Object.assign(jr.prototype,{isQuaternion:!0,set:function(e,t,r,n){return this._x=e,this._y=t,this._z=r,this._w=n,this._onChangeCallback(),this},clone:function(){return new this.constructor(this._x,this._y,this._z,this._w)},copy:function(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this},setFromEuler:function(e,t){if(!e||!e.isEuler)throw new Error(\"THREE.Quaternion: .setFromEuler() now expects an Euler rotation rather than a Vector3 and order.\");var r=e._x,n=e._y,i=e._z,a=e.order,o=Math.cos,s=Math.sin,c=o(r\/2),l=o(n\/2),h=o(i\/2),u=s(r\/2),p=s(n\/2),d=s(i\/2);return\"XYZ\"===a?(this._x=u*l*h+c*p*d,this._y=c*p*h-u*l*d,this._z=c*l*d+u*p*h,this._w=c*l*h-u*p*d):\"YXZ\"===a?(this._x=u*l*h+c*p*d,this._y=c*p*h-u*l*d,this._z=c*l*d-u*p*h,this._w=c*l*h+u*p*d):\"ZXY\"===a?(this._x=u*l*h-c*p*d,this._y=c*p*h+u*l*d,this._z=c*l*d+u*p*h,this._w=c*l*h-u*p*d):\"ZYX\"===a?(this._x=u*l*h-c*p*d,this._y=c*p*h+u*l*d,this._z=c*l*d-u*p*h,this._w=c*l*h+u*p*d):\"YZX\"===a?(this._x=u*l*h+c*p*d,this._y=c*p*h+u*l*d,this._z=c*l*d-u*p*h,this._w=c*l*h-u*p*d):\"XZY\"===a&&(this._x=u*l*h-c*p*d,this._y=c*p*h-u*l*d,this._z=c*l*d+u*p*h,this._w=c*l*h+u*p*d),!1!==t&&this._onChangeCallback(),this},setFromAxisAngle:function(e,t){var r=t\/2,n=Math.sin(r);return this._x=e.x*n,this._y=e.y*n,this._z=e.z*n,this._w=Math.cos(r),this._onChangeCallback(),this},setFromRotationMatrix:function(e){var t,r=e.elements,n=r[0],i=r[4],a=r[8],o=r[1],s=r[5],c=r[9],l=r[2],h=r[6],u=r[10],p=n+s+u;return p>0?(t=.5\/Math.sqrt(p+1),this._w=.25\/t,this._x=(h-c)*t,this._y=(a-l)*t,this._z=(o-i)*t):n>s&&n>u?(t=2*Math.sqrt(1+n-s-u),this._w=(h-c)\/t,this._x=.25*t,this._y=(i+o)\/t,this._z=(a+l)\/t):s>u?(t=2*Math.sqrt(1+s-n-u),this._w=(a-l)\/t,this._x=(i+o)\/t,this._y=.25*t,this._z=(c+h)\/t):(t=2*Math.sqrt(1+u-n-s),this._w=(o-i)\/t,this._x=(a+l)\/t,this._y=(c+h)\/t,this._z=.25*t),this._onChangeCallback(),this},setFromUnitVectors:function(e,t){var r=e.dot(t)+1;return r<1e-6?(r=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=r):(this._x=0,this._y=-e.z,this._z=e.y,this._w=r)):(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=r),this.normalize()},angleTo:function(e){return 2*Math.acos(Math.abs(Nr.clamp(this.dot(e),-1,1)))},rotateTowards:function(e,t){var r=this.angleTo(e);if(0===r)return this;var n=Math.min(1,t\/r);return this.slerp(e,n),this},inverse:function(){return this.conjugate()},conjugate:function(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this},dot:function(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w},lengthSq:function(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w},length:function(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)},normalize:function(){var 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},multiply:function(e,t){return void 0!==t?(console.warn(\"THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead.\"),this.multiplyQuaternions(e,t)):this.multiplyQuaternions(this,e)},premultiply:function(e){return this.multiplyQuaternions(e,this)},multiplyQuaternions:function(e,t){var r=e._x,n=e._y,i=e._z,a=e._w,o=t._x,s=t._y,c=t._z,l=t._w;return this._x=r*l+a*o+n*c-i*s,this._y=n*l+a*s+i*o-r*c,this._z=i*l+a*c+r*s-n*o,this._w=a*l-r*o-n*s-i*c,this._onChangeCallback(),this},slerp:function(e,t){if(0===t)return this;if(1===t)return this.copy(e);var r=this._x,n=this._y,i=this._z,a=this._w,o=a*e._w+r*e._x+n*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=r,this._y=n,this._z=i,this;var s=1-o*o;if(s<=Number.EPSILON){var c=1-t;return this._w=c*a+t*this._w,this._x=c*r+t*this._x,this._y=c*n+t*this._y,this._z=c*i+t*this._z,this.normalize(),this._onChangeCallback(),this}var l=Math.sqrt(s),h=Math.atan2(l,o),u=Math.sin((1-t)*h)\/l,p=Math.sin(t*h)\/l;return this._w=a*u+this._w*p,this._x=r*u+this._x*p,this._y=n*u+this._y*p,this._z=i*u+this._z*p,this._onChangeCallback(),this},equals:function(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w},fromArray:function(e,t){return void 0===t&&(t=0),this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e},fromBufferAttribute: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},_onChange:function(e){return this._onChangeCallback=e,this},_onChangeCallback:function(){}});var Wr=new Xr,qr=new jr;function Xr(e,t,r){this.x=e||0,this.y=t||0,this.z=r||0}Object.assign(Xr.prototype,{isVector3:!0,set:function(e,t,r){return this.x=e,this.y=t,this.z=r,this},setScalar:function(e){return this.x=e,this.y=e,this.z=e,this},setX:function(e){return this.x=e,this},setY:function(e){return this.y=e,this},setZ:function(e){return this.z=e,this},setComponent: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},getComponent: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)}},clone:function(){return new this.constructor(this.x,this.y,this.z)},copy:function(e){return this.x=e.x,this.y=e.y,this.z=e.z,this},add:function(e,t){return void 0!==t?(console.warn(\"THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead.\"),this.addVectors(e,t)):(this.x+=e.x,this.y+=e.y,this.z+=e.z,this)},addScalar:function(e){return this.x+=e,this.y+=e,this.z+=e,this},addVectors:function(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this},addScaledVector:function(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this},sub:function(e,t){return void 0!==t?(console.warn(\"THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead.\"),this.subVectors(e,t)):(this.x-=e.x,this.y-=e.y,this.z-=e.z,this)},subScalar:function(e){return this.x-=e,this.y-=e,this.z-=e,this},subVectors:function(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this},multiply:function(e,t){return void 0!==t?(console.warn(\"THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead.\"),this.multiplyVectors(e,t)):(this.x*=e.x,this.y*=e.y,this.z*=e.z,this)},multiplyScalar:function(e){return this.x*=e,this.y*=e,this.z*=e,this},multiplyVectors:function(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this},applyEuler:function(e){return e&&e.isEuler||console.error(\"THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order.\"),this.applyQuaternion(qr.setFromEuler(e))},applyAxisAngle:function(e,t){return this.applyQuaternion(qr.setFromAxisAngle(e,t))},applyMatrix3:function(e){var t=this.x,r=this.y,n=this.z,i=e.elements;return this.x=i[0]*t+i[3]*r+i[6]*n,this.y=i[1]*t+i[4]*r+i[7]*n,this.z=i[2]*t+i[5]*r+i[8]*n,this},applyNormalMatrix:function(e){return this.applyMatrix3(e).normalize()},applyMatrix4:function(e){var t=this.x,r=this.y,n=this.z,i=e.elements,a=1\/(i[3]*t+i[7]*r+i[11]*n+i[15]);return this.x=(i[0]*t+i[4]*r+i[8]*n+i[12])*a,this.y=(i[1]*t+i[5]*r+i[9]*n+i[13])*a,this.z=(i[2]*t+i[6]*r+i[10]*n+i[14])*a,this},applyQuaternion:function(e){var t=this.x,r=this.y,n=this.z,i=e.x,a=e.y,o=e.z,s=e.w,c=s*t+a*n-o*r,l=s*r+o*t-i*n,h=s*n+i*r-a*t,u=-i*t-a*r-o*n;return this.x=c*s+u*-i+l*-o-h*-a,this.y=l*s+u*-a+h*-i-c*-o,this.z=h*s+u*-o+c*-a-l*-i,this},project:function(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)},unproject:function(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)},transformDirection:function(e){var t=this.x,r=this.y,n=this.z,i=e.elements;return this.x=i[0]*t+i[4]*r+i[8]*n,this.y=i[1]*t+i[5]*r+i[9]*n,this.z=i[2]*t+i[6]*r+i[10]*n,this.normalize()},divide:function(e){return this.x\/=e.x,this.y\/=e.y,this.z\/=e.z,this},divideScalar:function(e){return this.multiplyScalar(1\/e)},min: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},max: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},clamp: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},clampScalar: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},clampLength:function(e,t){var r=this.length();return this.divideScalar(r||1).multiplyScalar(Math.max(e,Math.min(t,r)))},floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this},roundToZero:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this},negate:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this},dot:function(e){return this.x*e.x+this.y*e.y+this.z*e.z},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},manhattanLength:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)},normalize:function(){return this.divideScalar(this.length()||1)},setLength:function(e){return this.normalize().multiplyScalar(e)},lerp: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},lerpVectors:function(e,t,r){return this.subVectors(t,e).multiplyScalar(r).add(e)},cross:function(e,t){return void 0!==t?(console.warn(\"THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead.\"),this.crossVectors(e,t)):this.crossVectors(this,e)},crossVectors:function(e,t){var r=e.x,n=e.y,i=e.z,a=t.x,o=t.y,s=t.z;return this.x=n*s-i*o,this.y=i*a-r*s,this.z=r*o-n*a,this},projectOnVector:function(e){var t=e.lengthSq();if(0===t)return this.set(0,0,0);var r=e.dot(this)\/t;return this.copy(e).multiplyScalar(r)},projectOnPlane:function(e){return Wr.copy(this).projectOnVector(e),this.sub(Wr)},reflect:function(e){return this.sub(Wr.copy(e).multiplyScalar(2*this.dot(e)))},angleTo:function(e){var t=Math.sqrt(this.lengthSq()*e.lengthSq());if(0===t)return Math.PI\/2;var r=this.dot(e)\/t;return Math.acos(Nr.clamp(r,-1,1))},distanceTo:function(e){return Math.sqrt(this.distanceToSquared(e))},distanceToSquared:function(e){var t=this.x-e.x,r=this.y-e.y,n=this.z-e.z;return t*t+r*r+n*n},manhattanDistanceTo:function(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)},setFromSpherical:function(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)},setFromSphericalCoords:function(e,t,r){var n=Math.sin(t)*e;return this.x=n*Math.sin(r),this.y=Math.cos(t)*e,this.z=n*Math.cos(r),this},setFromCylindrical:function(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)},setFromCylindricalCoords:function(e,t,r){return this.x=e*Math.sin(t),this.y=r,this.z=e*Math.cos(t),this},setFromMatrixPosition:function(e){var t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this},setFromMatrixScale:function(e){var t=this.setFromMatrixColumn(e,0).length(),r=this.setFromMatrixColumn(e,1).length(),n=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=r,this.z=n,this},setFromMatrixColumn:function(e,t){return this.fromArray(e.elements,4*t)},setFromMatrix3Column:function(e,t){return this.fromArray(e.elements,3*t)},equals:function(e){return e.x===this.x&&e.y===this.y&&e.z===this.z},fromArray:function(e,t){return void 0===t&&(t=0),this.x=e[t],this.y=e[t+1],this.z=e[t+2],this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e},fromBufferAttribute:function(e,t,r){return void 0!==r&&console.warn(\"THREE.Vector3: offset has been removed from .fromBufferAttribute().\"),this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}});var Yr=new Xr,Zr=new tn,Jr=new Xr(0,0,0),Qr=new Xr(1,1,1),Kr=new Xr,$r=new Xr,en=new Xr;function tn(){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],arguments.length>0&&console.error(\"THREE.Matrix4: the constructor no longer reads arguments. use .set() instead.\")}Object.assign(tn.prototype,{isMatrix4:!0,set:function(e,t,r,n,i,a,o,s,c,l,h,u,p,d,f,m){var v=this.elements;return v[0]=e,v[4]=t,v[8]=r,v[12]=n,v[1]=i,v[5]=a,v[9]=o,v[13]=s,v[2]=c,v[6]=l,v[10]=h,v[14]=u,v[3]=p,v[7]=d,v[11]=f,v[15]=m,this},identity:function(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this},clone:function(){return(new tn).fromArray(this.elements)},copy:function(e){var t=this.elements,r=e.elements;return t[0]=r[0],t[1]=r[1],t[2]=r[2],t[3]=r[3],t[4]=r[4],t[5]=r[5],t[6]=r[6],t[7]=r[7],t[8]=r[8],t[9]=r[9],t[10]=r[10],t[11]=r[11],t[12]=r[12],t[13]=r[13],t[14]=r[14],t[15]=r[15],this},copyPosition:function(e){var t=this.elements,r=e.elements;return t[12]=r[12],t[13]=r[13],t[14]=r[14],this},extractBasis:function(e,t,r){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),r.setFromMatrixColumn(this,2),this},makeBasis:function(e,t,r){return this.set(e.x,t.x,r.x,0,e.y,t.y,r.y,0,e.z,t.z,r.z,0,0,0,0,1),this},extractRotation:function(e){var t=this.elements,r=e.elements,n=1\/Yr.setFromMatrixColumn(e,0).length(),i=1\/Yr.setFromMatrixColumn(e,1).length(),a=1\/Yr.setFromMatrixColumn(e,2).length();return t[0]=r[0]*n,t[1]=r[1]*n,t[2]=r[2]*n,t[3]=0,t[4]=r[4]*i,t[5]=r[5]*i,t[6]=r[6]*i,t[7]=0,t[8]=r[8]*a,t[9]=r[9]*a,t[10]=r[10]*a,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this},makeRotationFromEuler:function(e){e&&e.isEuler||console.error(\"THREE.Matrix4: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.\");var t=this.elements,r=e.x,n=e.y,i=e.z,a=Math.cos(r),o=Math.sin(r),s=Math.cos(n),c=Math.sin(n),l=Math.cos(i),h=Math.sin(i);if(\"XYZ\"===e.order){var u=a*l,p=a*h,d=o*l,f=o*h;t[0]=s*l,t[4]=-s*h,t[8]=c,t[1]=p+d*c,t[5]=u-f*c,t[9]=-o*s,t[2]=f-u*c,t[6]=d+p*c,t[10]=a*s}else if(\"YXZ\"===e.order){var m=s*l,v=s*h,g=c*l,y=c*h;t[0]=m+y*o,t[4]=g*o-v,t[8]=a*c,t[1]=a*h,t[5]=a*l,t[9]=-o,t[2]=v*o-g,t[6]=y+m*o,t[10]=a*s}else if(\"ZXY\"===e.order){m=s*l,v=s*h,g=c*l,y=c*h;t[0]=m-y*o,t[4]=-a*h,t[8]=g+v*o,t[1]=v+g*o,t[5]=a*l,t[9]=y-m*o,t[2]=-a*c,t[6]=o,t[10]=a*s}else if(\"ZYX\"===e.order){u=a*l,p=a*h,d=o*l,f=o*h;t[0]=s*l,t[4]=d*c-p,t[8]=u*c+f,t[1]=s*h,t[5]=f*c+u,t[9]=p*c-d,t[2]=-c,t[6]=o*s,t[10]=a*s}else if(\"YZX\"===e.order){var x=a*s,_=a*c,b=o*s,w=o*c;t[0]=s*l,t[4]=w-x*h,t[8]=b*h+_,t[1]=h,t[5]=a*l,t[9]=-o*l,t[2]=-c*l,t[6]=_*h+b,t[10]=x-w*h}else if(\"XZY\"===e.order){x=a*s,_=a*c,b=o*s,w=o*c;t[0]=s*l,t[4]=-h,t[8]=c*l,t[1]=x*h+w,t[5]=a*l,t[9]=_*h-b,t[2]=b*h-_,t[6]=o*l,t[10]=w*h+x}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this},makeRotationFromQuaternion:function(e){return this.compose(Jr,e,Qr)},lookAt:function(e,t,r){var n=this.elements;return en.subVectors(e,t),0===en.lengthSq()&&(en.z=1),en.normalize(),Kr.crossVectors(r,en),0===Kr.lengthSq()&&(1===Math.abs(r.z)?en.x+=1e-4:en.z+=1e-4,en.normalize(),Kr.crossVectors(r,en)),Kr.normalize(),$r.crossVectors(en,Kr),n[0]=Kr.x,n[4]=$r.x,n[8]=en.x,n[1]=Kr.y,n[5]=$r.y,n[9]=en.y,n[2]=Kr.z,n[6]=$r.z,n[10]=en.z,this},multiply:function(e,t){return void 0!==t?(console.warn(\"THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead.\"),this.multiplyMatrices(e,t)):this.multiplyMatrices(this,e)},premultiply:function(e){return this.multiplyMatrices(e,this)},multiplyMatrices:function(e,t){var r=e.elements,n=t.elements,i=this.elements,a=r[0],o=r[4],s=r[8],c=r[12],l=r[1],h=r[5],u=r[9],p=r[13],d=r[2],f=r[6],m=r[10],v=r[14],g=r[3],y=r[7],x=r[11],_=r[15],b=n[0],w=n[4],M=n[8],S=n[12],T=n[1],E=n[5],A=n[9],L=n[13],R=n[2],C=n[6],P=n[10],O=n[14],D=n[3],I=n[7],N=n[11],B=n[15];return i[0]=a*b+o*T+s*R+c*D,i[4]=a*w+o*E+s*C+c*I,i[8]=a*M+o*A+s*P+c*N,i[12]=a*S+o*L+s*O+c*B,i[1]=l*b+h*T+u*R+p*D,i[5]=l*w+h*E+u*C+p*I,i[9]=l*M+h*A+u*P+p*N,i[13]=l*S+h*L+u*O+p*B,i[2]=d*b+f*T+m*R+v*D,i[6]=d*w+f*E+m*C+v*I,i[10]=d*M+f*A+m*P+v*N,i[14]=d*S+f*L+m*O+v*B,i[3]=g*b+y*T+x*R+_*D,i[7]=g*w+y*E+x*C+_*I,i[11]=g*M+y*A+x*P+_*N,i[15]=g*S+y*L+x*O+_*B,this},multiplyScalar:function(e){var t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this},determinant:function(){var e=this.elements,t=e[0],r=e[4],n=e[8],i=e[12],a=e[1],o=e[5],s=e[9],c=e[13],l=e[2],h=e[6],u=e[10],p=e[14];return e[3]*(+i*s*h-n*c*h-i*o*u+r*c*u+n*o*p-r*s*p)+e[7]*(+t*s*p-t*c*u+i*a*u-n*a*p+n*c*l-i*s*l)+e[11]*(+t*c*h-t*o*p-i*a*h+r*a*p+i*o*l-r*c*l)+e[15]*(-n*o*l-t*s*h+t*o*u+n*a*h-r*a*u+r*s*l)},transpose: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},setPosition:function(e,t,r){var n=this.elements;return e.isVector3?(n[12]=e.x,n[13]=e.y,n[14]=e.z):(n[12]=e,n[13]=t,n[14]=r),this},getInverse:function(e,t){void 0!==t&&console.warn(\"THREE.Matrix4: .getInverse() can no longer be configured to throw on degenerate.\");var r=this.elements,n=e.elements,i=n[0],a=n[1],o=n[2],s=n[3],c=n[4],l=n[5],h=n[6],u=n[7],p=n[8],d=n[9],f=n[10],m=n[11],v=n[12],g=n[13],y=n[14],x=n[15],_=d*y*u-g*f*u+g*h*m-l*y*m-d*h*x+l*f*x,b=v*f*u-p*y*u-v*h*m+c*y*m+p*h*x-c*f*x,w=p*g*u-v*d*u+v*l*m-c*g*m-p*l*x+c*d*x,M=v*d*h-p*g*h-v*l*f+c*g*f+p*l*y-c*d*y,S=i*_+a*b+o*w+s*M;if(0===S)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);var T=1\/S;return r[0]=_*T,r[1]=(g*f*s-d*y*s-g*o*m+a*y*m+d*o*x-a*f*x)*T,r[2]=(l*y*s-g*h*s+g*o*u-a*y*u-l*o*x+a*h*x)*T,r[3]=(d*h*s-l*f*s-d*o*u+a*f*u+l*o*m-a*h*m)*T,r[4]=b*T,r[5]=(p*y*s-v*f*s+v*o*m-i*y*m-p*o*x+i*f*x)*T,r[6]=(v*h*s-c*y*s-v*o*u+i*y*u+c*o*x-i*h*x)*T,r[7]=(c*f*s-p*h*s+p*o*u-i*f*u-c*o*m+i*h*m)*T,r[8]=w*T,r[9]=(v*d*s-p*g*s-v*a*m+i*g*m+p*a*x-i*d*x)*T,r[10]=(c*g*s-v*l*s+v*a*u-i*g*u-c*a*x+i*l*x)*T,r[11]=(p*l*s-c*d*s-p*a*u+i*d*u+c*a*m-i*l*m)*T,r[12]=M*T,r[13]=(p*g*o-v*d*o+v*a*f-i*g*f-p*a*y+i*d*y)*T,r[14]=(v*l*o-c*g*o-v*a*h+i*g*h+c*a*y-i*l*y)*T,r[15]=(c*d*o-p*l*o+p*a*h-i*d*h-c*a*f+i*l*f)*T,this},scale:function(e){var t=this.elements,r=e.x,n=e.y,i=e.z;return t[0]*=r,t[4]*=n,t[8]*=i,t[1]*=r,t[5]*=n,t[9]*=i,t[2]*=r,t[6]*=n,t[10]*=i,t[3]*=r,t[7]*=n,t[11]*=i,this},getMaxScaleOnAxis:function(){var e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],r=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],n=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,r,n))},makeTranslation:function(e,t,r){return this.set(1,0,0,e,0,1,0,t,0,0,1,r,0,0,0,1),this},makeRotationX:function(e){var t=Math.cos(e),r=Math.sin(e);return this.set(1,0,0,0,0,t,-r,0,0,r,t,0,0,0,0,1),this},makeRotationY:function(e){var t=Math.cos(e),r=Math.sin(e);return this.set(t,0,r,0,0,1,0,0,-r,0,t,0,0,0,0,1),this},makeRotationZ:function(e){var t=Math.cos(e),r=Math.sin(e);return this.set(t,-r,0,0,r,t,0,0,0,0,1,0,0,0,0,1),this},makeRotationAxis:function(e,t){var r=Math.cos(t),n=Math.sin(t),i=1-r,a=e.x,o=e.y,s=e.z,c=i*a,l=i*o;return this.set(c*a+r,c*o-n*s,c*s+n*o,0,c*o+n*s,l*o+r,l*s-n*a,0,c*s-n*o,l*s+n*a,i*s*s+r,0,0,0,0,1),this},makeScale:function(e,t,r){return this.set(e,0,0,0,0,t,0,0,0,0,r,0,0,0,0,1),this},makeShear:function(e,t,r){return this.set(1,t,r,0,e,1,r,0,e,t,1,0,0,0,0,1),this},compose:function(e,t,r){var n=this.elements,i=t._x,a=t._y,o=t._z,s=t._w,c=i+i,l=a+a,h=o+o,u=i*c,p=i*l,d=i*h,f=a*l,m=a*h,v=o*h,g=s*c,y=s*l,x=s*h,_=r.x,b=r.y,w=r.z;return n[0]=(1-(f+v))*_,n[1]=(p+x)*_,n[2]=(d-y)*_,n[3]=0,n[4]=(p-x)*b,n[5]=(1-(u+v))*b,n[6]=(m+g)*b,n[7]=0,n[8]=(d+y)*w,n[9]=(m-g)*w,n[10]=(1-(u+f))*w,n[11]=0,n[12]=e.x,n[13]=e.y,n[14]=e.z,n[15]=1,this},decompose:function(e,t,r){var n=this.elements,i=Yr.set(n[0],n[1],n[2]).length(),a=Yr.set(n[4],n[5],n[6]).length(),o=Yr.set(n[8],n[9],n[10]).length();this.determinant()<0&&(i=-i),e.x=n[12],e.y=n[13],e.z=n[14],Zr.copy(this);var s=1\/i,c=1\/a,l=1\/o;return Zr.elements[0]*=s,Zr.elements[1]*=s,Zr.elements[2]*=s,Zr.elements[4]*=c,Zr.elements[5]*=c,Zr.elements[6]*=c,Zr.elements[8]*=l,Zr.elements[9]*=l,Zr.elements[10]*=l,t.setFromRotationMatrix(Zr),r.x=i,r.y=a,r.z=o,this},makePerspective:function(e,t,r,n,i,a){void 0===a&&console.warn(\"THREE.Matrix4: .makePerspective() has been redefined and has a new signature. Please check the docs.\");var o=this.elements,s=2*i\/(t-e),c=2*i\/(r-n),l=(t+e)\/(t-e),h=(r+n)\/(r-n),u=-(a+i)\/(a-i),p=-2*a*i\/(a-i);return o[0]=s,o[4]=0,o[8]=l,o[12]=0,o[1]=0,o[5]=c,o[9]=h,o[13]=0,o[2]=0,o[6]=0,o[10]=u,o[14]=p,o[3]=0,o[7]=0,o[11]=-1,o[15]=0,this},makeOrthographic:function(e,t,r,n,i,a){var o=this.elements,s=1\/(t-e),c=1\/(r-n),l=1\/(a-i),h=(t+e)*s,u=(r+n)*c,p=(a+i)*l;return o[0]=2*s,o[4]=0,o[8]=0,o[12]=-h,o[1]=0,o[5]=2*c,o[9]=0,o[13]=-u,o[2]=0,o[6]=0,o[10]=-2*l,o[14]=-p,o[3]=0,o[7]=0,o[11]=0,o[15]=1,this},equals:function(e){for(var t=this.elements,r=e.elements,n=0;n<16;n++)if(t[n]!==r[n])return!1;return!0},fromArray:function(e,t){void 0===t&&(t=0);for(var r=0;r<16;r++)this.elements[r]=e[r+t];return this},toArray:function(e,t){void 0===e&&(e=[]),void 0===t&&(t=0);var r=this.elements;return e[t]=r[0],e[t+1]=r[1],e[t+2]=r[2],e[t+3]=r[3],e[t+4]=r[4],e[t+5]=r[5],e[t+6]=r[6],e[t+7]=r[7],e[t+8]=r[8],e[t+9]=r[9],e[t+10]=r[10],e[t+11]=r[11],e[t+12]=r[12],e[t+13]=r[13],e[t+14]=r[14],e[t+15]=r[15],e}});var rn=new tn,nn=new jr;function an(e,t,r,n){this._x=e||0,this._y=t||0,this._z=r||0,this._order=n||an.DefaultOrder}function on(){this.mask=1}an.RotationOrders=[\"XYZ\",\"YZX\",\"ZXY\",\"XZY\",\"YXZ\",\"ZYX\"],an.DefaultOrder=\"XYZ\",Object.defineProperties(an.prototype,{x:{get:function(){return this._x},set:function(e){this._x=e,this._onChangeCallback()}},y:{get:function(){return this._y},set:function(e){this._y=e,this._onChangeCallback()}},z:{get:function(){return this._z},set:function(e){this._z=e,this._onChangeCallback()}},order:{get:function(){return this._order},set:function(e){this._order=e,this._onChangeCallback()}}}),Object.assign(an.prototype,{isEuler:!0,set:function(e,t,r,n){return this._x=e,this._y=t,this._z=r,this._order=n||this._order,this._onChangeCallback(),this},clone:function(){return new this.constructor(this._x,this._y,this._z,this._order)},copy:function(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this},setFromRotationMatrix:function(e,t,r){var n=Nr.clamp,i=e.elements,a=i[0],o=i[4],s=i[8],c=i[1],l=i[5],h=i[9],u=i[2],p=i[6],d=i[10];return\"XYZ\"===(t=t||this._order)?(this._y=Math.asin(n(s,-1,1)),Math.abs(s)<.9999999?(this._x=Math.atan2(-h,d),this._z=Math.atan2(-o,a)):(this._x=Math.atan2(p,l),this._z=0)):\"YXZ\"===t?(this._x=Math.asin(-n(h,-1,1)),Math.abs(h)<.9999999?(this._y=Math.atan2(s,d),this._z=Math.atan2(c,l)):(this._y=Math.atan2(-u,a),this._z=0)):\"ZXY\"===t?(this._x=Math.asin(n(p,-1,1)),Math.abs(p)<.9999999?(this._y=Math.atan2(-u,d),this._z=Math.atan2(-o,l)):(this._y=0,this._z=Math.atan2(c,a))):\"ZYX\"===t?(this._y=Math.asin(-n(u,-1,1)),Math.abs(u)<.9999999?(this._x=Math.atan2(p,d),this._z=Math.atan2(c,a)):(this._x=0,this._z=Math.atan2(-o,l))):\"YZX\"===t?(this._z=Math.asin(n(c,-1,1)),Math.abs(c)<.9999999?(this._x=Math.atan2(-h,l),this._y=Math.atan2(-u,a)):(this._x=0,this._y=Math.atan2(s,d))):\"XZY\"===t?(this._z=Math.asin(-n(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(p,l),this._y=Math.atan2(s,a)):(this._x=Math.atan2(-h,d),this._y=0)):console.warn(\"THREE.Euler: .setFromRotationMatrix() given unsupported order: \"+t),this._order=t,!1!==r&&this._onChangeCallback(),this},setFromQuaternion:function(e,t,r){return rn.makeRotationFromQuaternion(e),this.setFromRotationMatrix(rn,t,r)},setFromVector3:function(e,t){return this.set(e.x,e.y,e.z,t||this._order)},reorder:function(e){return nn.setFromEuler(this),this.setFromQuaternion(nn,e)},equals:function(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order},fromArray: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},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e},toVector3:function(e){return e?e.set(this._x,this._y,this._z):new Xr(this._x,this._y,this._z)},_onChange:function(e){return this._onChangeCallback=e,this},_onChangeCallback:function(){}}),Object.assign(on.prototype,{set:function(e){this.mask=1<<e|0},enable:function(e){this.mask|=1<<e|0},enableAll:function(){this.mask=-1},toggle:function(e){this.mask^=1<<e|0},disable:function(e){this.mask&=~(1<<e|0)},disableAll:function(){this.mask=0},test:function(e){return 0!=(this.mask&e.mask)}});var sn=0,cn=new Xr,ln=new jr,hn=new tn,un=new Xr,pn=new Xr,dn=new Xr,fn=new jr,mn=new Xr(1,0,0),vn=new Xr(0,1,0),gn=new Xr(0,0,1),yn={type:\"added\"},xn={type:\"removed\"};function _n(){Object.defineProperty(this,\"id\",{value:sn++}),this.uuid=Nr.generateUUID(),this.name=\"\",this.type=\"Object3D\",this.parent=null,this.children=[],this.up=_n.DefaultUp.clone();var e=new Xr,t=new an,r=new jr,n=new Xr(1,1,1);t._onChange(function(){r.setFromEuler(t,!1)}),r._onChange(function(){t.setFromQuaternion(r,void 0,!1)}),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:e},rotation:{configurable:!0,enumerable:!0,value:t},quaternion:{configurable:!0,enumerable:!0,value:r},scale:{configurable:!0,enumerable:!0,value:n},modelViewMatrix:{value:new tn},normalMatrix:{value:new Fr}}),this.matrix=new tn,this.matrixWorld=new tn,this.matrixAutoUpdate=_n.DefaultMatrixAutoUpdate,this.matrixWorldNeedsUpdate=!1,this.layers=new on,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.userData={}}function bn(){_n.call(this),this.type=\"Scene\",this.background=null,this.environment=null,this.fog=null,this.overrideMaterial=null,this.autoUpdate=!0,\"undefined\"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent(\"observe\",{detail:this}))}_n.DefaultUp=new Xr(0,1,0),_n.DefaultMatrixAutoUpdate=!0,_n.prototype=Object.assign(Object.create(Pr.prototype),{constructor:_n,isObject3D:!0,onBeforeRender:function(){},onAfterRender:function(){},applyMatrix4:function(e){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(e),this.matrix.decompose(this.position,this.quaternion,this.scale)},applyQuaternion:function(e){return this.quaternion.premultiply(e),this},setRotationFromAxisAngle:function(e,t){this.quaternion.setFromAxisAngle(e,t)},setRotationFromEuler:function(e){this.quaternion.setFromEuler(e,!0)},setRotationFromMatrix:function(e){this.quaternion.setFromRotationMatrix(e)},setRotationFromQuaternion:function(e){this.quaternion.copy(e)},rotateOnAxis:function(e,t){return ln.setFromAxisAngle(e,t),this.quaternion.multiply(ln),this},rotateOnWorldAxis:function(e,t){return ln.setFromAxisAngle(e,t),this.quaternion.premultiply(ln),this},rotateX:function(e){return this.rotateOnAxis(mn,e)},rotateY:function(e){return this.rotateOnAxis(vn,e)},rotateZ:function(e){return this.rotateOnAxis(gn,e)},translateOnAxis:function(e,t){return cn.copy(e).applyQuaternion(this.quaternion),this.position.add(cn.multiplyScalar(t)),this},translateX:function(e){return this.translateOnAxis(mn,e)},translateY:function(e){return this.translateOnAxis(vn,e)},translateZ:function(e){return this.translateOnAxis(gn,e)},localToWorld:function(e){return e.applyMatrix4(this.matrixWorld)},worldToLocal:function(e){return e.applyMatrix4(hn.getInverse(this.matrixWorld))},lookAt:function(e,t,r){e.isVector3?un.copy(e):un.set(e,t,r);var n=this.parent;this.updateWorldMatrix(!0,!1),pn.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?hn.lookAt(pn,un,this.up):hn.lookAt(un,pn,this.up),this.quaternion.setFromRotationMatrix(hn),n&&(hn.extractRotation(n.matrixWorld),ln.setFromRotationMatrix(hn),this.quaternion.premultiply(ln.inverse()))},add: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(yn)):console.error(\"THREE.Object3D.add: object not an instance of THREE.Object3D.\",e),this)},remove:function(e){if(arguments.length>1){for(var t=0;t<arguments.length;t++)this.remove(arguments[t]);return this}var r=this.children.indexOf(e);return-1!==r&&(e.parent=null,this.children.splice(r,1),e.dispatchEvent(xn)),this},attach:function(e){return this.updateWorldMatrix(!0,!1),hn.getInverse(this.matrixWorld),null!==e.parent&&(e.parent.updateWorldMatrix(!0,!1),hn.multiply(e.parent.matrixWorld)),e.applyMatrix4(hn),e.updateWorldMatrix(!1,!1),this.add(e),this},getObjectById:function(e){return this.getObjectByProperty(\"id\",e)},getObjectByName:function(e){return this.getObjectByProperty(\"name\",e)},getObjectByProperty:function(e,t){if(this[e]===t)return this;for(var r=0,n=this.children.length;r<n;r++){var i=this.children[r].getObjectByProperty(e,t);if(void 0!==i)return i}},getWorldPosition:function(e){return void 0===e&&(console.warn(\"THREE.Object3D: .getWorldPosition() target is now required\"),e=new Xr),this.updateMatrixWorld(!0),e.setFromMatrixPosition(this.matrixWorld)},getWorldQuaternion:function(e){return void 0===e&&(console.warn(\"THREE.Object3D: .getWorldQuaternion() target is now required\"),e=new jr),this.updateMatrixWorld(!0),this.matrixWorld.decompose(pn,e,dn),e},getWorldScale:function(e){return void 0===e&&(console.warn(\"THREE.Object3D: .getWorldScale() target is now required\"),e=new Xr),this.updateMatrixWorld(!0),this.matrixWorld.decompose(pn,fn,e),e},getWorldDirection:function(e){void 0===e&&(console.warn(\"THREE.Object3D: .getWorldDirection() target is now required\"),e=new Xr),this.updateMatrixWorld(!0);var t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()},raycast:function(){},traverse:function(e){e(this);for(var t=this.children,r=0,n=t.length;r<n;r++)t[r].traverse(e)},traverseVisible:function(e){if(!1!==this.visible){e(this);for(var t=this.children,r=0,n=t.length;r<n;r++)t[r].traverseVisible(e)}},traverseAncestors:function(e){var t=this.parent;null!==t&&(e(t),t.traverseAncestors(e))},updateMatrix:function(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0},updateMatrixWorld: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,r=0,n=t.length;r<n;r++)t[r].updateMatrixWorld(e)},updateWorldMatrix:function(e,t){var r=this.parent;if(!0===e&&null!==r&&r.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 n=this.children,i=0,a=n.length;i<a;i++)n[i].updateWorldMatrix(!1,!0)},toJSON:function(e){var t=void 0===e||\"string\"==typeof e,r={};t&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{}},r.metadata={version:4.5,type:\"Object\",generator:\"Object3D.toJSON\"});var n={};function i(t,r){return void 0===t[r.uuid]&&(t[r.uuid]=r.toJSON(e)),r.uuid}if(n.uuid=this.uuid,n.type=this.type,\"\"!==this.name&&(n.name=this.name),!0===this.castShadow&&(n.castShadow=!0),!0===this.receiveShadow&&(n.receiveShadow=!0),!1===this.visible&&(n.visible=!1),!1===this.frustumCulled&&(n.frustumCulled=!1),0!==this.renderOrder&&(n.renderOrder=this.renderOrder),\"{}\"!==JSON.stringify(this.userData)&&(n.userData=this.userData),n.layers=this.layers.mask,n.matrix=this.matrix.toArray(),!1===this.matrixAutoUpdate&&(n.matrixAutoUpdate=!1),this.isInstancedMesh&&(n.type=\"InstancedMesh\",n.count=this.count,n.instanceMatrix=this.instanceMatrix.toJSON()),this.isMesh||this.isLine||this.isPoints){n.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,c=o.length;s<c;s++){var l=o[s];i(e.shapes,l)}else i(e.shapes,o)}}if(void 0!==this.material)if(Array.isArray(this.material)){var h=[];for(s=0,c=this.material.length;s<c;s++)h.push(i(e.materials,this.material[s]));n.material=h}else n.material=i(e.materials,this.material);if(this.children.length>0){n.children=[];for(s=0;s<this.children.length;s++)n.children.push(this.children[s].toJSON(e).object)}if(t){var u=m(e.geometries),p=m(e.materials),d=m(e.textures),f=m(e.images);o=m(e.shapes);u.length>0&&(r.geometries=u),p.length>0&&(r.materials=p),d.length>0&&(r.textures=d),f.length>0&&(r.images=f),o.length>0&&(r.shapes=o)}return r.object=n,r;function m(e){var t=[];for(var r in e){var n=e[r];delete n.metadata,t.push(n)}return t}},clone:function(e){return(new this.constructor).copy(this,e)},copy:function(e,t){if(void 0===t&&(t=!0),this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),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.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.userData=JSON.parse(JSON.stringify(e.userData)),!0===t)for(var r=0;r<e.children.length;r++){var n=e.children[r];this.add(n.clone())}return this}}),bn.prototype=Object.assign(Object.create(_n.prototype),{constructor:bn,isScene:!0,copy:function(e,t){return _n.prototype.copy.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()),null!==e.overrideMaterial&&(this.overrideMaterial=e.overrideMaterial.clone()),this.autoUpdate=e.autoUpdate,this.matrixAutoUpdate=e.matrixAutoUpdate,this},toJSON:function(e){var t=_n.prototype.toJSON.call(this,e);return null!==this.background&&(t.object.background=this.background.toJSON(e)),null!==this.environment&&(t.object.environment=this.environment.toJSON(e)),null!==this.fog&&(t.object.fog=this.fog.toJSON()),t},dispose:function(){this.dispatchEvent({type:\"dispose\"})}});var wn=[new Xr,new Xr,new Xr,new Xr,new Xr,new Xr,new Xr,new Xr],Mn=new Xr,Sn=new Nn,Tn=new Xr,En=new Xr,An=new Xr,Ln=new Xr,Rn=new Xr,Cn=new Xr,Pn=new Xr,On=new Xr,Dn=new Xr,In=new Xr;function Nn(e,t){this.min=void 0!==e?e:new Xr(1\/0,1\/0,1\/0),this.max=void 0!==t?t:new Xr(-1\/0,-1\/0,-1\/0)}function Bn(e,t,r,n,i){var a,o;for(a=0,o=e.length-3;a<=o;a+=3){In.fromArray(e,a);var s=i.x*Math.abs(In.x)+i.y*Math.abs(In.y)+i.z*Math.abs(In.z),c=t.dot(In),l=r.dot(In),h=n.dot(In);if(Math.max(-Math.max(c,l,h),Math.min(c,l,h))>s)return!1}return!0}Object.assign(Nn.prototype,{isBox3:!0,set:function(e,t){return this.min.copy(e),this.max.copy(t),this},setFromArray:function(e){for(var t=1\/0,r=1\/0,n=1\/0,i=-1\/0,a=-1\/0,o=-1\/0,s=0,c=e.length;s<c;s+=3){var l=e[s],h=e[s+1],u=e[s+2];l<t&&(t=l),h<r&&(r=h),u<n&&(n=u),l>i&&(i=l),h>a&&(a=h),u>o&&(o=u)}return this.min.set(t,r,n),this.max.set(i,a,o),this},setFromBufferAttribute:function(e){for(var t=1\/0,r=1\/0,n=1\/0,i=-1\/0,a=-1\/0,o=-1\/0,s=0,c=e.count;s<c;s++){var l=e.getX(s),h=e.getY(s),u=e.getZ(s);l<t&&(t=l),h<r&&(r=h),u<n&&(n=u),l>i&&(i=l),h>a&&(a=h),u>o&&(o=u)}return this.min.set(t,r,n),this.max.set(i,a,o),this},setFromPoints:function(e){this.makeEmpty();for(var t=0,r=e.length;t<r;t++)this.expandByPoint(e[t]);return this},setFromCenterAndSize:function(e,t){var r=Mn.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(r),this.max.copy(e).add(r),this},setFromObject:function(e){return this.makeEmpty(),this.expandByObject(e)},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.min.copy(e.min),this.max.copy(e.max),this},makeEmpty:function(){return this.min.x=this.min.y=this.min.z=1\/0,this.max.x=this.max.y=this.max.z=-1\/0,this},isEmpty:function(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z},getCenter:function(e){return void 0===e&&(console.warn(\"THREE.Box3: .getCenter() target is now required\"),e=new Xr),this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)},getSize:function(e){return void 0===e&&(console.warn(\"THREE.Box3: .getSize() target is now required\"),e=new Xr),this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)},expandByPoint:function(e){return this.min.min(e),this.max.max(e),this},expandByVector:function(e){return this.min.sub(e),this.max.add(e),this},expandByScalar:function(e){return this.min.addScalar(-e),this.max.addScalar(e),this},expandByObject:function(e){e.updateWorldMatrix(!1,!1);var t=e.geometry;void 0!==t&&(null===t.boundingBox&&t.computeBoundingBox(),Sn.copy(t.boundingBox),Sn.applyMatrix4(e.matrixWorld),this.union(Sn));for(var r=e.children,n=0,i=r.length;n<i;n++)this.expandByObject(r[n]);return this},containsPoint: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)},containsBox: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},getParameter:function(e,t){return void 0===t&&(console.warn(\"THREE.Box3: .getParameter() target is now required\"),t=new Xr),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))},intersectsBox: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)},intersectsSphere:function(e){return this.clampPoint(e.center,Mn),Mn.distanceToSquared(e.center)<=e.radius*e.radius},intersectsPlane:function(e){var t,r;return e.normal.x>0?(t=e.normal.x*this.min.x,r=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,r=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,r+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,r+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,r+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,r+=e.normal.z*this.min.z),t<=-e.constant&&r>=-e.constant},intersectsTriangle:function(e){if(this.isEmpty())return!1;this.getCenter(Pn),On.subVectors(this.max,Pn),Tn.subVectors(e.a,Pn),En.subVectors(e.b,Pn),An.subVectors(e.c,Pn),Ln.subVectors(En,Tn),Rn.subVectors(An,En),Cn.subVectors(Tn,An);var t=[0,-Ln.z,Ln.y,0,-Rn.z,Rn.y,0,-Cn.z,Cn.y,Ln.z,0,-Ln.x,Rn.z,0,-Rn.x,Cn.z,0,-Cn.x,-Ln.y,Ln.x,0,-Rn.y,Rn.x,0,-Cn.y,Cn.x,0];return!!Bn(t,Tn,En,An,On)&&(!!Bn(t=[1,0,0,0,1,0,0,0,1],Tn,En,An,On)&&(Dn.crossVectors(Ln,Rn),Bn(t=[Dn.x,Dn.y,Dn.z],Tn,En,An,On)))},clampPoint:function(e,t){return void 0===t&&(console.warn(\"THREE.Box3: .clampPoint() target is now required\"),t=new Xr),t.copy(e).clamp(this.min,this.max)},distanceToPoint:function(e){return Mn.copy(e).clamp(this.min,this.max).sub(e).length()},getBoundingSphere:function(e){return void 0===e&&console.error(\"THREE.Box3: .getBoundingSphere() target is now required\"),this.getCenter(e.center),e.radius=.5*this.getSize(Mn).length(),e},intersect:function(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this},union:function(e){return this.min.min(e.min),this.max.max(e.max),this},applyMatrix4:function(e){return this.isEmpty()?this:(wn[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),wn[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),wn[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),wn[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),wn[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),wn[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),wn[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),wn[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(wn),this)},translate:function(e){return this.min.add(e),this.max.add(e),this},equals:function(e){return e.min.equals(this.min)&&e.max.equals(this.max)}});var Fn=new Nn;function Un(e,t){this.center=void 0!==e?e:new Xr,this.radius=void 0!==t?t:0}Object.assign(Un.prototype,{set:function(e,t){return this.center.copy(e),this.radius=t,this},setFromPoints:function(e,t){var r=this.center;void 0!==t?r.copy(t):Fn.setFromPoints(e).getCenter(r);for(var n=0,i=0,a=e.length;i<a;i++)n=Math.max(n,r.distanceToSquared(e[i]));return this.radius=Math.sqrt(n),this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.center.copy(e.center),this.radius=e.radius,this},empty:function(){return this.radius<=0},containsPoint:function(e){return e.distanceToSquared(this.center)<=this.radius*this.radius},distanceToPoint:function(e){return e.distanceTo(this.center)-this.radius},intersectsSphere:function(e){var t=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=t*t},intersectsBox:function(e){return e.intersectsSphere(this)},intersectsPlane:function(e){return Math.abs(e.distanceToPoint(this.center))<=this.radius},clampPoint:function(e,t){var r=this.center.distanceToSquared(e);return void 0===t&&(console.warn(\"THREE.Sphere: .clampPoint() target is now required\"),t=new Xr),t.copy(e),r>this.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t},getBoundingBox:function(e){return void 0===e&&(console.warn(\"THREE.Sphere: .getBoundingBox() target is now required\"),e=new Nn),e.set(this.center,this.center),e.expandByScalar(this.radius),e},applyMatrix4:function(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this},translate:function(e){return this.center.add(e),this},equals:function(e){return e.center.equals(this.center)&&e.radius===this.radius}});var Gn=new Xr,zn=new Xr,Hn=new Xr,Vn=new Xr,kn=new Xr,jn=new Xr,Wn=new Xr;function qn(e,t){this.origin=void 0!==e?e:new Xr,this.direction=void 0!==t?t:new Xr(0,0,-1)}Object.assign(qn.prototype,{set:function(e,t){return this.origin.copy(e),this.direction.copy(t),this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this},at:function(e,t){return void 0===t&&(console.warn(\"THREE.Ray: .at() target is now required\"),t=new Xr),t.copy(this.direction).multiplyScalar(e).add(this.origin)},lookAt:function(e){return this.direction.copy(e).sub(this.origin).normalize(),this},recast:function(e){return this.origin.copy(this.at(e,Gn)),this},closestPointToPoint:function(e,t){void 0===t&&(console.warn(\"THREE.Ray: .closestPointToPoint() target is now required\"),t=new Xr),t.subVectors(e,this.origin);var r=t.dot(this.direction);return r<0?t.copy(this.origin):t.copy(this.direction).multiplyScalar(r).add(this.origin)},distanceToPoint:function(e){return Math.sqrt(this.distanceSqToPoint(e))},distanceSqToPoint:function(e){var t=Gn.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(Gn.copy(this.direction).multiplyScalar(t).add(this.origin),Gn.distanceToSquared(e))},distanceSqToSegment:function(e,t,r,n){zn.copy(e).add(t).multiplyScalar(.5),Hn.copy(t).sub(e).normalize(),Vn.copy(this.origin).sub(zn);var i,a,o,s,c=.5*e.distanceTo(t),l=-this.direction.dot(Hn),h=Vn.dot(this.direction),u=-Vn.dot(Hn),p=Vn.lengthSq(),d=Math.abs(1-l*l);if(d>0)if(a=l*h-u,s=c*d,(i=l*u-h)>=0)if(a>=-s)if(a<=s){var f=1\/d;o=(i*=f)*(i+l*(a*=f)+2*h)+a*(l*i+a+2*u)+p}else a=c,o=-(i=Math.max(0,-(l*a+h)))*i+a*(a+2*u)+p;else a=-c,o=-(i=Math.max(0,-(l*a+h)))*i+a*(a+2*u)+p;else a<=-s?o=-(i=Math.max(0,-(-l*c+h)))*i+(a=i>0?-c:Math.min(Math.max(-c,-u),c))*(a+2*u)+p:a<=s?(i=0,o=(a=Math.min(Math.max(-c,-u),c))*(a+2*u)+p):o=-(i=Math.max(0,-(l*c+h)))*i+(a=i>0?c:Math.min(Math.max(-c,-u),c))*(a+2*u)+p;else a=l>0?-c:c,o=-(i=Math.max(0,-(l*a+h)))*i+a*(a+2*u)+p;return r&&r.copy(this.direction).multiplyScalar(i).add(this.origin),n&&n.copy(Hn).multiplyScalar(a).add(zn),o},intersectSphere:function(e,t){Gn.subVectors(e.center,this.origin);var r=Gn.dot(this.direction),n=Gn.dot(Gn)-r*r,i=e.radius*e.radius;if(n>i)return null;var a=Math.sqrt(i-n),o=r-a,s=r+a;return o<0&&s<0?null:o<0?this.at(s,t):this.at(o,t)},intersectsSphere:function(e){return this.distanceSqToPoint(e.center)<=e.radius*e.radius},distanceToPlane:function(e){var t=e.normal.dot(this.direction);if(0===t)return 0===e.distanceToPoint(this.origin)?0:null;var r=-(this.origin.dot(e.normal)+e.constant)\/t;return r>=0?r:null},intersectPlane:function(e,t){var r=this.distanceToPlane(e);return null===r?null:this.at(r,t)},intersectsPlane:function(e){var t=e.distanceToPoint(this.origin);return 0===t||e.normal.dot(this.direction)*t<0},intersectBox:function(e,t){var r,n,i,a,o,s,c=1\/this.direction.x,l=1\/this.direction.y,h=1\/this.direction.z,u=this.origin;return c>=0?(r=(e.min.x-u.x)*c,n=(e.max.x-u.x)*c):(r=(e.max.x-u.x)*c,n=(e.min.x-u.x)*c),l>=0?(i=(e.min.y-u.y)*l,a=(e.max.y-u.y)*l):(i=(e.max.y-u.y)*l,a=(e.min.y-u.y)*l),r>a||i>n?null:((i>r||r!=r)&&(r=i),(a<n||n!=n)&&(n=a),h>=0?(o=(e.min.z-u.z)*h,s=(e.max.z-u.z)*h):(o=(e.max.z-u.z)*h,s=(e.min.z-u.z)*h),r>s||o>n?null:((o>r||r!=r)&&(r=o),(s<n||n!=n)&&(n=s),n<0?null:this.at(r>=0?r:n,t)))},intersectsBox:function(e){return null!==this.intersectBox(e,Gn)},intersectTriangle:function(e,t,r,n,i){kn.subVectors(t,e),jn.subVectors(r,e),Wn.crossVectors(kn,jn);var a,o=this.direction.dot(Wn);if(o>0){if(n)return null;a=1}else{if(!(o<0))return null;a=-1,o=-o}Vn.subVectors(this.origin,e);var s=a*this.direction.dot(jn.crossVectors(Vn,jn));if(s<0)return null;var c=a*this.direction.dot(kn.cross(Vn));if(c<0)return null;if(s+c>o)return null;var l=-a*Vn.dot(Wn);return l<0?null:this.at(l\/o,i)},applyMatrix4:function(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this},equals:function(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}});var Xn=new Xr,Yn=new Xr,Zn=new Fr;function Jn(e,t){this.normal=void 0!==e?e:new Xr(1,0,0),this.constant=void 0!==t?t:0}Object.assign(Jn.prototype,{isPlane:!0,set:function(e,t){return this.normal.copy(e),this.constant=t,this},setComponents:function(e,t,r,n){return this.normal.set(e,t,r),this.constant=n,this},setFromNormalAndCoplanarPoint:function(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this},setFromCoplanarPoints:function(e,t,r){var n=Xn.subVectors(r,t).cross(Yn.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(n,e),this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.normal.copy(e.normal),this.constant=e.constant,this},normalize:function(){var e=1\/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this},negate:function(){return this.constant*=-1,this.normal.negate(),this},distanceToPoint:function(e){return this.normal.dot(e)+this.constant},distanceToSphere:function(e){return this.distanceToPoint(e.center)-e.radius},projectPoint:function(e,t){return void 0===t&&(console.warn(\"THREE.Plane: .projectPoint() target is now required\"),t=new Xr),t.copy(this.normal).multiplyScalar(-this.distanceToPoint(e)).add(e)},intersectLine:function(e,t){void 0===t&&(console.warn(\"THREE.Plane: .intersectLine() target is now required\"),t=new Xr);var r=e.delta(Xn),n=this.normal.dot(r);if(0===n)return 0===this.distanceToPoint(e.start)?t.copy(e.start):void 0;var i=-(e.start.dot(this.normal)+this.constant)\/n;return i<0||i>1?void 0:t.copy(r).multiplyScalar(i).add(e.start)},intersectsLine:function(e){var t=this.distanceToPoint(e.start),r=this.distanceToPoint(e.end);return t<0&&r>0||r<0&&t>0},intersectsBox:function(e){return e.intersectsPlane(this)},intersectsSphere:function(e){return e.intersectsPlane(this)},coplanarPoint:function(e){return void 0===e&&(console.warn(\"THREE.Plane: .coplanarPoint() target is now required\"),e=new Xr),e.copy(this.normal).multiplyScalar(-this.constant)},applyMatrix4:function(e,t){var r=t||Zn.getNormalMatrix(e),n=this.coplanarPoint(Xn).applyMatrix4(e),i=this.normal.applyMatrix3(r).normalize();return this.constant=-n.dot(i),this},translate:function(e){return this.constant-=e.dot(this.normal),this},equals:function(e){return e.normal.equals(this.normal)&&e.constant===this.constant}});var Qn=new Xr,Kn=new Xr,$n=new Xr,ei=new Xr,ti=new Xr,ri=new Xr,ni=new Xr,ii=new Xr,ai=new Xr,oi=new Xr;function si(e,t,r){this.a=void 0!==e?e:new Xr,this.b=void 0!==t?t:new Xr,this.c=void 0!==r?r:new Xr}Object.assign(si,{getNormal:function(e,t,r,n){void 0===n&&(console.warn(\"THREE.Triangle: .getNormal() target is now required\"),n=new Xr),n.subVectors(r,t),Qn.subVectors(e,t),n.cross(Qn);var i=n.lengthSq();return i>0?n.multiplyScalar(1\/Math.sqrt(i)):n.set(0,0,0)},getBarycoord:function(e,t,r,n,i){Qn.subVectors(n,t),Kn.subVectors(r,t),$n.subVectors(e,t);var a=Qn.dot(Qn),o=Qn.dot(Kn),s=Qn.dot($n),c=Kn.dot(Kn),l=Kn.dot($n),h=a*c-o*o;if(void 0===i&&(console.warn(\"THREE.Triangle: .getBarycoord() target is now required\"),i=new Xr),0===h)return i.set(-2,-1,-1);var u=1\/h,p=(c*s-o*l)*u,d=(a*l-o*s)*u;return i.set(1-p-d,d,p)},containsPoint:function(e,t,r,n){return si.getBarycoord(e,t,r,n,ei),ei.x>=0&&ei.y>=0&&ei.x+ei.y<=1},getUV:function(e,t,r,n,i,a,o,s){return this.getBarycoord(e,t,r,n,ei),s.set(0,0),s.addScaledVector(i,ei.x),s.addScaledVector(a,ei.y),s.addScaledVector(o,ei.z),s},isFrontFacing:function(e,t,r,n){return Qn.subVectors(r,t),Kn.subVectors(e,t),Qn.cross(Kn).dot(n)<0}}),Object.assign(si.prototype,{set:function(e,t,r){return this.a.copy(e),this.b.copy(t),this.c.copy(r),this},setFromPointsAndIndices:function(e,t,r,n){return this.a.copy(e[t]),this.b.copy(e[r]),this.c.copy(e[n]),this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this},getArea:function(){return Qn.subVectors(this.c,this.b),Kn.subVectors(this.a,this.b),.5*Qn.cross(Kn).length()},getMidpoint:function(e){return void 0===e&&(console.warn(\"THREE.Triangle: .getMidpoint() target is now required\"),e=new Xr),e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1\/3)},getNormal:function(e){return si.getNormal(this.a,this.b,this.c,e)},getPlane:function(e){return void 0===e&&(console.warn(\"THREE.Triangle: .getPlane() target is now required\"),e=new Jn),e.setFromCoplanarPoints(this.a,this.b,this.c)},getBarycoord:function(e,t){return si.getBarycoord(e,this.a,this.b,this.c,t)},getUV:function(e,t,r,n,i){return si.getUV(e,this.a,this.b,this.c,t,r,n,i)},containsPoint:function(e){return si.containsPoint(e,this.a,this.b,this.c)},isFrontFacing:function(e){return si.isFrontFacing(this.a,this.b,this.c,e)},intersectsBox:function(e){return e.intersectsTriangle(this)},closestPointToPoint:function(e,t){void 0===t&&(console.warn(\"THREE.Triangle: .closestPointToPoint() target is now required\"),t=new Xr);var r,n,i=this.a,a=this.b,o=this.c;ti.subVectors(a,i),ri.subVectors(o,i),ii.subVectors(e,i);var s=ti.dot(ii),c=ri.dot(ii);if(s<=0&&c<=0)return t.copy(i);ai.subVectors(e,a);var l=ti.dot(ai),h=ri.dot(ai);if(l>=0&&h<=l)return t.copy(a);var u=s*h-l*c;if(u<=0&&s>=0&&l<=0)return r=s\/(s-l),t.copy(i).addScaledVector(ti,r);oi.subVectors(e,o);var p=ti.dot(oi),d=ri.dot(oi);if(d>=0&&p<=d)return t.copy(o);var f=p*c-s*d;if(f<=0&&c>=0&&d<=0)return n=c\/(c-d),t.copy(i).addScaledVector(ri,n);var m=l*d-p*h;if(m<=0&&h-l>=0&&p-d>=0)return ni.subVectors(o,a),n=(h-l)\/(h-l+(p-d)),t.copy(a).addScaledVector(ni,n);var v=1\/(m+f+u);return r=f*v,n=u*v,t.copy(i).addScaledVector(ti,r).addScaledVector(ri,n)},equals:function(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}});var ci={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},li={h:0,s:0,l:0},hi={h:0,s:0,l:0};function ui(e,t,r){return void 0===t&&void 0===r?this.set(e):this.setRGB(e,t,r)}function pi(e,t,r){return r<0&&(r+=1),r>1&&(r-=1),r<1\/6?e+6*(t-e)*r:r<.5?t:r<2\/3?e+6*(t-e)*(2\/3-r):e}function di(e){return e<.04045?.0773993808*e:Math.pow(.9478672986*e+.0521327014,2.4)}function fi(e){return e<.0031308?12.92*e:1.055*Math.pow(e,.41666)-.055}function mi(e,t,r,n,i,a){this.a=e,this.b=t,this.c=r,this.normal=n&&n.isVector3?n:new Xr,this.vertexNormals=Array.isArray(n)?n:[],this.color=i&&i.isColor?i:new ui,this.vertexColors=Array.isArray(i)?i:[],this.materialIndex=void 0!==a?a:0}Object.assign(ui.prototype,{isColor:!0,r:1,g:1,b:1,set:function(e){return e&&e.isColor?this.copy(e):\"number\"==typeof e?this.setHex(e):\"string\"==typeof e&&this.setStyle(e),this},setScalar:function(e){return this.r=e,this.g=e,this.b=e,this},setHex:function(e){return e=Math.floor(e),this.r=(e>>16&255)\/255,this.g=(e>>8&255)\/255,this.b=(255&e)\/255,this},setRGB:function(e,t,r){return this.r=e,this.g=t,this.b=r,this},setHSL:function(e,t,r){if(e=Nr.euclideanModulo(e,1),t=Nr.clamp(t,0,1),r=Nr.clamp(r,0,1),0===t)this.r=this.g=this.b=r;else{var n=r<=.5?r*(1+t):r+t-r*t,i=2*r-n;this.r=pi(i,n,e+1\/3),this.g=pi(i,n,e),this.b=pi(i,n,e-1\/3)}return this},setStyle:function(e){function t(t){void 0!==t&&parseFloat(t)<1&&console.warn(\"THREE.Color: Alpha component of \"+e+\" will be ignored.\")}var r;if(r=\/^((?:rgb|hsl)a?)(s*([^)]*))\/.exec(e)){var n,i=r[1],a=r[2];switch(i){case\"rgb\":case\"rgba\":if(n=\/^(d+)s*,s*(d+)s*,s*(d+)s*(,s*([0-9]*.?[0-9]+)s*)?$\/.exec(a))return this.r=Math.min(255,parseInt(n[1],10))\/255,this.g=Math.min(255,parseInt(n[2],10))\/255,this.b=Math.min(255,parseInt(n[3],10))\/255,t(n[5]),this;if(n=\/^(d+)%s*,s*(d+)%s*,s*(d+)%s*(,s*([0-9]*.?[0-9]+)s*)?$\/.exec(a))return this.r=Math.min(100,parseInt(n[1],10))\/100,this.g=Math.min(100,parseInt(n[2],10))\/100,this.b=Math.min(100,parseInt(n[3],10))\/100,t(n[5]),this;break;case\"hsl\":case\"hsla\":if(n=\/^([0-9]*.?[0-9]+)s*,s*(d+)%s*,s*(d+)%s*(,s*([0-9]*.?[0-9]+)s*)?$\/.exec(a)){var o=parseFloat(n[1])\/360,s=parseInt(n[2],10)\/100,c=parseInt(n[3],10)\/100;return t(n[5]),this.setHSL(o,s,c)}}}else if(r=\/^#([A-Fa-f0-9]+)$\/.exec(e)){var l=r[1],h=l.length;if(3===h)return this.r=parseInt(l.charAt(0)+l.charAt(0),16)\/255,this.g=parseInt(l.charAt(1)+l.charAt(1),16)\/255,this.b=parseInt(l.charAt(2)+l.charAt(2),16)\/255,this;if(6===h)return this.r=parseInt(l.charAt(0)+l.charAt(1),16)\/255,this.g=parseInt(l.charAt(2)+l.charAt(3),16)\/255,this.b=parseInt(l.charAt(4)+l.charAt(5),16)\/255,this}return e&&e.length>0?this.setColorName(e):this},setColorName:function(e){var t=ci[e];return void 0!==t?this.setHex(t):console.warn(\"THREE.Color: Unknown color \"+e),this},clone:function(){return new this.constructor(this.r,this.g,this.b)},copy:function(e){return this.r=e.r,this.g=e.g,this.b=e.b,this},copyGammaToLinear:function(e,t){return void 0===t&&(t=2),this.r=Math.pow(e.r,t),this.g=Math.pow(e.g,t),this.b=Math.pow(e.b,t),this},copyLinearToGamma:function(e,t){void 0===t&&(t=2);var r=t>0?1\/t:1;return this.r=Math.pow(e.r,r),this.g=Math.pow(e.g,r),this.b=Math.pow(e.b,r),this},convertGammaToLinear:function(e){return this.copyGammaToLinear(this,e),this},convertLinearToGamma:function(e){return this.copyLinearToGamma(this,e),this},copySRGBToLinear:function(e){return this.r=di(e.r),this.g=di(e.g),this.b=di(e.b),this},copyLinearToSRGB:function(e){return this.r=fi(e.r),this.g=fi(e.g),this.b=fi(e.b),this},convertSRGBToLinear:function(){return this.copySRGBToLinear(this),this},convertLinearToSRGB:function(){return this.copyLinearToSRGB(this),this},getHex:function(){return 255*this.r<<16^255*this.g<<8^255*this.b<<0},getHexString:function(){return(\"000000\"+this.getHex().toString(16)).slice(-6)},getHSL:function(e){void 0===e&&(console.warn(\"THREE.Color: .getHSL() target is now required\"),e={h:0,s:0,l:0});var t,r,n=this.r,i=this.g,a=this.b,o=Math.max(n,i,a),s=Math.min(n,i,a),c=(s+o)\/2;if(s===o)t=0,r=0;else{var l=o-s;switch(r=c<=.5?l\/(o+s):l\/(2-o-s),o){case n:t=(i-a)\/l+(i<a?6:0);break;case i:t=(a-n)\/l+2;break;case a:t=(n-i)\/l+4}t\/=6}return e.h=t,e.s=r,e.l=c,e},getStyle:function(){return\"rgb(\"+(255*this.r|0)+\",\"+(255*this.g|0)+\",\"+(255*this.b|0)+\")\"},offsetHSL:function(e,t,r){return this.getHSL(li),li.h+=e,li.s+=t,li.l+=r,this.setHSL(li.h,li.s,li.l),this},add:function(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this},addColors:function(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this},addScalar:function(e){return this.r+=e,this.g+=e,this.b+=e,this},sub: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},multiply:function(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this},multiplyScalar:function(e){return this.r*=e,this.g*=e,this.b*=e,this},lerp: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},lerpHSL:function(e,t){this.getHSL(li),e.getHSL(hi);var r=Nr.lerp(li.h,hi.h,t),n=Nr.lerp(li.s,hi.s,t),i=Nr.lerp(li.l,hi.l,t);return this.setHSL(r,n,i),this},equals:function(e){return e.r===this.r&&e.g===this.g&&e.b===this.b},fromArray:function(e,t){return void 0===t&&(t=0),this.r=e[t],this.g=e[t+1],this.b=e[t+2],this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e},toJSON:function(){return this.getHex()}}),ui.NAMES=ci,Object.assign(mi.prototype,{clone:function(){return(new this.constructor).copy(this)},copy:function(e){this.a=e.a,this.b=e.b,this.c=e.c,this.normal.copy(e.normal),this.color.copy(e.color),this.materialIndex=e.materialIndex;for(var t=0,r=e.vertexNormals.length;t<r;t++)this.vertexNormals[t]=e.vertexNormals[t].clone();for(t=0,r=e.vertexColors.length;t<r;t++)this.vertexColors[t]=e.vertexColors[t].clone();return this}});var vi=0;function gi(){Object.defineProperty(this,\"id\",{value:vi++}),this.uuid=Nr.generateUUID(),this.name=\"\",this.type=\"Material\",this.fog=!0,this.blending=x,this.side=d,this.flatShading=!1,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.blendSrc=D,this.blendDst=I,this.blendEquation=S,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.depthFunc=k,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=br,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=sr,this.stencilZFail=sr,this.stencilZPass=sr,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaTest=0,this.premultipliedAlpha=!1,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0}function yi(e){gi.call(this),this.type=\"MeshBasicMaterial\",this.color=new ui(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=Y,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap=\"round\",this.wireframeLinejoin=\"round\",this.skinning=!1,this.morphTargets=!1,this.setValues(e)}gi.prototype=Object.assign(Object.create(Pr.prototype),{constructor:gi,isMaterial:!0,onBeforeCompile:function(){},setValues:function(e){if(void 0!==e)for(var t in e){var r=e[t];if(void 0!==r)if(\"shading\"!==t){var n=this[t];void 0!==n?n&&n.isColor?n.set(r):n&&n.isVector3&&r&&r.isVector3?n.copy(r):this[t]=r:console.warn(\"THREE.\"+this.type+\": '\"+t+\"' is not a property of this material.\")}else console.warn(\"THREE.\"+this.type+\": .shading has been removed. Use the boolean .flatShading instead.\"),this.flatShading=r===v;else console.warn(\"THREE.Material: '\"+t+\"' parameter is undefined.\")}},toJSON:function(e){var t=void 0===e||\"string\"==typeof e;t&&(e={textures:{},images:{}});var r={metadata:{version:4.5,type:\"Material\",generator:\"Material.toJSON\"}};function n(e){var t=[];for(var r in e){var n=e[r];delete n.metadata,t.push(n)}return t}if(r.uuid=this.uuid,r.type=this.type,\"\"!==this.name&&(r.name=this.name),this.color&&this.color.isColor&&(r.color=this.color.getHex()),void 0!==this.roughness&&(r.roughness=this.roughness),void 0!==this.metalness&&(r.metalness=this.metalness),this.sheen&&this.sheen.isColor&&(r.sheen=this.sheen.getHex()),this.emissive&&this.emissive.isColor&&(r.emissive=this.emissive.getHex()),this.emissiveIntensity&&1!==this.emissiveIntensity&&(r.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(r.specular=this.specular.getHex()),void 0!==this.shininess&&(r.shininess=this.shininess),void 0!==this.clearcoat&&(r.clearcoat=this.clearcoat),void 0!==this.clearcoatRoughness&&(r.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(r.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(r.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(r.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,r.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.map&&this.map.isTexture&&(r.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(r.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(r.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(r.lightMap=this.lightMap.toJSON(e).uuid),this.aoMap&&this.aoMap.isTexture&&(r.aoMap=this.aoMap.toJSON(e).uuid,r.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(r.bumpMap=this.bumpMap.toJSON(e).uuid,r.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(r.normalMap=this.normalMap.toJSON(e).uuid,r.normalMapType=this.normalMapType,r.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(r.displacementMap=this.displacementMap.toJSON(e).uuid,r.displacementScale=this.displacementScale,r.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(r.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(r.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(r.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(r.specularMap=this.specularMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(r.envMap=this.envMap.toJSON(e).uuid,r.reflectivity=this.reflectivity,r.refractionRatio=this.refractionRatio,void 0!==this.combine&&(r.combine=this.combine),void 0!==this.envMapIntensity&&(r.envMapIntensity=this.envMapIntensity)),this.gradientMap&&this.gradientMap.isTexture&&(r.gradientMap=this.gradientMap.toJSON(e).uuid),void 0!==this.size&&(r.size=this.size),void 0!==this.sizeAttenuation&&(r.sizeAttenuation=this.sizeAttenuation),this.blending!==x&&(r.blending=this.blending),!0===this.flatShading&&(r.flatShading=this.flatShading),this.side!==d&&(r.side=this.side),this.vertexColors&&(r.vertexColors=!0),this.opacity<1&&(r.opacity=this.opacity),!0===this.transparent&&(r.transparent=this.transparent),r.depthFunc=this.depthFunc,r.depthTest=this.depthTest,r.depthWrite=this.depthWrite,r.stencilWrite=this.stencilWrite,r.stencilWriteMask=this.stencilWriteMask,r.stencilFunc=this.stencilFunc,r.stencilRef=this.stencilRef,r.stencilFuncMask=this.stencilFuncMask,r.stencilFail=this.stencilFail,r.stencilZFail=this.stencilZFail,r.stencilZPass=this.stencilZPass,this.rotation&&0!==this.rotation&&(r.rotation=this.rotation),!0===this.polygonOffset&&(r.polygonOffset=!0),0!==this.polygonOffsetFactor&&(r.polygonOffsetFactor=this.polygonOffsetFactor),0!==this.polygonOffsetUnits&&(r.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth&&1!==this.linewidth&&(r.linewidth=this.linewidth),void 0!==this.dashSize&&(r.dashSize=this.dashSize),void 0!==this.gapSize&&(r.gapSize=this.gapSize),void 0!==this.scale&&(r.scale=this.scale),!0===this.dithering&&(r.dithering=!0),this.alphaTest>0&&(r.alphaTest=this.alphaTest),!0===this.premultipliedAlpha&&(r.premultipliedAlpha=this.premultipliedAlpha),!0===this.wireframe&&(r.wireframe=this.wireframe),this.wireframeLinewidth>1&&(r.wireframeLinewidth=this.wireframeLinewidth),\"round\"!==this.wireframeLinecap&&(r.wireframeLinecap=this.wireframeLinecap),\"round\"!==this.wireframeLinejoin&&(r.wireframeLinejoin=this.wireframeLinejoin),!0===this.morphTargets&&(r.morphTargets=!0),!0===this.morphNormals&&(r.morphNormals=!0),!0===this.skinning&&(r.skinning=!0),!1===this.visible&&(r.visible=!1),!1===this.toneMapped&&(r.toneMapped=!1),\"{}\"!==JSON.stringify(this.userData)&&(r.userData=this.userData),t){var i=n(e.textures),a=n(e.images);i.length>0&&(r.textures=i),a.length>0&&(r.images=a)}return r},clone:function(){return(new this.constructor).copy(this)},copy:function(e){this.name=e.name,this.fog=e.fog,this.blending=e.blending,this.side=e.side,this.flatShading=e.flatShading,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,r=null;if(null!==t){var n=t.length;r=new Array(n);for(var i=0;i!==n;++i)r[i]=t[i].clone()}return this.clippingPlanes=r,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.premultipliedAlpha=e.premultipliedAlpha,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this},dispose:function(){this.dispatchEvent({type:\"dispose\"})}}),Object.defineProperty(gi.prototype,\"needsUpdate\",{set:function(e){!0===e&&this.version++}}),yi.prototype=Object.create(gi.prototype),yi.prototype.constructor=yi,yi.prototype.isMeshBasicMaterial=!0,yi.prototype.copy=function(e){return gi.prototype.copy.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.skinning=e.skinning,this.morphTargets=e.morphTargets,this};var xi=new Xr;function _i(e,t,r){if(Array.isArray(e))throw new TypeError(\"THREE.BufferAttribute: array should be a Typed Array.\");this.name=\"\",this.array=e,this.itemSize=t,this.count=void 0!==e?e.length\/t:0,this.normalized=!0===r,this.usage=wr,this.updateRange={offset:0,count:-1},this.version=0}function bi(e,t,r){_i.call(this,new Int8Array(e),t,r)}function wi(e,t,r){_i.call(this,new Uint8Array(e),t,r)}function Mi(e,t,r){_i.call(this,new Uint8ClampedArray(e),t,r)}function Si(e,t,r){_i.call(this,new Int16Array(e),t,r)}function Ti(e,t,r){_i.call(this,new Uint16Array(e),t,r)}function Ei(e,t,r){_i.call(this,new Int32Array(e),t,r)}function Ai(e,t,r){_i.call(this,new Uint32Array(e),t,r)}function Li(e,t,r){_i.call(this,new Float32Array(e),t,r)}function Ri(e,t,r){_i.call(this,new Float64Array(e),t,r)}function Ci(){this.vertices=[],this.normals=[],this.colors=[],this.uvs=[],this.uvs2=[],this.groups=[],this.morphTargets={},this.skinWeights=[],this.skinIndices=[],this.boundingBox=null,this.boundingSphere=null,this.verticesNeedUpdate=!1,this.normalsNeedUpdate=!1,this.colorsNeedUpdate=!1,this.uvsNeedUpdate=!1,this.groupsNeedUpdate=!1}function Pi(e){if(0===e.length)return-1\/0;for(var t=e[0],r=1,n=e.length;r<n;++r)e[r]>t&&(t=e[r]);return t}Object.defineProperty(_i.prototype,\"needsUpdate\",{set:function(e){!0===e&&this.version++}}),Object.assign(_i.prototype,{isBufferAttribute:!0,onUploadCallback:function(){},setUsage:function(e){return this.usage=e,this},copy: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},copyAt:function(e,t,r){e*=this.itemSize,r*=t.itemSize;for(var n=0,i=this.itemSize;n<i;n++)this.array[e+n]=t.array[r+n];return this},copyArray:function(e){return this.array.set(e),this},copyColorsArray:function(e){for(var t=this.array,r=0,n=0,i=e.length;n<i;n++){var a=e[n];void 0===a&&(console.warn(\"THREE.BufferAttribute.copyColorsArray(): color is undefined\",n),a=new ui),t[r++]=a.r,t[r++]=a.g,t[r++]=a.b}return this},copyVector2sArray:function(e){for(var t=this.array,r=0,n=0,i=e.length;n<i;n++){var a=e[n];void 0===a&&(console.warn(\"THREE.BufferAttribute.copyVector2sArray(): vector is undefined\",n),a=new Br),t[r++]=a.x,t[r++]=a.y}return this},copyVector3sArray:function(e){for(var t=this.array,r=0,n=0,i=e.length;n<i;n++){var a=e[n];void 0===a&&(console.warn(\"THREE.BufferAttribute.copyVector3sArray(): vector is undefined\",n),a=new Xr),t[r++]=a.x,t[r++]=a.y,t[r++]=a.z}return this},copyVector4sArray:function(e){for(var t=this.array,r=0,n=0,i=e.length;n<i;n++){var a=e[n];void 0===a&&(console.warn(\"THREE.BufferAttribute.copyVector4sArray(): vector is undefined\",n),a=new Hr),t[r++]=a.x,t[r++]=a.y,t[r++]=a.z,t[r++]=a.w}return this},applyMatrix3:function(e){for(var t=0,r=this.count;t<r;t++)xi.x=this.getX(t),xi.y=this.getY(t),xi.z=this.getZ(t),xi.applyMatrix3(e),this.setXYZ(t,xi.x,xi.y,xi.z);return this},applyMatrix4:function(e){for(var t=0,r=this.count;t<r;t++)xi.x=this.getX(t),xi.y=this.getY(t),xi.z=this.getZ(t),xi.applyMatrix4(e),this.setXYZ(t,xi.x,xi.y,xi.z);return this},applyNormalMatrix:function(e){for(var t=0,r=this.count;t<r;t++)xi.x=this.getX(t),xi.y=this.getY(t),xi.z=this.getZ(t),xi.applyNormalMatrix(e),this.setXYZ(t,xi.x,xi.y,xi.z);return this},transformDirection:function(e){for(var t=0,r=this.count;t<r;t++)xi.x=this.getX(t),xi.y=this.getY(t),xi.z=this.getZ(t),xi.transformDirection(e),this.setXYZ(t,xi.x,xi.y,xi.z);return this},set:function(e,t){return void 0===t&&(t=0),this.array.set(e,t),this},getX:function(e){return this.array[e*this.itemSize]},setX:function(e,t){return this.array[e*this.itemSize]=t,this},getY:function(e){return this.array[e*this.itemSize+1]},setY:function(e,t){return this.array[e*this.itemSize+1]=t,this},getZ:function(e){return this.array[e*this.itemSize+2]},setZ:function(e,t){return this.array[e*this.itemSize+2]=t,this},getW:function(e){return this.array[e*this.itemSize+3]},setW:function(e,t){return this.array[e*this.itemSize+3]=t,this},setXY:function(e,t,r){return e*=this.itemSize,this.array[e+0]=t,this.array[e+1]=r,this},setXYZ:function(e,t,r,n){return e*=this.itemSize,this.array[e+0]=t,this.array[e+1]=r,this.array[e+2]=n,this},setXYZW:function(e,t,r,n,i){return e*=this.itemSize,this.array[e+0]=t,this.array[e+1]=r,this.array[e+2]=n,this.array[e+3]=i,this},onUpload:function(e){return this.onUploadCallback=e,this},clone:function(){return new this.constructor(this.array,this.itemSize).copy(this)},toJSON:function(){return{itemSize:this.itemSize,type:this.array.constructor.name,array:Array.prototype.slice.call(this.array),normalized:this.normalized}}}),bi.prototype=Object.create(_i.prototype),bi.prototype.constructor=bi,wi.prototype=Object.create(_i.prototype),wi.prototype.constructor=wi,Mi.prototype=Object.create(_i.prototype),Mi.prototype.constructor=Mi,Si.prototype=Object.create(_i.prototype),Si.prototype.constructor=Si,Ti.prototype=Object.create(_i.prototype),Ti.prototype.constructor=Ti,Ei.prototype=Object.create(_i.prototype),Ei.prototype.constructor=Ei,Ai.prototype=Object.create(_i.prototype),Ai.prototype.constructor=Ai,Li.prototype=Object.create(_i.prototype),Li.prototype.constructor=Li,Ri.prototype=Object.create(_i.prototype),Ri.prototype.constructor=Ri,Object.assign(Ci.prototype,{computeGroups:function(e){for(var t,r=[],n=void 0,i=e.faces,a=0;a<i.length;a++){var o=i[a];o.materialIndex!==n&&(n=o.materialIndex,void 0!==t&&(t.count=3*a-t.start,r.push(t)),t={start:3*a,materialIndex:n})}void 0!==t&&(t.count=3*a-t.start,r.push(t)),this.groups=r},fromGeometry:function(e){var t,r=e.faces,n=e.vertices,i=e.faceVertexUvs,a=i[0]&&i[0].length>0,o=i[1]&&i[1].length>0,s=e.morphTargets,c=s.length;if(c>0){t=[];for(var l=0;l<c;l++)t[l]={name:s[l].name,data:[]};this.morphTargets.position=t}var h,u=e.morphNormals,p=u.length;if(p>0){h=[];for(l=0;l<p;l++)h[l]={name:u[l].name,data:[]};this.morphTargets.normal=h}var d=e.skinIndices,f=e.skinWeights,m=d.length===n.length,v=f.length===n.length;n.length>0&&0===r.length&&console.error(\"THREE.DirectGeometry: Faceless geometries are not supported.\");for(l=0;l<r.length;l++){var g=r[l];this.vertices.push(n[g.a],n[g.b],n[g.c]);var y=g.vertexNormals;if(3===y.length)this.normals.push(y[0],y[1],y[2]);else{var x=g.normal;this.normals.push(x,x,x)}var _,b=g.vertexColors;if(3===b.length)this.colors.push(b[0],b[1],b[2]);else{var w=g.color;this.colors.push(w,w,w)}if(!0===a)void 0!==(_=i[0][l])?this.uvs.push(_[0],_[1],_[2]):(console.warn(\"THREE.DirectGeometry.fromGeometry(): Undefined vertexUv \",l),this.uvs.push(new Br,new Br,new Br));if(!0===o)void 0!==(_=i[1][l])?this.uvs2.push(_[0],_[1],_[2]):(console.warn(\"THREE.DirectGeometry.fromGeometry(): Undefined vertexUv2 \",l),this.uvs2.push(new Br,new Br,new Br));for(var M=0;M<c;M++){var S=s[M].vertices;t[M].data.push(S[g.a],S[g.b],S[g.c])}for(M=0;M<p;M++){var T=u[M].vertexNormals[l];h[M].data.push(T.a,T.b,T.c)}m&&this.skinIndices.push(d[g.a],d[g.b],d[g.c]),v&&this.skinWeights.push(f[g.a],f[g.b],f[g.c])}return this.computeGroups(e),this.verticesNeedUpdate=e.verticesNeedUpdate,this.normalsNeedUpdate=e.normalsNeedUpdate,this.colorsNeedUpdate=e.colorsNeedUpdate,this.uvsNeedUpdate=e.uvsNeedUpdate,this.groupsNeedUpdate=e.groupsNeedUpdate,null!==e.boundingSphere&&(this.boundingSphere=e.boundingSphere.clone()),null!==e.boundingBox&&(this.boundingBox=e.boundingBox.clone()),this}});var Oi=1,Di=new tn,Ii=new _n,Ni=new Xr,Bi=new Nn,Fi=new Nn,Ui=new Xr;function Gi(){Object.defineProperty(this,\"id\",{value:Oi+=2}),this.uuid=Nr.generateUUID(),this.name=\"\",this.type=\"BufferGeometry\",this.index=null,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1\/0},this.userData={}}Gi.prototype=Object.assign(Object.create(Pr.prototype),{constructor:Gi,isBufferGeometry:!0,getIndex:function(){return this.index},setIndex:function(e){Array.isArray(e)?this.index=new(Pi(e)>65535?Ai:Ti)(e,1):this.index=e},getAttribute:function(e){return this.attributes[e]},setAttribute:function(e,t){return this.attributes[e]=t,this},deleteAttribute:function(e){return delete this.attributes[e],this},addGroup:function(e,t,r){this.groups.push({start:e,count:t,materialIndex:void 0!==r?r:0})},clearGroups:function(){this.groups=[]},setDrawRange:function(e,t){this.drawRange.start=e,this.drawRange.count=t},applyMatrix4:function(e){var t=this.attributes.position;void 0!==t&&(t.applyMatrix4(e),t.needsUpdate=!0);var r=this.attributes.normal;if(void 0!==r){var n=(new Fr).getNormalMatrix(e);r.applyNormalMatrix(n),r.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},rotateX:function(e){return Di.makeRotationX(e),this.applyMatrix4(Di),this},rotateY:function(e){return Di.makeRotationY(e),this.applyMatrix4(Di),this},rotateZ:function(e){return Di.makeRotationZ(e),this.applyMatrix4(Di),this},translate:function(e,t,r){return Di.makeTranslation(e,t,r),this.applyMatrix4(Di),this},scale:function(e,t,r){return Di.makeScale(e,t,r),this.applyMatrix4(Di),this},lookAt:function(e){return Ii.lookAt(e),Ii.updateMatrix(),this.applyMatrix4(Ii.matrix),this},center:function(){return this.computeBoundingBox(),this.boundingBox.getCenter(Ni).negate(),this.translate(Ni.x,Ni.y,Ni.z),this},setFromObject:function(e){var t=e.geometry;if(e.isPoints||e.isLine){var r=new Li(3*t.vertices.length,3),n=new Li(3*t.colors.length,3);if(this.setAttribute(\"position\",r.copyVector3sArray(t.vertices)),this.setAttribute(\"color\",n.copyColorsArray(t.colors)),t.lineDistances&&t.lineDistances.length===t.vertices.length){var i=new Li(t.lineDistances.length,1);this.setAttribute(\"lineDistance\",i.copyArray(t.lineDistances))}null!==t.boundingSphere&&(this.boundingSphere=t.boundingSphere.clone()),null!==t.boundingBox&&(this.boundingBox=t.boundingBox.clone())}else e.isMesh&&t&&t.isGeometry&&this.fromGeometry(t);return this},setFromPoints:function(e){for(var t=[],r=0,n=e.length;r<n;r++){var i=e[r];t.push(i.x,i.y,i.z||0)}return this.setAttribute(\"position\",new Li(t,3)),this},updateFromObject:function(e){var t,r=e.geometry;if(e.isMesh){var n=r.__directGeometry;if(!0===r.elementsNeedUpdate&&(n=void 0,r.elementsNeedUpdate=!1),void 0===n)return this.fromGeometry(r);n.verticesNeedUpdate=r.verticesNeedUpdate,n.normalsNeedUpdate=r.normalsNeedUpdate,n.colorsNeedUpdate=r.colorsNeedUpdate,n.uvsNeedUpdate=r.uvsNeedUpdate,n.groupsNeedUpdate=r.groupsNeedUpdate,r.verticesNeedUpdate=!1,r.normalsNeedUpdate=!1,r.colorsNeedUpdate=!1,r.uvsNeedUpdate=!1,r.groupsNeedUpdate=!1,r=n}return!0===r.verticesNeedUpdate&&(void 0!==(t=this.attributes.position)&&(t.copyVector3sArray(r.vertices),t.needsUpdate=!0),r.verticesNeedUpdate=!1),!0===r.normalsNeedUpdate&&(void 0!==(t=this.attributes.normal)&&(t.copyVector3sArray(r.normals),t.needsUpdate=!0),r.normalsNeedUpdate=!1),!0===r.colorsNeedUpdate&&(void 0!==(t=this.attributes.color)&&(t.copyColorsArray(r.colors),t.needsUpdate=!0),r.colorsNeedUpdate=!1),r.uvsNeedUpdate&&(void 0!==(t=this.attributes.uv)&&(t.copyVector2sArray(r.uvs),t.needsUpdate=!0),r.uvsNeedUpdate=!1),r.lineDistancesNeedUpdate&&(void 0!==(t=this.attributes.lineDistance)&&(t.copyArray(r.lineDistances),t.needsUpdate=!0),r.lineDistancesNeedUpdate=!1),r.groupsNeedUpdate&&(r.computeGroups(e.geometry),this.groups=r.groups,r.groupsNeedUpdate=!1),this},fromGeometry:function(e){return e.__directGeometry=(new Ci).fromGeometry(e),this.fromDirectGeometry(e.__directGeometry)},fromDirectGeometry:function(e){var t=new Float32Array(3*e.vertices.length);if(this.setAttribute(\"position\",new _i(t,3).copyVector3sArray(e.vertices)),e.normals.length>0){var r=new Float32Array(3*e.normals.length);this.setAttribute(\"normal\",new _i(r,3).copyVector3sArray(e.normals))}if(e.colors.length>0){var n=new Float32Array(3*e.colors.length);this.setAttribute(\"color\",new _i(n,3).copyColorsArray(e.colors))}if(e.uvs.length>0){var i=new Float32Array(2*e.uvs.length);this.setAttribute(\"uv\",new _i(i,2).copyVector2sArray(e.uvs))}if(e.uvs2.length>0){var a=new Float32Array(2*e.uvs2.length);this.setAttribute(\"uv2\",new _i(a,2).copyVector2sArray(e.uvs2))}for(var o in this.groups=e.groups,e.morphTargets){for(var s=[],c=e.morphTargets[o],l=0,h=c.length;l<h;l++){var u=c[l],p=new Li(3*u.data.length,3);p.name=u.name,s.push(p.copyVector3sArray(u.data))}this.morphAttributes[o]=s}if(e.skinIndices.length>0){var d=new Li(4*e.skinIndices.length,4);this.setAttribute(\"skinIndex\",d.copyVector4sArray(e.skinIndices))}if(e.skinWeights.length>0){var f=new Li(4*e.skinWeights.length,4);this.setAttribute(\"skinWeight\",f.copyVector4sArray(e.skinWeights))}return null!==e.boundingSphere&&(this.boundingSphere=e.boundingSphere.clone()),null!==e.boundingBox&&(this.boundingBox=e.boundingBox.clone()),this},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new Nn);var e=this.attributes.position,t=this.morphAttributes.position;if(void 0!==e){if(this.boundingBox.setFromBufferAttribute(e),t)for(var r=0,n=t.length;r<n;r++){var i=t[r];Bi.setFromBufferAttribute(i),this.morphTargetsRelative?(Ui.addVectors(this.boundingBox.min,Bi.min),this.boundingBox.expandByPoint(Ui),Ui.addVectors(this.boundingBox.max,Bi.max),this.boundingBox.expandByPoint(Ui)):(this.boundingBox.expandByPoint(Bi.min),this.boundingBox.expandByPoint(Bi.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)},computeBoundingSphere:function(){null===this.boundingSphere&&(this.boundingSphere=new Un);var e=this.attributes.position,t=this.morphAttributes.position;if(e){var r=this.boundingSphere.center;if(Bi.setFromBufferAttribute(e),t)for(var n=0,i=t.length;n<i;n++){var a=t[n];Fi.setFromBufferAttribute(a),this.morphTargetsRelative?(Ui.addVectors(Bi.min,Fi.min),Bi.expandByPoint(Ui),Ui.addVectors(Bi.max,Fi.max),Bi.expandByPoint(Ui)):(Bi.expandByPoint(Fi.min),Bi.expandByPoint(Fi.max))}Bi.getCenter(r);var o=0;for(n=0,i=e.count;n<i;n++)Ui.fromBufferAttribute(e,n),o=Math.max(o,r.distanceToSquared(Ui));if(t)for(n=0,i=t.length;n<i;n++){a=t[n];for(var s=this.morphTargetsRelative,c=0,l=a.count;c<l;c++)Ui.fromBufferAttribute(a,c),s&&(Ni.fromBufferAttribute(e,c),Ui.add(Ni)),o=Math.max(o,r.distanceToSquared(Ui))}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)}},computeFaceNormals:function(){},computeVertexNormals:function(){var e=this.index,t=this.attributes;if(t.position){var r=t.position.array;if(void 0===t.normal)this.setAttribute(\"normal\",new _i(new Float32Array(r.length),3));else for(var n=t.normal.array,i=0,a=n.length;i<a;i++)n[i]=0;var o,s,c,l=t.normal.array,h=new Xr,u=new Xr,p=new Xr,d=new Xr,f=new Xr;if(e){var m=e.array;for(i=0,a=e.count;i<a;i+=3)o=3*m[i+0],s=3*m[i+1],c=3*m[i+2],h.fromArray(r,o),u.fromArray(r,s),p.fromArray(r,c),d.subVectors(p,u),f.subVectors(h,u),d.cross(f),l[o]+=d.x,l[o+1]+=d.y,l[o+2]+=d.z,l[s]+=d.x,l[s+1]+=d.y,l[s+2]+=d.z,l[c]+=d.x,l[c+1]+=d.y,l[c+2]+=d.z}else for(i=0,a=r.length;i<a;i+=9)h.fromArray(r,i),u.fromArray(r,i+3),p.fromArray(r,i+6),d.subVectors(p,u),f.subVectors(h,u),d.cross(f),l[i]=d.x,l[i+1]=d.y,l[i+2]=d.z,l[i+3]=d.x,l[i+4]=d.y,l[i+5]=d.z,l[i+6]=d.x,l[i+7]=d.y,l[i+8]=d.z;this.normalizeNormals(),t.normal.needsUpdate=!0}},merge:function(e,t){if(e&&e.isBufferGeometry){void 0===t&&(t=0,console.warn(\"THREE.BufferGeometry.merge(): Overwriting original geometry, starting at offset=0. Use BufferGeometryUtils.mergeBufferGeometries() for lossless merge.\"));var r=this.attributes;for(var n in r)if(void 0!==e.attributes[n])for(var i=r[n].array,a=e.attributes[n],o=a.array,s=a.itemSize*t,c=Math.min(o.length,i.length-s),l=0,h=s;l<c;l++,h++)i[h]=o[l];return this}console.error(\"THREE.BufferGeometry.merge(): geometry not an instance of THREE.BufferGeometry.\",e)},normalizeNormals:function(){for(var e=this.attributes.normal,t=0,r=e.count;t<r;t++)Ui.x=e.getX(t),Ui.y=e.getY(t),Ui.z=e.getZ(t),Ui.normalize(),e.setXYZ(t,Ui.x,Ui.y,Ui.z)},toNonIndexed:function(){function e(e,t){for(var r=e.array,n=e.itemSize,i=new r.constructor(t.length*n),a=0,o=0,s=0,c=t.length;s<c;s++){a=t[s]*n;for(var l=0;l<n;l++)i[o++]=r[a++]}return new _i(i,n)}if(null===this.index)return console.warn(\"THREE.BufferGeometry.toNonIndexed(): Geometry is already non-indexed.\"),this;var t=new Gi,r=this.index.array,n=this.attributes;for(var i in n){var a=e(n[i],r);t.setAttribute(i,a)}var o=this.morphAttributes;for(i in o){for(var s=[],c=o[i],l=0,h=c.length;l<h;l++){a=e(c[l],r);s.push(a)}t.morphAttributes[i]=s}t.morphTargetsRelative=this.morphTargetsRelative;for(var u=this.groups,p=(l=0,u.length);l<p;l++){var d=u[l];t.addGroup(d.start,d.count,d.materialIndex)}return t},toJSON:function(){var e={metadata:{version:4.5,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 r in t)void 0!==t[r]&&(e[r]=t[r]);return e}e.data={attributes:{}};var n=this.index;null!==n&&(e.data.index={type:n.array.constructor.name,array:Array.prototype.slice.call(n.array)});var i=this.attributes;for(var r in i){var a=(p=i[r]).toJSON();\"\"!==p.name&&(a.name=p.name),e.data.attributes[r]=a}var o={},s=!1;for(var r in this.morphAttributes){for(var c=this.morphAttributes[r],l=[],h=0,u=c.length;h<u;h++){var p;a=(p=c[h]).toJSON();\"\"!==p.name&&(a.name=p.name),l.push(a)}l.length>0&&(o[r]=l,s=!0)}s&&(e.data.morphAttributes=o,e.data.morphTargetsRelative=this.morphTargetsRelative);var d=this.groups;d.length>0&&(e.data.groups=JSON.parse(JSON.stringify(d)));var f=this.boundingSphere;return null!==f&&(e.data.boundingSphere={center:f.center.toArray(),radius:f.radius}),e},clone:function(){return(new Gi).copy(this)},copy:function(e){var t,r,n;this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.name=e.name;var i=e.index;null!==i&&this.setIndex(i.clone());var a=e.attributes;for(t in a){var o=a[t];this.setAttribute(t,o.clone())}var s=e.morphAttributes;for(t in s){var c=[],l=s[t];for(r=0,n=l.length;r<n;r++)c.push(l[r].clone());this.morphAttributes[t]=c}this.morphTargetsRelative=e.morphTargetsRelative;var h=e.groups;for(r=0,n=h.length;r<n;r++){var u=h[r];this.addGroup(u.start,u.count,u.materialIndex)}var p=e.boundingBox;null!==p&&(this.boundingBox=p.clone());var d=e.boundingSphere;return null!==d&&(this.boundingSphere=d.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,this},dispose:function(){this.dispatchEvent({type:\"dispose\"})}});var zi=new tn,Hi=new qn,Vi=new Un,ki=new Xr,ji=new Xr,Wi=new Xr,qi=new Xr,Xi=new Xr,Yi=new Xr,Zi=new Xr,Ji=new Xr,Qi=new Xr,Ki=new Br,$i=new Br,ea=new Br,ta=new Xr,ra=new Xr;function na(e,t){_n.call(this),this.type=\"Mesh\",this.geometry=void 0!==e?e:new Gi,this.material=void 0!==t?t:new yi,this.updateMorphTargets()}function ia(e,t,r,n,i,a,o,s){if(null===(t.side===f?n.intersectTriangle(o,a,i,!0,s):n.intersectTriangle(i,a,o,t.side!==m,s)))return null;ra.copy(s),ra.applyMatrix4(e.matrixWorld);var c=r.ray.origin.distanceTo(ra);return c<r.near||c>r.far?null:{distance:c,point:ra.clone(),object:e}}function aa(e,t,r,n,i,a,o,s,c,l,h,u){ki.fromBufferAttribute(i,l),ji.fromBufferAttribute(i,h),Wi.fromBufferAttribute(i,u);var p=e.morphTargetInfluences;if(t.morphTargets&&a&&p){Zi.set(0,0,0),Ji.set(0,0,0),Qi.set(0,0,0);for(var d=0,f=a.length;d<f;d++){var m=p[d],v=a[d];0!==m&&(qi.fromBufferAttribute(v,l),Xi.fromBufferAttribute(v,h),Yi.fromBufferAttribute(v,u),o?(Zi.addScaledVector(qi,m),Ji.addScaledVector(Xi,m),Qi.addScaledVector(Yi,m)):(Zi.addScaledVector(qi.sub(ki),m),Ji.addScaledVector(Xi.sub(ji),m),Qi.addScaledVector(Yi.sub(Wi),m)))}ki.add(Zi),ji.add(Ji),Wi.add(Qi)}var g=ia(e,t,r,n,ki,ji,Wi,ta);if(g){s&&(Ki.fromBufferAttribute(s,l),$i.fromBufferAttribute(s,h),ea.fromBufferAttribute(s,u),g.uv=si.getUV(ta,ki,ji,Wi,Ki,$i,ea,new Br)),c&&(Ki.fromBufferAttribute(c,l),$i.fromBufferAttribute(c,h),ea.fromBufferAttribute(c,u),g.uv2=si.getUV(ta,ki,ji,Wi,Ki,$i,ea,new Br));var y=new mi(l,h,u);si.getNormal(ki,ji,Wi,y.normal),g.face=y}return g}na.prototype=Object.assign(Object.create(_n.prototype),{constructor:na,isMesh:!0,copy:function(e){return _n.prototype.copy.call(this,e),void 0!==e.morphTargetInfluences&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),void 0!==e.morphTargetDictionary&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this},updateMorphTargets:function(){var e,t,r,n=this.geometry;if(n.isBufferGeometry){var i=n.morphAttributes,a=Object.keys(i);if(a.length>0){var o=i[a[0]];if(void 0!==o)for(this.morphTargetInfluences=[],this.morphTargetDictionary={},e=0,t=o.length;e<t;e++)r=o[e].name||String(e),this.morphTargetInfluences.push(0),this.morphTargetDictionary[r]=e}}else{var s=n.morphTargets;void 0!==s&&s.length>0&&console.error(\"THREE.Mesh.updateMorphTargets() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.\")}},raycast:function(e,t){var r,n=this.geometry,i=this.material,a=this.matrixWorld;if(void 0!==i&&(null===n.boundingSphere&&n.computeBoundingSphere(),Vi.copy(n.boundingSphere),Vi.applyMatrix4(a),!1!==e.ray.intersectsSphere(Vi)&&(zi.getInverse(a),Hi.copy(e.ray).applyMatrix4(zi),null===n.boundingBox||!1!==Hi.intersectsBox(n.boundingBox))))if(n.isBufferGeometry){var o,s,c,l,h,u,p,d,f,m=n.index,v=n.attributes.position,g=n.morphAttributes.position,y=n.morphTargetsRelative,x=n.attributes.uv,_=n.attributes.uv2,b=n.groups,w=n.drawRange;if(null!==m)if(Array.isArray(i))for(l=0,u=b.length;l<u;l++)for(f=i[(d=b[l]).materialIndex],h=Math.max(d.start,w.start),p=Math.min(d.start+d.count,w.start+w.count);h<p;h+=3)o=m.getX(h),s=m.getX(h+1),c=m.getX(h+2),(r=aa(this,f,e,Hi,v,g,y,x,_,o,s,c))&&(r.faceIndex=Math.floor(h\/3),r.face.materialIndex=d.materialIndex,t.push(r));else for(l=Math.max(0,w.start),u=Math.min(m.count,w.start+w.count);l<u;l+=3)o=m.getX(l),s=m.getX(l+1),c=m.getX(l+2),(r=aa(this,i,e,Hi,v,g,y,x,_,o,s,c))&&(r.faceIndex=Math.floor(l\/3),t.push(r));else if(void 0!==v)if(Array.isArray(i))for(l=0,u=b.length;l<u;l++)for(f=i[(d=b[l]).materialIndex],h=Math.max(d.start,w.start),p=Math.min(d.start+d.count,w.start+w.count);h<p;h+=3)(r=aa(this,f,e,Hi,v,g,y,x,_,o=h,s=h+1,c=h+2))&&(r.faceIndex=Math.floor(h\/3),r.face.materialIndex=d.materialIndex,t.push(r));else for(l=Math.max(0,w.start),u=Math.min(v.count,w.start+w.count);l<u;l+=3)(r=aa(this,i,e,Hi,v,g,y,x,_,o=l,s=l+1,c=l+2))&&(r.faceIndex=Math.floor(l\/3),t.push(r))}else if(n.isGeometry){var M,S,T,E,A=Array.isArray(i),L=n.vertices,R=n.faces,C=n.faceVertexUvs[0];C.length>0&&(E=C);for(var P=0,O=R.length;P<O;P++){var D=R[P],I=A?i[D.materialIndex]:i;if(void 0!==I&&(M=L[D.a],S=L[D.b],T=L[D.c],r=ia(this,I,e,Hi,M,S,T,ta))){if(E&&E[P]){var N=E[P];Ki.copy(N[0]),$i.copy(N[1]),ea.copy(N[2]),r.uv=si.getUV(ta,M,S,T,Ki,$i,ea,new Br)}r.face=D,r.faceIndex=P,t.push(r)}}}},clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}});var oa=0,sa=new tn,ca=new _n,la=new Xr;function ha(){Object.defineProperty(this,\"id\",{value:oa+=2}),this.uuid=Nr.generateUUID(),this.name=\"\",this.type=\"Geometry\",this.vertices=[],this.colors=[],this.faces=[],this.faceVertexUvs=[[]],this.morphTargets=[],this.morphNormals=[],this.skinWeights=[],this.skinIndices=[],this.lineDistances=[],this.boundingBox=null,this.boundingSphere=null,this.elementsNeedUpdate=!1,this.verticesNeedUpdate=!1,this.uvsNeedUpdate=!1,this.normalsNeedUpdate=!1,this.colorsNeedUpdate=!1,this.lineDistancesNeedUpdate=!1,this.groupsNeedUpdate=!1}ha.prototype=Object.assign(Object.create(Pr.prototype),{constructor:ha,isGeometry:!0,applyMatrix4:function(e){for(var t=(new Fr).getNormalMatrix(e),r=0,n=this.vertices.length;r<n;r++){this.vertices[r].applyMatrix4(e)}for(r=0,n=this.faces.length;r<n;r++){var i=this.faces[r];i.normal.applyMatrix3(t).normalize();for(var a=0,o=i.vertexNormals.length;a<o;a++)i.vertexNormals[a].applyMatrix3(t).normalize()}return null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this.verticesNeedUpdate=!0,this.normalsNeedUpdate=!0,this},rotateX:function(e){return sa.makeRotationX(e),this.applyMatrix4(sa),this},rotateY:function(e){return sa.makeRotationY(e),this.applyMatrix4(sa),this},rotateZ:function(e){return sa.makeRotationZ(e),this.applyMatrix4(sa),this},translate:function(e,t,r){return sa.makeTranslation(e,t,r),this.applyMatrix4(sa),this},scale:function(e,t,r){return sa.makeScale(e,t,r),this.applyMatrix4(sa),this},lookAt:function(e){return ca.lookAt(e),ca.updateMatrix(),this.applyMatrix4(ca.matrix),this},fromBufferGeometry:function(e){var t=this,r=null!==e.index?e.index.array:void 0,n=e.attributes;if(void 0===n.position)return console.error(\"THREE.Geometry.fromBufferGeometry(): Position attribute required for conversion.\"),this;var i=n.position.array,a=void 0!==n.normal?n.normal.array:void 0,o=void 0!==n.color?n.color.array:void 0,s=void 0!==n.uv?n.uv.array:void 0,c=void 0!==n.uv2?n.uv2.array:void 0;void 0!==c&&(this.faceVertexUvs[1]=[]);for(var l=0;l<i.length;l+=3)t.vertices.push((new Xr).fromArray(i,l)),void 0!==o&&t.colors.push((new ui).fromArray(o,l));function h(e,r,n,i){var l=void 0===o?[]:[t.colors[e].clone(),t.colors[r].clone(),t.colors[n].clone()],h=new mi(e,r,n,void 0===a?[]:[(new Xr).fromArray(a,3*e),(new Xr).fromArray(a,3*r),(new Xr).fromArray(a,3*n)],l,i);t.faces.push(h),void 0!==s&&t.faceVertexUvs[0].push([(new Br).fromArray(s,2*e),(new Br).fromArray(s,2*r),(new Br).fromArray(s,2*n)]),void 0!==c&&t.faceVertexUvs[1].push([(new Br).fromArray(c,2*e),(new Br).fromArray(c,2*r),(new Br).fromArray(c,2*n)])}var u=e.groups;if(u.length>0)for(l=0;l<u.length;l++)for(var p=u[l],d=p.start,f=d,m=d+p.count;f<m;f+=3)void 0!==r?h(r[f],r[f+1],r[f+2],p.materialIndex):h(f,f+1,f+2,p.materialIndex);else if(void 0!==r)for(l=0;l<r.length;l+=3)h(r[l],r[l+1],r[l+2]);else for(l=0;l<i.length\/3;l+=3)h(l,l+1,l+2);return this.computeFaceNormals(),null!==e.boundingBox&&(this.boundingBox=e.boundingBox.clone()),null!==e.boundingSphere&&(this.boundingSphere=e.boundingSphere.clone()),this},center:function(){return this.computeBoundingBox(),this.boundingBox.getCenter(la).negate(),this.translate(la.x,la.y,la.z),this},normalize:function(){this.computeBoundingSphere();var e=this.boundingSphere.center,t=this.boundingSphere.radius,r=0===t?1:1\/t,n=new tn;return n.set(r,0,0,-r*e.x,0,r,0,-r*e.y,0,0,r,-r*e.z,0,0,0,1),this.applyMatrix4(n),this},computeFaceNormals:function(){for(var e=new Xr,t=new Xr,r=0,n=this.faces.length;r<n;r++){var i=this.faces[r],a=this.vertices[i.a],o=this.vertices[i.b],s=this.vertices[i.c];e.subVectors(s,o),t.subVectors(a,o),e.cross(t),e.normalize(),i.normal.copy(e)}},computeVertexNormals:function(e){var t,r,n,i,a,o;for(void 0===e&&(e=!0),o=new Array(this.vertices.length),t=0,r=this.vertices.length;t<r;t++)o[t]=new Xr;if(e){var s,c,l,h=new Xr,u=new Xr;for(n=0,i=this.faces.length;n<i;n++)a=this.faces[n],s=this.vertices[a.a],c=this.vertices[a.b],l=this.vertices[a.c],h.subVectors(l,c),u.subVectors(s,c),h.cross(u),o[a.a].add(h),o[a.b].add(h),o[a.c].add(h)}else for(this.computeFaceNormals(),n=0,i=this.faces.length;n<i;n++)o[(a=this.faces[n]).a].add(a.normal),o[a.b].add(a.normal),o[a.c].add(a.normal);for(t=0,r=this.vertices.length;t<r;t++)o[t].normalize();for(n=0,i=this.faces.length;n<i;n++){var p=(a=this.faces[n]).vertexNormals;3===p.length?(p[0].copy(o[a.a]),p[1].copy(o[a.b]),p[2].copy(o[a.c])):(p[0]=o[a.a].clone(),p[1]=o[a.b].clone(),p[2]=o[a.c].clone())}this.faces.length>0&&(this.normalsNeedUpdate=!0)},computeFlatVertexNormals:function(){var e,t,r;for(this.computeFaceNormals(),e=0,t=this.faces.length;e<t;e++){var n=(r=this.faces[e]).vertexNormals;3===n.length?(n[0].copy(r.normal),n[1].copy(r.normal),n[2].copy(r.normal)):(n[0]=r.normal.clone(),n[1]=r.normal.clone(),n[2]=r.normal.clone())}this.faces.length>0&&(this.normalsNeedUpdate=!0)},computeMorphNormals:function(){var e,t,r,n,i;for(r=0,n=this.faces.length;r<n;r++)for((i=this.faces[r]).__originalFaceNormal?i.__originalFaceNormal.copy(i.normal):i.__originalFaceNormal=i.normal.clone(),i.__originalVertexNormals||(i.__originalVertexNormals=[]),e=0,t=i.vertexNormals.length;e<t;e++)i.__originalVertexNormals[e]?i.__originalVertexNormals[e].copy(i.vertexNormals[e]):i.__originalVertexNormals[e]=i.vertexNormals[e].clone();var a=new ha;for(a.faces=this.faces,e=0,t=this.morphTargets.length;e<t;e++){if(!this.morphNormals[e]){this.morphNormals[e]={},this.morphNormals[e].faceNormals=[],this.morphNormals[e].vertexNormals=[];var o=this.morphNormals[e].faceNormals,s=this.morphNormals[e].vertexNormals;for(r=0,n=this.faces.length;r<n;r++)c=new Xr,l={a:new Xr,b:new Xr,c:new Xr},o.push(c),s.push(l)}var c,l,h=this.morphNormals[e];for(a.vertices=this.morphTargets[e].vertices,a.computeFaceNormals(),a.computeVertexNormals(),r=0,n=this.faces.length;r<n;r++)i=this.faces[r],c=h.faceNormals[r],l=h.vertexNormals[r],c.copy(i.normal),l.a.copy(i.vertexNormals[0]),l.b.copy(i.vertexNormals[1]),l.c.copy(i.vertexNormals[2])}for(r=0,n=this.faces.length;r<n;r++)(i=this.faces[r]).normal=i.__originalFaceNormal,i.vertexNormals=i.__originalVertexNormals},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new Nn),this.boundingBox.setFromPoints(this.vertices)},computeBoundingSphere:function(){null===this.boundingSphere&&(this.boundingSphere=new Un),this.boundingSphere.setFromPoints(this.vertices)},merge:function(e,t,r){if(e&&e.isGeometry){var n,i=this.vertices.length,a=this.vertices,o=e.vertices,s=this.faces,c=e.faces,l=this.colors,h=e.colors;void 0===r&&(r=0),void 0!==t&&(n=(new Fr).getNormalMatrix(t));for(var u=0,p=o.length;u<p;u++){var d=o[u].clone();void 0!==t&&d.applyMatrix4(t),a.push(d)}for(u=0,p=h.length;u<p;u++)l.push(h[u].clone());for(u=0,p=c.length;u<p;u++){var f,m,v,g=c[u],y=g.vertexNormals,x=g.vertexColors;(f=new mi(g.a+i,g.b+i,g.c+i)).normal.copy(g.normal),void 0!==n&&f.normal.applyMatrix3(n).normalize();for(var _=0,b=y.length;_<b;_++)m=y[_].clone(),void 0!==n&&m.applyMatrix3(n).normalize(),f.vertexNormals.push(m);f.color.copy(g.color);for(_=0,b=x.length;_<b;_++)v=x[_],f.vertexColors.push(v.clone());f.materialIndex=g.materialIndex+r,s.push(f)}for(u=0,p=e.faceVertexUvs.length;u<p;u++){var w=e.faceVertexUvs[u];void 0===this.faceVertexUvs[u]&&(this.faceVertexUvs[u]=[]);for(_=0,b=w.length;_<b;_++){for(var M=w[_],S=[],T=0,E=M.length;T<E;T++)S.push(M[T].clone());this.faceVertexUvs[u].push(S)}}}else console.error(\"THREE.Geometry.merge(): geometry not an instance of THREE.Geometry.\",e)},mergeMesh:function(e){e&&e.isMesh?(e.matrixAutoUpdate&&e.updateMatrix(),this.merge(e.geometry,e.matrix)):console.error(\"THREE.Geometry.mergeMesh(): mesh not an instance of THREE.Mesh.\",e)},mergeVertices:function(){var e,t,r,n,i,a,o,s,c={},l=[],h=[],u=Math.pow(10,4);for(r=0,n=this.vertices.length;r<n;r++)e=this.vertices[r],void 0===c[t=Math.round(e.x*u)+\"_\"+Math.round(e.y*u)+\"_\"+Math.round(e.z*u)]?(c[t]=r,l.push(this.vertices[r]),h[r]=l.length-1):h[r]=h[c[t]];var p=[];for(r=0,n=this.faces.length;r<n;r++){(i=this.faces[r]).a=h[i.a],i.b=h[i.b],i.c=h[i.c],a=[i.a,i.b,i.c];for(var d=0;d<3;d++)if(a[d]===a[(d+1)%3]){p.push(r);break}}for(r=p.length-1;r>=0;r--){var f=p[r];for(this.faces.splice(f,1),o=0,s=this.faceVertexUvs.length;o<s;o++)this.faceVertexUvs[o].splice(f,1)}var m=this.vertices.length-l.length;return this.vertices=l,m},setFromPoints:function(e){this.vertices=[];for(var t=0,r=e.length;t<r;t++){var n=e[t];this.vertices.push(new Xr(n.x,n.y,n.z||0))}return this},sortFacesByMaterialIndex:function(){for(var e=this.faces,t=e.length,r=0;r<t;r++)e[r]._id=r;e.sort(function(e,t){return e.materialIndex-t.materialIndex});var n,i,a=this.faceVertexUvs[0],o=this.faceVertexUvs[1];a&&a.length===t&&(n=[]),o&&o.length===t&&(i=[]);for(r=0;r<t;r++){var s=e[r]._id;n&&n.push(a[s]),i&&i.push(o[s])}n&&(this.faceVertexUvs[0]=n),i&&(this.faceVertexUvs[1]=i)},toJSON:function(){var e={metadata:{version:4.5,type:\"Geometry\",generator:\"Geometry.toJSON\"}};if(e.uuid=this.uuid,e.type=this.type,\"\"!==this.name&&(e.name=this.name),void 0!==this.parameters){var t=this.parameters;for(var r in t)void 0!==t[r]&&(e[r]=t[r]);return e}for(var n=[],i=0;i<this.vertices.length;i++){var a=this.vertices[i];n.push(a.x,a.y,a.z)}var o=[],s=[],c={},l=[],h={},u=[],p={};for(i=0;i<this.faces.length;i++){var d=this.faces[i],f=void 0!==this.faceVertexUvs[0][i],m=d.normal.length()>0,v=d.vertexNormals.length>0,g=1!==d.color.r||1!==d.color.g||1!==d.color.b,y=d.vertexColors.length>0,x=0;if(x=M(x,0,0),x=M(x,1,!0),x=M(x,2,!1),x=M(x,3,f),x=M(x,4,m),x=M(x,5,v),x=M(x,6,g),x=M(x,7,y),o.push(x),o.push(d.a,d.b,d.c),o.push(d.materialIndex),f){var _=this.faceVertexUvs[0][i];o.push(E(_[0]),E(_[1]),E(_[2]))}if(m&&o.push(S(d.normal)),v){var b=d.vertexNormals;o.push(S(b[0]),S(b[1]),S(b[2]))}if(g&&o.push(T(d.color)),y){var w=d.vertexColors;o.push(T(w[0]),T(w[1]),T(w[2]))}}function M(e,t,r){return r?e|1<<t:e&~(1<<t)}function S(e){var t=e.x.toString()+e.y.toString()+e.z.toString();return void 0!==c[t]?c[t]:(c[t]=s.length\/3,s.push(e.x,e.y,e.z),c[t])}function T(e){var t=e.r.toString()+e.g.toString()+e.b.toString();return void 0!==h[t]?h[t]:(h[t]=l.length,l.push(e.getHex()),h[t])}function E(e){var t=e.x.toString()+e.y.toString();return void 0!==p[t]?p[t]:(p[t]=u.length\/2,u.push(e.x,e.y),p[t])}return e.data={},e.data.vertices=n,e.data.normals=s,l.length>0&&(e.data.colors=l),u.length>0&&(e.data.uvs=[u]),e.data.faces=o,e},clone:function(){return(new ha).copy(this)},copy:function(e){var t,r,n,i,a,o;this.vertices=[],this.colors=[],this.faces=[],this.faceVertexUvs=[[]],this.morphTargets=[],this.morphNormals=[],this.skinWeights=[],this.skinIndices=[],this.lineDistances=[],this.boundingBox=null,this.boundingSphere=null,this.name=e.name;var s=e.vertices;for(t=0,r=s.length;t<r;t++)this.vertices.push(s[t].clone());var c=e.colors;for(t=0,r=c.length;t<r;t++)this.colors.push(c[t].clone());var l=e.faces;for(t=0,r=l.length;t<r;t++)this.faces.push(l[t].clone());for(t=0,r=e.faceVertexUvs.length;t<r;t++){var h=e.faceVertexUvs[t];for(void 0===this.faceVertexUvs[t]&&(this.faceVertexUvs[t]=[]),n=0,i=h.length;n<i;n++){var u=h[n],p=[];for(a=0,o=u.length;a<o;a++){var d=u[a];p.push(d.clone())}this.faceVertexUvs[t].push(p)}}var f=e.morphTargets;for(t=0,r=f.length;t<r;t++){var m={};if(m.name=f[t].name,void 0!==f[t].vertices)for(m.vertices=[],n=0,i=f[t].vertices.length;n<i;n++)m.vertices.push(f[t].vertices[n].clone());if(void 0!==f[t].normals)for(m.normals=[],n=0,i=f[t].normals.length;n<i;n++)m.normals.push(f[t].normals[n].clone());this.morphTargets.push(m)}var v=e.morphNormals;for(t=0,r=v.length;t<r;t++){var g={};if(void 0!==v[t].vertexNormals)for(g.vertexNormals=[],n=0,i=v[t].vertexNormals.length;n<i;n++){var y=v[t].vertexNormals[n],x={};x.a=y.a.clone(),x.b=y.b.clone(),x.c=y.c.clone(),g.vertexNormals.push(x)}if(void 0!==v[t].faceNormals)for(g.faceNormals=[],n=0,i=v[t].faceNormals.length;n<i;n++)g.faceNormals.push(v[t].faceNormals[n].clone());this.morphNormals.push(g)}var _=e.skinWeights;for(t=0,r=_.length;t<r;t++)this.skinWeights.push(_[t].clone());var b=e.skinIndices;for(t=0,r=b.length;t<r;t++)this.skinIndices.push(b[t].clone());var w=e.lineDistances;for(t=0,r=w.length;t<r;t++)this.lineDistances.push(w[t]);var M=e.boundingBox;null!==M&&(this.boundingBox=M.clone());var S=e.boundingSphere;return null!==S&&(this.boundingSphere=S.clone()),this.elementsNeedUpdate=e.elementsNeedUpdate,this.verticesNeedUpdate=e.verticesNeedUpdate,this.uvsNeedUpdate=e.uvsNeedUpdate,this.normalsNeedUpdate=e.normalsNeedUpdate,this.colorsNeedUpdate=e.colorsNeedUpdate,this.lineDistancesNeedUpdate=e.lineDistancesNeedUpdate,this.groupsNeedUpdate=e.groupsNeedUpdate,this},dispose:function(){this.dispatchEvent({type:\"dispose\"})}});class ua extends ha{constructor(e,t,r,n,i,a){super(),this.type=\"BoxGeometry\",this.parameters={width:e,height:t,depth:r,widthSegments:n,heightSegments:i,depthSegments:a},this.fromBufferGeometry(new pa(e,t,r,n,i,a)),this.mergeVertices()}}exports.CubeGeometry=exports.BoxGeometry=ua;class pa extends Gi{constructor(e,t,r,n,i,a){super(),this.type=\"BoxBufferGeometry\",this.parameters={width:e,height:t,depth:r,widthSegments:n,heightSegments:i,depthSegments:a};var o=this;e=e||1,t=t||1,r=r||1,n=Math.floor(n)||1,i=Math.floor(i)||1,a=Math.floor(a)||1;var s=[],c=[],l=[],h=[],u=0,p=0;function d(e,t,r,n,i,a,d,f,m,v,g){var y,x,_=a\/m,b=d\/v,w=a\/2,M=d\/2,S=f\/2,T=m+1,E=v+1,A=0,L=0,R=new Xr;for(x=0;x<E;x++){var C=x*b-M;for(y=0;y<T;y++){var P=y*_-w;R[e]=P*n,R[t]=C*i,R[r]=S,c.push(R.x,R.y,R.z),R[e]=0,R[t]=0,R[r]=f>0?1:-1,l.push(R.x,R.y,R.z),h.push(y\/m),h.push(1-x\/v),A+=1}}for(x=0;x<v;x++)for(y=0;y<m;y++){var O=u+y+T*x,D=u+y+T*(x+1),I=u+(y+1)+T*(x+1),N=u+(y+1)+T*x;s.push(O,D,N),s.push(D,I,N),L+=6}o.addGroup(p,L,g),p+=L,u+=A}d(\"z\",\"y\",\"x\",-1,-1,r,t,e,a,i,0),d(\"z\",\"y\",\"x\",1,-1,r,t,-e,a,i,1),d(\"x\",\"z\",\"y\",1,1,e,r,t,n,a,2),d(\"x\",\"z\",\"y\",1,-1,e,r,-t,n,a,3),d(\"x\",\"y\",\"z\",1,-1,e,t,r,n,i,4),d(\"x\",\"y\",\"z\",-1,-1,e,t,-r,n,i,5),this.setIndex(s),this.setAttribute(\"position\",new Li(c,3)),this.setAttribute(\"normal\",new Li(l,3)),this.setAttribute(\"uv\",new Li(h,2))}}function da(e){var t={};for(var r in e)for(var n in t[r]={},e[r]){var i=e[r][n];i&&(i.isColor||i.isMatrix3||i.isMatrix4||i.isVector2||i.isVector3||i.isVector4||i.isTexture)?t[r][n]=i.clone():Array.isArray(i)?t[r][n]=i.slice():t[r][n]=i}return t}function fa(e){for(var t={},r=0;r<e.length;r++){var n=da(e[r]);for(var i in n)t[i]=n[i]}return t}exports.BoxBufferGeometry=pa;var ma={clone:da,merge:fa};exports.UniformsUtils=ma;var va=\"void main() {ntgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );n}\",ga=\"void main() {ntgl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );n}\";function ya(e){gi.call(this),this.type=\"ShaderMaterial\",this.defines={},this.uniforms={},this.vertexShader=va,this.fragmentShader=ga,this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.extensions={derivatives:!1,fragDepth:!1,drawBuffers:!1,shaderTextureLOD:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv2:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,void 0!==e&&(void 0!==e.attributes&&console.error(\"THREE.ShaderMaterial: attributes should now be defined in THREE.BufferGeometry instead.\"),this.setValues(e))}function xa(){_n.call(this),this.type=\"Camera\",this.matrixWorldInverse=new tn,this.projectionMatrix=new tn,this.projectionMatrixInverse=new tn}function _a(e,t,r,n){xa.call(this),this.type=\"PerspectiveCamera\",this.fov=void 0!==e?e:50,this.zoom=1,this.near=void 0!==r?r:.1,this.far=void 0!==n?n:2e3,this.focus=10,this.aspect=void 0!==t?t:1,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}ya.prototype=Object.create(gi.prototype),ya.prototype.constructor=ya,ya.prototype.isShaderMaterial=!0,ya.prototype.copy=function(e){return gi.prototype.copy.call(this,e),this.fragmentShader=e.fragmentShader,this.vertexShader=e.vertexShader,this.uniforms=da(e.uniforms),this.defines=Object.assign({},e.defines),this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.lights=e.lights,this.clipping=e.clipping,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this.extensions=e.extensions,this},ya.prototype.toJSON=function(e){var t=gi.prototype.toJSON.call(this,e);for(var r in t.uniforms={},this.uniforms){var n=this.uniforms[r].value;n&&n.isTexture?t.uniforms[r]={type:\"t\",value:n.toJSON(e).uuid}:n&&n.isColor?t.uniforms[r]={type:\"c\",value:n.getHex()}:n&&n.isVector2?t.uniforms[r]={type:\"v2\",value:n.toArray()}:n&&n.isVector3?t.uniforms[r]={type:\"v3\",value:n.toArray()}:n&&n.isVector4?t.uniforms[r]={type:\"v4\",value:n.toArray()}:n&&n.isMatrix3?t.uniforms[r]={type:\"m3\",value:n.toArray()}:n&&n.isMatrix4?t.uniforms[r]={type:\"m4\",value:n.toArray()}:t.uniforms[r]={value:n}}Object.keys(this.defines).length>0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader;var i={};for(var a in this.extensions)!0===this.extensions[a]&&(i[a]=!0);return Object.keys(i).length>0&&(t.extensions=i),t},xa.prototype=Object.assign(Object.create(_n.prototype),{constructor:xa,isCamera:!0,copy:function(e,t){return _n.prototype.copy.call(this,e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this},getWorldDirection:function(e){void 0===e&&(console.warn(\"THREE.Camera: .getWorldDirection() target is now required\"),e=new Xr),this.updateMatrixWorld(!0);var t=this.matrixWorld.elements;return e.set(-t[8],-t[9],-t[10]).normalize()},updateMatrixWorld:function(e){_n.prototype.updateMatrixWorld.call(this,e),this.matrixWorldInverse.getInverse(this.matrixWorld)},updateWorldMatrix:function(e,t){_n.prototype.updateWorldMatrix.call(this,e,t),this.matrixWorldInverse.getInverse(this.matrixWorld)},clone:function(){return(new this.constructor).copy(this)}}),_a.prototype=Object.assign(Object.create(xa.prototype),{constructor:_a,isPerspectiveCamera:!0,copy:function(e,t){return xa.prototype.copy.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},setFocalLength:function(e){var t=.5*this.getFilmHeight()\/e;this.fov=2*Nr.RAD2DEG*Math.atan(t),this.updateProjectionMatrix()},getFocalLength:function(){var e=Math.tan(.5*Nr.DEG2RAD*this.fov);return.5*this.getFilmHeight()\/e},getEffectiveFOV:function(){return 2*Nr.RAD2DEG*Math.atan(Math.tan(.5*Nr.DEG2RAD*this.fov)\/this.zoom)},getFilmWidth:function(){return this.filmGauge*Math.min(this.aspect,1)},getFilmHeight:function(){return this.filmGauge\/Math.max(this.aspect,1)},setViewOffset:function(e,t,r,n,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=r,this.view.offsetY=n,this.view.width=i,this.view.height=a,this.updateProjectionMatrix()},clearViewOffset:function(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()},updateProjectionMatrix:function(){var e=this.near,t=e*Math.tan(.5*Nr.DEG2RAD*this.fov)\/this.zoom,r=2*t,n=this.aspect*r,i=-.5*n,a=this.view;if(null!==this.view&&this.view.enabled){var o=a.fullWidth,s=a.fullHeight;i+=a.offsetX*n\/o,t-=a.offsetY*r\/s,n*=a.width\/o,r*=a.height\/s}var c=this.filmOffset;0!==c&&(i+=e*c\/this.getFilmWidth()),this.projectionMatrix.makePerspective(i,i+n,t,t-r,e,this.far),this.projectionMatrixInverse.getInverse(this.projectionMatrix)},toJSON:function(e){var t=_n.prototype.toJSON.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}});var ba=90,wa=1;function Ma(e,t,r,n){_n.call(this),this.type=\"CubeCamera\";var i=new _a(ba,wa,e,t);i.up.set(0,-1,0),i.lookAt(new Xr(1,0,0)),this.add(i);var a=new _a(ba,wa,e,t);a.up.set(0,-1,0),a.lookAt(new Xr(-1,0,0)),this.add(a);var o=new _a(ba,wa,e,t);o.up.set(0,0,1),o.lookAt(new Xr(0,1,0)),this.add(o);var s=new _a(ba,wa,e,t);s.up.set(0,0,-1),s.lookAt(new Xr(0,-1,0)),this.add(s);var c=new _a(ba,wa,e,t);c.up.set(0,-1,0),c.lookAt(new Xr(0,0,1)),this.add(c);var l=new _a(ba,wa,e,t);l.up.set(0,-1,0),l.lookAt(new Xr(0,0,-1)),this.add(l),n=n||{format:Fe,magFilter:xe,minFilter:xe},this.renderTarget=new Sa(r,n),this.renderTarget.texture.name=\"CubeCamera\",this.update=function(e,t){null===this.parent&&this.updateMatrixWorld();var r=e.getRenderTarget(),n=this.renderTarget,h=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,c),n.texture.generateMipmaps=h,e.setRenderTarget(n,5),e.render(t,l),e.setRenderTarget(r)},this.clear=function(e,t,r,n){for(var i=e.getRenderTarget(),a=this.renderTarget,o=0;o<6;o++)e.setRenderTarget(a,o),e.clear(t,r,n);e.setRenderTarget(i)}}function Sa(e,t,r){Number.isInteger(t)&&(console.warn(\"THREE.WebGLCubeRenderTarget: constructor signature is now WebGLCubeRenderTarget( size, options )\"),t=r),Vr.call(this,e,e,t)}function Ta(e,t,r,n,i,a,o,s,c,l,h,u){zr.call(this,null,a,o,s,c,l,n,i,h,u),this.image={data:e||null,width:t||1,height:r||1},this.magFilter=void 0!==c?c:fe,this.minFilter=void 0!==l?l:fe,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.needsUpdate=!0}Ma.prototype=Object.create(_n.prototype),Ma.prototype.constructor=Ma,Sa.prototype=Object.create(Vr.prototype),Sa.prototype.constructor=Sa,Sa.prototype.isWebGLCubeRenderTarget=!0,Sa.prototype.fromEquirectangularTexture=function(e,t){this.texture.type=t.type,this.texture.format=t.format,this.texture.encoding=t.encoding;var r=new bn,n={uniforms:{tEquirect:{value:null}},vertexShader:[\"varying vec3 vWorldDirection;\",\"vec3 transformDirection( in vec3 dir, in mat4 matrix ) {\",\"treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\",\"}\",\"void main() {\",\"tvWorldDirection = transformDirection( position, modelMatrix );\",\"t#include <begin_vertex>\",\"t#include <project_vertex>\",\"}\"].join(\"n\"),fragmentShader:[\"uniform sampler2D tEquirect;\",\"varying vec3 vWorldDirection;\",\"#define RECIPROCAL_PI 0.31830988618\",\"#define RECIPROCAL_PI2 0.15915494\",\"void main() {\",\"tvec3 direction = normalize( vWorldDirection );\",\"tvec2 sampleUV;\",\"tsampleUV.y = asin( clamp( direction.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\",\"tsampleUV.x = atan( direction.z, direction.x ) * RECIPROCAL_PI2 + 0.5;\",\"tgl_FragColor = texture2D( tEquirect, sampleUV );\",\"}\"].join(\"n\")},i=new ya({type:\"CubemapFromEquirect\",uniforms:da(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:f,blending:y});i.uniforms.tEquirect.value=t;var a=new na(new pa(5,5,5),i);r.add(a);var o=new Ma(1,10,1);return o.renderTarget=this,o.renderTarget.texture.name=\"CubeCameraTexture\",o.update(e,r),a.geometry.dispose(),a.material.dispose(),this},Ta.prototype=Object.create(zr.prototype),Ta.prototype.constructor=Ta,Ta.prototype.isDataTexture=!0;var Ea=new Un,Aa=new Xr;function La(e,t,r,n,i,a){this.planes=[void 0!==e?e:new Jn,void 0!==t?t:new Jn,void 0!==r?r:new Jn,void 0!==n?n:new Jn,void 0!==i?i:new Jn,void 0!==a?a:new Jn]}Object.assign(La.prototype,{set:function(e,t,r,n,i,a){var o=this.planes;return o[0].copy(e),o[1].copy(t),o[2].copy(r),o[3].copy(n),o[4].copy(i),o[5].copy(a),this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){for(var t=this.planes,r=0;r<6;r++)t[r].copy(e.planes[r]);return this},setFromProjectionMatrix:function(e){var t=this.planes,r=e.elements,n=r[0],i=r[1],a=r[2],o=r[3],s=r[4],c=r[5],l=r[6],h=r[7],u=r[8],p=r[9],d=r[10],f=r[11],m=r[12],v=r[13],g=r[14],y=r[15];return t[0].setComponents(o-n,h-s,f-u,y-m).normalize(),t[1].setComponents(o+n,h+s,f+u,y+m).normalize(),t[2].setComponents(o+i,h+c,f+p,y+v).normalize(),t[3].setComponents(o-i,h-c,f-p,y-v).normalize(),t[4].setComponents(o-a,h-l,f-d,y-g).normalize(),t[5].setComponents(o+a,h+l,f+d,y+g).normalize(),this},intersectsObject:function(e){var t=e.geometry;return null===t.boundingSphere&&t.computeBoundingSphere(),Ea.copy(t.boundingSphere).applyMatrix4(e.matrixWorld),this.intersectsSphere(Ea)},intersectsSprite:function(e){return Ea.center.set(0,0,0),Ea.radius=.7071067811865476,Ea.applyMatrix4(e.matrixWorld),this.intersectsSphere(Ea)},intersectsSphere:function(e){for(var t=this.planes,r=e.center,n=-e.radius,i=0;i<6;i++){if(t[i].distanceToPoint(r)<n)return!1}return!0},intersectsBox:function(e){for(var t=this.planes,r=0;r<6;r++){var n=t[r];if(Aa.x=n.normal.x>0?e.max.x:e.min.x,Aa.y=n.normal.y>0?e.max.y:e.min.y,Aa.z=n.normal.z>0?e.max.z:e.min.z,n.distanceToPoint(Aa)<0)return!1}return!0},containsPoint:function(e){for(var t=this.planes,r=0;r<6;r++)if(t[r].distanceToPoint(e)<0)return!1;return!0}});var Ra={common:{diffuse:{value:new ui(15658734)},opacity:{value:1},map:{value:null},uvTransform:{value:new Fr},uv2Transform:{value:new Fr},alphaMap:{value:null}},specularmap:{specularMap:{value:null}},envmap:{envMap:{value:null},flipEnvMap:{value:-1},reflectivity:{value:1},refractionRatio:{value:.98},maxMipLevel:{value:0}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1}},emissivemap:{emissiveMap:{value:null}},bumpmap:{bumpMap:{value:null},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalScale:{value:new Br(1,1)}},displacementmap:{displacementMap:{value:null},displacementScale:{value:1},displacementBias:{value:0}},roughnessmap:{roughnessMap:{value:null}},metalnessmap:{metalnessMap:{value:null}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new ui(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowBias:{},shadowRadius:{},shadowMapSize:{}}},spotShadowMap:{value:[]},spotShadowMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}}},points:{diffuse:{value:new ui(15658734)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},uvTransform:{value:new Fr}},sprite:{diffuse:{value:new ui(15658734)},opacity:{value:1},center:{value:new Br(.5,.5)},rotation:{value:0},map:{value:null},alphaMap:{value:null},uvTransform:{value:new Fr}}};function Ca(){var e=null,t=!1,r=null;function n(i,a){!1!==t&&(r(i,a),e.requestAnimationFrame(n))}return{start:function(){!0!==t&&null!==r&&(e.requestAnimationFrame(n),t=!0)},stop:function(){t=!1},setAnimationLoop:function(e){r=e},setContext:function(t){e=t}}}function Pa(e,t){var r=t.isWebGL2,n=new WeakMap;return{get:function(e){return e.isInterleavedBufferAttribute&&(e=e.data),n.get(e)},remove:function(t){t.isInterleavedBufferAttribute&&(t=t.data);var r=n.get(t);r&&(e.deleteBuffer(r.buffer),n.delete(t))},update:function(t,i){t.isInterleavedBufferAttribute&&(t=t.data);var a=n.get(t);void 0===a?n.set(t,function(t,r){var n=t.array,i=t.usage,a=e.createBuffer();e.bindBuffer(r,a),e.bufferData(r,n,i),t.onUploadCallback();var o=5126;return n instanceof Float32Array?o=5126:n instanceof Float64Array?console.warn(\"THREE.WebGLAttributes: Unsupported data buffer format: Float64Array.\"):n instanceof Uint16Array?o=5123:n instanceof Int16Array?o=5122:n instanceof Uint32Array?o=5125:n instanceof Int32Array?o=5124:n instanceof Int8Array?o=5120:n instanceof Uint8Array&&(o=5121),{buffer:a,type:o,bytesPerElement:n.BYTES_PER_ELEMENT,version:t.version}}(t,i)):a.version<t.version&&(function(t,n,i){var a=n.array,o=n.updateRange;e.bindBuffer(i,t),-1===o.count?e.bufferSubData(i,0,a):(r?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)}(a.buffer,t,i),a.version=t.version)}}}function Oa(e,t,r,n){ha.call(this),this.type=\"PlaneGeometry\",this.parameters={width:e,height:t,widthSegments:r,heightSegments:n},this.fromBufferGeometry(new Da(e,t,r,n)),this.mergeVertices()}function Da(e,t,r,n){Gi.call(this),this.type=\"PlaneBufferGeometry\",this.parameters={width:e,height:t,widthSegments:r,heightSegments:n};var i,a,o=(e=e||1)\/2,s=(t=t||1)\/2,c=Math.floor(r)||1,l=Math.floor(n)||1,h=c+1,u=l+1,p=e\/c,d=t\/l,f=[],m=[],v=[],g=[];for(a=0;a<u;a++){var y=a*d-s;for(i=0;i<h;i++){var x=i*p-o;m.push(x,-y,0),v.push(0,0,1),g.push(i\/c),g.push(1-a\/l)}}for(a=0;a<l;a++)for(i=0;i<c;i++){var _=i+h*a,b=i+h*(a+1),w=i+1+h*(a+1),M=i+1+h*a;f.push(_,b,M),f.push(b,w,M)}this.setIndex(f),this.setAttribute(\"position\",new Li(m,3)),this.setAttribute(\"normal\",new Li(v,3)),this.setAttribute(\"uv\",new Li(g,2))}exports.UniformsLib=Ra,Oa.prototype=Object.create(ha.prototype),Oa.prototype.constructor=Oa,Da.prototype=Object.create(Gi.prototype),Da.prototype.constructor=Da;var Ia=\"#ifdef USE_ALPHAMAPntdiffuseColor.a *= texture2D( alphaMap, vUv ).g;n#endif\",Na=\"#ifdef USE_ALPHAMAPntuniform sampler2D alphaMap;n#endif\",Ba=\"#ifdef ALPHATESTntif ( diffuseColor.a < ALPHATEST ) discard;n#endif\",Fa=\"#ifdef USE_AOMAPntfloat ambientOcclusion = ( texture2D( aoMap, vUv2 ).r - 1.0 ) * aoMapIntensity + 1.0;ntreflectedLight.indirectDiffuse *= ambientOcclusion;nt#if defined( USE_ENVMAP ) && defined( STANDARD )nttfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );nttreflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.specularRoughness );nt#endifn#endif\",Ua=\"#ifdef USE_AOMAPntuniform sampler2D aoMap;ntuniform float aoMapIntensity;n#endif\",Ga=\"vec3 transformed = vec3( position );\",za=\"vec3 objectNormal = vec3( normal );n#ifdef USE_TANGENTntvec3 objectTangent = vec3( tangent.xyz );n#endif\",Ha=\"vec2 integrateSpecularBRDF( const in float dotNV, const in float roughness ) {ntconst vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );ntconst vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );ntvec4 r = roughness * c0 + c1;ntfloat a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;ntreturn vec2( -1.04, 1.04 ) * a004 + r.zw;n}nfloat punctualLightIntensityToIrradianceFactor( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {n#if defined ( PHYSICALLY_CORRECT_LIGHTS )ntfloat distanceFalloff = 1.0 \/ max( pow( lightDistance, decayExponent ), 0.01 );ntif( cutoffDistance > 0.0 ) {nttdistanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance \/ cutoffDistance ) ) );nt}ntreturn distanceFalloff;n#elsentif( cutoffDistance > 0.0 && decayExponent > 0.0 ) {nttreturn pow( saturate( -lightDistance \/ cutoffDistance + 1.0 ), decayExponent );nt}ntreturn 1.0;n#endifn}nvec3 BRDF_Diffuse_Lambert( const in vec3 diffuseColor ) {ntreturn RECIPROCAL_PI * diffuseColor;n}nvec3 F_Schlick( const in vec3 specularColor, const in float dotLH ) {ntfloat fresnel = exp2( ( -5.55473 * dotLH - 6.98316 ) * dotLH );ntreturn ( 1.0 - specularColor ) * fresnel + specularColor;n}nvec3 F_Schlick_RoughnessDependent( const in vec3 F0, const in float dotNV, const in float roughness ) {ntfloat fresnel = exp2( ( -5.55473 * dotNV - 6.98316 ) * dotNV );ntvec3 Fr = max( vec3( 1.0 - roughness ), F0 ) - F0;ntreturn Fr * fresnel + F0;n}nfloat G_GGX_Smith( const in float alpha, const in float dotNL, const in float dotNV ) {ntfloat a2 = pow2( alpha );ntfloat gl = dotNL + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );ntfloat gv = dotNV + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );ntreturn 1.0 \/ ( gl * gv );n}nfloat G_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {ntfloat a2 = pow2( alpha );ntfloat gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );ntfloat gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );ntreturn 0.5 \/ max( gv + gl, EPSILON );n}nfloat D_GGX( const in float alpha, const in float dotNH ) {ntfloat a2 = pow2( alpha );ntfloat denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;ntreturn RECIPROCAL_PI * a2 \/ pow2( denom );n}nvec3 BRDF_Specular_GGX( const in IncidentLight incidentLight, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float roughness ) {ntfloat alpha = pow2( roughness );ntvec3 halfDir = normalize( incidentLight.direction + viewDir );ntfloat dotNL = saturate( dot( normal, incidentLight.direction ) );ntfloat dotNV = saturate( dot( normal, viewDir ) );ntfloat dotNH = saturate( dot( normal, halfDir ) );ntfloat dotLH = saturate( dot( incidentLight.direction, halfDir ) );ntvec3 F = F_Schlick( specularColor, dotLH );ntfloat G = G_GGX_SmithCorrelated( alpha, dotNL, dotNV );ntfloat D = D_GGX( alpha, dotNH );ntreturn F * ( G * D );n}nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {ntconst float LUT_SIZE  = 64.0;ntconst float LUT_SCALE = ( LUT_SIZE - 1.0 ) \/ LUT_SIZE;ntconst float LUT_BIAS  = 0.5 \/ LUT_SIZE;ntfloat dotNV = saturate( dot( N, V ) );ntvec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );ntuv = uv * LUT_SCALE + LUT_BIAS;ntreturn uv;n}nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {ntfloat l = length( f );ntreturn max( ( l * l + f.z ) \/ ( l + 1.0 ), 0.0 );n}nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {ntfloat x = dot( v1, v2 );ntfloat y = abs( x );ntfloat a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;ntfloat b = 3.4175940 + ( 4.1616724 + y ) * y;ntfloat v = a \/ b;ntfloat theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;ntreturn 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 ] ) {ntvec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];ntvec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];ntvec3 lightNormal = cross( v1, v2 );ntif( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );ntvec3 T1, T2;ntT1 = normalize( V - N * dot( V, N ) );ntT2 = - cross( N, T1 );ntmat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );ntvec3 coords[ 4 ];ntcoords[ 0 ] = mat * ( rectCoords[ 0 ] - P );ntcoords[ 1 ] = mat * ( rectCoords[ 1 ] - P );ntcoords[ 2 ] = mat * ( rectCoords[ 2 ] - P );ntcoords[ 3 ] = mat * ( rectCoords[ 3 ] - P );ntcoords[ 0 ] = normalize( coords[ 0 ] );ntcoords[ 1 ] = normalize( coords[ 1 ] );ntcoords[ 2 ] = normalize( coords[ 2 ] );ntcoords[ 3 ] = normalize( coords[ 3 ] );ntvec3 vectorFormFactor = vec3( 0.0 );ntvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );ntvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );ntvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );ntvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );ntfloat result = LTC_ClippedSphereFormFactor( vectorFormFactor );ntreturn vec3( result );n}nvec3 BRDF_Specular_GGX_Environment( const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float roughness ) {ntfloat dotNV = saturate( dot( normal, viewDir ) );ntvec2 brdf = integrateSpecularBRDF( dotNV, roughness );ntreturn specularColor * brdf.x + brdf.y;n}nvoid BRDF_Specular_Multiscattering_Environment( const in GeometricContext geometry, const in vec3 specularColor, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {ntfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );ntvec3 F = F_Schlick_RoughnessDependent( specularColor, dotNV, roughness );ntvec2 brdf = integrateSpecularBRDF( dotNV, roughness );ntvec3 FssEss = F * brdf.x + brdf.y;ntfloat Ess = brdf.x + brdf.y;ntfloat Ems = 1.0 - Ess;ntvec3 Favg = specularColor + ( 1.0 - specularColor ) * 0.047619;tvec3 Fms = FssEss * Favg \/ ( 1.0 - Ems * Favg );ntsingleScatter += FssEss;ntmultiScatter += Fms * Ems;n}nfloat G_BlinnPhong_Implicit( ) {ntreturn 0.25;n}nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {ntreturn RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );n}nvec3 BRDF_Specular_BlinnPhong( const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float shininess ) {ntvec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );ntfloat dotNH = saturate( dot( geometry.normal, halfDir ) );ntfloat dotLH = saturate( dot( incidentLight.direction, halfDir ) );ntvec3 F = F_Schlick( specularColor, dotLH );ntfloat G = G_BlinnPhong_Implicit( );ntfloat D = D_BlinnPhong( shininess, dotNH );ntreturn F * ( G * D );n}nfloat GGXRoughnessToBlinnExponent( const in float ggxRoughness ) {ntreturn ( 2.0 \/ pow2( ggxRoughness + 0.0001 ) - 2.0 );n}nfloat BlinnExponentToGGXRoughness( const in float blinnExponent ) {ntreturn sqrt( 2.0 \/ ( blinnExponent + 2.0 ) );n}n#if defined( USE_SHEEN )nfloat D_Charlie(float roughness, float NoH) {ntfloat invAlpha  = 1.0 \/ roughness;ntfloat cos2h = NoH * NoH;ntfloat sin2h = max(1.0 - cos2h, 0.0078125);treturn (2.0 + invAlpha) * pow(sin2h, invAlpha * 0.5) \/ (2.0 * PI);n}nfloat V_Neubelt(float NoV, float NoL) {ntreturn saturate(1.0 \/ (4.0 * (NoL + NoV - NoL * NoV)));n}nvec3 BRDF_Specular_Sheen( const in float roughness, const in vec3 L, const in GeometricContext geometry, vec3 specularColor ) {ntvec3 N = geometry.normal;ntvec3 V = geometry.viewDir;ntvec3 H = normalize( V + L );ntfloat dotNH = saturate( dot( N, H ) );ntreturn specularColor * D_Charlie( roughness, dotNH ) * V_Neubelt( dot(N, V), dot(N, L) );n}n#endif\",Va=\"#ifdef USE_BUMPMAPntuniform sampler2D bumpMap;ntuniform float bumpScale;ntvec2 dHdxy_fwd() {nttvec2 dSTdx = dFdx( vUv );nttvec2 dSTdy = dFdy( vUv );nttfloat Hll = bumpScale * texture2D( bumpMap, vUv ).x;nttfloat dBx = bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll;nttfloat dBy = bumpScale * texture2D( bumpMap, vUv + dSTdy ).x - Hll;nttreturn vec2( dBx, dBy );nt}ntvec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy ) {nttvec3 vSigmaX = vec3( dFdx( surf_pos.x ), dFdx( surf_pos.y ), dFdx( surf_pos.z ) );nttvec3 vSigmaY = vec3( dFdy( surf_pos.x ), dFdy( surf_pos.y ), dFdy( surf_pos.z ) );nttvec3 vN = surf_norm;nttvec3 R1 = cross( vSigmaY, vN );nttvec3 R2 = cross( vN, vSigmaX );nttfloat fDet = dot( vSigmaX, R1 );nttfDet *= ( float( gl_FrontFacing ) * 2.0 - 1.0 );nttvec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );nttreturn normalize( abs( fDet ) * surf_norm - vGrad );nt}n#endif\",ka=\"#if NUM_CLIPPING_PLANES > 0ntvec4 plane;nt#pragma unroll_loop_startntfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {nttplane = clippingPlanes[ i ];nttif ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;nt}nt#pragma unroll_loop_endnt#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANESnttbool clipped = true;ntt#pragma unroll_loop_startnttfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {ntttplane = clippingPlanes[ i ];ntttclipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;ntt}ntt#pragma unroll_loop_endnttif ( clipped ) discard;nt#endifn#endif\",ja=\"#if NUM_CLIPPING_PLANES > 0ntvarying vec3 vClipPosition;ntuniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];n#endif\",Wa=\"#if NUM_CLIPPING_PLANES > 0ntvarying vec3 vClipPosition;n#endif\",qa=\"#if NUM_CLIPPING_PLANES > 0ntvClipPosition = - mvPosition.xyz;n#endif\",Xa=\"#ifdef USE_COLORntdiffuseColor.rgb *= vColor;n#endif\",Ya=\"#ifdef USE_COLORntvarying vec3 vColor;n#endif\",Za=\"#ifdef USE_COLORntvarying vec3 vColor;n#endif\",Ja=\"#ifdef USE_COLORntvColor.xyz = color.xyz;n#endif\",Qa=\"#define PI 3.14159265359n#define PI2 6.28318530718n#define PI_HALF 1.5707963267949n#define RECIPROCAL_PI 0.31830988618n#define RECIPROCAL_PI2 0.15915494n#define LOG2 1.442695n#define EPSILON 1e-6n#ifndef saturaten#define saturate(a) clamp( a, 0.0, 1.0 )n#endifn#define whiteComplement(a) ( 1.0 - saturate( a ) )nfloat pow2( const in float x ) { return x*x; }nfloat pow3( const in float x ) { return x*x*x; }nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }nfloat average( const in vec3 color ) { return dot( color, vec3( 0.3333 ) ); }nhighp float rand( const in vec2 uv ) {ntconst highp float a = 12.9898, b = 78.233, c = 43758.5453;nthighp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );ntreturn fract(sin(sn) * c);n}n#ifdef HIGH_PRECISIONntfloat precisionSafeLength( vec3 v ) { return length( v ); }n#elsentfloat max3( vec3 v ) { return max( max( v.x, v.y ), v.z ); }ntfloat precisionSafeLength( vec3 v ) {nttfloat maxComponent = max3( abs( v ) );nttreturn length( v \/ maxComponent ) * maxComponent;nt}n#endifnstruct IncidentLight {ntvec3 color;ntvec3 direction;ntbool visible;n};nstruct ReflectedLight {ntvec3 directDiffuse;ntvec3 directSpecular;ntvec3 indirectDiffuse;ntvec3 indirectSpecular;n};nstruct GeometricContext {ntvec3 position;ntvec3 normal;ntvec3 viewDir;n#ifdef CLEARCOATntvec3 clearcoatNormal;n#endifn};nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {ntreturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );n}nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {ntreturn normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );n}nvec3 projectOnPlane(in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {ntfloat distance = dot( planeNormal, point - pointOnPlane );ntreturn - distance * planeNormal + point;n}nfloat sideOfPlane( in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {ntreturn sign( dot( point - pointOnPlane, planeNormal ) );n}nvec3 linePlaneIntersect( in vec3 pointOnLine, in vec3 lineDirection, in vec3 pointOnPlane, in vec3 planeNormal ) {ntreturn lineDirection * ( dot( planeNormal, pointOnPlane - pointOnLine ) \/ dot( planeNormal, lineDirection ) ) + pointOnLine;n}nmat3 transposeMat3( const in mat3 m ) {ntmat3 tmp;nttmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );nttmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );nttmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );ntreturn tmp;n}nfloat linearToRelativeLuminance( const in vec3 color ) {ntvec3 weights = vec3( 0.2126, 0.7152, 0.0722 );ntreturn dot( weights, color.rgb );n}nbool isPerspectiveMatrix( mat4 m ) {n  return m[ 2 ][ 3 ] == - 1.0;n}\",Ka=\"#ifdef ENVMAP_TYPE_CUBE_UVn#define cubeUV_maxMipLevel 8.0n#define cubeUV_minMipLevel 4.0n#define cubeUV_maxTileSize 256.0n#define cubeUV_minTileSize 16.0nfloat getFace(vec3 direction) {n    vec3 absDirection = abs(direction);n    float face = -1.0;n    if (absDirection.x > absDirection.z) {n      if (absDirection.x > absDirection.y)n        face = direction.x > 0.0 ? 0.0 : 3.0;n      elsen        face = direction.y > 0.0 ? 1.0 : 4.0;n    } else {n      if (absDirection.z > absDirection.y)n        face = direction.z > 0.0 ? 2.0 : 5.0;n      elsen        face = direction.y > 0.0 ? 1.0 : 4.0;n    }n    return face;n}nvec2 getUV(vec3 direction, float face) {n    vec2 uv;n    if (face == 0.0) {n      uv = vec2(-direction.z, direction.y) \/ abs(direction.x);n    } else if (face == 1.0) {n      uv = vec2(direction.x, -direction.z) \/ abs(direction.y);n    } else if (face == 2.0) {n      uv = direction.xy \/ abs(direction.z);n    } else if (face == 3.0) {n      uv = vec2(direction.z, direction.y) \/ abs(direction.x);n    } else if (face == 4.0) {n      uv = direction.xz \/ abs(direction.y);n    } else {n      uv = vec2(-direction.x, direction.y) \/ abs(direction.z);n    }n    return 0.5 * (uv + 1.0);n}nvec3 bilinearCubeUV(sampler2D envMap, vec3 direction, float mipInt) {n  float face = getFace(direction);n  float filterInt = max(cubeUV_minMipLevel - mipInt, 0.0);n  mipInt = max(mipInt, cubeUV_minMipLevel);n  float faceSize = exp2(mipInt);n  float texelSize = 1.0 \/ (3.0 * cubeUV_maxTileSize);n  vec2 uv = getUV(direction, face) * (faceSize - 1.0);n  vec2 f = fract(uv);n  uv += 0.5 - f;n  if (face > 2.0) {n    uv.y += faceSize;n    face -= 3.0;n  }n  uv.x += face * faceSize;n  if(mipInt < cubeUV_maxMipLevel){n    uv.y += 2.0 * cubeUV_maxTileSize;n  }n  uv.y += filterInt * 2.0 * cubeUV_minTileSize;n  uv.x += 3.0 * max(0.0, cubeUV_maxTileSize - 2.0 * faceSize);n  uv *= texelSize;n  vec3 tl = envMapTexelToLinear(texture2D(envMap, uv)).rgb;n  uv.x += texelSize;n  vec3 tr = envMapTexelToLinear(texture2D(envMap, uv)).rgb;n  uv.y += texelSize;n  vec3 br = envMapTexelToLinear(texture2D(envMap, uv)).rgb;n  uv.x -= texelSize;n  vec3 bl = envMapTexelToLinear(texture2D(envMap, uv)).rgb;n  vec3 tm = mix(tl, tr, f.x);n  vec3 bm = mix(bl, br, f.x);n  return mix(tm, bm, f.y);n}n#define r0 1.0n#define v0 0.339n#define m0 -2.0n#define r1 0.8n#define v1 0.276n#define m1 -1.0n#define r4 0.4n#define v4 0.046n#define m4 2.0n#define r5 0.305n#define v5 0.016n#define m5 3.0n#define r6 0.21n#define v6 0.0038n#define m6 4.0nfloat roughnessToMip(float roughness) {n  float mip = 0.0;n  if (roughness >= r1) {n    mip = (r0 - roughness) * (m1 - m0) \/ (r0 - r1) + m0;n  } else if (roughness >= r4) {n    mip = (r1 - roughness) * (m4 - m1) \/ (r1 - r4) + m1;n  } else if (roughness >= r5) {n    mip = (r4 - roughness) * (m5 - m4) \/ (r4 - r5) + m4;n  } else if (roughness >= r6) {n    mip = (r5 - roughness) * (m6 - m5) \/ (r5 - r6) + m5;n  } else {n    mip = -2.0 * log2(1.16 * roughness);  }n  return mip;n}nvec4 textureCubeUV(sampler2D envMap, vec3 sampleDir, float roughness) {n  float mip = clamp(roughnessToMip(roughness), m0, cubeUV_maxMipLevel);n  float mipF = fract(mip);n  float mipInt = floor(mip);n  vec3 color0 = bilinearCubeUV(envMap, sampleDir, mipInt);n  if (mipF == 0.0) {n    return vec4(color0, 1.0);n  } else {n    vec3 color1 = bilinearCubeUV(envMap, sampleDir, mipInt + 1.0);n    return vec4(mix(color0, color1, mipF), 1.0);n  }n}n#endif\",$a=\"vec3 transformedNormal = objectNormal;n#ifdef USE_INSTANCINGntmat3 m = mat3( instanceMatrix );nttransformedNormal \/= vec3( dot( m[ 0 ], m[ 0 ] ), dot( m[ 1 ], m[ 1 ] ), dot( m[ 2 ], m[ 2 ] ) );nttransformedNormal = m * transformedNormal;n#endifntransformedNormal = normalMatrix * transformedNormal;n#ifdef FLIP_SIDEDnttransformedNormal = - transformedNormal;n#endifn#ifdef USE_TANGENTntvec3 transformedTangent = ( modelViewMatrix * vec4( objectTangent, 0.0 ) ).xyz;nt#ifdef FLIP_SIDEDntttransformedTangent = - transformedTangent;nt#endifn#endif\",eo=\"#ifdef USE_DISPLACEMENTMAPntuniform sampler2D displacementMap;ntuniform float displacementScale;ntuniform float displacementBias;n#endif\",to=\"#ifdef USE_DISPLACEMENTMAPnttransformed += normalize( objectNormal ) * ( texture2D( displacementMap, vUv ).x * displacementScale + displacementBias );n#endif\",ro=\"#ifdef USE_EMISSIVEMAPntvec4 emissiveColor = texture2D( emissiveMap, vUv );ntemissiveColor.rgb = emissiveMapTexelToLinear( emissiveColor ).rgb;nttotalEmissiveRadiance *= emissiveColor.rgb;n#endif\",no=\"#ifdef USE_EMISSIVEMAPntuniform sampler2D emissiveMap;n#endif\",io=\"gl_FragColor = linearToOutputTexel( gl_FragColor );\",ao=\"nvec4 LinearToLinear( in vec4 value ) {ntreturn value;n}nvec4 GammaToLinear( in vec4 value, in float gammaFactor ) {ntreturn vec4( pow( value.rgb, vec3( gammaFactor ) ), value.a );n}nvec4 LinearToGamma( in vec4 value, in float gammaFactor ) {ntreturn vec4( pow( value.rgb, vec3( 1.0 \/ gammaFactor ) ), value.a );n}nvec4 sRGBToLinear( in vec4 value ) {ntreturn vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.a );n}nvec4 LinearTosRGB( in vec4 value ) {ntreturn 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}nvec4 RGBEToLinear( in vec4 value ) {ntreturn vec4( value.rgb * exp2( value.a * 255.0 - 128.0 ), 1.0 );n}nvec4 LinearToRGBE( in vec4 value ) {ntfloat maxComponent = max( max( value.r, value.g ), value.b );ntfloat fExp = clamp( ceil( log2( maxComponent ) ), -128.0, 127.0 );ntreturn vec4( value.rgb \/ exp2( fExp ), ( fExp + 128.0 ) \/ 255.0 );n}nvec4 RGBMToLinear( in vec4 value, in float maxRange ) {ntreturn vec4( value.rgb * value.a * maxRange, 1.0 );n}nvec4 LinearToRGBM( in vec4 value, in float maxRange ) {ntfloat maxRGB = max( value.r, max( value.g, value.b ) );ntfloat M = clamp( maxRGB \/ maxRange, 0.0, 1.0 );ntM = ceil( M * 255.0 ) \/ 255.0;ntreturn vec4( value.rgb \/ ( M * maxRange ), M );n}nvec4 RGBDToLinear( in vec4 value, in float maxRange ) {ntreturn vec4( value.rgb * ( ( maxRange \/ 255.0 ) \/ value.a ), 1.0 );n}nvec4 LinearToRGBD( in vec4 value, in float maxRange ) {ntfloat maxRGB = max( value.r, max( value.g, value.b ) );ntfloat D = max( maxRange \/ maxRGB, 1.0 );ntD = clamp( floor( D ) \/ 255.0, 0.0, 1.0 );ntreturn vec4( value.rgb * ( D * ( 255.0 \/ maxRange ) ), D );n}nconst mat3 cLogLuvM = mat3( 0.2209, 0.3390, 0.4184, 0.1138, 0.6780, 0.7319, 0.0102, 0.1130, 0.2969 );nvec4 LinearToLogLuv( in vec4 value )  {ntvec3 Xp_Y_XYZp = cLogLuvM * value.rgb;ntXp_Y_XYZp = max( Xp_Y_XYZp, vec3( 1e-6, 1e-6, 1e-6 ) );ntvec4 vResult;ntvResult.xy = Xp_Y_XYZp.xy \/ Xp_Y_XYZp.z;ntfloat Le = 2.0 * log2(Xp_Y_XYZp.y) + 127.0;ntvResult.w = fract( Le );ntvResult.z = ( Le - ( floor( vResult.w * 255.0 ) ) \/ 255.0 ) \/ 255.0;ntreturn vResult;n}nconst mat3 cLogLuvInverseM = mat3( 6.0014, -2.7008, -1.7996, -1.3320, 3.1029, -5.7721, 0.3008, -1.0882, 5.6268 );nvec4 LogLuvToLinear( in vec4 value ) {ntfloat Le = value.z * 255.0 + value.w;ntvec3 Xp_Y_XYZp;ntXp_Y_XYZp.y = exp2( ( Le - 127.0 ) \/ 2.0 );ntXp_Y_XYZp.z = Xp_Y_XYZp.y \/ value.y;ntXp_Y_XYZp.x = value.x * Xp_Y_XYZp.z;ntvec3 vRGB = cLogLuvInverseM * Xp_Y_XYZp.rgb;ntreturn vec4( max( vRGB, 0.0 ), 1.0 );n}\",oo=\"#ifdef USE_ENVMAPnt#ifdef ENV_WORLDPOSnttvec3 cameraToFrag;nttnttif ( isOrthographic ) {ntttcameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );ntt}  else {ntttcameraToFrag = normalize( vWorldPosition - cameraPosition );ntt}nttvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );ntt#ifdef ENVMAP_MODE_REFLECTIONntttvec3 reflectVec = reflect( cameraToFrag, worldNormal );ntt#elsentttvec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );ntt#endifnt#elsenttvec3 reflectVec = vReflect;nt#endifnt#ifdef ENVMAP_TYPE_CUBEnttvec4 envColor = textureCube( envMap, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );nt#elif defined( ENVMAP_TYPE_CUBE_UV )nttvec4 envColor = textureCubeUV( envMap, reflectVec, 0.0 );nt#elif defined( ENVMAP_TYPE_EQUIREC )nttvec2 sampleUV;nttreflectVec = normalize( reflectVec );nttsampleUV.y = asin( clamp( reflectVec.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;nttsampleUV.x = atan( reflectVec.z, reflectVec.x ) * RECIPROCAL_PI2 + 0.5;nttvec4 envColor = texture2D( envMap, sampleUV );nt#elif defined( ENVMAP_TYPE_SPHERE )nttreflectVec = normalize( reflectVec );nttvec3 reflectView = normalize( ( viewMatrix * vec4( reflectVec, 0.0 ) ).xyz + vec3( 0.0, 0.0, 1.0 ) );nttvec4 envColor = texture2D( envMap, reflectView.xy * 0.5 + 0.5 );nt#elsenttvec4 envColor = vec4( 0.0 );nt#endifnt#ifndef ENVMAP_TYPE_CUBE_UVnttenvColor = envMapTexelToLinear( envColor );nt#endifnt#ifdef ENVMAP_BLENDING_MULTIPLYnttoutgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );nt#elif defined( ENVMAP_BLENDING_MIX )nttoutgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );nt#elif defined( ENVMAP_BLENDING_ADD )nttoutgoingLight += envColor.xyz * specularStrength * reflectivity;nt#endifn#endif\",so=\"#ifdef USE_ENVMAPntuniform float envMapIntensity;ntuniform float flipEnvMap;ntuniform int maxMipLevel;nt#ifdef ENVMAP_TYPE_CUBEnttuniform samplerCube envMap;nt#elsenttuniform sampler2D envMap;nt#endifntn#endif\",co=\"#ifdef USE_ENVMAPntuniform float reflectivity;nt#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )ntt#define ENV_WORLDPOSnt#endifnt#ifdef ENV_WORLDPOSnttvarying vec3 vWorldPosition;nttuniform float refractionRatio;nt#elsenttvarying vec3 vReflect;nt#endifn#endif\",lo=\"#ifdef USE_ENVMAPnt#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) ||defined( PHONG )ntt#define ENV_WORLDPOSnt#endifnt#ifdef ENV_WORLDPOSnttnttvarying vec3 vWorldPosition;nt#elsenttvarying vec3 vReflect;nttuniform float refractionRatio;nt#endifn#endif\",ho=\"#ifdef USE_ENVMAPnt#ifdef ENV_WORLDPOSnttvWorldPosition = worldPosition.xyz;nt#elsenttvec3 cameraToVertex;nttif ( isOrthographic ) { ntttcameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );ntt} else {ntttcameraToVertex = normalize( worldPosition.xyz - cameraPosition );ntt}nttvec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );ntt#ifdef ENVMAP_MODE_REFLECTIONntttvReflect = reflect( cameraToVertex, worldNormal );ntt#elsentttvReflect = refract( cameraToVertex, worldNormal, refractionRatio );ntt#endifnt#endifn#endif\",uo=\"#ifdef USE_FOGntfogDepth = -mvPosition.z;n#endif\",po=\"#ifdef USE_FOGntvarying float fogDepth;n#endif\",fo=\"#ifdef USE_FOGnt#ifdef FOG_EXP2nttfloat fogFactor = 1.0 - exp( - fogDensity * fogDensity * fogDepth * fogDepth );nt#elsenttfloat fogFactor = smoothstep( fogNear, fogFar, fogDepth );nt#endifntgl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );n#endif\",mo=\"#ifdef USE_FOGntuniform vec3 fogColor;ntvarying float fogDepth;nt#ifdef FOG_EXP2nttuniform float fogDensity;nt#elsenttuniform float fogNear;nttuniform float fogFar;nt#endifn#endif\",vo=\"#ifdef USE_GRADIENTMAPntuniform sampler2D gradientMap;n#endifnvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {ntfloat dotNL = dot( normal, lightDirection );ntvec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );nt#ifdef USE_GRADIENTMAPnttreturn texture2D( gradientMap, coord ).rgb;nt#elsenttreturn ( coord.x < 0.7 ) ? vec3( 0.7 ) : vec3( 1.0 );nt#endifn}\",go=\"#ifdef USE_LIGHTMAPntvec4 lightMapTexel= texture2D( lightMap, vUv2 );ntreflectedLight.indirectDiffuse += PI * lightMapTexelToLinear( lightMapTexel ).rgb * lightMapIntensity;n#endif\",yo=\"#ifdef USE_LIGHTMAPntuniform sampler2D lightMap;ntuniform float lightMapIntensity;n#endif\",xo=\"vec3 diffuse = vec3( 1.0 );nGeometricContext geometry;ngeometry.position = mvPosition.xyz;ngeometry.normal = normalize( transformedNormal );ngeometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( -mvPosition.xyz );nGeometricContext backGeometry;nbackGeometry.position = geometry.position;nbackGeometry.normal = -geometry.normal;nbackGeometry.viewDir = geometry.viewDir;nvLightFront = vec3( 0.0 );nvIndirectFront = vec3( 0.0 );n#ifdef DOUBLE_SIDEDntvLightBack = vec3( 0.0 );ntvIndirectBack = vec3( 0.0 );n#endifnIncidentLight directLight;nfloat dotNL;nvec3 directLightColor_Diffuse;n#if NUM_POINT_LIGHTS > 0nt#pragma unroll_loop_startntfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {nttgetPointDirectLightIrradiance( pointLights[ i ], geometry, directLight );nttdotNL = dot( geometry.normal, directLight.direction );nttdirectLightColor_Diffuse = PI * directLight.color;nttvLightFront += saturate( dotNL ) * directLightColor_Diffuse;ntt#ifdef DOUBLE_SIDEDntttvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;ntt#endifnt}nt#pragma unroll_loop_endn#endifn#if NUM_SPOT_LIGHTS > 0nt#pragma unroll_loop_startntfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {nttgetSpotDirectLightIrradiance( spotLights[ i ], geometry, directLight );nttdotNL = dot( geometry.normal, directLight.direction );nttdirectLightColor_Diffuse = PI * directLight.color;nttvLightFront += saturate( dotNL ) * directLightColor_Diffuse;ntt#ifdef DOUBLE_SIDEDntttvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;ntt#endifnt}nt#pragma unroll_loop_endn#endifn#if NUM_DIR_LIGHTS > 0nt#pragma unroll_loop_startntfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {nttgetDirectionalDirectLightIrradiance( directionalLights[ i ], geometry, directLight );nttdotNL = dot( geometry.normal, directLight.direction );nttdirectLightColor_Diffuse = PI * directLight.color;nttvLightFront += saturate( dotNL ) * directLightColor_Diffuse;ntt#ifdef DOUBLE_SIDEDntttvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;ntt#endifnt}nt#pragma unroll_loop_endn#endifn#if NUM_HEMI_LIGHTS > 0nt#pragma unroll_loop_startntfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {nttvIndirectFront += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );ntt#ifdef DOUBLE_SIDEDntttvIndirectBack += getHemisphereLightIrradiance( hemisphereLights[ i ], backGeometry );ntt#endifnt}nt#pragma unroll_loop_endn#endif\",_o=\"uniform bool receiveShadow;nuniform vec3 ambientLightColor;nuniform vec3 lightProbe[ 9 ];nvec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {ntfloat x = normal.x, y = normal.y, z = normal.z;ntvec3 result = shCoefficients[ 0 ] * 0.886227;ntresult += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;ntresult += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;ntresult += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;ntresult += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;ntresult += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;ntresult += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );ntresult += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;ntresult += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );ntreturn result;n}nvec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in GeometricContext geometry ) {ntvec3 worldNormal = inverseTransformDirection( geometry.normal, viewMatrix );ntvec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );ntreturn irradiance;n}nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {ntvec3 irradiance = ambientLightColor;nt#ifndef PHYSICALLY_CORRECT_LIGHTSnttirradiance *= PI;nt#endifntreturn irradiance;n}n#if NUM_DIR_LIGHTS > 0ntstruct DirectionalLight {nttvec3 direction;nttvec3 color;nt};ntuniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];nt#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0nttstruct DirectionalLightShadow {ntttfloat shadowBias;ntttfloat shadowRadius;ntttvec2 shadowMapSize;ntt};nttuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];nt#endifntvoid getDirectionalDirectLightIrradiance( const in DirectionalLight directionalLight, const in GeometricContext geometry, out IncidentLight directLight ) {nttdirectLight.color = directionalLight.color;nttdirectLight.direction = directionalLight.direction;nttdirectLight.visible = true;nt}n#endifn#if NUM_POINT_LIGHTS > 0ntstruct PointLight {nttvec3 position;nttvec3 color;nttfloat distance;nttfloat decay;nt};ntuniform PointLight pointLights[ NUM_POINT_LIGHTS ];nt#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0nttstruct PointLightShadow {ntttfloat shadowBias;ntttfloat shadowRadius;ntttvec2 shadowMapSize;ntttfloat shadowCameraNear;ntttfloat shadowCameraFar;ntt};nttuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];nt#endifntvoid getPointDirectLightIrradiance( const in PointLight pointLight, const in GeometricContext geometry, out IncidentLight directLight ) {nttvec3 lVector = pointLight.position - geometry.position;nttdirectLight.direction = normalize( lVector );nttfloat lightDistance = length( lVector );nttdirectLight.color = pointLight.color;nttdirectLight.color *= punctualLightIntensityToIrradianceFactor( lightDistance, pointLight.distance, pointLight.decay );nttdirectLight.visible = ( directLight.color != vec3( 0.0 ) );nt}n#endifn#if NUM_SPOT_LIGHTS > 0ntstruct SpotLight {nttvec3 position;nttvec3 direction;nttvec3 color;nttfloat distance;nttfloat decay;nttfloat coneCos;nttfloat penumbraCos;nt};ntuniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];nt#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0nttstruct SpotLightShadow {ntttfloat shadowBias;ntttfloat shadowRadius;ntttvec2 shadowMapSize;ntt};nttuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];nt#endifntvoid getSpotDirectLightIrradiance( const in SpotLight spotLight, const in GeometricContext geometry, out IncidentLight directLight  ) {nttvec3 lVector = spotLight.position - geometry.position;nttdirectLight.direction = normalize( lVector );nttfloat lightDistance = length( lVector );nttfloat angleCos = dot( directLight.direction, spotLight.direction );nttif ( angleCos > spotLight.coneCos ) {ntttfloat spotEffect = smoothstep( spotLight.coneCos, spotLight.penumbraCos, angleCos );ntttdirectLight.color = spotLight.color;ntttdirectLight.color *= spotEffect * punctualLightIntensityToIrradianceFactor( lightDistance, spotLight.distance, spotLight.decay );ntttdirectLight.visible = true;ntt} else {ntttdirectLight.color = vec3( 0.0 );ntttdirectLight.visible = false;ntt}nt}n#endifn#if NUM_RECT_AREA_LIGHTS > 0ntstruct RectAreaLight {nttvec3 color;nttvec3 position;nttvec3 halfWidth;nttvec3 halfHeight;nt};ntuniform sampler2D ltc_1;tuniform sampler2D ltc_2;ntuniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];n#endifn#if NUM_HEMI_LIGHTS > 0ntstruct HemisphereLight {nttvec3 direction;nttvec3 skyColor;nttvec3 groundColor;nt};ntuniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];ntvec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in GeometricContext geometry ) {nttfloat dotNL = dot( geometry.normal, hemiLight.direction );nttfloat hemiDiffuseWeight = 0.5 * dotNL + 0.5;nttvec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );ntt#ifndef PHYSICALLY_CORRECT_LIGHTSntttirradiance *= PI;ntt#endifnttreturn irradiance;nt}n#endif\",bo=\"#if defined( USE_ENVMAP )nt#ifdef ENVMAP_MODE_REFRACTIONnttuniform float refractionRatio;nt#endifntvec3 getLightProbeIndirectIrradiance( const in GeometricContext geometry, const in int maxMIPLevel ) {nttvec3 worldNormal = inverseTransformDirection( geometry.normal, viewMatrix );ntt#ifdef ENVMAP_TYPE_CUBEntttvec3 queryVec = vec3( flipEnvMap * worldNormal.x, worldNormal.yz );nttt#ifdef TEXTURE_LOD_EXTnttttvec4 envMapColor = textureCubeLodEXT( envMap, queryVec, float( maxMIPLevel ) );nttt#elsenttttvec4 envMapColor = textureCube( envMap, queryVec, float( maxMIPLevel ) );nttt#endifntttenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;ntt#elif defined( ENVMAP_TYPE_CUBE_UV )ntttvec4 envMapColor = textureCubeUV( envMap, worldNormal, 1.0 );ntt#elsentttvec4 envMapColor = vec4( 0.0 );ntt#endifnttreturn PI * envMapColor.rgb * envMapIntensity;nt}ntfloat getSpecularMIPLevel( const in float roughness, const in int maxMIPLevel ) {nttfloat maxMIPLevelScalar = float( maxMIPLevel );nttfloat sigma = PI * roughness * roughness \/ ( 1.0 + roughness );nttfloat desiredMIPLevel = maxMIPLevelScalar + log2( sigma );nttreturn clamp( desiredMIPLevel, 0.0, maxMIPLevelScalar );nt}ntvec3 getLightProbeIndirectRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in int maxMIPLevel ) {ntt#ifdef ENVMAP_MODE_REFLECTIONntt  vec3 reflectVec = reflect( -viewDir, normal );ntt  reflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );ntt#elsentt  vec3 reflectVec = refract( -viewDir, normal, refractionRatio );ntt#endifnttreflectVec = inverseTransformDirection( reflectVec, viewMatrix );nttfloat specularMIPLevel = getSpecularMIPLevel( roughness, maxMIPLevel );ntt#ifdef ENVMAP_TYPE_CUBEntttvec3 queryReflectVec = vec3( flipEnvMap * reflectVec.x, reflectVec.yz );nttt#ifdef TEXTURE_LOD_EXTnttttvec4 envMapColor = textureCubeLodEXT( envMap, queryReflectVec, specularMIPLevel );nttt#elsenttttvec4 envMapColor = textureCube( envMap, queryReflectVec, specularMIPLevel );nttt#endifntttenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;ntt#elif defined( ENVMAP_TYPE_CUBE_UV )ntttvec4 envMapColor = textureCubeUV( envMap, reflectVec, roughness );ntt#elif defined( ENVMAP_TYPE_EQUIREC )ntttvec2 sampleUV;ntttsampleUV.y = asin( clamp( reflectVec.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;ntttsampleUV.x = atan( reflectVec.z, reflectVec.x ) * RECIPROCAL_PI2 + 0.5;nttt#ifdef TEXTURE_LOD_EXTnttttvec4 envMapColor = texture2DLodEXT( envMap, sampleUV, specularMIPLevel );nttt#elsenttttvec4 envMapColor = texture2D( envMap, sampleUV, specularMIPLevel );nttt#endifntttenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;ntt#elif defined( ENVMAP_TYPE_SPHERE )ntttvec3 reflectView = normalize( ( viewMatrix * vec4( reflectVec, 0.0 ) ).xyz + vec3( 0.0,0.0,1.0 ) );nttt#ifdef TEXTURE_LOD_EXTnttttvec4 envMapColor = texture2DLodEXT( envMap, reflectView.xy * 0.5 + 0.5, specularMIPLevel );nttt#elsenttttvec4 envMapColor = texture2D( envMap, reflectView.xy * 0.5 + 0.5, specularMIPLevel );nttt#endifntttenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;ntt#endifnttreturn envMapColor.rgb * envMapIntensity;nt}n#endif\",wo=\"ToonMaterial material;nmaterial.diffuseColor = diffuseColor.rgb;nmaterial.specularColor = specular;nmaterial.specularShininess = shininess;nmaterial.specularStrength = specularStrength;\",Mo=\"varying vec3 vViewPosition;n#ifndef FLAT_SHADEDntvarying vec3 vNormal;n#endifnstruct ToonMaterial {ntvec3tdiffuseColor;ntvec3tspecularColor;ntfloattspecularShininess;ntfloattspecularStrength;n};nvoid RE_Direct_Toon( const in IncidentLight directLight, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {ntvec3 irradiance = getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color;nt#ifndef PHYSICALLY_CORRECT_LIGHTSnttirradiance *= PI;nt#endifntreflectedLight.directDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );ntreflectedLight.directSpecular += irradiance * BRDF_Specular_BlinnPhong( directLight, geometry, material.specularColor, material.specularShininess ) * material.specularStrength;n}nvoid RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {ntreflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );n}n#define RE_DirectttttRE_Direct_Toonn#define RE_IndirectDiffusettRE_IndirectDiffuse_Toonn#define Material_LightProbeLOD( material )t(0)\",So=\"BlinnPhongMaterial material;nmaterial.diffuseColor = diffuseColor.rgb;nmaterial.specularColor = specular;nmaterial.specularShininess = shininess;nmaterial.specularStrength = specularStrength;\",To=\"varying vec3 vViewPosition;n#ifndef FLAT_SHADEDntvarying vec3 vNormal;n#endifnstruct BlinnPhongMaterial {ntvec3tdiffuseColor;ntvec3tspecularColor;ntfloattspecularShininess;ntfloattspecularStrength;n};nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {ntfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );ntvec3 irradiance = dotNL * directLight.color;nt#ifndef PHYSICALLY_CORRECT_LIGHTSnttirradiance *= PI;nt#endifntreflectedLight.directDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );ntreflectedLight.directSpecular += irradiance * BRDF_Specular_BlinnPhong( directLight, geometry, material.specularColor, material.specularShininess ) * material.specularStrength;n}nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {ntreflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );n}n#define RE_DirectttttRE_Direct_BlinnPhongn#define RE_IndirectDiffusettRE_IndirectDiffuse_BlinnPhongn#define Material_LightProbeLOD( material )t(0)\",Eo=\"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.specularRoughness = max( roughnessFactor, 0.0525 );material.specularRoughness += geometryRoughness;nmaterial.specularRoughness = min( material.specularRoughness, 1.0 );n#ifdef REFLECTIVITYntmaterial.specularColor = mix( vec3( MAXIMUM_SPECULAR_COEFFICIENT * pow2( reflectivity ) ), diffuseColor.rgb, metalnessFactor );n#elsentmaterial.specularColor = mix( vec3( DEFAULT_SPECULAR_COEFFICIENT ), diffuseColor.rgb, metalnessFactor );n#endifn#ifdef CLEARCOATntmaterial.clearcoat = clearcoat;ntmaterial.clearcoatRoughness = clearcoatRoughness;nt#ifdef USE_CLEARCOATMAPnttmaterial.clearcoat *= texture2D( clearcoatMap, vUv ).x;nt#endifnt#ifdef USE_CLEARCOAT_ROUGHNESSMAPnttmaterial.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vUv ).y;nt#endifntmaterial.clearcoat = saturate( material.clearcoat );tmaterial.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );ntmaterial.clearcoatRoughness += geometryRoughness;ntmaterial.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );n#endifn#ifdef USE_SHEENntmaterial.sheenColor = sheen;n#endif\",Ao=\"struct PhysicalMaterial {ntvec3tdiffuseColor;ntfloattspecularRoughness;ntvec3tspecularColor;n#ifdef CLEARCOATntfloat clearcoat;ntfloat clearcoatRoughness;n#endifn#ifdef USE_SHEENntvec3 sheenColor;n#endifn};n#define MAXIMUM_SPECULAR_COEFFICIENT 0.16n#define DEFAULT_SPECULAR_COEFFICIENT 0.04nfloat clearcoatDHRApprox( const in float roughness, const in float dotNL ) {ntreturn DEFAULT_SPECULAR_COEFFICIENT + ( 1.0 - DEFAULT_SPECULAR_COEFFICIENT ) * ( pow( 1.0 - dotNL, 5.0 ) * pow( 1.0 - roughness, 2.0 ) );n}n#if NUM_RECT_AREA_LIGHTS > 0ntvoid RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {nttvec3 normal = geometry.normal;nttvec3 viewDir = geometry.viewDir;nttvec3 position = geometry.position;nttvec3 lightPos = rectAreaLight.position;nttvec3 halfWidth = rectAreaLight.halfWidth;nttvec3 halfHeight = rectAreaLight.halfHeight;nttvec3 lightColor = rectAreaLight.color;nttfloat roughness = material.specularRoughness;nttvec3 rectCoords[ 4 ];nttrectCoords[ 0 ] = lightPos + halfWidth - halfHeight;ttrectCoords[ 1 ] = lightPos - halfWidth - halfHeight;nttrectCoords[ 2 ] = lightPos - halfWidth + halfHeight;nttrectCoords[ 3 ] = lightPos + halfWidth + halfHeight;nttvec2 uv = LTC_Uv( normal, viewDir, roughness );nttvec4 t1 = texture2D( ltc_1, uv );nttvec4 t2 = texture2D( ltc_2, uv );nttmat3 mInv = mat3(ntttvec3( t1.x, 0, t1.y ),ntttvec3(    0, 1,    0 ),ntttvec3( t1.z, 0, t1.w )ntt);nttvec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );nttreflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );nttreflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );nt}n#endifnvoid RE_Direct_Physical( const in IncidentLight directLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {ntfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );ntvec3 irradiance = dotNL * directLight.color;nt#ifndef PHYSICALLY_CORRECT_LIGHTSnttirradiance *= PI;nt#endifnt#ifdef CLEARCOATnttfloat ccDotNL = saturate( dot( geometry.clearcoatNormal, directLight.direction ) );nttvec3 ccIrradiance = ccDotNL * directLight.color;ntt#ifndef PHYSICALLY_CORRECT_LIGHTSntttccIrradiance *= PI;ntt#endifnttfloat clearcoatDHR = material.clearcoat * clearcoatDHRApprox( material.clearcoatRoughness, ccDotNL );nttreflectedLight.directSpecular += ccIrradiance * material.clearcoat * BRDF_Specular_GGX( directLight, geometry.viewDir, geometry.clearcoatNormal, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearcoatRoughness );nt#elsenttfloat clearcoatDHR = 0.0;nt#endifnt#ifdef USE_SHEENnttreflectedLight.directSpecular += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Specular_Sheen(ntttmaterial.specularRoughness,ntttdirectLight.direction,ntttgeometry,ntttmaterial.sheenColorntt);nt#elsenttreflectedLight.directSpecular += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Specular_GGX( directLight, geometry.viewDir, geometry.normal, material.specularColor, material.specularRoughness);nt#endifntreflectedLight.directDiffuse += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );n}nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {ntreflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_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) {nt#ifdef CLEARCOATnttfloat ccDotNV = saturate( dot( geometry.clearcoatNormal, geometry.viewDir ) );nttreflectedLight.indirectSpecular += clearcoatRadiance * material.clearcoat * BRDF_Specular_GGX_Environment( geometry.viewDir, geometry.clearcoatNormal, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearcoatRoughness );nttfloat ccDotNL = ccDotNV;nttfloat clearcoatDHR = material.clearcoat * clearcoatDHRApprox( material.clearcoatRoughness, ccDotNL );nt#elsenttfloat clearcoatDHR = 0.0;nt#endifntfloat clearcoatInv = 1.0 - clearcoatDHR;ntvec3 singleScattering = vec3( 0.0 );ntvec3 multiScattering = vec3( 0.0 );ntvec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;ntBRDF_Specular_Multiscattering_Environment( geometry, material.specularColor, material.specularRoughness, singleScattering, multiScattering );ntvec3 diffuse = material.diffuseColor * ( 1.0 - ( singleScattering + multiScattering ) );ntreflectedLight.indirectSpecular += clearcoatInv * radiance * singleScattering;ntreflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;ntreflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;n}n#define RE_DirectttttRE_Direct_Physicaln#define RE_Direct_RectAreattRE_Direct_RectArea_Physicaln#define RE_IndirectDiffusettRE_IndirectDiffuse_Physicaln#define RE_IndirectSpecularttRE_IndirectSpecular_Physicalnfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {ntreturn saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );n}\",Lo=\"nGeometricContext geometry;ngeometry.position = - vViewPosition;ngeometry.normal = normal;ngeometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );n#ifdef CLEARCOATntgeometry.clearcoatNormal = clearcoatNormal;n#endifnIncidentLight directLight;n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )ntPointLight pointLight;nt#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0ntPointLightShadow pointLightShadow;nt#endifnt#pragma unroll_loop_startntfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {nttpointLight = pointLights[ i ];nttgetPointDirectLightIrradiance( pointLight, geometry, directLight );ntt#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )nttpointLightShadow = pointLightShadows[ i ];nttdirectLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;ntt#endifnttRE_Direct( directLight, geometry, material, reflectedLight );nt}nt#pragma unroll_loop_endn#endifn#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )ntSpotLight spotLight;nt#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0ntSpotLightShadow spotLightShadow;nt#endifnt#pragma unroll_loop_startntfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {nttspotLight = spotLights[ i ];nttgetSpotDirectLightIrradiance( spotLight, geometry, directLight );ntt#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )nttspotLightShadow = spotLightShadows[ i ];nttdirectLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;ntt#endifnttRE_Direct( directLight, geometry, material, reflectedLight );nt}nt#pragma unroll_loop_endn#endifn#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )ntDirectionalLight directionalLight;nt#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0ntDirectionalLightShadow directionalLightShadow;nt#endifnt#pragma unroll_loop_startntfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {nttdirectionalLight = directionalLights[ i ];nttgetDirectionalDirectLightIrradiance( directionalLight, geometry, directLight );ntt#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )nttdirectionalLightShadow = directionalLightShadows[ i ];nttdirectLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;ntt#endifnttRE_Direct( directLight, geometry, material, reflectedLight );nt}nt#pragma unroll_loop_endn#endifn#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )ntRectAreaLight rectAreaLight;nt#pragma unroll_loop_startntfor ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {nttrectAreaLight = rectAreaLights[ i ];nttRE_Direct_RectArea( rectAreaLight, geometry, material, reflectedLight );nt}nt#pragma unroll_loop_endn#endifn#if defined( RE_IndirectDiffuse )ntvec3 iblIrradiance = vec3( 0.0 );ntvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );ntirradiance += getLightProbeIrradiance( lightProbe, geometry );nt#if ( NUM_HEMI_LIGHTS > 0 )ntt#pragma unroll_loop_startnttfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {ntttirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );ntt}ntt#pragma unroll_loop_endnt#endifn#endifn#if defined( RE_IndirectSpecular )ntvec3 radiance = vec3( 0.0 );ntvec3 clearcoatRadiance = vec3( 0.0 );n#endif\",Ro=\"#if defined( RE_IndirectDiffuse )nt#ifdef USE_LIGHTMAPnttvec4 lightMapTexel= texture2D( lightMap, vUv2 );nttvec3 lightMapIrradiance = lightMapTexelToLinear( lightMapTexel ).rgb * lightMapIntensity;ntt#ifndef PHYSICALLY_CORRECT_LIGHTSntttlightMapIrradiance *= PI;ntt#endifnttirradiance += lightMapIrradiance;nt#endifnt#if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )nttiblIrradiance += getLightProbeIndirectIrradiance( geometry, maxMipLevel );nt#endifn#endifn#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )ntradiance += getLightProbeIndirectRadiance( geometry.viewDir, geometry.normal, material.specularRoughness, maxMipLevel );nt#ifdef CLEARCOATnttclearcoatRadiance += getLightProbeIndirectRadiance( geometry.viewDir, geometry.clearcoatNormal, material.clearcoatRoughness, maxMipLevel );nt#endifn#endif\",Co=\"#if defined( RE_IndirectDiffuse )ntRE_IndirectDiffuse( irradiance, geometry, material, reflectedLight );n#endifn#if defined( RE_IndirectSpecular )ntRE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometry, material, reflectedLight );n#endif\",Po=\"#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )ntgl_FragDepthEXT = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;n#endif\",Oo=\"#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )ntuniform float logDepthBufFC;ntvarying float vFragDepth;ntvarying float vIsPerspective;n#endif\",Do=\"#ifdef USE_LOGDEPTHBUFnt#ifdef USE_LOGDEPTHBUF_EXTnttvarying float vFragDepth;nttvarying float vIsPerspective;nt#elsenttuniform float logDepthBufFC;nt#endifn#endif\",Io=\"#ifdef USE_LOGDEPTHBUFnt#ifdef USE_LOGDEPTHBUF_EXTnttvFragDepth = 1.0 + gl_Position.w;nttvIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );nt#elsenttif ( isPerspectiveMatrix( projectionMatrix ) ) {ntttgl_Position.z = log2( max( EPSILON, gl_Position.w + 1.0 ) ) * logDepthBufFC - 1.0;ntttgl_Position.z *= gl_Position.w;ntt}nt#endifn#endif\",No=\"#ifdef USE_MAPntvec4 texelColor = texture2D( map, vUv );nttexelColor = mapTexelToLinear( texelColor );ntdiffuseColor *= texelColor;n#endif\",Bo=\"#ifdef USE_MAPntuniform sampler2D map;n#endif\",Fo=\"#if defined( USE_MAP ) || defined( USE_ALPHAMAP )ntvec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;n#endifn#ifdef USE_MAPntvec4 mapTexel = texture2D( map, uv );ntdiffuseColor *= mapTexelToLinear( mapTexel );n#endifn#ifdef USE_ALPHAMAPntdiffuseColor.a *= texture2D( alphaMap, uv ).g;n#endif\",Uo=\"#if defined( USE_MAP ) || defined( USE_ALPHAMAP )ntuniform mat3 uvTransform;n#endifn#ifdef USE_MAPntuniform sampler2D map;n#endifn#ifdef USE_ALPHAMAPntuniform sampler2D alphaMap;n#endif\",Go=\"float metalnessFactor = metalness;n#ifdef USE_METALNESSMAPntvec4 texelMetalness = texture2D( metalnessMap, vUv );ntmetalnessFactor *= texelMetalness.b;n#endif\",zo=\"#ifdef USE_METALNESSMAPntuniform sampler2D metalnessMap;n#endif\",Ho=\"#ifdef USE_MORPHNORMALSntobjectNormal *= morphTargetBaseInfluence;ntobjectNormal += morphNormal0 * morphTargetInfluences[ 0 ];ntobjectNormal += morphNormal1 * morphTargetInfluences[ 1 ];ntobjectNormal += morphNormal2 * morphTargetInfluences[ 2 ];ntobjectNormal += morphNormal3 * morphTargetInfluences[ 3 ];n#endif\",Vo=\"#ifdef USE_MORPHTARGETSntuniform float morphTargetBaseInfluence;nt#ifndef USE_MORPHNORMALSntuniform float morphTargetInfluences[ 8 ];nt#elsentuniform float morphTargetInfluences[ 4 ];nt#endifn#endif\",ko=\"#ifdef USE_MORPHTARGETSnttransformed *= morphTargetBaseInfluence;nttransformed += morphTarget0 * morphTargetInfluences[ 0 ];nttransformed += morphTarget1 * morphTargetInfluences[ 1 ];nttransformed += morphTarget2 * morphTargetInfluences[ 2 ];nttransformed += morphTarget3 * morphTargetInfluences[ 3 ];nt#ifndef USE_MORPHNORMALSnttransformed += morphTarget4 * morphTargetInfluences[ 4 ];nttransformed += morphTarget5 * morphTargetInfluences[ 5 ];nttransformed += morphTarget6 * morphTargetInfluences[ 6 ];nttransformed += morphTarget7 * morphTargetInfluences[ 7 ];nt#endifn#endif\",jo=\"#ifdef FLAT_SHADEDntvec3 fdx = vec3( dFdx( vViewPosition.x ), dFdx( vViewPosition.y ), dFdx( vViewPosition.z ) );ntvec3 fdy = vec3( dFdy( vViewPosition.x ), dFdy( vViewPosition.y ), dFdy( vViewPosition.z ) );ntvec3 normal = normalize( cross( fdx, fdy ) );n#elsentvec3 normal = normalize( vNormal );nt#ifdef DOUBLE_SIDEDnttnormal = normal * ( float( gl_FrontFacing ) * 2.0 - 1.0 );nt#endifnt#ifdef USE_TANGENTnttvec3 tangent = normalize( vTangent );nttvec3 bitangent = normalize( vBitangent );ntt#ifdef DOUBLE_SIDEDnttttangent = tangent * ( float( gl_FrontFacing ) * 2.0 - 1.0 );ntttbitangent = bitangent * ( float( gl_FrontFacing ) * 2.0 - 1.0 );ntt#endifntt#if defined( TANGENTSPACE_NORMALMAP ) || defined( USE_CLEARCOAT_NORMALMAP )ntttmat3 vTBN = mat3( tangent, bitangent, normal );ntt#endifnt#endifn#endifnvec3 geometryNormal = normal;\",Wo=\"#ifdef OBJECTSPACE_NORMALMAPntnormal = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;nt#ifdef FLIP_SIDEDnttnormal = - normal;nt#endifnt#ifdef DOUBLE_SIDEDnttnormal = normal * ( float( gl_FrontFacing ) * 2.0 - 1.0 );nt#endifntnormal = normalize( normalMatrix * normal );n#elif defined( TANGENTSPACE_NORMALMAP )ntvec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;ntmapN.xy *= normalScale;nt#ifdef USE_TANGENTnttnormal = normalize( vTBN * mapN );nt#elsenttnormal = perturbNormal2Arb( -vViewPosition, normal, mapN );nt#endifn#elif defined( USE_BUMPMAP )ntnormal = perturbNormalArb( -vViewPosition, normal, dHdxy_fwd() );n#endif\",qo=\"#ifdef USE_NORMALMAPntuniform sampler2D normalMap;ntuniform vec2 normalScale;n#endifn#ifdef OBJECTSPACE_NORMALMAPntuniform mat3 normalMatrix;n#endifn#if ! defined ( USE_TANGENT ) && ( defined ( TANGENTSPACE_NORMALMAP ) || defined ( USE_CLEARCOAT_NORMALMAP ) )ntvec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm, vec3 mapN ) {nttvec3 q0 = vec3( dFdx( eye_pos.x ), dFdx( eye_pos.y ), dFdx( eye_pos.z ) );nttvec3 q1 = vec3( dFdy( eye_pos.x ), dFdy( eye_pos.y ), dFdy( eye_pos.z ) );nttvec2 st0 = dFdx( vUv.st );nttvec2 st1 = dFdy( vUv.st );nttfloat scale = sign( st1.t * st0.s - st0.t * st1.s );nttvec3 S = normalize( ( q0 * st1.t - q1 * st0.t ) * scale );nttvec3 T = normalize( ( - q0 * st1.s + q1 * st0.s ) * scale );nttvec3 N = normalize( surf_norm );nttmat3 tsn = mat3( S, T, N );nttmapN.xy *= ( float( gl_FrontFacing ) * 2.0 - 1.0 );nttreturn normalize( tsn * mapN );nt}n#endif\",Xo=\"#ifdef CLEARCOATntvec3 clearcoatNormal = geometryNormal;n#endif\",Yo=\"#ifdef USE_CLEARCOAT_NORMALMAPntvec3 clearcoatMapN = texture2D( clearcoatNormalMap, vUv ).xyz * 2.0 - 1.0;ntclearcoatMapN.xy *= clearcoatNormalScale;nt#ifdef USE_TANGENTnttclearcoatNormal = normalize( vTBN * clearcoatMapN );nt#elsenttclearcoatNormal = perturbNormal2Arb( - vViewPosition, clearcoatNormal, clearcoatMapN );nt#endifn#endif\",Zo=\"#ifdef USE_CLEARCOATMAPntuniform sampler2D clearcoatMap;n#endifn#ifdef USE_CLEARCOAT_ROUGHNESSMAPntuniform sampler2D clearcoatRoughnessMap;n#endifn#ifdef USE_CLEARCOAT_NORMALMAPntuniform sampler2D clearcoatNormalMap;ntuniform vec2 clearcoatNormalScale;n#endif\",Jo=\"vec3 packNormalToRGB( const in vec3 normal ) {ntreturn normalize( normal ) * 0.5 + 0.5;n}nvec3 unpackRGBToNormal( const in vec3 rgb ) {ntreturn 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 ) {ntvec4 r = vec4( fract( v * PackFactors ), v );ntr.yzw -= r.xyz * ShiftRight8;treturn r * PackUpscale;n}nfloat unpackRGBAToDepth( const in vec4 v ) {ntreturn dot( v, UnpackFactors );n}nvec4 pack2HalfToRGBA( vec2 v ) {ntvec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ));ntreturn vec4( r.x - r.y \/ 255.0, r.y, r.z - r.w \/ 255.0, r.w);n}nvec2 unpackRGBATo2Half( vec4 v ) {ntreturn 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 ) {ntreturn ( viewZ + near ) \/ ( near - far );n}nfloat orthographicDepthToViewZ( const in float linearClipZ, const in float near, const in float far ) {ntreturn linearClipZ * ( near - far ) - near;n}nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {ntreturn (( near + viewZ ) * far ) \/ (( far - near ) * viewZ );n}nfloat perspectiveDepthToViewZ( const in float invClipZ, const in float near, const in float far ) {ntreturn ( near * far ) \/ ( ( far - near ) * invClipZ - far );n}\",Qo=\"#ifdef PREMULTIPLIED_ALPHAntgl_FragColor.rgb *= gl_FragColor.a;n#endif\",Ko=\"vec4 mvPosition = vec4( transformed, 1.0 );n#ifdef USE_INSTANCINGntmvPosition = instanceMatrix * mvPosition;n#endifnmvPosition = modelViewMatrix * mvPosition;ngl_Position = projectionMatrix * mvPosition;\",$o=\"#ifdef DITHERINGntgl_FragColor.rgb = dithering( gl_FragColor.rgb );n#endif\",es=\"#ifdef DITHERINGntvec3 dithering( vec3 color ) {nttfloat grid_position = rand( gl_FragCoord.xy );nttvec3 dither_shift_RGB = vec3( 0.25 \/ 255.0, -0.25 \/ 255.0, 0.25 \/ 255.0 );nttdither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );nttreturn color + dither_shift_RGB;nt}n#endif\",ts=\"float roughnessFactor = roughness;n#ifdef USE_ROUGHNESSMAPntvec4 texelRoughness = texture2D( roughnessMap, vUv );ntroughnessFactor *= texelRoughness.g;n#endif\",rs=\"#ifdef USE_ROUGHNESSMAPntuniform sampler2D roughnessMap;n#endif\",ns=\"#ifdef USE_SHADOWMAPnt#if NUM_DIR_LIGHT_SHADOWS > 0nttuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];nttvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];nt#endifnt#if NUM_SPOT_LIGHT_SHADOWS > 0nttuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];nttvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHT_SHADOWS ];nt#endifnt#if NUM_POINT_LIGHT_SHADOWS > 0nttuniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];nttvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];nt#endifntfloat texture2DCompare( sampler2D depths, vec2 uv, float compare ) {nttreturn step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );nt}ntvec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {nttreturn unpackRGBATo2Half( texture2D( shadow, uv ) );nt}ntfloat VSMShadow (sampler2D shadow, vec2 uv, float compare ){nttfloat occlusion = 1.0;nttvec2 distribution = texture2DDistribution( shadow, uv );nttfloat hard_shadow = step( compare , distribution.x );nttif (hard_shadow != 1.0 ) {ntttfloat distance = compare - distribution.x ;ntttfloat variance = max( 0.00000, distribution.y * distribution.y );ntttfloat softness_probability = variance \/ (variance + distance * distance );tttsoftness_probability = clamp( ( softness_probability - 0.3 ) \/ ( 0.95 - 0.3 ), 0.0, 1.0 );tttocclusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 );ntt}nttreturn occlusion;nt}ntfloat getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {nttfloat shadow = 1.0;nttshadowCoord.xyz \/= shadowCoord.w;nttshadowCoord.z += shadowBias;nttbvec4 inFrustumVec = bvec4 ( shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0 );nttbool inFrustum = all( inFrustumVec );nttbvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 );nttbool frustumTest = all( frustumTestVec );nttif ( frustumTest ) {ntt#if defined( SHADOWMAP_TYPE_PCF )ntttvec2 texelSize = vec2( 1.0 ) \/ shadowMapSize;ntttfloat dx0 = - texelSize.x * shadowRadius;ntttfloat dy0 = - texelSize.y * shadowRadius;ntttfloat dx1 = + texelSize.x * shadowRadius;ntttfloat dy1 = + texelSize.y * shadowRadius;ntttfloat dx2 = dx0 \/ 2.0;ntttfloat dy2 = dy0 \/ 2.0;ntttfloat dx3 = dx1 \/ 2.0;ntttfloat dy3 = dy1 \/ 2.0;ntttshadow = (ntttttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +ntttttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +ntttttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +ntttttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +ntttttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +ntttttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +ntttttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +ntttttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +ntttttexture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +ntttttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +ntttttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +ntttttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +ntttttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +ntttttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +ntttttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +ntttttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +ntttttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )nttt) * ( 1.0 \/ 17.0 );ntt#elif defined( SHADOWMAP_TYPE_PCF_SOFT )ntttvec2 texelSize = vec2( 1.0 ) \/ shadowMapSize;ntttfloat dx = texelSize.x;ntttfloat dy = texelSize.y;ntttvec2 uv = shadowCoord.xy;ntttvec2 f = fract( uv * shadowMapSize + 0.5 );ntttuv -= f * texelSize;ntttshadow = (ntttttexture2DCompare( shadowMap, uv, shadowCoord.z ) +ntttttexture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +ntttttexture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +ntttttexture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +nttttmix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ), nttttt texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),nttttt f.x ) +nttttmix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ), nttttt texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),nttttt f.x ) +nttttmix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ), nttttt texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),nttttt f.y ) +nttttmix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ), nttttt texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),nttttt f.y ) +nttttmix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ), ntttttt  texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),ntttttt  f.x ),nttttt mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ), ntttttt  texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),ntttttt  f.x ),nttttt f.y )nttt) * ( 1.0 \/ 9.0 );ntt#elif defined( SHADOWMAP_TYPE_VSM )ntttshadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );ntt#elsentttshadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );ntt#endifntt}nttreturn shadow;nt}ntvec2 cubeToUV( vec3 v, float texelSizeY ) {nttvec3 absV = abs( v );nttfloat scaleToCube = 1.0 \/ max( absV.x, max( absV.y, absV.z ) );nttabsV *= scaleToCube;nttv *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );nttvec2 planar = v.xy;nttfloat almostATexel = 1.5 * texelSizeY;nttfloat almostOne = 1.0 - almostATexel;nttif ( absV.z >= almostOne ) {ntttif ( v.z > 0.0 )nttttplanar.x = 4.0 - v.x;ntt} else if ( absV.x >= almostOne ) {ntttfloat signX = sign( v.x );ntttplanar.x = v.z * signX + 2.0 * signX;ntt} else if ( absV.y >= almostOne ) {ntttfloat signY = sign( v.y );ntttplanar.x = v.x + 2.0 * signY + 2.0;ntttplanar.y = v.z * signY - 2.0;ntt}nttreturn vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );nt}ntfloat getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {nttvec2 texelSize = vec2( 1.0 ) \/ ( shadowMapSize * vec2( 4.0, 2.0 ) );nttvec3 lightToPosition = shadowCoord.xyz;nttfloat dp = ( length( lightToPosition ) - shadowCameraNear ) \/ ( shadowCameraFar - shadowCameraNear );ttdp += shadowBias;nttvec3 bd3D = normalize( lightToPosition );ntt#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )ntttvec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;ntttreturn (ntttttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +ntttttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +ntttttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +ntttttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +ntttttexture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +ntttttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +ntttttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +ntttttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +ntttttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )nttt) * ( 1.0 \/ 9.0 );ntt#elsentttreturn texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );ntt#endifnt}n#endif\",is=\"#ifdef USE_SHADOWMAPnt#if NUM_DIR_LIGHT_SHADOWS > 0nttuniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];nttvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];nt#endifnt#if NUM_SPOT_LIGHT_SHADOWS > 0nttuniform mat4 spotShadowMatrix[ NUM_SPOT_LIGHT_SHADOWS ];nttvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHT_SHADOWS ];nt#endifnt#if NUM_POINT_LIGHT_SHADOWS > 0nttuniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];nttvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];nt#endifn#endif\",as=\"#ifdef USE_SHADOWMAPnt#if NUM_DIR_LIGHT_SHADOWS > 0nt#pragma unroll_loop_startntfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {nttvDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * worldPosition;nt}nt#pragma unroll_loop_endnt#endifnt#if NUM_SPOT_LIGHT_SHADOWS > 0nt#pragma unroll_loop_startntfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {nttvSpotShadowCoord[ i ] = spotShadowMatrix[ i ] * worldPosition;nt}nt#pragma unroll_loop_endnt#endifnt#if NUM_POINT_LIGHT_SHADOWS > 0nt#pragma unroll_loop_startntfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {nttvPointShadowCoord[ i ] = pointShadowMatrix[ i ] * worldPosition;nt}nt#pragma unroll_loop_endnt#endifn#endif\",os=\"float getShadowMask() {ntfloat shadow = 1.0;nt#ifdef USE_SHADOWMAPnt#if NUM_DIR_LIGHT_SHADOWS > 0ntDirectionalLightShadow directionalLight;nt#pragma unroll_loop_startntfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {nttdirectionalLight = directionalLightShadows[ i ];nttshadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;nt}nt#pragma unroll_loop_endnt#endifnt#if NUM_SPOT_LIGHT_SHADOWS > 0ntSpotLightShadow spotLight;nt#pragma unroll_loop_startntfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {nttspotLight = spotLightShadows[ i ];nttshadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;nt}nt#pragma unroll_loop_endnt#endifnt#if NUM_POINT_LIGHT_SHADOWS > 0ntPointLightShadow pointLight;nt#pragma unroll_loop_startntfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {nttpointLight = pointLightShadows[ i ];nttshadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;nt}nt#pragma unroll_loop_endnt#endifnt#endifntreturn shadow;n}\",ss=\"#ifdef USE_SKINNINGntmat4 boneMatX = getBoneMatrix( skinIndex.x );ntmat4 boneMatY = getBoneMatrix( skinIndex.y );ntmat4 boneMatZ = getBoneMatrix( skinIndex.z );ntmat4 boneMatW = getBoneMatrix( skinIndex.w );n#endif\",cs=\"#ifdef USE_SKINNINGntuniform mat4 bindMatrix;ntuniform mat4 bindMatrixInverse;nt#ifdef BONE_TEXTUREnttuniform highp sampler2D boneTexture;nttuniform int boneTextureSize;nttmat4 getBoneMatrix( const in float i ) {ntttfloat j = i * 4.0;ntttfloat x = mod( j, float( boneTextureSize ) );ntttfloat y = floor( j \/ float( boneTextureSize ) );ntttfloat dx = 1.0 \/ float( boneTextureSize );ntttfloat dy = 1.0 \/ float( boneTextureSize );nttty = dy * ( y + 0.5 );ntttvec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );ntttvec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );ntttvec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );ntttvec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );ntttmat4 bone = mat4( v1, v2, v3, v4 );ntttreturn bone;ntt}nt#elsenttuniform mat4 boneMatrices[ MAX_BONES ];nttmat4 getBoneMatrix( const in float i ) {ntttmat4 bone = boneMatrices[ int(i) ];ntttreturn bone;ntt}nt#endifn#endif\",ls=\"#ifdef USE_SKINNINGntvec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );ntvec4 skinned = vec4( 0.0 );ntskinned += boneMatX * skinVertex * skinWeight.x;ntskinned += boneMatY * skinVertex * skinWeight.y;ntskinned += boneMatZ * skinVertex * skinWeight.z;ntskinned += boneMatW * skinVertex * skinWeight.w;nttransformed = ( bindMatrixInverse * skinned ).xyz;n#endif\",hs=\"#ifdef USE_SKINNINGntmat4 skinMatrix = mat4( 0.0 );ntskinMatrix += skinWeight.x * boneMatX;ntskinMatrix += skinWeight.y * boneMatY;ntskinMatrix += skinWeight.z * boneMatZ;ntskinMatrix += skinWeight.w * boneMatW;ntskinMatrix  = bindMatrixInverse * skinMatrix * bindMatrix;ntobjectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;nt#ifdef USE_TANGENTnttobjectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;nt#endifn#endif\",us=\"float specularStrength;n#ifdef USE_SPECULARMAPntvec4 texelSpecular = texture2D( specularMap, vUv );ntspecularStrength = texelSpecular.r;n#elsentspecularStrength = 1.0;n#endif\",ps=\"#ifdef USE_SPECULARMAPntuniform sampler2D specularMap;n#endif\",ds=\"#if defined( TONE_MAPPING )ntgl_FragColor.rgb = toneMapping( gl_FragColor.rgb );n#endif\",fs=\"#ifndef saturaten#define saturate(a) clamp( a, 0.0, 1.0 )n#endifnuniform float toneMappingExposure;nuniform float toneMappingWhitePoint;nvec3 LinearToneMapping( vec3 color ) {ntreturn toneMappingExposure * color;n}nvec3 ReinhardToneMapping( vec3 color ) {ntcolor *= toneMappingExposure;ntreturn saturate( color \/ ( vec3( 1.0 ) + color ) );n}n#define Uncharted2Helper( x ) max( ( ( x * ( 0.15 * x + 0.10 * 0.50 ) + 0.20 * 0.02 ) \/ ( x * ( 0.15 * x + 0.50 ) + 0.20 * 0.30 ) ) - 0.02 \/ 0.30, vec3( 0.0 ) )nvec3 Uncharted2ToneMapping( vec3 color ) {ntcolor *= toneMappingExposure;ntreturn saturate( Uncharted2Helper( color ) \/ Uncharted2Helper( vec3( toneMappingWhitePoint ) ) );n}nvec3 OptimizedCineonToneMapping( vec3 color ) {ntcolor *= toneMappingExposure;ntcolor = max( vec3( 0.0 ), color - 0.004 );ntreturn pow( ( color * ( 6.2 * color + 0.5 ) ) \/ ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );n}nvec3 ACESFilmicToneMapping( vec3 color ) {ntcolor *= toneMappingExposure;ntreturn saturate( ( color * ( 2.51 * color + 0.03 ) ) \/ ( color * ( 2.43 * color + 0.59 ) + 0.14 ) );n}\",ms=\"#if ( defined( USE_UV ) && ! defined( UVS_VERTEX_ONLY ) )ntvarying vec2 vUv;n#endif\",vs=\"#ifdef USE_UVnt#ifdef UVS_VERTEX_ONLYnttvec2 vUv;nt#elsenttvarying vec2 vUv;nt#endifntuniform mat3 uvTransform;n#endif\",gs=\"#ifdef USE_UVntvUv = ( uvTransform * vec3( uv, 1 ) ).xy;n#endif\",ys=\"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )ntvarying vec2 vUv2;n#endif\",xs=\"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )ntattribute vec2 uv2;ntvarying vec2 vUv2;ntuniform mat3 uv2Transform;n#endif\",_s=\"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )ntvUv2 = ( uv2Transform * vec3( uv2, 1 ) ).xy;n#endif\",bs=\"#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP )ntvec4 worldPosition = vec4( transformed, 1.0 );nt#ifdef USE_INSTANCINGnttworldPosition = instanceMatrix * worldPosition;nt#endifntworldPosition = modelMatrix * worldPosition;n#endif\",ws=\"uniform sampler2D t2D;nvarying vec2 vUv;nvoid main() {ntvec4 texColor = texture2D( t2D, vUv );ntgl_FragColor = mapTexelToLinear( texColor );nt#include <tonemapping_fragment>nt#include <encodings_fragment>n}\",Ms=\"varying vec2 vUv;nuniform mat3 uvTransform;nvoid main() {ntvUv = ( uvTransform * vec3( uv, 1 ) ).xy;ntgl_Position = vec4( position.xy, 1.0, 1.0 );n}\",Ss=\"#include <envmap_common_pars_fragment>nuniform float opacity;nvarying vec3 vWorldDirection;n#include <cube_uv_reflection_fragment>nvoid main() {ntvec3 vReflect = vWorldDirection;nt#include <envmap_fragment>ntgl_FragColor = envColor;ntgl_FragColor.a *= opacity;nt#include <tonemapping_fragment>nt#include <encodings_fragment>n}\",Ts=\"varying vec3 vWorldDirection;n#include <common>nvoid main() {ntvWorldDirection = transformDirection( position, modelMatrix );nt#include <begin_vertex>nt#include <project_vertex>ntgl_Position.z = gl_Position.w;n}\",Es=\"#if DEPTH_PACKING == 3200ntuniform float opacity;n#endifn#include <common>n#include <packing>n#include <uv_pars_fragment>n#include <map_pars_fragment>n#include <alphamap_pars_fragment>n#include <logdepthbuf_pars_fragment>n#include <clipping_planes_pars_fragment>nvarying vec2 vHighPrecisionZW;nvoid main() {nt#include <clipping_planes_fragment>ntvec4 diffuseColor = vec4( 1.0 );nt#if DEPTH_PACKING == 3200nttdiffuseColor.a = opacity;nt#endifnt#include <map_fragment>nt#include <alphamap_fragment>nt#include <alphatest_fragment>nt#include <logdepthbuf_fragment>ntfloat fragCoordZ = 0.5 * vHighPrecisionZW[0] \/ vHighPrecisionZW[1] + 0.5;nt#if DEPTH_PACKING == 3200nttgl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );nt#elif DEPTH_PACKING == 3201nttgl_FragColor = packDepthToRGBA( fragCoordZ );nt#endifn}\",As=\"#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() {nt#include <uv_vertex>nt#include <skinbase_vertex>nt#ifdef USE_DISPLACEMENTMAPntt#include <beginnormal_vertex>ntt#include <morphnormal_vertex>ntt#include <skinnormal_vertex>nt#endifnt#include <begin_vertex>nt#include <morphtarget_vertex>nt#include <skinning_vertex>nt#include <displacementmap_vertex>nt#include <project_vertex>nt#include <logdepthbuf_vertex>nt#include <clipping_planes_vertex>ntvHighPrecisionZW = gl_Position.zw;n}\",Ls=\"#define DISTANCEnuniform 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 <clipping_planes_pars_fragment>nvoid main () {nt#include <clipping_planes_fragment>ntvec4 diffuseColor = vec4( 1.0 );nt#include <map_fragment>nt#include <alphamap_fragment>nt#include <alphatest_fragment>ntfloat dist = length( vWorldPosition - referencePosition );ntdist = ( dist - nearDistance ) \/ ( farDistance - nearDistance );ntdist = saturate( dist );ntgl_FragColor = packDepthToRGBA( dist );n}\",Rs=\"#define DISTANCEnvarying 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() {nt#include <uv_vertex>nt#include <skinbase_vertex>nt#ifdef USE_DISPLACEMENTMAPntt#include <beginnormal_vertex>ntt#include <morphnormal_vertex>ntt#include <skinnormal_vertex>nt#endifnt#include <begin_vertex>nt#include <morphtarget_vertex>nt#include <skinning_vertex>nt#include <displacementmap_vertex>nt#include <project_vertex>nt#include <worldpos_vertex>nt#include <clipping_planes_vertex>ntvWorldPosition = worldPosition.xyz;n}\",Cs=\"uniform sampler2D tEquirect;nvarying vec3 vWorldDirection;n#include <common>nvoid main() {ntvec3 direction = normalize( vWorldDirection );ntvec2 sampleUV;ntsampleUV.y = asin( clamp( direction.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;ntsampleUV.x = atan( direction.z, direction.x ) * RECIPROCAL_PI2 + 0.5;ntvec4 texColor = texture2D( tEquirect, sampleUV );ntgl_FragColor = mapTexelToLinear( texColor );nt#include <tonemapping_fragment>nt#include <encodings_fragment>n}\",Ps=\"varying vec3 vWorldDirection;n#include <common>nvoid main() {ntvWorldDirection = transformDirection( position, modelMatrix );nt#include <begin_vertex>nt#include <project_vertex>n}\",Os=\"uniform vec3 diffuse;nuniform float opacity;nuniform float dashSize;nuniform float totalSize;nvarying float vLineDistance;n#include <common>n#include <color_pars_fragment>n#include <fog_pars_fragment>n#include <logdepthbuf_pars_fragment>n#include <clipping_planes_pars_fragment>nvoid main() {nt#include <clipping_planes_fragment>ntif ( mod( vLineDistance, totalSize ) > dashSize ) {nttdiscard;nt}ntvec3 outgoingLight = vec3( 0.0 );ntvec4 diffuseColor = vec4( diffuse, opacity );nt#include <logdepthbuf_fragment>nt#include <color_fragment>ntoutgoingLight = diffuseColor.rgb;ntgl_FragColor = vec4( outgoingLight, diffuseColor.a );nt#include <tonemapping_fragment>nt#include <encodings_fragment>nt#include <fog_fragment>nt#include <premultiplied_alpha_fragment>n}\",Ds=\"uniform float scale;nattribute float lineDistance;nvarying float vLineDistance;n#include <common>n#include <color_pars_vertex>n#include <fog_pars_vertex>n#include <logdepthbuf_pars_vertex>n#include <clipping_planes_pars_vertex>nvoid main() {ntvLineDistance = scale * lineDistance;nt#include <color_vertex>nt#include <begin_vertex>nt#include <project_vertex>nt#include <logdepthbuf_vertex>nt#include <clipping_planes_vertex>nt#include <fog_vertex>n}\",Is=\"uniform vec3 diffuse;nuniform float opacity;n#ifndef FLAT_SHADEDntvarying vec3 vNormal;n#endifn#include <common>n#include <color_pars_fragment>n#include <uv_pars_fragment>n#include <uv2_pars_fragment>n#include <map_pars_fragment>n#include <alphamap_pars_fragment>n#include <aomap_pars_fragment>n#include <lightmap_pars_fragment>n#include <envmap_common_pars_fragment>n#include <envmap_pars_fragment>n#include <cube_uv_reflection_fragment>n#include <fog_pars_fragment>n#include <specularmap_pars_fragment>n#include <logdepthbuf_pars_fragment>n#include <clipping_planes_pars_fragment>nvoid main() {nt#include <clipping_planes_fragment>ntvec4 diffuseColor = vec4( diffuse, opacity );nt#include <logdepthbuf_fragment>nt#include <map_fragment>nt#include <color_fragment>nt#include <alphamap_fragment>nt#include <alphatest_fragment>nt#include <specularmap_fragment>ntReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );nt#ifdef USE_LIGHTMAPntnttvec4 lightMapTexel= texture2D( lightMap, vUv2 );nttreflectedLight.indirectDiffuse += lightMapTexelToLinear( lightMapTexel ).rgb * lightMapIntensity;nt#elsenttreflectedLight.indirectDiffuse += vec3( 1.0 );nt#endifnt#include <aomap_fragment>ntreflectedLight.indirectDiffuse *= diffuseColor.rgb;ntvec3 outgoingLight = reflectedLight.indirectDiffuse;nt#include <envmap_fragment>ntgl_FragColor = vec4( outgoingLight, diffuseColor.a );nt#include <tonemapping_fragment>nt#include <encodings_fragment>nt#include <fog_fragment>nt#include <premultiplied_alpha_fragment>n}\",Ns=\"#include <common>n#include <uv_pars_vertex>n#include <uv2_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() {nt#include <uv_vertex>nt#include <uv2_vertex>nt#include <color_vertex>nt#include <skinbase_vertex>nt#ifdef USE_ENVMAPnt#include <beginnormal_vertex>nt#include <morphnormal_vertex>nt#include <skinnormal_vertex>nt#include <defaultnormal_vertex>nt#endifnt#include <begin_vertex>nt#include <morphtarget_vertex>nt#include <skinning_vertex>nt#include <project_vertex>nt#include <logdepthbuf_vertex>nt#include <worldpos_vertex>nt#include <clipping_planes_vertex>nt#include <envmap_vertex>nt#include <fog_vertex>n}\",Bs=\"uniform vec3 diffuse;nuniform vec3 emissive;nuniform float opacity;nvarying vec3 vLightFront;nvarying vec3 vIndirectFront;n#ifdef DOUBLE_SIDEDntvarying vec3 vLightBack;ntvarying vec3 vIndirectBack;n#endifn#include <common>n#include <packing>n#include <dithering_pars_fragment>n#include <color_pars_fragment>n#include <uv_pars_fragment>n#include <uv2_pars_fragment>n#include <map_pars_fragment>n#include <alphamap_pars_fragment>n#include <aomap_pars_fragment>n#include <lightmap_pars_fragment>n#include <emissivemap_pars_fragment>n#include <envmap_common_pars_fragment>n#include <envmap_pars_fragment>n#include <cube_uv_reflection_fragment>n#include <bsdfs>n#include <lights_pars_begin>n#include <fog_pars_fragment>n#include <shadowmap_pars_fragment>n#include <shadowmask_pars_fragment>n#include <specularmap_pars_fragment>n#include <logdepthbuf_pars_fragment>n#include <clipping_planes_pars_fragment>nvoid main() {nt#include <clipping_planes_fragment>ntvec4 diffuseColor = vec4( diffuse, opacity );ntReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );ntvec3 totalEmissiveRadiance = emissive;nt#include <logdepthbuf_fragment>nt#include <map_fragment>nt#include <color_fragment>nt#include <alphamap_fragment>nt#include <alphatest_fragment>nt#include <specularmap_fragment>nt#include <emissivemap_fragment>ntreflectedLight.indirectDiffuse = getAmbientLightIrradiance( ambientLightColor );nt#ifdef DOUBLE_SIDEDnttreflectedLight.indirectDiffuse += ( gl_FrontFacing ) ? vIndirectFront : vIndirectBack;nt#elsenttreflectedLight.indirectDiffuse += vIndirectFront;nt#endifnt#include <lightmap_fragment>ntreflectedLight.indirectDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb );nt#ifdef DOUBLE_SIDEDnttreflectedLight.directDiffuse = ( gl_FrontFacing ) ? vLightFront : vLightBack;nt#elsenttreflectedLight.directDiffuse = vLightFront;nt#endifntreflectedLight.directDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb ) * getShadowMask();nt#include <aomap_fragment>ntvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;nt#include <envmap_fragment>ntgl_FragColor = vec4( outgoingLight, diffuseColor.a );nt#include <tonemapping_fragment>nt#include <encodings_fragment>nt#include <fog_fragment>nt#include <premultiplied_alpha_fragment>nt#include <dithering_fragment>n}\",Fs=\"#define LAMBERTnvarying vec3 vLightFront;nvarying vec3 vIndirectFront;n#ifdef DOUBLE_SIDEDntvarying vec3 vLightBack;ntvarying vec3 vIndirectBack;n#endifn#include <common>n#include <uv_pars_vertex>n#include <uv2_pars_vertex>n#include <envmap_pars_vertex>n#include <bsdfs>n#include <lights_pars_begin>n#include <color_pars_vertex>n#include <fog_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() {nt#include <uv_vertex>nt#include <uv2_vertex>nt#include <color_vertex>nt#include <beginnormal_vertex>nt#include <morphnormal_vertex>nt#include <skinbase_vertex>nt#include <skinnormal_vertex>nt#include <defaultnormal_vertex>nt#include <begin_vertex>nt#include <morphtarget_vertex>nt#include <skinning_vertex>nt#include <project_vertex>nt#include <logdepthbuf_vertex>nt#include <clipping_planes_vertex>nt#include <worldpos_vertex>nt#include <envmap_vertex>nt#include <lights_lambert_vertex>nt#include <shadowmap_vertex>nt#include <fog_vertex>n}\",Us=\"#define MATCAPnuniform vec3 diffuse;nuniform float opacity;nuniform sampler2D matcap;nvarying vec3 vViewPosition;n#ifndef FLAT_SHADEDntvarying vec3 vNormal;n#endifn#include <common>n#include <color_pars_fragment>n#include <uv_pars_fragment>n#include <map_pars_fragment>n#include <alphamap_pars_fragment>n#include <fog_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() {nt#include <clipping_planes_fragment>ntvec4 diffuseColor = vec4( diffuse, opacity );nt#include <logdepthbuf_fragment>nt#include <map_fragment>nt#include <color_fragment>nt#include <alphamap_fragment>nt#include <alphatest_fragment>nt#include <normal_fragment_begin>nt#include <normal_fragment_maps>ntvec3 viewDir = normalize( vViewPosition );ntvec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );ntvec3 y = cross( viewDir, x );ntvec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;nt#ifdef USE_MATCAPnttvec4 matcapColor = texture2D( matcap, uv );nttmatcapColor = matcapTexelToLinear( matcapColor );nt#elsenttvec4 matcapColor = vec4( 1.0 );nt#endifntvec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;ntgl_FragColor = vec4( outgoingLight, diffuseColor.a );nt#include <tonemapping_fragment>nt#include <encodings_fragment>nt#include <fog_fragment>nt#include <premultiplied_alpha_fragment>n}\",Gs=\"#define MATCAPnvarying vec3 vViewPosition;n#ifndef FLAT_SHADEDntvarying vec3 vNormal;n#endifn#include <common>n#include <uv_pars_vertex>n#include <color_pars_vertex>n#include <displacementmap_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() {nt#include <uv_vertex>nt#include <color_vertex>nt#include <beginnormal_vertex>nt#include <morphnormal_vertex>nt#include <skinbase_vertex>nt#include <skinnormal_vertex>nt#include <defaultnormal_vertex>nt#ifndef FLAT_SHADEDnttvNormal = normalize( transformedNormal );nt#endifnt#include <begin_vertex>nt#include <morphtarget_vertex>nt#include <skinning_vertex>nt#include <displacementmap_vertex>nt#include <project_vertex>nt#include <logdepthbuf_vertex>nt#include <clipping_planes_vertex>nt#include <fog_vertex>ntvViewPosition = - mvPosition.xyz;n}\",zs=\"#define TOONnuniform 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 <uv2_pars_fragment>n#include <map_pars_fragment>n#include <alphamap_pars_fragment>n#include <aomap_pars_fragment>n#include <lightmap_pars_fragment>n#include <emissivemap_pars_fragment>n#include <gradientmap_pars_fragment>n#include <fog_pars_fragment>n#include <bsdfs>n#include <lights_pars_begin>n#include <lights_toon_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() {nt#include <clipping_planes_fragment>ntvec4 diffuseColor = vec4( diffuse, opacity );ntReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );ntvec3 totalEmissiveRadiance = emissive;nt#include <logdepthbuf_fragment>nt#include <map_fragment>nt#include <color_fragment>nt#include <alphamap_fragment>nt#include <alphatest_fragment>nt#include <specularmap_fragment>nt#include <normal_fragment_begin>nt#include <normal_fragment_maps>nt#include <emissivemap_fragment>nt#include <lights_toon_fragment>nt#include <lights_fragment_begin>nt#include <lights_fragment_maps>nt#include <lights_fragment_end>nt#include <aomap_fragment>ntvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;ntgl_FragColor = vec4( outgoingLight, diffuseColor.a );nt#include <tonemapping_fragment>nt#include <encodings_fragment>nt#include <fog_fragment>nt#include <premultiplied_alpha_fragment>nt#include <dithering_fragment>n}\",Hs=\"#define TOONnvarying vec3 vViewPosition;n#ifndef FLAT_SHADEDntvarying vec3 vNormal;n#endifn#include <common>n#include <uv_pars_vertex>n#include <uv2_pars_vertex>n#include <displacementmap_pars_vertex>n#include <color_pars_vertex>n#include <fog_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() {nt#include <uv_vertex>nt#include <uv2_vertex>nt#include <color_vertex>nt#include <beginnormal_vertex>nt#include <morphnormal_vertex>nt#include <skinbase_vertex>nt#include <skinnormal_vertex>nt#include <defaultnormal_vertex>n#ifndef FLAT_SHADEDntvNormal = normalize( transformedNormal );n#endifnt#include <begin_vertex>nt#include <morphtarget_vertex>nt#include <skinning_vertex>nt#include <displacementmap_vertex>nt#include <project_vertex>nt#include <logdepthbuf_vertex>nt#include <clipping_planes_vertex>ntvViewPosition = - mvPosition.xyz;nt#include <worldpos_vertex>nt#include <shadowmap_vertex>nt#include <fog_vertex>n}\",Vs=\"#define PHONGnuniform 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 <uv2_pars_fragment>n#include <map_pars_fragment>n#include <alphamap_pars_fragment>n#include <aomap_pars_fragment>n#include <lightmap_pars_fragment>n#include <emissivemap_pars_fragment>n#include <envmap_common_pars_fragment>n#include <envmap_pars_fragment>n#include <cube_uv_reflection_fragment>n#include <fog_pars_fragment>n#include <bsdfs>n#include <lights_pars_begin>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() {nt#include <clipping_planes_fragment>ntvec4 diffuseColor = vec4( diffuse, opacity );ntReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );ntvec3 totalEmissiveRadiance = emissive;nt#include <logdepthbuf_fragment>nt#include <map_fragment>nt#include <color_fragment>nt#include <alphamap_fragment>nt#include <alphatest_fragment>nt#include <specularmap_fragment>nt#include <normal_fragment_begin>nt#include <normal_fragment_maps>nt#include <emissivemap_fragment>nt#include <lights_phong_fragment>nt#include <lights_fragment_begin>nt#include <lights_fragment_maps>nt#include <lights_fragment_end>nt#include <aomap_fragment>ntvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;nt#include <envmap_fragment>ntgl_FragColor = vec4( outgoingLight, diffuseColor.a );nt#include <tonemapping_fragment>nt#include <encodings_fragment>nt#include <fog_fragment>nt#include <premultiplied_alpha_fragment>nt#include <dithering_fragment>n}\",ks=\"#define PHONGnvarying vec3 vViewPosition;n#ifndef FLAT_SHADEDntvarying vec3 vNormal;n#endifn#include <common>n#include <uv_pars_vertex>n#include <uv2_pars_vertex>n#include <displacementmap_pars_vertex>n#include <envmap_pars_vertex>n#include <color_pars_vertex>n#include <fog_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() {nt#include <uv_vertex>nt#include <uv2_vertex>nt#include <color_vertex>nt#include <beginnormal_vertex>nt#include <morphnormal_vertex>nt#include <skinbase_vertex>nt#include <skinnormal_vertex>nt#include <defaultnormal_vertex>n#ifndef FLAT_SHADEDntvNormal = normalize( transformedNormal );n#endifnt#include <begin_vertex>nt#include <morphtarget_vertex>nt#include <skinning_vertex>nt#include <displacementmap_vertex>nt#include <project_vertex>nt#include <logdepthbuf_vertex>nt#include <clipping_planes_vertex>ntvViewPosition = - mvPosition.xyz;nt#include <worldpos_vertex>nt#include <envmap_vertex>nt#include <shadowmap_vertex>nt#include <fog_vertex>n}\",js=\"#define STANDARDn#ifdef PHYSICALnt#define REFLECTIVITYnt#define CLEARCOATnt#define TRANSPARENCYn#endifnuniform vec3 diffuse;nuniform vec3 emissive;nuniform float roughness;nuniform float metalness;nuniform float opacity;n#ifdef TRANSPARENCYntuniform float transparency;n#endifn#ifdef REFLECTIVITYntuniform float reflectivity;n#endifn#ifdef CLEARCOATntuniform float clearcoat;ntuniform float clearcoatRoughness;n#endifn#ifdef USE_SHEENntuniform vec3 sheen;n#endifnvarying vec3 vViewPosition;n#ifndef FLAT_SHADEDntvarying vec3 vNormal;nt#ifdef USE_TANGENTnttvarying vec3 vTangent;nttvarying vec3 vBitangent;nt#endifn#endifn#include <common>n#include <packing>n#include <dithering_pars_fragment>n#include <color_pars_fragment>n#include <uv_pars_fragment>n#include <uv2_pars_fragment>n#include <map_pars_fragment>n#include <alphamap_pars_fragment>n#include <aomap_pars_fragment>n#include <lightmap_pars_fragment>n#include <emissivemap_pars_fragment>n#include <bsdfs>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 <lights_physical_pars_fragment>n#include <shadowmap_pars_fragment>n#include <bumpmap_pars_fragment>n#include <normalmap_pars_fragment>n#include <clearcoat_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() {nt#include <clipping_planes_fragment>ntvec4 diffuseColor = vec4( diffuse, opacity );ntReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );ntvec3 totalEmissiveRadiance = emissive;nt#include <logdepthbuf_fragment>nt#include <map_fragment>nt#include <color_fragment>nt#include <alphamap_fragment>nt#include <alphatest_fragment>nt#include <roughnessmap_fragment>nt#include <metalnessmap_fragment>nt#include <normal_fragment_begin>nt#include <normal_fragment_maps>nt#include <clearcoat_normal_fragment_begin>nt#include <clearcoat_normal_fragment_maps>nt#include <emissivemap_fragment>nt#include <lights_physical_fragment>nt#include <lights_fragment_begin>nt#include <lights_fragment_maps>nt#include <lights_fragment_end>nt#include <aomap_fragment>ntvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;nt#ifdef TRANSPARENCYnttdiffuseColor.a *= saturate( 1. - transparency + linearToRelativeLuminance( reflectedLight.directSpecular + reflectedLight.indirectSpecular ) );nt#endifntgl_FragColor = vec4( outgoingLight, diffuseColor.a );nt#include <tonemapping_fragment>nt#include <encodings_fragment>nt#include <fog_fragment>nt#include <premultiplied_alpha_fragment>nt#include <dithering_fragment>n}\",Ws=\"#define STANDARDnvarying vec3 vViewPosition;n#ifndef FLAT_SHADEDntvarying vec3 vNormal;nt#ifdef USE_TANGENTnttvarying vec3 vTangent;nttvarying vec3 vBitangent;nt#endifn#endifn#include <common>n#include <uv_pars_vertex>n#include <uv2_pars_vertex>n#include <displacementmap_pars_vertex>n#include <color_pars_vertex>n#include <fog_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() {nt#include <uv_vertex>nt#include <uv2_vertex>nt#include <color_vertex>nt#include <beginnormal_vertex>nt#include <morphnormal_vertex>nt#include <skinbase_vertex>nt#include <skinnormal_vertex>nt#include <defaultnormal_vertex>n#ifndef FLAT_SHADEDntvNormal = normalize( transformedNormal );nt#ifdef USE_TANGENTnttvTangent = normalize( transformedTangent );nttvBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );nt#endifn#endifnt#include <begin_vertex>nt#include <morphtarget_vertex>nt#include <skinning_vertex>nt#include <displacementmap_vertex>nt#include <project_vertex>nt#include <logdepthbuf_vertex>nt#include <clipping_planes_vertex>ntvViewPosition = - mvPosition.xyz;nt#include <worldpos_vertex>nt#include <shadowmap_vertex>nt#include <fog_vertex>n}\",qs=\"#define NORMALnuniform float opacity;n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )ntvarying vec3 vViewPosition;n#endifn#ifndef FLAT_SHADEDntvarying vec3 vNormal;nt#ifdef USE_TANGENTnttvarying vec3 vTangent;nttvarying vec3 vBitangent;nt#endifn#endifn#include <packing>n#include <uv_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() {nt#include <clipping_planes_fragment>nt#include <logdepthbuf_fragment>nt#include <normal_fragment_begin>nt#include <normal_fragment_maps>ntgl_FragColor = vec4( packNormalToRGB( normal ), opacity );n}\",Xs=\"#define NORMALn#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )ntvarying vec3 vViewPosition;n#endifn#ifndef FLAT_SHADEDntvarying vec3 vNormal;nt#ifdef USE_TANGENTnttvarying vec3 vTangent;nttvarying vec3 vBitangent;nt#endifn#endifn#include <common>n#include <uv_pars_vertex>n#include <displacementmap_pars_vertex>n#include <morphtarget_pars_vertex>n#include <skinning_pars_vertex>n#include <logdepthbuf_pars_vertex>n#include <clipping_planes_pars_vertex>nvoid main() {nt#include <uv_vertex>nt#include <beginnormal_vertex>nt#include <morphnormal_vertex>nt#include <skinbase_vertex>nt#include <skinnormal_vertex>nt#include <defaultnormal_vertex>n#ifndef FLAT_SHADEDntvNormal = normalize( transformedNormal );nt#ifdef USE_TANGENTnttvTangent = normalize( transformedTangent );nttvBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );nt#endifn#endifnt#include <begin_vertex>nt#include <morphtarget_vertex>nt#include <skinning_vertex>nt#include <displacementmap_vertex>nt#include <project_vertex>nt#include <logdepthbuf_vertex>nt#include <clipping_planes_vertex>n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )ntvViewPosition = - mvPosition.xyz;n#endifn}\",Ys=\"uniform vec3 diffuse;nuniform float opacity;n#include <common>n#include <color_pars_fragment>n#include <map_particle_pars_fragment>n#include <fog_pars_fragment>n#include <logdepthbuf_pars_fragment>n#include <clipping_planes_pars_fragment>nvoid main() {nt#include <clipping_planes_fragment>ntvec3 outgoingLight = vec3( 0.0 );ntvec4 diffuseColor = vec4( diffuse, opacity );nt#include <logdepthbuf_fragment>nt#include <map_particle_fragment>nt#include <color_fragment>nt#include <alphatest_fragment>ntoutgoingLight = diffuseColor.rgb;ntgl_FragColor = vec4( outgoingLight, diffuseColor.a );nt#include <tonemapping_fragment>nt#include <encodings_fragment>nt#include <fog_fragment>nt#include <premultiplied_alpha_fragment>n}\",Zs=\"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>nvoid main() {nt#include <color_vertex>nt#include <begin_vertex>nt#include <morphtarget_vertex>nt#include <project_vertex>ntgl_PointSize = size;nt#ifdef USE_SIZEATTENUATIONnttbool isPerspective = isPerspectiveMatrix( projectionMatrix );nttif ( isPerspective ) gl_PointSize *= ( scale \/ - mvPosition.z );nt#endifnt#include <logdepthbuf_vertex>nt#include <clipping_planes_vertex>nt#include <worldpos_vertex>nt#include <fog_vertex>n}\",Js=\"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 <shadowmap_pars_fragment>n#include <shadowmask_pars_fragment>nvoid main() {ntgl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );nt#include <tonemapping_fragment>nt#include <encodings_fragment>nt#include <fog_fragment>n}\",Qs=\"#include <fog_pars_vertex>n#include <shadowmap_pars_vertex>nvoid main() {nt#include <begin_vertex>nt#include <project_vertex>nt#include <worldpos_vertex>nt#include <shadowmap_vertex>nt#include <fog_vertex>n}\",Ks=\"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 <fog_pars_fragment>n#include <logdepthbuf_pars_fragment>n#include <clipping_planes_pars_fragment>nvoid main() {nt#include <clipping_planes_fragment>ntvec3 outgoingLight = vec3( 0.0 );ntvec4 diffuseColor = vec4( diffuse, opacity );nt#include <logdepthbuf_fragment>nt#include <map_fragment>nt#include <alphamap_fragment>nt#include <alphatest_fragment>ntoutgoingLight = diffuseColor.rgb;ntgl_FragColor = vec4( outgoingLight, diffuseColor.a );nt#include <tonemapping_fragment>nt#include <encodings_fragment>nt#include <fog_fragment>n}\",$s=\"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() {nt#include <uv_vertex>ntvec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );ntvec2 scale;ntscale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) );ntscale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) );nt#ifndef USE_SIZEATTENUATIONnttbool isPerspective = isPerspectiveMatrix( projectionMatrix );nttif ( isPerspective ) scale *= - mvPosition.z;nt#endifntvec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;ntvec2 rotatedPosition;ntrotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;ntrotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;ntmvPosition.xy += rotatedPosition;ntgl_Position = projectionMatrix * mvPosition;nt#include <logdepthbuf_vertex>nt#include <clipping_planes_vertex>nt#include <fog_vertex>n}\",ec={alphamap_fragment:Ia,alphamap_pars_fragment:Na,alphatest_fragment:Ba,aomap_fragment:Fa,aomap_pars_fragment:Ua,begin_vertex:Ga,beginnormal_vertex:za,bsdfs:Ha,bumpmap_pars_fragment:Va,clipping_planes_fragment:ka,clipping_planes_pars_fragment:ja,clipping_planes_pars_vertex:Wa,clipping_planes_vertex:qa,color_fragment:Xa,color_pars_fragment:Ya,color_pars_vertex:Za,color_vertex:Ja,common:Qa,cube_uv_reflection_fragment:Ka,defaultnormal_vertex:$a,displacementmap_pars_vertex:eo,displacementmap_vertex:to,emissivemap_fragment:ro,emissivemap_pars_fragment:no,encodings_fragment:io,encodings_pars_fragment:ao,envmap_fragment:oo,envmap_common_pars_fragment:so,envmap_pars_fragment:co,envmap_pars_vertex:lo,envmap_physical_pars_fragment:bo,envmap_vertex:ho,fog_vertex:uo,fog_pars_vertex:po,fog_fragment:fo,fog_pars_fragment:mo,gradientmap_pars_fragment:vo,lightmap_fragment:go,lightmap_pars_fragment:yo,lights_lambert_vertex:xo,lights_pars_begin:_o,lights_toon_fragment:wo,lights_toon_pars_fragment:Mo,lights_phong_fragment:So,lights_phong_pars_fragment:To,lights_physical_fragment:Eo,lights_physical_pars_fragment:Ao,lights_fragment_begin:Lo,lights_fragment_maps:Ro,lights_fragment_end:Co,logdepthbuf_fragment:Po,logdepthbuf_pars_fragment:Oo,logdepthbuf_pars_vertex:Do,logdepthbuf_vertex:Io,map_fragment:No,map_pars_fragment:Bo,map_particle_fragment:Fo,map_particle_pars_fragment:Uo,metalnessmap_fragment:Go,metalnessmap_pars_fragment:zo,morphnormal_vertex:Ho,morphtarget_pars_vertex:Vo,morphtarget_vertex:ko,normal_fragment_begin:jo,normal_fragment_maps:Wo,normalmap_pars_fragment:qo,clearcoat_normal_fragment_begin:Xo,clearcoat_normal_fragment_maps:Yo,clearcoat_pars_fragment:Zo,packing:Jo,premultiplied_alpha_fragment:Qo,project_vertex:Ko,dithering_fragment:$o,dithering_pars_fragment:es,roughnessmap_fragment:ts,roughnessmap_pars_fragment:rs,shadowmap_pars_fragment:ns,shadowmap_pars_vertex:is,shadowmap_vertex:as,shadowmask_pars_fragment:os,skinbase_vertex:ss,skinning_pars_vertex:cs,skinning_vertex:ls,skinnormal_vertex:hs,specularmap_fragment:us,specularmap_pars_fragment:ps,tonemapping_fragment:ds,tonemapping_pars_fragment:fs,uv_pars_fragment:ms,uv_pars_vertex:vs,uv_vertex:gs,uv2_pars_fragment:ys,uv2_pars_vertex:xs,uv2_vertex:_s,worldpos_vertex:bs,background_frag:ws,background_vert:Ms,cube_frag:Ss,cube_vert:Ts,depth_frag:Es,depth_vert:As,distanceRGBA_frag:Ls,distanceRGBA_vert:Rs,equirect_frag:Cs,equirect_vert:Ps,linedashed_frag:Os,linedashed_vert:Ds,meshbasic_frag:Is,meshbasic_vert:Ns,meshlambert_frag:Bs,meshlambert_vert:Fs,meshmatcap_frag:Us,meshmatcap_vert:Gs,meshtoon_frag:zs,meshtoon_vert:Hs,meshphong_frag:Vs,meshphong_vert:ks,meshphysical_frag:js,meshphysical_vert:Ws,normal_frag:qs,normal_vert:Xs,points_frag:Ys,points_vert:Zs,shadow_frag:Js,shadow_vert:Qs,sprite_frag:Ks,sprite_vert:$s};exports.ShaderChunk=ec;var tc={basic:{uniforms:fa([Ra.common,Ra.specularmap,Ra.envmap,Ra.aomap,Ra.lightmap,Ra.fog]),vertexShader:ec.meshbasic_vert,fragmentShader:ec.meshbasic_frag},lambert:{uniforms:fa([Ra.common,Ra.specularmap,Ra.envmap,Ra.aomap,Ra.lightmap,Ra.emissivemap,Ra.fog,Ra.lights,{emissive:{value:new ui(0)}}]),vertexShader:ec.meshlambert_vert,fragmentShader:ec.meshlambert_frag},phong:{uniforms:fa([Ra.common,Ra.specularmap,Ra.envmap,Ra.aomap,Ra.lightmap,Ra.emissivemap,Ra.bumpmap,Ra.normalmap,Ra.displacementmap,Ra.fog,Ra.lights,{emissive:{value:new ui(0)},specular:{value:new ui(1118481)},shininess:{value:30}}]),vertexShader:ec.meshphong_vert,fragmentShader:ec.meshphong_frag},standard:{uniforms:fa([Ra.common,Ra.envmap,Ra.aomap,Ra.lightmap,Ra.emissivemap,Ra.bumpmap,Ra.normalmap,Ra.displacementmap,Ra.roughnessmap,Ra.metalnessmap,Ra.fog,Ra.lights,{emissive:{value:new ui(0)},roughness:{value:.5},metalness:{value:.5},envMapIntensity:{value:1}}]),vertexShader:ec.meshphysical_vert,fragmentShader:ec.meshphysical_frag},toon:{uniforms:fa([Ra.common,Ra.specularmap,Ra.aomap,Ra.lightmap,Ra.emissivemap,Ra.bumpmap,Ra.normalmap,Ra.displacementmap,Ra.gradientmap,Ra.fog,Ra.lights,{emissive:{value:new ui(0)},specular:{value:new ui(1118481)},shininess:{value:30}}]),vertexShader:ec.meshtoon_vert,fragmentShader:ec.meshtoon_frag},matcap:{uniforms:fa([Ra.common,Ra.bumpmap,Ra.normalmap,Ra.displacementmap,Ra.fog,{matcap:{value:null}}]),vertexShader:ec.meshmatcap_vert,fragmentShader:ec.meshmatcap_frag},points:{uniforms:fa([Ra.points,Ra.fog]),vertexShader:ec.points_vert,fragmentShader:ec.points_frag},dashed:{uniforms:fa([Ra.common,Ra.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:ec.linedashed_vert,fragmentShader:ec.linedashed_frag},depth:{uniforms:fa([Ra.common,Ra.displacementmap]),vertexShader:ec.depth_vert,fragmentShader:ec.depth_frag},normal:{uniforms:fa([Ra.common,Ra.bumpmap,Ra.normalmap,Ra.displacementmap,{opacity:{value:1}}]),vertexShader:ec.normal_vert,fragmentShader:ec.normal_frag},sprite:{uniforms:fa([Ra.sprite,Ra.fog]),vertexShader:ec.sprite_vert,fragmentShader:ec.sprite_frag},background:{uniforms:{uvTransform:{value:new Fr},t2D:{value:null}},vertexShader:ec.background_vert,fragmentShader:ec.background_frag},cube:{uniforms:fa([Ra.envmap,{opacity:{value:1}}]),vertexShader:ec.cube_vert,fragmentShader:ec.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:ec.equirect_vert,fragmentShader:ec.equirect_frag},distanceRGBA:{uniforms:fa([Ra.common,Ra.displacementmap,{referencePosition:{value:new Xr},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:ec.distanceRGBA_vert,fragmentShader:ec.distanceRGBA_frag},shadow:{uniforms:fa([Ra.lights,Ra.fog,{color:{value:new ui(0)},opacity:{value:1}}]),vertexShader:ec.shadow_vert,fragmentShader:ec.shadow_frag}};function rc(e,t,r,n){var i,a,o=new ui(0),s=0,c=null,l=0,h=null;function u(e,r){t.buffers.color.setClear(e.r,e.g,e.b,r,n)}return{getClearColor:function(){return o},setClearColor:function(e,t){o.set(e),u(o,s=void 0!==t?t:1)},getClearAlpha:function(){return s},setClearAlpha:function(e){u(o,s=e)},render:function(t,n,p,m){var v=n.background,g=e.xr,y=g.getSession&&g.getSession();if(y&&\"additive\"===y.environmentBlendMode&&(v=null),null===v?u(o,s):v&&v.isColor&&(u(v,1),m=!0),(e.autoClear||m)&&e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil),v&&(v.isCubeTexture||v.isWebGLCubeRenderTarget||v.mapping===le)){void 0===a&&((a=new na(new pa(1,1,1),new ya({type:\"BackgroundCubeMaterial\",uniforms:da(tc.cube.uniforms),vertexShader:tc.cube.vertexShader,fragmentShader:tc.cube.fragmentShader,side:f,depthTest:!1,depthWrite:!1,fog:!1}))).geometry.deleteAttribute(\"normal\"),a.geometry.deleteAttribute(\"uv\"),a.onBeforeRender=function(e,t,r){this.matrixWorld.copyPosition(r.matrixWorld)},Object.defineProperty(a.material,\"envMap\",{get:function(){return this.uniforms.envMap.value}}),r.update(a));var x=v.isWebGLCubeRenderTarget?v.texture:v;a.material.uniforms.envMap.value=x,a.material.uniforms.flipEnvMap.value=x.isCubeTexture?-1:1,c===v&&l===x.version&&h===e.toneMapping||(a.material.needsUpdate=!0,c=v,l=x.version,h=e.toneMapping),t.unshift(a,a.geometry,a.material,0,0,null)}else v&&v.isTexture&&(void 0===i&&((i=new na(new Da(2,2),new ya({type:\"BackgroundMaterial\",uniforms:da(tc.background.uniforms),vertexShader:tc.background.vertexShader,fragmentShader:tc.background.fragmentShader,side:d,depthTest:!1,depthWrite:!1,fog:!1}))).geometry.deleteAttribute(\"normal\"),Object.defineProperty(i.material,\"map\",{get:function(){return this.uniforms.t2D.value}}),r.update(i)),i.material.uniforms.t2D.value=v,!0===v.matrixAutoUpdate&&v.updateMatrix(),i.material.uniforms.uvTransform.value.copy(v.matrix),c===v&&l===v.version&&h===e.toneMapping||(i.material.needsUpdate=!0,c=v,l=v.version,h=e.toneMapping),t.unshift(i,i.geometry,i.material,0,0,null))}}}function nc(e,t,r,n){var i,a=n.isWebGL2;this.setMode=function(e){i=e},this.render=function(t,n){e.drawArrays(i,t,n),r.update(n,i)},this.renderInstances=function(n,o,s,c){if(0!==c){var l,h;if(a)l=e,h=\"drawArraysInstanced\";else if(h=\"drawArraysInstancedANGLE\",null===(l=t.get(\"ANGLE_instanced_arrays\")))return void console.error(\"THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.\");l[h](i,o,s,c),r.update(s,i,c)}}}function ic(e,t,r){var n;function i(t){if(\"highp\"===t){if(e.getShaderPrecisionFormat(35633,36338).precision>0&&e.getShaderPrecisionFormat(35632,36338).precision>0)return\"highp\";t=\"mediump\"}return\"mediump\"===t&&e.getShaderPrecisionFormat(35633,36337).precision>0&&e.getShaderPrecisionFormat(35632,36337).precision>0?\"mediump\":\"lowp\"}var a=\"undefined\"!=typeof WebGL2RenderingContext&&e instanceof WebGL2RenderingContext||\"undefined\"!=typeof WebGL2ComputeRenderingContext&&e instanceof WebGL2ComputeRenderingContext,o=void 0!==r.precision?r.precision:\"highp\",s=i(o);s!==o&&(console.warn(\"THREE.WebGLRenderer:\",o,\"not supported, using\",s,\"instead.\"),o=s);var c=!0===r.logarithmicDepthBuffer,l=e.getParameter(34930),h=e.getParameter(35660),u=e.getParameter(3379),p=e.getParameter(34076),d=e.getParameter(34921),f=e.getParameter(36347),m=e.getParameter(36348),v=e.getParameter(36349),g=h>0,y=a||!!t.get(\"OES_texture_float\");return{isWebGL2:a,getMaxAnisotropy:function(){if(void 0!==n)return n;var r=t.get(\"EXT_texture_filter_anisotropic\");return n=null!==r?e.getParameter(r.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0},getMaxPrecision:i,precision:o,logarithmicDepthBuffer:c,maxTextures:l,maxVertexTextures:h,maxTextureSize:u,maxCubemapSize:p,maxAttributes:d,maxVertexUniforms:f,maxVaryings:m,maxFragmentUniforms:v,vertexTextures:g,floatFragmentTextures:y,floatVertexTextures:g&&y,maxSamples:a?e.getParameter(36183):0}}function ac(){var e=this,t=null,r=0,n=!1,i=!1,a=new Jn,o=new Fr,s={value:null,needsUpdate:!1};function c(){s.value!==t&&(s.value=t,s.needsUpdate=r>0),e.numPlanes=r,e.numIntersection=0}function l(t,r,n,i){var c=null!==t?t.length:0,l=null;if(0!==c){if(l=s.value,!0!==i||null===l){var h=n+4*c,u=r.matrixWorldInverse;o.getNormalMatrix(u),(null===l||l.length<h)&&(l=new Float32Array(h));for(var p=0,d=n;p!==c;++p,d+=4)a.copy(t[p]).applyMatrix4(u,o),a.normal.toArray(l,d),l[d+3]=a.constant}s.value=l,s.needsUpdate=!0}return e.numPlanes=c,e.numIntersection=0,l}this.uniform=s,this.numPlanes=0,this.numIntersection=0,this.init=function(e,i,a){var o=0!==e.length||i||0!==r||n;return n=i,t=l(e,a,0),r=e.length,o},this.beginShadows=function(){i=!0,l(null)},this.endShadows=function(){i=!1,c()},this.setState=function(e,a,o,h,u,p){if(!n||null===e||0===e.length||i&&!o)i?l(null):c();else{var d=i?0:r,f=4*d,m=u.clippingState||null;s.value=m,m=l(e,h,f,p);for(var v=0;v!==f;++v)m[v]=t[v];u.clippingState=m,this.numIntersection=a?this.numPlanes:0,this.numPlanes+=d}}}function oc(e){var t={};return{get:function(r){if(void 0!==t[r])return t[r];var n;switch(r){case\"WEBGL_depth_texture\":n=e.getExtension(\"WEBGL_depth_texture\")||e.getExtension(\"MOZ_WEBGL_depth_texture\")||e.getExtension(\"WEBKIT_WEBGL_depth_texture\");break;case\"EXT_texture_filter_anisotropic\":n=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\":n=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\":n=e.getExtension(\"WEBGL_compressed_texture_pvrtc\")||e.getExtension(\"WEBKIT_WEBGL_compressed_texture_pvrtc\");break;default:n=e.getExtension(r)}return null===n&&console.warn(\"THREE.WebGLRenderer: \"+r+\" extension not supported.\"),t[r]=n,n}}}function sc(e,t,r){var n=new WeakMap,i=new WeakMap;function a(e){var o=e.target,s=n.get(o);for(var c in null!==s.index&&t.remove(s.index),s.attributes)t.remove(s.attributes[c]);o.removeEventListener(\"dispose\",a),n.delete(o);var l=i.get(s);l&&(t.remove(l),i.delete(s)),r.memory.geometries--}function o(e){var r=[],n=e.index,a=e.attributes.position,o=0;if(null!==n){var s=n.array;o=n.version;for(var c=0,l=s.length;c<l;c+=3){var h=s[c+0],u=s[c+1],p=s[c+2];r.push(h,u,u,p,p,h)}}else{s=a.array;o=a.version;for(c=0,l=s.length\/3-1;c<l;c+=3){h=c+0,u=c+1,p=c+2;r.push(h,u,u,p,p,h)}}var d=new(Pi(r)>65535?Ai:Ti)(r,1);d.version=o,t.update(d,34963);var f=i.get(e);f&&t.remove(f),i.set(e,d)}return{get:function(e,t){var i=n.get(t);return i||(t.addEventListener(\"dispose\",a),t.isBufferGeometry?i=t:t.isGeometry&&(void 0===t._bufferGeometry&&(t._bufferGeometry=(new Gi).setFromObject(e)),i=t._bufferGeometry),n.set(t,i),r.memory.geometries++,i)},update:function(e){var r=e.index,n=e.attributes;for(var i in null!==r&&t.update(r,34963),n)t.update(n[i],34962);var a=e.morphAttributes;for(var i in a)for(var o=a[i],s=0,c=o.length;s<c;s++)t.update(o[s],34962)},getWireframeAttribute:function(e){var t=i.get(e);if(t){var r=e.index;null!==r&&t.version<r.version&&o(e)}else o(e);return i.get(e)}}}function cc(e,t,r,n){var i,a,o,s=n.isWebGL2;this.setMode=function(e){i=e},this.setIndex=function(e){a=e.type,o=e.bytesPerElement},this.render=function(t,n){e.drawElements(i,n,a,t*o),r.update(n,i)},this.renderInstances=function(n,c,l,h){if(0!==h){var u,p;if(s)u=e,p=\"drawElementsInstanced\";else if(p=\"drawElementsInstancedANGLE\",null===(u=t.get(\"ANGLE_instanced_arrays\")))return void console.error(\"THREE.WebGLIndexedBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.\");u[p](i,l,a,c*o,h),r.update(l,i,h)}}}function lc(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.frame++,t.calls=0,t.triangles=0,t.points=0,t.lines=0},update:function(e,r,n){switch(n=n||1,t.calls++,r){case 4:t.triangles+=n*(e\/3);break;case 1:t.lines+=n*(e\/2);break;case 3:t.lines+=n*(e-1);break;case 2:t.lines+=n*e;break;case 0:t.points+=n*e;break;default:console.error(\"THREE.WebGLInfo: Unknown draw mode:\",r)}}}}function hc(e,t){return Math.abs(t[1])-Math.abs(e[1])}function uc(e){var t={},r=new Float32Array(8);return{update:function(n,i,a,o){var s=n.morphTargetInfluences,c=void 0===s?0:s.length,l=t[i.id];if(void 0===l){l=[];for(var h=0;h<c;h++)l[h]=[h,0];t[i.id]=l}var u=a.morphTargets&&i.morphAttributes.position,p=a.morphNormals&&i.morphAttributes.normal;for(h=0;h<c;h++)0!==(f=l[h])[1]&&(u&&i.deleteAttribute(\"morphTarget\"+h),p&&i.deleteAttribute(\"morphNormal\"+h));for(h=0;h<c;h++)(f=l[h])[0]=h,f[1]=s[h];l.sort(hc);var d=0;for(h=0;h<8;h++){var f;if(f=l[h]){var m=f[0],v=f[1];if(v){u&&i.setAttribute(\"morphTarget\"+h,u[m]),p&&i.setAttribute(\"morphNormal\"+h,p[m]),r[h]=v,d+=v;continue}}r[h]=0}var g=i.morphTargetsRelative?1:1-d;o.getUniforms().setValue(e,\"morphTargetBaseInfluence\",g),o.getUniforms().setValue(e,\"morphTargetInfluences\",r)}}}function pc(e,t,r,n){var i=new WeakMap;return{update:function(e){var a=n.render.frame,o=e.geometry,s=t.get(e,o);return i.get(s)!==a&&(o.isGeometry&&s.updateFromObject(e),t.update(s),i.set(s,a)),e.isInstancedMesh&&r.update(e.instanceMatrix,34962),s},dispose:function(){i=new WeakMap}}}function dc(e,t,r,n,i,a,o,s,c,l){e=void 0!==e?e:[],t=void 0!==t?t:ie,o=void 0!==o?o:Fe,zr.call(this,e,t,r,n,i,a,o,s,c,l),this.flipY=!1}function fc(e,t,r,n){zr.call(this,null),this.image={data:e||null,width:t||1,height:r||1,depth:n||1},this.magFilter=fe,this.minFilter=fe,this.wrapR=pe,this.generateMipmaps=!1,this.flipY=!1,this.needsUpdate=!0}function mc(e,t,r,n){zr.call(this,null),this.image={data:e||null,width:t||1,height:r||1,depth:n||1},this.magFilter=fe,this.minFilter=fe,this.wrapR=pe,this.generateMipmaps=!1,this.flipY=!1,this.needsUpdate=!0}exports.ShaderLib=tc,tc.physical={uniforms:fa([tc.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatNormalScale:{value:new Br(1,1)},clearcoatNormalMap:{value:null},sheen:{value:new ui(0)},transparency:{value:0}}]),vertexShader:ec.meshphysical_vert,fragmentShader:ec.meshphysical_frag},dc.prototype=Object.create(zr.prototype),dc.prototype.constructor=dc,dc.prototype.isCubeTexture=!0,Object.defineProperty(dc.prototype,\"images\",{get:function(){return this.image},set:function(e){this.image=e}}),fc.prototype=Object.create(zr.prototype),fc.prototype.constructor=fc,fc.prototype.isDataTexture2DArray=!0,mc.prototype=Object.create(zr.prototype),mc.prototype.constructor=mc,mc.prototype.isDataTexture3D=!0;var vc=new zr,gc=new fc,yc=new mc,xc=new dc,_c=[],bc=[],wc=new Float32Array(16),Mc=new Float32Array(9),Sc=new Float32Array(4);function Tc(e,t,r){var n=e[0];if(n<=0||n>0)return e;var i=t*r,a=_c[i];if(void 0===a&&(a=new Float32Array(i),_c[i]=a),0!==t){n.toArray(a,0);for(var o=1,s=0;o!==t;++o)s+=r,e[o].toArray(a,s)}return a}function Ec(e,t){if(e.length!==t.length)return!1;for(var r=0,n=e.length;r<n;r++)if(e[r]!==t[r])return!1;return!0}function Ac(e,t){for(var r=0,n=t.length;r<n;r++)e[r]=t[r]}function Lc(e,t){var r=bc[t];void 0===r&&(r=new Int32Array(t),bc[t]=r);for(var n=0;n!==t;++n)r[n]=e.allocateTextureUnit();return r}function Rc(e,t){var r=this.cache;r[0]!==t&&(e.uniform1f(this.addr,t),r[0]=t)}function Cc(e,t){var r=this.cache;if(void 0!==t.x)r[0]===t.x&&r[1]===t.y||(e.uniform2f(this.addr,t.x,t.y),r[0]=t.x,r[1]=t.y);else{if(Ec(r,t))return;e.uniform2fv(this.addr,t),Ac(r,t)}}function Pc(e,t){var r=this.cache;if(void 0!==t.x)r[0]===t.x&&r[1]===t.y&&r[2]===t.z||(e.uniform3f(this.addr,t.x,t.y,t.z),r[0]=t.x,r[1]=t.y,r[2]=t.z);else if(void 0!==t.r)r[0]===t.r&&r[1]===t.g&&r[2]===t.b||(e.uniform3f(this.addr,t.r,t.g,t.b),r[0]=t.r,r[1]=t.g,r[2]=t.b);else{if(Ec(r,t))return;e.uniform3fv(this.addr,t),Ac(r,t)}}function Oc(e,t){var r=this.cache;if(void 0!==t.x)r[0]===t.x&&r[1]===t.y&&r[2]===t.z&&r[3]===t.w||(e.uniform4f(this.addr,t.x,t.y,t.z,t.w),r[0]=t.x,r[1]=t.y,r[2]=t.z,r[3]=t.w);else{if(Ec(r,t))return;e.uniform4fv(this.addr,t),Ac(r,t)}}function Dc(e,t){var r=this.cache,n=t.elements;if(void 0===n){if(Ec(r,t))return;e.uniformMatrix2fv(this.addr,!1,t),Ac(r,t)}else{if(Ec(r,n))return;Sc.set(n),e.uniformMatrix2fv(this.addr,!1,Sc),Ac(r,n)}}function Ic(e,t){var r=this.cache,n=t.elements;if(void 0===n){if(Ec(r,t))return;e.uniformMatrix3fv(this.addr,!1,t),Ac(r,t)}else{if(Ec(r,n))return;Mc.set(n),e.uniformMatrix3fv(this.addr,!1,Mc),Ac(r,n)}}function Nc(e,t){var r=this.cache,n=t.elements;if(void 0===n){if(Ec(r,t))return;e.uniformMatrix4fv(this.addr,!1,t),Ac(r,t)}else{if(Ec(r,n))return;wc.set(n),e.uniformMatrix4fv(this.addr,!1,wc),Ac(r,n)}}function Bc(e,t,r){var n=this.cache,i=r.allocateTextureUnit();n[0]!==i&&(e.uniform1i(this.addr,i),n[0]=i),r.safeSetTexture2D(t||vc,i)}function Fc(e,t,r){var n=this.cache,i=r.allocateTextureUnit();n[0]!==i&&(e.uniform1i(this.addr,i),n[0]=i),r.setTexture2DArray(t||gc,i)}function Uc(e,t,r){var n=this.cache,i=r.allocateTextureUnit();n[0]!==i&&(e.uniform1i(this.addr,i),n[0]=i),r.setTexture3D(t||yc,i)}function Gc(e,t,r){var n=this.cache,i=r.allocateTextureUnit();n[0]!==i&&(e.uniform1i(this.addr,i),n[0]=i),r.safeSetTextureCube(t||xc,i)}function zc(e,t){var r=this.cache;r[0]!==t&&(e.uniform1i(this.addr,t),r[0]=t)}function Hc(e,t){var r=this.cache;Ec(r,t)||(e.uniform2iv(this.addr,t),Ac(r,t))}function Vc(e,t){var r=this.cache;Ec(r,t)||(e.uniform3iv(this.addr,t),Ac(r,t))}function kc(e,t){var r=this.cache;Ec(r,t)||(e.uniform4iv(this.addr,t),Ac(r,t))}function jc(e,t){var r=this.cache;r[0]!==t&&(e.uniform1ui(this.addr,t),r[0]=t)}function Wc(e){switch(e){case 5126:return Rc;case 35664:return Cc;case 35665:return Pc;case 35666:return Oc;case 35674:return Dc;case 35675:return Ic;case 35676:return Nc;case 5124:case 35670:return zc;case 35667:case 35671:return Hc;case 35668:case 35672:return Vc;case 35669:case 35673:return kc;case 5125:return jc;case 35678:case 36198:case 36298:case 36306:case 35682:return Bc;case 35679:case 36299:case 36307:return Uc;case 35680:case 36300:case 36308:case 36293:return Gc;case 36289:case 36303:case 36311:case 36292:return Fc}}function qc(e,t){e.uniform1fv(this.addr,t)}function Xc(e,t){e.uniform1iv(this.addr,t)}function Yc(e,t){e.uniform2iv(this.addr,t)}function Zc(e,t){e.uniform3iv(this.addr,t)}function Jc(e,t){e.uniform4iv(this.addr,t)}function Qc(e,t){var r=Tc(t,this.size,2);e.uniform2fv(this.addr,r)}function Kc(e,t){var r=Tc(t,this.size,3);e.uniform3fv(this.addr,r)}function $c(e,t){var r=Tc(t,this.size,4);e.uniform4fv(this.addr,r)}function el(e,t){var r=Tc(t,this.size,4);e.uniformMatrix2fv(this.addr,!1,r)}function tl(e,t){var r=Tc(t,this.size,9);e.uniformMatrix3fv(this.addr,!1,r)}function rl(e,t){var r=Tc(t,this.size,16);e.uniformMatrix4fv(this.addr,!1,r)}function nl(e,t,r){var n=t.length,i=Lc(r,n);e.uniform1iv(this.addr,i);for(var a=0;a!==n;++a)r.safeSetTexture2D(t[a]||vc,i[a])}function il(e,t,r){var n=t.length,i=Lc(r,n);e.uniform1iv(this.addr,i);for(var a=0;a!==n;++a)r.safeSetTextureCube(t[a]||xc,i[a])}function al(e){switch(e){case 5126:return qc;case 35664:return Qc;case 35665:return Kc;case 35666:return $c;case 35674:return el;case 35675:return tl;case 35676:return rl;case 5124:case 35670:return Xc;case 35667:case 35671:return Yc;case 35668:case 35672:return Zc;case 35669:case 35673:return Jc;case 35678:case 36198:case 36298:case 36306:case 35682:return nl;case 35680:case 36300:case 36308:case 36293:return il}}function ol(e,t,r){this.id=e,this.addr=r,this.cache=[],this.setValue=Wc(t.type)}function sl(e,t,r){this.id=e,this.addr=r,this.cache=[],this.size=t.size,this.setValue=al(t.type)}function cl(e){this.id=e,this.seq=[],this.map={}}sl.prototype.updateCache=function(e){var t=this.cache;e instanceof Float32Array&&t.length!==e.length&&(this.cache=new Float32Array(e.length)),Ac(t,e)},cl.prototype.setValue=function(e,t,r){for(var n=this.seq,i=0,a=n.length;i!==a;++i){var o=n[i];o.setValue(e,t[o.id],r)}};var ll=\/([wd_]+)(])?([|.)?\/g;function hl(e,t){e.seq.push(t),e.map[t.id]=t}function ul(e,t,r){var n=e.name,i=n.length;for(ll.lastIndex=0;;){var a=ll.exec(n),o=ll.lastIndex,s=a[1],c=\"]\"===a[2],l=a[3];if(c&&(s|=0),void 0===l||\"[\"===l&&o+2===i){hl(r,void 0===l?new ol(s,e,t):new sl(s,e,t));break}var h=r.map[s];void 0===h&&hl(r,h=new cl(s)),r=h}}function pl(e,t){this.seq=[],this.map={};for(var r=e.getProgramParameter(t,35718),n=0;n<r;++n){var i=e.getActiveUniform(t,n);ul(i,e.getUniformLocation(t,i.name),this)}}function dl(e,t,r){var n=e.createShader(t);return e.shaderSource(n,r),e.compileShader(n),n}pl.prototype.setValue=function(e,t,r,n){var i=this.map[t];void 0!==i&&i.setValue(e,r,n)},pl.prototype.setOptional=function(e,t,r){var n=t[r];void 0!==n&&this.setValue(e,r,n)},pl.upload=function(e,t,r,n){for(var i=0,a=t.length;i!==a;++i){var o=t[i],s=r[o.id];!1!==s.needsUpdate&&o.setValue(e,s.value,n)}},pl.seqWithValue=function(e,t){for(var r=[],n=0,i=e.length;n!==i;++n){var a=e[n];a.id in t&&r.push(a)}return r};var fl=0;function ml(e){for(var t=e.split(\"n\"),r=0;r<t.length;r++)t[r]=r+1+\": \"+t[r];return t.join(\"n\")}function vl(e){switch(e){case Yt:return[\"Linear\",\"( value )\"];case Zt:return[\"sRGB\",\"( value )\"];case Qt:return[\"RGBE\",\"( value )\"];case $t:return[\"RGBM\",\"( value, 7.0 )\"];case er:return[\"RGBM\",\"( value, 16.0 )\"];case tr:return[\"RGBD\",\"( value, 256.0 )\"];case Jt:return[\"Gamma\",\"( value, float( GAMMA_FACTOR ) )\"];case Kt:return[\"LogLuv\",\"( value )\"];default:throw new Error(\"unsupported encoding: \"+e)}}function gl(e,t,r){var n=e.getShaderParameter(t,35713),i=e.getShaderInfoLog(t).trim();return n&&\"\"===i?\"\":\"THREE.WebGLShader: gl.getShaderInfoLog() \"+r+\"n\"+i+ml(e.getShaderSource(t))}function yl(e,t){var r=vl(t);return\"vec4 \"+e+\"( vec4 value ) { return \"+r[0]+\"ToLinear\"+r[1]+\"; }\"}function xl(e,t){var r=vl(t);return\"vec4 \"+e+\"( vec4 value ) { return LinearTo\"+r[0]+r[1]+\"; }\"}function _l(e,t){var r;switch(t){case K:r=\"Linear\";break;case $:r=\"Reinhard\";break;case ee:r=\"Uncharted2\";break;case te:r=\"OptimizedCineon\";break;case re:r=\"ACESFilmic\";break;default:throw new Error(\"unsupported toneMapping: \"+t)}return\"vec3 \"+e+\"( vec3 color ) { return \"+r+\"ToneMapping( color ); }\"}function bl(e){return[e.extensionDerivatives||e.envMapCubeUV||e.bumpMap||e.tangentSpaceNormalMap||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.rendererExtensionShaderTextureLod?\"#extension GL_EXT_shader_texture_lod : enable\":\"\"].filter(Sl).join(\"n\")}function wl(e){var t=[];for(var r in e){var n=e[r];!1!==n&&t.push(\"#define \"+r+\" \"+n)}return t.join(\"n\")}function Ml(e,t){for(var r={},n=e.getProgramParameter(t,35721),i=0;i<n;i++){var a=e.getActiveAttrib(t,i).name;r[a]=e.getAttribLocation(t,a)}return r}function Sl(e){return\"\"!==e}function Tl(e,t){return e.replace(\/NUM_DIR_LIGHTS\/g,t.numDirLights).replace(\/NUM_SPOT_LIGHTS\/g,t.numSpotLights).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\/g,t.numSpotLightShadows).replace(\/NUM_POINT_LIGHT_SHADOWS\/g,t.numPointLightShadows)}function El(e,t){return e.replace(\/NUM_CLIPPING_PLANES\/g,t.numClippingPlanes).replace(\/UNION_CLIPPING_PLANES\/g,t.numClippingPlanes-t.numClipIntersection)}var Al=\/^[ t]*#include +<([wd.\/]+)>\/gm;function Ll(e){return e.replace(Al,Rl)}function Rl(e,t){var r=ec[t];if(void 0===r)throw new Error(\"Can not resolve #include <\"+t+\">\");return Ll(r)}var Cl=\/#pragma unroll_loop[s]+?for ( int i = (d+); i < (d+); i ++ ) {([sS]+?)(?=})}\/g,Pl=\/#pragma unroll_loop_start[s]+?for ( int i = (d+); i < (d+); i ++ ) {([sS]+?)(?=})}[s]+?#pragma unroll_loop_end\/g;function Ol(e){return e.replace(Pl,Il).replace(Cl,Dl)}function Dl(e,t,r,n){return console.warn(\"WebGLProgram: #pragma unroll_loop shader syntax is deprecated. Please use #pragma unroll_loop_start syntax instead.\"),Il(e,t,r,n)}function Il(e,t,r,n){for(var i=\"\",a=parseInt(t);a<parseInt(r);a++)i+=n.replace(\/[ i ]\/g,\"[ \"+a+\" ]\").replace(\/UNROLLED_LOOP_INDEX\/g,a);return i}function Nl(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 Bl(e){var t=\"SHADOWMAP_TYPE_BASIC\";return e.shadowMapType===h?t=\"SHADOWMAP_TYPE_PCF\":e.shadowMapType===u?t=\"SHADOWMAP_TYPE_PCF_SOFT\":e.shadowMapType===p&&(t=\"SHADOWMAP_TYPE_VSM\"),t}function Fl(e){var t=\"ENVMAP_TYPE_CUBE\";if(e.envMap)switch(e.envMapMode){case ie:case ae:t=\"ENVMAP_TYPE_CUBE\";break;case le:case he:t=\"ENVMAP_TYPE_CUBE_UV\";break;case oe:case se:t=\"ENVMAP_TYPE_EQUIREC\";break;case ce:t=\"ENVMAP_TYPE_SPHERE\"}return t}function Ul(e){var t=\"ENVMAP_MODE_REFLECTION\";if(e.envMap)switch(e.envMapMode){case ae:case se:t=\"ENVMAP_MODE_REFRACTION\"}return t}function Gl(e){var t=\"ENVMAP_BLENDING_NONE\";if(e.envMap)switch(e.combine){case Y:t=\"ENVMAP_BLENDING_MULTIPLY\";break;case Z:t=\"ENVMAP_BLENDING_MIX\";break;case J:t=\"ENVMAP_BLENDING_ADD\"}return t}function zl(e,t,r){var n,i,a=e.getContext(),o=r.defines,s=r.vertexShader,c=r.fragmentShader,l=Bl(r),h=Fl(r),u=Ul(r),p=Gl(r),d=e.gammaFactor>0?e.gammaFactor:1,f=r.isWebGL2?\"\":bl(r),m=wl(o),v=a.createProgram();if(r.isRawShaderMaterial?((n=[m].filter(Sl).join(\"n\")).length>0&&(n+=\"n\"),(i=[f,m].filter(Sl).join(\"n\")).length>0&&(i+=\"n\")):(n=[Nl(r),\"#define SHADER_NAME \"+r.shaderName,m,r.instancing?\"#define USE_INSTANCING\":\"\",r.supportsVertexTextures?\"#define VERTEX_TEXTURES\":\"\",\"#define GAMMA_FACTOR \"+d,\"#define MAX_BONES \"+r.maxBones,r.useFog&&r.fog?\"#define USE_FOG\":\"\",r.useFog&&r.fogExp2?\"#define FOG_EXP2\":\"\",r.map?\"#define USE_MAP\":\"\",r.envMap?\"#define USE_ENVMAP\":\"\",r.envMap?\"#define \"+u:\"\",r.lightMap?\"#define USE_LIGHTMAP\":\"\",r.aoMap?\"#define USE_AOMAP\":\"\",r.emissiveMap?\"#define USE_EMISSIVEMAP\":\"\",r.bumpMap?\"#define USE_BUMPMAP\":\"\",r.normalMap?\"#define USE_NORMALMAP\":\"\",r.normalMap&&r.objectSpaceNormalMap?\"#define OBJECTSPACE_NORMALMAP\":\"\",r.normalMap&&r.tangentSpaceNormalMap?\"#define TANGENTSPACE_NORMALMAP\":\"\",r.clearcoatMap?\"#define USE_CLEARCOATMAP\":\"\",r.clearcoatRoughnessMap?\"#define USE_CLEARCOAT_ROUGHNESSMAP\":\"\",r.clearcoatNormalMap?\"#define USE_CLEARCOAT_NORMALMAP\":\"\",r.displacementMap&&r.supportsVertexTextures?\"#define USE_DISPLACEMENTMAP\":\"\",r.specularMap?\"#define USE_SPECULARMAP\":\"\",r.roughnessMap?\"#define USE_ROUGHNESSMAP\":\"\",r.metalnessMap?\"#define USE_METALNESSMAP\":\"\",r.alphaMap?\"#define USE_ALPHAMAP\":\"\",r.vertexTangents?\"#define USE_TANGENT\":\"\",r.vertexColors?\"#define USE_COLOR\":\"\",r.vertexUvs?\"#define USE_UV\":\"\",r.uvsVertexOnly?\"#define UVS_VERTEX_ONLY\":\"\",r.flatShading?\"#define FLAT_SHADED\":\"\",r.skinning?\"#define USE_SKINNING\":\"\",r.useVertexTexture?\"#define BONE_TEXTURE\":\"\",r.morphTargets?\"#define USE_MORPHTARGETS\":\"\",r.morphNormals&&!1===r.flatShading?\"#define USE_MORPHNORMALS\":\"\",r.doubleSided?\"#define DOUBLE_SIDED\":\"\",r.flipSided?\"#define FLIP_SIDED\":\"\",r.shadowMapEnabled?\"#define USE_SHADOWMAP\":\"\",r.shadowMapEnabled?\"#define \"+l:\"\",r.sizeAttenuation?\"#define USE_SIZEATTENUATION\":\"\",r.logarithmicDepthBuffer?\"#define USE_LOGDEPTHBUF\":\"\",r.logarithmicDepthBuffer&&r.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\",\" attribute mat4 instanceMatrix;\",\"#endif\",\"attribute vec3 position;\",\"attribute vec3 normal;\",\"attribute vec2 uv;\",\"#ifdef USE_TANGENT\",\"tattribute vec4 tangent;\",\"#endif\",\"#ifdef USE_COLOR\",\"tattribute vec3 color;\",\"#endif\",\"#ifdef USE_MORPHTARGETS\",\"tattribute vec3 morphTarget0;\",\"tattribute vec3 morphTarget1;\",\"tattribute vec3 morphTarget2;\",\"tattribute vec3 morphTarget3;\",\"t#ifdef USE_MORPHNORMALS\",\"ttattribute vec3 morphNormal0;\",\"ttattribute vec3 morphNormal1;\",\"ttattribute vec3 morphNormal2;\",\"ttattribute vec3 morphNormal3;\",\"t#else\",\"ttattribute vec3 morphTarget4;\",\"ttattribute vec3 morphTarget5;\",\"ttattribute vec3 morphTarget6;\",\"ttattribute vec3 morphTarget7;\",\"t#endif\",\"#endif\",\"#ifdef USE_SKINNING\",\"tattribute vec4 skinIndex;\",\"tattribute vec4 skinWeight;\",\"#endif\",\"n\"].filter(Sl).join(\"n\"),i=[f,Nl(r),\"#define SHADER_NAME \"+r.shaderName,m,r.alphaTest?\"#define ALPHATEST \"+r.alphaTest+(r.alphaTest%1?\"\":\".0\"):\"\",\"#define GAMMA_FACTOR \"+d,r.useFog&&r.fog?\"#define USE_FOG\":\"\",r.useFog&&r.fogExp2?\"#define FOG_EXP2\":\"\",r.map?\"#define USE_MAP\":\"\",r.matcap?\"#define USE_MATCAP\":\"\",r.envMap?\"#define USE_ENVMAP\":\"\",r.envMap?\"#define \"+h:\"\",r.envMap?\"#define \"+u:\"\",r.envMap?\"#define \"+p:\"\",r.lightMap?\"#define USE_LIGHTMAP\":\"\",r.aoMap?\"#define USE_AOMAP\":\"\",r.emissiveMap?\"#define USE_EMISSIVEMAP\":\"\",r.bumpMap?\"#define USE_BUMPMAP\":\"\",r.normalMap?\"#define USE_NORMALMAP\":\"\",r.normalMap&&r.objectSpaceNormalMap?\"#define OBJECTSPACE_NORMALMAP\":\"\",r.normalMap&&r.tangentSpaceNormalMap?\"#define TANGENTSPACE_NORMALMAP\":\"\",r.clearcoatMap?\"#define USE_CLEARCOATMAP\":\"\",r.clearcoatRoughnessMap?\"#define USE_CLEARCOAT_ROUGHNESSMAP\":\"\",r.clearcoatNormalMap?\"#define USE_CLEARCOAT_NORMALMAP\":\"\",r.specularMap?\"#define USE_SPECULARMAP\":\"\",r.roughnessMap?\"#define USE_ROUGHNESSMAP\":\"\",r.metalnessMap?\"#define USE_METALNESSMAP\":\"\",r.alphaMap?\"#define USE_ALPHAMAP\":\"\",r.sheen?\"#define USE_SHEEN\":\"\",r.vertexTangents?\"#define USE_TANGENT\":\"\",r.vertexColors?\"#define USE_COLOR\":\"\",r.vertexUvs?\"#define USE_UV\":\"\",r.uvsVertexOnly?\"#define UVS_VERTEX_ONLY\":\"\",r.gradientMap?\"#define USE_GRADIENTMAP\":\"\",r.flatShading?\"#define FLAT_SHADED\":\"\",r.doubleSided?\"#define DOUBLE_SIDED\":\"\",r.flipSided?\"#define FLIP_SIDED\":\"\",r.shadowMapEnabled?\"#define USE_SHADOWMAP\":\"\",r.shadowMapEnabled?\"#define \"+l:\"\",r.premultipliedAlpha?\"#define PREMULTIPLIED_ALPHA\":\"\",r.physicallyCorrectLights?\"#define PHYSICALLY_CORRECT_LIGHTS\":\"\",r.logarithmicDepthBuffer?\"#define USE_LOGDEPTHBUF\":\"\",r.logarithmicDepthBuffer&&r.rendererExtensionFragDepth?\"#define USE_LOGDEPTHBUF_EXT\":\"\",(r.extensionShaderTextureLOD||r.envMap)&&r.rendererExtensionShaderTextureLod?\"#define TEXTURE_LOD_EXT\":\"\",\"uniform mat4 viewMatrix;\",\"uniform vec3 cameraPosition;\",\"uniform bool isOrthographic;\",r.toneMapping!==Q?\"#define TONE_MAPPING\":\"\",r.toneMapping!==Q?ec.tonemapping_pars_fragment:\"\",r.toneMapping!==Q?_l(\"toneMapping\",r.toneMapping):\"\",r.dithering?\"#define DITHERING\":\"\",r.outputEncoding||r.mapEncoding||r.matcapEncoding||r.envMapEncoding||r.emissiveMapEncoding||r.lightMapEncoding?ec.encodings_pars_fragment:\"\",r.mapEncoding?yl(\"mapTexelToLinear\",r.mapEncoding):\"\",r.matcapEncoding?yl(\"matcapTexelToLinear\",r.matcapEncoding):\"\",r.envMapEncoding?yl(\"envMapTexelToLinear\",r.envMapEncoding):\"\",r.emissiveMapEncoding?yl(\"emissiveMapTexelToLinear\",r.emissiveMapEncoding):\"\",r.lightMapEncoding?yl(\"lightMapTexelToLinear\",r.lightMapEncoding):\"\",r.outputEncoding?xl(\"linearToOutputTexel\",r.outputEncoding):\"\",r.depthPacking?\"#define DEPTH_PACKING \"+r.depthPacking:\"\",\"n\"].filter(Sl).join(\"n\")),s=El(s=Tl(s=Ll(s),r),r),c=El(c=Tl(c=Ll(c),r),r),s=Ol(s),c=Ol(c),r.isWebGL2&&!r.isRawShaderMaterial){var g=!1,y=\/^s*#versions+300s+ess*n\/;r.isShaderMaterial&&null!==s.match(y)&&null!==c.match(y)&&(g=!0,s=s.replace(y,\"\"),c=c.replace(y,\"\")),n=[\"#version 300 esn\",\"#define attribute in\",\"#define varying out\",\"#define texture2D texture\"].join(\"n\")+\"n\"+n,i=[\"#version 300 esn\",\"#define varying in\",g?\"\":\"out highp vec4 pc_fragColor;\",g?\"\":\"#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\"+i}var x,_,b=i+c,w=dl(a,35633,n+s),M=dl(a,35632,b);if(a.attachShader(v,w),a.attachShader(v,M),void 0!==r.index0AttributeName?a.bindAttribLocation(v,0,r.index0AttributeName):!0===r.morphTargets&&a.bindAttribLocation(v,0,\"position\"),a.linkProgram(v),e.debug.checkShaderErrors){var S=a.getProgramInfoLog(v).trim(),T=a.getShaderInfoLog(w).trim(),E=a.getShaderInfoLog(M).trim(),A=!0,L=!0;if(!1===a.getProgramParameter(v,35714)){A=!1;var R=gl(a,w,\"vertex\"),C=gl(a,M,\"fragment\");console.error(\"THREE.WebGLProgram: shader error: \",a.getError(),\"35715\",a.getProgramParameter(v,35715),\"gl.getProgramInfoLog\",S,R,C)}else\"\"!==S?console.warn(\"THREE.WebGLProgram: gl.getProgramInfoLog()\",S):\"\"!==T&&\"\"!==E||(L=!1);L&&(this.diagnostics={runnable:A,programLog:S,vertexShader:{log:T,prefix:n},fragmentShader:{log:E,prefix:i}})}return a.detachShader(v,w),a.detachShader(v,M),a.deleteShader(w),a.deleteShader(M),this.getUniforms=function(){return void 0===x&&(x=new pl(a,v)),x},this.getAttributes=function(){return void 0===_&&(_=Ml(a,v)),_},this.destroy=function(){a.deleteProgram(v),this.program=void 0},this.name=r.shaderName,this.id=fl++,this.cacheKey=t,this.usedTimes=1,this.program=v,this.vertexShader=w,this.fragmentShader=M,this}function Hl(e,t,r){var n=[],i=r.isWebGL2,a=r.logarithmicDepthBuffer,o=r.floatVertexTextures,s=r.precision,c=r.maxVertexUniforms,l=r.vertexTextures,h={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\"},u=[\"precision\",\"isWebGL2\",\"supportsVertexTextures\",\"outputEncoding\",\"instancing\",\"map\",\"mapEncoding\",\"matcap\",\"matcapEncoding\",\"envMap\",\"envMapMode\",\"envMapEncoding\",\"envMapCubeUV\",\"lightMap\",\"lightMapEncoding\",\"aoMap\",\"emissiveMap\",\"emissiveMapEncoding\",\"bumpMap\",\"normalMap\",\"objectSpaceNormalMap\",\"tangentSpaceNormalMap\",\"clearcoatMap\",\"clearcoatRoughnessMap\",\"clearcoatNormalMap\",\"displacementMap\",\"specularMap\",\"roughnessMap\",\"metalnessMap\",\"gradientMap\",\"alphaMap\",\"combine\",\"vertexColors\",\"vertexTangents\",\"vertexUvs\",\"uvsVertexOnly\",\"fog\",\"useFog\",\"fogExp2\",\"flatShading\",\"sizeAttenuation\",\"logarithmicDepthBuffer\",\"skinning\",\"maxBones\",\"useVertexTexture\",\"morphTargets\",\"morphNormals\",\"maxMorphTargets\",\"maxMorphNormals\",\"premultipliedAlpha\",\"numDirLights\",\"numPointLights\",\"numSpotLights\",\"numHemiLights\",\"numRectAreaLights\",\"numDirLightShadows\",\"numPointLightShadows\",\"numSpotLightShadows\",\"shadowMapEnabled\",\"shadowMapType\",\"toneMapping\",\"physicallyCorrectLights\",\"alphaTest\",\"doubleSided\",\"flipSided\",\"numClippingPlanes\",\"numClipIntersection\",\"depthPacking\",\"dithering\",\"sheen\"];function p(e){var t;return e?e.isTexture?t=e.encoding:e.isWebGLRenderTarget&&(console.warn(\"THREE.WebGLPrograms.getTextureEncodingFromMap: don't use render targets as textures. Use their .texture property instead.\"),t=e.texture.encoding):t=Yt,t}this.getParameters=function(n,u,d,v,g,y,x){var _=v.fog,b=n.isMeshStandardMaterial?v.environment:null,w=n.envMap||b,M=h[n.type],S=x.isSkinnedMesh?function(e){var t=e.skeleton.bones;if(o)return 1024;var r=c,n=Math.floor((r-20)\/4),i=Math.min(n,t.length);return i<t.length?(console.warn(\"THREE.WebGLRenderer: Skeleton has \"+t.length+\" bones. This GPU supports \"+i+\".\"),0):i}(x):0;null!==n.precision&&(s=r.getMaxPrecision(n.precision))!==n.precision&&console.warn(\"THREE.WebGLProgram.getParameters:\",n.precision,\"not supported, using\",s,\"instead.\");var T=function(e,t){var r;if(t){var n=tc[t];r={name:e.type,uniforms:ma.clone(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader}}else r={name:e.type,uniforms:e.uniforms,vertexShader:e.vertexShader,fragmentShader:e.fragmentShader};return r}(n,M);n.onBeforeCompile(T,e);var E=e.getRenderTarget();return{isWebGL2:i,shaderID:M,shaderName:T.name,uniforms:T.uniforms,vertexShader:T.vertexShader,fragmentShader:T.fragmentShader,defines:n.defines,isRawShaderMaterial:n.isRawShaderMaterial,isShaderMaterial:n.isShaderMaterial,precision:s,instancing:!0===x.isInstancedMesh,supportsVertexTextures:l,outputEncoding:null!==E?p(E.texture):e.outputEncoding,map:!!n.map,mapEncoding:p(n.map),matcap:!!n.matcap,matcapEncoding:p(n.matcap),envMap:!!w,envMapMode:w&&w.mapping,envMapEncoding:p(w),envMapCubeUV:!!w&&(w.mapping===le||w.mapping===he),lightMap:!!n.lightMap,lightMapEncoding:p(n.lightMap),aoMap:!!n.aoMap,emissiveMap:!!n.emissiveMap,emissiveMapEncoding:p(n.emissiveMap),bumpMap:!!n.bumpMap,normalMap:!!n.normalMap,objectSpaceNormalMap:n.normalMapType===ar,tangentSpaceNormalMap:n.normalMapType===ir,clearcoatMap:!!n.clearcoatMap,clearcoatRoughnessMap:!!n.clearcoatRoughnessMap,clearcoatNormalMap:!!n.clearcoatNormalMap,displacementMap:!!n.displacementMap,roughnessMap:!!n.roughnessMap,metalnessMap:!!n.metalnessMap,specularMap:!!n.specularMap,alphaMap:!!n.alphaMap,gradientMap:!!n.gradientMap,sheen:!!n.sheen,combine:n.combine,vertexTangents:n.normalMap&&n.vertexTangents,vertexColors:n.vertexColors,vertexUvs:!!(n.map||n.bumpMap||n.normalMap||n.specularMap||n.alphaMap||n.emissiveMap||n.roughnessMap||n.metalnessMap||n.clearcoatMap||n.clearcoatRoughnessMap||n.clearcoatNormalMap||n.displacementMap),uvsVertexOnly:!(n.map||n.bumpMap||n.normalMap||n.specularMap||n.alphaMap||n.emissiveMap||n.roughnessMap||n.metalnessMap||n.clearcoatNormalMap||!n.displacementMap),fog:!!_,useFog:n.fog,fogExp2:_&&_.isFogExp2,flatShading:n.flatShading,sizeAttenuation:n.sizeAttenuation,logarithmicDepthBuffer:a,skinning:n.skinning&&S>0,maxBones:S,useVertexTexture:o,morphTargets:n.morphTargets,morphNormals:n.morphNormals,maxMorphTargets:e.maxMorphTargets,maxMorphNormals:e.maxMorphNormals,numDirLights:u.directional.length,numPointLights:u.point.length,numSpotLights:u.spot.length,numRectAreaLights:u.rectArea.length,numHemiLights:u.hemi.length,numDirLightShadows:u.directionalShadowMap.length,numPointLightShadows:u.pointShadowMap.length,numSpotLightShadows:u.spotShadowMap.length,numClippingPlanes:g,numClipIntersection:y,dithering:n.dithering,shadowMapEnabled:e.shadowMap.enabled&&d.length>0,shadowMapType:e.shadowMap.type,toneMapping:n.toneMapped?e.toneMapping:Q,physicallyCorrectLights:e.physicallyCorrectLights,premultipliedAlpha:n.premultipliedAlpha,alphaTest:n.alphaTest,doubleSided:n.side===m,flipSided:n.side===f,depthPacking:void 0!==n.depthPacking&&n.depthPacking,index0AttributeName:n.index0AttributeName,extensionDerivatives:n.extensions&&n.extensions.derivatives,extensionFragDepth:n.extensions&&n.extensions.fragDepth,extensionDrawBuffers:n.extensions&&n.extensions.drawBuffers,extensionShaderTextureLOD:n.extensions&&n.extensions.shaderTextureLOD,rendererExtensionFragDepth:i||null!==t.get(\"EXT_frag_depth\"),rendererExtensionDrawBuffers:i||null!==t.get(\"WEBGL_draw_buffers\"),rendererExtensionShaderTextureLod:i||null!==t.get(\"EXT_shader_texture_lod\"),onBeforeCompile:n.onBeforeCompile}},this.getProgramCacheKey=function(t){var r=[];if(t.shaderID?r.push(t.shaderID):(r.push(t.fragmentShader),r.push(t.vertexShader)),void 0!==t.defines)for(var n in t.defines)r.push(n),r.push(t.defines[n]);if(void 0===t.isRawShaderMaterial){for(var i=0;i<u.length;i++)r.push(t[u[i]]);r.push(e.outputEncoding),r.push(e.gammaFactor)}return r.push(t.onBeforeCompile.toString()),r.join()},this.acquireProgram=function(t,r){for(var i,a=0,o=n.length;a<o;a++){var s=n[a];if(s.cacheKey===r){++(i=s).usedTimes;break}}return void 0===i&&(i=new zl(e,r,t),n.push(i)),i},this.releaseProgram=function(e){if(0==--e.usedTimes){var t=n.indexOf(e);n[t]=n[n.length-1],n.pop(),e.destroy()}},this.programs=n}function Vl(){var e=new WeakMap;return{get:function(t){var r=e.get(t);return void 0===r&&(r={},e.set(t,r)),r},remove:function(t){e.delete(t)},update:function(t,r,n){e.get(t)[r]=n},dispose:function(){e=new WeakMap}}}function kl(e,t){return e.groupOrder!==t.groupOrder?e.groupOrder-t.groupOrder:e.renderOrder!==t.renderOrder?e.renderOrder-t.renderOrder:e.program!==t.program?e.program.id-t.program.id: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 jl(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 Wl(){var e=[],t=0,r=[],n=[],i={id:-1};function a(r,n,a,o,s,c){var l=e[t];return void 0===l?(l={id:r.id,object:r,geometry:n,material:a,program:a.program||i,groupOrder:o,renderOrder:r.renderOrder,z:s,group:c},e[t]=l):(l.id=r.id,l.object=r,l.geometry=n,l.material=a,l.program=a.program||i,l.groupOrder=o,l.renderOrder=r.renderOrder,l.z=s,l.group=c),t++,l}return{opaque:r,transparent:n,init:function(){t=0,r.length=0,n.length=0},push:function(e,t,i,o,s,c){var l=a(e,t,i,o,s,c);(!0===i.transparent?n:r).push(l)},unshift:function(e,t,i,o,s,c){var l=a(e,t,i,o,s,c);(!0===i.transparent?n:r).unshift(l)},finish:function(){for(var r=t,n=e.length;r<n;r++){var i=e[r];if(null===i.id)break;i.id=null,i.object=null,i.geometry=null,i.material=null,i.program=null,i.group=null}},sort:function(e,t){r.length>1&&r.sort(e||kl),n.length>1&&n.sort(t||jl)}}}function ql(){var e=new WeakMap;function t(r){var n=r.target;n.removeEventListener(\"dispose\",t),e.delete(n)}return{get:function(r,n){var i,a=e.get(r);return void 0===a?(i=new Wl,e.set(r,new WeakMap),e.get(r).set(n,i),r.addEventListener(\"dispose\",t)):void 0===(i=a.get(n))&&(i=new Wl,a.set(n,i)),i},dispose:function(){e=new WeakMap}}}function Xl(){var e={};return{get:function(t){if(void 0!==e[t.id])return e[t.id];var r;switch(t.type){case\"DirectionalLight\":r={direction:new Xr,color:new ui};break;case\"SpotLight\":r={position:new Xr,direction:new Xr,color:new ui,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case\"PointLight\":r={position:new Xr,color:new ui,distance:0,decay:0};break;case\"HemisphereLight\":r={direction:new Xr,skyColor:new ui,groundColor:new ui};break;case\"RectAreaLight\":r={color:new ui,position:new Xr,halfWidth:new Xr,halfHeight:new Xr}}return e[t.id]=r,r}}}function Yl(){var e={};return{get:function(t){if(void 0!==e[t.id])return e[t.id];var r;switch(t.type){case\"DirectionalLight\":case\"SpotLight\":r={shadowBias:0,shadowRadius:1,shadowMapSize:new Br};break;case\"PointLight\":r={shadowBias:0,shadowRadius:1,shadowMapSize:new Br,shadowCameraNear:1,shadowCameraFar:1e3}}return e[t.id]=r,r}}}var Zl=0;function Jl(e,t){return(t.castShadow?1:0)-(e.castShadow?1:0)}function Ql(){for(var e=new Xl,t=Yl(),r={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotShadow:[],spotShadowMap:[],spotShadowMatrix:[],rectArea:[],point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[]},n=0;n<9;n++)r.probe.push(new Xr);var i=new Xr,a=new tn,o=new tn;return{setup:function(n,s,c){for(var l=0,h=0,u=0,p=0;p<9;p++)r.probe[p].set(0,0,0);var d=0,f=0,m=0,v=0,g=0,y=0,x=0,_=0,b=c.matrixWorldInverse;n.sort(Jl),p=0;for(var w=n.length;p<w;p++){var M=n[p],S=M.color,T=M.intensity,E=M.distance,A=M.shadow&&M.shadow.map?M.shadow.map.texture:null;if(M.isAmbientLight)l+=S.r*T,h+=S.g*T,u+=S.b*T;else if(M.isLightProbe)for(var L=0;L<9;L++)r.probe[L].addScaledVector(M.sh.coefficients[L],T);else if(M.isDirectionalLight){if((P=e.get(M)).color.copy(M.color).multiplyScalar(M.intensity),P.direction.setFromMatrixPosition(M.matrixWorld),i.setFromMatrixPosition(M.target.matrixWorld),P.direction.sub(i),P.direction.transformDirection(b),M.castShadow){var R=M.shadow;(C=t.get(M)).shadowBias=R.bias,C.shadowRadius=R.radius,C.shadowMapSize=R.mapSize,r.directionalShadow[d]=C,r.directionalShadowMap[d]=A,r.directionalShadowMatrix[d]=M.shadow.matrix,y++}r.directional[d]=P,d++}else if(M.isSpotLight)(P=e.get(M)).position.setFromMatrixPosition(M.matrixWorld),P.position.applyMatrix4(b),P.color.copy(S).multiplyScalar(T),P.distance=E,P.direction.setFromMatrixPosition(M.matrixWorld),i.setFromMatrixPosition(M.target.matrixWorld),P.direction.sub(i),P.direction.transformDirection(b),P.coneCos=Math.cos(M.angle),P.penumbraCos=Math.cos(M.angle*(1-M.penumbra)),P.decay=M.decay,M.castShadow&&(R=M.shadow,(C=t.get(M)).shadowBias=R.bias,C.shadowRadius=R.radius,C.shadowMapSize=R.mapSize,r.spotShadow[m]=C,r.spotShadowMap[m]=A,r.spotShadowMatrix[m]=M.shadow.matrix,_++),r.spot[m]=P,m++;else if(M.isRectAreaLight)(P=e.get(M)).color.copy(S).multiplyScalar(T),P.position.setFromMatrixPosition(M.matrixWorld),P.position.applyMatrix4(b),o.identity(),a.copy(M.matrixWorld),a.premultiply(b),o.extractRotation(a),P.halfWidth.set(.5*M.width,0,0),P.halfHeight.set(0,.5*M.height,0),P.halfWidth.applyMatrix4(o),P.halfHeight.applyMatrix4(o),r.rectArea[v]=P,v++;else if(M.isPointLight){var C;if((P=e.get(M)).position.setFromMatrixPosition(M.matrixWorld),P.position.applyMatrix4(b),P.color.copy(M.color).multiplyScalar(M.intensity),P.distance=M.distance,P.decay=M.decay,M.castShadow)R=M.shadow,(C=t.get(M)).shadowBias=R.bias,C.shadowRadius=R.radius,C.shadowMapSize=R.mapSize,C.shadowCameraNear=R.camera.near,C.shadowCameraFar=R.camera.far,r.pointShadow[f]=C,r.pointShadowMap[f]=A,r.pointShadowMatrix[f]=M.shadow.matrix,x++;r.point[f]=P,f++}else if(M.isHemisphereLight){var P;(P=e.get(M)).direction.setFromMatrixPosition(M.matrixWorld),P.direction.transformDirection(b),P.direction.normalize(),P.skyColor.copy(M.color).multiplyScalar(T),P.groundColor.copy(M.groundColor).multiplyScalar(T),r.hemi[g]=P,g++}}r.ambient[0]=l,r.ambient[1]=h,r.ambient[2]=u;var O=r.hash;O.directionalLength===d&&O.pointLength===f&&O.spotLength===m&&O.rectAreaLength===v&&O.hemiLength===g&&O.numDirectionalShadows===y&&O.numPointShadows===x&&O.numSpotShadows===_||(r.directional.length=d,r.spot.length=m,r.rectArea.length=v,r.point.length=f,r.hemi.length=g,r.directionalShadow.length=y,r.directionalShadowMap.length=y,r.pointShadow.length=x,r.pointShadowMap.length=x,r.spotShadow.length=_,r.spotShadowMap.length=_,r.directionalShadowMatrix.length=y,r.pointShadowMatrix.length=x,r.spotShadowMatrix.length=_,O.directionalLength=d,O.pointLength=f,O.spotLength=m,O.rectAreaLength=v,O.hemiLength=g,O.numDirectionalShadows=y,O.numPointShadows=x,O.numSpotShadows=_,r.version=Zl++)},state:r}}function Kl(){var e=new Ql,t=[],r=[];return{init:function(){t.length=0,r.length=0},state:{lightsArray:t,shadowsArray:r,lights:e},setupLights:function(n){e.setup(t,r,n)},pushLight:function(e){t.push(e)},pushShadow:function(e){r.push(e)}}}function $l(){var e=new WeakMap;function t(r){var n=r.target;n.removeEventListener(\"dispose\",t),e.delete(n)}return{get:function(r,n){var i;return!1===e.has(r)?(i=new Kl,e.set(r,new WeakMap),e.get(r).set(n,i),r.addEventListener(\"dispose\",t)):!1===e.get(r).has(n)?(i=new Kl,e.get(r).set(n,i)):i=e.get(r).get(n),i},dispose:function(){e=new WeakMap}}}function eh(e){gi.call(this),this.type=\"MeshDepthMaterial\",this.depthPacking=rr,this.skinning=!1,this.morphTargets=!1,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.setValues(e)}function th(e){gi.call(this),this.type=\"MeshDistanceMaterial\",this.referencePosition=new Xr,this.nearDistance=1,this.farDistance=1e3,this.skinning=!1,this.morphTargets=!1,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.fog=!1,this.setValues(e)}eh.prototype=Object.create(gi.prototype),eh.prototype.constructor=eh,eh.prototype.isMeshDepthMaterial=!0,eh.prototype.copy=function(e){return gi.prototype.copy.call(this,e),this.depthPacking=e.depthPacking,this.skinning=e.skinning,this.morphTargets=e.morphTargets,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},th.prototype=Object.create(gi.prototype),th.prototype.constructor=th,th.prototype.isMeshDistanceMaterial=!0,th.prototype.copy=function(e){return gi.prototype.copy.call(this,e),this.referencePosition.copy(e.referencePosition),this.nearDistance=e.nearDistance,this.farDistance=e.farDistance,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this};var rh=\"uniform sampler2D shadow_pass;nuniform vec2 resolution;nuniform float radius;n#include <packing>nvoid main() {n  float mean = 0.0;n  float squared_mean = 0.0;ntfloat depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy  ) \/ resolution ) );n  for ( float i = -1.0; i < 1.0 ; i += SAMPLE_RATE) {n    #ifdef HORIZONAL_PASSn      vec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( i, 0.0 ) * radius ) \/ resolution ) );n      mean += distribution.x;n      squared_mean += distribution.y * distribution.y + distribution.x * distribution.x;n    #elsen      float depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0,  i )  * radius ) \/ resolution ) );n      mean += depth;n      squared_mean += depth * depth;n    #endifn  }n  mean = mean * HALF_SAMPLE_RATE;n  squared_mean = squared_mean * HALF_SAMPLE_RATE;n  float std_dev = sqrt( squared_mean - mean * mean );n  gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );n}\",nh=\"void main() {ntgl_Position = vec4( position, 1.0 );n}\";function ih(e,t,r){var n=new La,i=new Br,a=new Br,o=new Hr,s=[],c=[],l={},u={0:f,1:d,2:m},v=new ya({defines:{SAMPLE_RATE:.25,HALF_SAMPLE_RATE:1\/8},uniforms:{shadow_pass:{value:null},resolution:{value:new Br},radius:{value:4}},vertexShader:nh,fragmentShader:rh}),g=v.clone();g.defines.HORIZONAL_PASS=1;var x=new Gi;x.setAttribute(\"position\",new _i(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));var _=new na(x,v),b=this;function w(r,n){var i=t.update(_);v.uniforms.shadow_pass.value=r.map.texture,v.uniforms.resolution.value=r.mapSize,v.uniforms.radius.value=r.radius,e.setRenderTarget(r.mapPass),e.clear(),e.renderBufferDirect(n,null,i,v,_,null),g.uniforms.shadow_pass.value=r.mapPass.texture,g.uniforms.resolution.value=r.mapSize,g.uniforms.radius.value=r.radius,e.setRenderTarget(r.map),e.clear(),e.renderBufferDirect(n,null,i,g,_,null)}function M(e,t,r){var n=e<<0|t<<1|r<<2,i=s[n];return void 0===i&&(i=new eh({depthPacking:nr,morphTargets:e,skinning:t}),s[n]=i),i}function S(e,t,r){var n=e<<0|t<<1|r<<2,i=c[n];return void 0===i&&(i=new th({morphTargets:e,skinning:t}),c[n]=i),i}function T(t,r,n,i,a,o){var s=t.geometry,c=null,h=M,d=t.customDepthMaterial;if(!0===n.isPointLight&&(h=S,d=t.customDistanceMaterial),void 0===d){var f=!1;!0===r.morphTargets&&(!0===s.isBufferGeometry?f=s.morphAttributes&&s.morphAttributes.position&&s.morphAttributes.position.length>0:!0===s.isGeometry&&(f=s.morphTargets&&s.morphTargets.length>0));var m=!1;!0===t.isSkinnedMesh&&(!0===r.skinning?m=!0:console.warn(\"THREE.WebGLShadowMap: THREE.SkinnedMesh with material.skinning set to false:\",t)),c=h(f,m,!0===t.isInstancedMesh)}else c=d;if(e.localClippingEnabled&&!0===r.clipShadows&&0!==r.clippingPlanes.length){var v=c.uuid,g=r.uuid,y=l[v];void 0===y&&(y={},l[v]=y);var x=y[g];void 0===x&&(x=c.clone(),y[g]=x),c=x}return c.visible=r.visible,c.wireframe=r.wireframe,c.side=o===p?null!==r.shadowSide?r.shadowSide:r.side:null!==r.shadowSide?r.shadowSide:u[r.side],c.clipShadows=r.clipShadows,c.clippingPlanes=r.clippingPlanes,c.clipIntersection=r.clipIntersection,c.wireframeLinewidth=r.wireframeLinewidth,c.linewidth=r.linewidth,!0===n.isPointLight&&!0===c.isMeshDistanceMaterial&&(c.referencePosition.setFromMatrixPosition(n.matrixWorld),c.nearDistance=i,c.farDistance=a),c}function E(r,i,a,o,s){if(!1!==r.visible){if(r.layers.test(i.layers)&&(r.isMesh||r.isLine||r.isPoints)&&(r.castShadow||r.receiveShadow&&s===p)&&(!r.frustumCulled||n.intersectsObject(r))){r.modelViewMatrix.multiplyMatrices(a.matrixWorldInverse,r.matrixWorld);var c=t.update(r),l=r.material;if(Array.isArray(l))for(var h=c.groups,u=0,d=h.length;u<d;u++){var f=h[u],m=l[f.materialIndex];if(m&&m.visible){var v=T(r,m,o,a.near,a.far,s);e.renderBufferDirect(a,null,c,v,r,f)}}else if(l.visible){v=T(r,l,o,a.near,a.far,s);e.renderBufferDirect(a,null,c,v,r,null)}}for(var g=r.children,y=0,x=g.length;y<x;y++)E(g[y],i,a,o,s)}}this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=h,this.render=function(t,s,c){if(!1!==b.enabled&&(!1!==b.autoUpdate||!1!==b.needsUpdate)&&0!==t.length){var l=e.getRenderTarget(),h=e.getActiveCubeFace(),u=e.getActiveMipmapLevel(),d=e.state;d.setBlending(y),d.buffers.color.setClear(1,1,1,1),d.buffers.depth.setTest(!0),d.setScissorTest(!1);for(var f=0,m=t.length;f<m;f++){var v=t[f],g=v.shadow;if(void 0!==g){i.copy(g.mapSize);var x=g.getFrameExtents();if(i.multiply(x),a.copy(g.mapSize),(i.x>r||i.y>r)&&(console.warn(\"THREE.WebGLShadowMap:\",v,\"has shadow exceeding max texture size, reducing\"),i.x>r&&(a.x=Math.floor(r\/x.x),i.x=a.x*x.x,g.mapSize.x=a.x),i.y>r&&(a.y=Math.floor(r\/x.y),i.y=a.y*x.y,g.mapSize.y=a.y)),null===g.map&&!g.isPointLightShadow&&this.type===p){var _={minFilter:xe,magFilter:xe,format:Ue};g.map=new Vr(i.x,i.y,_),g.map.texture.name=v.name+\".shadowMap\",g.mapPass=new Vr(i.x,i.y,_),g.camera.updateProjectionMatrix()}if(null===g.map){_={minFilter:fe,magFilter:fe,format:Ue};g.map=new Vr(i.x,i.y,_),g.map.texture.name=v.name+\".shadowMap\",g.camera.updateProjectionMatrix()}e.setRenderTarget(g.map),e.clear();for(var M=g.getViewportCount(),S=0;S<M;S++){var T=g.getViewport(S);o.set(a.x*T.x,a.y*T.y,a.x*T.z,a.y*T.w),d.viewport(o),g.updateMatrices(v,S),n=g.getFrustum(),E(s,c,g.camera,v,this.type)}g.isPointLightShadow||this.type!==p||w(g,c)}else console.warn(\"THREE.WebGLShadowMap:\",v,\"has no shadow.\")}b.needsUpdate=!1,e.setRenderTarget(l,h,u)}}}function ah(e,t,r){var o=r.isWebGL2;var s=new function(){var t=!1,r=new Hr,n=null,i=new Hr(0,0,0,0);return{setMask:function(r){n===r||t||(e.colorMask(r,r,r,r),n=r)},setLocked:function(e){t=e},setClear:function(t,n,a,o,s){!0===s&&(t*=o,n*=o,a*=o),r.set(t,n,a,o),!1===i.equals(r)&&(e.clearColor(t,n,a,o),i.copy(r))},reset:function(){t=!1,n=null,i.set(-1,0,0,0)}}},c=new function(){var t=!1,r=null,n=null,i=null;return{setTest:function(e){e?xe(2929):_e(2929)},setMask:function(n){r===n||t||(e.depthMask(n),r=n)},setFunc:function(t){if(n!==t){if(t)switch(t){case z:e.depthFunc(512);break;case H:e.depthFunc(519);break;case V:e.depthFunc(513);break;case k:e.depthFunc(515);break;case j:e.depthFunc(514);break;case W:e.depthFunc(518);break;case q:e.depthFunc(516);break;case X:e.depthFunc(517);break;default:e.depthFunc(515)}else e.depthFunc(515);n=t}},setLocked:function(e){t=e},setClear:function(t){i!==t&&(e.clearDepth(t),i=t)},reset:function(){t=!1,r=null,n=null,i=null}}},l=new function(){var t=!1,r=null,n=null,i=null,a=null,o=null,s=null,c=null,l=null;return{setTest:function(e){t||(e?xe(2960):_e(2960))},setMask:function(n){r===n||t||(e.stencilMask(n),r=n)},setFunc:function(t,r,o){n===t&&i===r&&a===o||(e.stencilFunc(t,r,o),n=t,i=r,a=o)},setOp:function(t,r,n){o===t&&s===r&&c===n||(e.stencilOp(t,r,n),o=t,s=r,c=n)},setLocked:function(e){t=e},setClear:function(t){l!==t&&(e.clearStencil(t),l=t)},reset:function(){t=!1,r=null,n=null,i=null,a=null,o=null,s=null,c=null,l=null}}},h=e.getParameter(34921),u=new Uint8Array(h),p=new Uint8Array(h),d=new Uint8Array(h),v={},g=null,Y=null,Z=null,J=null,Q=null,K=null,$=null,ee=null,te=null,re=!1,ne=null,ie=null,ae=null,oe=null,se=null,ce=e.getParameter(35661),le=!1,he=0,ue=e.getParameter(7938);-1!==ue.indexOf(\"WebGL\")?(he=parseFloat(\/^WebGL ([0-9])\/.exec(ue)[1]),le=he>=1):-1!==ue.indexOf(\"OpenGL ES\")&&(he=parseFloat(\/^OpenGL ES ([0-9])\/.exec(ue)[1]),le=he>=2);var pe=null,de={},fe=new Hr,me=new Hr;function ve(t,r,n){var i=new Uint8Array(4),a=e.createTexture();e.bindTexture(t,a),e.texParameteri(t,10241,9728),e.texParameteri(t,10240,9728);for(var o=0;o<n;o++)e.texImage2D(r+o,0,6408,1,1,0,6408,5121,i);return a}var ge={};function ye(r,n){(u[r]=1,0===p[r]&&(e.enableVertexAttribArray(r),p[r]=1),d[r]!==n)&&((o?e:t.get(\"ANGLE_instanced_arrays\"))[o?\"vertexAttribDivisor\":\"vertexAttribDivisorANGLE\"](r,n),d[r]=n)}function xe(t){!0!==v[t]&&(e.enable(t),v[t]=!0)}function _e(t){!1!==v[t]&&(e.disable(t),v[t]=!1)}ge[3553]=ve(3553,3553,1),ge[34067]=ve(34067,34069,6),s.setClear(0,0,0,1),c.setClear(1),l.setClear(0),xe(2929),c.setFunc(k),Te(!1),Ee(i),xe(2884),Se(y);var be={[S]:32774,[T]:32778,[E]:32779};if(o)be[A]=32775,be[L]=32776;else{var we=t.get(\"EXT_blend_minmax\");null!==we&&(be[A]=we.MIN_EXT,be[L]=we.MAX_EXT)}var Me={[R]:0,[C]:1,[P]:768,[D]:770,[G]:776,[F]:774,[N]:772,[O]:769,[I]:771,[U]:775,[B]:773};function Se(t,r,n,i,a,o,s,c){if(t!==y){if(Y||(xe(3042),Y=!0),t===M)a=a||r,o=o||n,s=s||i,r===J&&a===$||(e.blendEquationSeparate(be[r],be[a]),J=r,$=a),n===Q&&i===K&&o===ee&&s===te||(e.blendFuncSeparate(Me[n],Me[i],Me[o],Me[s]),Q=n,K=i,ee=o,te=s),Z=t,re=null;else if(t!==Z||c!==re){if(J===S&&$===S||(e.blendEquation(32774),J=S,$=S),c)switch(t){case x:e.blendFuncSeparate(1,771,1,771);break;case _:e.blendFunc(1,1);break;case b:e.blendFuncSeparate(0,0,769,771);break;case w:e.blendFuncSeparate(0,768,0,770);break;default:console.error(\"THREE.WebGLState: Invalid blending: \",t)}else switch(t){case x:e.blendFuncSeparate(770,771,1,771);break;case _:e.blendFunc(770,1);break;case b:e.blendFunc(0,769);break;case w:e.blendFunc(0,768);break;default:console.error(\"THREE.WebGLState: Invalid blending: \",t)}Q=null,K=null,ee=null,te=null,Z=t,re=c}}else Y&&(_e(3042),Y=!1)}function Te(t){ne!==t&&(t?e.frontFace(2304):e.frontFace(2305),ne=t)}function Ee(t){t!==n?(xe(2884),t!==ie&&(t===i?e.cullFace(1029):t===a?e.cullFace(1028):e.cullFace(1032))):_e(2884),ie=t}function Ae(t,r,n){t?(xe(32823),oe===r&&se===n||(e.polygonOffset(r,n),oe=r,se=n)):_e(32823)}function Le(t){void 0===t&&(t=33984+ce-1),pe!==t&&(e.activeTexture(t),pe=t)}return{buffers:{color:s,depth:c,stencil:l},initAttributes:function(){for(var e=0,t=u.length;e<t;e++)u[e]=0},enableAttribute:function(e){ye(e,0)},enableAttributeAndDivisor:ye,disableUnusedAttributes:function(){for(var t=0,r=p.length;t!==r;++t)p[t]!==u[t]&&(e.disableVertexAttribArray(t),p[t]=0)},enable:xe,disable:_e,useProgram:function(t){return g!==t&&(e.useProgram(t),g=t,!0)},setBlending:Se,setMaterial:function(e,t){e.side===m?_e(2884):xe(2884);var r=e.side===f;t&&(r=!r),Te(r),e.blending===x&&!1===e.transparent?Se(y):Se(e.blending,e.blendEquation,e.blendSrc,e.blendDst,e.blendEquationAlpha,e.blendSrcAlpha,e.blendDstAlpha,e.premultipliedAlpha),c.setFunc(e.depthFunc),c.setTest(e.depthTest),c.setMask(e.depthWrite),s.setMask(e.colorWrite);var n=e.stencilWrite;l.setTest(n),n&&(l.setMask(e.stencilWriteMask),l.setFunc(e.stencilFunc,e.stencilRef,e.stencilFuncMask),l.setOp(e.stencilFail,e.stencilZFail,e.stencilZPass)),Ae(e.polygonOffset,e.polygonOffsetFactor,e.polygonOffsetUnits)},setFlipSided:Te,setCullFace:Ee,setLineWidth:function(t){t!==ae&&(le&&e.lineWidth(t),ae=t)},setPolygonOffset:Ae,setScissorTest:function(e){e?xe(3089):_e(3089)},activeTexture:Le,bindTexture:function(t,r){null===pe&&Le();var n=de[pe];void 0===n&&(n={type:void 0,texture:void 0},de[pe]=n),n.type===t&&n.texture===r||(e.bindTexture(t,r||ge[t]),n.type=t,n.texture=r)},unbindTexture:function(){var t=de[pe];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(t){console.error(\"THREE.WebGLState:\",t)}},texImage2D:function(){try{e.texImage2D.apply(e,arguments)}catch(t){console.error(\"THREE.WebGLState:\",t)}},texImage3D:function(){try{e.texImage3D.apply(e,arguments)}catch(t){console.error(\"THREE.WebGLState:\",t)}},scissor:function(t){!1===fe.equals(t)&&(e.scissor(t.x,t.y,t.z,t.w),fe.copy(t))},viewport:function(t){!1===me.equals(t)&&(e.viewport(t.x,t.y,t.z,t.w),me.copy(t))},reset:function(){for(var t=0;t<p.length;t++)1===p[t]&&(e.disableVertexAttribArray(t),p[t]=0);v={},pe=null,de={},g=null,Z=null,ne=null,ie=null,s.reset(),c.reset(),l.reset()}}}function oh(e,t,r,n,i,a,o){var s,c=i.isWebGL2,l=i.maxTextures,h=i.maxCubemapSize,u=i.maxTextureSize,p=i.maxSamples,d=new WeakMap,f=!1;try{f=\"undefined\"!=typeof OffscreenCanvas&&null!==new OffscreenCanvas(1,1).getContext(\"2d\")}catch(G){}function m(e,t){return f?new OffscreenCanvas(e,t):document.createElementNS(\"http:\/\/www.w3.org\/1999\/xhtml\",\"canvas\")}function v(e,t,r,n){var i=1;if((e.width>n||e.height>n)&&(i=n\/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?Nr.floorPowerOfTwo:Math.floor,o=a(i*e.width),c=a(i*e.height);void 0===s&&(s=m(o,c));var l=r?m(o,c):s;return l.width=o,l.height=c,l.getContext(\"2d\").drawImage(e,0,0,o,c),console.warn(\"THREE.WebGLRenderer: Texture has been resized from (\"+e.width+\"x\"+e.height+\") to (\"+o+\"x\"+c+\").\"),l}return\"data\"in e&&console.warn(\"THREE.WebGLRenderer: Image in DataTexture is too big (\"+e.width+\"x\"+e.height+\").\"),e}return e}function g(e){return Nr.isPowerOfTwo(e.width)&&Nr.isPowerOfTwo(e.height)}function y(e,t){return e.generateMipmaps&&t&&e.minFilter!==fe&&e.minFilter!==xe}function x(t,r,i,a){e.generateMipmap(t),n.get(r).__maxMipLevel=Math.log(Math.max(i,a))*Math.LOG2E}function _(r,n,i){if(!1===c)return n;if(null!==r){if(void 0!==e[r])return e[r];console.warn(\"THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '\"+r+\"'\")}var a=n;return 6403===n&&(5126===i&&(a=33326),5131===i&&(a=33325),5121===i&&(a=33321)),6407===n&&(5126===i&&(a=34837),5131===i&&(a=34843),5121===i&&(a=32849)),6408===n&&(5126===i&&(a=34836),5131===i&&(a=34842),5121===i&&(a=32856)),33325!==a&&33326!==a&&34842!==a&&34836!==a||t.get(\"EXT_color_buffer_float\"),a}function b(e){return e===fe||e===me||e===ge?9728:9729}function w(t){var r=t.target;r.removeEventListener(\"dispose\",w),function(t){var r=n.get(t);if(void 0===r.__webglInit)return;e.deleteTexture(r.__webglTexture),n.remove(t)}(r),r.isVideoTexture&&d.delete(r),o.memory.textures--}function M(t){var r=t.target;r.removeEventListener(\"dispose\",M),function(t){var r=n.get(t),i=n.get(t.texture);if(!t)return;void 0!==i.__webglTexture&&e.deleteTexture(i.__webglTexture);t.depthTexture&&t.depthTexture.dispose();if(t.isWebGLCubeRenderTarget)for(var a=0;a<6;a++)e.deleteFramebuffer(r.__webglFramebuffer[a]),r.__webglDepthbuffer&&e.deleteRenderbuffer(r.__webglDepthbuffer[a]);else e.deleteFramebuffer(r.__webglFramebuffer),r.__webglDepthbuffer&&e.deleteRenderbuffer(r.__webglDepthbuffer),r.__webglMultisampledFramebuffer&&e.deleteFramebuffer(r.__webglMultisampledFramebuffer),r.__webglColorRenderbuffer&&e.deleteRenderbuffer(r.__webglColorRenderbuffer),r.__webglDepthRenderbuffer&&e.deleteRenderbuffer(r.__webglDepthRenderbuffer);n.remove(t.texture),n.remove(t)}(r),o.memory.textures--}var S=0;function T(e,t){var i=n.get(e);if(e.isVideoTexture&&function(e){var t=o.render.frame;d.get(e)!==t&&(d.set(e,t),e.update())}(e),e.version>0&&i.__version!==e.version){var a=e.image;if(void 0===a)console.warn(\"THREE.WebGLRenderer: Texture marked for update but image is undefined\");else{if(!1!==a.complete)return void O(i,e,t);console.warn(\"THREE.WebGLRenderer: Texture marked for update but image is incomplete\")}}r.activeTexture(33984+t),r.bindTexture(3553,i.__webglTexture)}function E(t,i){if(6===t.image.length){var o=n.get(t);if(t.version>0&&o.__version!==t.version){P(o,t),r.activeTexture(33984+i),r.bindTexture(34067,o.__webglTexture),e.pixelStorei(37440,t.flipY);for(var s=t&&(t.isCompressedTexture||t.image[0].isCompressedTexture),l=t.image[0]&&t.image[0].isDataTexture,u=[],p=0;p<6;p++)u[p]=s||l?l?t.image[p].image:t.image[p]:v(t.image[p],!1,!0,h);var d,f=u[0],m=g(f)||c,b=a.convert(t.format),w=a.convert(t.type),M=_(t.internalFormat,b,w);if(C(34067,t,m),s){for(p=0;p<6;p++){d=u[p].mipmaps;for(var S=0;S<d.length;S++){var T=d[S];t.format!==Ue&&t.format!==Fe?null!==b?r.compressedTexImage2D(34069+p,S,M,T.width,T.height,0,T.data):console.warn(\"THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()\"):r.texImage2D(34069+p,S,M,T.width,T.height,0,b,w,T.data)}}o.__maxMipLevel=d.length-1}else{d=t.mipmaps;for(p=0;p<6;p++)if(l){r.texImage2D(34069+p,0,M,u[p].width,u[p].height,0,b,w,u[p].data);for(S=0;S<d.length;S++){var E=(T=d[S]).image[p].image;r.texImage2D(34069+p,S+1,M,E.width,E.height,0,b,w,E.data)}}else{r.texImage2D(34069+p,0,M,b,w,u[p]);for(S=0;S<d.length;S++){T=d[S];r.texImage2D(34069+p,S+1,M,b,w,T.image[p])}}o.__maxMipLevel=d.length}y(t,m)&&x(34067,t,f.width,f.height),o.__version=t.version,t.onUpdate&&t.onUpdate(t)}else r.activeTexture(33984+i),r.bindTexture(34067,o.__webglTexture)}}function A(e,t){r.activeTexture(33984+t),r.bindTexture(34067,n.get(e).__webglTexture)}var L={[ue]:10497,[pe]:33071,[de]:33648},R={[fe]:9728,[me]:9984,[ge]:9986,[xe]:9729,[_e]:9985,[we]:9987};function C(r,a,o){o?(e.texParameteri(r,10242,L[a.wrapS]),e.texParameteri(r,10243,L[a.wrapT]),32879!==r&&35866!==r||e.texParameteri(r,32882,L[a.wrapR]),e.texParameteri(r,10240,R[a.magFilter]),e.texParameteri(r,10241,R[a.minFilter])):(e.texParameteri(r,10242,33071),e.texParameteri(r,10243,33071),32879!==r&&35866!==r||e.texParameteri(r,32882,33071),a.wrapS===pe&&a.wrapT===pe||console.warn(\"THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping.\"),e.texParameteri(r,10240,b(a.magFilter)),e.texParameteri(r,10241,b(a.minFilter)),a.minFilter!==fe&&a.minFilter!==xe&&console.warn(\"THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.\"));var s=t.get(\"EXT_texture_filter_anisotropic\");if(s){if(a.type===Ce&&null===t.get(\"OES_texture_float_linear\"))return;if(a.type===Pe&&null===(c||t.get(\"OES_texture_half_float_linear\")))return;(a.anisotropy>1||n.get(a).__currentAnisotropy)&&(e.texParameterf(r,s.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(a.anisotropy,i.getMaxAnisotropy())),n.get(a).__currentAnisotropy=a.anisotropy)}}function P(t,r){void 0===t.__webglInit&&(t.__webglInit=!0,r.addEventListener(\"dispose\",w),t.__webglTexture=e.createTexture(),o.memory.textures++)}function O(t,n,i){var o=3553;n.isDataTexture2DArray&&(o=35866),n.isDataTexture3D&&(o=32879),P(t,n),r.activeTexture(33984+i),r.bindTexture(o,t.__webglTexture),e.pixelStorei(37440,n.flipY),e.pixelStorei(37441,n.premultiplyAlpha),e.pixelStorei(3317,n.unpackAlignment);var s=function(e){return!c&&(e.wrapS!==pe||e.wrapT!==pe||e.minFilter!==fe&&e.minFilter!==xe)}(n)&&!1===g(n.image),l=v(n.image,s,!1,u),h=g(l)||c,p=a.convert(n.format),d=a.convert(n.type),f=_(n.internalFormat,p,d);C(o,n,h);var m,b=n.mipmaps;if(n.isDepthTexture)f=6402,c?f=n.type===Ce?36012:n.type===Re?33190:n.type===Ne?35056:33189:n.type===Ce&&console.error(\"WebGLRenderer: Floating point depth texture requires WebGL2.\"),n.format===Ve&&6402===f&&n.type!==Ae&&n.type!==Re&&(console.warn(\"THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture.\"),n.type=Ae,d=a.convert(n.type)),n.format===ke&&6402===f&&(f=34041,n.type!==Ne&&(console.warn(\"THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture.\"),n.type=Ne,d=a.convert(n.type))),r.texImage2D(3553,0,f,l.width,l.height,0,p,d,null);else if(n.isDataTexture)if(b.length>0&&h){for(var w=0,M=b.length;w<M;w++)m=b[w],r.texImage2D(3553,w,f,m.width,m.height,0,p,d,m.data);n.generateMipmaps=!1,t.__maxMipLevel=b.length-1}else r.texImage2D(3553,0,f,l.width,l.height,0,p,d,l.data),t.__maxMipLevel=0;else if(n.isCompressedTexture){for(w=0,M=b.length;w<M;w++)m=b[w],n.format!==Ue&&n.format!==Fe?null!==p?r.compressedTexImage2D(3553,w,f,m.width,m.height,0,m.data):console.warn(\"THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()\"):r.texImage2D(3553,w,f,m.width,m.height,0,p,d,m.data);t.__maxMipLevel=b.length-1}else if(n.isDataTexture2DArray)r.texImage3D(35866,0,f,l.width,l.height,l.depth,0,p,d,l.data),t.__maxMipLevel=0;else if(n.isDataTexture3D)r.texImage3D(32879,0,f,l.width,l.height,l.depth,0,p,d,l.data),t.__maxMipLevel=0;else if(b.length>0&&h){for(w=0,M=b.length;w<M;w++)m=b[w],r.texImage2D(3553,w,f,p,d,m);n.generateMipmaps=!1,t.__maxMipLevel=b.length-1}else r.texImage2D(3553,0,f,p,d,l),t.__maxMipLevel=0;y(n,h)&&x(o,n,l.width,l.height),t.__version=n.version,n.onUpdate&&n.onUpdate(n)}function D(t,i,o,s){var c=a.convert(i.texture.format),l=a.convert(i.texture.type),h=_(i.texture.internalFormat,c,l);r.texImage2D(s,0,h,i.width,i.height,0,c,l,null),e.bindFramebuffer(36160,t),e.framebufferTexture2D(36160,o,s,n.get(i.texture).__webglTexture,0),e.bindFramebuffer(36160,null)}function I(t,r,n){if(e.bindRenderbuffer(36161,t),r.depthBuffer&&!r.stencilBuffer){var i=33189;if(n){var o=r.depthTexture;o&&o.isDepthTexture&&(o.type===Ce?i=36012:o.type===Re&&(i=33190));var s=B(r);e.renderbufferStorageMultisample(36161,s,i,r.width,r.height)}else e.renderbufferStorage(36161,i,r.width,r.height);e.framebufferRenderbuffer(36160,36096,36161,t)}else if(r.depthBuffer&&r.stencilBuffer){if(n){s=B(r);e.renderbufferStorageMultisample(36161,s,35056,r.width,r.height)}else e.renderbufferStorage(36161,34041,r.width,r.height);e.framebufferRenderbuffer(36160,33306,36161,t)}else{var c=a.convert(r.texture.format),l=a.convert(r.texture.type);i=_(r.texture.internalFormat,c,l);if(n){s=B(r);e.renderbufferStorageMultisample(36161,s,i,r.width,r.height)}else e.renderbufferStorage(36161,i,r.width,r.height)}e.bindRenderbuffer(36161,null)}function N(t){var r=n.get(t),i=!0===t.isWebGLCubeRenderTarget;if(t.depthTexture){if(i)throw new Error(\"target.depthTexture not supported in Cube render targets\");!function(t,r){if(r&&r.isWebGLCubeRenderTarget)throw new Error(\"Depth Texture with cube render targets is not supported\");if(e.bindFramebuffer(36160,t),!r.depthTexture||!r.depthTexture.isDepthTexture)throw new Error(\"renderTarget.depthTexture must be an instance of THREE.DepthTexture\");n.get(r.depthTexture).__webglTexture&&r.depthTexture.image.width===r.width&&r.depthTexture.image.height===r.height||(r.depthTexture.image.width=r.width,r.depthTexture.image.height=r.height,r.depthTexture.needsUpdate=!0),T(r.depthTexture,0);var i=n.get(r.depthTexture).__webglTexture;if(r.depthTexture.format===Ve)e.framebufferTexture2D(36160,36096,3553,i,0);else{if(r.depthTexture.format!==ke)throw new Error(\"Unknown depthTexture format\");e.framebufferTexture2D(36160,33306,3553,i,0)}}(r.__webglFramebuffer,t)}else if(i){r.__webglDepthbuffer=[];for(var a=0;a<6;a++)e.bindFramebuffer(36160,r.__webglFramebuffer[a]),r.__webglDepthbuffer[a]=e.createRenderbuffer(),I(r.__webglDepthbuffer[a],t,!1)}else e.bindFramebuffer(36160,r.__webglFramebuffer),r.__webglDepthbuffer=e.createRenderbuffer(),I(r.__webglDepthbuffer,t,!1);e.bindFramebuffer(36160,null)}function B(e){return c&&e.isWebGLMultisampleRenderTarget?Math.min(p,e.samples):0}var F=!1,U=!1;this.allocateTextureUnit=function(){var e=S;return e>=l&&console.warn(\"THREE.WebGLTextures: Trying to use \"+e+\" texture units while this GPU supports only \"+l),S+=1,e},this.resetTextureUnits=function(){S=0},this.setTexture2D=T,this.setTexture2DArray=function(e,t){var i=n.get(e);e.version>0&&i.__version!==e.version?O(i,e,t):(r.activeTexture(33984+t),r.bindTexture(35866,i.__webglTexture))},this.setTexture3D=function(e,t){var i=n.get(e);e.version>0&&i.__version!==e.version?O(i,e,t):(r.activeTexture(33984+t),r.bindTexture(32879,i.__webglTexture))},this.setTextureCube=E,this.setTextureCubeDynamic=A,this.setupRenderTarget=function(t){var i=n.get(t),s=n.get(t.texture);t.addEventListener(\"dispose\",M),s.__webglTexture=e.createTexture(),o.memory.textures++;var l=!0===t.isWebGLCubeRenderTarget,h=!0===t.isWebGLMultisampleRenderTarget,u=g(t)||c;if(!c||t.texture.format!==Fe||t.texture.type!==Ce&&t.texture.type!==Pe||(t.texture.format=Ue,console.warn(\"THREE.WebGLRenderer: Rendering to textures with RGB format is not supported. Using RGBA format instead.\")),l){i.__webglFramebuffer=[];for(var p=0;p<6;p++)i.__webglFramebuffer[p]=e.createFramebuffer()}else if(i.__webglFramebuffer=e.createFramebuffer(),h)if(c){i.__webglMultisampledFramebuffer=e.createFramebuffer(),i.__webglColorRenderbuffer=e.createRenderbuffer(),e.bindRenderbuffer(36161,i.__webglColorRenderbuffer);var d=a.convert(t.texture.format),f=a.convert(t.texture.type),m=_(t.texture.internalFormat,d,f),v=B(t);e.renderbufferStorageMultisample(36161,v,m,t.width,t.height),e.bindFramebuffer(36160,i.__webglMultisampledFramebuffer),e.framebufferRenderbuffer(36160,36064,36161,i.__webglColorRenderbuffer),e.bindRenderbuffer(36161,null),t.depthBuffer&&(i.__webglDepthRenderbuffer=e.createRenderbuffer(),I(i.__webglDepthRenderbuffer,t,!0)),e.bindFramebuffer(36160,null)}else console.warn(\"THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2.\");if(l){for(r.bindTexture(34067,s.__webglTexture),C(34067,t.texture,u),p=0;p<6;p++)D(i.__webglFramebuffer[p],t,36064,34069+p);y(t.texture,u)&&x(34067,t.texture,t.width,t.height),r.bindTexture(34067,null)}else r.bindTexture(3553,s.__webglTexture),C(3553,t.texture,u),D(i.__webglFramebuffer,t,36064,3553),y(t.texture,u)&&x(3553,t.texture,t.width,t.height),r.bindTexture(3553,null);t.depthBuffer&&N(t)},this.updateRenderTargetMipmap=function(e){var t=e.texture;if(y(t,g(e)||c)){var i=e.isWebGLCubeRenderTarget?34067:3553,a=n.get(t).__webglTexture;r.bindTexture(i,a),x(i,t,e.width,e.height),r.bindTexture(i,null)}},this.updateMultisampleRenderTarget=function(t){if(t.isWebGLMultisampleRenderTarget)if(c){var r=n.get(t);e.bindFramebuffer(36008,r.__webglMultisampledFramebuffer),e.bindFramebuffer(36009,r.__webglFramebuffer);var i=t.width,a=t.height,o=16384;t.depthBuffer&&(o|=256),t.stencilBuffer&&(o|=1024),e.blitFramebuffer(0,0,i,a,0,0,i,a,o,9728),e.bindFramebuffer(36160,r.__webglMultisampledFramebuffer)}else console.warn(\"THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2.\")},this.safeSetTexture2D=function(e,t){e&&e.isWebGLRenderTarget&&(!1===F&&(console.warn(\"THREE.WebGLTextures.safeSetTexture2D: don't use render targets as textures. Use their .texture property instead.\"),F=!0),e=e.texture),T(e,t)},this.safeSetTextureCube=function(e,t){e&&e.isWebGLCubeRenderTarget&&(!1===U&&(console.warn(\"THREE.WebGLTextures.safeSetTextureCube: don't use cube render targets as textures. Use their .texture property instead.\"),U=!0),e=e.texture),e&&e.isCubeTexture||Array.isArray(e.image)&&6===e.image.length?E(e,t):A(e,t)}}function sh(e,t,r){var n=r.isWebGL2;return{convert:function(e){var r;if(e===Se)return 5121;if(e===Oe)return 32819;if(e===De)return 32820;if(e===Ie)return 33635;if(e===Te)return 5120;if(e===Ee)return 5122;if(e===Ae)return 5123;if(e===Le)return 5124;if(e===Re)return 5125;if(e===Ce)return 5126;if(e===Pe)return n?5131:null!==(r=t.get(\"OES_texture_half_float\"))?r.HALF_FLOAT_OES:null;if(e===Be)return 6406;if(e===Fe)return 6407;if(e===Ue)return 6408;if(e===Ge)return 6409;if(e===ze)return 6410;if(e===Ve)return 6402;if(e===ke)return 34041;if(e===je)return 6403;if(e===We)return 36244;if(e===qe)return 33319;if(e===Xe)return 33320;if(e===Ye)return 36248;if(e===Ze)return 36249;if(e===Je||e===Qe||e===Ke||e===$e){if(null===(r=t.get(\"WEBGL_compressed_texture_s3tc\")))return null;if(e===Je)return r.COMPRESSED_RGB_S3TC_DXT1_EXT;if(e===Qe)return r.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(e===Ke)return r.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(e===$e)return r.COMPRESSED_RGBA_S3TC_DXT5_EXT}if(e===et||e===tt||e===rt||e===nt){if(null===(r=t.get(\"WEBGL_compressed_texture_pvrtc\")))return null;if(e===et)return r.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(e===tt)return r.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(e===rt)return r.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(e===nt)return r.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(e===it)return null!==(r=t.get(\"WEBGL_compressed_texture_etc1\"))?r.COMPRESSED_RGB_ETC1_WEBGL:null;if((e===at||e===ot)&&null!==(r=t.get(\"WEBGL_compressed_texture_etc\"))){if(e===at)return r.COMPRESSED_RGB8_ETC2;if(e===ot)return r.COMPRESSED_RGBA8_ETC2_EAC}return e===st||e===ct||e===lt||e===ht||e===ut||e===pt||e===dt||e===ft||e===mt||e===vt||e===gt||e===yt||e===xt||e===_t||e===wt||e===Mt||e===St||e===Tt||e===Et||e===At||e===Lt||e===Rt||e===Ct||e===Pt||e===Ot||e===Dt||e===It||e===Nt?null!==(r=t.get(\"WEBGL_compressed_texture_astc\"))?e:null:e===bt?null!==(r=t.get(\"EXT_texture_compression_bptc\"))?e:null:e===Ne?n?34042:null!==(r=t.get(\"WEBGL_depth_texture\"))?r.UNSIGNED_INT_24_8_WEBGL:null:void 0}}}function ch(e){_a.call(this),this.cameras=e||[]}function lh(){_n.call(this),this.type=\"Group\"}function hh(e,t){var r=this,n=null,i=1,a=null,o=\"local-floor\",s=null,c=[],l=new Map,h=new _a;h.layers.enable(1),h.viewport=new Hr;var u=new _a;u.layers.enable(2),u.viewport=new Hr;var p=new ch([h,u]);p.layers.enable(1),p.layers.enable(2);var d=null,f=null;function m(e){var t=l.get(e.inputSource);t&&(t.targetRay&&t.targetRay.dispatchEvent({type:e.type}),t.grip&&t.grip.dispatchEvent({type:e.type}))}function v(){l.forEach(function(e,t){e.targetRay&&(e.targetRay.dispatchEvent({type:\"disconnected\",data:t}),e.targetRay.visible=!1),e.grip&&(e.grip.dispatchEvent({type:\"disconnected\",data:t}),e.grip.visible=!1)}),l.clear(),e.setFramebuffer(null),e.setRenderTarget(e.getRenderTarget()),M.stop(),r.isPresenting=!1,r.dispatchEvent({type:\"sessionend\"})}function g(e){a=e,M.setContext(n),M.start(),r.isPresenting=!0,r.dispatchEvent({type:\"sessionstart\"})}function y(e){for(var t=n.inputSources,r=0;r<c.length;r++)l.set(t[r],c[r]);for(r=0;r<e.removed.length;r++){var i=e.removed[r];(a=l.get(i))&&(a.targetRay&&a.targetRay.dispatchEvent({type:\"disconnected\",data:i}),a.grip&&a.grip.dispatchEvent({type:\"disconnected\",data:i}),l.delete(i))}for(r=0;r<e.added.length;r++){var a;i=e.added[r];(a=l.get(i))&&(a.targetRay&&a.targetRay.dispatchEvent({type:\"connected\",data:i}),a.grip&&a.grip.dispatchEvent({type:\"connected\",data:i}))}}this.enabled=!1,this.isPresenting=!1,this.getController=function(e){var t=c[e];return void 0===t&&(t={},c[e]=t),void 0===t.targetRay&&(t.targetRay=new lh,t.targetRay.matrixAutoUpdate=!1,t.targetRay.visible=!1),t.targetRay},this.getControllerGrip=function(e){var t=c[e];return void 0===t&&(t={},c[e]=t),void 0===t.grip&&(t.grip=new lh,t.grip.matrixAutoUpdate=!1,t.grip.visible=!1),t.grip},this.setFramebufferScaleFactor=function(e){i=e,1==r.isPresenting&&console.warn(\"WebXRManager: Cannot change framebuffer scale while presenting VR content\")},this.setReferenceSpaceType=function(e){o=e},this.getReferenceSpace=function(){return a},this.getSession=function(){return n},this.setSession=function(e){if(null!==(n=e)){n.addEventListener(\"select\",m),n.addEventListener(\"selectstart\",m),n.addEventListener(\"selectend\",m),n.addEventListener(\"squeeze\",m),n.addEventListener(\"squeezestart\",m),n.addEventListener(\"squeezeend\",m),n.addEventListener(\"end\",v);var r=t.getContextAttributes(),a={antialias:r.antialias,alpha:r.alpha,depth:r.depth,stencil:r.stencil,framebufferScaleFactor:i},s=new XRWebGLLayer(n,t,a);n.updateRenderState({baseLayer:s}),n.requestReferenceSpace(o).then(g),n.addEventListener(\"inputsourceschange\",y)}};var x=new Xr,_=new Xr;function b(e,t){null===t?e.matrixWorld.copy(e.matrix):e.matrixWorld.multiplyMatrices(t.matrixWorld,e.matrix),e.matrixWorldInverse.getInverse(e.matrixWorld)}this.getCamera=function(e){p.near=u.near=h.near=e.near,p.far=u.far=h.far=e.far,d===p.near&&f===p.far||(n.updateRenderState({depthNear:p.near,depthFar:p.far}),d=p.near,f=p.far);var t=e.parent,r=p.cameras;b(p,t);for(var i=0;i<r.length;i++)b(r[i],t);e.matrixWorld.copy(p.matrixWorld);for(var a=e.children,o=(i=0,a.length);i<o;i++)a[i].updateMatrixWorld(!0);return function(e,t,r){x.setFromMatrixPosition(t.matrixWorld),_.setFromMatrixPosition(r.matrixWorld);var n=x.distanceTo(_),i=t.projectionMatrix.elements,a=r.projectionMatrix.elements,o=i[14]\/(i[10]-1),s=i[14]\/(i[10]+1),c=(i[9]+1)\/i[5],l=(i[9]-1)\/i[5],h=(i[8]-1)\/i[0],u=(a[8]+1)\/a[0],p=o*h,d=o*u,f=n\/(-h+u),m=f*-h;t.matrixWorld.decompose(e.position,e.quaternion,e.scale),e.translateX(m),e.translateZ(f),e.matrixWorld.compose(e.position,e.quaternion,e.scale),e.matrixWorldInverse.getInverse(e.matrixWorld);var v=o+f,g=s+f,y=p-m,b=d+(n-m),w=c*s\/g*v,M=l*s\/g*v;e.projectionMatrix.makePerspective(y,b,w,M,v,g)}(p,h,u),p};var w=null;var M=new Ca;M.setAnimationLoop(function(t,r){if(null!==(s=r.getViewerPose(a))){var i=s.views,o=n.renderState.baseLayer;e.setFramebuffer(o.framebuffer);for(var l=0;l<i.length;l++){var h=i[l],u=o.getViewport(h),d=p.cameras[l];d.matrix.fromArray(h.transform.matrix),d.projectionMatrix.fromArray(h.projectionMatrix),d.viewport.set(u.x,u.y,u.width,u.height),0===l&&p.matrix.copy(d.matrix)}}var f=n.inputSources;for(l=0;l<c.length;l++){var m=c[l],v=f[l],g=null,y=null;v&&(m.targetRay&&null!==(g=r.getPose(v.targetRaySpace,a))&&(m.targetRay.matrix.fromArray(g.transform.matrix),m.targetRay.matrix.decompose(m.targetRay.position,m.targetRay.rotation,m.targetRay.scale)),m.grip&&v.gripSpace&&null!==(y=r.getPose(v.gripSpace,a))&&(m.grip.matrix.fromArray(y.transform.matrix),m.grip.matrix.decompose(m.grip.position,m.grip.rotation,m.grip.scale))),m.targetRay&&(m.targetRay.visible=null!==g),m.grip&&(m.grip.visible=null!==y)}w&&w(t,r)}),this.setAnimationLoop=function(e){w=e},this.dispose=function(){}}function uh(e){var t=void 0!==(e=e||{}).canvas?e.canvas:document.createElementNS(\"http:\/\/www.w3.org\/1999\/xhtml\",\"canvas\"),r=void 0!==e.context?e.context:null,n=void 0!==e.alpha&&e.alpha,i=void 0===e.depth||e.depth,a=void 0===e.stencil||e.stencil,o=void 0!==e.antialias&&e.antialias,s=void 0===e.premultipliedAlpha||e.premultipliedAlpha,c=void 0!==e.preserveDrawingBuffer&&e.preserveDrawingBuffer,l=void 0!==e.powerPreference?e.powerPreference:\"default\",h=void 0!==e.failIfMajorPerformanceCaveat&&e.failIfMajorPerformanceCaveat,u=null,p=null;this.domElement=t,this.debug={checkShaderErrors:!0},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.gammaFactor=2,this.outputEncoding=Yt,this.physicallyCorrectLights=!1,this.toneMapping=K,this.toneMappingExposure=1,this.toneMappingWhitePoint=1,this.maxMorphTargets=8,this.maxMorphNormals=4;var d,m,v,g,y,x,_,b,w,M,S,T,E,A,L,R,C,P,O=this,D=!1,I=null,N=0,B=0,F=null,U=null,G=-1,z={geometry:null,program:null,wireframe:!1},H=null,V=null,k=new Hr,j=new Hr,W=null,q=t.width,X=t.height,Y=1,Z=null,J=null,Q=new Hr(0,0,q,X),$=new Hr(0,0,q,X),ee=!1,te=new La,re=new ac,ne=!1,ie=!1,ae=new tn,oe=new Xr;function se(){return null===F?Y:1}try{var ce={alpha:n,depth:i,stencil:a,antialias:o,premultipliedAlpha:s,preserveDrawingBuffer:c,powerPreference:l,failIfMajorPerformanceCaveat:h,xrCompatible:!0};if(t.addEventListener(\"webglcontextlost\",pe,!1),t.addEventListener(\"webglcontextrestored\",de,!1),null===(d=r||t.getContext(\"webgl\",ce)||t.getContext(\"experimental-webgl\",ce)))throw null!==t.getContext(\"webgl\")?new Error(\"Error creating WebGL context with your selected attributes.\"):new Error(\"Error creating WebGL context.\");void 0===d.getShaderPrecisionFormat&&(d.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}})}catch(Ee){throw console.error(\"THREE.WebGLRenderer: \"+Ee.message),Ee}function le(){m=new oc(d),!1===(v=new ic(d,m,e)).isWebGL2&&(m.get(\"WEBGL_depth_texture\"),m.get(\"OES_texture_float\"),m.get(\"OES_texture_half_float\"),m.get(\"OES_texture_half_float_linear\"),m.get(\"OES_standard_derivatives\"),m.get(\"OES_element_index_uint\"),m.get(\"ANGLE_instanced_arrays\")),m.get(\"OES_texture_float_linear\"),P=new sh(d,m,v),(g=new ah(d,m,v)).scissor(j.copy($).multiplyScalar(Y).floor()),g.viewport(k.copy(Q).multiplyScalar(Y).floor()),y=new lc(d),x=new Vl,_=new oh(d,m,g,x,v,P,y),b=new Pa(d,v),w=new sc(d,b,y),M=new pc(d,w,b,y),L=new uc(d),S=new Hl(O,m,v),T=new ql,E=new $l,A=new rc(O,g,M,s),R=new nc(d,m,y,v),C=new cc(d,m,y,v),y.programs=S.programs,O.capabilities=v,O.extensions=m,O.properties=x,O.renderLists=T,O.state=g,O.info=y}le();var he=new hh(O,d);this.xr=he;var ue=new ih(O,M,v.maxTextureSize);function pe(e){e.preventDefault(),console.log(\"THREE.WebGLRenderer: Context Lost.\"),D=!0}function de(){console.log(\"THREE.WebGLRenderer: Context Restored.\"),D=!1,le()}function fe(e){var t=e.target;t.removeEventListener(\"dispose\",fe),function(e){me(e),x.remove(e)}(t)}function me(e){var t=x.get(e).program;e.program=void 0,void 0!==t&&S.releaseProgram(t)}this.shadowMap=ue,this.getContext=function(){return d},this.getContextAttributes=function(){return d.getContextAttributes()},this.forceContextLoss=function(){var e=m.get(\"WEBGL_lose_context\");e&&e.loseContext()},this.forceContextRestore=function(){var e=m.get(\"WEBGL_lose_context\");e&&e.restoreContext()},this.getPixelRatio=function(){return Y},this.setPixelRatio=function(e){void 0!==e&&(Y=e,this.setSize(q,X,!1))},this.getSize=function(e){return void 0===e&&(console.warn(\"WebGLRenderer: .getsize() now requires a Vector2 as an argument\"),e=new Br),e.set(q,X)},this.setSize=function(e,r,n){he.isPresenting?console.warn(\"THREE.WebGLRenderer: Can't change size while VR device is presenting.\"):(q=e,X=r,t.width=Math.floor(e*Y),t.height=Math.floor(r*Y),!1!==n&&(t.style.width=e+\"px\",t.style.height=r+\"px\"),this.setViewport(0,0,e,r))},this.getDrawingBufferSize=function(e){return void 0===e&&(console.warn(\"WebGLRenderer: .getdrawingBufferSize() now requires a Vector2 as an argument\"),e=new Br),e.set(q*Y,X*Y).floor()},this.setDrawingBufferSize=function(e,r,n){q=e,X=r,Y=n,t.width=Math.floor(e*n),t.height=Math.floor(r*n),this.setViewport(0,0,e,r)},this.getCurrentViewport=function(e){return void 0===e&&(console.warn(\"WebGLRenderer: .getCurrentViewport() now requires a Vector4 as an argument\"),e=new Hr),e.copy(k)},this.getViewport=function(e){return e.copy(Q)},this.setViewport=function(e,t,r,n){e.isVector4?Q.set(e.x,e.y,e.z,e.w):Q.set(e,t,r,n),g.viewport(k.copy(Q).multiplyScalar(Y).floor())},this.getScissor=function(e){return e.copy($)},this.setScissor=function(e,t,r,n){e.isVector4?$.set(e.x,e.y,e.z,e.w):$.set(e,t,r,n),g.scissor(j.copy($).multiplyScalar(Y).floor())},this.getScissorTest=function(){return ee},this.setScissorTest=function(e){g.setScissorTest(ee=e)},this.setOpaqueSort=function(e){Z=e},this.setTransparentSort=function(e){J=e},this.getClearColor=function(){return A.getClearColor()},this.setClearColor=function(){A.setClearColor.apply(A,arguments)},this.getClearAlpha=function(){return A.getClearAlpha()},this.setClearAlpha=function(){A.setClearAlpha.apply(A,arguments)},this.clear=function(e,t,r){var n=0;(void 0===e||e)&&(n|=16384),(void 0===t||t)&&(n|=256),(void 0===r||r)&&(n|=1024),d.clear(n)},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(){t.removeEventListener(\"webglcontextlost\",pe,!1),t.removeEventListener(\"webglcontextrestored\",de,!1),T.dispose(),E.dispose(),x.dispose(),M.dispose(),he.dispose(),ye.stop(),this.forceContextLoss()},this.renderBufferImmediate=function(e,t){g.initAttributes();var r=x.get(e);e.hasPositions&&!r.position&&(r.position=d.createBuffer()),e.hasNormals&&!r.normal&&(r.normal=d.createBuffer()),e.hasUvs&&!r.uv&&(r.uv=d.createBuffer()),e.hasColors&&!r.color&&(r.color=d.createBuffer());var n=t.getAttributes();e.hasPositions&&(d.bindBuffer(34962,r.position),d.bufferData(34962,e.positionArray,35048),g.enableAttribute(n.position),d.vertexAttribPointer(n.position,3,5126,!1,0,0)),e.hasNormals&&(d.bindBuffer(34962,r.normal),d.bufferData(34962,e.normalArray,35048),g.enableAttribute(n.normal),d.vertexAttribPointer(n.normal,3,5126,!1,0,0)),e.hasUvs&&(d.bindBuffer(34962,r.uv),d.bufferData(34962,e.uvArray,35048),g.enableAttribute(n.uv),d.vertexAttribPointer(n.uv,2,5126,!1,0,0)),e.hasColors&&(d.bindBuffer(34962,r.color),d.bufferData(34962,e.colorArray,35048),g.enableAttribute(n.color),d.vertexAttribPointer(n.color,3,5126,!1,0,0)),g.disableUnusedAttributes(),d.drawArrays(4,0,e.count),e.count=0};var ve=new bn;this.renderBufferDirect=function(e,t,r,n,i,a){null===t&&(t=ve);var o=i.isMesh&&i.matrixWorld.determinant()<0,s=we(e,t,n,i);g.setMaterial(n,o);var c=!1;z.geometry===r.id&&z.program===s.id&&z.wireframe===(!0===n.wireframe)||(z.geometry=r.id,z.program=s.id,z.wireframe=!0===n.wireframe,c=!0),(n.morphTargets||n.morphNormals)&&(L.update(i,r,n,s),c=!0);var l=r.index,h=r.attributes.position;if(null===l){if(void 0===h||0===h.count)return}else if(0===l.count)return;var u,p=1;!0===n.wireframe&&(l=w.getWireframeAttribute(r),p=2);var f=R;null!==l&&(u=b.get(l),(f=C).setIndex(u)),c&&(!function(e,t,r,n){if(!1===v.isWebGL2&&(e.isInstancedMesh||t.isInstancedBufferGeometry)&&null===m.get(\"ANGLE_instanced_arrays\"))return;g.initAttributes();var i=t.attributes,a=n.getAttributes(),o=r.defaultAttributeValues;for(var s in a){var c=a[s];if(c>=0){var l=i[s];if(void 0!==l){var h=l.normalized,u=l.itemSize,p=b.get(l);if(void 0===p)continue;var f=p.buffer,y=p.type,x=p.bytesPerElement;if(l.isInterleavedBufferAttribute){var _=l.data,w=_.stride,M=l.offset;_&&_.isInstancedInterleavedBuffer?(g.enableAttributeAndDivisor(c,_.meshPerAttribute),void 0===t.maxInstancedCount&&(t.maxInstancedCount=_.meshPerAttribute*_.count)):g.enableAttribute(c),d.bindBuffer(34962,f),d.vertexAttribPointer(c,u,y,h,w*x,M*x)}else l.isInstancedBufferAttribute?(g.enableAttributeAndDivisor(c,l.meshPerAttribute),void 0===t.maxInstancedCount&&(t.maxInstancedCount=l.meshPerAttribute*l.count)):g.enableAttribute(c),d.bindBuffer(34962,f),d.vertexAttribPointer(c,u,y,h,0,0)}else if(\"instanceMatrix\"===s){var p=b.get(e.instanceMatrix);if(void 0===p)continue;var f=p.buffer,y=p.type;g.enableAttributeAndDivisor(c+0,1),g.enableAttributeAndDivisor(c+1,1),g.enableAttributeAndDivisor(c+2,1),g.enableAttributeAndDivisor(c+3,1),d.bindBuffer(34962,f),d.vertexAttribPointer(c+0,4,y,!1,64,0),d.vertexAttribPointer(c+1,4,y,!1,64,16),d.vertexAttribPointer(c+2,4,y,!1,64,32),d.vertexAttribPointer(c+3,4,y,!1,64,48)}else if(void 0!==o){var S=o[s];if(void 0!==S)switch(S.length){case 2:d.vertexAttrib2fv(c,S);break;case 3:d.vertexAttrib3fv(c,S);break;case 4:d.vertexAttrib4fv(c,S);break;default:d.vertexAttrib1fv(c,S)}}}}g.disableUnusedAttributes()}(i,r,n,s),null!==l&&d.bindBuffer(34963,u.buffer));var y=null!==l?l.count:h.count,x=r.drawRange.start*p,_=r.drawRange.count*p,M=null!==a?a.start*p:0,S=null!==a?a.count*p:1\/0,T=Math.max(x,M),E=Math.min(y,x+_,M+S)-1,A=Math.max(0,E-T+1);if(0!==A){if(i.isMesh)!0===n.wireframe?(g.setLineWidth(n.wireframeLinewidth*se()),f.setMode(1)):f.setMode(4);else if(i.isLine){var P=n.linewidth;void 0===P&&(P=1),g.setLineWidth(P*se()),i.isLineSegments?f.setMode(1):i.isLineLoop?f.setMode(2):f.setMode(3)}else i.isPoints?f.setMode(0):i.isSprite&&f.setMode(4);i.isInstancedMesh?f.renderInstances(r,T,A,i.count):r.isInstancedBufferGeometry?f.renderInstances(r,T,A,r.maxInstancedCount):f.render(T,A)}},this.compile=function(e,t){(p=E.get(e,t)).init(),e.traverse(function(e){e.isLight&&(p.pushLight(e),e.castShadow&&p.pushShadow(e))}),p.setupLights(t);var r={};e.traverse(function(t){if(t.material)if(Array.isArray(t.material))for(var n=0;n<t.material.length;n++)t.material[n].uuid in r==!1&&(be(t.material[n],e,t),r[t.material[n].uuid]=!0);else t.material.uuid in r==!1&&(be(t.material,e,t),r[t.material.uuid]=!0)})};var ge=null;var ye=new Ca;function xe(e,t,r,n){for(var i=0,a=e.length;i<a;i++){var o=e[i],s=o.object,c=o.geometry,l=void 0===n?o.material:n,h=o.group;if(r.isArrayCamera){V=r;for(var u=r.cameras,d=0,f=u.length;d<f;d++){var m=u[d];s.layers.test(m.layers)&&(g.viewport(k.copy(m.viewport)),p.setupLights(m),_e(s,t,m,c,l,h))}}else V=null,_e(s,t,r,c,l,h)}}function _e(e,t,r,n,i,a){if(e.onBeforeRender(O,t,r,n,i,a),p=E.get(t,V||r),e.modelViewMatrix.multiplyMatrices(r.matrixWorldInverse,e.matrixWorld),e.normalMatrix.getNormalMatrix(e.modelViewMatrix),e.isImmediateRenderObject){var o=we(r,t,i,e);g.setMaterial(i),z.geometry=null,z.program=null,z.wireframe=!1,function(e,t){e.render(function(e){O.renderBufferImmediate(e,t)})}(e,o)}else O.renderBufferDirect(r,t,n,i,e,a);e.onAfterRender(O,t,r,n,i,a),p=E.get(t,V||r)}function be(e,t,r){var n=x.get(e),i=p.state.lights,a=p.state.shadowsArray,o=i.state.version,s=S.getParameters(e,i.state,a,t,re.numPlanes,re.numIntersection,r),c=S.getProgramCacheKey(s),l=n.program,h=!0;if(void 0===l)e.addEventListener(\"dispose\",fe);else if(l.cacheKey!==c)me(e);else if(n.lightsStateVersion!==o)n.lightsStateVersion=o,h=!1;else{if(void 0!==s.shaderID)return;h=!1}h&&(l=S.acquireProgram(s,c),n.program=l,n.uniforms=s.uniforms,n.environment=e.isMeshStandardMaterial?t.environment:null,n.outputEncoding=O.outputEncoding,e.program=l);var u=l.getAttributes();if(e.morphTargets){e.numSupportedMorphTargets=0;for(var d=0;d<O.maxMorphTargets;d++)u[\"morphTarget\"+d]>=0&&e.numSupportedMorphTargets++}if(e.morphNormals){e.numSupportedMorphNormals=0;for(d=0;d<O.maxMorphNormals;d++)u[\"morphNormal\"+d]>=0&&e.numSupportedMorphNormals++}var f=n.uniforms;(e.isShaderMaterial||e.isRawShaderMaterial)&&!0!==e.clipping||(n.numClippingPlanes=re.numPlanes,n.numIntersection=re.numIntersection,f.clippingPlanes=re.uniform),n.fog=t.fog,n.needsLights=function(e){return e.isMeshLambertMaterial||e.isMeshToonMaterial||e.isMeshPhongMaterial||e.isMeshStandardMaterial||e.isShadowMaterial||e.isShaderMaterial&&!0===e.lights}(e),n.lightsStateVersion=o,n.needsLights&&(f.ambientLightColor.value=i.state.ambient,f.lightProbe.value=i.state.probe,f.directionalLights.value=i.state.directional,f.directionalLightShadows.value=i.state.directionalShadow,f.spotLights.value=i.state.spot,f.spotLightShadows.value=i.state.spotShadow,f.rectAreaLights.value=i.state.rectArea,f.pointLights.value=i.state.point,f.pointLightShadows.value=i.state.pointShadow,f.hemisphereLights.value=i.state.hemi,f.directionalShadowMap.value=i.state.directionalShadowMap,f.directionalShadowMatrix.value=i.state.directionalShadowMatrix,f.spotShadowMap.value=i.state.spotShadowMap,f.spotShadowMatrix.value=i.state.spotShadowMatrix,f.pointShadowMap.value=i.state.pointShadowMap,f.pointShadowMatrix.value=i.state.pointShadowMatrix);var m=n.program.getUniforms(),v=pl.seqWithValue(m.seq,f);n.uniformsList=v}function we(e,t,r,n){_.resetTextureUnits();var i=t.fog,a=r.isMeshStandardMaterial?t.environment:null,o=x.get(r),s=p.state.lights;if(ne&&(ie||e!==H)){var c=e===H&&r.id===G;re.setState(r.clippingPlanes,r.clipIntersection,r.clipShadows,e,o,c)}r.version===o.__version?void 0===o.program?be(r,t,n):r.fog&&o.fog!==i?be(r,t,n):o.environment!==a?be(r,t,n):o.needsLights&&o.lightsStateVersion!==s.state.version?be(r,t,n):void 0===o.numClippingPlanes||o.numClippingPlanes===re.numPlanes&&o.numIntersection===re.numIntersection?o.outputEncoding!==O.outputEncoding&&be(r,t,n):be(r,t,n):(be(r,t,n),o.__version=r.version);var l,h,u=!1,m=!1,y=!1,b=o.program,w=b.getUniforms(),M=o.uniforms;if(g.useProgram(b.program)&&(u=!0,m=!0,y=!0),r.id!==G&&(G=r.id,m=!0),u||H!==e){if(w.setValue(d,\"projectionMatrix\",e.projectionMatrix),v.logarithmicDepthBuffer&&w.setValue(d,\"logDepthBufFC\",2\/(Math.log(e.far+1)\/Math.LN2)),H!==e&&(H=e,m=!0,y=!0),r.isShaderMaterial||r.isMeshPhongMaterial||r.isMeshToonMaterial||r.isMeshStandardMaterial||r.envMap){var S=w.map.cameraPosition;void 0!==S&&S.setValue(d,oe.setFromMatrixPosition(e.matrixWorld))}(r.isMeshPhongMaterial||r.isMeshToonMaterial||r.isMeshLambertMaterial||r.isMeshBasicMaterial||r.isMeshStandardMaterial||r.isShaderMaterial)&&w.setValue(d,\"isOrthographic\",!0===e.isOrthographicCamera),(r.isMeshPhongMaterial||r.isMeshToonMaterial||r.isMeshLambertMaterial||r.isMeshBasicMaterial||r.isMeshStandardMaterial||r.isShaderMaterial||r.skinning)&&w.setValue(d,\"viewMatrix\",e.matrixWorldInverse)}if(r.skinning){w.setOptional(d,n,\"bindMatrix\"),w.setOptional(d,n,\"bindMatrixInverse\");var T=n.skeleton;if(T){var E=T.bones;if(v.floatVertexTextures){if(void 0===T.boneTexture){var A=Math.sqrt(4*E.length);A=Nr.ceilPowerOfTwo(A),A=Math.max(A,4);var L=new Float32Array(A*A*4);L.set(T.boneMatrices);var R=new Ta(L,A,A,Ue,Ce);T.boneMatrices=L,T.boneTexture=R,T.boneTextureSize=A}w.setValue(d,\"boneTexture\",T.boneTexture,_),w.setValue(d,\"boneTextureSize\",T.boneTextureSize)}else w.setOptional(d,T,\"boneMatrices\")}}return(m||o.receiveShadow!==n.receiveShadow)&&(o.receiveShadow=n.receiveShadow,w.setValue(d,\"receiveShadow\",n.receiveShadow)),m&&(w.setValue(d,\"toneMappingExposure\",O.toneMappingExposure),w.setValue(d,\"toneMappingWhitePoint\",O.toneMappingWhitePoint),o.needsLights&&(h=y,(l=M).ambientLightColor.needsUpdate=h,l.lightProbe.needsUpdate=h,l.directionalLights.needsUpdate=h,l.directionalLightShadows.needsUpdate=h,l.pointLights.needsUpdate=h,l.pointLightShadows.needsUpdate=h,l.spotLights.needsUpdate=h,l.spotLightShadows.needsUpdate=h,l.rectAreaLights.needsUpdate=h,l.hemisphereLights.needsUpdate=h),i&&r.fog&&function(e,t){e.fogColor.value.copy(t.color),t.isFog?(e.fogNear.value=t.near,e.fogFar.value=t.far):t.isFogExp2&&(e.fogDensity.value=t.density)}(M,i),r.isMeshBasicMaterial?Me(M,r):r.isMeshLambertMaterial?(Me(M,r),function(e,t){t.emissiveMap&&(e.emissiveMap.value=t.emissiveMap)}(M,r)):r.isMeshToonMaterial?(Me(M,r),function(e,t){e.specular.value.copy(t.specular),e.shininess.value=Math.max(t.shininess,1e-4),t.gradientMap&&(e.gradientMap.value=t.gradientMap);t.emissiveMap&&(e.emissiveMap.value=t.emissiveMap);t.bumpMap&&(e.bumpMap.value=t.bumpMap,e.bumpScale.value=t.bumpScale,t.side===f&&(e.bumpScale.value*=-1));t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale),t.side===f&&e.normalScale.value.negate());t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias)}(M,r)):r.isMeshPhongMaterial?(Me(M,r),function(e,t){e.specular.value.copy(t.specular),e.shininess.value=Math.max(t.shininess,1e-4),t.emissiveMap&&(e.emissiveMap.value=t.emissiveMap);t.bumpMap&&(e.bumpMap.value=t.bumpMap,e.bumpScale.value=t.bumpScale,t.side===f&&(e.bumpScale.value*=-1));t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale),t.side===f&&e.normalScale.value.negate());t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias)}(M,r)):r.isMeshStandardMaterial?(Me(M,r,a),r.isMeshPhysicalMaterial?function(e,t,r){Te(e,t,r),e.reflectivity.value=t.reflectivity,e.clearcoat.value=t.clearcoat,e.clearcoatRoughness.value=t.clearcoatRoughness,t.sheen&&e.sheen.value.copy(t.sheen);t.clearcoatMap&&(e.clearcoatMap.value=t.clearcoatMap);t.clearcoatRoughnessMap&&(e.clearcoatRoughnessMap.value=t.clearcoatRoughnessMap);t.clearcoatNormalMap&&(e.clearcoatNormalScale.value.copy(t.clearcoatNormalScale),e.clearcoatNormalMap.value=t.clearcoatNormalMap,t.side===f&&e.clearcoatNormalScale.value.negate());e.transparency.value=t.transparency}(M,r,a):Te(M,r,a)):r.isMeshMatcapMaterial?(Me(M,r),function(e,t){t.matcap&&(e.matcap.value=t.matcap);t.bumpMap&&(e.bumpMap.value=t.bumpMap,e.bumpScale.value=t.bumpScale,t.side===f&&(e.bumpScale.value*=-1));t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale),t.side===f&&e.normalScale.value.negate());t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias)}(M,r)):r.isMeshDepthMaterial?(Me(M,r),function(e,t){t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias)}(M,r)):r.isMeshDistanceMaterial?(Me(M,r),function(e,t){t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias);e.referencePosition.value.copy(t.referencePosition),e.nearDistance.value=t.nearDistance,e.farDistance.value=t.farDistance}(M,r)):r.isMeshNormalMaterial?(Me(M,r),function(e,t){t.bumpMap&&(e.bumpMap.value=t.bumpMap,e.bumpScale.value=t.bumpScale,t.side===f&&(e.bumpScale.value*=-1));t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale),t.side===f&&e.normalScale.value.negate());t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias)}(M,r)):r.isLineBasicMaterial?(function(e,t){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity}(M,r),r.isLineDashedMaterial&&function(e,t){e.dashSize.value=t.dashSize,e.totalSize.value=t.dashSize+t.gapSize,e.scale.value=t.scale}(M,r)):r.isPointsMaterial?function(e,t){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity,e.size.value=t.size*Y,e.scale.value=.5*X,t.map&&(e.map.value=t.map);t.alphaMap&&(e.alphaMap.value=t.alphaMap);var r;t.map?r=t.map:t.alphaMap&&(r=t.alphaMap);void 0!==r&&(!0===r.matrixAutoUpdate&&r.updateMatrix(),e.uvTransform.value.copy(r.matrix))}(M,r):r.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);t.alphaMap&&(e.alphaMap.value=t.alphaMap);var r;t.map?r=t.map:t.alphaMap&&(r=t.alphaMap);void 0!==r&&(!0===r.matrixAutoUpdate&&r.updateMatrix(),e.uvTransform.value.copy(r.matrix))}(M,r):r.isShadowMaterial&&(M.color.value.copy(r.color),M.opacity.value=r.opacity),void 0!==M.ltc_1&&(M.ltc_1.value=Ra.LTC_1),void 0!==M.ltc_2&&(M.ltc_2.value=Ra.LTC_2),pl.upload(d,o.uniformsList,M,_),r.isShaderMaterial&&(r.uniformsNeedUpdate=!1)),r.isShaderMaterial&&!0===r.uniformsNeedUpdate&&(pl.upload(d,o.uniformsList,M,_),r.uniformsNeedUpdate=!1),r.isSpriteMaterial&&w.setValue(d,\"center\",n.center),w.setValue(d,\"modelViewMatrix\",n.modelViewMatrix),w.setValue(d,\"normalMatrix\",n.normalMatrix),w.setValue(d,\"modelMatrix\",n.matrixWorld),b}function Me(e,t,r){e.opacity.value=t.opacity,t.color&&e.diffuse.value.copy(t.color),t.emissive&&e.emissive.value.copy(t.emissive).multiplyScalar(t.emissiveIntensity),t.map&&(e.map.value=t.map),t.alphaMap&&(e.alphaMap.value=t.alphaMap),t.specularMap&&(e.specularMap.value=t.specularMap);var n,i,a=t.envMap||r;a&&(e.envMap.value=a,e.flipEnvMap.value=a.isCubeTexture?-1:1,e.reflectivity.value=t.reflectivity,e.refractionRatio.value=t.refractionRatio,e.maxMipLevel.value=x.get(a).__maxMipLevel),t.lightMap&&(e.lightMap.value=t.lightMap,e.lightMapIntensity.value=t.lightMapIntensity),t.aoMap&&(e.aoMap.value=t.aoMap,e.aoMapIntensity.value=t.aoMapIntensity),t.map?n=t.map:t.specularMap?n=t.specularMap:t.displacementMap?n=t.displacementMap:t.normalMap?n=t.normalMap:t.bumpMap?n=t.bumpMap:t.roughnessMap?n=t.roughnessMap:t.metalnessMap?n=t.metalnessMap:t.alphaMap?n=t.alphaMap:t.emissiveMap&&(n=t.emissiveMap),void 0!==n&&(n.isWebGLRenderTarget&&(n=n.texture),!0===n.matrixAutoUpdate&&n.updateMatrix(),e.uvTransform.value.copy(n.matrix)),t.aoMap?i=t.aoMap:t.lightMap&&(i=t.lightMap),void 0!==i&&(i.isWebGLRenderTarget&&(i=i.texture),!0===i.matrixAutoUpdate&&i.updateMatrix(),e.uv2Transform.value.copy(i.matrix))}function Te(e,t,r){e.roughness.value=t.roughness,e.metalness.value=t.metalness,t.roughnessMap&&(e.roughnessMap.value=t.roughnessMap),t.metalnessMap&&(e.metalnessMap.value=t.metalnessMap),t.emissiveMap&&(e.emissiveMap.value=t.emissiveMap),t.bumpMap&&(e.bumpMap.value=t.bumpMap,e.bumpScale.value=t.bumpScale,t.side===f&&(e.bumpScale.value*=-1)),t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale),t.side===f&&e.normalScale.value.negate()),t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias),(t.envMap||r)&&(e.envMapIntensity.value=t.envMapIntensity)}ye.setAnimationLoop(function(e){he.isPresenting||ge&&ge(e)}),\"undefined\"!=typeof window&&ye.setContext(window),this.setAnimationLoop=function(e){ge=e,he.setAnimationLoop(e),ye.start()},this.render=function(e,t){var r,n;if(void 0!==arguments[2]&&(console.warn(\"THREE.WebGLRenderer.render(): the renderTarget argument has been removed. Use .setRenderTarget() instead.\"),r=arguments[2]),void 0!==arguments[3]&&(console.warn(\"THREE.WebGLRenderer.render(): the forceClear argument has been removed. Use .clear() instead.\"),n=arguments[3]),t&&t.isCamera){if(!D){z.geometry=null,z.program=null,z.wireframe=!1,G=-1,H=null,!0===e.autoUpdate&&e.updateMatrixWorld(),null===t.parent&&t.updateMatrixWorld(),he.enabled&&he.isPresenting&&(t=he.getCamera(t)),(p=E.get(e,t)).init(),e.onBeforeRender(O,e,t,r||F),ae.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),te.setFromProjectionMatrix(ae),ie=this.localClippingEnabled,ne=re.init(this.clippingPlanes,ie,t),(u=T.get(e,t)).init(),function e(t,r,n,i){if(!1===t.visible)return;var a=t.layers.test(r.layers);if(a)if(t.isGroup)n=t.renderOrder;else if(t.isLOD)!0===t.autoUpdate&&t.update(r);else if(t.isLight)p.pushLight(t),t.castShadow&&p.pushShadow(t);else if(t.isSprite){if(!t.frustumCulled||te.intersectsSprite(t)){i&&oe.setFromMatrixPosition(t.matrixWorld).applyMatrix4(ae);var o=M.update(t),s=t.material;s.visible&&u.push(t,o,s,n,oe.z,null)}}else if(t.isImmediateRenderObject)i&&oe.setFromMatrixPosition(t.matrixWorld).applyMatrix4(ae),u.push(t,null,t.material,n,oe.z,null);else if((t.isMesh||t.isLine||t.isPoints)&&(t.isSkinnedMesh&&t.skeleton.frame!==y.render.frame&&(t.skeleton.update(),t.skeleton.frame=y.render.frame),!t.frustumCulled||te.intersectsObject(t))){i&&oe.setFromMatrixPosition(t.matrixWorld).applyMatrix4(ae);var o=M.update(t),s=t.material;if(Array.isArray(s))for(var c=o.groups,l=0,h=c.length;l<h;l++){var d=c[l],f=s[d.materialIndex];f&&f.visible&&u.push(t,o,f,n,oe.z,d)}else s.visible&&u.push(t,o,s,n,oe.z,null)}var m=t.children;for(var l=0,h=m.length;l<h;l++)e(m[l],r,n,i)}(e,t,0,O.sortObjects),u.finish(),!0===O.sortObjects&&u.sort(Z,J),ne&&re.beginShadows();var i=p.state.shadowsArray;ue.render(i,e,t),p.setupLights(t),ne&&re.endShadows(),this.info.autoReset&&this.info.reset(),void 0!==r&&this.setRenderTarget(r),A.render(u,e,t,n);var a=u.opaque,o=u.transparent;if(e.overrideMaterial){var s=e.overrideMaterial;a.length&&xe(a,e,t,s),o.length&&xe(o,e,t,s)}else a.length&&xe(a,e,t),o.length&&xe(o,e,t);e.onAfterRender(O,e,t),null!==F&&(_.updateRenderTargetMipmap(F),_.updateMultisampleRenderTarget(F)),g.buffers.depth.setTest(!0),g.buffers.depth.setMask(!0),g.buffers.color.setMask(!0),g.setPolygonOffset(!1),u=null,p=null}}else console.error(\"THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.\")},this.setFramebuffer=function(e){I!==e&&null===F&&d.bindFramebuffer(36160,e),I=e},this.getActiveCubeFace=function(){return N},this.getActiveMipmapLevel=function(){return B},this.getRenderTarget=function(){return F},this.setRenderTarget=function(e,t,r){F=e,N=t,B=r,e&&void 0===x.get(e).__webglFramebuffer&&_.setupRenderTarget(e);var n=I,i=!1;if(e){var a=x.get(e).__webglFramebuffer;e.isWebGLCubeRenderTarget?(n=a[t||0],i=!0):n=e.isWebGLMultisampleRenderTarget?x.get(e).__webglMultisampledFramebuffer:a,k.copy(e.viewport),j.copy(e.scissor),W=e.scissorTest}else k.copy(Q).multiplyScalar(Y).floor(),j.copy($).multiplyScalar(Y).floor(),W=ee;if(U!==n&&(d.bindFramebuffer(36160,n),U=n),g.viewport(k),g.scissor(j),g.setScissorTest(W),i){var o=x.get(e.texture);d.framebufferTexture2D(36160,36064,34069+(t||0),o.__webglTexture,r||0)}},this.readRenderTargetPixels=function(e,t,r,n,i,a,o){if(e&&e.isWebGLRenderTarget){var s=x.get(e).__webglFramebuffer;if(e.isWebGLCubeRenderTarget&&void 0!==o&&(s=s[o]),s){var c=!1;s!==U&&(d.bindFramebuffer(36160,s),c=!0);try{var l=e.texture,h=l.format,u=l.type;if(h!==Ue&&P.convert(h)!==d.getParameter(35739))return void console.error(\"THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.\");if(!(u===Se||P.convert(u)===d.getParameter(35738)||u===Ce&&(v.isWebGL2||m.get(\"OES_texture_float\")||m.get(\"WEBGL_color_buffer_float\"))||u===Pe&&(v.isWebGL2?m.get(\"EXT_color_buffer_float\"):m.get(\"EXT_color_buffer_half_float\"))))return void console.error(\"THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.\");36053===d.checkFramebufferStatus(36160)?t>=0&&t<=e.width-n&&r>=0&&r<=e.height-i&&d.readPixels(t,r,n,i,P.convert(h),P.convert(u),a):console.error(\"THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete.\")}finally{c&&d.bindFramebuffer(36160,U)}}}else console.error(\"THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.\")},this.copyFramebufferToTexture=function(e,t,r){void 0===r&&(r=0);var n=Math.pow(2,-r),i=Math.floor(t.image.width*n),a=Math.floor(t.image.height*n),o=P.convert(t.format);_.setTexture2D(t,0),d.copyTexImage2D(3553,r,o,e.x,e.y,i,a,0),g.unbindTexture()},this.copyTextureToTexture=function(e,t,r,n){var i=t.image.width,a=t.image.height,o=P.convert(r.format),s=P.convert(r.type);_.setTexture2D(r,0),t.isDataTexture?d.texSubImage2D(3553,n||0,e.x,e.y,i,a,o,s,t.image.data):d.texSubImage2D(3553,n||0,e.x,e.y,o,s,t.image),g.unbindTexture()},this.initTexture=function(e){_.setTexture2D(e,0),g.unbindTexture()},\"undefined\"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent(\"observe\",{detail:this}))}function ph(e,t){this.name=\"\",this.color=new ui(e),this.density=void 0!==t?t:25e-5}function dh(e,t,r){this.name=\"\",this.color=new ui(e),this.near=void 0!==t?t:1,this.far=void 0!==r?r:1e3}function fh(e,t){this.array=e,this.stride=t,this.count=void 0!==e?e.length\/t:0,this.usage=wr,this.updateRange={offset:0,count:-1},this.version=0}ch.prototype=Object.assign(Object.create(_a.prototype),{constructor:ch,isArrayCamera:!0}),lh.prototype=Object.assign(Object.create(_n.prototype),{constructor:lh,isGroup:!0}),Object.assign(hh.prototype,Pr.prototype),Object.assign(ph.prototype,{isFogExp2:!0,clone:function(){return new ph(this.color,this.density)},toJSON:function(){return{type:\"FogExp2\",color:this.color.getHex(),density:this.density}}}),Object.assign(dh.prototype,{isFog:!0,clone:function(){return new dh(this.color,this.near,this.far)},toJSON:function(){return{type:\"Fog\",color:this.color.getHex(),near:this.near,far:this.far}}}),Object.defineProperty(fh.prototype,\"needsUpdate\",{set:function(e){!0===e&&this.version++}}),Object.assign(fh.prototype,{isInterleavedBuffer:!0,onUploadCallback:function(){},setUsage:function(e){return this.usage=e,this},copy:function(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this},copyAt:function(e,t,r){e*=this.stride,r*=t.stride;for(var n=0,i=this.stride;n<i;n++)this.array[e+n]=t.array[r+n];return this},set:function(e,t){return void 0===t&&(t=0),this.array.set(e,t),this},clone:function(){return(new this.constructor).copy(this)},onUpload:function(e){return this.onUploadCallback=e,this}});var mh,vh=new Xr;function gh(e,t,r,n){this.data=e,this.itemSize=t,this.offset=r,this.normalized=!0===n}function yh(e){gi.call(this),this.type=\"SpriteMaterial\",this.color=new ui(16777215),this.map=null,this.alphaMap=null,this.rotation=0,this.sizeAttenuation=!0,this.transparent=!0,this.setValues(e)}Object.defineProperties(gh.prototype,{count:{get:function(){return this.data.count}},array:{get:function(){return this.data.array}}}),Object.assign(gh.prototype,{isInterleavedBufferAttribute:!0,applyMatrix4:function(e){for(var t=0,r=this.data.count;t<r;t++)vh.x=this.getX(t),vh.y=this.getY(t),vh.z=this.getZ(t),vh.applyMatrix4(e),this.setXYZ(t,vh.x,vh.y,vh.z);return this},setX:function(e,t){return this.data.array[e*this.data.stride+this.offset]=t,this},setY:function(e,t){return this.data.array[e*this.data.stride+this.offset+1]=t,this},setZ:function(e,t){return this.data.array[e*this.data.stride+this.offset+2]=t,this},setW:function(e,t){return this.data.array[e*this.data.stride+this.offset+3]=t,this},getX:function(e){return this.data.array[e*this.data.stride+this.offset]},getY:function(e){return this.data.array[e*this.data.stride+this.offset+1]},getZ:function(e){return this.data.array[e*this.data.stride+this.offset+2]},getW:function(e){return this.data.array[e*this.data.stride+this.offset+3]},setXY:function(e,t,r){return e=e*this.data.stride+this.offset,this.data.array[e+0]=t,this.data.array[e+1]=r,this},setXYZ:function(e,t,r,n){return e=e*this.data.stride+this.offset,this.data.array[e+0]=t,this.data.array[e+1]=r,this.data.array[e+2]=n,this},setXYZW:function(e,t,r,n,i){return e=e*this.data.stride+this.offset,this.data.array[e+0]=t,this.data.array[e+1]=r,this.data.array[e+2]=n,this.data.array[e+3]=i,this}}),yh.prototype=Object.create(gi.prototype),yh.prototype.constructor=yh,yh.prototype.isSpriteMaterial=!0,yh.prototype.copy=function(e){return gi.prototype.copy.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};var xh=new Xr,_h=new Xr,bh=new Xr,wh=new Br,Mh=new Br,Sh=new tn,Th=new Xr,Eh=new Xr,Ah=new Xr,Lh=new Br,Rh=new Br,Ch=new Br;function Ph(e){if(_n.call(this),this.type=\"Sprite\",void 0===mh){mh=new Gi;var t=new fh(new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),5);mh.setIndex([0,1,2,0,2,3]),mh.setAttribute(\"position\",new gh(t,3,0,!1)),mh.setAttribute(\"uv\",new gh(t,2,3,!1))}this.geometry=mh,this.material=void 0!==e?e:new yh,this.center=new Br(.5,.5)}function Oh(e,t,r,n,i,a){wh.subVectors(e,r).addScalar(.5).multiply(n),void 0!==i?(Mh.x=a*wh.x-i*wh.y,Mh.y=i*wh.x+a*wh.y):Mh.copy(wh),e.copy(t),e.x+=Mh.x,e.y+=Mh.y,e.applyMatrix4(Sh)}Ph.prototype=Object.assign(Object.create(_n.prototype),{constructor:Ph,isSprite:!0,raycast:function(e,t){null===e.camera&&console.error('THREE.Sprite: \"Raycaster.camera\" needs to be set in order to raycast against sprites.'),_h.setFromMatrixScale(this.matrixWorld),Sh.copy(e.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(e.camera.matrixWorldInverse,this.matrixWorld),bh.setFromMatrixPosition(this.modelViewMatrix),e.camera.isPerspectiveCamera&&!1===this.material.sizeAttenuation&&_h.multiplyScalar(-bh.z);var r,n,i=this.material.rotation;0!==i&&(n=Math.cos(i),r=Math.sin(i));var a=this.center;Oh(Th.set(-.5,-.5,0),bh,a,_h,r,n),Oh(Eh.set(.5,-.5,0),bh,a,_h,r,n),Oh(Ah.set(.5,.5,0),bh,a,_h,r,n),Lh.set(0,0),Rh.set(1,0),Ch.set(1,1);var o=e.ray.intersectTriangle(Th,Eh,Ah,!1,xh);if(null!==o||(Oh(Eh.set(-.5,.5,0),bh,a,_h,r,n),Rh.set(0,1),null!==(o=e.ray.intersectTriangle(Th,Ah,Eh,!1,xh)))){var s=e.ray.origin.distanceTo(xh);s<e.near||s>e.far||t.push({distance:s,point:xh.clone(),uv:si.getUV(xh,Th,Eh,Ah,Lh,Rh,Ch,new Br),face:null,object:this})}},clone:function(){return new this.constructor(this.material).copy(this)},copy:function(e){return _n.prototype.copy.call(this,e),void 0!==e.center&&this.center.copy(e.center),this}});var Dh=new Xr,Ih=new Xr;function Nh(){_n.call(this),this._currentLevel=0,this.type=\"LOD\",Object.defineProperties(this,{levels:{enumerable:!0,value:[]}}),this.autoUpdate=!0}function Bh(e,t){e&&e.isGeometry&&console.error(\"THREE.SkinnedMesh no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.\"),na.call(this,e,t),this.type=\"SkinnedMesh\",this.bindMode=\"attached\",this.bindMatrix=new tn,this.bindMatrixInverse=new tn}Nh.prototype=Object.assign(Object.create(_n.prototype),{constructor:Nh,isLOD:!0,copy:function(e){_n.prototype.copy.call(this,e,!1);for(var t=e.levels,r=0,n=t.length;r<n;r++){var i=t[r];this.addLevel(i.object.clone(),i.distance)}return this.autoUpdate=e.autoUpdate,this},addLevel:function(e,t){void 0===t&&(t=0),t=Math.abs(t);for(var r=this.levels,n=0;n<r.length&&!(t<r[n].distance);n++);return r.splice(n,0,{distance:t,object:e}),this.add(e),this},getCurrentLevel:function(){return this._currentLevel},getObjectForDistance:function(e){var t=this.levels;if(t.length>0){for(var r=1,n=t.length;r<n&&!(e<t[r].distance);r++);return t[r-1].object}return null},raycast:function(e,t){if(this.levels.length>0){Dh.setFromMatrixPosition(this.matrixWorld);var r=e.ray.origin.distanceTo(Dh);this.getObjectForDistance(r).raycast(e,t)}},update:function(e){var t=this.levels;if(t.length>1){Dh.setFromMatrixPosition(e.matrixWorld),Ih.setFromMatrixPosition(this.matrixWorld);var r=Dh.distanceTo(Ih)\/e.zoom;t[0].object.visible=!0;for(var n=1,i=t.length;n<i&&r>=t[n].distance;n++)t[n-1].object.visible=!1,t[n].object.visible=!0;for(this._currentLevel=n-1;n<i;n++)t[n].object.visible=!1}},toJSON:function(e){var t=_n.prototype.toJSON.call(this,e);!1===this.autoUpdate&&(t.object.autoUpdate=!1),t.object.levels=[];for(var r=this.levels,n=0,i=r.length;n<i;n++){var a=r[n];t.object.levels.push({object:a.object.uuid,distance:a.distance})}return t}}),Bh.prototype=Object.assign(Object.create(na.prototype),{constructor:Bh,isSkinnedMesh:!0,bind:function(e,t){this.skeleton=e,void 0===t&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),t=this.matrixWorld),this.bindMatrix.copy(t),this.bindMatrixInverse.getInverse(t)},pose:function(){this.skeleton.pose()},normalizeSkinWeights:function(){for(var e=new Hr,t=this.geometry.attributes.skinWeight,r=0,n=t.count;r<n;r++){e.x=t.getX(r),e.y=t.getY(r),e.z=t.getZ(r),e.w=t.getW(r);var i=1\/e.manhattanLength();i!==1\/0?e.multiplyScalar(i):e.set(1,0,0,0),t.setXYZW(r,e.x,e.y,e.z,e.w)}},updateMatrixWorld:function(e){na.prototype.updateMatrixWorld.call(this,e),\"attached\"===this.bindMode?this.bindMatrixInverse.getInverse(this.matrixWorld):\"detached\"===this.bindMode?this.bindMatrixInverse.getInverse(this.bindMatrix):console.warn(\"THREE.SkinnedMesh: Unrecognized bindMode: \"+this.bindMode)},clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}});var Fh=new tn,Uh=new tn;function Gh(e,t){if(e=e||[],this.bones=e.slice(0),this.boneMatrices=new Float32Array(16*this.bones.length),this.frame=-1,void 0===t)this.calculateInverses();else if(this.bones.length===t.length)this.boneInverses=t.slice(0);else{console.warn(\"THREE.Skeleton boneInverses is the wrong length.\"),this.boneInverses=[];for(var r=0,n=this.bones.length;r<n;r++)this.boneInverses.push(new tn)}}function zh(){_n.call(this),this.type=\"Bone\"}Object.assign(Gh.prototype,{calculateInverses:function(){this.boneInverses=[];for(var e=0,t=this.bones.length;e<t;e++){var r=new tn;this.bones[e]&&r.getInverse(this.bones[e].matrixWorld),this.boneInverses.push(r)}},pose:function(){var e,t,r;for(t=0,r=this.bones.length;t<r;t++)(e=this.bones[t])&&e.matrixWorld.getInverse(this.boneInverses[t]);for(t=0,r=this.bones.length;t<r;t++)(e=this.bones[t])&&(e.parent&&e.parent.isBone?(e.matrix.getInverse(e.parent.matrixWorld),e.matrix.multiply(e.matrixWorld)):e.matrix.copy(e.matrixWorld),e.matrix.decompose(e.position,e.quaternion,e.scale))},update:function(){for(var e=this.bones,t=this.boneInverses,r=this.boneMatrices,n=this.boneTexture,i=0,a=e.length;i<a;i++){var o=e[i]?e[i].matrixWorld:Uh;Fh.multiplyMatrices(o,t[i]),Fh.toArray(r,16*i)}void 0!==n&&(n.needsUpdate=!0)},clone:function(){return new Gh(this.bones,this.boneInverses)},getBoneByName:function(e){for(var t=0,r=this.bones.length;t<r;t++){var n=this.bones[t];if(n.name===e)return n}},dispose:function(){this.boneTexture&&(this.boneTexture.dispose(),this.boneTexture=void 0)}}),zh.prototype=Object.assign(Object.create(_n.prototype),{constructor:zh,isBone:!0});var Hh=new tn,Vh=new tn,kh=[],jh=new na;function Wh(e,t,r){na.call(this,e,t),this.instanceMatrix=new _i(new Float32Array(16*r),16),this.count=r,this.frustumCulled=!1}function qh(e){gi.call(this),this.type=\"LineBasicMaterial\",this.color=new ui(16777215),this.linewidth=1,this.linecap=\"round\",this.linejoin=\"round\",this.setValues(e)}Wh.prototype=Object.assign(Object.create(na.prototype),{constructor:Wh,isInstancedMesh:!0,getMatrixAt:function(e,t){t.fromArray(this.instanceMatrix.array,16*e)},raycast:function(e,t){var r=this.matrixWorld,n=this.count;if(jh.geometry=this.geometry,jh.material=this.material,void 0!==jh.material)for(var i=0;i<n;i++)this.getMatrixAt(i,Hh),Vh.multiplyMatrices(r,Hh),jh.matrixWorld=Vh,jh.raycast(e,kh),kh.length>0&&(kh[0].instanceId=i,kh[0].object=this,t.push(kh[0]),kh.length=0)},setMatrixAt:function(e,t){t.toArray(this.instanceMatrix.array,16*e)},updateMorphTargets:function(){}}),qh.prototype=Object.create(gi.prototype),qh.prototype.constructor=qh,qh.prototype.isLineBasicMaterial=!0,qh.prototype.copy=function(e){return gi.prototype.copy.call(this,e),this.color.copy(e.color),this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this};var Xh=new Xr,Yh=new Xr,Zh=new tn,Jh=new qn,Qh=new Un;function Kh(e,t,r){1===r&&console.error(\"THREE.Line: parameter THREE.LinePieces no longer supported. Use THREE.LineSegments instead.\"),_n.call(this),this.type=\"Line\",this.geometry=void 0!==e?e:new Gi,this.material=void 0!==t?t:new qh}Kh.prototype=Object.assign(Object.create(_n.prototype),{constructor:Kh,isLine:!0,computeLineDistances:function(){var e=this.geometry;if(e.isBufferGeometry)if(null===e.index){for(var t=e.attributes.position,r=[0],n=1,i=t.count;n<i;n++)Xh.fromBufferAttribute(t,n-1),Yh.fromBufferAttribute(t,n),r[n]=r[n-1],r[n]+=Xh.distanceTo(Yh);e.setAttribute(\"lineDistance\",new Li(r,1))}else console.warn(\"THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.\");else if(e.isGeometry){var a=e.vertices;(r=e.lineDistances)[0]=0;for(n=1,i=a.length;n<i;n++)r[n]=r[n-1],r[n]+=a[n-1].distanceTo(a[n])}return this},raycast:function(e,t){var r=this.geometry,n=this.matrixWorld,i=e.params.Line.threshold;if(null===r.boundingSphere&&r.computeBoundingSphere(),Qh.copy(r.boundingSphere),Qh.applyMatrix4(n),Qh.radius+=i,!1!==e.ray.intersectsSphere(Qh)){Zh.getInverse(n),Jh.copy(e.ray).applyMatrix4(Zh);var a=i\/((this.scale.x+this.scale.y+this.scale.z)\/3),o=a*a,s=new Xr,c=new Xr,l=new Xr,h=new Xr,u=this&&this.isLineSegments?2:1;if(r.isBufferGeometry){var p=r.index,d=r.attributes.position.array;if(null!==p)for(var f=p.array,m=0,v=f.length-1;m<v;m+=u){var g=f[m],y=f[m+1];if(s.fromArray(d,3*g),c.fromArray(d,3*y),!(Jh.distanceSqToSegment(s,c,h,l)>o))h.applyMatrix4(this.matrixWorld),(b=e.ray.origin.distanceTo(h))<e.near||b>e.far||t.push({distance:b,point:l.clone().applyMatrix4(this.matrixWorld),index:m,face:null,faceIndex:null,object:this})}else for(m=0,v=d.length\/3-1;m<v;m+=u){if(s.fromArray(d,3*m),c.fromArray(d,3*m+3),!(Jh.distanceSqToSegment(s,c,h,l)>o))h.applyMatrix4(this.matrixWorld),(b=e.ray.origin.distanceTo(h))<e.near||b>e.far||t.push({distance:b,point:l.clone().applyMatrix4(this.matrixWorld),index:m,face:null,faceIndex:null,object:this})}}else if(r.isGeometry){var x=r.vertices,_=x.length;for(m=0;m<_-1;m+=u){var b;if(!(Jh.distanceSqToSegment(x[m],x[m+1],h,l)>o))h.applyMatrix4(this.matrixWorld),(b=e.ray.origin.distanceTo(h))<e.near||b>e.far||t.push({distance:b,point:l.clone().applyMatrix4(this.matrixWorld),index:m,face:null,faceIndex:null,object:this})}}}},clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}});var $h=new Xr,eu=new Xr;function tu(e,t){Kh.call(this,e,t),this.type=\"LineSegments\"}function ru(e,t){Kh.call(this,e,t),this.type=\"LineLoop\"}function nu(e){gi.call(this),this.type=\"PointsMaterial\",this.color=new ui(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.morphTargets=!1,this.setValues(e)}tu.prototype=Object.assign(Object.create(Kh.prototype),{constructor:tu,isLineSegments:!0,computeLineDistances:function(){var e=this.geometry;if(e.isBufferGeometry)if(null===e.index){for(var t=e.attributes.position,r=[],n=0,i=t.count;n<i;n+=2)$h.fromBufferAttribute(t,n),eu.fromBufferAttribute(t,n+1),r[n]=0===n?0:r[n-1],r[n+1]=r[n]+$h.distanceTo(eu);e.setAttribute(\"lineDistance\",new Li(r,1))}else console.warn(\"THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.\");else if(e.isGeometry){var a=e.vertices;for(r=e.lineDistances,n=0,i=a.length;n<i;n+=2)$h.copy(a[n]),eu.copy(a[n+1]),r[n]=0===n?0:r[n-1],r[n+1]=r[n]+$h.distanceTo(eu)}return this}}),ru.prototype=Object.assign(Object.create(Kh.prototype),{constructor:ru,isLineLoop:!0}),nu.prototype=Object.create(gi.prototype),nu.prototype.constructor=nu,nu.prototype.isPointsMaterial=!0,nu.prototype.copy=function(e){return gi.prototype.copy.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.morphTargets=e.morphTargets,this};var iu=new tn,au=new qn,ou=new Un,su=new Xr;function cu(e,t){_n.call(this),this.type=\"Points\",this.geometry=void 0!==e?e:new Gi,this.material=void 0!==t?t:new nu,this.updateMorphTargets()}function lu(e,t,r,n,i,a,o){var s=au.distanceSqToPoint(e);if(s<r){var c=new Xr;au.closestPointToPoint(e,c),c.applyMatrix4(n);var l=i.ray.origin.distanceTo(c);if(l<i.near||l>i.far)return;a.push({distance:l,distanceToRay:Math.sqrt(s),point:c,index:t,face:null,object:o})}}function hu(e,t,r,n,i,a,o,s,c){zr.call(this,e,t,r,n,i,a,o,s,c),this.format=void 0!==o?o:Fe,this.minFilter=void 0!==a?a:xe,this.magFilter=void 0!==i?i:xe,this.generateMipmaps=!1}function uu(e,t,r,n,i,a,o,s,c,l,h,u){zr.call(this,null,a,o,s,c,l,n,i,h,u),this.image={width:t,height:r},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}function pu(e,t,r,n,i,a,o,s,c){zr.call(this,e,t,r,n,i,a,o,s,c),this.needsUpdate=!0}function du(e,t,r,n,i,a,o,s,c,l){if((l=void 0!==l?l:Ve)!==Ve&&l!==ke)throw new Error(\"DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat\");void 0===r&&l===Ve&&(r=Ae),void 0===r&&l===ke&&(r=Ne),zr.call(this,null,n,i,a,o,s,l,r,c),this.image={width:e,height:t},this.magFilter=void 0!==o?o:fe,this.minFilter=void 0!==s?s:fe,this.flipY=!1,this.generateMipmaps=!1}function fu(e){Gi.call(this),this.type=\"WireframeGeometry\";var t,r,n,i,a,o,s,c,l,h,u=[],p=[0,0],d={},f=[\"a\",\"b\",\"c\"];if(e&&e.isGeometry){var m=e.faces;for(t=0,n=m.length;t<n;t++){var v=m[t];for(r=0;r<3;r++)s=v[f[r]],c=v[f[(r+1)%3]],p[0]=Math.min(s,c),p[1]=Math.max(s,c),void 0===d[l=p[0]+\",\"+p[1]]&&(d[l]={index1:p[0],index2:p[1]})}for(l in d)o=d[l],h=e.vertices[o.index1],u.push(h.x,h.y,h.z),h=e.vertices[o.index2],u.push(h.x,h.y,h.z)}else if(e&&e.isBufferGeometry){var g,y,x,_,b,w,M;if(h=new Xr,null!==e.index){for(g=e.attributes.position,y=e.index,0===(x=e.groups).length&&(x=[{start:0,count:y.count,materialIndex:0}]),i=0,a=x.length;i<a;++i)for(t=b=(_=x[i]).start,n=b+_.count;t<n;t+=3)for(r=0;r<3;r++)s=y.getX(t+r),c=y.getX(t+(r+1)%3),p[0]=Math.min(s,c),p[1]=Math.max(s,c),void 0===d[l=p[0]+\",\"+p[1]]&&(d[l]={index1:p[0],index2:p[1]});for(l in d)o=d[l],h.fromBufferAttribute(g,o.index1),u.push(h.x,h.y,h.z),h.fromBufferAttribute(g,o.index2),u.push(h.x,h.y,h.z)}else for(t=0,n=(g=e.attributes.position).count\/3;t<n;t++)for(r=0;r<3;r++)w=3*t+r,h.fromBufferAttribute(g,w),u.push(h.x,h.y,h.z),M=3*t+(r+1)%3,h.fromBufferAttribute(g,M),u.push(h.x,h.y,h.z)}this.setAttribute(\"position\",new Li(u,3))}function mu(e,t,r){ha.call(this),this.type=\"ParametricGeometry\",this.parameters={func:e,slices:t,stacks:r},this.fromBufferGeometry(new vu(e,t,r)),this.mergeVertices()}function vu(e,t,r){Gi.call(this),this.type=\"ParametricBufferGeometry\",this.parameters={func:e,slices:t,stacks:r};var n,i,a=[],o=[],s=[],c=[],l=new Xr,h=new Xr,u=new Xr,p=new Xr,d=new Xr;e.length<3&&console.error(\"THREE.ParametricGeometry: Function must now modify a Vector3 as third parameter.\");var f=t+1;for(n=0;n<=r;n++){var m=n\/r;for(i=0;i<=t;i++){var v=i\/t;e(v,m,h),o.push(h.x,h.y,h.z),v-1e-5>=0?(e(v-1e-5,m,u),p.subVectors(h,u)):(e(v+1e-5,m,u),p.subVectors(u,h)),m-1e-5>=0?(e(v,m-1e-5,u),d.subVectors(h,u)):(e(v,m+1e-5,u),d.subVectors(u,h)),l.crossVectors(p,d).normalize(),s.push(l.x,l.y,l.z),c.push(v,m)}}for(n=0;n<r;n++)for(i=0;i<t;i++){var g=n*f+i,y=n*f+i+1,x=(n+1)*f+i+1,_=(n+1)*f+i;a.push(g,y,_),a.push(y,x,_)}this.setIndex(a),this.setAttribute(\"position\",new Li(o,3)),this.setAttribute(\"normal\",new Li(s,3)),this.setAttribute(\"uv\",new Li(c,2))}function gu(e,t,r,n){ha.call(this),this.type=\"PolyhedronGeometry\",this.parameters={vertices:e,indices:t,radius:r,detail:n},this.fromBufferGeometry(new yu(e,t,r,n)),this.mergeVertices()}function yu(e,t,r,n){Gi.call(this),this.type=\"PolyhedronBufferGeometry\",this.parameters={vertices:e,indices:t,radius:r,detail:n},r=r||1;var i=[],a=[];function o(e,t,r,n){var i,a,o=Math.pow(2,n),c=[];for(i=0;i<=o;i++){c[i]=[];var l=e.clone().lerp(r,i\/o),h=t.clone().lerp(r,i\/o),u=o-i;for(a=0;a<=u;a++)c[i][a]=0===a&&i===o?l:l.clone().lerp(h,a\/u)}for(i=0;i<o;i++)for(a=0;a<2*(o-i)-1;a++){var p=Math.floor(a\/2);a%2==0?(s(c[i][p+1]),s(c[i+1][p]),s(c[i][p])):(s(c[i][p+1]),s(c[i+1][p+1]),s(c[i+1][p]))}}function s(e){i.push(e.x,e.y,e.z)}function c(t,r){var n=3*t;r.x=e[n+0],r.y=e[n+1],r.z=e[n+2]}function l(e,t,r,n){n<0&&1===e.x&&(a[t]=e.x-1),0===r.x&&0===r.z&&(a[t]=n\/2\/Math.PI+.5)}function h(e){return Math.atan2(e.z,-e.x)}!function(e){for(var r=new Xr,n=new Xr,i=new Xr,a=0;a<t.length;a+=3)c(t[a+0],r),c(t[a+1],n),c(t[a+2],i),o(r,n,i,e)}(n=n||0),function(e){for(var t=new Xr,r=0;r<i.length;r+=3)t.x=i[r+0],t.y=i[r+1],t.z=i[r+2],t.normalize().multiplyScalar(e),i[r+0]=t.x,i[r+1]=t.y,i[r+2]=t.z}(r),function(){for(var e=new Xr,t=0;t<i.length;t+=3){e.x=i[t+0],e.y=i[t+1],e.z=i[t+2];var r=h(e)\/2\/Math.PI+.5,n=(o=e,Math.atan2(-o.y,Math.sqrt(o.x*o.x+o.z*o.z))\/Math.PI+.5);a.push(r,1-n)}var o;(function(){for(var e=new Xr,t=new Xr,r=new Xr,n=new Xr,o=new Br,s=new Br,c=new Br,u=0,p=0;u<i.length;u+=9,p+=6){e.set(i[u+0],i[u+1],i[u+2]),t.set(i[u+3],i[u+4],i[u+5]),r.set(i[u+6],i[u+7],i[u+8]),o.set(a[p+0],a[p+1]),s.set(a[p+2],a[p+3]),c.set(a[p+4],a[p+5]),n.copy(e).add(t).add(r).divideScalar(3);var d=h(n);l(o,p+0,e,d),l(s,p+2,t,d),l(c,p+4,r,d)}})(),function(){for(var e=0;e<a.length;e+=6){var t=a[e+0],r=a[e+2],n=a[e+4],i=Math.max(t,r,n),o=Math.min(t,r,n);i>.9&&o<.1&&(t<.2&&(a[e+0]+=1),r<.2&&(a[e+2]+=1),n<.2&&(a[e+4]+=1))}}()}(),this.setAttribute(\"position\",new Li(i,3)),this.setAttribute(\"normal\",new Li(i.slice(),3)),this.setAttribute(\"uv\",new Li(a,2)),0===n?this.computeVertexNormals():this.normalizeNormals()}function xu(e,t){ha.call(this),this.type=\"TetrahedronGeometry\",this.parameters={radius:e,detail:t},this.fromBufferGeometry(new _u(e,t)),this.mergeVertices()}function _u(e,t){yu.call(this,[1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],[2,1,0,0,3,2,1,3,0,2,3,1],e,t),this.type=\"TetrahedronBufferGeometry\",this.parameters={radius:e,detail:t}}function bu(e,t){ha.call(this),this.type=\"OctahedronGeometry\",this.parameters={radius:e,detail:t},this.fromBufferGeometry(new wu(e,t)),this.mergeVertices()}function wu(e,t){yu.call(this,[1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2],e,t),this.type=\"OctahedronBufferGeometry\",this.parameters={radius:e,detail:t}}function Mu(e,t){ha.call(this),this.type=\"IcosahedronGeometry\",this.parameters={radius:e,detail:t},this.fromBufferGeometry(new Su(e,t)),this.mergeVertices()}function Su(e,t){var r=(1+Math.sqrt(5))\/2,n=[-1,r,0,1,r,0,-1,-r,0,1,-r,0,0,-1,r,0,1,r,0,-1,-r,0,1,-r,r,0,-1,r,0,1,-r,0,-1,-r,0,1];yu.call(this,n,[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],e,t),this.type=\"IcosahedronBufferGeometry\",this.parameters={radius:e,detail:t}}function Tu(e,t){ha.call(this),this.type=\"DodecahedronGeometry\",this.parameters={radius:e,detail:t},this.fromBufferGeometry(new Eu(e,t)),this.mergeVertices()}function Eu(e,t){var r=(1+Math.sqrt(5))\/2,n=1\/r,i=[-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,-n,-r,0,-n,r,0,n,-r,0,n,r,-n,-r,0,-n,r,0,n,-r,0,n,r,0,-r,0,-n,r,0,-n,-r,0,n,r,0,n];yu.call(this,i,[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],e,t),this.type=\"DodecahedronBufferGeometry\",this.parameters={radius:e,detail:t}}function Au(e,t,r,n,i,a){ha.call(this),this.type=\"TubeGeometry\",this.parameters={path:e,tubularSegments:t,radius:r,radialSegments:n,closed:i},void 0!==a&&console.warn(\"THREE.TubeGeometry: taper has been removed.\");var o=new Lu(e,t,r,n,i);this.tangents=o.tangents,this.normals=o.normals,this.binormals=o.binormals,this.fromBufferGeometry(o),this.mergeVertices()}function Lu(e,t,r,n,i){Gi.call(this),this.type=\"TubeBufferGeometry\",this.parameters={path:e,tubularSegments:t,radius:r,radialSegments:n,closed:i},t=t||64,r=r||1,n=n||8,i=i||!1;var a=e.computeFrenetFrames(t,i);this.tangents=a.tangents,this.normals=a.normals,this.binormals=a.binormals;var o,s,c=new Xr,l=new Xr,h=new Br,u=new Xr,p=[],d=[],f=[],m=[];function v(i){u=e.getPointAt(i\/t,u);var o=a.normals[i],h=a.binormals[i];for(s=0;s<=n;s++){var f=s\/n*Math.PI*2,m=Math.sin(f),v=-Math.cos(f);l.x=v*o.x+m*h.x,l.y=v*o.y+m*h.y,l.z=v*o.z+m*h.z,l.normalize(),d.push(l.x,l.y,l.z),c.x=u.x+r*l.x,c.y=u.y+r*l.y,c.z=u.z+r*l.z,p.push(c.x,c.y,c.z)}}!function(){for(o=0;o<t;o++)v(o);v(!1===i?t:0),function(){for(o=0;o<=t;o++)for(s=0;s<=n;s++)h.x=o\/t,h.y=s\/n,f.push(h.x,h.y)}(),function(){for(s=1;s<=t;s++)for(o=1;o<=n;o++){var e=(n+1)*(s-1)+(o-1),r=(n+1)*s+(o-1),i=(n+1)*s+o,a=(n+1)*(s-1)+o;m.push(e,r,a),m.push(r,i,a)}}()}(),this.setIndex(m),this.setAttribute(\"position\",new Li(p,3)),this.setAttribute(\"normal\",new Li(d,3)),this.setAttribute(\"uv\",new Li(f,2))}function Ru(e,t,r,n,i,a,o){ha.call(this),this.type=\"TorusKnotGeometry\",this.parameters={radius:e,tube:t,tubularSegments:r,radialSegments:n,p:i,q:a},void 0!==o&&console.warn(\"THREE.TorusKnotGeometry: heightScale has been deprecated. Use .scale( x, y, z ) instead.\"),this.fromBufferGeometry(new Cu(e,t,r,n,i,a)),this.mergeVertices()}function Cu(e,t,r,n,i,a){Gi.call(this),this.type=\"TorusKnotBufferGeometry\",this.parameters={radius:e,tube:t,tubularSegments:r,radialSegments:n,p:i,q:a},e=e||1,t=t||.4,r=Math.floor(r)||64,n=Math.floor(n)||8,i=i||2,a=a||3;var o,s,c=[],l=[],h=[],u=[],p=new Xr,d=new Xr,f=new Xr,m=new Xr,v=new Xr,g=new Xr,y=new Xr;for(o=0;o<=r;++o){var x=o\/r*i*Math.PI*2;for(A(x,i,a,e,f),A(x+.01,i,a,e,m),g.subVectors(m,f),y.addVectors(m,f),v.crossVectors(g,y),y.crossVectors(v,g),v.normalize(),y.normalize(),s=0;s<=n;++s){var _=s\/n*Math.PI*2,b=-t*Math.cos(_),w=t*Math.sin(_);p.x=f.x+(b*y.x+w*v.x),p.y=f.y+(b*y.y+w*v.y),p.z=f.z+(b*y.z+w*v.z),l.push(p.x,p.y,p.z),d.subVectors(p,f).normalize(),h.push(d.x,d.y,d.z),u.push(o\/r),u.push(s\/n)}}for(s=1;s<=r;s++)for(o=1;o<=n;o++){var M=(n+1)*(s-1)+(o-1),S=(n+1)*s+(o-1),T=(n+1)*s+o,E=(n+1)*(s-1)+o;c.push(M,S,E),c.push(S,T,E)}function A(e,t,r,n,i){var a=Math.cos(e),o=Math.sin(e),s=r\/t*e,c=Math.cos(s);i.x=n*(2+c)*.5*a,i.y=n*(2+c)*o*.5,i.z=n*Math.sin(s)*.5}this.setIndex(c),this.setAttribute(\"position\",new Li(l,3)),this.setAttribute(\"normal\",new Li(h,3)),this.setAttribute(\"uv\",new Li(u,2))}function Pu(e,t,r,n,i){ha.call(this),this.type=\"TorusGeometry\",this.parameters={radius:e,tube:t,radialSegments:r,tubularSegments:n,arc:i},this.fromBufferGeometry(new Ou(e,t,r,n,i)),this.mergeVertices()}function Ou(e,t,r,n,i){Gi.call(this),this.type=\"TorusBufferGeometry\",this.parameters={radius:e,tube:t,radialSegments:r,tubularSegments:n,arc:i},e=e||1,t=t||.4,r=Math.floor(r)||8,n=Math.floor(n)||6,i=i||2*Math.PI;var a,o,s=[],c=[],l=[],h=[],u=new Xr,p=new Xr,d=new Xr;for(a=0;a<=r;a++)for(o=0;o<=n;o++){var f=o\/n*i,m=a\/r*Math.PI*2;p.x=(e+t*Math.cos(m))*Math.cos(f),p.y=(e+t*Math.cos(m))*Math.sin(f),p.z=t*Math.sin(m),c.push(p.x,p.y,p.z),u.x=e*Math.cos(f),u.y=e*Math.sin(f),d.subVectors(p,u).normalize(),l.push(d.x,d.y,d.z),h.push(o\/n),h.push(a\/r)}for(a=1;a<=r;a++)for(o=1;o<=n;o++){var v=(n+1)*a+o-1,g=(n+1)*(a-1)+o-1,y=(n+1)*(a-1)+o,x=(n+1)*a+o;s.push(v,g,x),s.push(g,y,x)}this.setIndex(s),this.setAttribute(\"position\",new Li(c,3)),this.setAttribute(\"normal\",new Li(l,3)),this.setAttribute(\"uv\",new Li(h,2))}cu.prototype=Object.assign(Object.create(_n.prototype),{constructor:cu,isPoints:!0,raycast:function(e,t){var r=this.geometry,n=this.matrixWorld,i=e.params.Points.threshold;if(null===r.boundingSphere&&r.computeBoundingSphere(),ou.copy(r.boundingSphere),ou.applyMatrix4(n),ou.radius+=i,!1!==e.ray.intersectsSphere(ou)){iu.getInverse(n),au.copy(e.ray).applyMatrix4(iu);var a=i\/((this.scale.x+this.scale.y+this.scale.z)\/3),o=a*a;if(r.isBufferGeometry){var s=r.index,c=r.attributes.position.array;if(null!==s)for(var l=s.array,h=0,u=l.length;h<u;h++){var p=l[h];su.fromArray(c,3*p),lu(su,p,o,n,e,t,this)}else{h=0;for(var d=c.length\/3;h<d;h++)su.fromArray(c,3*h),lu(su,h,o,n,e,t,this)}}else{var f=r.vertices;for(h=0,d=f.length;h<d;h++)lu(f[h],h,o,n,e,t,this)}}},updateMorphTargets:function(){var e,t,r,n=this.geometry;if(n.isBufferGeometry){var i=n.morphAttributes,a=Object.keys(i);if(a.length>0){var o=i[a[0]];if(void 0!==o)for(this.morphTargetInfluences=[],this.morphTargetDictionary={},e=0,t=o.length;e<t;e++)r=o[e].name||String(e),this.morphTargetInfluences.push(0),this.morphTargetDictionary[r]=e}}else{var s=n.morphTargets;void 0!==s&&s.length>0&&console.error(\"THREE.Points.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.\")}},clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}}),hu.prototype=Object.assign(Object.create(zr.prototype),{constructor:hu,isVideoTexture:!0,update:function(){var e=this.image;e.readyState>=e.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}}),uu.prototype=Object.create(zr.prototype),uu.prototype.constructor=uu,uu.prototype.isCompressedTexture=!0,pu.prototype=Object.create(zr.prototype),pu.prototype.constructor=pu,pu.prototype.isCanvasTexture=!0,du.prototype=Object.create(zr.prototype),du.prototype.constructor=du,du.prototype.isDepthTexture=!0,fu.prototype=Object.create(Gi.prototype),fu.prototype.constructor=fu,mu.prototype=Object.create(ha.prototype),mu.prototype.constructor=mu,vu.prototype=Object.create(Gi.prototype),vu.prototype.constructor=vu,gu.prototype=Object.create(ha.prototype),gu.prototype.constructor=gu,yu.prototype=Object.create(Gi.prototype),yu.prototype.constructor=yu,xu.prototype=Object.create(ha.prototype),xu.prototype.constructor=xu,_u.prototype=Object.create(yu.prototype),_u.prototype.constructor=_u,bu.prototype=Object.create(ha.prototype),bu.prototype.constructor=bu,wu.prototype=Object.create(yu.prototype),wu.prototype.constructor=wu,Mu.prototype=Object.create(ha.prototype),Mu.prototype.constructor=Mu,Su.prototype=Object.create(yu.prototype),Su.prototype.constructor=Su,Tu.prototype=Object.create(ha.prototype),Tu.prototype.constructor=Tu,Eu.prototype=Object.create(yu.prototype),Eu.prototype.constructor=Eu,Au.prototype=Object.create(ha.prototype),Au.prototype.constructor=Au,Lu.prototype=Object.create(Gi.prototype),Lu.prototype.constructor=Lu,Lu.prototype.toJSON=function(){var e=Gi.prototype.toJSON.call(this);return e.path=this.parameters.path.toJSON(),e},Ru.prototype=Object.create(ha.prototype),Ru.prototype.constructor=Ru,Cu.prototype=Object.create(Gi.prototype),Cu.prototype.constructor=Cu,Pu.prototype=Object.create(ha.prototype),Pu.prototype.constructor=Pu,Ou.prototype=Object.create(Gi.prototype),Ou.prototype.constructor=Ou;var Du={triangulate:function(e,t,r){r=r||2;var n,i,a,o,s,c,l,h=t&&t.length,u=h?t[0]*r:e.length,p=Iu(e,0,u,r,!0),d=[];if(!p||p.next===p.prev)return d;if(h&&(p=Hu(e,t,p,r)),e.length>80*r){n=a=e[0],i=o=e[1];for(var f=r;f<u;f+=r)(s=e[f])<n&&(n=s),(c=e[f+1])<i&&(i=c),s>a&&(a=s),c>o&&(o=c);l=0!==(l=Math.max(a-n,o-i))?1\/l:0}return Bu(p,d,r,n,i,l),d}};function Iu(e,t,r,n,i){var a,o;if(i===sp(e,t,r,n)>0)for(a=t;a<r;a+=n)o=ip(a,e[a],e[a+1],o);else for(a=r-n;a>=t;a-=n)o=ip(a,e[a],e[a+1],o);return o&&Ku(o,o.next)&&(ap(o),o=o.next),o}function Nu(e,t){if(!e)return e;t||(t=e);var r,n=e;do{if(r=!1,n.steiner||!Ku(n,n.next)&&0!==Qu(n.prev,n,n.next))n=n.next;else{if(ap(n),(n=t=n.prev)===n.next)break;r=!0}}while(r||n!==t);return t}function Bu(e,t,r,n,i,a,o){if(e){!o&&a&&Wu(e,n,i,a);for(var s,c,l=e;e.prev!==e.next;)if(s=e.prev,c=e.next,a?Uu(e,n,i,a):Fu(e))t.push(s.i\/r),t.push(e.i\/r),t.push(c.i\/r),ap(e),e=c.next,l=c.next;else if((e=c)===l){o?1===o?Bu(e=Gu(e,t,r),t,r,n,i,a,2):2===o&&zu(e,t,r,n,i,a):Bu(Nu(e),t,r,n,i,a,1);break}}}function Fu(e){var t=e.prev,r=e,n=e.next;if(Qu(t,r,n)>=0)return!1;for(var i=e.next.next;i!==e.prev;){if(Zu(t.x,t.y,r.x,r.y,n.x,n.y,i.x,i.y)&&Qu(i.prev,i,i.next)>=0)return!1;i=i.next}return!0}function Uu(e,t,r,n){var i=e.prev,a=e,o=e.next;if(Qu(i,a,o)>=0)return!1;for(var s=i.x<a.x?i.x<o.x?i.x:o.x:a.x<o.x?a.x:o.x,c=i.y<a.y?i.y<o.y?i.y:o.y:a.y<o.y?a.y:o.y,l=i.x>a.x?i.x>o.x?i.x:o.x:a.x>o.x?a.x:o.x,h=i.y>a.y?i.y>o.y?i.y:o.y:a.y>o.y?a.y:o.y,u=Xu(s,c,t,r,n),p=Xu(l,h,t,r,n),d=e.prevZ,f=e.nextZ;d&&d.z>=u&&f&&f.z<=p;){if(d!==e.prev&&d!==e.next&&Zu(i.x,i.y,a.x,a.y,o.x,o.y,d.x,d.y)&&Qu(d.prev,d,d.next)>=0)return!1;if(d=d.prevZ,f!==e.prev&&f!==e.next&&Zu(i.x,i.y,a.x,a.y,o.x,o.y,f.x,f.y)&&Qu(f.prev,f,f.next)>=0)return!1;f=f.nextZ}for(;d&&d.z>=u;){if(d!==e.prev&&d!==e.next&&Zu(i.x,i.y,a.x,a.y,o.x,o.y,d.x,d.y)&&Qu(d.prev,d,d.next)>=0)return!1;d=d.prevZ}for(;f&&f.z<=p;){if(f!==e.prev&&f!==e.next&&Zu(i.x,i.y,a.x,a.y,o.x,o.y,f.x,f.y)&&Qu(f.prev,f,f.next)>=0)return!1;f=f.nextZ}return!0}function Gu(e,t,r){var n=e;do{var i=n.prev,a=n.next.next;!Ku(i,a)&&$u(i,n,n.next,a)&&tp(i,a)&&tp(a,i)&&(t.push(i.i\/r),t.push(n.i\/r),t.push(a.i\/r),ap(n),ap(n.next),n=e=a),n=n.next}while(n!==e);return n}function zu(e,t,r,n,i,a){var o=e;do{for(var s=o.next.next;s!==o.prev;){if(o.i!==s.i&&Ju(o,s)){var c=np(o,s);return o=Nu(o,o.next),c=Nu(c,c.next),Bu(o,t,r,n,i,a),void Bu(c,t,r,n,i,a)}s=s.next}o=o.next}while(o!==e)}function Hu(e,t,r,n){var i,a,o,s=[];for(i=0,a=t.length;i<a;i++)(o=Iu(e,t[i]*n,i<a-1?t[i+1]*n:e.length,n,!1))===o.next&&(o.steiner=!0),s.push(Yu(o));for(s.sort(Vu),i=0;i<s.length;i++)ku(s[i],r),r=Nu(r,r.next);return r}function Vu(e,t){return e.x-t.x}function ku(e,t){if(t=ju(e,t)){var r=np(t,e);Nu(r,r.next)}}function ju(e,t){var r,n=t,i=e.x,a=e.y,o=-1\/0;do{if(a<=n.y&&a>=n.next.y&&n.next.y!==n.y){var s=n.x+(a-n.y)*(n.next.x-n.x)\/(n.next.y-n.y);if(s<=i&&s>o){if(o=s,s===i){if(a===n.y)return n;if(a===n.next.y)return n.next}r=n.x<n.next.x?n:n.next}}n=n.next}while(n!==t);if(!r)return null;if(i===o)return r.prev;var c,l=r,h=r.x,u=r.y,p=1\/0;for(n=r.next;n!==l;)i>=n.x&&n.x>=h&&i!==n.x&&Zu(a<u?i:o,a,h,u,a<u?o:i,a,n.x,n.y)&&((c=Math.abs(a-n.y)\/(i-n.x))<p||c===p&&n.x>r.x)&&tp(n,e)&&(r=n,p=c),n=n.next;return r}function Wu(e,t,r,n){var i=e;do{null===i.z&&(i.z=Xu(i.x,i.y,t,r,n)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next}while(i!==e);i.prevZ.nextZ=null,i.prevZ=null,qu(i)}function qu(e){var t,r,n,i,a,o,s,c,l=1;do{for(r=e,e=null,a=null,o=0;r;){for(o++,n=r,s=0,t=0;t<l&&(s++,n=n.nextZ);t++);for(c=l;s>0||c>0&&n;)0!==s&&(0===c||!n||r.z<=n.z)?(i=r,r=r.nextZ,s--):(i=n,n=n.nextZ,c--),a?a.nextZ=i:e=i,i.prevZ=a,a=i;r=n}a.nextZ=null,l*=2}while(o>1);return e}function Xu(e,t,r,n,i){return(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-r)*i)|e<<8))|e<<4))|e<<2))|e<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-n)*i)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function Yu(e){var t=e,r=e;do{(t.x<r.x||t.x===r.x&&t.y<r.y)&&(r=t),t=t.next}while(t!==e);return r}function Zu(e,t,r,n,i,a,o,s){return(i-o)*(t-s)-(e-o)*(a-s)>=0&&(e-o)*(n-s)-(r-o)*(t-s)>=0&&(r-o)*(a-s)-(i-o)*(n-s)>=0}function Ju(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!ep(e,t)&&tp(e,t)&&tp(t,e)&&rp(e,t)}function Qu(e,t,r){return(t.y-e.y)*(r.x-t.x)-(t.x-e.x)*(r.y-t.y)}function Ku(e,t){return e.x===t.x&&e.y===t.y}function $u(e,t,r,n){return!!(Ku(e,r)&&Ku(t,n)||Ku(e,n)&&Ku(r,t))||Qu(e,t,r)>0!=Qu(e,t,n)>0&&Qu(r,n,e)>0!=Qu(r,n,t)>0}function ep(e,t){var r=e;do{if(r.i!==e.i&&r.next.i!==e.i&&r.i!==t.i&&r.next.i!==t.i&&$u(r,r.next,e,t))return!0;r=r.next}while(r!==e);return!1}function tp(e,t){return Qu(e.prev,e,e.next)<0?Qu(e,t,e.next)>=0&&Qu(e,e.prev,t)>=0:Qu(e,t,e.prev)<0||Qu(e,e.next,t)<0}function rp(e,t){var r=e,n=!1,i=(e.x+t.x)\/2,a=(e.y+t.y)\/2;do{r.y>a!=r.next.y>a&&r.next.y!==r.y&&i<(r.next.x-r.x)*(a-r.y)\/(r.next.y-r.y)+r.x&&(n=!n),r=r.next}while(r!==e);return n}function np(e,t){var r=new op(e.i,e.x,e.y),n=new op(t.i,t.x,t.y),i=e.next,a=t.prev;return e.next=t,t.prev=e,r.next=i,i.prev=r,n.next=r,r.prev=n,a.next=n,n.prev=a,n}function ip(e,t,r,n){var i=new op(e,t,r);return n?(i.next=n.next,i.prev=n,n.next.prev=i,n.next=i):(i.prev=i,i.next=i),i}function ap(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 op(e,t,r){this.i=e,this.x=t,this.y=r,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}function sp(e,t,r,n){for(var i=0,a=t,o=r-n;a<r;a+=n)i+=(e[o]-e[a])*(e[a+1]+e[o+1]),o=a;return i}var cp={area:function(e){for(var t=e.length,r=0,n=t-1,i=0;i<t;n=i++)r+=e[n].x*e[i].y-e[i].x*e[n].y;return.5*r},isClockWise:function(e){return cp.area(e)<0},triangulateShape:function(e,t){var r=[],n=[],i=[];lp(e),hp(r,e);var a=e.length;t.forEach(lp);for(var o=0;o<t.length;o++)n.push(a),a+=t[o].length,hp(r,t[o]);var s=Du.triangulate(r,n);for(o=0;o<s.length;o+=3)i.push(s.slice(o,o+3));return i}};function lp(e){var t=e.length;t>2&&e[t-1].equals(e[0])&&e.pop()}function hp(e,t){for(var r=0;r<t.length;r++)e.push(t[r].x),e.push(t[r].y)}function up(e,t){ha.call(this),this.type=\"ExtrudeGeometry\",this.parameters={shapes:e,options:t},this.fromBufferGeometry(new pp(e,t)),this.mergeVertices()}function pp(e,t){Gi.call(this),this.type=\"ExtrudeBufferGeometry\",this.parameters={shapes:e,options:t},e=Array.isArray(e)?e:[e];for(var r=this,n=[],i=[],a=0,o=e.length;a<o;a++){s(e[a])}function s(e){var a=[],o=void 0!==t.curveSegments?t.curveSegments:12,s=void 0!==t.steps?t.steps:1,c=void 0!==t.depth?t.depth:100,l=void 0===t.bevelEnabled||t.bevelEnabled,h=void 0!==t.bevelThickness?t.bevelThickness:6,u=void 0!==t.bevelSize?t.bevelSize:h-2,p=void 0!==t.bevelOffset?t.bevelOffset:0,d=void 0!==t.bevelSegments?t.bevelSegments:3,f=t.extrudePath,m=void 0!==t.UVGenerator?t.UVGenerator:dp;void 0!==t.amount&&(console.warn(\"THREE.ExtrudeBufferGeometry: amount has been renamed to depth.\"),c=t.amount);var v,g,y,x,_,b,w,M,S=!1;f&&(v=f.getSpacedPoints(s),S=!0,l=!1,g=f.computeFrenetFrames(s,!1),y=new Xr,x=new Xr,_=new Xr),l||(d=0,h=0,u=0,p=0);var T=e.extractPoints(o),E=T.shape,A=T.holes;if(!cp.isClockWise(E))for(E=E.reverse(),w=0,M=A.length;w<M;w++)b=A[w],cp.isClockWise(b)&&(A[w]=b.reverse());var L=cp.triangulateShape(E,A),R=E;for(w=0,M=A.length;w<M;w++)b=A[w],E=E.concat(b);function C(e,t,r){return t||console.error(\"THREE.ExtrudeGeometry: vec does not exist\"),t.clone().multiplyScalar(r).add(e)}var P,O,D,I,N,B,F=E.length,U=L.length;function G(e,t,r){var n,i,a,o=e.x-t.x,s=e.y-t.y,c=r.x-e.x,l=r.y-e.y,h=o*o+s*s,u=o*l-s*c;if(Math.abs(u)>Number.EPSILON){var p=Math.sqrt(h),d=Math.sqrt(c*c+l*l),f=t.x-s\/p,m=t.y+o\/p,v=((r.x-l\/d-f)*l-(r.y+c\/d-m)*c)\/(o*l-s*c),g=(n=f+o*v-e.x)*n+(i=m+s*v-e.y)*i;if(g<=2)return new Br(n,i);a=Math.sqrt(g\/2)}else{var y=!1;o>Number.EPSILON?c>Number.EPSILON&&(y=!0):o<-Number.EPSILON?c<-Number.EPSILON&&(y=!0):Math.sign(s)===Math.sign(l)&&(y=!0),y?(n=-s,i=o,a=Math.sqrt(h)):(n=o,i=s,a=Math.sqrt(h\/2))}return new Br(n\/a,i\/a)}for(var z=[],H=0,V=R.length,k=V-1,j=H+1;H<V;H++,k++,j++)k===V&&(k=0),j===V&&(j=0),z[H]=G(R[H],R[k],R[j]);var W,q,X=[],Y=z.concat();for(w=0,M=A.length;w<M;w++){for(b=A[w],W=[],H=0,k=(V=b.length)-1,j=H+1;H<V;H++,k++,j++)k===V&&(k=0),j===V&&(j=0),W[H]=G(b[H],b[k],b[j]);X.push(W),Y=Y.concat(W)}for(P=0;P<d;P++){for(D=P\/d,I=h*Math.cos(D*Math.PI\/2),O=u*Math.sin(D*Math.PI\/2)+p,H=0,V=R.length;H<V;H++)J((N=C(R[H],z[H],O)).x,N.y,-I);for(w=0,M=A.length;w<M;w++)for(b=A[w],W=X[w],H=0,V=b.length;H<V;H++)J((N=C(b[H],W[H],O)).x,N.y,-I)}for(O=u+p,H=0;H<F;H++)N=l?C(E[H],Y[H],O):E[H],S?(x.copy(g.normals[0]).multiplyScalar(N.x),y.copy(g.binormals[0]).multiplyScalar(N.y),_.copy(v[0]).add(x).add(y),J(_.x,_.y,_.z)):J(N.x,N.y,0);for(q=1;q<=s;q++)for(H=0;H<F;H++)N=l?C(E[H],Y[H],O):E[H],S?(x.copy(g.normals[q]).multiplyScalar(N.x),y.copy(g.binormals[q]).multiplyScalar(N.y),_.copy(v[q]).add(x).add(y),J(_.x,_.y,_.z)):J(N.x,N.y,c\/s*q);for(P=d-1;P>=0;P--){for(D=P\/d,I=h*Math.cos(D*Math.PI\/2),O=u*Math.sin(D*Math.PI\/2)+p,H=0,V=R.length;H<V;H++)J((N=C(R[H],z[H],O)).x,N.y,c+I);for(w=0,M=A.length;w<M;w++)for(b=A[w],W=X[w],H=0,V=b.length;H<V;H++)N=C(b[H],W[H],O),S?J(N.x,N.y+v[s-1].y,v[s-1].x+I):J(N.x,N.y,c+I)}function Z(e,t){var r,n;for(H=e.length;--H>=0;){r=H,(n=H-1)<0&&(n=e.length-1);var i=0,a=s+2*d;for(i=0;i<a;i++){var o=F*i,c=F*(i+1);K(t+r+o,t+n+o,t+n+c,t+r+c)}}}function J(e,t,r){a.push(e),a.push(t),a.push(r)}function Q(e,t,i){$(e),$(t),$(i);var a=n.length\/3,o=m.generateTopUV(r,n,a-3,a-2,a-1);ee(o[0]),ee(o[1]),ee(o[2])}function K(e,t,i,a){$(e),$(t),$(a),$(t),$(i),$(a);var o=n.length\/3,s=m.generateSideWallUV(r,n,o-6,o-3,o-2,o-1);ee(s[0]),ee(s[1]),ee(s[3]),ee(s[1]),ee(s[2]),ee(s[3])}function $(e){n.push(a[3*e+0]),n.push(a[3*e+1]),n.push(a[3*e+2])}function ee(e){i.push(e.x),i.push(e.y)}!function(){var e=n.length\/3;if(l){var t=0,i=F*t;for(H=0;H<U;H++)Q((B=L[H])[2]+i,B[1]+i,B[0]+i);for(i=F*(t=s+2*d),H=0;H<U;H++)Q((B=L[H])[0]+i,B[1]+i,B[2]+i)}else{for(H=0;H<U;H++)Q((B=L[H])[2],B[1],B[0]);for(H=0;H<U;H++)Q((B=L[H])[0]+F*s,B[1]+F*s,B[2]+F*s)}r.addGroup(e,n.length\/3-e,0)}(),function(){var e=n.length\/3,t=0;for(Z(R,t),t+=R.length,w=0,M=A.length;w<M;w++)Z(b=A[w],t),t+=b.length;r.addGroup(e,n.length\/3-e,1)}()}this.setAttribute(\"position\",new Li(n,3)),this.setAttribute(\"uv\",new Li(i,2)),this.computeVertexNormals()}exports.ShapeUtils=cp,up.prototype=Object.create(ha.prototype),up.prototype.constructor=up,up.prototype.toJSON=function(){var e=ha.prototype.toJSON.call(this);return fp(this.parameters.shapes,this.parameters.options,e)},pp.prototype=Object.create(Gi.prototype),pp.prototype.constructor=pp,pp.prototype.toJSON=function(){var e=Gi.prototype.toJSON.call(this);return fp(this.parameters.shapes,this.parameters.options,e)};var dp={generateTopUV:function(e,t,r,n,i){var a=t[3*r],o=t[3*r+1],s=t[3*n],c=t[3*n+1],l=t[3*i],h=t[3*i+1];return[new Br(a,o),new Br(s,c),new Br(l,h)]},generateSideWallUV:function(e,t,r,n,i,a){var o=t[3*r],s=t[3*r+1],c=t[3*r+2],l=t[3*n],h=t[3*n+1],u=t[3*n+2],p=t[3*i],d=t[3*i+1],f=t[3*i+2],m=t[3*a],v=t[3*a+1],g=t[3*a+2];return Math.abs(s-h)<.01?[new Br(o,1-c),new Br(l,1-u),new Br(p,1-f),new Br(m,1-g)]:[new Br(s,1-c),new Br(h,1-u),new Br(d,1-f),new Br(v,1-g)]}};function fp(e,t,r){if(r.shapes=[],Array.isArray(e))for(var n=0,i=e.length;n<i;n++){var a=e[n];r.shapes.push(a.uuid)}else r.shapes.push(e.uuid);return void 0!==t.extrudePath&&(r.options.extrudePath=t.extrudePath.toJSON()),r}function mp(e,t){ha.call(this),this.type=\"TextGeometry\",this.parameters={text:e,parameters:t},this.fromBufferGeometry(new vp(e,t)),this.mergeVertices()}function vp(e,t){var r=(t=t||{}).font;if(!r||!r.isFont)return console.error(\"THREE.TextGeometry: font parameter is not an instance of THREE.Font.\"),new ha;var n=r.generateShapes(e,t.size);t.depth=void 0!==t.height?t.height:50,void 0===t.bevelThickness&&(t.bevelThickness=10),void 0===t.bevelSize&&(t.bevelSize=8),void 0===t.bevelEnabled&&(t.bevelEnabled=!1),pp.call(this,n,t),this.type=\"TextBufferGeometry\"}function gp(e,t,r,n,i,a,o){ha.call(this),this.type=\"SphereGeometry\",this.parameters={radius:e,widthSegments:t,heightSegments:r,phiStart:n,phiLength:i,thetaStart:a,thetaLength:o},this.fromBufferGeometry(new yp(e,t,r,n,i,a,o)),this.mergeVertices()}function yp(e,t,r,n,i,a,o){Gi.call(this),this.type=\"SphereBufferGeometry\",this.parameters={radius:e,widthSegments:t,heightSegments:r,phiStart:n,phiLength:i,thetaStart:a,thetaLength:o},e=e||1,t=Math.max(3,Math.floor(t)||8),r=Math.max(2,Math.floor(r)||6),n=void 0!==n?n:0,i=void 0!==i?i:2*Math.PI,a=void 0!==a?a:0,o=void 0!==o?o:Math.PI;var s,c,l=Math.min(a+o,Math.PI),h=0,u=[],p=new Xr,d=new Xr,f=[],m=[],v=[],g=[];for(c=0;c<=r;c++){var y=[],x=c\/r,_=0;for(0==c&&0==a?_=.5\/t:c==r&&l==Math.PI&&(_=-.5\/t),s=0;s<=t;s++){var b=s\/t;p.x=-e*Math.cos(n+b*i)*Math.sin(a+x*o),p.y=e*Math.cos(a+x*o),p.z=e*Math.sin(n+b*i)*Math.sin(a+x*o),m.push(p.x,p.y,p.z),d.copy(p).normalize(),v.push(d.x,d.y,d.z),g.push(b+_,1-x),y.push(h++)}u.push(y)}for(c=0;c<r;c++)for(s=0;s<t;s++){var w=u[c][s+1],M=u[c][s],S=u[c+1][s],T=u[c+1][s+1];(0!==c||a>0)&&f.push(w,M,T),(c!==r-1||l<Math.PI)&&f.push(M,S,T)}this.setIndex(f),this.setAttribute(\"position\",new Li(m,3)),this.setAttribute(\"normal\",new Li(v,3)),this.setAttribute(\"uv\",new Li(g,2))}function xp(e,t,r,n,i,a){ha.call(this),this.type=\"RingGeometry\",this.parameters={innerRadius:e,outerRadius:t,thetaSegments:r,phiSegments:n,thetaStart:i,thetaLength:a},this.fromBufferGeometry(new _p(e,t,r,n,i,a)),this.mergeVertices()}function _p(e,t,r,n,i,a){Gi.call(this),this.type=\"RingBufferGeometry\",this.parameters={innerRadius:e,outerRadius:t,thetaSegments:r,phiSegments:n,thetaStart:i,thetaLength:a},e=e||.5,t=t||1,i=void 0!==i?i:0,a=void 0!==a?a:2*Math.PI,r=void 0!==r?Math.max(3,r):8;var o,s,c,l=[],h=[],u=[],p=[],d=e,f=(t-e)\/(n=void 0!==n?Math.max(1,n):1),m=new Xr,v=new Br;for(s=0;s<=n;s++){for(c=0;c<=r;c++)o=i+c\/r*a,m.x=d*Math.cos(o),m.y=d*Math.sin(o),h.push(m.x,m.y,m.z),u.push(0,0,1),v.x=(m.x\/t+1)\/2,v.y=(m.y\/t+1)\/2,p.push(v.x,v.y);d+=f}for(s=0;s<n;s++){var g=s*(r+1);for(c=0;c<r;c++){var y=o=c+g,x=o+r+1,_=o+r+2,b=o+1;l.push(y,x,b),l.push(x,_,b)}}this.setIndex(l),this.setAttribute(\"position\",new Li(h,3)),this.setAttribute(\"normal\",new Li(u,3)),this.setAttribute(\"uv\",new Li(p,2))}function bp(e,t,r,n){ha.call(this),this.type=\"LatheGeometry\",this.parameters={points:e,segments:t,phiStart:r,phiLength:n},this.fromBufferGeometry(new wp(e,t,r,n)),this.mergeVertices()}function wp(e,t,r,n){Gi.call(this),this.type=\"LatheBufferGeometry\",this.parameters={points:e,segments:t,phiStart:r,phiLength:n},t=Math.floor(t)||12,r=r||0,n=n||2*Math.PI,n=Nr.clamp(n,0,2*Math.PI);var i,a,o,s=[],c=[],l=[],h=1\/t,u=new Xr,p=new Br;for(a=0;a<=t;a++){var d=r+a*h*n,f=Math.sin(d),m=Math.cos(d);for(o=0;o<=e.length-1;o++)u.x=e[o].x*f,u.y=e[o].y,u.z=e[o].x*m,c.push(u.x,u.y,u.z),p.x=a\/t,p.y=o\/(e.length-1),l.push(p.x,p.y)}for(a=0;a<t;a++)for(o=0;o<e.length-1;o++){var v=i=o+a*e.length,g=i+e.length,y=i+e.length+1,x=i+1;s.push(v,g,x),s.push(g,y,x)}if(this.setIndex(s),this.setAttribute(\"position\",new Li(c,3)),this.setAttribute(\"uv\",new Li(l,2)),this.computeVertexNormals(),n===2*Math.PI){var _=this.attributes.normal.array,b=new Xr,w=new Xr,M=new Xr;for(i=t*e.length*3,a=0,o=0;a<e.length;a++,o+=3)b.x=_[o+0],b.y=_[o+1],b.z=_[o+2],w.x=_[i+o+0],w.y=_[i+o+1],w.z=_[i+o+2],M.addVectors(b,w).normalize(),_[o+0]=_[i+o+0]=M.x,_[o+1]=_[i+o+1]=M.y,_[o+2]=_[i+o+2]=M.z}}function Mp(e,t){ha.call(this),this.type=\"ShapeGeometry\",\"object\"==typeof t&&(console.warn(\"THREE.ShapeGeometry: Options parameter has been removed.\"),t=t.curveSegments),this.parameters={shapes:e,curveSegments:t},this.fromBufferGeometry(new Sp(e,t)),this.mergeVertices()}function Sp(e,t){Gi.call(this),this.type=\"ShapeBufferGeometry\",this.parameters={shapes:e,curveSegments:t},t=t||12;var r=[],n=[],i=[],a=[],o=0,s=0;if(!1===Array.isArray(e))l(e);else for(var c=0;c<e.length;c++)l(e[c]),this.addGroup(o,s,c),o+=s,s=0;function l(e){var o,c,l,h=n.length\/3,u=e.extractPoints(t),p=u.shape,d=u.holes;for(!1===cp.isClockWise(p)&&(p=p.reverse()),o=0,c=d.length;o<c;o++)l=d[o],!0===cp.isClockWise(l)&&(d[o]=l.reverse());var f=cp.triangulateShape(p,d);for(o=0,c=d.length;o<c;o++)l=d[o],p=p.concat(l);for(o=0,c=p.length;o<c;o++){var m=p[o];n.push(m.x,m.y,0),i.push(0,0,1),a.push(m.x,m.y)}for(o=0,c=f.length;o<c;o++){var v=f[o],g=v[0]+h,y=v[1]+h,x=v[2]+h;r.push(g,y,x),s+=3}}this.setIndex(r),this.setAttribute(\"position\",new Li(n,3)),this.setAttribute(\"normal\",new Li(i,3)),this.setAttribute(\"uv\",new Li(a,2))}function Tp(e,t){if(t.shapes=[],Array.isArray(e))for(var r=0,n=e.length;r<n;r++){var i=e[r];t.shapes.push(i.uuid)}else t.shapes.push(e.uuid);return t}function Ep(e,t){Gi.call(this),this.type=\"EdgesGeometry\",this.parameters={thresholdAngle:t},t=void 0!==t?t:1;var r,n,i,a,o=[],s=Math.cos(Nr.DEG2RAD*t),c=[0,0],l={},h=[\"a\",\"b\",\"c\"];e.isBufferGeometry?(a=new ha).fromBufferGeometry(e):a=e.clone(),a.mergeVertices(),a.computeFaceNormals();for(var u=a.vertices,p=a.faces,d=0,f=p.length;d<f;d++)for(var m=p[d],v=0;v<3;v++)r=m[h[v]],n=m[h[(v+1)%3]],c[0]=Math.min(r,n),c[1]=Math.max(r,n),void 0===l[i=c[0]+\",\"+c[1]]?l[i]={index1:c[0],index2:c[1],face1:d,face2:void 0}:l[i].face2=d;for(i in l){var g=l[i];if(void 0===g.face2||p[g.face1].normal.dot(p[g.face2].normal)<=s){var y=u[g.index1];o.push(y.x,y.y,y.z),y=u[g.index2],o.push(y.x,y.y,y.z)}}this.setAttribute(\"position\",new Li(o,3))}function Ap(e,t,r,n,i,a,o,s){ha.call(this),this.type=\"CylinderGeometry\",this.parameters={radiusTop:e,radiusBottom:t,height:r,radialSegments:n,heightSegments:i,openEnded:a,thetaStart:o,thetaLength:s},this.fromBufferGeometry(new Lp(e,t,r,n,i,a,o,s)),this.mergeVertices()}function Lp(e,t,r,n,i,a,o,s){Gi.call(this),this.type=\"CylinderBufferGeometry\",this.parameters={radiusTop:e,radiusBottom:t,height:r,radialSegments:n,heightSegments:i,openEnded:a,thetaStart:o,thetaLength:s};var c=this;e=void 0!==e?e:1,t=void 0!==t?t:1,r=r||1,n=Math.floor(n)||8,i=Math.floor(i)||1,a=void 0!==a&&a,o=void 0!==o?o:0,s=void 0!==s?s:2*Math.PI;var l=[],h=[],u=[],p=[],d=0,f=[],m=r\/2,v=0;function g(r){var i,a,f,g=new Br,y=new Xr,x=0,_=!0===r?e:t,b=!0===r?1:-1;for(a=d,i=1;i<=n;i++)h.push(0,m*b,0),u.push(0,b,0),p.push(.5,.5),d++;for(f=d,i=0;i<=n;i++){var w=i\/n*s+o,M=Math.cos(w),S=Math.sin(w);y.x=_*S,y.y=m*b,y.z=_*M,h.push(y.x,y.y,y.z),u.push(0,b,0),g.x=.5*M+.5,g.y=.5*S*b+.5,p.push(g.x,g.y),d++}for(i=0;i<n;i++){var T=a+i,E=f+i;!0===r?l.push(E,E+1,T):l.push(E+1,E,T),x+=3}c.addGroup(v,x,!0===r?1:2),v+=x}!function(){var a,g,y=new Xr,x=new Xr,_=0,b=(t-e)\/r;for(g=0;g<=i;g++){var w=[],M=g\/i,S=M*(t-e)+e;for(a=0;a<=n;a++){var T=a\/n,E=T*s+o,A=Math.sin(E),L=Math.cos(E);x.x=S*A,x.y=-M*r+m,x.z=S*L,h.push(x.x,x.y,x.z),y.set(A,b,L).normalize(),u.push(y.x,y.y,y.z),p.push(T,1-M),w.push(d++)}f.push(w)}for(a=0;a<n;a++)for(g=0;g<i;g++){var R=f[g][a],C=f[g+1][a],P=f[g+1][a+1],O=f[g][a+1];l.push(R,C,O),l.push(C,P,O),_+=6}c.addGroup(v,_,0),v+=_}(),!1===a&&(e>0&&g(!0),t>0&&g(!1)),this.setIndex(l),this.setAttribute(\"position\",new Li(h,3)),this.setAttribute(\"normal\",new Li(u,3)),this.setAttribute(\"uv\",new Li(p,2))}function Rp(e,t,r,n,i,a,o){Ap.call(this,0,e,t,r,n,i,a,o),this.type=\"ConeGeometry\",this.parameters={radius:e,height:t,radialSegments:r,heightSegments:n,openEnded:i,thetaStart:a,thetaLength:o}}function Cp(e,t,r,n,i,a,o){Lp.call(this,0,e,t,r,n,i,a,o),this.type=\"ConeBufferGeometry\",this.parameters={radius:e,height:t,radialSegments:r,heightSegments:n,openEnded:i,thetaStart:a,thetaLength:o}}function Pp(e,t,r,n){ha.call(this),this.type=\"CircleGeometry\",this.parameters={radius:e,segments:t,thetaStart:r,thetaLength:n},this.fromBufferGeometry(new Op(e,t,r,n)),this.mergeVertices()}function Op(e,t,r,n){Gi.call(this),this.type=\"CircleBufferGeometry\",this.parameters={radius:e,segments:t,thetaStart:r,thetaLength:n},e=e||1,t=void 0!==t?Math.max(3,t):8,r=void 0!==r?r:0,n=void 0!==n?n:2*Math.PI;var i,a,o=[],s=[],c=[],l=[],h=new Xr,u=new Br;for(s.push(0,0,0),c.push(0,0,1),l.push(.5,.5),a=0,i=3;a<=t;a++,i+=3){var p=r+a\/t*n;h.x=e*Math.cos(p),h.y=e*Math.sin(p),s.push(h.x,h.y,h.z),c.push(0,0,1),u.x=(s[i]\/e+1)\/2,u.y=(s[i+1]\/e+1)\/2,l.push(u.x,u.y)}for(i=1;i<=t;i++)o.push(i,i+1,0);this.setIndex(o),this.setAttribute(\"position\",new Li(s,3)),this.setAttribute(\"normal\",new Li(c,3)),this.setAttribute(\"uv\",new Li(l,2))}mp.prototype=Object.create(ha.prototype),mp.prototype.constructor=mp,vp.prototype=Object.create(pp.prototype),vp.prototype.constructor=vp,gp.prototype=Object.create(ha.prototype),gp.prototype.constructor=gp,yp.prototype=Object.create(Gi.prototype),yp.prototype.constructor=yp,xp.prototype=Object.create(ha.prototype),xp.prototype.constructor=xp,_p.prototype=Object.create(Gi.prototype),_p.prototype.constructor=_p,bp.prototype=Object.create(ha.prototype),bp.prototype.constructor=bp,wp.prototype=Object.create(Gi.prototype),wp.prototype.constructor=wp,Mp.prototype=Object.create(ha.prototype),Mp.prototype.constructor=Mp,Mp.prototype.toJSON=function(){var e=ha.prototype.toJSON.call(this);return Tp(this.parameters.shapes,e)},Sp.prototype=Object.create(Gi.prototype),Sp.prototype.constructor=Sp,Sp.prototype.toJSON=function(){var e=Gi.prototype.toJSON.call(this);return Tp(this.parameters.shapes,e)},Ep.prototype=Object.create(Gi.prototype),Ep.prototype.constructor=Ep,Ap.prototype=Object.create(ha.prototype),Ap.prototype.constructor=Ap,Lp.prototype=Object.create(Gi.prototype),Lp.prototype.constructor=Lp,Rp.prototype=Object.create(Ap.prototype),Rp.prototype.constructor=Rp,Cp.prototype=Object.create(Lp.prototype),Cp.prototype.constructor=Cp,Pp.prototype=Object.create(ha.prototype),Pp.prototype.constructor=Pp,Op.prototype=Object.create(Gi.prototype),Op.prototype.constructor=Op;var Dp=Object.freeze({__proto__:null,WireframeGeometry:fu,ParametricGeometry:mu,ParametricBufferGeometry:vu,TetrahedronGeometry:xu,TetrahedronBufferGeometry:_u,OctahedronGeometry:bu,OctahedronBufferGeometry:wu,IcosahedronGeometry:Mu,IcosahedronBufferGeometry:Su,DodecahedronGeometry:Tu,DodecahedronBufferGeometry:Eu,PolyhedronGeometry:gu,PolyhedronBufferGeometry:yu,TubeGeometry:Au,TubeBufferGeometry:Lu,TorusKnotGeometry:Ru,TorusKnotBufferGeometry:Cu,TorusGeometry:Pu,TorusBufferGeometry:Ou,TextGeometry:mp,TextBufferGeometry:vp,SphereGeometry:gp,SphereBufferGeometry:yp,RingGeometry:xp,RingBufferGeometry:_p,PlaneGeometry:Oa,PlaneBufferGeometry:Da,LatheGeometry:bp,LatheBufferGeometry:wp,ShapeGeometry:Mp,ShapeBufferGeometry:Sp,ExtrudeGeometry:up,ExtrudeBufferGeometry:pp,EdgesGeometry:Ep,ConeGeometry:Rp,ConeBufferGeometry:Cp,CylinderGeometry:Ap,CylinderBufferGeometry:Lp,CircleGeometry:Pp,CircleBufferGeometry:Op,BoxGeometry:ua,BoxBufferGeometry:pa});function Ip(e){gi.call(this),this.type=\"ShadowMaterial\",this.color=new ui(0),this.transparent=!0,this.setValues(e)}function Np(e){ya.call(this,e),this.type=\"RawShaderMaterial\"}function Bp(e){gi.call(this),this.defines={STANDARD:\"\"},this.type=\"MeshStandardMaterial\",this.color=new ui(16777215),this.roughness=1,this.metalness=0,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new ui(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=ir,this.normalScale=new Br(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapIntensity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap=\"round\",this.wireframeLinejoin=\"round\",this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.vertexTangents=!1,this.setValues(e)}function Fp(e){Bp.call(this),this.defines={STANDARD:\"\",PHYSICAL:\"\"},this.type=\"MeshPhysicalMaterial\",this.clearcoat=0,this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new Br(1,1),this.clearcoatNormalMap=null,this.reflectivity=.5,this.sheen=null,this.transparency=0,this.setValues(e)}function Up(e){gi.call(this),this.type=\"MeshPhongMaterial\",this.color=new ui(16777215),this.specular=new ui(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new ui(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=ir,this.normalScale=new Br(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=Y,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap=\"round\",this.wireframeLinejoin=\"round\",this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(e)}function Gp(e){gi.call(this),this.defines={TOON:\"\"},this.type=\"MeshToonMaterial\",this.color=new ui(16777215),this.specular=new ui(1118481),this.shininess=30,this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new ui(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=ir,this.normalScale=new Br(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap=\"round\",this.wireframeLinejoin=\"round\",this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(e)}function zp(e){gi.call(this),this.type=\"MeshNormalMaterial\",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=ir,this.normalScale=new Br(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(e)}function Hp(e){gi.call(this),this.type=\"MeshLambertMaterial\",this.color=new ui(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new ui(0),this.emissiveIntensity=1,this.emissiveMap=null,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=Y,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap=\"round\",this.wireframeLinejoin=\"round\",this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(e)}function Vp(e){gi.call(this),this.defines={MATCAP:\"\"},this.type=\"MeshMatcapMaterial\",this.color=new ui(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=ir,this.normalScale=new Br(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(e)}function kp(e){qh.call(this),this.type=\"LineDashedMaterial\",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(e)}Ip.prototype=Object.create(gi.prototype),Ip.prototype.constructor=Ip,Ip.prototype.isShadowMaterial=!0,Ip.prototype.copy=function(e){return gi.prototype.copy.call(this,e),this.color.copy(e.color),this},Np.prototype=Object.create(ya.prototype),Np.prototype.constructor=Np,Np.prototype.isRawShaderMaterial=!0,Bp.prototype=Object.create(gi.prototype),Bp.prototype.constructor=Bp,Bp.prototype.isMeshStandardMaterial=!0,Bp.prototype.copy=function(e){return gi.prototype.copy.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.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this.vertexTangents=e.vertexTangents,this},Fp.prototype=Object.create(Bp.prototype),Fp.prototype.constructor=Fp,Fp.prototype.isMeshPhysicalMaterial=!0,Fp.prototype.copy=function(e){return Bp.prototype.copy.call(this,e),this.defines={STANDARD:\"\",PHYSICAL:\"\"},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.reflectivity=e.reflectivity,e.sheen?this.sheen=(this.sheen||new ui).copy(e.sheen):this.sheen=null,this.transparency=e.transparency,this},Up.prototype=Object.create(gi.prototype),Up.prototype.constructor=Up,Up.prototype.isMeshPhongMaterial=!0,Up.prototype.copy=function(e){return gi.prototype.copy.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.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this},Gp.prototype=Object.create(gi.prototype),Gp.prototype.constructor=Gp,Gp.prototype.isMeshToonMaterial=!0,Gp.prototype.copy=function(e){return gi.prototype.copy.call(this,e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,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.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this},zp.prototype=Object.create(gi.prototype),zp.prototype.constructor=zp,zp.prototype.isMeshNormalMaterial=!0,zp.prototype.copy=function(e){return gi.prototype.copy.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.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this},Hp.prototype=Object.create(gi.prototype),Hp.prototype.constructor=Hp,Hp.prototype.isMeshLambertMaterial=!0,Hp.prototype.copy=function(e){return gi.prototype.copy.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.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.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this},Vp.prototype=Object.create(gi.prototype),Vp.prototype.constructor=Vp,Vp.prototype.isMeshMatcapMaterial=!0,Vp.prototype.copy=function(e){return gi.prototype.copy.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.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this},kp.prototype=Object.create(qh.prototype),kp.prototype.constructor=kp,kp.prototype.isLineDashedMaterial=!0,kp.prototype.copy=function(e){return qh.prototype.copy.call(this,e),this.scale=e.scale,this.dashSize=e.dashSize,this.gapSize=e.gapSize,this};var jp=Object.freeze({__proto__:null,ShadowMaterial:Ip,SpriteMaterial:yh,RawShaderMaterial:Np,ShaderMaterial:ya,PointsMaterial:nu,MeshPhysicalMaterial:Fp,MeshStandardMaterial:Bp,MeshPhongMaterial:Up,MeshToonMaterial:Gp,MeshNormalMaterial:zp,MeshLambertMaterial:Hp,MeshDepthMaterial:eh,MeshDistanceMaterial:th,MeshBasicMaterial:yi,MeshMatcapMaterial:Vp,LineDashedMaterial:kp,LineBasicMaterial:qh,Material:gi}),Wp={arraySlice:function(e,t,r){return Wp.isTypedArray(e)?new e.constructor(e.subarray(t,void 0!==r?r:e.length)):e.slice(t,r)},convertArray:function(e,t,r){return!e||!r&&e.constructor===t?e:\"number\"==typeof t.BYTES_PER_ELEMENT?new t(e):Array.prototype.slice.call(e)},isTypedArray:function(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)},getKeyframeOrder:function(e){for(var t=e.length,r=new Array(t),n=0;n!==t;++n)r[n]=n;return r.sort(function(t,r){return e[t]-e[r]}),r},sortedArray:function(e,t,r){for(var n=e.length,i=new e.constructor(n),a=0,o=0;o!==n;++a)for(var s=r[a]*t,c=0;c!==t;++c)i[o++]=e[s+c];return i},flattenJSON:function(e,t,r,n){for(var i=1,a=e[0];void 0!==a&&void 0===a[n];)a=e[i++];if(void 0!==a){var o=a[n];if(void 0!==o)if(Array.isArray(o))do{void 0!==(o=a[n])&&(t.push(a.time),r.push.apply(r,o)),a=e[i++]}while(void 0!==a);else if(void 0!==o.toArray)do{void 0!==(o=a[n])&&(t.push(a.time),o.toArray(r,r.length)),a=e[i++]}while(void 0!==a);else do{void 0!==(o=a[n])&&(t.push(a.time),r.push(o)),a=e[i++]}while(void 0!==a)}},subclip:function(e,t,r,n,i){i=i||30;var a=e.clone();a.name=t;for(var o=[],s=0;s<a.tracks.length;++s){for(var c=a.tracks[s],l=c.getValueSize(),h=[],u=[],p=0;p<c.times.length;++p){var d=c.times[p]*i;if(!(d<r||d>=n)){h.push(c.times[p]);for(var f=0;f<l;++f)u.push(c.values[p*l+f])}}0!==h.length&&(c.times=Wp.convertArray(h,c.times.constructor),c.values=Wp.convertArray(u,c.values.constructor),o.push(c))}a.tracks=o;var m=1\/0;for(s=0;s<a.tracks.length;++s)m>a.tracks[s].times[0]&&(m=a.tracks[s].times[0]);for(s=0;s<a.tracks.length;++s)a.tracks[s].shift(-1*m);return a.resetDuration(),a}};function qp(e,t,r,n){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=void 0!==n?n:new t.constructor(r),this.sampleValues=t,this.valueSize=r}function Xp(e,t,r,n){qp.call(this,e,t,r,n),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0}function Yp(e,t,r,n){qp.call(this,e,t,r,n)}function Zp(e,t,r,n){qp.call(this,e,t,r,n)}function Jp(e,t,r,n){if(void 0===e)throw new Error(\"THREE.KeyframeTrack: track name is undefined\");if(void 0===t||0===t.length)throw new Error(\"THREE.KeyframeTrack: no keyframes in track named \"+e);this.name=e,this.times=Wp.convertArray(t,this.TimeBufferType),this.values=Wp.convertArray(r,this.ValueBufferType),this.setInterpolation(n||this.DefaultInterpolation)}function Qp(e,t,r){Jp.call(this,e,t,r)}function Kp(e,t,r,n){Jp.call(this,e,t,r,n)}function $p(e,t,r,n){Jp.call(this,e,t,r,n)}function ed(e,t,r,n){qp.call(this,e,t,r,n)}function td(e,t,r,n){Jp.call(this,e,t,r,n)}function rd(e,t,r,n){Jp.call(this,e,t,r,n)}function nd(e,t,r,n){Jp.call(this,e,t,r,n)}function id(e,t,r){this.name=e,this.tracks=r,this.duration=void 0!==t?t:-1,this.uuid=Nr.generateUUID(),this.duration<0&&this.resetDuration()}function ad(e){switch(e.toLowerCase()){case\"scalar\":case\"double\":case\"float\":case\"number\":case\"integer\":return $p;case\"vector\":case\"vector2\":case\"vector3\":case\"vector4\":return nd;case\"color\":return Kp;case\"quaternion\":return td;case\"bool\":case\"boolean\":return Qp;case\"string\":return rd}throw new Error(\"THREE.KeyframeTrack: Unsupported typeName: \"+e)}function od(e){if(void 0===e.type)throw new Error(\"THREE.KeyframeTrack: track type undefined, can not parse\");var t=ad(e.type);if(void 0===e.times){var r=[],n=[];Wp.flattenJSON(e.keys,r,n,\"value\"),e.times=r,e.values=n}return void 0!==t.parse?t.parse(e):new t(e.name,e.times,e.values,e.interpolation)}exports.AnimationUtils=Wp,Object.assign(qp.prototype,{evaluate:function(e){var t=this.parameterPositions,r=this._cachedIndex,n=t[r],i=t[r-1];e:{t:{var a;r:{n:if(!(e<n)){for(var o=r+2;;){if(void 0===n){if(e<i)break n;return r=t.length,this._cachedIndex=r,this.afterEnd_(r-1,e,i)}if(r===o)break;if(i=n,e<(n=t[++r]))break t}a=t.length;break r}if(e>=i)break e;var s=t[1];e<s&&(r=2,i=s);for(o=r-2;;){if(void 0===i)return this._cachedIndex=0,this.beforeStart_(0,e,n);if(r===o)break;if(n=i,e>=(i=t[--r-1]))break t}a=r,r=0}for(;r<a;){var c=r+a>>>1;e<t[c]?a=c:r=c+1}if(n=t[r],void 0===(i=t[r-1]))return this._cachedIndex=0,this.beforeStart_(0,e,n);if(void 0===n)return r=t.length,this._cachedIndex=r,this.afterEnd_(r-1,i,e)}this._cachedIndex=r,this.intervalChanged_(r,i,n)}return this.interpolate_(r,i,e,n)},settings:null,DefaultSettings_:{},getSettings_:function(){return this.settings||this.DefaultSettings_},copySampleValue_:function(e){for(var t=this.resultBuffer,r=this.sampleValues,n=this.valueSize,i=e*n,a=0;a!==n;++a)t[a]=r[i+a];return t},interpolate_:function(){throw new Error(\"call to abstract method\")},intervalChanged_:function(){}}),Object.assign(qp.prototype,{beforeStart_:qp.prototype.copySampleValue_,afterEnd_:qp.prototype.copySampleValue_}),Xp.prototype=Object.assign(Object.create(qp.prototype),{constructor:Xp,DefaultSettings_:{endingStart:Vt,endingEnd:Vt},intervalChanged_:function(e,t,r){var n=this.parameterPositions,i=e-2,a=e+1,o=n[i],s=n[a];if(void 0===o)switch(this.getSettings_().endingStart){case kt:i=e,o=2*t-r;break;case jt:o=t+n[i=n.length-2]-n[i+1];break;default:i=e,o=r}if(void 0===s)switch(this.getSettings_().endingEnd){case kt:a=e,s=2*r-t;break;case jt:a=1,s=r+n[1]-n[0];break;default:a=e-1,s=t}var c=.5*(r-t),l=this.valueSize;this._weightPrev=c\/(t-o),this._weightNext=c\/(s-r),this._offsetPrev=i*l,this._offsetNext=a*l},interpolate_:function(e,t,r,n){for(var i=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=e*o,c=s-o,l=this._offsetPrev,h=this._offsetNext,u=this._weightPrev,p=this._weightNext,d=(r-t)\/(n-t),f=d*d,m=f*d,v=-u*m+2*u*f-u*d,g=(1+u)*m+(-1.5-2*u)*f+(-.5+u)*d+1,y=(-1-p)*m+(1.5+p)*f+.5*d,x=p*m-p*f,_=0;_!==o;++_)i[_]=v*a[l+_]+g*a[c+_]+y*a[s+_]+x*a[h+_];return i}}),Yp.prototype=Object.assign(Object.create(qp.prototype),{constructor:Yp,interpolate_:function(e,t,r,n){for(var i=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=e*o,c=s-o,l=(r-t)\/(n-t),h=1-l,u=0;u!==o;++u)i[u]=a[c+u]*h+a[s+u]*l;return i}}),Zp.prototype=Object.assign(Object.create(qp.prototype),{constructor:Zp,interpolate_:function(e){return this.copySampleValue_(e-1)}}),Object.assign(Jp,{toJSON:function(e){var t,r=e.constructor;if(void 0!==r.toJSON)t=r.toJSON(e);else{t={name:e.name,times:Wp.convertArray(e.times,Array),values:Wp.convertArray(e.values,Array)};var n=e.getInterpolation();n!==e.DefaultInterpolation&&(t.interpolation=n)}return t.type=e.ValueTypeName,t}}),Object.assign(Jp.prototype,{constructor:Jp,TimeBufferType:Float32Array,ValueBufferType:Float32Array,DefaultInterpolation:zt,InterpolantFactoryMethodDiscrete:function(e){return new Zp(this.times,this.values,this.getValueSize(),e)},InterpolantFactoryMethodLinear:function(e){return new Yp(this.times,this.values,this.getValueSize(),e)},InterpolantFactoryMethodSmooth:function(e){return new Xp(this.times,this.values,this.getValueSize(),e)},setInterpolation:function(e){var t;switch(e){case Gt:t=this.InterpolantFactoryMethodDiscrete;break;case zt:t=this.InterpolantFactoryMethodLinear;break;case Ht:t=this.InterpolantFactoryMethodSmooth}if(void 0===t){var r=\"unsupported interpolation for \"+this.ValueTypeName+\" keyframe track named \"+this.name;if(void 0===this.createInterpolant){if(e===this.DefaultInterpolation)throw new Error(r);this.setInterpolation(this.DefaultInterpolation)}return console.warn(\"THREE.KeyframeTrack:\",r),this}return this.createInterpolant=t,this},getInterpolation:function(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return Gt;case this.InterpolantFactoryMethodLinear:return zt;case this.InterpolantFactoryMethodSmooth:return Ht}},getValueSize:function(){return this.values.length\/this.times.length},shift:function(e){if(0!==e)for(var t=this.times,r=0,n=t.length;r!==n;++r)t[r]+=e;return this},scale:function(e){if(1!==e)for(var t=this.times,r=0,n=t.length;r!==n;++r)t[r]*=e;return this},trim:function(e,t){for(var r=this.times,n=r.length,i=0,a=n-1;i!==n&&r[i]<e;)++i;for(;-1!==a&&r[a]>t;)--a;if(++a,0!==i||a!==n){i>=a&&(i=(a=Math.max(a,1))-1);var o=this.getValueSize();this.times=Wp.arraySlice(r,i,a),this.values=Wp.arraySlice(this.values,i*o,a*o)}return this},validate: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 r=this.times,n=this.values,i=r.length;0===i&&(console.error(\"THREE.KeyframeTrack: Track is empty.\",this),e=!1);for(var a=null,o=0;o!==i;o++){var s=r[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!==n&&Wp.isTypedArray(n)){o=0;for(var c=n.length;o!==c;++o){var l=n[o];if(isNaN(l)){console.error(\"THREE.KeyframeTrack: Value is not a valid number.\",this,o,l),e=!1;break}}}return e},optimize:function(){for(var e=Wp.arraySlice(this.times),t=Wp.arraySlice(this.values),r=this.getValueSize(),n=this.getInterpolation()===Ht,i=1,a=e.length-1,o=1;o<a;++o){var s=!1,c=e[o];if(c!==e[o+1]&&(1!==o||c!==c[0]))if(n)s=!0;else for(var l=o*r,h=l-r,u=l+r,p=0;p!==r;++p){var d=t[l+p];if(d!==t[h+p]||d!==t[u+p]){s=!0;break}}if(s){if(o!==i){e[i]=e[o];var f=o*r,m=i*r;for(p=0;p!==r;++p)t[m+p]=t[f+p]}++i}}if(a>0){e[i]=e[a];for(f=a*r,m=i*r,p=0;p!==r;++p)t[m+p]=t[f+p];++i}return i!==e.length?(this.times=Wp.arraySlice(e,0,i),this.values=Wp.arraySlice(t,0,i*r)):(this.times=e,this.values=t),this},clone:function(){var e=Wp.arraySlice(this.times,0),t=Wp.arraySlice(this.values,0),r=new(0,this.constructor)(this.name,e,t);return r.createInterpolant=this.createInterpolant,r}}),Qp.prototype=Object.assign(Object.create(Jp.prototype),{constructor:Qp,ValueTypeName:\"bool\",ValueBufferType:Array,DefaultInterpolation:Gt,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0}),Kp.prototype=Object.assign(Object.create(Jp.prototype),{constructor:Kp,ValueTypeName:\"color\"}),$p.prototype=Object.assign(Object.create(Jp.prototype),{constructor:$p,ValueTypeName:\"number\"}),ed.prototype=Object.assign(Object.create(qp.prototype),{constructor:ed,interpolate_:function(e,t,r,n){for(var i=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=e*o,c=(r-t)\/(n-t),l=s+o;s!==l;s+=4)jr.slerpFlat(i,0,a,s-o,a,s,c);return i}}),td.prototype=Object.assign(Object.create(Jp.prototype),{constructor:td,ValueTypeName:\"quaternion\",DefaultInterpolation:zt,InterpolantFactoryMethodLinear:function(e){return new ed(this.times,this.values,this.getValueSize(),e)},InterpolantFactoryMethodSmooth:void 0}),rd.prototype=Object.assign(Object.create(Jp.prototype),{constructor:rd,ValueTypeName:\"string\",ValueBufferType:Array,DefaultInterpolation:Gt,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0}),nd.prototype=Object.assign(Object.create(Jp.prototype),{constructor:nd,ValueTypeName:\"vector\"}),Object.assign(id,{parse:function(e){for(var t=[],r=e.tracks,n=1\/(e.fps||1),i=0,a=r.length;i!==a;++i)t.push(od(r[i]).scale(n));return new id(e.name,e.duration,t)},toJSON:function(e){for(var t=[],r=e.tracks,n={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid},i=0,a=r.length;i!==a;++i)t.push(Jp.toJSON(r[i]));return n},CreateFromMorphTargetSequence:function(e,t,r,n){for(var i=t.length,a=[],o=0;o<i;o++){var s=[],c=[];s.push((o+i-1)%i,o,(o+1)%i),c.push(0,1,0);var l=Wp.getKeyframeOrder(s);s=Wp.sortedArray(s,1,l),c=Wp.sortedArray(c,1,l),n||0!==s[0]||(s.push(i),c.push(c[0])),a.push(new $p(\".morphTargetInfluences[\"+t[o].name+\"]\",s,c).scale(1\/r))}return new id(e,-1,a)},findByName:function(e,t){var r=e;if(!Array.isArray(e)){var n=e;r=n.geometry&&n.geometry.animations||n.animations}for(var i=0;i<r.length;i++)if(r[i].name===t)return r[i];return null},CreateClipsFromMorphTargetSequences:function(e,t,r){for(var n={},i=\/^([w-]*?)([d]+)$\/,a=0,o=e.length;a<o;a++){var s=e[a],c=s.name.match(i);if(c&&c.length>1){var l=n[u=c[1]];l||(n[u]=l=[]),l.push(s)}}var h=[];for(var u in n)h.push(id.CreateFromMorphTargetSequence(u,n[u],t,r));return h},parseAnimation:function(e,t){if(!e)return console.error(\"THREE.AnimationClip: No animation in JSONLoader data.\"),null;for(var r=function(e,t,r,n,i){if(0!==r.length){var a=[],o=[];Wp.flattenJSON(r,a,o,n),0!==a.length&&i.push(new e(t,a,o))}},n=[],i=e.name||\"default\",a=e.length||-1,o=e.fps||30,s=e.hierarchy||[],c=0;c<s.length;c++){var l=s[c].keys;if(l&&0!==l.length)if(l[0].morphTargets){for(var h={},u=0;u<l.length;u++)if(l[u].morphTargets)for(var p=0;p<l[u].morphTargets.length;p++)h[l[u].morphTargets[p]]=-1;for(var d in h){var f=[],m=[];for(p=0;p!==l[u].morphTargets.length;++p){var v=l[u];f.push(v.time),m.push(v.morphTarget===d?1:0)}n.push(new $p(\".morphTargetInfluence[\"+d+\"]\",f,m))}a=h.length*(o||1)}else{var g=\".bones[\"+t[c].name+\"]\";r(nd,g+\".position\",l,\"pos\",n),r(td,g+\".quaternion\",l,\"rot\",n),r(nd,g+\".scale\",l,\"scl\",n)}}return 0===n.length?null:new id(i,a,n)}}),Object.assign(id.prototype,{resetDuration:function(){for(var e=0,t=0,r=this.tracks.length;t!==r;++t){var n=this.tracks[t];e=Math.max(e,n.times[n.times.length-1])}return this.duration=e,this},trim:function(){for(var e=0;e<this.tracks.length;e++)this.tracks[e].trim(0,this.duration);return this},validate:function(){for(var e=!0,t=0;t<this.tracks.length;t++)e=e&&this.tracks[t].validate();return e},optimize:function(){for(var e=0;e<this.tracks.length;e++)this.tracks[e].optimize();return this},clone:function(){for(var e=[],t=0;t<this.tracks.length;t++)e.push(this.tracks[t].clone());return new id(this.name,this.duration,e)}});var sd={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={}}};function cd(e,t,r){var n=this,i=!1,a=0,o=0,s=void 0,c=[];this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=r,this.itemStart=function(e){o++,!1===i&&void 0!==n.onStart&&n.onStart(e,a,o),i=!0},this.itemEnd=function(e){a++,void 0!==n.onProgress&&n.onProgress(e,a,o),a===o&&(i=!1,void 0!==n.onLoad&&n.onLoad())},this.itemError=function(e){void 0!==n.onError&&n.onError(e)},this.resolveURL=function(e){return s?s(e):e},this.setURLModifier=function(e){return s=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,r=c.length;t<r;t+=2){var n=c[t],i=c[t+1];if(n.global&&(n.lastIndex=0),n.test(e))return i}return null}}exports.Cache=sd;var ld=new cd;function hd(e){this.manager=void 0!==e?e:ld,this.crossOrigin=\"anonymous\",this.path=\"\",this.resourcePath=\"\"}exports.DefaultLoadingManager=ld,Object.assign(hd.prototype,{load:function(){},parse:function(){},setCrossOrigin:function(e){return this.crossOrigin=e,this},setPath:function(e){return this.path=e,this},setResourcePath:function(e){return this.resourcePath=e,this}});var ud={};function pd(e){hd.call(this,e)}function dd(e){hd.call(this,e)}function fd(e){hd.call(this,e)}function md(e){hd.call(this,e)}function vd(e){hd.call(this,e)}function gd(e){hd.call(this,e)}function yd(e){hd.call(this,e)}function xd(){this.type=\"Curve\",this.arcLengthDivisions=200}function _d(e,t,r,n,i,a,o,s){xd.call(this),this.type=\"EllipseCurve\",this.aX=e||0,this.aY=t||0,this.xRadius=r||1,this.yRadius=n||1,this.aStartAngle=i||0,this.aEndAngle=a||2*Math.PI,this.aClockwise=o||!1,this.aRotation=s||0}function bd(e,t,r,n,i,a){_d.call(this,e,t,r,r,n,i,a),this.type=\"ArcCurve\"}function wd(){var e=0,t=0,r=0,n=0;function i(i,a,o,s){e=i,t=o,r=-3*i+3*a-2*o-s,n=2*i-2*a+o+s}return{initCatmullRom:function(e,t,r,n,a){i(t,r,a*(r-e),a*(n-t))},initNonuniformCatmullRom:function(e,t,r,n,a,o,s){var c=(t-e)\/a-(r-e)\/(a+o)+(r-t)\/o,l=(r-t)\/o-(n-t)\/(o+s)+(n-r)\/s;i(t,r,c*=o,l*=o)},calc:function(i){var a=i*i;return e+t*i+r*a+n*(a*i)}}}pd.prototype=Object.assign(Object.create(hd.prototype),{constructor:pd,load:function(e,t,r,n){void 0===e&&(e=\"\"),void 0!==this.path&&(e=this.path+e),e=this.manager.resolveURL(e);var i=this,a=sd.get(e);if(void 0!==a)return i.manager.itemStart(e),setTimeout(function(){t&&t(a),i.manager.itemEnd(e)},0),a;if(void 0===ud[e]){var o=e.match(\/^data:(.*?)(;base64)?,(.*)$\/);if(o){var s=o[1],c=!!o[2],l=o[3];l=decodeURIComponent(l),c&&(l=atob(l));try{var h,u=(this.responseType||\"\").toLowerCase();switch(u){case\"arraybuffer\":case\"blob\":for(var p=new Uint8Array(l.length),d=0;d<l.length;d++)p[d]=l.charCodeAt(d);h=\"blob\"===u?new Blob([p.buffer],{type:s}):p.buffer;break;case\"document\":var f=new DOMParser;h=f.parseFromString(l,s);break;case\"json\":h=JSON.parse(l);break;default:h=l}setTimeout(function(){t&&t(h),i.manager.itemEnd(e)},0)}catch(g){setTimeout(function(){n&&n(g),i.manager.itemError(e),i.manager.itemEnd(e)},0)}}else{ud[e]=[],ud[e].push({onLoad:t,onProgress:r,onError:n});var m=new XMLHttpRequest;for(var v in m.open(\"GET\",e,!0),m.addEventListener(\"load\",function(t){var r=this.response,n=ud[e];if(delete ud[e],200===this.status||0===this.status){0===this.status&&console.warn(\"THREE.FileLoader: HTTP Status 0 received.\"),sd.add(e,r);for(var a=0,o=n.length;a<o;a++){(s=n[a]).onLoad&&s.onLoad(r)}i.manager.itemEnd(e)}else{for(a=0,o=n.length;a<o;a++){var s;(s=n[a]).onError&&s.onError(t)}i.manager.itemError(e),i.manager.itemEnd(e)}},!1),m.addEventListener(\"progress\",function(t){for(var r=ud[e],n=0,i=r.length;n<i;n++){var a=r[n];a.onProgress&&a.onProgress(t)}},!1),m.addEventListener(\"error\",function(t){var r=ud[e];delete ud[e];for(var n=0,a=r.length;n<a;n++){var o=r[n];o.onError&&o.onError(t)}i.manager.itemError(e),i.manager.itemEnd(e)},!1),m.addEventListener(\"abort\",function(t){var r=ud[e];delete ud[e];for(var n=0,a=r.length;n<a;n++){var o=r[n];o.onError&&o.onError(t)}i.manager.itemError(e),i.manager.itemEnd(e)},!1),void 0!==this.responseType&&(m.responseType=this.responseType),void 0!==this.withCredentials&&(m.withCredentials=this.withCredentials),m.overrideMimeType&&m.overrideMimeType(void 0!==this.mimeType?this.mimeType:\"text\/plain\"),this.requestHeader)m.setRequestHeader(v,this.requestHeader[v]);m.send(null)}return i.manager.itemStart(e),m}ud[e].push({onLoad:t,onProgress:r,onError:n})},setResponseType:function(e){return this.responseType=e,this},setWithCredentials:function(e){return this.withCredentials=e,this},setMimeType:function(e){return this.mimeType=e,this},setRequestHeader:function(e){return this.requestHeader=e,this}}),dd.prototype=Object.assign(Object.create(hd.prototype),{constructor:dd,load:function(e,t,r,n){var i=this,a=new pd(i.manager);a.setPath(i.path),a.load(e,function(e){t(i.parse(JSON.parse(e)))},r,n)},parse:function(e){for(var t=[],r=0;r<e.length;r++){var n=id.parse(e[r]);t.push(n)}return t}}),fd.prototype=Object.assign(Object.create(hd.prototype),{constructor:fd,load:function(e,t,r,n){var i=this,a=[],o=new uu;o.image=a;var s=new pd(this.manager);function c(c){s.load(e[c],function(e){var r=i.parse(e,!0);a[c]={width:r.width,height:r.height,format:r.format,mipmaps:r.mipmaps},6===(l+=1)&&(1===r.mipmapCount&&(o.minFilter=xe),o.format=r.format,o.needsUpdate=!0,t&&t(o))},r,n)}if(s.setPath(this.path),s.setResponseType(\"arraybuffer\"),Array.isArray(e))for(var l=0,h=0,u=e.length;h<u;++h)c(h);else s.load(e,function(e){var r=i.parse(e,!0);if(r.isCubemap)for(var n=r.mipmaps.length\/r.mipmapCount,s=0;s<n;s++){a[s]={mipmaps:[]};for(var c=0;c<r.mipmapCount;c++)a[s].mipmaps.push(r.mipmaps[s*r.mipmapCount+c]),a[s].format=r.format,a[s].width=r.width,a[s].height=r.height}else o.image.width=r.width,o.image.height=r.height,o.mipmaps=r.mipmaps;1===r.mipmapCount&&(o.minFilter=xe),o.format=r.format,o.needsUpdate=!0,t&&t(o)},r,n);return o}}),md.prototype=Object.assign(Object.create(hd.prototype),{constructor:md,load:function(e,t,r,n){var i=this,a=new Ta,o=new pd(this.manager);return o.setResponseType(\"arraybuffer\"),o.setPath(this.path),o.load(e,function(e){var r=i.parse(e);r&&(void 0!==r.image?a.image=r.image:void 0!==r.data&&(a.image.width=r.width,a.image.height=r.height,a.image.data=r.data),a.wrapS=void 0!==r.wrapS?r.wrapS:pe,a.wrapT=void 0!==r.wrapT?r.wrapT:pe,a.magFilter=void 0!==r.magFilter?r.magFilter:xe,a.minFilter=void 0!==r.minFilter?r.minFilter:xe,a.anisotropy=void 0!==r.anisotropy?r.anisotropy:1,void 0!==r.format&&(a.format=r.format),void 0!==r.type&&(a.type=r.type),void 0!==r.mipmaps&&(a.mipmaps=r.mipmaps,a.minFilter=we),1===r.mipmapCount&&(a.minFilter=xe),a.needsUpdate=!0,t&&t(a,r))},r,n),a}}),vd.prototype=Object.assign(Object.create(hd.prototype),{constructor:vd,load:function(e,t,r,n){void 0!==this.path&&(e=this.path+e),e=this.manager.resolveURL(e);var i=this,a=sd.get(e);if(void 0!==a)return i.manager.itemStart(e),setTimeout(function(){t&&t(a),i.manager.itemEnd(e)},0),a;var o=document.createElementNS(\"http:\/\/www.w3.org\/1999\/xhtml\",\"img\");function s(){o.removeEventListener(\"load\",s,!1),o.removeEventListener(\"error\",c,!1),sd.add(e,this),t&&t(this),i.manager.itemEnd(e)}function c(t){o.removeEventListener(\"load\",s,!1),o.removeEventListener(\"error\",c,!1),n&&n(t),i.manager.itemError(e),i.manager.itemEnd(e)}return o.addEventListener(\"load\",s,!1),o.addEventListener(\"error\",c,!1),\"data:\"!==e.substr(0,5)&&void 0!==this.crossOrigin&&(o.crossOrigin=this.crossOrigin),i.manager.itemStart(e),o.src=e,o}}),gd.prototype=Object.assign(Object.create(hd.prototype),{constructor:gd,load:function(e,t,r,n){var i=new dc,a=new vd(this.manager);a.setCrossOrigin(this.crossOrigin),a.setPath(this.path);var o=0;function s(r){a.load(e[r],function(e){i.images[r]=e,6===++o&&(i.needsUpdate=!0,t&&t(i))},void 0,n)}for(var c=0;c<e.length;++c)s(c);return i}}),yd.prototype=Object.assign(Object.create(hd.prototype),{constructor:yd,load:function(e,t,r,n){var i=new zr,a=new vd(this.manager);return a.setCrossOrigin(this.crossOrigin),a.setPath(this.path),a.load(e,function(r){i.image=r;var n=e.search(\/.jpe?g($|?)\/i)>0||0===e.search(\/^data:image\/jpeg\/);i.format=n?Fe:Ue,i.needsUpdate=!0,void 0!==t&&t(i)},r,n),i}}),Object.assign(xd.prototype,{getPoint:function(){return console.warn(\"THREE.Curve: .getPoint() not implemented.\"),null},getPointAt:function(e,t){var r=this.getUtoTmapping(e);return this.getPoint(r,t)},getPoints:function(e){void 0===e&&(e=5);for(var t=[],r=0;r<=e;r++)t.push(this.getPoint(r\/e));return t},getSpacedPoints:function(e){void 0===e&&(e=5);for(var t=[],r=0;r<=e;r++)t.push(this.getPointAt(r\/e));return t},getLength:function(){var e=this.getLengths();return e[e.length-1]},getLengths:function(e){if(void 0===e&&(e=this.arcLengthDivisions),this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;var t,r,n=[],i=this.getPoint(0),a=0;for(n.push(0),r=1;r<=e;r++)a+=(t=this.getPoint(r\/e)).distanceTo(i),n.push(a),i=t;return this.cacheArcLengths=n,n},updateArcLengths:function(){this.needsUpdate=!0,this.getLengths()},getUtoTmapping:function(e,t){var r,n=this.getLengths(),i=0,a=n.length;r=t||e*n[a-1];for(var o,s=0,c=a-1;s<=c;)if((o=n[i=Math.floor(s+(c-s)\/2)]-r)<0)s=i+1;else{if(!(o>0)){c=i;break}c=i-1}if(n[i=c]===r)return i\/(a-1);var l=n[i];return(i+(r-l)\/(n[i+1]-l))\/(a-1)},getTangent:function(e){var t=e-1e-4,r=e+1e-4;t<0&&(t=0),r>1&&(r=1);var n=this.getPoint(t);return this.getPoint(r).clone().sub(n).normalize()},getTangentAt:function(e){var t=this.getUtoTmapping(e);return this.getTangent(t)},computeFrenetFrames:function(e,t){var r,n,i,a=new Xr,o=[],s=[],c=[],l=new Xr,h=new tn;for(r=0;r<=e;r++)n=r\/e,o[r]=this.getTangentAt(n),o[r].normalize();s[0]=new Xr,c[0]=new Xr;var u=Number.MAX_VALUE,p=Math.abs(o[0].x),d=Math.abs(o[0].y),f=Math.abs(o[0].z);for(p<=u&&(u=p,a.set(1,0,0)),d<=u&&(u=d,a.set(0,1,0)),f<=u&&a.set(0,0,1),l.crossVectors(o[0],a).normalize(),s[0].crossVectors(o[0],l),c[0].crossVectors(o[0],s[0]),r=1;r<=e;r++)s[r]=s[r-1].clone(),c[r]=c[r-1].clone(),l.crossVectors(o[r-1],o[r]),l.length()>Number.EPSILON&&(l.normalize(),i=Math.acos(Nr.clamp(o[r-1].dot(o[r]),-1,1)),s[r].applyMatrix4(h.makeRotationAxis(l,i))),c[r].crossVectors(o[r],s[r]);if(!0===t)for(i=Math.acos(Nr.clamp(s[0].dot(s[e]),-1,1)),i\/=e,o[0].dot(l.crossVectors(s[0],s[e]))>0&&(i=-i),r=1;r<=e;r++)s[r].applyMatrix4(h.makeRotationAxis(o[r],i*r)),c[r].crossVectors(o[r],s[r]);return{tangents:o,normals:s,binormals:c}},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.arcLengthDivisions=e.arcLengthDivisions,this},toJSON:function(){var e={metadata:{version:4.5,type:\"Curve\",generator:\"Curve.toJSON\"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e},fromJSON:function(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}}),_d.prototype=Object.create(xd.prototype),_d.prototype.constructor=_d,_d.prototype.isEllipseCurve=!0,_d.prototype.getPoint=function(e,t){for(var r=t||new Br,n=2*Math.PI,i=this.aEndAngle-this.aStartAngle,a=Math.abs(i)<Number.EPSILON;i<0;)i+=n;for(;i>n;)i-=n;i<Number.EPSILON&&(i=a?0:n),!0!==this.aClockwise||a||(i===n?i=-n:i-=n);var o=this.aStartAngle+e*i,s=this.aX+this.xRadius*Math.cos(o),c=this.aY+this.yRadius*Math.sin(o);if(0!==this.aRotation){var l=Math.cos(this.aRotation),h=Math.sin(this.aRotation),u=s-this.aX,p=c-this.aY;s=u*l-p*h+this.aX,c=u*h+p*l+this.aY}return r.set(s,c)},_d.prototype.copy=function(e){return xd.prototype.copy.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},_d.prototype.toJSON=function(){var e=xd.prototype.toJSON.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},_d.prototype.fromJSON=function(e){return xd.prototype.fromJSON.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},bd.prototype=Object.create(_d.prototype),bd.prototype.constructor=bd,bd.prototype.isArcCurve=!0;var Md=new Xr,Sd=new wd,Td=new wd,Ed=new wd;function Ad(e,t,r,n){xd.call(this),this.type=\"CatmullRomCurve3\",this.points=e||[],this.closed=t||!1,this.curveType=r||\"centripetal\",this.tension=n||.5}function Ld(e,t,r,n,i){var a=.5*(n-t),o=.5*(i-r),s=e*e;return(2*r-2*n+a+o)*(e*s)+(-3*r+3*n-2*a-o)*s+a*e+r}function Rd(e,t){var r=1-e;return r*r*t}function Cd(e,t){return 2*(1-e)*e*t}function Pd(e,t){return e*e*t}function Od(e,t,r,n){return Rd(e,t)+Cd(e,r)+Pd(e,n)}function Dd(e,t){var r=1-e;return r*r*r*t}function Id(e,t){var r=1-e;return 3*r*r*e*t}function Nd(e,t){return 3*(1-e)*e*e*t}function Bd(e,t){return e*e*e*t}function Fd(e,t,r,n,i){return Dd(e,t)+Id(e,r)+Nd(e,n)+Bd(e,i)}function Ud(e,t,r,n){xd.call(this),this.type=\"CubicBezierCurve\",this.v0=e||new Br,this.v1=t||new Br,this.v2=r||new Br,this.v3=n||new Br}function Gd(e,t,r,n){xd.call(this),this.type=\"CubicBezierCurve3\",this.v0=e||new Xr,this.v1=t||new Xr,this.v2=r||new Xr,this.v3=n||new Xr}function zd(e,t){xd.call(this),this.type=\"LineCurve\",this.v1=e||new Br,this.v2=t||new Br}function Hd(e,t){xd.call(this),this.type=\"LineCurve3\",this.v1=e||new Xr,this.v2=t||new Xr}function Vd(e,t,r){xd.call(this),this.type=\"QuadraticBezierCurve\",this.v0=e||new Br,this.v1=t||new Br,this.v2=r||new Br}function kd(e,t,r){xd.call(this),this.type=\"QuadraticBezierCurve3\",this.v0=e||new Xr,this.v1=t||new Xr,this.v2=r||new Xr}function jd(e){xd.call(this),this.type=\"SplineCurve\",this.points=e||[]}Ad.prototype=Object.create(xd.prototype),Ad.prototype.constructor=Ad,Ad.prototype.isCatmullRomCurve3=!0,Ad.prototype.getPoint=function(e,t){var r,n,i,a,o=t||new Xr,s=this.points,c=s.length,l=(c-(this.closed?0:1))*e,h=Math.floor(l),u=l-h;if(this.closed?h+=h>0?0:(Math.floor(Math.abs(h)\/c)+1)*c:0===u&&h===c-1&&(h=c-2,u=1),this.closed||h>0?r=s[(h-1)%c]:(Md.subVectors(s[0],s[1]).add(s[0]),r=Md),n=s[h%c],i=s[(h+1)%c],this.closed||h+2<c?a=s[(h+2)%c]:(Md.subVectors(s[c-1],s[c-2]).add(s[c-1]),a=Md),\"centripetal\"===this.curveType||\"chordal\"===this.curveType){var p=\"chordal\"===this.curveType?.5:.25,d=Math.pow(r.distanceToSquared(n),p),f=Math.pow(n.distanceToSquared(i),p),m=Math.pow(i.distanceToSquared(a),p);f<1e-4&&(f=1),d<1e-4&&(d=f),m<1e-4&&(m=f),Sd.initNonuniformCatmullRom(r.x,n.x,i.x,a.x,d,f,m),Td.initNonuniformCatmullRom(r.y,n.y,i.y,a.y,d,f,m),Ed.initNonuniformCatmullRom(r.z,n.z,i.z,a.z,d,f,m)}else\"catmullrom\"===this.curveType&&(Sd.initCatmullRom(r.x,n.x,i.x,a.x,this.tension),Td.initCatmullRom(r.y,n.y,i.y,a.y,this.tension),Ed.initCatmullRom(r.z,n.z,i.z,a.z,this.tension));return o.set(Sd.calc(u),Td.calc(u),Ed.calc(u)),o},Ad.prototype.copy=function(e){xd.prototype.copy.call(this,e),this.points=[];for(var t=0,r=e.points.length;t<r;t++){var n=e.points[t];this.points.push(n.clone())}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this},Ad.prototype.toJSON=function(){var e=xd.prototype.toJSON.call(this);e.points=[];for(var t=0,r=this.points.length;t<r;t++){var n=this.points[t];e.points.push(n.toArray())}return e.closed=this.closed,e.curveType=this.curveType,e.tension=this.tension,e},Ad.prototype.fromJSON=function(e){xd.prototype.fromJSON.call(this,e),this.points=[];for(var t=0,r=e.points.length;t<r;t++){var n=e.points[t];this.points.push((new Xr).fromArray(n))}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this},Ud.prototype=Object.create(xd.prototype),Ud.prototype.constructor=Ud,Ud.prototype.isCubicBezierCurve=!0,Ud.prototype.getPoint=function(e,t){var r=t||new Br,n=this.v0,i=this.v1,a=this.v2,o=this.v3;return r.set(Fd(e,n.x,i.x,a.x,o.x),Fd(e,n.y,i.y,a.y,o.y)),r},Ud.prototype.copy=function(e){return xd.prototype.copy.call(this,e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this},Ud.prototype.toJSON=function(){var e=xd.prototype.toJSON.call(this);return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e},Ud.prototype.fromJSON=function(e){return xd.prototype.fromJSON.call(this,e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this},Gd.prototype=Object.create(xd.prototype),Gd.prototype.constructor=Gd,Gd.prototype.isCubicBezierCurve3=!0,Gd.prototype.getPoint=function(e,t){var r=t||new Xr,n=this.v0,i=this.v1,a=this.v2,o=this.v3;return r.set(Fd(e,n.x,i.x,a.x,o.x),Fd(e,n.y,i.y,a.y,o.y),Fd(e,n.z,i.z,a.z,o.z)),r},Gd.prototype.copy=function(e){return xd.prototype.copy.call(this,e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this},Gd.prototype.toJSON=function(){var e=xd.prototype.toJSON.call(this);return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e},Gd.prototype.fromJSON=function(e){return xd.prototype.fromJSON.call(this,e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this},zd.prototype=Object.create(xd.prototype),zd.prototype.constructor=zd,zd.prototype.isLineCurve=!0,zd.prototype.getPoint=function(e,t){var r=t||new Br;return 1===e?r.copy(this.v2):(r.copy(this.v2).sub(this.v1),r.multiplyScalar(e).add(this.v1)),r},zd.prototype.getPointAt=function(e,t){return this.getPoint(e,t)},zd.prototype.getTangent=function(){return this.v2.clone().sub(this.v1).normalize()},zd.prototype.copy=function(e){return xd.prototype.copy.call(this,e),this.v1.copy(e.v1),this.v2.copy(e.v2),this},zd.prototype.toJSON=function(){var e=xd.prototype.toJSON.call(this);return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e},zd.prototype.fromJSON=function(e){return xd.prototype.fromJSON.call(this,e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this},Hd.prototype=Object.create(xd.prototype),Hd.prototype.constructor=Hd,Hd.prototype.isLineCurve3=!0,Hd.prototype.getPoint=function(e,t){var r=t||new Xr;return 1===e?r.copy(this.v2):(r.copy(this.v2).sub(this.v1),r.multiplyScalar(e).add(this.v1)),r},Hd.prototype.getPointAt=function(e,t){return this.getPoint(e,t)},Hd.prototype.copy=function(e){return xd.prototype.copy.call(this,e),this.v1.copy(e.v1),this.v2.copy(e.v2),this},Hd.prototype.toJSON=function(){var e=xd.prototype.toJSON.call(this);return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e},Hd.prototype.fromJSON=function(e){return xd.prototype.fromJSON.call(this,e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this},Vd.prototype=Object.create(xd.prototype),Vd.prototype.constructor=Vd,Vd.prototype.isQuadraticBezierCurve=!0,Vd.prototype.getPoint=function(e,t){var r=t||new Br,n=this.v0,i=this.v1,a=this.v2;return r.set(Od(e,n.x,i.x,a.x),Od(e,n.y,i.y,a.y)),r},Vd.prototype.copy=function(e){return xd.prototype.copy.call(this,e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this},Vd.prototype.toJSON=function(){var e=xd.prototype.toJSON.call(this);return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e},Vd.prototype.fromJSON=function(e){return xd.prototype.fromJSON.call(this,e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this},kd.prototype=Object.create(xd.prototype),kd.prototype.constructor=kd,kd.prototype.isQuadraticBezierCurve3=!0,kd.prototype.getPoint=function(e,t){var r=t||new Xr,n=this.v0,i=this.v1,a=this.v2;return r.set(Od(e,n.x,i.x,a.x),Od(e,n.y,i.y,a.y),Od(e,n.z,i.z,a.z)),r},kd.prototype.copy=function(e){return xd.prototype.copy.call(this,e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this},kd.prototype.toJSON=function(){var e=xd.prototype.toJSON.call(this);return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e},kd.prototype.fromJSON=function(e){return xd.prototype.fromJSON.call(this,e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this},jd.prototype=Object.create(xd.prototype),jd.prototype.constructor=jd,jd.prototype.isSplineCurve=!0,jd.prototype.getPoint=function(e,t){var r=t||new Br,n=this.points,i=(n.length-1)*e,a=Math.floor(i),o=i-a,s=n[0===a?a:a-1],c=n[a],l=n[a>n.length-2?n.length-1:a+1],h=n[a>n.length-3?n.length-1:a+2];return r.set(Ld(o,s.x,c.x,l.x,h.x),Ld(o,s.y,c.y,l.y,h.y)),r},jd.prototype.copy=function(e){xd.prototype.copy.call(this,e),this.points=[];for(var t=0,r=e.points.length;t<r;t++){var n=e.points[t];this.points.push(n.clone())}return this},jd.prototype.toJSON=function(){var e=xd.prototype.toJSON.call(this);e.points=[];for(var t=0,r=this.points.length;t<r;t++){var n=this.points[t];e.points.push(n.toArray())}return e},jd.prototype.fromJSON=function(e){xd.prototype.fromJSON.call(this,e),this.points=[];for(var t=0,r=e.points.length;t<r;t++){var n=e.points[t];this.points.push((new Br).fromArray(n))}return this};var Wd=Object.freeze({__proto__:null,ArcCurve:bd,CatmullRomCurve3:Ad,CubicBezierCurve:Ud,CubicBezierCurve3:Gd,EllipseCurve:_d,LineCurve:zd,LineCurve3:Hd,QuadraticBezierCurve:Vd,QuadraticBezierCurve3:kd,SplineCurve:jd});function qd(){xd.call(this),this.type=\"CurvePath\",this.curves=[],this.autoClose=!1}function Xd(e){qd.call(this),this.type=\"Path\",this.currentPoint=new Br,e&&this.setFromPoints(e)}function Yd(e){Xd.call(this,e),this.uuid=Nr.generateUUID(),this.type=\"Shape\",this.holes=[]}function Zd(e,t){_n.call(this),this.type=\"Light\",this.color=new ui(e),this.intensity=void 0!==t?t:1,this.receiveShadow=void 0}function Jd(e,t,r){Zd.call(this,e,r),this.type=\"HemisphereLight\",this.castShadow=void 0,this.position.copy(_n.DefaultUp),this.updateMatrix(),this.groundColor=new ui(t)}function Qd(e){this.camera=e,this.bias=0,this.radius=1,this.mapSize=new Br(512,512),this.map=null,this.mapPass=null,this.matrix=new tn,this._frustum=new La,this._frameExtents=new Br(1,1),this._viewportCount=1,this._viewports=[new Hr(0,0,1,1)]}function Kd(){Qd.call(this,new _a(50,1,.5,500))}function $d(e,t,r,n,i,a){Zd.call(this,e,t),this.type=\"SpotLight\",this.position.copy(_n.DefaultUp),this.updateMatrix(),this.target=new _n,Object.defineProperty(this,\"power\",{get:function(){return this.intensity*Math.PI},set:function(e){this.intensity=e\/Math.PI}}),this.distance=void 0!==r?r:0,this.angle=void 0!==n?n:Math.PI\/3,this.penumbra=void 0!==i?i:0,this.decay=void 0!==a?a:1,this.shadow=new Kd}function ef(){Qd.call(this,new _a(90,1,.5,500)),this._frameExtents=new Br(4,2),this._viewportCount=6,this._viewports=[new Hr(2,1,1,1),new Hr(0,1,1,1),new Hr(3,1,1,1),new Hr(1,1,1,1),new Hr(3,0,1,1),new Hr(1,0,1,1)],this._cubeDirections=[new Xr(1,0,0),new Xr(-1,0,0),new Xr(0,0,1),new Xr(0,0,-1),new Xr(0,1,0),new Xr(0,-1,0)],this._cubeUps=[new Xr(0,1,0),new Xr(0,1,0),new Xr(0,1,0),new Xr(0,1,0),new Xr(0,0,1),new Xr(0,0,-1)]}function tf(e,t,r,n){Zd.call(this,e,t),this.type=\"PointLight\",Object.defineProperty(this,\"power\",{get:function(){return 4*this.intensity*Math.PI},set:function(e){this.intensity=e\/(4*Math.PI)}}),this.distance=void 0!==r?r:0,this.decay=void 0!==n?n:1,this.shadow=new ef}function rf(e,t,r,n,i,a){xa.call(this),this.type=\"OrthographicCamera\",this.zoom=1,this.view=null,this.left=void 0!==e?e:-1,this.right=void 0!==t?t:1,this.top=void 0!==r?r:1,this.bottom=void 0!==n?n:-1,this.near=void 0!==i?i:.1,this.far=void 0!==a?a:2e3,this.updateProjectionMatrix()}function nf(){Qd.call(this,new rf(-5,5,5,-5,.5,500))}function af(e,t){Zd.call(this,e,t),this.type=\"DirectionalLight\",this.position.copy(_n.DefaultUp),this.updateMatrix(),this.target=new _n,this.shadow=new nf}function of(e,t){Zd.call(this,e,t),this.type=\"AmbientLight\",this.castShadow=void 0}function sf(e,t,r,n){Zd.call(this,e,t),this.type=\"RectAreaLight\",this.width=void 0!==r?r:10,this.height=void 0!==n?n:10}function cf(e){hd.call(this,e),this.textures={}}qd.prototype=Object.assign(Object.create(xd.prototype),{constructor:qd,add:function(e){this.curves.push(e)},closePath:function(){var e=this.curves[0].getPoint(0),t=this.curves[this.curves.length-1].getPoint(1);e.equals(t)||this.curves.push(new zd(t,e))},getPoint:function(e){for(var t=e*this.getLength(),r=this.getCurveLengths(),n=0;n<r.length;){if(r[n]>=t){var i=r[n]-t,a=this.curves[n],o=a.getLength(),s=0===o?0:1-i\/o;return a.getPointAt(s)}n++}return null},getLength:function(){var e=this.getCurveLengths();return e[e.length-1]},updateArcLengths:function(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()},getCurveLengths:function(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;for(var e=[],t=0,r=0,n=this.curves.length;r<n;r++)t+=this.curves[r].getLength(),e.push(t);return this.cacheLengths=e,e},getSpacedPoints:function(e){void 0===e&&(e=40);for(var t=[],r=0;r<=e;r++)t.push(this.getPoint(r\/e));return this.autoClose&&t.push(t[0]),t},getPoints:function(e){e=e||12;for(var t,r=[],n=0,i=this.curves;n<i.length;n++)for(var a=i[n],o=a&&a.isEllipseCurve?2*e:a&&(a.isLineCurve||a.isLineCurve3)?1:a&&a.isSplineCurve?e*a.points.length:e,s=a.getPoints(o),c=0;c<s.length;c++){var l=s[c];t&&t.equals(l)||(r.push(l),t=l)}return this.autoClose&&r.length>1&&!r[r.length-1].equals(r[0])&&r.push(r[0]),r},copy:function(e){xd.prototype.copy.call(this,e),this.curves=[];for(var t=0,r=e.curves.length;t<r;t++){var n=e.curves[t];this.curves.push(n.clone())}return this.autoClose=e.autoClose,this},toJSON:function(){var e=xd.prototype.toJSON.call(this);e.autoClose=this.autoClose,e.curves=[];for(var t=0,r=this.curves.length;t<r;t++){var n=this.curves[t];e.curves.push(n.toJSON())}return e},fromJSON:function(e){xd.prototype.fromJSON.call(this,e),this.autoClose=e.autoClose,this.curves=[];for(var t=0,r=e.curves.length;t<r;t++){var n=e.curves[t];this.curves.push((new Wd[n.type]).fromJSON(n))}return this}}),Xd.prototype=Object.assign(Object.create(qd.prototype),{constructor:Xd,setFromPoints:function(e){this.moveTo(e[0].x,e[0].y);for(var t=1,r=e.length;t<r;t++)this.lineTo(e[t].x,e[t].y);return this},moveTo:function(e,t){return this.currentPoint.set(e,t),this},lineTo:function(e,t){var r=new zd(this.currentPoint.clone(),new Br(e,t));return this.curves.push(r),this.currentPoint.set(e,t),this},quadraticCurveTo:function(e,t,r,n){var i=new Vd(this.currentPoint.clone(),new Br(e,t),new Br(r,n));return this.curves.push(i),this.currentPoint.set(r,n),this},bezierCurveTo:function(e,t,r,n,i,a){var o=new Ud(this.currentPoint.clone(),new Br(e,t),new Br(r,n),new Br(i,a));return this.curves.push(o),this.currentPoint.set(i,a),this},splineThru:function(e){var t=new jd([this.currentPoint.clone()].concat(e));return this.curves.push(t),this.currentPoint.copy(e[e.length-1]),this},arc:function(e,t,r,n,i,a){var o=this.currentPoint.x,s=this.currentPoint.y;return this.absarc(e+o,t+s,r,n,i,a),this},absarc:function(e,t,r,n,i,a){return this.absellipse(e,t,r,r,n,i,a),this},ellipse:function(e,t,r,n,i,a,o,s){var c=this.currentPoint.x,l=this.currentPoint.y;return this.absellipse(e+c,t+l,r,n,i,a,o,s),this},absellipse:function(e,t,r,n,i,a,o,s){var c=new _d(e,t,r,n,i,a,o,s);if(this.curves.length>0){var l=c.getPoint(0);l.equals(this.currentPoint)||this.lineTo(l.x,l.y)}this.curves.push(c);var h=c.getPoint(1);return this.currentPoint.copy(h),this},copy:function(e){return qd.prototype.copy.call(this,e),this.currentPoint.copy(e.currentPoint),this},toJSON:function(){var e=qd.prototype.toJSON.call(this);return e.currentPoint=this.currentPoint.toArray(),e},fromJSON:function(e){return qd.prototype.fromJSON.call(this,e),this.currentPoint.fromArray(e.currentPoint),this}}),Yd.prototype=Object.assign(Object.create(Xd.prototype),{constructor:Yd,getPointsHoles:function(e){for(var t=[],r=0,n=this.holes.length;r<n;r++)t[r]=this.holes[r].getPoints(e);return t},extractPoints:function(e){return{shape:this.getPoints(e),holes:this.getPointsHoles(e)}},copy:function(e){Xd.prototype.copy.call(this,e),this.holes=[];for(var t=0,r=e.holes.length;t<r;t++){var n=e.holes[t];this.holes.push(n.clone())}return this},toJSON:function(){var e=Xd.prototype.toJSON.call(this);e.uuid=this.uuid,e.holes=[];for(var t=0,r=this.holes.length;t<r;t++){var n=this.holes[t];e.holes.push(n.toJSON())}return e},fromJSON:function(e){Xd.prototype.fromJSON.call(this,e),this.uuid=e.uuid,this.holes=[];for(var t=0,r=e.holes.length;t<r;t++){var n=e.holes[t];this.holes.push((new Xd).fromJSON(n))}return this}}),Zd.prototype=Object.assign(Object.create(_n.prototype),{constructor:Zd,isLight:!0,copy:function(e){return _n.prototype.copy.call(this,e),this.color.copy(e.color),this.intensity=e.intensity,this},toJSON:function(e){var t=_n.prototype.toJSON.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}}),Jd.prototype=Object.assign(Object.create(Zd.prototype),{constructor:Jd,isHemisphereLight:!0,copy:function(e){return Zd.prototype.copy.call(this,e),this.groundColor.copy(e.groundColor),this}}),Object.assign(Qd.prototype,{_projScreenMatrix:new tn,_lightPositionWorld:new Xr,_lookTarget:new Xr,getViewportCount:function(){return this._viewportCount},getFrustum:function(){return this._frustum},updateMatrices:function(e){var t=this.camera,r=this.matrix,n=this._projScreenMatrix,i=this._lookTarget,a=this._lightPositionWorld;a.setFromMatrixPosition(e.matrixWorld),t.position.copy(a),i.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(i),t.updateMatrixWorld(),n.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(n),r.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),r.multiply(t.projectionMatrix),r.multiply(t.matrixWorldInverse)},getViewport:function(e){return this._viewports[e]},getFrameExtents:function(){return this._frameExtents},copy:function(e){return this.camera=e.camera.clone(),this.bias=e.bias,this.radius=e.radius,this.mapSize.copy(e.mapSize),this},clone:function(){return(new this.constructor).copy(this)},toJSON:function(){var e={};return 0!==this.bias&&(e.bias=this.bias),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}}),Kd.prototype=Object.assign(Object.create(Qd.prototype),{constructor:Kd,isSpotLightShadow:!0,updateMatrices:function(e){var t=this.camera,r=2*Nr.RAD2DEG*e.angle,n=this.mapSize.width\/this.mapSize.height,i=e.distance||t.far;r===t.fov&&n===t.aspect&&i===t.far||(t.fov=r,t.aspect=n,t.far=i,t.updateProjectionMatrix()),Qd.prototype.updateMatrices.call(this,e)}}),$d.prototype=Object.assign(Object.create(Zd.prototype),{constructor:$d,isSpotLight:!0,copy:function(e){return Zd.prototype.copy.call(this,e),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}}),ef.prototype=Object.assign(Object.create(Qd.prototype),{constructor:ef,isPointLightShadow:!0,updateMatrices:function(e,t){void 0===t&&(t=0);var r=this.camera,n=this.matrix,i=this._lightPositionWorld,a=this._lookTarget,o=this._projScreenMatrix;i.setFromMatrixPosition(e.matrixWorld),r.position.copy(i),a.copy(r.position),a.add(this._cubeDirections[t]),r.up.copy(this._cubeUps[t]),r.lookAt(a),r.updateMatrixWorld(),n.makeTranslation(-i.x,-i.y,-i.z),o.multiplyMatrices(r.projectionMatrix,r.matrixWorldInverse),this._frustum.setFromProjectionMatrix(o)}}),tf.prototype=Object.assign(Object.create(Zd.prototype),{constructor:tf,isPointLight:!0,copy:function(e){return Zd.prototype.copy.call(this,e),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}}),rf.prototype=Object.assign(Object.create(xa.prototype),{constructor:rf,isOrthographicCamera:!0,copy:function(e,t){return xa.prototype.copy.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},setViewOffset:function(e,t,r,n,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=r,this.view.offsetY=n,this.view.width=i,this.view.height=a,this.updateProjectionMatrix()},clearViewOffset:function(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()},updateProjectionMatrix:function(){var e=(this.right-this.left)\/(2*this.zoom),t=(this.top-this.bottom)\/(2*this.zoom),r=(this.right+this.left)\/2,n=(this.top+this.bottom)\/2,i=r-e,a=r+e,o=n+t,s=n-t;if(null!==this.view&&this.view.enabled){var c=(this.right-this.left)\/this.view.fullWidth\/this.zoom,l=(this.top-this.bottom)\/this.view.fullHeight\/this.zoom;a=(i+=c*this.view.offsetX)+c*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.projectionMatrixInverse.getInverse(this.projectionMatrix)},toJSON:function(e){var t=_n.prototype.toJSON.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}}),nf.prototype=Object.assign(Object.create(Qd.prototype),{constructor:nf,isDirectionalLightShadow:!0,updateMatrices:function(e){Qd.prototype.updateMatrices.call(this,e)}}),af.prototype=Object.assign(Object.create(Zd.prototype),{constructor:af,isDirectionalLight:!0,copy:function(e){return Zd.prototype.copy.call(this,e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}),of.prototype=Object.assign(Object.create(Zd.prototype),{constructor:of,isAmbientLight:!0}),sf.prototype=Object.assign(Object.create(Zd.prototype),{constructor:sf,isRectAreaLight:!0,copy:function(e){return Zd.prototype.copy.call(this,e),this.width=e.width,this.height=e.height,this},toJSON:function(e){var t=Zd.prototype.toJSON.call(this,e);return t.object.width=this.width,t.object.height=this.height,t}}),cf.prototype=Object.assign(Object.create(hd.prototype),{constructor:cf,load:function(e,t,r,n){var i=this,a=new pd(i.manager);a.setPath(i.path),a.load(e,function(e){t(i.parse(JSON.parse(e)))},r,n)},parse:function(e){var t=this.textures;function r(e){return void 0===t[e]&&console.warn(\"THREE.MaterialLoader: Undefined texture\",e),t[e]}var n=new jp[e.type];if(void 0!==e.uuid&&(n.uuid=e.uuid),void 0!==e.name&&(n.name=e.name),void 0!==e.color&&n.color.setHex(e.color),void 0!==e.roughness&&(n.roughness=e.roughness),void 0!==e.metalness&&(n.metalness=e.metalness),void 0!==e.sheen&&(n.sheen=(new ui).setHex(e.sheen)),void 0!==e.emissive&&n.emissive.setHex(e.emissive),void 0!==e.specular&&n.specular.setHex(e.specular),void 0!==e.shininess&&(n.shininess=e.shininess),void 0!==e.clearcoat&&(n.clearcoat=e.clearcoat),void 0!==e.clearcoatRoughness&&(n.clearcoatRoughness=e.clearcoatRoughness),void 0!==e.fog&&(n.fog=e.fog),void 0!==e.flatShading&&(n.flatShading=e.flatShading),void 0!==e.blending&&(n.blending=e.blending),void 0!==e.combine&&(n.combine=e.combine),void 0!==e.side&&(n.side=e.side),void 0!==e.opacity&&(n.opacity=e.opacity),void 0!==e.transparent&&(n.transparent=e.transparent),void 0!==e.alphaTest&&(n.alphaTest=e.alphaTest),void 0!==e.depthTest&&(n.depthTest=e.depthTest),void 0!==e.depthWrite&&(n.depthWrite=e.depthWrite),void 0!==e.colorWrite&&(n.colorWrite=e.colorWrite),void 0!==e.stencilWrite&&(n.stencilWrite=e.stencilWrite),void 0!==e.stencilWriteMask&&(n.stencilWriteMask=e.stencilWriteMask),void 0!==e.stencilFunc&&(n.stencilFunc=e.stencilFunc),void 0!==e.stencilRef&&(n.stencilRef=e.stencilRef),void 0!==e.stencilFuncMask&&(n.stencilFuncMask=e.stencilFuncMask),void 0!==e.stencilFail&&(n.stencilFail=e.stencilFail),void 0!==e.stencilZFail&&(n.stencilZFail=e.stencilZFail),void 0!==e.stencilZPass&&(n.stencilZPass=e.stencilZPass),void 0!==e.wireframe&&(n.wireframe=e.wireframe),void 0!==e.wireframeLinewidth&&(n.wireframeLinewidth=e.wireframeLinewidth),void 0!==e.wireframeLinecap&&(n.wireframeLinecap=e.wireframeLinecap),void 0!==e.wireframeLinejoin&&(n.wireframeLinejoin=e.wireframeLinejoin),void 0!==e.rotation&&(n.rotation=e.rotation),1!==e.linewidth&&(n.linewidth=e.linewidth),void 0!==e.dashSize&&(n.dashSize=e.dashSize),void 0!==e.gapSize&&(n.gapSize=e.gapSize),void 0!==e.scale&&(n.scale=e.scale),void 0!==e.polygonOffset&&(n.polygonOffset=e.polygonOffset),void 0!==e.polygonOffsetFactor&&(n.polygonOffsetFactor=e.polygonOffsetFactor),void 0!==e.polygonOffsetUnits&&(n.polygonOffsetUnits=e.polygonOffsetUnits),void 0!==e.skinning&&(n.skinning=e.skinning),void 0!==e.morphTargets&&(n.morphTargets=e.morphTargets),void 0!==e.morphNormals&&(n.morphNormals=e.morphNormals),void 0!==e.dithering&&(n.dithering=e.dithering),void 0!==e.vertexTangents&&(n.vertexTangents=e.vertexTangents),void 0!==e.visible&&(n.visible=e.visible),void 0!==e.toneMapped&&(n.toneMapped=e.toneMapped),void 0!==e.userData&&(n.userData=e.userData),void 0!==e.vertexColors&&(\"number\"==typeof e.vertexColors?n.vertexColors=e.vertexColors>0:n.vertexColors=e.vertexColors),void 0!==e.uniforms)for(var i in e.uniforms){var a=e.uniforms[i];switch(n.uniforms[i]={},a.type){case\"t\":n.uniforms[i].value=r(a.value);break;case\"c\":n.uniforms[i].value=(new ui).setHex(a.value);break;case\"v2\":n.uniforms[i].value=(new Br).fromArray(a.value);break;case\"v3\":n.uniforms[i].value=(new Xr).fromArray(a.value);break;case\"v4\":n.uniforms[i].value=(new Hr).fromArray(a.value);break;case\"m3\":n.uniforms[i].value=(new Fr).fromArray(a.value);case\"m4\":n.uniforms[i].value=(new tn).fromArray(a.value);break;default:n.uniforms[i].value=a.value}}if(void 0!==e.defines&&(n.defines=e.defines),void 0!==e.vertexShader&&(n.vertexShader=e.vertexShader),void 0!==e.fragmentShader&&(n.fragmentShader=e.fragmentShader),void 0!==e.extensions)for(var o in e.extensions)n.extensions[o]=e.extensions[o];if(void 0!==e.shading&&(n.flatShading=1===e.shading),void 0!==e.size&&(n.size=e.size),void 0!==e.sizeAttenuation&&(n.sizeAttenuation=e.sizeAttenuation),void 0!==e.map&&(n.map=r(e.map)),void 0!==e.matcap&&(n.matcap=r(e.matcap)),void 0!==e.alphaMap&&(n.alphaMap=r(e.alphaMap)),void 0!==e.bumpMap&&(n.bumpMap=r(e.bumpMap)),void 0!==e.bumpScale&&(n.bumpScale=e.bumpScale),void 0!==e.normalMap&&(n.normalMap=r(e.normalMap)),void 0!==e.normalMapType&&(n.normalMapType=e.normalMapType),void 0!==e.normalScale){var s=e.normalScale;!1===Array.isArray(s)&&(s=[s,s]),n.normalScale=(new Br).fromArray(s)}return void 0!==e.displacementMap&&(n.displacementMap=r(e.displacementMap)),void 0!==e.displacementScale&&(n.displacementScale=e.displacementScale),void 0!==e.displacementBias&&(n.displacementBias=e.displacementBias),void 0!==e.roughnessMap&&(n.roughnessMap=r(e.roughnessMap)),void 0!==e.metalnessMap&&(n.metalnessMap=r(e.metalnessMap)),void 0!==e.emissiveMap&&(n.emissiveMap=r(e.emissiveMap)),void 0!==e.emissiveIntensity&&(n.emissiveIntensity=e.emissiveIntensity),void 0!==e.specularMap&&(n.specularMap=r(e.specularMap)),void 0!==e.envMap&&(n.envMap=r(e.envMap)),void 0!==e.envMapIntensity&&(n.envMapIntensity=e.envMapIntensity),void 0!==e.reflectivity&&(n.reflectivity=e.reflectivity),void 0!==e.refractionRatio&&(n.refractionRatio=e.refractionRatio),void 0!==e.lightMap&&(n.lightMap=r(e.lightMap)),void 0!==e.lightMapIntensity&&(n.lightMapIntensity=e.lightMapIntensity),void 0!==e.aoMap&&(n.aoMap=r(e.aoMap)),void 0!==e.aoMapIntensity&&(n.aoMapIntensity=e.aoMapIntensity),void 0!==e.gradientMap&&(n.gradientMap=r(e.gradientMap)),void 0!==e.clearcoatMap&&(n.clearcoatMap=r(e.clearcoatMap)),void 0!==e.clearcoatRoughnessMap&&(n.clearcoatRoughnessMap=r(e.clearcoatRoughnessMap)),void 0!==e.clearcoatNormalMap&&(n.clearcoatNormalMap=r(e.clearcoatNormalMap)),void 0!==e.clearcoatNormalScale&&(n.clearcoatNormalScale=(new Br).fromArray(e.clearcoatNormalScale)),n},setTextures:function(e){return this.textures=e,this}});var lf={decodeText:function(e){if(\"undefined\"!=typeof TextDecoder)return(new TextDecoder).decode(e);for(var t=\"\",r=0,n=e.length;r<n;r++)t+=String.fromCharCode(e[r]);try{return decodeURIComponent(escape(t))}catch(i){return t}},extractUrlBase:function(e){var t=e.lastIndexOf(\"\/\");return-1===t?\".\/\":e.substr(0,t+1)}};function hf(){Gi.call(this),this.type=\"InstancedBufferGeometry\",this.maxInstancedCount=void 0}function uf(e,t,r,n){\"number\"==typeof r&&(n=r,r=!1,console.error(\"THREE.InstancedBufferAttribute: The constructor now expects normalized as the third argument.\")),_i.call(this,e,t,r),this.meshPerAttribute=n||1}function pf(e){hd.call(this,e)}exports.LoaderUtils=lf,hf.prototype=Object.assign(Object.create(Gi.prototype),{constructor:hf,isInstancedBufferGeometry:!0,copy:function(e){return Gi.prototype.copy.call(this,e),this.maxInstancedCount=e.maxInstancedCount,this},clone:function(){return(new this.constructor).copy(this)},toJSON:function(){var e=Gi.prototype.toJSON.call(this);return e.maxInstancedCount=this.maxInstancedCount,e.isInstancedBufferGeometry=!0,e}}),uf.prototype=Object.assign(Object.create(_i.prototype),{constructor:uf,isInstancedBufferAttribute:!0,copy:function(e){return _i.prototype.copy.call(this,e),this.meshPerAttribute=e.meshPerAttribute,this},toJSON:function(){var e=_i.prototype.toJSON.call(this);return e.meshPerAttribute=this.meshPerAttribute,e.isInstancedBufferAttribute=!0,e}}),pf.prototype=Object.assign(Object.create(hd.prototype),{constructor:pf,load:function(e,t,r,n){var i=this,a=new pd(i.manager);a.setPath(i.path),a.load(e,function(e){t(i.parse(JSON.parse(e)))},r,n)},parse:function(e){var t=e.isInstancedBufferGeometry?new hf:new Gi,r=e.data.index;if(void 0!==r){var n=new df[r.type](r.array);t.setIndex(new _i(n,1))}var i=e.data.attributes;for(var a in i){var o=i[a],s=(n=new df[o.type](o.array),new(o.isInstancedBufferAttribute?uf:_i)(n,o.itemSize,o.normalized));void 0!==o.name&&(s.name=o.name),t.setAttribute(a,s)}var c=e.data.morphAttributes;if(c)for(var a in c){for(var l=c[a],h=[],u=0,p=l.length;u<p;u++){o=l[u],s=new _i(n=new df[o.type](o.array),o.itemSize,o.normalized);void 0!==o.name&&(s.name=o.name),h.push(s)}t.morphAttributes[a]=h}e.data.morphTargetsRelative&&(t.morphTargetsRelative=!0);var d=e.data.groups||e.data.drawcalls||e.data.offsets;if(void 0!==d){u=0;for(var f=d.length;u!==f;++u){var m=d[u];t.addGroup(m.start,m.count,m.materialIndex)}}var v=e.data.boundingSphere;if(void 0!==v){var g=new Xr;void 0!==v.center&&g.fromArray(v.center),t.boundingSphere=new Un(g,v.radius)}return e.name&&(t.name=e.name),e.userData&&(t.userData=e.userData),t}});var df={Int8Array:Int8Array,Uint8Array:Uint8Array,Uint8ClampedArray:\"undefined\"!=typeof Uint8ClampedArray?Uint8ClampedArray:Uint8Array,Int16Array:Int16Array,Uint16Array:Uint16Array,Int32Array:Int32Array,Uint32Array:Uint32Array,Float32Array:Float32Array,Float64Array:Float64Array};function ff(e){hd.call(this,e)}ff.prototype=Object.assign(Object.create(hd.prototype),{constructor:ff,load:function(e,t,r,n){var i=this,a=\"\"===this.path?lf.extractUrlBase(e):this.path;this.resourcePath=this.resourcePath||a;var o=new pd(i.manager);o.setPath(this.path),o.load(e,function(r){var a=null;try{a=JSON.parse(r)}catch(s){return void 0!==n&&n(s),void console.error(\"THREE:ObjectLoader: Can't parse \"+e+\".\",s.message)}var o=a.metadata;void 0!==o&&void 0!==o.type&&\"geometry\"!==o.type.toLowerCase()?i.parse(a,t):console.error(\"THREE.ObjectLoader: Can't load \"+e)},r,n)},parse:function(e,t){var r=this.parseShape(e.shapes),n=this.parseGeometries(e.geometries,r),i=this.parseImages(e.images,function(){void 0!==t&&t(s)}),a=this.parseTextures(e.textures,i),o=this.parseMaterials(e.materials,a),s=this.parseObject(e.object,n,o);return e.animations&&(s.animations=this.parseAnimations(e.animations)),void 0!==e.images&&0!==e.images.length||void 0!==t&&t(s),s},parseShape:function(e){var t={};if(void 0!==e)for(var r=0,n=e.length;r<n;r++){var i=(new Yd).fromJSON(e[r]);t[i.uuid]=i}return t},parseGeometries:function(e,t){var r={};if(void 0!==e)for(var n=new pf,i=0,a=e.length;i<a;i++){var o,s=e[i];switch(s.type){case\"PlaneGeometry\":case\"PlaneBufferGeometry\":o=new Dp[s.type](s.width,s.height,s.widthSegments,s.heightSegments);break;case\"BoxGeometry\":case\"BoxBufferGeometry\":case\"CubeGeometry\":o=new Dp[s.type](s.width,s.height,s.depth,s.widthSegments,s.heightSegments,s.depthSegments);break;case\"CircleGeometry\":case\"CircleBufferGeometry\":o=new Dp[s.type](s.radius,s.segments,s.thetaStart,s.thetaLength);break;case\"CylinderGeometry\":case\"CylinderBufferGeometry\":o=new Dp[s.type](s.radiusTop,s.radiusBottom,s.height,s.radialSegments,s.heightSegments,s.openEnded,s.thetaStart,s.thetaLength);break;case\"ConeGeometry\":case\"ConeBufferGeometry\":o=new Dp[s.type](s.radius,s.height,s.radialSegments,s.heightSegments,s.openEnded,s.thetaStart,s.thetaLength);break;case\"SphereGeometry\":case\"SphereBufferGeometry\":o=new Dp[s.type](s.radius,s.widthSegments,s.heightSegments,s.phiStart,s.phiLength,s.thetaStart,s.thetaLength);break;case\"DodecahedronGeometry\":case\"DodecahedronBufferGeometry\":case\"IcosahedronGeometry\":case\"IcosahedronBufferGeometry\":case\"OctahedronGeometry\":case\"OctahedronBufferGeometry\":case\"TetrahedronGeometry\":case\"TetrahedronBufferGeometry\":o=new Dp[s.type](s.radius,s.detail);break;case\"RingGeometry\":case\"RingBufferGeometry\":o=new Dp[s.type](s.innerRadius,s.outerRadius,s.thetaSegments,s.phiSegments,s.thetaStart,s.thetaLength);break;case\"TorusGeometry\":case\"TorusBufferGeometry\":o=new Dp[s.type](s.radius,s.tube,s.radialSegments,s.tubularSegments,s.arc);break;case\"TorusKnotGeometry\":case\"TorusKnotBufferGeometry\":o=new Dp[s.type](s.radius,s.tube,s.tubularSegments,s.radialSegments,s.p,s.q);break;case\"TubeGeometry\":case\"TubeBufferGeometry\":o=new Dp[s.type]((new Wd[s.path.type]).fromJSON(s.path),s.tubularSegments,s.radius,s.radialSegments,s.closed);break;case\"LatheGeometry\":case\"LatheBufferGeometry\":o=new Dp[s.type](s.points,s.segments,s.phiStart,s.phiLength);break;case\"PolyhedronGeometry\":case\"PolyhedronBufferGeometry\":o=new Dp[s.type](s.vertices,s.indices,s.radius,s.details);break;case\"ShapeGeometry\":case\"ShapeBufferGeometry\":for(var c=[],l=0,h=s.shapes.length;l<h;l++){var u=t[s.shapes[l]];c.push(u)}o=new Dp[s.type](c,s.curveSegments);break;case\"ExtrudeGeometry\":case\"ExtrudeBufferGeometry\":for(c=[],l=0,h=s.shapes.length;l<h;l++){u=t[s.shapes[l]];c.push(u)}var p=s.options.extrudePath;void 0!==p&&(s.options.extrudePath=(new Wd[p.type]).fromJSON(p)),o=new Dp[s.type](c,s.options);break;case\"BufferGeometry\":case\"InstancedBufferGeometry\":o=n.parse(s);break;case\"Geometry\":console.error('THREE.ObjectLoader: Loading \"Geometry\" is not supported anymore.');break;default:console.warn('THREE.ObjectLoader: Unsupported geometry type \"'+s.type+'\"');continue}o.uuid=s.uuid,void 0!==s.name&&(o.name=s.name),!0===o.isBufferGeometry&&void 0!==s.userData&&(o.userData=s.userData),r[s.uuid]=o}return r},parseMaterials:function(e,t){var r={},n={};if(void 0!==e){var i=new cf;i.setTextures(t);for(var a=0,o=e.length;a<o;a++){var s=e[a];if(\"MultiMaterial\"===s.type){for(var c=[],l=0;l<s.materials.length;l++){var h=s.materials[l];void 0===r[h.uuid]&&(r[h.uuid]=i.parse(h)),c.push(r[h.uuid])}n[s.uuid]=c}else void 0===r[s.uuid]&&(r[s.uuid]=i.parse(s)),n[s.uuid]=r[s.uuid]}}return n},parseAnimations:function(e){for(var t=[],r=0;r<e.length;r++){var n=e[r],i=id.parse(n);void 0!==n.uuid&&(i.uuid=n.uuid),t.push(i)}return t},parseImages:function(e,t){var r=this,n={};function i(e){return r.manager.itemStart(e),a.load(e,function(){r.manager.itemEnd(e)},void 0,function(){r.manager.itemError(e),r.manager.itemEnd(e)})}if(void 0!==e&&e.length>0){var a=new vd(new cd(t));a.setCrossOrigin(this.crossOrigin);for(var o=0,s=e.length;o<s;o++){var c=e[o],l=c.url;if(Array.isArray(l)){n[c.uuid]=[];for(var h=0,u=l.length;h<u;h++){var p=l[h],d=\/^(\/\/)|([a-z]+:(\/\/)?)\/i.test(p)?p:r.resourcePath+p;n[c.uuid].push(i(d))}}else{d=\/^(\/\/)|([a-z]+:(\/\/)?)\/i.test(c.url)?c.url:r.resourcePath+c.url;n[c.uuid]=i(d)}}}return n},parseTextures:function(e,t){function r(e,t){return\"number\"==typeof e?e:(console.warn(\"THREE.ObjectLoader.parseTexture: Constant should be in numeric form.\",e),t[e])}var n={};if(void 0!==e)for(var i=0,a=e.length;i<a;i++){var o,s=e[i];void 0===s.image&&console.warn('THREE.ObjectLoader: No \"image\" specified for',s.uuid),void 0===t[s.image]&&console.warn(\"THREE.ObjectLoader: Undefined image\",s.image),(o=Array.isArray(t[s.image])?new dc(t[s.image]):new zr(t[s.image])).needsUpdate=!0,o.uuid=s.uuid,void 0!==s.name&&(o.name=s.name),void 0!==s.mapping&&(o.mapping=r(s.mapping,vf)),void 0!==s.offset&&o.offset.fromArray(s.offset),void 0!==s.repeat&&o.repeat.fromArray(s.repeat),void 0!==s.center&&o.center.fromArray(s.center),void 0!==s.rotation&&(o.rotation=s.rotation),void 0!==s.wrap&&(o.wrapS=r(s.wrap[0],gf),o.wrapT=r(s.wrap[1],gf)),void 0!==s.format&&(o.format=s.format),void 0!==s.type&&(o.type=s.type),void 0!==s.encoding&&(o.encoding=s.encoding),void 0!==s.minFilter&&(o.minFilter=r(s.minFilter,yf)),void 0!==s.magFilter&&(o.magFilter=r(s.magFilter,yf)),void 0!==s.anisotropy&&(o.anisotropy=s.anisotropy),void 0!==s.flipY&&(o.flipY=s.flipY),void 0!==s.premultiplyAlpha&&(o.premultiplyAlpha=s.premultiplyAlpha),void 0!==s.unpackAlignment&&(o.unpackAlignment=s.unpackAlignment),n[s.uuid]=o}return n},parseObject:function(e,t,r){var n;function i(e){return void 0===t[e]&&console.warn(\"THREE.ObjectLoader: Undefined geometry\",e),t[e]}function a(e){if(void 0!==e){if(Array.isArray(e)){for(var t=[],n=0,i=e.length;n<i;n++){var a=e[n];void 0===r[a]&&console.warn(\"THREE.ObjectLoader: Undefined material\",a),t.push(r[a])}return t}return void 0===r[e]&&console.warn(\"THREE.ObjectLoader: Undefined material\",e),r[e]}}switch(e.type){case\"Scene\":n=new bn,void 0!==e.background&&Number.isInteger(e.background)&&(n.background=new ui(e.background)),void 0!==e.fog&&(\"Fog\"===e.fog.type?n.fog=new dh(e.fog.color,e.fog.near,e.fog.far):\"FogExp2\"===e.fog.type&&(n.fog=new ph(e.fog.color,e.fog.density)));break;case\"PerspectiveCamera\":n=new _a(e.fov,e.aspect,e.near,e.far),void 0!==e.focus&&(n.focus=e.focus),void 0!==e.zoom&&(n.zoom=e.zoom),void 0!==e.filmGauge&&(n.filmGauge=e.filmGauge),void 0!==e.filmOffset&&(n.filmOffset=e.filmOffset),void 0!==e.view&&(n.view=Object.assign({},e.view));break;case\"OrthographicCamera\":n=new rf(e.left,e.right,e.top,e.bottom,e.near,e.far),void 0!==e.zoom&&(n.zoom=e.zoom),void 0!==e.view&&(n.view=Object.assign({},e.view));break;case\"AmbientLight\":n=new of(e.color,e.intensity);break;case\"DirectionalLight\":n=new af(e.color,e.intensity);break;case\"PointLight\":n=new tf(e.color,e.intensity,e.distance,e.decay);break;case\"RectAreaLight\":n=new sf(e.color,e.intensity,e.width,e.height);break;case\"SpotLight\":n=new $d(e.color,e.intensity,e.distance,e.angle,e.penumbra,e.decay);break;case\"HemisphereLight\":n=new Jd(e.color,e.groundColor,e.intensity);break;case\"SkinnedMesh\":console.warn(\"THREE.ObjectLoader.parseObject() does not support SkinnedMesh yet.\");case\"Mesh\":n=new na(o=i(e.geometry),s=a(e.material));break;case\"InstancedMesh\":var o=i(e.geometry),s=a(e.material),c=e.count,l=e.instanceMatrix;(n=new Wh(o,s,c)).instanceMatrix=new _i(new Float32Array(l.array),16);break;case\"LOD\":n=new Nh;break;case\"Line\":n=new Kh(i(e.geometry),a(e.material),e.mode);break;case\"LineLoop\":n=new ru(i(e.geometry),a(e.material));break;case\"LineSegments\":n=new tu(i(e.geometry),a(e.material));break;case\"PointCloud\":case\"Points\":n=new cu(i(e.geometry),a(e.material));break;case\"Sprite\":n=new Ph(a(e.material));break;case\"Group\":n=new lh;break;default:n=new _n}if(n.uuid=e.uuid,void 0!==e.name&&(n.name=e.name),void 0!==e.matrix?(n.matrix.fromArray(e.matrix),void 0!==e.matrixAutoUpdate&&(n.matrixAutoUpdate=e.matrixAutoUpdate),n.matrixAutoUpdate&&n.matrix.decompose(n.position,n.quaternion,n.scale)):(void 0!==e.position&&n.position.fromArray(e.position),void 0!==e.rotation&&n.rotation.fromArray(e.rotation),void 0!==e.quaternion&&n.quaternion.fromArray(e.quaternion),void 0!==e.scale&&n.scale.fromArray(e.scale)),void 0!==e.castShadow&&(n.castShadow=e.castShadow),void 0!==e.receiveShadow&&(n.receiveShadow=e.receiveShadow),e.shadow&&(void 0!==e.shadow.bias&&(n.shadow.bias=e.shadow.bias),void 0!==e.shadow.radius&&(n.shadow.radius=e.shadow.radius),void 0!==e.shadow.mapSize&&n.shadow.mapSize.fromArray(e.shadow.mapSize),void 0!==e.shadow.camera&&(n.shadow.camera=this.parseObject(e.shadow.camera))),void 0!==e.visible&&(n.visible=e.visible),void 0!==e.frustumCulled&&(n.frustumCulled=e.frustumCulled),void 0!==e.renderOrder&&(n.renderOrder=e.renderOrder),void 0!==e.userData&&(n.userData=e.userData),void 0!==e.layers&&(n.layers.mask=e.layers),void 0!==e.children)for(var h=e.children,u=0;u<h.length;u++)n.add(this.parseObject(h[u],t,r));if(\"LOD\"===e.type){void 0!==e.autoUpdate&&(n.autoUpdate=e.autoUpdate);for(var p=e.levels,d=0;d<p.length;d++){var f=p[d],m=n.getObjectByProperty(\"uuid\",f.object);void 0!==m&&n.addLevel(m,f.distance)}}return n}});var mf,vf={UVMapping:ne,CubeReflectionMapping:ie,CubeRefractionMapping:ae,EquirectangularReflectionMapping:oe,EquirectangularRefractionMapping:se,SphericalReflectionMapping:ce,CubeUVReflectionMapping:le,CubeUVRefractionMapping:he},gf={RepeatWrapping:ue,ClampToEdgeWrapping:pe,MirroredRepeatWrapping:de},yf={NearestFilter:fe,NearestMipmapNearestFilter:me,NearestMipmapLinearFilter:ge,LinearFilter:xe,LinearMipmapNearestFilter:_e,LinearMipmapLinearFilter:we};function xf(e){\"undefined\"==typeof createImageBitmap&&console.warn(\"THREE.ImageBitmapLoader: createImageBitmap() not supported.\"),\"undefined\"==typeof fetch&&console.warn(\"THREE.ImageBitmapLoader: fetch() not supported.\"),hd.call(this,e),this.options=void 0}function _f(){this.type=\"ShapePath\",this.color=new ui,this.subPaths=[],this.currentPath=null}function bf(e){this.type=\"Font\",this.data=e}function wf(e,t,r){for(var n=Array.from?Array.from(e):String(e).split(\"\"),i=t\/r.resolution,a=(r.boundingBox.yMax-r.boundingBox.yMin+r.underlineThickness)*i,o=[],s=0,c=0,l=0;l<n.length;l++){var h=n[l];if(\"n\"===h)s=0,c-=a;else{var u=Mf(h,i,s,c,r);s+=u.offsetX,o.push(u.path)}}return o}function Mf(e,t,r,n,i){var a=i.glyphs[e]||i.glyphs[\"?\"];if(a){var o,s,c,l,h,u,p,d,f=new _f;if(a.o)for(var m=a._cachedOutline||(a._cachedOutline=a.o.split(\" \")),v=0,g=m.length;v<g;){switch(m[v++]){case\"m\":o=m[v++]*t+r,s=m[v++]*t+n,f.moveTo(o,s);break;case\"l\":o=m[v++]*t+r,s=m[v++]*t+n,f.lineTo(o,s);break;case\"q\":c=m[v++]*t+r,l=m[v++]*t+n,h=m[v++]*t+r,u=m[v++]*t+n,f.quadraticCurveTo(h,u,c,l);break;case\"b\":c=m[v++]*t+r,l=m[v++]*t+n,h=m[v++]*t+r,u=m[v++]*t+n,p=m[v++]*t+r,d=m[v++]*t+n,f.bezierCurveTo(h,u,p,d,c,l)}}return{offsetX:a.ha*t,path:f}}console.error('THREE.Font: character \"'+e+'\" does not exists in font family '+i.familyName+\".\")}function Sf(e){hd.call(this,e)}xf.prototype=Object.assign(Object.create(hd.prototype),{constructor:xf,setOptions:function(e){return this.options=e,this},load:function(e,t,r,n){void 0===e&&(e=\"\"),void 0!==this.path&&(e=this.path+e),e=this.manager.resolveURL(e);var i=this,a=sd.get(e);if(void 0!==a)return i.manager.itemStart(e),setTimeout(function(){t&&t(a),i.manager.itemEnd(e)},0),a;fetch(e).then(function(e){return e.blob()}).then(function(e){return void 0===i.options?createImageBitmap(e):createImageBitmap(e,i.options)}).then(function(r){sd.add(e,r),t&&t(r),i.manager.itemEnd(e)}).catch(function(t){n&&n(t),i.manager.itemError(e),i.manager.itemEnd(e)}),i.manager.itemStart(e)}}),Object.assign(_f.prototype,{moveTo:function(e,t){return this.currentPath=new Xd,this.subPaths.push(this.currentPath),this.currentPath.moveTo(e,t),this},lineTo:function(e,t){return this.currentPath.lineTo(e,t),this},quadraticCurveTo:function(e,t,r,n){return this.currentPath.quadraticCurveTo(e,t,r,n),this},bezierCurveTo:function(e,t,r,n,i,a){return this.currentPath.bezierCurveTo(e,t,r,n,i,a),this},splineThru:function(e){return this.currentPath.splineThru(e),this},toShapes:function(e,t){function r(e){for(var t=[],r=0,n=e.length;r<n;r++){var i=e[r],a=new Yd;a.curves=i.curves,t.push(a)}return t}function n(e,t){for(var r=t.length,n=!1,i=r-1,a=0;a<r;i=a++){var o=t[i],s=t[a],c=s.x-o.x,l=s.y-o.y;if(Math.abs(l)>Number.EPSILON){if(l<0&&(o=t[a],c=-c,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 h=l*(e.x-o.x)-c*(e.y-o.y);if(0===h)return!0;if(h<0)continue;n=!n}}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 n}var i=cp.isClockWise,a=this.subPaths;if(0===a.length)return[];if(!0===t)return r(a);var o,s,c,l=[];if(1===a.length)return s=a[0],(c=new Yd).curves=s.curves,l.push(c),l;var h=!i(a[0].getPoints());h=e?!h:h;var u,p,d=[],f=[],m=[],v=0;f[v]=void 0,m[v]=[];for(var g=0,y=a.length;g<y;g++)o=i(u=(s=a[g]).getPoints()),(o=e?!o:o)?(!h&&f[v]&&v++,f[v]={s:new Yd,p:u},f[v].s.curves=s.curves,h&&v++,m[v]=[]):m[v].push({h:s,p:u[0]});if(!f[0])return r(a);if(f.length>1){for(var x=!1,_=[],b=0,w=f.length;b<w;b++)d[b]=[];for(b=0,w=f.length;b<w;b++)for(var M=m[b],S=0;S<M.length;S++){for(var T=M[S],E=!0,A=0;A<f.length;A++)n(T.p,f[A].p)&&(b!==A&&_.push({froms:b,tos:A,hole:S}),E?(E=!1,d[A].push(T)):x=!0);E&&d[b].push(T)}_.length>0&&(x||(m=d))}g=0;for(var L=f.length;g<L;g++){c=f[g].s,l.push(c);for(var R=0,C=(p=m[g]).length;R<C;R++)c.holes.push(p[R].h)}return l}}),Object.assign(bf.prototype,{isFont:!0,generateShapes:function(e,t){void 0===t&&(t=100);for(var r=[],n=wf(e,t,this.data),i=0,a=n.length;i<a;i++)Array.prototype.push.apply(r,n[i].toShapes());return r}}),Sf.prototype=Object.assign(Object.create(hd.prototype),{constructor:Sf,load:function(e,t,r,n){var i=this,a=new pd(this.manager);a.setPath(this.path),a.load(e,function(e){var r;try{r=JSON.parse(e)}catch(a){console.warn(\"THREE.FontLoader: typeface.js support is being deprecated. Use typeface.json instead.\"),r=JSON.parse(e.substring(65,e.length-2))}var n=i.parse(r);t&&t(n)},r,n)},parse:function(e){return new bf(e)}});var Tf={getContext:function(){return void 0===mf&&(mf=new(window.AudioContext||window.webkitAudioContext)),mf},setContext:function(e){mf=e}};function Ef(e){hd.call(this,e)}function Af(){this.coefficients=[];for(var e=0;e<9;e++)this.coefficients.push(new Xr)}function Lf(e,t){Zd.call(this,void 0,t),this.sh=void 0!==e?e:new Af}function Rf(e,t,r){Lf.call(this,void 0,r);var n=(new ui).set(e),i=(new ui).set(t),a=new Xr(n.r,n.g,n.b),o=new Xr(i.r,i.g,i.b),s=Math.sqrt(Math.PI),c=s*Math.sqrt(.75);this.sh.coefficients[0].copy(a).add(o).multiplyScalar(s),this.sh.coefficients[1].copy(a).sub(o).multiplyScalar(c)}function Cf(e,t){Lf.call(this,void 0,t);var r=(new ui).set(e);this.sh.coefficients[0].set(r.r,r.g,r.b).multiplyScalar(2*Math.sqrt(Math.PI))}exports.AudioContext=Tf,Ef.prototype=Object.assign(Object.create(hd.prototype),{constructor:Ef,load:function(e,t,r,n){var i=new pd(this.manager);i.setResponseType(\"arraybuffer\"),i.setPath(this.path),i.load(e,function(e){var r=e.slice(0);Tf.getContext().decodeAudioData(r,function(e){t(e)})},r,n)}}),Object.assign(Af.prototype,{isSphericalHarmonics3:!0,set:function(e){for(var t=0;t<9;t++)this.coefficients[t].copy(e[t]);return this},zero:function(){for(var e=0;e<9;e++)this.coefficients[e].set(0,0,0);return this},getAt:function(e,t){var r=e.x,n=e.y,i=e.z,a=this.coefficients;return t.copy(a[0]).multiplyScalar(.282095),t.addScaledVector(a[1],.488603*n),t.addScaledVector(a[2],.488603*i),t.addScaledVector(a[3],.488603*r),t.addScaledVector(a[4],r*n*1.092548),t.addScaledVector(a[5],n*i*1.092548),t.addScaledVector(a[6],.315392*(3*i*i-1)),t.addScaledVector(a[7],r*i*1.092548),t.addScaledVector(a[8],.546274*(r*r-n*n)),t},getIrradianceAt:function(e,t){var r=e.x,n=e.y,i=e.z,a=this.coefficients;return t.copy(a[0]).multiplyScalar(.886227),t.addScaledVector(a[1],1.023328*n),t.addScaledVector(a[2],1.023328*i),t.addScaledVector(a[3],1.023328*r),t.addScaledVector(a[4],.858086*r*n),t.addScaledVector(a[5],.858086*n*i),t.addScaledVector(a[6],.743125*i*i-.247708),t.addScaledVector(a[7],.858086*r*i),t.addScaledVector(a[8],.429043*(r*r-n*n)),t},add:function(e){for(var t=0;t<9;t++)this.coefficients[t].add(e.coefficients[t]);return this},addScaledSH:function(e,t){for(var r=0;r<9;r++)this.coefficients[r].addScaledVector(e.coefficients[r],t);return this},scale:function(e){for(var t=0;t<9;t++)this.coefficients[t].multiplyScalar(e);return this},lerp:function(e,t){for(var r=0;r<9;r++)this.coefficients[r].lerp(e.coefficients[r],t);return this},equals:function(e){for(var t=0;t<9;t++)if(!this.coefficients[t].equals(e.coefficients[t]))return!1;return!0},copy:function(e){return this.set(e.coefficients)},clone:function(){return(new this.constructor).copy(this)},fromArray:function(e,t){void 0===t&&(t=0);for(var r=this.coefficients,n=0;n<9;n++)r[n].fromArray(e,t+3*n);return this},toArray:function(e,t){void 0===e&&(e=[]),void 0===t&&(t=0);for(var r=this.coefficients,n=0;n<9;n++)r[n].toArray(e,t+3*n);return e}}),Object.assign(Af,{getBasisAt:function(e,t){var r=e.x,n=e.y,i=e.z;t[0]=.282095,t[1]=.488603*n,t[2]=.488603*i,t[3]=.488603*r,t[4]=1.092548*r*n,t[5]=1.092548*n*i,t[6]=.315392*(3*i*i-1),t[7]=1.092548*r*i,t[8]=.546274*(r*r-n*n)}}),Lf.prototype=Object.assign(Object.create(Zd.prototype),{constructor:Lf,isLightProbe:!0,copy:function(e){return Zd.prototype.copy.call(this,e),this.sh.copy(e.sh),this.intensity=e.intensity,this},toJSON:function(e){return Zd.prototype.toJSON.call(this,e)}}),Rf.prototype=Object.assign(Object.create(Lf.prototype),{constructor:Rf,isHemisphereLightProbe:!0,copy:function(e){return Lf.prototype.copy.call(this,e),this},toJSON:function(e){return Lf.prototype.toJSON.call(this,e)}}),Cf.prototype=Object.assign(Object.create(Lf.prototype),{constructor:Cf,isAmbientLightProbe:!0,copy:function(e){return Lf.prototype.copy.call(this,e),this},toJSON:function(e){return Lf.prototype.toJSON.call(this,e)}});var Pf=new tn,Of=new tn;function Df(){this.type=\"StereoCamera\",this.aspect=1,this.eyeSep=.064,this.cameraL=new _a,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new _a,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}}function If(e){this.autoStart=void 0===e||e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}Object.assign(Df.prototype,{update: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;var r,n,i=e.projectionMatrix.clone(),a=t.eyeSep\/2,o=a*t.near\/t.focus,s=t.near*Math.tan(Nr.DEG2RAD*t.fov*.5)\/t.zoom;Of.elements[12]=-a,Pf.elements[12]=a,r=-s*t.aspect+o,n=s*t.aspect+o,i.elements[0]=2*t.near\/(n-r),i.elements[8]=(n+r)\/(n-r),this.cameraL.projectionMatrix.copy(i),r=-s*t.aspect-o,n=s*t.aspect-o,i.elements[0]=2*t.near\/(n-r),i.elements[8]=(n+r)\/(n-r),this.cameraR.projectionMatrix.copy(i)}this.cameraL.matrixWorld.copy(e.matrixWorld).multiply(Of),this.cameraR.matrixWorld.copy(e.matrixWorld).multiply(Pf)}}),Object.assign(If.prototype,{start:function(){this.startTime=(\"undefined\"==typeof performance?Date:performance).now(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0},stop:function(){this.getElapsedTime(),this.running=!1,this.autoStart=!1},getElapsedTime:function(){return this.getDelta(),this.elapsedTime},getDelta:function(){var e=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){var t=(\"undefined\"==typeof performance?Date:performance).now();e=(t-this.oldTime)\/1e3,this.oldTime=t,this.elapsedTime+=e}return e}});var Nf=new Xr,Bf=new jr,Ff=new Xr,Uf=new Xr;function Gf(){_n.call(this),this.type=\"AudioListener\",this.context=Tf.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._clock=new If}function zf(e){_n.call(this),this.type=\"Audio\",this.listener=e,this.context=e.context,this.gain=this.context.createGain(),this.gain.connect(e.getInput()),this.autoplay=!1,this.buffer=null,this.detune=0,this.loop=!1,this.loopStart=0,this.loopEnd=0,this.offset=0,this.duration=void 0,this.playbackRate=1,this.isPlaying=!1,this.hasPlaybackControl=!0,this.sourceType=\"empty\",this._startedAt=0,this._pausedAt=0,this.filters=[]}Gf.prototype=Object.assign(Object.create(_n.prototype),{constructor:Gf,getInput:function(){return this.gain},removeFilter: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},getFilter:function(){return this.filter},setFilter: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},getMasterVolume:function(){return this.gain.gain.value},setMasterVolume:function(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this},updateMatrixWorld:function(e){_n.prototype.updateMatrixWorld.call(this,e);var t=this.context.listener,r=this.up;if(this.timeDelta=this._clock.getDelta(),this.matrixWorld.decompose(Nf,Bf,Ff),Uf.set(0,0,-1).applyQuaternion(Bf),t.positionX){var n=this.context.currentTime+this.timeDelta;t.positionX.linearRampToValueAtTime(Nf.x,n),t.positionY.linearRampToValueAtTime(Nf.y,n),t.positionZ.linearRampToValueAtTime(Nf.z,n),t.forwardX.linearRampToValueAtTime(Uf.x,n),t.forwardY.linearRampToValueAtTime(Uf.y,n),t.forwardZ.linearRampToValueAtTime(Uf.z,n),t.upX.linearRampToValueAtTime(r.x,n),t.upY.linearRampToValueAtTime(r.y,n),t.upZ.linearRampToValueAtTime(r.z,n)}else t.setPosition(Nf.x,Nf.y,Nf.z),t.setOrientation(Uf.x,Uf.y,Uf.z,r.x,r.y,r.z)}}),zf.prototype=Object.assign(Object.create(_n.prototype),{constructor:zf,getOutput:function(){return this.gain},setNodeSource:function(e){return this.hasPlaybackControl=!1,this.sourceType=\"audioNode\",this.source=e,this.connect(),this},setMediaElementSource:function(e){return this.hasPlaybackControl=!1,this.sourceType=\"mediaNode\",this.source=this.context.createMediaElementSource(e),this.connect(),this},setMediaStreamSource:function(e){return this.hasPlaybackControl=!1,this.sourceType=\"mediaStreamNode\",this.source=this.context.createMediaStreamSource(e),this.connect(),this},setBuffer:function(e){return this.buffer=e,this.sourceType=\"buffer\",this.autoplay&&this.play(),this},play:function(e){if(void 0===e&&(e=0),!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._pausedAt+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.\")},pause:function(){if(!1!==this.hasPlaybackControl)return!0===this.isPlaying&&(this._pausedAt+=Math.max(this.context.currentTime-this._startedAt,0)*this.playbackRate,this.source.stop(),this.source.onended=null,this.isPlaying=!1),this;console.warn(\"THREE.Audio: this Audio has no playback control.\")},stop:function(){if(!1!==this.hasPlaybackControl)return this._pausedAt=0,this.source.stop(),this.source.onended=null,this.isPlaying=!1,this;console.warn(\"THREE.Audio: this Audio has no playback control.\")},connect: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},disconnect: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},getFilters:function(){return this.filters},setFilters:function(e){return e||(e=[]),!0===this.isPlaying?(this.disconnect(),this.filters=e,this.connect()):this.filters=e,this},setDetune: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},getDetune:function(){return this.detune},getFilter:function(){return this.getFilters()[0]},setFilter:function(e){return this.setFilters(e?[e]:[])},setPlaybackRate: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.\")},getPlaybackRate:function(){return this.playbackRate},onEnded:function(){this.isPlaying=!1},getLoop:function(){return!1===this.hasPlaybackControl?(console.warn(\"THREE.Audio: this Audio has no playback control.\"),!1):this.loop},setLoop:function(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.\")},setLoopStart:function(e){return this.loopStart=e,this},setLoopEnd:function(e){return this.loopEnd=e,this},getVolume:function(){return this.gain.gain.value},setVolume:function(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this}});var Hf=new Xr,Vf=new jr,kf=new Xr,jf=new Xr;function Wf(e){zf.call(this,e),this.panner=this.context.createPanner(),this.panner.panningModel=\"HRTF\",this.panner.connect(this.gain)}function qf(e,t){this.analyser=e.context.createAnalyser(),this.analyser.fftSize=void 0!==t?t:2048,this.data=new Uint8Array(this.analyser.frequencyBinCount),e.getOutput().connect(this.analyser)}function Xf(e,t,r){this.binding=e,this.valueSize=r;var n,i=Float64Array;switch(t){case\"quaternion\":n=this._slerp;break;case\"string\":case\"bool\":i=Array,n=this._select;break;default:n=this._lerp}this.buffer=new i(4*r),this._mixBufferRegion=n,this.cumulativeWeight=0,this.useCount=0,this.referenceCount=0}Wf.prototype=Object.assign(Object.create(zf.prototype),{constructor:Wf,getOutput:function(){return this.panner},getRefDistance:function(){return this.panner.refDistance},setRefDistance:function(e){return this.panner.refDistance=e,this},getRolloffFactor:function(){return this.panner.rolloffFactor},setRolloffFactor:function(e){return this.panner.rolloffFactor=e,this},getDistanceModel:function(){return this.panner.distanceModel},setDistanceModel:function(e){return this.panner.distanceModel=e,this},getMaxDistance:function(){return this.panner.maxDistance},setMaxDistance:function(e){return this.panner.maxDistance=e,this},setDirectionalCone:function(e,t,r){return this.panner.coneInnerAngle=e,this.panner.coneOuterAngle=t,this.panner.coneOuterGain=r,this},updateMatrixWorld:function(e){if(_n.prototype.updateMatrixWorld.call(this,e),!0!==this.hasPlaybackControl||!1!==this.isPlaying){this.matrixWorld.decompose(Hf,Vf,kf),jf.set(0,0,1).applyQuaternion(Vf);var t=this.panner;if(t.positionX){var r=this.context.currentTime+this.listener.timeDelta;t.positionX.linearRampToValueAtTime(Hf.x,r),t.positionY.linearRampToValueAtTime(Hf.y,r),t.positionZ.linearRampToValueAtTime(Hf.z,r),t.orientationX.linearRampToValueAtTime(jf.x,r),t.orientationY.linearRampToValueAtTime(jf.y,r),t.orientationZ.linearRampToValueAtTime(jf.z,r)}else t.setPosition(Hf.x,Hf.y,Hf.z),t.setOrientation(jf.x,jf.y,jf.z)}}}),Object.assign(qf.prototype,{getFrequencyData:function(){return this.analyser.getByteFrequencyData(this.data),this.data},getAverageFrequency:function(){for(var e=0,t=this.getFrequencyData(),r=0;r<t.length;r++)e+=t[r];return e\/t.length}}),Object.assign(Xf.prototype,{accumulate:function(e,t){var r=this.buffer,n=this.valueSize,i=e*n+n,a=this.cumulativeWeight;if(0===a){for(var o=0;o!==n;++o)r[i+o]=r[o];a=t}else{var s=t\/(a+=t);this._mixBufferRegion(r,i,0,s,n)}this.cumulativeWeight=a},apply:function(e){var t=this.valueSize,r=this.buffer,n=e*t+t,i=this.cumulativeWeight,a=this.binding;if(this.cumulativeWeight=0,i<1){var o=3*t;this._mixBufferRegion(r,n,o,1-i,t)}for(var s=t,c=t+t;s!==c;++s)if(r[s]!==r[s+t]){a.setValue(r,n);break}},saveOriginalState:function(){var e=this.binding,t=this.buffer,r=this.valueSize,n=3*r;e.getValue(t,n);for(var i=r,a=n;i!==a;++i)t[i]=t[n+i%r];this.cumulativeWeight=0},restoreOriginalState:function(){var e=3*this.valueSize;this.binding.setValue(this.buffer,e)},_select:function(e,t,r,n,i){if(n>=.5)for(var a=0;a!==i;++a)e[t+a]=e[r+a]},_slerp:function(e,t,r,n){jr.slerpFlat(e,t,e,t,e,r,n)},_lerp:function(e,t,r,n,i){for(var a=1-n,o=0;o!==i;++o){var s=t+o;e[s]=e[s]*a+e[r+o]*n}}});var Yf=\"\\[\\]\\.:\\\/\",Zf=new RegExp(\"[\"+Yf+\"]\",\"g\"),Jf=\"[^\"+Yf+\"]\",Qf=\"[^\"+Yf.replace(\"\\.\",\"\")+\"]\",Kf=\/((?:WC+[\/:])*)\/.source.replace(\"WC\",Jf),$f=\/(WCOD+)?\/.source.replace(\"WCOD\",Qf),em=\/(?:.(WC+)(?:[(.+)])?)?\/.source.replace(\"WC\",Jf),tm=\/.(WC+)(?:[(.+)])?\/.source.replace(\"WC\",Jf),rm=new RegExp(\"^\"+Kf+$f+em+tm+\"$\"),nm=[\"material\",\"materials\",\"bones\"];function im(e,t,r){var n=r||am.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,n)}function am(e,t,r){this.path=t,this.parsedPath=r||am.parseTrackName(t),this.node=am.findNode(e,this.parsedPath.nodeName)||e,this.rootNode=e}function om(){this.uuid=Nr.generateUUID(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;var e={};this._indicesByUUID=e;for(var t=0,r=arguments.length;t!==r;++t)e[arguments[t].uuid]=t;this._paths=[],this._parsedPaths=[],this._bindings=[],this._bindingsIndicesByPath={};var n=this;this.stats={objects:{get total(){return n._objects.length},get inUse(){return this.total-n.nCachedObjects_}},get bindingsPerObject(){return n._bindings.length}}}function sm(e,t,r){this._mixer=e,this._clip=t,this._localRoot=r||null;for(var n=t.tracks,i=n.length,a=new Array(i),o={endingStart:Vt,endingEnd:Vt},s=0;s!==i;++s){var c=n[s].createInterpolant(null);a[s]=c,c.settings=o}this._interpolantSettings=o,this._interpolants=a,this._propertyBindings=new Array(i),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=Ft,this._loopCount=-1,this._startTime=null,this.time=0,this.timeScale=1,this._effectiveTimeScale=1,this.weight=1,this._effectiveWeight=1,this.repetitions=1\/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtStart=!0,this.zeroSlopeAtEnd=!0}function cm(e){this._root=e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}function lm(e){\"string\"==typeof e&&(console.warn(\"THREE.Uniform: Type parameter is no longer needed.\"),e=arguments[1]),this.value=e}function hm(e,t,r){fh.call(this,e,t),this.meshPerAttribute=r||1}function um(e,t,r,n){this.ray=new qn(e,t),this.near=r||0,this.far=n||1\/0,this.camera=null,this.layers=new on,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}},Object.defineProperties(this.params,{PointCloud:{get:function(){return console.warn(\"THREE.Raycaster: params.PointCloud has been renamed to params.Points.\"),this.Points}}})}function pm(e,t){return e.distance-t.distance}function dm(e,t,r,n){if(e.layers.test(t.layers)&&e.raycast(t,r),!0===n)for(var i=e.children,a=0,o=i.length;a<o;a++)dm(i[a],t,r,!0)}function fm(e,t,r){return this.radius=void 0!==e?e:1,this.phi=void 0!==t?t:0,this.theta=void 0!==r?r:0,this}function mm(e,t,r){return this.radius=void 0!==e?e:1,this.theta=void 0!==t?t:0,this.y=void 0!==r?r:0,this}Object.assign(im.prototype,{getValue:function(e,t){this.bind();var r=this._targetGroup.nCachedObjects_,n=this._bindings[r];void 0!==n&&n.getValue(e,t)},setValue:function(e,t){for(var r=this._bindings,n=this._targetGroup.nCachedObjects_,i=r.length;n!==i;++n)r[n].setValue(e,t)},bind:function(){for(var e=this._bindings,t=this._targetGroup.nCachedObjects_,r=e.length;t!==r;++t)e[t].bind()},unbind:function(){for(var e=this._bindings,t=this._targetGroup.nCachedObjects_,r=e.length;t!==r;++t)e[t].unbind()}}),Object.assign(am,{Composite:im,create:function(e,t,r){return e&&e.isAnimationObjectGroup?new am.Composite(e,t,r):new am(e,t,r)},sanitizeNodeName:function(e){return e.replace(\/s\/g,\"_\").replace(Zf,\"\")},parseTrackName:function(e){var t=rm.exec(e);if(!t)throw new Error(\"PropertyBinding: Cannot parse trackName: \"+e);var r={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},n=r.nodeName&&r.nodeName.lastIndexOf(\".\");if(void 0!==n&&-1!==n){var i=r.nodeName.substring(n+1);-1!==nm.indexOf(i)&&(r.nodeName=r.nodeName.substring(0,n),r.objectName=i)}if(null===r.propertyName||0===r.propertyName.length)throw new Error(\"PropertyBinding: can not parse propertyName from trackName: \"+e);return r},findNode:function(e,t){if(!t||\"\"===t||\".\"===t||-1===t||t===e.name||t===e.uuid)return e;if(e.skeleton){var r=e.skeleton.getBoneByName(t);if(void 0!==r)return r}if(e.children){var n=function(e){for(var r=0;r<e.length;r++){var i=e[r];if(i.name===t||i.uuid===t)return i;var a=n(i.children);if(a)return a}return null},i=n(e.children);if(i)return i}return null}}),Object.assign(am.prototype,{_getValue_unavailable:function(){},_setValue_unavailable:function(){},BindingType:{Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3},Versioning:{None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2},GetterByBindingType:[function(e,t){e[t]=this.node[this.propertyName]},function(e,t){for(var r=this.resolvedProperty,n=0,i=r.length;n!==i;++n)e[t++]=r[n]},function(e,t){e[t]=this.resolvedProperty[this.propertyIndex]},function(e,t){this.resolvedProperty.toArray(e,t)}],SetterByBindingTypeAndVersioning:[[function(e,t){this.targetObject[this.propertyName]=e[t]},function(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.needsUpdate=!0},function(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}],[function(e,t){for(var r=this.resolvedProperty,n=0,i=r.length;n!==i;++n)r[n]=e[t++]},function(e,t){for(var r=this.resolvedProperty,n=0,i=r.length;n!==i;++n)r[n]=e[t++];this.targetObject.needsUpdate=!0},function(e,t){for(var r=this.resolvedProperty,n=0,i=r.length;n!==i;++n)r[n]=e[t++];this.targetObject.matrixWorldNeedsUpdate=!0}],[function(e,t){this.resolvedProperty[this.propertyIndex]=e[t]},function(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.needsUpdate=!0},function(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}],[function(e,t){this.resolvedProperty.fromArray(e,t)},function(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.needsUpdate=!0},function(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.matrixWorldNeedsUpdate=!0}]],getValue:function(e,t){this.bind(),this.getValue(e,t)},setValue:function(e,t){this.bind(),this.setValue(e,t)},bind:function(){var e=this.node,t=this.parsedPath,r=t.objectName,n=t.propertyName,i=t.propertyIndex;if(e||(e=am.findNode(this.rootNode,t.nodeName)||this.rootNode,this.node=e),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,e){if(r){var a=t.objectIndex;switch(r){case\"materials\":if(!e.material)return void console.error(\"THREE.PropertyBinding: Can not bind to material as node does not have a material.\",this);if(!e.material.materials)return void console.error(\"THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.\",this);e=e.material.materials;break;case\"bones\":if(!e.skeleton)return void console.error(\"THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.\",this);e=e.skeleton.bones;for(var o=0;o<e.length;o++)if(e[o].name===a){a=o;break}break;default:if(void 0===e[r])return void console.error(\"THREE.PropertyBinding: Can not bind to objectName of node undefined.\",this);e=e[r]}if(void 0!==a){if(void 0===e[a])return void console.error(\"THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.\",this,e);e=e[a]}}var s=e[n];if(void 0!==s){var c=this.Versioning.None;this.targetObject=e,void 0!==e.needsUpdate?c=this.Versioning.NeedsUpdate:void 0!==e.matrixWorldNeedsUpdate&&(c=this.Versioning.MatrixWorldNeedsUpdate);var l=this.BindingType.Direct;if(void 0!==i){if(\"morphTargetInfluences\"===n){if(!e.geometry)return void console.error(\"THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.\",this);if(e.geometry.isBufferGeometry){if(!e.geometry.morphAttributes)return void console.error(\"THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.\",this);for(o=0;o<this.node.geometry.morphAttributes.position.length;o++)if(e.geometry.morphAttributes.position[o].name===i){i=o;break}}else{if(!e.geometry.morphTargets)return void console.error(\"THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphTargets.\",this);for(o=0;o<this.node.geometry.morphTargets.length;o++)if(e.geometry.morphTargets[o].name===i){i=o;break}}}l=this.BindingType.ArrayElement,this.resolvedProperty=s,this.propertyIndex=i}else void 0!==s.fromArray&&void 0!==s.toArray?(l=this.BindingType.HasFromToArray,this.resolvedProperty=s):Array.isArray(s)?(l=this.BindingType.EntireArray,this.resolvedProperty=s):this.propertyName=n;this.getValue=this.GetterByBindingType[l],this.setValue=this.SetterByBindingTypeAndVersioning[l][c]}else{var h=t.nodeName;console.error(\"THREE.PropertyBinding: Trying to update property for track: \"+h+\".\"+n+\" but it wasn't found.\",e)}}else console.error(\"THREE.PropertyBinding: Trying to update node for track: \"+this.path+\" but it wasn't found.\")},unbind:function(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}),Object.assign(am.prototype,{_getValue_unbound:am.prototype.getValue,_setValue_unbound:am.prototype.setValue}),Object.assign(om.prototype,{isAnimationObjectGroup:!0,add:function(){for(var e=this._objects,t=e.length,r=this.nCachedObjects_,n=this._indicesByUUID,i=this._paths,a=this._parsedPaths,o=this._bindings,s=o.length,c=void 0,l=0,h=arguments.length;l!==h;++l){var u=arguments[l],p=u.uuid,d=n[p];if(void 0===d){d=t++,n[p]=d,e.push(u);for(var f=0,m=s;f!==m;++f)o[f].push(new am(u,i[f],a[f]))}else if(d<r){c=e[d];var v=--r,g=e[v];n[g.uuid]=d,e[d]=g,n[p]=v,e[v]=u;for(f=0,m=s;f!==m;++f){var y=o[f],x=y[v],_=y[d];y[d]=x,void 0===_&&(_=new am(u,i[f],a[f])),y[v]=_}}else e[d]!==c&&console.error(\"THREE.AnimationObjectGroup: Different objects with the same UUID detected. Clean the caches or recreate your infrastructure when reloading scenes.\")}this.nCachedObjects_=r},remove:function(){for(var e=this._objects,t=this.nCachedObjects_,r=this._indicesByUUID,n=this._bindings,i=n.length,a=0,o=arguments.length;a!==o;++a){var s=arguments[a],c=s.uuid,l=r[c];if(void 0!==l&&l>=t){var h=t++,u=e[h];r[u.uuid]=l,e[l]=u,r[c]=h,e[h]=s;for(var p=0,d=i;p!==d;++p){var f=n[p],m=f[h],v=f[l];f[l]=m,f[h]=v}}}this.nCachedObjects_=t},uncache:function(){for(var e=this._objects,t=e.length,r=this.nCachedObjects_,n=this._indicesByUUID,i=this._bindings,a=i.length,o=0,s=arguments.length;o!==s;++o){var c=arguments[o].uuid,l=n[c];if(void 0!==l)if(delete n[c],l<r){var h=--r,u=e[h],p=e[g=--t];n[u.uuid]=l,e[l]=u,n[p.uuid]=h,e[h]=p,e.pop();for(var d=0,f=a;d!==f;++d){var m=(y=i[d])[h],v=y[g];y[l]=m,y[h]=v,y.pop()}}else{var g;n[(p=e[g=--t]).uuid]=l,e[l]=p,e.pop();for(d=0,f=a;d!==f;++d){var y;(y=i[d])[l]=y[g],y.pop()}}}this.nCachedObjects_=r},subscribe_:function(e,t){var r=this._bindingsIndicesByPath,n=r[e],i=this._bindings;if(void 0!==n)return i[n];var a=this._paths,o=this._parsedPaths,s=this._objects,c=s.length,l=this.nCachedObjects_,h=new Array(c);n=i.length,r[e]=n,a.push(e),o.push(t),i.push(h);for(var u=l,p=s.length;u!==p;++u){var d=s[u];h[u]=new am(d,e,t)}return h},unsubscribe_:function(e){var t=this._bindingsIndicesByPath,r=t[e];if(void 0!==r){var n=this._paths,i=this._parsedPaths,a=this._bindings,o=a.length-1,s=a[o];t[e[o]]=r,a[r]=s,a.pop(),i[r]=i[o],i.pop(),n[r]=n[o],n.pop()}}}),Object.assign(sm.prototype,{play:function(){return this._mixer._activateAction(this),this},stop:function(){return this._mixer._deactivateAction(this),this.reset()},reset:function(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()},isRunning:function(){return this.enabled&&!this.paused&&0!==this.timeScale&&null===this._startTime&&this._mixer._isActiveAction(this)},isScheduled:function(){return this._mixer._isActiveAction(this)},startAt:function(e){return this._startTime=e,this},setLoop:function(e,t){return this.loop=e,this.repetitions=t,this},setEffectiveWeight:function(e){return this.weight=e,this._effectiveWeight=this.enabled?e:0,this.stopFading()},getEffectiveWeight:function(){return this._effectiveWeight},fadeIn:function(e){return this._scheduleFading(e,0,1)},fadeOut:function(e){return this._scheduleFading(e,1,0)},crossFadeFrom:function(e,t,r){if(e.fadeOut(t),this.fadeIn(t),r){var n=this._clip.duration,i=e._clip.duration,a=i\/n,o=n\/i;e.warp(1,a,t),this.warp(o,1,t)}return this},crossFadeTo:function(e,t,r){return e.crossFadeFrom(this,t,r)},stopFading:function(){var e=this._weightInterpolant;return null!==e&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this},setEffectiveTimeScale:function(e){return this.timeScale=e,this._effectiveTimeScale=this.paused?0:e,this.stopWarping()},getEffectiveTimeScale:function(){return this._effectiveTimeScale},setDuration:function(e){return this.timeScale=this._clip.duration\/e,this.stopWarping()},syncWith:function(e){return this.time=e.time,this.timeScale=e.timeScale,this.stopWarping()},halt:function(e){return this.warp(this._effectiveTimeScale,0,e)},warp:function(e,t,r){var n=this._mixer,i=n.time,a=this._timeScaleInterpolant,o=this.timeScale;null===a&&(a=n._lendControlInterpolant(),this._timeScaleInterpolant=a);var s=a.parameterPositions,c=a.sampleValues;return s[0]=i,s[1]=i+r,c[0]=e\/o,c[1]=t\/o,this},stopWarping:function(){var e=this._timeScaleInterpolant;return null!==e&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this},getMixer:function(){return this._mixer},getClip:function(){return this._clip},getRoot:function(){return this._localRoot||this._mixer._root},_update:function(e,t,r,n){if(this.enabled){var i=this._startTime;if(null!==i){var a=(e-i)*r;if(a<0||0===r)return;this._startTime=null,t=r*a}t*=this._updateTimeScale(e);var o=this._updateTime(t),s=this._updateWeight(e);if(s>0)for(var c=this._interpolants,l=this._propertyBindings,h=0,u=c.length;h!==u;++h)c[h].evaluate(o),l[h].accumulate(n,s)}else this._updateWeight(e)},_updateWeight:function(e){var t=0;if(this.enabled){t=this.weight;var r=this._weightInterpolant;if(null!==r){var n=r.evaluate(e)[0];t*=n,e>r.parameterPositions[1]&&(this.stopFading(),0===n&&(this.enabled=!1))}}return this._effectiveWeight=t,t},_updateTimeScale:function(e){var t=0;if(!this.paused){t=this.timeScale;var r=this._timeScaleInterpolant;if(null!==r)t*=r.evaluate(e)[0],e>r.parameterPositions[1]&&(this.stopWarping(),0===t?this.paused=!0:this.timeScale=t)}return this._effectiveTimeScale=t,t},_updateTime:function(e){var t=this.time+e,r=this._clip.duration,n=this.loop,i=this._loopCount,a=n===Ut;if(0===e)return-1===i?t:a&&1==(1&i)?r-t:t;if(n===Bt){-1===i&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(t>=r)t=r;else{if(!(t<0)){this.time=t;break e}t=0}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=t,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)),t>=r||t<0){var o=Math.floor(t\/r);t-=r*o,i+=Math.abs(o);var s=this.repetitions-i;if(s<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,t=e>0?r:0,this.time=t,this._mixer.dispatchEvent({type:\"finished\",action:this,direction:e>0?1:-1});else{if(1===s){var c=e<0;this._setEndings(c,!c,a)}else this._setEndings(!1,!1,a);this._loopCount=i,this.time=t,this._mixer.dispatchEvent({type:\"loop\",action:this,loopDelta:o})}}else this.time=t;if(a&&1==(1&i))return r-t}return t},_setEndings:function(e,t,r){var n=this._interpolantSettings;r?(n.endingStart=kt,n.endingEnd=kt):(n.endingStart=e?this.zeroSlopeAtStart?kt:Vt:jt,n.endingEnd=t?this.zeroSlopeAtEnd?kt:Vt:jt)},_scheduleFading:function(e,t,r){var n=this._mixer,i=n.time,a=this._weightInterpolant;null===a&&(a=n._lendControlInterpolant(),this._weightInterpolant=a);var o=a.parameterPositions,s=a.sampleValues;return o[0]=i,s[0]=t,o[1]=i+e,s[1]=r,this}}),cm.prototype=Object.assign(Object.create(Pr.prototype),{constructor:cm,_bindAction:function(e,t){var r=e._localRoot||this._root,n=e._clip.tracks,i=n.length,a=e._propertyBindings,o=e._interpolants,s=r.uuid,c=this._bindingsByRootAndName,l=c[s];void 0===l&&(l={},c[s]=l);for(var h=0;h!==i;++h){var u=n[h],p=u.name,d=l[p];if(void 0!==d)a[h]=d;else{if(void 0!==(d=a[h])){null===d._cacheIndex&&(++d.referenceCount,this._addInactiveBinding(d,s,p));continue}var f=t&&t._propertyBindings[h].binding.parsedPath;++(d=new Xf(am.create(r,p,f),u.ValueTypeName,u.getValueSize())).referenceCount,this._addInactiveBinding(d,s,p),a[h]=d}o[h].resultBuffer=d.buffer}},_activateAction:function(e){if(!this._isActiveAction(e)){if(null===e._cacheIndex){var t=(e._localRoot||this._root).uuid,r=e._clip.uuid,n=this._actionsByClip[r];this._bindAction(e,n&&n.knownActions[0]),this._addInactiveAction(e,r,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)}},_deactivateAction:function(e){if(this._isActiveAction(e)){for(var t=e._propertyBindings,r=0,n=t.length;r!==n;++r){var i=t[r];0==--i.useCount&&(i.restoreOriginalState(),this._takeBackBinding(i))}this._takeBackAction(e)}},_initMemoryManager: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}}}},_isActiveAction:function(e){var t=e._cacheIndex;return null!==t&&t<this._nActiveActions},_addInactiveAction:function(e,t,r){var n=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=n.length,n.push(e),a.actionByRoot[r]=e},_removeInactiveAction:function(e){var t=this._actions,r=t[t.length-1],n=e._cacheIndex;r._cacheIndex=n,t[n]=r,t.pop(),e._cacheIndex=null;var i=e._clip.uuid,a=this._actionsByClip,o=a[i],s=o.knownActions,c=s[s.length-1],l=e._byClipCacheIndex;c._byClipCacheIndex=l,s[l]=c,s.pop(),e._byClipCacheIndex=null,delete o.actionByRoot[(e._localRoot||this._root).uuid],0===s.length&&delete a[i],this._removeInactiveBindingsForAction(e)},_removeInactiveBindingsForAction:function(e){for(var t=e._propertyBindings,r=0,n=t.length;r!==n;++r){var i=t[r];0==--i.referenceCount&&this._removeInactiveBinding(i)}},_lendAction:function(e){var t=this._actions,r=e._cacheIndex,n=this._nActiveActions++,i=t[n];e._cacheIndex=n,t[n]=e,i._cacheIndex=r,t[r]=i},_takeBackAction:function(e){var t=this._actions,r=e._cacheIndex,n=--this._nActiveActions,i=t[n];e._cacheIndex=n,t[n]=e,i._cacheIndex=r,t[r]=i},_addInactiveBinding:function(e,t,r){var n=this._bindingsByRootAndName,i=n[t],a=this._bindings;void 0===i&&(i={},n[t]=i),i[r]=e,e._cacheIndex=a.length,a.push(e)},_removeInactiveBinding:function(e){var t=this._bindings,r=e.binding,n=r.rootNode.uuid,i=r.path,a=this._bindingsByRootAndName,o=a[n],s=t[t.length-1],c=e._cacheIndex;s._cacheIndex=c,t[c]=s,t.pop(),delete o[i],0===Object.keys(o).length&&delete a[n]},_lendBinding:function(e){var t=this._bindings,r=e._cacheIndex,n=this._nActiveBindings++,i=t[n];e._cacheIndex=n,t[n]=e,i._cacheIndex=r,t[r]=i},_takeBackBinding:function(e){var t=this._bindings,r=e._cacheIndex,n=--this._nActiveBindings,i=t[n];e._cacheIndex=n,t[n]=e,i._cacheIndex=r,t[r]=i},_lendControlInterpolant:function(){var e=this._controlInterpolants,t=this._nActiveControlInterpolants++,r=e[t];return void 0===r&&((r=new Yp(new Float32Array(2),new Float32Array(2),1,this._controlInterpolantsResultBuffer)).__cacheIndex=t,e[t]=r),r},_takeBackControlInterpolant:function(e){var t=this._controlInterpolants,r=e.__cacheIndex,n=--this._nActiveControlInterpolants,i=t[n];e.__cacheIndex=n,t[n]=e,i.__cacheIndex=r,t[r]=i},_controlInterpolantsResultBuffer:new Float32Array(1),clipAction:function(e,t){var r=t||this._root,n=r.uuid,i=\"string\"==typeof e?id.findByName(r,e):e,a=null!==i?i.uuid:e,o=this._actionsByClip[a],s=null;if(void 0!==o){var c=o.actionByRoot[n];if(void 0!==c)return c;s=o.knownActions[0],null===i&&(i=s._clip)}if(null===i)return null;var l=new sm(this,i,t);return this._bindAction(l,s),this._addInactiveAction(l,a,n),l},existingAction:function(e,t){var r=t||this._root,n=r.uuid,i=\"string\"==typeof e?id.findByName(r,e):e,a=i?i.uuid:e,o=this._actionsByClip[a];return void 0!==o&&o.actionByRoot[n]||null},stopAllAction:function(){var e=this._actions,t=this._nActiveActions,r=this._bindings,n=this._nActiveBindings;this._nActiveActions=0,this._nActiveBindings=0;for(var i=0;i!==t;++i)e[i].reset();for(i=0;i!==n;++i)r[i].useCount=0;return this},update:function(e){e*=this.timeScale;for(var t=this._actions,r=this._nActiveActions,n=this.time+=e,i=Math.sign(e),a=this._accuIndex^=1,o=0;o!==r;++o){t[o]._update(n,e,i,a)}var s=this._bindings,c=this._nActiveBindings;for(o=0;o!==c;++o)s[o].apply(a);return this},setTime:function(e){this.time=0;for(var t=0;t<this._actions.length;t++)this._actions[t].time=0;return this.update(e)},getRoot:function(){return this._root},uncacheClip:function(e){var t=this._actions,r=e.uuid,n=this._actionsByClip,i=n[r];if(void 0!==i){for(var a=i.knownActions,o=0,s=a.length;o!==s;++o){var c=a[o];this._deactivateAction(c);var l=c._cacheIndex,h=t[t.length-1];c._cacheIndex=null,c._byClipCacheIndex=null,h._cacheIndex=l,t[l]=h,t.pop(),this._removeInactiveBindingsForAction(c)}delete n[r]}},uncacheRoot:function(e){var t=e.uuid,r=this._actionsByClip;for(var n in r){var i=r[n].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)}},uncacheAction:function(e,t){var r=this.existingAction(e,t);null!==r&&(this._deactivateAction(r),this._removeInactiveAction(r))}}),lm.prototype.clone=function(){return new lm(void 0===this.value.clone?this.value:this.value.clone())},hm.prototype=Object.assign(Object.create(fh.prototype),{constructor:hm,isInstancedInterleavedBuffer:!0,copy:function(e){return fh.prototype.copy.call(this,e),this.meshPerAttribute=e.meshPerAttribute,this}}),Object.assign(um.prototype,{set:function(e,t){this.ray.set(e,t)},setFromCamera:function(e,t){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&&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.\")},intersectObject:function(e,t,r){var n=r||[];return dm(e,this,n,t),n.sort(pm),n},intersectObjects:function(e,t,r){var n=r||[];if(!1===Array.isArray(e))return console.warn(\"THREE.Raycaster.intersectObjects: objects is not an Array.\"),n;for(var i=0,a=e.length;i<a;i++)dm(e[i],this,n,t);return n.sort(pm),n}}),Object.assign(fm.prototype,{set:function(e,t,r){return this.radius=e,this.phi=t,this.theta=r,this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.radius=e.radius,this.phi=e.phi,this.theta=e.theta,this},makeSafe:function(){return this.phi=Math.max(1e-6,Math.min(Math.PI-1e-6,this.phi)),this},setFromVector3:function(e){return this.setFromCartesianCoords(e.x,e.y,e.z)},setFromCartesianCoords:function(e,t,r){return this.radius=Math.sqrt(e*e+t*t+r*r),0===this.radius?(this.theta=0,this.phi=0):(this.theta=Math.atan2(e,r),this.phi=Math.acos(Nr.clamp(t\/this.radius,-1,1))),this}}),Object.assign(mm.prototype,{set:function(e,t,r){return this.radius=e,this.theta=t,this.y=r,this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.radius=e.radius,this.theta=e.theta,this.y=e.y,this},setFromVector3:function(e){return this.setFromCartesianCoords(e.x,e.y,e.z)},setFromCartesianCoords:function(e,t,r){return this.radius=Math.sqrt(e*e+r*r),this.theta=Math.atan2(e,r),this.y=t,this}});var vm=new Br;function gm(e,t){this.min=void 0!==e?e:new Br(1\/0,1\/0),this.max=void 0!==t?t:new Br(-1\/0,-1\/0)}Object.assign(gm.prototype,{set:function(e,t){return this.min.copy(e),this.max.copy(t),this},setFromPoints:function(e){this.makeEmpty();for(var t=0,r=e.length;t<r;t++)this.expandByPoint(e[t]);return this},setFromCenterAndSize:function(e,t){var r=vm.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(r),this.max.copy(e).add(r),this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.min.copy(e.min),this.max.copy(e.max),this},makeEmpty:function(){return this.min.x=this.min.y=1\/0,this.max.x=this.max.y=-1\/0,this},isEmpty:function(){return this.max.x<this.min.x||this.max.y<this.min.y},getCenter:function(e){return void 0===e&&(console.warn(\"THREE.Box2: .getCenter() target is now required\"),e=new Br),this.isEmpty()?e.set(0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)},getSize:function(e){return void 0===e&&(console.warn(\"THREE.Box2: .getSize() target is now required\"),e=new Br),this.isEmpty()?e.set(0,0):e.subVectors(this.max,this.min)},expandByPoint:function(e){return this.min.min(e),this.max.max(e),this},expandByVector:function(e){return this.min.sub(e),this.max.add(e),this},expandByScalar:function(e){return this.min.addScalar(-e),this.max.addScalar(e),this},containsPoint:function(e){return!(e.x<this.min.x||e.x>this.max.x||e.y<this.min.y||e.y>this.max.y)},containsBox: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},getParameter:function(e,t){return void 0===t&&(console.warn(\"THREE.Box2: .getParameter() target is now required\"),t=new Br),t.set((e.x-this.min.x)\/(this.max.x-this.min.x),(e.y-this.min.y)\/(this.max.y-this.min.y))},intersectsBox: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)},clampPoint:function(e,t){return void 0===t&&(console.warn(\"THREE.Box2: .clampPoint() target is now required\"),t=new Br),t.copy(e).clamp(this.min,this.max)},distanceToPoint:function(e){return vm.copy(e).clamp(this.min,this.max).sub(e).length()},intersect:function(e){return this.min.max(e.min),this.max.min(e.max),this},union:function(e){return this.min.min(e.min),this.max.max(e.max),this},translate:function(e){return this.min.add(e),this.max.add(e),this},equals:function(e){return e.min.equals(this.min)&&e.max.equals(this.max)}});var ym=new Xr,xm=new Xr;function _m(e,t){this.start=void 0!==e?e:new Xr,this.end=void 0!==t?t:new Xr}function bm(e){_n.call(this),this.material=e,this.render=function(){}}Object.assign(_m.prototype,{set:function(e,t){return this.start.copy(e),this.end.copy(t),this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.start.copy(e.start),this.end.copy(e.end),this},getCenter:function(e){return void 0===e&&(console.warn(\"THREE.Line3: .getCenter() target is now required\"),e=new Xr),e.addVectors(this.start,this.end).multiplyScalar(.5)},delta:function(e){return void 0===e&&(console.warn(\"THREE.Line3: .delta() target is now required\"),e=new Xr),e.subVectors(this.end,this.start)},distanceSq:function(){return this.start.distanceToSquared(this.end)},distance:function(){return this.start.distanceTo(this.end)},at:function(e,t){return void 0===t&&(console.warn(\"THREE.Line3: .at() target is now required\"),t=new Xr),this.delta(t).multiplyScalar(e).add(this.start)},closestPointToPointParameter:function(e,t){ym.subVectors(e,this.start),xm.subVectors(this.end,this.start);var r=xm.dot(xm),n=xm.dot(ym)\/r;return t&&(n=Nr.clamp(n,0,1)),n},closestPointToPoint:function(e,t,r){var n=this.closestPointToPointParameter(e,t);return void 0===r&&(console.warn(\"THREE.Line3: .closestPointToPoint() target is now required\"),r=new Xr),this.delta(r).multiplyScalar(n).add(this.start)},applyMatrix4:function(e){return this.start.applyMatrix4(e),this.end.applyMatrix4(e),this},equals:function(e){return e.start.equals(this.start)&&e.end.equals(this.end)}}),bm.prototype=Object.create(_n.prototype),bm.prototype.constructor=bm,bm.prototype.isImmediateRenderObject=!0;var wm=new Xr;function Mm(e,t){_n.call(this),this.light=e,this.light.updateMatrixWorld(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=t;for(var r=new Gi,n=[0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,-1,0,1,0,0,0,0,1,1,0,0,0,0,-1,1],i=0,a=1;i<32;i++,a++){var o=i\/32*Math.PI*2,s=a\/32*Math.PI*2;n.push(Math.cos(o),Math.sin(o),1,Math.cos(s),Math.sin(s),1)}r.setAttribute(\"position\",new Li(n,3));var c=new qh({fog:!1,toneMapped:!1});this.cone=new tu(r,c),this.add(this.cone),this.update()}Mm.prototype=Object.create(_n.prototype),Mm.prototype.constructor=Mm,Mm.prototype.dispose=function(){this.cone.geometry.dispose(),this.cone.material.dispose()},Mm.prototype.update=function(){this.light.updateMatrixWorld();var e=this.light.distance?this.light.distance:1e3,t=e*Math.tan(this.light.angle);this.cone.scale.set(t,t,e),wm.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(wm),void 0!==this.color?this.cone.material.color.set(this.color):this.cone.material.color.copy(this.light.color)};var Sm=new Xr,Tm=new tn,Em=new tn;function Am(e){var t=[];e&&e.isBone&&t.push(e);for(var r=0;r<e.children.length;r++)t.push.apply(t,Am(e.children[r]));return t}function Lm(e){for(var t=Am(e),r=new Gi,n=[],i=[],a=new ui(0,0,1),o=new ui(0,1,0),s=0;s<t.length;s++){var c=t[s];c.parent&&c.parent.isBone&&(n.push(0,0,0),n.push(0,0,0),i.push(a.r,a.g,a.b),i.push(o.r,o.g,o.b))}r.setAttribute(\"position\",new Li(n,3)),r.setAttribute(\"color\",new Li(i,3));var l=new qh({vertexColors:!0,depthTest:!1,depthWrite:!1,toneMapped:!1,transparent:!0});tu.call(this,r,l),this.root=e,this.bones=t,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1}function Rm(e,t,r){this.light=e,this.light.updateMatrixWorld(),this.color=r;var n=new yp(t,4,2),i=new yi({wireframe:!0,fog:!1,toneMapped:!1});na.call(this,n,i),this.matrix=this.light.matrixWorld,this.matrixAutoUpdate=!1,this.update()}Lm.prototype=Object.create(tu.prototype),Lm.prototype.constructor=Lm,Lm.prototype.isSkeletonHelper=!0,Lm.prototype.updateMatrixWorld=function(e){var t=this.bones,r=this.geometry,n=r.getAttribute(\"position\");Em.getInverse(this.root.matrixWorld);for(var i=0,a=0;i<t.length;i++){var o=t[i];o.parent&&o.parent.isBone&&(Tm.multiplyMatrices(Em,o.matrixWorld),Sm.setFromMatrixPosition(Tm),n.setXYZ(a,Sm.x,Sm.y,Sm.z),Tm.multiplyMatrices(Em,o.parent.matrixWorld),Sm.setFromMatrixPosition(Tm),n.setXYZ(a+1,Sm.x,Sm.y,Sm.z),a+=2)}r.getAttribute(\"position\").needsUpdate=!0,_n.prototype.updateMatrixWorld.call(this,e)},Rm.prototype=Object.create(na.prototype),Rm.prototype.constructor=Rm,Rm.prototype.dispose=function(){this.geometry.dispose(),this.material.dispose()},Rm.prototype.update=function(){void 0!==this.color?this.material.color.set(this.color):this.material.color.copy(this.light.color)};var Cm=new Xr,Pm=new ui,Om=new ui;function Dm(e,t,r){_n.call(this),this.light=e,this.light.updateMatrixWorld(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=r;var n=new wu(t);n.rotateY(.5*Math.PI),this.material=new yi({wireframe:!0,fog:!1,toneMapped:!1}),void 0===this.color&&(this.material.vertexColors=!0);var i=n.getAttribute(\"position\"),a=new Float32Array(3*i.count);n.setAttribute(\"color\",new _i(a,3)),this.add(new na(n,this.material)),this.update()}function Im(e,t,r,n){e=e||10,t=t||10,r=new ui(void 0!==r?r:4473924),n=new ui(void 0!==n?n:8947848);for(var i=t\/2,a=e\/t,o=e\/2,s=[],c=[],l=0,h=0,u=-o;l<=t;l++,u+=a){s.push(-o,0,u,o,0,u),s.push(u,0,-o,u,0,o);var p=l===i?r:n;p.toArray(c,h),h+=3,p.toArray(c,h),h+=3,p.toArray(c,h),h+=3,p.toArray(c,h),h+=3}var d=new Gi;d.setAttribute(\"position\",new Li(s,3)),d.setAttribute(\"color\",new Li(c,3));var f=new qh({vertexColors:!0,toneMapped:!1});tu.call(this,d,f)}function Nm(e,t,r,n,i,a){e=e||10,t=t||16,r=r||8,n=n||64,i=new ui(void 0!==i?i:4473924),a=new ui(void 0!==a?a:8947848);var o,s,c,l,h,u,p,d=[],f=[];for(l=0;l<=t;l++)c=l\/t*(2*Math.PI),o=Math.sin(c)*e,s=Math.cos(c)*e,d.push(0,0,0),d.push(o,0,s),p=1&l?i:a,f.push(p.r,p.g,p.b),f.push(p.r,p.g,p.b);for(l=0;l<=r;l++)for(p=1&l?i:a,u=e-e\/r*l,h=0;h<n;h++)c=h\/n*(2*Math.PI),o=Math.sin(c)*u,s=Math.cos(c)*u,d.push(o,0,s),f.push(p.r,p.g,p.b),c=(h+1)\/n*(2*Math.PI),o=Math.sin(c)*u,s=Math.cos(c)*u,d.push(o,0,s),f.push(p.r,p.g,p.b);var m=new Gi;m.setAttribute(\"position\",new Li(d,3)),m.setAttribute(\"color\",new Li(f,3));var v=new qh({vertexColors:!0,toneMapped:!1});tu.call(this,m,v)}Dm.prototype=Object.create(_n.prototype),Dm.prototype.constructor=Dm,Dm.prototype.dispose=function(){this.children[0].geometry.dispose(),this.children[0].material.dispose()},Dm.prototype.update=function(){var e=this.children[0];if(void 0!==this.color)this.material.color.set(this.color);else{var t=e.geometry.getAttribute(\"color\");Pm.copy(this.light.color),Om.copy(this.light.groundColor);for(var r=0,n=t.count;r<n;r++){var i=r<n\/2?Pm:Om;t.setXYZ(r,i.r,i.g,i.b)}t.needsUpdate=!0}e.lookAt(Cm.setFromMatrixPosition(this.light.matrixWorld).negate())},Im.prototype=Object.assign(Object.create(tu.prototype),{constructor:Im,copy:function(e){return tu.prototype.copy.call(this,e),this.geometry.copy(e.geometry),this.material.copy(e.material),this},clone:function(){return(new this.constructor).copy(this)}}),Nm.prototype=Object.create(tu.prototype),Nm.prototype.constructor=Nm;var Bm=new Xr,Fm=new Xr,Um=new Xr;function Gm(e,t,r){_n.call(this),this.light=e,this.light.updateMatrixWorld(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=r,void 0===t&&(t=1);var n=new Gi;n.setAttribute(\"position\",new Li([-t,t,0,t,t,0,t,-t,0,-t,-t,0,-t,t,0],3));var i=new qh({fog:!1,toneMapped:!1});this.lightPlane=new Kh(n,i),this.add(this.lightPlane),(n=new Gi).setAttribute(\"position\",new Li([0,0,0,0,0,1],3)),this.targetLine=new Kh(n,i),this.add(this.targetLine),this.update()}Gm.prototype=Object.create(_n.prototype),Gm.prototype.constructor=Gm,Gm.prototype.dispose=function(){this.lightPlane.geometry.dispose(),this.lightPlane.material.dispose(),this.targetLine.geometry.dispose(),this.targetLine.material.dispose()},Gm.prototype.update=function(){Bm.setFromMatrixPosition(this.light.matrixWorld),Fm.setFromMatrixPosition(this.light.target.matrixWorld),Um.subVectors(Fm,Bm),this.lightPlane.lookAt(Fm),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(Fm),this.targetLine.scale.z=Um.length()};var zm=new Xr,Hm=new xa;function Vm(e){var t=new Gi,r=new qh({color:16777215,vertexColors:!0,toneMapped:!1}),n=[],i=[],a={},o=new ui(16755200),s=new ui(16711680),c=new ui(43775),l=new ui(16777215),h=new ui(3355443);function u(e,t,r){p(e,r),p(t,r)}function p(e,t){n.push(0,0,0),i.push(t.r,t.g,t.b),void 0===a[e]&&(a[e]=[]),a[e].push(n.length\/3-1)}u(\"n1\",\"n2\",o),u(\"n2\",\"n4\",o),u(\"n4\",\"n3\",o),u(\"n3\",\"n1\",o),u(\"f1\",\"f2\",o),u(\"f2\",\"f4\",o),u(\"f4\",\"f3\",o),u(\"f3\",\"f1\",o),u(\"n1\",\"f1\",o),u(\"n2\",\"f2\",o),u(\"n3\",\"f3\",o),u(\"n4\",\"f4\",o),u(\"p\",\"n1\",s),u(\"p\",\"n2\",s),u(\"p\",\"n3\",s),u(\"p\",\"n4\",s),u(\"u1\",\"u2\",c),u(\"u2\",\"u3\",c),u(\"u3\",\"u1\",c),u(\"c\",\"t\",l),u(\"p\",\"c\",h),u(\"cn1\",\"cn2\",h),u(\"cn3\",\"cn4\",h),u(\"cf1\",\"cf2\",h),u(\"cf3\",\"cf4\",h),t.setAttribute(\"position\",new Li(n,3)),t.setAttribute(\"color\",new Li(i,3)),tu.call(this,t,r),this.camera=e,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=a,this.update()}function km(e,t,r,n,i,a,o){zm.set(i,a,o).unproject(n);var s=t[e];if(void 0!==s)for(var c=r.getAttribute(\"position\"),l=0,h=s.length;l<h;l++)c.setXYZ(s[l],zm.x,zm.y,zm.z)}Vm.prototype=Object.create(tu.prototype),Vm.prototype.constructor=Vm,Vm.prototype.update=function(){var e=this.geometry,t=this.pointMap;Hm.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse),km(\"c\",t,e,Hm,0,0,-1),km(\"t\",t,e,Hm,0,0,1),km(\"n1\",t,e,Hm,-1,-1,-1),km(\"n2\",t,e,Hm,1,-1,-1),km(\"n3\",t,e,Hm,-1,1,-1),km(\"n4\",t,e,Hm,1,1,-1),km(\"f1\",t,e,Hm,-1,-1,1),km(\"f2\",t,e,Hm,1,-1,1),km(\"f3\",t,e,Hm,-1,1,1),km(\"f4\",t,e,Hm,1,1,1),km(\"u1\",t,e,Hm,.7,1.1,-1),km(\"u2\",t,e,Hm,-.7,1.1,-1),km(\"u3\",t,e,Hm,0,2,-1),km(\"cf1\",t,e,Hm,-1,0,1),km(\"cf2\",t,e,Hm,1,0,1),km(\"cf3\",t,e,Hm,0,-1,1),km(\"cf4\",t,e,Hm,0,1,1),km(\"cn1\",t,e,Hm,-1,0,-1),km(\"cn2\",t,e,Hm,1,0,-1),km(\"cn3\",t,e,Hm,0,-1,-1),km(\"cn4\",t,e,Hm,0,1,-1),e.getAttribute(\"position\").needsUpdate=!0};var jm=new Nn;function Wm(e,t){this.object=e,void 0===t&&(t=16776960);var r=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]),n=new Float32Array(24),i=new Gi;i.setIndex(new _i(r,1)),i.setAttribute(\"position\",new _i(n,3)),tu.call(this,i,new qh({color:t,toneMapped:!1})),this.matrixAutoUpdate=!1,this.update()}function qm(e,t){this.type=\"Box3Helper\",this.box=e,t=t||16776960;var r=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]),n=new Gi;n.setIndex(new _i(r,1)),n.setAttribute(\"position\",new Li([1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,-1,-1,1,-1,-1,-1,-1,1,-1,-1],3)),tu.call(this,n,new qh({color:t,toneMapped:!1})),this.geometry.computeBoundingSphere()}function Xm(e,t,r){this.type=\"PlaneHelper\",this.plane=e,this.size=void 0===t?1:t;var n=void 0!==r?r:16776960,i=new Gi;i.setAttribute(\"position\",new Li([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,0,1,0,0,0],3)),i.computeBoundingSphere(),Kh.call(this,i,new qh({color:n,toneMapped:!1}));var a=new Gi;a.setAttribute(\"position\",new Li([1,1,1,-1,1,1,-1,-1,1,1,1,1,-1,-1,1,1,-1,1],3)),a.computeBoundingSphere(),this.add(new na(a,new yi({color:n,opacity:.2,transparent:!0,depthWrite:!1,toneMapped:!1})))}Wm.prototype=Object.create(tu.prototype),Wm.prototype.constructor=Wm,Wm.prototype.update=function(e){if(void 0!==e&&console.warn(\"THREE.BoxHelper: .update() has no longer arguments.\"),void 0!==this.object&&jm.setFromObject(this.object),!jm.isEmpty()){var t=jm.min,r=jm.max,n=this.geometry.attributes.position,i=n.array;i[0]=r.x,i[1]=r.y,i[2]=r.z,i[3]=t.x,i[4]=r.y,i[5]=r.z,i[6]=t.x,i[7]=t.y,i[8]=r.z,i[9]=r.x,i[10]=t.y,i[11]=r.z,i[12]=r.x,i[13]=r.y,i[14]=t.z,i[15]=t.x,i[16]=r.y,i[17]=t.z,i[18]=t.x,i[19]=t.y,i[20]=t.z,i[21]=r.x,i[22]=t.y,i[23]=t.z,n.needsUpdate=!0,this.geometry.computeBoundingSphere()}},Wm.prototype.setFromObject=function(e){return this.object=e,this.update(),this},Wm.prototype.copy=function(e){return tu.prototype.copy.call(this,e),this.object=e.object,this},Wm.prototype.clone=function(){return(new this.constructor).copy(this)},qm.prototype=Object.create(tu.prototype),qm.prototype.constructor=qm,qm.prototype.updateMatrixWorld=function(e){var t=this.box;t.isEmpty()||(t.getCenter(this.position),t.getSize(this.scale),this.scale.multiplyScalar(.5),_n.prototype.updateMatrixWorld.call(this,e))},Xm.prototype=Object.create(Kh.prototype),Xm.prototype.constructor=Xm,Xm.prototype.updateMatrixWorld=function(e){var t=-this.plane.constant;Math.abs(t)<1e-8&&(t=1e-8),this.scale.set(.5*this.size,.5*this.size,t),this.children[0].material.side=t<0?f:d,this.lookAt(this.plane.normal),_n.prototype.updateMatrixWorld.call(this,e)};var Ym,Zm,Jm=new Xr;function Qm(e,t,r,n,i,a){_n.call(this),void 0===e&&(e=new Xr(0,0,1)),void 0===t&&(t=new Xr(0,0,0)),void 0===r&&(r=1),void 0===n&&(n=16776960),void 0===i&&(i=.2*r),void 0===a&&(a=.2*i),void 0===Ym&&((Ym=new Gi).setAttribute(\"position\",new Li([0,0,0,0,1,0],3)),(Zm=new Lp(0,.5,1,5,1)).translate(0,-.5,0)),this.position.copy(t),this.line=new Kh(Ym,new qh({color:n,toneMapped:!1})),this.line.matrixAutoUpdate=!1,this.add(this.line),this.cone=new na(Zm,new yi({color:n,toneMapped:!1})),this.cone.matrixAutoUpdate=!1,this.add(this.cone),this.setDirection(e),this.setLength(r,i,a)}function Km(e){var t=[0,0,0,e=e||1,0,0,0,0,0,0,e,0,0,0,0,0,0,e],r=new Gi;r.setAttribute(\"position\",new Li(t,3)),r.setAttribute(\"color\",new Li([1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],3));var n=new qh({vertexColors:!0,toneMapped:!1});tu.call(this,r,n)}Qm.prototype=Object.create(_n.prototype),Qm.prototype.constructor=Qm,Qm.prototype.setDirection=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{Jm.set(e.z,0,-e.x).normalize();var t=Math.acos(e.y);this.quaternion.setFromAxisAngle(Jm,t)}},Qm.prototype.setLength=function(e,t,r){void 0===t&&(t=.2*e),void 0===r&&(r=.2*t),this.line.scale.set(1,Math.max(1e-4,e-t),1),this.line.updateMatrix(),this.cone.scale.set(r,t,r),this.cone.position.y=e,this.cone.updateMatrix()},Qm.prototype.setColor=function(e){this.line.material.color.set(e),this.cone.material.color.set(e)},Qm.prototype.copy=function(e){return _n.prototype.copy.call(this,e,!1),this.line.copy(e.line),this.cone.copy(e.cone),this},Qm.prototype.clone=function(){return(new this.constructor).copy(this)},Km.prototype=Object.create(tu.prototype),Km.prototype.constructor=Km;var $m=4,ev=8,tv=Math.pow(2,ev),rv=[.125,.215,.35,.446,.526,.582],nv=ev-$m+1+rv.length,iv=20,av={[Yt]:0,[Zt]:1,[Qt]:2,[$t]:3,[er]:4,[tr]:5,[Jt]:6},ov=new rf,sv=Pv(iv),cv=null,lv=null,{_lodPlanes:hv,_sizeLods:uv,_sigmas:pv}=_v(),dv=null,fv=null,mv=null,vv=(1+Math.sqrt(5))\/2,gv=1\/vv,yv=[new Xr(1,1,1),new Xr(-1,1,1),new Xr(1,1,-1),new Xr(-1,1,-1),new Xr(0,vv,gv),new Xr(0,vv,-gv),new Xr(gv,0,vv),new Xr(-gv,0,vv),new Xr(vv,gv,0),new Xr(-vv,gv,0)];function xv(e){fv=e,Tv(sv)}function _v(){for(var e=[],t=[],r=[],n=ev,i=0;i<nv;i++){var a=Math.pow(2,n);t.push(a);var o=1\/a;i>ev-$m?o=rv[i-ev+$m-1]:0==i&&(o=0),r.push(o);for(var s=1\/(a-1),c=-s\/2,l=1+s\/2,h=[c,c,l,c,l,l,c,c,l,l,c,l],u=new Float32Array(108),p=new Float32Array(72),d=new Float32Array(36),f=0;f<6;f++){var m=f%3*2\/3-1,v=f>2?0:-1,g=[m,v,0,m+2\/3,v,0,m+2\/3,v+1,0,m,v,0,m+2\/3,v+1,0,m,v+1,0];u.set(g,18*f),p.set(h,12*f);var y=[f,f,f,f,f,f];d.set(y,6*f)}var x=new Gi;x.setAttribute(\"position\",new _i(u,3)),x.setAttribute(\"uv\",new _i(p,2)),x.setAttribute(\"faceIndex\",new _i(d,1)),e.push(x),n>$m&&n--}return{_lodPlanes:e,_sizeLods:t,_sigmas:r}}function bv(e){var t={magFilter:fe,minFilter:fe,generateMipmaps:!1,type:e?e.type:Se,format:e?e.format:He,encoding:e?e.encoding:Qt,depthBuffer:!1,stencilBuffer:!1},r=Ev(t);return r.depthBuffer=!e,dv=Ev(t),r}function wv(e){dv.dispose(),fv.setRenderTarget(mv),e.scissorTest=!1,e.setSize(e.width,e.height)}function Mv(e,t,r,n){var i=new _a(90,1,t,r),a=[1,1,1,1,-1,1],o=[1,1,-1,-1,-1,1],s=fv.outputEncoding,c=fv.toneMapping,l=fv.toneMappingExposure,h=fv.getClearColor(),u=fv.getClearAlpha();fv.toneMapping=K,fv.toneMappingExposure=1,fv.outputEncoding=Yt,e.scale.z*=-1;var p=e.background;if(p&&p.isColor){p.convertSRGBToLinear();var d=Math.max(p.r,p.g,p.b),f=Math.min(Math.max(Math.ceil(Math.log2(d)),-128),127);p=p.multiplyScalar(Math.pow(2,-f));var m=(f+128)\/255;fv.setClearColor(p,m),e.background=null}for(var v=0;v<6;v++){var g=v%3;0==g?(i.up.set(0,a[v],0),i.lookAt(o[v],0,0)):1==g?(i.up.set(0,0,a[v]),i.lookAt(0,o[v],0)):(i.up.set(0,a[v],0),i.lookAt(0,0,o[v])),Av(n,g*tv,v>2?tv:0,tv,tv),fv.setRenderTarget(n),fv.render(e,i)}fv.toneMapping=c,fv.toneMappingExposure=l,fv.outputEncoding=s,fv.setClearColor(h,u),e.scale.z*=-1}function Sv(e,t){var r=new bn;e.isCubeTexture?null==lv&&(lv=Dv()):null==cv&&(cv=Ov());var n=e.isCubeTexture?lv:cv;r.add(new na(hv[0],n));var i=n.uniforms;i.envMap.value=e,e.isCubeTexture||i.texelSize.value.set(1\/e.image.width,1\/e.image.height),i.inputEncoding.value=av[e.encoding],i.outputEncoding.value=av[e.encoding],Av(t,0,0,3*tv,2*tv),fv.setRenderTarget(t),fv.render(r,ov)}function Tv(e){var t=new bn;t.add(new na(hv[0],e)),fv.compile(t,ov)}function Ev(e){var t=new Vr(3*tv,3*tv,e);return t.texture.mapping=le,t.texture.name=\"PMREM.cubeUv\",t.scissorTest=!0,t}function Av(e,t,r,n,i){e.viewport.set(t,r,n,i),e.scissor.set(t,r,n,i)}function Lv(e){var t=fv.autoClear;fv.autoClear=!1;for(var r=1;r<nv;r++){Rv(e,r-1,r,Math.sqrt(pv[r]*pv[r]-pv[r-1]*pv[r-1]),yv[(r-1)%yv.length])}fv.autoClear=t}function Rv(e,t,r,n,i){Cv(e,dv,t,r,n,\"latitudinal\",i),Cv(dv,e,r,r,n,\"longitudinal\",i)}function Cv(e,t,r,n,i,a,o){\"latitudinal\"!==a&&\"longitudinal\"!==a&&console.error(\"blur direction must be either latitudinal or longitudinal!\");var s=new bn;s.add(new na(hv[n],sv));var c=sv.uniforms,l=uv[r]-1,h=isFinite(i)?Math.PI\/(2*l):2*Math.PI\/(2*iv-1),u=i\/h,p=isFinite(i)?1+Math.floor(3*u):iv;p>iv&&console.warn(`sigmaRadians, ${i}, is too large and will clip, as it requested ${p} samples when the maximum is set to ${iv}`);for(var d=[],f=0,m=0;m<iv;++m){var v=m\/u,g=Math.exp(-v*v\/2);d.push(g),0==m?f+=g:m<p&&(f+=2*g)}for(m=0;m<d.length;m++)d[m]=d[m]\/f;c.envMap.value=e.texture,c.samples.value=p,c.weights.value=d,c.latitudinal.value=\"latitudinal\"===a,o&&(c.poleAxis.value=o),c.dTheta.value=h,c.mipInt.value=ev-r,c.inputEncoding.value=av[e.texture.encoding],c.outputEncoding.value=av[e.texture.encoding];var y=uv[n];Av(t,v=3*Math.max(0,tv-2*y),(0===n?0:2*tv)+2*y*(n>ev-$m?n-ev+$m:0),3*y,2*y),fv.setRenderTarget(t),fv.render(s,ov)}function Pv(e){var t=new Np({defines:{n:e},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:new Float32Array(e)},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:new Xr(0,1,0)},inputEncoding:{value:av[Yt]},outputEncoding:{value:av[Yt]}},vertexShader:Iv(),fragmentShader:`nprecision mediump float;nprecision mediump int;nvarying vec3 vOutputDirection;nuniform sampler2D envMap;nuniform int samples;nuniform float weights[n];nuniform bool latitudinal;nuniform float dTheta;nuniform float mipInt;nuniform vec3 poleAxis;nn${Nv()}nn#define ENVMAP_TYPE_CUBE_UVn#include <cube_uv_reflection_fragment>nnvec3 getSample(float theta, vec3 axis) {ntfloat cosTheta = cos(theta);nt\/\/ Rodrigues' axis-angle rotationntvec3 sampleDirection = vOutputDirection * cosThetantt+ cross(axis, vOutputDirection) * sin(theta)ntt+ axis * dot(axis, vOutputDirection) * (1.0 - cosTheta);ntreturn bilinearCubeUV(envMap, sampleDirection, mipInt);n}nnvoid main() {ntvec3 axis = latitudinal ? poleAxis : cross(poleAxis, vOutputDirection);ntif (all(equal(axis, vec3(0.0))))nttaxis = vec3(vOutputDirection.z, 0.0, - vOutputDirection.x);ntaxis = normalize(axis);ntgl_FragColor = vec4(0.0);ntgl_FragColor.rgb += weights[0] * getSample(0.0, axis);ntfor (int i = 1; i < n; i++) {nttif (i >= samples)ntttbreak;nttfloat theta = dTheta * float(i);nttgl_FragColor.rgb += weights[i] * getSample(-1.0 * theta, axis);nttgl_FragColor.rgb += weights[i] * getSample(theta, axis);nt}ntgl_FragColor = linearToOutputTexel(gl_FragColor);n}ntt`,blending:y,depthTest:!1,depthWrite:!1});return t.type=\"SphericalGaussianBlur\",t}function Ov(){var e=new Np({uniforms:{envMap:{value:null},texelSize:{value:new Br(1,1)},inputEncoding:{value:av[Yt]},outputEncoding:{value:av[Yt]}},vertexShader:Iv(),fragmentShader:`nprecision mediump float;nprecision mediump int;nvarying vec3 vOutputDirection;nuniform sampler2D envMap;nuniform vec2 texelSize;nn${Nv()}nn#define RECIPROCAL_PI 0.31830988618n#define RECIPROCAL_PI2 0.15915494nnvoid main() {ntgl_FragColor = vec4(0.0);ntvec3 outputDirection = normalize(vOutputDirection);ntvec2 uv;ntuv.y = asin(clamp(outputDirection.y, -1.0, 1.0)) * RECIPROCAL_PI + 0.5;ntuv.x = atan(outputDirection.z, outputDirection.x) * RECIPROCAL_PI2 + 0.5;ntvec2 f = fract(uv \/ texelSize - 0.5);ntuv -= f * texelSize;ntvec3 tl = envMapTexelToLinear(texture2D(envMap, uv)).rgb;ntuv.x += texelSize.x;ntvec3 tr = envMapTexelToLinear(texture2D(envMap, uv)).rgb;ntuv.y += texelSize.y;ntvec3 br = envMapTexelToLinear(texture2D(envMap, uv)).rgb;ntuv.x -= texelSize.x;ntvec3 bl = envMapTexelToLinear(texture2D(envMap, uv)).rgb;ntvec3 tm = mix(tl, tr, f.x);ntvec3 bm = mix(bl, br, f.x);ntgl_FragColor.rgb = mix(tm, bm, f.y);ntgl_FragColor = linearToOutputTexel(gl_FragColor);n}ntt`,blending:y,depthTest:!1,depthWrite:!1});return e.type=\"EquirectangularToCubeUV\",e}function Dv(){var e=new Np({uniforms:{envMap:{value:null},inputEncoding:{value:av[Yt]},outputEncoding:{value:av[Yt]}},vertexShader:Iv(),fragmentShader:`nprecision mediump float;nprecision mediump int;nvarying vec3 vOutputDirection;nuniform samplerCube envMap;nn${Nv()}nnvoid main() {ntgl_FragColor = vec4(0.0);ntgl_FragColor.rgb = envMapTexelToLinear(textureCube(envMap, vec3( - vOutputDirection.x, vOutputDirection.yz ))).rgb;ntgl_FragColor = linearToOutputTexel(gl_FragColor);n}ntt`,blending:y,depthTest:!1,depthWrite:!1});return e.type=\"CubemapToCubeUV\",e}function Iv(){return\"nprecision mediump float;nprecision mediump int;nattribute vec3 position;nattribute vec2 uv;nattribute float faceIndex;nvarying vec3 vOutputDirection;nvec3 getDirection(vec2 uv, float face) {ntuv = 2.0 * uv - 1.0;ntvec3 direction = vec3(uv, 1.0);ntif (face == 0.0) {nttdirection = direction.zyx;nttdirection.z *= -1.0;nt} else if (face == 1.0) {nttdirection = direction.xzy;nttdirection.z *= -1.0;nt} else if (face == 3.0) {nttdirection = direction.zyx;nttdirection.x *= -1.0;nt} else if (face == 4.0) {nttdirection = direction.xzy;nttdirection.y *= -1.0;nt} else if (face == 5.0) {nttdirection.xz *= -1.0;nt}ntreturn direction;n}nvoid main() {ntvOutputDirection = getDirection(uv, faceIndex);ntgl_Position = vec4( position, 1.0 );n}nt\"}function Nv(){return\"nuniform int inputEncoding;nuniform int outputEncoding;nn#include <encodings_pars_fragment>nnvec4 inputTexelToLinear(vec4 value){ntif(inputEncoding == 0){nttreturn value;nt}else if(inputEncoding == 1){nttreturn sRGBToLinear(value);nt}else if(inputEncoding == 2){nttreturn RGBEToLinear(value);nt}else if(inputEncoding == 3){nttreturn RGBMToLinear(value, 7.0);nt}else if(inputEncoding == 4){nttreturn RGBMToLinear(value, 16.0);nt}else if(inputEncoding == 5){nttreturn RGBDToLinear(value, 256.0);nt}else{nttreturn GammaToLinear(value, 2.2);nt}n}nnvec4 linearToOutputTexel(vec4 value){ntif(outputEncoding == 0){nttreturn value;nt}else if(outputEncoding == 1){nttreturn LinearTosRGB(value);nt}else if(outputEncoding == 2){nttreturn LinearToRGBE(value);nt}else if(outputEncoding == 3){nttreturn LinearToRGBM(value, 7.0);nt}else if(outputEncoding == 4){nttreturn LinearToRGBM(value, 16.0);nt}else if(outputEncoding == 5){nttreturn LinearToRGBD(value, 256.0);nt}else{nttreturn LinearToGamma(value, 2.2);nt}n}nnvec4 envMapTexelToLinear(vec4 color) {ntreturn inputTexelToLinear(color);n}nt\"}function Bv(e,t,r,n,i,a,o){return console.warn(\"THREE.Face4 has been removed. A THREE.Face3 will be created instead.\"),new mi(e,t,r,i,a,o)}xv.prototype={constructor:xv,fromScene:function(e,t=0,r=.1,n=100){mv=fv.getRenderTarget();var i=bv();return Mv(e,r,n,i),t>0&&Rv(i,0,0,t),Lv(i),wv(i),i},fromEquirectangular:function(e){return e.magFilter=fe,e.minFilter=fe,e.generateMipmaps=!1,this.fromCubemap(e)},fromCubemap:function(e){mv=fv.getRenderTarget();var t=bv(e);return Sv(e,t),Lv(t),wv(t),t},compileCubemapShader:function(){null==lv&&Tv(lv=Dv())},compileEquirectangularShader:function(){null==cv&&Tv(cv=Ov())},dispose:function(){sv.dispose(),null!=lv&&lv.dispose(),null!=cv&&cv.dispose();for(var e=0;e<hv.length;e++)hv[e].dispose()}};var Fv=0;exports.LineStrip=Fv;var Uv=1;exports.LinePieces=Uv;var Gv=0;exports.NoColors=Gv;var zv=1;exports.FaceColors=zv;var Hv=2;function Vv(e){return console.warn(\"THREE.MeshFaceMaterial has been removed. Use an Array instead.\"),e}function kv(e){return void 0===e&&(e=[]),console.warn(\"THREE.MultiMaterial has been removed. Use an Array instead.\"),e.isMultiMaterial=!0,e.materials=e,e.clone=function(){return e.slice()},e}function jv(e,t){return console.warn(\"THREE.PointCloud has been renamed to THREE.Points.\"),new cu(e,t)}function Wv(e){return console.warn(\"THREE.Particle has been renamed to THREE.Sprite.\"),new Ph(e)}function qv(e,t){return console.warn(\"THREE.ParticleSystem has been renamed to THREE.Points.\"),new cu(e,t)}function Xv(e){return console.warn(\"THREE.PointCloudMaterial has been renamed to THREE.PointsMaterial.\"),new nu(e)}function Yv(e){return console.warn(\"THREE.ParticleBasicMaterial has been renamed to THREE.PointsMaterial.\"),new nu(e)}function Zv(e){return console.warn(\"THREE.ParticleSystemMaterial has been renamed to THREE.PointsMaterial.\"),new nu(e)}function Jv(e,t,r){return console.warn(\"THREE.Vertex has been removed. Use THREE.Vector3 instead.\"),new Xr(e,t,r)}function Qv(e,t){return console.warn(\"THREE.DynamicBufferAttribute has been removed. Use new THREE.BufferAttribute().setUsage( THREE.DynamicDrawUsage ) instead.\"),new _i(e,t).setUsage(Mr)}function Kv(e,t){return console.warn(\"THREE.Int8Attribute has been removed. Use new THREE.Int8BufferAttribute() instead.\"),new bi(e,t)}function $v(e,t){return console.warn(\"THREE.Uint8Attribute has been removed. Use new THREE.Uint8BufferAttribute() instead.\"),new wi(e,t)}function eg(e,t){return console.warn(\"THREE.Uint8ClampedAttribute has been removed. Use new THREE.Uint8ClampedBufferAttribute() instead.\"),new Mi(e,t)}function tg(e,t){return console.warn(\"THREE.Int16Attribute has been removed. Use new THREE.Int16BufferAttribute() instead.\"),new Si(e,t)}function rg(e,t){return console.warn(\"THREE.Uint16Attribute has been removed. Use new THREE.Uint16BufferAttribute() instead.\"),new Ti(e,t)}function ng(e,t){return console.warn(\"THREE.Int32Attribute has been removed. Use new THREE.Int32BufferAttribute() instead.\"),new Ei(e,t)}function ig(e,t){return console.warn(\"THREE.Uint32Attribute has been removed. Use new THREE.Uint32BufferAttribute() instead.\"),new Ai(e,t)}function ag(e,t){return console.warn(\"THREE.Float32Attribute has been removed. Use new THREE.Float32BufferAttribute() instead.\"),new Li(e,t)}function og(e,t){return console.warn(\"THREE.Float64Attribute has been removed. Use new THREE.Float64BufferAttribute() instead.\"),new Ri(e,t)}function sg(e){console.warn(\"THREE.ClosedSplineCurve3 has been deprecated. Use THREE.CatmullRomCurve3 instead.\"),Ad.call(this,e),this.type=\"catmullrom\",this.closed=!0}function cg(e){console.warn(\"THREE.SplineCurve3 has been deprecated. Use THREE.CatmullRomCurve3 instead.\"),Ad.call(this,e),this.type=\"catmullrom\"}function lg(e){console.warn(\"THREE.Spline has been removed. Use THREE.CatmullRomCurve3 instead.\"),Ad.call(this,e),this.type=\"catmullrom\"}function hg(e){return console.warn(\"THREE.AxisHelper has been renamed to THREE.AxesHelper.\"),new Km(e)}function ug(e,t){return console.warn(\"THREE.BoundingBoxHelper has been deprecated. Creating a THREE.BoxHelper instead.\"),new Wm(e,t)}function pg(e,t){return console.warn(\"THREE.EdgesHelper has been removed. Use THREE.EdgesGeometry instead.\"),new tu(new Ep(e.geometry),new qh({color:void 0!==t?t:16777215}))}function dg(e,t){return console.warn(\"THREE.WireframeHelper has been removed. Use THREE.WireframeGeometry instead.\"),new tu(new fu(e.geometry),new qh({color:void 0!==t?t:16777215}))}function fg(e){return console.warn(\"THREE.XHRLoader has been renamed to THREE.FileLoader.\"),new pd(e)}function mg(e){return console.warn(\"THREE.BinaryTextureLoader has been renamed to THREE.DataTextureLoader.\"),new md(e)}function vg(e,t,r){return console.warn(\"THREE.WebGLRenderTargetCube( width, height, options ) is now WebGLCubeRenderTarget( size, options ).\"),new Sa(e,r)}exports.VertexColors=Hv,xd.create=function(e,t){return console.log(\"THREE.Curve.create() has been deprecated\"),e.prototype=Object.create(xd.prototype),e.prototype.constructor=e,e.prototype.getPoint=t,e},Object.assign(qd.prototype,{createPointsGeometry:function(e){console.warn(\"THREE.CurvePath: .createPointsGeometry() has been removed. Use new THREE.Geometry().setFromPoints( points ) instead.\");var t=this.getPoints(e);return this.createGeometry(t)},createSpacedPointsGeometry:function(e){console.warn(\"THREE.CurvePath: .createSpacedPointsGeometry() has been removed. Use new THREE.Geometry().setFromPoints( points ) instead.\");var t=this.getSpacedPoints(e);return this.createGeometry(t)},createGeometry:function(e){console.warn(\"THREE.CurvePath: .createGeometry() has been removed. Use new THREE.Geometry().setFromPoints( points ) instead.\");for(var t=new ha,r=0,n=e.length;r<n;r++){var i=e[r];t.vertices.push(new Xr(i.x,i.y,i.z||0))}return t}}),Object.assign(Xd.prototype,{fromPoints:function(e){return console.warn(\"THREE.Path: .fromPoints() has been renamed to .setFromPoints().\"),this.setFromPoints(e)}}),sg.prototype=Object.create(Ad.prototype),cg.prototype=Object.create(Ad.prototype),lg.prototype=Object.create(Ad.prototype),Object.assign(lg.prototype,{initFromArray:function(){console.error(\"THREE.Spline: .initFromArray() has been removed.\")},getControlPointsArray:function(){console.error(\"THREE.Spline: .getControlPointsArray() has been removed.\")},reparametrizeByArcLength:function(){console.error(\"THREE.Spline: .reparametrizeByArcLength() has been removed.\")}}),Im.prototype.setColors=function(){console.error(\"THREE.GridHelper: setColors() has been deprecated, pass them in the constructor instead.\")},Lm.prototype.update=function(){console.error(\"THREE.SkeletonHelper: update() no longer needs to be called.\")},Object.assign(hd.prototype,{extractUrlBase:function(e){return console.warn(\"THREE.Loader: .extractUrlBase() has been deprecated. Use THREE.LoaderUtils.extractUrlBase() instead.\"),lf.extractUrlBase(e)}}),hd.Handlers={add:function(){console.error(\"THREE.Loader: Handlers.add() has been removed. Use LoadingManager.addHandler() instead.\")},get:function(){console.error(\"THREE.Loader: Handlers.get() has been removed. Use LoadingManager.getHandler() instead.\")}},Object.assign(ff.prototype,{setTexturePath:function(e){return console.warn(\"THREE.ObjectLoader: .setTexturePath() has been renamed to .setResourcePath().\"),this.setResourcePath(e)}}),Object.assign(gm.prototype,{center:function(e){return console.warn(\"THREE.Box2: .center() has been renamed to .getCenter().\"),this.getCenter(e)},empty:function(){return console.warn(\"THREE.Box2: .empty() has been renamed to .isEmpty().\"),this.isEmpty()},isIntersectionBox:function(e){return console.warn(\"THREE.Box2: .isIntersectionBox() has been renamed to .intersectsBox().\"),this.intersectsBox(e)},size:function(e){return console.warn(\"THREE.Box2: .size() has been renamed to .getSize().\"),this.getSize(e)}}),Object.assign(Nn.prototype,{center:function(e){return console.warn(\"THREE.Box3: .center() has been renamed to .getCenter().\"),this.getCenter(e)},empty:function(){return console.warn(\"THREE.Box3: .empty() has been renamed to .isEmpty().\"),this.isEmpty()},isIntersectionBox:function(e){return console.warn(\"THREE.Box3: .isIntersectionBox() has been renamed to .intersectsBox().\"),this.intersectsBox(e)},isIntersectionSphere:function(e){return console.warn(\"THREE.Box3: .isIntersectionSphere() has been renamed to .intersectsSphere().\"),this.intersectsSphere(e)},size:function(e){return console.warn(\"THREE.Box3: .size() has been renamed to .getSize().\"),this.getSize(e)}}),La.prototype.setFromMatrix=function(e){return console.warn(\"THREE.Frustum: .setFromMatrix() has been renamed to .setFromProjectionMatrix().\"),this.setFromProjectionMatrix(e)},_m.prototype.center=function(e){return console.warn(\"THREE.Line3: .center() has been renamed to .getCenter().\"),this.getCenter(e)},Object.assign(Nr,{random16:function(){return console.warn(\"THREE.Math: .random16() has been deprecated. Use Math.random() instead.\"),Math.random()},nearestPowerOfTwo:function(e){return console.warn(\"THREE.Math: .nearestPowerOfTwo() has been renamed to .floorPowerOfTwo().\"),Nr.floorPowerOfTwo(e)},nextPowerOfTwo:function(e){return console.warn(\"THREE.Math: .nextPowerOfTwo() has been renamed to .ceilPowerOfTwo().\"),Nr.ceilPowerOfTwo(e)}}),Object.assign(Fr.prototype,{flattenToArrayOffset:function(e,t){return console.warn(\"THREE.Matrix3: .flattenToArrayOffset() has been deprecated. Use .toArray() instead.\"),this.toArray(e,t)},multiplyVector3:function(e){return console.warn(\"THREE.Matrix3: .multiplyVector3() has been removed. Use vector.applyMatrix3( matrix ) instead.\"),e.applyMatrix3(this)},multiplyVector3Array:function(){console.error(\"THREE.Matrix3: .multiplyVector3Array() has been removed.\")},applyToBufferAttribute:function(e){return console.warn(\"THREE.Matrix3: .applyToBufferAttribute() has been removed. Use attribute.applyMatrix3( matrix ) instead.\"),e.applyMatrix3(this)},applyToVector3Array:function(){console.error(\"THREE.Matrix3: .applyToVector3Array() has been removed.\")}}),Object.assign(tn.prototype,{extractPosition:function(e){return console.warn(\"THREE.Matrix4: .extractPosition() has been renamed to .copyPosition().\"),this.copyPosition(e)},flattenToArrayOffset:function(e,t){return console.warn(\"THREE.Matrix4: .flattenToArrayOffset() has been deprecated. Use .toArray() instead.\"),this.toArray(e,t)},getPosition:function(){return console.warn(\"THREE.Matrix4: .getPosition() has been removed. Use Vector3.setFromMatrixPosition( matrix ) instead.\"),(new Xr).setFromMatrixColumn(this,3)},setRotationFromQuaternion:function(e){return console.warn(\"THREE.Matrix4: .setRotationFromQuaternion() has been renamed to .makeRotationFromQuaternion().\"),this.makeRotationFromQuaternion(e)},multiplyToArray:function(){console.warn(\"THREE.Matrix4: .multiplyToArray() has been removed.\")},multiplyVector3:function(e){return console.warn(\"THREE.Matrix4: .multiplyVector3() has been removed. Use vector.applyMatrix4( matrix ) instead.\"),e.applyMatrix4(this)},multiplyVector4:function(e){return console.warn(\"THREE.Matrix4: .multiplyVector4() has been removed. Use vector.applyMatrix4( matrix ) instead.\"),e.applyMatrix4(this)},multiplyVector3Array:function(){console.error(\"THREE.Matrix4: .multiplyVector3Array() has been removed.\")},rotateAxis:function(e){console.warn(\"THREE.Matrix4: .rotateAxis() has been removed. Use Vector3.transformDirection( matrix ) instead.\"),e.transformDirection(this)},crossVector:function(e){return console.warn(\"THREE.Matrix4: .crossVector() has been removed. Use vector.applyMatrix4( matrix ) instead.\"),e.applyMatrix4(this)},translate:function(){console.error(\"THREE.Matrix4: .translate() has been removed.\")},rotateX:function(){console.error(\"THREE.Matrix4: .rotateX() has been removed.\")},rotateY:function(){console.error(\"THREE.Matrix4: .rotateY() has been removed.\")},rotateZ:function(){console.error(\"THREE.Matrix4: .rotateZ() has been removed.\")},rotateByAxis:function(){console.error(\"THREE.Matrix4: .rotateByAxis() has been removed.\")},applyToBufferAttribute:function(e){return console.warn(\"THREE.Matrix4: .applyToBufferAttribute() has been removed. Use attribute.applyMatrix4( matrix ) instead.\"),e.applyMatrix4(this)},applyToVector3Array:function(){console.error(\"THREE.Matrix4: .applyToVector3Array() has been removed.\")},makeFrustum:function(e,t,r,n,i,a){return console.warn(\"THREE.Matrix4: .makeFrustum() has been removed. Use .makePerspective( left, right, top, bottom, near, far ) instead.\"),this.makePerspective(e,t,n,r,i,a)}}),Jn.prototype.isIntersectionLine=function(e){return console.warn(\"THREE.Plane: .isIntersectionLine() has been renamed to .intersectsLine().\"),this.intersectsLine(e)},jr.prototype.multiplyVector3=function(e){return console.warn(\"THREE.Quaternion: .multiplyVector3() has been removed. Use is now vector.applyQuaternion( quaternion ) instead.\"),e.applyQuaternion(this)},Object.assign(qn.prototype,{isIntersectionBox:function(e){return console.warn(\"THREE.Ray: .isIntersectionBox() has been renamed to .intersectsBox().\"),this.intersectsBox(e)},isIntersectionPlane:function(e){return console.warn(\"THREE.Ray: .isIntersectionPlane() has been renamed to .intersectsPlane().\"),this.intersectsPlane(e)},isIntersectionSphere:function(e){return console.warn(\"THREE.Ray: .isIntersectionSphere() has been renamed to .intersectsSphere().\"),this.intersectsSphere(e)}}),Object.assign(si.prototype,{area:function(){return console.warn(\"THREE.Triangle: .area() has been renamed to .getArea().\"),this.getArea()},barycoordFromPoint:function(e,t){return console.warn(\"THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord().\"),this.getBarycoord(e,t)},midpoint:function(e){return console.warn(\"THREE.Triangle: .midpoint() has been renamed to .getMidpoint().\"),this.getMidpoint(e)},normal:function(e){return console.warn(\"THREE.Triangle: .normal() has been renamed to .getNormal().\"),this.getNormal(e)},plane:function(e){return console.warn(\"THREE.Triangle: .plane() has been renamed to .getPlane().\"),this.getPlane(e)}}),Object.assign(si,{barycoordFromPoint:function(e,t,r,n,i){return console.warn(\"THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord().\"),si.getBarycoord(e,t,r,n,i)},normal:function(e,t,r,n){return console.warn(\"THREE.Triangle: .normal() has been renamed to .getNormal().\"),si.getNormal(e,t,r,n)}}),Object.assign(Yd.prototype,{extractAllPoints:function(e){return console.warn(\"THREE.Shape: .extractAllPoints() has been removed. Use .extractPoints() instead.\"),this.extractPoints(e)},extrude:function(e){return console.warn(\"THREE.Shape: .extrude() has been removed. Use ExtrudeGeometry() instead.\"),new up(this,e)},makeGeometry:function(e){return console.warn(\"THREE.Shape: .makeGeometry() has been removed. Use ShapeGeometry() instead.\"),new Mp(this,e)}}),Object.assign(Br.prototype,{fromAttribute:function(e,t,r){return console.warn(\"THREE.Vector2: .fromAttribute() has been renamed to .fromBufferAttribute().\"),this.fromBufferAttribute(e,t,r)},distanceToManhattan:function(e){return console.warn(\"THREE.Vector2: .distanceToManhattan() has been renamed to .manhattanDistanceTo().\"),this.manhattanDistanceTo(e)},lengthManhattan:function(){return console.warn(\"THREE.Vector2: .lengthManhattan() has been renamed to .manhattanLength().\"),this.manhattanLength()}}),Object.assign(Xr.prototype,{setEulerFromRotationMatrix:function(){console.error(\"THREE.Vector3: .setEulerFromRotationMatrix() has been removed. Use Euler.setFromRotationMatrix() instead.\")},setEulerFromQuaternion:function(){console.error(\"THREE.Vector3: .setEulerFromQuaternion() has been removed. Use Euler.setFromQuaternion() instead.\")},getPositionFromMatrix:function(e){return console.warn(\"THREE.Vector3: .getPositionFromMatrix() has been renamed to .setFromMatrixPosition().\"),this.setFromMatrixPosition(e)},getScaleFromMatrix:function(e){return console.warn(\"THREE.Vector3: .getScaleFromMatrix() has been renamed to .setFromMatrixScale().\"),this.setFromMatrixScale(e)},getColumnFromMatrix:function(e,t){return console.warn(\"THREE.Vector3: .getColumnFromMatrix() has been renamed to .setFromMatrixColumn().\"),this.setFromMatrixColumn(t,e)},applyProjection:function(e){return console.warn(\"THREE.Vector3: .applyProjection() has been removed. Use .applyMatrix4( m ) instead.\"),this.applyMatrix4(e)},fromAttribute:function(e,t,r){return console.warn(\"THREE.Vector3: .fromAttribute() has been renamed to .fromBufferAttribute().\"),this.fromBufferAttribute(e,t,r)},distanceToManhattan:function(e){return console.warn(\"THREE.Vector3: .distanceToManhattan() has been renamed to .manhattanDistanceTo().\"),this.manhattanDistanceTo(e)},lengthManhattan:function(){return console.warn(\"THREE.Vector3: .lengthManhattan() has been renamed to .manhattanLength().\"),this.manhattanLength()}}),Object.assign(Hr.prototype,{fromAttribute:function(e,t,r){return console.warn(\"THREE.Vector4: .fromAttribute() has been renamed to .fromBufferAttribute().\"),this.fromBufferAttribute(e,t,r)},lengthManhattan:function(){return console.warn(\"THREE.Vector4: .lengthManhattan() has been renamed to .manhattanLength().\"),this.manhattanLength()}}),Object.assign(ha.prototype,{computeTangents:function(){console.error(\"THREE.Geometry: .computeTangents() has been removed.\")},computeLineDistances:function(){console.error(\"THREE.Geometry: .computeLineDistances() has been removed. Use THREE.Line.computeLineDistances() instead.\")},applyMatrix:function(e){return console.warn(\"THREE.Geometry: .applyMatrix() has been renamed to .applyMatrix4().\"),this.applyMatrix4(e)}}),Object.assign(_n.prototype,{getChildByName:function(e){return console.warn(\"THREE.Object3D: .getChildByName() has been renamed to .getObjectByName().\"),this.getObjectByName(e)},renderDepth:function(){console.warn(\"THREE.Object3D: .renderDepth has been removed. Use .renderOrder, instead.\")},translate:function(e,t){return console.warn(\"THREE.Object3D: .translate() has been removed. Use .translateOnAxis( axis, distance ) instead.\"),this.translateOnAxis(t,e)},getWorldRotation:function(){console.error(\"THREE.Object3D: .getWorldRotation() has been removed. Use THREE.Object3D.getWorldQuaternion( target ) instead.\")},applyMatrix:function(e){return console.warn(\"THREE.Object3D: .applyMatrix() has been renamed to .applyMatrix4().\"),this.applyMatrix4(e)}}),Object.defineProperties(_n.prototype,{eulerOrder:{get:function(){return console.warn(\"THREE.Object3D: .eulerOrder is now .rotation.order.\"),this.rotation.order},set:function(e){console.warn(\"THREE.Object3D: .eulerOrder is now .rotation.order.\"),this.rotation.order=e}},useQuaternion:{get:function(){console.warn(\"THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.\")},set:function(){console.warn(\"THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.\")}}}),Object.assign(na.prototype,{setDrawMode:function(){console.error(\"THREE.Mesh: .setDrawMode() has been removed. The renderer now always assumes THREE.TrianglesDrawMode. Transform your geometry via BufferGeometryUtils.toTrianglesDrawMode() if necessary.\")}}),Object.defineProperties(na.prototype,{drawMode:{get:function(){return console.error(\"THREE.Mesh: .drawMode has been removed. The renderer now always assumes THREE.TrianglesDrawMode.\"),Wt},set:function(){console.error(\"THREE.Mesh: .drawMode has been removed. The renderer now always assumes THREE.TrianglesDrawMode. Transform your geometry via BufferGeometryUtils.toTrianglesDrawMode() if necessary.\")}}}),Object.defineProperties(Nh.prototype,{objects:{get:function(){return console.warn(\"THREE.LOD: .objects has been renamed to .levels.\"),this.levels}}}),Object.defineProperty(Gh.prototype,\"useVertexTexture\",{get:function(){console.warn(\"THREE.Skeleton: useVertexTexture has been removed.\")},set:function(){console.warn(\"THREE.Skeleton: useVertexTexture has been removed.\")}}),Bh.prototype.initBones=function(){console.error(\"THREE.SkinnedMesh: initBones() has been removed.\")},Object.defineProperty(xd.prototype,\"__arcLengthDivisions\",{get:function(){return console.warn(\"THREE.Curve: .__arcLengthDivisions is now .arcLengthDivisions.\"),this.arcLengthDivisions},set:function(e){console.warn(\"THREE.Curve: .__arcLengthDivisions is now .arcLengthDivisions.\"),this.arcLengthDivisions=e}}),_a.prototype.setLens=function(e,t){console.warn(\"THREE.PerspectiveCamera.setLens is deprecated. Use .setFocalLength and .filmGauge for a photographic setup.\"),void 0!==t&&(this.filmGauge=t),this.setFocalLength(e)},Object.defineProperties(Zd.prototype,{onlyShadow:{set:function(){console.warn(\"THREE.Light: .onlyShadow has been removed.\")}},shadowCameraFov:{set:function(e){console.warn(\"THREE.Light: .shadowCameraFov is now .shadow.camera.fov.\"),this.shadow.camera.fov=e}},shadowCameraLeft:{set:function(e){console.warn(\"THREE.Light: .shadowCameraLeft is now .shadow.camera.left.\"),this.shadow.camera.left=e}},shadowCameraRight:{set:function(e){console.warn(\"THREE.Light: .shadowCameraRight is now .shadow.camera.right.\"),this.shadow.camera.right=e}},shadowCameraTop:{set:function(e){console.warn(\"THREE.Light: .shadowCameraTop is now .shadow.camera.top.\"),this.shadow.camera.top=e}},shadowCameraBottom:{set:function(e){console.warn(\"THREE.Light: .shadowCameraBottom is now .shadow.camera.bottom.\"),this.shadow.camera.bottom=e}},shadowCameraNear:{set:function(e){console.warn(\"THREE.Light: .shadowCameraNear is now .shadow.camera.near.\"),this.shadow.camera.near=e}},shadowCameraFar:{set:function(e){console.warn(\"THREE.Light: .shadowCameraFar is now .shadow.camera.far.\"),this.shadow.camera.far=e}},shadowCameraVisible:{set:function(){console.warn(\"THREE.Light: .shadowCameraVisible has been removed. Use new THREE.CameraHelper( light.shadow.camera ) instead.\")}},shadowBias:{set:function(e){console.warn(\"THREE.Light: .shadowBias is now .shadow.bias.\"),this.shadow.bias=e}},shadowDarkness:{set:function(){console.warn(\"THREE.Light: .shadowDarkness has been removed.\")}},shadowMapWidth:{set:function(e){console.warn(\"THREE.Light: .shadowMapWidth is now .shadow.mapSize.width.\"),this.shadow.mapSize.width=e}},shadowMapHeight:{set:function(e){console.warn(\"THREE.Light: .shadowMapHeight is now .shadow.mapSize.height.\"),this.shadow.mapSize.height=e}}}),Object.defineProperties(_i.prototype,{length:{get:function(){return console.warn(\"THREE.BufferAttribute: .length has been deprecated. Use .count instead.\"),this.array.length}},dynamic:{get:function(){return console.warn(\"THREE.BufferAttribute: .dynamic has been deprecated. Use .usage instead.\"),this.usage===Mr},set:function(){console.warn(\"THREE.BufferAttribute: .dynamic has been deprecated. Use .usage instead.\"),this.setUsage(Mr)}}}),Object.assign(_i.prototype,{setDynamic:function(e){return console.warn(\"THREE.BufferAttribute: .setDynamic() has been deprecated. Use .setUsage() instead.\"),this.setUsage(!0===e?Mr:wr),this},copyIndicesArray:function(){console.error(\"THREE.BufferAttribute: .copyIndicesArray() has been removed.\")},setArray:function(){console.error(\"THREE.BufferAttribute: .setArray has been removed. Use BufferGeometry .setAttribute to replace\/resize attribute buffers\")}}),Object.assign(Gi.prototype,{addIndex:function(e){console.warn(\"THREE.BufferGeometry: .addIndex() has been renamed to .setIndex().\"),this.setIndex(e)},addAttribute:function(e,t){return console.warn(\"THREE.BufferGeometry: .addAttribute() has been renamed to .setAttribute().\"),t&&t.isBufferAttribute||t&&t.isInterleavedBufferAttribute?\"index\"===e?(console.warn(\"THREE.BufferGeometry.addAttribute: Use .setIndex() for index attribute.\"),this.setIndex(t),this):this.setAttribute(e,t):(console.warn(\"THREE.BufferGeometry: .addAttribute() now expects ( name, attribute ).\"),this.setAttribute(e,new _i(arguments[1],arguments[2])))},addDrawCall:function(e,t,r){void 0!==r&&console.warn(\"THREE.BufferGeometry: .addDrawCall() no longer supports indexOffset.\"),console.warn(\"THREE.BufferGeometry: .addDrawCall() is now .addGroup().\"),this.addGroup(e,t)},clearDrawCalls:function(){console.warn(\"THREE.BufferGeometry: .clearDrawCalls() is now .clearGroups().\"),this.clearGroups()},computeTangents:function(){console.warn(\"THREE.BufferGeometry: .computeTangents() has been removed.\")},computeOffsets:function(){console.warn(\"THREE.BufferGeometry: .computeOffsets() has been removed.\")},removeAttribute:function(e){return console.warn(\"THREE.BufferGeometry: .removeAttribute() has been renamed to .deleteAttribute().\"),this.deleteAttribute(e)},applyMatrix:function(e){return console.warn(\"THREE.BufferGeometry: .applyMatrix() has been renamed to .applyMatrix4().\"),this.applyMatrix4(e)}}),Object.defineProperties(Gi.prototype,{drawcalls:{get:function(){return console.error(\"THREE.BufferGeometry: .drawcalls has been renamed to .groups.\"),this.groups}},offsets:{get:function(){return console.warn(\"THREE.BufferGeometry: .offsets has been renamed to .groups.\"),this.groups}}}),Object.defineProperties(um.prototype,{linePrecision:{get:function(){return console.warn(\"THREE.Raycaster: .linePrecision has been deprecated. Use .params.Line.threshold instead.\"),this.params.Line.threshold},set:function(e){console.warn(\"THREE.Raycaster: .linePrecision has been deprecated. Use .params.Line.threshold instead.\"),this.params.Line.threshold=e}}}),Object.defineProperties(fh.prototype,{dynamic:{get:function(){return console.warn(\"THREE.InterleavedBuffer: .length has been deprecated. Use .usage instead.\"),this.usage===Mr},set:function(e){console.warn(\"THREE.InterleavedBuffer: .length has been deprecated. Use .usage instead.\"),this.setUsage(e)}}}),Object.assign(fh.prototype,{setDynamic:function(e){return console.warn(\"THREE.InterleavedBuffer: .setDynamic() has been deprecated. Use .setUsage() instead.\"),this.setUsage(!0===e?Mr:wr),this},setArray:function(){console.error(\"THREE.InterleavedBuffer: .setArray has been removed. Use BufferGeometry .setAttribute to replace\/resize attribute buffers\")}}),Object.assign(pp.prototype,{getArrays:function(){console.error(\"THREE.ExtrudeBufferGeometry: .getArrays() has been removed.\")},addShapeList:function(){console.error(\"THREE.ExtrudeBufferGeometry: .addShapeList() has been removed.\")},addShape:function(){console.error(\"THREE.ExtrudeBufferGeometry: .addShape() has been removed.\")}}),Object.defineProperties(lm.prototype,{dynamic:{set:function(){console.warn(\"THREE.Uniform: .dynamic has been removed. Use object.onBeforeRender() instead.\")}},onUpdate:{value:function(){return console.warn(\"THREE.Uniform: .onUpdate() has been removed. Use object.onBeforeRender() instead.\"),this}}}),Object.defineProperties(gi.prototype,{wrapAround:{get:function(){console.warn(\"THREE.Material: .wrapAround has been removed.\")},set:function(){console.warn(\"THREE.Material: .wrapAround has been removed.\")}},overdraw:{get:function(){console.warn(\"THREE.Material: .overdraw has been removed.\")},set:function(){console.warn(\"THREE.Material: .overdraw has been removed.\")}},wrapRGB:{get:function(){return console.warn(\"THREE.Material: .wrapRGB has been removed.\"),new ui}},shading:{get:function(){console.error(\"THREE.\"+this.type+\": .shading has been removed. Use the boolean .flatShading instead.\")},set:function(e){console.warn(\"THREE.\"+this.type+\": .shading has been removed. Use the boolean .flatShading instead.\"),this.flatShading=e===v}},stencilMask:{get:function(){return console.warn(\"THREE.\"+this.type+\": .stencilMask has been removed. Use .stencilFuncMask instead.\"),this.stencilFuncMask},set:function(e){console.warn(\"THREE.\"+this.type+\": .stencilMask has been removed. Use .stencilFuncMask instead.\"),this.stencilFuncMask=e}}}),Object.defineProperties(Up.prototype,{metal:{get:function(){return console.warn(\"THREE.MeshPhongMaterial: .metal has been removed. Use THREE.MeshStandardMaterial instead.\"),!1},set:function(){console.warn(\"THREE.MeshPhongMaterial: .metal has been removed. Use THREE.MeshStandardMaterial instead\")}}}),Object.defineProperties(ya.prototype,{derivatives:{get:function(){return console.warn(\"THREE.ShaderMaterial: .derivatives has been moved to .extensions.derivatives.\"),this.extensions.derivatives},set:function(e){console.warn(\"THREE. ShaderMaterial: .derivatives has been moved to .extensions.derivatives.\"),this.extensions.derivatives=e}}}),Object.assign(uh.prototype,{clearTarget:function(e,t,r,n){console.warn(\"THREE.WebGLRenderer: .clearTarget() has been deprecated. Use .setRenderTarget() and .clear() instead.\"),this.setRenderTarget(e),this.clear(t,r,n)},animate:function(e){console.warn(\"THREE.WebGLRenderer: .animate() is now .setAnimationLoop().\"),this.setAnimationLoop(e)},getCurrentRenderTarget:function(){return console.warn(\"THREE.WebGLRenderer: .getCurrentRenderTarget() is now .getRenderTarget().\"),this.getRenderTarget()},getMaxAnisotropy:function(){return console.warn(\"THREE.WebGLRenderer: .getMaxAnisotropy() is now .capabilities.getMaxAnisotropy().\"),this.capabilities.getMaxAnisotropy()},getPrecision:function(){return console.warn(\"THREE.WebGLRenderer: .getPrecision() is now .capabilities.precision.\"),this.capabilities.precision},resetGLState:function(){return console.warn(\"THREE.WebGLRenderer: .resetGLState() is now .state.reset().\"),this.state.reset()},supportsFloatTextures:function(){return console.warn(\"THREE.WebGLRenderer: .supportsFloatTextures() is now .extensions.get( 'OES_texture_float' ).\"),this.extensions.get(\"OES_texture_float\")},supportsHalfFloatTextures:function(){return console.warn(\"THREE.WebGLRenderer: .supportsHalfFloatTextures() is now .extensions.get( 'OES_texture_half_float' ).\"),this.extensions.get(\"OES_texture_half_float\")},supportsStandardDerivatives:function(){return console.warn(\"THREE.WebGLRenderer: .supportsStandardDerivatives() is now .extensions.get( 'OES_standard_derivatives' ).\"),this.extensions.get(\"OES_standard_derivatives\")},supportsCompressedTextureS3TC:function(){return console.warn(\"THREE.WebGLRenderer: .supportsCompressedTextureS3TC() is now .extensions.get( 'WEBGL_compressed_texture_s3tc' ).\"),this.extensions.get(\"WEBGL_compressed_texture_s3tc\")},supportsCompressedTexturePVRTC:function(){return console.warn(\"THREE.WebGLRenderer: .supportsCompressedTexturePVRTC() is now .extensions.get( 'WEBGL_compressed_texture_pvrtc' ).\"),this.extensions.get(\"WEBGL_compressed_texture_pvrtc\")},supportsBlendMinMax:function(){return console.warn(\"THREE.WebGLRenderer: .supportsBlendMinMax() is now .extensions.get( 'EXT_blend_minmax' ).\"),this.extensions.get(\"EXT_blend_minmax\")},supportsVertexTextures:function(){return console.warn(\"THREE.WebGLRenderer: .supportsVertexTextures() is now .capabilities.vertexTextures.\"),this.capabilities.vertexTextures},supportsInstancedArrays:function(){return console.warn(\"THREE.WebGLRenderer: .supportsInstancedArrays() is now .extensions.get( 'ANGLE_instanced_arrays' ).\"),this.extensions.get(\"ANGLE_instanced_arrays\")},enableScissorTest:function(e){console.warn(\"THREE.WebGLRenderer: .enableScissorTest() is now .setScissorTest().\"),this.setScissorTest(e)},initMaterial:function(){console.warn(\"THREE.WebGLRenderer: .initMaterial() has been removed.\")},addPrePlugin:function(){console.warn(\"THREE.WebGLRenderer: .addPrePlugin() has been removed.\")},addPostPlugin:function(){console.warn(\"THREE.WebGLRenderer: .addPostPlugin() has been removed.\")},updateShadowMap:function(){console.warn(\"THREE.WebGLRenderer: .updateShadowMap() has been removed.\")},setFaceCulling:function(){console.warn(\"THREE.WebGLRenderer: .setFaceCulling() has been removed.\")},allocTextureUnit:function(){console.warn(\"THREE.WebGLRenderer: .allocTextureUnit() has been removed.\")},setTexture:function(){console.warn(\"THREE.WebGLRenderer: .setTexture() has been removed.\")},setTexture2D:function(){console.warn(\"THREE.WebGLRenderer: .setTexture2D() has been removed.\")},setTextureCube:function(){console.warn(\"THREE.WebGLRenderer: .setTextureCube() has been removed.\")},getActiveMipMapLevel:function(){return console.warn(\"THREE.WebGLRenderer: .getActiveMipMapLevel() is now .getActiveMipmapLevel().\"),this.getActiveMipmapLevel()}}),Object.defineProperties(uh.prototype,{shadowMapEnabled:{get:function(){return this.shadowMap.enabled},set:function(e){console.warn(\"THREE.WebGLRenderer: .shadowMapEnabled is now .shadowMap.enabled.\"),this.shadowMap.enabled=e}},shadowMapType:{get:function(){return this.shadowMap.type},set:function(e){console.warn(\"THREE.WebGLRenderer: .shadowMapType is now .shadowMap.type.\"),this.shadowMap.type=e}},shadowMapCullFace:{get:function(){console.warn(\"THREE.WebGLRenderer: .shadowMapCullFace has been removed. Set Material.shadowSide instead.\")},set:function(){console.warn(\"THREE.WebGLRenderer: .shadowMapCullFace has been removed. Set Material.shadowSide instead.\")}},context:{get:function(){return console.warn(\"THREE.WebGLRenderer: .context has been removed. Use .getContext() instead.\"),this.getContext()}},vr:{get:function(){return console.warn(\"THREE.WebGLRenderer: .vr has been renamed to .xr\"),this.xr}},gammaInput:{get:function(){return console.warn(\"THREE.WebGLRenderer: .gammaInput has been removed. Set the encoding for textures via Texture.encoding instead.\"),!1},set:function(){console.warn(\"THREE.WebGLRenderer: .gammaInput has been removed. Set the encoding for textures via Texture.encoding instead.\")}},gammaOutput:{get:function(){return console.warn(\"THREE.WebGLRenderer: .gammaOutput has been removed. Set WebGLRenderer.outputEncoding instead.\"),!1},set:function(e){console.warn(\"THREE.WebGLRenderer: .gammaOutput has been removed. Set WebGLRenderer.outputEncoding instead.\"),this.outputEncoding=!0===e?Zt:Yt}}}),Object.defineProperties(ih.prototype,{cullFace:{get:function(){console.warn(\"THREE.WebGLRenderer: .shadowMap.cullFace has been removed. Set Material.shadowSide instead.\")},set:function(){console.warn(\"THREE.WebGLRenderer: .shadowMap.cullFace has been removed. Set Material.shadowSide instead.\")}},renderReverseSided:{get:function(){console.warn(\"THREE.WebGLRenderer: .shadowMap.renderReverseSided has been removed. Set Material.shadowSide instead.\")},set:function(){console.warn(\"THREE.WebGLRenderer: .shadowMap.renderReverseSided has been removed. Set Material.shadowSide instead.\")}},renderSingleSided:{get:function(){console.warn(\"THREE.WebGLRenderer: .shadowMap.renderSingleSided has been removed. Set Material.shadowSide instead.\")},set:function(){console.warn(\"THREE.WebGLRenderer: .shadowMap.renderSingleSided has been removed. Set Material.shadowSide instead.\")}}}),Object.defineProperties(Vr.prototype,{wrapS:{get:function(){return console.warn(\"THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS.\"),this.texture.wrapS},set:function(e){console.warn(\"THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS.\"),this.texture.wrapS=e}},wrapT:{get:function(){return console.warn(\"THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT.\"),this.texture.wrapT},set:function(e){console.warn(\"THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT.\"),this.texture.wrapT=e}},magFilter:{get:function(){return console.warn(\"THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter.\"),this.texture.magFilter},set:function(e){console.warn(\"THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter.\"),this.texture.magFilter=e}},minFilter:{get:function(){return console.warn(\"THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter.\"),this.texture.minFilter},set:function(e){console.warn(\"THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter.\"),this.texture.minFilter=e}},anisotropy:{get:function(){return console.warn(\"THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy.\"),this.texture.anisotropy},set:function(e){console.warn(\"THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy.\"),this.texture.anisotropy=e}},offset:{get:function(){return console.warn(\"THREE.WebGLRenderTarget: .offset is now .texture.offset.\"),this.texture.offset},set:function(e){console.warn(\"THREE.WebGLRenderTarget: .offset is now .texture.offset.\"),this.texture.offset=e}},repeat:{get:function(){return console.warn(\"THREE.WebGLRenderTarget: .repeat is now .texture.repeat.\"),this.texture.repeat},set:function(e){console.warn(\"THREE.WebGLRenderTarget: .repeat is now .texture.repeat.\"),this.texture.repeat=e}},format:{get:function(){return console.warn(\"THREE.WebGLRenderTarget: .format is now .texture.format.\"),this.texture.format},set:function(e){console.warn(\"THREE.WebGLRenderTarget: .format is now .texture.format.\"),this.texture.format=e}},type:{get:function(){return console.warn(\"THREE.WebGLRenderTarget: .type is now .texture.type.\"),this.texture.type},set:function(e){console.warn(\"THREE.WebGLRenderTarget: .type is now .texture.type.\"),this.texture.type=e}},generateMipmaps:{get:function(){return console.warn(\"THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps.\"),this.texture.generateMipmaps},set:function(e){console.warn(\"THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps.\"),this.texture.generateMipmaps=e}}}),Object.defineProperties(zf.prototype,{load:{value:function(e){console.warn(\"THREE.Audio: .load has been deprecated. Use THREE.AudioLoader instead.\");var t=this;return(new Ef).load(e,function(e){t.setBuffer(e)}),this}},startTime:{set:function(){console.warn(\"THREE.Audio: .startTime is now .play( delay ).\")}}}),qf.prototype.getData=function(){return console.warn(\"THREE.AudioAnalyser: .getData() is now .getFrequencyData().\"),this.getFrequencyData()},Ma.prototype.updateCubeMap=function(e,t){return console.warn(\"THREE.CubeCamera: .updateCubeMap() is now .update().\"),this.update(e,t)};var gg={merge:function(e,t,r){var n;console.warn(\"THREE.GeometryUtils: .merge() has been moved to Geometry. Use geometry.merge( geometry2, matrix, materialIndexOffset ) instead.\"),t.isMesh&&(t.matrixAutoUpdate&&t.updateMatrix(),n=t.matrix,t=t.geometry),e.merge(t,n,r)},center:function(e){return console.warn(\"THREE.GeometryUtils: .center() has been moved to Geometry. Use geometry.center() instead.\"),e.center()}};function yg(){console.error(\"THREE.CanvasRenderer has been removed\")}function xg(){console.error(\"THREE.JSONLoader has been removed.\")}exports.GeometryUtils=gg,Ur.crossOrigin=void 0,Ur.loadTexture=function(e,t,r,n){console.warn(\"THREE.ImageUtils.loadTexture has been deprecated. Use THREE.TextureLoader() instead.\");var i=new yd;i.setCrossOrigin(this.crossOrigin);var a=i.load(e,r,void 0,n);return t&&(a.mapping=t),a},Ur.loadTextureCube=function(e,t,r,n){console.warn(\"THREE.ImageUtils.loadTextureCube has been deprecated. Use THREE.CubeTextureLoader() instead.\");var i=new gd;i.setCrossOrigin(this.crossOrigin);var a=i.load(e,r,void 0,n);return t&&(a.mapping=t),a},Ur.loadCompressedTexture=function(){console.error(\"THREE.ImageUtils.loadCompressedTexture has been removed. Use THREE.DDSLoader instead.\")},Ur.loadCompressedTextureCube=function(){console.error(\"THREE.ImageUtils.loadCompressedTextureCube has been removed. Use THREE.DDSLoader instead.\")};var _g={createMultiMaterialObject:function(){console.error(\"THREE.SceneUtils has been moved to \/examples\/jsm\/utils\/SceneUtils.js\")},detach:function(){console.error(\"THREE.SceneUtils has been moved to \/examples\/jsm\/utils\/SceneUtils.js\")},attach:function(){console.error(\"THREE.SceneUtils has been moved to \/examples\/jsm\/utils\/SceneUtils.js\")}};function bg(){console.error(\"THREE.LensFlare has been moved to \/examples\/jsm\/objects\/Lensflare.js\")}exports.SceneUtils=_g,\"undefined\"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent(\"register\",{detail:{revision:e}}));\n},{}],\"dax8\":[function(require,module,exports) {\nmodule.exports=\"#define GLSLIFY 1nuniform float u_t;nnuniform float u_audio_high;nuniform float u_audio_level;nuniform float u_audio_history;nnvarying float v_noise;nnvec3 mod289(vec3 x)n{n    return x - floor(x * (1.0 \/ 289.0)) * 289.0;n}nnvec4 mod289(vec4 x) {n    return x - floor(x * (1.0 \/ 289.0)) * 289.0;n}nnvec4 permute(vec4 x)n{n    return mod289((x * 34.0 + 1.0) * x);n}nnvec4 taylorInvSqrt(vec4 r)n{n    return 1.79284291400159 - 0.85373472095314 * r;n}nnfloat snoise(vec3 v)n{n    const vec2 C = vec2(1.0 \/ 6.0, 1.0 \/ 3.0);nn    \/\/ First cornern    vec3 i  = floor(v + dot(v, C.yyy));n    vec3 x0 = v   - i + dot(i, C.xxx);nn    \/\/ Other cornersn    vec3 g = step(x0.yzx, x0.xyz);n    vec3 l = 1.0 - g;n    vec3 i1 = min(g.xyz, l.zxy);n    vec3 i2 = max(g.xyz, l.zxy);nn    \/\/ x1 = x0 - i1  + 1.0 * C.xxx;n    \/\/ x2 = x0 - i2  + 2.0 * C.xxx;n    \/\/ x3 = x0 - 1.0 + 3.0 * C.xxx;n    vec3 x1 = x0 - i1 + C.xxx;n    vec3 x2 = x0 - i2 + C.yyy;n    vec3 x3 = x0 - 0.5;nn    \/\/ Permutationsn    i = mod289(i); \/\/ Avoid truncation effects in permutationn    vec4 p =n      permute(permute(permute(i.z + vec4(0.0, i1.z, i2.z, 1.0))n                            + i.y + vec4(0.0, i1.y, i2.y, 1.0))n                            + i.x + vec4(0.0, i1.x, i2.x, 1.0));nn    \/\/ Gradients: 7x7 points over a square, mapped onto an octahedron.n    \/\/ The ring size 17*17 = 289 is close to a multiple of 49 (49*6 = 294)n    vec4 j = p - 49.0 * floor(p * (1.0 \/ 49.0));  \/\/ mod(p,7*7)nn    vec4 x_ = floor(j * (1.0 \/ 7.0));n    vec4 y_ = floor(j - 7.0 * x_ );  \/\/ mod(j,N)nn    vec4 x = x_ * (2.0 \/ 7.0) + 0.5 \/ 7.0 - 1.0;n    vec4 y = y_ * (2.0 \/ 7.0) + 0.5 \/ 7.0 - 1.0;nn    vec4 h = 1.0 - abs(x) - abs(y);nn    vec4 b0 = vec4(x.xy, y.xy);n    vec4 b1 = vec4(x.zw, y.zw);nn    \/\/vec4 s0 = vec4(lessThan(b0, 0.0)) * 2.0 - 1.0;n    \/\/vec4 s1 = vec4(lessThan(b1, 0.0)) * 2.0 - 1.0;n    vec4 s0 = floor(b0) * 2.0 + 1.0;n    vec4 s1 = floor(b1) * 2.0 + 1.0;n    vec4 sh = -step(h, vec4(0.0));nn    vec4 a0 = b0.xzyw + s0.xzyw * sh.xxyy;n    vec4 a1 = b1.xzyw + s1.xzyw * sh.zzww;nn    vec3 g0 = vec3(a0.xy, h.x);n    vec3 g1 = vec3(a0.zw, h.y);n    vec3 g2 = vec3(a1.xy, h.z);n    vec3 g3 = vec3(a1.zw, h.w);nn    \/\/ Normalise gradientsn    vec4 norm = taylorInvSqrt(vec4(dot(g0, g0), dot(g1, g1), dot(g2, g2), dot(g3, g3)));n    g0 *= norm.x;n    g1 *= norm.y;n    g2 *= norm.z;n    g3 *= norm.w;nn    \/\/ Mix final noise valuen    vec4 m = max(0.6 - vec4(dot(x0, x0), dot(x1, x1), dot(x2, x2), dot(x3, x3)), 0.0);n    m = m * m;n    m = m * m;nn    vec4 px = vec4(dot(x0, g0), dot(x1, g1), dot(x2, g2), dot(x3, g3));n    return (42.0 * dot(m, px) + 1.) * .5;n}nnvec3 norm(in vec3 _v){ntreturn length(_v) > .0 ? normalize(_v) : vec3(.0);n}nn#define NOISE_COMPLEXITY .6n#define NOISE_OCTAVE 5nnvoid main(){ntfloat m_noise_time = u_audio_history;ntfloat m_noise_scale = 2.2 + u_audio_level;nn    float m_fbm = 0.;n    for(int i = 0; i < NOISE_OCTAVE; i++){n    tm_fbm += snoise(n    ttposition.xyz * NOISE_COMPLEXITY * float(i) + n    ttm_noise_time * float(i)n    t);n    }n    m_fbm \/= float(NOISE_OCTAVE);nn    vec3 m_pos = position + norm(position) * m_fbm * m_noise_scale;nnt\/\/ get color n    float m_noise_col = pow(abs(1.-m_fbm), 3.5);n    v_noise = m_noise_col + m_noise_col * u_audio_level * 2.2;     nn    \/\/ rand directionn    float _dirx = snoise(m_pos.zyx * 4. + m_noise_time * .01);ntfloat _diry = snoise(m_pos.yzx * 4. + m_noise_time * .01);ntfloat _dirz = snoise(m_pos.zxy * 4. + m_noise_time * .01);ntvec3 _rand_point_dir = vec3(_dirx, _diry, _dirz);nt_rand_point_dir = 1. - 2. * _rand_point_dir;nn#if defined(IS_WIRE) || defined(IS_POINTS)ntgl_PointSize = pow(abs(m_fbm), 6.) * 1000. * u_audio_high;n    m_pos += (_rand_point_dir * .3 * u_audio_level);n#endifnn#if defined(IS_POP)n    m_pos += (_rand_point_dir * .1 * u_audio_high * u_audio_high);n#endifnn#if defined(IS_POP_OUT)ntm_pos += (_rand_point_dir*_rand_point_dir * .2 * u_audio_high);n#endifnntgl_Position = projectionMatrix * modelViewMatrix * vec4(m_pos, 1.);n}\";\n},{}],\"zjQ3\":[function(require,module,exports) {\nmodule.exports=\"#define GLSLIFY 1nvarying float v_noise;nnuniform float u_audio_high;nuniform float u_audio_level;nuniform float u_audio_history;nnvec3 norm(in vec3 _v){n  return length(_v) > .0 ? normalize(_v) : vec3(.0);n}nn#if defined(IS_POINTS)n  uniform sampler2D tex_sprite;n#endifnnvoid main(){n  float noise = v_noise;n  float noiseInv = 1. - v_noise;nn  float c = noise * 1.5 - pow(abs(noiseInv), 4.) * .95;n  c = clamp(c, 0., 2.);n  c *= smoothstep(0., .9, u_audio_level);nn#if defined(IS_WIRE) || defined(IS_POINTS)n  c += 1. * pow(abs(noise), 4.) * u_audio_level;n  c += .6 * noiseInv * u_audio_high * u_audio_high;;nn  #if defined(IS_WIRE)n    c *= .1;n  #endifn#elsen  c *= .2;n#endif nn  float cNoise = c * noise;n  vec3 col = vec3(c * 2., cNoise, cNoise);n  col = mix(col.gbr * sin(u_audio_history), col, noiseInv);nn  gl_FragColor = vec4(col, 1.);nn#if defined(IS_POINTS)n  gl_FragColor *= texture2D(tex_sprite, gl_PointCoord);n#endifnn#if defined(IS_POP) || defined(IS_POP_OUT)n  gl_FragColor.rgb = pow(abs(gl_FragColor.rgb), vec3(1.2));n#endifn}\";\n},{}],\"repo\":[function(require,module,exports) {\nmodule.exports=\"sprite_additive_rect.b7bf5773.png\";\n},{}],\"a0jw\":[function(require,module,exports) {\n\"use strict\";var e=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(exports,\"__esModule\",{value:!0});var t=require(\"three\"),i=e(require(\".\/..\/shaders\/blob.vert\")),r=e(require(\".\/..\/shaders\/blob.frag\")),a=e(require(\".\/..\/assets\/sprite_additive_rect.png\")),s=function(){function e(e){this.audioAnalyzer=e;var i=document.documentElement.clientWidth,r=document.documentElement.clientHeight;this.clock=new t.Clock,this.InitRenderer(i,r),this.InitCamera(i,r),this.InitShader(),this.InitScene(),window.addEventListener(\"Resize\",this.Resize.bind(this))}return e.prototype.InitRenderer=function(e,i){this.renderer||(this.renderer=new t.WebGLRenderer({powerPreference:\"high-performance\"}),this.renderer.autoClear=!0,document.body.appendChild(this.renderer.domElement)),this.renderer.setPixelRatio(window.devicePixelRatio),this.renderer.setSize(e,i)},e.prototype.InitCamera=function(e,i){this.camera||(this.camera=new t.PerspectiveCamera(45,e\/i,.1,100),this.camera.position.z=.5),this.camera.aspect=e\/i,this.camera.updateProjectionMatrix()},e.prototype.InitShader=function(){var e=function(e,i){return new t.ShaderMaterial({uniforms:{u_t:{value:0},u_is_init:{value:!1},u_audio_high:{value:0},u_audio_level:{value:0},u_audio_history:{value:0}},vertexShader:e,fragmentShader:i})};this.meshShader=e(i.default,r.default),this.wireShader=e(i.default,r.default),this.pointsShader=e(i.default,r.default),this.popPointsShader=e(i.default,r.default),this.popWireShader=e(i.default,r.default),this.poppopPointsShaderOut=e(i.default,r.default),this.popWireShaderOut=e(i.default,r.default),this.meshShader.extensions.derivatives=!0,this.meshShader.defines.IS_MESH=\"true\",this.meshShader.defines.HAS_SHADOW=\"true\",this.wireShader.defines.IS_WIRE=\"true\",this.pointsShader.defines.IS_POINTS=\"true\",this.popPointsShader.defines.IS_POINTS=\"true\",this.popPointsShader.defines.IS_POP=\"true\",this.popWireShader.defines.IS_WIRE=\"true\",this.popWireShader.defines.IS_POP=\"true\",this.poppopPointsShaderOut.defines.IS_POINTS=\"true\",this.poppopPointsShaderOut.defines.IS_POP_OUT=\"true\",this.popWireShaderOut.defines.IS_WIRE=\"true\",this.popWireShaderOut.defines.IS_POP_OUT=\"true\";var s=(new t.TextureLoader).load(a.default);s.wrapS=t.ClampToEdgeWrapping,s.wrapT=t.ClampToEdgeWrapping,s.magFilter=t.LinearFilter,s.minFilter=t.LinearFilter,this.shaderBatch=[this.meshShader,this.wireShader,this.pointsShader,this.popPointsShader,this.popWireShader,this.poppopPointsShaderOut,this.popWireShaderOut];for(var n=0,h=[this.wireShader,this.pointsShader,this.popPointsShader,this.popWireShader,this.poppopPointsShaderOut,this.popWireShaderOut];n<h.length;n++){var d=h[n];d.uniforms.spriteTex={value:s},d.blending=t.AdditiveBlending,d.transparent=!0,d.depthTest=!1}},e.prototype.InitScene=function(){var e=new t.SphereBufferGeometry(.7,128,128),i=new t.SphereBufferGeometry(.7,64,64);this.scene=new t.Scene;var r=new t.Mesh(e,this.meshShader),a=new t.Line(i,this.wireShader),s=new t.Points(e,this.pointsShader),n=new t.Points(i,this.popPointsShader),h=new t.Line(i,this.popWireShader),d=new t.Points(i,this.poppopPointsShaderOut),o=new t.Line(i,this.popWireShaderOut);this.scene.add(r),this.scene.add(a),this.scene.add(s),this.scene.add(n),this.scene.add(h),this.scene.add(d),this.scene.add(o)},e.prototype.Update=function(){var e;if(this.renderer){var t=this.audioAnalyzer.high,i=this.audioAnalyzer.level,r=this.audioAnalyzer.history,a=null===(e=this.clock)||void 0===e?void 0:e.getElapsedTime();this.ZiggleCamera(r);for(var s=0,n=this.shaderBatch;s<n.length;s++){var h=n[s];h.uniforms.u_t.value=a,h.uniforms.u_audio_high.value=t,h.uniforms.u_audio_level.value=i,h.uniforms.u_audio_history.value=r}this.renderer.render(this.scene,this.camera)}},e.prototype.ZiggleCamera=function(e){if(this.camera){var i=new t.Vector3(Math.sin(e),Math.cos(.9*e)*Math.sin(.7*e),Math.cos(2*e));i.multiplyScalar(6+2*Math.sin(2*e));var r=new t.Vector3(Math.sin(.6*e),0,Math.cos(.4*e));r.multiplyScalar(.3),this.camera.position.copy(i),this.camera.lookAt(r),this.camera.updateProjectionMatrix()}},e.prototype.Resize=function(){if(this.renderer&&this.camera){var e=document.documentElement.clientWidth,t=document.documentElement.clientHeight;this.InitRenderer(e,t),this.InitCamera(e,t)}},e}();exports.default=s;\n},{\"three\":\"dKqR\",\".\/..\/shaders\/blob.vert\":\"dax8\",\".\/..\/shaders\/blob.frag\":\"zjQ3\",\".\/..\/assets\/sprite_additive_rect.png\":\"repo\"}],\"K3r8\":[function(require,module,exports) {\n\"use strict\";var e=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(exports,\"__esModule\",{value:!0});var t,o,n=e(require(\"avseoul_common_npm\/js\/AudioAnalyzer\")),a=e(require(\".\/ParticleEqualizer\")),i=function(){t=new n.default(250),o=new a.default(t)},u=function e(){requestAnimationFrame(e),t.update(),o.Update()};document.addEventListener(\"DOMContentLoaded\",function(){window.location.pathname.includes(\"particleEqualizer\")&&\"http:\"==window.location.protocol&&\"localhost\"!=window.location.hostname?window.open(\"https:\/\/\"+window.location.hostname+window.location.pathname,\"_top\"):(i(),u())});\n},{\"avseoul_common_npm\/js\/AudioAnalyzer\":\"I1Xo\",\".\/ParticleEqualizer\":\"a0jw\"}]},{},[\"K3r8\"], null)\n\n\n\n<\/script>\n<style>\n\n.body{min-width:1024px;overflow:hidden;margin:0;padding:0;background:#000;font-family:Helvetica,arial,sans-serif}canvas{position:fixed;left:0;top:0;width:100%;height:90%}::-webkit-scrollbar{width:2px}::-webkit-scrollbar-track{border-radius:2px;background:#333}::-webkit-scrollbar-thumb{border-radius:2px;background:#999}::-webkit-scrollbar-thumb:window-inactive{background:#999}\n<\/style>\n\n<meta charset=\"utf-8\"><meta name=\"description\" content=\"Particle Equalizer designed by Sehyun av Kim\"><meta name=\"keywords\" content=\"particle equalizer,glitch,webgl,threejs,3js,audiovisual,avseoul,sehyun kim\"><meta name=\"author\" content=\"avseoul\"><meta name=\"contact\" content=\"av.seoul@gmail.com\"><meta name=\"viewport\" content=\"width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0\"><link rel=\"stylesheet\" type=\"text\/css\" href=\"style.e2e9f77c.css\"><script src=\"script.c6456acd.js\"><\/script><\/head><body> <canvas><\/canvas> <\/body><\/html>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-dc54401 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"dc54401\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-9c31fdd\" data-id=\"9c31fdd\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap\">\n\t\t\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<\/div>\n\t\t","protected":false},"excerpt":{"rendered":"<p>Graphics and Audio on Web<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-172","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/hayhurst2.hulldesign.co.uk\/index.php\/wp-json\/wp\/v2\/pages\/172","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/hayhurst2.hulldesign.co.uk\/index.php\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/hayhurst2.hulldesign.co.uk\/index.php\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/hayhurst2.hulldesign.co.uk\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/hayhurst2.hulldesign.co.uk\/index.php\/wp-json\/wp\/v2\/comments?post=172"}],"version-history":[{"count":10,"href":"https:\/\/hayhurst2.hulldesign.co.uk\/index.php\/wp-json\/wp\/v2\/pages\/172\/revisions"}],"predecessor-version":[{"id":183,"href":"https:\/\/hayhurst2.hulldesign.co.uk\/index.php\/wp-json\/wp\/v2\/pages\/172\/revisions\/183"}],"wp:attachment":[{"href":"https:\/\/hayhurst2.hulldesign.co.uk\/index.php\/wp-json\/wp\/v2\/media?parent=172"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}