/*! For license information please see zinc.frontend.js.LICENSE.txt */ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.Zinc=t():e.Zinc=t()}(this,(()=>(()=>{var e={164:function(e,t,r){"use strict";var i,n;"undefined"==typeof window||window,void 0===(n="function"==typeof(i=function(){function e(e,t){var r=Object.prototype.toString.call(e),i="[object Array]"===r||"[object NodeList]"===r||"[object HTMLCollection]"===r||"[object Object]"===r||"undefined"!=typeof jQuery&&e instanceof jQuery||"undefined"!=typeof Elements&&e instanceof Elements,n=0,a=e.length;if(i)for(;n{"use strict";r.d(t,{A:()=>m});function i(e,t){this.name="AggregateError",this.errors=e,this.message=t||""}i.prototype=Error.prototype;var n=setTimeout;function a(e){return!(!e||void 0===e.length)}function s(){}function o(e){if(!(this instanceof o))throw new TypeError("Promises must be constructed via new");if("function"!=typeof e)throw new TypeError("not a function");this._state=0,this._handled=!1,this._value=void 0,this._deferreds=[],p(e,this)}function l(e,t){for(;3===e._state;)e=e._value;return 0===e._state?void e._deferreds.push(t):(e._handled=!0,void o._immediateFn((function(){var r=1===e._state?t.onFulfilled:t.onRejected;if(null!==r){var i;try{i=r(e._value)}catch(e){return void c(t.promise,e)}h(t.promise,i)}else(1===e._state?h:c)(t.promise,e._value)})))}function h(e,t){try{if(t===e)throw new TypeError("A promise cannot be resolved with itself.");if(t&&("object"==typeof t||"function"==typeof t)){var r=t.then;if(t instanceof o)return e._state=3,e._value=t,void u(e);if("function"==typeof r)return void p((i=r,n=t,function(){i.apply(n,arguments)}),e)}e._state=1,e._value=t,u(e)}catch(t){c(e,t)}var i,n}function c(e,t){e._state=2,e._value=t,u(e)}function u(e){2===e._state&&0===e._deferreds.length&&o._immediateFn((function(){e._handled||o._unhandledRejectionFn(e._value)}));for(var t=0,r=e._deferreds.length;t{"use strict";r.d(t,{A:()=>p});var i=r(1515);function n(e,t){for(var r,i=0;ie.length)&&(t=e.length);for(var r=0,i=Array(t);r{"use strict";function i(e,t,r,i,n,a,s){try{var o=e[a](s),l=o.value}catch(e){return void r(e)}o.done?t(l):Promise.resolve(l).then(i,n)}function n(e){return function(){var t=this,r=arguments;return new Promise((function(n,a){function s(e){i(l,n,a,s,o,"next",e)}function o(e){i(l,n,a,s,o,"throw",e)}var l=e.apply(t,r);s(void 0)}))}}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,i)}return r}r.r(t),r.d(t,{ACESFilmicToneMapping:()=>ae,AddEquation:()=>L,AddOperation:()=>ee,AdditiveAnimationBlendMode:()=>Yt,AdditiveBlending:()=>S,AlphaFormat:()=>Fe,AlwaysDepth:()=>W,AlwaysStencilFunc:()=>Er,AmbientLight:()=>Uu,AmbientLightProbe:()=>ad,AnimationClip:()=>nu,AnimationLoader:()=>du,AnimationMixer:()=>Ud,AnimationObjectGroup:()=>Nd,AnimationUtils:()=>Wc,ArcCurve:()=>Ah,ArrayCamera:()=>Qo,ArrowHelper:()=>Ap,Audio:()=>vd,AudioAnalyser:()=>_d,AudioContext:()=>rd,AudioListener:()=>fd,AudioLoader:()=>id,AxesHelper:()=>Lp,AxisHelper:()=>Tm,BackSide:()=>y,BasicDepthPacking:()=>or,BasicShadowMap:()=>p,BinaryTextureLoader:()=>Cm,Bone:()=>Ul,BooleanKeyframeTrack:()=>Kc,BoundingBoxHelper:()=>Em,Box2:()=>qd,Box3:()=>pi,Box3Helper:()=>_p,BoxBufferGeometry:()=>Sa,BoxGeometry:()=>Sa,BoxHelper:()=>wp,BufferAttribute:()=>Un,BufferGeometry:()=>na,BufferGeometryLoader:()=>Wu,ByteType:()=>Le,Cache:()=>su,Camera:()=>Ra,CameraHelper:()=>yp,CanvasRenderer:()=>Im,CanvasTexture:()=>ph,CatmullRomCurve3:()=>Oh,CineonToneMapping:()=>ne,CircleBufferGeometry:()=>fh,CircleGeometry:()=>fh,ClampToEdgeWrapping:()=>fe,Clock:()=>hd,Color:()=>On,ColorKeyframeTrack:()=>Qc,CompressedTexture:()=>dh,CompressedTextureLoader:()=>pu,ConeBufferGeometry:()=>gh,ConeGeometry:()=>gh,CubeCamera:()=>Ia,CubeReflectionMapping:()=>le,CubeRefractionMapping:()=>he,CubeTexture:()=>Oa,CubeTextureLoader:()=>fu,CubeUVReflectionMapping:()=>de,CubeUVRefractionMapping:()=>pe,CubicBezierCurve:()=>Uh,CubicBezierCurve3:()=>zh,CubicInterpolant:()=>qc,CullFaceBack:()=>c,CullFaceFront:()=>u,CullFaceFrontBack:()=>d,CullFaceNone:()=>h,Curve:()=>Th,CurvePath:()=>yu,CustomBlending:()=>A,CustomToneMapping:()=>se,CylinderBufferGeometry:()=>vh,CylinderGeometry:()=>vh,Cylindrical:()=>Wd,DataTexture:()=>zl,DataTexture2DArray:()=>ls,DataTexture3D:()=>hs,DataTextureLoader:()=>vu,DataUtils:()=>Pp,DecrementStencilOp:()=>fr,DecrementWrapStencilOp:()=>gr,DefaultLoadingManager:()=>lu,DepthFormat:()=>We,DepthStencilFormat:()=>Ze,DepthTexture:()=>mh,DirectionalLight:()=>Bu,DirectionalLightHelper:()=>fp,DiscreteInterpolant:()=>Yc,DodecahedronBufferGeometry:()=>xh,DodecahedronGeometry:()=>xh,DoubleSide:()=>x,DstAlphaFactor:()=>F,DstColorFactor:()=>V,DynamicBufferAttribute:()=>fm,DynamicCopyUsage:()=>Dr,DynamicDrawUsage:()=>Lr,DynamicReadUsage:()=>Pr,EdgesGeometry:()=>Sh,EdgesHelper:()=>Am,EllipseCurve:()=>Eh,EqualDepth:()=>X,EqualStencilFunc:()=>wr,EquirectangularReflectionMapping:()=>ce,EquirectangularRefractionMapping:()=>ue,Euler:()=>Ki,EventDispatcher:()=>zr,ExtrudeBufferGeometry:()=>yc,ExtrudeGeometry:()=>yc,FaceColors:()=>nm,FileLoader:()=>uu,FlatShading:()=>b,Float16BufferAttribute:()=>Wn,Float32Attribute:()=>Mm,Float32BufferAttribute:()=>Zn,Float64Attribute:()=>Sm,Float64BufferAttribute:()=>qn,FloatType:()=>Oe,Fog:()=>ol,FogExp2:()=>sl,Font:()=>Qu,FontLoader:()=>ed,FrontSide:()=>g,Frustum:()=>Va,GLBufferAttribute:()=>Gd,GLSL1:()=>Br,GLSL3:()=>Ur,GammaEncoding:()=>tr,GreaterDepth:()=>J,GreaterEqualDepth:()=>Y,GreaterEqualStencilFunc:()=>Tr,GreaterStencilFunc:()=>Mr,GridHelper:()=>cp,Group:()=>$o,HalfFloatType:()=>De,HemisphereLight:()=>_u,HemisphereLightHelper:()=>hp,HemisphereLightProbe:()=>nd,IcosahedronBufferGeometry:()=>bc,IcosahedronGeometry:()=>bc,ImageBitmapLoader:()=>Ju,ImageLoader:()=>mu,ImageUtils:()=>ti,ImmediateRenderObject:()=>Kd,IncrementStencilOp:()=>mr,IncrementWrapStencilOp:()=>vr,InstancedBufferAttribute:()=>ju,InstancedBufferGeometry:()=>ku,InstancedInterleavedBuffer:()=>Fd,InstancedMesh:()=>Zl,Int16Attribute:()=>xm,Int16BufferAttribute:()=>Vn,Int32Attribute:()=>wm,Int32BufferAttribute:()=>kn,Int8Attribute:()=>vm,Int8BufferAttribute:()=>zn,IntType:()=>Pe,InterleavedBuffer:()=>hl,InterleavedBufferAttribute:()=>ul,Interpolant:()=>Zc,InterpolateDiscrete:()=>Ht,InterpolateLinear:()=>kt,InterpolateSmooth:()=>jt,InvertStencilOp:()=>yr,JSONLoader:()=>Om,KeepStencilOp:()=>dr,KeyframeTrack:()=>Jc,LOD:()=>Cl,LatheBufferGeometry:()=>wc,LatheGeometry:()=>wc,Layers:()=>Qi,LensFlare:()=>Nm,LessDepth:()=>Z,LessEqualDepth:()=>q,LessEqualStencilFunc:()=>_r,LessStencilFunc:()=>br,Light:()=>wu,LightProbe:()=>Gu,Line:()=>$l,Line3:()=>Jd,LineBasicMaterial:()=>ql,LineCurve:()=>Fh,LineCurve3:()=>Gh,LineDashedMaterial:()=>kc,LineLoop:()=>ih,LinePieces:()=>rm,LineSegments:()=>rh,LineStrip:()=>tm,LinearEncoding:()=>$t,LinearFilter:()=>_e,LinearInterpolant:()=>Xc,LinearMipMapLinearFilter:()=>Ee,LinearMipMapNearestFilter:()=>Se,LinearMipmapLinearFilter:()=>Te,LinearMipmapNearestFilter:()=>Me,LinearToneMapping:()=>re,Loader:()=>hu,LoaderUtils:()=>Hu,LoadingManager:()=>ou,LogLuvEncoding:()=>ir,LoopOnce:()=>Ft,LoopPingPong:()=>Vt,LoopRepeat:()=>Gt,LuminanceAlphaFormat:()=>ke,LuminanceFormat:()=>He,MOUSE:()=>o,Material:()=>En,MaterialLoader:()=>Vu,Math:()=>Qr,MathUtils:()=>Qr,Matrix3:()=>ei,Matrix4:()=>Vi,MaxEquation:()=>I,Mesh:()=>_a,MeshBasicMaterial:()=>Dn,MeshDepthMaterial:()=>jo,MeshDistanceMaterial:()=>Wo,MeshFaceMaterial:()=>sm,MeshLambertMaterial:()=>Vc,MeshMatcapMaterial:()=>Hc,MeshNormalMaterial:()=>Gc,MeshPhongMaterial:()=>zc,MeshPhysicalMaterial:()=>Uc,MeshStandardMaterial:()=>Bc,MeshToonMaterial:()=>Fc,MinEquation:()=>P,MirroredRepeatWrapping:()=>ve,MixOperation:()=>$,MultiMaterial:()=>om,MultiplyBlending:()=>E,MultiplyOperation:()=>Q,NearestFilter:()=>ge,NearestMipMapLinearFilter:()=>we,NearestMipMapNearestFilter:()=>xe,NearestMipmapLinearFilter:()=>be,NearestMipmapNearestFilter:()=>ye,NeverDepth:()=>j,NeverStencilFunc:()=>xr,NoBlending:()=>_,NoColors:()=>im,NoToneMapping:()=>te,NormalAnimationBlendMode:()=>Xt,NormalBlending:()=>M,NotEqualDepth:()=>K,NotEqualStencilFunc:()=>Sr,NumberKeyframeTrack:()=>$c,Object3D:()=>pn,ObjectLoader:()=>Zu,ObjectSpaceNormalMap:()=>cr,OctahedronBufferGeometry:()=>_c,OctahedronGeometry:()=>_c,OneFactor:()=>D,OneMinusDstAlphaFactor:()=>G,OneMinusDstColorFactor:()=>H,OneMinusSrcAlphaFactor:()=>z,OneMinusSrcColorFactor:()=>B,OrthographicCamera:()=>Du,PCFShadowMap:()=>m,PCFSoftShadowMap:()=>f,PMREMGenerator:()=>Xp,ParametricBufferGeometry:()=>Mc,ParametricGeometry:()=>Mc,Particle:()=>hm,ParticleBasicMaterial:()=>dm,ParticleSystem:()=>cm,ParticleSystemMaterial:()=>pm,Path:()=>xu,PerspectiveCamera:()=>Ca,Plane:()=>za,PlaneBufferGeometry:()=>ja,PlaneGeometry:()=>ja,PlaneHelper:()=>Mp,PointCloud:()=>lm,PointCloudMaterial:()=>um,PointLight:()=>Ou,PointLightHelper:()=>ap,Points:()=>hh,PointsMaterial:()=>nh,PolarGridHelper:()=>up,PolyhedronBufferGeometry:()=>yh,PolyhedronGeometry:()=>yh,PositionalAudio:()=>wd,PropertyBinding:()=>Dd,PropertyMixer:()=>Md,QuadraticBezierCurve:()=>Vh,QuadraticBezierCurve3:()=>Hh,Quaternion:()=>hi,QuaternionKeyframeTrack:()=>tu,QuaternionLinearInterpolant:()=>eu,REVISION:()=>s,RGBADepthPacking:()=>lr,RGBAFormat:()=>Ve,RGBAIntegerFormat:()=>Qe,RGBA_ASTC_10x10_Format:()=>wt,RGBA_ASTC_10x5_Format:()=>yt,RGBA_ASTC_10x6_Format:()=>xt,RGBA_ASTC_10x8_Format:()=>bt,RGBA_ASTC_12x10_Format:()=>_t,RGBA_ASTC_12x12_Format:()=>Mt,RGBA_ASTC_4x4_Format:()=>ct,RGBA_ASTC_5x4_Format:()=>ut,RGBA_ASTC_5x5_Format:()=>dt,RGBA_ASTC_6x5_Format:()=>pt,RGBA_ASTC_6x6_Format:()=>mt,RGBA_ASTC_8x5_Format:()=>ft,RGBA_ASTC_8x6_Format:()=>vt,RGBA_ASTC_8x8_Format:()=>gt,RGBA_BPTC_Format:()=>St,RGBA_ETC2_EAC_Format:()=>ht,RGBA_PVRTC_2BPPV1_Format:()=>st,RGBA_PVRTC_4BPPV1_Format:()=>at,RGBA_S3TC_DXT1_Format:()=>et,RGBA_S3TC_DXT3_Format:()=>tt,RGBA_S3TC_DXT5_Format:()=>rt,RGBDEncoding:()=>sr,RGBEEncoding:()=>rr,RGBEFormat:()=>je,RGBFormat:()=>Ge,RGBIntegerFormat:()=>Ke,RGBM16Encoding:()=>ar,RGBM7Encoding:()=>nr,RGB_ETC1_Format:()=>ot,RGB_ETC2_Format:()=>lt,RGB_PVRTC_2BPPV1_Format:()=>nt,RGB_PVRTC_4BPPV1_Format:()=>it,RGB_S3TC_DXT1_Format:()=>$e,RGFormat:()=>Ye,RGIntegerFormat:()=>Je,RawShaderMaterial:()=>Nc,Ray:()=>Gi,Raycaster:()=>Vd,RectAreaLight:()=>zu,RedFormat:()=>qe,RedIntegerFormat:()=>Xe,ReinhardToneMapping:()=>ie,RepeatWrapping:()=>me,ReplaceStencilOp:()=>pr,ReverseSubtractEquation:()=>C,RingBufferGeometry:()=>Sc,RingGeometry:()=>Sc,SRGB8_ALPHA8_ASTC_10x10_Format:()=>Bt,SRGB8_ALPHA8_ASTC_10x5_Format:()=>Ot,SRGB8_ALPHA8_ASTC_10x6_Format:()=>Dt,SRGB8_ALPHA8_ASTC_10x8_Format:()=>Nt,SRGB8_ALPHA8_ASTC_12x10_Format:()=>Ut,SRGB8_ALPHA8_ASTC_12x12_Format:()=>zt,SRGB8_ALPHA8_ASTC_4x4_Format:()=>Tt,SRGB8_ALPHA8_ASTC_5x4_Format:()=>Et,SRGB8_ALPHA8_ASTC_5x5_Format:()=>At,SRGB8_ALPHA8_ASTC_6x5_Format:()=>Lt,SRGB8_ALPHA8_ASTC_6x6_Format:()=>Rt,SRGB8_ALPHA8_ASTC_8x5_Format:()=>Ct,SRGB8_ALPHA8_ASTC_8x6_Format:()=>Pt,SRGB8_ALPHA8_ASTC_8x8_Format:()=>It,Scene:()=>ll,SceneUtils:()=>Dm,ShaderChunk:()=>Wa,ShaderLib:()=>qa,ShaderMaterial:()=>La,ShadowMaterial:()=>Dc,Shape:()=>bu,ShapeBufferGeometry:()=>Tc,ShapeGeometry:()=>Tc,ShapePath:()=>Ku,ShapeUtils:()=>fc,ShortType:()=>Re,Skeleton:()=>Vl,SkeletonHelper:()=>ip,SkinnedMesh:()=>Bl,SmoothShading:()=>w,Sphere:()=>Ii,SphereBufferGeometry:()=>Ec,SphereGeometry:()=>Ec,Spherical:()=>jd,SphericalHarmonics3:()=>Fu,SplineCurve:()=>kh,SpotLight:()=>Lu,SpotLightHelper:()=>$d,Sprite:()=>El,SpriteMaterial:()=>dl,SrcAlphaFactor:()=>U,SrcAlphaSaturateFactor:()=>k,SrcColorFactor:()=>N,StaticCopyUsage:()=>Or,StaticDrawUsage:()=>Ar,StaticReadUsage:()=>Cr,StereoCamera:()=>ld,StreamCopyUsage:()=>Nr,StreamDrawUsage:()=>Rr,StreamReadUsage:()=>Ir,StringKeyframeTrack:()=>ru,SubtractEquation:()=>R,SubtractiveBlending:()=>T,TOUCH:()=>l,TangentSpaceNormalMap:()=>hr,TetrahedronBufferGeometry:()=>Ac,TetrahedronGeometry:()=>Ac,TextBufferGeometry:()=>Lc,TextGeometry:()=>Lc,Texture:()=>ii,TextureLoader:()=>gu,TorusBufferGeometry:()=>Rc,TorusGeometry:()=>Rc,TorusKnotBufferGeometry:()=>Cc,TorusKnotGeometry:()=>Cc,Triangle:()=>Sn,TriangleFanDrawMode:()=>Qt,TriangleStripDrawMode:()=>Kt,TrianglesDrawMode:()=>Jt,TubeBufferGeometry:()=>Pc,TubeGeometry:()=>Pc,UVMapping:()=>oe,Uint16Attribute:()=>bm,Uint16BufferAttribute:()=>Hn,Uint32Attribute:()=>_m,Uint32BufferAttribute:()=>jn,Uint8Attribute:()=>gm,Uint8BufferAttribute:()=>Fn,Uint8ClampedAttribute:()=>ym,Uint8ClampedBufferAttribute:()=>Gn,Uniform:()=>zd,UniformsLib:()=>Za,UniformsUtils:()=>Aa,UnsignedByteType:()=>Ae,UnsignedInt248Type:()=>ze,UnsignedIntType:()=>Ie,UnsignedShort4444Type:()=>Ne,UnsignedShort5551Type:()=>Be,UnsignedShort565Type:()=>Ue,UnsignedShortType:()=>Ce,VSMShadowMap:()=>v,Vector2:()=>$r,Vector3:()=>ci,Vector4:()=>ai,VectorKeyframeTrack:()=>iu,Vertex:()=>mm,VertexColors:()=>am,VideoTexture:()=>uh,WebGL1Renderer:()=>al,WebGLCubeRenderTarget:()=>Da,WebGLMultipleRenderTargets:()=>oi,WebGLMultisampleRenderTarget:()=>li,WebGLRenderTarget:()=>si,WebGLRenderTargetCube:()=>Pm,WebGLRenderer:()=>nl,WebGLUtils:()=>Ko,WireframeGeometry:()=>Ic,WireframeHelper:()=>Lm,WrapAroundEnding:()=>qt,XHRLoader:()=>Rm,ZeroCurvatureEnding:()=>Wt,ZeroFactor:()=>O,ZeroSlopeEnding:()=>Zt,ZeroStencilOp:()=>ur,sRGBEncoding:()=>er});var s="130",o={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},l={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},h=0,c=1,u=2,d=3,p=0,m=1,f=2,v=3,g=0,y=1,x=2,b=1,w=2,_=0,M=1,S=2,T=3,E=4,A=5,L=100,R=101,C=102,P=103,I=104,O=200,D=201,N=202,B=203,U=204,z=205,F=206,G=207,V=208,H=209,k=210,j=0,W=1,Z=2,q=3,X=4,Y=5,J=6,K=7,Q=0,$=1,ee=2,te=0,re=1,ie=2,ne=3,ae=4,se=5,oe=300,le=301,he=302,ce=303,ue=304,de=306,pe=307,me=1e3,fe=1001,ve=1002,ge=1003,ye=1004,xe=1004,be=1005,we=1005,_e=1006,Me=1007,Se=1007,Te=1008,Ee=1008,Ae=1009,Le=1010,Re=1011,Ce=1012,Pe=1013,Ie=1014,Oe=1015,De=1016,Ne=1017,Be=1018,Ue=1019,ze=1020,Fe=1021,Ge=1022,Ve=1023,He=1024,ke=1025,je=Ve,We=1026,Ze=1027,qe=1028,Xe=1029,Ye=1030,Je=1031,Ke=1032,Qe=1033,$e=33776,et=33777,tt=33778,rt=33779,it=35840,nt=35841,at=35842,st=35843,ot=36196,lt=37492,ht=37496,ct=37808,ut=37809,dt=37810,pt=37811,mt=37812,ft=37813,vt=37814,gt=37815,yt=37816,xt=37817,bt=37818,wt=37819,_t=37820,Mt=37821,St=36492,Tt=37840,Et=37841,At=37842,Lt=37843,Rt=37844,Ct=37845,Pt=37846,It=37847,Ot=37848,Dt=37849,Nt=37850,Bt=37851,Ut=37852,zt=37853,Ft=2200,Gt=2201,Vt=2202,Ht=2300,kt=2301,jt=2302,Wt=2400,Zt=2401,qt=2402,Xt=2500,Yt=2501,Jt=0,Kt=1,Qt=2,$t=3e3,er=3001,tr=3007,rr=3002,ir=3003,nr=3004,ar=3005,sr=3006,or=3200,lr=3201,hr=0,cr=1,ur=0,dr=7680,pr=7681,mr=7682,fr=7683,vr=34055,gr=34056,yr=5386,xr=512,br=513,wr=514,_r=515,Mr=516,Sr=517,Tr=518,Er=519,Ar=35044,Lr=35048,Rr=35040,Cr=35045,Pr=35049,Ir=35041,Or=35046,Dr=35050,Nr=35042,Br="100",Ur="300 es";class zr{addEventListener(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(e,t){if(void 0===this._listeners)return!1;var r=this._listeners;return void 0!==r[e]&&-1!==r[e].indexOf(t)}removeEventListener(e,t){if(void 0!==this._listeners){var r=this._listeners[e];if(void 0!==r){var i=r.indexOf(t);-1!==i&&r.splice(i,1)}}}dispatchEvent(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),i=0,n=r.length;iGr;Gr++)Fr[Gr]=(16>Gr?"0":"")+Gr.toString(16);var Vr=1234567,Hr=Math.PI/180,kr=180/Math.PI;function jr(){var e=0|4294967295*Math.random(),t=0|4294967295*Math.random(),r=0|4294967295*Math.random(),i=0|4294967295*Math.random();return(Fr[255&e]+Fr[255&e>>8]+Fr[255&e>>16]+Fr[255&e>>24]+"-"+Fr[255&t]+Fr[255&t>>8]+"-"+Fr[64|15&t>>16]+Fr[255&t>>24]+"-"+Fr[128|63&r]+Fr[255&r>>8]+"-"+Fr[255&r>>16]+Fr[255&r>>24]+Fr[255&i]+Fr[255&i>>8]+Fr[255&i>>16]+Fr[255&i>>24]).toUpperCase()}function Wr(e,t,r){return Math.max(t,Math.min(r,e))}function Zr(e,t){return(e%t+t)%t}function qr(e,t,r){return(1-r)*e+r*t}function Xr(e){return 0==(e&e-1)&&0!==e}function Yr(e){return Math.pow(2,Math.ceil(Math.log(e)/Math.LN2))}function Jr(e){return Math.pow(2,Math.floor(Math.log(e)/Math.LN2))}var Kr,Qr=Object.freeze({__proto__:null,DEG2RAD:Hr,RAD2DEG:kr,generateUUID:jr,clamp:Wr,euclideanModulo:Zr,mapLinear:function(e,t,r,i,n){return i+(e-t)*(n-i)/(r-t)},inverseLerp:function(e,t,r){return e===t?0:(r-e)/(t-e)},lerp:qr,damp:function(e,t,r,i){return qr(e,t,1-Math.exp(-r*i))},pingpong:function(e){var t=1=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())},seededRandom:function(e){return void 0!==e&&(Vr=e%2147483647),((Vr=16807*Vr%2147483647)-1)/2147483646},degToRad:function(e){return e*Hr},radToDeg:function(e){return e*kr},isPowerOfTwo:Xr,ceilPowerOfTwo:Yr,floorPowerOfTwo:Jr,setQuaternionFromProperEuler:function(e,t,r,i,n){var a=Math.cos,s=Math.sin,o=a(r/2),l=s(r/2),h=a((t+i)/2),c=s((t+i)/2),u=a((t-i)/2),d=s((t-i)/2),p=a((i-t)/2),m=s((i-t)/2);"XYX"===n?e.set(o*c,l*u,l*d,o*h):"YZY"===n?e.set(l*d,o*c,l*u,o*h):"ZXZ"===n?e.set(l*u,l*d,o*c,o*h):"XZX"===n?e.set(o*c,l*m,l*p,o*h):"YXY"===n?e.set(l*p,o*c,l*m,o*h):"ZYZ"===n?e.set(l*m,l*p,o*c,o*h):console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+n)}});class $r{constructor(){var e=0this.x?Math.ceil(this.x):Math.floor(this.x),this.y=0>this.y?Math.ceil(this.y):Math.floor(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){var t=this.x-e.x,r=this.y-e.y;return t*t+r*r}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,r){return this.x=e.x+(t.x-e.x)*r,this.y=e.y+(t.y-e.y)*r,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e){var t=1i;i++)if(t[i]!==r[i])return!1;return!0}fromArray(e){for(var t=1r;r++)this.elements[r]=e[r+t];return this}toArray(){var e=0e.x||1e.x?0:1;break;case ve:1===Math.abs(Math.floor(e.x)%2)?e.x=Math.ceil(e.x)-e.x:e.x-=Math.floor(e.x)}if(0>e.y||1e.y?0:1;break;case ve:1===Math.abs(Math.floor(e.y)%2)?e.y=Math.ceil(e.y)-e.y:e.y-=Math.floor(e.y)}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){!0===e&&this.version++}}function ni(e){return"undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap?ti.getDataURL(e):e.data?{data:Array.prototype.slice.call(e.data),width:e.width,height:e.height,type:e.data.constructor.name}:(console.warn("THREE.Texture: Unable to serialize Texture."),{})}ii.DEFAULT_IMAGE=void 0,ii.DEFAULT_MAPPING=oe,ii.prototype.isTexture=!0;class ai{constructor(){var e=0t?(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(e){var t,r,i,n,a=.01,s=.1,o=e.elements,l=o[0],h=o[4],c=o[8],u=o[1],d=o[5],p=o[9],m=o[2],f=o[6],v=o[10];if(Math.abs(h-u)y&&g>x?gx?yMath.abs(M)&&(M=1),this.x=(f-p)/M,this.y=(c-m)/M,this.z=(u-h)/M,this.w=Math.acos((l+d+v-1)/2),this}min(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(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(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(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(e,t){var r=this.length();return this.divideScalar(r||1).multiplyScalar(Math.max(e,Math.min(t,r)))}floor(){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(){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(){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(){return this.x=0>this.x?Math.ceil(this.x):Math.floor(this.x),this.y=0>this.y?Math.ceil(this.y):Math.floor(this.y),this.z=0>this.z?Math.ceil(this.z):Math.floor(this.z),this.w=0>this.w?Math.ceil(this.w):Math.floor(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(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(e,t,r){return this.x=e.x+(t.x-e.x)*r,this.y=e.y+(t.y-e.y)*r,this.z=e.z+(t.z-e.z)*r,this.w=e.w+(t.w-e.w)*r,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e){var t=1Number.EPSILON){var x=Math.sqrt(y),b=Math.atan2(x,v*g);f=Math.sin(f*b)/x,s=Math.sin(s*b)/x}var w=s*g;if(o=o*f+u*w,l=l*f+d*w,h=h*f+p*w,c=c*f+m*w,f==1-s){var _=1/Math.sqrt(o*o+l*l+h*h+c*c);o*=_,l*=_,h*=_,c*=_}}e[t]=o,e[t+1]=l,e[t+2]=h,e[t+3]=c}static multiplyQuaternionsFlat(e,t,r,i,n,a){var s=r[i],o=r[i+1],l=r[i+2],h=r[i+3],c=n[a],u=n[a+1],d=n[a+2],p=n[a+3];return e[t]=s*p+h*c+o*d-l*u,e[t+1]=o*p+h*u+l*c-s*d,e[t+2]=l*p+h*d+s*u-o*c,e[t+3]=h*p-s*c-o*u-l*d,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,r,i){return this._x=e,this._y=t,this._z=r,this._w=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(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,i=e._y,n=e._z,a=e._order,s=Math.cos,o=Math.sin,l=s(r/2),h=s(i/2),c=s(n/2),u=o(r/2),d=o(i/2),p=o(n/2);return"XYZ"===a?(this._x=u*h*c+l*d*p,this._y=l*d*c-u*h*p,this._z=l*h*p+u*d*c,this._w=l*h*c-u*d*p):"YXZ"===a?(this._x=u*h*c+l*d*p,this._y=l*d*c-u*h*p,this._z=l*h*p-u*d*c,this._w=l*h*c+u*d*p):"ZXY"===a?(this._x=u*h*c-l*d*p,this._y=l*d*c+u*h*p,this._z=l*h*p+u*d*c,this._w=l*h*c-u*d*p):"ZYX"===a?(this._x=u*h*c-l*d*p,this._y=l*d*c+u*h*p,this._z=l*h*p-u*d*c,this._w=l*h*c+u*d*p):"YZX"===a?(this._x=u*h*c+l*d*p,this._y=l*d*c+u*h*p,this._z=l*h*p-u*d*c,this._w=l*h*c-u*d*p):"XZY"===a?(this._x=u*h*c-l*d*p,this._y=l*d*c-u*h*p,this._z=l*h*p+u*d*c,this._w=l*h*c+u*d*p):console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+a),!1!==t&&this._onChangeCallback(),this}setFromAxisAngle(e,t){var r=t/2,i=Math.sin(r);return this._x=e.x*i,this._y=e.y*i,this._z=e.z*i,this._w=Math.cos(r),this._onChangeCallback(),this}setFromRotationMatrix(e){var t=e.elements,r=t[0],i=t[4],n=t[8],a=t[1],s=t[5],o=t[9],l=t[2],h=t[6],c=t[10],u=r+s+c;if(0s&&r>c){var p=2*Math.sqrt(1+r-s-c);this._w=(h-o)/p,this._x=.25*p,this._y=(i+a)/p,this._z=(n+l)/p}else if(s>c){var m=2*Math.sqrt(1+s-r-c);this._w=(n-l)/m,this._x=(i+a)/m,this._y=.25*m,this._z=(o+h)/m}else{var f=2*Math.sqrt(1+c-r-s);this._w=(a-i)/f,this._x=(n+l)/f,this._y=(o+h)/f,this._z=.25*f}return this._onChangeCallback(),this}setFromUnitVectors(e,t){var r=e.dot(t)+1;return rMath.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(e){return 2*Math.acos(Math.abs(Wr(this.dot(e),-1,1)))}rotateTowards(e,t){var r=this.angleTo(e);if(0===r)return this;var i=Math.min(1,t/r);return this.slerp(e,i),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){var e=this.length();return 0===e?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x*=e,this._y*=e,this._z*=e,this._w*=e),this._onChangeCallback(),this}multiply(e,t){return void 0===t?this.multiplyQuaternions(this,e):(console.warn("THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead."),this.multiplyQuaternions(e,t))}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){var r=e._x,i=e._y,n=e._z,a=e._w,s=t._x,o=t._y,l=t._z,h=t._w;return this._x=r*h+a*s+i*l-n*o,this._y=i*h+a*o+n*s-r*l,this._z=n*h+a*l+r*o-i*s,this._w=a*h-r*s-i*o-n*l,this._onChangeCallback(),this}slerp(e,t){if(0===t)return this;if(1===t)return this.copy(e);var r=this._x,i=this._y,n=this._z,a=this._w,s=a*e._w+r*e._x+i*e._y+n*e._z;if(0>s?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,s=-s):this.copy(e),1<=s)return this._w=a,this._x=r,this._y=i,this._z=n,this;var o=1-s*s;if(o<=Number.EPSILON){var l=1-t;return this._w=l*a+t*this._w,this._x=l*r+t*this._x,this._y=l*i+t*this._y,this._z=l*n+t*this._z,this.normalize(),this._onChangeCallback(),this}var h=Math.sqrt(o),c=Math.atan2(h,s),u=Math.sin((1-t)*c)/h,d=Math.sin(t*c)/h;return this._w=a*u+this._w*d,this._x=r*u+this._x*d,this._y=i*u+this._y*d,this._z=n*u+this._z*d,this._onChangeCallback(),this}slerpQuaternions(e,t,r){this.copy(e).slerp(t,r)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e){var t=1this.x?Math.ceil(this.x):Math.floor(this.x),this.y=0>this.y?Math.ceil(this.y):Math.floor(this.y),this.z=0>this.z?Math.ceil(this.z):Math.floor(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(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(e,t,r){return this.x=e.x+(t.x-e.x)*r,this.y=e.y+(t.y-e.y)*r,this.z=e.z+(t.z-e.z)*r,this}cross(e,t){return void 0===t?this.crossVectors(this,e):(console.warn("THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead."),this.crossVectors(e,t))}crossVectors(e,t){var r=e.x,i=e.y,n=e.z,a=t.x,s=t.y,o=t.z;return this.x=i*o-n*s,this.y=n*a-r*o,this.z=r*s-i*a,this}projectOnVector(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(e){return ui.copy(this).projectOnVector(e),this.sub(ui)}reflect(e){return this.sub(ui.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(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(Wr(r,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){var t=this.x-e.x,r=this.y-e.y,i=this.z-e.z;return t*t+r*r+i*i}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,r){var i=Math.sin(t)*e;return this.x=i*Math.sin(r),this.y=Math.cos(t)*e,this.z=i*Math.cos(r),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,r){return this.x=e*Math.sin(t),this.y=r,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){var t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){var t=this.setFromMatrixColumn(e,0).length(),r=this.setFromMatrixColumn(e,1).length(),i=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=r,this.z=i,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,4*t)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,3*t)}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e){var t=1n&&(n=h),c>a&&(a=c),u>s&&(s=u)}return this.min.set(t,r,i),this.max.set(n,a,s),this}setFromBufferAttribute(e){for(var t=1/0,r=1/0,i=1/0,n=-1/0,a=-1/0,s=-1/0,o=0,l=e.count;on&&(n=h),c>a&&(a=c),u>s&&(s=u)}return this.min.set(t,r,i),this.max.set(n,a,s),this}setFromPoints(e){this.makeEmpty();for(var t=0,r=e.length;tthis.max.x||e.ythis.max.y||e.zthis.max.z)}containsBox(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(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return!(e.max.xthis.max.x||e.max.ythis.max.y||e.max.zthis.max.z)}intersectsSphere(e){return this.clampPoint(e.center,fi),fi.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){var t,r;return 0=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(Mi),Si.subVectors(this.max,Mi),gi.subVectors(e.a,Mi),yi.subVectors(e.b,Mi),xi.subVectors(e.c,Mi),bi.subVectors(yi,gi),wi.subVectors(xi,yi),_i.subVectors(gi,xi);var t=[0,-bi.z,bi.y,0,-wi.z,wi.y,0,-_i.z,_i.y,bi.z,0,-bi.x,wi.z,0,-wi.x,_i.z,0,-_i.x,-bi.y,bi.x,0,-wi.y,wi.x,0,-_i.y,_i.x,0];return!!Ai(t,gi,yi,xi,Si)&&!!Ai(t=[1,0,0,0,1,0,0,0,1],gi,yi,xi,Si)&&(Ti.crossVectors(bi,wi),Ai(t=[Ti.x,Ti.y,Ti.z],gi,yi,xi,Si))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return fi.copy(e).clamp(this.min,this.max).sub(e).length()}getBoundingSphere(e){return this.getCenter(e.center),e.radius=.5*this.getSize(fi).length(),e}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()||(mi[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),mi[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),mi[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),mi[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),mi[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),mi[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),mi[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),mi[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(mi)),this}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}pi.prototype.isBox3=!0;var mi=[new ci,new ci,new ci,new ci,new ci,new ci,new ci,new ci],fi=new ci,vi=new pi,gi=new ci,yi=new ci,xi=new ci,bi=new ci,wi=new ci,_i=new ci,Mi=new ci,Si=new ci,Ti=new ci,Ei=new ci;function Ai(e,t,r,i,n){for(var a=0,s=e.length-3;a<=s;a+=3){Ei.fromArray(e,a);var o=n.x*Math.abs(Ei.x)+n.y*Math.abs(Ei.y)+n.z*Math.abs(Ei.z),l=t.dot(Ei),h=r.dot(Ei),c=i.dot(Ei);if(Math.max(-Math.max(l,h,c),Math.min(l,h,c))>o)return!1}return!0}var Li=new pi,Ri=new ci,Ci=new ci,Pi=new ci;class Ii{constructor(){var e=0this.radius}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(e){return e.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(e){return e.distanceTo(this.center)-this.radius}intersectsSphere(e){var t=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=t*t}intersectsBox(e){return e.intersectsSphere(this)}intersectsPlane(e){return Math.abs(e.distanceToPoint(this.center))<=this.radius}clampPoint(e,t){var r=this.center.distanceToSquared(e);return t.copy(e),r>this.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius*=e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){Pi.subVectors(e,this.center);var t=Pi.lengthSq();if(t>this.radius*this.radius){var r=Math.sqrt(t),i=.5*(r-this.radius);this.center.add(Pi.multiplyScalar(i/r)),this.radius+=i}return this}union(e){return Ci.subVectors(e.center,this.center).normalize().multiplyScalar(e.radius),this.expandByPoint(Ri.copy(e.center).add(Ci)),this.expandByPoint(Ri.copy(e.center).sub(Ci)),this}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return(new this.constructor).copy(this)}}var Oi=new ci,Di=new ci,Ni=new ci,Bi=new ci,Ui=new ci,zi=new ci,Fi=new ci;class Gi{constructor(){var e=0r?t.copy(this.origin):t.copy(this.direction).multiplyScalar(r).add(this.origin)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){var t=Oi.subVectors(e,this.origin).dot(this.direction);return 0>t?this.origin.distanceToSquared(e):(Oi.copy(this.direction).multiplyScalar(t).add(this.origin),Oi.distanceToSquared(e))}distanceSqToSegment(e,t,r,i){Di.copy(e).add(t).multiplyScalar(.5),Ni.copy(t).sub(e).normalize(),Bi.copy(this.origin).sub(Di);var n,a,s,o,l=.5*e.distanceTo(t),h=-this.direction.dot(Ni),c=Bi.dot(this.direction),u=-Bi.dot(Ni),d=Bi.lengthSq(),p=Math.abs(1-h*h);if(0=-o)if(a<=o){var m=1/p;s=(n*=m)*(n+h*(a*=m)+2*c)+a*(h*n+a+2*u)+d}else a=l,s=-(n=Math.max(0,-(h*a+c)))*n+a*(a+2*u)+d;else a=-l,s=-(n=Math.max(0,-(h*a+c)))*n+a*(a+2*u)+d;else a<=-o?s=-(n=Math.max(0,-(-h*l+c)))*n+(a=0n)return null;var a=Math.sqrt(n-i),s=r-a,o=r+a;return 0>s&&0>o?null:0>s?this.at(o,t):this.at(s,t)}intersectsSphere(e){return this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(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 0<=r?r:null}intersectPlane(e,t){var r=this.distanceToPlane(e);return null===r?null:this.at(r,t)}intersectsPlane(e){var t=e.distanceToPoint(this.origin);return 0===t||!!(0>e.normal.dot(this.direction)*t)}intersectBox(e,t){var r,i,n,a,s,o,l=1/this.direction.x,h=1/this.direction.y,c=1/this.direction.z,u=this.origin;return 0<=l?(r=(e.min.x-u.x)*l,i=(e.max.x-u.x)*l):(r=(e.max.x-u.x)*l,i=(e.min.x-u.x)*l),0<=h?(n=(e.min.y-u.y)*h,a=(e.max.y-u.y)*h):(n=(e.max.y-u.y)*h,a=(e.min.y-u.y)*h),r>a||n>i?null:((n>r||r!=r)&&(r=n),(ao||s>i?null:((s>r||r!=r)&&(r=s),(oi?null:this.at(0<=r?r:i,t)))}intersectsBox(e){return null!==this.intersectBox(e,Oi)}intersectTriangle(e,t,r,i,n){Ui.subVectors(t,e),zi.subVectors(r,e),Fi.crossVectors(Ui,zi);var a,s=this.direction.dot(Fi);if(0s))return null;a=-1,s=-s}Bi.subVectors(this.origin,e);var o=a*this.direction.dot(zi.crossVectors(Bi,zi));if(0>o)return null;var l=a*this.direction.dot(Ui.cross(Bi));if(0>l)return null;if(o+l>s)return null;var h=-a*Bi.dot(Fi);return 0>h?null:this.at(h/s,n)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return(new this.constructor).copy(this)}}class Vi{constructor(){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],0this.determinant()&&(n=-n),e.x=i[12],e.y=i[13],e.z=i[14],ki.copy(this);var o=1/n,l=1/a,h=1/s;return ki.elements[0]*=o,ki.elements[1]*=o,ki.elements[2]*=o,ki.elements[4]*=l,ki.elements[5]*=l,ki.elements[6]*=l,ki.elements[8]*=h,ki.elements[9]*=h,ki.elements[10]*=h,t.setFromRotationMatrix(ki),r.x=n,r.y=a,r.z=s,this}makePerspective(e,t,r,i,n,a){void 0===a&&console.warn("THREE.Matrix4: .makePerspective() has been redefined and has a new signature. Please check the docs.");var s=this.elements;return s[0]=2*n/(t-e),s[4]=0,s[8]=(t+e)/(t-e),s[12]=0,s[1]=0,s[5]=2*n/(r-i),s[9]=(r+i)/(r-i),s[13]=0,s[2]=0,s[6]=0,s[10]=-(a+n)/(a-n),s[14]=-2*a*n/(a-n),s[3]=0,s[7]=0,s[11]=-1,s[15]=0,this}makeOrthographic(e,t,r,i,n,a){var s=this.elements,o=1/(t-e),l=1/(r-i),h=1/(a-n);return s[0]=2*o,s[4]=0,s[8]=0,s[12]=-(t+e)*o,s[1]=0,s[5]=2*l,s[9]=0,s[13]=-(r+i)*l,s[2]=0,s[6]=0,s[10]=-2*h,s[14]=-(a+n)*h,s[3]=0,s[7]=0,s[11]=0,s[15]=1,this}equals(e){for(var t=this.elements,r=e.elements,i=0;16>i;i++)if(t[i]!==r[i])return!1;return!0}fromArray(e){for(var t=1r;r++)this.elements[r]=e[r+t];return this}toArray(){var e=0Math.abs(s)?(this._x=Math.atan2(-h,d),this._z=Math.atan2(-a,n)):(this._x=Math.atan2(u,l),this._z=0)):"YXZ"===t?(this._x=Math.asin(-Wr(h,-1,1)),.9999999>Math.abs(h)?(this._y=Math.atan2(s,d),this._z=Math.atan2(o,l)):(this._y=Math.atan2(-c,n),this._z=0)):"ZXY"===t?(this._x=Math.asin(Wr(u,-1,1)),.9999999>Math.abs(u)?(this._y=Math.atan2(-c,d),this._z=Math.atan2(-a,l)):(this._y=0,this._z=Math.atan2(o,n))):"ZYX"===t?(this._y=Math.asin(-Wr(c,-1,1)),.9999999>Math.abs(c)?(this._x=Math.atan2(u,d),this._z=Math.atan2(o,n)):(this._x=0,this._z=Math.atan2(-a,l))):"YZX"===t?(this._z=Math.asin(Wr(o,-1,1)),.9999999>Math.abs(o)?(this._x=Math.atan2(-h,l),this._y=Math.atan2(-c,n)):(this._x=0,this._y=Math.atan2(s,d))):"XZY"===t?(this._z=Math.asin(-Wr(a,-1,1)),.9999999>Math.abs(a)?(this._x=Math.atan2(u,l),this._y=Math.atan2(s,n)):(this._x=Math.atan2(-h,d),this._y=0)):console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+t),this._order=t,!0===r&&this._onChangeCallback(),this}setFromQuaternion(e,t,r){return Yi.makeRotationFromQuaternion(e),this.setFromRotationMatrix(Yi,t,r)}setFromVector3(e){var t=1=gn.x+gn.y}static getUV(e,t,r,i,n,a,s,o){return this.getBarycoord(e,t,r,i,gn),o.set(0,0),o.addScaledVector(n,gn.x),o.addScaledVector(a,gn.y),o.addScaledVector(s,gn.z),o}static isFrontFacing(e,t,r,i){return mn.subVectors(r,t),fn.subVectors(e,t),!!(0>mn.cross(fn).dot(i))}set(e,t,r){return this.a.copy(e),this.b.copy(t),this.c.copy(r),this}setFromPointsAndIndices(e,t,r,i){return this.a.copy(e[t]),this.b.copy(e[r]),this.c.copy(e[i]),this}clone(){return(new this.constructor).copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return mn.subVectors(this.c,this.b),fn.subVectors(this.a,this.b),.5*mn.cross(fn).length()}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return Sn.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return Sn.getBarycoord(e,this.a,this.b,this.c,t)}getUV(e,t,r,i,n){return Sn.getUV(e,this.a,this.b,this.c,t,r,i,n)}containsPoint(e){return Sn.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return Sn.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){var r,i,n=this.a,a=this.b,s=this.c;yn.subVectors(a,n),xn.subVectors(s,n),wn.subVectors(e,n);var o=yn.dot(wn),l=xn.dot(wn);if(0>=o&&0>=l)return t.copy(n);_n.subVectors(e,a);var h=yn.dot(_n),c=xn.dot(_n);if(0<=h&&c<=h)return t.copy(a);var u=o*c-h*l;if(0>=u&&0<=o&&0>=h)return r=o/(o-h),t.copy(n).addScaledVector(yn,r);Mn.subVectors(e,s);var d=yn.dot(Mn),p=xn.dot(Mn);if(0<=p&&d<=p)return t.copy(s);var m=d*l-o*p;if(0>=m&&0<=l&&0>=p)return i=l/(l-p),t.copy(n).addScaledVector(xn,i);var f=h*p-d*c;if(0>=f&&0<=c-h&&0<=d-p)return bn.subVectors(s,a),i=(c-h)/(c-h+(d-p)),t.copy(a).addScaledVector(bn,i);var v=1/(f+m+u);return r=m*v,i=u*v,t.copy(n).addScaledVector(yn,r).addScaledVector(xn,i)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}var Tn=0;class En extends zr{constructor(){super(),Object.defineProperty(this,"id",{value:Tn++}),this.uuid=jr(),this.name="",this.type="Material",this.fog=!0,this.blending=M,this.side=g,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.blendSrc=U,this.blendDst=z,this.blendEquation=L,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.depthFunc=q,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=Er,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=dr,this.stencilZFail=dr,this.stencilZPass=dr,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.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0}onBuild(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(void 0!==e)for(var t in e){var r=e[t];if(void 0!==r)if("shading"!=t){var i=this[t];void 0!==i?i&&i.isColor?i.set(r):i&&i.isVector3&&r&&r.isVector3?i.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===b;else console.warn("THREE.Material: '"+t+"' parameter is undefined.")}}toJSON(e){function t(e){var t=[];for(var r in e){var i=e[r];delete i.metadata,t.push(i)}return t}var r=void 0===e||"string"==typeof e;r&&(e={textures:{},images:{}});var i={metadata:{version:4.5,type:"Material",generator:"Material.toJSON"}};if(i.uuid=this.uuid,i.type=this.type,""!==this.name&&(i.name=this.name),this.color&&this.color.isColor&&(i.color=this.color.getHex()),void 0!==this.roughness&&(i.roughness=this.roughness),void 0!==this.metalness&&(i.metalness=this.metalness),this.sheen&&this.sheen.isColor&&(i.sheen=this.sheen.getHex()),this.emissive&&this.emissive.isColor&&(i.emissive=this.emissive.getHex()),this.emissiveIntensity&&1!==this.emissiveIntensity&&(i.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(i.specular=this.specular.getHex()),void 0!==this.shininess&&(i.shininess=this.shininess),void 0!==this.clearcoat&&(i.clearcoat=this.clearcoat),void 0!==this.clearcoatRoughness&&(i.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(i.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(i.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(i.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,i.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.map&&this.map.isTexture&&(i.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(i.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(i.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(i.lightMap=this.lightMap.toJSON(e).uuid,i.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(i.aoMap=this.aoMap.toJSON(e).uuid,i.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(i.bumpMap=this.bumpMap.toJSON(e).uuid,i.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(i.normalMap=this.normalMap.toJSON(e).uuid,i.normalMapType=this.normalMapType,i.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(i.displacementMap=this.displacementMap.toJSON(e).uuid,i.displacementScale=this.displacementScale,i.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(i.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(i.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(i.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(i.specularMap=this.specularMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(i.envMap=this.envMap.toJSON(e).uuid,void 0!==this.combine&&(i.combine=this.combine)),void 0!==this.envMapIntensity&&(i.envMapIntensity=this.envMapIntensity),void 0!==this.reflectivity&&(i.reflectivity=this.reflectivity),void 0!==this.refractionRatio&&(i.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(i.gradientMap=this.gradientMap.toJSON(e).uuid),void 0!==this.transmission&&(i.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(i.transmissionMap=this.transmissionMap.toJSON(e).uuid),void 0!==this.thickness&&(i.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(i.thicknessMap=this.thicknessMap.toJSON(e).uuid),void 0!==this.attenuationDistance&&(i.attenuationDistance=this.attenuationDistance),void 0!==this.attenuationColor&&(i.attenuationColor=this.attenuationColor.getHex()),void 0!==this.size&&(i.size=this.size),null!==this.shadowSide&&(i.shadowSide=this.shadowSide),void 0!==this.sizeAttenuation&&(i.sizeAttenuation=this.sizeAttenuation),this.blending!==M&&(i.blending=this.blending),this.side!==g&&(i.side=this.side),this.vertexColors&&(i.vertexColors=!0),1>this.opacity&&(i.opacity=this.opacity),!0===this.transparent&&(i.transparent=this.transparent),i.depthFunc=this.depthFunc,i.depthTest=this.depthTest,i.depthWrite=this.depthWrite,i.colorWrite=this.colorWrite,i.stencilWrite=this.stencilWrite,i.stencilWriteMask=this.stencilWriteMask,i.stencilFunc=this.stencilFunc,i.stencilRef=this.stencilRef,i.stencilFuncMask=this.stencilFuncMask,i.stencilFail=this.stencilFail,i.stencilZFail=this.stencilZFail,i.stencilZPass=this.stencilZPass,this.rotation&&0!==this.rotation&&(i.rotation=this.rotation),!0===this.polygonOffset&&(i.polygonOffset=!0),0!==this.polygonOffsetFactor&&(i.polygonOffsetFactor=this.polygonOffsetFactor),0!==this.polygonOffsetUnits&&(i.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth&&1!==this.linewidth&&(i.linewidth=this.linewidth),void 0!==this.dashSize&&(i.dashSize=this.dashSize),void 0!==this.gapSize&&(i.gapSize=this.gapSize),void 0!==this.scale&&(i.scale=this.scale),!0===this.dithering&&(i.dithering=!0),0r&&(r+=1),1e?.0773993808*e:Math.pow(.9478672986*e+.0521327014,2.4)}function In(e){return.0031308>e?12.92*e:1.055*Math.pow(e,.41666)-.055}class On{constructor(e,t,r){return void 0===t&&void 0===r?this.set(e):this.setRGB(e,t,r)}set(e){return e&&e.isColor?this.copy(e):"number"==typeof e?this.setHex(e):"string"==typeof e&&this.setStyle(e),this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e){return e=Math.floor(e),this.r=(255&e>>16)/255,this.g=(255&e>>8)/255,this.b=(255&e)/255,this}setRGB(e,t,r){return this.r=e,this.g=t,this.b=r,this}setHSL(e,t,r){if(e=Zr(e,1),t=Wr(t,0,1),r=Wr(r,0,1),0===t)this.r=this.g=this.b=r;else{var i=.5>=r?r*(1+t):r+t-r*t,n=2*r-i;this.r=Cn(n,i,e+1/3),this.g=Cn(n,i,e),this.b=Cn(n,i,e-1/3)}return this}setStyle(e){function t(t){void 0===t||1>parseFloat(t)&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}var r;if(r=/^((?:rgb|hsl)a?)\(([^\)]*)\)/.exec(e)){var i,n=r[1],a=r[2];switch(n){case"rgb":case"rgba":if(i=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return this.r=Math.min(255,parseInt(i[1],10))/255,this.g=Math.min(255,parseInt(i[2],10))/255,this.b=Math.min(255,parseInt(i[3],10))/255,t(i[4]),this;if(i=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return this.r=Math.min(100,parseInt(i[1],10))/100,this.g=Math.min(100,parseInt(i[2],10))/100,this.b=Math.min(100,parseInt(i[3],10))/100,t(i[4]),this;break;case"hsl":case"hsla":if(i=/^\s*(\d*\.?\d+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a)){var s=parseFloat(i[1])/360,o=parseInt(i[2],10)/100,l=parseInt(i[3],10)/100;return t(i[4]),this.setHSL(s,o,l)}}}else if(r=/^\#([A-Fa-f\d]+)$/.exec(e)){var h=r[1],c=h.length;if(3===c)return this.r=parseInt(h.charAt(0)+h.charAt(0),16)/255,this.g=parseInt(h.charAt(1)+h.charAt(1),16)/255,this.b=parseInt(h.charAt(2)+h.charAt(2),16)/255,this;if(6===c)return this.r=parseInt(h.charAt(0)+h.charAt(1),16)/255,this.g=parseInt(h.charAt(2)+h.charAt(3),16)/255,this.b=parseInt(h.charAt(4)+h.charAt(5),16)/255,this}return e&&0=l?h/(s+o):h/(2-s-o),s===i?t=(n-a)/h+(nt&&(t=e[r]);return t}var Yn={Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array};function Jn(e,t){return new Yn[e](t)}var Kn=0,Qn=new Vi,$n=new pn,ea=new ci,ta=new pi,ra=new pi,ia=new ci;class na extends zr{constructor(){super(),Object.defineProperty(this,"id",{value:Kn++}),this.uuid=jr(),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={}}getIndex(){return this.index}setIndex(e){return this.index=Array.isArray(e)?new(65535R.dot(u[e])?-1:1;h[4*e]=L.x,h[4*e+1]=L.y,h[4*e+2]=L.z,h[4*e+3]=r}var r=this.index,i=this.attributes;if(null!==r&&void 0!==i.position&&void 0!==i.normal&&void 0!==i.uv){var n=r.array,a=i.position.array,s=i.normal.array,o=i.uv.array,l=a.length/3;void 0===i.tangent&&this.setAttribute("tangent",new Un(new Float32Array(4*l),4));for(var h=i.tangent.array,c=[],u=[],d=0;dr.far?null:{distance:l,point:wa.clone(),object:e}}(e,t,r,i,la,ha,ca,ba);if(g){o&&(ga.fromBufferAttribute(o,h),ya.fromBufferAttribute(o,c),xa.fromBufferAttribute(o,u),g.uv=Sn.getUV(ba,la,ha,ca,ga,ya,xa,new $r)),l&&(ga.fromBufferAttribute(l,h),ya.fromBufferAttribute(l,c),xa.fromBufferAttribute(l,u),g.uv2=Sn.getUV(ba,la,ha,ca,ga,ya,xa,new $r));var b={a:h,b:c,c:u,normal:new ci,materialIndex:0};Sn.getNormal(la,ha,ca,b.normal),g.face=b}return g}_a.prototype.isMesh=!0;class Sa extends na{constructor(){function e(e,t,r,i,n,a,s,m,f,v,g){for(var y,x=f+1,b=0,w=0,_=new ci,M=0;M\n\t\t\t\t\t#include \n\n\t\t\t\t}\n\t\t\t",fragmentShader:"\n\n\t\t\t\tuniform sampler2D tEquirect;\n\n\t\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t\t#include \n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvec3 direction = normalize( vWorldDirection );\n\n\t\t\t\t\tvec2 sampleUV = equirectUv( direction );\n\n\t\t\t\t\tgl_FragColor = texture2D( tEquirect, sampleUV );\n\n\t\t\t\t}\n\t\t\t",side:y,blending:_});i.uniforms.tEquirect.value=t;var n=new _a(r,i),a=t.minFilter;return t.minFilter===Te&&(t.minFilter=_e),new Ia(1,10,this).update(e,n),t.minFilter=a,n.geometry.dispose(),n.material.dispose(),this}clear(e,t,r,i){for(var n=e.getRenderTarget(),a=0;6>a;a++)e.setRenderTarget(this,a),e.clear(t,r,i);e.setRenderTarget(n)}}Da.prototype.isWebGLCubeRenderTarget=!0;var Na=new ci,Ba=new ci,Ua=new ei;class za{constructor(){var e=0n||1t&&0r&&0r;r++)t[r].copy(e.planes[r]);return this}setFromProjectionMatrix(e){var t=this.planes,r=e.elements,i=r[0],n=r[1],a=r[2],s=r[3],o=r[4],l=r[5],h=r[6],c=r[7],u=r[8],d=r[9],p=r[10],m=r[11],f=r[12],v=r[13],g=r[14],y=r[15];return t[0].setComponents(s-i,c-o,m-u,y-f).normalize(),t[1].setComponents(s+i,c+o,m+u,y+f).normalize(),t[2].setComponents(s+n,c+l,m+d,y+v).normalize(),t[3].setComponents(s-n,c-l,m-d,y-v).normalize(),t[4].setComponents(s-a,c-h,m-p,y-g).normalize(),t[5].setComponents(s+a,c+h,m+p,y+g).normalize(),this}intersectsObject(e){var t=e.geometry;return null===t.boundingSphere&&t.computeBoundingSphere(),Fa.copy(t.boundingSphere).applyMatrix4(e.matrixWorld),this.intersectsSphere(Fa)}intersectsSprite(e){return Fa.center.set(0,0,0),Fa.radius=.7071067811865476,Fa.applyMatrix4(e.matrixWorld),this.intersectsSphere(Fa)}intersectsSphere(e){for(var t=this.planes,r=e.center,i=-e.radius,n=0;6>n;n++)if(t[n].distanceToPoint(r)i;i++)if(t=r[i],Ga.x=0t.distanceToPoint(Ga))return!1;return!0}containsPoint(e){for(var t=this.planes,r=0;6>r;r++)if(0>t[r].distanceToPoint(e))return!1;return!0}clone(){return(new this.constructor).copy(this)}}function Ha(){function e(r,a){i(r,a),n=t.requestAnimationFrame(e)}var t=null,r=!1,i=null,n=null;return{start:function(){!0===r||null===i||(n=t.requestAnimationFrame(e),r=!0)},stop:function(){t.cancelAnimationFrame(n),r=!1},setAnimationLoop:function(e){i=e},setContext:function(e){t=e}}}function ka(e,t){var r=t.isWebGL2,i=new WeakMap;return{get:function(e){return e.isInterleavedBufferAttribute&&(e=e.data),i.get(e)},remove:function(t){t.isInterleavedBufferAttribute&&(t=t.data);var r=i.get(t);r&&(e.deleteBuffer(r.buffer),i.delete(t))},update:function(t,n){if(t.isGLBufferAttribute){var a=i.get(t);(!a||a.version 0.0 ) {\n\t\tdistanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\t}\n\treturn distanceFalloff;\n#else\n\tif( cutoffDistance > 0.0 && decayExponent > 0.0 ) {\n\t\treturn pow( saturate( -lightDistance / cutoffDistance + 1.0 ), decayExponent );\n\t}\n\treturn 1.0;\n#endif\n}\nvec3 BRDF_Diffuse_Lambert( const in vec3 diffuseColor ) {\n\treturn RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 specularColor, const in float dotVH ) {\n\tfloat fresnel = exp2( ( -5.55473 * dotVH - 6.98316 ) * dotVH );\n\treturn ( 1.0 - specularColor ) * fresnel + specularColor;\n}\nvec3 F_Schlick_RoughnessDependent( const in vec3 F0, const in float dotNV, const in float roughness ) {\n\tfloat fresnel = exp2( ( -5.55473 * dotNV - 6.98316 ) * dotNV );\n\tvec3 Fr = max( vec3( 1.0 - roughness ), F0 ) - F0;\n\treturn Fr * fresnel + F0;\n}\nfloat G_GGX_Smith( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gl = dotNL + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\tfloat gv = dotNV + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\treturn 1.0 / ( gl * gv );\n}\nfloat G_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\tfloat gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\treturn 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n\tfloat a2 = pow2( alpha );\n\tfloat denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n\treturn RECIPROCAL_PI * a2 / pow2( denom );\n}\nvec3 BRDF_Specular_GGX( const in IncidentLight incidentLight, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float roughness ) {\n\tfloat alpha = pow2( roughness );\n\tvec3 halfDir = normalize( incidentLight.direction + viewDir );\n\tfloat dotNL = saturate( dot( normal, incidentLight.direction ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, dotLH );\n\tfloat G = G_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\tfloat D = D_GGX( alpha, dotNH );\n\treturn F * ( G * D );\n}\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n\tconst float LUT_SIZE = 64.0;\n\tconst float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n\tconst float LUT_BIAS = 0.5 / LUT_SIZE;\n\tfloat dotNV = saturate( dot( N, V ) );\n\tvec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\n\tuv = uv * LUT_SCALE + LUT_BIAS;\n\treturn uv;\n}\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n\tfloat l = length( f );\n\treturn max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n}\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n\tfloat x = dot( v1, v2 );\n\tfloat y = abs( x );\n\tfloat a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\n\tfloat b = 3.4175940 + ( 4.1616724 + y ) * y;\n\tfloat v = a / b;\n\tfloat theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\n\treturn cross( v1, v2 ) * theta_sintheta;\n}\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\n\tvec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n\tvec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n\tvec3 lightNormal = cross( v1, v2 );\n\tif( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n\tvec3 T1, T2;\n\tT1 = normalize( V - N * dot( V, N ) );\n\tT2 = - cross( N, T1 );\n\tmat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );\n\tvec3 coords[ 4 ];\n\tcoords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n\tcoords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n\tcoords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n\tcoords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n\tcoords[ 0 ] = normalize( coords[ 0 ] );\n\tcoords[ 1 ] = normalize( coords[ 1 ] );\n\tcoords[ 2 ] = normalize( coords[ 2 ] );\n\tcoords[ 3 ] = normalize( coords[ 3 ] );\n\tvec3 vectorFormFactor = vec3( 0.0 );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n\tfloat result = LTC_ClippedSphereFormFactor( vectorFormFactor );\n\treturn vec3( result );\n}\nvec3 BRDF_Specular_GGX_Environment( const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tvec2 brdf = integrateSpecularBRDF( dotNV, roughness );\n\treturn 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 ) {\n\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\tvec3 F = F_Schlick_RoughnessDependent( specularColor, dotNV, roughness );\n\tvec2 brdf = integrateSpecularBRDF( dotNV, roughness );\n\tvec3 FssEss = F * brdf.x + brdf.y;\n\tfloat Ess = brdf.x + brdf.y;\n\tfloat Ems = 1.0 - Ess;\n\tvec3 Favg = specularColor + ( 1.0 - specularColor ) * 0.047619;\tvec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );\n\tsingleScatter += FssEss;\n\tmultiScatter += Fms * Ems;\n}\nfloat G_BlinnPhong_Implicit( ) {\n\treturn 0.25;\n}\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\n\treturn RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\n}\nvec3 BRDF_Specular_BlinnPhong( const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float shininess ) {\n\tvec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );\n\tfloat dotNH = saturate( dot( geometry.normal, halfDir ) );\n\tfloat dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, dotLH );\n\tfloat G = G_BlinnPhong_Implicit( );\n\tfloat D = D_BlinnPhong( shininess, dotNH );\n\treturn F * ( G * D );\n}\nfloat GGXRoughnessToBlinnExponent( const in float ggxRoughness ) {\n\treturn ( 2.0 / pow2( ggxRoughness + 0.0001 ) - 2.0 );\n}\nfloat BlinnExponentToGGXRoughness( const in float blinnExponent ) {\n\treturn sqrt( 2.0 / ( blinnExponent + 2.0 ) );\n}\n#if defined( USE_SHEEN )\nfloat D_Charlie(float roughness, float NoH) {\n\tfloat invAlpha = 1.0 / roughness;\n\tfloat cos2h = NoH * NoH;\n\tfloat 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) {\n\treturn 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 ) {\n\tvec3 N = geometry.normal;\n\tvec3 V = geometry.viewDir;\n\tvec3 H = normalize( V + L );\n\tfloat dotNH = saturate( dot( N, H ) );\n\treturn specularColor * D_Charlie( roughness, dotNH ) * V_Neubelt( dot(N, V), dot(N, L) );\n}\n#endif",bumpmap_pars_fragment:"#ifdef USE_BUMPMAP\n\tuniform sampler2D bumpMap;\n\tuniform float bumpScale;\n\tvec2 dHdxy_fwd() {\n\t\tvec2 dSTdx = dFdx( vUv );\n\t\tvec2 dSTdy = dFdy( vUv );\n\t\tfloat Hll = bumpScale * texture2D( bumpMap, vUv ).x;\n\t\tfloat dBx = bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll;\n\t\tfloat dBy = bumpScale * texture2D( bumpMap, vUv + dSTdy ).x - Hll;\n\t\treturn vec2( dBx, dBy );\n\t}\n\tvec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {\n\t\tvec3 vSigmaX = vec3( dFdx( surf_pos.x ), dFdx( surf_pos.y ), dFdx( surf_pos.z ) );\n\t\tvec3 vSigmaY = vec3( dFdy( surf_pos.x ), dFdy( surf_pos.y ), dFdy( surf_pos.z ) );\n\t\tvec3 vN = surf_norm;\n\t\tvec3 R1 = cross( vSigmaY, vN );\n\t\tvec3 R2 = cross( vN, vSigmaX );\n\t\tfloat fDet = dot( vSigmaX, R1 ) * faceDirection;\n\t\tvec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n\t\treturn normalize( abs( fDet ) * surf_norm - vGrad );\n\t}\n#endif",clipping_planes_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tvec4 plane;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n\t\tplane = clippingPlanes[ i ];\n\t\tif ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;\n\t}\n\t#pragma unroll_loop_end\n\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\tbool clipped = true;\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n\t\t\tplane = clippingPlanes[ i ];\n\t\t\tclipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t\tif ( clipped ) discard;\n\t#endif\n#endif",clipping_planes_pars_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n\tuniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif",clipping_planes_pars_vertex:"#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n#endif",clipping_planes_vertex:"#if NUM_CLIPPING_PLANES > 0\n\tvClipPosition = - mvPosition.xyz;\n#endif",color_fragment:"#if defined( USE_COLOR_ALPHA )\n\tdiffuseColor *= vColor;\n#elif defined( USE_COLOR )\n\tdiffuseColor.rgb *= vColor;\n#endif",color_pars_fragment:"#if defined( USE_COLOR_ALPHA )\n\tvarying vec4 vColor;\n#elif defined( USE_COLOR )\n\tvarying vec3 vColor;\n#endif",color_pars_vertex:"#if defined( USE_COLOR_ALPHA )\n\tvarying vec4 vColor;\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )\n\tvarying vec3 vColor;\n#endif",color_vertex:"#if defined( USE_COLOR_ALPHA )\n\tvColor = vec4( 1.0 );\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )\n\tvColor = vec3( 1.0 );\n#endif\n#ifdef USE_COLOR\n\tvColor *= color;\n#endif\n#ifdef USE_INSTANCING_COLOR\n\tvColor.xyz *= instanceColor.xyz;\n#endif",common:"#define PI 3.141592653589793\n#define PI2 6.283185307179586\n#define PI_HALF 1.5707963267948966\n#define RECIPROCAL_PI 0.3183098861837907\n#define RECIPROCAL_PI2 0.15915494309189535\n#define EPSILON 1e-6\n#ifndef saturate\n#define saturate(a) clamp( a, 0.0, 1.0 )\n#endif\n#define whiteComplement(a) ( 1.0 - saturate( a ) )\nfloat pow2( const in float x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat average( const in vec3 color ) { return dot( color, vec3( 0.3333 ) ); }\nhighp float rand( const in vec2 uv ) {\n\tconst highp float a = 12.9898, b = 78.233, c = 43758.5453;\n\thighp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n\treturn fract(sin(sn) * c);\n}\n#ifdef HIGH_PRECISION\n\tfloat precisionSafeLength( vec3 v ) { return length( v ); }\n#else\n\tfloat max3( vec3 v ) { return max( max( v.x, v.y ), v.z ); }\n\tfloat precisionSafeLength( vec3 v ) {\n\t\tfloat maxComponent = max3( abs( v ) );\n\t\treturn length( v / maxComponent ) * maxComponent;\n\t}\n#endif\nstruct IncidentLight {\n\tvec3 color;\n\tvec3 direction;\n\tbool visible;\n};\nstruct ReflectedLight {\n\tvec3 directDiffuse;\n\tvec3 directSpecular;\n\tvec3 indirectDiffuse;\n\tvec3 indirectSpecular;\n};\nstruct GeometricContext {\n\tvec3 position;\n\tvec3 normal;\n\tvec3 viewDir;\n#ifdef CLEARCOAT\n\tvec3 clearcoatNormal;\n#endif\n};\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n}\nvec3 projectOnPlane(in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\tfloat distance = dot( planeNormal, point - pointOnPlane );\n\treturn - distance * planeNormal + point;\n}\nfloat sideOfPlane( in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\treturn sign( dot( point - pointOnPlane, planeNormal ) );\n}\nvec3 linePlaneIntersect( in vec3 pointOnLine, in vec3 lineDirection, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\treturn lineDirection * ( dot( planeNormal, pointOnPlane - pointOnLine ) / dot( planeNormal, lineDirection ) ) + pointOnLine;\n}\nmat3 transposeMat3( const in mat3 m ) {\n\tmat3 tmp;\n\ttmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );\n\ttmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );\n\ttmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );\n\treturn tmp;\n}\nfloat linearToRelativeLuminance( const in vec3 color ) {\n\tvec3 weights = vec3( 0.2126, 0.7152, 0.0722 );\n\treturn dot( weights, color.rgb );\n}\nbool isPerspectiveMatrix( mat4 m ) {\n\treturn m[ 2 ][ 3 ] == - 1.0;\n}\nvec2 equirectUv( in vec3 dir ) {\n\tfloat u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;\n\tfloat v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\treturn vec2( u, v );\n}",cube_uv_reflection_fragment:"#ifdef ENVMAP_TYPE_CUBE_UV\n\t#define cubeUV_maxMipLevel 8.0\n\t#define cubeUV_minMipLevel 4.0\n\t#define cubeUV_maxTileSize 256.0\n\t#define cubeUV_minTileSize 16.0\n\tfloat getFace( vec3 direction ) {\n\t\tvec3 absDirection = abs( direction );\n\t\tfloat face = - 1.0;\n\t\tif ( absDirection.x > absDirection.z ) {\n\t\t\tif ( absDirection.x > absDirection.y )\n\t\t\t\tface = direction.x > 0.0 ? 0.0 : 3.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t} else {\n\t\t\tif ( absDirection.z > absDirection.y )\n\t\t\t\tface = direction.z > 0.0 ? 2.0 : 5.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t}\n\t\treturn face;\n\t}\n\tvec2 getUV( vec3 direction, float face ) {\n\t\tvec2 uv;\n\t\tif ( face == 0.0 ) {\n\t\t\tuv = vec2( direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 1.0 ) {\n\t\t\tuv = vec2( - direction.x, - direction.z ) / abs( direction.y );\n\t\t} else if ( face == 2.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.y ) / abs( direction.z );\n\t\t} else if ( face == 3.0 ) {\n\t\t\tuv = vec2( - direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 4.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.z ) / abs( direction.y );\n\t\t} else {\n\t\t\tuv = vec2( direction.x, direction.y ) / abs( direction.z );\n\t\t}\n\t\treturn 0.5 * ( uv + 1.0 );\n\t}\n\tvec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {\n\t\tfloat face = getFace( direction );\n\t\tfloat filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );\n\t\tmipInt = max( mipInt, cubeUV_minMipLevel );\n\t\tfloat faceSize = exp2( mipInt );\n\t\tfloat texelSize = 1.0 / ( 3.0 * cubeUV_maxTileSize );\n\t\tvec2 uv = getUV( direction, face ) * ( faceSize - 1.0 );\n\t\tvec2 f = fract( uv );\n\t\tuv += 0.5 - f;\n\t\tif ( face > 2.0 ) {\n\t\t\tuv.y += faceSize;\n\t\t\tface -= 3.0;\n\t\t}\n\t\tuv.x += face * faceSize;\n\t\tif ( mipInt < cubeUV_maxMipLevel ) {\n\t\t\tuv.y += 2.0 * cubeUV_maxTileSize;\n\t\t}\n\t\tuv.y += filterInt * 2.0 * cubeUV_minTileSize;\n\t\tuv.x += 3.0 * max( 0.0, cubeUV_maxTileSize - 2.0 * faceSize );\n\t\tuv *= texelSize;\n\t\tvec3 tl = envMapTexelToLinear( texture2D( envMap, uv ) ).rgb;\n\t\tuv.x += texelSize;\n\t\tvec3 tr = envMapTexelToLinear( texture2D( envMap, uv ) ).rgb;\n\t\tuv.y += texelSize;\n\t\tvec3 br = envMapTexelToLinear( texture2D( envMap, uv ) ).rgb;\n\t\tuv.x -= texelSize;\n\t\tvec3 bl = envMapTexelToLinear( texture2D( envMap, uv ) ).rgb;\n\t\tvec3 tm = mix( tl, tr, f.x );\n\t\tvec3 bm = mix( bl, br, f.x );\n\t\treturn mix( tm, bm, f.y );\n\t}\n\t#define r0 1.0\n\t#define v0 0.339\n\t#define m0 - 2.0\n\t#define r1 0.8\n\t#define v1 0.276\n\t#define m1 - 1.0\n\t#define r4 0.4\n\t#define v4 0.046\n\t#define m4 2.0\n\t#define r5 0.305\n\t#define v5 0.016\n\t#define m5 3.0\n\t#define r6 0.21\n\t#define v6 0.0038\n\t#define m6 4.0\n\tfloat roughnessToMip( float roughness ) {\n\t\tfloat mip = 0.0;\n\t\tif ( roughness >= r1 ) {\n\t\t\tmip = ( r0 - roughness ) * ( m1 - m0 ) / ( r0 - r1 ) + m0;\n\t\t} else if ( roughness >= r4 ) {\n\t\t\tmip = ( r1 - roughness ) * ( m4 - m1 ) / ( r1 - r4 ) + m1;\n\t\t} else if ( roughness >= r5 ) {\n\t\t\tmip = ( r4 - roughness ) * ( m5 - m4 ) / ( r4 - r5 ) + m4;\n\t\t} else if ( roughness >= r6 ) {\n\t\t\tmip = ( r5 - roughness ) * ( m6 - m5 ) / ( r5 - r6 ) + m5;\n\t\t} else {\n\t\t\tmip = - 2.0 * log2( 1.16 * roughness );\t\t}\n\t\treturn mip;\n\t}\n\tvec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {\n\t\tfloat mip = clamp( roughnessToMip( roughness ), m0, cubeUV_maxMipLevel );\n\t\tfloat mipF = fract( mip );\n\t\tfloat mipInt = floor( mip );\n\t\tvec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );\n\t\tif ( mipF == 0.0 ) {\n\t\t\treturn vec4( color0, 1.0 );\n\t\t} else {\n\t\t\tvec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );\n\t\t\treturn vec4( mix( color0, color1, mipF ), 1.0 );\n\t\t}\n\t}\n#endif",defaultnormal_vertex:"vec3 transformedNormal = objectNormal;\n#ifdef USE_INSTANCING\n\tmat3 m = mat3( instanceMatrix );\n\ttransformedNormal /= vec3( dot( m[ 0 ], m[ 0 ] ), dot( m[ 1 ], m[ 1 ] ), dot( m[ 2 ], m[ 2 ] ) );\n\ttransformedNormal = m * transformedNormal;\n#endif\ntransformedNormal = normalMatrix * transformedNormal;\n#ifdef FLIP_SIDED\n\ttransformedNormal = - transformedNormal;\n#endif\n#ifdef USE_TANGENT\n\tvec3 transformedTangent = ( modelViewMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n\t#ifdef FLIP_SIDED\n\t\ttransformedTangent = - transformedTangent;\n\t#endif\n#endif",displacementmap_pars_vertex:"#ifdef USE_DISPLACEMENTMAP\n\tuniform sampler2D displacementMap;\n\tuniform float displacementScale;\n\tuniform float displacementBias;\n#endif",displacementmap_vertex:"#ifdef USE_DISPLACEMENTMAP\n\ttransformed += normalize( objectNormal ) * ( texture2D( displacementMap, vUv ).x * displacementScale + displacementBias );\n#endif",emissivemap_fragment:"#ifdef USE_EMISSIVEMAP\n\tvec4 emissiveColor = texture2D( emissiveMap, vUv );\n\temissiveColor.rgb = emissiveMapTexelToLinear( emissiveColor ).rgb;\n\ttotalEmissiveRadiance *= emissiveColor.rgb;\n#endif",emissivemap_pars_fragment:"#ifdef USE_EMISSIVEMAP\n\tuniform sampler2D emissiveMap;\n#endif",encodings_fragment:"gl_FragColor = linearToOutputTexel( gl_FragColor );",encodings_pars_fragment:"\nvec4 LinearToLinear( in vec4 value ) {\n\treturn value;\n}\nvec4 GammaToLinear( in vec4 value, in float gammaFactor ) {\n\treturn vec4( pow( value.rgb, vec3( gammaFactor ) ), value.a );\n}\nvec4 LinearToGamma( in vec4 value, in float gammaFactor ) {\n\treturn vec4( pow( value.rgb, vec3( 1.0 / gammaFactor ) ), value.a );\n}\nvec4 sRGBToLinear( in vec4 value ) {\n\treturn 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 ) {\n\treturn vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );\n}\nvec4 RGBEToLinear( in vec4 value ) {\n\treturn vec4( value.rgb * exp2( value.a * 255.0 - 128.0 ), 1.0 );\n}\nvec4 LinearToRGBE( in vec4 value ) {\n\tfloat maxComponent = max( max( value.r, value.g ), value.b );\n\tfloat fExp = clamp( ceil( log2( maxComponent ) ), -128.0, 127.0 );\n\treturn vec4( value.rgb / exp2( fExp ), ( fExp + 128.0 ) / 255.0 );\n}\nvec4 RGBMToLinear( in vec4 value, in float maxRange ) {\n\treturn vec4( value.rgb * value.a * maxRange, 1.0 );\n}\nvec4 LinearToRGBM( in vec4 value, in float maxRange ) {\n\tfloat maxRGB = max( value.r, max( value.g, value.b ) );\n\tfloat M = clamp( maxRGB / maxRange, 0.0, 1.0 );\n\tM = ceil( M * 255.0 ) / 255.0;\n\treturn vec4( value.rgb / ( M * maxRange ), M );\n}\nvec4 RGBDToLinear( in vec4 value, in float maxRange ) {\n\treturn vec4( value.rgb * ( ( maxRange / 255.0 ) / value.a ), 1.0 );\n}\nvec4 LinearToRGBD( in vec4 value, in float maxRange ) {\n\tfloat maxRGB = max( value.r, max( value.g, value.b ) );\n\tfloat D = max( maxRange / maxRGB, 1.0 );\n\tD = clamp( floor( D ) / 255.0, 0.0, 1.0 );\n\treturn vec4( value.rgb * ( D * ( 255.0 / maxRange ) ), D );\n}\nconst mat3 cLogLuvM = mat3( 0.2209, 0.3390, 0.4184, 0.1138, 0.6780, 0.7319, 0.0102, 0.1130, 0.2969 );\nvec4 LinearToLogLuv( in vec4 value ) {\n\tvec3 Xp_Y_XYZp = cLogLuvM * value.rgb;\n\tXp_Y_XYZp = max( Xp_Y_XYZp, vec3( 1e-6, 1e-6, 1e-6 ) );\n\tvec4 vResult;\n\tvResult.xy = Xp_Y_XYZp.xy / Xp_Y_XYZp.z;\n\tfloat Le = 2.0 * log2(Xp_Y_XYZp.y) + 127.0;\n\tvResult.w = fract( Le );\n\tvResult.z = ( Le - ( floor( vResult.w * 255.0 ) ) / 255.0 ) / 255.0;\n\treturn vResult;\n}\nconst mat3 cLogLuvInverseM = mat3( 6.0014, -2.7008, -1.7996, -1.3320, 3.1029, -5.7721, 0.3008, -1.0882, 5.6268 );\nvec4 LogLuvToLinear( in vec4 value ) {\n\tfloat Le = value.z * 255.0 + value.w;\n\tvec3 Xp_Y_XYZp;\n\tXp_Y_XYZp.y = exp2( ( Le - 127.0 ) / 2.0 );\n\tXp_Y_XYZp.z = Xp_Y_XYZp.y / value.y;\n\tXp_Y_XYZp.x = value.x * Xp_Y_XYZp.z;\n\tvec3 vRGB = cLogLuvInverseM * Xp_Y_XYZp.rgb;\n\treturn vec4( max( vRGB, 0.0 ), 1.0 );\n}",envmap_fragment:"#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvec3 cameraToFrag;\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToFrag = normalize( vWorldPosition - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( cameraToFrag, worldNormal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );\n\t\t#endif\n\t#else\n\t\tvec3 reflectVec = vReflect;\n\t#endif\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 envColor = textureCube( envMap, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\tvec4 envColor = textureCubeUV( envMap, reflectVec, 0.0 );\n\t#else\n\t\tvec4 envColor = vec4( 0.0 );\n\t#endif\n\t#ifndef ENVMAP_TYPE_CUBE_UV\n\t\tenvColor = envMapTexelToLinear( envColor );\n\t#endif\n\t#ifdef ENVMAP_BLENDING_MULTIPLY\n\t\toutgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_MIX )\n\t\toutgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_ADD )\n\t\toutgoingLight += envColor.xyz * specularStrength * reflectivity;\n\t#endif\n#endif",envmap_common_pars_fragment:"#ifdef USE_ENVMAP\n\tuniform float envMapIntensity;\n\tuniform float flipEnvMap;\n\tuniform int maxMipLevel;\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tuniform samplerCube envMap;\n\t#else\n\t\tuniform sampler2D envMap;\n\t#endif\n\t\n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\n\tuniform float reflectivity;\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\tvarying vec3 vWorldPosition;\n\t\tuniform float refractionRatio;\n\t#else\n\t\tvarying vec3 vReflect;\n\t#endif\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) ||defined( PHONG )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\t\n\t\tvarying vec3 vWorldPosition;\n\t#else\n\t\tvarying vec3 vReflect;\n\t\tuniform float refractionRatio;\n\t#endif\n#endif",envmap_physical_pars_fragment:"#if defined( USE_ENVMAP )\n\t#ifdef ENVMAP_MODE_REFRACTION\n\t\tuniform float refractionRatio;\n\t#endif\n\tvec3 getLightProbeIndirectIrradiance( const in GeometricContext geometry, const in int maxMIPLevel ) {\n\t\tvec3 worldNormal = inverseTransformDirection( geometry.normal, viewMatrix );\n\t\t#ifdef ENVMAP_TYPE_CUBE\n\t\t\tvec3 queryVec = vec3( flipEnvMap * worldNormal.x, worldNormal.yz );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = textureCubeLodEXT( envMap, queryVec, float( maxMIPLevel ) );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = textureCube( envMap, queryVec, float( maxMIPLevel ) );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, worldNormal, 1.0 );\n\t\t#else\n\t\t\tvec4 envMapColor = vec4( 0.0 );\n\t\t#endif\n\t\treturn PI * envMapColor.rgb * envMapIntensity;\n\t}\n\tfloat getSpecularMIPLevel( const in float roughness, const in int maxMIPLevel ) {\n\t\tfloat maxMIPLevelScalar = float( maxMIPLevel );\n\t\tfloat sigma = PI * roughness * roughness / ( 1.0 + roughness );\n\t\tfloat desiredMIPLevel = maxMIPLevelScalar + log2( sigma );\n\t\treturn clamp( desiredMIPLevel, 0.0, maxMIPLevelScalar );\n\t}\n\tvec3 getLightProbeIndirectRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in int maxMIPLevel ) {\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( -viewDir, normal );\n\t\t\treflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( -viewDir, normal, refractionRatio );\n\t\t#endif\n\t\treflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n\t\tfloat specularMIPLevel = getSpecularMIPLevel( roughness, maxMIPLevel );\n\t\t#ifdef ENVMAP_TYPE_CUBE\n\t\t\tvec3 queryReflectVec = vec3( flipEnvMap * reflectVec.x, reflectVec.yz );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = textureCubeLodEXT( envMap, queryReflectVec, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = textureCube( envMap, queryReflectVec, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, reflectVec, roughness );\n\t\t#endif\n\t\treturn envMapColor.rgb * envMapIntensity;\n\t}\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvWorldPosition = worldPosition.xyz;\n\t#else\n\t\tvec3 cameraToVertex;\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvReflect = reflect( cameraToVertex, worldNormal );\n\t\t#else\n\t\t\tvReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n\t\t#endif\n\t#endif\n#endif",fog_vertex:"#ifdef USE_FOG\n\tfogDepth = - mvPosition.z;\n#endif",fog_pars_vertex:"#ifdef USE_FOG\n\tvarying float fogDepth;\n#endif",fog_fragment:"#ifdef USE_FOG\n\t#ifdef FOG_EXP2\n\t\tfloat fogFactor = 1.0 - exp( - fogDensity * fogDensity * fogDepth * fogDepth );\n\t#else\n\t\tfloat fogFactor = smoothstep( fogNear, fogFar, fogDepth );\n\t#endif\n\tgl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n#endif",fog_pars_fragment:"#ifdef USE_FOG\n\tuniform vec3 fogColor;\n\tvarying float fogDepth;\n\t#ifdef FOG_EXP2\n\t\tuniform float fogDensity;\n\t#else\n\t\tuniform float fogNear;\n\t\tuniform float fogFar;\n\t#endif\n#endif",gradientmap_pars_fragment:"#ifdef USE_GRADIENTMAP\n\tuniform sampler2D gradientMap;\n#endif\nvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n\tfloat dotNL = dot( normal, lightDirection );\n\tvec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n\t#ifdef USE_GRADIENTMAP\n\t\treturn texture2D( gradientMap, coord ).rgb;\n\t#else\n\t\treturn ( coord.x < 0.7 ) ? vec3( 0.7 ) : vec3( 1.0 );\n\t#endif\n}",lightmap_fragment:"#ifdef USE_LIGHTMAP\n\tvec4 lightMapTexel= texture2D( lightMap, vUv2 );\n\treflectedLight.indirectDiffuse += PI * lightMapTexelToLinear( lightMapTexel ).rgb * lightMapIntensity;\n#endif",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\n\tuniform sampler2D lightMap;\n\tuniform float lightMapIntensity;\n#endif",lights_lambert_vertex:"vec3 diffuse = vec3( 1.0 );\nGeometricContext geometry;\ngeometry.position = mvPosition.xyz;\ngeometry.normal = normalize( transformedNormal );\ngeometry.viewDir = ( 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_SIDED\n\tvLightBack = vec3( 0.0 );\n\tvIndirectBack = vec3( 0.0 );\n#endif\nIncidentLight directLight;\nfloat dotNL;\nvec3 directLightColor_Diffuse;\nvIndirectFront += getAmbientLightIrradiance( ambientLightColor );\nvIndirectFront += getLightProbeIrradiance( lightProbe, geometry );\n#ifdef DOUBLE_SIDED\n\tvIndirectBack += getAmbientLightIrradiance( ambientLightColor );\n\tvIndirectBack += getLightProbeIrradiance( lightProbe, backGeometry );\n#endif\n#if NUM_POINT_LIGHTS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tgetPointDirectLightIrradiance( pointLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tgetSpotDirectLightIrradiance( spotLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if NUM_DIR_LIGHTS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tgetDirectionalDirectLightIrradiance( directionalLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\tvIndirectFront += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvIndirectBack += getHemisphereLightIrradiance( hemisphereLights[ i ], backGeometry );\n\t\t#endif\n\t}\n\t#pragma unroll_loop_end\n#endif",lights_pars_begin:"uniform bool receiveShadow;\nuniform vec3 ambientLightColor;\nuniform vec3 lightProbe[ 9 ];\nvec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {\n\tfloat x = normal.x, y = normal.y, z = normal.z;\n\tvec3 result = shCoefficients[ 0 ] * 0.886227;\n\tresult += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;\n\tresult += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;\n\tresult += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;\n\tresult += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;\n\tresult += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;\n\tresult += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );\n\tresult += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;\n\tresult += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );\n\treturn result;\n}\nvec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in GeometricContext geometry ) {\n\tvec3 worldNormal = inverseTransformDirection( geometry.normal, viewMatrix );\n\tvec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );\n\treturn irradiance;\n}\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n\tvec3 irradiance = ambientLightColor;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treturn irradiance;\n}\n#if NUM_DIR_LIGHTS > 0\n\tstruct DirectionalLight {\n\t\tvec3 direction;\n\t\tvec3 color;\n\t};\n\tuniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n\tvoid getDirectionalDirectLightIrradiance( const in DirectionalLight directionalLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tdirectLight.color = directionalLight.color;\n\t\tdirectLight.direction = directionalLight.direction;\n\t\tdirectLight.visible = true;\n\t}\n#endif\n#if NUM_POINT_LIGHTS > 0\n\tstruct PointLight {\n\t\tvec3 position;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t};\n\tuniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n\tvoid getPointDirectLightIrradiance( const in PointLight pointLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tvec3 lVector = pointLight.position - geometry.position;\n\t\tdirectLight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tdirectLight.color = pointLight.color;\n\t\tdirectLight.color *= punctualLightIntensityToIrradianceFactor( lightDistance, pointLight.distance, pointLight.decay );\n\t\tdirectLight.visible = ( directLight.color != vec3( 0.0 ) );\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\tstruct SpotLight {\n\t\tvec3 position;\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tfloat coneCos;\n\t\tfloat penumbraCos;\n\t};\n\tuniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n\tvoid getSpotDirectLightIrradiance( const in SpotLight spotLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tvec3 lVector = spotLight.position - geometry.position;\n\t\tdirectLight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tfloat angleCos = dot( directLight.direction, spotLight.direction );\n\t\tif ( angleCos > spotLight.coneCos ) {\n\t\t\tfloat spotEffect = smoothstep( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n\t\t\tdirectLight.color = spotLight.color;\n\t\t\tdirectLight.color *= spotEffect * punctualLightIntensityToIrradianceFactor( lightDistance, spotLight.distance, spotLight.decay );\n\t\t\tdirectLight.visible = true;\n\t\t} else {\n\t\t\tdirectLight.color = vec3( 0.0 );\n\t\t\tdirectLight.visible = false;\n\t\t}\n\t}\n#endif\n#if NUM_RECT_AREA_LIGHTS > 0\n\tstruct RectAreaLight {\n\t\tvec3 color;\n\t\tvec3 position;\n\t\tvec3 halfWidth;\n\t\tvec3 halfHeight;\n\t};\n\tuniform sampler2D ltc_1;\tuniform sampler2D ltc_2;\n\tuniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\tstruct HemisphereLight {\n\t\tvec3 direction;\n\t\tvec3 skyColor;\n\t\tvec3 groundColor;\n\t};\n\tuniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n\tvec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in GeometricContext geometry ) {\n\t\tfloat dotNL = dot( geometry.normal, hemiLight.direction );\n\t\tfloat hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n\t\tvec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tirradiance *= PI;\n\t\t#endif\n\t\treturn irradiance;\n\t}\n#endif",lights_toon_fragment:"ToonMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;",lights_toon_pars_fragment:"varying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\nstruct ToonMaterial {\n\tvec3 diffuseColor;\n};\nvoid RE_Direct_Toon( const in IncidentLight directLight, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\tvec3 irradiance = getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treflectedLight.directDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_Toon\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Toon\n#define Material_LightProbeLOD( material )\t(0)",lights_phong_fragment:"BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;",lights_phong_pars_fragment:"varying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\nstruct BlinnPhongMaterial {\n\tvec3 diffuseColor;\n\tvec3 specularColor;\n\tfloat specularShininess;\n\tfloat specularStrength;\n};\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treflectedLight.directDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n\treflectedLight.directSpecular += irradiance * BRDF_Specular_BlinnPhong( directLight, geometry, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_BlinnPhong\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_BlinnPhong\n#define Material_LightProbeLOD( material )\t(0)",lights_physical_fragment:"PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nvec3 dxy = max( abs( dFdx( geometryNormal ) ), abs( dFdy( geometryNormal ) ) );\nfloat geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );\nmaterial.specularRoughness = max( roughnessFactor, 0.0525 );material.specularRoughness += geometryRoughness;\nmaterial.specularRoughness = min( material.specularRoughness, 1.0 );\n#ifdef REFLECTIVITY\n\tmaterial.specularColor = mix( vec3( MAXIMUM_SPECULAR_COEFFICIENT * pow2( reflectivity ) ), diffuseColor.rgb, metalnessFactor );\n#else\n\tmaterial.specularColor = mix( vec3( DEFAULT_SPECULAR_COEFFICIENT ), diffuseColor.rgb, metalnessFactor );\n#endif\n#ifdef CLEARCOAT\n\tmaterial.clearcoat = clearcoat;\n\tmaterial.clearcoatRoughness = clearcoatRoughness;\n\t#ifdef USE_CLEARCOATMAP\n\t\tmaterial.clearcoat *= texture2D( clearcoatMap, vUv ).x;\n\t#endif\n\t#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\t\tmaterial.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vUv ).y;\n\t#endif\n\tmaterial.clearcoat = saturate( material.clearcoat );\tmaterial.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );\n\tmaterial.clearcoatRoughness += geometryRoughness;\n\tmaterial.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );\n#endif\n#ifdef USE_SHEEN\n\tmaterial.sheenColor = sheen;\n#endif",lights_physical_pars_fragment:"struct PhysicalMaterial {\n\tvec3 diffuseColor;\n\tfloat specularRoughness;\n\tvec3 specularColor;\n#ifdef CLEARCOAT\n\tfloat clearcoat;\n\tfloat clearcoatRoughness;\n#endif\n#ifdef USE_SHEEN\n\tvec3 sheenColor;\n#endif\n};\n#define MAXIMUM_SPECULAR_COEFFICIENT 0.16\n#define DEFAULT_SPECULAR_COEFFICIENT 0.04\nfloat clearcoatDHRApprox( const in float roughness, const in float dotNL ) {\n\treturn DEFAULT_SPECULAR_COEFFICIENT + ( 1.0 - DEFAULT_SPECULAR_COEFFICIENT ) * ( pow( 1.0 - dotNL, 5.0 ) * pow( 1.0 - roughness, 2.0 ) );\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n\tvoid RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t\tvec3 normal = geometry.normal;\n\t\tvec3 viewDir = geometry.viewDir;\n\t\tvec3 position = geometry.position;\n\t\tvec3 lightPos = rectAreaLight.position;\n\t\tvec3 halfWidth = rectAreaLight.halfWidth;\n\t\tvec3 halfHeight = rectAreaLight.halfHeight;\n\t\tvec3 lightColor = rectAreaLight.color;\n\t\tfloat roughness = material.specularRoughness;\n\t\tvec3 rectCoords[ 4 ];\n\t\trectCoords[ 0 ] = lightPos + halfWidth - halfHeight;\t\trectCoords[ 1 ] = lightPos - halfWidth - halfHeight;\n\t\trectCoords[ 2 ] = lightPos - halfWidth + halfHeight;\n\t\trectCoords[ 3 ] = lightPos + halfWidth + halfHeight;\n\t\tvec2 uv = LTC_Uv( normal, viewDir, roughness );\n\t\tvec4 t1 = texture2D( ltc_1, uv );\n\t\tvec4 t2 = texture2D( ltc_2, uv );\n\t\tmat3 mInv = mat3(\n\t\t\tvec3( t1.x, 0, t1.y ),\n\t\t\tvec3( 0, 1, 0 ),\n\t\t\tvec3( t1.z, 0, t1.w )\n\t\t);\n\t\tvec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );\n\t\treflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n\t\treflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\n\t}\n#endif\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\t#ifdef CLEARCOAT\n\t\tfloat ccDotNL = saturate( dot( geometry.clearcoatNormal, directLight.direction ) );\n\t\tvec3 ccIrradiance = ccDotNL * directLight.color;\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tccIrradiance *= PI;\n\t\t#endif\n\t\tfloat clearcoatDHR = material.clearcoat * clearcoatDHRApprox( material.clearcoatRoughness, ccDotNL );\n\t\treflectedLight.directSpecular += ccIrradiance * material.clearcoat * BRDF_Specular_GGX( directLight, geometry.viewDir, geometry.clearcoatNormal, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearcoatRoughness );\n\t#else\n\t\tfloat clearcoatDHR = 0.0;\n\t#endif\n\t#ifdef USE_SHEEN\n\t\treflectedLight.directSpecular += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Specular_Sheen(\n\t\t\tmaterial.specularRoughness,\n\t\t\tdirectLight.direction,\n\t\t\tgeometry,\n\t\t\tmaterial.sheenColor\n\t\t);\n\t#else\n\t\treflectedLight.directSpecular += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Specular_GGX( directLight, geometry.viewDir, geometry.normal, material.specularColor, material.specularRoughness);\n\t#endif\n\treflectedLight.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 ) {\n\treflectedLight.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) {\n\t#ifdef CLEARCOAT\n\t\tfloat ccDotNV = saturate( dot( geometry.clearcoatNormal, geometry.viewDir ) );\n\t\treflectedLight.indirectSpecular += clearcoatRadiance * material.clearcoat * BRDF_Specular_GGX_Environment( geometry.viewDir, geometry.clearcoatNormal, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearcoatRoughness );\n\t\tfloat ccDotNL = ccDotNV;\n\t\tfloat clearcoatDHR = material.clearcoat * clearcoatDHRApprox( material.clearcoatRoughness, ccDotNL );\n\t#else\n\t\tfloat clearcoatDHR = 0.0;\n\t#endif\n\tfloat clearcoatInv = 1.0 - clearcoatDHR;\n\tvec3 singleScattering = vec3( 0.0 );\n\tvec3 multiScattering = vec3( 0.0 );\n\tvec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n\tBRDF_Specular_Multiscattering_Environment( geometry, material.specularColor, material.specularRoughness, singleScattering, multiScattering );\n\tvec3 diffuse = material.diffuseColor * ( 1.0 - ( singleScattering + multiScattering ) );\n\treflectedLight.indirectSpecular += clearcoatInv * radiance * singleScattering;\n\treflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;\n\treflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;\n}\n#define RE_Direct\t\t\t\tRE_Direct_Physical\n#define RE_Direct_RectArea\t\tRE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular\t\tRE_IndirectSpecular_Physical\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n\treturn saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}",lights_fragment_begin:"\nGeometricContext geometry;\ngeometry.position = - vViewPosition;\ngeometry.normal = normal;\ngeometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\n#ifdef CLEARCOAT\n\tgeometry.clearcoatNormal = clearcoatNormal;\n#endif\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n\tPointLight pointLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tgetPointDirectLightIrradiance( pointLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )\n\t\tpointLightShadow = pointLightShadows[ i ];\n\t\tdirectLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n\tSpotLight spotLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tgetSpotDirectLightIrradiance( spotLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\tspotLightShadow = spotLightShadows[ i ];\n\t\tdirectLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n\tDirectionalLight directionalLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tgetDirectionalDirectLightIrradiance( directionalLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n\t\tdirectionalLightShadow = directionalLightShadows[ i ];\n\t\tdirectLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n\tRectAreaLight rectAreaLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n\t\trectAreaLight = rectAreaLights[ i ];\n\t\tRE_Direct_RectArea( rectAreaLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if defined( RE_IndirectDiffuse )\n\tvec3 iblIrradiance = vec3( 0.0 );\n\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n\tirradiance += getLightProbeIrradiance( lightProbe, geometry );\n\t#if ( NUM_HEMI_LIGHTS > 0 )\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\t\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n#endif\n#if defined( RE_IndirectSpecular )\n\tvec3 radiance = vec3( 0.0 );\n\tvec3 clearcoatRadiance = vec3( 0.0 );\n#endif",lights_fragment_maps:"#if defined( RE_IndirectDiffuse )\n\t#ifdef USE_LIGHTMAP\n\t\tvec4 lightMapTexel= texture2D( lightMap, vUv2 );\n\t\tvec3 lightMapIrradiance = lightMapTexelToLinear( lightMapTexel ).rgb * lightMapIntensity;\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tlightMapIrradiance *= PI;\n\t\t#endif\n\t\tirradiance += lightMapIrradiance;\n\t#endif\n\t#if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )\n\t\tiblIrradiance += getLightProbeIndirectIrradiance( geometry, maxMipLevel );\n\t#endif\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\tradiance += getLightProbeIndirectRadiance( geometry.viewDir, geometry.normal, material.specularRoughness, maxMipLevel );\n\t#ifdef CLEARCOAT\n\t\tclearcoatRadiance += getLightProbeIndirectRadiance( geometry.viewDir, geometry.clearcoatNormal, material.clearcoatRoughness, maxMipLevel );\n\t#endif\n#endif",lights_fragment_end:"#if defined( RE_IndirectDiffuse )\n\tRE_IndirectDiffuse( irradiance, geometry, material, reflectedLight );\n#endif\n#if defined( RE_IndirectSpecular )\n\tRE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometry, material, reflectedLight );\n#endif",logdepthbuf_fragment:"#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\tgl_FragDepthEXT = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\n#endif",logdepthbuf_pars_fragment:"#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\tuniform float logDepthBufFC;\n\tvarying float vFragDepth;\n\tvarying float vIsPerspective;\n#endif",logdepthbuf_pars_vertex:"#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvarying float vFragDepth;\n\t\tvarying float vIsPerspective;\n\t#else\n\t\tuniform float logDepthBufFC;\n\t#endif\n#endif",logdepthbuf_vertex:"#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvFragDepth = 1.0 + gl_Position.w;\n\t\tvIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );\n\t#else\n\t\tif ( isPerspectiveMatrix( projectionMatrix ) ) {\n\t\t\tgl_Position.z = log2( max( EPSILON, gl_Position.w + 1.0 ) ) * logDepthBufFC - 1.0;\n\t\t\tgl_Position.z *= gl_Position.w;\n\t\t}\n\t#endif\n#endif",map_fragment:"#ifdef USE_MAP\n\tvec4 texelColor = texture2D( map, vUv );\n\ttexelColor = mapTexelToLinear( texelColor );\n\tdiffuseColor *= texelColor;\n#endif",map_pars_fragment:"#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif",map_particle_fragment:"#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\tvec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;\n#endif\n#ifdef USE_MAP\n\tvec4 mapTexel = texture2D( map, uv );\n\tdiffuseColor *= mapTexelToLinear( mapTexel );\n#endif\n#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, uv ).g;\n#endif",map_particle_pars_fragment:"#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\tuniform mat3 uvTransform;\n#endif\n#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif\n#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif",metalnessmap_fragment:"float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n\tvec4 texelMetalness = texture2D( metalnessMap, vUv );\n\tmetalnessFactor *= texelMetalness.b;\n#endif",metalnessmap_pars_fragment:"#ifdef USE_METALNESSMAP\n\tuniform sampler2D metalnessMap;\n#endif",morphnormal_vertex:"#ifdef USE_MORPHNORMALS\n\tobjectNormal *= morphTargetBaseInfluence;\n\tobjectNormal += morphNormal0 * morphTargetInfluences[ 0 ];\n\tobjectNormal += morphNormal1 * morphTargetInfluences[ 1 ];\n\tobjectNormal += morphNormal2 * morphTargetInfluences[ 2 ];\n\tobjectNormal += morphNormal3 * morphTargetInfluences[ 3 ];\n#endif",morphtarget_pars_vertex:"#ifdef USE_MORPHTARGETS\n\tuniform float morphTargetBaseInfluence;\n\t#ifndef USE_MORPHNORMALS\n\t\tuniform float morphTargetInfluences[ 8 ];\n\t#else\n\t\tuniform float morphTargetInfluences[ 4 ];\n\t#endif\n#endif",morphtarget_vertex:"#ifdef USE_MORPHTARGETS\n\ttransformed *= morphTargetBaseInfluence;\n\ttransformed += morphTarget0 * morphTargetInfluences[ 0 ];\n\ttransformed += morphTarget1 * morphTargetInfluences[ 1 ];\n\ttransformed += morphTarget2 * morphTargetInfluences[ 2 ];\n\ttransformed += morphTarget3 * morphTargetInfluences[ 3 ];\n\t#ifndef USE_MORPHNORMALS\n\t\ttransformed += morphTarget4 * morphTargetInfluences[ 4 ];\n\t\ttransformed += morphTarget5 * morphTargetInfluences[ 5 ];\n\t\ttransformed += morphTarget6 * morphTargetInfluences[ 6 ];\n\t\ttransformed += morphTarget7 * morphTargetInfluences[ 7 ];\n\t#endif\n#endif",normal_fragment_begin:"float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;\n#ifdef FLAT_SHADED\n\tvec3 fdx = vec3( dFdx( vViewPosition.x ), dFdx( vViewPosition.y ), dFdx( vViewPosition.z ) );\n\tvec3 fdy = vec3( dFdy( vViewPosition.x ), dFdy( vViewPosition.y ), dFdy( vViewPosition.z ) );\n\tvec3 normal = normalize( cross( fdx, fdy ) );\n#else\n\tvec3 normal = normalize( vNormal );\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * faceDirection;\n\t#endif\n\t#ifdef USE_TANGENT\n\t\tvec3 tangent = normalize( vTangent );\n\t\tvec3 bitangent = normalize( vBitangent );\n\t\t#ifdef DOUBLE_SIDED\n\t\t\ttangent = tangent * faceDirection;\n\t\t\tbitangent = bitangent * faceDirection;\n\t\t#endif\n\t\t#if defined( TANGENTSPACE_NORMALMAP ) || defined( USE_CLEARCOAT_NORMALMAP )\n\t\t\tmat3 vTBN = mat3( tangent, bitangent, normal );\n\t\t#endif\n\t#endif\n#endif\nvec3 geometryNormal = normal;",normal_fragment_maps:"#ifdef OBJECTSPACE_NORMALMAP\n\tnormal = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\t#ifdef FLIP_SIDED\n\t\tnormal = - normal;\n\t#endif\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * faceDirection;\n\t#endif\n\tnormal = normalize( normalMatrix * normal );\n#elif defined( TANGENTSPACE_NORMALMAP )\n\tvec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\tmapN.xy *= normalScale;\n\t#ifdef USE_TANGENT\n\t\tnormal = normalize( vTBN * mapN );\n\t#else\n\t\tnormal = perturbNormal2Arb( -vViewPosition, normal, mapN, faceDirection );\n\t#endif\n#elif defined( USE_BUMPMAP )\n\tnormal = perturbNormalArb( -vViewPosition, normal, dHdxy_fwd(), faceDirection );\n#endif",normalmap_pars_fragment:"#ifdef USE_NORMALMAP\n\tuniform sampler2D normalMap;\n\tuniform vec2 normalScale;\n#endif\n#ifdef OBJECTSPACE_NORMALMAP\n\tuniform mat3 normalMatrix;\n#endif\n#if ! defined ( USE_TANGENT ) && ( defined ( TANGENTSPACE_NORMALMAP ) || defined ( USE_CLEARCOAT_NORMALMAP ) )\n\tvec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm, vec3 mapN, float faceDirection ) {\n\t\tvec3 q0 = vec3( dFdx( eye_pos.x ), dFdx( eye_pos.y ), dFdx( eye_pos.z ) );\n\t\tvec3 q1 = vec3( dFdy( eye_pos.x ), dFdy( eye_pos.y ), dFdy( eye_pos.z ) );\n\t\tvec2 st0 = dFdx( vUv.st );\n\t\tvec2 st1 = dFdy( vUv.st );\n\t\tvec3 N = surf_norm;\n\t\tvec3 q1perp = cross( q1, N );\n\t\tvec3 q0perp = cross( N, q0 );\n\t\tvec3 T = q1perp * st0.x + q0perp * st1.x;\n\t\tvec3 B = q1perp * st0.y + q0perp * st1.y;\n\t\tfloat det = max( dot( T, T ), dot( B, B ) );\n\t\tfloat scale = ( det == 0.0 ) ? 0.0 : faceDirection * inversesqrt( det );\n\t\treturn normalize( T * ( mapN.x * scale ) + B * ( mapN.y * scale ) + N * mapN.z );\n\t}\n#endif",clearcoat_normal_fragment_begin:"#ifdef CLEARCOAT\n\tvec3 clearcoatNormal = geometryNormal;\n#endif",clearcoat_normal_fragment_maps:"#ifdef USE_CLEARCOAT_NORMALMAP\n\tvec3 clearcoatMapN = texture2D( clearcoatNormalMap, vUv ).xyz * 2.0 - 1.0;\n\tclearcoatMapN.xy *= clearcoatNormalScale;\n\t#ifdef USE_TANGENT\n\t\tclearcoatNormal = normalize( vTBN * clearcoatMapN );\n\t#else\n\t\tclearcoatNormal = perturbNormal2Arb( - vViewPosition, clearcoatNormal, clearcoatMapN, faceDirection );\n\t#endif\n#endif",clearcoat_pars_fragment:"#ifdef USE_CLEARCOATMAP\n\tuniform sampler2D clearcoatMap;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tuniform sampler2D clearcoatRoughnessMap;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tuniform sampler2D clearcoatNormalMap;\n\tuniform vec2 clearcoatNormalScale;\n#endif",packing:"vec3 packNormalToRGB( const in vec3 normal ) {\n\treturn normalize( normal ) * 0.5 + 0.5;\n}\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\n\treturn 2.0 * rgb.xyz - 1.0;\n}\nconst float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;\nconst vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );\nconst vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. );\nconst float ShiftRight8 = 1. / 256.;\nvec4 packDepthToRGBA( const in float v ) {\n\tvec4 r = vec4( fract( v * PackFactors ), v );\n\tr.yzw -= r.xyz * ShiftRight8;\treturn r * PackUpscale;\n}\nfloat unpackRGBAToDepth( const in vec4 v ) {\n\treturn dot( v, UnpackFactors );\n}\nvec4 pack2HalfToRGBA( vec2 v ) {\n\tvec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ));\n\treturn vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w);\n}\nvec2 unpackRGBATo2Half( vec4 v ) {\n\treturn vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );\n}\nfloat viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( viewZ + near ) / ( near - far );\n}\nfloat orthographicDepthToViewZ( const in float linearClipZ, const in float near, const in float far ) {\n\treturn linearClipZ * ( near - far ) - near;\n}\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn (( near + viewZ ) * far ) / (( far - near ) * viewZ );\n}\nfloat perspectiveDepthToViewZ( const in float invClipZ, const in float near, const in float far ) {\n\treturn ( near * far ) / ( ( far - near ) * invClipZ - far );\n}",premultiplied_alpha_fragment:"#ifdef PREMULTIPLIED_ALPHA\n\tgl_FragColor.rgb *= gl_FragColor.a;\n#endif",project_vertex:"vec4 mvPosition = vec4( transformed, 1.0 );\n#ifdef USE_INSTANCING\n\tmvPosition = instanceMatrix * mvPosition;\n#endif\nmvPosition = modelViewMatrix * mvPosition;\ngl_Position = projectionMatrix * mvPosition;",dithering_fragment:"#ifdef DITHERING\n\tgl_FragColor.rgb = dithering( gl_FragColor.rgb );\n#endif",dithering_pars_fragment:"#ifdef DITHERING\n\tvec3 dithering( vec3 color ) {\n\t\tfloat grid_position = rand( gl_FragCoord.xy );\n\t\tvec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );\n\t\tdither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );\n\t\treturn color + dither_shift_RGB;\n\t}\n#endif",roughnessmap_fragment:"float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n\tvec4 texelRoughness = texture2D( roughnessMap, vUv );\n\troughnessFactor *= texelRoughness.g;\n#endif",roughnessmap_pars_fragment:"#ifdef USE_ROUGHNESSMAP\n\tuniform sampler2D roughnessMap;\n#endif",shadowmap_pars_fragment:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n\tfloat texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n\t\treturn step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\n\t}\n\tvec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {\n\t\treturn unpackRGBATo2Half( texture2D( shadow, uv ) );\n\t}\n\tfloat VSMShadow (sampler2D shadow, vec2 uv, float compare ){\n\t\tfloat occlusion = 1.0;\n\t\tvec2 distribution = texture2DDistribution( shadow, uv );\n\t\tfloat hard_shadow = step( compare , distribution.x );\n\t\tif (hard_shadow != 1.0 ) {\n\t\t\tfloat distance = compare - distribution.x ;\n\t\t\tfloat variance = max( 0.00000, distribution.y * distribution.y );\n\t\t\tfloat softness_probability = variance / (variance + distance * distance );\t\t\tsoftness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 );\t\t\tocclusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 );\n\t\t}\n\t\treturn occlusion;\n\t}\n\tfloat getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\t\tfloat shadow = 1.0;\n\t\tshadowCoord.xyz /= shadowCoord.w;\n\t\tshadowCoord.z += shadowBias;\n\t\tbvec4 inFrustumVec = bvec4 ( shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0 );\n\t\tbool inFrustum = all( inFrustumVec );\n\t\tbvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 );\n\t\tbool frustumTest = all( frustumTestVec );\n\t\tif ( frustumTest ) {\n\t\t#if defined( SHADOWMAP_TYPE_PCF )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx0 = - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 = - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 = + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 = + texelSize.y * shadowRadius;\n\t\t\tfloat dx2 = dx0 / 2.0;\n\t\t\tfloat dy2 = dy0 / 2.0;\n\t\t\tfloat dx3 = dx1 / 2.0;\n\t\t\tfloat dy3 = dy1 / 2.0;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 17.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx = texelSize.x;\n\t\t\tfloat dy = texelSize.y;\n\t\t\tvec2 uv = shadowCoord.xy;\n\t\t\tvec2 f = fract( uv * shadowMapSize + 0.5 );\n\t\t\tuv -= f * texelSize;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, uv, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ), \n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ), \n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ), \n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ), \n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ), \n\t\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t\t f.x ),\n\t\t\t\t\t mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ), \n\t\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t\t f.x ),\n\t\t\t\t\t f.y )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_VSM )\n\t\t\tshadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#else\n\t\t\tshadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#endif\n\t\t}\n\t\treturn shadow;\n\t}\n\tvec2 cubeToUV( vec3 v, float texelSizeY ) {\n\t\tvec3 absV = abs( v );\n\t\tfloat scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );\n\t\tabsV *= scaleToCube;\n\t\tv *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );\n\t\tvec2 planar = v.xy;\n\t\tfloat almostATexel = 1.5 * texelSizeY;\n\t\tfloat almostOne = 1.0 - almostATexel;\n\t\tif ( absV.z >= almostOne ) {\n\t\t\tif ( v.z > 0.0 )\n\t\t\t\tplanar.x = 4.0 - v.x;\n\t\t} else if ( absV.x >= almostOne ) {\n\t\t\tfloat signX = sign( v.x );\n\t\t\tplanar.x = v.z * signX + 2.0 * signX;\n\t\t} else if ( absV.y >= almostOne ) {\n\t\t\tfloat signY = sign( v.y );\n\t\t\tplanar.x = v.x + 2.0 * signY + 2.0;\n\t\t\tplanar.y = v.z * signY - 2.0;\n\t\t}\n\t\treturn vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );\n\t}\n\tfloat getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n\t\tvec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\n\t\tvec3 lightToPosition = shadowCoord.xyz;\n\t\tfloat dp = ( length( lightToPosition ) - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear );\t\tdp += shadowBias;\n\t\tvec3 bd3D = normalize( lightToPosition );\n\t\t#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )\n\t\t\tvec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;\n\t\t\treturn (\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#else\n\t\t\treturn texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\n\t\t#endif\n\t}\n#endif",shadowmap_pars_vertex:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tuniform mat4 spotShadowMatrix[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n#endif",shadowmap_vertex:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0 || NUM_SPOT_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0\n\t\tvec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\t\tvec4 shadowWorldPosition;\n\t#endif\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );\n\t\tvDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias, 0 );\n\t\tvSpotShadowCoord[ i ] = spotShadowMatrix[ i ] * shadowWorldPosition;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );\n\t\tvPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n#endif",shadowmask_pars_fragment:"float getShadowMask() {\n\tfloat shadow = 1.0;\n\t#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\tdirectionalLight = directionalLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n\t\tspotLight = spotLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\tpointLight = pointLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#endif\n\treturn shadow;\n}",skinbase_vertex:"#ifdef USE_SKINNING\n\tmat4 boneMatX = getBoneMatrix( skinIndex.x );\n\tmat4 boneMatY = getBoneMatrix( skinIndex.y );\n\tmat4 boneMatZ = getBoneMatrix( skinIndex.z );\n\tmat4 boneMatW = getBoneMatrix( skinIndex.w );\n#endif",skinning_pars_vertex:"#ifdef USE_SKINNING\n\tuniform mat4 bindMatrix;\n\tuniform mat4 bindMatrixInverse;\n\t#ifdef BONE_TEXTURE\n\t\tuniform highp sampler2D boneTexture;\n\t\tuniform int boneTextureSize;\n\t\tmat4 getBoneMatrix( const in float i ) {\n\t\t\tfloat j = i * 4.0;\n\t\t\tfloat x = mod( j, float( boneTextureSize ) );\n\t\t\tfloat y = floor( j / float( boneTextureSize ) );\n\t\t\tfloat dx = 1.0 / float( boneTextureSize );\n\t\t\tfloat dy = 1.0 / float( boneTextureSize );\n\t\t\ty = dy * ( y + 0.5 );\n\t\t\tvec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );\n\t\t\tvec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );\n\t\t\tvec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );\n\t\t\tvec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );\n\t\t\tmat4 bone = mat4( v1, v2, v3, v4 );\n\t\t\treturn bone;\n\t\t}\n\t#else\n\t\tuniform mat4 boneMatrices[ MAX_BONES ];\n\t\tmat4 getBoneMatrix( const in float i ) {\n\t\t\tmat4 bone = boneMatrices[ int(i) ];\n\t\t\treturn bone;\n\t\t}\n\t#endif\n#endif",skinning_vertex:"#ifdef USE_SKINNING\n\tvec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\n\tvec4 skinned = vec4( 0.0 );\n\tskinned += boneMatX * skinVertex * skinWeight.x;\n\tskinned += boneMatY * skinVertex * skinWeight.y;\n\tskinned += boneMatZ * skinVertex * skinWeight.z;\n\tskinned += boneMatW * skinVertex * skinWeight.w;\n\ttransformed = ( bindMatrixInverse * skinned ).xyz;\n#endif",skinnormal_vertex:"#ifdef USE_SKINNING\n\tmat4 skinMatrix = mat4( 0.0 );\n\tskinMatrix += skinWeight.x * boneMatX;\n\tskinMatrix += skinWeight.y * boneMatY;\n\tskinMatrix += skinWeight.z * boneMatZ;\n\tskinMatrix += skinWeight.w * boneMatW;\n\tskinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;\n\tobjectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n\t#ifdef USE_TANGENT\n\t\tobjectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n\t#endif\n#endif",specularmap_fragment:"float specularStrength;\n#ifdef USE_SPECULARMAP\n\tvec4 texelSpecular = texture2D( specularMap, vUv );\n\tspecularStrength = texelSpecular.r;\n#else\n\tspecularStrength = 1.0;\n#endif",specularmap_pars_fragment:"#ifdef USE_SPECULARMAP\n\tuniform sampler2D specularMap;\n#endif",tonemapping_fragment:"#if defined( TONE_MAPPING )\n\tgl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif",tonemapping_pars_fragment:"#ifndef saturate\n#define saturate(a) clamp( a, 0.0, 1.0 )\n#endif\nuniform float toneMappingExposure;\nvec3 LinearToneMapping( vec3 color ) {\n\treturn toneMappingExposure * color;\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( color / ( vec3( 1.0 ) + color ) );\n}\nvec3 OptimizedCineonToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\tcolor = max( vec3( 0.0 ), color - 0.004 );\n\treturn pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\nvec3 RRTAndODTFit( vec3 v ) {\n\tvec3 a = v * ( v + 0.0245786 ) - 0.000090537;\n\tvec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;\n\treturn a / b;\n}\nvec3 ACESFilmicToneMapping( vec3 color ) {\n\tconst mat3 ACESInputMat = mat3(\n\t\tvec3( 0.59719, 0.07600, 0.02840 ),\t\tvec3( 0.35458, 0.90834, 0.13383 ),\n\t\tvec3( 0.04823, 0.01566, 0.83777 )\n\t);\n\tconst mat3 ACESOutputMat = mat3(\n\t\tvec3( 1.60475, -0.10208, -0.00327 ),\t\tvec3( -0.53108, 1.10813, -0.07276 ),\n\t\tvec3( -0.07367, -0.00605, 1.07602 )\n\t);\n\tcolor *= toneMappingExposure / 0.6;\n\tcolor = ACESInputMat * color;\n\tcolor = RRTAndODTFit( color );\n\tcolor = ACESOutputMat * color;\n\treturn saturate( color );\n}\nvec3 CustomToneMapping( vec3 color ) { return color; }",transmission_fragment:"#ifdef USE_TRANSMISSION\n\tfloat transmissionFactor = transmission;\n\tfloat thicknessFactor = thickness;\n\t#ifdef USE_TRANSMISSIONMAP\n\t\ttransmissionFactor *= texture2D( transmissionMap, vUv ).r;\n\t#endif\n\t#ifdef USE_THICKNESSNMAP\n\t\tthicknessFactor *= texture2D( thicknessMap, vUv ).g;\n\t#endif\n\tvec3 pos = vWorldPosition.xyz / vWorldPosition.w;\n\tvec3 v = normalize( cameraPosition - pos );\n\tfloat ior = ( 1.0 + 0.4 * reflectivity ) / ( 1.0 - 0.4 * reflectivity );\n\tvec3 transmission = transmissionFactor * getIBLVolumeRefraction(\n\t\tnormal, v, roughnessFactor, material.diffuseColor, totalSpecular,\n\t\tpos, modelMatrix, viewMatrix, projectionMatrix, ior, thicknessFactor,\n\t\tattenuationColor, attenuationDistance );\n\ttotalDiffuse = mix( totalDiffuse, transmission, transmissionFactor );\n#endif",transmission_pars_fragment:"#ifdef USE_TRANSMISSION\n\t#ifdef USE_TRANSMISSIONMAP\n\t\tuniform sampler2D transmissionMap;\n\t#endif\n\t#ifdef USE_THICKNESSMAP\n\t\tuniform sampler2D thicknessMap;\n\t#endif\n\tuniform vec2 transmissionSamplerSize;\n\tuniform sampler2D transmissionSamplerMap;\n\tuniform mat4 modelMatrix;\n\tuniform mat4 projectionMatrix;\n\tvarying vec4 vWorldPosition;\n\tvec3 getVolumeTransmissionRay(vec3 n, vec3 v, float thickness, float ior, mat4 modelMatrix) {\n\t\tvec3 refractionVector = refract(-v, normalize(n), 1.0 / ior);\n\t\tvec3 modelScale;\n\t\tmodelScale.x = length(vec3(modelMatrix[0].xyz));\n\t\tmodelScale.y = length(vec3(modelMatrix[1].xyz));\n\t\tmodelScale.z = length(vec3(modelMatrix[2].xyz));\n\t\treturn normalize(refractionVector) * thickness * modelScale;\n\t}\n\tfloat applyIorToRoughness(float roughness, float ior) {\n\t\treturn roughness * clamp(ior * 2.0 - 2.0, 0.0, 1.0);\n\t}\n\tvec3 getTransmissionSample(vec2 fragCoord, float roughness, float ior) {\n\t\tfloat framebufferLod = log2(transmissionSamplerSize.x) * applyIorToRoughness(roughness, ior);\n\t\treturn texture2DLodEXT(transmissionSamplerMap, fragCoord.xy, framebufferLod).rgb;\n\t}\n\tvec3 applyVolumeAttenuation(vec3 radiance, float transmissionDistance, vec3 attenuationColor, float attenuationDistance) {\n\t\tif (attenuationDistance == 0.0) {\n\t\t\treturn radiance;\n\t\t} else {\n\t\t\tvec3 attenuationCoefficient = -log(attenuationColor) / attenuationDistance;\n\t\t\tvec3 transmittance = exp(-attenuationCoefficient * transmissionDistance);\t\t\treturn transmittance * radiance;\n\t\t}\n\t}\n\tvec3 getIBLVolumeRefraction(vec3 n, vec3 v, float perceptualRoughness, vec3 baseColor, vec3 specularColor,\n\t\tvec3 position, mat4 modelMatrix, mat4 viewMatrix, mat4 projMatrix, float ior, float thickness,\n\t\tvec3 attenuationColor, float attenuationDistance) {\n\t\tvec3 transmissionRay = getVolumeTransmissionRay(n, v, thickness, ior, modelMatrix);\n\t\tvec3 refractedRayExit = position + transmissionRay;\n\t\tvec4 ndcPos = projMatrix * viewMatrix * vec4(refractedRayExit, 1.0);\n\t\tvec2 refractionCoords = ndcPos.xy / ndcPos.w;\n\t\trefractionCoords += 1.0;\n\t\trefractionCoords /= 2.0;\n\t\tvec3 transmittedLight = getTransmissionSample(refractionCoords, perceptualRoughness, ior);\n\t\tvec3 attenuatedColor = applyVolumeAttenuation(transmittedLight, length(transmissionRay), attenuationColor, attenuationDistance);\n\t\treturn (1.0 - specularColor) * attenuatedColor * baseColor;\n\t}\n#endif",uv_pars_fragment:"#if ( defined( USE_UV ) && ! defined( UVS_VERTEX_ONLY ) )\n\tvarying vec2 vUv;\n#endif",uv_pars_vertex:"#ifdef USE_UV\n\t#ifdef UVS_VERTEX_ONLY\n\t\tvec2 vUv;\n\t#else\n\t\tvarying vec2 vUv;\n\t#endif\n\tuniform mat3 uvTransform;\n#endif",uv_vertex:"#ifdef USE_UV\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n#endif",uv2_pars_fragment:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvarying vec2 vUv2;\n#endif",uv2_pars_vertex:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tattribute vec2 uv2;\n\tvarying vec2 vUv2;\n\tuniform mat3 uv2Transform;\n#endif",uv2_vertex:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvUv2 = ( uv2Transform * vec3( uv2, 1 ) ).xy;\n#endif",worldpos_vertex:"#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION )\n\tvec4 worldPosition = vec4( transformed, 1.0 );\n\t#ifdef USE_INSTANCING\n\t\tworldPosition = instanceMatrix * worldPosition;\n\t#endif\n\tworldPosition = modelMatrix * worldPosition;\n#endif",background_frag:"uniform sampler2D t2D;\nvarying vec2 vUv;\nvoid main() {\n\tvec4 texColor = texture2D( t2D, vUv );\n\tgl_FragColor = mapTexelToLinear( texColor );\n\t#include \n\t#include \n}",background_vert:"varying vec2 vUv;\nuniform mat3 uvTransform;\nvoid main() {\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n\tgl_Position = vec4( position.xy, 1.0, 1.0 );\n}",cube_frag:"#include \nuniform float opacity;\nvarying vec3 vWorldDirection;\n#include \nvoid main() {\n\tvec3 vReflect = vWorldDirection;\n\t#include \n\tgl_FragColor = envColor;\n\tgl_FragColor.a *= opacity;\n\t#include \n\t#include \n}",cube_vert:"varying vec3 vWorldDirection;\n#include \nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include \n\t#include \n\tgl_Position.z = gl_Position.w;\n}",depth_frag:"#if DEPTH_PACKING == 3200\n\tuniform float opacity;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( 1.0 );\n\t#if DEPTH_PACKING == 3200\n\t\tdiffuseColor.a = opacity;\n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\tfloat fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;\n\t#if DEPTH_PACKING == 3200\n\t\tgl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );\n\t#elif DEPTH_PACKING == 3201\n\t\tgl_FragColor = packDepthToRGBA( fragCoordZ );\n\t#endif\n}",depth_vert:"#include \n#include \n#include \n#include \n#include \n#include \n#include \nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\t#include \n\t#include \n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include \n\t\t#include \n\t\t#include \n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvHighPrecisionZW = gl_Position.zw;\n}",distanceRGBA_frag:"#define DISTANCE\nuniform vec3 referencePosition;\nuniform float nearDistance;\nuniform float farDistance;\nvarying vec3 vWorldPosition;\n#include \n#include \n#include \n#include \n#include \n#include \nvoid main () {\n\t#include \n\tvec4 diffuseColor = vec4( 1.0 );\n\t#include \n\t#include \n\t#include \n\tfloat dist = length( vWorldPosition - referencePosition );\n\tdist = ( dist - nearDistance ) / ( farDistance - nearDistance );\n\tdist = saturate( dist );\n\tgl_FragColor = packDepthToRGBA( dist );\n}",distanceRGBA_vert:"#define DISTANCE\nvarying vec3 vWorldPosition;\n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include \n\t\t#include \n\t\t#include \n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvWorldPosition = worldPosition.xyz;\n}",equirect_frag:"uniform sampler2D tEquirect;\nvarying vec3 vWorldDirection;\n#include \nvoid main() {\n\tvec3 direction = normalize( vWorldDirection );\n\tvec2 sampleUV = equirectUv( direction );\n\tvec4 texColor = texture2D( tEquirect, sampleUV );\n\tgl_FragColor = mapTexelToLinear( texColor );\n\t#include \n\t#include \n}",equirect_vert:"varying vec3 vWorldDirection;\n#include \nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include \n\t#include \n}",linedashed_frag:"uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;\n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tif ( mod( vLineDistance, totalSize ) > dashSize ) {\n\t\tdiscard;\n\t}\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\toutgoingLight = diffuseColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n}",linedashed_vert:"uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tvLineDistance = scale * lineDistance;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshbasic_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\t#ifdef USE_LIGHTMAP\n\t\n\t\tvec4 lightMapTexel= texture2D( lightMap, vUv2 );\n\t\treflectedLight.indirectDiffuse += lightMapTexelToLinear( lightMapTexel ).rgb * lightMapIntensity;\n\t#else\n\t\treflectedLight.indirectDiffuse += vec3( 1.0 );\n\t#endif\n\t#include \n\treflectedLight.indirectDiffuse *= diffuseColor.rgb;\n\tvec3 outgoingLight = reflectedLight.indirectDiffuse;\n\t#include \n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshbasic_vert:"#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#ifdef USE_ENVMAP\n\t#include \n\t#include \n\t#include \n\t#include \n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshlambert_frag:"uniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\nvarying vec3 vLightFront;\nvarying vec3 vIndirectFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n\tvarying vec3 vIndirectBack;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#ifdef DOUBLE_SIDED\n\t\treflectedLight.indirectDiffuse += ( gl_FrontFacing ) ? vIndirectFront : vIndirectBack;\n\t#else\n\t\treflectedLight.indirectDiffuse += vIndirectFront;\n\t#endif\n\t#include \n\treflectedLight.indirectDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb );\n\t#ifdef DOUBLE_SIDED\n\t\treflectedLight.directDiffuse = ( gl_FrontFacing ) ? vLightFront : vLightBack;\n\t#else\n\t\treflectedLight.directDiffuse = vLightFront;\n\t#endif\n\treflectedLight.directDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb ) * getShadowMask();\n\t#include \n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include \n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshlambert_vert:"#define LAMBERT\nvarying vec3 vLightFront;\nvarying vec3 vIndirectFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n\tvarying vec3 vIndirectBack;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshmatcap_frag:"#define MATCAP\nuniform vec3 diffuse;\nuniform float opacity;\nuniform sampler2D matcap;\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 viewDir = normalize( vViewPosition );\n\tvec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );\n\tvec3 y = cross( viewDir, x );\n\tvec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;\n\t#ifdef USE_MATCAP\n\t\tvec4 matcapColor = texture2D( matcap, uv );\n\t\tmatcapColor = matcapTexelToLinear( matcapColor );\n\t#else\n\t\tvec4 matcapColor = vec4( 1.0 );\n\t#endif\n\tvec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshmatcap_vert:"#define MATCAP\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#ifndef FLAT_SHADED\n\t\tvNormal = normalize( transformedNormal );\n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n}",meshtoon_frag:"#define TOON\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshtoon_vert:"#define TOON\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n\t#include \n\t#include \n\t#include \n}",meshphong_frag:"#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\t#include \n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshphong_vert:"#define PHONG\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n\t#include \n\t#include \n\t#include \n\t#include \n}",meshphysical_frag:"#define STANDARD\n#ifdef PHYSICAL\n\t#define REFLECTIVITY\n\t#define CLEARCOAT\n#endif\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifdef USE_TRANSMISSION\n\tuniform float transmission;\n\tuniform float thickness;\n\tuniform vec3 attenuationColor;\n\tuniform float attenuationDistance;\n#endif\n#ifdef REFLECTIVITY\n\tuniform float reflectivity;\n#endif\n#ifdef CLEARCOAT\n\tuniform float clearcoat;\n\tuniform float clearcoatRoughness;\n#endif\n#ifdef USE_SHEEN\n\tuniform vec3 sheen;\n#endif\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;\n\tvec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;\n\t#include \n\tvec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshphysical_vert:"#define STANDARD\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif\n#ifdef USE_TRANSMISSION\n\tvarying vec4 vWorldPosition;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n\t#ifdef USE_TANGENT\n\t\tvTangent = normalize( transformedTangent );\n\t\tvBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\n\t#endif\n#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n\t#include \n\t#include \n\t#include \n#ifdef USE_TRANSMISSION\n\tvWorldPosition = worldPosition;\n#endif\n}",normal_frag:"#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\tgl_FragColor = vec4( packNormalToRGB( normal ), opacity );\n}",normal_vert:"#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n\t#ifdef USE_TANGENT\n\t\tvTangent = normalize( transformedTangent );\n\t\tvBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\n\t#endif\n#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n}",points_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\t#include \n\t#include \n\toutgoingLight = diffuseColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n}",points_vert:"uniform float size;\nuniform float scale;\n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\tgl_PointSize = size;\n\t#ifdef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );\n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n}",shadow_frag:"uniform vec3 color;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tgl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );\n\t#include \n\t#include \n\t#include \n}",shadow_vert:"#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",sprite_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\t#include \n\t#include \n\toutgoingLight = diffuseColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n}",sprite_vert:"uniform float rotation;\nuniform vec2 center;\n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\n\tvec2 scale;\n\tscale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) );\n\tscale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) );\n\t#ifndef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) scale *= - mvPosition.z;\n\t#endif\n\tvec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;\n\tvec2 rotatedPosition;\n\trotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\n\trotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\n\tmvPosition.xy += rotatedPosition;\n\tgl_Position = projectionMatrix * mvPosition;\n\t#include \n\t#include \n\t#include \n}"},Za={common:{diffuse:{value:new On(16777215)},opacity:{value:1},map:{value:null},uvTransform:{value:new ei},uv2Transform:{value:new ei},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 $r(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 On(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotShadowMap:{value:[]},spotShadowMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new On(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},uvTransform:{value:new ei}},sprite:{diffuse:{value:new On(16777215)},opacity:{value:1},center:{value:new $r(.5,.5)},rotation:{value:0},map:{value:null},alphaMap:{value:null},uvTransform:{value:new ei}}},qa={basic:{uniforms:Ea([Za.common,Za.specularmap,Za.envmap,Za.aomap,Za.lightmap,Za.fog]),vertexShader:Wa.meshbasic_vert,fragmentShader:Wa.meshbasic_frag},lambert:{uniforms:Ea([Za.common,Za.specularmap,Za.envmap,Za.aomap,Za.lightmap,Za.emissivemap,Za.fog,Za.lights,{emissive:{value:new On(0)}}]),vertexShader:Wa.meshlambert_vert,fragmentShader:Wa.meshlambert_frag},phong:{uniforms:Ea([Za.common,Za.specularmap,Za.envmap,Za.aomap,Za.lightmap,Za.emissivemap,Za.bumpmap,Za.normalmap,Za.displacementmap,Za.fog,Za.lights,{emissive:{value:new On(0)},specular:{value:new On(1118481)},shininess:{value:30}}]),vertexShader:Wa.meshphong_vert,fragmentShader:Wa.meshphong_frag},standard:{uniforms:Ea([Za.common,Za.envmap,Za.aomap,Za.lightmap,Za.emissivemap,Za.bumpmap,Za.normalmap,Za.displacementmap,Za.roughnessmap,Za.metalnessmap,Za.fog,Za.lights,{emissive:{value:new On(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Wa.meshphysical_vert,fragmentShader:Wa.meshphysical_frag},toon:{uniforms:Ea([Za.common,Za.aomap,Za.lightmap,Za.emissivemap,Za.bumpmap,Za.normalmap,Za.displacementmap,Za.gradientmap,Za.fog,Za.lights,{emissive:{value:new On(0)}}]),vertexShader:Wa.meshtoon_vert,fragmentShader:Wa.meshtoon_frag},matcap:{uniforms:Ea([Za.common,Za.bumpmap,Za.normalmap,Za.displacementmap,Za.fog,{matcap:{value:null}}]),vertexShader:Wa.meshmatcap_vert,fragmentShader:Wa.meshmatcap_frag},points:{uniforms:Ea([Za.points,Za.fog]),vertexShader:Wa.points_vert,fragmentShader:Wa.points_frag},dashed:{uniforms:Ea([Za.common,Za.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Wa.linedashed_vert,fragmentShader:Wa.linedashed_frag},depth:{uniforms:Ea([Za.common,Za.displacementmap]),vertexShader:Wa.depth_vert,fragmentShader:Wa.depth_frag},normal:{uniforms:Ea([Za.common,Za.bumpmap,Za.normalmap,Za.displacementmap,{opacity:{value:1}}]),vertexShader:Wa.normal_vert,fragmentShader:Wa.normal_frag},sprite:{uniforms:Ea([Za.sprite,Za.fog]),vertexShader:Wa.sprite_vert,fragmentShader:Wa.sprite_frag},background:{uniforms:{uvTransform:{value:new ei},t2D:{value:null}},vertexShader:Wa.background_vert,fragmentShader:Wa.background_frag},cube:{uniforms:Ea([Za.envmap,{opacity:{value:1}}]),vertexShader:Wa.cube_vert,fragmentShader:Wa.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Wa.equirect_vert,fragmentShader:Wa.equirect_frag},distanceRGBA:{uniforms:Ea([Za.common,Za.displacementmap,{referencePosition:{value:new ci},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Wa.distanceRGBA_vert,fragmentShader:Wa.distanceRGBA_frag},shadow:{uniforms:Ea([Za.lights,Za.fog,{color:{value:new On(0)},opacity:{value:1}}]),vertexShader:Wa.shadow_vert,fragmentShader:Wa.shadow_frag}};function Xa(e,t,r,i,n){function a(e,t){r.buffers.color.setClear(e.r,e.g,e.b,t,n)}var s,o,l=new On(0),h=0,c=null,u=0,d=null;return{getClearColor:function(){return l},setClearColor:function(e){var t=1n;n++)i[n]=[n,0];return{update:function(n,a,s,o){var l=n.morphTargetInfluences,h=void 0===l?0:l.length,c=t[a.id];if(void 0===c||c.length!==h){c=[];for(var u=0;um;m++)my;y++){var x=i[y],b=x[0],w=x[1];b!==Number.MAX_SAFE_INTEGER&&w?(f&&a.getAttribute("morphTarget"+y)!==f[b]&&a.setAttribute("morphTarget"+y,f[b]),v&&a.getAttribute("morphNormal"+y)!==v[b]&&a.setAttribute("morphNormal"+y,v[b]),r[y]=w,g+=w):(f&&!0===a.hasAttribute("morphTarget"+y)&&a.deleteAttribute("morphTarget"+y),v&&!0===a.hasAttribute("morphNormal"+y)&&a.deleteAttribute("morphNormal"+y),r[y]=0)}var _=a.morphTargetsRelative?1:1-g;o.getUniforms().setValue(e,"morphTargetBaseInfluence",_),o.getUniforms().setValue(e,"morphTargetInfluences",r)}}}function os(e,t,r,i){function n(e){var t=e.target;t.removeEventListener("dispose",n),r.remove(t.instanceMatrix),null!==t.instanceColor&&r.remove(t.instanceColor)}var a=new WeakMap;return{update:function(e){var s=i.render.frame,o=e.geometry,l=t.get(e,o);return a.get(l)!==s&&(t.update(l),a.set(l,s)),e.isInstancedMesh&&(!1===e.hasEventListener("dispose",n)&&e.addEventListener("dispose",n),r.update(e.instanceMatrix,34962),null!==e.instanceColor&&r.update(e.instanceColor,34962)),l},dispose:function(){a=new WeakMap}}}qa.physical={uniforms:Ea([qa.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatNormalScale:{value:new $r(1,1)},clearcoatNormalMap:{value:null},sheen:{value:new On(0)},transmission:{value:0},transmissionMap:{value:null},transmissionSamplerSize:{value:new $r},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},attenuationDistance:{value:0},attenuationColor:{value:new On(0)}}]),vertexShader:Wa.meshphysical_vert,fragmentShader:Wa.meshphysical_frag};class ls extends ii{constructor(){var e=0=i||0/gm;function Mo(e){return e.replace(_o,So)}function So(e,t){var r=Wa[t];if(void 0===r)throw new Error("Can not resolve #include <"+t+">");return Mo(r)}var To=/#pragma unroll_loop[\s]+?for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}/g,Eo=/#pragma unroll_loop_start\s+for\s*\(\s*int\s+i\s*=\s*(\d+)\s*;\s*i\s*<\s*(\d+)\s*;\s*i\s*\+\+\s*\)\s*{([\s\S]+?)}\s+#pragma unroll_loop_end/g;function Ao(e){return e.replace(Eo,Ro).replace(To,Lo)}function Lo(e,t,r,i){return console.warn("WebGLProgram: #pragma unroll_loop shader syntax is deprecated. Please use #pragma unroll_loop_start syntax instead."),Ro(0,t,r,i)}function Ro(e,t,r,i){for(var n="",a=parseInt(t);a=t.get(r).length?(n=new Bo(e),t.get(r).push(n)):n=t.get(r)[i],n},dispose:function(){t=new WeakMap}}}function zo(){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 ci,color:new On};break;case"SpotLight":r={position:new ci,direction:new ci,color:new On,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":r={position:new ci,color:new On,distance:0,decay:0};break;case"HemisphereLight":r={direction:new ci,skyColor:new On,groundColor:new On};break;case"RectAreaLight":r={color:new On,position:new ci,halfWidth:new ci,halfHeight:new ci}}return e[t.id]=r,r}}}var Fo=0;function Go(e,t){return(t.castShadow?1:0)-(e.castShadow?1:0)}function Vo(e,t){for(var r=new zo,i=function(){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,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new $r};break;case"PointLight":r={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new $r,shadowCameraNear:1,shadowCameraFar:1e3}}return e[t.id]=r,r}}}(),n={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:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[]},a=0;9>a;a++)n.probe.push(new ci);var s=new ci,o=new Vi,l=new Vi;return{setup:function(a){for(var s=0,o=0,l=0,h=0;9>h;h++)n.probe[h].set(0,0,0);var c=0,u=0,d=0,p=0,m=0,f=0,v=0,g=0;a.sort(Go);for(var y=0,x=a.length;yT;T++)n.probe[T].addScaledVector(b.sh.coefficients[T],_);else if(b.isDirectionalLight){var E=r.get(b);if(E.color.copy(b.color).multiplyScalar(b.intensity),b.castShadow){var A=b.shadow,L=i.get(b);L.shadowBias=A.bias,L.shadowNormalBias=A.normalBias,L.shadowRadius=A.radius,L.shadowMapSize=A.mapSize,n.directionalShadow[c]=L,n.directionalShadowMap[c]=S,n.directionalShadowMatrix[c]=b.shadow.matrix,f++}n.directional[c]=E,c++}else if(b.isSpotLight){var R=r.get(b);if(R.position.setFromMatrixPosition(b.matrixWorld),R.color.copy(w).multiplyScalar(_),R.distance=M,R.coneCos=Math.cos(b.angle),R.penumbraCos=Math.cos(b.angle*(1-b.penumbra)),R.decay=b.decay,b.castShadow){var C=b.shadow,P=i.get(b);P.shadowBias=C.bias,P.shadowNormalBias=C.normalBias,P.shadowRadius=C.radius,P.shadowMapSize=C.mapSize,n.spotShadow[d]=P,n.spotShadowMap[d]=S,n.spotShadowMatrix[d]=b.shadow.matrix,g++}n.spot[d]=R,d++}else if(b.isRectAreaLight){var I=r.get(b);I.color.copy(w).multiplyScalar(_),I.halfWidth.set(.5*b.width,0,0),I.halfHeight.set(0,.5*b.height,0),n.rectArea[p]=I,p++}else if(b.isPointLight){var O=r.get(b);if(O.color.copy(b.color).multiplyScalar(b.intensity),O.distance=b.distance,O.decay=b.decay,b.castShadow){var D=b.shadow,N=i.get(b);N.shadowBias=D.bias,N.shadowNormalBias=D.normalBias,N.shadowRadius=D.radius,N.shadowMapSize=D.mapSize,N.shadowCameraNear=D.camera.near,N.shadowCameraFar=D.camera.far,n.pointShadow[u]=N,n.pointShadowMap[u]=S,n.pointShadowMatrix[u]=b.shadow.matrix,v++}n.point[u]=O,u++}else if(b.isHemisphereLight){var B=r.get(b);B.skyColor.copy(b.color).multiplyScalar(_),B.groundColor.copy(b.groundColor).multiplyScalar(_),n.hemi[m]=B,m++}}0=r.get(i).length?(n=new Ho(e,t),r.get(i).push(n)):n=r.get(i)[a],n},dispose:function(){r=new WeakMap}}}class jo extends En{constructor(e){super(),this.type="MeshDepthMaterial",this.depthPacking=or,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)}copy(e){return super.copy(e),this.depthPacking=e.depthPacking,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}}jo.prototype.isMeshDepthMaterial=!0;class Wo extends En{constructor(e){super(),this.type="MeshDistanceMaterial",this.referencePosition=new ci,this.nearDistance=1,this.farDistance=1e3,this.morphTargets=!1,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.fog=!1,this.setValues(e)}copy(e){return super.copy(e),this.referencePosition.copy(e.referencePosition),this.nearDistance=e.nearDistance,this.farDistance=e.farDistance,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}}Wo.prototype.isMeshDistanceMaterial=!0;var Zo="uniform sampler2D shadow_pass;\nuniform vec2 resolution;\nuniform float radius;\n#include \nvoid main() {\n\tfloat mean = 0.0;\n\tfloat squared_mean = 0.0;\n\tfloat depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy ) / resolution ) );\n\tfor ( float i = -1.0; i < 1.0 ; i += SAMPLE_RATE) {\n\t\t#ifdef HORIZONTAL_PASS\n\t\t\tvec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( i, 0.0 ) * radius ) / resolution ) );\n\t\t\tmean += distribution.x;\n\t\t\tsquared_mean += distribution.y * distribution.y + distribution.x * distribution.x;\n\t\t#else\n\t\t\tfloat depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, i ) * radius ) / resolution ) );\n\t\t\tmean += depth;\n\t\t\tsquared_mean += depth * depth;\n\t\t#endif\n\t}\n\tmean = mean * HALF_SAMPLE_RATE;\n\tsquared_mean = squared_mean * HALF_SAMPLE_RATE;\n\tfloat std_dev = sqrt( squared_mean - mean * mean );\n\tgl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );\n}",qo="void main() {\n\tgl_Position = vec4( position, 1.0 );\n}";function Xo(e,t,r){function i(r,i){var n=t.update(E);M.uniforms.shadow_pass.value=r.map.texture,M.uniforms.resolution.value=r.mapSize,M.uniforms.radius.value=r.radius,e.setRenderTarget(r.mapPass),e.clear(),e.renderBufferDirect(i,null,n,M,E,null),S.uniforms.shadow_pass.value=r.mapPass.texture,S.uniforms.resolution.value=r.mapSize,S.uniforms.radius.value=r.radius,e.setRenderTarget(r.map),e.clear(),e.renderBufferDirect(i,null,n,S,E,null)}function n(e){var t=e<<0,r=d[t];return void 0===r&&(r=new jo({depthPacking:lr,morphTargets:e}),d[t]=r),r}function a(e){var t=e<<0,r=p[t];return void 0===r&&(r=new Wo({morphTargets:e}),p[t]=r),r}function s(t,r,i,s,o,l,h){var c=null,u=n,d=t.customDepthMaterial;if(!0===s.isPointLight&&(u=a,d=t.customDistanceMaterial),void 0===d){var p=!1;!0===i.morphTargets&&(p=r.morphAttributes&&r.morphAttributes.position&&0b||h.y>b)&&(h.x>b&&(c.x=Math.floor(b/x.x),h.x=c.x*x.x,y.mapSize.x=c.x),h.y>b&&(c.y=Math.floor(b/x.y),h.y=c.y*x.y,y.mapSize.y=c.y)),null===y.map&&!y.isPointLightShadow&&this.type===v){var w={minFilter:_e,magFilter:_e,format:Ve};y.map=new si(h.x,h.y,w),y.map.texture.name=g.name+".shadowMap",y.mapPass=new si(h.x,h.y,w),y.camera.updateProjectionMatrix()}if(null===y.map){var M={minFilter:ge,magFilter:ge,format:Ve};y.map=new si(h.x,h.y,M),y.map.texture.name=g.name+".shadowMap",y.camera.updateProjectionMatrix()}e.setRenderTarget(y.map),e.clear();for(var S,T=y.getViewportCount(),E=0;Ei||e.height>i)&&(n=i/Math.max(e.width,e.height)),1>n||!0===t){if("undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap){var a=t?Jr:Math.floor,s=a(n*e.width),l=a(n*e.height);void 0===S&&(S=o(s,l));var h=r?o(s,l):S;return h.width=s,h.height=l,h.getContext("2d").drawImage(e,0,0,s,l),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+e.width+"x"+e.height+") to ("+s+"x"+l+")."),h}return"data"in e&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+e.width+"x"+e.height+")."),e}return e}function h(e){return Xr(e.width)&&Xr(e.height)}function c(e,t){return e.generateMipmaps&&t&&e.minFilter!==ge&&e.minFilter!==_e}function u(t,r,n,a){var s=4o;o++)e.deleteFramebuffer(n.__webglFramebuffer[o]),n.__webglDepthbuffer&&e.deleteRenderbuffer(n.__webglDepthbuffer[o]);else e.deleteFramebuffer(n.__webglFramebuffer),n.__webglDepthbuffer&&e.deleteRenderbuffer(n.__webglDepthbuffer),n.__webglMultisampledFramebuffer&&e.deleteFramebuffer(n.__webglMultisampledFramebuffer),n.__webglColorRenderbuffer&&e.deleteRenderbuffer(n.__webglColorRenderbuffer),n.__webglDepthRenderbuffer&&e.deleteRenderbuffer(n.__webglDepthRenderbuffer);if(t.isWebGLMultipleRenderTargets)for(var l,h=0,c=r.length;hm;m++)p[m]=s||o?o?i.image[m].image:i.image[m]:l(i.image[m],!1,!0,A);var f,v=p[0],g=h(v)||T,b=a.convert(i.format),w=a.convert(i.type),_=d(i.internalFormat,b,w);if(y(34067,i,g),s){for(var M=0;6>M;M++){f=p[M].mipmaps;for(var S,E=0;EL;L++)if(o){r.texImage2D(34069+L,0,_,p[L].width,p[L].height,0,b,w,p[L].data);for(var R=0;R=E&&console.warn("THREE.WebGLTextures: Trying to use "+e+" texture units while this GPU supports only "+E),I+=1,e},this.resetTextureUnits=function(){I=0},this.setTexture2D=v,this.setTexture2DArray=function(e,t){var n=i.get(e);return 0E;E++)l.__webglFramebuffer[E]=e.createFramebuffer()}else if(l.__webglFramebuffer=e.createFramebuffer(),g)if(n.drawBuffers)for(var A,L=t.texture,R=0,C=L.length;RN;N++)w(l.__webglFramebuffer[N],t,o,36064,34069+N);c(o,S)&&u(34067,o,t.width,t.height),r.bindTexture(34067,null)}else if(g){for(var B=t.texture,U=0,z=B.length;Us;s++)r.bindFramebuffer(36160,n.__webglFramebuffer[s]),n.__webglDepthbuffer[s]=e.createRenderbuffer(),_(n.__webglDepthbuffer[s],t,!1)}else r.bindFramebuffer(36160,n.__webglFramebuffer),n.__webglDepthbuffer=e.createRenderbuffer(),_(n.__webglDepthbuffer,t,!1);r.bindFramebuffer(36160,null)}(t)},this.updateRenderTargetMipmap=function(e){for(var t,n=h(e)||T,a=!0===e.isWebGLMultipleRenderTargets?e.texture:[e.texture],s=0,o=a.length;s.025?(l.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!l.inputState.pinching&&f<=.015&&(l.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else null!==o&&e.gripSpace&&null!==(n=t.getPose(e.gripSpace,r))&&(o.matrix.fromArray(n.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),n.linearVelocity?(o.hasLinearVelocity=!0,o.linearVelocity.copy(n.linearVelocity)):o.hasLinearVelocity=!1,n.angularVelocity?(o.hasAngularVelocity=!0,o.angularVelocity.copy(n.angularVelocity)):o.hasAngularVelocity=!1);return null!==s&&(s.visible=null!==i),null!==o&&(o.visible=null!==n),null!==l&&(l.visible=null!==a),this}}class rl extends zr{constructor(e,t){function r(e){var t=y.get(e.inputSource);t&&t.dispatchEvent({type:e.type,data:e.inputSource})}function i(){y.forEach((function(e,t){e.disconnect(t)})),y.clear(),M=null,S=null,l.bindXRFramebuffer(null),e.setRenderTarget(e.getRenderTarget()),L.stop(),o.isPresenting=!1,o.dispatchEvent({type:"sessionend"})}function a(e){for(var t=h.inputSources,r=0;ra.matrixWorld.determinant(),l=p(t,r,n,a);N.setMaterial(n,o);var h=i.index,c=i.attributes.position;if(null===h){if(void 0===c||0===c.count)return}else if(0===h.count)return;var u=1;!0===n.wireframe&&(h=V.getWireframeAttribute(i),u=2),(n.morphTargets||n.morphNormals)&&J.update(a,i,n,l),ee.setup(a,n,l,i,h);var d,m=K;null!==h&&(d=G.get(h),(m=Q).setIndex(d));var f=null===h?c.count:h.count,v=i.drawRange.start*u,g=i.drawRange.count*u,y=null===s?0:s.start*u,x=null===s?1/0:s.count*u,b=Math.max(v,y),w=Math.min(f,v+g,y+x)-1,_=Math.max(0,w-b+1);if(0!==_){if(a.isMesh)!0===n.wireframe?(N.setLineWidth(n.wireframeLinewidth*e()),m.setMode(1)):m.setMode(4);else if(a.isLine){var M=n.linewidth;void 0===M&&(M=1),N.setLineWidth(M*e()),a.isLineSegments?m.setMode(1):a.isLineLoop?m.setMode(2):m.setMode(3)}else a.isPoints?m.setMode(0):a.isSprite&&m.setMode(4);if(a.isInstancedMesh)m.renderInstances(b,_,a.count);else if(i.isInstancedBufferGeometry){var S=Math.min(i.instanceCount,i._maxInstanceCount);m.renderInstances(b,_,S)}else m.render(b,_)}},this.compile=function(e,t){(C=Z.get(e)).init(),e.traverseVisible((function(e){e.isLight&&e.layers.test(t.layers)&&(C.pushLight(e),e.castShadow&&C.pushShadow(e))})),C.setupLights(),e.traverse((function(t){var r=t.material;if(r)if(Array.isArray(r))for(var i=0;ie.far||t.push({distance:o,point:ml.clone(),uv:Sn.getUV(ml,bl,wl,_l,Ml,Sl,Tl,new $r),face:null,object:this})}}copy(e){return super.copy(e),void 0!==e.center&&this.center.copy(e.center),this.material=e.material,this}}function Al(e,t,r,i,n,a){gl.subVectors(e,r).addScalar(.5).multiply(i),void 0===n?yl.copy(gl):(yl.x=a*gl.x-n*gl.y,yl.y=n*gl.x+a*gl.y),e.copy(t),e.x+=yl.x,e.y+=yl.y,e.applyMatrix4(xl)}El.prototype.isSprite=!0;var Ll=new ci,Rl=new ci;class Cl extends pn{constructor(){super(),this._currentLevel=0,this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]},isLOD:{value:!0}}),this.autoUpdate=!0}copy(e){super.copy(e,!1);for(var t,r=e.levels,i=0,n=r.length;i=t[r].distance;r++)t[r-1].object.visible=!1,t[r].object.visible=!0;for(this._currentLevel=r-1;ra;a++)if(0!==(n=Ol.getComponent(a))){var s=Il.getComponent(a);Nl.multiplyMatrices(r.bones[s].matrixWorld,r.boneInverses[s]),t.addScaledVector(Dl.copy(Pl).applyMatrix4(Nl),n)}return t.applyMatrix4(this.bindMatrixInverse)}}Bl.prototype.isSkinnedMesh=!0;class Ul extends pn{constructor(){super(),this.type="Bone"}}Ul.prototype.isBone=!0;class zl extends ii{constructor(){var e=0o)){u.applyMatrix4(this.matrixWorld);var x=e.ray.origin.distanceTo(u);xe.far||t.push({distance:x,point:c.clone().applyMatrix4(this.matrixWorld),index:f,face:null,faceIndex:null,object:this})}}else for(var b=Math.max(0,a.start),w=Math.min(m.count,a.start+a.count)-1;bo)){u.applyMatrix4(this.matrixWorld);var _=e.ray.origin.distanceTo(u);_e.far||t.push({distance:_,point:c.clone().applyMatrix4(this.matrixWorld),index:b,face:null,faceIndex:null,object:this})}}else r.isGeometry&&console.error("THREE.Line.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}}updateMorphTargets(){var e=this.geometry;if(e.isBufferGeometry){var t=e.morphAttributes,r=Object.keys(t);if(0n.far)return;a.push({distance:h,distanceToRay:Math.sqrt(o),point:l,index:t,face:null,object:s})}}hh.prototype.isPoints=!0;class uh extends ii{constructor(e,t,r,i,n,a,s,o,l){super(e,t,r,i,n,a,s,o,l),this.format=void 0===s?Ge:s,this.minFilter=void 0===a?_e:a,this.magFilter=void 0===n?_e:n,this.generateMipmaps=!1;var h=this;"requestVideoFrameCallback"in e&&e.requestVideoFrameCallback((function t(){h.needsUpdate=!0,e.requestVideoFrameCallback(t)}))}clone(){return new this.constructor(this.image).copy(this)}update(){var e=this.image;!1=="requestVideoFrameCallback"in e&&e.readyState>=e.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}}uh.prototype.isVideoTexture=!0;class dh extends ii{constructor(e,t,r,i,n,a,s,o,l,h,c,u){super(null,a,s,o,l,h,i,n,c,u),this.image={width:t,height:r},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}}dh.prototype.isCompressedTexture=!0;class ph extends ii{constructor(e,t,r,i,n,a,s,o,l){super(e,t,r,i,n,a,s,o,l),this.needsUpdate=!0}}ph.prototype.isCanvasTexture=!0;class mh extends ii{constructor(e,t,r,i,n,a,s,o,l,h){if((h=void 0===h?We:h)!==We&&h!==Ze)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");void 0===r&&h===We&&(r=Ce),void 0===r&&h===Ze&&(r=ze),super(null,i,n,a,s,o,h,r,l),this.image={width:e,height:t},this.magFilter=void 0===s?ge:s,this.minFilter=void 0===o?ge:o,this.flipY=!1,this.generateMipmaps=!1}}mh.prototype.isDepthTexture=!0;class fh extends na{constructor(){var e=0i&&1===e.x&&(c[t]=e.x-1),0===r.x&&0===r.z&&(c[t]=i/2/Math.PI+.5)}function s(e){return Math.atan2(e.z,-e.x)}var o=2a&&(.2>t&&(c[e+0]+=1),.2>r&&(c[e+2]+=1),.2>i&&(c[e+4]+=1))}}()}(),this.setAttribute("position",new Zn(h,3)),this.setAttribute("normal",new Zn(h.slice(),3)),this.setAttribute("uv",new Zn(c,2)),0===l?this.computeVertexNormals():this.normalizeNormals()}static fromJSON(e){return new yh(e.vertices,e.indices,e.radius,e.details)}}class xh extends yh{constructor(){var e=0v;v++){var g=(v+1)%3,y=h[v],x=h[g],b=Mh[l[v]],w=Mh[l[g]],_="".concat(y,"_").concat(x),M="".concat(x,"_").concat(y);M in c&&c[M]?(_h.dot(c[M].normal)<=i&&(u.push(b.x,b.y,b.z),u.push(w.x,w.y,w.z)),c[M]=null):!(_ in c)&&(c[_]={index0:o[v],index1:o[g],normal:_h.clone()})}}for(var S in c)if(c[S]){var{index0:T,index1:E}=c[S];bh.fromBufferAttribute(a,T),wh.fromBufferAttribute(a,E),u.push(bh.x,bh.y,bh.z),u.push(wh.x,wh.y,wh.z)}this.setAttribute("position",new Zn(u,3))}else console.error("THREE.EdgesGeometry no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}}class Th{constructor(){this.type="Curve",this.arcLengthDivisions=200}getPoint(){return console.warn("THREE.Curve: .getPoint() not implemented."),null}getPointAt(e,t){var r=this.getUtoTmapping(e);return this.getPoint(r,t)}getPoints(){for(var e=0(s=i[n=Math.floor(o+(l-o)/2)]-r))o=n+1;else{if(!(0i&&(i=0),1Number.EPSILON){o.normalize();var f=Math.acos(Wr(n[m-1].dot(n[m]),-1,1));a[m].applyMatrix4(l.makeRotationAxis(o,f))}s[m].crossVectors(n[m],a[m])}if(!0===t){var v=Math.acos(Wr(a[0].dot(a[e]),-1,1));v/=e,0n;)n+=i;for(;n>i;)n-=i;np&&(p=1),1e-4>d&&(d=p),1e-4>m&&(m=p),Ch.initNonuniformCatmullRom(t.x,h.x,c.x,r.x,d,p,m),Ph.initNonuniformCatmullRom(t.y,h.y,c.y,r.y,d,p,m),Ih.initNonuniformCatmullRom(t.z,h.z,c.z,r.z,d,p,m)}else"catmullrom"===this.curveType&&(Ch.initCatmullRom(t.x,h.x,c.x,r.x,this.tension),Ph.initCatmullRom(t.y,h.y,c.y,r.y,this.tension),Ih.initCatmullRom(t.z,h.z,c.z,r.z,this.tension));return i.set(Ch.calc(l),Ph.calc(l),Ih.calc(l)),i}copy(e){super.copy(e),this.points=[];for(var t,r=0,i=e.points.length;rr.length-2?r.length-1:n+1],h=r[n>r.length-3?r.length-1:n+2];return t.set(Dh(a,s.x,o.x,l.x,h.x),Dh(a,s.y,o.y,l.y,h.y)),t}copy(e){super.copy(e),this.points=[];for(var t,r=0,i=e.points.length;r=t;a-=i)s=dc(a,e[a],e[a+1],s);return s&&sc(s,s.next)&&(pc(s),s=s.next),s}function Zh(e,t){if(!e)return e;t||(t=e);var r,i=e;do{if(r=!1,i.steiner||!sc(i,i.next)&&0!==ac(i.prev,i,i.next))i=i.next;else{if(pc(i),(i=t=i.prev)===i.next)break;r=!0}}while(r||i!==t);return t}function qh(e,t,r,i,n,a,s){if(e){!s&&a&&function(e,t,r,i){var n=e;do{null===n.z&&(n.z=tc(n.x,n.y,t,r,i)),n.prevZ=n.prev,n.nextZ=n.next,n=n.next}while(n!==e);n.prevZ.nextZ=null,n.prevZ=null,function(e){var t,r,i,n,a,s,o,l,h=1;do{for(r=e,e=null,a=null,s=0;r;){for(s++,i=r,o=0,t=0;ta.x?n.x>s.x?n.x:s.x:a.x>s.x?a.x:s.x,c=n.y>a.y?n.y>s.y?n.y:s.y:a.y>s.y?a.y:s.y,u=tc(o,l,t,r,i),d=tc(h,c,t,r,i),p=e.prevZ,m=e.nextZ;p&&p.z>=u&&m&&m.z<=d;){if(p!==e.prev&&p!==e.next&&ic(n.x,n.y,a.x,a.y,s.x,s.y,p.x,p.y)&&0<=ac(p.prev,p,p.next))return!1;if(p=p.prevZ,m!==e.prev&&m!==e.next&&ic(n.x,n.y,a.x,a.y,s.x,s.y,m.x,m.y)&&0<=ac(m.prev,m,m.next))return!1;m=m.nextZ}for(;p&&p.z>=u;){if(p!==e.prev&&p!==e.next&&ic(n.x,n.y,a.x,a.y,s.x,s.y,p.x,p.y)&&0<=ac(p.prev,p,p.next))return!1;p=p.prevZ}for(;m&&m.z<=d;){if(m!==e.prev&&m!==e.next&&ic(n.x,n.y,a.x,a.y,s.x,s.y,m.x,m.y)&&0<=ac(m.prev,m,m.next))return!1;m=m.nextZ}return!0}function Jh(e,t,r){var i=e;do{var n=i.prev,a=i.next.next;!sc(n,a)&&oc(n,i,i.next,a)&&cc(n,a)&&cc(a,n)&&(t.push(n.i/r),t.push(i.i/r),t.push(a.i/r),pc(i),pc(i.next),i=e=a),i=i.next}while(i!==e);return Zh(i)}function Kh(e,t,r,i,n,a){var s=e;do{for(var o=s.next.next;o!==s.prev;){if(s.i!==o.i&&nc(s,o)){var l=uc(s,o);return s=Zh(s,s.next),l=Zh(l,l.next),qh(s,t,r,i,n,a),void qh(l,t,r,i,n,a)}o=o.next}s=s.next}while(s!==e)}function Qh(e,t){return e.x-t.x}function $h(e,t){if(t=function(e,t){var r,i=t,n=e.x,a=e.y,s=-1/0;do{if(a<=i.y&&a>=i.next.y&&i.next.y!==i.y){var o=i.x+(a-i.y)*(i.next.x-i.x)/(i.next.y-i.y);if(o<=n&&o>s){if(s=o,o===n){if(a===i.y)return i;if(a===i.next.y)return i.next}r=i.x=i.x&&i.x>=c&&n!==i.x&&ic(ar.x||i.x===r.x&&ec(r,i)))&&(r=i,d=l)),i=i.next}while(i!==h);return r}(e,t),t){var r=uc(t,e);Zh(t,t.next),Zh(r,r.next)}}function ec(e,t){return 0>ac(e.prev,e,t.prev)&&0>ac(t.next,e,e.next)}function tc(e,t,r,i,n){return(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-r)*n)|e<<8))|e<<4))|e<<2))|e<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-i)*n)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function rc(e){var t=e,r=e;do{(t.xa!=r.next.y>a&&r.next.y!==r.y&&n<(r.next.x-r.x)*(a-r.y)/(r.next.y-r.y)+r.x&&(i=!i),r=r.next}while(r!==e);return i}(e,t)&&(ac(e.prev,e,t.prev)||ac(e,t.prev,t))||sc(e,t)&&0=Math.min(e.x,r.x)&&t.y<=Math.max(e.y,r.y)&&t.y>=Math.min(e.y,r.y)}function hc(e){return 0e?-1:0}function cc(e,t){return 0>ac(e.prev,e,e.next)?0<=ac(e,t,e.next)&&0<=ac(e,e.prev,t):0>ac(e,t,e.prev)||0>ac(e,e.next,t)}function uc(e,t){var r=new mc(e.i,e.x,e.y),i=new mc(t.i,t.x,t.y),n=e.next,a=t.prev;return e.next=t,t.prev=e,r.next=n,n.prev=r,i.next=r,r.prev=i,a.next=i,i.prev=a,i}function dc(e,t,r,i){var n=new mc(e,t,r);return i?(n.next=i.next,n.prev=i,i.next.prev=n,i.next=n):(n.prev=n,n.next=n),n}function pc(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 mc(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}class fc{static area(e){for(var t=e.length,r=0,i=t-1,n=0;nfc.area(e)}static triangulateShape(e,t){var r=[],i=[],n=[];vc(e),gc(r,e);var a=e.length;t.forEach(vc);for(var s=0;s80*h){r=n=e[0],i=a=e[1];for(var m=h;mn&&(n=s),o>a&&(a=o);l=0===(l=Math.max(n-r,a-i))?0:1/l}return qh(d,p,h,r,i,l),p}(r,i),l=0;lNumber.EPSILON){var d=Math.sqrt(c),p=Math.sqrt(l*l+h*h),m=t.x-o/d,f=t.y+s/d,v=((r.x-h/p-m)*h-(r.y+l/p-f)*l)/(s*h-o*l),g=(i=m+s*v-e.x)*i+(n=f+o*v-e.y)*n;if(2>=g)return new $r(i,n);a=Math.sqrt(g/2)}else{var y=!1;s>Number.EPSILON?l>Number.EPSILON&&(y=!0):s<-Number.EPSILON?l<-Number.EPSILON&&(y=!0):Math.sign(o)===Math.sign(h)&&(y=!0),y?(i=-o,n=s,a=Math.sqrt(c)):(i=s,n=o,a=Math.sqrt(c/2))}return new $r(i/a,n/a)}function o(e,t){for(var r=e.length;0<=--r;){var i=r,n=r-1;0>n&&(n=e.length-1);for(var a=0,s=f+2*w;ae.length&&console.error("THREE.ParametricGeometry: Function must now modify a Vector3 as third parameter.");for(var p,m=t+1,f=0;f<=r;f++){p=f/r;for(var v,g=0;g<=t;g++)e(v=g/t,p,h),n.push(h.x,h.y,h.z),0<=v-o?(e(v-o,p,c),u.subVectors(h,c)):(e(v+o,p,c),u.subVectors(c,h)),0<=p-o?(e(v,p-o,c),d.subVectors(h,c)):(e(v,p+o,c),d.subVectors(c,h)),l.crossVectors(u,d).normalize(),a.push(l.x,l.y,l.z),s.push(v,p)}for(var y=0;ym;m++){var f=s.getX(d+m),v=s.getX(d+(m+1)%3);r[0]=Math.min(f,v),r[1]=Math.max(f,v);var g=r[0]+","+r[1];void 0===i[g]&&(i[g]={index1:r[0],index2:r[1]})}for(var y in i){var x=i[y];n.fromBufferAttribute(a,x.index1),t.push(n.x,n.y,n.z),n.fromBufferAttribute(a,x.index2),t.push(n.x,n.y,n.z)}}else for(var b=e.attributes.position,w=0,_=b.count/3;w<_;w++)for(var M,S=0;3>S;S++){M=3*w+S,n.fromBufferAttribute(b,M),t.push(n.x,n.y,n.z);var T=3*w+(S+1)%3;n.fromBufferAttribute(b,T),t.push(n.x,n.y,n.z)}this.setAttribute("position",new Zn(t,3))}else console.error("THREE.WireframeGeometry no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}}var Oc=Object.freeze({__proto__:null,BoxGeometry:Sa,BoxBufferGeometry:Sa,CircleGeometry:fh,CircleBufferGeometry:fh,ConeGeometry:gh,ConeBufferGeometry:gh,CylinderGeometry:vh,CylinderBufferGeometry:vh,DodecahedronGeometry:xh,DodecahedronBufferGeometry:xh,EdgesGeometry:Sh,ExtrudeGeometry:yc,ExtrudeBufferGeometry:yc,IcosahedronGeometry:bc,IcosahedronBufferGeometry:bc,LatheGeometry:wc,LatheBufferGeometry:wc,OctahedronGeometry:_c,OctahedronBufferGeometry:_c,ParametricGeometry:Mc,ParametricBufferGeometry:Mc,PlaneGeometry:ja,PlaneBufferGeometry:ja,PolyhedronGeometry:yh,PolyhedronBufferGeometry:yh,RingGeometry:Sc,RingBufferGeometry:Sc,ShapeGeometry:Tc,ShapeBufferGeometry:Tc,SphereGeometry:Ec,SphereBufferGeometry:Ec,TetrahedronGeometry:Ac,TetrahedronBufferGeometry:Ac,TextGeometry:Lc,TextBufferGeometry:Lc,TorusGeometry:Rc,TorusBufferGeometry:Rc,TorusKnotGeometry:Cc,TorusKnotBufferGeometry:Cc,TubeGeometry:Pc,TubeBufferGeometry:Pc,WireframeGeometry:Ic});class Dc extends En{constructor(e){super(),this.type="ShadowMaterial",this.color=new On(0),this.transparent=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this}}Dc.prototype.isShadowMaterial=!0;class Nc extends La{constructor(e){super(e),this.type="RawShaderMaterial"}}Nc.prototype.isRawShaderMaterial=!0;class Bc extends En{constructor(e){super(),this.defines={STANDARD:""},this.type="MeshStandardMaterial",this.color=new On(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 On(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=hr,this.normalScale=new $r(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapIntensity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.morphTargets=!1,this.morphNormals=!1,this.flatShading=!1,this.vertexTangents=!1,this.setValues(e)}copy(e){return super.copy(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.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this.flatShading=e.flatShading,this.vertexTangents=e.vertexTangents,this}}Bc.prototype.isMeshStandardMaterial=!0;class Uc extends Bc{constructor(e){super(),this.defines={STANDARD:"",PHYSICAL:""},this.type="MeshPhysicalMaterial",this.clearcoat=0,this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new $r(1,1),this.clearcoatNormalMap=null,this.reflectivity=.5,Object.defineProperty(this,"ior",{get:function(){return(1+.4*this.reflectivity)/(1-.4*this.reflectivity)},set:function(e){this.reflectivity=Wr(2.5*(e-1)/(e+1),0,1)}}),this.sheen=null,this.transmission=0,this.transmissionMap=null,this.thickness=.01,this.thicknessMap=null,this.attenuationDistance=0,this.attenuationColor=new On(1,1,1),this.setValues(e)}copy(e){return super.copy(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,this.sheen=e.sheen?(this.sheen||new On).copy(e.sheen):null,this.transmission=e.transmission,this.transmissionMap=e.transmissionMap,this.thickness=e.thickness,this.thicknessMap=e.thicknessMap,this.attenuationDistance=e.attenuationDistance,this.attenuationColor.copy(e.attenuationColor),this}}Uc.prototype.isMeshPhysicalMaterial=!0;class zc extends En{constructor(e){super(),this.type="MeshPhongMaterial",this.color=new On(16777215),this.specular=new On(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new On(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=hr,this.normalScale=new $r(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=Q,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.morphTargets=!1,this.morphNormals=!1,this.flatShading=!1,this.setValues(e)}copy(e){return super.copy(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.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this.flatShading=e.flatShading,this}}zc.prototype.isMeshPhongMaterial=!0;class Fc extends En{constructor(e){super(),this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new On(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new On(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=hr,this.normalScale=new $r(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.morphTargets=!1,this.morphNormals=!1,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.gradientMap=e.gradientMap,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this}}Fc.prototype.isMeshToonMaterial=!0;class Gc extends En{constructor(e){super(),this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=hr,this.normalScale=new $r(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.morphTargets=!1,this.morphNormals=!1,this.flatShading=!1,this.setValues(e)}copy(e){return super.copy(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.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this.flatShading=e.flatShading,this}}Gc.prototype.isMeshNormalMaterial=!0;class Vc extends En{constructor(e){super(),this.type="MeshLambertMaterial",this.color=new On(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new On(0),this.emissiveIntensity=1,this.emissiveMap=null,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=Q,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.morphTargets=!1,this.morphNormals=!1,this.setValues(e)}copy(e){return super.copy(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.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this}}Vc.prototype.isMeshLambertMaterial=!0;class Hc extends En{constructor(e){super(),this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new On(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=hr,this.normalScale=new $r(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.morphTargets=!1,this.morphNormals=!1,this.flatShading=!1,this.setValues(e)}copy(e){return super.copy(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.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this.flatShading=e.flatShading,this}}Hc.prototype.isMeshMatcapMaterial=!0;class kc extends ql{constructor(e){super(),this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(e)}copy(e){return super.copy(e),this.scale=e.scale,this.dashSize=e.dashSize,this.gapSize=e.gapSize,this}}kc.prototype.isLineDashedMaterial=!0;var jc=Object.freeze({__proto__:null,ShadowMaterial:Dc,SpriteMaterial:dl,RawShaderMaterial:Nc,ShaderMaterial:La,PointsMaterial:nh,MeshPhysicalMaterial:Uc,MeshStandardMaterial:Bc,MeshPhongMaterial:zc,MeshToonMaterial:Fc,MeshNormalMaterial:Gc,MeshLambertMaterial:Vc,MeshDepthMaterial:jo,MeshDistanceMaterial:Wo,MeshBasicMaterial:Dn,MeshMatcapMaterial:Hc,LineDashedMaterial:kc,LineBasicMaterial:ql,Material:En}),Wc={arraySlice:function(e,t,r){return Wc.isTypedArray(e)?new e.constructor(e.subarray(t,void 0===r?e.length:r)):e.slice(t,r)},convertArray:function(e,t,r){return e&&(r||e.constructor!==t)?"number"==typeof t.BYTES_PER_ELEMENT?new t(e):Array.prototype.slice.call(e):e},isTypedArray:function(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)},getKeyframeOrder:function(e){for(var t=e.length,r=Array(t),i=0;i!==t;++i)r[i]=i;return r.sort((function(t,r){return e[t]-e[r]})),r},sortedArray:function(e,t,r){for(var i,n=e.length,a=new e.constructor(n),s=0,o=0;o!==n;++s){i=r[s]*t;for(var l=0;l!==t;++l)a[o++]=e[i+l]}return a},flattenJSON:function(e,t,r,i){for(var n=1,a=e[0];void 0!==a&&void 0===a[i];)a=e[n++];if(void 0!==a){var s=a[i];if(void 0!==s)if(Array.isArray(s))do{void 0!==(s=a[i])&&(t.push(a.time),r.push.apply(r,s)),a=e[n++]}while(void 0!==a);else if(void 0!==s.toArray)do{void 0!==(s=a[i])&&(t.push(a.time),s.toArray(r,r.length)),a=e[n++]}while(void 0!==a);else do{void 0!==(s=a[i])&&(t.push(a.time),r.push(s)),a=e[n++]}while(void 0!==a)}},subclip:function(e,t,r,i){var n=4=i)){u.push(h.times[p]);for(var m=0;ma.tracks[v].times[0]&&(f=a.tracks[v].times[0]);for(var g=0;g=i&&(i=30);for(var n=r.tracks.length,a=t/i,s=function(){var t=r.tracks[o],i=t.ValueTypeName;if("bool"===i||"string"===i)return 0;var n=e.tracks.find((function(e){return e.name===t.name&&e.ValueTypeName===i}));if(void 0===n)return 0;var s=0,l=t.getValueSize();t.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(s=l/3);var h=0,c=n.getValueSize();n.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(h=c/3);var u,d=t.times.length-1;if(a<=t.times[0]){var p=s,m=l-s;u=Wc.arraySlice(t.values,p,m)}else if(a>=t.times[d]){var f=d*l+s,v=f+l-s;u=Wc.arraySlice(t.values,f,v)}else{var g=t.createInterpolant(),y=s,x=l-s;g.evaluate(a),u=Wc.arraySlice(g.resultBuffer,y,x)}"quaternion"===i&&(new hi).fromArray(u).normalize().conjugate().toArray(u);for(var b,w=n.times.length,_=0;_=n)break e;var o=t[1];e=(n=t[--r-1]))break t}a=r,r=0}for(;r>>1;et;)--a;if(++a,0!==n||a!==i){n>=a&&(n=(a=Math.max(a,1))-1);var s=this.getValueSize();this.times=Wc.arraySlice(r,n,a),this.values=Wc.arraySlice(this.values,n*s,a*s)}return this}validate(){var e=!0,t=this.getValueSize();0!=t-Math.floor(t)&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),e=!1);var r=this.times,i=this.values,n=r.length;0===n&&(console.error("THREE.KeyframeTrack: Track is empty.",this),e=!1);for(var a,s=null,o=0;o!==n;o++){if("number"==typeof(a=r[o])&&isNaN(a)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,o,a),e=!1;break}if(null!==s&&s>a){console.error("THREE.KeyframeTrack: Out of order keys.",this,o,a,s),e=!1;break}s=a}if(void 0!==i&&Wc.isTypedArray(i))for(var l,h=0,c=i.length;h!==c;++h)if(l=i[h],isNaN(l)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,h,l),e=!1;break}return e}optimize(){for(var e=Wc.arraySlice(this.times),t=Wc.arraySlice(this.values),r=this.getValueSize(),i=this.getInterpolation()===jt,n=e.length-1,a=1,s=1;sthis.duration&&this.resetDuration()}static parse(e){for(var t=[],r=e.tracks,i=1/(e.fps||1),n=0,a=r.length;n!==a;++n)t.push(au(r[n]).scale(i));var s=new this(e.name,e.duration,t,e.blendMode);return s.uuid=e.uuid,s}static toJSON(e){for(var t=[],r=e.tracks,i={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode},n=0,a=r.length;n!==a;++n)t.push(Jc.toJSON(r[n]));return i}static CreateFromMorphTargetSequence(e,t,r,i){for(var n=t.length,a=[],s=0;s=t){var n=r[i]-t,a=this.curves[i],s=a.getLength(),o=0===s?0:1-n/s;return a.getPointAt(o)}i++}return null}getLength(){var e=this.getCurveLengths();return e[e.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;for(var e=[],t=0,r=0,i=this.curves.length;re;e++)this.coefficients.push(new ci)}set(e){for(var t=0;9>t;t++)this.coefficients[t].copy(e[t]);return this}zero(){for(var e=0;9>e;e++)this.coefficients[e].set(0,0,0);return this}getAt(e,t){var r=e.x,i=e.y,n=e.z,a=this.coefficients;return t.copy(a[0]).multiplyScalar(.282095),t.addScaledVector(a[1],.488603*i),t.addScaledVector(a[2],.488603*n),t.addScaledVector(a[3],.488603*r),t.addScaledVector(a[4],r*i*1.092548),t.addScaledVector(a[5],i*n*1.092548),t.addScaledVector(a[6],.315392*(3*n*n-1)),t.addScaledVector(a[7],r*n*1.092548),t.addScaledVector(a[8],.546274*(r*r-i*i)),t}getIrradianceAt(e,t){var r=e.x,i=e.y,n=e.z,a=this.coefficients;return t.copy(a[0]).multiplyScalar(.886227),t.addScaledVector(a[1],1.023328*i),t.addScaledVector(a[2],1.023328*n),t.addScaledVector(a[3],1.023328*r),t.addScaledVector(a[4],.858086*r*i),t.addScaledVector(a[5],.858086*i*n),t.addScaledVector(a[6],.743125*n*n-.247708),t.addScaledVector(a[7],.858086*r*n),t.addScaledVector(a[8],.429043*(r*r-i*i)),t}add(e){for(var t=0;9>t;t++)this.coefficients[t].add(e.coefficients[t]);return this}addScaledSH(e,t){for(var r=0;9>r;r++)this.coefficients[r].addScaledVector(e.coefficients[r],t);return this}scale(e){for(var t=0;9>t;t++)this.coefficients[t].multiplyScalar(e);return this}lerp(e,t){for(var r=0;9>r;r++)this.coefficients[r].lerp(e.coefficients[r],t);return this}equals(e){for(var t=0;9>t;t++)if(!this.coefficients[t].equals(e.coefficients[t]))return!1;return!0}copy(e){return this.set(e.coefficients)}clone(){return(new this.constructor).copy(this)}fromArray(e){for(var t=1i;i++)r[i].fromArray(e,t+3*i);return this}toArray(){for(var e=0i;i++)r[i].toArray(e,t+3*i);return e}static getBasisAt(e,t){var r=e.x,i=e.y,n=e.z;t[0]=.282095,t[1]=.488603*i,t[2]=.488603*n,t[3]=.488603*r,t[4]=1.092548*r*i,t[5]=1.092548*i*n,t[6]=.315392*(3*n*n-1),t[7]=1.092548*r*n,t[8]=.546274*(r*r-i*i)}}Fu.prototype.isSphericalHarmonics3=!0;class Gu extends wu{constructor(){var e=0Number.EPSILON){if(0>h&&(s=t[a],l=-l,o=t[n],h=-h),e.yo.y)continue;if(e.y!==s.y){var c=h*(e.x-s.x)-l*(e.y-s.y);if(0==c)return!0;if(0>c)continue;i=!i}else if(e.x===s.x)return!0}else{if(e.y!==s.y)continue;if(o.x<=e.x&&e.x<=s.x||s.x<=e.x&&e.x<=o.x)return!0}}return i}var n=fc.isClockWise,a=this.subPaths;if(0===a.length)return[];if(!0===t)return r(a);var s,o,l,h=[];if(1===a.length)return o=a[0],(l=new bu).curves=o.curves,h.push(l),h;var c=!n(a[0].getPoints());c=e?!c:c;var u,d=[],p=[],m=[],f=0;p[f]=void 0,m[f]=[];for(var v=0,g=a.length;vn){var o=t*this._origIndex;this._mixBufferRegion(r,i,o,1-n,t)}0=n){var c=n++,u=e[c];t[u.uuid]=h,e[h]=u,t[l]=c,e[c]=o;for(var d=0,p=i;d!==p;++d){var m=r[d],f=m[c],v=m[h];m[h]=f,m[c]=v}}}this.nCachedObjects_=n}uncache(){for(var e=this._objects,t=this._indicesByUUID,r=this._bindings,i=r.length,n=this.nCachedObjects_,a=e.length,s=0,o=arguments.length;s!==o;++s){var l=arguments[s].uuid,h=t[l];if(void 0!==h)if(delete t[l],ha||0===r)return;this._startTime=null,t=r*a}t*=this._updateTimeScale(e);var s=this._updateTime(t),o=this._updateWeight(e);if(0r.parameterPositions[1]&&(this.stopFading(),0===i&&(this.enabled=!1))}}return this._effectiveWeight=t,t}_updateTimeScale(e){var t=0;if(!this.paused){t=this.timeScale;var r=this._timeScaleInterpolant;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(e){var t=this._clip.duration,r=this.loop,i=this.time+e,n=this._loopCount,a=r===Vt;if(0===e)return-1===n?i:a&&1==(1&n)?t-i:i;if(r===Ft){-1===n&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(i>=t)i=t;else{if(!(0>i)){this.time=i;break e}i=0}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:0>e?-1:1})}}else{if(-1===n&&(0<=e?(n=0,this._setEndings(!0,0===this.repetitions,a)):this._setEndings(0===this.repetitions,!0,a)),i>=t||0>i){var s=Math.floor(i/t);i-=t*s,n+=Math.abs(s);var o=this.repetitions-n;if(0>=o)this.clampWhenFinished?this.paused=!0:this.enabled=!1,i=0e;this._setEndings(l,!l,a)}else this._setEndings(!1,!1,a);this._loopCount=n,this.time=i,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:s})}}else this.time=i;if(a&&1==(1&n))return t-i}return i}_setEndings(e,t,r){var i=this._interpolantSettings;r?(i.endingStart=Zt,i.endingEnd=Zt):(i.endingStart=e?this.zeroSlopeAtStart?Zt:Wt:qt,i.endingEnd=t?this.zeroSlopeAtEnd?Zt:Wt:qt)}_scheduleFading(e,t,r){var i=this._mixer,n=i.time,a=this._weightInterpolant;null===a&&(a=i._lendControlInterpolant(),this._weightInterpolant=a);var s=a.parameterPositions,o=a.sampleValues;return s[0]=n,o[0]=t,s[1]=n+e,o[1]=r,this}}class Ud extends zr{constructor(e){super(),this._root=e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}_bindAction(e,t){var r=e._localRoot||this._root,i=e._clip.tracks,n=i.length,a=e._propertyBindings,s=e._interpolants,o=r.uuid,l=this._bindingsByRootAndName,h=l[o];void 0===h&&(h={},l[o]=h);for(var c=0;c!==n;++c){var u=i[c],d=u.name,p=h[d];if(void 0!==p)a[c]=p;else{if(void 0!==(p=a[c])){null===p._cacheIndex&&(++p.referenceCount,this._addInactiveBinding(p,o,d));continue}var m=t&&t._propertyBindings[c].binding.parsedPath;++(p=new Md(Dd.create(r,d,m),u.ValueTypeName,u.getValueSize())).referenceCount,this._addInactiveBinding(p,o,d),a[c]=p}s[c].resultBuffer=p.buffer}}_activateAction(e){if(!this._isActiveAction(e)){if(null===e._cacheIndex){var t=(e._localRoot||this._root).uuid,r=e._clip.uuid,i=this._actionsByClip[r];this._bindAction(e,i&&i.knownActions[0]),this._addInactiveAction(e,r,t)}for(var n,a=e._propertyBindings,s=0,o=a.length;s!==o;++s)0==(n=a[s]).useCount++&&(this._lendBinding(n),n.saveOriginalState());this._lendAction(e)}}_deactivateAction(e){if(this._isActiveAction(e)){for(var t,r=e._propertyBindings,i=0,n=r.length;i!==n;++i)0==--(t=r[i]).useCount&&(t.restoreOriginalState(),this._takeBackBinding(t));this._takeBackAction(e)}}_initMemoryManager(){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(e){var t=e._cacheIndex;return null!==t&&tthis.max.x||e.ythis.max.y)}containsBox(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(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y))}intersectsBox(e){return!(e.max.xthis.max.x||e.max.ythis.max.y)}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return Zd.copy(e).clamp(this.min,this.max).sub(e).length()}intersect(e){return this.min.max(e.min),this.max.min(e.max),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}qd.prototype.isBox2=!0;var Xd=new ci,Yd=new ci;class Jd{constructor(){var e=0Math.abs(t)&&(t=1e-8),this.scale.set(.5*this.size,.5*this.size,t),this.children[0].material.side=0>t?y:g,this.lookAt(this.plane.normal),super.updateMatrixWorld(e)}}var Sp,Tp,Ep=new ci;class Ap extends pn{constructor(){var e=0e.y)this.quaternion.set(1,0,0,0);else{Ep.set(e.z,0,-e.x).normalize();var t=Math.acos(e.y);this.quaternion.setFromAxisAngle(Ep,t)}}setLength(e){var t=1>16,i=2047&t>>12,n=255&t>>23;return 103>n?r:142n?r|=((i|=2048)>>114-n)+(1&i>>113-n):(r|=n-112<<10|i>>1,r+=1&i)}}var Ip=Math.pow(2,8),Op=[.125,.215,.35,.446,.526,.582],Dp=5+Op.length,Np={[$t]:0,[er]:1,[rr]:2,[nr]:3,[ar]:4,[sr]:5,[tr]:6},Bp=new Dn({side:y,depthWrite:!1,depthTest:!1}),Up=new _a(new Sa,Bp),zp=new Du,{_lodPlanes:Fp,_sizeLods:Gp,_sigmas:Vp}=Jp(),Hp=new On,kp=null,jp=(1+Math.sqrt(5))/2,Wp=1/jp,Zp=[new ci(1,1,1),new ci(-1,1,1),new ci(1,1,-1),new ci(-1,1,-1),new ci(0,jp,Wp),new ci(0,jp,-Wp),new ci(Wp,0,jp),new ci(-Wp,0,jp),new ci(jp,Wp,0),new ci(-jp,Wp,0)];function qp(e){var t=Math.max(e.r,e.g,e.b),r=Math.min(Math.max(Math.ceil(Math.log2(t)),-128),127);return e.multiplyScalar(Math.pow(2,-r)),(r+128)/255}class Xp{constructor(e){var t,r;this._renderer=e,this._pingPongRenderTarget=null,this._blurMaterial=(20,t=new Float32Array(20),r=new ci(0,1,0),new Nc({name:"SphericalGaussianBlur",defines:{n:20},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:t},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:r},inputEncoding:{value:Np[$t]},outputEncoding:{value:Np[$t]}},vertexShader:"\n\n\t\tprecision mediump float;\n\t\tprecision mediump int;\n\n\t\tattribute vec3 position;\n\t\tattribute vec2 uv;\n\t\tattribute float faceIndex;\n\n\t\tvarying vec3 vOutputDirection;\n\n\t\t// RH coordinate system; PMREM face-indexing convention\n\t\tvec3 getDirection( vec2 uv, float face ) {\n\n\t\t\tuv = 2.0 * uv - 1.0;\n\n\t\t\tvec3 direction = vec3( uv, 1.0 );\n\n\t\t\tif ( face == 0.0 ) {\n\n\t\t\t\tdirection = direction.zyx; // ( 1, v, u ) pos x\n\n\t\t\t} else if ( face == 1.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xz *= -1.0; // ( -u, 1, -v ) pos y\n\n\t\t\t} else if ( face == 2.0 ) {\n\n\t\t\t\tdirection.x *= -1.0; // ( -u, v, 1 ) pos z\n\n\t\t\t} else if ( face == 3.0 ) {\n\n\t\t\t\tdirection = direction.zyx;\n\t\t\t\tdirection.xz *= -1.0; // ( -1, v, -u ) neg x\n\n\t\t\t} else if ( face == 4.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xy *= -1.0; // ( -u, -1, v ) neg y\n\n\t\t\t} else if ( face == 5.0 ) {\n\n\t\t\t\tdirection.z *= -1.0; // ( u, v, -1 ) neg z\n\n\t\t\t}\n\n\t\t\treturn direction;\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvOutputDirection = getDirection( uv, faceIndex );\n\t\t\tgl_Position = vec4( position, 1.0 );\n\n\t\t}\n\t",fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform sampler2D envMap;\n\t\t\tuniform int samples;\n\t\t\tuniform float weights[ n ];\n\t\t\tuniform bool latitudinal;\n\t\t\tuniform float dTheta;\n\t\t\tuniform float mipInt;\n\t\t\tuniform vec3 poleAxis;\n\n\t\t\t".concat("\n\n\t\tuniform int inputEncoding;\n\t\tuniform int outputEncoding;\n\n\t\t#include \n\n\t\tvec4 inputTexelToLinear( vec4 value ) {\n\n\t\t\tif ( inputEncoding == 0 ) {\n\n\t\t\t\treturn value;\n\n\t\t\t} else if ( inputEncoding == 1 ) {\n\n\t\t\t\treturn sRGBToLinear( value );\n\n\t\t\t} else if ( inputEncoding == 2 ) {\n\n\t\t\t\treturn RGBEToLinear( value );\n\n\t\t\t} else if ( inputEncoding == 3 ) {\n\n\t\t\t\treturn RGBMToLinear( value, 7.0 );\n\n\t\t\t} else if ( inputEncoding == 4 ) {\n\n\t\t\t\treturn RGBMToLinear( value, 16.0 );\n\n\t\t\t} else if ( inputEncoding == 5 ) {\n\n\t\t\t\treturn RGBDToLinear( value, 256.0 );\n\n\t\t\t} else {\n\n\t\t\t\treturn GammaToLinear( value, 2.2 );\n\n\t\t\t}\n\n\t\t}\n\n\t\tvec4 linearToOutputTexel( vec4 value ) {\n\n\t\t\tif ( outputEncoding == 0 ) {\n\n\t\t\t\treturn value;\n\n\t\t\t} else if ( outputEncoding == 1 ) {\n\n\t\t\t\treturn LinearTosRGB( value );\n\n\t\t\t} else if ( outputEncoding == 2 ) {\n\n\t\t\t\treturn LinearToRGBE( value );\n\n\t\t\t} else if ( outputEncoding == 3 ) {\n\n\t\t\t\treturn LinearToRGBM( value, 7.0 );\n\n\t\t\t} else if ( outputEncoding == 4 ) {\n\n\t\t\t\treturn LinearToRGBM( value, 16.0 );\n\n\t\t\t} else if ( outputEncoding == 5 ) {\n\n\t\t\t\treturn LinearToRGBD( value, 256.0 );\n\n\t\t\t} else {\n\n\t\t\t\treturn LinearToGamma( value, 2.2 );\n\n\t\t\t}\n\n\t\t}\n\n\t\tvec4 envMapTexelToLinear( vec4 color ) {\n\n\t\t\treturn inputTexelToLinear( color );\n\n\t\t}\n\t","\n\n\t\t\t#define ENVMAP_TYPE_CUBE_UV\n\t\t\t#include \n\n\t\t\tvec3 getSample( float theta, vec3 axis ) {\n\n\t\t\t\tfloat cosTheta = cos( theta );\n\t\t\t\t// Rodrigues' axis-angle rotation\n\t\t\t\tvec3 sampleDirection = vOutputDirection * cosTheta\n\t\t\t\t\t+ cross( axis, vOutputDirection ) * sin( theta )\n\t\t\t\t\t+ axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );\n\n\t\t\t\treturn bilinearCubeUV( envMap, sampleDirection, mipInt );\n\n\t\t\t}\n\n\t\t\tvoid main() {\n\n\t\t\t\tvec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );\n\n\t\t\t\tif ( all( equal( axis, vec3( 0.0 ) ) ) ) {\n\n\t\t\t\t\taxis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );\n\n\t\t\t\t}\n\n\t\t\t\taxis = normalize( axis );\n\n\t\t\t\tgl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\t\t\t\tgl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );\n\n\t\t\t\tfor ( int i = 1; i < n; i++ ) {\n\n\t\t\t\t\tif ( i >= samples ) {\n\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tfloat theta = dTheta * float( i );\n\t\t\t\t\tgl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );\n\t\t\t\t\tgl_FragColor.rgb += weights[ i ] * getSample( theta, axis );\n\n\t\t\t\t}\n\n\t\t\t\tgl_FragColor = linearToOutputTexel( gl_FragColor );\n\n\t\t\t}\n\t\t"),blending:_,depthTest:!1,depthWrite:!1})),this._equirectShader=null,this._cubemapShader=null,this._compileMaterial(this._blurMaterial)}fromScene(e){var t=1v;v++)0==(f=v%3)?(n.up.set(0,a[v],0),n.lookAt(s[v],0,0)):1==f?(n.up.set(0,0,a[v]),n.lookAt(0,s[v],0)):(n.up.set(0,a[v],0),n.lookAt(0,0,s[v])),Qp(i,f*Ip,220&&console.warn("sigmaRadians, ".concat(n,", is too large and will clip, as it requested ").concat(m," samples when the maximum is set to ").concat(20));for(var f=[],v=0,g=0;g<20;++g){var y=g/p,x=Math.exp(-y*y/2);f.push(x),0==g?v+=x:g4?i-8+4:0),3*w,2*w),o.setRenderTarget(t),o.render(h,zp)}}function Yp(e){return void 0!==e&&e.type===Ae&&(e.encoding===$t||e.encoding===er||e.encoding===tr)}function Jp(){for(var e,t=[],r=[],i=[],n=8,a=0;a4?s=Op[a-8+4-1]:0==a&&(s=0),i.push(s);for(var o=1/(e-1),l=-o/2,h=1+o/2,c=[l,l,h,l,h,h,l,l,h,h,l,h],u=new Float32Array(108),d=new Float32Array(72),p=new Float32Array(36),m=0;m<6;m++){var f=m%3*2/3-1,v=24&&n--}return{_lodPlanes:t,_sizeLods:r,_sigmas:i}}function Kp(e){var t=new si(3*Ip,3*Ip,e);return t.texture.mapping=de,t.texture.name="PMREM.cubeUv",t.scissorTest=!0,t}function Qp(e,t,r,i,n){e.viewport.set(t,r,i,n),e.scissor.set(t,r,i,n)}function $p(){var e=new $r(1,1);return new Nc({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null},texelSize:{value:e},inputEncoding:{value:Np[$t]},outputEncoding:{value:Np[$t]}},vertexShader:"\n\n\t\tprecision mediump float;\n\t\tprecision mediump int;\n\n\t\tattribute vec3 position;\n\t\tattribute vec2 uv;\n\t\tattribute float faceIndex;\n\n\t\tvarying vec3 vOutputDirection;\n\n\t\t// RH coordinate system; PMREM face-indexing convention\n\t\tvec3 getDirection( vec2 uv, float face ) {\n\n\t\t\tuv = 2.0 * uv - 1.0;\n\n\t\t\tvec3 direction = vec3( uv, 1.0 );\n\n\t\t\tif ( face == 0.0 ) {\n\n\t\t\t\tdirection = direction.zyx; // ( 1, v, u ) pos x\n\n\t\t\t} else if ( face == 1.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xz *= -1.0; // ( -u, 1, -v ) pos y\n\n\t\t\t} else if ( face == 2.0 ) {\n\n\t\t\t\tdirection.x *= -1.0; // ( -u, v, 1 ) pos z\n\n\t\t\t} else if ( face == 3.0 ) {\n\n\t\t\t\tdirection = direction.zyx;\n\t\t\t\tdirection.xz *= -1.0; // ( -1, v, -u ) neg x\n\n\t\t\t} else if ( face == 4.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xy *= -1.0; // ( -u, -1, v ) neg y\n\n\t\t\t} else if ( face == 5.0 ) {\n\n\t\t\t\tdirection.z *= -1.0; // ( u, v, -1 ) neg z\n\n\t\t\t}\n\n\t\t\treturn direction;\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvOutputDirection = getDirection( uv, faceIndex );\n\t\t\tgl_Position = vec4( position, 1.0 );\n\n\t\t}\n\t",fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform sampler2D envMap;\n\t\t\tuniform vec2 texelSize;\n\n\t\t\t".concat("\n\n\t\tuniform int inputEncoding;\n\t\tuniform int outputEncoding;\n\n\t\t#include \n\n\t\tvec4 inputTexelToLinear( vec4 value ) {\n\n\t\t\tif ( inputEncoding == 0 ) {\n\n\t\t\t\treturn value;\n\n\t\t\t} else if ( inputEncoding == 1 ) {\n\n\t\t\t\treturn sRGBToLinear( value );\n\n\t\t\t} else if ( inputEncoding == 2 ) {\n\n\t\t\t\treturn RGBEToLinear( value );\n\n\t\t\t} else if ( inputEncoding == 3 ) {\n\n\t\t\t\treturn RGBMToLinear( value, 7.0 );\n\n\t\t\t} else if ( inputEncoding == 4 ) {\n\n\t\t\t\treturn RGBMToLinear( value, 16.0 );\n\n\t\t\t} else if ( inputEncoding == 5 ) {\n\n\t\t\t\treturn RGBDToLinear( value, 256.0 );\n\n\t\t\t} else {\n\n\t\t\t\treturn GammaToLinear( value, 2.2 );\n\n\t\t\t}\n\n\t\t}\n\n\t\tvec4 linearToOutputTexel( vec4 value ) {\n\n\t\t\tif ( outputEncoding == 0 ) {\n\n\t\t\t\treturn value;\n\n\t\t\t} else if ( outputEncoding == 1 ) {\n\n\t\t\t\treturn LinearTosRGB( value );\n\n\t\t\t} else if ( outputEncoding == 2 ) {\n\n\t\t\t\treturn LinearToRGBE( value );\n\n\t\t\t} else if ( outputEncoding == 3 ) {\n\n\t\t\t\treturn LinearToRGBM( value, 7.0 );\n\n\t\t\t} else if ( outputEncoding == 4 ) {\n\n\t\t\t\treturn LinearToRGBM( value, 16.0 );\n\n\t\t\t} else if ( outputEncoding == 5 ) {\n\n\t\t\t\treturn LinearToRGBD( value, 256.0 );\n\n\t\t\t} else {\n\n\t\t\t\treturn LinearToGamma( value, 2.2 );\n\n\t\t\t}\n\n\t\t}\n\n\t\tvec4 envMapTexelToLinear( vec4 color ) {\n\n\t\t\treturn inputTexelToLinear( color );\n\n\t\t}\n\t","\n\n\t\t\t#include \n\n\t\t\tvoid main() {\n\n\t\t\t\tgl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\n\t\t\t\tvec3 outputDirection = normalize( vOutputDirection );\n\t\t\t\tvec2 uv = equirectUv( outputDirection );\n\n\t\t\t\tvec2 f = fract( uv / texelSize - 0.5 );\n\t\t\t\tuv -= f * texelSize;\n\t\t\t\tvec3 tl = envMapTexelToLinear( texture2D ( envMap, uv ) ).rgb;\n\t\t\t\tuv.x += texelSize.x;\n\t\t\t\tvec3 tr = envMapTexelToLinear( texture2D ( envMap, uv ) ).rgb;\n\t\t\t\tuv.y += texelSize.y;\n\t\t\t\tvec3 br = envMapTexelToLinear( texture2D ( envMap, uv ) ).rgb;\n\t\t\t\tuv.x -= texelSize.x;\n\t\t\t\tvec3 bl = envMapTexelToLinear( texture2D ( envMap, uv ) ).rgb;\n\n\t\t\t\tvec3 tm = mix( tl, tr, f.x );\n\t\t\t\tvec3 bm = mix( bl, br, f.x );\n\t\t\t\tgl_FragColor.rgb = mix( tm, bm, f.y );\n\n\t\t\t\tgl_FragColor = linearToOutputTexel( gl_FragColor );\n\n\t\t\t}\n\t\t"),blending:_,depthTest:!1,depthWrite:!1})}function em(){return new Nc({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},inputEncoding:{value:Np[$t]},outputEncoding:{value:Np[$t]}},vertexShader:"\n\n\t\tprecision mediump float;\n\t\tprecision mediump int;\n\n\t\tattribute vec3 position;\n\t\tattribute vec2 uv;\n\t\tattribute float faceIndex;\n\n\t\tvarying vec3 vOutputDirection;\n\n\t\t// RH coordinate system; PMREM face-indexing convention\n\t\tvec3 getDirection( vec2 uv, float face ) {\n\n\t\t\tuv = 2.0 * uv - 1.0;\n\n\t\t\tvec3 direction = vec3( uv, 1.0 );\n\n\t\t\tif ( face == 0.0 ) {\n\n\t\t\t\tdirection = direction.zyx; // ( 1, v, u ) pos x\n\n\t\t\t} else if ( face == 1.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xz *= -1.0; // ( -u, 1, -v ) pos y\n\n\t\t\t} else if ( face == 2.0 ) {\n\n\t\t\t\tdirection.x *= -1.0; // ( -u, v, 1 ) pos z\n\n\t\t\t} else if ( face == 3.0 ) {\n\n\t\t\t\tdirection = direction.zyx;\n\t\t\t\tdirection.xz *= -1.0; // ( -1, v, -u ) neg x\n\n\t\t\t} else if ( face == 4.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xy *= -1.0; // ( -u, -1, v ) neg y\n\n\t\t\t} else if ( face == 5.0 ) {\n\n\t\t\t\tdirection.z *= -1.0; // ( u, v, -1 ) neg z\n\n\t\t\t}\n\n\t\t\treturn direction;\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvOutputDirection = getDirection( uv, faceIndex );\n\t\t\tgl_Position = vec4( position, 1.0 );\n\n\t\t}\n\t",fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform samplerCube envMap;\n\n\t\t\t".concat("\n\n\t\tuniform int inputEncoding;\n\t\tuniform int outputEncoding;\n\n\t\t#include \n\n\t\tvec4 inputTexelToLinear( vec4 value ) {\n\n\t\t\tif ( inputEncoding == 0 ) {\n\n\t\t\t\treturn value;\n\n\t\t\t} else if ( inputEncoding == 1 ) {\n\n\t\t\t\treturn sRGBToLinear( value );\n\n\t\t\t} else if ( inputEncoding == 2 ) {\n\n\t\t\t\treturn RGBEToLinear( value );\n\n\t\t\t} else if ( inputEncoding == 3 ) {\n\n\t\t\t\treturn RGBMToLinear( value, 7.0 );\n\n\t\t\t} else if ( inputEncoding == 4 ) {\n\n\t\t\t\treturn RGBMToLinear( value, 16.0 );\n\n\t\t\t} else if ( inputEncoding == 5 ) {\n\n\t\t\t\treturn RGBDToLinear( value, 256.0 );\n\n\t\t\t} else {\n\n\t\t\t\treturn GammaToLinear( value, 2.2 );\n\n\t\t\t}\n\n\t\t}\n\n\t\tvec4 linearToOutputTexel( vec4 value ) {\n\n\t\t\tif ( outputEncoding == 0 ) {\n\n\t\t\t\treturn value;\n\n\t\t\t} else if ( outputEncoding == 1 ) {\n\n\t\t\t\treturn LinearTosRGB( value );\n\n\t\t\t} else if ( outputEncoding == 2 ) {\n\n\t\t\t\treturn LinearToRGBE( value );\n\n\t\t\t} else if ( outputEncoding == 3 ) {\n\n\t\t\t\treturn LinearToRGBM( value, 7.0 );\n\n\t\t\t} else if ( outputEncoding == 4 ) {\n\n\t\t\t\treturn LinearToRGBM( value, 16.0 );\n\n\t\t\t} else if ( outputEncoding == 5 ) {\n\n\t\t\t\treturn LinearToRGBD( value, 256.0 );\n\n\t\t\t} else {\n\n\t\t\t\treturn LinearToGamma( value, 2.2 );\n\n\t\t\t}\n\n\t\t}\n\n\t\tvec4 envMapTexelToLinear( vec4 color ) {\n\n\t\t\treturn inputTexelToLinear( color );\n\n\t\t}\n\t","\n\n\t\t\tvoid main() {\n\n\t\t\t\tgl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\t\t\t\tgl_FragColor.rgb = envMapTexelToLinear( textureCube( envMap, vec3( - vOutputDirection.x, vOutputDirection.yz ) ) ).rgb;\n\t\t\t\tgl_FragColor = linearToOutputTexel( gl_FragColor );\n\n\t\t\t}\n\t\t"),blending:_,depthTest:!1,depthWrite:!1})}var tm=0,rm=1,im=0,nm=1,am=2;function sm(e){return console.warn("THREE.MeshFaceMaterial has been removed. Use an Array instead."),e}function om(){var e=0t[0]?1:0})),e._entries&&(e._entries={});for(var r=0;r{function i(e){function t(i){if(r[i])return r[i].exports;var n=r[i]={i,l:!1,exports:{}};return e[i].call(n.exports,n,n.exports,t),n.l=!0,n.exports}var r={};t.m=e,t.c=r,t.i=function(e){return e},t.d=function(e,r,i){t.o(e,r)||Object.defineProperty(e,r,{configurable:!1,enumerable:!0,get:i})},t.r=function(e){Object.defineProperty(e,"__esModule",{value:!0})},t.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(r,"a",r),r},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="/",t.oe=function(e){throw console.error(e),e};var i=t(t.s=ENTRY_MODULE);return i.default||i}var n="[\\.|\\-|\\+|\\w|/|@]+",a="\\(\\s*(/\\*.*?\\*/)?\\s*.*?("+n+").*?\\)";function s(e){return(e+"").replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}function o(e,t,i){var o={};o[i]=[];var l,h=t.toString(),c=h.match(/^function\s?\w*\(\w+,\s*\w+,\s*(\w+)\)/);if(!c)return o;for(var u,d=c[1],p=new RegExp("(\\\\n|\\W)"+s(d)+a,"g");u=p.exec(h);)"dll-reference"!==u[3]&&o[i].push(u[3]);for(p=new RegExp("\\("+s(d)+'\\("(dll-reference\\s('+n+'))"\\)\\)'+a,"g");u=p.exec(h);)e[u[2]]||(o[i].push(u[1]),e[u[2]]=r(u[1]).m),o[u[2]]=o[u[2]]||[],o[u[2]].push(u[4]);for(var m=Object.keys(o),f=0;f{var i,n,a,s,o,l,h,c,u=r(1515),d=r(2515).resolveURL,p=function(){this.nearPlane=.168248,this.farPlane=6.82906,this.eyePosition=[.5,-2.86496,.5],this.targetPosition=[.5,.5,.5],this.upVector=[0,0,1];var e=this;this.setFromObject=t=>{var{nearPlane:r,farPlane:i,eyePosition:n,targetPosition:a,upVector:s}=t;e.nearPlane=r,e.farPlane=i,e.eyePosition=n,e.targetPosition=a,e.upVector=s}},m=function(e,t,r,i){var n=e.eyePosition,a=e.targetPosition,s=e.upVector,o=t.eyePosition,l=t.targetPosition,h=t.upVector,c=r,u=i,d=0,p=!1;c.near=Math.min(e.nearPlane,t.nearPlane),c.far=Math.max(e.farPlane,t.farPlane),c.cameraObject.up.set(t.upVector[0],t.upVector[1],t.upVector[2]),this.setDuration=e=>{u=e},this.update=e=>{!1===this.enabled||((e=>{var t=d+e;t>u&&(t=u),d=t})(e),(()=>{var e=d/u,t=[n[0]*(1-e)+o[0]*e,n[1]*(1-e)+o[1]*e,n[2]*(1-e)+o[2]*e],r=[a[0]*(1-e)+l[0]*e,a[1]*(1-e)+l[1]*e,a[2]*(1-e)+l[2]*e];s[0],h[0],s[1],h[1],s[2],h[2],c.cameraObject.position.set(t[0],t[1],t[2]),c.cameraObject.target.set(r[0],r[1],r[2])})(),d==u&&(p=!0))},this.isTransitionCompleted=()=>p},f=function(e,t,r,i){var n=e,a=t,s=r,o=i,l=0,h=!1;this.setDuration=e=>{o=e},this.update=e=>{!1===this.enabled||((e=>{var t=l,r=l+e;r>o&&(r=o);var i=((l=r)-t)/o*a;s.rotateAboutLookAtpoint(n,i)})(e),l==o&&(h=!0))},this.isTransitionCompleted=()=>h},v=function(e,t,r,i,n){var a=e,s=t,o=n,l=r,h=i,c=new u.Raycaster;c.params.Line.threshold=.1,c.params.Points.threshold=1;var d=new u.Vector2,p=!1,m=new Date,f=!1,v=0,g=[],y={zincCamera:void 0,x:-1,y:-1},x=void 0;this.enable=()=>{enable=!0},this.disable=()=>{enable=!1},this.getIntersectsObject=e=>{if(s!==a){var t=a.getThreeJSScene();o.render(t,e.cameraObject)}var r=x||a.getPickableThreeJSObjects();return g.length=0,c.intersectObjects(r,!0,g)},this.setPickableObjects=e=>{void 0===e?x=void 0:(x=[],e.forEach((e=>{e.getGroup()&&e.getGroup().visible&&x.push(e.getGroup())})))},this.getIntersectsObjectWithOrigin=(e,t,r)=>(c.set(t,r),this.getIntersectsObject(e)),this.getIntersectsObjectWithCamera=(e,t,r)=>(e.getNDCFromDocumentCoords(t,r,d),c.setFromCamera(d,e.cameraObject),this.getIntersectsObject(e)),this.pick=(e,t,r)=>{if(o&&a&&e&&l){this.getIntersectsObjectWithCamera(e,t,r);for(var i,n=g.length,s=0;s{if(o&&a&&e&&h){if(this.getIntersectsObjectWithCamera(e,t,r),m.setTime(Date.now()),0===g.length){if(f)return;f=!0}else f=!1;h(g,t,r)}};this.move=(e,t,r)=>{o&&a&&e&&h&&(a.displayMarkers?b(e,t,r):(y.zincCamera=e,y.x=t,y.y=r,!p&&(250<=(v=m?Date.now()-m.getTime():250)?b(e,t,r):(p=!0,setTimeout(w(y),v)))))};var w=e=>function(){p=!1,b(e.zincCamera,e.x,e.y)}},g=function(e,t,r,i){var n=new u.Vector3,a=-t,s=i,o=e;this.stopOnCameraInput=r,this.requireUpdate=!0;var l=new u.Vector3,h=new u.Vector3;this.update=e=>{!1===this.enabled||(this.requireUpdate&&((e=>{var t=Math.sqrt(e[0]*e[0]+e[1]*e[1]),r=.25*(4*Math.abs(e[0])+4*Math.abs(e[1])),i=-e[1]/t,a=e[0]/t,o=i*e[0]+a*-e[1];o>r?o=r:o<-r&&(o=-r);var c=Math.acos(o/r)-.5*Math.PI;n.copy(s.cameraObject.position).sub(s.cameraObject.target).normalize(),l.copy(s.cameraObject.up).normalize(),h.crossVectors(l,n).normalize().multiplyScalar(i),l.multiplyScalar(a),l.add(h).multiplyScalar(Math.cos(c)),n.multiplyScalar(Math.sin(c)).add(l)})(o),this.requireUpdate=!1),s.rotateAboutLookAtpoint(n,a*e/1e3))}},y=function(){this.type="StereoCamera",this.aspect=1,this.cameraL=new u.PerspectiveCamera,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new u.PerspectiveCamera,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1};Object.assign(y.prototype,{update:(h=new u.Matrix4,c=new u.Matrix4,function(e){if(i!==e.focus||n!==e.fov||a!==e.aspect*this.aspect||s!==e.near||o!==e.far||l!==e.zoom){i=e.focus,n=e.fov,a=e.aspect*this.aspect,s=e.near,o=e.far,l=e.zoom;var t,r,d=e.projectionMatrix.clone(),p=.032*s/i,m=s*Math.tan(u.Math.DEG2RAD*n*.5)/e.zoom;c.elements[12]=-.032,h.elements[12]=.032,t=-m*a+p,r=m*a+p,d.elements[0]=2*s/(r-t),d.elements[8]=(r+t)/(r-t),this.cameraL.projectionMatrix.copy(d),t=-m*a-p,r=m*a-p,d.elements[0]=2*s/(r-t),d.elements[8]=(r+t)/(r-t),this.cameraR.projectionMatrix.copy(d)}this.cameraL.matrixWorld.copy(e.matrixWorld).multiply(c),this.cameraR.matrixWorld.copy(e.matrixWorld).multiply(h)})});var x=function(e){var t=this;this.object=e,this.object.rotation.reorder("YXZ"),this.enabled=!0,this.deviceOrientation={},this.screenOrientation=0;var r,i,n,a,s=e=>{t.deviceOrientation=e},o=()=>{"undefined"!=typeof window&&(t.screenOrientation=window.orientation||0)},l=(r=new u.Vector3(0,0,1),i=new u.Euler,n=new u.Quaternion,a=new u.Quaternion(-Math.sqrt(.5),0,0,Math.sqrt(.5)),(e,t,s,o,l)=>{var h=new u.Vector3(0,0,1);h.subVectors(e.target,e.position),i.set(s,t,-o,"YXZ");var c=new u.Quaternion;c.setFromEuler(i),c.multiply(a),c.multiply(n.setFromAxisAngle(r,-l)),h.applyQuaternion(c),h.addVectors(e.position,h),e.lookAt(h)});this.connect=()=>{o(),"undefined"!=typeof window&&(window.addEventListener("orientationchange",o,!1),window.addEventListener("deviceorientation",s,!1)),t.enabled=!0},this.disconnect=()=>{"undefined"!=typeof window&&(window.removeEventListener("orientationchange",o,!1),window.removeEventListener("deviceorientation",s,!1)),t.enabled=!1},this.update=()=>{if(!1!==t.enabled){var e=t.deviceOrientation.alpha?u.Math.degToRad(t.deviceOrientation.alpha):0,r=t.deviceOrientation.beta?u.Math.degToRad(t.deviceOrientation.beta):0,i=t.deviceOrientation.gamma?u.Math.degToRad(t.deviceOrientation.gamma):0,n=t.screenOrientation?u.Math.degToRad(t.screenOrientation):0;l(t.object,e,r,i,n)}},this.dispose=function(){this.disconnect()},this.connect()},b=function(){var e=void 0,t=void 0,r=void 0,i=new u.Vector3,n=new u.Vector3,a=new u.Vector3,s=new u.Vector3,o=void 0;this.setCurrentCameraSettings=(a,s)=>{e=a.clone(),t=a,r=s,e.near=r.nearPlane,r.farPlane&&(e.far=r.farPlane),r.eyePosition&&e.position.set(r.eyePosition[0],r.eyePosition[1],r.eyePosition[2]),r.upVector&&e.up.set(r.upVector[0],r.upVector[1],r.upVector[2]),r.targetPosition&&(e.target=new u.Vector3(r.targetPosition[0],r.targetPosition[1],r.targetPosition[2]),e.lookAt(e.target)),e.updateProjectionMatrix(),i.copy(e.position).project(e),n.copy(e.target).project(e)},this.getCurrentPosition=()=>(n.copy(t.target).project(e),[n.x,n.y]),this.zoom=e=>{var r=.002*e,i=Math.max(t.zoom-r,1);t.zoom=i,t.updateProjectionMatrix()},this.zoomToBox=(t,r)=>{t.getCenter(a),a.project(e),this.setCenterZoom([a.x,a.y],r)},this.getPanZoom=()=>({target:this.getCurrentPosition(),zoom:t.zoom}),this.setCenterZoom=(r,i)=>{a.set(r[0],r[1],n.z).unproject(e),s.copy(a).sub(t.target),t.target.copy(a),t.lookAt(t.target),t.position.add(s),t.zoom=i,t.updateProjectionMatrix()},this.setEventCallback=e=>{(void 0===e||"function"==typeof e)&&(o=e)},this.triggerCallback=()=>{void 0!==o&&"function"==typeof o&&o()}};t.Viewport=p,t.CameraControls=function(e,t,r,i){var n={NONE:-1,DEFAULT:0,PATH:1,SMOOTH_CAMERA_TRANSITION:2,AUTO_TUMBLE:3,ROTATE_TRANSITION:4,MINIMAP:5,SYNC_CONTROL:6},a={NONE:-1,ROTATE:0,ZOOM:1,PAN:2,TOUCH_ROTATE:3,TOUCH_ZOOM:4,TOUCH_PAN:5,SCROLL:6},s={};s.MAIN=a.ROTATE,s.AUXILIARY=a.ZOOM,s.SECONDARY=a.PAN,this.cameraObject=e,this.domElement=void 0===t?document:t,this.renderer=r,this.scene=i,this.tumble_rate=1.5,this.pointer_x=0,this.pointer_y=0,this.pointer_x_start=0,this.pointer_y_start=0,this.previous_pointer_x=0,this.previous_pointer_y=0,this.near_plane_fly_debt=0,this.touchZoomDistanceStart=0,this.touchZoomDistanceEnd=0,this.directionalLight=0,this.scrollRate=50,this.pixelHeight=1;var o,l=6e3,h=!0,c=0,y=void 0,w=void 0,_=!1,M=500,S=void 0,T="default",E=n.DEFAULT,A=void 0,L=void 0,R=void 0,C=0,P=1;this._state=a.NONE,this.targetTouchId=-1;var I=void 0,O=new u.Vector3,D=new u.Vector3,N=new u.Vector3,B=new u.Vector3,U=new u.Vector3,z=new u.Vector3,F=new u.Vector3,G=new u.Vector3,V=new u.Sphere,H=new u.Vector3,k=!1,j=void 0,W=0,Z={default:new p};Z.default.nearPlane=.1,Z.default.farPlane=2e3,Z.default.eyePosition=[0,0,0],Z.default.targetPosition=[0,0,-1],Z.default.upVector=[0,1,0],void 0===this.cameraObject.target&&(this.cameraObject.target=new u.Vector3(...Z.default.targetPosition)),this.calculateMaxAllowedDistance=e=>{var t=e.getBoundingBox();if(t){t.getBoundingSphere(V),W=6*V.radius;var r=0;this.cameraObject&&(r=this.cameraObject.position.distanceTo(V.center)),W=r>W?r:W}else W=0},this.addViewport=(e,t)=>{e&&t&&(Z[e]=t)},this.setDefaultViewport=e=>!(!e||!(e in Z)||(T=e,0)),this.getDefaultViewport=()=>T,this.getViewportOfName=e=>Z[e],this.setCurrentViewport=e=>!!(e in Z)&&(this.setCurrentCameraSettings(Z[e]),!0),this.setRotationMode=e=>{switch(e){case"none":P=-1;break;case"horizontal":P=2;break;case"vertical":P=3;break;default:P=1}},this.onResize=()=>{I&&(I=void 0),j&&j.setCurrentCameraSettings(this.cameraObject,Z[T])},this.getVisibleHeightAtZDepth=e=>{var t=this.cameraObject.position.distanceTo(this.cameraObject.target);e{var t=this.getVisibleHeightAtZDepth(0);return this.pixelHeight=t/e,this.pixelHeight},this.getNDCFromDocumentCoords=(e,t,r)=>{ie(!1);var i=r||new u.Vector2,n=(e-I.left)/I.width*2-1,a=-(t-I.top)/I.height*2+1;return i.set(n,a)},this.getRelativeCoordsFromNDC=(e,t,r)=>{ie(!1);var i=r||new u.Vector2;return i.x=(e+1)*I.width/2,i.y=(1-t)*I.height/2,i},this.setMouseButtonAction=(e,t)=>{s[e]=a[t]};var q=()=>{if(0e||this.cameraObject.position.distanceTo(V.center)>e}return!0},X=e=>{H.copy(this.cameraObject.position).add(e),q()&&(this.cameraObject.target.add(e),this.cameraObject.position.add(e),this.updateDirectionalLight())},Y=e=>{var t;if(ie(!1),E===n.DEFAULT&&(t=this.scene.getNormalisedMinimapCoordinates(this.renderer,e)),t){E=n.MINIMAP;var r=this.scene.getMinimapDiffFromNormalised(t.x,t.y);X(r)}else 0==e.button?e.ctrlKey?this._state=s.AUXILIARY:e.shiftKey?this._state=s.SECONDARY:this._state=s.MAIN:1==e.button?(e.preventDefault(),this._state=s.AUXILIARY):2==e.button&&(this._state=s.SECONDARY),this.pointer_x=e.clientX-I.left,this.pointer_y=e.clientY-I.top,this.pointer_x_start=this.pointer_x,this.pointer_y_start=this.pointer_y,this.previous_pointer_x=this.pointer_x,this.previous_pointer_y=this.pointer_y},J=e=>{if(ie(!1),I)if(this.pointer_x=e.clientX-I.left,this.pointer_y=e.clientY-I.top,E===n.MINIMAP){var t=this.scene.getNormalisedMinimapCoordinates(this.renderer,e);if(t){var r=this.scene.getMinimapDiffFromNormalised(t.x,t.y);X(r)}}else this._state===a.NONE&&void 0!==o&&o.move(this,e.clientX,e.clientY,this.renderer)},K=e=>{this._state=a.NONE,E==n.MINIMAP&&(E=n.DEFAULT),void 0!==o&&this.pointer_x_start==e.clientX-I.left&&this.pointer_y_start==e.clientY-I.top&&o.pick(this,e.clientX,e.clientY,this.renderer)},Q=e=>{this._state=a.NONE},$=e=>{ie(!1);var t=e.touches.length;if(1==t)this._state=a.TOUCH_ROTATE,this.pointer_x=e.touches[0].clientX-I.left,this.pointer_y=e.touches[0].clientY-I.top,this.pointer_x_start=this.pointer_x,this.pointer_y_start=this.pointer_y,this.previous_pointer_x=this.pointer_x,this.previous_pointer_y=this.pointer_y;else if(2==t){this._state=a.TOUCH_ZOOM;var r=e.touches[0].clientX-e.touches[1].clientX,i=e.touches[0].clientY-e.touches[1].clientY;this.touchZoomDistanceEnd=this.touchZoomDistanceStart=Math.sqrt(r*r+i*i)}else 3==t&&(this._state=a.TOUCH_PAN,this.targetTouchId=e.touches[0].identifier,this.pointer_x=e.touches[0].clientX-I.left,this.pointer_y=e.touches[0].clientY-I.top,this.previous_pointer_x=this.pointer_x,this.previous_pointer_y=this.pointer_y)},ee=e=>{e.preventDefault(),e.stopPropagation();var t=e.touches.length;if(1==t)this.pointer_x=e.touches[0].clientX-I.left,this.pointer_y=e.touches[0].clientY-I.top;else if(2==t){if(this._state===a.TOUCH_ZOOM){var r=e.touches[0].clientX-e.touches[1].clientX,i=e.touches[0].clientY-e.touches[1].clientY;this.touchZoomDistanceEnd=Math.sqrt(r*r+i*i)}}else if(3==t&&this._state===a.TOUCH_PAN)for(var n=0;3>n;n++)e.touches[n].identifier==this.targetTouchId&&(this.pointer_x=e.touches[0].clientX-I.left,this.pointer_y=e.touches[0].clientY-I.top)},te=e=>{var t=e.touches.length;this.touchZoomDistanceStart=this.touchZoomDistanceEnd=0,this.targetTouchId=-1,this._state=a.NONE,1==t&&void 0!==o&&this.pointer_x_start==e.touches[0].clientX-I.left&&this.pointer_y_start==e.touches[0].clientY-I.top&&o.pick(this.cameraObject,e.touches[0].clientX,e.touches[0].clientY,this.renderer)},re=()=>{ie(!0)},ie=e=>{if(e||void 0===I){var t=new IntersectionObserver((e=>{for(var r of e)I=r.boundingClientRect;t.disconnect()}));t.observe(this.domElement)}},ne=e=>{ie(!1),this._state=a.SCROLL;var t=0;0e.deltaY&&(t=-1*this.scrollRate),C+=t,e.preventDefault(),e.stopImmediatePropagation()},ae=()=>{if(void 0!==this.cameraObject){var e=I.height,t=this.cameraObject.position.distanceTo(this.cameraObject.target),r=0;this.cameraObject.far>this.cameraObject.near&&t>=this.cameraObject.near&&t<=this.cameraObject.far&&(r=(t-this.cameraObject.near)/(this.cameraObject.far-this.cameraObject.near)),D.set(this.previous_pointer_x,e-this.previous_pointer_y,0),N.set(this.previous_pointer_x,e-this.previous_pointer_y,1),B.set(this.pointer_x,e-this.pointer_y,0),U.set(this.pointer_x,e-this.pointer_y,1),D.unproject(this.cameraObject),N.unproject(this.cameraObject),B.unproject(this.cameraObject),U.unproject(this.cameraObject),B.sub(D).multiplyScalar(1-r),U.sub(N).multiplyScalar(r),B.add(U).multiplyScalar(-.002),X(B)}this.previous_pointer_x=this.pointer_x,this.previous_pointer_y=this.pointer_y};this.getVectorsFromRotateAboutLookAtPoints=(e,t)=>{e.normalize(),F.copy(this.cameraObject.position).sub(this.cameraObject.target),G.copy(F),F.normalize(),.8{var r=this.getVectorsFromRotateAboutLookAtPoints(e,t);this.cameraObject.position.copy(r.position),this.updateDirectionalLight(),this.cameraObject.up.copy(r.up)};var se=()=>{if(void 0!==this.cameraObject){var e=I.width,t=I.height;if(0r?l=r:l<-r&&(l=-r)}var h=Math.acos(0/r)-.5*Math.PI,c=this.tumble_rate*a/r;O.copy(this.cameraObject.position).sub(this.cameraObject.target).normalize(),D.copy(this.cameraObject.up).normalize(),N.copy(D).cross(O).normalize().multiplyScalar(s),D.multiplyScalar(o),z.addVectors(N,D).multiplyScalar(Math.cos(h)),O.multiplyScalar(Math.sin(h)),z.add(O),this.rotateAboutLookAtpoint(z,-c)}}}this.previous_pointer_x=this.pointer_x,this.previous_pointer_y=this.pointer_y},oe=()=>{var e=0;return this._state===a.ZOOM?e=this.previous_pointer_y-this.pointer_y:this._state===a.SCROLL?e=C:(e=-1*(this.touchZoomDistanceEnd-this.touchZoomDistanceStart),this.touchZoomDistanceStart=this.touchZoomDistanceEnd),e};this.changeZoomByScrollRateUnit=e=>{var t=e*this.scrollRate;this.changeZoomByValue(t)},this.changeZoomByValue=e=>{if(void 0!==this.cameraObject){var t=I.height,r=this.cameraObject.position.clone();r.sub(this.cameraObject.target);var i=r.length(),n=1.5*e/t;if(.01{var e=oe();this.changeZoomByValue(e),this._state===a.ZOOM&&(this.previous_pointer_x=this.pointer_x,this.previous_pointer_y=this.pointer_y),this._state===a.SCROLL&&(C=0,this._state=a.NONE)};this.setDirectionalLight=e=>{this.directionalLight=e},this.updateDirectionalLight=()=>{0!=this.directionalLight&&this.directionalLight.position.set(this.cameraObject.position.x,this.cameraObject.position.y,this.cameraObject.position.z)},this.enable=function(){h=!0,this.domElement&&this.domElement.addEventListener&&(this.domElement.addEventListener("mousedown",Y,!1),this.domElement.addEventListener("mousemove",J,!1),this.domElement.addEventListener("mouseup",K,!1),this.domElement.addEventListener("mouseleave",Q,!1),this.domElement.addEventListener("touchstart",$,!1),this.domElement.addEventListener("touchmove",ee,!1),this.domElement.addEventListener("touchend",te,!1),this.domElement.addEventListener("wheel",ne,!1),this.domElement.addEventListener("contextmenu",(e=>{e.preventDefault()}),!1),this.domElement.addEventListener("mouseenter",re,!1))},this.disable=function(){h=!1,this.domElement&&this.domElement.removeEventListener&&(this.domElement.removeEventListener("mousedown",Y,!1),this.domElement.removeEventListener("mousemove",J,!1),this.domElement.removeEventListener("mouseup",K,!1),this.domElement.removeEventListener("mouseleave",Q,!1),this.domElement.removeEventListener("touchstart",$,!1),this.domElement.removeEventListener("touchmove",ee,!1),this.domElement.removeEventListener("touchend",te,!1),this.domElement.removeEventListener("wheel",ne,!1),this.domElement.removeEventListener("mouseenter",re,!1),this.domElement.removeEventListener("contextmenu",(e=>{e.preventDefault()}),!1))},this.loadPath=e=>{y=e.CameraPath,w=e.NumberOfPoints},this.loadPathURL=(e,t)=>{var r=new XMLHttpRequest;r.onreadystatechange=()=>{if(4==r.readyState&&200==r.status){var e=JSON.parse(r.responseText);this.loadPath(e),null!=t&&"function"==typeof t&&t()}};var i=d(e);r.open("GET",i,!0),r.send()},this.setPathDuration=e=>{l=e,A&&A.setDuration(l),L&&L.setDuration(l)},this.getPlayRate=()=>M,this.setPlayRate=e=>{M=e},this.getTime=()=>c,this.setTime=e=>{c=e>l?l:0>e?0:e},this.getNumberOfTimeFrame=()=>w,this.getCurrentTimeFrame=()=>{if(2{2(c=l*e/(w-1))&&(c=0),c>l&&(c=l))};var he=e=>{if(E===n.PATH&&((e=>{var t=c+e;t>l&&(t-=l),c=t})(e),y)){for(var t=this.getCurrentTimeFrame(),r=t[0],i=t[1],a=t[2],s=[y[3*r],y[3*r+1],y[3*r+2]],o=[y[3*i],y[3*i+1],y[3*i+2]],h=[],u=0;u{he(0)};var ce=()=>{this._state===a.ROTATE||this._state===a.TOUCH_ROTATE?se():this._state===a.PAN||this._state===a.TOUCH_PAN?(ae(),j.triggerCallback()):(this._state===a.ZOOM||this._state===a.TOUCH_ZOOM||this._state===a.SCROLL)&&(j.zoom(oe()),this.previous_pointer_x=this.pointer_x,this.previous_pointer_y=this.pointer_y,this._state===a.SCROLL&&(this._state=a.NONE),C=0,j.triggerCallback())};this.update=e=>{var t=e*M,r=h,i=!0;return E===n.PATH?he(t):E===n.SMOOTH_CAMERA_TRANSITION&&A?(A.update(t),A.isTransitionCompleted()&&(E=n.DEFAULT),r=!1):E===n.ROTATE_CAMERA_TRANSITION&&L?(L.update(t),L.isTransitionCompleted()&&(E=n.DEFAULT),r=!1):E===n.AUTO_TUMBLE&&R?R.update(t):E===n.SYNC_CONTROL&&j?(ce(),r=!1):i=!1,r&&(this._state!==a.NONE&&(i=!0),this._state===a.ROTATE||this._state===a.TOUCH_ROTATE?se():this._state===a.PAN||this._state===a.TOUCH_PAN?ae():(this._state===a.ZOOM||this._state===a.TOUCH_ZOOM||this._state===a.SCROLL)&&le(),this._state!==a.NONE&&E===n.AUTO_TUMBLE&&R&&R.stopOnCameraInput,this._state===a.SCROLL&&(this._state=a.NONE)),S?(i=!0,S.update()):this.cameraObject.lookAt(this.cameraObject.target),i=i||k,k=!1,i},this.playPath=()=>{E=n.PATH},this.stopPath=()=>{E=n.DEFAULT},this.isPlayingPath=()=>E===n.PATH,this.enableDirectionalLightUpdateWithPath=e=>{_=e},this.enableDeviceOrientation=()=>{S||(S=new x(this.cameraObject))},this.disableDeviceOrientation=()=>{S&&(S.dispose(),S=void 0)},this.isDeviceOrientationEnabled=()=>!!S,this.resetView=()=>{var e=Z[T];this.cameraObject.near=e.nearPlane,this.cameraObject.far=e.farPlane,this.cameraObject.position.set(e.eyePosition[0],e.eyePosition[1],e.eyePosition[2]),this.cameraObject.target.set(e.targetPosition[0],e.targetPosition[1],e.targetPosition[2]),this.cameraObject.up.set(e.upVector[0],e.upVector[1],e.upVector[2]),this.cameraObject.updateProjectionMatrix(),this.updateDirectionalLight()},this.setCurrentCameraSettings=e=>{e.nearPlane&&(this.cameraObject.near=e.nearPlane),e.farPlane&&(this.cameraObject.far=e.farPlane),e.eyePosition&&this.cameraObject.position.set(e.eyePosition[0],e.eyePosition[1],e.eyePosition[2]),e.targetPosition&&this.cameraObject.target.set(e.targetPosition[0],e.targetPosition[1],e.targetPosition[2]),e.upVector&&this.cameraObject.up.set(e.upVector[0],e.upVector[1],e.upVector[2]),this.cameraObject.updateProjectionMatrix(),this.updateDirectionalLight(),k=!0},this.getViewportFromCentreAndRadius=(e,t,r,i,n,a)=>{var s=this.cameraObject.position.x-this.cameraObject.target.x,o=this.cameraObject.position.y-this.cameraObject.target.y,l=this.cameraObject.position.z-this.cameraObject.target.z,h=1/Math.sqrt(s*s+o*o+l*l);s*=h,o*=h,l*=h;var c,u=[e,t,r],d=i/Math.tan(n*Math.PI/360),m=[e+s*d,t+o*d,r+l*d],f=d+a;c=a>.95*d?(1-.95)*d:d-a;var v=new p;return v.nearPlane=c,v.farPlane=f,v.eyePosition=m,v.targetPosition=u,v.upVector=[this.cameraObject.up.x,this.cameraObject.up.y,this.cameraObject.up.z],v},this.getViewportFromBoundingBox=(e,t)=>{var r=e.min.distanceTo(e.max)/2*t,i=(e.min.x+e.max.x)/2,n=(e.min.y+e.max.y)/2,a=(e.min.z+e.max.z)/2;return this.getViewportFromCentreAndRadius(i,n,a,r,40,4*r)},this.getCurrentViewport=()=>{var e=new p;return e.nearPlane=this.cameraObject.near,e.farPlane=this.cameraObject.far,e.eyePosition[0]=this.cameraObject.position.x,e.eyePosition[1]=this.cameraObject.position.y,e.eyePosition[2]=this.cameraObject.position.z,e.targetPosition[0]=this.cameraObject.target.x,e.targetPosition[1]=this.cameraObject.target.y,e.targetPosition[2]=this.cameraObject.target.z,e.upVector[0]=this.cameraObject.up.x,e.upVector[1]=this.cameraObject.up.y,e.upVector[2]=this.cameraObject.up.z,e},this.getDefaultEyePosition=()=>eyePosition,this.getDefaultTargetPosition=()=>targetPosition,this.cameraTransition=(e,t,r)=>{null==L&&(A=new m(e,t,this,r))},this.rotateCameraTransition=(e,t,r)=>{null==A&&(L=new f(e,t,this,r))},this.enableCameraTransition=()=>{A&&(E=n.SMOOTH_CAMERA_TRANSITION),L&&(E=n.ROTATE_CAMERA_TRANSITION)},this.pauseCameraTransition=()=>{E=n.DEFAULT},this.stopCameraTransition=()=>{E=n.DEFAULT,A=void 0,L=void 0},this.isTransitioningCamera=()=>E===n.SMOOTH_CAMERA_TRANSITION||E===n.ROTATE_CAMERA_TRANSITION,this.autoTumble=(e,t,r)=>{R=new g(e,t,r,this)},this.enableAutoTumble=()=>{E=n.AUTO_TUMBLE},this.stopAutoTumble=()=>{E=n.DEFAULT,R=void 0},this.updateAutoTumble=()=>{R&&(R.requireUpdate=!0)},this.isAutoTumble=()=>E===n.AUTO_TUMBLE,this.enableRaycaster=(e,t,r)=>{null==o&&(o=new v(e,this.scene,t,r,this.renderer))},this.disableRaycaster=()=>{o.disable(),o=void 0},this.isSyncControl=()=>currentMpde===n.SYNC_CONTROL,this.enableSyncControl=()=>(E=n.SYNC_CONTROL,j||(j=new b),j.setCurrentCameraSettings(this.cameraObject,Z[T]),j),this.disableSyncControl=()=>{E=n.DEFAULT,this.cameraObject.zoom=1,this.cameraObject.updateProjectionMatrix()},this.enable()},t.SmoothCameraTransition=m,t.RotateCameraTransition=f,t.RayCaster=v,t.CameraAutoTumble=g,t.StereoEffect=function(e){var t=new y;t.aspect=.5,this.setSize=(t,r)=>{e.setSize(t,r)},this.render=(r,i)=>{r.updateMatrixWorld(),null===i.parent&&i.updateMatrixWorld(),t.update(i);var n=e.getSize();e.setScissorTest(!0),e.clear(),e.setScissor(0,0,n.width/2,n.height),e.setViewport(0,0,n.width/2,n.height),e.render(r,t.cameraL),e.setScissor(n.width/2,0,n.width/2,n.height),e.setViewport(n.width/2,0,n.width/2,n.height),e.render(r,t.cameraR),e.setScissorTest(!1)}},t.NDCCameraControl=b},3152:(e,t,r)=>{var i=r(1515),n=r(6133)(i),a=r(5672).V,s=r(3515),o=r(7846).A,l=i.BufferGeometryLoader,h=function(e){var t;e&&e.isGeometry&&(t=e);var c=void 0,u=void 0,d=!1,p=void 0;this.getHostGeometry=()=>{var e=new n(t.getMorph());return new m(e)},this.getGeometry=()=>t;var m=e=>{var r=t.getMorph().material.clone();r.morphTargets=!1;var i=e.toMesh(r),n=new a;return n.geometry=i.geometry,i.userData=n,n.setMorph(i),n};this.setCSG=e=>{c.setCSG(e)};var f=(e,t,r,i)=>{if(d)i("On progress");else{var n=e.getMorph(),a=n.geometry.clone().applyMatrix(n.matrix).toJSON();p=r,d=!0,u.postMessage({action:t,object:a})}};this.intersect=e=>new o(((t,r)=>{if(u)f(e,"intersect",t,r);else{var i=c.intersect(e),n=new h(m(i));n.setCSG(i),t(n)}})),this.subtract=e=>new o(((t,r)=>{if(u)f(e,"intersect",t,r);else{var i=c.subtract(e),n=new h(m(i));n.setCSG(i),t(n)}})),this.union=e=>new o(((t,r)=>{if(u)f(e,"intersect",t,r);else{var i=c.union(e),n=new h(m(i));n.setCSG(i),t(n)}})),this.terminateWorker=()=>{u&&u.terminate()},(e=>{if(void 0!==s&&(u=s(4494)),u){if(e&&e.isGeometry){var n=e.getMorph(),o=n.geometry.clone().applyMatrix(n.matrix).toJSON();u.addEventListener("message",(function(e){(e=>{switch(e.data.action){case"message":console.log(e.data.message);break;case"result":var r=new h((e=>{var r=t.getMorph().material.clone();r.morphTargets=!1;var n=new a,s=(new l).parse(e),o=new i.Mesh(s.geometry,r);return n.geometry=o.geometry,o.userData=n,n.setMorph(o),n})(e.data.object));p&&p(r),p=void 0,d=!1;break;default:throw"Cannot handle specified action."}})(e)})),u.postMessage({action:"initialise",object:o})}}else c=new(r(8701).$)(e)})(e)};t.w=h},1602:(e,t,r)=>{var i=r(1515),n=r(6133)(i),a=(r(2842).V,function(e){var t;e&&e.isGlyphset&&(t=e);var s=[];this.setGlyphset=e=>{e&&e.isGlyphset&&(t=e),hostCSG=void 0},this.getGlyphset=()=>t;this.intersect=e=>{var o=(e=>{if(t&&e&&e.getMorph())return 0==s.length&&t.forEachGlyph((e=>{var t=e.getMesh(),r=e.getLabel();if(t){var i=new n(t.geometry.clone().applyMatrix(t.matrix)),a=[];a.csg=i,a.label=r,t.material&&(a.material=t.material.clone()),s.push(a)}})),new n(e.getMorph())})(e);if(0{r(1515);var i=r(9425).B;t.H=function(){var e=this;this.parseGLTFObjects=(t,i,n,a)=>{var s=i;if(0!==n)if("Object3D"!==t.type){var o;if("Mesh"===t.type?o=new(r(5672).V):"LineSegments"===t.type?o=new(r(8145).q):"Points"===t.type&&(o=new(r(770).t)),o){var l=!1,h=!1;t.geometry&&t.geometry.morphAttributes&&(l=!!t.geometry.morphAttributes.position,h=!!t.geometry.morphAttributes.color),o.setMesh(t.clone(),l,h);var c=o.getMorph();o.groupName=c.name,c.matrixAutoUpdate=!0,i.addZincObject(o),null!=a&&"function"==typeof a&&a(o)}}else if(""!==t.name&&(i&&(s=i.findOrCreateChildFromPath(t.name)),s)){var u=s.getGroup();u.position.copy(t.position),u.rotation.copy(t.rotation),u.quaternion.copy(t.quaternion),u.matrixAutoUpdate=!0}n++,t.children.forEach((t=>{e.parseGLTFObjects(t,s,n,a)}))},this.setCamera=e=>{e.viewAll();var t=e.getZincCameraControls(),r=t.getCurrentViewport();t.addViewport("default",r),t.setDefaultViewport("default")},this.load=(t,r,n,a,s)=>{var o=n.substring(0,n.lastIndexOf("/")+1),l=n.substring(n.lastIndexOf("/")+1,n.length);(new i).setPath(o).load(l,(function(i){console.log(i),e.parseGLTFObjects(i.scene,r,0,a),e.setCamera(t),null!=s&&"function"==typeof s&&s()}))}}},807:(e,t,r)=>{"use strict";r.d(t,{q:()=>v});var i=r(1515),n=r(1781).a,a=i.LoaderUtils,s=i.AnimationClip,o=i.Vector3,l=i.Vector4,h=i.Color,c=i.Vector2,u=r(8154).n,d=r(8154).V,p=i.FileLoader,m=i.DefaultLoadingManager,f=r(1574).i;function v(e){"boolean"==typeof e&&(console.warn("THREE.JSONLoader: showStatus parameter has been removed from constructor."),e=void 0),this.manager=void 0===e?m:e,this.withCredentials=!1,this.paramsString=""}Object.assign(v.prototype,{load:function(e,t,r,i){var n=this,s=this.texturePath&&"string"==typeof this.texturePath?this.texturePath:a.extractUrlBase(e),o=new p(this.manager);e.split("?"),this.paramsString=2===e.length?paramsStrings[1]:"",o.setWithCredentials(this.withCredentials),o.load(e,(function(r){var i=JSON.parse(r),a=i.metadata;if(void 0!==a){var o=a.type;if(void 0!==o&&"object"===o.toLowerCase())return void console.error("THREE.JSONLoader: "+e+" should be loaded with THREE.ObjectLoader instead.")}if(n&&n.parse){var l=n.parse(i,s);t(l.geometry,l.materials)}}),r,i)},setTexturePath:function(e){this.texturePath=e},parse:function(e,t){void 0!==e.data&&(e=e.data),e.scale=void 0===e.scale?1:1/e.scale;var r=new d;if(r.morphColors=[],function(e,t){function r(e,t){return e&1<n;n++)I=C[2*(m=D[s++])],O=C[2*m+1],P=new c(I,O),2!==n&&t.faceVertexUvs[i][a].push(P),0!==n&&t.faceVertexUvs[i][a+1].push(P);if(b&&(p=3*D[s++],E.normal.set(B[p++],B[p++],B[p]),A.normal.copy(E.normal)),w)for(i=0;4>i;i++)p=3*D[s++],R=new o(B[p++],B[p++],B[p]),2!==i&&E.vertexNormals.push(R),0!==i&&A.vertexNormals.push(R);if(_&&(L=U[d=D[s++]],E.color.setHex(L),A.color.setHex(L)),M)for(i=0;4>i;i++)L=U[d=D[s++]],2!==i&&E.vertexColors.push(new h(L)),0!==i&&A.vertexColors.push(new h(L));t.faces.push(E),t.faces.push(A)}else{if((T=new u).a=D[s++],T.b=D[s++],T.c=D[s++],y&&(f=D[s++],T.materialIndex=f),a=t.faces.length,x)for(i=0;in;n++)I=C[2*(m=D[s++])],O=C[2*m+1],P=new c(I,O),t.faceVertexUvs[i][a].push(P);if(b&&(p=3*D[s++],T.normal.set(B[p++],B[p++],B[p])),w)for(i=0;3>i;i++)p=3*D[s++],R=new o(B[p++],B[p++],B[p]),T.vertexNormals.push(R);if(_&&(d=D[s++],T.color.setHex(U[d])),M)for(i=0;3>i;i++)d=D[s++],T.vertexColors.push(new h(U[d]));t.faces.push(T)}}(e,r),function(e,t){var r=void 0===e.influencesPerVertex?2:e.influencesPerVertex;if(e.skinWeights)for(var i=0,n=e.skinWeights.length;i{"use strict";r.d(t,{L:()=>m});var i=r(1515),n=/^[og]\s*(.+)?/,a=/^mtllib /,s=/^usemtl /,o=/^usemap /,l=new i.Vector3,h=new i.Vector3,c=new i.Vector3,u=new i.Vector3,d=new i.Vector3;function p(){var e={objects:[],object:{},vertices:[],normals:[],colors:[],uvs:[],materials:{},materialLibraries:[],startObject:function(e,t){if(this.object&&!1===this.object.fromDeclaration)return this.object.name=e,void(this.object.fromDeclaration=!1!==t);var r=this.object&&"function"==typeof this.object.currentMaterial?this.object.currentMaterial():void 0;if(this.object&&"function"==typeof this.object._finalize&&this.object._finalize(!0),this.object={name:e||"",fromDeclaration:!1!==t,geometry:{vertices:[],normals:[],colors:[],uvs:[],hasUVIndices:!1},materials:[],smooth:!0,startMaterial:function(e,t){var r=this._finalize(!1);r&&(r.inherited||0>=r.groupCount)&&this.materials.splice(r.index,1);var i={index:this.materials.length,name:e||"",mtllib:Array.isArray(t)&&0=this.materials[r].groupCount&&this.materials.splice(r,1);return e&&0===this.materials.length&&this.materials.push({name:"",smooth:this.smooth}),t}},r&&r.name&&"function"==typeof r.clone){var i=r.clone(0);i.inherited=!0,this.object.materials.push(i)}this.objects.push(this.object)},finalize:function(){this.object&&"function"==typeof this.object._finalize&&this.object._finalize(!0)},parseVertexIndex:function(e,t){var r=parseInt(e,10);return 3*(0<=r?r-1:r+t/3)},parseNormalIndex:function(e,t){var r=parseInt(e,10);return 3*(0<=r?r-1:r+t/3)},parseUVIndex:function(e,t){var r=parseInt(e,10);return 2*(0<=r?r-1:r+t/2)},addVertex:function(e,t,r){var i=this.vertices,n=this.object.geometry.vertices;n.push(i[e+0],i[e+1],i[e+2]),n.push(i[t+0],i[t+1],i[t+2]),n.push(i[r+0],i[r+1],i[r+2])},addVertexPoint:function(e){var t=this.vertices;this.object.geometry.vertices.push(t[e+0],t[e+1],t[e+2])},addVertexLine:function(e){var t=this.vertices;this.object.geometry.vertices.push(t[e+0],t[e+1],t[e+2])},addNormal:function(e,t,r){var i=this.normals,n=this.object.geometry.normals;n.push(i[e+0],i[e+1],i[e+2]),n.push(i[t+0],i[t+1],i[t+2]),n.push(i[r+0],i[r+1],i[r+2])},addFaceNormal:function(e,t,r){var i=this.vertices,n=this.object.geometry.normals;l.fromArray(i,e),h.fromArray(i,t),c.fromArray(i,r),d.subVectors(c,h),u.subVectors(l,h),d.cross(u),d.normalize(),n.push(d.x,d.y,d.z),n.push(d.x,d.y,d.z),n.push(d.x,d.y,d.z)},addColor:function(e,t,r){var i=this.colors,n=this.object.geometry.colors;void 0!==i[e]&&n.push(i[e+0],i[e+1],i[e+2]),void 0!==i[t]&&n.push(i[t+0],i[t+1],i[t+2]),void 0!==i[r]&&n.push(i[r+0],i[r+1],i[r+2])},addUV:function(e,t,r){var i=this.uvs,n=this.object.geometry.uvs;n.push(i[e+0],i[e+1]),n.push(i[t+0],i[t+1]),n.push(i[r+0],i[r+1])},addDefaultUV:function(){var e=this.object.geometry.uvs;e.push(0,0),e.push(0,0),e.push(0,0)},addUVLine:function(e){var t=this.uvs;this.object.geometry.uvs.push(t[e+0],t[e+1])},addFace:function(e,t,r,i,n,a,s,o,l){var h=this.vertices.length,c=this.parseVertexIndex(e,h),u=this.parseVertexIndex(t,h),d=this.parseVertexIndex(r,h);if(this.addVertex(c,u,d),this.addColor(c,u,d),void 0!==s&&""!==s){var p=this.normals.length;c=this.parseNormalIndex(s,p),u=this.parseNormalIndex(o,p),d=this.parseNormalIndex(l,p),this.addNormal(c,u,d)}else this.addFaceNormal(c,u,d);if(void 0!==i&&""!==i){var m=this.uvs.length;c=this.parseUVIndex(i,m),u=this.parseUVIndex(n,m),d=this.parseUVIndex(a,m),this.addUV(c,u,d),this.object.geometry.hasUVIndices=!0}else this.addDefaultUV()},addPointGeometry:function(e){this.object.geometry.type="Points";for(var t,r=this.vertices.length,i=0,n=e.length;i{"use strict";r.d(t,{t:()=>n});var i=r(1515);class n extends i.Loader{constructor(e){super(e)}load(e,t,r,n){var a=this,s=new i.FileLoader(this.manager);s.setPath(this.path),s.setResponseType("arraybuffer"),s.setRequestHeader(this.requestHeader),s.setWithCredentials(this.withCredentials),s.load(e,(function(r){try{t(a.parse(r))}catch(t){n?n(t):console.error(t),a.manager.itemError(e)}}),r,n)}parse(e){function t(e,t,r){for(var i=0,n=e.length;in;n++)if(t(i,r,n))return!1;return!0}(n)?function(e){for(var t,r,n,a,s,o,l,h,c=new DataView(e),u=c.getUint32(80,!0),d=!1,p=0;p<70;p++)1129270351==c.getUint32(p,!1)&&82==c.getUint8(p+4)&&61==c.getUint8(p+5)&&(d=!0,a=new Float32Array(3*u*3),s=c.getUint8(p+6)/255,o=c.getUint8(p+7)/255,l=c.getUint8(p+8)/255,h=c.getUint8(p+9)/255);for(var m=new i.BufferGeometry,f=new Float32Array(3*u*3),v=new Float32Array(3*u*3),g=0;g>5)/31,n=(31&_>>10)/31):(t=s,r=o,n=l)}for(var M=1;3>=M;M++){var S=y+12*M,T=3*g*3+3*(M-1);f[T]=c.getFloat32(S,!0),f[T+1]=c.getFloat32(S+4,!0),f[T+2]=c.getFloat32(S+8,!0),v[T]=x,v[T+1]=b,v[T+2]=w,d&&(a[T]=t,a[T+1]=r,a[T+2]=n)}}return m.setAttribute("position",new i.BufferAttribute(f,3)),m.setAttribute("normal",new i.BufferAttribute(v,3)),d&&(m.setAttribute("color",new i.BufferAttribute(a,3)),m.hasColors=!0,m.alpha=h),m}(n):function(e){for(var t,r=new i.BufferGeometry,n=/solid([\s\S]*?)endsolid/g,a=/facet([\s\S]*?)endfacet/g,s=0,o=/[\s]+([+-]?(?:\d*)(?:\.\d*)?(?:[eE][+-]?\d+)?)/.source,l=new RegExp("vertex"+o+o+o,"g"),h=new RegExp("normal"+o+o+o,"g"),c=[],u=[],d=new i.Vector3,p=0,m=0,f=0;null!==(t=n.exec(e));){m=f;for(var v=t[0];null!==(t=a.exec(v));){for(var g=0,y=0,x=t[0];null!==(t=h.exec(x));)d.x=parseFloat(t[1]),d.y=parseFloat(t[2]),d.z=parseFloat(t[3]),y++;for(;null!==(t=l.exec(x));)c.push(parseFloat(t[1]),parseFloat(t[2]),parseFloat(t[3])),u.push(d.x,d.y,d.z),g++,f++;1!==y&&console.error("THREE.STLLoader: Something isn't right with the normal of face number "+s),3!==g&&console.error("THREE.STLLoader: Something isn't right with the vertices of face number "+s),s++}var b=m,w=f-m;r.addGroup(b,w,p),p++}return r.setAttribute("position",new i.Float32BufferAttribute(c,3)),r.setAttribute("normal",new i.Float32BufferAttribute(u,3)),r}("string"==typeof(r=e)?r:i.LoaderUtils.decodeText(new Uint8Array(r)))}}},1915:(e,t,r)=>{function i(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,i)}return r}function n(e){for(var t,r=1;r{var t=h[e.index];if(t){var r=n.parse(t);e.onLoad(r.geometry,r.materials)}else f(e,{responseURL:o})},f=e=>{e.onError&&(!d&&(d={responseURL:o}),e.onError(d))};this.downloadCompleted=e=>{try{h=JSON.parse(e[0]),c=!1,u=!0,Array.isArray(h)?p.forEach((e=>m(e))):p.forEach((e=>f(e)))}catch(e){p.forEach((e=>f(e)))}};var v=()=>e=>{d=e,u=!0,c=!1,p.forEach((e=>{f(e)}))},g=()=>e=>{p.forEach((t=>{t.onProgress&&t.onProgress(e)}))};this.load=(e,t,r,n)=>{var a={index:e,onLoad:t,onProgress:r,onError:n};u?h?m(a):f(d):c?p.push(a):(p.push(a),c=!0,i.load(o,l,g,v))}},l=function(e,t){var r=[],i=e,n=t,a=0;this.itemDownloaded=(e,t)=>{if(r[e]=t,++a==i){for(var s=r[0][1],o=(e=>{var t=(e,t)=>{e.merge(t)};if(e&&0e[0]))),l=1;le.dispose()));n(o,s)}}};t._=function(){var e=0;this.crossOrigin="Anonymous";var t=new a,r=[],i={},s=(t,a,s,l,h)=>{var u=h?n({},h):{},d=i[t];if(!d)if(20>e){var p=new c(void 0,this,u);++e,d=new o(t,this.crossOrigin,p),i[t]=d}else r.push({url:t,onLoad:a,onProgress:s,onError:l,options:h});d&&(u.isHandler=d,d.load(h.index,a,s,l))},h=(i,n,a,o,l)=>{if(l&&void 0!==l.index)s(i,n,a,o,l);else if(20>e){++e;var h=new c(n,this,l),u=new c(o,this,l);t.crossOrigin=this.crossOrigin,t.load(i,h,a,u)}else r.push({url:i,onLoad:n,onProgress:a,onError:o,options:l})};this.load=(e,t,r,i,a)=>{Array.isArray(e)?((e,t,r,i,a)=>{var s=e.length,o=new l(s,t),c=0;e.forEach((e=>{var s=a?n({},a):{};s.msHandler=o,s.order=c,c++,h(e,t,r,i,s)}))})(e,t,r,i,a):h(e,t,r,i,a)},this.loadFromWaitingList=()=>{for(;20>e;){var t=r.shift();if(!t)return;this.load(t.url,t.onLoad,t.onProgress,t.onError,t.options)}},this.itemRemainingCheck=()=>{if(0===r.length&&0==e)for(var t in i)i.hasOwnProperty(t)&&delete i[t]};var c=function(t,r,i){return function(){--e;for(var n=arguments.length,a=Array(n),s=0;st.parse(e)}},7404:(e,t,r)=>{var i=r(1515);t.U=function(e){var t=e;this.camera=new i.OrthographicCamera(-.5,.5,.5,-.5,.01,10),this.helper=void 0;var r=new i.BufferGeometry,n=new Float32Array([-1,-1,1,1,-1,1,1,1,1,1,1,1,-1,1,1,-1,-1,1]),a=new i.BufferAttribute(n,3);r.setAttribute("position",a);var s=new i.MeshBasicMaterial({color:3355443,depthTest:!1,depthWrite:!1,opacity:.5,transparent:!0});this.mask=new i.Mesh(r,s);var o=new i.Box3,l=new i.Vector3;this.getDiffFromNormalised=(e,t)=>{o.setFromBufferAttribute(a).getCenter(l);var r=l.clone().project(this.camera);return new i.Vector3(e,t,r.z).unproject(this.camera).sub(l)};var h=(e,r)=>{t.camera.near&&(this.camera.near=t.camera.near),r.farPlane&&(this.camera.far=r.farPlane),r.eyePosition&&this.camera.position.set(r.eyePosition[0],r.eyePosition[1],r.eyePosition[2]),r.upVector&&this.camera.up.set(r.upVector[0],r.upVector[1],r.upVector[2]),r.targetPosition&&this.camera.lookAt(new i.Vector3(r.targetPosition[0],r.targetPosition[1],r.targetPosition[2])),this.camera.zoom=1/e,this.camera.updateProjectionMatrix()};this.getBoundary=()=>{var e=(new i.Vector3).copy(t.camera.target).project(t.camera),r=new i.Vector3(-1,-1,e.z).unproject(t.camera),n=new i.Vector3(1,-1,e.z).unproject(t.camera),s=new i.Vector3(1,1,e.z).unproject(t.camera),o=new i.Vector3(-1,1,e.z).unproject(t.camera);a.copyVector3sArray([r,n,s,s,o,r]),a.needsUpdate=!0},this.updateCamera=()=>{this.getBoundary();var e=t.getZincCameraControls(),r=t.getBoundingBox();if(r){var i=r.min.distanceTo(r.max),n=i/2,a=(r.min.x+r.max.x)/2,s=(r.min.y+r.max.y)/2,o=(r.min.z+r.max.z)/2,l=e.getViewportFromCentreAndRadius(a,s,o,n,40,4*n);h(i,l)}}}},9960:(e,t)=>{t.augmentMorphColor=function(){return function(e){e.vertexShader=e.vertexShader.replace("#include ",["varying vec3 vColor;","attribute vec3 morphColor0;","attribute vec3 morphColor1;"].join("\n")),e.vertexShader=e.vertexShader.replace("#include ",["vColor.xyz = color.xyz;","#ifdef USE_MORPHTARGETS","vColor = morphColor0 * morphTargetInfluences[ 0 ];","vColor += morphColor1 * morphTargetInfluences[ 1 ];","#endif"].join("\n"))}}},5672:function(e,t,r){var i=r(1515),n=r(2515).toBufferGeometry,a=function(){r(7393).c.call(this),this.videoHandler=void 0,this.isGeometry=!0,this.createMesh=(e,t,a)=>{if(!this.morph||!this.morph.geometry||null==e){var s=((e,t,a)=>{var s,o=n(e,a),l=!1;if(1>a.opacity&&(l=!0),void 0===o._video){var h=a.localTimeEnabled||a.localMorphColour;t?((s=t).morphTargets=h,s.morphNormals=a.localTimeEnabled):s=o instanceof i.BufferGeometry&&void 0===o.attributes.color?new i.MeshPhongMaterial({color:a.colour,morphTargets:h,morphNormals:a.localTimeEnabled,transparent:l,opacity:a.opacity,side:i.DoubleSide}):new i.MeshPhongMaterial({color:a.colour,morphTargets:h,morphNormals:a.localTimeEnabled,vertexColors:i.VertexColors,transparent:l,opacity:a.opacity,side:i.DoubleSide}),a.localMorphColour&&o.morphAttributes.color&&(s.onBeforeCompile=r(9960).augmentMorphColor())}else{var c=o._video.createCanvasVideoTexture();s=new i.MeshBasicMaterial({morphTargets:a.localTimeEnabled,color:new i.Color(1,1,1),transparent:l,opacity:a.opacity,map:c,side:i.DoubleSide}),o._video}return new i.Mesh(o,s)})(e,t,a);this.setMesh(s,a.localTimeEnabled,a.localMorphColour)}},this.calculateUVs=()=>{this.geometry.computeBoundingBox();var e=this.geometry.boundingBox.max,t=this.geometry.boundingBox.min,r=new i.Vector2(0-t.x,0-t.y),n=new i.Vector2(e.x-t.x,e.y-t.y);this.geometry.faceVertexUvs[0]=[];for(var a=0;a{this.morph.material.wireframe=e},this.editVertices=function(e,t){if(e&&e.length){var r=this.getMorph(),i=r.geometry.getAttribute("position");if(!r||0>t)return;var n=3*t;e.forEach((e=>{i.array[n++]=e[0],i.array[n++]=e[1],i.array[n++]=e[2]})),i.needsUpdate=!0,r.geometry.computeBoundingBox(),r.geometry.computeBoundingSphere(),this.boundingBoxUpdateRequired=!0}}};a.prototype=Object.create(r(7393).c.prototype),t.V=a},9344:(e,t,r)=>{var i=r(1515),n=function(e,t,n,a){var s;r(7393).c.call(this),t&&((s=t.clone()).vertexColors=i.FaceColors),this.id=n;var o=void 0,l=void 0;this.isGlyph=!0,this.fromMesh=e=>!(!e||!e.isMesh||(this.morph=e.clone(),this.morph.userData=this,this.group.add(this.morph),0)),e&&s&&this.fromMesh(new i.Mesh(e,s)),this.getGlyphset=function(){return a},this.setLabel=e=>{e&&("string"==typeof e||e instanceof String)&&(l=e,this.morph&&(this.morph.name=e)),o&&this.showLabel()},this.showLabel=e=>{if(o&&(position=o.getPosition(),this.group.remove(o.getSprite()),o.dispose(),o=void 0),l&&("string"==typeof l||l instanceof String)){var t=[0,0,0];(o=new(r(4296).J)(l,e)).setPosition(t[0],t[1],t[2]),this.group.add(o.getSprite())}},this.getLabel=()=>l,this.getMesh=()=>this.morph,this.setTransformation=(e,t,r,i)=>{this.morph&&(this.morph.matrix.elements[0]=t[0],this.morph.matrix.elements[1]=t[1],this.morph.matrix.elements[2]=t[2],this.morph.matrix.elements[3]=0,this.morph.matrix.elements[4]=r[0],this.morph.matrix.elements[5]=r[1],this.morph.matrix.elements[6]=r[2],this.morph.matrix.elements[7]=0,this.morph.matrix.elements[8]=i[0],this.morph.matrix.elements[9]=i[1],this.morph.matrix.elements[10]=i[2],this.morph.matrix.elements[11]=0,this.morph.matrix.elements[12]=e[0],this.morph.matrix.elements[13]=e[1],this.morph.matrix.elements[14]=e[2],this.morph.matrix.elements[15]=1,this.morph.matrixAutoUpdate=!1),o&&o.setPosition(e[0],e[1],e[2])},this.setColour=e=>{o&&o.setColour(e),this.secondaryMesh&&this.secondaryMesh.material&&(this.secondaryMesh.material.color=colour),this.geometry.colorsNeedUpdate=!0},this.dispose=()=>{this.material&&this.material.dispose(),this.morph=void 0}};n.prototype=Object.create(r(7393).c.prototype),t.z=n},2842:(e,t,r)=>{function i(e){throw new TypeError('"'+e+'" is read-only')}var n=r(1515),a=r(807).q,s=function(){r(7393).c.call(this);var e=[],t=void 0,s=void 0,o=void 0,l=void 0,h=void 0,c=void 0,u=void 0,d=0,p=0,m=[0,0,0],f=[0,0,0],v=[0,0,0],g="NONE";this.ready=!1;var y=!1,x=!1;this.isGlyphset=!0;for(var b=new n.Matrix4,w=new n.Color,_=new n.Color,M=new n.Box3,S=new n.Box3,T=new n.Box3,E=[],A=[],L=[],R=[],C=[],P=[],I=[],O=[],D=0;8>D;D++)E[D]=new n.Vector3;this.load=(e,r,i,b,w)=>{t=e.axis1,s=e.axis2,o=e.axis3,l=e.positions,h=e.scale,c=e.colors,u=e.label,y=e.metadata.MorphColours,x=e.metadata.MorphVertices,d=e.metadata.number_of_time_steps,g=e.metadata.repeat_mode,p=e.metadata.number_of_vertices,"AXES_2D"==g||"MIRROR"==g?p*=2:"AXES_3D"==g&&(p*=3),m=e.metadata.base_size,f=e.metadata.offset,v=e.metadata.scale_factors;var _=new a;this.geometry=new n.BufferGeometry;var M=new n.InstancedMesh(this.geometry,void 0,p);if(this.setMorph(M),b){var S=_.parse(r);G(i,w)(S.geometry,S.materials),S.geometry.dispose()}else _.crossOrigin="Anonymous",_.load(r,G(i,w))};var N=(e,t,r,i,n,a)=>{if("NONE"==g||"MIRROR"==g){for(var s=[0,0,0],o=[0,0,0],l=[0,0,0],h=[0,0,0],c=[0,0,0],u=[0,0,0],d=[0,0,0],p=[0,0,0],y=[0,0,0],x=0;3>x;x++)b=0>n[x]?-1:1,s[x]=b*m[x]+n[x]*v[x];for(x=0;3>x;x++)o[x]=t[x]*s[0],l[x]=r[x]*s[1],h[x]=i[x]*s[2],c[x]=e[x]+f[0]*o[x]+f[1]*l[x]+f[2]*h[x],"MIRROR"==g&&(u[x]=-o[x],d[x]=-l[x],p[x]=-h[x],y[x]=c[x],0>n[0]&&(c[x]-=o[x],y[x]-=u[x]));0>h[0]*(o[1]*l[2]-o[2]*l[1])+h[1]*(o[2]*l[0]-o[0]*l[2])+h[2]*(o[0]*l[1]-o[1]*l[0])&&(h[0]=-h[0],h[1]=-h[1],h[2]=-h[2]),a[0]=[c,o,l,h],"MIRROR"==g&&(0>p[0]*(u[1]*d[2]-u[2]*d[1])+p[1]*(u[2]*d[0]-u[0]*d[2])+p[2]*(u[0]*d[1]-u[1]*d[0])&&(p[0]=-p[0],p[1]=-p[1],p[2]=-p[2]),a[1]=[y,u,d,p])}else if("AXES_2D"==g||"AXES_3D"==g){var b,w=[0,0,0],_=[0,0,0];for(x=0;3>x;x++)b=0>n[x]?-1:1,w[x]=b*m[0]+n[x]*v[0];for(x=0;3>x;x++)_[x]=e[x]+f[0]*w[0]*t[x]+f[1]*w[1]*r[x]+f[2]*w[2]*i[x];for(var M="AXES_2D"==glyph_repeat_mode?2:3,S=0;S{var s=1;"AXES_2D"==g||"MIRROR"==g?s=2:"AXES_3D"==g&&(s=3);var o=t.length/3,l=0;O.length=s;for(var h=0;h{var r=1;"AXES_2D"==g||"MIRROR"==g?r=2:"AXES_3D"==g&&(r=3);for(var i,n=t.length,a=0,s=0;s{var e=A,r=L,n=R,a=C,u=P,p=I,m=this.inbuildTime/this.duration*(d-1),f=Math.floor(m),v=1-(m-f),g=Math.ceil(m);if(x){var b=l[f.toString()],M=l[g.toString()],S=t[f.toString()],T=t[g.toString()],E=s[f.toString()],O=s[g.toString()],D=o[f.toString()],N=o[g.toString()],z=h[f.toString()],F=h[g.toString()];A.length=b.length,L.length=b.length,R.length=b.length,C.length=b.length,P.length=b.length;for(var G=0;G{for(var t=0;t{if(null!=u&&i)for(var n,a=0;a{t.isGlyph&&e.push(t),this.ready=!0,this.boundingBoxUpdateRequired=!0},this.addMeshAsGlyph=(t,i)=>{if(t.isMesh){var n=new(r(9344).z)(void 0,void 0,i,this);return n.fromMesh(t),e.push(n),this.morph.add(n.getGroup()),this.ready=!0,this.boundingBoxUpdateRequired=!0,n}},this.forEachGlyph=t=>{for(var r=0;r(r,i)=>{var n=r.toBufferGeometry();this.geometry.copy(n),this.geometry.computeBoundingSphere(),this.geometry.computeBoundingBox(),n.dispose(),i&&i[0]&&(this.morph.material=i[0]),F(t),this.morph.name=this.groupName,this.morph.userData=this,this.setMorph(this.morph),r.dispose(),null!=e&&"function"==typeof e&&e(this)};this.getClosestVertexIndex=function(){var e=-1;if(this.morph&&this.ready){this.getBoundingBox().getCenter(this._v1);for(var t,r=l[0],i=r.length/3,n=-1,a=0,s=0;sa)&&(n=a,e=s)}return e},this.getClosestVertex=function(){if(-1==this.closestVertexIndex&&(this.closestVertexIndex=this.getClosestVertexIndex()),0<=this.closestVertexIndex&&this.morph){var e=new n.Vector3;return this.morph.getMatrixAt(this.closestVertexIndex,b),e.setFromMatrixPosition(b),e}},this.getBoundingBox=()=>{if(this.morph&&this.ready&&this.morph.visible){if(this.boundingBoxUpdateRequired){M.setFromBufferAttribute(this.morph.geometry.attributes.position);for(var e=0;e{this.inbuildTime=e>this.duration?this.duration:0>e?0:e,(y||x)&&(z(),x&&(this.markerUpdateRequired=!0))},this.isTimeVarying=()=>!(!(!1===this.ready||0this.inbuildTime,this.dispose=()=>{for(var r=e.length-1;0<=r;r--)e[r].dispose();this.geometry&&this.geometry.dispose(),this.morph&&this.morph.material.dispose(),t=void 0,s=void 0,o=void 0,l=void 0,h=void 0,c=void 0,this.ready=!1,this.groupName=void 0},this.render=(e,t,r)=>{if(1==t){var i=this.inbuildTime+e;i>this.duration&&(i-=this.duration),this.inbuildTime=i,(y||x)&&z()}this.updateMarker(t,r)}};s.prototype=Object.create(r(7393).c.prototype),t.V=s},4296:(e,t,r)=>{var i=r(8221).A;t.J=function(e,t){var r=e,n=void 0;(n=t?new i(r,.015,t.getStyle()):new i(r,.015)).fontFace="Asap",n.fontWeight=700,n.material.map.generateMipmaps=!1,n.material.sizeAttenuation=!1,n.center.x=-.05,n.center.y=0,this.getPosition=()=>n?[n.position.x,n.position.y,n.position.z]:[0,0,0],this.setPosition=(e,t,r)=>{n&&n.position.set(e,t,r)},this.setColour=e=>{n.color=e.getStyle()},this.setScale=e=>{n&&0{n.dispose()},this.getSprite=()=>n,this.getString=()=>r}},8145:(e,t,r)=>{var i=r(1515),n=r(2515).toBufferGeometry,a=function(){r(7393).c.call(this),this.isLines=!0,this.createLineSegment=(e,t,i)=>{if(e&&t){var a=n(e,i);i.localMorphColour&&a.morphAttributes.color&&(t.onBeforeCompile=r(9960).augmentMorphColor());var s=new(r(1491).D)(a,t);this.setMesh(s,i.localTimeEnabled,i.localMorphColour)}},this.setWidth=e=>{this.morph&&this.morph.material&&(this.morph.material.linewidth=e,this.morph.material.needsUpdate=!0)},this.addLines=(e,t)=>{if(e&&0{r(1515),r(2515).toBufferGeometry;var i=r(8233).b,n=r(9236).G,a=r(5807).n,s=function(){r(8145).q.call(this),this.isLines2=!0;var e=Array(300);this.createLineSegment=(e,t,r)=>{if(e&&t){var n=new a;n.setPositions(e),n.colorsNeedUpdate=!0;var s=new i(n,t);s.scale.set(1,1,1),s.computeLineDistances(),this.setMesh(s,r.localTimeEnabled,r.localMorphColour)}},this.setWidth=e=>{this.morph&&this.morph.material&&(this.morph.material.linewidth=e,this.morph.material.needsUpdate=!0)},this.addVertices=function(t){if(t&&t.length){var r=this.getMorph();r||(this.drawRange=0);var i=3*this.drawRange;if(t.forEach((t=>{e[i++]=t[0],e[i++]=t[1],e[i++]=t[2],this.drawRange++})),!r)for(;300>i;)e[i++]=t[0][0],e[i++]=t[0][1],e[i++]=t[0][2];r&&(r.geometry.setPositions(e),r.computeLineDistances(),this.boundingBoxUpdateRequired=!0)}return e},this.getVerticesByFaceIndex=function(e){var t=2*e*3,r=this.getMorph();if(r&&3*this.drawRange>t){var i=r.geometry.getAttribute("instanceStart");return[[i.data.array[t],i.data.array[++t],i.data.array[++t]],[i.data.array[++t],i.data.array[++t],i.data.array[++t]]]}return[]},this.editVertices=function(t,r){if(t&&t.length){var i=this.getMorph(),n=r+t.length-1;if(!i||0>r||n>=this.drawRange)return;var a=3*r;for(t.forEach((t=>{e[a++]=t[0],e[a++]=t[1],e[a++]=t[2]})),a=3*this.drawRange;300>a;)e[a++]=t[0][0],e[a++]=t[0][1],e[a++]=t[0][2];i.geometry.setPositions(e),i.computeLineDistances(),this.boundingBoxUpdateRequired=!0}return e},this.addLines=(t,r)=>{if(t&&0{this.getMorph().material.resolution.set(window.innerWidth,window.innerHeight)}};(s.prototype=Object.create(r(8145).q.prototype)).constructor=s,t.s=s},9801:(e,t,r)=>{var i=r(1515),n=r(2515).updateMorphColorAttribute,a=r(2515).toBufferGeometry;t.U=function(e){this.levels=[],this._currentLevel=0,this._renderOrder=1,this._material=void 0,this._secondaryMaterial=void 0,this._loader=void 0,this._parent=e,this.addLevel=(e,t)=>{if(e){var r,i=Math.abs(t);for(r=0;r{if(e){for(var r=Math.abs(t),i=0;i{this._loader=e;var a,s=this.calculateDistance(t);for(a=0;a{var t=this.levels[e];return t.morph||t.loaded||t.loading||(t.loading=!0,this._loader.load(t.url,this.lodLoader(t.distance),void 0,void 0,{index:t.index})),void 0===t.morph},this.calculateDistance=function(e){this._parent.getBoundingBox();var t=this._parent.radius,r=0;return"far"===e?r=4.5*t:"medium"===e?r=2.5*t:"close"==e&&(r=0),r},this.containsLevels=()=>!!(this.levels&&1{var e=this.levels[this._currentLevel];this._material&&(this._material.transparent?(!this._secondaryMaterial&&(this._secondaryMaterial=this._material.clone(),this._secondaryMaterial.side=i.FrontSide),this._secondaryMaterial.opacity=this._material.opacity,this._secondaryMaterial.emissive&&this._secondaryMaterial.emissive.copy(this._material.emissive),this._secondaryMaterial.needsUpdate=!0,!e.secondaryMesh&&(e.secondaryMesh=new i.Mesh(e.morph.geometry,this._secondaryMaterial),e.secondaryMesh.renderOrder=e.morph.renderOrder+1,e.secondaryMesh.userData=e.morph.userData,e.secondaryMesh.name=e.morph.name),this._material.side=i.BackSide,this._material.needsUpdate=!0,!e.secondaryMesh.parent&&(e.morph.add(e.secondaryMesh),this._parent.animationGroup&&this._parent.animationGroup.add(e.secondaryMesh))):(e.secondaryMesh&&(e.morph.remove(e.secondaryMesh),this._parent.animationGroup&&(this._parent.animationGroup.uncache(e.secondaryMesh),this._parent.animationGroup.remove(e.secondaryMesh))),this._material.side=i.DoubleSide,this._material.needsUpdate=!0))},this.dispose=()=>{this.levels.forEach((e=>{e.morph&&e.morph.geometry&&e.morph.geometry.dispose()})),this._material&&this._material.dispose(),this._secondaryMaterial&&this._secondaryMaterial.dispose()},this.getCurrentLevel=()=>this._currentLevel,this.getCurrentMorph=()=>{var e=this.levels[this._currentLevel];return e&&e.morph?e.morph:this._parent.morph},this.lodLoader=function(e){return t=>{var n=this._material,s={localTimeEnabled:this._parent.timeEnabled,localMorphColour:this._parent.morphColour},o=a(t,s),l=void 0;this._parent.isGeometry?l=new i.Mesh(o,n):this._parent.isLines&&(l=new(r(1491).D)(o,n)),l.userData=this._parent,l.renderOrder=this._renderOrder,t.dispose(),this.levelLoaded(l,e)}},this.updateMorphColorAttribute=e=>{if(this._material&&(this._material.vertexColors==i.VertexColors||1==this._material.vertexColors))if(e){var t=this.getCurrentMorph();n(t.geometry,t)}else this.levels.forEach((e=>{e.morph&&e.morph.geometry&&n(e.morph.geometry,e.morph)}))},this.setColour=e=>{this._material.color=e,this._secondaryMaterial&&(this._secondaryMaterial.color=e),t()},this.setFrustumCulled=e=>{this.levels.forEach((t=>{t.morph&&(t.morph.frustumCulled=e),t.secondaryMesh&&(t.secondaryMesh.frustumCulled=e)}))},this.setMaterial=e=>{e&&(!this._material||this._material.id!==e.id)&&(this._material=e,this._secondaryMaterial&&this._secondaryMaterial.dispose(),this._secondaryMaterial=e.clone(),this._secondaryMaterial.side=i.FrontSide,this._secondaryMaterial.transparent=!0,this.levels.forEach((e=>{e.morph&&(e.morph.material=this._material,e.morph.geometry&&(e.morph.geometry.colorsNeedUpdate=!0)),e.secondaryMesh&&(e.secondaryMesh.material=this._secondaryMaterial)})))},this.setName=e=>{this.levels.forEach((t=>{t.morph&&(t.morph.name=e),t.secondaryMesh&&(t.secondaryMesh.name=e)}))},this.setRenderOrder=e=>{this._renderOrder=e,this.levels.forEach((t=>{t.morph&&(t.morph.renderOrder=e),t.secondaryMesh&&(t.secondaryMesh.renderOrder=e)}))},this.setVertexColors=e=>{this._material.vertexColors=e,t(),this._secondaryMaterial&&(this._secondaryMaterial.vertexColors=e)},this.update=(e,t)=>{var r=this.levels;if(1=r[i].distance;i++)r[i].morph?(-1{this.levels.forEach((r=>{r.morph&&(t?r.morph.add(e):r.morph.remove(e))}))};var t=()=>{this.levels.forEach((e=>{e.morph&&e.morph.geometry&&(e.morph.geometry.colorsNeedUpdate=!0)}))}}},4834:(e,t,r)=>{var i=r(1515),n=new Image(128,128);n.src=r(2370);var a=new i.Texture;a.image=n,a.needsUpdate=!0;var s=[.02,.03,1],o=new i.SpriteMaterial({map:a,alphaTest:.5,transparent:!0,depthTest:!1,depthWrite:!1,sizeAttenuation:!1}),l=r(2515).createNewSpriteText,h=function(e){r(7393).c.call(this),this.texture=a;var t=void 0,n=void 0,h=void 0,c=void 0,u=void 0,d=!0;this.morph=new i.Group,this.group=this.morph,this.parent=e,this.isMarker=!0;var p=!1;this.ndc=new i.Vector3;var m=void 0,f=void 0;this.updateVisual=(e,t)=>{var r=1;e!==t&&(r=.6+.4*(1-(this.ndc.z-e)/(t-e))),this.setSpriteSize(r)},this.updateNDC=e=>(this.ndc.copy(this.morph.position),this.ndc.project(e),this.ndc.z=Math.min(Math.max(this.ndc.z,0),1),this.ndc),this.setPosition=(e,t,r)=>{this.morph.position.set(e,t,r)},this.setSpriteSize=e=>{t.scale.set(.015,.02,1),t.scale.multiplyScalar(e)},this.setUserSprite=()=>{c&&(this.morph.add(c),d&&(this.morph.remove(t),f&&this.morph.remove(f),d=!1))},this.setImageForUserSprite=(e,t)=>{c&&(this.morph.remove(c),c=void 0),n&&n.dispose(),h&&h.dispose(),(n=new i.Texture).image=e,n.needsUpdate=!0,h=new i.SpriteMaterial({map:n,alphaTest:.5,transparent:!0,depthTest:!1,depthWrite:!1,sizeAttenuation:!1}),t||(t=[.05,.05,1]),(c=new i.Sprite(h)).center.set(.5,0),c.scale.set(t[0],t[1],t[2]),c.userData=this,this.setUserSprite()},this.setDefaultSprite=()=>{d||(d=!0,this.morph.add(t),c&&this.morph.remove(c),f&&this.morph.add(f))},this.loadUserSprite=(e,t)=>{if(e)if(e!==u){u=e;var r=new Image(128,128);r.crossOrigin="anonymous",r.onload=()=>{this.setImageForUserSprite(r,t)},r.src=e}else this.setUserSprite()},this.dispose=()=>{this.morph&&this.morph.clear(),t&&(t.clear(),t=void 0),f&&(f.material.map.dispose(),f.material.dispose(),f=void 0)},this.isEnabled=()=>p,this.setNumber=e=>{(!e||m!=e)&&f&&(this.morph.remove(f),f.material.map.dispose(),f.material.dispose(),f=void 0),!f&&e&&(f=l(e,.012,"black","Asap",120,700),this.morph.add(f)),m=e},this.getNumber=()=>m||1,this.setVisibility=function(e){e!==this.visible&&(this.visible=e,this.group.visible=e,this.parent.region&&(this.parent.region.pickableUpdateRequired=!0))},this.enable=()=>{p=!0,this.morph.visible=!0,this.visible=!0},this.disable=()=>{p=!1,this.morph.visible=!1,this.visible=!1},(()=>{(t=new i.Sprite(o)).center.set(.5,0),this.morph.add(t),this.morph.position.set(0,0,0),this.morph.renderOrder=1e4,t.scale.set(s[0],s[1],s[2]),t.userData=this})()};h.prototype=Object.create(r(7393).c.prototype),t.p=h},2970:(e,t,r)=>{function i(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,i)}return r}var n=r(1515),a=new Image(128,128);a.src=r(7328);var s=new n.Texture;s.image=a,s.needsUpdate=!0;var o=[.02,.03,1],l=new n.SpriteMaterial({map:s,alphaTest:.5,transparent:!0,depthTest:!1,depthWrite:!1,sizeAttenuation:!1}),h=r(2515).createNewSpriteText,c=function(e){r(7393).c.call(this),this.texture=s;var t=void 0;this.morph=new n.Group,this.group=this.morph,this.isMarkerCluster=!0;var a=!0,c=[];this.markers={};var u=new n.Vector2,d=new n.Vector2,p=Date.now();this.setSpriteSize=e=>{t.scale.set(.015,.02,1),t.scale.multiplyScalar(e)},this.clear=()=>{this.group.clear(),this.markers={}},this.dispose=()=>{this.clear(),this.morph&&this.morph.clear()};var m=e=>{var t=new n.Group,r=new n.Sprite(l);return r.clusterIndex=e,r.center.set(.5,0),r.position.set(0,0,0),r.renderOrder=1e4,r.scale.set(o[0],o[1],o[2]),r.userData=this,t.add(r),this.group.add(t),{group:t,marker:r,label:void 0,number:0,min:[0,0,0],max:[1,1,1]}},f=(e,t)=>{var r=!0,i={members:[],coords:[0,0,0],min:[0,0,0],max:[1,1,1]};for(var n in e)r?(u.set(e[n].ndc.x,e[n].ndc.y),this._b1.setFromPoints([e[n].morph.position]),r=!1,i.members.push(e[n]),i.coords=[e[n].morph.position.x,e[n].morph.position.y,e[n].morph.position.z],t.push(i),delete e[n]):(d.set(e[n].ndc.x,e[n].ndc.y),.1>u.distanceTo(d)&&(i.members.push(e[n]),this._b1.expandByPoint(e[n].morph.position),delete e[n]));i.min=[this._b1.min.x,this._b1.min.y,this._b1.min.z],i.max=[this._b1.max.x,this._b1.max.y,this._b1.max.z],1!=r&&f(e,t)};this.calculate=()=>{if(a&&500{var t=0;for(e.forEach((e=>{var r=e.members.length,i=0;1===r?e.members[0].setVisibility(!0):(e.members.forEach((e=>{i+=e.getNumber(),e.setVisibility(!1)})),!c[t]&&c.push(m(t)),((e,t,r)=>{e.group.visible=!0,e.group.position.set(t.coords[0],t.coords[1],t.coords[2]),(void 0===e.label||r!==e.number)&&(e.label&&(e.group.remove(e.label),e.label.material.map.dispose(),e.label.material.dispose()),e.label=h(r,.012,"black","Asap",120,700),e.number=r,e.group.add(e.label)),e.min=t.min,e.max=t.max})(c[t],e,i),t++)}));ta,this.enable=()=>{a=!0,this.morph.visible=!0},this.disable=()=>{for(var e in a=!1,this.morph.visible=!1,this.markers){var t;null!==(t=this.markers[e])&&void 0!==t&&t.isMarker&&this.markers[e].isEnabled()&&this.markers[e].setVisibility(!0)}},this.zoomToCluster=t=>!!(void 0!==t&&-1{var t;return!!(void 0!==e&&-1{var i=r(1515),n=r(377).O,a=r(2515).toBufferGeometry,s=r(2515).getCircularTexture,o=r(4296).J,l=function(){r(7393).c.call(this),this.isPointset=!0;var e=[];this.createMesh=(e,t,r)=>{if(e&&t){var i=a(e,r),o=s();t.map=o;var l=new n(i,t);this.setMesh(l,r.localTimeEnabled,r.localMorphColour)}};var t=(t,r,n,a)=>{if(n){var s=new i.Color(a),l=new o(n,s);l.setPosition(r[0],r[1],r[2]);var h=l.getSprite();h.material.sizeAttenuation=!1,h.material.alphaTest=.5,h.material.transparent=!0,h.material.depthWrite=!1,h.material.depthTest=!1,this.group.add(h),e[t]=l}};this.addPoints=(e,r,n)=>{if(e&&0{this.morph&&this.morph.material&&(this.morph.material.size=e,this.morph.material.needsUpdate=!0)},this.setSizeAttenuation=e=>{this.morph&&this.morph.material&&(this.morph.material.sizeAttenuation=e,this.morph.material.needsUpdate=!0)},this.getVerticesByIndex=function(e){if(0<=e&&this.drawRange>e){var t=this.getMorph().geometry.getAttribute("position");return[t.getX(e),t.getY(e),t.getZ(e)]}},this.editVertices=function(t,r){if(t&&t.length){var i=this.getMorph(),n=r+t.length-1;if(!i||0>r||n>=this.drawRange)return;var a=i.geometry.getAttribute("position"),s=r;t.forEach((t=>{var r=e[s];r&&r.setPosition(t[0],t[1],t[2]),a.setXYZ(s++,t[0],t[1],t[2])})),a.needsUpdate=!0,this.boundingBoxUpdateRequired=!0}},this.render=(e,t,r,i)=>{this.morph&&r&&(this.morph.sizePerPixel=r.pixelHeight),l.prototype.render.call(this,e,t,r,i)}};l.prototype=Object.create(r(7393).c.prototype),t.t=l},9372:(e,t,r)=>{r(1515);var i=r(2515).resolveURL,n=function(e){r(7393).c.call(this),this.isTexturePrimitive=!0,this.texture=e,this.load=(e,t)=>{if(e&&e.images&&e.images.source){var n=new(r(3523).$),a=[];e.images.source.forEach((e=>{a.push(i(e))}));var s=this;n.loadFromImages(a).then((()=>{s.texture=n,s.initialise(e,t)}))}},this.initialise=(e,t)=>{null!=t&&"function"==typeof t&&t(this)}};(n.prototype=Object.create(r(7393).c.prototype)).constructor=n,t.p=n},4291:(e,t,r)=>{function i(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,i)}return r}function n(e){for(var t,r=1;r{e.forEach((e=>this.createSlide(e)))};var l=(e,t)=>{var r=e.material,i=r.uniforms;switch(e.rotation.x=0,e.rotation.y=0,e.rotation.z=0,e.position.x=0,e.position.y=0,e.position.z=0,t.direction){case"x":var n=o?-Math.PI/2:Math.PI/2;e.rotation.y=n,i.direction.value=1,i.slide.value.set(t.value,0,0),e.position.x=t.value;break;case"y":e.rotation.x=Math.PI/2,i.direction.value=2,i.slide.value.set(0,t.value,0),e.position.y=t.value;break;case"z":i.direction.value=3,i.slide.value.set(0,0,t.value),e.position.z=t.value}r.needsUpdate=!0,this.boundingBoxUpdateRequired=!0};this.modifySlideSettings=e=>{e&&e.id&&e.id in i&&i[e.id]&&l(i[e.id],e)},this.createSlide=e=>{if(this.texture&&this.texture.isTextureArray&&this.texture.isReady()&&e&&e.direction&&void 0!==e.value){var r=new a.PlaneGeometry(1,1);r.translate(.5,.5,0);var n=s.getUniforms();n.diffuse.value=this.texture.impl,n.depth.value=this.texture.size.depth,n.flipY.value=o;var h={fs:s.fs,vs:s.vs,uniforms:n,glslVersion:s.glslVersion,side:a.DoubleSide,transparent:!1},c=this.texture.getMaterial(h);c.needsUpdate=!0;var u=new a.Mesh(r,c);u.name=this.groupName,u.userData=this;var d={value:e.value,direction:e.direction,id:u.id};return t.push(d),l(u,d),i[u.id]=u,this.morph.add(u),this.boundingBoxUpdateRequired=!0,d}},this.getTextureSettings=()=>[...t],this.getTextureSettingsWithId=e=>{for(var r=0;rthis.morph?[...this.morph.children]:[],this.removeSlide=e=>{e&&this.removeSlideWithId(e.id)},this.removeSlideWithId=e=>{if(this.morph&&e in i&&i[e]){if(this.morph.getObjectById(e)){var r=i[e];this.morph.remove(r),r.clear(),r.geometry&&r.geometry.dispose(),r.material&&r.material.dispose(),this.boundingBoxUpdateRequired=!0}var n=t.findIndex((t=>t.id===e));-1{this.morph.children.forEach((e=>{e.geometry&&e.geometry.dispose(),e.material&&e.material.dispose()})),r(9372).p.prototype.dispose.call(this),this.boundingBoxUpdateRequired=!0},this.getBoundingBox=()=>{if(this.morph&&this.morph.children&&this.morph.visible&&this.boundingBoxUpdateRequired){this.cachedBoundingBox.makeEmpty();var e=new a.Vector3(0,0,0);this.morph.children.forEach((t=>{((e,t,r)=>{switch(t.direction.value){case 1:r.copy(t.slide.value),e.expandByPoint(r),r.setY(1),r.setZ(1),e.expandByPoint(r);break;case 2:r.copy(t.slide.value),e.expandByPoint(r),r.setX(1),r.setZ(1),e.expandByPoint(r);break;case 3:r.copy(t.slide.value),e.expandByPoint(r),r.setX(1),r.setY(1),e.expandByPoint(r)}})(this.cachedBoundingBox,t.material.uniforms,e)})),this.morph.updateMatrixWorld(!0,!0),this.cachedBoundingBox.applyMatrix4(this.morph.matrixWorld),this.boundingBoxUpdateRequired=!1}return this.cachedBoundingBox},this.applyTransformation=(e,t,r)=>{var i=new a.Matrix4;i.set(e[0],e[1],e[2],0,e[3],e[4],e[5],0,e[6],e[7],e[8],0,0,0,0,0);var n=(new a.Quaternion).setFromRotationMatrix(i);this.morph.position.set(...t),this.morph.quaternion.copy(n),this.morph.scale.set(...r),this.morph.updateMatrix(),this.boundingBoxUpdateRequired=!0},this.initialise=(e,t)=>{if(e){var r=e.locations;r&&0{var i=r(1515),n=r(2515).createBufferGeometry,a=r(2515).resolveURL,s=0,o=function(){this.isZincObject=!0,this.geometry=void 0,this.morph=void 0,this.group=new i.Group,this._lod=new(r(9801).U)(this),this.groupName=void 0,this.timeEnabled=!1,this.morphColour=!1,this.inbuildTime=0,this.mixer=void 0,this.animationGroup=void 0,this.duration=6e3,this.clipAction=void 0,this.userData={},this.videoHandler=void 0,this.marker=void 0,this.markerNumber=void 0,this.markerUpdateRequired=!0,this.closestVertexIndex=-1,this.boundingBoxUpdateRequired=!0,this.cachedBoundingBox=new i.Box3,this.anatomicalId=void 0,this.region=void 0,this.animationClip=void 0,this.markerMode="inherited",this.uuid="pr"+s++,this._v1=new i.Vector3,this._v2=new i.Vector3,this._b1=new i.Box3,this.center=new i.Vector3,this.radius=0,this.visible=!0,this.drawRange=-1};o.prototype.setDuration=function(e){this.duration=e,this.clipAction&&this.clipAction.setDuration(this.duration)},o.prototype.getDuration=function(){return this.duration},o.prototype.setRegion=function(e){this.region=e},o.prototype.getRegion=function(){return this.region},o.prototype.getMorph=function(){return this._lod.getCurrentMorph()||this.morph},o.prototype.getGroup=function(){return this.group},o.prototype.setMorph=function(e){this.morph=e,this.group.add(this.morph);var t=this._lod.calculateDistance("far");this._lod.addLevel(e,t),this._lod.setMaterial(e.material)},o.prototype.checkTransparentMesh=function(){},o.prototype.setMesh=function(e,t,r){this.animationGroup=new i.AnimationObjectGroup(e),this.mixer=new i.AnimationMixer(this.animationGroup);var n=e.geometry;if(this.geometry=e.geometry,this.clipAction=void 0,n&&n.morphAttributes){var a=n.morphAttributes.position;a||(a=n.morphAttributes.color?n.morphAttributes.color:n.morphAttributes.normal),a&&(this.animationClip=i.AnimationClip.CreateClipsFromMorphTargetSequences(a,10,!0),this.animationClip&&null!=this.animationClip[0]&&(this.clipAction=this.mixer.clipAction(this.animationClip[0]).setDuration(this.duration),this.clipAction.loop=i.loopOnce,this.clipAction.clampWhenFinished=!0,this.clipAction.play()))}this.timeEnabled=t,this.morphColour=r,e.userData=this,e.matrixAutoUpdate=!1,this.setMorph(e),this.checkTransparentMesh(),this.timeEnabled?this.setFrustumCulled(!1):this.morphColour&&(n.setAttribute("morphTarget0",n.getAttribute("position")),n.setAttribute("morphTarget1",n.getAttribute("position"))),this.boundingBoxUpdateRequired=!0},o.prototype.setName=function(e){this.groupName=e,this._lod.setName(e)},o.prototype.getCurrentTime=function(){if(this.clipAction){var e=this.clipAction.time/this.clipAction._clip.duration;return this.duration*e}return this.inbuildTime},o.prototype.setMorphTime=function(e){var t=!1;if(this.clipAction){var r=e/this.duration*this.clipAction._clip.duration;r!=this.clipAction.time&&(this.clipAction.time=r,t=!0),t&&this.isTimeVarying()&&this.mixer.update(0)}else{var i;(i=e>this.duration?this.duration:0>e?0:e)!=this.inbuildTime&&(this.inbuildTime=i,t=!0)}t&&(this.boundingBoxUpdateRequired=!0,this._lod.updateMorphColorAttribute(!0),this.timeEnabled&&(this.markerUpdateRequired=!0))},o.prototype.isTimeVarying=function(){return!(!this.timeEnabled&&!this.morphColour)},o.prototype.getVisibility=function(){return this.visible},o.prototype.setVisibility=function(e){e!==this.visible&&(this.visible=e,this.group.visible=e,this.region&&(this.region.pickableUpdateRequired=!0))},o.prototype.setAlpha=function(e){var t=this._lod._material,r=!1;1>e&&(r=!0),t.opacity=e,t.transparent=r,this.checkTransparentMesh()},o.prototype.setFrustumCulled=function(e){this._lod.setFrustumCulled(e)},o.prototype.setVertexColors=function(e){this._lod.setVertexColors(e)},o.prototype.getColour=function(){return this._lod._material?this._lod._material.color:void 0},o.prototype.setColour=function(e){this._lod.setColour(e)},o.prototype.getColourHex=function(){return!this.morphColour&&this._lod._material&&this._lod._material.color?this._lod._material.color.getHexString():void 0},o.prototype.setColourHex=function(e){this._lod._material.color.setHex(e),this._lod._secondaryMaterial&&this._lod._secondaryMaterial.color.setHex(e)},o.prototype.setEmissiveRGB=function(e){this._lod._material&&this._lod._material.emissive&&this._lod._material.emissive.setRGB(...e),this._lod._secondaryMaterial&&this._lod._secondaryMaterial.emissive.setRGB(...e)},o.prototype.setMaterial=function(e){this._lod.setMaterial(e)},o.prototype.getClosestVertexIndex=function(){var e=-1,t=this.getMorph();if(t&&t.geoemtry){var r=t.geometry.attributes.position;if(this._b1.setFromBufferAttribute(r),this._b1.getCenter(this._v1),r)for(var i=-1,n=0,a=0;an&&(i=n,e=a)}return e},o.prototype.getClosestVertex=function(e){var t=new i.Vector3;-1==this.closestVertexIndex&&(this.closestVertexIndex=this.getClosestVertexIndex());var r=this.getMorph();if(r&&r.geometry&&0<=this.closestVertexIndex){var n=r.morphTargetInfluences,a=r.geometry.morphAttributes;if(!(n&&a&&a.position))return t.fromArray(r.geometry.attributes.position.array,3*this.closestVertexIndex),e?t.applyMatrix4(r.matrixWorld):t;for(var s=!1,o=0;or.x||1r.y)&&(t=!1),e.getZincCameraControls().getRelativeCoordsFromNDC(r.x,r.y,r),{position:r,inView:t}}},o.prototype.setMarkerMode=function(e,t){e!==this.markerMode&&(this.markerMode="on"===e||"off"===e?e:"inherited",this.region&&(this.region.pickableUpdateRequired=!0)),t&&(this.markerNumber=t.number,this.markerImgURL=t.imgURL)},o.prototype.render=function(e,t,r,i){if(this.visible&&!(this.timeEnabled&&t)&&this._lod.update(r,this.center),1==t){if(this.clipAction&&this.isTimeVarying())this.mixer.update(e);else{var n=this.inbuildTime+e;n>this.duration&&(n-=this.duration),this.inbuildTime=n}this.visible&&0!=e&&(this.boundingBoxUpdateRequired=!0,1==this.morphColour&&this._lod.updateMorphColorAttribute(!0))}this.updateMarker(t,i)},o.prototype.addLOD=function(e,t,r,i,n){this._lod.addLevelFromURL(e,t,r,i,n)},o.prototype.addVertices=function(e){var t=this.getMorph(),r=void 0;if(t){if(-1{i.setXYZ(this.drawRange,e[0],e[1],e[2]),++this.drawRange})),i.needsUpdate=!0,t.geometry.setDrawRange(0,this.drawRange),t.geometry.computeBoundingBox(),t.geometry.computeBoundingSphere(),r=t.geoemtry,this.boundingBoxUpdateRequired=!0}}else r=n(500,e),this.drawRange=e.length;return r},o.prototype.setPosition=function(e,t,r){var i=this.getGroup();i&&(i.position.set(e,t,r),i.updateMatrix(),this.boundingBoxUpdateRequired=!0)},o.prototype.loadAdditionalSources=function(e){e.load(a(filename),meshloader(region,colour,opacity,localTimeEnabled,localMorphColour,void 0,void 0,void 0,void 0,finishCallback),this.onProgress(filename),this.onError(finishCallback))},o.prototype.setScaleAll=function(e){var t=this.getGroup();t&&(t.scale.set(e,e,e),t.updateMatrix(),this.boundingBoxUpdateRequired=!0)},t.c=o},2843:(e,t,r)=>{var{Group:i,Matrix4:n}=r(1515),a=r(770).t,s=(r(8145).q,r(7931).s),o=r(5672).V,l=r(1515),h=0,c=function(e,t){var r=e,u=new i;u.matrixAutoUpdate=!1,u.userData=this;var d=[],p="",m=[],f=t,v=new n,g=3e3;v.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this.pickableUpdateRequired=!0,this.isRegion=!0,this.uuid="re"+h++,this.hideAllPrimitives=()=>{d.forEach((e=>e.hideAllPrimitives())),m.forEach((e=>e.setVisibility(!1)))},this.showAllPrimitives=()=>{d.forEach((e=>e.showAllPrimitives())),m.forEach((e=>e.setVisibility(!0)))},this.setVisibility=e=>{e!=u.visible&&(u.visible=e,this.pickableUpdateRequired=!0)},this.getVisibility=()=>u.visible,this.getGroup=()=>u,this.setTransformation=e=>{v.set(...e),u.matrix.copy(v),u.updateMatrixWorld()},this.setName=e=>{e&&""!==e&&(p=e)},this.getName=()=>p,this.getParent=()=>r,this.getFullSeparatedPath=()=>{var e=[];if(""!==p){e.push(p);for(var t,i=r;void 0!==i;)""!==(t=i.getName())&&e.unshift(t),i=i.getParent()}return e},this.getFullPath=()=>{var e=this.getFullSeparatedPath();if(0{t=t.concat("/",e)})),t}return""},this.createChild=e=>{var t=new c(this,f);return t.setName(e),d.push(t),u.add(t.getGroup()),t},this.getChildWithName=e=>{if(e)for(var t=e.toLowerCase(),r=0;r{if(e&&0{var t=e.split("/");return this.findChildFromSeparatedPath(t)},this.createChildFromSeparatedPath=e=>{if(0{var t=e.split("/");return this.createChildFromSeparatedPath(t)},this.findOrCreateChildFromPath=e=>{var t=this.findChildFromPath(e);return t||(t=this.createChildFromPath(e)),t},this.addZincObject=e=>{e&&(e.setRegion(this),u.add(e.getGroup()),m.push(e),this.pickableUpdateRequired=!0,f&&f.triggerObjectAddedCallback(e))},this.removeZincObject=e=>{for(var t=0;t{if(this.pickableUpdateRequired)return!0;if(e)for(var t=0;t(u.visible&&(m.forEach((t=>{if(t.getGroup()&&t.getGroup().visible){var r=t.marker;r&&r.isEnabled()&&e.push(r.getMorph()),e.push(t.getGroup())}})),t&&d.forEach((r=>{r.getPickableThreeJSObjects(e,t)})),this.pickableUpdateRequired=!1),e),this.setDuration=e=>{g=e,m.forEach((t=>t.setDuration(e))),d.forEach((t=>t.setDuration(e)))},this.getDuration=()=>g,this.getBoundingBox=e=>{var t,r;return m.forEach((e=>{(r=e.getBoundingBox())&&(null==t?t=r.clone():t.union(r))})),e&&d.forEach((i=>{(r=i.getBoundingBox(e))&&(null==t?t=r.clone():t.union(r))})),t},this.clear=e=>{e&&d.forEach((t=>t.clear(e))),m.forEach((e=>{u.remove(e.getGroup()),e.dispose()})),d=[],m=[]},this.objectIsInRegion=(e,t)=>{for(var r=0;r{m.forEach((t=>{t.isGeometry&&e(t)})),t&&d.forEach((r=>r.forEachGeometry(e,t)))},this.forEachGlyphset=(e,t)=>{m.forEach((t=>{t.isGlyphset&&e(t)})),t&&d.forEach((r=>r.forEachGlyphset(e,t)))},this.forEachPointset=(e,t)=>{m.forEach((t=>{t.isPointset&&e(t)})),t&&d.forEach((r=>r.forEachPointset(e,t)))},this.forEachLine=(e,t)=>{m.forEach((t=>{t.isLines&&e(t)})),t&&d.forEach((r=>r.forEachLine(e,t)))},this.findObjectsWithAnatomicalId=(e,t)=>(m.forEach((t=>{t.anatomicalId===e&&objectsArray.push(t)})),t&&d.forEach((r=>{var i=r.findObjectsWithAnatomicalId(e,t);objectsArray.push(...i)})),objectsArray),this.findObjectsWithGroupName=(e,t)=>{var r=[];return m.forEach((t=>{(t.groupName?t.groupName.toLowerCase():t.groupName)===(e?e.toLowerCase():e)&&r.push(t)})),t&&d.forEach((i=>{var n=i.findObjectsWithGroupName(e,t);r.push(...n)})),r},this.findGeometriesWithGroupName=(e,t)=>this.findObjectsWithGroupName(e,t).filter((e=>e.isGeometry)),this.findPointsetsWithGroupName=(e,t)=>this.findObjectsWithGroupName(e,t).filter((e=>e.isPointset)),this.findGlyphsetsWithGroupName=(e,t)=>this.findObjectsWithGroupName(e,t).filter((e=>e.isGlyphset)),this.findLinesWithGroupName=(e,t)=>this.findObjectsWithGroupName(e,t).filter((e=>e.isLines)),this.getAllObjects=e=>{var t=[...m];return e&&d.forEach((r=>{var i=r.getAllObjects(e);t.push(...i)})),t},this.getChildRegions=e=>{var t=[...d];return e&&d.forEach((r=>{var i=r.getChildRegions(e);t.push(...i)})),t},this.getCurrentTime=()=>{if(null!=m[0])return m[0].getCurrentTime();for(var e,t=0;t{m.forEach((t=>{t.setMorphTime(e)})),t&&d.forEach((t=>{t.setMorphTime(e)}))},this.isTimeVarying=()=>{for(var e=0;e{var s;this.getAllObjects(a).forEach((a=>{a.render(e*t,r,i,n)})),n&&!1===r&&null!==(s=n.markerCluster)&&void 0!==s&&s.markerUpdateRequired&&n.markerCluster.calculate()},this.createPoints=(e,t,r,i)=>{var n=!1,s=this.findObjectsWithGroupName(e,!1),o=s.findIndex((e=>e.isPointset)),l=-1{var i=!1,n=this.findObjectsWithGroupName(e,!1),a=n.findIndex((e=>e.isLines)),o=-1{var s=new o,h=new l.MeshPhongMaterial({color:r,morphTargets:!1,morphNormals:!1,transparent:!0,opacity:i,side:l.DoubleSide});return s.createMesh(t,h,{localTimeEnabled:!1,localMorphColour:!1}),s.getMorph()?(s.setVisibility(!1),s.setName(e),s.setRenderOrder(a),this.addZincObject(s),s):void 0}};t.T=c},3260:(e,t,r)=>{var i=r(1515),n=r(164);t.A=function(e){var t=e,a=void 0,s=void 0,o=new i.Clock(!1);this.playAnimation=!0;var l=1e3,h=[],c=0,u=[],d=0,p=void 0,m=void 0,f=void 0,v=void 0,g=[],y=[],x=new i.Group,b=void 0,w=void 0,_=!1,M=[0,0],S=[0,0];this.getDrawingWidth=()=>t?t.clientWidth:b?void 0===b.clientWidth?Math.round(b.width):Math.round(b.clientWidth):0,this.getDrawingHeight=()=>t?t.clientHeight:b?void 0===b.clientHeight?Math.round(b.height):Math.round(b.clientHeight):0,this.onWindowResize=()=>{s.onWindowResize();var e=this.getDrawingWidth(),r=this.getDrawingHeight();if(null!=a){var n;t?(n=t.getBoundingClientRect(),a.setSize(e,r)):b&&(void 0===b.getBoundingClientRect||(n=b.getBoundingClientRect(),b.width=e,b.height=r),a.setSize(e,r,!1)),n&&(S[0]=n.left,S[1]=n.top);var o=new i.Vector2;a.getSize(o),M[0]=o.x,M[1]=o.y}},this.initialiseVisualisation=e=>{if(void 0===(e=e||{}).antialias){var r=!1;try{/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)&&(r=!0)}catch(e){r=!1}e.antialias=!r}e.canvas&&(t=void 0,b=e.canvas),a=new i.WebGLRenderer(e),void 0!==t&&t.appendChild(a.domElement),a.setClearColor(16777215,1),b&&b.style&&(b.style.height="100%",b.style.width="100%"),a.autoClear=!1;var n=this.createScene("default");this.setCurrentScene(n)},this.getCurrentScene=()=>s,this.setCurrentScene=e=>{if(e){this.removeActiveScene(e);var t=s;s=e,t&&t.setInteractiveControlEnable(!1),s.setInteractiveControlEnable(!0),s.setAdditionalScenesGroup(x),this.onWindowResize()}},this.getSceneByName=e=>g[e],this.createScene=e=>{var i;if(null==g[e])return i=b?new(r(5015).Z)(b,a):new(r(5015).Z)(t,a),g[e]=i,i.sceneName=e,i},this.resetView=()=>{s.resetView()},this.viewAll=()=>{if(s){var e=s.getBoundingBox();if(e){for(var t,r=0;r{s.loadModelsURL(e,t,r,i,n,a)},this.loadViewURL=e=>{s.loadViewURL(e)},this.loadFromViewURL=(e,t)=>{s.loadFromViewURL(e,t)},this.updateDirectionalLight=()=>{s.updateDirectionalLight()};var T=()=>{_?(p=requestAnimationFrame(T),this.render()):(cancelAnimationFrame(p),p=void 0)};this.stopAnimate=()=>{_&&(o.stop(),_=!1)},this.animate=()=>{_||(o.start(),_=!0,T())},Date.now(),this.addPreRenderCallbackFunction=e=>(++c,h[c]=e,c),this.removePreRenderCallbackFunction=e=>{e in h&&delete h[e]},this.addPostRenderCallbackFunction=e=>(++d,u[d]=e,d),this.removePostRenderCallbackFunction=e=>{e in u&&delete u[e]},this.getPlayRate=()=>l,this.setPlayRate=e=>{l=e},this.getCurrentTime=()=>s.getCurrentTime(),this.setMorphsTime=e=>{s.setMorphsTime(e)},this.getZincGeometryByID=e=>s.getZincGeometryByID(e),this.addToScene=e=>{s.addObject(e)},this.addToOrthoScene=e=>{if(null==f&&(f=new i.Scene),null==m){var t=this.getDrawingWidth(),r=this.getDrawingHeight();(m=new i.OrthographicCamera(-t/2,t/2,r/2,-r/2,1,10)).position.z=10}f.add(e)};var E=e=>t=>{t.needsUpdate=!0;var r=new i.SpriteMaterial({map:t}),n=r.map.image.width,a=r.map.image.height;e.material=r,e.scale.set(n,a,1);var s=this.getDrawingWidth(),o=this.getDrawingHeight();e.position.set((s-n)/2,(-o+a)/2,1),this.addToOrthoScene(e)};this.addLogo=()=>{v=new i.Sprite,i.ImageUtils.loadTexture("images/abi_big_logo_transparent_small.png",void 0,E(v))},this.render=()=>{w||(t?0a,this.isSceneActive=e=>{if(s===e)return!0;for(var t=0;t{this.isSceneActive(e)||(y.push(e),x.add(e.getThreeJSScene()))},this.removeActiveScene=e=>{for(var t=0;t{for(var e=0;e{for(var e in _&&cancelAnimationFrame(p),g)g.hasOwnProperty(e)&&g[e].clearAll();g=[],y=[],x=new i.Group,this.stopAnimate(),h=[],c=0,m=void 0,f=void 0,v=void 0;var t=this.createScene("default");this.setCurrentScene(t),w=void 0},this.transitionScene=(e,t)=>{if(s){var r=s.getZincCameraControls(),i=e.getBoundingBox();if(i){var n=i.min.distanceTo(i.max)/2,a=(i.min.x+i.max.x)/2,o=(i.min.y+i.max.y)/2,l=(i.min.z+i.max.z)/2,h=r.getViewportFromCentreAndRadius(a,o,l,n,40,4*n),c=r.getCurrentViewport();r.cameraTransition(c,h,t),r.enableCameraTransition()}}},this.isWebGL2=()=>!!a&&a.capabilities.isWebGL2}},5015:(e,t,r)=>{var i=r(1515),n=r(2970).p,a=r(6264).c,s=r(3778).O,o=r(701).Viewport,l=r(2515).createBufferGeometry,h=r(2515).getCircularTexture,c=0;t.Z=function(e,t){var u=this,d=e,p=void 0,m=new a(this),f=void 0,v={},g=0,y={},x=0,b=new i.Scene,w=new(r(2843).T)(void 0,this);b.add(w.getGroup());var _=new i.Group;b.add(_),this.directionalLight=void 0,this.ambient=void 0,this.camera=void 0;var M=6e3,S=void 0;this.sceneName=void 0;var T=!1,E=void 0;this.autoClearFlag=!0,this.displayMarkers=!1,this.displayMinimap=!1,this.minimapScissor={x_offset:16,y_offset:16,width:128,height:128,align:"top-left",updateRequired:!0};var A={x:0,y:0},L={Duration:"6 secs",OriginalDuration:"-",TimeStamps:{}},R=new i.Vector2,C=[];this.forcePickableObjectsUpdate=!1,this.uuid="sc"+c++;var P=new n(this);P.disable(),b.add(P.group);var I=()=>d?void 0===d.clientWidth?d.width:d.clientWidth:0,O=()=>d?void 0===d.clientHeight?d.height:d.clientHeight:0;this.getDownloadProgress=()=>m.getDownloadProgress(),this.onWindowResize=()=>{var e=O();this.camera.aspect=I()/e,this.camera.updateProjectionMatrix(),this.minimapScissor.updateRequired=!0,S.onResize(),S.calculateHeightPerPixelAtZeroDepth(e)},this.resetView=()=>{this.onWindowResize(),S.resetView()},this.changeZoomByScrollRateUnit=e=>{S.changeZoomByScrollRateUnit(e)},(()=>{this.camera=new i.PerspectiveCamera(40,I()/O(),0,10),this.ambient=new i.AmbientLight(16777215,.2),b.add(this.ambient),this.directionalLight=new i.DirectionalLight(16777215,.8),b.add(this.directionalLight),(S=new(r(701).CameraControls)(this.camera,t.domElement,t,this)).setDirectionalLight(this.directionalLight),S.resetView(),f=new(r(7404).U)(this)})(),this.loadView=e=>{var t=new o;return t.setFromObject(e),S.setCurrentCameraSettings(t),!0},this.setupMultipleViews=(e,t)=>{for(var[r,i]of Object.entries(t)){var n=new o;n.setFromObject(i),S.addViewport(r,n)}S.setDefaultViewport(e)},this.getBoundingBox=()=>w.getBoundingBox(!0),this.viewAllWithBoundingBox=e=>{if(e){var t=S.getViewportFromBoundingBox(e,1);S.setCurrentCameraSettings(t),S.calculateHeightPerPixelAtZeroDepth(O()),P.markerUpdateRequired=!0}},this.viewAll=()=>{var e=this.getBoundingBox();this.viewAllWithBoundingBox(e),P.markerUpdateRequired=!0},this.forEachGeometry=e=>{w.forEachGeometry(e,!0)},this.forEachGlyphset=e=>{w.forEachGlyphset(e,!0)},this.forEachPointset=e=>{w.forEachPointset(e,!0)},this.forEachLine=e=>{w.forEachLine(e,!0)},this.findGeometriesWithGroupName=e=>w.findGeometriesWithGroupName(e,!0),this.findPointsetsWithGroupName=e=>w.findPointsetsWithGroupName(e,!0),this.findGlyphsetsWithGroupName=e=>w.findGlyphsetsWithGroupName(e,!0),this.findLinesWithGroupName=e=>w.findLinesWithGroupName(e,!0),this.findObjectsWithGroupName=e=>w.findObjectsWithGroupName(e,!0),this.findObjectsWithAnatomicalId=e=>w.findObjectsWithAnatomicalId(e,!0),this.getBoundingBoxOfZincObjects=e=>{for(var t,r=void 0,i=0;i{e.project(this.camera);var t=I()/2,r=O()/2;return e.x=e.x*t+t,e.y=-e.y*r+r,e},this.getObjectsScreenXY=e=>{if(e&&0{var t=this.findObjectsWithGroupName(e);return this.getObjectsScreenXY(t)},this.addZincObject=e=>{e&&(w.addZincObject(e),S&&S.calculateMaxAllowedDistance(this))},this.loadGlyphsetURL=(e,t,r,i)=>{m.loadGlyphsetURL(w,e,t,r,i)},this.loadPointsetURL=(e,t,r,i,n)=>{m.loadPointsetURL(w,e,t,r,i,n)},this.loadLinesURL=(e,t,r,i,n)=>{m.loadLinesURL(w,e,t,r,i,n)},this.loadSTL=(e,t,r)=>{m.loadSTL(w,e,t,r)},this.loadOBJ=(e,t,r)=>{m.loadOBJ(w,e,t,r)},this.loadMetadataURL=(e,t,r)=>{m.loadMetadataURL(w,e,t,r)},this.loadModelsURL=(e,t,r,i,n,a)=>{m.loadModelsURL(w.urls,t,r,i,n,a)},this.loadViewURL=e=>{m.loadViewURL(e)},this.loadFromViewURL=(e,t)=>{m.loadFromViewURL(e,t)},this.loadGLTF=(e,t,r,i)=>{m.loadGLTF(w,e,t,r,i)},this.updateDirectionalLight=()=>{S.updateDirectionalLight()},this.addObject=e=>{b.add(e)},this.removeObject=e=>{b.remove(e)},this.getCurrentTime=()=>{if(null!=p)return p.getCurrentTime(M);var e=w.getCurrentTime();return-1===e?0:e},this.setMorphsTime=e=>{null!=p&&p.setMorphTime(e,M),w.setMorphTime(e,!0)},this.isTimeVarying=()=>!(!p||!p.video||p.video.error)||w.isTimeVarying(),this.renderGeometries=(e,t,r)=>{var i={};if(i.camera=S,i.displayMarkers=this.displayMarkers,i.markerCluster=P,i.markersList=P.markers,i.ndcToBeUpdated=!1,r&&(i.markerCluster.markerUpdateRequired=!0),p)if(p.isReadyToPlay()){r?p.video.play():p.video.pause();var n=p.video.currentTime/p.getVideoDuration()*M;0==m.toBeDownloaded?(S.setTime(n),i.ndcToBeUpdated=S.update(0),i.ndcToBeUpdated&&S.calculateHeightPerPixelAtZeroDepth(O()),w.setMorphTime(n,!0),w.renderGeometries(0,0,r,S,i,!0)):S.update(0)}else myPlayRate=0;else 0==m.toBeDownloaded?(i.ndcToBeUpdated=S.update(t),i.ndcToBeUpdated&&S.calculateHeightPerPixelAtZeroDepth(O()),w.renderGeometries(e,t,r,S,i,!0)):S.update(0)},this.getThreeJSScene=()=>b,this.setVideoHandler=e=>{p||(p=e)},this.setAdditionalScenesGroup=e=>{b.add(e)};var D=e=>{var t,r,i,n,a,s,o,l;!0===this.displayMinimap&&(e.setScissorTest(!0),e.getSize(R),this.minimapScissor.updateRequired&&(t=this.minimapScissor.align,r=this.minimapScissor.x_offset,i=this.minimapScissor.y_offset,n=this.minimapScissor.width,a=this.minimapScissor.height,s=R.x,o=R.y,l=t.includes("top")?o-a-i:t.includes("bottom")?i:Math.floor((o-a)/2),A={x:t.includes("left")?r:t.includes("right")?s-r-n:Math.floor((s-n)/2),y:l},this.minimapScissor.updateRequired=!1),e.setScissor(A.x,A.y,this.minimapScissor.width,this.minimapScissor.height),e.setViewport(A.x,A.y,this.minimapScissor.width,this.minimapScissor.height),f.updateCamera(),b.add(f.mask),e.render(b,f.camera),b.remove(f.mask),e.setScissorTest(!1),e.setViewport(0,0,R.x,R.y))};this.render=e=>{this.autoClearFlag&&e.clear(),T&&E?E.render(b,this.camera):(e.render(b,this.camera),D(e))},this.setInteractiveControlEnable=e=>{1==e?S.enable():S.disable()},this.getZincCameraControls=()=>S,this.getThreeJSScene=()=>b,this.setDuration=e=>{w.setDuration(e),M=e,S.setPathDuration(e),m.duration=e},this.getDuration=()=>M,this.setStereoEffectEnable=e=>{1!=e||E||(E=new r(701).StereoEffect(t)),t.setSize(I(),O()),this.camera.updateProjectionMatrix(),T=e},this.objectIsInScene=e=>w.objectIsInRegion(e,!0),this.alignBoundingBoxToCameraView=(e,t)=>{if(e){var r=new i.Vector3;e.getCenter(r);var n=this.getZincCameraControls().getCurrentViewport(),a=new i.Vector3(n.targetPosition[0],n.targetPosition[1],n.targetPosition[2]),s=new i.Vector3(n.eyePosition[0],n.eyePosition[1],n.eyePosition[2]),o=new i.Vector3,l=new i.Vector3;o.subVectors(a,s).normalize(),l.subVectors(a,r).normalize();var h=new i.Vector3;h.crossVectors(o,l);var c=o.angleTo(l);0{if(e){var i=this.getZincCameraControls().getCurrentViewport(),n=this.getZincCameraControls().getViewportFromBoundingBox(e,t);0{if(this.objectIsInScene(e)){var r=e.getBoundingBox();this.alignBoundingBoxToCameraView(r,t)}},this.setCameraTargetToObject=e=>{if(this.objectIsInScene(e)){var t=new i.Vector3,r=e.getBoundingBox(),n=this.getZincCameraControls().getCurrentViewport();r.getCenter(t);var a=new i.Vector3(n.targetPosition[0],n.targetPosition[1],n.targetPosition[2]),s=new i.Vector3(n.eyePosition[0],n.eyePosition[1],n.eyePosition[2]),o=new i.Vector3,l=new i.Vector3;o.subVectors(s,a),l.addVectors(t,o),n.eyePosition[0]=l.x,n.eyePosition[1]=l.y,n.eyePosition[2]=l.z,n.targetPosition[0]=t.x,n.targetPosition[1]=t.y,n.targetPosition[2]=t.z,this.getZincCameraControls().setCurrentCameraSettings(n),P.markerUpdateRequired=!0}},this.isStereoEffectEnable=()=>T,this.removeZincObject=e=>{w.removeZincObject(e),S&&S.calculateMaxAllowedDistance(this),P.markerUpdateRequired=!0},this.updatePickableThreeJSObjects=()=>{C.length=0,P.isEnabled&&C.push(P.group),w.getPickableThreeJSObjects(C,!0),this.forcePickableObjectsUpdate=!1},this.getPickableThreeJSObjects=()=>((this.forcePickableObjectsUpdate||w.checkPickableUpdateRequred(!0))&&this.updatePickableThreeJSObjects(),C),this.getNormalisedMinimapCoordinates=(e,t)=>{if(this.displayMinimap){var r=new i.Vector2;e.getSize(r);var n=r.y-t.clientY;if(A.x+this.minimapScissor.width>t.clientX&&t.clientX>A.x&&A.y+this.minimapScissor.height>n&&n>A.y)return{x:(t.clientX-A.x)/this.minimapScissor.width*2-1,y:(n-A.y)/this.minimapScissor.height*2-1}}},this.getMinimapDiffFromNormalised=(e,t)=>f?f.getDiffFromNormalised(e,t):void 0,this.isWebGL2=()=>t.isWebGL2(),this.clearAll=()=>{P.clear(),w.clear(!0),this.clearZincObjectAddedCallbacks(),this.clearZincObjectRemovedCallbacks(),m.toBeDwonloaded=0,S&&S.calculateMaxAllowedDistance(this),P.markerUpdateRequired=!0},this.addMetadataTimeStamp=(e,t)=>{L.TimeStamps[e]=B(t)},this.getMetadataTag=e=>L[e],this.getMetadata=()=>L,this.setMetadataTag=(e,t)=>{L[e]=t},this.removeMetadataTag=e=>{delete L[e]},this.resetMetadata=()=>{L={Duration:"6 secs",OriginalDuration:"-",TimeStamps:{}}},this.resetDuration=()=>{this.setDuration(6e3)};var N=e=>[...e.years?["".concat(e.years,"years")]:[],...e.months?["".concat(e.months,"months")]:[],...e.weeks?["".concat(e.weeks,"weeks")]:[],...e.days?["".concat(e.days,"days")]:[],...e.hours?["".concat(e.hours,"hours")]:[],...e.mins?["".concat(e.mins,"mins")]:[],...e.secs?["".concat(e.secs,"secs")]:[]].join(" "),B=e=>e.years?31536e6*e.years:0+e.months?2592e6*e.months:0+e.weeks?6048e5*e.weeks:0+e.days?864e5*e.days:0+e.hours?36e5*e.hours:0+e.mins?6e4*e.mins:0+e.secs?1e3*e.secs:0;this.setDurationFromObject=e=>{var t=N(e),r=B(e);this.setMetadataTag("Duration",t),this.setDuration(r)},this.setOriginalDurationFromObject=e=>{var t=N(e);this.setMetadataTag("OriginalDuration",t)},this.exportGLTF=e=>new s(this).exportGLTF(e),this.getRootRegion=()=>w,this.createLines=(e,t,r,i)=>{var n=w.findChildFromPath(e);return void 0===n&&(n=w.createChildFromPath(e)),n.createLines(t,r,i)},this.createPoints=(e,t,r,i,n)=>{var a=w.findChildFromPath(e);return void 0===a&&(a=w.createChildFromPath(e)),a.createPoints(t,r,i,n)},this.addZincObjectAddedCallbacks=e=>(++g,v[g]=e,g),this.addZincObjectRemovedCallbacks=e=>(++x,y[x]=e,x),this.removeZincObjectAddedCallbacks=e=>{e in g&&delete v[e]},this.removeZincObjectRemovedCallbacks=e=>{e in x&&delete y[e]},this.clearZincObjectAddedCallbacks=()=>{v={},g=0},this.clearZincObjectRemovedCallbacks=()=>{y={},x=0},this.triggerObjectAddedCallback=e=>{for(var t in v)v.hasOwnProperty(t)&&v[t](e)},this.triggerObjectRemovedCallback=e=>{for(var t in y)y.hasOwnProperty(t)&&y[t](e)},this.addTemporaryPoints=(e,t)=>{var n=l(e.length,e),a=new i.PointsMaterial({alphaTest:.5,size:15,color:t,sizeAttenuation:!1}),s=h();a.map=s;var o=new(r(377).O)(n,a);return _.add(o),o},this.addTemporaryLines=(e,t)=>{var n=l(e.length,e),a=new i.LineBasicMaterial({color:t}),s=new(r(1491).D)(n,a);return _.add(s),s},this.removeTemporaryPrimitive=e=>{_.remove(e),e.geometry.dispose(),e.material.dispose()},this.clearTemporaryPrimitives=()=>{var e=0;return _.children.forEach((t=>{t.geometry.dispose(),t.material.dispose(),e++})),_.clear(),e},this.addBoundingBoxPrimitive=function(e,t,r,n,a){var s=5{var s;switch(e){case"x":(s=new i.PlaneGeometry(h.z,h.y)).rotateY(Math.PI/2);break;case"y":(s=new i.PlaneGeometry(h.x,h.z)).rotateX(Math.PI/2);break;case"z":s=new i.PlaneGeometry(h.x,h.y)}var l=o.createGeometryFromThreeJSGeometry(t[d],s,r[d],n,a,10001);c.push(l),d++})),h.addVectors(l.min,l.max).multiplyScalar(.5),c.forEach((e=>{e.setPosition(h.x,h.y,h.z)})),c}},this.enableMarkerCluster=e=>{e?(P.markerUpdateRequired=!0,P.enable()):(P.markerUpdateRequired=!1,P.disable()),this.forcePickableObjectsUpdate=!0}}},3778:(e,t,r)=>{var i=r(370).r;t.O=function(e){var t=e;this.exportGLTF=e=>{var r=t.getRootRegion().getAllObjects(!0),n=[];r.forEach((e=>{e.animationClip&&n.push({clip:e.animationClip[0],mesh:e.getMorph()})}));var a=new i,s={binary:e,animations:n};return new Promise((e=>{a.parse(t.getThreeJSScene(),(function(t){e(t)}),s)}))}}},6264:(e,t,r)=>{var i=r(1515),n=r(2515).resolveURL,a=r(2515).createNewURL,s=r(7270).t,o=r(654).L,l=r(1915)._;t.c=function(e){var t=e;this.toBeDownloaded=0,this.progressMap={};var h=!1,c=!1,u=new l;this.getDownloadProgress=()=>{var e=0,t=0,r=!1;for(var i in this.progressMap){var n=this.progressMap[i];e+=n[1],t+=n[0],0==n[1]&&(r=!0)}return r&&(e=0),[e,t,c]},this.onProgress=e=>t=>{this.progressMap[e]=[t.loaded,t.total]},this.onError=e=>t=>{--this.toBeDownloaded,c=!0,console.error("There is an issue with one of the external resource: ".concat(null==t?void 0:t.responseURL,".")),e&&e()},this.loadViewURL=(e,r)=>{this.toBeDownloaded+=1;var i=new XMLHttpRequest;i.onreadystatechange=()=>{if(4==i.readyState)if(200==i.status){var e=JSON.parse(i.responseText);t.setupMultipleViews("default",{default:e}),t.resetView(),h=!0,--this.toBeDownloaded,null!=r&&"function"==typeof r&&r()}else this.onError()};var a=n(e);i.open("GET",a,!0),i.send()},this.loadModelsURL=(e,t,i,a,s,o,l)=>{var h=t.length;this.toBeDownloaded+=h;for(var c=0;c{var a=new XMLHttpRequest;a.onreadystatechange=()=>{if(4==a.readyState&&200==a.status){var n=JSON.parse(a.responseText);t.loadView(n);for(var s,o=[],l=r+"_",h=0;h(d,p)=>{var m=new(r(8145).q),f=void 0;p&&p[0]&&(f=new i.LineBasicMaterial({color:p[0].color.clone()}),1>p[0].opacity&&(f.transparent=!0),f.opacity=p[0].opacity,f.morphTargets=n,f.vertexColors=p[0].vertexColors);var v={localTimeEnabled:n,localMorphColour:a};if(m&&(m.createLineSegment(d,f,v),m.setName(s),m.anatomicalId=o,m.setRenderOrder(l),e.addZincObject(m),m.setDuration(t.getDuration()),console.log(h),h&&h.levels))for(var[g,y]of Object.entries(h.levels))m.addLOD(u,g,y.URL,y.Index,h.preload);--this.toBeDownloaded,d.dispose(),null!=c&&"function"==typeof c&&c(m)};this.loadLinesURL=(e,t,r,i,n,a,s)=>{var o=0;this.toBeDownloaded+=1;var l=!(!s||!s.isInline)&&s.isInline,h=s&&s.anatomicalId?s.anatomicalId:void 0,c=s&&s.renderOrder?s.renderOrder:void 0;null!=r&&(o=!!r);var p=0;if(null!=i&&(p=!!i),l){var m=u.parse(t);d(e,o,p,n,h,c,s.lod,a)(m.geometry,m.materials)}else u.load(t,d(e,o,p,n,h,c,s.lod,a),this.onProgress(t),this.onError(a),s.loaderOptions)};var p=(e,i,a,s,o,l)=>{var h=l&&l.isInline?l.isInline:void 0,c=l&&l.anatomicalId?l.anatomicalId:void 0,u=l&&l.displayLabels?l.displayLabels:void 0,d=l&&l.renderOrder?l.renderOrder:void 0,p=new(r(2842).V);p.setDuration(t.getDuration()),p.groupName=s;var m=()=>{--this.toBeDownloaded,null!=o&&"function"==typeof o&&o(p)};++this.toBeDownloaded,h?p.load(i,a,m,h,u):p.load(i,n(a),m,h,u),p.anatomicalId=c,p.setRenderOrder(d),e.addZincObject(p)},m=(e,n,a,s,o,l,h)=>(c,u)=>{var d=new(r(770).t),p=new i.PointsMaterial({alphaTest:.5,size:10,sizeAttenuation:!1});u&&u[0]&&(1>u[0].opacity&&(p.transparent=!0),p.opacity=u[0].opacity,p.color=u[0].color,p.morphTargets=n,p.vertexColors=u[0].vertexColors);var m={};m.localTimeEnabled=n,m.localMorphColour=a,d&&(d.createMesh(c,p,m),d.setName(s),d.anatomicalId=o,e.addZincObject(d),d.setDuration(t.getDuration()),d.setRenderOrder(l)),c.dispose(),--this.toBeDownloaded,null!=h&&"function"==typeof h&&h(d)};this.loadSTL=(e,t,i,a)=>{this.toBeDownloaded+=1;var o=r(1913).defaultMaterialColor,l=r(1913).defaultOpacity,h=new s;h.crossOrigin="Anonymous",h.load(n(t),y(e,o,l,!1,!1,i,void 0,void 0,void 0,a))},this.loadOBJ=(e,t,i,a)=>{this.toBeDownloaded+=1;var s=r(1913).defaultMaterialColor,l=r(1913).defaultOpacity,h=new o;h.crossOrigin="Anonymous",h.load(n(t),y(e,s,l,!1,!1,i,void 0,void 0,void 0,a))};var f=(e,t,i,n,a,l,h)=>{this.toBeDownloaded+=1;var c=r(1913).defaultMaterialColor,d=r(1913).defaultOpacity,p=0,m=!(!h||!h.isInline)&&h.isInline,f=h&&h.fileFormat?h.fileFormat:void 0,v=h&&h.anatomicalId?h.anatomicalId:void 0,g=h&&h.renderOrder?h.renderOrder:void 0;null!=i&&(p=!!i);var x=0;null!=n&&(x=!!n);var b=u;if(void 0!==f)if("STL"==f)b=new s;else if("OBJ"==f)return(b=new o).crossOrigin="Anonymous",void b.load(t,objloader(e,c,d,p,x,a,v,l),this.onProgress(t),this.onError,h.loaderOptions);if(m){var w=u.parse(t);y(e,c,d,p,x,a,v,g,h,l)(w.geometry,w.materials)}else b.crossOrigin="Anonymous",u.load(t,y(e,c,d,p,x,a,v,g,h,l),this.onProgress(t),this.onError(l),h.loaderOptions)},v=function(e,r,i){var n=0;return a=>{if(++n,a&&null!=r&&"function"==typeof r){r(a);var s=t.getZincCameraControls();s&&s.calculateMaxAllowedDistance(t)}n==e&&(0==h&&t.viewAll(),null!=i&&"function"==typeof i&&i())}};this.loadPointsetURL=(e,t,r,i,n,a,s)=>{var o=0;this.toBeDownloaded+=1,null!=r&&(o=!!r);var l=0;null!=i&&(l=!!i);var h=!(!s||!s.isInline)&&s.isInline,c=s&&s.anatomicalId?s.anatomicalId:void 0,d=s&&s.renderOrder?s.renderOrder:void 0;if(h){var p=u.parse(t);m(e,o,l,n,c,d,a)(p.geometry,p.materials)}else u.load(t,m(e,o,l,n,c,d,a),this.onProgress(t),this.onError(a),s.loaderOptions)};var g=(e,t,i,n,s,o)=>{var l=o&&o.isInline?o.isInline:void 0,h=o&&o.anatomicalId?o.anatomicalId:void 0,c=o&&o.renderOrder?o.renderOrder:void 0,u=void 0;if(i){if(t&&i.images&&i.images.source)for(var d,p=i.images.source,m=0;m{--this.toBeDownloaded,null!=s&&"function"==typeof s&&s(u)}),l),u.anatomicalId=h,u.setRenderOrder(c),e.addZincObject(u))}};this.loadTextureURL=(e,t,r,i,a)=>{if(a&&a.isInline&&a.isInline)g(e,void 0,t,r,i,a);else{var s=new XMLHttpRequest;s.onreadystatechange=((e,t,r,i,n)=>()=>{if(4==t.readyState&&200==t.status){var a=JSON.parse(t.responseText);g(e,t.responseURL,a,r,i,n)}})(e,s,r,i,a),s.open("GET",n(t),!0),s.send()}},this.loadGlyphsetURL=(e,t,r,i,a,s)=>{if(s&&s.isInline&&s.isInline)p(e,t,r,i,a,s);else{var o=new XMLHttpRequest;o.onreadystatechange=((e,t,r,i,n,a)=>()=>{if(4==t.readyState&&200==t.status){var s=JSON.parse(t.responseText);p(e,s,r,i,n,a)}})(e,o,r,i,a,s),o.open("GET",n(t),!0),o.send()}};var y=(e,i,n,a,s,o,l,h,c,d)=>(p,m)=>{var f;m&&m[0]&&(f=m[0]);var v=((e,i,n,a,s,o,l,h,c)=>{var u={colour:n,opacity:a,localTimeEnabled:s,localMorphColour:o},d=new(r(5672).V);return d.createMesh(i,h,u),d.getMorph()?(d.setName(c),e&&e.addZincObject(d),d.setDuration(t.getDuration()),d.videoHandler&&t.setVideoHandler(d.videoHandler),d):void 0})(e,p,i,n,a,s,0,f,o);if(v.anatomicalId=l,v.setRenderOrder(h),c.lod&&c.lod.levels)for(var[g,y]of Object.entries(c.lod.levels))v.addLOD(u,g,y.URL,y.Index,c.lod.preload);--this.toBeDownloaded,p.dispose(),null!=d&&"function"==typeof d&&d(v)},x=e=>{var[,t,r,i,n,a,s,o]=e.match(/P(?:(\d+)Y)?(?:(\d+)M)?(?:(\d+)W)?(?:(\d+)D)?(?:T(?:(\d+)H)?(?:(\d+)M)?(?:(\d+)S)?)?$/);return{years:t,months:r,weeks:i,days:n,hours:a,mins:s,secs:o}};this.loadSettings=e=>{if(e){if(e.Duration){var r=x(e.Duration);t.setDurationFromObject(r)}if(e.OriginalDuration){var i=x(e.OriginalDuration);t.setOriginalDurationFromObject(i)}if(e.TimeStamps)for(var n in e.TimeStamps){var a=x(e.TimeStamps[n]);t.addMetadataTimeStamp(n,a)}}};var b=(e,t,r,i,n)=>{if(r){var s=void 0,o=!1;r.URL?(s=r.URL,t&&(s=a(s,t))):r.Inline&&(s=r.Inline.URL,o=!0);var l={};if(r.LOD&&r.LOD.Levels)for(var[h,c]of(l.preload=!!r.LOD.Preload,l.levels={},Object.entries(r.LOD.Levels)))l.levels[h]={},l.levels[h].URL=a(c.URL,t),l.levels[h].Index=c.Index;var u=r.GroupName;(void 0===u||""===u)&&(u="_Unnamed");var d={loaderOptions:{index:r.Index},isInline:o,fileFormat:r.FileFormat,anatomicalId:r.AnatomicalId,compression:r.compression,lod:l,renderOrder:i};switch(r.Type){case"Surfaces":f(e,s,r.MorphVertices,r.MorphColours,u,n,d);break;case"Glyph":var p;o?p=r.Inline.GlyphGeometriesURL:(p=r.GlyphGeometriesURL,p=a(r.GlyphGeometriesURL,t)),r.DisplayLabels&&(d.displayLabels=!0),this.loadGlyphsetURL(e,s,p,u,n,d);break;case"Points":this.loadPointsetURL(e,s,r.MorphVertices,r.MorphColours,u,n,d);break;case"Lines":this.loadLinesURL(e,s,r.MorphVertices,r.MorphColours,u,n,d);break;case"Texture":this.loadTextureURL(e,s,u,n,d)}}},w=(e,r,i)=>{if(r){var n=void 0,s=!1;switch(r.URL?(n=r.URL,e&&(n=a(r.URL,e))):r.Inline&&(n=r.Inline.URL,s=!0),r.Type){case"View":s?(t.setupMultipleViews("default",{default:n}),h=!0,null!=i&&"function"==typeof i&&i()):this.loadViewURL(n,i);break;case"Settings":this.loadSettings(r)}}};this.loadGLTF=(e,i,n,a,s)=>{(new(r(5576).H)).load(t,e,i,n,a,s)};var _=(e,t,r,i)=>{if(r.Primitives&&r.Primitives.forEach((r=>{var n=1;r.Order&&(n=r.Order),b(e,t,r,n,i)})),r.Transformation&&e.setTransformation(r.Transformation),r.Children)for(var[n,a]of Object.entries(r.Children)){var s=e.findOrCreateChildFromPath(n);s&&_(s,t,a,i)}},M=(e,t)=>{if(Array.isArray(e)){for(var r=0,i=0;i{var t=e.Primitives?M(e.Primitives,!1):0;return e.Children&&Object.values(e.Children).forEach((e=>{t+=S(e)})),t},T=e=>Array.isArray(e)?M(e,!0):"object"==typeof e&&null!==e&&"2.0"===e.Version?S(e.Regions):void 0,E=(e,t,r,i,n)=>{var a=e;r.RegionPath&&""!==r.RegionPath&&(a=e.findOrCreateChildFromPath(r.RegionPath)),b(a,t,r,2*i,n)},A=(e,r,i,n,s)=>{var o=T(r),l=new v(o,n,s);r.Settings&&this.loadSettings(r.Settings),r.Views&&((e,r)=>{var i=r.Default;if(r.Inline)t.setupMultipleViews(i,r.Entries);else{var n=[],s=function(t){e&&(newURL=a(l,e),n.push(new Promise(((e,r)=>{fetch(newURL).then((e=>e.json())).then((r=>e({key:t,data:r}))).catch((e=>r(e)))}))))};for(var[o,l]of Object.entries(r.Entries))s(o);Promise.all(n).then((e=>{var r={};e.forEach((e=>{r[e.key]=e.data})),t.setupMultipleViews(i,r);var n=t.getZincCameraControls();n&&n.setCurrentViewport(i),h=!0}))}})(i,r.Views),r.Regions&&_(e,i,r.Regions,l)};this.loadMetadataURL=(e,r,i,a)=>{var s=new XMLHttpRequest,o=n(r);s.onreadystatechange=()=>{if(4==s.readyState&&200==s.status){t.resetMetadata(),t.resetDuration(),h=!1;var r=s.responseURL;void 0===r&&(r=new URL(o).href);var n=JSON.parse(s.responseText);Array.isArray(n)?((e,t,r,i,n)=>{for(var a=T(t),s=new v(a,i,n),o=0;o{var i=r(1515),n=i.GLSL3;t.fs="\nprecision highp float;\nprecision highp int;\nprecision highp sampler2DArray;\n\nuniform sampler2DArray diffuse;\nin vec3 vUw;\n\nout vec4 outColor;\n\nvoid main() {\n\n vec4 color = texture( diffuse, vUw );\n\n // lighten a bit\n outColor = vec4( color.rgb + .2, 1.0 );\n\n}\n",t.vs="\nout vec3 vUw;\nuniform float depth;\nuniform vec3 slide;\nuniform int direction;\nuniform bool flipY;\n\nvoid main() {\n\n vec3 slidePos = position.xyz;\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position.xyz, 1.0 );\n\n if (direction == 1)\n slidePos = vec3(slide.x, position.y, position.x);\n if (direction == 2)\n slidePos = vec3(position.x, slide.y, position.y);\n if (direction == 3)\n slidePos = vec3(position.x, position.y, slide.z);\n\n if (flipY) \n slidePos.y = 1.0 - slidePos.y;\n\n vUw.xyz = vec3(slidePos.x, slidePos.y, slidePos.z * depth);\n\n}\n",t.glslVersion=n,t.getUniforms=function(){return{diffuse:{value:void 0},depth:{value:1},slide:{value:new i.Vector3(0,0,1)},direction:{value:1},flipY:{value:!0}}}},1860:(e,t,r)=>{function i(e,t,r,i,n,a,s){try{var o=e[a](s),l=o.value}catch(e){return void r(e)}o.done?t(l):Promise.resolve(l).then(i,n)}function n(e){return function(){var t=this,r=arguments;return new Promise((function(n,a){function s(e){i(l,n,a,s,o,"next",e)}function o(e){i(l,n,a,s,o,"throw",e)}var l=e.apply(t,r);s(void 0)}))}}var a=r(1515),s=function(){this.isTexture=!0,this.impl=void 0,this.isLoading=!1,this.size={width:1,height:1,depth:0}};s.prototype.loadImage=function(e,t){return new Promise(((r,i)=>{e.onload=()=>r(e),e.onerror=i,e.src=t}))},s.prototype.imageToUint8Array=function(){var e=n((function*(e,t,r,i){yield e.loadImage(t,r),i.width=t.width,i.height=t.height;var n=i.getContext("2d");return n.drawImage(t,0,0),{array:new Uint8Array(n.getImageData(0,0,i.width,i.height).data.buffer),width:i.width,height:i.height}}));return function(){return e.apply(this,arguments)}}(),s.prototype.loadFromImages=function(){var e=n((function*(){}));return function(){return e.apply(this,arguments)}}(),s.prototype.isReady=function(){return!(!this.impl||this.isLoading)},s.prototype.getMaterial=function(){if(this.impl)return new a.MeshBasicMaterial({color:new a.Color(1,1,1),transparent:!1,opacity:1,map:this.impl,side:a.DoubleSide})},t.g=s},3523:(e,t,r)=>{function i(e,t,r,i,n,a,s){try{var o=e[a](s),l=o.value}catch(e){return void r(e)}o.done?t(l):Promise.resolve(l).then(i,n)}var n=r(1515),a=function(){var e=this;r(1860).g.call(this),this.isTextureArray=!0,this.loadFromImages=function(){var t,r=(t=function*(t){var r=1,i=1,a=0;if(t&&t.length){e.isLoading=!0;var s=new Image;s.crossOrigin="Anonymous";for(var o,l=document.createElement("canvas"),h=0,c=Array(t.length),u=0;u{d.set(e,h),h+=e.length})),e.impl=new n.DataTexture2DArray(d,r,i,a),e.size={width:r,height:i,depth:a},e.isLoading=!1,e.impl.needsUpdate=!0}},function(){var e=this,r=arguments;return new Promise((function(n,a){function s(e){i(l,n,a,s,o,"next",e)}function o(e){i(l,n,a,s,o,"throw",e)}var l=t.apply(e,r);s(void 0)}))});return function(){return r.apply(this,arguments)}}(),this.getMaterial=e=>{if(this.impl){var t;if(e){if(e.vs&&e.fs){var r=!0;e.transparent&&(r=e.transparent);var i=n.FrontSide;e.side&&(i=e.side),t=new n.ShaderMaterial({transparent:r,uniforms:e.uniforms,vertexShader:e.vs,fragmentShader:e.fs,side:i}),e.glslVersion&&(t.glslVersion=e.glslVersion)}}else t=new n.MeshBasicMaterial({color:new n.Color(1,1,1),transparent:!1,opacity:1,map:this.impl,side:n.DoubleSide});if(t)return t.needsUpdate=!0,t}}};a.prototype=Object.create(r(1860).g.prototype),t.$=a},6133:e=>{"use strict";e.exports=function(e){var t=function(r){var i,n,a,s,o,l,h,c=[];if(r.isBufferGeometry&&(r=(new e.Geometry).fromBufferGeometry(r)),r instanceof e.Geometry)this.matrix=new e.Matrix4;else{if(!r.isMesh){if(r instanceof t.Node)return this.tree=r,this.matrix=new e.Matrix4,this;throw"ThreeBSP: Given geometry is unsupported"}r.updateMatrix(),this.matrix=r.matrix.clone(),(r=r.geometry).isBufferGeometry&&(r=(new e.Geometry).fromBufferGeometry(r)),r.mergeVertices(),r.computeVertexNormals(!1)}for(i=0,n=r.faces.length;i1e-5?1:0},t.Polygon.prototype.classifySide=function(e){var t,r,i,n=0,a=0,s=e.vertices.length;for(t=0;t{"use strict";r.d(t,{r:()=>n});var i=r(1515);class n{constructor(){this.pluginCallbacks=[],this.register((function(e){return new m(e)})),this.register((function(e){return new f(e)})),this.register((function(e){return new v(e)}))}register(e){return-1===this.pluginCallbacks.indexOf(e)&&this.pluginCallbacks.push(e),this}unregister(e){return-1!==this.pluginCallbacks.indexOf(e)&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(e),1),this}parse(e,t,r){for(var i=new p,n=[],a=0,s=this.pluginCallbacks.length;a(i=Math.min(h,c)-r)&&(i=0)}if(0===i)return null;var u,d=function(e,t,r){for(var i={min:Array(e.itemSize).fill(Number.POSITIVE_INFINITY),max:Array(e.itemSize).fill(Number.NEGATIVE_INFINITY)},n=t;no.maxTextureSize||e.height>o.maxTextureSize)&&console.warn("GLTFExporter: Image size is bigger than maxTextureSize",e);var v=new Uint8ClampedArray(e.height*e.width*4);if(t===i.RGBAFormat)for(var g=0;gO&&I.setXYZ(O,R.getX(O)-P.getX(O),R.getY(O)-P.getY(O),R.getZ(O)-P.getZ(O));else for(var N=0,B=R.count;N=e.far?.001:e.far,znear:0>e.near?0:e.near}:n.perspective={aspectRatio:e.aspect,yfov:i.MathUtils.degToRad(e.fov),zfar:0>=e.far?.001:e.far,znear:0>e.near?0:e.near},""!==e.name&&(n.name=e.type),t.cameras.push(n)-1}processAnimation(e,t){var r=this.json,a=this.nodeMap;r.animations||(r.animations=[]);for(var s=(e=n.Utils.mergeMorphTargetTracks(e.clone(),t)).tracks,o=[],h=[],c=0;ce.times[e.times.length-1]){if(Math.abs(e.times[e.times.length-1]-t)t){a.set(e.times.slice(0,h+1),0),a[h+1]=t,a.set(e.times.slice(h+1),h+2),s.set(e.values.slice(0,(h+1)*n),0),s.set(o.evaluate(t),(h+1)*n),s.set(e.values.slice((h+1)*n),(h+2)*n),r=h+1;break}}return e.times=a,e.values=s,r},mergeMorphTargetTracks:function(e,t){for(var r=[],n={},a=e.tracks,s=0;s{"use strict";r.d(t,{V:()=>l,n:()=>c});var i=r(1515),n=new i.Matrix4,a=new i.Object3D,s=new i.Vector3,o=new i.Vector3;function l(){this.uuid=i.MathUtils.generateUUID(),this.name="",this.type="Geometry",this.vertices=[],this.colors=[],this.faces=[],this.faceVertexUvs=[[]],this.normals=[],this.uvs=[],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,this.morphNormalsReady=!1}l.prototype=Object.assign(Object.create(i.EventDispatcher.prototype),{constructor:l,isGeometry:!0,applyMatrix4:function(e){for(var t=(new i.Matrix3).getNormalMatrix(e),r=0,n=this.vertices.length;rm;m++)if(p[m]===p[(m+1)%3]){c.push(u);break}}for(var f,v=c.length-1;0<=v;v--){f=c[v],this.faces.splice(f,1);for(var g=0,y=this.faceVertexUvs.length;g{"use strict";r.d(t,{a:()=>l});var i,n,a,s,o=r(1515);function l(){}r(1515),l.Handlers={handlers:[],add:function(e,t){this.handlers.push(e,t)},get:function(e){for(var t=this.handlers,r=0,i=t.length;ru.opacity&&(u.transparent=!0),s.setTextures(c),s.parse(u)})})},377:(e,t,r)=>{"use strict";r.d(t,{O:()=>c});var i=r(1515),n=new i.Matrix4,a=new i.Ray,s=new i.Sphere,o=new i.Vector3,l=new i.Vector3,h=new i.Vector3;class c extends i.Object3D{constructor(){var e=0s.far)return;o.push({distance:u,distanceToRay:Math.sqrt(h),point:c,index:t,face:null,object:l})}}function d(e,t,r,i){o.fromBufferAttribute(t,i);var n=e.morphTargetInfluences;if(e.material.morphTargets&&r&&n){l.set(0,0,0);for(var a=0,s=r.length;a{"use strict";r.d(t,{G:()=>n});var i=r(1515);i.UniformsLib.line={linewidth:{value:1},resolution:{value:new i.Vector2(1,1)},dashScale:{value:1},dashSize:{value:1},dashOffset:{value:0},gapSize:{value:1},opacity:{value:1}},i.ShaderLib.line={uniforms:i.UniformsUtils.merge([i.UniformsLib.common,i.UniformsLib.fog,i.UniformsLib.line]),vertexShader:"\n\t\t#include \n\t\t#include \n\t\t#include \n\t\t#include \n\t\t#include \n\n\t\tuniform float linewidth;\n\t\tuniform vec2 resolution;\n\n\t\tattribute vec3 instanceStart;\n\t\tattribute vec3 instanceEnd;\n\n\t\tattribute vec3 instanceColorStart;\n\t\tattribute vec3 instanceColorEnd;\n\n\t\tvarying vec2 vUv;\n\n\t\t#ifdef USE_DASH\n\n\t\t\tuniform float dashScale;\n\t\t\tattribute float instanceDistanceStart;\n\t\t\tattribute float instanceDistanceEnd;\n\t\t\tvarying float vLineDistance;\n\n\t\t#endif\n\n\t\tvoid trimSegment( const in vec4 start, inout vec4 end ) {\n\n\t\t\t// trim end segment so it terminates between the camera plane and the near plane\n\n\t\t\t// conservative estimate of the near plane\n\t\t\tfloat a = projectionMatrix[ 2 ][ 2 ]; // 3nd entry in 3th column\n\t\t\tfloat b = projectionMatrix[ 3 ][ 2 ]; // 3nd entry in 4th column\n\t\t\tfloat nearEstimate = - 0.5 * b / a;\n\n\t\t\tfloat alpha = ( nearEstimate - start.z ) / ( end.z - start.z );\n\n\t\t\tend.xyz = mix( start.xyz, end.xyz, alpha );\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\t#ifdef USE_COLOR\n\n\t\t\t\tvColor.xyz = ( position.y < 0.5 ) ? instanceColorStart : instanceColorEnd;\n\n\t\t\t#endif\n\n\t\t\t#ifdef USE_DASH\n\n\t\t\t\tvLineDistance = ( position.y < 0.5 ) ? dashScale * instanceDistanceStart : dashScale * instanceDistanceEnd;\n\n\t\t\t#endif\n\n\t\t\tfloat aspect = resolution.x / resolution.y;\n\n\t\t\tvUv = uv;\n\n\t\t\t// camera space\n\t\t\tvec4 start = modelViewMatrix * vec4( instanceStart, 1.0 );\n\t\t\tvec4 end = modelViewMatrix * vec4( instanceEnd, 1.0 );\n\n\t\t\t// special case for perspective projection, and segments that terminate either in, or behind, the camera plane\n\t\t\t// clearly the gpu firmware has a way of addressing this issue when projecting into ndc space\n\t\t\t// but we need to perform ndc-space calculations in the shader, so we must address this issue directly\n\t\t\t// perhaps there is a more elegant solution -- WestLangley\n\n\t\t\tbool perspective = ( projectionMatrix[ 2 ][ 3 ] == - 1.0 ); // 4th entry in the 3rd column\n\n\t\t\tif ( perspective ) {\n\n\t\t\t\tif ( start.z < 0.0 && end.z >= 0.0 ) {\n\n\t\t\t\t\ttrimSegment( start, end );\n\n\t\t\t\t} else if ( end.z < 0.0 && start.z >= 0.0 ) {\n\n\t\t\t\t\ttrimSegment( end, start );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t// clip space\n\t\t\tvec4 clipStart = projectionMatrix * start;\n\t\t\tvec4 clipEnd = projectionMatrix * end;\n\n\t\t\t// ndc space\n\t\t\tvec2 ndcStart = clipStart.xy / clipStart.w;\n\t\t\tvec2 ndcEnd = clipEnd.xy / clipEnd.w;\n\n\t\t\t// direction\n\t\t\tvec2 dir = ndcEnd - ndcStart;\n\n\t\t\t// account for clip-space aspect ratio\n\t\t\tdir.x *= aspect;\n\t\t\tdir = normalize( dir );\n\n\t\t\t// perpendicular to dir\n\t\t\tvec2 offset = vec2( dir.y, - dir.x );\n\n\t\t\t// undo aspect ratio adjustment\n\t\t\tdir.x /= aspect;\n\t\t\toffset.x /= aspect;\n\n\t\t\t// sign flip\n\t\t\tif ( position.x < 0.0 ) offset *= - 1.0;\n\n\t\t\t// endcaps\n\t\t\tif ( position.y < 0.0 ) {\n\n\t\t\t\toffset += - dir;\n\n\t\t\t} else if ( position.y > 1.0 ) {\n\n\t\t\t\toffset += dir;\n\n\t\t\t}\n\n\t\t\t// adjust for linewidth\n\t\t\toffset *= linewidth;\n\n\t\t\t// adjust for clip-space to screen-space conversion // maybe resolution should be based on viewport ...\n\t\t\toffset /= resolution.y;\n\n\t\t\t// select end\n\t\t\tvec4 clip = ( position.y < 0.5 ) ? clipStart : clipEnd;\n\n\t\t\t// back to clip space\n\t\t\toffset *= clip.w;\n\n\t\t\tclip.xy += offset;\n\n\t\t\tgl_Position = clip;\n\n\t\t\tvec4 mvPosition = ( position.y < 0.5 ) ? start : end; // this is an approximation\n\n\t\t\t#include \n\t\t\t#include \n\t\t\t#include \n\n\t\t}",fragmentShader:"\n\t\tuniform vec3 diffuse;\n\t\tuniform float opacity;\n\n\t\t#ifdef USE_DASH\n\n\t\t\tuniform float dashSize;\n\t\t\tuniform float dashOffset;\n\t\t\tuniform float gapSize;\n\n\t\t#endif\n\n\t\tvarying float vLineDistance;\n\n\t\t#include \n\t\t#include \n\t\t#include \n\t\t#include \n\t\t#include \n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\t#include \n\n\t\t\t#ifdef USE_DASH\n\n\t\t\t\tif ( vUv.y < - 1.0 || vUv.y > 1.0 ) discard; // discard endcaps\n\n\t\t\t\tif ( mod( vLineDistance + dashOffset, dashSize + gapSize ) > dashSize ) discard; // todo - FIX\n\n\t\t\t#endif\n\n\t\t\tfloat alpha = opacity;\n\n\t\t\t#ifdef ALPHA_TO_COVERAGE\n\n\t\t\t// artifacts appear on some hardware if a derivative is taken within a conditional\n\t\t\tfloat a = vUv.x;\n\t\t\tfloat b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0;\n\t\t\tfloat len2 = a * a + b * b;\n\t\t\tfloat dlen = fwidth( len2 );\n\n\t\t\tif ( abs( vUv.y ) > 1.0 ) {\n\n\t\t\t\talpha = 1.0 - smoothstep( 1.0 - dlen, 1.0 + dlen, len2 );\n\n\t\t\t}\n\n\t\t\t#else\n\n\t\t\tif ( abs( vUv.y ) > 1.0 ) {\n\n\t\t\t\tfloat a = vUv.x;\n\t\t\t\tfloat b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0;\n\t\t\t\tfloat len2 = a * a + b * b;\n\n\t\t\t\tif ( len2 > 1.0 ) discard;\n\n\t\t\t}\n\n\t\t\t#endif\n\n\t\t\tvec4 diffuseColor = vec4( diffuse, alpha );\n\n\t\t\t#include \n\t\t\t#include \n\n\t\t\tgl_FragColor = vec4( diffuseColor.rgb, alpha );\n\n\t\t\t#include \n\t\t\t#include \n\t\t\t#include \n\t\t\t#include \n\n\t\t}"};class n extends i.ShaderMaterial{constructor(e){super({type:"LineMaterial",uniforms:i.UniformsUtils.clone(i.ShaderLib.line.uniforms),vertexShader:i.ShaderLib.line.vertexShader,fragmentShader:i.ShaderLib.line.fragmentShader,clipping:!0}),Object.defineProperties(this,{color:{enumerable:!0,get:function(){return this.uniforms.diffuse.value},set:function(e){this.uniforms.diffuse.value=e}},linewidth:{enumerable:!0,get:function(){return this.uniforms.linewidth.value},set:function(e){this.uniforms.linewidth.value=e}},dashed:{enumerable:!0,get:function(){return!!("USE_DASH"in this.defines)},set(e){!!e!=!!("USE_DASH"in this.defines)&&(this.needsUpdate=!0),!0===e?this.defines.USE_DASH="":delete this.defines.USE_DASH}},dashScale:{enumerable:!0,get:function(){return this.uniforms.dashScale.value},set:function(e){this.uniforms.dashScale.value=e}},dashSize:{enumerable:!0,get:function(){return this.uniforms.dashSize.value},set:function(e){this.uniforms.dashSize.value=e}},dashOffset:{enumerable:!0,get:function(){return this.uniforms.dashOffset.value},set:function(e){this.uniforms.dashOffset.value=e}},gapSize:{enumerable:!0,get:function(){return this.uniforms.gapSize.value},set:function(e){this.uniforms.gapSize.value=e}},opacity:{enumerable:!0,get:function(){return this.uniforms.opacity.value},set:function(e){this.uniforms.opacity.value=e}},resolution:{enumerable:!0,get:function(){return this.uniforms.resolution.value},set:function(e){this.uniforms.resolution.value.copy(e)}},alphaToCoverage:{enumerable:!0,get:function(){return!!("ALPHA_TO_COVERAGE"in this.defines)},set:function(e){!!e!=!!("ALPHA_TO_COVERAGE"in this.defines)&&(this.needsUpdate=!0),!0===e?(this.defines.ALPHA_TO_COVERAGE="",this.extensions.derivatives=!0):(delete this.defines.ALPHA_TO_COVERAGE,this.extensions.derivatives=!1)}}}),this.setValues(e)}}n.prototype.isLineMaterial=!0},1491:(e,t,r)=>{"use strict";r.d(t,{D:()=>g});var i=r(1515),n=new i.Vector3,a=new i.Vector3,s=new i.Matrix4,o=new i.Ray,l=new i.Sphere,h=new i.Vector3,c=new i.Vector3,u=new i.Vector3,d=new i.Vector3;class p extends i.Object3D{constructor(){var e=0d)){g.applyMatrix4(this.matrixWorld);var S=e.ray.origin.distanceTo(g);Se.far||t.push({distance:S,point:v.clone().applyMatrix4(this.matrixWorld),index:M,face:null,faceIndex:null,object:this})}}else for(var T=Math.max(0,h.start),E=Math.min(b.count,h.start+h.count),A=T;Ad)){g.applyMatrix4(this.matrixWorld);var L=e.ray.origin.distanceTo(g);Le.far||t.push({distance:L,point:v.clone().applyMatrix4(this.matrixWorld),index:A,face:null,faceIndex:null,object:this})}}else r.isGeometry&&console.error("THREE.Line.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}}updateMorphTargets(){var e=this.geometry;if(e.isBufferGeometry){var t=e.morphAttributes,r=Object.keys(t);if(0{"use strict";r.d(t,{b:()=>y});var i=r(1515),n=r(5807),a=r(9236),s=new i.Vector3,o=new i.Vector3,l=new i.Vector4,h=new i.Vector4,c=new i.Vector4,u=new i.Vector3,d=new i.Matrix4,p=new i.Line3,m=new i.Vector3,f=new i.Box3,v=new i.Sphere,g=new i.Vector4;class y extends i.Mesh{constructor(){super(0S&&h.z>S)){if(l.z>S){var I=l.z-h.z,O=(l.z-S)/I;l.lerp(h,O)}else if(h.z>S){var D=h.z-l.z,N=(h.z-S)/D;h.lerp(l,N)}l.applyMatrix4(s),h.applyMatrix4(s),l.multiplyScalar(1/l.w),h.multiplyScalar(1/h.w),l.x*=b.x/2,l.y*=b.y/2,h.x*=b.x/2,h.y*=b.y/2,p.start.copy(l),p.start.z=0,p.end.copy(h),p.end.z=0;var B=p.closestPointToPointParameter(u,!0);p.at(B,m);var U=i.MathUtils.lerp(l.z,h.z,B),z=-1<=U&&1>=U,F=u.distanceTo(m)<.5*w;if(z&&F){p.start.fromBufferAttribute(_,C),p.end.fromBufferAttribute(M,C),p.start.applyMatrix4(o),p.end.applyMatrix4(o);var G=new i.Vector3,V=new i.Vector3;n.distanceSqToSegment(p.start,p.end,V,G),t.push({point:V,pointOnLine:G,distance:n.origin.distanceTo(V),object:this,face:null,faceIndex:C,uv:null,uv2:null})}}}}}}y.prototype.LineSegments2=!0},5807:(e,t,r)=>{"use strict";r.d(t,{n:()=>s});var i=r(1515),n=new i.Box3,a=new i.Vector3;class s extends i.InstancedBufferGeometry{constructor(){super(),this.type="LineSegmentsGeometry",this.setIndex([0,2,1,2,3,1,2,4,3,4,5,3,4,6,5,6,7,5]),this.setAttribute("position",new i.Float32BufferAttribute([-1,2,0,1,2,0,-1,1,0,1,1,0,-1,0,0,1,0,0,-1,-1,0,1,-1,0],3)),this.setAttribute("uv",new i.Float32BufferAttribute([-1,2,1,2,-1,1,1,1,-1,-1,1,-1,-1,-2,1,-2],2))}applyMatrix4(e){var t=this.attributes.instanceStart,r=this.attributes.instanceEnd;return void 0!==t&&(t.applyMatrix4(e),r.applyMatrix4(e),t.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this}setPositions(e){var t;e instanceof Float32Array?t=e:Array.isArray(e)&&(t=new Float32Array(e));var r=new i.InstancedInterleavedBuffer(t,6,1);return this.setAttribute("instanceStart",new i.InterleavedBufferAttribute(r,3,0)),this.setAttribute("instanceEnd",new i.InterleavedBufferAttribute(r,3,3)),this.computeBoundingBox(),this.computeBoundingSphere(),this}setColors(e){var t;e instanceof Float32Array?t=e:Array.isArray(e)&&(t=new Float32Array(e));var r=new i.InstancedInterleavedBuffer(t,6,1);return this.setAttribute("instanceColorStart",new i.InterleavedBufferAttribute(r,3,0)),this.setAttribute("instanceColorEnd",new i.InterleavedBufferAttribute(r,3,3)),this}fromWireframeGeometry(e){return this.setPositions(e.attributes.position.array),this}fromEdgesGeometry(e){return this.setPositions(e.attributes.position.array),this}fromMesh(e){return this.fromWireframeGeometry(new i.WireframeGeometry(e.geometry)),this}fromLineSegments(e){var t=e.geometry;return t.isGeometry?void console.error("THREE.LineSegmentsGeometry no longer supports Geometry. Use THREE.BufferGeometry instead."):(t.isBufferGeometry&&this.setPositions(t.attributes.position.array),this)}computeBoundingBox(){null===this.boundingBox&&(this.boundingBox=new i.Box3);var e=this.attributes.instanceStart,t=this.attributes.instanceEnd;void 0!==e&&void 0!==t&&(this.boundingBox.setFromBufferAttribute(e),n.setFromBufferAttribute(t),this.boundingBox.union(n))}computeBoundingSphere(){null===this.boundingSphere&&(this.boundingSphere=new i.Sphere),null===this.boundingBox&&this.computeBoundingBox();var e=this.attributes.instanceStart,t=this.attributes.instanceEnd;if(void 0!==e&&void 0!==t){var r=this.boundingSphere.center;this.boundingBox.getCenter(r);for(var n=0,s=0,o=e.count;s{var i=r(1515),n=r(8154).V,a=r(8221).A;function s(e){var t=e,i=r(1913).modelPrefix;return i&&("/"!=i[i.length-1]&&function(e){throw new TypeError('"prefix" is read-only')}(),/^(?:[a-z]+:)?\/\//i.test(e)||(t=i+e)),t}function o(e,t,r,i){var n=new XMLHttpRequest;n.open("GET",s(e),!0),n.onreadystatechange=()=>{4==n.readyState&&(200==n.status?r(n.responseText,t):i(e))},n.send(null)}t.getColorsRGB=(e,t)=>{var r=Math.floor(t/3),n=t%3,a=0;0==n?a=e[r].r:1==n?a=e[r].g:2==n&&(a=e[r].b);var s=new i.Color(a);return[s.r,s.g,s.b]},t.updateMorphColorAttribute=function(e,t){if(t&&e&&e.morphAttributes&&e.morphAttributes.color){var r=e.morphAttributes.color,i=t.morphTargetInfluences,n=i.length;e.deleteAttribute("morphColor0"),e.deleteAttribute("morphColor1");for(var a=0,s=[],o=0;1>a||o{var r;return e instanceof n?(t.localTimeEnabled&&!e.morphNormalsReady&&(null==e.morphNormals||0==e.morphNormals.length)&&e.computeMorphNormals(),r=e.toIndexedBufferGeometry(),t.localMorphColour&&l(e,r)):e instanceof i.BufferGeometry&&(r=e.clone()),r.colorsNeedUpdate=!0,r.computeBoundingBox(),r.computeBoundingSphere(),e._video&&(r._video=e._video),r},t.copyMorphColorsToBufferGeometry=(e,t)=>{if(e&&e.morphColors&&0{if(e&&e.morphColors&&0[])));var f=Math.log10(1/t),v=Math.pow(10,f);for(p=0;p=Math.pow(2,8)&&(D=Uint16Array),u.length>=Math.pow(2,16)&&(D=Uint32Array);var N=new D(u);return u=null,null===n?u=new i.BufferAttribute(N,1):(u=e.getIndex().clone()).setArray(N),C.setIndex(u),C},t.getBoundingBox=function(e,t,r,i,n){var a=e.morphTargetInfluences,s=void 0;e.geometry&&(s=e.geometry.morphAttributes);var o=!1;if(a&&s&&s.position){i.set(0,0,0),n.set(0,0,0);for(var l=0;l{try{var r=new URL(e,t).href;if(e&&2>e.split("?").length){var i=t.split("?");2===i.length&&(r=r+"?"+i[1])}return r}catch(t){console.error("There is an issue creting the url link with: ".concat(e,"."))}};if(!Array.isArray(e))return r(e,t);var i=[];return e.forEach((e=>{i.push(r(e,t))})),i},t.createBufferGeometry=function(e,t){if(t&&e>=t.length){var r=new i.BufferGeometry,n=new Float32Array(3*e),a=0;return t.forEach((e=>{n[a++]=e[0],n[a++]=e[1],n[a++]=e[2]})),r.setAttribute("position",new i.BufferAttribute(n,3)),r.setDrawRange(0,t.length),r}},t.getCircularTexture=function(){var e=new Image;e.src=r(2978);var t=new i.Texture;return t.image=e,t.needsUpdate=!0,t},t.resolveURL=s,t.loadExternalFile=o,t.loadExternalFiles=function(e,t,r){function i(e,r){s[r]=e,++a==n&&t(s)}for(var n=e.length,a=0,s=[],l=0;l{var i=r(1515);t.i=function(e){var t=this;this.video=void 0,this.videoTexture=void 0,this.setMorphTime=function(e,r){var i=e/r*t.video.duration;t.video.currentTime=i},this.getVideoDuration=function(){return t.video.duration},this.createCanvasVideoTexture=function(){return t.videoTexture=new i.VideoTexture(t.video),t.videoTexture.minFilter=i.LinearFilter,t.videoTexture.magFilter=i.LinearFilter,t.videoTexture.format=i.RGBFormat,t.video.currentTime=0,t.videoTexture},this.getCurrentTime=function(e){return t.video?e*(t.video.currentTime/t.video.duration):0},this.isReadyToPlay=function(){return!!(t.video&&3<=t.video.readyState)},document&&(t.video=document.createElement("video"),t.video.crossOrigin="anonymous",t.video.src=e,t.video.load(),t.video.loop=!0)}},4494:(e,t,r)=>{var i=r(5672).V,n=r(1515),a=n.BufferGeometryLoader;e.exports=function(e){var t=void 0,s=function(e){var t=(new a).parse(e),r=new n.MeshPhongMaterial,s=new n.Mesh(t.geometry,r),o=new i;return o.setMorph(s),o};e.addEventListener("message",(function(i){switch(i.data.action){case"initialise":n=i.data.object,a=s(n),t=new(r(8701).$)(a),e.postMessage({action:"message",message:"Initialised"});break;case"intersect":!function(r){if(t){var i=s(r),n=t.intersect(i).toBufferGeometry().toJSON();e.postMessage({action:"result",object:n})}}(i.data.object);break;case"subtract":!function(r){if(t){var i=s(r),n=t.subtract(i).toBufferGeometry().toJSON();e.postMessage({action:"result",object:n})}}(i.data.object);break;case"union":!function(r){if(t){var i=s(r),n=t.union(i).toBufferGeometry().toJSON();e.postMessage({action:"result",object:n})}}(i.data.object);break;default:throw"Cannot handle specified action."}var n,a}))}},8701:(e,t,r)=>{var i=r(1515),n=r(6133)(i);r(5672).V,r(3152).w,t.$=function(e){var t,r;e&&e.isGeometry&&(t=e),this.setGeometry=e=>{e&&e.isGeometry&&(t=e),r=void 0},this.setCSG=e=>{r=e};var i=e=>{if(t&&t.morph&&e&&e.morph)return void 0===r&&(r=new n(t.morph)),new n(e.morph)};this.intersect=e=>{var t=i(e);return r&&t?r.intersect(t):void 0},this.subtract=e=>{var t=i(e);return r&&t?r.subtract(t):void 0},this.union=e=>{var t=i(e);return r&&t?r.union(t):void 0}}},1913:(e,t,r)=>{r(6550);var i=r(8330).version;e.exports=new function(){this.Revision=i,this.defaultMaterialColor=16777215,this.defaultOpacity=1,this.modelPrefix=void 0,this.Geometry=r(5672).V,this.Glyph=r(9344).z,this.Glyphset=r(2842).V,this.Pointset=r(770).t,this.Label=r(4296).J,this.Lines=r(8145).q,this.TextureArray=r(3523).$,this.TextureSlides=r(4291).W,this.Renderer=r(3260).A,this.Scene=r(5015).Z,this.GeometryCSG=r(3152).w,this.GlyphsetCSG=r(1602).K,this.Viewport=r(701).Viewport,this.CameraControls=r(701).CameraControls,this.SmoothCameraTransition=r(701).SmoothCameraTransition,this.RayCaster=r(701).RayCaster,this.CameraAutoTumble=r(701).CameraAutoTumble,this.StereoEffect=r(701).StereoEffect,this.loadExternalFile=r(2515).loadExternalFile,this.loadExternalFiles=r(2515).loadExternalFiles,this.THREE=r(1515)}},2978:e=>{e.exports="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAAZiS0dEAAAAAAAA+UO7fwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9sHDgwCEMBJZu0AAAAdaVRYdENvbW1lbnQAAAAAAENyZWF0ZWQgd2l0aCBHSU1QZC5lBwAABM5JREFUWMO1V0tPG2cUPZ4Hxh6DazIOrjFNqJs0FIMqWFgWQkatsmvVbtggKlSVRVf5AWz4AWz4AUSKEChll19QJYSXkECuhFxsHjEhxCYm+DWGMZ5HF72DJq4bAzFXurI0M/I5997v3u9cC65vTJVn2lX/xHINQOYSBLTLEuIuCWw4Z3IGAEvf6ASmVHjNzHCXBG4A0AjACsAOwEbO0nsFQBnAGYASAIl+ZRMR7SolMEdsByD09fV5R0ZGgg8ePPjW5/N1iqLYpuu6RZblciKR2I9Go69evnwZnZ+fjwI4IS8AKBIRzeQfJWCANwKwh0KhtrGxsYehUOin1tbW+zzP23ietzY2NnIAoGmaLsuyUiqVyvl8XtrY2NiamZn589mzZxsAUgCOAeQAnFI2tI+VxIjaAeDzoaGh7xYWFuZOTk6OZVk+12uYqqq6JEnn0Wg0OT4+/geAXwGEAdwDIFJQXC1wO4DWR48e/RCPxxclSSroVzRFUbSDg4P848ePFwH8DuAhkWih83TRQWxFOXgAwvDwcOfo6OhvXV1d39tsNtuVBwTDWBwOh1UUxVsMw1hXVlbSdCgNV43uYSvrHg6H24aHh38eHBz85TrgF9FYLHA4HLzH43FvbW2d7u/vG+dANp8FpqIlbd3d3V8Fg8EfBUFw4BONZVmL3+9vHhkZCQL4AoAHgJPK8G+yzC0XDofdoVAo5PP5vkadTBAEtr+/39ff3x8gAp/RPOEqx2qjx+NpvXv3bk9DQ0NDvQgwDIOWlhZrMBj8kgi0UJdxRgYMArzL5XJ7vd57qLPZ7Xamp6fnNgBXtQxcjFuHw+Hyer3t9SYgCAITCAScAJoBNNEY/08GOFVVrfVMv7kMNDntFD1vjIAPrlRN0xjckOm6biFQ3jwNPwDMZrOnqVTqfb3Bi8Wivru7W/VCYkwPlKOjo0IikXh7EwQikYgE4Nw0CfXKDCipVCoTj8df3QABbW1tLUc6oUgkFPMkVACUNjc337148eKvw8PDbJ2jP1taWkoCyNDVXDSECmNSK4qiKNLq6urW8+fPI/UicHx8rD59+jSVy+WOAKSJhKENwFItLtoxk8mwsixzHR0dHe3t7c5PAU+n09rs7OzJkydPYqVSaQfANoDXALIk31S2smU1TWMPDg7K5XKZ7+3t9TudTut1U7+wsFCcmJiIpdPpbQBxADsAknQWymYCOukBHYCuKApisdhpMpnURFEU79y503TVyKenpzOTk5M7e3t7MQKPV0Zv1gNm+awB0MvlshqLxfLb29uyJElWURSbXC4XXyvqxcXFs6mpqeTc3Nzu3t7e3wQcA7BPZ8Cov1pNlJplmQtAG8MwHV6v95tAINA5MDBwPxAIuLu6upr8fr/VAN3c3JQjkcjZ+vp6fnl5+d2bN29SuVzuNYAEpf01CdRChUL+X1VskHACuA3Ay3Fcu9vt7nA6nZ7m5uYWQRCaNE3jVVW15PP580KhIGUymWw2m00DOAJwSP4WwPtq4LX2Ao6USxNlQyS/RcQcdLGwlNIz6vEMAaZpNzCk2Pll94LK/cDYimxERiBwG10sxjgvEZBE0UpE6vxj+0Ct5bTaXthgEhRmja8QWNkkPGsuIpfdjpkK+cZUWTC0KredVmtD/gdlSl6EG4AMvQAAAABJRU5ErkJggg=="},2370:e=>{e.exports="data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIiA/Pg0KPCFET0NUWVBFIHN2ZyBQVUJMSUMgIi0vL1czQy8vRFREIFNWRyAxLjEvL0VOIiAiaHR0cDovL3d3dy53My5vcmcvR3JhcGhpY3MvU1ZHLzEuMS9EVEQvc3ZnMTEuZHRkIj4NCjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgdmVyc2lvbj0iMS4xIiB3aWR0aD0iMzY1IiBoZWlnaHQ9IjU2MCIgdmlld0JveD0iMCAwIDM2NSA1NjAiIHhtbDpzcGFjZT0icHJlc2VydmUiPg0KPGRlc2M+Q3JlYXRlZCB3aXRoIEZhYnJpYy5qcyA1LjIuNDwvZGVzYz4NCjxkZWZzPg0KPC9kZWZzPg0KPHJlY3QgeD0iMCIgeT0iMCIgd2lkdGg9IjEwMCUiIGhlaWdodD0iMTAwJSIgZmlsbD0idHJhbnNwYXJlbnQiPjwvcmVjdD4NCjxnIHRyYW5zZm9ybT0ibWF0cml4KDAgMCAwIDAgMCAwKSIgaWQ9IjgwOGVkMjgzLTI1MjQtNDQwZi04OGFlLTNiZGI0N2JiNTc0OSIgID4NCjwvZz4NCjxnIHRyYW5zZm9ybT0ibWF0cml4KDEgMCAwIDEgMTgyLjUgMjgwKSIgaWQ9ImRiMzA0MTNkLTViZmYtNGI5OC1hYjU5LTQ2NDQ5N2VlMTk5ZSIgID4NCjxyZWN0IHN0eWxlPSJzdHJva2U6IG5vbmU7IHN0cm9rZS13aWR0aDogMTsgc3Ryb2tlLWRhc2hhcnJheTogbm9uZTsgc3Ryb2tlLWxpbmVjYXA6IGJ1dHQ7IHN0cm9rZS1kYXNob2Zmc2V0OiAwOyBzdHJva2UtbGluZWpvaW46IG1pdGVyOyBzdHJva2UtbWl0ZXJsaW1pdDogNDsgZmlsbDogcmdiKDI1NSwyNTUsMjU1KTsgZmlsbC1ydWxlOiBub256ZXJvOyBvcGFjaXR5OiAxOyB2aXNpYmlsaXR5OiBoaWRkZW47IiB2ZWN0b3ItZWZmZWN0PSJub24tc2NhbGluZy1zdHJva2UiICB4PSItMTgyLjUiIHk9Ii0yODAiIHJ4PSIwIiByeT0iMCIgd2lkdGg9IjM2NSIgaGVpZ2h0PSI1NjAiIC8+DQo8L2c+DQo8ZyB0cmFuc2Zvcm09Im1hdHJpeCgwIDAgMCAwIDAgOTcuNSkiICA+DQo8ZyBzdHlsZT0iIiAgID4NCjwvZz4NCjwvZz4NCjxnIHRyYW5zZm9ybT0ibWF0cml4KDAgMCAwIDAgMCA5Ny41KSIgID4NCjxnIHN0eWxlPSIiICAgPg0KPC9nPg0KPC9nPg0KPGcgdHJhbnNmb3JtPSJtYXRyaXgoMC45OSAwIDAgMC45OSAxODIuNSAyODApIiAgPg0KPGcgc3R5bGU9IiIgdmVjdG9yLWVmZmVjdD0ibm9uLXNjYWxpbmctc3Ryb2tlIiAgID4NCgkJPGcgdHJhbnNmb3JtPSJtYXRyaXgoMSAwIDAgMSAwIDApIiAgPg0KPHJlY3Qgc3R5bGU9InN0cm9rZTogbm9uZTsgc3Ryb2tlLXdpZHRoOiAxOyBzdHJva2UtZGFzaGFycmF5OiBub25lOyBzdHJva2UtbGluZWNhcDogYnV0dDsgc3Ryb2tlLWRhc2hvZmZzZXQ6IDA7IHN0cm9rZS1saW5lam9pbjogbWl0ZXI7IHN0cm9rZS1taXRlcmxpbWl0OiA0OyBmaWxsOiByZ2IoMjU1LDI1NSwyNTUpOyBmaWxsLXJ1bGU6IG5vbnplcm87IG9wYWNpdHk6IDE7IHZpc2liaWxpdHk6IGhpZGRlbjsiIHZlY3Rvci1lZmZlY3Q9Im5vbi1zY2FsaW5nLXN0cm9rZSIgIHg9Ii01NDAiIHk9Ii01NDAiIHJ4PSIwIiByeT0iMCIgd2lkdGg9IjEwODAiIGhlaWdodD0iMTA4MCIgLz4NCjwvZz4NCgkJPGcgdHJhbnNmb3JtPSJtYXRyaXgoMSAwIDAgMSAwIDApIiAgPg0KPHBhdGggc3R5bGU9InN0cm9rZTogcmdiKDAsMCwwKTsgc3Ryb2tlLXdpZHRoOiAwOyBzdHJva2UtZGFzaGFycmF5OiBub25lOyBzdHJva2UtbGluZWNhcDogYnV0dDsgc3Ryb2tlLWRhc2hvZmZzZXQ6IDA7IHN0cm9rZS1saW5lam9pbjogbWl0ZXI7IHN0cm9rZS1taXRlcmxpbWl0OiA0OyBmaWxsOiByZ2IoMCw4OSwxMTYpOyBmaWxsLXJ1bGU6IG5vbnplcm87IG9wYWNpdHk6IDE7IiB2ZWN0b3ItZWZmZWN0PSJub24tc2NhbGluZy1zdHJva2UiICB0cmFuc2Zvcm09IiB0cmFuc2xhdGUoLTE4Mi45LCAtMjc5Ljg1KSIgZD0iTSAxODIuOSA1NTEuNyBDIDE4Mi45IDU1MS44MDAwMDAwMDAwMDAxIDE4My4xIDU1MiAxODMuMSA1NTIgQyAxODMuMSA1NTIgMzU4LjMgMjgzIDM1OC4zIDE5NC42IEMgMzU4LjMgNjQuNSAyNjkuNSA3LjkwMDAwMDAwMDAwMDAwNiAxODIuOSA3LjY5OTk5OTk5OTk5OTk4OSBDIDk2LjMgNy45IDcuNSA2NC41IDcuNSAxOTQuNiBDIDcuNSAyODMgMTgyLjggNTUyIDE4Mi44IDU1MiBDIDE4Mi44IDU1MiAxODIuOSA1NTEuNyAxODIuOSA1NTEuNyB6IE0gMTIyLjIgMTg3LjIgQyAxMjIuMiAxNTMuNiAxNDkuNCAxMjYuMzk5OTk5OTk5OTk5OTkgMTgzIDEyNi4zOTk5OTk5OTk5OTk5OSBDIDIxNi42IDEyNi4zOTk5OTk5OTk5OTk5OSAyNDMuOCAxNTMuNiAyNDMuOCAxODcuMiBDIDI0My44IDIyMC43OTk5OTk5OTk5OTk5OCAyMTYuNSAyNDggMTgyLjkgMjQ4IEMgMTQ5LjQgMjQ4IDEyMi4yIDIyMC44IDEyMi4yIDE4Ny4yIHoiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIgLz4NCjwvZz4NCgkJPGcgdHJhbnNmb3JtPSJtYXRyaXgoMy44MiAwIDAgMy44MiAwIC0xMDAuNzcpIiAgPg0KPGNpcmNsZSBzdHlsZT0ic3Ryb2tlOiByZ2IoMCwwLDApOyBzdHJva2Utd2lkdGg6IDA7IHN0cm9rZS1kYXNoYXJyYXk6IG5vbmU7IHN0cm9rZS1saW5lY2FwOiBidXR0OyBzdHJva2UtZGFzaG9mZnNldDogMDsgc3Ryb2tlLWxpbmVqb2luOiBtaXRlcjsgc3Ryb2tlLW1pdGVybGltaXQ6IDQ7IGZpbGw6IHJnYigyNTUsMjU1LDI1NSk7IGZpbGwtcnVsZTogbm9uemVybzsgb3BhY2l0eTogMTsiIHZlY3Rvci1lZmZlY3Q9Im5vbi1zY2FsaW5nLXN0cm9rZSIgIGN4PSIwIiBjeT0iMCIgcj0iMzUiIC8+DQo8L2c+DQo8L2c+DQo8L2c+DQo8L3N2Zz4="},7328:e=>{e.exports="data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIiA/Pgo8IURPQ1RZUEUgc3ZnIFBVQkxJQyAiLS8vVzNDLy9EVEQgU1ZHIDEuMS8vRU4iICJodHRwOi8vd3d3LnczLm9yZy9HcmFwaGljcy9TVkcvMS4xL0RURC9zdmcxMS5kdGQiPgo8c3ZnIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHZlcnNpb249IjEuMSIgd2lkdGg9IjM2NSIgaGVpZ2h0PSI1NjAiIHZpZXdCb3g9IjAgMCAzNjUgNTYwIiB4bWw6c3BhY2U9InByZXNlcnZlIj4KPGRlc2M+Q3JlYXRlZCB3aXRoIEZhYnJpYy5qcyA1LjIuNDwvZGVzYz4KPGRlZnM+CjwvZGVmcz4KPHJlY3QgeD0iMCIgeT0iMCIgd2lkdGg9IjEwMCUiIGhlaWdodD0iMTAwJSIgZmlsbD0idHJhbnNwYXJlbnQiPjwvcmVjdD4KPGcgdHJhbnNmb3JtPSJtYXRyaXgoMCAwIDAgMCAwIDApIiBpZD0iODA4ZWQyODMtMjUyNC00NDBmLTg4YWUtM2JkYjQ3YmI1NzQ5IiAgPgo8L2c+CjxnIHRyYW5zZm9ybT0ibWF0cml4KDEgMCAwIDEgMTgyLjUgMjgwKSIgaWQ9ImRiMzA0MTNkLTViZmYtNGI5OC1hYjU5LTQ2NDQ5N2VlMTk5ZSIgID4KPHJlY3Qgc3R5bGU9InN0cm9rZTogbm9uZTsgc3Ryb2tlLXdpZHRoOiAxOyBzdHJva2UtZGFzaGFycmF5OiBub25lOyBzdHJva2UtbGluZWNhcDogYnV0dDsgc3Ryb2tlLWRhc2hvZmZzZXQ6IDA7IHN0cm9rZS1saW5lam9pbjogbWl0ZXI7IHN0cm9rZS1taXRlcmxpbWl0OiA0OyBmaWxsOiByZ2IoMjU1LDI1NSwyNTUpOyBmaWxsLXJ1bGU6IG5vbnplcm87IG9wYWNpdHk6IDE7IHZpc2liaWxpdHk6IGhpZGRlbjsiIHZlY3Rvci1lZmZlY3Q9Im5vbi1zY2FsaW5nLXN0cm9rZSIgIHg9Ii0xODIuNSIgeT0iLTI4MCIgcng9IjAiIHJ5PSIwIiB3aWR0aD0iMzY1IiBoZWlnaHQ9IjU2MCIgLz4KPC9nPgo8ZyB0cmFuc2Zvcm09Im1hdHJpeCgwIDAgMCAwIDAgOTcuNSkiICA+CjxnIHN0eWxlPSIiICAgPgo8L2c+CjwvZz4KPGcgdHJhbnNmb3JtPSJtYXRyaXgoMCAwIDAgMCAwIDk3LjUpIiAgPgo8ZyBzdHlsZT0iIiAgID4KPC9nPgo8L2c+CjxnIHRyYW5zZm9ybT0ibWF0cml4KDAuOTkgMCAwIDAuOTkgMTgyLjUgMjgwKSIgID4KPGcgc3R5bGU9IiIgdmVjdG9yLWVmZmVjdD0ibm9uLXNjYWxpbmctc3Ryb2tlIiAgID4KCQk8ZyB0cmFuc2Zvcm09Im1hdHJpeCgxIDAgMCAxIDAgMCkiICA+CjxyZWN0IHN0eWxlPSJzdHJva2U6IG5vbmU7IHN0cm9rZS13aWR0aDogMTsgc3Ryb2tlLWRhc2hhcnJheTogbm9uZTsgc3Ryb2tlLWxpbmVjYXA6IGJ1dHQ7IHN0cm9rZS1kYXNob2Zmc2V0OiAwOyBzdHJva2UtbGluZWpvaW46IG1pdGVyOyBzdHJva2UtbWl0ZXJsaW1pdDogNDsgZmlsbDogcmdiKDI1NSwyNTUsMjU1KTsgZmlsbC1ydWxlOiBub256ZXJvOyBvcGFjaXR5OiAxOyB2aXNpYmlsaXR5OiBoaWRkZW47IiB2ZWN0b3ItZWZmZWN0PSJub24tc2NhbGluZy1zdHJva2UiICB4PSItNTQwIiB5PSItNTQwIiByeD0iMCIgcnk9IjAiIHdpZHRoPSIxMDgwIiBoZWlnaHQ9IjEwODAiIC8+CjwvZz4KCQk8ZyB0cmFuc2Zvcm09Im1hdHJpeCgxIDAgMCAxIDAgMCkiICA+CjxwYXRoIHN0eWxlPSJzdHJva2U6IHJnYigwLDAsMCk7IHN0cm9rZS13aWR0aDogMDsgc3Ryb2tlLWRhc2hhcnJheTogbm9uZTsgc3Ryb2tlLWxpbmVjYXA6IGJ1dHQ7IHN0cm9rZS1kYXNob2Zmc2V0OiAwOyBzdHJva2UtbGluZWpvaW46IG1pdGVyOyBzdHJva2UtbWl0ZXJsaW1pdDogNDsgZmlsbDogcmdiKDI1NSwxNjUsMCk7IGZpbGwtcnVsZTogbm9uemVybzsgb3BhY2l0eTogMTsiIHZlY3Rvci1lZmZlY3Q9Im5vbi1zY2FsaW5nLXN0cm9rZSIgIHRyYW5zZm9ybT0iIHRyYW5zbGF0ZSgtMTgyLjksIC0yNzkuODUpIiBkPSJNIDE4Mi45IDU1MS43IEMgMTgyLjkgNTUxLjgwMDAwMDAwMDAwMDEgMTgzLjEgNTUyIDE4My4xIDU1MiBDIDE4My4xIDU1MiAzNTguMyAyODMgMzU4LjMgMTk0LjYgQyAzNTguMyA2NC41IDI2OS41IDcuOTAwMDAwMDAwMDAwMDA2IDE4Mi45IDcuNjk5OTk5OTk5OTk5OTg5IEMgOTYuMyA3LjkgNy41IDY0LjUgNy41IDE5NC42IEMgNy41IDI4MyAxODIuOCA1NTIgMTgyLjggNTUyIEMgMTgyLjggNTUyIDE4Mi45IDU1MS43IDE4Mi45IDU1MS43IHogTSAxMjIuMiAxODcuMiBDIDEyMi4yIDE1My42IDE0OS40IDEyNi4zOTk5OTk5OTk5OTk5OSAxODMgMTI2LjM5OTk5OTk5OTk5OTk5IEMgMjE2LjYgMTI2LjM5OTk5OTk5OTk5OTk5IDI0My44IDE1My42IDI0My44IDE4Ny4yIEMgMjQzLjggMjIwLjc5OTk5OTk5OTk5OTk4IDIxNi41IDI0OCAxODIuOSAyNDggQyAxNDkuNCAyNDggMTIyLjIgMjIwLjggMTIyLjIgMTg3LjIgeiIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiAvPgo8L2c+CgkJPGcgdHJhbnNmb3JtPSJtYXRyaXgoMy44MiAwIDAgMy44MiAwIC0xMDAuNzcpIiAgPgo8Y2lyY2xlIHN0eWxlPSJzdHJva2U6IHJnYigwLDAsMCk7IHN0cm9rZS13aWR0aDogMDsgc3Ryb2tlLWRhc2hhcnJheTogbm9uZTsgc3Ryb2tlLWxpbmVjYXA6IGJ1dHQ7IHN0cm9rZS1kYXNob2Zmc2V0OiAwOyBzdHJva2UtbGluZWpvaW46IG1pdGVyOyBzdHJva2UtbWl0ZXJsaW1pdDogNDsgZmlsbDogcmdiKDI1NSwyNTUsMjU1KTsgZmlsbC1ydWxlOiBub256ZXJvOyBvcGFjaXR5OiAxOyIgdmVjdG9yLWVmZmVjdD0ibm9uLXNjYWxpbmctc3Ryb2tlIiAgY3g9IjAiIGN5PSIwIiByPSIzNSIgLz4KPC9nPgo8L2c+CjwvZz4KPC9zdmc+"},9425:(e,t,r)=>{"use strict";r.d(t,{B:()=>n});var i=r(1515);class n extends i.Loader{constructor(e){super(e),this.dracoLoader=null,this.ktx2Loader=null,this.meshoptDecoder=null,this.pluginCallbacks=[],this.register((function(e){return new h(e)})),this.register((function(e){return new u(e)})),this.register((function(e){return new d(e)})),this.register((function(e){return new c(e)})),this.register((function(e){return new o(e)})),this.register((function(e){return new p(e)}))}load(e,t,r,n){var a,s=this;a=""===this.resourcePath?""===this.path?i.LoaderUtils.extractUrlBase(e):this.path:this.resourcePath,this.manager.itemStart(e);var o=function(t){n?n(t):console.error(t),s.manager.itemError(e),s.manager.itemEnd(e)},l=new i.FileLoader(this.manager);l.setPath(this.path),l.setResponseType("arraybuffer"),l.setRequestHeader(this.requestHeader),l.setWithCredentials(this.withCredentials),l.load(e,(function(r){try{s.parse(r,a,(function(r){t(r),s.manager.itemEnd(e)}),o)}catch(e){o(e)}}),r,o)}setDRACOLoader(e){return this.dracoLoader=e,this}setDDSLoader(){throw new Error('THREE.GLTFLoader: "MSFT_texture_dds" no longer supported. Please update to "KHR_texture_basisu".')}setKTX2Loader(e){return this.ktx2Loader=e,this}setMeshoptDecoder(e){return this.meshoptDecoder=e,this}register(e){return-1===this.pluginCallbacks.indexOf(e)&&this.pluginCallbacks.push(e),this}unregister(e){return-1!==this.pluginCallbacks.indexOf(e)&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(e),1),this}parse(e,t,r,n){var a,o={},h={};if("string"==typeof e)a=e;else if(i.LoaderUtils.decodeText(new Uint8Array(e,0,4))===m){try{o[s.KHR_BINARY_GLTF]=new f(e)}catch(e){return void(n&&n(e))}a=o[s.KHR_BINARY_GLTF].content}else a=i.LoaderUtils.decodeText(new Uint8Array(e));var c=JSON.parse(a);if(void 0===c.asset||2>c.asset.version[0])n&&n(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));else{var u=new N(c,{path:t||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});u.fileLoader.setRequestHeader(this.requestHeader);for(var d,p=0;pthis.header.version)throw new Error("THREE.GLTFLoader: Legacy binary file detected.");for(var r,n=this.header.length-12,a=new DataView(e,12),o=0;o",t).replace("#include ",r).replace("#include ",n).replace("#include ",a).replace("#include ",s)},Object.defineProperties(this,{specular:{get:function(){return o.specular.value},set:function(e){o.specular.value=e}},specularMap:{get:function(){return o.specularMap.value},set:function(e){o.specularMap.value=e,e?this.defines.USE_SPECULARMAP="":delete this.defines.USE_SPECULARMAP}},glossiness:{get:function(){return o.glossiness.value},set:function(e){o.glossiness.value=e}},glossinessMap:{get:function(){return o.glossinessMap.value},set:function(e){o.glossinessMap.value=e,e?(this.defines.USE_GLOSSINESSMAP="",this.defines.USE_UV=""):(delete this.defines.USE_GLOSSINESSMAP,delete this.defines.USE_UV)}}}),delete this.metalness,delete this.roughness,delete this.metalnessMap,delete this.roughnessMap,this.setValues(e)}copy(e){return super.copy(e),this.specularMap=e.specularMap,this.specular.copy(e.specular),this.glossinessMap=e.glossinessMap,this.glossiness=e.glossiness,delete this.metalness,delete this.roughness,delete this.metalnessMap,delete this.roughnessMap,this}}class x{constructor(){this.name=s.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS,this.specularGlossinessParams=["color","map","lightMap","lightMapIntensity","aoMap","aoMapIntensity","emissive","emissiveIntensity","emissiveMap","bumpMap","bumpScale","normalMap","normalMapType","displacementMap","displacementScale","displacementBias","specularMap","specular","glossinessMap","glossiness","alphaMap","envMap","envMapIntensity","refractionRatio"]}getMaterialType(){return y}extendParams(e,t,r){var n=t.extensions[this.name];e.color=new i.Color(1,1,1),e.opacity=1;var a=[];if(Array.isArray(n.diffuseFactor)){var s=n.diffuseFactor;e.color.fromArray(s),e.opacity=s[3]}if(void 0!==n.diffuseTexture&&a.push(r.assignTexture(e,"map",n.diffuseTexture)),e.emissive=new i.Color(0,0,0),e.glossiness=void 0===n.glossinessFactor?1:n.glossinessFactor,e.specular=new i.Color(1,1,1),Array.isArray(n.specularFactor)&&e.specular.fromArray(n.specularFactor),void 0!==n.specularGlossinessTexture){var o=n.specularGlossinessTexture;a.push(r.assignTexture(e,"glossinessMap",o)),a.push(r.assignTexture(e,"specularMap",o))}return Promise.all(a)}createMaterial(e){var t=new y(e);return t.fog=!0,t.color=e.color,t.map=void 0===e.map?null:e.map,t.lightMap=null,t.lightMapIntensity=1,t.aoMap=void 0===e.aoMap?null:e.aoMap,t.aoMapIntensity=1,t.emissive=e.emissive,t.emissiveIntensity=1,t.emissiveMap=void 0===e.emissiveMap?null:e.emissiveMap,t.bumpMap=void 0===e.bumpMap?null:e.bumpMap,t.bumpScale=1,t.normalMap=void 0===e.normalMap?null:e.normalMap,t.normalMapType=i.TangentSpaceNormalMap,e.normalScale&&(t.normalScale=e.normalScale),t.displacementMap=null,t.displacementScale=1,t.displacementBias=0,t.specularMap=void 0===e.specularMap?null:e.specularMap,t.specular=e.specular,t.glossinessMap=void 0===e.glossinessMap?null:e.glossinessMap,t.glossiness=e.glossiness,t.alphaMap=null,t.envMap=void 0===e.envMap?null:e.envMap,t.envMapIntensity=1,t.refractionRatio=.98,t}}class b{constructor(){this.name=s.KHR_MESH_QUANTIZATION}}class w extends i.Interpolant{constructor(e,t,r,i){super(e,t,r,i)}copySampleValue_(e){for(var t=this.resultBuffer,r=this.sampleValues,i=this.valueSize,n=0;n!==i;n++)t[n]=r[e*i*3+i+n];return t}}w.prototype.beforeStart_=w.prototype.copySampleValue_,w.prototype.afterEnd_=w.prototype.copySampleValue_,w.prototype.interpolate_=function(e,t,r,i){for(var n=this.resultBuffer,a=this.sampleValues,s=this.valueSize,o=3*s,l=i-t,h=(r-t)/l,c=h*h,u=c*h,d=e*o,p=d-o,m=-2*u+3*c,f=u-c,v=0;v!==s;v++){var g=a[p+v+s],y=a[p+v+2*s]*l,x=a[d+v+s],b=a[d+v]*l;n[v]=(1-m)*g+(f-c+h)*y+m*x+f*b}return n};var _={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},M={9728:i.NearestFilter,9729:i.LinearFilter,9984:i.NearestMipmapNearestFilter,9985:i.LinearMipmapNearestFilter,9986:i.NearestMipmapLinearFilter,9987:i.LinearMipmapLinearFilter},S={33071:i.ClampToEdgeWrapping,33648:i.MirroredRepeatWrapping,10497:i.RepeatWrapping},T={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},E={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",TEXCOORD_0:"uv",TEXCOORD_1:"uv2",COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},A={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},L={CUBICSPLINE:void 0,LINEAR:i.InterpolateLinear,STEP:i.InterpolateDiscrete};function R(e,t){return"string"!=typeof e||""===e?"":(/^https?:\/\//i.test(t)&&/^\//.test(e)&&(t=t.replace(/(^https?:\/\/[^\/]+).*/i,"$1")),/^(https?:)?\/\//i.test(e)||/^data:.*,.*$/i.test(e)||/^blob:.*$/i.test(e)?e:t+e)}function C(e,t,r){for(var i in r.extensions)void 0===e[i]&&(t.userData.gltfExtensions=t.userData.gltfExtensions||{},t.userData.gltfExtensions[i]=r.extensions[i])}function P(e,t){void 0!==t.extras&&("object"==typeof t.extras?Object.assign(e.userData,t.extras):console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+t.extras))}function I(e,t){if(e.updateMorphTargets(),void 0!==t.weights)for(var r=0,i=t.weights.length;r=e.refs[t])return r;var i=r.clone();return i.name+="_instance_"+e.uses[t]++,i}_invokeOne(e){var t=Object.values(this.plugins);t.push(this);for(var r,i=0;i{"use strict";e.exports=JSON.parse('{"name":"zincjs","version":"1.11.4","description":"ZincJS (Web-based-Zinc-Visualisation)","main":"build/zinc.js","directories":{"doc":"docs"},"files":["package.json","LICENSE","README.md","src/*","build/zinc.js","build/zinc.frontend.js","build/zinc.js.map","webpack.config.js"],"scripts":{"build-bundle":"webpack --config webpack.frontend.js; webpack --config webpack.backend.js","build-backend":"webpack --config webpack.backend.js","test":"npm --prefix ./test install && npm --prefix ./test run test-ci","changelog":"auto-changelog -p --output CHANGELOG.md --template keepachangelog","jsdoc":"jsdoc -c jsdoc_conf.json","version":"npm run build-bundle;npm run jsdoc;npm run changelog; git add CHANGELOG.md docs","release:beta":"npm version prerelease --preid=beta; npm publish --tag beta","release:minor":"npm version minor; npm publish","release:patch":"npm version patch; npm publish"},"repository":{"type":"git","url":"git+https://github.com/alan-wu/ZincJS.git"},"keywords":["library","webgl","3d","zincjs"],"author":"Alan Wu ","license":"MIT","bugs":{"url":"https://github.com/alan-wu/ZincJS/issues"},"homepage":"http://alan-wu.github.io/ZincJS/","devDependencies":{"@babel/core":"^7.23.9","@babel/preset-env":"^7.23.9","auto-changelog":"^2.4.0","babel-loader":"^9.1.3","babel-preset-minify":"^0.5.1","file-loader":"^6.2.0","jsdoc":"^4.0.2","raw-loader":"^4.0.2","webpack":"^5.90.3","webpack-cli":"^5.1.4","webpack-node-externals":"^3.0.0"},"dependencies":{"css-element-queries":"^1.2.2","lodash":"^4.17.19","promise-polyfill":"^8.1.3","three":"^0.130.1","three-spritetext":"1.6.2","url-loader":"^4.1.1","url-polyfill":"^1.1.7","webworkify-webpack":"^2.1.5"}}')}},t={};function r(i){var n=t[i];if(void 0!==n)return n.exports;var a=t[i]={exports:{}};return e[i].call(a.exports,a,a.exports,r),a.exports}return r.m=e,r.d=(e,t)=>{for(var i in t)r.o(t,i)&&!r.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r(1913)})())); //# sourceMappingURL=zinc.frontend.js.map